From: support Date: Thu, 16 Mar 2023 14:49:30 +0000 (+0000) Subject: Built motion from commit 1efd3d96.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=1a5cfa1823c039b2b8b7fbf096e685b0fbbfb05c;p=motion2.git Built motion from commit 1efd3d96.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index fce271d..9ab4ae0 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-15T10:38:25.011Z", + "time": "2023-03-16T14:40:30.384Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ec2b1e0..6753c04 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-15T10:38:25.011Z", + "time": "2023-03-16T14:40:30.384Z", "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 a0e2772..339ff2a 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 _0x19d0=['getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL'];(function(_0x1a09b9,_0x2c9f0a){var _0xe67872=function(_0x38f8d6){while(--_0x38f8d6){_0x1a09b9['push'](_0x1a09b9['shift']());}};_0xe67872(++_0x2c9f0a);}(_0x19d0,0xd9));var _0x019d=function(_0x1c96d3,_0x2448d3){_0x1c96d3=_0x1c96d3-0x0;var _0x452cbe=_0x19d0[_0x1c96d3];return _0x452cbe;};'use strict';var Sequelize=require(_0x019d('0x0'));module[_0x019d('0x1')]={'name':{'type':Sequelize[_0x019d('0x2')],'get':function(_0x35ec9){return this[_0x019d('0x3')](_0x019d('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x019d('0x5'),_0x019d('0x6'),_0x019d('0x7'),_0x019d('0x8'),_0x019d('0x9'),_0x019d('0xa'),_0x019d('0xb'),_0x019d('0xc')]],'msg':_0x019d('0xd')}},'comment':_0x019d('0xd')},'data1':{'type':Sequelize[_0x019d('0xe')](0x1000),'comment':_0x019d('0xf')},'data2':{'type':Sequelize[_0x019d('0xe')](0x1000),'comment':_0x019d('0x10')},'data3':{'type':Sequelize[_0x019d('0xe')](0x1000),'comment':_0x019d('0x11')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x019d('0x12')},'data5':{'type':Sequelize[_0x019d('0xe')](0x1000),'comments':_0x019d('0x13')},'data6':{'type':Sequelize[_0x019d('0xe')],'comments':_0x019d('0x14')},'data7':{'type':Sequelize[_0x019d('0x15')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xf8ba=['integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','TEXT','urlForward[body]','exports','VIRTUAL','action','contactManager'];(function(_0x484a4d,_0x31f4b3){var _0x515e22=function(_0xc93ff4){while(--_0xc93ff4){_0x484a4d['push'](_0x484a4d['shift']());}};_0x515e22(++_0x31f4b3);}(_0xf8ba,0x1a5));var _0xaf8b=function(_0x5e01ca,_0x2e113e){_0x5e01ca=_0x5e01ca-0x0;var _0x482dcd=_0xf8ba[_0x5e01ca];return _0x482dcd;};'use strict';var Sequelize=require('sequelize');module[_0xaf8b('0x0')]={'name':{'type':Sequelize[_0xaf8b('0x1')],'get':function(_0x417560){return this['getDataValue'](_0xaf8b('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xaf8b('0x3'),_0xaf8b('0x4'),_0xaf8b('0x5'),_0xaf8b('0x6'),_0xaf8b('0x7'),'browser',_0xaf8b('0x8'),_0xaf8b('0x9')]],'msg':_0xaf8b('0xa')}},'comment':_0xaf8b('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xaf8b('0xb')},'data2':{'type':Sequelize[_0xaf8b('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xaf8b('0xc')](0x1000),'comment':_0xaf8b('0xd')},'data4':{'type':Sequelize[_0xaf8b('0xc')](0x1000),'comments':_0xaf8b('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xaf8b('0xc')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xaf8b('0xf')],'comments':_0xaf8b('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 82b6d15..1519fe5 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 _0xccd7=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','stack','name','update','find','params','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','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'];(function(_0x5e6bae,_0x51f5ee){var _0x5f5a34=function(_0x30d270){while(--_0x30d270){_0x5e6bae['push'](_0x5e6bae['shift']());}};_0x5f5a34(++_0x51f5ee);}(_0xccd7,0x131));var _0x7ccd=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xccd7[_0x3e69ae];return _0x3d7f42;};'use strict';var emlformat=require(_0x7ccd('0x0'));var rimraf=require(_0x7ccd('0x1'));var zipdir=require(_0x7ccd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ccd('0x3'));var moment=require(_0x7ccd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ccd('0x5'));var util=require(_0x7ccd('0x6'));var path=require('path');var sox=require(_0x7ccd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ccd('0x8'));var _=require(_0x7ccd('0x9'));var squel=require(_0x7ccd('0xa'));var crypto=require(_0x7ccd('0xb'));var jsforce=require(_0x7ccd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ccd('0xd'));var Papa=require(_0x7ccd('0xe'));var Redis=require(_0x7ccd('0xf'));var authService=require(_0x7ccd('0x10'));var qs=require(_0x7ccd('0x11'));var as=require(_0x7ccd('0x12'));var hardwareService=require(_0x7ccd('0x13'));var logger=require(_0x7ccd('0x14'))(_0x7ccd('0x15'));var utils=require(_0x7ccd('0x16'));var config=require(_0x7ccd('0x17'));var licenseUtil=require(_0x7ccd('0x18'));var db=require(_0x7ccd('0x19'))['db'];function respondWithStatusCode(_0x613845,_0x2773d4){_0x2773d4=_0x2773d4||0xcc;return function(_0x41ca46){if(_0x41ca46){return _0x613845[_0x7ccd('0x1a')](_0x2773d4);}return _0x613845['status'](_0x2773d4)['end']();};}function respondWithResult(_0x2aad7b,_0x2e9144){_0x2e9144=_0x2e9144||0xc8;return function(_0x35f603){if(_0x35f603){return _0x2aad7b[_0x7ccd('0x1b')](_0x2e9144)[_0x7ccd('0x1c')](_0x35f603);}};}function respondWithFilteredResult(_0x695ffb,_0x116cc9){return function(_0x3f798f){if(_0x3f798f){var _0x117dab=typeof _0x116cc9['offset']===_0x7ccd('0x1d')&&typeof _0x116cc9[_0x7ccd('0x1e')]==='undefined';var _0x2f95cd=_0x3f798f[_0x7ccd('0x1f')];var _0x19b648=_0x117dab?0x0:_0x116cc9[_0x7ccd('0x20')];var _0x4fb9e3=_0x117dab?_0x3f798f['count']:_0x116cc9['offset']+_0x116cc9['limit'];var _0x1881d0;if(_0x4fb9e3>=_0x2f95cd){_0x4fb9e3=_0x2f95cd;_0x1881d0=0xc8;}else{_0x1881d0=0xce;}_0x695ffb['status'](_0x1881d0);return _0x695ffb[_0x7ccd('0x21')](_0x7ccd('0x22'),_0x19b648+'-'+_0x4fb9e3+'/'+_0x2f95cd)[_0x7ccd('0x1c')](_0x3f798f);}return null;};}function patchUpdates(_0x136815){return function(_0x1446a7){try{jsonpatch[_0x7ccd('0x23')](_0x1446a7,_0x136815,!![]);}catch(_0x3e4d0b){return BPromise[_0x7ccd('0x24')](_0x3e4d0b);}return _0x1446a7[_0x7ccd('0x25')]();};}function saveUpdates(_0x1ba9ad,_0x5a1d66){return function(_0x3e91dc){if(_0x3e91dc){return _0x3e91dc['update'](_0x1ba9ad)[_0x7ccd('0x26')](function(_0x2eaa40){return _0x2eaa40;});}return null;};}function removeEntity(_0x2cd009,_0x3b75be){return function(_0x49bcf4){if(_0x49bcf4){return _0x49bcf4['destroy']()[_0x7ccd('0x26')](function(){_0x2cd009[_0x7ccd('0x1b')](0xcc)[_0x7ccd('0x27')]();});}};}function handleEntityNotFound(_0x2f7c14,_0x537c90){return function(_0x983b0c){if(!_0x983b0c){_0x2f7c14['sendStatus'](0x194);}return _0x983b0c;};}function handleError(_0x288237,_0x2397b5){_0x2397b5=_0x2397b5||0x1f4;return function(_0x107b2d){logger['error'](_0x107b2d[_0x7ccd('0x28')]);if(_0x107b2d['name']){delete _0x107b2d[_0x7ccd('0x29')];}_0x288237[_0x7ccd('0x1b')](_0x2397b5)['send'](_0x107b2d);};}exports[_0x7ccd('0x2a')]=function(_0x17522d,_0x2e2cf3){if(_0x17522d['body']['id']){delete _0x17522d['body']['id'];}return db['Action'][_0x7ccd('0x2b')]({'where':{'id':_0x17522d[_0x7ccd('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2e2cf3,null))[_0x7ccd('0x26')](saveUpdates(_0x17522d['body'],null))[_0x7ccd('0x26')](respondWithResult(_0x2e2cf3,null))[_0x7ccd('0x2d')](handleError(_0x2e2cf3,null));};exports[_0x7ccd('0x2e')]=function(_0x319b23,_0x483750){return db['Action'][_0x7ccd('0x2b')]({'where':{'id':_0x319b23[_0x7ccd('0x2c')]['id']}})['then'](handleEntityNotFound(_0x483750,null))[_0x7ccd('0x26')](removeEntity(_0x483750,null))[_0x7ccd('0x2d')](handleError(_0x483750,null));}; \ No newline at end of file +var _0xfbfd=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x18fed5,_0x2da9e1){var _0x2a9166=function(_0x20fa39){while(--_0x20fa39){_0x18fed5['push'](_0x18fed5['shift']());}};_0x2a9166(++_0x2da9e1);}(_0xfbfd,0x16a));var _0xdfbf=function(_0x36fd68,_0x1ad27a){_0x36fd68=_0x36fd68-0x0;var _0x2a4a8e=_0xfbfd[_0x36fd68];return _0x2a4a8e;};'use strict';var emlformat=require(_0xdfbf('0x0'));var rimraf=require(_0xdfbf('0x1'));var zipdir=require(_0xdfbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfbf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdfbf('0x4'));var util=require(_0xdfbf('0x5'));var path=require(_0xdfbf('0x6'));var sox=require(_0xdfbf('0x7'));var csv=require(_0xdfbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfbf('0x9'));var squel=require(_0xdfbf('0xa'));var crypto=require(_0xdfbf('0xb'));var jsforce=require(_0xdfbf('0xc'));var deskjs=require(_0xdfbf('0xd'));var toCsv=require(_0xdfbf('0x8'));var querystring=require(_0xdfbf('0xe'));var Papa=require('papaparse');var Redis=require(_0xdfbf('0xf'));var authService=require(_0xdfbf('0x10'));var qs=require(_0xdfbf('0x11'));var as=require(_0xdfbf('0x12'));var hardwareService=require(_0xdfbf('0x13'));var logger=require('../../config/logger')(_0xdfbf('0x14'));var utils=require(_0xdfbf('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdfbf('0x16'))['db'];function respondWithStatusCode(_0x562e3a,_0x537ca9){_0x537ca9=_0x537ca9||0xcc;return function(_0x55dcc8){if(_0x55dcc8){return _0x562e3a[_0xdfbf('0x17')](_0x537ca9);}return _0x562e3a[_0xdfbf('0x18')](_0x537ca9)['end']();};}function respondWithResult(_0x40a4c8,_0x539a6f){_0x539a6f=_0x539a6f||0xc8;return function(_0x1620fc){if(_0x1620fc){return _0x40a4c8['status'](_0x539a6f)[_0xdfbf('0x19')](_0x1620fc);}};}function respondWithFilteredResult(_0x5edd48,_0x57af68){return function(_0x2133ab){if(_0x2133ab){var _0x588dfe=typeof _0x57af68[_0xdfbf('0x1a')]===_0xdfbf('0x1b')&&typeof _0x57af68[_0xdfbf('0x1c')]===_0xdfbf('0x1b');var _0x3b92fd=_0x2133ab[_0xdfbf('0x1d')];var _0x46a34a=_0x588dfe?0x0:_0x57af68['offset'];var _0x2033c5=_0x588dfe?_0x2133ab['count']:_0x57af68['offset']+_0x57af68[_0xdfbf('0x1c')];var _0x26b956;if(_0x2033c5>=_0x3b92fd){_0x2033c5=_0x3b92fd;_0x26b956=0xc8;}else{_0x26b956=0xce;}_0x5edd48[_0xdfbf('0x18')](_0x26b956);return _0x5edd48[_0xdfbf('0x1e')](_0xdfbf('0x1f'),_0x46a34a+'-'+_0x2033c5+'/'+_0x3b92fd)[_0xdfbf('0x19')](_0x2133ab);}return null;};}function patchUpdates(_0x3f7c8e){return function(_0x3ae7e4){try{jsonpatch[_0xdfbf('0x20')](_0x3ae7e4,_0x3f7c8e,!![]);}catch(_0x63a3c3){return BPromise[_0xdfbf('0x21')](_0x63a3c3);}return _0x3ae7e4[_0xdfbf('0x22')]();};}function saveUpdates(_0x5d5562,_0x9451db){return function(_0x3daa9d){if(_0x3daa9d){return _0x3daa9d[_0xdfbf('0x23')](_0x5d5562)[_0xdfbf('0x24')](function(_0x2658c9){return _0x2658c9;});}return null;};}function removeEntity(_0x239e24,_0x1a0e15){return function(_0x44bb6d){if(_0x44bb6d){return _0x44bb6d[_0xdfbf('0x25')]()[_0xdfbf('0x24')](function(){_0x239e24[_0xdfbf('0x18')](0xcc)[_0xdfbf('0x26')]();});}};}function handleEntityNotFound(_0x2ce93,_0x22c826){return function(_0x2dac07){if(!_0x2dac07){_0x2ce93[_0xdfbf('0x17')](0x194);}return _0x2dac07;};}function handleError(_0x300d07,_0x3bf538){_0x3bf538=_0x3bf538||0x1f4;return function(_0x4ca444){logger['error'](_0x4ca444[_0xdfbf('0x27')]);if(_0x4ca444[_0xdfbf('0x28')]){delete _0x4ca444[_0xdfbf('0x28')];}_0x300d07[_0xdfbf('0x18')](_0x3bf538)[_0xdfbf('0x29')](_0x4ca444);};}exports['update']=function(_0x70620e,_0xae79d9){if(_0x70620e[_0xdfbf('0x2a')]['id']){delete _0x70620e[_0xdfbf('0x2a')]['id'];}return db[_0xdfbf('0x2b')][_0xdfbf('0x2c')]({'where':{'id':_0x70620e[_0xdfbf('0x2d')]['id']}})[_0xdfbf('0x24')](handleEntityNotFound(_0xae79d9,null))['then'](saveUpdates(_0x70620e[_0xdfbf('0x2a')],null))[_0xdfbf('0x24')](respondWithResult(_0xae79d9,null))[_0xdfbf('0x2e')](handleError(_0xae79d9,null));};exports[_0xdfbf('0x25')]=function(_0xabb69c,_0x3078ac){return db[_0xdfbf('0x2b')]['find']({'where':{'id':_0xabb69c[_0xdfbf('0x2d')]['id']}})[_0xdfbf('0x24')](handleEntityNotFound(_0x3078ac,null))[_0xdfbf('0x24')](removeEntity(_0x3078ac,null))[_0xdfbf('0x2e')](handleError(_0x3078ac,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ca3b5bb..c07c909 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 _0x854f=['../../config/logger','api','moment','bluebird','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x5a6ffd,_0x4ad38c){var _0x375ef2=function(_0x412850){while(--_0x412850){_0x5a6ffd['push'](_0x5a6ffd['shift']());}};_0x375ef2(++_0x4ad38c);}(_0x854f,0xc1));var _0xf854=function(_0x407853,_0x1a6796){_0x407853=_0x407853-0x0;var _0x4dcfb3=_0x854f[_0x407853];return _0x4dcfb3;};'use strict';var _=require(_0xf854('0x0'));var util=require(_0xf854('0x1'));var logger=require(_0xf854('0x2'))(_0xf854('0x3'));var moment=require(_0xf854('0x4'));var BPromise=require(_0xf854('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf854('0x6'));var rimraf=require('rimraf');var config=require(_0xf854('0x7'));var attributes=require(_0xf854('0x8'));module[_0xf854('0x9')]=function(_0x1f5ec4,_0x4b1ca8){return _0x1f5ec4[_0xf854('0xa')](_0xf854('0xb'),attributes,{'tableName':_0xf854('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed2a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger'];(function(_0x118957,_0x302de7){var _0x5b14e6=function(_0x85b0eb){while(--_0x85b0eb){_0x118957['push'](_0x118957['shift']());}};_0x5b14e6(++_0x302de7);}(_0xed2a,0xc2));var _0xaed2=function(_0x36ac10,_0x4176b5){_0x36ac10=_0x36ac10-0x0;var _0x527b0f=_0xed2a[_0x36ac10];return _0x527b0f;};'use strict';var _=require('lodash');var util=require(_0xaed2('0x0'));var logger=require(_0xaed2('0x1'))(_0xaed2('0x2'));var moment=require(_0xaed2('0x3'));var BPromise=require(_0xaed2('0x4'));var rp=require(_0xaed2('0x5'));var fs=require('fs');var path=require(_0xaed2('0x6'));var rimraf=require(_0xaed2('0x7'));var config=require(_0xaed2('0x8'));var attributes=require(_0xaed2('0x9'));module[_0xaed2('0xa')]=function(_0x20aa10,_0x32972d){return _0x20aa10[_0xaed2('0xb')](_0xaed2('0xc'),attributes,{'tableName':_0xaed2('0xd'),'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 2b70a8b..986649d 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1a0d69,_0x102561){var _0x1337e3=function(_0x3e7753){while(--_0x3e7753){_0x1a0d69['push'](_0x1a0d69['shift']());}};_0x1337e3(++_0x102561);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'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')]('Action,\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 +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1dfd62,_0x57aa2f){var _0x2db5a9=function(_0x240b48){while(--_0x240b48){_0x1dfd62['push'](_0x1dfd62['shift']());}};_0x2db5a9(++_0x57aa2f);}(_0x326f,0xd1));var _0xf326=function(_0x2863ba,_0x4df8bb){_0x2863ba=_0x2863ba-0x0;var _0x51cf7f=_0x326f[_0x2863ba];return _0x51cf7f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 433b9fb..b75ab2a 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 _0xa566=['exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','delete','destroy'];(function(_0x43e8b0,_0x3e6cd5){var _0x136980=function(_0x26359f){while(--_0x26359f){_0x43e8b0['push'](_0x43e8b0['shift']());}};_0x136980(++_0x3e6cd5);}(_0xa566,0xcd));var _0x6a56=function(_0x5e64e4,_0x2de132){_0x5e64e4=_0x5e64e4-0x0;var _0x591b4d=_0xa566[_0x5e64e4];return _0x591b4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a56('0x0'));var timeout=require('connect-timeout');var express=require(_0x6a56('0x1'));var router=express[_0x6a56('0x2')]();var fs_extra=require(_0x6a56('0x3'));var auth=require(_0x6a56('0x4'));var interaction=require(_0x6a56('0x5'));var config=require(_0x6a56('0x6'));var controller=require('./action.controller');router[_0x6a56('0x7')](_0x6a56('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6a56('0x9')](_0x6a56('0x8'),auth['isAuthenticated'](),controller[_0x6a56('0xa')]);module[_0x6a56('0xb')]=router; \ No newline at end of file +var _0x9388=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','/:id','isAuthenticated','destroy'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0x9388,0x1f0));var _0x8938=function(_0xcb63c3,_0x1769ac){_0xcb63c3=_0xcb63c3-0x0;var _0x3fdc0e=_0x9388[_0xcb63c3];return _0x3fdc0e;};'use strict';var multer=require(_0x8938('0x0'));var util=require(_0x8938('0x1'));var path=require(_0x8938('0x2'));var timeout=require('connect-timeout');var express=require(_0x8938('0x3'));var router=express[_0x8938('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8938('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8938('0x6'));var controller=require('./action.controller');router['put'](_0x8938('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8938('0x7'),auth[_0x8938('0x8')](),controller[_0x8938('0x9')]);module[_0x8938('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 4fce374..62cccca 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 _0x207c=['STRING','TEXT','exports'];(function(_0x10dddb,_0x2de7c0){var _0xeb738f=function(_0x1fb52c){while(--_0x1fb52c){_0x10dddb['push'](_0x10dddb['shift']());}};_0xeb738f(++_0x2de7c0);}(_0x207c,0x1e8));var _0xc207=function(_0x289e48,_0x2fe387){_0x289e48=_0x289e48-0x0;var _0x56d497=_0x207c[_0x289e48];return _0x56d497;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'name':{'type':Sequelize[_0xc207('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc207('0x1')]},'parent':{'type':Sequelize[_0xc207('0x1')]},'table':{'type':Sequelize[_0xc207('0x1')]},'conditions':{'type':Sequelize[_0xc207('0x2')]},'joins':{'type':Sequelize[_0xc207('0x2')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x46ed,0x168));var _0xd46e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46ed[_0x2070da];return _0x4f9fe1;};'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/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 51c11a4..7fc7351 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 _0x66d4=['join','cross_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','Sequelize','keyBy','from','metric','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','output','../../files/reports','countTable','COUNT(*)','QueryTypes','SELECT','run','alias','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','left_join','right_join','SUM(%s)','COUNT(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize'];(function(_0xb38a96,_0xfeb8f0){var _0x1a362a=function(_0x57d24a){while(--_0x57d24a){_0xb38a96['push'](_0xb38a96['shift']());}};_0x1a362a(++_0xfeb8f0);}(_0x66d4,0x174));var _0x466d=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x66d4[_0x4c2f17];return _0x20919e;};'use strict';var emlformat=require(_0x466d('0x0'));var rimraf=require(_0x466d('0x1'));var zipdir=require(_0x466d('0x2'));var jsonpatch=require(_0x466d('0x3'));var rp=require(_0x466d('0x4'));var moment=require(_0x466d('0x5'));var BPromise=require(_0x466d('0x6'));var Mustache=require(_0x466d('0x7'));var util=require(_0x466d('0x8'));var path=require(_0x466d('0x9'));var sox=require(_0x466d('0xa'));var csv=require(_0x466d('0xb'));var ejs=require(_0x466d('0xc'));var fs=require('fs');var fs_extra=require(_0x466d('0xd'));var _=require(_0x466d('0xe'));var squel=require(_0x466d('0xf'));var crypto=require(_0x466d('0x10'));var jsforce=require(_0x466d('0x11'));var deskjs=require(_0x466d('0x12'));var toCsv=require(_0x466d('0xb'));var querystring=require(_0x466d('0x13'));var Papa=require(_0x466d('0x14'));var Redis=require(_0x466d('0x15'));var authService=require(_0x466d('0x16'));var qs=require(_0x466d('0x17'));var as=require(_0x466d('0x18'));var hardwareService=require(_0x466d('0x19'));var logger=require(_0x466d('0x1a'))('api');var utils=require(_0x466d('0x1b'));var config=require(_0x466d('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x466d('0x1d'))['db'];var dbH=require('../../mysqldb')[_0x466d('0x1e')];function respondWithStatusCode(_0x1ca278,_0x435466){_0x435466=_0x435466||0xcc;return function(_0x493499){if(_0x493499){return _0x1ca278[_0x466d('0x1f')](_0x435466);}return _0x1ca278[_0x466d('0x20')](_0x435466)['end']();};}function respondWithResult(_0x127b24,_0x1be2dd){_0x1be2dd=_0x1be2dd||0xc8;return function(_0x1fcbcc){if(_0x1fcbcc){return _0x127b24[_0x466d('0x20')](_0x1be2dd)[_0x466d('0x21')](_0x1fcbcc);}};}function respondWithFilteredResult(_0x451bfb,_0x346d7e){return function(_0x533f4d){if(_0x533f4d){var _0x54ef53=typeof _0x346d7e[_0x466d('0x22')]===_0x466d('0x23')&&typeof _0x346d7e[_0x466d('0x24')]===_0x466d('0x23');var _0x4bfb6f=_0x533f4d[_0x466d('0x25')];var _0x2f1dbd=_0x54ef53?0x0:_0x346d7e[_0x466d('0x22')];var _0x484c37=_0x54ef53?_0x533f4d[_0x466d('0x25')]:_0x346d7e[_0x466d('0x22')]+_0x346d7e[_0x466d('0x24')];var _0xd154bd;if(_0x484c37>=_0x4bfb6f){_0x484c37=_0x4bfb6f;_0xd154bd=0xc8;}else{_0xd154bd=0xce;}_0x451bfb[_0x466d('0x20')](_0xd154bd);return _0x451bfb[_0x466d('0x26')](_0x466d('0x27'),_0x2f1dbd+'-'+_0x484c37+'/'+_0x4bfb6f)['json'](_0x533f4d);}return null;};}function patchUpdates(_0x1cca1f){return function(_0x553db3){try{jsonpatch[_0x466d('0x28')](_0x553db3,_0x1cca1f,!![]);}catch(_0x597dc2){return BPromise[_0x466d('0x29')](_0x597dc2);}return _0x553db3[_0x466d('0x2a')]();};}function saveUpdates(_0x483f4e,_0x4fc31d){return function(_0x2b1ba0){if(_0x2b1ba0){return _0x2b1ba0[_0x466d('0x2b')](_0x483f4e)[_0x466d('0x2c')](function(_0x42878e){return _0x42878e;});}return null;};}function removeEntity(_0x5232da,_0x84e1c4){return function(_0x30d82e){if(_0x30d82e){return _0x30d82e[_0x466d('0x2d')]()[_0x466d('0x2c')](function(){var _0x313244=_0x30d82e['get']({'plain':!![]});var _0x2e4534='CustomReports';return db['UserProfileResource'][_0x466d('0x2d')]({'where':{'type':_0x2e4534,'resourceId':_0x313244['id']}})[_0x466d('0x2c')](function(){return _0x30d82e;});})[_0x466d('0x2c')](function(){_0x5232da['status'](0xcc)[_0x466d('0x2e')]();});}};}function handleEntityNotFound(_0x32aff7,_0x2db3dd){return function(_0x2f584c){if(!_0x2f584c){_0x32aff7[_0x466d('0x1f')](0x194);}return _0x2f584c;};}function handleError(_0x59a995,_0x54fed9){_0x54fed9=_0x54fed9||0x1f4;return function(_0x34685d){logger[_0x466d('0x2f')](_0x34685d[_0x466d('0x30')]);if(_0x34685d[_0x466d('0x31')]){delete _0x34685d[_0x466d('0x31')];}_0x59a995[_0x466d('0x20')](_0x54fed9)['send'](_0x34685d);};}exports['index']=function(_0x646117,_0x1f864f){var _0x75f4ad={},_0x509b41={},_0x28064a={'count':0x0,'rows':[]};var _0x36bcdf=_[_0x466d('0x32')](db[_0x466d('0x33')][_0x466d('0x34')],function(_0x874548){return{'name':_0x874548[_0x466d('0x35')],'type':_0x874548[_0x466d('0x36')][_0x466d('0x37')]};});_0x509b41['model']=_[_0x466d('0x32')](_0x36bcdf,'name');_0x509b41['query']=_['keys'](_0x646117[_0x466d('0x38')]);_0x509b41[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x509b41[_0x466d('0x3b')],_0x509b41[_0x466d('0x38')]);_0x75f4ad[_0x466d('0x3c')]=_[_0x466d('0x3a')](_0x509b41['model'],qs['fields'](_0x646117[_0x466d('0x38')][_0x466d('0x3d')]));_0x75f4ad[_0x466d('0x3c')]=_0x75f4ad[_0x466d('0x3c')][_0x466d('0x3e')]?_0x75f4ad['attributes']:_0x509b41[_0x466d('0x3b')];if(!_0x646117[_0x466d('0x38')][_0x466d('0x3f')](_0x466d('0x40'))){_0x75f4ad[_0x466d('0x24')]=qs[_0x466d('0x24')](_0x646117[_0x466d('0x38')][_0x466d('0x24')]);_0x75f4ad[_0x466d('0x22')]=qs[_0x466d('0x22')](_0x646117[_0x466d('0x38')][_0x466d('0x22')]);}_0x75f4ad[_0x466d('0x41')]=qs[_0x466d('0x42')](_0x646117[_0x466d('0x38')][_0x466d('0x42')]);_0x75f4ad[_0x466d('0x43')]=qs[_0x466d('0x39')](_[_0x466d('0x44')](_0x646117[_0x466d('0x38')],_0x509b41[_0x466d('0x39')]),_0x36bcdf);if(_0x646117[_0x466d('0x38')][_0x466d('0x45')]){_0x75f4ad[_0x466d('0x43')]=_[_0x466d('0x46')](_0x75f4ad['where'],{'$or':_[_0x466d('0x32')](_0x36bcdf,function(_0x3e6c2d){if(_0x3e6c2d['type']!==_0x466d('0x47')){var _0x338994={};_0x338994[_0x3e6c2d['name']]={'$like':'%'+_0x646117['query'][_0x466d('0x45')]+'%'};return _0x338994;}})});}_0x75f4ad=_[_0x466d('0x46')]({},_0x75f4ad,_0x646117[_0x466d('0x48')]);var _0x2e6e48={'where':_0x75f4ad[_0x466d('0x43')]};return db[_0x466d('0x33')]['count'](_0x2e6e48)[_0x466d('0x2c')](function(_0x55868f){_0x28064a[_0x466d('0x25')]=_0x55868f;if(_0x646117[_0x466d('0x38')]['includeAll']){_0x75f4ad[_0x466d('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x466d('0x4a')](_0x75f4ad);})[_0x466d('0x2c')](function(_0x2adfc1){_0x28064a[_0x466d('0x4b')]=_0x2adfc1;return _0x28064a;})[_0x466d('0x2c')](respondWithFilteredResult(_0x1f864f,_0x75f4ad))[_0x466d('0x4c')](handleError(_0x1f864f,null));};exports[_0x466d('0x4d')]=function(_0x4547e1,_0x479144){var _0x48425d={'raw':![],'where':{'id':_0x4547e1[_0x466d('0x4e')]['id']}},_0x1ab80e={};_0x1ab80e['model']=_[_0x466d('0x4f')](db[_0x466d('0x33')][_0x466d('0x34')]);_0x1ab80e[_0x466d('0x38')]=_[_0x466d('0x4f')](_0x4547e1[_0x466d('0x38')]);_0x1ab80e[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x1ab80e['model'],_0x1ab80e['query']);_0x48425d['attributes']=_[_0x466d('0x3a')](_0x1ab80e[_0x466d('0x3b')],qs[_0x466d('0x3d')](_0x4547e1[_0x466d('0x38')][_0x466d('0x3d')]));_0x48425d[_0x466d('0x3c')]=_0x48425d[_0x466d('0x3c')]['length']?_0x48425d[_0x466d('0x3c')]:_0x1ab80e[_0x466d('0x3b')];if(_0x4547e1['query'][_0x466d('0x50')]){_0x48425d[_0x466d('0x49')]=[{'all':!![]}];}_0x48425d=_[_0x466d('0x46')]({},_0x48425d,_0x4547e1[_0x466d('0x48')]);return db[_0x466d('0x33')][_0x466d('0x51')](_0x48425d)['then'](handleEntityNotFound(_0x479144,null))['then'](respondWithResult(_0x479144,null))[_0x466d('0x4c')](handleError(_0x479144,null));};exports[_0x466d('0x52')]=function(_0x3b4cbd,_0xb84a82){return db[_0x466d('0x33')]['create'](_0x3b4cbd[_0x466d('0x53')],{})[_0x466d('0x2c')](function(_0x43fb3e){var _0x23b9f8=_0x3b4cbd[_0x466d('0x54')][_0x466d('0x55')]({'plain':!![]});if(!_0x23b9f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b9f8[_0x466d('0x56')]===_0x466d('0x54')){var _0x1d8d4e=_0x43fb3e[_0x466d('0x55')]({'plain':!![]});var _0x1ad05a=_0x466d('0x57');return db[_0x466d('0x58')][_0x466d('0x51')]({'where':{'name':_0x1ad05a,'userProfileId':_0x23b9f8[_0x466d('0x59')]},'raw':!![]})['then'](function(_0x44ec89){if(_0x44ec89&&_0x44ec89[_0x466d('0x5a')]===0x0){return db[_0x466d('0x5b')][_0x466d('0x52')]({'name':_0x1d8d4e[_0x466d('0x31')],'resourceId':_0x1d8d4e['id'],'type':'CustomReports','sectionId':_0x44ec89['id']},{})[_0x466d('0x2c')](function(){return _0x43fb3e;});}else{return _0x43fb3e;}})[_0x466d('0x4c')](function(_0x5e853e){logger[_0x466d('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e853e);throw _0x5e853e;});}return _0x43fb3e;})[_0x466d('0x2c')](respondWithResult(_0xb84a82,0xc9))[_0x466d('0x4c')](handleError(_0xb84a82,null));};exports[_0x466d('0x2b')]=function(_0x777dda,_0x325ea6){if(_0x777dda['body']['id']){delete _0x777dda[_0x466d('0x53')]['id'];}return db[_0x466d('0x33')][_0x466d('0x51')]({'where':{'id':_0x777dda[_0x466d('0x4e')]['id']}})[_0x466d('0x2c')](handleEntityNotFound(_0x325ea6,null))[_0x466d('0x2c')](saveUpdates(_0x777dda[_0x466d('0x53')],null))[_0x466d('0x2c')](respondWithResult(_0x325ea6,null))['catch'](handleError(_0x325ea6,null));};exports['destroy']=function(_0x2dfd87,_0x555aa1){return db['AnalyticCustomReport'][_0x466d('0x51')]({'where':{'id':_0x2dfd87[_0x466d('0x4e')]['id']}})[_0x466d('0x2c')](handleEntityNotFound(_0x555aa1,null))['then'](removeEntity(_0x555aa1,null))[_0x466d('0x4c')](handleError(_0x555aa1,null));};exports['preview']=function(_0x564755,_0x3a2ae3){var _0x2883ae=0xa;var _0x5c6855=['join',_0x466d('0x5c'),_0x466d('0x5d'),'cross_join'];var _0x5624a7={'SUM':_0x466d('0x5e'),'COUNT':_0x466d('0x5f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x466d('0x60'),'MIN':_0x466d('0x61'),'AVG':_0x466d('0x62'),'GROUP_CONCAT':_0x466d('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x466d('0x64')};var _0x3da099={'SEC_TO_TIME':_0x466d('0x65'),'DATE':_0x466d('0x66'),'HOUR':_0x466d('0x67'),'ROUND':_0x466d('0x68'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x179f76=function(_0x514c66){return!_[_0x466d('0x69')]([_0x466d('0x6a'),_0x466d('0x6b'),_0x466d('0x6c'),_0x466d('0x6d')],_0x514c66);};var _0x29f54d=function(_0x30ddef){if(!_0x30ddef||!_0x30ddef[_0x466d('0x6e')][_0x466d('0x3e')]){return'';}for(var _0x2a18e2='(',_0x3f620e=0x0;_0x3f620e<_0x30ddef['rules'][_0x466d('0x3e')];_0x3f620e+=0x1){_0x3f620e>0x0&&(_0x2a18e2+='\x20'+_0x30ddef[_0x466d('0x6f')]+'\x20');_0x2a18e2+=_0x30ddef[_0x466d('0x6e')][_0x3f620e][_0x466d('0x70')]?_0x29f54d(_0x30ddef[_0x466d('0x6e')][_0x3f620e][_0x466d('0x70')]):_0x30ddef[_0x466d('0x6e')][_0x3f620e]['field']+'\x20'+_0x30ddef[_0x466d('0x6e')][_0x3f620e]['condition']+(_0x179f76(_0x30ddef[_0x466d('0x6e')][_0x3f620e][_0x466d('0x71')])?'\x20'+_0x30ddef['rules'][_0x3f620e][_0x466d('0x72')]:'');}return _0x2a18e2+')';};var _0x3c30d9={'where':{'id':_0x564755[_0x466d('0x4e')]['id']}},_0x36a9f6,_0x3cb2ef,_0x4f4a49,_0x3f3a38,_0x31c56e;_0x3c30d9=_[_0x466d('0x46')]({},_0x3c30d9,_0x564755['options']);return db[_0x466d('0x33')]['find'](_0x3c30d9)[_0x466d('0x2c')](function(_0x18bab9){if(_0x18bab9){_0x36a9f6=_0x18bab9;return _0x18bab9[_0x466d('0x73')]();}return null;})['then'](function(_0x592ece){if(_0x592ece){if(!_0x592ece[_0x466d('0x3e')]){throw new db['Sequelize'][(_0x466d('0x74'))](_0x466d('0x75'),0x193);}_0x3cb2ef=_0x592ece;return db[_0x466d('0x76')][_0x466d('0x4a')]({'raw':!![]});}return null;})[_0x466d('0x2c')](function(_0x1b6e68){if(_0x1b6e68){_0x4f4a49=_['keyBy'](_0x1b6e68,'id');var _0x308a84;var _0x122895=squel[_0x466d('0x77')]();_0x122895['from'](_0x36a9f6[_0x466d('0x78')]);for(var _0x38ebaa=0x0;_0x38ebaa<_0x3cb2ef[_0x466d('0x3e')];_0x38ebaa+=0x1){_0x308a84=_0x3cb2ef[_0x38ebaa][_0x466d('0x79')]?_0x4f4a49[_0x3cb2ef[_0x38ebaa][_0x466d('0x79')]]['metric']:_0x3cb2ef[_0x38ebaa][_0x466d('0x7a')];_0x308a84=_0x3cb2ef[_0x38ebaa][_0x466d('0x7b')]?_[_0x466d('0x7c')](_0x5624a7[_0x3cb2ef[_0x38ebaa]['function']],'%s',_0x308a84):_0x308a84;_0x308a84=_0x3cb2ef[_0x38ebaa][_0x466d('0x7d')]?_[_0x466d('0x7c')](_0x3da099[_0x3cb2ef[_0x38ebaa][_0x466d('0x7d')]],'%s',_0x308a84):_0x308a84;if(_0x3cb2ef[_0x38ebaa][_0x466d('0x7e')]){_0x122895['group'](_0x308a84);}_0x3cb2ef[_0x38ebaa][_0x466d('0x7f')]&&_0x122895[_0x466d('0x41')](_0x308a84,_0x3cb2ef[_0x38ebaa][_0x466d('0x7f')]===_0x466d('0x80')?![]:!![]);_0x122895[_0x466d('0x7a')](_0x308a84,_0x3cb2ef[_0x38ebaa]['alias']||_0x308a84);}if(_0x36a9f6[_0x466d('0x81')]){_0x36a9f6[_0x466d('0x81')]=JSON[_0x466d('0x82')](_0x36a9f6[_0x466d('0x81')]);for(var _0x3bcb54=0x0;_0x3bcb54<_0x36a9f6['joins'][_0x466d('0x3e')];_0x3bcb54+=0x1){if(_0x36a9f6[_0x466d('0x81')][_0x3bcb54][_0x466d('0x36')]&&_[_0x466d('0x69')](_0x5c6855,_0x36a9f6[_0x466d('0x81')][_0x3bcb54]['type'])&&_0x36a9f6['joins'][_0x3bcb54][_0x466d('0x83')]&&_0x36a9f6[_0x466d('0x81')][_0x3bcb54]['foreignTable']&&_0x36a9f6[_0x466d('0x81')][_0x3bcb54][_0x466d('0x84')]){_0x122895[_0x36a9f6[_0x466d('0x81')][_0x3bcb54]['type']](_0x36a9f6[_0x466d('0x81')][_0x3bcb54][_0x466d('0x85')],null,util[_0x466d('0x7d')](_0x466d('0x86'),_0x36a9f6['table'],_0x36a9f6[_0x466d('0x81')][_0x3bcb54][_0x466d('0x83')],_0x36a9f6['joins'][_0x3bcb54]['foreignTable'],_0x36a9f6[_0x466d('0x81')][_0x3bcb54]['foreignKey']));}}}if(_0x36a9f6[_0x466d('0x87')]){_0x36a9f6[_0x466d('0x87')]=JSON[_0x466d('0x82')](_0x36a9f6['conditions']);_0x122895[_0x466d('0x43')](_0x29f54d(_0x36a9f6[_0x466d('0x87')]['group']));}_0x31c56e=_0x122895[_0x466d('0x88')]();_0x122895[_0x466d('0x24')](_0x2883ae);_0x122895[_0x466d('0x22')](0x0);logger[_0x466d('0x89')](_0x466d('0x8a'),_0x122895[_0x466d('0x8b')]());return dbH[_0x466d('0x8c')][_0x466d('0x38')](_0x122895[_0x466d('0x8b')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x3a2ae3,null))[_0x466d('0x4c')](handleError(_0x3a2ae3,null));};function runReport(_0x1c9726,_0x47856b,_0x402c1e){var _0x118040=_0x47856b[_0x466d('0x31')];var _0x73eb91=0xa;var _0x42de5c=[_0x466d('0x8d'),_0x466d('0x5c'),_0x466d('0x5d'),_0x466d('0x8e')];var _0x281003={'SUM':'SUM(%s)','COUNT':_0x466d('0x5f'),'COUNT DISTINCT':_0x466d('0x8f'),'MAX':_0x466d('0x60'),'MIN':'MIN(%s)','AVG':_0x466d('0x62'),'GROUP_CONCAT':_0x466d('0x63'),'GROUP_CONCAT ASC':_0x466d('0x90'),'GROUP_CONCAT DESC':_0x466d('0x64')};var _0x20926b={'SEC_TO_TIME':_0x466d('0x65'),'DATE':_0x466d('0x66'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x466d('0x91')};var _0x55d86e=function(_0x283983){return!_['includes'](['IS\x20NULL',_0x466d('0x6b'),_0x466d('0x6c'),_0x466d('0x6d')],_0x283983);};var _0x2eab48=function(_0x262bb5){if(!_0x262bb5||!_0x262bb5[_0x466d('0x6e')]['length']){return'';}for(var _0x21992d='(',_0x445140=0x0;_0x445140<_0x262bb5['rules'][_0x466d('0x3e')];_0x445140+=0x1){_0x445140>0x0&&(_0x21992d+='\x20'+_0x262bb5['operator']+'\x20');_0x21992d+=_0x262bb5[_0x466d('0x6e')][_0x445140][_0x466d('0x70')]?_0x2eab48(_0x262bb5[_0x466d('0x6e')][_0x445140][_0x466d('0x70')]):_0x262bb5[_0x466d('0x6e')][_0x445140][_0x466d('0x7a')]+'\x20'+_0x262bb5[_0x466d('0x6e')][_0x445140]['condition']+(_0x55d86e(_0x262bb5[_0x466d('0x6e')][_0x445140]['condition'])?'\x20'+_0x262bb5[_0x466d('0x6e')][_0x445140][_0x466d('0x72')]:'');}return _0x21992d+')';};var _0x1d7bcb={'where':{'id':_0x1c9726['id']}},_0x105428,_0xe2d1c,_0x48c541,_0x20aa79,_0x45f314;_0x1d7bcb=_[_0x466d('0x46')]({},_0x1d7bcb,_0x402c1e);return db['AnalyticCustomReport'][_0x466d('0x51')](_0x1d7bcb)[_0x466d('0x2c')](function(_0x3d78a2){if(_0x3d78a2){_0x105428=_0x3d78a2;return _0x3d78a2[_0x466d('0x73')]();}return null;})['then'](function(_0x578e19){if(_0x578e19){if(!_0x578e19['length']){throw new db[(_0x466d('0x92'))][(_0x466d('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe2d1c=_0x578e19;return db[_0x466d('0x76')][_0x466d('0x4a')]({'raw':!![]});}return null;})['then'](function(_0xa7cca0){if(_0xa7cca0){_0x48c541=_[_0x466d('0x93')](_0xa7cca0,'id');var _0x23a8c9;var _0x34aaf1=squel[_0x466d('0x77')]();_0x34aaf1[_0x466d('0x94')](_0x105428[_0x466d('0x78')]);for(var _0x20c6f6=0x0;_0x20c6f6<_0xe2d1c[_0x466d('0x3e')];_0x20c6f6+=0x1){_0x23a8c9=_0xe2d1c[_0x20c6f6][_0x466d('0x79')]?_0x48c541[_0xe2d1c[_0x20c6f6][_0x466d('0x79')]][_0x466d('0x95')]:_0xe2d1c[_0x20c6f6][_0x466d('0x7a')];_0x23a8c9=_0xe2d1c[_0x20c6f6][_0x466d('0x7b')]?_[_0x466d('0x7c')](_0x281003[_0xe2d1c[_0x20c6f6][_0x466d('0x7b')]],'%s',_0x23a8c9):_0x23a8c9;_0x23a8c9=_0xe2d1c[_0x20c6f6][_0x466d('0x7d')]?_[_0x466d('0x7c')](_0x20926b[_0xe2d1c[_0x20c6f6]['format']],'%s',_0x23a8c9):_0x23a8c9;if(_0xe2d1c[_0x20c6f6][_0x466d('0x7e')]){_0x34aaf1['group'](_0x23a8c9);}_0xe2d1c[_0x20c6f6]['orderBy']&&_0x34aaf1[_0x466d('0x41')](_0x23a8c9,_0xe2d1c[_0x20c6f6][_0x466d('0x7f')]===_0x466d('0x80')?![]:!![]);_0x34aaf1[_0x466d('0x7a')](_0x23a8c9,_0xe2d1c[_0x20c6f6]['alias']||_0x23a8c9);}if(_0x105428['joins']){_0x105428[_0x466d('0x81')]=JSON['parse'](_0x105428[_0x466d('0x81')]);for(var _0x48dd61=0x0;_0x48dd61<_0x105428[_0x466d('0x81')]['length'];_0x48dd61+=0x1){if(_0x105428[_0x466d('0x81')][_0x48dd61][_0x466d('0x36')]&&_[_0x466d('0x69')](_0x42de5c,_0x105428[_0x466d('0x81')][_0x48dd61]['type'])&&_0x105428[_0x466d('0x81')][_0x48dd61][_0x466d('0x83')]&&_0x105428[_0x466d('0x81')][_0x48dd61][_0x466d('0x85')]&&_0x105428[_0x466d('0x81')][_0x48dd61]['foreignKey']){_0x34aaf1[_0x105428[_0x466d('0x81')][_0x48dd61][_0x466d('0x36')]](_0x105428['joins'][_0x48dd61]['foreignTable'],null,util['format'](_0x466d('0x86'),_0x105428['table'],_0x105428[_0x466d('0x81')][_0x48dd61]['parentKey'],_0x105428['joins'][_0x48dd61][_0x466d('0x85')],_0x105428[_0x466d('0x81')][_0x48dd61][_0x466d('0x84')]));}}}if(_0x105428['conditions']){_0x105428[_0x466d('0x87')]=JSON['parse'](_0x105428[_0x466d('0x87')]);_0x34aaf1[_0x466d('0x43')](_0x2eab48(_0x105428['conditions'][_0x466d('0x70')]));}_0x45f314=_0x34aaf1['clone']();_0x34aaf1[_0x466d('0x24')](_0x73eb91);_0x34aaf1['offset'](0x0);return;}})[_0x466d('0x2c')](function(){if(_0x47856b['output']===_0x466d('0x96')){return null;}var _0x2a4d14=_['merge'](_0x47856b,{'name':_0x47856b[_0x466d('0x97')]||_0x47856b['name']||_0x105428[_0x466d('0x31')],'basename':_0x118040,'savename':util[_0x466d('0x7d')](_0x466d('0x98'),_0x47856b['name']||_0x105428[_0x466d('0x31')],require(_0x466d('0x99'))[_0x466d('0x9a')](0x4),_0x47856b['output']||_0x466d('0x9b')),'reportId':_0x105428['id'],'reportType':'custom'});return db[_0x466d('0x9c')][_0x466d('0x52')](_0x2a4d14,{'raw':!![]});})['then'](function(_0x4592e1){if(_0x105428[_0x466d('0x78')]==='cdr'){_0x45f314[_0x466d('0x43')](_0x105428[_0x466d('0x78')]+_0x466d('0x9d'),_0x47856b[_0x466d('0x9e')],_0x47856b[_0x466d('0x9f')]);}else{_0x45f314[_0x466d('0x43')](_0x105428[_0x466d('0x78')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x47856b[_0x466d('0x9e')],_0x47856b[_0x466d('0x9f')]);}if(_0x4592e1){logger[_0x466d('0xa0')](_0x466d('0xa1'),_0x45f314[_0x466d('0x8b')]());require('child_process')[_0x466d('0xa2')](path[_0x466d('0x8d')](__dirname,'../../components/export/',_0x4592e1[_0x466d('0xa3')]),[_0x4592e1['id'],_0x45f314[_0x466d('0x8b')](),path[_0x466d('0x8d')](__dirname,_0x466d('0xa4'),_0x4592e1['savename']),_0x118040]);return _0x4592e1;}else{var _0x27d936=squel[_0x466d('0x77')]();_0x27d936['from']('('+_0x45f314['toString']()+')',_0x466d('0xa5'));_0x27d936['field'](_0x466d('0xa6'),'count');_0x45f314['limit'](_0x47856b[_0x466d('0x24')]||_0x73eb91);_0x45f314[_0x466d('0x22')](_0x47856b[_0x466d('0x22')]||0x0);return dbH[_0x466d('0x8c')][_0x466d('0x38')](_0x27d936['toString'](),{'type':dbH['sequelize'][_0x466d('0xa7')][_0x466d('0xa8')]})['then'](function(_0x56c1d7){if(!_0x56c1d7[_0x466d('0x3e')]){_0x20aa79=0x0;}else{_0x20aa79=_0x56c1d7[0x0][_0x466d('0x25')]||0x0;}return dbH['sequelize'][_0x466d('0x38')](_0x45f314[_0x466d('0x8b')](),{'type':dbH[_0x466d('0x8c')]['QueryTypes'][_0x466d('0xa8')]});})[_0x466d('0x2c')](function(_0x5c55ec){return{'rows':_0x5c55ec||[],'count':_0x20aa79};});}});}exports[_0x466d('0xa9')]=function(_0x40f028,_0x42e883){return runReport(_0x40f028[_0x466d('0x4e')],_0x40f028['query'],_0x40f028['options'])[_0x466d('0x2c')](respondWithResult(_0x42e883,null))[_0x466d('0x4c')](handleError(_0x42e883,null));};exports['runReport']=runReport;exports[_0x466d('0x38')]=function(_0x5a91d4,_0x4775c4){var _0x171bb2=0xa;var _0x3569b1=[_0x466d('0x8d'),_0x466d('0x5c'),_0x466d('0x5d'),_0x466d('0x8e')];var _0x67f602={'SUM':_0x466d('0x5e'),'COUNT':_0x466d('0x5f'),'COUNT DISTINCT':_0x466d('0x8f'),'MAX':_0x466d('0x60'),'MIN':_0x466d('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x466d('0x63'),'GROUP_CONCAT ASC':_0x466d('0x90'),'GROUP_CONCAT DESC':_0x466d('0x64')};var _0x22610b={'SEC_TO_TIME':_0x466d('0x65'),'DATE':_0x466d('0x66'),'HOUR':_0x466d('0x67'),'ROUND':_0x466d('0x68'),'UNIX_TIMESTAMP':_0x466d('0x91')};var _0x5f0697=function(_0x270546){return!_[_0x466d('0x69')]([_0x466d('0x6a'),_0x466d('0x6b'),_0x466d('0x6c'),_0x466d('0x6d')],_0x270546);};var _0x6cfe92=function(_0x5ac828){if(!_0x5ac828||!_0x5ac828[_0x466d('0x6e')][_0x466d('0x3e')]){return'';}for(var _0x119bc5='(',_0x2b5f6e=0x0;_0x2b5f6e<_0x5ac828[_0x466d('0x6e')][_0x466d('0x3e')];_0x2b5f6e+=0x1){_0x2b5f6e>0x0&&(_0x119bc5+='\x20'+_0x5ac828[_0x466d('0x6f')]+'\x20');_0x119bc5+=_0x5ac828[_0x466d('0x6e')][_0x2b5f6e]['group']?_0x6cfe92(_0x5ac828['rules'][_0x2b5f6e]['group']):_0x5ac828[_0x466d('0x6e')][_0x2b5f6e][_0x466d('0x7a')]+'\x20'+_0x5ac828[_0x466d('0x6e')][_0x2b5f6e]['condition']+(_0x5f0697(_0x5ac828[_0x466d('0x6e')][_0x2b5f6e]['condition'])?'\x20'+_0x5ac828[_0x466d('0x6e')][_0x2b5f6e][_0x466d('0x72')]:'');}return _0x119bc5+')';};var _0x45bd04={'where':{'id':_0x5a91d4[_0x466d('0x4e')]['id']}},_0x1edc97,_0x5f13c7,_0x3ed851,_0x260b6b,_0x1054b2;_0x45bd04=_['merge']({},_0x45bd04,_0x5a91d4['options']);return db[_0x466d('0x33')]['find'](_0x45bd04)[_0x466d('0x2c')](function(_0x324a87){if(_0x324a87){_0x1edc97=_0x324a87;return _0x324a87[_0x466d('0x73')]();}return null;})[_0x466d('0x2c')](function(_0x58047b){if(_0x58047b){if(!_0x58047b[_0x466d('0x3e')]){throw new db[(_0x466d('0x92'))][(_0x466d('0x74'))](_0x466d('0x75'),0x193);}_0x5f13c7=_0x58047b;return db[_0x466d('0x76')][_0x466d('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x1c6c51){if(_0x1c6c51){_0x3ed851=_[_0x466d('0x93')](_0x1c6c51,'id');var _0x48b8b3;var _0x324747=squel[_0x466d('0x77')]();_0x324747['from'](_0x1edc97[_0x466d('0x78')]);for(var _0x54d89c=0x0;_0x54d89c<_0x5f13c7[_0x466d('0x3e')];_0x54d89c+=0x1){_0x48b8b3=_0x5f13c7[_0x54d89c][_0x466d('0x79')]?_0x3ed851[_0x5f13c7[_0x54d89c]['MetricId']][_0x466d('0x95')]:_0x5f13c7[_0x54d89c][_0x466d('0x7a')];_0x48b8b3=_0x5f13c7[_0x54d89c]['function']?_[_0x466d('0x7c')](_0x67f602[_0x5f13c7[_0x54d89c]['function']],'%s',_0x48b8b3):_0x48b8b3;_0x48b8b3=_0x5f13c7[_0x54d89c][_0x466d('0x7d')]?_[_0x466d('0x7c')](_0x22610b[_0x5f13c7[_0x54d89c][_0x466d('0x7d')]],'%s',_0x48b8b3):_0x48b8b3;if(_0x5f13c7[_0x54d89c]['groupBy']){_0x324747[_0x466d('0x70')](_0x48b8b3);}_0x5f13c7[_0x54d89c][_0x466d('0x7f')]&&_0x324747[_0x466d('0x41')](_0x48b8b3,_0x5f13c7[_0x54d89c][_0x466d('0x7f')]===_0x466d('0x80')?![]:!![]);_0x324747[_0x466d('0x7a')](_0x48b8b3,_0x5f13c7[_0x54d89c][_0x466d('0xaa')]||_0x48b8b3);}if(_0x1edc97['joins']){_0x1edc97['joins']=JSON['parse'](_0x1edc97[_0x466d('0x81')]);for(var _0x31be55=0x0;_0x31be55<_0x1edc97[_0x466d('0x81')][_0x466d('0x3e')];_0x31be55+=0x1){if(_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x36')]&&_[_0x466d('0x69')](_0x3569b1,_0x1edc97['joins'][_0x31be55][_0x466d('0x36')])&&_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x83')]&&_0x1edc97[_0x466d('0x81')][_0x31be55]['foreignTable']&&_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x84')]){_0x324747[_0x1edc97[_0x466d('0x81')][_0x31be55]['type']](_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x85')],null,util[_0x466d('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1edc97[_0x466d('0x78')],_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x83')],_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x85')],_0x1edc97[_0x466d('0x81')][_0x31be55][_0x466d('0x84')]));}}}if(_0x1edc97['conditions']){_0x1edc97['conditions']=JSON[_0x466d('0x82')](_0x1edc97[_0x466d('0x87')]);_0x324747[_0x466d('0x43')](_0x6cfe92(_0x1edc97[_0x466d('0x87')][_0x466d('0x70')]));}_0x1054b2=_0x324747['clone']();_0x324747[_0x466d('0x24')](_0x171bb2);_0x324747[_0x466d('0x22')](0x0);logger[_0x466d('0x89')]('Limited\x20Query:',_0x324747[_0x466d('0x8b')]());return dbH[_0x466d('0x8c')]['query'](_0x324747[_0x466d('0x8b')](),{'type':dbH['sequelize'][_0x466d('0xa7')][_0x466d('0xa8')]});}})['then'](function(){return{'sql':_0x1054b2[_0x466d('0x8b')]()};})[_0x466d('0x2c')](respondWithResult(_0x4775c4,null))[_0x466d('0x4c')](handleError(_0x4775c4,null));}; \ No newline at end of file +var _0xbf21=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','MetricId','function','replace','format','groupBy','orderBy','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','table','foreignTable','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','operator','from','metric','DESC','alias','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','savename','COUNT(*)','runReport','cross_join','HOUR(%s)','IS\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','set','apply','reject','update','then','get','CustomReports','destroy','sendStatus','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbf21,0xec));var _0x1bf2=function(_0x44b691,_0x368823){_0x44b691=_0x44b691-0x0;var _0x4f6637=_0xbf21[_0x44b691];return _0x4f6637;};'use strict';var emlformat=require(_0x1bf2('0x0'));var rimraf=require(_0x1bf2('0x1'));var zipdir=require(_0x1bf2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bf2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1bf2('0x4'));var util=require(_0x1bf2('0x5'));var path=require(_0x1bf2('0x6'));var sox=require(_0x1bf2('0x7'));var csv=require(_0x1bf2('0x8'));var ejs=require(_0x1bf2('0x9'));var fs=require('fs');var fs_extra=require(_0x1bf2('0xa'));var _=require(_0x1bf2('0xb'));var squel=require(_0x1bf2('0xc'));var crypto=require('crypto');var jsforce=require(_0x1bf2('0xd'));var deskjs=require(_0x1bf2('0xe'));var toCsv=require(_0x1bf2('0x8'));var querystring=require(_0x1bf2('0xf'));var Papa=require(_0x1bf2('0x10'));var Redis=require(_0x1bf2('0x11'));var authService=require(_0x1bf2('0x12'));var qs=require(_0x1bf2('0x13'));var as=require(_0x1bf2('0x14'));var hardwareService=require(_0x1bf2('0x15'));var logger=require(_0x1bf2('0x16'))(_0x1bf2('0x17'));var utils=require('../../config/utils');var config=require(_0x1bf2('0x18'));var licenseUtil=require(_0x1bf2('0x19'));var db=require(_0x1bf2('0x1a'))['db'];var dbH=require(_0x1bf2('0x1a'))[_0x1bf2('0x1b')];function respondWithStatusCode(_0x10a428,_0x5f4cb1){_0x5f4cb1=_0x5f4cb1||0xcc;return function(_0x2927b4){if(_0x2927b4){return _0x10a428['sendStatus'](_0x5f4cb1);}return _0x10a428[_0x1bf2('0x1c')](_0x5f4cb1)[_0x1bf2('0x1d')]();};}function respondWithResult(_0x138c98,_0x1413b0){_0x1413b0=_0x1413b0||0xc8;return function(_0x3e3e6c){if(_0x3e3e6c){return _0x138c98[_0x1bf2('0x1c')](_0x1413b0)[_0x1bf2('0x1e')](_0x3e3e6c);}};}function respondWithFilteredResult(_0x55769b,_0x818e0a){return function(_0x5dd095){if(_0x5dd095){var _0x19c3cc=typeof _0x818e0a[_0x1bf2('0x1f')]===_0x1bf2('0x20')&&typeof _0x818e0a['limit']===_0x1bf2('0x20');var _0x261e53=_0x5dd095[_0x1bf2('0x21')];var _0x547e6b=_0x19c3cc?0x0:_0x818e0a[_0x1bf2('0x1f')];var _0x46e711=_0x19c3cc?_0x5dd095[_0x1bf2('0x21')]:_0x818e0a[_0x1bf2('0x1f')]+_0x818e0a['limit'];var _0x449736;if(_0x46e711>=_0x261e53){_0x46e711=_0x261e53;_0x449736=0xc8;}else{_0x449736=0xce;}_0x55769b[_0x1bf2('0x1c')](_0x449736);return _0x55769b[_0x1bf2('0x22')]('Content-Range',_0x547e6b+'-'+_0x46e711+'/'+_0x261e53)['json'](_0x5dd095);}return null;};}function patchUpdates(_0x326dd3){return function(_0x526be0){try{jsonpatch[_0x1bf2('0x23')](_0x526be0,_0x326dd3,!![]);}catch(_0x172409){return BPromise[_0x1bf2('0x24')](_0x172409);}return _0x526be0['save']();};}function saveUpdates(_0x347772,_0x4c9874){return function(_0x500a82){if(_0x500a82){return _0x500a82[_0x1bf2('0x25')](_0x347772)[_0x1bf2('0x26')](function(_0x4fbec4){return _0x4fbec4;});}return null;};}function removeEntity(_0xb13cd7,_0x241a6b){return function(_0x514966){if(_0x514966){return _0x514966['destroy']()['then'](function(){var _0xfa82f7=_0x514966[_0x1bf2('0x27')]({'plain':!![]});var _0x4c3dd2=_0x1bf2('0x28');return db['UserProfileResource'][_0x1bf2('0x29')]({'where':{'type':_0x4c3dd2,'resourceId':_0xfa82f7['id']}})[_0x1bf2('0x26')](function(){return _0x514966;});})[_0x1bf2('0x26')](function(){_0xb13cd7['status'](0xcc)[_0x1bf2('0x1d')]();});}};}function handleEntityNotFound(_0x2ae72c,_0x53df96){return function(_0x3eb070){if(!_0x3eb070){_0x2ae72c[_0x1bf2('0x2a')](0x194);}return _0x3eb070;};}function handleError(_0x54b31f,_0x75aa1e){_0x75aa1e=_0x75aa1e||0x1f4;return function(_0x4b16a8){logger[_0x1bf2('0x2b')](_0x4b16a8[_0x1bf2('0x2c')]);if(_0x4b16a8[_0x1bf2('0x2d')]){delete _0x4b16a8[_0x1bf2('0x2d')];}_0x54b31f[_0x1bf2('0x1c')](_0x75aa1e)[_0x1bf2('0x2e')](_0x4b16a8);};}exports['index']=function(_0x3afff0,_0x315f49){var _0x42e4ba={},_0x2c4166={},_0x186e91={'count':0x0,'rows':[]};var _0xccb8c6=_[_0x1bf2('0x2f')](db[_0x1bf2('0x30')][_0x1bf2('0x31')],function(_0x1286ec){return{'name':_0x1286ec[_0x1bf2('0x32')],'type':_0x1286ec[_0x1bf2('0x33')][_0x1bf2('0x34')]};});_0x2c4166[_0x1bf2('0x35')]=_[_0x1bf2('0x2f')](_0xccb8c6,_0x1bf2('0x2d'));_0x2c4166[_0x1bf2('0x36')]=_['keys'](_0x3afff0[_0x1bf2('0x36')]);_0x2c4166['filters']=_[_0x1bf2('0x37')](_0x2c4166['model'],_0x2c4166['query']);_0x42e4ba[_0x1bf2('0x38')]=_['intersection'](_0x2c4166[_0x1bf2('0x35')],qs['fields'](_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x39')]));_0x42e4ba['attributes']=_0x42e4ba[_0x1bf2('0x38')][_0x1bf2('0x3a')]?_0x42e4ba['attributes']:_0x2c4166['model'];if(!_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x3b')](_0x1bf2('0x3c'))){_0x42e4ba['limit']=qs[_0x1bf2('0x3d')](_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x3d')]);_0x42e4ba['offset']=qs['offset'](_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x1f')]);}_0x42e4ba[_0x1bf2('0x3e')]=qs[_0x1bf2('0x3f')](_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x3f')]);_0x42e4ba[_0x1bf2('0x40')]=qs[_0x1bf2('0x41')](_['pick'](_0x3afff0[_0x1bf2('0x36')],_0x2c4166[_0x1bf2('0x41')]),_0xccb8c6);if(_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x42')]){_0x42e4ba[_0x1bf2('0x40')]=_[_0x1bf2('0x43')](_0x42e4ba[_0x1bf2('0x40')],{'$or':_[_0x1bf2('0x2f')](_0xccb8c6,function(_0x47955b){if(_0x47955b[_0x1bf2('0x33')]!==_0x1bf2('0x44')){var _0x1e4def={};_0x1e4def[_0x47955b['name']]={'$like':'%'+_0x3afff0[_0x1bf2('0x36')]['filter']+'%'};return _0x1e4def;}})});}_0x42e4ba=_[_0x1bf2('0x43')]({},_0x42e4ba,_0x3afff0[_0x1bf2('0x45')]);var _0x2cfb67={'where':_0x42e4ba[_0x1bf2('0x40')]};return db[_0x1bf2('0x30')][_0x1bf2('0x21')](_0x2cfb67)[_0x1bf2('0x26')](function(_0x11b451){_0x186e91[_0x1bf2('0x21')]=_0x11b451;if(_0x3afff0[_0x1bf2('0x36')][_0x1bf2('0x46')]){_0x42e4ba[_0x1bf2('0x47')]=[{'all':!![]}];}return db[_0x1bf2('0x30')]['findAll'](_0x42e4ba);})[_0x1bf2('0x26')](function(_0xec142a){_0x186e91[_0x1bf2('0x48')]=_0xec142a;return _0x186e91;})['then'](respondWithFilteredResult(_0x315f49,_0x42e4ba))['catch'](handleError(_0x315f49,null));};exports[_0x1bf2('0x49')]=function(_0x3650e5,_0x25cbb6){var _0xa1670={'raw':![],'where':{'id':_0x3650e5[_0x1bf2('0x4a')]['id']}},_0x2cd6cc={};_0x2cd6cc[_0x1bf2('0x35')]=_[_0x1bf2('0x4b')](db[_0x1bf2('0x30')][_0x1bf2('0x31')]);_0x2cd6cc[_0x1bf2('0x36')]=_[_0x1bf2('0x4b')](_0x3650e5['query']);_0x2cd6cc[_0x1bf2('0x41')]=_[_0x1bf2('0x37')](_0x2cd6cc[_0x1bf2('0x35')],_0x2cd6cc[_0x1bf2('0x36')]);_0xa1670[_0x1bf2('0x38')]=_['intersection'](_0x2cd6cc[_0x1bf2('0x35')],qs[_0x1bf2('0x39')](_0x3650e5[_0x1bf2('0x36')][_0x1bf2('0x39')]));_0xa1670[_0x1bf2('0x38')]=_0xa1670['attributes'][_0x1bf2('0x3a')]?_0xa1670[_0x1bf2('0x38')]:_0x2cd6cc['model'];if(_0x3650e5[_0x1bf2('0x36')][_0x1bf2('0x46')]){_0xa1670[_0x1bf2('0x47')]=[{'all':!![]}];}_0xa1670=_[_0x1bf2('0x43')]({},_0xa1670,_0x3650e5[_0x1bf2('0x45')]);return db[_0x1bf2('0x30')][_0x1bf2('0x4c')](_0xa1670)[_0x1bf2('0x26')](handleEntityNotFound(_0x25cbb6,null))[_0x1bf2('0x26')](respondWithResult(_0x25cbb6,null))[_0x1bf2('0x4d')](handleError(_0x25cbb6,null));};exports[_0x1bf2('0x4e')]=function(_0xc2bdb,_0x40bd57){return db['AnalyticCustomReport'][_0x1bf2('0x4e')](_0xc2bdb[_0x1bf2('0x4f')],{})[_0x1bf2('0x26')](function(_0x2daf1b){var _0x21cdaf=_0xc2bdb['user'][_0x1bf2('0x27')]({'plain':!![]});if(!_0x21cdaf)throw new Error(_0x1bf2('0x50'));if(_0x21cdaf['role']===_0x1bf2('0x51')){var _0x2dee5f=_0x2daf1b['get']({'plain':!![]});var _0x271691=_0x1bf2('0x52');return db[_0x1bf2('0x53')][_0x1bf2('0x4c')]({'where':{'name':_0x271691,'userProfileId':_0x21cdaf[_0x1bf2('0x54')]},'raw':!![]})['then'](function(_0x1e1f67){if(_0x1e1f67&&_0x1e1f67[_0x1bf2('0x55')]===0x0){return db[_0x1bf2('0x56')][_0x1bf2('0x4e')]({'name':_0x2dee5f['name'],'resourceId':_0x2dee5f['id'],'type':_0x1bf2('0x28'),'sectionId':_0x1e1f67['id']},{})['then'](function(){return _0x2daf1b;});}else{return _0x2daf1b;}})[_0x1bf2('0x4d')](function(_0x27c624){logger[_0x1bf2('0x2b')](_0x1bf2('0x57'),_0x27c624);throw _0x27c624;});}return _0x2daf1b;})[_0x1bf2('0x26')](respondWithResult(_0x40bd57,0xc9))[_0x1bf2('0x4d')](handleError(_0x40bd57,null));};exports['update']=function(_0x34fe9b,_0x1a5967){if(_0x34fe9b[_0x1bf2('0x4f')]['id']){delete _0x34fe9b[_0x1bf2('0x4f')]['id'];}return db[_0x1bf2('0x30')][_0x1bf2('0x4c')]({'where':{'id':_0x34fe9b[_0x1bf2('0x4a')]['id']}})[_0x1bf2('0x26')](handleEntityNotFound(_0x1a5967,null))[_0x1bf2('0x26')](saveUpdates(_0x34fe9b['body'],null))['then'](respondWithResult(_0x1a5967,null))['catch'](handleError(_0x1a5967,null));};exports[_0x1bf2('0x29')]=function(_0x2efd6f,_0x4e4e5f){return db['AnalyticCustomReport'][_0x1bf2('0x4c')]({'where':{'id':_0x2efd6f[_0x1bf2('0x4a')]['id']}})[_0x1bf2('0x26')](handleEntityNotFound(_0x4e4e5f,null))['then'](removeEntity(_0x4e4e5f,null))[_0x1bf2('0x4d')](handleError(_0x4e4e5f,null));};exports[_0x1bf2('0x58')]=function(_0x11e509,_0x24d8e8){var _0x3bbbce=0xa;var _0x52a83e=['join','left_join',_0x1bf2('0x59'),'cross_join'];var _0x47c970={'SUM':_0x1bf2('0x5a'),'COUNT':_0x1bf2('0x5b'),'COUNT DISTINCT':_0x1bf2('0x5c'),'MAX':_0x1bf2('0x5d'),'MIN':_0x1bf2('0x5e'),'AVG':_0x1bf2('0x5f'),'GROUP_CONCAT':_0x1bf2('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ae808={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1bf2('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x1bf2('0x62'),'UNIX_TIMESTAMP':_0x1bf2('0x63')};var _0x40d1a1=function(_0x2c8a29){return!_[_0x1bf2('0x64')]([_0x1bf2('0x65'),_0x1bf2('0x66'),'IS\x20EMPTY',_0x1bf2('0x67')],_0x2c8a29);};var _0x1f7783=function(_0x5d9919){if(!_0x5d9919||!_0x5d9919[_0x1bf2('0x68')]['length']){return'';}for(var _0x5588be='(',_0x356f1b=0x0;_0x356f1b<_0x5d9919['rules'][_0x1bf2('0x3a')];_0x356f1b+=0x1){_0x356f1b>0x0&&(_0x5588be+='\x20'+_0x5d9919['operator']+'\x20');_0x5588be+=_0x5d9919[_0x1bf2('0x68')][_0x356f1b][_0x1bf2('0x69')]?_0x1f7783(_0x5d9919[_0x1bf2('0x68')][_0x356f1b]['group']):_0x5d9919[_0x1bf2('0x68')][_0x356f1b][_0x1bf2('0x6a')]+'\x20'+_0x5d9919[_0x1bf2('0x68')][_0x356f1b][_0x1bf2('0x6b')]+(_0x40d1a1(_0x5d9919[_0x1bf2('0x68')][_0x356f1b][_0x1bf2('0x6b')])?'\x20'+_0x5d9919[_0x1bf2('0x68')][_0x356f1b][_0x1bf2('0x6c')]:'');}return _0x5588be+')';};var _0x16898b={'where':{'id':_0x11e509[_0x1bf2('0x4a')]['id']}},_0x19b93a,_0x3e2e66,_0x11ba5f,_0x4ceb95,_0x33711a;_0x16898b=_[_0x1bf2('0x43')]({},_0x16898b,_0x11e509[_0x1bf2('0x45')]);return db[_0x1bf2('0x30')][_0x1bf2('0x4c')](_0x16898b)[_0x1bf2('0x26')](function(_0x3b10fc){if(_0x3b10fc){_0x19b93a=_0x3b10fc;return _0x3b10fc[_0x1bf2('0x6d')]();}return null;})['then'](function(_0x55449e){if(_0x55449e){if(!_0x55449e[_0x1bf2('0x3a')]){throw new db['Sequelize'][(_0x1bf2('0x6e'))](_0x1bf2('0x6f'),0x193);}_0x3e2e66=_0x55449e;return db[_0x1bf2('0x70')][_0x1bf2('0x71')]({'raw':!![]});}return null;})['then'](function(_0x3fb6ae){if(_0x3fb6ae){_0x11ba5f=_[_0x1bf2('0x72')](_0x3fb6ae,'id');var _0x2cbcf3;var _0x376401=squel[_0x1bf2('0x73')]();_0x376401['from'](_0x19b93a['table']);for(var _0xaec1d3=0x0;_0xaec1d3<_0x3e2e66[_0x1bf2('0x3a')];_0xaec1d3+=0x1){_0x2cbcf3=_0x3e2e66[_0xaec1d3][_0x1bf2('0x74')]?_0x11ba5f[_0x3e2e66[_0xaec1d3][_0x1bf2('0x74')]]['metric']:_0x3e2e66[_0xaec1d3]['field'];_0x2cbcf3=_0x3e2e66[_0xaec1d3][_0x1bf2('0x75')]?_[_0x1bf2('0x76')](_0x47c970[_0x3e2e66[_0xaec1d3][_0x1bf2('0x75')]],'%s',_0x2cbcf3):_0x2cbcf3;_0x2cbcf3=_0x3e2e66[_0xaec1d3][_0x1bf2('0x77')]?_[_0x1bf2('0x76')](_0x4ae808[_0x3e2e66[_0xaec1d3][_0x1bf2('0x77')]],'%s',_0x2cbcf3):_0x2cbcf3;if(_0x3e2e66[_0xaec1d3][_0x1bf2('0x78')]){_0x376401[_0x1bf2('0x69')](_0x2cbcf3);}_0x3e2e66[_0xaec1d3][_0x1bf2('0x79')]&&_0x376401[_0x1bf2('0x3e')](_0x2cbcf3,_0x3e2e66[_0xaec1d3]['orderBy']==='DESC'?![]:!![]);_0x376401[_0x1bf2('0x6a')](_0x2cbcf3,_0x3e2e66[_0xaec1d3]['alias']||_0x2cbcf3);}if(_0x19b93a[_0x1bf2('0x7a')]){_0x19b93a[_0x1bf2('0x7a')]=JSON[_0x1bf2('0x7b')](_0x19b93a['joins']);for(var _0x258314=0x0;_0x258314<_0x19b93a[_0x1bf2('0x7a')]['length'];_0x258314+=0x1){if(_0x19b93a[_0x1bf2('0x7a')][_0x258314][_0x1bf2('0x33')]&&_[_0x1bf2('0x64')](_0x52a83e,_0x19b93a[_0x1bf2('0x7a')][_0x258314][_0x1bf2('0x33')])&&_0x19b93a[_0x1bf2('0x7a')][_0x258314][_0x1bf2('0x7c')]&&_0x19b93a['joins'][_0x258314]['foreignTable']&&_0x19b93a['joins'][_0x258314][_0x1bf2('0x7d')]){_0x376401[_0x19b93a[_0x1bf2('0x7a')][_0x258314][_0x1bf2('0x33')]](_0x19b93a[_0x1bf2('0x7a')][_0x258314]['foreignTable'],null,util[_0x1bf2('0x77')](_0x1bf2('0x7e'),_0x19b93a[_0x1bf2('0x7f')],_0x19b93a['joins'][_0x258314]['parentKey'],_0x19b93a[_0x1bf2('0x7a')][_0x258314][_0x1bf2('0x80')],_0x19b93a[_0x1bf2('0x7a')][_0x258314]['foreignKey']));}}}if(_0x19b93a[_0x1bf2('0x81')]){_0x19b93a[_0x1bf2('0x81')]=JSON[_0x1bf2('0x7b')](_0x19b93a['conditions']);_0x376401[_0x1bf2('0x40')](_0x1f7783(_0x19b93a['conditions'][_0x1bf2('0x69')]));}_0x33711a=_0x376401['clone']();_0x376401[_0x1bf2('0x3d')](_0x3bbbce);_0x376401[_0x1bf2('0x1f')](0x0);logger[_0x1bf2('0x82')](_0x1bf2('0x83'),_0x376401[_0x1bf2('0x84')]());return dbH['sequelize']['query'](_0x376401[_0x1bf2('0x84')](),{'type':dbH[_0x1bf2('0x85')][_0x1bf2('0x86')][_0x1bf2('0x87')]});}})['then'](respondWithResult(_0x24d8e8,null))[_0x1bf2('0x4d')](handleError(_0x24d8e8,null));};function runReport(_0x5e93be,_0x3ffca4,_0x13e93a){var _0x20d0c9=_0x3ffca4[_0x1bf2('0x2d')];var _0x7286da=0xa;var _0x4df555=[_0x1bf2('0x88'),_0x1bf2('0x89'),_0x1bf2('0x59'),'cross_join'];var _0x2e72b0={'SUM':_0x1bf2('0x5a'),'COUNT':_0x1bf2('0x5b'),'COUNT DISTINCT':_0x1bf2('0x5c'),'MAX':_0x1bf2('0x5d'),'MIN':_0x1bf2('0x5e'),'AVG':_0x1bf2('0x5f'),'GROUP_CONCAT':_0x1bf2('0x60'),'GROUP_CONCAT ASC':_0x1bf2('0x8a'),'GROUP_CONCAT DESC':_0x1bf2('0x8b')};var _0x4511f5={'SEC_TO_TIME':_0x1bf2('0x8c'),'DATE':_0x1bf2('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x1bf2('0x62'),'UNIX_TIMESTAMP':_0x1bf2('0x63')};var _0x25bcab=function(_0xbf13f0){return!_[_0x1bf2('0x64')]([_0x1bf2('0x65'),_0x1bf2('0x66'),'IS\x20EMPTY',_0x1bf2('0x67')],_0xbf13f0);};var _0x1fa858=function(_0x3bfcfd){if(!_0x3bfcfd||!_0x3bfcfd[_0x1bf2('0x68')]['length']){return'';}for(var _0xcacfca='(',_0x35c4d0=0x0;_0x35c4d0<_0x3bfcfd['rules'][_0x1bf2('0x3a')];_0x35c4d0+=0x1){_0x35c4d0>0x0&&(_0xcacfca+='\x20'+_0x3bfcfd[_0x1bf2('0x8d')]+'\x20');_0xcacfca+=_0x3bfcfd[_0x1bf2('0x68')][_0x35c4d0][_0x1bf2('0x69')]?_0x1fa858(_0x3bfcfd[_0x1bf2('0x68')][_0x35c4d0][_0x1bf2('0x69')]):_0x3bfcfd[_0x1bf2('0x68')][_0x35c4d0]['field']+'\x20'+_0x3bfcfd[_0x1bf2('0x68')][_0x35c4d0][_0x1bf2('0x6b')]+(_0x25bcab(_0x3bfcfd[_0x1bf2('0x68')][_0x35c4d0][_0x1bf2('0x6b')])?'\x20'+_0x3bfcfd['rules'][_0x35c4d0][_0x1bf2('0x6c')]:'');}return _0xcacfca+')';};var _0x4d3a45={'where':{'id':_0x5e93be['id']}},_0x3082e5,_0x2712c9,_0x3f94bd,_0x7ce3c5,_0x4ea9bd;_0x4d3a45=_['merge']({},_0x4d3a45,_0x13e93a);return db['AnalyticCustomReport']['find'](_0x4d3a45)[_0x1bf2('0x26')](function(_0x1f80dc){if(_0x1f80dc){_0x3082e5=_0x1f80dc;return _0x1f80dc[_0x1bf2('0x6d')]();}return null;})['then'](function(_0x31063c){if(_0x31063c){if(!_0x31063c[_0x1bf2('0x3a')]){throw new db['Sequelize'][(_0x1bf2('0x6e'))](_0x1bf2('0x6f'),0x193);}_0x2712c9=_0x31063c;return db[_0x1bf2('0x70')]['findAll']({'raw':!![]});}return null;})[_0x1bf2('0x26')](function(_0x225617){if(_0x225617){_0x3f94bd=_[_0x1bf2('0x72')](_0x225617,'id');var _0x5cebac;var _0x3d69fb=squel[_0x1bf2('0x73')]();_0x3d69fb[_0x1bf2('0x8e')](_0x3082e5[_0x1bf2('0x7f')]);for(var _0x5ecc4c=0x0;_0x5ecc4c<_0x2712c9[_0x1bf2('0x3a')];_0x5ecc4c+=0x1){_0x5cebac=_0x2712c9[_0x5ecc4c]['MetricId']?_0x3f94bd[_0x2712c9[_0x5ecc4c][_0x1bf2('0x74')]][_0x1bf2('0x8f')]:_0x2712c9[_0x5ecc4c][_0x1bf2('0x6a')];_0x5cebac=_0x2712c9[_0x5ecc4c][_0x1bf2('0x75')]?_[_0x1bf2('0x76')](_0x2e72b0[_0x2712c9[_0x5ecc4c][_0x1bf2('0x75')]],'%s',_0x5cebac):_0x5cebac;_0x5cebac=_0x2712c9[_0x5ecc4c]['format']?_[_0x1bf2('0x76')](_0x4511f5[_0x2712c9[_0x5ecc4c]['format']],'%s',_0x5cebac):_0x5cebac;if(_0x2712c9[_0x5ecc4c][_0x1bf2('0x78')]){_0x3d69fb[_0x1bf2('0x69')](_0x5cebac);}_0x2712c9[_0x5ecc4c][_0x1bf2('0x79')]&&_0x3d69fb[_0x1bf2('0x3e')](_0x5cebac,_0x2712c9[_0x5ecc4c][_0x1bf2('0x79')]===_0x1bf2('0x90')?![]:!![]);_0x3d69fb[_0x1bf2('0x6a')](_0x5cebac,_0x2712c9[_0x5ecc4c][_0x1bf2('0x91')]||_0x5cebac);}if(_0x3082e5[_0x1bf2('0x7a')]){_0x3082e5[_0x1bf2('0x7a')]=JSON[_0x1bf2('0x7b')](_0x3082e5[_0x1bf2('0x7a')]);for(var _0x2be8ae=0x0;_0x2be8ae<_0x3082e5['joins'][_0x1bf2('0x3a')];_0x2be8ae+=0x1){if(_0x3082e5['joins'][_0x2be8ae][_0x1bf2('0x33')]&&_['includes'](_0x4df555,_0x3082e5['joins'][_0x2be8ae][_0x1bf2('0x33')])&&_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae]['parentKey']&&_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae][_0x1bf2('0x80')]&&_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae][_0x1bf2('0x7d')]){_0x3d69fb[_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae][_0x1bf2('0x33')]](_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae][_0x1bf2('0x80')],null,util[_0x1bf2('0x77')](_0x1bf2('0x7e'),_0x3082e5[_0x1bf2('0x7f')],_0x3082e5[_0x1bf2('0x7a')][_0x2be8ae][_0x1bf2('0x7c')],_0x3082e5['joins'][_0x2be8ae][_0x1bf2('0x80')],_0x3082e5['joins'][_0x2be8ae]['foreignKey']));}}}if(_0x3082e5['conditions']){_0x3082e5[_0x1bf2('0x81')]=JSON['parse'](_0x3082e5[_0x1bf2('0x81')]);_0x3d69fb['where'](_0x1fa858(_0x3082e5[_0x1bf2('0x81')][_0x1bf2('0x69')]));}_0x4ea9bd=_0x3d69fb[_0x1bf2('0x92')]();_0x3d69fb['limit'](_0x7286da);_0x3d69fb['offset'](0x0);return;}})[_0x1bf2('0x26')](function(){if(_0x3ffca4[_0x1bf2('0x93')]==='web'){return null;}var _0xd6e73e=_[_0x1bf2('0x43')](_0x3ffca4,{'name':_0x3ffca4[_0x1bf2('0x94')]||_0x3ffca4[_0x1bf2('0x2d')]||_0x3082e5[_0x1bf2('0x2d')],'basename':_0x20d0c9,'savename':util[_0x1bf2('0x77')](_0x1bf2('0x95'),_0x3ffca4[_0x1bf2('0x2d')]||_0x3082e5[_0x1bf2('0x2d')],require(_0x1bf2('0x96'))[_0x1bf2('0x97')](0x4),_0x3ffca4[_0x1bf2('0x93')]||_0x1bf2('0x98')),'reportId':_0x3082e5['id'],'reportType':'custom'});return db[_0x1bf2('0x99')][_0x1bf2('0x4e')](_0xd6e73e,{'raw':!![]});})[_0x1bf2('0x26')](function(_0x59d180){if(_0x3082e5[_0x1bf2('0x7f')]===_0x1bf2('0x9a')){_0x4ea9bd[_0x1bf2('0x40')](_0x3082e5[_0x1bf2('0x7f')]+_0x1bf2('0x9b'),_0x3ffca4[_0x1bf2('0x9c')],_0x3ffca4[_0x1bf2('0x9d')]);}else{_0x4ea9bd[_0x1bf2('0x40')](_0x3082e5['table']+_0x1bf2('0x9e'),_0x3ffca4[_0x1bf2('0x9c')],_0x3ffca4[_0x1bf2('0x9d')]);}if(_0x59d180){logger['info']('Run\x20Query:',_0x4ea9bd[_0x1bf2('0x84')]());require(_0x1bf2('0x9f'))[_0x1bf2('0xa0')](path[_0x1bf2('0x88')](__dirname,_0x1bf2('0xa1'),_0x59d180['output']),[_0x59d180['id'],_0x4ea9bd['toString'](),path[_0x1bf2('0x88')](__dirname,'../../files/reports',_0x59d180[_0x1bf2('0xa2')]),_0x20d0c9]);return _0x59d180;}else{var _0x1d379e=squel[_0x1bf2('0x73')]();_0x1d379e['from']('('+_0x4ea9bd[_0x1bf2('0x84')]()+')','countTable');_0x1d379e[_0x1bf2('0x6a')](_0x1bf2('0xa3'),'count');_0x4ea9bd[_0x1bf2('0x3d')](_0x3ffca4['limit']||_0x7286da);_0x4ea9bd[_0x1bf2('0x1f')](_0x3ffca4[_0x1bf2('0x1f')]||0x0);return dbH['sequelize']['query'](_0x1d379e['toString'](),{'type':dbH[_0x1bf2('0x85')][_0x1bf2('0x86')][_0x1bf2('0x87')]})['then'](function(_0x1f4cad){if(!_0x1f4cad[_0x1bf2('0x3a')]){_0x7ce3c5=0x0;}else{_0x7ce3c5=_0x1f4cad[0x0]['count']||0x0;}return dbH[_0x1bf2('0x85')]['query'](_0x4ea9bd[_0x1bf2('0x84')](),{'type':dbH[_0x1bf2('0x85')][_0x1bf2('0x86')][_0x1bf2('0x87')]});})[_0x1bf2('0x26')](function(_0x3d4601){return{'rows':_0x3d4601||[],'count':_0x7ce3c5};});}});}exports['run']=function(_0x5a06e9,_0x184c2b){return runReport(_0x5a06e9[_0x1bf2('0x4a')],_0x5a06e9['query'],_0x5a06e9[_0x1bf2('0x45')])['then'](respondWithResult(_0x184c2b,null))[_0x1bf2('0x4d')](handleError(_0x184c2b,null));};exports[_0x1bf2('0xa4')]=runReport;exports['query']=function(_0x7169b,_0x4048ac){var _0x4ada0a=0xa;var _0xa24947=[_0x1bf2('0x88'),_0x1bf2('0x89'),_0x1bf2('0x59'),_0x1bf2('0xa5')];var _0x25ed78={'SUM':_0x1bf2('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1bf2('0x5c'),'MAX':'MAX(%s)','MIN':_0x1bf2('0x5e'),'AVG':_0x1bf2('0x5f'),'GROUP_CONCAT':_0x1bf2('0x60'),'GROUP_CONCAT ASC':_0x1bf2('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x51877e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1bf2('0x61'),'HOUR':_0x1bf2('0xa6'),'ROUND':_0x1bf2('0x62'),'UNIX_TIMESTAMP':_0x1bf2('0x63')};var _0x136ba2=function(_0x12cafa){return!_[_0x1bf2('0x64')]([_0x1bf2('0x65'),'IS\x20NOT\x20NULL',_0x1bf2('0xa7'),_0x1bf2('0x67')],_0x12cafa);};var _0x2cc744=function(_0x59286a){if(!_0x59286a||!_0x59286a[_0x1bf2('0x68')]['length']){return'';}for(var _0x531338='(',_0x132c4f=0x0;_0x132c4f<_0x59286a[_0x1bf2('0x68')][_0x1bf2('0x3a')];_0x132c4f+=0x1){_0x132c4f>0x0&&(_0x531338+='\x20'+_0x59286a['operator']+'\x20');_0x531338+=_0x59286a[_0x1bf2('0x68')][_0x132c4f][_0x1bf2('0x69')]?_0x2cc744(_0x59286a[_0x1bf2('0x68')][_0x132c4f][_0x1bf2('0x69')]):_0x59286a[_0x1bf2('0x68')][_0x132c4f]['field']+'\x20'+_0x59286a[_0x1bf2('0x68')][_0x132c4f][_0x1bf2('0x6b')]+(_0x136ba2(_0x59286a[_0x1bf2('0x68')][_0x132c4f][_0x1bf2('0x6b')])?'\x20'+_0x59286a[_0x1bf2('0x68')][_0x132c4f][_0x1bf2('0x6c')]:'');}return _0x531338+')';};var _0xbe0bb1={'where':{'id':_0x7169b[_0x1bf2('0x4a')]['id']}},_0x59ae19,_0x586dd9,_0x3a780c,_0x343a0a,_0xf36346;_0xbe0bb1=_[_0x1bf2('0x43')]({},_0xbe0bb1,_0x7169b['options']);return db[_0x1bf2('0x30')][_0x1bf2('0x4c')](_0xbe0bb1)[_0x1bf2('0x26')](function(_0x54fa0e){if(_0x54fa0e){_0x59ae19=_0x54fa0e;return _0x54fa0e['getFields']();}return null;})[_0x1bf2('0x26')](function(_0x59aa12){if(_0x59aa12){if(!_0x59aa12['length']){throw new db['Sequelize'][(_0x1bf2('0x6e'))](_0x1bf2('0x6f'),0x193);}_0x586dd9=_0x59aa12;return db[_0x1bf2('0x70')][_0x1bf2('0x71')]({'raw':!![]});}return null;})[_0x1bf2('0x26')](function(_0x21177c){if(_0x21177c){_0x3a780c=_[_0x1bf2('0x72')](_0x21177c,'id');var _0x571448;var _0xc38d16=squel[_0x1bf2('0x73')]();_0xc38d16[_0x1bf2('0x8e')](_0x59ae19[_0x1bf2('0x7f')]);for(var _0x32eaad=0x0;_0x32eaad<_0x586dd9['length'];_0x32eaad+=0x1){_0x571448=_0x586dd9[_0x32eaad][_0x1bf2('0x74')]?_0x3a780c[_0x586dd9[_0x32eaad]['MetricId']][_0x1bf2('0x8f')]:_0x586dd9[_0x32eaad][_0x1bf2('0x6a')];_0x571448=_0x586dd9[_0x32eaad][_0x1bf2('0x75')]?_[_0x1bf2('0x76')](_0x25ed78[_0x586dd9[_0x32eaad][_0x1bf2('0x75')]],'%s',_0x571448):_0x571448;_0x571448=_0x586dd9[_0x32eaad][_0x1bf2('0x77')]?_[_0x1bf2('0x76')](_0x51877e[_0x586dd9[_0x32eaad][_0x1bf2('0x77')]],'%s',_0x571448):_0x571448;if(_0x586dd9[_0x32eaad]['groupBy']){_0xc38d16[_0x1bf2('0x69')](_0x571448);}_0x586dd9[_0x32eaad][_0x1bf2('0x79')]&&_0xc38d16[_0x1bf2('0x3e')](_0x571448,_0x586dd9[_0x32eaad][_0x1bf2('0x79')]===_0x1bf2('0x90')?![]:!![]);_0xc38d16[_0x1bf2('0x6a')](_0x571448,_0x586dd9[_0x32eaad][_0x1bf2('0x91')]||_0x571448);}if(_0x59ae19[_0x1bf2('0x7a')]){_0x59ae19[_0x1bf2('0x7a')]=JSON['parse'](_0x59ae19[_0x1bf2('0x7a')]);for(var _0x5e98f1=0x0;_0x5e98f1<_0x59ae19[_0x1bf2('0x7a')][_0x1bf2('0x3a')];_0x5e98f1+=0x1){if(_0x59ae19['joins'][_0x5e98f1][_0x1bf2('0x33')]&&_[_0x1bf2('0x64')](_0xa24947,_0x59ae19['joins'][_0x5e98f1][_0x1bf2('0x33')])&&_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1]['parentKey']&&_0x59ae19['joins'][_0x5e98f1][_0x1bf2('0x80')]&&_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1][_0x1bf2('0x7d')]){_0xc38d16[_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1][_0x1bf2('0x33')]](_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1]['foreignTable'],null,util[_0x1bf2('0x77')](_0x1bf2('0x7e'),_0x59ae19[_0x1bf2('0x7f')],_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1][_0x1bf2('0x7c')],_0x59ae19[_0x1bf2('0x7a')][_0x5e98f1][_0x1bf2('0x80')],_0x59ae19['joins'][_0x5e98f1][_0x1bf2('0x7d')]));}}}if(_0x59ae19[_0x1bf2('0x81')]){_0x59ae19[_0x1bf2('0x81')]=JSON[_0x1bf2('0x7b')](_0x59ae19[_0x1bf2('0x81')]);_0xc38d16['where'](_0x2cc744(_0x59ae19[_0x1bf2('0x81')][_0x1bf2('0x69')]));}_0xf36346=_0xc38d16[_0x1bf2('0x92')]();_0xc38d16[_0x1bf2('0x3d')](_0x4ada0a);_0xc38d16[_0x1bf2('0x1f')](0x0);logger['debug'](_0x1bf2('0x83'),_0xc38d16['toString']());return dbH['sequelize'][_0x1bf2('0x36')](_0xc38d16[_0x1bf2('0x84')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0xf36346[_0x1bf2('0x84')]()};})[_0x1bf2('0x26')](respondWithResult(_0x4048ac,null))[_0x1bf2('0x4d')](handleError(_0x4048ac,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 70cecc8..0fbebdc 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 _0xf418=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports'];(function(_0x42a791,_0x1f32c7){var _0x1732b1=function(_0x5ed167){while(--_0x5ed167){_0x42a791['push'](_0x42a791['shift']());}};_0x1732b1(++_0x1f32c7);}(_0xf418,0xf0));var _0x8f41=function(_0x1da3a4,_0x5a5a8b){_0x1da3a4=_0x1da3a4-0x0;var _0x88c6ab=_0xf418[_0x1da3a4];return _0x88c6ab;};'use strict';var _=require(_0x8f41('0x0'));var util=require('util');var logger=require(_0x8f41('0x1'))(_0x8f41('0x2'));var moment=require(_0x8f41('0x3'));var BPromise=require(_0x8f41('0x4'));var rp=require(_0x8f41('0x5'));var fs=require('fs');var path=require(_0x8f41('0x6'));var rimraf=require('rimraf');var config=require(_0x8f41('0x7'));var attributes=require(_0x8f41('0x8'));module[_0x8f41('0x9')]=function(_0x1bb3d1,_0x3d002b){return _0x1bb3d1[_0x8f41('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x8f41('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e55=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e55,0x127));var _0x53e5=function(_0x4fff26,_0x4ba88e){_0x4fff26=_0x4fff26-0x0;var _0x56cb24=_0x3e55[_0x4fff26];return _0x56cb24;};'use strict';var _=require(_0x53e5('0x0'));var util=require('util');var logger=require(_0x53e5('0x1'))('api');var moment=require(_0x53e5('0x2'));var BPromise=require(_0x53e5('0x3'));var rp=require(_0x53e5('0x4'));var fs=require('fs');var path=require(_0x53e5('0x5'));var rimraf=require(_0x53e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x53e5('0x7'));module[_0x53e5('0x8')]=function(_0x3e1db9,_0x53baf0){return _0x3e1db9['define'](_0x53e5('0x9'),attributes,{'tableName':_0x53e5('0xa'),'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 f8aee97..63dd15d 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 _0x81d0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x35fc3a,_0x327ea7){var _0x339c58=function(_0x1a22ff){while(--_0x1a22ff){_0x35fc3a['push'](_0x35fc3a['shift']());}};_0x339c58(++_0x327ea7);}(_0x81d0,0x119));var _0x081d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x081d('0x0'));var util=require(_0x081d('0x1'));var moment=require(_0x081d('0x2'));var BPromise=require('bluebird');var rs=require(_0x081d('0x3'));var fs=require('fs');var Redis=require(_0x081d('0x4'));var db=require(_0x081d('0x5'))['db'];var utils=require(_0x081d('0x6'));var logger=require(_0x081d('0x7'))(_0x081d('0x8'));var config=require(_0x081d('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7922d9,_0x17cb85,_0x296270){return new BPromise(function(_0x4406ee,_0x3b3b6a){return client[_0x081d('0xa')](_0x7922d9,_0x296270)[_0x081d('0xb')](function(_0x15a1b8){logger[_0x081d('0xc')](_0x081d('0xd'),_0x17cb85,'request\x20sent');logger[_0x081d('0xe')](_0x081d('0xf'),_0x17cb85,'request\x20sent',JSON[_0x081d('0x10')](_0x15a1b8));if(_0x15a1b8[_0x081d('0x11')]){if(_0x15a1b8[_0x081d('0x11')]['code']===0x1f4){logger[_0x081d('0x11')](_0x081d('0xd'),_0x17cb85,_0x15a1b8[_0x081d('0x11')][_0x081d('0x12')]);return _0x3b3b6a(_0x15a1b8[_0x081d('0x11')][_0x081d('0x12')]);}logger[_0x081d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x17cb85,_0x15a1b8[_0x081d('0x11')][_0x081d('0x12')]);return _0x4406ee(_0x15a1b8['error'][_0x081d('0x12')]);}else{logger[_0x081d('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x17cb85,_0x081d('0x13'));_0x4406ee(_0x15a1b8[_0x081d('0x14')][_0x081d('0x12')]);}})[_0x081d('0x15')](function(_0x1cbcf5){logger[_0x081d('0x11')](_0x081d('0xd'),_0x17cb85,_0x1cbcf5);_0x3b3b6a(_0x1cbcf5);});});} \ No newline at end of file +var _0xd9f4=['message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd9f4,0xac));var _0x4d9f=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xd9f4[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x4d9f('0x0'));var util=require('util');var moment=require(_0x4d9f('0x1'));var BPromise=require(_0x4d9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d9f('0x3'));var db=require(_0x4d9f('0x4'))['db'];var utils=require(_0x4d9f('0x5'));var logger=require('../../config/logger')(_0x4d9f('0x6'));var config=require(_0x4d9f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6df,_0x4002fd,_0x473fe7){return new BPromise(function(_0x216980,_0x164560){return client[_0x4d9f('0x8')](_0x4dc6df,_0x473fe7)[_0x4d9f('0x9')](function(_0xa40336){logger[_0x4d9f('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4002fd,_0x4d9f('0xb'));logger[_0x4d9f('0xc')](_0x4d9f('0xd'),_0x4002fd,_0x4d9f('0xb'),JSON[_0x4d9f('0xe')](_0xa40336));if(_0xa40336[_0x4d9f('0xf')]){if(_0xa40336[_0x4d9f('0xf')][_0x4d9f('0x10')]===0x1f4){logger['error'](_0x4d9f('0x11'),_0x4002fd,_0xa40336[_0x4d9f('0xf')]['message']);return _0x164560(_0xa40336['error'][_0x4d9f('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4002fd,_0xa40336[_0x4d9f('0xf')][_0x4d9f('0x12')]);return _0x216980(_0xa40336[_0x4d9f('0xf')][_0x4d9f('0x12')]);}else{logger['info'](_0x4d9f('0x11'),_0x4002fd,_0x4d9f('0xb'));_0x216980(_0xa40336['result'][_0x4d9f('0x12')]);}})['catch'](function(_0x5456ae){logger[_0x4d9f('0xf')](_0x4d9f('0x11'),_0x4002fd,_0x5456ae);_0x164560(_0x5456ae);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 72efb4a..43b68b9 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 _0xbc2c=['/:id/query','query','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x1305a5,_0x43a964){var _0x4df750=function(_0x217da7){while(--_0x217da7){_0x1305a5['push'](_0x1305a5['shift']());}};_0x4df750(++_0x43a964);}(_0xbc2c,0x19e));var _0xcbc2=function(_0x2fe383,_0x4ca01b){_0x2fe383=_0x2fe383-0x0;var _0x496a15=_0xbc2c[_0x2fe383];return _0x496a15;};'use strict';var multer=require(_0xcbc2('0x0'));var util=require(_0xcbc2('0x1'));var path=require(_0xcbc2('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbc2('0x3'));var router=express[_0xcbc2('0x4')]();var fs_extra=require(_0xcbc2('0x5'));var auth=require(_0xcbc2('0x6'));var interaction=require(_0xcbc2('0x7'));var config=require(_0xcbc2('0x8'));var controller=require(_0xcbc2('0x9'));router[_0xcbc2('0xa')]('/',auth[_0xcbc2('0xb')](),controller[_0xcbc2('0xc')]);router[_0xcbc2('0xa')](_0xcbc2('0xd'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0xe')]);router['get'](_0xcbc2('0xf'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x10')]);router[_0xcbc2('0xa')](_0xcbc2('0x11'),auth[_0xcbc2('0xb')](),controller['run']);router[_0xcbc2('0xa')](_0xcbc2('0x12'),auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x13')]);router['post']('/',auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x14')]);router['put']('/:id',auth[_0xcbc2('0xb')](),controller[_0xcbc2('0x15')]);router[_0xcbc2('0x16')](_0xcbc2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcbc2('0x17')]=router; \ No newline at end of file +var _0x2cb4=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete'];(function(_0x459a5c,_0x5caa61){var _0x138038=function(_0xe10aa4){while(--_0xe10aa4){_0x459a5c['push'](_0x459a5c['shift']());}};_0x138038(++_0x5caa61);}(_0x2cb4,0x1cc));var _0x42cb=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x2cb4[_0x4fa0ea];return _0x51d027;};'use strict';var multer=require(_0x42cb('0x0'));var util=require(_0x42cb('0x1'));var path=require(_0x42cb('0x2'));var timeout=require(_0x42cb('0x3'));var express=require(_0x42cb('0x4'));var router=express[_0x42cb('0x5')]();var fs_extra=require(_0x42cb('0x6'));var auth=require(_0x42cb('0x7'));var interaction=require(_0x42cb('0x8'));var config=require(_0x42cb('0x9'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x42cb('0xa')](),controller[_0x42cb('0xb')]);router[_0x42cb('0xc')](_0x42cb('0xd'),auth[_0x42cb('0xa')](),controller[_0x42cb('0xe')]);router['get'](_0x42cb('0xf'),auth[_0x42cb('0xa')](),controller[_0x42cb('0x10')]);router['get'](_0x42cb('0x11'),auth[_0x42cb('0xa')](),controller[_0x42cb('0x12')]);router['get'](_0x42cb('0x13'),auth[_0x42cb('0xa')](),controller[_0x42cb('0x14')]);router[_0x42cb('0x15')]('/',auth['isAuthenticated'](),controller[_0x42cb('0x16')]);router[_0x42cb('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x42cb('0x18')]);router[_0x42cb('0x19')](_0x42cb('0xd'),auth[_0x42cb('0xa')](),controller['destroy']);module[_0x42cb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e6d98bf..2ba31bc 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x4e611c,_0x3a3057){var _0x168a72=function(_0x32ddcf){while(--_0x32ddcf){_0x4e611c['push'](_0x4e611c['shift']());}};_0x168a72(++_0x3a3057);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x36d2a1,_0x176456){var _0x5de65d=function(_0xb44b57){while(--_0xb44b57){_0x36d2a1['push'](_0x36d2a1['shift']());}};_0x5de65d(++_0x176456);}(_0x6aa7,0x178));var _0x76aa=function(_0x560406,_0x3da3f7){_0x560406=_0x560406-0x0;var _0x4e2bbf=_0x6aa7[_0x560406];return _0x4e2bbf;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 430acb4..fbadf27 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3af576,_0x2b4be0){var _0xca84cd=function(_0x68403b){while(--_0x68403b){_0x3af576['push'](_0x3af576['shift']());}};_0xca84cd(++_0x2b4be0);}(_0x4975,0x86));var _0x5497=function(_0x4af63b,_0x3fa86b){_0x4af63b=_0x4af63b-0x0;var _0x1d59ab=_0x4975[_0x4af63b];return _0x1d59ab;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','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','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x2e726e,_0x3faf87){var _0x273748=function(_0x3d9fbb){while(--_0x3d9fbb){_0x2e726e['push'](_0x2e726e['shift']());}};_0x273748(++_0x3faf87);}(_0xda19,0xd5));var _0x9da1=function(_0x45cafc,_0x37c891){_0x45cafc=_0x45cafc-0x0;var _0x21d385=_0xda19[_0x45cafc];return _0x21d385;};'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'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b17b6b0..5ccb2ac 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 _0xdee9=['../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdee9,0x1b2));var _0x9dee=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xdee9[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x9dee('0x0'));var util=require(_0x9dee('0x1'));var logger=require(_0x9dee('0x2'))(_0x9dee('0x3'));var moment=require('moment');var BPromise=require(_0x9dee('0x4'));var rp=require(_0x9dee('0x5'));var fs=require('fs');var path=require(_0x9dee('0x6'));var rimraf=require(_0x9dee('0x7'));var config=require(_0x9dee('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x9dee('0x9')]=function(_0x17a4b7,_0x687199){return _0x17a4b7[_0x9dee('0xa')](_0x9dee('0xb'),attributes,{'tableName':_0x9dee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe797=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash'];(function(_0x247b94,_0x57ed01){var _0x50029f=function(_0x51013d){while(--_0x51013d){_0x247b94['push'](_0x247b94['shift']());}};_0x50029f(++_0x57ed01);}(_0xe797,0xdc));var _0x7e79=function(_0x2f8b86,_0x14fb9f){_0x2f8b86=_0x2f8b86-0x0;var _0x340414=_0xe797[_0x2f8b86];return _0x340414;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var logger=require(_0x7e79('0x2'))(_0x7e79('0x3'));var moment=require(_0x7e79('0x4'));var BPromise=require(_0x7e79('0x5'));var rp=require(_0x7e79('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e79('0x7'));var config=require(_0x7e79('0x8'));var attributes=require(_0x7e79('0x9'));module[_0x7e79('0xa')]=function(_0x19c696,_0x501ba6){return _0x19c696[_0x7e79('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0x7e79('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 5b756f8..e616858 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 _0xcf7a=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x35b201,_0x4a6e0c){var _0x998cc0=function(_0x2f0565){while(--_0x2f0565){_0x35b201['push'](_0x35b201['shift']());}};_0x998cc0(++_0x4a6e0c);}(_0xcf7a,0x1a7));var _0xacf7=function(_0x169c25,_0xb9b181){_0x169c25=_0x169c25-0x0;var _0x3688b4=_0xcf7a[_0x169c25];return _0x3688b4;};'use strict';var _=require(_0xacf7('0x0'));var util=require(_0xacf7('0x1'));var moment=require(_0xacf7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacf7('0x3'));var db=require(_0xacf7('0x4'))['db'];var utils=require(_0xacf7('0x5'));var logger=require(_0xacf7('0x6'))(_0xacf7('0x7'));var config=require(_0xacf7('0x8'));var jayson=require(_0xacf7('0x9'));var client=jayson[_0xacf7('0xa')][_0xacf7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d1f9,_0x616916,_0x3cc8e9){return new BPromise(function(_0x5cf8a9,_0x4547a1){return client[_0xacf7('0xc')](_0x17d1f9,_0x3cc8e9)[_0xacf7('0xd')](function(_0x1266e0){logger['info'](_0xacf7('0xe'),_0x616916,_0xacf7('0xf'));logger[_0xacf7('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x616916,_0xacf7('0xf'),JSON[_0xacf7('0x11')](_0x1266e0));if(_0x1266e0['error']){if(_0x1266e0[_0xacf7('0x12')][_0xacf7('0x13')]===0x1f4){logger[_0xacf7('0x12')](_0xacf7('0xe'),_0x616916,_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);return _0x4547a1(_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);}logger['error'](_0xacf7('0xe'),_0x616916,_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);return _0x5cf8a9(_0x1266e0[_0xacf7('0x12')]['message']);}else{logger[_0xacf7('0x15')](_0xacf7('0xe'),_0x616916,'request\x20sent');_0x5cf8a9(_0x1266e0[_0xacf7('0x16')]['message']);}})['catch'](function(_0x230022){logger[_0xacf7('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x616916,_0x230022);_0x4547a1(_0x230022);});});} \ No newline at end of file +var _0x4d30=['code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x152341,_0x8f0c56){var _0x440e1b=function(_0x33918f){while(--_0x33918f){_0x152341['push'](_0x152341['shift']());}};_0x440e1b(++_0x8f0c56);}(_0x4d30,0xc6));var _0x04d3=function(_0x362fd0,_0x316ea4){_0x362fd0=_0x362fd0-0x0;var _0x3e20bb=_0x4d30[_0x362fd0];return _0x3e20bb;};'use strict';var _=require('lodash');var util=require(_0x04d3('0x0'));var moment=require(_0x04d3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04d3('0x2'));var db=require(_0x04d3('0x3'))['db'];var utils=require(_0x04d3('0x4'));var logger=require(_0x04d3('0x5'))(_0x04d3('0x6'));var config=require(_0x04d3('0x7'));var jayson=require(_0x04d3('0x8'));var client=jayson[_0x04d3('0x9')][_0x04d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae4db,_0x21d8b2,_0x3875f4){return new BPromise(function(_0x470fcb,_0x16f8a1){return client[_0x04d3('0xb')](_0x2ae4db,_0x3875f4)[_0x04d3('0xc')](function(_0xdcea8c){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x21d8b2,'request\x20sent');logger[_0x04d3('0xd')](_0x04d3('0xe'),_0x21d8b2,_0x04d3('0xf'),JSON[_0x04d3('0x10')](_0xdcea8c));if(_0xdcea8c['error']){if(_0xdcea8c[_0x04d3('0x11')][_0x04d3('0x12')]===0x1f4){logger['error'](_0x04d3('0x13'),_0x21d8b2,_0xdcea8c[_0x04d3('0x11')][_0x04d3('0x14')]);return _0x16f8a1(_0xdcea8c[_0x04d3('0x11')][_0x04d3('0x14')]);}logger[_0x04d3('0x11')](_0x04d3('0x13'),_0x21d8b2,_0xdcea8c[_0x04d3('0x11')][_0x04d3('0x14')]);return _0x470fcb(_0xdcea8c[_0x04d3('0x11')][_0x04d3('0x14')]);}else{logger[_0x04d3('0x15')](_0x04d3('0x13'),_0x21d8b2,_0x04d3('0xf'));_0x470fcb(_0xdcea8c[_0x04d3('0x16')][_0x04d3('0x14')]);}})[_0x04d3('0x17')](function(_0x5cb6b3){logger[_0x04d3('0x11')](_0x04d3('0x13'),_0x21d8b2,_0x5cb6b3);_0x16f8a1(_0x5cb6b3);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 42e3a16..ba71f49 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 _0xc627=['get','/:id','show','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xc627,0x12b));var _0x7c62=function(_0x2ea107,_0xd3322a){_0x2ea107=_0x2ea107-0x0;var _0xd82057=_0xc627[_0x2ea107];return _0xd82057;};'use strict';var multer=require(_0x7c62('0x0'));var util=require(_0x7c62('0x1'));var path=require(_0x7c62('0x2'));var timeout=require(_0x7c62('0x3'));var express=require(_0x7c62('0x4'));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(_0x7c62('0x5'));var controller=require(_0x7c62('0x6'));router['get']('/',auth[_0x7c62('0x7')](),controller[_0x7c62('0x8')]);router[_0x7c62('0x9')](_0x7c62('0xa'),auth[_0x7c62('0x7')](),controller[_0x7c62('0xb')]);router['get']('/:id/preview',auth[_0x7c62('0x7')](),controller['preview']);router[_0x7c62('0x9')](_0x7c62('0xc'),auth[_0x7c62('0x7')](),controller[_0x7c62('0xd')]);router['get'](_0x7c62('0xe'),auth[_0x7c62('0x7')](),controller[_0x7c62('0xf')]);router[_0x7c62('0x10')]('/',auth[_0x7c62('0x7')](),controller[_0x7c62('0x11')]);router[_0x7c62('0x12')](_0x7c62('0xa'),auth['isAuthenticated'](),controller[_0x7c62('0x13')]);router[_0x7c62('0x14')](_0x7c62('0xa'),auth[_0x7c62('0x7')](),controller[_0x7c62('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4af0=['isAuthenticated','preview','/:id/run','run','query','post','create','put','delete','destroy','exports','path','express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4af0,0x15b));var _0x04af=function(_0x52d637,_0x4f76ce){_0x52d637=_0x52d637-0x0;var _0x2de925=_0x4af0[_0x52d637];return _0x2de925;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x04af('0x0'));var timeout=require('connect-timeout');var express=require(_0x04af('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x04af('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x04af('0x3'));var controller=require(_0x04af('0x4'));router[_0x04af('0x5')]('/',auth['isAuthenticated'](),controller[_0x04af('0x6')]);router[_0x04af('0x5')](_0x04af('0x7'),auth['isAuthenticated'](),controller[_0x04af('0x8')]);router[_0x04af('0x5')](_0x04af('0x9'),auth[_0x04af('0xa')](),controller[_0x04af('0xb')]);router[_0x04af('0x5')](_0x04af('0xc'),auth[_0x04af('0xa')](),controller[_0x04af('0xd')]);router[_0x04af('0x5')]('/:id/query',auth[_0x04af('0xa')](),controller[_0x04af('0xe')]);router[_0x04af('0xf')]('/',auth[_0x04af('0xa')](),controller[_0x04af('0x10')]);router[_0x04af('0x11')](_0x04af('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x04af('0x12')](_0x04af('0x7'),auth[_0x04af('0xa')](),controller[_0x04af('0x13')]);module[_0x04af('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1a64d61..8f2e77d 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 _0x6574=['exports','STRING','ENUM','xlsx','DATE','scheduled','manual','INTEGER','sequelize','moment'];(function(_0x5bfdc1,_0x7b1e19){var _0xd18268=function(_0x43ff55){while(--_0x43ff55){_0x5bfdc1['push'](_0x5bfdc1['shift']());}};_0xd18268(++_0x7b1e19);}(_0x6574,0x18e));var _0x4657=function(_0x50dea1,_0x3dc580){_0x50dea1=_0x50dea1-0x0;var _0x300b3f=_0x6574[_0x50dea1];return _0x300b3f;};'use strict';var Sequelize=require(_0x4657('0x0'));var moment=require(_0x4657('0x1'));module[_0x4657('0x2')]={'name':{'type':Sequelize[_0x4657('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4657('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4657('0x4')]('csv','pdf',_0x4657('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x4657('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4657('0x6')]},'status':{'type':Sequelize[_0x4657('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0x4657('0x7')),'allowNull':![],'defaultValue':_0x4657('0x8')},'reportId':{'type':Sequelize[_0x4657('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x4657('0x3')]}}; \ No newline at end of file +var _0x73bc=['exports','STRING','csv','pdf','xlsx','DATE','ENUM','manual','scheduled','INTEGER','sequelize','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x73bc,0xfa));var _0xc73b=function(_0x2afb83,_0x567025){_0x2afb83=_0x2afb83-0x0;var _0x4ecfcf=_0x73bc[_0x2afb83];return _0x4ecfcf;};'use strict';var Sequelize=require(_0xc73b('0x0'));var moment=require(_0xc73b('0x1'));module[_0xc73b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc73b('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xc73b('0x4'),_0xc73b('0x5'),_0xc73b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc73b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc73b('0x7')]},'endDate':{'type':Sequelize[_0xc73b('0x7')]},'status':{'type':Sequelize[_0xc73b('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xc73b('0x8')](_0xc73b('0x9'),_0xc73b('0xa')),'allowNull':![],'defaultValue':_0xc73b('0x9')},'reportId':{'type':Sequelize[_0xc73b('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 47f12e6..5cd6f25 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 _0x24d5=['request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','ExtractedReports','end','sendStatus','error','name','send','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','savename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x14639e,_0x2407e0){var _0x49be63=function(_0x27dbc4){while(--_0x27dbc4){_0x14639e['push'](_0x14639e['shift']());}};_0x49be63(++_0x2407e0);}(_0x24d5,0x116));var _0x524d=function(_0x377408,_0x1e2f33){_0x377408=_0x377408-0x0;var _0x4769d4=_0x24d5[_0x377408];return _0x4769d4;};'use strict';var emlformat=require(_0x524d('0x0'));var rimraf=require(_0x524d('0x1'));var zipdir=require(_0x524d('0x2'));var jsonpatch=require(_0x524d('0x3'));var rp=require(_0x524d('0x4'));var moment=require(_0x524d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x524d('0x6'));var util=require('util');var path=require(_0x524d('0x7'));var sox=require(_0x524d('0x8'));var csv=require(_0x524d('0x9'));var ejs=require(_0x524d('0xa'));var fs=require('fs');var fs_extra=require(_0x524d('0xb'));var _=require(_0x524d('0xc'));var squel=require(_0x524d('0xd'));var crypto=require(_0x524d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x524d('0xf'));var toCsv=require(_0x524d('0x9'));var querystring=require('querystring');var Papa=require(_0x524d('0x10'));var Redis=require(_0x524d('0x11'));var authService=require(_0x524d('0x12'));var qs=require(_0x524d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x524d('0x14'));var logger=require(_0x524d('0x15'))('api');var utils=require(_0x524d('0x16'));var config=require(_0x524d('0x17'));var licenseUtil=require(_0x524d('0x18'));var db=require(_0x524d('0x19'))['db'];function respondWithStatusCode(_0x3d6b1a,_0x36d164){_0x36d164=_0x36d164||0xcc;return function(_0x4f473c){if(_0x4f473c){return _0x3d6b1a['sendStatus'](_0x36d164);}return _0x3d6b1a['status'](_0x36d164)['end']();};}function respondWithResult(_0x23d557,_0x1aa443){_0x1aa443=_0x1aa443||0xc8;return function(_0x2f0e8f){if(_0x2f0e8f){return _0x23d557[_0x524d('0x1a')](_0x1aa443)[_0x524d('0x1b')](_0x2f0e8f);}};}function respondWithFilteredResult(_0x8297f,_0x47a8d8){return function(_0x5b3491){if(_0x5b3491){var _0x1de0e9=typeof _0x47a8d8[_0x524d('0x1c')]===_0x524d('0x1d')&&typeof _0x47a8d8[_0x524d('0x1e')]===_0x524d('0x1d');var _0x2ab3fd=_0x5b3491[_0x524d('0x1f')];var _0x44f4bb=_0x1de0e9?0x0:_0x47a8d8[_0x524d('0x1c')];var _0x427124=_0x1de0e9?_0x5b3491[_0x524d('0x1f')]:_0x47a8d8['offset']+_0x47a8d8[_0x524d('0x1e')];var _0x27ac00;if(_0x427124>=_0x2ab3fd){_0x427124=_0x2ab3fd;_0x27ac00=0xc8;}else{_0x27ac00=0xce;}_0x8297f['status'](_0x27ac00);return _0x8297f['set'](_0x524d('0x20'),_0x44f4bb+'-'+_0x427124+'/'+_0x2ab3fd)[_0x524d('0x1b')](_0x5b3491);}return null;};}function patchUpdates(_0x575808){return function(_0x34ef9d){try{jsonpatch['apply'](_0x34ef9d,_0x575808,!![]);}catch(_0x8d6f64){return BPromise['reject'](_0x8d6f64);}return _0x34ef9d['save']();};}function saveUpdates(_0x3550cd,_0x43897b){return function(_0x129ca0){if(_0x129ca0){return _0x129ca0[_0x524d('0x21')](_0x3550cd)[_0x524d('0x22')](function(_0x511d35){return _0x511d35;});}return null;};}function removeEntity(_0x4167e6,_0x34241e){return function(_0x2fd24a){if(_0x2fd24a){return _0x2fd24a[_0x524d('0x23')]()[_0x524d('0x22')](function(){var _0x2aab56=_0x2fd24a['get']({'plain':!![]});var _0x12decf=_0x524d('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x12decf,'resourceId':_0x2aab56['id']}})[_0x524d('0x22')](function(){return _0x2fd24a;});})['then'](function(){_0x4167e6[_0x524d('0x1a')](0xcc)[_0x524d('0x25')]();});}};}function handleEntityNotFound(_0x2846ad,_0x28d73d){return function(_0x2d9ffa){if(!_0x2d9ffa){_0x2846ad[_0x524d('0x26')](0x194);}return _0x2d9ffa;};}function handleError(_0x19a3f9,_0x8bd9be){_0x8bd9be=_0x8bd9be||0x1f4;return function(_0x4745e1){logger[_0x524d('0x27')](_0x4745e1['stack']);if(_0x4745e1[_0x524d('0x28')]){delete _0x4745e1[_0x524d('0x28')];}_0x19a3f9[_0x524d('0x1a')](_0x8bd9be)[_0x524d('0x29')](_0x4745e1);};}exports['index']=function(_0x18018c,_0x384a36){var _0x38c955={},_0x1b3681={},_0x5a1a0f={'count':0x0,'rows':[]};var _0x15ca45=_[_0x524d('0x2a')](db[_0x524d('0x2b')][_0x524d('0x2c')],function(_0x16a980){return{'name':_0x16a980['fieldName'],'type':_0x16a980[_0x524d('0x2d')][_0x524d('0x2e')]};});_0x1b3681[_0x524d('0x2f')]=_[_0x524d('0x2a')](_0x15ca45,_0x524d('0x28'));_0x1b3681[_0x524d('0x30')]=_[_0x524d('0x31')](_0x18018c[_0x524d('0x30')]);_0x1b3681[_0x524d('0x32')]=_[_0x524d('0x33')](_0x1b3681['model'],_0x1b3681[_0x524d('0x30')]);_0x38c955['attributes']=_[_0x524d('0x33')](_0x1b3681['model'],qs[_0x524d('0x34')](_0x18018c[_0x524d('0x30')][_0x524d('0x34')]));_0x38c955['attributes']=_0x38c955[_0x524d('0x35')][_0x524d('0x36')]?_0x38c955[_0x524d('0x35')]:_0x1b3681[_0x524d('0x2f')];if(!_0x18018c[_0x524d('0x30')][_0x524d('0x37')](_0x524d('0x38'))){_0x38c955['limit']=qs['limit'](_0x18018c[_0x524d('0x30')][_0x524d('0x1e')]);_0x38c955[_0x524d('0x1c')]=qs[_0x524d('0x1c')](_0x18018c[_0x524d('0x30')]['offset']);}_0x38c955['order']=qs[_0x524d('0x39')](_0x18018c['query']['sort']);_0x38c955[_0x524d('0x3a')]=qs[_0x524d('0x32')](_[_0x524d('0x3b')](_0x18018c[_0x524d('0x30')],_0x1b3681[_0x524d('0x32')]),_0x15ca45);if(_0x18018c['query'][_0x524d('0x3c')]){_0x38c955[_0x524d('0x3a')]=_[_0x524d('0x3d')](_0x38c955['where'],{'$or':_[_0x524d('0x2a')](_0x15ca45,function(_0x11534f){if(_0x11534f[_0x524d('0x2d')]!==_0x524d('0x3e')){var _0x7534e={};_0x7534e[_0x11534f[_0x524d('0x28')]]={'$like':'%'+_0x18018c['query'][_0x524d('0x3c')]+'%'};return _0x7534e;}})});}_0x38c955=_[_0x524d('0x3d')]({},_0x38c955,_0x18018c[_0x524d('0x3f')]);var _0x12ff5a={'where':_0x38c955['where']};return db[_0x524d('0x2b')][_0x524d('0x1f')](_0x12ff5a)[_0x524d('0x22')](function(_0x243968){_0x5a1a0f[_0x524d('0x1f')]=_0x243968;if(_0x18018c[_0x524d('0x30')][_0x524d('0x40')]){_0x38c955[_0x524d('0x41')]=[{'all':!![]}];}return db[_0x524d('0x2b')][_0x524d('0x42')](_0x38c955);})[_0x524d('0x22')](function(_0x1da597){_0x5a1a0f[_0x524d('0x43')]=_0x1da597;return _0x5a1a0f;})[_0x524d('0x22')](respondWithFilteredResult(_0x384a36,_0x38c955))[_0x524d('0x44')](handleError(_0x384a36,null));};exports[_0x524d('0x45')]=function(_0x1c9b32,_0x4e7d56){var _0x3b7f04={'raw':!![],'where':{'id':_0x1c9b32[_0x524d('0x46')]['id']}},_0x3352f8={};_0x3352f8['model']=_[_0x524d('0x31')](db['AnalyticExtractedReport'][_0x524d('0x2c')]);_0x3352f8[_0x524d('0x30')]=_[_0x524d('0x31')](_0x1c9b32[_0x524d('0x30')]);_0x3352f8['filters']=_[_0x524d('0x33')](_0x3352f8[_0x524d('0x2f')],_0x3352f8[_0x524d('0x30')]);_0x3b7f04['attributes']=_[_0x524d('0x33')](_0x3352f8[_0x524d('0x2f')],qs[_0x524d('0x34')](_0x1c9b32[_0x524d('0x30')][_0x524d('0x34')]));_0x3b7f04['attributes']=_0x3b7f04[_0x524d('0x35')][_0x524d('0x36')]?_0x3b7f04['attributes']:_0x3352f8[_0x524d('0x2f')];if(_0x1c9b32['query'][_0x524d('0x40')]){_0x3b7f04['include']=[{'all':!![]}];}_0x3b7f04=_[_0x524d('0x3d')]({},_0x3b7f04,_0x1c9b32[_0x524d('0x3f')]);return db[_0x524d('0x2b')]['find'](_0x3b7f04)[_0x524d('0x22')](handleEntityNotFound(_0x4e7d56,null))[_0x524d('0x22')](respondWithResult(_0x4e7d56,null))[_0x524d('0x44')](handleError(_0x4e7d56,null));};exports['create']=function(_0x1d0ffa,_0x194bb7){return db[_0x524d('0x2b')][_0x524d('0x47')](_0x1d0ffa[_0x524d('0x48')],{})[_0x524d('0x22')](function(_0x4b3984){var _0x16cdf3=_0x1d0ffa[_0x524d('0x49')][_0x524d('0x4a')]({'plain':!![]});if(!_0x16cdf3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16cdf3[_0x524d('0x4b')]===_0x524d('0x49')){var _0x767e35=_0x4b3984[_0x524d('0x4a')]({'plain':!![]});var _0x157222=_0x524d('0x24');return db[_0x524d('0x4c')][_0x524d('0x4d')]({'where':{'name':_0x157222,'userProfileId':_0x16cdf3[_0x524d('0x4e')]},'raw':!![]})['then'](function(_0x60dd60){if(_0x60dd60&&_0x60dd60[_0x524d('0x4f')]===0x0){return db[_0x524d('0x50')]['create']({'name':_0x767e35['name'],'resourceId':_0x767e35['id'],'type':_0x60dd60['name'],'sectionId':_0x60dd60['id']},{})[_0x524d('0x22')](function(){return _0x4b3984;});}else{return _0x4b3984;}})['catch'](function(_0x1371ea){logger[_0x524d('0x27')](_0x524d('0x51'),_0x1371ea);throw _0x1371ea;});}return _0x4b3984;})[_0x524d('0x22')](respondWithResult(_0x194bb7,0xc9))[_0x524d('0x44')](handleError(_0x194bb7,null));};exports['update']=function(_0x4dca41,_0x1b073c){if(_0x4dca41[_0x524d('0x48')]['id']){delete _0x4dca41[_0x524d('0x48')]['id'];}return db[_0x524d('0x2b')][_0x524d('0x4d')]({'where':{'id':_0x4dca41[_0x524d('0x46')]['id']}})[_0x524d('0x22')](handleEntityNotFound(_0x1b073c,null))[_0x524d('0x22')](saveUpdates(_0x4dca41[_0x524d('0x48')],null))[_0x524d('0x22')](respondWithResult(_0x1b073c,null))[_0x524d('0x44')](handleError(_0x1b073c,null));};exports[_0x524d('0x23')]=function(_0x3082b4,_0x5e433d){return db[_0x524d('0x2b')][_0x524d('0x4d')]({'where':{'id':_0x3082b4[_0x524d('0x46')]['id']}})[_0x524d('0x22')](handleEntityNotFound(_0x5e433d,null))[_0x524d('0x22')](removeEntity(_0x5e433d,null))[_0x524d('0x44')](handleError(_0x5e433d,null));};exports[_0x524d('0x52')]=function(_0x25f33c,_0x497191,_0x496c5e){return db[_0x524d('0x2b')]['find']({'where':{'id':_0x25f33c[_0x524d('0x46')]['id']},'attributes':[_0x524d('0x28'),_0x524d('0x53'),'savename',_0x524d('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x497191,null))[_0x524d('0x22')](function(_0x1d9f48){if(_0x1d9f48){if(!fs[_0x524d('0x55')](path['join'](config[_0x524d('0x56')],_0x524d('0x57'),_0x1d9f48['savename']))){throw new db[(_0x524d('0x58'))][(_0x524d('0x59'))](_0x524d('0x5a'));}if(_0x25f33c['query']['exists']){return _0x497191['sendStatus'](0xc8);}return _0x497191[_0x524d('0x52')](path[_0x524d('0x5b')](config[_0x524d('0x56')],_0x524d('0x57'),_0x1d9f48[_0x524d('0x5c')]),util['format']('%s.%s',_0x1d9f48[_0x524d('0x53')]||_0x1d9f48[_0x524d('0x28')],_0x1d9f48[_0x524d('0x54')][_0x524d('0x5d')]()));}})['catch'](handleError(_0x497191,null));}; \ No newline at end of file +var _0x770c=['query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','key','keys','filters','intersection','model'];(function(_0x486ca7,_0x4ca73b){var _0x31834a=function(_0x3d8be6){while(--_0x3d8be6){_0x486ca7['push'](_0x486ca7['shift']());}};_0x31834a(++_0x4ca73b);}(_0x770c,0x14c));var _0xc770=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x770c[_0x5ca5bc];return _0x26ca86;};'use strict';var emlformat=require(_0xc770('0x0'));var rimraf=require(_0xc770('0x1'));var zipdir=require(_0xc770('0x2'));var jsonpatch=require(_0xc770('0x3'));var rp=require(_0xc770('0x4'));var moment=require(_0xc770('0x5'));var BPromise=require(_0xc770('0x6'));var Mustache=require(_0xc770('0x7'));var util=require('util');var path=require(_0xc770('0x8'));var sox=require('sox');var csv=require(_0xc770('0x9'));var ejs=require(_0xc770('0xa'));var fs=require('fs');var fs_extra=require(_0xc770('0xb'));var _=require(_0xc770('0xc'));var squel=require(_0xc770('0xd'));var crypto=require(_0xc770('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc770('0xf'));var toCsv=require(_0xc770('0x9'));var querystring=require('querystring');var Papa=require(_0xc770('0x10'));var Redis=require(_0xc770('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc770('0x12'));var as=require(_0xc770('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc770('0x14'));var utils=require('../../config/utils');var config=require(_0xc770('0x15'));var licenseUtil=require(_0xc770('0x16'));var db=require(_0xc770('0x17'))['db'];function respondWithStatusCode(_0x5e5dfd,_0x2bb8bb){_0x2bb8bb=_0x2bb8bb||0xcc;return function(_0x3aefd3){if(_0x3aefd3){return _0x5e5dfd[_0xc770('0x18')](_0x2bb8bb);}return _0x5e5dfd[_0xc770('0x19')](_0x2bb8bb)[_0xc770('0x1a')]();};}function respondWithResult(_0x157e98,_0x465ac5){_0x465ac5=_0x465ac5||0xc8;return function(_0x591a18){if(_0x591a18){return _0x157e98[_0xc770('0x19')](_0x465ac5)[_0xc770('0x1b')](_0x591a18);}};}function respondWithFilteredResult(_0x4d0b3c,_0x2c7817){return function(_0x3b9fb8){if(_0x3b9fb8){var _0x5d1e07=typeof _0x2c7817[_0xc770('0x1c')]===_0xc770('0x1d')&&typeof _0x2c7817['limit']==='undefined';var _0x297371=_0x3b9fb8['count'];var _0x271fae=_0x5d1e07?0x0:_0x2c7817[_0xc770('0x1c')];var _0x6b2fbd=_0x5d1e07?_0x3b9fb8[_0xc770('0x1e')]:_0x2c7817['offset']+_0x2c7817['limit'];var _0x5ba565;if(_0x6b2fbd>=_0x297371){_0x6b2fbd=_0x297371;_0x5ba565=0xc8;}else{_0x5ba565=0xce;}_0x4d0b3c[_0xc770('0x19')](_0x5ba565);return _0x4d0b3c[_0xc770('0x1f')](_0xc770('0x20'),_0x271fae+'-'+_0x6b2fbd+'/'+_0x297371)[_0xc770('0x1b')](_0x3b9fb8);}return null;};}function patchUpdates(_0x67cbe3){return function(_0x5b53ff){try{jsonpatch['apply'](_0x5b53ff,_0x67cbe3,!![]);}catch(_0x12c230){return BPromise[_0xc770('0x21')](_0x12c230);}return _0x5b53ff[_0xc770('0x22')]();};}function saveUpdates(_0x27756b,_0x4a3d12){return function(_0x270223){if(_0x270223){return _0x270223[_0xc770('0x23')](_0x27756b)[_0xc770('0x24')](function(_0x352175){return _0x352175;});}return null;};}function removeEntity(_0x114d0c,_0x277dc8){return function(_0x5e1679){if(_0x5e1679){return _0x5e1679[_0xc770('0x25')]()[_0xc770('0x24')](function(){var _0x2e2a45=_0x5e1679[_0xc770('0x26')]({'plain':!![]});var _0x2fb6b1=_0xc770('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2fb6b1,'resourceId':_0x2e2a45['id']}})['then'](function(){return _0x5e1679;});})[_0xc770('0x24')](function(){_0x114d0c[_0xc770('0x19')](0xcc)[_0xc770('0x1a')]();});}};}function handleEntityNotFound(_0x3edf01,_0x3a4d64){return function(_0x5ec24c){if(!_0x5ec24c){_0x3edf01[_0xc770('0x18')](0x194);}return _0x5ec24c;};}function handleError(_0x10d9f0,_0x4a08c2){_0x4a08c2=_0x4a08c2||0x1f4;return function(_0xbb49a3){logger[_0xc770('0x28')](_0xbb49a3[_0xc770('0x29')]);if(_0xbb49a3[_0xc770('0x2a')]){delete _0xbb49a3[_0xc770('0x2a')];}_0x10d9f0[_0xc770('0x19')](_0x4a08c2)[_0xc770('0x2b')](_0xbb49a3);};}exports['index']=function(_0x1bdbee,_0x4a9951){var _0x18270b={},_0x235b1d={},_0x52dd30={'count':0x0,'rows':[]};var _0x5f4ee8=_[_0xc770('0x2c')](db[_0xc770('0x2d')][_0xc770('0x2e')],function(_0x3e0c31){return{'name':_0x3e0c31['fieldName'],'type':_0x3e0c31['type'][_0xc770('0x2f')]};});_0x235b1d['model']=_[_0xc770('0x2c')](_0x5f4ee8,'name');_0x235b1d['query']=_[_0xc770('0x30')](_0x1bdbee['query']);_0x235b1d[_0xc770('0x31')]=_[_0xc770('0x32')](_0x235b1d[_0xc770('0x33')],_0x235b1d[_0xc770('0x34')]);_0x18270b[_0xc770('0x35')]=_['intersection'](_0x235b1d[_0xc770('0x33')],qs[_0xc770('0x36')](_0x1bdbee['query'][_0xc770('0x36')]));_0x18270b[_0xc770('0x35')]=_0x18270b[_0xc770('0x35')][_0xc770('0x37')]?_0x18270b[_0xc770('0x35')]:_0x235b1d[_0xc770('0x33')];if(!_0x1bdbee[_0xc770('0x34')][_0xc770('0x38')](_0xc770('0x39'))){_0x18270b['limit']=qs[_0xc770('0x3a')](_0x1bdbee[_0xc770('0x34')][_0xc770('0x3a')]);_0x18270b['offset']=qs[_0xc770('0x1c')](_0x1bdbee[_0xc770('0x34')][_0xc770('0x1c')]);}_0x18270b[_0xc770('0x3b')]=qs[_0xc770('0x3c')](_0x1bdbee[_0xc770('0x34')]['sort']);_0x18270b['where']=qs['filters'](_[_0xc770('0x3d')](_0x1bdbee['query'],_0x235b1d['filters']),_0x5f4ee8);if(_0x1bdbee[_0xc770('0x34')][_0xc770('0x3e')]){_0x18270b[_0xc770('0x3f')]=_[_0xc770('0x40')](_0x18270b[_0xc770('0x3f')],{'$or':_[_0xc770('0x2c')](_0x5f4ee8,function(_0x4f4cea){if(_0x4f4cea['type']!=='VIRTUAL'){var _0x2e74d8={};_0x2e74d8[_0x4f4cea[_0xc770('0x2a')]]={'$like':'%'+_0x1bdbee[_0xc770('0x34')][_0xc770('0x3e')]+'%'};return _0x2e74d8;}})});}_0x18270b=_[_0xc770('0x40')]({},_0x18270b,_0x1bdbee['options']);var _0x484cc0={'where':_0x18270b['where']};return db[_0xc770('0x2d')][_0xc770('0x1e')](_0x484cc0)[_0xc770('0x24')](function(_0x426197){_0x52dd30[_0xc770('0x1e')]=_0x426197;if(_0x1bdbee[_0xc770('0x34')][_0xc770('0x41')]){_0x18270b[_0xc770('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xc770('0x43')](_0x18270b);})['then'](function(_0x19ef16){_0x52dd30[_0xc770('0x44')]=_0x19ef16;return _0x52dd30;})['then'](respondWithFilteredResult(_0x4a9951,_0x18270b))[_0xc770('0x45')](handleError(_0x4a9951,null));};exports[_0xc770('0x46')]=function(_0x5890ad,_0x58b47f){var _0x5b79d8={'raw':!![],'where':{'id':_0x5890ad[_0xc770('0x47')]['id']}},_0x564172={};_0x564172[_0xc770('0x33')]=_[_0xc770('0x30')](db[_0xc770('0x2d')][_0xc770('0x2e')]);_0x564172[_0xc770('0x34')]=_[_0xc770('0x30')](_0x5890ad['query']);_0x564172[_0xc770('0x31')]=_[_0xc770('0x32')](_0x564172[_0xc770('0x33')],_0x564172[_0xc770('0x34')]);_0x5b79d8[_0xc770('0x35')]=_['intersection'](_0x564172[_0xc770('0x33')],qs[_0xc770('0x36')](_0x5890ad[_0xc770('0x34')][_0xc770('0x36')]));_0x5b79d8[_0xc770('0x35')]=_0x5b79d8['attributes'][_0xc770('0x37')]?_0x5b79d8[_0xc770('0x35')]:_0x564172[_0xc770('0x33')];if(_0x5890ad[_0xc770('0x34')][_0xc770('0x41')]){_0x5b79d8[_0xc770('0x42')]=[{'all':!![]}];}_0x5b79d8=_[_0xc770('0x40')]({},_0x5b79d8,_0x5890ad['options']);return db[_0xc770('0x2d')][_0xc770('0x48')](_0x5b79d8)[_0xc770('0x24')](handleEntityNotFound(_0x58b47f,null))[_0xc770('0x24')](respondWithResult(_0x58b47f,null))['catch'](handleError(_0x58b47f,null));};exports[_0xc770('0x49')]=function(_0x31b7d8,_0x180365){return db[_0xc770('0x2d')]['create'](_0x31b7d8[_0xc770('0x4a')],{})[_0xc770('0x24')](function(_0x33844e){var _0x420a01=_0x31b7d8[_0xc770('0x4b')]['get']({'plain':!![]});if(!_0x420a01)throw new Error(_0xc770('0x4c'));if(_0x420a01['role']===_0xc770('0x4b')){var _0x44689c=_0x33844e[_0xc770('0x26')]({'plain':!![]});var _0x4a3b7d=_0xc770('0x27');return db[_0xc770('0x4d')][_0xc770('0x48')]({'where':{'name':_0x4a3b7d,'userProfileId':_0x420a01[_0xc770('0x4e')]},'raw':!![]})[_0xc770('0x24')](function(_0x10136f){if(_0x10136f&&_0x10136f[_0xc770('0x4f')]===0x0){return db[_0xc770('0x50')]['create']({'name':_0x44689c['name'],'resourceId':_0x44689c['id'],'type':_0x10136f[_0xc770('0x2a')],'sectionId':_0x10136f['id']},{})['then'](function(){return _0x33844e;});}else{return _0x33844e;}})[_0xc770('0x45')](function(_0x1b66ba){logger[_0xc770('0x28')](_0xc770('0x51'),_0x1b66ba);throw _0x1b66ba;});}return _0x33844e;})[_0xc770('0x24')](respondWithResult(_0x180365,0xc9))[_0xc770('0x45')](handleError(_0x180365,null));};exports['update']=function(_0x47f419,_0x352a8b){if(_0x47f419[_0xc770('0x4a')]['id']){delete _0x47f419[_0xc770('0x4a')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x47f419[_0xc770('0x47')]['id']}})[_0xc770('0x24')](handleEntityNotFound(_0x352a8b,null))[_0xc770('0x24')](saveUpdates(_0x47f419[_0xc770('0x4a')],null))[_0xc770('0x24')](respondWithResult(_0x352a8b,null))[_0xc770('0x45')](handleError(_0x352a8b,null));};exports[_0xc770('0x25')]=function(_0x53dbfb,_0x370842){return db[_0xc770('0x2d')][_0xc770('0x48')]({'where':{'id':_0x53dbfb['params']['id']}})[_0xc770('0x24')](handleEntityNotFound(_0x370842,null))[_0xc770('0x24')](removeEntity(_0x370842,null))[_0xc770('0x45')](handleError(_0x370842,null));};exports[_0xc770('0x52')]=function(_0x53664b,_0x53676d,_0x5e58cc){return db[_0xc770('0x2d')][_0xc770('0x48')]({'where':{'id':_0x53664b[_0xc770('0x47')]['id']},'attributes':['name','basename','savename',_0xc770('0x53')],'raw':!![]})[_0xc770('0x24')](handleEntityNotFound(_0x53676d,null))[_0xc770('0x24')](function(_0x592d9b){if(_0x592d9b){if(!fs[_0xc770('0x54')](path[_0xc770('0x55')](config[_0xc770('0x56')],_0xc770('0x57'),_0x592d9b[_0xc770('0x58')]))){throw new db[(_0xc770('0x59'))][(_0xc770('0x5a'))](_0xc770('0x5b'));}if(_0x53664b[_0xc770('0x34')][_0xc770('0x5c')]){return _0x53676d[_0xc770('0x18')](0xc8);}return _0x53676d[_0xc770('0x52')](path['join'](config['root'],'server/files/reports',_0x592d9b[_0xc770('0x58')]),util[_0xc770('0x5d')]('%s.%s',_0x592d9b[_0xc770('0x5e')]||_0x592d9b[_0xc770('0x2a')],_0x592d9b[_0xc770('0x53')][_0xc770('0x5f')]()));}})[_0xc770('0x45')](handleError(_0x53676d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 237d2d7..1b4e86b 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 _0x1188=['AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x2be2c7,_0x32900e){var _0x4cc9a7=function(_0x2a3c37){while(--_0x2a3c37){_0x2be2c7['push'](_0x2be2c7['shift']());}};_0x4cc9a7(++_0x32900e);}(_0x1188,0x69));var _0x8118=function(_0x1920a3,_0x22bf25){_0x1920a3=_0x1920a3-0x0;var _0x482fc9=_0x1188[_0x1920a3];return _0x482fc9;};'use strict';var _=require(_0x8118('0x0'));var util=require(_0x8118('0x1'));var logger=require(_0x8118('0x2'))(_0x8118('0x3'));var moment=require('moment');var BPromise=require(_0x8118('0x4'));var rp=require(_0x8118('0x5'));var fs=require('fs');var path=require(_0x8118('0x6'));var rimraf=require(_0x8118('0x7'));var config=require(_0x8118('0x8'));var attributes=require(_0x8118('0x9'));module[_0x8118('0xa')]=function(_0x4e0d25,_0x2f47f3){return _0x4e0d25[_0x8118('0xb')](_0x8118('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x576f=['analytics_extracted_reports','lodash','util','api','moment','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x8b0073,_0x107010){var _0x12aff2=function(_0x4c1ae3){while(--_0x4c1ae3){_0x8b0073['push'](_0x8b0073['shift']());}};_0x12aff2(++_0x107010);}(_0x576f,0x181));var _0xf576=function(_0x266f7b,_0x1355af){_0x266f7b=_0x266f7b-0x0;var _0x1b4d71=_0x576f[_0x266f7b];return _0x1b4d71;};'use strict';var _=require(_0xf576('0x0'));var util=require(_0xf576('0x1'));var logger=require('../../config/logger')(_0xf576('0x2'));var moment=require(_0xf576('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf576('0x4'));var rimraf=require(_0xf576('0x5'));var config=require(_0xf576('0x6'));var attributes=require(_0xf576('0x7'));module[_0xf576('0x8')]=function(_0x365f55,_0x194c6c){return _0x365f55[_0xf576('0x9')](_0xf576('0xa'),attributes,{'tableName':_0xf576('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 61c611b..576dad7 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 _0xcc55=['../../config/environment','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x51df70,_0xe0b02b){var _0x252bad=function(_0x1de606){while(--_0x1de606){_0x51df70['push'](_0x51df70['shift']());}};_0x252bad(++_0xe0b02b);}(_0xcc55,0x173));var _0x5cc5=function(_0x3be353,_0x491043){_0x3be353=_0x3be353-0x0;var _0x53b513=_0xcc55[_0x3be353];return _0x53b513;};'use strict';var _=require('lodash');var util=require(_0x5cc5('0x0'));var moment=require(_0x5cc5('0x1'));var BPromise=require(_0x5cc5('0x2'));var rs=require(_0x5cc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cc5('0x4'))['db'];var utils=require(_0x5cc5('0x5'));var logger=require('../../config/logger')(_0x5cc5('0x6'));var config=require(_0x5cc5('0x7'));var jayson=require(_0x5cc5('0x8'));var client=jayson[_0x5cc5('0x9')][_0x5cc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab107,_0x4003b9,_0x43f936){return new BPromise(function(_0x4ce93a,_0x162b80){return client[_0x5cc5('0xb')](_0x1ab107,_0x43f936)['then'](function(_0x336e26){logger['info'](_0x5cc5('0xc'),_0x4003b9,_0x5cc5('0xd'));logger[_0x5cc5('0xe')](_0x5cc5('0xf'),_0x4003b9,_0x5cc5('0xd'),JSON['stringify'](_0x336e26));if(_0x336e26[_0x5cc5('0x10')]){if(_0x336e26[_0x5cc5('0x10')][_0x5cc5('0x11')]===0x1f4){logger[_0x5cc5('0x10')](_0x5cc5('0xc'),_0x4003b9,_0x336e26[_0x5cc5('0x10')][_0x5cc5('0x12')]);return _0x162b80(_0x336e26[_0x5cc5('0x10')][_0x5cc5('0x12')]);}logger[_0x5cc5('0x10')](_0x5cc5('0xc'),_0x4003b9,_0x336e26[_0x5cc5('0x10')][_0x5cc5('0x12')]);return _0x4ce93a(_0x336e26[_0x5cc5('0x10')][_0x5cc5('0x12')]);}else{logger[_0x5cc5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4003b9,_0x5cc5('0xd'));_0x4ce93a(_0x336e26[_0x5cc5('0x14')][_0x5cc5('0x12')]);}})['catch'](function(_0x26cd2d){logger[_0x5cc5('0x10')](_0x5cc5('0xc'),_0x4003b9,_0x26cd2d);_0x162b80(_0x26cd2d);});});} \ No newline at end of file +var _0x4838=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird'];(function(_0x47b688,_0x200c56){var _0x163100=function(_0xe484e8){while(--_0xe484e8){_0x47b688['push'](_0x47b688['shift']());}};_0x163100(++_0x200c56);}(_0x4838,0x111));var _0x8483=function(_0x471a54,_0x59a122){_0x471a54=_0x471a54-0x0;var _0x20c5e2=_0x4838[_0x471a54];return _0x20c5e2;};'use strict';var _=require('lodash');var util=require(_0x8483('0x0'));var moment=require('moment');var BPromise=require(_0x8483('0x1'));var rs=require(_0x8483('0x2'));var fs=require('fs');var Redis=require(_0x8483('0x3'));var db=require(_0x8483('0x4'))['db'];var utils=require(_0x8483('0x5'));var logger=require(_0x8483('0x6'))(_0x8483('0x7'));var config=require(_0x8483('0x8'));var jayson=require(_0x8483('0x9'));var client=jayson[_0x8483('0xa')][_0x8483('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x169df1,_0x308de4,_0x5efc2b){return new BPromise(function(_0x47ad02,_0x583805){return client[_0x8483('0xc')](_0x169df1,_0x5efc2b)[_0x8483('0xd')](function(_0x3b44ba){logger[_0x8483('0xe')](_0x8483('0xf'),_0x308de4,'request\x20sent');logger[_0x8483('0x10')](_0x8483('0x11'),_0x308de4,'request\x20sent',JSON[_0x8483('0x12')](_0x3b44ba));if(_0x3b44ba[_0x8483('0x13')]){if(_0x3b44ba['error'][_0x8483('0x14')]===0x1f4){logger['error'](_0x8483('0xf'),_0x308de4,_0x3b44ba['error']['message']);return _0x583805(_0x3b44ba['error'][_0x8483('0x15')]);}logger['error'](_0x8483('0xf'),_0x308de4,_0x3b44ba[_0x8483('0x13')]['message']);return _0x47ad02(_0x3b44ba[_0x8483('0x13')][_0x8483('0x15')]);}else{logger[_0x8483('0xe')](_0x8483('0xf'),_0x308de4,_0x8483('0x16'));_0x47ad02(_0x3b44ba[_0x8483('0x17')][_0x8483('0x15')]);}})[_0x8483('0x18')](function(_0xd2d36a){logger[_0x8483('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x308de4,_0xd2d36a);_0x583805(_0xd2d36a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2001d67..b82e0bb 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 _0x119f=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','download','post'];(function(_0x2a009e,_0x19d263){var _0x261192=function(_0x8ca28d){while(--_0x8ca28d){_0x2a009e['push'](_0x2a009e['shift']());}};_0x261192(++_0x19d263);}(_0x119f,0x8a));var _0xf119=function(_0x193a5d,_0x161cad){_0x193a5d=_0x193a5d-0x0;var _0x3b2626=_0x119f[_0x193a5d];return _0x3b2626;};'use strict';var multer=require(_0xf119('0x0'));var util=require(_0xf119('0x1'));var path=require(_0xf119('0x2'));var timeout=require(_0xf119('0x3'));var express=require('express');var router=express[_0xf119('0x4')]();var fs_extra=require(_0xf119('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf119('0x6'));var controller=require(_0xf119('0x7'));router[_0xf119('0x8')]('/',auth[_0xf119('0x9')](),controller[_0xf119('0xa')]);router['get'](_0xf119('0xb'),auth[_0xf119('0x9')](),controller['show']);router[_0xf119('0x8')]('/:id/download',auth[_0xf119('0x9')](),controller[_0xf119('0xc')]);router[_0xf119('0xd')]('/',auth[_0xf119('0x9')](),controller[_0xf119('0xe')]);router['put']('/:id',auth[_0xf119('0x9')](),controller[_0xf119('0xf')]);router[_0xf119('0x10')](_0xf119('0xb'),auth[_0xf119('0x9')](),controller[_0xf119('0x11')]);module[_0xf119('0x12')]=router; \ No newline at end of file +var _0x6452=['fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','delete','destroy','exports','path','express'];(function(_0x330cc5,_0x147150){var _0x5b3ad9=function(_0x418fc7){while(--_0x418fc7){_0x330cc5['push'](_0x330cc5['shift']());}};_0x5b3ad9(++_0x147150);}(_0x6452,0x6a));var _0x2645=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x6452[_0x3bceea];return _0x30a8d3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2645('0x0'));var timeout=require('connect-timeout');var express=require(_0x2645('0x1'));var router=express['Router']();var fs_extra=require(_0x2645('0x2'));var auth=require(_0x2645('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2645('0x4'));var controller=require(_0x2645('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2645('0x6')](_0x2645('0x7'),auth[_0x2645('0x8')](),controller[_0x2645('0x9')]);router['get'](_0x2645('0xa'),auth[_0x2645('0x8')](),controller[_0x2645('0xb')]);router[_0x2645('0xc')]('/',auth[_0x2645('0x8')](),controller[_0x2645('0xd')]);router[_0x2645('0xe')](_0x2645('0x7'),auth[_0x2645('0x8')](),controller['update']);router[_0x2645('0xf')](_0x2645('0x7'),auth[_0x2645('0x8')](),controller[_0x2645('0x10')]);module[_0x2645('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7a4202f..d0d05e0 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 _0x94cb=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x51fb0c,_0x937d84){var _0x6b1d12=function(_0xb70b58){while(--_0xb70b58){_0x51fb0c['push'](_0x51fb0c['shift']());}};_0x6b1d12(++_0x937d84);}(_0x94cb,0x137));var _0xb94c=function(_0x2cb08e,_0x48f58a){_0x2cb08e=_0x2cb08e-0x0;var _0x3b5f48=_0x94cb[_0x2cb08e];return _0x3b5f48;};'use strict';var Sequelize=require(_0xb94c('0x0'));module[_0xb94c('0x1')]={'field':{'type':Sequelize[_0xb94c('0x2')]},'alias':{'type':Sequelize[_0xb94c('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb94c('0x3')]},'groupBy':{'type':Sequelize[_0xb94c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb94c('0x3')]},'custom':{'type':Sequelize[_0xb94c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe9b8=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x10e5a8,_0x31bf6d){var _0x517c65=function(_0x2a7ca7){while(--_0x2a7ca7){_0x10e5a8['push'](_0x10e5a8['shift']());}};_0x517c65(++_0x31bf6d);}(_0xe9b8,0x1ce));var _0x8e9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe9b8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8e9b('0x0'));module[_0x8e9b('0x1')]={'field':{'type':Sequelize[_0x8e9b('0x2')]},'alias':{'type':Sequelize[_0x8e9b('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x8e9b('0x3')]},'groupBy':{'type':Sequelize[_0x8e9b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8e9b('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6ee95a0..282b38b 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 _0xea51=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','AnalyticFieldReport','find','catch','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys'];(function(_0x25d542,_0x462ad9){var _0x377a7e=function(_0x5bd8ee){while(--_0x5bd8ee){_0x25d542['push'](_0x25d542['shift']());}};_0x377a7e(++_0x462ad9);}(_0xea51,0x70));var _0x1ea5=function(_0x2e8adf,_0x246201){_0x2e8adf=_0x2e8adf-0x0;var _0x505ca3=_0xea51[_0x2e8adf];return _0x505ca3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ea5('0x0'));var zipdir=require(_0x1ea5('0x1'));var jsonpatch=require(_0x1ea5('0x2'));var rp=require(_0x1ea5('0x3'));var moment=require(_0x1ea5('0x4'));var BPromise=require(_0x1ea5('0x5'));var Mustache=require(_0x1ea5('0x6'));var util=require(_0x1ea5('0x7'));var path=require(_0x1ea5('0x8'));var sox=require('sox');var csv=require(_0x1ea5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ea5('0xa'));var _=require('lodash');var squel=require(_0x1ea5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ea5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1ea5('0xd'));var Papa=require(_0x1ea5('0xe'));var Redis=require(_0x1ea5('0xf'));var authService=require(_0x1ea5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ea5('0x11'));var logger=require(_0x1ea5('0x12'))(_0x1ea5('0x13'));var utils=require(_0x1ea5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea5('0x15'));var db=require(_0x1ea5('0x16'))['db'];function respondWithStatusCode(_0x3e8fcd,_0x38fafd){_0x38fafd=_0x38fafd||0xcc;return function(_0x42359d){if(_0x42359d){return _0x3e8fcd[_0x1ea5('0x17')](_0x38fafd);}return _0x3e8fcd['status'](_0x38fafd)[_0x1ea5('0x18')]();};}function respondWithResult(_0xfdd9c2,_0xed00c5){_0xed00c5=_0xed00c5||0xc8;return function(_0x4ebd1c){if(_0x4ebd1c){return _0xfdd9c2[_0x1ea5('0x19')](_0xed00c5)[_0x1ea5('0x1a')](_0x4ebd1c);}};}function respondWithFilteredResult(_0x182a70,_0x51da19){return function(_0x25144c){if(_0x25144c){var _0x3a46e4=typeof _0x51da19['offset']==='undefined'&&typeof _0x51da19[_0x1ea5('0x1b')]===_0x1ea5('0x1c');var _0x3b5a4a=_0x25144c[_0x1ea5('0x1d')];var _0x3e8c8f=_0x3a46e4?0x0:_0x51da19[_0x1ea5('0x1e')];var _0x24e368=_0x3a46e4?_0x25144c[_0x1ea5('0x1d')]:_0x51da19['offset']+_0x51da19[_0x1ea5('0x1b')];var _0x455b5d;if(_0x24e368>=_0x3b5a4a){_0x24e368=_0x3b5a4a;_0x455b5d=0xc8;}else{_0x455b5d=0xce;}_0x182a70[_0x1ea5('0x19')](_0x455b5d);return _0x182a70['set']('Content-Range',_0x3e8c8f+'-'+_0x24e368+'/'+_0x3b5a4a)[_0x1ea5('0x1a')](_0x25144c);}return null;};}function patchUpdates(_0x4f6b8f){return function(_0x150130){try{jsonpatch[_0x1ea5('0x1f')](_0x150130,_0x4f6b8f,!![]);}catch(_0x131124){return BPromise[_0x1ea5('0x20')](_0x131124);}return _0x150130[_0x1ea5('0x21')]();};}function saveUpdates(_0x561b40,_0x3e95a8){return function(_0x234400){if(_0x234400){return _0x234400[_0x1ea5('0x22')](_0x561b40)[_0x1ea5('0x23')](function(_0x2c0821){return _0x2c0821;});}return null;};}function removeEntity(_0x576e9d,_0x1dbb79){return function(_0x57f434){if(_0x57f434){return _0x57f434[_0x1ea5('0x24')]()['then'](function(){_0x576e9d[_0x1ea5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6aab88,_0x5f34d5){return function(_0xf3290c){if(!_0xf3290c){_0x6aab88[_0x1ea5('0x17')](0x194);}return _0xf3290c;};}function handleError(_0x1343e9,_0x43fc05){_0x43fc05=_0x43fc05||0x1f4;return function(_0x282d8d){logger['error'](_0x282d8d[_0x1ea5('0x25')]);if(_0x282d8d[_0x1ea5('0x26')]){delete _0x282d8d[_0x1ea5('0x26')];}_0x1343e9[_0x1ea5('0x19')](_0x43fc05)[_0x1ea5('0x27')](_0x282d8d);};}exports[_0x1ea5('0x28')]=function(_0x7cff4b,_0x3a7290){var _0x456250={},_0x4f6556={},_0x527ecf={'count':0x0,'rows':[]};var _0x4979eb=_['map'](db['AnalyticFieldReport'][_0x1ea5('0x29')],function(_0xaeb697){return{'name':_0xaeb697[_0x1ea5('0x2a')],'type':_0xaeb697[_0x1ea5('0x2b')]['key']};});_0x4f6556[_0x1ea5('0x2c')]=_[_0x1ea5('0x2d')](_0x4979eb,_0x1ea5('0x26'));_0x4f6556[_0x1ea5('0x2e')]=_[_0x1ea5('0x2f')](_0x7cff4b[_0x1ea5('0x2e')]);_0x4f6556[_0x1ea5('0x30')]=_[_0x1ea5('0x31')](_0x4f6556[_0x1ea5('0x2c')],_0x4f6556[_0x1ea5('0x2e')]);_0x456250[_0x1ea5('0x32')]=_[_0x1ea5('0x31')](_0x4f6556['model'],qs['fields'](_0x7cff4b['query'][_0x1ea5('0x33')]));_0x456250[_0x1ea5('0x32')]=_0x456250['attributes'][_0x1ea5('0x34')]?_0x456250[_0x1ea5('0x32')]:_0x4f6556[_0x1ea5('0x2c')];if(!_0x7cff4b['query'][_0x1ea5('0x35')](_0x1ea5('0x36'))){_0x456250[_0x1ea5('0x1b')]=qs[_0x1ea5('0x1b')](_0x7cff4b[_0x1ea5('0x2e')][_0x1ea5('0x1b')]);_0x456250[_0x1ea5('0x1e')]=qs[_0x1ea5('0x1e')](_0x7cff4b[_0x1ea5('0x2e')]['offset']);}_0x456250[_0x1ea5('0x37')]=qs[_0x1ea5('0x38')](_0x7cff4b[_0x1ea5('0x2e')][_0x1ea5('0x38')]);_0x456250['where']=qs[_0x1ea5('0x30')](_[_0x1ea5('0x39')](_0x7cff4b[_0x1ea5('0x2e')],_0x4f6556[_0x1ea5('0x30')]),_0x4979eb);if(_0x7cff4b['query']['filter']){_0x456250[_0x1ea5('0x3a')]=_['merge'](_0x456250['where'],{'$or':_['map'](_0x4979eb,function(_0x2218c4){if(_0x2218c4[_0x1ea5('0x2b')]!==_0x1ea5('0x3b')){var _0x1de8d2={};_0x1de8d2[_0x2218c4[_0x1ea5('0x26')]]={'$like':'%'+_0x7cff4b[_0x1ea5('0x2e')][_0x1ea5('0x3c')]+'%'};return _0x1de8d2;}})});}_0x456250=_[_0x1ea5('0x3d')]({},_0x456250,_0x7cff4b[_0x1ea5('0x3e')]);var _0x2a0ced={'where':_0x456250[_0x1ea5('0x3a')]};return db['AnalyticFieldReport'][_0x1ea5('0x1d')](_0x2a0ced)['then'](function(_0x5736c3){_0x527ecf[_0x1ea5('0x1d')]=_0x5736c3;if(_0x7cff4b[_0x1ea5('0x2e')][_0x1ea5('0x3f')]){_0x456250[_0x1ea5('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x1ea5('0x41')](_0x456250);})[_0x1ea5('0x23')](function(_0x29a215){_0x527ecf[_0x1ea5('0x42')]=_0x29a215;return _0x527ecf;})[_0x1ea5('0x23')](respondWithFilteredResult(_0x3a7290,_0x456250))['catch'](handleError(_0x3a7290,null));};exports['show']=function(_0x4e7d88,_0x163e0c){var _0x536910={'raw':![],'where':{'id':_0x4e7d88[_0x1ea5('0x43')]['id']}},_0x351785={};_0x351785['model']=_[_0x1ea5('0x2f')](db[_0x1ea5('0x44')]['rawAttributes']);_0x351785[_0x1ea5('0x2e')]=_[_0x1ea5('0x2f')](_0x4e7d88['query']);_0x351785['filters']=_[_0x1ea5('0x31')](_0x351785['model'],_0x351785[_0x1ea5('0x2e')]);_0x536910[_0x1ea5('0x32')]=_[_0x1ea5('0x31')](_0x351785['model'],qs['fields'](_0x4e7d88['query']['fields']));_0x536910['attributes']=_0x536910[_0x1ea5('0x32')][_0x1ea5('0x34')]?_0x536910[_0x1ea5('0x32')]:_0x351785[_0x1ea5('0x2c')];if(_0x4e7d88['query'][_0x1ea5('0x3f')]){_0x536910['include']=[{'all':!![]}];}_0x536910=_['merge']({},_0x536910,_0x4e7d88[_0x1ea5('0x3e')]);return db[_0x1ea5('0x44')][_0x1ea5('0x45')](_0x536910)[_0x1ea5('0x23')](handleEntityNotFound(_0x163e0c,null))['then'](respondWithResult(_0x163e0c,null))[_0x1ea5('0x46')](handleError(_0x163e0c,null));};exports['create']=function(_0x12d5f2,_0x4421ea){return db[_0x1ea5('0x44')][_0x1ea5('0x47')](_0x12d5f2[_0x1ea5('0x48')],{})['then'](respondWithResult(_0x4421ea,0xc9))[_0x1ea5('0x46')](handleError(_0x4421ea,null));};exports[_0x1ea5('0x49')]=function(_0x15c77f,_0x596fb1){return db[_0x1ea5('0x44')]['bulkCreate'](_0x15c77f[_0x1ea5('0x48')],{'raw':![],'individualHooks':!![]})[_0x1ea5('0x23')](respondWithResult(_0x596fb1,0xc9))[_0x1ea5('0x46')](handleError(_0x596fb1,null));};exports['update']=function(_0x5e423c,_0x39512d){if(_0x5e423c[_0x1ea5('0x48')]['id']){delete _0x5e423c[_0x1ea5('0x48')]['id'];}return db[_0x1ea5('0x44')][_0x1ea5('0x45')]({'where':{'id':_0x5e423c['params']['id']}})[_0x1ea5('0x23')](handleEntityNotFound(_0x39512d,null))['then'](saveUpdates(_0x5e423c[_0x1ea5('0x48')],null))['then'](respondWithResult(_0x39512d,null))[_0x1ea5('0x46')](handleError(_0x39512d,null));};exports[_0x1ea5('0x24')]=function(_0x439c56,_0x332381){return db[_0x1ea5('0x44')][_0x1ea5('0x45')]({'where':{'id':_0x439c56[_0x1ea5('0x43')]['id']}})['then'](handleEntityNotFound(_0x332381,null))['then'](removeEntity(_0x332381,null))[_0x1ea5('0x46')](handleError(_0x332381,null));};exports['bulkDestroy']=function(_0x311960,_0x524933){return db[_0x1ea5('0x44')][_0x1ea5('0x24')]({'where':{'id':_0x311960['query'][_0x1ea5('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x1ea5('0x23')](respondWithResult(_0x524933,0xcc))[_0x1ea5('0x46')](handleError(_0x524933,null));};exports[_0x1ea5('0x4b')]=function(_0x52012a,_0xc50773,_0x4116e5){return db[_0x1ea5('0x4c')]['findOne']({'where':{'id':_0x52012a[_0x1ea5('0x43')]['id']}})[_0x1ea5('0x23')](handleEntityNotFound(_0xc50773,null))['then'](function(_0x589217){if(_0x589217){return db[_0x1ea5('0x4d')][_0x1ea5('0x4e')](function(_0x4af3df){return db['AnalyticFieldReport'][_0x1ea5('0x24')]({'where':{'CustomReportId':_0x52012a[_0x1ea5('0x43')]['id']},'transaction':_0x4af3df})[_0x1ea5('0x23')](function(_0x26e5e9){var _0x3c61ba=_['map'](_0x52012a[_0x1ea5('0x48')],function(_0x3460a8){delete _0x3460a8['id'];_0x3460a8[_0x1ea5('0x4f')]=_0x52012a[_0x1ea5('0x43')]['id'];return _0x3460a8;});return db['AnalyticFieldReport'][_0x1ea5('0x49')](_0x3c61ba,{'transaction':_0x4af3df});});})[_0x1ea5('0x23')](function(){return db[_0x1ea5('0x44')]['findAll']({'where':{'CustomReportId':_0x52012a[_0x1ea5('0x43')]['id']}});});}})['then'](respondWithResult(_0xc50773,null))[_0x1ea5('0x46')](handleError(_0xc50773,null));}; \ No newline at end of file +var _0xef2d=['stack','name','send','map','AnalyticFieldReport','fieldName','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0xef2d,0x16d));var _0xdef2=function(_0x17a8dd,_0x3c18fb){_0x17a8dd=_0x17a8dd-0x0;var _0x556f85=_0xef2d[_0x17a8dd];return _0x556f85;};'use strict';var emlformat=require(_0xdef2('0x0'));var rimraf=require(_0xdef2('0x1'));var zipdir=require(_0xdef2('0x2'));var jsonpatch=require(_0xdef2('0x3'));var rp=require(_0xdef2('0x4'));var moment=require('moment');var BPromise=require(_0xdef2('0x5'));var Mustache=require(_0xdef2('0x6'));var util=require(_0xdef2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdef2('0x8'));var ejs=require(_0xdef2('0x9'));var fs=require('fs');var fs_extra=require(_0xdef2('0xa'));var _=require(_0xdef2('0xb'));var squel=require(_0xdef2('0xc'));var crypto=require(_0xdef2('0xd'));var jsforce=require(_0xdef2('0xe'));var deskjs=require(_0xdef2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdef2('0x10'));var Redis=require(_0xdef2('0x11'));var authService=require(_0xdef2('0x12'));var qs=require(_0xdef2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdef2('0x14'));var logger=require('../../config/logger')(_0xdef2('0x15'));var utils=require(_0xdef2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdef2('0x17'));var db=require(_0xdef2('0x18'))['db'];function respondWithStatusCode(_0x12a29c,_0x2d675a){_0x2d675a=_0x2d675a||0xcc;return function(_0x159c45){if(_0x159c45){return _0x12a29c[_0xdef2('0x19')](_0x2d675a);}return _0x12a29c['status'](_0x2d675a)[_0xdef2('0x1a')]();};}function respondWithResult(_0x4d360a,_0x1a6f41){_0x1a6f41=_0x1a6f41||0xc8;return function(_0x3c61be){if(_0x3c61be){return _0x4d360a[_0xdef2('0x1b')](_0x1a6f41)[_0xdef2('0x1c')](_0x3c61be);}};}function respondWithFilteredResult(_0x456892,_0x4bed6f){return function(_0x126c6c){if(_0x126c6c){var _0x34771c=typeof _0x4bed6f[_0xdef2('0x1d')]===_0xdef2('0x1e')&&typeof _0x4bed6f['limit']===_0xdef2('0x1e');var _0x39fdc5=_0x126c6c[_0xdef2('0x1f')];var _0x1aef0e=_0x34771c?0x0:_0x4bed6f['offset'];var _0x40c2bc=_0x34771c?_0x126c6c[_0xdef2('0x1f')]:_0x4bed6f[_0xdef2('0x1d')]+_0x4bed6f[_0xdef2('0x20')];var _0x6115ad;if(_0x40c2bc>=_0x39fdc5){_0x40c2bc=_0x39fdc5;_0x6115ad=0xc8;}else{_0x6115ad=0xce;}_0x456892[_0xdef2('0x1b')](_0x6115ad);return _0x456892['set'](_0xdef2('0x21'),_0x1aef0e+'-'+_0x40c2bc+'/'+_0x39fdc5)['json'](_0x126c6c);}return null;};}function patchUpdates(_0x15a6e8){return function(_0x1524bc){try{jsonpatch[_0xdef2('0x22')](_0x1524bc,_0x15a6e8,!![]);}catch(_0x4b91ac){return BPromise[_0xdef2('0x23')](_0x4b91ac);}return _0x1524bc['save']();};}function saveUpdates(_0x3546e6,_0x545562){return function(_0x58eaf1){if(_0x58eaf1){return _0x58eaf1[_0xdef2('0x24')](_0x3546e6)[_0xdef2('0x25')](function(_0x2bf0f9){return _0x2bf0f9;});}return null;};}function removeEntity(_0x3db7c0,_0x45da78){return function(_0x41cfd8){if(_0x41cfd8){return _0x41cfd8[_0xdef2('0x26')]()['then'](function(){_0x3db7c0[_0xdef2('0x1b')](0xcc)[_0xdef2('0x1a')]();});}};}function handleEntityNotFound(_0x1d687d,_0x45d52d){return function(_0x199e6a){if(!_0x199e6a){_0x1d687d[_0xdef2('0x19')](0x194);}return _0x199e6a;};}function handleError(_0x3ec81a,_0x5e2b48){_0x5e2b48=_0x5e2b48||0x1f4;return function(_0x5aa303){logger[_0xdef2('0x27')](_0x5aa303[_0xdef2('0x28')]);if(_0x5aa303[_0xdef2('0x29')]){delete _0x5aa303[_0xdef2('0x29')];}_0x3ec81a[_0xdef2('0x1b')](_0x5e2b48)[_0xdef2('0x2a')](_0x5aa303);};}exports['index']=function(_0x73f9ca,_0x521e34){var _0x881a9a={},_0x24e4b8={},_0x3f13c8={'count':0x0,'rows':[]};var _0x2c3faa=_[_0xdef2('0x2b')](db[_0xdef2('0x2c')]['rawAttributes'],function(_0x516c59){return{'name':_0x516c59[_0xdef2('0x2d')],'type':_0x516c59['type'][_0xdef2('0x2e')]};});_0x24e4b8['model']=_[_0xdef2('0x2b')](_0x2c3faa,'name');_0x24e4b8[_0xdef2('0x2f')]=_[_0xdef2('0x30')](_0x73f9ca[_0xdef2('0x2f')]);_0x24e4b8['filters']=_[_0xdef2('0x31')](_0x24e4b8[_0xdef2('0x32')],_0x24e4b8[_0xdef2('0x2f')]);_0x881a9a['attributes']=_[_0xdef2('0x31')](_0x24e4b8['model'],qs[_0xdef2('0x33')](_0x73f9ca[_0xdef2('0x2f')][_0xdef2('0x33')]));_0x881a9a[_0xdef2('0x34')]=_0x881a9a[_0xdef2('0x34')][_0xdef2('0x35')]?_0x881a9a[_0xdef2('0x34')]:_0x24e4b8[_0xdef2('0x32')];if(!_0x73f9ca[_0xdef2('0x2f')]['hasOwnProperty']('nolimit')){_0x881a9a[_0xdef2('0x20')]=qs['limit'](_0x73f9ca[_0xdef2('0x2f')][_0xdef2('0x20')]);_0x881a9a['offset']=qs[_0xdef2('0x1d')](_0x73f9ca[_0xdef2('0x2f')]['offset']);}_0x881a9a[_0xdef2('0x36')]=qs[_0xdef2('0x37')](_0x73f9ca[_0xdef2('0x2f')][_0xdef2('0x37')]);_0x881a9a[_0xdef2('0x38')]=qs[_0xdef2('0x39')](_[_0xdef2('0x3a')](_0x73f9ca['query'],_0x24e4b8[_0xdef2('0x39')]),_0x2c3faa);if(_0x73f9ca[_0xdef2('0x2f')]['filter']){_0x881a9a[_0xdef2('0x38')]=_[_0xdef2('0x3b')](_0x881a9a['where'],{'$or':_[_0xdef2('0x2b')](_0x2c3faa,function(_0x49327c){if(_0x49327c[_0xdef2('0x3c')]!==_0xdef2('0x3d')){var _0xb09374={};_0xb09374[_0x49327c[_0xdef2('0x29')]]={'$like':'%'+_0x73f9ca[_0xdef2('0x2f')][_0xdef2('0x3e')]+'%'};return _0xb09374;}})});}_0x881a9a=_['merge']({},_0x881a9a,_0x73f9ca['options']);var _0x1c08f9={'where':_0x881a9a['where']};return db['AnalyticFieldReport'][_0xdef2('0x1f')](_0x1c08f9)[_0xdef2('0x25')](function(_0x42b52a){_0x3f13c8['count']=_0x42b52a;if(_0x73f9ca[_0xdef2('0x2f')]['includeAll']){_0x881a9a[_0xdef2('0x3f')]=[{'all':!![]}];}return db[_0xdef2('0x2c')][_0xdef2('0x40')](_0x881a9a);})['then'](function(_0x7ae408){_0x3f13c8[_0xdef2('0x41')]=_0x7ae408;return _0x3f13c8;})[_0xdef2('0x25')](respondWithFilteredResult(_0x521e34,_0x881a9a))[_0xdef2('0x42')](handleError(_0x521e34,null));};exports[_0xdef2('0x43')]=function(_0x12bdf2,_0xdffc27){var _0x35c512={'raw':![],'where':{'id':_0x12bdf2[_0xdef2('0x44')]['id']}},_0x2a4822={};_0x2a4822[_0xdef2('0x32')]=_[_0xdef2('0x30')](db['AnalyticFieldReport'][_0xdef2('0x45')]);_0x2a4822[_0xdef2('0x2f')]=_[_0xdef2('0x30')](_0x12bdf2[_0xdef2('0x2f')]);_0x2a4822[_0xdef2('0x39')]=_[_0xdef2('0x31')](_0x2a4822[_0xdef2('0x32')],_0x2a4822[_0xdef2('0x2f')]);_0x35c512['attributes']=_[_0xdef2('0x31')](_0x2a4822[_0xdef2('0x32')],qs[_0xdef2('0x33')](_0x12bdf2[_0xdef2('0x2f')][_0xdef2('0x33')]));_0x35c512['attributes']=_0x35c512[_0xdef2('0x34')][_0xdef2('0x35')]?_0x35c512['attributes']:_0x2a4822[_0xdef2('0x32')];if(_0x12bdf2[_0xdef2('0x2f')][_0xdef2('0x46')]){_0x35c512[_0xdef2('0x3f')]=[{'all':!![]}];}_0x35c512=_[_0xdef2('0x3b')]({},_0x35c512,_0x12bdf2[_0xdef2('0x47')]);return db[_0xdef2('0x2c')][_0xdef2('0x48')](_0x35c512)[_0xdef2('0x25')](handleEntityNotFound(_0xdffc27,null))[_0xdef2('0x25')](respondWithResult(_0xdffc27,null))[_0xdef2('0x42')](handleError(_0xdffc27,null));};exports[_0xdef2('0x49')]=function(_0x550b1f,_0x550b83){return db['AnalyticFieldReport']['create'](_0x550b1f[_0xdef2('0x4a')],{})[_0xdef2('0x25')](respondWithResult(_0x550b83,0xc9))[_0xdef2('0x42')](handleError(_0x550b83,null));};exports[_0xdef2('0x4b')]=function(_0x4d771d,_0x2c9461){return db['AnalyticFieldReport'][_0xdef2('0x4b')](_0x4d771d['body'],{'raw':![],'individualHooks':!![]})[_0xdef2('0x25')](respondWithResult(_0x2c9461,0xc9))[_0xdef2('0x42')](handleError(_0x2c9461,null));};exports['update']=function(_0x53cc81,_0x70ffaf){if(_0x53cc81['body']['id']){delete _0x53cc81[_0xdef2('0x4a')]['id'];}return db[_0xdef2('0x2c')][_0xdef2('0x48')]({'where':{'id':_0x53cc81[_0xdef2('0x44')]['id']}})[_0xdef2('0x25')](handleEntityNotFound(_0x70ffaf,null))[_0xdef2('0x25')](saveUpdates(_0x53cc81[_0xdef2('0x4a')],null))['then'](respondWithResult(_0x70ffaf,null))[_0xdef2('0x42')](handleError(_0x70ffaf,null));};exports['destroy']=function(_0x54c030,_0x2d1cb9){return db[_0xdef2('0x2c')]['find']({'where':{'id':_0x54c030[_0xdef2('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d1cb9,null))[_0xdef2('0x25')](removeEntity(_0x2d1cb9,null))[_0xdef2('0x42')](handleError(_0x2d1cb9,null));};exports['bulkDestroy']=function(_0x3c1d4b,_0x5c877b){return db[_0xdef2('0x2c')][_0xdef2('0x26')]({'where':{'id':_0x3c1d4b[_0xdef2('0x2f')][_0xdef2('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5c877b,0xcc))[_0xdef2('0x42')](handleError(_0x5c877b,null));};exports['addFields']=function(_0x1eb2f5,_0xb0bb7,_0x59b542){return db[_0xdef2('0x4d')][_0xdef2('0x4e')]({'where':{'id':_0x1eb2f5[_0xdef2('0x44')]['id']}})[_0xdef2('0x25')](handleEntityNotFound(_0xb0bb7,null))[_0xdef2('0x25')](function(_0x437a60){if(_0x437a60){return db[_0xdef2('0x4f')]['transaction'](function(_0x1a2783){return db[_0xdef2('0x2c')][_0xdef2('0x26')]({'where':{'CustomReportId':_0x1eb2f5[_0xdef2('0x44')]['id']},'transaction':_0x1a2783})[_0xdef2('0x25')](function(_0x34bb0a){var _0x2728bd=_[_0xdef2('0x2b')](_0x1eb2f5[_0xdef2('0x4a')],function(_0x2fcfa0){delete _0x2fcfa0['id'];_0x2fcfa0[_0xdef2('0x50')]=_0x1eb2f5[_0xdef2('0x44')]['id'];return _0x2fcfa0;});return db[_0xdef2('0x2c')][_0xdef2('0x4b')](_0x2728bd,{'transaction':_0x1a2783});});})[_0xdef2('0x25')](function(){return db['AnalyticFieldReport'][_0xdef2('0x40')]({'where':{'CustomReportId':_0x1eb2f5[_0xdef2('0x44')]['id']}});});}})[_0xdef2('0x25')](respondWithResult(_0xb0bb7,null))[_0xdef2('0x42')](handleError(_0xb0bb7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4f27fde..7da1ae1 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 _0xfcdf=['bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment'];(function(_0x500206,_0x3e623b){var _0x4bcb84=function(_0x59fa82){while(--_0x59fa82){_0x500206['push'](_0x500206['shift']());}};_0x4bcb84(++_0x3e623b);}(_0xfcdf,0xbc));var _0xffcd=function(_0x522936,_0x323a9c){_0x522936=_0x522936-0x0;var _0x3a7b4c=_0xfcdf[_0x522936];return _0x3a7b4c;};'use strict';var _=require(_0xffcd('0x0'));var util=require(_0xffcd('0x1'));var logger=require(_0xffcd('0x2'))('api');var moment=require(_0xffcd('0x3'));var BPromise=require(_0xffcd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffcd('0x5'));var rimraf=require(_0xffcd('0x6'));var config=require(_0xffcd('0x7'));var attributes=require(_0xffcd('0x8'));module[_0xffcd('0x9')]=function(_0x148507,_0x317310){return _0x148507[_0xffcd('0xa')](_0xffcd('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f40=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0f40,0x176));var _0x00f4=function(_0x2b4629,_0x2cfe26){_0x2b4629=_0x2b4629-0x0;var _0x1d8fa9=_0x0f40[_0x2b4629];return _0x1d8fa9;};'use strict';var _=require(_0x00f4('0x0'));var util=require(_0x00f4('0x1'));var logger=require(_0x00f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x00f4('0x3'));var rp=require(_0x00f4('0x4'));var fs=require('fs');var path=require(_0x00f4('0x5'));var rimraf=require(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x00f4('0x8')]=function(_0x11a12b,_0xd0e9d0){return _0x11a12b[_0x00f4('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x00f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 1746659..22ec9f9 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 _0xd94b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2f34cb,_0x4aebda){var _0x448f63=function(_0x2019f6){while(--_0x2019f6){_0x2f34cb['push'](_0x2f34cb['shift']());}};_0x448f63(++_0x4aebda);}(_0xd94b,0xbf));var _0xbd94=function(_0xfeb39,_0x1d20b7){_0xfeb39=_0xfeb39-0x0;var _0x167aa8=_0xd94b[_0xfeb39];return _0x167aa8;};'use strict';var _=require(_0xbd94('0x0'));var util=require(_0xbd94('0x1'));var moment=require(_0xbd94('0x2'));var BPromise=require(_0xbd94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd94('0x4'));var db=require(_0xbd94('0x5'))['db'];var utils=require(_0xbd94('0x6'));var logger=require(_0xbd94('0x7'))('rpc');var config=require(_0xbd94('0x8'));var jayson=require(_0xbd94('0x9'));var client=jayson[_0xbd94('0xa')][_0xbd94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31a79c,_0x289cb4,_0x2ef2f2){return new BPromise(function(_0x20635d,_0x4aa203){return client[_0xbd94('0xc')](_0x31a79c,_0x2ef2f2)[_0xbd94('0xd')](function(_0x4a525e){logger[_0xbd94('0xe')](_0xbd94('0xf'),_0x289cb4,_0xbd94('0x10'));logger[_0xbd94('0x11')](_0xbd94('0x12'),_0x289cb4,'request\x20sent',JSON[_0xbd94('0x13')](_0x4a525e));if(_0x4a525e[_0xbd94('0x14')]){if(_0x4a525e['error'][_0xbd94('0x15')]===0x1f4){logger[_0xbd94('0x14')](_0xbd94('0xf'),_0x289cb4,_0x4a525e[_0xbd94('0x14')][_0xbd94('0x16')]);return _0x4aa203(_0x4a525e[_0xbd94('0x14')][_0xbd94('0x16')]);}logger[_0xbd94('0x14')](_0xbd94('0xf'),_0x289cb4,_0x4a525e[_0xbd94('0x14')][_0xbd94('0x16')]);return _0x20635d(_0x4a525e[_0xbd94('0x14')][_0xbd94('0x16')]);}else{logger['info'](_0xbd94('0xf'),_0x289cb4,_0xbd94('0x10'));_0x20635d(_0x4a525e[_0xbd94('0x17')][_0xbd94('0x16')]);}})['catch'](function(_0xdb778e){logger[_0xbd94('0x14')](_0xbd94('0xf'),_0x289cb4,_0xdb778e);_0x4aa203(_0xdb778e);});});} \ No newline at end of file +var _0xe6f2=['message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xd7df6d,_0x2e784b){var _0x304544=function(_0x4e6594){while(--_0x4e6594){_0xd7df6d['push'](_0xd7df6d['shift']());}};_0x304544(++_0x2e784b);}(_0xe6f2,0x1d2));var _0x2e6f=function(_0x5d2138,_0x3190db){_0x5d2138=_0x5d2138-0x0;var _0x31f675=_0xe6f2[_0x5d2138];return _0x31f675;};'use strict';var _=require('lodash');var util=require(_0x2e6f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2e6f('0x1'));var fs=require('fs');var Redis=require(_0x2e6f('0x2'));var db=require(_0x2e6f('0x3'))['db'];var utils=require(_0x2e6f('0x4'));var logger=require('../../config/logger')(_0x2e6f('0x5'));var config=require(_0x2e6f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2e6f('0x7')][_0x2e6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2001d2,_0x5bc7fd,_0x42525a){return new BPromise(function(_0x2cd7c3,_0x4000f2){return client[_0x2e6f('0x9')](_0x2001d2,_0x42525a)[_0x2e6f('0xa')](function(_0x40dbf3){logger['info'](_0x2e6f('0xb'),_0x5bc7fd,_0x2e6f('0xc'));logger[_0x2e6f('0xd')](_0x2e6f('0xe'),_0x5bc7fd,'request\x20sent',JSON[_0x2e6f('0xf')](_0x40dbf3));if(_0x40dbf3['error']){if(_0x40dbf3[_0x2e6f('0x10')][_0x2e6f('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5bc7fd,_0x40dbf3[_0x2e6f('0x10')][_0x2e6f('0x12')]);return _0x4000f2(_0x40dbf3[_0x2e6f('0x10')][_0x2e6f('0x12')]);}logger[_0x2e6f('0x10')](_0x2e6f('0xb'),_0x5bc7fd,_0x40dbf3[_0x2e6f('0x10')][_0x2e6f('0x12')]);return _0x2cd7c3(_0x40dbf3[_0x2e6f('0x10')]['message']);}else{logger[_0x2e6f('0x13')](_0x2e6f('0xb'),_0x5bc7fd,'request\x20sent');_0x2cd7c3(_0x40dbf3[_0x2e6f('0x14')][_0x2e6f('0x12')]);}})[_0x2e6f('0x15')](function(_0xbcdbd9){logger['error'](_0x2e6f('0xb'),_0x5bc7fd,_0xbcdbd9);_0x4000f2(_0xbcdbd9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a13f2f5..5947c06 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(_0x531bc7,_0x113e06){var _0x26547c=function(_0x1d8cfd){while(--_0x1d8cfd){_0x531bc7['push'](_0x531bc7['shift']());}};_0x26547c(++_0x113e06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x6b1060,_0x5aaae9){var _0x9d80d3=function(_0x4b3e91){while(--_0x4b3e91){_0x6b1060['push'](_0x6b1060['shift']());}};_0x9d80d3(++_0x5aaae9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 0306e7a..f9e9ecb 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 _0x61a5=['name','TEXT','sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x61a5,0x19e));var _0x561a=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x61a5[_0x416cdc];return _0x1931ce;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'name':{'type':Sequelize[_0x561a('0x1')],'allowNull':![],'unique':_0x561a('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x561a('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4db=['TEXT','name','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa4db,0x139));var _0xba4d=function(_0x29b6ba,_0x3947af){_0x29b6ba=_0x29b6ba-0x0;var _0x215d0f=_0xa4db[_0x29b6ba];return _0x215d0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba4d('0x0')},'table':{'type':Sequelize[_0xba4d('0x1')]},'metric':{'type':Sequelize[_0xba4d('0x2')]},'description':{'type':Sequelize[_0xba4d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 856dcdb..e10632d 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1f8184,_0x59e343){var _0x3e19d8=function(_0x1a2a68){while(--_0x1a2a68){_0x1f8184['push'](_0x1f8184['shift']());}};_0x3e19d8(++_0x59e343);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x4b84[_0x2a238a];return _0xeef802;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x45b380,_0x478cbd){var _0x4cdb76=function(_0x1b6a75){while(--_0x1b6a75){_0x45b380['push'](_0x45b380['shift']());}};_0x4cdb76(++_0x478cbd);}(_0x81bd,0x7c));var _0xd81b=function(_0xc4376d,_0x2e6841){_0xc4376d=_0xc4376d-0x0;var _0x291524=_0x81bd[_0xc4376d];return _0x291524;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 60a7c23..dcccd56 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 _0x13c5=['exports','analytics_metrics','lodash','path','./analyticMetric.attributes'];(function(_0x343343,_0x46874d){var _0x25462d=function(_0x2f88a4){while(--_0x2f88a4){_0x343343['push'](_0x343343['shift']());}};_0x25462d(++_0x46874d);}(_0x13c5,0x7a));var _0x513c=function(_0x4861fd,_0x43c3bd){_0x4861fd=_0x4861fd-0x0;var _0x2b7231=_0x13c5[_0x4861fd];return _0x2b7231;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x2'));module[_0x513c('0x3')]=function(_0x982017,_0x2ad2db){return _0x982017['define']('AnalyticMetric',attributes,{'tableName':_0x513c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d76=['moment','bluebird','request-promise','path','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api'];(function(_0x23662d,_0x1c9918){var _0x22a879=function(_0xdbc5a5){while(--_0xdbc5a5){_0x23662d['push'](_0x23662d['shift']());}};_0x22a879(++_0x1c9918);}(_0x9d76,0x76));var _0x69d7=function(_0x4bfab7,_0x1f92fc){_0x4bfab7=_0x4bfab7-0x0;var _0x232fd7=_0x9d76[_0x4bfab7];return _0x232fd7;};'use strict';var _=require(_0x69d7('0x0'));var util=require('util');var logger=require(_0x69d7('0x1'))(_0x69d7('0x2'));var moment=require(_0x69d7('0x3'));var BPromise=require(_0x69d7('0x4'));var rp=require(_0x69d7('0x5'));var fs=require('fs');var path=require(_0x69d7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x69d7('0x7'));module[_0x69d7('0x8')]=function(_0x9ec22e,_0x237111){return _0x9ec22e['define'](_0x69d7('0x9'),attributes,{'tableName':_0x69d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index dee7898..4a9b0fb 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 _0xc583=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x220c6e,_0x1c328c){var _0x534e93=function(_0xaa73ff){while(--_0xaa73ff){_0x220c6e['push'](_0x220c6e['shift']());}};_0x534e93(++_0x1c328c);}(_0xc583,0x194));var _0x3c58=function(_0x22b96f,_0x35cc0a){_0x22b96f=_0x22b96f-0x0;var _0x2bee8a=_0xc583[_0x22b96f];return _0x2bee8a;};'use strict';var _=require(_0x3c58('0x0'));var util=require('util');var moment=require(_0x3c58('0x1'));var BPromise=require(_0x3c58('0x2'));var rs=require(_0x3c58('0x3'));var fs=require('fs');var Redis=require(_0x3c58('0x4'));var db=require(_0x3c58('0x5'))['db'];var utils=require(_0x3c58('0x6'));var logger=require(_0x3c58('0x7'))(_0x3c58('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c58('0x9')][_0x3c58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31cf0d,_0x137a4d,_0x3d1974){return new BPromise(function(_0x3439a7,_0x935da2){return client[_0x3c58('0xb')](_0x31cf0d,_0x3d1974)[_0x3c58('0xc')](function(_0x405c25){logger[_0x3c58('0xd')](_0x3c58('0xe'),_0x137a4d,_0x3c58('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x137a4d,'request\x20sent',JSON[_0x3c58('0x10')](_0x405c25));if(_0x405c25['error']){if(_0x405c25[_0x3c58('0x11')]['code']===0x1f4){logger[_0x3c58('0x11')](_0x3c58('0xe'),_0x137a4d,_0x405c25['error'][_0x3c58('0x12')]);return _0x935da2(_0x405c25[_0x3c58('0x11')][_0x3c58('0x12')]);}logger[_0x3c58('0x11')](_0x3c58('0xe'),_0x137a4d,_0x405c25[_0x3c58('0x11')][_0x3c58('0x12')]);return _0x3439a7(_0x405c25['error'][_0x3c58('0x12')]);}else{logger[_0x3c58('0xd')](_0x3c58('0xe'),_0x137a4d,_0x3c58('0xf'));_0x3439a7(_0x405c25[_0x3c58('0x13')][_0x3c58('0x12')]);}})[_0x3c58('0x14')](function(_0x59be62){logger[_0x3c58('0x11')](_0x3c58('0xe'),_0x137a4d,_0x59be62);_0x935da2(_0x59be62);});});} \ No newline at end of file +var _0x0ecf=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x0ecf,0xf0));var _0xf0ec=function(_0x30e5b6,_0x2ab393){_0x30e5b6=_0x30e5b6-0x0;var _0x4f1bf4=_0x0ecf[_0x30e5b6];return _0x4f1bf4;};'use strict';var _=require('lodash');var util=require(_0xf0ec('0x0'));var moment=require(_0xf0ec('0x1'));var BPromise=require(_0xf0ec('0x2'));var rs=require(_0xf0ec('0x3'));var fs=require('fs');var Redis=require(_0xf0ec('0x4'));var db=require(_0xf0ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ec('0x6'))(_0xf0ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xf0ec('0x8'));var client=jayson[_0xf0ec('0x9')][_0xf0ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e6600,_0x5d8752,_0x3423a7){return new BPromise(function(_0x2b3910,_0x113694){return client['request'](_0x5e6600,_0x3423a7)[_0xf0ec('0xb')](function(_0x2d6356){logger[_0xf0ec('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x5d8752,_0xf0ec('0xd'));logger[_0xf0ec('0xe')](_0xf0ec('0xf'),_0x5d8752,_0xf0ec('0xd'),JSON[_0xf0ec('0x10')](_0x2d6356));if(_0x2d6356[_0xf0ec('0x11')]){if(_0x2d6356[_0xf0ec('0x11')][_0xf0ec('0x12')]===0x1f4){logger[_0xf0ec('0x11')](_0xf0ec('0x13'),_0x5d8752,_0x2d6356[_0xf0ec('0x11')][_0xf0ec('0x14')]);return _0x113694(_0x2d6356[_0xf0ec('0x11')][_0xf0ec('0x14')]);}logger[_0xf0ec('0x11')](_0xf0ec('0x13'),_0x5d8752,_0x2d6356[_0xf0ec('0x11')][_0xf0ec('0x14')]);return _0x2b3910(_0x2d6356[_0xf0ec('0x11')][_0xf0ec('0x14')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5d8752,_0xf0ec('0xd'));_0x2b3910(_0x2d6356[_0xf0ec('0x15')]['message']);}})[_0xf0ec('0x16')](function(_0x409cb7){logger['error'](_0xf0ec('0x13'),_0x5d8752,_0x409cb7);_0x113694(_0x409cb7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index def7732..88e1335 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 _0x6d19=['../../config/environment','./analyticMetric.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1bb54c,_0x1ae739){var _0x431e02=function(_0x513416){while(--_0x513416){_0x1bb54c['push'](_0x1bb54c['shift']());}};_0x431e02(++_0x1ae739);}(_0x6d19,0x160));var _0x96d1=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x6d19[_0x548627];return _0x844a84;};'use strict';var multer=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var path=require(_0x96d1('0x2'));var timeout=require(_0x96d1('0x3'));var express=require(_0x96d1('0x4'));var router=express[_0x96d1('0x5')]();var fs_extra=require(_0x96d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x96d1('0x7'));var config=require(_0x96d1('0x8'));var controller=require(_0x96d1('0x9'));router[_0x96d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x96d1('0xb')]);router[_0x96d1('0xa')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0xd')]);router[_0x96d1('0xe')]('/',auth[_0x96d1('0xf')](),controller[_0x96d1('0x10')]);router[_0x96d1('0x11')](_0x96d1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x96d1('0x12')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x598a=['util','path','connect-timeout','express','fs-extra','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x598a,0xfb));var _0xa598=function(_0x202077,_0x41b817){_0x202077=_0x202077-0x0;var _0x490a54=_0x598a[_0x202077];return _0x490a54;};'use strict';var multer=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var path=require(_0xa598('0x2'));var timeout=require(_0xa598('0x3'));var express=require(_0xa598('0x4'));var router=express['Router']();var fs_extra=require(_0xa598('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa598('0x6'));router[_0xa598('0x7')]('/',auth[_0xa598('0x8')](),controller[_0xa598('0x9')]);router[_0xa598('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa598('0xa')]);router[_0xa598('0xb')]('/',auth[_0xa598('0x8')](),controller[_0xa598('0xc')]);router[_0xa598('0xd')](_0xa598('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xa598('0xf')](_0xa598('0xe'),auth[_0xa598('0x8')](),controller[_0xa598('0x10')]);module[_0xa598('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 71df0f5..57fbf25 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 _0xe24a=['TEXT','exports'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0xe24a,0x87));var _0xae24=function(_0x1c57f9,_0x474d9b){_0x1c57f9=_0x1c57f9-0x0;var _0x5c8aac=_0xe24a[_0x1c57f9];return _0x5c8aac;};'use strict';var Sequelize=require('sequelize');module[_0xae24('0x0')]={'tree':{'type':Sequelize[_0xae24('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9f4e=['exports','TEXT','sequelize'];(function(_0x59e7e0,_0x3ec148){var _0x26b058=function(_0x212ee2){while(--_0x212ee2){_0x59e7e0['push'](_0x59e7e0['shift']());}};_0x26b058(++_0x3ec148);}(_0x9f4e,0xce));var _0xe9f4=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x9f4e[_0x1057a3];return _0x131cdb;};'use strict';var Sequelize=require(_0xe9f4('0x0'));module[_0xe9f4('0x1')]={'tree':{'type':Sequelize[_0xe9f4('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 2b46f7d..a06477e 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 _0x8bed=['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','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','sendStatus','error','stack','name','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4a8535,_0x100001){var _0x2e48dd=function(_0x20e9b5){while(--_0x20e9b5){_0x4a8535['push'](_0x4a8535['shift']());}};_0x2e48dd(++_0x100001);}(_0x8bed,0xca));var _0xd8be=function(_0x4ff939,_0x5f54ea){_0x4ff939=_0x4ff939-0x0;var _0x3f8ba8=_0x8bed[_0x4ff939];return _0x3f8ba8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8be('0x0'));var zipdir=require(_0xd8be('0x1'));var jsonpatch=require(_0xd8be('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8be('0x3'));var Mustache=require(_0xd8be('0x4'));var util=require(_0xd8be('0x5'));var path=require(_0xd8be('0x6'));var sox=require(_0xd8be('0x7'));var csv=require(_0xd8be('0x8'));var ejs=require(_0xd8be('0x9'));var fs=require('fs');var fs_extra=require(_0xd8be('0xa'));var _=require(_0xd8be('0xb'));var squel=require(_0xd8be('0xc'));var crypto=require(_0xd8be('0xd'));var jsforce=require(_0xd8be('0xe'));var deskjs=require(_0xd8be('0xf'));var toCsv=require(_0xd8be('0x8'));var querystring=require(_0xd8be('0x10'));var Papa=require(_0xd8be('0x11'));var Redis=require(_0xd8be('0x12'));var authService=require(_0xd8be('0x13'));var qs=require(_0xd8be('0x14'));var as=require(_0xd8be('0x15'));var hardwareService=require(_0xd8be('0x16'));var logger=require(_0xd8be('0x17'))(_0xd8be('0x18'));var utils=require(_0xd8be('0x19'));var config=require(_0xd8be('0x1a'));var licenseUtil=require(_0xd8be('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2504c8,_0x151719){_0x151719=_0x151719||0xcc;return function(_0x447d92){if(_0x447d92){return _0x2504c8['sendStatus'](_0x151719);}return _0x2504c8[_0xd8be('0x1c')](_0x151719)[_0xd8be('0x1d')]();};}function respondWithResult(_0x450dd8,_0x2f6b07){_0x2f6b07=_0x2f6b07||0xc8;return function(_0x12fd09){if(_0x12fd09){return _0x450dd8[_0xd8be('0x1c')](_0x2f6b07)['json'](_0x12fd09);}};}function respondWithFilteredResult(_0x14bbd6,_0x52a2da){return function(_0x5b6c0e){if(_0x5b6c0e){var _0x5d0ae3=typeof _0x52a2da[_0xd8be('0x1e')]===_0xd8be('0x1f')&&typeof _0x52a2da[_0xd8be('0x20')]===_0xd8be('0x1f');var _0x382d4a=_0x5b6c0e[_0xd8be('0x21')];var _0x52cf76=_0x5d0ae3?0x0:_0x52a2da[_0xd8be('0x1e')];var _0x269a99=_0x5d0ae3?_0x5b6c0e['count']:_0x52a2da['offset']+_0x52a2da[_0xd8be('0x20')];var _0xd75dbb;if(_0x269a99>=_0x382d4a){_0x269a99=_0x382d4a;_0xd75dbb=0xc8;}else{_0xd75dbb=0xce;}_0x14bbd6[_0xd8be('0x1c')](_0xd75dbb);return _0x14bbd6[_0xd8be('0x22')]('Content-Range',_0x52cf76+'-'+_0x269a99+'/'+_0x382d4a)[_0xd8be('0x23')](_0x5b6c0e);}return null;};}function patchUpdates(_0xe34c12){return function(_0x156857){try{jsonpatch['apply'](_0x156857,_0xe34c12,!![]);}catch(_0x48f423){return BPromise[_0xd8be('0x24')](_0x48f423);}return _0x156857['save']();};}function saveUpdates(_0x284f80,_0x31b4ec){return function(_0x10dab6){if(_0x10dab6){return _0x10dab6[_0xd8be('0x25')](_0x284f80)[_0xd8be('0x26')](function(_0x2e9828){return _0x2e9828;});}return null;};}function removeEntity(_0x2f9c19,_0x1914d1){return function(_0x5ae535){if(_0x5ae535){return _0x5ae535[_0xd8be('0x27')]()[_0xd8be('0x26')](function(){_0x2f9c19[_0xd8be('0x1c')](0xcc)[_0xd8be('0x1d')]();});}};}function handleEntityNotFound(_0x5a17e4,_0x4ee1c4){return function(_0x5220b2){if(!_0x5220b2){_0x5a17e4[_0xd8be('0x28')](0x194);}return _0x5220b2;};}function handleError(_0x33fb6a,_0x592c4c){_0x592c4c=_0x592c4c||0x1f4;return function(_0x10789a){logger[_0xd8be('0x29')](_0x10789a[_0xd8be('0x2a')]);if(_0x10789a[_0xd8be('0x2b')]){delete _0x10789a[_0xd8be('0x2b')];}_0x33fb6a[_0xd8be('0x1c')](_0x592c4c)['send'](_0x10789a);};}exports['index']=function(_0x47247f,_0x45ce44){var _0x295faa={},_0x22ac51={},_0x5efc59={'count':0x0,'rows':[]};var _0x5de0ec=_[_0xd8be('0x2c')](db[_0xd8be('0x2d')][_0xd8be('0x2e')],function(_0x1c62eb){return{'name':_0x1c62eb[_0xd8be('0x2f')],'type':_0x1c62eb[_0xd8be('0x30')][_0xd8be('0x31')]};});_0x22ac51[_0xd8be('0x32')]=_[_0xd8be('0x2c')](_0x5de0ec,_0xd8be('0x2b'));_0x22ac51[_0xd8be('0x33')]=_[_0xd8be('0x34')](_0x47247f[_0xd8be('0x33')]);_0x22ac51[_0xd8be('0x35')]=_[_0xd8be('0x36')](_0x22ac51['model'],_0x22ac51['query']);_0x295faa[_0xd8be('0x37')]=_['intersection'](_0x22ac51[_0xd8be('0x32')],qs[_0xd8be('0x38')](_0x47247f[_0xd8be('0x33')][_0xd8be('0x38')]));_0x295faa[_0xd8be('0x37')]=_0x295faa[_0xd8be('0x37')][_0xd8be('0x39')]?_0x295faa['attributes']:_0x22ac51[_0xd8be('0x32')];if(!_0x47247f[_0xd8be('0x33')][_0xd8be('0x3a')]('nolimit')){_0x295faa[_0xd8be('0x20')]=qs['limit'](_0x47247f[_0xd8be('0x33')][_0xd8be('0x20')]);_0x295faa[_0xd8be('0x1e')]=qs['offset'](_0x47247f[_0xd8be('0x33')][_0xd8be('0x1e')]);}_0x295faa['order']=qs[_0xd8be('0x3b')](_0x47247f[_0xd8be('0x33')][_0xd8be('0x3b')]);_0x295faa[_0xd8be('0x3c')]=qs[_0xd8be('0x35')](_['pick'](_0x47247f[_0xd8be('0x33')],_0x22ac51['filters']),_0x5de0ec);if(_0x47247f[_0xd8be('0x33')]['filter']){_0x295faa[_0xd8be('0x3c')]=_[_0xd8be('0x3d')](_0x295faa[_0xd8be('0x3c')],{'$or':_[_0xd8be('0x2c')](_0x5de0ec,function(_0xb960b6){if(_0xb960b6[_0xd8be('0x30')]!==_0xd8be('0x3e')){var _0xd50b91={};_0xd50b91[_0xb960b6[_0xd8be('0x2b')]]={'$like':'%'+_0x47247f[_0xd8be('0x33')][_0xd8be('0x3f')]+'%'};return _0xd50b91;}})});}_0x295faa=_[_0xd8be('0x3d')]({},_0x295faa,_0x47247f['options']);var _0x1a61f2={'where':_0x295faa[_0xd8be('0x3c')]};return db[_0xd8be('0x2d')][_0xd8be('0x21')](_0x1a61f2)[_0xd8be('0x26')](function(_0x1adb91){_0x5efc59[_0xd8be('0x21')]=_0x1adb91;if(_0x47247f['query'][_0xd8be('0x40')]){_0x295faa[_0xd8be('0x41')]=[{'all':!![]}];}return db[_0xd8be('0x2d')]['findAll'](_0x295faa);})[_0xd8be('0x26')](function(_0x4246f8){_0x5efc59['rows']=_0x4246f8;return _0x5efc59;})[_0xd8be('0x26')](respondWithFilteredResult(_0x45ce44,_0x295faa))[_0xd8be('0x42')](handleError(_0x45ce44,null));};exports[_0xd8be('0x43')]=function(_0x2db83f,_0x2829eb){var _0xe9aabe={'raw':!![],'where':{'id':_0x2db83f['params']['id']}},_0x880fde={};_0x880fde[_0xd8be('0x32')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x880fde[_0xd8be('0x33')]=_[_0xd8be('0x34')](_0x2db83f['query']);_0x880fde[_0xd8be('0x35')]=_[_0xd8be('0x36')](_0x880fde['model'],_0x880fde['query']);_0xe9aabe[_0xd8be('0x37')]=_[_0xd8be('0x36')](_0x880fde[_0xd8be('0x32')],qs[_0xd8be('0x38')](_0x2db83f[_0xd8be('0x33')][_0xd8be('0x38')]));_0xe9aabe['attributes']=_0xe9aabe[_0xd8be('0x37')][_0xd8be('0x39')]?_0xe9aabe['attributes']:_0x880fde[_0xd8be('0x32')];if(_0x2db83f[_0xd8be('0x33')][_0xd8be('0x40')]){_0xe9aabe[_0xd8be('0x41')]=[{'all':!![]}];}_0xe9aabe=_[_0xd8be('0x3d')]({},_0xe9aabe,_0x2db83f['options']);return db[_0xd8be('0x2d')][_0xd8be('0x44')](_0xe9aabe)['then'](handleEntityNotFound(_0x2829eb,null))[_0xd8be('0x26')](respondWithResult(_0x2829eb,null))[_0xd8be('0x42')](handleError(_0x2829eb,null));};exports[_0xd8be('0x45')]=function(_0x3dfe33,_0x5af887){return db['AnalyticTreeReport'][_0xd8be('0x45')](_0x3dfe33['body'],{})[_0xd8be('0x26')](respondWithResult(_0x5af887,0xc9))['catch'](handleError(_0x5af887,null));};exports[_0xd8be('0x25')]=function(_0xb64434,_0x47ddf1){if(_0xb64434[_0xd8be('0x46')]['id']){delete _0xb64434['body']['id'];}return db[_0xd8be('0x2d')][_0xd8be('0x44')]({'where':{'id':_0xb64434[_0xd8be('0x47')]['id']}})[_0xd8be('0x26')](handleEntityNotFound(_0x47ddf1,null))[_0xd8be('0x26')](saveUpdates(_0xb64434['body'],null))['then'](respondWithResult(_0x47ddf1,null))[_0xd8be('0x42')](handleError(_0x47ddf1,null));};exports[_0xd8be('0x27')]=function(_0x2f8e37,_0xefcb14){return db[_0xd8be('0x2d')][_0xd8be('0x44')]({'where':{'id':_0x2f8e37[_0xd8be('0x47')]['id']}})['then'](handleEntityNotFound(_0xefcb14,null))[_0xd8be('0x26')](removeEntity(_0xefcb14,null))[_0xd8be('0x42')](handleError(_0xefcb14,null));}; \ No newline at end of file +var _0x7ad2=['sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','show','params','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x4e29f4,_0x481754){var _0xaf50cb=function(_0x25d70c){while(--_0x25d70c){_0x4e29f4['push'](_0x4e29f4['shift']());}};_0xaf50cb(++_0x481754);}(_0x7ad2,0x1f4));var _0x27ad=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7ad2[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x27ad('0x0'));var rimraf=require(_0x27ad('0x1'));var zipdir=require(_0x27ad('0x2'));var jsonpatch=require(_0x27ad('0x3'));var rp=require(_0x27ad('0x4'));var moment=require(_0x27ad('0x5'));var BPromise=require(_0x27ad('0x6'));var Mustache=require(_0x27ad('0x7'));var util=require(_0x27ad('0x8'));var path=require(_0x27ad('0x9'));var sox=require('sox');var csv=require(_0x27ad('0xa'));var ejs=require(_0x27ad('0xb'));var fs=require('fs');var fs_extra=require(_0x27ad('0xc'));var _=require(_0x27ad('0xd'));var squel=require(_0x27ad('0xe'));var crypto=require(_0x27ad('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27ad('0xa'));var querystring=require(_0x27ad('0x10'));var Papa=require(_0x27ad('0x11'));var Redis=require(_0x27ad('0x12'));var authService=require(_0x27ad('0x13'));var qs=require(_0x27ad('0x14'));var as=require(_0x27ad('0x15'));var hardwareService=require(_0x27ad('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x27ad('0x17'));var config=require(_0x27ad('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3abecd,_0x5d7f1d){_0x5d7f1d=_0x5d7f1d||0xcc;return function(_0x93be95){if(_0x93be95){return _0x3abecd[_0x27ad('0x19')](_0x5d7f1d);}return _0x3abecd[_0x27ad('0x1a')](_0x5d7f1d)[_0x27ad('0x1b')]();};}function respondWithResult(_0x1f1a9b,_0x4841cb){_0x4841cb=_0x4841cb||0xc8;return function(_0x10199d){if(_0x10199d){return _0x1f1a9b['status'](_0x4841cb)[_0x27ad('0x1c')](_0x10199d);}};}function respondWithFilteredResult(_0x5ef0fd,_0x5aead6){return function(_0x54dcb8){if(_0x54dcb8){var _0x5498db=typeof _0x5aead6[_0x27ad('0x1d')]===_0x27ad('0x1e')&&typeof _0x5aead6[_0x27ad('0x1f')]===_0x27ad('0x1e');var _0x9ad64=_0x54dcb8[_0x27ad('0x20')];var _0x374c32=_0x5498db?0x0:_0x5aead6[_0x27ad('0x1d')];var _0x8f3699=_0x5498db?_0x54dcb8['count']:_0x5aead6[_0x27ad('0x1d')]+_0x5aead6[_0x27ad('0x1f')];var _0x3696d4;if(_0x8f3699>=_0x9ad64){_0x8f3699=_0x9ad64;_0x3696d4=0xc8;}else{_0x3696d4=0xce;}_0x5ef0fd[_0x27ad('0x1a')](_0x3696d4);return _0x5ef0fd[_0x27ad('0x21')]('Content-Range',_0x374c32+'-'+_0x8f3699+'/'+_0x9ad64)[_0x27ad('0x1c')](_0x54dcb8);}return null;};}function patchUpdates(_0x2ec67a){return function(_0x2397f8){try{jsonpatch['apply'](_0x2397f8,_0x2ec67a,!![]);}catch(_0x49dd89){return BPromise[_0x27ad('0x22')](_0x49dd89);}return _0x2397f8[_0x27ad('0x23')]();};}function saveUpdates(_0x57005f,_0x31a965){return function(_0x1ec0a9){if(_0x1ec0a9){return _0x1ec0a9[_0x27ad('0x24')](_0x57005f)['then'](function(_0x163409){return _0x163409;});}return null;};}function removeEntity(_0x299309,_0x212fb2){return function(_0x58b1df){if(_0x58b1df){return _0x58b1df[_0x27ad('0x25')]()[_0x27ad('0x26')](function(){_0x299309['status'](0xcc)[_0x27ad('0x1b')]();});}};}function handleEntityNotFound(_0x3ef647,_0x625c04){return function(_0x2315ed){if(!_0x2315ed){_0x3ef647[_0x27ad('0x19')](0x194);}return _0x2315ed;};}function handleError(_0x5d6ac9,_0x49650f){_0x49650f=_0x49650f||0x1f4;return function(_0x43cc54){logger[_0x27ad('0x27')](_0x43cc54[_0x27ad('0x28')]);if(_0x43cc54[_0x27ad('0x29')]){delete _0x43cc54['name'];}_0x5d6ac9[_0x27ad('0x1a')](_0x49650f)[_0x27ad('0x2a')](_0x43cc54);};}exports[_0x27ad('0x2b')]=function(_0x523671,_0x3d7c4c){var _0x3ccbfc={},_0x32bf0c={},_0x1f9031={'count':0x0,'rows':[]};var _0x3c3518=_[_0x27ad('0x2c')](db['AnalyticTreeReport'][_0x27ad('0x2d')],function(_0x4afaef){return{'name':_0x4afaef[_0x27ad('0x2e')],'type':_0x4afaef[_0x27ad('0x2f')]['key']};});_0x32bf0c[_0x27ad('0x30')]=_[_0x27ad('0x2c')](_0x3c3518,_0x27ad('0x29'));_0x32bf0c[_0x27ad('0x31')]=_[_0x27ad('0x32')](_0x523671['query']);_0x32bf0c['filters']=_[_0x27ad('0x33')](_0x32bf0c[_0x27ad('0x30')],_0x32bf0c['query']);_0x3ccbfc[_0x27ad('0x34')]=_['intersection'](_0x32bf0c[_0x27ad('0x30')],qs[_0x27ad('0x35')](_0x523671[_0x27ad('0x31')][_0x27ad('0x35')]));_0x3ccbfc[_0x27ad('0x34')]=_0x3ccbfc['attributes']['length']?_0x3ccbfc[_0x27ad('0x34')]:_0x32bf0c['model'];if(!_0x523671[_0x27ad('0x31')][_0x27ad('0x36')](_0x27ad('0x37'))){_0x3ccbfc[_0x27ad('0x1f')]=qs[_0x27ad('0x1f')](_0x523671[_0x27ad('0x31')]['limit']);_0x3ccbfc[_0x27ad('0x1d')]=qs[_0x27ad('0x1d')](_0x523671[_0x27ad('0x31')]['offset']);}_0x3ccbfc['order']=qs[_0x27ad('0x38')](_0x523671[_0x27ad('0x31')][_0x27ad('0x38')]);_0x3ccbfc[_0x27ad('0x39')]=qs[_0x27ad('0x3a')](_[_0x27ad('0x3b')](_0x523671[_0x27ad('0x31')],_0x32bf0c[_0x27ad('0x3a')]),_0x3c3518);if(_0x523671[_0x27ad('0x31')][_0x27ad('0x3c')]){_0x3ccbfc[_0x27ad('0x39')]=_[_0x27ad('0x3d')](_0x3ccbfc[_0x27ad('0x39')],{'$or':_[_0x27ad('0x2c')](_0x3c3518,function(_0x421973){if(_0x421973['type']!==_0x27ad('0x3e')){var _0x3937dd={};_0x3937dd[_0x421973[_0x27ad('0x29')]]={'$like':'%'+_0x523671[_0x27ad('0x31')][_0x27ad('0x3c')]+'%'};return _0x3937dd;}})});}_0x3ccbfc=_[_0x27ad('0x3d')]({},_0x3ccbfc,_0x523671[_0x27ad('0x3f')]);var _0x49d810={'where':_0x3ccbfc[_0x27ad('0x39')]};return db[_0x27ad('0x40')][_0x27ad('0x20')](_0x49d810)['then'](function(_0x1dfe07){_0x1f9031['count']=_0x1dfe07;if(_0x523671[_0x27ad('0x31')][_0x27ad('0x41')]){_0x3ccbfc['include']=[{'all':!![]}];}return db[_0x27ad('0x40')][_0x27ad('0x42')](_0x3ccbfc);})[_0x27ad('0x26')](function(_0x3f681e){_0x1f9031[_0x27ad('0x43')]=_0x3f681e;return _0x1f9031;})['then'](respondWithFilteredResult(_0x3d7c4c,_0x3ccbfc))['catch'](handleError(_0x3d7c4c,null));};exports[_0x27ad('0x44')]=function(_0x1a98b1,_0x203e81){var _0x40d7eb={'raw':!![],'where':{'id':_0x1a98b1[_0x27ad('0x45')]['id']}},_0x2cce46={};_0x2cce46[_0x27ad('0x30')]=_[_0x27ad('0x32')](db['AnalyticTreeReport'][_0x27ad('0x2d')]);_0x2cce46[_0x27ad('0x31')]=_[_0x27ad('0x32')](_0x1a98b1['query']);_0x2cce46[_0x27ad('0x3a')]=_[_0x27ad('0x33')](_0x2cce46[_0x27ad('0x30')],_0x2cce46[_0x27ad('0x31')]);_0x40d7eb[_0x27ad('0x34')]=_['intersection'](_0x2cce46[_0x27ad('0x30')],qs[_0x27ad('0x35')](_0x1a98b1[_0x27ad('0x31')][_0x27ad('0x35')]));_0x40d7eb[_0x27ad('0x34')]=_0x40d7eb[_0x27ad('0x34')][_0x27ad('0x46')]?_0x40d7eb[_0x27ad('0x34')]:_0x2cce46[_0x27ad('0x30')];if(_0x1a98b1[_0x27ad('0x31')][_0x27ad('0x41')]){_0x40d7eb['include']=[{'all':!![]}];}_0x40d7eb=_[_0x27ad('0x3d')]({},_0x40d7eb,_0x1a98b1['options']);return db[_0x27ad('0x40')]['find'](_0x40d7eb)[_0x27ad('0x26')](handleEntityNotFound(_0x203e81,null))[_0x27ad('0x26')](respondWithResult(_0x203e81,null))[_0x27ad('0x47')](handleError(_0x203e81,null));};exports[_0x27ad('0x48')]=function(_0x5eced9,_0x497b27){return db[_0x27ad('0x40')]['create'](_0x5eced9[_0x27ad('0x49')],{})[_0x27ad('0x26')](respondWithResult(_0x497b27,0xc9))[_0x27ad('0x47')](handleError(_0x497b27,null));};exports[_0x27ad('0x24')]=function(_0x1daab0,_0x2569e8){if(_0x1daab0[_0x27ad('0x49')]['id']){delete _0x1daab0[_0x27ad('0x49')]['id'];}return db[_0x27ad('0x40')][_0x27ad('0x4a')]({'where':{'id':_0x1daab0['params']['id']}})[_0x27ad('0x26')](handleEntityNotFound(_0x2569e8,null))['then'](saveUpdates(_0x1daab0[_0x27ad('0x49')],null))[_0x27ad('0x26')](respondWithResult(_0x2569e8,null))['catch'](handleError(_0x2569e8,null));};exports[_0x27ad('0x25')]=function(_0x487b01,_0x58cd91){return db[_0x27ad('0x40')][_0x27ad('0x4a')]({'where':{'id':_0x487b01[_0x27ad('0x45')]['id']}})['then'](handleEntityNotFound(_0x58cd91,null))[_0x27ad('0x26')](removeEntity(_0x58cd91,null))[_0x27ad('0x47')](handleError(_0x58cd91,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 361de0d..984033a 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 _0x44ef=['moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x474771,_0x50efa1){var _0x6388b6=function(_0x56f4c0){while(--_0x56f4c0){_0x474771['push'](_0x474771['shift']());}};_0x6388b6(++_0x50efa1);}(_0x44ef,0x88));var _0xf44e=function(_0x4306f9,_0x55b768){_0x4306f9=_0x4306f9-0x0;var _0xb960db=_0x44ef[_0x4306f9];return _0xb960db;};'use strict';var _=require(_0xf44e('0x0'));var util=require(_0xf44e('0x1'));var logger=require(_0xf44e('0x2'))(_0xf44e('0x3'));var moment=require(_0xf44e('0x4'));var BPromise=require(_0xf44e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf44e('0x6'));var rimraf=require(_0xf44e('0x7'));var config=require(_0xf44e('0x8'));var attributes=require(_0xf44e('0x9'));module[_0xf44e('0xa')]=function(_0x392679,_0x5f1409){return _0x392679[_0xf44e('0xb')](_0xf44e('0xc'),attributes,{'tableName':_0xf44e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd16f=['rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','api','bluebird','request-promise','path'];(function(_0x30d0ad,_0x5e091a){var _0x4dd2b8=function(_0x363c64){while(--_0x363c64){_0x30d0ad['push'](_0x30d0ad['shift']());}};_0x4dd2b8(++_0x5e091a);}(_0xd16f,0xcb));var _0xfd16=function(_0x5ab00c,_0x1ffb65){_0x5ab00c=_0x5ab00c-0x0;var _0x140a93=_0xd16f[_0x5ab00c];return _0x140a93;};'use strict';var _=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var logger=require('../../config/logger')(_0xfd16('0x2'));var moment=require('moment');var BPromise=require(_0xfd16('0x3'));var rp=require(_0xfd16('0x4'));var fs=require('fs');var path=require(_0xfd16('0x5'));var rimraf=require(_0xfd16('0x6'));var config=require(_0xfd16('0x7'));var attributes=require(_0xfd16('0x8'));module['exports']=function(_0x46ad99,_0x40cce0){return _0x46ad99[_0xfd16('0x9')](_0xfd16('0xa'),attributes,{'tableName':'analytics_report_trees','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 4f74ff3..739c993 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1b4355,_0xa1c0b5){var _0xa12783=function(_0x270dcf){while(--_0x270dcf){_0x1b4355['push'](_0x1b4355['shift']());}};_0xa12783(++_0xa1c0b5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'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')]('AnalyticTreeReport,\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 +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38ca49,_0x206382){var _0x131806=function(_0xd39e4d){while(--_0xd39e4d){_0x38ca49['push'](_0x38ca49['shift']());}};_0x131806(++_0x206382);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c25ba10..f66cab3 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 _0x9b93=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports','util','path'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x9b93,0xb9));var _0x39b9=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x9b93[_0x5d80de];return _0x1c7556;};'use strict';var multer=require('multer');var util=require(_0x39b9('0x0'));var path=require(_0x39b9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39b9('0x2')]();var fs_extra=require(_0x39b9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x39b9('0x4'));var config=require(_0x39b9('0x5'));var controller=require(_0x39b9('0x6'));router[_0x39b9('0x7')]('/',auth[_0x39b9('0x8')](),controller[_0x39b9('0x9')]);router[_0x39b9('0x7')]('/:id',auth[_0x39b9('0x8')](),controller['show']);router[_0x39b9('0xa')]('/',auth[_0x39b9('0x8')](),controller[_0x39b9('0xb')]);router['put'](_0x39b9('0xc'),auth[_0x39b9('0x8')](),controller[_0x39b9('0xd')]);router[_0x39b9('0xe')]('/:id',auth[_0x39b9('0x8')](),controller[_0x39b9('0xf')]);module[_0x39b9('0x10')]=router; \ No newline at end of file +var _0xbd39=['isAuthenticated','index','post','/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xbd39,0xf5));var _0x9bd3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xbd39[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require(_0x9bd3('0x0'));var path=require(_0x9bd3('0x1'));var timeout=require(_0x9bd3('0x2'));var express=require('express');var router=express[_0x9bd3('0x3')]();var fs_extra=require(_0x9bd3('0x4'));var auth=require(_0x9bd3('0x5'));var interaction=require(_0x9bd3('0x6'));var config=require(_0x9bd3('0x7'));var controller=require(_0x9bd3('0x8'));router[_0x9bd3('0x9')]('/',auth[_0x9bd3('0xa')](),controller[_0x9bd3('0xb')]);router[_0x9bd3('0x9')]('/:id',auth[_0x9bd3('0xa')](),controller['show']);router[_0x9bd3('0xc')]('/',auth[_0x9bd3('0xa')](),controller['create']);router['put'](_0x9bd3('0xd'),auth[_0x9bd3('0xa')](),controller[_0x9bd3('0xe')]);router[_0x9bd3('0xf')](_0x9bd3('0xd'),auth[_0x9bd3('0xa')](),controller['destroy']);module[_0x9bd3('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6bf8caf..38bcfe1 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 _0xfd2f=['sequelize','exports','STRING'];(function(_0x5f2854,_0x24dd94){var _0xd871cc=function(_0x242c39){while(--_0x242c39){_0x5f2854['push'](_0x5f2854['shift']());}};_0xd871cc(++_0x24dd94);}(_0xfd2f,0x14a));var _0xffd2=function(_0xadb003,_0x35765e){_0xadb003=_0xadb003-0x0;var _0x43cbc2=_0xfd2f[_0xadb003];return _0x43cbc2;};'use strict';var Sequelize=require(_0xffd2('0x0'));module[_0xffd2('0x1')]={'name':{'type':Sequelize[_0xffd2('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xffd2('0x2')]}}; \ No newline at end of file +var _0xf8de=['exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf8de,0x1d4));var _0xef8d=function(_0x567992,_0xc335a5){_0x567992=_0x567992-0x0;var _0x48f62f=_0xf8de[_0x567992];return _0x48f62f;};'use strict';var Sequelize=require('sequelize');module[_0xef8d('0x0')]={'name':{'type':Sequelize[_0xef8d('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xef8d('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1eb7dad..49f9cc0 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 _0xa7c4=['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','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','fields','options','find','clone','get','omit','createdAt','updatedAt','body','create','originalname','file','mimetype','ChatOfflineMessageId','server/files/attachments/','join','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel'];(function(_0x363789,_0x285ecd){var _0x129141=function(_0x38c792){while(--_0x38c792){_0x363789['push'](_0x363789['shift']());}};_0x129141(++_0x285ecd);}(_0xa7c4,0x1ac));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4a7c('0x0'));var rimraf=require(_0x4a7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a7c('0x2'));var rp=require(_0x4a7c('0x3'));var moment=require(_0x4a7c('0x4'));var BPromise=require(_0x4a7c('0x5'));var Mustache=require(_0x4a7c('0x6'));var util=require(_0x4a7c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4a7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a7c('0x9'));var _=require(_0x4a7c('0xa'));var squel=require(_0x4a7c('0xb'));var crypto=require(_0x4a7c('0xc'));var jsforce=require(_0x4a7c('0xd'));var deskjs=require(_0x4a7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4a7c('0xf'));var Papa=require(_0x4a7c('0x10'));var Redis=require(_0x4a7c('0x11'));var authService=require(_0x4a7c('0x12'));var qs=require(_0x4a7c('0x13'));var as=require(_0x4a7c('0x14'));var hardwareService=require(_0x4a7c('0x15'));var logger=require(_0x4a7c('0x16'))(_0x4a7c('0x17'));var utils=require(_0x4a7c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4a7c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x206795,_0x991f8f){_0x991f8f=_0x991f8f||0xcc;return function(_0x50a600){if(_0x50a600){return _0x206795[_0x4a7c('0x1a')](_0x991f8f);}return _0x206795[_0x4a7c('0x1b')](_0x991f8f)[_0x4a7c('0x1c')]();};}function respondWithResult(_0x4abd95,_0x4ef7fb){_0x4ef7fb=_0x4ef7fb||0xc8;return function(_0x23fead){if(_0x23fead){return _0x4abd95[_0x4a7c('0x1b')](_0x4ef7fb)[_0x4a7c('0x1d')](_0x23fead);}};}function respondWithFilteredResult(_0x2c77cc,_0x50f592){return function(_0xf822af){if(_0xf822af){var _0x57cec6=typeof _0x50f592[_0x4a7c('0x1e')]===_0x4a7c('0x1f')&&typeof _0x50f592['limit']===_0x4a7c('0x1f');var _0xac751c=_0xf822af[_0x4a7c('0x20')];var _0x5a8ba3=_0x57cec6?0x0:_0x50f592['offset'];var _0xe13446=_0x57cec6?_0xf822af[_0x4a7c('0x20')]:_0x50f592['offset']+_0x50f592['limit'];var _0x10a4b0;if(_0xe13446>=_0xac751c){_0xe13446=_0xac751c;_0x10a4b0=0xc8;}else{_0x10a4b0=0xce;}_0x2c77cc['status'](_0x10a4b0);return _0x2c77cc[_0x4a7c('0x21')](_0x4a7c('0x22'),_0x5a8ba3+'-'+_0xe13446+'/'+_0xac751c)[_0x4a7c('0x1d')](_0xf822af);}return null;};}function patchUpdates(_0x125b4a){return function(_0x59232e){try{jsonpatch['apply'](_0x59232e,_0x125b4a,!![]);}catch(_0x14eac8){return BPromise[_0x4a7c('0x23')](_0x14eac8);}return _0x59232e[_0x4a7c('0x24')]();};}function saveUpdates(_0x55bf1a,_0x560a42){return function(_0x15516a){if(_0x15516a){return _0x15516a[_0x4a7c('0x25')](_0x55bf1a)[_0x4a7c('0x26')](function(_0x2968a0){return _0x2968a0;});}return null;};}function removeEntity(_0x33aefe,_0x277c53){return function(_0x2278b1){if(_0x2278b1){return _0x2278b1['destroy']()[_0x4a7c('0x26')](function(){_0x33aefe[_0x4a7c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a06a,_0x70ddb3){return function(_0x5dc3f6){if(!_0x5dc3f6){_0x39a06a[_0x4a7c('0x1a')](0x194);}return _0x5dc3f6;};}function handleError(_0x3ddb54,_0xe3e136){_0xe3e136=_0xe3e136||0x1f4;return function(_0x5b4535){logger[_0x4a7c('0x27')](_0x5b4535[_0x4a7c('0x28')]);if(_0x5b4535[_0x4a7c('0x29')]){delete _0x5b4535[_0x4a7c('0x29')];}_0x3ddb54[_0x4a7c('0x1b')](_0xe3e136)[_0x4a7c('0x2a')](_0x5b4535);};}exports['index']=function(_0x2b1b28,_0x54b07d){var _0x210817={},_0x5dcb2e={},_0x1028a4={'count':0x0,'rows':[]};var _0x43d743=_[_0x4a7c('0x2b')](db[_0x4a7c('0x2c')][_0x4a7c('0x2d')],function(_0x3057cb){return{'name':_0x3057cb[_0x4a7c('0x2e')],'type':_0x3057cb[_0x4a7c('0x2f')][_0x4a7c('0x30')]};});_0x5dcb2e[_0x4a7c('0x31')]=_[_0x4a7c('0x2b')](_0x43d743,_0x4a7c('0x29'));_0x5dcb2e[_0x4a7c('0x32')]=_[_0x4a7c('0x33')](_0x2b1b28[_0x4a7c('0x32')]);_0x5dcb2e[_0x4a7c('0x34')]=_[_0x4a7c('0x35')](_0x5dcb2e[_0x4a7c('0x31')],_0x5dcb2e[_0x4a7c('0x32')]);_0x210817['attributes']=_['intersection'](_0x5dcb2e['model'],qs['fields'](_0x2b1b28['query']['fields']));_0x210817[_0x4a7c('0x36')]=_0x210817[_0x4a7c('0x36')][_0x4a7c('0x37')]?_0x210817[_0x4a7c('0x36')]:_0x5dcb2e[_0x4a7c('0x31')];if(!_0x2b1b28[_0x4a7c('0x32')][_0x4a7c('0x38')](_0x4a7c('0x39'))){_0x210817[_0x4a7c('0x3a')]=qs['limit'](_0x2b1b28['query']['limit']);_0x210817[_0x4a7c('0x1e')]=qs[_0x4a7c('0x1e')](_0x2b1b28[_0x4a7c('0x32')][_0x4a7c('0x1e')]);}_0x210817[_0x4a7c('0x3b')]=qs[_0x4a7c('0x3c')](_0x2b1b28[_0x4a7c('0x32')][_0x4a7c('0x3c')]);_0x210817[_0x4a7c('0x3d')]=qs[_0x4a7c('0x34')](_[_0x4a7c('0x3e')](_0x2b1b28[_0x4a7c('0x32')],_0x5dcb2e['filters']),_0x43d743);if(_0x2b1b28[_0x4a7c('0x32')]['filter']){_0x210817['where']=_[_0x4a7c('0x3f')](_0x210817[_0x4a7c('0x3d')],{'$or':_[_0x4a7c('0x2b')](_0x43d743,function(_0x39f22b){if(_0x39f22b['type']!==_0x4a7c('0x40')){var _0x23e611={};_0x23e611[_0x39f22b[_0x4a7c('0x29')]]={'$like':'%'+_0x2b1b28[_0x4a7c('0x32')][_0x4a7c('0x41')]+'%'};return _0x23e611;}})});}_0x210817=_[_0x4a7c('0x3f')]({},_0x210817,_0x2b1b28['options']);var _0x45652a={'where':_0x210817[_0x4a7c('0x3d')]};return db[_0x4a7c('0x2c')][_0x4a7c('0x20')](_0x45652a)[_0x4a7c('0x26')](function(_0x69f34e){_0x1028a4[_0x4a7c('0x20')]=_0x69f34e;if(_0x2b1b28[_0x4a7c('0x32')][_0x4a7c('0x42')]){_0x210817[_0x4a7c('0x43')]=[{'all':!![]}];}return db[_0x4a7c('0x2c')][_0x4a7c('0x44')](_0x210817);})[_0x4a7c('0x26')](function(_0x38ac1e){_0x1028a4['rows']=_0x38ac1e;return _0x1028a4;})[_0x4a7c('0x26')](respondWithFilteredResult(_0x54b07d,_0x210817))[_0x4a7c('0x45')](handleError(_0x54b07d,null));};exports['show']=function(_0x5dd955,_0x265c75){var _0x5288c3={'raw':!![],'where':{'id':_0x5dd955[_0x4a7c('0x46')]['id']}},_0x206192={};_0x206192[_0x4a7c('0x31')]=_[_0x4a7c('0x33')](db[_0x4a7c('0x2c')][_0x4a7c('0x2d')]);_0x206192[_0x4a7c('0x32')]=_['keys'](_0x5dd955[_0x4a7c('0x32')]);_0x206192[_0x4a7c('0x34')]=_[_0x4a7c('0x35')](_0x206192['model'],_0x206192[_0x4a7c('0x32')]);_0x5288c3[_0x4a7c('0x36')]=_[_0x4a7c('0x35')](_0x206192[_0x4a7c('0x31')],qs['fields'](_0x5dd955[_0x4a7c('0x32')][_0x4a7c('0x47')]));_0x5288c3[_0x4a7c('0x36')]=_0x5288c3['attributes']['length']?_0x5288c3[_0x4a7c('0x36')]:_0x206192['model'];if(_0x5dd955['query']['includeAll']){_0x5288c3['include']=[{'all':!![]}];}_0x5288c3=_[_0x4a7c('0x3f')]({},_0x5288c3,_0x5dd955[_0x4a7c('0x48')]);return db['Attachment'][_0x4a7c('0x49')](_0x5288c3)[_0x4a7c('0x26')](handleEntityNotFound(_0x265c75,null))[_0x4a7c('0x26')](respondWithResult(_0x265c75,null))[_0x4a7c('0x45')](handleError(_0x265c75,null));};exports[_0x4a7c('0x4a')]=function(_0x10ae40,_0x4ef1b4){var _0x2dc01d={'where':{'id':_0x10ae40[_0x4a7c('0x46')]['id']}},_0x1cc515={};_0x1cc515[_0x4a7c('0x31')]=_[_0x4a7c('0x33')](db[_0x4a7c('0x2c')][_0x4a7c('0x2d')]);_0x2dc01d[_0x4a7c('0x36')]=_[_0x4a7c('0x35')](_0x1cc515[_0x4a7c('0x31')],qs[_0x4a7c('0x47')](_0x10ae40[_0x4a7c('0x32')][_0x4a7c('0x47')]));_0x2dc01d[_0x4a7c('0x36')]=_0x2dc01d[_0x4a7c('0x36')][_0x4a7c('0x37')]?_0x2dc01d[_0x4a7c('0x36')]:_0x1cc515['model'];if(_0x10ae40[_0x4a7c('0x32')]['includeAll']){_0x2dc01d[_0x4a7c('0x43')]=[{'all':!![]}];}_0x2dc01d=_[_0x4a7c('0x3f')]({},_0x2dc01d,_0x10ae40['options']);return db['Attachment'][_0x4a7c('0x49')](_0x2dc01d)['then'](handleEntityNotFound(_0x4ef1b4,null))[_0x4a7c('0x26')](function(_0x1d9536){if(_0x1d9536){var _0x134567=_0x1d9536[_0x4a7c('0x4b')]({'plain':!![]});_0x134567=qs[_0x4a7c('0x4c')](_0x134567,['id',_0x4a7c('0x4d'),_0x4a7c('0x4e')]);_0x10ae40[_0x4a7c('0x4f')]=_['omit'](_0x10ae40[_0x4a7c('0x4f')],['id','createdAt','updatedAt']);return db[_0x4a7c('0x2c')][_0x4a7c('0x50')](_[_0x4a7c('0x3f')](_0x134567,_0x10ae40[_0x4a7c('0x4f')]),{'include':_0x10ae40[_0x4a7c('0x32')][_0x4a7c('0x42')]?[{'all':!![]}]:undefined});}})[_0x4a7c('0x26')](respondWithResult(_0x4ef1b4,0xc9))['catch'](handleError(_0x4ef1b4,null));};exports[_0x4a7c('0x25')]=function(_0x1b063d,_0x286cd5){if(_0x1b063d[_0x4a7c('0x4f')]['id']){delete _0x1b063d['body']['id'];}return db[_0x4a7c('0x2c')][_0x4a7c('0x49')]({'where':{'id':_0x1b063d['params']['id']}})[_0x4a7c('0x26')](handleEntityNotFound(_0x286cd5,null))[_0x4a7c('0x26')](saveUpdates(_0x1b063d[_0x4a7c('0x4f')],null))[_0x4a7c('0x26')](respondWithResult(_0x286cd5,null))['catch'](handleError(_0x286cd5,null));};exports['destroy']=function(_0x21e756,_0x26f54e){return db[_0x4a7c('0x2c')][_0x4a7c('0x49')]({'where':{'id':_0x21e756[_0x4a7c('0x46')]['id']}})[_0x4a7c('0x26')](handleEntityNotFound(_0x26f54e,null))['then'](removeEntity(_0x26f54e,null))['catch'](handleError(_0x26f54e,null));};exports['create']=function(_0x243ec5,_0x15ebbc,_0x2c05c0){_0x243ec5['body']['name']=_0x243ec5['file'][_0x4a7c('0x51')];_0x243ec5[_0x4a7c('0x4f')]['basename']=_0x243ec5[_0x4a7c('0x52')]['filename'];_0x243ec5['body'][_0x4a7c('0x2f')]=_0x243ec5[_0x4a7c('0x52')][_0x4a7c('0x53')];return db[_0x4a7c('0x2c')]['create'](_0x243ec5[_0x4a7c('0x4f')])[_0x4a7c('0x26')](respondWithResult(_0x15ebbc,0xc9))[_0x4a7c('0x45')](handleError(_0x15ebbc,null));};exports['download']=function(_0x5f57e5,_0x301215,_0x239972){return db[_0x4a7c('0x2c')]['findOne']({'where':{'id':_0x5f57e5[_0x4a7c('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x301215,null))['then'](function(_0x6d71e8){if(_0x6d71e8){var _0x12d972=_0x6d71e8[_0x4a7c('0x54')]!==null;var _0x254056=path['join'](config['root'],_0x4a7c('0x55'));if(_0x12d972){_0x254056=path[_0x4a7c('0x56')](_0x254056,'offline-chat/');}var _0x24468a=path[_0x4a7c('0x56')](_0x254056,_0x6d71e8['basename']);return _0x301215[_0x4a7c('0x57')](_0x24468a);}})['catch'](handleError(_0x301215,null));}; \ No newline at end of file +var _0x7b5a=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','mimetype','download','findOne','join','root','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7b5a,0xf6));var _0xa7b5=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x7b5a[_0x30a31e];return _0x170879;};'use strict';var emlformat=require(_0xa7b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7b5('0x2'));var moment=require(_0xa7b5('0x3'));var BPromise=require(_0xa7b5('0x4'));var Mustache=require(_0xa7b5('0x5'));var util=require(_0xa7b5('0x6'));var path=require('path');var sox=require(_0xa7b5('0x7'));var csv=require(_0xa7b5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7b5('0x9'));var _=require(_0xa7b5('0xa'));var squel=require(_0xa7b5('0xb'));var crypto=require(_0xa7b5('0xc'));var jsforce=require(_0xa7b5('0xd'));var deskjs=require(_0xa7b5('0xe'));var toCsv=require(_0xa7b5('0x8'));var querystring=require(_0xa7b5('0xf'));var Papa=require('papaparse');var Redis=require(_0xa7b5('0x10'));var authService=require(_0xa7b5('0x11'));var qs=require(_0xa7b5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7b5('0x13'));var logger=require(_0xa7b5('0x14'))(_0xa7b5('0x15'));var utils=require('../../config/utils');var config=require(_0xa7b5('0x16'));var licenseUtil=require(_0xa7b5('0x17'));var db=require(_0xa7b5('0x18'))['db'];function respondWithStatusCode(_0x2f2539,_0x4ec15c){_0x4ec15c=_0x4ec15c||0xcc;return function(_0x31b90b){if(_0x31b90b){return _0x2f2539[_0xa7b5('0x19')](_0x4ec15c);}return _0x2f2539['status'](_0x4ec15c)[_0xa7b5('0x1a')]();};}function respondWithResult(_0x12180e,_0x49ef62){_0x49ef62=_0x49ef62||0xc8;return function(_0x441be2){if(_0x441be2){return _0x12180e[_0xa7b5('0x1b')](_0x49ef62)['json'](_0x441be2);}};}function respondWithFilteredResult(_0x1dd47c,_0x246ed8){return function(_0x49a447){if(_0x49a447){var _0x1ba6aa=typeof _0x246ed8[_0xa7b5('0x1c')]===_0xa7b5('0x1d')&&typeof _0x246ed8['limit']===_0xa7b5('0x1d');var _0x1accad=_0x49a447[_0xa7b5('0x1e')];var _0x46fbe4=_0x1ba6aa?0x0:_0x246ed8[_0xa7b5('0x1c')];var _0x42fb0e=_0x1ba6aa?_0x49a447['count']:_0x246ed8[_0xa7b5('0x1c')]+_0x246ed8[_0xa7b5('0x1f')];var _0x206e2c;if(_0x42fb0e>=_0x1accad){_0x42fb0e=_0x1accad;_0x206e2c=0xc8;}else{_0x206e2c=0xce;}_0x1dd47c[_0xa7b5('0x1b')](_0x206e2c);return _0x1dd47c[_0xa7b5('0x20')](_0xa7b5('0x21'),_0x46fbe4+'-'+_0x42fb0e+'/'+_0x1accad)['json'](_0x49a447);}return null;};}function patchUpdates(_0x4d177a){return function(_0x50122d){try{jsonpatch['apply'](_0x50122d,_0x4d177a,!![]);}catch(_0x493bd7){return BPromise['reject'](_0x493bd7);}return _0x50122d[_0xa7b5('0x22')]();};}function saveUpdates(_0x324d5d,_0x3f63ac){return function(_0x5c4c8a){if(_0x5c4c8a){return _0x5c4c8a[_0xa7b5('0x23')](_0x324d5d)[_0xa7b5('0x24')](function(_0x1530c4){return _0x1530c4;});}return null;};}function removeEntity(_0x14b34d,_0xde5042){return function(_0x51f7a6){if(_0x51f7a6){return _0x51f7a6[_0xa7b5('0x25')]()[_0xa7b5('0x24')](function(){_0x14b34d[_0xa7b5('0x1b')](0xcc)[_0xa7b5('0x1a')]();});}};}function handleEntityNotFound(_0x2307c8,_0x119bcc){return function(_0x5fe7c7){if(!_0x5fe7c7){_0x2307c8[_0xa7b5('0x19')](0x194);}return _0x5fe7c7;};}function handleError(_0x23646c,_0x16bfec){_0x16bfec=_0x16bfec||0x1f4;return function(_0x2f6edb){logger[_0xa7b5('0x26')](_0x2f6edb[_0xa7b5('0x27')]);if(_0x2f6edb[_0xa7b5('0x28')]){delete _0x2f6edb[_0xa7b5('0x28')];}_0x23646c[_0xa7b5('0x1b')](_0x16bfec)[_0xa7b5('0x29')](_0x2f6edb);};}exports[_0xa7b5('0x2a')]=function(_0x7127b9,_0x597b37){var _0x25a54c={},_0x5d18ed={},_0x2473f4={'count':0x0,'rows':[]};var _0x1ec6b6=_[_0xa7b5('0x2b')](db[_0xa7b5('0x2c')][_0xa7b5('0x2d')],function(_0x1f764d){return{'name':_0x1f764d[_0xa7b5('0x2e')],'type':_0x1f764d[_0xa7b5('0x2f')][_0xa7b5('0x30')]};});_0x5d18ed['model']=_[_0xa7b5('0x2b')](_0x1ec6b6,_0xa7b5('0x28'));_0x5d18ed['query']=_['keys'](_0x7127b9[_0xa7b5('0x31')]);_0x5d18ed[_0xa7b5('0x32')]=_[_0xa7b5('0x33')](_0x5d18ed[_0xa7b5('0x34')],_0x5d18ed['query']);_0x25a54c[_0xa7b5('0x35')]=_['intersection'](_0x5d18ed[_0xa7b5('0x34')],qs[_0xa7b5('0x36')](_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x36')]));_0x25a54c[_0xa7b5('0x35')]=_0x25a54c[_0xa7b5('0x35')][_0xa7b5('0x37')]?_0x25a54c['attributes']:_0x5d18ed[_0xa7b5('0x34')];if(!_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x38')](_0xa7b5('0x39'))){_0x25a54c[_0xa7b5('0x1f')]=qs[_0xa7b5('0x1f')](_0x7127b9['query']['limit']);_0x25a54c[_0xa7b5('0x1c')]=qs['offset'](_0x7127b9[_0xa7b5('0x31')]['offset']);}_0x25a54c['order']=qs[_0xa7b5('0x3a')](_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x3a')]);_0x25a54c[_0xa7b5('0x3b')]=qs['filters'](_[_0xa7b5('0x3c')](_0x7127b9[_0xa7b5('0x31')],_0x5d18ed['filters']),_0x1ec6b6);if(_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x3d')]){_0x25a54c['where']=_[_0xa7b5('0x3e')](_0x25a54c[_0xa7b5('0x3b')],{'$or':_['map'](_0x1ec6b6,function(_0x3392d8){if(_0x3392d8['type']!==_0xa7b5('0x3f')){var _0x87486c={};_0x87486c[_0x3392d8['name']]={'$like':'%'+_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x3d')]+'%'};return _0x87486c;}})});}_0x25a54c=_['merge']({},_0x25a54c,_0x7127b9['options']);var _0x46dd0c={'where':_0x25a54c[_0xa7b5('0x3b')]};return db[_0xa7b5('0x2c')]['count'](_0x46dd0c)['then'](function(_0xb85536){_0x2473f4['count']=_0xb85536;if(_0x7127b9[_0xa7b5('0x31')][_0xa7b5('0x40')]){_0x25a54c[_0xa7b5('0x41')]=[{'all':!![]}];}return db[_0xa7b5('0x2c')]['findAll'](_0x25a54c);})[_0xa7b5('0x24')](function(_0x1a4d54){_0x2473f4[_0xa7b5('0x42')]=_0x1a4d54;return _0x2473f4;})[_0xa7b5('0x24')](respondWithFilteredResult(_0x597b37,_0x25a54c))[_0xa7b5('0x43')](handleError(_0x597b37,null));};exports[_0xa7b5('0x44')]=function(_0x48596c,_0x3dca6c){var _0x2770f4={'raw':!![],'where':{'id':_0x48596c[_0xa7b5('0x45')]['id']}},_0x5e409a={};_0x5e409a[_0xa7b5('0x34')]=_[_0xa7b5('0x46')](db[_0xa7b5('0x2c')][_0xa7b5('0x2d')]);_0x5e409a['query']=_['keys'](_0x48596c[_0xa7b5('0x31')]);_0x5e409a[_0xa7b5('0x32')]=_[_0xa7b5('0x33')](_0x5e409a[_0xa7b5('0x34')],_0x5e409a[_0xa7b5('0x31')]);_0x2770f4[_0xa7b5('0x35')]=_[_0xa7b5('0x33')](_0x5e409a['model'],qs[_0xa7b5('0x36')](_0x48596c['query'][_0xa7b5('0x36')]));_0x2770f4[_0xa7b5('0x35')]=_0x2770f4[_0xa7b5('0x35')][_0xa7b5('0x37')]?_0x2770f4['attributes']:_0x5e409a[_0xa7b5('0x34')];if(_0x48596c[_0xa7b5('0x31')][_0xa7b5('0x40')]){_0x2770f4[_0xa7b5('0x41')]=[{'all':!![]}];}_0x2770f4=_[_0xa7b5('0x3e')]({},_0x2770f4,_0x48596c[_0xa7b5('0x47')]);return db['Attachment'][_0xa7b5('0x48')](_0x2770f4)[_0xa7b5('0x24')](handleEntityNotFound(_0x3dca6c,null))[_0xa7b5('0x24')](respondWithResult(_0x3dca6c,null))['catch'](handleError(_0x3dca6c,null));};exports['clone']=function(_0x2c0144,_0xc30027){var _0x5237e4={'where':{'id':_0x2c0144['params']['id']}},_0x100d5d={};_0x100d5d[_0xa7b5('0x34')]=_[_0xa7b5('0x46')](db['Attachment'][_0xa7b5('0x2d')]);_0x5237e4[_0xa7b5('0x35')]=_[_0xa7b5('0x33')](_0x100d5d['model'],qs[_0xa7b5('0x36')](_0x2c0144[_0xa7b5('0x31')][_0xa7b5('0x36')]));_0x5237e4[_0xa7b5('0x35')]=_0x5237e4[_0xa7b5('0x35')][_0xa7b5('0x37')]?_0x5237e4[_0xa7b5('0x35')]:_0x100d5d['model'];if(_0x2c0144[_0xa7b5('0x31')][_0xa7b5('0x40')]){_0x5237e4[_0xa7b5('0x41')]=[{'all':!![]}];}_0x5237e4=_[_0xa7b5('0x3e')]({},_0x5237e4,_0x2c0144[_0xa7b5('0x47')]);return db[_0xa7b5('0x2c')][_0xa7b5('0x48')](_0x5237e4)[_0xa7b5('0x24')](handleEntityNotFound(_0xc30027,null))[_0xa7b5('0x24')](function(_0x12949a){if(_0x12949a){var _0x5b1e30=_0x12949a[_0xa7b5('0x49')]({'plain':!![]});_0x5b1e30=qs[_0xa7b5('0x4a')](_0x5b1e30,['id',_0xa7b5('0x4b'),_0xa7b5('0x4c')]);_0x2c0144[_0xa7b5('0x4d')]=_[_0xa7b5('0x4a')](_0x2c0144[_0xa7b5('0x4d')],['id',_0xa7b5('0x4b'),_0xa7b5('0x4c')]);return db[_0xa7b5('0x2c')][_0xa7b5('0x4e')](_[_0xa7b5('0x3e')](_0x5b1e30,_0x2c0144[_0xa7b5('0x4d')]),{'include':_0x2c0144[_0xa7b5('0x31')][_0xa7b5('0x40')]?[{'all':!![]}]:undefined});}})[_0xa7b5('0x24')](respondWithResult(_0xc30027,0xc9))[_0xa7b5('0x43')](handleError(_0xc30027,null));};exports['update']=function(_0x428fd4,_0x540c1c){if(_0x428fd4[_0xa7b5('0x4d')]['id']){delete _0x428fd4[_0xa7b5('0x4d')]['id'];}return db['Attachment']['find']({'where':{'id':_0x428fd4[_0xa7b5('0x45')]['id']}})[_0xa7b5('0x24')](handleEntityNotFound(_0x540c1c,null))['then'](saveUpdates(_0x428fd4[_0xa7b5('0x4d')],null))[_0xa7b5('0x24')](respondWithResult(_0x540c1c,null))[_0xa7b5('0x43')](handleError(_0x540c1c,null));};exports[_0xa7b5('0x25')]=function(_0x2a1683,_0x2b0431){return db['Attachment']['find']({'where':{'id':_0x2a1683[_0xa7b5('0x45')]['id']}})[_0xa7b5('0x24')](handleEntityNotFound(_0x2b0431,null))[_0xa7b5('0x24')](removeEntity(_0x2b0431,null))[_0xa7b5('0x43')](handleError(_0x2b0431,null));};exports['create']=function(_0xc6f412,_0x1ef939,_0x55a819){_0xc6f412['body'][_0xa7b5('0x28')]=_0xc6f412['file'][_0xa7b5('0x4f')];_0xc6f412[_0xa7b5('0x4d')][_0xa7b5('0x50')]=_0xc6f412[_0xa7b5('0x51')]['filename'];_0xc6f412[_0xa7b5('0x4d')]['type']=_0xc6f412[_0xa7b5('0x51')][_0xa7b5('0x52')];return db['Attachment']['create'](_0xc6f412[_0xa7b5('0x4d')])[_0xa7b5('0x24')](respondWithResult(_0x1ef939,0xc9))['catch'](handleError(_0x1ef939,null));};exports[_0xa7b5('0x53')]=function(_0x3935c2,_0x4587fb,_0x8c9b39){return db[_0xa7b5('0x2c')][_0xa7b5('0x54')]({'where':{'id':_0x3935c2[_0xa7b5('0x45')]['id']},'raw':!![]})[_0xa7b5('0x24')](handleEntityNotFound(_0x4587fb,null))[_0xa7b5('0x24')](function(_0x6067c4){if(_0x6067c4){var _0x2361c8=_0x6067c4['ChatOfflineMessageId']!==null;var _0x561b8c=path[_0xa7b5('0x55')](config[_0xa7b5('0x56')],'server/files/attachments/');if(_0x2361c8){_0x561b8c=path[_0xa7b5('0x55')](_0x561b8c,'offline-chat/');}var _0x2ef73d=path[_0xa7b5('0x55')](_0x561b8c,_0x6067c4[_0xa7b5('0x50')]);return _0x4587fb[_0xa7b5('0x53')](_0x2ef73d);}})[_0xa7b5('0x43')](handleError(_0x4587fb,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c5eb2bc..532ac3b 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 _0xc0b8=['bluebird','path','rimraf','../../config/environment','./attachment.attributes','Attachment','attachments','lodash','util','../../config/logger','api','moment'];(function(_0x3a6ec0,_0x39220a){var _0x336102=function(_0x496e14){while(--_0x496e14){_0x3a6ec0['push'](_0x3a6ec0['shift']());}};_0x336102(++_0x39220a);}(_0xc0b8,0x1f3));var _0x8c0b=function(_0x3a27cb,_0x361775){_0x3a27cb=_0x3a27cb-0x0;var _0x3aa498=_0xc0b8[_0x3a27cb];return _0x3aa498;};'use strict';var _=require(_0x8c0b('0x0'));var util=require(_0x8c0b('0x1'));var logger=require(_0x8c0b('0x2'))(_0x8c0b('0x3'));var moment=require(_0x8c0b('0x4'));var BPromise=require(_0x8c0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c0b('0x6'));var rimraf=require(_0x8c0b('0x7'));var config=require(_0x8c0b('0x8'));var attributes=require(_0x8c0b('0x9'));module['exports']=function(_0x493937,_0x913fc9){return _0x493937['define'](_0x8c0b('0xa'),attributes,{'tableName':_0x8c0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a51=['attachments','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','Attachment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6a51,0xe7));var _0x16a5=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x6a51[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0x16a5('0x0'));var util=require(_0x16a5('0x1'));var logger=require('../../config/logger')(_0x16a5('0x2'));var moment=require(_0x16a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x16a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16a5('0x5'));var config=require(_0x16a5('0x6'));var attributes=require('./attachment.attributes');module[_0x16a5('0x7')]=function(_0x2031c1,_0x361cd7){return _0x2031c1['define'](_0x16a5('0x8'),attributes,{'tableName':_0x16a5('0x9'),'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 bc2cad4..9170477 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 _0x1094=['create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment'];(function(_0x398256,_0x4e19cc){var _0x4af8a9=function(_0x1b497c){while(--_0x1b497c){_0x398256['push'](_0x398256['shift']());}};_0x4af8a9(++_0x4e19cc);}(_0x1094,0x143));var _0x4109=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x1094[_0x5c1345];return _0x1c070d;};'use strict';var _=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var moment=require('moment');var BPromise=require(_0x4109('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4109('0x3'));var db=require(_0x4109('0x4'))['db'];var utils=require(_0x4109('0x5'));var logger=require(_0x4109('0x6'))(_0x4109('0x7'));var config=require('../../config/environment');var jayson=require(_0x4109('0x8'));var client=jayson[_0x4109('0x9')][_0x4109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c3e9,_0xd2df16,_0x2c34f){return new BPromise(function(_0x5512e8,_0x5b4ecf){return client[_0x4109('0xb')](_0x36c3e9,_0x2c34f)[_0x4109('0xc')](function(_0x2fa1d8){logger[_0x4109('0xd')]('Attachment,\x20%s,\x20%s',_0xd2df16,'request\x20sent');logger[_0x4109('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0xd2df16,_0x4109('0xf'),JSON[_0x4109('0x10')](_0x2fa1d8));if(_0x2fa1d8[_0x4109('0x11')]){if(_0x2fa1d8['error'][_0x4109('0x12')]===0x1f4){logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')][_0x4109('0x14')]);return _0x5b4ecf(_0x2fa1d8['error'][_0x4109('0x14')]);}logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')]['message']);return _0x5512e8(_0x2fa1d8['error'][_0x4109('0x14')]);}else{logger[_0x4109('0xd')](_0x4109('0x13'),_0xd2df16,_0x4109('0xf'));_0x5512e8(_0x2fa1d8[_0x4109('0x15')][_0x4109('0x14')]);}})[_0x4109('0x16')](function(_0x3c6542){logger['error']('Attachment,\x20%s,\x20%s',_0xd2df16,_0x3c6542);_0x5b4ecf(_0x3c6542);});});}exports[_0x4109('0x17')]=function(_0x328f1c){var _0x6945ae=this;return new Promise(function(_0x2e3fd6,_0x415e48){return db[_0x4109('0x18')][_0x4109('0x19')](_0x328f1c[_0x4109('0x1a')],{'raw':_0x328f1c[_0x4109('0x1b')]?_0x328f1c['options'][_0x4109('0x1c')]===undefined?!![]:![]:!![]})[_0x4109('0xc')](function(_0x5cde5d){logger[_0x4109('0xd')](_0x4109('0x17'),_0x328f1c);logger['debug']('CreateAttachment',_0x328f1c,JSON[_0x4109('0x10')](_0x5cde5d));_0x2e3fd6(_0x5cde5d);})['catch'](function(_0x369de0){logger[_0x4109('0x11')](_0x4109('0x17'),_0x369de0[_0x4109('0x14')],_0x328f1c);_0x415e48(_0x6945ae['error'](0x1f4,_0x369de0[_0x4109('0x14')]));});});}; \ No newline at end of file +var _0xd246=['../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x575d0,_0x45eb69){var _0x1a6e7b=function(_0x16d607){while(--_0x16d607){_0x575d0['push'](_0x575d0['shift']());}};_0x1a6e7b(++_0x45eb69);}(_0xd246,0xf5));var _0x6d24=function(_0x4f8722,_0x47e4ae){_0x4f8722=_0x4f8722-0x0;var _0x1430eb=_0xd246[_0x4f8722];return _0x1430eb;};'use strict';var _=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var moment=require(_0x6d24('0x2'));var BPromise=require(_0x6d24('0x3'));var rs=require(_0x6d24('0x4'));var fs=require('fs');var Redis=require(_0x6d24('0x5'));var db=require(_0x6d24('0x6'))['db'];var utils=require(_0x6d24('0x7'));var logger=require('../../config/logger')(_0x6d24('0x8'));var config=require('../../config/environment');var jayson=require(_0x6d24('0x9'));var client=jayson['client'][_0x6d24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7f6dfa,_0x1dcaa2,_0x358a65){return new BPromise(function(_0x38e1eb,_0x43500f){return client[_0x6d24('0xb')](_0x7f6dfa,_0x358a65)['then'](function(_0x5a05d3){logger[_0x6d24('0xc')]('Attachment,\x20%s,\x20%s',_0x1dcaa2,_0x6d24('0xd'));logger['debug'](_0x6d24('0xe'),_0x1dcaa2,'request\x20sent',JSON[_0x6d24('0xf')](_0x5a05d3));if(_0x5a05d3[_0x6d24('0x10')]){if(_0x5a05d3['error'][_0x6d24('0x11')]===0x1f4){logger['error'](_0x6d24('0x12'),_0x1dcaa2,_0x5a05d3[_0x6d24('0x10')]['message']);return _0x43500f(_0x5a05d3['error']['message']);}logger[_0x6d24('0x10')](_0x6d24('0x12'),_0x1dcaa2,_0x5a05d3[_0x6d24('0x10')][_0x6d24('0x13')]);return _0x38e1eb(_0x5a05d3['error']['message']);}else{logger[_0x6d24('0xc')](_0x6d24('0x12'),_0x1dcaa2,_0x6d24('0xd'));_0x38e1eb(_0x5a05d3['result']['message']);}})[_0x6d24('0x14')](function(_0x336aeb){logger[_0x6d24('0x10')](_0x6d24('0x12'),_0x1dcaa2,_0x336aeb);_0x43500f(_0x336aeb);});});}exports[_0x6d24('0x15')]=function(_0xad7d02){var _0x49a269=this;return new Promise(function(_0x5b81b4,_0x430b55){return db[_0x6d24('0x16')][_0x6d24('0x17')](_0xad7d02['body'],{'raw':_0xad7d02[_0x6d24('0x18')]?_0xad7d02[_0x6d24('0x18')][_0x6d24('0x19')]===undefined?!![]:![]:!![]})[_0x6d24('0x1a')](function(_0x359430){logger['info'](_0x6d24('0x15'),_0xad7d02);logger[_0x6d24('0x1b')]('CreateAttachment',_0xad7d02,JSON[_0x6d24('0xf')](_0x359430));_0x5b81b4(_0x359430);})['catch'](function(_0xca50d5){logger[_0x6d24('0x10')](_0x6d24('0x15'),_0xca50d5[_0x6d24('0x13')],_0xad7d02);_0x430b55(_0x49a269[_0x6d24('0x10')](0x1f4,_0xca50d5[_0x6d24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 874361e..d12f2a8 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(_0x45e329,_0x29482f){var _0x31282b=function(_0x4e6609){while(--_0x4e6609){_0x45e329['push'](_0x45e329['shift']());}};_0x31282b(++_0x29482f);}(_0x757a,0xde));var _0xa757=function(_0x20de4e,_0x468e68){_0x20de4e=_0x20de4e-0x0;var _0x2228d0=_0x757a[_0x20de4e];return _0x2228d0;};'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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3064f0,_0x4eda7f){var _0xde6d31=function(_0x141c41){while(--_0x141c41){_0x3064f0['push'](_0x3064f0['shift']());}};_0xde6d31(++_0x4eda7f);}(_0x2032,0xd9));var _0x2203=function(_0x30a647,_0x4cd2ca){_0x30a647=_0x30a647-0x0;var _0x5c3f7a=_0x2032[_0x30a647];return _0x5c3f7a;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ff46bdb..c832941 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 _0x5f5d=['clearBlockUser','getLicense','catch','status','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport-local','Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','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','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','online','user','agent','add'];(function(_0x4c2e41,_0x5408d7){var _0x57fcc9=function(_0x4d7492){while(--_0x4d7492){_0x4c2e41['push'](_0x4c2e41['shift']());}};_0x57fcc9(++_0x5408d7);}(_0x5f5d,0x15d));var _0xd5f5=function(_0x27b1ba,_0x452e63){_0x27b1ba=_0x27b1ba-0x0;var _0x72679e=_0x5f5d[_0x27b1ba];return _0x72679e;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xd5f5('0x0'))[_0xd5f5('0x1')];var moment=require(_0xd5f5('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xd5f5('0x3'));var util=require('util');var db=require(_0xd5f5('0x4'))['db'];var authService=require(_0xd5f5('0x5'));var utils=require(_0xd5f5('0x6'));var config=require(_0xd5f5('0x7'));var logger=require(_0xd5f5('0x8'))(_0xd5f5('0x9'));function isActiveDirectoryConfigured(_0x2a8647){var _0xe3f28a=![];if(typeof _0x2a8647[_0xd5f5('0xa')]!=='undefined'){_0xe3f28a=_0x2a8647[_0xd5f5('0xa')][_0xd5f5('0xb')]&&_0x2a8647[_0xd5f5('0xa')][_0xd5f5('0xc')]&&_0x2a8647[_0xd5f5('0xa')][_0xd5f5('0xd')];}return _0xe3f28a;}function adAuthenticate(_0x417340,_0x1a078d,_0x175b56){return new BPromise(function(_0x34598f,_0x2faf52){try{var _0x1be92b=new ActiveDirectory(_0x417340);_0x1be92b['authenticate'](_0x1a078d,_0x175b56,function(_0x41cef6,_0x4141c3){if(_0x41cef6){logger[_0xd5f5('0xe')](_0xd5f5('0xf'),_0x1a078d,util[_0xd5f5('0x10')](_0x41cef6,{'showHidden':![],'depth':null}));_0x2faf52(_0xd5f5('0x11'));}else if(!_0x4141c3){logger[_0xd5f5('0xe')](_0xd5f5('0x12'),_0x1a078d);_0x2faf52('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x34598f(_0x4141c3);}});}catch(_0x26f3be){_0x2faf52(_0x26f3be);}});}function ActiveDirectoryAuthenticate(_0x4de0e9,_0x85cc4b,_0x5aa485,_0x387fd7){var _0x213239,_0x3d9a3e;if(!isActiveDirectoryConfigured(config)){logger[_0xd5f5('0xe')](_0xd5f5('0x13'),_0x85cc4b);return _0x387fd7(null,![],{'message':_0xd5f5('0x11')});}return db['Setting'][_0xd5f5('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd5f5('0x15')],'raw':!![]})[_0xd5f5('0x16')](function(_0x49e266){_0x213239=_0x49e266;if(!_0x213239[_0xd5f5('0x17')]){logger[_0xd5f5('0xe')](_0xd5f5('0x18'),_0x85cc4b);throw new Error(_0xd5f5('0x11'));}return _0x4de0e9[_0xd5f5('0x14')]({'attributes':['id',_0xd5f5('0x19'),'password',_0xd5f5('0x1a'),_0xd5f5('0x1b'),_0xd5f5('0x1c'),_0xd5f5('0x1d'),_0xd5f5('0x1e'),_0xd5f5('0x1f')],'where':{'name':_0x85cc4b,'role':{'$or':['admin',_0xd5f5('0x20'),_0xd5f5('0x21')]},'adSsoEnabled':!![]}});})[_0xd5f5('0x16')](function(_0x10848a){if(!_0x10848a||_0x10848a&&_0x10848a[_0xd5f5('0x19')]!==_0x85cc4b){throw new Error(_0xd5f5('0x11'));}_0x3d9a3e=_0x10848a;var _0x4b14e4=_0x3d9a3e[_0xd5f5('0x19')]+'@'+config[_0xd5f5('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x4b14e4,_0x5aa485);})['then'](function(_0x12ebd8){if(_0x3d9a3e[_0xd5f5('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x213239[_0xd5f5('0x15')]>0x0){if(_0x3d9a3e[_0xd5f5('0x1d')]){if(moment(_0x3d9a3e['blockedAt'])[_0xd5f5('0x22')](_0x213239[_0xd5f5('0x15')],'minutes')>moment()){throw new Error(_0xd5f5('0x11'));}return utils[_0xd5f5('0x23')](_0x3d9a3e,0x0,![],null)[_0xd5f5('0x16')](function(){return utils[_0xd5f5('0x24')](_0x3d9a3e);})['then'](function(){return _0x387fd7(null,_0x3d9a3e);});}else{return utils['getLicense'](_0x3d9a3e)['then'](function(){return _0x387fd7(null,_0x3d9a3e);});}}else{return utils['getLicense'](_0x3d9a3e)['then'](function(){return _0x387fd7(null,_0x3d9a3e);});}})[_0xd5f5('0x25')](function(_0x50177b){return _0x387fd7(null,![],_0x50177b);});}function handleError(_0x80a0df,_0x227fcb,_0xdbbf58){return _0x80a0df[_0xd5f5('0x26')](_0x227fcb||0x1f4)[_0xd5f5('0x27')]({'message':_0xdbbf58?_0xdbbf58['message']||_0xdbbf58:''});}exports[_0xd5f5('0x28')]=function(_0x50d2fc,_0x31960a,_0x36ed2f){passport[_0xd5f5('0x29')]('ad-login',function(_0x535f92,_0xe058a9,_0xa7ab60){var _0x5ea408=_0x535f92||_0xa7ab60;if(_0x5ea408){return handleError(_0x31960a,0x191,_0x5ea408);}if(!_0xe058a9){return handleError(_0x31960a,0x194,{'message':_0xd5f5('0x2a')});}else{var _0x433620={'payload':{'id':_0xe058a9['id'],'role':_0xe058a9[_0xd5f5('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xd5f5('0x2b')](_0x433620)[_0xd5f5('0x16')](function(_0x488e6b){_0x31960a[_0xd5f5('0x2c')]({'id':_0xe058a9['id'],'token':_0x488e6b,'statusCall':'','isAlreadyLogged':_0xe058a9[_0xd5f5('0x1f')]});});}})(_0x50d2fc,_0x31960a,_0x36ed2f);};passport[_0xd5f5('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xd5f5('0x19'),'passwordField':_0xd5f5('0x2e')},function(_0x2e7d4d,_0x5e361a,_0x436880){return ActiveDirectoryAuthenticate(db[_0xd5f5('0x2f')],_0x2e7d4d,_0x5e361a,_0x436880);})); \ No newline at end of file +var _0x9da6=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','admin','user','disabled','add','minutes','clearBlockUser','getLicense','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport-local','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xee259c,_0x1d54c2){var _0x1eafb2=function(_0x4bf9c0){while(--_0x4bf9c0){_0xee259c['push'](_0xee259c['shift']());}};_0x1eafb2(++_0x1d54c2);}(_0x9da6,0xa6));var _0x69da=function(_0x18dc14,_0x12e682){_0x18dc14=_0x18dc14-0x0;var _0x3321ae=_0x9da6[_0x18dc14];return _0x3321ae;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x69da('0x0'))['Strategy'];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x69da('0x1'));var db=require(_0x69da('0x2'))['db'];var authService=require(_0x69da('0x3'));var utils=require(_0x69da('0x4'));var config=require('../../config/environment');var logger=require(_0x69da('0x5'))(_0x69da('0x6'));function isActiveDirectoryConfigured(_0xb34092){var _0x126d33=![];if(typeof _0xb34092[_0x69da('0x7')]!=='undefined'){_0x126d33=_0xb34092[_0x69da('0x7')][_0x69da('0x8')]&&_0xb34092['activedirectory'][_0x69da('0x9')]&&_0xb34092[_0x69da('0x7')][_0x69da('0xa')];}return _0x126d33;}function adAuthenticate(_0x2a1707,_0x2a315b,_0x2a1abd){return new BPromise(function(_0xefc810,_0x509b7c){try{var _0x3fab0c=new ActiveDirectory(_0x2a1707);_0x3fab0c['authenticate'](_0x2a315b,_0x2a1abd,function(_0x508111,_0x51d04f){if(_0x508111){logger[_0x69da('0xb')]('Error\x20authenticate\x20%s:\x20%s',_0x2a315b,util[_0x69da('0xc')](_0x508111,{'showHidden':![],'depth':null}));_0x509b7c(_0x69da('0xd'));}else if(!_0x51d04f){logger[_0x69da('0xb')](_0x69da('0xe'),_0x2a315b);_0x509b7c(_0x69da('0xd'));}else{_0xefc810(_0x51d04f);}});}catch(_0x526959){_0x509b7c(_0x526959);}});}function ActiveDirectoryAuthenticate(_0x3dd616,_0x500390,_0x4d9e78,_0x5028da){var _0x27a880,_0x21953d;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x500390);return _0x5028da(null,![],{'message':_0x69da('0xd')});}return db[_0x69da('0xf')][_0x69da('0x10')]({'where':{'id':0x1},'attributes':[_0x69da('0x11'),_0x69da('0x12')],'raw':!![]})[_0x69da('0x13')](function(_0x41b527){_0x27a880=_0x41b527;if(!_0x27a880[_0x69da('0x11')]){logger['error'](_0x69da('0x14'),_0x500390);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3dd616[_0x69da('0x10')]({'attributes':['id',_0x69da('0x15'),_0x69da('0x16'),_0x69da('0x17'),_0x69da('0x18'),'disabled',_0x69da('0x19'),_0x69da('0x1a'),'online'],'where':{'name':_0x500390,'role':{'$or':[_0x69da('0x1b'),_0x69da('0x1c'),'agent']},'adSsoEnabled':!![]}});})[_0x69da('0x13')](function(_0x3d4c23){if(!_0x3d4c23||_0x3d4c23&&_0x3d4c23[_0x69da('0x15')]!==_0x500390){throw new Error(_0x69da('0xd'));}_0x21953d=_0x3d4c23;var _0x18b397=_0x21953d[_0x69da('0x15')]+'@'+config[_0x69da('0x7')][_0x69da('0xa')];return adAuthenticate(config[_0x69da('0x7')],_0x18b397,_0x4d9e78);})[_0x69da('0x13')](function(_0x54d1b0){if(_0x21953d[_0x69da('0x1d')]){throw new Error(_0x69da('0xd'));}if(_0x27a880[_0x69da('0x12')]>0x0){if(_0x21953d[_0x69da('0x19')]){if(moment(_0x21953d[_0x69da('0x1a')])[_0x69da('0x1e')](_0x27a880[_0x69da('0x12')],_0x69da('0x1f'))>moment()){throw new Error(_0x69da('0xd'));}return utils[_0x69da('0x20')](_0x21953d,0x0,![],null)[_0x69da('0x13')](function(){return utils[_0x69da('0x21')](_0x21953d);})[_0x69da('0x13')](function(){return _0x5028da(null,_0x21953d);});}else{return utils[_0x69da('0x21')](_0x21953d)[_0x69da('0x13')](function(){return _0x5028da(null,_0x21953d);});}}else{return utils[_0x69da('0x21')](_0x21953d)[_0x69da('0x13')](function(){return _0x5028da(null,_0x21953d);});}})['catch'](function(_0x5a8d33){return _0x5028da(null,![],_0x5a8d33);});}function handleError(_0x121e2e,_0x4d18b2,_0x3cd856){return _0x121e2e['status'](_0x4d18b2||0x1f4)[_0x69da('0x22')]({'message':_0x3cd856?_0x3cd856[_0x69da('0x23')]||_0x3cd856:''});}exports[_0x69da('0x24')]=function(_0x7081e4,_0x2d08f1,_0x5a5eb3){passport[_0x69da('0x25')](_0x69da('0x26'),function(_0x4ba43d,_0x61eb5,_0xb99e08){var _0x5183ab=_0x4ba43d||_0xb99e08;if(_0x5183ab){return handleError(_0x2d08f1,0x191,_0x5183ab);}if(!_0x61eb5){return handleError(_0x2d08f1,0x194,{'message':_0x69da('0x27')});}else{var _0x652fd9={'payload':{'id':_0x61eb5['id'],'role':_0x61eb5['role']},'options':{'expiresIn':0x15180}};return authService[_0x69da('0x28')](_0x652fd9)[_0x69da('0x13')](function(_0x30b2da){_0x2d08f1[_0x69da('0x29')]({'id':_0x61eb5['id'],'token':_0x30b2da,'statusCall':'','isAlreadyLogged':_0x61eb5[_0x69da('0x2a')]});});}})(_0x7081e4,_0x2d08f1,_0x5a5eb3);};passport[_0x69da('0x2b')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x69da('0x16')},function(_0x57bf23,_0x2f7dd5,_0x5dfc66){return ActiveDirectoryAuthenticate(db[_0x69da('0x2c')],_0x57bf23,_0x2f7dd5,_0x5dfc66);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a25e508..a1f235f 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 _0x20e2=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x177e72,_0x28bf32){var _0x392698=function(_0x45a052){while(--_0x45a052){_0x177e72['push'](_0x177e72['shift']());}};_0x392698(++_0x28bf32);}(_0x20e2,0x1c3));var _0x220e=function(_0x3f4f99,_0x673680){_0x3f4f99=_0x3f4f99-0x0;var _0xde7221=_0x20e2[_0x3f4f99];return _0xde7221;};'use strict';var express=require('express');var router=express[_0x220e('0x0')]();var controller=require(_0x220e('0x1'));router[_0x220e('0x2')]('/',controller[_0x220e('0x3')]);module[_0x220e('0x4')]=router; \ No newline at end of file +var _0xb501=['Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x26505f,_0x3aca29){var _0x3ebdc3=function(_0x11b83d){while(--_0x11b83d){_0x26505f['push'](_0x26505f['shift']());}};_0x3ebdc3(++_0x3aca29);}(_0xb501,0xdc));var _0x1b50=function(_0x58db31,_0x4b4ca2){_0x58db31=_0x58db31-0x0;var _0x5c2c19=_0xb501[_0x58db31];return _0x5c2c19;};'use strict';var express=require('express');var router=express[_0x1b50('0x0')]();var controller=require(_0x1b50('0x1'));router[_0x1b50('0x2')]('/',controller[_0x1b50('0x3')]);module[_0x1b50('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 0dae410..ca219fb 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(_0x1ea92e,_0x3dcf0e){var _0x2afe32=function(_0x3fe338){while(--_0x3fe338){_0x1ea92e['push'](_0x1ea92e['shift']());}};_0x2afe32(++_0x3dcf0e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x169a44,_0x2597e4){_0x169a44=_0x169a44-0x0;var _0x2e02a4=_0x7a54[_0x169a44];return _0x2e02a4;};'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 8343cb6..f3ca627 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 _0x87a4=['/callback','callback','isMiddleware','login','exports','express','passport','../user/user.controller.js','../../components/auth/service'];(function(_0x1d99f1,_0x284c97){var _0x595325=function(_0x41e059){while(--_0x41e059){_0x1d99f1['push'](_0x1d99f1['shift']());}};_0x595325(++_0x284c97);}(_0x87a4,0x12e));var _0x487a=function(_0x1adf0e,_0x3bd542){_0x1adf0e=_0x1adf0e-0x0;var _0x460f14=_0x87a4[_0x1adf0e];return _0x460f14;};'use strict';var express=require(_0x487a('0x0'));var passport=require(_0x487a('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x487a('0x2'));var authService=require(_0x487a('0x3'));router['get']('/',controller['login']);router['get'](_0x487a('0x4'),controller[_0x487a('0x5')],authService[_0x487a('0x6')],userController[_0x487a('0x7')],authService['setTokenCookie']);module[_0x487a('0x8')]=router; \ No newline at end of file +var _0xffcc=['setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','get','callback','login'];(function(_0x2a187,_0x2fcfe7){var _0xd0786d=function(_0x39cd74){while(--_0x39cd74){_0x2a187['push'](_0x2a187['shift']());}};_0xd0786d(++_0x2fcfe7);}(_0xffcc,0x112));var _0xcffc=function(_0x8b46fd,_0x3ff643){_0x8b46fd=_0x8b46fd-0x0;var _0x1ebf86=_0xffcc[_0x8b46fd];return _0x1ebf86;};'use strict';var express=require('express');var passport=require(_0xcffc('0x0'));var router=express['Router']();var controller=require(_0xcffc('0x1'));var userController=require(_0xcffc('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0xcffc('0x3')]('/callback',controller[_0xcffc('0x4')],authService['isMiddleware'],userController[_0xcffc('0x5')],authService[_0xcffc('0x6')]);module[_0xcffc('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index b5de359..2188167 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 _0x325c=['lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','user','agent','then','name','loginAttempts','blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','error','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordHistory','use','passport','passport-local','Strategy','jayson/promise'];(function(_0x1c6abb,_0x5884e6){var _0x2aee50=function(_0x3e3c96){while(--_0x3e3c96){_0x1c6abb['push'](_0x1c6abb['shift']());}};_0x2aee50(++_0x5884e6);}(_0x325c,0x96));var _0xc325=function(_0x49775a,_0x28de4f){_0x49775a=_0x49775a-0x0;var _0x4fc888=_0x325c[_0x49775a];return _0x4fc888;};'use strict';var util=require('util');var passport=require(_0xc325('0x0'));var LocalStrategy=require(_0xc325('0x1'))[_0xc325('0x2')];var jayson=require(_0xc325('0x3'));var _=require(_0xc325('0x4'));var rs=require('randomstring');var moment=require(_0xc325('0x5'));var db=require(_0xc325('0x6'))['db'];var authService=require(_0xc325('0x7'));var utils=require(_0xc325('0x8'));var client=jayson[_0xc325('0x9')][_0xc325('0xa')]({'port':0x232b});function localAuthenticate(_0x2fff39,_0x3b62fe,_0x3e35e4,_0x686b03){var _0x16dd0d,_0x2e053a;return db[_0xc325('0xb')][_0xc325('0xc')]({'where':{'id':0x1},'attributes':[_0xc325('0xd'),_0xc325('0xe')],'raw':!![]})['then'](function(_0x3a7ae6){_0x16dd0d=_0x3a7ae6;return _0x2fff39[_0xc325('0xc')]({'attributes':['id','name',_0xc325('0xf'),_0xc325('0x10'),_0xc325('0x11'),_0xc325('0x12'),'blocked',_0xc325('0x13'),'loginAttempts'],'where':{'name':_0x3b62fe,'role':{'$or':['admin',_0xc325('0x14'),_0xc325('0x15')]}}});})[_0xc325('0x16')](function(_0x85b83c){if(!_0x85b83c||_0x85b83c&&_0x85b83c[_0xc325('0x17')]!==_0x3b62fe){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2e053a=_0x85b83c;return _0x2e053a;}})[_0xc325('0x16')](function(){_0x2e053a['authenticate'](_0x3e35e4,function(_0x158d30,_0x680757){var _0x213884=_0x2e053a[_0xc325('0x18')]+0x1;if(_0x158d30){return _0x686b03(_0x158d30);}else if(!_0x680757){if(_0x2e053a['disabled']){return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x16dd0d[_0xc325('0xd')]>0x0){if(_0x2e053a[_0xc325('0x19')]){if(_0x16dd0d[_0xc325('0xe')]>0x0){if(moment(_0x2e053a[_0xc325('0x13')])[_0xc325('0x1a')](_0x16dd0d[_0xc325('0xe')],_0xc325('0x1b'))>moment()){return _0x686b03(null,![],{'message':_0xc325('0x1c')});}else{return utils[_0xc325('0x1d')](_0x2e053a,_0x213884,![],null)[_0xc325('0x16')](function(){return _0x686b03(null,![],{'message':_0xc325('0x1c')});});}}else{return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x213884>=_0x16dd0d[_0xc325('0xd')]){return utils[_0xc325('0x1d')](_0x2e053a,0x0,!![],moment())['then'](function(){return _0x686b03(null,![],{'message':_0xc325('0x1c')});});}else{return utils['clearBlockUser'](_0x2e053a,_0x213884,![],null)['then'](function(){return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2e053a[_0xc325('0x12')]){return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x16dd0d[_0xc325('0xd')]>0x0){if(_0x2e053a[_0xc325('0x19')]){if(_0x16dd0d[_0xc325('0xe')]>0x0){if(moment(_0x2e053a['blockedAt'])['add'](_0x16dd0d[_0xc325('0xe')],_0xc325('0x1b'))>moment()){return _0x686b03(null,![],{'message':_0xc325('0x1c')});}else{return utils[_0xc325('0x1d')](_0x2e053a,0x0,![],null)[_0xc325('0x16')](function(){return utils[_0xc325('0x1e')](_0x2e053a);})['then'](function(){return _0x686b03(null,_0x2e053a);});}}else{return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xc325('0x1d')](_0x2e053a,0x0,![],null)[_0xc325('0x16')](function(){return utils[_0xc325('0x1e')](_0x2e053a);})[_0xc325('0x16')](function(){return _0x686b03(null,_0x2e053a);})[_0xc325('0x1f')](function(_0x4d2216){return _0x686b03(null,![],_0x4d2216);});}}else{if(_0x2e053a[_0xc325('0x19')]){return _0x686b03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc325('0x1e')](_0x2e053a)[_0xc325('0x16')](function(){return _0x686b03(null,_0x2e053a);});}}}});})[_0xc325('0x1f')](function(_0x1091be){return _0x686b03(null,![],_0x1091be);});}function sendServiceMail(_0x23fe68){return db['MailAccount'][_0xc325('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc325('0x17'),_0xc325('0x21')],'include':[{'model':db[_0xc325('0x22')],'as':_0xc325('0x23'),'include':[{'model':db[_0xc325('0x24')],'as':'CloudProvider'}]}]})[_0xc325('0x16')](function(_0x485f14){if(!_0x485f14){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5bdaec=_0x485f14[_0xc325('0x25')]();var _0xa8973f={'account':_0x5bdaec,'message':_['merge']({'from':util[_0xc325('0x26')](_0xc325('0x27'),_0x485f14[_0xc325('0x17')],_0x485f14['email']||_0x485f14[_0xc325('0x23')]['user'])},_0x23fe68)};return client[_0xc325('0x28')]('SendMail',_0xa8973f);})['then'](function(_0x496da8){if(_0x496da8['error']){throw new Error(util[_0xc325('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x496da8[_0xc325('0x29')][_0xc325('0x2a')]||JSON[_0xc325('0x2b')](_0x496da8[_0xc325('0x29')])));}return!![];});}function handleError(_0x2d442d,_0x174f0e,_0x323c65){return _0x2d442d['status'](_0x174f0e||0x1f4)[_0xc325('0x2c')]({'message':_0x323c65?_0x323c65['message']||_0x323c65:''});}exports[_0xc325('0x2d')]=function(_0x30eda9,_0x25766e,_0x1384cb){passport['authenticate'](_0xc325('0x2e'),function(_0x22b3ef,_0x4506a2,_0x2570e9){var _0xa62122=_0x22b3ef||_0x2570e9;if(_0xa62122){return handleError(_0x25766e,0x191,_0xa62122);}if(!_0x4506a2){return handleError(_0x25766e,0x194,{'message':_0xc325('0x2f')});}else{var _0x13c984={'payload':{'id':_0x4506a2['id'],'role':_0x4506a2[_0xc325('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xc325('0x30')](_0x13c984)[_0xc325('0x16')](function(_0x133d60){_0x25766e[_0xc325('0x31')]({'id':_0x4506a2['id'],'token':_0x133d60,'statusCall':'','isAlreadyLogged':_0x4506a2[_0xc325('0x32')]});});}})(_0x30eda9,_0x25766e,_0x1384cb);};exports[_0xc325('0x33')]=function(_0x12b322,_0x3dfb3e){if(!_0x12b322[_0xc325('0x34')][_0xc325('0x21')]){return handleError(_0x3dfb3e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1610ab=rs[_0xc325('0x35')]();_0x12b322['body'][_0xc325('0x21')]=_0x12b322[_0xc325('0x34')]['email'][_0xc325('0x36')]()['toLowerCase']();var _0x27fa69;return db['Setting'][_0xc325('0xc')]({'where':{'id':0x1},'attributes':[_0xc325('0xd'),'blockDuration'],'raw':!![]})[_0xc325('0x16')](function(_0x4d1d3a){_0x27fa69=_0x4d1d3a;return db[_0xc325('0x37')]['find']({'where':{'email':_0x12b322[_0xc325('0x34')][_0xc325('0x21')]}});})['then'](function(_0x18bfeb){if(!_0x18bfeb){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x18bfeb[_0xc325('0x12')]){throw new Error(_0xc325('0x38'));}if(_0x18bfeb[_0xc325('0x19')]){if(moment(_0x18bfeb[_0xc325('0x13')])[_0xc325('0x1a')](_0x27fa69[_0xc325('0xe')],_0xc325('0x1b'))>moment()){throw new Error(_0xc325('0x39'));}else{_0x18bfeb[_0xc325('0x19')]=![];_0x18bfeb[_0xc325('0x13')]=null;}}_0x18bfeb[_0xc325('0x3a')]=_0x1610ab;_0x18bfeb[_0xc325('0x3b')]=Date[_0xc325('0x3c')]()+0x36ee80;return _0x18bfeb[_0xc325('0x3d')]();})[_0xc325('0x16')](function(){return sendServiceMail({'to':_0x12b322[_0xc325('0x34')][_0xc325('0x21')],'subject':_0xc325('0x3e'),'text':_0xc325('0x3f')+_0xc325('0x40')+_0xc325('0x41')+_0x12b322[_0xc325('0x42')][_0xc325('0x43')]+'/reset/'+_0x1610ab+'\x0a\x0a'+_0xc325('0x44')});})[_0xc325('0x16')](function(){_0x3dfb3e[_0xc325('0x45')](0xc8)['send']({'message':_0xc325('0x46')});})[_0xc325('0x1f')](function(_0xebae56){return handleError(_0x3dfb3e,0x1f4,_0xebae56);});};exports['reset']=function(_0x1fe5f2,_0x3afefe){return db[_0xc325('0x37')]['find']({'where':{'resetPasswordToken':_0x1fe5f2[_0xc325('0x47')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc325('0x3c')]()}}})[_0xc325('0x16')](function(_0x743746){if(!_0x743746){throw new Error(_0xc325('0x48'));}return db['Setting'][_0xc325('0xc')]({'attributes':['id',_0xc325('0x49'),'enforcePasswordHistory',_0xc325('0x4a')]})[_0xc325('0x16')](function(_0x2f5244){if(_0x2f5244[_0xc325('0x49')])authService['validatePasswordPattern'](_0x1fe5f2[_0xc325('0x34')][_0xc325('0xf')]);if(!_0x2f5244['enforcePasswordHistory']||!_0x743746['previousPasswords'])return _0x743746;authService[_0xc325('0x4b')](_0x1fe5f2[_0xc325('0x34')][_0xc325('0xf')],_0x743746['previousPasswords'],_0x2f5244[_0xc325('0x4a')]);return _0x743746;})[_0xc325('0x16')](function(){_0x743746[_0xc325('0xf')]=_0x1fe5f2['body'][_0xc325('0xf')];_0x743746['resetPasswordToken']=null;_0x743746[_0xc325('0x3b')]=null;return _0x743746[_0xc325('0x3d')]();});})[_0xc325('0x16')](function(){_0x3afefe[_0xc325('0x45')](0xc8)[_0xc325('0x2c')]({'message':'Password\x20reset!'});})[_0xc325('0x1f')](function(_0x5a7d99){return handleError(_0x3afefe,0x1f4,_0x5a7d99);});};passport[_0xc325('0x4c')](_0xc325('0x2e'),new LocalStrategy({'usernameField':_0xc325('0x17'),'passwordField':_0xc325('0xf')},function(_0x12e0d7,_0x447e92,_0xa775ef){return localAuthenticate(db[_0xc325('0x37')],_0x12e0d7,_0x447e92,_0xa775ef);})); \ No newline at end of file +var _0xac32=['resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x392632,_0x418adf){var _0x39df4f=function(_0x2ad576){while(--_0x2ad576){_0x392632['push'](_0x392632['shift']());}};_0x39df4f(++_0x418adf);}(_0xac32,0x111));var _0x2ac3=function(_0x258d81,_0x41ebde){_0x258d81=_0x258d81-0x0;var _0x7d0e3c=_0xac32[_0x258d81];return _0x7d0e3c;};'use strict';var util=require(_0x2ac3('0x0'));var passport=require(_0x2ac3('0x1'));var LocalStrategy=require(_0x2ac3('0x2'))[_0x2ac3('0x3')];var jayson=require('jayson/promise');var _=require(_0x2ac3('0x4'));var rs=require(_0x2ac3('0x5'));var moment=require(_0x2ac3('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x2ac3('0x7'));var utils=require(_0x2ac3('0x8'));var client=jayson[_0x2ac3('0x9')][_0x2ac3('0xa')]({'port':0x232b});function localAuthenticate(_0x4e9fc9,_0x10b292,_0x301ff2,_0x3a96d7){var _0x2ac1ab,_0x5a5ebe;return db[_0x2ac3('0xb')][_0x2ac3('0xc')]({'where':{'id':0x1},'attributes':[_0x2ac3('0xd'),'blockDuration'],'raw':!![]})[_0x2ac3('0xe')](function(_0x56287c){_0x2ac1ab=_0x56287c;return _0x4e9fc9[_0x2ac3('0xc')]({'attributes':['id',_0x2ac3('0xf'),_0x2ac3('0x10'),_0x2ac3('0x11'),'role',_0x2ac3('0x12'),_0x2ac3('0x13'),_0x2ac3('0x14'),'loginAttempts'],'where':{'name':_0x10b292,'role':{'$or':[_0x2ac3('0x15'),_0x2ac3('0x16'),_0x2ac3('0x17')]}}});})[_0x2ac3('0xe')](function(_0x780d2b){if(!_0x780d2b||_0x780d2b&&_0x780d2b[_0x2ac3('0xf')]!==_0x10b292){throw new Error(_0x2ac3('0x18'));}else{_0x5a5ebe=_0x780d2b;return _0x5a5ebe;}})[_0x2ac3('0xe')](function(){_0x5a5ebe[_0x2ac3('0x19')](_0x301ff2,function(_0x3cf1dc,_0x124eb9){var _0x3a2209=_0x5a5ebe[_0x2ac3('0x1a')]+0x1;if(_0x3cf1dc){return _0x3a96d7(_0x3cf1dc);}else if(!_0x124eb9){if(_0x5a5ebe[_0x2ac3('0x12')]){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}else if(_0x2ac1ab[_0x2ac3('0xd')]>0x0){if(_0x5a5ebe['blocked']){if(_0x2ac1ab[_0x2ac3('0x1b')]>0x0){if(moment(_0x5a5ebe[_0x2ac3('0x14')])[_0x2ac3('0x1c')](_0x2ac1ab[_0x2ac3('0x1b')],_0x2ac3('0x1d'))>moment()){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}else{return utils['clearBlockUser'](_0x5a5ebe,_0x3a2209,![],null)['then'](function(){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});});}}else{return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}}else{if(_0x3a2209>=_0x2ac1ab['allowedLoginAttempts']){return utils[_0x2ac3('0x1e')](_0x5a5ebe,0x0,!![],moment())[_0x2ac3('0xe')](function(){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});});}else{return utils[_0x2ac3('0x1e')](_0x5a5ebe,_0x3a2209,![],null)[_0x2ac3('0xe')](function(){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});});}}}else{return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}}else{if(_0x5a5ebe[_0x2ac3('0x12')]){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}else if(_0x2ac1ab[_0x2ac3('0xd')]>0x0){if(_0x5a5ebe['blocked']){if(_0x2ac1ab['blockDuration']>0x0){if(moment(_0x5a5ebe[_0x2ac3('0x14')])[_0x2ac3('0x1c')](_0x2ac1ab['blockDuration'],_0x2ac3('0x1d'))>moment()){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}else{return utils[_0x2ac3('0x1e')](_0x5a5ebe,0x0,![],null)['then'](function(){return utils[_0x2ac3('0x1f')](_0x5a5ebe);})[_0x2ac3('0xe')](function(){return _0x3a96d7(null,_0x5a5ebe);});}}else{return _0x3a96d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x5a5ebe,0x0,![],null)[_0x2ac3('0xe')](function(){return utils['getLicense'](_0x5a5ebe);})[_0x2ac3('0xe')](function(){return _0x3a96d7(null,_0x5a5ebe);})[_0x2ac3('0x20')](function(_0x5c0ce0){return _0x3a96d7(null,![],_0x5c0ce0);});}}else{if(_0x5a5ebe[_0x2ac3('0x13')]){return _0x3a96d7(null,![],{'message':_0x2ac3('0x18')});}else{return utils[_0x2ac3('0x1f')](_0x5a5ebe)[_0x2ac3('0xe')](function(){return _0x3a96d7(null,_0x5a5ebe);});}}}});})[_0x2ac3('0x20')](function(_0x556481){return _0x3a96d7(null,![],_0x556481);});}function sendServiceMail(_0x13b6ee){return db[_0x2ac3('0x21')][_0x2ac3('0x22')]({'where':{'service':!![]},'attributes':['id',_0x2ac3('0xf'),_0x2ac3('0x23')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2ac3('0x24')],'as':'CloudProvider'}]}]})['then'](function(_0x3f6ee6){if(!_0x3f6ee6){throw new Error(_0x2ac3('0x25'));}var _0x4475c0=_0x3f6ee6[_0x2ac3('0x26')]();var _0x3622da={'account':_0x4475c0,'message':_['merge']({'from':util[_0x2ac3('0x27')]('\x22%s\x22\x20<%s>',_0x3f6ee6[_0x2ac3('0xf')],_0x3f6ee6[_0x2ac3('0x23')]||_0x3f6ee6['Smtp'][_0x2ac3('0x16')])},_0x13b6ee)};return client[_0x2ac3('0x28')](_0x2ac3('0x29'),_0x3622da);})[_0x2ac3('0xe')](function(_0x32a4c5){if(_0x32a4c5['error']){throw new Error(util[_0x2ac3('0x27')](_0x2ac3('0x2a'),_0x32a4c5[_0x2ac3('0x2b')][_0x2ac3('0x2c')]||JSON[_0x2ac3('0x2d')](_0x32a4c5['error'])));}return!![];});}function handleError(_0x210e32,_0x3b3a2c,_0x4e75de){return _0x210e32[_0x2ac3('0x2e')](_0x3b3a2c||0x1f4)[_0x2ac3('0x2f')]({'message':_0x4e75de?_0x4e75de['message']||_0x4e75de:''});}exports['login']=function(_0x9aa2f6,_0x1f8d25,_0x5b89bd){passport[_0x2ac3('0x19')](_0x2ac3('0x30'),function(_0x5e26bb,_0x376a7d,_0x5ea0df){var _0x376d80=_0x5e26bb||_0x5ea0df;if(_0x376d80){return handleError(_0x1f8d25,0x191,_0x376d80);}if(!_0x376a7d){return handleError(_0x1f8d25,0x194,{'message':_0x2ac3('0x31')});}else{var _0x2a4bcc={'payload':{'id':_0x376a7d['id'],'role':_0x376a7d['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2a4bcc)[_0x2ac3('0xe')](function(_0x30fa66){_0x1f8d25[_0x2ac3('0x32')]({'id':_0x376a7d['id'],'token':_0x30fa66,'statusCall':'','isAlreadyLogged':_0x376a7d[_0x2ac3('0x33')]});});}})(_0x9aa2f6,_0x1f8d25,_0x5b89bd);};exports[_0x2ac3('0x34')]=function(_0x318e6e,_0x580c31){if(!_0x318e6e['body'][_0x2ac3('0x23')]){return handleError(_0x580c31,0x1f4,{'message':_0x2ac3('0x35')});}var _0x38a591=rs['generate']();_0x318e6e[_0x2ac3('0x36')][_0x2ac3('0x23')]=_0x318e6e['body'][_0x2ac3('0x23')][_0x2ac3('0x37')]()[_0x2ac3('0x38')]();var _0x4577f4;return db['Setting'][_0x2ac3('0xc')]({'where':{'id':0x1},'attributes':[_0x2ac3('0xd'),'blockDuration'],'raw':!![]})['then'](function(_0xddb3ef){_0x4577f4=_0xddb3ef;return db['User']['find']({'where':{'email':_0x318e6e['body'][_0x2ac3('0x23')]}});})[_0x2ac3('0xe')](function(_0x151785){if(!_0x151785){throw new Error(_0x2ac3('0x39'));}if(_0x151785[_0x2ac3('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x151785['blocked']){if(moment(_0x151785[_0x2ac3('0x14')])[_0x2ac3('0x1c')](_0x4577f4[_0x2ac3('0x1b')],'minutes')>moment()){throw new Error(_0x2ac3('0x3a'));}else{_0x151785['blocked']=![];_0x151785['blockedAt']=null;}}_0x151785['resetPasswordToken']=_0x38a591;_0x151785[_0x2ac3('0x3b')]=Date[_0x2ac3('0x3c')]()+0x36ee80;return _0x151785[_0x2ac3('0x3d')]();})[_0x2ac3('0xe')](function(){return sendServiceMail({'to':_0x318e6e[_0x2ac3('0x36')][_0x2ac3('0x23')],'subject':_0x2ac3('0x3e'),'text':_0x2ac3('0x3f')+_0x2ac3('0x40')+'https://'+_0x318e6e[_0x2ac3('0x41')][_0x2ac3('0x42')]+_0x2ac3('0x43')+_0x38a591+'\x0a\x0a'+_0x2ac3('0x44')});})[_0x2ac3('0xe')](function(){_0x580c31[_0x2ac3('0x2e')](0xc8)[_0x2ac3('0x2f')]({'message':_0x2ac3('0x45')});})[_0x2ac3('0x20')](function(_0x3d648d){return handleError(_0x580c31,0x1f4,_0x3d648d);});};exports[_0x2ac3('0x46')]=function(_0xd93dc,_0x159922){return db[_0x2ac3('0x47')][_0x2ac3('0x22')]({'where':{'resetPasswordToken':_0xd93dc[_0x2ac3('0x48')][_0x2ac3('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2ac3('0xe')](function(_0x1381c8){if(!_0x1381c8){throw new Error(_0x2ac3('0x4a'));}return db[_0x2ac3('0xb')][_0x2ac3('0xc')]({'attributes':['id','securePassword',_0x2ac3('0x4b'),_0x2ac3('0x4c')]})[_0x2ac3('0xe')](function(_0x1d1c2d){if(_0x1d1c2d[_0x2ac3('0x4d')])authService[_0x2ac3('0x4e')](_0xd93dc[_0x2ac3('0x36')][_0x2ac3('0x10')]);if(!_0x1d1c2d[_0x2ac3('0x4b')]||!_0x1381c8['previousPasswords'])return _0x1381c8;authService[_0x2ac3('0x4f')](_0xd93dc[_0x2ac3('0x36')][_0x2ac3('0x10')],_0x1381c8[_0x2ac3('0x50')],_0x1d1c2d[_0x2ac3('0x4c')]);return _0x1381c8;})[_0x2ac3('0xe')](function(){_0x1381c8[_0x2ac3('0x10')]=_0xd93dc[_0x2ac3('0x36')][_0x2ac3('0x10')];_0x1381c8['resetPasswordToken']=null;_0x1381c8[_0x2ac3('0x3b')]=null;return _0x1381c8[_0x2ac3('0x3d')]();});})['then'](function(){_0x159922[_0x2ac3('0x2e')](0xc8)[_0x2ac3('0x2f')]({'message':_0x2ac3('0x51')});})[_0x2ac3('0x20')](function(_0x2d11e0){return handleError(_0x159922,0x1f4,_0x2d11e0);});};passport[_0x2ac3('0x52')](_0x2ac3('0x30'),new LocalStrategy({'usernameField':_0x2ac3('0xf'),'passwordField':'password'},function(_0x17e58a,_0x285064,_0x105b49){return localAuthenticate(db[_0x2ac3('0x47')],_0x17e58a,_0x285064,_0x105b49);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d6724a8..97eac36 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 _0x9714=['express','Router','login','post','/forgot','forgot','/reset/:token','exports'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x9714,0xa0));var _0x4971=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x9714[_0x4e697a];return _0x88850c;};'use strict';var express=require(_0x4971('0x0'));var router=express[_0x4971('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x4971('0x2')]);router[_0x4971('0x3')](_0x4971('0x4'),controller[_0x4971('0x5')]);router[_0x4971('0x3')](_0x4971('0x6'),controller['reset']);module[_0x4971('0x7')]=router; \ No newline at end of file +var _0x8fe4=['post','login','/forgot','forgot','/reset/:token','exports','express','Router','./authLocal.controller'];(function(_0x4659b5,_0xd07142){var _0x2cd685=function(_0x89afc){while(--_0x89afc){_0x4659b5['push'](_0x4659b5['shift']());}};_0x2cd685(++_0xd07142);}(_0x8fe4,0xf0));var _0x48fe=function(_0x111213,_0x3b29d4){_0x111213=_0x111213-0x0;var _0x34b86a=_0x8fe4[_0x111213];return _0x34b86a;};'use strict';var express=require(_0x48fe('0x0'));var router=express[_0x48fe('0x1')]();var controller=require(_0x48fe('0x2'));router[_0x48fe('0x3')]('/',controller[_0x48fe('0x4')]);router[_0x48fe('0x3')](_0x48fe('0x5'),controller[_0x48fe('0x6')]);router[_0x48fe('0x3')](_0x48fe('0x7'),controller['reset']);module[_0x48fe('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index dcf5dc5..6e6db64 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 _0xe654=['BOOLEAN','sequelize','exports','STRING'];(function(_0x743abc,_0x84a83){var _0x5ceb31=function(_0x43857e){while(--_0x43857e){_0x743abc['push'](_0x743abc['shift']());}};_0x5ceb31(++_0x84a83);}(_0xe654,0x1ad));var _0x4e65=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe654[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4e65('0x0'));module[_0x4e65('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4e65('0x2')]},'description':{'type':Sequelize[_0x4e65('0x2')]},'status':{'type':Sequelize[_0x4e65('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x8cf4=['BOOLEAN','INTEGER','STRING'];(function(_0x3ca7b1,_0x50b9c5){var _0x1e042c=function(_0x589efe){while(--_0x589efe){_0x3ca7b1['push'](_0x3ca7b1['shift']());}};_0x1e042c(++_0x50b9c5);}(_0x8cf4,0x1ee));var _0x48cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8cf4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x48cf('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x48cf('0x0')]},'description':{'type':Sequelize[_0x48cf('0x0')]},'status':{'type':Sequelize[_0x48cf('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x48cf('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 460ef90..8f45d58 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 _0xc738=['request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','Condition','omit','ids','findOne','length','getConditions','addActions','Action','getActions','zip-dir'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc738,0x18a));var _0x8c73=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0xc738[_0x127a60];return _0xc1f6a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c73('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c73('0x1'));var moment=require('moment');var BPromise=require(_0x8c73('0x2'));var Mustache=require(_0x8c73('0x3'));var util=require(_0x8c73('0x4'));var path=require(_0x8c73('0x5'));var sox=require(_0x8c73('0x6'));var csv=require(_0x8c73('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c73('0x8'));var _=require('lodash');var squel=require(_0x8c73('0x9'));var crypto=require(_0x8c73('0xa'));var jsforce=require(_0x8c73('0xb'));var deskjs=require(_0x8c73('0xc'));var toCsv=require(_0x8c73('0x7'));var querystring=require(_0x8c73('0xd'));var Papa=require('papaparse');var Redis=require(_0x8c73('0xe'));var authService=require(_0x8c73('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c73('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x8c73('0x11'));var licenseUtil=require(_0x8c73('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1de4d1,_0x138654){_0x138654=_0x138654||0xcc;return function(_0x690c7){if(_0x690c7){return _0x1de4d1[_0x8c73('0x13')](_0x138654);}return _0x1de4d1[_0x8c73('0x14')](_0x138654)[_0x8c73('0x15')]();};}function respondWithResult(_0x5b578a,_0x303eda){_0x303eda=_0x303eda||0xc8;return function(_0x456702){if(_0x456702){return _0x5b578a[_0x8c73('0x14')](_0x303eda)['json'](_0x456702);}};}function respondWithFilteredResult(_0x49447d,_0x278061){return function(_0x2e4096){if(_0x2e4096){var _0x5a9963=typeof _0x278061[_0x8c73('0x16')]===_0x8c73('0x17')&&typeof _0x278061[_0x8c73('0x18')]===_0x8c73('0x17');var _0x386717=_0x2e4096[_0x8c73('0x19')];var _0x3bcb44=_0x5a9963?0x0:_0x278061[_0x8c73('0x16')];var _0x204fb4=_0x5a9963?_0x2e4096[_0x8c73('0x19')]:_0x278061[_0x8c73('0x16')]+_0x278061[_0x8c73('0x18')];var _0x52e93c;if(_0x204fb4>=_0x386717){_0x204fb4=_0x386717;_0x52e93c=0xc8;}else{_0x52e93c=0xce;}_0x49447d['status'](_0x52e93c);return _0x49447d[_0x8c73('0x1a')](_0x8c73('0x1b'),_0x3bcb44+'-'+_0x204fb4+'/'+_0x386717)[_0x8c73('0x1c')](_0x2e4096);}return null;};}function patchUpdates(_0x5b8d2e){return function(_0x2c6789){try{jsonpatch[_0x8c73('0x1d')](_0x2c6789,_0x5b8d2e,!![]);}catch(_0x19b14f){return BPromise[_0x8c73('0x1e')](_0x19b14f);}return _0x2c6789[_0x8c73('0x1f')]();};}function saveUpdates(_0x2b7d4b,_0xbeeecb){return function(_0xcac2f7){if(_0xcac2f7){return _0xcac2f7['update'](_0x2b7d4b)[_0x8c73('0x20')](function(_0x3f2bfe){return _0x3f2bfe;});}return null;};}function removeEntity(_0x774cfb,_0x49ebfd){return function(_0x58ed95){if(_0x58ed95){return _0x58ed95[_0x8c73('0x21')]()[_0x8c73('0x20')](function(){_0x774cfb[_0x8c73('0x14')](0xcc)[_0x8c73('0x15')]();});}};}function handleEntityNotFound(_0x2e4cbd,_0x4761ae){return function(_0x580535){if(!_0x580535){_0x2e4cbd[_0x8c73('0x13')](0x194);}return _0x580535;};}function handleError(_0x4d0c4a,_0x27652d){_0x27652d=_0x27652d||0x1f4;return function(_0x2d0658){logger[_0x8c73('0x22')](_0x2d0658['stack']);if(_0x2d0658[_0x8c73('0x23')]){delete _0x2d0658[_0x8c73('0x23')];}_0x4d0c4a[_0x8c73('0x14')](_0x27652d)[_0x8c73('0x24')](_0x2d0658);};}exports[_0x8c73('0x25')]=function(_0xbaac60,_0x427332){var _0x590c72={},_0x3eb387={},_0x129d6e={'count':0x0,'rows':[]};var _0x5f88c7=_[_0x8c73('0x26')](db[_0x8c73('0x27')][_0x8c73('0x28')],function(_0x397c48){return{'name':_0x397c48[_0x8c73('0x29')],'type':_0x397c48[_0x8c73('0x2a')][_0x8c73('0x2b')]};});_0x3eb387['model']=_[_0x8c73('0x26')](_0x5f88c7,_0x8c73('0x23'));_0x3eb387[_0x8c73('0x2c')]=_['keys'](_0xbaac60[_0x8c73('0x2c')]);_0x3eb387[_0x8c73('0x2d')]=_[_0x8c73('0x2e')](_0x3eb387[_0x8c73('0x2f')],_0x3eb387[_0x8c73('0x2c')]);_0x590c72[_0x8c73('0x30')]=_[_0x8c73('0x2e')](_0x3eb387[_0x8c73('0x2f')],qs[_0x8c73('0x31')](_0xbaac60[_0x8c73('0x2c')]['fields']));_0x590c72['attributes']=_0x590c72[_0x8c73('0x30')]['length']?_0x590c72['attributes']:_0x3eb387['model'];if(!_0xbaac60[_0x8c73('0x2c')][_0x8c73('0x32')](_0x8c73('0x33'))){_0x590c72[_0x8c73('0x18')]=qs[_0x8c73('0x18')](_0xbaac60[_0x8c73('0x2c')]['limit']);_0x590c72[_0x8c73('0x16')]=qs[_0x8c73('0x16')](_0xbaac60['query'][_0x8c73('0x16')]);}_0x590c72[_0x8c73('0x34')]=qs[_0x8c73('0x35')](_0xbaac60[_0x8c73('0x2c')]['sort']);_0x590c72[_0x8c73('0x36')]=qs[_0x8c73('0x2d')](_[_0x8c73('0x37')](_0xbaac60['query'],_0x3eb387['filters']),_0x5f88c7);if(_0xbaac60[_0x8c73('0x2c')][_0x8c73('0x38')]){_0x590c72[_0x8c73('0x36')]=_[_0x8c73('0x39')](_0x590c72[_0x8c73('0x36')],{'$or':_[_0x8c73('0x26')](_0x5f88c7,function(_0x202311){if(_0x202311['type']!=='VIRTUAL'){var _0x353788={};_0x353788[_0x202311[_0x8c73('0x23')]]={'$like':'%'+_0xbaac60['query'][_0x8c73('0x38')]+'%'};return _0x353788;}})});}_0x590c72=_[_0x8c73('0x39')]({},_0x590c72,_0xbaac60[_0x8c73('0x3a')]);var _0x64d3f={'where':_0x590c72['where']};return db[_0x8c73('0x27')]['count'](_0x64d3f)[_0x8c73('0x20')](function(_0x40d7ea){_0x129d6e[_0x8c73('0x19')]=_0x40d7ea;if(_0xbaac60[_0x8c73('0x2c')][_0x8c73('0x3b')]){_0x590c72[_0x8c73('0x3c')]=[{'all':!![]}];}return db[_0x8c73('0x27')][_0x8c73('0x3d')](_0x590c72);})[_0x8c73('0x20')](function(_0x19f9e7){_0x129d6e[_0x8c73('0x3e')]=_0x19f9e7;return _0x129d6e;})[_0x8c73('0x20')](respondWithFilteredResult(_0x427332,_0x590c72))[_0x8c73('0x3f')](handleError(_0x427332,null));};exports['show']=function(_0x42c111,_0x4e2606){var _0x228882={'raw':![],'where':{'id':_0x42c111[_0x8c73('0x40')]['id']}},_0x366773={};_0x366773['model']=_['keys'](db['Automation'][_0x8c73('0x28')]);_0x366773['query']=_[_0x8c73('0x41')](_0x42c111['query']);_0x366773[_0x8c73('0x2d')]=_['intersection'](_0x366773['model'],_0x366773[_0x8c73('0x2c')]);_0x228882[_0x8c73('0x30')]=_[_0x8c73('0x2e')](_0x366773[_0x8c73('0x2f')],qs[_0x8c73('0x31')](_0x42c111[_0x8c73('0x2c')][_0x8c73('0x31')]));_0x228882['attributes']=_0x228882['attributes']['length']?_0x228882['attributes']:_0x366773[_0x8c73('0x2f')];if(_0x42c111[_0x8c73('0x2c')]['includeAll']){_0x228882[_0x8c73('0x3c')]=[{'all':!![]}];}_0x228882=_[_0x8c73('0x39')]({},_0x228882,_0x42c111['options']);return db[_0x8c73('0x27')][_0x8c73('0x42')](_0x228882)['then'](handleEntityNotFound(_0x4e2606,null))[_0x8c73('0x20')](respondWithResult(_0x4e2606,null))[_0x8c73('0x3f')](handleError(_0x4e2606,null));};exports[_0x8c73('0x43')]=function(_0x719c3a,_0x1499f7){return db[_0x8c73('0x27')][_0x8c73('0x43')](_0x719c3a[_0x8c73('0x44')],{})[_0x8c73('0x20')](respondWithResult(_0x1499f7,0xc9))[_0x8c73('0x3f')](handleError(_0x1499f7,null));};exports[_0x8c73('0x45')]=function(_0x48e119,_0xbfd284){if(_0x48e119[_0x8c73('0x44')]['id']){delete _0x48e119[_0x8c73('0x44')]['id'];}return db[_0x8c73('0x27')][_0x8c73('0x42')]({'where':{'id':_0x48e119[_0x8c73('0x40')]['id']}})[_0x8c73('0x20')](handleEntityNotFound(_0xbfd284,null))[_0x8c73('0x20')](saveUpdates(_0x48e119[_0x8c73('0x44')],null))[_0x8c73('0x20')](respondWithResult(_0xbfd284,null))[_0x8c73('0x3f')](handleError(_0xbfd284,null));};exports[_0x8c73('0x21')]=function(_0x182fb7,_0x38a965){return db[_0x8c73('0x27')][_0x8c73('0x42')]({'where':{'id':_0x182fb7[_0x8c73('0x40')]['id']}})[_0x8c73('0x20')](handleEntityNotFound(_0x38a965,null))[_0x8c73('0x20')](removeEntity(_0x38a965,null))['catch'](handleError(_0x38a965,null));};exports['addConditions']=function(_0x1497ab,_0x129186,_0x2de2b8){return db[_0x8c73('0x46')][_0x8c73('0x42')]({'where':{'id':_0x1497ab['params']['id']}})[_0x8c73('0x20')](handleEntityNotFound(_0x129186,null))[_0x8c73('0x20')](function(_0x34206d){if(_0x34206d){return _0x34206d['addConditions'](_0x1497ab[_0x8c73('0x44')]['ids'],_[_0x8c73('0x47')](_0x1497ab[_0x8c73('0x44')],[_0x8c73('0x48'),'id'])||{});}})['then'](respondWithResult(_0x129186,null))[_0x8c73('0x3f')](handleError(_0x129186,null));};exports['getConditions']=function(_0x46bdb8,_0x32fbfa,_0x1c7e2f){var _0x145062={};var _0x33a1f6={};var _0x181b5a;var _0x4611b4;return db[_0x8c73('0x27')][_0x8c73('0x49')]({'where':{'id':_0x46bdb8['params']['id']}})[_0x8c73('0x20')](handleEntityNotFound(_0x32fbfa,null))['then'](function(_0x3140bf){if(_0x3140bf){_0x181b5a=_0x3140bf;_0x33a1f6[_0x8c73('0x2f')]=_['keys'](db[_0x8c73('0x46')]['rawAttributes']);_0x33a1f6[_0x8c73('0x2c')]=_[_0x8c73('0x41')](_0x46bdb8[_0x8c73('0x2c')]);_0x33a1f6[_0x8c73('0x2d')]=_['intersection'](_0x33a1f6[_0x8c73('0x2f')],_0x33a1f6[_0x8c73('0x2c')]);_0x145062['attributes']=_[_0x8c73('0x2e')](_0x33a1f6[_0x8c73('0x2f')],qs[_0x8c73('0x31')](_0x46bdb8[_0x8c73('0x2c')]['fields']));_0x145062[_0x8c73('0x30')]=_0x145062[_0x8c73('0x30')][_0x8c73('0x4a')]?_0x145062[_0x8c73('0x30')]:_0x33a1f6[_0x8c73('0x2f')];_0x145062['order']=qs['sort'](_0x46bdb8[_0x8c73('0x2c')][_0x8c73('0x35')]);_0x145062[_0x8c73('0x36')]=qs[_0x8c73('0x2d')](_[_0x8c73('0x37')](_0x46bdb8[_0x8c73('0x2c')],_0x33a1f6[_0x8c73('0x2d')]));if(_0x46bdb8['query'][_0x8c73('0x38')]){_0x145062[_0x8c73('0x36')]=_[_0x8c73('0x39')](_0x145062[_0x8c73('0x36')],{'$or':_[_0x8c73('0x26')](_0x145062[_0x8c73('0x30')],function(_0x215ae0){var _0x46d187={};_0x46d187[_0x215ae0]={'$like':'%'+_0x46bdb8[_0x8c73('0x2c')][_0x8c73('0x38')]+'%'};return _0x46d187;})});}_0x145062=_['merge']({},_0x145062,_0x46bdb8[_0x8c73('0x3a')]);return _0x181b5a[_0x8c73('0x4b')](_0x145062);}})['then'](function(_0x22a2cc){if(_0x22a2cc){_0x4611b4=_0x22a2cc['length'];if(!_0x46bdb8[_0x8c73('0x2c')][_0x8c73('0x32')](_0x8c73('0x33'))){_0x145062[_0x8c73('0x18')]=qs[_0x8c73('0x18')](_0x46bdb8[_0x8c73('0x2c')][_0x8c73('0x18')]);_0x145062['offset']=qs[_0x8c73('0x16')](_0x46bdb8[_0x8c73('0x2c')][_0x8c73('0x16')]);}return _0x181b5a[_0x8c73('0x4b')](_0x145062);}})[_0x8c73('0x20')](function(_0x11f849){if(_0x11f849){return _0x11f849?{'count':_0x4611b4,'rows':_0x11f849}:null;}})[_0x8c73('0x20')](respondWithResult(_0x32fbfa,null))[_0x8c73('0x3f')](handleError(_0x32fbfa,null));};exports[_0x8c73('0x4c')]=function(_0x2c93fb,_0x248a96,_0x31e464){return db[_0x8c73('0x4d')][_0x8c73('0x42')]({'where':{'id':_0x2c93fb[_0x8c73('0x40')]['id']}})['then'](handleEntityNotFound(_0x248a96,null))['then'](function(_0x5f548c){if(_0x5f548c){return _0x5f548c['addActions'](_0x2c93fb['body'][_0x8c73('0x48')],_[_0x8c73('0x47')](_0x2c93fb[_0x8c73('0x44')],[_0x8c73('0x48'),'id'])||{});}})['then'](respondWithResult(_0x248a96,null))[_0x8c73('0x3f')](handleError(_0x248a96,null));};exports[_0x8c73('0x4e')]=function(_0x366dce,_0x59a26e,_0x17f853){var _0x34a7ca={};var _0x56a594={};var _0x43336c;var _0x487049;return db['Automation'][_0x8c73('0x49')]({'where':{'id':_0x366dce[_0x8c73('0x40')]['id']}})[_0x8c73('0x20')](handleEntityNotFound(_0x59a26e,null))[_0x8c73('0x20')](function(_0x1934d7){if(_0x1934d7){_0x43336c=_0x1934d7;_0x56a594['model']=_['keys'](db[_0x8c73('0x4d')][_0x8c73('0x28')]);_0x56a594[_0x8c73('0x2c')]=_[_0x8c73('0x41')](_0x366dce[_0x8c73('0x2c')]);_0x56a594[_0x8c73('0x2d')]=_[_0x8c73('0x2e')](_0x56a594[_0x8c73('0x2f')],_0x56a594['query']);_0x34a7ca['attributes']=_[_0x8c73('0x2e')](_0x56a594[_0x8c73('0x2f')],qs['fields'](_0x366dce[_0x8c73('0x2c')][_0x8c73('0x31')]));_0x34a7ca[_0x8c73('0x30')]=_0x34a7ca[_0x8c73('0x30')][_0x8c73('0x4a')]?_0x34a7ca[_0x8c73('0x30')]:_0x56a594[_0x8c73('0x2f')];_0x34a7ca[_0x8c73('0x34')]=qs['sort'](_0x366dce['query'][_0x8c73('0x35')]);_0x34a7ca['where']=qs[_0x8c73('0x2d')](_['pick'](_0x366dce['query'],_0x56a594[_0x8c73('0x2d')]));if(_0x366dce['query'][_0x8c73('0x38')]){_0x34a7ca['where']=_[_0x8c73('0x39')](_0x34a7ca[_0x8c73('0x36')],{'$or':_[_0x8c73('0x26')](_0x34a7ca[_0x8c73('0x30')],function(_0x1e62fc){var _0x477b28={};_0x477b28[_0x1e62fc]={'$like':'%'+_0x366dce[_0x8c73('0x2c')][_0x8c73('0x38')]+'%'};return _0x477b28;})});}_0x34a7ca=_[_0x8c73('0x39')]({},_0x34a7ca,_0x366dce[_0x8c73('0x3a')]);return _0x43336c[_0x8c73('0x4e')](_0x34a7ca);}})['then'](function(_0x56889b){if(_0x56889b){_0x487049=_0x56889b[_0x8c73('0x4a')];if(!_0x366dce['query'][_0x8c73('0x32')](_0x8c73('0x33'))){_0x34a7ca['limit']=qs[_0x8c73('0x18')](_0x366dce[_0x8c73('0x2c')][_0x8c73('0x18')]);_0x34a7ca['offset']=qs[_0x8c73('0x16')](_0x366dce['query'][_0x8c73('0x16')]);}return _0x43336c[_0x8c73('0x4e')](_0x34a7ca);}})[_0x8c73('0x20')](function(_0x39c77f){if(_0x39c77f){return _0x39c77f?{'count':_0x487049,'rows':_0x39c77f}:null;}})[_0x8c73('0x20')](respondWithResult(_0x59a26e,null))['catch'](handleError(_0x59a26e,null));}; \ No newline at end of file +var _0xcb47=['include','find','body','destroy','addConditions','Condition','ids','omit','getConditions','pick','hasOwnProperty','addActions','Action','getActions','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','Automation','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','merge','type','options','includeAll','findAll','rows','catch','show','params'];(function(_0x237097,_0x2f6e40){var _0x1ec864=function(_0x2c6c94){while(--_0x2c6c94){_0x237097['push'](_0x237097['shift']());}};_0x1ec864(++_0x2f6e40);}(_0xcb47,0x1cc));var _0x7cb4=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0xcb47[_0x3ae2b2];return _0x1dbf00;};'use strict';var emlformat=require(_0x7cb4('0x0'));var rimraf=require(_0x7cb4('0x1'));var zipdir=require(_0x7cb4('0x2'));var jsonpatch=require(_0x7cb4('0x3'));var rp=require(_0x7cb4('0x4'));var moment=require('moment');var BPromise=require(_0x7cb4('0x5'));var Mustache=require(_0x7cb4('0x6'));var util=require('util');var path=require(_0x7cb4('0x7'));var sox=require(_0x7cb4('0x8'));var csv=require(_0x7cb4('0x9'));var ejs=require(_0x7cb4('0xa'));var fs=require('fs');var fs_extra=require(_0x7cb4('0xb'));var _=require(_0x7cb4('0xc'));var squel=require(_0x7cb4('0xd'));var crypto=require(_0x7cb4('0xe'));var jsforce=require(_0x7cb4('0xf'));var deskjs=require(_0x7cb4('0x10'));var toCsv=require(_0x7cb4('0x9'));var querystring=require(_0x7cb4('0x11'));var Papa=require(_0x7cb4('0x12'));var Redis=require(_0x7cb4('0x13'));var authService=require(_0x7cb4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7cb4('0x15'));var hardwareService=require(_0x7cb4('0x16'));var logger=require(_0x7cb4('0x17'))(_0x7cb4('0x18'));var utils=require(_0x7cb4('0x19'));var config=require(_0x7cb4('0x1a'));var licenseUtil=require(_0x7cb4('0x1b'));var db=require(_0x7cb4('0x1c'))['db'];function respondWithStatusCode(_0x562668,_0x143803){_0x143803=_0x143803||0xcc;return function(_0x1e1068){if(_0x1e1068){return _0x562668['sendStatus'](_0x143803);}return _0x562668[_0x7cb4('0x1d')](_0x143803)[_0x7cb4('0x1e')]();};}function respondWithResult(_0x205ff8,_0x3f411e){_0x3f411e=_0x3f411e||0xc8;return function(_0x5d4e4e){if(_0x5d4e4e){return _0x205ff8['status'](_0x3f411e)['json'](_0x5d4e4e);}};}function respondWithFilteredResult(_0x48f799,_0x22c7bc){return function(_0x18ec8d){if(_0x18ec8d){var _0x305ac3=typeof _0x22c7bc[_0x7cb4('0x1f')]==='undefined'&&typeof _0x22c7bc['limit']===_0x7cb4('0x20');var _0xbd2f91=_0x18ec8d[_0x7cb4('0x21')];var _0x2b2eb5=_0x305ac3?0x0:_0x22c7bc[_0x7cb4('0x1f')];var _0x1276d7=_0x305ac3?_0x18ec8d['count']:_0x22c7bc[_0x7cb4('0x1f')]+_0x22c7bc[_0x7cb4('0x22')];var _0x1e93cd;if(_0x1276d7>=_0xbd2f91){_0x1276d7=_0xbd2f91;_0x1e93cd=0xc8;}else{_0x1e93cd=0xce;}_0x48f799[_0x7cb4('0x1d')](_0x1e93cd);return _0x48f799[_0x7cb4('0x23')](_0x7cb4('0x24'),_0x2b2eb5+'-'+_0x1276d7+'/'+_0xbd2f91)[_0x7cb4('0x25')](_0x18ec8d);}return null;};}function patchUpdates(_0x479684){return function(_0x1c276){try{jsonpatch[_0x7cb4('0x26')](_0x1c276,_0x479684,!![]);}catch(_0x3301aa){return BPromise[_0x7cb4('0x27')](_0x3301aa);}return _0x1c276[_0x7cb4('0x28')]();};}function saveUpdates(_0x340923,_0x38a251){return function(_0x37b3cf){if(_0x37b3cf){return _0x37b3cf[_0x7cb4('0x29')](_0x340923)[_0x7cb4('0x2a')](function(_0x2c69cf){return _0x2c69cf;});}return null;};}function removeEntity(_0x4a70cf,_0x4cb69c){return function(_0x1d5337){if(_0x1d5337){return _0x1d5337['destroy']()[_0x7cb4('0x2a')](function(){_0x4a70cf[_0x7cb4('0x1d')](0xcc)[_0x7cb4('0x1e')]();});}};}function handleEntityNotFound(_0x445415,_0x2dd25b){return function(_0x1d1e21){if(!_0x1d1e21){_0x445415[_0x7cb4('0x2b')](0x194);}return _0x1d1e21;};}function handleError(_0xa67c8f,_0x4c782e){_0x4c782e=_0x4c782e||0x1f4;return function(_0x58ee58){logger[_0x7cb4('0x2c')](_0x58ee58['stack']);if(_0x58ee58[_0x7cb4('0x2d')]){delete _0x58ee58['name'];}_0xa67c8f['status'](_0x4c782e)[_0x7cb4('0x2e')](_0x58ee58);};}exports[_0x7cb4('0x2f')]=function(_0xe61bed,_0x163394){var _0x39a695={},_0x581bc4={},_0x323444={'count':0x0,'rows':[]};var _0x28e7e7=_[_0x7cb4('0x30')](db[_0x7cb4('0x31')][_0x7cb4('0x32')],function(_0x474c21){return{'name':_0x474c21[_0x7cb4('0x33')],'type':_0x474c21['type'][_0x7cb4('0x34')]};});_0x581bc4['model']=_[_0x7cb4('0x30')](_0x28e7e7,_0x7cb4('0x2d'));_0x581bc4[_0x7cb4('0x35')]=_[_0x7cb4('0x36')](_0xe61bed[_0x7cb4('0x35')]);_0x581bc4['filters']=_[_0x7cb4('0x37')](_0x581bc4[_0x7cb4('0x38')],_0x581bc4[_0x7cb4('0x35')]);_0x39a695['attributes']=_['intersection'](_0x581bc4[_0x7cb4('0x38')],qs[_0x7cb4('0x39')](_0xe61bed[_0x7cb4('0x35')]['fields']));_0x39a695[_0x7cb4('0x3a')]=_0x39a695[_0x7cb4('0x3a')][_0x7cb4('0x3b')]?_0x39a695['attributes']:_0x581bc4[_0x7cb4('0x38')];if(!_0xe61bed[_0x7cb4('0x35')]['hasOwnProperty'](_0x7cb4('0x3c'))){_0x39a695[_0x7cb4('0x22')]=qs['limit'](_0xe61bed[_0x7cb4('0x35')][_0x7cb4('0x22')]);_0x39a695[_0x7cb4('0x1f')]=qs['offset'](_0xe61bed[_0x7cb4('0x35')][_0x7cb4('0x1f')]);}_0x39a695[_0x7cb4('0x3d')]=qs[_0x7cb4('0x3e')](_0xe61bed['query'][_0x7cb4('0x3e')]);_0x39a695[_0x7cb4('0x3f')]=qs[_0x7cb4('0x40')](_['pick'](_0xe61bed[_0x7cb4('0x35')],_0x581bc4[_0x7cb4('0x40')]),_0x28e7e7);if(_0xe61bed[_0x7cb4('0x35')]['filter']){_0x39a695[_0x7cb4('0x3f')]=_[_0x7cb4('0x41')](_0x39a695['where'],{'$or':_['map'](_0x28e7e7,function(_0x578dce){if(_0x578dce[_0x7cb4('0x42')]!=='VIRTUAL'){var _0x26ceb0={};_0x26ceb0[_0x578dce[_0x7cb4('0x2d')]]={'$like':'%'+_0xe61bed[_0x7cb4('0x35')]['filter']+'%'};return _0x26ceb0;}})});}_0x39a695=_[_0x7cb4('0x41')]({},_0x39a695,_0xe61bed[_0x7cb4('0x43')]);var _0x3c8bf0={'where':_0x39a695[_0x7cb4('0x3f')]};return db[_0x7cb4('0x31')][_0x7cb4('0x21')](_0x3c8bf0)[_0x7cb4('0x2a')](function(_0x416ff7){_0x323444[_0x7cb4('0x21')]=_0x416ff7;if(_0xe61bed[_0x7cb4('0x35')][_0x7cb4('0x44')]){_0x39a695['include']=[{'all':!![]}];}return db[_0x7cb4('0x31')][_0x7cb4('0x45')](_0x39a695);})[_0x7cb4('0x2a')](function(_0x45d167){_0x323444[_0x7cb4('0x46')]=_0x45d167;return _0x323444;})['then'](respondWithFilteredResult(_0x163394,_0x39a695))[_0x7cb4('0x47')](handleError(_0x163394,null));};exports[_0x7cb4('0x48')]=function(_0x20e0ff,_0x2306c5){var _0x4b2e30={'raw':![],'where':{'id':_0x20e0ff[_0x7cb4('0x49')]['id']}},_0x2aaf1f={};_0x2aaf1f[_0x7cb4('0x38')]=_[_0x7cb4('0x36')](db[_0x7cb4('0x31')][_0x7cb4('0x32')]);_0x2aaf1f[_0x7cb4('0x35')]=_['keys'](_0x20e0ff[_0x7cb4('0x35')]);_0x2aaf1f[_0x7cb4('0x40')]=_[_0x7cb4('0x37')](_0x2aaf1f['model'],_0x2aaf1f[_0x7cb4('0x35')]);_0x4b2e30[_0x7cb4('0x3a')]=_[_0x7cb4('0x37')](_0x2aaf1f[_0x7cb4('0x38')],qs['fields'](_0x20e0ff[_0x7cb4('0x35')]['fields']));_0x4b2e30['attributes']=_0x4b2e30[_0x7cb4('0x3a')][_0x7cb4('0x3b')]?_0x4b2e30[_0x7cb4('0x3a')]:_0x2aaf1f['model'];if(_0x20e0ff[_0x7cb4('0x35')][_0x7cb4('0x44')]){_0x4b2e30[_0x7cb4('0x4a')]=[{'all':!![]}];}_0x4b2e30=_[_0x7cb4('0x41')]({},_0x4b2e30,_0x20e0ff['options']);return db[_0x7cb4('0x31')][_0x7cb4('0x4b')](_0x4b2e30)[_0x7cb4('0x2a')](handleEntityNotFound(_0x2306c5,null))[_0x7cb4('0x2a')](respondWithResult(_0x2306c5,null))[_0x7cb4('0x47')](handleError(_0x2306c5,null));};exports['create']=function(_0x22624d,_0x3058c4){return db[_0x7cb4('0x31')]['create'](_0x22624d[_0x7cb4('0x4c')],{})['then'](respondWithResult(_0x3058c4,0xc9))[_0x7cb4('0x47')](handleError(_0x3058c4,null));};exports[_0x7cb4('0x29')]=function(_0x48d1ce,_0x5666c9){if(_0x48d1ce['body']['id']){delete _0x48d1ce['body']['id'];}return db[_0x7cb4('0x31')][_0x7cb4('0x4b')]({'where':{'id':_0x48d1ce[_0x7cb4('0x49')]['id']}})[_0x7cb4('0x2a')](handleEntityNotFound(_0x5666c9,null))[_0x7cb4('0x2a')](saveUpdates(_0x48d1ce[_0x7cb4('0x4c')],null))[_0x7cb4('0x2a')](respondWithResult(_0x5666c9,null))[_0x7cb4('0x47')](handleError(_0x5666c9,null));};exports[_0x7cb4('0x4d')]=function(_0x15ddae,_0x57149a){return db[_0x7cb4('0x31')]['find']({'where':{'id':_0x15ddae[_0x7cb4('0x49')]['id']}})[_0x7cb4('0x2a')](handleEntityNotFound(_0x57149a,null))[_0x7cb4('0x2a')](removeEntity(_0x57149a,null))[_0x7cb4('0x47')](handleError(_0x57149a,null));};exports[_0x7cb4('0x4e')]=function(_0x4c630c,_0x194c56,_0x5c8918){return db[_0x7cb4('0x4f')][_0x7cb4('0x4b')]({'where':{'id':_0x4c630c[_0x7cb4('0x49')]['id']}})[_0x7cb4('0x2a')](handleEntityNotFound(_0x194c56,null))[_0x7cb4('0x2a')](function(_0x4c951a){if(_0x4c951a){return _0x4c951a['addConditions'](_0x4c630c[_0x7cb4('0x4c')][_0x7cb4('0x50')],_[_0x7cb4('0x51')](_0x4c630c[_0x7cb4('0x4c')],['ids','id'])||{});}})[_0x7cb4('0x2a')](respondWithResult(_0x194c56,null))[_0x7cb4('0x47')](handleError(_0x194c56,null));};exports[_0x7cb4('0x52')]=function(_0x180e96,_0x5084d3,_0x52afa5){var _0xab5ba={};var _0x4eb9ff={};var _0x26a3e0;var _0x220e9a;return db[_0x7cb4('0x31')]['findOne']({'where':{'id':_0x180e96[_0x7cb4('0x49')]['id']}})['then'](handleEntityNotFound(_0x5084d3,null))['then'](function(_0x2fb6eb){if(_0x2fb6eb){_0x26a3e0=_0x2fb6eb;_0x4eb9ff[_0x7cb4('0x38')]=_['keys'](db[_0x7cb4('0x4f')]['rawAttributes']);_0x4eb9ff[_0x7cb4('0x35')]=_[_0x7cb4('0x36')](_0x180e96[_0x7cb4('0x35')]);_0x4eb9ff[_0x7cb4('0x40')]=_[_0x7cb4('0x37')](_0x4eb9ff['model'],_0x4eb9ff[_0x7cb4('0x35')]);_0xab5ba[_0x7cb4('0x3a')]=_[_0x7cb4('0x37')](_0x4eb9ff['model'],qs[_0x7cb4('0x39')](_0x180e96[_0x7cb4('0x35')]['fields']));_0xab5ba[_0x7cb4('0x3a')]=_0xab5ba['attributes'][_0x7cb4('0x3b')]?_0xab5ba[_0x7cb4('0x3a')]:_0x4eb9ff['model'];_0xab5ba[_0x7cb4('0x3d')]=qs[_0x7cb4('0x3e')](_0x180e96['query'][_0x7cb4('0x3e')]);_0xab5ba[_0x7cb4('0x3f')]=qs[_0x7cb4('0x40')](_[_0x7cb4('0x53')](_0x180e96[_0x7cb4('0x35')],_0x4eb9ff['filters']));if(_0x180e96[_0x7cb4('0x35')]['filter']){_0xab5ba[_0x7cb4('0x3f')]=_[_0x7cb4('0x41')](_0xab5ba['where'],{'$or':_[_0x7cb4('0x30')](_0xab5ba[_0x7cb4('0x3a')],function(_0x1e91c7){var _0x140c13={};_0x140c13[_0x1e91c7]={'$like':'%'+_0x180e96[_0x7cb4('0x35')]['filter']+'%'};return _0x140c13;})});}_0xab5ba=_['merge']({},_0xab5ba,_0x180e96[_0x7cb4('0x43')]);return _0x26a3e0[_0x7cb4('0x52')](_0xab5ba);}})[_0x7cb4('0x2a')](function(_0x2bf0b3){if(_0x2bf0b3){_0x220e9a=_0x2bf0b3[_0x7cb4('0x3b')];if(!_0x180e96['query'][_0x7cb4('0x54')](_0x7cb4('0x3c'))){_0xab5ba[_0x7cb4('0x22')]=qs[_0x7cb4('0x22')](_0x180e96[_0x7cb4('0x35')][_0x7cb4('0x22')]);_0xab5ba[_0x7cb4('0x1f')]=qs[_0x7cb4('0x1f')](_0x180e96['query'][_0x7cb4('0x1f')]);}return _0x26a3e0[_0x7cb4('0x52')](_0xab5ba);}})[_0x7cb4('0x2a')](function(_0x55e735){if(_0x55e735){return _0x55e735?{'count':_0x220e9a,'rows':_0x55e735}:null;}})['then'](respondWithResult(_0x5084d3,null))[_0x7cb4('0x47')](handleError(_0x5084d3,null));};exports[_0x7cb4('0x55')]=function(_0x5a8b52,_0x6ff886,_0x4c386a){return db[_0x7cb4('0x56')][_0x7cb4('0x4b')]({'where':{'id':_0x5a8b52[_0x7cb4('0x49')]['id']}})[_0x7cb4('0x2a')](handleEntityNotFound(_0x6ff886,null))[_0x7cb4('0x2a')](function(_0x5cb66e){if(_0x5cb66e){return _0x5cb66e[_0x7cb4('0x55')](_0x5a8b52['body']['ids'],_[_0x7cb4('0x51')](_0x5a8b52[_0x7cb4('0x4c')],['ids','id'])||{});}})[_0x7cb4('0x2a')](respondWithResult(_0x6ff886,null))['catch'](handleError(_0x6ff886,null));};exports[_0x7cb4('0x57')]=function(_0x52654d,_0x5988b9,_0x1f5cf8){var _0xb0c4a0={};var _0x192533={};var _0x36f258;var _0x2ed07c;return db[_0x7cb4('0x31')]['findOne']({'where':{'id':_0x52654d[_0x7cb4('0x49')]['id']}})[_0x7cb4('0x2a')](handleEntityNotFound(_0x5988b9,null))[_0x7cb4('0x2a')](function(_0x7f6f5b){if(_0x7f6f5b){_0x36f258=_0x7f6f5b;_0x192533[_0x7cb4('0x38')]=_[_0x7cb4('0x36')](db[_0x7cb4('0x56')][_0x7cb4('0x32')]);_0x192533['query']=_[_0x7cb4('0x36')](_0x52654d['query']);_0x192533[_0x7cb4('0x40')]=_[_0x7cb4('0x37')](_0x192533[_0x7cb4('0x38')],_0x192533[_0x7cb4('0x35')]);_0xb0c4a0[_0x7cb4('0x3a')]=_['intersection'](_0x192533['model'],qs[_0x7cb4('0x39')](_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x39')]));_0xb0c4a0[_0x7cb4('0x3a')]=_0xb0c4a0[_0x7cb4('0x3a')][_0x7cb4('0x3b')]?_0xb0c4a0['attributes']:_0x192533['model'];_0xb0c4a0[_0x7cb4('0x3d')]=qs[_0x7cb4('0x3e')](_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x3e')]);_0xb0c4a0[_0x7cb4('0x3f')]=qs[_0x7cb4('0x40')](_[_0x7cb4('0x53')](_0x52654d[_0x7cb4('0x35')],_0x192533['filters']));if(_0x52654d['query'][_0x7cb4('0x58')]){_0xb0c4a0[_0x7cb4('0x3f')]=_['merge'](_0xb0c4a0['where'],{'$or':_[_0x7cb4('0x30')](_0xb0c4a0[_0x7cb4('0x3a')],function(_0x56cf4d){var _0x3df133={};_0x3df133[_0x56cf4d]={'$like':'%'+_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x58')]+'%'};return _0x3df133;})});}_0xb0c4a0=_[_0x7cb4('0x41')]({},_0xb0c4a0,_0x52654d[_0x7cb4('0x43')]);return _0x36f258[_0x7cb4('0x57')](_0xb0c4a0);}})[_0x7cb4('0x2a')](function(_0x5251bd){if(_0x5251bd){_0x2ed07c=_0x5251bd[_0x7cb4('0x3b')];if(!_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x54')](_0x7cb4('0x3c'))){_0xb0c4a0[_0x7cb4('0x22')]=qs[_0x7cb4('0x22')](_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x22')]);_0xb0c4a0['offset']=qs[_0x7cb4('0x1f')](_0x52654d[_0x7cb4('0x35')][_0x7cb4('0x1f')]);}return _0x36f258['getActions'](_0xb0c4a0);}})[_0x7cb4('0x2a')](function(_0x85b462){if(_0x85b462){return _0x85b462?{'count':_0x2ed07c,'rows':_0x85b462}:null;}})[_0x7cb4('0x2a')](respondWithResult(_0x5988b9,null))[_0x7cb4('0x47')](handleError(_0x5988b9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 147f4f2..3d481e8 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 _0x9cf2=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./automation.attributes','exports','Automation'];(function(_0x17035c,_0x4128f1){var _0x5adf50=function(_0xa0335c){while(--_0xa0335c){_0x17035c['push'](_0x17035c['shift']());}};_0x5adf50(++_0x4128f1);}(_0x9cf2,0x1bd));var _0x29cf=function(_0x512e16,_0x4f7249){_0x512e16=_0x512e16-0x0;var _0xedb9bd=_0x9cf2[_0x512e16];return _0xedb9bd;};'use strict';var _=require(_0x29cf('0x0'));var util=require(_0x29cf('0x1'));var logger=require(_0x29cf('0x2'))(_0x29cf('0x3'));var moment=require(_0x29cf('0x4'));var BPromise=require(_0x29cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29cf('0x6'));var rimraf=require('rimraf');var config=require(_0x29cf('0x7'));var attributes=require(_0x29cf('0x8'));module[_0x29cf('0x9')]=function(_0x3a7a04,_0x4cc76b){return _0x3a7a04['define'](_0x29cf('0xa'),attributes,{'tableName':_0x29cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb45f=['define','Automation','tools_automations','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x1e5318,_0x1d06a6){var _0x5131de=function(_0x3dd1c9){while(--_0x3dd1c9){_0x1e5318['push'](_0x1e5318['shift']());}};_0x5131de(++_0x1d06a6);}(_0xb45f,0x7b));var _0xfb45=function(_0x3e88d8,_0x3806f0){_0x3e88d8=_0x3e88d8-0x0;var _0x30d1c6=_0xb45f[_0x3e88d8];return _0x30d1c6;};'use strict';var _=require('lodash');var util=require(_0xfb45('0x0'));var logger=require(_0xfb45('0x1'))(_0xfb45('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb45('0x3'));var fs=require('fs');var path=require(_0xfb45('0x4'));var rimraf=require(_0xfb45('0x5'));var config=require(_0xfb45('0x6'));var attributes=require(_0xfb45('0x7'));module[_0xfb45('0x8')]=function(_0x5dd53d,_0x1683b0){return _0x5dd53d[_0xfb45('0x9')](_0xfb45('0xa'),attributes,{'tableName':_0xfb45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 731a80d..c101185 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 _0xc5b3=['client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0xc5b3[_0x1a0600];return _0x734670;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var moment=require(_0x3c5b('0x2'));var BPromise=require(_0x3c5b('0x3'));var rs=require(_0x3c5b('0x4'));var fs=require('fs');var Redis=require(_0x3c5b('0x5'));var db=require(_0x3c5b('0x6'))['db'];var utils=require(_0x3c5b('0x7'));var logger=require('../../config/logger')(_0x3c5b('0x8'));var config=require(_0x3c5b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c5b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7a363e,_0x4730e9,_0x894f97){return new BPromise(function(_0xae86a0,_0x32586d){return client[_0x3c5b('0xb')](_0x7a363e,_0x894f97)[_0x3c5b('0xc')](function(_0x5f5df9){logger[_0x3c5b('0xd')](_0x3c5b('0xe'),_0x4730e9,_0x3c5b('0xf'));logger[_0x3c5b('0x10')](_0x3c5b('0x11'),_0x4730e9,'request\x20sent',JSON[_0x3c5b('0x12')](_0x5f5df9));if(_0x5f5df9[_0x3c5b('0x13')]){if(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x14')]===0x1f4){logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9[_0x3c5b('0x13')]['message']);return _0x32586d(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x15')]);}logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9['error'][_0x3c5b('0x15')]);return _0xae86a0(_0x5f5df9['error'][_0x3c5b('0x15')]);}else{logger[_0x3c5b('0xd')]('Automation,\x20%s,\x20%s',_0x4730e9,_0x3c5b('0xf'));_0xae86a0(_0x5f5df9[_0x3c5b('0x16')]['message']);}})[_0x3c5b('0x17')](function(_0x1cbe52){logger[_0x3c5b('0x13')]('Automation,\x20%s,\x20%s',_0x4730e9,_0x1cbe52);_0x32586d(_0x1cbe52);});});} \ No newline at end of file +var _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x6f75,0x71));var _0x56f7=function(_0x13efd3,_0x1b4309){_0x13efd3=_0x13efd3-0x0;var _0x5bdca7=_0x6f75[_0x13efd3];return _0x5bdca7;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('Automation,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3ab10f4..7642088 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 _0xb2ff=['show','/:id/conditions','post','create','addConditions','/:id/actions','addActions','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2ff[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0x6')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller['getConditions']);router[_0xfb2f('0x6')]('/:id/actions',auth[_0xfb2f('0x7')](),controller['getActions']);router[_0xfb2f('0xb')]('/',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xc')]);router[_0xfb2f('0xb')](_0xfb2f('0xa'),auth['isAuthenticated'](),controller[_0xfb2f('0xd')]);router[_0xfb2f('0xb')](_0xfb2f('0xe'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xf')]);router[_0xfb2f('0x10')](_0xfb2f('0x8'),auth[_0xfb2f('0x7')](),controller['update']);router[_0xfb2f('0x11')](_0xfb2f('0x8'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x12')]);module[_0xfb2f('0x13')]=router; \ No newline at end of file +var _0x0048=['show','/:id/conditions','/:id/actions','post','isAuthenticated','addConditions','addActions','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id'];(function(_0x1f6128,_0xe9ae3){var _0x5ac79f=function(_0x3066f0){while(--_0x3066f0){_0x1f6128['push'](_0x1f6128['shift']());}};_0x5ac79f(++_0xe9ae3);}(_0x0048,0x129));var _0x8004=function(_0x1ce834,_0x48dac9){_0x1ce834=_0x1ce834-0x0;var _0x248554=_0x0048[_0x1ce834];return _0x248554;};'use strict';var multer=require('multer');var util=require(_0x8004('0x0'));var path=require(_0x8004('0x1'));var timeout=require('connect-timeout');var express=require(_0x8004('0x2'));var router=express[_0x8004('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8004('0x4'));var interaction=require(_0x8004('0x5'));var config=require(_0x8004('0x6'));var controller=require(_0x8004('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8004('0x8')]);router[_0x8004('0x9')](_0x8004('0xa'),auth['isAuthenticated'](),controller[_0x8004('0xb')]);router[_0x8004('0x9')](_0x8004('0xc'),auth['isAuthenticated'](),controller['getConditions']);router['get'](_0x8004('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x8004('0xe')]('/',auth[_0x8004('0xf')](),controller['create']);router['post'](_0x8004('0xc'),auth[_0x8004('0xf')](),controller[_0x8004('0x10')]);router[_0x8004('0xe')](_0x8004('0xd'),auth[_0x8004('0xf')](),controller[_0x8004('0x11')]);router['put'](_0x8004('0xa'),auth[_0x8004('0xf')](),controller[_0x8004('0x12')]);router[_0x8004('0x13')](_0x8004('0xa'),auth[_0x8004('0xf')](),controller[_0x8004('0x14')]);module[_0x8004('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 68b0dc8..1cf2dfd 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 _0xef6a=['INTEGER','UNSIGNED','Max\x20200\x20calls.','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)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','BOOLEAN'];(function(_0x51d1ae,_0x22ab91){var _0x44959d=function(_0x19f122){while(--_0x19f122){_0x51d1ae['push'](_0x51d1ae['shift']());}};_0x44959d(++_0x22ab91);}(_0xef6a,0x1b8));var _0xaef6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xef6a[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module[_0xaef6('0x0')]={'name':{'type':Sequelize[_0xaef6('0x1')],'unique':_0xaef6('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xaef6('0x1')]},'active':{'type':Sequelize[_0xaef6('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xaef6('0x4')](0x4)[_0xaef6('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaef6('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaef6('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaef6('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaef6('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaef6('0x4')](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaef6('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaef6('0x4')](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'defaultValue':0x3,'comment':_0xaef6('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaef6('0xc')},'dialTimezone':{'type':Sequelize[_0xaef6('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaef6('0x1')],'defaultValue':_0xaef6('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xaef6('0xe')](_0xaef6('0xf'),'never',_0xaef6('0x10')),'defaultValue':_0xaef6('0xf')},'dialAMDActive':{'type':Sequelize[_0xaef6('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xaef6('0x4')](0x9)[_0xaef6('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaef6('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xaef6('0x4')](0x9)[_0xaef6('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaef6('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaef6('0x4')](0x9)[_0xaef6('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaef6('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xaef6('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaef6('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xaef6('0x4')](0x9)[_0xaef6('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaef6('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaef6('0x4')](0x9)[_0xaef6('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaef6('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xaef6('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaef6('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaef6('0x4')](0x5)[_0xaef6('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaef6('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaef6('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaef6('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaef6('0xe')](_0xaef6('0x1a'),_0xaef6('0x1b')),'defaultValue':_0xaef6('0x1a')},'dialPrefix':{'type':Sequelize[_0xaef6('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaef6('0x1c')},'dialCutDigit':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaef6('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaef6('0x4')](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xaef6('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaef6('0x4')](0x3)[_0xaef6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaef6('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaef6('0x4')](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xaef6('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaef6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaef6('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaef6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaef6('0x24')}}; \ No newline at end of file +var _0xf19d=['BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','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)','sequelize','exports','STRING','name','ivr'];(function(_0xe79d9f,_0x15231d){var _0x5c77fa=function(_0x40a65a){while(--_0x40a65a){_0xe79d9f['push'](_0xe79d9f['shift']());}};_0x5c77fa(++_0x15231d);}(_0xf19d,0x1b7));var _0xdf19=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xf19d[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0xdf19('0x0'));module[_0xdf19('0x1')]={'name':{'type':Sequelize[_0xdf19('0x2')],'unique':_0xdf19('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdf19('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xdf19('0x2')]},'active':{'type':Sequelize[_0xdf19('0x5')],'defaultValue':0x0,'comment':_0xdf19('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xdf19('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdf19('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdf19('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdf19('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdf19('0x9')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdf19('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'comment':_0xdf19('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdf19('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdf19('0x2')],'defaultValue':_0xdf19('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xdf19('0xf')](_0xdf19('0x10'),_0xdf19('0x11'),_0xdf19('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xdf19('0x5')],'defaultValue':0x0,'comment':_0xdf19('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xdf19('0x9')](0x9)[_0xdf19('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdf19('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xdf19('0x9')](0x9)[_0xdf19('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdf19('0x9')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdf19('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xdf19('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdf19('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xdf19('0x9')](0x9)[_0xdf19('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdf19('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdf19('0x9')](0x9)[_0xdf19('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdf19('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdf19('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdf19('0x9')](0x9)[_0xdf19('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdf19('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdf19('0x1b'),'ASC'),'defaultValue':_0xdf19('0x1b')},'dialPrefix':{'type':Sequelize[_0xdf19('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdf19('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xdf19('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdf19('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdf19('0x9')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdf19('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdf19('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdf19('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index cf86145..9db74c8 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 _0x39d0=['into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','OrderBy','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','Content-Range','reject','update','then','get','IvrCampaigns','destroy','error','stack','name','send','index','map','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','Campaign','count','includeAll','include','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','updatedAt','createdAt','UserProfileResource','getHoppers','CmHopper','CampaignId','rows','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','findOne','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','omit','spread','dialCheckDuplicateType','always','insert'];(function(_0x131162,_0x4c2814){var _0x45285d=function(_0x19fb1f){while(--_0x19fb1f){_0x131162['push'](_0x131162['shift']());}};_0x45285d(++_0x4c2814);}(_0x39d0,0x144));var _0x039d=function(_0x4835fc,_0x53ffb5){_0x4835fc=_0x4835fc-0x0;var _0x295770=_0x39d0[_0x4835fc];return _0x295770;};'use strict';var emlformat=require(_0x039d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x039d('0x1'));var rp=require(_0x039d('0x2'));var moment=require(_0x039d('0x3'));var BPromise=require(_0x039d('0x4'));var Mustache=require(_0x039d('0x5'));var util=require('util');var path=require(_0x039d('0x6'));var sox=require(_0x039d('0x7'));var csv=require(_0x039d('0x8'));var ejs=require(_0x039d('0x9'));var fs=require('fs');var fs_extra=require(_0x039d('0xa'));var _=require(_0x039d('0xb'));var squel=require(_0x039d('0xc'));var crypto=require(_0x039d('0xd'));var jsforce=require(_0x039d('0xe'));var deskjs=require(_0x039d('0xf'));var toCsv=require(_0x039d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x039d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x039d('0x11'));var as=require(_0x039d('0x12'));var hardwareService=require(_0x039d('0x13'));var logger=require(_0x039d('0x14'))('api');var utils=require(_0x039d('0x15'));var config=require(_0x039d('0x16'));var licenseUtil=require(_0x039d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9930eb,_0x111f41){_0x111f41=_0x111f41||0xcc;return function(_0x24de67){if(_0x24de67){return _0x9930eb[_0x039d('0x18')](_0x111f41);}return _0x9930eb[_0x039d('0x19')](_0x111f41)[_0x039d('0x1a')]();};}function respondWithResult(_0x3147c0,_0x54cf8e){_0x54cf8e=_0x54cf8e||0xc8;return function(_0x4dc3a4){if(_0x4dc3a4){return _0x3147c0[_0x039d('0x19')](_0x54cf8e)[_0x039d('0x1b')](_0x4dc3a4);}};}function respondWithFilteredResult(_0x33e289,_0x138193){return function(_0x24c16f){if(_0x24c16f){var _0x330966=typeof _0x138193['offset']===_0x039d('0x1c')&&typeof _0x138193[_0x039d('0x1d')]===_0x039d('0x1c');var _0x4dfc0c=_0x24c16f['count'];var _0xaedb24=_0x330966?0x0:_0x138193[_0x039d('0x1e')];var _0x360233=_0x330966?_0x24c16f['count']:_0x138193['offset']+_0x138193[_0x039d('0x1d')];var _0x37ff76;if(_0x360233>=_0x4dfc0c){_0x360233=_0x4dfc0c;_0x37ff76=0xc8;}else{_0x37ff76=0xce;}_0x33e289['status'](_0x37ff76);return _0x33e289['set'](_0x039d('0x1f'),_0xaedb24+'-'+_0x360233+'/'+_0x4dfc0c)['json'](_0x24c16f);}return null;};}function patchUpdates(_0x2a8602){return function(_0x1e526e){try{jsonpatch['apply'](_0x1e526e,_0x2a8602,!![]);}catch(_0x2e33e1){return BPromise[_0x039d('0x20')](_0x2e33e1);}return _0x1e526e['save']();};}function saveUpdates(_0x6e1cb9,_0x15dcaa){return function(_0xd5c776){if(_0xd5c776){return _0xd5c776[_0x039d('0x21')](_0x6e1cb9)[_0x039d('0x22')](function(_0x5b9ade){return _0x5b9ade;});}return null;};}function removeEntity(_0x2f21b7,_0x7e230f){return function(_0x15b103){if(_0x15b103){return _0x15b103['destroy']()[_0x039d('0x22')](function(){var _0x4a3177=_0x15b103[_0x039d('0x23')]({'plain':!![]});var _0x109b2b=_0x039d('0x24');return db['UserProfileResource'][_0x039d('0x25')]({'where':{'type':_0x109b2b,'resourceId':_0x4a3177['id']}})[_0x039d('0x22')](function(){return _0x15b103;});})[_0x039d('0x22')](function(){_0x2f21b7[_0x039d('0x19')](0xcc)[_0x039d('0x1a')]();});}};}function handleEntityNotFound(_0x1ef877,_0x3ad778){return function(_0x170e34){if(!_0x170e34){_0x1ef877[_0x039d('0x18')](0x194);}return _0x170e34;};}function handleError(_0x9da588,_0x33f704){_0x33f704=_0x33f704||0x1f4;return function(_0x38ff1e){logger[_0x039d('0x26')](_0x38ff1e[_0x039d('0x27')]);if(_0x38ff1e[_0x039d('0x28')]){delete _0x38ff1e[_0x039d('0x28')];}_0x9da588[_0x039d('0x19')](_0x33f704)[_0x039d('0x29')](_0x38ff1e);};}exports[_0x039d('0x2a')]=function(_0xf477c5,_0x1f89a5){var _0xf074d8={},_0xf32a01={},_0x2eef2b={'count':0x0,'rows':[]};var _0x1babe4=_[_0x039d('0x2b')](db['Campaign']['rawAttributes'],function(_0x12ee85){return{'name':_0x12ee85['fieldName'],'type':_0x12ee85['type'][_0x039d('0x2c')]};});_0xf32a01[_0x039d('0x2d')]=_[_0x039d('0x2b')](_0x1babe4,_0x039d('0x28'));_0xf32a01[_0x039d('0x2e')]=_[_0x039d('0x2f')](_0xf477c5['query']);_0xf32a01['filters']=_[_0x039d('0x30')](_0xf32a01[_0x039d('0x2d')],_0xf32a01['query']);_0xf074d8[_0x039d('0x31')]=_[_0x039d('0x30')](_0xf32a01['model'],qs[_0x039d('0x32')](_0xf477c5[_0x039d('0x2e')][_0x039d('0x32')]));_0xf074d8[_0x039d('0x31')]=_0xf074d8['attributes']['length']?_0xf074d8[_0x039d('0x31')]:_0xf32a01[_0x039d('0x2d')];if(!_0xf477c5[_0x039d('0x2e')][_0x039d('0x33')](_0x039d('0x34'))){_0xf074d8['limit']=qs[_0x039d('0x1d')](_0xf477c5[_0x039d('0x2e')][_0x039d('0x1d')]);_0xf074d8[_0x039d('0x1e')]=qs[_0x039d('0x1e')](_0xf477c5['query'][_0x039d('0x1e')]);}_0xf074d8[_0x039d('0x35')]=qs[_0x039d('0x36')](_0xf477c5['query'][_0x039d('0x36')]);_0xf074d8[_0x039d('0x37')]=qs[_0x039d('0x38')](_[_0x039d('0x39')](_0xf477c5['query'],_0xf32a01[_0x039d('0x38')]),_0x1babe4);if(_0xf477c5[_0x039d('0x2e')][_0x039d('0x3a')]){_0xf074d8[_0x039d('0x37')]=_['merge'](_0xf074d8['where'],{'$or':_[_0x039d('0x2b')](_0x1babe4,function(_0x1b83ba){if(_0x1b83ba[_0x039d('0x3b')]!==_0x039d('0x3c')){var _0xbb1a62={};_0xbb1a62[_0x1b83ba['name']]={'$like':'%'+_0xf477c5[_0x039d('0x2e')]['filter']+'%'};return _0xbb1a62;}})});}_0xf074d8=_[_0x039d('0x3d')]({},_0xf074d8,_0xf477c5['options']);var _0x40df67={'where':_0xf074d8[_0x039d('0x37')]};return db[_0x039d('0x3e')][_0x039d('0x3f')](_0x40df67)['then'](function(_0x397d9e){_0x2eef2b[_0x039d('0x3f')]=_0x397d9e;if(_0xf477c5['query'][_0x039d('0x40')]){_0xf074d8[_0x039d('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0xf074d8);})[_0x039d('0x22')](function(_0x4485dc){_0x2eef2b['rows']=_0x4485dc;return _0x2eef2b;})[_0x039d('0x22')](respondWithFilteredResult(_0x1f89a5,_0xf074d8))[_0x039d('0x42')](handleError(_0x1f89a5,null));};exports[_0x039d('0x43')]=function(_0x13e74c,_0x3c39ec){var _0x35da4d={'raw':![],'where':{'id':_0x13e74c[_0x039d('0x44')]['id']}},_0x18f09e={};_0x18f09e['model']=_['keys'](db['Campaign'][_0x039d('0x45')]);_0x18f09e[_0x039d('0x2e')]=_['keys'](_0x13e74c[_0x039d('0x2e')]);_0x18f09e[_0x039d('0x38')]=_[_0x039d('0x30')](_0x18f09e[_0x039d('0x2d')],_0x18f09e[_0x039d('0x2e')]);_0x35da4d['attributes']=_[_0x039d('0x30')](_0x18f09e[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x13e74c[_0x039d('0x2e')]['fields']));_0x35da4d[_0x039d('0x31')]=_0x35da4d[_0x039d('0x31')]['length']?_0x35da4d['attributes']:_0x18f09e['model'];if(_0x13e74c[_0x039d('0x2e')]['includeAll']){_0x35da4d[_0x039d('0x41')]=[{'all':!![]}];}_0x35da4d=_[_0x039d('0x3d')]({},_0x35da4d,_0x13e74c[_0x039d('0x46')]);return db[_0x039d('0x3e')]['find'](_0x35da4d)[_0x039d('0x22')](handleEntityNotFound(_0x3c39ec,null))[_0x039d('0x22')](respondWithResult(_0x3c39ec,null))[_0x039d('0x42')](handleError(_0x3c39ec,null));};exports['create']=function(_0x207835,_0x763622){return db[_0x039d('0x3e')][_0x039d('0x47')](_0x207835[_0x039d('0x48')],{})[_0x039d('0x22')](function(_0x11642b){var _0x1efc9e=_0x207835[_0x039d('0x49')]['get']({'plain':!![]});if(!_0x1efc9e)throw new Error(_0x039d('0x4a'));if(_0x1efc9e[_0x039d('0x4b')]===_0x039d('0x49')){var _0x6a7798=_0x11642b[_0x039d('0x23')]({'plain':!![]});var _0x43c3f5=_0x039d('0x24');return db[_0x039d('0x4c')][_0x039d('0x4d')]({'where':{'name':_0x43c3f5,'userProfileId':_0x1efc9e['userProfileId']},'raw':!![]})[_0x039d('0x22')](function(_0x4f6323){if(_0x4f6323&&_0x4f6323[_0x039d('0x4e')]===0x0){return db['UserProfileResource'][_0x039d('0x47')]({'name':_0x6a7798[_0x039d('0x28')],'resourceId':_0x6a7798['id'],'type':_0x4f6323['name'],'sectionId':_0x4f6323['id']},{})['then'](function(){return _0x11642b;});}else{return _0x11642b;}})[_0x039d('0x42')](function(_0x226628){logger[_0x039d('0x26')](_0x039d('0x4f'),_0x226628);throw _0x226628;});}return _0x11642b;})[_0x039d('0x22')](respondWithResult(_0x763622,0xc9))['catch'](handleError(_0x763622,null));};exports['clone']=function(_0x482c77,_0x3613a5){var _0x56834c={'where':{'id':_0x482c77['params']['id']}},_0x45cd5b={};_0x45cd5b[_0x039d('0x2d')]=_[_0x039d('0x2f')](db['Campaign'][_0x039d('0x45')]);_0x56834c[_0x039d('0x31')]=_['intersection'](_0x45cd5b[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x482c77[_0x039d('0x2e')][_0x039d('0x32')]));_0x56834c[_0x039d('0x31')]=_0x56834c[_0x039d('0x31')][_0x039d('0x50')]?_0x56834c[_0x039d('0x31')]:_0x45cd5b[_0x039d('0x2d')];if(_0x482c77[_0x039d('0x2e')][_0x039d('0x40')]){_0x56834c[_0x039d('0x41')]=[{'all':!![]}];}_0x56834c=_['merge']({},_0x56834c,_0x482c77[_0x039d('0x46')]);return db[_0x039d('0x3e')][_0x039d('0x4d')](_0x56834c)[_0x039d('0x22')](handleEntityNotFound(_0x3613a5,null))[_0x039d('0x22')](function(_0x56b61c){if(_0x56b61c){var _0x4f8559=_0x56b61c[_0x039d('0x23')]({'plain':!![]});_0x4f8559=qs['omit'](_0x4f8559,['id','createdAt',_0x039d('0x51')]);_0x482c77[_0x039d('0x48')]=_['omit'](_0x482c77[_0x039d('0x48')],['id',_0x039d('0x52'),'updatedAt']);return db[_0x039d('0x3e')][_0x039d('0x47')](_[_0x039d('0x3d')](_0x4f8559,_0x482c77['body']),{'include':_0x482c77[_0x039d('0x2e')][_0x039d('0x40')]?[{'all':!![]}]:undefined})[_0x039d('0x22')](function(_0x4729dc){var _0x536bce=_0x482c77['user'][_0x039d('0x23')]({'plain':!![]});if(!_0x536bce)throw new Error(_0x039d('0x4a'));if(_0x536bce[_0x039d('0x4b')]===_0x039d('0x49')){var _0x44ab8a=_0x4729dc[_0x039d('0x23')]({'plain':!![]});var _0x5b3083=_0x039d('0x24');return db[_0x039d('0x4c')][_0x039d('0x4d')]({'where':{'name':_0x5b3083,'userProfileId':_0x536bce['userProfileId']},'raw':!![]})[_0x039d('0x22')](function(_0x14ed0f){if(_0x14ed0f&&_0x14ed0f[_0x039d('0x4e')]===0x0){return db[_0x039d('0x53')][_0x039d('0x47')]({'name':_0x44ab8a[_0x039d('0x28')],'resourceId':_0x44ab8a['id'],'type':_0x14ed0f['name'],'sectionId':_0x14ed0f['id']},{})[_0x039d('0x22')](function(){return _0x4729dc;});}else{return _0x4729dc;}})['catch'](function(_0x5c29b0){logger[_0x039d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c29b0);throw _0x5c29b0;});}return _0x4729dc;});}})[_0x039d('0x22')](respondWithResult(_0x3613a5,0xc9))[_0x039d('0x42')](handleError(_0x3613a5,null));};exports['update']=function(_0x338a03,_0x2fbf5f){if(_0x338a03['body']['id']){delete _0x338a03[_0x039d('0x48')]['id'];}return db['Campaign'][_0x039d('0x4d')]({'where':{'id':_0x338a03[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x2fbf5f,null))[_0x039d('0x22')](saveUpdates(_0x338a03[_0x039d('0x48')],null))[_0x039d('0x22')](respondWithResult(_0x2fbf5f,null))[_0x039d('0x42')](handleError(_0x2fbf5f,null));};exports[_0x039d('0x25')]=function(_0x2eeb5d,_0x3f8fc2){return db['Campaign'][_0x039d('0x4d')]({'where':{'id':_0x2eeb5d[_0x039d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f8fc2,null))[_0x039d('0x22')](removeEntity(_0x3f8fc2,null))[_0x039d('0x42')](handleError(_0x3f8fc2,null));};exports[_0x039d('0x54')]=function(_0x3de906,_0xb8c3a0,_0x345e23){var _0x6bfc15={'raw':!![],'where':{}};var _0x4256a8={};var _0x12d02c={'count':0x0,'rows':[]};return db[_0x039d('0x3e')]['findOne']({'where':{'id':_0x3de906[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0xb8c3a0,null))[_0x039d('0x22')](function(_0x2304b3){if(_0x2304b3){_0x4256a8[_0x039d('0x2d')]=_[_0x039d('0x2f')](db[_0x039d('0x55')]['rawAttributes']);_0x4256a8[_0x039d('0x2e')]=_['keys'](_0x3de906[_0x039d('0x2e')]);_0x4256a8['filters']=_['intersection'](_0x4256a8[_0x039d('0x2d')],_0x4256a8[_0x039d('0x2e')]);_0x6bfc15[_0x039d('0x31')]=_['intersection'](_0x4256a8[_0x039d('0x2d')],qs['fields'](_0x3de906['query'][_0x039d('0x32')]));_0x6bfc15[_0x039d('0x31')]=_0x6bfc15['attributes'][_0x039d('0x50')]?_0x6bfc15['attributes']:_0x4256a8[_0x039d('0x2d')];if(!_0x3de906[_0x039d('0x2e')]['hasOwnProperty'](_0x039d('0x34'))){_0x6bfc15[_0x039d('0x1d')]=qs['limit'](_0x3de906[_0x039d('0x2e')][_0x039d('0x1d')]);_0x6bfc15['offset']=qs[_0x039d('0x1e')](_0x3de906[_0x039d('0x2e')][_0x039d('0x1e')]);}_0x6bfc15['order']=qs['sort'](_0x3de906[_0x039d('0x2e')][_0x039d('0x36')]);_0x6bfc15[_0x039d('0x37')]=qs[_0x039d('0x38')](_[_0x039d('0x39')](_0x3de906[_0x039d('0x2e')],_0x4256a8[_0x039d('0x38')]));_0x6bfc15[_0x039d('0x37')][_0x039d('0x56')]=_0x2304b3['id'];if(_0x3de906[_0x039d('0x2e')]['filter']){_0x6bfc15[_0x039d('0x37')]=_[_0x039d('0x3d')](_0x6bfc15['where'],{'$or':_['map'](_0x6bfc15[_0x039d('0x31')],function(_0x2dc97f){var _0x3172e0={};_0x3172e0[_0x2dc97f]={'$like':'%'+_0x3de906[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x3172e0;})});}_0x6bfc15=_[_0x039d('0x3d')]({},_0x6bfc15,_0x3de906[_0x039d('0x46')]);return db[_0x039d('0x55')][_0x039d('0x3f')]({'where':_0x6bfc15[_0x039d('0x37')]})[_0x039d('0x22')](function(_0x298786){_0x12d02c[_0x039d('0x3f')]=_0x298786;if(_0x3de906['query']['includeAll']){_0x6bfc15[_0x039d('0x41')]=[{'all':!![]}];}return db[_0x039d('0x55')]['findAll'](_0x6bfc15);})[_0x039d('0x22')](function(_0x4c7d3e){_0x12d02c[_0x039d('0x57')]=_0x4c7d3e;return _0x12d02c;});}})[_0x039d('0x22')](respondWithFilteredResult(_0xb8c3a0,_0x6bfc15))[_0x039d('0x42')](handleError(_0xb8c3a0,null));};exports['getHopperHistories']=function(_0x4bbefe,_0x285da7,_0x5595a0){var _0x322b44={'raw':!![],'where':{}};var _0x5e451b={};var _0x102d68={'count':0x0,'rows':[]};return db[_0x039d('0x3e')]['findOne']({'where':{'id':_0x4bbefe[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x285da7,null))[_0x039d('0x22')](function(_0x3c95ea){if(_0x3c95ea){_0x5e451b['model']=_[_0x039d('0x2f')](db[_0x039d('0x58')][_0x039d('0x45')]);_0x5e451b[_0x039d('0x2e')]=_[_0x039d('0x2f')](_0x4bbefe[_0x039d('0x2e')]);_0x5e451b[_0x039d('0x38')]=_[_0x039d('0x30')](_0x5e451b[_0x039d('0x2d')],_0x5e451b[_0x039d('0x2e')]);_0x322b44[_0x039d('0x31')]=_['intersection'](_0x5e451b[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x4bbefe[_0x039d('0x2e')][_0x039d('0x32')]));_0x322b44[_0x039d('0x31')]=_0x322b44[_0x039d('0x31')]['length']?_0x322b44[_0x039d('0x31')]:_0x5e451b['model'];if(!_0x4bbefe['query']['hasOwnProperty'](_0x039d('0x34'))){_0x322b44[_0x039d('0x1d')]=qs[_0x039d('0x1d')](_0x4bbefe[_0x039d('0x2e')][_0x039d('0x1d')]);_0x322b44[_0x039d('0x1e')]=qs[_0x039d('0x1e')](_0x4bbefe['query'][_0x039d('0x1e')]);}_0x322b44[_0x039d('0x35')]=qs['sort'](_0x4bbefe[_0x039d('0x2e')][_0x039d('0x36')]);_0x322b44[_0x039d('0x37')]=qs['filters'](_['pick'](_0x4bbefe[_0x039d('0x2e')],_0x5e451b[_0x039d('0x38')]));_0x322b44[_0x039d('0x37')]['CampaignId']=_0x3c95ea['id'];if(_0x4bbefe[_0x039d('0x2e')][_0x039d('0x3a')]){_0x322b44[_0x039d('0x37')]=_[_0x039d('0x3d')](_0x322b44[_0x039d('0x37')],{'$or':_[_0x039d('0x2b')](_0x322b44[_0x039d('0x31')],function(_0x1d42c8){var _0x3a6bb4={};_0x3a6bb4[_0x1d42c8]={'$like':'%'+_0x4bbefe[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x3a6bb4;})});}_0x322b44=_[_0x039d('0x3d')]({},_0x322b44,_0x4bbefe[_0x039d('0x46')]);return db[_0x039d('0x58')][_0x039d('0x3f')]({'where':_0x322b44[_0x039d('0x37')]})[_0x039d('0x22')](function(_0x2d7e97){_0x102d68[_0x039d('0x3f')]=_0x2d7e97;if(_0x4bbefe[_0x039d('0x2e')][_0x039d('0x40')]){_0x322b44[_0x039d('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x039d('0x59')](_0x322b44);})[_0x039d('0x22')](function(_0x3f8be2){_0x102d68['rows']=_0x3f8be2;return _0x102d68;});}})[_0x039d('0x22')](respondWithFilteredResult(_0x285da7,_0x322b44))[_0x039d('0x42')](handleError(_0x285da7,null));};exports[_0x039d('0x5a')]=function(_0x52666f,_0x107679,_0x2c03ab){var _0x17200c={'raw':!![],'where':{}};var _0x5e1b33={};var _0x2c1982={'count':0x0,'rows':[]};return db[_0x039d('0x3e')]['findOne']({'where':{'id':_0x52666f[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x107679,null))[_0x039d('0x22')](function(_0x46c177){if(_0x46c177){_0x5e1b33[_0x039d('0x2d')]=_[_0x039d('0x2f')](db[_0x039d('0x5b')][_0x039d('0x45')]);_0x5e1b33[_0x039d('0x2e')]=_['keys'](_0x52666f[_0x039d('0x2e')]);_0x5e1b33[_0x039d('0x38')]=_['intersection'](_0x5e1b33[_0x039d('0x2d')],_0x5e1b33['query']);_0x17200c[_0x039d('0x31')]=_[_0x039d('0x30')](_0x5e1b33[_0x039d('0x2d')],qs['fields'](_0x52666f[_0x039d('0x2e')][_0x039d('0x32')]));_0x17200c['attributes']=_0x17200c[_0x039d('0x31')]['length']?_0x17200c[_0x039d('0x31')]:_0x5e1b33[_0x039d('0x2d')];if(!_0x52666f[_0x039d('0x2e')][_0x039d('0x33')]('nolimit')){_0x17200c[_0x039d('0x1d')]=qs[_0x039d('0x1d')](_0x52666f[_0x039d('0x2e')][_0x039d('0x1d')]);_0x17200c[_0x039d('0x1e')]=qs[_0x039d('0x1e')](_0x52666f['query'][_0x039d('0x1e')]);}_0x17200c[_0x039d('0x35')]=qs[_0x039d('0x36')](_0x52666f[_0x039d('0x2e')][_0x039d('0x36')]);_0x17200c[_0x039d('0x37')]=qs[_0x039d('0x38')](_[_0x039d('0x39')](_0x52666f[_0x039d('0x2e')],_0x5e1b33[_0x039d('0x38')]));_0x17200c[_0x039d('0x37')][_0x039d('0x56')]=_0x46c177['id'];if(_0x52666f[_0x039d('0x2e')][_0x039d('0x3a')]){_0x17200c[_0x039d('0x37')]=_[_0x039d('0x3d')](_0x17200c['where'],{'$or':_[_0x039d('0x2b')](_0x17200c['attributes'],function(_0x1e4942){var _0x266096={};_0x266096[_0x1e4942]={'$like':'%'+_0x52666f[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x266096;})});}_0x17200c=_[_0x039d('0x3d')]({},_0x17200c,_0x52666f[_0x039d('0x46')]);return db['CmHopperFinal'][_0x039d('0x3f')]({'where':_0x17200c[_0x039d('0x37')]})[_0x039d('0x22')](function(_0x281c42){_0x2c1982[_0x039d('0x3f')]=_0x281c42;if(_0x52666f[_0x039d('0x2e')][_0x039d('0x40')]){_0x17200c[_0x039d('0x41')]=[{'all':!![]}];}return db[_0x039d('0x5b')][_0x039d('0x59')](_0x17200c);})[_0x039d('0x22')](function(_0x1a3fb6){_0x2c1982['rows']=_0x1a3fb6;return _0x2c1982;});}})[_0x039d('0x22')](respondWithFilteredResult(_0x107679,_0x17200c))[_0x039d('0x42')](handleError(_0x107679,null));};exports['getHopperBlacks']=function(_0x3f8cc3,_0x5d4328,_0x47b3f2){var _0x2468c8={'raw':!![],'where':{}};var _0x402091={};var _0x393145={'count':0x0,'rows':[]};return db[_0x039d('0x3e')][_0x039d('0x5c')]({'where':{'id':_0x3f8cc3[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x5d4328,null))[_0x039d('0x22')](function(_0x3239b8){if(_0x3239b8){_0x402091[_0x039d('0x2d')]=_['keys'](db[_0x039d('0x5d')][_0x039d('0x45')]);_0x402091[_0x039d('0x2e')]=_[_0x039d('0x2f')](_0x3f8cc3[_0x039d('0x2e')]);_0x402091[_0x039d('0x38')]=_[_0x039d('0x30')](_0x402091[_0x039d('0x2d')],_0x402091[_0x039d('0x2e')]);_0x2468c8[_0x039d('0x31')]=_[_0x039d('0x30')](_0x402091[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x32')]));_0x2468c8[_0x039d('0x31')]=_0x2468c8['attributes']['length']?_0x2468c8[_0x039d('0x31')]:_0x402091[_0x039d('0x2d')];if(!_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x33')](_0x039d('0x34'))){_0x2468c8[_0x039d('0x1d')]=qs[_0x039d('0x1d')](_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x1d')]);_0x2468c8[_0x039d('0x1e')]=qs[_0x039d('0x1e')](_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x1e')]);}_0x2468c8[_0x039d('0x35')]=qs[_0x039d('0x36')](_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x36')]);_0x2468c8[_0x039d('0x37')]=qs['filters'](_[_0x039d('0x39')](_0x3f8cc3[_0x039d('0x2e')],_0x402091['filters']));_0x2468c8[_0x039d('0x37')]['CampaignId']=_0x3239b8['id'];if(_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x3a')]){_0x2468c8[_0x039d('0x37')]=_[_0x039d('0x3d')](_0x2468c8['where'],{'$or':_['map'](_0x2468c8[_0x039d('0x31')],function(_0x1558c3){var _0x483097={};_0x483097[_0x1558c3]={'$like':'%'+_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x483097;})});}_0x2468c8=_[_0x039d('0x3d')]({},_0x2468c8,_0x3f8cc3[_0x039d('0x46')]);return db[_0x039d('0x5d')][_0x039d('0x3f')]({'where':_0x2468c8['where']})[_0x039d('0x22')](function(_0x3cd9ff){_0x393145[_0x039d('0x3f')]=_0x3cd9ff;if(_0x3f8cc3[_0x039d('0x2e')][_0x039d('0x40')]){_0x2468c8[_0x039d('0x41')]=[{'all':!![]}];}return db[_0x039d('0x5d')]['findAll'](_0x2468c8);})['then'](function(_0x4021f0){_0x393145[_0x039d('0x57')]=_0x4021f0;return _0x393145;});}})[_0x039d('0x22')](respondWithFilteredResult(_0x5d4328,_0x2468c8))['catch'](handleError(_0x5d4328,null));};exports[_0x039d('0x5e')]=function(_0x601405,_0x40aa7b,_0xe171e9){var _0x75447b={};var _0x1f6425={};var _0x4f81a1;var _0x10de9f;return db['Campaign']['findOne']({'where':{'id':_0x601405['params']['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x40aa7b,null))[_0x039d('0x22')](function(_0x2206f3){if(_0x2206f3){_0x4f81a1=_0x2206f3;_0x1f6425['model']=_[_0x039d('0x2f')](db[_0x039d('0x5f')][_0x039d('0x45')]);_0x1f6425['query']=_['keys'](_0x601405[_0x039d('0x2e')]);_0x1f6425[_0x039d('0x38')]=_[_0x039d('0x30')](_0x1f6425[_0x039d('0x2d')],_0x1f6425[_0x039d('0x2e')]);_0x75447b[_0x039d('0x31')]=_[_0x039d('0x30')](_0x1f6425[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x601405[_0x039d('0x2e')][_0x039d('0x32')]));_0x75447b[_0x039d('0x31')]=_0x75447b['attributes'][_0x039d('0x50')]?_0x75447b['attributes']:_0x1f6425[_0x039d('0x2d')];_0x75447b['order']=qs[_0x039d('0x36')](_0x601405['query'][_0x039d('0x36')]);_0x75447b[_0x039d('0x37')]=qs[_0x039d('0x38')](_['pick'](_0x601405[_0x039d('0x2e')],_0x1f6425['filters']));if(_0x601405['query'][_0x039d('0x3a')]){_0x75447b[_0x039d('0x37')]=_[_0x039d('0x3d')](_0x75447b['where'],{'$or':_[_0x039d('0x2b')](_0x75447b[_0x039d('0x31')],function(_0x853111){var _0x3279e2={};_0x3279e2[_0x853111]={'$like':'%'+_0x601405[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x3279e2;})});}_0x75447b=_[_0x039d('0x3d')]({},_0x75447b,_0x601405[_0x039d('0x46')]);return _0x4f81a1[_0x039d('0x5e')](_0x75447b);}})[_0x039d('0x22')](function(_0x50938a){if(_0x50938a){_0x10de9f=_0x50938a[_0x039d('0x50')];if(!_0x601405[_0x039d('0x2e')][_0x039d('0x33')]('nolimit')){_0x75447b[_0x039d('0x1d')]=qs[_0x039d('0x1d')](_0x601405['query'][_0x039d('0x1d')]);_0x75447b[_0x039d('0x1e')]=qs['offset'](_0x601405[_0x039d('0x2e')][_0x039d('0x1e')]);}return _0x4f81a1[_0x039d('0x5e')](_0x75447b);}})['then'](function(_0x4ba749){if(_0x4ba749){return _0x4ba749?{'count':_0x10de9f,'rows':_0x4ba749}:null;}})[_0x039d('0x22')](respondWithResult(_0x40aa7b,null))[_0x039d('0x42')](handleError(_0x40aa7b,null));};exports[_0x039d('0x60')]=function(_0x4b2a2d,_0x1bedc0,_0x372c50){var _0x1d9e51,_0x34af30;var _0x13d85d=[];var _0x278d69=moment()[_0x039d('0x61')](_0x039d('0x62'));return db[_0x039d('0x3e')][_0x039d('0x4d')]({'where':{'id':_0x4b2a2d[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x1bedc0,null))[_0x039d('0x22')](function(_0x328f00){if(_0x328f00){_0x34af30=_0x328f00;return _0x328f00[_0x039d('0x60')](_0x4b2a2d[_0x039d('0x48')][_0x039d('0x63')],_[_0x039d('0x64')](_0x4b2a2d[_0x039d('0x48')],[_0x039d('0x63'),'id'])||{});}return null;})[_0x039d('0x65')](function(_0x3cdaff){var _0x3c8b9d;var _0xb03b44;_0x1d9e51=_0x3cdaff||[];var _0xdd86ad=[];if(_0x3cdaff){for(var _0x1a6c95=0x0;_0x1a6c95<_0x3cdaff['length'];_0x1a6c95+=0x1){var _0x5e6aa1=_0x3cdaff[_0x1a6c95][_0x039d('0x23')]({'plain':!![]});_0x34af30[_0x039d('0x66')]=_0x4b2a2d[_0x039d('0x48')][_0x039d('0x66')]?_0x4b2a2d[_0x039d('0x48')][_0x039d('0x66')]:_0x34af30['dialCheckDuplicateType'];switch(_0x34af30[_0x039d('0x66')]){case _0x039d('0x67'):_0x3c8b9d=squel[_0x039d('0x68')]()[_0x039d('0x69')](_0x039d('0x6a'))['fromQuery'](['phone',_0x039d('0x6b'),_0x039d('0x6c'),_0x039d('0x6d'),_0x039d('0x56'),_0x039d('0x52'),_0x039d('0x51')],squel[_0x039d('0x6e')]()[_0x039d('0x6f')](_0x039d('0x70'),_0x039d('0x70'))[_0x039d('0x6f')](_0x039d('0x71'),_0x039d('0x6b'))[_0x039d('0x6f')]('id','ContactId')[_0x039d('0x6f')](_0x5e6aa1[_0x039d('0x72')][_0x039d('0x73')](),_0x039d('0x6d'))[_0x039d('0x6f')](_0x4b2a2d[_0x039d('0x44')]['id'][_0x039d('0x73')](),_0x039d('0x56'))['field']('\x27'+_0x278d69+'\x27','createdAt')[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x51'))[_0x039d('0x74')](_0x039d('0x75'))[_0x039d('0x37')](_0x039d('0x76'))[_0x039d('0x37')](_0x039d('0x77'),_0x5e6aa1[_0x039d('0x72')][_0x039d('0x73')]())[_0x039d('0x37')](_0x039d('0x78'))[_0x039d('0x37')](_0x039d('0x79'),squel[_0x039d('0x6e')]()['field'](_0x039d('0x7a'))[_0x039d('0x74')](_0x039d('0x7b'))[_0x039d('0x37')]('CampaignId\x20=\x20?',_0x4b2a2d[_0x039d('0x44')]['id'][_0x039d('0x73')]()))[_0x039d('0x37')](_0x039d('0x79'),squel[_0x039d('0x6e')]()['field'](_0x039d('0x7c'))[_0x039d('0x74')]('cm_hopper')[_0x039d('0x37')](_0x039d('0x7d'),_0x4b2a2d[_0x039d('0x44')]['id'][_0x039d('0x73')]())))['toString']();break;case _0x039d('0x7e'):_0x3c8b9d=squel[_0x039d('0x68')]()[_0x039d('0x69')](_0x039d('0x6a'))[_0x039d('0x7f')](['phone',_0x039d('0x6b'),_0x039d('0x6c'),_0x039d('0x6d'),_0x039d('0x56'),'createdAt',_0x039d('0x51')],squel[_0x039d('0x6e')]()['field']('phone',_0x039d('0x70'))[_0x039d('0x6f')]('NOW()',_0x039d('0x6b'))['field']('id',_0x039d('0x6c'))[_0x039d('0x6f')](_0x5e6aa1[_0x039d('0x72')][_0x039d('0x73')](),_0x039d('0x6d'))[_0x039d('0x6f')](_0x4b2a2d[_0x039d('0x44')]['id'][_0x039d('0x73')](),_0x039d('0x56'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x52'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x51'))[_0x039d('0x74')](_0x039d('0x75'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x5e6aa1[_0x039d('0x72')][_0x039d('0x73')]())[_0x039d('0x37')](_0x039d('0x78'))[_0x039d('0x37')](_0x039d('0x79'),squel[_0x039d('0x6e')]()[_0x039d('0x6f')](_0x039d('0x7c'))[_0x039d('0x74')](_0x039d('0x6a'))[_0x039d('0x37')](_0x039d('0x7d'),_0x4b2a2d[_0x039d('0x44')]['id'][_0x039d('0x73')]())))[_0x039d('0x73')]();break;default:_0x3c8b9d=squel[_0x039d('0x68')]()[_0x039d('0x69')](_0x039d('0x6a'))['fromQuery']([_0x039d('0x70'),_0x039d('0x6b'),'ContactId',_0x039d('0x6d'),_0x039d('0x56'),_0x039d('0x52'),_0x039d('0x51')],squel[_0x039d('0x6e')]()['field'](_0x039d('0x70'),_0x039d('0x70'))['field'](_0x039d('0x71'),'scheduledAt')['field']('id',_0x039d('0x6c'))[_0x039d('0x6f')](_0x5e6aa1['CmListId'][_0x039d('0x73')](),_0x039d('0x6d'))[_0x039d('0x6f')](_0x4b2a2d[_0x039d('0x44')]['id']['toString'](),_0x039d('0x56'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x52'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x51'))['from'](_0x039d('0x75'))[_0x039d('0x37')](_0x039d('0x76'))['where']('ListId\x20=\x20?',_0x5e6aa1[_0x039d('0x72')][_0x039d('0x73')]())[_0x039d('0x37')](_0x039d('0x78')))['toString']();}_0xb03b44=squel['insert']()['into'](_0x039d('0x80'))[_0x039d('0x7f')]([_0x039d('0x81'),_0x039d('0x6b'),_0x039d('0x70'),'OrderBy','createdAt',_0x039d('0x51')],squel[_0x039d('0x6e')]()['field'](_0x039d('0x82'),'id')[_0x039d('0x6f')](_0x039d('0x71'),'scheduledAt')['field']('ci.item',_0x039d('0x70'))['field']('ci.OrderBY',_0x039d('0x83'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x52'))[_0x039d('0x6f')]('\x27'+_0x278d69+'\x27',_0x039d('0x51'))['from']('cm_contact_has_items','ci')[_0x039d('0x84')](_0x039d('0x6a'),'h',_0x039d('0x85'))['where']('h.ListId\x20=\x20?',_0x5e6aa1['CmListId'][_0x039d('0x73')]())[_0x039d('0x37')](_0x039d('0x86'),_0x4b2a2d[_0x039d('0x44')]['id']['toString']())[_0x039d('0x37')](_0x039d('0x87'),_0x278d69))[_0x039d('0x73')]();_0xdd86ad['push'](db[_0x039d('0x88')]['query'](_0x3c8b9d));_0x13d85d[_0x039d('0x89')](db[_0x039d('0x88')][_0x039d('0x2e')](_0xb03b44));}return BPromise['all'](_0xdd86ad);}})[_0x039d('0x22')](function(){return BPromise[_0x039d('0x8a')](_0x13d85d);})[_0x039d('0x22')](function(){return _0x1d9e51;})['then'](respondWithResult(_0x1bedc0,null))['catch'](handleError(_0x1bedc0,null));};exports[_0x039d('0x8b')]=function(_0x363d6d,_0x4aedab,_0x7f77fe){return db[_0x039d('0x3e')][_0x039d('0x4d')]({'where':{'id':_0x363d6d['params']['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x4aedab,null))[_0x039d('0x22')](function(_0x200f24){if(_0x200f24){return _0x200f24[_0x039d('0x8b')](_0x363d6d[_0x039d('0x2e')]['ids']);}})[_0x039d('0x22')](function(_0x193021){if(_0x193021){return db[_0x039d('0x55')][_0x039d('0x25')]({'where':{'ListId':_0x363d6d['query']['ids'],'CampaignId':_0x363d6d[_0x039d('0x44')]['id']}})[_0x039d('0x22')](function(){return _0x193021;});}})[_0x039d('0x22')](respondWithStatusCode(_0x4aedab,null))[_0x039d('0x42')](handleError(_0x4aedab,null));};exports['getBlackLists']=function(_0x25a310,_0x11a835,_0x31f666){var _0x46752d={};var _0x20b012={};var _0x48a38b;var _0x394251;return db[_0x039d('0x3e')]['findOne']({'where':{'id':_0x25a310[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x11a835,null))[_0x039d('0x22')](function(_0x11146f){if(_0x11146f){_0x48a38b=_0x11146f;_0x20b012[_0x039d('0x2d')]=_[_0x039d('0x2f')](db[_0x039d('0x5f')][_0x039d('0x45')]);_0x20b012[_0x039d('0x2e')]=_[_0x039d('0x2f')](_0x25a310[_0x039d('0x2e')]);_0x20b012[_0x039d('0x38')]=_[_0x039d('0x30')](_0x20b012[_0x039d('0x2d')],_0x20b012[_0x039d('0x2e')]);_0x46752d[_0x039d('0x31')]=_[_0x039d('0x30')](_0x20b012[_0x039d('0x2d')],qs[_0x039d('0x32')](_0x25a310[_0x039d('0x2e')][_0x039d('0x32')]));_0x46752d[_0x039d('0x31')]=_0x46752d[_0x039d('0x31')][_0x039d('0x50')]?_0x46752d[_0x039d('0x31')]:_0x20b012[_0x039d('0x2d')];_0x46752d[_0x039d('0x35')]=qs[_0x039d('0x36')](_0x25a310[_0x039d('0x2e')][_0x039d('0x36')]);_0x46752d['where']=qs[_0x039d('0x38')](_[_0x039d('0x39')](_0x25a310[_0x039d('0x2e')],_0x20b012['filters']));if(_0x25a310['query'][_0x039d('0x3a')]){_0x46752d['where']=_[_0x039d('0x3d')](_0x46752d[_0x039d('0x37')],{'$or':_[_0x039d('0x2b')](_0x46752d['attributes'],function(_0x50c6a2){var _0x5b549e={};_0x5b549e[_0x50c6a2]={'$like':'%'+_0x25a310[_0x039d('0x2e')][_0x039d('0x3a')]+'%'};return _0x5b549e;})});}_0x46752d=_[_0x039d('0x3d')]({},_0x46752d,_0x25a310[_0x039d('0x46')]);return _0x48a38b['getBlackLists'](_0x46752d);}})[_0x039d('0x22')](function(_0x17ae98){if(_0x17ae98){_0x394251=_0x17ae98[_0x039d('0x50')];if(!_0x25a310[_0x039d('0x2e')][_0x039d('0x33')](_0x039d('0x34'))){_0x46752d[_0x039d('0x1d')]=qs[_0x039d('0x1d')](_0x25a310[_0x039d('0x2e')][_0x039d('0x1d')]);_0x46752d[_0x039d('0x1e')]=qs[_0x039d('0x1e')](_0x25a310[_0x039d('0x2e')][_0x039d('0x1e')]);}return _0x48a38b[_0x039d('0x8c')](_0x46752d);}})[_0x039d('0x22')](function(_0x4fdfe2){if(_0x4fdfe2){return _0x4fdfe2?{'count':_0x394251,'rows':_0x4fdfe2}:null;}})[_0x039d('0x22')](respondWithResult(_0x11a835,null))[_0x039d('0x42')](handleError(_0x11a835,null));};exports[_0x039d('0x8d')]=function(_0x241ce5,_0x1f9bc7,_0xb512a7){var _0xe543d4,_0x28b87b;var _0x4f03bb=[];var _0x2be376=moment()[_0x039d('0x61')](_0x039d('0x62'));return db[_0x039d('0x3e')][_0x039d('0x4d')]({'where':{'id':_0x241ce5[_0x039d('0x44')]['id']}})[_0x039d('0x22')](handleEntityNotFound(_0x1f9bc7,null))[_0x039d('0x22')](function(_0x4d7133){if(_0x4d7133){_0x28b87b=_0x4d7133;return _0x4d7133[_0x039d('0x8d')](_0x241ce5[_0x039d('0x48')]['ids'],_[_0x039d('0x64')](_0x241ce5[_0x039d('0x48')],[_0x039d('0x63'),'id'])||{});}return null;})[_0x039d('0x65')](function(_0x19a016){var _0x3cf081;var _0x573eed;_0xe543d4=_0x19a016||[];var _0xc8fe5b=[];if(_0x19a016){for(var _0x39154b=0x0;_0x39154b<_0x19a016['length'];_0x39154b+=0x1){var _0x1eaefe=_0x19a016[_0x39154b][_0x039d('0x23')]({'plain':!![]});_0x3cf081=squel[_0x039d('0x68')]()[_0x039d('0x69')]('cm_hopper_black')[_0x039d('0x7f')]([_0x039d('0x70'),'ContactId','ListId',_0x039d('0x56'),_0x039d('0x52'),_0x039d('0x51')],squel[_0x039d('0x6e')]()['field'](_0x039d('0x70'),_0x039d('0x70'))[_0x039d('0x6f')]('id',_0x039d('0x6c'))[_0x039d('0x6f')](_0x1eaefe[_0x039d('0x72')][_0x039d('0x73')](),_0x039d('0x6d'))['field'](_0x241ce5[_0x039d('0x44')]['id'][_0x039d('0x73')](),_0x039d('0x56'))[_0x039d('0x6f')](_0x039d('0x71'),_0x039d('0x52'))[_0x039d('0x6f')](_0x039d('0x71'),_0x039d('0x51'))[_0x039d('0x74')](_0x039d('0x75'))[_0x039d('0x37')](_0x039d('0x76'))[_0x039d('0x37')](_0x039d('0x77'),_0x1eaefe[_0x039d('0x72')]['toString']())[_0x039d('0x37')](_0x039d('0x78')))[_0x039d('0x73')]();_0xc8fe5b['push'](db[_0x039d('0x88')]['query'](_0x3cf081));}return BPromise[_0x039d('0x8a')](_0xc8fe5b);}})[_0x039d('0x22')](function(){return _0xe543d4;})[_0x039d('0x22')](respondWithResult(_0x1f9bc7,null))[_0x039d('0x42')](handleError(_0x1f9bc7,null));};exports[_0x039d('0x8e')]=function(_0x1c70f1,_0x129de4,_0x3da412){return db[_0x039d('0x3e')][_0x039d('0x4d')]({'where':{'id':_0x1c70f1[_0x039d('0x44')]['id']}})['then'](handleEntityNotFound(_0x129de4,null))[_0x039d('0x22')](function(_0x562a05){if(_0x562a05){return _0x562a05[_0x039d('0x8e')](_0x1c70f1[_0x039d('0x2e')][_0x039d('0x63')]);}})[_0x039d('0x22')](function(_0x39cbd3){if(_0x39cbd3){return db[_0x039d('0x5d')][_0x039d('0x25')]({'where':{'ListId':_0x1c70f1[_0x039d('0x2e')][_0x039d('0x63')],'CampaignId':_0x1c70f1['params']['id']}})[_0x039d('0x22')](function(){return _0x39cbd3;});}})[_0x039d('0x22')](respondWithStatusCode(_0x129de4,null))['catch'](handleError(_0x129de4,null));}; \ No newline at end of file +var _0xda66=['../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','get','IvrCampaigns','destroy','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','order','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x32e786,_0x4f8a4d){var _0x13ab55=function(_0x3fe0fa){while(--_0x3fe0fa){_0x32e786['push'](_0x32e786['shift']());}};_0x13ab55(++_0x4f8a4d);}(_0xda66,0x7f));var _0x6da6=function(_0x3c3e20,_0x50ec3f){_0x3c3e20=_0x3c3e20-0x0;var _0x5e43e9=_0xda66[_0x3c3e20];return _0x5e43e9;};'use strict';var emlformat=require(_0x6da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6da6('0x1'));var jsonpatch=require(_0x6da6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6da6('0x3'));var util=require(_0x6da6('0x4'));var path=require(_0x6da6('0x5'));var sox=require(_0x6da6('0x6'));var csv=require(_0x6da6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6da6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6da6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6da6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6da6('0xb'));var Redis=require(_0x6da6('0xc'));var authService=require(_0x6da6('0xd'));var qs=require(_0x6da6('0xe'));var as=require(_0x6da6('0xf'));var hardwareService=require(_0x6da6('0x10'));var logger=require(_0x6da6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6da6('0x12'));var licenseUtil=require(_0x6da6('0x13'));var db=require(_0x6da6('0x14'))['db'];function respondWithStatusCode(_0xa7da31,_0x57d6ad){_0x57d6ad=_0x57d6ad||0xcc;return function(_0x118ac9){if(_0x118ac9){return _0xa7da31['sendStatus'](_0x57d6ad);}return _0xa7da31[_0x6da6('0x15')](_0x57d6ad)[_0x6da6('0x16')]();};}function respondWithResult(_0x173238,_0x44290c){_0x44290c=_0x44290c||0xc8;return function(_0x18a255){if(_0x18a255){return _0x173238[_0x6da6('0x15')](_0x44290c)[_0x6da6('0x17')](_0x18a255);}};}function respondWithFilteredResult(_0x58d817,_0x557e72){return function(_0x50393e){if(_0x50393e){var _0x57348f=typeof _0x557e72['offset']==='undefined'&&typeof _0x557e72[_0x6da6('0x18')]===_0x6da6('0x19');var _0x321c67=_0x50393e[_0x6da6('0x1a')];var _0x2fd36d=_0x57348f?0x0:_0x557e72['offset'];var _0x2bf7d9=_0x57348f?_0x50393e[_0x6da6('0x1a')]:_0x557e72[_0x6da6('0x1b')]+_0x557e72['limit'];var _0x10f673;if(_0x2bf7d9>=_0x321c67){_0x2bf7d9=_0x321c67;_0x10f673=0xc8;}else{_0x10f673=0xce;}_0x58d817['status'](_0x10f673);return _0x58d817[_0x6da6('0x1c')](_0x6da6('0x1d'),_0x2fd36d+'-'+_0x2bf7d9+'/'+_0x321c67)[_0x6da6('0x17')](_0x50393e);}return null;};}function patchUpdates(_0xd63d5b){return function(_0x59b347){try{jsonpatch[_0x6da6('0x1e')](_0x59b347,_0xd63d5b,!![]);}catch(_0x37f406){return BPromise['reject'](_0x37f406);}return _0x59b347[_0x6da6('0x1f')]();};}function saveUpdates(_0x17f731,_0x3ff78b){return function(_0x2366e7){if(_0x2366e7){return _0x2366e7['update'](_0x17f731)[_0x6da6('0x20')](function(_0x34bf25){return _0x34bf25;});}return null;};}function removeEntity(_0x3b7340,_0xe1d27e){return function(_0x48ff63){if(_0x48ff63){return _0x48ff63['destroy']()[_0x6da6('0x20')](function(){var _0x39fb46=_0x48ff63[_0x6da6('0x21')]({'plain':!![]});var _0x30269f=_0x6da6('0x22');return db['UserProfileResource'][_0x6da6('0x23')]({'where':{'type':_0x30269f,'resourceId':_0x39fb46['id']}})[_0x6da6('0x20')](function(){return _0x48ff63;});})[_0x6da6('0x20')](function(){_0x3b7340[_0x6da6('0x15')](0xcc)[_0x6da6('0x16')]();});}};}function handleEntityNotFound(_0x3a3903,_0x15262a){return function(_0x575f7d){if(!_0x575f7d){_0x3a3903[_0x6da6('0x24')](0x194);}return _0x575f7d;};}function handleError(_0x263989,_0x2274ad){_0x2274ad=_0x2274ad||0x1f4;return function(_0x1cd1a4){logger[_0x6da6('0x25')](_0x1cd1a4[_0x6da6('0x26')]);if(_0x1cd1a4[_0x6da6('0x27')]){delete _0x1cd1a4[_0x6da6('0x27')];}_0x263989[_0x6da6('0x15')](_0x2274ad)[_0x6da6('0x28')](_0x1cd1a4);};}exports[_0x6da6('0x29')]=function(_0x5c380b,_0x3d4572){var _0x4b7e10={},_0x945988={},_0x414d68={'count':0x0,'rows':[]};var _0x357b2d=_[_0x6da6('0x2a')](db[_0x6da6('0x2b')][_0x6da6('0x2c')],function(_0x53fad5){return{'name':_0x53fad5[_0x6da6('0x2d')],'type':_0x53fad5[_0x6da6('0x2e')][_0x6da6('0x2f')]};});_0x945988['model']=_[_0x6da6('0x2a')](_0x357b2d,'name');_0x945988[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x5c380b[_0x6da6('0x30')]);_0x945988[_0x6da6('0x32')]=_['intersection'](_0x945988[_0x6da6('0x33')],_0x945988[_0x6da6('0x30')]);_0x4b7e10[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x945988['model'],qs['fields'](_0x5c380b[_0x6da6('0x30')]['fields']));_0x4b7e10[_0x6da6('0x34')]=_0x4b7e10[_0x6da6('0x34')]['length']?_0x4b7e10[_0x6da6('0x34')]:_0x945988['model'];if(!_0x5c380b[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x4b7e10[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x5c380b[_0x6da6('0x30')][_0x6da6('0x18')]);_0x4b7e10['offset']=qs['offset'](_0x5c380b['query']['offset']);}_0x4b7e10['order']=qs[_0x6da6('0x38')](_0x5c380b[_0x6da6('0x30')][_0x6da6('0x38')]);_0x4b7e10[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_['pick'](_0x5c380b[_0x6da6('0x30')],_0x945988[_0x6da6('0x32')]),_0x357b2d);if(_0x5c380b[_0x6da6('0x30')]['filter']){_0x4b7e10[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x4b7e10[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x357b2d,function(_0x19ae4c){if(_0x19ae4c[_0x6da6('0x2e')]!=='VIRTUAL'){var _0x22cd85={};_0x22cd85[_0x19ae4c[_0x6da6('0x27')]]={'$like':'%'+_0x5c380b[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x22cd85;}})});}_0x4b7e10=_[_0x6da6('0x3a')]({},_0x4b7e10,_0x5c380b[_0x6da6('0x3c')]);var _0x3733d4={'where':_0x4b7e10[_0x6da6('0x39')]};return db[_0x6da6('0x2b')][_0x6da6('0x1a')](_0x3733d4)[_0x6da6('0x20')](function(_0x14ede3){_0x414d68['count']=_0x14ede3;if(_0x5c380b[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x4b7e10[_0x6da6('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x6da6('0x3f')](_0x4b7e10);})['then'](function(_0x40bd0e){_0x414d68[_0x6da6('0x40')]=_0x40bd0e;return _0x414d68;})['then'](respondWithFilteredResult(_0x3d4572,_0x4b7e10))[_0x6da6('0x41')](handleError(_0x3d4572,null));};exports['show']=function(_0x588175,_0x9601e2){var _0x13e970={'raw':![],'where':{'id':_0x588175[_0x6da6('0x42')]['id']}},_0x1611df={};_0x1611df[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x2b')][_0x6da6('0x2c')]);_0x1611df[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x588175[_0x6da6('0x30')]);_0x1611df[_0x6da6('0x32')]=_['intersection'](_0x1611df[_0x6da6('0x33')],_0x1611df[_0x6da6('0x30')]);_0x13e970[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x1611df['model'],qs[_0x6da6('0x43')](_0x588175['query'][_0x6da6('0x43')]));_0x13e970['attributes']=_0x13e970[_0x6da6('0x34')][_0x6da6('0x44')]?_0x13e970[_0x6da6('0x34')]:_0x1611df[_0x6da6('0x33')];if(_0x588175[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x13e970['include']=[{'all':!![]}];}_0x13e970=_['merge']({},_0x13e970,_0x588175[_0x6da6('0x3c')]);return db[_0x6da6('0x2b')][_0x6da6('0x45')](_0x13e970)['then'](handleEntityNotFound(_0x9601e2,null))[_0x6da6('0x20')](respondWithResult(_0x9601e2,null))[_0x6da6('0x41')](handleError(_0x9601e2,null));};exports[_0x6da6('0x46')]=function(_0x22e236,_0xc54684){return db[_0x6da6('0x2b')][_0x6da6('0x46')](_0x22e236[_0x6da6('0x47')],{})[_0x6da6('0x20')](function(_0x21f968){var _0x2076be=_0x22e236[_0x6da6('0x48')][_0x6da6('0x21')]({'plain':!![]});if(!_0x2076be)throw new Error(_0x6da6('0x49'));if(_0x2076be[_0x6da6('0x4a')]===_0x6da6('0x48')){var _0x2a6761=_0x21f968[_0x6da6('0x21')]({'plain':!![]});var _0x4121fd=_0x6da6('0x22');return db[_0x6da6('0x4b')][_0x6da6('0x45')]({'where':{'name':_0x4121fd,'userProfileId':_0x2076be[_0x6da6('0x4c')]},'raw':!![]})[_0x6da6('0x20')](function(_0x20bc74){if(_0x20bc74&&_0x20bc74[_0x6da6('0x4d')]===0x0){return db[_0x6da6('0x4e')][_0x6da6('0x46')]({'name':_0x2a6761[_0x6da6('0x27')],'resourceId':_0x2a6761['id'],'type':_0x20bc74[_0x6da6('0x27')],'sectionId':_0x20bc74['id']},{})[_0x6da6('0x20')](function(){return _0x21f968;});}else{return _0x21f968;}})[_0x6da6('0x41')](function(_0x3e468c){logger[_0x6da6('0x25')](_0x6da6('0x4f'),_0x3e468c);throw _0x3e468c;});}return _0x21f968;})[_0x6da6('0x20')](respondWithResult(_0xc54684,0xc9))[_0x6da6('0x41')](handleError(_0xc54684,null));};exports['clone']=function(_0x177a4e,_0x46cb75){var _0x401f57={'where':{'id':_0x177a4e[_0x6da6('0x42')]['id']}},_0x51f0f9={};_0x51f0f9[_0x6da6('0x33')]=_['keys'](db[_0x6da6('0x2b')][_0x6da6('0x2c')]);_0x401f57[_0x6da6('0x34')]=_['intersection'](_0x51f0f9[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x177a4e[_0x6da6('0x30')][_0x6da6('0x43')]));_0x401f57[_0x6da6('0x34')]=_0x401f57[_0x6da6('0x34')]['length']?_0x401f57[_0x6da6('0x34')]:_0x51f0f9[_0x6da6('0x33')];if(_0x177a4e[_0x6da6('0x30')]['includeAll']){_0x401f57['include']=[{'all':!![]}];}_0x401f57=_['merge']({},_0x401f57,_0x177a4e['options']);return db[_0x6da6('0x2b')][_0x6da6('0x45')](_0x401f57)[_0x6da6('0x20')](handleEntityNotFound(_0x46cb75,null))[_0x6da6('0x20')](function(_0x2de317){if(_0x2de317){var _0x25925b=_0x2de317[_0x6da6('0x21')]({'plain':!![]});_0x25925b=qs[_0x6da6('0x50')](_0x25925b,['id',_0x6da6('0x51'),'updatedAt']);_0x177a4e[_0x6da6('0x47')]=_[_0x6da6('0x50')](_0x177a4e[_0x6da6('0x47')],['id',_0x6da6('0x51'),_0x6da6('0x52')]);return db[_0x6da6('0x2b')][_0x6da6('0x46')](_[_0x6da6('0x3a')](_0x25925b,_0x177a4e[_0x6da6('0x47')]),{'include':_0x177a4e['query'][_0x6da6('0x3d')]?[{'all':!![]}]:undefined})[_0x6da6('0x20')](function(_0xd76a95){var _0x3826f4=_0x177a4e[_0x6da6('0x48')][_0x6da6('0x21')]({'plain':!![]});if(!_0x3826f4)throw new Error(_0x6da6('0x49'));if(_0x3826f4[_0x6da6('0x4a')]===_0x6da6('0x48')){var _0x30e35c=_0xd76a95[_0x6da6('0x21')]({'plain':!![]});var _0x57c710=_0x6da6('0x22');return db['UserProfileSection'][_0x6da6('0x45')]({'where':{'name':_0x57c710,'userProfileId':_0x3826f4[_0x6da6('0x4c')]},'raw':!![]})[_0x6da6('0x20')](function(_0x1c3dbc){if(_0x1c3dbc&&_0x1c3dbc[_0x6da6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x30e35c[_0x6da6('0x27')],'resourceId':_0x30e35c['id'],'type':_0x1c3dbc['name'],'sectionId':_0x1c3dbc['id']},{})['then'](function(){return _0xd76a95;});}else{return _0xd76a95;}})[_0x6da6('0x41')](function(_0x416483){logger['error'](_0x6da6('0x4f'),_0x416483);throw _0x416483;});}return _0xd76a95;});}})['then'](respondWithResult(_0x46cb75,0xc9))[_0x6da6('0x41')](handleError(_0x46cb75,null));};exports['update']=function(_0x36a671,_0x1620e7){if(_0x36a671['body']['id']){delete _0x36a671[_0x6da6('0x47')]['id'];}return db[_0x6da6('0x2b')]['find']({'where':{'id':_0x36a671[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x1620e7,null))['then'](saveUpdates(_0x36a671['body'],null))[_0x6da6('0x20')](respondWithResult(_0x1620e7,null))[_0x6da6('0x41')](handleError(_0x1620e7,null));};exports[_0x6da6('0x23')]=function(_0x10f976,_0x4b0e98){return db[_0x6da6('0x2b')]['find']({'where':{'id':_0x10f976[_0x6da6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b0e98,null))[_0x6da6('0x20')](removeEntity(_0x4b0e98,null))[_0x6da6('0x41')](handleError(_0x4b0e98,null));};exports[_0x6da6('0x53')]=function(_0x380ab7,_0xe5277c,_0x42fc41){var _0xc6505c={'raw':!![],'where':{}};var _0x5dfbcf={};var _0x58764f={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x380ab7[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0xe5277c,null))[_0x6da6('0x20')](function(_0x3667e3){if(_0x3667e3){_0x5dfbcf['model']=_[_0x6da6('0x31')](db[_0x6da6('0x55')][_0x6da6('0x2c')]);_0x5dfbcf[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x380ab7['query']);_0x5dfbcf[_0x6da6('0x32')]=_[_0x6da6('0x35')](_0x5dfbcf['model'],_0x5dfbcf[_0x6da6('0x30')]);_0xc6505c['attributes']=_[_0x6da6('0x35')](_0x5dfbcf[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x43')]));_0xc6505c['attributes']=_0xc6505c[_0x6da6('0x34')]['length']?_0xc6505c[_0x6da6('0x34')]:_0x5dfbcf[_0x6da6('0x33')];if(!_0x380ab7[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0xc6505c[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x380ab7['query']['limit']);_0xc6505c[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x1b')]);}_0xc6505c[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x38')]);_0xc6505c['where']=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x380ab7[_0x6da6('0x30')],_0x5dfbcf[_0x6da6('0x32')]));_0xc6505c[_0x6da6('0x39')][_0x6da6('0x58')]=_0x3667e3['id'];if(_0x380ab7[_0x6da6('0x30')][_0x6da6('0x3b')]){_0xc6505c[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0xc6505c['where'],{'$or':_[_0x6da6('0x2a')](_0xc6505c[_0x6da6('0x34')],function(_0x2773ad){var _0x3b12e2={};_0x3b12e2[_0x2773ad]={'$like':'%'+_0x380ab7[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x3b12e2;})});}_0xc6505c=_[_0x6da6('0x3a')]({},_0xc6505c,_0x380ab7[_0x6da6('0x3c')]);return db[_0x6da6('0x55')][_0x6da6('0x1a')]({'where':_0xc6505c['where']})['then'](function(_0x320fab){_0x58764f['count']=_0x320fab;if(_0x380ab7['query'][_0x6da6('0x3d')]){_0xc6505c[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x55')]['findAll'](_0xc6505c);})[_0x6da6('0x20')](function(_0x2b8a4c){_0x58764f[_0x6da6('0x40')]=_0x2b8a4c;return _0x58764f;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0xe5277c,_0xc6505c))['catch'](handleError(_0xe5277c,null));};exports[_0x6da6('0x59')]=function(_0x48bb49,_0x46648d,_0x4487ad){var _0x287042={'raw':!![],'where':{}};var _0x4848e8={};var _0x2658e3={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')]['findOne']({'where':{'id':_0x48bb49[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x46648d,null))[_0x6da6('0x20')](function(_0x4b11a8){if(_0x4b11a8){_0x4848e8[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5a')][_0x6da6('0x2c')]);_0x4848e8[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x48bb49[_0x6da6('0x30')]);_0x4848e8['filters']=_[_0x6da6('0x35')](_0x4848e8[_0x6da6('0x33')],_0x4848e8[_0x6da6('0x30')]);_0x287042['attributes']=_['intersection'](_0x4848e8[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x48bb49[_0x6da6('0x30')][_0x6da6('0x43')]));_0x287042[_0x6da6('0x34')]=_0x287042['attributes'][_0x6da6('0x44')]?_0x287042['attributes']:_0x4848e8[_0x6da6('0x33')];if(!_0x48bb49[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x287042[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x48bb49[_0x6da6('0x30')]['limit']);_0x287042['offset']=qs['offset'](_0x48bb49[_0x6da6('0x30')][_0x6da6('0x1b')]);}_0x287042['order']=qs[_0x6da6('0x38')](_0x48bb49[_0x6da6('0x30')]['sort']);_0x287042[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x48bb49[_0x6da6('0x30')],_0x4848e8[_0x6da6('0x32')]));_0x287042[_0x6da6('0x39')][_0x6da6('0x58')]=_0x4b11a8['id'];if(_0x48bb49[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x287042['where']=_['merge'](_0x287042[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x287042[_0x6da6('0x34')],function(_0x140d6d){var _0x1fef4d={};_0x1fef4d[_0x140d6d]={'$like':'%'+_0x48bb49[_0x6da6('0x30')]['filter']+'%'};return _0x1fef4d;})});}_0x287042=_[_0x6da6('0x3a')]({},_0x287042,_0x48bb49[_0x6da6('0x3c')]);return db['CmHopperHistory'][_0x6da6('0x1a')]({'where':_0x287042[_0x6da6('0x39')]})[_0x6da6('0x20')](function(_0x4c7492){_0x2658e3[_0x6da6('0x1a')]=_0x4c7492;if(_0x48bb49[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x287042[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x5a')][_0x6da6('0x3f')](_0x287042);})[_0x6da6('0x20')](function(_0x25db84){_0x2658e3[_0x6da6('0x40')]=_0x25db84;return _0x2658e3;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x46648d,_0x287042))[_0x6da6('0x41')](handleError(_0x46648d,null));};exports[_0x6da6('0x5b')]=function(_0x483f72,_0x169e82,_0x3f50ee){var _0x273626={'raw':!![],'where':{}};var _0x3f4407={};var _0x57dc3c={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x483f72['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x169e82,null))[_0x6da6('0x20')](function(_0x4cc9dd){if(_0x4cc9dd){_0x3f4407[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5c')]['rawAttributes']);_0x3f4407[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x483f72[_0x6da6('0x30')]);_0x3f4407[_0x6da6('0x32')]=_[_0x6da6('0x35')](_0x3f4407['model'],_0x3f4407[_0x6da6('0x30')]);_0x273626[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x3f4407[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x483f72[_0x6da6('0x30')][_0x6da6('0x43')]));_0x273626[_0x6da6('0x34')]=_0x273626[_0x6da6('0x34')]['length']?_0x273626[_0x6da6('0x34')]:_0x3f4407[_0x6da6('0x33')];if(!_0x483f72['query']['hasOwnProperty'](_0x6da6('0x37'))){_0x273626[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x483f72['query'][_0x6da6('0x18')]);_0x273626[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x483f72['query']['offset']);}_0x273626[_0x6da6('0x56')]=qs['sort'](_0x483f72[_0x6da6('0x30')][_0x6da6('0x38')]);_0x273626['where']=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x483f72[_0x6da6('0x30')],_0x3f4407[_0x6da6('0x32')]));_0x273626[_0x6da6('0x39')][_0x6da6('0x58')]=_0x4cc9dd['id'];if(_0x483f72['query'][_0x6da6('0x3b')]){_0x273626['where']=_[_0x6da6('0x3a')](_0x273626[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x273626['attributes'],function(_0x3d267f){var _0xaba7d7={};_0xaba7d7[_0x3d267f]={'$like':'%'+_0x483f72['query'][_0x6da6('0x3b')]+'%'};return _0xaba7d7;})});}_0x273626=_['merge']({},_0x273626,_0x483f72['options']);return db[_0x6da6('0x5c')]['count']({'where':_0x273626[_0x6da6('0x39')]})['then'](function(_0x3bae7c){_0x57dc3c['count']=_0x3bae7c;if(_0x483f72[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x273626['include']=[{'all':!![]}];}return db[_0x6da6('0x5c')][_0x6da6('0x3f')](_0x273626);})[_0x6da6('0x20')](function(_0x2e74c9){_0x57dc3c[_0x6da6('0x40')]=_0x2e74c9;return _0x57dc3c;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x169e82,_0x273626))[_0x6da6('0x41')](handleError(_0x169e82,null));};exports[_0x6da6('0x5d')]=function(_0x281b11,_0x5547e9,_0x2f270c){var _0x7b9951={'raw':!![],'where':{}};var _0x2c824c={};var _0x4987be={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x281b11[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x5547e9,null))[_0x6da6('0x20')](function(_0x359066){if(_0x359066){_0x2c824c[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5e')]['rawAttributes']);_0x2c824c[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x281b11[_0x6da6('0x30')]);_0x2c824c[_0x6da6('0x32')]=_['intersection'](_0x2c824c['model'],_0x2c824c[_0x6da6('0x30')]);_0x7b9951[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x2c824c['model'],qs[_0x6da6('0x43')](_0x281b11[_0x6da6('0x30')][_0x6da6('0x43')]));_0x7b9951['attributes']=_0x7b9951[_0x6da6('0x34')]['length']?_0x7b9951[_0x6da6('0x34')]:_0x2c824c[_0x6da6('0x33')];if(!_0x281b11[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x7b9951[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x281b11[_0x6da6('0x30')][_0x6da6('0x18')]);_0x7b9951[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x281b11[_0x6da6('0x30')]['offset']);}_0x7b9951[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x281b11['query']['sort']);_0x7b9951[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x281b11['query'],_0x2c824c[_0x6da6('0x32')]));_0x7b9951[_0x6da6('0x39')][_0x6da6('0x58')]=_0x359066['id'];if(_0x281b11[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x7b9951[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x7b9951[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x7b9951[_0x6da6('0x34')],function(_0x23192d){var _0x13a0ff={};_0x13a0ff[_0x23192d]={'$like':'%'+_0x281b11['query'][_0x6da6('0x3b')]+'%'};return _0x13a0ff;})});}_0x7b9951=_[_0x6da6('0x3a')]({},_0x7b9951,_0x281b11[_0x6da6('0x3c')]);return db[_0x6da6('0x5e')]['count']({'where':_0x7b9951[_0x6da6('0x39')]})[_0x6da6('0x20')](function(_0x4aac02){_0x4987be[_0x6da6('0x1a')]=_0x4aac02;if(_0x281b11['query']['includeAll']){_0x7b9951[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x5e')][_0x6da6('0x3f')](_0x7b9951);})['then'](function(_0xba036d){_0x4987be[_0x6da6('0x40')]=_0xba036d;return _0x4987be;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x5547e9,_0x7b9951))['catch'](handleError(_0x5547e9,null));};exports['getLists']=function(_0x2ad2f8,_0x410cb2,_0x4cc417){var _0x189ac2={};var _0x2c7407={};var _0x406990;var _0x4cad70;return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x2ad2f8[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x410cb2,null))[_0x6da6('0x20')](function(_0x4ebb94){if(_0x4ebb94){_0x406990=_0x4ebb94;_0x2c7407['model']=_[_0x6da6('0x31')](db[_0x6da6('0x5f')][_0x6da6('0x2c')]);_0x2c7407['query']=_['keys'](_0x2ad2f8[_0x6da6('0x30')]);_0x2c7407['filters']=_['intersection'](_0x2c7407[_0x6da6('0x33')],_0x2c7407[_0x6da6('0x30')]);_0x189ac2[_0x6da6('0x34')]=_['intersection'](_0x2c7407['model'],qs[_0x6da6('0x43')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x43')]));_0x189ac2[_0x6da6('0x34')]=_0x189ac2[_0x6da6('0x34')][_0x6da6('0x44')]?_0x189ac2[_0x6da6('0x34')]:_0x2c7407[_0x6da6('0x33')];_0x189ac2[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x38')]);_0x189ac2[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x2ad2f8[_0x6da6('0x30')],_0x2c7407[_0x6da6('0x32')]));if(_0x2ad2f8['query'][_0x6da6('0x3b')]){_0x189ac2[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x189ac2['where'],{'$or':_[_0x6da6('0x2a')](_0x189ac2[_0x6da6('0x34')],function(_0x1658f7){var _0x368ca7={};_0x368ca7[_0x1658f7]={'$like':'%'+_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x368ca7;})});}_0x189ac2=_[_0x6da6('0x3a')]({},_0x189ac2,_0x2ad2f8[_0x6da6('0x3c')]);return _0x406990[_0x6da6('0x60')](_0x189ac2);}})[_0x6da6('0x20')](function(_0x915306){if(_0x915306){_0x4cad70=_0x915306['length'];if(!_0x2ad2f8['query'][_0x6da6('0x36')](_0x6da6('0x37'))){_0x189ac2['limit']=qs[_0x6da6('0x18')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x18')]);_0x189ac2[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x1b')]);}return _0x406990[_0x6da6('0x60')](_0x189ac2);}})['then'](function(_0x3e9997){if(_0x3e9997){return _0x3e9997?{'count':_0x4cad70,'rows':_0x3e9997}:null;}})[_0x6da6('0x20')](respondWithResult(_0x410cb2,null))[_0x6da6('0x41')](handleError(_0x410cb2,null));};exports[_0x6da6('0x61')]=function(_0x5f10fd,_0x2c7e8e,_0x218110){var _0x40ba25,_0x59c435;var _0x18e81c=[];var _0x657eea=moment()[_0x6da6('0x62')](_0x6da6('0x63'));return db['Campaign']['find']({'where':{'id':_0x5f10fd[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x2c7e8e,null))[_0x6da6('0x20')](function(_0x215c02){if(_0x215c02){_0x59c435=_0x215c02;return _0x215c02[_0x6da6('0x61')](_0x5f10fd[_0x6da6('0x47')][_0x6da6('0x64')],_[_0x6da6('0x50')](_0x5f10fd[_0x6da6('0x47')],['ids','id'])||{});}return null;})['spread'](function(_0x4097ca){var _0x49b13d;var _0x2af6d9;_0x40ba25=_0x4097ca||[];var _0x15710e=[];if(_0x4097ca){for(var _0x553198=0x0;_0x553198<_0x4097ca[_0x6da6('0x44')];_0x553198+=0x1){var _0x265a50=_0x4097ca[_0x553198][_0x6da6('0x21')]({'plain':!![]});_0x59c435['dialCheckDuplicateType']=_0x5f10fd['body'][_0x6da6('0x65')]?_0x5f10fd[_0x6da6('0x47')][_0x6da6('0x65')]:_0x59c435['dialCheckDuplicateType'];switch(_0x59c435[_0x6da6('0x65')]){case _0x6da6('0x66'):_0x49b13d=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x69'))[_0x6da6('0x6a')]([_0x6da6('0x6b'),_0x6da6('0x6c'),_0x6da6('0x6d'),'ListId',_0x6da6('0x58'),_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()[_0x6da6('0x6f')](_0x6da6('0x6b'),_0x6da6('0x6b'))[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x6c'))[_0x6da6('0x6f')]('id',_0x6da6('0x6d'))['field'](_0x265a50['CmListId']['toString'](),'ListId')['field'](_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))['from'](_0x6da6('0x72'))['where'](_0x6da6('0x73'))['where'](_0x6da6('0x74'),_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')]())[_0x6da6('0x39')](_0x6da6('0x76'))[_0x6da6('0x39')](_0x6da6('0x77'),squel['select']()[_0x6da6('0x6f')](_0x6da6('0x78'))[_0x6da6('0x79')](_0x6da6('0x7a'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]()))[_0x6da6('0x39')](_0x6da6('0x77'),squel['select']()[_0x6da6('0x6f')](_0x6da6('0x7c'))[_0x6da6('0x79')](_0x6da6('0x69'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id']['toString']())))[_0x6da6('0x71')]();break;case _0x6da6('0x7d'):_0x49b13d=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x69'))['fromQuery']([_0x6da6('0x6b'),_0x6da6('0x6c'),_0x6da6('0x6d'),_0x6da6('0x7e'),'CampaignId',_0x6da6('0x51'),'updatedAt'],squel[_0x6da6('0x6e')]()[_0x6da6('0x6f')](_0x6da6('0x6b'),'phone')[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x6c'))['field']('id','ContactId')[_0x6da6('0x6f')](_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')](),_0x6da6('0x7e'))[_0x6da6('0x6f')](_0x5f10fd[_0x6da6('0x42')]['id']['toString'](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27','createdAt')[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')]('deletedAt\x20IS\x20NULL')[_0x6da6('0x39')]('ListId\x20=\x20?',_0x265a50[_0x6da6('0x75')]['toString']())[_0x6da6('0x39')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6da6('0x77'),squel[_0x6da6('0x6e')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x6da6('0x69'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]())))[_0x6da6('0x71')]();break;default:_0x49b13d=squel['insert']()[_0x6da6('0x68')]('cm_hopper')[_0x6da6('0x6a')]([_0x6da6('0x6b'),'scheduledAt',_0x6da6('0x6d'),'ListId',_0x6da6('0x58'),_0x6da6('0x51'),_0x6da6('0x52')],squel['select']()[_0x6da6('0x6f')](_0x6da6('0x6b'),'phone')[_0x6da6('0x6f')]('NOW()',_0x6da6('0x6c'))['field']('id',_0x6da6('0x6d'))['field'](_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')](),'ListId')[_0x6da6('0x6f')](_0x5f10fd[_0x6da6('0x42')]['id']['toString'](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')](_0x6da6('0x73'))[_0x6da6('0x39')](_0x6da6('0x74'),_0x265a50[_0x6da6('0x75')]['toString']())[_0x6da6('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x6da6('0x71')]();}_0x2af6d9=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x7f'))[_0x6da6('0x6a')](['cmHopperId',_0x6da6('0x6c'),_0x6da6('0x6b'),_0x6da6('0x80'),_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()['field'](_0x6da6('0x81'),'id')['field'](_0x6da6('0x70'),'scheduledAt')['field'](_0x6da6('0x82'),'phone')[_0x6da6('0x6f')](_0x6da6('0x83'),_0x6da6('0x80'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')](_0x6da6('0x84'),'ci')[_0x6da6('0x85')](_0x6da6('0x69'),'h',_0x6da6('0x86'))['where']('h.ListId\x20=\x20?',_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')]())['where'](_0x6da6('0x87'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]())['where'](_0x6da6('0x88'),_0x657eea))[_0x6da6('0x71')]();_0x15710e[_0x6da6('0x89')](db[_0x6da6('0x8a')][_0x6da6('0x30')](_0x49b13d));_0x18e81c['push'](db[_0x6da6('0x8a')]['query'](_0x2af6d9));}return BPromise[_0x6da6('0x8b')](_0x15710e);}})['then'](function(){return BPromise[_0x6da6('0x8b')](_0x18e81c);})[_0x6da6('0x20')](function(){return _0x40ba25;})['then'](respondWithResult(_0x2c7e8e,null))[_0x6da6('0x41')](handleError(_0x2c7e8e,null));};exports[_0x6da6('0x8c')]=function(_0xfa1e50,_0x36835e,_0x41c904){return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0xfa1e50[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x36835e,null))[_0x6da6('0x20')](function(_0x104f4f){if(_0x104f4f){return _0x104f4f[_0x6da6('0x8c')](_0xfa1e50['query'][_0x6da6('0x64')]);}})[_0x6da6('0x20')](function(_0x1fcf7c){if(_0x1fcf7c){return db['CmHopper'][_0x6da6('0x23')]({'where':{'ListId':_0xfa1e50['query'][_0x6da6('0x64')],'CampaignId':_0xfa1e50[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](function(){return _0x1fcf7c;});}})['then'](respondWithStatusCode(_0x36835e,null))[_0x6da6('0x41')](handleError(_0x36835e,null));};exports[_0x6da6('0x8d')]=function(_0x2495bc,_0x184e1d,_0x5ec7d4){var _0x33eb6e={};var _0x47a9a5={};var _0x105c80;var _0x355141;return db[_0x6da6('0x2b')]['findOne']({'where':{'id':_0x2495bc['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x184e1d,null))[_0x6da6('0x20')](function(_0xb8d491){if(_0xb8d491){_0x105c80=_0xb8d491;_0x47a9a5[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5f')][_0x6da6('0x2c')]);_0x47a9a5[_0x6da6('0x30')]=_['keys'](_0x2495bc['query']);_0x47a9a5[_0x6da6('0x32')]=_['intersection'](_0x47a9a5[_0x6da6('0x33')],_0x47a9a5[_0x6da6('0x30')]);_0x33eb6e[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x47a9a5[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x2495bc[_0x6da6('0x30')][_0x6da6('0x43')]));_0x33eb6e['attributes']=_0x33eb6e[_0x6da6('0x34')][_0x6da6('0x44')]?_0x33eb6e[_0x6da6('0x34')]:_0x47a9a5[_0x6da6('0x33')];_0x33eb6e[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x2495bc[_0x6da6('0x30')]['sort']);_0x33eb6e[_0x6da6('0x39')]=qs['filters'](_[_0x6da6('0x57')](_0x2495bc['query'],_0x47a9a5['filters']));if(_0x2495bc[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x33eb6e[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x33eb6e[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x33eb6e[_0x6da6('0x34')],function(_0x57ae45){var _0x118826={};_0x118826[_0x57ae45]={'$like':'%'+_0x2495bc[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x118826;})});}_0x33eb6e=_[_0x6da6('0x3a')]({},_0x33eb6e,_0x2495bc[_0x6da6('0x3c')]);return _0x105c80[_0x6da6('0x8d')](_0x33eb6e);}})[_0x6da6('0x20')](function(_0x4f91cd){if(_0x4f91cd){_0x355141=_0x4f91cd[_0x6da6('0x44')];if(!_0x2495bc[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x33eb6e[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x2495bc['query'][_0x6da6('0x18')]);_0x33eb6e[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x2495bc['query'][_0x6da6('0x1b')]);}return _0x105c80[_0x6da6('0x8d')](_0x33eb6e);}})[_0x6da6('0x20')](function(_0x52d5db){if(_0x52d5db){return _0x52d5db?{'count':_0x355141,'rows':_0x52d5db}:null;}})[_0x6da6('0x20')](respondWithResult(_0x184e1d,null))[_0x6da6('0x41')](handleError(_0x184e1d,null));};exports[_0x6da6('0x8e')]=function(_0x1af412,_0x48e581,_0x56e2b8){var _0x21e4f7,_0x24052e;var _0x20ee4d=[];var _0x5af63b=moment()[_0x6da6('0x62')](_0x6da6('0x63'));return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0x1af412['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x48e581,null))['then'](function(_0xf18937){if(_0xf18937){_0x24052e=_0xf18937;return _0xf18937['addBlackLists'](_0x1af412[_0x6da6('0x47')]['ids'],_[_0x6da6('0x50')](_0x1af412[_0x6da6('0x47')],[_0x6da6('0x64'),'id'])||{});}return null;})[_0x6da6('0x8f')](function(_0x3f7e65){var _0x52ec7e;var _0x462f7b;_0x21e4f7=_0x3f7e65||[];var _0xe76ff9=[];if(_0x3f7e65){for(var _0x142e7e=0x0;_0x142e7e<_0x3f7e65[_0x6da6('0x44')];_0x142e7e+=0x1){var _0x5f544d=_0x3f7e65[_0x142e7e][_0x6da6('0x21')]({'plain':!![]});_0x52ec7e=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x90'))[_0x6da6('0x6a')]([_0x6da6('0x6b'),_0x6da6('0x6d'),'ListId','CampaignId',_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()['field'](_0x6da6('0x6b'),_0x6da6('0x6b'))[_0x6da6('0x6f')]('id',_0x6da6('0x6d'))['field'](_0x5f544d['CmListId'][_0x6da6('0x71')](),'ListId')[_0x6da6('0x6f')](_0x1af412[_0x6da6('0x42')]['id'][_0x6da6('0x71')](),_0x6da6('0x58'))[_0x6da6('0x6f')](_0x6da6('0x70'),'createdAt')[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')](_0x6da6('0x73'))[_0x6da6('0x39')](_0x6da6('0x74'),_0x5f544d['CmListId']['toString']())['where'](_0x6da6('0x76')))[_0x6da6('0x71')]();_0xe76ff9[_0x6da6('0x89')](db[_0x6da6('0x8a')][_0x6da6('0x30')](_0x52ec7e));}return BPromise[_0x6da6('0x8b')](_0xe76ff9);}})['then'](function(){return _0x21e4f7;})[_0x6da6('0x20')](respondWithResult(_0x48e581,null))['catch'](handleError(_0x48e581,null));};exports[_0x6da6('0x91')]=function(_0x369109,_0x1b7113,_0x39d7df){return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0x369109[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x1b7113,null))['then'](function(_0x478689){if(_0x478689){return _0x478689['removeBlackLists'](_0x369109[_0x6da6('0x30')]['ids']);}})['then'](function(_0x4203f5){if(_0x4203f5){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x369109[_0x6da6('0x30')]['ids'],'CampaignId':_0x369109[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](function(){return _0x4203f5;});}})['then'](respondWithStatusCode(_0x1b7113,null))[_0x6da6('0x41')](handleError(_0x1b7113,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 388ddc0..6044caa 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(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 9fd417a..8095994 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 _0x2060=['Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2060,0x1be));var _0x0206=function(_0x57f295,_0x4ca3c4){_0x57f295=_0x57f295-0x0;var _0x51fd23=_0x2060[_0x57f295];return _0x51fd23;};'use strict';var _=require(_0x0206('0x0'));var util=require('util');var moment=require(_0x0206('0x1'));var BPromise=require(_0x0206('0x2'));var rs=require(_0x0206('0x3'));var fs=require('fs');var Redis=require(_0x0206('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0206('0x5'));var logger=require(_0x0206('0x6'))('rpc');var config=require(_0x0206('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0206('0x8')][_0x0206('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x529d59,_0x2eda0e,_0x5c8dbb){return new BPromise(function(_0x4ffb51,_0x46dd94){return client[_0x0206('0xa')](_0x529d59,_0x5c8dbb)[_0x0206('0xb')](function(_0x194718){logger[_0x0206('0xc')](_0x0206('0xd'),_0x2eda0e,_0x0206('0xe'));logger[_0x0206('0xf')](_0x0206('0x10'),_0x2eda0e,_0x0206('0xe'),JSON[_0x0206('0x11')](_0x194718));if(_0x194718['error']){if(_0x194718['error'][_0x0206('0x12')]===0x1f4){logger[_0x0206('0x13')]('Campaign,\x20%s,\x20%s',_0x2eda0e,_0x194718[_0x0206('0x13')][_0x0206('0x14')]);return _0x46dd94(_0x194718[_0x0206('0x13')]['message']);}logger[_0x0206('0x13')](_0x0206('0xd'),_0x2eda0e,_0x194718[_0x0206('0x13')][_0x0206('0x14')]);return _0x4ffb51(_0x194718['error'][_0x0206('0x14')]);}else{logger['info'](_0x0206('0xd'),_0x2eda0e,_0x0206('0xe'));_0x4ffb51(_0x194718[_0x0206('0x15')][_0x0206('0x14')]);}})[_0x0206('0x16')](function(_0x26c261){logger['error']('Campaign,\x20%s,\x20%s',_0x2eda0e,_0x26c261);_0x46dd94(_0x26c261);});});}exports[_0x0206('0x17')]=function(_0x5641df){var _0x58291b=this;return new Promise(function(_0x2db2da,_0x3ecd80){return db[_0x0206('0x18')][_0x0206('0x19')]({'raw':_0x5641df['options']?_0x5641df[_0x0206('0x1a')][_0x0206('0x1b')]===undefined?!![]:![]:!![],'where':_0x5641df[_0x0206('0x1a')]?_0x5641df[_0x0206('0x1a')][_0x0206('0x1c')]||null:null,'attributes':_0x5641df[_0x0206('0x1a')]?_0x5641df[_0x0206('0x1a')][_0x0206('0x1d')]||null:null,'limit':_0x5641df['options']?_0x5641df[_0x0206('0x1a')]['limit']||null:null,'include':_0x5641df['options']?_0x5641df[_0x0206('0x1a')]['include']?_[_0x0206('0x1e')](_0x5641df[_0x0206('0x1a')][_0x0206('0x1f')],function(_0x4c5452){return{'model':db[_0x4c5452[_0x0206('0x20')]],'as':_0x4c5452['as'],'attributes':_0x4c5452[_0x0206('0x1d')],'include':_0x4c5452[_0x0206('0x1f')]?_['map'](_0x4c5452['include'],function(_0x3b9890){return{'model':db[_0x3b9890[_0x0206('0x20')]],'as':_0x3b9890['as'],'attributes':_0x3b9890['attributes'],'include':_0x3b9890[_0x0206('0x1f')]?_[_0x0206('0x1e')](_0x3b9890[_0x0206('0x1f')],function(_0x38ebfe){return{'model':db[_0x38ebfe[_0x0206('0x20')]],'as':_0x38ebfe['as'],'attributes':_0x38ebfe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0206('0xb')](function(_0x18513c){logger[_0x0206('0xc')]('GetCampaign',_0x5641df);logger[_0x0206('0xf')](_0x0206('0x17'),_0x5641df,JSON[_0x0206('0x11')](_0x18513c));_0x2db2da(_0x18513c);})['catch'](function(_0xe6320c){logger[_0x0206('0x13')]('GetCampaign',_0xe6320c[_0x0206('0x14')],_0x5641df);_0x3ecd80(_0x58291b[_0x0206('0x13')](0x1f4,_0xe6320c[_0x0206('0x14')]));});});}; \ No newline at end of file +var _0xde13=['stringify','error','message','result','catch','GetCampaign','Campaign','options','raw','attributes','limit','include','map','model','then','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32d2b0,_0x46dd6e){var _0x29ab56=function(_0x38477f){while(--_0x38477f){_0x32d2b0['push'](_0x32d2b0['shift']());}};_0x29ab56(++_0x46dd6e);}(_0xde13,0x146));var _0x3de1=function(_0x41b90b,_0x50066f){_0x41b90b=_0x41b90b-0x0;var _0x4a84fb=_0xde13[_0x41b90b];return _0x4a84fb;};'use strict';var _=require(_0x3de1('0x0'));var util=require(_0x3de1('0x1'));var moment=require(_0x3de1('0x2'));var BPromise=require(_0x3de1('0x3'));var rs=require(_0x3de1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3de1('0x5'))['db'];var utils=require(_0x3de1('0x6'));var logger=require(_0x3de1('0x7'))('rpc');var config=require(_0x3de1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3de1('0x9')][_0x3de1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2169,_0x34291a,_0x5f1aff){return new BPromise(function(_0x11df45,_0x41b5bb){return client[_0x3de1('0xb')](_0x3d2169,_0x5f1aff)['then'](function(_0x4eb503){logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));logger[_0x3de1('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x34291a,_0x3de1('0xd'),JSON[_0x3de1('0xf')](_0x4eb503));if(_0x4eb503[_0x3de1('0x10')]){if(_0x4eb503['error']['code']===0x1f4){logger[_0x3de1('0x10')]('Campaign,\x20%s,\x20%s',_0x34291a,_0x4eb503['error']['message']);return _0x41b5bb(_0x4eb503[_0x3de1('0x10')][_0x3de1('0x11')]);}logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x4eb503['error'][_0x3de1('0x11')]);return _0x11df45(_0x4eb503['error'][_0x3de1('0x11')]);}else{logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));_0x11df45(_0x4eb503[_0x3de1('0x12')]['message']);}})[_0x3de1('0x13')](function(_0x25f619){logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x25f619);_0x41b5bb(_0x25f619);});});}exports[_0x3de1('0x14')]=function(_0x510e5a){var _0x19254b=this;return new Promise(function(_0x5a10f2,_0x1e5a06){return db[_0x3de1('0x15')]['findAll']({'raw':_0x510e5a[_0x3de1('0x16')]?_0x510e5a['options'][_0x3de1('0x17')]===undefined?!![]:![]:!![],'where':_0x510e5a[_0x3de1('0x16')]?_0x510e5a[_0x3de1('0x16')]['where']||null:null,'attributes':_0x510e5a[_0x3de1('0x16')]?_0x510e5a[_0x3de1('0x16')][_0x3de1('0x18')]||null:null,'limit':_0x510e5a['options']?_0x510e5a[_0x3de1('0x16')][_0x3de1('0x19')]||null:null,'include':_0x510e5a['options']?_0x510e5a['options'][_0x3de1('0x1a')]?_[_0x3de1('0x1b')](_0x510e5a[_0x3de1('0x16')][_0x3de1('0x1a')],function(_0x242ab0){return{'model':db[_0x242ab0[_0x3de1('0x1c')]],'as':_0x242ab0['as'],'attributes':_0x242ab0[_0x3de1('0x18')],'include':_0x242ab0[_0x3de1('0x1a')]?_['map'](_0x242ab0['include'],function(_0x9873fa){return{'model':db[_0x9873fa[_0x3de1('0x1c')]],'as':_0x9873fa['as'],'attributes':_0x9873fa[_0x3de1('0x18')],'include':_0x9873fa[_0x3de1('0x1a')]?_[_0x3de1('0x1b')](_0x9873fa['include'],function(_0x5985b2){return{'model':db[_0x5985b2['model']],'as':_0x5985b2['as'],'attributes':_0x5985b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3de1('0x1d')](function(_0xc6537a){logger[_0x3de1('0x1e')](_0x3de1('0x14'),_0x510e5a);logger[_0x3de1('0xe')](_0x3de1('0x14'),_0x510e5a,JSON[_0x3de1('0xf')](_0xc6537a));_0x5a10f2(_0xc6537a);})[_0x3de1('0x13')](function(_0x898786){logger[_0x3de1('0x10')](_0x3de1('0x14'),_0x898786[_0x3de1('0x11')],_0x510e5a);_0x1e5a06(_0x19254b['error'](0x1f4,_0x898786['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b100da0..7150c10 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 _0x18a5=['destroy','removeLists','removeBlackLists','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists','addBlackLists','put','update','delete'];(function(_0x24cf7f,_0xcda231){var _0x4c6742=function(_0x2469db){while(--_0x2469db){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x4c6742(++_0xcda231);}(_0x18a5,0x164));var _0x518a=function(_0x395bd2,_0x4e0a20){_0x395bd2=_0x395bd2-0x0;var _0x518dc4=_0x18a5[_0x395bd2];return _0x518dc4;};'use strict';var multer=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x518a('0x2'));var router=express['Router']();var fs_extra=require(_0x518a('0x3'));var auth=require(_0x518a('0x4'));var interaction=require(_0x518a('0x5'));var config=require(_0x518a('0x6'));var controller=require(_0x518a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x518a('0x8')](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('0xb')]);router[_0x518a('0x8')](_0x518a('0xc'),auth[_0x518a('0xa')](),controller[_0x518a('0xd')]);router[_0x518a('0x8')](_0x518a('0xe'),auth[_0x518a('0xa')](),controller[_0x518a('0xf')]);router[_0x518a('0x8')](_0x518a('0x10'),auth[_0x518a('0xa')](),controller['getHopperFinals']);router[_0x518a('0x8')]('/:id/hopper_black',auth[_0x518a('0xa')](),controller['getHopperBlacks']);router[_0x518a('0x8')](_0x518a('0x11'),auth[_0x518a('0xa')](),controller[_0x518a('0x12')]);router[_0x518a('0x8')](_0x518a('0x13'),auth[_0x518a('0xa')](),controller['getBlackLists']);router[_0x518a('0x14')]('/',auth[_0x518a('0xa')](),controller[_0x518a('0x15')]);router['post'](_0x518a('0x16'),auth[_0x518a('0xa')](),controller['clone']);router['post'](_0x518a('0x11'),auth['isAuthenticated'](),controller[_0x518a('0x17')]);router[_0x518a('0x14')](_0x518a('0x13'),auth[_0x518a('0xa')](),controller[_0x518a('0x18')]);router[_0x518a('0x19')](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('0x1a')]);router[_0x518a('0x1b')](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('0x1c')]);router['delete'](_0x518a('0x11'),auth['isAuthenticated'](),controller[_0x518a('0x1d')]);router['delete'](_0x518a('0x13'),auth[_0x518a('0xa')](),controller[_0x518a('0x1e')]);module[_0x518a('0x1f')]=router; \ No newline at end of file +var _0xf9f7=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers'];(function(_0x3162d2,_0x5608e1){var _0x228fbf=function(_0x3942b8){while(--_0x3942b8){_0x3162d2['push'](_0x3162d2['shift']());}};_0x228fbf(++_0x5608e1);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x3a1dec,_0x1f943f){_0x3a1dec=_0x3a1dec-0x0;var _0x60ede0=_0xf9f7[_0x3a1dec];return _0x60ede0;};'use strict';var multer=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var path=require(_0x7f9f('0x2'));var timeout=require(_0x7f9f('0x3'));var express=require(_0x7f9f('0x4'));var router=express[_0x7f9f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f9f('0x6'));var config=require(_0x7f9f('0x7'));var controller=require(_0x7f9f('0x8'));router[_0x7f9f('0x9')]('/',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0xb')]);router['get'](_0x7f9f('0xc'),auth[_0x7f9f('0xa')](),controller[_0x7f9f('0xd')]);router[_0x7f9f('0x9')](_0x7f9f('0xe'),auth['isAuthenticated'](),controller[_0x7f9f('0xf')]);router[_0x7f9f('0x9')](_0x7f9f('0x10'),auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x11')]);router[_0x7f9f('0x9')](_0x7f9f('0x12'),auth['isAuthenticated'](),controller[_0x7f9f('0x13')]);router[_0x7f9f('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x7f9f('0x14')]);router['get'](_0x7f9f('0x15'),auth[_0x7f9f('0xa')](),controller['getLists']);router[_0x7f9f('0x9')]('/:id/blacklists',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x16')]);router[_0x7f9f('0x17')]('/',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x18')]);router['post'](_0x7f9f('0x19'),auth[_0x7f9f('0xa')](),controller['clone']);router[_0x7f9f('0x17')]('/:id/lists',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x1a')]);router[_0x7f9f('0x17')](_0x7f9f('0x1b'),auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x1c')]);router['put'](_0x7f9f('0xc'),auth[_0x7f9f('0xa')](),controller['update']);router[_0x7f9f('0x1d')]('/:id',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x1e')]);router[_0x7f9f('0x1d')](_0x7f9f('0x15'),auth['isAuthenticated'](),controller[_0x7f9f('0x1f')]);router['delete']('/:id/blacklists',auth[_0x7f9f('0xa')](),controller[_0x7f9f('0x20')]);module[_0x7f9f('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 e6d2b87..7fa9dde 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 _0xd9cf=['medium','VIRTUAL','sequelize','STRING','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd9cf,0x19c));var _0xfd9c=function(_0x3856d1,_0x39feb0){_0x3856d1=_0x3856d1-0x0;var _0x2b6824=_0xd9cf[_0x3856d1];return _0x2b6824;};'use strict';var Sequelize=require(_0xfd9c('0x0'));module['exports']={'key':{'type':Sequelize[_0xfd9c('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xfd9c('0x2')],'length':_0xfd9c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfd9c('0x1')]},'name':{'type':Sequelize[_0xfd9c('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x4940=['key','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x2b43f4,_0x26227b){var _0x540009=function(_0x1a2467){while(--_0x1a2467){_0x2b43f4['push'](_0x2b43f4['shift']());}};_0x540009(++_0x26227b);}(_0x4940,0xe1));var _0x0494=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4940[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require('sequelize');module[_0x0494('0x0')]={'key':{'type':Sequelize[_0x0494('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x0494('0x2')],'length':_0x0494('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0494('0x1')]},'name':{'type':Sequelize[_0x0494('0x4')],'get':function(){return this[_0x0494('0x5')](_0x0494('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f047d6c..09d19df 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 _0xe61b=['UserProfileSection','CannedAnswers','userProfileId','UserProfileResource','error','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','get','then','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xe61b,0xad));var _0xbe61=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xe61b[_0x34b1b8];return _0x542dd8;};'use strict';var emlformat=require(_0xbe61('0x0'));var rimraf=require(_0xbe61('0x1'));var zipdir=require(_0xbe61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe61('0x3'));var moment=require(_0xbe61('0x4'));var BPromise=require(_0xbe61('0x5'));var Mustache=require(_0xbe61('0x6'));var util=require(_0xbe61('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('fs-extra');var _=require('lodash');var squel=require(_0xbe61('0x8'));var crypto=require(_0xbe61('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbe61('0xa'));var toCsv=require(_0xbe61('0xb'));var querystring=require(_0xbe61('0xc'));var Papa=require(_0xbe61('0xd'));var Redis=require(_0xbe61('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbe61('0xf'));var as=require(_0xbe61('0x10'));var hardwareService=require(_0xbe61('0x11'));var logger=require('../../config/logger')(_0xbe61('0x12'));var utils=require('../../config/utils');var config=require(_0xbe61('0x13'));var licenseUtil=require(_0xbe61('0x14'));var db=require(_0xbe61('0x15'))['db'];function respondWithStatusCode(_0xc67b2f,_0x29fe4f){_0x29fe4f=_0x29fe4f||0xcc;return function(_0x11256f){if(_0x11256f){return _0xc67b2f[_0xbe61('0x16')](_0x29fe4f);}return _0xc67b2f[_0xbe61('0x17')](_0x29fe4f)['end']();};}function respondWithResult(_0x2a282b,_0x4bcba7){_0x4bcba7=_0x4bcba7||0xc8;return function(_0x4e8afe){if(_0x4e8afe){return _0x2a282b[_0xbe61('0x17')](_0x4bcba7)[_0xbe61('0x18')](_0x4e8afe);}};}function respondWithFilteredResult(_0x15b87d,_0x59cecf){return function(_0x151081){if(_0x151081){var _0xb95d7b=typeof _0x59cecf[_0xbe61('0x19')]===_0xbe61('0x1a')&&typeof _0x59cecf['limit']===_0xbe61('0x1a');var _0x256529=_0x151081[_0xbe61('0x1b')];var _0x168c2b=_0xb95d7b?0x0:_0x59cecf[_0xbe61('0x19')];var _0x556a3f=_0xb95d7b?_0x151081[_0xbe61('0x1b')]:_0x59cecf['offset']+_0x59cecf['limit'];var _0x3a96c5;if(_0x556a3f>=_0x256529){_0x556a3f=_0x256529;_0x3a96c5=0xc8;}else{_0x3a96c5=0xce;}_0x15b87d['status'](_0x3a96c5);return _0x15b87d[_0xbe61('0x1c')](_0xbe61('0x1d'),_0x168c2b+'-'+_0x556a3f+'/'+_0x256529)[_0xbe61('0x18')](_0x151081);}return null;};}function patchUpdates(_0x7cb326){return function(_0x20bbb1){try{jsonpatch[_0xbe61('0x1e')](_0x20bbb1,_0x7cb326,!![]);}catch(_0x5657e6){return BPromise['reject'](_0x5657e6);}return _0x20bbb1[_0xbe61('0x1f')]();};}function saveUpdates(_0x53107a,_0x261b7c){return function(_0x428de9){if(_0x428de9){return _0x428de9[_0xbe61('0x20')](_0x53107a)['then'](function(_0x205ac4){return _0x205ac4;});}return null;};}function removeEntity(_0xb3ce7d,_0x4904a6){return function(_0x2b779a){if(_0x2b779a){return _0x2b779a[_0xbe61('0x21')]()['then'](function(){var _0x52dc3f=_0x2b779a[_0xbe61('0x22')]({'plain':!![]});var _0x700643='CannedAnswers';return db['UserProfileResource'][_0xbe61('0x21')]({'where':{'type':_0x700643,'resourceId':_0x52dc3f['id']}})['then'](function(){return _0x2b779a;});})[_0xbe61('0x23')](function(){_0xb3ce7d[_0xbe61('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7eb8,_0x4b53aa){return function(_0x14358c){if(!_0x14358c){_0x3a7eb8['sendStatus'](0x194);}return _0x14358c;};}function handleError(_0x399467,_0x52de8f){_0x52de8f=_0x52de8f||0x1f4;return function(_0x589e09){logger['error'](_0x589e09[_0xbe61('0x24')]);if(_0x589e09[_0xbe61('0x25')]){delete _0x589e09[_0xbe61('0x25')];}_0x399467[_0xbe61('0x17')](_0x52de8f)[_0xbe61('0x26')](_0x589e09);};}exports[_0xbe61('0x27')]=function(_0x31823b,_0x3d6af2){var _0xf89eef={},_0x501b7c={},_0x326f56={'count':0x0,'rows':[]};var _0x55fde3=_['map'](db[_0xbe61('0x28')][_0xbe61('0x29')],function(_0x1fa080){return{'name':_0x1fa080[_0xbe61('0x2a')],'type':_0x1fa080[_0xbe61('0x2b')][_0xbe61('0x2c')]};});_0x501b7c[_0xbe61('0x2d')]=_['map'](_0x55fde3,_0xbe61('0x25'));_0x501b7c['query']=_[_0xbe61('0x2e')](_0x31823b['query']);_0x501b7c[_0xbe61('0x2f')]=_[_0xbe61('0x30')](_0x501b7c[_0xbe61('0x2d')],_0x501b7c[_0xbe61('0x31')]);_0xf89eef[_0xbe61('0x32')]=_[_0xbe61('0x30')](_0x501b7c[_0xbe61('0x2d')],qs['fields'](_0x31823b['query'][_0xbe61('0x33')]));_0xf89eef[_0xbe61('0x32')]=_0xf89eef[_0xbe61('0x32')][_0xbe61('0x34')]?_0xf89eef[_0xbe61('0x32')]:_0x501b7c['model'];if(!_0x31823b[_0xbe61('0x31')][_0xbe61('0x35')](_0xbe61('0x36'))){_0xf89eef[_0xbe61('0x37')]=qs[_0xbe61('0x37')](_0x31823b[_0xbe61('0x31')]['limit']);_0xf89eef[_0xbe61('0x19')]=qs['offset'](_0x31823b[_0xbe61('0x31')][_0xbe61('0x19')]);}_0xf89eef[_0xbe61('0x38')]=qs[_0xbe61('0x39')](_0x31823b['query']['sort']);_0xf89eef[_0xbe61('0x3a')]=qs['filters'](_[_0xbe61('0x3b')](_0x31823b[_0xbe61('0x31')],_0x501b7c[_0xbe61('0x2f')]),_0x55fde3);if(_0x31823b[_0xbe61('0x31')][_0xbe61('0x3c')]){_0xf89eef[_0xbe61('0x3a')]=_['merge'](_0xf89eef[_0xbe61('0x3a')],{'$or':[{'key':{'$like':'%'+_0x31823b[_0xbe61('0x31')][_0xbe61('0x3c')]+'%'}},{'value':{'$like':'%'+_0x31823b['query']['filter']+'%'}}]});}_0xf89eef=_[_0xbe61('0x3d')]({},_0xf89eef,_0x31823b[_0xbe61('0x3e')]);var _0x2b60={'where':_0xf89eef[_0xbe61('0x3a')]};return db[_0xbe61('0x28')]['count'](_0x2b60)['then'](function(_0xf900d2){_0x326f56['count']=_0xf900d2;if(_0x31823b['query'][_0xbe61('0x3f')]){_0xf89eef[_0xbe61('0x40')]=[{'all':!![]}];}return db[_0xbe61('0x28')][_0xbe61('0x41')](_0xf89eef);})[_0xbe61('0x23')](function(_0x51e968){_0x326f56['rows']=_0x51e968;return _0x326f56;})[_0xbe61('0x23')](respondWithFilteredResult(_0x3d6af2,_0xf89eef))['catch'](handleError(_0x3d6af2,null));};exports[_0xbe61('0x42')]=function(_0x1b96cf,_0x1d694b){var _0x5cee48={'raw':!![],'where':{'id':_0x1b96cf[_0xbe61('0x43')]['id']}},_0x1b2dbc={};_0x1b2dbc[_0xbe61('0x2d')]=_[_0xbe61('0x2e')](db[_0xbe61('0x28')][_0xbe61('0x29')]);_0x1b2dbc[_0xbe61('0x31')]=_[_0xbe61('0x2e')](_0x1b96cf[_0xbe61('0x31')]);_0x1b2dbc[_0xbe61('0x2f')]=_[_0xbe61('0x30')](_0x1b2dbc[_0xbe61('0x2d')],_0x1b2dbc['query']);_0x5cee48[_0xbe61('0x32')]=_[_0xbe61('0x30')](_0x1b2dbc['model'],qs['fields'](_0x1b96cf[_0xbe61('0x31')][_0xbe61('0x33')]));_0x5cee48['attributes']=_0x5cee48[_0xbe61('0x32')][_0xbe61('0x34')]?_0x5cee48[_0xbe61('0x32')]:_0x1b2dbc[_0xbe61('0x2d')];if(_0x1b96cf[_0xbe61('0x31')]['includeAll']){_0x5cee48['include']=[{'all':!![]}];}_0x5cee48=_[_0xbe61('0x3d')]({},_0x5cee48,_0x1b96cf[_0xbe61('0x3e')]);return db[_0xbe61('0x28')][_0xbe61('0x44')](_0x5cee48)[_0xbe61('0x23')](handleEntityNotFound(_0x1d694b,null))[_0xbe61('0x23')](respondWithResult(_0x1d694b,null))[_0xbe61('0x45')](handleError(_0x1d694b,null));};exports[_0xbe61('0x20')]=function(_0x4ca17c,_0x279fef){if(_0x4ca17c['body']['id']){delete _0x4ca17c['body']['id'];}return db[_0xbe61('0x28')][_0xbe61('0x44')]({'where':{'id':_0x4ca17c[_0xbe61('0x43')]['id']}})[_0xbe61('0x23')](handleEntityNotFound(_0x279fef,null))[_0xbe61('0x23')](saveUpdates(_0x4ca17c[_0xbe61('0x46')],null))[_0xbe61('0x23')](respondWithResult(_0x279fef,null))['catch'](handleError(_0x279fef,null));};exports[_0xbe61('0x21')]=function(_0x354fae,_0xc26b1c){return db[_0xbe61('0x28')][_0xbe61('0x44')]({'where':{'id':_0x354fae['params']['id']}})[_0xbe61('0x23')](handleEntityNotFound(_0xc26b1c,null))[_0xbe61('0x23')](removeEntity(_0xc26b1c,null))['catch'](handleError(_0xc26b1c,null));};exports[_0xbe61('0x47')]=function(_0x533530,_0xcbd6e3){var _0xf1ecba={'key':_0x533530[_0xbe61('0x46')][_0xbe61('0x2c')]};if(_0x533530[_0xbe61('0x46')][_0xbe61('0x48')]){_0xf1ecba[_0xbe61('0x48')]=_0x533530[_0xbe61('0x46')][_0xbe61('0x48')];}else if(_0x533530[_0xbe61('0x46')][_0xbe61('0x49')]){_0xf1ecba['SmsAccountId']=_0x533530[_0xbe61('0x46')][_0xbe61('0x49')];}else if(_0x533530[_0xbe61('0x46')][_0xbe61('0x4a')]){_0xf1ecba['OpenchannelAccountId']=_0x533530[_0xbe61('0x46')]['OpenchannelAccountId'];}else if(_0x533530[_0xbe61('0x46')][_0xbe61('0x4b')]){_0xf1ecba[_0xbe61('0x4b')]=_0x533530[_0xbe61('0x46')][_0xbe61('0x4b')];}return db[_0xbe61('0x28')][_0xbe61('0x44')]({'where':_0xf1ecba})[_0xbe61('0x23')](function(_0x6138ef){if(_0x6138ef){throw new db['Sequelize']['ValidationError'](_0xbe61('0x4c'));}return db[_0xbe61('0x28')][_0xbe61('0x47')](_0x533530[_0xbe61('0x46')]);})[_0xbe61('0x23')](function(_0x10261d){var _0x4bd691=_0x533530[_0xbe61('0x4d')][_0xbe61('0x22')]({'plain':!![]});if(!_0x4bd691)throw new Error(_0xbe61('0x4e'));if(_0x4bd691['role']==='user'){var _0x3d66f5=_0x10261d[_0xbe61('0x22')]({'plain':!![]});return db[_0xbe61('0x4f')]['find']({'where':{'name':_0xbe61('0x50'),'userProfileId':_0x4bd691[_0xbe61('0x51')]},'raw':!![]})[_0xbe61('0x23')](function(_0x386b00){if(_0x386b00&&_0x386b00['autoAssociation']===0x0){return db[_0xbe61('0x52')]['create']({'name':_0x3d66f5[_0xbe61('0x25')],'resourceId':_0x3d66f5['id'],'type':_0x386b00[_0xbe61('0x25')],'sectionId':_0x386b00['id']},{})[_0xbe61('0x23')](function(){return _0x10261d;});}else{return _0x10261d;}})[_0xbe61('0x45')](function(_0x509a21){logger[_0xbe61('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x509a21);throw _0x509a21;});}return _0x10261d;})['then'](respondWithResult(_0xcbd6e3,0xc9))[_0xbe61('0x45')](handleError(_0xcbd6e3,null));}; \ No newline at end of file +var _0x7e96=['catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x7e96,0x1e4));var _0x67e9=function(_0x503350,_0x3fbbb8){_0x503350=_0x503350-0x0;var _0x49e615=_0x7e96[_0x503350];return _0x49e615;};'use strict';var emlformat=require(_0x67e9('0x0'));var rimraf=require(_0x67e9('0x1'));var zipdir=require(_0x67e9('0x2'));var jsonpatch=require(_0x67e9('0x3'));var rp=require(_0x67e9('0x4'));var moment=require(_0x67e9('0x5'));var BPromise=require(_0x67e9('0x6'));var Mustache=require(_0x67e9('0x7'));var util=require(_0x67e9('0x8'));var path=require('path');var sox=require(_0x67e9('0x9'));var csv=require(_0x67e9('0xa'));var ejs=require(_0x67e9('0xb'));var fs=require('fs');var fs_extra=require(_0x67e9('0xc'));var _=require('lodash');var squel=require(_0x67e9('0xd'));var crypto=require(_0x67e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x67e9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x67e9('0x10'));var Papa=require(_0x67e9('0x11'));var Redis=require(_0x67e9('0x12'));var authService=require(_0x67e9('0x13'));var qs=require(_0x67e9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67e9('0x15'));var logger=require(_0x67e9('0x16'))(_0x67e9('0x17'));var utils=require('../../config/utils');var config=require(_0x67e9('0x18'));var licenseUtil=require(_0x67e9('0x19'));var db=require(_0x67e9('0x1a'))['db'];function respondWithStatusCode(_0x377419,_0x20adef){_0x20adef=_0x20adef||0xcc;return function(_0x1122e7){if(_0x1122e7){return _0x377419[_0x67e9('0x1b')](_0x20adef);}return _0x377419[_0x67e9('0x1c')](_0x20adef)[_0x67e9('0x1d')]();};}function respondWithResult(_0x33321f,_0x19375e){_0x19375e=_0x19375e||0xc8;return function(_0x4bd267){if(_0x4bd267){return _0x33321f[_0x67e9('0x1c')](_0x19375e)[_0x67e9('0x1e')](_0x4bd267);}};}function respondWithFilteredResult(_0x540a07,_0x2f5408){return function(_0x428487){if(_0x428487){var _0x425364=typeof _0x2f5408[_0x67e9('0x1f')]===_0x67e9('0x20')&&typeof _0x2f5408[_0x67e9('0x21')]==='undefined';var _0x8cc9d9=_0x428487[_0x67e9('0x22')];var _0x28bc7=_0x425364?0x0:_0x2f5408[_0x67e9('0x1f')];var _0x317c50=_0x425364?_0x428487['count']:_0x2f5408['offset']+_0x2f5408[_0x67e9('0x21')];var _0x362f7b;if(_0x317c50>=_0x8cc9d9){_0x317c50=_0x8cc9d9;_0x362f7b=0xc8;}else{_0x362f7b=0xce;}_0x540a07[_0x67e9('0x1c')](_0x362f7b);return _0x540a07[_0x67e9('0x23')]('Content-Range',_0x28bc7+'-'+_0x317c50+'/'+_0x8cc9d9)[_0x67e9('0x1e')](_0x428487);}return null;};}function patchUpdates(_0x25a1ee){return function(_0x33aaba){try{jsonpatch[_0x67e9('0x24')](_0x33aaba,_0x25a1ee,!![]);}catch(_0x3038fb){return BPromise[_0x67e9('0x25')](_0x3038fb);}return _0x33aaba[_0x67e9('0x26')]();};}function saveUpdates(_0x3bb8e7,_0x230f8d){return function(_0x453dab){if(_0x453dab){return _0x453dab[_0x67e9('0x27')](_0x3bb8e7)['then'](function(_0x516ea1){return _0x516ea1;});}return null;};}function removeEntity(_0x31d5d7,_0x139331){return function(_0x2c5a0e){if(_0x2c5a0e){return _0x2c5a0e[_0x67e9('0x28')]()[_0x67e9('0x29')](function(){var _0x5d186e=_0x2c5a0e['get']({'plain':!![]});var _0x58c358=_0x67e9('0x2a');return db[_0x67e9('0x2b')]['destroy']({'where':{'type':_0x58c358,'resourceId':_0x5d186e['id']}})[_0x67e9('0x29')](function(){return _0x2c5a0e;});})[_0x67e9('0x29')](function(){_0x31d5d7[_0x67e9('0x1c')](0xcc)[_0x67e9('0x1d')]();});}};}function handleEntityNotFound(_0x377466,_0x78e176){return function(_0x450a95){if(!_0x450a95){_0x377466['sendStatus'](0x194);}return _0x450a95;};}function handleError(_0x3c4b24,_0x588be7){_0x588be7=_0x588be7||0x1f4;return function(_0x3c6d8b){logger[_0x67e9('0x2c')](_0x3c6d8b['stack']);if(_0x3c6d8b[_0x67e9('0x2d')]){delete _0x3c6d8b[_0x67e9('0x2d')];}_0x3c4b24[_0x67e9('0x1c')](_0x588be7)[_0x67e9('0x2e')](_0x3c6d8b);};}exports[_0x67e9('0x2f')]=function(_0x570f5a,_0x1ca9c9){var _0x54c456={},_0x383560={},_0x3ac090={'count':0x0,'rows':[]};var _0x5b98d2=_[_0x67e9('0x30')](db['CannedAnswer'][_0x67e9('0x31')],function(_0x3b1401){return{'name':_0x3b1401[_0x67e9('0x32')],'type':_0x3b1401[_0x67e9('0x33')][_0x67e9('0x34')]};});_0x383560[_0x67e9('0x35')]=_[_0x67e9('0x30')](_0x5b98d2,_0x67e9('0x2d'));_0x383560[_0x67e9('0x36')]=_[_0x67e9('0x37')](_0x570f5a[_0x67e9('0x36')]);_0x383560[_0x67e9('0x38')]=_[_0x67e9('0x39')](_0x383560[_0x67e9('0x35')],_0x383560[_0x67e9('0x36')]);_0x54c456[_0x67e9('0x3a')]=_[_0x67e9('0x39')](_0x383560[_0x67e9('0x35')],qs[_0x67e9('0x3b')](_0x570f5a[_0x67e9('0x36')]['fields']));_0x54c456['attributes']=_0x54c456[_0x67e9('0x3a')][_0x67e9('0x3c')]?_0x54c456[_0x67e9('0x3a')]:_0x383560[_0x67e9('0x35')];if(!_0x570f5a[_0x67e9('0x36')][_0x67e9('0x3d')](_0x67e9('0x3e'))){_0x54c456[_0x67e9('0x21')]=qs[_0x67e9('0x21')](_0x570f5a[_0x67e9('0x36')]['limit']);_0x54c456['offset']=qs[_0x67e9('0x1f')](_0x570f5a[_0x67e9('0x36')]['offset']);}_0x54c456[_0x67e9('0x3f')]=qs[_0x67e9('0x40')](_0x570f5a['query']['sort']);_0x54c456['where']=qs[_0x67e9('0x38')](_['pick'](_0x570f5a[_0x67e9('0x36')],_0x383560[_0x67e9('0x38')]),_0x5b98d2);if(_0x570f5a[_0x67e9('0x36')]['filter']){_0x54c456[_0x67e9('0x41')]=_['merge'](_0x54c456[_0x67e9('0x41')],{'$or':[{'key':{'$like':'%'+_0x570f5a[_0x67e9('0x36')][_0x67e9('0x42')]+'%'}},{'value':{'$like':'%'+_0x570f5a[_0x67e9('0x36')]['filter']+'%'}}]});}_0x54c456=_[_0x67e9('0x43')]({},_0x54c456,_0x570f5a[_0x67e9('0x44')]);var _0x26008d={'where':_0x54c456[_0x67e9('0x41')]};return db[_0x67e9('0x45')]['count'](_0x26008d)[_0x67e9('0x29')](function(_0x33e217){_0x3ac090['count']=_0x33e217;if(_0x570f5a['query'][_0x67e9('0x46')]){_0x54c456[_0x67e9('0x47')]=[{'all':!![]}];}return db[_0x67e9('0x45')][_0x67e9('0x48')](_0x54c456);})[_0x67e9('0x29')](function(_0x4b8ce3){_0x3ac090[_0x67e9('0x49')]=_0x4b8ce3;return _0x3ac090;})[_0x67e9('0x29')](respondWithFilteredResult(_0x1ca9c9,_0x54c456))[_0x67e9('0x4a')](handleError(_0x1ca9c9,null));};exports[_0x67e9('0x4b')]=function(_0x1d7eb0,_0x4d8b4e){var _0x35a91c={'raw':!![],'where':{'id':_0x1d7eb0[_0x67e9('0x4c')]['id']}},_0x20b331={};_0x20b331['model']=_[_0x67e9('0x37')](db[_0x67e9('0x45')][_0x67e9('0x31')]);_0x20b331[_0x67e9('0x36')]=_[_0x67e9('0x37')](_0x1d7eb0[_0x67e9('0x36')]);_0x20b331[_0x67e9('0x38')]=_['intersection'](_0x20b331[_0x67e9('0x35')],_0x20b331[_0x67e9('0x36')]);_0x35a91c['attributes']=_[_0x67e9('0x39')](_0x20b331[_0x67e9('0x35')],qs[_0x67e9('0x3b')](_0x1d7eb0['query'][_0x67e9('0x3b')]));_0x35a91c[_0x67e9('0x3a')]=_0x35a91c[_0x67e9('0x3a')][_0x67e9('0x3c')]?_0x35a91c[_0x67e9('0x3a')]:_0x20b331[_0x67e9('0x35')];if(_0x1d7eb0[_0x67e9('0x36')][_0x67e9('0x46')]){_0x35a91c[_0x67e9('0x47')]=[{'all':!![]}];}_0x35a91c=_['merge']({},_0x35a91c,_0x1d7eb0[_0x67e9('0x44')]);return db[_0x67e9('0x45')][_0x67e9('0x4d')](_0x35a91c)['then'](handleEntityNotFound(_0x4d8b4e,null))['then'](respondWithResult(_0x4d8b4e,null))['catch'](handleError(_0x4d8b4e,null));};exports[_0x67e9('0x27')]=function(_0x4f59fa,_0x2411fd){if(_0x4f59fa['body']['id']){delete _0x4f59fa[_0x67e9('0x4e')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x4f59fa['params']['id']}})[_0x67e9('0x29')](handleEntityNotFound(_0x2411fd,null))[_0x67e9('0x29')](saveUpdates(_0x4f59fa[_0x67e9('0x4e')],null))[_0x67e9('0x29')](respondWithResult(_0x2411fd,null))[_0x67e9('0x4a')](handleError(_0x2411fd,null));};exports['destroy']=function(_0x57da5d,_0x11654d){return db[_0x67e9('0x45')][_0x67e9('0x4d')]({'where':{'id':_0x57da5d[_0x67e9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11654d,null))[_0x67e9('0x29')](removeEntity(_0x11654d,null))[_0x67e9('0x4a')](handleError(_0x11654d,null));};exports[_0x67e9('0x4f')]=function(_0x2cf950,_0x526ecf){var _0x13f510={'key':_0x2cf950['body'][_0x67e9('0x34')]};if(_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x50')]){_0x13f510['MailAccountId']=_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x50')];}else if(_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x51')]){_0x13f510[_0x67e9('0x51')]=_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x51')];}else if(_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x52')]){_0x13f510[_0x67e9('0x52')]=_0x2cf950['body'][_0x67e9('0x52')];}else if(_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x53')]){_0x13f510[_0x67e9('0x53')]=_0x2cf950[_0x67e9('0x4e')][_0x67e9('0x53')];}return db[_0x67e9('0x45')][_0x67e9('0x4d')]({'where':_0x13f510})[_0x67e9('0x29')](function(_0x51e212){if(_0x51e212){throw new db[(_0x67e9('0x54'))][(_0x67e9('0x55'))](_0x67e9('0x56'));}return db['CannedAnswer'][_0x67e9('0x4f')](_0x2cf950[_0x67e9('0x4e')]);})[_0x67e9('0x29')](function(_0xaa1947){var _0x148ae4=_0x2cf950[_0x67e9('0x57')]['get']({'plain':!![]});if(!_0x148ae4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x148ae4[_0x67e9('0x58')]===_0x67e9('0x57')){var _0x3941a1=_0xaa1947[_0x67e9('0x59')]({'plain':!![]});return db[_0x67e9('0x5a')][_0x67e9('0x4d')]({'where':{'name':'CannedAnswers','userProfileId':_0x148ae4[_0x67e9('0x5b')]},'raw':!![]})['then'](function(_0x2d744f){if(_0x2d744f&&_0x2d744f['autoAssociation']===0x0){return db['UserProfileResource'][_0x67e9('0x4f')]({'name':_0x3941a1[_0x67e9('0x2d')],'resourceId':_0x3941a1['id'],'type':_0x2d744f[_0x67e9('0x2d')],'sectionId':_0x2d744f['id']},{})[_0x67e9('0x29')](function(){return _0xaa1947;});}else{return _0xaa1947;}})[_0x67e9('0x4a')](function(_0x10c200){logger[_0x67e9('0x2c')](_0x67e9('0x5c'),_0x10c200);throw _0x10c200;});}return _0xaa1947;})[_0x67e9('0x29')](respondWithResult(_0x526ecf,0xc9))[_0x67e9('0x4a')](handleError(_0x526ecf,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 29f3380..563b600 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 _0xca0d=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x501c4c,_0x30ce7f){var _0x318509=function(_0x2f5c93){while(--_0x2f5c93){_0x501c4c['push'](_0x501c4c['shift']());}};_0x318509(++_0x30ce7f);}(_0xca0d,0x17b));var _0xdca0=function(_0x3f267c,_0x150415){_0x3f267c=_0x3f267c-0x0;var _0x124815=_0xca0d[_0x3f267c];return _0x124815;};'use strict';var _=require(_0xdca0('0x0'));var util=require(_0xdca0('0x1'));var logger=require(_0xdca0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdca0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdca0('0x4'));var config=require(_0xdca0('0x5'));var attributes=require(_0xdca0('0x6'));module[_0xdca0('0x7')]=function(_0x2af9b7,_0x1897b8){return _0x2af9b7[_0xdca0('0x8')](_0xdca0('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdca0('0xa'),'collate':_0xdca0('0xb')});}; \ No newline at end of file +var _0xda51=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','util','request-promise','path'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xda51,0x7f));var _0x1da5=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0xda51[_0x21f9c2];return _0x3da17f;};'use strict';var _=require('lodash');var util=require(_0x1da5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1da5('0x1'));var fs=require('fs');var path=require(_0x1da5('0x2'));var rimraf=require(_0x1da5('0x3'));var config=require(_0x1da5('0x4'));var attributes=require(_0x1da5('0x5'));module[_0x1da5('0x6')]=function(_0xb8ba6f,_0x5b191b){return _0xb8ba6f[_0x1da5('0x7')]('CannedAnswer',attributes,{'tableName':_0x1da5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1da5('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0fe1965..90faecd 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(_0x300361,_0x1e6ad5){var _0x2a7301=function(_0x441fe6){while(--_0x441fe6){_0x300361['push'](_0x300361['shift']());}};_0x2a7301(++_0x1e6ad5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x2ebcb9,_0x3819cf){var _0x25714a=function(_0x1b0a4f){while(--_0x1b0a4f){_0x2ebcb9['push'](_0x2ebcb9['shift']());}};_0x25714a(++_0x3819cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 f877c66..d1d3d52 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 _0x8be8=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x1efcaa,_0x508b7e){var _0x4e5dd9=function(_0x2ef160){while(--_0x2ef160){_0x1efcaa['push'](_0x1efcaa['shift']());}};_0x4e5dd9(++_0x508b7e);}(_0x8be8,0x1e3));var _0x88be=function(_0x41c03d,_0x11991f){_0x41c03d=_0x41c03d-0x0;var _0x4428e4=_0x8be8[_0x41c03d];return _0x4428e4;};'use strict';var multer=require('multer');var util=require(_0x88be('0x0'));var path=require(_0x88be('0x1'));var timeout=require(_0x88be('0x2'));var express=require(_0x88be('0x3'));var router=express[_0x88be('0x4')]();var fs_extra=require(_0x88be('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x88be('0x6'));var config=require(_0x88be('0x7'));var controller=require(_0x88be('0x8'));router[_0x88be('0x9')]('/',auth[_0x88be('0xa')](),controller[_0x88be('0xb')]);router[_0x88be('0x9')](_0x88be('0xc'),auth['isAuthenticated'](),controller[_0x88be('0xd')]);router[_0x88be('0xe')]('/',auth[_0x88be('0xa')](),controller[_0x88be('0xf')]);router[_0x88be('0x10')](_0x88be('0xc'),auth[_0x88be('0xa')](),controller[_0x88be('0x11')]);router[_0x88be('0x12')](_0x88be('0xc'),auth[_0x88be('0xa')](),controller['destroy']);module[_0x88be('0x13')]=router; \ No newline at end of file +var _0x81b9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x81b9,0xa9));var _0x981b=function(_0x34ae74,_0x9b28fa){_0x34ae74=_0x34ae74-0x0;var _0x3ebfbc=_0x81b9[_0x34ae74];return _0x3ebfbc;};'use strict';var multer=require(_0x981b('0x0'));var util=require(_0x981b('0x1'));var path=require('path');var timeout=require(_0x981b('0x2'));var express=require(_0x981b('0x3'));var router=express[_0x981b('0x4')]();var fs_extra=require(_0x981b('0x5'));var auth=require(_0x981b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x981b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x981b('0x8')](_0x981b('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x981b('0xa')](),controller[_0x981b('0xb')]);router[_0x981b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x981b('0xd')]);router[_0x981b('0xe')](_0x981b('0x9'),auth[_0x981b('0xa')](),controller[_0x981b('0xf')]);module[_0x981b('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 0cbb306..17d625c 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 _0x22d5=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x3b4d50,_0x4f8332){var _0x27cffc=function(_0x5117cd){while(--_0x5117cd){_0x3b4d50['push'](_0x3b4d50['shift']());}};_0x27cffc(++_0x4f8332);}(_0x22d5,0xc5));var _0x522d=function(_0x4f8722,_0x47e4ae){_0x4f8722=_0x4f8722-0x0;var _0x1430eb=_0x22d5[_0x4f8722];return _0x1430eb;};'use strict';var Sequelize=require(_0x522d('0x0'));module[_0x522d('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x522d('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x522d('0x3')]},'dst':{'type':Sequelize[_0x522d('0x3')]},'dcontext':{'type':Sequelize[_0x522d('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x522d('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x522d('0x3')]},'duration':{'type':Sequelize[_0x522d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x522d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x522d('0x3')]},'amaflags':{'type':Sequelize[_0x522d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x522d('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x522d('0x3')]},'linkedid':{'type':Sequelize[_0x522d('0x3')]},'sequence':{'type':Sequelize[_0x522d('0x3')]},'peeraccount':{'type':Sequelize[_0x522d('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x522d('0x3')]}}; \ No newline at end of file +var _0xdb76=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x36c8b0,_0x3d63e3){var _0x1d3145=function(_0x29de60){while(--_0x29de60){_0x36c8b0['push'](_0x36c8b0['shift']());}};_0x1d3145(++_0x3d63e3);}(_0xdb76,0x1be));var _0x6db7=function(_0xaa3699,_0x173245){_0xaa3699=_0xaa3699-0x0;var _0x17ab5c=_0xdb76[_0xaa3699];return _0x17ab5c;};'use strict';var Sequelize=require(_0x6db7('0x0'));module[_0x6db7('0x1')]={'calldate':{'type':Sequelize[_0x6db7('0x2')],'allowNull':![],'defaultValue':_0x6db7('0x3')},'clid':{'type':Sequelize[_0x6db7('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x6db7('0x4')]},'dcontext':{'type':Sequelize[_0x6db7('0x4')]},'channel':{'type':Sequelize[_0x6db7('0x4')]},'dstchannel':{'type':Sequelize[_0x6db7('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6db7('0x4')]},'duration':{'type':Sequelize[_0x6db7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6db7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6db7('0x4')]},'amaflags':{'type':Sequelize[_0x6db7('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6db7('0x4')]},'uniqueid':{'type':Sequelize[_0x6db7('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x6db7('0x4')]},'peeraccount':{'type':Sequelize[_0x6db7('0x4')]},'type':{'type':Sequelize[_0x6db7('0x4')]},'tag':{'type':Sequelize[_0x6db7('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7a3b4a2..3f6d5af 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 _0x99c9=['merge','options','include','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','map','Cdr','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','filter'];(function(_0x3b2c66,_0x1bf0ee){var _0x1f16f9=function(_0x5d1570){while(--_0x5d1570){_0x3b2c66['push'](_0x3b2c66['shift']());}};_0x1f16f9(++_0x1bf0ee);}(_0x99c9,0x13c));var _0x999c=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x99c9[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x999c('0x0'));var rimraf=require(_0x999c('0x1'));var zipdir=require(_0x999c('0x2'));var jsonpatch=require(_0x999c('0x3'));var rp=require(_0x999c('0x4'));var moment=require(_0x999c('0x5'));var BPromise=require(_0x999c('0x6'));var Mustache=require('mustache');var util=require(_0x999c('0x7'));var path=require(_0x999c('0x8'));var sox=require(_0x999c('0x9'));var csv=require(_0x999c('0xa'));var ejs=require(_0x999c('0xb'));var fs=require('fs');var fs_extra=require(_0x999c('0xc'));var _=require(_0x999c('0xd'));var squel=require(_0x999c('0xe'));var crypto=require(_0x999c('0xf'));var jsforce=require(_0x999c('0x10'));var deskjs=require(_0x999c('0x11'));var toCsv=require(_0x999c('0xa'));var querystring=require(_0x999c('0x12'));var Papa=require(_0x999c('0x13'));var Redis=require('ioredis');var authService=require(_0x999c('0x14'));var qs=require(_0x999c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x999c('0x16'));var logger=require(_0x999c('0x17'))(_0x999c('0x18'));var utils=require(_0x999c('0x19'));var config=require(_0x999c('0x1a'));var licenseUtil=require(_0x999c('0x1b'));var db=require(_0x999c('0x1c'))['db'];function respondWithStatusCode(_0x3d7c6d,_0x2e5f7e){_0x2e5f7e=_0x2e5f7e||0xcc;return function(_0x44a5bc){if(_0x44a5bc){return _0x3d7c6d[_0x999c('0x1d')](_0x2e5f7e);}return _0x3d7c6d[_0x999c('0x1e')](_0x2e5f7e)['end']();};}function respondWithResult(_0x15f812,_0xd14862){_0xd14862=_0xd14862||0xc8;return function(_0x4f2916){if(_0x4f2916){return _0x15f812['status'](_0xd14862)['json'](_0x4f2916);}};}function respondWithFilteredResult(_0x161434,_0xb3e981){return function(_0x203a73){if(_0x203a73){var _0x116f08=typeof _0xb3e981[_0x999c('0x1f')]==='undefined'&&typeof _0xb3e981[_0x999c('0x20')]===_0x999c('0x21');var _0x2b6126=_0x203a73[_0x999c('0x22')];var _0x110486=_0x116f08?0x0:_0xb3e981['offset'];var _0x1b327f=_0x116f08?_0x203a73[_0x999c('0x22')]:_0xb3e981[_0x999c('0x1f')]+_0xb3e981[_0x999c('0x20')];var _0x32c66c;if(_0x1b327f>=_0x2b6126){_0x1b327f=_0x2b6126;_0x32c66c=0xc8;}else{_0x32c66c=0xce;}_0x161434['status'](_0x32c66c);return _0x161434[_0x999c('0x23')](_0x999c('0x24'),_0x110486+'-'+_0x1b327f+'/'+_0x2b6126)[_0x999c('0x25')](_0x203a73);}return null;};}function patchUpdates(_0x1ec406){return function(_0xceb421){try{jsonpatch[_0x999c('0x26')](_0xceb421,_0x1ec406,!![]);}catch(_0x4a2865){return BPromise[_0x999c('0x27')](_0x4a2865);}return _0xceb421[_0x999c('0x28')]();};}function saveUpdates(_0x24f637,_0x2bcfc9){return function(_0x1c6e55){if(_0x1c6e55){return _0x1c6e55[_0x999c('0x29')](_0x24f637)[_0x999c('0x2a')](function(_0x2a7986){return _0x2a7986;});}return null;};}function removeEntity(_0x4002d2,_0x281720){return function(_0x2cfd83){if(_0x2cfd83){return _0x2cfd83['destroy']()[_0x999c('0x2a')](function(){_0x4002d2[_0x999c('0x1e')](0xcc)[_0x999c('0x2b')]();});}};}function handleEntityNotFound(_0x2e9d58,_0x2256fd){return function(_0x15d102){if(!_0x15d102){_0x2e9d58['sendStatus'](0x194);}return _0x15d102;};}function handleError(_0x4755c2,_0x43293f){_0x43293f=_0x43293f||0x1f4;return function(_0x1c866f){logger['error'](_0x1c866f[_0x999c('0x2c')]);if(_0x1c866f[_0x999c('0x2d')]){delete _0x1c866f['name'];}_0x4755c2[_0x999c('0x1e')](_0x43293f)['send'](_0x1c866f);};}exports['index']=function(_0xedf57d,_0x42cb25){var _0x457df3={},_0x2de6d5={},_0x3737e9={'count':0x0,'rows':[]};var _0x42c2e8=_[_0x999c('0x2e')](db[_0x999c('0x2f')][_0x999c('0x30')],function(_0x3b836a){return{'name':_0x3b836a['fieldName'],'type':_0x3b836a[_0x999c('0x31')][_0x999c('0x32')]};});_0x2de6d5[_0x999c('0x33')]=_[_0x999c('0x2e')](_0x42c2e8,_0x999c('0x2d'));_0x2de6d5[_0x999c('0x34')]=_[_0x999c('0x35')](_0xedf57d[_0x999c('0x34')]);_0x2de6d5['filters']=_['intersection'](_0x2de6d5[_0x999c('0x33')],_0x2de6d5[_0x999c('0x34')]);_0x457df3[_0x999c('0x36')]=_[_0x999c('0x37')](_0x2de6d5['model'],qs[_0x999c('0x38')](_0xedf57d[_0x999c('0x34')][_0x999c('0x38')]));_0x457df3[_0x999c('0x36')]=_0x457df3['attributes']['length']?_0x457df3[_0x999c('0x36')]:_0x2de6d5[_0x999c('0x33')];if(!_0xedf57d[_0x999c('0x34')][_0x999c('0x39')](_0x999c('0x3a'))){_0x457df3[_0x999c('0x20')]=qs[_0x999c('0x20')](_0xedf57d['query']['limit']);_0x457df3['offset']=qs[_0x999c('0x1f')](_0xedf57d[_0x999c('0x34')]['offset']);}_0x457df3['order']=qs['sort'](_0xedf57d[_0x999c('0x34')][_0x999c('0x3b')]);_0x457df3[_0x999c('0x3c')]=qs[_0x999c('0x3d')](_['pick'](_0xedf57d[_0x999c('0x34')],_0x2de6d5[_0x999c('0x3d')]),_0x42c2e8);if(_0xedf57d['query']['filter']){_0x457df3[_0x999c('0x3c')]=_['merge'](_0x457df3[_0x999c('0x3c')],{'$or':_['map'](_0x42c2e8,function(_0x3605a3){if(_0x3605a3[_0x999c('0x31')]!==_0x999c('0x3e')){var _0xcd729={};_0xcd729[_0x3605a3['name']]={'$like':'%'+_0xedf57d['query'][_0x999c('0x3f')]+'%'};return _0xcd729;}})});}_0x457df3=_[_0x999c('0x40')]({},_0x457df3,_0xedf57d[_0x999c('0x41')]);var _0xf26ba3={'where':_0x457df3['where']};return db[_0x999c('0x2f')][_0x999c('0x22')](_0xf26ba3)[_0x999c('0x2a')](function(_0x5fa1de){_0x3737e9['count']=_0x5fa1de;if(_0xedf57d[_0x999c('0x34')]['includeAll']){_0x457df3[_0x999c('0x42')]=[{'all':!![]}];}return db[_0x999c('0x2f')]['findAll'](_0x457df3);})[_0x999c('0x2a')](function(_0x357915){_0x3737e9[_0x999c('0x43')]=_0x357915;return _0x3737e9;})[_0x999c('0x2a')](respondWithFilteredResult(_0x42cb25,_0x457df3))[_0x999c('0x44')](handleError(_0x42cb25,null));};exports[_0x999c('0x45')]=function(_0xa6b0f1,_0x3edf69){var _0x4ef478={'raw':!![],'where':{'id':_0xa6b0f1['params']['id']}},_0x563e11={};_0x563e11['model']=_[_0x999c('0x35')](db[_0x999c('0x2f')][_0x999c('0x30')]);_0x563e11[_0x999c('0x34')]=_[_0x999c('0x35')](_0xa6b0f1['query']);_0x563e11[_0x999c('0x3d')]=_[_0x999c('0x37')](_0x563e11[_0x999c('0x33')],_0x563e11[_0x999c('0x34')]);_0x4ef478[_0x999c('0x36')]=_['intersection'](_0x563e11[_0x999c('0x33')],qs[_0x999c('0x38')](_0xa6b0f1[_0x999c('0x34')][_0x999c('0x38')]));_0x4ef478[_0x999c('0x36')]=_0x4ef478[_0x999c('0x36')][_0x999c('0x46')]?_0x4ef478[_0x999c('0x36')]:_0x563e11[_0x999c('0x33')];if(_0xa6b0f1['query']['includeAll']){_0x4ef478[_0x999c('0x42')]=[{'all':!![]}];}_0x4ef478=_[_0x999c('0x40')]({},_0x4ef478,_0xa6b0f1[_0x999c('0x41')]);return db[_0x999c('0x2f')][_0x999c('0x47')](_0x4ef478)[_0x999c('0x2a')](handleEntityNotFound(_0x3edf69,null))[_0x999c('0x2a')](respondWithResult(_0x3edf69,null))[_0x999c('0x44')](handleError(_0x3edf69,null));};exports[_0x999c('0x48')]=function(_0x26ebd7,_0x3457d6){return db['Cdr'][_0x999c('0x48')](_0x26ebd7[_0x999c('0x49')],{})[_0x999c('0x2a')](respondWithResult(_0x3457d6,0xc9))[_0x999c('0x44')](handleError(_0x3457d6,null));};exports[_0x999c('0x29')]=function(_0x386be6,_0x11f3bf){if(_0x386be6[_0x999c('0x49')]['id']){delete _0x386be6['body']['id'];}return db[_0x999c('0x2f')][_0x999c('0x47')]({'where':{'id':_0x386be6[_0x999c('0x4a')]['id']}})[_0x999c('0x2a')](handleEntityNotFound(_0x11f3bf,null))[_0x999c('0x2a')](saveUpdates(_0x386be6[_0x999c('0x49')],null))[_0x999c('0x2a')](respondWithResult(_0x11f3bf,null))['catch'](handleError(_0x11f3bf,null));};exports['destroy']=function(_0x1139f6,_0x3f134a){return db[_0x999c('0x2f')][_0x999c('0x47')]({'where':{'id':_0x1139f6[_0x999c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f134a,null))[_0x999c('0x2a')](removeEntity(_0x3f134a,null))[_0x999c('0x44')](handleError(_0x3f134a,null));};exports[_0x999c('0x4b')]=function(_0x11cc72,_0x5c066e){return db[_0x999c('0x2f')]['describe']()[_0x999c('0x2a')](respondWithResult(_0x5c066e,null))[_0x999c('0x44')](handleError(_0x5c066e,null));}; \ No newline at end of file +var _0xd6d6=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type'];(function(_0x6dcc3b,_0x506e51){var _0x2dea27=function(_0x24e40e){while(--_0x24e40e){_0x6dcc3b['push'](_0x6dcc3b['shift']());}};_0x2dea27(++_0x506e51);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4c38e4,_0x3f9d7b){_0x4c38e4=_0x4c38e4-0x0;var _0x453a84=_0xd6d6[_0x4c38e4];return _0x453a84;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x2d')](_0xde3272,'name');_0x8a9a84[_0x6d6d('0x34')]=_['keys'](_0x553645[_0x6d6d('0x34')]);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x553645['query'][_0x6d6d('0x38')]));_0x5273cd[_0x6d6d('0x37')]=_0x5273cd[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x5273cd[_0x6d6d('0x37')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x34')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1e')]);_0x5273cd[_0x6d6d('0x1f')]=qs['offset'](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1f')]);}_0x5273cd[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3d')](_0x553645['query']['sort']);_0x5273cd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x35')](_[_0x6d6d('0x3f')](_0x553645['query'],_0x8a9a84[_0x6d6d('0x35')]),_0xde3272);if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]){_0x5273cd[_0x6d6d('0x3e')]=_['merge'](_0x5273cd['where'],{'$or':_['map'](_0xde3272,function(_0x62620d){if(_0x62620d[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x22a49a={};_0x22a49a[_0x62620d['name']]={'$like':'%'+_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]+'%'};return _0x22a49a;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x3d632c={'where':_0x5273cd[_0x6d6d('0x3e')]};return db['Cdr'][_0x6d6d('0x20')](_0x3d632c)[_0x6d6d('0x27')](function(_0x42aff0){_0x57341f[_0x6d6d('0x20')]=_0x42aff0;if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x5273cd[_0x6d6d('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x6d6d('0x46')](_0x5273cd);})[_0x6d6d('0x27')](function(_0x16e177){_0x57341f[_0x6d6d('0x47')]=_0x16e177;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))['catch'](handleError(_0x3edcce,null));};exports[_0x6d6d('0x48')]=function(_0x39f2a9,_0x55dba8){var _0x452de2={'raw':!![],'where':{'id':_0x39f2a9[_0x6d6d('0x49')]['id']}},_0x50dc17={};_0x50dc17[_0x6d6d('0x33')]=_['keys'](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x50dc17[_0x6d6d('0x34')]=_[_0x6d6d('0x4a')](_0x39f2a9[_0x6d6d('0x34')]);_0x50dc17['filters']=_['intersection'](_0x50dc17[_0x6d6d('0x33')],_0x50dc17['query']);_0x452de2['attributes']=_[_0x6d6d('0x36')](_0x50dc17[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x39f2a9['query'][_0x6d6d('0x38')]));_0x452de2['attributes']=_0x452de2[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x452de2[_0x6d6d('0x37')]:_0x50dc17[_0x6d6d('0x33')];if(_0x39f2a9[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x452de2[_0x6d6d('0x45')]=[{'all':!![]}];}_0x452de2=_['merge']({},_0x452de2,_0x39f2a9[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')](_0x452de2)[_0x6d6d('0x27')](handleEntityNotFound(_0x55dba8,null))[_0x6d6d('0x27')](respondWithResult(_0x55dba8,null))[_0x6d6d('0x4c')](handleError(_0x55dba8,null));};exports[_0x6d6d('0x4d')]=function(_0x1d2b20,_0x24cec2){return db['Cdr']['create'](_0x1d2b20[_0x6d6d('0x4e')],{})[_0x6d6d('0x27')](respondWithResult(_0x24cec2,0xc9))[_0x6d6d('0x4c')](handleError(_0x24cec2,null));};exports[_0x6d6d('0x26')]=function(_0xe2a20e,_0x492834){if(_0xe2a20e[_0x6d6d('0x4e')]['id']){delete _0xe2a20e[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0xe2a20e[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x27')](saveUpdates(_0xe2a20e[_0x6d6d('0x4e')],null))[_0x6d6d('0x27')](respondWithResult(_0x492834,null))[_0x6d6d('0x4c')](handleError(_0x492834,null));};exports[_0x6d6d('0x28')]=function(_0x175e26,_0x4d9811){return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0x175e26[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x4d9811,null))[_0x6d6d('0x27')](removeEntity(_0x4d9811,null))['catch'](handleError(_0x4d9811,null));};exports[_0x6d6d('0x4f')]=function(_0x36bc5a,_0x45340b){return db['Cdr']['describe']()[_0x6d6d('0x27')](respondWithResult(_0x45340b,null))['catch'](handleError(_0x45340b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d4556c5..bd0962e 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x502211,_0x30c0e7){var _0x323391=function(_0x6ebdc0){while(--_0x6ebdc0){_0x502211['push'](_0x502211['shift']());}};_0x323391(++_0x30c0e7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x7c220b,_0x28c84d){var _0x3b5f7e=function(_0x5af67e){while(--_0x5af67e){_0x7c220b['push'](_0x7c220b['shift']());}};_0x3b5f7e(++_0x28c84d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 704039c..1240a01 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 _0x2b86=['../../config/logger','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9eb13e,_0x5d5531){var _0x1d7286=function(_0x49369f){while(--_0x49369f){_0x9eb13e['push'](_0x9eb13e['shift']());}};_0x1d7286(++_0x5d5531);}(_0x2b86,0x196));var _0x62b8=function(_0x378739,_0x5c8a7a){_0x378739=_0x378739-0x0;var _0x24471f=_0x2b86[_0x378739];return _0x24471f;};'use strict';var _=require(_0x62b8('0x0'));var util=require(_0x62b8('0x1'));var moment=require(_0x62b8('0x2'));var BPromise=require(_0x62b8('0x3'));var rs=require(_0x62b8('0x4'));var fs=require('fs');var Redis=require(_0x62b8('0x5'));var db=require(_0x62b8('0x6'))['db'];var utils=require(_0x62b8('0x7'));var logger=require(_0x62b8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x62b8('0x9'));var client=jayson[_0x62b8('0xa')][_0x62b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d0d05,_0x1fdf78,_0x27a4f6){return new BPromise(function(_0x30b4e7,_0x28aac5){return client[_0x62b8('0xc')](_0x2d0d05,_0x27a4f6)['then'](function(_0x2ce483){logger[_0x62b8('0xd')](_0x62b8('0xe'),_0x1fdf78,_0x62b8('0xf'));logger[_0x62b8('0x10')](_0x62b8('0x11'),_0x1fdf78,_0x62b8('0xf'),JSON[_0x62b8('0x12')](_0x2ce483));if(_0x2ce483[_0x62b8('0x13')]){if(_0x2ce483['error']['code']===0x1f4){logger[_0x62b8('0x13')](_0x62b8('0xe'),_0x1fdf78,_0x2ce483['error'][_0x62b8('0x14')]);return _0x28aac5(_0x2ce483[_0x62b8('0x13')][_0x62b8('0x14')]);}logger[_0x62b8('0x13')](_0x62b8('0xe'),_0x1fdf78,_0x2ce483[_0x62b8('0x13')][_0x62b8('0x14')]);return _0x30b4e7(_0x2ce483[_0x62b8('0x13')][_0x62b8('0x14')]);}else{logger['info'](_0x62b8('0xe'),_0x1fdf78,_0x62b8('0xf'));_0x30b4e7(_0x2ce483[_0x62b8('0x15')][_0x62b8('0x14')]);}})[_0x62b8('0x16')](function(_0x70cf90){logger[_0x62b8('0x13')]('Cdr,\x20%s,\x20%s',_0x1fdf78,_0x70cf90);_0x28aac5(_0x70cf90);});});} \ No newline at end of file +var _0x6a0c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x19d638,_0x1ca3d7){var _0x2db8b8=function(_0x510385){while(--_0x510385){_0x19d638['push'](_0x19d638['shift']());}};_0x2db8b8(++_0x1ca3d7);}(_0x6a0c,0x10e));var _0xc6a0=function(_0x111316,_0x5c4166){_0x111316=_0x111316-0x0;var _0x5dab09=_0x6a0c[_0x111316];return _0x5dab09;};'use strict';var _=require(_0xc6a0('0x0'));var util=require('util');var moment=require(_0xc6a0('0x1'));var BPromise=require(_0xc6a0('0x2'));var rs=require(_0xc6a0('0x3'));var fs=require('fs');var Redis=require(_0xc6a0('0x4'));var db=require(_0xc6a0('0x5'))['db'];var utils=require(_0xc6a0('0x6'));var logger=require('../../config/logger')(_0xc6a0('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6a0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340461,_0x309f38,_0x48989b){return new BPromise(function(_0x5c9f1c,_0x4ded67){return client[_0xc6a0('0x9')](_0x340461,_0x48989b)['then'](function(_0x233ebb){logger[_0xc6a0('0xa')](_0xc6a0('0xb'),_0x309f38,'request\x20sent');logger[_0xc6a0('0xc')](_0xc6a0('0xd'),_0x309f38,'request\x20sent',JSON['stringify'](_0x233ebb));if(_0x233ebb[_0xc6a0('0xe')]){if(_0x233ebb[_0xc6a0('0xe')][_0xc6a0('0xf')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x309f38,_0x233ebb['error']['message']);return _0x4ded67(_0x233ebb[_0xc6a0('0xe')][_0xc6a0('0x10')]);}logger[_0xc6a0('0xe')](_0xc6a0('0xb'),_0x309f38,_0x233ebb[_0xc6a0('0xe')][_0xc6a0('0x10')]);return _0x5c9f1c(_0x233ebb[_0xc6a0('0xe')][_0xc6a0('0x10')]);}else{logger['info'](_0xc6a0('0xb'),_0x309f38,_0xc6a0('0x11'));_0x5c9f1c(_0x233ebb['result'][_0xc6a0('0x10')]);}})['catch'](function(_0x14d2c7){logger[_0xc6a0('0xe')](_0xc6a0('0xb'),_0x309f38,_0x14d2c7);_0x4ded67(_0x14d2c7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9a31613..a7b7611 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2f6e47,_0x40ba6b){var _0x29c331=function(_0x18d873){while(--_0x18d873){_0x2f6e47['push'](_0x2f6e47['shift']());}};_0x29c331(++_0x40ba6b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3a0aef,_0x4815f2){var _0x837448=function(_0x2ccc78){while(--_0x2ccc78){_0x3a0aef['push'](_0x3a0aef['shift']());}};_0x837448(++_0x4815f2);}(_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('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4a95ecf..c5a7e1e 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 _0x82f0=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x82f0,0x19c));var _0x082f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x82f0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x082f('0x0'));module[_0x082f('0x1')]={'priority':{'type':Sequelize[_0x082f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x082f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x082f('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x082f('0x5')}}; \ No newline at end of file +var _0x4631=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x4631,0x18a));var _0x1463=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x4631[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0x1463('0x0'));module[_0x1463('0x1')]={'priority':{'type':Sequelize[_0x1463('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1463('0x3')]},'interval':{'type':Sequelize[_0x1463('0x3')],'defaultValue':_0x1463('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e8a6105..82e2983 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 _0x1bb2=['../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','show','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','ChatApplication','find','catch','body','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x290a82,_0x37b7aa){var _0x4c9955=function(_0x288e31){while(--_0x288e31){_0x290a82['push'](_0x290a82['shift']());}};_0x4c9955(++_0x37b7aa);}(_0x1bb2,0x152));var _0x21bb=function(_0x3002a2,_0x514522){_0x3002a2=_0x3002a2-0x0;var _0x42524e=_0x1bb2[_0x3002a2];return _0x42524e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21bb('0x0'));var zipdir=require(_0x21bb('0x1'));var jsonpatch=require(_0x21bb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21bb('0x3'));var Mustache=require(_0x21bb('0x4'));var util=require(_0x21bb('0x5'));var path=require(_0x21bb('0x6'));var sox=require(_0x21bb('0x7'));var csv=require(_0x21bb('0x8'));var ejs=require(_0x21bb('0x9'));var fs=require('fs');var fs_extra=require(_0x21bb('0xa'));var _=require(_0x21bb('0xb'));var squel=require(_0x21bb('0xc'));var crypto=require(_0x21bb('0xd'));var jsforce=require(_0x21bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21bb('0x8'));var querystring=require('querystring');var Papa=require(_0x21bb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21bb('0x10'));var as=require(_0x21bb('0x11'));var hardwareService=require(_0x21bb('0x12'));var logger=require(_0x21bb('0x13'))(_0x21bb('0x14'));var utils=require(_0x21bb('0x15'));var config=require(_0x21bb('0x16'));var licenseUtil=require(_0x21bb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x231d5b,_0x3026eb){_0x3026eb=_0x3026eb||0xcc;return function(_0x516c76){if(_0x516c76){return _0x231d5b[_0x21bb('0x18')](_0x3026eb);}return _0x231d5b[_0x21bb('0x19')](_0x3026eb)['end']();};}function respondWithResult(_0x42ad54,_0xae34f3){_0xae34f3=_0xae34f3||0xc8;return function(_0x3444e1){if(_0x3444e1){return _0x42ad54[_0x21bb('0x19')](_0xae34f3)['json'](_0x3444e1);}};}function respondWithFilteredResult(_0x2eaa36,_0x589d0f){return function(_0x5eb3d2){if(_0x5eb3d2){var _0x18daa7=typeof _0x589d0f[_0x21bb('0x1a')]===_0x21bb('0x1b')&&typeof _0x589d0f[_0x21bb('0x1c')]===_0x21bb('0x1b');var _0x412d50=_0x5eb3d2[_0x21bb('0x1d')];var _0x15fc36=_0x18daa7?0x0:_0x589d0f[_0x21bb('0x1a')];var _0x17ee1d=_0x18daa7?_0x5eb3d2[_0x21bb('0x1d')]:_0x589d0f['offset']+_0x589d0f[_0x21bb('0x1c')];var _0x159ac6;if(_0x17ee1d>=_0x412d50){_0x17ee1d=_0x412d50;_0x159ac6=0xc8;}else{_0x159ac6=0xce;}_0x2eaa36[_0x21bb('0x19')](_0x159ac6);return _0x2eaa36['set'](_0x21bb('0x1e'),_0x15fc36+'-'+_0x17ee1d+'/'+_0x412d50)[_0x21bb('0x1f')](_0x5eb3d2);}return null;};}function patchUpdates(_0x271a9f){return function(_0x28899f){try{jsonpatch[_0x21bb('0x20')](_0x28899f,_0x271a9f,!![]);}catch(_0x44930d){return BPromise[_0x21bb('0x21')](_0x44930d);}return _0x28899f[_0x21bb('0x22')]();};}function saveUpdates(_0x169623,_0x3d4814){return function(_0x9f93a7){if(_0x9f93a7){return _0x9f93a7[_0x21bb('0x23')](_0x169623)['then'](function(_0x353019){return _0x353019;});}return null;};}function removeEntity(_0x2b2bc3,_0x358c1a){return function(_0x490266){if(_0x490266){return _0x490266[_0x21bb('0x24')]()[_0x21bb('0x25')](function(){_0x2b2bc3[_0x21bb('0x19')](0xcc)[_0x21bb('0x26')]();});}};}function handleEntityNotFound(_0x40d801,_0x3239e2){return function(_0x112412){if(!_0x112412){_0x40d801[_0x21bb('0x18')](0x194);}return _0x112412;};}function handleError(_0x4db3ad,_0x22a467){_0x22a467=_0x22a467||0x1f4;return function(_0xed3ab2){logger[_0x21bb('0x27')](_0xed3ab2[_0x21bb('0x28')]);if(_0xed3ab2['name']){delete _0xed3ab2[_0x21bb('0x29')];}_0x4db3ad[_0x21bb('0x19')](_0x22a467)[_0x21bb('0x2a')](_0xed3ab2);};}exports[_0x21bb('0x2b')]=function(_0xc6ae64,_0x2c09d6){var _0x20de34={'raw':!![],'where':{'id':_0xc6ae64['params']['id']}},_0x256974={};_0x256974[_0x21bb('0x2c')]=_[_0x21bb('0x2d')](db['ChatApplication'][_0x21bb('0x2e')]);_0x256974[_0x21bb('0x2f')]=_[_0x21bb('0x2d')](_0xc6ae64['query']);_0x256974[_0x21bb('0x30')]=_['intersection'](_0x256974[_0x21bb('0x2c')],_0x256974[_0x21bb('0x2f')]);_0x20de34[_0x21bb('0x31')]=_[_0x21bb('0x32')](_0x256974['model'],qs[_0x21bb('0x33')](_0xc6ae64[_0x21bb('0x2f')]['fields']));_0x20de34[_0x21bb('0x31')]=_0x20de34[_0x21bb('0x31')][_0x21bb('0x34')]?_0x20de34[_0x21bb('0x31')]:_0x256974[_0x21bb('0x2c')];if(_0xc6ae64[_0x21bb('0x2f')]['includeAll']){_0x20de34[_0x21bb('0x35')]=[{'all':!![]}];}_0x20de34=_[_0x21bb('0x36')]({},_0x20de34,_0xc6ae64['options']);return db[_0x21bb('0x37')][_0x21bb('0x38')](_0x20de34)['then'](handleEntityNotFound(_0x2c09d6,null))[_0x21bb('0x25')](respondWithResult(_0x2c09d6,null))[_0x21bb('0x39')](handleError(_0x2c09d6,null));};exports[_0x21bb('0x23')]=function(_0x3ac411,_0x58e25a){if(_0x3ac411['body']['id']){delete _0x3ac411[_0x21bb('0x3a')]['id'];}return db['ChatApplication'][_0x21bb('0x38')]({'where':{'id':_0x3ac411['params']['id']}})[_0x21bb('0x25')](handleEntityNotFound(_0x58e25a,null))[_0x21bb('0x25')](saveUpdates(_0x3ac411[_0x21bb('0x3a')],null))[_0x21bb('0x25')](respondWithResult(_0x58e25a,null))[_0x21bb('0x39')](handleError(_0x58e25a,null));};exports['destroy']=function(_0x50ad22,_0xee3a6b){return db[_0x21bb('0x37')][_0x21bb('0x38')]({'where':{'id':_0x50ad22[_0x21bb('0x3b')]['id']}})[_0x21bb('0x25')](handleEntityNotFound(_0xee3a6b,null))['then'](removeEntity(_0xee3a6b,null))['catch'](handleError(_0xee3a6b,null));}; \ No newline at end of file +var _0x97e7=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','model','intersection','fields','attributes','includeAll','include','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x59004c,_0xaf71a5){var _0x3cbb8d=function(_0x224c6e){while(--_0x224c6e){_0x59004c['push'](_0x59004c['shift']());}};_0x3cbb8d(++_0xaf71a5);}(_0x97e7,0x1a1));var _0x797e=function(_0x4c77b8,_0x3f38b6){_0x4c77b8=_0x4c77b8-0x0;var _0x2f8918=_0x97e7[_0x4c77b8];return _0x2f8918;};'use strict';var emlformat=require(_0x797e('0x0'));var rimraf=require(_0x797e('0x1'));var zipdir=require(_0x797e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x797e('0x3'));var moment=require(_0x797e('0x4'));var BPromise=require(_0x797e('0x5'));var Mustache=require(_0x797e('0x6'));var util=require(_0x797e('0x7'));var path=require(_0x797e('0x8'));var sox=require(_0x797e('0x9'));var csv=require(_0x797e('0xa'));var ejs=require(_0x797e('0xb'));var fs=require('fs');var fs_extra=require(_0x797e('0xc'));var _=require(_0x797e('0xd'));var squel=require(_0x797e('0xe'));var crypto=require('crypto');var jsforce=require(_0x797e('0xf'));var deskjs=require(_0x797e('0x10'));var toCsv=require(_0x797e('0xa'));var querystring=require(_0x797e('0x11'));var Papa=require('papaparse');var Redis=require(_0x797e('0x12'));var authService=require(_0x797e('0x13'));var qs=require(_0x797e('0x14'));var as=require(_0x797e('0x15'));var hardwareService=require(_0x797e('0x16'));var logger=require(_0x797e('0x17'))(_0x797e('0x18'));var utils=require('../../config/utils');var config=require(_0x797e('0x19'));var licenseUtil=require(_0x797e('0x1a'));var db=require(_0x797e('0x1b'))['db'];function respondWithStatusCode(_0x5e924f,_0x23eb05){_0x23eb05=_0x23eb05||0xcc;return function(_0x5adb17){if(_0x5adb17){return _0x5e924f[_0x797e('0x1c')](_0x23eb05);}return _0x5e924f['status'](_0x23eb05)[_0x797e('0x1d')]();};}function respondWithResult(_0x437b80,_0x506fde){_0x506fde=_0x506fde||0xc8;return function(_0x318f6d){if(_0x318f6d){return _0x437b80['status'](_0x506fde)[_0x797e('0x1e')](_0x318f6d);}};}function respondWithFilteredResult(_0xfbd7a2,_0x27e5b6){return function(_0x1ccfaa){if(_0x1ccfaa){var _0x442ba0=typeof _0x27e5b6[_0x797e('0x1f')]===_0x797e('0x20')&&typeof _0x27e5b6[_0x797e('0x21')]===_0x797e('0x20');var _0x582288=_0x1ccfaa[_0x797e('0x22')];var _0x26469b=_0x442ba0?0x0:_0x27e5b6[_0x797e('0x1f')];var _0x47ca1f=_0x442ba0?_0x1ccfaa[_0x797e('0x22')]:_0x27e5b6[_0x797e('0x1f')]+_0x27e5b6['limit'];var _0x2c1657;if(_0x47ca1f>=_0x582288){_0x47ca1f=_0x582288;_0x2c1657=0xc8;}else{_0x2c1657=0xce;}_0xfbd7a2[_0x797e('0x23')](_0x2c1657);return _0xfbd7a2[_0x797e('0x24')](_0x797e('0x25'),_0x26469b+'-'+_0x47ca1f+'/'+_0x582288)[_0x797e('0x1e')](_0x1ccfaa);}return null;};}function patchUpdates(_0x57ddae){return function(_0x3cc7b4){try{jsonpatch['apply'](_0x3cc7b4,_0x57ddae,!![]);}catch(_0x544225){return BPromise['reject'](_0x544225);}return _0x3cc7b4['save']();};}function saveUpdates(_0x47bde9,_0x2f7bdc){return function(_0x323333){if(_0x323333){return _0x323333[_0x797e('0x26')](_0x47bde9)[_0x797e('0x27')](function(_0x1b03d0){return _0x1b03d0;});}return null;};}function removeEntity(_0x137aea,_0x41d4df){return function(_0x1023e7){if(_0x1023e7){return _0x1023e7[_0x797e('0x28')]()[_0x797e('0x27')](function(){_0x137aea[_0x797e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d5391,_0x1da25e){return function(_0x56e9c0){if(!_0x56e9c0){_0x3d5391[_0x797e('0x1c')](0x194);}return _0x56e9c0;};}function handleError(_0xe8bfa0,_0x2879e6){_0x2879e6=_0x2879e6||0x1f4;return function(_0x28189c){logger[_0x797e('0x29')](_0x28189c[_0x797e('0x2a')]);if(_0x28189c[_0x797e('0x2b')]){delete _0x28189c[_0x797e('0x2b')];}_0xe8bfa0[_0x797e('0x23')](_0x2879e6)[_0x797e('0x2c')](_0x28189c);};}exports[_0x797e('0x2d')]=function(_0x58e0ce,_0x281ade){var _0x3b540d={'raw':!![],'where':{'id':_0x58e0ce[_0x797e('0x2e')]['id']}},_0x3dbe9b={};_0x3dbe9b['model']=_[_0x797e('0x2f')](db[_0x797e('0x30')][_0x797e('0x31')]);_0x3dbe9b['query']=_[_0x797e('0x2f')](_0x58e0ce[_0x797e('0x32')]);_0x3dbe9b['filters']=_['intersection'](_0x3dbe9b[_0x797e('0x33')],_0x3dbe9b['query']);_0x3b540d['attributes']=_[_0x797e('0x34')](_0x3dbe9b[_0x797e('0x33')],qs['fields'](_0x58e0ce['query'][_0x797e('0x35')]));_0x3b540d[_0x797e('0x36')]=_0x3b540d[_0x797e('0x36')]['length']?_0x3b540d['attributes']:_0x3dbe9b['model'];if(_0x58e0ce[_0x797e('0x32')][_0x797e('0x37')]){_0x3b540d[_0x797e('0x38')]=[{'all':!![]}];}_0x3b540d=_['merge']({},_0x3b540d,_0x58e0ce[_0x797e('0x39')]);return db['ChatApplication'][_0x797e('0x3a')](_0x3b540d)[_0x797e('0x27')](handleEntityNotFound(_0x281ade,null))[_0x797e('0x27')](respondWithResult(_0x281ade,null))[_0x797e('0x3b')](handleError(_0x281ade,null));};exports['update']=function(_0x4f6b22,_0x5be6e1){if(_0x4f6b22[_0x797e('0x3c')]['id']){delete _0x4f6b22['body']['id'];}return db[_0x797e('0x30')]['find']({'where':{'id':_0x4f6b22[_0x797e('0x2e')]['id']}})[_0x797e('0x27')](handleEntityNotFound(_0x5be6e1,null))['then'](saveUpdates(_0x4f6b22[_0x797e('0x3c')],null))['then'](respondWithResult(_0x5be6e1,null))['catch'](handleError(_0x5be6e1,null));};exports['destroy']=function(_0x58e7d5,_0x40c347){return db[_0x797e('0x30')][_0x797e('0x3a')]({'where':{'id':_0x58e7d5[_0x797e('0x2e')]['id']}})['then'](handleEntityNotFound(_0x40c347,null))['then'](removeEntity(_0x40c347,null))['catch'](handleError(_0x40c347,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e805530..07145df 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 _0x8811=['../../config/environment','./chatApplication.attributes','define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8811,0x73));var _0x1881=function(_0x42edd9,_0x1e5ea1){_0x42edd9=_0x42edd9-0x0;var _0x5ef512=_0x8811[_0x42edd9];return _0x5ef512;};'use strict';var _=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var logger=require(_0x1881('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1881('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1881('0x4'));var rimraf=require(_0x1881('0x5'));var config=require(_0x1881('0x6'));var attributes=require(_0x1881('0x7'));module['exports']=function(_0x281294,_0x16bbdb){return _0x281294[_0x1881('0x8')](_0x1881('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1881('0xa')});}; \ No newline at end of file +var _0x7ae7=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x31bc86,_0x1629b5){var _0x3da61e=function(_0x560836){while(--_0x560836){_0x31bc86['push'](_0x31bc86['shift']());}};_0x3da61e(++_0x1629b5);}(_0x7ae7,0xd9));var _0x77ae=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0x7ae7[_0x40ebc3];return _0x1d8b08;};'use strict';var _=require(_0x77ae('0x0'));var util=require(_0x77ae('0x1'));var logger=require('../../config/logger')(_0x77ae('0x2'));var moment=require(_0x77ae('0x3'));var BPromise=require(_0x77ae('0x4'));var rp=require(_0x77ae('0x5'));var fs=require('fs');var path=require(_0x77ae('0x6'));var rimraf=require(_0x77ae('0x7'));var config=require(_0x77ae('0x8'));var attributes=require(_0x77ae('0x9'));module[_0x77ae('0xa')]=function(_0x3dd200,_0x276be6){return _0x3dd200[_0x77ae('0xb')](_0x77ae('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77ae('0xd'),'collate':_0x77ae('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9735dd7..6092768 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 _0xd06f=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','info'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xd06f,0x1a7));var _0xfd06=function(_0x1f0448,_0xa2865f){_0x1f0448=_0x1f0448-0x0;var _0x16fe78=_0xd06f[_0x1f0448];return _0x16fe78;};'use strict';var _=require('lodash');var util=require(_0xfd06('0x0'));var moment=require(_0xfd06('0x1'));var BPromise=require(_0xfd06('0x2'));var rs=require(_0xfd06('0x3'));var fs=require('fs');var Redis=require(_0xfd06('0x4'));var db=require(_0xfd06('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd06('0x6'));var client=jayson[_0xfd06('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495e4a,_0x48b73d,_0x36f177){return new BPromise(function(_0xdc0750,_0x5499ff){return client['request'](_0x495e4a,_0x36f177)['then'](function(_0x458b4a){logger[_0xfd06('0x8')](_0xfd06('0x9'),_0x48b73d,_0xfd06('0xa'));logger[_0xfd06('0xb')](_0xfd06('0xc'),_0x48b73d,'request\x20sent',JSON['stringify'](_0x458b4a));if(_0x458b4a[_0xfd06('0xd')]){if(_0x458b4a[_0xfd06('0xd')][_0xfd06('0xe')]===0x1f4){logger[_0xfd06('0xd')](_0xfd06('0x9'),_0x48b73d,_0x458b4a['error'][_0xfd06('0xf')]);return _0x5499ff(_0x458b4a[_0xfd06('0xd')][_0xfd06('0xf')]);}logger[_0xfd06('0xd')](_0xfd06('0x9'),_0x48b73d,_0x458b4a['error'][_0xfd06('0xf')]);return _0xdc0750(_0x458b4a[_0xfd06('0xd')][_0xfd06('0xf')]);}else{logger[_0xfd06('0x8')](_0xfd06('0x9'),_0x48b73d,_0xfd06('0xa'));_0xdc0750(_0x458b4a[_0xfd06('0x10')]['message']);}})[_0xfd06('0x11')](function(_0x191ac9){logger[_0xfd06('0xd')]('ChatApplication,\x20%s,\x20%s',_0x48b73d,_0x191ac9);_0x5499ff(_0x191ac9);});});} \ No newline at end of file +var _0x9e20=['message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s'];(function(_0x4b3cfe,_0x17a344){var _0x3f9e47=function(_0x1438c6){while(--_0x1438c6){_0x4b3cfe['push'](_0x4b3cfe['shift']());}};_0x3f9e47(++_0x17a344);}(_0x9e20,0x172));var _0x09e2=function(_0x21662d,_0x213eea){_0x21662d=_0x21662d-0x0;var _0x236c05=_0x9e20[_0x21662d];return _0x236c05;};'use strict';var _=require(_0x09e2('0x0'));var util=require(_0x09e2('0x1'));var moment=require(_0x09e2('0x2'));var BPromise=require(_0x09e2('0x3'));var rs=require(_0x09e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09e2('0x5'));var logger=require(_0x09e2('0x6'))(_0x09e2('0x7'));var config=require(_0x09e2('0x8'));var jayson=require(_0x09e2('0x9'));var client=jayson[_0x09e2('0xa')][_0x09e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb5725a,_0x3ff34c,_0x215cb4){return new BPromise(function(_0x504bcd,_0x4d0ca1){return client[_0x09e2('0xc')](_0xb5725a,_0x215cb4)[_0x09e2('0xd')](function(_0x442f21){logger[_0x09e2('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3ff34c,'request\x20sent');logger[_0x09e2('0xf')](_0x09e2('0x10'),_0x3ff34c,_0x09e2('0x11'),JSON[_0x09e2('0x12')](_0x442f21));if(_0x442f21[_0x09e2('0x13')]){if(_0x442f21[_0x09e2('0x13')]['code']===0x1f4){logger[_0x09e2('0x13')](_0x09e2('0x14'),_0x3ff34c,_0x442f21[_0x09e2('0x13')]['message']);return _0x4d0ca1(_0x442f21[_0x09e2('0x13')]['message']);}logger[_0x09e2('0x13')](_0x09e2('0x14'),_0x3ff34c,_0x442f21[_0x09e2('0x13')][_0x09e2('0x15')]);return _0x504bcd(_0x442f21['error'][_0x09e2('0x15')]);}else{logger[_0x09e2('0xe')](_0x09e2('0x14'),_0x3ff34c,_0x09e2('0x11'));_0x504bcd(_0x442f21[_0x09e2('0x16')][_0x09e2('0x15')]);}})['catch'](function(_0x1cb1d2){logger[_0x09e2('0x13')]('ChatApplication,\x20%s,\x20%s',_0x3ff34c,_0x1cb1d2);_0x4d0ca1(_0x1cb1d2);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 87b091d..2b0b61a 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 _0x2fe6=['../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x18d916,_0x522ebd){var _0x21830e=function(_0x1ad5c2){while(--_0x1ad5c2){_0x18d916['push'](_0x18d916['shift']());}};_0x21830e(++_0x522ebd);}(_0x2fe6,0x1da));var _0x62fe=function(_0x58cb4f,_0x3fc4ee){_0x58cb4f=_0x58cb4f-0x0;var _0x4a52cc=_0x2fe6[_0x58cb4f];return _0x4a52cc;};'use strict';var multer=require('multer');var util=require(_0x62fe('0x0'));var path=require(_0x62fe('0x1'));var timeout=require(_0x62fe('0x2'));var express=require(_0x62fe('0x3'));var router=express[_0x62fe('0x4')]();var fs_extra=require(_0x62fe('0x5'));var auth=require(_0x62fe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x62fe('0x7'));var controller=require('./chatApplication.controller');router[_0x62fe('0x8')](_0x62fe('0x9'),auth[_0x62fe('0xa')](),controller['show']);router[_0x62fe('0xb')](_0x62fe('0x9'),auth['isAuthenticated'](),controller[_0x62fe('0xc')]);router[_0x62fe('0xd')](_0x62fe('0x9'),auth[_0x62fe('0xa')](),controller[_0x62fe('0xe')]);module[_0x62fe('0xf')]=router; \ No newline at end of file +var _0x556d=['show','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0x556d,0x16c));var _0xd556=function(_0x164e5d,_0x1da231){_0x164e5d=_0x164e5d-0x0;var _0x476cfe=_0x556d[_0x164e5d];return _0x476cfe;};'use strict';var multer=require(_0xd556('0x0'));var util=require(_0xd556('0x1'));var path=require(_0xd556('0x2'));var timeout=require(_0xd556('0x3'));var express=require(_0xd556('0x4'));var router=express[_0xd556('0x5')]();var fs_extra=require(_0xd556('0x6'));var auth=require(_0xd556('0x7'));var interaction=require(_0xd556('0x8'));var config=require(_0xd556('0x9'));var controller=require(_0xd556('0xa'));router[_0xd556('0xb')](_0xd556('0xc'),auth[_0xd556('0xd')](),controller[_0xd556('0xe')]);router['put'](_0xd556('0xc'),auth['isAuthenticated'](),controller[_0xd556('0xf')]);router['delete'](_0xd556('0xc'),auth['isAuthenticated'](),controller[_0xd556('0x10')]);module[_0xd556('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 fcaf9bd..e54b43b 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 _0x9527=['STRING','exports'];(function(_0x143d26,_0x5dd1d6){var _0x130c43=function(_0x5323ec){while(--_0x5323ec){_0x143d26['push'](_0x143d26['shift']());}};_0x130c43(++_0x5dd1d6);}(_0x9527,0x135));var _0x7952=function(_0x823840,_0x27d075){_0x823840=_0x823840-0x0;var _0x547997=_0x9527[_0x823840];return _0x547997;};'use strict';var Sequelize=require('sequelize');module[_0x7952('0x0')]={'name':{'type':Sequelize[_0x7952('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7952('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd48e=['exports','STRING','BOOLEAN'];(function(_0x138ed5,_0x215001){var _0x14b804=function(_0x271f16){while(--_0x271f16){_0x138ed5['push'](_0x138ed5['shift']());}};_0x14b804(++_0x215001);}(_0xd48e,0x93));var _0xed48=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd48e[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0xed48('0x0')]={'name':{'type':Sequelize[_0xed48('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xed48('0x1')]},'write':{'type':Sequelize[_0xed48('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b4eb556..31d22a9 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 _0xcd6c=['findAll','rows','catch','show','params','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','User','hasOwnProperty','getMembers','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','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/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','offset','undefined','count','limit','status','set','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x1c83c9,_0x2a0efc){var _0x49c840=function(_0x2945e2){while(--_0x2945e2){_0x1c83c9['push'](_0x1c83c9['shift']());}};_0x49c840(++_0x2a0efc);}(_0xcd6c,0x1a3));var _0xccd6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd6c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xccd6('0x0'));var rimraf=require(_0xccd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccd6('0x2'));var rp=require(_0xccd6('0x3'));var moment=require(_0xccd6('0x4'));var BPromise=require(_0xccd6('0x5'));var Mustache=require('mustache');var util=require(_0xccd6('0x6'));var path=require('path');var sox=require(_0xccd6('0x7'));var csv=require(_0xccd6('0x8'));var ejs=require(_0xccd6('0x9'));var fs=require('fs');var fs_extra=require(_0xccd6('0xa'));var _=require(_0xccd6('0xb'));var squel=require(_0xccd6('0xc'));var crypto=require(_0xccd6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xccd6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xccd6('0xf'));var Redis=require(_0xccd6('0x10'));var authService=require(_0xccd6('0x11'));var qs=require(_0xccd6('0x12'));var as=require(_0xccd6('0x13'));var hardwareService=require(_0xccd6('0x14'));var logger=require(_0xccd6('0x15'))('api');var utils=require(_0xccd6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xccd6('0x17'));var db=require('../../mysqldb')['db'];config[_0xccd6('0x18')]=_[_0xccd6('0x19')](config[_0xccd6('0x18')],{'host':_0xccd6('0x1a'),'port':0x18eb});var socket=require(_0xccd6('0x1b'))(new Redis(config[_0xccd6('0x18')]));require('./chatGroup.socket')[_0xccd6('0x1c')](socket);function respondWithStatusCode(_0xcc0481,_0x1ae6c9){_0x1ae6c9=_0x1ae6c9||0xcc;return function(_0xd97318){if(_0xd97318){return _0xcc0481['sendStatus'](_0x1ae6c9);}return _0xcc0481['status'](_0x1ae6c9)[_0xccd6('0x1d')]();};}function respondWithResult(_0x4b6ef3,_0x301fcc){_0x301fcc=_0x301fcc||0xc8;return function(_0x1be952){if(_0x1be952){return _0x4b6ef3['status'](_0x301fcc)['json'](_0x1be952);}};}function respondWithFilteredResult(_0x70cbd9,_0x461ef9){return function(_0x2be871){if(_0x2be871){var _0x2d90a9=typeof _0x461ef9[_0xccd6('0x1e')]===_0xccd6('0x1f')&&typeof _0x461ef9['limit']===_0xccd6('0x1f');var _0x873b40=_0x2be871[_0xccd6('0x20')];var _0x37b1fd=_0x2d90a9?0x0:_0x461ef9[_0xccd6('0x1e')];var _0x323739=_0x2d90a9?_0x2be871[_0xccd6('0x20')]:_0x461ef9[_0xccd6('0x1e')]+_0x461ef9[_0xccd6('0x21')];var _0x41c028;if(_0x323739>=_0x873b40){_0x323739=_0x873b40;_0x41c028=0xc8;}else{_0x41c028=0xce;}_0x70cbd9[_0xccd6('0x22')](_0x41c028);return _0x70cbd9[_0xccd6('0x23')]('Content-Range',_0x37b1fd+'-'+_0x323739+'/'+_0x873b40)[_0xccd6('0x24')](_0x2be871);}return null;};}function patchUpdates(_0x2becee){return function(_0x51fe96){try{jsonpatch[_0xccd6('0x25')](_0x51fe96,_0x2becee,!![]);}catch(_0x371c60){return BPromise[_0xccd6('0x26')](_0x371c60);}return _0x51fe96['save']();};}function saveUpdates(_0x52a31d,_0x50a050){return function(_0x586e29){if(_0x586e29){return _0x586e29[_0xccd6('0x27')](_0x52a31d)[_0xccd6('0x28')](function(_0x476e92){return _0x476e92;});}return null;};}function removeEntity(_0x11b65d,_0x19e94b){return function(_0x5d4756){if(_0x5d4756){return _0x5d4756[_0xccd6('0x29')]()[_0xccd6('0x28')](function(){_0x11b65d['status'](0xcc)[_0xccd6('0x1d')]();});}};}function handleEntityNotFound(_0x2b08bd,_0x4d337c){return function(_0xbbb75f){if(!_0xbbb75f){_0x2b08bd[_0xccd6('0x2a')](0x194);}return _0xbbb75f;};}function handleError(_0x13f690,_0x10e5ae){_0x10e5ae=_0x10e5ae||0x1f4;return function(_0x2f558e){logger[_0xccd6('0x2b')](_0x2f558e['stack']);if(_0x2f558e['name']){delete _0x2f558e[_0xccd6('0x2c')];}_0x13f690[_0xccd6('0x22')](_0x10e5ae)[_0xccd6('0x2d')](_0x2f558e);};}exports[_0xccd6('0x2e')]=function(_0x30c69a,_0x48d2a7){var _0x3b4dcb={},_0x3b4905={},_0x25c249={'count':0x0,'rows':[]};var _0x18e0ea=_[_0xccd6('0x2f')](db[_0xccd6('0x30')][_0xccd6('0x31')],function(_0x3a2518){return{'name':_0x3a2518[_0xccd6('0x32')],'type':_0x3a2518[_0xccd6('0x33')][_0xccd6('0x34')]};});_0x3b4905[_0xccd6('0x35')]=_[_0xccd6('0x2f')](_0x18e0ea,_0xccd6('0x2c'));_0x3b4905[_0xccd6('0x36')]=_[_0xccd6('0x37')](_0x30c69a[_0xccd6('0x36')]);_0x3b4905[_0xccd6('0x38')]=_[_0xccd6('0x39')](_0x3b4905['model'],_0x3b4905[_0xccd6('0x36')]);_0x3b4dcb[_0xccd6('0x3a')]=_[_0xccd6('0x39')](_0x3b4905[_0xccd6('0x35')],qs[_0xccd6('0x3b')](_0x30c69a[_0xccd6('0x36')][_0xccd6('0x3b')]));_0x3b4dcb[_0xccd6('0x3a')]=_0x3b4dcb['attributes'][_0xccd6('0x3c')]?_0x3b4dcb[_0xccd6('0x3a')]:_0x3b4905['model'];if(!_0x30c69a[_0xccd6('0x36')]['hasOwnProperty'](_0xccd6('0x3d'))){_0x3b4dcb[_0xccd6('0x21')]=qs[_0xccd6('0x21')](_0x30c69a[_0xccd6('0x36')]['limit']);_0x3b4dcb[_0xccd6('0x1e')]=qs[_0xccd6('0x1e')](_0x30c69a[_0xccd6('0x36')][_0xccd6('0x1e')]);}_0x3b4dcb['order']=qs[_0xccd6('0x3e')](_0x30c69a[_0xccd6('0x36')]['sort']);_0x3b4dcb[_0xccd6('0x3f')]=qs[_0xccd6('0x38')](_[_0xccd6('0x40')](_0x30c69a['query'],_0x3b4905[_0xccd6('0x38')]),_0x18e0ea);if(_0x30c69a[_0xccd6('0x36')][_0xccd6('0x41')]){_0x3b4dcb[_0xccd6('0x3f')]=_[_0xccd6('0x42')](_0x3b4dcb['where'],{'$or':_[_0xccd6('0x2f')](_0x18e0ea,function(_0x4f1a1b){if(_0x4f1a1b[_0xccd6('0x33')]!==_0xccd6('0x43')){var _0x22fbd1={};_0x22fbd1[_0x4f1a1b['name']]={'$like':'%'+_0x30c69a['query'][_0xccd6('0x41')]+'%'};return _0x22fbd1;}})});}_0x3b4dcb=_[_0xccd6('0x42')]({},_0x3b4dcb,_0x30c69a[_0xccd6('0x44')]);var _0x4da0d1={'where':_0x3b4dcb[_0xccd6('0x3f')]};return db[_0xccd6('0x30')][_0xccd6('0x20')](_0x4da0d1)['then'](function(_0x14f5d7){_0x25c249[_0xccd6('0x20')]=_0x14f5d7;if(_0x30c69a['query'][_0xccd6('0x45')]){_0x3b4dcb[_0xccd6('0x46')]=[{'all':!![]}];}return db[_0xccd6('0x30')][_0xccd6('0x47')](_0x3b4dcb);})[_0xccd6('0x28')](function(_0x153a38){_0x25c249[_0xccd6('0x48')]=_0x153a38;return _0x25c249;})[_0xccd6('0x28')](respondWithFilteredResult(_0x48d2a7,_0x3b4dcb))[_0xccd6('0x49')](handleError(_0x48d2a7,null));};exports[_0xccd6('0x4a')]=function(_0x2d28cd,_0x4fa307){var _0x175a20={'raw':!![],'where':{'id':_0x2d28cd[_0xccd6('0x4b')]['id']}},_0xe7717e={};_0xe7717e[_0xccd6('0x35')]=_[_0xccd6('0x37')](db[_0xccd6('0x30')]['rawAttributes']);_0xe7717e['query']=_[_0xccd6('0x37')](_0x2d28cd[_0xccd6('0x36')]);_0xe7717e['filters']=_[_0xccd6('0x39')](_0xe7717e['model'],_0xe7717e[_0xccd6('0x36')]);_0x175a20['attributes']=_['intersection'](_0xe7717e[_0xccd6('0x35')],qs['fields'](_0x2d28cd[_0xccd6('0x36')][_0xccd6('0x3b')]));_0x175a20['attributes']=_0x175a20['attributes'][_0xccd6('0x3c')]?_0x175a20[_0xccd6('0x3a')]:_0xe7717e[_0xccd6('0x35')];if(_0x2d28cd['query'][_0xccd6('0x45')]){_0x175a20[_0xccd6('0x46')]=[{'all':!![]}];}_0x175a20=_[_0xccd6('0x42')]({},_0x175a20,_0x2d28cd[_0xccd6('0x44')]);return db[_0xccd6('0x30')][_0xccd6('0x4c')](_0x175a20)[_0xccd6('0x28')](handleEntityNotFound(_0x4fa307,null))[_0xccd6('0x28')](respondWithResult(_0x4fa307,null))[_0xccd6('0x49')](handleError(_0x4fa307,null));};exports[_0xccd6('0x4d')]=function(_0x2c34d5,_0x5312c5){return db['ChatGroup'][_0xccd6('0x4d')](_0x2c34d5[_0xccd6('0x4e')],{})['then'](respondWithResult(_0x5312c5,0xc9))[_0xccd6('0x49')](handleError(_0x5312c5,null));};exports[_0xccd6('0x27')]=function(_0x549ce4,_0x344baa){if(_0x549ce4[_0xccd6('0x4e')]['id']){delete _0x549ce4[_0xccd6('0x4e')]['id'];}return db[_0xccd6('0x30')][_0xccd6('0x4c')]({'where':{'id':_0x549ce4[_0xccd6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x344baa,null))[_0xccd6('0x28')](saveUpdates(_0x549ce4[_0xccd6('0x4e')],null))[_0xccd6('0x28')](respondWithResult(_0x344baa,null))[_0xccd6('0x49')](handleError(_0x344baa,null));};exports[_0xccd6('0x29')]=function(_0x85bb6b,_0x145ebb){return db[_0xccd6('0x30')][_0xccd6('0x4c')]({'where':{'id':_0x85bb6b[_0xccd6('0x4b')]['id']}})[_0xccd6('0x28')](handleEntityNotFound(_0x145ebb,null))[_0xccd6('0x28')](removeEntity(_0x145ebb,null))[_0xccd6('0x49')](handleError(_0x145ebb,null));};exports[_0xccd6('0x4f')]=function(_0x607cff,_0x5b0d09){return db[_0xccd6('0x30')][_0xccd6('0x4f')]()['then'](respondWithResult(_0x5b0d09,null))[_0xccd6('0x49')](handleError(_0x5b0d09,null));};exports[_0xccd6('0x50')]=function(_0x456dbd,_0x42ce86,_0x299c8b){return db['ChatInternalMessage'][_0xccd6('0x20')]({'where':{'ChatGroupId':_0x456dbd['params']['id'],'ToId':_0x456dbd[_0xccd6('0x51')]['id'],'read':![]}})[_0xccd6('0x28')](function(_0x4af618){return{'id':_[_0xccd6('0x52')](_0x456dbd[_0xccd6('0x4b')]['id']),'count':_0x4af618};})[_0xccd6('0x28')](respondWithResult(_0x42ce86,null))[_0xccd6('0x49')](handleError(_0x42ce86,null));};exports[_0xccd6('0x53')]=function(_0x32624e,_0x2983af,_0xb4c245){return db[_0xccd6('0x30')][_0xccd6('0x4c')]({'where':{'id':_0x32624e[_0xccd6('0x4b')]['id']}})[_0xccd6('0x28')](handleEntityNotFound(_0x2983af,null))[_0xccd6('0x28')](function(_0x3819b0){if(_0x3819b0){return _0x3819b0[_0xccd6('0x53')](_0x32624e[_0xccd6('0x4e')][_0xccd6('0x54')],_[_0xccd6('0x55')](_0x32624e[_0xccd6('0x4e')],['ids','id'])||{});}})[_0xccd6('0x28')](respondWithResult(_0x2983af,null))['catch'](handleError(_0x2983af,null));};exports['getMembers']=function(_0x25e482,_0x13bacb,_0x4074a4){var _0x3f2d1d={};var _0x12fe45={};var _0xeb4141;var _0x4f5712;return db[_0xccd6('0x30')]['findOne']({'where':{'id':_0x25e482[_0xccd6('0x4b')]['id']}})[_0xccd6('0x28')](handleEntityNotFound(_0x13bacb,null))[_0xccd6('0x28')](function(_0x8ca994){if(_0x8ca994){_0xeb4141=_0x8ca994;_0x12fe45['model']=_[_0xccd6('0x37')](db[_0xccd6('0x56')][_0xccd6('0x31')]);_0x12fe45[_0xccd6('0x36')]=_['keys'](_0x25e482[_0xccd6('0x36')]);_0x12fe45['filters']=_[_0xccd6('0x39')](_0x12fe45['model'],_0x12fe45[_0xccd6('0x36')]);_0x3f2d1d[_0xccd6('0x3a')]=_[_0xccd6('0x39')](_0x12fe45[_0xccd6('0x35')],qs['fields'](_0x25e482[_0xccd6('0x36')]['fields']));_0x3f2d1d[_0xccd6('0x3a')]=_0x3f2d1d['attributes']['length']?_0x3f2d1d[_0xccd6('0x3a')]:_0x12fe45[_0xccd6('0x35')];_0x3f2d1d['order']=qs[_0xccd6('0x3e')](_0x25e482[_0xccd6('0x36')][_0xccd6('0x3e')]);_0x3f2d1d[_0xccd6('0x3f')]=qs[_0xccd6('0x38')](_[_0xccd6('0x40')](_0x25e482[_0xccd6('0x36')],_0x12fe45[_0xccd6('0x38')]));if(_0x25e482['query'][_0xccd6('0x41')]){_0x3f2d1d['where']=_[_0xccd6('0x42')](_0x3f2d1d[_0xccd6('0x3f')],{'$or':_[_0xccd6('0x2f')](_0x3f2d1d['attributes'],function(_0x16096f){var _0x1b9bb6={};_0x1b9bb6[_0x16096f]={'$like':'%'+_0x25e482[_0xccd6('0x36')][_0xccd6('0x41')]+'%'};return _0x1b9bb6;})});}_0x3f2d1d=_[_0xccd6('0x42')]({},_0x3f2d1d,_0x25e482['options']);return _0xeb4141['getMembers'](_0x3f2d1d);}})[_0xccd6('0x28')](function(_0x40121c){if(_0x40121c){_0x4f5712=_0x40121c[_0xccd6('0x3c')];if(!_0x25e482[_0xccd6('0x36')][_0xccd6('0x57')](_0xccd6('0x3d'))){_0x3f2d1d[_0xccd6('0x21')]=qs[_0xccd6('0x21')](_0x25e482[_0xccd6('0x36')]['limit']);_0x3f2d1d[_0xccd6('0x1e')]=qs[_0xccd6('0x1e')](_0x25e482[_0xccd6('0x36')]['offset']);}return _0xeb4141[_0xccd6('0x58')](_0x3f2d1d);}})[_0xccd6('0x28')](function(_0x34ed7f){if(_0x34ed7f){return _0x34ed7f?{'count':_0x4f5712,'rows':_0x34ed7f}:null;}})['then'](respondWithResult(_0x13bacb,null))[_0xccd6('0x49')](handleError(_0x13bacb,null));};exports[_0xccd6('0x59')]=function(_0x59cebb,_0x3dc14a,_0x24f2fb){return db['ChatGroup']['find']({'where':{'id':_0x59cebb[_0xccd6('0x4b')]['id']}})[_0xccd6('0x28')](handleEntityNotFound(_0x3dc14a,null))[_0xccd6('0x28')](function(_0x126cca){if(_0x126cca){return _0x126cca[_0xccd6('0x59')](_0x59cebb[_0xccd6('0x36')][_0xccd6('0x54')]);}})[_0xccd6('0x28')](respondWithStatusCode(_0x3dc14a,null))[_0xccd6('0x49')](handleError(_0x3dc14a,null));};exports[_0xccd6('0x5a')]=function(_0x2a0890,_0xb5cafe,_0xa2e4ef){if(_0x2a0890['body']['id']){delete _0x2a0890[_0xccd6('0x4e')]['id'];}return db[_0xccd6('0x30')][_0xccd6('0x4c')]({'where':{'id':_0x2a0890[_0xccd6('0x4b')]['id']}})[_0xccd6('0x28')](handleEntityNotFound(_0xb5cafe,null))['then'](function(_0x5f5adc){if(_0x5f5adc){_0x2a0890[_0xccd6('0x4e')][_0xccd6('0x5b')]=_0x5f5adc['id'];return db[_0xccd6('0x5c')]['create'](_0x2a0890['body']);}})[_0xccd6('0x28')](respondWithResult(_0xb5cafe,null))[_0xccd6('0x49')](handleError(_0xb5cafe,null));};exports[_0xccd6('0x5d')]=function(_0x4d1175,_0x58523d,_0x4cd571){var _0x2646e4={};var _0x2d131e={};var _0x4a999c;var _0x5373ac;return db[_0xccd6('0x30')][_0xccd6('0x5e')]({'where':{'id':_0x4d1175[_0xccd6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58523d,null))['then'](function(_0x43a525){if(_0x43a525){_0x4a999c=_0x43a525;_0x2d131e[_0xccd6('0x35')]=_['keys'](db[_0xccd6('0x5c')][_0xccd6('0x31')]);_0x2d131e[_0xccd6('0x36')]=_[_0xccd6('0x37')](_0x4d1175[_0xccd6('0x36')]);_0x2d131e[_0xccd6('0x38')]=_['intersection'](_0x2d131e[_0xccd6('0x35')],_0x2d131e[_0xccd6('0x36')]);_0x2646e4['attributes']=_[_0xccd6('0x39')](_0x2d131e[_0xccd6('0x35')],qs[_0xccd6('0x3b')](_0x4d1175[_0xccd6('0x36')]['fields']));_0x2646e4[_0xccd6('0x3a')]=_0x2646e4[_0xccd6('0x3a')][_0xccd6('0x3c')]?_0x2646e4['attributes']:_0x2d131e[_0xccd6('0x35')];_0x2646e4['order']=qs[_0xccd6('0x3e')](_0x4d1175[_0xccd6('0x36')]['sort']);_0x2646e4[_0xccd6('0x3f')]=qs[_0xccd6('0x38')](_[_0xccd6('0x40')](_0x4d1175['query'],_0x2d131e[_0xccd6('0x38')]));if(_0x4d1175[_0xccd6('0x36')][_0xccd6('0x41')]){_0x2646e4[_0xccd6('0x3f')]=_['merge'](_0x2646e4['where'],{'$or':_[_0xccd6('0x2f')](_0x2646e4[_0xccd6('0x3a')],function(_0x2e37da){var _0x531318={};_0x531318[_0x2e37da]={'$like':'%'+_0x4d1175['query'][_0xccd6('0x41')]+'%'};return _0x531318;})});}if(_0x4d1175[_0xccd6('0x36')][_0xccd6('0x5f')]){var _0x3a3889=_0x4d1175[_0xccd6('0x36')]['$gte']['split'](',');var _0x57be95={};_0x57be95[_0x3a3889[0x0]]={'$gte':moment(_0x3a3889[0x1])[_0xccd6('0x60')](_0xccd6('0x61'))};_0x2646e4[_0xccd6('0x3f')]=_[_0xccd6('0x42')](_0x2646e4[_0xccd6('0x3f')],_0x57be95);}_0x2646e4=_[_0xccd6('0x42')]({},_0x2646e4,_0x4d1175[_0xccd6('0x44')]);return _0x4a999c[_0xccd6('0x5d')](_0x2646e4);}})['then'](function(_0x43fdec){if(_0x43fdec){_0x5373ac=_0x43fdec['length'];if(!_0x4d1175['query'][_0xccd6('0x57')]('nolimit')){_0x2646e4[_0xccd6('0x21')]=qs['limit'](_0x4d1175[_0xccd6('0x36')][_0xccd6('0x21')]);_0x2646e4['offset']=qs[_0xccd6('0x1e')](_0x4d1175[_0xccd6('0x36')][_0xccd6('0x1e')]);}return _0x4a999c[_0xccd6('0x5d')](_0x2646e4);}})[_0xccd6('0x28')](function(_0x3cd44f){if(_0x3cd44f){return _0x3cd44f?{'count':_0x5373ac,'rows':_0x3cd44f}:null;}})[_0xccd6('0x28')](respondWithResult(_0x58523d,null))[_0xccd6('0x49')](handleError(_0x58523d,null));}; \ No newline at end of file +var _0x2503=['json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','ChatGroup','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','removeMembers','ids','addMessage','getMessages','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end'];(function(_0x21db42,_0x1c998c){var _0x493b0a=function(_0x544c8a){while(--_0x544c8a){_0x21db42['push'](_0x21db42['shift']());}};_0x493b0a(++_0x1c998c);}(_0x2503,0x110));var _0x3250=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2503[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3250('0x0'));var rimraf=require(_0x3250('0x1'));var zipdir=require(_0x3250('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3250('0x3'));var moment=require(_0x3250('0x4'));var BPromise=require(_0x3250('0x5'));var Mustache=require(_0x3250('0x6'));var util=require(_0x3250('0x7'));var path=require(_0x3250('0x8'));var sox=require(_0x3250('0x9'));var csv=require(_0x3250('0xa'));var ejs=require(_0x3250('0xb'));var fs=require('fs');var fs_extra=require(_0x3250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3250('0xd'));var jsforce=require(_0x3250('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3250('0xa'));var querystring=require(_0x3250('0xf'));var Papa=require('papaparse');var Redis=require(_0x3250('0x10'));var authService=require(_0x3250('0x11'));var qs=require(_0x3250('0x12'));var as=require(_0x3250('0x13'));var hardwareService=require(_0x3250('0x14'));var logger=require(_0x3250('0x15'))(_0x3250('0x16'));var utils=require(_0x3250('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3250('0x18'));var db=require(_0x3250('0x19'))['db'];config[_0x3250('0x1a')]=_[_0x3250('0x1b')](config[_0x3250('0x1a')],{'host':_0x3250('0x1c'),'port':0x18eb});var socket=require(_0x3250('0x1d'))(new Redis(config[_0x3250('0x1a')]));require(_0x3250('0x1e'))['register'](socket);function respondWithStatusCode(_0x2c15e1,_0x3e2533){_0x3e2533=_0x3e2533||0xcc;return function(_0x2585f0){if(_0x2585f0){return _0x2c15e1[_0x3250('0x1f')](_0x3e2533);}return _0x2c15e1[_0x3250('0x20')](_0x3e2533)[_0x3250('0x21')]();};}function respondWithResult(_0x2358a9,_0x38e872){_0x38e872=_0x38e872||0xc8;return function(_0xa83344){if(_0xa83344){return _0x2358a9['status'](_0x38e872)[_0x3250('0x22')](_0xa83344);}};}function respondWithFilteredResult(_0x8d2f67,_0x4239ad){return function(_0x4b77da){if(_0x4b77da){var _0x3d5ba8=typeof _0x4239ad[_0x3250('0x23')]===_0x3250('0x24')&&typeof _0x4239ad['limit']===_0x3250('0x24');var _0x5707f2=_0x4b77da[_0x3250('0x25')];var _0x3837a3=_0x3d5ba8?0x0:_0x4239ad['offset'];var _0x3ee6bd=_0x3d5ba8?_0x4b77da['count']:_0x4239ad[_0x3250('0x23')]+_0x4239ad['limit'];var _0x1fb0c4;if(_0x3ee6bd>=_0x5707f2){_0x3ee6bd=_0x5707f2;_0x1fb0c4=0xc8;}else{_0x1fb0c4=0xce;}_0x8d2f67[_0x3250('0x20')](_0x1fb0c4);return _0x8d2f67[_0x3250('0x26')](_0x3250('0x27'),_0x3837a3+'-'+_0x3ee6bd+'/'+_0x5707f2)[_0x3250('0x22')](_0x4b77da);}return null;};}function patchUpdates(_0x5c8c0c){return function(_0x25f863){try{jsonpatch[_0x3250('0x28')](_0x25f863,_0x5c8c0c,!![]);}catch(_0x536382){return BPromise[_0x3250('0x29')](_0x536382);}return _0x25f863[_0x3250('0x2a')]();};}function saveUpdates(_0x4ec5d7,_0x1ee4c4){return function(_0x4556d9){if(_0x4556d9){return _0x4556d9[_0x3250('0x2b')](_0x4ec5d7)[_0x3250('0x2c')](function(_0x177dc6){return _0x177dc6;});}return null;};}function removeEntity(_0x38926a,_0x1f8454){return function(_0x13850b){if(_0x13850b){return _0x13850b[_0x3250('0x2d')]()['then'](function(){_0x38926a[_0x3250('0x20')](0xcc)[_0x3250('0x21')]();});}};}function handleEntityNotFound(_0x256f01,_0x6b785a){return function(_0x24005b){if(!_0x24005b){_0x256f01[_0x3250('0x1f')](0x194);}return _0x24005b;};}function handleError(_0x1c3fc8,_0x4c0020){_0x4c0020=_0x4c0020||0x1f4;return function(_0x1f4fbd){logger[_0x3250('0x2e')](_0x1f4fbd[_0x3250('0x2f')]);if(_0x1f4fbd['name']){delete _0x1f4fbd[_0x3250('0x30')];}_0x1c3fc8[_0x3250('0x20')](_0x4c0020)[_0x3250('0x31')](_0x1f4fbd);};}exports[_0x3250('0x32')]=function(_0xba91ac,_0x59305d){var _0x148f25={},_0x45908e={},_0x4116ee={'count':0x0,'rows':[]};var _0x3fd63b=_['map'](db['ChatGroup'][_0x3250('0x33')],function(_0x2d69c7){return{'name':_0x2d69c7[_0x3250('0x34')],'type':_0x2d69c7[_0x3250('0x35')][_0x3250('0x36')]};});_0x45908e['model']=_['map'](_0x3fd63b,_0x3250('0x30'));_0x45908e[_0x3250('0x37')]=_['keys'](_0xba91ac[_0x3250('0x37')]);_0x45908e[_0x3250('0x38')]=_[_0x3250('0x39')](_0x45908e[_0x3250('0x3a')],_0x45908e[_0x3250('0x37')]);_0x148f25['attributes']=_[_0x3250('0x39')](_0x45908e[_0x3250('0x3a')],qs[_0x3250('0x3b')](_0xba91ac[_0x3250('0x37')]['fields']));_0x148f25[_0x3250('0x3c')]=_0x148f25[_0x3250('0x3c')][_0x3250('0x3d')]?_0x148f25[_0x3250('0x3c')]:_0x45908e['model'];if(!_0xba91ac[_0x3250('0x37')][_0x3250('0x3e')](_0x3250('0x3f'))){_0x148f25[_0x3250('0x40')]=qs[_0x3250('0x40')](_0xba91ac['query'][_0x3250('0x40')]);_0x148f25[_0x3250('0x23')]=qs[_0x3250('0x23')](_0xba91ac['query'][_0x3250('0x23')]);}_0x148f25[_0x3250('0x41')]=qs[_0x3250('0x42')](_0xba91ac[_0x3250('0x37')][_0x3250('0x42')]);_0x148f25[_0x3250('0x43')]=qs[_0x3250('0x38')](_[_0x3250('0x44')](_0xba91ac['query'],_0x45908e['filters']),_0x3fd63b);if(_0xba91ac[_0x3250('0x37')]['filter']){_0x148f25[_0x3250('0x43')]=_['merge'](_0x148f25[_0x3250('0x43')],{'$or':_['map'](_0x3fd63b,function(_0x1d6866){if(_0x1d6866['type']!==_0x3250('0x45')){var _0x47bd79={};_0x47bd79[_0x1d6866['name']]={'$like':'%'+_0xba91ac['query'][_0x3250('0x46')]+'%'};return _0x47bd79;}})});}_0x148f25=_[_0x3250('0x47')]({},_0x148f25,_0xba91ac['options']);var _0x1d6d50={'where':_0x148f25[_0x3250('0x43')]};return db[_0x3250('0x48')][_0x3250('0x25')](_0x1d6d50)['then'](function(_0x17b9c8){_0x4116ee[_0x3250('0x25')]=_0x17b9c8;if(_0xba91ac[_0x3250('0x37')][_0x3250('0x49')]){_0x148f25[_0x3250('0x4a')]=[{'all':!![]}];}return db[_0x3250('0x48')][_0x3250('0x4b')](_0x148f25);})[_0x3250('0x2c')](function(_0xcba78e){_0x4116ee[_0x3250('0x4c')]=_0xcba78e;return _0x4116ee;})['then'](respondWithFilteredResult(_0x59305d,_0x148f25))[_0x3250('0x4d')](handleError(_0x59305d,null));};exports[_0x3250('0x4e')]=function(_0x56a76c,_0x39ac89){var _0x2d0a7c={'raw':!![],'where':{'id':_0x56a76c[_0x3250('0x4f')]['id']}},_0x2b5b50={};_0x2b5b50[_0x3250('0x3a')]=_[_0x3250('0x50')](db['ChatGroup'][_0x3250('0x33')]);_0x2b5b50[_0x3250('0x37')]=_[_0x3250('0x50')](_0x56a76c[_0x3250('0x37')]);_0x2b5b50['filters']=_[_0x3250('0x39')](_0x2b5b50[_0x3250('0x3a')],_0x2b5b50[_0x3250('0x37')]);_0x2d0a7c[_0x3250('0x3c')]=_['intersection'](_0x2b5b50[_0x3250('0x3a')],qs[_0x3250('0x3b')](_0x56a76c['query'][_0x3250('0x3b')]));_0x2d0a7c[_0x3250('0x3c')]=_0x2d0a7c[_0x3250('0x3c')]['length']?_0x2d0a7c['attributes']:_0x2b5b50[_0x3250('0x3a')];if(_0x56a76c[_0x3250('0x37')][_0x3250('0x49')]){_0x2d0a7c[_0x3250('0x4a')]=[{'all':!![]}];}_0x2d0a7c=_[_0x3250('0x47')]({},_0x2d0a7c,_0x56a76c[_0x3250('0x51')]);return db[_0x3250('0x48')][_0x3250('0x52')](_0x2d0a7c)['then'](handleEntityNotFound(_0x39ac89,null))[_0x3250('0x2c')](respondWithResult(_0x39ac89,null))[_0x3250('0x4d')](handleError(_0x39ac89,null));};exports['create']=function(_0x6009f0,_0x3c6b7e){return db[_0x3250('0x48')][_0x3250('0x53')](_0x6009f0['body'],{})['then'](respondWithResult(_0x3c6b7e,0xc9))[_0x3250('0x4d')](handleError(_0x3c6b7e,null));};exports[_0x3250('0x2b')]=function(_0x174664,_0x12aab4){if(_0x174664[_0x3250('0x54')]['id']){delete _0x174664['body']['id'];}return db[_0x3250('0x48')][_0x3250('0x52')]({'where':{'id':_0x174664[_0x3250('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12aab4,null))[_0x3250('0x2c')](saveUpdates(_0x174664[_0x3250('0x54')],null))['then'](respondWithResult(_0x12aab4,null))[_0x3250('0x4d')](handleError(_0x12aab4,null));};exports[_0x3250('0x2d')]=function(_0x157ed7,_0x3a94a3){return db[_0x3250('0x48')][_0x3250('0x52')]({'where':{'id':_0x157ed7[_0x3250('0x4f')]['id']}})[_0x3250('0x2c')](handleEntityNotFound(_0x3a94a3,null))['then'](removeEntity(_0x3a94a3,null))['catch'](handleError(_0x3a94a3,null));};exports['describe']=function(_0x4e77be,_0xd11fde){return db[_0x3250('0x48')][_0x3250('0x55')]()[_0x3250('0x2c')](respondWithResult(_0xd11fde,null))[_0x3250('0x4d')](handleError(_0xd11fde,null));};exports[_0x3250('0x56')]=function(_0x50aa81,_0x3a07d4,_0x40a4e2){return db[_0x3250('0x57')][_0x3250('0x25')]({'where':{'ChatGroupId':_0x50aa81['params']['id'],'ToId':_0x50aa81[_0x3250('0x58')]['id'],'read':![]}})['then'](function(_0x4f286a){return{'id':_[_0x3250('0x59')](_0x50aa81[_0x3250('0x4f')]['id']),'count':_0x4f286a};})[_0x3250('0x2c')](respondWithResult(_0x3a07d4,null))[_0x3250('0x4d')](handleError(_0x3a07d4,null));};exports['addMembers']=function(_0x4ec593,_0xfda842,_0x262200){return db[_0x3250('0x48')][_0x3250('0x52')]({'where':{'id':_0x4ec593[_0x3250('0x4f')]['id']}})[_0x3250('0x2c')](handleEntityNotFound(_0xfda842,null))[_0x3250('0x2c')](function(_0x559754){if(_0x559754){return _0x559754[_0x3250('0x5a')](_0x4ec593[_0x3250('0x54')]['ids'],_[_0x3250('0x5b')](_0x4ec593[_0x3250('0x54')],['ids','id'])||{});}})[_0x3250('0x2c')](respondWithResult(_0xfda842,null))[_0x3250('0x4d')](handleError(_0xfda842,null));};exports[_0x3250('0x5c')]=function(_0x1837dc,_0x3cac52,_0x45e8bb){var _0x1a3692={};var _0x48f429={};var _0x25a415;var _0x2b2c70;return db['ChatGroup'][_0x3250('0x5d')]({'where':{'id':_0x1837dc[_0x3250('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3cac52,null))[_0x3250('0x2c')](function(_0xd42dfb){if(_0xd42dfb){_0x25a415=_0xd42dfb;_0x48f429['model']=_[_0x3250('0x50')](db['User'][_0x3250('0x33')]);_0x48f429[_0x3250('0x37')]=_['keys'](_0x1837dc['query']);_0x48f429[_0x3250('0x38')]=_[_0x3250('0x39')](_0x48f429[_0x3250('0x3a')],_0x48f429[_0x3250('0x37')]);_0x1a3692[_0x3250('0x3c')]=_[_0x3250('0x39')](_0x48f429[_0x3250('0x3a')],qs[_0x3250('0x3b')](_0x1837dc['query'][_0x3250('0x3b')]));_0x1a3692[_0x3250('0x3c')]=_0x1a3692[_0x3250('0x3c')][_0x3250('0x3d')]?_0x1a3692['attributes']:_0x48f429['model'];_0x1a3692[_0x3250('0x41')]=qs[_0x3250('0x42')](_0x1837dc['query'][_0x3250('0x42')]);_0x1a3692['where']=qs['filters'](_['pick'](_0x1837dc[_0x3250('0x37')],_0x48f429['filters']));if(_0x1837dc['query']['filter']){_0x1a3692['where']=_[_0x3250('0x47')](_0x1a3692[_0x3250('0x43')],{'$or':_['map'](_0x1a3692[_0x3250('0x3c')],function(_0x14e353){var _0x27d2ba={};_0x27d2ba[_0x14e353]={'$like':'%'+_0x1837dc[_0x3250('0x37')][_0x3250('0x46')]+'%'};return _0x27d2ba;})});}_0x1a3692=_[_0x3250('0x47')]({},_0x1a3692,_0x1837dc['options']);return _0x25a415[_0x3250('0x5c')](_0x1a3692);}})[_0x3250('0x2c')](function(_0x54cc44){if(_0x54cc44){_0x2b2c70=_0x54cc44[_0x3250('0x3d')];if(!_0x1837dc[_0x3250('0x37')][_0x3250('0x3e')]('nolimit')){_0x1a3692[_0x3250('0x40')]=qs['limit'](_0x1837dc[_0x3250('0x37')][_0x3250('0x40')]);_0x1a3692['offset']=qs[_0x3250('0x23')](_0x1837dc[_0x3250('0x37')][_0x3250('0x23')]);}return _0x25a415[_0x3250('0x5c')](_0x1a3692);}})[_0x3250('0x2c')](function(_0x3c2513){if(_0x3c2513){return _0x3c2513?{'count':_0x2b2c70,'rows':_0x3c2513}:null;}})[_0x3250('0x2c')](respondWithResult(_0x3cac52,null))[_0x3250('0x4d')](handleError(_0x3cac52,null));};exports[_0x3250('0x5e')]=function(_0x2b59c7,_0x56ea6e,_0x14da8e){return db[_0x3250('0x48')][_0x3250('0x52')]({'where':{'id':_0x2b59c7[_0x3250('0x4f')]['id']}})[_0x3250('0x2c')](handleEntityNotFound(_0x56ea6e,null))[_0x3250('0x2c')](function(_0x365395){if(_0x365395){return _0x365395[_0x3250('0x5e')](_0x2b59c7[_0x3250('0x37')][_0x3250('0x5f')]);}})[_0x3250('0x2c')](respondWithStatusCode(_0x56ea6e,null))[_0x3250('0x4d')](handleError(_0x56ea6e,null));};exports[_0x3250('0x60')]=function(_0x182294,_0x4250d0,_0x1b68d2){if(_0x182294['body']['id']){delete _0x182294[_0x3250('0x54')]['id'];}return db[_0x3250('0x48')][_0x3250('0x52')]({'where':{'id':_0x182294[_0x3250('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4250d0,null))[_0x3250('0x2c')](function(_0x4862ff){if(_0x4862ff){_0x182294[_0x3250('0x54')]['ChatGroupId']=_0x4862ff['id'];return db[_0x3250('0x57')][_0x3250('0x53')](_0x182294[_0x3250('0x54')]);}})[_0x3250('0x2c')](respondWithResult(_0x4250d0,null))[_0x3250('0x4d')](handleError(_0x4250d0,null));};exports[_0x3250('0x61')]=function(_0x33df7a,_0x2367f8,_0x148a30){var _0x27870d={};var _0x31b12c={};var _0x27150d;var _0x542ad1;return db[_0x3250('0x48')][_0x3250('0x5d')]({'where':{'id':_0x33df7a[_0x3250('0x4f')]['id']}})[_0x3250('0x2c')](handleEntityNotFound(_0x2367f8,null))['then'](function(_0x3796ff){if(_0x3796ff){_0x27150d=_0x3796ff;_0x31b12c[_0x3250('0x3a')]=_[_0x3250('0x50')](db[_0x3250('0x57')][_0x3250('0x33')]);_0x31b12c[_0x3250('0x37')]=_['keys'](_0x33df7a[_0x3250('0x37')]);_0x31b12c[_0x3250('0x38')]=_[_0x3250('0x39')](_0x31b12c['model'],_0x31b12c[_0x3250('0x37')]);_0x27870d[_0x3250('0x3c')]=_[_0x3250('0x39')](_0x31b12c['model'],qs[_0x3250('0x3b')](_0x33df7a[_0x3250('0x37')][_0x3250('0x3b')]));_0x27870d[_0x3250('0x3c')]=_0x27870d[_0x3250('0x3c')][_0x3250('0x3d')]?_0x27870d[_0x3250('0x3c')]:_0x31b12c[_0x3250('0x3a')];_0x27870d[_0x3250('0x41')]=qs[_0x3250('0x42')](_0x33df7a['query'][_0x3250('0x42')]);_0x27870d[_0x3250('0x43')]=qs[_0x3250('0x38')](_[_0x3250('0x44')](_0x33df7a[_0x3250('0x37')],_0x31b12c[_0x3250('0x38')]));if(_0x33df7a[_0x3250('0x37')][_0x3250('0x46')]){_0x27870d[_0x3250('0x43')]=_[_0x3250('0x47')](_0x27870d['where'],{'$or':_[_0x3250('0x62')](_0x27870d[_0x3250('0x3c')],function(_0x289304){var _0xfc851d={};_0xfc851d[_0x289304]={'$like':'%'+_0x33df7a['query'][_0x3250('0x46')]+'%'};return _0xfc851d;})});}if(_0x33df7a[_0x3250('0x37')][_0x3250('0x63')]){var _0x204376=_0x33df7a[_0x3250('0x37')][_0x3250('0x63')][_0x3250('0x64')](',');var _0x4f208b={};_0x4f208b[_0x204376[0x0]]={'$gte':moment(_0x204376[0x1])['format'](_0x3250('0x65'))};_0x27870d['where']=_['merge'](_0x27870d['where'],_0x4f208b);}_0x27870d=_[_0x3250('0x47')]({},_0x27870d,_0x33df7a[_0x3250('0x51')]);return _0x27150d[_0x3250('0x61')](_0x27870d);}})[_0x3250('0x2c')](function(_0x2fde54){if(_0x2fde54){_0x542ad1=_0x2fde54[_0x3250('0x3d')];if(!_0x33df7a[_0x3250('0x37')][_0x3250('0x3e')](_0x3250('0x3f'))){_0x27870d[_0x3250('0x40')]=qs['limit'](_0x33df7a['query'][_0x3250('0x40')]);_0x27870d[_0x3250('0x23')]=qs['offset'](_0x33df7a[_0x3250('0x37')][_0x3250('0x23')]);}return _0x27150d[_0x3250('0x61')](_0x27870d);}})[_0x3250('0x2c')](function(_0x39a6fc){if(_0x39a6fc){return _0x39a6fc?{'count':_0x542ad1,'rows':_0x39a6fc}:null;}})[_0x3250('0x2c')](respondWithResult(_0x2367f8,null))[_0x3250('0x4d')](handleError(_0x2367f8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c2fd793..86ce72a 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 _0x3823=['../../mysqldb','ChatGroup','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3da241,_0xeba26a){var _0x43e156=function(_0x41ced1){while(--_0x41ced1){_0x3da241['push'](_0x3da241['shift']());}};_0x43e156(++_0xeba26a);}(_0x3823,0xb0));var _0x3382=function(_0x92ec1b,_0x882d2b){_0x92ec1b=_0x92ec1b-0x0;var _0x541de8=_0x3823[_0x92ec1b];return _0x541de8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x3382('0x0'))['db'][_0x3382('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3382('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3382('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c7f37){return function(_0x834bba,_0x420a9a,_0x19d80e){ChatGroupEvents['emit'](_0x3c7f37+':'+_0x834bba['id'],_0x834bba);ChatGroupEvents[_0x3382('0x4')](_0x3c7f37,_0x834bba);_0x19d80e(null);};}for(var e in events){if(events[_0x3382('0x5')](e)){var event=events[e];ChatGroup[_0x3382('0x6')](e,emitEvent(event));}}module[_0x3382('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x6f44=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x6f44,0x1ea));var _0x46f4=function(_0x41612b,_0x1f7510){_0x41612b=_0x41612b-0x0;var _0x2ef80d=_0x6f44[_0x41612b];return _0x2ef80d;};'use strict';var EventEmitter=require(_0x46f4('0x0'));var ChatGroup=require(_0x46f4('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x46f4('0x2')](0x0);var events={'afterCreate':_0x46f4('0x3'),'afterUpdate':_0x46f4('0x4'),'afterDestroy':_0x46f4('0x5')};function emitEvent(_0x4099a9){return function(_0x1e2554,_0x26f749,_0x200f8b){ChatGroupEvents[_0x46f4('0x6')](_0x4099a9+':'+_0x1e2554['id'],_0x1e2554);ChatGroupEvents['emit'](_0x4099a9,_0x1e2554);_0x200f8b(null);};}for(var e in events){if(events[_0x46f4('0x7')](e)){var event=events[e];ChatGroup[_0x46f4('0x8')](e,emitEvent(event));}}module[_0x46f4('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 5ae9e0a..62fd5e8 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 _0xd42b=['rimraf','../../config/environment','define','chat_groups','util','../../config/logger','api','moment','path'];(function(_0x2719d3,_0x30c25f){var _0x4cc222=function(_0x5bed61){while(--_0x5bed61){_0x2719d3['push'](_0x2719d3['shift']());}};_0x4cc222(++_0x30c25f);}(_0xd42b,0x1f3));var _0xbd42=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xd42b[_0x40d8d7];return _0x3454cc;};'use strict';var _=require('lodash');var util=require(_0xbd42('0x0'));var logger=require(_0xbd42('0x1'))(_0xbd42('0x2'));var moment=require(_0xbd42('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd42('0x4'));var rimraf=require(_0xbd42('0x5'));var config=require(_0xbd42('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x803ddf,_0x8512db){return _0x803ddf[_0xbd42('0x7')]('ChatGroup',attributes,{'tableName':_0xbd42('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baa=['chat_groups','../../config/logger','api','moment','bluebird','path','define','ChatGroup'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x3baa,0x1d9));var _0xa3ba=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x3baa[_0xb0fe92];return _0x41787f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3ba('0x0'))(_0xa3ba('0x1'));var moment=require(_0xa3ba('0x2'));var BPromise=require(_0xa3ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3ba('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x145d08,_0x25987d){return _0x145d08[_0xa3ba('0x5')](_0xa3ba('0x6'),attributes,{'tableName':_0xa3ba('0x7'),'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 9357378..eb9ea36 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 _0xdbd0=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x250b10,_0x52defa){var _0x20a519=function(_0xa83c93){while(--_0xa83c93){_0x250b10['push'](_0x250b10['shift']());}};_0x20a519(++_0x52defa);}(_0xdbd0,0x88));var _0x0dbd=function(_0x3ee09e,_0x1d0818){_0x3ee09e=_0x3ee09e-0x0;var _0x204f02=_0xdbd0[_0x3ee09e];return _0x204f02;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var moment=require(_0x0dbd('0x2'));var BPromise=require(_0x0dbd('0x3'));var rs=require(_0x0dbd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dbd('0x5'))['db'];var utils=require(_0x0dbd('0x6'));var logger=require(_0x0dbd('0x7'))('rpc');var config=require(_0x0dbd('0x8'));var jayson=require(_0x0dbd('0x9'));var client=jayson[_0x0dbd('0xa')][_0x0dbd('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0dbd('0xc')],{'host':_0x0dbd('0xd'),'port':0x18eb});var socket=require(_0x0dbd('0xe'))(new Redis(config[_0x0dbd('0xc')]));require(_0x0dbd('0xf'))[_0x0dbd('0x10')](socket);function respondWithRpcPromise(_0x5329e7,_0x55f318,_0x1a5e84){return new BPromise(function(_0x1e0d57,_0x86fd0){return client[_0x0dbd('0x11')](_0x5329e7,_0x1a5e84)[_0x0dbd('0x12')](function(_0x18e73c){logger[_0x0dbd('0x13')](_0x0dbd('0x14'),_0x55f318,'request\x20sent');logger[_0x0dbd('0x15')](_0x0dbd('0x16'),_0x55f318,_0x0dbd('0x17'),JSON['stringify'](_0x18e73c));if(_0x18e73c[_0x0dbd('0x18')]){if(_0x18e73c[_0x0dbd('0x18')][_0x0dbd('0x19')]===0x1f4){logger[_0x0dbd('0x18')](_0x0dbd('0x14'),_0x55f318,_0x18e73c[_0x0dbd('0x18')][_0x0dbd('0x1a')]);return _0x86fd0(_0x18e73c[_0x0dbd('0x18')][_0x0dbd('0x1a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x55f318,_0x18e73c[_0x0dbd('0x18')][_0x0dbd('0x1a')]);return _0x1e0d57(_0x18e73c['error'][_0x0dbd('0x1a')]);}else{logger[_0x0dbd('0x13')]('ChatGroup,\x20%s,\x20%s',_0x55f318,'request\x20sent');_0x1e0d57(_0x18e73c[_0x0dbd('0x1b')][_0x0dbd('0x1a')]);}})[_0x0dbd('0x1c')](function(_0x5087d3){logger[_0x0dbd('0x18')](_0x0dbd('0x14'),_0x55f318,_0x5087d3);_0x86fd0(_0x5087d3);});});} \ No newline at end of file +var _0x2a9b=['stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x19de04,_0x1f9453){var _0x1cd3d2=function(_0x3e2850){while(--_0x3e2850){_0x19de04['push'](_0x19de04['shift']());}};_0x1cd3d2(++_0x1f9453);}(_0x2a9b,0x14b));var _0xb2a9=function(_0x36503d,_0x30ca19){_0x36503d=_0x36503d-0x0;var _0x579499=_0x2a9b[_0x36503d];return _0x579499;};'use strict';var _=require('lodash');var util=require(_0xb2a9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb2a9('0x1'));var fs=require('fs');var Redis=require(_0xb2a9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2a9('0x3'));var logger=require(_0xb2a9('0x4'))(_0xb2a9('0x5'));var config=require(_0xb2a9('0x6'));var jayson=require(_0xb2a9('0x7'));var client=jayson[_0xb2a9('0x8')][_0xb2a9('0x9')]({'port':0x232a});config[_0xb2a9('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb2a9('0xb'))[_0xb2a9('0xc')](socket);function respondWithRpcPromise(_0x4c46af,_0xcdac87,_0xe3a752){return new BPromise(function(_0x20c41c,_0x59f585){return client['request'](_0x4c46af,_0xe3a752)[_0xb2a9('0xd')](function(_0x32be75){logger[_0xb2a9('0xe')](_0xb2a9('0xf'),_0xcdac87,_0xb2a9('0x10'));logger[_0xb2a9('0x11')](_0xb2a9('0x12'),_0xcdac87,'request\x20sent',JSON[_0xb2a9('0x13')](_0x32be75));if(_0x32be75[_0xb2a9('0x14')]){if(_0x32be75[_0xb2a9('0x14')][_0xb2a9('0x15')]===0x1f4){logger[_0xb2a9('0x14')]('ChatGroup,\x20%s,\x20%s',_0xcdac87,_0x32be75[_0xb2a9('0x14')][_0xb2a9('0x16')]);return _0x59f585(_0x32be75[_0xb2a9('0x14')][_0xb2a9('0x16')]);}logger['error'](_0xb2a9('0xf'),_0xcdac87,_0x32be75['error']['message']);return _0x20c41c(_0x32be75[_0xb2a9('0x14')][_0xb2a9('0x16')]);}else{logger['info'](_0xb2a9('0xf'),_0xcdac87,'request\x20sent');_0x20c41c(_0x32be75[_0xb2a9('0x17')][_0xb2a9('0x16')]);}})[_0xb2a9('0x18')](function(_0x58c271){logger[_0xb2a9('0x14')]('ChatGroup,\x20%s,\x20%s',_0xcdac87,_0x58c271);_0x59f585(_0x58c271);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f1ae635..b5d890d 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 _0x20fd=['register','length','./chatGroup.events','update','emit','removeListener'];(function(_0x3caf9f,_0xec59b8){var _0x203e82=function(_0x33a58e){while(--_0x33a58e){_0x3caf9f['push'](_0x3caf9f['shift']());}};_0x203e82(++_0xec59b8);}(_0x20fd,0x1a0));var _0xd20f=function(_0x3bbb74,_0x2dc0ef){_0x3bbb74=_0x3bbb74-0x0;var _0xc5dcbc=_0x20fd[_0x3bbb74];return _0xc5dcbc;};'use strict';var ChatGroupEvents=require(_0xd20f('0x0'));var events=['save','remove',_0xd20f('0x1')];function createListener(_0x44997e,_0x76554a){return function(_0xb11b25){_0x76554a[_0xd20f('0x2')](_0x44997e,_0xb11b25);};}function removeListener(_0x1e4d07,_0x262a8a){return function(){ChatGroupEvents[_0xd20f('0x3')](_0x1e4d07,_0x262a8a);};}exports[_0xd20f('0x4')]=function(_0x588bd9){for(var _0x52a9d3=0x0,_0x2056ce=events[_0xd20f('0x5')];_0x52a9d3<_0x2056ce;_0x52a9d3++){var _0x36cffb=events[_0x52a9d3];var _0x4adab9=createListener('chatGroup:'+_0x36cffb,_0x588bd9);ChatGroupEvents['on'](_0x36cffb,_0x4adab9);}}; \ No newline at end of file +var _0x637b=['remove','emit','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x440469,_0xd6af33){var _0xe0c479=function(_0x29061a){while(--_0x29061a){_0x440469['push'](_0x440469['shift']());}};_0xe0c479(++_0xd6af33);}(_0x637b,0xfa));var _0xb637=function(_0x22ff81,_0x4b3c61){_0x22ff81=_0x22ff81-0x0;var _0x385c13=_0x637b[_0x22ff81];return _0x385c13;};'use strict';var ChatGroupEvents=require(_0xb637('0x0'));var events=[_0xb637('0x1'),_0xb637('0x2'),'update'];function createListener(_0x5650c7,_0x473c67){return function(_0xab5d3){_0x473c67[_0xb637('0x3')](_0x5650c7,_0xab5d3);};}function removeListener(_0xeea0be,_0x28e60f){return function(){ChatGroupEvents['removeListener'](_0xeea0be,_0x28e60f);};}exports[_0xb637('0x4')]=function(_0xf3f74c){for(var _0x54f299=0x0,_0x26b45a=events[_0xb637('0x5')];_0x54f299<_0x26b45a;_0x54f299++){var _0x562b1f=events[_0x54f299];var _0x39fdc8=createListener(_0xb637('0x6')+_0x562b1f,_0xf3f74c);ChatGroupEvents['on'](_0x562b1f,_0x39fdc8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9d53991..afa2a42 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 _0x5efb=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','addMembers','addMessage','put','delete','removeMembers','exports'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x5efb,0xa1));var _0xb5ef=function(_0x5259f7,_0xdcdc61){_0x5259f7=_0x5259f7-0x0;var _0x11e597=_0x5efb[_0x5259f7];return _0x11e597;};'use strict';var multer=require(_0xb5ef('0x0'));var util=require(_0xb5ef('0x1'));var path=require(_0xb5ef('0x2'));var timeout=require(_0xb5ef('0x3'));var express=require('express');var router=express[_0xb5ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb5ef('0x5'));var interaction=require(_0xb5ef('0x6'));var config=require(_0xb5ef('0x7'));var controller=require('./chatGroup.controller');router[_0xb5ef('0x8')]('/',auth[_0xb5ef('0x9')](),controller['index']);router[_0xb5ef('0x8')]('/describe',auth[_0xb5ef('0x9')](),controller['describe']);router[_0xb5ef('0x8')](_0xb5ef('0xa'),auth[_0xb5ef('0x9')](),controller['show']);router['get'](_0xb5ef('0xb'),auth[_0xb5ef('0x9')](),controller[_0xb5ef('0xc')]);router['get'](_0xb5ef('0xd'),auth[_0xb5ef('0x9')](),controller[_0xb5ef('0xe')]);router[_0xb5ef('0x8')]('/:id/messages',auth[_0xb5ef('0x9')](),controller[_0xb5ef('0xf')]);router[_0xb5ef('0x10')]('/',auth[_0xb5ef('0x9')](),controller['create']);router[_0xb5ef('0x10')]('/:id/members',auth[_0xb5ef('0x9')](),controller[_0xb5ef('0x11')]);router['post']('/:id/messages',auth[_0xb5ef('0x9')](),controller[_0xb5ef('0x12')]);router[_0xb5ef('0x13')](_0xb5ef('0xa'),auth[_0xb5ef('0x9')](),controller['update']);router[_0xb5ef('0x14')](_0xb5ef('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xb5ef('0x14')](_0xb5ef('0xd'),auth[_0xb5ef('0x9')](),controller[_0xb5ef('0x15')]);module[_0xb5ef('0x16')]=router; \ No newline at end of file +var _0xbda5=['fs-extra','isAuthenticated','index','get','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x29d736,_0x5d3711){var _0xf3e49b=function(_0x3ff27f){while(--_0x3ff27f){_0x29d736['push'](_0x29d736['shift']());}};_0xf3e49b(++_0x5d3711);}(_0xbda5,0x173));var _0x5bda=function(_0x227b53,_0x410a40){_0x227b53=_0x227b53-0x0;var _0x26b21a=_0xbda5[_0x227b53];return _0x26b21a;};'use strict';var multer=require(_0x5bda('0x0'));var util=require(_0x5bda('0x1'));var path=require('path');var timeout=require(_0x5bda('0x2'));var express=require(_0x5bda('0x3'));var router=express['Router']();var fs_extra=require(_0x5bda('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x5bda('0x5')](),controller[_0x5bda('0x6')]);router[_0x5bda('0x7')](_0x5bda('0x8'),auth['isAuthenticated'](),controller[_0x5bda('0x9')]);router[_0x5bda('0x7')](_0x5bda('0xa'),auth[_0x5bda('0x5')](),controller[_0x5bda('0xb')]);router[_0x5bda('0x7')]('/:id/unread',auth[_0x5bda('0x5')](),controller[_0x5bda('0xc')]);router[_0x5bda('0x7')](_0x5bda('0xd'),auth['isAuthenticated'](),controller[_0x5bda('0xe')]);router[_0x5bda('0x7')](_0x5bda('0xf'),auth[_0x5bda('0x5')](),controller[_0x5bda('0x10')]);router[_0x5bda('0x11')]('/',auth['isAuthenticated'](),controller[_0x5bda('0x12')]);router['post'](_0x5bda('0xd'),auth[_0x5bda('0x5')](),controller[_0x5bda('0x13')]);router['post'](_0x5bda('0xf'),auth[_0x5bda('0x5')](),controller['addMessage']);router[_0x5bda('0x14')](_0x5bda('0xa'),auth['isAuthenticated'](),controller[_0x5bda('0x15')]);router[_0x5bda('0x16')](_0x5bda('0xa'),auth[_0x5bda('0x5')](),controller[_0x5bda('0x17')]);router[_0x5bda('0x16')](_0x5bda('0xd'),auth[_0x5bda('0x5')](),controller['removeMembers']);module[_0x5bda('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7b8e491..5548f29 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 _0x337f=['ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize','exports','BOOLEAN'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x337f,0x11f));var _0xf337=function(_0x553d0e,_0x159bb5){_0x553d0e=_0x553d0e-0x0;var _0x22c5f6=_0x337f[_0x553d0e];return _0x22c5f6;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'closed':{'type':Sequelize[_0xf337('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf337('0x3')](_0xf337('0x4'),_0xf337('0x5')),'defaultValue':_0xf337('0x4')},'ratingMessage':{'type':Sequelize[_0xf337('0x6')]},'pathTranscript':{'type':Sequelize[_0xf337('0x6')]},'mailTranscript':{'type':Sequelize[_0xf337('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf337('0x8')]},'disposition':{'type':Sequelize[_0xf337('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf337('0x7')]},'note':{'type':Sequelize[_0xf337('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xf337('0x7')]},'osVersion':{'type':Sequelize[_0xf337('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xf337('0x7')]},'deviceType':{'type':Sequelize[_0xf337('0x7')]},'referer':{'type':Sequelize[_0xf337('0x6')]},'customerIp':{'type':Sequelize[_0xf337('0x7')]},'formData':{'type':Sequelize[_0xf337('0x6')](_0xf337('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf337('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf337('0x7')]},'customerPort':{'type':Sequelize[_0xf337('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xf337('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xf337('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4e76=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize'];(function(_0x15318c,_0x2e50e4){var _0x10d3ce=function(_0x2fecdd){while(--_0x2fecdd){_0x15318c['push'](_0x15318c['shift']());}};_0x10d3ce(++_0x2e50e4);}(_0x4e76,0x167));var _0x64e7=function(_0x346795,_0x2e860e){_0x346795=_0x346795-0x0;var _0x2f10e3=_0x4e76[_0x346795];return _0x2f10e3;};'use strict';var Sequelize=require(_0x64e7('0x0'));module[_0x64e7('0x1')]={'closed':{'type':Sequelize[_0x64e7('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x64e7('0x3')]},'ratingType':{'type':Sequelize[_0x64e7('0x4')](_0x64e7('0x5'),_0x64e7('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x64e7('0x7')]},'mailTranscript':{'type':Sequelize[_0x64e7('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x64e7('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x64e7('0x8')]},'note':{'type':Sequelize[_0x64e7('0x8')]},'browserName':{'type':Sequelize[_0x64e7('0x8')]},'browserVersion':{'type':Sequelize[_0x64e7('0x8')]},'osName':{'type':Sequelize[_0x64e7('0x8')]},'osVersion':{'type':Sequelize[_0x64e7('0x8')]},'deviceModel':{'type':Sequelize[_0x64e7('0x8')]},'deviceVendor':{'type':Sequelize[_0x64e7('0x8')]},'deviceType':{'type':Sequelize[_0x64e7('0x8')]},'referer':{'type':Sequelize[_0x64e7('0x7')]},'customerIp':{'type':Sequelize[_0x64e7('0x8')]},'formData':{'type':Sequelize['TEXT'](_0x64e7('0x9'))},'read1stAt':{'type':Sequelize[_0x64e7('0xa')]},'lastMsgAt':{'type':Sequelize[_0x64e7('0xa')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x64e7('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x64e7('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x64e7('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x64e7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x64e7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e06c446..202089d 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 _0xf163=['originalname','file','filename','mimetype','findOne','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','User','ContactId','Messages','UserId','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','fullname','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ChatMessage','ids','omit','filters','hasOwnProperty','sort','ChatInteractionId','filter','where','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','nolimit','pick','includeAgent','push','addTags','setTags','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','firstName','attachments','createdAt','direction','Owner','get','mkdirSync','Chat','N.A.','browserName','referer','customerIp','customerPort','createReadStream','out','lastName','read','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','render','merge','contact','agent','interaction','index','map','ChatInteraction','fieldName','type','getOptions','findAll','chat','query','then','params','model','rawAttributes','keys','intersection','attributes','fields','length','includeAll','options','find','create','body','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooMetadata','user','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload'];(function(_0x12f4d2,_0x3a416e){var _0x488e5e=function(_0x43fe1e){while(--_0x43fe1e){_0x12f4d2['push'](_0x12f4d2['shift']());}};_0x488e5e(++_0x3a416e);}(_0xf163,0x1ec));var _0x3f16=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xf163[_0x4eaa4c];return _0x15aec6;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3f16('0x0'));var rp=require(_0x3f16('0x1'));var moment=require('moment');var BPromise=require(_0x3f16('0x2'));var Mustache=require(_0x3f16('0x3'));var util=require(_0x3f16('0x4'));var path=require('path');var ejs=require(_0x3f16('0x5'));var fs=require('fs');var _=require(_0x3f16('0x6'));var Redis=require(_0x3f16('0x7'));var interaction=require(_0x3f16('0x8'));var qs=require(_0x3f16('0x9'));var pdf=require(_0x3f16('0xa'));var logger=require('../../config/logger')(_0x3f16('0xb'));var config=require(_0x3f16('0xc'));var db=require(_0x3f16('0xd'))['db'];config[_0x3f16('0xe')]=_['defaults'](config[_0x3f16('0xe')],{'host':_0x3f16('0xf'),'port':0x18eb});var socket=require(_0x3f16('0x10'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3f16('0x11')][_0x3f16('0x12')]({'port':0x232b});var client9004=jayson[_0x3f16('0x11')][_0x3f16('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x3bdbb2,_0x15237c,_0x2d7781,_0x101dca){return new BPromise(function(_0x265e43,_0x592eaf){var _0x3fb33d=_0x101dca||client;return _0x3fb33d[_0x3f16('0x13')](_0x3bdbb2,_0x2d7781)['then'](function(_0x4d5eb5){logger[_0x3f16('0x14')](_0x3f16('0x15'),_0x15237c,_0x3f16('0x16'));logger[_0x3f16('0x17')](_0x3f16('0x18'),_0x15237c,'request\x20sent',JSON[_0x3f16('0x19')](_0x4d5eb5));if(_0x4d5eb5['error']){if(_0x4d5eb5[_0x3f16('0x1a')]['code']===0x1f4){logger['error'](_0x3f16('0x15'),_0x15237c,_0x4d5eb5[_0x3f16('0x1a')]['message']);return _0x592eaf(_0x4d5eb5['error'][_0x3f16('0x1b')]);}logger[_0x3f16('0x1a')](_0x3f16('0x15'),_0x15237c,_0x4d5eb5[_0x3f16('0x1a')][_0x3f16('0x1b')]);return _0x265e43(_0x4d5eb5[_0x3f16('0x1a')][_0x3f16('0x1b')]);}else{logger[_0x3f16('0x14')](_0x3f16('0x15'),_0x15237c,'request\x20sent');_0x265e43(_0x4d5eb5[_0x3f16('0x1c')][_0x3f16('0x1b')]);}})[_0x3f16('0x1d')](function(_0x2660d8){logger[_0x3f16('0x1a')](_0x3f16('0x15'),_0x15237c,_0x2660d8);_0x592eaf(_0x2660d8);});});}function respondWithStatusCode(_0x228c29,_0x31614a){_0x31614a=_0x31614a||0xcc;return function(_0x2a481c){if(_0x2a481c){return _0x228c29[_0x3f16('0x1e')](_0x31614a);}return _0x228c29['status'](_0x31614a)[_0x3f16('0x1f')]();};}function respondWithResult(_0x35f270,_0x3986e4){_0x3986e4=_0x3986e4||0xc8;return function(_0x2f55f7){if(_0x2f55f7){return _0x35f270[_0x3f16('0x20')](_0x3986e4)[_0x3f16('0x21')](_0x2f55f7);}};}function respondWithFilteredResult(_0x3b8155,_0x35b044){return function(_0x1b22c9){if(_0x1b22c9){var _0x478d7d=typeof _0x35b044[_0x3f16('0x22')]===_0x3f16('0x23')&&typeof _0x35b044[_0x3f16('0x24')]==='undefined';var _0x4ef0c2=_0x1b22c9[_0x3f16('0x25')];var _0x4a7c2b=_0x478d7d?0x0:_0x35b044[_0x3f16('0x22')];var _0x53c3ea=_0x478d7d?_0x1b22c9[_0x3f16('0x25')]:_0x35b044['offset']+_0x35b044['limit'];var _0xfdf9c;if(_0x53c3ea>=_0x4ef0c2){_0x53c3ea=_0x4ef0c2;_0xfdf9c=0xc8;}else{_0xfdf9c=0xce;}_0x3b8155['status'](_0xfdf9c);return _0x3b8155[_0x3f16('0x26')](_0x3f16('0x27'),_0x4a7c2b+'-'+_0x53c3ea+'/'+_0x4ef0c2)[_0x3f16('0x21')](_0x1b22c9);}return null;};}function saveUpdates(_0x44eba9){return function(_0x57d2f2){if(_0x57d2f2){return _0x57d2f2[_0x3f16('0x28')](_0x44eba9)['then'](function(_0x14aeb9){return _0x14aeb9;});}return null;};}function removeEntity(_0x480143){return function(_0x53f49f){if(_0x53f49f){return _0x53f49f[_0x3f16('0x29')]()['then'](function(){_0x480143[_0x3f16('0x20')](0xcc)[_0x3f16('0x1f')]();});}};}function handleEntityNotFound(_0x1050f9){return function(_0x2440d1){if(!_0x2440d1){_0x1050f9[_0x3f16('0x1e')](0x194);}return _0x2440d1;};}function handleError(_0x3bd86b,_0x1de7d3){_0x1de7d3=_0x1de7d3||0x1f4;return function(_0x11239a){logger['error'](_0x11239a[_0x3f16('0x2a')]);if(_0x11239a[_0x3f16('0x2b')]){delete _0x11239a[_0x3f16('0x2b')];}_0x3bd86b[_0x3f16('0x20')](_0x1de7d3)[_0x3f16('0x2c')](_0x11239a);};}function getMustacheRender(_0x24a4ba,_0x4d13ef){return Mustache[_0x3f16('0x2d')](_0x24a4ba,_[_0x3f16('0x2e')](_0x4d13ef['body'],{'contact':_0x4d13ef[_0x3f16('0x2f')],'message':_0x4d13ef['message'],'agent':_0x4d13ef[_0x3f16('0x30')],'interaction':_0x4d13ef[_0x3f16('0x31')],'account':_0x4d13ef['account']}))||'';}exports[_0x3f16('0x32')]=function(_0x110426,_0x3bf5ef){var _0x3fa6e6={};var _0x491885=_[_0x3f16('0x33')](db[_0x3f16('0x34')]['rawAttributes'],function(_0x383493){return{'name':_0x383493[_0x3f16('0x35')],'type':_0x383493[_0x3f16('0x36')]['key']};});_0x3fa6e6=qs[_0x3f16('0x37')](_0x491885,_0x110426);return interaction[_0x3f16('0x38')](_0x3f16('0x39'),_0x110426[_0x3f16('0x3a')],_0x110426['user'],_0x3fa6e6,_0x491885)[_0x3f16('0x3b')](respondWithFilteredResult(_0x3bf5ef,_0x3fa6e6))[_0x3f16('0x1d')](handleError(_0x3bf5ef,null));};exports['show']=function(_0xd98e09,_0x510376){var _0x33052d={'raw':![],'where':{'id':_0xd98e09[_0x3f16('0x3c')]['id']}},_0x2bf687={};_0x2bf687[_0x3f16('0x3d')]=_['keys'](db[_0x3f16('0x34')][_0x3f16('0x3e')]);_0x2bf687[_0x3f16('0x3a')]=_[_0x3f16('0x3f')](_0xd98e09[_0x3f16('0x3a')]);_0x2bf687['filters']=_[_0x3f16('0x40')](_0x2bf687['model'],_0x2bf687['query']);_0x33052d[_0x3f16('0x41')]=_['intersection'](_0x2bf687['model'],qs['fields'](_0xd98e09[_0x3f16('0x3a')][_0x3f16('0x42')]));_0x33052d['attributes']=_0x33052d[_0x3f16('0x41')][_0x3f16('0x43')]?_0x33052d[_0x3f16('0x41')]:_0x2bf687[_0x3f16('0x3d')];if(_0xd98e09['query'][_0x3f16('0x44')]){_0x33052d['include']=[{'all':!![]}];}_0x33052d=_[_0x3f16('0x2e')]({},_0x33052d,_0xd98e09[_0x3f16('0x45')]);return db['ChatInteraction'][_0x3f16('0x46')](_0x33052d)[_0x3f16('0x3b')](handleEntityNotFound(_0x510376,null))[_0x3f16('0x3b')](respondWithResult(_0x510376,null))['catch'](handleError(_0x510376,null));};exports['create']=function(_0x320468,_0x3b0397){return db['ChatInteraction'][_0x3f16('0x47')](_0x320468[_0x3f16('0x48')],{})[_0x3f16('0x3b')](respondWithResult(_0x3b0397,0xc9))[_0x3f16('0x1d')](handleError(_0x3b0397,null));};exports[_0x3f16('0x28')]=function(_0x1efd30,_0x34ab9f){if(_0x1efd30[_0x3f16('0x48')]['id']){delete _0x1efd30[_0x3f16('0x48')]['id'];}return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0x1efd30['params']['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0x34ab9f,null))[_0x3f16('0x3b')](saveUpdates(_0x1efd30['body'],null))[_0x3f16('0x3b')](respondWithResult(_0x34ab9f,null))[_0x3f16('0x1d')](handleError(_0x34ab9f,null));};exports[_0x3f16('0x29')]=function(_0xa27c5b,_0x127bb7){return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0xa27c5b[_0x3f16('0x3c')]['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0x127bb7,null))[_0x3f16('0x3b')](removeEntity(_0x127bb7,null))[_0x3f16('0x1d')](handleError(_0x127bb7,null));};exports[_0x3f16('0x49')]=function(_0xdd2169,_0x496bdd){return db[_0x3f16('0x34')][_0x3f16('0x49')]()[_0x3f16('0x3b')](respondWithResult(_0x496bdd,null))[_0x3f16('0x1d')](handleError(_0x496bdd,null));};exports[_0x3f16('0x4a')]=function(_0x3b3dc7,_0x2fd38d){var _0x16793c=_0x3b3dc7[_0x3f16('0x3c')]['id'];var _0xeb1272;var _0x28596a;var _0x3db6b4;return db[_0x3f16('0x34')]['findOne']({'where':{'id':_0x16793c}})[_0x3f16('0x3b')](function(_0x95ff0e){_0xeb1272=_0x95ff0e;return db[_0x3f16('0x4b')]['findOne']({'where':{'id':_0x95ff0e[_0x3f16('0x4c')]},'attributes':['id',_0x3f16('0x4d'),_0x3f16('0x4e'),'vidaooTopic','vidaooNote',_0x3f16('0x4f')],'raw':!![]});})[_0x3f16('0x3b')](function(_0x57314d){if(_0x57314d&&_0x57314d[_0x3f16('0x4d')]&&_0x57314d['vidaooEscalation']){_0x28596a=_0x57314d;var _0x644070={'interaction':{'id':_0x16793c},'agent':{'id':_0x3b3dc7[_0x3f16('0x50')]['id'],'name':_0x3b3dc7[_0x3f16('0x50')][_0x3f16('0x2b')],'fullname':_0x3b3dc7[_0x3f16('0x50')]['fullname'],'email':_0x3b3dc7[_0x3f16('0x50')][_0x3f16('0x51')]},'contact':_0x3b3dc7[_0x3f16('0x48')][_0x3f16('0x2f')],'account':_0x3b3dc7['body']['account']};var _0x4c6678={'rejectUnauthorized':![],'method':_0x3f16('0x52'),'url':_0x3f16('0x53'),'headers':{'X-APIKEY':_0x57314d[_0x3f16('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3b3dc7['user'][_0x3f16('0x51')]],'buttons':null,'topic':_0x28596a['vidaooTopic'],'note':_[_0x3f16('0x54')](_0x28596a[_0x3f16('0x55')])?null:getMustacheRender(_0x28596a[_0x3f16('0x55')],_0x644070),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x3f16('0x54')](_0x28596a[_0x3f16('0x4f')])){var _0x440ff4=getMustacheRender(_0x28596a[_0x3f16('0x4f')],_0x644070);var _0x40f8f0=JSON[_0x3f16('0x56')](_0x440ff4);_0x4c6678[_0x3f16('0x48')][_0x3f16('0x57')]=_0x40f8f0;}}catch(_0x5892fc){throw new db[(_0x3f16('0x58'))][(_0x3f16('0x59'))](_0x3f16('0x5a'));}return rp(_0x4c6678);}else{throw new db[(_0x3f16('0x58'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x3f16('0x3b')](function(_0x132472){_0x3db6b4=_0x132472;if(_0x3db6b4['id']){var _0x111dde={'body':_0x3db6b4['join_url'],'ChatWebsiteId':_0x28596a['id'],'ChatInteractionId':_0xeb1272['id'],'direction':'out','UserId':_0x3b3dc7['user']['id']};return db['ChatMessage'][_0x3f16('0x47')](_0x111dde,{});}else{throw new db[(_0x3f16('0x58'))][(_0x3f16('0x59'))](_0x3f16('0x5b'));}})[_0x3f16('0x3b')](function(){return _0xeb1272[_0x3f16('0x5c')]({'vidaooSessionId':_0x3db6b4['id']});})[_0x3f16('0x3b')](respondWithResult(_0x2fd38d,null))[_0x3f16('0x1d')](handleError(_0x2fd38d,null));};exports[_0x3f16('0x5d')]=function(_0x1a79f7,_0x47885b){if(_0x1a79f7[_0x3f16('0x48')]['id']){delete _0x1a79f7['body']['id'];}return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0x1a79f7[_0x3f16('0x3c')]['id']},'include':[{'model':db[_0x3f16('0x5e')],'as':_0x3f16('0x5f')}]})['then'](handleEntityNotFound(_0x47885b,null))[_0x3f16('0x3b')](saveUpdates(_0x1a79f7['body'],null))['then'](respondWithResult(_0x47885b,null))['catch'](handleError(_0x47885b,null));};exports[_0x3f16('0x60')]=function(_0x1c07ba,_0xf3025b){if(_0x1c07ba[_0x3f16('0x48')]['id']){delete _0x1c07ba[_0x3f16('0x48')]['id'];}return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0x1c07ba[_0x3f16('0x3c')]['id']}})[_0x3f16('0x3b')](function(_0x18d74a){if(!_0x18d74a){logger['error'](_0x3f16('0x61'),_0x3f16('0x60'),0x194,'entity\x20not\x20found');_0xf3025b[_0x3f16('0x1e')](0x194);}else{if(_0x18d74a['UserId']){throw new db[(_0x3f16('0x58'))]['ValidationError'](_0x3f16('0x62'));}}return _0x18d74a;})[_0x3f16('0x3b')](function(_0x55cff2){if(_0x55cff2){return _0x55cff2[_0x3f16('0x28')]({'closed':_0x1c07ba['body'][_0x3f16('0x63')],'disposition':_0x1c07ba[_0x3f16('0x48')][_0x3f16('0x64')]})[_0x3f16('0x3b')](function(_0x87c5b){return _0x87c5b;});}})[_0x3f16('0x3b')](function(){return respondWithRpcPromise('AbandonInteraction',_0x3f16('0x60'),_0x1c07ba[_0x3f16('0x48')],client9004);})[_0x3f16('0x3b')](respondWithResult(_0xf3025b,null))['catch'](handleError(_0xf3025b,null));};exports[_0x3f16('0x65')]=function(_0x31691d,_0x3db514){_0x31691d['body']['name']=_0x31691d['file'][_0x3f16('0x66')];_0x31691d['body']['basename']=_0x31691d[_0x3f16('0x67')][_0x3f16('0x68')];_0x31691d[_0x3f16('0x48')]['type']=_0x31691d[_0x3f16('0x67')][_0x3f16('0x69')];return db['Attachment'][_0x3f16('0x47')](_0x31691d[_0x3f16('0x48')])[_0x3f16('0x3b')](respondWithResult(_0x3db514,0xc9))[_0x3f16('0x1d')](handleError(_0x3db514,null));};exports['attachmentDownload']=function(_0x537fee,_0x162dd4){return db['ChatInteraction'][_0x3f16('0x6a')]({'where':{'id':_0x537fee[_0x3f16('0x3c')]['id']},'raw':!![]})[_0x3f16('0x3b')](handleEntityNotFound(_0x162dd4,null))[_0x3f16('0x3b')](function(_0x467609){if(_0x467609){if(_0x467609['closed']){return _0x162dd4[_0x3f16('0x20')](0x193)[_0x3f16('0x21')]({'status':0x193,'message':_0x3f16('0x6b')});}return db[_0x3f16('0x6c')][_0x3f16('0x6a')]({'where':{'id':_0x537fee['query'][_0x3f16('0x6d')]},'raw':!![]})['then'](handleEntityNotFound(_0x162dd4,null));}})[_0x3f16('0x3b')](function(_0x55c39b){if(_0x55c39b){var _0x5191cb=_0x55c39b['ChatOfflineMessageId']!==null;var _0x5ac499=path[_0x3f16('0x6e')](config[_0x3f16('0x6f')],_0x3f16('0x70'));if(_0x5191cb){_0x5ac499=path[_0x3f16('0x6e')](_0x5ac499,_0x3f16('0x71'));}var _0xaec424=path[_0x3f16('0x6e')](_0x5ac499,_0x55c39b[_0x3f16('0x72')]);return _0x162dd4[_0x3f16('0x73')](_0xaec424);}})[_0x3f16('0x1d')](handleError(_0x162dd4,null));};exports[_0x3f16('0x74')]=function(_0x59221a,_0x135a31){var _0x545cc7=null;var _0x4b5ebb=null;var _0x70501=null;if(_0x59221a[_0x3f16('0x48')]['id']){delete _0x59221a[_0x3f16('0x48')]['id'];}if(_0x59221a[_0x3f16('0x48')][_0x3f16('0x75')]){_0x70501=path[_0x3f16('0x6e')](config[_0x3f16('0x6f')],_0x3f16('0x76'),util[_0x3f16('0x77')](_0x3f16('0x78'),Date[_0x3f16('0x79')]()));_0x59221a[_0x3f16('0x48')]['pathTranscript']=_0x70501;}return db[_0x3f16('0x34')]['find']({'where':{'id':_0x59221a[_0x3f16('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x3f16('0x7a')],'as':_0x3f16('0x7a')}]}]})[_0x3f16('0x3b')](handleEntityNotFound(_0x135a31,null))['then'](saveUpdates(_0x59221a[_0x3f16('0x48')],null))[_0x3f16('0x3b')](function(_0x698381){if(_0x698381){_0x545cc7=_0x698381;return db[_0x3f16('0x4b')]['find']({'where':{'id':_0x545cc7['ChatWebsiteId']}});}})[_0x3f16('0x3b')](function(_0x43fdc2){if(_0x43fdc2){_0x4b5ebb=_0x43fdc2;return db[_0x3f16('0x5e')][_0x3f16('0x46')]({'where':{'id':_0x545cc7[_0x3f16('0x7b')]}});}})[_0x3f16('0x3b')](function(_0x98ad04){if(_0x98ad04){if(_0x70501){var _0x1f308b=null;for(var _0x281285=0x1;_0x281285<_0x545cc7[_0x3f16('0x7c')][_0x3f16('0x43')];++_0x281285){_0x1f308b=_0x545cc7['Messages'][_0x281285];var _0x3ba3e0=_0x1f308b[_0x3f16('0x7d')]?util['format']('%s%d',_0x4b5ebb[_0x3f16('0x7e')],_0x1f308b[_0x3f16('0x7d')]):'System';var _0x38292e=_0x59221a[_0x3f16('0x48')][_0x3f16('0x7f')]||util[_0x3f16('0x77')](_0x3f16('0x80'),_0x3f16('0x81'),_0x1f308b[_0x3f16('0x7b')]);switch(_0x4b5ebb[_0x3f16('0x82')]){case _0x3f16('0x83'):_0x3ba3e0=_0x1f308b[_0x3f16('0x7d')]?util[_0x3f16('0x77')](_0x3f16('0x80'),_0x4b5ebb[_0x3f16('0x7e')],_0x1f308b[_0x3f16('0x7d')]):_0x3f16('0x84');break;case _0x3f16('0x85'):_0x3ba3e0=_0x1f308b[_0x3f16('0x7d')]?_0x1f308b[_0x3f16('0x7a')][_0x3f16('0x86')]||_0x1f308b[_0x3f16('0x7a')]['fullname']:_0x3f16('0x84');break;case _0x3f16('0x87'):_0x3ba3e0=_0x1f308b[_0x3f16('0x7d')]?_0x1f308b['User'][_0x3f16('0x88')]:_0x3f16('0x84');break;default:_0x3ba3e0=_0x1f308b['UserId']?util[_0x3f16('0x77')](_0x3f16('0x80'),_0x4b5ebb['agentAlias'],_0x1f308b[_0x3f16('0x7d')]):'System';}var _0x2ef482=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1f308b['createdAt'])['format'](_0x3f16('0x89')),_0x1f308b['direction']==='in'?_0x38292e:_0x3ba3e0,_0x1f308b[_0x3f16('0x48')]);if(!_0x1f308b[_0x3f16('0x8a')]){fs['appendFileSync'](_0x70501,_0x2ef482);}}return db['MailAccount'][_0x3f16('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0x3f16('0x8b')],'as':_0x3f16('0x8c'),'raw':!![],'include':[{'model':db[_0x3f16('0x8d')],'as':_0x3f16('0x8d'),'raw':!![]}]}]});}}})[_0x3f16('0x3b')](function(_0x3439e2){if(!_0x3439e2||!_0x3439e2['Smtp']||!_0x59221a['body'])return _0x545cc7;var _0x3c6a09=_0x3439e2[_0x3f16('0x8e')]();return respondWithRpcPromise('SendMail',_0x3f16('0x8f'),{'account':_0x3c6a09,'message':{'from':util[_0x3f16('0x77')](_0x3f16('0x90'),_0x3439e2[_0x3f16('0x2b')],_0x3439e2[_0x3f16('0x51')]||_0x3439e2[_0x3f16('0x8c')]['user']),'to':_0x59221a[_0x3f16('0x48')]['mailTranscript'],'subject':_0x3f16('0x91'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x59221a[_0x3f16('0x48')][_0x3f16('0x75')]),'attachments':[{'path':_0x70501}]}})[_0x3f16('0x3b')](function(){return _0x545cc7;})[_0x3f16('0x1d')](function(_0x588e5c){logger[_0x3f16('0x1a')](_0x588e5c);});})[_0x3f16('0x3b')](respondWithStatusCode(_0x135a31,0xc8))[_0x3f16('0x1d')](handleError(_0x135a31,null));};exports[_0x3f16('0x92')]=function(_0x24071b,_0x2ade5e){return db[_0x3f16('0x93')][_0x3f16('0x46')]({'where':{'id':_0x24071b[_0x3f16('0x3c')]['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0x2ade5e,null))[_0x3f16('0x3b')](function(_0x454930){if(_0x454930){return _0x454930[_0x3f16('0x92')](_0x24071b[_0x3f16('0x48')][_0x3f16('0x94')],_[_0x3f16('0x95')](_0x24071b[_0x3f16('0x48')],[_0x3f16('0x94'),'id'])||{});}})[_0x3f16('0x3b')](respondWithResult(_0x2ade5e,null))[_0x3f16('0x1d')](handleError(_0x2ade5e,null));};exports['getMessages']=function(_0x42d76e,_0xa99d2d){var _0x3a33d6={'raw':![],'where':{}};var _0x4c71d9={};var _0x34e37c={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3f16('0x6a')]({'where':{'id':_0x42d76e['params']['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0xa99d2d,null))[_0x3f16('0x3b')](function(_0x3e87fc){if(_0x3e87fc){_0x4c71d9[_0x3f16('0x3d')]=_[_0x3f16('0x3f')](db[_0x3f16('0x93')][_0x3f16('0x3e')]);_0x4c71d9[_0x3f16('0x3a')]=_[_0x3f16('0x3f')](_0x42d76e[_0x3f16('0x3a')]);_0x4c71d9[_0x3f16('0x96')]=_[_0x3f16('0x40')](_0x4c71d9[_0x3f16('0x3d')],_0x4c71d9[_0x3f16('0x3a')]);_0x3a33d6[_0x3f16('0x41')]=_['intersection'](_0x4c71d9[_0x3f16('0x3d')],qs[_0x3f16('0x42')](_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x42')]));_0x3a33d6[_0x3f16('0x41')]=_0x3a33d6['attributes'][_0x3f16('0x43')]?_0x3a33d6[_0x3f16('0x41')]:_0x4c71d9[_0x3f16('0x3d')];if(!_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x97')]('nolimit')){_0x3a33d6[_0x3f16('0x24')]=qs[_0x3f16('0x24')](_0x42d76e[_0x3f16('0x3a')]['limit']);_0x3a33d6['offset']=qs[_0x3f16('0x22')](_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x22')]);}_0x3a33d6['order']=qs['sort'](_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x98')]);_0x3a33d6['where']=qs[_0x3f16('0x96')](_['pick'](_0x42d76e[_0x3f16('0x3a')],_0x4c71d9['filters']));_0x3a33d6['where'][_0x3f16('0x99')]=_0x3e87fc['id'];if(_0x42d76e['query'][_0x3f16('0x9a')]){_0x3a33d6[_0x3f16('0x9b')]=_[_0x3f16('0x2e')](_0x3a33d6[_0x3f16('0x9b')],{'$or':_[_0x3f16('0x33')](_0x3a33d6[_0x3f16('0x41')],function(_0x5e1801){var _0x23033e={};_0x23033e[_0x5e1801]={'$like':'%'+_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x9a')]+'%'};return _0x23033e;})});}if(_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x9c')]){var _0x52d639=_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x9c')]['split'](',');var _0xebdc77={};_0xebdc77[_0x52d639[0x0]]={'$gte':moment(_0x52d639[0x1])[_0x3f16('0x77')](_0x3f16('0x9d'))};_0x3a33d6['where']=_[_0x3f16('0x2e')](_0x3a33d6[_0x3f16('0x9b')],_0xebdc77);}_0x3a33d6=_[_0x3f16('0x2e')]({},_0x3a33d6,_0x42d76e[_0x3f16('0x45')]);return db[_0x3f16('0x93')]['count']({'where':_0x3a33d6[_0x3f16('0x9b')]})[_0x3f16('0x3b')](function(_0x54d5f1){_0x34e37c['count']=_0x54d5f1;if(_0x42d76e[_0x3f16('0x3a')][_0x3f16('0x44')]){_0x3a33d6[_0x3f16('0x9e')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x3a33d6);})[_0x3f16('0x3b')](function(_0x2eb5b1){_0x34e37c[_0x3f16('0x9f')]=_0x2eb5b1;return _0x34e37c;});}})['then'](respondWithFilteredResult(_0xa99d2d,_0x3a33d6))[_0x3f16('0x1d')](handleError(_0xa99d2d,null));};exports['getMyMessages']=function(_0x5e28c3,_0x420a5a){var _0x120148={'where':{}},_0x58a71c={},_0x524be1={'count':0x0,'rows':[]};return db[_0x3f16('0x34')][_0x3f16('0x6a')]({'where':{'id':_0x5e28c3[_0x3f16('0x3c')]['id']}})['then'](handleEntityNotFound(_0x420a5a,null))[_0x3f16('0x3b')](function(_0x513eea){if(_0x513eea){_0x58a71c[_0x3f16('0x3d')]=_['keys'](db['ChatMessage'][_0x3f16('0x3e')]);_0x58a71c[_0x3f16('0x3a')]=_[_0x3f16('0x3f')](_0x5e28c3['query']);_0x58a71c[_0x3f16('0x96')]=_['intersection'](_0x58a71c[_0x3f16('0x3d')],_0x58a71c['query']);_0x120148[_0x3f16('0x41')]=_[_0x3f16('0x40')](_0x58a71c[_0x3f16('0x3d')],qs[_0x3f16('0x42')](_0x5e28c3[_0x3f16('0x3a')][_0x3f16('0x42')]));_0x120148[_0x3f16('0x41')]=_0x120148[_0x3f16('0x41')][_0x3f16('0x43')]?_0x120148[_0x3f16('0x41')]:_0x58a71c[_0x3f16('0x3d')];if(!_0x5e28c3[_0x3f16('0x3a')]['hasOwnProperty'](_0x3f16('0xa0'))){_0x120148[_0x3f16('0x24')]=qs[_0x3f16('0x24')](_0x5e28c3['query']['limit']);_0x120148['offset']=qs[_0x3f16('0x22')](_0x5e28c3[_0x3f16('0x3a')][_0x3f16('0x22')]);}_0x120148['order']=qs[_0x3f16('0x98')](_0x5e28c3[_0x3f16('0x3a')][_0x3f16('0x98')]);_0x120148['where']=qs[_0x3f16('0x96')](_[_0x3f16('0xa1')](_0x5e28c3[_0x3f16('0x3a')],_0x58a71c['filters']));_0x120148['where'][_0x3f16('0x99')]=_0x513eea['id'];if(_0x5e28c3['query'][_0x3f16('0x9a')]){_0x120148[_0x3f16('0x9b')]=_[_0x3f16('0x2e')](_0x120148[_0x3f16('0x9b')],{'$or':_[_0x3f16('0x33')](_0x120148[_0x3f16('0x41')],function(_0x325d66){var _0x2a68d1={};_0x2a68d1[_0x325d66]={'$like':'%'+_0x5e28c3[_0x3f16('0x3a')][_0x3f16('0x9a')]+'%'};return _0x2a68d1;})});}_0x120148[_0x3f16('0x9b')][_0x3f16('0x8a')]=![];if(_0x5e28c3[_0x3f16('0x3a')]['id']){_0x120148[_0x3f16('0x9b')]['id']={'$gt':_0x5e28c3['query']['id']};}_0x120148=_['merge']({},_0x120148,_0x5e28c3[_0x3f16('0x45')]);return db[_0x3f16('0x93')][_0x3f16('0x25')]({'where':_0x120148[_0x3f16('0x9b')]})[_0x3f16('0x3b')](function(_0x2af2b4){_0x524be1[_0x3f16('0x25')]=_0x2af2b4;_0x120148[_0x3f16('0x9e')]=[];if(_0x5e28c3['query'][_0x3f16('0xa2')]){_0x120148[_0x3f16('0x9e')][_0x3f16('0xa3')]({'model':db[_0x3f16('0x7a')],'as':'User','attributes':['id','fullname',_0x3f16('0x86')]});}if(_0x5e28c3['query'][_0x3f16('0x44')]){_0x120148['include']=[{'all':!![]}];}return db['ChatMessage'][_0x3f16('0x38')](_0x120148);})[_0x3f16('0x3b')](function(_0x5ada33){_0x524be1['rows']=_0x5ada33;return _0x524be1;});}})[_0x3f16('0x3b')](respondWithFilteredResult(_0x420a5a,_0x120148))[_0x3f16('0x1d')](handleError(_0x420a5a,null));};exports[_0x3f16('0xa4')]=function(_0x2d1313,_0x5036eb){return db[_0x3f16('0x34')]['find']({'where':{'id':_0x2d1313[_0x3f16('0x3c')]['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0x5036eb,null))[_0x3f16('0x3b')](function(_0x333055){if(_0x333055){return _0x333055[_0x3f16('0xa5')](_0x2d1313['body']['ids'],_['omit'](_0x2d1313[_0x3f16('0x48')],['ids','id'])||{})['spread'](function(){return db[_0x3f16('0xa6')][_0x3f16('0x38')]({'attributes':['id',_0x3f16('0x2b'),'color'],'where':{'id':_0x2d1313['body'][_0x3f16('0x94')]}});})[_0x3f16('0x3b')](function(_0x32abd3){socket[_0x3f16('0xa7')](_0x3f16('0xa8'),{'id':Number(_0x2d1313['params']['id']),'tags':_0x32abd3||[]});return{'id':Number(_0x2d1313[_0x3f16('0x3c')]['id']),'tags':_0x32abd3||[]};});}})[_0x3f16('0x3b')](respondWithResult(_0x5036eb,null))[_0x3f16('0x1d')](handleError(_0x5036eb,null));};exports[_0x3f16('0xa9')]=function(_0x4bf03a,_0x14b10a){return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0x4bf03a[_0x3f16('0x3c')]['id']}})[_0x3f16('0x3b')](handleEntityNotFound(_0x14b10a,null))[_0x3f16('0x3b')](function(_0x4f7df3){if(_0x4f7df3){return _0x4f7df3['removeTags'](_0x4bf03a['query'][_0x3f16('0x94')]);}})['then'](respondWithStatusCode(_0x14b10a,null))[_0x3f16('0x1d')](handleError(_0x14b10a,null));};exports['download']=function(_0x490b16,_0x556ff6){var _0x124d7a=moment()[_0x3f16('0xaa')]()[_0x3f16('0xab')]();var _0x47e930=path[_0x3f16('0x6e')](config['root'],_0x3f16('0xac'),_0x3f16('0xad'),_0x3f16('0xae'));var _0x2d6d6c=path[_0x3f16('0x6e')](config[_0x3f16('0x6f')],_0x3f16('0xac'),_0x3f16('0xad'),'attachments');var _0x3f6a12=path[_0x3f16('0x6e')](_0x47e930,_0x124d7a);var _0x25aa11=util[_0x3f16('0x77')]('transcript-%d-%s.zip',_0x490b16[_0x3f16('0x3c')]['id'],_0x124d7a);var _0x3ddb46=path[_0x3f16('0x6e')](_0x47e930,_0x25aa11);var _0x3861a5=[];_0x3861a5[_0x3f16('0xa3')]({'model':db['User'],'as':_0x3f16('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x3861a5[_0x3f16('0xa3')]({'model':db[_0x3f16('0x5e')],'as':_0x3f16('0x5f'),'attributes':['id',_0x3f16('0xaf'),'lastName'],'raw':!![]});if(_0x490b16['query'][_0x3f16('0xb0')]){_0x3861a5[_0x3f16('0xa3')]({'model':db[_0x3f16('0x6c')],'as':_0x3f16('0x6c'),'raw':!![]});}var _0x3d2597=[{'model':db[_0x3f16('0x93')],'as':'Messages','attributes':['id','body',_0x3f16('0xb1'),_0x3f16('0xb2'),_0x3f16('0x8a'),'read'],'include':_0x3861a5}];_0x3d2597[_0x3f16('0xa3')]({'model':db[_0x3f16('0x4b')],'as':'Account','attributes':['id',_0x3f16('0x2b')]});_0x3d2597[_0x3f16('0xa3')]({'model':db[_0x3f16('0x7a')],'as':_0x3f16('0xb3'),'attributes':['id',_0x3f16('0x88')]});return db[_0x3f16('0x34')][_0x3f16('0x46')]({'where':{'id':_0x490b16[_0x3f16('0x3c')]['id']},'include':_0x3d2597})[_0x3f16('0x3b')](handleEntityNotFound(_0x556ff6,null))['then'](function(_0x3e93bb){if(_0x3e93bb){var _0x3862d3=_0x3e93bb[_0x3f16('0xb4')]({'plain':!![]});fs[_0x3f16('0xb5')](_0x3f6a12);var _0x59e64b={'channel':_0x3f16('0xb6'),'account':_0x3862d3['Account']['name'],'agent':_0x3862d3[_0x3f16('0xb3')]?_0x3862d3[_0x3f16('0xb3')][_0x3f16('0x88')]:_0x3f16('0xb7'),'createdAt':moment(_0x3862d3[_0x3f16('0xb1')])[_0x3f16('0x77')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3862d3[_0x3f16('0x63')]?moment(_0x3862d3['closedAt'])[_0x3f16('0x77')](_0x3f16('0x9d'))[_0x3f16('0xab')]():'','disposition':_0x3862d3['disposition'],'chatInfo':{'browser':_0x3862d3[_0x3f16('0xb8')],'os':_0x3862d3['osName'],'referer':_0x3862d3[_0x3f16('0xb9')],'customerIp':_0x3862d3[_0x3f16('0xba')],'customerPort':_0x3862d3[_0x3f16('0xbb')]?_0x3862d3[_0x3f16('0xbb')]:_0x3f16('0xb7')},'messages':_(_0x3862d3[_0x3f16('0x7c')])['tail']()[_0x3f16('0x9a')]({'secret':![]})[_0x3f16('0x33')](function(_0x325dce){if(_0x325dce[_0x3f16('0x6c')]){var _0x39906c=path['join'](_0x2d6d6c,_0x325dce[_0x3f16('0x6c')][_0x3f16('0x72')]);if(fs['existsSync'](_0x39906c)){fs[_0x3f16('0xbc')](_0x39906c)['pipe'](fs['createWriteStream'](path[_0x3f16('0x6e')](_0x3f6a12,_0x325dce['Attachment'][_0x3f16('0x72')])));}}return{'date':moment(_0x325dce['createdAt'])[_0x3f16('0x77')](_0x3f16('0x9d'))[_0x3f16('0xab')](),'sender':_0x325dce[_0x3f16('0xb2')]===_0x3f16('0xbd')?_0x325dce[_0x3f16('0x7a')]?_0x325dce[_0x3f16('0x7a')][_0x3f16('0x88')]:_0x3f16('0x84'):_0x325dce[_0x3f16('0x5f')]['firstName']+(_0x325dce[_0x3f16('0x5f')]['lastName']?'\x20'+_0x325dce[_0x3f16('0x5f')][_0x3f16('0xbe')]:''),'body':_0x325dce[_0x3f16('0x6c')]?_0x325dce[_0x3f16('0x6c')][_0x3f16('0x72')]:_0x325dce[_0x3f16('0x48')],'direction':_0x325dce[_0x3f16('0xb2')]===_0x3f16('0xbd')?'A':'C','secret':_0x325dce[_0x3f16('0x8a')],'read':_0x325dce[_0x3f16('0xbf')],'attachment':_0x325dce[_0x3f16('0x6c')]};})['value']()};return ejs[_0x3f16('0xc0')](path[_0x3f16('0x6e')](config[_0x3f16('0x6f')],_0x3f16('0xac'),_0x3f16('0xc1'),_0x3f16('0xc2')),{'interaction':_0x59e64b})[_0x3f16('0x3b')](function(_0x1e2765){var _0x43e508=path['join'](_0x3f6a12,'transcript-'+_0x3862d3['id']+'-'+_0x124d7a+'.pdf');var _0xa17db3={'path':_0x43e508,'channel':'Chat','interactionId':_0x3862d3['id']};return pdf[_0x3f16('0xc3')](_0x1e2765,_0xa17db3);})[_0x3f16('0x3b')](function(){return new Promise(function(_0x55f6a7,_0x468917){zipdir(_0x3f6a12,{'saveTo':_0x3ddb46},function(_0x3365bb,_0x57878e){if(_0x3365bb)return _0x468917(_0x3365bb);return _0x55f6a7(_0x57878e);});})[_0x3f16('0x3b')](function(){return new BPromise(function(_0x4f8376,_0x51dc9c){rimraf(_0x3f6a12,function(_0x3ac378){if(_0x3ac378)_0x51dc9c(_0x3ac378);return _0x4f8376();});});})[_0x3f16('0x3b')](function(){return _0x556ff6[_0x3f16('0x73')](_0x3ddb46,_0x25aa11,function(_0xa0a84a){if(_0xa0a84a){logger['error'](_0x3f16('0xc4'),_0xa0a84a);}else{fs[_0x3f16('0xc5')](_0x3ddb46);}});});});}else{return _0x556ff6[_0x3f16('0x1e')](0xc8);}})[_0x3f16('0x1d')](handleError(_0x556ff6,null));}; \ No newline at end of file +var _0x2754=['attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','join','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','options','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','Contact','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','end','stack','name','send','render','body','contact','agent','account','map','ChatInteraction','fieldName','type','key','getOptions','chat','query','user','catch','show','params','model','keys','rawAttributes','intersection','attributes','length','includeAll','include','find','create','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment'];(function(_0x71035a,_0x2086dc){var _0x45334c=function(_0x488d4d){while(--_0x488d4d){_0x71035a['push'](_0x71035a['shift']());}};_0x45334c(++_0x2086dc);}(_0x2754,0x67));var _0x4275=function(_0x207f67,_0x172ffa){_0x207f67=_0x207f67-0x0;var _0x4d6724=_0x2754[_0x207f67];return _0x4d6724;};'use strict';var rimraf=require(_0x4275('0x0'));var zipdir=require(_0x4275('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4275('0x2'));var Mustache=require(_0x4275('0x3'));var util=require(_0x4275('0x4'));var path=require('path');var ejs=require(_0x4275('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4275('0x6'));var interaction=require(_0x4275('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4275('0x8'));var logger=require(_0x4275('0x9'))('api');var config=require(_0x4275('0xa'));var db=require(_0x4275('0xb'))['db'];config[_0x4275('0xc')]=_['defaults'](config[_0x4275('0xc')],{'host':_0x4275('0xd'),'port':0x18eb});var socket=require(_0x4275('0xe'))(new Redis(config[_0x4275('0xc')]));require(_0x4275('0xf'))[_0x4275('0x10')](socket);var jayson=require(_0x4275('0x11'));var client=jayson['client'][_0x4275('0x12')]({'port':0x232b});var client9004=jayson[_0x4275('0x13')][_0x4275('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x217002,_0x406cb4,_0x3f0135,_0x1f31f9){return new BPromise(function(_0x58e206,_0x91712c){var _0x6a30de=_0x1f31f9||client;return _0x6a30de[_0x4275('0x14')](_0x217002,_0x3f0135)[_0x4275('0x15')](function(_0x2c4b99){logger[_0x4275('0x16')](_0x4275('0x17'),_0x406cb4,_0x4275('0x18'));logger[_0x4275('0x19')](_0x4275('0x1a'),_0x406cb4,'request\x20sent',JSON['stringify'](_0x2c4b99));if(_0x2c4b99['error']){if(_0x2c4b99[_0x4275('0x1b')][_0x4275('0x1c')]===0x1f4){logger[_0x4275('0x1b')](_0x4275('0x17'),_0x406cb4,_0x2c4b99['error'][_0x4275('0x1d')]);return _0x91712c(_0x2c4b99[_0x4275('0x1b')][_0x4275('0x1d')]);}logger[_0x4275('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x406cb4,_0x2c4b99[_0x4275('0x1b')][_0x4275('0x1d')]);return _0x58e206(_0x2c4b99['error'][_0x4275('0x1d')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x406cb4,_0x4275('0x18'));_0x58e206(_0x2c4b99[_0x4275('0x1e')][_0x4275('0x1d')]);}})['catch'](function(_0xe5384d){logger[_0x4275('0x1b')](_0x4275('0x17'),_0x406cb4,_0xe5384d);_0x91712c(_0xe5384d);});});}function respondWithStatusCode(_0x284f04,_0x233a7a){_0x233a7a=_0x233a7a||0xcc;return function(_0x225015){if(_0x225015){return _0x284f04[_0x4275('0x1f')](_0x233a7a);}return _0x284f04[_0x4275('0x20')](_0x233a7a)['end']();};}function respondWithResult(_0x66a044,_0x1e477d){_0x1e477d=_0x1e477d||0xc8;return function(_0x3c491e){if(_0x3c491e){return _0x66a044['status'](_0x1e477d)[_0x4275('0x21')](_0x3c491e);}};}function respondWithFilteredResult(_0x12aae4,_0x190248){return function(_0x3a3646){if(_0x3a3646){var _0x47cb86=typeof _0x190248[_0x4275('0x22')]==='undefined'&&typeof _0x190248[_0x4275('0x23')]===_0x4275('0x24');var _0x47dd0b=_0x3a3646['count'];var _0x2bb24e=_0x47cb86?0x0:_0x190248[_0x4275('0x22')];var _0x4aa1e7=_0x47cb86?_0x3a3646[_0x4275('0x25')]:_0x190248[_0x4275('0x22')]+_0x190248[_0x4275('0x23')];var _0x4afbc2;if(_0x4aa1e7>=_0x47dd0b){_0x4aa1e7=_0x47dd0b;_0x4afbc2=0xc8;}else{_0x4afbc2=0xce;}_0x12aae4[_0x4275('0x20')](_0x4afbc2);return _0x12aae4[_0x4275('0x26')](_0x4275('0x27'),_0x2bb24e+'-'+_0x4aa1e7+'/'+_0x47dd0b)[_0x4275('0x21')](_0x3a3646);}return null;};}function saveUpdates(_0x2a2df3){return function(_0x3164c5){if(_0x3164c5){return _0x3164c5[_0x4275('0x28')](_0x2a2df3)[_0x4275('0x15')](function(_0x3c8821){return _0x3c8821;});}return null;};}function removeEntity(_0x1a738a){return function(_0x1c9e69){if(_0x1c9e69){return _0x1c9e69['destroy']()['then'](function(){_0x1a738a[_0x4275('0x20')](0xcc)[_0x4275('0x29')]();});}};}function handleEntityNotFound(_0x188ae0){return function(_0xa38061){if(!_0xa38061){_0x188ae0['sendStatus'](0x194);}return _0xa38061;};}function handleError(_0x443d95,_0x1a8ce0){_0x1a8ce0=_0x1a8ce0||0x1f4;return function(_0x575f10){logger[_0x4275('0x1b')](_0x575f10[_0x4275('0x2a')]);if(_0x575f10[_0x4275('0x2b')]){delete _0x575f10['name'];}_0x443d95[_0x4275('0x20')](_0x1a8ce0)[_0x4275('0x2c')](_0x575f10);};}function getMustacheRender(_0xbd10b8,_0xb5ca1e){return Mustache[_0x4275('0x2d')](_0xbd10b8,_['merge'](_0xb5ca1e[_0x4275('0x2e')],{'contact':_0xb5ca1e[_0x4275('0x2f')],'message':_0xb5ca1e[_0x4275('0x1d')],'agent':_0xb5ca1e[_0x4275('0x30')],'interaction':_0xb5ca1e['interaction'],'account':_0xb5ca1e[_0x4275('0x31')]}))||'';}exports['index']=function(_0x5bbb65,_0x69da99){var _0x5e2478={};var _0x178522=_[_0x4275('0x32')](db[_0x4275('0x33')]['rawAttributes'],function(_0xb253d){return{'name':_0xb253d[_0x4275('0x34')],'type':_0xb253d[_0x4275('0x35')][_0x4275('0x36')]};});_0x5e2478=qs[_0x4275('0x37')](_0x178522,_0x5bbb65);return interaction['findAll'](_0x4275('0x38'),_0x5bbb65[_0x4275('0x39')],_0x5bbb65[_0x4275('0x3a')],_0x5e2478,_0x178522)['then'](respondWithFilteredResult(_0x69da99,_0x5e2478))[_0x4275('0x3b')](handleError(_0x69da99,null));};exports[_0x4275('0x3c')]=function(_0x39f579,_0x44e326){var _0x1c7c7d={'raw':![],'where':{'id':_0x39f579[_0x4275('0x3d')]['id']}},_0x14c515={};_0x14c515[_0x4275('0x3e')]=_[_0x4275('0x3f')](db[_0x4275('0x33')][_0x4275('0x40')]);_0x14c515['query']=_[_0x4275('0x3f')](_0x39f579[_0x4275('0x39')]);_0x14c515['filters']=_[_0x4275('0x41')](_0x14c515['model'],_0x14c515[_0x4275('0x39')]);_0x1c7c7d[_0x4275('0x42')]=_[_0x4275('0x41')](_0x14c515[_0x4275('0x3e')],qs['fields'](_0x39f579[_0x4275('0x39')]['fields']));_0x1c7c7d['attributes']=_0x1c7c7d[_0x4275('0x42')][_0x4275('0x43')]?_0x1c7c7d[_0x4275('0x42')]:_0x14c515['model'];if(_0x39f579[_0x4275('0x39')][_0x4275('0x44')]){_0x1c7c7d[_0x4275('0x45')]=[{'all':!![]}];}_0x1c7c7d=_['merge']({},_0x1c7c7d,_0x39f579['options']);return db[_0x4275('0x33')][_0x4275('0x46')](_0x1c7c7d)[_0x4275('0x15')](handleEntityNotFound(_0x44e326,null))['then'](respondWithResult(_0x44e326,null))['catch'](handleError(_0x44e326,null));};exports[_0x4275('0x47')]=function(_0x4bb9ab,_0x3458e6){return db[_0x4275('0x33')]['create'](_0x4bb9ab[_0x4275('0x2e')],{})[_0x4275('0x15')](respondWithResult(_0x3458e6,0xc9))[_0x4275('0x3b')](handleError(_0x3458e6,null));};exports[_0x4275('0x28')]=function(_0x27f0a8,_0x590768){if(_0x27f0a8['body']['id']){delete _0x27f0a8[_0x4275('0x2e')]['id'];}return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x27f0a8[_0x4275('0x3d')]['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x590768,null))[_0x4275('0x15')](saveUpdates(_0x27f0a8[_0x4275('0x2e')],null))['then'](respondWithResult(_0x590768,null))[_0x4275('0x3b')](handleError(_0x590768,null));};exports[_0x4275('0x48')]=function(_0x3fa49e,_0x2b156c){return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x3fa49e[_0x4275('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2b156c,null))[_0x4275('0x15')](removeEntity(_0x2b156c,null))['catch'](handleError(_0x2b156c,null));};exports[_0x4275('0x49')]=function(_0x506a88,_0x49fe1d){return db[_0x4275('0x33')]['describe']()[_0x4275('0x15')](respondWithResult(_0x49fe1d,null))['catch'](handleError(_0x49fe1d,null));};exports['createVidaooSession']=function(_0x3c6d80,_0x521b39){var _0xf4a6dc=_0x3c6d80[_0x4275('0x3d')]['id'];var _0x2fd177;var _0x1641a2;var _0x2e4aaa;return db[_0x4275('0x33')][_0x4275('0x4a')]({'where':{'id':_0xf4a6dc}})[_0x4275('0x15')](function(_0x1ed927){_0x2fd177=_0x1ed927;return db[_0x4275('0x4b')]['findOne']({'where':{'id':_0x1ed927[_0x4275('0x4c')]},'attributes':['id',_0x4275('0x4d'),'vidaooEscalation',_0x4275('0x4e'),_0x4275('0x4f'),_0x4275('0x50')],'raw':!![]});})[_0x4275('0x15')](function(_0x4a5790){if(_0x4a5790&&_0x4a5790[_0x4275('0x4d')]&&_0x4a5790['vidaooEscalation']){_0x1641a2=_0x4a5790;var _0x3900f3={'interaction':{'id':_0xf4a6dc},'agent':{'id':_0x3c6d80['user']['id'],'name':_0x3c6d80[_0x4275('0x3a')][_0x4275('0x2b')],'fullname':_0x3c6d80['user'][_0x4275('0x51')],'email':_0x3c6d80[_0x4275('0x3a')][_0x4275('0x52')]},'contact':_0x3c6d80['body'][_0x4275('0x2f')],'account':_0x3c6d80['body'][_0x4275('0x31')]};var _0x2ea286={'rejectUnauthorized':![],'method':_0x4275('0x53'),'url':_0x4275('0x54'),'headers':{'X-APIKEY':_0x4a5790[_0x4275('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3c6d80[_0x4275('0x3a')][_0x4275('0x52')]],'buttons':null,'topic':_0x1641a2[_0x4275('0x4e')],'note':_[_0x4275('0x55')](_0x1641a2[_0x4275('0x4f')])?null:getMustacheRender(_0x1641a2['vidaooNote'],_0x3900f3),'metadata':null},'redirect':_0x4275('0x56'),'json':!![]};try{if(!_[_0x4275('0x55')](_0x1641a2[_0x4275('0x50')])){var _0x1b4bc1=getMustacheRender(_0x1641a2['vidaooMetadata'],_0x3900f3);var _0x4c1f52=JSON[_0x4275('0x57')](_0x1b4bc1);_0x2ea286[_0x4275('0x2e')][_0x4275('0x58')]=_0x4c1f52;}}catch(_0x12554c){throw new db[(_0x4275('0x59'))]['ValidationError'](_0x4275('0x5a'));}return rp(_0x2ea286);}else{throw new db[(_0x4275('0x59'))][(_0x4275('0x5b'))](_0x4275('0x5c'));}})[_0x4275('0x15')](function(_0x345c7d){_0x2e4aaa=_0x345c7d;if(_0x2e4aaa['id']){var _0x5b7929={'body':_0x2e4aaa[_0x4275('0x5d')],'ChatWebsiteId':_0x1641a2['id'],'ChatInteractionId':_0x2fd177['id'],'direction':'out','UserId':_0x3c6d80['user']['id']};return db[_0x4275('0x5e')][_0x4275('0x47')](_0x5b7929,{});}else{throw new db['Sequelize'][(_0x4275('0x5b'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x2fd177[_0x4275('0x5f')]({'vidaooSessionId':_0x2e4aaa['id']});})[_0x4275('0x15')](respondWithResult(_0x521b39,null))[_0x4275('0x3b')](handleError(_0x521b39,null));};exports[_0x4275('0x60')]=function(_0xab5945,_0x1c1a5d){if(_0xab5945['body']['id']){delete _0xab5945['body']['id'];}return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0xab5945['params']['id']},'include':[{'model':db[_0x4275('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1c1a5d,null))[_0x4275('0x15')](saveUpdates(_0xab5945[_0x4275('0x2e')],null))[_0x4275('0x15')](respondWithResult(_0x1c1a5d,null))[_0x4275('0x3b')](handleError(_0x1c1a5d,null));};exports[_0x4275('0x62')]=function(_0x41235a,_0x82cb9a){if(_0x41235a[_0x4275('0x2e')]['id']){delete _0x41235a[_0x4275('0x2e')]['id'];}return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x41235a[_0x4275('0x3d')]['id']}})[_0x4275('0x15')](function(_0x4b1667){if(!_0x4b1667){logger['error'](_0x4275('0x63'),_0x4275('0x62'),0x194,_0x4275('0x64'));_0x82cb9a['sendStatus'](0x194);}else{if(_0x4b1667[_0x4275('0x65')]){throw new db[(_0x4275('0x59'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x4b1667;})['then'](function(_0x4b4dde){if(_0x4b4dde){return _0x4b4dde[_0x4275('0x28')]({'closed':_0x41235a['body']['closed'],'disposition':_0x41235a['body'][_0x4275('0x66')]})[_0x4275('0x15')](function(_0x2ee661){return _0x2ee661;});}})[_0x4275('0x15')](function(){return respondWithRpcPromise(_0x4275('0x67'),_0x4275('0x62'),_0x41235a[_0x4275('0x2e')],client9004);})[_0x4275('0x15')](respondWithResult(_0x82cb9a,null))[_0x4275('0x3b')](handleError(_0x82cb9a,null));};exports['attachmentUpload']=function(_0x3f7812,_0x5d0e96){_0x3f7812[_0x4275('0x2e')]['name']=_0x3f7812[_0x4275('0x68')][_0x4275('0x69')];_0x3f7812[_0x4275('0x2e')][_0x4275('0x6a')]=_0x3f7812[_0x4275('0x68')]['filename'];_0x3f7812[_0x4275('0x2e')]['type']=_0x3f7812['file'][_0x4275('0x6b')];return db[_0x4275('0x6c')]['create'](_0x3f7812[_0x4275('0x2e')])[_0x4275('0x15')](respondWithResult(_0x5d0e96,0xc9))[_0x4275('0x3b')](handleError(_0x5d0e96,null));};exports[_0x4275('0x6d')]=function(_0x116a4e,_0x26f907){return db[_0x4275('0x33')][_0x4275('0x4a')]({'where':{'id':_0x116a4e[_0x4275('0x3d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26f907,null))[_0x4275('0x15')](function(_0x1260f8){if(_0x1260f8){if(_0x1260f8[_0x4275('0x6e')]){return _0x26f907['status'](0x193)[_0x4275('0x21')]({'status':0x193,'message':_0x4275('0x6f')});}return db[_0x4275('0x6c')][_0x4275('0x4a')]({'where':{'id':_0x116a4e[_0x4275('0x39')][_0x4275('0x70')]},'raw':!![]})[_0x4275('0x15')](handleEntityNotFound(_0x26f907,null));}})[_0x4275('0x15')](function(_0x913217){if(_0x913217){var _0x1ebb79=_0x913217[_0x4275('0x71')]!==null;var _0x8f681e=path['join'](config[_0x4275('0x72')],'server/files/attachments/');if(_0x1ebb79){_0x8f681e=path[_0x4275('0x73')](_0x8f681e,_0x4275('0x74'));}var _0x1295be=path[_0x4275('0x73')](_0x8f681e,_0x913217[_0x4275('0x6a')]);return _0x26f907[_0x4275('0x75')](_0x1295be);}})[_0x4275('0x3b')](handleError(_0x26f907,null));};exports[_0x4275('0x76')]=function(_0x3b37c2,_0x39a70f){var _0x22cd4c=null;var _0xfdffa9=null;var _0x243391=null;if(_0x3b37c2[_0x4275('0x2e')]['id']){delete _0x3b37c2[_0x4275('0x2e')]['id'];}if(_0x3b37c2[_0x4275('0x2e')]['mailTranscript']){_0x243391=path[_0x4275('0x73')](config[_0x4275('0x72')],_0x4275('0x77'),util[_0x4275('0x78')](_0x4275('0x79'),Date[_0x4275('0x7a')]()));_0x3b37c2[_0x4275('0x2e')][_0x4275('0x7b')]=_0x243391;}return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x3b37c2[_0x4275('0x3d')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x4275('0x7c'),'include':[{'model':db[_0x4275('0x7d')],'as':'User'}]}]})[_0x4275('0x15')](handleEntityNotFound(_0x39a70f,null))['then'](saveUpdates(_0x3b37c2[_0x4275('0x2e')],null))[_0x4275('0x15')](function(_0x4b869c){if(_0x4b869c){_0x22cd4c=_0x4b869c;return db[_0x4275('0x4b')][_0x4275('0x46')]({'where':{'id':_0x22cd4c[_0x4275('0x4c')]}});}})[_0x4275('0x15')](function(_0x130884){if(_0x130884){_0xfdffa9=_0x130884;return db['CmContact'][_0x4275('0x46')]({'where':{'id':_0x22cd4c[_0x4275('0x7e')]}});}})[_0x4275('0x15')](function(_0x93ee2b){if(_0x93ee2b){if(_0x243391){var _0x250657=null;for(var _0xed18bd=0x1;_0xed18bd<_0x22cd4c[_0x4275('0x7c')][_0x4275('0x43')];++_0xed18bd){_0x250657=_0x22cd4c['Messages'][_0xed18bd];var _0x1b677c=_0x250657[_0x4275('0x65')]?util[_0x4275('0x78')](_0x4275('0x7f'),_0xfdffa9['agentAlias'],_0x250657[_0x4275('0x65')]):_0x4275('0x80');var _0x1f624b=_0x3b37c2[_0x4275('0x2e')][_0x4275('0x81')]||util[_0x4275('0x78')](_0x4275('0x7f'),_0x4275('0x82'),_0x250657['ContactId']);switch(_0xfdffa9[_0x4275('0x83')]){case _0x4275('0x84'):_0x1b677c=_0x250657[_0x4275('0x65')]?util[_0x4275('0x78')](_0x4275('0x7f'),_0xfdffa9[_0x4275('0x85')],_0x250657[_0x4275('0x65')]):'System';break;case _0x4275('0x86'):_0x1b677c=_0x250657[_0x4275('0x65')]?_0x250657[_0x4275('0x7d')][_0x4275('0x87')]||_0x250657['User'][_0x4275('0x51')]:_0x4275('0x80');break;case _0x4275('0x88'):_0x1b677c=_0x250657[_0x4275('0x65')]?_0x250657['User'][_0x4275('0x51')]:_0x4275('0x80');break;default:_0x1b677c=_0x250657[_0x4275('0x65')]?util[_0x4275('0x78')]('%s%d',_0xfdffa9['agentAlias'],_0x250657[_0x4275('0x65')]):_0x4275('0x80');}var _0x975da0=util[_0x4275('0x78')](_0x4275('0x89'),moment(_0x250657[_0x4275('0x8a')])[_0x4275('0x78')]('MM/DD/YYYY\x20HH:mm:ss'),_0x250657[_0x4275('0x8b')]==='in'?_0x1f624b:_0x1b677c,_0x250657[_0x4275('0x2e')]);if(!_0x250657[_0x4275('0x8c')]){fs[_0x4275('0x8d')](_0x243391,_0x975da0);}}return db['MailAccount'][_0x4275('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4275('0x8e'),'raw':!![],'include':[{'model':db[_0x4275('0x8f')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x4275('0x15')](function(_0x291a84){if(!_0x291a84||!_0x291a84[_0x4275('0x8e')]||!_0x3b37c2[_0x4275('0x2e')])return _0x22cd4c;var _0x2dc7d0=_0x291a84['getSmtpOptions']();return respondWithRpcPromise(_0x4275('0x90'),_0x4275('0x91'),{'account':_0x2dc7d0,'message':{'from':util[_0x4275('0x78')](_0x4275('0x92'),_0x291a84[_0x4275('0x2b')],_0x291a84[_0x4275('0x52')]||_0x291a84[_0x4275('0x8e')][_0x4275('0x3a')]),'to':_0x3b37c2[_0x4275('0x2e')][_0x4275('0x93')],'subject':'Mail\x20Transcript','text':util[_0x4275('0x78')](_0x4275('0x94'),_0x3b37c2[_0x4275('0x2e')][_0x4275('0x93')]),'attachments':[{'path':_0x243391}]}})[_0x4275('0x15')](function(){return _0x22cd4c;})[_0x4275('0x3b')](function(_0x3bbce4){logger[_0x4275('0x1b')](_0x3bbce4);});})['then'](respondWithStatusCode(_0x39a70f,0xc8))[_0x4275('0x3b')](handleError(_0x39a70f,null));};exports[_0x4275('0x95')]=function(_0x1aa61e,_0x41a89d){return db[_0x4275('0x5e')][_0x4275('0x46')]({'where':{'id':_0x1aa61e['params']['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x41a89d,null))['then'](function(_0x2c4a20){if(_0x2c4a20){return _0x2c4a20['addMessage'](_0x1aa61e['body'][_0x4275('0x96')],_[_0x4275('0x97')](_0x1aa61e['body'],[_0x4275('0x96'),'id'])||{});}})[_0x4275('0x15')](respondWithResult(_0x41a89d,null))[_0x4275('0x3b')](handleError(_0x41a89d,null));};exports[_0x4275('0x98')]=function(_0x17b032,_0x22895a){var _0x158cd4={'raw':![],'where':{}};var _0x9ab3af={};var _0x3efcd6={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x17b032[_0x4275('0x3d')]['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x22895a,null))[_0x4275('0x15')](function(_0x24ad51){if(_0x24ad51){_0x9ab3af[_0x4275('0x3e')]=_[_0x4275('0x3f')](db[_0x4275('0x5e')][_0x4275('0x40')]);_0x9ab3af['query']=_[_0x4275('0x3f')](_0x17b032[_0x4275('0x39')]);_0x9ab3af[_0x4275('0x99')]=_[_0x4275('0x41')](_0x9ab3af[_0x4275('0x3e')],_0x9ab3af[_0x4275('0x39')]);_0x158cd4[_0x4275('0x42')]=_['intersection'](_0x9ab3af[_0x4275('0x3e')],qs[_0x4275('0x9a')](_0x17b032[_0x4275('0x39')][_0x4275('0x9a')]));_0x158cd4[_0x4275('0x42')]=_0x158cd4['attributes'][_0x4275('0x43')]?_0x158cd4['attributes']:_0x9ab3af[_0x4275('0x3e')];if(!_0x17b032[_0x4275('0x39')][_0x4275('0x9b')](_0x4275('0x9c'))){_0x158cd4[_0x4275('0x23')]=qs[_0x4275('0x23')](_0x17b032['query'][_0x4275('0x23')]);_0x158cd4[_0x4275('0x22')]=qs[_0x4275('0x22')](_0x17b032['query'][_0x4275('0x22')]);}_0x158cd4[_0x4275('0x9d')]=qs[_0x4275('0x9e')](_0x17b032['query']['sort']);_0x158cd4[_0x4275('0x9f')]=qs[_0x4275('0x99')](_[_0x4275('0xa0')](_0x17b032[_0x4275('0x39')],_0x9ab3af[_0x4275('0x99')]));_0x158cd4[_0x4275('0x9f')]['ChatInteractionId']=_0x24ad51['id'];if(_0x17b032[_0x4275('0x39')][_0x4275('0xa1')]){_0x158cd4['where']=_[_0x4275('0xa2')](_0x158cd4[_0x4275('0x9f')],{'$or':_['map'](_0x158cd4[_0x4275('0x42')],function(_0x51664b){var _0x1cac42={};_0x1cac42[_0x51664b]={'$like':'%'+_0x17b032[_0x4275('0x39')][_0x4275('0xa1')]+'%'};return _0x1cac42;})});}if(_0x17b032[_0x4275('0x39')][_0x4275('0xa3')]){var _0x4793c3=_0x17b032[_0x4275('0x39')][_0x4275('0xa3')]['split'](',');var _0x16d63a={};_0x16d63a[_0x4793c3[0x0]]={'$gte':moment(_0x4793c3[0x1])[_0x4275('0x78')](_0x4275('0xa4'))};_0x158cd4[_0x4275('0x9f')]=_[_0x4275('0xa2')](_0x158cd4['where'],_0x16d63a);}_0x158cd4=_[_0x4275('0xa2')]({},_0x158cd4,_0x17b032['options']);return db[_0x4275('0x5e')][_0x4275('0x25')]({'where':_0x158cd4['where']})[_0x4275('0x15')](function(_0x128315){_0x3efcd6[_0x4275('0x25')]=_0x128315;if(_0x17b032['query'][_0x4275('0x44')]){_0x158cd4['include']=[{'all':!![]}];}return db[_0x4275('0x5e')][_0x4275('0xa5')](_0x158cd4);})[_0x4275('0x15')](function(_0x156638){_0x3efcd6[_0x4275('0xa6')]=_0x156638;return _0x3efcd6;});}})[_0x4275('0x15')](respondWithFilteredResult(_0x22895a,_0x158cd4))[_0x4275('0x3b')](handleError(_0x22895a,null));};exports[_0x4275('0xa7')]=function(_0x3506d6,_0x5a6b5a){var _0x13e326={'where':{}},_0x134252={},_0x20797b={'count':0x0,'rows':[]};return db[_0x4275('0x33')][_0x4275('0x4a')]({'where':{'id':_0x3506d6['params']['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x5a6b5a,null))['then'](function(_0x5d4695){if(_0x5d4695){_0x134252[_0x4275('0x3e')]=_[_0x4275('0x3f')](db[_0x4275('0x5e')][_0x4275('0x40')]);_0x134252[_0x4275('0x39')]=_[_0x4275('0x3f')](_0x3506d6[_0x4275('0x39')]);_0x134252['filters']=_[_0x4275('0x41')](_0x134252[_0x4275('0x3e')],_0x134252[_0x4275('0x39')]);_0x13e326[_0x4275('0x42')]=_[_0x4275('0x41')](_0x134252[_0x4275('0x3e')],qs[_0x4275('0x9a')](_0x3506d6[_0x4275('0x39')][_0x4275('0x9a')]));_0x13e326[_0x4275('0x42')]=_0x13e326[_0x4275('0x42')][_0x4275('0x43')]?_0x13e326['attributes']:_0x134252[_0x4275('0x3e')];if(!_0x3506d6[_0x4275('0x39')][_0x4275('0x9b')](_0x4275('0x9c'))){_0x13e326['limit']=qs[_0x4275('0x23')](_0x3506d6['query'][_0x4275('0x23')]);_0x13e326[_0x4275('0x22')]=qs[_0x4275('0x22')](_0x3506d6[_0x4275('0x39')]['offset']);}_0x13e326[_0x4275('0x9d')]=qs[_0x4275('0x9e')](_0x3506d6['query'][_0x4275('0x9e')]);_0x13e326[_0x4275('0x9f')]=qs['filters'](_[_0x4275('0xa0')](_0x3506d6['query'],_0x134252[_0x4275('0x99')]));_0x13e326['where']['ChatInteractionId']=_0x5d4695['id'];if(_0x3506d6[_0x4275('0x39')][_0x4275('0xa1')]){_0x13e326[_0x4275('0x9f')]=_['merge'](_0x13e326['where'],{'$or':_[_0x4275('0x32')](_0x13e326[_0x4275('0x42')],function(_0x78eec7){var _0x6d56c4={};_0x6d56c4[_0x78eec7]={'$like':'%'+_0x3506d6[_0x4275('0x39')][_0x4275('0xa1')]+'%'};return _0x6d56c4;})});}_0x13e326['where'][_0x4275('0x8c')]=![];if(_0x3506d6['query']['id']){_0x13e326[_0x4275('0x9f')]['id']={'$gt':_0x3506d6['query']['id']};}_0x13e326=_[_0x4275('0xa2')]({},_0x13e326,_0x3506d6[_0x4275('0xa8')]);return db[_0x4275('0x5e')][_0x4275('0x25')]({'where':_0x13e326[_0x4275('0x9f')]})[_0x4275('0x15')](function(_0x19615e){_0x20797b['count']=_0x19615e;_0x13e326['include']=[];if(_0x3506d6[_0x4275('0x39')][_0x4275('0xa9')]){_0x13e326[_0x4275('0x45')]['push']({'model':db[_0x4275('0x7d')],'as':'User','attributes':['id',_0x4275('0x51'),_0x4275('0x87')]});}if(_0x3506d6[_0x4275('0x39')][_0x4275('0x44')]){_0x13e326[_0x4275('0x45')]=[{'all':!![]}];}return db[_0x4275('0x5e')]['findAll'](_0x13e326);})['then'](function(_0x34fc3e){_0x20797b[_0x4275('0xa6')]=_0x34fc3e;return _0x20797b;});}})[_0x4275('0x15')](respondWithFilteredResult(_0x5a6b5a,_0x13e326))[_0x4275('0x3b')](handleError(_0x5a6b5a,null));};exports[_0x4275('0xaa')]=function(_0x5717c7,_0x12a1ad){return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x5717c7[_0x4275('0x3d')]['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x12a1ad,null))['then'](function(_0x8a9797){if(_0x8a9797){return _0x8a9797[_0x4275('0xab')](_0x5717c7[_0x4275('0x2e')][_0x4275('0x96')],_[_0x4275('0x97')](_0x5717c7['body'],[_0x4275('0x96'),'id'])||{})[_0x4275('0xac')](function(){return db[_0x4275('0xad')][_0x4275('0xa5')]({'attributes':['id','name',_0x4275('0xae')],'where':{'id':_0x5717c7[_0x4275('0x2e')][_0x4275('0x96')]}});})[_0x4275('0x15')](function(_0x24bfbc){socket[_0x4275('0xaf')](_0x4275('0xb0'),{'id':Number(_0x5717c7[_0x4275('0x3d')]['id']),'tags':_0x24bfbc||[]});return{'id':Number(_0x5717c7[_0x4275('0x3d')]['id']),'tags':_0x24bfbc||[]};});}})['then'](respondWithResult(_0x12a1ad,null))[_0x4275('0x3b')](handleError(_0x12a1ad,null));};exports[_0x4275('0xb1')]=function(_0x3f4c48,_0x5a8272){return db['ChatInteraction'][_0x4275('0x46')]({'where':{'id':_0x3f4c48[_0x4275('0x3d')]['id']}})[_0x4275('0x15')](handleEntityNotFound(_0x5a8272,null))[_0x4275('0x15')](function(_0x356ef4){if(_0x356ef4){return _0x356ef4[_0x4275('0xb1')](_0x3f4c48[_0x4275('0x39')][_0x4275('0x96')]);}})[_0x4275('0x15')](respondWithStatusCode(_0x5a8272,null))[_0x4275('0x3b')](handleError(_0x5a8272,null));};exports['download']=function(_0x2bbfa2,_0x19f3ed){var _0x3f5d86=moment()[_0x4275('0xb2')]()[_0x4275('0xb3')]();var _0x3e9e72=path[_0x4275('0x73')](config[_0x4275('0x72')],_0x4275('0xb4'),_0x4275('0xb5'),'tmp');var _0x3db431=path[_0x4275('0x73')](config[_0x4275('0x72')],_0x4275('0xb4'),_0x4275('0xb5'),_0x4275('0xb6'));var _0x1fc2ed=path[_0x4275('0x73')](_0x3e9e72,_0x3f5d86);var _0x24b0f6=util[_0x4275('0x78')](_0x4275('0xb7'),_0x2bbfa2[_0x4275('0x3d')]['id'],_0x3f5d86);var _0xee6fca=path[_0x4275('0x73')](_0x3e9e72,_0x24b0f6);var _0x1265f4=[];_0x1265f4[_0x4275('0xb8')]({'model':db[_0x4275('0x7d')],'as':'User','attributes':['id',_0x4275('0x51')],'raw':!![]});_0x1265f4[_0x4275('0xb8')]({'model':db[_0x4275('0x61')],'as':'Contact','attributes':['id',_0x4275('0xb9'),_0x4275('0xba')],'raw':!![]});if(_0x2bbfa2[_0x4275('0x39')][_0x4275('0xb6')]){_0x1265f4[_0x4275('0xb8')]({'model':db[_0x4275('0x6c')],'as':_0x4275('0x6c'),'raw':!![]});}var _0x5935f9=[{'model':db[_0x4275('0x5e')],'as':_0x4275('0x7c'),'attributes':['id',_0x4275('0x2e'),_0x4275('0x8a'),_0x4275('0x8b'),_0x4275('0x8c'),_0x4275('0xbb')],'include':_0x1265f4}];_0x5935f9[_0x4275('0xb8')]({'model':db['ChatWebsite'],'as':_0x4275('0xbc'),'attributes':['id',_0x4275('0x2b')]});_0x5935f9[_0x4275('0xb8')]({'model':db[_0x4275('0x7d')],'as':_0x4275('0xbd'),'attributes':['id',_0x4275('0x51')]});return db[_0x4275('0x33')][_0x4275('0x46')]({'where':{'id':_0x2bbfa2['params']['id']},'include':_0x5935f9})[_0x4275('0x15')](handleEntityNotFound(_0x19f3ed,null))[_0x4275('0x15')](function(_0x4c6be8){if(_0x4c6be8){var _0x584cb0=_0x4c6be8[_0x4275('0xbe')]({'plain':!![]});fs[_0x4275('0xbf')](_0x1fc2ed);var _0x5933f3={'channel':_0x4275('0xc0'),'account':_0x584cb0[_0x4275('0xbc')][_0x4275('0x2b')],'agent':_0x584cb0['Owner']?_0x584cb0[_0x4275('0xbd')][_0x4275('0x51')]:'N.A.','createdAt':moment(_0x584cb0[_0x4275('0x8a')])[_0x4275('0x78')](_0x4275('0xa4'))[_0x4275('0xb3')](),'closedAt':_0x584cb0['closed']?moment(_0x584cb0[_0x4275('0xc1')])[_0x4275('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4275('0xb3')]():'','disposition':_0x584cb0[_0x4275('0x66')],'chatInfo':{'browser':_0x584cb0[_0x4275('0xc2')],'os':_0x584cb0[_0x4275('0xc3')],'referer':_0x584cb0[_0x4275('0xc4')],'customerIp':_0x584cb0['customerIp'],'customerPort':_0x584cb0[_0x4275('0xc5')]?_0x584cb0[_0x4275('0xc5')]:'N.A.'},'messages':_(_0x584cb0[_0x4275('0x7c')])[_0x4275('0xc6')]()[_0x4275('0xa1')]({'secret':![]})['map'](function(_0x466737){if(_0x466737[_0x4275('0x6c')]){var _0x4dc5de=path[_0x4275('0x73')](_0x3db431,_0x466737[_0x4275('0x6c')][_0x4275('0x6a')]);if(fs[_0x4275('0xc7')](_0x4dc5de)){fs[_0x4275('0xc8')](_0x4dc5de)[_0x4275('0xc9')](fs[_0x4275('0xca')](path['join'](_0x1fc2ed,_0x466737[_0x4275('0x6c')][_0x4275('0x6a')])));}}return{'date':moment(_0x466737[_0x4275('0x8a')])['format'](_0x4275('0xa4'))[_0x4275('0xb3')](),'sender':_0x466737[_0x4275('0x8b')]===_0x4275('0xcb')?_0x466737['User']?_0x466737[_0x4275('0x7d')]['fullname']:_0x4275('0x80'):_0x466737[_0x4275('0xcc')][_0x4275('0xb9')]+(_0x466737[_0x4275('0xcc')][_0x4275('0xba')]?'\x20'+_0x466737[_0x4275('0xcc')][_0x4275('0xba')]:''),'body':_0x466737[_0x4275('0x6c')]?_0x466737[_0x4275('0x6c')]['basename']:_0x466737[_0x4275('0x2e')],'direction':_0x466737['direction']==='out'?'A':'C','secret':_0x466737[_0x4275('0x8c')],'read':_0x466737[_0x4275('0xbb')],'attachment':_0x466737[_0x4275('0x6c')]};})[_0x4275('0xcd')]()};return ejs['renderFile'](path[_0x4275('0x73')](config['root'],_0x4275('0xb4'),_0x4275('0xce'),_0x4275('0xcf')),{'interaction':_0x5933f3})[_0x4275('0x15')](function(_0x223d6e){var _0x5a82ef=path[_0x4275('0x73')](_0x1fc2ed,'transcript-'+_0x584cb0['id']+'-'+_0x3f5d86+_0x4275('0xd0'));var _0x588298={'path':_0x5a82ef,'channel':_0x4275('0xc0'),'interactionId':_0x584cb0['id']};return pdf[_0x4275('0xd1')](_0x223d6e,_0x588298);})[_0x4275('0x15')](function(){return new Promise(function(_0x3138b0,_0x1dca65){zipdir(_0x1fc2ed,{'saveTo':_0xee6fca},function(_0xa75109,_0x1b4f36){if(_0xa75109)return _0x1dca65(_0xa75109);return _0x3138b0(_0x1b4f36);});})[_0x4275('0x15')](function(){return new BPromise(function(_0x458f84,_0xbcb844){rimraf(_0x1fc2ed,function(_0x21c688){if(_0x21c688)_0xbcb844(_0x21c688);return _0x458f84();});});})[_0x4275('0x15')](function(){return _0x19f3ed[_0x4275('0x75')](_0xee6fca,_0x24b0f6,function(_0x3fe977){if(_0x3fe977){logger[_0x4275('0x1b')](_0x4275('0xd2'),_0x3fe977);}else{fs[_0x4275('0xd3')](_0xee6fca);}});});});}else{return _0x19f3ed['sendStatus'](0xc8);}})[_0x4275('0x3b')](handleError(_0x19f3ed,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d586d3a..7609123 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 _0xb686=['then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll'];(function(_0x597f7b,_0x511d3c){var _0x41ef72=function(_0x5657cf){while(--_0x5657cf){_0x597f7b['push'](_0x597f7b['shift']());}};_0x41ef72(++_0x511d3c);}(_0xb686,0xa8));var _0x6b68=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb686[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x6b68('0x0'));var ChatInteraction=require(_0x6b68('0x1'))['db'][_0x6b68('0x2')];var ChatMessage=require(_0x6b68('0x1'))['db'][_0x6b68('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6b68('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b68('0x5'),'afterDestroy':_0x6b68('0x6')};function emitEvent(_0x48ceda){return function(_0x213410,_0x37c231,_0x32282f){_0x213410[_0x6b68('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x36bf7f){_0x213410[_0x6b68('0x8')](_0x6b68('0x9'),_0x36bf7f[_0x6b68('0xa')](function(_0x295df5){return{'id':_0x295df5['id']};}));return ChatMessage[_0x6b68('0xb')]({'where':{'ChatInteractionId':_0x213410['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b68('0xc')](function(_0xa2336e){_0x213410[_0x6b68('0x8')](_0x6b68('0xd'),_0xa2336e['length']);ChatInteractionEvents[_0x6b68('0xe')](_0x48ceda+':'+_0x213410['id'],_0x213410);ChatInteractionEvents[_0x6b68('0xe')](_0x48ceda,_0x213410);_0x32282f(null);})[_0x6b68('0xf')](_0x32282f(null));};}for(var e in events){if(events[_0x6b68('0x10')](e)){var event=events[e];ChatInteraction[_0x6b68('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x6795=['ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x50d3c3,_0x4b2a29){var _0x47ac6e=function(_0x3df07a){while(--_0x3df07a){_0x50d3c3['push'](_0x50d3c3['shift']());}};_0x47ac6e(++_0x4b2a29);}(_0x6795,0x9f));var _0x5679=function(_0x513abe,_0x880145){_0x513abe=_0x513abe-0x0;var _0x595005=_0x6795[_0x513abe];return _0x595005;};'use strict';var EventEmitter=require(_0x5679('0x0'));var ChatInteraction=require(_0x5679('0x1'))['db'][_0x5679('0x2')];var ChatMessage=require(_0x5679('0x1'))['db'][_0x5679('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5679('0x4')](0x0);var events={'afterCreate':_0x5679('0x5'),'afterUpdate':_0x5679('0x6'),'afterDestroy':'remove'};function emitEvent(_0x29ab93){return function(_0x2fc03b,_0x30494f,_0x235897){_0x2fc03b[_0x5679('0x7')]({'attributes':['id'],'raw':!![]})[_0x5679('0x8')](function(_0x4c8dd2){_0x2fc03b[_0x5679('0x9')](_0x5679('0xa'),_0x4c8dd2['map'](function(_0x348184){return{'id':_0x348184['id']};}));return ChatMessage[_0x5679('0xb')]({'where':{'ChatInteractionId':_0x2fc03b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42a076){_0x2fc03b['setDataValue'](_0x5679('0xc'),_0x42a076['length']);ChatInteractionEvents[_0x5679('0xd')](_0x29ab93+':'+_0x2fc03b['id'],_0x2fc03b);ChatInteractionEvents[_0x5679('0xd')](_0x29ab93,_0x2fc03b);_0x235897(null);})[_0x5679('0xe')](_0x235897(null));};}for(var e in events){if(events[_0x5679('0xf')](e)){var event=events[e];ChatInteraction[_0x5679('0x10')](e,emitEvent(event));}}module[_0x5679('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 0d2a977..c553e1a 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 _0x15c9=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf'];(function(_0x43ddfc,_0x4c02bb){var _0x2f0b82=function(_0x1eb5ef){while(--_0x1eb5ef){_0x43ddfc['push'](_0x43ddfc['shift']());}};_0x2f0b82(++_0x4c02bb);}(_0x15c9,0xd2));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x915c('0x0'));var util=require(_0x915c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x915c('0x2'));var BPromise=require('bluebird');var rp=require(_0x915c('0x3'));var fs=require('fs');var path=require(_0x915c('0x4'));var rimraf=require(_0x915c('0x5'));var config=require(_0x915c('0x6'));var attributes=require(_0x915c('0x7'));module[_0x915c('0x8')]=function(_0x58658e,_0xdcf7d7){return _0x58658e['define'](_0x915c('0x9'),attributes,{'tableName':_0x915c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ff29a,_0x490ee9,_0x4d8ded){if(_0x2ff29a[_0x915c('0xb')](_0x915c('0xc'))){_0x2ff29a[_0x915c('0xd')]=moment()[_0x915c('0xe')](_0x915c('0xf'));}_0x4d8ded(null,_0x2ff29a);}},'charset':_0x915c('0x10'),'collate':_0x915c('0x11')});}; \ No newline at end of file +var _0x6596=['exports','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x3415a1,_0x5e5717){var _0x224228=function(_0x4134b2){while(--_0x4134b2){_0x3415a1['push'](_0x3415a1['shift']());}};_0x224228(++_0x5e5717);}(_0x6596,0x1ca));var _0x6659=function(_0x11d5f7,_0x41d281){_0x11d5f7=_0x11d5f7-0x0;var _0x47ab7c=_0x6596[_0x11d5f7];return _0x47ab7c;};'use strict';var _=require(_0x6659('0x0'));var util=require('util');var logger=require(_0x6659('0x1'))('api');var moment=require(_0x6659('0x2'));var BPromise=require('bluebird');var rp=require(_0x6659('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6659('0x4'));var config=require(_0x6659('0x5'));var attributes=require(_0x6659('0x6'));module[_0x6659('0x7')]=function(_0x39b238,_0x4e414e){return _0x39b238['define'](_0x6659('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56f064,_0x42cbb4,_0x5d1791){if(_0x56f064[_0x6659('0x9')]('closed')){_0x56f064[_0x6659('0xa')]=moment()[_0x6659('0xb')](_0x6659('0xc'));}_0x5d1791(null,_0x56f064);}},'charset':_0x6659('0xd'),'collate':_0x6659('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e164532..4e1b18e 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 _0xdb07=['request\x20sent','catch','UpdateChatInteraction','update','options','raw','where','attributes','debug','AddTagsToChatInteraction','find','addTags','body','omit','ids','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','stringify','error','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x36531f,_0x4ba624){var _0x2ee6b0=function(_0x45bad0){while(--_0x45bad0){_0x36531f['push'](_0x36531f['shift']());}};_0x2ee6b0(++_0x4ba624);}(_0xdb07,0x85));var _0x7db0=function(_0x35ebae,_0x4f86c4){_0x35ebae=_0x35ebae-0x0;var _0x1924cf=_0xdb07[_0x35ebae];return _0x1924cf;};'use strict';var _=require('lodash');var util=require(_0x7db0('0x0'));var moment=require(_0x7db0('0x1'));var BPromise=require(_0x7db0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7db0('0x3'));var db=require(_0x7db0('0x4'))['db'];var utils=require(_0x7db0('0x5'));var logger=require(_0x7db0('0x6'))(_0x7db0('0x7'));var config=require('../../config/environment');var jayson=require(_0x7db0('0x8'));var client=jayson[_0x7db0('0x9')][_0x7db0('0xa')]({'port':0x232a});config['redis']=_[_0x7db0('0xb')](config[_0x7db0('0xc')],{'host':_0x7db0('0xd'),'port':0x18eb});var socket=require(_0x7db0('0xe'))(new Redis(config[_0x7db0('0xc')]));require('./chatInteraction.socket')[_0x7db0('0xf')](socket);function respondWithRpcPromise(_0x40af10,_0x23fb5a,_0x7b2323){return new BPromise(function(_0x4f57ee,_0x2ff6d8){return client[_0x7db0('0x10')](_0x40af10,_0x7b2323)[_0x7db0('0x11')](function(_0x35a886){logger[_0x7db0('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x23fb5a,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x23fb5a,'request\x20sent',JSON[_0x7db0('0x13')](_0x35a886));if(_0x35a886[_0x7db0('0x14')]){if(_0x35a886[_0x7db0('0x14')]['code']===0x1f4){logger[_0x7db0('0x14')](_0x7db0('0x15'),_0x23fb5a,_0x35a886['error'][_0x7db0('0x16')]);return _0x2ff6d8(_0x35a886[_0x7db0('0x14')]['message']);}logger[_0x7db0('0x14')](_0x7db0('0x15'),_0x23fb5a,_0x35a886[_0x7db0('0x14')][_0x7db0('0x16')]);return _0x4f57ee(_0x35a886[_0x7db0('0x14')][_0x7db0('0x16')]);}else{logger[_0x7db0('0x12')](_0x7db0('0x15'),_0x23fb5a,_0x7db0('0x17'));_0x4f57ee(_0x35a886['result'][_0x7db0('0x16')]);}})[_0x7db0('0x18')](function(_0x4f0a38){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x23fb5a,_0x4f0a38);_0x2ff6d8(_0x4f0a38);});});}exports[_0x7db0('0x19')]=function(_0x443706){var _0x3dc3aa=this;return new Promise(function(_0x50be04,_0x1b4af1){return db['ChatInteraction'][_0x7db0('0x1a')](_0x443706['body'],{'raw':_0x443706[_0x7db0('0x1b')]?_0x443706[_0x7db0('0x1b')][_0x7db0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x443706[_0x7db0('0x1b')]?_0x443706[_0x7db0('0x1b')][_0x7db0('0x1d')]||null:null,'attributes':_0x443706[_0x7db0('0x1b')]?_0x443706[_0x7db0('0x1b')][_0x7db0('0x1e')]||null:null,'limit':_0x443706['options']?_0x443706[_0x7db0('0x1b')]['limit']||null:null})[_0x7db0('0x11')](function(_0x527a68){logger['info'](_0x7db0('0x19'),_0x443706);logger[_0x7db0('0x1f')](_0x7db0('0x19'),_0x443706,JSON[_0x7db0('0x13')](_0x527a68));_0x50be04(_0x527a68);})['catch'](function(_0x228ef7){logger['error'](_0x7db0('0x19'),_0x228ef7[_0x7db0('0x16')],_0x443706);_0x1b4af1(_0x3dc3aa[_0x7db0('0x14')](0x1f4,_0x228ef7[_0x7db0('0x16')]));});});};exports[_0x7db0('0x20')]=function(_0x43bc94){return new Promise(function(_0x5a7e20,_0x15aa40){return db['ChatInteraction'][_0x7db0('0x21')]({'where':_0x43bc94[_0x7db0('0x1b')]?_0x43bc94['options'][_0x7db0('0x1d')]||null:null})[_0x7db0('0x11')](function(_0x1b8e9e){if(_0x1b8e9e){return _0x1b8e9e[_0x7db0('0x22')](_0x43bc94[_0x7db0('0x23')]['ids'],_[_0x7db0('0x24')](_0x43bc94[_0x7db0('0x23')],[_0x7db0('0x25'),'id'])||{});}})['spread'](function(_0x42c70a){logger['info']('AddTags',_0x43bc94);logger[_0x7db0('0x1f')](_0x7db0('0x26'),_0x43bc94,JSON['stringify'](_0x42c70a));_0x5a7e20(_0x42c70a);})['catch'](function(_0x3f0237){logger['error'](_0x7db0('0x26'),_0x3f0237[_0x7db0('0x16')],_0x43bc94);_0x15aa40(_this[_0x7db0('0x14')](0x1f4,_0x3f0237['message']));});});}; \ No newline at end of file +var _0x4546=['options','raw','where','debug','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','UpdateChatInteraction','update','body'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x4546,0xab));var _0x6454=function(_0x50b6cc,_0x4dfee5){_0x50b6cc=_0x50b6cc-0x0;var _0x93119c=_0x4546[_0x50b6cc];return _0x93119c;};'use strict';var _=require(_0x6454('0x0'));var util=require(_0x6454('0x1'));var moment=require(_0x6454('0x2'));var BPromise=require(_0x6454('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6454('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6454('0x5'))(_0x6454('0x6'));var config=require(_0x6454('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6454('0x8')]['http']({'port':0x232a});config[_0x6454('0x9')]=_[_0x6454('0xa')](config[_0x6454('0x9')],{'host':_0x6454('0xb'),'port':0x18eb});var socket=require(_0x6454('0xc'))(new Redis(config[_0x6454('0x9')]));require(_0x6454('0xd'))[_0x6454('0xe')](socket);function respondWithRpcPromise(_0x4d8e6d,_0x48278f,_0x3630cb){return new BPromise(function(_0x13ef93,_0x566d2f){return client[_0x6454('0xf')](_0x4d8e6d,_0x3630cb)[_0x6454('0x10')](function(_0x1e7230){logger[_0x6454('0x11')](_0x6454('0x12'),_0x48278f,'request\x20sent');logger['debug'](_0x6454('0x13'),_0x48278f,'request\x20sent',JSON[_0x6454('0x14')](_0x1e7230));if(_0x1e7230['error']){if(_0x1e7230['error'][_0x6454('0x15')]===0x1f4){logger[_0x6454('0x16')](_0x6454('0x12'),_0x48278f,_0x1e7230[_0x6454('0x16')][_0x6454('0x17')]);return _0x566d2f(_0x1e7230[_0x6454('0x16')]['message']);}logger[_0x6454('0x16')](_0x6454('0x12'),_0x48278f,_0x1e7230[_0x6454('0x16')][_0x6454('0x17')]);return _0x13ef93(_0x1e7230[_0x6454('0x16')][_0x6454('0x17')]);}else{logger['info'](_0x6454('0x12'),_0x48278f,_0x6454('0x18'));_0x13ef93(_0x1e7230['result'][_0x6454('0x17')]);}})[_0x6454('0x19')](function(_0x48972b){logger[_0x6454('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x48278f,_0x48972b);_0x566d2f(_0x48972b);});});}exports[_0x6454('0x1a')]=function(_0x587636){var _0x3bc737=this;return new Promise(function(_0x5b1574,_0x29b7ee){return db['ChatInteraction'][_0x6454('0x1b')](_0x587636[_0x6454('0x1c')],{'raw':_0x587636['options']?_0x587636[_0x6454('0x1d')][_0x6454('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587636['options']?_0x587636[_0x6454('0x1d')][_0x6454('0x1f')]||null:null,'attributes':_0x587636[_0x6454('0x1d')]?_0x587636[_0x6454('0x1d')]['attributes']||null:null,'limit':_0x587636[_0x6454('0x1d')]?_0x587636[_0x6454('0x1d')]['limit']||null:null})[_0x6454('0x10')](function(_0xeda3aa){logger[_0x6454('0x11')]('UpdateChatInteraction',_0x587636);logger[_0x6454('0x20')](_0x6454('0x1a'),_0x587636,JSON['stringify'](_0xeda3aa));_0x5b1574(_0xeda3aa);})['catch'](function(_0x36fc74){logger[_0x6454('0x16')](_0x6454('0x1a'),_0x36fc74['message'],_0x587636);_0x29b7ee(_0x3bc737[_0x6454('0x16')](0x1f4,_0x36fc74[_0x6454('0x17')]));});});};exports[_0x6454('0x21')]=function(_0x26518f){return new Promise(function(_0x30341a,_0x62047a){return db['ChatInteraction'][_0x6454('0x22')]({'where':_0x26518f[_0x6454('0x1d')]?_0x26518f[_0x6454('0x1d')][_0x6454('0x1f')]||null:null})['then'](function(_0x57b197){if(_0x57b197){return _0x57b197[_0x6454('0x23')](_0x26518f[_0x6454('0x1c')][_0x6454('0x24')],_[_0x6454('0x25')](_0x26518f[_0x6454('0x1c')],[_0x6454('0x24'),'id'])||{});}})[_0x6454('0x26')](function(_0x3764e0){logger[_0x6454('0x11')](_0x6454('0x27'),_0x26518f);logger['debug'](_0x6454('0x27'),_0x26518f,JSON['stringify'](_0x3764e0));_0x30341a(_0x3764e0);})[_0x6454('0x19')](function(_0x3be06c){logger['error'](_0x6454('0x27'),_0x3be06c[_0x6454('0x17')],_0x26518f);_0x62047a(_this[_0x6454('0x16')](0x1f4,_0x3be06c[_0x6454('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2f5216f..53c9d18 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 _0xb079=['register','save','remove','update','emit','removeListener'];(function(_0x1a0404,_0x364e3d){var _0x243c1b=function(_0x102e16){while(--_0x102e16){_0x1a0404['push'](_0x1a0404['shift']());}};_0x243c1b(++_0x364e3d);}(_0xb079,0x1c9));var _0x9b07=function(_0x26f5e8,_0x41e832){_0x26f5e8=_0x26f5e8-0x0;var _0x3acdfd=_0xb079[_0x26f5e8];return _0x3acdfd;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9b07('0x0'),_0x9b07('0x1'),_0x9b07('0x2')];function createListener(_0x158a14,_0x22f945){return function(_0x3c199c){_0x22f945[_0x9b07('0x3')](_0x158a14,_0x3c199c);};}function removeListener(_0x14a884,_0x3bf703){return function(){ChatInteractionEvents[_0x9b07('0x4')](_0x14a884,_0x3bf703);};}exports[_0x9b07('0x5')]=function(_0x4a6f57){for(var _0x1ebf90=0x0,_0x2be1ef=events['length'];_0x1ebf90<_0x2be1ef;_0x1ebf90++){var _0x17a4bc=events[_0x1ebf90];var _0x5a0395=createListener('chatInteraction:'+_0x17a4bc,_0x4a6f57);ChatInteractionEvents['on'](_0x17a4bc,_0x5a0395);}}; \ No newline at end of file +var _0x0fc2=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x85e1ae,_0xd1bfba){var _0x3be149=function(_0x16b94d){while(--_0x16b94d){_0x85e1ae['push'](_0x85e1ae['shift']());}};_0x3be149(++_0xd1bfba);}(_0x0fc2,0x6e));var _0x20fc=function(_0x43d690,_0x232548){_0x43d690=_0x43d690-0x0;var _0x10d5a6=_0x0fc2[_0x43d690];return _0x10d5a6;};'use strict';var ChatInteractionEvents=require(_0x20fc('0x0'));var events=[_0x20fc('0x1'),_0x20fc('0x2'),_0x20fc('0x3')];function createListener(_0x51d2ab,_0x46b3ae){return function(_0xba56f5){_0x46b3ae[_0x20fc('0x4')](_0x51d2ab,_0xba56f5);};}function removeListener(_0x2b95b8,_0x14a9af){return function(){ChatInteractionEvents[_0x20fc('0x5')](_0x2b95b8,_0x14a9af);};}exports[_0x20fc('0x6')]=function(_0x13f2d5){for(var _0x10f6ad=0x0,_0xc556e8=events[_0x20fc('0x7')];_0x10f6ad<_0xc556e8;_0x10f6ad++){var _0x470d1a=events[_0x10f6ad];var _0x24b617=createListener(_0x20fc('0x8')+_0x470d1a,_0x13f2d5);ChatInteractionEvents['on'](_0x470d1a,_0x24b617);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 801e632..bd53830 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 _0xf839=['root','server/files/attachments/','format','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','join'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf839,0x1da));var _0x9f83=function(_0x331152,_0x25c1a8){_0x331152=_0x331152-0x0;var _0x2da184=_0xf839[_0x331152];return _0x2da184;};'use strict';var multer=require(_0x9f83('0x0'));var util=require('util');var path=require(_0x9f83('0x1'));var timeout=require(_0x9f83('0x2'));var express=require(_0x9f83('0x3'));var router=express[_0x9f83('0x4')]();var fs_extra=require(_0x9f83('0x5'));var auth=require(_0x9f83('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f83('0x7'));var controller=require(_0x9f83('0x8'));router[_0x9f83('0x9')]('/',auth[_0x9f83('0xa')](),controller[_0x9f83('0xb')]);router[_0x9f83('0x9')](_0x9f83('0xc'),auth['isAuthenticated'](),controller[_0x9f83('0xd')]);router[_0x9f83('0x9')](_0x9f83('0xe'),auth[_0x9f83('0xf')](),controller['show']);router['get'](_0x9f83('0x10'),auth[_0x9f83('0xf')](),controller[_0x9f83('0x11')]);router[_0x9f83('0x9')](_0x9f83('0x12'),auth['isAuthenticated'](),controller[_0x9f83('0x13')]);router['get'](_0x9f83('0x14'),auth[_0x9f83('0xf')](),controller[_0x9f83('0x15')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x9f83('0x16')]);router[_0x9f83('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f83('0x17')](_0x9f83('0x18'),auth[_0x9f83('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53a4b5,_0x488b11,_0x4ac108){_0x4ac108(null,path[_0x9f83('0x19')](config[_0x9f83('0x1a')],_0x9f83('0x1b')));},'filename':function(_0x22cb30,_0x134adb,_0xb4f4cc){_0xb4f4cc(null,util[_0x9f83('0x1c')]('%s-%s',Date['now'](),_0x134adb['originalname'][_0x9f83('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9f83('0x17')](_0x9f83('0x1e'),upload[_0x9f83('0x1f')](_0x9f83('0x20')),controller['attachmentUpload']);router[_0x9f83('0x17')](_0x9f83('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x9f83('0x21')]);router['post'](_0x9f83('0x22'),auth['isAuthenticated'](),interaction[_0x9f83('0x23')](_0x9f83('0x24'),_0x9f83('0x25')),controller[_0x9f83('0x26')]);router[_0x9f83('0x27')](_0x9f83('0xe'),auth[_0x9f83('0xa')](),interaction[_0x9f83('0x23')](_0x9f83('0x24'),_0x9f83('0x28')),controller[_0x9f83('0x29')]);router[_0x9f83('0x27')](_0x9f83('0x2a'),controller[_0x9f83('0x2b')]);router[_0x9f83('0x27')]('/:id/abandon',auth[_0x9f83('0xf')](),controller[_0x9f83('0x2c')]);router[_0x9f83('0x27')](_0x9f83('0x2d'),controller[_0x9f83('0x2e')]);router[_0x9f83('0x2f')](_0x9f83('0xe'),auth[_0x9f83('0xa')](),interaction['tracked'](_0x9f83('0x24'),_0x9f83('0x30')),controller['destroy']);router[_0x9f83('0x2f')](_0x9f83('0x22'),auth[_0x9f83('0xa')](),controller[_0x9f83('0x31')]);module['exports']=router; \ No newline at end of file +var _0x303b=['tracked','chatinteraction:destroy','destroy','removeTags','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','/:id/tags','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','put','/:id/close','close','delete'];(function(_0x5e5c64,_0x19b9fb){var _0x1bf287=function(_0x19fb98){while(--_0x19fb98){_0x5e5c64['push'](_0x5e5c64['shift']());}};_0x1bf287(++_0x19b9fb);}(_0x303b,0xd5));var _0xb303=function(_0x5da87f,_0x3e0249){_0x5da87f=_0x5da87f-0x0;var _0x1be0cf=_0x303b[_0x5da87f];return _0x1be0cf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb303('0x0'));var express=require(_0xb303('0x1'));var router=express[_0xb303('0x2')]();var fs_extra=require(_0xb303('0x3'));var auth=require(_0xb303('0x4'));var interaction=require(_0xb303('0x5'));var config=require(_0xb303('0x6'));var controller=require(_0xb303('0x7'));router['get']('/',auth[_0xb303('0x8')](),controller[_0xb303('0x9')]);router['get'](_0xb303('0xa'),auth[_0xb303('0x8')](),controller[_0xb303('0xb')]);router[_0xb303('0xc')](_0xb303('0xd'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xb303('0xc')](_0xb303('0xe'),auth[_0xb303('0xf')](),controller[_0xb303('0x10')]);router[_0xb303('0xc')](_0xb303('0x11'),auth[_0xb303('0x8')](),controller[_0xb303('0x12')]);router[_0xb303('0xc')]('/:id/my_messages',auth[_0xb303('0xf')](),controller[_0xb303('0x13')]);router[_0xb303('0xc')](_0xb303('0x14'),auth['isAuthenticated'](),controller['download']);router[_0xb303('0x15')]('/',auth[_0xb303('0x8')](),controller[_0xb303('0x16')]);router[_0xb303('0x15')](_0xb303('0x17'),auth[_0xb303('0x8')](),controller[_0xb303('0x18')]);var upload=multer({'storage':multer[_0xb303('0x19')]({'destination':function(_0x1910eb,_0x30bfe4,_0x2859aa){_0x2859aa(null,path['join'](config[_0xb303('0x1a')],_0xb303('0x1b')));},'filename':function(_0x277f70,_0xf11a6f,_0x19f7d2){_0x19f7d2(null,util[_0xb303('0x1c')](_0xb303('0x1d'),Date[_0xb303('0x1e')](),_0xf11a6f['originalname'][_0xb303('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xb303('0x20'),upload['single'](_0xb303('0x21')),controller[_0xb303('0x22')]);router[_0xb303('0x15')](_0xb303('0x11'),auth[_0xb303('0xf')](),controller['addMessage']);router[_0xb303('0x15')](_0xb303('0x23'),auth['isAuthenticated'](),interaction['tracked'](_0xb303('0x24'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0xb303('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xb303('0x24'),_0xb303('0x25')),controller[_0xb303('0x26')]);router['put'](_0xb303('0x27'),controller[_0xb303('0x28')]);router['put'](_0xb303('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xb303('0x2a')]);router[_0xb303('0x2b')](_0xb303('0x2c'),controller[_0xb303('0x2d')]);router[_0xb303('0x2e')](_0xb303('0xd'),auth[_0xb303('0x8')](),interaction[_0xb303('0x2f')](_0xb303('0x24'),_0xb303('0x30')),controller[_0xb303('0x31')]);router[_0xb303('0x2e')](_0xb303('0x23'),auth['isAuthenticated'](),controller[_0xb303('0x32')]);module[_0xb303('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a8d45d5..57f4346 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 _0x67d3=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x67d3,0x1a9));var _0x367d=function(_0x18d479,_0x5ee508){_0x18d479=_0x18d479-0x0;var _0x2cf821=_0x67d3[_0x18d479];return _0x2cf821;};'use strict';var Sequelize=require(_0x367d('0x0'));module[_0x367d('0x1')]={'body':{'type':Sequelize[_0x367d('0x2')](_0x367d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x367d('0x4')]}}; \ No newline at end of file +var _0xd904=['medium','INTEGER','sequelize'];(function(_0x345524,_0x28de07){var _0x476dba=function(_0x149408){while(--_0x149408){_0x345524['push'](_0x345524['shift']());}};_0x476dba(++_0x28de07);}(_0xd904,0x1bb));var _0x4d90=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xd904[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x4d90('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4d90('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4d90('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c393ded..f70f5d2 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 _0x8698=['map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','admin','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','user','get','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','end','error','name','status','send'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x8698,0xa9));var _0x8869=function(_0x220fd2,_0x3acd91){_0x220fd2=_0x220fd2-0x0;var _0x1e4faf=_0x8698[_0x220fd2];return _0x1e4faf;};'use strict';var emlformat=require(_0x8869('0x0'));var rimraf=require(_0x8869('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8869('0x2'));var rp=require(_0x8869('0x3'));var moment=require('moment');var BPromise=require(_0x8869('0x4'));var Mustache=require(_0x8869('0x5'));var util=require(_0x8869('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8869('0x7'));var ejs=require(_0x8869('0x8'));var fs=require('fs');var fs_extra=require(_0x8869('0x9'));var _=require(_0x8869('0xa'));var squel=require(_0x8869('0xb'));var crypto=require(_0x8869('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8869('0xd'));var toCsv=require(_0x8869('0x7'));var querystring=require(_0x8869('0xe'));var Papa=require(_0x8869('0xf'));var Redis=require('ioredis');var authService=require(_0x8869('0x10'));var qs=require(_0x8869('0x11'));var as=require(_0x8869('0x12'));var hardwareService=require(_0x8869('0x13'));var logger=require(_0x8869('0x14'))('api');var utils=require(_0x8869('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8869('0x16'));var db=require('../../mysqldb')['db'];config[_0x8869('0x17')]=_[_0x8869('0x18')](config[_0x8869('0x17')],{'host':_0x8869('0x19'),'port':0x18eb});var socket=require(_0x8869('0x1a'))(new Redis(config[_0x8869('0x17')]));require(_0x8869('0x1b'))[_0x8869('0x1c')](socket);function respondWithStatusCode(_0x1ecc54,_0x45414a){_0x45414a=_0x45414a||0xcc;return function(_0x32cfcc){if(_0x32cfcc){return _0x1ecc54[_0x8869('0x1d')](_0x45414a);}return _0x1ecc54['status'](_0x45414a)['end']();};}function respondWithResult(_0x514e27,_0x161c24){_0x161c24=_0x161c24||0xc8;return function(_0x5a74fd){if(_0x5a74fd){return _0x514e27['status'](_0x161c24)['json'](_0x5a74fd);}};}function respondWithFilteredResult(_0x6393f5,_0x483af8){return function(_0x580a6b){if(_0x580a6b){var _0x3eb117=typeof _0x483af8['offset']===_0x8869('0x1e')&&typeof _0x483af8[_0x8869('0x1f')]===_0x8869('0x1e');var _0x4d1079=_0x580a6b[_0x8869('0x20')];var _0x233c15=_0x3eb117?0x0:_0x483af8[_0x8869('0x21')];var _0x343f22=_0x3eb117?_0x580a6b[_0x8869('0x20')]:_0x483af8[_0x8869('0x21')]+_0x483af8['limit'];var _0x519c47;if(_0x343f22>=_0x4d1079){_0x343f22=_0x4d1079;_0x519c47=0xc8;}else{_0x519c47=0xce;}_0x6393f5['status'](_0x519c47);return _0x6393f5[_0x8869('0x22')](_0x8869('0x23'),_0x233c15+'-'+_0x343f22+'/'+_0x4d1079)[_0x8869('0x24')](_0x580a6b);}return null;};}function patchUpdates(_0x582e2e){return function(_0x3f53a3){try{jsonpatch['apply'](_0x3f53a3,_0x582e2e,!![]);}catch(_0x3b009f){return BPromise[_0x8869('0x25')](_0x3b009f);}return _0x3f53a3['save']();};}function saveUpdates(_0x3aa6a8,_0x51c422){return function(_0x47d32a){if(_0x47d32a){return _0x47d32a[_0x8869('0x26')](_0x3aa6a8)[_0x8869('0x27')](function(_0x526094){return _0x526094;});}return null;};}function removeEntity(_0x15d577,_0x3382d1){return function(_0xe640b9){if(_0xe640b9){return _0xe640b9['destroy']()[_0x8869('0x27')](function(){_0x15d577['status'](0xcc)[_0x8869('0x28')]();});}};}function handleEntityNotFound(_0x3d63ef,_0xe5cbc4){return function(_0x1d8d9a){if(!_0x1d8d9a){_0x3d63ef[_0x8869('0x1d')](0x194);}return _0x1d8d9a;};}function handleError(_0x5b62b0,_0x1dec1b){_0x1dec1b=_0x1dec1b||0x1f4;return function(_0x4d6488){logger[_0x8869('0x29')](_0x4d6488['stack']);if(_0x4d6488[_0x8869('0x2a')]){delete _0x4d6488[_0x8869('0x2a')];}_0x5b62b0[_0x8869('0x2b')](_0x1dec1b)[_0x8869('0x2c')](_0x4d6488);};}exports['index']=function(_0x13df95,_0x5efa97){var _0x36ca21={},_0x53d2e4={},_0x2596b6={'count':0x0,'rows':[]};var _0x51ea45=_[_0x8869('0x2d')](db[_0x8869('0x2e')][_0x8869('0x2f')],function(_0x247912){return{'name':_0x247912['fieldName'],'type':_0x247912[_0x8869('0x30')][_0x8869('0x31')]};});_0x53d2e4[_0x8869('0x32')]=_[_0x8869('0x2d')](_0x51ea45,'name');_0x53d2e4[_0x8869('0x33')]=_[_0x8869('0x34')](_0x13df95[_0x8869('0x33')]);_0x53d2e4[_0x8869('0x35')]=_[_0x8869('0x36')](_0x53d2e4['model'],_0x53d2e4[_0x8869('0x33')]);_0x36ca21[_0x8869('0x37')]=_[_0x8869('0x36')](_0x53d2e4[_0x8869('0x32')],qs[_0x8869('0x38')](_0x13df95['query'][_0x8869('0x38')]));_0x36ca21['attributes']=_0x36ca21[_0x8869('0x37')][_0x8869('0x39')]?_0x36ca21['attributes']:_0x53d2e4[_0x8869('0x32')];if(!_0x13df95[_0x8869('0x33')][_0x8869('0x3a')](_0x8869('0x3b'))){_0x36ca21[_0x8869('0x1f')]=qs[_0x8869('0x1f')](_0x13df95['query'][_0x8869('0x1f')]);_0x36ca21[_0x8869('0x21')]=qs[_0x8869('0x21')](_0x13df95[_0x8869('0x33')][_0x8869('0x21')]);}_0x36ca21[_0x8869('0x3c')]=qs['sort'](_0x13df95[_0x8869('0x33')][_0x8869('0x3d')]);_0x36ca21[_0x8869('0x3e')]=qs['filters'](_[_0x8869('0x3f')](_0x13df95[_0x8869('0x33')],_0x53d2e4[_0x8869('0x35')]),_0x51ea45);if(_0x13df95[_0x8869('0x33')][_0x8869('0x40')]){_0x36ca21[_0x8869('0x3e')]=_[_0x8869('0x41')](_0x36ca21[_0x8869('0x3e')],{'$or':_[_0x8869('0x2d')](_0x51ea45,function(_0x29c118){if(_0x29c118[_0x8869('0x30')]!=='VIRTUAL'){var _0x30dc8f={};_0x30dc8f[_0x29c118[_0x8869('0x2a')]]={'$like':'%'+_0x13df95[_0x8869('0x33')][_0x8869('0x40')]+'%'};return _0x30dc8f;}})});}_0x36ca21=_[_0x8869('0x41')]({},_0x36ca21,_0x13df95[_0x8869('0x42')]);var _0x40b824={'where':_0x36ca21[_0x8869('0x3e')]};return db['ChatInternalMessage'][_0x8869('0x20')](_0x40b824)[_0x8869('0x27')](function(_0x39367d){_0x2596b6[_0x8869('0x20')]=_0x39367d;if(_0x13df95[_0x8869('0x33')][_0x8869('0x43')]){_0x36ca21[_0x8869('0x44')]=[{'all':!![]}];}return db[_0x8869('0x2e')][_0x8869('0x45')](_0x36ca21);})['then'](function(_0x33a6f8){_0x2596b6[_0x8869('0x46')]=_0x33a6f8;return _0x2596b6;})[_0x8869('0x27')](respondWithFilteredResult(_0x5efa97,_0x36ca21))[_0x8869('0x47')](handleError(_0x5efa97,null));};exports[_0x8869('0x48')]=function(_0x4708cf,_0x111541){var _0x14a87d={'raw':!![],'where':{'id':_0x4708cf[_0x8869('0x49')]['id']}},_0x153d30={};_0x153d30[_0x8869('0x32')]=_['keys'](db[_0x8869('0x2e')][_0x8869('0x2f')]);_0x153d30[_0x8869('0x33')]=_[_0x8869('0x34')](_0x4708cf[_0x8869('0x33')]);_0x153d30['filters']=_[_0x8869('0x36')](_0x153d30[_0x8869('0x32')],_0x153d30[_0x8869('0x33')]);_0x14a87d[_0x8869('0x37')]=_[_0x8869('0x36')](_0x153d30['model'],qs[_0x8869('0x38')](_0x4708cf[_0x8869('0x33')][_0x8869('0x38')]));_0x14a87d[_0x8869('0x37')]=_0x14a87d['attributes'][_0x8869('0x39')]?_0x14a87d[_0x8869('0x37')]:_0x153d30['model'];if(_0x4708cf[_0x8869('0x33')][_0x8869('0x43')]){_0x14a87d[_0x8869('0x44')]=[{'all':!![]}];}_0x14a87d=_['merge']({},_0x14a87d,_0x4708cf[_0x8869('0x42')]);return db[_0x8869('0x2e')][_0x8869('0x4a')](_0x14a87d)[_0x8869('0x27')](handleEntityNotFound(_0x111541,null))[_0x8869('0x27')](respondWithResult(_0x111541,null))['catch'](handleError(_0x111541,null));};exports[_0x8869('0x4b')]=function(_0x54d3ba,_0xeb3b8c){return db[_0x8869('0x2e')][_0x8869('0x4b')](_0x54d3ba[_0x8869('0x4c')],{})['then'](respondWithResult(_0xeb3b8c,0xc9))[_0x8869('0x47')](handleError(_0xeb3b8c,null));};exports[_0x8869('0x26')]=function(_0x5d1788,_0x749edb){if(_0x5d1788[_0x8869('0x4c')]['id']){delete _0x5d1788[_0x8869('0x4c')]['id'];}return db[_0x8869('0x2e')][_0x8869('0x4a')]({'where':{'id':_0x5d1788[_0x8869('0x49')]['id']}})[_0x8869('0x27')](handleEntityNotFound(_0x749edb,null))[_0x8869('0x27')](saveUpdates(_0x5d1788['body'],null))[_0x8869('0x27')](respondWithResult(_0x749edb,null))[_0x8869('0x47')](handleError(_0x749edb,null));};exports[_0x8869('0x4d')]=function(_0xfe070a,_0x414e5b){return db[_0x8869('0x2e')][_0x8869('0x4a')]({'where':{'id':_0xfe070a[_0x8869('0x49')]['id']}})[_0x8869('0x27')](handleEntityNotFound(_0x414e5b,null))[_0x8869('0x27')](removeEntity(_0x414e5b,null))[_0x8869('0x47')](handleError(_0x414e5b,null));};exports[_0x8869('0x4e')]=function(_0x140526,_0x53f3e4){return db[_0x8869('0x2e')][_0x8869('0x4e')]()['then'](respondWithResult(_0x53f3e4,null))['catch'](handleError(_0x53f3e4,null));};function wrapUser(_0x237f8f){return function(_0x45b065){var _0x2316b0=_0x237f8f['get']({'plain':!![]});_0x2316b0[_0x8869('0x4f')]=[];if(_0x45b065){_0x2316b0[_0x8869('0x50')]=_0x45b065[_0x8869('0x51')];_0x2316b0[_0x8869('0x52')]=_0x45b065;}else{_0x2316b0[_0x8869('0x50')]=moment(0x0)[_0x8869('0x53')](_0x8869('0x54'));_0x2316b0['lastMessage']={};}return _0x2316b0;};}exports['getUsers']=function(_0x3934c7,_0x15b48d,_0x47da51){var _0x1335ce=[];return db['User'][_0x8869('0x45')]({'where':{'role':['agent',_0x8869('0x55'),'user']},'attributes':['id','fullname',_0x8869('0x2a'),'role',_0x8869('0x56'),_0x8869('0x57'),_0x8869('0x58'),_0x8869('0x59'),_0x8869('0x5a'),_0x8869('0x5b')],'order':qs[_0x8869('0x3d')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x8869('0x5c'),'attributes':['id',_0x8869('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x8869('0x27')](function(_0x2e6947){if(_0x2e6947){var _0x261117=_0x3934c7[_0x8869('0x5d')][_0x8869('0x5e')]({'plain':!![]});if(!_0x261117)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x261117[_0x8869('0x5f')]===_0x8869('0x5d')){return db[_0x8869('0x60')][_0x8869('0x4a')]({'where':{'name':_0x8869('0x61'),'userProfileId':_0x261117['userProfileId']},'raw':!![]})['then'](function(_0x35ba9f){if(_0x35ba9f){if(_0x35ba9f[_0x8869('0x62')]===0x0){return db[_0x8869('0x63')][_0x8869('0x45')]({'where':{'sectionId':_0x35ba9f['id']},'raw':!![]})[_0x8869('0x27')](function(_0x3e7b50){var _0xcde4a7=[];if(_[_0x8869('0x64')](_0x3e7b50)){_0xcde4a7=_[_0x8869('0x40')](_0x2e6947,function(_0x3d4884){if(_0x3d4884['role']!==_0x8869('0x65')){return _0x3d4884;}});return _0xcde4a7;}else{for(var _0x151c73=0x0;_0x151c73<_0x2e6947[_0x8869('0x39')];_0x151c73++){var _0x3fb6df=_0x2e6947[_0x151c73];if(_0x3fb6df[_0x8869('0x5f')]===_0x8869('0x65')){var _0xf57140=_[_0x8869('0x4a')](_0x3e7b50,function(_0x350815){return _0x350815[_0x8869('0x66')]===_0x3fb6df['id'];});if(_0xf57140)_0xcde4a7[_0x8869('0x67')](_0x3fb6df);}else{_0xcde4a7[_0x8869('0x67')](_0x3fb6df);}}return _0xcde4a7;}});}else{return _0x2e6947;}}else{var _0x4ddeb7=_[_0x8869('0x40')](_0x2e6947,function(_0x3a6842){if(_0x3a6842[_0x8869('0x5f')]!==_0x8869('0x65')){return _0x3a6842;}});return _0x4ddeb7;}});}else{return _0x2e6947;}}})[_0x8869('0x27')](function(_0x4425b7){var _0xac1b46=[];if(_0x4425b7){_0x1335ce=_0x4425b7;for(var _0x31e65c=0x0;_0x31e65c<_0x4425b7[_0x8869('0x39')];_0x31e65c+=0x1){_0x1335ce[_0x31e65c][_0x8869('0x4f')]=[];_0xac1b46[_0x8869('0x67')](db['ChatInternalMessage'][_0x8869('0x4a')]({'where':{'FromId':[_0x3934c7[_0x8869('0x5d')]['id'],_0x4425b7[_0x31e65c]['id']],'ToId':[_0x3934c7['user']['id'],_0x4425b7[_0x31e65c]['id']],'ChatGroupId':null},'attributes':['id',_0x8869('0x51'),'FromId',_0x8869('0x68'),_0x8869('0x69'),'body'],'order':qs[_0x8869('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8869('0x27')](wrapUser(_0x4425b7[_0x31e65c])));}return BPromise[_0x8869('0x6a')](_0xac1b46);}return[];})['then'](function(_0x25cbf3){return{'rows':_0x25cbf3,'count':_0x25cbf3[_0x8869('0x39')]};})[_0x8869('0x27')](respondWithResult(_0x15b48d,null))['catch'](handleError(_0x15b48d,null));}; \ No newline at end of file +var _0x89cf=['userpic','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','agent','resourceId','push','messages','createdAt','FromId','-createdAt','all','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','ChatInternalMessage','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','lastMessage','lastMessageAt','admin','user','fullname','role'];(function(_0x25abbe,_0x53b462){var _0x55c770=function(_0x164dbf){while(--_0x164dbf){_0x25abbe['push'](_0x25abbe['shift']());}};_0x55c770(++_0x53b462);}(_0x89cf,0x7b));var _0xf89c=function(_0x1f6b53,_0xfff811){_0x1f6b53=_0x1f6b53-0x0;var _0x248627=_0x89cf[_0x1f6b53];return _0x248627;};'use strict';var emlformat=require(_0xf89c('0x0'));var rimraf=require(_0xf89c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf89c('0x2'));var rp=require('request-promise');var moment=require(_0xf89c('0x3'));var BPromise=require(_0xf89c('0x4'));var Mustache=require('mustache');var util=require(_0xf89c('0x5'));var path=require(_0xf89c('0x6'));var sox=require('sox');var csv=require(_0xf89c('0x7'));var ejs=require(_0xf89c('0x8'));var fs=require('fs');var fs_extra=require(_0xf89c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf89c('0xa'));var deskjs=require(_0xf89c('0xb'));var toCsv=require(_0xf89c('0x7'));var querystring=require(_0xf89c('0xc'));var Papa=require(_0xf89c('0xd'));var Redis=require(_0xf89c('0xe'));var authService=require(_0xf89c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf89c('0x10'));var logger=require(_0xf89c('0x11'))(_0xf89c('0x12'));var utils=require(_0xf89c('0x13'));var config=require(_0xf89c('0x14'));var licenseUtil=require(_0xf89c('0x15'));var db=require(_0xf89c('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf89c('0x17'),'port':0x18eb});var socket=require(_0xf89c('0x18'))(new Redis(config[_0xf89c('0x19')]));require(_0xf89c('0x1a'))[_0xf89c('0x1b')](socket);function respondWithStatusCode(_0x34f8bf,_0x2446c5){_0x2446c5=_0x2446c5||0xcc;return function(_0x2240e1){if(_0x2240e1){return _0x34f8bf[_0xf89c('0x1c')](_0x2446c5);}return _0x34f8bf[_0xf89c('0x1d')](_0x2446c5)[_0xf89c('0x1e')]();};}function respondWithResult(_0x128cb0,_0x133848){_0x133848=_0x133848||0xc8;return function(_0xf15450){if(_0xf15450){return _0x128cb0[_0xf89c('0x1d')](_0x133848)[_0xf89c('0x1f')](_0xf15450);}};}function respondWithFilteredResult(_0x4d1412,_0x5ec42f){return function(_0x5501ed){if(_0x5501ed){var _0x436213=typeof _0x5ec42f[_0xf89c('0x20')]===_0xf89c('0x21')&&typeof _0x5ec42f[_0xf89c('0x22')]===_0xf89c('0x21');var _0x38137f=_0x5501ed[_0xf89c('0x23')];var _0x1976a1=_0x436213?0x0:_0x5ec42f[_0xf89c('0x20')];var _0x214e35=_0x436213?_0x5501ed[_0xf89c('0x23')]:_0x5ec42f[_0xf89c('0x20')]+_0x5ec42f[_0xf89c('0x22')];var _0x3f62ad;if(_0x214e35>=_0x38137f){_0x214e35=_0x38137f;_0x3f62ad=0xc8;}else{_0x3f62ad=0xce;}_0x4d1412[_0xf89c('0x1d')](_0x3f62ad);return _0x4d1412[_0xf89c('0x24')](_0xf89c('0x25'),_0x1976a1+'-'+_0x214e35+'/'+_0x38137f)[_0xf89c('0x1f')](_0x5501ed);}return null;};}function patchUpdates(_0x5d83b5){return function(_0x6861e8){try{jsonpatch[_0xf89c('0x26')](_0x6861e8,_0x5d83b5,!![]);}catch(_0x312bd4){return BPromise[_0xf89c('0x27')](_0x312bd4);}return _0x6861e8[_0xf89c('0x28')]();};}function saveUpdates(_0x3d8390,_0x36378f){return function(_0x30a4c8){if(_0x30a4c8){return _0x30a4c8[_0xf89c('0x29')](_0x3d8390)[_0xf89c('0x2a')](function(_0x176ec4){return _0x176ec4;});}return null;};}function removeEntity(_0x4c158d,_0x2bb797){return function(_0xdff54c){if(_0xdff54c){return _0xdff54c[_0xf89c('0x2b')]()[_0xf89c('0x2a')](function(){_0x4c158d[_0xf89c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x380b72,_0x228999){return function(_0x53f4ac){if(!_0x53f4ac){_0x380b72[_0xf89c('0x1c')](0x194);}return _0x53f4ac;};}function handleError(_0x601f93,_0x63762c){_0x63762c=_0x63762c||0x1f4;return function(_0xb832cf){logger['error'](_0xb832cf['stack']);if(_0xb832cf[_0xf89c('0x2c')]){delete _0xb832cf[_0xf89c('0x2c')];}_0x601f93[_0xf89c('0x1d')](_0x63762c)[_0xf89c('0x2d')](_0xb832cf);};}exports['index']=function(_0x4a4382,_0x5ecf66){var _0x333a64={},_0x301b17={},_0x124df9={'count':0x0,'rows':[]};var _0x2224ff=_['map'](db[_0xf89c('0x2e')][_0xf89c('0x2f')],function(_0x35937b){return{'name':_0x35937b['fieldName'],'type':_0x35937b[_0xf89c('0x30')][_0xf89c('0x31')]};});_0x301b17[_0xf89c('0x32')]=_['map'](_0x2224ff,_0xf89c('0x2c'));_0x301b17[_0xf89c('0x33')]=_[_0xf89c('0x34')](_0x4a4382[_0xf89c('0x33')]);_0x301b17['filters']=_['intersection'](_0x301b17['model'],_0x301b17[_0xf89c('0x33')]);_0x333a64[_0xf89c('0x35')]=_[_0xf89c('0x36')](_0x301b17[_0xf89c('0x32')],qs[_0xf89c('0x37')](_0x4a4382[_0xf89c('0x33')][_0xf89c('0x37')]));_0x333a64[_0xf89c('0x35')]=_0x333a64[_0xf89c('0x35')][_0xf89c('0x38')]?_0x333a64[_0xf89c('0x35')]:_0x301b17['model'];if(!_0x4a4382['query'][_0xf89c('0x39')](_0xf89c('0x3a'))){_0x333a64[_0xf89c('0x22')]=qs['limit'](_0x4a4382[_0xf89c('0x33')][_0xf89c('0x22')]);_0x333a64[_0xf89c('0x20')]=qs['offset'](_0x4a4382['query']['offset']);}_0x333a64[_0xf89c('0x3b')]=qs[_0xf89c('0x3c')](_0x4a4382[_0xf89c('0x33')][_0xf89c('0x3c')]);_0x333a64['where']=qs[_0xf89c('0x3d')](_[_0xf89c('0x3e')](_0x4a4382[_0xf89c('0x33')],_0x301b17[_0xf89c('0x3d')]),_0x2224ff);if(_0x4a4382[_0xf89c('0x33')][_0xf89c('0x3f')]){_0x333a64[_0xf89c('0x40')]=_[_0xf89c('0x41')](_0x333a64[_0xf89c('0x40')],{'$or':_[_0xf89c('0x42')](_0x2224ff,function(_0x27a1b3){if(_0x27a1b3[_0xf89c('0x30')]!==_0xf89c('0x43')){var _0x1b510f={};_0x1b510f[_0x27a1b3[_0xf89c('0x2c')]]={'$like':'%'+_0x4a4382[_0xf89c('0x33')][_0xf89c('0x3f')]+'%'};return _0x1b510f;}})});}_0x333a64=_[_0xf89c('0x41')]({},_0x333a64,_0x4a4382[_0xf89c('0x44')]);var _0x1a0582={'where':_0x333a64[_0xf89c('0x40')]};return db['ChatInternalMessage']['count'](_0x1a0582)['then'](function(_0x4c6060){_0x124df9[_0xf89c('0x23')]=_0x4c6060;if(_0x4a4382['query']['includeAll']){_0x333a64[_0xf89c('0x45')]=[{'all':!![]}];}return db[_0xf89c('0x2e')][_0xf89c('0x46')](_0x333a64);})[_0xf89c('0x2a')](function(_0x4e9829){_0x124df9[_0xf89c('0x47')]=_0x4e9829;return _0x124df9;})[_0xf89c('0x2a')](respondWithFilteredResult(_0x5ecf66,_0x333a64))['catch'](handleError(_0x5ecf66,null));};exports['show']=function(_0x377dd2,_0x2d01e1){var _0x463f20={'raw':!![],'where':{'id':_0x377dd2[_0xf89c('0x48')]['id']}},_0x12ec73={};_0x12ec73[_0xf89c('0x32')]=_['keys'](db['ChatInternalMessage'][_0xf89c('0x2f')]);_0x12ec73['query']=_[_0xf89c('0x34')](_0x377dd2[_0xf89c('0x33')]);_0x12ec73[_0xf89c('0x3d')]=_['intersection'](_0x12ec73[_0xf89c('0x32')],_0x12ec73['query']);_0x463f20[_0xf89c('0x35')]=_[_0xf89c('0x36')](_0x12ec73[_0xf89c('0x32')],qs[_0xf89c('0x37')](_0x377dd2[_0xf89c('0x33')]['fields']));_0x463f20[_0xf89c('0x35')]=_0x463f20[_0xf89c('0x35')]['length']?_0x463f20[_0xf89c('0x35')]:_0x12ec73['model'];if(_0x377dd2[_0xf89c('0x33')][_0xf89c('0x49')]){_0x463f20['include']=[{'all':!![]}];}_0x463f20=_[_0xf89c('0x41')]({},_0x463f20,_0x377dd2['options']);return db[_0xf89c('0x2e')][_0xf89c('0x4a')](_0x463f20)['then'](handleEntityNotFound(_0x2d01e1,null))[_0xf89c('0x2a')](respondWithResult(_0x2d01e1,null))[_0xf89c('0x4b')](handleError(_0x2d01e1,null));};exports['create']=function(_0x2295a9,_0x550966){return db[_0xf89c('0x2e')][_0xf89c('0x4c')](_0x2295a9[_0xf89c('0x4d')],{})[_0xf89c('0x2a')](respondWithResult(_0x550966,0xc9))[_0xf89c('0x4b')](handleError(_0x550966,null));};exports[_0xf89c('0x29')]=function(_0x3091ba,_0xe166a0){if(_0x3091ba[_0xf89c('0x4d')]['id']){delete _0x3091ba[_0xf89c('0x4d')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x3091ba[_0xf89c('0x48')]['id']}})['then'](handleEntityNotFound(_0xe166a0,null))['then'](saveUpdates(_0x3091ba[_0xf89c('0x4d')],null))[_0xf89c('0x2a')](respondWithResult(_0xe166a0,null))[_0xf89c('0x4b')](handleError(_0xe166a0,null));};exports[_0xf89c('0x2b')]=function(_0xe144bd,_0x1db3f9){return db[_0xf89c('0x2e')][_0xf89c('0x4a')]({'where':{'id':_0xe144bd['params']['id']}})['then'](handleEntityNotFound(_0x1db3f9,null))[_0xf89c('0x2a')](removeEntity(_0x1db3f9,null))[_0xf89c('0x4b')](handleError(_0x1db3f9,null));};exports[_0xf89c('0x4e')]=function(_0x2ca16d,_0x429dfe){return db['ChatInternalMessage'][_0xf89c('0x4e')]()['then'](respondWithResult(_0x429dfe,null))['catch'](handleError(_0x429dfe,null));};function wrapUser(_0x5677b2){return function(_0x2da42a){var _0x3aaa4f=_0x5677b2['get']({'plain':!![]});_0x3aaa4f['messages']=[];if(_0x2da42a){_0x3aaa4f['lastMessageAt']=_0x2da42a['createdAt'];_0x3aaa4f[_0xf89c('0x4f')]=_0x2da42a;}else{_0x3aaa4f[_0xf89c('0x50')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3aaa4f[_0xf89c('0x4f')]={};}return _0x3aaa4f;};}exports['getUsers']=function(_0x39720e,_0x3e06be,_0x545932){var _0x4a8a3d=[];return db['User'][_0xf89c('0x46')]({'where':{'role':['agent',_0xf89c('0x51'),_0xf89c('0x52')]},'attributes':['id',_0xf89c('0x53'),_0xf89c('0x2c'),_0xf89c('0x54'),_0xf89c('0x55'),_0xf89c('0x56'),_0xf89c('0x57'),'lastLoginAt','allowmessenger',_0xf89c('0x58')],'order':qs[_0xf89c('0x3c')](_0xf89c('0x59')),'include':[{'model':db[_0xf89c('0x5a')],'as':_0xf89c('0x5b'),'attributes':['id',_0xf89c('0x2c'),_0xf89c('0x30')],'through':{'attributes':[]}}]})[_0xf89c('0x2a')](function(_0xbdccec){if(_0xbdccec){var _0x47c6b0=_0x39720e['user']['get']({'plain':!![]});if(!_0x47c6b0)throw new Error(_0xf89c('0x5c'));if(_0x47c6b0[_0xf89c('0x54')]===_0xf89c('0x52')){return db[_0xf89c('0x5d')][_0xf89c('0x4a')]({'where':{'name':'Agents','userProfileId':_0x47c6b0[_0xf89c('0x5e')]},'raw':!![]})[_0xf89c('0x2a')](function(_0x4b978e){if(_0x4b978e){if(_0x4b978e['autoAssociation']===0x0){return db[_0xf89c('0x5f')]['findAll']({'where':{'sectionId':_0x4b978e['id']},'raw':!![]})[_0xf89c('0x2a')](function(_0x415c2e){var _0x5b368d=[];if(_['isEmpty'](_0x415c2e)){_0x5b368d=_[_0xf89c('0x3f')](_0xbdccec,function(_0x15a758){if(_0x15a758['role']!==_0xf89c('0x60')){return _0x15a758;}});return _0x5b368d;}else{for(var _0x351b87=0x0;_0x351b87<_0xbdccec[_0xf89c('0x38')];_0x351b87++){var _0x20f038=_0xbdccec[_0x351b87];if(_0x20f038[_0xf89c('0x54')]==='agent'){var _0x48c4f7=_[_0xf89c('0x4a')](_0x415c2e,function(_0x2017a5){return _0x2017a5[_0xf89c('0x61')]===_0x20f038['id'];});if(_0x48c4f7)_0x5b368d[_0xf89c('0x62')](_0x20f038);}else{_0x5b368d[_0xf89c('0x62')](_0x20f038);}}return _0x5b368d;}});}else{return _0xbdccec;}}else{var _0x30ca4b=_[_0xf89c('0x3f')](_0xbdccec,function(_0x84f090){if(_0x84f090[_0xf89c('0x54')]!==_0xf89c('0x60')){return _0x84f090;}});return _0x30ca4b;}});}else{return _0xbdccec;}}})[_0xf89c('0x2a')](function(_0x35c493){var _0x23c377=[];if(_0x35c493){_0x4a8a3d=_0x35c493;for(var _0x3dcee1=0x0;_0x3dcee1<_0x35c493['length'];_0x3dcee1+=0x1){_0x4a8a3d[_0x3dcee1][_0xf89c('0x63')]=[];_0x23c377[_0xf89c('0x62')](db[_0xf89c('0x2e')][_0xf89c('0x4a')]({'where':{'FromId':[_0x39720e[_0xf89c('0x52')]['id'],_0x35c493[_0x3dcee1]['id']],'ToId':[_0x39720e[_0xf89c('0x52')]['id'],_0x35c493[_0x3dcee1]['id']],'ChatGroupId':null},'attributes':['id',_0xf89c('0x64'),_0xf89c('0x65'),'ToId','read',_0xf89c('0x4d')],'order':qs[_0xf89c('0x3c')](_0xf89c('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x35c493[_0x3dcee1])));}return BPromise[_0xf89c('0x67')](_0x23c377);}return[];})[_0xf89c('0x2a')](function(_0x351e08){return{'rows':_0x351e08,'count':_0x351e08['length']};})['then'](respondWithResult(_0x3e06be,null))[_0xf89c('0x4b')](handleError(_0x3e06be,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 036a256..aa95e8e 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 _0xf873=['events','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x456ce1,_0x5bef34){var _0x5b3a7f=function(_0x118465){while(--_0x118465){_0x456ce1['push'](_0x456ce1['shift']());}};_0x5b3a7f(++_0x5bef34);}(_0xf873,0x178));var _0x3f87=function(_0x592b9e,_0x2d882a){_0x592b9e=_0x592b9e-0x0;var _0x3ec6ac=_0xf873[_0x592b9e];return _0x3ec6ac;};'use strict';var EventEmitter=require(_0x3f87('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3f87('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3f87('0x2')](0x0);var events={'afterCreate':_0x3f87('0x3'),'afterUpdate':'update','afterDestroy':_0x3f87('0x4')};function emitEvent(_0x1324a7){return function(_0x44b3c3,_0x32e82d,_0x394849){ChatInternalMessageEvents[_0x3f87('0x5')](_0x1324a7+':'+_0x44b3c3['id'],_0x44b3c3);ChatInternalMessageEvents['emit'](_0x1324a7,_0x44b3c3);_0x394849(null);};}for(var e in events){if(events[_0x3f87('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3f87('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe7e1=['setMaxListeners','save','remove','emit','events','../../mysqldb','ChatInternalMessage'];(function(_0x9035a,_0x1c1624){var _0x193d40=function(_0x660e1e){while(--_0x660e1e){_0x9035a['push'](_0x9035a['shift']());}};_0x193d40(++_0x1c1624);}(_0xe7e1,0x185));var _0x1e7e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xe7e1[_0x45b034];return _0x509cb0;};'use strict';var EventEmitter=require(_0x1e7e('0x0'));var ChatInternalMessage=require(_0x1e7e('0x1'))['db'][_0x1e7e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1e7e('0x3')](0x0);var events={'afterCreate':_0x1e7e('0x4'),'afterUpdate':'update','afterDestroy':_0x1e7e('0x5')};function emitEvent(_0x59a86d){return function(_0x122f22,_0x3caffb,_0x2bc43a){ChatInternalMessageEvents[_0x1e7e('0x6')](_0x59a86d+':'+_0x122f22['id'],_0x122f22);ChatInternalMessageEvents[_0x1e7e('0x6')](_0x59a86d,_0x122f22);_0x2bc43a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index fb97c8e..30ee538 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 _0x7dab=['../../config/logger','api','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7dab,0x102));var _0xb7da=function(_0x2c9eea,_0x5abda0){_0x2c9eea=_0x2c9eea-0x0;var _0x309090=_0x7dab[_0x2c9eea];return _0x309090;};'use strict';var _=require(_0xb7da('0x0'));var util=require(_0xb7da('0x1'));var logger=require(_0xb7da('0x2'))(_0xb7da('0x3'));var moment=require('moment');var BPromise=require(_0xb7da('0x4'));var rp=require(_0xb7da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7da('0x6'));var attributes=require(_0xb7da('0x7'));module[_0xb7da('0x8')]=function(_0x36f359,_0x5e8cc5){return _0x36f359[_0xb7da('0x9')](_0xb7da('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7da('0xb'),'collate':_0xb7da('0xc')});}; \ No newline at end of file +var _0xfd91=['ChatInternalMessage','chat_internal_messages','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','define'];(function(_0x5111bf,_0x5a1f92){var _0xeabd97=function(_0x55e865){while(--_0x55e865){_0x5111bf['push'](_0x5111bf['shift']());}};_0xeabd97(++_0x5a1f92);}(_0xfd91,0x1db));var _0x1fd9=function(_0x57bb28,_0x3d6d4a){_0x57bb28=_0x57bb28-0x0;var _0x4d26a4=_0xfd91[_0x57bb28];return _0x4d26a4;};'use strict';var _=require('lodash');var util=require(_0x1fd9('0x0'));var logger=require(_0x1fd9('0x1'))(_0x1fd9('0x2'));var moment=require(_0x1fd9('0x3'));var BPromise=require(_0x1fd9('0x4'));var rp=require(_0x1fd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fd9('0x6'));var config=require('../../config/environment');var attributes=require(_0x1fd9('0x7'));module['exports']=function(_0x461d8c,_0x4f19da){return _0x461d8c[_0x1fd9('0x8')](_0x1fd9('0x9'),attributes,{'tableName':_0x1fd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 3e775f2..ebad29d 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 _0x2aef=['../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2c8b50,_0x23a0d2){var _0x342eb2=function(_0x27df6e){while(--_0x27df6e){_0x2c8b50['push'](_0x2c8b50['shift']());}};_0x342eb2(++_0x23a0d2);}(_0x2aef,0x122));var _0xf2ae=function(_0x227dd3,_0x3f3428){_0x227dd3=_0x227dd3-0x0;var _0x4a595e=_0x2aef[_0x227dd3];return _0x4a595e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2ae('0x0'));var rs=require(_0xf2ae('0x1'));var fs=require('fs');var Redis=require(_0xf2ae('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2ae('0x3'));var logger=require(_0xf2ae('0x4'))('rpc');var config=require(_0xf2ae('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf2ae('0x6')][_0xf2ae('0x7')]({'port':0x232a});config['redis']=_[_0xf2ae('0x8')](config[_0xf2ae('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2ae('0xa'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x257c86,_0x143a8c,_0x401f26){return new BPromise(function(_0x50f544,_0xdcaf7a){return client['request'](_0x257c86,_0x401f26)['then'](function(_0x79e05e){logger[_0xf2ae('0xb')]('ChatInternalMessage,\x20%s,\x20%s',_0x143a8c,_0xf2ae('0xc'));logger[_0xf2ae('0xd')](_0xf2ae('0xe'),_0x143a8c,_0xf2ae('0xc'),JSON[_0xf2ae('0xf')](_0x79e05e));if(_0x79e05e['error']){if(_0x79e05e['error']['code']===0x1f4){logger[_0xf2ae('0x10')](_0xf2ae('0x11'),_0x143a8c,_0x79e05e[_0xf2ae('0x10')][_0xf2ae('0x12')]);return _0xdcaf7a(_0x79e05e[_0xf2ae('0x10')][_0xf2ae('0x12')]);}logger[_0xf2ae('0x10')](_0xf2ae('0x11'),_0x143a8c,_0x79e05e['error'][_0xf2ae('0x12')]);return _0x50f544(_0x79e05e[_0xf2ae('0x10')][_0xf2ae('0x12')]);}else{logger['info'](_0xf2ae('0x11'),_0x143a8c,'request\x20sent');_0x50f544(_0x79e05e[_0xf2ae('0x13')]['message']);}})[_0xf2ae('0x14')](function(_0x39d561){logger[_0xf2ae('0x10')](_0xf2ae('0x11'),_0x143a8c,_0x39d561);_0xdcaf7a(_0x39d561);});});} \ No newline at end of file +var _0xca41=['register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x3f5f3d,_0x2e38c5){var _0x455ffb=function(_0x28f837){while(--_0x28f837){_0x3f5f3d['push'](_0x3f5f3d['shift']());}};_0x455ffb(++_0x2e38c5);}(_0xca41,0xb5));var _0x1ca4=function(_0x5af0a2,_0x2b4a26){_0x5af0a2=_0x5af0a2-0x0;var _0x1419f6=_0xca41[_0x5af0a2];return _0x1419f6;};'use strict';var _=require(_0x1ca4('0x0'));var util=require(_0x1ca4('0x1'));var moment=require(_0x1ca4('0x2'));var BPromise=require(_0x1ca4('0x3'));var rs=require(_0x1ca4('0x4'));var fs=require('fs');var Redis=require(_0x1ca4('0x5'));var db=require(_0x1ca4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca4('0x7'))(_0x1ca4('0x8'));var config=require(_0x1ca4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ca4('0xa')]['http']({'port':0x232a});config[_0x1ca4('0xb')]=_[_0x1ca4('0xc')](config[_0x1ca4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ca4('0xd'))(new Redis(config[_0x1ca4('0xb')]));require(_0x1ca4('0xe'))[_0x1ca4('0xf')](socket);function respondWithRpcPromise(_0x31aa6c,_0x5aa247,_0x33c7b8){return new BPromise(function(_0x4e9dc7,_0x8e8bd8){return client[_0x1ca4('0x10')](_0x31aa6c,_0x33c7b8)[_0x1ca4('0x11')](function(_0x262344){logger[_0x1ca4('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x5aa247,_0x1ca4('0x13'));logger[_0x1ca4('0x14')](_0x1ca4('0x15'),_0x5aa247,_0x1ca4('0x13'),JSON['stringify'](_0x262344));if(_0x262344['error']){if(_0x262344[_0x1ca4('0x16')][_0x1ca4('0x17')]===0x1f4){logger[_0x1ca4('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x5aa247,_0x262344[_0x1ca4('0x16')]['message']);return _0x8e8bd8(_0x262344[_0x1ca4('0x16')][_0x1ca4('0x18')]);}logger[_0x1ca4('0x16')](_0x1ca4('0x19'),_0x5aa247,_0x262344[_0x1ca4('0x16')][_0x1ca4('0x18')]);return _0x4e9dc7(_0x262344[_0x1ca4('0x16')][_0x1ca4('0x18')]);}else{logger[_0x1ca4('0x12')](_0x1ca4('0x19'),_0x5aa247,_0x1ca4('0x13'));_0x4e9dc7(_0x262344[_0x1ca4('0x1a')][_0x1ca4('0x18')]);}})[_0x1ca4('0x1b')](function(_0x37d91a){logger[_0x1ca4('0x16')](_0x1ca4('0x19'),_0x5aa247,_0x37d91a);_0x8e8bd8(_0x37d91a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8593606..49e9535 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 _0xfa50=['register','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener'];(function(_0x4cbc20,_0x115dc6){var _0x3f83f7=function(_0x133b98){while(--_0x133b98){_0x4cbc20['push'](_0x4cbc20['shift']());}};_0x3f83f7(++_0x115dc6);}(_0xfa50,0x1d7));var _0x0fa5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa50[_0x321bb2];return _0x9c12ed;};'use strict';var ChatInternalMessageEvents=require(_0x0fa5('0x0'));var events=['save',_0x0fa5('0x1'),_0x0fa5('0x2')];function createListener(_0xcdfb05,_0x5a117e){return function(_0xb5ff0b){_0x5a117e[_0x0fa5('0x3')](_0xcdfb05,_0xb5ff0b);};}function removeListener(_0x4c4d4f,_0x364b1e){return function(){ChatInternalMessageEvents[_0x0fa5('0x4')](_0x4c4d4f,_0x364b1e);};}exports[_0x0fa5('0x5')]=function(_0x194313){for(var _0x3e4bbe=0x0,_0x44cf6a=events['length'];_0x3e4bbe<_0x44cf6a;_0x3e4bbe++){var _0x2e8e26=events[_0x3e4bbe];var _0x56b6ea=createListener(_0x0fa5('0x6')+_0x2e8e26,_0x194313);ChatInternalMessageEvents['on'](_0x2e8e26,_0x56b6ea);}}; \ No newline at end of file +var _0x6df3=['update','emit','removeListener','length','save','remove'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x6df3,0xb2));var _0x36df=function(_0x32912e,_0x35b6ea){_0x32912e=_0x32912e-0x0;var _0x39500d=_0x6df3[_0x32912e];return _0x39500d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x36df('0x0'),_0x36df('0x1'),_0x36df('0x2')];function createListener(_0x4885b9,_0x20e39f){return function(_0x5ab52b){_0x20e39f[_0x36df('0x3')](_0x4885b9,_0x5ab52b);};}function removeListener(_0x221289,_0x4322e8){return function(){ChatInternalMessageEvents[_0x36df('0x4')](_0x221289,_0x4322e8);};}exports['register']=function(_0x49d1eb){for(var _0x4af8bd=0x0,_0x3869b5=events[_0x36df('0x5')];_0x4af8bd<_0x3869b5;_0x4af8bd++){var _0x3702b6=events[_0x4af8bd];var _0x3f6d87=createListener('chatInternalMessage:'+_0x3702b6,_0x49d1eb);ChatInternalMessageEvents['on'](_0x3702b6,_0x3f6d87);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c9d9963..22d189f 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 _0xec57=['getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users'];(function(_0x150355,_0x1ef719){var _0x42887b=function(_0xfd9450){while(--_0xfd9450){_0x150355['push'](_0x150355['shift']());}};_0x42887b(++_0x1ef719);}(_0xec57,0x87));var _0x7ec5=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xec57[_0x340380];return _0x49ce1c;};'use strict';var multer=require(_0x7ec5('0x0'));var util=require(_0x7ec5('0x1'));var path=require(_0x7ec5('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ec5('0x3'));var router=express[_0x7ec5('0x4')]();var fs_extra=require(_0x7ec5('0x5'));var auth=require(_0x7ec5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7ec5('0x7'));var controller=require(_0x7ec5('0x8'));router[_0x7ec5('0x9')]('/',auth[_0x7ec5('0xa')](),controller[_0x7ec5('0xb')]);router['get'](_0x7ec5('0xc'),auth[_0x7ec5('0xa')](),controller[_0x7ec5('0xd')]);router[_0x7ec5('0x9')](_0x7ec5('0xe'),auth[_0x7ec5('0xa')](),controller[_0x7ec5('0xf')]);router[_0x7ec5('0x9')](_0x7ec5('0x10'),auth[_0x7ec5('0xa')](),controller[_0x7ec5('0x11')]);router[_0x7ec5('0x12')]('/',auth['isAuthenticated'](),controller[_0x7ec5('0x13')]);router[_0x7ec5('0x14')]('/:id',controller[_0x7ec5('0x15')]);router[_0x7ec5('0x16')](_0x7ec5('0x10'),auth[_0x7ec5('0xa')](),controller[_0x7ec5('0x17')]);module[_0x7ec5('0x18')]=router; \ No newline at end of file +var _0xf1c9=['/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','getUsers'];(function(_0x2f568c,_0x298e5b){var _0x3135f7=function(_0x46df10){while(--_0x46df10){_0x2f568c['push'](_0x2f568c['shift']());}};_0x3135f7(++_0x298e5b);}(_0xf1c9,0xb1));var _0x9f1c=function(_0x2351d7,_0x3b1861){_0x2351d7=_0x2351d7-0x0;var _0x106340=_0xf1c9[_0x2351d7];return _0x106340;};'use strict';var multer=require(_0x9f1c('0x0'));var util=require(_0x9f1c('0x1'));var path=require(_0x9f1c('0x2'));var timeout=require(_0x9f1c('0x3'));var express=require(_0x9f1c('0x4'));var router=express[_0x9f1c('0x5')]();var fs_extra=require(_0x9f1c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f1c('0x7'));var config=require('../../config/environment');var controller=require(_0x9f1c('0x8'));router[_0x9f1c('0x9')]('/',auth[_0x9f1c('0xa')](),controller['index']);router[_0x9f1c('0x9')](_0x9f1c('0xb'),auth[_0x9f1c('0xa')](),controller['describe']);router[_0x9f1c('0x9')]('/users',auth[_0x9f1c('0xa')](),controller[_0x9f1c('0xc')]);router[_0x9f1c('0x9')](_0x9f1c('0xd'),auth[_0x9f1c('0xa')](),controller[_0x9f1c('0xe')]);router['post']('/',auth[_0x9f1c('0xa')](),controller[_0x9f1c('0xf')]);router[_0x9f1c('0x10')](_0x9f1c('0xd'),controller['update']);router[_0x9f1c('0x11')](_0x9f1c('0xd'),auth['isAuthenticated'](),controller[_0x9f1c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 70a2664..485ee29 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 _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x117c,0x71));var _0xc117=function(_0x33481a,_0x5d4316){_0x33481a=_0x33481a-0x0;var _0x408ab9=_0x117c[_0x33481a];return _0x408ab9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file +var _0xdef9=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xdef9,0x1ed));var _0x9def=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xdef9[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x9def('0x0'));module[_0x9def('0x1')]={'body':{'type':Sequelize[_0x9def('0x2')](_0x9def('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9def('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9def('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9def('0x5')]('in',_0x9def('0x6')),'defaultValue':_0x9def('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9def('0x7')]},'providerName':{'type':Sequelize[_0x9def('0x8')]},'providerResponse':{'type':Sequelize[_0x9def('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c1e144d..c4ce79b 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 _0x862b=['intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','include','rows','show','length','body','find','params','describe','accept','acceptMessage','chat','user','UserId','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','interface','format','channel','motionChannel','event','EventManager','rejectmessage','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','send','index','ChatMessage','rawAttributes','key','model','name','query','keys'];(function(_0x2ccc71,_0x6b0352){var _0xb9fff2=function(_0xf6f69c){while(--_0xf6f69c){_0x2ccc71['push'](_0x2ccc71['shift']());}};_0xb9fff2(++_0x6b0352);}(_0x862b,0x9a));var _0xb862=function(_0xbe22c,_0x486191){_0xbe22c=_0xbe22c-0x0;var _0x31b9ee=_0x862b[_0xbe22c];return _0x31b9ee;};'use strict';var util=require(_0xb862('0x0'));var _=require(_0xb862('0x1'));var Redis=require(_0xb862('0x2'));var interactionService=require(_0xb862('0x3'));var qs=require(_0xb862('0x4'));var logger=require(_0xb862('0x5'))(_0xb862('0x6'));var config=require(_0xb862('0x7'));var db=require(_0xb862('0x8'))['db'];config[_0xb862('0x9')]=_['defaults'](config[_0xb862('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb862('0xa'))(new Redis(config[_0xb862('0x9')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xb862('0xb'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xb862('0xc')][_0xb862('0xd')]({'port':0x232a});var interaction_log=require(_0xb862('0x5'))('chat-interactions');function respondWithRpcPromise(_0x4d97dd,_0x5c31dd,_0x4a0785,_0x2366cb){return new Promise(function(_0x36c3dd,_0x10e950){var _0x534d5a=_0x2366cb||client;return _0x534d5a[_0xb862('0xe')](_0x4d97dd,_0x4a0785)['then'](function(_0x1809af){logger[_0xb862('0xf')]('ChatMessage,\x20%s,\x20%s',_0x5c31dd,_0xb862('0x10'));logger[_0xb862('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5c31dd,_0xb862('0x10'),JSON[_0xb862('0x12')](_0x1809af));if(_0x1809af['error']){if(_0x1809af[_0xb862('0x13')][_0xb862('0x14')]===0x1f4){logger[_0xb862('0x13')](_0xb862('0x15'),_0x5c31dd,_0x1809af[_0xb862('0x13')]['message']);return _0x10e950(_0x1809af[_0xb862('0x13')][_0xb862('0x16')]);}logger['error'](_0xb862('0x15'),_0x5c31dd,_0x1809af['error'][_0xb862('0x16')]);return _0x36c3dd(_0x1809af['error'][_0xb862('0x16')]);}else{logger[_0xb862('0xf')](_0xb862('0x15'),_0x5c31dd,_0xb862('0x10'));_0x36c3dd(_0x1809af[_0xb862('0x17')][_0xb862('0x16')]);}})[_0xb862('0x18')](function(_0x1c921c){logger[_0xb862('0x13')]('ChatMessage,\x20%s,\x20%s',_0x5c31dd,_0x1c921c);_0x10e950(_0x1c921c);});});}function respondWithResult(_0x433cd3,_0x418da5){_0x418da5=_0x418da5||0xc8;return function(_0x224035){if(_0x224035){return _0x433cd3[_0xb862('0x19')](_0x418da5)[_0xb862('0x1a')](_0x224035);}};}function respondWithFilteredResult(_0x384ff5,_0x506356){return function(_0xe07bc3){if(_0xe07bc3){var _0x5e1400=typeof _0x506356[_0xb862('0x1b')]===_0xb862('0x1c')&&typeof _0x506356['limit']===_0xb862('0x1c');var _0x52643c=_0xe07bc3[_0xb862('0x1d')];var _0x2b5401=_0x5e1400?0x0:_0x506356['offset'];var _0x451050=_0x5e1400?_0xe07bc3['count']:_0x506356[_0xb862('0x1b')]+_0x506356['limit'];var _0x3dbac7;if(_0x451050>=_0x52643c){_0x451050=_0x52643c;_0x3dbac7=0xc8;}else{_0x3dbac7=0xce;}_0x384ff5['status'](_0x3dbac7);return _0x384ff5[_0xb862('0x1e')](_0xb862('0x1f'),_0x2b5401+'-'+_0x451050+'/'+_0x52643c)[_0xb862('0x1a')](_0xe07bc3);}return null;};}function saveUpdates(_0x2bd1c6){return function(_0x51de20){if(_0x51de20){return _0x51de20[_0xb862('0x20')](_0x2bd1c6)[_0xb862('0x21')](function(_0x26bdfb){return _0x26bdfb;});}return null;};}function removeEntity(_0x564eae){return function(_0x29c354){if(_0x29c354){return _0x29c354[_0xb862('0x22')]()[_0xb862('0x21')](function(){_0x564eae['status'](0xcc)[_0xb862('0x23')]();});}};}function handleEntityNotFound(_0x1224a5){return function(_0x433e6e){if(!_0x433e6e){_0x1224a5[_0xb862('0x24')](0x194);}return _0x433e6e;};}function handleError(_0x444c24,_0x551c7b){_0x551c7b=_0x551c7b||0x1f4;return function(_0x5c4401){logger[_0xb862('0x13')](_0x5c4401['stack']);if(_0x5c4401['name']){delete _0x5c4401['name'];}_0x444c24[_0xb862('0x19')](_0x551c7b)[_0xb862('0x25')](_0x5c4401);};}exports[_0xb862('0x26')]=function(_0x188973,_0x1cb98d){var _0x1eef3d={},_0x2699ef={},_0x36a2e1={'count':0x0,'rows':[]};var _0x5a2644=_['map'](db[_0xb862('0x27')][_0xb862('0x28')],function(_0x1ddf2c){return{'name':_0x1ddf2c['fieldName'],'type':_0x1ddf2c['type'][_0xb862('0x29')]};});_0x2699ef[_0xb862('0x2a')]=_['map'](_0x5a2644,_0xb862('0x2b'));_0x2699ef[_0xb862('0x2c')]=_[_0xb862('0x2d')](_0x188973[_0xb862('0x2c')]);_0x2699ef['filters']=_[_0xb862('0x2e')](_0x2699ef[_0xb862('0x2a')],_0x2699ef[_0xb862('0x2c')]);_0x1eef3d[_0xb862('0x2f')]=_['intersection'](_0x2699ef['model'],qs[_0xb862('0x30')](_0x188973[_0xb862('0x2c')][_0xb862('0x30')]));_0x1eef3d[_0xb862('0x2f')]=_0x1eef3d[_0xb862('0x2f')]['length']?_0x1eef3d[_0xb862('0x2f')]:_0x2699ef[_0xb862('0x2a')];if(!_0x188973[_0xb862('0x2c')][_0xb862('0x31')]('nolimit')){_0x1eef3d[_0xb862('0x32')]=qs[_0xb862('0x32')](_0x188973['query'][_0xb862('0x32')]);_0x1eef3d[_0xb862('0x1b')]=qs[_0xb862('0x1b')](_0x188973[_0xb862('0x2c')]['offset']);}_0x1eef3d[_0xb862('0x33')]=qs[_0xb862('0x34')](_0x188973['query']['sort']);_0x1eef3d[_0xb862('0x35')]=qs[_0xb862('0x36')](_[_0xb862('0x37')](_0x188973[_0xb862('0x2c')],_0x2699ef[_0xb862('0x36')]),_0x5a2644);if(_0x188973[_0xb862('0x2c')][_0xb862('0x38')]){_0x1eef3d[_0xb862('0x35')]=_['merge'](_0x1eef3d['where'],{'$or':_[_0xb862('0x39')](_0x5a2644,function(_0x18f3e0){if(_0x18f3e0['type']!==_0xb862('0x3a')){var _0x41f6a5={};_0x41f6a5[_0x18f3e0[_0xb862('0x2b')]]={'$like':'%'+_0x188973[_0xb862('0x2c')][_0xb862('0x38')]+'%'};return _0x41f6a5;}})});}_0x1eef3d=_[_0xb862('0x3b')]({},_0x1eef3d,_0x188973[_0xb862('0x3c')]);var _0x2724b1={'where':_0x1eef3d[_0xb862('0x35')]};return db[_0xb862('0x27')]['count'](_0x2724b1)[_0xb862('0x21')](function(_0x2e0a30){_0x36a2e1[_0xb862('0x1d')]=_0x2e0a30;if(_0x188973[_0xb862('0x2c')]['includeAll']){_0x1eef3d[_0xb862('0x3d')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x1eef3d);})['then'](function(_0x8954f9){_0x36a2e1[_0xb862('0x3e')]=_0x8954f9;return _0x36a2e1;})[_0xb862('0x21')](respondWithFilteredResult(_0x1cb98d,_0x1eef3d))[_0xb862('0x18')](handleError(_0x1cb98d,null));};exports[_0xb862('0x3f')]=function(_0x505f42,_0x57e6bd){var _0x202339={'raw':!![],'where':{'id':_0x505f42['params']['id']}},_0x2b966f={};_0x2b966f['model']=_[_0xb862('0x2d')](db[_0xb862('0x27')][_0xb862('0x28')]);_0x2b966f[_0xb862('0x2c')]=_[_0xb862('0x2d')](_0x505f42[_0xb862('0x2c')]);_0x2b966f[_0xb862('0x36')]=_[_0xb862('0x2e')](_0x2b966f[_0xb862('0x2a')],_0x2b966f[_0xb862('0x2c')]);_0x202339[_0xb862('0x2f')]=_[_0xb862('0x2e')](_0x2b966f[_0xb862('0x2a')],qs[_0xb862('0x30')](_0x505f42['query'][_0xb862('0x30')]));_0x202339['attributes']=_0x202339[_0xb862('0x2f')][_0xb862('0x40')]?_0x202339[_0xb862('0x2f')]:_0x2b966f[_0xb862('0x2a')];if(_0x505f42['query']['includeAll']){_0x202339[_0xb862('0x3d')]=[{'all':!![]}];}_0x202339=_['merge']({},_0x202339,_0x505f42[_0xb862('0x3c')]);return db[_0xb862('0x27')]['find'](_0x202339)['then'](handleEntityNotFound(_0x57e6bd,null))[_0xb862('0x21')](respondWithResult(_0x57e6bd,null))[_0xb862('0x18')](handleError(_0x57e6bd,null));};exports['create']=function(_0x49acce,_0x1cad79){return db[_0xb862('0x27')]['create'](_0x49acce[_0xb862('0x41')],{})[_0xb862('0x21')](respondWithResult(_0x1cad79,0xc9))[_0xb862('0x18')](handleError(_0x1cad79,null));};exports[_0xb862('0x20')]=function(_0x19e199,_0x147c79){if(_0x19e199[_0xb862('0x41')]['id']){delete _0x19e199['body']['id'];}return db['ChatMessage'][_0xb862('0x42')]({'where':{'id':_0x19e199['params']['id']}})['then'](handleEntityNotFound(_0x147c79,null))[_0xb862('0x21')](saveUpdates(_0x19e199[_0xb862('0x41')],null))['then'](respondWithResult(_0x147c79,null))[_0xb862('0x18')](handleError(_0x147c79,null));};exports[_0xb862('0x22')]=function(_0x53e67a,_0x5af744){return db['ChatMessage'][_0xb862('0x42')]({'where':{'id':_0x53e67a[_0xb862('0x43')]['id']}})[_0xb862('0x21')](handleEntityNotFound(_0x5af744,null))[_0xb862('0x21')](removeEntity(_0x5af744,null))[_0xb862('0x18')](handleError(_0x5af744,null));};exports['describe']=function(_0x4e2160,_0x59da84){return db['ChatMessage'][_0xb862('0x44')]()['then'](respondWithResult(_0x59da84,null))[_0xb862('0x18')](handleError(_0x59da84,null));};exports[_0xb862('0x45')]=function(_0x2c17ef,_0x2327b0){var _0x1d0a8c='chat';return interactionService[_0xb862('0x46')](_0x2c17ef,_0x1d0a8c)[_0xb862('0x21')](respondWithResult(_0x2327b0,null))[_0xb862('0x18')](handleError(_0x2327b0,null));};exports['reject']=function(_0x53b0a7,_0x554736){var _0x17c5e9={'agent':{},'channel':_0xb862('0x47')};if(_0x53b0a7[_0xb862('0x41')]['id']){delete _0x53b0a7[_0xb862('0x41')]['id'];}_0x53b0a7['body']['UserId']=_0x53b0a7[_0xb862('0x41')]['UserId']||_0x53b0a7[_0xb862('0x48')]['id'];_0x17c5e9['agent']['id']=_0x53b0a7[_0xb862('0x41')][_0xb862('0x49')];return db['ChatMessage']['find']({'where':{'id':_0x53b0a7['params']['id'],'UserId':null}})[_0xb862('0x21')](handleEntityNotFound(_0x554736,null))['then'](function(_0x3831c3){if(_0x3831c3){_0x17c5e9[_0xb862('0x16')]=_0x3831c3[_0xb862('0x4a')]({'plain':!![]});return db[_0xb862('0x4b')]['find']({'where':{'id':_0x3831c3[_0xb862('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0x554736,null))[_0xb862('0x21')](function(_0x26713f){if(_0x26713f){_0x17c5e9['interaction']=_0x26713f[_0xb862('0x4a')]({'plain':!![]});interaction_log['info'](_0xb862('0x4d'),_0x53b0a7[_0xb862('0x48')]['id'],_0x53b0a7[_0xb862('0x48')][_0xb862('0x2b')],_0x53b0a7[_0xb862('0x48')]['role'],_0x17c5e9[_0xb862('0x4e')]['id'],_0x53b0a7['body']?JSON[_0xb862('0x12')](_0x53b0a7[_0xb862('0x41')]):_0xb862('0x4f'));return respondWithRpcPromise(_0xb862('0x50'),_0xb862('0x51'),_0x17c5e9);}return null;})[_0xb862('0x21')](function(_0x140811){var _0x3d400b=_0xb862('0x52')+_0x140811[_0xb862('0x16')][_0xb862('0x53')];return db['sequelize'][_0xb862('0x2c')](_0x3d400b,{'type':db[_0xb862('0x54')]['QueryTypes'][_0xb862('0x55')],'raw':!![]})[_0xb862('0x21')](function(_0x1bd2a2){return _0x1bd2a2;});})['then'](function(_0xf00d37){if(_0xf00d37){_0x17c5e9[_0xb862('0x16')][_0xb862('0x56')]=_0xf00d37[0x0];if(!_0x53b0a7[_0xb862('0x41')][_0xb862('0x49')])return;return db[_0xb862('0x57')][_0xb862('0x42')]({'where':{'id':_0x53b0a7['body'][_0xb862('0x49')],'role':_0xb862('0x58')},'attributes':['id','name',_0xb862('0x59'),_0xb862('0x5a'),'internal'],'raw':!![]});}return null;})[_0xb862('0x21')](function(_0x524d50){if(!_0x524d50)return null;_0x17c5e9[_0xb862('0x16')][_0xb862('0x58')]=_0x524d50;return _0x17c5e9;})[_0xb862('0x21')](function(_0x547859){if(_0x547859){_0x547859['message'][_0xb862('0x5b')]=util[_0xb862('0x5c')]('SIP/%s',_0x53b0a7[_0xb862('0x48')][_0xb862('0x2b')]);_0x547859['message'][_0xb862('0x5d')]=_0x17c5e9['channel'];_0x547859[_0xb862('0x16')][_0xb862('0x5e')]=_0x17c5e9[_0xb862('0x5d')];_0x547859[_0xb862('0x16')][_0xb862('0x5f')]='reject';respondWithRpcPromise('EventManager',_0xb862('0x60'),{'event':_0xb862('0x61'),'message':_['merge'](_0x17c5e9[_0xb862('0x16')],JSON[_0xb862('0x62')](_0x17c5e9[_0xb862('0x4e')][_0xb862('0x63')]))},client9002);return _0x17c5e9;}return null;})['then'](respondWithResult(_0x554736,null))[_0xb862('0x18')](handleError(_0x554736,null));}; \ No newline at end of file +var _0x3a68=['describe','reject','chat','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','parse','formData','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','ChatMessage','includeAll','findAll','rows','show','params','keys','options','create','body','update','find'];(function(_0x34df56,_0x52a58f){var _0x520f88=function(_0x2f0a82){while(--_0x2f0a82){_0x34df56['push'](_0x34df56['shift']());}};_0x520f88(++_0x52a58f);}(_0x3a68,0xe6));var _0x83a6=function(_0x2a7837,_0x57caa0){_0x2a7837=_0x2a7837-0x0;var _0x4f10bf=_0x3a68[_0x2a7837];return _0x4f10bf;};'use strict';var util=require(_0x83a6('0x0'));var _=require('lodash');var Redis=require(_0x83a6('0x1'));var interactionService=require(_0x83a6('0x2'));var qs=require(_0x83a6('0x3'));var logger=require(_0x83a6('0x4'))(_0x83a6('0x5'));var config=require('../../config/environment');var db=require(_0x83a6('0x6'))['db'];config[_0x83a6('0x7')]=_[_0x83a6('0x8')](config[_0x83a6('0x7')],{'host':_0x83a6('0x9'),'port':0x18eb});var socket=require(_0x83a6('0xa'))(new Redis(config['redis']));require(_0x83a6('0xb'))[_0x83a6('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x83a6('0xd')][_0x83a6('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x83a6('0xe')]({'port':0x232a});var interaction_log=require(_0x83a6('0x4'))('chat-interactions');function respondWithRpcPromise(_0x2f201d,_0x817230,_0x192f77,_0x26182e){return new Promise(function(_0x56c570,_0x2df6d4){var _0x27b462=_0x26182e||client;return _0x27b462[_0x83a6('0xf')](_0x2f201d,_0x192f77)['then'](function(_0x46ce92){logger['info'](_0x83a6('0x10'),_0x817230,'request\x20sent');logger[_0x83a6('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x817230,_0x83a6('0x12'),JSON[_0x83a6('0x13')](_0x46ce92));if(_0x46ce92['error']){if(_0x46ce92[_0x83a6('0x14')]['code']===0x1f4){logger[_0x83a6('0x14')](_0x83a6('0x10'),_0x817230,_0x46ce92['error'][_0x83a6('0x15')]);return _0x2df6d4(_0x46ce92[_0x83a6('0x14')][_0x83a6('0x15')]);}logger['error'](_0x83a6('0x10'),_0x817230,_0x46ce92[_0x83a6('0x14')]['message']);return _0x56c570(_0x46ce92['error'][_0x83a6('0x15')]);}else{logger[_0x83a6('0x16')](_0x83a6('0x10'),_0x817230,'request\x20sent');_0x56c570(_0x46ce92[_0x83a6('0x17')][_0x83a6('0x15')]);}})[_0x83a6('0x18')](function(_0x1128b0){logger[_0x83a6('0x14')](_0x83a6('0x10'),_0x817230,_0x1128b0);_0x2df6d4(_0x1128b0);});});}function respondWithResult(_0x4ff2b2,_0x22fc1d){_0x22fc1d=_0x22fc1d||0xc8;return function(_0x5bf3a4){if(_0x5bf3a4){return _0x4ff2b2[_0x83a6('0x19')](_0x22fc1d)[_0x83a6('0x1a')](_0x5bf3a4);}};}function respondWithFilteredResult(_0x102976,_0x5b38a5){return function(_0x598141){if(_0x598141){var _0x2f7ef2=typeof _0x5b38a5[_0x83a6('0x1b')]===_0x83a6('0x1c')&&typeof _0x5b38a5[_0x83a6('0x1d')]==='undefined';var _0xc40d99=_0x598141[_0x83a6('0x1e')];var _0x2f0aeb=_0x2f7ef2?0x0:_0x5b38a5[_0x83a6('0x1b')];var _0x637be1=_0x2f7ef2?_0x598141['count']:_0x5b38a5[_0x83a6('0x1b')]+_0x5b38a5['limit'];var _0x8eee70;if(_0x637be1>=_0xc40d99){_0x637be1=_0xc40d99;_0x8eee70=0xc8;}else{_0x8eee70=0xce;}_0x102976[_0x83a6('0x19')](_0x8eee70);return _0x102976['set'](_0x83a6('0x1f'),_0x2f0aeb+'-'+_0x637be1+'/'+_0xc40d99)[_0x83a6('0x1a')](_0x598141);}return null;};}function saveUpdates(_0x157193){return function(_0x57d30b){if(_0x57d30b){return _0x57d30b['update'](_0x157193)['then'](function(_0x509f7a){return _0x509f7a;});}return null;};}function removeEntity(_0x1d648a){return function(_0x20516e){if(_0x20516e){return _0x20516e['destroy']()[_0x83a6('0x20')](function(){_0x1d648a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e3495){return function(_0x4bf316){if(!_0x4bf316){_0x8e3495['sendStatus'](0x194);}return _0x4bf316;};}function handleError(_0x21e2e2,_0x393a7f){_0x393a7f=_0x393a7f||0x1f4;return function(_0x1ffbfa){logger[_0x83a6('0x14')](_0x1ffbfa[_0x83a6('0x21')]);if(_0x1ffbfa[_0x83a6('0x22')]){delete _0x1ffbfa[_0x83a6('0x22')];}_0x21e2e2[_0x83a6('0x19')](_0x393a7f)[_0x83a6('0x23')](_0x1ffbfa);};}exports[_0x83a6('0x24')]=function(_0x3d0073,_0x1eae99){var _0x50ccc0={},_0x4e94ca={},_0x3d22bc={'count':0x0,'rows':[]};var _0x569fda=_[_0x83a6('0x25')](db['ChatMessage'][_0x83a6('0x26')],function(_0x1c7312){return{'name':_0x1c7312[_0x83a6('0x27')],'type':_0x1c7312['type'][_0x83a6('0x28')]};});_0x4e94ca[_0x83a6('0x29')]=_[_0x83a6('0x25')](_0x569fda,_0x83a6('0x22'));_0x4e94ca[_0x83a6('0x2a')]=_['keys'](_0x3d0073[_0x83a6('0x2a')]);_0x4e94ca[_0x83a6('0x2b')]=_[_0x83a6('0x2c')](_0x4e94ca[_0x83a6('0x29')],_0x4e94ca[_0x83a6('0x2a')]);_0x50ccc0['attributes']=_[_0x83a6('0x2c')](_0x4e94ca[_0x83a6('0x29')],qs['fields'](_0x3d0073[_0x83a6('0x2a')][_0x83a6('0x2d')]));_0x50ccc0[_0x83a6('0x2e')]=_0x50ccc0[_0x83a6('0x2e')][_0x83a6('0x2f')]?_0x50ccc0[_0x83a6('0x2e')]:_0x4e94ca[_0x83a6('0x29')];if(!_0x3d0073['query'][_0x83a6('0x30')](_0x83a6('0x31'))){_0x50ccc0[_0x83a6('0x1d')]=qs[_0x83a6('0x1d')](_0x3d0073[_0x83a6('0x2a')]['limit']);_0x50ccc0[_0x83a6('0x1b')]=qs[_0x83a6('0x1b')](_0x3d0073[_0x83a6('0x2a')][_0x83a6('0x1b')]);}_0x50ccc0[_0x83a6('0x32')]=qs['sort'](_0x3d0073['query'][_0x83a6('0x33')]);_0x50ccc0[_0x83a6('0x34')]=qs['filters'](_[_0x83a6('0x35')](_0x3d0073[_0x83a6('0x2a')],_0x4e94ca[_0x83a6('0x2b')]),_0x569fda);if(_0x3d0073[_0x83a6('0x2a')][_0x83a6('0x36')]){_0x50ccc0[_0x83a6('0x34')]=_[_0x83a6('0x37')](_0x50ccc0[_0x83a6('0x34')],{'$or':_[_0x83a6('0x25')](_0x569fda,function(_0x4ae5bf){if(_0x4ae5bf[_0x83a6('0x38')]!==_0x83a6('0x39')){var _0x151b12={};_0x151b12[_0x4ae5bf[_0x83a6('0x22')]]={'$like':'%'+_0x3d0073[_0x83a6('0x2a')][_0x83a6('0x36')]+'%'};return _0x151b12;}})});}_0x50ccc0=_[_0x83a6('0x37')]({},_0x50ccc0,_0x3d0073['options']);var _0x459e74={'where':_0x50ccc0[_0x83a6('0x34')]};return db[_0x83a6('0x3a')][_0x83a6('0x1e')](_0x459e74)[_0x83a6('0x20')](function(_0x342e4d){_0x3d22bc[_0x83a6('0x1e')]=_0x342e4d;if(_0x3d0073['query'][_0x83a6('0x3b')]){_0x50ccc0['include']=[{'all':!![]}];}return db['ChatMessage'][_0x83a6('0x3c')](_0x50ccc0);})[_0x83a6('0x20')](function(_0x75e073){_0x3d22bc[_0x83a6('0x3d')]=_0x75e073;return _0x3d22bc;})[_0x83a6('0x20')](respondWithFilteredResult(_0x1eae99,_0x50ccc0))[_0x83a6('0x18')](handleError(_0x1eae99,null));};exports[_0x83a6('0x3e')]=function(_0x1baf74,_0x561887){var _0x2ed145={'raw':!![],'where':{'id':_0x1baf74[_0x83a6('0x3f')]['id']}},_0x47f168={};_0x47f168[_0x83a6('0x29')]=_[_0x83a6('0x40')](db['ChatMessage'][_0x83a6('0x26')]);_0x47f168[_0x83a6('0x2a')]=_[_0x83a6('0x40')](_0x1baf74['query']);_0x47f168[_0x83a6('0x2b')]=_[_0x83a6('0x2c')](_0x47f168[_0x83a6('0x29')],_0x47f168[_0x83a6('0x2a')]);_0x2ed145[_0x83a6('0x2e')]=_[_0x83a6('0x2c')](_0x47f168[_0x83a6('0x29')],qs['fields'](_0x1baf74['query'][_0x83a6('0x2d')]));_0x2ed145[_0x83a6('0x2e')]=_0x2ed145[_0x83a6('0x2e')][_0x83a6('0x2f')]?_0x2ed145[_0x83a6('0x2e')]:_0x47f168[_0x83a6('0x29')];if(_0x1baf74[_0x83a6('0x2a')][_0x83a6('0x3b')]){_0x2ed145['include']=[{'all':!![]}];}_0x2ed145=_['merge']({},_0x2ed145,_0x1baf74[_0x83a6('0x41')]);return db[_0x83a6('0x3a')]['find'](_0x2ed145)[_0x83a6('0x20')](handleEntityNotFound(_0x561887,null))[_0x83a6('0x20')](respondWithResult(_0x561887,null))[_0x83a6('0x18')](handleError(_0x561887,null));};exports[_0x83a6('0x42')]=function(_0x44442f,_0x4f5b7a){return db['ChatMessage'][_0x83a6('0x42')](_0x44442f[_0x83a6('0x43')],{})[_0x83a6('0x20')](respondWithResult(_0x4f5b7a,0xc9))[_0x83a6('0x18')](handleError(_0x4f5b7a,null));};exports[_0x83a6('0x44')]=function(_0x225874,_0x6f7acc){if(_0x225874[_0x83a6('0x43')]['id']){delete _0x225874[_0x83a6('0x43')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x225874[_0x83a6('0x3f')]['id']}})[_0x83a6('0x20')](handleEntityNotFound(_0x6f7acc,null))[_0x83a6('0x20')](saveUpdates(_0x225874['body'],null))[_0x83a6('0x20')](respondWithResult(_0x6f7acc,null))[_0x83a6('0x18')](handleError(_0x6f7acc,null));};exports['destroy']=function(_0x393a7a,_0x1f08fe){return db[_0x83a6('0x3a')][_0x83a6('0x45')]({'where':{'id':_0x393a7a['params']['id']}})[_0x83a6('0x20')](handleEntityNotFound(_0x1f08fe,null))['then'](removeEntity(_0x1f08fe,null))[_0x83a6('0x18')](handleError(_0x1f08fe,null));};exports[_0x83a6('0x46')]=function(_0x3605fe,_0x318a47){return db[_0x83a6('0x3a')][_0x83a6('0x46')]()[_0x83a6('0x20')](respondWithResult(_0x318a47,null))[_0x83a6('0x18')](handleError(_0x318a47,null));};exports['accept']=function(_0x2701a2,_0x39eace){var _0x2ca612='chat';return interactionService['acceptMessage'](_0x2701a2,_0x2ca612)['then'](respondWithResult(_0x39eace,null))[_0x83a6('0x18')](handleError(_0x39eace,null));};exports[_0x83a6('0x47')]=function(_0x57b203,_0x1c74db){var _0x12f818={'agent':{},'channel':_0x83a6('0x48')};if(_0x57b203[_0x83a6('0x43')]['id']){delete _0x57b203['body']['id'];}_0x57b203[_0x83a6('0x43')][_0x83a6('0x49')]=_0x57b203[_0x83a6('0x43')][_0x83a6('0x49')]||_0x57b203[_0x83a6('0x4a')]['id'];_0x12f818[_0x83a6('0x4b')]['id']=_0x57b203[_0x83a6('0x43')][_0x83a6('0x49')];return db[_0x83a6('0x3a')]['find']({'where':{'id':_0x57b203[_0x83a6('0x3f')]['id'],'UserId':null}})[_0x83a6('0x20')](handleEntityNotFound(_0x1c74db,null))[_0x83a6('0x20')](function(_0x3d4840){if(_0x3d4840){_0x12f818[_0x83a6('0x15')]=_0x3d4840['get']({'plain':!![]});return db[_0x83a6('0x4c')][_0x83a6('0x45')]({'where':{'id':_0x3d4840[_0x83a6('0x4d')]}});}return null;})['then'](handleEntityNotFound(_0x1c74db,null))['then'](function(_0x1b002b){if(_0x1b002b){_0x12f818[_0x83a6('0x4e')]=_0x1b002b[_0x83a6('0x4f')]({'plain':!![]});interaction_log[_0x83a6('0x16')](_0x83a6('0x50'),_0x57b203['user']['id'],_0x57b203['user'][_0x83a6('0x22')],_0x57b203[_0x83a6('0x4a')]['role'],_0x12f818[_0x83a6('0x4e')]['id'],_0x57b203['body']?JSON[_0x83a6('0x13')](_0x57b203[_0x83a6('0x43')]):_0x83a6('0x51'));return respondWithRpcPromise(_0x83a6('0x52'),'rejectMessage',_0x12f818);}return null;})[_0x83a6('0x20')](function(_0x54f4d5){var _0x514c2b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54f4d5[_0x83a6('0x15')][_0x83a6('0x53')];return db[_0x83a6('0x54')][_0x83a6('0x2a')](_0x514c2b,{'type':db[_0x83a6('0x55')]['QueryTypes'][_0x83a6('0x56')],'raw':!![]})[_0x83a6('0x20')](function(_0x17678b){return _0x17678b;});})[_0x83a6('0x20')](function(_0x5c6225){if(_0x5c6225){_0x12f818['message'][_0x83a6('0x57')]=_0x5c6225[0x0];if(!_0x57b203[_0x83a6('0x43')][_0x83a6('0x49')])return;return db[_0x83a6('0x58')][_0x83a6('0x45')]({'where':{'id':_0x57b203[_0x83a6('0x43')]['UserId'],'role':'agent'},'attributes':['id','name',_0x83a6('0x59'),_0x83a6('0x5a'),'internal'],'raw':!![]});}return null;})[_0x83a6('0x20')](function(_0x14dbd1){if(!_0x14dbd1)return null;_0x12f818['message'][_0x83a6('0x4b')]=_0x14dbd1;return _0x12f818;})[_0x83a6('0x20')](function(_0x3cb0b8){if(_0x3cb0b8){_0x3cb0b8[_0x83a6('0x15')][_0x83a6('0x5b')]=util[_0x83a6('0x5c')](_0x83a6('0x5d'),_0x57b203[_0x83a6('0x4a')][_0x83a6('0x22')]);_0x3cb0b8['message'][_0x83a6('0x5e')]=_0x12f818[_0x83a6('0x5e')];_0x3cb0b8[_0x83a6('0x15')][_0x83a6('0x5f')]=_0x12f818[_0x83a6('0x5e')];_0x3cb0b8[_0x83a6('0x15')]['event']=_0x83a6('0x47');respondWithRpcPromise(_0x83a6('0x60'),_0x83a6('0x60'),{'event':_0x83a6('0x61'),'message':_[_0x83a6('0x37')](_0x12f818[_0x83a6('0x15')],JSON[_0x83a6('0x62')](_0x12f818['interaction'][_0x83a6('0x63')]))},client9002);return _0x12f818;}return null;})[_0x83a6('0x20')](respondWithResult(_0x1c74db,null))[_0x83a6('0x18')](handleError(_0x1c74db,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 738e15b..4cabc87 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 _0x6bab=['events','../../mysqldb','save','remove','emit','hasOwnProperty','exports'];(function(_0x597f0d,_0x49508b){var _0x4b66ef=function(_0xbc756c){while(--_0xbc756c){_0x597f0d['push'](_0x597f0d['shift']());}};_0x4b66ef(++_0x49508b);}(_0x6bab,0x1e3));var _0xb6ba=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x6bab[_0x2390bd];return _0x3a969d;};'use strict';var EventEmitter=require(_0xb6ba('0x0'));var ChatMessage=require(_0xb6ba('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6ba('0x2'),'afterUpdate':'update','afterDestroy':_0xb6ba('0x3')};function emitEvent(_0x37e2c9){return function(_0x3db3eb,_0x43c284,_0x15c200){ChatMessageEvents[_0xb6ba('0x4')](_0x37e2c9+':'+_0x3db3eb['id'],_0x3db3eb);ChatMessageEvents[_0xb6ba('0x4')](_0x37e2c9,_0x3db3eb);_0x15c200(null);};}for(var e in events){if(events[_0xb6ba('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb6ba('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x4564=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4564,0xfc));var _0x4456=function(_0x7fb487,_0x32182b){_0x7fb487=_0x7fb487-0x0;var _0x39fb59=_0x4564[_0x7fb487];return _0x39fb59;};'use strict';var EventEmitter=require(_0x4456('0x0'));var ChatMessage=require(_0x4456('0x1'))['db'][_0x4456('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4456('0x3')](0x0);var events={'afterCreate':_0x4456('0x4'),'afterUpdate':_0x4456('0x5'),'afterDestroy':_0x4456('0x6')};function emitEvent(_0x3f3785){return function(_0x2ab069,_0x2299b3,_0x4a33bd){ChatMessageEvents[_0x4456('0x7')](_0x3f3785+':'+_0x2ab069['id'],_0x2ab069);ChatMessageEvents[_0x4456('0x7')](_0x3f3785,_0x2ab069);_0x4a33bd(null);};}for(var e in events){if(events[_0x4456('0x8')](e)){var event=events[e];ChatMessage[_0x4456('0x9')](e,emitEvent(event));}}module[_0x4456('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b152bb9..37ebd33 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 _0xc0bc=['moment','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x3764b3,_0x23d114){var _0x48f40c=function(_0xdecee1){while(--_0xdecee1){_0x3764b3['push'](_0x3764b3['shift']());}};_0x48f40c(++_0x23d114);}(_0xc0bc,0x176));var _0xcc0b=function(_0x35b0ec,_0x28ff81){_0x35b0ec=_0x35b0ec-0x0;var _0x2dd601=_0xc0bc[_0x35b0ec];return _0x2dd601;};'use strict';var _=require('lodash');var util=require(_0xcc0b('0x0'));var logger=require(_0xcc0b('0x1'))(_0xcc0b('0x2'));var moment=require(_0xcc0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc0b('0x4'));var fs=require('fs');var path=require(_0xcc0b('0x5'));var rimraf=require(_0xcc0b('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc0b('0x7'));module[_0xcc0b('0x8')]=function(_0x526a0d,_0x5b427c){return _0x526a0d[_0xcc0b('0x9')](_0xcc0b('0xa'),attributes,{'tableName':_0xcc0b('0xb'),'paranoid':![],'indexes':[{'name':_0xcc0b('0xc'),'fields':[_0xcc0b('0xd')],'type':_0xcc0b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53c0e7,_0x235b6c,_0x58c6a7){var _0x44c706=_0x526a0d['models'];var _0x822723=_0x53c0e7[_0xcc0b('0xf')]({'plain':!![]});if(_0x822723[_0xcc0b('0x10')][_0xcc0b('0x11')]()==='in'||_0x822723['direction'][_0xcc0b('0x11')]()==='out'&&!_0x822723[_0xcc0b('0x12')]&&!_[_0xcc0b('0x13')](_0x822723[_0xcc0b('0x14')])){_0x44c706['ChatInteraction'][_0xcc0b('0x15')]({'where':{'id':_0x822723[_0xcc0b('0x16')]}})[_0xcc0b('0x17')](function(_0xd77f39){if(_0xd77f39){_0xd77f39['update']({'lastMsgAt':_0x822723[_0xcc0b('0x18')],'lastMsgDirection':_0x822723[_0xcc0b('0x10')][_0xcc0b('0x11')]()});}})[_0xcc0b('0x19')](function(_0x43835a){console[_0xcc0b('0x1a')](_0x43835a);});}_0x58c6a7();}},'charset':_0xcc0b('0x1b'),'collate':_0xcc0b('0x1c')});}; \ No newline at end of file +var _0xdcd5=['then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x9d1556,_0x22622f){var _0x2d2cea=function(_0x266ee1){while(--_0x266ee1){_0x9d1556['push'](_0x9d1556['shift']());}};_0x2d2cea(++_0x22622f);}(_0xdcd5,0x1a9));var _0x5dcd=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0xdcd5[_0x2f3d29];return _0x53d69d;};'use strict';var _=require(_0x5dcd('0x0'));var util=require('util');var logger=require(_0x5dcd('0x1'))(_0x5dcd('0x2'));var moment=require(_0x5dcd('0x3'));var BPromise=require('bluebird');var rp=require(_0x5dcd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dcd('0x5'));var config=require(_0x5dcd('0x6'));var attributes=require('./chatMessage.attributes');module[_0x5dcd('0x7')]=function(_0x938bdf,_0x995967){return _0x938bdf[_0x5dcd('0x8')](_0x5dcd('0x9'),attributes,{'tableName':_0x5dcd('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x5dcd('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b8e85,_0x40c557,_0x24fba5){var _0x41ec14=_0x938bdf[_0x5dcd('0xc')];var _0x5b07ed=_0x4b8e85[_0x5dcd('0xd')]({'plain':!![]});if(_0x5b07ed[_0x5dcd('0xe')][_0x5dcd('0xf')]()==='in'||_0x5b07ed['direction'][_0x5dcd('0xf')]()===_0x5dcd('0x10')&&!_0x5b07ed[_0x5dcd('0x11')]&&!_[_0x5dcd('0x12')](_0x5b07ed[_0x5dcd('0x13')])){_0x41ec14[_0x5dcd('0x14')][_0x5dcd('0x15')]({'where':{'id':_0x5b07ed[_0x5dcd('0x16')]}})[_0x5dcd('0x17')](function(_0x4a13c0){if(_0x4a13c0){_0x4a13c0[_0x5dcd('0x18')]({'lastMsgAt':_0x5b07ed[_0x5dcd('0x19')],'lastMsgDirection':_0x5b07ed[_0x5dcd('0xe')][_0x5dcd('0xf')]()});}})['catch'](function(_0x1468c9){console[_0x5dcd('0x1a')](_0x1468c9);});}_0x24fba5();}},'charset':_0x5dcd('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 22fd5c9..249383d 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 _0xbf3e=['ioredis','../../config/logger','rpc','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','lodash','util','bluebird','randomstring'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xbf3e,0x1e9));var _0xebf3=function(_0x469afd,_0x3b6353){_0x469afd=_0x469afd-0x0;var _0x10b8e5=_0xbf3e[_0x469afd];return _0x10b8e5;};'use strict';var _=require(_0xebf3('0x0'));var util=require(_0xebf3('0x1'));var moment=require('moment');var BPromise=require(_0xebf3('0x2'));var rs=require(_0xebf3('0x3'));var fs=require('fs');var Redis=require(_0xebf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xebf3('0x5'))(_0xebf3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xebf3('0x7')][_0xebf3('0x8')]({'port':0x232a});config[_0xebf3('0x9')]=_[_0xebf3('0xa')](config['redis'],{'host':_0xebf3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebf3('0x9')]));require(_0xebf3('0xc'))[_0xebf3('0xd')](socket);function respondWithRpcPromise(_0x2ad341,_0x51b31e,_0x587f34){return new BPromise(function(_0x449e96,_0x525315){return client['request'](_0x2ad341,_0x587f34)[_0xebf3('0xe')](function(_0x2ecdce){logger[_0xebf3('0xf')]('ChatMessage,\x20%s,\x20%s',_0x51b31e,_0xebf3('0x10'));logger[_0xebf3('0x11')](_0xebf3('0x12'),_0x51b31e,'request\x20sent',JSON['stringify'](_0x2ecdce));if(_0x2ecdce[_0xebf3('0x13')]){if(_0x2ecdce['error'][_0xebf3('0x14')]===0x1f4){logger[_0xebf3('0x13')](_0xebf3('0x15'),_0x51b31e,_0x2ecdce['error'][_0xebf3('0x16')]);return _0x525315(_0x2ecdce[_0xebf3('0x13')][_0xebf3('0x16')]);}logger[_0xebf3('0x13')](_0xebf3('0x15'),_0x51b31e,_0x2ecdce['error']['message']);return _0x449e96(_0x2ecdce[_0xebf3('0x13')][_0xebf3('0x16')]);}else{logger[_0xebf3('0xf')](_0xebf3('0x15'),_0x51b31e,_0xebf3('0x10'));_0x449e96(_0x2ecdce[_0xebf3('0x17')][_0xebf3('0x16')]);}})[_0xebf3('0x18')](function(_0x44f18e){logger[_0xebf3('0x13')](_0xebf3('0x15'),_0x51b31e,_0x44f18e);_0x525315(_0x44f18e);});});}exports[_0xebf3('0x19')]=function(_0x3cc01a){var _0x147aaf=this;return new Promise(function(_0x17a26c,_0x1a30cc){return db['ChatMessage'][_0xebf3('0x1a')](_0x3cc01a[_0xebf3('0x1b')],{'raw':_0x3cc01a[_0xebf3('0x1c')]?_0x3cc01a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2efe43){logger[_0xebf3('0xf')](_0xebf3('0x19'),_0x3cc01a);logger['debug'](_0xebf3('0x19'),_0x3cc01a,JSON['stringify'](_0x2efe43));_0x17a26c(_0x2efe43);})[_0xebf3('0x18')](function(_0x5ef606){logger[_0xebf3('0x13')](_0xebf3('0x19'),_0x5ef606[_0xebf3('0x16')],_0x3cc01a);_0x1a30cc(_0x147aaf[_0xebf3('0x13')](0x1f4,_0x5ef606[_0xebf3('0x16')]));});});}; \ No newline at end of file +var _0x1b6e=['error','message','result','catch','CreateChatMessage','create','body','options','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x52d4ee,_0x64e207){var _0x51d053=function(_0x32b659){while(--_0x32b659){_0x52d4ee['push'](_0x52d4ee['shift']());}};_0x51d053(++_0x64e207);}(_0x1b6e,0x1d8));var _0xe1b6=function(_0x5a12a5,_0x20c182){_0x5a12a5=_0x5a12a5-0x0;var _0x5d384c=_0x1b6e[_0x5a12a5];return _0x5d384c;};'use strict';var _=require(_0xe1b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe1b6('0x1'));var fs=require('fs');var Redis=require(_0xe1b6('0x2'));var db=require(_0xe1b6('0x3'))['db'];var utils=require(_0xe1b6('0x4'));var logger=require(_0xe1b6('0x5'))(_0xe1b6('0x6'));var config=require(_0xe1b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1b6('0x8')][_0xe1b6('0x9')]({'port':0x232a});config[_0xe1b6('0xa')]=_['defaults'](config[_0xe1b6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1b6('0xb'))(new Redis(config['redis']));require(_0xe1b6('0xc'))['register'](socket);function respondWithRpcPromise(_0x313181,_0x107b90,_0x2cc31c){return new BPromise(function(_0x162d11,_0xe3673){return client[_0xe1b6('0xd')](_0x313181,_0x2cc31c)[_0xe1b6('0xe')](function(_0x5ee723){logger[_0xe1b6('0xf')](_0xe1b6('0x10'),_0x107b90,'request\x20sent');logger[_0xe1b6('0x11')](_0xe1b6('0x12'),_0x107b90,_0xe1b6('0x13'),JSON[_0xe1b6('0x14')](_0x5ee723));if(_0x5ee723[_0xe1b6('0x15')]){if(_0x5ee723[_0xe1b6('0x15')]['code']===0x1f4){logger[_0xe1b6('0x15')]('ChatMessage,\x20%s,\x20%s',_0x107b90,_0x5ee723[_0xe1b6('0x15')]['message']);return _0xe3673(_0x5ee723[_0xe1b6('0x15')][_0xe1b6('0x16')]);}logger[_0xe1b6('0x15')](_0xe1b6('0x10'),_0x107b90,_0x5ee723[_0xe1b6('0x15')][_0xe1b6('0x16')]);return _0x162d11(_0x5ee723[_0xe1b6('0x15')][_0xe1b6('0x16')]);}else{logger[_0xe1b6('0xf')](_0xe1b6('0x10'),_0x107b90,_0xe1b6('0x13'));_0x162d11(_0x5ee723[_0xe1b6('0x17')][_0xe1b6('0x16')]);}})[_0xe1b6('0x18')](function(_0x4c1aca){logger[_0xe1b6('0x15')](_0xe1b6('0x10'),_0x107b90,_0x4c1aca);_0xe3673(_0x4c1aca);});});}exports[_0xe1b6('0x19')]=function(_0x108728){var _0x4e517a=this;return new Promise(function(_0xe8de21,_0x129e66){return db['ChatMessage'][_0xe1b6('0x1a')](_0x108728[_0xe1b6('0x1b')],{'raw':_0x108728['options']?_0x108728[_0xe1b6('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24d69e){logger[_0xe1b6('0xf')](_0xe1b6('0x19'),_0x108728);logger[_0xe1b6('0x11')](_0xe1b6('0x19'),_0x108728,JSON[_0xe1b6('0x14')](_0x24d69e));_0xe8de21(_0x24d69e);})[_0xe1b6('0x18')](function(_0x38a3db){logger[_0xe1b6('0x15')](_0xe1b6('0x19'),_0x38a3db[_0xe1b6('0x16')],_0x108728);_0x129e66(_0x4e517a['error'](0x1f4,_0x38a3db[_0xe1b6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 16d5df2..9830c9c 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 _0x46fc=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x2777ef,_0x1f7721){var _0xd4b76a=function(_0x48518b){while(--_0x48518b){_0x2777ef['push'](_0x2777ef['shift']());}};_0xd4b76a(++_0x1f7721);}(_0x46fc,0x103));var _0xc46f=function(_0x1a50e5,_0x14accb){_0x1a50e5=_0x1a50e5-0x0;var _0x53b463=_0x46fc[_0x1a50e5];return _0x53b463;};'use strict';var ChatMessageEvents=require(_0xc46f('0x0'));var events=[_0xc46f('0x1'),_0xc46f('0x2'),_0xc46f('0x3')];function createListener(_0x865c60,_0x9460ea){return function(_0x2bf9ee){_0x9460ea[_0xc46f('0x4')](_0x865c60,_0x2bf9ee);};}function removeListener(_0x3a56db,_0x5b0483){return function(){ChatMessageEvents['removeListener'](_0x3a56db,_0x5b0483);};}exports[_0xc46f('0x5')]=function(_0x176c6f){for(var _0x30ca8d=0x0,_0x15904c=events[_0xc46f('0x6')];_0x30ca8d<_0x15904c;_0x30ca8d++){var _0x312101=events[_0x30ca8d];var _0x155a10=createListener(_0xc46f('0x7')+_0x312101,_0x176c6f);ChatMessageEvents['on'](_0x312101,_0x155a10);}}; \ No newline at end of file +var _0x85d0=['emit','register','length','chatMessage:'];(function(_0x185925,_0x3cf438){var _0x5a34dc=function(_0x269f37){while(--_0x269f37){_0x185925['push'](_0x185925['shift']());}};_0x5a34dc(++_0x3cf438);}(_0x85d0,0x164));var _0x085d=function(_0x33233f,_0x510bc2){_0x33233f=_0x33233f-0x0;var _0xe8ba55=_0x85d0[_0x33233f];return _0xe8ba55;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){ChatMessageEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);ChatMessageEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4167120..2b89d4f 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 _0x2ba8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x2ba8,0x6e));var _0x82ba=function(_0x158241,_0x236288){_0x158241=_0x158241-0x0;var _0x1dd068=_0x2ba8[_0x158241];return _0x1dd068;};'use strict';var multer=require(_0x82ba('0x0'));var util=require('util');var path=require(_0x82ba('0x1'));var timeout=require(_0x82ba('0x2'));var express=require(_0x82ba('0x3'));var router=express[_0x82ba('0x4')]();var fs_extra=require(_0x82ba('0x5'));var auth=require(_0x82ba('0x6'));var interaction=require(_0x82ba('0x7'));var config=require(_0x82ba('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x82ba('0x9')](),controller['index']);router[_0x82ba('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x82ba('0xa')](_0x82ba('0xb'),auth[_0x82ba('0x9')](),controller[_0x82ba('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x82ba('0xd'),_0x82ba('0xe')),controller[_0x82ba('0xf')]);router[_0x82ba('0x10')](_0x82ba('0xb'),controller['update']);router['put']('/:id/accept',auth[_0x82ba('0x9')](),controller[_0x82ba('0x11')]);router[_0x82ba('0x10')](_0x82ba('0x12'),auth[_0x82ba('0x9')](),controller[_0x82ba('0x13')]);router[_0x82ba('0x14')](_0x82ba('0xb'),auth['isAuthenticated'](),controller[_0x82ba('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8fad=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5e4740,_0x2e4ed7){var _0x314894=function(_0x35d383){while(--_0x35d383){_0x5e4740['push'](_0x5e4740['shift']());}};_0x314894(++_0x2e4ed7);}(_0x8fad,0x65));var _0xd8fa=function(_0x4e7f11,_0x56d30c){_0x4e7f11=_0x4e7f11-0x0;var _0x30633a=_0x8fad[_0x4e7f11];return _0x30633a;};'use strict';var multer=require(_0xd8fa('0x0'));var util=require(_0xd8fa('0x1'));var path=require(_0xd8fa('0x2'));var timeout=require(_0xd8fa('0x3'));var express=require(_0xd8fa('0x4'));var router=express[_0xd8fa('0x5')]();var fs_extra=require(_0xd8fa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8fa('0x7'));var config=require(_0xd8fa('0x8'));var controller=require(_0xd8fa('0x9'));router[_0xd8fa('0xa')]('/',auth[_0xd8fa('0xb')](),controller[_0xd8fa('0xc')]);router['get']('/describe',auth[_0xd8fa('0xb')](),controller['describe']);router[_0xd8fa('0xa')](_0xd8fa('0xd'),auth[_0xd8fa('0xb')](),controller[_0xd8fa('0xe')]);router[_0xd8fa('0xf')]('/',auth[_0xd8fa('0xb')](),interaction['tracked'](_0xd8fa('0x10'),_0xd8fa('0x11')),controller[_0xd8fa('0x12')]);router[_0xd8fa('0x13')](_0xd8fa('0xd'),controller[_0xd8fa('0x14')]);router[_0xd8fa('0x13')](_0xd8fa('0x15'),auth[_0xd8fa('0xb')](),controller[_0xd8fa('0x16')]);router[_0xd8fa('0x13')](_0xd8fa('0x17'),auth[_0xd8fa('0xb')](),controller['reject']);router[_0xd8fa('0x18')]('/:id',auth[_0xd8fa('0xb')](),controller[_0xd8fa('0x19')]);module[_0xd8fa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e39475c..f9a0b1e 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x757a,0xde));var _0xa757=function(_0xd51ae0,_0x197b10){_0xd51ae0=_0xd51ae0-0x0;var _0x204c3a=_0x757a[_0xd51ae0];return _0x204c3a;};'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 _0x5f66=['medium','TEXT','exports'];(function(_0x267a32,_0x20480f){var _0x33e7e9=function(_0x3ac9bb){while(--_0x3ac9bb){_0x267a32['push'](_0x267a32['shift']());}};_0x33e7e9(++_0x20480f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cf307f1..81cfbba 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 _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(_0x4aa3b4,_0x53970e){var _0x5447e1=function(_0x54df7d){while(--_0x54df7d){_0x4aa3b4['push'](_0x4aa3b4['shift']());}};_0x5447e1(++_0x53970e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 +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(_0x101ce3,_0x5c6db1){var _0x63b658=function(_0x22ff8d){while(--_0x22ff8d){_0x101ce3['push'](_0x101ce3['shift']());}};_0x63b658(++_0x5c6db1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 09b136b..7db4b36 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 _0xbc9b=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3193f1,_0x3503b9){var _0x3c7c76=function(_0x386007){while(--_0x386007){_0x3193f1['push'](_0x3193f1['shift']());}};_0x3c7c76(++_0x3503b9);}(_0xbc9b,0x9e));var _0xbbc9=function(_0x2b8ff6,_0x54639b){_0x2b8ff6=_0x2b8ff6-0x0;var _0xe6d789=_0xbc9b[_0x2b8ff6];return _0xe6d789;};'use strict';var EventEmitter=require(_0xbbc9('0x0'));var ChatOfflineMessage=require(_0xbbc9('0x1'))['db'][_0xbbc9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xbbc9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbbc9('0x4'),'afterDestroy':_0xbbc9('0x5')};function emitEvent(_0x2dd792){return function(_0x8d64d8,_0x3ffa65,_0x5ed1a4){ChatOfflineMessageEvents[_0xbbc9('0x6')](_0x2dd792+':'+_0x8d64d8['id'],_0x8d64d8);ChatOfflineMessageEvents['emit'](_0x2dd792,_0x8d64d8);_0x5ed1a4(null);};}for(var e in events){if(events[_0xbbc9('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xbbc9('0x8')](e,emitEvent(event));}}module[_0xbbc9('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x57e8=['exports','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x3f724a,_0x50581c){var _0x41bbf2=function(_0x177952){while(--_0x177952){_0x3f724a['push'](_0x3f724a['shift']());}};_0x41bbf2(++_0x50581c);}(_0x57e8,0x10a));var _0x857e=function(_0xe5b0fd,_0x502084){_0xe5b0fd=_0xe5b0fd-0x0;var _0x56cb02=_0x57e8[_0xe5b0fd];return _0x56cb02;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x857e('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x857e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x333dc6){return function(_0x8df9a0,_0x440ec1,_0x4d789c){ChatOfflineMessageEvents[_0x857e('0x2')](_0x333dc6+':'+_0x8df9a0['id'],_0x8df9a0);ChatOfflineMessageEvents[_0x857e('0x2')](_0x333dc6,_0x8df9a0);_0x4d789c(null);};}for(var e in events){if(events[_0x857e('0x3')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x857e('0x4')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bea86bb..b2ce403 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 _0xc29b=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x240096,_0x4a8c21){var _0x59a87b=function(_0x2f68c3){while(--_0x2f68c3){_0x240096['push'](_0x240096['shift']());}};_0x59a87b(++_0x4a8c21);}(_0xc29b,0x1d9));var _0xbc29=function(_0x3b55e1,_0x3da326){_0x3b55e1=_0x3b55e1-0x0;var _0x2f1a16=_0xc29b[_0x3b55e1];return _0x2f1a16;};'use strict';var attributes=require(_0xbc29('0x0'));module['exports']=function(_0x3074a4){return _0x3074a4[_0xbc29('0x1')](_0xbc29('0x2'),attributes,{'tableName':_0xbc29('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbc29('0x4')});}; \ No newline at end of file +var _0xc6e8=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x1ee30f,_0xd6880a){var _0x5774b9=function(_0x4f98a5){while(--_0x4f98a5){_0x1ee30f['push'](_0x1ee30f['shift']());}};_0x5774b9(++_0xd6880a);}(_0xc6e8,0xb6));var _0x8c6e=function(_0x48a766,_0x2b095a){_0x48a766=_0x48a766-0x0;var _0x4a2207=_0xc6e8[_0x48a766];return _0x4a2207;};'use strict';var attributes=require(_0x8c6e('0x0'));module[_0x8c6e('0x1')]=function(_0x136208){return _0x136208['define']('ChatOfflineMessage',attributes,{'tableName':_0x8c6e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c6e('0x3'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index efadef4..9c5d4ba 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 _0xc1b6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x2e2616,_0x15afe2){var _0x572c57=function(_0x1243b8){while(--_0x1243b8){_0x2e2616['push'](_0x2e2616['shift']());}};_0x572c57(++_0x15afe2);}(_0xc1b6,0xfb));var _0x6c1b=function(_0x820d7b,_0xa5564c){_0x820d7b=_0x820d7b-0x0;var _0x249af0=_0xc1b6[_0x820d7b];return _0x249af0;};'use strict';var _=require(_0x6c1b('0x0'));var util=require(_0x6c1b('0x1'));var moment=require(_0x6c1b('0x2'));var BPromise=require(_0x6c1b('0x3'));var rs=require(_0x6c1b('0x4'));var fs=require('fs');var Redis=require(_0x6c1b('0x5'));var db=require(_0x6c1b('0x6'))['db'];var utils=require(_0x6c1b('0x7'));var logger=require(_0x6c1b('0x8'))(_0x6c1b('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c1b('0xa'));var client=jayson[_0x6c1b('0xb')][_0x6c1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c82c0,_0x14aedf,_0xccd626){return new BPromise(function(_0x1edcc2,_0x3cac92){return client['request'](_0x3c82c0,_0xccd626)['then'](function(_0x1614c2){logger[_0x6c1b('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x14aedf,_0x6c1b('0xe'));logger[_0x6c1b('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x14aedf,'request\x20sent',JSON[_0x6c1b('0x10')](_0x1614c2));if(_0x1614c2[_0x6c1b('0x11')]){if(_0x1614c2[_0x6c1b('0x11')][_0x6c1b('0x12')]===0x1f4){logger[_0x6c1b('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x14aedf,_0x1614c2[_0x6c1b('0x11')]['message']);return _0x3cac92(_0x1614c2[_0x6c1b('0x11')]['message']);}logger[_0x6c1b('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x14aedf,_0x1614c2[_0x6c1b('0x11')][_0x6c1b('0x13')]);return _0x1edcc2(_0x1614c2['error'][_0x6c1b('0x13')]);}else{logger[_0x6c1b('0xd')](_0x6c1b('0x14'),_0x14aedf,_0x6c1b('0xe'));_0x1edcc2(_0x1614c2[_0x6c1b('0x15')][_0x6c1b('0x13')]);}})[_0x6c1b('0x16')](function(_0x68258b){logger[_0x6c1b('0x11')](_0x6c1b('0x14'),_0x14aedf,_0x68258b);_0x3cac92(_0x68258b);});});} \ No newline at end of file +var _0xc0c2=['message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc0c2,0x1b7));var _0x2c0c=function(_0x7b717,_0x311539){_0x7b717=_0x7b717-0x0;var _0x50d254=_0xc0c2[_0x7b717];return _0x50d254;};'use strict';var _=require('lodash');var util=require(_0x2c0c('0x0'));var moment=require(_0x2c0c('0x1'));var BPromise=require(_0x2c0c('0x2'));var rs=require(_0x2c0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c0c('0x4'))['db'];var utils=require(_0x2c0c('0x5'));var logger=require(_0x2c0c('0x6'))(_0x2c0c('0x7'));var config=require(_0x2c0c('0x8'));var jayson=require(_0x2c0c('0x9'));var client=jayson[_0x2c0c('0xa')][_0x2c0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5472d9,_0x5730f6,_0x3d6ee6){return new BPromise(function(_0x20d58d,_0x7fe1a9){return client['request'](_0x5472d9,_0x3d6ee6)[_0x2c0c('0xc')](function(_0x5a4c71){logger[_0x2c0c('0xd')](_0x2c0c('0xe'),_0x5730f6,'request\x20sent');logger[_0x2c0c('0xf')](_0x2c0c('0x10'),_0x5730f6,_0x2c0c('0x11'),JSON[_0x2c0c('0x12')](_0x5a4c71));if(_0x5a4c71[_0x2c0c('0x13')]){if(_0x5a4c71[_0x2c0c('0x13')][_0x2c0c('0x14')]===0x1f4){logger[_0x2c0c('0x13')](_0x2c0c('0xe'),_0x5730f6,_0x5a4c71[_0x2c0c('0x13')][_0x2c0c('0x15')]);return _0x7fe1a9(_0x5a4c71[_0x2c0c('0x13')]['message']);}logger[_0x2c0c('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5730f6,_0x5a4c71[_0x2c0c('0x13')][_0x2c0c('0x15')]);return _0x20d58d(_0x5a4c71[_0x2c0c('0x13')][_0x2c0c('0x15')]);}else{logger[_0x2c0c('0xd')](_0x2c0c('0xe'),_0x5730f6,_0x2c0c('0x11'));_0x20d58d(_0x5a4c71['result'][_0x2c0c('0x15')]);}})[_0x2c0c('0x16')](function(_0x4e3703){logger['error'](_0x2c0c('0xe'),_0x5730f6,_0x4e3703);_0x7fe1a9(_0x4e3703);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 54ecc0d..587d047 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 _0xb1ef=['post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','describe','/:id','show'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb1ef,0x168));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var path=require(_0xfb1e('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb1e('0x3'));var router=express[_0xfb1e('0x4')]();var fs_extra=require(_0xfb1e('0x5'));var auth=require(_0xfb1e('0x6'));var interaction=require(_0xfb1e('0x7'));var config=require(_0xfb1e('0x8'));var controller=require(_0xfb1e('0x9'));router[_0xfb1e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfb1e('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfb1e('0xb')]);router[_0xfb1e('0xa')](_0xfb1e('0xc'),auth['isAuthenticated'](),controller[_0xfb1e('0xd')]);router[_0xfb1e('0xe')]('/',auth[_0xfb1e('0xf')](),controller[_0xfb1e('0x10')]);router[_0xfb1e('0x11')](_0xfb1e('0xc'),auth[_0xfb1e('0xf')](),controller[_0xfb1e('0x12')]);router[_0xfb1e('0x13')](_0xfb1e('0xc'),auth[_0xfb1e('0xf')](),controller[_0xfb1e('0x14')]);module[_0xfb1e('0x15')]=router; \ No newline at end of file +var _0xb407=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x3c9363,_0x48021b){var _0x1ea31d=function(_0x4edaf8){while(--_0x4edaf8){_0x3c9363['push'](_0x3c9363['shift']());}};_0x1ea31d(++_0x48021b);}(_0xb407,0x13f));var _0x7b40=function(_0x27fc10,_0x1a8782){_0x27fc10=_0x27fc10-0x0;var _0x141ae3=_0xb407[_0x27fc10];return _0x141ae3;};'use strict';var multer=require(_0x7b40('0x0'));var util=require('util');var path=require(_0x7b40('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b40('0x2'));var router=express[_0x7b40('0x3')]();var fs_extra=require(_0x7b40('0x4'));var auth=require(_0x7b40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b40('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x7b40('0x7')]('/',auth[_0x7b40('0x8')](),controller[_0x7b40('0x9')]);router[_0x7b40('0x7')](_0x7b40('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7b40('0x7')](_0x7b40('0xb'),auth[_0x7b40('0x8')](),controller[_0x7b40('0xc')]);router[_0x7b40('0xd')]('/',auth[_0x7b40('0x8')](),controller['create']);router[_0x7b40('0xe')](_0x7b40('0xb'),auth[_0x7b40('0x8')](),controller[_0x7b40('0xf')]);router[_0x7b40('0x10')](_0x7b40('0xb'),auth[_0x7b40('0x8')](),controller[_0x7b40('0x11')]);module[_0x7b40('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 69899be..76ee5c4 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 _0xe892=['ENUM','mouseOver','timeout','STRING'];(function(_0x26e2b6,_0x46e581){var _0x5976ab=function(_0x2cace3){while(--_0x2cace3){_0x26e2b6['push'](_0x26e2b6['shift']());}};_0x5976ab(++_0x46e581);}(_0xe892,0x73));var _0x2e89=function(_0x1210e6,_0x4329d3){_0x1210e6=_0x1210e6-0x0;var _0x245b77=_0xe892[_0x1210e6];return _0x245b77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e89('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x2e89('0x1')](_0x2e89('0x2'),_0x2e89('0x3')),'defaultValue':_0x2e89('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4b64=['mouseOver','sequelize','exports','STRING','ENUM'];(function(_0x358aa7,_0x73c983){var _0x57a925=function(_0x4bf7cc){while(--_0x4bf7cc){_0x358aa7['push'](_0x358aa7['shift']());}};_0x57a925(++_0x73c983);}(_0x4b64,0x100));var _0x44b6=function(_0x556b28,_0x46061b){_0x556b28=_0x556b28-0x0;var _0x23bfc1=_0x4b64[_0x556b28];return _0x23bfc1;};'use strict';var Sequelize=require(_0x44b6('0x0'));module[_0x44b6('0x1')]={'name':{'type':Sequelize[_0x44b6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x44b6('0x3')](_0x44b6('0x4'),'timeout'),'defaultValue':_0x44b6('0x4')},'selector':{'type':Sequelize[_0x44b6('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 c15b567..f20cd66 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 _0x32ff=['attributes','intersection','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','model'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x32ff,0xc7));var _0xf32f=function(_0x2f0c73,_0x59f591){_0x2f0c73=_0x2f0c73-0x0;var _0xd82041=_0x32ff[_0x2f0c73];return _0xd82041;};'use strict';var emlformat=require(_0xf32f('0x0'));var rimraf=require(_0xf32f('0x1'));var zipdir=require(_0xf32f('0x2'));var jsonpatch=require(_0xf32f('0x3'));var rp=require(_0xf32f('0x4'));var moment=require(_0xf32f('0x5'));var BPromise=require(_0xf32f('0x6'));var Mustache=require(_0xf32f('0x7'));var util=require(_0xf32f('0x8'));var path=require(_0xf32f('0x9'));var sox=require(_0xf32f('0xa'));var csv=require(_0xf32f('0xb'));var ejs=require(_0xf32f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf32f('0xd'));var squel=require('squel');var crypto=require(_0xf32f('0xe'));var jsforce=require(_0xf32f('0xf'));var deskjs=require(_0xf32f('0x10'));var toCsv=require(_0xf32f('0xb'));var querystring=require(_0xf32f('0x11'));var Papa=require(_0xf32f('0x12'));var Redis=require(_0xf32f('0x13'));var authService=require(_0xf32f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf32f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf32f('0x16'));var config=require(_0xf32f('0x17'));var licenseUtil=require(_0xf32f('0x18'));var db=require(_0xf32f('0x19'))['db'];function respondWithStatusCode(_0xe12aea,_0x159f72){_0x159f72=_0x159f72||0xcc;return function(_0x257380){if(_0x257380){return _0xe12aea[_0xf32f('0x1a')](_0x159f72);}return _0xe12aea[_0xf32f('0x1b')](_0x159f72)['end']();};}function respondWithResult(_0x83c7d9,_0x120885){_0x120885=_0x120885||0xc8;return function(_0x174efc){if(_0x174efc){return _0x83c7d9['status'](_0x120885)[_0xf32f('0x1c')](_0x174efc);}};}function respondWithFilteredResult(_0x1750fa,_0xeec5c){return function(_0x160ba1){if(_0x160ba1){var _0x1b7dc3=typeof _0xeec5c[_0xf32f('0x1d')]==='undefined'&&typeof _0xeec5c[_0xf32f('0x1e')]==='undefined';var _0x140126=_0x160ba1['count'];var _0x19ffa2=_0x1b7dc3?0x0:_0xeec5c[_0xf32f('0x1d')];var _0x8cf34d=_0x1b7dc3?_0x160ba1[_0xf32f('0x1f')]:_0xeec5c['offset']+_0xeec5c[_0xf32f('0x1e')];var _0x181d12;if(_0x8cf34d>=_0x140126){_0x8cf34d=_0x140126;_0x181d12=0xc8;}else{_0x181d12=0xce;}_0x1750fa['status'](_0x181d12);return _0x1750fa[_0xf32f('0x20')](_0xf32f('0x21'),_0x19ffa2+'-'+_0x8cf34d+'/'+_0x140126)['json'](_0x160ba1);}return null;};}function patchUpdates(_0x25cb11){return function(_0x40dbdb){try{jsonpatch[_0xf32f('0x22')](_0x40dbdb,_0x25cb11,!![]);}catch(_0xf2fa68){return BPromise[_0xf32f('0x23')](_0xf2fa68);}return _0x40dbdb[_0xf32f('0x24')]();};}function saveUpdates(_0x465f80,_0xe0b16d){return function(_0x48a316){if(_0x48a316){return _0x48a316[_0xf32f('0x25')](_0x465f80)[_0xf32f('0x26')](function(_0xcad45b){return _0xcad45b;});}return null;};}function removeEntity(_0x27007d,_0x360a68){return function(_0x5d0c5a){if(_0x5d0c5a){return _0x5d0c5a[_0xf32f('0x27')]()['then'](function(){_0x27007d[_0xf32f('0x1b')](0xcc)[_0xf32f('0x28')]();});}};}function handleEntityNotFound(_0x52eac7,_0x517924){return function(_0x48c9b7){if(!_0x48c9b7){_0x52eac7[_0xf32f('0x1a')](0x194);}return _0x48c9b7;};}function handleError(_0x450056,_0x2edf3a){_0x2edf3a=_0x2edf3a||0x1f4;return function(_0x3ac4d3){logger[_0xf32f('0x29')](_0x3ac4d3[_0xf32f('0x2a')]);if(_0x3ac4d3[_0xf32f('0x2b')]){delete _0x3ac4d3[_0xf32f('0x2b')];}_0x450056[_0xf32f('0x1b')](_0x2edf3a)[_0xf32f('0x2c')](_0x3ac4d3);};}exports[_0xf32f('0x2d')]=function(_0xe631d0,_0x4f9feb){var _0x9ff745={'raw':!![],'where':{'id':_0xe631d0[_0xf32f('0x2e')]['id']}},_0x285eb9={};_0x285eb9['model']=_[_0xf32f('0x2f')](db[_0xf32f('0x30')][_0xf32f('0x31')]);_0x285eb9[_0xf32f('0x32')]=_[_0xf32f('0x2f')](_0xe631d0[_0xf32f('0x32')]);_0x285eb9[_0xf32f('0x33')]=_['intersection'](_0x285eb9[_0xf32f('0x34')],_0x285eb9[_0xf32f('0x32')]);_0x9ff745[_0xf32f('0x35')]=_[_0xf32f('0x36')](_0x285eb9[_0xf32f('0x34')],qs['fields'](_0xe631d0[_0xf32f('0x32')]['fields']));_0x9ff745['attributes']=_0x9ff745[_0xf32f('0x35')][_0xf32f('0x37')]?_0x9ff745[_0xf32f('0x35')]:_0x285eb9[_0xf32f('0x34')];if(_0xe631d0[_0xf32f('0x32')][_0xf32f('0x38')]){_0x9ff745['include']=[{'all':!![]}];}_0x9ff745=_[_0xf32f('0x39')]({},_0x9ff745,_0xe631d0[_0xf32f('0x3a')]);return db[_0xf32f('0x30')][_0xf32f('0x3b')](_0x9ff745)[_0xf32f('0x26')](handleEntityNotFound(_0x4f9feb,null))[_0xf32f('0x26')](respondWithResult(_0x4f9feb,null))[_0xf32f('0x3c')](handleError(_0x4f9feb,null));};exports[_0xf32f('0x3d')]=function(_0x5e79b2,_0x3f6769){return db[_0xf32f('0x30')]['create'](_0x5e79b2[_0xf32f('0x3e')],{})[_0xf32f('0x26')](respondWithResult(_0x3f6769,0xc9))[_0xf32f('0x3c')](handleError(_0x3f6769,null));};exports['update']=function(_0x1c618c,_0x14418a){if(_0x1c618c[_0xf32f('0x3e')]['id']){delete _0x1c618c[_0xf32f('0x3e')]['id'];}return db[_0xf32f('0x30')][_0xf32f('0x3b')]({'where':{'id':_0x1c618c[_0xf32f('0x2e')]['id']}})[_0xf32f('0x26')](handleEntityNotFound(_0x14418a,null))[_0xf32f('0x26')](saveUpdates(_0x1c618c[_0xf32f('0x3e')],null))[_0xf32f('0x26')](respondWithResult(_0x14418a,null))[_0xf32f('0x3c')](handleError(_0x14418a,null));};exports[_0xf32f('0x27')]=function(_0x68efde,_0x3c79d0){return db['ChatProactiveAction'][_0xf32f('0x3b')]({'where':{'id':_0x68efde[_0xf32f('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3c79d0,null))[_0xf32f('0x26')](removeEntity(_0x3c79d0,null))[_0xf32f('0x3c')](handleError(_0x3c79d0,null));}; \ No newline at end of file +var _0x0faf=['options','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','name','send','show','model','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge'];(function(_0x2fa167,_0x5a76e9){var _0x759825=function(_0x5432ad){while(--_0x5432ad){_0x2fa167['push'](_0x2fa167['shift']());}};_0x759825(++_0x5a76e9);}(_0x0faf,0x132));var _0xf0fa=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x0faf[_0x4456a2];return _0xf36b56;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0fa('0x1'));var jsonpatch=require(_0xf0fa('0x2'));var rp=require(_0xf0fa('0x3'));var moment=require(_0xf0fa('0x4'));var BPromise=require(_0xf0fa('0x5'));var Mustache=require(_0xf0fa('0x6'));var util=require(_0xf0fa('0x7'));var path=require(_0xf0fa('0x8'));var sox=require(_0xf0fa('0x9'));var csv=require('to-csv');var ejs=require(_0xf0fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xb'));var _=require(_0xf0fa('0xc'));var squel=require(_0xf0fa('0xd'));var crypto=require(_0xf0fa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0fa('0xf'));var toCsv=require(_0xf0fa('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf0fa('0x11'));var authService=require(_0xf0fa('0x12'));var qs=require(_0xf0fa('0x13'));var as=require(_0xf0fa('0x14'));var hardwareService=require(_0xf0fa('0x15'));var logger=require(_0xf0fa('0x16'))(_0xf0fa('0x17'));var utils=require(_0xf0fa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf0fa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f46ff,_0x521034){_0x521034=_0x521034||0xcc;return function(_0x39ae2b){if(_0x39ae2b){return _0x2f46ff[_0xf0fa('0x1a')](_0x521034);}return _0x2f46ff[_0xf0fa('0x1b')](_0x521034)['end']();};}function respondWithResult(_0x5821ae,_0x42591b){_0x42591b=_0x42591b||0xc8;return function(_0x540a04){if(_0x540a04){return _0x5821ae[_0xf0fa('0x1b')](_0x42591b)[_0xf0fa('0x1c')](_0x540a04);}};}function respondWithFilteredResult(_0x10ce43,_0x3203ce){return function(_0x467d5f){if(_0x467d5f){var _0x33df80=typeof _0x3203ce[_0xf0fa('0x1d')]===_0xf0fa('0x1e')&&typeof _0x3203ce['limit']===_0xf0fa('0x1e');var _0x477914=_0x467d5f[_0xf0fa('0x1f')];var _0x1d3c22=_0x33df80?0x0:_0x3203ce[_0xf0fa('0x1d')];var _0x386e5f=_0x33df80?_0x467d5f['count']:_0x3203ce['offset']+_0x3203ce[_0xf0fa('0x20')];var _0x2751cc;if(_0x386e5f>=_0x477914){_0x386e5f=_0x477914;_0x2751cc=0xc8;}else{_0x2751cc=0xce;}_0x10ce43[_0xf0fa('0x1b')](_0x2751cc);return _0x10ce43[_0xf0fa('0x21')](_0xf0fa('0x22'),_0x1d3c22+'-'+_0x386e5f+'/'+_0x477914)[_0xf0fa('0x1c')](_0x467d5f);}return null;};}function patchUpdates(_0x32c9bc){return function(_0x3de639){try{jsonpatch[_0xf0fa('0x23')](_0x3de639,_0x32c9bc,!![]);}catch(_0x15942b){return BPromise[_0xf0fa('0x24')](_0x15942b);}return _0x3de639['save']();};}function saveUpdates(_0x10c93e,_0x306f3e){return function(_0x39e82d){if(_0x39e82d){return _0x39e82d[_0xf0fa('0x25')](_0x10c93e)[_0xf0fa('0x26')](function(_0x2b22c5){return _0x2b22c5;});}return null;};}function removeEntity(_0x3901aa,_0x1f0eaf){return function(_0x3feb0c){if(_0x3feb0c){return _0x3feb0c['destroy']()[_0xf0fa('0x26')](function(){_0x3901aa[_0xf0fa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5d7d,_0x3703b5){return function(_0x2efe88){if(!_0x2efe88){_0x3b5d7d['sendStatus'](0x194);}return _0x2efe88;};}function handleError(_0xded80d,_0x284499){_0x284499=_0x284499||0x1f4;return function(_0x3d10fb){logger[_0xf0fa('0x27')](_0x3d10fb['stack']);if(_0x3d10fb['name']){delete _0x3d10fb[_0xf0fa('0x28')];}_0xded80d[_0xf0fa('0x1b')](_0x284499)[_0xf0fa('0x29')](_0x3d10fb);};}exports[_0xf0fa('0x2a')]=function(_0x57b8e9,_0x4058d6){var _0x409a8c={'raw':!![],'where':{'id':_0x57b8e9['params']['id']}},_0x1279cf={};_0x1279cf[_0xf0fa('0x2b')]=_['keys'](db[_0xf0fa('0x2c')][_0xf0fa('0x2d')]);_0x1279cf[_0xf0fa('0x2e')]=_['keys'](_0x57b8e9[_0xf0fa('0x2e')]);_0x1279cf[_0xf0fa('0x2f')]=_[_0xf0fa('0x30')](_0x1279cf[_0xf0fa('0x2b')],_0x1279cf[_0xf0fa('0x2e')]);_0x409a8c[_0xf0fa('0x31')]=_['intersection'](_0x1279cf['model'],qs[_0xf0fa('0x32')](_0x57b8e9[_0xf0fa('0x2e')]['fields']));_0x409a8c[_0xf0fa('0x31')]=_0x409a8c['attributes']['length']?_0x409a8c['attributes']:_0x1279cf[_0xf0fa('0x2b')];if(_0x57b8e9['query'][_0xf0fa('0x33')]){_0x409a8c[_0xf0fa('0x34')]=[{'all':!![]}];}_0x409a8c=_[_0xf0fa('0x35')]({},_0x409a8c,_0x57b8e9[_0xf0fa('0x36')]);return db[_0xf0fa('0x2c')][_0xf0fa('0x37')](_0x409a8c)[_0xf0fa('0x26')](handleEntityNotFound(_0x4058d6,null))[_0xf0fa('0x26')](respondWithResult(_0x4058d6,null))['catch'](handleError(_0x4058d6,null));};exports[_0xf0fa('0x38')]=function(_0x307aa8,_0x36dd2b){return db['ChatProactiveAction'][_0xf0fa('0x38')](_0x307aa8[_0xf0fa('0x39')],{})[_0xf0fa('0x26')](respondWithResult(_0x36dd2b,0xc9))[_0xf0fa('0x3a')](handleError(_0x36dd2b,null));};exports['update']=function(_0x5c474e,_0x2a9f4b){if(_0x5c474e[_0xf0fa('0x39')]['id']){delete _0x5c474e[_0xf0fa('0x39')]['id'];}return db[_0xf0fa('0x2c')][_0xf0fa('0x37')]({'where':{'id':_0x5c474e['params']['id']}})['then'](handleEntityNotFound(_0x2a9f4b,null))['then'](saveUpdates(_0x5c474e['body'],null))[_0xf0fa('0x26')](respondWithResult(_0x2a9f4b,null))[_0xf0fa('0x3a')](handleError(_0x2a9f4b,null));};exports['destroy']=function(_0x4ff1a5,_0xdada45){return db[_0xf0fa('0x2c')][_0xf0fa('0x37')]({'where':{'id':_0x4ff1a5[_0xf0fa('0x3b')]['id']}})[_0xf0fa('0x26')](handleEntityNotFound(_0xdada45,null))[_0xf0fa('0x26')](removeEntity(_0xdada45,null))[_0xf0fa('0x3a')](handleError(_0xdada45,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b958ec8..24e8991 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 _0x883d=['chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatProactiveAction'];(function(_0x355141,_0x4ce3bd){var _0x328382=function(_0x44e03c){while(--_0x44e03c){_0x355141['push'](_0x355141['shift']());}};_0x328382(++_0x4ce3bd);}(_0x883d,0x90));var _0xd883=function(_0x3cb8ea,_0x30f75d){_0x3cb8ea=_0x3cb8ea-0x0;var _0x430985=_0x883d[_0x3cb8ea];return _0x430985;};'use strict';var _=require(_0xd883('0x0'));var util=require('util');var logger=require(_0xd883('0x1'))('api');var moment=require(_0xd883('0x2'));var BPromise=require(_0xd883('0x3'));var rp=require(_0xd883('0x4'));var fs=require('fs');var path=require(_0xd883('0x5'));var rimraf=require(_0xd883('0x6'));var config=require(_0xd883('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x14da31,_0xd62e7f){return _0x14da31[_0xd883('0x8')](_0xd883('0x9'),attributes,{'tableName':_0xd883('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e52=['../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc15fc,_0x5a2e1f){var _0x2a8c36=function(_0x5029a1){while(--_0x5029a1){_0xc15fc['push'](_0xc15fc['shift']());}};_0x2a8c36(++_0x5a2e1f);}(_0x7e52,0x17e));var _0x27e5=function(_0x15fe30,_0x38f044){_0x15fe30=_0x15fe30-0x0;var _0x12ebe7=_0x7e52[_0x15fe30];return _0x12ebe7;};'use strict';var _=require(_0x27e5('0x0'));var util=require('util');var logger=require(_0x27e5('0x1'))(_0x27e5('0x2'));var moment=require(_0x27e5('0x3'));var BPromise=require(_0x27e5('0x4'));var rp=require(_0x27e5('0x5'));var fs=require('fs');var path=require(_0x27e5('0x6'));var rimraf=require(_0x27e5('0x7'));var config=require(_0x27e5('0x8'));var attributes=require(_0x27e5('0x9'));module['exports']=function(_0x1804e2,_0x348e0f){return _0x1804e2[_0x27e5('0xa')](_0x27e5('0xb'),attributes,{'tableName':_0x27e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 57a7c08..7959d12 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 _0xece2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x5b8704,_0x40b036){var _0x5bdc53=function(_0x354b24){while(--_0x354b24){_0x5b8704['push'](_0x5b8704['shift']());}};_0x5bdc53(++_0x40b036);}(_0xece2,0xd9));var _0x2ece=function(_0x449f06,_0x56a32c){_0x449f06=_0x449f06-0x0;var _0x179378=_0xece2[_0x449f06];return _0x179378;};'use strict';var _=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var moment=require(_0x2ece('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ece('0x3'));var db=require(_0x2ece('0x4'))['db'];var utils=require(_0x2ece('0x5'));var logger=require(_0x2ece('0x6'))('rpc');var config=require(_0x2ece('0x7'));var jayson=require(_0x2ece('0x8'));var client=jayson['client'][_0x2ece('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46917a,_0x14a892,_0x469b73){return new BPromise(function(_0x452c3b,_0x1aa0fe){return client['request'](_0x46917a,_0x469b73)[_0x2ece('0xa')](function(_0x37346b){logger[_0x2ece('0xb')](_0x2ece('0xc'),_0x14a892,'request\x20sent');logger[_0x2ece('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14a892,'request\x20sent',JSON[_0x2ece('0xe')](_0x37346b));if(_0x37346b['error']){if(_0x37346b[_0x2ece('0xf')]['code']===0x1f4){logger[_0x2ece('0xf')](_0x2ece('0xc'),_0x14a892,_0x37346b['error'][_0x2ece('0x10')]);return _0x1aa0fe(_0x37346b[_0x2ece('0xf')][_0x2ece('0x10')]);}logger[_0x2ece('0xf')](_0x2ece('0xc'),_0x14a892,_0x37346b[_0x2ece('0xf')][_0x2ece('0x10')]);return _0x452c3b(_0x37346b[_0x2ece('0xf')][_0x2ece('0x10')]);}else{logger['info'](_0x2ece('0xc'),_0x14a892,_0x2ece('0x11'));_0x452c3b(_0x37346b[_0x2ece('0x12')][_0x2ece('0x10')]);}})[_0x2ece('0x13')](function(_0x757b0){logger[_0x2ece('0xf')](_0x2ece('0xc'),_0x14a892,_0x757b0);_0x1aa0fe(_0x757b0);});});} \ No newline at end of file +var _0x4c3b=['code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','info','request\x20sent','debug','stringify','error'];(function(_0x49fb23,_0x5340d4){var _0x4ef27b=function(_0xe79ef4){while(--_0xe79ef4){_0x49fb23['push'](_0x49fb23['shift']());}};_0x4ef27b(++_0x5340d4);}(_0x4c3b,0x16d));var _0xb4c3=function(_0x571726,_0x4c5bd1){_0x571726=_0x571726-0x0;var _0x53a3d8=_0x4c3b[_0x571726];return _0x53a3d8;};'use strict';var _=require(_0xb4c3('0x0'));var util=require(_0xb4c3('0x1'));var moment=require(_0xb4c3('0x2'));var BPromise=require(_0xb4c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4c3('0x5'))(_0xb4c3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb4c3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a9417,_0x2d67d3,_0x3191f2){return new BPromise(function(_0x3cfd9a,_0x4ae5e5){return client['request'](_0x1a9417,_0x3191f2)['then'](function(_0x147203){logger[_0xb4c3('0x8')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d67d3,_0xb4c3('0x9'));logger[_0xb4c3('0xa')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2d67d3,'request\x20sent',JSON[_0xb4c3('0xb')](_0x147203));if(_0x147203[_0xb4c3('0xc')]){if(_0x147203['error'][_0xb4c3('0xd')]===0x1f4){logger[_0xb4c3('0xc')](_0xb4c3('0xe'),_0x2d67d3,_0x147203[_0xb4c3('0xc')]['message']);return _0x4ae5e5(_0x147203[_0xb4c3('0xc')]['message']);}logger['error'](_0xb4c3('0xe'),_0x2d67d3,_0x147203[_0xb4c3('0xc')][_0xb4c3('0xf')]);return _0x3cfd9a(_0x147203[_0xb4c3('0xc')][_0xb4c3('0xf')]);}else{logger[_0xb4c3('0x8')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d67d3,_0xb4c3('0x9'));_0x3cfd9a(_0x147203[_0xb4c3('0x10')][_0xb4c3('0xf')]);}})[_0xb4c3('0x11')](function(_0x4ebf9){logger[_0xb4c3('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d67d3,_0x4ebf9);_0x4ae5e5(_0x4ebf9);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 582ca10..d005459 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 _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0xbec2cd,_0xcf1938){var _0x38142e=function(_0x2abf51){while(--_0x2abf51){_0xbec2cd['push'](_0xbec2cd['shift']());}};_0x38142e(++_0xcf1938);}(_0x31f0,0xb7));var _0x031f=function(_0xb30c72,_0x38c379){_0xb30c72=_0xb30c72-0x0;var _0x5c2b2e=_0x31f0[_0xb30c72];return _0x5c2b2e;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0x8958=['show','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x3cc418,_0xe8585d){var _0x307a5b=function(_0x347f56){while(--_0x347f56){_0x3cc418['push'](_0x3cc418['shift']());}};_0x307a5b(++_0xe8585d);}(_0x8958,0x93));var _0x8895=function(_0x18f3a6,_0x4561f7){_0x18f3a6=_0x18f3a6-0x0;var _0x37b39c=_0x8958[_0x18f3a6];return _0x37b39c;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get'](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0x7')]);router[_0x8895('0x8')]('/',auth[_0x8895('0x6')](),controller['create']);router[_0x8895('0x9')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xc')]);module[_0x8895('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 73c75e3..108b33d 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 _0x9319=['sequelize','exports','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2eae90,_0x3b09f2){var _0x27fce6=function(_0x30c5c7){while(--_0x30c5c7){_0x2eae90['push'](_0x2eae90['shift']());}};_0x27fce6(++_0x3b09f2);}(_0x9319,0xe0));var _0x9931=function(_0x45d5bf,_0x338e8e){_0x45d5bf=_0x45d5bf-0x0;var _0x5197d3=_0x9319[_0x45d5bf];return _0x5197d3;};'use strict';var Sequelize=require(_0x9931('0x0'));module[_0x9931('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9931('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9931('0x3')](_0x9931('0x4'),_0x9931('0x5'),_0x9931('0x6'))}}; \ No newline at end of file +var _0x5f07=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x5aea3e,_0x20d237){var _0x558b7b=function(_0x46b629){while(--_0x46b629){_0x5aea3e['push'](_0x5aea3e['shift']());}};_0x558b7b(++_0x20d237);}(_0x5f07,0x121));var _0x75f0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f07[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x75f0('0x0'));module[_0x75f0('0x1')]={'name':{'type':Sequelize[_0x75f0('0x2')],'unique':_0x75f0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x75f0('0x2')]},'timeout':{'type':Sequelize[_0x75f0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x75f0('0x5'),_0x75f0('0x6'),_0x75f0('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d47c292..37f8735 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 _0x6450=['include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserChatQueue','nolimit','order','sort','pick','ChatQueueId','filter','map','User','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','hasOwnProperty','addTeams','ids','online','interface','flatMap','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','Agents','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','ChatQueues','error','name','send','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where'];(function(_0x1ee73f,_0x3b0729){var _0x5954f9=function(_0x2cf6b5){while(--_0x2cf6b5){_0x1ee73f['push'](_0x1ee73f['shift']());}};_0x5954f9(++_0x3b0729);}(_0x6450,0x1b4));var _0x0645=function(_0x33b9d8,_0x3b087c){_0x33b9d8=_0x33b9d8-0x0;var _0x1cffc7=_0x6450[_0x33b9d8];return _0x1cffc7;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x0645('0x0'));var squel=require('squel');var Redis=require(_0x0645('0x1'));var qs=require(_0x0645('0x2'));var logger=require(_0x0645('0x3'))(_0x0645('0x4'));var config=require(_0x0645('0x5'));var db=require(_0x0645('0x6'))['db'];config['redis']=_[_0x0645('0x7')](config[_0x0645('0x8')],{'host':_0x0645('0x9'),'port':0x18eb});var socket=require(_0x0645('0xa'))(new Redis(config['redis']));require(_0x0645('0xb'))['register'](socket);function respondWithStatusCode(_0x3946d9,_0xda538b){_0xda538b=_0xda538b||0xcc;return function(_0xb3febe){if(_0xb3febe){return _0x3946d9[_0x0645('0xc')](_0xda538b);}return _0x3946d9[_0x0645('0xd')](_0xda538b)[_0x0645('0xe')]();};}function respondWithResult(_0x40bf96,_0xab72b4){_0xab72b4=_0xab72b4||0xc8;return function(_0x32f9d4){if(_0x32f9d4){return _0x40bf96[_0x0645('0xd')](_0xab72b4)[_0x0645('0xf')](_0x32f9d4);}};}function respondWithFilteredResult(_0x328d0d,_0x3e15b8){return function(_0x3b7da4){if(_0x3b7da4){var _0x48f428=typeof _0x3e15b8['offset']===_0x0645('0x10')&&typeof _0x3e15b8[_0x0645('0x11')]===_0x0645('0x10');var _0x330773=_0x3b7da4[_0x0645('0x12')];var _0x5d32af=_0x48f428?0x0:_0x3e15b8[_0x0645('0x13')];var _0x3858fb=_0x48f428?_0x3b7da4['count']:_0x3e15b8[_0x0645('0x13')]+_0x3e15b8['limit'];var _0x51bdab;if(_0x3858fb>=_0x330773){_0x3858fb=_0x330773;_0x51bdab=0xc8;}else{_0x51bdab=0xce;}_0x328d0d[_0x0645('0xd')](_0x51bdab);return _0x328d0d['set'](_0x0645('0x14'),_0x5d32af+'-'+_0x3858fb+'/'+_0x330773)['json'](_0x3b7da4);}return null;};}function saveUpdates(_0x3273c1){return function(_0x173109){if(_0x173109){return _0x173109[_0x0645('0x15')](_0x3273c1)[_0x0645('0x16')](function(_0x451a79){return _0x451a79;});}return null;};}function removeEntity(_0x2b54b4){return function(_0x50a3cb){if(_0x50a3cb){return _0x50a3cb[_0x0645('0x17')]()['then'](function(){var _0x1da23b=_0x50a3cb[_0x0645('0x18')]({'plain':!![]});var _0x542f42=_0x0645('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x542f42,'resourceId':_0x1da23b['id']}})[_0x0645('0x16')](function(){return _0x50a3cb;});})[_0x0645('0x16')](function(){_0x2b54b4[_0x0645('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37d765){return function(_0x54dbd4){if(!_0x54dbd4){_0x37d765[_0x0645('0xc')](0x194);}return _0x54dbd4;};}function handleError(_0x54ee29,_0xe6e56d){_0xe6e56d=_0xe6e56d||0x1f4;return function(_0x497ff7){logger[_0x0645('0x1a')](_0x497ff7['stack']);if(_0x497ff7['name']){delete _0x497ff7[_0x0645('0x1b')];}_0x54ee29['status'](_0xe6e56d)[_0x0645('0x1c')](_0x497ff7);};}exports['index']=function(_0x52e6e2,_0x329e07){var _0x5098ec={};var _0x217666={'count':0x0,'rows':[]};var _0x586e09=_['map'](db[_0x0645('0x1d')][_0x0645('0x1e')],function(_0x1c89ae){return{'name':_0x1c89ae[_0x0645('0x1f')],'type':_0x1c89ae[_0x0645('0x20')][_0x0645('0x21')]};});_0x5098ec=qs[_0x0645('0x22')](_0x586e09,_0x52e6e2);var _0x16ce72={'where':_0x5098ec[_0x0645('0x23')]};return db[_0x0645('0x1d')][_0x0645('0x12')](_0x16ce72)[_0x0645('0x16')](function(_0x562909){_0x217666[_0x0645('0x12')]=_0x562909;_0x5098ec['include']=qs[_0x0645('0x24')](_0x52e6e2[_0x0645('0x25')]);return db[_0x0645('0x1d')][_0x0645('0x26')](_0x5098ec);})[_0x0645('0x16')](function(_0x1563d6){_0x217666['rows']=_0x1563d6;return _0x217666;})['then'](respondWithFilteredResult(_0x329e07,_0x5098ec))[_0x0645('0x27')](handleError(_0x329e07,null));};exports[_0x0645('0x28')]=function(_0xf2f38d,_0x27da7d){var _0x4b5d38={'raw':!![],'where':{'id':_0xf2f38d[_0x0645('0x29')]['id']}},_0x572d63={};_0x572d63[_0x0645('0x2a')]=_[_0x0645('0x2b')](db[_0x0645('0x1d')][_0x0645('0x1e')]);_0x572d63['query']=_[_0x0645('0x2b')](_0xf2f38d['query']);_0x572d63[_0x0645('0x2c')]=_[_0x0645('0x2d')](_0x572d63[_0x0645('0x2a')],_0x572d63[_0x0645('0x25')]);_0x4b5d38[_0x0645('0x2e')]=_['intersection'](_0x572d63[_0x0645('0x2a')],qs[_0x0645('0x2f')](_0xf2f38d[_0x0645('0x25')]['fields']));_0x4b5d38[_0x0645('0x2e')]=_0x4b5d38['attributes'][_0x0645('0x30')]?_0x4b5d38[_0x0645('0x2e')]:_0x572d63[_0x0645('0x2a')];if(_0xf2f38d[_0x0645('0x25')][_0x0645('0x31')]){_0x4b5d38[_0x0645('0x24')]=[{'all':!![]}];}_0x4b5d38=_[_0x0645('0x32')]({},_0x4b5d38,_0xf2f38d[_0x0645('0x33')]);return db[_0x0645('0x1d')][_0x0645('0x34')](_0x4b5d38)[_0x0645('0x16')](handleEntityNotFound(_0x27da7d,null))[_0x0645('0x16')](respondWithResult(_0x27da7d,null))[_0x0645('0x27')](handleError(_0x27da7d,null));};exports['create']=function(_0x22a0e1,_0x48e7dc){return db[_0x0645('0x1d')][_0x0645('0x35')](_0x22a0e1[_0x0645('0x36')],{})[_0x0645('0x16')](function(_0x749940){var _0x919ccb=_0x22a0e1[_0x0645('0x37')][_0x0645('0x18')]({'plain':!![]});if(!_0x919ccb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x919ccb[_0x0645('0x38')]===_0x0645('0x37')){var _0x5000fb=_0x749940[_0x0645('0x18')]({'plain':!![]});var _0x233060='ChatQueues';return db[_0x0645('0x39')][_0x0645('0x34')]({'where':{'name':_0x233060,'userProfileId':_0x919ccb[_0x0645('0x3a')]},'raw':!![]})[_0x0645('0x16')](function(_0x1dc0b1){if(_0x1dc0b1&&_0x1dc0b1['autoAssociation']===0x0){return db[_0x0645('0x3b')]['create']({'name':_0x5000fb[_0x0645('0x1b')],'resourceId':_0x5000fb['id'],'type':_0x1dc0b1[_0x0645('0x1b')],'sectionId':_0x1dc0b1['id']},{})[_0x0645('0x16')](function(){return _0x749940;});}else{return _0x749940;}})[_0x0645('0x27')](function(_0x271176){logger[_0x0645('0x1a')](_0x0645('0x3c'),_0x271176);throw _0x271176;});}return _0x749940;})[_0x0645('0x16')](respondWithResult(_0x48e7dc,0xc9))['catch'](handleError(_0x48e7dc,null));};exports['update']=function(_0x5b793b,_0x50ff6a){if(_0x5b793b['body']['id']){delete _0x5b793b[_0x0645('0x36')]['id'];}return db[_0x0645('0x1d')][_0x0645('0x34')]({'where':{'id':_0x5b793b['params']['id']}})['then'](handleEntityNotFound(_0x50ff6a,null))[_0x0645('0x16')](saveUpdates(_0x5b793b[_0x0645('0x36')],null))[_0x0645('0x16')](respondWithResult(_0x50ff6a,null))[_0x0645('0x27')](handleError(_0x50ff6a,null));};exports['destroy']=function(_0x502284,_0xa135e8){return db['ChatQueue']['find']({'where':{'id':_0x502284[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0xa135e8,null))[_0x0645('0x16')](removeEntity(_0xa135e8,null))[_0x0645('0x27')](handleError(_0xa135e8,null));};exports['describe']=function(_0x1cd039,_0x2ebbb6){return db[_0x0645('0x1d')]['describe']()['then'](respondWithResult(_0x2ebbb6,null))[_0x0645('0x27')](handleError(_0x2ebbb6,null));};exports['getMembers']=function(_0x19f805,_0x5ddb73){var _0x5a7aa3={'raw':!![],'where':{}},_0x3d54a0={},_0x439adf;return db[_0x0645('0x1d')][_0x0645('0x3d')]({'where':{'id':_0x19f805[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0x5ddb73,null))[_0x0645('0x16')](function(_0x487961){if(_0x487961){_0x439adf=_0x487961[_0x0645('0x18')]({'plain':!![]});_0x3d54a0[_0x0645('0x2a')]=_['keys'](db[_0x0645('0x3e')]['rawAttributes']);_0x3d54a0[_0x0645('0x25')]=_['keys'](_0x19f805[_0x0645('0x25')]);_0x3d54a0['filters']=_[_0x0645('0x2d')](_0x3d54a0[_0x0645('0x2a')],_0x3d54a0[_0x0645('0x25')]);_0x5a7aa3[_0x0645('0x2e')]=_[_0x0645('0x2d')](_0x3d54a0['model'],qs[_0x0645('0x2f')](_0x19f805[_0x0645('0x25')]['fields']));_0x5a7aa3[_0x0645('0x2e')]=_0x5a7aa3['attributes']['length']?_0x5a7aa3[_0x0645('0x2e')]:_0x3d54a0[_0x0645('0x2a')];if(!_0x19f805[_0x0645('0x25')]['hasOwnProperty'](_0x0645('0x3f'))){_0x5a7aa3[_0x0645('0x11')]=qs[_0x0645('0x11')](_0x19f805[_0x0645('0x25')][_0x0645('0x11')]);_0x5a7aa3[_0x0645('0x13')]=qs[_0x0645('0x13')](_0x19f805[_0x0645('0x25')]['offset']);}_0x5a7aa3[_0x0645('0x40')]=qs[_0x0645('0x41')](_0x19f805[_0x0645('0x25')]['sort']);_0x5a7aa3['where']=qs[_0x0645('0x2c')](_[_0x0645('0x42')](_0x19f805[_0x0645('0x25')],_0x3d54a0[_0x0645('0x2c')]));_0x5a7aa3['where'][_0x0645('0x43')]=_0x487961['id'];if(_0x19f805[_0x0645('0x25')][_0x0645('0x44')]){_0x5a7aa3['where']=_[_0x0645('0x32')](_0x5a7aa3[_0x0645('0x23')],{'$or':_[_0x0645('0x45')](_0x5a7aa3[_0x0645('0x2e')],function(_0x15b6e2){var _0xf79eaa={};_0xf79eaa[_0x15b6e2]={'$like':'%'+_0x19f805[_0x0645('0x25')][_0x0645('0x44')]+'%'};return _0xf79eaa;})});}_0x5a7aa3=_[_0x0645('0x32')]({},_0x5a7aa3,_0x19f805[_0x0645('0x33')]);return db['UserChatQueue']['findAll'](_0x5a7aa3);}})[_0x0645('0x16')](function(_0x4b9763){if(_0x4b9763){return db[_0x0645('0x46')][_0x0645('0x47')]({'where':{'id':_['map'](_0x4b9763,'UserId'),'role':_0x0645('0x48')},'attributes':['id','name',_0x0645('0x49'),_0x0645('0x4a'),'createdAt']});}})[_0x0645('0x16')](function(_0x12ea49){if(_0x12ea49){return{'count':_0x12ea49['count'],'rows':_[_0x0645('0x45')](_0x12ea49['rows'],function(_0x6590fe){return{'membername':_0x6590fe[_0x0645('0x1b')],'UserId':_0x6590fe['id'],'queue_name':_0x439adf[_0x0645('0x1b')],'ChatQueueId':_0x439adf['id'],'interface':util[_0x0645('0x4b')](_0x0645('0x4c'),_0x0645('0x4d'),_0x6590fe[_0x0645('0x1b')]),'penalty':0x0,'paused':_0x6590fe[_0x0645('0x49')],'createdAt':_0x6590fe[_0x0645('0x4e')],'updatedAt':_0x6590fe[_0x0645('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0645('0x16')](respondWithFilteredResult(_0x5ddb73,_0x5a7aa3))[_0x0645('0x27')](handleError(_0x5ddb73,null));};exports[_0x0645('0x4f')]=function(_0x1f1bc8,_0x1125b8){var _0x58b607={};var _0x2138ac={};var _0x5bfbcb;var _0x1b7774;return db['ChatQueue']['findOne']({'where':{'id':_0x1f1bc8[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0x1125b8,null))[_0x0645('0x16')](function(_0x22af0a){if(_0x22af0a){_0x5bfbcb=_0x22af0a;_0x2138ac['model']=_[_0x0645('0x2b')](db[_0x0645('0x50')][_0x0645('0x1e')]);_0x2138ac[_0x0645('0x25')]=_[_0x0645('0x2b')](_0x1f1bc8[_0x0645('0x25')]);_0x2138ac['filters']=_['intersection'](_0x2138ac['model'],_0x2138ac[_0x0645('0x25')]);_0x58b607['attributes']=_[_0x0645('0x2d')](_0x2138ac['model'],qs[_0x0645('0x2f')](_0x1f1bc8[_0x0645('0x25')][_0x0645('0x2f')]));_0x58b607[_0x0645('0x2e')]=_0x58b607[_0x0645('0x2e')][_0x0645('0x30')]?_0x58b607[_0x0645('0x2e')]:_0x2138ac[_0x0645('0x2a')];_0x58b607[_0x0645('0x40')]=qs[_0x0645('0x41')](_0x1f1bc8[_0x0645('0x25')][_0x0645('0x41')]);_0x58b607[_0x0645('0x23')]=qs['filters'](_[_0x0645('0x42')](_0x1f1bc8[_0x0645('0x25')],_0x2138ac[_0x0645('0x2c')]));if(_0x1f1bc8[_0x0645('0x25')][_0x0645('0x44')]){_0x58b607[_0x0645('0x23')]=_['merge'](_0x58b607[_0x0645('0x23')],{'$or':_[_0x0645('0x45')](_0x58b607[_0x0645('0x2e')],function(_0x24ed2b){var _0x323529={};_0x323529[_0x24ed2b]={'$like':'%'+_0x1f1bc8['query'][_0x0645('0x44')]+'%'};return _0x323529;})});}_0x58b607=_[_0x0645('0x32')]({},_0x58b607,_0x1f1bc8[_0x0645('0x33')]);return _0x5bfbcb['getTeams'](_0x58b607);}})[_0x0645('0x16')](function(_0x23a3b8){if(_0x23a3b8){_0x1b7774=_0x23a3b8[_0x0645('0x30')];if(!_0x1f1bc8[_0x0645('0x25')][_0x0645('0x51')](_0x0645('0x3f'))){_0x58b607[_0x0645('0x11')]=qs['limit'](_0x1f1bc8[_0x0645('0x25')]['limit']);_0x58b607[_0x0645('0x13')]=qs['offset'](_0x1f1bc8['query'][_0x0645('0x13')]);}return _0x5bfbcb[_0x0645('0x4f')](_0x58b607);}})[_0x0645('0x16')](function(_0x32162a){if(_0x32162a){return _0x32162a?{'count':_0x1b7774,'rows':_0x32162a}:null;}})[_0x0645('0x16')](respondWithResult(_0x1125b8,null))[_0x0645('0x27')](handleError(_0x1125b8,null));};exports[_0x0645('0x52')]=function(_0x270592,_0x3816ed){var _0x83e7ad=_0x270592[_0x0645('0x36')][_0x0645('0x53')];return db[_0x0645('0x50')][_0x0645('0x26')]({'where':{'id':_0x83e7ad},'attributes':['id'],'include':[{'model':db[_0x0645('0x46')],'as':'Agents','attributes':['id',_0x0645('0x1b'),_0x0645('0x54'),'voicePause',_0x0645('0x55')],'raw':!![]}]})[_0x0645('0x16')](function(_0x107168){if(_0x107168){var _0x2ed370=_[_0x0645('0x56')](_0x107168,function(_0x45c28f){var _0x5709f9=_0x45c28f[_0x0645('0x18')]({'plain':!![]});return _0x5709f9['Agents'];});return db[_0x0645('0x1d')][_0x0645('0x34')]({'where':{'id':_0x270592[_0x0645('0x29')]['id']}})['then'](function(_0x244d3f){return db[_0x0645('0x57')][_0x0645('0x58')](function(_0x45a8ba){return _0x244d3f[_0x0645('0x52')](_0x83e7ad,{'transaction':_0x45a8ba})['then'](function(){return BPromise[_0x0645('0x59')](_0x2ed370,function(_0x5984b5){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x5984b5['id'],'ChatQueueId':_0x270592[_0x0645('0x29')]['id']},'transaction':_0x45a8ba});});})[_0x0645('0x16')](function(){_0x2ed370[_0x0645('0x5a')](function(_0x1bf736){socket['emit'](_0x0645('0x5b'),{'UserId':_0x1bf736['id'],'ChatQueueId':_0x244d3f['id']});});});});});}})[_0x0645('0x16')](respondWithStatusCode(_0x3816ed,null))[_0x0645('0x27')](handleError(_0x3816ed,null));};exports[_0x0645('0x5c')]=function(_0x5e3438,_0x1e7a45){return db['Team']['findAll']({'where':{'id':_0x5e3438[_0x0645('0x25')][_0x0645('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0645('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x0645('0x16')](handleEntityNotFound(_0x1e7a45,null))[_0x0645('0x16')](function(_0x52de67){var _0x274287=_[_0x0645('0x45')](_0x52de67,'id');var _0x4d7ab7=[];var _0xe75ff9=[];var _0x3d97fb=squel[_0x0645('0x5e')]();_0x3d97fb[_0x0645('0x5f')]('tq.TeamId')['from'](_0x0645('0x60'),'tq')[_0x0645('0x61')](_0x0645('0x62'),'ut',_0x0645('0x63'))[_0x0645('0x23')](_0x0645('0x64'),_0x5e3438[_0x0645('0x29')]['id']);for(var _0x16e187=0x0;_0x16e187<_0x52de67[_0x0645('0x30')];_0x16e187+=0x1){let _0x25579d=_0x52de67[_0x16e187];for(var _0x48ab9d=0x0;_0x48ab9d<_0x25579d[_0x0645('0x5d')]['length'];_0x48ab9d+=0x1){let _0x10bcfc=_0x25579d[_0x0645('0x5d')][_0x48ab9d];var _0x87dfe2=_0x3d97fb['clone']();_0x87dfe2[_0x0645('0x23')](_0x0645('0x65'),_0x10bcfc['id']);_0xe75ff9['push'](db[_0x0645('0x57')][_0x0645('0x25')](_0x87dfe2['toString'](),{'type':db['sequelize'][_0x0645('0x66')][_0x0645('0x67')]})[_0x0645('0x16')](function(_0x3670ea){if(_0x3670ea[_0x0645('0x30')]===0x1){return _0x10bcfc['id'];}else{var _0x371ad0=_[_0x0645('0x68')](_[_0x0645('0x45')](_0x3670ea,'TeamId'),function(_0x257850){return _[_0x0645('0x69')](_0x274287,_0x257850);});if(_0x371ad0){return _0x10bcfc['id'];}}}));}}return BPromise[_0x0645('0x6a')](_0xe75ff9)['then'](function(_0x21138b){_0x4d7ab7=_(_0x4d7ab7)[_0x0645('0x6b')](_0x21138b)[_0x0645('0x6c')]()['value']();return db[_0x0645('0x1d')]['find']({'where':{'id':_0x5e3438['params']['id']}})['then'](function(_0x468d28){return db[_0x0645('0x57')][_0x0645('0x58')](function(_0x3a5210){return _0x468d28[_0x0645('0x5c')](_0x5e3438['query'][_0x0645('0x53')],{'transaction':_0x3a5210})[_0x0645('0x16')](function(){if(!_[_0x0645('0x6d')](_0x4d7ab7)){return _0x468d28[_0x0645('0x6e')](_0x4d7ab7,{'transaction':_0x3a5210});}})[_0x0645('0x16')](function(){_0x4d7ab7[_0x0645('0x5a')](function(_0x3dbb41){socket[_0x0645('0x6f')](_0x0645('0x70'),{'UserId':_0x3dbb41,'ChatQueueId':_0x468d28['id']});});});});});});})['then'](respondWithStatusCode(_0x1e7a45,null))[_0x0645('0x27')](handleError(_0x1e7a45,null));};exports[_0x0645('0x71')]=function(_0x37f929,_0xccc21a){return db[_0x0645('0x1d')][_0x0645('0x34')]({'where':{'id':_0x37f929[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0xccc21a,null))[_0x0645('0x16')](function(_0x4cea7d){if(_0x4cea7d){return _0x4cea7d[_0x0645('0x71')](_0x37f929[_0x0645('0x36')]['ids'],_[_0x0645('0x72')](_0x37f929[_0x0645('0x36')],[_0x0645('0x53'),'id'])||{})[_0x0645('0x73')](function(_0x145c9c){for(var _0x5cb51d=0x0;_0x5cb51d<_0x37f929[_0x0645('0x36')][_0x0645('0x53')]['length'];_0x5cb51d+=0x1){socket[_0x0645('0x6f')]('userChatQueue:save',{'UserId':Number(_0x37f929[_0x0645('0x36')]['ids'][_0x5cb51d]),'ChatQueueId':Number(_0x37f929[_0x0645('0x29')]['id'])});}return _0x145c9c;});}})[_0x0645('0x16')](respondWithResult(_0xccc21a,null))[_0x0645('0x27')](handleError(_0xccc21a,null));};exports['removeAgents']=function(_0x211d62,_0x4f5c6c){return db[_0x0645('0x1d')]['find']({'where':{'id':_0x211d62[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0x4f5c6c,null))[_0x0645('0x16')](function(_0x2117f6){if(_0x2117f6){return _0x2117f6[_0x0645('0x6e')](_0x211d62[_0x0645('0x25')][_0x0645('0x53')])[_0x0645('0x16')](function(){if(_[_0x0645('0x74')](_0x211d62[_0x0645('0x25')][_0x0645('0x53')])){for(var _0x2ae2a0=0x0;_0x2ae2a0<_0x211d62[_0x0645('0x25')][_0x0645('0x53')]['length'];_0x2ae2a0+=0x1){socket[_0x0645('0x6f')](_0x0645('0x70'),{'UserId':Number(_0x211d62['query'][_0x0645('0x53')][_0x2ae2a0]),'ChatQueueId':Number(_0x211d62[_0x0645('0x29')]['id'])});}}else{socket['emit'](_0x0645('0x70'),{'UserId':Number(_0x211d62[_0x0645('0x25')]['ids']),'ChatQueueId':Number(_0x211d62[_0x0645('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f5c6c,null))[_0x0645('0x27')](handleError(_0x4f5c6c,null));};exports['getAgents']=function(_0x4435ba,_0x3f2e14){var _0x4cc9ab={};var _0x1aa631={};var _0x398f77;var _0x256dde;return db[_0x0645('0x1d')]['findOne']({'where':{'id':_0x4435ba[_0x0645('0x29')]['id']}})[_0x0645('0x16')](handleEntityNotFound(_0x3f2e14,null))[_0x0645('0x16')](function(_0x5e2d61){if(_0x5e2d61){_0x398f77=_0x5e2d61;_0x1aa631['model']=_['keys'](db[_0x0645('0x46')][_0x0645('0x1e')]);_0x1aa631[_0x0645('0x25')]=_[_0x0645('0x2b')](_0x4435ba[_0x0645('0x25')]);_0x1aa631[_0x0645('0x2c')]=_[_0x0645('0x2d')](_0x1aa631[_0x0645('0x2a')],_0x1aa631[_0x0645('0x25')]);_0x4cc9ab[_0x0645('0x2e')]=_['intersection'](_0x1aa631[_0x0645('0x2a')],qs[_0x0645('0x2f')](_0x4435ba[_0x0645('0x25')]['fields']));_0x4cc9ab[_0x0645('0x2e')]=_0x4cc9ab[_0x0645('0x2e')][_0x0645('0x30')]?_0x4cc9ab[_0x0645('0x2e')]:_0x1aa631[_0x0645('0x2a')];_0x4cc9ab[_0x0645('0x40')]=qs[_0x0645('0x41')](_0x4435ba['query'][_0x0645('0x41')]);_0x4cc9ab[_0x0645('0x23')]=qs[_0x0645('0x2c')](_[_0x0645('0x42')](_0x4435ba[_0x0645('0x25')],_0x1aa631[_0x0645('0x2c')]));if(_0x4435ba[_0x0645('0x25')][_0x0645('0x44')]){_0x4cc9ab[_0x0645('0x23')]=_[_0x0645('0x32')](_0x4cc9ab[_0x0645('0x23')],{'$or':_[_0x0645('0x45')](_0x4cc9ab[_0x0645('0x2e')],function(_0x15e4e7){var _0x31724b={};_0x31724b[_0x15e4e7]={'$like':'%'+_0x4435ba[_0x0645('0x25')][_0x0645('0x44')]+'%'};return _0x31724b;})});}_0x4cc9ab=_[_0x0645('0x32')]({},_0x4cc9ab,_0x4435ba[_0x0645('0x33')]);return _0x398f77[_0x0645('0x75')](_0x4cc9ab);}})[_0x0645('0x16')](function(_0x6920f8){if(_0x6920f8){_0x256dde=_0x6920f8[_0x0645('0x30')];if(!_0x4435ba['query'][_0x0645('0x51')]('nolimit')){_0x4cc9ab[_0x0645('0x11')]=qs[_0x0645('0x11')](_0x4435ba[_0x0645('0x25')][_0x0645('0x11')]);_0x4cc9ab[_0x0645('0x13')]=qs['offset'](_0x4435ba[_0x0645('0x25')][_0x0645('0x13')]);}return _0x398f77['getAgents'](_0x4cc9ab);}})[_0x0645('0x16')](function(_0x1abb9f){if(_0x1abb9f){return _0x1abb9f?{'count':_0x256dde,'rows':_0x1abb9f}:null;}})['then'](respondWithResult(_0x3f2e14,null))[_0x0645('0x27')](handleError(_0x3f2e14,null));}; \ No newline at end of file +var _0x1096=['%s/%s','updatedAt','getTeams','addTeams','ids','findAll','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','removeTeams','Team','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','emit','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','getAgents','util','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','ChatQueues','UserProfileResource','name','send','index','rawAttributes','fieldName','type','getOptions','where','ChatQueue','include','rows','catch','params','keys','query','filters','model','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','limit','order','sort','pick','filter','map','options','User','findAndCountAll','UserId','agent','chatPause','createdAt','format'];(function(_0x1612bb,_0x53b05c){var _0x365f9d=function(_0x4b1d56){while(--_0x4b1d56){_0x1612bb['push'](_0x1612bb['shift']());}};_0x365f9d(++_0x53b05c);}(_0x1096,0x11b));var _0x6109=function(_0x475a6f,_0x10769f){_0x475a6f=_0x475a6f-0x0;var _0x356d19=_0x1096[_0x475a6f];return _0x356d19;};'use strict';var BPromise=require('bluebird');var util=require(_0x6109('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x6109('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x6109('0x2'))(_0x6109('0x3'));var config=require(_0x6109('0x4'));var db=require(_0x6109('0x5'))['db'];config[_0x6109('0x6')]=_[_0x6109('0x7')](config[_0x6109('0x6')],{'host':_0x6109('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6109('0x9'))[_0x6109('0xa')](socket);function respondWithStatusCode(_0xafef8e,_0x5cc6b1){_0x5cc6b1=_0x5cc6b1||0xcc;return function(_0x3f2e66){if(_0x3f2e66){return _0xafef8e[_0x6109('0xb')](_0x5cc6b1);}return _0xafef8e[_0x6109('0xc')](_0x5cc6b1)[_0x6109('0xd')]();};}function respondWithResult(_0x98914a,_0x18d5d0){_0x18d5d0=_0x18d5d0||0xc8;return function(_0x38a79c){if(_0x38a79c){return _0x98914a[_0x6109('0xc')](_0x18d5d0)[_0x6109('0xe')](_0x38a79c);}};}function respondWithFilteredResult(_0x3a41b3,_0x2c9eeb){return function(_0x440d1b){if(_0x440d1b){var _0x29f450=typeof _0x2c9eeb[_0x6109('0xf')]===_0x6109('0x10')&&typeof _0x2c9eeb['limit']===_0x6109('0x10');var _0x20a7f4=_0x440d1b[_0x6109('0x11')];var _0x350bc9=_0x29f450?0x0:_0x2c9eeb['offset'];var _0x2f25b0=_0x29f450?_0x440d1b[_0x6109('0x11')]:_0x2c9eeb[_0x6109('0xf')]+_0x2c9eeb['limit'];var _0x468a14;if(_0x2f25b0>=_0x20a7f4){_0x2f25b0=_0x20a7f4;_0x468a14=0xc8;}else{_0x468a14=0xce;}_0x3a41b3[_0x6109('0xc')](_0x468a14);return _0x3a41b3[_0x6109('0x12')](_0x6109('0x13'),_0x350bc9+'-'+_0x2f25b0+'/'+_0x20a7f4)[_0x6109('0xe')](_0x440d1b);}return null;};}function saveUpdates(_0x36438c){return function(_0x1f502e){if(_0x1f502e){return _0x1f502e[_0x6109('0x14')](_0x36438c)['then'](function(_0x202032){return _0x202032;});}return null;};}function removeEntity(_0x597b53){return function(_0x43fb1e){if(_0x43fb1e){return _0x43fb1e[_0x6109('0x15')]()[_0x6109('0x16')](function(){var _0x182df7=_0x43fb1e['get']({'plain':!![]});var _0x47ae63=_0x6109('0x17');return db[_0x6109('0x18')][_0x6109('0x15')]({'where':{'type':_0x47ae63,'resourceId':_0x182df7['id']}})[_0x6109('0x16')](function(){return _0x43fb1e;});})[_0x6109('0x16')](function(){_0x597b53[_0x6109('0xc')](0xcc)[_0x6109('0xd')]();});}};}function handleEntityNotFound(_0x508de9){return function(_0x1e5587){if(!_0x1e5587){_0x508de9[_0x6109('0xb')](0x194);}return _0x1e5587;};}function handleError(_0x4ccf14,_0x3799ad){_0x3799ad=_0x3799ad||0x1f4;return function(_0x119770){logger['error'](_0x119770['stack']);if(_0x119770[_0x6109('0x19')]){delete _0x119770[_0x6109('0x19')];}_0x4ccf14['status'](_0x3799ad)[_0x6109('0x1a')](_0x119770);};}exports[_0x6109('0x1b')]=function(_0x3e9b61,_0x1cde64){var _0x4da4e9={};var _0x3d23ea={'count':0x0,'rows':[]};var _0x150291=_['map'](db['ChatQueue'][_0x6109('0x1c')],function(_0x41e053){return{'name':_0x41e053[_0x6109('0x1d')],'type':_0x41e053[_0x6109('0x1e')]['key']};});_0x4da4e9=qs[_0x6109('0x1f')](_0x150291,_0x3e9b61);var _0x77a9ba={'where':_0x4da4e9[_0x6109('0x20')]};return db[_0x6109('0x21')]['count'](_0x77a9ba)[_0x6109('0x16')](function(_0x29cbae){_0x3d23ea[_0x6109('0x11')]=_0x29cbae;_0x4da4e9[_0x6109('0x22')]=qs[_0x6109('0x22')](_0x3e9b61['query']);return db[_0x6109('0x21')]['findAll'](_0x4da4e9);})[_0x6109('0x16')](function(_0x4b73fa){_0x3d23ea[_0x6109('0x23')]=_0x4b73fa;return _0x3d23ea;})[_0x6109('0x16')](respondWithFilteredResult(_0x1cde64,_0x4da4e9))[_0x6109('0x24')](handleError(_0x1cde64,null));};exports['show']=function(_0x33407a,_0x7c3f3e){var _0x13580c={'raw':!![],'where':{'id':_0x33407a[_0x6109('0x25')]['id']}},_0x3adac3={};_0x3adac3['model']=_[_0x6109('0x26')](db['ChatQueue']['rawAttributes']);_0x3adac3[_0x6109('0x27')]=_[_0x6109('0x26')](_0x33407a['query']);_0x3adac3[_0x6109('0x28')]=_['intersection'](_0x3adac3[_0x6109('0x29')],_0x3adac3[_0x6109('0x27')]);_0x13580c[_0x6109('0x2a')]=_[_0x6109('0x2b')](_0x3adac3['model'],qs[_0x6109('0x2c')](_0x33407a['query'][_0x6109('0x2c')]));_0x13580c[_0x6109('0x2a')]=_0x13580c[_0x6109('0x2a')][_0x6109('0x2d')]?_0x13580c[_0x6109('0x2a')]:_0x3adac3['model'];if(_0x33407a[_0x6109('0x27')][_0x6109('0x2e')]){_0x13580c['include']=[{'all':!![]}];}_0x13580c=_[_0x6109('0x2f')]({},_0x13580c,_0x33407a['options']);return db['ChatQueue'][_0x6109('0x30')](_0x13580c)['then'](handleEntityNotFound(_0x7c3f3e,null))['then'](respondWithResult(_0x7c3f3e,null))['catch'](handleError(_0x7c3f3e,null));};exports['create']=function(_0x406a14,_0x4e6d4a){return db[_0x6109('0x21')][_0x6109('0x31')](_0x406a14[_0x6109('0x32')],{})[_0x6109('0x16')](function(_0x39f6ab){var _0x45a108=_0x406a14[_0x6109('0x33')][_0x6109('0x34')]({'plain':!![]});if(!_0x45a108)throw new Error(_0x6109('0x35'));if(_0x45a108['role']==='user'){var _0x51e27c=_0x39f6ab[_0x6109('0x34')]({'plain':!![]});var _0x50e066='ChatQueues';return db[_0x6109('0x36')][_0x6109('0x30')]({'where':{'name':_0x50e066,'userProfileId':_0x45a108[_0x6109('0x37')]},'raw':!![]})['then'](function(_0x21a371){if(_0x21a371&&_0x21a371['autoAssociation']===0x0){return db[_0x6109('0x18')]['create']({'name':_0x51e27c[_0x6109('0x19')],'resourceId':_0x51e27c['id'],'type':_0x21a371[_0x6109('0x19')],'sectionId':_0x21a371['id']},{})[_0x6109('0x16')](function(){return _0x39f6ab;});}else{return _0x39f6ab;}})[_0x6109('0x24')](function(_0xa22b3f){logger['error'](_0x6109('0x38'),_0xa22b3f);throw _0xa22b3f;});}return _0x39f6ab;})[_0x6109('0x16')](respondWithResult(_0x4e6d4a,0xc9))[_0x6109('0x24')](handleError(_0x4e6d4a,null));};exports[_0x6109('0x14')]=function(_0x285915,_0xfa6380){if(_0x285915['body']['id']){delete _0x285915['body']['id'];}return db[_0x6109('0x21')][_0x6109('0x30')]({'where':{'id':_0x285915[_0x6109('0x25')]['id']}})[_0x6109('0x16')](handleEntityNotFound(_0xfa6380,null))[_0x6109('0x16')](saveUpdates(_0x285915[_0x6109('0x32')],null))[_0x6109('0x16')](respondWithResult(_0xfa6380,null))[_0x6109('0x24')](handleError(_0xfa6380,null));};exports[_0x6109('0x15')]=function(_0x4ef9a9,_0xe0224d){return db[_0x6109('0x21')][_0x6109('0x30')]({'where':{'id':_0x4ef9a9[_0x6109('0x25')]['id']}})[_0x6109('0x16')](handleEntityNotFound(_0xe0224d,null))[_0x6109('0x16')](removeEntity(_0xe0224d,null))['catch'](handleError(_0xe0224d,null));};exports[_0x6109('0x39')]=function(_0x485364,_0x2492dc){return db['ChatQueue'][_0x6109('0x39')]()['then'](respondWithResult(_0x2492dc,null))[_0x6109('0x24')](handleError(_0x2492dc,null));};exports[_0x6109('0x3a')]=function(_0x21f66f,_0x318be6){var _0x40444a={'raw':!![],'where':{}},_0x4243f1={},_0x3fe73a;return db[_0x6109('0x21')][_0x6109('0x3b')]({'where':{'id':_0x21f66f[_0x6109('0x25')]['id']}})[_0x6109('0x16')](handleEntityNotFound(_0x318be6,null))[_0x6109('0x16')](function(_0x578523){if(_0x578523){_0x3fe73a=_0x578523[_0x6109('0x34')]({'plain':!![]});_0x4243f1[_0x6109('0x29')]=_['keys'](db[_0x6109('0x3c')]['rawAttributes']);_0x4243f1[_0x6109('0x27')]=_['keys'](_0x21f66f[_0x6109('0x27')]);_0x4243f1[_0x6109('0x28')]=_[_0x6109('0x2b')](_0x4243f1[_0x6109('0x29')],_0x4243f1[_0x6109('0x27')]);_0x40444a[_0x6109('0x2a')]=_[_0x6109('0x2b')](_0x4243f1['model'],qs['fields'](_0x21f66f[_0x6109('0x27')][_0x6109('0x2c')]));_0x40444a[_0x6109('0x2a')]=_0x40444a[_0x6109('0x2a')][_0x6109('0x2d')]?_0x40444a['attributes']:_0x4243f1[_0x6109('0x29')];if(!_0x21f66f[_0x6109('0x27')][_0x6109('0x3d')](_0x6109('0x3e'))){_0x40444a[_0x6109('0x3f')]=qs[_0x6109('0x3f')](_0x21f66f[_0x6109('0x27')][_0x6109('0x3f')]);_0x40444a[_0x6109('0xf')]=qs[_0x6109('0xf')](_0x21f66f[_0x6109('0x27')][_0x6109('0xf')]);}_0x40444a[_0x6109('0x40')]=qs[_0x6109('0x41')](_0x21f66f[_0x6109('0x27')][_0x6109('0x41')]);_0x40444a[_0x6109('0x20')]=qs['filters'](_[_0x6109('0x42')](_0x21f66f['query'],_0x4243f1[_0x6109('0x28')]));_0x40444a[_0x6109('0x20')]['ChatQueueId']=_0x578523['id'];if(_0x21f66f[_0x6109('0x27')][_0x6109('0x43')]){_0x40444a[_0x6109('0x20')]=_[_0x6109('0x2f')](_0x40444a['where'],{'$or':_[_0x6109('0x44')](_0x40444a[_0x6109('0x2a')],function(_0x34ff29){var _0x589c7e={};_0x589c7e[_0x34ff29]={'$like':'%'+_0x21f66f[_0x6109('0x27')][_0x6109('0x43')]+'%'};return _0x589c7e;})});}_0x40444a=_[_0x6109('0x2f')]({},_0x40444a,_0x21f66f[_0x6109('0x45')]);return db['UserChatQueue']['findAll'](_0x40444a);}})[_0x6109('0x16')](function(_0x3a27c7){if(_0x3a27c7){return db[_0x6109('0x46')][_0x6109('0x47')]({'where':{'id':_['map'](_0x3a27c7,_0x6109('0x48')),'role':_0x6109('0x49')},'attributes':['id','name',_0x6109('0x4a'),'updatedAt',_0x6109('0x4b')]});}})['then'](function(_0x1352b6){if(_0x1352b6){return{'count':_0x1352b6['count'],'rows':_[_0x6109('0x44')](_0x1352b6['rows'],function(_0x3e63c8){return{'membername':_0x3e63c8['name'],'UserId':_0x3e63c8['id'],'queue_name':_0x3fe73a['name'],'ChatQueueId':_0x3fe73a['id'],'interface':util[_0x6109('0x4c')](_0x6109('0x4d'),'SIP',_0x3e63c8[_0x6109('0x19')]),'penalty':0x0,'paused':_0x3e63c8[_0x6109('0x4a')],'createdAt':_0x3e63c8['createdAt'],'updatedAt':_0x3e63c8[_0x6109('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x318be6,_0x40444a))[_0x6109('0x24')](handleError(_0x318be6,null));};exports[_0x6109('0x4f')]=function(_0x396ad4,_0xae7afd){var _0xdc4e28={};var _0x1f17c9={};var _0x41a959;var _0x3a68f6;return db[_0x6109('0x21')]['findOne']({'where':{'id':_0x396ad4[_0x6109('0x25')]['id']}})['then'](handleEntityNotFound(_0xae7afd,null))[_0x6109('0x16')](function(_0x417682){if(_0x417682){_0x41a959=_0x417682;_0x1f17c9['model']=_[_0x6109('0x26')](db['Team'][_0x6109('0x1c')]);_0x1f17c9['query']=_[_0x6109('0x26')](_0x396ad4['query']);_0x1f17c9['filters']=_[_0x6109('0x2b')](_0x1f17c9[_0x6109('0x29')],_0x1f17c9[_0x6109('0x27')]);_0xdc4e28[_0x6109('0x2a')]=_[_0x6109('0x2b')](_0x1f17c9['model'],qs[_0x6109('0x2c')](_0x396ad4['query']['fields']));_0xdc4e28['attributes']=_0xdc4e28[_0x6109('0x2a')][_0x6109('0x2d')]?_0xdc4e28['attributes']:_0x1f17c9[_0x6109('0x29')];_0xdc4e28[_0x6109('0x40')]=qs[_0x6109('0x41')](_0x396ad4[_0x6109('0x27')]['sort']);_0xdc4e28[_0x6109('0x20')]=qs[_0x6109('0x28')](_['pick'](_0x396ad4['query'],_0x1f17c9[_0x6109('0x28')]));if(_0x396ad4[_0x6109('0x27')][_0x6109('0x43')]){_0xdc4e28[_0x6109('0x20')]=_['merge'](_0xdc4e28[_0x6109('0x20')],{'$or':_[_0x6109('0x44')](_0xdc4e28[_0x6109('0x2a')],function(_0x2414be){var _0x59d25={};_0x59d25[_0x2414be]={'$like':'%'+_0x396ad4[_0x6109('0x27')][_0x6109('0x43')]+'%'};return _0x59d25;})});}_0xdc4e28=_[_0x6109('0x2f')]({},_0xdc4e28,_0x396ad4[_0x6109('0x45')]);return _0x41a959['getTeams'](_0xdc4e28);}})[_0x6109('0x16')](function(_0xc586ca){if(_0xc586ca){_0x3a68f6=_0xc586ca['length'];if(!_0x396ad4['query'][_0x6109('0x3d')]('nolimit')){_0xdc4e28[_0x6109('0x3f')]=qs[_0x6109('0x3f')](_0x396ad4[_0x6109('0x27')][_0x6109('0x3f')]);_0xdc4e28['offset']=qs[_0x6109('0xf')](_0x396ad4[_0x6109('0x27')][_0x6109('0xf')]);}return _0x41a959['getTeams'](_0xdc4e28);}})[_0x6109('0x16')](function(_0x2e8699){if(_0x2e8699){return _0x2e8699?{'count':_0x3a68f6,'rows':_0x2e8699}:null;}})[_0x6109('0x16')](respondWithResult(_0xae7afd,null))[_0x6109('0x24')](handleError(_0xae7afd,null));};exports[_0x6109('0x50')]=function(_0x3eb24a,_0x405026){var _0x3a9697=_0x3eb24a[_0x6109('0x32')][_0x6109('0x51')];return db['Team'][_0x6109('0x52')]({'where':{'id':_0x3a9697},'attributes':['id'],'include':[{'model':db[_0x6109('0x46')],'as':_0x6109('0x53'),'attributes':['id','name',_0x6109('0x54'),'voicePause',_0x6109('0x55')],'raw':!![]}]})[_0x6109('0x16')](function(_0x2b8018){if(_0x2b8018){var _0x1c992e=_[_0x6109('0x56')](_0x2b8018,function(_0x47e4f3){var _0x9e58ee=_0x47e4f3['get']({'plain':!![]});return _0x9e58ee['Agents'];});return db[_0x6109('0x21')][_0x6109('0x30')]({'where':{'id':_0x3eb24a[_0x6109('0x25')]['id']}})[_0x6109('0x16')](function(_0xed031){return db[_0x6109('0x57')][_0x6109('0x58')](function(_0x4980bc){return _0xed031['addTeams'](_0x3a9697,{'transaction':_0x4980bc})[_0x6109('0x16')](function(){return BPromise[_0x6109('0x59')](_0x1c992e,function(_0x2634ba){return db[_0x6109('0x3c')][_0x6109('0x5a')]({'where':{'UserId':_0x2634ba['id'],'ChatQueueId':_0x3eb24a[_0x6109('0x25')]['id']},'transaction':_0x4980bc});});})[_0x6109('0x16')](function(){_0x1c992e['forEach'](function(_0x52b1d1){socket['emit']('userChatQueue:save',{'UserId':_0x52b1d1['id'],'ChatQueueId':_0xed031['id']});});});});});}})[_0x6109('0x16')](respondWithStatusCode(_0x405026,null))[_0x6109('0x24')](handleError(_0x405026,null));};exports[_0x6109('0x5b')]=function(_0x5d7ab5,_0x4b7e00){return db[_0x6109('0x5c')][_0x6109('0x52')]({'where':{'id':_0x5d7ab5[_0x6109('0x27')][_0x6109('0x51')]},'attributes':['id'],'include':[{'model':db[_0x6109('0x46')],'as':_0x6109('0x53'),'attributes':['id'],'raw':!![]}]})[_0x6109('0x16')](handleEntityNotFound(_0x4b7e00,null))[_0x6109('0x16')](function(_0x10a7d7){var _0x427e10=_[_0x6109('0x44')](_0x10a7d7,'id');var _0x2f23f3=[];var _0x1a56e2=[];var _0x1782e9=squel['select']();_0x1782e9['field'](_0x6109('0x5d'))[_0x6109('0x5e')](_0x6109('0x5f'),'tq')[_0x6109('0x60')](_0x6109('0x61'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6109('0x20')]('ChatQueueId\x20=\x20?',_0x5d7ab5[_0x6109('0x25')]['id']);for(var _0xc9ad90=0x0;_0xc9ad90<_0x10a7d7['length'];_0xc9ad90+=0x1){let _0x3016c7=_0x10a7d7[_0xc9ad90];for(var _0x1a608d=0x0;_0x1a608d<_0x3016c7[_0x6109('0x53')]['length'];_0x1a608d+=0x1){let _0x58042b=_0x3016c7[_0x6109('0x53')][_0x1a608d];var _0x30e94e=_0x1782e9[_0x6109('0x62')]();_0x30e94e['where']('ut.UserId\x20=\x20?',_0x58042b['id']);_0x1a56e2['push'](db[_0x6109('0x57')][_0x6109('0x27')](_0x30e94e[_0x6109('0x63')](),{'type':db[_0x6109('0x57')][_0x6109('0x64')][_0x6109('0x65')]})[_0x6109('0x16')](function(_0x2246f6){if(_0x2246f6['length']===0x1){return _0x58042b['id'];}else{var _0x412f4c=_[_0x6109('0x66')](_['map'](_0x2246f6,_0x6109('0x67')),function(_0x5e5e5a){return _[_0x6109('0x68')](_0x427e10,_0x5e5e5a);});if(_0x412f4c){return _0x58042b['id'];}}}));}}return BPromise[_0x6109('0x69')](_0x1a56e2)[_0x6109('0x16')](function(_0x3d964d){_0x2f23f3=_(_0x2f23f3)[_0x6109('0x6a')](_0x3d964d)[_0x6109('0x6b')]()[_0x6109('0x6c')]();return db['ChatQueue'][_0x6109('0x30')]({'where':{'id':_0x5d7ab5[_0x6109('0x25')]['id']}})[_0x6109('0x16')](function(_0x36b222){return db[_0x6109('0x57')][_0x6109('0x58')](function(_0x564d2d){return _0x36b222[_0x6109('0x5b')](_0x5d7ab5['query'][_0x6109('0x51')],{'transaction':_0x564d2d})[_0x6109('0x16')](function(){if(!_[_0x6109('0x6d')](_0x2f23f3)){return _0x36b222['removeAgents'](_0x2f23f3,{'transaction':_0x564d2d});}})[_0x6109('0x16')](function(){_0x2f23f3[_0x6109('0x6e')](function(_0x2600f5){socket[_0x6109('0x6f')](_0x6109('0x70'),{'UserId':_0x2600f5,'ChatQueueId':_0x36b222['id']});});});});});});})[_0x6109('0x16')](respondWithStatusCode(_0x4b7e00,null))[_0x6109('0x24')](handleError(_0x4b7e00,null));};exports[_0x6109('0x71')]=function(_0x1ffd76,_0x434d3a){return db['ChatQueue'][_0x6109('0x30')]({'where':{'id':_0x1ffd76[_0x6109('0x25')]['id']}})[_0x6109('0x16')](handleEntityNotFound(_0x434d3a,null))['then'](function(_0x464977){if(_0x464977){return _0x464977[_0x6109('0x71')](_0x1ffd76['body'][_0x6109('0x51')],_[_0x6109('0x72')](_0x1ffd76['body'],[_0x6109('0x51'),'id'])||{})[_0x6109('0x73')](function(_0x3b4639){for(var _0x393ada=0x0;_0x393ada<_0x1ffd76[_0x6109('0x32')][_0x6109('0x51')][_0x6109('0x2d')];_0x393ada+=0x1){socket[_0x6109('0x6f')](_0x6109('0x74'),{'UserId':Number(_0x1ffd76[_0x6109('0x32')][_0x6109('0x51')][_0x393ada]),'ChatQueueId':Number(_0x1ffd76[_0x6109('0x25')]['id'])});}return _0x3b4639;});}})[_0x6109('0x16')](respondWithResult(_0x434d3a,null))[_0x6109('0x24')](handleError(_0x434d3a,null));};exports[_0x6109('0x75')]=function(_0x154eb9,_0x42d6f6){return db['ChatQueue'][_0x6109('0x30')]({'where':{'id':_0x154eb9[_0x6109('0x25')]['id']}})[_0x6109('0x16')](handleEntityNotFound(_0x42d6f6,null))[_0x6109('0x16')](function(_0x1d957a){if(_0x1d957a){return _0x1d957a[_0x6109('0x75')](_0x154eb9[_0x6109('0x27')][_0x6109('0x51')])[_0x6109('0x16')](function(){if(_[_0x6109('0x76')](_0x154eb9['query']['ids'])){for(var _0x7d335b=0x0;_0x7d335b<_0x154eb9[_0x6109('0x27')][_0x6109('0x51')]['length'];_0x7d335b+=0x1){socket[_0x6109('0x6f')]('userChatQueue:remove',{'UserId':Number(_0x154eb9['query']['ids'][_0x7d335b]),'ChatQueueId':Number(_0x154eb9[_0x6109('0x25')]['id'])});}}else{socket['emit'](_0x6109('0x70'),{'UserId':Number(_0x154eb9['query'][_0x6109('0x51')]),'ChatQueueId':Number(_0x154eb9['params']['id'])});}});}})[_0x6109('0x16')](respondWithStatusCode(_0x42d6f6,null))[_0x6109('0x24')](handleError(_0x42d6f6,null));};exports[_0x6109('0x77')]=function(_0x1a2788,_0x467a60){var _0x262255={};var _0x1a88bd={};var _0x27671c;var _0x546eda;return db['ChatQueue'][_0x6109('0x3b')]({'where':{'id':_0x1a2788['params']['id']}})[_0x6109('0x16')](handleEntityNotFound(_0x467a60,null))[_0x6109('0x16')](function(_0x296523){if(_0x296523){_0x27671c=_0x296523;_0x1a88bd[_0x6109('0x29')]=_[_0x6109('0x26')](db[_0x6109('0x46')][_0x6109('0x1c')]);_0x1a88bd[_0x6109('0x27')]=_['keys'](_0x1a2788['query']);_0x1a88bd[_0x6109('0x28')]=_['intersection'](_0x1a88bd[_0x6109('0x29')],_0x1a88bd['query']);_0x262255[_0x6109('0x2a')]=_['intersection'](_0x1a88bd['model'],qs[_0x6109('0x2c')](_0x1a2788[_0x6109('0x27')][_0x6109('0x2c')]));_0x262255[_0x6109('0x2a')]=_0x262255[_0x6109('0x2a')][_0x6109('0x2d')]?_0x262255[_0x6109('0x2a')]:_0x1a88bd[_0x6109('0x29')];_0x262255[_0x6109('0x40')]=qs[_0x6109('0x41')](_0x1a2788['query'][_0x6109('0x41')]);_0x262255[_0x6109('0x20')]=qs[_0x6109('0x28')](_[_0x6109('0x42')](_0x1a2788[_0x6109('0x27')],_0x1a88bd[_0x6109('0x28')]));if(_0x1a2788[_0x6109('0x27')][_0x6109('0x43')]){_0x262255[_0x6109('0x20')]=_[_0x6109('0x2f')](_0x262255[_0x6109('0x20')],{'$or':_[_0x6109('0x44')](_0x262255[_0x6109('0x2a')],function(_0x3f789d){var _0x3717d8={};_0x3717d8[_0x3f789d]={'$like':'%'+_0x1a2788[_0x6109('0x27')][_0x6109('0x43')]+'%'};return _0x3717d8;})});}_0x262255=_[_0x6109('0x2f')]({},_0x262255,_0x1a2788[_0x6109('0x45')]);return _0x27671c[_0x6109('0x77')](_0x262255);}})[_0x6109('0x16')](function(_0x4645cb){if(_0x4645cb){_0x546eda=_0x4645cb[_0x6109('0x2d')];if(!_0x1a2788[_0x6109('0x27')][_0x6109('0x3d')](_0x6109('0x3e'))){_0x262255[_0x6109('0x3f')]=qs[_0x6109('0x3f')](_0x1a2788[_0x6109('0x27')][_0x6109('0x3f')]);_0x262255['offset']=qs[_0x6109('0xf')](_0x1a2788['query'][_0x6109('0xf')]);}return _0x27671c[_0x6109('0x77')](_0x262255);}})[_0x6109('0x16')](function(_0x4752ec){if(_0x4752ec){return _0x4752ec?{'count':_0x546eda,'rows':_0x4752ec}:null;}})['then'](respondWithResult(_0x467a60,null))[_0x6109('0x24')](handleError(_0x467a60,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 10f71a7..a616b08 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 _0x8954=['hook','exports','events','ChatQueue','setMaxListeners','emit','hasOwnProperty'];(function(_0x117260,_0x14e08f){var _0x4d32f7=function(_0x1c5446){while(--_0x1c5446){_0x117260['push'](_0x117260['shift']());}};_0x4d32f7(++_0x14e08f);}(_0x8954,0x136));var _0x4895=function(_0x2e3dcd,_0x1d883d){_0x2e3dcd=_0x2e3dcd-0x0;var _0x3cb872=_0x8954[_0x2e3dcd];return _0x3cb872;};'use strict';var EventEmitter=require(_0x4895('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4895('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4895('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x39e68b){return function(_0x469496,_0x175e0c,_0x23b837){ChatQueueEvents[_0x4895('0x3')](_0x39e68b+':'+_0x469496['id'],_0x469496);ChatQueueEvents['emit'](_0x39e68b,_0x469496);_0x23b837(null);};}for(var e in events){if(events[_0x4895('0x4')](e)){var event=events[e];ChatQueue[_0x4895('0x5')](e,emitEvent(event));}}module[_0x4895('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x6fff=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3407be,_0x3ad78b){var _0x1743e2=function(_0x564703){while(--_0x564703){_0x3407be['push'](_0x3407be['shift']());}};_0x1743e2(++_0x3ad78b);}(_0x6fff,0x160));var _0xf6ff=function(_0x2a27cc,_0x76891){_0x2a27cc=_0x2a27cc-0x0;var _0x32326a=_0x6fff[_0x2a27cc];return _0x32326a;};'use strict';var EventEmitter=require(_0xf6ff('0x0'));var ChatQueue=require(_0xf6ff('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6ff('0x2'),'afterUpdate':'update','afterDestroy':_0xf6ff('0x3')};function emitEvent(_0x2bd8df){return function(_0x401f76,_0x1f9573,_0x3f3319){ChatQueueEvents[_0xf6ff('0x4')](_0x2bd8df+':'+_0x401f76['id'],_0x401f76);ChatQueueEvents[_0xf6ff('0x4')](_0x2bd8df,_0x401f76);_0x3f3319(null);};}for(var e in events){if(events[_0xf6ff('0x5')](e)){var event=events[e];ChatQueue[_0xf6ff('0x6')](e,emitEvent(event));}}module[_0xf6ff('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index de7cc01..39aa7a1 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 _0xd9c8=['define','ChatQueue','chat_queues','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1ec1b8,_0x4e3651){var _0x4d0f2c=function(_0x502766){while(--_0x502766){_0x1ec1b8['push'](_0x1ec1b8['shift']());}};_0x4d0f2c(++_0x4e3651);}(_0xd9c8,0x66));var _0x8d9c=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xd9c8[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8d9c('0x2'));var BPromise=require(_0x8d9c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d9c('0x4'));var rimraf=require(_0x8d9c('0x5'));var config=require(_0x8d9c('0x6'));var attributes=require('./chatQueue.attributes');module[_0x8d9c('0x7')]=function(_0x368ea6,_0x203291){return _0x368ea6[_0x8d9c('0x8')](_0x8d9c('0x9'),attributes,{'tableName':_0x8d9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15a9=['define','ChatQueue','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x15a9,0xa7));var _0x915a=function(_0x4abd5b,_0x10e5d4){_0x4abd5b=_0x4abd5b-0x0;var _0x14d848=_0x15a9[_0x4abd5b];return _0x14d848;};'use strict';var _=require(_0x915a('0x0'));var util=require('util');var logger=require(_0x915a('0x1'))(_0x915a('0x2'));var moment=require(_0x915a('0x3'));var BPromise=require('bluebird');var rp=require(_0x915a('0x4'));var fs=require('fs');var path=require(_0x915a('0x5'));var rimraf=require('rimraf');var config=require(_0x915a('0x6'));var attributes=require(_0x915a('0x7'));module[_0x915a('0x8')]=function(_0x1b5876,_0xd3f27d){return _0x1b5876[_0x915a('0x9')](_0x915a('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 708b6ff..aec0224 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 _0x7582=['map','include','model','GetChatQueue','debug','ShowChatQueue','ChatQueue','find','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7582,0x167));var _0x2758=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x7582[_0xdeac17];return _0x33aabd;};'use strict';var _=require('lodash');var util=require(_0x2758('0x0'));var moment=require(_0x2758('0x1'));var BPromise=require(_0x2758('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2758('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2758('0x4'));var logger=require(_0x2758('0x5'))(_0x2758('0x6'));var config=require(_0x2758('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2758('0x8')][_0x2758('0x9')]({'port':0x232a});config['redis']=_[_0x2758('0xa')](config[_0x2758('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2758('0xc'))(new Redis(config[_0x2758('0xb')]));require(_0x2758('0xd'))['register'](socket);function respondWithRpcPromise(_0x39afde,_0x1bb787,_0x5816fe){return new BPromise(function(_0x51fd3c,_0x32cf1a){return client[_0x2758('0xe')](_0x39afde,_0x5816fe)[_0x2758('0xf')](function(_0x27df52){logger[_0x2758('0x10')](_0x2758('0x11'),_0x1bb787,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1bb787,_0x2758('0x12'),JSON[_0x2758('0x13')](_0x27df52));if(_0x27df52[_0x2758('0x14')]){if(_0x27df52[_0x2758('0x14')][_0x2758('0x15')]===0x1f4){logger[_0x2758('0x14')](_0x2758('0x11'),_0x1bb787,_0x27df52[_0x2758('0x14')][_0x2758('0x16')]);return _0x32cf1a(_0x27df52[_0x2758('0x14')][_0x2758('0x16')]);}logger[_0x2758('0x14')](_0x2758('0x11'),_0x1bb787,_0x27df52[_0x2758('0x14')]['message']);return _0x51fd3c(_0x27df52['error']['message']);}else{logger[_0x2758('0x10')](_0x2758('0x11'),_0x1bb787,_0x2758('0x12'));_0x51fd3c(_0x27df52[_0x2758('0x17')][_0x2758('0x16')]);}})[_0x2758('0x18')](function(_0x594575){logger[_0x2758('0x14')](_0x2758('0x11'),_0x1bb787,_0x594575);_0x32cf1a(_0x594575);});});}exports['GetChatQueue']=function(_0x30b3d9){var _0x1cdc63=this;return new Promise(function(_0x8cfe47,_0x4100a0){return db['ChatQueue'][_0x2758('0x19')]({'raw':_0x30b3d9['options']?_0x30b3d9[_0x2758('0x1a')][_0x2758('0x1b')]===undefined?!![]:![]:!![],'where':_0x30b3d9[_0x2758('0x1a')]?_0x30b3d9[_0x2758('0x1a')][_0x2758('0x1c')]||null:null,'attributes':_0x30b3d9[_0x2758('0x1a')]?_0x30b3d9[_0x2758('0x1a')][_0x2758('0x1d')]||null:null,'limit':_0x30b3d9[_0x2758('0x1a')]?_0x30b3d9[_0x2758('0x1a')][_0x2758('0x1e')]||null:null,'include':_0x30b3d9[_0x2758('0x1a')]?_0x30b3d9['options']['include']?_[_0x2758('0x1f')](_0x30b3d9[_0x2758('0x1a')][_0x2758('0x20')],function(_0x2209fc){return{'model':db[_0x2209fc[_0x2758('0x21')]],'as':_0x2209fc['as'],'attributes':_0x2209fc[_0x2758('0x1d')],'include':_0x2209fc['include']?_['map'](_0x2209fc[_0x2758('0x20')],function(_0x28c1f2){return{'model':db[_0x28c1f2[_0x2758('0x21')]],'as':_0x28c1f2['as'],'attributes':_0x28c1f2[_0x2758('0x1d')],'include':_0x28c1f2['include']?_['map'](_0x28c1f2[_0x2758('0x20')],function(_0x230f28){return{'model':db[_0x230f28[_0x2758('0x21')]],'as':_0x230f28['as'],'attributes':_0x230f28['attributes']};}):[]};}):[]};}):[]:[]})[_0x2758('0xf')](function(_0x4b20ee){logger[_0x2758('0x10')](_0x2758('0x22'),_0x30b3d9);logger[_0x2758('0x23')](_0x2758('0x22'),_0x30b3d9,JSON[_0x2758('0x13')](_0x4b20ee));_0x8cfe47(_0x4b20ee);})[_0x2758('0x18')](function(_0x2d44e4){logger[_0x2758('0x14')](_0x2758('0x22'),_0x2d44e4[_0x2758('0x16')],_0x30b3d9);_0x4100a0(_0x1cdc63['error'](0x1f4,_0x2d44e4[_0x2758('0x16')]));});});};exports[_0x2758('0x24')]=function(_0x819909){var _0x2f7f7b=this;return new Promise(function(_0x51b7db,_0x5f105f){return db[_0x2758('0x25')][_0x2758('0x26')]({'raw':_0x819909['options']?_0x819909[_0x2758('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x819909[_0x2758('0x1a')]?_0x819909['options'][_0x2758('0x1c')]||null:null,'attributes':_0x819909[_0x2758('0x1a')]?_0x819909['options'][_0x2758('0x1d')]||null:null,'include':_0x819909[_0x2758('0x1a')]?_0x819909[_0x2758('0x1a')][_0x2758('0x20')]?_[_0x2758('0x1f')](_0x819909[_0x2758('0x1a')][_0x2758('0x20')],function(_0x4453a8){return{'model':db[_0x4453a8['model']],'as':_0x4453a8['as'],'attributes':_0x4453a8[_0x2758('0x1d')],'include':_0x4453a8[_0x2758('0x20')]?_[_0x2758('0x1f')](_0x4453a8[_0x2758('0x20')],function(_0x4030c5){return{'model':db[_0x4030c5[_0x2758('0x21')]],'as':_0x4030c5['as'],'attributes':_0x4030c5[_0x2758('0x1d')],'include':_0x4030c5[_0x2758('0x20')]?_[_0x2758('0x1f')](_0x4030c5['include'],function(_0x4ba64a){return{'model':db[_0x4ba64a[_0x2758('0x21')]],'as':_0x4ba64a['as'],'attributes':_0x4ba64a[_0x2758('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2758('0xf')](function(_0x2c3aab){logger[_0x2758('0x10')](_0x2758('0x24'),_0x819909);logger['debug'](_0x2758('0x24'),_0x819909,JSON[_0x2758('0x13')](_0x2c3aab));_0x51b7db(_0x2c3aab);})['catch'](function(_0x57908c){logger['error'](_0x2758('0x24'),_0x57908c[_0x2758('0x16')],_0x819909);_0x5f105f(_0x2f7f7b[_0x2758('0x14')](0x1f4,_0x57908c[_0x2758('0x16')]));});});}; \ No newline at end of file +var _0x5fbb=['./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','where','include','map','model','attributes','stringify','ShowChatQueue','find','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x25ce5a,_0x2f621e){var _0xe19595=function(_0x167964){while(--_0x167964){_0x25ce5a['push'](_0x25ce5a['shift']());}};_0xe19595(++_0x2f621e);}(_0x5fbb,0x1ba));var _0xb5fb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5fbb[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb5fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5fb('0x1'));var fs=require('fs');var Redis=require(_0xb5fb('0x2'));var db=require(_0xb5fb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5fb('0x4'))(_0xb5fb('0x5'));var config=require(_0xb5fb('0x6'));var jayson=require(_0xb5fb('0x7'));var client=jayson[_0xb5fb('0x8')][_0xb5fb('0x9')]({'port':0x232a});config[_0xb5fb('0xa')]=_[_0xb5fb('0xb')](config[_0xb5fb('0xa')],{'host':_0xb5fb('0xc'),'port':0x18eb});var socket=require(_0xb5fb('0xd'))(new Redis(config[_0xb5fb('0xa')]));require(_0xb5fb('0xe'))['register'](socket);function respondWithRpcPromise(_0x462832,_0x84f5a8,_0x38f18a){return new BPromise(function(_0x58eb20,_0x5e3694){return client['request'](_0x462832,_0x38f18a)[_0xb5fb('0xf')](function(_0xf7cb72){logger['info'](_0xb5fb('0x10'),_0x84f5a8,_0xb5fb('0x11'));logger[_0xb5fb('0x12')](_0xb5fb('0x13'),_0x84f5a8,_0xb5fb('0x11'),JSON['stringify'](_0xf7cb72));if(_0xf7cb72[_0xb5fb('0x14')]){if(_0xf7cb72[_0xb5fb('0x14')][_0xb5fb('0x15')]===0x1f4){logger[_0xb5fb('0x14')](_0xb5fb('0x10'),_0x84f5a8,_0xf7cb72['error'][_0xb5fb('0x16')]);return _0x5e3694(_0xf7cb72[_0xb5fb('0x14')]['message']);}logger[_0xb5fb('0x14')](_0xb5fb('0x10'),_0x84f5a8,_0xf7cb72['error'][_0xb5fb('0x16')]);return _0x58eb20(_0xf7cb72['error'][_0xb5fb('0x16')]);}else{logger[_0xb5fb('0x17')](_0xb5fb('0x10'),_0x84f5a8,_0xb5fb('0x11'));_0x58eb20(_0xf7cb72[_0xb5fb('0x18')][_0xb5fb('0x16')]);}})[_0xb5fb('0x19')](function(_0x15d462){logger[_0xb5fb('0x14')](_0xb5fb('0x10'),_0x84f5a8,_0x15d462);_0x5e3694(_0x15d462);});});}exports[_0xb5fb('0x1a')]=function(_0x3a87fe){var _0x1daacb=this;return new Promise(function(_0x28ad5b,_0x15a8f4){return db[_0xb5fb('0x1b')]['findAll']({'raw':_0x3a87fe['options']?_0x3a87fe[_0xb5fb('0x1c')][_0xb5fb('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a87fe[_0xb5fb('0x1c')]?_0x3a87fe[_0xb5fb('0x1c')][_0xb5fb('0x1e')]||null:null,'attributes':_0x3a87fe[_0xb5fb('0x1c')]?_0x3a87fe[_0xb5fb('0x1c')]['attributes']||null:null,'limit':_0x3a87fe[_0xb5fb('0x1c')]?_0x3a87fe[_0xb5fb('0x1c')]['limit']||null:null,'include':_0x3a87fe[_0xb5fb('0x1c')]?_0x3a87fe[_0xb5fb('0x1c')][_0xb5fb('0x1f')]?_[_0xb5fb('0x20')](_0x3a87fe[_0xb5fb('0x1c')][_0xb5fb('0x1f')],function(_0x17e59f){return{'model':db[_0x17e59f[_0xb5fb('0x21')]],'as':_0x17e59f['as'],'attributes':_0x17e59f[_0xb5fb('0x22')],'include':_0x17e59f[_0xb5fb('0x1f')]?_[_0xb5fb('0x20')](_0x17e59f['include'],function(_0x3820dc){return{'model':db[_0x3820dc[_0xb5fb('0x21')]],'as':_0x3820dc['as'],'attributes':_0x3820dc[_0xb5fb('0x22')],'include':_0x3820dc[_0xb5fb('0x1f')]?_[_0xb5fb('0x20')](_0x3820dc[_0xb5fb('0x1f')],function(_0x4d9cc6){return{'model':db[_0x4d9cc6[_0xb5fb('0x21')]],'as':_0x4d9cc6['as'],'attributes':_0x4d9cc6[_0xb5fb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb5fb('0xf')](function(_0x2aa7bf){logger[_0xb5fb('0x17')]('GetChatQueue',_0x3a87fe);logger['debug']('GetChatQueue',_0x3a87fe,JSON[_0xb5fb('0x23')](_0x2aa7bf));_0x28ad5b(_0x2aa7bf);})[_0xb5fb('0x19')](function(_0x58c9a8){logger[_0xb5fb('0x14')](_0xb5fb('0x1a'),_0x58c9a8[_0xb5fb('0x16')],_0x3a87fe);_0x15a8f4(_0x1daacb['error'](0x1f4,_0x58c9a8[_0xb5fb('0x16')]));});});};exports[_0xb5fb('0x24')]=function(_0x5a60fb){var _0x54c2aa=this;return new Promise(function(_0x2ca3a6,_0x8d71da){return db[_0xb5fb('0x1b')][_0xb5fb('0x25')]({'raw':_0x5a60fb[_0xb5fb('0x1c')]?_0x5a60fb[_0xb5fb('0x1c')][_0xb5fb('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a60fb[_0xb5fb('0x1c')]?_0x5a60fb[_0xb5fb('0x1c')]['where']||null:null,'attributes':_0x5a60fb[_0xb5fb('0x1c')]?_0x5a60fb[_0xb5fb('0x1c')][_0xb5fb('0x22')]||null:null,'include':_0x5a60fb[_0xb5fb('0x1c')]?_0x5a60fb[_0xb5fb('0x1c')][_0xb5fb('0x1f')]?_[_0xb5fb('0x20')](_0x5a60fb[_0xb5fb('0x1c')][_0xb5fb('0x1f')],function(_0x6b3e2e){return{'model':db[_0x6b3e2e['model']],'as':_0x6b3e2e['as'],'attributes':_0x6b3e2e['attributes'],'include':_0x6b3e2e['include']?_['map'](_0x6b3e2e[_0xb5fb('0x1f')],function(_0x4fe549){return{'model':db[_0x4fe549[_0xb5fb('0x21')]],'as':_0x4fe549['as'],'attributes':_0x4fe549['attributes'],'include':_0x4fe549['include']?_[_0xb5fb('0x20')](_0x4fe549[_0xb5fb('0x1f')],function(_0x2629f9){return{'model':db[_0x2629f9[_0xb5fb('0x21')]],'as':_0x2629f9['as'],'attributes':_0x2629f9[_0xb5fb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40f732){logger[_0xb5fb('0x17')](_0xb5fb('0x24'),_0x5a60fb);logger[_0xb5fb('0x12')](_0xb5fb('0x24'),_0x5a60fb,JSON[_0xb5fb('0x23')](_0x40f732));_0x2ca3a6(_0x40f732);})[_0xb5fb('0x19')](function(_0x1a0dfa){logger[_0xb5fb('0x14')](_0xb5fb('0x24'),_0x1a0dfa[_0xb5fb('0x16')],_0x5a60fb);_0x8d71da(_0x54c2aa[_0xb5fb('0x14')](0x1f4,_0x1a0dfa[_0xb5fb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e9b0bbe..56dbe3b 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 _0x6aa7=['update','emit','length','chatQueue:','./chatQueue.events','remove'];(function(_0x4d216c,_0x363a80){var _0x36fe74=function(_0x460e09){while(--_0x460e09){_0x4d216c['push'](_0x4d216c['shift']());}};_0x36fe74(++_0x363a80);}(_0x6aa7,0x178));var _0x76aa=function(_0x3ad2a0,_0x222027){_0x3ad2a0=_0x3ad2a0-0x0;var _0x5729d8=_0x6aa7[_0x3ad2a0];return _0x5729d8;};'use strict';var ChatQueueEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatQueueEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatQueueEvents['on'](_0xa9b695,_0x56d6bc);}}; \ No newline at end of file +var _0x0c02=['save','remove','emit','removeListener','register','chatQueue:'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){ChatQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);ChatQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 24e47dd..5fed92a 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x7cc618,_0x3da493){_0x7cc618=_0x7cc618-0x0;var _0x5b62b2=_0x3e74[_0x7cc618];return _0x5b62b2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5efc6d,_0x26f293){var _0x31d65f=function(_0x58b2ba){while(--_0x58b2ba){_0x5efc6d['push'](_0x5efc6d['shift']());}};_0x31d65f(++_0x26f293);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b4eb8ac..aa28c87 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 _0xb7a5=['sequelize','exports','STRING','DATE'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0xb7a5,0x13c));var _0x5b7a=function(_0x4792f8,_0x5dad13){_0x4792f8=_0x4792f8-0x0;var _0x50efe9=_0xb7a5[_0x4792f8];return _0x50efe9;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b7a('0x0'));module[_0x5b7a('0x1')]={'uniqueid':{'type':Sequelize[_0x5b7a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5b7a('0x2')]},'joinAt':{'type':Sequelize[_0x5b7a('0x3')]},'leaveAt':{'type':Sequelize[_0x5b7a('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5b7a('0x3')]},'reason':{'type':Sequelize[_0x5b7a('0x2')]}}; \ No newline at end of file +var _0x97f6=['STRING','DATE','moment','sequelize','exports'];(function(_0x562d85,_0x60bd0b){var _0x1a5780=function(_0x44e426){while(--_0x44e426){_0x562d85['push'](_0x562d85['shift']());}};_0x1a5780(++_0x60bd0b);}(_0x97f6,0x1bf));var _0x697f=function(_0x192b02,_0x9af40d){_0x192b02=_0x192b02-0x0;var _0x2effa3=_0x97f6[_0x192b02];return _0x2effa3;};'use strict';var moment=require(_0x697f('0x0'));var Sequelize=require(_0x697f('0x1'));module[_0x697f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x697f('0x3')]},'joinAt':{'type':Sequelize[_0x697f('0x4')]},'leaveAt':{'type':Sequelize[_0x697f('0x4')]},'acceptAt':{'type':Sequelize[_0x697f('0x4')]},'exitAt':{'type':Sequelize[_0x697f('0x4')]},'reason':{'type':Sequelize[_0x697f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ee7d012..2728f4d 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 _0x0958=['../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3220a2,_0x16f7b2){var _0x2307ce=function(_0x1e087d){while(--_0x1e087d){_0x3220a2['push'](_0x3220a2['shift']());}};_0x2307ce(++_0x16f7b2);}(_0x0958,0x7c));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x8095('0x0'));var rimraf=require(_0x8095('0x1'));var zipdir=require(_0x8095('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8095('0x3'));var moment=require(_0x8095('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8095('0x5'));var path=require(_0x8095('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8095('0x7'));var fs=require('fs');var fs_extra=require(_0x8095('0x8'));var _=require(_0x8095('0x9'));var squel=require(_0x8095('0xa'));var crypto=require(_0x8095('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8095('0xc'));var querystring=require(_0x8095('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8095('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8095('0xf'));var hardwareService=require(_0x8095('0x10'));var logger=require(_0x8095('0x11'))(_0x8095('0x12'));var utils=require(_0x8095('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8095('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2acacf,_0x4cf53f){_0x4cf53f=_0x4cf53f||0xcc;return function(_0x31803a){if(_0x31803a){return _0x2acacf[_0x8095('0x15')](_0x4cf53f);}return _0x2acacf[_0x8095('0x16')](_0x4cf53f)[_0x8095('0x17')]();};}function respondWithResult(_0x5cfc5f,_0x8f6b26){_0x8f6b26=_0x8f6b26||0xc8;return function(_0x2f75a4){if(_0x2f75a4){return _0x5cfc5f[_0x8095('0x16')](_0x8f6b26)['json'](_0x2f75a4);}};}function respondWithFilteredResult(_0x5c1299,_0x3f446f){return function(_0x42a59a){if(_0x42a59a){var _0xb7c487=typeof _0x3f446f[_0x8095('0x18')]==='undefined'&&typeof _0x3f446f[_0x8095('0x19')]===_0x8095('0x1a');var _0x4a1d27=_0x42a59a['count'];var _0x13ff41=_0xb7c487?0x0:_0x3f446f['offset'];var _0x3e4fde=_0xb7c487?_0x42a59a[_0x8095('0x1b')]:_0x3f446f[_0x8095('0x18')]+_0x3f446f['limit'];var _0x2e5b38;if(_0x3e4fde>=_0x4a1d27){_0x3e4fde=_0x4a1d27;_0x2e5b38=0xc8;}else{_0x2e5b38=0xce;}_0x5c1299[_0x8095('0x16')](_0x2e5b38);return _0x5c1299[_0x8095('0x1c')]('Content-Range',_0x13ff41+'-'+_0x3e4fde+'/'+_0x4a1d27)[_0x8095('0x1d')](_0x42a59a);}return null;};}function patchUpdates(_0x104cc4){return function(_0xb0a513){try{jsonpatch['apply'](_0xb0a513,_0x104cc4,!![]);}catch(_0x176ba9){return BPromise['reject'](_0x176ba9);}return _0xb0a513[_0x8095('0x1e')]();};}function saveUpdates(_0x3f4b29,_0x421792){return function(_0x1c97c4){if(_0x1c97c4){return _0x1c97c4[_0x8095('0x1f')](_0x3f4b29)[_0x8095('0x20')](function(_0x2a7bb6){return _0x2a7bb6;});}return null;};}function removeEntity(_0x138b65,_0x23ece3){return function(_0x441fbf){if(_0x441fbf){return _0x441fbf[_0x8095('0x21')]()[_0x8095('0x20')](function(){_0x138b65[_0x8095('0x16')](0xcc)[_0x8095('0x17')]();});}};}function handleEntityNotFound(_0x5896f4,_0x499138){return function(_0x1b2939){if(!_0x1b2939){_0x5896f4[_0x8095('0x15')](0x194);}return _0x1b2939;};}function handleError(_0x2552b9,_0x39cde9){_0x39cde9=_0x39cde9||0x1f4;return function(_0x3bf5ce){logger[_0x8095('0x22')](_0x3bf5ce[_0x8095('0x23')]);if(_0x3bf5ce[_0x8095('0x24')]){delete _0x3bf5ce[_0x8095('0x24')];}_0x2552b9[_0x8095('0x16')](_0x39cde9)[_0x8095('0x25')](_0x3bf5ce);};}exports[_0x8095('0x26')]=function(_0x223ade,_0x38d932){var _0xd4ff7d={},_0x22fc6c={},_0x38d69e={'count':0x0,'rows':[]};var _0x575801=_['map'](db[_0x8095('0x27')][_0x8095('0x28')],function(_0x45843c){return{'name':_0x45843c[_0x8095('0x29')],'type':_0x45843c[_0x8095('0x2a')][_0x8095('0x2b')]};});_0x22fc6c[_0x8095('0x2c')]=_['map'](_0x575801,'name');_0x22fc6c['query']=_[_0x8095('0x2d')](_0x223ade['query']);_0x22fc6c[_0x8095('0x2e')]=_[_0x8095('0x2f')](_0x22fc6c[_0x8095('0x2c')],_0x22fc6c[_0x8095('0x30')]);_0xd4ff7d[_0x8095('0x31')]=_['intersection'](_0x22fc6c['model'],qs['fields'](_0x223ade[_0x8095('0x30')][_0x8095('0x32')]));_0xd4ff7d[_0x8095('0x31')]=_0xd4ff7d[_0x8095('0x31')][_0x8095('0x33')]?_0xd4ff7d['attributes']:_0x22fc6c[_0x8095('0x2c')];if(!_0x223ade[_0x8095('0x30')]['hasOwnProperty'](_0x8095('0x34'))){_0xd4ff7d[_0x8095('0x19')]=qs['limit'](_0x223ade[_0x8095('0x30')][_0x8095('0x19')]);_0xd4ff7d[_0x8095('0x18')]=qs[_0x8095('0x18')](_0x223ade['query'][_0x8095('0x18')]);}_0xd4ff7d[_0x8095('0x35')]=qs[_0x8095('0x36')](_0x223ade[_0x8095('0x30')][_0x8095('0x36')]);_0xd4ff7d[_0x8095('0x37')]=qs[_0x8095('0x2e')](_['pick'](_0x223ade[_0x8095('0x30')],_0x22fc6c[_0x8095('0x2e')]),_0x575801);if(_0x223ade['query'][_0x8095('0x38')]){_0xd4ff7d[_0x8095('0x37')]=_[_0x8095('0x39')](_0xd4ff7d['where'],{'$or':_[_0x8095('0x3a')](_0x575801,function(_0x44ef7d){if(_0x44ef7d['type']!==_0x8095('0x3b')){var _0x1b12fe={};_0x1b12fe[_0x44ef7d[_0x8095('0x24')]]={'$like':'%'+_0x223ade[_0x8095('0x30')]['filter']+'%'};return _0x1b12fe;}})});}_0xd4ff7d=_[_0x8095('0x39')]({},_0xd4ff7d,_0x223ade[_0x8095('0x3c')]);var _0x42827b={'where':_0xd4ff7d[_0x8095('0x37')]};return db[_0x8095('0x27')][_0x8095('0x1b')](_0x42827b)[_0x8095('0x20')](function(_0x482427){_0x38d69e[_0x8095('0x1b')]=_0x482427;if(_0x223ade[_0x8095('0x30')][_0x8095('0x3d')]){_0xd4ff7d[_0x8095('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x8095('0x3f')](_0xd4ff7d);})[_0x8095('0x20')](function(_0x5484d5){_0x38d69e[_0x8095('0x40')]=_0x5484d5;return _0x38d69e;})['then'](respondWithFilteredResult(_0x38d932,_0xd4ff7d))[_0x8095('0x41')](handleError(_0x38d932,null));};exports[_0x8095('0x42')]=function(_0x306fb4,_0x594309){var _0x15bcde={'raw':!![],'where':{'id':_0x306fb4['params']['id']}},_0x488e2e={};_0x488e2e['model']=_[_0x8095('0x2d')](db[_0x8095('0x27')][_0x8095('0x28')]);_0x488e2e[_0x8095('0x30')]=_[_0x8095('0x2d')](_0x306fb4[_0x8095('0x30')]);_0x488e2e[_0x8095('0x2e')]=_[_0x8095('0x2f')](_0x488e2e[_0x8095('0x2c')],_0x488e2e[_0x8095('0x30')]);_0x15bcde[_0x8095('0x31')]=_[_0x8095('0x2f')](_0x488e2e[_0x8095('0x2c')],qs['fields'](_0x306fb4[_0x8095('0x30')][_0x8095('0x32')]));_0x15bcde['attributes']=_0x15bcde[_0x8095('0x31')]['length']?_0x15bcde[_0x8095('0x31')]:_0x488e2e[_0x8095('0x2c')];if(_0x306fb4[_0x8095('0x30')][_0x8095('0x3d')]){_0x15bcde[_0x8095('0x3e')]=[{'all':!![]}];}_0x15bcde=_[_0x8095('0x39')]({},_0x15bcde,_0x306fb4[_0x8095('0x3c')]);return db[_0x8095('0x27')]['find'](_0x15bcde)[_0x8095('0x20')](handleEntityNotFound(_0x594309,null))[_0x8095('0x20')](respondWithResult(_0x594309,null))[_0x8095('0x41')](handleError(_0x594309,null));};exports[_0x8095('0x43')]=function(_0xa78ed7,_0x14fd11){return db[_0x8095('0x27')][_0x8095('0x43')](_0xa78ed7[_0x8095('0x44')],{})[_0x8095('0x20')](respondWithResult(_0x14fd11,0xc9))[_0x8095('0x41')](handleError(_0x14fd11,null));};exports[_0x8095('0x1f')]=function(_0x5961c8,_0x2209b6){if(_0x5961c8['body']['id']){delete _0x5961c8['body']['id'];}return db[_0x8095('0x27')][_0x8095('0x45')]({'where':{'id':_0x5961c8['params']['id']}})['then'](handleEntityNotFound(_0x2209b6,null))[_0x8095('0x20')](saveUpdates(_0x5961c8[_0x8095('0x44')],null))['then'](respondWithResult(_0x2209b6,null))[_0x8095('0x41')](handleError(_0x2209b6,null));};exports[_0x8095('0x21')]=function(_0x1bef5e,_0x1aa669){return db[_0x8095('0x27')][_0x8095('0x45')]({'where':{'id':_0x1bef5e[_0x8095('0x46')]['id']}})['then'](handleEntityNotFound(_0x1aa669,null))['then'](removeEntity(_0x1aa669,null))[_0x8095('0x41')](handleError(_0x1aa669,null));};exports['describe']=function(_0x4782d8,_0x49246c){return db[_0x8095('0x27')][_0x8095('0x47')]()['then'](respondWithResult(_0x49246c,null))[_0x8095('0x41')](handleError(_0x49246c,null));}; \ No newline at end of file +var _0x3024=['type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','send','map','ChatQueueReport','rawAttributes','fieldName'];(function(_0x3a833e,_0x5a1878){var _0xdff445=function(_0x1715a3){while(--_0x1715a3){_0x3a833e['push'](_0x3a833e['shift']());}};_0xdff445(++_0x5a1878);}(_0x3024,0x64));var _0x4302=function(_0x32a308,_0x3399c8){_0x32a308=_0x32a308-0x0;var _0x5eb939=_0x3024[_0x32a308];return _0x5eb939;};'use strict';var emlformat=require(_0x4302('0x0'));var rimraf=require(_0x4302('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4302('0x2'));var rp=require(_0x4302('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4302('0x4'));var util=require('util');var path=require(_0x4302('0x5'));var sox=require(_0x4302('0x6'));var csv=require('to-csv');var ejs=require(_0x4302('0x7'));var fs=require('fs');var fs_extra=require(_0x4302('0x8'));var _=require('lodash');var squel=require(_0x4302('0x9'));var crypto=require(_0x4302('0xa'));var jsforce=require(_0x4302('0xb'));var deskjs=require(_0x4302('0xc'));var toCsv=require(_0x4302('0xd'));var querystring=require(_0x4302('0xe'));var Papa=require(_0x4302('0xf'));var Redis=require('ioredis');var authService=require(_0x4302('0x10'));var qs=require(_0x4302('0x11'));var as=require(_0x4302('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4302('0x13'))(_0x4302('0x14'));var utils=require('../../config/utils');var config=require(_0x4302('0x15'));var licenseUtil=require(_0x4302('0x16'));var db=require(_0x4302('0x17'))['db'];function respondWithStatusCode(_0x5a0241,_0x3ce552){_0x3ce552=_0x3ce552||0xcc;return function(_0x177706){if(_0x177706){return _0x5a0241['sendStatus'](_0x3ce552);}return _0x5a0241[_0x4302('0x18')](_0x3ce552)[_0x4302('0x19')]();};}function respondWithResult(_0x2b9821,_0x5b19ca){_0x5b19ca=_0x5b19ca||0xc8;return function(_0x1b254c){if(_0x1b254c){return _0x2b9821[_0x4302('0x18')](_0x5b19ca)['json'](_0x1b254c);}};}function respondWithFilteredResult(_0x36599d,_0x27a6a8){return function(_0x53c593){if(_0x53c593){var _0x1cc113=typeof _0x27a6a8[_0x4302('0x1a')]===_0x4302('0x1b')&&typeof _0x27a6a8[_0x4302('0x1c')]===_0x4302('0x1b');var _0x3ce7c2=_0x53c593[_0x4302('0x1d')];var _0x23aa0e=_0x1cc113?0x0:_0x27a6a8[_0x4302('0x1a')];var _0x41de23=_0x1cc113?_0x53c593[_0x4302('0x1d')]:_0x27a6a8[_0x4302('0x1a')]+_0x27a6a8[_0x4302('0x1c')];var _0xa736ce;if(_0x41de23>=_0x3ce7c2){_0x41de23=_0x3ce7c2;_0xa736ce=0xc8;}else{_0xa736ce=0xce;}_0x36599d['status'](_0xa736ce);return _0x36599d[_0x4302('0x1e')]('Content-Range',_0x23aa0e+'-'+_0x41de23+'/'+_0x3ce7c2)[_0x4302('0x1f')](_0x53c593);}return null;};}function patchUpdates(_0x50d168){return function(_0x4ad2a3){try{jsonpatch[_0x4302('0x20')](_0x4ad2a3,_0x50d168,!![]);}catch(_0x102eee){return BPromise[_0x4302('0x21')](_0x102eee);}return _0x4ad2a3[_0x4302('0x22')]();};}function saveUpdates(_0x525520,_0x5e2404){return function(_0x1d99fe){if(_0x1d99fe){return _0x1d99fe[_0x4302('0x23')](_0x525520)[_0x4302('0x24')](function(_0x4b259d){return _0x4b259d;});}return null;};}function removeEntity(_0x19ab4c,_0x156072){return function(_0x72ed32){if(_0x72ed32){return _0x72ed32[_0x4302('0x25')]()['then'](function(){_0x19ab4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2952,_0x1021b1){return function(_0x3ffa91){if(!_0x3ffa91){_0x5a2952['sendStatus'](0x194);}return _0x3ffa91;};}function handleError(_0x1e0486,_0x33a916){_0x33a916=_0x33a916||0x1f4;return function(_0x20fe19){logger['error'](_0x20fe19[_0x4302('0x26')]);if(_0x20fe19['name']){delete _0x20fe19['name'];}_0x1e0486['status'](_0x33a916)[_0x4302('0x27')](_0x20fe19);};}exports['index']=function(_0x2e1633,_0x1aca12){var _0x5cb819={},_0x1b057f={},_0x5bc965={'count':0x0,'rows':[]};var _0x1ce315=_[_0x4302('0x28')](db[_0x4302('0x29')][_0x4302('0x2a')],function(_0x2dd48c){return{'name':_0x2dd48c[_0x4302('0x2b')],'type':_0x2dd48c[_0x4302('0x2c')][_0x4302('0x2d')]};});_0x1b057f[_0x4302('0x2e')]=_['map'](_0x1ce315,_0x4302('0x2f'));_0x1b057f[_0x4302('0x30')]=_[_0x4302('0x31')](_0x2e1633[_0x4302('0x30')]);_0x1b057f['filters']=_[_0x4302('0x32')](_0x1b057f[_0x4302('0x2e')],_0x1b057f[_0x4302('0x30')]);_0x5cb819[_0x4302('0x33')]=_[_0x4302('0x32')](_0x1b057f['model'],qs[_0x4302('0x34')](_0x2e1633[_0x4302('0x30')][_0x4302('0x34')]));_0x5cb819[_0x4302('0x33')]=_0x5cb819[_0x4302('0x33')][_0x4302('0x35')]?_0x5cb819[_0x4302('0x33')]:_0x1b057f[_0x4302('0x2e')];if(!_0x2e1633[_0x4302('0x30')]['hasOwnProperty'](_0x4302('0x36'))){_0x5cb819['limit']=qs[_0x4302('0x1c')](_0x2e1633['query']['limit']);_0x5cb819[_0x4302('0x1a')]=qs[_0x4302('0x1a')](_0x2e1633[_0x4302('0x30')]['offset']);}_0x5cb819[_0x4302('0x37')]=qs[_0x4302('0x38')](_0x2e1633[_0x4302('0x30')][_0x4302('0x38')]);_0x5cb819['where']=qs[_0x4302('0x39')](_['pick'](_0x2e1633[_0x4302('0x30')],_0x1b057f[_0x4302('0x39')]),_0x1ce315);if(_0x2e1633[_0x4302('0x30')][_0x4302('0x3a')]){_0x5cb819[_0x4302('0x3b')]=_['merge'](_0x5cb819[_0x4302('0x3b')],{'$or':_['map'](_0x1ce315,function(_0x4e4780){if(_0x4e4780['type']!==_0x4302('0x3c')){var _0x39bedf={};_0x39bedf[_0x4e4780[_0x4302('0x2f')]]={'$like':'%'+_0x2e1633[_0x4302('0x30')][_0x4302('0x3a')]+'%'};return _0x39bedf;}})});}_0x5cb819=_[_0x4302('0x3d')]({},_0x5cb819,_0x2e1633[_0x4302('0x3e')]);var _0x263950={'where':_0x5cb819[_0x4302('0x3b')]};return db[_0x4302('0x29')]['count'](_0x263950)['then'](function(_0x155361){_0x5bc965[_0x4302('0x1d')]=_0x155361;if(_0x2e1633[_0x4302('0x30')][_0x4302('0x3f')]){_0x5cb819['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x4302('0x40')](_0x5cb819);})[_0x4302('0x24')](function(_0x203c1f){_0x5bc965[_0x4302('0x41')]=_0x203c1f;return _0x5bc965;})[_0x4302('0x24')](respondWithFilteredResult(_0x1aca12,_0x5cb819))[_0x4302('0x42')](handleError(_0x1aca12,null));};exports['show']=function(_0x109c63,_0x52e975){var _0x372bb4={'raw':!![],'where':{'id':_0x109c63[_0x4302('0x43')]['id']}},_0x2a557b={};_0x2a557b[_0x4302('0x2e')]=_['keys'](db[_0x4302('0x29')][_0x4302('0x2a')]);_0x2a557b[_0x4302('0x30')]=_[_0x4302('0x31')](_0x109c63[_0x4302('0x30')]);_0x2a557b['filters']=_[_0x4302('0x32')](_0x2a557b[_0x4302('0x2e')],_0x2a557b['query']);_0x372bb4['attributes']=_[_0x4302('0x32')](_0x2a557b[_0x4302('0x2e')],qs['fields'](_0x109c63[_0x4302('0x30')][_0x4302('0x34')]));_0x372bb4[_0x4302('0x33')]=_0x372bb4[_0x4302('0x33')][_0x4302('0x35')]?_0x372bb4[_0x4302('0x33')]:_0x2a557b[_0x4302('0x2e')];if(_0x109c63[_0x4302('0x30')][_0x4302('0x3f')]){_0x372bb4[_0x4302('0x44')]=[{'all':!![]}];}_0x372bb4=_['merge']({},_0x372bb4,_0x109c63[_0x4302('0x3e')]);return db['ChatQueueReport'][_0x4302('0x45')](_0x372bb4)['then'](handleEntityNotFound(_0x52e975,null))[_0x4302('0x24')](respondWithResult(_0x52e975,null))[_0x4302('0x42')](handleError(_0x52e975,null));};exports['create']=function(_0x34bc72,_0x558af4){return db[_0x4302('0x29')]['create'](_0x34bc72[_0x4302('0x46')],{})[_0x4302('0x24')](respondWithResult(_0x558af4,0xc9))[_0x4302('0x42')](handleError(_0x558af4,null));};exports[_0x4302('0x23')]=function(_0x25b46b,_0x2b073b){if(_0x25b46b['body']['id']){delete _0x25b46b[_0x4302('0x46')]['id'];}return db[_0x4302('0x29')][_0x4302('0x45')]({'where':{'id':_0x25b46b[_0x4302('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b073b,null))[_0x4302('0x24')](saveUpdates(_0x25b46b[_0x4302('0x46')],null))[_0x4302('0x24')](respondWithResult(_0x2b073b,null))[_0x4302('0x42')](handleError(_0x2b073b,null));};exports[_0x4302('0x25')]=function(_0x1dbe2f,_0x359f87){return db[_0x4302('0x29')][_0x4302('0x45')]({'where':{'id':_0x1dbe2f[_0x4302('0x43')]['id']}})[_0x4302('0x24')](handleEntityNotFound(_0x359f87,null))[_0x4302('0x24')](removeEntity(_0x359f87,null))[_0x4302('0x42')](handleError(_0x359f87,null));};exports[_0x4302('0x47')]=function(_0x59845a,_0x994c1f){return db['ChatQueueReport'][_0x4302('0x47')]()[_0x4302('0x24')](respondWithResult(_0x994c1f,null))['catch'](handleError(_0x994c1f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0b85c85..793f0d2 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x14df1a,_0x5b627d){var _0x5a7379=function(_0x30ba7b){while(--_0x30ba7b){_0x14df1a['push'](_0x14df1a['shift']());}};_0x5a7379(++_0x5b627d);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x28b463,_0x19caf5){var _0x273400=function(_0x35d0b6){while(--_0x35d0b6){_0x28b463['push'](_0x28b463['shift']());}};_0x273400(++_0x19caf5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8edb67d..d89d46b 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 _0x017c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x150d8a,_0x3123cc){var _0xf67128=function(_0x242fb9){while(--_0x242fb9){_0x150d8a['push'](_0x150d8a['shift']());}};_0xf67128(++_0x3123cc);}(_0x017c,0xb6));var _0xc017=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x017c[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0xc017('0x0'));var util=require(_0xc017('0x1'));var moment=require(_0xc017('0x2'));var BPromise=require(_0xc017('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc017('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc017('0x5'));var logger=require(_0xc017('0x6'))(_0xc017('0x7'));var config=require(_0xc017('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc017('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17930e,_0x205f9f,_0x57d0d9){return new BPromise(function(_0x141177,_0x71792){return client[_0xc017('0xa')](_0x17930e,_0x57d0d9)[_0xc017('0xb')](function(_0x2feedf){logger['info'](_0xc017('0xc'),_0x205f9f,'request\x20sent');logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x205f9f,_0xc017('0xd'),JSON[_0xc017('0xe')](_0x2feedf));if(_0x2feedf[_0xc017('0xf')]){if(_0x2feedf[_0xc017('0xf')][_0xc017('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x205f9f,_0x2feedf[_0xc017('0xf')][_0xc017('0x11')]);return _0x71792(_0x2feedf[_0xc017('0xf')][_0xc017('0x11')]);}logger['error'](_0xc017('0xc'),_0x205f9f,_0x2feedf[_0xc017('0xf')][_0xc017('0x11')]);return _0x141177(_0x2feedf['error']['message']);}else{logger[_0xc017('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x205f9f,_0xc017('0xd'));_0x141177(_0x2feedf[_0xc017('0x13')][_0xc017('0x11')]);}})[_0xc017('0x14')](function(_0x1e10c3){logger[_0xc017('0xf')](_0xc017('0xc'),_0x205f9f,_0x1e10c3);_0x71792(_0x1e10c3);});});}exports[_0xc017('0x15')]=function(_0x48bf8e){var _0x2febe1=this;return new Promise(function(_0x1c622a,_0x4943d5){return db[_0xc017('0x16')][_0xc017('0x17')](_0x48bf8e[_0xc017('0x18')],{'raw':_0x48bf8e[_0xc017('0x19')]?_0x48bf8e['options']['raw']===undefined?!![]:![]:!![]})[_0xc017('0xb')](function(_0xfdc7d3){logger[_0xc017('0x12')](_0xc017('0x15'),_0x48bf8e);logger[_0xc017('0x1a')](_0xc017('0x15'),_0x48bf8e,JSON['stringify'](_0xfdc7d3));_0x1c622a(_0xfdc7d3);})['catch'](function(_0x3dbe06){logger[_0xc017('0xf')](_0xc017('0x15'),_0x3dbe06[_0xc017('0x11')],_0x48bf8e);_0x4943d5(_0x2febe1[_0xc017('0xf')](0x1f4,_0x3dbe06['message']));});});};exports[_0xc017('0x1b')]=function(_0xf6c2cd){var _0x2df6ea=this;return new Promise(function(_0x1aae47,_0xd8d956){return db[_0xc017('0x16')]['update'](_0xf6c2cd[_0xc017('0x18')],{'raw':_0xf6c2cd[_0xc017('0x19')]?_0xf6c2cd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6c2cd[_0xc017('0x19')]?_0xf6c2cd['options'][_0xc017('0x1c')]||null:null,'attributes':_0xf6c2cd[_0xc017('0x19')]?_0xf6c2cd[_0xc017('0x19')][_0xc017('0x1d')]||null:null,'limit':_0xf6c2cd[_0xc017('0x19')]?_0xf6c2cd['options'][_0xc017('0x1e')]||null:null})[_0xc017('0xb')](function(_0x5e164e){logger[_0xc017('0x12')](_0xc017('0x1b'),_0xf6c2cd);logger[_0xc017('0x1a')](_0xc017('0x1b'),_0xf6c2cd,JSON['stringify'](_0x5e164e));_0x1aae47(_0x5e164e);})[_0xc017('0x14')](function(_0x342f28){logger['error'](_0xc017('0x1b'),_0x342f28[_0xc017('0x11')],_0xf6c2cd);_0xd8d956(_0x2df6ea['error'](0x1f4,_0x342f28[_0xc017('0x11')]));});});}; \ No newline at end of file +var _0xc13c=['rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','create','body','options','raw','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xc13c,0x155));var _0xcc13=function(_0x762f3,_0x51e97a){_0x762f3=_0x762f3-0x0;var _0x9dbf10=_0xc13c[_0x762f3];return _0x9dbf10;};'use strict';var _=require(_0xcc13('0x0'));var util=require(_0xcc13('0x1'));var moment=require(_0xcc13('0x2'));var BPromise=require(_0xcc13('0x3'));var rs=require(_0xcc13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc13('0x6'))(_0xcc13('0x7'));var config=require(_0xcc13('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fd488,_0x31e64d,_0x1adeb7){return new BPromise(function(_0x33c1fa,_0x235120){return client[_0xcc13('0xa')](_0x4fd488,_0x1adeb7)[_0xcc13('0xb')](function(_0x3499b0){logger[_0xcc13('0xc')](_0xcc13('0xd'),_0x31e64d,_0xcc13('0xe'));logger[_0xcc13('0xf')](_0xcc13('0x10'),_0x31e64d,'request\x20sent',JSON[_0xcc13('0x11')](_0x3499b0));if(_0x3499b0[_0xcc13('0x12')]){if(_0x3499b0[_0xcc13('0x12')]['code']===0x1f4){logger[_0xcc13('0x12')](_0xcc13('0xd'),_0x31e64d,_0x3499b0['error'][_0xcc13('0x13')]);return _0x235120(_0x3499b0[_0xcc13('0x12')]['message']);}logger['error'](_0xcc13('0xd'),_0x31e64d,_0x3499b0[_0xcc13('0x12')][_0xcc13('0x13')]);return _0x33c1fa(_0x3499b0['error'][_0xcc13('0x13')]);}else{logger[_0xcc13('0xc')](_0xcc13('0xd'),_0x31e64d,_0xcc13('0xe'));_0x33c1fa(_0x3499b0['result'][_0xcc13('0x13')]);}})[_0xcc13('0x14')](function(_0x4f8844){logger['error'](_0xcc13('0xd'),_0x31e64d,_0x4f8844);_0x235120(_0x4f8844);});});}exports[_0xcc13('0x15')]=function(_0x4681cd){var _0x4f502f=this;return new Promise(function(_0x2cfa38,_0x2c8811){return db['ChatQueueReport'][_0xcc13('0x16')](_0x4681cd[_0xcc13('0x17')],{'raw':_0x4681cd[_0xcc13('0x18')]?_0x4681cd[_0xcc13('0x18')][_0xcc13('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1fea91){logger[_0xcc13('0xc')]('CreateChatQueueReport',_0x4681cd);logger[_0xcc13('0xf')](_0xcc13('0x15'),_0x4681cd,JSON['stringify'](_0x1fea91));_0x2cfa38(_0x1fea91);})[_0xcc13('0x14')](function(_0x73a3b5){logger[_0xcc13('0x12')](_0xcc13('0x15'),_0x73a3b5[_0xcc13('0x13')],_0x4681cd);_0x2c8811(_0x4f502f[_0xcc13('0x12')](0x1f4,_0x73a3b5[_0xcc13('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x5eeb7f){var _0x363c3b=this;return new Promise(function(_0x2e0bec,_0xb88ec7){return db['ChatQueueReport']['update'](_0x5eeb7f['body'],{'raw':_0x5eeb7f[_0xcc13('0x18')]?_0x5eeb7f[_0xcc13('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eeb7f['options']?_0x5eeb7f[_0xcc13('0x18')][_0xcc13('0x1a')]||null:null,'attributes':_0x5eeb7f['options']?_0x5eeb7f[_0xcc13('0x18')]['attributes']||null:null,'limit':_0x5eeb7f[_0xcc13('0x18')]?_0x5eeb7f['options'][_0xcc13('0x1b')]||null:null})[_0xcc13('0xb')](function(_0x525b32){logger[_0xcc13('0xc')](_0xcc13('0x1c'),_0x5eeb7f);logger['debug']('UpdateChatQueueReport',_0x5eeb7f,JSON[_0xcc13('0x11')](_0x525b32));_0x2e0bec(_0x525b32);})[_0xcc13('0x14')](function(_0x14553f){logger[_0xcc13('0x12')]('UpdateChatQueueReport',_0x14553f['message'],_0x5eeb7f);_0xb88ec7(_0x363c3b[_0xcc13('0x12')](0x1f4,_0x14553f[_0xcc13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2b047f9..f2eb737 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 _0x710a=['describe','/:id','post','create','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x1a37b2,_0x584b3b){var _0x130c75=function(_0x268407){while(--_0x268407){_0x1a37b2['push'](_0x1a37b2['shift']());}};_0x130c75(++_0x584b3b);}(_0x710a,0xb1));var _0xa710=function(_0x20eb36,_0x41efeb){_0x20eb36=_0x20eb36-0x0;var _0x6abe87=_0x710a[_0x20eb36];return _0x6abe87;};'use strict';var multer=require(_0xa710('0x0'));var util=require(_0xa710('0x1'));var path=require('path');var timeout=require(_0xa710('0x2'));var express=require(_0xa710('0x3'));var router=express[_0xa710('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa710('0x5'));var interaction=require(_0xa710('0x6'));var config=require(_0xa710('0x7'));var controller=require(_0xa710('0x8'));router['get']('/',auth[_0xa710('0x9')](),controller[_0xa710('0xa')]);router[_0xa710('0xb')](_0xa710('0xc'),auth['isAuthenticated'](),controller[_0xa710('0xd')]);router[_0xa710('0xb')](_0xa710('0xe'),auth[_0xa710('0x9')](),controller['show']);router[_0xa710('0xf')]('/',auth['isAuthenticated'](),controller[_0xa710('0x10')]);router['put'](_0xa710('0xe'),auth[_0xa710('0x9')](),controller[_0xa710('0x11')]);router['delete'](_0xa710('0xe'),auth[_0xa710('0x9')](),controller[_0xa710('0x12')]);module['exports']=router; \ No newline at end of file +var _0x65f5=['destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete'];(function(_0xf15be4,_0x2c2591){var _0x2b6849=function(_0x544282){while(--_0x544282){_0xf15be4['push'](_0xf15be4['shift']());}};_0x2b6849(++_0x2c2591);}(_0x65f5,0x191));var _0x565f=function(_0x2cbede,_0x501eef){_0x2cbede=_0x2cbede-0x0;var _0x33eaa0=_0x65f5[_0x2cbede];return _0x33eaa0;};'use strict';var multer=require(_0x565f('0x0'));var util=require(_0x565f('0x1'));var path=require(_0x565f('0x2'));var timeout=require('connect-timeout');var express=require(_0x565f('0x3'));var router=express[_0x565f('0x4')]();var fs_extra=require(_0x565f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x565f('0x6'));var controller=require(_0x565f('0x7'));router[_0x565f('0x8')]('/',auth[_0x565f('0x9')](),controller[_0x565f('0xa')]);router[_0x565f('0x8')](_0x565f('0xb'),auth[_0x565f('0x9')](),controller[_0x565f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x565f('0xd')]);router[_0x565f('0xe')]('/',auth[_0x565f('0x9')](),controller[_0x565f('0xf')]);router[_0x565f('0x10')](_0x565f('0x11'),auth[_0x565f('0x9')](),controller['update']);router[_0x565f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x565f('0x13')]);module[_0x565f('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b70dac7..28906f2 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x41c1ae,_0x2f1102){var _0x11e6c9=function(_0x556e04){while(--_0x556e04){_0x41c1ae['push'](_0x41c1ae['shift']());}};_0x11e6c9(++_0x2f1102);}(_0xaa88,0x137));var _0x8aa8=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xaa88[_0x5216e0];return _0x5b3f40;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xabdc08,_0xe68f5e){var _0x3b4796=function(_0x443ac1){while(--_0x443ac1){_0xabdc08['push'](_0xabdc08['shift']());}};_0x3b4796(++_0xe68f5e);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xedd9[_0x2f5a22];return _0x326b70;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 00270c0..40ba811 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 _0x085c=['where','filters','pick','filter','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort'];(function(_0x8dc01d,_0x4e8f22){var _0x3ab917=function(_0x17d5ce){while(--_0x17d5ce){_0x8dc01d['push'](_0x8dc01d['shift']());}};_0x3ab917(++_0x4e8f22);}(_0x085c,0xf4));var _0xc085=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x085c[_0x57fa33];return _0x12e724;};'use strict';var emlformat=require(_0xc085('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc085('0x1'));var rp=require(_0xc085('0x2'));var moment=require(_0xc085('0x3'));var BPromise=require(_0xc085('0x4'));var Mustache=require('mustache');var util=require(_0xc085('0x5'));var path=require(_0xc085('0x6'));var sox=require('sox');var csv=require(_0xc085('0x7'));var ejs=require(_0xc085('0x8'));var fs=require('fs');var fs_extra=require(_0xc085('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc085('0xa'));var jsforce=require(_0xc085('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc085('0x7'));var querystring=require(_0xc085('0xc'));var Papa=require(_0xc085('0xd'));var Redis=require('ioredis');var authService=require(_0xc085('0xe'));var qs=require(_0xc085('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc085('0x10'));var logger=require(_0xc085('0x11'))('api');var utils=require(_0xc085('0x12'));var config=require(_0xc085('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc085('0x14'))['db'];function respondWithStatusCode(_0x58c8fd,_0x2b90b6){_0x2b90b6=_0x2b90b6||0xcc;return function(_0x4af916){if(_0x4af916){return _0x58c8fd[_0xc085('0x15')](_0x2b90b6);}return _0x58c8fd['status'](_0x2b90b6)[_0xc085('0x16')]();};}function respondWithResult(_0x11f8fb,_0x2bab59){_0x2bab59=_0x2bab59||0xc8;return function(_0xf8ebf5){if(_0xf8ebf5){return _0x11f8fb['status'](_0x2bab59)[_0xc085('0x17')](_0xf8ebf5);}};}function respondWithFilteredResult(_0x1992da,_0x1278e7){return function(_0x2aeabf){if(_0x2aeabf){var _0x3d807f=typeof _0x1278e7[_0xc085('0x18')]==='undefined'&&typeof _0x1278e7[_0xc085('0x19')]===_0xc085('0x1a');var _0x473e2a=_0x2aeabf[_0xc085('0x1b')];var _0x848a72=_0x3d807f?0x0:_0x1278e7[_0xc085('0x18')];var _0x228c66=_0x3d807f?_0x2aeabf['count']:_0x1278e7['offset']+_0x1278e7[_0xc085('0x19')];var _0x1939ce;if(_0x228c66>=_0x473e2a){_0x228c66=_0x473e2a;_0x1939ce=0xc8;}else{_0x1939ce=0xce;}_0x1992da[_0xc085('0x1c')](_0x1939ce);return _0x1992da[_0xc085('0x1d')](_0xc085('0x1e'),_0x848a72+'-'+_0x228c66+'/'+_0x473e2a)['json'](_0x2aeabf);}return null;};}function patchUpdates(_0x575ab0){return function(_0x3f03e8){try{jsonpatch[_0xc085('0x1f')](_0x3f03e8,_0x575ab0,!![]);}catch(_0x429fc8){return BPromise[_0xc085('0x20')](_0x429fc8);}return _0x3f03e8['save']();};}function saveUpdates(_0x262e38,_0x414a2a){return function(_0x424009){if(_0x424009){return _0x424009[_0xc085('0x21')](_0x262e38)['then'](function(_0x5c9f54){return _0x5c9f54;});}return null;};}function removeEntity(_0x225d21,_0x373c6f){return function(_0x2b0107){if(_0x2b0107){return _0x2b0107[_0xc085('0x22')]()['then'](function(){_0x225d21[_0xc085('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d02f,_0x2ea9a3){return function(_0x12fa5e){if(!_0x12fa5e){_0x23d02f[_0xc085('0x15')](0x194);}return _0x12fa5e;};}function handleError(_0x23072f,_0x195348){_0x195348=_0x195348||0x1f4;return function(_0x21bd13){logger[_0xc085('0x23')](_0x21bd13[_0xc085('0x24')]);if(_0x21bd13['name']){delete _0x21bd13[_0xc085('0x25')];}_0x23072f[_0xc085('0x1c')](_0x195348)[_0xc085('0x26')](_0x21bd13);};}exports[_0xc085('0x27')]=function(_0x16a555,_0x5af81c){var _0x439213={},_0x5109ce={},_0x4936cf={'count':0x0,'rows':[]};var _0x29fbf7=_[_0xc085('0x28')](db[_0xc085('0x29')][_0xc085('0x2a')],function(_0x1b19f2){return{'name':_0x1b19f2[_0xc085('0x2b')],'type':_0x1b19f2[_0xc085('0x2c')][_0xc085('0x2d')]};});_0x5109ce[_0xc085('0x2e')]=_[_0xc085('0x28')](_0x29fbf7,_0xc085('0x25'));_0x5109ce[_0xc085('0x2f')]=_[_0xc085('0x30')](_0x16a555[_0xc085('0x2f')]);_0x5109ce['filters']=_['intersection'](_0x5109ce[_0xc085('0x2e')],_0x5109ce[_0xc085('0x2f')]);_0x439213[_0xc085('0x31')]=_[_0xc085('0x32')](_0x5109ce['model'],qs[_0xc085('0x33')](_0x16a555[_0xc085('0x2f')][_0xc085('0x33')]));_0x439213['attributes']=_0x439213[_0xc085('0x31')][_0xc085('0x34')]?_0x439213[_0xc085('0x31')]:_0x5109ce['model'];if(!_0x16a555[_0xc085('0x2f')][_0xc085('0x35')]('nolimit')){_0x439213['limit']=qs[_0xc085('0x19')](_0x16a555[_0xc085('0x2f')][_0xc085('0x19')]);_0x439213[_0xc085('0x18')]=qs['offset'](_0x16a555['query'][_0xc085('0x18')]);}_0x439213[_0xc085('0x36')]=qs['sort'](_0x16a555[_0xc085('0x2f')][_0xc085('0x37')]);_0x439213[_0xc085('0x38')]=qs[_0xc085('0x39')](_[_0xc085('0x3a')](_0x16a555['query'],_0x5109ce[_0xc085('0x39')]),_0x29fbf7);if(_0x16a555[_0xc085('0x2f')][_0xc085('0x3b')]){_0x439213[_0xc085('0x38')]=_['merge'](_0x439213[_0xc085('0x38')],{'$or':_[_0xc085('0x28')](_0x29fbf7,function(_0x394b5f){if(_0x394b5f[_0xc085('0x2c')]!==_0xc085('0x3c')){var _0x53b4ac={};_0x53b4ac[_0x394b5f[_0xc085('0x25')]]={'$like':'%'+_0x16a555[_0xc085('0x2f')][_0xc085('0x3b')]+'%'};return _0x53b4ac;}})});}_0x439213=_[_0xc085('0x3d')]({},_0x439213,_0x16a555['options']);var _0x394e61={'where':_0x439213['where']};return db['ChatTransferReport']['count'](_0x394e61)[_0xc085('0x3e')](function(_0x10e5e6){_0x4936cf[_0xc085('0x1b')]=_0x10e5e6;if(_0x16a555[_0xc085('0x2f')][_0xc085('0x3f')]){_0x439213[_0xc085('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xc085('0x41')](_0x439213);})[_0xc085('0x3e')](function(_0x5efeaf){_0x4936cf[_0xc085('0x42')]=_0x5efeaf;return _0x4936cf;})[_0xc085('0x3e')](respondWithFilteredResult(_0x5af81c,_0x439213))[_0xc085('0x43')](handleError(_0x5af81c,null));};exports[_0xc085('0x44')]=function(_0x5a1b76,_0x1de039){var _0x35b4f1={'raw':!![],'where':{'id':_0x5a1b76[_0xc085('0x45')]['id']}},_0x2d2371={};_0x2d2371[_0xc085('0x2e')]=_['keys'](db[_0xc085('0x29')]['rawAttributes']);_0x2d2371[_0xc085('0x2f')]=_[_0xc085('0x30')](_0x5a1b76[_0xc085('0x2f')]);_0x2d2371['filters']=_[_0xc085('0x32')](_0x2d2371['model'],_0x2d2371[_0xc085('0x2f')]);_0x35b4f1['attributes']=_[_0xc085('0x32')](_0x2d2371['model'],qs['fields'](_0x5a1b76[_0xc085('0x2f')][_0xc085('0x33')]));_0x35b4f1[_0xc085('0x31')]=_0x35b4f1['attributes'][_0xc085('0x34')]?_0x35b4f1[_0xc085('0x31')]:_0x2d2371[_0xc085('0x2e')];if(_0x5a1b76[_0xc085('0x2f')][_0xc085('0x3f')]){_0x35b4f1[_0xc085('0x40')]=[{'all':!![]}];}_0x35b4f1=_[_0xc085('0x3d')]({},_0x35b4f1,_0x5a1b76[_0xc085('0x46')]);return db['ChatTransferReport']['find'](_0x35b4f1)[_0xc085('0x3e')](handleEntityNotFound(_0x1de039,null))[_0xc085('0x3e')](respondWithResult(_0x1de039,null))[_0xc085('0x43')](handleError(_0x1de039,null));};exports['create']=function(_0x3a93bf,_0x1b08db){return db['ChatTransferReport'][_0xc085('0x47')](_0x3a93bf['body'],{})[_0xc085('0x3e')](respondWithResult(_0x1b08db,0xc9))[_0xc085('0x43')](handleError(_0x1b08db,null));};exports[_0xc085('0x21')]=function(_0x5e58df,_0x3db3ae){if(_0x5e58df['body']['id']){delete _0x5e58df[_0xc085('0x48')]['id'];}return db[_0xc085('0x29')]['find']({'where':{'id':_0x5e58df['params']['id']}})[_0xc085('0x3e')](handleEntityNotFound(_0x3db3ae,null))[_0xc085('0x3e')](saveUpdates(_0x5e58df['body'],null))['then'](respondWithResult(_0x3db3ae,null))[_0xc085('0x43')](handleError(_0x3db3ae,null));};exports[_0xc085('0x22')]=function(_0x4735d4,_0x59b1a0){return db[_0xc085('0x29')][_0xc085('0x49')]({'where':{'id':_0x4735d4[_0xc085('0x45')]['id']}})[_0xc085('0x3e')](handleEntityNotFound(_0x59b1a0,null))[_0xc085('0x3e')](removeEntity(_0x59b1a0,null))[_0xc085('0x43')](handleError(_0x59b1a0,null));};exports['describe']=function(_0x2342e5,_0x5c1803){return db[_0xc085('0x29')][_0xc085('0x4a')]()[_0xc085('0x3e')](respondWithResult(_0x5c1803,null))[_0xc085('0x43')](handleError(_0x5c1803,null));}; \ No newline at end of file +var _0xd5a7=['fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatTransferReport','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','catch','create','body','describe','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xd5a7,0x67));var _0x7d5a=function(_0x442f2a,_0x3e6ef2){_0x442f2a=_0x442f2a-0x0;var _0x490f46=_0xd5a7[_0x442f2a];return _0x490f46;};'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(_0x7d5a('0x0'));var moment=require('moment');var BPromise=require(_0x7d5a('0x1'));var Mustache=require(_0x7d5a('0x2'));var util=require(_0x7d5a('0x3'));var path=require(_0x7d5a('0x4'));var sox=require(_0x7d5a('0x5'));var csv=require(_0x7d5a('0x6'));var ejs=require(_0x7d5a('0x7'));var fs=require('fs');var fs_extra=require(_0x7d5a('0x8'));var _=require(_0x7d5a('0x9'));var squel=require(_0x7d5a('0xa'));var crypto=require(_0x7d5a('0xb'));var jsforce=require(_0x7d5a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7d5a('0x6'));var querystring=require(_0x7d5a('0xd'));var Papa=require(_0x7d5a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7d5a('0xf'));var as=require(_0x7d5a('0x10'));var hardwareService=require(_0x7d5a('0x11'));var logger=require(_0x7d5a('0x12'))('api');var utils=require(_0x7d5a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d5a('0x14'))['db'];function respondWithStatusCode(_0x11893a,_0x54fa0d){_0x54fa0d=_0x54fa0d||0xcc;return function(_0x310973){if(_0x310973){return _0x11893a[_0x7d5a('0x15')](_0x54fa0d);}return _0x11893a[_0x7d5a('0x16')](_0x54fa0d)['end']();};}function respondWithResult(_0x259cf1,_0x500f85){_0x500f85=_0x500f85||0xc8;return function(_0x21088b){if(_0x21088b){return _0x259cf1[_0x7d5a('0x16')](_0x500f85)['json'](_0x21088b);}};}function respondWithFilteredResult(_0x253fed,_0x36e685){return function(_0x1ea66e){if(_0x1ea66e){var _0x106c94=typeof _0x36e685[_0x7d5a('0x17')]===_0x7d5a('0x18')&&typeof _0x36e685[_0x7d5a('0x19')]===_0x7d5a('0x18');var _0x36bc11=_0x1ea66e[_0x7d5a('0x1a')];var _0x310c52=_0x106c94?0x0:_0x36e685[_0x7d5a('0x17')];var _0x47edba=_0x106c94?_0x1ea66e[_0x7d5a('0x1a')]:_0x36e685[_0x7d5a('0x17')]+_0x36e685[_0x7d5a('0x19')];var _0x2d6f31;if(_0x47edba>=_0x36bc11){_0x47edba=_0x36bc11;_0x2d6f31=0xc8;}else{_0x2d6f31=0xce;}_0x253fed['status'](_0x2d6f31);return _0x253fed[_0x7d5a('0x1b')](_0x7d5a('0x1c'),_0x310c52+'-'+_0x47edba+'/'+_0x36bc11)[_0x7d5a('0x1d')](_0x1ea66e);}return null;};}function patchUpdates(_0x4c3c48){return function(_0x691fc4){try{jsonpatch[_0x7d5a('0x1e')](_0x691fc4,_0x4c3c48,!![]);}catch(_0x2d709b){return BPromise['reject'](_0x2d709b);}return _0x691fc4['save']();};}function saveUpdates(_0x56c2c2,_0x276dec){return function(_0x261259){if(_0x261259){return _0x261259[_0x7d5a('0x1f')](_0x56c2c2)[_0x7d5a('0x20')](function(_0x59f785){return _0x59f785;});}return null;};}function removeEntity(_0x52c417,_0x444aec){return function(_0x45c61f){if(_0x45c61f){return _0x45c61f[_0x7d5a('0x21')]()['then'](function(){_0x52c417[_0x7d5a('0x16')](0xcc)[_0x7d5a('0x22')]();});}};}function handleEntityNotFound(_0x53f8ac,_0x4fadfb){return function(_0x51ddd4){if(!_0x51ddd4){_0x53f8ac[_0x7d5a('0x15')](0x194);}return _0x51ddd4;};}function handleError(_0x216d8d,_0x35e827){_0x35e827=_0x35e827||0x1f4;return function(_0x161c20){logger[_0x7d5a('0x23')](_0x161c20[_0x7d5a('0x24')]);if(_0x161c20[_0x7d5a('0x25')]){delete _0x161c20[_0x7d5a('0x25')];}_0x216d8d['status'](_0x35e827)[_0x7d5a('0x26')](_0x161c20);};}exports[_0x7d5a('0x27')]=function(_0x19092e,_0x1455cd){var _0x3d0f99={},_0x4e3f7a={},_0x386b50={'count':0x0,'rows':[]};var _0x362970=_[_0x7d5a('0x28')](db['ChatTransferReport']['rawAttributes'],function(_0x675f61){return{'name':_0x675f61[_0x7d5a('0x29')],'type':_0x675f61[_0x7d5a('0x2a')]['key']};});_0x4e3f7a[_0x7d5a('0x2b')]=_[_0x7d5a('0x28')](_0x362970,_0x7d5a('0x25'));_0x4e3f7a[_0x7d5a('0x2c')]=_['keys'](_0x19092e[_0x7d5a('0x2c')]);_0x4e3f7a[_0x7d5a('0x2d')]=_[_0x7d5a('0x2e')](_0x4e3f7a[_0x7d5a('0x2b')],_0x4e3f7a['query']);_0x3d0f99[_0x7d5a('0x2f')]=_['intersection'](_0x4e3f7a[_0x7d5a('0x2b')],qs[_0x7d5a('0x30')](_0x19092e['query'][_0x7d5a('0x30')]));_0x3d0f99[_0x7d5a('0x2f')]=_0x3d0f99['attributes']['length']?_0x3d0f99[_0x7d5a('0x2f')]:_0x4e3f7a[_0x7d5a('0x2b')];if(!_0x19092e[_0x7d5a('0x2c')][_0x7d5a('0x31')](_0x7d5a('0x32'))){_0x3d0f99[_0x7d5a('0x19')]=qs['limit'](_0x19092e[_0x7d5a('0x2c')][_0x7d5a('0x19')]);_0x3d0f99[_0x7d5a('0x17')]=qs[_0x7d5a('0x17')](_0x19092e[_0x7d5a('0x2c')]['offset']);}_0x3d0f99[_0x7d5a('0x33')]=qs[_0x7d5a('0x34')](_0x19092e['query'][_0x7d5a('0x34')]);_0x3d0f99['where']=qs['filters'](_[_0x7d5a('0x35')](_0x19092e[_0x7d5a('0x2c')],_0x4e3f7a[_0x7d5a('0x2d')]),_0x362970);if(_0x19092e[_0x7d5a('0x2c')][_0x7d5a('0x36')]){_0x3d0f99[_0x7d5a('0x37')]=_[_0x7d5a('0x38')](_0x3d0f99[_0x7d5a('0x37')],{'$or':_[_0x7d5a('0x28')](_0x362970,function(_0x42ea9e){if(_0x42ea9e[_0x7d5a('0x2a')]!=='VIRTUAL'){var _0x1fc23c={};_0x1fc23c[_0x42ea9e[_0x7d5a('0x25')]]={'$like':'%'+_0x19092e[_0x7d5a('0x2c')][_0x7d5a('0x36')]+'%'};return _0x1fc23c;}})});}_0x3d0f99=_[_0x7d5a('0x38')]({},_0x3d0f99,_0x19092e[_0x7d5a('0x39')]);var _0x57401d={'where':_0x3d0f99['where']};return db[_0x7d5a('0x3a')][_0x7d5a('0x1a')](_0x57401d)[_0x7d5a('0x20')](function(_0x51a7ca){_0x386b50[_0x7d5a('0x1a')]=_0x51a7ca;if(_0x19092e['query'][_0x7d5a('0x3b')]){_0x3d0f99[_0x7d5a('0x3c')]=[{'all':!![]}];}return db[_0x7d5a('0x3a')][_0x7d5a('0x3d')](_0x3d0f99);})['then'](function(_0xbe93af){_0x386b50['rows']=_0xbe93af;return _0x386b50;})['then'](respondWithFilteredResult(_0x1455cd,_0x3d0f99))['catch'](handleError(_0x1455cd,null));};exports[_0x7d5a('0x3e')]=function(_0x59cf2e,_0x5c19de){var _0x3f757c={'raw':!![],'where':{'id':_0x59cf2e[_0x7d5a('0x3f')]['id']}},_0x570aea={};_0x570aea['model']=_[_0x7d5a('0x40')](db[_0x7d5a('0x3a')][_0x7d5a('0x41')]);_0x570aea[_0x7d5a('0x2c')]=_[_0x7d5a('0x40')](_0x59cf2e[_0x7d5a('0x2c')]);_0x570aea[_0x7d5a('0x2d')]=_['intersection'](_0x570aea[_0x7d5a('0x2b')],_0x570aea['query']);_0x3f757c['attributes']=_['intersection'](_0x570aea[_0x7d5a('0x2b')],qs['fields'](_0x59cf2e[_0x7d5a('0x2c')][_0x7d5a('0x30')]));_0x3f757c[_0x7d5a('0x2f')]=_0x3f757c[_0x7d5a('0x2f')][_0x7d5a('0x42')]?_0x3f757c[_0x7d5a('0x2f')]:_0x570aea[_0x7d5a('0x2b')];if(_0x59cf2e[_0x7d5a('0x2c')][_0x7d5a('0x3b')]){_0x3f757c[_0x7d5a('0x3c')]=[{'all':!![]}];}_0x3f757c=_[_0x7d5a('0x38')]({},_0x3f757c,_0x59cf2e[_0x7d5a('0x39')]);return db[_0x7d5a('0x3a')][_0x7d5a('0x43')](_0x3f757c)[_0x7d5a('0x20')](handleEntityNotFound(_0x5c19de,null))[_0x7d5a('0x20')](respondWithResult(_0x5c19de,null))[_0x7d5a('0x44')](handleError(_0x5c19de,null));};exports[_0x7d5a('0x45')]=function(_0x2f3b0f,_0x1ffa8c){return db[_0x7d5a('0x3a')][_0x7d5a('0x45')](_0x2f3b0f[_0x7d5a('0x46')],{})[_0x7d5a('0x20')](respondWithResult(_0x1ffa8c,0xc9))[_0x7d5a('0x44')](handleError(_0x1ffa8c,null));};exports[_0x7d5a('0x1f')]=function(_0x5a6b34,_0x25f5f9){if(_0x5a6b34[_0x7d5a('0x46')]['id']){delete _0x5a6b34[_0x7d5a('0x46')]['id'];}return db[_0x7d5a('0x3a')][_0x7d5a('0x43')]({'where':{'id':_0x5a6b34['params']['id']}})['then'](handleEntityNotFound(_0x25f5f9,null))[_0x7d5a('0x20')](saveUpdates(_0x5a6b34[_0x7d5a('0x46')],null))[_0x7d5a('0x20')](respondWithResult(_0x25f5f9,null))[_0x7d5a('0x44')](handleError(_0x25f5f9,null));};exports[_0x7d5a('0x21')]=function(_0x4c5dd7,_0x14df4d){return db[_0x7d5a('0x3a')][_0x7d5a('0x43')]({'where':{'id':_0x4c5dd7['params']['id']}})[_0x7d5a('0x20')](handleEntityNotFound(_0x14df4d,null))[_0x7d5a('0x20')](removeEntity(_0x14df4d,null))['catch'](handleError(_0x14df4d,null));};exports[_0x7d5a('0x47')]=function(_0xe98852,_0x4a5bd9){return db[_0x7d5a('0x3a')]['describe']()[_0x7d5a('0x20')](respondWithResult(_0x4a5bd9,null))[_0x7d5a('0x44')](handleError(_0x4a5bd9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0c1fd11..d200cc5 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 _0xc1c1=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c1,0x154));var _0x1c1c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc1c1[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1c1c('0x0'));var util=require(_0x1c1c('0x1'));var logger=require(_0x1c1c('0x2'))(_0x1c1c('0x3'));var moment=require('moment');var BPromise=require(_0x1c1c('0x4'));var rp=require(_0x1c1c('0x5'));var fs=require('fs');var path=require(_0x1c1c('0x6'));var rimraf=require(_0x1c1c('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x502599,_0x1886f0){return _0x502599['define'](_0x1c1c('0x8'),attributes,{'tableName':_0x1c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x1c1c('0xa'),'fields':[_0x1c1c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x858e=['../../config/environment','./chatTransferReport.attributes','ChatTransferReport','uniqueid','../../config/logger','request-promise','rimraf'];(function(_0x5c2034,_0x16cb32){var _0x1222d6=function(_0x3e8213){while(--_0x3e8213){_0x5c2034['push'](_0x5c2034['shift']());}};_0x1222d6(++_0x16cb32);}(_0x858e,0x6d));var _0xe858=function(_0x51bdd4,_0x29b4be){_0x51bdd4=_0x51bdd4-0x0;var _0x1d3a75=_0x858e[_0x51bdd4];return _0x1d3a75;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe858('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe858('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe858('0x2'));var config=require(_0xe858('0x3'));var attributes=require(_0xe858('0x4'));module['exports']=function(_0x8b9d87,_0x355f5b){return _0x8b9d87['define'](_0xe858('0x5'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe858('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6a66305..f8d57a0 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 _0x5fe2=['../../config/logger','rpc','../../config/environment','client','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5fe2,0x8e));var _0x25fe=function(_0x1d8990,_0x4382b5){_0x1d8990=_0x1d8990-0x0;var _0x5ce380=_0x5fe2[_0x1d8990];return _0x5ce380;};'use strict';var _=require(_0x25fe('0x0'));var util=require(_0x25fe('0x1'));var moment=require(_0x25fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25fe('0x3'))['db'];var utils=require(_0x25fe('0x4'));var logger=require(_0x25fe('0x5'))(_0x25fe('0x6'));var config=require(_0x25fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x25fe('0x8')][_0x25fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b35b7,_0x1c0002,_0x268980){return new BPromise(function(_0x32bb63,_0x454e78){return client[_0x25fe('0xa')](_0x1b35b7,_0x268980)['then'](function(_0x2e850e){logger['info'](_0x25fe('0xb'),_0x1c0002,_0x25fe('0xc'));logger['debug'](_0x25fe('0xd'),_0x1c0002,_0x25fe('0xc'),JSON[_0x25fe('0xe')](_0x2e850e));if(_0x2e850e[_0x25fe('0xf')]){if(_0x2e850e[_0x25fe('0xf')][_0x25fe('0x10')]===0x1f4){logger[_0x25fe('0xf')](_0x25fe('0xb'),_0x1c0002,_0x2e850e[_0x25fe('0xf')][_0x25fe('0x11')]);return _0x454e78(_0x2e850e[_0x25fe('0xf')]['message']);}logger[_0x25fe('0xf')](_0x25fe('0xb'),_0x1c0002,_0x2e850e[_0x25fe('0xf')]['message']);return _0x32bb63(_0x2e850e[_0x25fe('0xf')]['message']);}else{logger[_0x25fe('0x12')](_0x25fe('0xb'),_0x1c0002,'request\x20sent');_0x32bb63(_0x2e850e[_0x25fe('0x13')]['message']);}})[_0x25fe('0x14')](function(_0x550cf0){logger[_0x25fe('0xf')](_0x25fe('0xb'),_0x1c0002,_0x550cf0);_0x454e78(_0x550cf0);});});} \ No newline at end of file +var _0x4271=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x126dfb,_0x4e1bdd){var _0x487792=function(_0x47079d){while(--_0x47079d){_0x126dfb['push'](_0x126dfb['shift']());}};_0x487792(++_0x4e1bdd);}(_0x4271,0x87));var _0x1427=function(_0x244aa4,_0x251b1d){_0x244aa4=_0x244aa4-0x0;var _0x463d24=_0x4271[_0x244aa4];return _0x463d24;};'use strict';var _=require(_0x1427('0x0'));var util=require(_0x1427('0x1'));var moment=require(_0x1427('0x2'));var BPromise=require(_0x1427('0x3'));var rs=require(_0x1427('0x4'));var fs=require('fs');var Redis=require(_0x1427('0x5'));var db=require(_0x1427('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1427('0x7'))('rpc');var config=require(_0x1427('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1427('0x9')][_0x1427('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x214cbc,_0x508ea3,_0x22c89f){return new BPromise(function(_0x291dc2,_0x4d21de){return client[_0x1427('0xb')](_0x214cbc,_0x22c89f)[_0x1427('0xc')](function(_0x24dca1){logger[_0x1427('0xd')](_0x1427('0xe'),_0x508ea3,_0x1427('0xf'));logger[_0x1427('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x508ea3,_0x1427('0xf'),JSON[_0x1427('0x11')](_0x24dca1));if(_0x24dca1[_0x1427('0x12')]){if(_0x24dca1[_0x1427('0x12')][_0x1427('0x13')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x508ea3,_0x24dca1[_0x1427('0x12')][_0x1427('0x14')]);return _0x4d21de(_0x24dca1[_0x1427('0x12')][_0x1427('0x14')]);}logger[_0x1427('0x12')](_0x1427('0xe'),_0x508ea3,_0x24dca1[_0x1427('0x12')][_0x1427('0x14')]);return _0x291dc2(_0x24dca1['error'][_0x1427('0x14')]);}else{logger[_0x1427('0xd')](_0x1427('0xe'),_0x508ea3,_0x1427('0xf'));_0x291dc2(_0x24dca1[_0x1427('0x15')][_0x1427('0x14')]);}})[_0x1427('0x16')](function(_0x3cad64){logger[_0x1427('0x12')](_0x1427('0xe'),_0x508ea3,_0x3cad64);_0x4d21de(_0x3cad64);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b3c19e8..9154b38 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 _0x2b4d=['update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x4b43c0,_0x3a8091){var _0x574c13=function(_0x39eaf4){while(--_0x39eaf4){_0x4b43c0['push'](_0x4b43c0['shift']());}};_0x574c13(++_0x3a8091);}(_0x2b4d,0xb3));var _0xd2b4=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x2b4d[_0x5d30b4];return _0x1acfb8;};'use strict';var multer=require('multer');var util=require(_0xd2b4('0x0'));var path=require('path');var timeout=require(_0xd2b4('0x1'));var express=require(_0xd2b4('0x2'));var router=express[_0xd2b4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2b4('0x4'));var config=require(_0xd2b4('0x5'));var controller=require(_0xd2b4('0x6'));router['get']('/',auth[_0xd2b4('0x7')](),controller[_0xd2b4('0x8')]);router[_0xd2b4('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xd2b4('0xa'),auth['isAuthenticated'](),controller[_0xd2b4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd2b4('0xc')]);router['put'](_0xd2b4('0xa'),auth[_0xd2b4('0x7')](),controller[_0xd2b4('0xd')]);router[_0xd2b4('0xe')]('/:id',auth[_0xd2b4('0x7')](),controller['destroy']);module[_0xd2b4('0xf')]=router; \ No newline at end of file +var _0xc258=['isAuthenticated','index','show','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc258,0x14c));var _0x8c25=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc258[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x8c25('0x0'));var util=require(_0x8c25('0x1'));var path=require(_0x8c25('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c25('0x3'));var router=express[_0x8c25('0x4')]();var fs_extra=require(_0x8c25('0x5'));var auth=require(_0x8c25('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c25('0x7'));var controller=require(_0x8c25('0x8'));router[_0x8c25('0x9')]('/',auth[_0x8c25('0xa')](),controller[_0x8c25('0xb')]);router['get']('/describe',auth[_0x8c25('0xa')](),controller['describe']);router['get']('/:id',auth[_0x8c25('0xa')](),controller[_0x8c25('0xc')]);router['post']('/',auth[_0x8c25('0xa')](),controller['create']);router[_0x8c25('0xd')](_0x8c25('0xe'),auth['isAuthenticated'](),controller[_0x8c25('0xf')]);router[_0x8c25('0x10')](_0x8c25('0xe'),auth['isAuthenticated'](),controller[_0x8c25('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1d93f14..dc5e09e 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 _0x9f2b=['offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','#ffffff','BOOLEAN','rounded','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','thumb','text','getDataValue','parse','setDataValue','stringify','input','textarea','Comments'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x9f2b,0x168));var _0xb9f2=function(_0x138ab8,_0x539ea0){_0x138ab8=_0x138ab8-0x0;var _0x3598de=_0x9f2b[_0x138ab8];return _0x3598de;};'use strict';var Sequelize=require(_0xb9f2('0x0'));var rs=require('randomstring');module[_0xb9f2('0x1')]={'name':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'unique':_0xb9f2('0x3')},'description':{'type':Sequelize[_0xb9f2('0x2')]},'mapKey':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':_0xb9f2('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':_0xb9f2('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0xb9f2('0x7')},'header_online':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x8')},'start_chat_button':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x9')},'offline_chat_button':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0xa')},'download_transcript':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb9f2('0xb')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb9f2('0xd')]},'closingQuestion':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0xf')},'noteTitle':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x10')},'placeholderMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x11')},'closingMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x12')},'closingMessageButton':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x13')},'skipMessageButton':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x14')},'conditionAgreement':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x15')},'ratingType':{'type':Sequelize[_0xb9f2('0x16')]('star',_0xb9f2('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb9f2('0xb')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb9f2('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0xb9f2('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xb9f2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb9f2('0x19')]('onlineForm')?JSON[_0xb9f2('0x1a')](this['getDataValue']('onlineForm')):{};},'set':function(_0x3adea3){return this[_0xb9f2('0x1b')]('onlineForm',JSON[_0xb9f2('0x1c')](_0x3adea3));}},'offlineForm':{'type':Sequelize[_0xb9f2('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb9f2('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xb9f2('0x4'),'type':_0xb9f2('0x4')},'variable':null},{'type':_0xb9f2('0x1e'),'config':{'placeholder':_0xb9f2('0x1f')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb9f2('0x19')]('offlineForm')?JSON[_0xb9f2('0x1a')](this[_0xb9f2('0x19')](_0xb9f2('0x20'))):{};},'set':function(_0xb61282){return this['setDataValue']('offlineForm',JSON[_0xb9f2('0x1c')](_0xb61282));}},'token':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':function(){return rs[_0xb9f2('0x21')]();}},'autoclose':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb9f2('0x2')]},'waitingTitle':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x22')},'waitingMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x24')},'offlineMessageBody':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x26')},'skipUnmanaged':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x14')},'sendUnmanaged':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb9f2('0xd')],'defaultValue':function(){return _0xb9f2('0x27');}},'notificationSound':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xb9f2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':_0xb9f2('0x28')},'verticalAlignment':{'type':Sequelize[_0xb9f2('0xb')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xb9f2('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb9f2('0x2')]},'customerAvatar':{'type':Sequelize[_0xb9f2('0xd')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb9f2('0xb')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':_0xb9f2('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb9f2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb9f2('0x2b')},'systemAvatar':{'type':Sequelize[_0xb9f2('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb9f2('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa1b04f){if(!_0xa1b04f)this[_0xb9f2('0x1b')](_0xb9f2('0x2d'),null);this[_0xb9f2('0x1b')](_0xb9f2('0x2e'),_0xa1b04f);}},'vidaooEscalation':{'type':Sequelize[_0xb9f2('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb9f2('0x2')]},'vidaooTopic':{'type':Sequelize[_0xb9f2('0x2')],'allowNull':![],'defaultValue':_0xb9f2('0x2f')},'vidaooNote':{'type':Sequelize[_0xb9f2('0x2')],'defaultValue':function(){return _0xb9f2('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xb9f2('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb9f2('0xd')]}}; \ No newline at end of file +var _0x44ac=['STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','thumb','input','text','name','email','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','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:','Your\x20request\x20has\x20not\x20been\x20processed.','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize'];(function(_0x4d9cab,_0x488b32){var _0x4a1609=function(_0x1bde59){while(--_0x1bde59){_0x4d9cab['push'](_0x4d9cab['shift']());}};_0x4a1609(++_0x488b32);}(_0x44ac,0x148));var _0xc44a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x44ac[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xc44a('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![],'unique':_0xc44a('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc44a('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc44a('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc44a('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![],'defaultValue':_0xc44a('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc44a('0x7')](_0xc44a('0x8'),_0xc44a('0x9')),'defaultValue':_0xc44a('0x8')},'header_online':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0xa')},'start_chat_button':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0xb')},'offline_chat_button':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc44a('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc44a('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xc44a('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc44a('0x11')},'noteTitle':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x12')},'placeholderMessage':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x13')},'closingMessageButton':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x14')},'skipMessageButton':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x15')},'conditionAgreement':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xc44a('0x7')](_0xc44a('0x16'),_0xc44a('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xc44a('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc44a('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc44a('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xc44a('0x19'),'required':!![]},'props':{'title':_0xc44a('0x1a'),'helpText':''}},{'type':_0xc44a('0x18'),'props':{'title':_0xc44a('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':_0xc44a('0x1b'),'type':_0xc44a('0x1b')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc44a('0x1c')](_0xc44a('0x1d'))?JSON[_0xc44a('0x1e')](this['getDataValue'](_0xc44a('0x1d'))):{};},'set':function(_0x2bb050){return this[_0xc44a('0x1f')]('onlineForm',JSON[_0xc44a('0x20')](_0x2bb050));}},'offlineForm':{'type':Sequelize[_0xc44a('0xe')],'defaultValue':function(){return JSON[_0xc44a('0x20')]({'items':[{'type':_0xc44a('0x18'),'props':{'title':_0xc44a('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':_0xc44a('0x1b'),'type':_0xc44a('0x1b')},'variable':null},{'type':_0xc44a('0x21'),'config':{'placeholder':_0xc44a('0x22')},'props':{'title':_0xc44a('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0xc44a('0x1e')](this[_0xc44a('0x1c')](_0xc44a('0x23'))):{};},'set':function(_0x19c8c4){return this[_0xc44a('0x1f')](_0xc44a('0x23'),JSON[_0xc44a('0x20')](_0x19c8c4));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc44a('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc44a('0x1')]},'forwardOffline':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc44a('0x1')]},'waitingTitle':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xc44a('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x28')},'skipUnmanaged':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x15')},'sendUnmanaged':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc44a('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc44a('0x1')]},'notificationTemplate':{'type':Sequelize[_0xc44a('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc44a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xc44a('0xc')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xc44a('0x1')]},'customerAvatar':{'type':Sequelize[_0xc44a('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc44a('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![],'defaultValue':_0xc44a('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc44a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc44a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc44a('0x1')],'defaultValue':_0xc44a('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc44a('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![],'comment':_0xc44a('0x2c'),'set':function(_0x1dc17a){if(!_0x1dc17a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xc44a('0x1f')](_0xc44a('0x2d'),_0x1dc17a);}},'vidaooEscalation':{'type':Sequelize[_0xc44a('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xc44a('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xc44a('0x2e');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc44a('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 74c6534..24d76ea 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 _0x0faf=['querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','destroy','get','ChatWebsites','UserProfileResource','name','send','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','show','mandatoryDispositionPause','fields','includeAll','find','create','body','address','split','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ChatWebsiteId','getDispositions','findOne','Disposition','order','findAll','removeDispositions','getAnswers','CannedAnswer','ids','addLogo','file','addAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','Interval','resolve','timezone','ifTime','notify','chat','from','mapKey','isEmpty','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Applications','Intervals','interval','account','applications','orderBy','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','Start','EventManager','offline','Sequelize','no\x20available\x20attributes','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','subjectOffline','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','internal','Tag','Tags','tag','getSnippet','getProactiveActions','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','virtual','replace','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash'];(function(_0x26d0eb,_0x2017ec){var _0x29d250=function(_0x5f46f9){while(--_0x5f46f9){_0x26d0eb['push'](_0x26d0eb['shift']());}};_0x29d250(++_0x2017ec);}(_0x0faf,0x132));var _0xf0fa=function(_0x2c7780,_0x100f4a){_0x2c7780=_0x2c7780-0x0;var _0x580bc8=_0x0faf[_0x2c7780];return _0x580bc8;};'use strict';var Mustache=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var ejs=require(_0xf0fa('0x2'));var fs=require('fs');var fs_extra=require(_0xf0fa('0x3'));var _=require(_0xf0fa('0x4'));var querystring=require(_0xf0fa('0x5'));var htmlToText=require(_0xf0fa('0x6'));var Redis=require(_0xf0fa('0x7'));var jayson=require(_0xf0fa('0x8'));var qs=require(_0xf0fa('0x9'));var logger=require('../../config/logger')(_0xf0fa('0xa'));var config=require(_0xf0fa('0xb'));var APIBadRequestError=require(_0xf0fa('0xc'))[_0xf0fa('0xd')];var APINotFoundError=require(_0xf0fa('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xf0fa('0xc'))[_0xf0fa('0xe')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0xf0fa('0xc'))[_0xf0fa('0xf')];var wildcardUtils=require(_0xf0fa('0x10'));var URL=require(_0xf0fa('0x11'))[_0xf0fa('0x12')];var db=require(_0xf0fa('0x13'))['db'];config[_0xf0fa('0x14')]=_[_0xf0fa('0x15')](config['redis'],{'host':_0xf0fa('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0fa('0x14')]));require('./chatWebsite.socket')[_0xf0fa('0x17')](socket);var client=jayson[_0xf0fa('0x18')][_0xf0fa('0x19')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xf0fa('0x18')]['http']({'port':0x232b});var client9001=jayson[_0xf0fa('0x18')][_0xf0fa('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x10ce43,_0x3203ce,_0x467d5f,_0x33df80){return new Promise(function(_0x28bab8,_0x3f3bb7){var _0x497542=_0x33df80||client;return _0x497542[_0xf0fa('0x1a')](_0x10ce43,_0x467d5f)[_0xf0fa('0x1b')](function(_0x30ce17){logger[_0xf0fa('0x1c')](_0xf0fa('0x1d'),_0x3203ce,_0xf0fa('0x1e'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3203ce,_0xf0fa('0x1e'),JSON[_0xf0fa('0x1f')](_0x30ce17));if(_0x30ce17[_0xf0fa('0x20')]){if(_0x30ce17[_0xf0fa('0x20')][_0xf0fa('0x21')]===0x1f4){logger[_0xf0fa('0x20')](_0xf0fa('0x1d'),_0x3203ce,_0x30ce17[_0xf0fa('0x20')][_0xf0fa('0x22')]);return _0x3f3bb7(_0x30ce17[_0xf0fa('0x20')][_0xf0fa('0x22')]);}logger['error'](_0xf0fa('0x1d'),_0x3203ce,_0x30ce17[_0xf0fa('0x20')][_0xf0fa('0x22')]);return _0x28bab8(_0x30ce17[_0xf0fa('0x20')][_0xf0fa('0x22')]);}else{logger[_0xf0fa('0x1c')](_0xf0fa('0x1d'),_0x3203ce,_0xf0fa('0x1e'));_0x28bab8(_0x30ce17[_0xf0fa('0x23')]['message']);}})[_0xf0fa('0x24')](function(_0x19e392){logger['error'](_0xf0fa('0x1d'),_0x3203ce,_0x19e392);_0x3f3bb7(_0x19e392);});});}function respondWithStatusCode(_0x3703b5,_0x2efe88){_0x2efe88=_0x2efe88||0xcc;return function(_0x59e007){if(_0x59e007){return _0x3703b5[_0xf0fa('0x25')](_0x2efe88);}return _0x3703b5[_0xf0fa('0x26')](_0x2efe88)[_0xf0fa('0x27')]();};}function respondWithResult(_0xf631f6,_0x4e6eef){_0x4e6eef=_0x4e6eef||0xc8;return function(_0x4be235){if(_0x4be235){return _0xf631f6[_0xf0fa('0x26')](_0x4e6eef)[_0xf0fa('0x28')](_0x4be235);}};}function respondWithFilteredResult(_0x1679cf,_0x11085f){return function(_0x57b8e9){if(_0x57b8e9){var _0x4058d6=typeof _0x11085f[_0xf0fa('0x29')]===_0xf0fa('0x2a')&&typeof _0x11085f['limit']===_0xf0fa('0x2a');var _0x593697=_0x57b8e9[_0xf0fa('0x2b')];var _0x1e3875=_0x4058d6?0x0:_0x11085f[_0xf0fa('0x29')];var _0x519661=_0x4058d6?_0x57b8e9[_0xf0fa('0x2b')]:_0x11085f[_0xf0fa('0x29')]+_0x11085f[_0xf0fa('0x2c')];var _0x212986;if(_0x519661>=_0x593697){_0x519661=_0x593697;_0x212986=0xc8;}else{_0x212986=0xce;}_0x1679cf[_0xf0fa('0x26')](_0x212986);return _0x1679cf[_0xf0fa('0x2d')]('Content-Range',_0x1e3875+'-'+_0x519661+'/'+_0x593697)['json'](_0x57b8e9);}return null;};}function saveUpdates(_0x36173a){return function(_0x255f9d){if(_0x255f9d){return _0x255f9d['update'](_0x36173a)[_0xf0fa('0x1b')](function(_0x50e0bd){return _0x50e0bd;});}return null;};}function removeEntity(_0x5ca1b2){return function(_0x47dcbb){if(_0x47dcbb){return _0x47dcbb[_0xf0fa('0x2e')]()['then'](function(){var _0x2c0721=_0x47dcbb[_0xf0fa('0x2f')]({'plain':!![]});var _0x5e1d57=_0xf0fa('0x30');return db[_0xf0fa('0x31')][_0xf0fa('0x2e')]({'where':{'type':_0x5e1d57,'resourceId':_0x2c0721['id']}})[_0xf0fa('0x1b')](function(){return _0x47dcbb;});})[_0xf0fa('0x1b')](function(){_0x5ca1b2['status'](0xcc)[_0xf0fa('0x27')]();});}};}function handleEntityNotFound(_0x307aa8){return function(_0x36dd2b){if(!_0x36dd2b){_0x307aa8['sendStatus'](0x194);}return _0x36dd2b;};}function handleError(_0x2a6749,_0x114feb){_0x114feb=_0x114feb||0x1f4;return function(_0x19b137){logger[_0xf0fa('0x20')](_0x19b137['stack']);if(_0x19b137['name']){delete _0x19b137[_0xf0fa('0x32')];}_0x2a6749[_0xf0fa('0x26')](_0x114feb)[_0xf0fa('0x33')](_0x19b137);};}function createInteractionObject(_0x47486f,_0x3a238d,_0x5cd669,_0x571422){var _0x5a2be0=require('user-agent-parser');var _0x3cdc0e=new _0x5a2be0();var _0x778121=_0x3cdc0e['setUA'](_0x5cd669['user-agent'])[_0xf0fa('0x34')]();var _0x1b8fb8=_0x3a238d[_0xf0fa('0x35')];if(_0x5cd669[_0xf0fa('0x36')]){_0x1b8fb8=_0x5cd669[_0xf0fa('0x36')];}else if(_0x5cd669[_0xf0fa('0x37')]){_0x1b8fb8=_[_0xf0fa('0x38')](_0x5cd669['x-forwarded-for']['split'](','));}return{'ContactId':_0x571422['id'],'ChatWebsiteId':_0x47486f,'from':(_0x571422[_0xf0fa('0x39')]||'')+'\x20'+(_0x571422[_0xf0fa('0x3a')]||''),'customerIp':_0x1b8fb8,'customerPort':_0x5cd669[_0xf0fa('0x3b')]?_0x5cd669[_0xf0fa('0x3b')]:null,'referer':_0x3a238d[_0xf0fa('0x3c')],'browserName':_0x778121[_0xf0fa('0x3d')]['name']&&_0x778121[_0xf0fa('0x3d')]['version']?util[_0xf0fa('0x3e')](_0xf0fa('0x3f'),_0x778121[_0xf0fa('0x3d')][_0xf0fa('0x32')],_0x778121[_0xf0fa('0x3d')][_0xf0fa('0x40')]):_0xf0fa('0x41'),'browserVersion':_0x778121[_0xf0fa('0x3d')][_0xf0fa('0x40')]||'unknown','osName':util['format']('%s\x20%s',_0x778121['os'][_0xf0fa('0x32')],_0x778121['os'][_0xf0fa('0x40')]),'osVersion':_0x778121['os']['version'],'deviceModel':_0x778121[_0xf0fa('0x42')][_0xf0fa('0x43')]&&_0x778121[_0xf0fa('0x42')][_0xf0fa('0x44')]?util['format'](_0xf0fa('0x45'),_0x778121[_0xf0fa('0x42')][_0xf0fa('0x43')],_0x778121[_0xf0fa('0x42')][_0xf0fa('0x44')],_0x778121[_0xf0fa('0x42')][_0xf0fa('0x46')]):null,'deviceVendor':_0x778121[_0xf0fa('0x42')][_0xf0fa('0x44')],'deviceType':_0x778121['device'][_0xf0fa('0x46')],'formData':JSON[_0xf0fa('0x1f')](_0x3a238d)};}exports[_0xf0fa('0x47')]=function(_0x24ae12,_0x856c2e){var _0x2f8c74={'include':[{'model':db[_0xf0fa('0x48')],'as':'mandatoryDispositionPause'}]},_0x53b2a6={},_0xd86643={'count':0x0,'rows':[]};var _0x1e13f6=_[_0xf0fa('0x49')](db[_0xf0fa('0x4a')][_0xf0fa('0x4b')],function(_0x37aad0){return{'name':_0x37aad0[_0xf0fa('0x4c')],'type':_0x37aad0[_0xf0fa('0x46')][_0xf0fa('0x4d')]};});_0x53b2a6[_0xf0fa('0x43')]=_['map'](_0x1e13f6,_0xf0fa('0x32'));_0x53b2a6['query']=_[_0xf0fa('0x4e')](_0x24ae12[_0xf0fa('0x4f')]);_0x53b2a6[_0xf0fa('0x50')]=_['intersection'](_0x53b2a6[_0xf0fa('0x43')],_0x53b2a6[_0xf0fa('0x4f')]);_0x2f8c74[_0xf0fa('0x51')]=_[_0xf0fa('0x52')](_0x53b2a6[_0xf0fa('0x43')],qs['fields'](_0x24ae12[_0xf0fa('0x4f')]['fields']));_0x2f8c74[_0xf0fa('0x51')]=_0x2f8c74[_0xf0fa('0x51')][_0xf0fa('0x53')]?_0x2f8c74[_0xf0fa('0x51')]:_0x53b2a6[_0xf0fa('0x43')];if(!_0x24ae12['query'][_0xf0fa('0x54')](_0xf0fa('0x55'))){_0x2f8c74[_0xf0fa('0x2c')]=qs[_0xf0fa('0x2c')](_0x24ae12[_0xf0fa('0x4f')][_0xf0fa('0x2c')]);_0x2f8c74['offset']=qs[_0xf0fa('0x29')](_0x24ae12['query']['offset']);}_0x2f8c74['order']=qs[_0xf0fa('0x56')](_0x24ae12[_0xf0fa('0x4f')][_0xf0fa('0x56')]);_0x2f8c74[_0xf0fa('0x57')]=qs[_0xf0fa('0x50')](_[_0xf0fa('0x58')](_0x24ae12[_0xf0fa('0x4f')],_0x53b2a6[_0xf0fa('0x50')]),_0x1e13f6);if(_0x24ae12[_0xf0fa('0x4f')]['filter']){_0x2f8c74[_0xf0fa('0x57')]=_['merge'](_0x2f8c74[_0xf0fa('0x57')],{'$or':_[_0xf0fa('0x49')](_0x1e13f6,function(_0x1f95dc){if(_0x1f95dc[_0xf0fa('0x46')]!=='VIRTUAL'){var _0x36e343={};_0x36e343[_0x1f95dc['name']]={'$like':'%'+_0x24ae12[_0xf0fa('0x4f')][_0xf0fa('0x59')]+'%'};return _0x36e343;}})});}_0x2f8c74=_[_0xf0fa('0x5a')]({},_0x2f8c74,_0x24ae12[_0xf0fa('0x5b')]);var _0xa55804={'where':_0x2f8c74[_0xf0fa('0x57')]};return db['ChatWebsite'][_0xf0fa('0x2b')](_0xa55804)[_0xf0fa('0x1b')](function(_0x4a20f4){_0xd86643[_0xf0fa('0x2b')]=_0x4a20f4;if(_0x24ae12[_0xf0fa('0x4f')]['includeAll']){_0x2f8c74[_0xf0fa('0x5c')]=[{'all':!![]}];}return db[_0xf0fa('0x4a')]['findAll'](_0x2f8c74);})[_0xf0fa('0x1b')](function(_0x3c5014){_0xd86643[_0xf0fa('0x5d')]=_0x3c5014;return _0xd86643;})['then'](respondWithFilteredResult(_0x856c2e,_0x2f8c74))[_0xf0fa('0x24')](handleError(_0x856c2e,null));};exports[_0xf0fa('0x5e')]=function(_0x480dc0,_0x22ed85){var _0x34147c={'raw':![],'where':{'id':_0x480dc0['params']['id']},'include':[{'model':db[_0xf0fa('0x48')],'as':_0xf0fa('0x5f')}]},_0x3369e1={};_0x3369e1['model']=_[_0xf0fa('0x4e')](db[_0xf0fa('0x4a')][_0xf0fa('0x4b')]);_0x3369e1[_0xf0fa('0x4f')]=_[_0xf0fa('0x4e')](_0x480dc0[_0xf0fa('0x4f')]);_0x3369e1[_0xf0fa('0x50')]=_[_0xf0fa('0x52')](_0x3369e1[_0xf0fa('0x43')],_0x3369e1[_0xf0fa('0x4f')]);_0x34147c['attributes']=_[_0xf0fa('0x52')](_0x3369e1[_0xf0fa('0x43')],qs[_0xf0fa('0x60')](_0x480dc0[_0xf0fa('0x4f')][_0xf0fa('0x60')]));_0x34147c[_0xf0fa('0x51')]=_0x34147c[_0xf0fa('0x51')]['length']?_0x34147c[_0xf0fa('0x51')]:_0x3369e1[_0xf0fa('0x43')];if(_0x480dc0[_0xf0fa('0x4f')][_0xf0fa('0x61')]){_0x34147c[_0xf0fa('0x5c')]=[{'all':!![]}];}_0x34147c=_[_0xf0fa('0x5a')]({},_0x34147c,_0x480dc0[_0xf0fa('0x5b')]);return db['ChatWebsite'][_0xf0fa('0x62')](_0x34147c)[_0xf0fa('0x1b')](handleEntityNotFound(_0x22ed85,null))[_0xf0fa('0x1b')](respondWithResult(_0x22ed85,null))[_0xf0fa('0x24')](handleError(_0x22ed85,null));};exports[_0xf0fa('0x63')]=function(_0x5bf7f2,_0x5f023b){var _0x5a4e16=null;_0x5bf7f2[_0xf0fa('0x64')][_0xf0fa('0x65')][_0xf0fa('0x66')](',')[_0xf0fa('0x67')](_0x508df9=>{if(_0x508df9['trim']()!==''&&!wildcardUtils[_0xf0fa('0x68')](_0x508df9['trim']())){_0x5a4e16=new APIBadRequestError('\x22'+_0x508df9[_0xf0fa('0x69')]()+_0xf0fa('0x6a'));}});if(_0x5a4e16){return handleError(_0x5f023b,null)(_0x5a4e16);}return db[_0xf0fa('0x4a')][_0xf0fa('0x63')](_0x5bf7f2[_0xf0fa('0x64')],{})['then'](function(_0x130e56){var _0xdc09c7=_0x5bf7f2[_0xf0fa('0x6b')][_0xf0fa('0x2f')]({'plain':!![]});if(!_0xdc09c7)throw new Error(_0xf0fa('0x6c'));if(_0xdc09c7[_0xf0fa('0x6d')]===_0xf0fa('0x6b')){var _0x35e7e7=_0x130e56[_0xf0fa('0x2f')]({'plain':!![]});var _0x4c2fdd='ChatWebsites';return db[_0xf0fa('0x6e')]['find']({'where':{'name':_0x4c2fdd,'userProfileId':_0xdc09c7[_0xf0fa('0x6f')]},'raw':!![]})['then'](function(_0x4b3cb6){if(_0x4b3cb6&&_0x4b3cb6['autoAssociation']===0x0){return db[_0xf0fa('0x31')][_0xf0fa('0x63')]({'name':_0x35e7e7[_0xf0fa('0x32')],'resourceId':_0x35e7e7['id'],'type':_0x4b3cb6[_0xf0fa('0x32')],'sectionId':_0x4b3cb6['id']},{})[_0xf0fa('0x1b')](function(){return _0x130e56;});}else{return _0x130e56;}})[_0xf0fa('0x24')](function(_0x12a969){logger[_0xf0fa('0x20')](_0xf0fa('0x70'),_0x12a969);throw _0x12a969;});}return _0x130e56;})[_0xf0fa('0x1b')](respondWithResult(_0x5f023b,0xc9))['catch'](handleError(_0x5f023b,null));};exports[_0xf0fa('0x71')]=function(_0x5de588,_0x448851){var _0x56c701=null;_0x5de588[_0xf0fa('0x64')]['address'][_0xf0fa('0x66')](',')['forEach'](_0x15f4d5=>{if(_0x15f4d5[_0xf0fa('0x69')]()!==''&&!wildcardUtils[_0xf0fa('0x68')](_0x15f4d5[_0xf0fa('0x69')]())){_0x56c701=new APIBadRequestError('\x22'+_0x15f4d5[_0xf0fa('0x69')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x56c701){return handleError(_0x448851,null)(_0x56c701);}if(_0x5de588['body']['id']){delete _0x5de588[_0xf0fa('0x64')]['id'];}return db[_0xf0fa('0x4a')]['find']({'where':{'id':_0x5de588['params']['id']},'include':[{'model':db[_0xf0fa('0x48')],'as':_0xf0fa('0x5f')}]})[_0xf0fa('0x1b')](handleEntityNotFound(_0x448851,null))[_0xf0fa('0x1b')](saveUpdates(_0x5de588[_0xf0fa('0x64')],null))['then'](respondWithResult(_0x448851,null))[_0xf0fa('0x24')](handleError(_0x448851,null));};exports[_0xf0fa('0x2e')]=function(_0x16492b,_0x5ab304){return db['ChatWebsite'][_0xf0fa('0x62')]({'where':{'id':_0x16492b[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x5ab304,null))['then'](removeEntity(_0x5ab304,null))[_0xf0fa('0x24')](handleError(_0x5ab304,null));};exports[_0xf0fa('0x73')]=function(_0x22cf95,_0x509891){return db['ChatWebsite']['describe']()[_0xf0fa('0x1b')](respondWithResult(_0x509891,null))['catch'](handleError(_0x509891,null));};exports['addDisposition']=function(_0xebbb68,_0xfb68fd){if(_0xebbb68[_0xf0fa('0x64')]['id']){delete _0xebbb68[_0xf0fa('0x64')]['id'];}return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0xebbb68['params']['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0xfb68fd,null))[_0xf0fa('0x1b')](function(_0x15dda8){if(_0x15dda8){_0xebbb68['body'][_0xf0fa('0x74')]=_0x15dda8['id'];return db['Disposition']['create'](_0xebbb68[_0xf0fa('0x64')]);}})['then'](respondWithResult(_0xfb68fd,null))['catch'](handleError(_0xfb68fd,null));};exports[_0xf0fa('0x75')]=function(_0x418ee8,_0x83ea6d){var _0x581f37={'raw':![],'where':{}};var _0xe1b0ff={};var _0x168099={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf0fa('0x76')]({'where':{'id':_0x418ee8[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x83ea6d,null))[_0xf0fa('0x1b')](function(_0x1461e1){if(_0x1461e1){_0xe1b0ff[_0xf0fa('0x43')]=_['keys'](db[_0xf0fa('0x77')]['rawAttributes']);_0xe1b0ff[_0xf0fa('0x4f')]=_[_0xf0fa('0x4e')](_0x418ee8[_0xf0fa('0x4f')]);_0xe1b0ff[_0xf0fa('0x50')]=_[_0xf0fa('0x52')](_0xe1b0ff[_0xf0fa('0x43')],_0xe1b0ff[_0xf0fa('0x4f')]);_0x581f37['attributes']=_['intersection'](_0xe1b0ff[_0xf0fa('0x43')],qs[_0xf0fa('0x60')](_0x418ee8['query'][_0xf0fa('0x60')]));_0x581f37['attributes']=_0x581f37['attributes'][_0xf0fa('0x53')]?_0x581f37[_0xf0fa('0x51')]:_0xe1b0ff['model'];if(!_0x418ee8['query'][_0xf0fa('0x54')](_0xf0fa('0x55'))){_0x581f37[_0xf0fa('0x2c')]=qs[_0xf0fa('0x2c')](_0x418ee8[_0xf0fa('0x4f')][_0xf0fa('0x2c')]);_0x581f37['offset']=qs[_0xf0fa('0x29')](_0x418ee8[_0xf0fa('0x4f')]['offset']);}_0x581f37[_0xf0fa('0x78')]=qs['sort'](_0x418ee8[_0xf0fa('0x4f')]['sort']);_0x581f37['where']=qs[_0xf0fa('0x50')](_['pick'](_0x418ee8['query'],_0xe1b0ff['filters']));_0x581f37['where'][_0xf0fa('0x74')]=_0x1461e1['id'];if(_0x418ee8['query'][_0xf0fa('0x59')]){_0x581f37[_0xf0fa('0x57')]=_['merge'](_0x581f37[_0xf0fa('0x57')],{'$or':_[_0xf0fa('0x49')](_0x581f37[_0xf0fa('0x51')],function(_0x2ef7ef){var _0x4e5a0e={};_0x4e5a0e[_0x2ef7ef]={'$like':'%'+_0x418ee8[_0xf0fa('0x4f')]['filter']+'%'};return _0x4e5a0e;})});}_0x581f37=_[_0xf0fa('0x5a')]({},_0x581f37,_0x418ee8['options']);return db[_0xf0fa('0x77')][_0xf0fa('0x2b')]({'where':_0x581f37[_0xf0fa('0x57')]})[_0xf0fa('0x1b')](function(_0x4c4fdd){_0x168099['count']=_0x4c4fdd;if(_0x418ee8[_0xf0fa('0x4f')]['includeAll']){_0x581f37[_0xf0fa('0x5c')]=[{'all':!![]}];}return db[_0xf0fa('0x77')][_0xf0fa('0x79')](_0x581f37);})['then'](function(_0x142f4f){_0x168099['rows']=_0x142f4f;return _0x168099;});}})[_0xf0fa('0x1b')](respondWithFilteredResult(_0x83ea6d,_0x581f37))[_0xf0fa('0x24')](handleError(_0x83ea6d,null));};exports[_0xf0fa('0x7a')]=function(_0x52cf85,_0x227fda){return db['ChatWebsite'][_0xf0fa('0x62')]({'where':{'id':_0x52cf85[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x227fda,null))[_0xf0fa('0x1b')](function(_0x47317b){if(_0x47317b){return _0x47317b[_0xf0fa('0x7a')](_0x52cf85[_0xf0fa('0x4f')]['ids']);}})[_0xf0fa('0x1b')](respondWithStatusCode(_0x227fda,null))['catch'](handleError(_0x227fda,null));};exports['addAnswer']=function(_0x2ea054,_0x381b50){if(_0x2ea054['body']['id']){delete _0x2ea054['body']['id'];}return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x2ea054['params']['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x381b50,null))['then'](function(_0x2815ca){if(_0x2815ca){_0x2ea054[_0xf0fa('0x64')]['ChatWebsiteId']=_0x2815ca['id'];return db['CannedAnswer'][_0xf0fa('0x63')](_0x2ea054['body']);}})[_0xf0fa('0x1b')](respondWithResult(_0x381b50,null))[_0xf0fa('0x24')](handleError(_0x381b50,null));};exports[_0xf0fa('0x7b')]=function(_0x530b41,_0x577ea1){var _0x174737={'raw':![],'where':{}};var _0x4eddc7={};var _0x24b4d7={'count':0x0,'rows':[]};return db[_0xf0fa('0x4a')]['findOne']({'where':{'id':_0x530b41[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x577ea1,null))[_0xf0fa('0x1b')](function(_0x40ba70){if(_0x40ba70){_0x4eddc7[_0xf0fa('0x43')]=_[_0xf0fa('0x4e')](db['CannedAnswer']['rawAttributes']);_0x4eddc7[_0xf0fa('0x4f')]=_['keys'](_0x530b41[_0xf0fa('0x4f')]);_0x4eddc7['filters']=_['intersection'](_0x4eddc7[_0xf0fa('0x43')],_0x4eddc7['query']);_0x174737['attributes']=_[_0xf0fa('0x52')](_0x4eddc7['model'],qs['fields'](_0x530b41[_0xf0fa('0x4f')][_0xf0fa('0x60')]));_0x174737['attributes']=_0x174737[_0xf0fa('0x51')]['length']?_0x174737['attributes']:_0x4eddc7[_0xf0fa('0x43')];if(!_0x530b41['query']['hasOwnProperty'](_0xf0fa('0x55'))){_0x174737['limit']=qs[_0xf0fa('0x2c')](_0x530b41[_0xf0fa('0x4f')]['limit']);_0x174737[_0xf0fa('0x29')]=qs[_0xf0fa('0x29')](_0x530b41[_0xf0fa('0x4f')]['offset']);}_0x174737[_0xf0fa('0x78')]=qs[_0xf0fa('0x56')](_0x530b41['query']['sort']);_0x174737[_0xf0fa('0x57')]=qs['filters'](_['pick'](_0x530b41[_0xf0fa('0x4f')],_0x4eddc7['filters']));_0x174737['where'][_0xf0fa('0x74')]=_0x40ba70['id'];if(_0x530b41['query'][_0xf0fa('0x59')]){_0x174737[_0xf0fa('0x57')]=_[_0xf0fa('0x5a')](_0x174737[_0xf0fa('0x57')],{'$or':_[_0xf0fa('0x49')](_0x174737['attributes'],function(_0x201f77){var _0x2bd061={};_0x2bd061[_0x201f77]={'$like':'%'+_0x530b41[_0xf0fa('0x4f')][_0xf0fa('0x59')]+'%'};return _0x2bd061;})});}_0x174737=_[_0xf0fa('0x5a')]({},_0x174737,_0x530b41[_0xf0fa('0x5b')]);return db[_0xf0fa('0x7c')][_0xf0fa('0x2b')]({'where':_0x174737['where']})['then'](function(_0x397378){_0x24b4d7['count']=_0x397378;if(_0x530b41['query'][_0xf0fa('0x61')]){_0x174737[_0xf0fa('0x5c')]=[{'all':!![]}];}return db[_0xf0fa('0x7c')][_0xf0fa('0x79')](_0x174737);})[_0xf0fa('0x1b')](function(_0x188052){_0x24b4d7[_0xf0fa('0x5d')]=_0x188052;return _0x24b4d7;});}})[_0xf0fa('0x1b')](respondWithFilteredResult(_0x577ea1,_0x174737))['catch'](handleError(_0x577ea1,null));};exports['removeAnswers']=function(_0x5461cc,_0x50735f){return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x5461cc['params']['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x50735f,null))[_0xf0fa('0x1b')](function(_0x18d4ce){if(_0x18d4ce){return _0x18d4ce['removeAnswers'](_0x5461cc['query'][_0xf0fa('0x7d')]);}})[_0xf0fa('0x1b')](respondWithStatusCode(_0x50735f,null))[_0xf0fa('0x24')](handleError(_0x50735f,null));};exports[_0xf0fa('0x7e')]=function(_0x44b3cf,_0x45b555){_0x44b3cf['body']['sitepic']=_0x44b3cf[_0xf0fa('0x7f')]['filename'];return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x44b3cf[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x45b555,null))[_0xf0fa('0x1b')](saveUpdates(_0x44b3cf[_0xf0fa('0x64')],null))[_0xf0fa('0x1b')](respondWithResult(_0x45b555,null))[_0xf0fa('0x24')](handleError(_0x45b555,null));};exports[_0xf0fa('0x80')]=function(_0x4aa74c,_0x3d878b){_0x4aa74c['body']['agentAvatar']=_0x4aa74c[_0xf0fa('0x7f')][_0xf0fa('0x81')];return db['ChatWebsite'][_0xf0fa('0x62')]({'where':{'id':_0x4aa74c[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x3d878b,null))[_0xf0fa('0x1b')](saveUpdates(_0x4aa74c[_0xf0fa('0x64')],null))[_0xf0fa('0x1b')](respondWithResult(_0x3d878b,null))['catch'](handleError(_0x3d878b,null));};exports[_0xf0fa('0x82')]=function(_0x2e30dd,_0x3edfe0){_0x2e30dd['body'][_0xf0fa('0x83')]=_0x2e30dd[_0xf0fa('0x7f')][_0xf0fa('0x81')];return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x2e30dd[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x3edfe0,null))[_0xf0fa('0x1b')](saveUpdates(_0x2e30dd[_0xf0fa('0x64')],null))[_0xf0fa('0x1b')](respondWithResult(_0x3edfe0,null))[_0xf0fa('0x24')](handleError(_0x3edfe0,null));};exports[_0xf0fa('0x84')]=function(_0x17ca2b,_0x284e7d){_0x17ca2b[_0xf0fa('0x64')][_0xf0fa('0x85')]=_0x17ca2b[_0xf0fa('0x7f')][_0xf0fa('0x81')];return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x17ca2b[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x284e7d,null))[_0xf0fa('0x1b')](saveUpdates(_0x17ca2b['body'],null))['then'](respondWithResult(_0x284e7d,null))[_0xf0fa('0x24')](handleError(_0x284e7d,null));};exports[_0xf0fa('0x86')]=function(_0x2a8217,_0x15291c){var _0x125713=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x89'));var _0x202759={'where':{'id':_0x2a8217[_0xf0fa('0x72')]['id']},'attributes':['id',_0xf0fa('0x8a')],'raw':!![]};var _0x2cd096=![];return require('../../config/license/util')[_0xf0fa('0x8b')]()['then'](function(_0x35fd94){if(_0x35fd94){_0x2cd096=_0x35fd94[_0xf0fa('0x8c')];}})['then'](function(){return db[_0xf0fa('0x4a')][_0xf0fa('0x62')](_0x202759);})[_0xf0fa('0x1b')](handleEntityNotFound(_0x15291c,null))[_0xf0fa('0x1b')](function(_0x16fdd7){if(_0x16fdd7){if(!_[_0xf0fa('0x8d')](_0x16fdd7[_0xf0fa('0x8a')])){if(fs['existsSync'](path['join'](config[_0xf0fa('0x88')],_0xf0fa('0x8e'),_0x16fdd7[_0xf0fa('0x8a')]))&&_0x2cd096){_0x125713=path['join'](config[_0xf0fa('0x88')],_0xf0fa('0x8e'),_0x16fdd7[_0xf0fa('0x8a')]);}}return _0x15291c[_0xf0fa('0x8f')](_0x125713);}})[_0xf0fa('0x24')](handleError(_0x15291c,null));};exports[_0xf0fa('0x90')]=function(_0x6b6050,_0x36c5e3){var _0x18fe3d=path[_0xf0fa('0x87')](config['root'],_0xf0fa('0x91'));var _0x522569={'where':{'id':_0x6b6050[_0xf0fa('0x72')]['id']},'attributes':['id',_0xf0fa('0x92')],'raw':!![]};return db[_0xf0fa('0x4a')][_0xf0fa('0x62')](_0x522569)[_0xf0fa('0x1b')](handleEntityNotFound(_0x36c5e3,null))[_0xf0fa('0x1b')](function(_0x32a10f){if(_0x32a10f){if(!_[_0xf0fa('0x8d')](_0x32a10f['agentAvatar'])){if(fs['existsSync'](path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x32a10f[_0xf0fa('0x92')]))){_0x18fe3d=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x32a10f['agentAvatar']);}}return _0x36c5e3[_0xf0fa('0x8f')](_0x18fe3d);}})[_0xf0fa('0x24')](handleError(_0x36c5e3,null));};exports[_0xf0fa('0x94')]=function(_0x477425,_0x3f068f){var _0xc8e407=path[_0xf0fa('0x87')](config['root'],_0xf0fa('0x95'));var _0x3fc094={'where':{'id':_0x477425[_0xf0fa('0x72')]['id']},'attributes':['id',_0xf0fa('0x83'),_0xf0fa('0x96')],'raw':!![]};return db['ChatWebsite'][_0xf0fa('0x62')](_0x3fc094)['then'](handleEntityNotFound(_0x3f068f,null))[_0xf0fa('0x1b')](function(_0x350b8a){if(_0x350b8a){if(!_[_0xf0fa('0x8d')](_0x350b8a['customerAvatar'])){if(fs['existsSync'](path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x350b8a[_0xf0fa('0x83')]))&&_0x350b8a['showCustomerAvatar']){_0xc8e407=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x350b8a[_0xf0fa('0x83')]);}}return _0x3f068f[_0xf0fa('0x8f')](_0xc8e407);}})[_0xf0fa('0x24')](handleError(_0x3f068f,null));};exports['getSystemAvatar']=function(_0x42c62c,_0x4f21e9){var _0x5252ba=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],'server/files/images/avatars/system_avatar.png');var _0x31f378={'where':{'id':_0x42c62c['params']['id']},'attributes':['id',_0xf0fa('0x85')],'raw':!![]};return db['ChatWebsite']['find'](_0x31f378)[_0xf0fa('0x1b')](handleEntityNotFound(_0x4f21e9,null))[_0xf0fa('0x1b')](function(_0x2ab565){if(_0x2ab565){if(!_[_0xf0fa('0x8d')](_0x2ab565[_0xf0fa('0x85')])){if(fs[_0xf0fa('0x97')](path['join'](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x2ab565[_0xf0fa('0x85')]))){_0x5252ba=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x93'),_0x2ab565[_0xf0fa('0x85')]);}}return _0x4f21e9[_0xf0fa('0x8f')](_0x5252ba);}})['catch'](handleError(_0x4f21e9,null));};function checkWebsiteInterval(_0x32d4bf){var _0x2a895e=_0x32d4bf[_0xf0fa('0x98')];if(!_0x2a895e){return Promise[_0xf0fa('0x99')](_0x32d4bf);}var _0x117071=_0x32d4bf[_0xf0fa('0x9a')]||undefined;return _0x2a895e[_0xf0fa('0x9b')](_0x117071)[_0xf0fa('0x1b')](function(_0x114487){if(!_0x114487){throw new APIOutOfIntervalError();}return _0x32d4bf;});}exports[_0xf0fa('0x9c')]=function(_0x27c397,_0x49448a){var _0x29b1e9={'body':_0x27c397[_0xf0fa('0x64')],'channel':_0xf0fa('0x9d')};var _0x24c93c=[];var _0xb688a1=[];var _0x274f0d={};var _0x3daa6e=![];if(_0x27c397[_0xf0fa('0x64')]['id']){delete _0x27c397['body']['id'];}if(_[_0xf0fa('0x8d')](_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x9e')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xf0fa('0x8d')](_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x9f')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xf0fa('0xa0')](_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x64')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x212b4a=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x35')]&&_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x3c')];return db[_0xf0fa('0xa1')][_0xf0fa('0x73')]()['then'](function(_0x5421b7){if(!_0x5421b7){throw new Error(_0xf0fa('0xa2'));}_0x24c93c=Object['keys'](_0x5421b7)[_0xf0fa('0x59')](function(_0x4be965){return![_0xf0fa('0xa3'),'updatedAt'][_0xf0fa('0xa4')](_0x4be965);});_0xb688a1=Object[_0xf0fa('0x4e')](_0x5421b7)[_0xf0fa('0x59')](function(_0x51417a){return!['createdAt',_0xf0fa('0xa5'),_0xf0fa('0xa6'),_0xf0fa('0xa7')]['includes'](_0x51417a);});if(!_['includes'](_0xb688a1,_0x27c397['body']['mapKey'])){throw new APIBadRequestError(_0xf0fa('0xa8')+_0xb688a1['join'](',\x20'));}_0x274f0d[_0x27c397['body'][_0xf0fa('0x9f')]]=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x9e')];})[_0xf0fa('0x1b')](function(){return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x27c397['params']['id']},'include':[{'model':db[_0xf0fa('0xa9')],'as':_0xf0fa('0xaa'),'include':[{'model':db[_0xf0fa('0xa1')],'as':_0xf0fa('0xab'),'where':_0x274f0d,'limit':0x1,'order':[[_0xf0fa('0xa5'),_0xf0fa('0xac')]]}]},{'model':db['ChatApplication'],'as':_0xf0fa('0xad')},{'model':db['Interval'],'as':_0xf0fa('0x98'),'include':[{'model':db[_0xf0fa('0x98')],'as':_0xf0fa('0xae'),'attributes':['id',_0xf0fa('0xaf')],'raw':!![]}]}]});})[_0xf0fa('0x1b')](function(_0x1eec60){if(!_0x1eec60){throw new APINotFoundError(util[_0xf0fa('0x3e')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x27c397[_0xf0fa('0x72')]['id']));}if(_0x212b4a){return checkWebsiteInterval(_0x1eec60);}return _0x1eec60;})[_0xf0fa('0x1b')](function(_0x4765f8){_0x29b1e9[_0xf0fa('0xb0')]=_0x4765f8;_0x29b1e9[_0xf0fa('0xb1')]=_[_0xf0fa('0xb2')](_0x4765f8['Applications'],[_0xf0fa('0xb3')],[_0xf0fa('0xb4')]);if(_0x29b1e9[_0xf0fa('0xb0')][_0xf0fa('0xad')]){delete _0x29b1e9[_0xf0fa('0xb0')][_0xf0fa('0xad')];}_0x29b1e9[_0xf0fa('0xb5')]=_0x4765f8[_0xf0fa('0xaa')]||{'id':_0x4765f8[_0xf0fa('0xa7')]};if(_0x29b1e9[_0xf0fa('0xb5')]&&_0x29b1e9[_0xf0fa('0xb5')][_0xf0fa('0xab')][_0xf0fa('0x53')]){return _0x29b1e9[_0xf0fa('0xb5')][_0xf0fa('0xab')][0x0];}var _0x322116=_['defaults'](_0x27c397[_0xf0fa('0x64')],{'firstName':_0x27c397['body'][_0xf0fa('0x9e')],'ListId':_0x4765f8[_0xf0fa('0xa7')]});_0x322116[_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x9f')]]=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x9e')];return db[_0xf0fa('0xa1')][_0xf0fa('0x63')](_0x322116,{'fields':_0x24c93c,'raw':!![]});})[_0xf0fa('0x1b')](function(_0x4fb7e8){_0x29b1e9[_0xf0fa('0xb6')]=_0x4fb7e8;var _0x3ba4e3=createInteractionObject(_0x27c397[_0xf0fa('0x72')]['id'],_0x27c397[_0xf0fa('0x64')],_0x27c397[_0xf0fa('0xb7')],_0x4fb7e8);var _0x30ece0={'ChatWebsiteId':_0x27c397['params']['id']};if(_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xb8')]){_0x30ece0[_0xf0fa('0xb8')]=_0x27c397[_0xf0fa('0x64')]['threadId'];_0x30ece0[_0xf0fa('0xb9')]=![];return db[_0xf0fa('0xba')][_0xf0fa('0x62')]({'where':_0x30ece0})['then'](function(_0x3b751e){var _0x20a66f=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x35')]&&_0x27c397[_0xf0fa('0x64')]['referer'];if(_0x3b751e){_0x3daa6e=!![];return _0x3b751e;}else if(!_0x20a66f&&_0x3b751e&&_0x3b751e[_0xf0fa('0xb9')]){throw new APIConflictError(_0xf0fa('0xbb'));}_0x3ba4e3[_0xf0fa('0xb8')]=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xb8')];_0x3ba4e3['externalUrl']=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xbc')];return db[_0xf0fa('0xba')][_0xf0fa('0x63')](_0x3ba4e3);});}_0x30ece0[_0xf0fa('0xbd')]=_0x4fb7e8['id'];if(_0x27c397[_0xf0fa('0x64')]['interaction']&&_0x27c397[_0xf0fa('0x64')]['interaction']['id']){_0x30ece0['id']=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xbe')]['id'];return db[_0xf0fa('0xba')][_0xf0fa('0x62')]({'where':_0x30ece0})[_0xf0fa('0x1b')](function(_0x3a9e84){var _0xf57911=_0x27c397['body'][_0xf0fa('0x35')]&&_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x3c')];if(!_0xf57911&&_0x3a9e84&&_0x3a9e84['closed']){throw new APIConflictError(_0xf0fa('0xbb'));}else if(_0x3a9e84){_0x3daa6e=!![];return _0x3a9e84;}else{return db['ChatInteraction']['create'](_0x3ba4e3);}});}return db['ChatInteraction'][_0xf0fa('0x63')](_0x3ba4e3);})['then'](function(_0x3a6594){if(!_0x3daa6e){return _0x3a6594;}var _0x26524d={'from':(_0x29b1e9['contact']['firstName']||'')+'\x20'+(_0x29b1e9[_0xf0fa('0xb6')][_0xf0fa('0x3a')]||'')};if(_0x27c397['body'][_0xf0fa('0xb8')]&&_0x27c397['body']['messageId']&&_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xb8')]!=_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xbf')]){_0x26524d['threadId']=_0x27c397['body'][_0xf0fa('0xbf')];}return _0x3a6594[_0xf0fa('0x71')](_0x26524d);})[_0xf0fa('0x1b')](function(_0x22b9b6){_0x29b1e9[_0xf0fa('0xbe')]=_0x22b9b6['get']({'plain':!![]});_0x29b1e9[_0xf0fa('0xbe')][_0xf0fa('0xc0')]=!_0x3daa6e;if(_0x29b1e9[_0xf0fa('0xbe')][_0xf0fa('0xc0')]){if(_0x29b1e9[_0xf0fa('0xb0')][_0xf0fa('0xc1')]){_0x29b1e9[_0xf0fa('0xb1')][_0xf0fa('0xc2')]({'id':0x0,'priority':_0x29b1e9['applications'][_0xf0fa('0x53')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xf0fa('0xc3')});}}return db[_0xf0fa('0xc4')][_0xf0fa('0x63')]({'body':_0x27c397[_0xf0fa('0x64')][_0xf0fa('0x64')],'ChatWebsiteId':_0x27c397[_0xf0fa('0x72')]['id'],'ChatInteractionId':_0x22b9b6['id'],'direction':'in','ContactId':_0x29b1e9['contact']['id'],'AttachmentId':_0x27c397[_0xf0fa('0x64')][_0xf0fa('0xc5')]});})[_0xf0fa('0x1b')](function(_0x1514a4){_0x29b1e9[_0xf0fa('0x22')]=_0x1514a4;if(!_0x29b1e9['interaction'][_0xf0fa('0xc6')]){return;}return db['User'][_0xf0fa('0x62')]({'attributes':['id','name'],'where':{'id':_0x29b1e9[_0xf0fa('0xbe')][_0xf0fa('0xc6')]}});})['then'](function(_0x25d33c){if(_0x25d33c){_0x29b1e9[_0xf0fa('0xb1')][_0xf0fa('0xc7')]({'id':0x0,'priority':0x0,'app':_0xf0fa('0xc8'),'appdata':_0x25d33c[_0xf0fa('0x32')]+','+(_0x29b1e9['account'][_0xf0fa('0xc9')]||0xa),'interval':_0xf0fa('0xc3')});_0x29b1e9['forcedOwnership']=!![];}if(!_0x29b1e9[_0xf0fa('0xbe')][_0xf0fa('0xca')]){return;}return db[_0xf0fa('0xcb')]['find']({'attributes':['id',_0xf0fa('0x32')],'where':{'id':_0x29b1e9[_0xf0fa('0xbe')]['queueId']}});})[_0xf0fa('0x1b')](function(_0x5453b6){if(_0x5453b6){_0x29b1e9[_0xf0fa('0xb1')][_0xf0fa('0xc7')]({'id':0x0,'priority':0x1,'app':_0xf0fa('0xcc'),'appdata':_0x5453b6[_0xf0fa('0x32')]+','+(_0x29b1e9[_0xf0fa('0xb0')]['waitForTheAssignedQueue']||0x12c),'interval':_0xf0fa('0xc3')});}return respondWithRpcPromise(_0xf0fa('0xcd'),'startRouting',_0x29b1e9);})['then'](function(_0x551b54){respondWithRpcPromise(_0xf0fa('0xce'),'EventManager',{'event':_0xf0fa('0x9c'),'message':_0x551b54},client9002);return _0x551b54;})['then'](respondWithResult(_0x49448a,null))['catch'](APIHandleError(_0x49448a));};exports[_0xf0fa('0xcf')]=function(_0x14f4d7,_0x46f6fd){var _0x58566d,_0x198210,_0x2ecf7d;var _0x78b0da=[];var _0x18be1d={};var _0x32e7ee=_0x14f4d7['files']||[];var _0x51ffae=[];var _0x4784e7;return db['CmContact'][_0xf0fa('0x73')]()[_0xf0fa('0x1b')](function(_0x2f0641){if(!_0x2f0641){throw new db[(_0xf0fa('0xd0'))]['ValidationError'](_0xf0fa('0xd1'));}_0x78b0da=_['difference'](_[_0xf0fa('0x4e')](_0x2f0641),['createdAt','updatedAt',_0xf0fa('0xa6'),_0xf0fa('0xa7')]);if(_0x14f4d7[_0xf0fa('0x64')]['id']){delete _0x14f4d7[_0xf0fa('0x64')]['id'];}if(_[_0xf0fa('0x8d')](_0x14f4d7['body'][_0xf0fa('0x9e')])){throw _0x46f6fd[_0xf0fa('0x26')](0x1f4)[_0xf0fa('0x33')](new db[(_0xf0fa('0xd0'))][(_0xf0fa('0xd2'))](_0xf0fa('0xd3')));}if(_['isNil'](_0x14f4d7[_0xf0fa('0x64')][_0xf0fa('0x64')])||_0x14f4d7[_0xf0fa('0x64')]['body']===''){throw _0x46f6fd['status'](0x1f4)['send'](new db[(_0xf0fa('0xd0'))][(_0xf0fa('0xd2'))](_0xf0fa('0xd4')));}if(_[_0xf0fa('0x8d')](_0x14f4d7[_0xf0fa('0x64')]['mapKeyOffline'])){throw _0x46f6fd['status'](0x1f4)[_0xf0fa('0x33')](new db[(_0xf0fa('0xd0'))]['ValidationError'](_0xf0fa('0xd5')+_0x78b0da));}if(!_[_0xf0fa('0xa4')](_0x78b0da,_0x14f4d7[_0xf0fa('0x64')][_0xf0fa('0xd6')])){throw _0x46f6fd[_0xf0fa('0x26')](0x1f4)[_0xf0fa('0x33')](new db[(_0xf0fa('0xd0'))][(_0xf0fa('0xd2'))](_0xf0fa('0xd7')+_0x78b0da));}_0x18be1d[_0x14f4d7[_0xf0fa('0x64')][_0xf0fa('0xd6')]]=_0x14f4d7['body'][_0xf0fa('0x9e')];})[_0xf0fa('0x1b')](function(){return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x14f4d7[_0xf0fa('0x72')]['id']},'include':[{'model':db[_0xf0fa('0xa9')],'as':'List'},{'model':db[_0xf0fa('0xd8')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x46f6fd,null))['then'](function(_0x4814bd){if(_0x4814bd&&_0x4814bd[_0xf0fa('0xaa')]){_0x198210=_0x4814bd;var _0x420256=_['defaults'](_0x14f4d7[_0xf0fa('0x64')],{'firstName':_0x14f4d7[_0xf0fa('0x64')]['from'],'phone':_0x14f4d7[_0xf0fa('0x64')]['from'],'ListId':_0x4814bd[_0xf0fa('0xa7')]});_0x420256[_0x14f4d7[_0xf0fa('0x64')][_0xf0fa('0xd6')]]=_0x14f4d7[_0xf0fa('0x64')]['from'];return db['CmContact'][_0xf0fa('0xd9')]({'where':_0x18be1d,'defaults':_0x420256});}})[_0xf0fa('0xda')](function(_0x13e5e2){if(_0x13e5e2){_0x2ecf7d=_0x13e5e2;var _0x424332=fs['readFileSync'](path[_0xf0fa('0x87')](config['root'],_0xf0fa('0xdb')),_0xf0fa('0xdc'));var _0x4238f0=ejs['render'](_0x424332,{'body':_[_0xf0fa('0xdd')](_0x14f4d7[_0xf0fa('0x64')]['body']),'bodyTitle':_0x198210[_0xf0fa('0xde')]});return db['ChatOfflineMessage'][_0xf0fa('0x63')]({'body':_0x4238f0,'plainBody':htmlToText[_0xf0fa('0xdf')](_0x4238f0),'ContactId':_0x13e5e2['id'],'ChatWebsiteId':_0x198210['id']});}})[_0xf0fa('0x1b')](function(_0x5ea55e){_0x4784e7=_0x5ea55e;if(_0x32e7ee[_0xf0fa('0x53')]){var _0xcf0df8=_0x32e7ee[_0xf0fa('0x49')](function(_0x117823){return{'name':_0x117823[_0xf0fa('0xe0')],'basename':_0x117823[_0xf0fa('0x81')],'type':_0x117823[_0xf0fa('0xe1')],'ChatOfflineMessageId':_0x5ea55e['id']};});_0x51ffae=_0xcf0df8[_0xf0fa('0x49')](_0x68a2d3=>{var _0x577ad2={'filename':_0x68a2d3[_0xf0fa('0x32')],'path':path[_0xf0fa('0x87')](config['root'],_0xf0fa('0xe2'),_0xf0fa('0xe3'),_0xf0fa('0xe4'),_0xf0fa('0xe5'),_0x68a2d3[_0xf0fa('0xe6')])};return _0x577ad2;});if(!_0x198210['openNewInteraction']){return db[_0xf0fa('0xe7')]['transaction'](function(_0x47d348){return db[_0xf0fa('0xe8')][_0xf0fa('0xe9')](_0xcf0df8,{'transaction':_0x47d348});});}}})['then'](function(){if(_0x4784e7){_0x58566d=_0x4784e7;return db[_0xf0fa('0xd8')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf0fa('0xea')],'as':_0xf0fa('0xeb'),'raw':!![],'include':[{'model':db[_0xf0fa('0xec')],'as':_0xf0fa('0xec'),'raw':!![]}]}]});}})[_0xf0fa('0x1b')](function(_0x4cdac1){if(_0x4cdac1&&_0x4cdac1[_0xf0fa('0xeb')]&&_0x198210['forwardOffline']&&_0x198210[_0xf0fa('0xed')]){var _0x273837=_0x4cdac1[_0xf0fa('0xee')]();return respondWithRpcPromise('SendMail',_0xf0fa('0xef'),{'account':_0x273837,'message':{'from':util['format'](_0xf0fa('0xf0'),_0x4cdac1[_0xf0fa('0x32')],_0x4cdac1[_0xf0fa('0xf1')]||_0x4cdac1[_0xf0fa('0xeb')]['user']),'to':_0x198210[_0xf0fa('0xed')],'subject':_0x198210['offlineMessageSubject'],'html':_0x58566d[_0xf0fa('0x64')],'attachments':_0x51ffae}},client9003)[_0xf0fa('0x1b')](function(){return _0x58566d;})[_0xf0fa('0x24')](function(_0x2e7035){logger[_0xf0fa('0x20')](_0x2e7035);});}})[_0xf0fa('0x1b')](function(){if(_0x198210&&_0x198210[_0xf0fa('0xf2')]&&_0x198210[_0xf0fa('0xf3')]){var _0x1b42b7=[];if(_0x32e7ee[_0xf0fa('0x53')]){_0x1b42b7=_0x32e7ee['map'](function(_0x5e0d64){return{'name':_0x5e0d64[_0xf0fa('0xe0')],'basename':_0x5e0d64[_0xf0fa('0x81')],'type':_0x5e0d64[_0xf0fa('0xe1')],'ChatOfflineMessageId':_0x4784e7['id']};});}var _0x1b7959;if(!_['isNil'](_0x198210[_0xf0fa('0xf4')])){var _0x19526b=_[_0xf0fa('0x49')](_0x14f4d7['body'],function(_0x1ea16c){return _0x1ea16c;});var _0x16af6e=_['toPairsIn'](_0x19526b)[0x0];var _0x2383ff=_[_0xf0fa('0xf5')](_0x16af6e,function(_0xc659b3){return _0xc659b3;});_0x1b7959=_0x2383ff[0x1][_0x198210[_0xf0fa('0xf4')]];}var _0x327677={'from':_0x2ecf7d[_0xf0fa('0xf1')],'firstName':_0x2ecf7d['firstName'],'lastName':_0x2ecf7d[_0xf0fa('0x3a')],'mapKey':'email','message':{'from':_0x2ecf7d[_0xf0fa('0xf1')],'to':_0x198210[_0xf0fa('0xd8')]['email'],'cc':'','subject':_[_0xf0fa('0x8d')](_0x1b7959)?_0x198210[_0xf0fa('0xf6')]:_0x1b7959,'messageId':'','sentAt':new Date(),'attach':_0x1b42b7[_0xf0fa('0x53')],'attachments':_0x1b42b7,'originChannel':_0xf0fa('0xf7'),'ChatWebsiteId':_0x198210['id'],'ChatOfflineMessageId':_0x58566d['id'],'originTo':_0x198210[_0xf0fa('0xd8')][_0xf0fa('0xf1')]},'body':_0x58566d['body']};var _0x45a8fa={'account':{'id':_0x198210['MailAccountId']},'body':_0x327677,'log':_0xf0fa('0xf8')};return respondWithRpcPromise(_0xf0fa('0xf8'),_0xf0fa('0xf9'),_0x45a8fa,client9001)['then'](function(){return _0x58566d;})['catch'](function(_0x5243f4){logger[_0xf0fa('0x20')](_0x5243f4);});}return;})['then'](function(){if(_0x58566d){return _0x58566d;}})[_0xf0fa('0x1b')](respondWithResult(_0x46f6fd,null))['catch'](function(){for(var _0x3724af of _0x32e7ee){var _0x4bdf4d=path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],'server','files',_0xf0fa('0xe4'),_0xf0fa('0xe5'),_0x3724af['filename']);fs_extra[_0xf0fa('0xfa')](_0x4bdf4d)[_0xf0fa('0x24')](function(_0x1c51ea){logger[_0xf0fa('0x20')](_0xf0fa('0xfb'),_0x4bdf4d,_0x1c51ea);});}});};exports[_0xf0fa('0xfc')]=function(_0x400beb,_0x48f8db){return db[_0xf0fa('0xba')][_0xf0fa('0x62')]({'where':{'id':_0x400beb['params']['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x48f8db,null))[_0xf0fa('0x1b')](function(_0x25d74d){if(_0x25d74d){return _0x25d74d[_0xf0fa('0xfc')](_0x400beb[_0xf0fa('0x64')][_0xf0fa('0x7d')],_[_0xf0fa('0xfd')](_0x400beb[_0xf0fa('0x64')],[_0xf0fa('0x7d'),'id'])||{});}})['then'](respondWithResult(_0x48f8db,null))[_0xf0fa('0x24')](handleError(_0x48f8db,null));};exports['getInteractions']=function(_0x302bfd,_0x12d88f){var _0x48eaa0={'raw':![],'where':{}};var _0x3d2806={};var _0x14afdf={'count':0x0,'rows':[]};return db[_0xf0fa('0x4a')][_0xf0fa('0x76')]({'where':{'id':_0x302bfd[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x12d88f,null))[_0xf0fa('0x1b')](function(_0x5a92e5){if(_0x5a92e5){_0x3d2806[_0xf0fa('0x43')]=_[_0xf0fa('0x4e')](db[_0xf0fa('0xba')]['rawAttributes']);_0x3d2806[_0xf0fa('0x4f')]=_[_0xf0fa('0x4e')](_0x302bfd['query']);_0x3d2806['filters']=_[_0xf0fa('0x52')](_0x3d2806['model'],_0x3d2806[_0xf0fa('0x4f')]);_0x48eaa0[_0xf0fa('0x51')]=_['intersection'](_0x3d2806[_0xf0fa('0x43')],qs[_0xf0fa('0x60')](_0x302bfd['query'][_0xf0fa('0x60')]));_0x48eaa0['attributes']=_0x48eaa0[_0xf0fa('0x51')]['length']?_0x48eaa0[_0xf0fa('0x51')]:_0x3d2806[_0xf0fa('0x43')];if(!_0x302bfd[_0xf0fa('0x4f')]['hasOwnProperty'](_0xf0fa('0x55'))){_0x48eaa0['limit']=qs['limit'](_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x2c')]);_0x48eaa0['offset']=qs[_0xf0fa('0x29')](_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x29')]);}_0x48eaa0[_0xf0fa('0x78')]=qs[_0xf0fa('0x56')](_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x56')]);_0x48eaa0[_0xf0fa('0x57')]=qs[_0xf0fa('0x50')](_[_0xf0fa('0x58')](_0x302bfd[_0xf0fa('0x4f')],_0x3d2806[_0xf0fa('0x50')]));_0x48eaa0[_0xf0fa('0x57')][_0xf0fa('0x74')]=_0x5a92e5['id'];if(_0x302bfd['query']['filter']){_0x48eaa0[_0xf0fa('0x57')]=_[_0xf0fa('0x5a')](_0x48eaa0[_0xf0fa('0x57')],{'$or':_['map'](_0x48eaa0['attributes'],function(_0x144f00){var _0x2c72ad={};_0x2c72ad[_0x144f00]={'$like':'%'+_0x302bfd[_0xf0fa('0x4f')]['filter']+'%'};return _0x2c72ad;})});}_0x48eaa0=_['merge']({},_0x48eaa0,_0x302bfd[_0xf0fa('0x5b')]);return db[_0xf0fa('0xba')][_0xf0fa('0x2b')]({'where':_0x48eaa0['where']})[_0xf0fa('0x1b')](function(_0x4dd350){_0x14afdf[_0xf0fa('0x2b')]=_0x4dd350;if(_0x302bfd['query'][_0xf0fa('0x61')]){_0x48eaa0[_0xf0fa('0x5c')]=[{'model':db['CmContact'],'as':_0xf0fa('0xfe'),'required':![]},{'model':db[_0xf0fa('0xff')],'as':_0xf0fa('0x100'),'attributes':[_0xf0fa('0x32'),'fullname',_0xf0fa('0x101')],'required':![]},{'model':db[_0xf0fa('0x102')],'as':_0xf0fa('0x103'),'attributes':['id',_0xf0fa('0x32'),'color'],'where':_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x104')]?{'id':_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x104')]}:undefined,'required':_0x302bfd[_0xf0fa('0x4f')][_0xf0fa('0x104')]?!![]:![]}];}return db['ChatInteraction'][_0xf0fa('0x79')](_0x48eaa0);})[_0xf0fa('0x1b')](function(_0x31b02c){_0x14afdf[_0xf0fa('0x5d')]=_0x31b02c;return _0x14afdf;});}})[_0xf0fa('0x1b')](respondWithFilteredResult(_0x12d88f,_0x48eaa0))[_0xf0fa('0x24')](handleError(_0x12d88f,null));};exports[_0xf0fa('0x105')]=function(_0x3a771a,_0xb2cec){var _0x2f48e5=0x0;var _0x24a65e=0x0;var _0x4a86b0=![];var _0x10f1e6;var _0x4af21c;return db['ChatWebsite'][_0xf0fa('0x62')]({'where':{'id':_0x3a771a['params']['id']},'include':[{'model':db[_0xf0fa('0x98')],'as':_0xf0fa('0x98'),'include':[{'model':db[_0xf0fa('0x98')],'as':_0xf0fa('0xae'),'attributes':['id',_0xf0fa('0xaf')]}]}]})['then'](handleEntityNotFound(_0xb2cec,null))['then'](function(_0x10182b){if(_0x10182b){_0x10f1e6=_0x10182b;return _0x10182b[_0xf0fa('0x106')]({'raw':!![]});}})['then'](function(_0x29b02a){if(_0x10f1e6){if(_0x29b02a){_0x4af21c=_0x29b02a;}}return require('../../config/license/util')['getLicense']();})[_0xf0fa('0x1b')](function(_0x37e3c9){if(_0x37e3c9){_0x24a65e=_0x37e3c9['virtual'];_0x4a86b0=_0x37e3c9[_0xf0fa('0x8c')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xf0fa('0x1b')](function(_0x454635){_0x2f48e5=_0x454635;if(_0x24a65e&&_0x454635>_0x24a65e){return db[_0xf0fa('0x107')]['findOne']({'where':{'id':0x1}})[_0xf0fa('0x1b')](function(_0x516b94){if(_0x516b94){_0x516b94[_0xf0fa('0x108')](_0xf0fa('0x109'));}});}})[_0xf0fa('0x1b')](function(){var _0x439d09=_0x10f1e6[_0xf0fa('0x98')];var _0x5bc810=_0x10f1e6[_0xf0fa('0x9a')]||undefined;return _0x439d09?_0x439d09[_0xf0fa('0x9b')](_0x5bc810):!![];})[_0xf0fa('0x1b')](function(_0x482924){var _0x1ee758=fs[_0xf0fa('0x10a')](path[_0xf0fa('0x87')](config[_0xf0fa('0x88')],_0xf0fa('0x10b')),_0xf0fa('0xdc'));var _0x3ec6e8='3.13.0';var _0x105c08=![];var _0x347180,_0x3c814b;if(_0x3a771a[_0xf0fa('0xb7')][_0xf0fa('0x3c')]){_0x347180=new URL(_0x3a771a[_0xf0fa('0xb7')][_0xf0fa('0x3c')])[_0xf0fa('0x10c')];}else if(_0x3a771a[_0xf0fa('0xb7')][_0xf0fa('0x10c')]){_0x347180=new URL(_0x3a771a['headers'][_0xf0fa('0x10c')])[_0xf0fa('0x10c')];}else{_0x347180=_0xf0fa('0x10d');}_0x3c814b=typeof _0x10f1e6[_0xf0fa('0x65')][_0xf0fa('0x66')](',')[_0xf0fa('0x62')](function(_0x960a4c){return wildcardUtils[_0xf0fa('0x10e')](_0x960a4c,_0x347180);})!=='undefined';var _0x5db875={'chatVersion':_0x3ec6e8,'chatWebsiteAddressOrigin':_0x3c814b?_0x347180:_0x10f1e6[_0xf0fa('0x65')],'remote':_0x10f1e6['remote'],'query':querystring[_0xf0fa('0x1f')](_[_0xf0fa('0x5a')](_0x10f1e6[_0xf0fa('0x2f')]({'plain':!![]}),{'customerIp':_0x3a771a['headers']['x-forwarded-for']||_0x3a771a[_0xf0fa('0xb7')][_0xf0fa('0x10f')]||_0x3a771a[_0xf0fa('0x110')]['remoteAddress']||_0x3a771a['ip'],'referer':_0x3a771a['headers'][_0xf0fa('0x3c')],'openedInteractions':_0x2f48e5,'maxInteractions':_0x24a65e,'virtual':_0x4a86b0[_0xf0fa('0x111')],'online':_0x482924,'custom':_0x4a86b0,'address':_0x3c814b?_0x347180:null}))[_0xf0fa('0x112')](/'/g,'\x5c\x27')};_0xb2cec[_0xf0fa('0x33')](ejs['render'](Mustache['render'](_0x1ee758,_0x5db875),{'proactiveActions':_0x4af21c,'alignment':_0x10f1e6['alignment'],'verticalAlignment':_0x10f1e6[_0xf0fa('0x113')],'div_color':_0x10f1e6[_0xf0fa('0x114')],'labelText':_0x10f1e6[_0xf0fa('0x115')],'text_color':_0x10f1e6[_0xf0fa('0x116')],'text_button_color':_0x10f1e6[_0xf0fa('0x117')],'button_color':_0x10f1e6[_0xf0fa('0x118')],'background_color':_0x10f1e6['backgroundColor'],'hideWhenOffline':_0x10f1e6[_0xf0fa('0x119')],'intervalId':_0x10f1e6[_0xf0fa('0x11a')],'isDevelopment':_0x105c08,'chatVersion':_0x3ec6e8}));})[_0xf0fa('0x24')](handleError(_0xb2cec,null));};exports[_0xf0fa('0x11b')]=function(_0x34d2f2,_0x3527eb){var _0x5672a5=_0x34d2f2['params']['id'];var _0x52e00b=_0x34d2f2[_0xf0fa('0x64')];var _0x90a29e=0xc8;var _0x257eec=null;return db['sequelize'][_0xf0fa('0x11c')]({'isolationLevel':db[_0xf0fa('0xe7')][_0xf0fa('0x11d')][_0xf0fa('0x11e')][_0xf0fa('0x11f')]},function(_0x4fb8ea){return db[_0xf0fa('0x4a')]['findOne']({'where':{'id':_0x5672a5},'transaction':_0x4fb8ea})[_0xf0fa('0x1b')](function(_0x2706f0){if(_0x2706f0){return db[_0xf0fa('0x120')][_0xf0fa('0x2e')]({'where':{'ChatWebsiteId':_0x5672a5},'transaction':_0x4fb8ea})[_0xf0fa('0x1b')](function(){var _0x46e8e3=_[_0xf0fa('0x49')](_0x52e00b,function(_0x35bce9){_0x35bce9[_0xf0fa('0x74')]=_0x5672a5;return _0x35bce9;});return db[_0xf0fa('0x120')][_0xf0fa('0xe9')](_0x46e8e3,{'transaction':_0x4fb8ea});});}else{_0x90a29e=0x194;_0x257eec=[];}});})['then'](function(){if(_0x90a29e!==0x194){return db[_0xf0fa('0x120')][_0xf0fa('0x121')]({'where':{'ChatWebsiteId':_0x5672a5},'order':_0xf0fa('0xb3')})[_0xf0fa('0x1b')](function(_0x46262c){_0x257eec=_0x46262c;});}})[_0xf0fa('0x24')](function(_0x1e90de){_0x90a29e=0x1f4;logger['error'](_0x1e90de[_0xf0fa('0x122')]);if(_0x1e90de[_0xf0fa('0x32')]){delete _0x1e90de[_0xf0fa('0x32')];}_0x257eec=_0x1e90de;})[_0xf0fa('0x123')](function(){if(_0x257eec===null){_0x3527eb[_0xf0fa('0x25')](_0x90a29e);}else{if(_0x90a29e===0x1f4){_0x3527eb[_0xf0fa('0x26')](_0x90a29e)[_0xf0fa('0x33')](_0x257eec);}else{_0x3527eb[_0xf0fa('0x26')](_0x90a29e)[_0xf0fa('0x28')](_0x257eec);}}});};exports[_0xf0fa('0x124')]=function(_0x4f94d1,_0x9fb94){var _0x23b783={};var _0x48bb9d={};var _0x597ee4;var _0x479d27;return db[_0xf0fa('0x4a')][_0xf0fa('0x76')]({'where':{'id':_0x4f94d1[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x9fb94,null))['then'](function(_0x3f1558){if(_0x3f1558){_0x597ee4=_0x3f1558;_0x48bb9d[_0xf0fa('0x43')]=_[_0xf0fa('0x4e')](db[_0xf0fa('0x120')]['rawAttributes']);_0x48bb9d[_0xf0fa('0x4f')]=_['keys'](_0x4f94d1[_0xf0fa('0x4f')]);_0x48bb9d['filters']=_[_0xf0fa('0x52')](_0x48bb9d[_0xf0fa('0x43')],_0x48bb9d['query']);_0x23b783['attributes']=_['intersection'](_0x48bb9d[_0xf0fa('0x43')],qs['fields'](_0x4f94d1['query'][_0xf0fa('0x60')]));_0x23b783[_0xf0fa('0x51')]=_0x23b783[_0xf0fa('0x51')]['length']?_0x23b783['attributes']:_0x48bb9d[_0xf0fa('0x43')];_0x23b783[_0xf0fa('0x78')]=qs[_0xf0fa('0x56')](_0x4f94d1[_0xf0fa('0x4f')][_0xf0fa('0x56')]);_0x23b783[_0xf0fa('0x57')]=qs['filters'](_[_0xf0fa('0x58')](_0x4f94d1[_0xf0fa('0x4f')],_0x48bb9d[_0xf0fa('0x50')]));if(_0x4f94d1['query']['filter']){_0x23b783[_0xf0fa('0x57')]=_['merge'](_0x23b783[_0xf0fa('0x57')],{'$or':_['map'](_0x23b783['attributes'],function(_0x401c07){var _0x333812={};_0x333812[_0x401c07]={'$like':'%'+_0x4f94d1['query']['filter']+'%'};return _0x333812;})});}_0x23b783=_[_0xf0fa('0x5a')]({},_0x23b783,_0x4f94d1[_0xf0fa('0x5b')]);return _0x597ee4['getApplications'](_0x23b783);}})[_0xf0fa('0x1b')](function(_0x77eb11){if(_0x77eb11){_0x479d27=_0x77eb11[_0xf0fa('0x53')];if(!_0x4f94d1[_0xf0fa('0x4f')][_0xf0fa('0x54')](_0xf0fa('0x55'))){_0x23b783[_0xf0fa('0x2c')]=qs[_0xf0fa('0x2c')](_0x4f94d1['query'][_0xf0fa('0x2c')]);_0x23b783['offset']=qs[_0xf0fa('0x29')](_0x4f94d1[_0xf0fa('0x4f')]['offset']);}return _0x597ee4[_0xf0fa('0x124')](_0x23b783);}})[_0xf0fa('0x1b')](function(_0x400482){if(_0x400482){return _0x400482?{'count':_0x479d27,'rows':_0x400482}:null;}})[_0xf0fa('0x1b')](respondWithResult(_0x9fb94,null))[_0xf0fa('0x24')](handleError(_0x9fb94,null));};exports[_0xf0fa('0x125')]=function(_0x2f1287,_0x289f8e){return db['chatProactiveAction'][_0xf0fa('0x62')]({'where':{'id':_0x2f1287[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x289f8e,null))[_0xf0fa('0x1b')](function(_0x3eaddd){if(_0x3eaddd){return _0x3eaddd['addProactiveActions'](_0x2f1287[_0xf0fa('0x64')][_0xf0fa('0x7d')],_['omit'](_0x2f1287[_0xf0fa('0x64')],[_0xf0fa('0x7d'),'id'])||{});}})[_0xf0fa('0x1b')](respondWithResult(_0x289f8e,null))[_0xf0fa('0x24')](handleError(_0x289f8e,null));};exports[_0xf0fa('0x106')]=function(_0x309c2e,_0x338f3f){var _0x4270f8={};var _0x50afc4={};var _0x7c3c08;var _0xac6798;return db[_0xf0fa('0x4a')][_0xf0fa('0x76')]({'where':{'id':_0x309c2e[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x338f3f,null))[_0xf0fa('0x1b')](function(_0x1935f1){if(_0x1935f1){_0x7c3c08=_0x1935f1;_0x50afc4['model']=_['keys'](db[_0xf0fa('0x126')]['rawAttributes']);_0x50afc4['query']=_[_0xf0fa('0x4e')](_0x309c2e[_0xf0fa('0x4f')]);_0x50afc4['filters']=_[_0xf0fa('0x52')](_0x50afc4[_0xf0fa('0x43')],_0x50afc4['query']);_0x4270f8[_0xf0fa('0x51')]=_[_0xf0fa('0x52')](_0x50afc4[_0xf0fa('0x43')],qs[_0xf0fa('0x60')](_0x309c2e[_0xf0fa('0x4f')]['fields']));_0x4270f8[_0xf0fa('0x51')]=_0x4270f8[_0xf0fa('0x51')][_0xf0fa('0x53')]?_0x4270f8[_0xf0fa('0x51')]:_0x50afc4[_0xf0fa('0x43')];_0x4270f8[_0xf0fa('0x78')]=qs[_0xf0fa('0x56')](_0x309c2e[_0xf0fa('0x4f')][_0xf0fa('0x56')]);_0x4270f8['where']=qs['filters'](_[_0xf0fa('0x58')](_0x309c2e[_0xf0fa('0x4f')],_0x50afc4[_0xf0fa('0x50')]));if(_0x309c2e[_0xf0fa('0x4f')][_0xf0fa('0x59')]){_0x4270f8[_0xf0fa('0x57')]=_['merge'](_0x4270f8['where'],{'$or':_['map'](_0x4270f8[_0xf0fa('0x51')],function(_0x4d3309){var _0x4cd024={};_0x4cd024[_0x4d3309]={'$like':'%'+_0x309c2e[_0xf0fa('0x4f')]['filter']+'%'};return _0x4cd024;})});}_0x4270f8=_['merge']({},_0x4270f8,_0x309c2e[_0xf0fa('0x5b')]);return _0x7c3c08[_0xf0fa('0x106')](_0x4270f8);}})[_0xf0fa('0x1b')](function(_0x4b385b){if(_0x4b385b){_0xac6798=_0x4b385b[_0xf0fa('0x53')];if(!_0x309c2e['query'][_0xf0fa('0x54')](_0xf0fa('0x55'))){_0x4270f8['limit']=qs['limit'](_0x309c2e[_0xf0fa('0x4f')][_0xf0fa('0x2c')]);_0x4270f8[_0xf0fa('0x29')]=qs[_0xf0fa('0x29')](_0x309c2e[_0xf0fa('0x4f')][_0xf0fa('0x29')]);}return _0x7c3c08[_0xf0fa('0x106')](_0x4270f8);}})[_0xf0fa('0x1b')](function(_0x500e27){if(_0x500e27){return _0x500e27?{'count':_0xac6798,'rows':_0x500e27}:null;}})['then'](respondWithResult(_0x338f3f,null))[_0xf0fa('0x24')](handleError(_0x338f3f,null));};exports[_0xf0fa('0x127')]=function(_0x593571,_0x4dbd0b){var _0x170c1e=_0x593571[_0xf0fa('0x4f')][_0xf0fa('0x128')]===_0xf0fa('0x129')?_0xf0fa('0x12a'):_0xf0fa('0x12b');return db[_0xf0fa('0x4a')]['find']({'attributes':['id',_0x170c1e],'where':{'id':_0x593571[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x4dbd0b,null))[_0xf0fa('0x1b')](function(_0x1eb934){if(_0x1eb934){var _0x19a5a6=_0x1eb934[_0x170c1e];var _0xc70a96=_0x19a5a6&&_0x19a5a6['items']?_0x19a5a6['items']:[];_0x4dbd0b['send']({'fromKey':_[_0xf0fa('0x8d')](_0x19a5a6[_0xf0fa('0x12c')])?undefined:_0x19a5a6[_0xf0fa('0x12c')],'count':_0xc70a96[_0xf0fa('0x53')],'rows':_0xc70a96});}})[_0xf0fa('0x24')](handleError(_0x4dbd0b,null));};exports[_0xf0fa('0x12d')]=function(_0x76f5e1,_0x2e15e1){var _0xf491a2={'raw':![],'where':{}};var _0x4c62fd={};var _0x551134={'count':0x0,'rows':[]};return db[_0xf0fa('0x4a')][_0xf0fa('0x76')]({'where':{'id':_0x76f5e1[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x2e15e1,null))[_0xf0fa('0x1b')](function(_0x122141){if(_0x122141){_0x4c62fd[_0xf0fa('0x43')]=_[_0xf0fa('0x4e')](db[_0xf0fa('0x12e')][_0xf0fa('0x4b')]);_0x4c62fd['query']=_[_0xf0fa('0x4e')](_0x76f5e1[_0xf0fa('0x4f')]);_0x4c62fd[_0xf0fa('0x50')]=_[_0xf0fa('0x52')](_0x4c62fd[_0xf0fa('0x43')],_0x4c62fd['query']);_0xf491a2[_0xf0fa('0x51')]=_[_0xf0fa('0x52')](_0x4c62fd[_0xf0fa('0x43')],qs['fields'](_0x76f5e1[_0xf0fa('0x4f')][_0xf0fa('0x60')]));_0xf491a2[_0xf0fa('0x51')]=_0xf491a2['attributes']['length']?_0xf491a2[_0xf0fa('0x51')]:_0x4c62fd[_0xf0fa('0x43')];if(!_0x76f5e1[_0xf0fa('0x4f')]['hasOwnProperty'](_0xf0fa('0x55'))){_0xf491a2['limit']=qs[_0xf0fa('0x2c')](_0x76f5e1['query'][_0xf0fa('0x2c')]);_0xf491a2[_0xf0fa('0x29')]=qs[_0xf0fa('0x29')](_0x76f5e1[_0xf0fa('0x4f')]['offset']);}_0xf491a2[_0xf0fa('0x78')]=qs['sort'](_0x76f5e1[_0xf0fa('0x4f')][_0xf0fa('0x56')]);_0xf491a2[_0xf0fa('0x57')]=qs['filters'](_[_0xf0fa('0x58')](_0x76f5e1[_0xf0fa('0x4f')],_0x4c62fd['filters']));_0xf491a2[_0xf0fa('0x57')][_0xf0fa('0x74')]=_0x122141['id'];if(_0x76f5e1[_0xf0fa('0x4f')][_0xf0fa('0x59')]){_0xf491a2[_0xf0fa('0x57')]=_[_0xf0fa('0x5a')](_0xf491a2[_0xf0fa('0x57')],{'$or':_['map'](_0xf491a2['attributes'],function(_0x1308e0){var _0xd84d9f={};_0xd84d9f[_0x1308e0]={'$like':'%'+_0x76f5e1['query'][_0xf0fa('0x59')]+'%'};return _0xd84d9f;})});}_0xf491a2=_[_0xf0fa('0x5a')]({},_0xf491a2,_0x76f5e1[_0xf0fa('0x5b')]);return db[_0xf0fa('0x12e')]['count']({'where':_0xf491a2[_0xf0fa('0x57')]})['then'](function(_0x34b8bf){_0x551134['count']=_0x34b8bf;if(_0x76f5e1[_0xf0fa('0x4f')][_0xf0fa('0x61')]){_0xf491a2[_0xf0fa('0x5c')]=[{'all':!![]}];}else{_0xf491a2['include']=[{'model':db[_0xf0fa('0xa1')],'as':'Contact','required':![]},{'model':db[_0xf0fa('0xe8')],'as':_0xf0fa('0x12f'),'required':![]}];}return db[_0xf0fa('0x12e')][_0xf0fa('0x79')](_0xf491a2);})[_0xf0fa('0x1b')](function(_0x1791fa){_0x551134[_0xf0fa('0x5d')]=_0x1791fa;return _0x551134;});}})[_0xf0fa('0x1b')](respondWithFilteredResult(_0x2e15e1,_0xf491a2))['catch'](handleError(_0x2e15e1,null));};exports[_0xf0fa('0x130')]=function(_0x3e3672,_0x2ba0b7){return db[_0xf0fa('0x4a')][_0xf0fa('0x62')]({'where':{'id':_0x3e3672['params']['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x2ba0b7,null))[_0xf0fa('0x1b')](function(_0x44e7f6){if(_0x44e7f6){return _0x44e7f6[_0xf0fa('0x130')](_0x3e3672['body']['ids'],_[_0xf0fa('0xfd')](_0x3e3672[_0xf0fa('0x64')],[_0xf0fa('0x7d'),'id'])||{})['spread'](function(_0x1c11d8){for(var _0x57878a=0x0;_0x57878a<_0x3e3672['body'][_0xf0fa('0x7d')][_0xf0fa('0x53')];_0x57878a+=0x1){socket[_0xf0fa('0x131')](_0xf0fa('0x132'),{'UserId':Number(_0x3e3672[_0xf0fa('0x64')][_0xf0fa('0x7d')][_0x57878a]),'ChatWebsiteId':Number(_0x3e3672[_0xf0fa('0x72')]['id'])});}return _0x1c11d8;});}})[_0xf0fa('0x1b')](respondWithResult(_0x2ba0b7,null))[_0xf0fa('0x24')](handleError(_0x2ba0b7,null));};exports[_0xf0fa('0x133')]=function(_0x3d47dd,_0x2cdf61){return db['ChatWebsite'][_0xf0fa('0x62')]({'where':{'id':_0x3d47dd[_0xf0fa('0x72')]['id']}})[_0xf0fa('0x1b')](handleEntityNotFound(_0x2cdf61,null))['then'](function(_0x160498){if(_0x160498){return _0x160498[_0xf0fa('0x133')](_0x3d47dd[_0xf0fa('0x4f')]['ids'])['then'](function(){if(_[_0xf0fa('0x134')](_0x3d47dd['query']['ids'])){for(var _0x14b1a8=0x0;_0x14b1a8<_0x3d47dd[_0xf0fa('0x4f')][_0xf0fa('0x7d')]['length'];_0x14b1a8+=0x1){socket[_0xf0fa('0x131')]('userChatWebsite:remove',{'UserId':Number(_0x3d47dd[_0xf0fa('0x4f')][_0xf0fa('0x7d')][_0x14b1a8]),'ChatWebsiteId':Number(_0x3d47dd[_0xf0fa('0x72')]['id'])});}}else{socket['emit'](_0xf0fa('0x135'),{'UserId':Number(_0x3d47dd[_0xf0fa('0x4f')]['ids']),'ChatWebsiteId':Number(_0x3d47dd[_0xf0fa('0x72')]['id'])});}});}})[_0xf0fa('0x1b')](respondWithStatusCode(_0x2cdf61,null))[_0xf0fa('0x24')](handleError(_0x2cdf61,null));};exports[_0xf0fa('0x136')]=function(_0x3bccb1,_0x5ba9b0){var _0x6ae366={};var _0x4e7525={};var _0x37c4f0;var _0x274673;return db[_0xf0fa('0x4a')][_0xf0fa('0x76')]({'where':{'id':_0x3bccb1[_0xf0fa('0x72')]['id']}})['then'](handleEntityNotFound(_0x5ba9b0,null))['then'](function(_0x466e06){if(_0x466e06){_0x37c4f0=_0x466e06;_0x4e7525['model']=_['keys'](db[_0xf0fa('0xff')][_0xf0fa('0x4b')]);_0x4e7525['query']=_['keys'](_0x3bccb1[_0xf0fa('0x4f')]);_0x4e7525[_0xf0fa('0x50')]=_['intersection'](_0x4e7525[_0xf0fa('0x43')],_0x4e7525['query']);_0x6ae366[_0xf0fa('0x51')]=_['intersection'](_0x4e7525['model'],qs[_0xf0fa('0x60')](_0x3bccb1[_0xf0fa('0x4f')][_0xf0fa('0x60')]));_0x6ae366[_0xf0fa('0x51')]=_0x6ae366[_0xf0fa('0x51')][_0xf0fa('0x53')]?_0x6ae366[_0xf0fa('0x51')]:_0x4e7525[_0xf0fa('0x43')];_0x6ae366['order']=qs[_0xf0fa('0x56')](_0x3bccb1['query'][_0xf0fa('0x56')]);_0x6ae366[_0xf0fa('0x57')]=qs[_0xf0fa('0x50')](_['pick'](_0x3bccb1['query'],_0x4e7525[_0xf0fa('0x50')]));if(_0x3bccb1[_0xf0fa('0x4f')]['filter']){_0x6ae366[_0xf0fa('0x57')]=_[_0xf0fa('0x5a')](_0x6ae366['where'],{'$or':_[_0xf0fa('0x49')](_0x6ae366[_0xf0fa('0x51')],function(_0x1ea500){var _0x1a0665={};_0x1a0665[_0x1ea500]={'$like':'%'+_0x3bccb1[_0xf0fa('0x4f')][_0xf0fa('0x59')]+'%'};return _0x1a0665;})});}_0x6ae366=_[_0xf0fa('0x5a')]({},_0x6ae366,_0x3bccb1['options']);return _0x37c4f0[_0xf0fa('0x136')](_0x6ae366);}})['then'](function(_0x4cae54){if(_0x4cae54){_0x274673=_0x4cae54[_0xf0fa('0x53')];if(!_0x3bccb1[_0xf0fa('0x4f')]['hasOwnProperty'](_0xf0fa('0x55'))){_0x6ae366['limit']=qs[_0xf0fa('0x2c')](_0x3bccb1[_0xf0fa('0x4f')][_0xf0fa('0x2c')]);_0x6ae366[_0xf0fa('0x29')]=qs[_0xf0fa('0x29')](_0x3bccb1[_0xf0fa('0x4f')][_0xf0fa('0x29')]);}return _0x37c4f0[_0xf0fa('0x136')](_0x6ae366);}})['then'](function(_0x112af9){if(_0x112af9){return _0x112af9?{'count':_0x274673,'rows':_0x112af9}:null;}})['then'](respondWithResult(_0x5ba9b0,null))['catch'](handleError(_0x5ba9b0,null));}; \ No newline at end of file +var _0x5ad3=['chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','Applications','priority','asc','account','list','Contacts','defaults','contact','headers','threadId','ChatInteraction','referer','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','firstName','messageId','update','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','Start','startRouting','EventManager','notify','offline','files','CmContact','Sequelize','ValidationError','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getLicense','virtual','License','increment','chatLicenseExceeded','readFileSync','3.13.0','origin','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','localhost','./chatWebsite.socket','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','destroy','get','ChatWebsites','UserProfileResource','stack','send','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','name','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','ChatWebsite','count','includeAll','findAll','catch','params','include','create','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','findOne','Disposition','hasOwnProperty','rows','removeDispositions','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','timezone','ifTime'];(function(_0x319d30,_0x169ec5){var _0x2d2197=function(_0x5aa0f6){while(--_0x5aa0f6){_0x319d30['push'](_0x319d30['shift']());}};_0x2d2197(++_0x169ec5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x33f34e,_0x4fde5b){_0x33f34e=_0x33f34e-0x0;var _0x58dc01=_0x5ad3[_0x33f34e];return _0x58dc01;};'use strict';var Mustache=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var ejs=require(_0x35ad('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35ad('0x4'));var querystring=require(_0x35ad('0x5'));var htmlToText=require(_0x35ad('0x6'));var Redis=require(_0x35ad('0x7'));var jayson=require(_0x35ad('0x8'));var qs=require(_0x35ad('0x9'));var logger=require(_0x35ad('0xa'))(_0x35ad('0xb'));var config=require(_0x35ad('0xc'));var APIBadRequestError=require(_0x35ad('0xd'))['APIBadRequestError'];var APINotFoundError=require(_0x35ad('0xd'))[_0x35ad('0xe')];var APIOutOfIntervalError=require(_0x35ad('0xd'))['APIOutOfIntervalError'];var APIHandleError=require(_0x35ad('0xd'))['handleError'];var APIConflictError=require('../../errors/api')[_0x35ad('0xf')];var wildcardUtils=require(_0x35ad('0x10'));var URL=require('url')[_0x35ad('0x11')];var db=require(_0x35ad('0x12'))['db'];config['redis']=_['defaults'](config[_0x35ad('0x13')],{'host':_0x35ad('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35ad('0x13')]));require(_0x35ad('0x15'))['register'](socket);var client=jayson['client'][_0x35ad('0x16')]({'port':0x232c});var client9002=jayson[_0x35ad('0x17')][_0x35ad('0x16')]({'port':0x232a});var client9003=jayson['client'][_0x35ad('0x16')]({'port':0x232b});var client9001=jayson[_0x35ad('0x17')]['http']({'port':0x2329});function respondWithRpcPromise(_0x1494be,_0x4d5185,_0x4e3cd8,_0x3a981a){return new Promise(function(_0x3ff2f0,_0x27efeb){var _0x56cb8e=_0x3a981a||client;return _0x56cb8e[_0x35ad('0x18')](_0x1494be,_0x4e3cd8)[_0x35ad('0x19')](function(_0x233394){logger[_0x35ad('0x1a')](_0x35ad('0x1b'),_0x4d5185,_0x35ad('0x1c'));logger['debug'](_0x35ad('0x1d'),_0x4d5185,_0x35ad('0x1c'),JSON['stringify'](_0x233394));if(_0x233394['error']){if(_0x233394[_0x35ad('0x1e')][_0x35ad('0x1f')]===0x1f4){logger['error'](_0x35ad('0x1b'),_0x4d5185,_0x233394[_0x35ad('0x1e')]['message']);return _0x27efeb(_0x233394[_0x35ad('0x1e')][_0x35ad('0x20')]);}logger[_0x35ad('0x1e')](_0x35ad('0x1b'),_0x4d5185,_0x233394[_0x35ad('0x1e')][_0x35ad('0x20')]);return _0x3ff2f0(_0x233394[_0x35ad('0x1e')][_0x35ad('0x20')]);}else{logger[_0x35ad('0x1a')](_0x35ad('0x1b'),_0x4d5185,'request\x20sent');_0x3ff2f0(_0x233394[_0x35ad('0x21')][_0x35ad('0x20')]);}})['catch'](function(_0x43059e){logger[_0x35ad('0x1e')](_0x35ad('0x1b'),_0x4d5185,_0x43059e);_0x27efeb(_0x43059e);});});}function respondWithStatusCode(_0xfc80ac,_0x368468){_0x368468=_0x368468||0xcc;return function(_0x561cae){if(_0x561cae){return _0xfc80ac[_0x35ad('0x22')](_0x368468);}return _0xfc80ac[_0x35ad('0x23')](_0x368468)[_0x35ad('0x24')]();};}function respondWithResult(_0x1ca61d,_0x2ddb59){_0x2ddb59=_0x2ddb59||0xc8;return function(_0x20a682){if(_0x20a682){return _0x1ca61d[_0x35ad('0x23')](_0x2ddb59)[_0x35ad('0x25')](_0x20a682);}};}function respondWithFilteredResult(_0x5418c2,_0x2e7ddd){return function(_0x11da54){if(_0x11da54){var _0x2f8b3=typeof _0x2e7ddd[_0x35ad('0x26')]===_0x35ad('0x27')&&typeof _0x2e7ddd['limit']==='undefined';var _0x131d65=_0x11da54['count'];var _0x235e5e=_0x2f8b3?0x0:_0x2e7ddd['offset'];var _0x53603f=_0x2f8b3?_0x11da54['count']:_0x2e7ddd['offset']+_0x2e7ddd[_0x35ad('0x28')];var _0x5a60e1;if(_0x53603f>=_0x131d65){_0x53603f=_0x131d65;_0x5a60e1=0xc8;}else{_0x5a60e1=0xce;}_0x5418c2['status'](_0x5a60e1);return _0x5418c2[_0x35ad('0x29')]('Content-Range',_0x235e5e+'-'+_0x53603f+'/'+_0x131d65)[_0x35ad('0x25')](_0x11da54);}return null;};}function saveUpdates(_0x51cf37){return function(_0x4005ad){if(_0x4005ad){return _0x4005ad['update'](_0x51cf37)[_0x35ad('0x19')](function(_0x4a75ee){return _0x4a75ee;});}return null;};}function removeEntity(_0x13f8f4){return function(_0x2766dd){if(_0x2766dd){return _0x2766dd[_0x35ad('0x2a')]()['then'](function(){var _0x2852e2=_0x2766dd[_0x35ad('0x2b')]({'plain':!![]});var _0x129710=_0x35ad('0x2c');return db[_0x35ad('0x2d')]['destroy']({'where':{'type':_0x129710,'resourceId':_0x2852e2['id']}})['then'](function(){return _0x2766dd;});})[_0x35ad('0x19')](function(){_0x13f8f4[_0x35ad('0x23')](0xcc)[_0x35ad('0x24')]();});}};}function handleEntityNotFound(_0x1c8a3d){return function(_0x55e676){if(!_0x55e676){_0x1c8a3d[_0x35ad('0x22')](0x194);}return _0x55e676;};}function handleError(_0x15b057,_0x30a247){_0x30a247=_0x30a247||0x1f4;return function(_0x1eb043){logger[_0x35ad('0x1e')](_0x1eb043[_0x35ad('0x2e')]);if(_0x1eb043['name']){delete _0x1eb043['name'];}_0x15b057[_0x35ad('0x23')](_0x30a247)[_0x35ad('0x2f')](_0x1eb043);};}function createInteractionObject(_0x1d24bb,_0x448abf,_0x3c9f2e,_0x240722){var _0x11e7e2=require(_0x35ad('0x30'));var _0x4625dd=new _0x11e7e2();var _0x549231=_0x4625dd[_0x35ad('0x31')](_0x3c9f2e['user-agent'])[_0x35ad('0x32')]();var _0x18e3a5=_0x448abf[_0x35ad('0x33')];if(_0x3c9f2e[_0x35ad('0x34')]){_0x18e3a5=_0x3c9f2e[_0x35ad('0x34')];}else if(_0x3c9f2e[_0x35ad('0x35')]){_0x18e3a5=_[_0x35ad('0x36')](_0x3c9f2e[_0x35ad('0x35')][_0x35ad('0x37')](','));}return{'ContactId':_0x240722['id'],'ChatWebsiteId':_0x1d24bb,'from':(_0x240722['firstName']||'')+'\x20'+(_0x240722[_0x35ad('0x38')]||''),'customerIp':_0x18e3a5,'customerPort':_0x3c9f2e[_0x35ad('0x39')]?_0x3c9f2e[_0x35ad('0x39')]:null,'referer':_0x448abf['referer'],'browserName':_0x549231[_0x35ad('0x3a')][_0x35ad('0x3b')]&&_0x549231[_0x35ad('0x3a')][_0x35ad('0x3c')]?util[_0x35ad('0x3d')](_0x35ad('0x3e'),_0x549231[_0x35ad('0x3a')][_0x35ad('0x3b')],_0x549231[_0x35ad('0x3a')][_0x35ad('0x3c')]):_0x35ad('0x3f'),'browserVersion':_0x549231['browser'][_0x35ad('0x3c')]||'unknown','osName':util[_0x35ad('0x3d')](_0x35ad('0x3e'),_0x549231['os'][_0x35ad('0x3b')],_0x549231['os'][_0x35ad('0x3c')]),'osVersion':_0x549231['os'][_0x35ad('0x3c')],'deviceModel':_0x549231[_0x35ad('0x40')][_0x35ad('0x41')]&&_0x549231[_0x35ad('0x40')][_0x35ad('0x42')]?util['format'](_0x35ad('0x43'),_0x549231[_0x35ad('0x40')][_0x35ad('0x41')],_0x549231[_0x35ad('0x40')][_0x35ad('0x42')],_0x549231['device'][_0x35ad('0x44')]):null,'deviceVendor':_0x549231[_0x35ad('0x40')]['vendor'],'deviceType':_0x549231['device'][_0x35ad('0x44')],'formData':JSON[_0x35ad('0x45')](_0x448abf)};}exports[_0x35ad('0x46')]=function(_0x3e4093,_0x57a5f5){var _0x19c5f1={'include':[{'model':db[_0x35ad('0x47')],'as':_0x35ad('0x48')}]},_0x1e3794={},_0x3c148a={'count':0x0,'rows':[]};var _0x2cbbdc=_[_0x35ad('0x49')](db['ChatWebsite'][_0x35ad('0x4a')],function(_0x39f7b1){return{'name':_0x39f7b1[_0x35ad('0x4b')],'type':_0x39f7b1['type']['key']};});_0x1e3794['model']=_[_0x35ad('0x49')](_0x2cbbdc,_0x35ad('0x3b'));_0x1e3794[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x3e4093['query']);_0x1e3794[_0x35ad('0x4e')]=_[_0x35ad('0x4f')](_0x1e3794[_0x35ad('0x41')],_0x1e3794[_0x35ad('0x4c')]);_0x19c5f1[_0x35ad('0x50')]=_[_0x35ad('0x4f')](_0x1e3794['model'],qs['fields'](_0x3e4093[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x19c5f1['attributes']=_0x19c5f1['attributes'][_0x35ad('0x52')]?_0x19c5f1[_0x35ad('0x50')]:_0x1e3794[_0x35ad('0x41')];if(!_0x3e4093['query']['hasOwnProperty'](_0x35ad('0x53'))){_0x19c5f1[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x3e4093['query'][_0x35ad('0x28')]);_0x19c5f1[_0x35ad('0x26')]=qs[_0x35ad('0x26')](_0x3e4093[_0x35ad('0x4c')][_0x35ad('0x26')]);}_0x19c5f1[_0x35ad('0x54')]=qs['sort'](_0x3e4093[_0x35ad('0x4c')][_0x35ad('0x55')]);_0x19c5f1[_0x35ad('0x56')]=qs['filters'](_[_0x35ad('0x57')](_0x3e4093[_0x35ad('0x4c')],_0x1e3794[_0x35ad('0x4e')]),_0x2cbbdc);if(_0x3e4093[_0x35ad('0x4c')]['filter']){_0x19c5f1['where']=_[_0x35ad('0x58')](_0x19c5f1[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0x2cbbdc,function(_0xddf762){if(_0xddf762[_0x35ad('0x44')]!=='VIRTUAL'){var _0x25d816={};_0x25d816[_0xddf762[_0x35ad('0x3b')]]={'$like':'%'+_0x3e4093[_0x35ad('0x4c')][_0x35ad('0x59')]+'%'};return _0x25d816;}})});}_0x19c5f1=_[_0x35ad('0x58')]({},_0x19c5f1,_0x3e4093[_0x35ad('0x5a')]);var _0x58da31={'where':_0x19c5f1['where']};return db[_0x35ad('0x5b')][_0x35ad('0x5c')](_0x58da31)[_0x35ad('0x19')](function(_0x30ebff){_0x3c148a[_0x35ad('0x5c')]=_0x30ebff;if(_0x3e4093[_0x35ad('0x4c')][_0x35ad('0x5d')]){_0x19c5f1['include']=[{'all':!![]}];}return db[_0x35ad('0x5b')][_0x35ad('0x5e')](_0x19c5f1);})[_0x35ad('0x19')](function(_0x2ee8f1){_0x3c148a['rows']=_0x2ee8f1;return _0x3c148a;})[_0x35ad('0x19')](respondWithFilteredResult(_0x57a5f5,_0x19c5f1))[_0x35ad('0x5f')](handleError(_0x57a5f5,null));};exports['show']=function(_0x1d66c6,_0x1aed75){var _0x1da9ca={'raw':![],'where':{'id':_0x1d66c6[_0x35ad('0x60')]['id']},'include':[{'model':db[_0x35ad('0x47')],'as':_0x35ad('0x48')}]},_0x3f9607={};_0x3f9607[_0x35ad('0x41')]=_['keys'](db[_0x35ad('0x5b')][_0x35ad('0x4a')]);_0x3f9607[_0x35ad('0x4c')]=_['keys'](_0x1d66c6[_0x35ad('0x4c')]);_0x3f9607['filters']=_[_0x35ad('0x4f')](_0x3f9607[_0x35ad('0x41')],_0x3f9607[_0x35ad('0x4c')]);_0x1da9ca[_0x35ad('0x50')]=_['intersection'](_0x3f9607[_0x35ad('0x41')],qs[_0x35ad('0x51')](_0x1d66c6[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x1da9ca[_0x35ad('0x50')]=_0x1da9ca['attributes'][_0x35ad('0x52')]?_0x1da9ca['attributes']:_0x3f9607[_0x35ad('0x41')];if(_0x1d66c6[_0x35ad('0x4c')]['includeAll']){_0x1da9ca[_0x35ad('0x61')]=[{'all':!![]}];}_0x1da9ca=_['merge']({},_0x1da9ca,_0x1d66c6[_0x35ad('0x5a')]);return db[_0x35ad('0x5b')]['find'](_0x1da9ca)[_0x35ad('0x19')](handleEntityNotFound(_0x1aed75,null))[_0x35ad('0x19')](respondWithResult(_0x1aed75,null))[_0x35ad('0x5f')](handleError(_0x1aed75,null));};exports[_0x35ad('0x62')]=function(_0x38d087,_0xa6d541){var _0x1ada40=null;_0x38d087['body'][_0x35ad('0x63')][_0x35ad('0x37')](',')[_0x35ad('0x64')](_0x3c7b45=>{if(_0x3c7b45[_0x35ad('0x65')]()!==''&&!wildcardUtils[_0x35ad('0x66')](_0x3c7b45[_0x35ad('0x65')]())){_0x1ada40=new APIBadRequestError('\x22'+_0x3c7b45['trim']()+_0x35ad('0x67'));}});if(_0x1ada40){return handleError(_0xa6d541,null)(_0x1ada40);}return db[_0x35ad('0x5b')][_0x35ad('0x62')](_0x38d087[_0x35ad('0x68')],{})[_0x35ad('0x19')](function(_0x49a255){var _0xf36ac7=_0x38d087[_0x35ad('0x69')]['get']({'plain':!![]});if(!_0xf36ac7)throw new Error(_0x35ad('0x6a'));if(_0xf36ac7[_0x35ad('0x6b')]===_0x35ad('0x69')){var _0x286543=_0x49a255['get']({'plain':!![]});var _0x351f14='ChatWebsites';return db[_0x35ad('0x6c')][_0x35ad('0x6d')]({'where':{'name':_0x351f14,'userProfileId':_0xf36ac7[_0x35ad('0x6e')]},'raw':!![]})['then'](function(_0x395370){if(_0x395370&&_0x395370['autoAssociation']===0x0){return db[_0x35ad('0x2d')]['create']({'name':_0x286543['name'],'resourceId':_0x286543['id'],'type':_0x395370[_0x35ad('0x3b')],'sectionId':_0x395370['id']},{})[_0x35ad('0x19')](function(){return _0x49a255;});}else{return _0x49a255;}})['catch'](function(_0x29337b){logger[_0x35ad('0x1e')](_0x35ad('0x6f'),_0x29337b);throw _0x29337b;});}return _0x49a255;})['then'](respondWithResult(_0xa6d541,0xc9))['catch'](handleError(_0xa6d541,null));};exports['update']=function(_0x54a89a,_0x3f98a2){var _0x1a9fbf=null;_0x54a89a[_0x35ad('0x68')][_0x35ad('0x63')][_0x35ad('0x37')](',')[_0x35ad('0x64')](_0x4b6f5b=>{if(_0x4b6f5b[_0x35ad('0x65')]()!==''&&!wildcardUtils[_0x35ad('0x66')](_0x4b6f5b['trim']())){_0x1a9fbf=new APIBadRequestError('\x22'+_0x4b6f5b[_0x35ad('0x65')]()+_0x35ad('0x67'));}});if(_0x1a9fbf){return handleError(_0x3f98a2,null)(_0x1a9fbf);}if(_0x54a89a['body']['id']){delete _0x54a89a[_0x35ad('0x68')]['id'];}return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x54a89a[_0x35ad('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x35ad('0x48')}]})[_0x35ad('0x19')](handleEntityNotFound(_0x3f98a2,null))[_0x35ad('0x19')](saveUpdates(_0x54a89a[_0x35ad('0x68')],null))[_0x35ad('0x19')](respondWithResult(_0x3f98a2,null))[_0x35ad('0x5f')](handleError(_0x3f98a2,null));};exports[_0x35ad('0x2a')]=function(_0x3dc5e5,_0xd021df){return db[_0x35ad('0x5b')]['find']({'where':{'id':_0x3dc5e5['params']['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0xd021df,null))[_0x35ad('0x19')](removeEntity(_0xd021df,null))['catch'](handleError(_0xd021df,null));};exports[_0x35ad('0x70')]=function(_0x1d4bdb,_0x112b37){return db[_0x35ad('0x5b')][_0x35ad('0x70')]()[_0x35ad('0x19')](respondWithResult(_0x112b37,null))['catch'](handleError(_0x112b37,null));};exports[_0x35ad('0x71')]=function(_0x260a38,_0x3e881b){if(_0x260a38[_0x35ad('0x68')]['id']){delete _0x260a38[_0x35ad('0x68')]['id'];}return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x260a38[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e881b,null))[_0x35ad('0x19')](function(_0x3530eb){if(_0x3530eb){_0x260a38[_0x35ad('0x68')][_0x35ad('0x72')]=_0x3530eb['id'];return db['Disposition'][_0x35ad('0x62')](_0x260a38['body']);}})[_0x35ad('0x19')](respondWithResult(_0x3e881b,null))['catch'](handleError(_0x3e881b,null));};exports['getDispositions']=function(_0x7b2480,_0x308daf){var _0x1c7558={'raw':![],'where':{}};var _0x5522d8={};var _0x3106bf={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x35ad('0x73')]({'where':{'id':_0x7b2480[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x308daf,null))[_0x35ad('0x19')](function(_0x4c6eca){if(_0x4c6eca){_0x5522d8[_0x35ad('0x41')]=_['keys'](db[_0x35ad('0x74')]['rawAttributes']);_0x5522d8[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x7b2480['query']);_0x5522d8['filters']=_['intersection'](_0x5522d8[_0x35ad('0x41')],_0x5522d8[_0x35ad('0x4c')]);_0x1c7558[_0x35ad('0x50')]=_[_0x35ad('0x4f')](_0x5522d8[_0x35ad('0x41')],qs['fields'](_0x7b2480['query'][_0x35ad('0x51')]));_0x1c7558['attributes']=_0x1c7558[_0x35ad('0x50')]['length']?_0x1c7558[_0x35ad('0x50')]:_0x5522d8[_0x35ad('0x41')];if(!_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x75')]('nolimit')){_0x1c7558[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x28')]);_0x1c7558[_0x35ad('0x26')]=qs[_0x35ad('0x26')](_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x26')]);}_0x1c7558['order']=qs[_0x35ad('0x55')](_0x7b2480[_0x35ad('0x4c')]['sort']);_0x1c7558['where']=qs['filters'](_[_0x35ad('0x57')](_0x7b2480[_0x35ad('0x4c')],_0x5522d8[_0x35ad('0x4e')]));_0x1c7558[_0x35ad('0x56')]['ChatWebsiteId']=_0x4c6eca['id'];if(_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x59')]){_0x1c7558[_0x35ad('0x56')]=_[_0x35ad('0x58')](_0x1c7558[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0x1c7558[_0x35ad('0x50')],function(_0x45e2df){var _0x35b822={};_0x35b822[_0x45e2df]={'$like':'%'+_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x59')]+'%'};return _0x35b822;})});}_0x1c7558=_['merge']({},_0x1c7558,_0x7b2480[_0x35ad('0x5a')]);return db[_0x35ad('0x74')][_0x35ad('0x5c')]({'where':_0x1c7558[_0x35ad('0x56')]})[_0x35ad('0x19')](function(_0x48fdf4){_0x3106bf['count']=_0x48fdf4;if(_0x7b2480[_0x35ad('0x4c')][_0x35ad('0x5d')]){_0x1c7558[_0x35ad('0x61')]=[{'all':!![]}];}return db[_0x35ad('0x74')][_0x35ad('0x5e')](_0x1c7558);})[_0x35ad('0x19')](function(_0x3c7bd8){_0x3106bf[_0x35ad('0x76')]=_0x3c7bd8;return _0x3106bf;});}})[_0x35ad('0x19')](respondWithFilteredResult(_0x308daf,_0x1c7558))[_0x35ad('0x5f')](handleError(_0x308daf,null));};exports['removeDispositions']=function(_0x27ec92,_0x52c150){return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x27ec92[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x52c150,null))[_0x35ad('0x19')](function(_0x1540fa){if(_0x1540fa){return _0x1540fa[_0x35ad('0x77')](_0x27ec92[_0x35ad('0x4c')]['ids']);}})[_0x35ad('0x19')](respondWithStatusCode(_0x52c150,null))[_0x35ad('0x5f')](handleError(_0x52c150,null));};exports['addAnswer']=function(_0x5d04d8,_0x961ce6){if(_0x5d04d8[_0x35ad('0x68')]['id']){delete _0x5d04d8['body']['id'];}return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x5d04d8[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x961ce6,null))[_0x35ad('0x19')](function(_0x550020){if(_0x550020){_0x5d04d8[_0x35ad('0x68')]['ChatWebsiteId']=_0x550020['id'];return db[_0x35ad('0x78')][_0x35ad('0x62')](_0x5d04d8[_0x35ad('0x68')]);}})[_0x35ad('0x19')](respondWithResult(_0x961ce6,null))[_0x35ad('0x5f')](handleError(_0x961ce6,null));};exports['getAnswers']=function(_0x6212c6,_0x2f3116){var _0x3b9232={'raw':![],'where':{}};var _0x102801={};var _0x5daf78={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x35ad('0x73')]({'where':{'id':_0x6212c6['params']['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x2f3116,null))['then'](function(_0xc8d2b7){if(_0xc8d2b7){_0x102801['model']=_['keys'](db[_0x35ad('0x78')]['rawAttributes']);_0x102801[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x6212c6[_0x35ad('0x4c')]);_0x102801[_0x35ad('0x4e')]=_[_0x35ad('0x4f')](_0x102801[_0x35ad('0x41')],_0x102801[_0x35ad('0x4c')]);_0x3b9232[_0x35ad('0x50')]=_['intersection'](_0x102801[_0x35ad('0x41')],qs[_0x35ad('0x51')](_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x3b9232['attributes']=_0x3b9232[_0x35ad('0x50')][_0x35ad('0x52')]?_0x3b9232['attributes']:_0x102801['model'];if(!_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x75')](_0x35ad('0x53'))){_0x3b9232['limit']=qs[_0x35ad('0x28')](_0x6212c6['query'][_0x35ad('0x28')]);_0x3b9232[_0x35ad('0x26')]=qs[_0x35ad('0x26')](_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x26')]);}_0x3b9232[_0x35ad('0x54')]=qs[_0x35ad('0x55')](_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x55')]);_0x3b9232['where']=qs[_0x35ad('0x4e')](_[_0x35ad('0x57')](_0x6212c6[_0x35ad('0x4c')],_0x102801['filters']));_0x3b9232['where'][_0x35ad('0x72')]=_0xc8d2b7['id'];if(_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x59')]){_0x3b9232[_0x35ad('0x56')]=_['merge'](_0x3b9232[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0x3b9232[_0x35ad('0x50')],function(_0x1f41d2){var _0x336feb={};_0x336feb[_0x1f41d2]={'$like':'%'+_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x59')]+'%'};return _0x336feb;})});}_0x3b9232=_[_0x35ad('0x58')]({},_0x3b9232,_0x6212c6[_0x35ad('0x5a')]);return db[_0x35ad('0x78')]['count']({'where':_0x3b9232['where']})[_0x35ad('0x19')](function(_0x32c93b){_0x5daf78[_0x35ad('0x5c')]=_0x32c93b;if(_0x6212c6[_0x35ad('0x4c')][_0x35ad('0x5d')]){_0x3b9232[_0x35ad('0x61')]=[{'all':!![]}];}return db[_0x35ad('0x78')]['findAll'](_0x3b9232);})['then'](function(_0x4081b9){_0x5daf78[_0x35ad('0x76')]=_0x4081b9;return _0x5daf78;});}})['then'](respondWithFilteredResult(_0x2f3116,_0x3b9232))['catch'](handleError(_0x2f3116,null));};exports[_0x35ad('0x79')]=function(_0x4f2f03,_0x218c89){return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x4f2f03['params']['id']}})['then'](handleEntityNotFound(_0x218c89,null))['then'](function(_0x2d4286){if(_0x2d4286){return _0x2d4286[_0x35ad('0x79')](_0x4f2f03[_0x35ad('0x4c')][_0x35ad('0x7a')]);}})[_0x35ad('0x19')](respondWithStatusCode(_0x218c89,null))[_0x35ad('0x5f')](handleError(_0x218c89,null));};exports[_0x35ad('0x7b')]=function(_0x8ed8f,_0x5ab8a6){_0x8ed8f[_0x35ad('0x68')][_0x35ad('0x7c')]=_0x8ed8f[_0x35ad('0x7d')][_0x35ad('0x7e')];return db['ChatWebsite'][_0x35ad('0x6d')]({'where':{'id':_0x8ed8f['params']['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x5ab8a6,null))[_0x35ad('0x19')](saveUpdates(_0x8ed8f[_0x35ad('0x68')],null))[_0x35ad('0x19')](respondWithResult(_0x5ab8a6,null))['catch'](handleError(_0x5ab8a6,null));};exports[_0x35ad('0x7f')]=function(_0x1cdcd4,_0x45fe0d){_0x1cdcd4['body'][_0x35ad('0x80')]=_0x1cdcd4[_0x35ad('0x7d')][_0x35ad('0x7e')];return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x1cdcd4[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x45fe0d,null))[_0x35ad('0x19')](saveUpdates(_0x1cdcd4[_0x35ad('0x68')],null))[_0x35ad('0x19')](respondWithResult(_0x45fe0d,null))[_0x35ad('0x5f')](handleError(_0x45fe0d,null));};exports[_0x35ad('0x81')]=function(_0x3c66f6,_0x738f2c){_0x3c66f6[_0x35ad('0x68')][_0x35ad('0x82')]=_0x3c66f6[_0x35ad('0x7d')][_0x35ad('0x7e')];return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0x3c66f6[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x738f2c,null))[_0x35ad('0x19')](saveUpdates(_0x3c66f6[_0x35ad('0x68')],null))['then'](respondWithResult(_0x738f2c,null))[_0x35ad('0x5f')](handleError(_0x738f2c,null));};exports[_0x35ad('0x83')]=function(_0xb68b35,_0x3d4f03){_0xb68b35[_0x35ad('0x68')][_0x35ad('0x84')]=_0xb68b35[_0x35ad('0x7d')][_0x35ad('0x7e')];return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'where':{'id':_0xb68b35[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x3d4f03,null))[_0x35ad('0x19')](saveUpdates(_0xb68b35['body'],null))[_0x35ad('0x19')](respondWithResult(_0x3d4f03,null))['catch'](handleError(_0x3d4f03,null));};exports[_0x35ad('0x85')]=function(_0x53f700,_0x1e081f){var _0x1bed38=path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x88'));var _0x4867a9={'where':{'id':_0x53f700[_0x35ad('0x60')]['id']},'attributes':['id',_0x35ad('0x7c')],'raw':!![]};var _0x34181a=![];return require(_0x35ad('0x89'))['getLicense']()[_0x35ad('0x19')](function(_0x18aeb0){if(_0x18aeb0){_0x34181a=_0x18aeb0[_0x35ad('0x8a')];}})['then'](function(){return db['ChatWebsite'][_0x35ad('0x6d')](_0x4867a9);})[_0x35ad('0x19')](handleEntityNotFound(_0x1e081f,null))[_0x35ad('0x19')](function(_0x379783){if(_0x379783){if(!_[_0x35ad('0x8b')](_0x379783[_0x35ad('0x7c')])){if(fs[_0x35ad('0x8c')](path[_0x35ad('0x86')](config['root'],_0x35ad('0x8d'),_0x379783['sitepic']))&&_0x34181a){_0x1bed38=path[_0x35ad('0x86')](config[_0x35ad('0x87')],'server/files/images/logos/',_0x379783['sitepic']);}}return _0x1e081f[_0x35ad('0x8e')](_0x1bed38);}})[_0x35ad('0x5f')](handleError(_0x1e081f,null));};exports[_0x35ad('0x8f')]=function(_0x56c09a,_0x23fe9b){var _0x594247=path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x90'));var _0x5aa94b={'where':{'id':_0x56c09a['params']['id']},'attributes':['id',_0x35ad('0x80')],'raw':!![]};return db['ChatWebsite'][_0x35ad('0x6d')](_0x5aa94b)[_0x35ad('0x19')](handleEntityNotFound(_0x23fe9b,null))[_0x35ad('0x19')](function(_0xeb83b1){if(_0xeb83b1){if(!_[_0x35ad('0x8b')](_0xeb83b1[_0x35ad('0x80')])){if(fs[_0x35ad('0x8c')](path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x91'),_0xeb83b1[_0x35ad('0x80')]))){_0x594247=path[_0x35ad('0x86')](config['root'],_0x35ad('0x91'),_0xeb83b1[_0x35ad('0x80')]);}}return _0x23fe9b[_0x35ad('0x8e')](_0x594247);}})[_0x35ad('0x5f')](handleError(_0x23fe9b,null));};exports[_0x35ad('0x92')]=function(_0x265832,_0x364fcb){var _0xcfcbcb=path['join'](config[_0x35ad('0x87')],_0x35ad('0x93'));var _0x30fe3d={'where':{'id':_0x265832[_0x35ad('0x60')]['id']},'attributes':['id',_0x35ad('0x82'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x35ad('0x6d')](_0x30fe3d)['then'](handleEntityNotFound(_0x364fcb,null))['then'](function(_0x5e8291){if(_0x5e8291){if(!_[_0x35ad('0x8b')](_0x5e8291[_0x35ad('0x82')])){if(fs[_0x35ad('0x8c')](path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x91'),_0x5e8291[_0x35ad('0x82')]))&&_0x5e8291[_0x35ad('0x94')]){_0xcfcbcb=path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x91'),_0x5e8291['customerAvatar']);}}return _0x364fcb[_0x35ad('0x8e')](_0xcfcbcb);}})[_0x35ad('0x5f')](handleError(_0x364fcb,null));};exports['getSystemAvatar']=function(_0x521e08,_0x345da6){var _0x288068=path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x95'));var _0x2758f9={'where':{'id':_0x521e08[_0x35ad('0x60')]['id']},'attributes':['id',_0x35ad('0x84')],'raw':!![]};return db[_0x35ad('0x5b')][_0x35ad('0x6d')](_0x2758f9)[_0x35ad('0x19')](handleEntityNotFound(_0x345da6,null))[_0x35ad('0x19')](function(_0x48c23a){if(_0x48c23a){if(!_[_0x35ad('0x8b')](_0x48c23a[_0x35ad('0x84')])){if(fs[_0x35ad('0x8c')](path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0x91'),_0x48c23a[_0x35ad('0x84')]))){_0x288068=path[_0x35ad('0x86')](config['root'],_0x35ad('0x91'),_0x48c23a[_0x35ad('0x84')]);}}return _0x345da6['download'](_0x288068);}})[_0x35ad('0x5f')](handleError(_0x345da6,null));};function checkWebsiteInterval(_0x452afc){var _0x304c0f=_0x452afc['Interval'];if(!_0x304c0f){return Promise['resolve'](_0x452afc);}var _0x1d1c02=_0x452afc[_0x35ad('0x96')]||undefined;return _0x304c0f[_0x35ad('0x97')](_0x1d1c02)[_0x35ad('0x19')](function(_0x156de8){if(!_0x156de8){throw new APIOutOfIntervalError();}return _0x452afc;});}exports['notify']=function(_0x1257da,_0x9d1163){var _0x1b8bc8={'body':_0x1257da[_0x35ad('0x68')],'channel':_0x35ad('0x98')};var _0x162365=[];var _0x39a1db=[];var _0x23598a={};var _0x4f9680=![];if(_0x1257da['body']['id']){delete _0x1257da[_0x35ad('0x68')]['id'];}if(_[_0x35ad('0x8b')](_0x1257da['body'][_0x35ad('0x99')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x35ad('0x8b')](_0x1257da[_0x35ad('0x68')][_0x35ad('0x9a')])){throw new APIBadRequestError(_0x35ad('0x9b'));}if(_[_0x35ad('0x9c')](_0x1257da[_0x35ad('0x68')][_0x35ad('0x68')])){throw new APIBadRequestError(_0x35ad('0x9d'));}var _0x1f0fcb=_0x1257da[_0x35ad('0x68')]['customerIp']&&_0x1257da[_0x35ad('0x68')]['referer'];return db['CmContact']['describe']()['then'](function(_0x3c6582){if(!_0x3c6582){throw new Error(_0x35ad('0x9e'));}_0x162365=Object[_0x35ad('0x4d')](_0x3c6582)['filter'](function(_0x455561){return![_0x35ad('0x9f'),_0x35ad('0xa0')][_0x35ad('0xa1')](_0x455561);});_0x39a1db=Object[_0x35ad('0x4d')](_0x3c6582)['filter'](function(_0x26c88a){return![_0x35ad('0x9f'),_0x35ad('0xa0'),_0x35ad('0xa2'),_0x35ad('0xa3')][_0x35ad('0xa1')](_0x26c88a);});if(!_[_0x35ad('0xa1')](_0x39a1db,_0x1257da[_0x35ad('0x68')][_0x35ad('0x9a')])){throw new APIBadRequestError(_0x35ad('0xa4')+_0x39a1db[_0x35ad('0x86')](',\x20'));}_0x23598a[_0x1257da[_0x35ad('0x68')][_0x35ad('0x9a')]]=_0x1257da['body'][_0x35ad('0x99')];})['then'](function(){return db[_0x35ad('0x5b')]['find']({'where':{'id':_0x1257da[_0x35ad('0x60')]['id']},'include':[{'model':db[_0x35ad('0xa5')],'as':_0x35ad('0xa6'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x23598a,'limit':0x1,'order':[['updatedAt',_0x35ad('0xa7')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db[_0x35ad('0xa8')],'as':_0x35ad('0xa8'),'include':[{'model':db[_0x35ad('0xa8')],'as':_0x35ad('0xa9'),'attributes':['id',_0x35ad('0xaa')],'raw':!![]}]}]});})['then'](function(_0x30d239){if(!_0x30d239){throw new APINotFoundError(util[_0x35ad('0x3d')](_0x35ad('0xab'),_0x1257da[_0x35ad('0x60')]['id']));}if(_0x1f0fcb){return checkWebsiteInterval(_0x30d239);}return _0x30d239;})[_0x35ad('0x19')](function(_0xe0da68){_0x1b8bc8['account']=_0xe0da68;_0x1b8bc8[_0x35ad('0xac')]=_[_0x35ad('0xad')](_0xe0da68[_0x35ad('0xae')],[_0x35ad('0xaf')],[_0x35ad('0xb0')]);if(_0x1b8bc8[_0x35ad('0xb1')]['Applications']){delete _0x1b8bc8[_0x35ad('0xb1')][_0x35ad('0xae')];}_0x1b8bc8[_0x35ad('0xb2')]=_0xe0da68[_0x35ad('0xa6')]||{'id':_0xe0da68[_0x35ad('0xa3')]};if(_0x1b8bc8[_0x35ad('0xb2')]&&_0x1b8bc8['list']['Contacts'][_0x35ad('0x52')]){return _0x1b8bc8[_0x35ad('0xb2')][_0x35ad('0xb3')][0x0];}var _0x50eba3=_[_0x35ad('0xb4')](_0x1257da[_0x35ad('0x68')],{'firstName':_0x1257da[_0x35ad('0x68')][_0x35ad('0x99')],'ListId':_0xe0da68[_0x35ad('0xa3')]});_0x50eba3[_0x1257da[_0x35ad('0x68')][_0x35ad('0x9a')]]=_0x1257da['body']['from'];return db['CmContact']['create'](_0x50eba3,{'fields':_0x162365,'raw':!![]});})[_0x35ad('0x19')](function(_0x28eaee){_0x1b8bc8[_0x35ad('0xb5')]=_0x28eaee;var _0x4313c9=createInteractionObject(_0x1257da['params']['id'],_0x1257da[_0x35ad('0x68')],_0x1257da[_0x35ad('0xb6')],_0x28eaee);var _0x42895d={'ChatWebsiteId':_0x1257da[_0x35ad('0x60')]['id']};if(_0x1257da[_0x35ad('0x68')]['threadId']){_0x42895d[_0x35ad('0xb7')]=_0x1257da[_0x35ad('0x68')][_0x35ad('0xb7')];_0x42895d['closed']=![];return db[_0x35ad('0xb8')][_0x35ad('0x6d')]({'where':_0x42895d})[_0x35ad('0x19')](function(_0x4ac9bf){var _0x5f0433=_0x1257da['body'][_0x35ad('0x33')]&&_0x1257da[_0x35ad('0x68')][_0x35ad('0xb9')];if(_0x4ac9bf){_0x4f9680=!![];return _0x4ac9bf;}else if(!_0x5f0433&&_0x4ac9bf&&_0x4ac9bf[_0x35ad('0xba')]){throw new APIConflictError(_0x35ad('0xbb'));}_0x4313c9[_0x35ad('0xb7')]=_0x1257da['body'][_0x35ad('0xb7')];_0x4313c9[_0x35ad('0xbc')]=_0x1257da[_0x35ad('0x68')]['externalUrl'];return db['ChatInteraction'][_0x35ad('0x62')](_0x4313c9);});}_0x42895d[_0x35ad('0xbd')]=_0x28eaee['id'];if(_0x1257da[_0x35ad('0x68')][_0x35ad('0xbe')]&&_0x1257da[_0x35ad('0x68')][_0x35ad('0xbe')]['id']){_0x42895d['id']=_0x1257da['body']['interaction']['id'];return db['ChatInteraction'][_0x35ad('0x6d')]({'where':_0x42895d})[_0x35ad('0x19')](function(_0x1e8f91){var _0x4b5e4f=_0x1257da['body']['customerIp']&&_0x1257da[_0x35ad('0x68')][_0x35ad('0xb9')];if(!_0x4b5e4f&&_0x1e8f91&&_0x1e8f91['closed']){throw new APIConflictError(_0x35ad('0xbb'));}else if(_0x1e8f91){_0x4f9680=!![];return _0x1e8f91;}else{return db['ChatInteraction'][_0x35ad('0x62')](_0x4313c9);}});}return db[_0x35ad('0xb8')]['create'](_0x4313c9);})[_0x35ad('0x19')](function(_0xf40d55){if(!_0x4f9680){return _0xf40d55;}var _0x3120cd={'from':(_0x1b8bc8[_0x35ad('0xb5')][_0x35ad('0xbf')]||'')+'\x20'+(_0x1b8bc8[_0x35ad('0xb5')][_0x35ad('0x38')]||'')};if(_0x1257da[_0x35ad('0x68')][_0x35ad('0xb7')]&&_0x1257da['body'][_0x35ad('0xc0')]&&_0x1257da[_0x35ad('0x68')][_0x35ad('0xb7')]!=_0x1257da[_0x35ad('0x68')]['messageId']){_0x3120cd[_0x35ad('0xb7')]=_0x1257da['body']['messageId'];}return _0xf40d55[_0x35ad('0xc1')](_0x3120cd);})[_0x35ad('0x19')](function(_0x54abbf){_0x1b8bc8['interaction']=_0x54abbf[_0x35ad('0x2b')]({'plain':!![]});_0x1b8bc8[_0x35ad('0xbe')]['created']=!_0x4f9680;if(_0x1b8bc8[_0x35ad('0xbe')][_0x35ad('0xc2')]){if(_0x1b8bc8['account'][_0x35ad('0xc3')]){_0x1b8bc8[_0x35ad('0xac')][_0x35ad('0xc4')]({'id':0x0,'priority':_0x1b8bc8[_0x35ad('0xac')][_0x35ad('0x52')]+0x1,'app':_0x35ad('0xc5'),'appdata':_0x35ad('0xc6'),'interval':_0x35ad('0xc7')});}}return db[_0x35ad('0xc8')]['create']({'body':_0x1257da[_0x35ad('0x68')][_0x35ad('0x68')],'ChatWebsiteId':_0x1257da['params']['id'],'ChatInteractionId':_0x54abbf['id'],'direction':'in','ContactId':_0x1b8bc8[_0x35ad('0xb5')]['id'],'AttachmentId':_0x1257da[_0x35ad('0x68')][_0x35ad('0xc9')]});})[_0x35ad('0x19')](function(_0x55aabf){_0x1b8bc8['message']=_0x55aabf;if(!_0x1b8bc8['interaction']['UserId']){return;}return db[_0x35ad('0xca')]['find']({'attributes':['id',_0x35ad('0x3b')],'where':{'id':_0x1b8bc8['interaction'][_0x35ad('0xcb')]}});})[_0x35ad('0x19')](function(_0x3deadf){if(_0x3deadf){_0x1b8bc8[_0x35ad('0xac')]['unshift']({'id':0x0,'priority':0x0,'app':_0x35ad('0xcc'),'appdata':_0x3deadf['name']+','+(_0x1b8bc8[_0x35ad('0xb1')][_0x35ad('0xcd')]||0xa),'interval':_0x35ad('0xc7')});_0x1b8bc8[_0x35ad('0xce')]=!![];}if(!_0x1b8bc8[_0x35ad('0xbe')][_0x35ad('0xcf')]){return;}return db[_0x35ad('0xd0')][_0x35ad('0x6d')]({'attributes':['id',_0x35ad('0x3b')],'where':{'id':_0x1b8bc8[_0x35ad('0xbe')][_0x35ad('0xcf')]}});})[_0x35ad('0x19')](function(_0x4202e9){if(_0x4202e9){_0x1b8bc8['applications'][_0x35ad('0xd1')]({'id':0x0,'priority':0x1,'app':_0x35ad('0xd2'),'appdata':_0x4202e9[_0x35ad('0x3b')]+','+(_0x1b8bc8[_0x35ad('0xb1')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x35ad('0xd3'),_0x35ad('0xd4'),_0x1b8bc8);})[_0x35ad('0x19')](function(_0x3e25cf){respondWithRpcPromise('EventManager',_0x35ad('0xd5'),{'event':_0x35ad('0xd6'),'message':_0x3e25cf},client9002);return _0x3e25cf;})['then'](respondWithResult(_0x9d1163,null))[_0x35ad('0x5f')](APIHandleError(_0x9d1163));};exports[_0x35ad('0xd7')]=function(_0x12630f,_0x378362){var _0x4dbe1c,_0x2bac03,_0x3a2819;var _0x3c856b=[];var _0x34874e={};var _0x190ecb=_0x12630f[_0x35ad('0xd8')]||[];var _0x54bad8=[];var _0x27d199;return db[_0x35ad('0xd9')][_0x35ad('0x70')]()[_0x35ad('0x19')](function(_0x26a9b0){if(!_0x26a9b0){throw new db[(_0x35ad('0xda'))][(_0x35ad('0xdb'))]('no\x20available\x20attributes');}_0x3c856b=_['difference'](_[_0x35ad('0x4d')](_0x26a9b0),[_0x35ad('0x9f'),_0x35ad('0xa0'),_0x35ad('0xa2'),_0x35ad('0xa3')]);if(_0x12630f[_0x35ad('0x68')]['id']){delete _0x12630f['body']['id'];}if(_[_0x35ad('0x8b')](_0x12630f[_0x35ad('0x68')]['from'])){throw _0x378362[_0x35ad('0x23')](0x1f4)[_0x35ad('0x2f')](new db[(_0x35ad('0xda'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x35ad('0x8b')](_0x12630f[_0x35ad('0x68')]['body'])||_0x12630f[_0x35ad('0x68')][_0x35ad('0x68')]===''){throw _0x378362[_0x35ad('0x23')](0x1f4)[_0x35ad('0x2f')](new db[(_0x35ad('0xda'))][(_0x35ad('0xdb'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x35ad('0x8b')](_0x12630f['body'][_0x35ad('0xdc')])){throw _0x378362[_0x35ad('0x23')](0x1f4)['send'](new db[(_0x35ad('0xda'))][(_0x35ad('0xdb'))](_0x35ad('0xdd')+_0x3c856b));}if(!_[_0x35ad('0xa1')](_0x3c856b,_0x12630f['body']['mapKeyOffline'])){throw _0x378362[_0x35ad('0x23')](0x1f4)[_0x35ad('0x2f')](new db[(_0x35ad('0xda'))][(_0x35ad('0xdb'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c856b));}_0x34874e[_0x12630f[_0x35ad('0x68')]['mapKeyOffline']]=_0x12630f[_0x35ad('0x68')][_0x35ad('0x99')];})[_0x35ad('0x19')](function(){return db[_0x35ad('0x5b')]['find']({'where':{'id':_0x12630f[_0x35ad('0x60')]['id']},'include':[{'model':db[_0x35ad('0xa5')],'as':_0x35ad('0xa6')},{'model':db[_0x35ad('0xde')],'as':_0x35ad('0xde')}]});})[_0x35ad('0x19')](handleEntityNotFound(_0x378362,null))[_0x35ad('0x19')](function(_0x3c8544){if(_0x3c8544&&_0x3c8544[_0x35ad('0xa6')]){_0x2bac03=_0x3c8544;var _0x4c7e3e=_[_0x35ad('0xb4')](_0x12630f[_0x35ad('0x68')],{'firstName':_0x12630f['body'][_0x35ad('0x99')],'phone':_0x12630f['body']['from'],'ListId':_0x3c8544[_0x35ad('0xa3')]});_0x4c7e3e[_0x12630f[_0x35ad('0x68')][_0x35ad('0xdc')]]=_0x12630f[_0x35ad('0x68')]['from'];return db[_0x35ad('0xd9')][_0x35ad('0xdf')]({'where':_0x34874e,'defaults':_0x4c7e3e});}})[_0x35ad('0xe0')](function(_0x1ff13b){if(_0x1ff13b){_0x3a2819=_0x1ff13b;var _0x5ab2f9=fs['readFileSync'](path[_0x35ad('0x86')](config['root'],_0x35ad('0xe1')),_0x35ad('0xe2'));var _0x1b4c34=ejs['render'](_0x5ab2f9,{'body':_[_0x35ad('0xe3')](_0x12630f['body'][_0x35ad('0x68')]),'bodyTitle':_0x2bac03[_0x35ad('0xe4')]});return db['ChatOfflineMessage'][_0x35ad('0x62')]({'body':_0x1b4c34,'plainBody':htmlToText[_0x35ad('0xe5')](_0x1b4c34),'ContactId':_0x1ff13b['id'],'ChatWebsiteId':_0x2bac03['id']});}})['then'](function(_0x1e0e35){_0x27d199=_0x1e0e35;if(_0x190ecb[_0x35ad('0x52')]){var _0x5a1392=_0x190ecb[_0x35ad('0x49')](function(_0x22ed7d){return{'name':_0x22ed7d[_0x35ad('0xe6')],'basename':_0x22ed7d['filename'],'type':_0x22ed7d[_0x35ad('0xe7')],'ChatOfflineMessageId':_0x1e0e35['id']};});_0x54bad8=_0x5a1392['map'](_0x2c4504=>{var _0x159e9a={'filename':_0x2c4504[_0x35ad('0x3b')],'path':path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0xe8'),_0x35ad('0xd8'),_0x35ad('0xe9'),_0x35ad('0xea'),_0x2c4504['basename'])};return _0x159e9a;});if(!_0x2bac03['openNewInteraction']){return db[_0x35ad('0xeb')][_0x35ad('0xec')](function(_0x4c0ea8){return db['Attachment'][_0x35ad('0xed')](_0x5a1392,{'transaction':_0x4c0ea8});});}}})[_0x35ad('0x19')](function(){if(_0x27d199){_0x4dbe1c=_0x27d199;return db[_0x35ad('0xde')][_0x35ad('0x73')]({'where':{'service':!![]},'include':[{'model':db[_0x35ad('0xee')],'as':_0x35ad('0xef'),'raw':!![],'include':[{'model':db[_0x35ad('0xf0')],'as':_0x35ad('0xf0'),'raw':!![]}]}]});}})[_0x35ad('0x19')](function(_0x24ec72){if(_0x24ec72&&_0x24ec72[_0x35ad('0xef')]&&_0x2bac03[_0x35ad('0xf1')]&&_0x2bac03[_0x35ad('0xf2')]){var _0x5b2882=_0x24ec72[_0x35ad('0xf3')]();return respondWithRpcPromise(_0x35ad('0xf4'),_0x35ad('0xf5'),{'account':_0x5b2882,'message':{'from':util[_0x35ad('0x3d')](_0x35ad('0xf6'),_0x24ec72[_0x35ad('0x3b')],_0x24ec72[_0x35ad('0xf7')]||_0x24ec72[_0x35ad('0xef')][_0x35ad('0x69')]),'to':_0x2bac03[_0x35ad('0xf2')],'subject':_0x2bac03['offlineMessageSubject'],'html':_0x4dbe1c[_0x35ad('0x68')],'attachments':_0x54bad8}},client9003)['then'](function(){return _0x4dbe1c;})['catch'](function(_0x1b2ab8){logger[_0x35ad('0x1e')](_0x1b2ab8);});}})['then'](function(){if(_0x2bac03&&_0x2bac03[_0x35ad('0xf8')]&&_0x2bac03[_0x35ad('0xf9')]){var _0x53ce66=[];if(_0x190ecb[_0x35ad('0x52')]){_0x53ce66=_0x190ecb[_0x35ad('0x49')](function(_0x47fb6c){return{'name':_0x47fb6c[_0x35ad('0xe6')],'basename':_0x47fb6c['filename'],'type':_0x47fb6c[_0x35ad('0xe7')],'ChatOfflineMessageId':_0x27d199['id']};});}var _0x5bfd6d;if(!_[_0x35ad('0x8b')](_0x2bac03[_0x35ad('0xfa')])){var _0xfc20bd=_[_0x35ad('0x49')](_0x12630f[_0x35ad('0x68')],function(_0x508b7a){return _0x508b7a;});var _0x2d5220=_[_0x35ad('0xfb')](_0xfc20bd)[0x0];var _0x1e9544=_[_0x35ad('0xfc')](_0x2d5220,function(_0x236091){return _0x236091;});_0x5bfd6d=_0x1e9544[0x1][_0x2bac03[_0x35ad('0xfa')]];}var _0x7be2f3={'from':_0x3a2819[_0x35ad('0xf7')],'firstName':_0x3a2819[_0x35ad('0xbf')],'lastName':_0x3a2819[_0x35ad('0x38')],'mapKey':_0x35ad('0xf7'),'message':{'from':_0x3a2819['email'],'to':_0x2bac03['MailAccount']['email'],'cc':'','subject':_[_0x35ad('0x8b')](_0x5bfd6d)?_0x2bac03['offlineMessageSubject']:_0x5bfd6d,'messageId':'','sentAt':new Date(),'attach':_0x53ce66[_0x35ad('0x52')],'attachments':_0x53ce66,'originChannel':'Chat','ChatWebsiteId':_0x2bac03['id'],'ChatOfflineMessageId':_0x4dbe1c['id'],'originTo':_0x2bac03[_0x35ad('0xde')][_0x35ad('0xf7')]},'body':_0x4dbe1c['body']};var _0x472d76={'account':{'id':_0x2bac03['MailAccountId']},'body':_0x7be2f3,'log':_0x35ad('0xfd')};return respondWithRpcPromise(_0x35ad('0xfd'),_0x35ad('0xfe'),_0x472d76,client9001)[_0x35ad('0x19')](function(){return _0x4dbe1c;})[_0x35ad('0x5f')](function(_0x12e4e8){logger[_0x35ad('0x1e')](_0x12e4e8);});}return;})[_0x35ad('0x19')](function(){if(_0x4dbe1c){return _0x4dbe1c;}})[_0x35ad('0x19')](respondWithResult(_0x378362,null))[_0x35ad('0x5f')](function(){for(var _0x5c81f5 of _0x190ecb){var _0xc9e73b=path[_0x35ad('0x86')](config[_0x35ad('0x87')],_0x35ad('0xe8'),_0x35ad('0xd8'),_0x35ad('0xe9'),_0x35ad('0xea'),_0x5c81f5[_0x35ad('0x7e')]);fs_extra[_0x35ad('0xff')](_0xc9e73b)[_0x35ad('0x5f')](function(_0x5c6b69){logger[_0x35ad('0x1e')](_0x35ad('0x100'),_0xc9e73b,_0x5c6b69);});}});};exports[_0x35ad('0x101')]=function(_0x1c9dce,_0x1a8b38){return db[_0x35ad('0xb8')][_0x35ad('0x6d')]({'where':{'id':_0x1c9dce['params']['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x1a8b38,null))[_0x35ad('0x19')](function(_0x1e7178){if(_0x1e7178){return _0x1e7178['addInteraction'](_0x1c9dce['body']['ids'],_[_0x35ad('0x102')](_0x1c9dce[_0x35ad('0x68')],[_0x35ad('0x7a'),'id'])||{});}})[_0x35ad('0x19')](respondWithResult(_0x1a8b38,null))['catch'](handleError(_0x1a8b38,null));};exports['getInteractions']=function(_0x2e89c4,_0x20c5b1){var _0x5d2740={'raw':![],'where':{}};var _0x735d43={};var _0x335d7b={'count':0x0,'rows':[]};return db[_0x35ad('0x5b')][_0x35ad('0x73')]({'where':{'id':_0x2e89c4[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x20c5b1,null))[_0x35ad('0x19')](function(_0x38d879){if(_0x38d879){_0x735d43[_0x35ad('0x41')]=_[_0x35ad('0x4d')](db[_0x35ad('0xb8')][_0x35ad('0x4a')]);_0x735d43[_0x35ad('0x4c')]=_['keys'](_0x2e89c4[_0x35ad('0x4c')]);_0x735d43['filters']=_[_0x35ad('0x4f')](_0x735d43['model'],_0x735d43['query']);_0x5d2740['attributes']=_['intersection'](_0x735d43['model'],qs[_0x35ad('0x51')](_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x5d2740[_0x35ad('0x50')]=_0x5d2740[_0x35ad('0x50')][_0x35ad('0x52')]?_0x5d2740['attributes']:_0x735d43[_0x35ad('0x41')];if(!_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x75')](_0x35ad('0x53'))){_0x5d2740[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x2e89c4['query'][_0x35ad('0x28')]);_0x5d2740['offset']=qs['offset'](_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x26')]);}_0x5d2740[_0x35ad('0x54')]=qs[_0x35ad('0x55')](_0x2e89c4[_0x35ad('0x4c')]['sort']);_0x5d2740[_0x35ad('0x56')]=qs[_0x35ad('0x4e')](_[_0x35ad('0x57')](_0x2e89c4['query'],_0x735d43['filters']));_0x5d2740[_0x35ad('0x56')][_0x35ad('0x72')]=_0x38d879['id'];if(_0x2e89c4['query'][_0x35ad('0x59')]){_0x5d2740['where']=_['merge'](_0x5d2740[_0x35ad('0x56')],{'$or':_['map'](_0x5d2740[_0x35ad('0x50')],function(_0x47f047){var _0x5a0e51={};_0x5a0e51[_0x47f047]={'$like':'%'+_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x59')]+'%'};return _0x5a0e51;})});}_0x5d2740=_['merge']({},_0x5d2740,_0x2e89c4[_0x35ad('0x5a')]);return db[_0x35ad('0xb8')]['count']({'where':_0x5d2740['where']})[_0x35ad('0x19')](function(_0x37cb29){_0x335d7b[_0x35ad('0x5c')]=_0x37cb29;if(_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x5d')]){_0x5d2740[_0x35ad('0x61')]=[{'model':db[_0x35ad('0xd9')],'as':_0x35ad('0x103'),'required':![]},{'model':db[_0x35ad('0xca')],'as':_0x35ad('0x104'),'attributes':[_0x35ad('0x3b'),_0x35ad('0x105'),_0x35ad('0x106')],'required':![]},{'model':db[_0x35ad('0x107')],'as':_0x35ad('0x108'),'attributes':['id',_0x35ad('0x3b'),_0x35ad('0x109')],'where':_0x2e89c4[_0x35ad('0x4c')][_0x35ad('0x10a')]?{'id':_0x2e89c4['query'][_0x35ad('0x10a')]}:undefined,'required':_0x2e89c4[_0x35ad('0x4c')]['tag']?!![]:![]}];}return db[_0x35ad('0xb8')]['findAll'](_0x5d2740);})[_0x35ad('0x19')](function(_0x26a97c){_0x335d7b[_0x35ad('0x76')]=_0x26a97c;return _0x335d7b;});}})['then'](respondWithFilteredResult(_0x20c5b1,_0x5d2740))[_0x35ad('0x5f')](handleError(_0x20c5b1,null));};exports[_0x35ad('0x10b')]=function(_0x5b4423,_0x472796){var _0x51ac94=0x0;var _0x59f17c=0x0;var _0x3dedad=![];var _0x1455db;var _0x117be3;return db[_0x35ad('0x5b')]['find']({'where':{'id':_0x5b4423[_0x35ad('0x60')]['id']},'include':[{'model':db[_0x35ad('0xa8')],'as':'Interval','include':[{'model':db[_0x35ad('0xa8')],'as':'Intervals','attributes':['id','interval']}]}]})[_0x35ad('0x19')](handleEntityNotFound(_0x472796,null))['then'](function(_0x4bfbe3){if(_0x4bfbe3){_0x1455db=_0x4bfbe3;return _0x4bfbe3['getProactiveActions']({'raw':!![]});}})[_0x35ad('0x19')](function(_0x4e0ab0){if(_0x1455db){if(_0x4e0ab0){_0x117be3=_0x4e0ab0;}}return require('../../config/license/util')[_0x35ad('0x10c')]();})['then'](function(_0x92f21d){if(_0x92f21d){_0x59f17c=_0x92f21d[_0x35ad('0x10d')];_0x3dedad=_0x92f21d[_0x35ad('0x8a')];}})['then'](function(){return db[_0x35ad('0xb8')]['count']({'where':{'closed':![]}});})[_0x35ad('0x19')](function(_0x402c16){_0x51ac94=_0x402c16;if(_0x59f17c&&_0x402c16>_0x59f17c){return db[_0x35ad('0x10e')]['findOne']({'where':{'id':0x1}})['then'](function(_0x12efc1){if(_0x12efc1){_0x12efc1[_0x35ad('0x10f')](_0x35ad('0x110'));}});}})[_0x35ad('0x19')](function(){var _0xe72c44=_0x1455db['Interval'];var _0x9a1871=_0x1455db[_0x35ad('0x96')]||undefined;return _0xe72c44?_0xe72c44[_0x35ad('0x97')](_0x9a1871):!![];})['then'](function(_0x199476){var _0x1f1579=fs[_0x35ad('0x111')](path[_0x35ad('0x86')](config[_0x35ad('0x87')],'server/files/chat/iframe.ejs'),'utf8');var _0x305e75=_0x35ad('0x112');var _0x1d759b=![];var _0x11e739,_0x3a9f26;if(_0x5b4423[_0x35ad('0xb6')][_0x35ad('0xb9')]){_0x11e739=new URL(_0x5b4423[_0x35ad('0xb6')]['referer'])[_0x35ad('0x113')];}else if(_0x5b4423[_0x35ad('0xb6')][_0x35ad('0x113')]){_0x11e739=new URL(_0x5b4423['headers'][_0x35ad('0x113')])[_0x35ad('0x113')];}else{_0x11e739='http://localhost:9000';}_0x3a9f26=typeof _0x1455db['address'][_0x35ad('0x37')](',')[_0x35ad('0x6d')](function(_0x1c803b){return wildcardUtils[_0x35ad('0x114')](_0x1c803b,_0x11e739);})!=='undefined';var _0x4eaac3={'chatVersion':_0x305e75,'chatWebsiteAddressOrigin':_0x3a9f26?_0x11e739:_0x1455db[_0x35ad('0x63')],'remote':_0x1455db['remote'],'query':querystring[_0x35ad('0x45')](_['merge'](_0x1455db[_0x35ad('0x2b')]({'plain':!![]}),{'customerIp':_0x5b4423[_0x35ad('0xb6')]['x-forwarded-for']||_0x5b4423['headers'][_0x35ad('0x115')]||_0x5b4423[_0x35ad('0x116')][_0x35ad('0x117')]||_0x5b4423['ip'],'referer':_0x5b4423['headers'][_0x35ad('0xb9')],'openedInteractions':_0x51ac94,'maxInteractions':_0x59f17c,'virtual':_0x3dedad[_0x35ad('0x10d')],'online':_0x199476,'custom':_0x3dedad,'address':_0x3a9f26?_0x11e739:null}))['replace'](/'/g,'\x5c\x27')};_0x472796[_0x35ad('0x2f')](ejs[_0x35ad('0x118')](Mustache['render'](_0x1f1579,_0x4eaac3),{'proactiveActions':_0x117be3,'alignment':_0x1455db[_0x35ad('0x119')],'verticalAlignment':_0x1455db[_0x35ad('0x11a')],'div_color':_0x1455db[_0x35ad('0x109')],'labelText':_0x1455db[_0x35ad('0x11b')],'text_color':_0x1455db[_0x35ad('0x11c')],'text_button_color':_0x1455db['textButtonColor'],'button_color':_0x1455db[_0x35ad('0x11d')],'background_color':_0x1455db[_0x35ad('0x11e')],'hideWhenOffline':_0x1455db[_0x35ad('0x11f')],'intervalId':_0x1455db[_0x35ad('0x120')],'isDevelopment':_0x1d759b,'chatVersion':_0x305e75}));})[_0x35ad('0x5f')](handleError(_0x472796,null));};exports[_0x35ad('0x121')]=function(_0x7c9e89,_0x1af0ce){var _0x16f4aa=_0x7c9e89[_0x35ad('0x60')]['id'];var _0x26b5c6=_0x7c9e89['body'];var _0x336f22=0xc8;var _0x21a8f8=null;return db['sequelize'][_0x35ad('0xec')]({'isolationLevel':db[_0x35ad('0xeb')][_0x35ad('0x122')][_0x35ad('0x123')]['READ_COMMITTED']},function(_0x52a70f){return db[_0x35ad('0x5b')][_0x35ad('0x73')]({'where':{'id':_0x16f4aa},'transaction':_0x52a70f})[_0x35ad('0x19')](function(_0x5ae3ce){if(_0x5ae3ce){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x16f4aa},'transaction':_0x52a70f})['then'](function(){var _0x183474=_[_0x35ad('0x49')](_0x26b5c6,function(_0x319076){_0x319076['ChatWebsiteId']=_0x16f4aa;return _0x319076;});return db[_0x35ad('0x124')][_0x35ad('0xed')](_0x183474,{'transaction':_0x52a70f});});}else{_0x336f22=0x194;_0x21a8f8=[];}});})[_0x35ad('0x19')](function(){if(_0x336f22!==0x194){return db[_0x35ad('0x124')][_0x35ad('0x125')]({'where':{'ChatWebsiteId':_0x16f4aa},'order':_0x35ad('0xaf')})[_0x35ad('0x19')](function(_0x40ec18){_0x21a8f8=_0x40ec18;});}})[_0x35ad('0x5f')](function(_0x2a36a1){_0x336f22=0x1f4;logger[_0x35ad('0x1e')](_0x2a36a1[_0x35ad('0x2e')]);if(_0x2a36a1[_0x35ad('0x3b')]){delete _0x2a36a1['name'];}_0x21a8f8=_0x2a36a1;})[_0x35ad('0x126')](function(){if(_0x21a8f8===null){_0x1af0ce[_0x35ad('0x22')](_0x336f22);}else{if(_0x336f22===0x1f4){_0x1af0ce[_0x35ad('0x23')](_0x336f22)[_0x35ad('0x2f')](_0x21a8f8);}else{_0x1af0ce['status'](_0x336f22)[_0x35ad('0x25')](_0x21a8f8);}}});};exports['getApplications']=function(_0x54b56b,_0xd8fb4){var _0x576355={};var _0x3b1208={};var _0x2e4f2d;var _0x496a5d;return db[_0x35ad('0x5b')][_0x35ad('0x73')]({'where':{'id':_0x54b56b[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0xd8fb4,null))[_0x35ad('0x19')](function(_0x513569){if(_0x513569){_0x2e4f2d=_0x513569;_0x3b1208[_0x35ad('0x41')]=_[_0x35ad('0x4d')](db[_0x35ad('0x124')]['rawAttributes']);_0x3b1208[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x54b56b[_0x35ad('0x4c')]);_0x3b1208[_0x35ad('0x4e')]=_['intersection'](_0x3b1208[_0x35ad('0x41')],_0x3b1208[_0x35ad('0x4c')]);_0x576355[_0x35ad('0x50')]=_[_0x35ad('0x4f')](_0x3b1208[_0x35ad('0x41')],qs[_0x35ad('0x51')](_0x54b56b[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x576355[_0x35ad('0x50')]=_0x576355[_0x35ad('0x50')]['length']?_0x576355[_0x35ad('0x50')]:_0x3b1208['model'];_0x576355[_0x35ad('0x54')]=qs[_0x35ad('0x55')](_0x54b56b['query']['sort']);_0x576355['where']=qs[_0x35ad('0x4e')](_['pick'](_0x54b56b['query'],_0x3b1208[_0x35ad('0x4e')]));if(_0x54b56b['query'][_0x35ad('0x59')]){_0x576355[_0x35ad('0x56')]=_[_0x35ad('0x58')](_0x576355[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0x576355['attributes'],function(_0xbb801){var _0x370996={};_0x370996[_0xbb801]={'$like':'%'+_0x54b56b['query'][_0x35ad('0x59')]+'%'};return _0x370996;})});}_0x576355=_['merge']({},_0x576355,_0x54b56b['options']);return _0x2e4f2d[_0x35ad('0x127')](_0x576355);}})[_0x35ad('0x19')](function(_0x30728d){if(_0x30728d){_0x496a5d=_0x30728d[_0x35ad('0x52')];if(!_0x54b56b[_0x35ad('0x4c')][_0x35ad('0x75')](_0x35ad('0x53'))){_0x576355[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x54b56b[_0x35ad('0x4c')][_0x35ad('0x28')]);_0x576355[_0x35ad('0x26')]=qs[_0x35ad('0x26')](_0x54b56b[_0x35ad('0x4c')][_0x35ad('0x26')]);}return _0x2e4f2d['getApplications'](_0x576355);}})['then'](function(_0x4ebeb5){if(_0x4ebeb5){return _0x4ebeb5?{'count':_0x496a5d,'rows':_0x4ebeb5}:null;}})[_0x35ad('0x19')](respondWithResult(_0xd8fb4,null))[_0x35ad('0x5f')](handleError(_0xd8fb4,null));};exports[_0x35ad('0x128')]=function(_0x7d16de,_0x1de368){return db[_0x35ad('0x129')][_0x35ad('0x6d')]({'where':{'id':_0x7d16de['params']['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x1de368,null))[_0x35ad('0x19')](function(_0x1293e9){if(_0x1293e9){return _0x1293e9[_0x35ad('0x128')](_0x7d16de[_0x35ad('0x68')][_0x35ad('0x7a')],_[_0x35ad('0x102')](_0x7d16de[_0x35ad('0x68')],[_0x35ad('0x7a'),'id'])||{});}})[_0x35ad('0x19')](respondWithResult(_0x1de368,null))['catch'](handleError(_0x1de368,null));};exports['getProactiveActions']=function(_0x49c46f,_0x48bc36){var _0x518711={};var _0x2dfe5c={};var _0x259a7a;var _0x4c47cb;return db[_0x35ad('0x5b')]['findOne']({'where':{'id':_0x49c46f[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x48bc36,null))['then'](function(_0x2e0776){if(_0x2e0776){_0x259a7a=_0x2e0776;_0x2dfe5c[_0x35ad('0x41')]=_[_0x35ad('0x4d')](db['ChatProactiveAction'][_0x35ad('0x4a')]);_0x2dfe5c['query']=_[_0x35ad('0x4d')](_0x49c46f['query']);_0x2dfe5c[_0x35ad('0x4e')]=_[_0x35ad('0x4f')](_0x2dfe5c[_0x35ad('0x41')],_0x2dfe5c[_0x35ad('0x4c')]);_0x518711[_0x35ad('0x50')]=_['intersection'](_0x2dfe5c[_0x35ad('0x41')],qs['fields'](_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x51')]));_0x518711['attributes']=_0x518711[_0x35ad('0x50')]['length']?_0x518711[_0x35ad('0x50')]:_0x2dfe5c[_0x35ad('0x41')];_0x518711[_0x35ad('0x54')]=qs[_0x35ad('0x55')](_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x55')]);_0x518711[_0x35ad('0x56')]=qs[_0x35ad('0x4e')](_[_0x35ad('0x57')](_0x49c46f[_0x35ad('0x4c')],_0x2dfe5c[_0x35ad('0x4e')]));if(_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x59')]){_0x518711[_0x35ad('0x56')]=_[_0x35ad('0x58')](_0x518711['where'],{'$or':_[_0x35ad('0x49')](_0x518711['attributes'],function(_0xfc554f){var _0x29ae9c={};_0x29ae9c[_0xfc554f]={'$like':'%'+_0x49c46f['query'][_0x35ad('0x59')]+'%'};return _0x29ae9c;})});}_0x518711=_[_0x35ad('0x58')]({},_0x518711,_0x49c46f[_0x35ad('0x5a')]);return _0x259a7a[_0x35ad('0x12a')](_0x518711);}})[_0x35ad('0x19')](function(_0x22baf8){if(_0x22baf8){_0x4c47cb=_0x22baf8['length'];if(!_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x75')]('nolimit')){_0x518711[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x28')]);_0x518711['offset']=qs[_0x35ad('0x26')](_0x49c46f[_0x35ad('0x4c')][_0x35ad('0x26')]);}return _0x259a7a[_0x35ad('0x12a')](_0x518711);}})[_0x35ad('0x19')](function(_0x681307){if(_0x681307){return _0x681307?{'count':_0x4c47cb,'rows':_0x681307}:null;}})[_0x35ad('0x19')](respondWithResult(_0x48bc36,null))[_0x35ad('0x5f')](handleError(_0x48bc36,null));};exports[_0x35ad('0x12b')]=function(_0x1023f9,_0x505c4e){var _0x2570a4=_0x1023f9[_0x35ad('0x4c')][_0x35ad('0x12c')]===_0x35ad('0x12d')?_0x35ad('0x12e'):_0x35ad('0x12f');return db[_0x35ad('0x5b')][_0x35ad('0x6d')]({'attributes':['id',_0x2570a4],'where':{'id':_0x1023f9[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x505c4e,null))[_0x35ad('0x19')](function(_0x45ed9b){if(_0x45ed9b){var _0x2a72c4=_0x45ed9b[_0x2570a4];var _0x33614a=_0x2a72c4&&_0x2a72c4[_0x35ad('0x130')]?_0x2a72c4[_0x35ad('0x130')]:[];_0x505c4e['send']({'fromKey':_['isNil'](_0x2a72c4[_0x35ad('0x131')])?undefined:_0x2a72c4[_0x35ad('0x131')],'count':_0x33614a[_0x35ad('0x52')],'rows':_0x33614a});}})[_0x35ad('0x5f')](handleError(_0x505c4e,null));};exports[_0x35ad('0x132')]=function(_0x286eaf,_0x5dbaf8){var _0x4f3669={'raw':![],'where':{}};var _0x450e30={};var _0x15e7f0={'count':0x0,'rows':[]};return db[_0x35ad('0x5b')][_0x35ad('0x73')]({'where':{'id':_0x286eaf[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x5dbaf8,null))[_0x35ad('0x19')](function(_0x2727d6){if(_0x2727d6){_0x450e30['model']=_[_0x35ad('0x4d')](db[_0x35ad('0x133')][_0x35ad('0x4a')]);_0x450e30[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x286eaf[_0x35ad('0x4c')]);_0x450e30[_0x35ad('0x4e')]=_['intersection'](_0x450e30[_0x35ad('0x41')],_0x450e30[_0x35ad('0x4c')]);_0x4f3669['attributes']=_[_0x35ad('0x4f')](_0x450e30[_0x35ad('0x41')],qs[_0x35ad('0x51')](_0x286eaf[_0x35ad('0x4c')]['fields']));_0x4f3669[_0x35ad('0x50')]=_0x4f3669['attributes'][_0x35ad('0x52')]?_0x4f3669[_0x35ad('0x50')]:_0x450e30[_0x35ad('0x41')];if(!_0x286eaf[_0x35ad('0x4c')][_0x35ad('0x75')](_0x35ad('0x53'))){_0x4f3669[_0x35ad('0x28')]=qs['limit'](_0x286eaf[_0x35ad('0x4c')][_0x35ad('0x28')]);_0x4f3669['offset']=qs[_0x35ad('0x26')](_0x286eaf[_0x35ad('0x4c')]['offset']);}_0x4f3669[_0x35ad('0x54')]=qs[_0x35ad('0x55')](_0x286eaf[_0x35ad('0x4c')][_0x35ad('0x55')]);_0x4f3669[_0x35ad('0x56')]=qs['filters'](_[_0x35ad('0x57')](_0x286eaf[_0x35ad('0x4c')],_0x450e30['filters']));_0x4f3669['where'][_0x35ad('0x72')]=_0x2727d6['id'];if(_0x286eaf[_0x35ad('0x4c')][_0x35ad('0x59')]){_0x4f3669['where']=_[_0x35ad('0x58')](_0x4f3669[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0x4f3669[_0x35ad('0x50')],function(_0x227b62){var _0x37f51a={};_0x37f51a[_0x227b62]={'$like':'%'+_0x286eaf['query'][_0x35ad('0x59')]+'%'};return _0x37f51a;})});}_0x4f3669=_['merge']({},_0x4f3669,_0x286eaf[_0x35ad('0x5a')]);return db['ChatOfflineMessage'][_0x35ad('0x5c')]({'where':_0x4f3669['where']})[_0x35ad('0x19')](function(_0x183d4c){_0x15e7f0['count']=_0x183d4c;if(_0x286eaf[_0x35ad('0x4c')][_0x35ad('0x5d')]){_0x4f3669[_0x35ad('0x61')]=[{'all':!![]}];}else{_0x4f3669[_0x35ad('0x61')]=[{'model':db['CmContact'],'as':_0x35ad('0x103'),'required':![]},{'model':db[_0x35ad('0x134')],'as':_0x35ad('0x135'),'required':![]}];}return db[_0x35ad('0x133')][_0x35ad('0x5e')](_0x4f3669);})['then'](function(_0x3760e3){_0x15e7f0[_0x35ad('0x76')]=_0x3760e3;return _0x15e7f0;});}})['then'](respondWithFilteredResult(_0x5dbaf8,_0x4f3669))['catch'](handleError(_0x5dbaf8,null));};exports[_0x35ad('0x136')]=function(_0x8f00c5,_0x1af22e){return db[_0x35ad('0x5b')]['find']({'where':{'id':_0x8f00c5[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x1af22e,null))[_0x35ad('0x19')](function(_0xe7a305){if(_0xe7a305){return _0xe7a305['addAgents'](_0x8f00c5[_0x35ad('0x68')]['ids'],_[_0x35ad('0x102')](_0x8f00c5['body'],[_0x35ad('0x7a'),'id'])||{})['spread'](function(_0x55325e){for(var _0x4c591e=0x0;_0x4c591e<_0x8f00c5[_0x35ad('0x68')][_0x35ad('0x7a')]['length'];_0x4c591e+=0x1){socket[_0x35ad('0x137')](_0x35ad('0x138'),{'UserId':Number(_0x8f00c5['body'][_0x35ad('0x7a')][_0x4c591e]),'ChatWebsiteId':Number(_0x8f00c5[_0x35ad('0x60')]['id'])});}return _0x55325e;});}})[_0x35ad('0x19')](respondWithResult(_0x1af22e,null))[_0x35ad('0x5f')](handleError(_0x1af22e,null));};exports[_0x35ad('0x139')]=function(_0x33a3be,_0x49b8a8){return db['ChatWebsite'][_0x35ad('0x6d')]({'where':{'id':_0x33a3be[_0x35ad('0x60')]['id']}})['then'](handleEntityNotFound(_0x49b8a8,null))[_0x35ad('0x19')](function(_0x40f956){if(_0x40f956){return _0x40f956[_0x35ad('0x139')](_0x33a3be['query'][_0x35ad('0x7a')])[_0x35ad('0x19')](function(){if(_[_0x35ad('0x13a')](_0x33a3be['query'][_0x35ad('0x7a')])){for(var _0x4405af=0x0;_0x4405af<_0x33a3be[_0x35ad('0x4c')][_0x35ad('0x7a')][_0x35ad('0x52')];_0x4405af+=0x1){socket['emit'](_0x35ad('0x13b'),{'UserId':Number(_0x33a3be['query'][_0x35ad('0x7a')][_0x4405af]),'ChatWebsiteId':Number(_0x33a3be[_0x35ad('0x60')]['id'])});}}else{socket[_0x35ad('0x137')](_0x35ad('0x13b'),{'UserId':Number(_0x33a3be[_0x35ad('0x4c')][_0x35ad('0x7a')]),'ChatWebsiteId':Number(_0x33a3be['params']['id'])});}});}})[_0x35ad('0x19')](respondWithStatusCode(_0x49b8a8,null))[_0x35ad('0x5f')](handleError(_0x49b8a8,null));};exports[_0x35ad('0x13c')]=function(_0x2d94ce,_0x553f66){var _0xa11b01={};var _0x5bf0cf={};var _0x144961;var _0x4edb81;return db[_0x35ad('0x5b')]['findOne']({'where':{'id':_0x2d94ce[_0x35ad('0x60')]['id']}})[_0x35ad('0x19')](handleEntityNotFound(_0x553f66,null))[_0x35ad('0x19')](function(_0x38ed1e){if(_0x38ed1e){_0x144961=_0x38ed1e;_0x5bf0cf['model']=_[_0x35ad('0x4d')](db[_0x35ad('0xca')][_0x35ad('0x4a')]);_0x5bf0cf[_0x35ad('0x4c')]=_[_0x35ad('0x4d')](_0x2d94ce['query']);_0x5bf0cf[_0x35ad('0x4e')]=_[_0x35ad('0x4f')](_0x5bf0cf[_0x35ad('0x41')],_0x5bf0cf[_0x35ad('0x4c')]);_0xa11b01['attributes']=_[_0x35ad('0x4f')](_0x5bf0cf[_0x35ad('0x41')],qs[_0x35ad('0x51')](_0x2d94ce[_0x35ad('0x4c')][_0x35ad('0x51')]));_0xa11b01[_0x35ad('0x50')]=_0xa11b01['attributes'][_0x35ad('0x52')]?_0xa11b01[_0x35ad('0x50')]:_0x5bf0cf[_0x35ad('0x41')];_0xa11b01[_0x35ad('0x54')]=qs['sort'](_0x2d94ce['query'][_0x35ad('0x55')]);_0xa11b01['where']=qs[_0x35ad('0x4e')](_[_0x35ad('0x57')](_0x2d94ce['query'],_0x5bf0cf[_0x35ad('0x4e')]));if(_0x2d94ce[_0x35ad('0x4c')][_0x35ad('0x59')]){_0xa11b01[_0x35ad('0x56')]=_[_0x35ad('0x58')](_0xa11b01[_0x35ad('0x56')],{'$or':_[_0x35ad('0x49')](_0xa11b01[_0x35ad('0x50')],function(_0x4c82cc){var _0x41778b={};_0x41778b[_0x4c82cc]={'$like':'%'+_0x2d94ce[_0x35ad('0x4c')][_0x35ad('0x59')]+'%'};return _0x41778b;})});}_0xa11b01=_['merge']({},_0xa11b01,_0x2d94ce[_0x35ad('0x5a')]);return _0x144961[_0x35ad('0x13c')](_0xa11b01);}})[_0x35ad('0x19')](function(_0x1645f4){if(_0x1645f4){_0x4edb81=_0x1645f4[_0x35ad('0x52')];if(!_0x2d94ce['query']['hasOwnProperty'](_0x35ad('0x53'))){_0xa11b01[_0x35ad('0x28')]=qs[_0x35ad('0x28')](_0x2d94ce[_0x35ad('0x4c')]['limit']);_0xa11b01[_0x35ad('0x26')]=qs['offset'](_0x2d94ce[_0x35ad('0x4c')][_0x35ad('0x26')]);}return _0x144961[_0x35ad('0x13c')](_0xa11b01);}})['then'](function(_0x53027b){if(_0x53027b){return _0x53027b?{'count':_0x4edb81,'rows':_0x53027b}:null;}})[_0x35ad('0x19')](respondWithResult(_0x553f66,null))[_0x35ad('0x5f')](handleError(_0x553f66,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1f8f9b8..e967d22 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 _0x1af5=['emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0xd04611,_0x6f7365){var _0x72e2db=function(_0x349948){while(--_0x349948){_0xd04611['push'](_0xd04611['shift']());}};_0x72e2db(++_0x6f7365);}(_0x1af5,0x17d));var _0x51af=function(_0x53199e,_0x58c424){_0x53199e=_0x53199e-0x0;var _0x2cb521=_0x1af5[_0x53199e];return _0x2cb521;};'use strict';var EventEmitter=require(_0x51af('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x51af('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x51af('0x2')](0x0);var events={'afterCreate':_0x51af('0x3'),'afterUpdate':_0x51af('0x4'),'afterDestroy':_0x51af('0x5')};function emitEvent(_0x3fa933){return function(_0x3e09ac,_0x1ef226,_0x115556){ChatWebsiteEvents[_0x51af('0x6')](_0x3fa933+':'+_0x3e09ac['id'],_0x3e09ac);ChatWebsiteEvents[_0x51af('0x6')](_0x3fa933,_0x3e09ac);_0x115556(null);};}for(var e in events){if(events[_0x51af('0x7')](e)){var event=events[e];ChatWebsite[_0x51af('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x4989=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x31c480,_0x13f64a){var _0x3687ce=function(_0x46fbc0){while(--_0x46fbc0){_0x31c480['push'](_0x31c480['shift']());}};_0x3687ce(++_0x13f64a);}(_0x4989,0x79));var _0x9498=function(_0x1e744a,_0xa8fdb1){_0x1e744a=_0x1e744a-0x0;var _0x1ac4d0=_0x4989[_0x1e744a];return _0x1ac4d0;};'use strict';var EventEmitter=require(_0x9498('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9498('0x1')](0x0);var events={'afterCreate':_0x9498('0x2'),'afterUpdate':_0x9498('0x3'),'afterDestroy':_0x9498('0x4')};function emitEvent(_0x5953c0){return function(_0x55fabb,_0x84ed1b,_0x47922b){ChatWebsiteEvents[_0x9498('0x5')](_0x5953c0+':'+_0x55fabb['id'],_0x55fabb);ChatWebsiteEvents[_0x9498('0x5')](_0x5953c0,_0x55fabb);_0x47922b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9498('0x6')](e,emitEvent(event));}}module[_0x9498('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 01a53e8..f198cf2 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 _0xf7e2=['../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x485038,_0x3e26e8){var _0xa87ace=function(_0x1cf247){while(--_0x1cf247){_0x485038['push'](_0x485038['shift']());}};_0xa87ace(++_0x3e26e8);}(_0xf7e2,0x119));var _0x2f7e=function(_0x3930a0,_0xf416c0){_0x3930a0=_0x3930a0-0x0;var _0x11c08f=_0xf7e2[_0x3930a0];return _0x11c08f;};'use strict';var _=require(_0x2f7e('0x0'));var util=require(_0x2f7e('0x1'));var logger=require(_0x2f7e('0x2'))(_0x2f7e('0x3'));var moment=require('moment');var BPromise=require(_0x2f7e('0x4'));var rp=require(_0x2f7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f7e('0x6'));var config=require(_0x2f7e('0x7'));var attributes=require(_0x2f7e('0x8'));module['exports']=function(_0x52b464,_0xdc7705){return _0x52b464[_0x2f7e('0x9')](_0x2f7e('0xa'),attributes,{'tableName':_0x2f7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ce=['exports','ChatWebsite','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatWebsite.attributes'];(function(_0x16294f,_0x2b591d){var _0x2086f7=function(_0x38ea30){while(--_0x38ea30){_0x16294f['push'](_0x16294f['shift']());}};_0x2086f7(++_0x2b591d);}(_0x44ce,0x10a));var _0xe44c=function(_0x4cec57,_0x98c58a){_0x4cec57=_0x4cec57-0x0;var _0x18b817=_0x44ce[_0x4cec57];return _0x18b817;};'use strict';var _=require(_0xe44c('0x0'));var util=require(_0xe44c('0x1'));var logger=require(_0xe44c('0x2'))(_0xe44c('0x3'));var moment=require(_0xe44c('0x4'));var BPromise=require('bluebird');var rp=require(_0xe44c('0x5'));var fs=require('fs');var path=require(_0xe44c('0x6'));var rimraf=require('rimraf');var config=require(_0xe44c('0x7'));var attributes=require(_0xe44c('0x8'));module[_0xe44c('0x9')]=function(_0x186c3c,_0x583e15){return _0x186c3c['define'](_0xe44c('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 6f1c9c5..f773c26 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 _0xb931=['request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x2c044c,_0x217c40){var _0x2144a0=function(_0x3a4696){while(--_0x3a4696){_0x2c044c['push'](_0x2c044c['shift']());}};_0x2144a0(++_0x217c40);}(_0xb931,0x97));var _0x1b93=function(_0x2e706a,_0x49c551){_0x2e706a=_0x2e706a-0x0;var _0xfdc71c=_0xb931[_0x2e706a];return _0xfdc71c;};'use strict';var _=require(_0x1b93('0x0'));var util=require(_0x1b93('0x1'));var moment=require(_0x1b93('0x2'));var BPromise=require(_0x1b93('0x3'));var rs=require(_0x1b93('0x4'));var fs=require('fs');var Redis=require(_0x1b93('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b93('0x6'));var logger=require(_0x1b93('0x7'))(_0x1b93('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b93('0x9'));var client=jayson[_0x1b93('0xa')][_0x1b93('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1b93('0xc')],{'host':_0x1b93('0xd'),'port':0x18eb});var socket=require(_0x1b93('0xe'))(new Redis(config[_0x1b93('0xc')]));require(_0x1b93('0xf'))[_0x1b93('0x10')](socket);function respondWithRpcPromise(_0x430927,_0x3b7208,_0x38e3dc){return new BPromise(function(_0x3e5d4b,_0x42ebf2){return client[_0x1b93('0x11')](_0x430927,_0x38e3dc)[_0x1b93('0x12')](function(_0x16025f){logger[_0x1b93('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3b7208,_0x1b93('0x14'));logger[_0x1b93('0x15')](_0x1b93('0x16'),_0x3b7208,'request\x20sent',JSON[_0x1b93('0x17')](_0x16025f));if(_0x16025f[_0x1b93('0x18')]){if(_0x16025f[_0x1b93('0x18')]['code']===0x1f4){logger[_0x1b93('0x18')](_0x1b93('0x19'),_0x3b7208,_0x16025f['error'][_0x1b93('0x1a')]);return _0x42ebf2(_0x16025f['error'][_0x1b93('0x1a')]);}logger['error'](_0x1b93('0x19'),_0x3b7208,_0x16025f['error'][_0x1b93('0x1a')]);return _0x3e5d4b(_0x16025f['error'][_0x1b93('0x1a')]);}else{logger[_0x1b93('0x13')](_0x1b93('0x19'),_0x3b7208,_0x1b93('0x14'));_0x3e5d4b(_0x16025f['result'][_0x1b93('0x1a')]);}})[_0x1b93('0x1b')](function(_0x2c497d){logger[_0x1b93('0x18')](_0x1b93('0x19'),_0x3b7208,_0x2c497d);_0x42ebf2(_0x2c497d);});});} \ No newline at end of file +var _0x5d6c=['client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x368a3e,_0x47b292){var _0x3cb213=function(_0x1c283d){while(--_0x1c283d){_0x368a3e['push'](_0x368a3e['shift']());}};_0x3cb213(++_0x47b292);}(_0x5d6c,0x149));var _0xc5d6=function(_0x1db5cf,_0x25c3a4){_0x1db5cf=_0x1db5cf-0x0;var _0x931fe5=_0x5d6c[_0x1db5cf];return _0x931fe5;};'use strict';var _=require(_0xc5d6('0x0'));var util=require(_0xc5d6('0x1'));var moment=require(_0xc5d6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5d6('0x3'));var fs=require('fs');var Redis=require(_0xc5d6('0x4'));var db=require(_0xc5d6('0x5'))['db'];var utils=require(_0xc5d6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc5d6('0x7'));var jayson=require(_0xc5d6('0x8'));var client=jayson[_0xc5d6('0x9')]['http']({'port':0x232a});config[_0xc5d6('0xa')]=_[_0xc5d6('0xb')](config[_0xc5d6('0xa')],{'host':_0xc5d6('0xc'),'port':0x18eb});var socket=require(_0xc5d6('0xd'))(new Redis(config[_0xc5d6('0xa')]));require(_0xc5d6('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b438c,_0x2f05bc,_0x39c4bb){return new BPromise(function(_0xc6204f,_0x37063f){return client[_0xc5d6('0xf')](_0x5b438c,_0x39c4bb)[_0xc5d6('0x10')](function(_0x3cccb8){logger[_0xc5d6('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x2f05bc,'request\x20sent');logger[_0xc5d6('0x12')](_0xc5d6('0x13'),_0x2f05bc,_0xc5d6('0x14'),JSON['stringify'](_0x3cccb8));if(_0x3cccb8[_0xc5d6('0x15')]){if(_0x3cccb8['error'][_0xc5d6('0x16')]===0x1f4){logger[_0xc5d6('0x15')](_0xc5d6('0x17'),_0x2f05bc,_0x3cccb8[_0xc5d6('0x15')][_0xc5d6('0x18')]);return _0x37063f(_0x3cccb8[_0xc5d6('0x15')][_0xc5d6('0x18')]);}logger[_0xc5d6('0x15')](_0xc5d6('0x17'),_0x2f05bc,_0x3cccb8[_0xc5d6('0x15')]['message']);return _0xc6204f(_0x3cccb8[_0xc5d6('0x15')][_0xc5d6('0x18')]);}else{logger[_0xc5d6('0x11')](_0xc5d6('0x17'),_0x2f05bc,_0xc5d6('0x14'));_0xc6204f(_0x3cccb8['result'][_0xc5d6('0x18')]);}})[_0xc5d6('0x19')](function(_0x45c8fe){logger[_0xc5d6('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x2f05bc,_0x45c8fe);_0x37063f(_0x45c8fe);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e057110..48e3614 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 _0x0bc3=['register','length','chatWebsite:','save','remove','update','removeListener'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0x0bc3,0x1b5));var _0x30bc=function(_0x2b0be8,_0x404bc5){_0x2b0be8=_0x2b0be8-0x0;var _0x423f1d=_0x0bc3[_0x2b0be8];return _0x423f1d;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x30bc('0x0'),_0x30bc('0x1'),_0x30bc('0x2')];function createListener(_0x3f2894,_0x53998e){return function(_0x5a0318){_0x53998e['emit'](_0x3f2894,_0x5a0318);};}function removeListener(_0x369b55,_0x5b0036){return function(){ChatWebsiteEvents[_0x30bc('0x3')](_0x369b55,_0x5b0036);};}exports[_0x30bc('0x4')]=function(_0x3ce35c){for(var _0x4c8074=0x0,_0xf762f=events[_0x30bc('0x5')];_0x4c8074<_0xf762f;_0x4c8074++){var _0x31bac9=events[_0x4c8074];var _0x5aacb5=createListener(_0x30bc('0x6')+_0x31bac9,_0x3ce35c);ChatWebsiteEvents['on'](_0x31bac9,_0x5aacb5);}}; \ No newline at end of file +var _0xbe06=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x4df9d4,_0x5d3644){var _0x301a8b=function(_0x5d0113){while(--_0x5d0113){_0x4df9d4['push'](_0x4df9d4['shift']());}};_0x301a8b(++_0x5d3644);}(_0xbe06,0x1b4));var _0x6be0=function(_0x27d621,_0x1b4ab0){_0x27d621=_0x27d621-0x0;var _0x1911b7=_0xbe06[_0x27d621];return _0x1911b7;};'use strict';var ChatWebsiteEvents=require(_0x6be0('0x0'));var events=[_0x6be0('0x1'),_0x6be0('0x2'),_0x6be0('0x3')];function createListener(_0x4f8dcc,_0x4b3269){return function(_0x166c0b){_0x4b3269['emit'](_0x4f8dcc,_0x166c0b);};}function removeListener(_0x4d6f5e,_0x164f6c){return function(){ChatWebsiteEvents[_0x6be0('0x4')](_0x4d6f5e,_0x164f6c);};}exports[_0x6be0('0x5')]=function(_0x2c2369){for(var _0x2ee2ea=0x0,_0x1e7956=events[_0x6be0('0x6')];_0x2ee2ea<_0x1e7956;_0x2ee2ea++){var _0x3a69ba=events[_0x2ee2ea];var _0x33afb4=createListener(_0x6be0('0x7')+_0x3a69ba,_0x2c2369);ChatWebsiteEvents['on'](_0x3a69ba,_0x33afb4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 62bfd6c..9c58534 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf108=['exports','../../../utils/misc','url','URL','test','trim','replace','([\x5cw]+)'];(function(_0x2dd25a,_0x473907){var _0x59f26c=function(_0x4d2253){while(--_0x4d2253){_0x2dd25a['push'](_0x2dd25a['shift']());}};_0x59f26c(++_0x473907);}(_0xf108,0x1d9));var _0x8f10=function(_0x558cd0,_0x333581){_0x558cd0=_0x558cd0-0x0;var _0x5ac038=_0xf108[_0x558cd0];return _0x5ac038;};var escapeRegExp=require(_0x8f10('0x0'))['escapeRegExp'];var URL=require(_0x8f10('0x1'))[_0x8f10('0x2')];function testWildcardValidity(_0x19096f){var _0x4d49e8=!![];try{new URL(_0x19096f['replace']('*','localhost'));}catch(_0x440ee7){_0x4d49e8=![];}return _0x4d49e8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x8f10('0x3')](_0x19096f);}function testWebsiteWithWildcard(_0x511ab7,_0x30a472){var _0x2e3419;var _0x235737=escapeRegExp(_0x511ab7[_0x8f10('0x4')]()[_0x8f10('0x5')](/\/$/,''))[_0x8f10('0x5')]('\x5c*',_0x8f10('0x6'));try{new URL(_0x511ab7[_0x8f10('0x5')]('\x5c*','localhost'));_0x2e3419=new RegExp(_0x235737)[_0x8f10('0x3')](_0x30a472);}catch(_0x1787d2){_0x2e3419=![];}return _0x2e3419;}module[_0x8f10('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xb44a=['url','localhost','test','trim','replace','([\x5cw]+)'];(function(_0x5cdc9f,_0xa89ea5){var _0x4e9327=function(_0x1ad213){while(--_0x1ad213){_0x5cdc9f['push'](_0x5cdc9f['shift']());}};_0x4e9327(++_0xa89ea5);}(_0xb44a,0x1c2));var _0xab44=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xb44a[_0x25bca6];return _0x3f8d02;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xab44('0x0'))['URL'];function testWildcardValidity(_0x186fec){var _0x5c825d=!![];try{new URL(_0x186fec['replace']('*',_0xab44('0x1')));}catch(_0x5c93b4){_0x5c825d=![];}return _0x5c825d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xab44('0x2')](_0x186fec);}function testWebsiteWithWildcard(_0x32396c,_0x2e3662){var _0x28681a;var _0x2f3948=escapeRegExp(_0x32396c[_0xab44('0x3')]()[_0xab44('0x4')](/\/$/,''))[_0xab44('0x4')]('\x5c*',_0xab44('0x5'));try{new URL(_0x32396c[_0xab44('0x4')]('\x5c*',_0xab44('0x1')));_0x28681a=new RegExp(_0x2f3948)[_0xab44('0x2')](_0x2e3662);}catch(_0xa14367){_0x28681a=![];}return _0x28681a;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7047d09..9783bf4 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 _0x6520=['server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','single','addSystemAvatar','/:id/notify','notify','offline-chat','replace','offline','/:id/interactions','addInteraction','addProactiveActions','/:id/users','put','update','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','get','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','getSnippet','/:id/applications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','format','now','originalname','/:id/logo','file','join'];(function(_0x455ccb,_0x5fe7cd){var _0xbb3bb5=function(_0x41203e){while(--_0x41203e){_0x455ccb['push'](_0x455ccb['shift']());}};_0xbb3bb5(++_0x5fe7cd);}(_0x6520,0x189));var _0x0652=function(_0x33444b,_0xd30d56){_0x33444b=_0x33444b-0x0;var _0x38f918=_0x6520[_0x33444b];return _0x38f918;};'use strict';var multer=require(_0x0652('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0652('0x1'));var express=require(_0x0652('0x2'));var router=express['Router']();var fs_extra=require(_0x0652('0x3'));var auth=require(_0x0652('0x4'));var interaction=require(_0x0652('0x5'));var config=require(_0x0652('0x6'));var controller=require(_0x0652('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0652('0x8')]);router[_0x0652('0x9')]('/describe',auth[_0x0652('0xa')](),controller[_0x0652('0xb')]);router[_0x0652('0x9')](_0x0652('0xc'),auth[_0x0652('0xa')](),controller[_0x0652('0xd')]);router[_0x0652('0x9')]('/:id/dispositions',auth[_0x0652('0xa')](),controller[_0x0652('0xe')]);router[_0x0652('0x9')]('/:id/canned_answers',auth[_0x0652('0xa')](),controller[_0x0652('0xf')]);router[_0x0652('0x9')]('/:id/logo',controller['getLogo']);router['get']('/:id/avatar',controller['getAvatar']);router[_0x0652('0x9')](_0x0652('0x10'),controller[_0x0652('0x11')]);router['get'](_0x0652('0x12'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x0652('0xa')](),controller[_0x0652('0x13')]);router[_0x0652('0x9')]('/:id/snippet',controller[_0x0652('0x14')]);router[_0x0652('0x9')](_0x0652('0x15'),auth[_0x0652('0xa')](),controller['getApplications']);router[_0x0652('0x9')]('/:id/proactive_actions',auth[_0x0652('0xa')](),controller[_0x0652('0x16')]);router[_0x0652('0x9')]('/:id/fields',controller[_0x0652('0x17')]);router[_0x0652('0x9')](_0x0652('0x18'),auth[_0x0652('0xa')](),controller[_0x0652('0x19')]);router['get']('/:id/users',auth[_0x0652('0xa')](),controller[_0x0652('0x1a')]);router['post']('/',auth[_0x0652('0xa')](),controller[_0x0652('0x1b')]);router[_0x0652('0x1c')](_0x0652('0x1d'),auth[_0x0652('0xa')](),controller[_0x0652('0x1e')]);router[_0x0652('0x1c')](_0x0652('0x1f'),auth[_0x0652('0xa')](),controller[_0x0652('0x20')]);var upload=multer({'storage':multer[_0x0652('0x21')]({'destination':function(_0x516ec5,_0x452b6b,_0x49a314){_0x49a314(null,path['join'](config[_0x0652('0x22')],'server/files/images/logos/'));},'filename':function(_0x128991,_0x122ccf,_0x53a61e){_0x53a61e(null,util[_0x0652('0x23')]('%s-%s',Date[_0x0652('0x24')](),_0x122ccf[_0x0652('0x25')]));}})});router[_0x0652('0x1c')](_0x0652('0x26'),upload['single'](_0x0652('0x27')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3abe46,_0x595522,_0x350fdc){_0x350fdc(null,path[_0x0652('0x28')](config['root'],_0x0652('0x29')));},'filename':function(_0x4c9cc6,_0x4718c5,_0x5b38c0){_0x5b38c0(null,util[_0x0652('0x23')](_0x0652('0x2a'),Date[_0x0652('0x24')](),_0x4718c5[_0x0652('0x25')]));}})});router['post'](_0x0652('0x2b'),upload['single'](_0x0652('0x27')),controller[_0x0652('0x2c')]);var upload=multer({'storage':multer[_0x0652('0x21')]({'destination':function(_0x4b15c9,_0x8ada00,_0x2bc1de){_0x2bc1de(null,path[_0x0652('0x28')](config[_0x0652('0x22')],_0x0652('0x29')));},'filename':function(_0x26c790,_0x3aab99,_0x2b9957){_0x2b9957(null,util[_0x0652('0x23')](_0x0652('0x2a'),Date[_0x0652('0x24')](),_0x3aab99['originalname']));}})});router['post'](_0x0652('0x10'),upload[_0x0652('0x2d')](_0x0652('0x27')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x595210,_0x2d1800,_0x300019){_0x300019(null,path[_0x0652('0x28')](config[_0x0652('0x22')],'server/files/images/avatars/'));},'filename':function(_0x149f06,_0x49a7f0,_0x5aa1a6){_0x5aa1a6(null,util[_0x0652('0x23')](_0x0652('0x2a'),Date[_0x0652('0x24')](),_0x49a7f0[_0x0652('0x25')]));}})});router[_0x0652('0x1c')](_0x0652('0x12'),upload[_0x0652('0x2d')](_0x0652('0x27')),controller[_0x0652('0x2e')]);router[_0x0652('0x1c')](_0x0652('0x2f'),controller[_0x0652('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x485b40,_0x4e543b,_0x56a26a){const _0x2dab92=path[_0x0652('0x28')](config[_0x0652('0x22')],'server/files','attachments',_0x0652('0x31'));fs_extra['ensureDir'](_0x2dab92,function(){_0x56a26a(null,_0x2dab92);});},'filename':function(_0x27ae47,_0x27d38a,_0x3a44ab){const _0x148ee3=_0x27d38a[_0x0652('0x25')][_0x0652('0x32')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x542a90=path['extname'](_0x148ee3);const _0x5f182c=Date['now']()+'-'+_0x148ee3[_0x0652('0x32')](_0x542a90,'')+_0x542a90;_0x3a44ab(null,_0x5f182c);}})});router[_0x0652('0x1c')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x0652('0x33')]);router[_0x0652('0x1c')](_0x0652('0x34'),auth['isAuthenticated'](),controller[_0x0652('0x35')]);router['post'](_0x0652('0x15'),auth[_0x0652('0xa')](),controller['addApplications']);router[_0x0652('0x1c')]('/:id/proactive_actions',auth[_0x0652('0xa')](),controller[_0x0652('0x36')]);router[_0x0652('0x1c')](_0x0652('0x37'),auth[_0x0652('0xa')](),controller['addAgents']);router[_0x0652('0x38')](_0x0652('0xc'),auth['isAuthenticated'](),controller[_0x0652('0x39')]);router[_0x0652('0x3a')](_0x0652('0xc'),auth[_0x0652('0xa')](),controller['destroy']);router[_0x0652('0x3a')](_0x0652('0x1d'),auth[_0x0652('0xa')](),controller[_0x0652('0x3b')]);router[_0x0652('0x3a')](_0x0652('0x1f'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x0652('0x3a')](_0x0652('0x37'),auth[_0x0652('0xa')](),controller[_0x0652('0x3c')]);module[_0x0652('0x3d')]=router; \ No newline at end of file +var _0x6c55=['addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','join','server/files/images/avatars/','addCustomerAvatar','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','/describe','get','show','/:id/dispositions','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create'];(function(_0x4cf0a9,_0x3dc400){var _0x359cad=function(_0x449d53){while(--_0x449d53){_0x4cf0a9['push'](_0x4cf0a9['shift']());}};_0x359cad(++_0x3dc400);}(_0x6c55,0xe1));var _0x56c5=function(_0x4b8980,_0x2559d8){_0x4b8980=_0x4b8980-0x0;var _0x2e93b4=_0x6c55[_0x4b8980];return _0x2e93b4;};'use strict';var multer=require(_0x56c5('0x0'));var util=require('util');var path=require(_0x56c5('0x1'));var timeout=require(_0x56c5('0x2'));var express=require(_0x56c5('0x3'));var router=express['Router']();var fs_extra=require(_0x56c5('0x4'));var auth=require(_0x56c5('0x5'));var interaction=require(_0x56c5('0x6'));var config=require('../../config/environment');var controller=require(_0x56c5('0x7'));router['get']('/',auth[_0x56c5('0x8')](),controller[_0x56c5('0x9')]);router['get'](_0x56c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x56c5('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x56c5('0xc')]);router[_0x56c5('0xb')](_0x56c5('0xd'),auth[_0x56c5('0x8')](),controller['getDispositions']);router[_0x56c5('0xb')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x56c5('0xb')](_0x56c5('0xe'),controller[_0x56c5('0xf')]);router[_0x56c5('0xb')]('/:id/avatar',controller[_0x56c5('0x10')]);router[_0x56c5('0xb')](_0x56c5('0x11'),controller[_0x56c5('0x12')]);router[_0x56c5('0xb')](_0x56c5('0x13'),controller[_0x56c5('0x14')]);router[_0x56c5('0xb')](_0x56c5('0x15'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x16')]);router[_0x56c5('0xb')](_0x56c5('0x17'),controller['getSnippet']);router[_0x56c5('0xb')](_0x56c5('0x18'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x19')]);router[_0x56c5('0xb')](_0x56c5('0x1a'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x1b')]);router[_0x56c5('0xb')](_0x56c5('0x1c'),controller[_0x56c5('0x1d')]);router[_0x56c5('0xb')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x56c5('0x1e')]);router[_0x56c5('0xb')](_0x56c5('0x1f'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x20')]);router[_0x56c5('0x21')]('/',auth[_0x56c5('0x8')](),controller[_0x56c5('0x22')]);router[_0x56c5('0x21')](_0x56c5('0xd'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x23')]);router['post'](_0x56c5('0x24'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x25')]);var upload=multer({'storage':multer[_0x56c5('0x26')]({'destination':function(_0x3ce3c4,_0x5d899d,_0x5d12c8){_0x5d12c8(null,path['join'](config[_0x56c5('0x27')],_0x56c5('0x28')));},'filename':function(_0x1fec64,_0x3c62ce,_0x4895dc){_0x4895dc(null,util[_0x56c5('0x29')](_0x56c5('0x2a'),Date[_0x56c5('0x2b')](),_0x3c62ce[_0x56c5('0x2c')]));}})});router[_0x56c5('0x21')](_0x56c5('0xe'),upload[_0x56c5('0x2d')](_0x56c5('0x2e')),controller['addLogo']);var upload=multer({'storage':multer[_0x56c5('0x26')]({'destination':function(_0x577a66,_0x2c5a2b,_0x337373){_0x337373(null,path[_0x56c5('0x2f')](config[_0x56c5('0x27')],'server/files/images/avatars/'));},'filename':function(_0x2afce1,_0x42260a,_0x563378){_0x563378(null,util[_0x56c5('0x29')](_0x56c5('0x2a'),Date[_0x56c5('0x2b')](),_0x42260a[_0x56c5('0x2c')]));}})});router[_0x56c5('0x21')]('/:id/avatar',upload[_0x56c5('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x56c5('0x26')]({'destination':function(_0x1497e5,_0x3e0dbf,_0x2c2a98){_0x2c2a98(null,path[_0x56c5('0x2f')](config[_0x56c5('0x27')],_0x56c5('0x30')));},'filename':function(_0x14d8b6,_0x26b3c7,_0x5b2ea6){_0x5b2ea6(null,util[_0x56c5('0x29')](_0x56c5('0x2a'),Date[_0x56c5('0x2b')](),_0x26b3c7[_0x56c5('0x2c')]));}})});router['post']('/:id/customer_avatar',upload[_0x56c5('0x2d')](_0x56c5('0x2e')),controller[_0x56c5('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5161ef,_0x543748,_0x323bdd){_0x323bdd(null,path[_0x56c5('0x2f')](config[_0x56c5('0x27')],'server/files/images/avatars/'));},'filename':function(_0x352110,_0x15c586,_0x3ebf72){_0x3ebf72(null,util['format'](_0x56c5('0x2a'),Date[_0x56c5('0x2b')](),_0x15c586['originalname']));}})});router[_0x56c5('0x21')](_0x56c5('0x13'),upload[_0x56c5('0x2d')](_0x56c5('0x2e')),controller['addSystemAvatar']);router[_0x56c5('0x21')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x56c5('0x26')]({'destination':function(_0x2e6ff3,_0x460604,_0x3ac59b){const _0x12f246=path[_0x56c5('0x2f')](config[_0x56c5('0x27')],'server/files','attachments',_0x56c5('0x32'));fs_extra[_0x56c5('0x33')](_0x12f246,function(){_0x3ac59b(null,_0x12f246);});},'filename':function(_0x4a11a8,_0x574fba,_0x4c1509){const _0x16910b=_0x574fba[_0x56c5('0x2c')][_0x56c5('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3e7a17=path[_0x56c5('0x35')](_0x16910b);const _0x168da5=Date['now']()+'-'+_0x16910b['replace'](_0x3e7a17,'')+_0x3e7a17;_0x4c1509(null,_0x168da5);}})});router[_0x56c5('0x21')](_0x56c5('0x36'),offlineUploadMulter[_0x56c5('0x37')](),controller[_0x56c5('0x38')]);router['post']('/:id/interactions',auth[_0x56c5('0x8')](),controller[_0x56c5('0x39')]);router[_0x56c5('0x21')](_0x56c5('0x18'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x3a')]);router[_0x56c5('0x21')](_0x56c5('0x1a'),auth[_0x56c5('0x8')](),controller['addProactiveActions']);router[_0x56c5('0x21')](_0x56c5('0x1f'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x3b')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x56c5('0x3c')]('/:id',auth[_0x56c5('0x8')](),controller[_0x56c5('0x3d')]);router[_0x56c5('0x3c')](_0x56c5('0xd'),auth[_0x56c5('0x8')](),controller[_0x56c5('0x3e')]);router[_0x56c5('0x3c')](_0x56c5('0x24'),auth[_0x56c5('0x8')](),controller['removeAnswers']);router[_0x56c5('0x3c')](_0x56c5('0x1f'),auth['isAuthenticated'](),controller[_0x56c5('0x3f')]);module[_0x56c5('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 9b2df32..ceef3f2 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 _0x6f76=['Router','env','production','app','get','client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','../config/environment'];(function(_0x5c1906,_0x42435a){var _0x2b340d=function(_0x59a039){while(--_0x59a039){_0x5c1906['push'](_0x5c1906['shift']());}};_0x2b340d(++_0x42435a);}(_0x6f76,0xf5));var _0x66f7=function(_0x293c4e,_0x4f80fb){_0x293c4e=_0x293c4e-0x0;var _0x4550e8=_0x6f76[_0x293c4e];return _0x4550e8;};var beaverLogger=require(_0x66f7('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x66f7('0x1'));var router=express[_0x66f7('0x2')]();var isProduction=config[_0x66f7('0x3')]===_0x66f7('0x4')||![];function clientSideLogs(_0x521725,_0x121bc6,_0x3cb73b){var _0x4d25aa=_0x521725[_0x66f7('0x5')][_0x66f7('0x6')](_0x66f7('0x7'));if(!_0x4d25aa){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x66f7('0x8')]({'uri':_0x66f7('0x9'),'logger':_0x4d25aa,'enableCors':!isProduction})(_0x521725,_0x121bc6,_0x3cb73b);}router[_0x66f7('0xa')](auth[_0x66f7('0xb')](),clientSideLogs);module[_0x66f7('0xc')]=router; \ No newline at end of file +var _0x80ba=['env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express','Router'];(function(_0x5318e3,_0x5553c6){var _0x22b7e2=function(_0x381aa0){while(--_0x381aa0){_0x5318e3['push'](_0x5318e3['shift']());}};_0x22b7e2(++_0x5553c6);}(_0x80ba,0x129));var _0xa80b=function(_0x27c3bf,_0xfd4e1b){_0x27c3bf=_0x27c3bf-0x0;var _0x14cbd2=_0x80ba[_0x27c3bf];return _0x14cbd2;};var beaverLogger=require(_0xa80b('0x0'));var express=require(_0xa80b('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0xa80b('0x2')]();var isProduction=config[_0xa80b('0x3')]===_0xa80b('0x4')||![];function clientSideLogs(_0x79b0d6,_0xfc7a01,_0x40fddf){var _0xae4e0b=_0x79b0d6['app'][_0xa80b('0x5')]('client-side-logger');if(!_0xae4e0b){throw new Error(_0xa80b('0x6'));}return beaverLogger[_0xa80b('0x7')]({'uri':'/client-logs','logger':_0xae4e0b,'enableCors':!isProduction})(_0x79b0d6,_0xfc7a01,_0x40fddf);}router['use'](auth[_0xa80b('0x8')](),clientSideLogs);module[_0xa80b('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7b7f086..45e7439 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 _0x8de3=['STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x3eb2bc,_0x3d4dfe){var _0x1b4d2f=function(_0x5162cb){while(--_0x5162cb){_0x3eb2bc['push'](_0x3eb2bc['shift']());}};_0x1b4d2f(++_0x3d4dfe);}(_0x8de3,0x11c));var _0x38de=function(_0x59fc33,_0x2e182d){_0x59fc33=_0x59fc33-0x0;var _0x39066f=_0x8de3[_0x59fc33];return _0x39066f;};'use strict';var Sequelize=require(_0x38de('0x0'));module[_0x38de('0x1')]={'name':{'type':Sequelize[_0x38de('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x38de('0x3')]('AmazonAWS',_0x38de('0x4'),_0x38de('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x38de('0x3')](_0x38de('0x6'),_0x38de('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x38de('0x2')],'comment':_0x38de('0x8')},'data3':{'type':Sequelize[_0x38de('0x2')],'comment':_0x38de('0x9')},'data4':{'type':Sequelize[_0x38de('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x38de('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x38de('0xa')],'comment':_0x38de('0xb')},'data7':{'type':Sequelize[_0x38de('0xa')],'comment':_0x38de('0xc')}}; \ No newline at end of file +var _0x2b1e=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM'];(function(_0x27ea40,_0x481630){var _0x197a30=function(_0x527650){while(--_0x527650){_0x27ea40['push'](_0x27ea40['shift']());}};_0x197a30(++_0x481630);}(_0x2b1e,0xdb));var _0xe2b1=function(_0xabeecb,_0x4f1ad6){_0xabeecb=_0xabeecb-0x0;var _0x10feb9=_0x2b1e[_0xabeecb];return _0x10feb9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe2b1('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe2b1('0x1')](_0xe2b1('0x2'),_0xe2b1('0x3'),_0xe2b1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe2b1('0x1')](_0xe2b1('0x5'),_0xe2b1('0x6'))},'data1':{'type':Sequelize[_0xe2b1('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe2b1('0x0')],'comment':_0xe2b1('0x7')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xe2b1('0x0')],'comment':_0xe2b1('0x8')},'data5':{'type':Sequelize['TEXT'],'comment':_0xe2b1('0x9')},'data6':{'type':Sequelize[_0xe2b1('0xa')],'comment':_0xe2b1('0xb')},'data7':{'type':Sequelize[_0xe2b1('0xa')],'comment':_0xe2b1('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index fe85842..f37c16c 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 _0x3f64=['getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','limit','offset','count','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','CloudProvider','includeAll','findAll','data3','catch','params','include','find','MicrosoftAzure','decryptString','create','body','service','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','from','base64','ascii','parse','isValidIdToken','id_token','oauth2Claims'];(function(_0xcc0cda,_0x353d30){var _0x4988cd=function(_0x38a5cf){while(--_0x38a5cf){_0xcc0cda['push'](_0xcc0cda['shift']());}};_0x4988cd(++_0x353d30);}(_0x3f64,0xbd));var _0x43f6=function(_0x56dd44,_0x110177){_0x56dd44=_0x56dd44-0x0;var _0x24c3ec=_0x3f64[_0x56dd44];return _0x24c3ec;};'use strict';var _=require(_0x43f6('0x0'));var Redis=require(_0x43f6('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x43f6('0x2'));var config=require(_0x43f6('0x3'));var logger=require(_0x43f6('0x4'))('api');var db=require(_0x43f6('0x5'))['db'];var oauth=require(_0x43f6('0x6'));config[_0x43f6('0x7')]=_['defaults'](config[_0x43f6('0x7')],{'host':_0x43f6('0x8'),'port':0x18eb});var socket=require(_0x43f6('0x9'))(new Redis(config[_0x43f6('0x7')]));var redis=new Redis(config[_0x43f6('0x7')]);function respondWithStatusCode(_0x405643,_0x4834b8){_0x4834b8=_0x4834b8||0xcc;return function(_0x480f24){if(_0x480f24){return _0x405643[_0x43f6('0xa')](_0x4834b8);}return _0x405643[_0x43f6('0xb')](_0x4834b8)['end']();};}function respondWithResult(_0x53b8db,_0x21de26){_0x21de26=_0x21de26||0xc8;return function(_0x41733e){if(_0x41733e){return _0x53b8db[_0x43f6('0xb')](_0x21de26)[_0x43f6('0xc')](_0x41733e);}};}function respondWithFilteredResult(_0x473799,_0x1317da){return function(_0x48d3bc){if(_0x48d3bc){var _0x3a45cf=typeof _0x1317da['offset']==='undefined'&&typeof _0x1317da[_0x43f6('0xd')]==='undefined';var _0x3cc58c=_0x48d3bc['count'];var _0x328029=_0x3a45cf?0x0:_0x1317da[_0x43f6('0xe')];var _0x285cf8=_0x3a45cf?_0x48d3bc[_0x43f6('0xf')]:_0x1317da['offset']+_0x1317da['limit'];var _0x2f9a5e;if(_0x285cf8>=_0x3cc58c){_0x285cf8=_0x3cc58c;_0x2f9a5e=0xc8;}else{_0x2f9a5e=0xce;}_0x473799[_0x43f6('0xb')](_0x2f9a5e);return _0x473799[_0x43f6('0x10')](_0x43f6('0x11'),_0x328029+'-'+_0x285cf8+'/'+_0x3cc58c)['json'](_0x48d3bc);}return null;};}function saveUpdates(_0x287333){return function(_0x3d1592){if(_0x3d1592){return _0x3d1592[_0x43f6('0x12')](_0x287333)[_0x43f6('0x13')](function(_0x5e7b9c){return _0x5e7b9c;});}return null;};}function removeEntity(_0x2657e0){return function(_0x467a92){if(_0x467a92){return _0x467a92[_0x43f6('0x14')]()[_0x43f6('0x13')](function(){_0x2657e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a64c){return function(_0x47eec3){if(!_0x47eec3){_0x28a64c[_0x43f6('0xa')](0x194);}return _0x47eec3;};}function handleError(_0x33f2bf,_0x5dc1c4){_0x5dc1c4=_0x5dc1c4||0x1f4;return function(_0x19f43c){logger[_0x43f6('0x15')](_0x19f43c[_0x43f6('0x16')]);if(_0x19f43c[_0x43f6('0x17')]){delete _0x19f43c['name'];}_0x33f2bf[_0x43f6('0xb')](_0x5dc1c4)[_0x43f6('0x18')](_0x19f43c);};}function maskClientSecret(_0x51efe1){return _[_0x43f6('0x19')](_0x51efe1[_0x43f6('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0xe70aca,_0x3dbaf1){var _0x80b0d3={},_0x488ab4={},_0x2f7c29={'count':0x0,'rows':[]};var _0x59a26e=_[_0x43f6('0x1b')](db['CloudProvider'][_0x43f6('0x1c')],function(_0x4f8b90){return{'name':_0x4f8b90[_0x43f6('0x1d')],'type':_0x4f8b90[_0x43f6('0x1e')]['key']};});_0x488ab4['model']=_[_0x43f6('0x1b')](_0x59a26e,_0x43f6('0x17'));_0x488ab4[_0x43f6('0x1f')]=_[_0x43f6('0x20')](_0xe70aca[_0x43f6('0x1f')]);_0x488ab4[_0x43f6('0x21')]=_[_0x43f6('0x22')](_0x488ab4[_0x43f6('0x23')],_0x488ab4['query']);_0x80b0d3[_0x43f6('0x24')]=_[_0x43f6('0x22')](_0x488ab4[_0x43f6('0x23')],qs[_0x43f6('0x25')](_0xe70aca['query']['fields']));_0x80b0d3[_0x43f6('0x24')]=_0x80b0d3['attributes'][_0x43f6('0x26')]?_0x80b0d3['attributes']:_0x488ab4[_0x43f6('0x23')];if(!_0xe70aca[_0x43f6('0x1f')]['hasOwnProperty'](_0x43f6('0x27'))){_0x80b0d3['limit']=qs['limit'](_0xe70aca[_0x43f6('0x1f')][_0x43f6('0xd')]);_0x80b0d3[_0x43f6('0xe')]=qs[_0x43f6('0xe')](_0xe70aca[_0x43f6('0x1f')][_0x43f6('0xe')]);}_0x80b0d3[_0x43f6('0x28')]=qs[_0x43f6('0x29')](_0xe70aca[_0x43f6('0x1f')]['sort']);_0x80b0d3['where']=qs[_0x43f6('0x21')](_[_0x43f6('0x2a')](_0xe70aca[_0x43f6('0x1f')],_0x488ab4[_0x43f6('0x21')]),_0x59a26e);if(_0xe70aca['query'][_0x43f6('0x2b')]){_0x80b0d3[_0x43f6('0x2c')]=_[_0x43f6('0x2d')](_0x80b0d3[_0x43f6('0x2c')],{'$or':_[_0x43f6('0x1b')](_0x59a26e,function(_0x60787){if(_0x60787[_0x43f6('0x1e')]!=='VIRTUAL'){var _0x29a3bc={};_0x29a3bc[_0x60787[_0x43f6('0x17')]]={'$like':'%'+_0xe70aca[_0x43f6('0x1f')]['filter']+'%'};return _0x29a3bc;}})});}_0x80b0d3=_[_0x43f6('0x2d')]({},_0x80b0d3,_0xe70aca[_0x43f6('0x2e')]);var _0x352157={'where':_0x80b0d3[_0x43f6('0x2c')]};return db[_0x43f6('0x2f')][_0x43f6('0xf')](_0x352157)['then'](function(_0x39a63d){_0x2f7c29['count']=_0x39a63d;if(_0xe70aca[_0x43f6('0x1f')][_0x43f6('0x30')]){_0x80b0d3['include']=[{'all':!![]}];}return db[_0x43f6('0x2f')][_0x43f6('0x31')](_0x80b0d3);})[_0x43f6('0x13')](function(_0x2cd58a){_0x2f7c29['rows']=_['map'](_0x2cd58a,function(_0x306cef){if(_0x306cef['service']==='MicrosoftAzure'){var _0x35d604=encryptor['decryptString'](_0x306cef[_0x43f6('0x32')]);_0x306cef[_0x43f6('0x32')]=maskClientSecret(_0x35d604);}return _0x306cef;});return _0x2f7c29;})[_0x43f6('0x13')](respondWithFilteredResult(_0x3dbaf1,_0x80b0d3))[_0x43f6('0x33')](handleError(_0x3dbaf1,null));};exports['show']=function(_0x35d8db,_0x32d675){var _0x230b7a={'raw':!![],'where':{'id':_0x35d8db[_0x43f6('0x34')]['id']}},_0xff6358={};_0xff6358[_0x43f6('0x23')]=_[_0x43f6('0x20')](db[_0x43f6('0x2f')][_0x43f6('0x1c')]);_0xff6358['query']=_['keys'](_0x35d8db[_0x43f6('0x1f')]);_0xff6358[_0x43f6('0x21')]=_[_0x43f6('0x22')](_0xff6358[_0x43f6('0x23')],_0xff6358[_0x43f6('0x1f')]);_0x230b7a[_0x43f6('0x24')]=_[_0x43f6('0x22')](_0xff6358[_0x43f6('0x23')],qs['fields'](_0x35d8db[_0x43f6('0x1f')][_0x43f6('0x25')]));_0x230b7a[_0x43f6('0x24')]=_0x230b7a[_0x43f6('0x24')][_0x43f6('0x26')]?_0x230b7a[_0x43f6('0x24')]:_0xff6358[_0x43f6('0x23')];if(_0x35d8db[_0x43f6('0x1f')]['includeAll']){_0x230b7a[_0x43f6('0x35')]=[{'all':!![]}];}_0x230b7a=_['merge']({},_0x230b7a,_0x35d8db[_0x43f6('0x2e')]);return db[_0x43f6('0x2f')][_0x43f6('0x36')](_0x230b7a)[_0x43f6('0x13')](handleEntityNotFound(_0x32d675,null))[_0x43f6('0x13')](function(_0xa19b29){if(_0xa19b29['service']===_0x43f6('0x37')){var _0x35d050=encryptor[_0x43f6('0x38')](_0xa19b29[_0x43f6('0x32')]);_0xa19b29[_0x43f6('0x32')]=maskClientSecret(_0x35d050);}return _0xa19b29;})[_0x43f6('0x13')](respondWithResult(_0x32d675,null))[_0x43f6('0x33')](handleError(_0x32d675,null));};exports[_0x43f6('0x39')]=function(_0x36dbdf,_0x509705){if(!_0x36dbdf[_0x43f6('0x3a')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x36dbdf[_0x43f6('0x3a')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x7a7584=db[_0x43f6('0x2f')][_0x43f6('0x1c')][_0x43f6('0x3b')]['values'];if(!_0x7a7584[_0x43f6('0x3c')](_0x36dbdf['body']['service']))throw new Error(_0x43f6('0x3d')+_0x7a7584[_0x43f6('0x3e')](',\x20'));if(_0x36dbdf[_0x43f6('0x3a')][_0x43f6('0x3b')]===_0x43f6('0x37')&&_0x36dbdf[_0x43f6('0x3a')][_0x43f6('0x32')]){_0x36dbdf[_0x43f6('0x3a')][_0x43f6('0x32')]=encryptor[_0x43f6('0x3f')](_0x36dbdf[_0x43f6('0x3a')][_0x43f6('0x32')]);}return db[_0x43f6('0x2f')][_0x43f6('0x39')](_0x36dbdf[_0x43f6('0x3a')],{})[_0x43f6('0x13')](respondWithResult(_0x509705,0xc9))[_0x43f6('0x33')](handleError(_0x509705,null));};exports[_0x43f6('0x12')]=function(_0x48b7eb,_0x152113){if(_0x48b7eb['body']['id']){delete _0x48b7eb[_0x43f6('0x3a')]['id'];}return db[_0x43f6('0x2f')][_0x43f6('0x36')]({'where':{'id':_0x48b7eb['params']['id']}})[_0x43f6('0x13')](handleEntityNotFound(_0x152113,null))['then'](function(_0x222a93){if(_0x222a93[_0x43f6('0x3b')]===_0x43f6('0x37')&&_0x48b7eb[_0x43f6('0x3a')]['data3']){_0x48b7eb[_0x43f6('0x3a')]['data3']=encryptor[_0x43f6('0x3f')](_0x48b7eb[_0x43f6('0x3a')][_0x43f6('0x32')]);}return _0x222a93;})[_0x43f6('0x13')](saveUpdates(_0x48b7eb[_0x43f6('0x3a')],null))[_0x43f6('0x13')](respondWithResult(_0x152113,null))[_0x43f6('0x33')](handleError(_0x152113,null));};exports[_0x43f6('0x14')]=function(_0x4b0b77,_0x41b459){return db[_0x43f6('0x2f')][_0x43f6('0x36')]({'where':{'id':_0x4b0b77[_0x43f6('0x34')]['id']}})['then'](handleEntityNotFound(_0x41b459,null))[_0x43f6('0x13')](removeEntity(_0x41b459,null))['catch'](handleError(_0x41b459,null));};exports[_0x43f6('0x40')]=function(_0x521ad7,_0x319f7b){return db[_0x43f6('0x2f')][_0x43f6('0x41')]({'where':{'id':_0x521ad7[_0x43f6('0x34')]['id']},'raw':!![]})[_0x43f6('0x13')](function(_0x338c5d){if(!_0x338c5d)return _0x319f7b[_0x43f6('0xa')](0x194);return{'url':oauth[_0x43f6('0x42')](_0x338c5d,_0x521ad7[_0x43f6('0x43')]['id'])};})[_0x43f6('0x13')](respondWithResult(_0x319f7b,null))['catch'](handleError(_0x319f7b,null));};exports[_0x43f6('0x44')]=function(_0x2dcfe1,_0x22a550){var _0x4c7ecd=_0x2dcfe1['body'];var _0x16175d;var _0x3360fa;if(_0x4c7ecd[_0x43f6('0x15')])throw _0x4c7ecd;redis[_0x43f6('0x45')](_0x4c7ecd[_0x43f6('0x46')])['then'](function(_0x5ab442){if(!_0x5ab442)throw new Error('Invalid\x20state\x20parameter');_0x16175d=JSON['parse'](_0x5ab442);var _0x4b6989=Buffer[_0x43f6('0x47')](_0x4c7ecd[_0x43f6('0x46')],_0x43f6('0x48'))['toString'](_0x43f6('0x49'));_0x3360fa=JSON[_0x43f6('0x4a')](_0x4b6989);if(!oauth[_0x43f6('0x4b')](_0x4c7ecd[_0x43f6('0x4c')],_0x16175d[_0x43f6('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x4c7ecd[_0x43f6('0x46')]);return oauth[_0x43f6('0x4e')](_0x4c7ecd[_0x43f6('0x4f')],_0x16175d);})[_0x43f6('0x13')](function(_0xfa15db){_0x16175d[_0x43f6('0x50')]=_0xfa15db[_0x43f6('0x51')];_0x16175d['data6']=_0xfa15db['refresh_token'];return db[_0x43f6('0x2f')][_0x43f6('0x12')]({'data5':_0x16175d[_0x43f6('0x50')],'data6':_0x16175d[_0x43f6('0x52')]},{'where':{'id':_0x16175d['id']}});})['then'](function(){oauth[_0x43f6('0x53')](_0x16175d);socket[_0x43f6('0x54')]('microsoftAuthorization:success',{'id':_0x3360fa['id']});return;})[_0x43f6('0x13')](respondWithStatusCode(_0x22a550,null))[_0x43f6('0x33')](function(_0x137ed7){if(_0x3360fa){socket['emit']('microsoftAuthorization:error',{'id':_0x3360fa['id']});}if(!_0x16175d){logger[_0x43f6('0x15')](_0x43f6('0x55'),_0x137ed7);return _0x22a550[_0x43f6('0xb')](0x1f4)[_0x43f6('0x18')](_0x137ed7[_0x43f6('0x56')]);}logger[_0x43f6('0x15')](_0x43f6('0x57'),_0x16175d['id'],JSON[_0x43f6('0x58')](_0x137ed7));});}; \ No newline at end of file +var _0xb38b=['filters','intersection','attributes','query','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','length','options','find','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','destroy','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','parse','from','base64','toString','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys'];(function(_0x188d46,_0x295bf0){var _0x62adb8=function(_0x268cfe){while(--_0x268cfe){_0x188d46['push'](_0x188d46['shift']());}};_0x62adb8(++_0x295bf0);}(_0xb38b,0x163));var _0xbb38=function(_0x8077fc,_0x49010e){_0x8077fc=_0x8077fc-0x0;var _0x4d16fa=_0xb38b[_0x8077fc];return _0x4d16fa;};'use strict';var _=require(_0xbb38('0x0'));var Redis=require(_0xbb38('0x1'));var qs=require(_0xbb38('0x2'));var encryptor=require(_0xbb38('0x3'));var config=require(_0xbb38('0x4'));var logger=require('../../config/logger')(_0xbb38('0x5'));var db=require(_0xbb38('0x6'))['db'];var oauth=require(_0xbb38('0x7'));config['redis']=_[_0xbb38('0x8')](config[_0xbb38('0x9')],{'host':_0xbb38('0xa'),'port':0x18eb});var socket=require(_0xbb38('0xb'))(new Redis(config[_0xbb38('0x9')]));var redis=new Redis(config[_0xbb38('0x9')]);function respondWithStatusCode(_0x3ad985,_0x46081e){_0x46081e=_0x46081e||0xcc;return function(_0x2ce356){if(_0x2ce356){return _0x3ad985[_0xbb38('0xc')](_0x46081e);}return _0x3ad985[_0xbb38('0xd')](_0x46081e)[_0xbb38('0xe')]();};}function respondWithResult(_0x3b12cb,_0x8ec922){_0x8ec922=_0x8ec922||0xc8;return function(_0x1627c0){if(_0x1627c0){return _0x3b12cb[_0xbb38('0xd')](_0x8ec922)['json'](_0x1627c0);}};}function respondWithFilteredResult(_0x28a914,_0x52fd9e){return function(_0x29fa28){if(_0x29fa28){var _0x1b0c73=typeof _0x52fd9e[_0xbb38('0xf')]===_0xbb38('0x10')&&typeof _0x52fd9e[_0xbb38('0x11')]===_0xbb38('0x10');var _0x598929=_0x29fa28[_0xbb38('0x12')];var _0x29b95f=_0x1b0c73?0x0:_0x52fd9e[_0xbb38('0xf')];var _0x11080d=_0x1b0c73?_0x29fa28[_0xbb38('0x12')]:_0x52fd9e['offset']+_0x52fd9e['limit'];var _0x476fbe;if(_0x11080d>=_0x598929){_0x11080d=_0x598929;_0x476fbe=0xc8;}else{_0x476fbe=0xce;}_0x28a914[_0xbb38('0xd')](_0x476fbe);return _0x28a914[_0xbb38('0x13')](_0xbb38('0x14'),_0x29b95f+'-'+_0x11080d+'/'+_0x598929)[_0xbb38('0x15')](_0x29fa28);}return null;};}function saveUpdates(_0x2c63ee){return function(_0x43c5d1){if(_0x43c5d1){return _0x43c5d1[_0xbb38('0x16')](_0x2c63ee)[_0xbb38('0x17')](function(_0x36edde){return _0x36edde;});}return null;};}function removeEntity(_0x3a69e0){return function(_0x122332){if(_0x122332){return _0x122332['destroy']()[_0xbb38('0x17')](function(){_0x3a69e0[_0xbb38('0xd')](0xcc)[_0xbb38('0xe')]();});}};}function handleEntityNotFound(_0xe9e82e){return function(_0xa01ac9){if(!_0xa01ac9){_0xe9e82e['sendStatus'](0x194);}return _0xa01ac9;};}function handleError(_0x4a1ffd,_0x97cd30){_0x97cd30=_0x97cd30||0x1f4;return function(_0x5da99f){logger[_0xbb38('0x18')](_0x5da99f[_0xbb38('0x19')]);if(_0x5da99f[_0xbb38('0x1a')]){delete _0x5da99f['name'];}_0x4a1ffd[_0xbb38('0xd')](_0x97cd30)['send'](_0x5da99f);};}function maskClientSecret(_0x9d135c){return _[_0xbb38('0x1b')](_0x9d135c['slice'](0x0,0x3),0x14,'*');}exports[_0xbb38('0x1c')]=function(_0x32f312,_0x5d4ad1){var _0x1c7a80={},_0x522585={},_0x138d26={'count':0x0,'rows':[]};var _0x4815bc=_[_0xbb38('0x1d')](db[_0xbb38('0x1e')][_0xbb38('0x1f')],function(_0x4db9b7){return{'name':_0x4db9b7[_0xbb38('0x20')],'type':_0x4db9b7[_0xbb38('0x21')][_0xbb38('0x22')]};});_0x522585[_0xbb38('0x23')]=_[_0xbb38('0x1d')](_0x4815bc,_0xbb38('0x1a'));_0x522585['query']=_[_0xbb38('0x24')](_0x32f312['query']);_0x522585[_0xbb38('0x25')]=_[_0xbb38('0x26')](_0x522585[_0xbb38('0x23')],_0x522585['query']);_0x1c7a80[_0xbb38('0x27')]=_[_0xbb38('0x26')](_0x522585[_0xbb38('0x23')],qs['fields'](_0x32f312[_0xbb38('0x28')][_0xbb38('0x29')]));_0x1c7a80[_0xbb38('0x27')]=_0x1c7a80['attributes']['length']?_0x1c7a80[_0xbb38('0x27')]:_0x522585['model'];if(!_0x32f312[_0xbb38('0x28')]['hasOwnProperty'](_0xbb38('0x2a'))){_0x1c7a80['limit']=qs['limit'](_0x32f312['query'][_0xbb38('0x11')]);_0x1c7a80[_0xbb38('0xf')]=qs[_0xbb38('0xf')](_0x32f312[_0xbb38('0x28')]['offset']);}_0x1c7a80[_0xbb38('0x2b')]=qs[_0xbb38('0x2c')](_0x32f312[_0xbb38('0x28')][_0xbb38('0x2c')]);_0x1c7a80['where']=qs[_0xbb38('0x25')](_['pick'](_0x32f312[_0xbb38('0x28')],_0x522585[_0xbb38('0x25')]),_0x4815bc);if(_0x32f312[_0xbb38('0x28')][_0xbb38('0x2d')]){_0x1c7a80[_0xbb38('0x2e')]=_[_0xbb38('0x2f')](_0x1c7a80[_0xbb38('0x2e')],{'$or':_['map'](_0x4815bc,function(_0x4a4f0b){if(_0x4a4f0b[_0xbb38('0x21')]!==_0xbb38('0x30')){var _0x206bdf={};_0x206bdf[_0x4a4f0b[_0xbb38('0x1a')]]={'$like':'%'+_0x32f312['query'][_0xbb38('0x2d')]+'%'};return _0x206bdf;}})});}_0x1c7a80=_[_0xbb38('0x2f')]({},_0x1c7a80,_0x32f312['options']);var _0x1dad0b={'where':_0x1c7a80[_0xbb38('0x2e')]};return db[_0xbb38('0x1e')]['count'](_0x1dad0b)[_0xbb38('0x17')](function(_0x85c070){_0x138d26[_0xbb38('0x12')]=_0x85c070;if(_0x32f312[_0xbb38('0x28')][_0xbb38('0x31')]){_0x1c7a80[_0xbb38('0x32')]=[{'all':!![]}];}return db[_0xbb38('0x1e')][_0xbb38('0x33')](_0x1c7a80);})['then'](function(_0x19660b){_0x138d26[_0xbb38('0x34')]=_[_0xbb38('0x1d')](_0x19660b,function(_0x43dffd){if(_0x43dffd[_0xbb38('0x35')]===_0xbb38('0x36')){var _0x2ed241=encryptor[_0xbb38('0x37')](_0x43dffd[_0xbb38('0x38')]);_0x43dffd[_0xbb38('0x38')]=maskClientSecret(_0x2ed241);}return _0x43dffd;});return _0x138d26;})[_0xbb38('0x17')](respondWithFilteredResult(_0x5d4ad1,_0x1c7a80))[_0xbb38('0x39')](handleError(_0x5d4ad1,null));};exports[_0xbb38('0x3a')]=function(_0x4159f8,_0x1fffc6){var _0x393296={'raw':!![],'where':{'id':_0x4159f8[_0xbb38('0x3b')]['id']}},_0x495b7c={};_0x495b7c[_0xbb38('0x23')]=_[_0xbb38('0x24')](db[_0xbb38('0x1e')][_0xbb38('0x1f')]);_0x495b7c[_0xbb38('0x28')]=_['keys'](_0x4159f8[_0xbb38('0x28')]);_0x495b7c[_0xbb38('0x25')]=_['intersection'](_0x495b7c[_0xbb38('0x23')],_0x495b7c[_0xbb38('0x28')]);_0x393296[_0xbb38('0x27')]=_[_0xbb38('0x26')](_0x495b7c[_0xbb38('0x23')],qs['fields'](_0x4159f8[_0xbb38('0x28')][_0xbb38('0x29')]));_0x393296['attributes']=_0x393296[_0xbb38('0x27')][_0xbb38('0x3c')]?_0x393296[_0xbb38('0x27')]:_0x495b7c[_0xbb38('0x23')];if(_0x4159f8[_0xbb38('0x28')][_0xbb38('0x31')]){_0x393296[_0xbb38('0x32')]=[{'all':!![]}];}_0x393296=_[_0xbb38('0x2f')]({},_0x393296,_0x4159f8[_0xbb38('0x3d')]);return db[_0xbb38('0x1e')][_0xbb38('0x3e')](_0x393296)[_0xbb38('0x17')](handleEntityNotFound(_0x1fffc6,null))[_0xbb38('0x17')](function(_0x225500){if(_0x225500[_0xbb38('0x35')]==='MicrosoftAzure'){var _0x6b6ae2=encryptor['decryptString'](_0x225500[_0xbb38('0x38')]);_0x225500[_0xbb38('0x38')]=maskClientSecret(_0x6b6ae2);}return _0x225500;})['then'](respondWithResult(_0x1fffc6,null))[_0xbb38('0x39')](handleError(_0x1fffc6,null));};exports['create']=function(_0x5d4ab2,_0x28981b){if(!_0x5d4ab2['body'][_0xbb38('0x1a')])throw new Error(_0xbb38('0x3f'));if(!_0x5d4ab2[_0xbb38('0x40')][_0xbb38('0x35')])throw new Error(_0xbb38('0x41'));var _0x506bff=db[_0xbb38('0x1e')]['rawAttributes'][_0xbb38('0x35')][_0xbb38('0x42')];if(!_0x506bff[_0xbb38('0x43')](_0x5d4ab2[_0xbb38('0x40')]['service']))throw new Error(_0xbb38('0x44')+_0x506bff[_0xbb38('0x45')](',\x20'));if(_0x5d4ab2[_0xbb38('0x40')][_0xbb38('0x35')]==='MicrosoftAzure'&&_0x5d4ab2[_0xbb38('0x40')][_0xbb38('0x38')]){_0x5d4ab2[_0xbb38('0x40')][_0xbb38('0x38')]=encryptor[_0xbb38('0x46')](_0x5d4ab2['body'][_0xbb38('0x38')]);}return db[_0xbb38('0x1e')][_0xbb38('0x47')](_0x5d4ab2[_0xbb38('0x40')],{})[_0xbb38('0x17')](respondWithResult(_0x28981b,0xc9))['catch'](handleError(_0x28981b,null));};exports[_0xbb38('0x16')]=function(_0x1045e6,_0x362741){if(_0x1045e6[_0xbb38('0x40')]['id']){delete _0x1045e6[_0xbb38('0x40')]['id'];}return db[_0xbb38('0x1e')][_0xbb38('0x3e')]({'where':{'id':_0x1045e6['params']['id']}})['then'](handleEntityNotFound(_0x362741,null))[_0xbb38('0x17')](function(_0x409c7f){if(_0x409c7f[_0xbb38('0x35')]==='MicrosoftAzure'&&_0x1045e6['body'][_0xbb38('0x38')]){_0x1045e6[_0xbb38('0x40')][_0xbb38('0x38')]=encryptor[_0xbb38('0x46')](_0x1045e6[_0xbb38('0x40')][_0xbb38('0x38')]);}return _0x409c7f;})['then'](saveUpdates(_0x1045e6[_0xbb38('0x40')],null))[_0xbb38('0x17')](respondWithResult(_0x362741,null))[_0xbb38('0x39')](handleError(_0x362741,null));};exports[_0xbb38('0x48')]=function(_0x348f91,_0x4f8570){return db[_0xbb38('0x1e')][_0xbb38('0x3e')]({'where':{'id':_0x348f91[_0xbb38('0x3b')]['id']}})[_0xbb38('0x17')](handleEntityNotFound(_0x4f8570,null))[_0xbb38('0x17')](removeEntity(_0x4f8570,null))[_0xbb38('0x39')](handleError(_0x4f8570,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5b021b,_0x320e5b){return db[_0xbb38('0x1e')][_0xbb38('0x49')]({'where':{'id':_0x5b021b[_0xbb38('0x3b')]['id']},'raw':!![]})[_0xbb38('0x17')](function(_0x3d2d94){if(!_0x3d2d94)return _0x320e5b[_0xbb38('0xc')](0x194);return{'url':oauth[_0xbb38('0x4a')](_0x3d2d94,_0x5b021b['user']['id'])};})[_0xbb38('0x17')](respondWithResult(_0x320e5b,null))[_0xbb38('0x39')](handleError(_0x320e5b,null));};exports[_0xbb38('0x4b')]=function(_0x1b028c,_0x51856f){var _0x4317b5=_0x1b028c[_0xbb38('0x40')];var _0x23bdef;var _0x533bb5;if(_0x4317b5[_0xbb38('0x18')])throw _0x4317b5;redis[_0xbb38('0x4c')](_0x4317b5[_0xbb38('0x4d')])[_0xbb38('0x17')](function(_0x200f60){if(!_0x200f60)throw new Error('Invalid\x20state\x20parameter');_0x23bdef=JSON[_0xbb38('0x4e')](_0x200f60);var _0x4c72d2=Buffer[_0xbb38('0x4f')](_0x4317b5[_0xbb38('0x4d')],_0xbb38('0x50'))[_0xbb38('0x51')](_0xbb38('0x52'));_0x533bb5=JSON[_0xbb38('0x4e')](_0x4c72d2);if(!oauth[_0xbb38('0x53')](_0x4317b5[_0xbb38('0x54')],_0x23bdef['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xbb38('0x55')](_0x4317b5['state']);return oauth[_0xbb38('0x56')](_0x4317b5[_0xbb38('0x57')],_0x23bdef);})[_0xbb38('0x17')](function(_0x552a4f){_0x23bdef[_0xbb38('0x58')]=_0x552a4f[_0xbb38('0x59')];_0x23bdef[_0xbb38('0x5a')]=_0x552a4f[_0xbb38('0x5b')];return db['CloudProvider'][_0xbb38('0x16')]({'data5':_0x23bdef['data5'],'data6':_0x23bdef[_0xbb38('0x5a')]},{'where':{'id':_0x23bdef['id']}});})['then'](function(){oauth[_0xbb38('0x5c')](_0x23bdef);socket[_0xbb38('0x5d')](_0xbb38('0x5e'),{'id':_0x533bb5['id']});return;})[_0xbb38('0x17')](respondWithStatusCode(_0x51856f,null))[_0xbb38('0x39')](function(_0x1ecee5){if(_0x533bb5){socket[_0xbb38('0x5d')](_0xbb38('0x5f'),{'id':_0x533bb5['id']});}if(!_0x23bdef){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x1ecee5);return _0x51856f[_0xbb38('0xd')](0x1f4)['send'](_0x1ecee5[_0xbb38('0x60')]);}logger[_0xbb38('0x18')](_0xbb38('0x61'),_0x23bdef['id'],JSON['stringify'](_0x1ecee5));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7312bf6..7862d7e 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 _0x5ee9=['cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x38df93,_0x1745db){var _0x3b4abd=function(_0x3b2e22){while(--_0x3b2e22){_0x38df93['push'](_0x38df93['shift']());}};_0x3b4abd(++_0x1745db);}(_0x5ee9,0x187));var _0x95ee=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5ee9[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var logger=require(_0x95ee('0x2'))(_0x95ee('0x3'));var moment=require(_0x95ee('0x4'));var BPromise=require(_0x95ee('0x5'));var rp=require(_0x95ee('0x6'));var fs=require('fs');var path=require(_0x95ee('0x7'));var rimraf=require(_0x95ee('0x8'));var config=require(_0x95ee('0x9'));var attributes=require(_0x95ee('0xa'));module[_0x95ee('0xb')]=function(_0x24065b,_0x1b833f){return _0x24065b['define']('CloudProvider',attributes,{'tableName':_0x95ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd341=['cloud_providers','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x529966,_0x25c320){var _0xe643a7=function(_0x39433b){while(--_0x39433b){_0x529966['push'](_0x529966['shift']());}};_0xe643a7(++_0x25c320);}(_0xd341,0x121));var _0x1d34=function(_0x10241c,_0x23677b){_0x10241c=_0x10241c-0x0;var _0x2c3eee=_0xd341[_0x10241c];return _0x2c3eee;};'use strict';var _=require('lodash');var util=require(_0x1d34('0x0'));var logger=require(_0x1d34('0x1'))(_0x1d34('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d34('0x3'));var fs=require('fs');var path=require(_0x1d34('0x4'));var rimraf=require(_0x1d34('0x5'));var config=require(_0x1d34('0x6'));var attributes=require(_0x1d34('0x7'));module[_0x1d34('0x8')]=function(_0x5a190a,_0x483f5b){return _0x5a190a[_0x1d34('0x9')](_0x1d34('0xa'),attributes,{'tableName':_0x1d34('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 c53d8b6..e389dc5 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 _0xebf3=['oauth2Claims','oauth2/','set','payload','issuer','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','catch','inspect','exports','lodash','crypto','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','stringify','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','scope','state','nonce','login','key'];(function(_0x3e5c74,_0x95bce8){var _0x5a45ad=function(_0x18b939){while(--_0x18b939){_0x3e5c74['push'](_0x3e5c74['shift']());}};_0x5a45ad(++_0x95bce8);}(_0xebf3,0x147));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var crypto=require(_0x3ebf('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x3ebf('0x2'));var encryptor=require(_0x3ebf('0x3'));var config=require(_0x3ebf('0x4'));var logger=require(_0x3ebf('0x5'))('api');var schedule=require(_0x3ebf('0x6'));var db=require(_0x3ebf('0x7'))['db'];config[_0x3ebf('0x8')]=_[_0x3ebf('0x9')](config[_0x3ebf('0x8')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x3ebf('0x8')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x3ebf('0xa'),_0x3ebf('0xb'),_0x3ebf('0xc'),_0x3ebf('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x3ebf('0xe')],'Dynamics365':[_0x3ebf('0xa'),_0x3ebf('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x3ebf('0xf');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x16b297){var _0x168eba=_[_0x3ebf('0x10')](AZURE_AUTH_SCOPES[_0x16b297[_0x3ebf('0x11')]]);if(_0x16b297[_0x3ebf('0x11')]===_0x3ebf('0x12'))_0x168eba[_0x3ebf('0x13')](_0x16b297['data7']+_0x3ebf('0x14'));return _0x168eba[_0x3ebf('0x15')]('\x20');}function getAccessTokenScope(_0x444ea1){if(_0x444ea1[_0x3ebf('0x11')]===_0x3ebf('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x444ea1[_0x3ebf('0x11')]==='Dynamics365')return _0x444ea1[_0x3ebf('0x17')]+_0x3ebf('0x14');}function generateMicrosoftAuthorizationUrl(_0x4b9530,_0x477e31){var _0x35fffd=MICROSOFT_AUTH_URL[_0x3ebf('0x18')](_0x3ebf('0x19'),_0x4b9530[_0x3ebf('0x1a')]);var _0xf1f3f1=[_0x3ebf('0x1b'),_0x3ebf('0x1c')];var _0x33f1b4=Buffer['from'](JSON[_0x3ebf('0x1d')]({'id':_0x477e31}))['toString']('base64');var _0x1cee42=crypto[_0x3ebf('0x1e')](0x10)[_0x3ebf('0x1f')](_0x3ebf('0x20'));var _0xaaf544=getAuthorizationScopes(_0x4b9530);var _0x352562=[{'key':_0x3ebf('0x21'),'value':_0x4b9530[_0x3ebf('0x22')]},{'key':_0x3ebf('0x23'),'value':encodeURIComponent(_0xf1f3f1[_0x3ebf('0x15')]('\x20'))},{'key':_0x3ebf('0x24'),'value':_0x4b9530[_0x3ebf('0x25')]},{'key':'response_mode','value':'form_post'},{'key':_0x3ebf('0x26'),'value':encodeURIComponent(_0xaaf544)},{'key':_0x3ebf('0x27'),'value':_0x33f1b4},{'key':_0x3ebf('0x28'),'value':_0x1cee42},{'key':'prompt','value':_0x3ebf('0x29')}];var _0x2d2244=_0x35fffd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3ebf('0x10')](_0x352562,function(_0x5491bd){return _0x5491bd[_0x3ebf('0x2a')]+'='+_0x5491bd['value'];})['join']('&');_0x4b9530[_0x3ebf('0x2b')]={'issuer':_0x35fffd[_0x3ebf('0x18')](_0x3ebf('0x2c'),''),'audience':_0x4b9530['data1'],'state':_0x33f1b4,'nonce':_0x1cee42};redis[_0x3ebf('0x2d')](_0x33f1b4,JSON[_0x3ebf('0x1d')](_0x4b9530));return _0x2d2244;}function isValidIdToken(_0x7b7a16,_0x3d79d4){try{var _0x4c2f99=jwt['decode'](_0x7b7a16,{'complete':!![]});var _0x358640=_0x4c2f99[_0x3ebf('0x2e')];if(_0x358640['iss']!==_0x3d79d4[_0x3ebf('0x2f')])return![];if(_0x358640['aud']!==_0x3d79d4[_0x3ebf('0x30')])return![];if(_0x358640[_0x3ebf('0x28')]!==_0x3d79d4['nonce'])return![];if(moment()[_0x3ebf('0x31')](moment[_0x3ebf('0x32')](_0x358640[_0x3ebf('0x33')])))return![];return!![];}catch(_0x43971e){throw _0x43971e;}}function refreshOauth2MicrosoftAccessToken(_0x217da5){return Promise[_0x3ebf('0x34')]()[_0x3ebf('0x35')](function(){if(_0x217da5[_0x3ebf('0x36')])return _0x217da5;return db[_0x3ebf('0x37')][_0x3ebf('0x38')]({'where':{'id':_0x217da5['id']},'raw':!![]});})[_0x3ebf('0x35')](function(_0x5180b0){var _0x29a90d={'grant_type':_0x3ebf('0x39'),'refresh_token':_0x5180b0[_0x3ebf('0x3a')],'scope':getAccessTokenScope(_0x5180b0),'redirect_uri':_0x5180b0[_0x3ebf('0x25')],'client_id':_0x5180b0[_0x3ebf('0x22')],'client_secret':encryptor[_0x3ebf('0x3b')](_0x5180b0['data3'])};var _0xd4bc19={'method':_0x3ebf('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0x3ebf('0x19'),_0x5180b0[_0x3ebf('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x29a90d,'json':!![]};return rp(_0xd4bc19);})[_0x3ebf('0x35')](function(_0x31e1de){_0x217da5[_0x3ebf('0x3d')]=_0x31e1de[_0x3ebf('0x3e')];_0x217da5[_0x3ebf('0x3a')]=_0x31e1de[_0x3ebf('0x39')];return db['CloudProvider'][_0x3ebf('0x3f')]({'data5':_0x217da5[_0x3ebf('0x3d')],'data6':_0x217da5[_0x3ebf('0x3a')]},{'where':{'id':_0x217da5['id']}});})['then'](function(){return _0x217da5;})['catch'](function(_0x48cfdd){logger[_0x3ebf('0x40')](_0x3ebf('0x41'),_0x217da5['id'],_0x48cfdd);});}function getOauth2MicrosoftAccessToken(_0x4200b3,_0x504718){var _0x5d9bd6={'grant_type':_0x3ebf('0x42'),'code':_0x4200b3,'scope':getAccessTokenScope(_0x504718),'redirect_uri':_0x504718['data4'],'client_id':_0x504718[_0x3ebf('0x22')],'client_secret':encryptor[_0x3ebf('0x3b')](_0x504718['data3'])};var _0x31f9ef={'method':_0x3ebf('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0x3ebf('0x19'),_0x504718[_0x3ebf('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d9bd6,'json':!![]};return rp(_0x31f9ef);}function startRefreshInterval(_0x43cb57){var _0x12efc4=schedule[_0x3ebf('0x43')];if(_0x12efc4[_0x43cb57['id']])clearInterval(_0x12efc4[_0x43cb57['id']]);_0x12efc4[_0x43cb57['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3ebf('0x44')](this,{'id':_0x43cb57['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x12efc4;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x3ebf('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3ebf('0x35')](function(_0x48221d){var _0x3991fc=_0x48221d[_0x3ebf('0x10')](function(_0x220880){return refreshOauth2MicrosoftAccessToken(_0x220880)['then'](function(_0x5358d1){startRefreshInterval(_0x5358d1);});});return Promise[_0x3ebf('0x46')](_0x3991fc);})[_0x3ebf('0x47')](function(_0x27a40d){var _0x452c4f=_0x27a40d?util[_0x3ebf('0x48')](_0x27a40d,{'showHidden':![],'depth':null}):'';logger[_0x3ebf('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x452c4f);});}module[_0x3ebf('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xd11a=['response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','key','value','oauth2/','set','decode','payload','iss','issuer','aud','audience','unix','exp','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','update','catch','authorization_code','intervals','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','randomBytes','hex','client_id','data1'];(function(_0x2a597f,_0x19e010){var _0x2917d8=function(_0x58e509){while(--_0x58e509){_0x2a597f['push'](_0x2a597f['shift']());}};_0x2917d8(++_0x19e010);}(_0xd11a,0x156));var _0xad11=function(_0x4723df,_0x10910e){_0x4723df=_0x4723df-0x0;var _0x5d240d=_0xd11a[_0x4723df];return _0x5d240d;};'use strict';var _=require('lodash');var crypto=require(_0xad11('0x0'));var jwt=require(_0xad11('0x1'));var moment=require(_0xad11('0x2'));var Redis=require('ioredis');var rp=require(_0xad11('0x3'));var util=require(_0xad11('0x4'));var encryptor=require(_0xad11('0x5'));var config=require(_0xad11('0x6'));var logger=require(_0xad11('0x7'))(_0xad11('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xad11('0x9'))['db'];config['redis']=_['defaults'](config[_0xad11('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xad11('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xad11('0xb'),_0xad11('0xc'),_0xad11('0xd'),_0xad11('0xe'),_0xad11('0xf'),_0xad11('0x10'),_0xad11('0x11')],'Dynamics365':[_0xad11('0xb'),_0xad11('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xad11('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1c8c42){var _0x2e1e37=_[_0xad11('0x13')](AZURE_AUTH_SCOPES[_0x1c8c42[_0xad11('0x14')]]);if(_0x1c8c42[_0xad11('0x14')]===_0xad11('0x15'))_0x2e1e37[_0xad11('0x16')](_0x1c8c42[_0xad11('0x17')]+_0xad11('0x18'));return _0x2e1e37[_0xad11('0x19')]('\x20');}function getAccessTokenScope(_0x5527e9){if(_0x5527e9['type']===_0xad11('0x1a'))return _0xad11('0xf');if(_0x5527e9['type']===_0xad11('0x15'))return _0x5527e9[_0xad11('0x17')]+_0xad11('0x18');}function generateMicrosoftAuthorizationUrl(_0x4abb51,_0x3d8d99){var _0x19c6b6=MICROSOFT_AUTH_URL[_0xad11('0x1b')](_0xad11('0x1c'),_0x4abb51[_0xad11('0x1d')]);var _0x599dc1=[_0xad11('0x1e'),'id_token'];var _0x1470ec=Buffer[_0xad11('0x1f')](JSON[_0xad11('0x20')]({'id':_0x3d8d99}))[_0xad11('0x21')]('base64');var _0x571b05=crypto[_0xad11('0x22')](0x10)[_0xad11('0x21')](_0xad11('0x23'));var _0x296b75=getAuthorizationScopes(_0x4abb51);var _0x1abaf0=[{'key':_0xad11('0x24'),'value':_0x4abb51[_0xad11('0x25')]},{'key':_0xad11('0x26'),'value':encodeURIComponent(_0x599dc1[_0xad11('0x19')]('\x20'))},{'key':_0xad11('0x27'),'value':_0x4abb51[_0xad11('0x28')]},{'key':_0xad11('0x29'),'value':_0xad11('0x2a')},{'key':_0xad11('0x2b'),'value':encodeURIComponent(_0x296b75)},{'key':_0xad11('0x2c'),'value':_0x1470ec},{'key':_0xad11('0x2d'),'value':_0x571b05},{'key':'prompt','value':'login'}];var _0x4e218a=_0x19c6b6+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xad11('0x13')](_0x1abaf0,function(_0x13d468){return _0x13d468[_0xad11('0x2e')]+'='+_0x13d468[_0xad11('0x2f')];})[_0xad11('0x19')]('&');_0x4abb51['oauth2Claims']={'issuer':_0x19c6b6['replace'](_0xad11('0x30'),''),'audience':_0x4abb51[_0xad11('0x25')],'state':_0x1470ec,'nonce':_0x571b05};redis[_0xad11('0x31')](_0x1470ec,JSON[_0xad11('0x20')](_0x4abb51));return _0x4e218a;}function isValidIdToken(_0x516087,_0x88d71a){try{var _0x25b73c=jwt[_0xad11('0x32')](_0x516087,{'complete':!![]});var _0x3294bd=_0x25b73c[_0xad11('0x33')];if(_0x3294bd[_0xad11('0x34')]!==_0x88d71a[_0xad11('0x35')])return![];if(_0x3294bd[_0xad11('0x36')]!==_0x88d71a[_0xad11('0x37')])return![];if(_0x3294bd[_0xad11('0x2d')]!==_0x88d71a[_0xad11('0x2d')])return![];if(moment()['isAfter'](moment[_0xad11('0x38')](_0x3294bd[_0xad11('0x39')])))return![];return!![];}catch(_0x3cb58d){throw _0x3cb58d;}}function refreshOauth2MicrosoftAccessToken(_0x1b2397){return Promise['resolve']()[_0xad11('0x3a')](function(){if(_0x1b2397[_0xad11('0x3b')])return _0x1b2397;return db[_0xad11('0x3c')][_0xad11('0x3d')]({'where':{'id':_0x1b2397['id']},'raw':!![]});})['then'](function(_0x54518c){var _0x10e062={'grant_type':_0xad11('0x3e'),'refresh_token':_0x54518c[_0xad11('0x3f')],'scope':getAccessTokenScope(_0x54518c),'redirect_uri':_0x54518c[_0xad11('0x28')],'client_id':_0x54518c[_0xad11('0x25')],'client_secret':encryptor[_0xad11('0x40')](_0x54518c[_0xad11('0x3b')])};var _0x55de40={'method':_0xad11('0x41'),'uri':MICROSOFT_AUTH_URL[_0xad11('0x1b')](_0xad11('0x1c'),_0x54518c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x10e062,'json':!![]};return rp(_0x55de40);})[_0xad11('0x3a')](function(_0x255315){_0x1b2397[_0xad11('0x42')]=_0x255315['access_token'];_0x1b2397['data6']=_0x255315['refresh_token'];return db[_0xad11('0x3c')][_0xad11('0x43')]({'data5':_0x1b2397[_0xad11('0x42')],'data6':_0x1b2397[_0xad11('0x3f')]},{'where':{'id':_0x1b2397['id']}});})[_0xad11('0x3a')](function(){return _0x1b2397;})[_0xad11('0x44')](function(_0x2364f8){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x1b2397['id'],_0x2364f8);});}function getOauth2MicrosoftAccessToken(_0x1d21a1,_0x4ba858){var _0x391f03={'grant_type':_0xad11('0x45'),'code':_0x1d21a1,'scope':getAccessTokenScope(_0x4ba858),'redirect_uri':_0x4ba858[_0xad11('0x28')],'client_id':_0x4ba858['data1'],'client_secret':encryptor['decryptString'](_0x4ba858['data3'])};var _0x1490c1={'method':_0xad11('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0xad11('0x1c'),_0x4ba858['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x391f03,'json':!![]};return rp(_0x1490c1);}function startRefreshInterval(_0x2643b8){var _0x244fbd=schedule['intervals'];if(_0x244fbd[_0x2643b8['id']])clearInterval(_0x244fbd[_0x2643b8['id']]);_0x244fbd[_0x2643b8['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x2643b8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xad11('0x46')]=_0x244fbd;}function startAllRefreshIntervals(){return db[_0xad11('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x5c94eb){var _0x40d6f6=_0x5c94eb[_0xad11('0x13')](function(_0x5ab9bf){return refreshOauth2MicrosoftAccessToken(_0x5ab9bf)[_0xad11('0x3a')](function(_0x51e798){startRefreshInterval(_0x51e798);});});return Promise[_0xad11('0x47')](_0x40d6f6);})[_0xad11('0x44')](function(_0x54ba61){var _0x30dcd1=_0x54ba61?util[_0xad11('0x48')](_0x54ba61,{'showHidden':![],'depth':null}):'';logger[_0xad11('0x49')](_0xad11('0x4a'),_0x30dcd1);});}module[_0xad11('0x4b')]={'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 31e1178..ec5fa2e 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 _0x762e=['CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x33bf36,_0xfb40b6){var _0x1921a9=function(_0x1e1009){while(--_0x1e1009){_0x33bf36['push'](_0x33bf36['shift']());}};_0x1921a9(++_0xfb40b6);}(_0x762e,0xea));var _0xe762=function(_0x2caa50,_0x2c936c){_0x2caa50=_0x2caa50-0x0;var _0x47a23f=_0x762e[_0x2caa50];return _0x47a23f;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4726,_0x7a1740,_0x2511ad){return new BPromise(function(_0xf20548,_0x26a4fc){return client[_0xe762('0x8')](_0x1f4726,_0x2511ad)['then'](function(_0x50dd96){logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));logger[_0xe762('0xc')](_0xe762('0xd'),_0x7a1740,_0xe762('0xb'),JSON['stringify'](_0x50dd96));if(_0x50dd96[_0xe762('0xe')]){if(_0x50dd96[_0xe762('0xe')][_0xe762('0xf')]===0x1f4){logger['error'](_0xe762('0xa'),_0x7a1740,_0x50dd96['error'][_0xe762('0x10')]);return _0x26a4fc(_0x50dd96['error'][_0xe762('0x10')]);}logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x50dd96['error']['message']);return _0xf20548(_0x50dd96[_0xe762('0xe')][_0xe762('0x10')]);}else{logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));_0xf20548(_0x50dd96[_0xe762('0x11')][_0xe762('0x10')]);}})[_0xe762('0x12')](function(_0x531587){logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x531587);_0x26a4fc(_0x531587);});});} \ No newline at end of file +var _0x6257=['info','request\x20sent','debug','code','message','error','CloudProvider,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x6257,0x1d4));var _0x7625=function(_0xdf62ba,_0x739410){_0xdf62ba=_0xdf62ba-0x0;var _0x3eac73=_0x6257[_0xdf62ba];return _0x3eac73;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6b884d6..aa5d69c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x27b563,_0x4ead98){var _0x22aae0=function(_0x22e04e){while(--_0x22e04e){_0x27b563['push'](_0x27b563['shift']());}};_0x22aae0(++_0x4ead98);}(_0xdb28,0x106));var _0x8db2=function(_0x5bb080,_0x3d6c47){_0x5bb080=_0x5bb080-0x0;var _0xb75fc2=_0xdb28[_0x5bb080];return _0xb75fc2;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x10f8fb,_0x1748be){var _0x81292e=function(_0x525ec7){while(--_0x525ec7){_0x10f8fb['push'](_0x10f8fb['shift']());}};_0x81292e(++_0x1748be);}(_0xdb28,0x106));var _0x8db2=function(_0x39d434,_0x4b85a2){_0x39d434=_0x39d434-0x0;var _0x3ada07=_0xdb28[_0x39d434];return _0x3ada07;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 82222f3..610cc3a 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 _0x1744=['STRING','name','sequelize'];(function(_0x4834c7,_0x320620){var _0x597940=function(_0x58ece4){while(--_0x58ece4){_0x4834c7['push'](_0x4834c7['shift']());}};_0x597940(++_0x320620);}(_0x1744,0xa1));var _0x4174=function(_0x5dfbe2,_0x23dd83){_0x5dfbe2=_0x5dfbe2-0x0;var _0x56f520=_0x1744[_0x5dfbe2];return _0x56f520;};'use strict';var Sequelize=require(_0x4174('0x0'));module['exports']={'name':{'type':Sequelize[_0x4174('0x1')],'unique':_0x4174('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4174('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4174('0x1')]},'phone':{'type':Sequelize[_0x4174('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4174('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4174('0x1')]},'country':{'type':Sequelize[_0x4174('0x1')]},'email':{'type':Sequelize[_0x4174('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4174('0x1')]},'sStreet':{'type':Sequelize[_0x4174('0x1')]},'sPostalCode':{'type':Sequelize[_0x4174('0x1')]},'sCity':{'type':Sequelize[_0x4174('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4174('0x1')]}}; \ No newline at end of file +var _0x7192=['exports','STRING','name'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x7192,0x1ad));var _0x2719=function(_0x3fd4c5,_0x530fdb){_0x3fd4c5=_0x3fd4c5-0x0;var _0x4eb8f2=_0x7192[_0x3fd4c5];return _0x4eb8f2;};'use strict';var Sequelize=require('sequelize');module[_0x2719('0x0')]={'name':{'type':Sequelize[_0x2719('0x1')],'unique':_0x2719('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x2719('0x1')]},'website':{'type':Sequelize[_0x2719('0x1')]},'phone':{'type':Sequelize[_0x2719('0x1')]},'fax':{'type':Sequelize[_0x2719('0x1')]},'type':{'type':Sequelize[_0x2719('0x1')]},'street':{'type':Sequelize[_0x2719('0x1')]},'postalCode':{'type':Sequelize[_0x2719('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2719('0x1')]},'email':{'type':Sequelize[_0x2719('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2719('0x1')]},'sStreet':{'type':Sequelize[_0x2719('0x1')]},'sPostalCode':{'type':Sequelize[_0x2719('0x1')]},'sCity':{'type':Sequelize[_0x2719('0x1')]},'sCountry':{'type':Sequelize[_0x2719('0x1')]},'description':{'type':Sequelize[_0x2719('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e088f77..9b864a0 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 _0x8d26=['send','index','CmCompany','describe','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','findOne','rawAttributes','length','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name'];(function(_0x578a6a,_0x3176b4){var _0x346e31=function(_0x201209){while(--_0x201209){_0x578a6a['push'](_0x578a6a['shift']());}};_0x346e31(++_0x3176b4);}(_0x8d26,0x1d8));var _0x68d2=function(_0x4346aa,_0x1e597e){_0x4346aa=_0x4346aa-0x0;var _0x31a809=_0x8d26[_0x4346aa];return _0x31a809;};'use strict';var emlformat=require(_0x68d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68d2('0x1'));var jsonpatch=require(_0x68d2('0x2'));var rp=require(_0x68d2('0x3'));var moment=require(_0x68d2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x68d2('0x5'));var sox=require(_0x68d2('0x6'));var csv=require(_0x68d2('0x7'));var ejs=require(_0x68d2('0x8'));var fs=require('fs');var fs_extra=require(_0x68d2('0x9'));var _=require(_0x68d2('0xa'));var squel=require(_0x68d2('0xb'));var crypto=require(_0x68d2('0xc'));var jsforce=require(_0x68d2('0xd'));var deskjs=require(_0x68d2('0xe'));var toCsv=require(_0x68d2('0x7'));var querystring=require('querystring');var Papa=require(_0x68d2('0xf'));var Redis=require(_0x68d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x68d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68d2('0x12'));var logger=require('../../config/logger')(_0x68d2('0x13'));var utils=require(_0x68d2('0x14'));var config=require(_0x68d2('0x15'));var licenseUtil=require(_0x68d2('0x16'));var db=require(_0x68d2('0x17'))['db'];function respondWithStatusCode(_0x2cfba1,_0x333767){_0x333767=_0x333767||0xcc;return function(_0x450284){if(_0x450284){return _0x2cfba1[_0x68d2('0x18')](_0x333767);}return _0x2cfba1['status'](_0x333767)[_0x68d2('0x19')]();};}function respondWithResult(_0x331ebe,_0x1a5a63){_0x1a5a63=_0x1a5a63||0xc8;return function(_0x359418){if(_0x359418){return _0x331ebe[_0x68d2('0x1a')](_0x1a5a63)['json'](_0x359418);}};}function respondWithFilteredResult(_0x460a4b,_0x3e02f1){return function(_0x56039d){if(_0x56039d){var _0x4c7989=typeof _0x3e02f1['offset']===_0x68d2('0x1b')&&typeof _0x3e02f1[_0x68d2('0x1c')]===_0x68d2('0x1b');var _0x35ca01=_0x56039d[_0x68d2('0x1d')];var _0x77d237=_0x4c7989?0x0:_0x3e02f1[_0x68d2('0x1e')];var _0x5e8b42=_0x4c7989?_0x56039d[_0x68d2('0x1d')]:_0x3e02f1[_0x68d2('0x1e')]+_0x3e02f1[_0x68d2('0x1c')];var _0x51b7f8;if(_0x5e8b42>=_0x35ca01){_0x5e8b42=_0x35ca01;_0x51b7f8=0xc8;}else{_0x51b7f8=0xce;}_0x460a4b[_0x68d2('0x1a')](_0x51b7f8);return _0x460a4b['set'](_0x68d2('0x1f'),_0x77d237+'-'+_0x5e8b42+'/'+_0x35ca01)[_0x68d2('0x20')](_0x56039d);}return null;};}function patchUpdates(_0x11c212){return function(_0x31a19b){try{jsonpatch[_0x68d2('0x21')](_0x31a19b,_0x11c212,!![]);}catch(_0x9eefa0){return BPromise['reject'](_0x9eefa0);}return _0x31a19b[_0x68d2('0x22')]();};}function saveUpdates(_0x20407e,_0xa443d8){return function(_0x49f53e){if(_0x49f53e){return _0x49f53e[_0x68d2('0x23')](_0x20407e)[_0x68d2('0x24')](function(_0x4e8e44){return _0x4e8e44;});}return null;};}function removeEntity(_0x17225e,_0x36d7bb){return function(_0x1bb65c){if(_0x1bb65c){return _0x1bb65c[_0x68d2('0x25')]()[_0x68d2('0x24')](function(){var _0x52f29c=_0x1bb65c[_0x68d2('0x26')]({'plain':!![]});var _0x1dabee=_0x68d2('0x27');return db[_0x68d2('0x28')][_0x68d2('0x25')]({'where':{'type':_0x1dabee,'resourceId':_0x52f29c['id']}})[_0x68d2('0x24')](function(){return _0x1bb65c;});})[_0x68d2('0x24')](function(){_0x17225e[_0x68d2('0x1a')](0xcc)[_0x68d2('0x19')]();});}};}function handleEntityNotFound(_0x4f6c4c,_0x5dd205){return function(_0x6bb765){if(!_0x6bb765){_0x4f6c4c[_0x68d2('0x18')](0x194);}return _0x6bb765;};}function handleError(_0x183333,_0x497787){_0x497787=_0x497787||0x1f4;return function(_0x3a474a){logger[_0x68d2('0x29')](_0x3a474a[_0x68d2('0x2a')]);if(_0x3a474a[_0x68d2('0x2b')]){delete _0x3a474a[_0x68d2('0x2b')];}_0x183333[_0x68d2('0x1a')](_0x497787)[_0x68d2('0x2c')](_0x3a474a);};}exports[_0x68d2('0x2d')]=function(_0x4a3031,_0x16e5ce){var _0x46b0fa={},_0x1e3bbb={},_0x2c6556={'count':0x0,'rows':[]};return db[_0x68d2('0x2e')][_0x68d2('0x2f')]()[_0x68d2('0x24')](function(_0x47603a){_0x1e3bbb[_0x68d2('0x30')]=_['keys'](_0x47603a);_0x1e3bbb['query']=_[_0x68d2('0x31')](_0x4a3031['query']);_0x1e3bbb[_0x68d2('0x32')]=_[_0x68d2('0x33')](_0x1e3bbb[_0x68d2('0x30')],_0x1e3bbb[_0x68d2('0x34')]);_0x46b0fa[_0x68d2('0x35')]=_[_0x68d2('0x33')](_0x1e3bbb[_0x68d2('0x30')],qs[_0x68d2('0x36')](_0x4a3031['query']['fields']));_0x46b0fa[_0x68d2('0x35')]=_0x46b0fa[_0x68d2('0x35')]['length']?_0x46b0fa[_0x68d2('0x35')]:_0x1e3bbb[_0x68d2('0x30')];if(!_0x4a3031[_0x68d2('0x34')][_0x68d2('0x37')](_0x68d2('0x38'))){_0x46b0fa[_0x68d2('0x1c')]=qs[_0x68d2('0x1c')](_0x4a3031['query']['limit']);_0x46b0fa[_0x68d2('0x1e')]=qs[_0x68d2('0x1e')](_0x4a3031[_0x68d2('0x34')][_0x68d2('0x1e')]);}_0x46b0fa['order']=qs[_0x68d2('0x39')](_0x4a3031['query'][_0x68d2('0x39')]);_0x46b0fa[_0x68d2('0x3a')]=qs[_0x68d2('0x32')](_[_0x68d2('0x3b')](_0x4a3031[_0x68d2('0x34')],_0x1e3bbb['filters']),_0x47603a);if(_0x4a3031[_0x68d2('0x34')][_0x68d2('0x3c')]){_0x46b0fa[_0x68d2('0x3a')]=_[_0x68d2('0x3d')](_0x46b0fa[_0x68d2('0x3a')],{'$or':_[_0x68d2('0x3e')](_0x46b0fa[_0x68d2('0x35')],function(_0x2910b0){var _0x591c62={};_0x591c62[_0x2910b0]={'$like':'%'+_0x4a3031[_0x68d2('0x34')][_0x68d2('0x3c')]+'%'};return _0x591c62;})});}_0x46b0fa=_[_0x68d2('0x3d')]({},_0x46b0fa,_0x4a3031[_0x68d2('0x3f')]);var _0x5c30a2={'where':_0x46b0fa[_0x68d2('0x3a')]};return db['CmCompany'][_0x68d2('0x1d')](_0x5c30a2)[_0x68d2('0x24')](function(_0x2449f7){_0x2c6556[_0x68d2('0x1d')]=_0x2449f7;if(_0x4a3031[_0x68d2('0x34')][_0x68d2('0x40')]){_0x46b0fa[_0x68d2('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x68d2('0x42')](_0x46b0fa);})['then'](function(_0x5031c1){_0x2c6556['rows']=_0x5031c1;return _0x2c6556;})[_0x68d2('0x24')](respondWithFilteredResult(_0x16e5ce,_0x46b0fa))['catch'](handleError(_0x16e5ce,null));})[_0x68d2('0x43')](handleError(_0x16e5ce,null));};exports[_0x68d2('0x44')]=function(_0x370631,_0x510fe7){var _0x181932={'raw':![],'where':{'id':_0x370631[_0x68d2('0x45')]['id']}},_0x353e48={};_0x353e48['model']=_[_0x68d2('0x31')](db[_0x68d2('0x2e')]['rawAttributes']);_0x353e48[_0x68d2('0x34')]=_[_0x68d2('0x31')](_0x370631[_0x68d2('0x34')]);_0x353e48[_0x68d2('0x32')]=_[_0x68d2('0x33')](_0x353e48[_0x68d2('0x30')],_0x353e48[_0x68d2('0x34')]);_0x181932['attributes']=_[_0x68d2('0x33')](_0x353e48[_0x68d2('0x30')],qs[_0x68d2('0x36')](_0x370631['query'][_0x68d2('0x36')]));_0x181932[_0x68d2('0x35')]=_0x181932[_0x68d2('0x35')]['length']?_0x181932[_0x68d2('0x35')]:_0x353e48[_0x68d2('0x30')];if(_0x370631[_0x68d2('0x34')][_0x68d2('0x40')]){_0x181932['include']=[{'all':!![]}];}_0x181932=_[_0x68d2('0x3d')]({},_0x181932,_0x370631[_0x68d2('0x3f')]);return db[_0x68d2('0x2e')]['find'](_0x181932)['then'](handleEntityNotFound(_0x510fe7,null))[_0x68d2('0x24')](respondWithResult(_0x510fe7,null))['catch'](handleError(_0x510fe7,null));};exports[_0x68d2('0x46')]=function(_0x1dad3c,_0x237a43){return db[_0x68d2('0x2e')][_0x68d2('0x46')](_0x1dad3c['body'],{})[_0x68d2('0x24')](function(_0x1f5782){var _0x135881=_0x1dad3c[_0x68d2('0x47')][_0x68d2('0x26')]({'plain':!![]});if(!_0x135881)throw new Error(_0x68d2('0x48'));if(_0x135881[_0x68d2('0x49')]===_0x68d2('0x47')){var _0x2474ac=_0x1f5782['get']({'plain':!![]});var _0x52fb8a=_0x68d2('0x27');return db['UserProfileSection'][_0x68d2('0x4a')]({'where':{'name':_0x52fb8a,'userProfileId':_0x135881[_0x68d2('0x4b')]},'raw':!![]})['then'](function(_0x32ab54){if(_0x32ab54&&_0x32ab54[_0x68d2('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x2474ac[_0x68d2('0x2b')],'resourceId':_0x2474ac['id'],'type':_0x32ab54[_0x68d2('0x2b')],'sectionId':_0x32ab54['id']},{})['then'](function(){return _0x1f5782;});}else{return _0x1f5782;}})[_0x68d2('0x43')](function(_0xc76dd9){logger['error'](_0x68d2('0x4d'),_0xc76dd9);throw _0xc76dd9;});}return _0x1f5782;})[_0x68d2('0x24')](respondWithResult(_0x237a43,0xc9))['catch'](handleError(_0x237a43,null));};exports[_0x68d2('0x23')]=function(_0x1e23ec,_0x51e889){if(_0x1e23ec['body']['id']){delete _0x1e23ec[_0x68d2('0x4e')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x1e23ec['params']['id']}})[_0x68d2('0x24')](handleEntityNotFound(_0x51e889,null))['then'](saveUpdates(_0x1e23ec['body'],null))[_0x68d2('0x24')](respondWithResult(_0x51e889,null))[_0x68d2('0x43')](handleError(_0x51e889,null));};exports[_0x68d2('0x25')]=function(_0x425e50,_0x20f417){return db['CmCompany'][_0x68d2('0x4a')]({'where':{'id':_0x425e50[_0x68d2('0x45')]['id']}})[_0x68d2('0x24')](handleEntityNotFound(_0x20f417,null))[_0x68d2('0x24')](removeEntity(_0x20f417,null))[_0x68d2('0x43')](handleError(_0x20f417,null));};exports['describe']=function(_0x1163ed,_0x3c8021){return db[_0x68d2('0x2e')]['describe']()[_0x68d2('0x24')](respondWithResult(_0x3c8021,null))[_0x68d2('0x43')](handleError(_0x3c8021,null));};exports[_0x68d2('0x4f')]=function(_0x415cc0,_0x5e3882,_0x4a412f){return db[_0x68d2('0x50')][_0x68d2('0x4a')]({'where':{'id':_0x415cc0['params']['id']}})[_0x68d2('0x24')](handleEntityNotFound(_0x5e3882,null))[_0x68d2('0x24')](function(_0x23c6e6){if(_0x23c6e6){return _0x23c6e6[_0x68d2('0x4f')](_0x415cc0[_0x68d2('0x4e')][_0x68d2('0x51')],_['omit'](_0x415cc0[_0x68d2('0x4e')],['ids','id'])||{});}})[_0x68d2('0x24')](respondWithResult(_0x5e3882,null))[_0x68d2('0x43')](handleError(_0x5e3882,null));};exports['getContacts']=function(_0xaf790e,_0x1d009a,_0x4f1d3d){var _0x180063={};var _0x38e0f3={};var _0x1f7d12;var _0x3b9774;return db[_0x68d2('0x2e')][_0x68d2('0x52')]({'where':{'id':_0xaf790e['params']['id']}})[_0x68d2('0x24')](handleEntityNotFound(_0x1d009a,null))[_0x68d2('0x24')](function(_0x131f35){if(_0x131f35){_0x1f7d12=_0x131f35;_0x38e0f3[_0x68d2('0x30')]=_['keys'](db['CmContact'][_0x68d2('0x53')]);_0x38e0f3['query']=_['keys'](_0xaf790e[_0x68d2('0x34')]);_0x38e0f3[_0x68d2('0x32')]=_[_0x68d2('0x33')](_0x38e0f3['model'],_0x38e0f3[_0x68d2('0x34')]);_0x180063['attributes']=_[_0x68d2('0x33')](_0x38e0f3['model'],qs[_0x68d2('0x36')](_0xaf790e[_0x68d2('0x34')][_0x68d2('0x36')]));_0x180063[_0x68d2('0x35')]=_0x180063['attributes'][_0x68d2('0x54')]?_0x180063['attributes']:_0x38e0f3[_0x68d2('0x30')];_0x180063['order']=qs['sort'](_0xaf790e['query'][_0x68d2('0x39')]);_0x180063['where']=qs['filters'](_[_0x68d2('0x3b')](_0xaf790e[_0x68d2('0x34')],_0x38e0f3[_0x68d2('0x32')]));if(_0xaf790e[_0x68d2('0x34')][_0x68d2('0x3c')]){_0x180063[_0x68d2('0x3a')]=_['merge'](_0x180063['where'],{'$or':_['map'](_0x180063[_0x68d2('0x35')],function(_0x2af247){var _0xb8b5ad={};_0xb8b5ad[_0x2af247]={'$like':'%'+_0xaf790e['query']['filter']+'%'};return _0xb8b5ad;})});}_0x180063=_[_0x68d2('0x3d')]({},_0x180063,_0xaf790e[_0x68d2('0x3f')]);return _0x1f7d12[_0x68d2('0x55')](_0x180063);}})['then'](function(_0x238411){if(_0x238411){_0x3b9774=_0x238411[_0x68d2('0x54')];if(!_0xaf790e[_0x68d2('0x34')][_0x68d2('0x37')](_0x68d2('0x38'))){_0x180063['limit']=qs[_0x68d2('0x1c')](_0xaf790e['query'][_0x68d2('0x1c')]);_0x180063[_0x68d2('0x1e')]=qs[_0x68d2('0x1e')](_0xaf790e[_0x68d2('0x34')][_0x68d2('0x1e')]);}return _0x1f7d12[_0x68d2('0x55')](_0x180063);}})['then'](function(_0x378d6b){if(_0x378d6b){return _0x378d6b?{'count':_0x3b9774,'rows':_0x378d6b}:null;}})[_0x68d2('0x24')](respondWithResult(_0x1d009a,null))[_0x68d2('0x43')](handleError(_0x1d009a,null));}; \ No newline at end of file +var _0x96a5=['options','getContacts','zip-dir','fast-json-patch','moment','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','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','autoAssociation','update','describe','CmContact','addContacts','ids','omit','findOne','pick','map'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x96a5,0x1b0));var _0x596a=function(_0x22386b,_0x13ef9a){_0x22386b=_0x22386b-0x0;var _0x264264=_0x96a5[_0x22386b];return _0x264264;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x596a('0x0'));var jsonpatch=require(_0x596a('0x1'));var rp=require('request-promise');var moment=require(_0x596a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x596a('0x3'));var path=require(_0x596a('0x4'));var sox=require(_0x596a('0x5'));var csv=require(_0x596a('0x6'));var ejs=require(_0x596a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x596a('0x8'));var squel=require(_0x596a('0x9'));var crypto=require(_0x596a('0xa'));var jsforce=require(_0x596a('0xb'));var deskjs=require(_0x596a('0xc'));var toCsv=require(_0x596a('0x6'));var querystring=require(_0x596a('0xd'));var Papa=require(_0x596a('0xe'));var Redis=require(_0x596a('0xf'));var authService=require(_0x596a('0x10'));var qs=require(_0x596a('0x11'));var as=require(_0x596a('0x12'));var hardwareService=require(_0x596a('0x13'));var logger=require(_0x596a('0x14'))(_0x596a('0x15'));var utils=require(_0x596a('0x16'));var config=require(_0x596a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x596a('0x18'))['db'];function respondWithStatusCode(_0x1f67bd,_0x4e5cdb){_0x4e5cdb=_0x4e5cdb||0xcc;return function(_0x443635){if(_0x443635){return _0x1f67bd[_0x596a('0x19')](_0x4e5cdb);}return _0x1f67bd['status'](_0x4e5cdb)[_0x596a('0x1a')]();};}function respondWithResult(_0x4d0497,_0x336a76){_0x336a76=_0x336a76||0xc8;return function(_0x844585){if(_0x844585){return _0x4d0497[_0x596a('0x1b')](_0x336a76)[_0x596a('0x1c')](_0x844585);}};}function respondWithFilteredResult(_0x5d26e2,_0x3d0090){return function(_0x65cbc5){if(_0x65cbc5){var _0x18508e=typeof _0x3d0090[_0x596a('0x1d')]==='undefined'&&typeof _0x3d0090[_0x596a('0x1e')]===_0x596a('0x1f');var _0x3d4f17=_0x65cbc5['count'];var _0xee4652=_0x18508e?0x0:_0x3d0090[_0x596a('0x1d')];var _0x2d2e55=_0x18508e?_0x65cbc5[_0x596a('0x20')]:_0x3d0090[_0x596a('0x1d')]+_0x3d0090[_0x596a('0x1e')];var _0x2ca15e;if(_0x2d2e55>=_0x3d4f17){_0x2d2e55=_0x3d4f17;_0x2ca15e=0xc8;}else{_0x2ca15e=0xce;}_0x5d26e2[_0x596a('0x1b')](_0x2ca15e);return _0x5d26e2[_0x596a('0x21')](_0x596a('0x22'),_0xee4652+'-'+_0x2d2e55+'/'+_0x3d4f17)[_0x596a('0x1c')](_0x65cbc5);}return null;};}function patchUpdates(_0x4a2b83){return function(_0xeab52e){try{jsonpatch['apply'](_0xeab52e,_0x4a2b83,!![]);}catch(_0x247803){return BPromise[_0x596a('0x23')](_0x247803);}return _0xeab52e[_0x596a('0x24')]();};}function saveUpdates(_0x3c7a4d,_0x236ad8){return function(_0x3e75c2){if(_0x3e75c2){return _0x3e75c2['update'](_0x3c7a4d)[_0x596a('0x25')](function(_0x162ea0){return _0x162ea0;});}return null;};}function removeEntity(_0x69be1a,_0x5178f1){return function(_0x37a7f7){if(_0x37a7f7){return _0x37a7f7[_0x596a('0x26')]()['then'](function(){var _0x5eb369=_0x37a7f7['get']({'plain':!![]});var _0x1c1891='Companies';return db[_0x596a('0x27')][_0x596a('0x26')]({'where':{'type':_0x1c1891,'resourceId':_0x5eb369['id']}})[_0x596a('0x25')](function(){return _0x37a7f7;});})[_0x596a('0x25')](function(){_0x69be1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55e559,_0x36ad9c){return function(_0xca8979){if(!_0xca8979){_0x55e559[_0x596a('0x19')](0x194);}return _0xca8979;};}function handleError(_0x425bb9,_0x1134a1){_0x1134a1=_0x1134a1||0x1f4;return function(_0x2cc794){logger[_0x596a('0x28')](_0x2cc794[_0x596a('0x29')]);if(_0x2cc794[_0x596a('0x2a')]){delete _0x2cc794[_0x596a('0x2a')];}_0x425bb9[_0x596a('0x1b')](_0x1134a1)['send'](_0x2cc794);};}exports[_0x596a('0x2b')]=function(_0x3ca4b9,_0x338f41){var _0x25e698={},_0xf2ee2b={},_0x2fc774={'count':0x0,'rows':[]};return db[_0x596a('0x2c')]['describe']()[_0x596a('0x25')](function(_0x35c6e6){_0xf2ee2b[_0x596a('0x2d')]=_[_0x596a('0x2e')](_0x35c6e6);_0xf2ee2b[_0x596a('0x2f')]=_[_0x596a('0x2e')](_0x3ca4b9[_0x596a('0x2f')]);_0xf2ee2b[_0x596a('0x30')]=_[_0x596a('0x31')](_0xf2ee2b['model'],_0xf2ee2b[_0x596a('0x2f')]);_0x25e698[_0x596a('0x32')]=_[_0x596a('0x31')](_0xf2ee2b[_0x596a('0x2d')],qs[_0x596a('0x33')](_0x3ca4b9['query'][_0x596a('0x33')]));_0x25e698[_0x596a('0x32')]=_0x25e698['attributes'][_0x596a('0x34')]?_0x25e698[_0x596a('0x32')]:_0xf2ee2b['model'];if(!_0x3ca4b9[_0x596a('0x2f')][_0x596a('0x35')]('nolimit')){_0x25e698[_0x596a('0x1e')]=qs[_0x596a('0x1e')](_0x3ca4b9[_0x596a('0x2f')][_0x596a('0x1e')]);_0x25e698[_0x596a('0x1d')]=qs[_0x596a('0x1d')](_0x3ca4b9['query'][_0x596a('0x1d')]);}_0x25e698['order']=qs[_0x596a('0x36')](_0x3ca4b9[_0x596a('0x2f')]['sort']);_0x25e698[_0x596a('0x37')]=qs['filters'](_['pick'](_0x3ca4b9[_0x596a('0x2f')],_0xf2ee2b['filters']),_0x35c6e6);if(_0x3ca4b9[_0x596a('0x2f')]['filter']){_0x25e698[_0x596a('0x37')]=_[_0x596a('0x38')](_0x25e698[_0x596a('0x37')],{'$or':_['map'](_0x25e698[_0x596a('0x32')],function(_0x32ce2a){var _0x307014={};_0x307014[_0x32ce2a]={'$like':'%'+_0x3ca4b9[_0x596a('0x2f')][_0x596a('0x39')]+'%'};return _0x307014;})});}_0x25e698=_[_0x596a('0x38')]({},_0x25e698,_0x3ca4b9['options']);var _0x12aba0={'where':_0x25e698['where']};return db['CmCompany']['count'](_0x12aba0)[_0x596a('0x25')](function(_0x3cb454){_0x2fc774[_0x596a('0x20')]=_0x3cb454;if(_0x3ca4b9[_0x596a('0x2f')][_0x596a('0x3a')]){_0x25e698['include']=[{'all':!![]}];}return db[_0x596a('0x2c')][_0x596a('0x3b')](_0x25e698);})['then'](function(_0x4ca786){_0x2fc774[_0x596a('0x3c')]=_0x4ca786;return _0x2fc774;})[_0x596a('0x25')](respondWithFilteredResult(_0x338f41,_0x25e698))[_0x596a('0x3d')](handleError(_0x338f41,null));})[_0x596a('0x3d')](handleError(_0x338f41,null));};exports['show']=function(_0x418c54,_0x15d8b8){var _0x22e4f8={'raw':![],'where':{'id':_0x418c54[_0x596a('0x3e')]['id']}},_0x3a39d3={};_0x3a39d3[_0x596a('0x2d')]=_[_0x596a('0x2e')](db[_0x596a('0x2c')][_0x596a('0x3f')]);_0x3a39d3['query']=_['keys'](_0x418c54[_0x596a('0x2f')]);_0x3a39d3['filters']=_['intersection'](_0x3a39d3[_0x596a('0x2d')],_0x3a39d3[_0x596a('0x2f')]);_0x22e4f8[_0x596a('0x32')]=_['intersection'](_0x3a39d3[_0x596a('0x2d')],qs['fields'](_0x418c54[_0x596a('0x2f')][_0x596a('0x33')]));_0x22e4f8[_0x596a('0x32')]=_0x22e4f8[_0x596a('0x32')][_0x596a('0x34')]?_0x22e4f8[_0x596a('0x32')]:_0x3a39d3[_0x596a('0x2d')];if(_0x418c54[_0x596a('0x2f')][_0x596a('0x3a')]){_0x22e4f8[_0x596a('0x40')]=[{'all':!![]}];}_0x22e4f8=_['merge']({},_0x22e4f8,_0x418c54['options']);return db[_0x596a('0x2c')][_0x596a('0x41')](_0x22e4f8)[_0x596a('0x25')](handleEntityNotFound(_0x15d8b8,null))[_0x596a('0x25')](respondWithResult(_0x15d8b8,null))[_0x596a('0x3d')](handleError(_0x15d8b8,null));};exports[_0x596a('0x42')]=function(_0x38079d,_0x595ee8){return db[_0x596a('0x2c')][_0x596a('0x42')](_0x38079d[_0x596a('0x43')],{})[_0x596a('0x25')](function(_0x54d3c1){var _0xee697d=_0x38079d[_0x596a('0x44')][_0x596a('0x45')]({'plain':!![]});if(!_0xee697d)throw new Error(_0x596a('0x46'));if(_0xee697d['role']===_0x596a('0x44')){var _0x2b8554=_0x54d3c1['get']({'plain':!![]});var _0xb4deeb=_0x596a('0x47');return db[_0x596a('0x48')][_0x596a('0x41')]({'where':{'name':_0xb4deeb,'userProfileId':_0xee697d[_0x596a('0x49')]},'raw':!![]})['then'](function(_0x503e6f){if(_0x503e6f&&_0x503e6f[_0x596a('0x4a')]===0x0){return db[_0x596a('0x27')]['create']({'name':_0x2b8554['name'],'resourceId':_0x2b8554['id'],'type':_0x503e6f[_0x596a('0x2a')],'sectionId':_0x503e6f['id']},{})[_0x596a('0x25')](function(){return _0x54d3c1;});}else{return _0x54d3c1;}})[_0x596a('0x3d')](function(_0x3f19e0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f19e0);throw _0x3f19e0;});}return _0x54d3c1;})[_0x596a('0x25')](respondWithResult(_0x595ee8,0xc9))['catch'](handleError(_0x595ee8,null));};exports[_0x596a('0x4b')]=function(_0xe66302,_0x1a509e){if(_0xe66302[_0x596a('0x43')]['id']){delete _0xe66302[_0x596a('0x43')]['id'];}return db[_0x596a('0x2c')][_0x596a('0x41')]({'where':{'id':_0xe66302['params']['id']}})[_0x596a('0x25')](handleEntityNotFound(_0x1a509e,null))[_0x596a('0x25')](saveUpdates(_0xe66302[_0x596a('0x43')],null))[_0x596a('0x25')](respondWithResult(_0x1a509e,null))[_0x596a('0x3d')](handleError(_0x1a509e,null));};exports['destroy']=function(_0x3698a9,_0x5be07b){return db[_0x596a('0x2c')][_0x596a('0x41')]({'where':{'id':_0x3698a9[_0x596a('0x3e')]['id']}})[_0x596a('0x25')](handleEntityNotFound(_0x5be07b,null))[_0x596a('0x25')](removeEntity(_0x5be07b,null))[_0x596a('0x3d')](handleError(_0x5be07b,null));};exports[_0x596a('0x4c')]=function(_0x520c0d,_0xe6b1a){return db['CmCompany'][_0x596a('0x4c')]()[_0x596a('0x25')](respondWithResult(_0xe6b1a,null))[_0x596a('0x3d')](handleError(_0xe6b1a,null));};exports['addContacts']=function(_0x1c12f9,_0x556c95,_0x39d997){return db[_0x596a('0x4d')][_0x596a('0x41')]({'where':{'id':_0x1c12f9[_0x596a('0x3e')]['id']}})[_0x596a('0x25')](handleEntityNotFound(_0x556c95,null))[_0x596a('0x25')](function(_0x4e383c){if(_0x4e383c){return _0x4e383c[_0x596a('0x4e')](_0x1c12f9[_0x596a('0x43')][_0x596a('0x4f')],_[_0x596a('0x50')](_0x1c12f9[_0x596a('0x43')],['ids','id'])||{});}})['then'](respondWithResult(_0x556c95,null))[_0x596a('0x3d')](handleError(_0x556c95,null));};exports['getContacts']=function(_0x224b95,_0x16f445,_0x6d8231){var _0x594d28={};var _0x3dacba={};var _0x5083c9;var _0x2f4ff9;return db[_0x596a('0x2c')][_0x596a('0x51')]({'where':{'id':_0x224b95[_0x596a('0x3e')]['id']}})[_0x596a('0x25')](handleEntityNotFound(_0x16f445,null))['then'](function(_0x517c3f){if(_0x517c3f){_0x5083c9=_0x517c3f;_0x3dacba[_0x596a('0x2d')]=_[_0x596a('0x2e')](db['CmContact']['rawAttributes']);_0x3dacba[_0x596a('0x2f')]=_[_0x596a('0x2e')](_0x224b95[_0x596a('0x2f')]);_0x3dacba[_0x596a('0x30')]=_['intersection'](_0x3dacba['model'],_0x3dacba[_0x596a('0x2f')]);_0x594d28[_0x596a('0x32')]=_[_0x596a('0x31')](_0x3dacba[_0x596a('0x2d')],qs[_0x596a('0x33')](_0x224b95[_0x596a('0x2f')][_0x596a('0x33')]));_0x594d28[_0x596a('0x32')]=_0x594d28[_0x596a('0x32')][_0x596a('0x34')]?_0x594d28['attributes']:_0x3dacba[_0x596a('0x2d')];_0x594d28['order']=qs[_0x596a('0x36')](_0x224b95[_0x596a('0x2f')][_0x596a('0x36')]);_0x594d28[_0x596a('0x37')]=qs[_0x596a('0x30')](_[_0x596a('0x52')](_0x224b95['query'],_0x3dacba[_0x596a('0x30')]));if(_0x224b95[_0x596a('0x2f')][_0x596a('0x39')]){_0x594d28[_0x596a('0x37')]=_[_0x596a('0x38')](_0x594d28[_0x596a('0x37')],{'$or':_[_0x596a('0x53')](_0x594d28[_0x596a('0x32')],function(_0x4b0412){var _0x1e9452={};_0x1e9452[_0x4b0412]={'$like':'%'+_0x224b95[_0x596a('0x2f')][_0x596a('0x39')]+'%'};return _0x1e9452;})});}_0x594d28=_[_0x596a('0x38')]({},_0x594d28,_0x224b95[_0x596a('0x54')]);return _0x5083c9[_0x596a('0x55')](_0x594d28);}})[_0x596a('0x25')](function(_0x424cc1){if(_0x424cc1){_0x2f4ff9=_0x424cc1[_0x596a('0x34')];if(!_0x224b95['query'][_0x596a('0x35')]('nolimit')){_0x594d28[_0x596a('0x1e')]=qs['limit'](_0x224b95['query'][_0x596a('0x1e')]);_0x594d28['offset']=qs[_0x596a('0x1d')](_0x224b95[_0x596a('0x2f')][_0x596a('0x1d')]);}return _0x5083c9[_0x596a('0x55')](_0x594d28);}})[_0x596a('0x25')](function(_0x17b051){if(_0x17b051){return _0x17b051?{'count':_0x2f4ff9,'rows':_0x17b051}:null;}})[_0x596a('0x25')](respondWithResult(_0x16f445,null))['catch'](handleError(_0x16f445,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index cc81d04..b893a47 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 _0x6178=['exports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x24d711,_0x3cdb28){var _0x3491b4=function(_0xd5957e){while(--_0xd5957e){_0x24d711['push'](_0x24d711['shift']());}};_0x3491b4(++_0x3cdb28);}(_0x6178,0xf1));var _0x8617=function(_0x12ec65,_0x5bd7c9){_0x12ec65=_0x12ec65-0x0;var _0x28502f=_0x6178[_0x12ec65];return _0x28502f;};'use strict';var _=require(_0x8617('0x0'));var util=require(_0x8617('0x1'));var logger=require('../../config/logger')(_0x8617('0x2'));var moment=require(_0x8617('0x3'));var BPromise=require('bluebird');var rp=require(_0x8617('0x4'));var fs=require('fs');var path=require(_0x8617('0x5'));var rimraf=require(_0x8617('0x6'));var config=require(_0x8617('0x7'));var attributes=require(_0x8617('0x8'));module[_0x8617('0x9')]=function(_0x1ac47c,_0x491605){return _0x1ac47c['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96c4=['exports','define','util','api','bluebird','request-promise','rimraf'];(function(_0x20bb5a,_0x3a325a){var _0x30e0eb=function(_0x2f12e3){while(--_0x2f12e3){_0x20bb5a['push'](_0x20bb5a['shift']());}};_0x30e0eb(++_0x3a325a);}(_0x96c4,0x79));var _0x496c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x496c('0x0'));var logger=require('../../config/logger')(_0x496c('0x1'));var moment=require('moment');var BPromise=require(_0x496c('0x2'));var rp=require(_0x496c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x496c('0x4'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x496c('0x5')]=function(_0x2b7557,_0x41e040){return _0x2b7557[_0x496c('0x6')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index ca3d0b2..fc43ecb 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 _0x269a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x19ea51,_0x24be66){var _0xba11b=function(_0x2f796c){while(--_0x2f796c){_0x19ea51['push'](_0x19ea51['shift']());}};_0xba11b(++_0x24be66);}(_0x269a,0x14a));var _0xa269=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x269a[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0xa269('0x0'));var moment=require(_0xa269('0x1'));var BPromise=require(_0xa269('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa269('0x3'));var db=require(_0xa269('0x4'))['db'];var utils=require(_0xa269('0x5'));var logger=require(_0xa269('0x6'))('rpc');var config=require(_0xa269('0x7'));var jayson=require(_0xa269('0x8'));var client=jayson[_0xa269('0x9')][_0xa269('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47b91f,_0x33249f,_0x44d510){return new BPromise(function(_0x48dd40,_0x430883){return client[_0xa269('0xb')](_0x47b91f,_0x44d510)[_0xa269('0xc')](function(_0x2a6527){logger['info'](_0xa269('0xd'),_0x33249f,'request\x20sent');logger['debug'](_0xa269('0xe'),_0x33249f,'request\x20sent',JSON[_0xa269('0xf')](_0x2a6527));if(_0x2a6527[_0xa269('0x10')]){if(_0x2a6527[_0xa269('0x10')][_0xa269('0x11')]===0x1f4){logger[_0xa269('0x10')](_0xa269('0xd'),_0x33249f,_0x2a6527[_0xa269('0x10')][_0xa269('0x12')]);return _0x430883(_0x2a6527[_0xa269('0x10')][_0xa269('0x12')]);}logger[_0xa269('0x10')](_0xa269('0xd'),_0x33249f,_0x2a6527[_0xa269('0x10')][_0xa269('0x12')]);return _0x48dd40(_0x2a6527[_0xa269('0x10')][_0xa269('0x12')]);}else{logger[_0xa269('0x13')](_0xa269('0xd'),_0x33249f,'request\x20sent');_0x48dd40(_0x2a6527[_0xa269('0x14')][_0xa269('0x12')]);}})[_0xa269('0x15')](function(_0x500853){logger['error'](_0xa269('0xd'),_0x33249f,_0x500853);_0x430883(_0x500853);});});} \ No newline at end of file +var _0x72ed=['../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xb1eb5c,_0x141fc4){var _0x2cde86=function(_0x20b558){while(--_0x20b558){_0xb1eb5c['push'](_0xb1eb5c['shift']());}};_0x2cde86(++_0x141fc4);}(_0x72ed,0x16f));var _0xd72e=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x72ed[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0xd72e('0x0'));var moment=require(_0xd72e('0x1'));var BPromise=require(_0xd72e('0x2'));var rs=require(_0xd72e('0x3'));var fs=require('fs');var Redis=require(_0xd72e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd72e('0x5'))(_0xd72e('0x6'));var config=require(_0xd72e('0x7'));var jayson=require(_0xd72e('0x8'));var client=jayson['client'][_0xd72e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8d0b,_0x32e145,_0x17fa61){return new BPromise(function(_0x57dcb2,_0x4a5781){return client[_0xd72e('0xa')](_0x3c8d0b,_0x17fa61)[_0xd72e('0xb')](function(_0x42e1bc){logger[_0xd72e('0xc')](_0xd72e('0xd'),_0x32e145,_0xd72e('0xe'));logger[_0xd72e('0xf')](_0xd72e('0x10'),_0x32e145,_0xd72e('0xe'),JSON[_0xd72e('0x11')](_0x42e1bc));if(_0x42e1bc[_0xd72e('0x12')]){if(_0x42e1bc[_0xd72e('0x12')][_0xd72e('0x13')]===0x1f4){logger[_0xd72e('0x12')]('CmCompany,\x20%s,\x20%s',_0x32e145,_0x42e1bc[_0xd72e('0x12')]['message']);return _0x4a5781(_0x42e1bc[_0xd72e('0x12')][_0xd72e('0x14')]);}logger[_0xd72e('0x12')](_0xd72e('0xd'),_0x32e145,_0x42e1bc[_0xd72e('0x12')][_0xd72e('0x14')]);return _0x57dcb2(_0x42e1bc[_0xd72e('0x12')][_0xd72e('0x14')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x32e145,_0xd72e('0xe'));_0x57dcb2(_0x42e1bc[_0xd72e('0x15')][_0xd72e('0x14')]);}})['catch'](function(_0x1ea80e){logger[_0xd72e('0x12')](_0xd72e('0xd'),_0x32e145,_0x1ea80e);_0x4a5781(_0x1ea80e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 54cefda..6cffd9c 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 _0xab64=['describe','/:id','show','/:id/contacts','getContacts','create','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get'];(function(_0x2e1da7,_0x4e26dc){var _0x151559=function(_0x1002b2){while(--_0x1002b2){_0x2e1da7['push'](_0x2e1da7['shift']());}};_0x151559(++_0x4e26dc);}(_0xab64,0xa0));var _0x4ab6=function(_0x4c85c5,_0x38bcf8){_0x4c85c5=_0x4c85c5-0x0;var _0x148b9b=_0xab64[_0x4c85c5];return _0x148b9b;};'use strict';var multer=require(_0x4ab6('0x0'));var util=require(_0x4ab6('0x1'));var path=require(_0x4ab6('0x2'));var timeout=require(_0x4ab6('0x3'));var express=require('express');var router=express[_0x4ab6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4ab6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ab6('0x6'));var controller=require(_0x4ab6('0x7'));router['get']('/',auth[_0x4ab6('0x8')](),controller[_0x4ab6('0x9')]);router[_0x4ab6('0xa')]('/describe',auth[_0x4ab6('0x8')](),controller[_0x4ab6('0xb')]);router[_0x4ab6('0xa')](_0x4ab6('0xc'),auth[_0x4ab6('0x8')](),controller[_0x4ab6('0xd')]);router[_0x4ab6('0xa')](_0x4ab6('0xe'),auth[_0x4ab6('0x8')](),controller[_0x4ab6('0xf')]);router['post']('/',auth[_0x4ab6('0x8')](),controller[_0x4ab6('0x10')]);router['post']('/:id/contacts',auth[_0x4ab6('0x8')](),controller['addContacts']);router['put'](_0x4ab6('0xc'),auth[_0x4ab6('0x8')](),controller['update']);router[_0x4ab6('0x11')](_0x4ab6('0xc'),auth[_0x4ab6('0x8')](),controller['destroy']);module[_0x4ab6('0x12')]=router; \ No newline at end of file +var _0x2198=['isAuthenticated','/describe','describe','/:id','show','/:id/contacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x314f6e,_0x3b43b0){var _0x33f886=function(_0x588569){while(--_0x588569){_0x314f6e['push'](_0x314f6e['shift']());}};_0x33f886(++_0x3b43b0);}(_0x2198,0x1ee));var _0x8219=function(_0x2765c0,_0x55f7ed){_0x2765c0=_0x2765c0-0x0;var _0x211c3e=_0x2198[_0x2765c0];return _0x211c3e;};'use strict';var multer=require(_0x8219('0x0'));var util=require(_0x8219('0x1'));var path=require(_0x8219('0x2'));var timeout=require('connect-timeout');var express=require(_0x8219('0x3'));var router=express[_0x8219('0x4')]();var fs_extra=require(_0x8219('0x5'));var auth=require(_0x8219('0x6'));var interaction=require(_0x8219('0x7'));var config=require('../../config/environment');var controller=require(_0x8219('0x8'));router[_0x8219('0x9')]('/',auth[_0x8219('0xa')](),controller['index']);router[_0x8219('0x9')](_0x8219('0xb'),auth[_0x8219('0xa')](),controller[_0x8219('0xc')]);router['get'](_0x8219('0xd'),auth['isAuthenticated'](),controller[_0x8219('0xe')]);router[_0x8219('0x9')](_0x8219('0xf'),auth[_0x8219('0xa')](),controller['getContacts']);router[_0x8219('0x10')]('/',auth[_0x8219('0xa')](),controller[_0x8219('0x11')]);router[_0x8219('0x10')](_0x8219('0xf'),auth[_0x8219('0xa')](),controller[_0x8219('0x12')]);router[_0x8219('0x13')]('/:id',auth[_0x8219('0xa')](),controller[_0x8219('0x14')]);router[_0x8219('0x15')](_0x8219('0xd'),auth[_0x8219('0xa')](),controller[_0x8219('0x16')]);module[_0x8219('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2d2818f..65468e0 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 _0xb0c1=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x403fb1,_0x5eb616){var _0x45ce2c=function(_0x5114ed){while(--_0x5114ed){_0x403fb1['push'](_0x403fb1['shift']());}};_0x45ce2c(++_0x5eb616);}(_0xb0c1,0xb1));var _0x1b0c=function(_0x2654eb,_0x25fd2a){_0x2654eb=_0x2654eb-0x0;var _0x4faa95=_0xb0c1[_0x2654eb];return _0x4faa95;};'use strict';var _=require(_0x1b0c('0x0'));var Sequelize=require('sequelize');module[_0x1b0c('0x1')]={'firstName':{'type':Sequelize[_0x1b0c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1b0c('0x2')]},'street':{'type':Sequelize[_0x1b0c('0x2')]},'postalCode':{'type':Sequelize[_0x1b0c('0x2')]},'city':{'type':Sequelize[_0x1b0c('0x2')]},'country':{'type':Sequelize[_0x1b0c('0x2')]},'dateOfBirth':{'type':Sequelize[_0x1b0c('0x2')]},'description':{'type':Sequelize[_0x1b0c('0x3')]},'phone':{'type':Sequelize[_0x1b0c('0x2')]},'mobile':{'type':Sequelize[_0x1b0c('0x2')]},'fax':{'type':Sequelize[_0x1b0c('0x2')]},'email':{'type':Sequelize[_0x1b0c('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x1b0c('0x2')]},'fb_data':{'type':Sequelize[_0x1b0c('0x2')]},'twitter':{'type':Sequelize[_0x1b0c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1b0c('0x2')]},'viber':{'type':Sequelize[_0x1b0c('0x2')]},'line':{'type':Sequelize[_0x1b0c('0x2')]},'wechat':{'type':Sequelize[_0x1b0c('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1b0c('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1b0c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1b0c('0x6')],'defaultValue':Sequelize[_0x1b0c('0x7')]},'dialTimezone':{'type':Sequelize[_0x1b0c('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa8ab=['UNSIGNED','NOW','lodash','STRING','INTEGER'];(function(_0x630223,_0x3c8fa3){var _0x1f57ec=function(_0x259a73){while(--_0x259a73){_0x630223['push'](_0x630223['shift']());}};_0x1f57ec(++_0x3c8fa3);}(_0xa8ab,0x183));var _0xba8a=function(_0x4fc125,_0x2c8989){_0x4fc125=_0x4fc125-0x0;var _0x19962b=_0xa8ab[_0x4fc125];return _0x19962b;};'use strict';var _=require(_0xba8a('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xba8a('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xba8a('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xba8a('0x1')]},'city':{'type':Sequelize[_0xba8a('0x1')]},'country':{'type':Sequelize[_0xba8a('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xba8a('0x1')]},'mobile':{'type':Sequelize[_0xba8a('0x1')]},'fax':{'type':Sequelize[_0xba8a('0x1')]},'email':{'type':Sequelize[_0xba8a('0x1')]},'url':{'type':Sequelize[_0xba8a('0x1')]},'facebook':{'type':Sequelize[_0xba8a('0x1')]},'fb_data':{'type':Sequelize[_0xba8a('0x1')]},'twitter':{'type':Sequelize[_0xba8a('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xba8a('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xba8a('0x1')]},'wechat':{'type':Sequelize[_0xba8a('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xba8a('0x2')](0x2)[_0xba8a('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xba8a('0x4')]},'dialTimezone':{'type':Sequelize[_0xba8a('0x1')]},'utcOffset':{'type':Sequelize[_0xba8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1b95668..90f5df8 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 _0x39d3=['CmCustomField','findAll','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','CmHopperBlack','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','each','duplicates','where','push','ListId','spread','show','Tag','Tags','tag','CmContactHasItem','Phones','ContactItemType','sequelize','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','map','isEmpty','table','setFields','id\x20=\x20?','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','getTags','setTags','ids','setAdditionalPhones','all','item_types','items','ItemTypeId','description','CmHopperAdditionalPhone','item','PHONE','OrderBy','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','literal','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','nolimit','pick','ContactId','options','rows','getHopperHistories','includeAll','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','import','agent','binding','firstName','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','message','exit','User','fork','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','Owner','fullname','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','path','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','redis','defaults','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','index','describe','getOptions','query','catch','CmContact','find','params','tags','length','keys','startsWith','cf_','displayName'];(function(_0x285974,_0x429798){var _0x1bf1f4=function(_0xcab200){while(--_0xcab200){_0x285974['push'](_0x285974['shift']());}};_0x1bf1f4(++_0x429798);}(_0x39d3,0x1c8));var _0x339d=function(_0xae92eb,_0x18ab88){_0xae92eb=_0xae92eb-0x0;var _0x2594f3=_0x39d3[_0xae92eb];return _0x2594f3;};'use strict';var moment=require(_0x339d('0x0'));var BPromise=require(_0x339d('0x1'));var util=require('util');var path=require(_0x339d('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x339d('0x3'));var Papa=require('papaparse');var Redis=require(_0x339d('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x339d('0x5'));var logger=require(_0x339d('0x6'))('api');var config=require(_0x339d('0x7'));var shared=require(_0x339d('0x8'));var db=require('../../mysqldb')['db'];config[_0x339d('0x9')]=_[_0x339d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x339d('0x9')]));require(_0x339d('0xb'))[_0x339d('0xc')](socket);function respondWithResult(_0x4d518b,_0x33ca2c){_0x33ca2c=_0x33ca2c||0xc8;return function(_0x34ab8e){if(_0x34ab8e){return _0x4d518b[_0x339d('0xd')](_0x33ca2c)[_0x339d('0xe')](_0x34ab8e);}};}function respondWithFilteredResult(_0x1eeda5,_0x5e74ff){return function(_0x54bffb){if(_0x54bffb){var _0x538c81=typeof _0x5e74ff[_0x339d('0xf')]===_0x339d('0x10')&&typeof _0x5e74ff['limit']===_0x339d('0x10');var _0x27c55e=_0x54bffb['count'];var _0x28d8ee=_0x538c81?0x0:_0x5e74ff[_0x339d('0xf')];var _0x302142=_0x538c81?_0x54bffb[_0x339d('0x11')]:_0x5e74ff[_0x339d('0xf')]+_0x5e74ff[_0x339d('0x12')];var _0x5c6f6a;if(_0x302142>=_0x27c55e){_0x302142=_0x27c55e;_0x5c6f6a=0xc8;}else{_0x5c6f6a=0xce;}_0x1eeda5[_0x339d('0xd')](_0x5c6f6a);return _0x1eeda5[_0x339d('0x13')](_0x339d('0x14'),_0x28d8ee+'-'+_0x302142+'/'+_0x27c55e)['json'](_0x54bffb);}return null;};}function saveUpdates(_0xab6227){return function(_0x593959){if(_0x593959){return _0x593959['update'](_0xab6227)[_0x339d('0x15')](function(_0x24b983){return _0x24b983;});}return null;};}function removeEntity(_0x3eddc6){return function(_0xad90f9){if(_0xad90f9){return _0xad90f9[_0x339d('0x16')]()[_0x339d('0x15')](function(){_0x3eddc6[_0x339d('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb3685){return function(_0x530f5d){if(!_0x530f5d){_0xfb3685[_0x339d('0x17')](0x194);}return _0x530f5d;};}function handleError(_0x646ac7,_0x357e60){_0x357e60=_0x357e60||0x1f4;return function(_0x3cefbb){logger[_0x339d('0x18')](_0x3cefbb[_0x339d('0x19')]);if(_0x3cefbb[_0x339d('0x1a')]){delete _0x3cefbb[_0x339d('0x1a')];}_0x646ac7[_0x339d('0xd')](_0x357e60)[_0x339d('0x1b')](_0x3cefbb);};}exports[_0x339d('0x1c')]=function(_0x443590,_0x546e72){var _0x72a79c={};return contacts[_0x339d('0x1d')]()[_0x339d('0x15')](function(_0xf14cf3){_0x72a79c=qs[_0x339d('0x1e')](_0xf14cf3,_0x443590);return contacts['findAll'](_0x443590[_0x339d('0x1f')],_0x443590['user'],_0x72a79c,_0xf14cf3);})[_0x339d('0x15')](respondWithFilteredResult(_0x546e72,_0x72a79c))[_0x339d('0x20')](handleError(_0x546e72,null));};exports['destroy']=function(_0x5d1016,_0x4bdda7){return db[_0x339d('0x21')][_0x339d('0x22')]({'where':{'id':_0x5d1016[_0x339d('0x23')]['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x4bdda7,null))[_0x339d('0x15')](removeEntity(_0x4bdda7,null))[_0x339d('0x20')](handleError(_0x4bdda7,null));};exports[_0x339d('0x1d')]=function(_0x37ca07,_0x514d34){return db[_0x339d('0x21')][_0x339d('0x1d')]()[_0x339d('0x15')](function(_0x4455f2){delete _0x4455f2[_0x339d('0x24')];for(var _0x348aa7=0x0;_0x348aa70x0){return new Promise(function(_0x950a98){var _0x4294fc=[];for(var _0x476b1a=0x0;_0x476b1a<_0x113b0b[_0x339d('0x25')];_0x476b1a++){_0x4294fc[_0x339d('0x59')](insertAdditionalPhones(_0x113b0b[_0x476b1a]['contact'],_0x113b0b[_0x476b1a][_0x339d('0x55')]));}Promise['all'](_0x4294fc)['then'](function(){_0x950a98(0x1);});})[_0x339d('0x15')](function(){return{'success':_0x4dda6a,'failure':_0x1a7440,'duplicates':_0x3b0e62};});}else{return{'success':_0x4dda6a,'failure':_0x1a7440,'duplicates':_0x3b0e62};}}})[_0x339d('0x15')](respondWithResult(_0x3dd58b,0xc9))[_0x339d('0x20')](handleError(_0x3dd58b,null));};exports[_0x339d('0x5c')]=function(_0x29a314,_0x10741e){var _0x3360ce;return db[_0x339d('0x21')][_0x339d('0x1d')]()[_0x339d('0x15')](function(_0x54a308){return db[_0x339d('0x21')][_0x339d('0x22')]({'where':{'id':_0x29a314[_0x339d('0x23')]['id']},'include':[{'model':db[_0x339d('0x5d')],'as':_0x339d('0x5e'),'attributes':['id',_0x339d('0x1a'),'color'],'required':_0x29a314[_0x339d('0x1f')][_0x339d('0x5f')]?!![]:![]},{'model':db[_0x339d('0x60')],'as':_0x339d('0x61'),'where':{'CmContactId':_0x29a314['params']['id']},'required':![],'include':[{'model':db[_0x339d('0x62')],'as':'ItemType'}]}],'order':[db[_0x339d('0x63')]['literal'](_0x339d('0x64'))],'attributes':_['keys'](_0x54a308)});})[_0x339d('0x15')](function(_0x24c033){if(!_[_0x339d('0x52')](_0x24c033)){_0x3360ce=_0x24c033[_0x339d('0x36')]({'plain':!![]});var _0x21b657={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x24c033&&_0x24c033['ListId']){if(_0x24c033['ListId']){_0x21b657[_0x339d('0x58')][_0x339d('0x65')][_0x339d('0x59')]({'ListId':{'$ne':_0x24c033[_0x339d('0x5a')]}});}}return db['CmCustomField'][_0x339d('0x2b')](_0x21b657);}})['then'](function(_0x2367d0){if(!_[_0x339d('0x52')](_0x2367d0)){return _[_0x339d('0x66')](_0x3360ce,_['map'](_0x2367d0,function(_0x336ae9){return util[_0x339d('0x67')](_0x339d('0x68'),_0x336ae9['id']);}));}})['then'](handleEntityNotFound(_0x10741e,null))['then'](respondWithResult(_0x10741e,null))[_0x339d('0x20')](handleError(_0x10741e,null));};exports['update']=function(_0x2cf5a1,_0x363030){var _0x321817;if(_0x2cf5a1[_0x339d('0x35')]['id']){delete _0x2cf5a1['body']['id'];}if(!_[_0x339d('0x52')](_0x2cf5a1[_0x339d('0x35')]['dialTimezone'])){var _0x1485d7=_0x2cf5a1[_0x339d('0x35')]['dialTimezone'];if(!_[_0x339d('0x52')](shared['timezones'][_0x1485d7]))_0x2cf5a1[_0x339d('0x35')][_0x339d('0x54')]=shared[_0x339d('0x53')][_0x1485d7][_0x339d('0x54')];}return db['CmContact']['find']({'where':{'id':_0x2cf5a1['params']['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x363030,null))['then'](saveUpdates(_0x2cf5a1['body'],null))[_0x339d('0x15')](function(_0x420c4c){_0x321817=_0x420c4c;var _0x4283ae={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x420c4c&&_0x420c4c[_0x339d('0x5a')]){if(_0x420c4c['ListId']){_0x4283ae[_0x339d('0x58')][_0x339d('0x65')]['push']({'ListId':{'$ne':_0x420c4c[_0x339d('0x5a')]}});}}return db[_0x339d('0x2a')][_0x339d('0x2b')](_0x4283ae);})['then'](function(_0x20e643){if(_0x20e643){return _[_0x339d('0x66')](_[_0x339d('0x69')](_0x2cf5a1[_0x339d('0x35')],function(_0x2ed499,_0x216819){return _[_0x339d('0x27')](_0x216819,_0x339d('0x28'));}),_[_0x339d('0x6a')](_0x20e643,function(_0x15bd7e){return util[_0x339d('0x67')](_0x339d('0x68'),_0x15bd7e['id']);}));}})[_0x339d('0x15')](function(_0x44f74b){if(_0x44f74b&&!_[_0x339d('0x6b')](_0x44f74b)){var _0x366a9d=squel[_0x339d('0x3f')]()[_0x339d('0x6c')]('cm_contacts')[_0x339d('0x6d')](_0x44f74b)[_0x339d('0x58')](_0x339d('0x6e'),_0x2cf5a1['params']['id'])['toParam']();return db[_0x339d('0x63')][_0x339d('0x1f')](_0x366a9d['text'],{'replacements':_0x366a9d[_0x339d('0x2f')]});}})[_0x339d('0x15')](function(){if(_0x2cf5a1[_0x339d('0x35')]['phone']&&_0x321817){return db[_0x339d('0x3c')][_0x339d('0x3f')]({'phone':_0x2cf5a1[_0x339d('0x35')][_0x339d('0x6f')],'OrderBy':0x0},{'where':{'ContactId':_0x321817['id']}});}})[_0x339d('0x15')](function(){return _0x321817;})[_0x339d('0x15')](respondWithResult(_0x363030,null))[_0x339d('0x20')](handleError(_0x363030,null));};exports['getTags']=function(_0x391730,_0x58bf7e){var _0x45733e={};var _0x260b8f={};var _0x3ceb7d;var _0x29004b;return db[_0x339d('0x21')][_0x339d('0x70')]({'where':{'id':_0x391730[_0x339d('0x23')]['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x58bf7e,null))[_0x339d('0x15')](function(_0xde2333){if(_0xde2333){_0x3ceb7d=_0xde2333;_0x260b8f[_0x339d('0x71')]=_[_0x339d('0x26')](db[_0x339d('0x5d')][_0x339d('0x72')]);_0x260b8f[_0x339d('0x1f')]=_[_0x339d('0x26')](_0x391730['query']);_0x260b8f[_0x339d('0x73')]=_[_0x339d('0x74')](_0x260b8f['model'],_0x260b8f[_0x339d('0x1f')]);_0x45733e[_0x339d('0x75')]=_[_0x339d('0x74')](_0x260b8f[_0x339d('0x71')],qs['fields'](_0x391730[_0x339d('0x1f')][_0x339d('0x76')]));_0x45733e[_0x339d('0x75')]=_0x45733e['attributes'][_0x339d('0x25')]?_0x45733e[_0x339d('0x75')]:_0x260b8f['model'];_0x45733e[_0x339d('0x77')]=qs[_0x339d('0x78')](_0x391730[_0x339d('0x1f')][_0x339d('0x78')]);_0x45733e[_0x339d('0x58')]=qs[_0x339d('0x73')](_['pick'](_0x391730[_0x339d('0x1f')],_0x260b8f[_0x339d('0x73')]));if(_0x391730[_0x339d('0x1f')][_0x339d('0x79')]){_0x45733e[_0x339d('0x58')]=_['merge'](_0x45733e['where'],{'$or':_[_0x339d('0x6a')](_0x45733e[_0x339d('0x75')],function(_0x13fde9){var _0x46809b={};_0x46809b[_0x13fde9]={'$like':'%'+_0x391730[_0x339d('0x1f')][_0x339d('0x79')]+'%'};return _0x46809b;})});}_0x45733e=_[_0x339d('0x34')]({},_0x45733e,_0x391730['options']);return _0x3ceb7d['getTags'](_0x45733e);}})[_0x339d('0x15')](function(_0x257ef9){if(_0x257ef9){_0x29004b=_0x257ef9[_0x339d('0x25')];if(!_0x391730[_0x339d('0x1f')]['hasOwnProperty']('nolimit')){_0x45733e[_0x339d('0x12')]=qs['limit'](_0x391730[_0x339d('0x1f')][_0x339d('0x12')]);_0x45733e[_0x339d('0xf')]=qs[_0x339d('0xf')](_0x391730['query'][_0x339d('0xf')]);}return _0x3ceb7d[_0x339d('0x7a')](_0x45733e);}})[_0x339d('0x15')](function(_0x44af5a){if(_0x44af5a){return _0x44af5a?{'count':_0x29004b,'rows':_0x44af5a}:null;}})[_0x339d('0x15')](respondWithResult(_0x58bf7e,null))[_0x339d('0x20')](handleError(_0x58bf7e,null));};exports['setTags']=function(_0x23c29c,_0x404a7d){if(_0x23c29c[_0x339d('0x35')]['id']){delete _0x23c29c[_0x339d('0x35')]['id'];}return db[_0x339d('0x21')][_0x339d('0x70')]({'where':{'id':_0x23c29c[_0x339d('0x23')]['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x404a7d,null))['then'](function(_0x20f6bc){if(_0x20f6bc){return _0x20f6bc[_0x339d('0x7b')](_0x23c29c['body'][_0x339d('0x7c')]||[]);}return null;})[_0x339d('0x15')](respondWithResult(_0x404a7d,null))[_0x339d('0x20')](handleError(_0x404a7d,null));};exports[_0x339d('0x7d')]=function(_0x56258d,_0x40e30c){var _0x48c8cc=[];_0x48c8cc[_0x339d('0x59')](addAdditionalPhones(_0x56258d[_0x339d('0x35')]));Promise[_0x339d('0x7e')](_0x48c8cc)['then'](function(){_0x48c8cc=[];_0x48c8cc[_0x339d('0x59')](deleteCmHopperPhones(_0x56258d['body']['id']));_0x48c8cc[_0x339d('0x59')](addCmHopperPhones(_0x56258d[_0x339d('0x35')]['id']));Promise['all'](_0x48c8cc)[_0x339d('0x15')](function(){return[0x1];})[_0x339d('0x15')](respondWithResult(_0x40e30c,null));});};function addAdditionalPhones(_0x21a45f){var _0x4feb83;return new Promise(function(_0x1bf331){return db[_0x339d('0x60')][_0x339d('0x16')]({'where':{'CmContactId':_0x21a45f['id']}})[_0x339d('0x15')](function(){db[_0x339d('0x62')][_0x339d('0x2b')]({'raw':!![],'attributes':['id','OrderBy']})[_0x339d('0x15')](function(_0x5c2e66){var _0x3c679a=[];for(var _0x37c82f=0x0;_0x37c82f<_0x21a45f['items'][_0x339d('0x25')];_0x37c82f++){var _0x4f6214=_0x21a45f[_0x339d('0x7f')]?_[_0x339d('0x52')](_0x21a45f[_0x339d('0x7f')][_0x37c82f])?'':_0x21a45f[_0x339d('0x7f')][_0x37c82f]:_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x81')]?_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x81')]:'';var _0x21df97=_['isNil'](_0x21a45f['items'][_0x37c82f][_0x339d('0x82')])?'':_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x82')];var _0x157f5f=_0x4f6214+':'+_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x6f')]+'§'+_0x21df97;if(_[_0x339d('0x52')](_0x4feb83))_0x4feb83=_0x157f5f;else _0x4feb83+=';'+_0x157f5f;var _0x451cf0=null;var _0x4bb1be=null;if(_0x21a45f[_0x339d('0x7f')]){if(!_[_0x339d('0x52')](_0x21a45f[_0x339d('0x7f')][_0x37c82f])){_0x4bb1be=_['find'](_0x5c2e66,function(_0x453019){return _0x453019['id']===_0x21a45f[_0x339d('0x7f')][_0x37c82f];});if(!_[_0x339d('0x52')](_0x4bb1be)){_0x451cf0=_0x4bb1be['OrderBy'];}}}else{if(!_['isNil'](_0x21a45f[_0x339d('0x80')][_0x37c82f])){_0x4bb1be=_['find'](_0x5c2e66,function(_0xad4f61){return _0xad4f61['id']===_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x81')];});if(!_[_0x339d('0x52')](_0x4bb1be)){_0x451cf0=_0x37c82f;}}}if(_['isNil'](_0x451cf0)){_0x451cf0=0x64;}_0x3c679a['push'](addAdditionalPhone(_0x21a45f['id'],_0x21a45f['items'][_0x37c82f]['phone'],_0x21a45f['item_types']?_[_0x339d('0x52')](_0x21a45f['item_types'][_0x37c82f])?null:_0x21a45f['item_types'][_0x37c82f]:_0x21a45f['items'][_0x37c82f][_0x339d('0x81')]?_0x21a45f[_0x339d('0x80')][_0x37c82f][_0x339d('0x81')]:null,_0x451cf0,_0x21df97));}Promise[_0x339d('0x7e')](_0x3c679a)[_0x339d('0x15')](function(){db[_0x339d('0x21')][_0x339d('0x3f')]({'AdditionalPhones':_0x4feb83},{'where':{'id':_0x21a45f['id']}})[_0x339d('0x15')](function(){_0x1bf331(0x1);});});});});});}function addAdditionalPhone(_0x10e6a8,_0x3a55b9,_0x117a3e,_0x555af0,_0x46b9a0){return db[_0x339d('0x60')][_0x339d('0x22')]({'where':{'CmContactId':_0x10e6a8,'item':_0x3a55b9}})[_0x339d('0x15')](function(_0x462d77){if(_0x462d77)logger[_0x339d('0x30')]('contact\x20phone\x20exists',_0x462d77);else{db['CmContactHasItem'][_0x339d('0x50')]({'CmContactId':_0x10e6a8,'item':_0x3a55b9,'ItemTypeId':_0x117a3e,'OrderBy':_0x555af0,'ItemClass':'PHONE','description':_0x46b9a0});}});}function deleteCmHopperPhones(_0x5dd8f4){return new Promise(function(_0x4ca9e0){return db[_0x339d('0x3c')][_0x339d('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5dd8f4}})['then'](function(_0x2244b3){db[_0x339d('0x83')][_0x339d('0x16')]({'where':{'CmHopperId':{'$in':_[_0x339d('0x6a')](_0x2244b3,'id')}}});})[_0x339d('0x15')](function(){_0x4ca9e0(0x1);});});}function addCmHopperPhones(_0xb51143){return new Promise(function(_0x26d512){return db[_0x339d('0x3c')][_0x339d('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb51143}})[_0x339d('0x15')](function(_0x1307c6){var _0x5e835d=[];_[_0x339d('0x6a')](_0x1307c6,function(_0x1c01c9){_0x5e835d[_0x339d('0x59')](createCmHopperPhone(_0xb51143,_0x1c01c9['id']));});Promise[_0x339d('0x7e')](_0x5e835d)['then'](function(){_0x26d512(0x1);});});});}function createCmHopperPhone(_0x2bfae2,_0x1cc889){return new Promise(function(_0x4a0310){db[_0x339d('0x60')][_0x339d('0x2b')]({'raw':!![],'attributes':[_0x339d('0x84'),'OrderBy'],'where':{'CmContactId':_0x2bfae2,'ItemClass':_0x339d('0x85')},'include':[{'model':db[_0x339d('0x62')],'attributes':[_0x339d('0x86')],'as':_0x339d('0x87')}],'order':['OrderBy',db[_0x339d('0x63')]['literal'](_0x339d('0x88'))]})[_0x339d('0x15')](function(_0x3c968f){var _0x328a05=0x1;var _0x1a06fb=_[_0x339d('0x6a')](_0x3c968f,function(_0x50264c){_0x50264c[_0x339d('0x89')]=_0x1cc889;_0x50264c['phone']=_0x50264c[_0x339d('0x84')];_0x50264c[_0x339d('0x86')]=_0x328a05;delete _0x50264c[_0x339d('0x8a')];_0x328a05=_0x328a05+0x1;return _0x50264c;});return db['CmHopperAdditionalPhone'][_0x339d('0x8b')](_0x1a06fb,{});})[_0x339d('0x15')](function(){_0x4a0310(0x1);});});}function insertAdditionalPhones(_0x24f6b0,_0x356f93){return new Promise(function(_0x49e67d){var _0x1e2e52=[];for(var _0x17d2f7=0x0;_0x17d2f7<_0x356f93[_0x339d('0x25')];_0x17d2f7++){var _0x2fbe5c=_0x356f93[_0x17d2f7];_0x1e2e52[_0x339d('0x59')](parseContactItemType(_0x2fbe5c));}Promise['all'](_0x1e2e52)['then'](function(){var _0x5e9055={'id':_0x24f6b0['id'],'items':_0x356f93};return addAdditionalPhones(_0x5e9055)[_0x339d('0x15')](function(){return addCmHopperPhones(_0x24f6b0['id']);});})[_0x339d('0x15')](function(){_0x49e67d(_0x24f6b0);});});}function parseContactItemType(_0x865a60){return new Promise(function(_0x4cb5ea){if(_0x865a60[_0x339d('0x33')](_0x339d('0x81'))){_0x4cb5ea(_0x865a60);}else{return db[_0x339d('0x62')][_0x339d('0x22')]({'where':{'name':_0x865a60[_0x339d('0x87')]}})['then'](function(_0x39e38a){if(_['isNil'](_0x39e38a))_0x865a60[_0x339d('0x81')]=null;else _0x865a60[_0x339d('0x81')]=_0x39e38a['id'];_0x4cb5ea(_0x865a60);});}});}exports['getAdditionalPhones']=function(_0x12043b,_0x28ab8b){return db[_0x339d('0x60')][_0x339d('0x2b')]({'raw':!![],'where':{'CmContactId':_0x12043b[_0x339d('0x23')]['id'],'ItemClass':_0x339d('0x85')},'include':[{'model':db[_0x339d('0x62')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x339d('0x63')][_0x339d('0x8c')](_0x339d('0x88'))]]})[_0x339d('0x15')](function(_0x205046){return _0x205046;})[_0x339d('0x15')](respondWithResult(_0x28ab8b,null))[_0x339d('0x20')](handleError(_0x28ab8b,null));};exports[_0x339d('0x8d')]=function(_0x3619f3,_0x4dda06){return db[_0x339d('0x60')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3619f3[_0x339d('0x35')][_0x339d('0x8e')]}})['then'](function(_0x22602c){var _0x181079=_['map'](_0x22602c,function(_0x5d23ad){_0x5d23ad[_0x339d('0x8f')]=_0x3619f3[_0x339d('0x35')]['toContactId'];return _0x5d23ad;});return db[_0x339d('0x60')][_0x339d('0x8b')](_0x181079,{});})[_0x339d('0x15')](function(){return addCmHopperPhones(_0x3619f3[_0x339d('0x35')][_0x339d('0x90')]);})[_0x339d('0x15')](function(){return['ok'];})[_0x339d('0x15')](respondWithResult(_0x4dda06,null))[_0x339d('0x20')](handleError(_0x4dda06,null));};exports['rescheduleAdditionalPhones']=function(_0x49c6ac,_0x349b80){var _0x1b8ba9=[];_0x1b8ba9[_0x339d('0x59')](createCmHopperPhone(_0x49c6ac['body']['id'],_0x49c6ac['body'][_0x339d('0x91')]));Promise[_0x339d('0x7e')](_0x1b8ba9)[_0x339d('0x15')](function(){return[0x1];})[_0x339d('0x15')](respondWithResult(_0x349b80,null));};exports[_0x339d('0x92')]=function(_0xba9026,_0x4dc388){var _0xf5c145={'raw':![],'where':{}};var _0x517b1d={};var _0x49358f={'count':0x0,'rows':[]};return db[_0x339d('0x21')][_0x339d('0x70')]({'where':{'id':_0xba9026['params']['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x4dc388,null))['then'](function(_0x3d761f){if(_0x3d761f){_0x517b1d['model']=_['keys'](db[_0x339d('0x3c')][_0x339d('0x72')]);_0x517b1d[_0x339d('0x1f')]=_['keys'](_0xba9026[_0x339d('0x1f')]);_0x517b1d['filters']=_[_0x339d('0x74')](_0x517b1d[_0x339d('0x71')],_0x517b1d[_0x339d('0x1f')]);_0xf5c145[_0x339d('0x75')]=_['intersection'](_0x517b1d[_0x339d('0x71')],qs[_0x339d('0x76')](_0xba9026[_0x339d('0x1f')]['fields']));_0xf5c145[_0x339d('0x75')]=_0xf5c145[_0x339d('0x75')][_0x339d('0x25')]?_0xf5c145[_0x339d('0x75')]:_0x517b1d[_0x339d('0x71')];if(!_0xba9026[_0x339d('0x1f')][_0x339d('0x33')](_0x339d('0x93'))){_0xf5c145[_0x339d('0x12')]=qs[_0x339d('0x12')](_0xba9026['query'][_0x339d('0x12')]);_0xf5c145['offset']=qs[_0x339d('0xf')](_0xba9026[_0x339d('0x1f')][_0x339d('0xf')]);}_0xf5c145['order']=qs['sort'](_0xba9026[_0x339d('0x1f')][_0x339d('0x78')]);_0xf5c145[_0x339d('0x58')]=qs[_0x339d('0x73')](_[_0x339d('0x94')](_0xba9026[_0x339d('0x1f')],_0x517b1d[_0x339d('0x73')]));_0xf5c145[_0x339d('0x58')][_0x339d('0x95')]=_0x3d761f['id'];if(_0xba9026[_0x339d('0x1f')][_0x339d('0x79')]){_0xf5c145['where']=_[_0x339d('0x34')](_0xf5c145[_0x339d('0x58')],{'$or':_['map'](_0xf5c145['attributes'],function(_0x21de98){var _0x2ccb2b={};_0x2ccb2b[_0x21de98]={'$like':'%'+_0xba9026[_0x339d('0x1f')][_0x339d('0x79')]+'%'};return _0x2ccb2b;})});}_0xf5c145=_[_0x339d('0x34')]({},_0xf5c145,_0xba9026[_0x339d('0x96')]);return db[_0x339d('0x3c')][_0x339d('0x11')]({'where':_0xf5c145[_0x339d('0x58')]})['then'](function(_0x1ac9f3){_0x49358f[_0x339d('0x11')]=_0x1ac9f3;if(_0xba9026[_0x339d('0x1f')]['includeAll']){_0xf5c145['include']=[{'all':!![]}];}return db[_0x339d('0x3c')]['findAll'](_0xf5c145);})[_0x339d('0x15')](function(_0x1a03e4){_0x49358f[_0x339d('0x97')]=_0x1a03e4;return _0x49358f;});}})[_0x339d('0x15')](respondWithFilteredResult(_0x4dc388,_0xf5c145))[_0x339d('0x20')](handleError(_0x4dc388,null));};exports[_0x339d('0x98')]=function(_0x42d33f,_0x24ac8c){var _0x175fd4={'raw':!![],'where':{}};var _0x2f5ef3={};var _0x27b535={'count':0x0,'rows':[]};return db['CmContact'][_0x339d('0x70')]({'where':{'id':_0x42d33f['params']['id']}})['then'](handleEntityNotFound(_0x24ac8c,null))['then'](function(_0x3d1b1c){if(_0x3d1b1c){_0x2f5ef3[_0x339d('0x71')]=_[_0x339d('0x26')](db[_0x339d('0x4a')][_0x339d('0x72')]);_0x2f5ef3[_0x339d('0x1f')]=_[_0x339d('0x26')](_0x42d33f[_0x339d('0x1f')]);_0x2f5ef3[_0x339d('0x73')]=_[_0x339d('0x74')](_0x2f5ef3[_0x339d('0x71')],_0x2f5ef3[_0x339d('0x1f')]);_0x175fd4['attributes']=_[_0x339d('0x74')](_0x2f5ef3[_0x339d('0x71')],qs[_0x339d('0x76')](_0x42d33f['query'][_0x339d('0x76')]));_0x175fd4[_0x339d('0x75')]=_0x175fd4[_0x339d('0x75')][_0x339d('0x25')]?_0x175fd4[_0x339d('0x75')]:_0x2f5ef3[_0x339d('0x71')];if(!_0x42d33f[_0x339d('0x1f')][_0x339d('0x33')]('nolimit')){_0x175fd4[_0x339d('0x12')]=qs['limit'](_0x42d33f[_0x339d('0x1f')][_0x339d('0x12')]);_0x175fd4[_0x339d('0xf')]=qs[_0x339d('0xf')](_0x42d33f[_0x339d('0x1f')][_0x339d('0xf')]);}_0x175fd4[_0x339d('0x77')]=qs[_0x339d('0x78')](_0x42d33f[_0x339d('0x1f')][_0x339d('0x78')]);_0x175fd4[_0x339d('0x58')]=qs[_0x339d('0x73')](_[_0x339d('0x94')](_0x42d33f[_0x339d('0x1f')],_0x2f5ef3[_0x339d('0x73')]));_0x175fd4['where'][_0x339d('0x95')]=_0x3d1b1c['id'];if(_0x42d33f[_0x339d('0x1f')][_0x339d('0x79')]){_0x175fd4[_0x339d('0x58')]=_[_0x339d('0x34')](_0x175fd4['where'],{'$or':_[_0x339d('0x6a')](_0x175fd4[_0x339d('0x75')],function(_0x5b607f){var _0x1070f2={};_0x1070f2[_0x5b607f]={'$like':'%'+_0x42d33f[_0x339d('0x1f')]['filter']+'%'};return _0x1070f2;})});}_0x175fd4=_[_0x339d('0x34')]({},_0x175fd4,_0x42d33f[_0x339d('0x96')]);return db[_0x339d('0x4a')]['count']({'where':_0x175fd4[_0x339d('0x58')]})['then'](function(_0x233403){_0x27b535['count']=_0x233403;if(_0x42d33f['query'][_0x339d('0x99')]){_0x175fd4[_0x339d('0x9a')]=[{'all':!![]}];}return db[_0x339d('0x4a')][_0x339d('0x2b')](_0x175fd4);})[_0x339d('0x15')](function(_0xc732e){_0x27b535[_0x339d('0x97')]=_0xc732e;return _0x27b535;});}})['then'](respondWithFilteredResult(_0x24ac8c,_0x175fd4))['catch'](handleError(_0x24ac8c,null));};exports[_0x339d('0x9b')]=function(_0x271285,_0x28500b){var _0x1dee24={'raw':!![],'where':{}};var _0x4710d2={};var _0x2f364c={'count':0x0,'rows':[]};return db[_0x339d('0x21')][_0x339d('0x70')]({'where':{'id':_0x271285['params']['id']}})[_0x339d('0x15')](handleEntityNotFound(_0x28500b,null))['then'](function(_0x15fe83){if(_0x15fe83){_0x4710d2[_0x339d('0x71')]=_[_0x339d('0x26')](db['CmHopperFinal']['rawAttributes']);_0x4710d2[_0x339d('0x1f')]=_['keys'](_0x271285[_0x339d('0x1f')]);_0x4710d2[_0x339d('0x73')]=_[_0x339d('0x74')](_0x4710d2['model'],_0x4710d2[_0x339d('0x1f')]);_0x1dee24[_0x339d('0x75')]=_[_0x339d('0x74')](_0x4710d2['model'],qs[_0x339d('0x76')](_0x271285[_0x339d('0x1f')]['fields']));_0x1dee24[_0x339d('0x75')]=_0x1dee24[_0x339d('0x75')][_0x339d('0x25')]?_0x1dee24['attributes']:_0x4710d2[_0x339d('0x71')];if(!_0x271285['query'][_0x339d('0x33')](_0x339d('0x93'))){_0x1dee24[_0x339d('0x12')]=qs[_0x339d('0x12')](_0x271285['query'][_0x339d('0x12')]);_0x1dee24[_0x339d('0xf')]=qs[_0x339d('0xf')](_0x271285[_0x339d('0x1f')][_0x339d('0xf')]);}_0x1dee24['order']=qs[_0x339d('0x78')](_0x271285['query'][_0x339d('0x78')]);_0x1dee24['where']=qs[_0x339d('0x73')](_[_0x339d('0x94')](_0x271285['query'],_0x4710d2[_0x339d('0x73')]));_0x1dee24[_0x339d('0x58')][_0x339d('0x95')]=_0x15fe83['id'];if(_0x271285[_0x339d('0x1f')]['filter']){_0x1dee24[_0x339d('0x58')]=_[_0x339d('0x34')](_0x1dee24[_0x339d('0x58')],{'$or':_[_0x339d('0x6a')](_0x1dee24[_0x339d('0x75')],function(_0x22b84d){var _0x134e51={};_0x134e51[_0x22b84d]={'$like':'%'+_0x271285[_0x339d('0x1f')][_0x339d('0x79')]+'%'};return _0x134e51;})});}_0x1dee24=_[_0x339d('0x34')]({},_0x1dee24,_0x271285[_0x339d('0x96')]);return db[_0x339d('0x49')][_0x339d('0x11')]({'where':_0x1dee24[_0x339d('0x58')]})[_0x339d('0x15')](function(_0x38667f){_0x2f364c[_0x339d('0x11')]=_0x38667f;if(_0x271285['query'][_0x339d('0x99')]){_0x1dee24['include']=[{'all':!![]}];}return db[_0x339d('0x49')]['findAll'](_0x1dee24);})[_0x339d('0x15')](function(_0x3028a6){_0x2f364c[_0x339d('0x97')]=_0x3028a6;return _0x2f364c;});}})[_0x339d('0x15')](respondWithFilteredResult(_0x28500b,_0x1dee24))[_0x339d('0x20')](handleError(_0x28500b,null));};exports[_0x339d('0x9c')]=function(_0x51aebc,_0x1c25a6){var _0x4ab0fe={'raw':!![],'where':{}};var _0x27726d={};var _0x44ab30={'count':0x0,'rows':[]};return db[_0x339d('0x21')][_0x339d('0x70')]({'where':{'id':_0x51aebc[_0x339d('0x23')]['id']}})['then'](handleEntityNotFound(_0x1c25a6,null))[_0x339d('0x15')](function(_0x58d915){if(_0x58d915){_0x27726d[_0x339d('0x71')]=_[_0x339d('0x26')](db[_0x339d('0x4d')][_0x339d('0x72')]);_0x27726d['query']=_[_0x339d('0x26')](_0x51aebc[_0x339d('0x1f')]);_0x27726d['filters']=_[_0x339d('0x74')](_0x27726d[_0x339d('0x71')],_0x27726d[_0x339d('0x1f')]);_0x4ab0fe[_0x339d('0x75')]=_[_0x339d('0x74')](_0x27726d[_0x339d('0x71')],qs[_0x339d('0x76')](_0x51aebc[_0x339d('0x1f')][_0x339d('0x76')]));_0x4ab0fe[_0x339d('0x75')]=_0x4ab0fe['attributes'][_0x339d('0x25')]?_0x4ab0fe[_0x339d('0x75')]:_0x27726d[_0x339d('0x71')];if(!_0x51aebc[_0x339d('0x1f')]['hasOwnProperty'](_0x339d('0x93'))){_0x4ab0fe['limit']=qs[_0x339d('0x12')](_0x51aebc[_0x339d('0x1f')][_0x339d('0x12')]);_0x4ab0fe[_0x339d('0xf')]=qs[_0x339d('0xf')](_0x51aebc[_0x339d('0x1f')][_0x339d('0xf')]);}_0x4ab0fe['order']=qs[_0x339d('0x78')](_0x51aebc[_0x339d('0x1f')][_0x339d('0x78')]);_0x4ab0fe[_0x339d('0x58')]=qs[_0x339d('0x73')](_[_0x339d('0x94')](_0x51aebc[_0x339d('0x1f')],_0x27726d[_0x339d('0x73')]));_0x4ab0fe[_0x339d('0x58')][_0x339d('0x95')]=_0x58d915['id'];if(_0x51aebc[_0x339d('0x1f')]['filter']){_0x4ab0fe[_0x339d('0x58')]=_[_0x339d('0x34')](_0x4ab0fe[_0x339d('0x58')],{'$or':_[_0x339d('0x6a')](_0x4ab0fe[_0x339d('0x75')],function(_0xffa7b3){var _0x5a9b3c={};_0x5a9b3c[_0xffa7b3]={'$like':'%'+_0x51aebc[_0x339d('0x1f')][_0x339d('0x79')]+'%'};return _0x5a9b3c;})});}_0x4ab0fe=_['merge']({},_0x4ab0fe,_0x51aebc[_0x339d('0x96')]);return db[_0x339d('0x4d')][_0x339d('0x11')]({'where':_0x4ab0fe[_0x339d('0x58')]})[_0x339d('0x15')](function(_0x34710a){_0x44ab30['count']=_0x34710a;if(_0x51aebc['query'][_0x339d('0x99')]){_0x4ab0fe[_0x339d('0x9a')]=[{'all':!![]}];}return db[_0x339d('0x4d')]['findAll'](_0x4ab0fe);})[_0x339d('0x15')](function(_0x55b94a){_0x44ab30[_0x339d('0x97')]=_0x55b94a;return _0x44ab30;});}})['then'](respondWithFilteredResult(_0x1c25a6,_0x4ab0fe))['catch'](handleError(_0x1c25a6,null));};exports[_0x339d('0x9d')]=function(_0x1cbfd2,_0x126184){try{if(!_0x1cbfd2[_0x339d('0x35')][_0x339d('0x5a')]){throw new Error(_0x339d('0x9e'));}if(!_0x1cbfd2[_0x339d('0x35')]['binding_keys']){throw new Error(_0x339d('0x9f'));}if(!_0x1cbfd2['body'][_0x339d('0xa0')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x1cbfd2[_0x339d('0x35')][_0x339d('0xa1')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3fbda9=_0x1cbfd2['body']['binding_keys']['split'](',');var _0x5d0c1d=_0x1cbfd2[_0x339d('0x35')][_0x339d('0xa0')][_0x339d('0xa2')](',');if(!_0x3fbda9[_0x339d('0x25')]||!_0x5d0c1d[_0x339d('0x25')]||_0x3fbda9[_0x339d('0x25')]!==_0x5d0c1d['length']){throw new Error(_0x339d('0xa3'));}_0x1cbfd2[_0x339d('0x35')][_0x339d('0x76')]=_['zipObject'](_0x3fbda9,_0x5d0c1d);if(!_0x1cbfd2[_0x339d('0x35')][_0x339d('0x76')][_0x339d('0x6f')]){throw new Error(_0x339d('0xa4'));}if(!_0x1cbfd2[_0x339d('0x35')]['fields']['firstName']){throw new Error(_0x339d('0xa5'));}var _0x2ca98a=path[_0x339d('0x39')](config[_0x339d('0xa6')],_0x339d('0xa7'),_0x1cbfd2['file'][_0x339d('0xa8')]);fs[_0x339d('0xa9')](_0x2ca98a,parseInt('0777',0x8));var _0x4ec989=require(_0x339d('0xaa'))['fork'](path[_0x339d('0x39')](__dirname,_0x339d('0xab')),[_0x2ca98a,_0x1cbfd2[_0x339d('0x35')]['binding_keys'],_0x1cbfd2['body'][_0x339d('0xa0')],_0x1cbfd2['body'][_0x339d('0x5a')],_0x1cbfd2[_0x339d('0x35')][_0x339d('0xac')],_0x1cbfd2['body']['duplicates'],_0x1cbfd2[_0x339d('0x35')][_0x339d('0xa1')]]);return _0x126184['status'](0xc8)['json']({'message':_0x339d('0xad'),'pid':_0x4ec989[_0x339d('0xae')]});}catch(_0x47aaac){return _0x126184[_0x339d('0xd')](0x1f4)[_0x339d('0x1b')](_0x47aaac);}};exports[_0x339d('0xaf')]=function(_0x563638,_0xae0897){var _0x12eb7a=fs[_0x339d('0xb0')](_0x563638[_0x339d('0xb1')]['path']);Papa[_0x339d('0xb2')](_0x12eb7a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x13e2e1){return _0xae0897[_0x339d('0xd')](0xc8)['json']({'file':_0x563638['file'],'fields':_0x13e2e1['meta'][_0x339d('0x76')]});}});};exports[_0x339d('0xb3')]=function(_0x1ba506,_0x5542da){return db['User'][_0x339d('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x339d('0xb4')}})[_0x339d('0x15')](function(_0x1dd7d7){var _0x529174=![];if(!_0x1ba506['body'][_0x339d('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1ba506[_0x339d('0x35')]['binding'][_0x339d('0x6f')]){throw new Error(_0x339d('0xa4'));}if(!_0x1ba506[_0x339d('0x35')][_0x339d('0xb5')][_0x339d('0xb6')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1ba506[_0x339d('0x35')][_0x339d('0xa1')]){throw new Error(_0x339d('0xb7'));}var _0x2ad262=require(_0x339d('0xaa'))['fork'](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x1ba506[_0x339d('0x23')]['id'],JSON[_0x339d('0xb8')](_0x1ba506[_0x339d('0x35')]),JSON['stringify'](_0x1dd7d7)]);_0x2ad262['on'](_0x339d('0xb9'),function(){_0x529174=!![];return _0x5542da[_0x339d('0xd')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2ad262[_0x339d('0xae')]});});_0x2ad262['on'](_0x339d('0xba'),function(_0x4ccbeb){if(_0x4ccbeb&&!_0x529174){return _0x5542da[_0x339d('0xd')](0x1f4)[_0x339d('0xe')]({'message':'error\x20child\x20process','pid':_0x2ad262[_0x339d('0xae')]});}});})[_0x339d('0x20')](handleError(_0x5542da,null));};exports['importUpdates']=function(_0xe159fc,_0x2b7a61){return db[_0x339d('0xbb')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x339d('0xb4')}})['then'](function(_0x4650c3){var _0x48798b=![];if(!_0xe159fc['body']['ListId']){throw new Error(_0x339d('0x9e'));}if(!_0xe159fc['body'][_0x339d('0xb5')][_0x339d('0x6f')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xe159fc[_0x339d('0x35')][_0x339d('0xb5')]['firstName']){throw new Error(_0x339d('0xa5'));}if(!_0xe159fc[_0x339d('0x35')][_0x339d('0xa1')]){throw new Error(_0x339d('0xb7'));}var _0x48ddc3=require(_0x339d('0xaa'))[_0x339d('0xbc')](path[_0x339d('0x39')](__dirname,'../../components/import/cm/csvUpdates'),[_0xe159fc[_0x339d('0x23')]['id'],JSON['stringify'](_0xe159fc[_0x339d('0x35')]),JSON[_0x339d('0xb8')](_0x4650c3)]);_0x48ddc3['on'](_0x339d('0xb9'),function(){_0x48798b=!![];return _0x2b7a61[_0x339d('0xd')](0xc8)[_0x339d('0xe')]({'message':_0x339d('0xbd'),'pid':_0x48ddc3[_0x339d('0xae')]});});_0x48ddc3['on'](_0x339d('0xba'),function(_0x29f3a0){if(_0x29f3a0&&!_0x48798b){return _0x2b7a61['status'](0x1f4)[_0x339d('0xe')]({'message':_0x339d('0xbe'),'pid':_0x48ddc3[_0x339d('0xae')]});}});})[_0x339d('0x20')](handleError(_0x2b7a61,null));};exports[_0x339d('0xbf')]=function(_0x54309f,_0x4341d6){var _0xb05428=[_0x339d('0xc0'),_0x339d('0xc1'),_0x339d('0xc2'),'openchannel',_0x339d('0xc3'),_0x339d('0xc4'),_0x339d('0xc5')];var _0xd57a45={'offset':0x0,'order':qs[_0x339d('0x78')](_0x339d('0xc6'))},_0x41d904={'count':0x0,'rows':[]};Promise['resolve']()[_0x339d('0x15')](function(){if(_0x54309f[_0x339d('0x1f')]['channel']){if(!_['includes'](_0xb05428,_0x54309f[_0x339d('0x1f')][_0x339d('0xc7')][_0x339d('0xc8')]())){throw new Error(_0x339d('0xc9'));}_0xb05428=[_0x54309f[_0x339d('0x1f')]['channel']['toLowerCase']()];}if(_0x54309f[_0x339d('0x1f')][_0x339d('0xca')]){try{var _0x47ed75=JSON[_0x339d('0xb2')](_0x54309f['query']['range']);if(!moment(_0x47ed75[_0x339d('0x3b')])[_0x339d('0xcb')]()){throw new Error(_0x339d('0xcc'));}if(!moment(_0x47ed75['to'])[_0x339d('0xcb')]()){throw new Error(_0x339d('0xcd'));}}catch(_0x49e1a6){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x54309f[_0x339d('0x1f')]['hasOwnProperty'](_0x339d('0x93'))){_0xd57a45[_0x339d('0x12')]=qs[_0x339d('0x12')](_0x54309f[_0x339d('0x1f')][_0x339d('0x12')]||0xa);_0xd57a45[_0x339d('0xf')]=qs[_0x339d('0xf')](_0x54309f[_0x339d('0x1f')][_0x339d('0xf')]);}var _0x4caabe=_0xb05428[_0x339d('0x6a')](function(_0x174fef){if(_0x174fef===_0x339d('0xc5')){var _0xee33ff={'attributes':['id',_0x339d('0xce'),_0x339d('0x2e'),_0x339d('0xcf'),_0x339d('0xd0'),_0x339d('0xd1'),_0x339d('0xd2'),_0x339d('0xd3'),_0x339d('0xd4'),_0x339d('0xd5'),_0x339d('0xd6'),_0x339d('0xd7'),'userSecondDisposition',_0x339d('0xd8'),_0x339d('0xd9')],'where':{'ContactId':_0x54309f[_0x339d('0x23')]['id']},'include':[{'model':db[_0x339d('0xbb')],'as':_0x339d('0xbb'),'attributes':['id','name','fullname','alias']}],'order':[[_0x339d('0xd6'),_0x339d('0xda')]]};if(_0x54309f[_0x339d('0x1f')][_0x339d('0xca')]){_0xee33ff[_0x339d('0x58')][_0x339d('0xd6')]={'$gte':_0x47ed75[_0x339d('0x3b')],'$lte':_0x47ed75['to']};}return db['VoiceCallReport'][_0x339d('0xdb')](_0xee33ff)['then'](function(_0x576cbf){_0x41d904[_0x339d('0x11')]+=_0x576cbf[_0x339d('0x11')];return _['map'](_0x576cbf[_0x339d('0x97')],function(_0x2dc2d6){var _0x17ebeb=_0x2dc2d6['get']({'plain':!![]});_0x17ebeb[_0x339d('0xc7')]=_0x174fef;if(_0x17ebeb[_0x339d('0xbb')]){_0x17ebeb[_0x339d('0xbb')]={'id':_0x17ebeb['User']['id'],'name':_0x17ebeb['User'][_0x339d('0x1a')],'fullname':_0x17ebeb[_0x339d('0xbb')]['fullname'],'alias':_0x17ebeb[_0x339d('0xbb')]['alias']};}return _0x17ebeb;});});}else{var _0x28c923=_[_0x339d('0xdc')](_0x174fef)+(_0x174fef===_0x339d('0xc1')?_0x339d('0xdd'):'Account');var _0x102bfa={'attributes':['id',_0x339d('0xde'),_0x339d('0xdf'),'createdAt',_0x339d('0xd5'),_0x339d('0xe0'),_0x339d('0xe1'),_0x339d('0xe2'),'UserId',_0x28c923+'Id'],'where':{'ContactId':_0x54309f['params']['id']},'include':[{'model':db[_0x28c923],'as':_0x339d('0xe3'),'attributes':['id',_0x339d('0x1a'),_0x339d('0xe4')]},{'model':db['User'],'as':_0x339d('0xe5'),'attributes':['id',_0x339d('0x1a'),_0x339d('0xe6')]},{'model':db['Tag'],'as':_0x339d('0x5e'),'attributes':['id',_0x339d('0x1a'),_0x339d('0xe7')],'through':{'attributes':[]}}],'order':[[_0x339d('0xd6'),_0x339d('0xda')]]};if(_0x54309f[_0x339d('0x1f')][_0x339d('0xca')]){_0x102bfa[_0x339d('0x58')]['createdAt']={'$gte':_0x47ed75[_0x339d('0x3b')],'$lte':_0x47ed75['to']};}switch(_0x174fef){case _0x339d('0xc1'):_0x102bfa[_0x339d('0x75')][_0x339d('0x59')](_0x339d('0xe8'),_0x339d('0xe9'),_0x339d('0xea'),_0x339d('0xeb'),'osName',_0x339d('0xec'),_0x339d('0xed'),_0x339d('0xee'),_0x339d('0xef'));break;case _0x339d('0xc0'):_0x102bfa['attributes'][_0x339d('0x59')](_0x339d('0xf0'),'substatus');break;case _0x339d('0xf1'):_0x102bfa[_0x339d('0x75')][_0x339d('0x59')](_0x339d('0xf2'),'threadId');break;}return db[_[_0x339d('0xdc')](_0x174fef)+_0x339d('0xf3')][_0x339d('0xdb')](_0x102bfa)['then'](function(_0x404bfd){_0x41d904['count']+=_0x404bfd[_0x339d('0x11')];return _['map'](_0x404bfd[_0x339d('0x97')],function(_0x3d032f){var _0x3cf88b=_0x3d032f['get']({'plain':!![]});_0x3cf88b[_0x339d('0xc7')]=_0x174fef;if(_0x3cf88b['Owner']){_0x3cf88b['Owner']={'id':_0x3cf88b[_0x339d('0xe5')]['id'],'name':_0x3cf88b[_0x339d('0xe5')][_0x339d('0x1a')],'fullname':_0x3cf88b[_0x339d('0xe5')][_0x339d('0xe6')]};}return _0x3cf88b;});});}});return Promise[_0x339d('0x7e')](_0x4caabe);})['then'](function(_0x54a7e5){return _(_0x54a7e5)[_0x339d('0xf4')]()[_0x339d('0xf5')]('createdAt')[_0x339d('0xf6')]()[_0x339d('0xf7')]();})[_0x339d('0x15')](function(_0x29dce0){_0x41d904[_0x339d('0x97')]=_0xd57a45[_0x339d('0x12')]?_0x29dce0[_0x339d('0xf8')](_0xd57a45[_0x339d('0xf')],_0xd57a45[_0x339d('0xf')]+_0xd57a45[_0x339d('0x12')]):_0x29dce0;return _0x41d904;})['then'](respondWithFilteredResult(_0x4341d6,_0xd57a45))[_0x339d('0x20')](handleError(_0x4341d6,null));}; \ No newline at end of file +var _0x52af=['cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','CmHopper','phone','getTags','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','sort','pick','merge','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','ItemTypeId','items','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','toContactId','getHoppers','ContactId','includeAll','getHopperHistories','CmHopperHistory','include','rows','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','join','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','chat','fax','whatsapp','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','voice','source','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','Tags','customerIp','deviceModel','osName','ratingMessage','referer','openchannel','Interaction','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','localhost','socket.io-emitter','register','offset','undefined','count','limit','status','set','json','update','then','destroy','end','sendStatus','error','name','send','index','describe','findAll','query','CmContact','find','params','catch','tags','keys','length','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','get','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','hasOwnProperty','contact','all','show','Tag','color','Phones','ContactItemType','ItemType','sequelize','literal','$and','omit','map','format','pickBy','startsWith'];(function(_0x4e125d,_0x998de0){var _0x8d9971=function(_0xcdb789){while(--_0xcdb789){_0x4e125d['push'](_0x4e125d['shift']());}};_0x8d9971(++_0x998de0);}(_0x52af,0x88));var _0xf52a=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x52af[_0x368fb9];return _0x4892fb;};'use strict';var moment=require(_0xf52a('0x0'));var BPromise=require(_0xf52a('0x1'));var util=require(_0xf52a('0x2'));var path=require(_0xf52a('0x3'));var fs=require('fs');var _=require(_0xf52a('0x4'));var squel=require('squel');var Papa=require(_0xf52a('0x5'));var Redis=require(_0xf52a('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0xf52a('0x7'))(_0xf52a('0x8'));var config=require(_0xf52a('0x9'));var shared=require(_0xf52a('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf52a('0xb')](config['redis'],{'host':_0xf52a('0xc'),'port':0x18eb});var socket=require(_0xf52a('0xd'))(new Redis(config['redis']));require('./cmContact.socket')[_0xf52a('0xe')](socket);function respondWithResult(_0x2fec56,_0x39ff68){_0x39ff68=_0x39ff68||0xc8;return function(_0x209c7e){if(_0x209c7e){return _0x2fec56['status'](_0x39ff68)['json'](_0x209c7e);}};}function respondWithFilteredResult(_0x2ff162,_0x40d418){return function(_0x2e2703){if(_0x2e2703){var _0x1aa201=typeof _0x40d418[_0xf52a('0xf')]===_0xf52a('0x10')&&typeof _0x40d418['limit']===_0xf52a('0x10');var _0x3fbbef=_0x2e2703[_0xf52a('0x11')];var _0x5cefb2=_0x1aa201?0x0:_0x40d418[_0xf52a('0xf')];var _0x54b350=_0x1aa201?_0x2e2703[_0xf52a('0x11')]:_0x40d418['offset']+_0x40d418[_0xf52a('0x12')];var _0x4a37ca;if(_0x54b350>=_0x3fbbef){_0x54b350=_0x3fbbef;_0x4a37ca=0xc8;}else{_0x4a37ca=0xce;}_0x2ff162[_0xf52a('0x13')](_0x4a37ca);return _0x2ff162[_0xf52a('0x14')]('Content-Range',_0x5cefb2+'-'+_0x54b350+'/'+_0x3fbbef)[_0xf52a('0x15')](_0x2e2703);}return null;};}function saveUpdates(_0x43cd73){return function(_0x5f4811){if(_0x5f4811){return _0x5f4811[_0xf52a('0x16')](_0x43cd73)[_0xf52a('0x17')](function(_0x563248){return _0x563248;});}return null;};}function removeEntity(_0x1aad2a){return function(_0x3af4bd){if(_0x3af4bd){return _0x3af4bd[_0xf52a('0x18')]()[_0xf52a('0x17')](function(){_0x1aad2a[_0xf52a('0x13')](0xcc)[_0xf52a('0x19')]();});}};}function handleEntityNotFound(_0x25ed3c){return function(_0x32244d){if(!_0x32244d){_0x25ed3c[_0xf52a('0x1a')](0x194);}return _0x32244d;};}function handleError(_0x19a567,_0x1201bc){_0x1201bc=_0x1201bc||0x1f4;return function(_0x315819){logger[_0xf52a('0x1b')](_0x315819['stack']);if(_0x315819[_0xf52a('0x1c')]){delete _0x315819[_0xf52a('0x1c')];}_0x19a567[_0xf52a('0x13')](_0x1201bc)[_0xf52a('0x1d')](_0x315819);};}exports[_0xf52a('0x1e')]=function(_0xfb30d,_0x74757b){var _0x1b2f54={};return contacts[_0xf52a('0x1f')]()[_0xf52a('0x17')](function(_0x2ba3b1){_0x1b2f54=qs['getOptions'](_0x2ba3b1,_0xfb30d);return contacts[_0xf52a('0x20')](_0xfb30d[_0xf52a('0x21')],_0xfb30d['user'],_0x1b2f54,_0x2ba3b1);})[_0xf52a('0x17')](respondWithFilteredResult(_0x74757b,_0x1b2f54))['catch'](handleError(_0x74757b,null));};exports[_0xf52a('0x18')]=function(_0x1e58b6,_0x3aaf33){return db[_0xf52a('0x22')][_0xf52a('0x23')]({'where':{'id':_0x1e58b6[_0xf52a('0x24')]['id']}})[_0xf52a('0x17')](handleEntityNotFound(_0x3aaf33,null))[_0xf52a('0x17')](removeEntity(_0x3aaf33,null))[_0xf52a('0x25')](handleError(_0x3aaf33,null));};exports['describe']=function(_0x48f3cf,_0x4c73d1){return db[_0xf52a('0x22')][_0xf52a('0x1f')]()['then'](function(_0x5e0a53){delete _0x5e0a53[_0xf52a('0x26')];for(var _0x171f15=0x0;_0x171f150x0){return new Promise(function(_0x3a9ad6){var _0xb20e81=[];for(var _0xea5ef1=0x0;_0xea5ef1<_0x5a1a5a['length'];_0xea5ef1++){_0xb20e81[_0xf52a('0x58')](insertAdditionalPhones(_0x5a1a5a[_0xea5ef1][_0xf52a('0x5c')],_0x5a1a5a[_0xea5ef1][_0xf52a('0x52')]));}Promise[_0xf52a('0x5d')](_0xb20e81)['then'](function(){_0x3a9ad6(0x1);});})[_0xf52a('0x17')](function(){return{'success':_0x413cf2,'failure':_0x41795a,'duplicates':_0x398062};});}else{return{'success':_0x413cf2,'failure':_0x41795a,'duplicates':_0x398062};}}})[_0xf52a('0x17')](respondWithResult(_0x33264e,0xc9))[_0xf52a('0x25')](handleError(_0x33264e,null));};exports[_0xf52a('0x5e')]=function(_0xb5ab8c,_0x5e7611){var _0x2b9d9e;return db[_0xf52a('0x22')][_0xf52a('0x1f')]()[_0xf52a('0x17')](function(_0x1caddd){return db[_0xf52a('0x22')]['find']({'where':{'id':_0xb5ab8c['params']['id']},'include':[{'model':db[_0xf52a('0x5f')],'as':'Tags','attributes':['id',_0xf52a('0x1c'),_0xf52a('0x60')],'required':_0xb5ab8c[_0xf52a('0x21')]['tag']?!![]:![]},{'model':db[_0xf52a('0x44')],'as':_0xf52a('0x61'),'where':{'CmContactId':_0xb5ab8c['params']['id']},'required':![],'include':[{'model':db[_0xf52a('0x62')],'as':_0xf52a('0x63')}]}],'order':[db[_0xf52a('0x64')][_0xf52a('0x65')]('Phones.OrderBy')],'attributes':_[_0xf52a('0x27')](_0x1caddd)});})['then'](function(_0x382d43){if(!_[_0xf52a('0x4e')](_0x382d43)){_0x2b9d9e=_0x382d43[_0xf52a('0x37')]({'plain':!![]});var _0x4aeda6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x382d43&&_0x382d43['ListId']){if(_0x382d43[_0xf52a('0x59')]){_0x4aeda6[_0xf52a('0x56')][_0xf52a('0x66')][_0xf52a('0x58')]({'ListId':{'$ne':_0x382d43['ListId']}});}}return db[_0xf52a('0x2d')][_0xf52a('0x20')](_0x4aeda6);}})[_0xf52a('0x17')](function(_0x546773){if(!_['isNil'](_0x546773)){return _[_0xf52a('0x67')](_0x2b9d9e,_[_0xf52a('0x68')](_0x546773,function(_0x2d7a49){return util[_0xf52a('0x69')]('cf_%d',_0x2d7a49['id']);}));}})['then'](handleEntityNotFound(_0x5e7611,null))[_0xf52a('0x17')](respondWithResult(_0x5e7611,null))[_0xf52a('0x25')](handleError(_0x5e7611,null));};exports[_0xf52a('0x16')]=function(_0x229b11,_0x5cf8c5){var _0x3df52c;if(_0x229b11[_0xf52a('0x35')]['id']){delete _0x229b11[_0xf52a('0x35')]['id'];}if(!_[_0xf52a('0x4e')](_0x229b11[_0xf52a('0x35')][_0xf52a('0x4f')])){var _0x14468a=_0x229b11[_0xf52a('0x35')]['dialTimezone'];if(!_[_0xf52a('0x4e')](shared[_0xf52a('0x50')][_0x14468a]))_0x229b11[_0xf52a('0x35')][_0xf52a('0x51')]=shared['timezones'][_0x14468a][_0xf52a('0x51')];}return db[_0xf52a('0x22')][_0xf52a('0x23')]({'where':{'id':_0x229b11[_0xf52a('0x24')]['id']}})[_0xf52a('0x17')](handleEntityNotFound(_0x5cf8c5,null))[_0xf52a('0x17')](saveUpdates(_0x229b11[_0xf52a('0x35')],null))[_0xf52a('0x17')](function(_0x54ee8f){_0x3df52c=_0x54ee8f;var _0x20dc0c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x54ee8f&&_0x54ee8f[_0xf52a('0x59')]){if(_0x54ee8f[_0xf52a('0x59')]){_0x20dc0c[_0xf52a('0x56')][_0xf52a('0x66')][_0xf52a('0x58')]({'ListId':{'$ne':_0x54ee8f[_0xf52a('0x59')]}});}}return db['CmCustomField'][_0xf52a('0x20')](_0x20dc0c);})['then'](function(_0x5cbbf6){if(_0x5cbbf6){return _[_0xf52a('0x67')](_[_0xf52a('0x6a')](_0x229b11[_0xf52a('0x35')],function(_0xccf84d,_0x35bf57){return _[_0xf52a('0x6b')](_0x35bf57,_0xf52a('0x29'));}),_[_0xf52a('0x68')](_0x5cbbf6,function(_0x38ba75){return util['format'](_0xf52a('0x6c'),_0x38ba75['id']);}));}})['then'](function(_0x130131){if(_0x130131&&!_[_0xf52a('0x6d')](_0x130131)){var _0x53c9c0=squel['update']()[_0xf52a('0x6e')](_0xf52a('0x6f'))['setFields'](_0x130131)[_0xf52a('0x56')](_0xf52a('0x70'),_0x229b11[_0xf52a('0x24')]['id'])[_0xf52a('0x71')]();return db[_0xf52a('0x64')]['query'](_0x53c9c0[_0xf52a('0x72')],{'replacements':_0x53c9c0['values']});}})['then'](function(){if(_0x229b11['body']['phone']&&_0x3df52c){return db[_0xf52a('0x73')][_0xf52a('0x16')]({'phone':_0x229b11['body'][_0xf52a('0x74')],'OrderBy':0x0},{'where':{'ContactId':_0x3df52c['id']}});}})['then'](function(){return _0x3df52c;})[_0xf52a('0x17')](respondWithResult(_0x5cf8c5,null))[_0xf52a('0x25')](handleError(_0x5cf8c5,null));};exports[_0xf52a('0x75')]=function(_0x1cea54,_0x1686f9){var _0x524efb={};var _0x47e2e1={};var _0xa8fb65;var _0x1dd135;return db['CmContact'][_0xf52a('0x76')]({'where':{'id':_0x1cea54[_0xf52a('0x24')]['id']}})['then'](handleEntityNotFound(_0x1686f9,null))[_0xf52a('0x17')](function(_0x4d1c02){if(_0x4d1c02){_0xa8fb65=_0x4d1c02;_0x47e2e1[_0xf52a('0x77')]=_['keys'](db[_0xf52a('0x5f')][_0xf52a('0x78')]);_0x47e2e1[_0xf52a('0x21')]=_[_0xf52a('0x27')](_0x1cea54[_0xf52a('0x21')]);_0x47e2e1[_0xf52a('0x79')]=_['intersection'](_0x47e2e1[_0xf52a('0x77')],_0x47e2e1[_0xf52a('0x21')]);_0x524efb[_0xf52a('0x7a')]=_[_0xf52a('0x7b')](_0x47e2e1['model'],qs[_0xf52a('0x7c')](_0x1cea54[_0xf52a('0x21')][_0xf52a('0x7c')]));_0x524efb['attributes']=_0x524efb[_0xf52a('0x7a')][_0xf52a('0x28')]?_0x524efb[_0xf52a('0x7a')]:_0x47e2e1[_0xf52a('0x77')];_0x524efb[_0xf52a('0x7d')]=qs[_0xf52a('0x7e')](_0x1cea54[_0xf52a('0x21')]['sort']);_0x524efb['where']=qs[_0xf52a('0x79')](_[_0xf52a('0x7f')](_0x1cea54['query'],_0x47e2e1[_0xf52a('0x79')]));if(_0x1cea54['query']['filter']){_0x524efb[_0xf52a('0x56')]=_[_0xf52a('0x80')](_0x524efb[_0xf52a('0x56')],{'$or':_[_0xf52a('0x68')](_0x524efb[_0xf52a('0x7a')],function(_0x3aa3f7){var _0x452238={};_0x452238[_0x3aa3f7]={'$like':'%'+_0x1cea54[_0xf52a('0x21')][_0xf52a('0x81')]+'%'};return _0x452238;})});}_0x524efb=_[_0xf52a('0x80')]({},_0x524efb,_0x1cea54[_0xf52a('0x82')]);return _0xa8fb65[_0xf52a('0x75')](_0x524efb);}})[_0xf52a('0x17')](function(_0x5c141b){if(_0x5c141b){_0x1dd135=_0x5c141b['length'];if(!_0x1cea54[_0xf52a('0x21')][_0xf52a('0x5b')](_0xf52a('0x83'))){_0x524efb[_0xf52a('0x12')]=qs[_0xf52a('0x12')](_0x1cea54[_0xf52a('0x21')][_0xf52a('0x12')]);_0x524efb[_0xf52a('0xf')]=qs[_0xf52a('0xf')](_0x1cea54[_0xf52a('0x21')][_0xf52a('0xf')]);}return _0xa8fb65[_0xf52a('0x75')](_0x524efb);}})[_0xf52a('0x17')](function(_0x30a73b){if(_0x30a73b){return _0x30a73b?{'count':_0x1dd135,'rows':_0x30a73b}:null;}})[_0xf52a('0x17')](respondWithResult(_0x1686f9,null))[_0xf52a('0x25')](handleError(_0x1686f9,null));};exports[_0xf52a('0x84')]=function(_0xe395ed,_0x561a4a){if(_0xe395ed[_0xf52a('0x35')]['id']){delete _0xe395ed[_0xf52a('0x35')]['id'];}return db[_0xf52a('0x22')][_0xf52a('0x76')]({'where':{'id':_0xe395ed[_0xf52a('0x24')]['id']}})['then'](handleEntityNotFound(_0x561a4a,null))[_0xf52a('0x17')](function(_0x541f87){if(_0x541f87){return _0x541f87[_0xf52a('0x84')](_0xe395ed[_0xf52a('0x35')][_0xf52a('0x85')]||[]);}return null;})[_0xf52a('0x17')](respondWithResult(_0x561a4a,null))[_0xf52a('0x25')](handleError(_0x561a4a,null));};exports[_0xf52a('0x86')]=function(_0x3fa209,_0x4fa49a){var _0x51d848=[];_0x51d848[_0xf52a('0x58')](addAdditionalPhones(_0x3fa209[_0xf52a('0x35')]));Promise[_0xf52a('0x5d')](_0x51d848)[_0xf52a('0x17')](function(){_0x51d848=[];_0x51d848[_0xf52a('0x58')](deleteCmHopperPhones(_0x3fa209[_0xf52a('0x35')]['id']));_0x51d848[_0xf52a('0x58')](addCmHopperPhones(_0x3fa209[_0xf52a('0x35')]['id']));Promise['all'](_0x51d848)[_0xf52a('0x17')](function(){return[0x1];})[_0xf52a('0x17')](respondWithResult(_0x4fa49a,null));});};function addAdditionalPhones(_0x188e89){var _0x55552e;return new Promise(function(_0x59f95a){return db[_0xf52a('0x44')]['destroy']({'where':{'CmContactId':_0x188e89['id']}})[_0xf52a('0x17')](function(){db[_0xf52a('0x62')]['findAll']({'raw':!![],'attributes':['id',_0xf52a('0x87')]})[_0xf52a('0x17')](function(_0x4f81cd){var _0x4588ac=[];for(var _0x404167=0x0;_0x404167<_0x188e89['items']['length'];_0x404167++){var _0x137b14=_0x188e89[_0xf52a('0x88')]?_[_0xf52a('0x4e')](_0x188e89[_0xf52a('0x88')][_0x404167])?'':_0x188e89[_0xf52a('0x88')][_0x404167]:_0x188e89['items'][_0x404167][_0xf52a('0x89')]?_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x89')]:'';var _0x4dc5de=_['isNil'](_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x8b')])?'':_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x8b')];var _0x3a2647=_0x137b14+':'+_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x74')]+'§'+_0x4dc5de;if(_[_0xf52a('0x4e')](_0x55552e))_0x55552e=_0x3a2647;else _0x55552e+=';'+_0x3a2647;var _0x4b6917=null;var _0x26ef27=null;if(_0x188e89[_0xf52a('0x88')]){if(!_['isNil'](_0x188e89['item_types'][_0x404167])){_0x26ef27=_[_0xf52a('0x23')](_0x4f81cd,function(_0x59dc28){return _0x59dc28['id']===_0x188e89['item_types'][_0x404167];});if(!_['isNil'](_0x26ef27)){_0x4b6917=_0x26ef27[_0xf52a('0x87')];}}}else{if(!_[_0xf52a('0x4e')](_0x188e89[_0xf52a('0x8a')][_0x404167])){_0x26ef27=_[_0xf52a('0x23')](_0x4f81cd,function(_0x287906){return _0x287906['id']===_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x89')];});if(!_['isNil'](_0x26ef27)){_0x4b6917=_0x404167;}}}if(_[_0xf52a('0x4e')](_0x4b6917)){_0x4b6917=0x64;}_0x4588ac['push'](addAdditionalPhone(_0x188e89['id'],_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x74')],_0x188e89[_0xf52a('0x88')]?_[_0xf52a('0x4e')](_0x188e89[_0xf52a('0x88')][_0x404167])?null:_0x188e89[_0xf52a('0x88')][_0x404167]:_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x89')]?_0x188e89[_0xf52a('0x8a')][_0x404167][_0xf52a('0x89')]:null,_0x4b6917,_0x4dc5de));}Promise[_0xf52a('0x5d')](_0x4588ac)[_0xf52a('0x17')](function(){db['CmContact'][_0xf52a('0x16')]({'AdditionalPhones':_0x55552e},{'where':{'id':_0x188e89['id']}})[_0xf52a('0x17')](function(){_0x59f95a(0x1);});});});});});}function addAdditionalPhone(_0x4ae559,_0x2483fc,_0x2e3c65,_0x23de3a,_0x1dccc1){return db[_0xf52a('0x44')]['find']({'where':{'CmContactId':_0x4ae559,'item':_0x2483fc}})[_0xf52a('0x17')](function(_0xd91f9c){if(_0xd91f9c)logger[_0xf52a('0x32')](_0xf52a('0x8c'),_0xd91f9c);else{db['CmContactHasItem'][_0xf52a('0x3b')]({'CmContactId':_0x4ae559,'item':_0x2483fc,'ItemTypeId':_0x2e3c65,'OrderBy':_0x23de3a,'ItemClass':_0xf52a('0x8d'),'description':_0x1dccc1});}});}function deleteCmHopperPhones(_0x5b6c2a){return new Promise(function(_0x44ee69){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b6c2a}})['then'](function(_0x1ed504){db[_0xf52a('0x8e')][_0xf52a('0x18')]({'where':{'CmHopperId':{'$in':_['map'](_0x1ed504,'id')}}});})[_0xf52a('0x17')](function(){_0x44ee69(0x1);});});}function addCmHopperPhones(_0x52109e){return new Promise(function(_0x1a745c){return db[_0xf52a('0x73')][_0xf52a('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x52109e}})['then'](function(_0xba2609){var _0x3d8efe=[];_[_0xf52a('0x68')](_0xba2609,function(_0x3146f0){_0x3d8efe['push'](createCmHopperPhone(_0x52109e,_0x3146f0['id']));});Promise['all'](_0x3d8efe)[_0xf52a('0x17')](function(){_0x1a745c(0x1);});});});}function createCmHopperPhone(_0x40c483,_0x10eaa4){return new Promise(function(_0x404478){db[_0xf52a('0x44')][_0xf52a('0x20')]({'raw':!![],'attributes':[_0xf52a('0x8f'),_0xf52a('0x87')],'where':{'CmContactId':_0x40c483,'ItemClass':_0xf52a('0x8d')},'include':[{'model':db[_0xf52a('0x62')],'attributes':[_0xf52a('0x87')],'as':_0xf52a('0x63')}],'order':['OrderBy',db[_0xf52a('0x64')][_0xf52a('0x65')](_0xf52a('0x90'))]})[_0xf52a('0x17')](function(_0x4a9694){var _0x2ce4cb=0x1;var _0xf62ac0=_[_0xf52a('0x68')](_0x4a9694,function(_0x6d3705){_0x6d3705['CmHopperId']=_0x10eaa4;_0x6d3705[_0xf52a('0x74')]=_0x6d3705[_0xf52a('0x8f')];_0x6d3705[_0xf52a('0x87')]=_0x2ce4cb;delete _0x6d3705[_0xf52a('0x91')];_0x2ce4cb=_0x2ce4cb+0x1;return _0x6d3705;});return db['CmHopperAdditionalPhone'][_0xf52a('0x53')](_0xf62ac0,{});})[_0xf52a('0x17')](function(){_0x404478(0x1);});});}function insertAdditionalPhones(_0x156c8d,_0x45770f){return new Promise(function(_0x488e1b){var _0x3ae921=[];for(var _0x5601d8=0x0;_0x5601d8<_0x45770f[_0xf52a('0x28')];_0x5601d8++){var _0x1bb9f0=_0x45770f[_0x5601d8];_0x3ae921[_0xf52a('0x58')](parseContactItemType(_0x1bb9f0));}Promise['all'](_0x3ae921)[_0xf52a('0x17')](function(){var _0x7f84f1={'id':_0x156c8d['id'],'items':_0x45770f};return addAdditionalPhones(_0x7f84f1)[_0xf52a('0x17')](function(){return addCmHopperPhones(_0x156c8d['id']);});})[_0xf52a('0x17')](function(){_0x488e1b(_0x156c8d);});});}function parseContactItemType(_0x359732){return new Promise(function(_0x2153bd){if(_0x359732[_0xf52a('0x5b')]('ItemTypeId')){_0x2153bd(_0x359732);}else{return db['ContactItemType'][_0xf52a('0x23')]({'where':{'name':_0x359732[_0xf52a('0x63')]}})[_0xf52a('0x17')](function(_0x113d10){if(_['isNil'](_0x113d10))_0x359732[_0xf52a('0x89')]=null;else _0x359732[_0xf52a('0x89')]=_0x113d10['id'];_0x2153bd(_0x359732);});}});}exports[_0xf52a('0x92')]=function(_0x420486,_0x357601){return db['CmContactHasItem'][_0xf52a('0x20')]({'raw':!![],'where':{'CmContactId':_0x420486[_0xf52a('0x24')]['id'],'ItemClass':_0xf52a('0x8d')},'include':[{'model':db[_0xf52a('0x62')],'as':_0xf52a('0x63')}],'order':[['OrderBy'],[db[_0xf52a('0x64')][_0xf52a('0x65')]('`ItemType`.OrderBy')]]})[_0xf52a('0x17')](function(_0x9e922){return _0x9e922;})[_0xf52a('0x17')](respondWithResult(_0x357601,null))[_0xf52a('0x25')](handleError(_0x357601,null));};exports[_0xf52a('0x93')]=function(_0x2d8705,_0x1e15b1){return db[_0xf52a('0x44')][_0xf52a('0x20')]({'raw':!![],'where':{'CmContactId':_0x2d8705['body']['fromContactId']}})[_0xf52a('0x17')](function(_0x5232d0){var _0x3c809f=_[_0xf52a('0x68')](_0x5232d0,function(_0x29d5e9){_0x29d5e9['CmContactId']=_0x2d8705['body'][_0xf52a('0x94')];return _0x29d5e9;});return db['CmContactHasItem'][_0xf52a('0x53')](_0x3c809f,{});})[_0xf52a('0x17')](function(){return addCmHopperPhones(_0x2d8705['body']['toContactId']);})[_0xf52a('0x17')](function(){return['ok'];})[_0xf52a('0x17')](respondWithResult(_0x1e15b1,null))[_0xf52a('0x25')](handleError(_0x1e15b1,null));};exports['rescheduleAdditionalPhones']=function(_0x3ea716,_0x15e03c){var _0x38e765=[];_0x38e765[_0xf52a('0x58')](createCmHopperPhone(_0x3ea716[_0xf52a('0x35')]['id'],_0x3ea716['body']['hopperId']));Promise[_0xf52a('0x5d')](_0x38e765)[_0xf52a('0x17')](function(){return[0x1];})[_0xf52a('0x17')](respondWithResult(_0x15e03c,null));};exports[_0xf52a('0x95')]=function(_0x2daed0,_0x678ebb){var _0x5339a2={'raw':![],'where':{}};var _0x54426d={};var _0x27d717={'count':0x0,'rows':[]};return db[_0xf52a('0x22')][_0xf52a('0x76')]({'where':{'id':_0x2daed0[_0xf52a('0x24')]['id']}})['then'](handleEntityNotFound(_0x678ebb,null))[_0xf52a('0x17')](function(_0x44da38){if(_0x44da38){_0x54426d[_0xf52a('0x77')]=_['keys'](db[_0xf52a('0x73')][_0xf52a('0x78')]);_0x54426d[_0xf52a('0x21')]=_[_0xf52a('0x27')](_0x2daed0[_0xf52a('0x21')]);_0x54426d[_0xf52a('0x79')]=_[_0xf52a('0x7b')](_0x54426d[_0xf52a('0x77')],_0x54426d[_0xf52a('0x21')]);_0x5339a2[_0xf52a('0x7a')]=_[_0xf52a('0x7b')](_0x54426d['model'],qs[_0xf52a('0x7c')](_0x2daed0[_0xf52a('0x21')][_0xf52a('0x7c')]));_0x5339a2[_0xf52a('0x7a')]=_0x5339a2[_0xf52a('0x7a')][_0xf52a('0x28')]?_0x5339a2['attributes']:_0x54426d['model'];if(!_0x2daed0['query'][_0xf52a('0x5b')](_0xf52a('0x83'))){_0x5339a2['limit']=qs[_0xf52a('0x12')](_0x2daed0[_0xf52a('0x21')][_0xf52a('0x12')]);_0x5339a2['offset']=qs[_0xf52a('0xf')](_0x2daed0['query'][_0xf52a('0xf')]);}_0x5339a2[_0xf52a('0x7d')]=qs[_0xf52a('0x7e')](_0x2daed0['query'][_0xf52a('0x7e')]);_0x5339a2['where']=qs[_0xf52a('0x79')](_[_0xf52a('0x7f')](_0x2daed0[_0xf52a('0x21')],_0x54426d[_0xf52a('0x79')]));_0x5339a2[_0xf52a('0x56')][_0xf52a('0x96')]=_0x44da38['id'];if(_0x2daed0[_0xf52a('0x21')][_0xf52a('0x81')]){_0x5339a2['where']=_[_0xf52a('0x80')](_0x5339a2[_0xf52a('0x56')],{'$or':_[_0xf52a('0x68')](_0x5339a2[_0xf52a('0x7a')],function(_0x106f93){var _0x4e4ca6={};_0x4e4ca6[_0x106f93]={'$like':'%'+_0x2daed0['query'][_0xf52a('0x81')]+'%'};return _0x4e4ca6;})});}_0x5339a2=_[_0xf52a('0x80')]({},_0x5339a2,_0x2daed0[_0xf52a('0x82')]);return db['CmHopper'][_0xf52a('0x11')]({'where':_0x5339a2[_0xf52a('0x56')]})[_0xf52a('0x17')](function(_0x227e1c){_0x27d717[_0xf52a('0x11')]=_0x227e1c;if(_0x2daed0[_0xf52a('0x21')][_0xf52a('0x97')]){_0x5339a2['include']=[{'all':!![]}];}return db[_0xf52a('0x73')]['findAll'](_0x5339a2);})[_0xf52a('0x17')](function(_0x2a416b){_0x27d717['rows']=_0x2a416b;return _0x27d717;});}})[_0xf52a('0x17')](respondWithFilteredResult(_0x678ebb,_0x5339a2))[_0xf52a('0x25')](handleError(_0x678ebb,null));};exports[_0xf52a('0x98')]=function(_0x7f1370,_0x443fd8){var _0x354f21={'raw':!![],'where':{}};var _0x239e56={};var _0x3ae62a={'count':0x0,'rows':[]};return db[_0xf52a('0x22')][_0xf52a('0x76')]({'where':{'id':_0x7f1370['params']['id']}})['then'](handleEntityNotFound(_0x443fd8,null))[_0xf52a('0x17')](function(_0xe4bce3){if(_0xe4bce3){_0x239e56['model']=_[_0xf52a('0x27')](db[_0xf52a('0x99')]['rawAttributes']);_0x239e56[_0xf52a('0x21')]=_[_0xf52a('0x27')](_0x7f1370[_0xf52a('0x21')]);_0x239e56['filters']=_[_0xf52a('0x7b')](_0x239e56[_0xf52a('0x77')],_0x239e56[_0xf52a('0x21')]);_0x354f21[_0xf52a('0x7a')]=_[_0xf52a('0x7b')](_0x239e56[_0xf52a('0x77')],qs[_0xf52a('0x7c')](_0x7f1370[_0xf52a('0x21')][_0xf52a('0x7c')]));_0x354f21[_0xf52a('0x7a')]=_0x354f21[_0xf52a('0x7a')][_0xf52a('0x28')]?_0x354f21[_0xf52a('0x7a')]:_0x239e56[_0xf52a('0x77')];if(!_0x7f1370[_0xf52a('0x21')][_0xf52a('0x5b')](_0xf52a('0x83'))){_0x354f21[_0xf52a('0x12')]=qs[_0xf52a('0x12')](_0x7f1370['query']['limit']);_0x354f21[_0xf52a('0xf')]=qs[_0xf52a('0xf')](_0x7f1370[_0xf52a('0x21')][_0xf52a('0xf')]);}_0x354f21[_0xf52a('0x7d')]=qs['sort'](_0x7f1370[_0xf52a('0x21')][_0xf52a('0x7e')]);_0x354f21[_0xf52a('0x56')]=qs[_0xf52a('0x79')](_[_0xf52a('0x7f')](_0x7f1370[_0xf52a('0x21')],_0x239e56['filters']));_0x354f21[_0xf52a('0x56')][_0xf52a('0x96')]=_0xe4bce3['id'];if(_0x7f1370[_0xf52a('0x21')][_0xf52a('0x81')]){_0x354f21[_0xf52a('0x56')]=_[_0xf52a('0x80')](_0x354f21['where'],{'$or':_[_0xf52a('0x68')](_0x354f21['attributes'],function(_0x3feb97){var _0x556855={};_0x556855[_0x3feb97]={'$like':'%'+_0x7f1370[_0xf52a('0x21')][_0xf52a('0x81')]+'%'};return _0x556855;})});}_0x354f21=_[_0xf52a('0x80')]({},_0x354f21,_0x7f1370['options']);return db[_0xf52a('0x99')][_0xf52a('0x11')]({'where':_0x354f21[_0xf52a('0x56')]})[_0xf52a('0x17')](function(_0x2b11ba){_0x3ae62a['count']=_0x2b11ba;if(_0x7f1370['query'][_0xf52a('0x97')]){_0x354f21[_0xf52a('0x9a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf52a('0x20')](_0x354f21);})[_0xf52a('0x17')](function(_0x41063a){_0x3ae62a[_0xf52a('0x9b')]=_0x41063a;return _0x3ae62a;});}})[_0xf52a('0x17')](respondWithFilteredResult(_0x443fd8,_0x354f21))['catch'](handleError(_0x443fd8,null));};exports[_0xf52a('0x9c')]=function(_0x3b0baf,_0x29c260){var _0x261193={'raw':!![],'where':{}};var _0xb88f00={};var _0x424e70={'count':0x0,'rows':[]};return db[_0xf52a('0x22')][_0xf52a('0x76')]({'where':{'id':_0x3b0baf[_0xf52a('0x24')]['id']}})['then'](handleEntityNotFound(_0x29c260,null))['then'](function(_0x356a9e){if(_0x356a9e){_0xb88f00['model']=_[_0xf52a('0x27')](db[_0xf52a('0x9d')][_0xf52a('0x78')]);_0xb88f00[_0xf52a('0x21')]=_[_0xf52a('0x27')](_0x3b0baf[_0xf52a('0x21')]);_0xb88f00['filters']=_[_0xf52a('0x7b')](_0xb88f00[_0xf52a('0x77')],_0xb88f00[_0xf52a('0x21')]);_0x261193['attributes']=_[_0xf52a('0x7b')](_0xb88f00[_0xf52a('0x77')],qs['fields'](_0x3b0baf[_0xf52a('0x21')]['fields']));_0x261193[_0xf52a('0x7a')]=_0x261193[_0xf52a('0x7a')][_0xf52a('0x28')]?_0x261193['attributes']:_0xb88f00[_0xf52a('0x77')];if(!_0x3b0baf[_0xf52a('0x21')][_0xf52a('0x5b')](_0xf52a('0x83'))){_0x261193[_0xf52a('0x12')]=qs[_0xf52a('0x12')](_0x3b0baf[_0xf52a('0x21')][_0xf52a('0x12')]);_0x261193[_0xf52a('0xf')]=qs[_0xf52a('0xf')](_0x3b0baf[_0xf52a('0x21')]['offset']);}_0x261193[_0xf52a('0x7d')]=qs[_0xf52a('0x7e')](_0x3b0baf['query']['sort']);_0x261193[_0xf52a('0x56')]=qs[_0xf52a('0x79')](_[_0xf52a('0x7f')](_0x3b0baf[_0xf52a('0x21')],_0xb88f00[_0xf52a('0x79')]));_0x261193[_0xf52a('0x56')][_0xf52a('0x96')]=_0x356a9e['id'];if(_0x3b0baf[_0xf52a('0x21')]['filter']){_0x261193['where']=_[_0xf52a('0x80')](_0x261193[_0xf52a('0x56')],{'$or':_['map'](_0x261193[_0xf52a('0x7a')],function(_0x39aabe){var _0x5ead43={};_0x5ead43[_0x39aabe]={'$like':'%'+_0x3b0baf[_0xf52a('0x21')][_0xf52a('0x81')]+'%'};return _0x5ead43;})});}_0x261193=_[_0xf52a('0x80')]({},_0x261193,_0x3b0baf[_0xf52a('0x82')]);return db[_0xf52a('0x9d')][_0xf52a('0x11')]({'where':_0x261193['where']})[_0xf52a('0x17')](function(_0x334a01){_0x424e70[_0xf52a('0x11')]=_0x334a01;if(_0x3b0baf[_0xf52a('0x21')][_0xf52a('0x97')]){_0x261193['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xf52a('0x20')](_0x261193);})[_0xf52a('0x17')](function(_0x8b82c4){_0x424e70[_0xf52a('0x9b')]=_0x8b82c4;return _0x424e70;});}})[_0xf52a('0x17')](respondWithFilteredResult(_0x29c260,_0x261193))['catch'](handleError(_0x29c260,null));};exports[_0xf52a('0x9e')]=function(_0x1aec79,_0x4a8804){var _0x2fd6c6={'raw':!![],'where':{}};var _0x416018={};var _0x4ea0b0={'count':0x0,'rows':[]};return db[_0xf52a('0x22')][_0xf52a('0x76')]({'where':{'id':_0x1aec79[_0xf52a('0x24')]['id']}})['then'](handleEntityNotFound(_0x4a8804,null))[_0xf52a('0x17')](function(_0x82a6d1){if(_0x82a6d1){_0x416018[_0xf52a('0x77')]=_[_0xf52a('0x27')](db['JscriptySessionReport'][_0xf52a('0x78')]);_0x416018[_0xf52a('0x21')]=_[_0xf52a('0x27')](_0x1aec79['query']);_0x416018[_0xf52a('0x79')]=_[_0xf52a('0x7b')](_0x416018[_0xf52a('0x77')],_0x416018[_0xf52a('0x21')]);_0x2fd6c6[_0xf52a('0x7a')]=_['intersection'](_0x416018[_0xf52a('0x77')],qs[_0xf52a('0x7c')](_0x1aec79[_0xf52a('0x21')][_0xf52a('0x7c')]));_0x2fd6c6[_0xf52a('0x7a')]=_0x2fd6c6[_0xf52a('0x7a')]['length']?_0x2fd6c6[_0xf52a('0x7a')]:_0x416018[_0xf52a('0x77')];if(!_0x1aec79[_0xf52a('0x21')][_0xf52a('0x5b')](_0xf52a('0x83'))){_0x2fd6c6[_0xf52a('0x12')]=qs[_0xf52a('0x12')](_0x1aec79[_0xf52a('0x21')][_0xf52a('0x12')]);_0x2fd6c6[_0xf52a('0xf')]=qs[_0xf52a('0xf')](_0x1aec79[_0xf52a('0x21')][_0xf52a('0xf')]);}_0x2fd6c6[_0xf52a('0x7d')]=qs['sort'](_0x1aec79['query']['sort']);_0x2fd6c6[_0xf52a('0x56')]=qs[_0xf52a('0x79')](_[_0xf52a('0x7f')](_0x1aec79[_0xf52a('0x21')],_0x416018['filters']));_0x2fd6c6[_0xf52a('0x56')]['ContactId']=_0x82a6d1['id'];if(_0x1aec79[_0xf52a('0x21')][_0xf52a('0x81')]){_0x2fd6c6['where']=_[_0xf52a('0x80')](_0x2fd6c6[_0xf52a('0x56')],{'$or':_['map'](_0x2fd6c6[_0xf52a('0x7a')],function(_0x5c7662){var _0x1a39b4={};_0x1a39b4[_0x5c7662]={'$like':'%'+_0x1aec79[_0xf52a('0x21')][_0xf52a('0x81')]+'%'};return _0x1a39b4;})});}_0x2fd6c6=_['merge']({},_0x2fd6c6,_0x1aec79[_0xf52a('0x82')]);return db[_0xf52a('0x4a')][_0xf52a('0x11')]({'where':_0x2fd6c6[_0xf52a('0x56')]})[_0xf52a('0x17')](function(_0x25ace3){_0x4ea0b0[_0xf52a('0x11')]=_0x25ace3;if(_0x1aec79[_0xf52a('0x21')]['includeAll']){_0x2fd6c6['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x2fd6c6);})[_0xf52a('0x17')](function(_0x462bdf){_0x4ea0b0[_0xf52a('0x9b')]=_0x462bdf;return _0x4ea0b0;});}})[_0xf52a('0x17')](respondWithFilteredResult(_0x4a8804,_0x2fd6c6))[_0xf52a('0x25')](handleError(_0x4a8804,null));};exports[_0xf52a('0x9f')]=function(_0x290392,_0x5bf7fd){try{if(!_0x290392[_0xf52a('0x35')][_0xf52a('0x59')]){throw new Error(_0xf52a('0xa0'));}if(!_0x290392[_0xf52a('0x35')][_0xf52a('0xa1')]){throw new Error(_0xf52a('0xa2'));}if(!_0x290392[_0xf52a('0x35')][_0xf52a('0xa3')]){throw new Error(_0xf52a('0xa4'));}if(!_0x290392['body'][_0xf52a('0xa5')]){throw new Error(_0xf52a('0xa6'));}var _0x1b355d=_0x290392[_0xf52a('0x35')][_0xf52a('0xa1')][_0xf52a('0xa7')](',');var _0x20a0ac=_0x290392['body']['binding_values'][_0xf52a('0xa7')](',');if(!_0x1b355d[_0xf52a('0x28')]||!_0x20a0ac[_0xf52a('0x28')]||_0x1b355d['length']!==_0x20a0ac[_0xf52a('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x290392[_0xf52a('0x35')]['fields']=_[_0xf52a('0xa8')](_0x1b355d,_0x20a0ac);if(!_0x290392['body'][_0xf52a('0x7c')][_0xf52a('0x74')]){throw new Error(_0xf52a('0xa9'));}if(!_0x290392[_0xf52a('0x35')]['fields'][_0xf52a('0xaa')]){throw new Error(_0xf52a('0xab'));}var _0x307d78=path['join'](config[_0xf52a('0xac')],_0xf52a('0xad'),_0x290392[_0xf52a('0xae')][_0xf52a('0xaf')]);fs[_0xf52a('0xb0')](_0x307d78,parseInt('0777',0x8));var _0x313f08=require(_0xf52a('0xb1'))[_0xf52a('0xb2')](path[_0xf52a('0xb3')](__dirname,_0xf52a('0xb4')),[_0x307d78,_0x290392[_0xf52a('0x35')][_0xf52a('0xa1')],_0x290392[_0xf52a('0x35')][_0xf52a('0xa3')],_0x290392['body'][_0xf52a('0x59')],_0x290392[_0xf52a('0x35')]['CompanyId'],_0x290392[_0xf52a('0x35')][_0xf52a('0x55')],_0x290392[_0xf52a('0x35')]['socket_timestamp']]);return _0x5bf7fd[_0xf52a('0x13')](0xc8)[_0xf52a('0x15')]({'message':_0xf52a('0xb5'),'pid':_0x313f08[_0xf52a('0xb6')]});}catch(_0x3a9f28){return _0x5bf7fd[_0xf52a('0x13')](0x1f4)['send'](_0x3a9f28);}};exports['upload']=function(_0x21f3f9,_0x554a30){var _0x43e443=fs[_0xf52a('0xb7')](_0x21f3f9[_0xf52a('0xae')][_0xf52a('0x3')]);Papa[_0xf52a('0xb8')](_0x43e443,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x278003){return _0x554a30['status'](0xc8)[_0xf52a('0x15')]({'file':_0x21f3f9[_0xf52a('0xae')],'fields':_0x278003[_0xf52a('0xb9')]['fields']});}});};exports['import']=function(_0x485792,_0x3b57d3){return db[_0xf52a('0xba')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xf52a('0xbb')}})[_0xf52a('0x17')](function(_0x1a61c9){var _0x3e36b1=![];if(!_0x485792[_0xf52a('0x35')][_0xf52a('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x485792[_0xf52a('0x35')][_0xf52a('0xbc')][_0xf52a('0x74')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x485792[_0xf52a('0x35')][_0xf52a('0xbc')][_0xf52a('0xaa')]){throw new Error(_0xf52a('0xab'));}if(!_0x485792['body'][_0xf52a('0xa5')]){throw new Error(_0xf52a('0xa6'));}var _0x148d61=require(_0xf52a('0xb1'))[_0xf52a('0xb2')](path[_0xf52a('0xb3')](__dirname,'../../components/import/cm/csv2'),[_0x485792[_0xf52a('0x24')]['id'],JSON[_0xf52a('0xbd')](_0x485792[_0xf52a('0x35')]),JSON[_0xf52a('0xbd')](_0x1a61c9)]);_0x148d61['on'](_0xf52a('0xbe'),function(){_0x3e36b1=!![];return _0x3b57d3['status'](0xc8)[_0xf52a('0x15')]({'message':_0xf52a('0xbf'),'pid':_0x148d61['pid']});});_0x148d61['on'](_0xf52a('0xc0'),function(_0x2ee6e1){if(_0x2ee6e1&&!_0x3e36b1){return _0x3b57d3[_0xf52a('0x13')](0x1f4)[_0xf52a('0x15')]({'message':'error\x20child\x20process','pid':_0x148d61[_0xf52a('0xb6')]});}});})['catch'](handleError(_0x3b57d3,null));};exports[_0xf52a('0xc1')]=function(_0x1df704,_0x3045ac){return db[_0xf52a('0xba')][_0xf52a('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf52a('0xbb')}})[_0xf52a('0x17')](function(_0x1f91aa){var _0x1a428f=![];if(!_0x1df704[_0xf52a('0x35')]['ListId']){throw new Error(_0xf52a('0xa0'));}if(!_0x1df704[_0xf52a('0x35')]['binding'][_0xf52a('0x74')]){throw new Error(_0xf52a('0xa9'));}if(!_0x1df704['body'][_0xf52a('0xbc')][_0xf52a('0xaa')]){throw new Error(_0xf52a('0xab'));}if(!_0x1df704[_0xf52a('0x35')]['socket_timestamp']){throw new Error(_0xf52a('0xa6'));}var _0x16f985=require('child_process')['fork'](path[_0xf52a('0xb3')](__dirname,_0xf52a('0xc2')),[_0x1df704[_0xf52a('0x24')]['id'],JSON[_0xf52a('0xbd')](_0x1df704['body']),JSON[_0xf52a('0xbd')](_0x1f91aa)]);_0x16f985['on'](_0xf52a('0xbe'),function(){_0x1a428f=!![];return _0x3045ac[_0xf52a('0x13')](0xc8)[_0xf52a('0x15')]({'message':_0xf52a('0xbf'),'pid':_0x16f985[_0xf52a('0xb6')]});});_0x16f985['on'](_0xf52a('0xc0'),function(_0x3d0235){if(_0x3d0235&&!_0x1a428f){return _0x3045ac[_0xf52a('0x13')](0x1f4)[_0xf52a('0x15')]({'message':_0xf52a('0xc3'),'pid':_0x16f985[_0xf52a('0xb6')]});}});})[_0xf52a('0x25')](handleError(_0x3045ac,null));};exports[_0xf52a('0xc4')]=function(_0x1793f5,_0x1a671f){var _0x5d5c5a=[_0xf52a('0xc5'),_0xf52a('0xc6'),'sms','openchannel',_0xf52a('0xc7'),_0xf52a('0xc8'),'voice'];var _0xd8024f={'offset':0x0,'order':qs['sort']('-createdAt')},_0x38bf80={'count':0x0,'rows':[]};Promise['resolve']()[_0xf52a('0x17')](function(){if(_0x1793f5['query'][_0xf52a('0xc9')]){if(!_[_0xf52a('0xca')](_0x5d5c5a,_0x1793f5[_0xf52a('0x21')]['channel'][_0xf52a('0xcb')]())){throw new Error('Invalid\x20channel');}_0x5d5c5a=[_0x1793f5['query'][_0xf52a('0xc9')][_0xf52a('0xcb')]()];}if(_0x1793f5['query'][_0xf52a('0xcc')]){try{var _0x4bf15a=JSON[_0xf52a('0xb8')](_0x1793f5[_0xf52a('0x21')][_0xf52a('0xcc')]);if(!moment(_0x4bf15a[_0xf52a('0x36')])[_0xf52a('0xcd')]()){throw new Error(_0xf52a('0xce'));}if(!moment(_0x4bf15a['to'])[_0xf52a('0xcd')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x224584){throw new Error(_0xf52a('0xcf'));}}if(!_0x1793f5[_0xf52a('0x21')][_0xf52a('0x5b')]('nolimit')){_0xd8024f['limit']=qs[_0xf52a('0x12')](_0x1793f5[_0xf52a('0x21')][_0xf52a('0x12')]||0xa);_0xd8024f[_0xf52a('0xf')]=qs[_0xf52a('0xf')](_0x1793f5[_0xf52a('0x21')]['offset']);}var _0xfe6797=_0x5d5c5a['map'](function(_0x2cc5e9){if(_0x2cc5e9===_0xf52a('0xd0')){var _0x3f2eec={'attributes':['id','uniqueid','type',_0xf52a('0xd1'),'destination',_0xf52a('0xd2'),_0xf52a('0xd3'),_0xf52a('0xd4'),'duration',_0xf52a('0xd5'),_0xf52a('0xd6'),_0xf52a('0xd7'),_0xf52a('0xd8'),_0xf52a('0xd9'),_0xf52a('0xda')],'where':{'ContactId':_0x1793f5['params']['id']},'include':[{'model':db['User'],'as':_0xf52a('0xba'),'attributes':['id','name',_0xf52a('0xdb'),_0xf52a('0x2e')]}],'order':[[_0xf52a('0xd6'),_0xf52a('0xdc')]]};if(_0x1793f5['query'][_0xf52a('0xcc')]){_0x3f2eec[_0xf52a('0x56')][_0xf52a('0xd6')]={'$gte':_0x4bf15a[_0xf52a('0x36')],'$lte':_0x4bf15a['to']};}return db[_0xf52a('0xdd')][_0xf52a('0xde')](_0x3f2eec)[_0xf52a('0x17')](function(_0x3aa1b7){_0x38bf80[_0xf52a('0x11')]+=_0x3aa1b7[_0xf52a('0x11')];return _[_0xf52a('0x68')](_0x3aa1b7[_0xf52a('0x9b')],function(_0x29aba7){var _0x548bdd=_0x29aba7[_0xf52a('0x37')]({'plain':!![]});_0x548bdd[_0xf52a('0xc9')]=_0x2cc5e9;if(_0x548bdd[_0xf52a('0xba')]){_0x548bdd[_0xf52a('0xba')]={'id':_0x548bdd['User']['id'],'name':_0x548bdd[_0xf52a('0xba')][_0xf52a('0x1c')],'fullname':_0x548bdd[_0xf52a('0xba')][_0xf52a('0xdb')],'alias':_0x548bdd[_0xf52a('0xba')]['alias']};}return _0x548bdd;});});}else{var _0x586c45=_[_0xf52a('0xdf')](_0x2cc5e9)+(_0x2cc5e9===_0xf52a('0xc6')?'Website':_0xf52a('0xe0'));var _0x904677={'attributes':['id',_0xf52a('0xe1'),_0xf52a('0xe2'),_0xf52a('0xd6'),_0xf52a('0xd5'),_0xf52a('0xe3'),_0xf52a('0xe4'),_0xf52a('0xe5'),'UserId',_0x586c45+'Id'],'where':{'ContactId':_0x1793f5['params']['id']},'include':[{'model':db[_0x586c45],'as':_0xf52a('0xe0'),'attributes':['id','name',_0xf52a('0xe6')]},{'model':db['User'],'as':_0xf52a('0xe7'),'attributes':['id','name',_0xf52a('0xdb')]},{'model':db[_0xf52a('0x5f')],'as':_0xf52a('0xe8'),'attributes':['id',_0xf52a('0x1c'),_0xf52a('0x60')],'through':{'attributes':[]}}],'order':[[_0xf52a('0xd6'),_0xf52a('0xdc')]]};if(_0x1793f5[_0xf52a('0x21')][_0xf52a('0xcc')]){_0x904677['where'][_0xf52a('0xd6')]={'$gte':_0x4bf15a[_0xf52a('0x36')],'$lte':_0x4bf15a['to']};}switch(_0x2cc5e9){case'chat':_0x904677[_0xf52a('0x7a')]['push']('browserName',_0xf52a('0xe9'),'customerPort',_0xf52a('0xea'),_0xf52a('0xeb'),_0xf52a('0xec'),'ratingType','ratingValue',_0xf52a('0xed'));break;case _0xf52a('0xc5'):_0x904677[_0xf52a('0x7a')][_0xf52a('0x58')]('subject','substatus');break;case _0xf52a('0xee'):_0x904677[_0xf52a('0x7a')]['push']('externalUrl','threadId');break;}return db[_[_0xf52a('0xdf')](_0x2cc5e9)+_0xf52a('0xef')]['findAndCountAll'](_0x904677)[_0xf52a('0x17')](function(_0x5442d2){_0x38bf80[_0xf52a('0x11')]+=_0x5442d2['count'];return _['map'](_0x5442d2['rows'],function(_0x53afbc){var _0x2f76cb=_0x53afbc[_0xf52a('0x37')]({'plain':!![]});_0x2f76cb[_0xf52a('0xc9')]=_0x2cc5e9;if(_0x2f76cb[_0xf52a('0xe7')]){_0x2f76cb[_0xf52a('0xe7')]={'id':_0x2f76cb[_0xf52a('0xe7')]['id'],'name':_0x2f76cb[_0xf52a('0xe7')][_0xf52a('0x1c')],'fullname':_0x2f76cb[_0xf52a('0xe7')][_0xf52a('0xdb')]};}return _0x2f76cb;});});}});return Promise['all'](_0xfe6797);})[_0xf52a('0x17')](function(_0x22e3bc){return _(_0x22e3bc)[_0xf52a('0xf0')]()[_0xf52a('0xf1')](_0xf52a('0xd6'))[_0xf52a('0xf2')]()[_0xf52a('0xf3')]();})[_0xf52a('0x17')](function(_0x1ce976){_0x38bf80[_0xf52a('0x9b')]=_0xd8024f[_0xf52a('0x12')]?_0x1ce976['slice'](_0xd8024f[_0xf52a('0xf')],_0xd8024f[_0xf52a('0xf')]+_0xd8024f[_0xf52a('0x12')]):_0x1ce976;return _0x38bf80;})['then'](respondWithFilteredResult(_0x1a671f,_0xd8024f))[_0xf52a('0x25')](handleError(_0x1a671f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index aae5ce8..becfb96 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05a3=['emit','hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','update','remove'];(function(_0x159c2f,_0xd39d20){var _0x591f68=function(_0x161ba6){while(--_0x161ba6){_0x159c2f['push'](_0x159c2f['shift']());}};_0x591f68(++_0xd39d20);}(_0x05a3,0xe3));var _0x305a=function(_0x43e974,_0x409c0d){_0x43e974=_0x43e974-0x0;var _0x41fcb4=_0x05a3[_0x43e974];return _0x41fcb4;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x305a('0x0'))['db'][_0x305a('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x305a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x305a('0x3'),'afterDestroy':_0x305a('0x4')};function emitEvent(_0x294c63){return function(_0xd48b31,_0xe803b4,_0xb47bad){CmContactEvents['emit'](_0x294c63+':'+_0xd48b31['id'],_0xd48b31);CmContactEvents[_0x305a('0x5')](_0x294c63,_0xd48b31);_0xb47bad(null);};}for(var e in events){if(events[_0x305a('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x305a('0x7')]=CmContactEvents; \ No newline at end of file +var _0x6e6a=['hasOwnProperty','hook','exports','events','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e6a,0x1a3));var _0xa6e6=function(_0x399abb,_0x5e6edd){_0x399abb=_0x399abb-0x0;var _0x336558=_0x6e6a[_0x399abb];return _0x336558;};'use strict';var EventEmitter=require(_0xa6e6('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6e6('0x1'),'afterUpdate':_0xa6e6('0x2'),'afterDestroy':_0xa6e6('0x3')};function emitEvent(_0x1d0b91){return function(_0x3d9808,_0xc4010,_0x520ae7){CmContactEvents['emit'](_0x1d0b91+':'+_0x3d9808['id'],_0x3d9808);CmContactEvents[_0xa6e6('0x4')](_0x1d0b91,_0x3d9808);_0x520ae7(null);};}for(var e in events){if(events[_0xa6e6('0x5')](e)){var event=events[e];CmContact[_0xa6e6('0x6')](e,emitEvent(event));}}module[_0xa6e6('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 066800a..48ed78b 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e50=['CampaignId','CmHopper','create','VoiceQueueId','dialCheckDuplicateType','onlyIfOpen','findAll','outbound','CmList','Lists','ListId','map','all','BlackLists','CmHopperBlack','exports','cm_contacts','fti_cm_contacts','lastName','models','get','error','catch','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','lodash','api','../../config/environment/shared','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','phone','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20'];(function(_0x431d94,_0x1ef420){var _0x51900c=function(_0x27cd95){while(--_0x27cd95){_0x431d94['push'](_0x431d94['shift']());}};_0x51900c(++_0x1ef420);}(_0x2e50,0x1ce));var _0x02e5=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2e50[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x02e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x02e5('0x1'));var moment=require('moment');var shared=require(_0x02e5('0x2'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x1fefb1,_0x3ff6bf,_0x44ce75,_0x9e756d){var _0x2887cf=_0x9e756d?_0x02e5('0x3'):_0x02e5('0x4');var _0x497924=_0x44ce75[_0x02e5('0x5')]?_0x44ce75[_0x02e5('0x5')]:moment()[_0x02e5('0x6')](_0x02e5('0x7'));if(_[_0x02e5('0x8')](_0x44ce75[_0x02e5('0x9')])){return Promise[_0x02e5('0xa')](_0x497924);}return _0x1fefb1[_0x2887cf][_0x02e5('0xb')]({'where':{'id':_0x3ff6bf}})[_0x02e5('0xc')](function(_0x471a40){if(_[_0x02e5('0x8')](_0x471a40)||_[_0x02e5('0x8')](_0x471a40[_0x02e5('0x9')])){return Promise[_0x02e5('0xa')](_0x497924);}var _0x1b2d17=shared[_0x02e5('0xd')];var _0x254557=_0x1b2d17[_0x471a40[_0x02e5('0x9')]];var _0x3ce4d9=_0x1b2d17[_0x44ce75[_0x02e5('0x9')]];if(_[_0x02e5('0x8')](_0x254557)&&_['isNil'](_0x3ce4d9)){return Promise['resolve'](_0x497924);}var _0x1f4799=_0x254557[_0x02e5('0xe')]-_0x3ce4d9['utcOffset'];var _0x58b858=_0x44ce75[_0x02e5('0x5')]?_0x44ce75[_0x02e5('0x5')]:moment();_0x497924=moment(_0x58b858)[_0x02e5('0xf')](_0x1f4799,_0x02e5('0x10'))['format'](_0x02e5('0x7'));return Promise['resolve'](_0x497924);});}function getNewHopperPayload(_0x1ea69d){return{'phone':_0x1ea69d[_0x02e5('0x11')],'ContactId':_0x1ea69d['id'],'ListId':_0x1ea69d['ListId'],'scheduledat':_0x1ea69d[_0x02e5('0x5')]?_0x1ea69d[_0x02e5('0x5')]:moment()[_0x02e5('0x6')](_0x02e5('0x7')),'priority':_0x1ea69d[_0x02e5('0x12')]?_0x1ea69d[_0x02e5('0x12')]:0x2,'callback':_0x1ea69d[_0x02e5('0x13')]?!![]:![],'callbackuniqueid':_0x1ea69d['callbackUniqueid']?_0x1ea69d['callbackUniqueid']:undefined,'callbackat':_0x1ea69d['callbackUniqueid']?moment()[_0x02e5('0x6')](_0x02e5('0x7')):undefined};}function handleAlwaysCheckDuplicate(_0x58917b,_0x15efe9,_0x559f47,_0x2bb502){var _0x32469d={'phone':_0x559f47[_0x02e5('0x11')]};var _0x3609aa={'calleridnum':_0x559f47['phone']};if(_0x2bb502){Object[_0x02e5('0x14')](_0x32469d,{'CampaignId':_0x15efe9['id']});Object[_0x02e5('0x14')](_0x3609aa,{'CampaignId':_0x15efe9['id']});}else{Object[_0x02e5('0x14')](_0x32469d,{'VoiceQueueId':_0x15efe9['id']});Object['assign'](_0x3609aa,{'VoiceQueueId':_0x15efe9['id']});}return _0x58917b['CmHopper'][_0x02e5('0xb')]({'where':_0x32469d})[_0x02e5('0xc')](function(_0x4ae25f){if(_0x4ae25f){throw new Error(_0x02e5('0x15')+_0x559f47[_0x02e5('0x11')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x15efe9['id']);}return _0x58917b['CmHopperFinal'][_0x02e5('0xb')]({'where':_0x3609aa});})['then'](function(_0x1ccbfe){if(_0x1ccbfe){throw new Error(_0x02e5('0x16')+_0x559f47[_0x02e5('0x11')]+_0x02e5('0x17')+_0x15efe9['id']);}var _0xdb0f62=getNewHopperPayload(_0x559f47);if(_0x2bb502){_0xdb0f62[_0x02e5('0x18')]=_0x15efe9['id'];}else{_0xdb0f62['VoiceQueueId']=_0x15efe9['id'];}return _0x58917b[_0x02e5('0x19')][_0x02e5('0x1a')](_0xdb0f62);});}function handleOnlyIfOpenCheckDuplicate(_0x684225,_0x5e75ee,_0x7c711,_0x548546){var _0x518612={'phone':_0x7c711['phone']};if(_0x548546){Object[_0x02e5('0x14')](_0x518612,{'CampaignId':_0x5e75ee['id']});}else{Object[_0x02e5('0x14')](_0x518612,{'VoiceQueueId':_0x5e75ee['id']});}return _0x684225[_0x02e5('0x19')][_0x02e5('0xb')]({'where':_0x518612})['then'](function(_0x5598d6){if(_0x5598d6){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x7c711[_0x02e5('0x11')]+_0x02e5('0x17')+_0x5e75ee['id']);}var _0x4f177f=getNewHopperPayload(_0x7c711);if(_0x548546){_0x4f177f[_0x02e5('0x18')]=_0x5e75ee['id'];}else{_0x4f177f[_0x02e5('0x1b')]=_0x5e75ee['id'];}return _0x684225['CmHopper']['create'](_0x4f177f);});}function handleNeverCheckDuplicate(_0x10df35,_0x468e23,_0x110c80){var _0x203fe5=getNewHopperPayload(_0x110c80);_0x203fe5[_0x02e5('0x1b')]=_0x468e23['id'];return _0x10df35['CmHopper']['create'](_0x203fe5);}function handleCheckDuplicate(_0x32b698,_0x5762e3,_0x19aae2,_0x8dfe01){return getTimezoneCallbackAt(_0x32b698,_0x5762e3,_0x19aae2,_0x8dfe01)[_0x02e5('0xc')](function(_0x259cb0){_0x19aae2[_0x02e5('0x5')]=_0x259cb0;switch(_0x5762e3[_0x02e5('0x1c')]){case'always':return handleAlwaysCheckDuplicate(_0x32b698,_0x5762e3,_0x19aae2,_0x8dfe01);case _0x02e5('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x32b698,_0x5762e3,_0x19aae2,_0x8dfe01);default:return handleNeverCheckDuplicate(_0x32b698,_0x5762e3,_0x19aae2);}});}function createHopperForVoiceQueues(_0x2b7069,_0x28d0bc){return _0x2b7069[_0x02e5('0x4')][_0x02e5('0x1e')]({'where':{'type':_0x02e5('0x1f')},'attributes':['id',_0x02e5('0x1c'),_0x02e5('0x9')],'include':[{'model':_0x2b7069[_0x02e5('0x20')],'as':_0x02e5('0x21'),'where':{'id':_0x28d0bc[_0x02e5('0x22')]}}],'raw':!![]})['then'](function(_0x396cf8){var _0x1f7cdc=_0x396cf8[_0x02e5('0x23')](function(_0x289ba8){return handleCheckDuplicate(_0x2b7069,_0x289ba8,_0x28d0bc,![]);});return Promise[_0x02e5('0x24')](_0x1f7cdc);});}function createHopperForCampaigns(_0x40a3c3,_0x547eb9){return _0x40a3c3[_0x02e5('0x3')][_0x02e5('0x1e')]({'attributes':['id',_0x02e5('0x1c'),_0x02e5('0x9')],'include':[{'model':_0x40a3c3[_0x02e5('0x20')],'as':_0x02e5('0x21'),'where':{'id':_0x547eb9[_0x02e5('0x22')]}}],'raw':!![]})[_0x02e5('0xc')](function(_0x8d6903){var _0x5bb30c=_0x8d6903[_0x02e5('0x23')](function(_0x4e3ba0){return handleCheckDuplicate(_0x40a3c3,_0x4e3ba0,_0x547eb9,!![]);});return Promise['all'](_0x5bb30c);});}function createHopperBlackForVoiceQueues(_0x4c0646,_0x1b2416){return _0x4c0646[_0x02e5('0x4')][_0x02e5('0x1e')]({'where':{'type':_0x02e5('0x1f')},'attributes':['id'],'include':[{'model':_0x4c0646[_0x02e5('0x20')],'as':_0x02e5('0x25'),'where':{'id':_0x1b2416['ListId']}}],'raw':!![]})[_0x02e5('0xc')](function(_0x49ab7b){var _0x146c2f=_0x49ab7b[_0x02e5('0x23')](function(_0x2b60a1){return _0x4c0646[_0x02e5('0x26')][_0x02e5('0x1a')]({'phone':_0x1b2416[_0x02e5('0x11')],'ContactId':_0x1b2416['id'],'ListId':_0x1b2416[_0x02e5('0x22')],'VoiceQueueId':_0x2b60a1['id']});});return Promise[_0x02e5('0x24')](_0x146c2f);});}function createHopperBlackForCampaigns(_0x5d6167,_0xaea5bb){return _0x5d6167[_0x02e5('0x3')][_0x02e5('0x1e')]({'attributes':['id'],'include':[{'model':_0x5d6167['CmList'],'as':_0x02e5('0x25'),'where':{'id':_0xaea5bb[_0x02e5('0x22')]}}],'raw':!![]})[_0x02e5('0xc')](function(_0x221487){var _0xdac367=_0x221487[_0x02e5('0x23')](function(_0x4068d0){return _0x5d6167[_0x02e5('0x26')][_0x02e5('0x1a')]({'phone':_0xaea5bb[_0x02e5('0x11')],'ContactId':_0xaea5bb['id'],'ListId':_0xaea5bb[_0x02e5('0x22')],'CampaignId':_0x4068d0['id']});});return Promise['all'](_0xdac367);});}module[_0x02e5('0x27')]=function(_0x343a88){return _0x343a88['define']('CmContact',attributes,{'tableName':_0x02e5('0x28'),'paranoid':!![],'indexes':[{'name':_0x02e5('0x11'),'fields':[_0x02e5('0x11')]},{'name':_0x02e5('0x29'),'fields':['firstName',_0x02e5('0x2a'),_0x02e5('0x11'),'mobile','fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x1aa95a,_0x42a79c,_0x5b7441){var _0x5581a4=_0x343a88[_0x02e5('0x2b')];var _0x31d9ec=_0x1aa95a[_0x02e5('0x2c')]({'plain':!![]});if(!_0x31d9ec['ListId']){logger[_0x02e5('0x2d')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x31d9ec['id']);return _0x5b7441();}if(!_0x31d9ec[_0x02e5('0x11')]){return _0x5b7441();}return createHopperForVoiceQueues(_0x5581a4,_0x31d9ec)[_0x02e5('0xc')](function(){return createHopperBlackForVoiceQueues(_0x5581a4,_0x31d9ec);})['then'](function(){return createHopperForCampaigns(_0x5581a4,_0x31d9ec);})[_0x02e5('0xc')](function(){return createHopperBlackForCampaigns(_0x5581a4,_0x31d9ec);})['then'](function(){return _0x5b7441();})[_0x02e5('0x2e')](function(_0xf12db){logger['error']('[cmContact][afterCreate]',_0xf12db['message']);_0x5b7441();});},'afterDestroy':function(_0x1b13f9,_0x21b789,_0x1aba7e){var _0x6c03d0=_0x343a88[_0x02e5('0x2b')];var _0x71b90b=_0x1b13f9[_0x02e5('0x2c')]({'plain':!![]});return _0x6c03d0['CmHopper'][_0x02e5('0x1e')]({'raw':!![],'where':{'ListId':_0x71b90b['ListId'],'ContactId':_0x71b90b['id']}})[_0x02e5('0xc')](function(_0x478f23){if(!_['isEmpty'](_0x478f23)){var _0x3cf216=[];for(var _0x262aa6=0x0;_0x262aa6<_0x478f23[_0x02e5('0x2f')];_0x262aa6+=0x1){var _0x3dd80f=_0x6c03d0['CmHopper'][_0x02e5('0x30')]({'where':{'ListId':_0x478f23[_0x262aa6][_0x02e5('0x22')],'ContactId':_0x478f23[_0x262aa6][_0x02e5('0x31')],'VoiceQueueId':_0x478f23[_0x262aa6][_0x02e5('0x1b')],'CampaignId':_0x478f23[_0x262aa6][_0x02e5('0x18')]}});_0x3cf216[_0x02e5('0x32')](_0x3dd80f);}return Promise[_0x02e5('0x24')](_0x3cf216);}})['then'](function(_0x2b0dc0){logger[_0x02e5('0x33')](_0x02e5('0x34'),util[_0x02e5('0x35')](_0x2b0dc0,{'showHidden':![],'depth':null}));_0x1aba7e();})[_0x02e5('0x2e')](function(_0x4f783c){logger[_0x02e5('0x2d')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x4f783c,{'showHidden':![],'depth':null}));_0x1aba7e(_0x4f783c);});}}});}; \ No newline at end of file +var _0xd58c=['isEmpty','length','destroy','ContactId','info','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','onlyIfOpen','outbound','Lists','map','all','findAll','dialCheckDuplicateType','CmList','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xd58c,0x174));var _0xcd58=function(_0x2fcfb1,_0x4b570b){_0x2fcfb1=_0x2fcfb1-0x0;var _0x1beaa4=_0xd58c[_0x2fcfb1];return _0x1beaa4;};'use strict';var _=require(_0xcd58('0x0'));var util=require('util');var logger=require(_0xcd58('0x1'))(_0xcd58('0x2'));var moment=require('moment');var shared=require(_0xcd58('0x3'));var attributes=require(_0xcd58('0x4'));function getTimezoneCallbackAt(_0x2e43d5,_0xfe0377,_0x3b0b12,_0x471fd0){var _0x40d5a2=_0x471fd0?_0xcd58('0x5'):_0xcd58('0x6');var _0x983673=_0x3b0b12[_0xcd58('0x7')]?_0x3b0b12[_0xcd58('0x7')]:moment()[_0xcd58('0x8')](_0xcd58('0x9'));if(_[_0xcd58('0xa')](_0x3b0b12[_0xcd58('0xb')])){return Promise[_0xcd58('0xc')](_0x983673);}return _0x2e43d5[_0x40d5a2][_0xcd58('0xd')]({'where':{'id':_0xfe0377}})[_0xcd58('0xe')](function(_0x39b758){if(_['isNil'](_0x39b758)||_[_0xcd58('0xa')](_0x39b758['dialTimezone'])){return Promise[_0xcd58('0xc')](_0x983673);}var _0xfec963=shared[_0xcd58('0xf')];var _0x4b40f3=_0xfec963[_0x39b758[_0xcd58('0xb')]];var _0x47bbba=_0xfec963[_0x3b0b12[_0xcd58('0xb')]];if(_[_0xcd58('0xa')](_0x4b40f3)&&_[_0xcd58('0xa')](_0x47bbba)){return Promise[_0xcd58('0xc')](_0x983673);}var _0x476fe8=_0x4b40f3['utcOffset']-_0x47bbba[_0xcd58('0x10')];var _0x4cb0e2=_0x3b0b12[_0xcd58('0x7')]?_0x3b0b12[_0xcd58('0x7')]:moment();_0x983673=moment(_0x4cb0e2)['add'](_0x476fe8,_0xcd58('0x11'))[_0xcd58('0x8')](_0xcd58('0x9'));return Promise[_0xcd58('0xc')](_0x983673);});}function getNewHopperPayload(_0x59fecf){return{'phone':_0x59fecf[_0xcd58('0x12')],'ContactId':_0x59fecf['id'],'ListId':_0x59fecf[_0xcd58('0x13')],'scheduledat':_0x59fecf['scheduledat']?_0x59fecf[_0xcd58('0x7')]:moment()['format'](_0xcd58('0x9')),'priority':_0x59fecf['priority']?_0x59fecf[_0xcd58('0x14')]:0x2,'callback':_0x59fecf[_0xcd58('0x15')]?!![]:![],'callbackuniqueid':_0x59fecf[_0xcd58('0x15')]?_0x59fecf[_0xcd58('0x15')]:undefined,'callbackat':_0x59fecf[_0xcd58('0x15')]?moment()[_0xcd58('0x8')](_0xcd58('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x66d79b,_0x4f4964,_0x245a7b,_0x3db75a){var _0x35c997={'phone':_0x245a7b[_0xcd58('0x12')]};var _0xcd7c9={'calleridnum':_0x245a7b[_0xcd58('0x12')]};if(_0x3db75a){Object[_0xcd58('0x16')](_0x35c997,{'CampaignId':_0x4f4964['id']});Object[_0xcd58('0x16')](_0xcd7c9,{'CampaignId':_0x4f4964['id']});}else{Object[_0xcd58('0x16')](_0x35c997,{'VoiceQueueId':_0x4f4964['id']});Object[_0xcd58('0x16')](_0xcd7c9,{'VoiceQueueId':_0x4f4964['id']});}return _0x66d79b[_0xcd58('0x17')]['findOne']({'where':_0x35c997})[_0xcd58('0xe')](function(_0x399342){if(_0x399342){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x245a7b['phone']+_0xcd58('0x18')+_0x4f4964['id']);}return _0x66d79b[_0xcd58('0x19')]['findOne']({'where':_0xcd7c9});})[_0xcd58('0xe')](function(_0x58990a){if(_0x58990a){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x245a7b[_0xcd58('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x4f4964['id']);}var _0x997455=getNewHopperPayload(_0x245a7b);if(_0x3db75a){_0x997455[_0xcd58('0x1a')]=_0x4f4964['id'];}else{_0x997455[_0xcd58('0x1b')]=_0x4f4964['id'];}return _0x66d79b['CmHopper']['create'](_0x997455);});}function handleOnlyIfOpenCheckDuplicate(_0x48e43e,_0x6f66e5,_0x31adeb,_0x31e222){var _0x55dbc9={'phone':_0x31adeb[_0xcd58('0x12')]};if(_0x31e222){Object[_0xcd58('0x16')](_0x55dbc9,{'CampaignId':_0x6f66e5['id']});}else{Object[_0xcd58('0x16')](_0x55dbc9,{'VoiceQueueId':_0x6f66e5['id']});}return _0x48e43e[_0xcd58('0x17')][_0xcd58('0xd')]({'where':_0x55dbc9})[_0xcd58('0xe')](function(_0x1a4469){if(_0x1a4469){throw new Error(_0xcd58('0x1c')+_0x31adeb[_0xcd58('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x6f66e5['id']);}var _0x437678=getNewHopperPayload(_0x31adeb);if(_0x31e222){_0x437678[_0xcd58('0x1a')]=_0x6f66e5['id'];}else{_0x437678[_0xcd58('0x1b')]=_0x6f66e5['id'];}return _0x48e43e[_0xcd58('0x17')][_0xcd58('0x1d')](_0x437678);});}function handleNeverCheckDuplicate(_0x2f2ce5,_0x48635b,_0x5d74b7){var _0x48d787=getNewHopperPayload(_0x5d74b7);_0x48d787['VoiceQueueId']=_0x48635b['id'];return _0x2f2ce5[_0xcd58('0x17')][_0xcd58('0x1d')](_0x48d787);}function handleCheckDuplicate(_0x587619,_0x184f31,_0x520921,_0x46787c){return getTimezoneCallbackAt(_0x587619,_0x184f31,_0x520921,_0x46787c)[_0xcd58('0xe')](function(_0x4fc315){_0x520921['scheduledat']=_0x4fc315;switch(_0x184f31['dialCheckDuplicateType']){case'always':return handleAlwaysCheckDuplicate(_0x587619,_0x184f31,_0x520921,_0x46787c);case _0xcd58('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0x587619,_0x184f31,_0x520921,_0x46787c);default:return handleNeverCheckDuplicate(_0x587619,_0x184f31,_0x520921);}});}function createHopperForVoiceQueues(_0x2e7b79,_0xafb477){return _0x2e7b79[_0xcd58('0x6')]['findAll']({'where':{'type':_0xcd58('0x1f')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x2e7b79['CmList'],'as':_0xcd58('0x20'),'where':{'id':_0xafb477[_0xcd58('0x13')]}}],'raw':!![]})[_0xcd58('0xe')](function(_0x33166e){var _0x1b9d3d=_0x33166e[_0xcd58('0x21')](function(_0x195255){return handleCheckDuplicate(_0x2e7b79,_0x195255,_0xafb477,![]);});return Promise[_0xcd58('0x22')](_0x1b9d3d);});}function createHopperForCampaigns(_0x20b33b,_0x128878){return _0x20b33b[_0xcd58('0x5')][_0xcd58('0x23')]({'attributes':['id',_0xcd58('0x24'),_0xcd58('0xb')],'include':[{'model':_0x20b33b[_0xcd58('0x25')],'as':_0xcd58('0x20'),'where':{'id':_0x128878['ListId']}}],'raw':!![]})[_0xcd58('0xe')](function(_0x59e468){var _0x2098f5=_0x59e468[_0xcd58('0x21')](function(_0x226d27){return handleCheckDuplicate(_0x20b33b,_0x226d27,_0x128878,!![]);});return Promise['all'](_0x2098f5);});}function createHopperBlackForVoiceQueues(_0x1ba370,_0x15a2f1){return _0x1ba370[_0xcd58('0x6')][_0xcd58('0x23')]({'where':{'type':_0xcd58('0x1f')},'attributes':['id'],'include':[{'model':_0x1ba370['CmList'],'as':'BlackLists','where':{'id':_0x15a2f1[_0xcd58('0x13')]}}],'raw':!![]})[_0xcd58('0xe')](function(_0xe9ab2b){var _0xa58a48=_0xe9ab2b[_0xcd58('0x21')](function(_0x40783c){return _0x1ba370[_0xcd58('0x26')]['create']({'phone':_0x15a2f1[_0xcd58('0x12')],'ContactId':_0x15a2f1['id'],'ListId':_0x15a2f1['ListId'],'VoiceQueueId':_0x40783c['id']});});return Promise['all'](_0xa58a48);});}function createHopperBlackForCampaigns(_0xac3aa3,_0x4e5d6a){return _0xac3aa3[_0xcd58('0x5')]['findAll']({'attributes':['id'],'include':[{'model':_0xac3aa3[_0xcd58('0x25')],'as':_0xcd58('0x27'),'where':{'id':_0x4e5d6a['ListId']}}],'raw':!![]})[_0xcd58('0xe')](function(_0x2f2cc4){var _0x30b452=_0x2f2cc4[_0xcd58('0x21')](function(_0x1d354b){return _0xac3aa3[_0xcd58('0x26')][_0xcd58('0x1d')]({'phone':_0x4e5d6a[_0xcd58('0x12')],'ContactId':_0x4e5d6a['id'],'ListId':_0x4e5d6a[_0xcd58('0x13')],'CampaignId':_0x1d354b['id']});});return Promise['all'](_0x30b452);});}module[_0xcd58('0x28')]=function(_0x164fa3){return _0x164fa3[_0xcd58('0x29')](_0xcd58('0x2a'),attributes,{'tableName':_0xcd58('0x2b'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0xcd58('0x2c'),'fields':[_0xcd58('0x2d'),_0xcd58('0x2e'),_0xcd58('0x12'),'mobile','fax','email'],'type':_0xcd58('0x2f')}],'timestamps':!![],'charset':_0xcd58('0x30'),'collate':_0xcd58('0x31'),'hooks':{'afterCreate':function(_0x346c9c,_0xd435fd,_0x4f4dab){var _0x4d276a=_0x164fa3[_0xcd58('0x32')];var _0x5e26c9=_0x346c9c[_0xcd58('0x33')]({'plain':!![]});if(!_0x5e26c9[_0xcd58('0x13')]){logger[_0xcd58('0x34')](_0xcd58('0x35')+_0x5e26c9['id']);return _0x4f4dab();}if(!_0x5e26c9['phone']){return _0x4f4dab();}return createHopperForVoiceQueues(_0x4d276a,_0x5e26c9)[_0xcd58('0xe')](function(){return createHopperBlackForVoiceQueues(_0x4d276a,_0x5e26c9);})[_0xcd58('0xe')](function(){return createHopperForCampaigns(_0x4d276a,_0x5e26c9);})[_0xcd58('0xe')](function(){return createHopperBlackForCampaigns(_0x4d276a,_0x5e26c9);})[_0xcd58('0xe')](function(){return _0x4f4dab();})[_0xcd58('0x36')](function(_0x15bca1){logger['error']('[cmContact][afterCreate]',_0x15bca1['message']);_0x4f4dab();});},'afterDestroy':function(_0x39d4a5,_0x26a242,_0x5bc097){var _0x3a81cd=_0x164fa3['models'];var _0x398901=_0x39d4a5[_0xcd58('0x33')]({'plain':!![]});return _0x3a81cd[_0xcd58('0x17')][_0xcd58('0x23')]({'raw':!![],'where':{'ListId':_0x398901[_0xcd58('0x13')],'ContactId':_0x398901['id']}})[_0xcd58('0xe')](function(_0x388c0f){if(!_[_0xcd58('0x37')](_0x388c0f)){var _0x46da21=[];for(var _0x4d9ce2=0x0;_0x4d9ce2<_0x388c0f[_0xcd58('0x38')];_0x4d9ce2+=0x1){var _0xfbc67d=_0x3a81cd['CmHopper'][_0xcd58('0x39')]({'where':{'ListId':_0x388c0f[_0x4d9ce2][_0xcd58('0x13')],'ContactId':_0x388c0f[_0x4d9ce2][_0xcd58('0x3a')],'VoiceQueueId':_0x388c0f[_0x4d9ce2][_0xcd58('0x1b')],'CampaignId':_0x388c0f[_0x4d9ce2][_0xcd58('0x1a')]}});_0x46da21['push'](_0xfbc67d);}return Promise[_0xcd58('0x22')](_0x46da21);}})['then'](function(_0x57fd35){logger[_0xcd58('0x3b')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x57fd35,{'showHidden':![],'depth':null}));_0x5bc097();})[_0xcd58('0x36')](function(_0x158934){logger[_0xcd58('0x34')](_0xcd58('0x3c'),util['inspect'](_0x158934,{'showHidden':![],'depth':null}));_0x5bc097(_0x158934);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 593218d..b796542 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x3a78b2,_0x504614){var _0x113653=function(_0x3f19a3){while(--_0x3f19a3){_0x3a78b2['push'](_0x3a78b2['shift']());}};_0x113653(++_0x504614);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x24b55a,_0x3e313f){var _0x17dcb5=function(_0x2cbb11){while(--_0x2cbb11){_0x24b55a['push'](_0x24b55a['shift']());}};_0x17dcb5(++_0x3e313f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 401813d..d8d5594 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33a1=['exports','PHONE','INTEGER','STRING','sequelize'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0x33a1,0x7c));var _0x133a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x133a('0x0'));module[_0x133a('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x133a('0x2')},'OrderBy':{'type':Sequelize[_0x133a('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x133a('0x4')],'defaultValue':null}}; \ No newline at end of file +var _0xce25=['INTEGER','PHONE'];(function(_0x4070ec,_0x43bebf){var _0x51eab2=function(_0x33b374){while(--_0x33b374){_0x4070ec['push'](_0x4070ec['shift']());}};_0x51eab2(++_0x43bebf);}(_0xce25,0x196));var _0x5ce2=function(_0x19a407,_0x3dac8f){_0x19a407=_0x19a407-0x0;var _0x136b61=_0xce25[_0x19a407];return _0x136b61;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x5ce2('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x5ce2('0x1')},'OrderBy':{'type':Sequelize[_0x5ce2('0x0')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 7fd27a2..42845d0 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd29e=['options','catch','create','body','get','user','CmContactHasItems','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','CmContactHasItem','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','show','rawAttributes','includeAll'];(function(_0x162467,_0x1d7760){var _0x39c856=function(_0x5d2c2b){while(--_0x5d2c2b){_0x162467['push'](_0x162467['shift']());}};_0x39c856(++_0x1d7760);}(_0xd29e,0xac));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xed29('0x0'));var rimraf=require(_0xed29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed29('0x2'));var rp=require('request-promise');var moment=require(_0xed29('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed29('0x4'));var util=require(_0xed29('0x5'));var path=require(_0xed29('0x6'));var sox=require('sox');var csv=require(_0xed29('0x7'));var ejs=require(_0xed29('0x8'));var fs=require('fs');var fs_extra=require(_0xed29('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xed29('0xa'));var jsforce=require(_0xed29('0xb'));var deskjs=require(_0xed29('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed29('0xd'));var Papa=require(_0xed29('0xe'));var Redis=require('ioredis');var authService=require(_0xed29('0xf'));var qs=require(_0xed29('0x10'));var as=require(_0xed29('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed29('0x12'))(_0xed29('0x13'));var utils=require(_0xed29('0x14'));var config=require(_0xed29('0x15'));var licenseUtil=require(_0xed29('0x16'));var db=require(_0xed29('0x17'))['db'];function respondWithStatusCode(_0x28b244,_0x31c8e9){_0x31c8e9=_0x31c8e9||0xcc;return function(_0x17a0fd){if(_0x17a0fd){return _0x28b244['sendStatus'](_0x31c8e9);}return _0x28b244['status'](_0x31c8e9)[_0xed29('0x18')]();};}function respondWithResult(_0x523495,_0x10bd5a){_0x10bd5a=_0x10bd5a||0xc8;return function(_0x2659d5){if(_0x2659d5){return _0x523495[_0xed29('0x19')](_0x10bd5a)[_0xed29('0x1a')](_0x2659d5);}};}function respondWithFilteredResult(_0x35f31a,_0x3a7170){return function(_0x5339b9){if(_0x5339b9){var _0xa1427c=typeof _0x3a7170['offset']===_0xed29('0x1b')&&typeof _0x3a7170[_0xed29('0x1c')]==='undefined';var _0x500c74=_0x5339b9[_0xed29('0x1d')];var _0x1ed3ea=_0xa1427c?0x0:_0x3a7170[_0xed29('0x1e')];var _0x51b71e=_0xa1427c?_0x5339b9[_0xed29('0x1d')]:_0x3a7170['offset']+_0x3a7170[_0xed29('0x1c')];var _0x571a8a;if(_0x51b71e>=_0x500c74){_0x51b71e=_0x500c74;_0x571a8a=0xc8;}else{_0x571a8a=0xce;}_0x35f31a[_0xed29('0x19')](_0x571a8a);return _0x35f31a[_0xed29('0x1f')](_0xed29('0x20'),_0x1ed3ea+'-'+_0x51b71e+'/'+_0x500c74)['json'](_0x5339b9);}return null;};}function patchUpdates(_0x36dee6){return function(_0x1f2146){try{jsonpatch[_0xed29('0x21')](_0x1f2146,_0x36dee6,!![]);}catch(_0x5a4692){return BPromise[_0xed29('0x22')](_0x5a4692);}return _0x1f2146[_0xed29('0x23')]();};}function saveUpdates(_0xdc580d,_0x340582){return function(_0x4b7cb6){if(_0x4b7cb6){return _0x4b7cb6['update'](_0xdc580d)[_0xed29('0x24')](function(_0x16fd8c){return _0x16fd8c;});}return null;};}function removeEntity(_0x267ecd,_0x1beec3){return function(_0x552c16){if(_0x552c16){return _0x552c16[_0xed29('0x25')]()['then'](function(){var _0x54f2a2=_0x552c16['get']({'plain':!![]});var _0x355ed0='CmContactHasItems';return db['UserProfileResource'][_0xed29('0x25')]({'where':{'type':_0x355ed0,'resourceId':_0x54f2a2['id']}})['then'](function(){return _0x552c16;});})['then'](function(){_0x267ecd[_0xed29('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f94a,_0x288d25){return function(_0x4fbede){if(!_0x4fbede){_0x27f94a['sendStatus'](0x194);}return _0x4fbede;};}function handleError(_0x4995ef,_0x3ab6a6){_0x3ab6a6=_0x3ab6a6||0x1f4;return function(_0x1c2518){logger[_0xed29('0x26')](_0x1c2518[_0xed29('0x27')]);if(_0x1c2518[_0xed29('0x28')]){delete _0x1c2518[_0xed29('0x28')];}_0x4995ef[_0xed29('0x19')](_0x3ab6a6)['send'](_0x1c2518);};}exports[_0xed29('0x29')]=function(_0x41b958,_0x4c4680){var _0xec70fd={},_0x266997={},_0x3684e7={'count':0x0,'rows':[]};var _0x1ab6b2=_[_0xed29('0x2a')](db[_0xed29('0x2b')]['rawAttributes'],function(_0x417cae){return{'name':_0x417cae[_0xed29('0x2c')],'type':_0x417cae[_0xed29('0x2d')]['key']};});_0x266997[_0xed29('0x2e')]=_[_0xed29('0x2a')](_0x1ab6b2,_0xed29('0x28'));_0x266997[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x41b958['query']);_0x266997[_0xed29('0x31')]=_[_0xed29('0x32')](_0x266997[_0xed29('0x2e')],_0x266997[_0xed29('0x2f')]);_0xec70fd[_0xed29('0x33')]=_[_0xed29('0x32')](_0x266997['model'],qs[_0xed29('0x34')](_0x41b958[_0xed29('0x2f')][_0xed29('0x34')]));_0xec70fd[_0xed29('0x33')]=_0xec70fd[_0xed29('0x33')]['length']?_0xec70fd[_0xed29('0x33')]:_0x266997[_0xed29('0x2e')];if(!_0x41b958[_0xed29('0x2f')][_0xed29('0x35')]('nolimit')){_0xec70fd[_0xed29('0x1c')]=qs[_0xed29('0x1c')](_0x41b958[_0xed29('0x2f')]['limit']);_0xec70fd[_0xed29('0x1e')]=qs[_0xed29('0x1e')](_0x41b958[_0xed29('0x2f')][_0xed29('0x1e')]);}_0xec70fd[_0xed29('0x36')]=qs[_0xed29('0x37')](_0x41b958[_0xed29('0x2f')][_0xed29('0x37')]);_0xec70fd[_0xed29('0x38')]=qs[_0xed29('0x31')](_[_0xed29('0x39')](_0x41b958[_0xed29('0x2f')],_0x266997[_0xed29('0x31')]),_0x1ab6b2);if(_0x41b958[_0xed29('0x2f')][_0xed29('0x3a')]){_0xec70fd['where']=_[_0xed29('0x3b')](_0xec70fd[_0xed29('0x38')],{'$or':_[_0xed29('0x2a')](_0x1ab6b2,function(_0xf0943c){if(_0xf0943c[_0xed29('0x2d')]!==_0xed29('0x3c')){var _0xd1f3b0={};_0xd1f3b0[_0xf0943c['name']]={'$like':'%'+_0x41b958[_0xed29('0x2f')][_0xed29('0x3a')]+'%'};return _0xd1f3b0;}})});}_0xec70fd=_[_0xed29('0x3b')]({},_0xec70fd,_0x41b958['options']);var _0x1d9915={'where':_0xec70fd[_0xed29('0x38')]};return db[_0xed29('0x2b')][_0xed29('0x1d')](_0x1d9915)[_0xed29('0x24')](function(_0x56dbc2){_0x3684e7['count']=_0x56dbc2;if(_0x41b958['query']['includeAll']){_0xec70fd[_0xed29('0x3d')]=[{'all':!![]}];}return db[_0xed29('0x2b')]['findAll'](_0xec70fd);})[_0xed29('0x24')](function(_0x1fc772){_0x3684e7['rows']=_0x1fc772;return _0x3684e7;})[_0xed29('0x24')](respondWithFilteredResult(_0x4c4680,_0xec70fd))['catch'](handleError(_0x4c4680,null));};exports[_0xed29('0x3e')]=function(_0x468471,_0x36e86d){var _0x42f9c2={'raw':!![],'where':{'id':_0x468471['params']['id']}},_0xe372c6={};_0xe372c6[_0xed29('0x2e')]=_['keys'](db[_0xed29('0x2b')][_0xed29('0x3f')]);_0xe372c6[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x468471[_0xed29('0x2f')]);_0xe372c6['filters']=_[_0xed29('0x32')](_0xe372c6['model'],_0xe372c6[_0xed29('0x2f')]);_0x42f9c2[_0xed29('0x33')]=_[_0xed29('0x32')](_0xe372c6[_0xed29('0x2e')],qs[_0xed29('0x34')](_0x468471['query'][_0xed29('0x34')]));_0x42f9c2[_0xed29('0x33')]=_0x42f9c2[_0xed29('0x33')]['length']?_0x42f9c2[_0xed29('0x33')]:_0xe372c6['model'];if(_0x468471['query'][_0xed29('0x40')]){_0x42f9c2[_0xed29('0x3d')]=[{'all':!![]}];}_0x42f9c2=_[_0xed29('0x3b')]({},_0x42f9c2,_0x468471[_0xed29('0x41')]);return db[_0xed29('0x2b')]['find'](_0x42f9c2)[_0xed29('0x24')](handleEntityNotFound(_0x36e86d,null))['then'](respondWithResult(_0x36e86d,null))[_0xed29('0x42')](handleError(_0x36e86d,null));};exports[_0xed29('0x43')]=function(_0x1cef2b,_0x26c50b){return db[_0xed29('0x2b')][_0xed29('0x43')](_0x1cef2b[_0xed29('0x44')],{})[_0xed29('0x24')](function(_0x35d698){var _0x4aa32f=_0x1cef2b['user'][_0xed29('0x45')]({'plain':!![]});if(!_0x4aa32f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aa32f['role']===_0xed29('0x46')){var _0x53673e=_0x35d698[_0xed29('0x45')]({'plain':!![]});var _0xb00afa=_0xed29('0x47');return db['UserProfileSection'][_0xed29('0x48')]({'where':{'name':_0xb00afa,'userProfileId':_0x4aa32f[_0xed29('0x49')]},'raw':!![]})[_0xed29('0x24')](function(_0x1f29a5){if(_0x1f29a5&&_0x1f29a5[_0xed29('0x4a')]===0x0){return db[_0xed29('0x4b')][_0xed29('0x43')]({'name':_0x53673e[_0xed29('0x28')],'resourceId':_0x53673e['id'],'type':_0x1f29a5[_0xed29('0x28')],'sectionId':_0x1f29a5['id']},{})[_0xed29('0x24')](function(){return _0x35d698;});}else{return _0x35d698;}})[_0xed29('0x42')](function(_0x4baa61){logger[_0xed29('0x26')](_0xed29('0x4c'),_0x4baa61);throw _0x4baa61;});}return _0x35d698;})[_0xed29('0x24')](respondWithResult(_0x26c50b,0xc9))[_0xed29('0x42')](handleError(_0x26c50b,null));};exports[_0xed29('0x4d')]=function(_0x3f5657,_0x530a81){if(_0x3f5657[_0xed29('0x44')]['id']){delete _0x3f5657[_0xed29('0x44')]['id'];}return db['CmContactHasItem'][_0xed29('0x48')]({'where':{'id':_0x3f5657[_0xed29('0x4e')]['id']}})[_0xed29('0x24')](handleEntityNotFound(_0x530a81,null))[_0xed29('0x24')](saveUpdates(_0x3f5657[_0xed29('0x44')],null))['then'](respondWithResult(_0x530a81,null))[_0xed29('0x42')](handleError(_0x530a81,null));};exports['destroy']=function(_0x86cf47,_0x8dfaeb){return db[_0xed29('0x2b')]['find']({'where':{'id':_0x86cf47['params']['id']}})[_0xed29('0x24')](handleEntityNotFound(_0x8dfaeb,null))[_0xed29('0x24')](removeEntity(_0x8dfaeb,null))[_0xed29('0x42')](handleError(_0x8dfaeb,null));}; \ No newline at end of file +var _0x8ae6=['rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll'];(function(_0x478150,_0x46b73a){var _0x303e3d=function(_0x2301e9){while(--_0x2301e9){_0x478150['push'](_0x478150['shift']());}};_0x303e3d(++_0x46b73a);}(_0x8ae6,0x14f));var _0x68ae=function(_0x522327,_0x3aff90){_0x522327=_0x522327-0x0;var _0x33ee38=_0x8ae6[_0x522327];return _0x33ee38;};'use strict';var emlformat=require(_0x68ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68ae('0x2'));var moment=require(_0x68ae('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x68ae('0x4'));var sox=require(_0x68ae('0x5'));var csv=require(_0x68ae('0x6'));var ejs=require(_0x68ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ae('0x8'));var squel=require('squel');var crypto=require(_0x68ae('0x9'));var jsforce=require(_0x68ae('0xa'));var deskjs=require(_0x68ae('0xb'));var toCsv=require(_0x68ae('0x6'));var querystring=require(_0x68ae('0xc'));var Papa=require('papaparse');var Redis=require(_0x68ae('0xd'));var authService=require(_0x68ae('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x68ae('0xf'))(_0x68ae('0x10'));var utils=require(_0x68ae('0x11'));var config=require(_0x68ae('0x12'));var licenseUtil=require(_0x68ae('0x13'));var db=require(_0x68ae('0x14'))['db'];function respondWithStatusCode(_0x3ce8e3,_0x5710d4){_0x5710d4=_0x5710d4||0xcc;return function(_0x340abe){if(_0x340abe){return _0x3ce8e3[_0x68ae('0x15')](_0x5710d4);}return _0x3ce8e3[_0x68ae('0x16')](_0x5710d4)['end']();};}function respondWithResult(_0x306e45,_0x12286f){_0x12286f=_0x12286f||0xc8;return function(_0x3d6069){if(_0x3d6069){return _0x306e45[_0x68ae('0x16')](_0x12286f)['json'](_0x3d6069);}};}function respondWithFilteredResult(_0x21c6e8,_0x240445){return function(_0x4b6c72){if(_0x4b6c72){var _0x4d1a33=typeof _0x240445[_0x68ae('0x17')]===_0x68ae('0x18')&&typeof _0x240445[_0x68ae('0x19')]==='undefined';var _0x282f9d=_0x4b6c72[_0x68ae('0x1a')];var _0x6f737b=_0x4d1a33?0x0:_0x240445[_0x68ae('0x17')];var _0x3873a7=_0x4d1a33?_0x4b6c72[_0x68ae('0x1a')]:_0x240445['offset']+_0x240445['limit'];var _0x3daf2f;if(_0x3873a7>=_0x282f9d){_0x3873a7=_0x282f9d;_0x3daf2f=0xc8;}else{_0x3daf2f=0xce;}_0x21c6e8['status'](_0x3daf2f);return _0x21c6e8[_0x68ae('0x1b')]('Content-Range',_0x6f737b+'-'+_0x3873a7+'/'+_0x282f9d)[_0x68ae('0x1c')](_0x4b6c72);}return null;};}function patchUpdates(_0x515b93){return function(_0x3ce237){try{jsonpatch[_0x68ae('0x1d')](_0x3ce237,_0x515b93,!![]);}catch(_0x11a8a0){return BPromise[_0x68ae('0x1e')](_0x11a8a0);}return _0x3ce237['save']();};}function saveUpdates(_0x305661,_0x4ed85f){return function(_0x59b43f){if(_0x59b43f){return _0x59b43f[_0x68ae('0x1f')](_0x305661)['then'](function(_0x243223){return _0x243223;});}return null;};}function removeEntity(_0xc17bf5,_0x31cd50){return function(_0x303cd3){if(_0x303cd3){return _0x303cd3[_0x68ae('0x20')]()[_0x68ae('0x21')](function(){var _0x39d887=_0x303cd3[_0x68ae('0x22')]({'plain':!![]});var _0x2d34a3='CmContactHasItems';return db[_0x68ae('0x23')][_0x68ae('0x20')]({'where':{'type':_0x2d34a3,'resourceId':_0x39d887['id']}})['then'](function(){return _0x303cd3;});})[_0x68ae('0x21')](function(){_0xc17bf5[_0x68ae('0x16')](0xcc)[_0x68ae('0x24')]();});}};}function handleEntityNotFound(_0x39a33f,_0x2aac8a){return function(_0x58c7f8){if(!_0x58c7f8){_0x39a33f[_0x68ae('0x15')](0x194);}return _0x58c7f8;};}function handleError(_0x331af4,_0x4bb430){_0x4bb430=_0x4bb430||0x1f4;return function(_0x445c5e){logger['error'](_0x445c5e[_0x68ae('0x25')]);if(_0x445c5e[_0x68ae('0x26')]){delete _0x445c5e['name'];}_0x331af4[_0x68ae('0x16')](_0x4bb430)[_0x68ae('0x27')](_0x445c5e);};}exports[_0x68ae('0x28')]=function(_0x57ad9d,_0xf5ddf4){var _0x383ac1={},_0x48985b={},_0x8e64a2={'count':0x0,'rows':[]};var _0x51b0bf=_[_0x68ae('0x29')](db[_0x68ae('0x2a')][_0x68ae('0x2b')],function(_0x2fda82){return{'name':_0x2fda82[_0x68ae('0x2c')],'type':_0x2fda82[_0x68ae('0x2d')][_0x68ae('0x2e')]};});_0x48985b['model']=_[_0x68ae('0x29')](_0x51b0bf,_0x68ae('0x26'));_0x48985b[_0x68ae('0x2f')]=_[_0x68ae('0x30')](_0x57ad9d[_0x68ae('0x2f')]);_0x48985b['filters']=_[_0x68ae('0x31')](_0x48985b[_0x68ae('0x32')],_0x48985b[_0x68ae('0x2f')]);_0x383ac1[_0x68ae('0x33')]=_[_0x68ae('0x31')](_0x48985b[_0x68ae('0x32')],qs[_0x68ae('0x34')](_0x57ad9d['query'][_0x68ae('0x34')]));_0x383ac1[_0x68ae('0x33')]=_0x383ac1[_0x68ae('0x33')][_0x68ae('0x35')]?_0x383ac1[_0x68ae('0x33')]:_0x48985b[_0x68ae('0x32')];if(!_0x57ad9d[_0x68ae('0x2f')]['hasOwnProperty'](_0x68ae('0x36'))){_0x383ac1[_0x68ae('0x19')]=qs[_0x68ae('0x19')](_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x19')]);_0x383ac1[_0x68ae('0x17')]=qs[_0x68ae('0x17')](_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x17')]);}_0x383ac1[_0x68ae('0x37')]=qs[_0x68ae('0x38')](_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x38')]);_0x383ac1[_0x68ae('0x39')]=qs['filters'](_['pick'](_0x57ad9d[_0x68ae('0x2f')],_0x48985b[_0x68ae('0x3a')]),_0x51b0bf);if(_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x3b')]){_0x383ac1[_0x68ae('0x39')]=_[_0x68ae('0x3c')](_0x383ac1[_0x68ae('0x39')],{'$or':_[_0x68ae('0x29')](_0x51b0bf,function(_0x29609f){if(_0x29609f[_0x68ae('0x2d')]!=='VIRTUAL'){var _0x469725={};_0x469725[_0x29609f[_0x68ae('0x26')]]={'$like':'%'+_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x3b')]+'%'};return _0x469725;}})});}_0x383ac1=_[_0x68ae('0x3c')]({},_0x383ac1,_0x57ad9d[_0x68ae('0x3d')]);var _0x38a380={'where':_0x383ac1[_0x68ae('0x39')]};return db[_0x68ae('0x2a')][_0x68ae('0x1a')](_0x38a380)[_0x68ae('0x21')](function(_0x5906a4){_0x8e64a2[_0x68ae('0x1a')]=_0x5906a4;if(_0x57ad9d[_0x68ae('0x2f')][_0x68ae('0x3e')]){_0x383ac1[_0x68ae('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x68ae('0x40')](_0x383ac1);})[_0x68ae('0x21')](function(_0x146051){_0x8e64a2[_0x68ae('0x41')]=_0x146051;return _0x8e64a2;})[_0x68ae('0x21')](respondWithFilteredResult(_0xf5ddf4,_0x383ac1))[_0x68ae('0x42')](handleError(_0xf5ddf4,null));};exports[_0x68ae('0x43')]=function(_0x316bbd,_0x5c69bc){var _0x3b0771={'raw':!![],'where':{'id':_0x316bbd[_0x68ae('0x44')]['id']}},_0x4d322e={};_0x4d322e[_0x68ae('0x32')]=_[_0x68ae('0x30')](db[_0x68ae('0x2a')][_0x68ae('0x2b')]);_0x4d322e['query']=_[_0x68ae('0x30')](_0x316bbd[_0x68ae('0x2f')]);_0x4d322e['filters']=_['intersection'](_0x4d322e[_0x68ae('0x32')],_0x4d322e[_0x68ae('0x2f')]);_0x3b0771[_0x68ae('0x33')]=_[_0x68ae('0x31')](_0x4d322e[_0x68ae('0x32')],qs[_0x68ae('0x34')](_0x316bbd[_0x68ae('0x2f')]['fields']));_0x3b0771[_0x68ae('0x33')]=_0x3b0771[_0x68ae('0x33')]['length']?_0x3b0771['attributes']:_0x4d322e[_0x68ae('0x32')];if(_0x316bbd[_0x68ae('0x2f')][_0x68ae('0x3e')]){_0x3b0771['include']=[{'all':!![]}];}_0x3b0771=_['merge']({},_0x3b0771,_0x316bbd[_0x68ae('0x3d')]);return db[_0x68ae('0x2a')]['find'](_0x3b0771)[_0x68ae('0x21')](handleEntityNotFound(_0x5c69bc,null))['then'](respondWithResult(_0x5c69bc,null))['catch'](handleError(_0x5c69bc,null));};exports[_0x68ae('0x45')]=function(_0x15093a,_0x20740b){return db[_0x68ae('0x2a')][_0x68ae('0x45')](_0x15093a[_0x68ae('0x46')],{})[_0x68ae('0x21')](function(_0x4a3652){var _0x522dd3=_0x15093a[_0x68ae('0x47')]['get']({'plain':!![]});if(!_0x522dd3)throw new Error(_0x68ae('0x48'));if(_0x522dd3[_0x68ae('0x49')]===_0x68ae('0x47')){var _0x53a6ee=_0x4a3652['get']({'plain':!![]});var _0x222049=_0x68ae('0x4a');return db[_0x68ae('0x4b')][_0x68ae('0x4c')]({'where':{'name':_0x222049,'userProfileId':_0x522dd3[_0x68ae('0x4d')]},'raw':!![]})[_0x68ae('0x21')](function(_0x1f6271){if(_0x1f6271&&_0x1f6271[_0x68ae('0x4e')]===0x0){return db[_0x68ae('0x23')][_0x68ae('0x45')]({'name':_0x53a6ee['name'],'resourceId':_0x53a6ee['id'],'type':_0x1f6271[_0x68ae('0x26')],'sectionId':_0x1f6271['id']},{})['then'](function(){return _0x4a3652;});}else{return _0x4a3652;}})['catch'](function(_0x24ed97){logger['error'](_0x68ae('0x4f'),_0x24ed97);throw _0x24ed97;});}return _0x4a3652;})['then'](respondWithResult(_0x20740b,0xc9))[_0x68ae('0x42')](handleError(_0x20740b,null));};exports[_0x68ae('0x1f')]=function(_0x359c56,_0x389952){if(_0x359c56[_0x68ae('0x46')]['id']){delete _0x359c56[_0x68ae('0x46')]['id'];}return db['CmContactHasItem'][_0x68ae('0x4c')]({'where':{'id':_0x359c56[_0x68ae('0x44')]['id']}})[_0x68ae('0x21')](handleEntityNotFound(_0x389952,null))['then'](saveUpdates(_0x359c56['body'],null))[_0x68ae('0x21')](respondWithResult(_0x389952,null))[_0x68ae('0x42')](handleError(_0x389952,null));};exports[_0x68ae('0x20')]=function(_0x281696,_0x1816c2){return db[_0x68ae('0x2a')]['find']({'where':{'id':_0x281696[_0x68ae('0x44')]['id']}})[_0x68ae('0x21')](handleEntityNotFound(_0x1816c2,null))['then'](removeEntity(_0x1816c2,null))[_0x68ae('0x42')](handleError(_0x1816c2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8adb4be..b4ff4b4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8a7=['bluebird','request-promise','path','../../config/environment','exports','define','CmContactHasItem','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe8a7,0x172));var _0x7e8a=function(_0x4c4d44,_0x199ab7){_0x4c4d44=_0x4c4d44-0x0;var _0x23af06=_0xe8a7[_0x4c4d44];return _0x23af06;};'use strict';var _=require(_0x7e8a('0x0'));var util=require(_0x7e8a('0x1'));var logger=require(_0x7e8a('0x2'))(_0x7e8a('0x3'));var moment=require('moment');var BPromise=require(_0x7e8a('0x4'));var rp=require(_0x7e8a('0x5'));var fs=require('fs');var path=require(_0x7e8a('0x6'));var rimraf=require('rimraf');var config=require(_0x7e8a('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0x7e8a('0x8')]=function(_0x4a34fb,_0x203c04){return _0x4a34fb[_0x7e8a('0x9')](_0x7e8a('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2815=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','util','api','moment','bluebird'];(function(_0x31d727,_0x4e19e9){var _0x3e2bd1=function(_0x44a388){while(--_0x44a388){_0x31d727['push'](_0x31d727['shift']());}};_0x3e2bd1(++_0x4e19e9);}(_0x2815,0x10a));var _0x5281=function(_0x3246f0,_0x3be7ce){_0x3246f0=_0x3246f0-0x0;var _0x4e3548=_0x2815[_0x3246f0];return _0x4e3548;};'use strict';var _=require('lodash');var util=require(_0x5281('0x0'));var logger=require('../../config/logger')(_0x5281('0x1'));var moment=require(_0x5281('0x2'));var BPromise=require(_0x5281('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5281('0x4'));var config=require(_0x5281('0x5'));var attributes=require(_0x5281('0x6'));module['exports']=function(_0x145272,_0x346b9c){return _0x145272[_0x5281('0x7')](_0x5281('0x8'),attributes,{'tableName':_0x5281('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index d643246..1dc2dba 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ad4=['debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x53d105,_0x4464ab){var _0x2b5af1=function(_0x3002d5){while(--_0x3002d5){_0x53d105['push'](_0x53d105['shift']());}};_0x2b5af1(++_0x4464ab);}(_0x8ad4,0x1e8));var _0x48ad=function(_0x4d634b,_0x3c3ed6){_0x4d634b=_0x4d634b-0x0;var _0x193d8a=_0x8ad4[_0x4d634b];return _0x193d8a;};'use strict';var _=require(_0x48ad('0x0'));var util=require(_0x48ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ad('0x3'))['db'];var utils=require(_0x48ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x48ad('0x5'));var client=jayson[_0x48ad('0x6')][_0x48ad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9086a3,_0x3ae82b,_0x380655){return new BPromise(function(_0x51dedd,_0x3f91e4){return client[_0x48ad('0x8')](_0x9086a3,_0x380655)[_0x48ad('0x9')](function(_0x6a1e0d){logger[_0x48ad('0xa')](_0x48ad('0xb'),_0x3ae82b,'request\x20sent');logger[_0x48ad('0xc')](_0x48ad('0xd'),_0x3ae82b,_0x48ad('0xe'),JSON['stringify'](_0x6a1e0d));if(_0x6a1e0d[_0x48ad('0xf')]){if(_0x6a1e0d[_0x48ad('0xf')][_0x48ad('0x10')]===0x1f4){logger['error'](_0x48ad('0xb'),_0x3ae82b,_0x6a1e0d['error'][_0x48ad('0x11')]);return _0x3f91e4(_0x6a1e0d[_0x48ad('0xf')]['message']);}logger['error'](_0x48ad('0xb'),_0x3ae82b,_0x6a1e0d['error'][_0x48ad('0x11')]);return _0x51dedd(_0x6a1e0d[_0x48ad('0xf')]['message']);}else{logger[_0x48ad('0xa')](_0x48ad('0xb'),_0x3ae82b,_0x48ad('0xe'));_0x51dedd(_0x6a1e0d[_0x48ad('0x12')][_0x48ad('0x11')]);}})[_0x48ad('0x13')](function(_0x34b247){logger[_0x48ad('0xf')](_0x48ad('0xb'),_0x3ae82b,_0x34b247);_0x3f91e4(_0x34b247);});});} \ No newline at end of file +var _0x5dfb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x3e4225,_0x2ecb68){var _0x582abb=function(_0x6c1d9e){while(--_0x6c1d9e){_0x3e4225['push'](_0x3e4225['shift']());}};_0x582abb(++_0x2ecb68);}(_0x5dfb,0xa7));var _0xb5df=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x5dfb[_0x424501];return _0xb719af;};'use strict';var _=require('lodash');var util=require(_0xb5df('0x0'));var moment=require(_0xb5df('0x1'));var BPromise=require(_0xb5df('0x2'));var rs=require(_0xb5df('0x3'));var fs=require('fs');var Redis=require(_0xb5df('0x4'));var db=require(_0xb5df('0x5'))['db'];var utils=require(_0xb5df('0x6'));var logger=require(_0xb5df('0x7'))('rpc');var config=require(_0xb5df('0x8'));var jayson=require(_0xb5df('0x9'));var client=jayson[_0xb5df('0xa')][_0xb5df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5811fc,_0x1b9602,_0x56127f){return new BPromise(function(_0x4cee70,_0xbc79ab){return client[_0xb5df('0xc')](_0x5811fc,_0x56127f)[_0xb5df('0xd')](function(_0x453123){logger[_0xb5df('0xe')](_0xb5df('0xf'),_0x1b9602,_0xb5df('0x10'));logger[_0xb5df('0x11')](_0xb5df('0x12'),_0x1b9602,'request\x20sent',JSON[_0xb5df('0x13')](_0x453123));if(_0x453123[_0xb5df('0x14')]){if(_0x453123['error']['code']===0x1f4){logger['error'](_0xb5df('0xf'),_0x1b9602,_0x453123[_0xb5df('0x14')][_0xb5df('0x15')]);return _0xbc79ab(_0x453123[_0xb5df('0x14')][_0xb5df('0x15')]);}logger[_0xb5df('0x14')](_0xb5df('0xf'),_0x1b9602,_0x453123[_0xb5df('0x14')][_0xb5df('0x15')]);return _0x4cee70(_0x453123[_0xb5df('0x14')]['message']);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x1b9602,_0xb5df('0x10'));_0x4cee70(_0x453123[_0xb5df('0x16')][_0xb5df('0x15')]);}})[_0xb5df('0x17')](function(_0x26cd0f){logger['error'](_0xb5df('0xf'),_0x1b9602,_0x26cd0f);_0xbc79ab(_0x26cd0f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6183a5e..422b45a 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x090e=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3766e3,_0x18056c){var _0x1eccfd=function(_0x2729a3){while(--_0x2729a3){_0x3766e3['push'](_0x3766e3['shift']());}};_0x1eccfd(++_0x18056c);}(_0x090e,0x1bb));var _0xe090=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x090e[_0x2442b9];return _0x31b571;};'use strict';var multer=require(_0xe090('0x0'));var util=require('util');var path=require(_0xe090('0x1'));var timeout=require(_0xe090('0x2'));var express=require(_0xe090('0x3'));var router=express['Router']();var fs_extra=require(_0xe090('0x4'));var auth=require(_0xe090('0x5'));var interaction=require(_0xe090('0x6'));var config=require(_0xe090('0x7'));var controller=require(_0xe090('0x8'));router[_0xe090('0x9')]('/',auth[_0xe090('0xa')](),controller[_0xe090('0xb')]);router[_0xe090('0x9')](_0xe090('0xc'),auth[_0xe090('0xa')](),controller[_0xe090('0xd')]);router[_0xe090('0xe')]('/',auth[_0xe090('0xa')](),controller[_0xe090('0xf')]);router[_0xe090('0x10')](_0xe090('0xc'),auth[_0xe090('0xa')](),controller[_0xe090('0x11')]);router['delete'](_0xe090('0xc'),auth[_0xe090('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x59e8=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x59e8,0x142));var _0x859e=function(_0x3b6f64,_0x3b79f2){_0x3b6f64=_0x3b6f64-0x0;var _0x280054=_0x59e8[_0x3b6f64];return _0x280054;};'use strict';var multer=require(_0x859e('0x0'));var util=require('util');var path=require(_0x859e('0x1'));var timeout=require('connect-timeout');var express=require(_0x859e('0x2'));var router=express[_0x859e('0x3')]();var fs_extra=require(_0x859e('0x4'));var auth=require(_0x859e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x859e('0x6'));var controller=require(_0x859e('0x7'));router['get']('/',auth[_0x859e('0x8')](),controller['index']);router[_0x859e('0x9')]('/:id',auth[_0x859e('0x8')](),controller[_0x859e('0xa')]);router[_0x859e('0xb')]('/',auth[_0x859e('0x8')](),controller[_0x859e('0xc')]);router[_0x859e('0xd')](_0x859e('0xe'),auth[_0x859e('0x8')](),controller[_0x859e('0xf')]);router[_0x859e('0x10')](_0x859e('0xe'),auth[_0x859e('0x8')](),controller[_0x859e('0x11')]);module[_0x859e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 369907d..29d075a 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 _0xb5fd=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','alias','STRING','TEXT','long','type','parse','values','isArray','setDataValue','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb5fd,0x9c));var _0xdb5f=function(_0x498948,_0x25b505){_0x498948=_0x498948-0x0;var _0x4e3bdf=_0xb5fd[_0x498948];return _0x4e3bdf;};'use strict';var Sequelize=require(_0xdb5f('0x0'));var _=require(_0xdb5f('0x1'));module[_0xdb5f('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c828f){return this[_0xdb5f('0x3')](_0xdb5f('0x4'));}},'alias':{'type':Sequelize[_0xdb5f('0x5')],'allowNull':![],'set':function(_0x6e56d6){this['setDataValue']('alias',_0x6e56d6?_0x6e56d6:this[_0xdb5f('0x3')]('name'));}},'type':{'type':Sequelize[_0xdb5f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xdb5f('0x6')](_0xdb5f('0x7')),'get':function(){if(this[_0xdb5f('0x3')](_0xdb5f('0x8'))==='select'){return JSON[_0xdb5f('0x9')](this['getDataValue'](_0xdb5f('0xa')));}else{return this[_0xdb5f('0x3')](_0xdb5f('0xa'));}},'set':function(_0x95df61){if(Array[_0xdb5f('0xb')](_0x95df61)){this[_0xdb5f('0xc')](_0xdb5f('0xa'),JSON[_0xdb5f('0xd')](_0x95df61));}else{this[_0xdb5f('0xc')]('values',_0x95df61);}}},'required':{'type':Sequelize[_0xdb5f('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xdb5f('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xdb5f('0xf')](_0xdb5f('0x10'))}}; \ No newline at end of file +var _0x8dcd=['voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x171ffa,_0x3a237c){var _0x12fbc5=function(_0x51c1e7){while(--_0x51c1e7){_0x171ffa['push'](_0x171ffa['shift']());}};_0x12fbc5(++_0x3a237c);}(_0x8dcd,0x157));var _0xd8dc=function(_0x4b8d24,_0x2d1ac1){_0x4b8d24=_0x4b8d24-0x0;var _0xb4cd4a=_0x8dcd[_0x4b8d24];return _0xb4cd4a;};'use strict';var Sequelize=require(_0xd8dc('0x0'));var _=require(_0xd8dc('0x1'));module['exports']={'name':{'type':Sequelize[_0xd8dc('0x2')],'get':function(_0x4068cb){return this[_0xd8dc('0x3')](_0xd8dc('0x4'));}},'alias':{'type':Sequelize[_0xd8dc('0x5')],'allowNull':![],'set':function(_0x4a7962){this[_0xd8dc('0x6')](_0xd8dc('0x4'),_0x4a7962?_0x4a7962:this['getDataValue'](_0xd8dc('0x7')));}},'type':{'type':Sequelize[_0xd8dc('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xd8dc('0x8')]('long'),'get':function(){if(this[_0xd8dc('0x3')](_0xd8dc('0x9'))===_0xd8dc('0xa')){return JSON[_0xd8dc('0xb')](this['getDataValue'](_0xd8dc('0xc')));}else{return this[_0xd8dc('0x3')](_0xd8dc('0xc'));}},'set':function(_0x11c801){if(Array[_0xd8dc('0xd')](_0x11c801)){this['setDataValue']('values',JSON[_0xd8dc('0xe')](_0x11c801));}else{this[_0xd8dc('0x6')]('values',_0x11c801);}}},'required':{'type':Sequelize[_0xd8dc('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd8dc('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd8dc('0x10')](_0xd8dc('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 11215d6..1682090 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 _0xd6ec=['CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','body','transaction','create','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','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','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x36686a,_0x33e734){var _0x8a8ff3=function(_0x2c3abb){while(--_0x2c3abb){_0x36686a['push'](_0x36686a['shift']());}};_0x8a8ff3(++_0x33e734);}(_0xd6ec,0x1df));var _0xcd6e=function(_0x598926,_0x2b2c85){_0x598926=_0x598926-0x0;var _0x1ffc63=_0xd6ec[_0x598926];return _0x1ffc63;};'use strict';var emlformat=require(_0xcd6e('0x0'));var rimraf=require(_0xcd6e('0x1'));var zipdir=require(_0xcd6e('0x2'));var jsonpatch=require(_0xcd6e('0x3'));var rp=require(_0xcd6e('0x4'));var moment=require('moment');var BPromise=require(_0xcd6e('0x5'));var Mustache=require(_0xcd6e('0x6'));var util=require(_0xcd6e('0x7'));var path=require(_0xcd6e('0x8'));var sox=require(_0xcd6e('0x9'));var csv=require(_0xcd6e('0xa'));var ejs=require(_0xcd6e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcd6e('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd6e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd6e('0xa'));var querystring=require(_0xcd6e('0xe'));var Papa=require(_0xcd6e('0xf'));var Redis=require(_0xcd6e('0x10'));var authService=require(_0xcd6e('0x11'));var qs=require(_0xcd6e('0x12'));var as=require(_0xcd6e('0x13'));var hardwareService=require(_0xcd6e('0x14'));var logger=require(_0xcd6e('0x15'))('api');var utils=require(_0xcd6e('0x16'));var config=require(_0xcd6e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2136ff,_0x44efab){_0x44efab=_0x44efab||0xcc;return function(_0x2874a6){if(_0x2874a6){return _0x2136ff[_0xcd6e('0x18')](_0x44efab);}return _0x2136ff[_0xcd6e('0x19')](_0x44efab)[_0xcd6e('0x1a')]();};}function respondWithResult(_0xc14523,_0x1db12f){_0x1db12f=_0x1db12f||0xc8;return function(_0x17a827){if(_0x17a827){return _0xc14523['status'](_0x1db12f)[_0xcd6e('0x1b')](_0x17a827);}};}function respondWithFilteredResult(_0x14692f,_0x54f7f6){return function(_0x552281){if(_0x552281){var _0x3b89fb=typeof _0x54f7f6[_0xcd6e('0x1c')]===_0xcd6e('0x1d')&&typeof _0x54f7f6[_0xcd6e('0x1e')]==='undefined';var _0x58bb31=_0x552281['count'];var _0x30cf5d=_0x3b89fb?0x0:_0x54f7f6['offset'];var _0x382ea4=_0x3b89fb?_0x552281[_0xcd6e('0x1f')]:_0x54f7f6['offset']+_0x54f7f6['limit'];var _0x2d93ad;if(_0x382ea4>=_0x58bb31){_0x382ea4=_0x58bb31;_0x2d93ad=0xc8;}else{_0x2d93ad=0xce;}_0x14692f[_0xcd6e('0x19')](_0x2d93ad);return _0x14692f[_0xcd6e('0x20')](_0xcd6e('0x21'),_0x30cf5d+'-'+_0x382ea4+'/'+_0x58bb31)[_0xcd6e('0x1b')](_0x552281);}return null;};}function patchUpdates(_0x50ffcf){return function(_0x40c775){try{jsonpatch['apply'](_0x40c775,_0x50ffcf,!![]);}catch(_0x4af569){return BPromise[_0xcd6e('0x22')](_0x4af569);}return _0x40c775[_0xcd6e('0x23')]();};}function saveUpdates(_0x4a6db7,_0x169900){return function(_0x311dcd){if(_0x311dcd){return _0x311dcd[_0xcd6e('0x24')](_0x4a6db7)[_0xcd6e('0x25')](function(_0x1e33f3){return _0x1e33f3;});}return null;};}function removeEntity(_0x56e1f7,_0x340fa6){return function(_0x5c51a0){if(_0x5c51a0){return _0x5c51a0[_0xcd6e('0x26')]()[_0xcd6e('0x25')](function(){_0x56e1f7[_0xcd6e('0x19')](0xcc)[_0xcd6e('0x1a')]();});}};}function handleEntityNotFound(_0x93be96,_0x5c598e){return function(_0x8b952){if(!_0x8b952){_0x93be96[_0xcd6e('0x18')](0x194);}return _0x8b952;};}function handleError(_0x17eb93,_0x54217f){_0x54217f=_0x54217f||0x1f4;return function(_0x40355b){logger[_0xcd6e('0x27')](_0x40355b[_0xcd6e('0x28')]);if(_0x40355b['name']){delete _0x40355b[_0xcd6e('0x29')];}_0x17eb93['status'](_0x54217f)[_0xcd6e('0x2a')](_0x40355b);};}exports['index']=function(_0x1ac729,_0x52a848){var _0x28a12f={},_0x12e7f0={},_0x5b17ef={'count':0x0,'rows':[]};var _0x438611=_['map'](db[_0xcd6e('0x2b')][_0xcd6e('0x2c')],function(_0x39042c){return{'name':_0x39042c[_0xcd6e('0x2d')],'type':_0x39042c[_0xcd6e('0x2e')][_0xcd6e('0x2f')]};});_0x12e7f0[_0xcd6e('0x30')]=_[_0xcd6e('0x31')](_[_0xcd6e('0x32')](_0x438611,_0xcd6e('0x29')),['name']);_0x12e7f0[_0xcd6e('0x33')]=_[_0xcd6e('0x34')](_0x1ac729[_0xcd6e('0x33')]);_0x12e7f0[_0xcd6e('0x35')]=_[_0xcd6e('0x36')](_0x12e7f0[_0xcd6e('0x30')],_0x12e7f0[_0xcd6e('0x33')]);_0x28a12f[_0xcd6e('0x37')]=_[_0xcd6e('0x36')](_0x12e7f0[_0xcd6e('0x30')],qs[_0xcd6e('0x38')](_0x1ac729['query'][_0xcd6e('0x38')]));_0x28a12f['attributes']=_0x28a12f['attributes'][_0xcd6e('0x39')]?_0x28a12f[_0xcd6e('0x37')]:_0x12e7f0['model'];if(!_0x1ac729[_0xcd6e('0x33')]['hasOwnProperty'](_0xcd6e('0x3a'))){_0x28a12f[_0xcd6e('0x1e')]=qs[_0xcd6e('0x1e')](_0x1ac729[_0xcd6e('0x33')][_0xcd6e('0x1e')]);_0x28a12f[_0xcd6e('0x1c')]=qs['offset'](_0x1ac729['query'][_0xcd6e('0x1c')]);}_0x28a12f['order']=qs[_0xcd6e('0x3b')](_0x1ac729[_0xcd6e('0x33')][_0xcd6e('0x3b')]);_0x28a12f[_0xcd6e('0x3c')]=qs[_0xcd6e('0x35')](_['pick'](_0x1ac729['query'],_0x12e7f0['filters']),_0x438611);if(_0x1ac729[_0xcd6e('0x33')]['filter']){_0x28a12f[_0xcd6e('0x3c')]=_[_0xcd6e('0x3d')](_0x28a12f[_0xcd6e('0x3c')],{'$or':_[_0xcd6e('0x32')](_0x438611,function(_0x751963){if(_0x751963['type']!==_0xcd6e('0x3e')){var _0x3b6b4f={};_0x3b6b4f[_0x751963[_0xcd6e('0x29')]]={'$like':'%'+_0x1ac729[_0xcd6e('0x33')][_0xcd6e('0x3f')]+'%'};return _0x3b6b4f;}})});}_0x28a12f=_['merge']({},_0x28a12f,_0x1ac729[_0xcd6e('0x40')]);var _0x5cf96a={'where':_0x28a12f['where']};return db[_0xcd6e('0x2b')][_0xcd6e('0x1f')](_0x5cf96a)[_0xcd6e('0x25')](function(_0x207cb0){_0x5b17ef[_0xcd6e('0x1f')]=_0x207cb0;if(_0x1ac729[_0xcd6e('0x33')][_0xcd6e('0x41')]){_0x28a12f['include']=[{'all':!![]}];}return db['CmCustomField'][_0xcd6e('0x42')](_0x28a12f);})[_0xcd6e('0x25')](function(_0x4f3b8a){_0x5b17ef[_0xcd6e('0x43')]=_0x4f3b8a;return _0x5b17ef;})['then'](respondWithFilteredResult(_0x52a848,_0x28a12f))[_0xcd6e('0x44')](handleError(_0x52a848,null));};exports['show']=function(_0x5865d6,_0x22a691){var _0x2195e9={'raw':!![],'where':{'id':_0x5865d6[_0xcd6e('0x45')]['id']}},_0xcca519={};_0xcca519[_0xcd6e('0x30')]=_[_0xcd6e('0x34')](db['CmCustomField'][_0xcd6e('0x2c')]);_0xcca519[_0xcd6e('0x33')]=_[_0xcd6e('0x34')](_0x5865d6[_0xcd6e('0x33')]);_0xcca519[_0xcd6e('0x35')]=_[_0xcd6e('0x36')](_0xcca519[_0xcd6e('0x30')],_0xcca519['query']);_0x2195e9[_0xcd6e('0x37')]=_[_0xcd6e('0x36')](_0xcca519[_0xcd6e('0x30')],qs[_0xcd6e('0x38')](_0x5865d6[_0xcd6e('0x33')][_0xcd6e('0x38')]));_0x2195e9[_0xcd6e('0x37')]=_0x2195e9['attributes'][_0xcd6e('0x39')]?_0x2195e9[_0xcd6e('0x37')]:_0xcca519[_0xcd6e('0x30')];if(_0x5865d6[_0xcd6e('0x33')][_0xcd6e('0x41')]){_0x2195e9[_0xcd6e('0x46')]=[{'all':!![]}];}_0x2195e9=_[_0xcd6e('0x3d')]({},_0x2195e9,_0x5865d6[_0xcd6e('0x40')]);return db['CmCustomField'][_0xcd6e('0x47')](_0x2195e9)[_0xcd6e('0x25')](handleEntityNotFound(_0x22a691,null))['then'](respondWithResult(_0x22a691,null))[_0xcd6e('0x44')](handleError(_0x22a691,null));};exports[_0xcd6e('0x24')]=function(_0x42de0e,_0x35733f){if(_0x42de0e[_0xcd6e('0x48')]['id']){delete _0x42de0e[_0xcd6e('0x48')]['id'];}return db[_0xcd6e('0x2b')][_0xcd6e('0x47')]({'where':{'id':_0x42de0e[_0xcd6e('0x45')]['id']}})[_0xcd6e('0x25')](handleEntityNotFound(_0x35733f,null))[_0xcd6e('0x25')](saveUpdates(_0x42de0e[_0xcd6e('0x48')],null))[_0xcd6e('0x25')](respondWithResult(_0x35733f,null))[_0xcd6e('0x44')](handleError(_0x35733f,null));};exports[_0xcd6e('0x26')]=function(_0x8952dc,_0x3a19e7){return db['CmCustomField'][_0xcd6e('0x47')]({'where':{'id':_0x8952dc[_0xcd6e('0x45')]['id']}})[_0xcd6e('0x25')](handleEntityNotFound(_0x3a19e7,null))['then'](removeEntity(_0x3a19e7,null))[_0xcd6e('0x44')](handleError(_0x3a19e7,null));};exports['create']=function(_0x26ce10,_0x5dcfbe){var _0x535528;return db['sequelize'][_0xcd6e('0x49')](function(_0x588a2b){return db[_0xcd6e('0x2b')][_0xcd6e('0x4a')](_0x26ce10[_0xcd6e('0x48')],{'transaction':_0x588a2b})['then'](function(_0x6b3587){_0x535528=_0x6b3587;var _0x3cfea2={'type':db[_0xcd6e('0x4b')]['TEXT'],'transaction':_0x588a2b};switch(_0x26ce10[_0xcd6e('0x48')][_0xcd6e('0x2e')]){case _0xcd6e('0x4c'):_0x3cfea2[_0xcd6e('0x2e')]=db[_0xcd6e('0x4b')][_0xcd6e('0x4d')];break;case _0xcd6e('0x4e'):_0x3cfea2[_0xcd6e('0x2e')]=db[_0xcd6e('0x4b')][_0xcd6e('0x4f')];break;case _0xcd6e('0x50'):_0x3cfea2[_0xcd6e('0x2e')]=db[_0xcd6e('0x4b')][_0xcd6e('0x51')];_0x3cfea2[_0xcd6e('0x52')]=![];break;default:}return db['sequelize'][_0xcd6e('0x53')][_0xcd6e('0x54')](_0xcd6e('0x55'),util['format'](_0xcd6e('0x56'),_0x535528['id']),_0x3cfea2);})[_0xcd6e('0x25')](function(){return _0x535528;});})[_0xcd6e('0x25')](respondWithResult(_0x5dcfbe,0xc9))['catch'](handleError(_0x5dcfbe,null));}; \ No newline at end of file +var _0xc3ed=['BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','type','differenceBy','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','CmCustomField','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch'];(function(_0x39e5f8,_0x2f12e5){var _0x459c35=function(_0x262c03){while(--_0x262c03){_0x39e5f8['push'](_0x39e5f8['shift']());}};_0x459c35(++_0x2f12e5);}(_0xc3ed,0x111));var _0xdc3e=function(_0x2c55b0,_0x3a32a3){_0x2c55b0=_0x2c55b0-0x0;var _0x24ea69=_0xc3ed[_0x2c55b0];return _0x24ea69;};'use strict';var emlformat=require(_0xdc3e('0x0'));var rimraf=require(_0xdc3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc3e('0x2'));var rp=require(_0xdc3e('0x3'));var moment=require(_0xdc3e('0x4'));var BPromise=require(_0xdc3e('0x5'));var Mustache=require(_0xdc3e('0x6'));var util=require('util');var path=require(_0xdc3e('0x7'));var sox=require('sox');var csv=require(_0xdc3e('0x8'));var ejs=require(_0xdc3e('0x9'));var fs=require('fs');var fs_extra=require(_0xdc3e('0xa'));var _=require(_0xdc3e('0xb'));var squel=require(_0xdc3e('0xc'));var crypto=require(_0xdc3e('0xd'));var jsforce=require(_0xdc3e('0xe'));var deskjs=require(_0xdc3e('0xf'));var toCsv=require(_0xdc3e('0x8'));var querystring=require(_0xdc3e('0x10'));var Papa=require(_0xdc3e('0x11'));var Redis=require(_0xdc3e('0x12'));var authService=require(_0xdc3e('0x13'));var qs=require(_0xdc3e('0x14'));var as=require(_0xdc3e('0x15'));var hardwareService=require(_0xdc3e('0x16'));var logger=require(_0xdc3e('0x17'))('api');var utils=require(_0xdc3e('0x18'));var config=require(_0xdc3e('0x19'));var licenseUtil=require(_0xdc3e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e4af6,_0x5befb6){_0x5befb6=_0x5befb6||0xcc;return function(_0x909deb){if(_0x909deb){return _0x2e4af6[_0xdc3e('0x1b')](_0x5befb6);}return _0x2e4af6['status'](_0x5befb6)['end']();};}function respondWithResult(_0x17da85,_0x4f9adb){_0x4f9adb=_0x4f9adb||0xc8;return function(_0x15133e){if(_0x15133e){return _0x17da85[_0xdc3e('0x1c')](_0x4f9adb)[_0xdc3e('0x1d')](_0x15133e);}};}function respondWithFilteredResult(_0x48a33f,_0x2b2f16){return function(_0x2c7396){if(_0x2c7396){var _0x384c96=typeof _0x2b2f16[_0xdc3e('0x1e')]==='undefined'&&typeof _0x2b2f16[_0xdc3e('0x1f')]===_0xdc3e('0x20');var _0x2175b2=_0x2c7396[_0xdc3e('0x21')];var _0x4d1136=_0x384c96?0x0:_0x2b2f16[_0xdc3e('0x1e')];var _0x1a0890=_0x384c96?_0x2c7396[_0xdc3e('0x21')]:_0x2b2f16[_0xdc3e('0x1e')]+_0x2b2f16[_0xdc3e('0x1f')];var _0x44b62f;if(_0x1a0890>=_0x2175b2){_0x1a0890=_0x2175b2;_0x44b62f=0xc8;}else{_0x44b62f=0xce;}_0x48a33f[_0xdc3e('0x1c')](_0x44b62f);return _0x48a33f[_0xdc3e('0x22')](_0xdc3e('0x23'),_0x4d1136+'-'+_0x1a0890+'/'+_0x2175b2)[_0xdc3e('0x1d')](_0x2c7396);}return null;};}function patchUpdates(_0x7b4ee){return function(_0x37f6be){try{jsonpatch[_0xdc3e('0x24')](_0x37f6be,_0x7b4ee,!![]);}catch(_0x18afb5){return BPromise['reject'](_0x18afb5);}return _0x37f6be[_0xdc3e('0x25')]();};}function saveUpdates(_0x55cb33,_0x2ae1e3){return function(_0x4f0a23){if(_0x4f0a23){return _0x4f0a23['update'](_0x55cb33)[_0xdc3e('0x26')](function(_0x34f5f2){return _0x34f5f2;});}return null;};}function removeEntity(_0x58ac4a,_0x31bb6a){return function(_0x2116b4){if(_0x2116b4){return _0x2116b4[_0xdc3e('0x27')]()[_0xdc3e('0x26')](function(){_0x58ac4a[_0xdc3e('0x1c')](0xcc)[_0xdc3e('0x28')]();});}};}function handleEntityNotFound(_0x5d597f,_0xd5e163){return function(_0x4e2e98){if(!_0x4e2e98){_0x5d597f[_0xdc3e('0x1b')](0x194);}return _0x4e2e98;};}function handleError(_0x1c95ca,_0x44cc9c){_0x44cc9c=_0x44cc9c||0x1f4;return function(_0x519a09){logger[_0xdc3e('0x29')](_0x519a09[_0xdc3e('0x2a')]);if(_0x519a09[_0xdc3e('0x2b')]){delete _0x519a09[_0xdc3e('0x2b')];}_0x1c95ca['status'](_0x44cc9c)[_0xdc3e('0x2c')](_0x519a09);};}exports['index']=function(_0x489b18,_0x2ff2c0){var _0x3d1e1f={},_0x1168bb={},_0x232e54={'count':0x0,'rows':[]};var _0x2f47c7=_['map'](db['CmCustomField'][_0xdc3e('0x2d')],function(_0x282bae){return{'name':_0x282bae[_0xdc3e('0x2e')],'type':_0x282bae[_0xdc3e('0x2f')]['key']};});_0x1168bb['model']=_[_0xdc3e('0x30')](_[_0xdc3e('0x31')](_0x2f47c7,_0xdc3e('0x2b')),[_0xdc3e('0x2b')]);_0x1168bb[_0xdc3e('0x32')]=_[_0xdc3e('0x33')](_0x489b18[_0xdc3e('0x32')]);_0x1168bb[_0xdc3e('0x34')]=_[_0xdc3e('0x35')](_0x1168bb[_0xdc3e('0x36')],_0x1168bb[_0xdc3e('0x32')]);_0x3d1e1f['attributes']=_[_0xdc3e('0x35')](_0x1168bb['model'],qs[_0xdc3e('0x37')](_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x37')]));_0x3d1e1f[_0xdc3e('0x38')]=_0x3d1e1f[_0xdc3e('0x38')][_0xdc3e('0x39')]?_0x3d1e1f[_0xdc3e('0x38')]:_0x1168bb['model'];if(!_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x3a')](_0xdc3e('0x3b'))){_0x3d1e1f[_0xdc3e('0x1f')]=qs[_0xdc3e('0x1f')](_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x1f')]);_0x3d1e1f[_0xdc3e('0x1e')]=qs[_0xdc3e('0x1e')](_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x1e')]);}_0x3d1e1f[_0xdc3e('0x3c')]=qs[_0xdc3e('0x3d')](_0x489b18['query'][_0xdc3e('0x3d')]);_0x3d1e1f[_0xdc3e('0x3e')]=qs[_0xdc3e('0x34')](_[_0xdc3e('0x3f')](_0x489b18[_0xdc3e('0x32')],_0x1168bb[_0xdc3e('0x34')]),_0x2f47c7);if(_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x40')]){_0x3d1e1f[_0xdc3e('0x3e')]=_['merge'](_0x3d1e1f[_0xdc3e('0x3e')],{'$or':_[_0xdc3e('0x31')](_0x2f47c7,function(_0x399858){if(_0x399858[_0xdc3e('0x2f')]!=='VIRTUAL'){var _0xd6e0a1={};_0xd6e0a1[_0x399858[_0xdc3e('0x2b')]]={'$like':'%'+_0x489b18[_0xdc3e('0x32')][_0xdc3e('0x40')]+'%'};return _0xd6e0a1;}})});}_0x3d1e1f=_[_0xdc3e('0x41')]({},_0x3d1e1f,_0x489b18[_0xdc3e('0x42')]);var _0x33351b={'where':_0x3d1e1f[_0xdc3e('0x3e')]};return db['CmCustomField'][_0xdc3e('0x21')](_0x33351b)[_0xdc3e('0x26')](function(_0xd84d34){_0x232e54[_0xdc3e('0x21')]=_0xd84d34;if(_0x489b18['query']['includeAll']){_0x3d1e1f[_0xdc3e('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x3d1e1f);})[_0xdc3e('0x26')](function(_0x423772){_0x232e54[_0xdc3e('0x44')]=_0x423772;return _0x232e54;})[_0xdc3e('0x26')](respondWithFilteredResult(_0x2ff2c0,_0x3d1e1f))[_0xdc3e('0x45')](handleError(_0x2ff2c0,null));};exports[_0xdc3e('0x46')]=function(_0x6b669f,_0x3145d1){var _0x563784={'raw':!![],'where':{'id':_0x6b669f[_0xdc3e('0x47')]['id']}},_0xc87f78={};_0xc87f78['model']=_['keys'](db[_0xdc3e('0x48')]['rawAttributes']);_0xc87f78[_0xdc3e('0x32')]=_[_0xdc3e('0x33')](_0x6b669f[_0xdc3e('0x32')]);_0xc87f78['filters']=_['intersection'](_0xc87f78[_0xdc3e('0x36')],_0xc87f78[_0xdc3e('0x32')]);_0x563784[_0xdc3e('0x38')]=_['intersection'](_0xc87f78['model'],qs['fields'](_0x6b669f[_0xdc3e('0x32')]['fields']));_0x563784['attributes']=_0x563784[_0xdc3e('0x38')][_0xdc3e('0x39')]?_0x563784[_0xdc3e('0x38')]:_0xc87f78['model'];if(_0x6b669f[_0xdc3e('0x32')]['includeAll']){_0x563784[_0xdc3e('0x43')]=[{'all':!![]}];}_0x563784=_[_0xdc3e('0x41')]({},_0x563784,_0x6b669f[_0xdc3e('0x42')]);return db[_0xdc3e('0x48')][_0xdc3e('0x49')](_0x563784)[_0xdc3e('0x26')](handleEntityNotFound(_0x3145d1,null))[_0xdc3e('0x26')](respondWithResult(_0x3145d1,null))[_0xdc3e('0x45')](handleError(_0x3145d1,null));};exports['update']=function(_0x1c5268,_0x18a7ca){if(_0x1c5268[_0xdc3e('0x4a')]['id']){delete _0x1c5268[_0xdc3e('0x4a')]['id'];}return db[_0xdc3e('0x48')]['find']({'where':{'id':_0x1c5268[_0xdc3e('0x47')]['id']}})[_0xdc3e('0x26')](handleEntityNotFound(_0x18a7ca,null))['then'](saveUpdates(_0x1c5268['body'],null))[_0xdc3e('0x26')](respondWithResult(_0x18a7ca,null))[_0xdc3e('0x45')](handleError(_0x18a7ca,null));};exports[_0xdc3e('0x27')]=function(_0x4716d2,_0x2a6a46){return db[_0xdc3e('0x48')][_0xdc3e('0x49')]({'where':{'id':_0x4716d2['params']['id']}})[_0xdc3e('0x26')](handleEntityNotFound(_0x2a6a46,null))['then'](removeEntity(_0x2a6a46,null))[_0xdc3e('0x45')](handleError(_0x2a6a46,null));};exports[_0xdc3e('0x4b')]=function(_0x42b1dd,_0x287a64){var _0x18f3db;return db[_0xdc3e('0x4c')][_0xdc3e('0x4d')](function(_0x4552de){return db['CmCustomField'][_0xdc3e('0x4b')](_0x42b1dd[_0xdc3e('0x4a')],{'transaction':_0x4552de})[_0xdc3e('0x26')](function(_0x4ce97e){_0x18f3db=_0x4ce97e;var _0x2ac0d7={'type':db[_0xdc3e('0x4e')][_0xdc3e('0x4f')],'transaction':_0x4552de};switch(_0x42b1dd[_0xdc3e('0x4a')][_0xdc3e('0x2f')]){case'text':_0x2ac0d7[_0xdc3e('0x2f')]=db[_0xdc3e('0x4e')][_0xdc3e('0x4f')];break;case _0xdc3e('0x50'):_0x2ac0d7[_0xdc3e('0x2f')]=db[_0xdc3e('0x4e')][_0xdc3e('0x51')];break;case _0xdc3e('0x52'):_0x2ac0d7[_0xdc3e('0x2f')]=db[_0xdc3e('0x4e')][_0xdc3e('0x53')];_0x2ac0d7[_0xdc3e('0x54')]=![];break;default:}return db[_0xdc3e('0x4c')][_0xdc3e('0x55')][_0xdc3e('0x56')]('cm_contacts',util[_0xdc3e('0x57')](_0xdc3e('0x58'),_0x18f3db['id']),_0x2ac0d7);})['then'](function(){return _0x18f3db;});})[_0xdc3e('0x26')](respondWithResult(_0x287a64,0xc9))['catch'](handleError(_0x287a64,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7a67b02..bc68434 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 _0x76c5=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x2366a7,_0x2cd559){var _0x523e4b=function(_0x39bdb7){while(--_0x39bdb7){_0x2366a7['push'](_0x2366a7['shift']());}};_0x523e4b(++_0x2cd559);}(_0x76c5,0x14d));var _0x576c=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x76c5[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x576c('0x0'));var util=require(_0x576c('0x1'));var logger=require(_0x576c('0x2'))('api');var moment=require(_0x576c('0x3'));var BPromise=require(_0x576c('0x4'));var rp=require(_0x576c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x576c('0x6'));var config=require(_0x576c('0x7'));var attributes=require(_0x576c('0x8'));module[_0x576c('0x9')]=function(_0x2b1878,_0x53f63d){return _0x2b1878['define'](_0x576c('0xa'),attributes,{'tableName':_0x576c('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad56=['define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x5908b8,_0x544699){var _0xe24a76=function(_0x2bd33f){while(--_0x2bd33f){_0x5908b8['push'](_0x5908b8['shift']());}};_0xe24a76(++_0x544699);}(_0xad56,0xea));var _0x6ad5=function(_0x2e7165,_0x40cd42){_0x2e7165=_0x2e7165-0x0;var _0x44f8cd=_0xad56[_0x2e7165];return _0x44f8cd;};'use strict';var _=require(_0x6ad5('0x0'));var util=require('util');var logger=require(_0x6ad5('0x1'))(_0x6ad5('0x2'));var moment=require(_0x6ad5('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ad5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ad5('0x5'));var config=require(_0x6ad5('0x6'));var attributes=require(_0x6ad5('0x7'));module['exports']=function(_0x3d2354,_0x493a42){return _0x3d2354[_0x6ad5('0x8')](_0x6ad5('0x9'),attributes,{'tableName':_0x6ad5('0xa'),'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 f661dd4..e81486b 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 _0x9e0c=['moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x40f09a,_0x3743b6){var _0x2eb96c=function(_0xe6203d){while(--_0xe6203d){_0x40f09a['push'](_0x40f09a['shift']());}};_0x2eb96c(++_0x3743b6);}(_0x9e0c,0x155));var _0xc9e0=function(_0xee07d6,_0x1d6cf1){_0xee07d6=_0xee07d6-0x0;var _0x5bbb1b=_0x9e0c[_0xee07d6];return _0x5bbb1b;};'use strict';var _=require('lodash');var util=require(_0xc9e0('0x0'));var moment=require(_0xc9e0('0x1'));var BPromise=require(_0xc9e0('0x2'));var rs=require(_0xc9e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9e0('0x4'));var logger=require(_0xc9e0('0x5'))('rpc');var config=require(_0xc9e0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc9e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23a87e,_0x3a7294,_0x1436c3){return new BPromise(function(_0x223cbc,_0x470637){return client['request'](_0x23a87e,_0x1436c3)[_0xc9e0('0x8')](function(_0x2a5126){logger[_0xc9e0('0x9')](_0xc9e0('0xa'),_0x3a7294,'request\x20sent');logger[_0xc9e0('0xb')](_0xc9e0('0xc'),_0x3a7294,_0xc9e0('0xd'),JSON[_0xc9e0('0xe')](_0x2a5126));if(_0x2a5126[_0xc9e0('0xf')]){if(_0x2a5126['error'][_0xc9e0('0x10')]===0x1f4){logger['error'](_0xc9e0('0xa'),_0x3a7294,_0x2a5126['error'][_0xc9e0('0x11')]);return _0x470637(_0x2a5126[_0xc9e0('0xf')][_0xc9e0('0x11')]);}logger[_0xc9e0('0xf')](_0xc9e0('0xa'),_0x3a7294,_0x2a5126[_0xc9e0('0xf')]['message']);return _0x223cbc(_0x2a5126[_0xc9e0('0xf')][_0xc9e0('0x11')]);}else{logger[_0xc9e0('0x9')](_0xc9e0('0xa'),_0x3a7294,_0xc9e0('0xd'));_0x223cbc(_0x2a5126[_0xc9e0('0x12')][_0xc9e0('0x11')]);}})['catch'](function(_0x9c6959){logger[_0xc9e0('0xf')](_0xc9e0('0xa'),_0x3a7294,_0x9c6959);_0x470637(_0x9c6959);});});} \ No newline at end of file +var _0x9bc9=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x4fd791,_0x180648){var _0x30c89e=function(_0x2b1edd){while(--_0x2b1edd){_0x4fd791['push'](_0x4fd791['shift']());}};_0x30c89e(++_0x180648);}(_0x9bc9,0x8c));var _0x99bc=function(_0x722c77,_0x2546f3){_0x722c77=_0x722c77-0x0;var _0x10c8b1=_0x9bc9[_0x722c77];return _0x10c8b1;};'use strict';var _=require('lodash');var util=require(_0x99bc('0x0'));var moment=require(_0x99bc('0x1'));var BPromise=require(_0x99bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99bc('0x3'));var db=require(_0x99bc('0x4'))['db'];var utils=require(_0x99bc('0x5'));var logger=require(_0x99bc('0x6'))('rpc');var config=require(_0x99bc('0x7'));var jayson=require(_0x99bc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ac38e,_0x5aca3a,_0x41d01f){return new BPromise(function(_0x19f5c2,_0x3e25a1){return client[_0x99bc('0x9')](_0x5ac38e,_0x41d01f)['then'](function(_0x56fdfd){logger['info']('CmCustomField,\x20%s,\x20%s',_0x5aca3a,_0x99bc('0xa'));logger[_0x99bc('0xb')](_0x99bc('0xc'),_0x5aca3a,_0x99bc('0xa'),JSON['stringify'](_0x56fdfd));if(_0x56fdfd[_0x99bc('0xd')]){if(_0x56fdfd[_0x99bc('0xd')][_0x99bc('0xe')]===0x1f4){logger[_0x99bc('0xd')](_0x99bc('0xf'),_0x5aca3a,_0x56fdfd[_0x99bc('0xd')][_0x99bc('0x10')]);return _0x3e25a1(_0x56fdfd['error'][_0x99bc('0x10')]);}logger['error'](_0x99bc('0xf'),_0x5aca3a,_0x56fdfd[_0x99bc('0xd')][_0x99bc('0x10')]);return _0x19f5c2(_0x56fdfd[_0x99bc('0xd')]['message']);}else{logger[_0x99bc('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5aca3a,'request\x20sent');_0x19f5c2(_0x56fdfd[_0x99bc('0x12')][_0x99bc('0x10')]);}})[_0x99bc('0x13')](function(_0x17c08c){logger['error']('CmCustomField,\x20%s,\x20%s',_0x5aca3a,_0x17c08c);_0x3e25a1(_0x17c08c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 57021d6..9a25cbf 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 _0x99e8=['create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5b09de,_0x197c25){var _0x1d5a64=function(_0x575379){while(--_0x575379){_0x5b09de['push'](_0x5b09de['shift']());}};_0x1d5a64(++_0x197c25);}(_0x99e8,0x148));var _0x899e=function(_0x494650,_0x5c2d27){_0x494650=_0x494650-0x0;var _0x59b12d=_0x99e8[_0x494650];return _0x59b12d;};'use strict';var multer=require('multer');var util=require(_0x899e('0x0'));var path=require('path');var timeout=require(_0x899e('0x1'));var express=require(_0x899e('0x2'));var router=express[_0x899e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x899e('0x4'));var interaction=require(_0x899e('0x5'));var config=require(_0x899e('0x6'));var controller=require(_0x899e('0x7'));router[_0x899e('0x8')]('/',auth[_0x899e('0x9')](),controller[_0x899e('0xa')]);router[_0x899e('0x8')](_0x899e('0xb'),auth[_0x899e('0x9')](),controller[_0x899e('0xc')]);router[_0x899e('0xd')]('/',auth[_0x899e('0x9')](),controller[_0x899e('0xe')]);router['put']('/:id',auth[_0x899e('0x9')](),controller[_0x899e('0xf')]);router[_0x899e('0x10')](_0x899e('0xb'),auth[_0x899e('0x9')](),controller[_0x899e('0x11')]);module[_0x899e('0x12')]=router; \ No newline at end of file +var _0x96aa=['get','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index'];(function(_0x385eee,_0x270cca){var _0x41fd49=function(_0x6bb501){while(--_0x6bb501){_0x385eee['push'](_0x385eee['shift']());}};_0x41fd49(++_0x270cca);}(_0x96aa,0x67));var _0xa96a=function(_0x12b597,_0x26c23a){_0x12b597=_0x12b597-0x0;var _0x3ebc89=_0x96aa[_0x12b597];return _0x3ebc89;};'use strict';var multer=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var path=require('path');var timeout=require(_0xa96a('0x2'));var express=require(_0xa96a('0x3'));var router=express[_0xa96a('0x4')]();var fs_extra=require(_0xa96a('0x5'));var auth=require(_0xa96a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa96a('0x7'));var controller=require(_0xa96a('0x8'));router['get']('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xa')]);router[_0xa96a('0xb')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xd')]);router[_0xa96a('0xe')]('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xf')]);router[_0xa96a('0x10')](_0xa96a('0xc'),auth['isAuthenticated'](),controller[_0xa96a('0x11')]);router['delete'](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller['destroy']);module[_0xa96a('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 80477de..21cd32e 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 _0xd8c3=['contactListQueue','moment','exports','BOOLEAN','DATE','format','INTEGER','STRING','UNSIGNED'];(function(_0x71d56f,_0x243e52){var _0x359ccf=function(_0x270822){while(--_0x270822){_0x71d56f['push'](_0x71d56f['shift']());}};_0x359ccf(++_0x243e52);}(_0xd8c3,0xfd));var _0x3d8c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd8c3[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0x3d8c('0x0'));var Sequelize=require('sequelize');module[_0x3d8c('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3d8c('0x3')],'defaultValue':moment()[_0x3d8c('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x3d8c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3d8c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3d8c('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3d8c('0x3')]},'priority':{'type':Sequelize[_0x3d8c('0x5')](0x2)[_0x3d8c('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3d8c('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3d8c('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x3d8c('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x3d8c('0x8')},'CampaignId':{'type':Sequelize[_0x3d8c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3d8c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3d8c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3d8c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3d8c('0x6')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x557c=['UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3cde8e,_0x3ccd85){var _0x1ff684=function(_0x342315){while(--_0x342315){_0x3cde8e['push'](_0x3cde8e['shift']());}};_0x1ff684(++_0x3ccd85);}(_0x557c,0xfc));var _0xc557=function(_0x9117ad,_0x386be4){_0x9117ad=_0x9117ad-0x0;var _0x540f0c=_0x557c[_0x9117ad];return _0x540f0c;};'use strict';var moment=require('moment');var Sequelize=require(_0xc557('0x0'));module[_0xc557('0x1')]={'phone':{'type':Sequelize[_0xc557('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc557('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc557('0x4')],'defaultValue':moment()[_0xc557('0x5')](_0xc557('0x6'))},'countbusyretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc557('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc557('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc557('0x4')]},'priority':{'type':Sequelize[_0xc557('0x7')](0x2)[_0xc557('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc557('0x7')],'unique':_0xc557('0x9')},'ListId':{'type':Sequelize[_0xc557('0x7')],'unique':_0xc557('0x9')},'UserId':{'type':Sequelize[_0xc557('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xc557('0x7')],'unique':_0xc557('0x9')},'CampaignId':{'type':Sequelize[_0xc557('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc557('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc557('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc557('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc557('0x4')],'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 7be8b84..ae3db9c 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 _0x4944=['keys','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$between','$in','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','getPreviewRecall','recallme','LOCK','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','update','sendStatus','error','name','CmHopper','rawAttributes','type','key','model','map','query'];(function(_0x50718c,_0x1fe536){var _0x1d920d=function(_0x32c836){while(--_0x32c836){_0x50718c['push'](_0x50718c['shift']());}};_0x1d920d(++_0x1fe536);}(_0x4944,0x6d));var _0x4494=function(_0x316613,_0x1f56d3){_0x316613=_0x316613-0x0;var _0x240205=_0x4944[_0x316613];return _0x240205;};'use strict';var moment=require(_0x4494('0x0'));var _=require('lodash');var qs=require(_0x4494('0x1'));var logger=require(_0x4494('0x2'))(_0x4494('0x3'));var shared=require(_0x4494('0x4'));var db=require(_0x4494('0x5'))['db'];function respondWithResult(_0x5074d9,_0x187098){_0x187098=_0x187098||0xc8;return function(_0x5c7492){if(_0x5c7492){return _0x5074d9[_0x4494('0x6')](_0x187098)[_0x4494('0x7')](_0x5c7492);}};}function respondWithFilteredResult(_0x38480d,_0xb94d02){return function(_0x2a4911){if(_0x2a4911){var _0x1a94d6=typeof _0xb94d02[_0x4494('0x8')]===_0x4494('0x9')&&typeof _0xb94d02[_0x4494('0xa')]==='undefined';var _0x1b6476=_0x2a4911[_0x4494('0xb')];var _0x461525=_0x1a94d6?0x0:_0xb94d02[_0x4494('0x8')];var _0x4acf68=_0x1a94d6?_0x2a4911['count']:_0xb94d02[_0x4494('0x8')]+_0xb94d02[_0x4494('0xa')];var _0xec70eb;if(_0x4acf68>=_0x1b6476){_0x4acf68=_0x1b6476;_0xec70eb=0xc8;}else{_0xec70eb=0xce;}_0x38480d['status'](_0xec70eb);return _0x38480d['set'](_0x4494('0xc'),_0x461525+'-'+_0x4acf68+'/'+_0x1b6476)[_0x4494('0x7')](_0x2a4911);}return null;};}function saveUpdates(_0x221a1d,_0x1c9750){return function(_0x40ee8d){if(_0x40ee8d){return _0x40ee8d[_0x4494('0xd')](_0x221a1d)['then'](function(_0x34959d){return _0x34959d;});}return null;};}function handleEntityNotFound(_0x2325f4,_0x45825c){return function(_0x259e03){if(!_0x259e03){_0x2325f4[_0x4494('0xe')](0x194);}return _0x259e03;};}function handleError(_0x8506a0,_0x3847d6){_0x3847d6=_0x3847d6||0x1f4;return function(_0x53fed5){logger[_0x4494('0xf')](_0x53fed5['stack']);if(_0x53fed5['name']){delete _0x53fed5[_0x4494('0x10')];}_0x8506a0[_0x4494('0x6')](_0x3847d6)['send'](_0x53fed5);};}exports['index']=function(_0xcbe5a4,_0x574fbb){var _0x4655ce={},_0x42880b={},_0x507339={'count':0x0,'rows':[]};var _0x22ed31=_['map'](db[_0x4494('0x11')][_0x4494('0x12')],function(_0x5bedb6){return{'name':_0x5bedb6['fieldName'],'type':_0x5bedb6[_0x4494('0x13')][_0x4494('0x14')]};});_0x42880b[_0x4494('0x15')]=_[_0x4494('0x16')](_0x22ed31,_0x4494('0x10'));_0x42880b[_0x4494('0x17')]=_[_0x4494('0x18')](_0xcbe5a4[_0x4494('0x17')]);_0x42880b['filters']=_['intersection'](_0x42880b['model'],_0x42880b['query']);_0x42880b[_0x4494('0x19')]=_[_0x4494('0x1a')](_0x42880b[_0x4494('0x19')],[_0x4494('0x1b'),'$or',_0x4494('0x1c'),_0x4494('0x1d'),'$lt',_0x4494('0x1e'),_0x4494('0x1f'),_0x4494('0x20'),'$not',_0x4494('0x21'),'$notBetween',_0x4494('0x22'),'$notIn',_0x4494('0x23'),_0x4494('0x24'),_0x4494('0x25'),'$notILike',_0x4494('0x23'),_0x4494('0x26'),'$contains',_0x4494('0x27'),_0x4494('0x28')]);_0x4655ce[_0x4494('0x29')]=_['intersection'](_0x42880b[_0x4494('0x15')],qs[_0x4494('0x2a')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2a')]));_0x4655ce[_0x4494('0x29')]=_0x4655ce[_0x4494('0x29')][_0x4494('0x2b')]?_0x4655ce[_0x4494('0x29')]:_0x42880b['model'];if(!_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2c')](_0x4494('0x2d'))){_0x4655ce['limit']=qs[_0x4494('0xa')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0xa')]);_0x4655ce[_0x4494('0x8')]=qs[_0x4494('0x8')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x8')]);}_0x4655ce['order']=qs[_0x4494('0x2e')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2e')]);_0x4655ce[_0x4494('0x2f')]=qs[_0x4494('0x19')](_[_0x4494('0x30')](_0xcbe5a4['query'],_0x42880b[_0x4494('0x19')]),_0x22ed31);if(_0xcbe5a4[_0x4494('0x17')][_0x4494('0x31')]){_0x4655ce[_0x4494('0x2f')]=_[_0x4494('0x32')](_0x4655ce['where'],{'$or':_[_0x4494('0x16')](_0x22ed31,function(_0x4dbe69){if(_0x4dbe69['type']!==_0x4494('0x33')){var _0x49a5c6={};_0x49a5c6[_0x4dbe69['name']]={'$like':'%'+_0xcbe5a4['query'][_0x4494('0x31')]+'%'};return _0x49a5c6;}})});}_0x4655ce=_[_0x4494('0x32')]({},_0x4655ce,_0xcbe5a4[_0x4494('0x34')]);var _0x546133={'where':_0x4655ce['where']};return db[_0x4494('0x11')][_0x4494('0xb')](_0x546133)[_0x4494('0x35')](function(_0x166d29){_0x507339[_0x4494('0xb')]=_0x166d29;if(_0xcbe5a4[_0x4494('0x17')][_0x4494('0x36')]){_0x4655ce[_0x4494('0x37')]=[{'all':!![]}];}return db[_0x4494('0x11')][_0x4494('0x38')](_0x4655ce);})[_0x4494('0x35')](function(_0x14542e){_0x507339[_0x4494('0x39')]=_0x14542e;return _0x507339;})['then'](respondWithFilteredResult(_0x574fbb,_0x4655ce))[_0x4494('0x3a')](handleError(_0x574fbb,null));};exports[_0x4494('0x3b')]=function(_0xdb7757,_0x3bfea6){var _0x20b267={'raw':!![],'where':{'id':_0xdb7757[_0x4494('0x3c')]['id']}},_0x3cd671={};_0x3cd671[_0x4494('0x15')]=_[_0x4494('0x18')](db['CmHopper']['rawAttributes']);_0x3cd671[_0x4494('0x17')]=_['keys'](_0xdb7757[_0x4494('0x17')]);_0x3cd671[_0x4494('0x19')]=_[_0x4494('0x3d')](_0x3cd671[_0x4494('0x15')],_0x3cd671[_0x4494('0x17')]);_0x20b267['attributes']=_['intersection'](_0x3cd671[_0x4494('0x15')],qs['fields'](_0xdb7757[_0x4494('0x17')][_0x4494('0x2a')]));_0x20b267[_0x4494('0x29')]=_0x20b267[_0x4494('0x29')][_0x4494('0x2b')]?_0x20b267[_0x4494('0x29')]:_0x3cd671[_0x4494('0x15')];if(_0xdb7757['query'][_0x4494('0x36')]){_0x20b267[_0x4494('0x37')]=[{'all':!![]}];}_0x20b267=_['merge']({},_0x20b267,_0xdb7757[_0x4494('0x34')]);return db[_0x4494('0x11')][_0x4494('0x3e')](_0x20b267)['then'](handleEntityNotFound(_0x3bfea6,null))[_0x4494('0x35')](respondWithResult(_0x3bfea6,null))[_0x4494('0x3a')](handleError(_0x3bfea6,null));};exports[_0x4494('0x3f')]=function(_0x465f5e,_0x543787){return db['CmHopper'][_0x4494('0x3f')](_0x465f5e[_0x4494('0x40')],{})[_0x4494('0x35')](respondWithResult(_0x543787,0xc9))['catch'](handleError(_0x543787,null));};exports['update']=function(_0x3717ae,_0x79e98c){if(_0x3717ae[_0x4494('0x40')]['id']){delete _0x3717ae['body']['id'];}return db[_0x4494('0x11')][_0x4494('0x3e')]({'where':{'id':_0x3717ae['params']['id']}})[_0x4494('0x35')](handleEntityNotFound(_0x79e98c,null))[_0x4494('0x35')](saveUpdates(_0x3717ae[_0x4494('0x40')],null))[_0x4494('0x35')](respondWithResult(_0x79e98c,null))[_0x4494('0x3a')](handleError(_0x79e98c,null));};exports['describe']=function(_0x802d47,_0x3c5475){return db[_0x4494('0x11')][_0x4494('0x41')]()[_0x4494('0x35')](respondWithResult(_0x3c5475,null))[_0x4494('0x3a')](handleError(_0x3c5475,null));};exports[_0x4494('0x42')]=function(_0x904f3,_0x102010){var _0x157e7c;var _0x4a2d84=_0x904f3[_0x4494('0x3c')]['id'];return db['CmHopper'][_0x4494('0x3e')]({'where':{'id':_0x904f3[_0x4494('0x3c')]['id']}})[_0x4494('0x35')](handleEntityNotFound(_0x102010,null))[_0x4494('0x35')](function(_0x473b00){if(_0x473b00){return _0x473b00['destroy']()[_0x4494('0x35')](function(_0x4eb660){return _0x4eb660;});}})['then'](function(_0x584373){_0x157e7c=_0x584373;if(_0x584373){if(_0x584373['VoiceQueueId']||_0x584373['CampaignId']){return db[_0x584373[_0x4494('0x43')]?_0x4494('0x44'):_0x4494('0x45')][_0x4494('0x3e')]({'where':{'id':_0x584373[_0x4494('0x43')]?_0x584373[_0x4494('0x43')]:_0x584373[_0x4494('0x46')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x49e0d2){var _0x3ad850={};if(_0x49e0d2){_[_0x4494('0x32')](_0x3ad850,_['omit'](_0x157e7c[_0x4494('0x47')],[_0x4494('0x48'),_0x4494('0x49'),'id']));_0x3ad850[_0x4494('0x4a')]=0x15;_0x3ad850[_0x4494('0x4b')]='deleted';_0x3ad850[_0x4494('0x4c')]=_0x49e0d2['name'];_0x3ad850['membername']=_0x904f3[_0x4494('0x4d')]['name'];_0x3ad850[_0x4494('0x4e')]=_0x904f3[_0x4494('0x4d')]['id'];_0x3ad850['deleted']=!![];_0x3ad850['deletedat']=moment()[_0x4494('0x4f')](_0x4494('0x50'));_0x3ad850[_0x4494('0x51')]=_0x157e7c['phone'];_0x3ad850[_0x4494('0x52')]=_0x157e7c[_0x4494('0x43')]?_0x4494('0x53'):_0x4494('0x54');return db[_0x4494('0x55')][_0x4494('0x3e')]({'where':{'id':_0x3ad850['ContactId']},'attributes':['firstName',_0x4494('0x56')]})['then'](function(_0x1d84fe){if(!_[_0x4494('0x57')](_0x102010)&&!_[_0x4494('0x57')](_0x1d84fe['firstName'])){_0x3ad850['calleridname']=_0x1d84fe[_0x4494('0x58')];if(!_[_0x4494('0x57')](_0x1d84fe[_0x4494('0x56')])){_0x3ad850[_0x4494('0x59')]+='\x20'+_0x1d84fe[_0x4494('0x56')];}}})[_0x4494('0x5a')](function(){return db[_0x4494('0x5b')]['create'](_0x3ad850);});}})[_0x4494('0x35')](function(_0x17721d){return db['CmHopperAdditionalPhone'][_0x4494('0x42')]({'where':{'CmHopperId':_0x4a2d84}});})[_0x4494('0x35')](function(){return _0x102010[_0x4494('0x6')](0xcc)[_0x4494('0x5c')]();})[_0x4494('0x3a')](handleError(_0x102010,null));};exports[_0x4494('0x5d')]=function(_0x6a9289,_0x43583a){var _0x3a7d93=[];return db['CmContact'][_0x4494('0x41')]()['then'](function(_0x5ed118){_0x3a7d93=_[_0x4494('0x18')](_0x5ed118);return _0x6a9289[_0x4494('0x4d')]['getVoiceQueues']({'where':{'type':_0x4494('0x5e'),'dialActive':!![],'dialMethod':_0x4494('0x5f')},'attributes':['id',_0x4494('0x60'),_0x4494('0x61')],'raw':!![]});})[_0x4494('0x35')](function(_0x4e6f96){if(_0x4e6f96&&_0x4e6f96[_0x4494('0x2b')]){return db[_0x4494('0x62')][_0x4494('0x63')](function(_0x299b8c){var _0x457d76={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4494('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x4e6f96,'id')},'$or':[{'UserId':null},{'UserId':_0x6a9289[_0x4494('0x4d')]['id']}]};var _0x3722d0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4e6f96)[_0x4494('0x31')]([_0x4494('0x61'),0x0])[_0x4494('0x16')]('id')[_0x4494('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x6a9289[_0x4494('0x4d')]['id']}]};var _0x15c6c1={'$or':[_0x457d76,_0x3722d0]};var _0xa85960=[];if(_0x6a9289[_0x4494('0x40')]['direction']&&_0x6a9289['body']['direction']===_0x4494('0x65')){if(!_[_0x4494('0x66')](_0x6a9289['body'][_0x4494('0x67')])){_0x15c6c1['id']={'$in':_0x6a9289[_0x4494('0x40')][_0x4494('0x67')]};}_0xa85960=[[_0x4494('0x68'),_0x4494('0x69')],[_0x4494('0x6a'),_0x4e6f96[0x0][_0x4494('0x60')]==='ASC'?_0x4494('0x6b'):_0x4494('0x69')],db[_0x4494('0x62')][_0x4494('0x6c')](_0x4494('0x6d')),['id',_0x4494('0x6b')]];}else{if(!_[_0x4494('0x66')](_0x6a9289[_0x4494('0x40')]['hopperIds'])){_0x15c6c1['id']={'$notIn':_0x6a9289[_0x4494('0x40')]['hopperIds']};}_0xa85960=[['priority',_0x4494('0x6b')],[_0x4494('0x6a'),_0x4e6f96[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x4494('0x6c')](_0x4494('0x6e')),['id','ASC']];}return db[_0x4494('0x11')][_0x4494('0x6f')]({'attributes':['id',_0x4494('0x70'),'phone','recallme'],'where':_0x15c6c1,'order':_0xa85960,'transaction':_0x299b8c,'lock':_0x299b8c['LOCK'][_0x4494('0x71')],'include':[{'model':db[_0x4494('0x55')],'as':_0x4494('0x72'),'attributes':_0x3a7d93,'include':[{'model':db[_0x4494('0x73')],'as':_0x4494('0x74'),'attributes':['id','name']}]},{'model':db[_0x4494('0x75')],'as':'List','attributes':['id','name']},{'model':db[_0x4494('0x44')],'as':'Queue','attributes':['id',_0x4494('0x10'),'dialActive']}]})[_0x4494('0x35')](function(_0x5d580e){if(_0x5d580e){return _0x5d580e['update']({'UserId':_0x6a9289['user']['id']},{'transaction':_0x299b8c});}});});}})['then'](handleEntityNotFound(_0x43583a,null))[_0x4494('0x35')](respondWithResult(_0x43583a,null))[_0x4494('0x3a')](handleError(_0x43583a,null));};exports[_0x4494('0x76')]=function(_0x3a7491,_0x3e7652,_0x19daf1){var _0x6131f6=[];var _0x46ec48=_0x3a7491[_0x4494('0x3c')]['id'];var _0x49dff9=_0x3a7491['user']['id'];return db['CmContact']['describe']()[_0x4494('0x35')](function(_0x38f28c){_0x6131f6=_[_0x4494('0x18')](_0x38f28c);return db['sequelize'][_0x4494('0x63')](function(_0x371baf){const _0x307bb9={'id':_0x46ec48};return db[_0x4494('0x11')][_0x4494('0x6f')]({'attributes':['id','scheduledat',_0x4494('0x77')],'where':_0x307bb9,'transaction':_0x371baf,'lock':_0x371baf[_0x4494('0x78')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x6131f6,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x4494('0x75')],'as':_0x4494('0x79'),'attributes':['id',_0x4494('0x10')]},{'model':db[_0x4494('0x44')],'as':_0x4494('0x7a'),'attributes':['id',_0x4494('0x10'),_0x4494('0x7b')]}]})['then'](function(_0x2a5a2b){if(_0x2a5a2b){return _0x2a5a2b['update']({'UserId':_0x49dff9},{'transaction':_0x371baf});}});});})[_0x4494('0x35')](handleEntityNotFound(_0x3e7652,null))[_0x4494('0x35')](respondWithResult(_0x3e7652,null))[_0x4494('0x3a')](handleError(_0x3e7652,null));};exports[_0x4494('0x7c')]=function(_0x1f18bf,_0x500858){return _0x1f18bf[_0x4494('0x4d')][_0x4494('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x4494('0x35')](function(_0xe0e497){if(_0xe0e497&&_0xe0e497[_0x4494('0x2b')]){return db[_0x4494('0x11')][_0x4494('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4494('0x4f')](_0x4494('0x50'))},'VoiceQueueId':{'$in':_[_0x4494('0x16')](_0xe0e497,'id')},'$or':[{'UserId':null},{'UserId':_0x1f18bf[_0x4494('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x1e9e8c){if(!_['isNil'](_0x1e9e8c)&&_[_0x4494('0x7e')](_0x1e9e8c)){return _0x500858[_0x4494('0x6')](0xc8)[_0x4494('0x7')]({'contacts':_0x1e9e8c});}else{logger['error'](_0x4494('0x7f'),'getOpenContacts',0x194,_0x4494('0x80'));_0x500858[_0x4494('0xe')](0x194);}})[_0x4494('0x3a')](handleError(_0x500858,null));};exports[_0x4494('0x81')]=function(_0x1796d1,_0x45b340){var _0x4875ee=shared[_0x4494('0x82')];var _0x1005e9=[];_['map'](_0x4875ee,function(_0x3a0787){_0x1005e9['push']({'id':_0x3a0787[_0x4494('0x10')],'name':_0x3a0787[_0x4494('0x10')],'utcOffset':_0x3a0787[_0x4494('0x83')]});});return _0x45b340[_0x4494('0x6')](0xc8)['json']({'tz':_0x1005e9});};exports[_0x4494('0x84')]=function(_0x4cc690,_0x360c65){var _0x1aa889=shared[_0x4494('0x82')];var _0xcc90e9={};if(!_[_0x4494('0x57')](_0x1aa889[_0x4cc690['body']['id']]))_0xcc90e9=_0x1aa889[_0x4cc690['body']['id']];return _0x360c65[_0x4494('0x6')](0xc8)[_0x4494('0x7')](_0xcc90e9);}; \ No newline at end of file +var _0x9a19=['moment','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','limit','undefined','offset','count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','filters','intersection','$or','$gt','$gte','$lt','$lte','$ne','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','destroy','end','getPreview','CmContact','getVoiceQueues','outbound','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','findOne','scheduledat','recallme','Contact','CmCompany','CmList','List','VoiceQueue','dialActive','getPreviewRecall','LOCK','UPDATE','Company','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','timezones'];(function(_0x2eb016,_0x357bcb){var _0x1773db=function(_0x5c3aeb){while(--_0x5c3aeb){_0x2eb016['push'](_0x2eb016['shift']());}};_0x1773db(++_0x357bcb);}(_0x9a19,0x114));var _0x99a1=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x9a19[_0x4c4037];return _0x357862;};'use strict';var moment=require(_0x99a1('0x0'));var _=require(_0x99a1('0x1'));var qs=require(_0x99a1('0x2'));var logger=require('../../config/logger')(_0x99a1('0x3'));var shared=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];function respondWithResult(_0x25da2d,_0x214082){_0x214082=_0x214082||0xc8;return function(_0x3d73c5){if(_0x3d73c5){return _0x25da2d[_0x99a1('0x6')](_0x214082)[_0x99a1('0x7')](_0x3d73c5);}};}function respondWithFilteredResult(_0x3eff4a,_0xff0240){return function(_0x65045d){if(_0x65045d){var _0x523b9e=typeof _0xff0240['offset']==='undefined'&&typeof _0xff0240[_0x99a1('0x8')]===_0x99a1('0x9');var _0x500164=_0x65045d['count'];var _0x4696f6=_0x523b9e?0x0:_0xff0240[_0x99a1('0xa')];var _0x23db53=_0x523b9e?_0x65045d[_0x99a1('0xb')]:_0xff0240[_0x99a1('0xa')]+_0xff0240['limit'];var _0x28ee99;if(_0x23db53>=_0x500164){_0x23db53=_0x500164;_0x28ee99=0xc8;}else{_0x28ee99=0xce;}_0x3eff4a[_0x99a1('0x6')](_0x28ee99);return _0x3eff4a[_0x99a1('0xc')](_0x99a1('0xd'),_0x4696f6+'-'+_0x23db53+'/'+_0x500164)[_0x99a1('0x7')](_0x65045d);}return null;};}function saveUpdates(_0x1bc7aa,_0x2ff655){return function(_0x532f56){if(_0x532f56){return _0x532f56[_0x99a1('0xe')](_0x1bc7aa)[_0x99a1('0xf')](function(_0x3a865c){return _0x3a865c;});}return null;};}function handleEntityNotFound(_0x47815e,_0xe1a1f){return function(_0x3c9ef4){if(!_0x3c9ef4){_0x47815e[_0x99a1('0x10')](0x194);}return _0x3c9ef4;};}function handleError(_0x4d73de,_0x2d81ed){_0x2d81ed=_0x2d81ed||0x1f4;return function(_0x3e45d4){logger[_0x99a1('0x11')](_0x3e45d4[_0x99a1('0x12')]);if(_0x3e45d4[_0x99a1('0x13')]){delete _0x3e45d4[_0x99a1('0x13')];}_0x4d73de[_0x99a1('0x6')](_0x2d81ed)['send'](_0x3e45d4);};}exports['index']=function(_0x6702d8,_0xbf62f1){var _0x1a8c41={},_0x1fcd00={},_0x74a113={'count':0x0,'rows':[]};var _0x209021=_[_0x99a1('0x14')](db[_0x99a1('0x15')][_0x99a1('0x16')],function(_0x2d8cac){return{'name':_0x2d8cac[_0x99a1('0x17')],'type':_0x2d8cac['type'][_0x99a1('0x18')]};});_0x1fcd00[_0x99a1('0x19')]=_['map'](_0x209021,_0x99a1('0x13'));_0x1fcd00['query']=_[_0x99a1('0x1a')](_0x6702d8[_0x99a1('0x1b')]);_0x1fcd00[_0x99a1('0x1c')]=_[_0x99a1('0x1d')](_0x1fcd00['model'],_0x1fcd00[_0x99a1('0x1b')]);_0x1fcd00[_0x99a1('0x1c')]=_['concat'](_0x1fcd00[_0x99a1('0x1c')],['$and',_0x99a1('0x1e'),_0x99a1('0x1f'),_0x99a1('0x20'),_0x99a1('0x21'),_0x99a1('0x22'),_0x99a1('0x23'),'$eq',_0x99a1('0x24'),'$between','$notBetween',_0x99a1('0x25'),_0x99a1('0x26'),_0x99a1('0x27'),_0x99a1('0x28'),_0x99a1('0x29'),_0x99a1('0x2a'),_0x99a1('0x27'),'$overlap',_0x99a1('0x2b'),'$contained',_0x99a1('0x2c')]);_0x1a8c41[_0x99a1('0x2d')]=_[_0x99a1('0x1d')](_0x1fcd00['model'],qs[_0x99a1('0x2e')](_0x6702d8[_0x99a1('0x1b')]['fields']));_0x1a8c41[_0x99a1('0x2d')]=_0x1a8c41[_0x99a1('0x2d')][_0x99a1('0x2f')]?_0x1a8c41[_0x99a1('0x2d')]:_0x1fcd00[_0x99a1('0x19')];if(!_0x6702d8[_0x99a1('0x1b')][_0x99a1('0x30')](_0x99a1('0x31'))){_0x1a8c41['limit']=qs['limit'](_0x6702d8[_0x99a1('0x1b')]['limit']);_0x1a8c41[_0x99a1('0xa')]=qs[_0x99a1('0xa')](_0x6702d8['query'][_0x99a1('0xa')]);}_0x1a8c41[_0x99a1('0x32')]=qs[_0x99a1('0x33')](_0x6702d8[_0x99a1('0x1b')][_0x99a1('0x33')]);_0x1a8c41[_0x99a1('0x34')]=qs[_0x99a1('0x1c')](_[_0x99a1('0x35')](_0x6702d8[_0x99a1('0x1b')],_0x1fcd00[_0x99a1('0x1c')]),_0x209021);if(_0x6702d8[_0x99a1('0x1b')][_0x99a1('0x36')]){_0x1a8c41[_0x99a1('0x34')]=_[_0x99a1('0x37')](_0x1a8c41['where'],{'$or':_['map'](_0x209021,function(_0x46e3f2){if(_0x46e3f2[_0x99a1('0x38')]!==_0x99a1('0x39')){var _0x4131e0={};_0x4131e0[_0x46e3f2[_0x99a1('0x13')]]={'$like':'%'+_0x6702d8[_0x99a1('0x1b')][_0x99a1('0x36')]+'%'};return _0x4131e0;}})});}_0x1a8c41=_['merge']({},_0x1a8c41,_0x6702d8[_0x99a1('0x3a')]);var _0x506613={'where':_0x1a8c41['where']};return db[_0x99a1('0x15')][_0x99a1('0xb')](_0x506613)[_0x99a1('0xf')](function(_0x3cd1a0){_0x74a113[_0x99a1('0xb')]=_0x3cd1a0;if(_0x6702d8[_0x99a1('0x1b')][_0x99a1('0x3b')]){_0x1a8c41[_0x99a1('0x3c')]=[{'all':!![]}];}return db[_0x99a1('0x15')][_0x99a1('0x3d')](_0x1a8c41);})[_0x99a1('0xf')](function(_0x152969){_0x74a113[_0x99a1('0x3e')]=_0x152969;return _0x74a113;})['then'](respondWithFilteredResult(_0xbf62f1,_0x1a8c41))['catch'](handleError(_0xbf62f1,null));};exports['show']=function(_0x29e884,_0x169df7){var _0x1d3f85={'raw':!![],'where':{'id':_0x29e884[_0x99a1('0x3f')]['id']}},_0x279662={};_0x279662['model']=_[_0x99a1('0x1a')](db[_0x99a1('0x15')][_0x99a1('0x16')]);_0x279662['query']=_['keys'](_0x29e884[_0x99a1('0x1b')]);_0x279662[_0x99a1('0x1c')]=_[_0x99a1('0x1d')](_0x279662['model'],_0x279662[_0x99a1('0x1b')]);_0x1d3f85[_0x99a1('0x2d')]=_[_0x99a1('0x1d')](_0x279662[_0x99a1('0x19')],qs[_0x99a1('0x2e')](_0x29e884[_0x99a1('0x1b')][_0x99a1('0x2e')]));_0x1d3f85[_0x99a1('0x2d')]=_0x1d3f85[_0x99a1('0x2d')][_0x99a1('0x2f')]?_0x1d3f85['attributes']:_0x279662[_0x99a1('0x19')];if(_0x29e884[_0x99a1('0x1b')][_0x99a1('0x3b')]){_0x1d3f85['include']=[{'all':!![]}];}_0x1d3f85=_[_0x99a1('0x37')]({},_0x1d3f85,_0x29e884['options']);return db[_0x99a1('0x15')][_0x99a1('0x40')](_0x1d3f85)[_0x99a1('0xf')](handleEntityNotFound(_0x169df7,null))[_0x99a1('0xf')](respondWithResult(_0x169df7,null))[_0x99a1('0x41')](handleError(_0x169df7,null));};exports[_0x99a1('0x42')]=function(_0x5822b1,_0xf0e085){return db['CmHopper'][_0x99a1('0x42')](_0x5822b1[_0x99a1('0x43')],{})[_0x99a1('0xf')](respondWithResult(_0xf0e085,0xc9))[_0x99a1('0x41')](handleError(_0xf0e085,null));};exports[_0x99a1('0xe')]=function(_0x67992,_0x31db25){if(_0x67992[_0x99a1('0x43')]['id']){delete _0x67992[_0x99a1('0x43')]['id'];}return db[_0x99a1('0x15')][_0x99a1('0x40')]({'where':{'id':_0x67992['params']['id']}})[_0x99a1('0xf')](handleEntityNotFound(_0x31db25,null))[_0x99a1('0xf')](saveUpdates(_0x67992['body'],null))[_0x99a1('0xf')](respondWithResult(_0x31db25,null))[_0x99a1('0x41')](handleError(_0x31db25,null));};exports[_0x99a1('0x44')]=function(_0x2e377b,_0x113dd9){return db[_0x99a1('0x15')][_0x99a1('0x44')]()['then'](respondWithResult(_0x113dd9,null))[_0x99a1('0x41')](handleError(_0x113dd9,null));};exports['destroy']=function(_0x1d4d3f,_0x269798){var _0x566442;var _0x5433f2=_0x1d4d3f[_0x99a1('0x3f')]['id'];return db[_0x99a1('0x15')][_0x99a1('0x40')]({'where':{'id':_0x1d4d3f[_0x99a1('0x3f')]['id']}})[_0x99a1('0xf')](handleEntityNotFound(_0x269798,null))['then'](function(_0x539a05){if(_0x539a05){return _0x539a05['destroy']()[_0x99a1('0xf')](function(_0x4ae90e){return _0x4ae90e;});}})[_0x99a1('0xf')](function(_0x30fdfb){_0x566442=_0x30fdfb;if(_0x30fdfb){if(_0x30fdfb[_0x99a1('0x45')]||_0x30fdfb[_0x99a1('0x46')]){return db[_0x30fdfb[_0x99a1('0x45')]?'VoiceQueue':_0x99a1('0x47')][_0x99a1('0x40')]({'where':{'id':_0x30fdfb[_0x99a1('0x45')]?_0x30fdfb['VoiceQueueId']:_0x30fdfb[_0x99a1('0x46')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x1b9598){var _0x1af90b={};if(_0x1b9598){_[_0x99a1('0x37')](_0x1af90b,_[_0x99a1('0x48')](_0x566442[_0x99a1('0x49')],[_0x99a1('0x4a'),_0x99a1('0x4b'),'id']));_0x1af90b[_0x99a1('0x4c')]=0x15;_0x1af90b[_0x99a1('0x4d')]='deleted';_0x1af90b[_0x99a1('0x4e')]=_0x1b9598['name'];_0x1af90b[_0x99a1('0x4f')]=_0x1d4d3f[_0x99a1('0x50')]['name'];_0x1af90b[_0x99a1('0x51')]=_0x1d4d3f[_0x99a1('0x50')]['id'];_0x1af90b[_0x99a1('0x52')]=!![];_0x1af90b[_0x99a1('0x53')]=moment()[_0x99a1('0x54')](_0x99a1('0x55'));_0x1af90b[_0x99a1('0x56')]=_0x566442[_0x99a1('0x57')];_0x1af90b[_0x99a1('0x58')]=_0x566442[_0x99a1('0x45')]?_0x99a1('0x59'):_0x99a1('0x5a');return db['CmContact']['find']({'where':{'id':_0x1af90b[_0x99a1('0x5b')]},'attributes':[_0x99a1('0x5c'),_0x99a1('0x5d')]})[_0x99a1('0xf')](function(_0x213719){if(!_['isNil'](_0x269798)&&!_[_0x99a1('0x5e')](_0x213719[_0x99a1('0x5c')])){_0x1af90b['calleridname']=_0x213719[_0x99a1('0x5c')];if(!_[_0x99a1('0x5e')](_0x213719[_0x99a1('0x5d')])){_0x1af90b[_0x99a1('0x5f')]+='\x20'+_0x213719[_0x99a1('0x5d')];}}})['finally'](function(){return db[_0x99a1('0x60')][_0x99a1('0x42')](_0x1af90b);});}})[_0x99a1('0xf')](function(_0x22811f){return db[_0x99a1('0x61')][_0x99a1('0x62')]({'where':{'CmHopperId':_0x5433f2}});})['then'](function(){return _0x269798[_0x99a1('0x6')](0xcc)[_0x99a1('0x63')]();})['catch'](handleError(_0x269798,null));};exports[_0x99a1('0x64')]=function(_0x2b228e,_0x3ad349){var _0xb126dd=[];return db[_0x99a1('0x65')]['describe']()[_0x99a1('0xf')](function(_0x5d250a){_0xb126dd=_['keys'](_0x5d250a);return _0x2b228e['user'][_0x99a1('0x66')]({'where':{'type':_0x99a1('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x99a1('0x68')],'raw':!![]});})['then'](function(_0x21a5f6){if(_0x21a5f6&&_0x21a5f6[_0x99a1('0x2f')]){return db[_0x99a1('0x69')][_0x99a1('0x6a')](function(_0x56d6cf){var _0x18f74b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x99a1('0x54')](_0x99a1('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x21a5f6,'id')},'$or':[{'UserId':null},{'UserId':_0x2b228e[_0x99a1('0x50')]['id']}]};var _0x5c5481={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x21a5f6)[_0x99a1('0x36')]([_0x99a1('0x68'),0x0])[_0x99a1('0x14')]('id')[_0x99a1('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x2b228e[_0x99a1('0x50')]['id']}]};var _0x5939ec={'$or':[_0x18f74b,_0x5c5481]};var _0x4d37f8=[];if(_0x2b228e['body'][_0x99a1('0x6c')]&&_0x2b228e[_0x99a1('0x43')]['direction']==='prev'){if(!_[_0x99a1('0x6d')](_0x2b228e[_0x99a1('0x43')][_0x99a1('0x6e')])){_0x5939ec['id']={'$in':_0x2b228e['body']['hopperIds']};}_0x4d37f8=[[_0x99a1('0x6f'),'ASC'],[_0x99a1('0x70'),_0x21a5f6[0x0][_0x99a1('0x71')]===_0x99a1('0x72')?'DESC':_0x99a1('0x72')],db[_0x99a1('0x69')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x99a1('0x73')]];}else{if(!_['isEmpty'](_0x2b228e[_0x99a1('0x43')][_0x99a1('0x6e')])){_0x5939ec['id']={'$notIn':_0x2b228e[_0x99a1('0x43')]['hopperIds']};}_0x4d37f8=[[_0x99a1('0x6f'),_0x99a1('0x73')],[_0x99a1('0x70'),_0x21a5f6[0x0][_0x99a1('0x71')]],db[_0x99a1('0x69')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x99a1('0x72')]];}return db[_0x99a1('0x15')][_0x99a1('0x74')]({'attributes':['id',_0x99a1('0x75'),'phone',_0x99a1('0x76')],'where':_0x5939ec,'order':_0x4d37f8,'transaction':_0x56d6cf,'lock':_0x56d6cf['LOCK']['UPDATE'],'include':[{'model':db[_0x99a1('0x65')],'as':_0x99a1('0x77'),'attributes':_0xb126dd,'include':[{'model':db[_0x99a1('0x78')],'as':'Company','attributes':['id',_0x99a1('0x13')]}]},{'model':db[_0x99a1('0x79')],'as':_0x99a1('0x7a'),'attributes':['id',_0x99a1('0x13')]},{'model':db[_0x99a1('0x7b')],'as':'Queue','attributes':['id',_0x99a1('0x13'),_0x99a1('0x7c')]}]})[_0x99a1('0xf')](function(_0x3a78e0){if(_0x3a78e0){return _0x3a78e0[_0x99a1('0xe')]({'UserId':_0x2b228e[_0x99a1('0x50')]['id']},{'transaction':_0x56d6cf});}});});}})['then'](handleEntityNotFound(_0x3ad349,null))[_0x99a1('0xf')](respondWithResult(_0x3ad349,null))[_0x99a1('0x41')](handleError(_0x3ad349,null));};exports[_0x99a1('0x7d')]=function(_0x1b3b83,_0x2172c3,_0x579271){var _0x18843d=[];var _0x68c944=_0x1b3b83[_0x99a1('0x3f')]['id'];var _0x123fa7=_0x1b3b83[_0x99a1('0x50')]['id'];return db[_0x99a1('0x65')]['describe']()[_0x99a1('0xf')](function(_0x33d96b){_0x18843d=_['keys'](_0x33d96b);return db['sequelize'][_0x99a1('0x6a')](function(_0x414370){const _0x5ecf95={'id':_0x68c944};return db[_0x99a1('0x15')][_0x99a1('0x74')]({'attributes':['id',_0x99a1('0x75'),_0x99a1('0x76')],'where':_0x5ecf95,'transaction':_0x414370,'lock':_0x414370[_0x99a1('0x7e')][_0x99a1('0x7f')],'include':[{'model':db[_0x99a1('0x65')],'as':_0x99a1('0x77'),'attributes':_0x18843d,'include':[{'model':db[_0x99a1('0x78')],'as':_0x99a1('0x80'),'attributes':['id',_0x99a1('0x13')]}]},{'model':db[_0x99a1('0x79')],'as':_0x99a1('0x7a'),'attributes':['id','name']},{'model':db[_0x99a1('0x7b')],'as':'Queue','attributes':['id','name',_0x99a1('0x7c')]}]})[_0x99a1('0xf')](function(_0x188f81){if(_0x188f81){return _0x188f81[_0x99a1('0xe')]({'UserId':_0x123fa7},{'transaction':_0x414370});}});});})[_0x99a1('0xf')](handleEntityNotFound(_0x2172c3,null))[_0x99a1('0xf')](respondWithResult(_0x2172c3,null))[_0x99a1('0x41')](handleError(_0x2172c3,null));};exports[_0x99a1('0x81')]=function(_0x361ce6,_0x557c5f){return _0x361ce6[_0x99a1('0x50')][_0x99a1('0x66')]({'where':{'type':_0x99a1('0x67'),'dialActive':!![],'dialMethod':_0x99a1('0x82')},'attributes':['id'],'raw':!![]})[_0x99a1('0xf')](function(_0xbba599){if(_0xbba599&&_0xbba599[_0x99a1('0x2f')]){return db[_0x99a1('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x99a1('0x14')](_0xbba599,'id')},'$or':[{'UserId':null},{'UserId':_0x361ce6[_0x99a1('0x50')]['id']}]}});}return 0x0;})['then'](function(_0x1d43d3){if(!_[_0x99a1('0x5e')](_0x1d43d3)&&_[_0x99a1('0x83')](_0x1d43d3)){return _0x557c5f[_0x99a1('0x6')](0xc8)['json']({'contacts':_0x1d43d3});}else{logger[_0x99a1('0x11')](_0x99a1('0x84'),_0x99a1('0x81'),0x194,_0x99a1('0x85'));_0x557c5f['sendStatus'](0x194);}})[_0x99a1('0x41')](handleError(_0x557c5f,null));};exports['getTimezones']=function(_0x50cb12,_0x590f39){var _0x21eb8b=shared['timezones'];var _0xb7744c=[];_[_0x99a1('0x14')](_0x21eb8b,function(_0x350514){_0xb7744c[_0x99a1('0x86')]({'id':_0x350514[_0x99a1('0x13')],'name':_0x350514[_0x99a1('0x13')],'utcOffset':_0x350514[_0x99a1('0x87')]});});return _0x590f39['status'](0xc8)['json']({'tz':_0xb7744c});};exports[_0x99a1('0x88')]=function(_0x14cd7d,_0xff43dd){var _0x4af45f=shared[_0x99a1('0x89')];var _0x9f460d={};if(!_[_0x99a1('0x5e')](_0x4af45f[_0x14cd7d['body']['id']]))_0x9f460d=_0x4af45f[_0x14cd7d[_0x99a1('0x43')]['id']];return _0xff43dd[_0x99a1('0x6')](0xc8)[_0x99a1('0x7')](_0x9f460d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ae76dfd..2d81160 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x187d,0x93));var _0xd187=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x187d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['../../config/logger','api','bluebird','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c60,0xc1));var _0x04c6=function(_0x2f64c7,_0x5ca78b){_0x2f64c7=_0x2f64c7-0x0;var _0x51a72d=_0x4c60[_0x2f64c7];return _0x51a72d;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e5dbe2f..4a1fa46 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 _0x27eb=['include','model','map','error','message','find','where','then','debug','ShowCmHopper','stringify','catch','create','body','info','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','Contact','keys','name','voicePause','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','LOCK','UPDATE','length','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','\x20MINUTE','NOW()','User','Agent','CmList','List','lodash','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit'];(function(_0x5310b4,_0x3c021a){var _0x3502a5=function(_0x3a595c){while(--_0x3a595c){_0x5310b4['push'](_0x5310b4['shift']());}};_0x3502a5(++_0x3c021a);}(_0x27eb,0x96));var _0xb27e=function(_0x495484,_0x4b43e0){_0x495484=_0x495484-0x0;var _0x4d628e=_0x27eb[_0x495484];return _0x4d628e;};'use strict';var _=require(_0xb27e('0x0'));var util=require(_0xb27e('0x1'));var moment=require('moment');var BPromise=require(_0xb27e('0x2'));var db=require(_0xb27e('0x3'))['db'];var logger=require('../../config/logger')(_0xb27e('0x4'));exports[_0xb27e('0x5')]=function(_0x105603){var _0x5e66a6=this;return new Promise(function(_0xc58b5f,_0x587f4e){return db[_0xb27e('0x6')][_0xb27e('0x7')]({'raw':_0x105603[_0xb27e('0x8')]?_0x105603['options'][_0xb27e('0x9')]===undefined?!![]:![]:!![],'where':_0x105603['options']?_0x105603[_0xb27e('0x8')]['where']||null:null,'attributes':_0x105603[_0xb27e('0x8')]?_0x105603[_0xb27e('0x8')][_0xb27e('0xa')]||null:null,'limit':_0x105603[_0xb27e('0x8')]?_0x105603[_0xb27e('0x8')][_0xb27e('0xb')]||null:null,'include':_0x105603['options']?_0x105603[_0xb27e('0x8')][_0xb27e('0xc')]?_['map'](_0x105603[_0xb27e('0x8')][_0xb27e('0xc')],function(_0x10e94d){return{'model':db[_0x10e94d[_0xb27e('0xd')]],'as':_0x10e94d['as'],'attributes':_0x10e94d[_0xb27e('0xa')],'include':_0x10e94d[_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x10e94d[_0xb27e('0xc')],function(_0x5103e2){return{'model':db[_0x5103e2[_0xb27e('0xd')]],'as':_0x5103e2['as'],'attributes':_0x5103e2['attributes'],'include':_0x5103e2[_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x5103e2['include'],function(_0x129910){return{'model':db[_0x129910[_0xb27e('0xd')]],'as':_0x129910['as'],'attributes':_0x129910[_0xb27e('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdec8){logger['info']('GetCmHopper',_0x105603);logger['debug'](_0xb27e('0x5'),_0x105603,JSON['stringify'](_0x2fdec8));_0xc58b5f(_0x2fdec8);})['catch'](function(_0x449338){logger[_0xb27e('0xf')](_0xb27e('0x5'),_0x449338['message'],_0x105603);_0x587f4e(_0x5e66a6[_0xb27e('0xf')](0x1f4,_0x449338[_0xb27e('0x10')]));});});};exports['ShowCmHopper']=function(_0x5a7289){var _0x36faaa=this;return new Promise(function(_0x3cc065,_0x3d1771){return db[_0xb27e('0x6')][_0xb27e('0x11')]({'raw':_0x5a7289[_0xb27e('0x8')]?_0x5a7289['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a7289[_0xb27e('0x8')]?_0x5a7289[_0xb27e('0x8')][_0xb27e('0x12')]||null:null,'attributes':_0x5a7289[_0xb27e('0x8')]?_0x5a7289['options']['attributes']||null:null,'include':_0x5a7289[_0xb27e('0x8')]?_0x5a7289[_0xb27e('0x8')][_0xb27e('0xc')]?_['map'](_0x5a7289['options']['include'],function(_0x212257){return{'model':db[_0x212257[_0xb27e('0xd')]],'as':_0x212257['as'],'attributes':_0x212257['attributes'],'include':_0x212257['include']?_[_0xb27e('0xe')](_0x212257[_0xb27e('0xc')],function(_0x1c4a1c){return{'model':db[_0x1c4a1c[_0xb27e('0xd')]],'as':_0x1c4a1c['as'],'attributes':_0x1c4a1c[_0xb27e('0xa')],'include':_0x1c4a1c[_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x1c4a1c['include'],function(_0x49b2be){return{'model':db[_0x49b2be['model']],'as':_0x49b2be['as'],'attributes':_0x49b2be[_0xb27e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb27e('0x13')](function(_0x3b74c8){logger['info']('ShowCmHopper',_0x5a7289);logger[_0xb27e('0x14')](_0xb27e('0x15'),_0x5a7289,JSON[_0xb27e('0x16')](_0x3b74c8));_0x3cc065(_0x3b74c8);})[_0xb27e('0x17')](function(_0x50ec86){logger['error']('ShowCmHopper',_0x50ec86[_0xb27e('0x10')],_0x5a7289);_0x3d1771(_0x36faaa[_0xb27e('0xf')](0x1f4,_0x50ec86[_0xb27e('0x10')]));});});};exports['CreateCmHopper']=function(_0x33a409){var _0x353332=this;return new Promise(function(_0x28ae46,_0x33d479){return db['CmHopper'][_0xb27e('0x18')](_0x33a409[_0xb27e('0x19')],{'raw':_0x33a409[_0xb27e('0x8')]?_0x33a409[_0xb27e('0x8')][_0xb27e('0x9')]===undefined?!![]:![]:!![]})[_0xb27e('0x13')](function(_0x5ec9c9){logger[_0xb27e('0x1a')](_0xb27e('0x1b'),_0x33a409);logger[_0xb27e('0x14')](_0xb27e('0x1b'),_0x33a409,JSON['stringify'](_0x5ec9c9));_0x28ae46(_0x5ec9c9);})[_0xb27e('0x17')](function(_0x26e599){logger[_0xb27e('0xf')](_0xb27e('0x1b'),_0x26e599[_0xb27e('0x10')],_0x33a409);_0x33d479(_0x353332[_0xb27e('0xf')](0x1f4,_0x26e599[_0xb27e('0x10')]));});});};exports[_0xb27e('0x1c')]=function(_0x13de7e){var _0x499fcc=this;return new Promise(function(_0x5692e1,_0x4ee6ca){return db[_0xb27e('0x6')][_0xb27e('0x1d')](_0x13de7e[_0xb27e('0x19')],{'raw':_0x13de7e[_0xb27e('0x8')]?_0x13de7e[_0xb27e('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13de7e[_0xb27e('0x8')]?_0x13de7e[_0xb27e('0x8')][_0xb27e('0x12')]||null:null,'attributes':_0x13de7e['options']?_0x13de7e['options'][_0xb27e('0xa')]||null:null,'limit':_0x13de7e[_0xb27e('0x8')]?_0x13de7e[_0xb27e('0x8')]['limit']||null:null})['then'](function(_0x30cd0f){logger['info']('UpdateCmHopper',_0x13de7e);logger[_0xb27e('0x1a')](_0xb27e('0x1e'),JSON['stringify'](_0x13de7e[_0xb27e('0x8')][_0xb27e('0x12')]),_0x13de7e['body'][_0xb27e('0x1f')]);logger[_0xb27e('0x14')](_0xb27e('0x1c'),_0x13de7e,JSON[_0xb27e('0x16')](_0x30cd0f));_0x5692e1(_0x30cd0f);})['catch'](function(_0x227159){logger[_0xb27e('0xf')](_0xb27e('0x1c'),_0x227159[_0xb27e('0x10')],_0x13de7e);_0x4ee6ca(_0x499fcc[_0xb27e('0xf')](0x1f4,_0x227159[_0xb27e('0x10')]));});});};exports[_0xb27e('0x20')]=function(_0x4a0673){var _0x48df7a=this;return new Promise(function(_0xc8e05a,_0x278e10){return db['CmHopper'][_0xb27e('0x21')]({'where':_0x4a0673[_0xb27e('0x8')]?_0x4a0673[_0xb27e('0x8')]['where']||null:null})[_0xb27e('0x13')](function(_0x2e8fe3){logger[_0xb27e('0x1a')]('DestroyCmHopper',_0x4a0673);logger[_0xb27e('0x14')](_0xb27e('0x20'),_0x4a0673,JSON[_0xb27e('0x16')](_0x2e8fe3));_0xc8e05a(_0x2e8fe3);})[_0xb27e('0x17')](function(_0xe7a939){logger[_0xb27e('0xf')]('DestroyCmHopper',_0xe7a939[_0xb27e('0x10')],_0x4a0673);_0x278e10(_0x48df7a[_0xb27e('0xf')](0x1f4,_0xe7a939[_0xb27e('0x10')]));});});};exports[_0xb27e('0x22')]=function(_0x20e9b4){var _0x474f80=this;return new Promise(function(_0x4f93c0,_0x2d4f9f){return db[_0xb27e('0x23')]['describe']()['then'](function(_0x1a64b7){return db[_0xb27e('0x24')][_0xb27e('0x25')](function(_0x48801f){return db[_0xb27e('0x6')][_0xb27e('0x7')]({'where':_0x20e9b4['options']?_0x20e9b4[_0xb27e('0x8')][_0xb27e('0x12')]||null:null,'attributes':_0x20e9b4[_0xb27e('0x8')]?_0x20e9b4[_0xb27e('0x8')][_0xb27e('0xa')]||null:null,'limit':_0x20e9b4[_0xb27e('0x8')]?_0x20e9b4['options'][_0xb27e('0xb')]||null:null,'order':_0x20e9b4[_0xb27e('0x8')]?_0x20e9b4[_0xb27e('0x8')][_0xb27e('0x26')]||null:null,'transaction':_0x48801f,'lock':_0x48801f['LOCK']['UPDATE'],'include':[{'model':db[_0xb27e('0x23')],'as':_0xb27e('0x27'),'attributes':_[_0xb27e('0x28')](_0x1a64b7)},{'model':db['User'],'as':'Agent','attributes':['id',_0xb27e('0x29'),_0xb27e('0x2a')]}]})[_0xb27e('0x13')](function(_0x4a3c7f){var _0x387768=[];var _0x53a833=[];for(var _0x469c30=0x0;_0x469c30<_0x4a3c7f['length'];_0x469c30+=0x1){var _0x12fbe8=_0x4a3c7f[_0x469c30][_0xb27e('0x2b')];if(_0x12fbe8===null){_0x387768[_0xb27e('0x2c')](_0x4a3c7f[_0x469c30][_0xb27e('0x1d')](_0x20e9b4[_0xb27e('0x19')],{'transaction':_0x48801f}));}else if(!_0x53a833[_0xb27e('0x2d')](_0x12fbe8)){_0x53a833['push'](_0x12fbe8);_0x387768['push'](_0x4a3c7f[_0x469c30][_0xb27e('0x1d')](_0x20e9b4[_0xb27e('0x19')],{'transaction':_0x48801f}));}}return BPromise[_0xb27e('0x2e')](_0x387768);});})['then'](function(_0x450bf5){logger[_0xb27e('0x1a')](_0xb27e('0x22'),_0x20e9b4);if(_0x450bf5['length']>0x0){logger['info'](_0xb27e('0x2f'),_0x450bf5[0x0][_0xb27e('0x30')]['id'],_0x450bf5[0x0]['dataValues'][_0xb27e('0x31')],_0x450bf5[0x0]['dataValues'][_0xb27e('0x1f')]);}logger[_0xb27e('0x14')](_0xb27e('0x22'),_0x20e9b4,JSON[_0xb27e('0x16')](_0x450bf5));_0x4f93c0(_0x450bf5);})[_0xb27e('0x17')](function(_0x90d8dc){logger[_0xb27e('0xf')](_0xb27e('0x22'),_0x90d8dc[_0xb27e('0x10')],_0x20e9b4);_0x2d4f9f(_0x474f80[_0xb27e('0xf')](0x1f4,_0x90d8dc['message']));});});});};exports['MoveContactManagedDialer']=function(_0x2c9f17){var _0x43fd3c=this;return new Promise(function(_0x3e8d4c,_0x392a9f){return db[_0xb27e('0x24')][_0xb27e('0x25')](function(_0x424da7){return db[_0xb27e('0x32')][_0xb27e('0x18')](_0x2c9f17['body'],{'raw':_0x2c9f17['options']?_0x2c9f17[_0xb27e('0x8')][_0xb27e('0x9')]===undefined?!![]:![]:!![],'transaction':_0x424da7})[_0xb27e('0x13')](function(){logger[_0xb27e('0x1a')](_0xb27e('0x33'),JSON['stringify'](_0x2c9f17[_0xb27e('0x8')][_0xb27e('0x12')]),_0x2c9f17[_0xb27e('0x8')]['where']['active']);return db[_0xb27e('0x6')]['destroy']({'where':_0x2c9f17['options']?_0x2c9f17['options'][_0xb27e('0x12')]||null:null,'transaction':_0x424da7});});})[_0xb27e('0x13')](function(_0x1b24b9){logger[_0xb27e('0x1a')](_0xb27e('0x34'),_0x2c9f17);logger[_0xb27e('0x14')](_0xb27e('0x34'),_0x2c9f17,JSON[_0xb27e('0x16')](_0x1b24b9));_0x3e8d4c(_0x1b24b9);})[_0xb27e('0x17')](function(_0x53cc25){logger[_0xb27e('0xf')](_0xb27e('0x34'),_0x53cc25[_0xb27e('0x10')],_0x2c9f17);_0x392a9f(_0x43fd3c[_0xb27e('0xf')](0x1f4,_0x53cc25[_0xb27e('0x10')]));});});};exports[_0xb27e('0x35')]=function(_0xcda099){var _0x214ebe=this;return new Promise(function(_0x51d206,_0x566183){return db[_0xb27e('0x6')][_0xb27e('0x7')]({'raw':_0xcda099[_0xb27e('0x8')]?_0xcda099['options'][_0xb27e('0x9')]===undefined?!![]:![]:!![],'where':_0xcda099['options']?_0xcda099[_0xb27e('0x8')][_0xb27e('0x12')]||null:null,'attributes':[[db[_0xb27e('0x24')]['fn'](_0xb27e('0x36'),db[_0xb27e('0x24')]['fn']('IF',db['sequelize']['literal']('`scheduledat`\x20>=\x20'+util[_0xb27e('0x37')](_0xb27e('0x38'),moment()['format'](_0xb27e('0x39')))+_0xb27e('0x3a')))),'contactsRescheduled']]})[_0xb27e('0x13')](function(_0x45ff0b){logger[_0xb27e('0x1a')](_0xb27e('0x35'),_0xcda099);logger[_0xb27e('0x14')](_0xb27e('0x35'),_0xcda099,JSON[_0xb27e('0x16')](_0x45ff0b));_0x51d206(_0x45ff0b);})['catch'](function(_0x2151db){logger[_0xb27e('0xf')]('CountReScheduled',_0x2151db[_0xb27e('0x10')],_0xcda099);_0x566183(_0x214ebe[_0xb27e('0xf')](0x1f4,_0x2151db[_0xb27e('0x10')]));});});};exports[_0xb27e('0x3b')]=function(_0x579b84){var _0x36a95e=this;return new Promise(function(_0x18afd8,_0x59b686){return db[_0xb27e('0x23')][_0xb27e('0x3c')]()['then'](function(){return db[_0xb27e('0x24')][_0xb27e('0x25')](function(_0x3377dd){return db[_0xb27e('0x6')][_0xb27e('0x7')]({'where':_0x579b84[_0xb27e('0x8')]?_0x579b84[_0xb27e('0x8')]['where']||null:null,'attributes':_0x579b84['options']?_0x579b84[_0xb27e('0x8')][_0xb27e('0xa')]||null:null,'limit':0x1,'order':_0x579b84[_0xb27e('0x8')]?_0x579b84[_0xb27e('0x8')][_0xb27e('0x26')]||null:null,'group':db[_0xb27e('0x6')][_0xb27e('0x2b')],'transaction':_0x3377dd,'lock':_0x3377dd[_0xb27e('0x3d')][_0xb27e('0x3e')],'include':_0x579b84[_0xb27e('0x8')]?_0x579b84[_0xb27e('0x8')][_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x579b84[_0xb27e('0x8')]['include'],function(_0x46280e){return{'model':db[_0x46280e[_0xb27e('0xd')]],'as':_0x46280e['as'],'attributes':_0x46280e[_0xb27e('0xa')],'include':_0x46280e[_0xb27e('0xc')]?_['map'](_0x46280e[_0xb27e('0xc')],function(_0x3f6c73){return{'model':db[_0x3f6c73[_0xb27e('0xd')]],'as':_0x3f6c73['as'],'attributes':_0x3f6c73[_0xb27e('0xa')],'include':_0x3f6c73[_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x3f6c73[_0xb27e('0xc')],function(_0x2b687b){return{'model':db[_0x2b687b[_0xb27e('0xd')]],'as':_0x2b687b['as'],'attributes':_0x2b687b[_0xb27e('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x418826){var _0x32477e=[];for(var _0x610bbf=0x0;_0x610bbf<_0x418826[_0xb27e('0x3f')];_0x610bbf+=0x1){_0x32477e[_0xb27e('0x2c')](_0x418826[_0x610bbf][_0xb27e('0x1d')](_0x579b84[_0xb27e('0x19')],{'transaction':_0x3377dd}));}return BPromise[_0xb27e('0x2e')](_0x32477e);});})[_0xb27e('0x13')](function(_0x188abe){logger[_0xb27e('0x1a')](_0xb27e('0x3b'),_0x579b84);logger[_0xb27e('0x14')](_0xb27e('0x3b'),_0x579b84,JSON['stringify'](_0x188abe));_0x18afd8(_0x188abe);})[_0xb27e('0x17')](function(_0x1bc990){logger[_0xb27e('0xf')](_0xb27e('0x3b'),_0x1bc990[_0xb27e('0x10')],_0x579b84);_0x59b686(_0x36a95e[_0xb27e('0xf')](0x1f4,_0x1bc990[_0xb27e('0x10')]));});});});};exports[_0xb27e('0x40')]=function(_0x340aaa){var _0x3c9f15=this;return new Promise(function(_0xf966ee,_0x46a100){db[_0xb27e('0x23')][_0xb27e('0x3c')]()[_0xb27e('0x13')](function(_0x6dbf64){return db['CmHopper']['findAll']({'raw':_0x340aaa['options']?_0x340aaa[_0xb27e('0x8')][_0xb27e('0x9')]===undefined?!![]:![]:!![],'where':_0x340aaa[_0xb27e('0x8')]?_0x340aaa[_0xb27e('0x8')][_0xb27e('0x12')]||null:null,'attributes':_0x340aaa[_0xb27e('0x8')]?_0x340aaa[_0xb27e('0x8')][_0xb27e('0xa')]||null:null,'limit':_0x340aaa[_0xb27e('0x8')]?_0x340aaa[_0xb27e('0x8')][_0xb27e('0xb')]||null:null,'include':_0x340aaa[_0xb27e('0x8')]?_0x340aaa[_0xb27e('0x8')][_0xb27e('0xc')]?_[_0xb27e('0xe')](_0x340aaa[_0xb27e('0x8')][_0xb27e('0xc')],function(_0x2dfed8){return{'model':db[_0x2dfed8[_0xb27e('0xd')]],'as':_0x2dfed8['as'],'attributes':_0x2dfed8['as']===_0xb27e('0x27')?_[_0xb27e('0x28')](_0x6dbf64):_0x2dfed8[_0xb27e('0xa')],'include':_0x2dfed8[_0xb27e('0xc')]?_['map'](_0x2dfed8[_0xb27e('0xc')],function(_0x18fe5b){return{'model':db[_0x18fe5b['model']],'as':_0x18fe5b['as'],'attributes':_0x18fe5b['attributes'],'include':_0x18fe5b['include']?_['map'](_0x18fe5b['include'],function(_0x8279a6){return{'model':db[_0x8279a6['model']],'as':_0x8279a6['as'],'attributes':_0x8279a6[_0xb27e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb27e('0x13')](function(_0x1571b6){logger[_0xb27e('0x1a')](_0xb27e('0x5'),_0x340aaa);logger[_0xb27e('0x14')](_0xb27e('0x5'),_0x340aaa,JSON[_0xb27e('0x16')](_0x1571b6));_0xf966ee(_0x1571b6);})[_0xb27e('0x17')](function(_0xfd522f){logger[_0xb27e('0xf')](_0xb27e('0x5'),_0xfd522f[_0xb27e('0x10')],_0x340aaa);_0x46a100(_0x3c9f15['error'](0x1f4,_0xfd522f['message']));});});});};exports[_0xb27e('0x41')]=function(_0x2e8156){var _0x5d1405=this;return new Promise(function(_0x453d0b,_0xb3ffa0){return db[_0xb27e('0x23')][_0xb27e('0x42')]({'raw':!![],'where':{'phone':_0x2e8156[_0xb27e('0x8')][_0xb27e('0x12')][_0xb27e('0x43')]},'attributes':['id',_0xb27e('0x44')],'order':[['id','DESC']]})['then'](function(_0x99f586){logger[_0xb27e('0x1a')](_0xb27e('0x45'),_0x2e8156);logger[_0xb27e('0x14')](_0xb27e('0x45'),_0x2e8156,JSON[_0xb27e('0x16')](_0x99f586));_0x453d0b(_0x99f586);})[_0xb27e('0x17')](function(_0x5cbc55){logger[_0xb27e('0xf')](_0xb27e('0x45'),_0x5cbc55[_0xb27e('0x10')],_0x2e8156);_0xb3ffa0(_0x5d1405[_0xb27e('0xf')](0x1f4,_0x5cbc55[_0xb27e('0x10')]));});});};exports[_0xb27e('0x46')]=function(_0x125cfd){var _0x3adc20=this;return new Promise(function(_0x4949a4,_0x138ad2){return db[_0xb27e('0x24')]['transaction'](function(_0x80715f){var _0x1ce1d2=_0x125cfd[_0xb27e('0x8')]&&_0x125cfd[_0xb27e('0x8')][_0xb27e('0x12')]?_0x125cfd[_0xb27e('0x8')][_0xb27e('0x12')]:{};return db[_0xb27e('0x6')][_0xb27e('0x1d')](_0x125cfd[_0xb27e('0x19')],{'where':_0x1ce1d2,'transaction':_0x80715f})[_0xb27e('0x13')](function(_0x15f7b0){logger['info'](_0xb27e('0x46'),_0x125cfd);logger[_0xb27e('0x14')](_0xb27e('0x46'),_0x125cfd,JSON['stringify'](_0x15f7b0));_0x4949a4(_0x15f7b0);})[_0xb27e('0x17')](function(_0x83d3b1){logger['error'](_0xb27e('0x46'),_0x83d3b1[_0xb27e('0x10')],_0x125cfd);_0x138ad2(_0x3adc20[_0xb27e('0xf')](0x1f4,_0x83d3b1[_0xb27e('0x10')]));});});});};exports[_0xb27e('0x47')]=function(_0xf951ab){var _0x141ee8=this;var _0x107942=_0xf951ab[_0xb27e('0x19')][_0xb27e('0x12')][_0xb27e('0x48')];var _0x2a6090=_0xf951ab[_0xb27e('0x19')][_0xb27e('0x12')]['interval'];var _0xee4800=_0xf951ab[_0xb27e('0x19')][_0xb27e('0x12')][_0xb27e('0x49')];return new Promise(function(_0x10a8fa,_0xc09b54){return db[_0xb27e('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x107942},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb27e('0x24')][_0xb27e('0x4a')]('NOW()\x20+\x20INTERVAL\x20'+_0x2a6090+_0xb27e('0x4b')),'$gt':db[_0xb27e('0x24')][_0xb27e('0x4a')](_0xb27e('0x4c'))}},'UserId':{'$in':_0xee4800}},'include':[{'model':db[_0xb27e('0x23')],'as':_0xb27e('0x27')},{'model':db[_0xb27e('0x4d')],'as':_0xb27e('0x4e'),'attributes':['id','name',_0xb27e('0x2a')]},{'model':db[_0xb27e('0x4f')],'as':_0xb27e('0x50')}]})[_0xb27e('0x13')](function(_0x2b5772){if(_0x2b5772[_0xb27e('0x3f')]>0x0){return db[_0xb27e('0x24')][_0xb27e('0x25')](function(_0x395eca){return db['CmHopper'][_0xb27e('0x1d')]({'recallmeNotifiedDate':db[_0xb27e('0x24')][_0xb27e('0x4a')](_0xb27e('0x4c'))},{'where':{'id':{'$in':_[_0xb27e('0xe')](_0x2b5772,'id')}},'transaction':_0x395eca})[_0xb27e('0x13')](function(){_0x10a8fa(_0x2b5772);})[_0xb27e('0x17')](function(_0x501f3a){logger[_0xb27e('0xf')](_0xb27e('0x47'),_0x501f3a[_0xb27e('0x10')],_0xf951ab);_0xc09b54(_0x141ee8[_0xb27e('0xf')](0x1f4,_0x501f3a[_0xb27e('0x10')]));});})['catch'](function(_0x22b98a){logger[_0xb27e('0xf')](_0xb27e('0x47'),_0x22b98a['message'],_0xf951ab);_0xc09b54(_0x141ee8[_0xb27e('0xf')](0x1f4,_0x22b98a[_0xb27e('0x10')]));});}else{_0x10a8fa(_0x2b5772);}});});}; \ No newline at end of file +var _0xa8fd=['destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UPDATE','all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','Agent','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','error','GetCmHopper','message','ShowCmHopper','debug','catch','CreateCmHopper','create','body','update','UpdateCmHopper','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','name','voicePause','UserId','includes','push','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal'];(function(_0x595798,_0x10d9fb){var _0x319187=function(_0x3cb628){while(--_0x3cb628){_0x595798['push'](_0x595798['shift']());}};_0x319187(++_0x10d9fb);}(_0xa8fd,0x69));var _0xda8f=function(_0x2ff51a,_0x5a3674){_0x2ff51a=_0x2ff51a-0x0;var _0x1ffabc=_0xa8fd[_0x2ff51a];return _0x1ffabc;};'use strict';var _=require('lodash');var util=require(_0xda8f('0x0'));var moment=require(_0xda8f('0x1'));var BPromise=require(_0xda8f('0x2'));var db=require(_0xda8f('0x3'))['db'];var logger=require(_0xda8f('0x4'))(_0xda8f('0x5'));exports['GetCmHopper']=function(_0x26eb5e){var _0x10e198=this;return new Promise(function(_0x5b5392,_0x221417){return db[_0xda8f('0x6')][_0xda8f('0x7')]({'raw':_0x26eb5e[_0xda8f('0x8')]?_0x26eb5e['options'][_0xda8f('0x9')]===undefined?!![]:![]:!![],'where':_0x26eb5e['options']?_0x26eb5e['options'][_0xda8f('0xa')]||null:null,'attributes':_0x26eb5e[_0xda8f('0x8')]?_0x26eb5e['options'][_0xda8f('0xb')]||null:null,'limit':_0x26eb5e[_0xda8f('0x8')]?_0x26eb5e[_0xda8f('0x8')][_0xda8f('0xc')]||null:null,'include':_0x26eb5e[_0xda8f('0x8')]?_0x26eb5e['options'][_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x26eb5e[_0xda8f('0x8')][_0xda8f('0xd')],function(_0x163d11){return{'model':db[_0x163d11[_0xda8f('0xf')]],'as':_0x163d11['as'],'attributes':_0x163d11['attributes'],'include':_0x163d11[_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x163d11[_0xda8f('0xd')],function(_0x562ff5){return{'model':db[_0x562ff5[_0xda8f('0xf')]],'as':_0x562ff5['as'],'attributes':_0x562ff5[_0xda8f('0xb')],'include':_0x562ff5[_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x562ff5[_0xda8f('0xd')],function(_0x39efb7){return{'model':db[_0x39efb7[_0xda8f('0xf')]],'as':_0x39efb7['as'],'attributes':_0x39efb7[_0xda8f('0xb')]};}):[]};}):[]};}):[]:[]})[_0xda8f('0x10')](function(_0x403f91){logger[_0xda8f('0x11')]('GetCmHopper',_0x26eb5e);logger['debug']('GetCmHopper',_0x26eb5e,JSON[_0xda8f('0x12')](_0x403f91));_0x5b5392(_0x403f91);})['catch'](function(_0x3e9c6c){logger[_0xda8f('0x13')](_0xda8f('0x14'),_0x3e9c6c[_0xda8f('0x15')],_0x26eb5e);_0x221417(_0x10e198[_0xda8f('0x13')](0x1f4,_0x3e9c6c[_0xda8f('0x15')]));});});};exports[_0xda8f('0x16')]=function(_0x5abe5b){var _0x191013=this;return new Promise(function(_0x226861,_0x2b250d){return db[_0xda8f('0x6')]['find']({'raw':_0x5abe5b[_0xda8f('0x8')]?_0x5abe5b[_0xda8f('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5abe5b[_0xda8f('0x8')]?_0x5abe5b['options'][_0xda8f('0xa')]||null:null,'attributes':_0x5abe5b['options']?_0x5abe5b[_0xda8f('0x8')]['attributes']||null:null,'include':_0x5abe5b[_0xda8f('0x8')]?_0x5abe5b[_0xda8f('0x8')][_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x5abe5b[_0xda8f('0x8')]['include'],function(_0x4c8f25){return{'model':db[_0x4c8f25[_0xda8f('0xf')]],'as':_0x4c8f25['as'],'attributes':_0x4c8f25[_0xda8f('0xb')],'include':_0x4c8f25[_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x4c8f25['include'],function(_0x55865c){return{'model':db[_0x55865c['model']],'as':_0x55865c['as'],'attributes':_0x55865c[_0xda8f('0xb')],'include':_0x55865c[_0xda8f('0xd')]?_['map'](_0x55865c[_0xda8f('0xd')],function(_0x1f7eec){return{'model':db[_0x1f7eec['model']],'as':_0x1f7eec['as'],'attributes':_0x1f7eec[_0xda8f('0xb')]};}):[]};}):[]};}):[]:[]})[_0xda8f('0x10')](function(_0x3c086){logger[_0xda8f('0x11')]('ShowCmHopper',_0x5abe5b);logger[_0xda8f('0x17')](_0xda8f('0x16'),_0x5abe5b,JSON[_0xda8f('0x12')](_0x3c086));_0x226861(_0x3c086);})[_0xda8f('0x18')](function(_0x2bd959){logger[_0xda8f('0x13')](_0xda8f('0x16'),_0x2bd959[_0xda8f('0x15')],_0x5abe5b);_0x2b250d(_0x191013['error'](0x1f4,_0x2bd959['message']));});});};exports[_0xda8f('0x19')]=function(_0x1ba035){var _0x31ca33=this;return new Promise(function(_0x3bd100,_0x1efeff){return db[_0xda8f('0x6')][_0xda8f('0x1a')](_0x1ba035[_0xda8f('0x1b')],{'raw':_0x1ba035[_0xda8f('0x8')]?_0x1ba035[_0xda8f('0x8')]['raw']===undefined?!![]:![]:!![]})[_0xda8f('0x10')](function(_0x23e87a){logger['info'](_0xda8f('0x19'),_0x1ba035);logger[_0xda8f('0x17')](_0xda8f('0x19'),_0x1ba035,JSON[_0xda8f('0x12')](_0x23e87a));_0x3bd100(_0x23e87a);})[_0xda8f('0x18')](function(_0x2ceee9){logger[_0xda8f('0x13')](_0xda8f('0x19'),_0x2ceee9[_0xda8f('0x15')],_0x1ba035);_0x1efeff(_0x31ca33[_0xda8f('0x13')](0x1f4,_0x2ceee9['message']));});});};exports['UpdateCmHopper']=function(_0x212e31){var _0x306459=this;return new Promise(function(_0x55bffb,_0x54aa25){return db[_0xda8f('0x6')][_0xda8f('0x1c')](_0x212e31[_0xda8f('0x1b')],{'raw':_0x212e31[_0xda8f('0x8')]?_0x212e31[_0xda8f('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212e31[_0xda8f('0x8')]?_0x212e31[_0xda8f('0x8')][_0xda8f('0xa')]||null:null,'attributes':_0x212e31[_0xda8f('0x8')]?_0x212e31[_0xda8f('0x8')]['attributes']||null:null,'limit':_0x212e31['options']?_0x212e31[_0xda8f('0x8')][_0xda8f('0xc')]||null:null})['then'](function(_0x2e5288){logger[_0xda8f('0x11')](_0xda8f('0x1d'),_0x212e31);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xda8f('0x12')](_0x212e31[_0xda8f('0x8')][_0xda8f('0xa')]),_0x212e31[_0xda8f('0x1b')][_0xda8f('0x1e')]);logger[_0xda8f('0x17')](_0xda8f('0x1d'),_0x212e31,JSON['stringify'](_0x2e5288));_0x55bffb(_0x2e5288);})[_0xda8f('0x18')](function(_0x2e600e){logger['error'](_0xda8f('0x1d'),_0x2e600e[_0xda8f('0x15')],_0x212e31);_0x54aa25(_0x306459[_0xda8f('0x13')](0x1f4,_0x2e600e['message']));});});};exports['DestroyCmHopper']=function(_0x5985d5){var _0x55c511=this;return new Promise(function(_0x5185f6,_0x1929d6){return db[_0xda8f('0x6')]['destroy']({'where':_0x5985d5[_0xda8f('0x8')]?_0x5985d5['options'][_0xda8f('0xa')]||null:null})['then'](function(_0x475644){logger['info'](_0xda8f('0x1f'),_0x5985d5);logger[_0xda8f('0x17')]('DestroyCmHopper',_0x5985d5,JSON['stringify'](_0x475644));_0x5185f6(_0x475644);})[_0xda8f('0x18')](function(_0x4ac96c){logger['error'](_0xda8f('0x1f'),_0x4ac96c[_0xda8f('0x15')],_0x5985d5);_0x1929d6(_0x55c511['error'](0x1f4,_0x4ac96c[_0xda8f('0x15')]));});});};exports[_0xda8f('0x20')]=function(_0x56aa39){var _0x1134b8=this;return new Promise(function(_0x3da088,_0x4e7909){return db[_0xda8f('0x21')][_0xda8f('0x22')]()['then'](function(_0x5eefef){return db[_0xda8f('0x23')][_0xda8f('0x24')](function(_0x52b77e){return db[_0xda8f('0x6')][_0xda8f('0x7')]({'where':_0x56aa39[_0xda8f('0x8')]?_0x56aa39[_0xda8f('0x8')][_0xda8f('0xa')]||null:null,'attributes':_0x56aa39[_0xda8f('0x8')]?_0x56aa39[_0xda8f('0x8')][_0xda8f('0xb')]||null:null,'limit':_0x56aa39['options']?_0x56aa39[_0xda8f('0x8')]['limit']||null:null,'order':_0x56aa39[_0xda8f('0x8')]?_0x56aa39[_0xda8f('0x8')][_0xda8f('0x25')]||null:null,'transaction':_0x52b77e,'lock':_0x52b77e[_0xda8f('0x26')]['UPDATE'],'include':[{'model':db[_0xda8f('0x21')],'as':_0xda8f('0x27'),'attributes':_[_0xda8f('0x28')](_0x5eefef)},{'model':db[_0xda8f('0x29')],'as':'Agent','attributes':['id',_0xda8f('0x2a'),_0xda8f('0x2b')]}]})['then'](function(_0x69d97a){var _0x143d42=[];var _0x16c0be=[];for(var _0x365abb=0x0;_0x365abb<_0x69d97a['length'];_0x365abb+=0x1){var _0x53b07f=_0x69d97a[_0x365abb][_0xda8f('0x2c')];if(_0x53b07f===null){_0x143d42['push'](_0x69d97a[_0x365abb][_0xda8f('0x1c')](_0x56aa39[_0xda8f('0x1b')],{'transaction':_0x52b77e}));}else if(!_0x16c0be[_0xda8f('0x2d')](_0x53b07f)){_0x16c0be[_0xda8f('0x2e')](_0x53b07f);_0x143d42[_0xda8f('0x2e')](_0x69d97a[_0x365abb]['update'](_0x56aa39['body'],{'transaction':_0x52b77e}));}}return BPromise['all'](_0x143d42);});})[_0xda8f('0x10')](function(_0x174439){logger[_0xda8f('0x11')](_0xda8f('0x20'),_0x56aa39);if(_0x174439[_0xda8f('0x2f')]>0x0){logger['info'](_0xda8f('0x30'),_0x174439[0x0][_0xda8f('0x31')]['id'],_0x174439[0x0][_0xda8f('0x31')][_0xda8f('0x32')],_0x174439[0x0]['dataValues'][_0xda8f('0x1e')]);}logger[_0xda8f('0x17')](_0xda8f('0x20'),_0x56aa39,JSON[_0xda8f('0x12')](_0x174439));_0x3da088(_0x174439);})['catch'](function(_0x1e8599){logger[_0xda8f('0x13')](_0xda8f('0x20'),_0x1e8599['message'],_0x56aa39);_0x4e7909(_0x1134b8[_0xda8f('0x13')](0x1f4,_0x1e8599[_0xda8f('0x15')]));});});});};exports[_0xda8f('0x33')]=function(_0x36f0dd){var _0x42eb7b=this;return new Promise(function(_0x3c2f3d,_0x3583c4){return db[_0xda8f('0x23')]['transaction'](function(_0x5b2bec){return db[_0xda8f('0x34')][_0xda8f('0x1a')](_0x36f0dd[_0xda8f('0x1b')],{'raw':_0x36f0dd[_0xda8f('0x8')]?_0x36f0dd[_0xda8f('0x8')][_0xda8f('0x9')]===undefined?!![]:![]:!![],'transaction':_0x5b2bec})[_0xda8f('0x10')](function(){logger[_0xda8f('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xda8f('0x12')](_0x36f0dd[_0xda8f('0x8')]['where']),_0x36f0dd[_0xda8f('0x8')][_0xda8f('0xa')][_0xda8f('0x1e')]);return db[_0xda8f('0x6')][_0xda8f('0x35')]({'where':_0x36f0dd[_0xda8f('0x8')]?_0x36f0dd[_0xda8f('0x8')][_0xda8f('0xa')]||null:null,'transaction':_0x5b2bec});});})[_0xda8f('0x10')](function(_0x4467dc){logger['info']('MoveContactManagedDialer',_0x36f0dd);logger[_0xda8f('0x17')]('MoveContactManagedDialer',_0x36f0dd,JSON[_0xda8f('0x12')](_0x4467dc));_0x3c2f3d(_0x4467dc);})[_0xda8f('0x18')](function(_0x495add){logger['error'](_0xda8f('0x33'),_0x495add['message'],_0x36f0dd);_0x3583c4(_0x42eb7b[_0xda8f('0x13')](0x1f4,_0x495add[_0xda8f('0x15')]));});});};exports[_0xda8f('0x36')]=function(_0x4f548a){var _0x2aaca0=this;return new Promise(function(_0x1b710f,_0x3116e9){return db[_0xda8f('0x6')][_0xda8f('0x7')]({'raw':_0x4f548a[_0xda8f('0x8')]?_0x4f548a[_0xda8f('0x8')][_0xda8f('0x9')]===undefined?!![]:![]:!![],'where':_0x4f548a[_0xda8f('0x8')]?_0x4f548a[_0xda8f('0x8')]['where']||null:null,'attributes':[[db[_0xda8f('0x23')]['fn'](_0xda8f('0x37'),db[_0xda8f('0x23')]['fn']('IF',db[_0xda8f('0x23')][_0xda8f('0x38')](_0xda8f('0x39')+util['format'](_0xda8f('0x3a'),moment()[_0xda8f('0x3b')](_0xda8f('0x3c')))+_0xda8f('0x3d')))),_0xda8f('0x3e')]]})[_0xda8f('0x10')](function(_0x4e950a){logger[_0xda8f('0x11')](_0xda8f('0x36'),_0x4f548a);logger['debug'](_0xda8f('0x36'),_0x4f548a,JSON[_0xda8f('0x12')](_0x4e950a));_0x1b710f(_0x4e950a);})[_0xda8f('0x18')](function(_0x15baed){logger['error'](_0xda8f('0x36'),_0x15baed['message'],_0x4f548a);_0x3116e9(_0x2aaca0[_0xda8f('0x13')](0x1f4,_0x15baed[_0xda8f('0x15')]));});});};exports['GetContactRecallMe']=function(_0x785b56){var _0x263423=this;return new Promise(function(_0x2d1ca9,_0x265556){return db[_0xda8f('0x21')][_0xda8f('0x22')]()['then'](function(){return db[_0xda8f('0x23')]['transaction'](function(_0x39dac3){return db[_0xda8f('0x6')]['findAll']({'where':_0x785b56[_0xda8f('0x8')]?_0x785b56[_0xda8f('0x8')][_0xda8f('0xa')]||null:null,'attributes':_0x785b56['options']?_0x785b56[_0xda8f('0x8')][_0xda8f('0xb')]||null:null,'limit':0x1,'order':_0x785b56[_0xda8f('0x8')]?_0x785b56[_0xda8f('0x8')]['order']||null:null,'group':db[_0xda8f('0x6')][_0xda8f('0x2c')],'transaction':_0x39dac3,'lock':_0x39dac3[_0xda8f('0x26')][_0xda8f('0x3f')],'include':_0x785b56['options']?_0x785b56[_0xda8f('0x8')][_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x785b56[_0xda8f('0x8')][_0xda8f('0xd')],function(_0x9c30ad){return{'model':db[_0x9c30ad['model']],'as':_0x9c30ad['as'],'attributes':_0x9c30ad['attributes'],'include':_0x9c30ad['include']?_['map'](_0x9c30ad[_0xda8f('0xd')],function(_0x387ff6){return{'model':db[_0x387ff6['model']],'as':_0x387ff6['as'],'attributes':_0x387ff6[_0xda8f('0xb')],'include':_0x387ff6[_0xda8f('0xd')]?_['map'](_0x387ff6[_0xda8f('0xd')],function(_0x24d354){return{'model':db[_0x24d354['model']],'as':_0x24d354['as'],'attributes':_0x24d354['attributes']};}):[]};}):[]};}):[]:[]})[_0xda8f('0x10')](function(_0x586afb){var _0x2a2454=[];for(var _0x455895=0x0;_0x455895<_0x586afb[_0xda8f('0x2f')];_0x455895+=0x1){_0x2a2454[_0xda8f('0x2e')](_0x586afb[_0x455895][_0xda8f('0x1c')](_0x785b56[_0xda8f('0x1b')],{'transaction':_0x39dac3}));}return BPromise[_0xda8f('0x40')](_0x2a2454);});})[_0xda8f('0x10')](function(_0x360755){logger[_0xda8f('0x11')]('GetContactRecallMe',_0x785b56);logger[_0xda8f('0x17')]('GetContactRecallMe',_0x785b56,JSON[_0xda8f('0x12')](_0x360755));_0x2d1ca9(_0x360755);})[_0xda8f('0x18')](function(_0x343e52){logger['error'](_0xda8f('0x41'),_0x343e52['message'],_0x785b56);_0x265556(_0x263423['error'](0x1f4,_0x343e52[_0xda8f('0x15')]));});});});};exports[_0xda8f('0x42')]=function(_0x22c854){var _0x24ef67=this;return new Promise(function(_0x4b063f,_0x194f8d){db[_0xda8f('0x21')][_0xda8f('0x22')]()['then'](function(_0x238f92){return db[_0xda8f('0x6')][_0xda8f('0x7')]({'raw':_0x22c854[_0xda8f('0x8')]?_0x22c854[_0xda8f('0x8')][_0xda8f('0x9')]===undefined?!![]:![]:!![],'where':_0x22c854[_0xda8f('0x8')]?_0x22c854[_0xda8f('0x8')][_0xda8f('0xa')]||null:null,'attributes':_0x22c854[_0xda8f('0x8')]?_0x22c854[_0xda8f('0x8')][_0xda8f('0xb')]||null:null,'limit':_0x22c854[_0xda8f('0x8')]?_0x22c854['options'][_0xda8f('0xc')]||null:null,'include':_0x22c854[_0xda8f('0x8')]?_0x22c854[_0xda8f('0x8')]['include']?_[_0xda8f('0xe')](_0x22c854[_0xda8f('0x8')]['include'],function(_0x44f66d){return{'model':db[_0x44f66d[_0xda8f('0xf')]],'as':_0x44f66d['as'],'attributes':_0x44f66d['as']===_0xda8f('0x27')?_[_0xda8f('0x28')](_0x238f92):_0x44f66d[_0xda8f('0xb')],'include':_0x44f66d[_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x44f66d[_0xda8f('0xd')],function(_0x1c3d10){return{'model':db[_0x1c3d10[_0xda8f('0xf')]],'as':_0x1c3d10['as'],'attributes':_0x1c3d10[_0xda8f('0xb')],'include':_0x1c3d10[_0xda8f('0xd')]?_[_0xda8f('0xe')](_0x1c3d10[_0xda8f('0xd')],function(_0x3d8904){return{'model':db[_0x3d8904[_0xda8f('0xf')]],'as':_0x3d8904['as'],'attributes':_0x3d8904['attributes']};}):[]};}):[]};}):[]:[]})[_0xda8f('0x10')](function(_0x290cf8){logger[_0xda8f('0x11')]('GetCmHopper',_0x22c854);logger[_0xda8f('0x17')]('GetCmHopper',_0x22c854,JSON[_0xda8f('0x12')](_0x290cf8));_0x4b063f(_0x290cf8);})[_0xda8f('0x18')](function(_0xc4b716){logger[_0xda8f('0x13')](_0xda8f('0x14'),_0xc4b716[_0xda8f('0x15')],_0x22c854);_0x194f8d(_0x24ef67[_0xda8f('0x13')](0x1f4,_0xc4b716[_0xda8f('0x15')]));});});});};exports[_0xda8f('0x43')]=function(_0x5f025d){var _0x48774a=this;return new Promise(function(_0x24edfc,_0x15a4fb){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x5f025d[_0xda8f('0x8')]['where'][_0xda8f('0x44')]},'attributes':['id',_0xda8f('0x45')],'order':[['id','DESC']]})['then'](function(_0xf913a3){logger[_0xda8f('0x11')](_0xda8f('0x46'),_0x5f025d);logger['debug'](_0xda8f('0x46'),_0x5f025d,JSON['stringify'](_0xf913a3));_0x24edfc(_0xf913a3);})[_0xda8f('0x18')](function(_0x4e2012){logger[_0xda8f('0x13')](_0xda8f('0x46'),_0x4e2012[_0xda8f('0x15')],_0x5f025d);_0x15a4fb(_0x48774a[_0xda8f('0x13')](0x1f4,_0x4e2012[_0xda8f('0x15')]));});});};exports[_0xda8f('0x47')]=function(_0x3bfd73){var _0x2b5bed=this;return new Promise(function(_0x1ba639,_0x4fdc83){return db['sequelize'][_0xda8f('0x24')](function(_0x38188a){var _0x26cb22=_0x3bfd73[_0xda8f('0x8')]&&_0x3bfd73[_0xda8f('0x8')][_0xda8f('0xa')]?_0x3bfd73[_0xda8f('0x8')]['where']:{};return db['CmHopper'][_0xda8f('0x1c')](_0x3bfd73[_0xda8f('0x1b')],{'where':_0x26cb22,'transaction':_0x38188a})[_0xda8f('0x10')](function(_0x2a80e1){logger[_0xda8f('0x11')](_0xda8f('0x47'),_0x3bfd73);logger[_0xda8f('0x17')](_0xda8f('0x47'),_0x3bfd73,JSON[_0xda8f('0x12')](_0x2a80e1));_0x1ba639(_0x2a80e1);})[_0xda8f('0x18')](function(_0x59164d){logger['error']('ResetActiveCalls',_0x59164d[_0xda8f('0x15')],_0x3bfd73);_0x4fdc83(_0x2b5bed[_0xda8f('0x13')](0x1f4,_0x59164d[_0xda8f('0x15')]));});});});};exports[_0xda8f('0x48')]=function(_0x31d0c4){var _0x205c45=this;var _0x311837=_0x31d0c4[_0xda8f('0x1b')][_0xda8f('0xa')]['voiceQueueIds'];var _0x1de696=_0x31d0c4[_0xda8f('0x1b')][_0xda8f('0xa')][_0xda8f('0x49')];var _0x42ce4a=_0x31d0c4['body']['where'][_0xda8f('0x4a')];return new Promise(function(_0x14e4d5,_0x429f76){return db[_0xda8f('0x6')][_0xda8f('0x7')]({'where':{'voiceQueueId':{'$in':_0x311837},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xda8f('0x23')][_0xda8f('0x38')]('NOW()\x20+\x20INTERVAL\x20'+_0x1de696+_0xda8f('0x4b')),'$gt':db['sequelize'][_0xda8f('0x38')](_0xda8f('0x4c'))}},'UserId':{'$in':_0x42ce4a}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xda8f('0x29')],'as':_0xda8f('0x4d'),'attributes':['id',_0xda8f('0x2a'),'voicePause']},{'model':db[_0xda8f('0x4e')],'as':'List'}]})['then'](function(_0x5af64f){if(_0x5af64f[_0xda8f('0x2f')]>0x0){return db[_0xda8f('0x23')][_0xda8f('0x24')](function(_0xa0b26c){return db['CmHopper'][_0xda8f('0x1c')]({'recallmeNotifiedDate':db[_0xda8f('0x23')][_0xda8f('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0xda8f('0xe')](_0x5af64f,'id')}},'transaction':_0xa0b26c})[_0xda8f('0x10')](function(){_0x14e4d5(_0x5af64f);})['catch'](function(_0x2c5585){logger[_0xda8f('0x13')](_0xda8f('0x48'),_0x2c5585['message'],_0x31d0c4);_0x429f76(_0x205c45['error'](0x1f4,_0x2c5585[_0xda8f('0x15')]));});})[_0xda8f('0x18')](function(_0x2b6fd7){logger[_0xda8f('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x2b6fd7[_0xda8f('0x15')],_0x31d0c4);_0x429f76(_0x205c45['error'](0x1f4,_0x2b6fd7[_0xda8f('0x15')]));});}else{_0x14e4d5(_0x5af64f);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 72ec632..6652995 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 _0xe4a1=['getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show','getPreviewRecall','post','/preview','getPreview','/timezone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4a1,0x17c));var _0x1e4a=function(_0x24257c,_0x7e09){_0x24257c=_0x24257c-0x0;var _0x14a40b=_0xe4a1[_0x24257c];return _0x14a40b;};'use strict';var express=require(_0x1e4a('0x0'));var router=express[_0x1e4a('0x1')]();var auth=require(_0x1e4a('0x2'));var controller=require('./cmHopper.controller');router[_0x1e4a('0x3')]('/',auth[_0x1e4a('0x4')](),controller[_0x1e4a('0x5')]);router[_0x1e4a('0x3')]('/describe',auth[_0x1e4a('0x4')](),controller[_0x1e4a('0x6')]);router[_0x1e4a('0x3')](_0x1e4a('0x7'),auth[_0x1e4a('0x4')](),controller[_0x1e4a('0x8')]);router[_0x1e4a('0x3')]('/timezones',auth[_0x1e4a('0x4')](),controller['getTimezones']);router[_0x1e4a('0x3')](_0x1e4a('0x9'),auth['isAuthenticated'](),controller[_0x1e4a('0xa')]);router[_0x1e4a('0x3')]('/:id/previewrecall',auth[_0x1e4a('0x4')](),controller[_0x1e4a('0xb')]);router[_0x1e4a('0xc')]('/',auth[_0x1e4a('0x4')](),controller['create']);router[_0x1e4a('0xc')](_0x1e4a('0xd'),auth[_0x1e4a('0x4')](),controller[_0x1e4a('0xe')]);router[_0x1e4a('0xc')](_0x1e4a('0xf'),auth['isAuthenticated'](),controller[_0x1e4a('0x10')]);router[_0x1e4a('0x11')](_0x1e4a('0x9'),auth[_0x1e4a('0x4')](),controller[_0x1e4a('0x12')]);router[_0x1e4a('0x13')](_0x1e4a('0x9'),auth[_0x1e4a('0x4')](),controller[_0x1e4a('0x14')]);module[_0x1e4a('0x15')]=router; \ No newline at end of file +var _0x86ff=['/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy','exports','express','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x86ff,0x1c1));var _0xf86f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86ff[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xf86f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0xf86f('0x1')]('/',auth[_0xf86f('0x2')](),controller[_0xf86f('0x3')]);router[_0xf86f('0x1')](_0xf86f('0x4'),auth['isAuthenticated'](),controller['describe']);router[_0xf86f('0x1')](_0xf86f('0x5'),auth[_0xf86f('0x2')](),controller[_0xf86f('0x6')]);router[_0xf86f('0x1')](_0xf86f('0x7'),auth[_0xf86f('0x2')](),controller[_0xf86f('0x8')]);router[_0xf86f('0x1')](_0xf86f('0x9'),auth[_0xf86f('0x2')](),controller[_0xf86f('0xa')]);router[_0xf86f('0x1')](_0xf86f('0xb'),auth[_0xf86f('0x2')](),controller[_0xf86f('0xc')]);router[_0xf86f('0xd')]('/',auth['isAuthenticated'](),controller[_0xf86f('0xe')]);router[_0xf86f('0xd')](_0xf86f('0xf'),auth[_0xf86f('0x2')](),controller[_0xf86f('0x10')]);router[_0xf86f('0xd')](_0xf86f('0x11'),auth['isAuthenticated'](),controller['getTimezone']);router[_0xf86f('0x12')]('/:id',auth[_0xf86f('0x2')](),controller[_0xf86f('0x13')]);router[_0xf86f('0x14')](_0xf86f('0x9'),auth[_0xf86f('0x2')](),controller[_0xf86f('0x15')]);module[_0xf86f('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index fb17b31..6c44ba3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x613f=['INTEGER','STRING','DATE','format','moment','sequelize','exports'];(function(_0x3e729a,_0x47254e){var _0x437950=function(_0x19636c){while(--_0x19636c){_0x3e729a['push'](_0x3e729a['shift']());}};_0x437950(++_0x47254e);}(_0x613f,0x1b6));var _0xf613=function(_0x371d0e,_0x2adb2e){_0x371d0e=_0x371d0e-0x0;var _0x4412ed=_0x613f[_0x371d0e];return _0x4412ed;};'use strict';var moment=require(_0xf613('0x0'));var Sequelize=require(_0xf613('0x1'));module[_0xf613('0x2')]={'CmHopperId':{'type':Sequelize[_0xf613('0x3')]},'phone':{'type':Sequelize[_0xf613('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf613('0x5')],'defaultValue':moment()[_0xf613('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf613('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf613('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf613('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf613('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf613('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x686c=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x686c,0x147));var _0xc686=function(_0x4e7261,_0x5d624d){_0x4e7261=_0x4e7261-0x0;var _0x37d87b=_0x686c[_0x4e7261];return _0x37d87b;};'use strict';var moment=require(_0xc686('0x0'));var Sequelize=require(_0xc686('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xc686('0x2')]},'phone':{'type':Sequelize[_0xc686('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc686('0x4')],'defaultValue':moment()[_0xc686('0x5')](_0xc686('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc686('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc686('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc686('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc686('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc686('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 545a9de..9f8587c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06af=['catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x06af,0x1a2));var _0xf06a=function(_0x4eb40b,_0x4dfbd9){_0x4eb40b=_0x4eb40b-0x0;var _0x4101f3=_0x06af[_0x4eb40b];return _0x4101f3;};'use strict';var emlformat=require(_0xf06a('0x0'));var rimraf=require(_0xf06a('0x1'));var zipdir=require(_0xf06a('0x2'));var jsonpatch=require(_0xf06a('0x3'));var rp=require('request-promise');var moment=require(_0xf06a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf06a('0x5'));var path=require(_0xf06a('0x6'));var sox=require(_0xf06a('0x7'));var csv=require(_0xf06a('0x8'));var ejs=require(_0xf06a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf06a('0xa'));var squel=require(_0xf06a('0xb'));var crypto=require(_0xf06a('0xc'));var jsforce=require(_0xf06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf06a('0x8'));var querystring=require('querystring');var Papa=require(_0xf06a('0xe'));var Redis=require(_0xf06a('0xf'));var authService=require(_0xf06a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf06a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf06a('0x12'))(_0xf06a('0x13'));var utils=require(_0xf06a('0x14'));var config=require(_0xf06a('0x15'));var licenseUtil=require(_0xf06a('0x16'));var db=require(_0xf06a('0x17'))['db'];function respondWithStatusCode(_0x1cf7a4,_0x3c3e12){_0x3c3e12=_0x3c3e12||0xcc;return function(_0x1740c3){if(_0x1740c3){return _0x1cf7a4[_0xf06a('0x18')](_0x3c3e12);}return _0x1cf7a4[_0xf06a('0x19')](_0x3c3e12)[_0xf06a('0x1a')]();};}function respondWithResult(_0x4043e6,_0x18031a){_0x18031a=_0x18031a||0xc8;return function(_0x44c75d){if(_0x44c75d){return _0x4043e6[_0xf06a('0x19')](_0x18031a)['json'](_0x44c75d);}};}function respondWithFilteredResult(_0x327332,_0x484f75){return function(_0x1a588c){if(_0x1a588c){var _0x2c1032=typeof _0x484f75[_0xf06a('0x1b')]===_0xf06a('0x1c')&&typeof _0x484f75[_0xf06a('0x1d')]==='undefined';var _0x498fe4=_0x1a588c[_0xf06a('0x1e')];var _0x51cdd9=_0x2c1032?0x0:_0x484f75[_0xf06a('0x1b')];var _0x1e1ebc=_0x2c1032?_0x1a588c['count']:_0x484f75[_0xf06a('0x1b')]+_0x484f75['limit'];var _0x2ee732;if(_0x1e1ebc>=_0x498fe4){_0x1e1ebc=_0x498fe4;_0x2ee732=0xc8;}else{_0x2ee732=0xce;}_0x327332[_0xf06a('0x19')](_0x2ee732);return _0x327332[_0xf06a('0x1f')](_0xf06a('0x20'),_0x51cdd9+'-'+_0x1e1ebc+'/'+_0x498fe4)[_0xf06a('0x21')](_0x1a588c);}return null;};}function patchUpdates(_0x5dd979){return function(_0x2fdc3f){try{jsonpatch['apply'](_0x2fdc3f,_0x5dd979,!![]);}catch(_0x2f1a33){return BPromise[_0xf06a('0x22')](_0x2f1a33);}return _0x2fdc3f[_0xf06a('0x23')]();};}function saveUpdates(_0x597c9b,_0xc42f11){return function(_0x51191e){if(_0x51191e){return _0x51191e[_0xf06a('0x24')](_0x597c9b)[_0xf06a('0x25')](function(_0x25ed03){return _0x25ed03;});}return null;};}function removeEntity(_0x3a8512,_0x4380e9){return function(_0x59c3f9){if(_0x59c3f9){return _0x59c3f9['destroy']()[_0xf06a('0x25')](function(){var _0x419aaa=_0x59c3f9[_0xf06a('0x26')]({'plain':!![]});var _0x4db84e=_0xf06a('0x27');return db[_0xf06a('0x28')][_0xf06a('0x29')]({'where':{'type':_0x4db84e,'resourceId':_0x419aaa['id']}})[_0xf06a('0x25')](function(){return _0x59c3f9;});})[_0xf06a('0x25')](function(){_0x3a8512['status'](0xcc)[_0xf06a('0x1a')]();});}};}function handleEntityNotFound(_0x5247bb,_0x2fb8f4){return function(_0x64ee7d){if(!_0x64ee7d){_0x5247bb[_0xf06a('0x18')](0x194);}return _0x64ee7d;};}function handleError(_0xfcf26,_0x43ca53){_0x43ca53=_0x43ca53||0x1f4;return function(_0x2f3000){logger[_0xf06a('0x2a')](_0x2f3000[_0xf06a('0x2b')]);if(_0x2f3000[_0xf06a('0x2c')]){delete _0x2f3000[_0xf06a('0x2c')];}_0xfcf26[_0xf06a('0x19')](_0x43ca53)[_0xf06a('0x2d')](_0x2f3000);};}exports[_0xf06a('0x2e')]=function(_0x169cd8,_0x5313ea){var _0x3be5ea={},_0x125227={},_0x3eaf7d={'count':0x0,'rows':[]};var _0x209a95=_['map'](db[_0xf06a('0x2f')][_0xf06a('0x30')],function(_0x371b91){return{'name':_0x371b91[_0xf06a('0x31')],'type':_0x371b91['type']['key']};});_0x125227[_0xf06a('0x32')]=_[_0xf06a('0x33')](_0x209a95,_0xf06a('0x2c'));_0x125227[_0xf06a('0x34')]=_['keys'](_0x169cd8[_0xf06a('0x34')]);_0x125227['filters']=_[_0xf06a('0x35')](_0x125227[_0xf06a('0x32')],_0x125227[_0xf06a('0x34')]);_0x3be5ea[_0xf06a('0x36')]=_[_0xf06a('0x35')](_0x125227[_0xf06a('0x32')],qs['fields'](_0x169cd8[_0xf06a('0x34')][_0xf06a('0x37')]));_0x3be5ea[_0xf06a('0x36')]=_0x3be5ea[_0xf06a('0x36')][_0xf06a('0x38')]?_0x3be5ea[_0xf06a('0x36')]:_0x125227[_0xf06a('0x32')];if(!_0x169cd8[_0xf06a('0x34')][_0xf06a('0x39')]('nolimit')){_0x3be5ea['limit']=qs['limit'](_0x169cd8[_0xf06a('0x34')][_0xf06a('0x1d')]);_0x3be5ea[_0xf06a('0x1b')]=qs[_0xf06a('0x1b')](_0x169cd8[_0xf06a('0x34')][_0xf06a('0x1b')]);}_0x3be5ea['order']=qs[_0xf06a('0x3a')](_0x169cd8[_0xf06a('0x34')][_0xf06a('0x3a')]);_0x3be5ea[_0xf06a('0x3b')]=qs[_0xf06a('0x3c')](_['pick'](_0x169cd8[_0xf06a('0x34')],_0x125227[_0xf06a('0x3c')]),_0x209a95);if(_0x169cd8[_0xf06a('0x34')][_0xf06a('0x3d')]){_0x3be5ea[_0xf06a('0x3b')]=_[_0xf06a('0x3e')](_0x3be5ea['where'],{'$or':_[_0xf06a('0x33')](_0x209a95,function(_0x369f6a){if(_0x369f6a[_0xf06a('0x3f')]!==_0xf06a('0x40')){var _0x1af785={};_0x1af785[_0x369f6a['name']]={'$like':'%'+_0x169cd8[_0xf06a('0x34')]['filter']+'%'};return _0x1af785;}})});}_0x3be5ea=_[_0xf06a('0x3e')]({},_0x3be5ea,_0x169cd8[_0xf06a('0x41')]);var _0x5a4e21={'where':_0x3be5ea[_0xf06a('0x3b')]};return db[_0xf06a('0x2f')][_0xf06a('0x1e')](_0x5a4e21)[_0xf06a('0x25')](function(_0x2e59b5){_0x3eaf7d[_0xf06a('0x1e')]=_0x2e59b5;if(_0x169cd8['query'][_0xf06a('0x42')]){_0x3be5ea['include']=[{'all':!![]}];}return db[_0xf06a('0x2f')][_0xf06a('0x43')](_0x3be5ea);})[_0xf06a('0x25')](function(_0x191ac5){_0x3eaf7d['rows']=_0x191ac5;return _0x3eaf7d;})[_0xf06a('0x25')](respondWithFilteredResult(_0x5313ea,_0x3be5ea))[_0xf06a('0x44')](handleError(_0x5313ea,null));};exports[_0xf06a('0x45')]=function(_0x191a59,_0x5614aa){var _0x34d561={'raw':!![],'where':{'id':_0x191a59['params']['id']}},_0x3d3559={};_0x3d3559['model']=_[_0xf06a('0x46')](db[_0xf06a('0x2f')][_0xf06a('0x30')]);_0x3d3559[_0xf06a('0x34')]=_[_0xf06a('0x46')](_0x191a59[_0xf06a('0x34')]);_0x3d3559[_0xf06a('0x3c')]=_[_0xf06a('0x35')](_0x3d3559[_0xf06a('0x32')],_0x3d3559['query']);_0x34d561['attributes']=_[_0xf06a('0x35')](_0x3d3559[_0xf06a('0x32')],qs[_0xf06a('0x37')](_0x191a59['query'][_0xf06a('0x37')]));_0x34d561[_0xf06a('0x36')]=_0x34d561['attributes']['length']?_0x34d561[_0xf06a('0x36')]:_0x3d3559[_0xf06a('0x32')];if(_0x191a59['query'][_0xf06a('0x42')]){_0x34d561[_0xf06a('0x47')]=[{'all':!![]}];}_0x34d561=_[_0xf06a('0x3e')]({},_0x34d561,_0x191a59[_0xf06a('0x41')]);return db[_0xf06a('0x2f')][_0xf06a('0x48')](_0x34d561)['then'](handleEntityNotFound(_0x5614aa,null))[_0xf06a('0x25')](respondWithResult(_0x5614aa,null))[_0xf06a('0x44')](handleError(_0x5614aa,null));};exports['create']=function(_0x25c67b,_0x52463b){return db[_0xf06a('0x2f')][_0xf06a('0x49')](_0x25c67b[_0xf06a('0x4a')],{})['then'](function(_0x58cf5b){var _0x59a03f=_0x25c67b[_0xf06a('0x4b')][_0xf06a('0x26')]({'plain':!![]});if(!_0x59a03f)throw new Error(_0xf06a('0x4c'));if(_0x59a03f[_0xf06a('0x4d')]===_0xf06a('0x4b')){var _0x3c85e3=_0x58cf5b[_0xf06a('0x26')]({'plain':!![]});var _0x4ca540=_0xf06a('0x27');return db[_0xf06a('0x4e')][_0xf06a('0x48')]({'where':{'name':_0x4ca540,'userProfileId':_0x59a03f['userProfileId']},'raw':!![]})[_0xf06a('0x25')](function(_0x4bff10){if(_0x4bff10&&_0x4bff10[_0xf06a('0x4f')]===0x0){return db[_0xf06a('0x28')]['create']({'name':_0x3c85e3[_0xf06a('0x2c')],'resourceId':_0x3c85e3['id'],'type':_0x4bff10[_0xf06a('0x2c')],'sectionId':_0x4bff10['id']},{})['then'](function(){return _0x58cf5b;});}else{return _0x58cf5b;}})[_0xf06a('0x44')](function(_0x56f31d){logger['error'](_0xf06a('0x50'),_0x56f31d);throw _0x56f31d;});}return _0x58cf5b;})['then'](respondWithResult(_0x52463b,0xc9))[_0xf06a('0x44')](handleError(_0x52463b,null));};exports[_0xf06a('0x24')]=function(_0x519609,_0x326c3c){if(_0x519609[_0xf06a('0x4a')]['id']){delete _0x519609[_0xf06a('0x4a')]['id'];}return db[_0xf06a('0x2f')][_0xf06a('0x48')]({'where':{'id':_0x519609['params']['id']}})[_0xf06a('0x25')](handleEntityNotFound(_0x326c3c,null))[_0xf06a('0x25')](saveUpdates(_0x519609['body'],null))[_0xf06a('0x25')](respondWithResult(_0x326c3c,null))[_0xf06a('0x44')](handleError(_0x326c3c,null));};exports[_0xf06a('0x29')]=function(_0x13b947,_0x4316d9){return db[_0xf06a('0x2f')]['find']({'where':{'id':_0x13b947['params']['id']}})['then'](handleEntityNotFound(_0x4316d9,null))[_0xf06a('0x25')](removeEntity(_0x4316d9,null))[_0xf06a('0x44')](handleError(_0x4316d9,null));}; \ No newline at end of file +var _0x95c6=['util','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','include','find','create','body','user','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x56e63a,_0x33135c){var _0x414c41=function(_0x251321){while(--_0x251321){_0x56e63a['push'](_0x56e63a['shift']());}};_0x414c41(++_0x33135c);}(_0x95c6,0x11f));var _0x695c=function(_0x2601ec,_0x2b5258){_0x2601ec=_0x2601ec-0x0;var _0x1c09c1=_0x95c6[_0x2601ec];return _0x1c09c1;};'use strict';var emlformat=require(_0x695c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x695c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x695c('0x2'));var moment=require(_0x695c('0x3'));var BPromise=require(_0x695c('0x4'));var Mustache=require('mustache');var util=require(_0x695c('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(_0x695c('0x6'));var squel=require(_0x695c('0x7'));var crypto=require(_0x695c('0x8'));var jsforce=require(_0x695c('0x9'));var deskjs=require(_0x695c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x695c('0xb'));var Redis=require(_0x695c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x695c('0xd'));var as=require(_0x695c('0xe'));var hardwareService=require(_0x695c('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x695c('0x10'));var config=require(_0x695c('0x11'));var licenseUtil=require(_0x695c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20967a,_0x14cf1c){_0x14cf1c=_0x14cf1c||0xcc;return function(_0x152d8c){if(_0x152d8c){return _0x20967a[_0x695c('0x13')](_0x14cf1c);}return _0x20967a[_0x695c('0x14')](_0x14cf1c)['end']();};}function respondWithResult(_0x436fb0,_0x3fd07d){_0x3fd07d=_0x3fd07d||0xc8;return function(_0x553eb2){if(_0x553eb2){return _0x436fb0[_0x695c('0x14')](_0x3fd07d)[_0x695c('0x15')](_0x553eb2);}};}function respondWithFilteredResult(_0x508d7d,_0x33ff03){return function(_0x4ebf44){if(_0x4ebf44){var _0x41743a=typeof _0x33ff03[_0x695c('0x16')]==='undefined'&&typeof _0x33ff03[_0x695c('0x17')]===_0x695c('0x18');var _0xd79291=_0x4ebf44[_0x695c('0x19')];var _0xcbb930=_0x41743a?0x0:_0x33ff03[_0x695c('0x16')];var _0x350e4d=_0x41743a?_0x4ebf44['count']:_0x33ff03['offset']+_0x33ff03['limit'];var _0x43a41d;if(_0x350e4d>=_0xd79291){_0x350e4d=_0xd79291;_0x43a41d=0xc8;}else{_0x43a41d=0xce;}_0x508d7d[_0x695c('0x14')](_0x43a41d);return _0x508d7d['set'](_0x695c('0x1a'),_0xcbb930+'-'+_0x350e4d+'/'+_0xd79291)[_0x695c('0x15')](_0x4ebf44);}return null;};}function patchUpdates(_0x2394ab){return function(_0x130a54){try{jsonpatch[_0x695c('0x1b')](_0x130a54,_0x2394ab,!![]);}catch(_0x363758){return BPromise[_0x695c('0x1c')](_0x363758);}return _0x130a54[_0x695c('0x1d')]();};}function saveUpdates(_0xf4687f,_0x1bb513){return function(_0x4af5ad){if(_0x4af5ad){return _0x4af5ad[_0x695c('0x1e')](_0xf4687f)[_0x695c('0x1f')](function(_0xff2ace){return _0xff2ace;});}return null;};}function removeEntity(_0xaf263f,_0x304d29){return function(_0x46edba){if(_0x46edba){return _0x46edba[_0x695c('0x20')]()[_0x695c('0x1f')](function(){var _0x272886=_0x46edba[_0x695c('0x21')]({'plain':!![]});var _0x43f1cf='CmHopperAdditionalPhones';return db[_0x695c('0x22')]['destroy']({'where':{'type':_0x43f1cf,'resourceId':_0x272886['id']}})[_0x695c('0x1f')](function(){return _0x46edba;});})['then'](function(){_0xaf263f[_0x695c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1615,_0x114f52){return function(_0x19549b){if(!_0x19549b){_0x1b1615[_0x695c('0x13')](0x194);}return _0x19549b;};}function handleError(_0x2d976e,_0x3e4ec1){_0x3e4ec1=_0x3e4ec1||0x1f4;return function(_0x17901a){logger['error'](_0x17901a[_0x695c('0x23')]);if(_0x17901a['name']){delete _0x17901a[_0x695c('0x24')];}_0x2d976e[_0x695c('0x14')](_0x3e4ec1)[_0x695c('0x25')](_0x17901a);};}exports[_0x695c('0x26')]=function(_0x49a61a,_0x57478d){var _0x49f173={},_0xfa5a95={},_0x508936={'count':0x0,'rows':[]};var _0x355ba0=_['map'](db[_0x695c('0x27')]['rawAttributes'],function(_0xfe492e){return{'name':_0xfe492e['fieldName'],'type':_0xfe492e[_0x695c('0x28')]['key']};});_0xfa5a95[_0x695c('0x29')]=_['map'](_0x355ba0,_0x695c('0x24'));_0xfa5a95[_0x695c('0x2a')]=_['keys'](_0x49a61a[_0x695c('0x2a')]);_0xfa5a95[_0x695c('0x2b')]=_['intersection'](_0xfa5a95[_0x695c('0x29')],_0xfa5a95[_0x695c('0x2a')]);_0x49f173[_0x695c('0x2c')]=_[_0x695c('0x2d')](_0xfa5a95[_0x695c('0x29')],qs[_0x695c('0x2e')](_0x49a61a[_0x695c('0x2a')][_0x695c('0x2e')]));_0x49f173[_0x695c('0x2c')]=_0x49f173[_0x695c('0x2c')][_0x695c('0x2f')]?_0x49f173['attributes']:_0xfa5a95[_0x695c('0x29')];if(!_0x49a61a[_0x695c('0x2a')][_0x695c('0x30')]('nolimit')){_0x49f173[_0x695c('0x17')]=qs[_0x695c('0x17')](_0x49a61a[_0x695c('0x2a')][_0x695c('0x17')]);_0x49f173[_0x695c('0x16')]=qs['offset'](_0x49a61a['query'][_0x695c('0x16')]);}_0x49f173['order']=qs[_0x695c('0x31')](_0x49a61a['query']['sort']);_0x49f173[_0x695c('0x32')]=qs['filters'](_[_0x695c('0x33')](_0x49a61a[_0x695c('0x2a')],_0xfa5a95[_0x695c('0x2b')]),_0x355ba0);if(_0x49a61a['query']['filter']){_0x49f173[_0x695c('0x32')]=_[_0x695c('0x34')](_0x49f173['where'],{'$or':_[_0x695c('0x35')](_0x355ba0,function(_0x15f843){if(_0x15f843[_0x695c('0x28')]!==_0x695c('0x36')){var _0x3ff636={};_0x3ff636[_0x15f843[_0x695c('0x24')]]={'$like':'%'+_0x49a61a[_0x695c('0x2a')][_0x695c('0x37')]+'%'};return _0x3ff636;}})});}_0x49f173=_[_0x695c('0x34')]({},_0x49f173,_0x49a61a[_0x695c('0x38')]);var _0xea9957={'where':_0x49f173[_0x695c('0x32')]};return db['CmHopperAdditionalPhone'][_0x695c('0x19')](_0xea9957)['then'](function(_0x529694){_0x508936[_0x695c('0x19')]=_0x529694;if(_0x49a61a[_0x695c('0x2a')][_0x695c('0x39')]){_0x49f173['include']=[{'all':!![]}];}return db[_0x695c('0x27')]['findAll'](_0x49f173);})[_0x695c('0x1f')](function(_0x172215){_0x508936[_0x695c('0x3a')]=_0x172215;return _0x508936;})[_0x695c('0x1f')](respondWithFilteredResult(_0x57478d,_0x49f173))[_0x695c('0x3b')](handleError(_0x57478d,null));};exports[_0x695c('0x3c')]=function(_0x45a028,_0x18b655){var _0x271e06={'raw':!![],'where':{'id':_0x45a028[_0x695c('0x3d')]['id']}},_0x3007a6={};_0x3007a6['model']=_[_0x695c('0x3e')](db[_0x695c('0x27')]['rawAttributes']);_0x3007a6[_0x695c('0x2a')]=_[_0x695c('0x3e')](_0x45a028[_0x695c('0x2a')]);_0x3007a6[_0x695c('0x2b')]=_[_0x695c('0x2d')](_0x3007a6[_0x695c('0x29')],_0x3007a6['query']);_0x271e06['attributes']=_[_0x695c('0x2d')](_0x3007a6[_0x695c('0x29')],qs['fields'](_0x45a028[_0x695c('0x2a')][_0x695c('0x2e')]));_0x271e06[_0x695c('0x2c')]=_0x271e06[_0x695c('0x2c')][_0x695c('0x2f')]?_0x271e06[_0x695c('0x2c')]:_0x3007a6[_0x695c('0x29')];if(_0x45a028[_0x695c('0x2a')]['includeAll']){_0x271e06[_0x695c('0x3f')]=[{'all':!![]}];}_0x271e06=_['merge']({},_0x271e06,_0x45a028[_0x695c('0x38')]);return db[_0x695c('0x27')][_0x695c('0x40')](_0x271e06)[_0x695c('0x1f')](handleEntityNotFound(_0x18b655,null))['then'](respondWithResult(_0x18b655,null))[_0x695c('0x3b')](handleError(_0x18b655,null));};exports[_0x695c('0x41')]=function(_0x503cd6,_0x187f1c){return db[_0x695c('0x27')][_0x695c('0x41')](_0x503cd6[_0x695c('0x42')],{})['then'](function(_0x2bfac0){var _0x1cdb5c=_0x503cd6[_0x695c('0x43')][_0x695c('0x21')]({'plain':!![]});if(!_0x1cdb5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cdb5c['role']===_0x695c('0x43')){var _0x42eace=_0x2bfac0['get']({'plain':!![]});var _0x23bcce=_0x695c('0x44');return db[_0x695c('0x45')][_0x695c('0x40')]({'where':{'name':_0x23bcce,'userProfileId':_0x1cdb5c['userProfileId']},'raw':!![]})['then'](function(_0x2d2413){if(_0x2d2413&&_0x2d2413[_0x695c('0x46')]===0x0){return db[_0x695c('0x22')][_0x695c('0x41')]({'name':_0x42eace[_0x695c('0x24')],'resourceId':_0x42eace['id'],'type':_0x2d2413[_0x695c('0x24')],'sectionId':_0x2d2413['id']},{})[_0x695c('0x1f')](function(){return _0x2bfac0;});}else{return _0x2bfac0;}})['catch'](function(_0x4fd9b4){logger[_0x695c('0x47')](_0x695c('0x48'),_0x4fd9b4);throw _0x4fd9b4;});}return _0x2bfac0;})[_0x695c('0x1f')](respondWithResult(_0x187f1c,0xc9))[_0x695c('0x3b')](handleError(_0x187f1c,null));};exports['update']=function(_0x2c0ad8,_0xb48d25){if(_0x2c0ad8[_0x695c('0x42')]['id']){delete _0x2c0ad8['body']['id'];}return db[_0x695c('0x27')][_0x695c('0x40')]({'where':{'id':_0x2c0ad8['params']['id']}})[_0x695c('0x1f')](handleEntityNotFound(_0xb48d25,null))[_0x695c('0x1f')](saveUpdates(_0x2c0ad8[_0x695c('0x42')],null))[_0x695c('0x1f')](respondWithResult(_0xb48d25,null))[_0x695c('0x3b')](handleError(_0xb48d25,null));};exports[_0x695c('0x20')]=function(_0x2da094,_0x2eaff3){return db[_0x695c('0x27')][_0x695c('0x40')]({'where':{'id':_0x2da094[_0x695c('0x3d')]['id']}})[_0x695c('0x1f')](handleEntityNotFound(_0x2eaff3,null))[_0x695c('0x1f')](removeEntity(_0x2eaff3,null))[_0x695c('0x3b')](handleError(_0x2eaff3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 85da45b..1453c9a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef2e=['exports','CmHopperAdditionalPhone','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbd2a25,_0x3228a1){var _0x15f31e=function(_0x2195b2){while(--_0x2195b2){_0xbd2a25['push'](_0xbd2a25['shift']());}};_0x15f31e(++_0x3228a1);}(_0xef2e,0x141));var _0xeef2=function(_0x1956c9,_0x2ad6b4){_0x1956c9=_0x1956c9-0x0;var _0x499d4=_0xef2e[_0x1956c9];return _0x499d4;};'use strict';var _=require('lodash');var util=require(_0xeef2('0x0'));var logger=require(_0xeef2('0x1'))(_0xeef2('0x2'));var moment=require(_0xeef2('0x3'));var BPromise=require(_0xeef2('0x4'));var rp=require(_0xeef2('0x5'));var fs=require('fs');var path=require(_0xeef2('0x6'));var rimraf=require(_0xeef2('0x7'));var config=require(_0xeef2('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xeef2('0x9')]=function(_0x2fd2ae,_0x18e937){return _0x2fd2ae['define'](_0xeef2('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa48a=['api','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa48a,0x1d7));var _0xaa48=function(_0x1078b3,_0x15c407){_0x1078b3=_0x1078b3-0x0;var _0x41c16b=_0xa48a[_0x1078b3];return _0x41c16b;};'use strict';var _=require('lodash');var util=require(_0xaa48('0x0'));var logger=require(_0xaa48('0x1'))(_0xaa48('0x2'));var moment=require('moment');var BPromise=require(_0xaa48('0x3'));var rp=require(_0xaa48('0x4'));var fs=require('fs');var path=require(_0xaa48('0x5'));var rimraf=require(_0xaa48('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa48('0x7'));module['exports']=function(_0x2ae524,_0x348b){return _0x2ae524[_0xaa48('0x8')](_0xaa48('0x9'),attributes,{'tableName':_0xaa48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 3a47cbc..9a6b31c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6528=['transaction','update','IncrementPreviewCounters','field','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countnoanswerretry','countdropretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','add','scheduledat','minutes','isNil','phone','createdAt','updatedAt','countcongestionretry','sequelize'];(function(_0x4488f4,_0x59bd40){var _0x3dd675=function(_0x548e0e){while(--_0x548e0e){_0x4488f4['push'](_0x4488f4['shift']());}};_0x3dd675(++_0x59bd40);}(_0x6528,0x160));var _0x8652=function(_0x1c351b,_0x45531d){_0x1c351b=_0x1c351b-0x0;var _0xe8f0dd=_0x6528[_0x1c351b];return _0xe8f0dd;};'use strict';var _=require(_0x8652('0x0'));var util=require(_0x8652('0x1'));var moment=require(_0x8652('0x2'));var BPromise=require('bluebird');var rs=require(_0x8652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8652('0x4'));var logger=require(_0x8652('0x5'))(_0x8652('0x6'));var config=require('../../config/environment');var jayson=require(_0x8652('0x7'));var client=jayson[_0x8652('0x8')][_0x8652('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41b9d0,_0x4a3479,_0xa77081){return new BPromise(function(_0x350737,_0x3c9cad){return client[_0x8652('0xa')](_0x41b9d0,_0xa77081)[_0x8652('0xb')](function(_0x528ebe){logger[_0x8652('0xc')](_0x8652('0xd'),_0x4a3479,_0x8652('0xe'));logger[_0x8652('0xf')](_0x8652('0x10'),_0x4a3479,_0x8652('0xe'),JSON[_0x8652('0x11')](_0x528ebe));if(_0x528ebe[_0x8652('0x12')]){if(_0x528ebe[_0x8652('0x12')][_0x8652('0x13')]===0x1f4){logger[_0x8652('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4a3479,_0x528ebe[_0x8652('0x12')][_0x8652('0x14')]);return _0x3c9cad(_0x528ebe[_0x8652('0x12')][_0x8652('0x14')]);}logger['error'](_0x8652('0xd'),_0x4a3479,_0x528ebe[_0x8652('0x12')][_0x8652('0x14')]);return _0x350737(_0x528ebe['error'][_0x8652('0x14')]);}else{logger[_0x8652('0xc')](_0x8652('0xd'),_0x4a3479,_0x8652('0xe'));_0x350737(_0x528ebe[_0x8652('0x15')][_0x8652('0x14')]);}})[_0x8652('0x16')](function(_0x32c2a2){logger[_0x8652('0x12')](_0x8652('0xd'),_0x4a3479,_0x32c2a2);_0x3c9cad(_0x32c2a2);});});}exports['VerifyAdditionalPhones']=function(_0x3c6449){var _0xf5692e=this;return new Promise(function(_0x457b02,_0x281bd6){return db[_0x8652('0x17')][_0x8652('0x18')]({'raw':!![],'where':{'ContactId':_0x3c6449['body'][_0x8652('0x19')],'ListId':_0x3c6449['body'][_0x8652('0x1a')],'VoiceQueueId':_0x3c6449[_0x8652('0x1b')][_0x8652('0x1c')]===undefined?null:_0x3c6449[_0x8652('0x1b')][_0x8652('0x1c')],'CampaignId':_0x3c6449[_0x8652('0x1b')]['CampaignId']===undefined?null:_0x3c6449['body'][_0x8652('0x1d')]}})[_0x8652('0xb')](function(_0x106b6a){if(_0x106b6a!=null){return db[_0x8652('0x1e')][_0x8652('0x18')]({'raw':!![],'where':{'CmHopperId':_0x106b6a['id'],'OrderBy':{'$gt':_0x106b6a[_0x8652('0x1f')]}},'order':[[_0x8652('0x1f'),_0x8652('0x20')]]})[_0x8652('0xb')](function(_0x346ab2){var _0x760c26=0x0;if(_0x346ab2){if(_0x346ab2[_0x8652('0x21')]+_0x346ab2['countcongestionretry']+_0x346ab2['countnoanswerretry']+_0x346ab2[_0x8652('0x22')]+_0x346ab2['countdropretry']+_0x346ab2[_0x8652('0x23')]+_0x346ab2[_0x8652('0x24')]+_0x346ab2[_0x8652('0x25')]<_0x3c6449['entity']['dialGlobalMaxRetry'])_0x760c26=0x1;_0x457b02({'additional':_0x760c26});}else{return db[_0x8652('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x106b6a['id']},'order':[[_0x8652('0x1f'),_0x8652('0x20')]]})[_0x8652('0xb')](function(_0x119b09){var _0x4b77db=0x0;if(_0x119b09){if(_0x119b09['countbusyretry']+_0x119b09['countcongestionretry']+_0x119b09[_0x8652('0x26')]+_0x119b09['countnosuchnumberretry']+_0x119b09[_0x8652('0x27')]+_0x119b09[_0x8652('0x23')]+_0x119b09[_0x8652('0x24')]+_0x119b09[_0x8652('0x25')]<_0x3c6449['entity'][_0x8652('0x28')])_0x4b77db=0x1;_0x457b02({'additional':_0x4b77db});}else{_0x457b02({'additional':0x0});}})[_0x8652('0x16')](function(_0x4cdbc1){logger[_0x8652('0x12')](_0x8652('0x29'),_0x4cdbc1[_0x8652('0x14')]);_0x281bd6(_0xf5692e[_0x8652('0x12')](0x1f4,_0x4cdbc1['message']));});}})[_0x8652('0x16')](function(_0x33644a){logger[_0x8652('0x12')]('VerifyAdditionalPhones',_0x33644a[_0x8652('0x14')]);_0x281bd6(_0xf5692e[_0x8652('0x12')](0x1f4,_0x33644a[_0x8652('0x14')]));});}else _0x457b02({'additional':0x0});});});};exports[_0x8652('0x2a')]=function(_0x41b32a){var _0x241d67=this;return new Promise(function(_0x5f2dfb,_0x405e35){return db[_0x8652('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x41b32a[_0x8652('0x1b')][_0x8652('0x19')],'ListId':_0x41b32a[_0x8652('0x1b')][_0x8652('0x1a')],'VoiceQueueId':_0x41b32a[_0x8652('0x1b')]['VoiceQueueId']===undefined?null:_0x41b32a[_0x8652('0x1b')][_0x8652('0x1c')],'CampaignId':_0x41b32a[_0x8652('0x1b')][_0x8652('0x1d')]===undefined?null:_0x41b32a[_0x8652('0x1b')]['CampaignId']}})[_0x8652('0xb')](function(_0x17d7b7){if(_0x17d7b7!=null){return db[_0x8652('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x17d7b7['id'],'OrderBy':{'$gte':_0x17d7b7[_0x8652('0x1f')]}},'order':[[_0x8652('0x1f'),_0x8652('0x20')]]})['then'](function(_0x1d0868){if(_0x1d0868)return activateAdditionalPhone(_0x17d7b7,_0x41b32a[_0x8652('0x1b')],_0x1d0868,_0x41b32a[_0x8652('0x2b')],_0x41b32a[_0x8652('0x2c')])['then'](function(_0x417fda){_0x5f2dfb(_0x417fda);});else{return db[_0x8652('0x1e')][_0x8652('0x18')]({'raw':!![],'where':{'CmHopperId':_0x17d7b7['id']},'order':[[_0x8652('0x1f'),_0x8652('0x20')]]})[_0x8652('0xb')](function(_0x18f940){if(_0x18f940)return activateAdditionalPhone(_0x17d7b7,_0x41b32a[_0x8652('0x1b')],_0x18f940,_0x41b32a[_0x8652('0x2b')],_0x41b32a['waitTime'])[_0x8652('0xb')](function(_0x5c7b06){_0x5f2dfb(_0x5c7b06);});else{_0x5f2dfb({'id':_0x17d7b7['id'],'phone':''});}})[_0x8652('0x16')](function(_0x45163c){logger['error'](_0x8652('0x29'),_0x45163c[_0x8652('0x14')]);_0x405e35(_0x241d67[_0x8652('0x12')](0x1f4,_0x45163c['message']));});}})[_0x8652('0x16')](function(_0x5c531a){logger[_0x8652('0x12')](_0x8652('0x29'),_0x5c531a[_0x8652('0x14')]);_0x405e35(_0x241d67[_0x8652('0x12')](0x1f4,_0x5c531a[_0x8652('0x14')]));});}else _0x5f2dfb(0x1);});});};function activateAdditionalPhone(_0x16786d,_0x24dc16,_0x593956,_0x32c197,_0x3912ba){return new Promise(function(_0x53295c,_0x13cc05){var _0x307282;if(_['isNil'](_0x593956['scheduledat'])){_0x593956['scheduledat']=moment();}if(moment()>moment(_0x593956['scheduledat'])){_0x307282=moment()[_0x8652('0x2d')](_0x3912ba||0x3,'minutes');}else{if(_0x593956[_0x8652('0x1f')]==0x0){_0x307282=moment(_0x593956[_0x8652('0x2e')]);}else{_0x307282=moment()[_0x8652('0x2d')](_0x3912ba||0x3,_0x8652('0x2f'));}}if(_[_0x8652('0x30')](_0x307282)){_0x307282=moment()[_0x8652('0x2d')](_0x3912ba||0x3,_0x8652('0x2f'));}var _0x3fdf9d={'phone':_0x16786d[_0x8652('0x31')],'active':0x0,'OrderBy':_[_0x8652('0x30')](_0x16786d['OrderBy'])?0x0:_0x16786d['OrderBy'],'scheduledat':moment()['add'](_0x32c197||0x1,'minutes'),'countbusyretry':_0x24dc16['countbusyretry'],'countcongestionretry':_0x24dc16['countcongestionretry'],'countnoanswerretry':_0x24dc16[_0x8652('0x26')],'countnosuchnumberretry':_0x24dc16[_0x8652('0x22')],'countdropretry':_0x24dc16['countdropretry'],'countabandonedretry':_0x24dc16[_0x8652('0x23')],'countmachineretry':_0x24dc16[_0x8652('0x24')],'countagentrejectretry':_0x24dc16['countagentrejectretry'],'createdAt':_0x24dc16[_0x8652('0x32')],'updatedAt':_0x24dc16[_0x8652('0x33')]};var _0x10fad6={'CmHopperId':_0x16786d['id'],'phone':_0x593956[_0x8652('0x31')],'active':0x0,'OrderBy':_[_0x8652('0x30')](_0x593956[_0x8652('0x1f')])?0x0:_0x593956['OrderBy'],'scheduledat':_0x307282,'countbusyretry':_0x593956[_0x8652('0x21')],'countcongestionretry':_0x593956[_0x8652('0x34')],'countnoanswerretry':_0x593956[_0x8652('0x26')],'countnosuchnumberretry':_0x593956[_0x8652('0x22')],'countdropretry':_0x593956['countdropretry'],'countabandonedretry':_0x593956[_0x8652('0x23')],'countmachineretry':_0x593956['countmachineretry'],'countagentrejectretry':_0x593956[_0x8652('0x25')],'createdAt':_0x593956[_0x8652('0x32')],'updatedAt':_0x593956[_0x8652('0x33')]};return db[_0x8652('0x35')][_0x8652('0x36')](function(_0x1eecf1){return db['CmHopperAdditionalPhone'][_0x8652('0x37')](_0x3fdf9d,{'where':{'id':_0x593956['id']}},{'transaction':_0x1eecf1})[_0x8652('0xb')](function(){return db[_0x8652('0x17')][_0x8652('0x37')](_0x10fad6,{'where':{'id':_0x16786d['id']}},{'transaction':_0x1eecf1});});})[_0x8652('0xb')](function(_0x517984){_0x53295c({'id':_0x16786d['id'],'phone':_0x593956[_0x8652('0x31')]});})[_0x8652('0x16')](function(_0x128863){logger[_0x8652('0x12')]('activateAdditionalPhone',_0x128863[_0x8652('0x14')]);_0x13cc05({'error':_0x128863[_0x8652('0x14')]});});});}exports[_0x8652('0x38')]=function(_0x594700){var _0x5d0757=this;return new Promise(function(_0x3638c5,_0x5cc0fc){return db[_0x8652('0x17')]['update'](_0x594700['body'][_0x8652('0x39')],{'where':{'id':_0x594700[_0x8652('0x1b')]['id']}})[_0x8652('0xb')](function(_0x3de1ac){_0x3638c5(_0x3de1ac);})[_0x8652('0x16')](function(_0x19a50d){logger[_0x8652('0x12')]('IncrementPreviewCounters',_0x19a50d[_0x8652('0x14')]);_0x5cc0fc(_0x5d0757[_0x8652('0x12')](0x1f4,_0x19a50d[_0x8652('0x14')]));});});}; \ No newline at end of file +var _0x4481=['countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countnosuchnumberretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x4481,0x141));var _0x1448=function(_0x2a5c87,_0x199f88){_0x2a5c87=_0x2a5c87-0x0;var _0x5d86f3=_0x4481[_0x2a5c87];return _0x5d86f3;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var moment=require(_0x1448('0x2'));var BPromise=require(_0x1448('0x3'));var rs=require(_0x1448('0x4'));var fs=require('fs');var Redis=require(_0x1448('0x5'));var db=require(_0x1448('0x6'))['db'];var utils=require(_0x1448('0x7'));var logger=require('../../config/logger')(_0x1448('0x8'));var config=require(_0x1448('0x9'));var jayson=require(_0x1448('0xa'));var client=jayson[_0x1448('0xb')][_0x1448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2415b3,_0x4669f4,_0xc52c0a){return new BPromise(function(_0x202b06,_0x298c4a){return client['request'](_0x2415b3,_0xc52c0a)[_0x1448('0xd')](function(_0x4592fe){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4669f4,'request\x20sent');logger[_0x1448('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4669f4,_0x1448('0xf'),JSON[_0x1448('0x10')](_0x4592fe));if(_0x4592fe[_0x1448('0x11')]){if(_0x4592fe['error'][_0x1448('0x12')]===0x1f4){logger['error'](_0x1448('0x13'),_0x4669f4,_0x4592fe[_0x1448('0x11')][_0x1448('0x14')]);return _0x298c4a(_0x4592fe[_0x1448('0x11')]['message']);}logger[_0x1448('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4669f4,_0x4592fe[_0x1448('0x11')]['message']);return _0x202b06(_0x4592fe[_0x1448('0x11')][_0x1448('0x14')]);}else{logger[_0x1448('0x15')](_0x1448('0x13'),_0x4669f4,_0x1448('0xf'));_0x202b06(_0x4592fe[_0x1448('0x16')][_0x1448('0x14')]);}})[_0x1448('0x17')](function(_0x5b98dc){logger[_0x1448('0x11')](_0x1448('0x13'),_0x4669f4,_0x5b98dc);_0x298c4a(_0x5b98dc);});});}exports[_0x1448('0x18')]=function(_0xbc68b4){var _0x1aef90=this;return new Promise(function(_0x3c028d,_0x1fb8a7){return db[_0x1448('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0xbc68b4[_0x1448('0x1a')]['ContactId'],'ListId':_0xbc68b4[_0x1448('0x1a')]['ListId'],'VoiceQueueId':_0xbc68b4['body'][_0x1448('0x1b')]===undefined?null:_0xbc68b4[_0x1448('0x1a')][_0x1448('0x1b')],'CampaignId':_0xbc68b4[_0x1448('0x1a')][_0x1448('0x1c')]===undefined?null:_0xbc68b4[_0x1448('0x1a')][_0x1448('0x1c')]}})[_0x1448('0xd')](function(_0x3dff63){if(_0x3dff63!=null){return db[_0x1448('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3dff63['id'],'OrderBy':{'$gt':_0x3dff63[_0x1448('0x1e')]}},'order':[[_0x1448('0x1e'),_0x1448('0x1f')]]})[_0x1448('0xd')](function(_0x590b29){var _0x4259a1=0x0;if(_0x590b29){if(_0x590b29[_0x1448('0x20')]+_0x590b29[_0x1448('0x21')]+_0x590b29[_0x1448('0x22')]+_0x590b29['countnosuchnumberretry']+_0x590b29[_0x1448('0x23')]+_0x590b29['countabandonedretry']+_0x590b29[_0x1448('0x24')]+_0x590b29[_0x1448('0x25')]<_0xbc68b4[_0x1448('0x26')][_0x1448('0x27')])_0x4259a1=0x1;_0x3c028d({'additional':_0x4259a1});}else{return db[_0x1448('0x1d')][_0x1448('0x28')]({'raw':!![],'where':{'CmHopperId':_0x3dff63['id']},'order':[[_0x1448('0x1e'),'ASC']]})['then'](function(_0x2cbece){var _0x161b82=0x0;if(_0x2cbece){if(_0x2cbece[_0x1448('0x20')]+_0x2cbece['countcongestionretry']+_0x2cbece[_0x1448('0x22')]+_0x2cbece[_0x1448('0x29')]+_0x2cbece['countdropretry']+_0x2cbece['countabandonedretry']+_0x2cbece[_0x1448('0x24')]+_0x2cbece[_0x1448('0x25')]<_0xbc68b4[_0x1448('0x26')]['dialGlobalMaxRetry'])_0x161b82=0x1;_0x3c028d({'additional':_0x161b82});}else{_0x3c028d({'additional':0x0});}})[_0x1448('0x17')](function(_0x5db70f){logger[_0x1448('0x11')]('VerifyAdditionalPhones',_0x5db70f[_0x1448('0x14')]);_0x1fb8a7(_0x1aef90[_0x1448('0x11')](0x1f4,_0x5db70f[_0x1448('0x14')]));});}})[_0x1448('0x17')](function(_0x3cd6d1){logger[_0x1448('0x11')](_0x1448('0x18'),_0x3cd6d1[_0x1448('0x14')]);_0x1fb8a7(_0x1aef90[_0x1448('0x11')](0x1f4,_0x3cd6d1[_0x1448('0x14')]));});}else _0x3c028d({'additional':0x0});});});};exports[_0x1448('0x2a')]=function(_0x1c8631){var _0x1f2a4c=this;return new Promise(function(_0x5ddd46,_0x388692){return db[_0x1448('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x1c8631['body'][_0x1448('0x2b')],'ListId':_0x1c8631[_0x1448('0x1a')]['ListId'],'VoiceQueueId':_0x1c8631[_0x1448('0x1a')]['VoiceQueueId']===undefined?null:_0x1c8631[_0x1448('0x1a')]['VoiceQueueId'],'CampaignId':_0x1c8631[_0x1448('0x1a')][_0x1448('0x1c')]===undefined?null:_0x1c8631[_0x1448('0x1a')]['CampaignId']}})['then'](function(_0x77667a){if(_0x77667a!=null){return db[_0x1448('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x77667a['id'],'OrderBy':{'$gte':_0x77667a[_0x1448('0x1e')]}},'order':[['OrderBy',_0x1448('0x1f')]]})[_0x1448('0xd')](function(_0x36865d){if(_0x36865d)return activateAdditionalPhone(_0x77667a,_0x1c8631[_0x1448('0x1a')],_0x36865d,_0x1c8631[_0x1448('0x2c')],_0x1c8631[_0x1448('0x2d')])[_0x1448('0xd')](function(_0x420883){_0x5ddd46(_0x420883);});else{return db['CmHopperAdditionalPhone'][_0x1448('0x28')]({'raw':!![],'where':{'CmHopperId':_0x77667a['id']},'order':[[_0x1448('0x1e'),_0x1448('0x1f')]]})['then'](function(_0x55ae4d){if(_0x55ae4d)return activateAdditionalPhone(_0x77667a,_0x1c8631['body'],_0x55ae4d,_0x1c8631['duration'],_0x1c8631[_0x1448('0x2d')])[_0x1448('0xd')](function(_0x2c7241){_0x5ddd46(_0x2c7241);});else{_0x5ddd46({'id':_0x77667a['id'],'phone':''});}})[_0x1448('0x17')](function(_0x7709fc){logger[_0x1448('0x11')]('VerifyAdditionalPhones',_0x7709fc[_0x1448('0x14')]);_0x388692(_0x1f2a4c[_0x1448('0x11')](0x1f4,_0x7709fc[_0x1448('0x14')]));});}})[_0x1448('0x17')](function(_0x41f4b2){logger[_0x1448('0x11')](_0x1448('0x18'),_0x41f4b2['message']);_0x388692(_0x1f2a4c['error'](0x1f4,_0x41f4b2[_0x1448('0x14')]));});}else _0x5ddd46(0x1);});});};function activateAdditionalPhone(_0x2f4357,_0x49fbb3,_0x2f0a68,_0x3858ec,_0x446fc1){return new Promise(function(_0x8b1587,_0x18af13){var _0x1f925f;if(_[_0x1448('0x2e')](_0x2f0a68[_0x1448('0x2f')])){_0x2f0a68[_0x1448('0x2f')]=moment();}if(moment()>moment(_0x2f0a68[_0x1448('0x2f')])){_0x1f925f=moment()[_0x1448('0x30')](_0x446fc1||0x3,'minutes');}else{if(_0x2f0a68[_0x1448('0x1e')]==0x0){_0x1f925f=moment(_0x2f0a68['scheduledat']);}else{_0x1f925f=moment()[_0x1448('0x30')](_0x446fc1||0x3,_0x1448('0x31'));}}if(_[_0x1448('0x2e')](_0x1f925f)){_0x1f925f=moment()[_0x1448('0x30')](_0x446fc1||0x3,_0x1448('0x31'));}var _0x2ee4bb={'phone':_0x2f4357[_0x1448('0x32')],'active':0x0,'OrderBy':_[_0x1448('0x2e')](_0x2f4357['OrderBy'])?0x0:_0x2f4357[_0x1448('0x1e')],'scheduledat':moment()[_0x1448('0x30')](_0x3858ec||0x1,'minutes'),'countbusyretry':_0x49fbb3[_0x1448('0x20')],'countcongestionretry':_0x49fbb3[_0x1448('0x21')],'countnoanswerretry':_0x49fbb3[_0x1448('0x22')],'countnosuchnumberretry':_0x49fbb3[_0x1448('0x29')],'countdropretry':_0x49fbb3[_0x1448('0x23')],'countabandonedretry':_0x49fbb3['countabandonedretry'],'countmachineretry':_0x49fbb3[_0x1448('0x24')],'countagentrejectretry':_0x49fbb3[_0x1448('0x25')],'createdAt':_0x49fbb3[_0x1448('0x33')],'updatedAt':_0x49fbb3[_0x1448('0x34')]};var _0x113148={'CmHopperId':_0x2f4357['id'],'phone':_0x2f0a68[_0x1448('0x32')],'active':0x0,'OrderBy':_[_0x1448('0x2e')](_0x2f0a68[_0x1448('0x1e')])?0x0:_0x2f0a68[_0x1448('0x1e')],'scheduledat':_0x1f925f,'countbusyretry':_0x2f0a68[_0x1448('0x20')],'countcongestionretry':_0x2f0a68[_0x1448('0x21')],'countnoanswerretry':_0x2f0a68[_0x1448('0x22')],'countnosuchnumberretry':_0x2f0a68['countnosuchnumberretry'],'countdropretry':_0x2f0a68[_0x1448('0x23')],'countabandonedretry':_0x2f0a68['countabandonedretry'],'countmachineretry':_0x2f0a68[_0x1448('0x24')],'countagentrejectretry':_0x2f0a68[_0x1448('0x25')],'createdAt':_0x2f0a68['createdAt'],'updatedAt':_0x2f0a68[_0x1448('0x34')]};return db[_0x1448('0x35')][_0x1448('0x36')](function(_0x5521a7){return db[_0x1448('0x1d')][_0x1448('0x37')](_0x2ee4bb,{'where':{'id':_0x2f0a68['id']}},{'transaction':_0x5521a7})['then'](function(){return db['CmHopper'][_0x1448('0x37')](_0x113148,{'where':{'id':_0x2f4357['id']}},{'transaction':_0x5521a7});});})[_0x1448('0xd')](function(_0x2f6846){_0x8b1587({'id':_0x2f4357['id'],'phone':_0x2f0a68[_0x1448('0x32')]});})[_0x1448('0x17')](function(_0x952f14){logger[_0x1448('0x11')](_0x1448('0x38'),_0x952f14['message']);_0x18af13({'error':_0x952f14['message']});});});}exports[_0x1448('0x39')]=function(_0x3eaf14){var _0x569556=this;return new Promise(function(_0x10bf52,_0x27ebfa){return db[_0x1448('0x19')][_0x1448('0x37')](_0x3eaf14['body'][_0x1448('0x3a')],{'where':{'id':_0x3eaf14[_0x1448('0x1a')]['id']}})[_0x1448('0xd')](function(_0xfa082d){_0x10bf52(_0xfa082d);})[_0x1448('0x17')](function(_0x25743d){logger['error']('IncrementPreviewCounters',_0x25743d[_0x1448('0x14')]);_0x27ebfa(_0x569556['error'](0x1f4,_0x25743d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 92b3118..521d12d 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f92=['post','create','put','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4b1c73,_0x1a4207){var _0xfab919=function(_0x423a33){while(--_0x423a33){_0x4b1c73['push'](_0x4b1c73['shift']());}};_0xfab919(++_0x1a4207);}(_0x2f92,0x1d1));var _0x22f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f92[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x22f9('0x0'));var path=require(_0x22f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x22f9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x22f9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x22f9('0x4'));var controller=require(_0x22f9('0x5'));router[_0x22f9('0x6')]('/',auth[_0x22f9('0x7')](),controller[_0x22f9('0x8')]);router[_0x22f9('0x6')](_0x22f9('0x9'),auth[_0x22f9('0x7')](),controller[_0x22f9('0xa')]);router[_0x22f9('0xb')]('/',auth[_0x22f9('0x7')](),controller[_0x22f9('0xc')]);router[_0x22f9('0xd')](_0x22f9('0x9'),auth[_0x22f9('0x7')](),controller[_0x22f9('0xe')]);router[_0x22f9('0xf')](_0x22f9('0x9'),auth[_0x22f9('0x7')](),controller['destroy']);module[_0x22f9('0x10')]=router; \ No newline at end of file +var _0x7a09=['isAuthenticated','index','/:id','show','post','put','update','delete','exports','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x7a09,0xa3));var _0x97a0=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x7a09[_0x33ebf5];return _0x66957b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x97a0('0x0'));var express=require('express');var router=express[_0x97a0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x97a0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x97a0('0x3'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x97a0('0x4')]('/',auth[_0x97a0('0x5')](),controller[_0x97a0('0x6')]);router[_0x97a0('0x4')](_0x97a0('0x7'),auth['isAuthenticated'](),controller[_0x97a0('0x8')]);router[_0x97a0('0x9')]('/',auth[_0x97a0('0x5')](),controller['create']);router[_0x97a0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x97a0('0xb')]);router[_0x97a0('0xc')](_0x97a0('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x97a0('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fdbbae7..8fdc41d 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 _0x7ebb=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x5685fe,_0x34a87f){var _0x5a6e5e=function(_0x2995d8){while(--_0x2995d8){_0x5685fe['push'](_0x5685fe['shift']());}};_0x5a6e5e(++_0x34a87f);}(_0x7ebb,0x161));var _0xb7eb=function(_0xcc3d40,_0x3c0f3c){_0xcc3d40=_0xcc3d40-0x0;var _0x4160a3=_0x7ebb[_0xcc3d40];return _0x4160a3;};'use strict';var moment=require(_0xb7eb('0x0'));var Sequelize=require(_0xb7eb('0x1'));module[_0xb7eb('0x2')]={'phone':{'type':Sequelize[_0xb7eb('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb7eb('0x4')],'unique':_0xb7eb('0x5')},'ListId':{'type':Sequelize[_0xb7eb('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xb7eb('0x4')],'unique':_0xb7eb('0x5')}}; \ No newline at end of file +var _0xe384=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x3f97bd,_0x2d6fba){var _0x5f3518=function(_0x55a01c){while(--_0x55a01c){_0x3f97bd['push'](_0x3f97bd['shift']());}};_0x5f3518(++_0x2d6fba);}(_0xe384,0x160));var _0x4e38=function(_0x401528,_0x25430d){_0x401528=_0x401528-0x0;var _0x36371e=_0xe384[_0x401528];return _0x36371e;};'use strict';var moment=require(_0x4e38('0x0'));var Sequelize=require('sequelize');module[_0x4e38('0x1')]={'phone':{'type':Sequelize[_0x4e38('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4e38('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4e38('0x4')},'VoiceQueueId':{'type':Sequelize[_0x4e38('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b985fbe..27d8679 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 _0xca27=['limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperBlack','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','body','find','catch','describe','eml-format','rimraf','zip-dir','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/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3a5eb3,_0x346050){var _0x4d2e43=function(_0x24ff1a){while(--_0x24ff1a){_0x3a5eb3['push'](_0x3a5eb3['shift']());}};_0x4d2e43(++_0x346050);}(_0xca27,0x1a9));var _0x7ca2=function(_0x5cc1a9,_0x55dbd4){_0x5cc1a9=_0x5cc1a9-0x0;var _0x14b68d=_0xca27[_0x5cc1a9];return _0x14b68d;};'use strict';var emlformat=require(_0x7ca2('0x0'));var rimraf=require(_0x7ca2('0x1'));var zipdir=require(_0x7ca2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ca2('0x3'));var BPromise=require(_0x7ca2('0x4'));var Mustache=require(_0x7ca2('0x5'));var util=require(_0x7ca2('0x6'));var path=require(_0x7ca2('0x7'));var sox=require(_0x7ca2('0x8'));var csv=require(_0x7ca2('0x9'));var ejs=require(_0x7ca2('0xa'));var fs=require('fs');var fs_extra=require(_0x7ca2('0xb'));var _=require(_0x7ca2('0xc'));var squel=require(_0x7ca2('0xd'));var crypto=require('crypto');var jsforce=require(_0x7ca2('0xe'));var deskjs=require(_0x7ca2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7ca2('0x10'));var Papa=require(_0x7ca2('0x11'));var Redis=require(_0x7ca2('0x12'));var authService=require(_0x7ca2('0x13'));var qs=require(_0x7ca2('0x14'));var as=require(_0x7ca2('0x15'));var hardwareService=require(_0x7ca2('0x16'));var logger=require('../../config/logger')(_0x7ca2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ca2('0x18'))['db'];function respondWithStatusCode(_0x27f26e,_0xe2f83){_0xe2f83=_0xe2f83||0xcc;return function(_0x3827d0){if(_0x3827d0){return _0x27f26e[_0x7ca2('0x19')](_0xe2f83);}return _0x27f26e[_0x7ca2('0x1a')](_0xe2f83)[_0x7ca2('0x1b')]();};}function respondWithResult(_0x4785a9,_0x3dc337){_0x3dc337=_0x3dc337||0xc8;return function(_0x1a18ae){if(_0x1a18ae){return _0x4785a9[_0x7ca2('0x1a')](_0x3dc337)[_0x7ca2('0x1c')](_0x1a18ae);}};}function respondWithFilteredResult(_0x4a3b44,_0x43c9d9){return function(_0x1450e1){if(_0x1450e1){var _0x24f49d=typeof _0x43c9d9[_0x7ca2('0x1d')]===_0x7ca2('0x1e')&&typeof _0x43c9d9[_0x7ca2('0x1f')]===_0x7ca2('0x1e');var _0xb33a02=_0x1450e1[_0x7ca2('0x20')];var _0x4dfb8b=_0x24f49d?0x0:_0x43c9d9[_0x7ca2('0x1d')];var _0x3dd65c=_0x24f49d?_0x1450e1[_0x7ca2('0x20')]:_0x43c9d9[_0x7ca2('0x1d')]+_0x43c9d9[_0x7ca2('0x1f')];var _0x2f65c9;if(_0x3dd65c>=_0xb33a02){_0x3dd65c=_0xb33a02;_0x2f65c9=0xc8;}else{_0x2f65c9=0xce;}_0x4a3b44[_0x7ca2('0x1a')](_0x2f65c9);return _0x4a3b44[_0x7ca2('0x21')]('Content-Range',_0x4dfb8b+'-'+_0x3dd65c+'/'+_0xb33a02)['json'](_0x1450e1);}return null;};}function patchUpdates(_0x36960f){return function(_0x16ef5c){try{jsonpatch[_0x7ca2('0x22')](_0x16ef5c,_0x36960f,!![]);}catch(_0x5bd37a){return BPromise['reject'](_0x5bd37a);}return _0x16ef5c[_0x7ca2('0x23')]();};}function saveUpdates(_0x285d89,_0x553242){return function(_0x3d6f84){if(_0x3d6f84){return _0x3d6f84[_0x7ca2('0x24')](_0x285d89)[_0x7ca2('0x25')](function(_0xc0fa66){return _0xc0fa66;});}return null;};}function removeEntity(_0x124952,_0x414bed){return function(_0x1a0452){if(_0x1a0452){return _0x1a0452[_0x7ca2('0x26')]()[_0x7ca2('0x25')](function(){_0x124952['status'](0xcc)[_0x7ca2('0x1b')]();});}};}function handleEntityNotFound(_0x494957,_0x62cfe8){return function(_0x984225){if(!_0x984225){_0x494957['sendStatus'](0x194);}return _0x984225;};}function handleError(_0x1fb8d4,_0xf494b3){_0xf494b3=_0xf494b3||0x1f4;return function(_0x345125){logger['error'](_0x345125[_0x7ca2('0x27')]);if(_0x345125[_0x7ca2('0x28')]){delete _0x345125[_0x7ca2('0x28')];}_0x1fb8d4['status'](_0xf494b3)[_0x7ca2('0x29')](_0x345125);};}exports[_0x7ca2('0x2a')]=function(_0x16f787,_0x18d565){var _0x3930b5={},_0x5be78a={},_0x67f55b={'count':0x0,'rows':[]};var _0x11f40a=_[_0x7ca2('0x2b')](db[_0x7ca2('0x2c')]['rawAttributes'],function(_0x3c8633){return{'name':_0x3c8633[_0x7ca2('0x2d')],'type':_0x3c8633[_0x7ca2('0x2e')]['key']};});_0x5be78a[_0x7ca2('0x2f')]=_[_0x7ca2('0x2b')](_0x11f40a,_0x7ca2('0x28'));_0x5be78a[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0x16f787[_0x7ca2('0x30')]);_0x5be78a[_0x7ca2('0x32')]=_['intersection'](_0x5be78a[_0x7ca2('0x2f')],_0x5be78a[_0x7ca2('0x30')]);_0x3930b5[_0x7ca2('0x33')]=_[_0x7ca2('0x34')](_0x5be78a[_0x7ca2('0x2f')],qs[_0x7ca2('0x35')](_0x16f787['query']['fields']));_0x3930b5['attributes']=_0x3930b5[_0x7ca2('0x33')][_0x7ca2('0x36')]?_0x3930b5['attributes']:_0x5be78a['model'];if(!_0x16f787[_0x7ca2('0x30')][_0x7ca2('0x37')](_0x7ca2('0x38'))){_0x3930b5['limit']=qs[_0x7ca2('0x1f')](_0x16f787[_0x7ca2('0x30')][_0x7ca2('0x1f')]);_0x3930b5[_0x7ca2('0x1d')]=qs[_0x7ca2('0x1d')](_0x16f787['query']['offset']);}_0x3930b5[_0x7ca2('0x39')]=qs[_0x7ca2('0x3a')](_0x16f787[_0x7ca2('0x30')][_0x7ca2('0x3a')]);_0x3930b5[_0x7ca2('0x3b')]=qs[_0x7ca2('0x32')](_[_0x7ca2('0x3c')](_0x16f787[_0x7ca2('0x30')],_0x5be78a['filters']),_0x11f40a);if(_0x16f787[_0x7ca2('0x30')][_0x7ca2('0x3d')]){_0x3930b5['where']=_[_0x7ca2('0x3e')](_0x3930b5[_0x7ca2('0x3b')],{'$or':_[_0x7ca2('0x2b')](_0x11f40a,function(_0x4357c7){if(_0x4357c7['type']!==_0x7ca2('0x3f')){var _0x16e705={};_0x16e705[_0x4357c7[_0x7ca2('0x28')]]={'$like':'%'+_0x16f787[_0x7ca2('0x30')][_0x7ca2('0x3d')]+'%'};return _0x16e705;}})});}_0x3930b5=_[_0x7ca2('0x3e')]({},_0x3930b5,_0x16f787[_0x7ca2('0x40')]);var _0x2cc1d2={'where':_0x3930b5[_0x7ca2('0x3b')]};return db[_0x7ca2('0x2c')][_0x7ca2('0x20')](_0x2cc1d2)[_0x7ca2('0x25')](function(_0x44a312){_0x67f55b[_0x7ca2('0x20')]=_0x44a312;if(_0x16f787[_0x7ca2('0x30')]['includeAll']){_0x3930b5[_0x7ca2('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7ca2('0x42')](_0x3930b5);})[_0x7ca2('0x25')](function(_0x17b102){_0x67f55b[_0x7ca2('0x43')]=_0x17b102;return _0x67f55b;})[_0x7ca2('0x25')](respondWithFilteredResult(_0x18d565,_0x3930b5))['catch'](handleError(_0x18d565,null));};exports[_0x7ca2('0x44')]=function(_0x4cf557,_0x5b3b22){var _0x379893={'raw':!![],'where':{'id':_0x4cf557[_0x7ca2('0x45')]['id']}},_0xad7dff={};_0xad7dff['model']=_[_0x7ca2('0x31')](db['CmHopperBlack'][_0x7ca2('0x46')]);_0xad7dff[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0x4cf557[_0x7ca2('0x30')]);_0xad7dff['filters']=_[_0x7ca2('0x34')](_0xad7dff[_0x7ca2('0x2f')],_0xad7dff['query']);_0x379893[_0x7ca2('0x33')]=_[_0x7ca2('0x34')](_0xad7dff[_0x7ca2('0x2f')],qs['fields'](_0x4cf557[_0x7ca2('0x30')][_0x7ca2('0x35')]));_0x379893[_0x7ca2('0x33')]=_0x379893[_0x7ca2('0x33')][_0x7ca2('0x36')]?_0x379893[_0x7ca2('0x33')]:_0xad7dff['model'];if(_0x4cf557['query'][_0x7ca2('0x47')]){_0x379893[_0x7ca2('0x41')]=[{'all':!![]}];}_0x379893=_[_0x7ca2('0x3e')]({},_0x379893,_0x4cf557[_0x7ca2('0x40')]);return db[_0x7ca2('0x2c')]['find'](_0x379893)['then'](handleEntityNotFound(_0x5b3b22,null))[_0x7ca2('0x25')](respondWithResult(_0x5b3b22,null))['catch'](handleError(_0x5b3b22,null));};exports[_0x7ca2('0x24')]=function(_0x3af4e8,_0x373f1a){if(_0x3af4e8[_0x7ca2('0x48')]['id']){delete _0x3af4e8['body']['id'];}return db[_0x7ca2('0x2c')][_0x7ca2('0x49')]({'where':{'id':_0x3af4e8[_0x7ca2('0x45')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x373f1a,null))[_0x7ca2('0x25')](saveUpdates(_0x3af4e8[_0x7ca2('0x48')],null))[_0x7ca2('0x25')](respondWithResult(_0x373f1a,null))[_0x7ca2('0x4a')](handleError(_0x373f1a,null));};exports[_0x7ca2('0x26')]=function(_0x2576e1,_0x95b5b7){return db['CmHopperBlack'][_0x7ca2('0x49')]({'where':{'id':_0x2576e1[_0x7ca2('0x45')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x95b5b7,null))[_0x7ca2('0x25')](removeEntity(_0x95b5b7,null))[_0x7ca2('0x4a')](handleError(_0x95b5b7,null));};exports[_0x7ca2('0x4b')]=function(_0x197171,_0x27eef4){return db[_0x7ca2('0x2c')]['describe']()[_0x7ca2('0x25')](respondWithResult(_0x27eef4,null))['catch'](handleError(_0x27eef4,null));}; \ No newline at end of file +var _0xb35b=['type','VIRTUAL','filter','merge','options','CmHopperBlack','includeAll','include','findAll','rows','show','find','catch','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5df3f5,_0x4cf65e){var _0x1c5b7c=function(_0xc8c045){while(--_0xc8c045){_0x5df3f5['push'](_0x5df3f5['shift']());}};_0x1c5b7c(++_0x4cf65e);}(_0xb35b,0xb6));var _0xbb35=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xb35b[_0x1cbcf1];return _0x3a06f0;};'use strict';var emlformat=require(_0xbb35('0x0'));var rimraf=require(_0xbb35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb35('0x2'));var rp=require(_0xbb35('0x3'));var moment=require(_0xbb35('0x4'));var BPromise=require(_0xbb35('0x5'));var Mustache=require(_0xbb35('0x6'));var util=require(_0xbb35('0x7'));var path=require('path');var sox=require(_0xbb35('0x8'));var csv=require(_0xbb35('0x9'));var ejs=require(_0xbb35('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb35('0xb'));var squel=require(_0xbb35('0xc'));var crypto=require(_0xbb35('0xd'));var jsforce=require(_0xbb35('0xe'));var deskjs=require(_0xbb35('0xf'));var toCsv=require(_0xbb35('0x9'));var querystring=require(_0xbb35('0x10'));var Papa=require(_0xbb35('0x11'));var Redis=require(_0xbb35('0x12'));var authService=require(_0xbb35('0x13'));var qs=require(_0xbb35('0x14'));var as=require(_0xbb35('0x15'));var hardwareService=require(_0xbb35('0x16'));var logger=require(_0xbb35('0x17'))(_0xbb35('0x18'));var utils=require(_0xbb35('0x19'));var config=require(_0xbb35('0x1a'));var licenseUtil=require(_0xbb35('0x1b'));var db=require(_0xbb35('0x1c'))['db'];function respondWithStatusCode(_0x4d2615,_0x45144e){_0x45144e=_0x45144e||0xcc;return function(_0x2470f4){if(_0x2470f4){return _0x4d2615[_0xbb35('0x1d')](_0x45144e);}return _0x4d2615[_0xbb35('0x1e')](_0x45144e)[_0xbb35('0x1f')]();};}function respondWithResult(_0x528cce,_0x1b1b6f){_0x1b1b6f=_0x1b1b6f||0xc8;return function(_0x23e027){if(_0x23e027){return _0x528cce[_0xbb35('0x1e')](_0x1b1b6f)[_0xbb35('0x20')](_0x23e027);}};}function respondWithFilteredResult(_0x361d86,_0x2bc7df){return function(_0x3bc3f6){if(_0x3bc3f6){var _0x5ab517=typeof _0x2bc7df['offset']===_0xbb35('0x21')&&typeof _0x2bc7df[_0xbb35('0x22')]===_0xbb35('0x21');var _0x4f08e0=_0x3bc3f6[_0xbb35('0x23')];var _0x42973e=_0x5ab517?0x0:_0x2bc7df[_0xbb35('0x24')];var _0x463f95=_0x5ab517?_0x3bc3f6[_0xbb35('0x23')]:_0x2bc7df['offset']+_0x2bc7df[_0xbb35('0x22')];var _0x30378c;if(_0x463f95>=_0x4f08e0){_0x463f95=_0x4f08e0;_0x30378c=0xc8;}else{_0x30378c=0xce;}_0x361d86[_0xbb35('0x1e')](_0x30378c);return _0x361d86[_0xbb35('0x25')](_0xbb35('0x26'),_0x42973e+'-'+_0x463f95+'/'+_0x4f08e0)['json'](_0x3bc3f6);}return null;};}function patchUpdates(_0x3b0d23){return function(_0x5f006a){try{jsonpatch[_0xbb35('0x27')](_0x5f006a,_0x3b0d23,!![]);}catch(_0x11b1b7){return BPromise[_0xbb35('0x28')](_0x11b1b7);}return _0x5f006a[_0xbb35('0x29')]();};}function saveUpdates(_0x3aa5d4,_0x25e6b6){return function(_0x33bcf5){if(_0x33bcf5){return _0x33bcf5[_0xbb35('0x2a')](_0x3aa5d4)[_0xbb35('0x2b')](function(_0x52db47){return _0x52db47;});}return null;};}function removeEntity(_0x247830,_0x1205c0){return function(_0x386cc2){if(_0x386cc2){return _0x386cc2[_0xbb35('0x2c')]()[_0xbb35('0x2b')](function(){_0x247830[_0xbb35('0x1e')](0xcc)[_0xbb35('0x1f')]();});}};}function handleEntityNotFound(_0x5624cc,_0x36f5c4){return function(_0x545a17){if(!_0x545a17){_0x5624cc[_0xbb35('0x1d')](0x194);}return _0x545a17;};}function handleError(_0xa158e9,_0x25d28b){_0x25d28b=_0x25d28b||0x1f4;return function(_0x1eae2a){logger[_0xbb35('0x2d')](_0x1eae2a[_0xbb35('0x2e')]);if(_0x1eae2a[_0xbb35('0x2f')]){delete _0x1eae2a[_0xbb35('0x2f')];}_0xa158e9['status'](_0x25d28b)[_0xbb35('0x30')](_0x1eae2a);};}exports[_0xbb35('0x31')]=function(_0x313a87,_0x41713c){var _0x4c5391={},_0x1b38b9={},_0x1a00a6={'count':0x0,'rows':[]};var _0x4bf240=_[_0xbb35('0x32')](db['CmHopperBlack'][_0xbb35('0x33')],function(_0x15beac){return{'name':_0x15beac[_0xbb35('0x34')],'type':_0x15beac['type']['key']};});_0x1b38b9[_0xbb35('0x35')]=_[_0xbb35('0x32')](_0x4bf240,_0xbb35('0x2f'));_0x1b38b9[_0xbb35('0x36')]=_[_0xbb35('0x37')](_0x313a87[_0xbb35('0x36')]);_0x1b38b9[_0xbb35('0x38')]=_[_0xbb35('0x39')](_0x1b38b9[_0xbb35('0x35')],_0x1b38b9[_0xbb35('0x36')]);_0x4c5391[_0xbb35('0x3a')]=_[_0xbb35('0x39')](_0x1b38b9[_0xbb35('0x35')],qs[_0xbb35('0x3b')](_0x313a87[_0xbb35('0x36')][_0xbb35('0x3b')]));_0x4c5391[_0xbb35('0x3a')]=_0x4c5391['attributes'][_0xbb35('0x3c')]?_0x4c5391[_0xbb35('0x3a')]:_0x1b38b9[_0xbb35('0x35')];if(!_0x313a87[_0xbb35('0x36')][_0xbb35('0x3d')](_0xbb35('0x3e'))){_0x4c5391[_0xbb35('0x22')]=qs['limit'](_0x313a87[_0xbb35('0x36')][_0xbb35('0x22')]);_0x4c5391[_0xbb35('0x24')]=qs['offset'](_0x313a87['query'][_0xbb35('0x24')]);}_0x4c5391[_0xbb35('0x3f')]=qs[_0xbb35('0x40')](_0x313a87[_0xbb35('0x36')][_0xbb35('0x40')]);_0x4c5391[_0xbb35('0x41')]=qs[_0xbb35('0x38')](_[_0xbb35('0x42')](_0x313a87[_0xbb35('0x36')],_0x1b38b9[_0xbb35('0x38')]),_0x4bf240);if(_0x313a87[_0xbb35('0x36')]['filter']){_0x4c5391[_0xbb35('0x41')]=_['merge'](_0x4c5391[_0xbb35('0x41')],{'$or':_[_0xbb35('0x32')](_0x4bf240,function(_0xa19e00){if(_0xa19e00[_0xbb35('0x43')]!==_0xbb35('0x44')){var _0x37b917={};_0x37b917[_0xa19e00[_0xbb35('0x2f')]]={'$like':'%'+_0x313a87[_0xbb35('0x36')][_0xbb35('0x45')]+'%'};return _0x37b917;}})});}_0x4c5391=_[_0xbb35('0x46')]({},_0x4c5391,_0x313a87[_0xbb35('0x47')]);var _0x2dc7c4={'where':_0x4c5391[_0xbb35('0x41')]};return db[_0xbb35('0x48')][_0xbb35('0x23')](_0x2dc7c4)[_0xbb35('0x2b')](function(_0x5d5615){_0x1a00a6[_0xbb35('0x23')]=_0x5d5615;if(_0x313a87[_0xbb35('0x36')][_0xbb35('0x49')]){_0x4c5391[_0xbb35('0x4a')]=[{'all':!![]}];}return db[_0xbb35('0x48')][_0xbb35('0x4b')](_0x4c5391);})['then'](function(_0x32d013){_0x1a00a6[_0xbb35('0x4c')]=_0x32d013;return _0x1a00a6;})[_0xbb35('0x2b')](respondWithFilteredResult(_0x41713c,_0x4c5391))['catch'](handleError(_0x41713c,null));};exports[_0xbb35('0x4d')]=function(_0xa98d72,_0xedc43a){var _0x47703d={'raw':!![],'where':{'id':_0xa98d72['params']['id']}},_0x1ee662={};_0x1ee662[_0xbb35('0x35')]=_['keys'](db['CmHopperBlack'][_0xbb35('0x33')]);_0x1ee662[_0xbb35('0x36')]=_[_0xbb35('0x37')](_0xa98d72[_0xbb35('0x36')]);_0x1ee662['filters']=_['intersection'](_0x1ee662['model'],_0x1ee662[_0xbb35('0x36')]);_0x47703d[_0xbb35('0x3a')]=_['intersection'](_0x1ee662[_0xbb35('0x35')],qs[_0xbb35('0x3b')](_0xa98d72[_0xbb35('0x36')][_0xbb35('0x3b')]));_0x47703d[_0xbb35('0x3a')]=_0x47703d[_0xbb35('0x3a')][_0xbb35('0x3c')]?_0x47703d['attributes']:_0x1ee662[_0xbb35('0x35')];if(_0xa98d72[_0xbb35('0x36')][_0xbb35('0x49')]){_0x47703d[_0xbb35('0x4a')]=[{'all':!![]}];}_0x47703d=_[_0xbb35('0x46')]({},_0x47703d,_0xa98d72[_0xbb35('0x47')]);return db[_0xbb35('0x48')][_0xbb35('0x4e')](_0x47703d)['then'](handleEntityNotFound(_0xedc43a,null))['then'](respondWithResult(_0xedc43a,null))[_0xbb35('0x4f')](handleError(_0xedc43a,null));};exports[_0xbb35('0x2a')]=function(_0x1daf00,_0x238886){if(_0x1daf00[_0xbb35('0x50')]['id']){delete _0x1daf00[_0xbb35('0x50')]['id'];}return db[_0xbb35('0x48')][_0xbb35('0x4e')]({'where':{'id':_0x1daf00[_0xbb35('0x51')]['id']}})['then'](handleEntityNotFound(_0x238886,null))[_0xbb35('0x2b')](saveUpdates(_0x1daf00[_0xbb35('0x50')],null))[_0xbb35('0x2b')](respondWithResult(_0x238886,null))['catch'](handleError(_0x238886,null));};exports[_0xbb35('0x2c')]=function(_0x36f0ab,_0xde532b){return db[_0xbb35('0x48')]['find']({'where':{'id':_0x36f0ab[_0xbb35('0x51')]['id']}})[_0xbb35('0x2b')](handleEntityNotFound(_0xde532b,null))[_0xbb35('0x2b')](removeEntity(_0xde532b,null))['catch'](handleError(_0xde532b,null));};exports[_0xbb35('0x52')]=function(_0x37c8df,_0x131af6){return db[_0xbb35('0x48')][_0xbb35('0x52')]()[_0xbb35('0x2b')](respondWithResult(_0x131af6,null))[_0xbb35('0x4f')](handleError(_0x131af6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 145aa82..8e65553 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 _0x6949=['exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39744b,_0x5b2f13){var _0x41df66=function(_0x55885e){while(--_0x55885e){_0x39744b['push'](_0x39744b['shift']());}};_0x41df66(++_0x5b2f13);}(_0x6949,0xc0));var _0x9694=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x6949[_0x2adfb1];return _0xa52d45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9694('0x0'))(_0x9694('0x1'));var moment=require(_0x9694('0x2'));var BPromise=require(_0x9694('0x3'));var rp=require(_0x9694('0x4'));var fs=require('fs');var path=require(_0x9694('0x5'));var rimraf=require(_0x9694('0x6'));var config=require(_0x9694('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x9694('0x8')]=function(_0x511bc1,_0x5cb288){return _0x511bc1[_0x9694('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41a6=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x41a6,0x1de));var _0x641a=function(_0x313277,_0x365ad3){_0x313277=_0x313277-0x0;var _0x146109=_0x41a6[_0x313277];return _0x146109;};'use strict';var _=require(_0x641a('0x0'));var util=require(_0x641a('0x1'));var logger=require(_0x641a('0x2'))(_0x641a('0x3'));var moment=require(_0x641a('0x4'));var BPromise=require('bluebird');var rp=require(_0x641a('0x5'));var fs=require('fs');var path=require(_0x641a('0x6'));var rimraf=require(_0x641a('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x641a('0x8')]=function(_0x99b58c,_0x1f231c){return _0x99b58c[_0x641a('0x9')](_0x641a('0xa'),attributes,{'tableName':_0x641a('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 71cc941..1603628 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 _0x5bb5=['code','message','info','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','then','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x474ce,_0x1a0188){var _0x4b1350=function(_0x221745){while(--_0x221745){_0x474ce['push'](_0x474ce['shift']());}};_0x4b1350(++_0x1a0188);}(_0x5bb5,0x13e));var _0x55bb=function(_0x3984c6,_0x170225){_0x3984c6=_0x3984c6-0x0;var _0x54e11e=_0x5bb5[_0x3984c6];return _0x54e11e;};'use strict';var _=require('lodash');var util=require(_0x55bb('0x0'));var moment=require('moment');var BPromise=require(_0x55bb('0x1'));var rs=require(_0x55bb('0x2'));var fs=require('fs');var Redis=require(_0x55bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x55bb('0x4'));var logger=require('../../config/logger')(_0x55bb('0x5'));var config=require(_0x55bb('0x6'));var jayson=require(_0x55bb('0x7'));var client=jayson['client'][_0x55bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2812e4,_0x2fa371,_0x399883){return new BPromise(function(_0x1e819b,_0xa6644b){return client[_0x55bb('0x9')](_0x2812e4,_0x399883)['then'](function(_0x1c804f){logger['info'](_0x55bb('0xa'),_0x2fa371,'request\x20sent');logger[_0x55bb('0xb')](_0x55bb('0xc'),_0x2fa371,'request\x20sent',JSON[_0x55bb('0xd')](_0x1c804f));if(_0x1c804f[_0x55bb('0xe')]){if(_0x1c804f[_0x55bb('0xe')][_0x55bb('0xf')]===0x1f4){logger[_0x55bb('0xe')](_0x55bb('0xa'),_0x2fa371,_0x1c804f['error'][_0x55bb('0x10')]);return _0xa6644b(_0x1c804f[_0x55bb('0xe')][_0x55bb('0x10')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2fa371,_0x1c804f[_0x55bb('0xe')][_0x55bb('0x10')]);return _0x1e819b(_0x1c804f[_0x55bb('0xe')]['message']);}else{logger[_0x55bb('0x11')](_0x55bb('0xa'),_0x2fa371,_0x55bb('0x12'));_0x1e819b(_0x1c804f[_0x55bb('0x13')][_0x55bb('0x10')]);}})[_0x55bb('0x14')](function(_0x22c0a1){logger[_0x55bb('0xe')](_0x55bb('0xa'),_0x2fa371,_0x22c0a1);_0xa6644b(_0x22c0a1);});});}exports[_0x55bb('0x15')]=function(_0x4c1530){var _0x2687fc=this;return new Promise(function(_0x1050b0,_0x34f962){return db[_0x55bb('0x16')][_0x55bb('0x17')]({'raw':_0x4c1530[_0x55bb('0x18')]?_0x4c1530[_0x55bb('0x18')][_0x55bb('0x19')]===undefined?!![]:![]:!![],'where':_0x4c1530[_0x55bb('0x18')]?_0x4c1530[_0x55bb('0x18')][_0x55bb('0x1a')]||null:null,'attributes':_0x4c1530[_0x55bb('0x18')]?_0x4c1530[_0x55bb('0x18')][_0x55bb('0x1b')]||null:null,'limit':_0x4c1530[_0x55bb('0x18')]?_0x4c1530[_0x55bb('0x18')][_0x55bb('0x1c')]||null:null,'include':_0x4c1530[_0x55bb('0x18')]?_0x4c1530[_0x55bb('0x18')]['include']?_['map'](_0x4c1530['options'][_0x55bb('0x1d')],function(_0x391bdf){return{'model':db[_0x391bdf[_0x55bb('0x1e')]],'as':_0x391bdf['as'],'attributes':_0x391bdf[_0x55bb('0x1b')],'include':_0x391bdf[_0x55bb('0x1d')]?_['map'](_0x391bdf[_0x55bb('0x1d')],function(_0x2125cc){return{'model':db[_0x2125cc[_0x55bb('0x1e')]],'as':_0x2125cc['as'],'attributes':_0x2125cc[_0x55bb('0x1b')],'include':_0x2125cc[_0x55bb('0x1d')]?_['map'](_0x2125cc[_0x55bb('0x1d')],function(_0x34a203){return{'model':db[_0x34a203['model']],'as':_0x34a203['as'],'attributes':_0x34a203['attributes']};}):[]};}):[]};}):[]:[]})[_0x55bb('0x1f')](function(_0x122870){logger[_0x55bb('0x11')](_0x55bb('0x15'),_0x4c1530);logger[_0x55bb('0xb')]('GetCmHopperBlack',_0x4c1530,JSON[_0x55bb('0xd')](_0x122870));_0x1050b0(_0x122870);})['catch'](function(_0x2855ee){logger['error'](_0x55bb('0x15'),_0x2855ee[_0x55bb('0x10')],_0x4c1530);_0x34f962(_0x2687fc[_0x55bb('0xe')](0x1f4,_0x2855ee['message']));});});};exports['UpdateCmHopperBlack']=function(_0x1c6178){var _0x194b0e=this;return new Promise(function(_0x8a4a7e,_0x908e31){return db['CmHopperBlack'][_0x55bb('0x20')](_0x1c6178[_0x55bb('0x21')],{'raw':_0x1c6178[_0x55bb('0x18')]?_0x1c6178[_0x55bb('0x18')][_0x55bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c6178[_0x55bb('0x18')]?_0x1c6178['options']['where']||null:null,'attributes':_0x1c6178[_0x55bb('0x18')]?_0x1c6178['options']['attributes']||null:null,'limit':_0x1c6178[_0x55bb('0x18')]?_0x1c6178[_0x55bb('0x18')][_0x55bb('0x1c')]||null:null})[_0x55bb('0x1f')](function(_0x477e42){logger[_0x55bb('0x11')](_0x55bb('0x22'),_0x1c6178);logger[_0x55bb('0xb')](_0x55bb('0x22'),_0x1c6178,JSON['stringify'](_0x477e42));_0x8a4a7e(_0x477e42);})[_0x55bb('0x14')](function(_0x568e2f){logger[_0x55bb('0xe')]('UpdateCmHopperBlack',_0x568e2f[_0x55bb('0x10')],_0x1c6178);_0x908e31(_0x194b0e['error'](0x1f4,_0x568e2f[_0x55bb('0x10')]));});});};exports[_0x55bb('0x23')]=function(_0x456455){var _0x196bbb=this;return new Promise(function(_0xce9e0a,_0x2e6ba4){return db['CmHopperBlack'][_0x55bb('0x24')]({'where':_0x456455[_0x55bb('0x18')]?_0x456455[_0x55bb('0x18')][_0x55bb('0x1a')]||null:null})[_0x55bb('0x1f')](function(_0xdfa149){logger[_0x55bb('0x11')](_0x55bb('0x23'),_0x456455);logger[_0x55bb('0xb')](_0x55bb('0x23'),_0x456455,JSON[_0x55bb('0xd')](_0xdfa149));_0xce9e0a(_0xdfa149);})[_0x55bb('0x14')](function(_0x3e30ff){logger[_0x55bb('0xe')](_0x55bb('0x23'),_0x3e30ff['message'],_0x456455);_0x2e6ba4(_0x196bbb[_0x55bb('0xe')](0x1f4,_0x3e30ff['message']));});});}; \ No newline at end of file +var _0xa480=['model','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map'];(function(_0x1b4785,_0x466dc2){var _0x356b87=function(_0x35360d){while(--_0x35360d){_0x1b4785['push'](_0x1b4785['shift']());}};_0x356b87(++_0x466dc2);}(_0xa480,0x165));var _0x0a48=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xa480[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x0a48('0x0'));var util=require(_0x0a48('0x1'));var moment=require('moment');var BPromise=require(_0x0a48('0x2'));var rs=require(_0x0a48('0x3'));var fs=require('fs');var Redis=require(_0x0a48('0x4'));var db=require(_0x0a48('0x5'))['db'];var utils=require(_0x0a48('0x6'));var logger=require(_0x0a48('0x7'))(_0x0a48('0x8'));var config=require('../../config/environment');var jayson=require(_0x0a48('0x9'));var client=jayson[_0x0a48('0xa')][_0x0a48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25ed4b,_0x9b7137,_0x188749){return new BPromise(function(_0x38d288,_0x497b8e){return client[_0x0a48('0xc')](_0x25ed4b,_0x188749)[_0x0a48('0xd')](function(_0x28ff40){logger[_0x0a48('0xe')](_0x0a48('0xf'),_0x9b7137,'request\x20sent');logger[_0x0a48('0x10')](_0x0a48('0x11'),_0x9b7137,_0x0a48('0x12'),JSON[_0x0a48('0x13')](_0x28ff40));if(_0x28ff40['error']){if(_0x28ff40['error'][_0x0a48('0x14')]===0x1f4){logger['error'](_0x0a48('0xf'),_0x9b7137,_0x28ff40['error']['message']);return _0x497b8e(_0x28ff40[_0x0a48('0x15')]['message']);}logger[_0x0a48('0x15')](_0x0a48('0xf'),_0x9b7137,_0x28ff40['error'][_0x0a48('0x16')]);return _0x38d288(_0x28ff40[_0x0a48('0x15')]['message']);}else{logger[_0x0a48('0xe')](_0x0a48('0xf'),_0x9b7137,'request\x20sent');_0x38d288(_0x28ff40['result'][_0x0a48('0x16')]);}})[_0x0a48('0x17')](function(_0x46d11b){logger[_0x0a48('0x15')](_0x0a48('0xf'),_0x9b7137,_0x46d11b);_0x497b8e(_0x46d11b);});});}exports[_0x0a48('0x18')]=function(_0x3ee088){var _0x392ea5=this;return new Promise(function(_0x3de64e,_0x37840b){return db[_0x0a48('0x19')][_0x0a48('0x1a')]({'raw':_0x3ee088[_0x0a48('0x1b')]?_0x3ee088[_0x0a48('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3ee088[_0x0a48('0x1b')]?_0x3ee088[_0x0a48('0x1b')][_0x0a48('0x1c')]||null:null,'attributes':_0x3ee088[_0x0a48('0x1b')]?_0x3ee088[_0x0a48('0x1b')][_0x0a48('0x1d')]||null:null,'limit':_0x3ee088[_0x0a48('0x1b')]?_0x3ee088[_0x0a48('0x1b')][_0x0a48('0x1e')]||null:null,'include':_0x3ee088[_0x0a48('0x1b')]?_0x3ee088[_0x0a48('0x1b')][_0x0a48('0x1f')]?_[_0x0a48('0x20')](_0x3ee088[_0x0a48('0x1b')]['include'],function(_0x47d87b){return{'model':db[_0x47d87b['model']],'as':_0x47d87b['as'],'attributes':_0x47d87b['attributes'],'include':_0x47d87b[_0x0a48('0x1f')]?_[_0x0a48('0x20')](_0x47d87b[_0x0a48('0x1f')],function(_0x370803){return{'model':db[_0x370803[_0x0a48('0x21')]],'as':_0x370803['as'],'attributes':_0x370803[_0x0a48('0x1d')],'include':_0x370803[_0x0a48('0x1f')]?_[_0x0a48('0x20')](_0x370803[_0x0a48('0x1f')],function(_0x4aab42){return{'model':db[_0x4aab42[_0x0a48('0x21')]],'as':_0x4aab42['as'],'attributes':_0x4aab42['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a48('0xd')](function(_0x38a870){logger[_0x0a48('0xe')](_0x0a48('0x18'),_0x3ee088);logger[_0x0a48('0x10')](_0x0a48('0x18'),_0x3ee088,JSON[_0x0a48('0x13')](_0x38a870));_0x3de64e(_0x38a870);})[_0x0a48('0x17')](function(_0x98b48){logger[_0x0a48('0x15')]('GetCmHopperBlack',_0x98b48[_0x0a48('0x16')],_0x3ee088);_0x37840b(_0x392ea5[_0x0a48('0x15')](0x1f4,_0x98b48[_0x0a48('0x16')]));});});};exports[_0x0a48('0x22')]=function(_0x326cc8){var _0x569750=this;return new Promise(function(_0x127461,_0x413be0){return db[_0x0a48('0x19')]['update'](_0x326cc8[_0x0a48('0x23')],{'raw':_0x326cc8[_0x0a48('0x1b')]?_0x326cc8['options'][_0x0a48('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x326cc8[_0x0a48('0x1b')]?_0x326cc8['options'][_0x0a48('0x1c')]||null:null,'attributes':_0x326cc8[_0x0a48('0x1b')]?_0x326cc8[_0x0a48('0x1b')][_0x0a48('0x1d')]||null:null,'limit':_0x326cc8[_0x0a48('0x1b')]?_0x326cc8['options'][_0x0a48('0x1e')]||null:null})[_0x0a48('0xd')](function(_0x58682d){logger['info']('UpdateCmHopperBlack',_0x326cc8);logger[_0x0a48('0x10')](_0x0a48('0x22'),_0x326cc8,JSON[_0x0a48('0x13')](_0x58682d));_0x127461(_0x58682d);})['catch'](function(_0x439735){logger['error'](_0x0a48('0x22'),_0x439735[_0x0a48('0x16')],_0x326cc8);_0x413be0(_0x569750[_0x0a48('0x15')](0x1f4,_0x439735['message']));});});};exports[_0x0a48('0x25')]=function(_0x5ce0a9){var _0x31436d=this;return new Promise(function(_0x578aea,_0x579b4a){return db[_0x0a48('0x19')][_0x0a48('0x26')]({'where':_0x5ce0a9[_0x0a48('0x1b')]?_0x5ce0a9[_0x0a48('0x1b')][_0x0a48('0x1c')]||null:null})[_0x0a48('0xd')](function(_0xa17a04){logger['info']('DestroyCmHopperBlack',_0x5ce0a9);logger[_0x0a48('0x10')]('DestroyCmHopperBlack',_0x5ce0a9,JSON[_0x0a48('0x13')](_0xa17a04));_0x578aea(_0xa17a04);})['catch'](function(_0x466ad5){logger['error']('DestroyCmHopperBlack',_0x466ad5[_0x0a48('0x16')],_0x5ce0a9);_0x579b4a(_0x31436d['error'](0x1f4,_0x466ad5[_0x0a48('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 753b692..2ca741e 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 _0x1623=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete','destroy','exports'];(function(_0x21235c,_0x5f27c6){var _0x2fdbd5=function(_0x336763){while(--_0x336763){_0x21235c['push'](_0x21235c['shift']());}};_0x2fdbd5(++_0x5f27c6);}(_0x1623,0xab));var _0x3162=function(_0x45f7a3,_0x39b7fb){_0x45f7a3=_0x45f7a3-0x0;var _0x5ecff3=_0x1623[_0x45f7a3];return _0x5ecff3;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3162('0xf')]);router[_0x3162('0x10')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x11')]);module[_0x3162('0x12')]=router; \ No newline at end of file +var _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f9d,0x93));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['put']('/:id',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 05cde00..684ecea 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 _0xec50=['endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue'];(function(_0x362daf,_0xa85b22){var _0x14d1d4=function(_0x5231f6){while(--_0x5231f6){_0x362daf['push'](_0x362daf['shift']());}};_0x14d1d4(++_0xa85b22);}(_0xec50,0x19f));var _0x0ec5=function(_0x433c11,_0x509a13){_0x433c11=_0x433c11-0x0;var _0x1bbb06=_0xec50[_0x433c11];return _0x1bbb06;};'use strict';var Sequelize=require(_0x0ec5('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x0ec5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0ec5('0x2')]},'scheduledat':{'type':Sequelize[_0x0ec5('0x3')]},'countbusyretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0ec5('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0ec5('0x2')]},'calleridnum':{'type':Sequelize[_0x0ec5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0ec5('0x3')]},'responsetime':{'type':Sequelize[_0x0ec5('0x3')]},'answertime':{'type':Sequelize[_0x0ec5('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0ec5('0x3')]},'ringtime':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0ec5('0x2')]},'campaign':{'type':Sequelize[_0x0ec5('0x2')]},'campaigntype':{'type':Sequelize[_0x0ec5('0x2')]},'membername':{'type':Sequelize[_0x0ec5('0x2')]},'reason':{'type':Sequelize[_0x0ec5('0x2')]},'disposition':{'type':Sequelize[_0x0ec5('0x2')]},'secondDisposition':{'type':Sequelize[_0x0ec5('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0ec5('0x2')]},'dispositionat':{'type':Sequelize[_0x0ec5('0x3')],'set':function(_0x251136){var _0xc044f4=this[_0x0ec5('0x4')](_0x0ec5('0x5'));if(_0xc044f4&&_0x251136){this[_0x0ec5('0x6')]('followuptime',moment(_0x251136)[_0x0ec5('0x7')](moment(_0xc044f4),_0x0ec5('0x8')));}}},'amd':{'type':Sequelize[_0x0ec5('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0ec5('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0ec5('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0ec5('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0ec5('0x3')]},'callback':{'type':Sequelize[_0x0ec5('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0ec5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0ec5('0x3')]},'deleted':{'type':Sequelize[_0x0ec5('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0ec5('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0ec5('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37cc=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x543db4,_0x425951){var _0x2eee9e=function(_0x4704d9){while(--_0x4704d9){_0x543db4['push'](_0x543db4['shift']());}};_0x2eee9e(++_0x425951);}(_0x37cc,0x173));var _0xc37c=function(_0xc66190,_0x1dab7d){_0xc66190=_0xc66190-0x0;var _0x20b436=_0x37cc[_0xc66190];return _0x20b436;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc37c('0x0'));module[_0xc37c('0x1')]={'state':{'type':Sequelize[_0xc37c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc37c('0x3')]},'scheduledat':{'type':Sequelize[_0xc37c('0x4')]},'countbusyretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc37c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc37c('0x3')]},'originatecalleridname':{'type':Sequelize[_0xc37c('0x3')]},'calleridnum':{'type':Sequelize[_0xc37c('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc37c('0x4')]},'responsetime':{'type':Sequelize[_0xc37c('0x4')]},'answertime':{'type':Sequelize[_0xc37c('0x4')]},'droptime':{'type':Sequelize[_0xc37c('0x4')]},'endtime':{'type':Sequelize[_0xc37c('0x4')]},'ringtime':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc37c('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc37c('0x3')]},'membername':{'type':Sequelize[_0xc37c('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc37c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc37c('0x3')]},'dispositionat':{'type':Sequelize[_0xc37c('0x4')],'set':function(_0x5a2eb2){var _0x4f175f=this[_0xc37c('0x5')](_0xc37c('0x6'));if(_0x4f175f&&_0x5a2eb2){this[_0xc37c('0x7')](_0xc37c('0x8'),moment(_0x5a2eb2)[_0xc37c('0x9')](moment(_0x4f175f),_0xc37c('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc37c('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc37c('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc37c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc37c('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc37c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 17e6b20..a558ce6 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 _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x1124a5,_0x4c0917){var _0x2f4aae=function(_0x4b209a){while(--_0x4b209a){_0x1124a5['push'](_0x1124a5['shift']());}};_0x2f4aae(++_0x4c0917);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3fa9ea,_0x5328d8){_0x3fa9ea=_0x3fa9ea-0x0;var _0x37677a=_0xc2c7[_0x3fa9ea];return _0x37677a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file +var _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x470d9e,_0x2a2da5){var _0x1e8507=function(_0x31f345){while(--_0x31f345){_0x470d9e['push'](_0x470d9e['shift']());}};_0x1e8507(++_0x2a2da5);}(_0x7a54,0x106));var _0x47a5=function(_0x5e2202,_0x3b5a00){_0x5e2202=_0x5e2202-0x0;var _0x39de89=_0x7a54[_0x5e2202];return _0x39de89;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 68a5fa5..7d6df1b 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 _0xf956=['bluebird','request-promise','path','rimraf','define','CmHopperFinal','calleridnum','lodash','../../config/logger','api'];(function(_0xbb1920,_0x21d136){var _0x33ca72=function(_0x27ad58){while(--_0x27ad58){_0xbb1920['push'](_0xbb1920['shift']());}};_0x33ca72(++_0x21d136);}(_0xf956,0x129));var _0x6f95=function(_0x4230f4,_0x38625b){_0x4230f4=_0x4230f4-0x0;var _0x4a12ac=_0xf956[_0x4230f4];return _0x4a12ac;};'use strict';var _=require(_0x6f95('0x0'));var util=require('util');var logger=require(_0x6f95('0x1'))(_0x6f95('0x2'));var moment=require('moment');var BPromise=require(_0x6f95('0x3'));var rp=require(_0x6f95('0x4'));var fs=require('fs');var path=require(_0x6f95('0x5'));var rimraf=require(_0x6f95('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x55ea4e,_0x46e9ad){return _0x55ea4e[_0x6f95('0x7')](_0x6f95('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x6f95('0x9'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8423=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x8423,0x132));var _0x3842=function(_0x340844,_0x56c401){_0x340844=_0x340844-0x0;var _0x493eac=_0x8423[_0x340844];return _0x493eac;};'use strict';var _=require('lodash');var util=require(_0x3842('0x0'));var logger=require(_0x3842('0x1'))(_0x3842('0x2'));var moment=require(_0x3842('0x3'));var BPromise=require(_0x3842('0x4'));var rp=require(_0x3842('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3842('0x6'));var config=require(_0x3842('0x7'));var attributes=require(_0x3842('0x8'));module[_0x3842('0x9')]=function(_0xe91296,_0x403a57){return _0xe91296[_0x3842('0xa')](_0x3842('0xb'),attributes,{'tableName':_0x3842('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3842('0xd')]},{'name':_0x3842('0xe'),'fields':[_0x3842('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 e347938..4c16de3 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(_0xf6eb42,_0x5b164b){var _0x13778c=function(_0xb150b6){while(--_0xb150b6){_0xf6eb42['push'](_0xf6eb42['shift']());}};_0x13778c(++_0x5b164b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b5af1,_0x1db01b){_0x5b5af1=_0x5b5af1-0x0;var _0x45ab7b=_0xb10b[_0x5b5af1];return _0x45ab7b;};'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(_0x2f01ab,_0x4d9ba3){var _0x26e67c=function(_0x2e8ad0){while(--_0x2e8ad0){_0x2f01ab['push'](_0x2f01ab['shift']());}};_0x26e67c(++_0x4d9ba3);}(_0xb10b,0x12a));var _0xbb10=function(_0x317943,_0x1a4079){_0x317943=_0x317943-0x0;var _0x5a578e=_0xb10b[_0x317943];return _0x5a578e;};'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 cbc9435..bedd7ea 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 _0xef30=['/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','multer','util','connect-timeout','express','Router','fs-extra','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x4a787c,_0x129bdb){var _0xf4aff6=function(_0x338500){while(--_0x338500){_0x4a787c['push'](_0x4a787c['shift']());}};_0xf4aff6(++_0x129bdb);}(_0xef30,0x133));var _0x0ef3=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xef30[_0x277107];return _0x1da046;};'use strict';var multer=require(_0x0ef3('0x0'));var util=require(_0x0ef3('0x1'));var path=require('path');var timeout=require(_0x0ef3('0x2'));var express=require(_0x0ef3('0x3'));var router=express[_0x0ef3('0x4')]();var fs_extra=require(_0x0ef3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0ef3('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0ef3('0x7')](_0x0ef3('0x8'),auth[_0x0ef3('0x9')](),controller[_0x0ef3('0xa')]);router[_0x0ef3('0x7')](_0x0ef3('0xb'),auth[_0x0ef3('0x9')](),controller[_0x0ef3('0xc')]);router[_0x0ef3('0x7')](_0x0ef3('0xd'),auth['isAuthenticated'](),controller[_0x0ef3('0xe')]);router[_0x0ef3('0x7')](_0x0ef3('0xf'),auth[_0x0ef3('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x0ef3('0x10')](_0x0ef3('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x0ef3('0x10')](_0x0ef3('0x12'),auth[_0x0ef3('0x9')](),controller[_0x0ef3('0x13')]);router[_0x0ef3('0x10')](_0x0ef3('0x14'),auth[_0x0ef3('0x9')](),controller[_0x0ef3('0x15')]);router[_0x0ef3('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x132a=['describe','get','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x132a,0xe7));var _0xa132=function(_0x12a7df,_0x1361b4){_0x12a7df=_0x12a7df-0x0;var _0x507bf0=_0x132a[_0x12a7df];return _0x507bf0;};'use strict';var multer=require('multer');var util=require(_0xa132('0x0'));var path=require(_0xa132('0x1'));var timeout=require(_0xa132('0x2'));var express=require(_0xa132('0x3'));var router=express[_0xa132('0x4')]();var fs_extra=require(_0xa132('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa132('0x6'));var config=require(_0xa132('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xa132('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa132('0x9')]);router[_0xa132('0xa')]('/:id',auth[_0xa132('0x8')](),controller[_0xa132('0xb')]);router[_0xa132('0xa')]('/voice/queue/countAttributes/:id',auth[_0xa132('0x8')](),controller[_0xa132('0xc')]);router[_0xa132('0xa')]('/campaign/countAttributes/:id',auth[_0xa132('0x8')](),controller[_0xa132('0xd')]);router[_0xa132('0xe')](_0xa132('0xf'),auth[_0xa132('0x8')](),controller[_0xa132('0x10')]);router[_0xa132('0xe')](_0xa132('0x11'),auth[_0xa132('0x8')](),controller[_0xa132('0x12')]);router[_0xa132('0xe')](_0xa132('0x13'),auth[_0xa132('0x8')](),controller['checkContactHopper']);router[_0xa132('0x14')](_0xa132('0x15'),auth['isAuthenticated'](),controller[_0xa132('0x16')]);module[_0xa132('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index dbba42b..f6324a7 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 _0xe49a=['DATE','INTEGER','BOOLEAN','STRING'];(function(_0x237140,_0x13f896){var _0x2e26f2=function(_0x1e7a52){while(--_0x1e7a52){_0x237140['push'](_0x237140['shift']());}};_0x2e26f2(++_0x13f896);}(_0xe49a,0x6f));var _0xae49=function(_0x1c1f82,_0x113720){_0x1c1f82=_0x1c1f82-0x0;var _0x2d63e2=_0xe49a[_0x1c1f82];return _0x2d63e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xae49('0x0')]},'scheduledat':{'type':Sequelize[_0xae49('0x1')]},'countbusyretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xae49('0x0')]},'calleridnum':{'type':Sequelize[_0xae49('0x0')]},'calleridname':{'type':Sequelize[_0xae49('0x0')]},'starttime':{'type':Sequelize[_0xae49('0x1')]},'responsetime':{'type':Sequelize[_0xae49('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xae49('0x0')]},'campaigntype':{'type':Sequelize[_0xae49('0x0')]},'membername':{'type':Sequelize[_0xae49('0x0')]},'reason':{'type':Sequelize[_0xae49('0x0')]},'amd':{'type':Sequelize[_0xae49('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xae49('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xae49('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xae49('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xae49('0x1')]},'recallme':{'type':Sequelize[_0xae49('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae49('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe201=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe201,0x1f1));var _0x1e20=function(_0x522bc8,_0x3525bf){_0x522bc8=_0x522bc8-0x0;var _0x5c5ab4=_0xe201[_0x522bc8];return _0x5c5ab4;};'use strict';var Sequelize=require(_0x1e20('0x0'));module[_0x1e20('0x1')]={'state':{'type':Sequelize[_0x1e20('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1e20('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1e20('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1e20('0x3')]},'calleridnum':{'type':Sequelize[_0x1e20('0x3')]},'calleridname':{'type':Sequelize[_0x1e20('0x3')]},'starttime':{'type':Sequelize[_0x1e20('0x4')]},'responsetime':{'type':Sequelize[_0x1e20('0x4')]},'answertime':{'type':Sequelize[_0x1e20('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1e20('0x4')]},'ringtime':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1e20('0x3')]},'campaigntype':{'type':Sequelize[_0x1e20('0x3')]},'membername':{'type':Sequelize[_0x1e20('0x3')]},'reason':{'type':Sequelize[_0x1e20('0x3')]},'amd':{'type':Sequelize[_0x1e20('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1e20('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1e20('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1e20('0x4')]},'recallme':{'type':Sequelize[_0x1e20('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1e20('0x4')]},'edited':{'type':Sequelize[_0x1e20('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1e20('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1e20('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9f8b40d..9e6b12d 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 _0x3ddd=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','then','error','stack','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','describe','update','body','uniqueid','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x41316a,_0x115589){var _0x363e5a=function(_0x43e83d){while(--_0x43e83d){_0x41316a['push'](_0x41316a['shift']());}};_0x363e5a(++_0x115589);}(_0x3ddd,0x96));var _0xd3dd=function(_0x4e3fb,_0x5c3245){_0x4e3fb=_0x4e3fb-0x0;var _0x24262d=_0x3ddd[_0x4e3fb];return _0x24262d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd3dd('0x0'));var rp=require(_0xd3dd('0x1'));var moment=require(_0xd3dd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd3dd('0x3'));var util=require('util');var path=require(_0xd3dd('0x4'));var sox=require(_0xd3dd('0x5'));var csv=require(_0xd3dd('0x6'));var ejs=require(_0xd3dd('0x7'));var fs=require('fs');var fs_extra=require(_0xd3dd('0x8'));var _=require(_0xd3dd('0x9'));var squel=require(_0xd3dd('0xa'));var crypto=require(_0xd3dd('0xb'));var jsforce=require(_0xd3dd('0xc'));var deskjs=require(_0xd3dd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd3dd('0xe'));var Papa=require(_0xd3dd('0xf'));var Redis=require(_0xd3dd('0x10'));var authService=require(_0xd3dd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3dd('0x12'));var logger=require(_0xd3dd('0x13'))(_0xd3dd('0x14'));var utils=require(_0xd3dd('0x15'));var config=require(_0xd3dd('0x16'));var licenseUtil=require(_0xd3dd('0x17'));var db=require(_0xd3dd('0x18'))['db'];function respondWithStatusCode(_0x541237,_0x7d54e8){_0x7d54e8=_0x7d54e8||0xcc;return function(_0x5dcff2){if(_0x5dcff2){return _0x541237[_0xd3dd('0x19')](_0x7d54e8);}return _0x541237[_0xd3dd('0x1a')](_0x7d54e8)[_0xd3dd('0x1b')]();};}function respondWithResult(_0x2c1959,_0x351a1b){_0x351a1b=_0x351a1b||0xc8;return function(_0x1db715){if(_0x1db715){return _0x2c1959[_0xd3dd('0x1a')](_0x351a1b)[_0xd3dd('0x1c')](_0x1db715);}};}function respondWithFilteredResult(_0x104f38,_0x1fe09a){return function(_0xbb388d){if(_0xbb388d){var _0x5e8a77=typeof _0x1fe09a['offset']==='undefined'&&typeof _0x1fe09a['limit']===_0xd3dd('0x1d');var _0x5efc87=_0xbb388d[_0xd3dd('0x1e')];var _0x379554=_0x5e8a77?0x0:_0x1fe09a[_0xd3dd('0x1f')];var _0x2c158f=_0x5e8a77?_0xbb388d['count']:_0x1fe09a[_0xd3dd('0x1f')]+_0x1fe09a[_0xd3dd('0x20')];var _0x58be00;if(_0x2c158f>=_0x5efc87){_0x2c158f=_0x5efc87;_0x58be00=0xc8;}else{_0x58be00=0xce;}_0x104f38[_0xd3dd('0x1a')](_0x58be00);return _0x104f38[_0xd3dd('0x21')](_0xd3dd('0x22'),_0x379554+'-'+_0x2c158f+'/'+_0x5efc87)[_0xd3dd('0x1c')](_0xbb388d);}return null;};}function patchUpdates(_0x362e89){return function(_0x1b77e5){try{jsonpatch['apply'](_0x1b77e5,_0x362e89,!![]);}catch(_0xa801bb){return BPromise['reject'](_0xa801bb);}return _0x1b77e5[_0xd3dd('0x23')]();};}function saveUpdates(_0x456a6f,_0x1e47e5){return function(_0x299636){if(_0x299636){return _0x299636['update'](_0x456a6f)[_0xd3dd('0x24')](function(_0x44ef03){return _0x44ef03;});}return null;};}function removeEntity(_0x324599,_0x49c638){return function(_0x58a84c){if(_0x58a84c){return _0x58a84c['destroy']()[_0xd3dd('0x24')](function(){_0x324599[_0xd3dd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59067c,_0x1f54e8){return function(_0x5c6b14){if(!_0x5c6b14){_0x59067c['sendStatus'](0x194);}return _0x5c6b14;};}function handleError(_0x713f9e,_0x23ecf2){_0x23ecf2=_0x23ecf2||0x1f4;return function(_0x1bedfa){logger[_0xd3dd('0x25')](_0x1bedfa[_0xd3dd('0x26')]);if(_0x1bedfa['name']){delete _0x1bedfa['name'];}_0x713f9e[_0xd3dd('0x1a')](_0x23ecf2)[_0xd3dd('0x27')](_0x1bedfa);};}exports[_0xd3dd('0x28')]=function(_0xc1a0f2,_0x4f9681){var _0x515fd7={},_0x7534f3={},_0x4f7d88={'count':0x0,'rows':[]};var _0x23ab22=_[_0xd3dd('0x29')](db[_0xd3dd('0x2a')][_0xd3dd('0x2b')],function(_0xb03fb1){return{'name':_0xb03fb1[_0xd3dd('0x2c')],'type':_0xb03fb1[_0xd3dd('0x2d')][_0xd3dd('0x2e')]};});_0x7534f3[_0xd3dd('0x2f')]=_[_0xd3dd('0x29')](_0x23ab22,_0xd3dd('0x30'));_0x7534f3['query']=_[_0xd3dd('0x31')](_0xc1a0f2[_0xd3dd('0x32')]);_0x7534f3[_0xd3dd('0x33')]=_[_0xd3dd('0x34')](_0x7534f3[_0xd3dd('0x2f')],_0x7534f3[_0xd3dd('0x32')]);_0x515fd7[_0xd3dd('0x35')]=_[_0xd3dd('0x34')](_0x7534f3[_0xd3dd('0x2f')],qs[_0xd3dd('0x36')](_0xc1a0f2[_0xd3dd('0x32')]['fields']));_0x515fd7[_0xd3dd('0x35')]=_0x515fd7['attributes'][_0xd3dd('0x37')]?_0x515fd7[_0xd3dd('0x35')]:_0x7534f3[_0xd3dd('0x2f')];if(!_0xc1a0f2[_0xd3dd('0x32')][_0xd3dd('0x38')](_0xd3dd('0x39'))){_0x515fd7['limit']=qs['limit'](_0xc1a0f2[_0xd3dd('0x32')][_0xd3dd('0x20')]);_0x515fd7[_0xd3dd('0x1f')]=qs['offset'](_0xc1a0f2[_0xd3dd('0x32')][_0xd3dd('0x1f')]);}_0x515fd7[_0xd3dd('0x3a')]=qs[_0xd3dd('0x3b')](_0xc1a0f2[_0xd3dd('0x32')]['sort']);_0x515fd7[_0xd3dd('0x3c')]=qs[_0xd3dd('0x33')](_[_0xd3dd('0x3d')](_0xc1a0f2['query'],_0x7534f3[_0xd3dd('0x33')]),_0x23ab22);if(_0xc1a0f2['query'][_0xd3dd('0x3e')]){_0x515fd7[_0xd3dd('0x3c')]=_[_0xd3dd('0x3f')](_0x515fd7[_0xd3dd('0x3c')],{'$or':_[_0xd3dd('0x29')](_0x23ab22,function(_0x56851f){if(_0x56851f[_0xd3dd('0x2d')]!==_0xd3dd('0x40')){var _0x1dd405={};_0x1dd405[_0x56851f[_0xd3dd('0x30')]]={'$like':'%'+_0xc1a0f2['query'][_0xd3dd('0x3e')]+'%'};return _0x1dd405;}})});}_0x515fd7=_[_0xd3dd('0x3f')]({},_0x515fd7,_0xc1a0f2[_0xd3dd('0x41')]);var _0x1ca63f={'where':_0x515fd7[_0xd3dd('0x3c')]};return db[_0xd3dd('0x2a')][_0xd3dd('0x1e')](_0x1ca63f)[_0xd3dd('0x24')](function(_0xa26fd){_0x4f7d88['count']=_0xa26fd;if(_0xc1a0f2[_0xd3dd('0x32')]['includeAll']){_0x515fd7[_0xd3dd('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x515fd7);})[_0xd3dd('0x24')](function(_0x5593c){_0x4f7d88[_0xd3dd('0x43')]=_0x5593c;return _0x4f7d88;})[_0xd3dd('0x24')](respondWithFilteredResult(_0x4f9681,_0x515fd7))[_0xd3dd('0x44')](handleError(_0x4f9681,null));};exports[_0xd3dd('0x45')]=function(_0x6d7c42,_0x43e8b4){var _0x3d4630={'raw':!![],'where':{'id':_0x6d7c42[_0xd3dd('0x46')]['id']}},_0xe62df2={};_0xe62df2['model']=_['keys'](db[_0xd3dd('0x2a')][_0xd3dd('0x2b')]);_0xe62df2[_0xd3dd('0x32')]=_[_0xd3dd('0x31')](_0x6d7c42[_0xd3dd('0x32')]);_0xe62df2[_0xd3dd('0x33')]=_[_0xd3dd('0x34')](_0xe62df2[_0xd3dd('0x2f')],_0xe62df2[_0xd3dd('0x32')]);_0x3d4630[_0xd3dd('0x35')]=_[_0xd3dd('0x34')](_0xe62df2[_0xd3dd('0x2f')],qs[_0xd3dd('0x36')](_0x6d7c42[_0xd3dd('0x32')][_0xd3dd('0x36')]));_0x3d4630[_0xd3dd('0x35')]=_0x3d4630[_0xd3dd('0x35')][_0xd3dd('0x37')]?_0x3d4630[_0xd3dd('0x35')]:_0xe62df2[_0xd3dd('0x2f')];if(_0x6d7c42[_0xd3dd('0x32')][_0xd3dd('0x47')]){_0x3d4630[_0xd3dd('0x42')]=[{'all':!![]}];}_0x3d4630=_['merge']({},_0x3d4630,_0x6d7c42[_0xd3dd('0x41')]);return db[_0xd3dd('0x2a')][_0xd3dd('0x48')](_0x3d4630)[_0xd3dd('0x24')](handleEntityNotFound(_0x43e8b4,null))['then'](respondWithResult(_0x43e8b4,null))[_0xd3dd('0x44')](handleError(_0x43e8b4,null));};exports[_0xd3dd('0x49')]=function(_0x55b38a,_0xeb335e){return db[_0xd3dd('0x2a')][_0xd3dd('0x49')](_0x55b38a['body'],{})[_0xd3dd('0x24')](respondWithResult(_0xeb335e,0xc9))[_0xd3dd('0x44')](handleError(_0xeb335e,null));};exports[_0xd3dd('0x4a')]=function(_0x466dd3,_0x8c57df){return db['CmHopperHistory'][_0xd3dd('0x4a')]()[_0xd3dd('0x24')](respondWithResult(_0x8c57df,null))[_0xd3dd('0x44')](handleError(_0x8c57df,null));};exports[_0xd3dd('0x4b')]=function(_0x348541,_0x1e06c4){if(_0x348541[_0xd3dd('0x4c')][_0xd3dd('0x4d')]){delete _0x348541[_0xd3dd('0x4c')][_0xd3dd('0x4d')];}return db[_0xd3dd('0x2a')][_0xd3dd('0x48')]({'where':{'uniqueid':_0x348541[_0xd3dd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e06c4,null))[_0xd3dd('0x24')](saveUpdates(_0x348541[_0xd3dd('0x4c')],null))['then'](respondWithResult(_0x1e06c4,null))[_0xd3dd('0x44')](handleError(_0x1e06c4,null));}; \ No newline at end of file +var _0x81ac=['request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','keys','find','catch','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch'];(function(_0x33bffd,_0x5b720a){var _0x2f05ac=function(_0x4d7b13){while(--_0x4d7b13){_0x33bffd['push'](_0x33bffd['shift']());}};_0x2f05ac(++_0x5b720a);}(_0x81ac,0x129));var _0xc81a=function(_0x5b9e7c,_0x596341){_0x5b9e7c=_0x5b9e7c-0x0;var _0x1db7f0=_0x81ac[_0x5b9e7c];return _0x1db7f0;};'use strict';var emlformat=require(_0xc81a('0x0'));var rimraf=require(_0xc81a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc81a('0x2'));var rp=require(_0xc81a('0x3'));var moment=require(_0xc81a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc81a('0x5'));var path=require(_0xc81a('0x6'));var sox=require(_0xc81a('0x7'));var csv=require(_0xc81a('0x8'));var ejs=require(_0xc81a('0x9'));var fs=require('fs');var fs_extra=require(_0xc81a('0xa'));var _=require(_0xc81a('0xb'));var squel=require(_0xc81a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc81a('0x8'));var querystring=require(_0xc81a('0xd'));var Papa=require(_0xc81a('0xe'));var Redis=require(_0xc81a('0xf'));var authService=require(_0xc81a('0x10'));var qs=require(_0xc81a('0x11'));var as=require(_0xc81a('0x12'));var hardwareService=require(_0xc81a('0x13'));var logger=require(_0xc81a('0x14'))(_0xc81a('0x15'));var utils=require('../../config/utils');var config=require(_0xc81a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc81a('0x17'))['db'];function respondWithStatusCode(_0x188103,_0x160557){_0x160557=_0x160557||0xcc;return function(_0x4e053b){if(_0x4e053b){return _0x188103[_0xc81a('0x18')](_0x160557);}return _0x188103[_0xc81a('0x19')](_0x160557)[_0xc81a('0x1a')]();};}function respondWithResult(_0x2d57d1,_0x19e9c1){_0x19e9c1=_0x19e9c1||0xc8;return function(_0x315eb6){if(_0x315eb6){return _0x2d57d1[_0xc81a('0x19')](_0x19e9c1)[_0xc81a('0x1b')](_0x315eb6);}};}function respondWithFilteredResult(_0x144e46,_0x2d14c5){return function(_0x4031f4){if(_0x4031f4){var _0x37ff9d=typeof _0x2d14c5['offset']===_0xc81a('0x1c')&&typeof _0x2d14c5[_0xc81a('0x1d')]===_0xc81a('0x1c');var _0x45512d=_0x4031f4[_0xc81a('0x1e')];var _0x484a5f=_0x37ff9d?0x0:_0x2d14c5['offset'];var _0x5e339a=_0x37ff9d?_0x4031f4[_0xc81a('0x1e')]:_0x2d14c5['offset']+_0x2d14c5['limit'];var _0x19b9dd;if(_0x5e339a>=_0x45512d){_0x5e339a=_0x45512d;_0x19b9dd=0xc8;}else{_0x19b9dd=0xce;}_0x144e46['status'](_0x19b9dd);return _0x144e46['set'](_0xc81a('0x1f'),_0x484a5f+'-'+_0x5e339a+'/'+_0x45512d)[_0xc81a('0x1b')](_0x4031f4);}return null;};}function patchUpdates(_0x263bb0){return function(_0x4e5eb5){try{jsonpatch[_0xc81a('0x20')](_0x4e5eb5,_0x263bb0,!![]);}catch(_0xa5f495){return BPromise[_0xc81a('0x21')](_0xa5f495);}return _0x4e5eb5['save']();};}function saveUpdates(_0x3b1bbb,_0x225cfd){return function(_0x162f05){if(_0x162f05){return _0x162f05[_0xc81a('0x22')](_0x3b1bbb)[_0xc81a('0x23')](function(_0x1f064a){return _0x1f064a;});}return null;};}function removeEntity(_0x5be2b5,_0x5c62d2){return function(_0x2a8067){if(_0x2a8067){return _0x2a8067['destroy']()[_0xc81a('0x23')](function(){_0x5be2b5[_0xc81a('0x19')](0xcc)[_0xc81a('0x1a')]();});}};}function handleEntityNotFound(_0x95b01,_0x5a12af){return function(_0x3656d3){if(!_0x3656d3){_0x95b01[_0xc81a('0x18')](0x194);}return _0x3656d3;};}function handleError(_0x521826,_0x64fc0){_0x64fc0=_0x64fc0||0x1f4;return function(_0x4ee20e){logger[_0xc81a('0x24')](_0x4ee20e[_0xc81a('0x25')]);if(_0x4ee20e[_0xc81a('0x26')]){delete _0x4ee20e[_0xc81a('0x26')];}_0x521826[_0xc81a('0x19')](_0x64fc0)[_0xc81a('0x27')](_0x4ee20e);};}exports[_0xc81a('0x28')]=function(_0x353019,_0x19f2fc){var _0x9652ba={},_0x455a8f={},_0x5a132d={'count':0x0,'rows':[]};var _0x39abdb=_[_0xc81a('0x29')](db[_0xc81a('0x2a')][_0xc81a('0x2b')],function(_0x1e16b0){return{'name':_0x1e16b0[_0xc81a('0x2c')],'type':_0x1e16b0[_0xc81a('0x2d')][_0xc81a('0x2e')]};});_0x455a8f[_0xc81a('0x2f')]=_[_0xc81a('0x29')](_0x39abdb,_0xc81a('0x26'));_0x455a8f[_0xc81a('0x30')]=_['keys'](_0x353019[_0xc81a('0x30')]);_0x455a8f[_0xc81a('0x31')]=_[_0xc81a('0x32')](_0x455a8f[_0xc81a('0x2f')],_0x455a8f[_0xc81a('0x30')]);_0x9652ba[_0xc81a('0x33')]=_[_0xc81a('0x32')](_0x455a8f['model'],qs['fields'](_0x353019[_0xc81a('0x30')][_0xc81a('0x34')]));_0x9652ba[_0xc81a('0x33')]=_0x9652ba[_0xc81a('0x33')][_0xc81a('0x35')]?_0x9652ba[_0xc81a('0x33')]:_0x455a8f[_0xc81a('0x2f')];if(!_0x353019[_0xc81a('0x30')][_0xc81a('0x36')](_0xc81a('0x37'))){_0x9652ba[_0xc81a('0x1d')]=qs[_0xc81a('0x1d')](_0x353019['query'][_0xc81a('0x1d')]);_0x9652ba['offset']=qs[_0xc81a('0x38')](_0x353019['query'][_0xc81a('0x38')]);}_0x9652ba[_0xc81a('0x39')]=qs[_0xc81a('0x3a')](_0x353019[_0xc81a('0x30')][_0xc81a('0x3a')]);_0x9652ba[_0xc81a('0x3b')]=qs[_0xc81a('0x31')](_[_0xc81a('0x3c')](_0x353019[_0xc81a('0x30')],_0x455a8f['filters']),_0x39abdb);if(_0x353019[_0xc81a('0x30')][_0xc81a('0x3d')]){_0x9652ba[_0xc81a('0x3b')]=_[_0xc81a('0x3e')](_0x9652ba[_0xc81a('0x3b')],{'$or':_[_0xc81a('0x29')](_0x39abdb,function(_0x563d47){if(_0x563d47[_0xc81a('0x2d')]!=='VIRTUAL'){var _0x373960={};_0x373960[_0x563d47[_0xc81a('0x26')]]={'$like':'%'+_0x353019[_0xc81a('0x30')][_0xc81a('0x3d')]+'%'};return _0x373960;}})});}_0x9652ba=_[_0xc81a('0x3e')]({},_0x9652ba,_0x353019[_0xc81a('0x3f')]);var _0x1a1fad={'where':_0x9652ba[_0xc81a('0x3b')]};return db['CmHopperHistory'][_0xc81a('0x1e')](_0x1a1fad)['then'](function(_0x59162){_0x5a132d[_0xc81a('0x1e')]=_0x59162;if(_0x353019['query'][_0xc81a('0x40')]){_0x9652ba[_0xc81a('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc81a('0x42')](_0x9652ba);})['then'](function(_0x5f0225){_0x5a132d[_0xc81a('0x43')]=_0x5f0225;return _0x5a132d;})['then'](respondWithFilteredResult(_0x19f2fc,_0x9652ba))['catch'](handleError(_0x19f2fc,null));};exports['show']=function(_0x37649f,_0x164170){var _0x27b57c={'raw':!![],'where':{'id':_0x37649f['params']['id']}},_0x495fde={};_0x495fde['model']=_[_0xc81a('0x44')](db[_0xc81a('0x2a')]['rawAttributes']);_0x495fde[_0xc81a('0x30')]=_[_0xc81a('0x44')](_0x37649f[_0xc81a('0x30')]);_0x495fde[_0xc81a('0x31')]=_['intersection'](_0x495fde['model'],_0x495fde[_0xc81a('0x30')]);_0x27b57c[_0xc81a('0x33')]=_['intersection'](_0x495fde[_0xc81a('0x2f')],qs[_0xc81a('0x34')](_0x37649f[_0xc81a('0x30')][_0xc81a('0x34')]));_0x27b57c[_0xc81a('0x33')]=_0x27b57c[_0xc81a('0x33')][_0xc81a('0x35')]?_0x27b57c[_0xc81a('0x33')]:_0x495fde[_0xc81a('0x2f')];if(_0x37649f['query']['includeAll']){_0x27b57c['include']=[{'all':!![]}];}_0x27b57c=_[_0xc81a('0x3e')]({},_0x27b57c,_0x37649f[_0xc81a('0x3f')]);return db[_0xc81a('0x2a')][_0xc81a('0x45')](_0x27b57c)[_0xc81a('0x23')](handleEntityNotFound(_0x164170,null))[_0xc81a('0x23')](respondWithResult(_0x164170,null))[_0xc81a('0x46')](handleError(_0x164170,null));};exports['create']=function(_0x581e9b,_0x1c0a7b){return db[_0xc81a('0x2a')][_0xc81a('0x47')](_0x581e9b['body'],{})[_0xc81a('0x23')](respondWithResult(_0x1c0a7b,0xc9))[_0xc81a('0x46')](handleError(_0x1c0a7b,null));};exports[_0xc81a('0x48')]=function(_0x41de22,_0x572d72){return db[_0xc81a('0x2a')][_0xc81a('0x48')]()[_0xc81a('0x23')](respondWithResult(_0x572d72,null))[_0xc81a('0x46')](handleError(_0x572d72,null));};exports[_0xc81a('0x22')]=function(_0x86c9bf,_0x54da28){if(_0x86c9bf[_0xc81a('0x49')]['uniqueid']){delete _0x86c9bf[_0xc81a('0x49')][_0xc81a('0x4a')];}return db[_0xc81a('0x2a')][_0xc81a('0x45')]({'where':{'uniqueid':_0x86c9bf['params']['id']}})[_0xc81a('0x23')](handleEntityNotFound(_0x54da28,null))[_0xc81a('0x23')](saveUpdates(_0x86c9bf[_0xc81a('0x49')],null))[_0xc81a('0x23')](respondWithResult(_0x54da28,null))[_0xc81a('0x46')](handleError(_0x54da28,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e17e38c..c29d943 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 _0x7804=['moment','request-promise','path','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','lodash','../../config/logger','api'];(function(_0x25c597,_0x35f16c){var _0x1be8b7=function(_0x479c73){while(--_0x479c73){_0x25c597['push'](_0x25c597['shift']());}};_0x1be8b7(++_0x35f16c);}(_0x7804,0xc3));var _0x4780=function(_0x55e36e,_0x1b5771){_0x55e36e=_0x55e36e-0x0;var _0x184429=_0x7804[_0x55e36e];return _0x184429;};'use strict';var _=require(_0x4780('0x0'));var util=require('util');var logger=require(_0x4780('0x1'))(_0x4780('0x2'));var moment=require(_0x4780('0x3'));var BPromise=require('bluebird');var rp=require(_0x4780('0x4'));var fs=require('fs');var path=require(_0x4780('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4780('0x6'));module['exports']=function(_0x4914ae,_0x138148){return _0x4914ae[_0x4780('0x7')](_0x4780('0x8'),attributes,{'tableName':_0x4780('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x4780('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['CmHopperHistory','cm_hopper_history','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x156c28,_0x60f6a7){var _0x1fee2d=function(_0x50e4c8){while(--_0x50e4c8){_0x156c28['push'](_0x156c28['shift']());}};_0x1fee2d(++_0x60f6a7);}(_0x7a52,0x1bd));var _0x27a5=function(_0x26f3df,_0xf96192){_0x26f3df=_0x26f3df-0x0;var _0x236f21=_0x7a52[_0x26f3df];return _0x236f21;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var logger=require(_0x27a5('0x1'))(_0x27a5('0x2'));var moment=require(_0x27a5('0x3'));var BPromise=require(_0x27a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27a5('0x5'));var rimraf=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var attributes=require(_0x27a5('0x8'));module[_0x27a5('0x9')]=function(_0x393c55,_0x23fc7e){return _0x393c55['define'](_0x27a5('0xa'),attributes,{'tableName':_0x27a5('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x27a5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c6ca394..9722cb5 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 _0xecf8=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','debug','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash'];(function(_0xbb45f6,_0x4df78e){var _0x4c122b=function(_0xdbf214){while(--_0xdbf214){_0xbb45f6['push'](_0xbb45f6['shift']());}};_0x4c122b(++_0x4df78e);}(_0xecf8,0xd4));var _0x8ecf=function(_0x5f3bad,_0x41db38){_0x5f3bad=_0x5f3bad-0x0;var _0x2a0de9=_0xecf8[_0x5f3bad];return _0x2a0de9;};'use strict';var _=require(_0x8ecf('0x0'));var util=require(_0x8ecf('0x1'));var moment=require(_0x8ecf('0x2'));var BPromise=require(_0x8ecf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ecf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ecf('0x5'));var logger=require(_0x8ecf('0x6'))('rpc');var config=require(_0x8ecf('0x7'));var jayson=require(_0x8ecf('0x8'));var client=jayson[_0x8ecf('0x9')][_0x8ecf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e83f,_0x4d6b74,_0x870b2a){return new BPromise(function(_0x13865a,_0x13441c){return client[_0x8ecf('0xb')](_0x18e83f,_0x870b2a)[_0x8ecf('0xc')](function(_0x29a9c7){logger[_0x8ecf('0xd')](_0x8ecf('0xe'),_0x4d6b74,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4d6b74,_0x8ecf('0xf'),JSON[_0x8ecf('0x10')](_0x29a9c7));if(_0x29a9c7[_0x8ecf('0x11')]){if(_0x29a9c7[_0x8ecf('0x11')][_0x8ecf('0x12')]===0x1f4){logger[_0x8ecf('0x11')](_0x8ecf('0xe'),_0x4d6b74,_0x29a9c7['error'][_0x8ecf('0x13')]);return _0x13441c(_0x29a9c7[_0x8ecf('0x11')][_0x8ecf('0x13')]);}logger[_0x8ecf('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4d6b74,_0x29a9c7[_0x8ecf('0x11')][_0x8ecf('0x13')]);return _0x13865a(_0x29a9c7['error'][_0x8ecf('0x13')]);}else{logger[_0x8ecf('0xd')](_0x8ecf('0xe'),_0x4d6b74,_0x8ecf('0xf'));_0x13865a(_0x29a9c7[_0x8ecf('0x14')][_0x8ecf('0x13')]);}})[_0x8ecf('0x15')](function(_0x3cf2e6){logger[_0x8ecf('0x11')](_0x8ecf('0xe'),_0x4d6b74,_0x3cf2e6);_0x13441c(_0x3cf2e6);});});}exports[_0x8ecf('0x16')]=function(_0x2cf645){var _0x3c4b49=this;return new Promise(function(_0x7c7d71,_0x59f338){return db['CmHopperHistory']['create'](_0x2cf645[_0x8ecf('0x17')],{'raw':_0x2cf645['options']?_0x2cf645[_0x8ecf('0x18')][_0x8ecf('0x19')]===undefined?!![]:![]:!![]})[_0x8ecf('0xc')](function(_0x33ebd0){logger[_0x8ecf('0xd')](_0x8ecf('0x16'),_0x2cf645);logger['debug'](_0x8ecf('0x16'),_0x2cf645,JSON[_0x8ecf('0x10')](_0x33ebd0));_0x7c7d71(_0x33ebd0);})[_0x8ecf('0x15')](function(_0x4077af){logger[_0x8ecf('0x11')](_0x8ecf('0x16'),_0x4077af['message'],_0x2cf645);_0x59f338(_0x3c4b49[_0x8ecf('0x11')](0x1f4,_0x4077af['message']));});});};exports[_0x8ecf('0x1a')]=function(_0x31f6ba){var _0x41899e=this;return new Promise(function(_0x3702bd,_0x44c61f){return db[_0x8ecf('0x1b')][_0x8ecf('0x1c')]({'raw':_0x31f6ba['options']?_0x31f6ba[_0x8ecf('0x18')][_0x8ecf('0x19')]===undefined?!![]:![]:!![],'where':_0x31f6ba[_0x8ecf('0x18')]?_0x31f6ba[_0x8ecf('0x18')][_0x8ecf('0x1d')]||null:null,'attributes':[[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['col']('id')),_0x8ecf('0x20')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x22')))),_0x8ecf('0x23')],[db[_0x8ecf('0x1e')]['fn']('COUNT',db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')]['literal'](_0x8ecf('0x24')))),_0x8ecf('0x25')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x26'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x27')))),_0x8ecf('0x28')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x26'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')]['literal'](_0x8ecf('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x8ecf('0xc')](function(_0x3d7648){logger[_0x8ecf('0xd')](_0x8ecf('0x1a'),_0x31f6ba);logger[_0x8ecf('0x2a')](_0x8ecf('0x1a'),_0x31f6ba,JSON['stringify'](_0x3d7648));_0x3702bd(_0x3d7648);})['catch'](function(_0x5603ec){logger[_0x8ecf('0x11')](_0x8ecf('0x1a'),_0x5603ec['message'],_0x31f6ba);_0x44c61f(_0x41899e['error'](0x1f4,_0x5603ec[_0x8ecf('0x13')]));});});};exports[_0x8ecf('0x2b')]=function(_0x41d934){var _0x181ef8=this;return new Promise(function(_0x12243b,_0x151aa5){return db[_0x8ecf('0x1b')][_0x8ecf('0x1c')]({'raw':_0x41d934[_0x8ecf('0x18')]?_0x41d934['options'][_0x8ecf('0x19')]===undefined?!![]:![]:!![],'where':_0x41d934[_0x8ecf('0x18')]?_0x41d934[_0x8ecf('0x18')][_0x8ecf('0x1d')]||null:null,'attributes':[[_0x8ecf('0x2c'),_0x8ecf('0x2d')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x2e')))),_0x8ecf('0x2f')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db['sequelize'][_0x8ecf('0x21')](_0x8ecf('0x30')))),_0x8ecf('0x31')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x32')))),'outboundAnswerCallsDay'],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x33')))),_0x8ecf('0x34')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8ecf('0x21')](_0x8ecf('0x35')))),_0x8ecf('0x36')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db['sequelize']['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8ecf('0x37')],[db[_0x8ecf('0x1e')]['fn']('COUNT',db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')]['literal'](_0x8ecf('0x38')))),_0x8ecf('0x39')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db['sequelize']['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x3a')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')]['literal'](_0x8ecf('0x3b')))),_0x8ecf('0x3c')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x3d')))),_0x8ecf('0x3e')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db['sequelize'][_0x8ecf('0x21')](_0x8ecf('0x3f')))),'outboundRejectCallsDay'],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x40')))),_0x8ecf('0x41')],[db['sequelize']['fn']('COUNT',db[_0x8ecf('0x1e')]['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')](_0x8ecf('0x42')))),_0x8ecf('0x43')],[db[_0x8ecf('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8ecf('0x1e')][_0x8ecf('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x8ecf('0x2c')]})[_0x8ecf('0xc')](function(_0x513945){logger[_0x8ecf('0xd')](_0x8ecf('0x2b'),_0x41d934);logger[_0x8ecf('0x2a')](_0x8ecf('0x2b'),_0x41d934,JSON[_0x8ecf('0x10')](_0x513945));_0x12243b(_0x513945);})[_0x8ecf('0x15')](function(_0x2a63a3){logger[_0x8ecf('0x11')]('GetVoiceQueueHopperHistory',_0x2a63a3[_0x8ecf('0x13')],_0x41d934);_0x151aa5(_0x181ef8['error'](0x1f4,_0x2a63a3['message']));});});};exports[_0x8ecf('0x44')]=function(_0x200e33){var _0x40410c=this;return new Promise(function(_0x21a660,_0x4ae6d9){return db[_0x8ecf('0x1b')][_0x8ecf('0x1c')]({'raw':_0x200e33[_0x8ecf('0x18')]?_0x200e33[_0x8ecf('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x200e33['options']?_0x200e33[_0x8ecf('0x18')][_0x8ecf('0x1d')]||null:null,'attributes':[['campaign',_0x8ecf('0x2d')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db[_0x8ecf('0x1e')]['col']('id')),_0x8ecf('0x45')],[db[_0x8ecf('0x1e')]['fn'](_0x8ecf('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8ecf('0x32')))),_0x8ecf('0x46')]],'group':[_0x8ecf('0x2c')]})[_0x8ecf('0xc')](function(_0x264d94){logger[_0x8ecf('0xd')](_0x8ecf('0x44'),_0x200e33);logger['debug'](_0x8ecf('0x44'),_0x200e33,JSON[_0x8ecf('0x10')](_0x264d94));_0x21a660(_0x264d94);})['catch'](function(_0x2e2b32){logger[_0x8ecf('0x11')](_0x8ecf('0x44'),_0x2e2b32[_0x8ecf('0x13')],_0x200e33);_0x4ae6d9(_0x40410c[_0x8ecf('0x11')](0x1f4,_0x2e2b32[_0x8ecf('0x13')]));});});}; \ No newline at end of file +var _0xb545=['outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','catch','AvgHandleTime','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','findAll','raw','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0xb545,0xcf));var _0x5b54=function(_0x2001cf,_0x1e8943){_0x2001cf=_0x2001cf-0x0;var _0x3a2182=_0xb545[_0x2001cf];return _0x3a2182;};'use strict';var _=require('lodash');var util=require(_0x5b54('0x0'));var moment=require('moment');var BPromise=require(_0x5b54('0x1'));var rs=require(_0x5b54('0x2'));var fs=require('fs');var Redis=require(_0x5b54('0x3'));var db=require(_0x5b54('0x4'))['db'];var utils=require(_0x5b54('0x5'));var logger=require('../../config/logger')(_0x5b54('0x6'));var config=require(_0x5b54('0x7'));var jayson=require(_0x5b54('0x8'));var client=jayson[_0x5b54('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b9c1,_0x2ee77f,_0x41e579){return new BPromise(function(_0x32a785,_0x321734){return client[_0x5b54('0xa')](_0x50b9c1,_0x41e579)[_0x5b54('0xb')](function(_0x553a32){logger[_0x5b54('0xc')](_0x5b54('0xd'),_0x2ee77f,'request\x20sent');logger[_0x5b54('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2ee77f,_0x5b54('0xf'),JSON[_0x5b54('0x10')](_0x553a32));if(_0x553a32[_0x5b54('0x11')]){if(_0x553a32[_0x5b54('0x11')][_0x5b54('0x12')]===0x1f4){logger[_0x5b54('0x11')](_0x5b54('0xd'),_0x2ee77f,_0x553a32[_0x5b54('0x11')]['message']);return _0x321734(_0x553a32['error']['message']);}logger[_0x5b54('0x11')](_0x5b54('0xd'),_0x2ee77f,_0x553a32[_0x5b54('0x11')]['message']);return _0x32a785(_0x553a32[_0x5b54('0x11')][_0x5b54('0x13')]);}else{logger[_0x5b54('0xc')](_0x5b54('0xd'),_0x2ee77f,_0x5b54('0xf'));_0x32a785(_0x553a32['result'][_0x5b54('0x13')]);}})['catch'](function(_0x257abd){logger['error'](_0x5b54('0xd'),_0x2ee77f,_0x257abd);_0x321734(_0x257abd);});});}exports[_0x5b54('0x14')]=function(_0x333aaf){var _0x331b15=this;return new Promise(function(_0x138360,_0x377e91){return db[_0x5b54('0x15')][_0x5b54('0x16')](_0x333aaf[_0x5b54('0x17')],{'raw':_0x333aaf['options']?_0x333aaf[_0x5b54('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f933d){logger['info']('CreateCmHopperHistory',_0x333aaf);logger[_0x5b54('0xe')](_0x5b54('0x14'),_0x333aaf,JSON['stringify'](_0x3f933d));_0x138360(_0x3f933d);})[_0x5b54('0x19')](function(_0x5031f7){logger['error'](_0x5b54('0x14'),_0x5031f7[_0x5b54('0x13')],_0x333aaf);_0x377e91(_0x331b15[_0x5b54('0x11')](0x1f4,_0x5031f7[_0x5b54('0x13')]));});});};exports[_0x5b54('0x1a')]=function(_0xe954f5){var _0x395fa7=this;return new Promise(function(_0x22e5be,_0x1f9e42){return db[_0x5b54('0x15')]['findAll']({'raw':_0xe954f5['options']?_0xe954f5[_0x5b54('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe954f5[_0x5b54('0x18')]?_0xe954f5['options']['where']||null:null,'attributes':[[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x1e')))),_0x5b54('0x1f')],[db['sequelize']['fn'](_0x5b54('0x1c'),db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x20')))),_0x5b54('0x21')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db['sequelize'][_0x5b54('0x1d')]('`state`\x20=\x2011,\x201,\x20null'))),_0x5b54('0x22')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x23'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x24')))),_0x5b54('0x25')],[db[_0x5b54('0x1b')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x5b54('0xb')](function(_0x179503){logger[_0x5b54('0xc')]('AvgHandleTime',_0xe954f5);logger['debug'](_0x5b54('0x1a'),_0xe954f5,JSON[_0x5b54('0x10')](_0x179503));_0x22e5be(_0x179503);})['catch'](function(_0x21559e){logger[_0x5b54('0x11')](_0x5b54('0x1a'),_0x21559e[_0x5b54('0x13')],_0xe954f5);_0x1f9e42(_0x395fa7[_0x5b54('0x11')](0x1f4,_0x21559e[_0x5b54('0x13')]));});});};exports[_0x5b54('0x27')]=function(_0x35c6a8){var _0x4e75e0=this;return new Promise(function(_0x575de5,_0x2e3a7d){return db[_0x5b54('0x15')][_0x5b54('0x28')]({'raw':_0x35c6a8['options']?_0x35c6a8[_0x5b54('0x18')][_0x5b54('0x29')]===undefined?!![]:![]:!![],'where':_0x35c6a8['options']?_0x35c6a8[_0x5b54('0x18')][_0x5b54('0x2a')]||null:null,'attributes':[[_0x5b54('0x2b'),_0x5b54('0x2c')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0x5b54('0x2d')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5b54('0x2e')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x1e')))),_0x5b54('0x2f')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x30')))),_0x5b54('0x31')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x32')))),_0x5b54('0x33')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5b54('0x34')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5b54('0x35')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x36')))),_0x5b54('0x37')],[db['sequelize']['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x38')))),_0x5b54('0x39')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3a')))),_0x5b54('0x3b')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3d')))),_0x5b54('0x3b')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db['sequelize'][_0x5b54('0x1d')](_0x5b54('0x3e')))),'outboundReCallsDay']],'group':[_0x5b54('0x2b')]})[_0x5b54('0xb')](function(_0x1a9daf){logger[_0x5b54('0xc')](_0x5b54('0x27'),_0x35c6a8);logger[_0x5b54('0xe')]('GetVoiceQueueHopperHistory',_0x35c6a8,JSON[_0x5b54('0x10')](_0x1a9daf));_0x575de5(_0x1a9daf);})[_0x5b54('0x19')](function(_0xdeca8c){logger[_0x5b54('0x11')]('GetVoiceQueueHopperHistory',_0xdeca8c[_0x5b54('0x13')],_0x35c6a8);_0x2e3a7d(_0x4e75e0[_0x5b54('0x11')](0x1f4,_0xdeca8c[_0x5b54('0x13')]));});});};exports[_0x5b54('0x3f')]=function(_0x5ad735){var _0x3fa4b3=this;return new Promise(function(_0x28f8fa,_0x3d0cdf){return db[_0x5b54('0x15')][_0x5b54('0x28')]({'raw':_0x5ad735[_0x5b54('0x18')]?_0x5ad735[_0x5b54('0x18')][_0x5b54('0x29')]===undefined?!![]:![]:!![],'where':_0x5ad735[_0x5b54('0x18')]?_0x5ad735[_0x5b54('0x18')][_0x5b54('0x2a')]||null:null,'attributes':[['campaign',_0x5b54('0x2c')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['col']('id')),_0x5b54('0x40')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x1e')))),_0x5b54('0x41')]],'group':[_0x5b54('0x2b')]})[_0x5b54('0xb')](function(_0x49d990){logger['info'](_0x5b54('0x3f'),_0x5ad735);logger[_0x5b54('0xe')](_0x5b54('0x3f'),_0x5ad735,JSON[_0x5b54('0x10')](_0x49d990));_0x28f8fa(_0x49d990);})[_0x5b54('0x19')](function(_0x55ff71){logger['error'](_0x5b54('0x3f'),_0x55ff71[_0x5b54('0x13')],_0x5ad735);_0x3d0cdf(_0x3fa4b3['error'](0x1f4,_0x55ff71[_0x5b54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b1251b1..4a10fe5 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 _0x3ace=['update','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x4b7afb,_0x5b4f78){var _0x1eaf18=function(_0x3d7993){while(--_0x3d7993){_0x4b7afb['push'](_0x4b7afb['shift']());}};_0x1eaf18(++_0x5b4f78);}(_0x3ace,0x10f));var _0xe3ac=function(_0xa14e8e,_0x4b3b36){_0xa14e8e=_0xa14e8e-0x0;var _0xcf5b9d=_0x3ace[_0xa14e8e];return _0xcf5b9d;};'use strict';var multer=require(_0xe3ac('0x0'));var util=require(_0xe3ac('0x1'));var path=require('path');var timeout=require(_0xe3ac('0x2'));var express=require('express');var router=express[_0xe3ac('0x3')]();var fs_extra=require(_0xe3ac('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe3ac('0x5'));var controller=require(_0xe3ac('0x6'));router[_0xe3ac('0x7')]('/',auth['isAuthenticated'](),controller[_0xe3ac('0x8')]);router[_0xe3ac('0x7')](_0xe3ac('0x9'),auth['isAuthenticated'](),controller[_0xe3ac('0xa')]);router[_0xe3ac('0x7')](_0xe3ac('0xb'),auth[_0xe3ac('0xc')](),controller[_0xe3ac('0xd')]);router[_0xe3ac('0xe')]('/',auth['isAuthenticated'](),controller[_0xe3ac('0xf')]);router[_0xe3ac('0x10')](_0xe3ac('0xb'),auth[_0xe3ac('0xc')](),controller[_0xe3ac('0x11')]);module['exports']=router; \ No newline at end of file +var _0x17dc=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','multer'];(function(_0x11ae05,_0xb34f47){var _0x239c2f=function(_0xd35c61){while(--_0xd35c61){_0x11ae05['push'](_0x11ae05['shift']());}};_0x239c2f(++_0xb34f47);}(_0x17dc,0x18e));var _0xc17d=function(_0x582ae6,_0x57aa08){_0x582ae6=_0x582ae6-0x0;var _0x303447=_0x17dc[_0x582ae6];return _0x303447;};'use strict';var multer=require(_0xc17d('0x0'));var util=require(_0xc17d('0x1'));var path=require('path');var timeout=require(_0xc17d('0x2'));var express=require(_0xc17d('0x3'));var router=express[_0xc17d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc17d('0x5'));var interaction=require(_0xc17d('0x6'));var config=require(_0xc17d('0x7'));var controller=require(_0xc17d('0x8'));router[_0xc17d('0x9')]('/',auth['isAuthenticated'](),controller[_0xc17d('0xa')]);router[_0xc17d('0x9')](_0xc17d('0xb'),auth[_0xc17d('0xc')](),controller[_0xc17d('0xd')]);router[_0xc17d('0x9')](_0xc17d('0xe'),auth[_0xc17d('0xc')](),controller['show']);router[_0xc17d('0xf')]('/',auth[_0xc17d('0xc')](),controller[_0xc17d('0x10')]);router[_0xc17d('0x11')](_0xc17d('0xe'),auth[_0xc17d('0xc')](),controller[_0xc17d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 75c93e4..45f701f 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 _0xeb0d=['sequelize','STRING'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x294fe5,_0x13b6e6){_0x294fe5=_0x294fe5-0x0;var _0x50e88e=_0xeb0d[_0x294fe5];return _0x50e88e;};'use strict';var Sequelize=require(_0xdeb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdeb0('0x1')]},'dialPrefix':{'type':Sequelize[_0xdeb0('0x1')]}}; \ No newline at end of file +var _0xf987=['STRING','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf987,0x18a));var _0x7f98=function(_0x5bca85,_0x27de14){_0x5bca85=_0x5bca85-0x0;var _0x5b1885=_0xf987[_0x5bca85];return _0x5b1885;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7f98('0x0')],'unique':_0x7f98('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7f98('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index da2748f..40d8b51 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 _0x554e=['describe','isArray','tags','push','each','CmContact','omit','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','nolimit','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','Lists','UserProfileResource','destroy','sendStatus','error','stack','name','map','CmList','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','params','intersection','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','rawAttributes','pick','rows','removeDispositions','ids','addContacts'];(function(_0x72efda,_0xb34cd6){var _0x187b19=function(_0x575c02){while(--_0x575c02){_0x72efda['push'](_0x72efda['shift']());}};_0x187b19(++_0xb34cd6);}(_0x554e,0x18b));var _0xe554=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0x554e[_0x4250b4];return _0x8a4807;};'use strict';var emlformat=require(_0xe554('0x0'));var rimraf=require(_0xe554('0x1'));var zipdir=require(_0xe554('0x2'));var jsonpatch=require(_0xe554('0x3'));var rp=require(_0xe554('0x4'));var moment=require(_0xe554('0x5'));var BPromise=require(_0xe554('0x6'));var Mustache=require('mustache');var util=require(_0xe554('0x7'));var path=require('path');var sox=require(_0xe554('0x8'));var csv=require(_0xe554('0x9'));var ejs=require(_0xe554('0xa'));var fs=require('fs');var fs_extra=require(_0xe554('0xb'));var _=require(_0xe554('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe554('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe554('0x9'));var querystring=require(_0xe554('0xe'));var Papa=require(_0xe554('0xf'));var Redis=require(_0xe554('0x10'));var authService=require(_0xe554('0x11'));var qs=require(_0xe554('0x12'));var as=require(_0xe554('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe554('0x14'))(_0xe554('0x15'));var utils=require(_0xe554('0x16'));var config=require(_0xe554('0x17'));var licenseUtil=require(_0xe554('0x18'));var db=require(_0xe554('0x19'))['db'];var csv_results;config[_0xe554('0x1a')]=_[_0xe554('0x1b')](config[_0xe554('0x1a')],{'host':_0xe554('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe554('0x1a')]));require(_0xe554('0x1d'))[_0xe554('0x1e')](socket);function respondWithStatusCode(_0x1278aa,_0x55072b){_0x55072b=_0x55072b||0xcc;return function(_0x3067e1){if(_0x3067e1){return _0x1278aa['sendStatus'](_0x55072b);}return _0x1278aa[_0xe554('0x1f')](_0x55072b)[_0xe554('0x20')]();};}function respondWithResult(_0xba4878,_0x1d62cb){_0x1d62cb=_0x1d62cb||0xc8;return function(_0x363e42){if(_0x363e42){return _0xba4878[_0xe554('0x1f')](_0x1d62cb)[_0xe554('0x21')](_0x363e42);}};}function respondWithFilteredResult(_0x206c77,_0x4a6c93){return function(_0x15cf70){if(_0x15cf70){var _0x2108ce=typeof _0x4a6c93[_0xe554('0x22')]==='undefined'&&typeof _0x4a6c93['limit']===_0xe554('0x23');var _0x144ae9=_0x15cf70[_0xe554('0x24')];var _0x1b5da2=_0x2108ce?0x0:_0x4a6c93['offset'];var _0xc3deea=_0x2108ce?_0x15cf70['count']:_0x4a6c93[_0xe554('0x22')]+_0x4a6c93[_0xe554('0x25')];var _0x5d81a2;if(_0xc3deea>=_0x144ae9){_0xc3deea=_0x144ae9;_0x5d81a2=0xc8;}else{_0x5d81a2=0xce;}_0x206c77[_0xe554('0x1f')](_0x5d81a2);return _0x206c77[_0xe554('0x26')]('Content-Range',_0x1b5da2+'-'+_0xc3deea+'/'+_0x144ae9)[_0xe554('0x21')](_0x15cf70);}return null;};}function patchUpdates(_0xe2baf3){return function(_0x4af47f){try{jsonpatch[_0xe554('0x27')](_0x4af47f,_0xe2baf3,!![]);}catch(_0x266183){return BPromise['reject'](_0x266183);}return _0x4af47f[_0xe554('0x28')]();};}function saveUpdates(_0x1f26bd,_0x1657c8){return function(_0xd2d232){if(_0xd2d232){return _0xd2d232[_0xe554('0x29')](_0x1f26bd)[_0xe554('0x2a')](function(_0x49479c){return _0x49479c;});}return null;};}function removeEntity(_0x29871c,_0x288033){return function(_0x1929e8){if(_0x1929e8){return _0x1929e8['destroy']()['then'](function(){var _0x2a352c=_0x1929e8['get']({'plain':!![]});var _0x5af6ea=_0xe554('0x2b');return db[_0xe554('0x2c')][_0xe554('0x2d')]({'where':{'type':_0x5af6ea,'resourceId':_0x2a352c['id']}})[_0xe554('0x2a')](function(){return _0x1929e8;});})['then'](function(){_0x29871c[_0xe554('0x1f')](0xcc)[_0xe554('0x20')]();});}};}function handleEntityNotFound(_0x485a67,_0x337ce3){return function(_0x4f99bf){if(!_0x4f99bf){_0x485a67[_0xe554('0x2e')](0x194);}return _0x4f99bf;};}function handleError(_0x13c561,_0x270ef1){_0x270ef1=_0x270ef1||0x1f4;return function(_0x29a275){logger[_0xe554('0x2f')](_0x29a275[_0xe554('0x30')]);if(_0x29a275[_0xe554('0x31')]){delete _0x29a275['name'];}_0x13c561['status'](_0x270ef1)['send'](_0x29a275);};}exports['index']=function(_0x14f90b,_0x36faf9){var _0x7160cf={},_0x8c7c9d={},_0x207c83={'count':0x0,'rows':[]};var _0x2bcc09=_[_0xe554('0x32')](db[_0xe554('0x33')]['rawAttributes'],function(_0x2a79f2){return{'name':_0x2a79f2[_0xe554('0x34')],'type':_0x2a79f2['type']['key']};});_0x8c7c9d[_0xe554('0x35')]=_['map'](_0x2bcc09,_0xe554('0x31'));_0x8c7c9d[_0xe554('0x36')]=_[_0xe554('0x37')](_0x14f90b['query']);_0x8c7c9d[_0xe554('0x38')]=_['intersection'](_0x8c7c9d['model'],_0x8c7c9d[_0xe554('0x36')]);_0x7160cf[_0xe554('0x39')]=_['intersection'](_0x8c7c9d[_0xe554('0x35')],qs[_0xe554('0x3a')](_0x14f90b[_0xe554('0x36')][_0xe554('0x3a')]));_0x7160cf['attributes']=_0x7160cf[_0xe554('0x39')][_0xe554('0x3b')]?_0x7160cf['attributes']:_0x8c7c9d[_0xe554('0x35')];if(!_0x14f90b['query'][_0xe554('0x3c')]('nolimit')){_0x7160cf[_0xe554('0x25')]=qs[_0xe554('0x25')](_0x14f90b[_0xe554('0x36')][_0xe554('0x25')]);_0x7160cf['offset']=qs[_0xe554('0x22')](_0x14f90b[_0xe554('0x36')][_0xe554('0x22')]);}_0x7160cf[_0xe554('0x3d')]=qs[_0xe554('0x3e')](_0x14f90b[_0xe554('0x36')][_0xe554('0x3e')]);_0x7160cf[_0xe554('0x3f')]=qs['filters'](_['pick'](_0x14f90b['query'],_0x8c7c9d[_0xe554('0x38')]),_0x2bcc09);if(_0x14f90b[_0xe554('0x36')][_0xe554('0x40')]){_0x7160cf[_0xe554('0x3f')]=_[_0xe554('0x41')](_0x7160cf[_0xe554('0x3f')],{'$or':_[_0xe554('0x32')](_0x2bcc09,function(_0x253ef7){if(_0x253ef7[_0xe554('0x42')]!==_0xe554('0x43')){var _0x117673={};_0x117673[_0x253ef7[_0xe554('0x31')]]={'$like':'%'+_0x14f90b[_0xe554('0x36')]['filter']+'%'};return _0x117673;}})});}_0x7160cf=_[_0xe554('0x41')]({},_0x7160cf,_0x14f90b['options']);var _0x4026e6={'where':_0x7160cf[_0xe554('0x3f')]};return db[_0xe554('0x33')]['count'](_0x4026e6)[_0xe554('0x2a')](function(_0x15e11b){_0x207c83['count']=_0x15e11b;if(_0x14f90b['query'][_0xe554('0x44')]){_0x7160cf[_0xe554('0x45')]=[{'all':!![]}];}return db[_0xe554('0x33')][_0xe554('0x46')](_0x7160cf);})[_0xe554('0x2a')](function(_0x3147a6){_0x207c83['rows']=_0x3147a6;return _0x207c83;})[_0xe554('0x2a')](respondWithFilteredResult(_0x36faf9,_0x7160cf))['catch'](handleError(_0x36faf9,null));};exports['show']=function(_0x43962a,_0x12b134){var _0x6352d5={'raw':![],'where':{'id':_0x43962a[_0xe554('0x47')]['id']}},_0x446235={};_0x446235[_0xe554('0x35')]=_['keys'](db[_0xe554('0x33')]['rawAttributes']);_0x446235[_0xe554('0x36')]=_[_0xe554('0x37')](_0x43962a[_0xe554('0x36')]);_0x446235[_0xe554('0x38')]=_[_0xe554('0x48')](_0x446235[_0xe554('0x35')],_0x446235['query']);_0x6352d5[_0xe554('0x39')]=_['intersection'](_0x446235[_0xe554('0x35')],qs[_0xe554('0x3a')](_0x43962a[_0xe554('0x36')][_0xe554('0x3a')]));_0x6352d5[_0xe554('0x39')]=_0x6352d5['attributes']['length']?_0x6352d5[_0xe554('0x39')]:_0x446235['model'];if(_0x43962a['query'][_0xe554('0x44')]){_0x6352d5[_0xe554('0x45')]=[{'all':!![]}];}_0x6352d5=_[_0xe554('0x41')]({},_0x6352d5,_0x43962a[_0xe554('0x49')]);return db[_0xe554('0x33')][_0xe554('0x4a')](_0x6352d5)[_0xe554('0x2a')](handleEntityNotFound(_0x12b134,null))[_0xe554('0x2a')](respondWithResult(_0x12b134,null))[_0xe554('0x4b')](handleError(_0x12b134,null));};exports['create']=function(_0x54eb20,_0x235711){return db['CmList'][_0xe554('0x4c')](_0x54eb20[_0xe554('0x4d')],{})[_0xe554('0x2a')](function(_0x3379ca){var _0x371170=_0x54eb20[_0xe554('0x4e')]['get']({'plain':!![]});if(!_0x371170)throw new Error(_0xe554('0x4f'));if(_0x371170[_0xe554('0x50')]===_0xe554('0x4e')){var _0x340d11=_0x3379ca[_0xe554('0x51')]({'plain':!![]});var _0x3d8596=_0xe554('0x2b');return db[_0xe554('0x52')][_0xe554('0x4a')]({'where':{'name':_0x3d8596,'userProfileId':_0x371170['userProfileId']},'raw':!![]})[_0xe554('0x2a')](function(_0x4303fe){if(_0x4303fe&&_0x4303fe[_0xe554('0x53')]===0x0){return db[_0xe554('0x2c')][_0xe554('0x4c')]({'name':_0x340d11[_0xe554('0x31')],'resourceId':_0x340d11['id'],'type':_0x4303fe[_0xe554('0x31')],'sectionId':_0x4303fe['id']},{})[_0xe554('0x2a')](function(){return _0x3379ca;});}else{return _0x3379ca;}})['catch'](function(_0x1f4f0e){logger[_0xe554('0x2f')](_0xe554('0x54'),_0x1f4f0e);throw _0x1f4f0e;});}return _0x3379ca;})[_0xe554('0x2a')](respondWithResult(_0x235711,0xc9))[_0xe554('0x4b')](handleError(_0x235711,null));};exports[_0xe554('0x29')]=function(_0x4e7f38,_0x528269){if(_0x4e7f38['body']['id']){delete _0x4e7f38['body']['id'];}return db[_0xe554('0x33')][_0xe554('0x4a')]({'where':{'id':_0x4e7f38[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x528269,null))[_0xe554('0x2a')](saveUpdates(_0x4e7f38['body'],null))[_0xe554('0x2a')](respondWithResult(_0x528269,null))[_0xe554('0x4b')](handleError(_0x528269,null));};exports[_0xe554('0x2d')]=function(_0x18725a,_0xd692c7){return db[_0xe554('0x33')]['find']({'where':{'id':_0x18725a['params']['id']}})['then'](handleEntityNotFound(_0xd692c7,null))[_0xe554('0x2a')](removeEntity(_0xd692c7,null))[_0xe554('0x4b')](handleError(_0xd692c7,null));};exports['describe']=function(_0x5d5d04,_0x2f0763){return db[_0xe554('0x33')]['describe']()[_0xe554('0x2a')](respondWithResult(_0x2f0763,null))[_0xe554('0x4b')](handleError(_0x2f0763,null));};exports[_0xe554('0x55')]=function(_0xd70ac1,_0x50fb63,_0x5cb161){if(_0xd70ac1['body']['id']){delete _0xd70ac1['body']['id'];}return db['CmList'][_0xe554('0x4a')]({'where':{'id':_0xd70ac1['params']['id']}})['then'](handleEntityNotFound(_0x50fb63,null))[_0xe554('0x2a')](function(_0x5af392){if(_0x5af392){_0xd70ac1[_0xe554('0x4d')][_0xe554('0x56')]=_0x5af392['id'];return db[_0xe554('0x57')][_0xe554('0x4c')](_0xd70ac1[_0xe554('0x4d')]);}})['then'](respondWithResult(_0x50fb63,null))[_0xe554('0x4b')](handleError(_0x50fb63,null));};exports['getDispositions']=function(_0x43d550,_0x5824e8,_0x115281){var _0x3fafce={'raw':![],'where':{}};var _0xed5bc9={};var _0x4f5bd7={'count':0x0,'rows':[]};return db[_0xe554('0x33')]['findOne']({'where':{'id':_0x43d550[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x5824e8,null))[_0xe554('0x2a')](function(_0x58543e){if(_0x58543e){_0xed5bc9[_0xe554('0x35')]=_[_0xe554('0x37')](db[_0xe554('0x57')][_0xe554('0x58')]);_0xed5bc9[_0xe554('0x36')]=_[_0xe554('0x37')](_0x43d550[_0xe554('0x36')]);_0xed5bc9[_0xe554('0x38')]=_[_0xe554('0x48')](_0xed5bc9[_0xe554('0x35')],_0xed5bc9[_0xe554('0x36')]);_0x3fafce[_0xe554('0x39')]=_[_0xe554('0x48')](_0xed5bc9[_0xe554('0x35')],qs['fields'](_0x43d550[_0xe554('0x36')]['fields']));_0x3fafce['attributes']=_0x3fafce[_0xe554('0x39')]['length']?_0x3fafce['attributes']:_0xed5bc9['model'];if(!_0x43d550[_0xe554('0x36')]['hasOwnProperty']('nolimit')){_0x3fafce[_0xe554('0x25')]=qs[_0xe554('0x25')](_0x43d550[_0xe554('0x36')]['limit']);_0x3fafce[_0xe554('0x22')]=qs['offset'](_0x43d550[_0xe554('0x36')][_0xe554('0x22')]);}_0x3fafce['order']=qs[_0xe554('0x3e')](_0x43d550['query'][_0xe554('0x3e')]);_0x3fafce[_0xe554('0x3f')]=qs['filters'](_[_0xe554('0x59')](_0x43d550[_0xe554('0x36')],_0xed5bc9[_0xe554('0x38')]));_0x3fafce[_0xe554('0x3f')]['ListId']=_0x58543e['id'];if(_0x43d550['query']['filter']){_0x3fafce[_0xe554('0x3f')]=_['merge'](_0x3fafce['where'],{'$or':_[_0xe554('0x32')](_0x3fafce[_0xe554('0x39')],function(_0x4e45c6){var _0x4583be={};_0x4583be[_0x4e45c6]={'$like':'%'+_0x43d550['query'][_0xe554('0x40')]+'%'};return _0x4583be;})});}_0x3fafce=_[_0xe554('0x41')]({},_0x3fafce,_0x43d550[_0xe554('0x49')]);return db['Disposition'][_0xe554('0x24')]({'where':_0x3fafce[_0xe554('0x3f')]})[_0xe554('0x2a')](function(_0x206938){_0x4f5bd7[_0xe554('0x24')]=_0x206938;if(_0x43d550[_0xe554('0x36')][_0xe554('0x44')]){_0x3fafce[_0xe554('0x45')]=[{'all':!![]}];}return db[_0xe554('0x57')]['findAll'](_0x3fafce);})[_0xe554('0x2a')](function(_0x359c1c){_0x4f5bd7[_0xe554('0x5a')]=_0x359c1c;return _0x4f5bd7;});}})[_0xe554('0x2a')](respondWithFilteredResult(_0x5824e8,_0x3fafce))['catch'](handleError(_0x5824e8,null));};exports[_0xe554('0x5b')]=function(_0x27c2b5,_0x27ae54,_0x111889){return db['CmList'][_0xe554('0x4a')]({'where':{'id':_0x27c2b5[_0xe554('0x47')]['id']}})['then'](handleEntityNotFound(_0x27ae54,null))[_0xe554('0x2a')](function(_0x394956){if(_0x394956){return _0x394956[_0xe554('0x5b')](_0x27c2b5[_0xe554('0x36')][_0xe554('0x5c')]);}})[_0xe554('0x2a')](respondWithStatusCode(_0x27ae54,null))[_0xe554('0x4b')](handleError(_0x27ae54,null));};exports[_0xe554('0x5d')]=function(_0x3c4a53,_0x4eb312,_0x490acf){return db['CmList'][_0xe554('0x4a')]({'where':{'id':_0x3c4a53[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x4eb312,null))[_0xe554('0x2a')](function(_0x208446){if(_0x208446){var _0x19e43a=[];var _0x41ac88={'success':[],'errors':[]};return db['CmContact'][_0xe554('0x5e')]()[_0xe554('0x2a')](function(_0x354f78){if(_0x3c4a53['body']['tags']&&_[_0xe554('0x5f')](_0x3c4a53[_0xe554('0x4d')]['tags'])){if(_0x3c4a53['body'][_0xe554('0x60')][_0xe554('0x3b')]){_0x3c4a53[_0xe554('0x4d')]['tags']=_0x3c4a53[_0xe554('0x4d')][_0xe554('0x60')]['join'](';')+';';}else{_0x3c4a53['body'][_0xe554('0x60')]=null;}}else{_0x3c4a53['body'][_0xe554('0x60')]=null;}if(_0x3c4a53[_0xe554('0x4d')]&&_[_0xe554('0x5f')](_0x3c4a53['body'])){for(var _0x15c63c=0x0;_0x15c63c<_0x3c4a53['body']['length'];_0x15c63c+=0x1){_0x3c4a53['body'][_0x15c63c][_0xe554('0x56')]=_0x3c4a53[_0xe554('0x47')]['id'];_0x19e43a[_0xe554('0x61')](_0x3c4a53[_0xe554('0x4d')][_0x15c63c]);}return BPromise[_0xe554('0x62')](_0x19e43a,function(_0x5b9e19){return db[_0xe554('0x63')]['create'](_[_0xe554('0x64')](_0x5b9e19,[_0xe554('0x5c'),'id'])||{},{'fields':_['keys'](_0x354f78),'raw':!![]})[_0xe554('0x2a')](function(_0x12e865){_0x41ac88['success'][_0xe554('0x61')](_0x12e865['dataValues']);})[_0xe554('0x4b')](function(_0xb0f2c3){_0x41ac88[_0xe554('0x65')][_0xe554('0x61')]({'data':_0x5b9e19,'error':_0xb0f2c3[_0xe554('0x66')]});});})[_0xe554('0x2a')](function(_0x51974d){return _0x41ac88;})[_0xe554('0x4b')](function(_0x2a270f){return _0x2a270f;});}else{_0x4eb312[_0xe554('0x1f')](0x190)['json']({'message':_0xe554('0x67')});}});}})[_0xe554('0x2a')](respondWithResult(_0x4eb312,null))['catch'](handleError(_0x4eb312,null));};exports[_0xe554('0x68')]=function(_0x355ed4,_0x22b1a0,_0x1b5a53){var _0x54ef14;return db[_0xe554('0x33')][_0xe554('0x4a')]({'where':{'id':_0x355ed4['params']['id']},'include':[{'model':db[_0xe554('0x69')],'as':_0xe554('0x6a')}]})['then'](handleEntityNotFound(_0x22b1a0,null))[_0xe554('0x2a')](function(_0x6b5413){if(_0x6b5413){_0x54ef14=_0x6b5413;return db[_0xe554('0x63')][_0xe554('0x58')];}})[_0xe554('0x2a')](function(_0x5c3079){if(_0x5c3079){var _0x5efae3={};var _0x4b6fb9={};_0x4b6fb9['model']=_['concat'](_[_0xe554('0x37')](_0x5c3079),_[_0xe554('0x32')](_0x54ef14['CustomFields'],function(_0x515639){return util[_0xe554('0x6b')]('cf_%d',_0x515639['id']);}));_0x4b6fb9['query']=_[_0xe554('0x37')](_0x355ed4[_0xe554('0x36')]);_0x4b6fb9[_0xe554('0x38')]=_['intersection'](_0x4b6fb9[_0xe554('0x35')],_0x4b6fb9[_0xe554('0x36')]);_0x5efae3[_0xe554('0x39')]=_[_0xe554('0x48')](_0x4b6fb9[_0xe554('0x35')],qs['fields'](_0x355ed4[_0xe554('0x36')][_0xe554('0x3a')]));_0x5efae3[_0xe554('0x39')]=_0x5efae3[_0xe554('0x39')]['length']?_0x5efae3['attributes']:_0x4b6fb9['model'];if(!_0x355ed4[_0xe554('0x36')][_0xe554('0x3c')](_0xe554('0x6c'))){_0x5efae3['limit']=qs[_0xe554('0x25')](_0x355ed4[_0xe554('0x36')]['limit']);_0x5efae3[_0xe554('0x22')]=qs[_0xe554('0x22')](_0x355ed4['query'][_0xe554('0x22')]);}_0x5efae3[_0xe554('0x3d')]=qs[_0xe554('0x3e')](_0x355ed4[_0xe554('0x36')][_0xe554('0x3e')]);_0x5efae3[_0xe554('0x3f')]=qs[_0xe554('0x38')](_['pick'](_0x355ed4['query'],_0x4b6fb9['filters']));_0x5efae3['raw']=!![];if(_0x355ed4[_0xe554('0x36')]['filter']){_0x5efae3['where']=_[_0xe554('0x41')](_0x5efae3[_0xe554('0x3f')],{'$or':_[_0xe554('0x32')](_0x5efae3[_0xe554('0x39')],function(_0x4f0984){var _0x4d68f6={};_0x4d68f6[_0x4f0984]={'$like':'%'+_0x355ed4[_0xe554('0x36')][_0xe554('0x40')]+'%'};return _0x4d68f6;})});}_0x5efae3=_[_0xe554('0x41')]({},_0x5efae3,_0x355ed4[_0xe554('0x49')]);return _0x54ef14['getContacts'](_0x5efae3);}})[_0xe554('0x2a')](respondWithResult(_0x22b1a0,null))[_0xe554('0x4b')](handleError(_0x22b1a0,null));};exports['getContactsCsv']=function(_0x57d19a,_0x2932a8,_0x3826d8){var _0x30b1b1;var _0x2b2273;var _0x1d7d48;var _0x37a404=_0x57d19a[_0xe554('0x47')]['id'];csv_results=[];return db['ContactItemType'][_0xe554('0x46')]({'attributes':['id',_0xe554('0x31')],'raw':!![],'order':[_0xe554('0x6d')]})[_0xe554('0x2a')](function(_0x28fe64){_0x30b1b1=_0x28fe64;var _0x1d3732=_[_0xe554('0x37')](db[_0xe554('0x63')][_0xe554('0x58')]);return db['CmCustomField'][_0xe554('0x46')]({'raw':!![],'attributes':['id',_0xe554('0x6e')]})[_0xe554('0x2a')](function(_0x4008a1){_0x2b2273=_0x4008a1;var _0x6d308f=squel[_0xe554('0x6f')]()['fields'](_0x1d3732)[_0xe554('0x70')](_0xe554('0x71'),'c')[_0xe554('0x3f')](_0xe554('0x72'),_0x37a404)['where'](_0xe554('0x73'))['distinct']();for(var _0x1e1661=0x0;_0x1e1661<_0x2b2273[_0xe554('0x3b')];_0x1e1661++){_0x6d308f[_0xe554('0x74')](_0xe554('0x75')+_0x2b2273[_0x1e1661]['id'],_0xe554('0x76')+_0x2b2273[_0x1e1661]['alias']);}for(var _0x1e1661=0x0;_0x1e1661<_0x30b1b1[_0xe554('0x3b')];_0x1e1661++){_0x6d308f['field'](squel['select']()[_0xe554('0x74')](_0xe554('0x77'))[_0xe554('0x70')](_0xe554('0x78'))[_0xe554('0x3f')](_0xe554('0x79'),_0x30b1b1[_0x1e1661]['id'])[_0xe554('0x3f')](_0xe554('0x7a')),_0xe554('0x7b')+_0x30b1b1[_0x1e1661][_0xe554('0x31')]);_0x6d308f[_0xe554('0x74')](squel[_0xe554('0x6f')]()[_0xe554('0x74')]('description')[_0xe554('0x70')](_0xe554('0x78'))[_0xe554('0x3f')](_0xe554('0x79'),_0x30b1b1[_0x1e1661]['id'])[_0xe554('0x3f')](_0xe554('0x7a')),_0xe554('0x7c')+_0x30b1b1[_0x1e1661]['name']);}var _0x39dc2f=[];_0x39dc2f[_0xe554('0x61')](_0x6d308f[_0xe554('0x7d')]());BPromise[_0xe554('0x62')](_0x39dc2f,handleQuery)[_0xe554('0x2a')](function(_0x10c579){handleQuery(_0x6d308f[_0xe554('0x7d')]());var _0x444610=csv_results[0x0];if(!_[_0xe554('0x7e')](_0x444610)){var _0x5bd6d7=toCsv(_0x444610);var _0x21a862=Date[_0xe554('0x7f')]();fs[_0xe554('0x80')](util['format']('/tmp/list_%d_%s.csv',_0x37a404,_0x21a862),_0x5bd6d7);_0x2932a8[_0xe554('0x81')](_0xe554('0x82'),_0xe554('0x83')+util['format'](_0xe554('0x84'),_0x37a404,_0x21a862));_0x2932a8['setHeader'](_0xe554('0x85'),_0xe554('0x86'));return _0x2932a8['download'](util[_0xe554('0x6b')](_0xe554('0x87'),_0x37a404,_0x21a862));}else{return _0x2932a8['sendStatus'](0xcc);}});});});};exports[_0xe554('0x88')]=function(_0x598747,_0x11d219,_0x3d1d4a){var _0x5b1cb5;delete _0x598747[_0xe554('0x4d')]['id'];return db[_0xe554('0x33')][_0xe554('0x89')]({'where':{'id':_0x598747['params']['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x11d219,null))['then'](function(_0x2e07bc){if(_0x2e07bc){return db[_0xe554('0x8a')][_0xe554('0x8b')](function(_0x1140ae){return db[_0xe554('0x69')][_0xe554('0x4c')](_0x598747[_0xe554('0x4d')],{'transaction':_0x1140ae})[_0xe554('0x2a')](function(_0x296c8f){_0x5b1cb5=_0x296c8f;return _0x2e07bc[_0xe554('0x8c')](_0x296c8f,{'transaction':_0x1140ae});})['then'](function(){var _0x278717={'type':db['Sequelize'][_0xe554('0x8d')],'transaction':_0x1140ae};switch(_0x598747[_0xe554('0x4d')][_0xe554('0x42')]){case _0xe554('0x8e'):_0x278717[_0xe554('0x42')]=db[_0xe554('0x8f')][_0xe554('0x8d')];break;case _0xe554('0x90'):_0x278717[_0xe554('0x42')]=db[_0xe554('0x8f')][_0xe554('0x91')];break;case _0xe554('0x92'):_0x278717['type']=db[_0xe554('0x8f')]['BOOLEAN'];_0x278717[_0xe554('0x93')]=![];break;default:}return db['sequelize'][_0xe554('0x94')][_0xe554('0x95')](_0xe554('0x71'),util[_0xe554('0x6b')](_0xe554('0x96'),_0x5b1cb5['id']),_0x278717);})['then'](function(){return _0x5b1cb5;});});}})[_0xe554('0x2a')](respondWithResult(_0x11d219,null))[_0xe554('0x4b')](handleError(_0x11d219,null));};exports[_0xe554('0x97')]=function(_0x3d4016,_0x20aedd,_0x559c63){var _0x41b6ad={};var _0x3b5114={};var _0x159c07;var _0x13243b;return db[_0xe554('0x33')][_0xe554('0x89')]({'where':{'id':_0x3d4016['params']['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x20aedd,null))[_0xe554('0x2a')](function(_0x5ba2ca){if(_0x5ba2ca){_0x159c07=_0x5ba2ca;_0x3b5114[_0xe554('0x35')]=_[_0xe554('0x37')](db[_0xe554('0x69')]['rawAttributes']);_0x3b5114[_0xe554('0x36')]=_[_0xe554('0x37')](_0x3d4016[_0xe554('0x36')]);_0x3b5114['filters']=_[_0xe554('0x48')](_0x3b5114[_0xe554('0x35')],_0x3b5114[_0xe554('0x36')]);_0x41b6ad[_0xe554('0x39')]=_[_0xe554('0x48')](_0x3b5114[_0xe554('0x35')],qs['fields'](_0x3d4016['query'][_0xe554('0x3a')]));_0x41b6ad['attributes']=_0x41b6ad['attributes'][_0xe554('0x3b')]?_0x41b6ad[_0xe554('0x39')]:_0x3b5114[_0xe554('0x35')];_0x41b6ad[_0xe554('0x3d')]=qs[_0xe554('0x3e')](_0x3d4016[_0xe554('0x36')]['sort']);_0x41b6ad[_0xe554('0x3f')]=qs[_0xe554('0x38')](_[_0xe554('0x59')](_0x3d4016[_0xe554('0x36')],_0x3b5114[_0xe554('0x38')]));_0x41b6ad[_0xe554('0x3f')]=_[_0xe554('0x41')](_0x41b6ad[_0xe554('0x3f')],{'$or':[{'ListId':_0x5ba2ca['id']},{'ListId':null}]});if(_0x3d4016['query'][_0xe554('0x40')]){_0x41b6ad[_0xe554('0x3f')]=_[_0xe554('0x41')](_0x41b6ad[_0xe554('0x3f')],{'$or':_['map'](_0x41b6ad[_0xe554('0x39')],function(_0x11cc74){var _0xb5c95={};_0xb5c95[_0x11cc74]={'$like':'%'+_0x3d4016['query']['filter']+'%'};return _0xb5c95;})});}_0x41b6ad=_['merge']({},_0x41b6ad,_0x3d4016[_0xe554('0x49')]);return db[_0xe554('0x69')]['findAndCountAll'](_0x41b6ad);}})[_0xe554('0x2a')](respondWithResult(_0x20aedd,null))[_0xe554('0x4b')](handleError(_0x20aedd,null));};exports[_0xe554('0x98')]=function(_0x26d162,_0x9a758e){return db[_0xe554('0x69')][_0xe554('0x99')]({'where':{'ListId':null}})[_0xe554('0x2a')](handleEntityNotFound(_0x9a758e,null))['then'](function(_0x36207e){return _0x36207e;})[_0xe554('0x2a')](respondWithResult(_0x9a758e,null))[_0xe554('0x4b')](handleError(_0x9a758e,null));};exports[_0xe554('0x9a')]=function(_0x42076c,_0x401a01,_0x16da15){return db[_0xe554('0x33')][_0xe554('0x4a')]({'where':{'id':_0x42076c[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x401a01,null))[_0xe554('0x2a')](function(_0x498937){if(_0x498937){return _0x498937[_0xe554('0x9a')](_0x42076c[_0xe554('0x4d')][_0xe554('0x5c')],_['omit'](_0x42076c['body'],[_0xe554('0x5c'),'id'])||{})[_0xe554('0x9b')](function(_0x5f051a){for(var _0x390e90=0x0;_0x390e90<_0x42076c[_0xe554('0x4d')][_0xe554('0x5c')]['length'];_0x390e90+=0x1){socket[_0xe554('0x9c')](_0xe554('0x9d'),{'UserId':Number(_0x42076c['body']['ids'][_0x390e90]),'CmListId':Number(_0x42076c[_0xe554('0x47')]['id'])});}return _0x5f051a;});}})[_0xe554('0x2a')](respondWithResult(_0x401a01,null))['catch'](handleError(_0x401a01,null));};exports[_0xe554('0x9e')]=function(_0xd90bb4,_0x15fe94,_0x6ab615){return db[_0xe554('0x33')][_0xe554('0x4a')]({'where':{'id':_0xd90bb4[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x15fe94,null))['then'](function(_0x4b2bec){if(_0x4b2bec){return _0x4b2bec['removeAgents'](_0xd90bb4[_0xe554('0x36')][_0xe554('0x5c')])[_0xe554('0x2a')](function(){if(_[_0xe554('0x5f')](_0xd90bb4[_0xe554('0x36')][_0xe554('0x5c')])){for(var _0x12ba3b=0x0;_0x12ba3b<_0xd90bb4[_0xe554('0x36')][_0xe554('0x5c')][_0xe554('0x3b')];_0x12ba3b+=0x1){socket[_0xe554('0x9c')](_0xe554('0x9f'),{'UserId':Number(_0xd90bb4['query'][_0xe554('0x5c')][_0x12ba3b]),'CmListId':Number(_0xd90bb4[_0xe554('0x47')]['id'])});}}else{socket[_0xe554('0x9c')](_0xe554('0x9f'),{'UserId':Number(_0xd90bb4[_0xe554('0x36')][_0xe554('0x5c')]),'CmListId':Number(_0xd90bb4[_0xe554('0x47')]['id'])});}});}})[_0xe554('0x2a')](respondWithStatusCode(_0x15fe94,null))[_0xe554('0x4b')](handleError(_0x15fe94,null));};exports['getAgents']=function(_0x395c4e,_0x205c77,_0x589510){var _0x9afd20={};var _0x1a94ee={};var _0x5ae533;var _0x2dd65f;return db[_0xe554('0x33')][_0xe554('0x89')]({'where':{'id':_0x395c4e[_0xe554('0x47')]['id']}})[_0xe554('0x2a')](handleEntityNotFound(_0x205c77,null))[_0xe554('0x2a')](function(_0x2657ac){if(_0x2657ac){_0x5ae533=_0x2657ac;_0x1a94ee[_0xe554('0x35')]=_['keys'](db[_0xe554('0xa0')][_0xe554('0x58')]);_0x1a94ee[_0xe554('0x36')]=_[_0xe554('0x37')](_0x395c4e['query']);_0x1a94ee[_0xe554('0x38')]=_[_0xe554('0x48')](_0x1a94ee[_0xe554('0x35')],_0x1a94ee[_0xe554('0x36')]);_0x9afd20[_0xe554('0x39')]=_['intersection'](_0x1a94ee[_0xe554('0x35')],qs[_0xe554('0x3a')](_0x395c4e[_0xe554('0x36')]['fields']));_0x9afd20[_0xe554('0x39')]=_0x9afd20[_0xe554('0x39')][_0xe554('0x3b')]?_0x9afd20['attributes']:_0x1a94ee[_0xe554('0x35')];_0x9afd20[_0xe554('0x3d')]=qs[_0xe554('0x3e')](_0x395c4e[_0xe554('0x36')]['sort']);_0x9afd20[_0xe554('0x3f')]=qs[_0xe554('0x38')](_[_0xe554('0x59')](_0x395c4e['query'],_0x1a94ee['filters']));if(_0x395c4e[_0xe554('0x36')]['filter']){_0x9afd20[_0xe554('0x3f')]=_[_0xe554('0x41')](_0x9afd20['where'],{'$or':_['map'](_0x9afd20[_0xe554('0x39')],function(_0x418d2d){var _0x7763d5={};_0x7763d5[_0x418d2d]={'$like':'%'+_0x395c4e['query'][_0xe554('0x40')]+'%'};return _0x7763d5;})});}_0x9afd20=_[_0xe554('0x41')]({},_0x9afd20,_0x395c4e[_0xe554('0x49')]);return _0x5ae533[_0xe554('0xa1')](_0x9afd20);}})[_0xe554('0x2a')](function(_0x25fc89){if(_0x25fc89){_0x2dd65f=_0x25fc89[_0xe554('0x3b')];if(!_0x395c4e[_0xe554('0x36')][_0xe554('0x3c')](_0xe554('0x6c'))){_0x9afd20[_0xe554('0x25')]=qs[_0xe554('0x25')](_0x395c4e[_0xe554('0x36')][_0xe554('0x25')]);_0x9afd20[_0xe554('0x22')]=qs[_0xe554('0x22')](_0x395c4e[_0xe554('0x36')][_0xe554('0x22')]);}return _0x5ae533[_0xe554('0xa1')](_0x9afd20);}})[_0xe554('0x2a')](function(_0x3f250f){if(_0x3f250f){return _0x3f250f?{'count':_0x2dd65f,'rows':_0x3f250f}:null;}})['then'](respondWithResult(_0x205c77,null))['catch'](handleError(_0x205c77,null));};function handleQuery(_0x2f088e){logger[_0xe554('0xa2')](_0x2f088e);return db[_0xe554('0x8a')]['query'](_0x2f088e)[_0xe554('0x9b')](function(_0x29c7d3){csv_results[_0xe554('0x61')](_0x29c7d3);})[_0xe554('0x4b')](function(_0x23711a){logger[_0xe554('0x2f')](_0x23711a[_0xe554('0x66')]);});} \ No newline at end of file +var _0xafdc=['download','sequelize','transaction','addCustomFields','Sequelize','text','INTEGER','switch','BOOLEAN','queryInterface','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','message','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','describe','tags','isArray','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','cf_%d','options','getContactsCsv','OrderBy','CmContact','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xafdc,0xb3));var _0xcafd=function(_0x5c2318,_0x2a6046){_0x5c2318=_0x5c2318-0x0;var _0x390f7e=_0xafdc[_0x5c2318];return _0x390f7e;};'use strict';var emlformat=require(_0xcafd('0x0'));var rimraf=require(_0xcafd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcafd('0x2'));var rp=require(_0xcafd('0x3'));var moment=require(_0xcafd('0x4'));var BPromise=require(_0xcafd('0x5'));var Mustache=require(_0xcafd('0x6'));var util=require(_0xcafd('0x7'));var path=require(_0xcafd('0x8'));var sox=require('sox');var csv=require(_0xcafd('0x9'));var ejs=require(_0xcafd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcafd('0xb'));var jsforce=require(_0xcafd('0xc'));var deskjs=require(_0xcafd('0xd'));var toCsv=require(_0xcafd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcafd('0xe'));var authService=require(_0xcafd('0xf'));var qs=require(_0xcafd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcafd('0x11'))(_0xcafd('0x12'));var utils=require(_0xcafd('0x13'));var config=require(_0xcafd('0x14'));var licenseUtil=require(_0xcafd('0x15'));var db=require(_0xcafd('0x16'))['db'];var csv_results;config['redis']=_['defaults'](config[_0xcafd('0x17')],{'host':_0xcafd('0x18'),'port':0x18eb});var socket=require(_0xcafd('0x19'))(new Redis(config[_0xcafd('0x17')]));require(_0xcafd('0x1a'))[_0xcafd('0x1b')](socket);function respondWithStatusCode(_0x3745bb,_0x990b75){_0x990b75=_0x990b75||0xcc;return function(_0x2fe9df){if(_0x2fe9df){return _0x3745bb[_0xcafd('0x1c')](_0x990b75);}return _0x3745bb[_0xcafd('0x1d')](_0x990b75)[_0xcafd('0x1e')]();};}function respondWithResult(_0x4c90a9,_0x189800){_0x189800=_0x189800||0xc8;return function(_0x17e1fa){if(_0x17e1fa){return _0x4c90a9[_0xcafd('0x1d')](_0x189800)[_0xcafd('0x1f')](_0x17e1fa);}};}function respondWithFilteredResult(_0x392fd5,_0x20c2ac){return function(_0x4d7f6f){if(_0x4d7f6f){var _0x2eda2b=typeof _0x20c2ac[_0xcafd('0x20')]===_0xcafd('0x21')&&typeof _0x20c2ac[_0xcafd('0x22')]===_0xcafd('0x21');var _0x1d2ea0=_0x4d7f6f['count'];var _0x330a7b=_0x2eda2b?0x0:_0x20c2ac[_0xcafd('0x20')];var _0x549abf=_0x2eda2b?_0x4d7f6f[_0xcafd('0x23')]:_0x20c2ac[_0xcafd('0x20')]+_0x20c2ac[_0xcafd('0x22')];var _0x1ef287;if(_0x549abf>=_0x1d2ea0){_0x549abf=_0x1d2ea0;_0x1ef287=0xc8;}else{_0x1ef287=0xce;}_0x392fd5['status'](_0x1ef287);return _0x392fd5['set'](_0xcafd('0x24'),_0x330a7b+'-'+_0x549abf+'/'+_0x1d2ea0)[_0xcafd('0x1f')](_0x4d7f6f);}return null;};}function patchUpdates(_0x2904dd){return function(_0x1e4b1c){try{jsonpatch[_0xcafd('0x25')](_0x1e4b1c,_0x2904dd,!![]);}catch(_0x24c561){return BPromise['reject'](_0x24c561);}return _0x1e4b1c[_0xcafd('0x26')]();};}function saveUpdates(_0x2467f6,_0x1f9982){return function(_0x174447){if(_0x174447){return _0x174447['update'](_0x2467f6)[_0xcafd('0x27')](function(_0x1aa03a){return _0x1aa03a;});}return null;};}function removeEntity(_0x4c35ec,_0x1ac7c1){return function(_0x39fdcf){if(_0x39fdcf){return _0x39fdcf['destroy']()[_0xcafd('0x27')](function(){var _0x37eba9=_0x39fdcf[_0xcafd('0x28')]({'plain':!![]});var _0x4c4cb3=_0xcafd('0x29');return db[_0xcafd('0x2a')][_0xcafd('0x2b')]({'where':{'type':_0x4c4cb3,'resourceId':_0x37eba9['id']}})[_0xcafd('0x27')](function(){return _0x39fdcf;});})[_0xcafd('0x27')](function(){_0x4c35ec[_0xcafd('0x1d')](0xcc)[_0xcafd('0x1e')]();});}};}function handleEntityNotFound(_0x33d650,_0x5eb48d){return function(_0x221d1b){if(!_0x221d1b){_0x33d650[_0xcafd('0x1c')](0x194);}return _0x221d1b;};}function handleError(_0x2c7dec,_0x12a791){_0x12a791=_0x12a791||0x1f4;return function(_0x3e2af3){logger[_0xcafd('0x2c')](_0x3e2af3[_0xcafd('0x2d')]);if(_0x3e2af3['name']){delete _0x3e2af3[_0xcafd('0x2e')];}_0x2c7dec[_0xcafd('0x1d')](_0x12a791)[_0xcafd('0x2f')](_0x3e2af3);};}exports[_0xcafd('0x30')]=function(_0x179206,_0x28492b){var _0x3dc6e0={},_0x2e2c0a={},_0x262051={'count':0x0,'rows':[]};var _0x29e805=_[_0xcafd('0x31')](db[_0xcafd('0x32')][_0xcafd('0x33')],function(_0xbdfbb5){return{'name':_0xbdfbb5[_0xcafd('0x34')],'type':_0xbdfbb5[_0xcafd('0x35')][_0xcafd('0x36')]};});_0x2e2c0a['model']=_[_0xcafd('0x31')](_0x29e805,_0xcafd('0x2e'));_0x2e2c0a['query']=_['keys'](_0x179206[_0xcafd('0x37')]);_0x2e2c0a[_0xcafd('0x38')]=_['intersection'](_0x2e2c0a[_0xcafd('0x39')],_0x2e2c0a[_0xcafd('0x37')]);_0x3dc6e0[_0xcafd('0x3a')]=_[_0xcafd('0x3b')](_0x2e2c0a[_0xcafd('0x39')],qs['fields'](_0x179206[_0xcafd('0x37')]['fields']));_0x3dc6e0['attributes']=_0x3dc6e0[_0xcafd('0x3a')][_0xcafd('0x3c')]?_0x3dc6e0[_0xcafd('0x3a')]:_0x2e2c0a['model'];if(!_0x179206['query'][_0xcafd('0x3d')](_0xcafd('0x3e'))){_0x3dc6e0[_0xcafd('0x22')]=qs[_0xcafd('0x22')](_0x179206[_0xcafd('0x37')][_0xcafd('0x22')]);_0x3dc6e0['offset']=qs[_0xcafd('0x20')](_0x179206[_0xcafd('0x37')][_0xcafd('0x20')]);}_0x3dc6e0[_0xcafd('0x3f')]=qs[_0xcafd('0x40')](_0x179206[_0xcafd('0x37')][_0xcafd('0x40')]);_0x3dc6e0[_0xcafd('0x41')]=qs['filters'](_[_0xcafd('0x42')](_0x179206['query'],_0x2e2c0a[_0xcafd('0x38')]),_0x29e805);if(_0x179206[_0xcafd('0x37')]['filter']){_0x3dc6e0[_0xcafd('0x41')]=_[_0xcafd('0x43')](_0x3dc6e0[_0xcafd('0x41')],{'$or':_[_0xcafd('0x31')](_0x29e805,function(_0x421749){if(_0x421749[_0xcafd('0x35')]!==_0xcafd('0x44')){var _0x19d399={};_0x19d399[_0x421749[_0xcafd('0x2e')]]={'$like':'%'+_0x179206[_0xcafd('0x37')][_0xcafd('0x45')]+'%'};return _0x19d399;}})});}_0x3dc6e0=_[_0xcafd('0x43')]({},_0x3dc6e0,_0x179206['options']);var _0x8e9d75={'where':_0x3dc6e0['where']};return db[_0xcafd('0x32')][_0xcafd('0x23')](_0x8e9d75)[_0xcafd('0x27')](function(_0x1bb63d){_0x262051[_0xcafd('0x23')]=_0x1bb63d;if(_0x179206[_0xcafd('0x37')][_0xcafd('0x46')]){_0x3dc6e0[_0xcafd('0x47')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x3dc6e0);})[_0xcafd('0x27')](function(_0xf64979){_0x262051[_0xcafd('0x48')]=_0xf64979;return _0x262051;})[_0xcafd('0x27')](respondWithFilteredResult(_0x28492b,_0x3dc6e0))[_0xcafd('0x49')](handleError(_0x28492b,null));};exports[_0xcafd('0x4a')]=function(_0x450a44,_0x3c611b){var _0x25fcdd={'raw':![],'where':{'id':_0x450a44['params']['id']}},_0x1b94e3={};_0x1b94e3[_0xcafd('0x39')]=_[_0xcafd('0x4b')](db[_0xcafd('0x32')][_0xcafd('0x33')]);_0x1b94e3['query']=_['keys'](_0x450a44[_0xcafd('0x37')]);_0x1b94e3[_0xcafd('0x38')]=_[_0xcafd('0x3b')](_0x1b94e3[_0xcafd('0x39')],_0x1b94e3['query']);_0x25fcdd[_0xcafd('0x3a')]=_[_0xcafd('0x3b')](_0x1b94e3[_0xcafd('0x39')],qs[_0xcafd('0x4c')](_0x450a44[_0xcafd('0x37')][_0xcafd('0x4c')]));_0x25fcdd[_0xcafd('0x3a')]=_0x25fcdd[_0xcafd('0x3a')][_0xcafd('0x3c')]?_0x25fcdd[_0xcafd('0x3a')]:_0x1b94e3[_0xcafd('0x39')];if(_0x450a44['query'][_0xcafd('0x46')]){_0x25fcdd[_0xcafd('0x47')]=[{'all':!![]}];}_0x25fcdd=_[_0xcafd('0x43')]({},_0x25fcdd,_0x450a44['options']);return db['CmList'][_0xcafd('0x4d')](_0x25fcdd)[_0xcafd('0x27')](handleEntityNotFound(_0x3c611b,null))['then'](respondWithResult(_0x3c611b,null))[_0xcafd('0x49')](handleError(_0x3c611b,null));};exports[_0xcafd('0x4e')]=function(_0x281cf1,_0x1393f7){return db[_0xcafd('0x32')]['create'](_0x281cf1[_0xcafd('0x4f')],{})[_0xcafd('0x27')](function(_0x1f7645){var _0x2a474c=_0x281cf1[_0xcafd('0x50')][_0xcafd('0x28')]({'plain':!![]});if(!_0x2a474c)throw new Error(_0xcafd('0x51'));if(_0x2a474c[_0xcafd('0x52')]==='user'){var _0x2df311=_0x1f7645['get']({'plain':!![]});var _0x36cb0f=_0xcafd('0x29');return db['UserProfileSection'][_0xcafd('0x4d')]({'where':{'name':_0x36cb0f,'userProfileId':_0x2a474c[_0xcafd('0x53')]},'raw':!![]})[_0xcafd('0x27')](function(_0x3e9e5f){if(_0x3e9e5f&&_0x3e9e5f['autoAssociation']===0x0){return db[_0xcafd('0x2a')]['create']({'name':_0x2df311['name'],'resourceId':_0x2df311['id'],'type':_0x3e9e5f[_0xcafd('0x2e')],'sectionId':_0x3e9e5f['id']},{})['then'](function(){return _0x1f7645;});}else{return _0x1f7645;}})['catch'](function(_0x2aaf27){logger['error'](_0xcafd('0x54'),_0x2aaf27);throw _0x2aaf27;});}return _0x1f7645;})[_0xcafd('0x27')](respondWithResult(_0x1393f7,0xc9))[_0xcafd('0x49')](handleError(_0x1393f7,null));};exports[_0xcafd('0x55')]=function(_0x3ed8e2,_0x318bb9){if(_0x3ed8e2['body']['id']){delete _0x3ed8e2[_0xcafd('0x4f')]['id'];}return db[_0xcafd('0x32')][_0xcafd('0x4d')]({'where':{'id':_0x3ed8e2[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x318bb9,null))[_0xcafd('0x27')](saveUpdates(_0x3ed8e2[_0xcafd('0x4f')],null))['then'](respondWithResult(_0x318bb9,null))[_0xcafd('0x49')](handleError(_0x318bb9,null));};exports[_0xcafd('0x2b')]=function(_0x130c8c,_0x2d8bf1){return db[_0xcafd('0x32')][_0xcafd('0x4d')]({'where':{'id':_0x130c8c[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x2d8bf1,null))[_0xcafd('0x27')](removeEntity(_0x2d8bf1,null))[_0xcafd('0x49')](handleError(_0x2d8bf1,null));};exports['describe']=function(_0x3d8635,_0x572014){return db[_0xcafd('0x32')]['describe']()[_0xcafd('0x27')](respondWithResult(_0x572014,null))[_0xcafd('0x49')](handleError(_0x572014,null));};exports['addDisposition']=function(_0x1d725d,_0x46f284,_0x36bc41){if(_0x1d725d[_0xcafd('0x4f')]['id']){delete _0x1d725d[_0xcafd('0x4f')]['id'];}return db[_0xcafd('0x32')][_0xcafd('0x4d')]({'where':{'id':_0x1d725d[_0xcafd('0x56')]['id']}})['then'](handleEntityNotFound(_0x46f284,null))[_0xcafd('0x27')](function(_0x352288){if(_0x352288){_0x1d725d[_0xcafd('0x4f')][_0xcafd('0x57')]=_0x352288['id'];return db[_0xcafd('0x58')][_0xcafd('0x4e')](_0x1d725d['body']);}})['then'](respondWithResult(_0x46f284,null))['catch'](handleError(_0x46f284,null));};exports[_0xcafd('0x59')]=function(_0x2150b2,_0x3fd527,_0x475bde){var _0x31f89c={'raw':![],'where':{}};var _0x41be1d={};var _0x2fb1f0={'count':0x0,'rows':[]};return db['CmList'][_0xcafd('0x5a')]({'where':{'id':_0x2150b2[_0xcafd('0x56')]['id']}})['then'](handleEntityNotFound(_0x3fd527,null))[_0xcafd('0x27')](function(_0x22bfce){if(_0x22bfce){_0x41be1d[_0xcafd('0x39')]=_[_0xcafd('0x4b')](db[_0xcafd('0x58')]['rawAttributes']);_0x41be1d[_0xcafd('0x37')]=_['keys'](_0x2150b2[_0xcafd('0x37')]);_0x41be1d['filters']=_['intersection'](_0x41be1d[_0xcafd('0x39')],_0x41be1d[_0xcafd('0x37')]);_0x31f89c[_0xcafd('0x3a')]=_['intersection'](_0x41be1d[_0xcafd('0x39')],qs[_0xcafd('0x4c')](_0x2150b2[_0xcafd('0x37')][_0xcafd('0x4c')]));_0x31f89c[_0xcafd('0x3a')]=_0x31f89c[_0xcafd('0x3a')]['length']?_0x31f89c['attributes']:_0x41be1d[_0xcafd('0x39')];if(!_0x2150b2[_0xcafd('0x37')][_0xcafd('0x3d')]('nolimit')){_0x31f89c[_0xcafd('0x22')]=qs['limit'](_0x2150b2['query'][_0xcafd('0x22')]);_0x31f89c[_0xcafd('0x20')]=qs[_0xcafd('0x20')](_0x2150b2[_0xcafd('0x37')][_0xcafd('0x20')]);}_0x31f89c['order']=qs[_0xcafd('0x40')](_0x2150b2[_0xcafd('0x37')][_0xcafd('0x40')]);_0x31f89c['where']=qs[_0xcafd('0x38')](_[_0xcafd('0x42')](_0x2150b2[_0xcafd('0x37')],_0x41be1d[_0xcafd('0x38')]));_0x31f89c[_0xcafd('0x41')][_0xcafd('0x57')]=_0x22bfce['id'];if(_0x2150b2[_0xcafd('0x37')][_0xcafd('0x45')]){_0x31f89c[_0xcafd('0x41')]=_['merge'](_0x31f89c['where'],{'$or':_['map'](_0x31f89c[_0xcafd('0x3a')],function(_0x4c5e58){var _0x3f4bc3={};_0x3f4bc3[_0x4c5e58]={'$like':'%'+_0x2150b2['query'][_0xcafd('0x45')]+'%'};return _0x3f4bc3;})});}_0x31f89c=_[_0xcafd('0x43')]({},_0x31f89c,_0x2150b2['options']);return db['Disposition'][_0xcafd('0x23')]({'where':_0x31f89c['where']})['then'](function(_0xd65e81){_0x2fb1f0[_0xcafd('0x23')]=_0xd65e81;if(_0x2150b2[_0xcafd('0x37')][_0xcafd('0x46')]){_0x31f89c[_0xcafd('0x47')]=[{'all':!![]}];}return db[_0xcafd('0x58')][_0xcafd('0x5b')](_0x31f89c);})[_0xcafd('0x27')](function(_0x467b65){_0x2fb1f0[_0xcafd('0x48')]=_0x467b65;return _0x2fb1f0;});}})[_0xcafd('0x27')](respondWithFilteredResult(_0x3fd527,_0x31f89c))['catch'](handleError(_0x3fd527,null));};exports['removeDispositions']=function(_0x4792ac,_0x488884,_0x5b033a){return db['CmList']['find']({'where':{'id':_0x4792ac[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x488884,null))[_0xcafd('0x27')](function(_0x493930){if(_0x493930){return _0x493930[_0xcafd('0x5c')](_0x4792ac[_0xcafd('0x37')][_0xcafd('0x5d')]);}})['then'](respondWithStatusCode(_0x488884,null))[_0xcafd('0x49')](handleError(_0x488884,null));};exports[_0xcafd('0x5e')]=function(_0x4145e7,_0x5514d8,_0x5421c5){return db[_0xcafd('0x32')][_0xcafd('0x4d')]({'where':{'id':_0x4145e7[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x5514d8,null))['then'](function(_0x2ffc02){if(_0x2ffc02){var _0x1e3e4f=[];var _0x42cbf7={'success':[],'errors':[]};return db['CmContact'][_0xcafd('0x5f')]()[_0xcafd('0x27')](function(_0x42a8f2){if(_0x4145e7[_0xcafd('0x4f')][_0xcafd('0x60')]&&_[_0xcafd('0x61')](_0x4145e7['body'][_0xcafd('0x60')])){if(_0x4145e7[_0xcafd('0x4f')][_0xcafd('0x60')][_0xcafd('0x3c')]){_0x4145e7[_0xcafd('0x4f')][_0xcafd('0x60')]=_0x4145e7[_0xcafd('0x4f')][_0xcafd('0x60')]['join'](';')+';';}else{_0x4145e7[_0xcafd('0x4f')][_0xcafd('0x60')]=null;}}else{_0x4145e7[_0xcafd('0x4f')]['tags']=null;}if(_0x4145e7[_0xcafd('0x4f')]&&_[_0xcafd('0x61')](_0x4145e7[_0xcafd('0x4f')])){for(var _0x10834c=0x0;_0x10834c<_0x4145e7['body']['length'];_0x10834c+=0x1){_0x4145e7[_0xcafd('0x4f')][_0x10834c]['ListId']=_0x4145e7[_0xcafd('0x56')]['id'];_0x1e3e4f[_0xcafd('0x62')](_0x4145e7[_0xcafd('0x4f')][_0x10834c]);}return BPromise[_0xcafd('0x63')](_0x1e3e4f,function(_0x2de70b){return db['CmContact']['create'](_[_0xcafd('0x64')](_0x2de70b,[_0xcafd('0x5d'),'id'])||{},{'fields':_[_0xcafd('0x4b')](_0x42a8f2),'raw':!![]})[_0xcafd('0x27')](function(_0xf14d5a){_0x42cbf7[_0xcafd('0x65')]['push'](_0xf14d5a[_0xcafd('0x66')]);})[_0xcafd('0x49')](function(_0x474562){_0x42cbf7[_0xcafd('0x67')][_0xcafd('0x62')]({'data':_0x2de70b,'error':_0x474562['message']});});})[_0xcafd('0x27')](function(_0xdd4d14){return _0x42cbf7;})['catch'](function(_0x381169){return _0x381169;});}else{_0x5514d8[_0xcafd('0x1d')](0x190)[_0xcafd('0x1f')]({'message':_0xcafd('0x68')});}});}})[_0xcafd('0x27')](respondWithResult(_0x5514d8,null))['catch'](handleError(_0x5514d8,null));};exports[_0xcafd('0x69')]=function(_0xadd7a8,_0x3e5a4f,_0x26cd68){var _0x4ea822;return db['CmList'][_0xcafd('0x4d')]({'where':{'id':_0xadd7a8[_0xcafd('0x56')]['id']},'include':[{'model':db[_0xcafd('0x6a')],'as':_0xcafd('0x6b')}]})[_0xcafd('0x27')](handleEntityNotFound(_0x3e5a4f,null))[_0xcafd('0x27')](function(_0x4ab547){if(_0x4ab547){_0x4ea822=_0x4ab547;return db['CmContact']['rawAttributes'];}})[_0xcafd('0x27')](function(_0x4fd5b9){if(_0x4fd5b9){var _0x292016={};var _0xcf48a8={};_0xcf48a8[_0xcafd('0x39')]=_['concat'](_[_0xcafd('0x4b')](_0x4fd5b9),_[_0xcafd('0x31')](_0x4ea822[_0xcafd('0x6b')],function(_0x1ef251){return util['format'](_0xcafd('0x6c'),_0x1ef251['id']);}));_0xcf48a8[_0xcafd('0x37')]=_['keys'](_0xadd7a8[_0xcafd('0x37')]);_0xcf48a8[_0xcafd('0x38')]=_[_0xcafd('0x3b')](_0xcf48a8[_0xcafd('0x39')],_0xcf48a8['query']);_0x292016[_0xcafd('0x3a')]=_[_0xcafd('0x3b')](_0xcf48a8[_0xcafd('0x39')],qs[_0xcafd('0x4c')](_0xadd7a8['query'][_0xcafd('0x4c')]));_0x292016[_0xcafd('0x3a')]=_0x292016[_0xcafd('0x3a')][_0xcafd('0x3c')]?_0x292016[_0xcafd('0x3a')]:_0xcf48a8[_0xcafd('0x39')];if(!_0xadd7a8[_0xcafd('0x37')][_0xcafd('0x3d')](_0xcafd('0x3e'))){_0x292016[_0xcafd('0x22')]=qs['limit'](_0xadd7a8[_0xcafd('0x37')][_0xcafd('0x22')]);_0x292016['offset']=qs['offset'](_0xadd7a8[_0xcafd('0x37')][_0xcafd('0x20')]);}_0x292016['order']=qs[_0xcafd('0x40')](_0xadd7a8[_0xcafd('0x37')][_0xcafd('0x40')]);_0x292016['where']=qs[_0xcafd('0x38')](_[_0xcafd('0x42')](_0xadd7a8[_0xcafd('0x37')],_0xcf48a8[_0xcafd('0x38')]));_0x292016['raw']=!![];if(_0xadd7a8[_0xcafd('0x37')][_0xcafd('0x45')]){_0x292016['where']=_['merge'](_0x292016['where'],{'$or':_[_0xcafd('0x31')](_0x292016['attributes'],function(_0x220cd3){var _0x1286a7={};_0x1286a7[_0x220cd3]={'$like':'%'+_0xadd7a8['query'][_0xcafd('0x45')]+'%'};return _0x1286a7;})});}_0x292016=_['merge']({},_0x292016,_0xadd7a8[_0xcafd('0x6d')]);return _0x4ea822[_0xcafd('0x69')](_0x292016);}})[_0xcafd('0x27')](respondWithResult(_0x3e5a4f,null))['catch'](handleError(_0x3e5a4f,null));};exports[_0xcafd('0x6e')]=function(_0x4be45b,_0x1cfccd,_0x535c78){var _0x12a44f;var _0x3b54cd;var _0x258472;var _0x3366dd=_0x4be45b[_0xcafd('0x56')]['id'];csv_results=[];return db['ContactItemType'][_0xcafd('0x5b')]({'attributes':['id',_0xcafd('0x2e')],'raw':!![],'order':[_0xcafd('0x6f')]})[_0xcafd('0x27')](function(_0x18ea5f){_0x12a44f=_0x18ea5f;var _0x217d69=_['keys'](db[_0xcafd('0x70')][_0xcafd('0x33')]);return db[_0xcafd('0x6a')][_0xcafd('0x5b')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x45438d){_0x3b54cd=_0x45438d;var _0x83e2d=squel[_0xcafd('0x71')]()[_0xcafd('0x4c')](_0x217d69)[_0xcafd('0x72')](_0xcafd('0x73'),'c')[_0xcafd('0x41')](_0xcafd('0x74'),_0x3366dd)[_0xcafd('0x41')](_0xcafd('0x75'))[_0xcafd('0x76')]();for(var _0x87d1a2=0x0;_0x87d1a2<_0x3b54cd[_0xcafd('0x3c')];_0x87d1a2++){_0x83e2d[_0xcafd('0x77')](_0xcafd('0x78')+_0x3b54cd[_0x87d1a2]['id'],_0xcafd('0x79')+_0x3b54cd[_0x87d1a2][_0xcafd('0x7a')]);}for(var _0x87d1a2=0x0;_0x87d1a2<_0x12a44f[_0xcafd('0x3c')];_0x87d1a2++){_0x83e2d[_0xcafd('0x77')](squel[_0xcafd('0x71')]()[_0xcafd('0x77')]('item')[_0xcafd('0x72')](_0xcafd('0x7b'))['where'](_0xcafd('0x7c'),_0x12a44f[_0x87d1a2]['id'])[_0xcafd('0x41')](_0xcafd('0x7d')),'additionalPhone_'+_0x12a44f[_0x87d1a2][_0xcafd('0x2e')]);_0x83e2d['field'](squel[_0xcafd('0x71')]()[_0xcafd('0x77')]('description')[_0xcafd('0x72')](_0xcafd('0x7b'))[_0xcafd('0x41')](_0xcafd('0x7c'),_0x12a44f[_0x87d1a2]['id'])[_0xcafd('0x41')](_0xcafd('0x7d')),'description_additionalPhone_'+_0x12a44f[_0x87d1a2][_0xcafd('0x2e')]);}var _0x50c5e=[];_0x50c5e['push'](_0x83e2d['toString']());BPromise['each'](_0x50c5e,handleQuery)[_0xcafd('0x27')](function(_0x2a37ed){handleQuery(_0x83e2d['toString']());var _0x15e96f=csv_results[0x0];if(!_[_0xcafd('0x7e')](_0x15e96f)){var _0x392b42=toCsv(_0x15e96f);var _0x2f66ea=Date[_0xcafd('0x7f')]();fs[_0xcafd('0x80')](util['format']('/tmp/list_%d_%s.csv',_0x3366dd,_0x2f66ea),_0x392b42);_0x1cfccd[_0xcafd('0x81')](_0xcafd('0x82'),_0xcafd('0x83')+util[_0xcafd('0x84')]('list_%d_%s.csv',_0x3366dd,_0x2f66ea));_0x1cfccd[_0xcafd('0x81')](_0xcafd('0x85'),_0xcafd('0x86'));return _0x1cfccd[_0xcafd('0x87')](util[_0xcafd('0x84')]('/tmp/list_%d_%s.csv',_0x3366dd,_0x2f66ea));}else{return _0x1cfccd[_0xcafd('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x50a39d,_0x338459,_0x53f8bb){var _0x2916a4;delete _0x50a39d[_0xcafd('0x4f')]['id'];return db[_0xcafd('0x32')]['findOne']({'where':{'id':_0x50a39d[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x338459,null))[_0xcafd('0x27')](function(_0x2b8ae8){if(_0x2b8ae8){return db[_0xcafd('0x88')][_0xcafd('0x89')](function(_0x41ab95){return db[_0xcafd('0x6a')][_0xcafd('0x4e')](_0x50a39d[_0xcafd('0x4f')],{'transaction':_0x41ab95})[_0xcafd('0x27')](function(_0xca4cdf){_0x2916a4=_0xca4cdf;return _0x2b8ae8[_0xcafd('0x8a')](_0xca4cdf,{'transaction':_0x41ab95});})['then'](function(){var _0x5b16be={'type':db[_0xcafd('0x8b')]['TEXT'],'transaction':_0x41ab95};switch(_0x50a39d[_0xcafd('0x4f')][_0xcafd('0x35')]){case _0xcafd('0x8c'):_0x5b16be[_0xcafd('0x35')]=db['Sequelize']['TEXT'];break;case'number':_0x5b16be[_0xcafd('0x35')]=db['Sequelize'][_0xcafd('0x8d')];break;case _0xcafd('0x8e'):_0x5b16be[_0xcafd('0x35')]=db[_0xcafd('0x8b')][_0xcafd('0x8f')];_0x5b16be['defaultValue']=![];break;default:}return db[_0xcafd('0x88')][_0xcafd('0x90')]['addColumn'](_0xcafd('0x73'),util['format']('cf_%s',_0x2916a4['id']),_0x5b16be);})[_0xcafd('0x27')](function(){return _0x2916a4;});});}})[_0xcafd('0x27')](respondWithResult(_0x338459,null))[_0xcafd('0x49')](handleError(_0x338459,null));};exports[_0xcafd('0x91')]=function(_0x19e64b,_0x2fd4dc,_0x4ed168){var _0x1f0a3d={};var _0x4d304f={};var _0x297089;var _0x20b2f1;return db[_0xcafd('0x32')][_0xcafd('0x5a')]({'where':{'id':_0x19e64b[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x2fd4dc,null))[_0xcafd('0x27')](function(_0x352bdc){if(_0x352bdc){_0x297089=_0x352bdc;_0x4d304f[_0xcafd('0x39')]=_[_0xcafd('0x4b')](db[_0xcafd('0x6a')][_0xcafd('0x33')]);_0x4d304f[_0xcafd('0x37')]=_[_0xcafd('0x4b')](_0x19e64b['query']);_0x4d304f[_0xcafd('0x38')]=_[_0xcafd('0x3b')](_0x4d304f[_0xcafd('0x39')],_0x4d304f[_0xcafd('0x37')]);_0x1f0a3d[_0xcafd('0x3a')]=_[_0xcafd('0x3b')](_0x4d304f[_0xcafd('0x39')],qs['fields'](_0x19e64b[_0xcafd('0x37')][_0xcafd('0x4c')]));_0x1f0a3d[_0xcafd('0x3a')]=_0x1f0a3d['attributes']['length']?_0x1f0a3d['attributes']:_0x4d304f['model'];_0x1f0a3d[_0xcafd('0x3f')]=qs[_0xcafd('0x40')](_0x19e64b[_0xcafd('0x37')][_0xcafd('0x40')]);_0x1f0a3d['where']=qs[_0xcafd('0x38')](_['pick'](_0x19e64b[_0xcafd('0x37')],_0x4d304f[_0xcafd('0x38')]));_0x1f0a3d[_0xcafd('0x41')]=_[_0xcafd('0x43')](_0x1f0a3d[_0xcafd('0x41')],{'$or':[{'ListId':_0x352bdc['id']},{'ListId':null}]});if(_0x19e64b[_0xcafd('0x37')][_0xcafd('0x45')]){_0x1f0a3d['where']=_['merge'](_0x1f0a3d[_0xcafd('0x41')],{'$or':_['map'](_0x1f0a3d['attributes'],function(_0x111e4a){var _0x5c954f={};_0x5c954f[_0x111e4a]={'$like':'%'+_0x19e64b[_0xcafd('0x37')][_0xcafd('0x45')]+'%'};return _0x5c954f;})});}_0x1f0a3d=_[_0xcafd('0x43')]({},_0x1f0a3d,_0x19e64b['options']);return db[_0xcafd('0x6a')][_0xcafd('0x92')](_0x1f0a3d);}})[_0xcafd('0x27')](respondWithResult(_0x2fd4dc,null))['catch'](handleError(_0x2fd4dc,null));};exports[_0xcafd('0x93')]=function(_0x5d6a9a,_0x238276){return db[_0xcafd('0x6a')]['findAndCountAll']({'where':{'ListId':null}})[_0xcafd('0x27')](handleEntityNotFound(_0x238276,null))[_0xcafd('0x27')](function(_0x23caee){return _0x23caee;})[_0xcafd('0x27')](respondWithResult(_0x238276,null))['catch'](handleError(_0x238276,null));};exports['addAgents']=function(_0x1ff220,_0x4b63e3,_0x4cc55d){return db['CmList'][_0xcafd('0x4d')]({'where':{'id':_0x1ff220['params']['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x4b63e3,null))[_0xcafd('0x27')](function(_0x42a2c8){if(_0x42a2c8){return _0x42a2c8[_0xcafd('0x94')](_0x1ff220['body'][_0xcafd('0x5d')],_[_0xcafd('0x64')](_0x1ff220[_0xcafd('0x4f')],[_0xcafd('0x5d'),'id'])||{})[_0xcafd('0x95')](function(_0x4095ea){for(var _0x22102d=0x0;_0x22102d<_0x1ff220['body']['ids']['length'];_0x22102d+=0x1){socket[_0xcafd('0x96')](_0xcafd('0x97'),{'UserId':Number(_0x1ff220['body'][_0xcafd('0x5d')][_0x22102d]),'CmListId':Number(_0x1ff220[_0xcafd('0x56')]['id'])});}return _0x4095ea;});}})['then'](respondWithResult(_0x4b63e3,null))['catch'](handleError(_0x4b63e3,null));};exports[_0xcafd('0x98')]=function(_0x535bb8,_0x3802a0,_0x51298f){return db[_0xcafd('0x32')][_0xcafd('0x4d')]({'where':{'id':_0x535bb8[_0xcafd('0x56')]['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0x3802a0,null))[_0xcafd('0x27')](function(_0x1751e7){if(_0x1751e7){return _0x1751e7[_0xcafd('0x98')](_0x535bb8[_0xcafd('0x37')][_0xcafd('0x5d')])[_0xcafd('0x27')](function(){if(_['isArray'](_0x535bb8[_0xcafd('0x37')][_0xcafd('0x5d')])){for(var _0x593a12=0x0;_0x593a12<_0x535bb8[_0xcafd('0x37')][_0xcafd('0x5d')][_0xcafd('0x3c')];_0x593a12+=0x1){socket[_0xcafd('0x96')](_0xcafd('0x99'),{'UserId':Number(_0x535bb8[_0xcafd('0x37')]['ids'][_0x593a12]),'CmListId':Number(_0x535bb8[_0xcafd('0x56')]['id'])});}}else{socket[_0xcafd('0x96')](_0xcafd('0x99'),{'UserId':Number(_0x535bb8[_0xcafd('0x37')][_0xcafd('0x5d')]),'CmListId':Number(_0x535bb8[_0xcafd('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3802a0,null))[_0xcafd('0x49')](handleError(_0x3802a0,null));};exports[_0xcafd('0x9a')]=function(_0x208edd,_0xdf9f8f,_0x551156){var _0x5e4870={};var _0x175f2e={};var _0x4e161d;var _0x3b3d97;return db[_0xcafd('0x32')][_0xcafd('0x5a')]({'where':{'id':_0x208edd['params']['id']}})[_0xcafd('0x27')](handleEntityNotFound(_0xdf9f8f,null))[_0xcafd('0x27')](function(_0x244df2){if(_0x244df2){_0x4e161d=_0x244df2;_0x175f2e['model']=_[_0xcafd('0x4b')](db[_0xcafd('0x9b')][_0xcafd('0x33')]);_0x175f2e['query']=_['keys'](_0x208edd[_0xcafd('0x37')]);_0x175f2e['filters']=_[_0xcafd('0x3b')](_0x175f2e[_0xcafd('0x39')],_0x175f2e['query']);_0x5e4870[_0xcafd('0x3a')]=_[_0xcafd('0x3b')](_0x175f2e[_0xcafd('0x39')],qs[_0xcafd('0x4c')](_0x208edd[_0xcafd('0x37')][_0xcafd('0x4c')]));_0x5e4870[_0xcafd('0x3a')]=_0x5e4870[_0xcafd('0x3a')][_0xcafd('0x3c')]?_0x5e4870['attributes']:_0x175f2e[_0xcafd('0x39')];_0x5e4870[_0xcafd('0x3f')]=qs[_0xcafd('0x40')](_0x208edd[_0xcafd('0x37')][_0xcafd('0x40')]);_0x5e4870[_0xcafd('0x41')]=qs[_0xcafd('0x38')](_[_0xcafd('0x42')](_0x208edd[_0xcafd('0x37')],_0x175f2e[_0xcafd('0x38')]));if(_0x208edd[_0xcafd('0x37')][_0xcafd('0x45')]){_0x5e4870[_0xcafd('0x41')]=_[_0xcafd('0x43')](_0x5e4870[_0xcafd('0x41')],{'$or':_[_0xcafd('0x31')](_0x5e4870[_0xcafd('0x3a')],function(_0x489a9b){var _0x13aeab={};_0x13aeab[_0x489a9b]={'$like':'%'+_0x208edd[_0xcafd('0x37')][_0xcafd('0x45')]+'%'};return _0x13aeab;})});}_0x5e4870=_['merge']({},_0x5e4870,_0x208edd[_0xcafd('0x6d')]);return _0x4e161d[_0xcafd('0x9a')](_0x5e4870);}})[_0xcafd('0x27')](function(_0xa878d6){if(_0xa878d6){_0x3b3d97=_0xa878d6[_0xcafd('0x3c')];if(!_0x208edd[_0xcafd('0x37')][_0xcafd('0x3d')]('nolimit')){_0x5e4870[_0xcafd('0x22')]=qs['limit'](_0x208edd[_0xcafd('0x37')]['limit']);_0x5e4870[_0xcafd('0x20')]=qs[_0xcafd('0x20')](_0x208edd['query'][_0xcafd('0x20')]);}return _0x4e161d[_0xcafd('0x9a')](_0x5e4870);}})[_0xcafd('0x27')](function(_0x3ada30){if(_0x3ada30){return _0x3ada30?{'count':_0x3b3d97,'rows':_0x3ada30}:null;}})[_0xcafd('0x27')](respondWithResult(_0xdf9f8f,null))[_0xcafd('0x49')](handleError(_0xdf9f8f,null));};function handleQuery(_0x45d2e4){logger['info'](_0x45d2e4);return db['sequelize'][_0xcafd('0x37')](_0x45d2e4)[_0xcafd('0x95')](function(_0x21ba51){csv_results[_0xcafd('0x62')](_0x21ba51);})[_0xcafd('0x49')](function(_0x12946e){logger[_0xcafd('0x2c')](_0x12946e[_0xcafd('0x9c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0718f5e..fe08e3c 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x55ca,0x126));var _0xa55c=function(_0x223a99,_0x1ddaff){_0x223a99=_0x223a99-0x0;var _0x5a2346=_0x55ca[_0x223a99];return _0x5a2346;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x18293c,_0x2a7a14){_0x18293c=_0x18293c-0x0;var _0x4ffc8e=_0xe14b[_0x18293c];return _0x4ffc8e;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 861eee7..4302526 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x48cb4a,_0x36de92){var _0x4f15b=function(_0x221924){while(--_0x221924){_0x48cb4a['push'](_0x48cb4a['shift']());}};_0x4f15b(++_0x36de92);}(_0x54ef,0x112));var _0xf54e=function(_0x34f1f5,_0x41dc83){_0x34f1f5=_0x34f1f5-0x0;var _0x39dbd6=_0x54ef[_0x34f1f5];return _0x39dbd6;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x65519c,_0x598f02){var _0x149ed2=function(_0x235bdd){while(--_0x235bdd){_0x65519c['push'](_0x65519c['shift']());}};_0x149ed2(++_0x598f02);}(_0x6c76,0x184));var _0x66c7=function(_0x1e0193,_0x172d11){_0x1e0193=_0x1e0193-0x0;var _0x56a72e=_0x6c76[_0x1e0193];return _0x56a72e;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','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 d0c8a2e..fdb7f5f 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 _0x737f=['randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment'];(function(_0x472a03,_0x2b562b){var _0x3cd91d=function(_0x7dbdec){while(--_0x7dbdec){_0x472a03['push'](_0x472a03['shift']());}};_0x3cd91d(++_0x2b562b);}(_0x737f,0x17d));var _0xf737=function(_0x57dc42,_0x423960){_0x57dc42=_0x57dc42-0x0;var _0x392cbf=_0x737f[_0x57dc42];return _0x392cbf;};'use strict';var _=require(_0xf737('0x0'));var util=require(_0xf737('0x1'));var moment=require(_0xf737('0x2'));var BPromise=require('bluebird');var rs=require(_0xf737('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf737('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf737('0x5'));var config=require(_0xf737('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf737('0x7')][_0xf737('0x8')]({'port':0x232a});config['redis']=_[_0xf737('0x9')](config['redis'],{'host':_0xf737('0xa'),'port':0x18eb});var socket=require(_0xf737('0xb'))(new Redis(config[_0xf737('0xc')]));require(_0xf737('0xd'))['register'](socket);function respondWithRpcPromise(_0x2494f5,_0x456da7,_0x1e6d71){return new BPromise(function(_0xc019ac,_0x89de9b){return client[_0xf737('0xe')](_0x2494f5,_0x1e6d71)[_0xf737('0xf')](function(_0x4b70d7){logger[_0xf737('0x10')](_0xf737('0x11'),_0x456da7,_0xf737('0x12'));logger[_0xf737('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x456da7,_0xf737('0x12'),JSON[_0xf737('0x14')](_0x4b70d7));if(_0x4b70d7[_0xf737('0x15')]){if(_0x4b70d7[_0xf737('0x15')][_0xf737('0x16')]===0x1f4){logger[_0xf737('0x15')]('CmList,\x20%s,\x20%s',_0x456da7,_0x4b70d7[_0xf737('0x15')][_0xf737('0x17')]);return _0x89de9b(_0x4b70d7[_0xf737('0x15')][_0xf737('0x17')]);}logger[_0xf737('0x15')]('CmList,\x20%s,\x20%s',_0x456da7,_0x4b70d7[_0xf737('0x15')][_0xf737('0x17')]);return _0xc019ac(_0x4b70d7[_0xf737('0x15')][_0xf737('0x17')]);}else{logger[_0xf737('0x10')](_0xf737('0x11'),_0x456da7,'request\x20sent');_0xc019ac(_0x4b70d7['result'][_0xf737('0x17')]);}})['catch'](function(_0x2ba033){logger[_0xf737('0x15')](_0xf737('0x11'),_0x456da7,_0x2ba033);_0x89de9b(_0x2ba033);});});} \ No newline at end of file +var _0x7c46=['http','defaults','redis','localhost','./cmList.socket','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7c46,0x1c3));var _0x67c4=function(_0x1faf6b,_0x1e6bc6){_0x1faf6b=_0x1faf6b-0x0;var _0x3e1ea3=_0x7c46[_0x1faf6b];return _0x3e1ea3;};'use strict';var _=require(_0x67c4('0x0'));var util=require(_0x67c4('0x1'));var moment=require(_0x67c4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67c4('0x3'));var db=require(_0x67c4('0x4'))['db'];var utils=require(_0x67c4('0x5'));var logger=require(_0x67c4('0x6'))(_0x67c4('0x7'));var config=require(_0x67c4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x67c4('0x9')]({'port':0x232a});config['redis']=_[_0x67c4('0xa')](config[_0x67c4('0xb')],{'host':_0x67c4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67c4('0xb')]));require(_0x67c4('0xd'))['register'](socket);function respondWithRpcPromise(_0x4ecd8a,_0xcc021,_0x2951e5){return new BPromise(function(_0x1d0f45,_0x5e1e2a){return client['request'](_0x4ecd8a,_0x2951e5)['then'](function(_0x85722c){logger[_0x67c4('0xe')]('CmList,\x20%s,\x20%s',_0xcc021,'request\x20sent');logger[_0x67c4('0xf')](_0x67c4('0x10'),_0xcc021,_0x67c4('0x11'),JSON[_0x67c4('0x12')](_0x85722c));if(_0x85722c[_0x67c4('0x13')]){if(_0x85722c[_0x67c4('0x13')][_0x67c4('0x14')]===0x1f4){logger[_0x67c4('0x13')]('CmList,\x20%s,\x20%s',_0xcc021,_0x85722c[_0x67c4('0x13')][_0x67c4('0x15')]);return _0x5e1e2a(_0x85722c[_0x67c4('0x13')]['message']);}logger['error']('CmList,\x20%s,\x20%s',_0xcc021,_0x85722c[_0x67c4('0x13')]['message']);return _0x1d0f45(_0x85722c[_0x67c4('0x13')][_0x67c4('0x15')]);}else{logger[_0x67c4('0xe')]('CmList,\x20%s,\x20%s',_0xcc021,'request\x20sent');_0x1d0f45(_0x85722c[_0x67c4('0x16')][_0x67c4('0x15')]);}})['catch'](function(_0x3a1856){logger[_0x67c4('0x13')]('CmList,\x20%s,\x20%s',_0xcc021,_0x3a1856);_0x5e1e2a(_0x3a1856);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 049951d..3a6bc0d 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 _0x2fef=['removeListener','register','length','save','remove','update','emit'];(function(_0x1a1d9b,_0x5ea65a){var _0x1d7a59=function(_0xa1dea2){while(--_0xa1dea2){_0x1a1d9b['push'](_0x1a1d9b['shift']());}};_0x1d7a59(++_0x5ea65a);}(_0x2fef,0x1c3));var _0xf2fe=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x2fef[_0x5c14f6];return _0x4949b3;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xf2fe('0x0'),_0xf2fe('0x1'),_0xf2fe('0x2')];function createListener(_0x54ccbf,_0x54fe75){return function(_0x2e2821){_0x54fe75[_0xf2fe('0x3')](_0x54ccbf,_0x2e2821);};}function removeListener(_0x505067,_0x41cd85){return function(){CmListEvents[_0xf2fe('0x4')](_0x505067,_0x41cd85);};}exports[_0xf2fe('0x5')]=function(_0x5b3d6e){for(var _0x3b7270=0x0,_0x4eec41=events[_0xf2fe('0x6')];_0x3b7270<_0x4eec41;_0x3b7270++){var _0x3591db=events[_0x3b7270];var _0x4e37f7=createListener('cmList:'+_0x3591db,_0x5b3d6e);CmListEvents['on'](_0x3591db,_0x4e37f7);}}; \ No newline at end of file +var _0xa845=['save','remove','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa845,0xe7));var _0x5a84=function(_0x282c7f,_0x460e10){_0x282c7f=_0x282c7f-0x0;var _0x54bc87=_0xa845[_0x282c7f];return _0x54bc87;};'use strict';var CmListEvents=require(_0x5a84('0x0'));var events=[_0x5a84('0x1'),_0x5a84('0x2'),'update'];function createListener(_0x50e482,_0x3e2381){return function(_0x31f793){_0x3e2381[_0x5a84('0x3')](_0x50e482,_0x31f793);};}function removeListener(_0x371751,_0x5d77fc){return function(){CmListEvents[_0x5a84('0x4')](_0x371751,_0x5d77fc);};}exports[_0x5a84('0x5')]=function(_0x33b8d3){for(var _0x2621fc=0x0,_0xde25e0=events[_0x5a84('0x6')];_0x2621fc<_0xde25e0;_0x2621fc++){var _0x4c86a3=events[_0x2621fc];var _0x2e9c96=createListener(_0x5a84('0x7')+_0x4c86a3,_0x33b8d3);CmListEvents['on'](_0x4c86a3,_0x2e9c96);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c1448ca..497ebeb 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 _0x370d=['put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','create','post','addDisposition','addContacts','addCustomField'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x370d,0xc6));var _0xd370=function(_0x100555,_0x35674e){_0x100555=_0x100555-0x0;var _0x13ce42=_0x370d[_0x100555];return _0x13ce42;};'use strict';var multer=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var path=require('path');var timeout=require(_0xd370('0x2'));var express=require(_0xd370('0x3'));var router=express[_0xd370('0x4')]();var fs_extra=require(_0xd370('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd370('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd370('0x7')]);router[_0xd370('0x8')](_0xd370('0x9'),auth[_0xd370('0xa')](),controller[_0xd370('0xb')]);router[_0xd370('0x8')](_0xd370('0xc'),auth[_0xd370('0xa')](),controller['getGlobalCustomFields']);router[_0xd370('0x8')](_0xd370('0xd'),auth[_0xd370('0xa')](),controller[_0xd370('0xe')]);router[_0xd370('0x8')](_0xd370('0xf'),auth['isAuthenticated'](),controller[_0xd370('0x10')]);router[_0xd370('0x8')]('/:id/contacts',auth[_0xd370('0xa')](),controller['getContacts']);router[_0xd370('0x8')](_0xd370('0x11'),auth[_0xd370('0xa')](),controller[_0xd370('0x12')]);router[_0xd370('0x8')](_0xd370('0x13'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xd370('0x8')](_0xd370('0x14'),auth[_0xd370('0xa')](),controller['getAgents']);router['post']('/',auth[_0xd370('0xa')](),controller[_0xd370('0x15')]);router[_0xd370('0x16')](_0xd370('0xf'),auth[_0xd370('0xa')](),controller[_0xd370('0x17')]);router['post']('/:id/contacts',auth[_0xd370('0xa')](),controller[_0xd370('0x18')]);router[_0xd370('0x16')](_0xd370('0x13'),auth[_0xd370('0xa')](),controller[_0xd370('0x19')]);router[_0xd370('0x16')](_0xd370('0x14'),auth[_0xd370('0xa')](),controller['addAgents']);router[_0xd370('0x1a')](_0xd370('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd370('0x1b')](_0xd370('0xd'),auth['isAuthenticated'](),controller[_0xd370('0x1c')]);router['delete'](_0xd370('0xf'),auth[_0xd370('0xa')](),controller[_0xd370('0x1d')]);router[_0xd370('0x1b')]('/:id/users',auth[_0xd370('0xa')](),controller[_0xd370('0x1e')]);module[_0xd370('0x1f')]=router; \ No newline at end of file +var _0xe630=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','addDisposition','/:id/fields','addCustomField','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0xedce05,_0x43e8c3){var _0x59f633=function(_0x53a054){while(--_0x53a054){_0xedce05['push'](_0xedce05['shift']());}};_0x59f633(++_0x43e8c3);}(_0xe630,0x149));var _0x0e63=function(_0x27b070,_0x217d9b){_0x27b070=_0x27b070-0x0;var _0x1d8ecb=_0xe630[_0x27b070];return _0x1d8ecb;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./cmList.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0x8')](_0x0e63('0xd'),auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0x8')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x8')](_0x0e63('0x11'),auth['isAuthenticated'](),controller[_0x0e63('0x12')]);router[_0x0e63('0x8')](_0x0e63('0x13'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x14')]);router[_0x0e63('0x8')](_0x0e63('0x15'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x16')]);router['get']('/:id/fields',auth[_0x0e63('0x9')](),controller[_0x0e63('0x17')]);router[_0x0e63('0x8')](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x19')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x1a')]);router['post']('/:id/contacts',auth[_0x0e63('0x9')](),controller['addContacts']);router['post'](_0x0e63('0x1b'),auth['isAuthenticated'](),controller[_0x0e63('0x1c')]);router[_0x0e63('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x0e63('0x1e')]);router[_0x0e63('0x1f')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x20')]);router[_0x0e63('0x21')]('/:id',auth[_0x0e63('0x9')](),controller[_0x0e63('0x22')]);router[_0x0e63('0x21')](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller['removeDispositions']);router['delete'](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x23')]);module[_0x0e63('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3d00fca..70584a7 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 _0xf49f=['sequelize','exports','getDataValue','field','STRING'];(function(_0x59f779,_0x268aea){var _0x2bd60c=function(_0x2a6ae3){while(--_0x2a6ae3){_0x59f779['push'](_0x59f779['shift']());}};_0x2bd60c(++_0x268aea);}(_0xf49f,0x109));var _0xff49=function(_0x3f90a5,_0x15d8ef){_0x3f90a5=_0x3f90a5-0x0;var _0x459437=_0xf49f[_0x3f90a5];return _0x459437;};'use strict';var Sequelize=require(_0xff49('0x0'));module[_0xff49('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xb1ca59){return this[_0xff49('0x2')](_0xff49('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xff49('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xff49('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x5114=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x5cf741,_0x3256c5){var _0x24ff69=function(_0x287716){while(--_0x287716){_0x5cf741['push'](_0x5cf741['shift']());}};_0x24ff69(++_0x3256c5);}(_0x5114,0xa0));var _0x4511=function(_0xe191c0,_0x548e88){_0xe191c0=_0xe191c0-0x0;var _0x1fad66=_0x5114[_0xe191c0];return _0x1fad66;};'use strict';var Sequelize=require(_0x4511('0x0'));module['exports']={'name':{'type':Sequelize[_0x4511('0x1')],'get':function(_0x2311c0){return this[_0x4511('0x2')](_0x4511('0x3'));}},'field':{'type':Sequelize[_0x4511('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x4511('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x4511('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index d3ea664..98e5f1f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1ea978,_0x2c9450){var _0x5d1a1f=function(_0x3fbc2a){while(--_0x3fbc2a){_0x1ea978['push'](_0x1ea978['shift']());}};_0x5d1a1f(++_0x2c9450);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xc86545,_0x123792){var _0x28c74e=function(_0x3f8b7c){while(--_0x3f8b7c){_0xc86545['push'](_0xc86545['shift']());}};_0x28c74e(++_0x123792);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 8f4f991..51e3b08 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 _0xd8af=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','../../config/logger','moment'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0xd8af,0x1ad));var _0xfd8a=function(_0x4938d3,_0x34b26e){_0x4938d3=_0x4938d3-0x0;var _0x59cb94=_0xd8af[_0x4938d3];return _0x59cb94;};'use strict';var _=require(_0xfd8a('0x0'));var util=require('util');var logger=require(_0xfd8a('0x1'))('api');var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rp=require(_0xfd8a('0x4'));var fs=require('fs');var path=require(_0xfd8a('0x5'));var rimraf=require(_0xfd8a('0x6'));var config=require(_0xfd8a('0x7'));var attributes=require(_0xfd8a('0x8'));module['exports']=function(_0x41d1aa,_0x5b45ca){return _0x41d1aa[_0xfd8a('0x9')](_0xfd8a('0xa'),attributes,{'tableName':_0xfd8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9765=['define','Condition','lodash','util','../../config/logger','api','moment','request-promise','path','./condition.attributes','exports'];(function(_0xcba4b6,_0x1ecf6a){var _0x2bd8bf=function(_0x46812a){while(--_0x46812a){_0xcba4b6['push'](_0xcba4b6['shift']());}};_0x2bd8bf(++_0x1ecf6a);}(_0x9765,0xde));var _0x5976=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9765[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5976('0x0'));var util=require(_0x5976('0x1'));var logger=require(_0x5976('0x2'))(_0x5976('0x3'));var moment=require(_0x5976('0x4'));var BPromise=require('bluebird');var rp=require(_0x5976('0x5'));var fs=require('fs');var path=require(_0x5976('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5976('0x7'));module[_0x5976('0x8')]=function(_0x33a734,_0x50666a){return _0x33a734[_0x5976('0x9')](_0x5976('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index eb5ee77..35f2ce1 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 _0x86e7=['rpc','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x550efc,_0x1ad9b0){var _0x8deded=function(_0x3e3054){while(--_0x3e3054){_0x550efc['push'](_0x550efc['shift']());}};_0x8deded(++_0x1ad9b0);}(_0x86e7,0x1c6));var _0x786e=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x86e7[_0x243217];return _0x478029;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x786e('0x0'));var BPromise=require(_0x786e('0x1'));var rs=require(_0x786e('0x2'));var fs=require('fs');var Redis=require(_0x786e('0x3'));var db=require(_0x786e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x786e('0x5'))(_0x786e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x786e('0x7')][_0x786e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x273f5a,_0x2ced01,_0x29fb73){return new BPromise(function(_0x2d218a,_0x73d476){return client[_0x786e('0x9')](_0x273f5a,_0x29fb73)[_0x786e('0xa')](function(_0x381f4e){logger[_0x786e('0xb')](_0x786e('0xc'),_0x2ced01,'request\x20sent');logger[_0x786e('0xd')](_0x786e('0xe'),_0x2ced01,_0x786e('0xf'),JSON['stringify'](_0x381f4e));if(_0x381f4e[_0x786e('0x10')]){if(_0x381f4e[_0x786e('0x10')][_0x786e('0x11')]===0x1f4){logger[_0x786e('0x10')](_0x786e('0xc'),_0x2ced01,_0x381f4e['error'][_0x786e('0x12')]);return _0x73d476(_0x381f4e['error'][_0x786e('0x12')]);}logger[_0x786e('0x10')](_0x786e('0xc'),_0x2ced01,_0x381f4e['error'][_0x786e('0x12')]);return _0x2d218a(_0x381f4e[_0x786e('0x10')][_0x786e('0x12')]);}else{logger['info'](_0x786e('0xc'),_0x2ced01,_0x786e('0xf'));_0x2d218a(_0x381f4e['result'][_0x786e('0x12')]);}})[_0x786e('0x13')](function(_0x7ef7ee){logger[_0x786e('0x10')](_0x786e('0xc'),_0x2ced01,_0x7ef7ee);_0x73d476(_0x7ef7ee);});});} \ No newline at end of file +var _0x486a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x486a,0x19c));var _0xa486=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x486a[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0xa486('0x0'));var util=require(_0xa486('0x1'));var moment=require(_0xa486('0x2'));var BPromise=require(_0xa486('0x3'));var rs=require(_0xa486('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa486('0x5'));var logger=require(_0xa486('0x6'))(_0xa486('0x7'));var config=require(_0xa486('0x8'));var jayson=require(_0xa486('0x9'));var client=jayson[_0xa486('0xa')][_0xa486('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3611e2,_0x54562a,_0x3df231){return new BPromise(function(_0x5417f4,_0x1ac785){return client[_0xa486('0xc')](_0x3611e2,_0x3df231)['then'](function(_0xc74045){logger['info']('Condition,\x20%s,\x20%s',_0x54562a,_0xa486('0xd'));logger[_0xa486('0xe')](_0xa486('0xf'),_0x54562a,_0xa486('0xd'),JSON[_0xa486('0x10')](_0xc74045));if(_0xc74045['error']){if(_0xc74045[_0xa486('0x11')]['code']===0x1f4){logger[_0xa486('0x11')](_0xa486('0x12'),_0x54562a,_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);return _0x1ac785(_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);}logger[_0xa486('0x11')](_0xa486('0x12'),_0x54562a,_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);return _0x5417f4(_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);}else{logger[_0xa486('0x14')](_0xa486('0x12'),_0x54562a,_0xa486('0xd'));_0x5417f4(_0xc74045[_0xa486('0x15')][_0xa486('0x13')]);}})['catch'](function(_0x483ebb){logger['error'](_0xa486('0x12'),_0x54562a,_0x483ebb);_0x1ac785(_0x483ebb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 98d1e4c..485278e 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 _0xd671=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0xd671,0xf0));var _0x1d67=function(_0x23eb8c,_0x5618e8){_0x23eb8c=_0x23eb8c-0x0;var _0x4978ba=_0xd671[_0x23eb8c];return _0x4978ba;};'use strict';var multer=require(_0x1d67('0x0'));var util=require(_0x1d67('0x1'));var path=require('path');var timeout=require(_0x1d67('0x2'));var express=require(_0x1d67('0x3'));var router=express[_0x1d67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d67('0x5'));var interaction=require(_0x1d67('0x6'));var config=require(_0x1d67('0x7'));var controller=require('./condition.controller');router[_0x1d67('0x8')](_0x1d67('0x9'),auth[_0x1d67('0xa')](),controller[_0x1d67('0xb')]);router[_0x1d67('0xc')](_0x1d67('0x9'),auth[_0x1d67('0xa')](),controller[_0x1d67('0xd')]);module[_0x1d67('0xe')]=router; \ No newline at end of file +var _0x5f3c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4a3ddc,_0x50dba5){var _0x1eeab1=function(_0x34ce68){while(--_0x34ce68){_0x4a3ddc['push'](_0x4a3ddc['shift']());}};_0x1eeab1(++_0x50dba5);}(_0x5f3c,0xeb));var _0xc5f3=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x5f3c[_0x2c93e2];return _0x57264e;};'use strict';var multer=require(_0xc5f3('0x0'));var util=require(_0xc5f3('0x1'));var path=require(_0xc5f3('0x2'));var timeout=require(_0xc5f3('0x3'));var express=require(_0xc5f3('0x4'));var router=express[_0xc5f3('0x5')]();var fs_extra=require(_0xc5f3('0x6'));var auth=require(_0xc5f3('0x7'));var interaction=require(_0xc5f3('0x8'));var config=require('../../config/environment');var controller=require(_0xc5f3('0x9'));router[_0xc5f3('0xa')]('/:id',auth[_0xc5f3('0xb')](),controller['update']);router[_0xc5f3('0xc')](_0xc5f3('0xd'),auth[_0xc5f3('0xb')](),controller[_0xc5f3('0xe')]);module[_0xc5f3('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index feb155d..0f2f387 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf46=['STRING','sequelize','exports'];(function(_0x15d35d,_0x5caf54){var _0x2f00d5=function(_0x1c3819){while(--_0x1c3819){_0x15d35d['push'](_0x15d35d['shift']());}};_0x2f00d5(++_0x5caf54);}(_0xcf46,0x1a5));var _0x6cf4=function(_0x4fa652,_0x2a8264){_0x4fa652=_0x4fa652-0x0;var _0x24fa27=_0xcf46[_0x4fa652];return _0x24fa27;};'use strict';var Sequelize=require(_0x6cf4('0x0'));module[_0x6cf4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6cf4('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1c5a=['exports','STRING','name','INTEGER','sequelize'];(function(_0xf54e9e,_0x451048){var _0x46eb6a=function(_0x3a8ffb){while(--_0x3a8ffb){_0xf54e9e['push'](_0xf54e9e['shift']());}};_0x46eb6a(++_0x451048);}(_0x1c5a,0x86));var _0xa1c5=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1c5a[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xa1c5('0x0'));module[_0xa1c5('0x1')]={'name':{'type':Sequelize[_0xa1c5('0x2')],'allowNull':![],'unique':_0xa1c5('0x3')},'OrderBy':{'type':Sequelize[_0xa1c5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa1c5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 67b36fb..1490f7a 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fdc=['destroy','get','ContactItemTypes','error','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','catch','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then'];(function(_0x450c48,_0x15fd64){var _0x404a83=function(_0x3832fa){while(--_0x3832fa){_0x450c48['push'](_0x450c48['shift']());}};_0x404a83(++_0x15fd64);}(_0x5fdc,0x127));var _0xc5fd=function(_0x405118,_0x4a5711){_0x405118=_0x405118-0x0;var _0x58cd17=_0x5fdc[_0x405118];return _0x58cd17;};'use strict';var emlformat=require(_0xc5fd('0x0'));var rimraf=require(_0xc5fd('0x1'));var zipdir=require(_0xc5fd('0x2'));var jsonpatch=require(_0xc5fd('0x3'));var rp=require(_0xc5fd('0x4'));var moment=require(_0xc5fd('0x5'));var BPromise=require(_0xc5fd('0x6'));var Mustache=require(_0xc5fd('0x7'));var util=require(_0xc5fd('0x8'));var path=require(_0xc5fd('0x9'));var sox=require(_0xc5fd('0xa'));var csv=require(_0xc5fd('0xb'));var ejs=require(_0xc5fd('0xc'));var fs=require('fs');var fs_extra=require(_0xc5fd('0xd'));var _=require(_0xc5fd('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5fd('0xf'));var toCsv=require(_0xc5fd('0xb'));var querystring=require(_0xc5fd('0x10'));var Papa=require(_0xc5fd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5fd('0x12'));var as=require(_0xc5fd('0x13'));var hardwareService=require(_0xc5fd('0x14'));var logger=require(_0xc5fd('0x15'))(_0xc5fd('0x16'));var utils=require(_0xc5fd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x558939,_0x1b1b2b){_0x1b1b2b=_0x1b1b2b||0xcc;return function(_0x1bc6d1){if(_0x1bc6d1){return _0x558939[_0xc5fd('0x19')](_0x1b1b2b);}return _0x558939[_0xc5fd('0x1a')](_0x1b1b2b)[_0xc5fd('0x1b')]();};}function respondWithResult(_0x40b0f8,_0x27447e){_0x27447e=_0x27447e||0xc8;return function(_0xa7a954){if(_0xa7a954){return _0x40b0f8['status'](_0x27447e)[_0xc5fd('0x1c')](_0xa7a954);}};}function respondWithFilteredResult(_0x103c3d,_0x2221da){return function(_0x3404e0){if(_0x3404e0){var _0x4d3636=typeof _0x2221da['offset']==='undefined'&&typeof _0x2221da['limit']==='undefined';var _0x35a9d0=_0x3404e0[_0xc5fd('0x1d')];var _0x27f611=_0x4d3636?0x0:_0x2221da[_0xc5fd('0x1e')];var _0x2ee392=_0x4d3636?_0x3404e0[_0xc5fd('0x1d')]:_0x2221da[_0xc5fd('0x1e')]+_0x2221da['limit'];var _0xb7bab1;if(_0x2ee392>=_0x35a9d0){_0x2ee392=_0x35a9d0;_0xb7bab1=0xc8;}else{_0xb7bab1=0xce;}_0x103c3d[_0xc5fd('0x1a')](_0xb7bab1);return _0x103c3d[_0xc5fd('0x1f')](_0xc5fd('0x20'),_0x27f611+'-'+_0x2ee392+'/'+_0x35a9d0)[_0xc5fd('0x1c')](_0x3404e0);}return null;};}function patchUpdates(_0x48024e){return function(_0x3966a2){try{jsonpatch[_0xc5fd('0x21')](_0x3966a2,_0x48024e,!![]);}catch(_0x18048e){return BPromise[_0xc5fd('0x22')](_0x18048e);}return _0x3966a2['save']();};}function saveUpdates(_0x4c85d5,_0x13cc42){return function(_0x2ab935){if(_0x2ab935){return _0x2ab935[_0xc5fd('0x23')](_0x4c85d5)[_0xc5fd('0x24')](function(_0x334401){return _0x334401;});}return null;};}function removeEntity(_0x311952,_0x56d473){return function(_0x1a3f21){if(_0x1a3f21){return _0x1a3f21[_0xc5fd('0x25')]()[_0xc5fd('0x24')](function(){var _0x18c9c7=_0x1a3f21[_0xc5fd('0x26')]({'plain':!![]});var _0x4020af=_0xc5fd('0x27');return db['UserProfileResource'][_0xc5fd('0x25')]({'where':{'type':_0x4020af,'resourceId':_0x18c9c7['id']}})['then'](function(){return _0x1a3f21;});})[_0xc5fd('0x24')](function(){_0x311952[_0xc5fd('0x1a')](0xcc)[_0xc5fd('0x1b')]();});}};}function handleEntityNotFound(_0x2bee22,_0x5cafd3){return function(_0x176313){if(!_0x176313){_0x2bee22[_0xc5fd('0x19')](0x194);}return _0x176313;};}function handleError(_0x19c4a0,_0x42cbf0){_0x42cbf0=_0x42cbf0||0x1f4;return function(_0x19df33){logger[_0xc5fd('0x28')](_0x19df33['stack']);if(_0x19df33[_0xc5fd('0x29')]){delete _0x19df33['name'];}_0x19c4a0['status'](_0x42cbf0)[_0xc5fd('0x2a')](_0x19df33);};}exports[_0xc5fd('0x2b')]=function(_0x39b21a,_0x38db1d){var _0x7693c4={},_0x85fa81={},_0x2a891d={'count':0x0,'rows':[]};var _0x321eea=_['map'](db[_0xc5fd('0x2c')][_0xc5fd('0x2d')],function(_0x6bb14d){return{'name':_0x6bb14d[_0xc5fd('0x2e')],'type':_0x6bb14d[_0xc5fd('0x2f')][_0xc5fd('0x30')]};});_0x85fa81[_0xc5fd('0x31')]=_[_0xc5fd('0x32')](_0x321eea,_0xc5fd('0x29'));_0x85fa81[_0xc5fd('0x33')]=_[_0xc5fd('0x34')](_0x39b21a[_0xc5fd('0x33')]);_0x85fa81['filters']=_[_0xc5fd('0x35')](_0x85fa81[_0xc5fd('0x31')],_0x85fa81[_0xc5fd('0x33')]);_0x7693c4[_0xc5fd('0x36')]=_[_0xc5fd('0x35')](_0x85fa81[_0xc5fd('0x31')],qs[_0xc5fd('0x37')](_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x37')]));_0x7693c4['attributes']=_0x7693c4[_0xc5fd('0x36')][_0xc5fd('0x38')]?_0x7693c4[_0xc5fd('0x36')]:_0x85fa81[_0xc5fd('0x31')];if(!_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x39')](_0xc5fd('0x3a'))){_0x7693c4['limit']=qs[_0xc5fd('0x3b')](_0x39b21a[_0xc5fd('0x33')]['limit']);_0x7693c4[_0xc5fd('0x1e')]=qs['offset'](_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x1e')]);}_0x7693c4[_0xc5fd('0x3c')]=qs['sort'](_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x3d')]);_0x7693c4['where']=qs[_0xc5fd('0x3e')](_[_0xc5fd('0x3f')](_0x39b21a[_0xc5fd('0x33')],_0x85fa81[_0xc5fd('0x3e')]),_0x321eea);if(_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x40')]){_0x7693c4['where']=_[_0xc5fd('0x41')](_0x7693c4[_0xc5fd('0x42')],{'$or':_[_0xc5fd('0x32')](_0x321eea,function(_0x2a368e){if(_0x2a368e['type']!=='VIRTUAL'){var _0x47fe66={};_0x47fe66[_0x2a368e[_0xc5fd('0x29')]]={'$like':'%'+_0x39b21a[_0xc5fd('0x33')][_0xc5fd('0x40')]+'%'};return _0x47fe66;}})});}_0x7693c4=_[_0xc5fd('0x41')]({},_0x7693c4,_0x39b21a[_0xc5fd('0x43')]);var _0x33514d={'where':_0x7693c4[_0xc5fd('0x42')]};return db[_0xc5fd('0x2c')][_0xc5fd('0x1d')](_0x33514d)['then'](function(_0x5a2199){_0x2a891d[_0xc5fd('0x1d')]=_0x5a2199;if(_0x39b21a['query'][_0xc5fd('0x44')]){_0x7693c4[_0xc5fd('0x45')]=[{'all':!![]}];}return db[_0xc5fd('0x2c')]['findAll'](_0x7693c4);})[_0xc5fd('0x24')](function(_0x350753){_0x2a891d['rows']=_0x350753;return _0x2a891d;})[_0xc5fd('0x24')](respondWithFilteredResult(_0x38db1d,_0x7693c4))[_0xc5fd('0x46')](handleError(_0x38db1d,null));};exports['show']=function(_0x3e57da,_0x48c8d4){var _0x1297a1={'raw':!![],'where':{'id':_0x3e57da['params']['id']}},_0x17ce12={};_0x17ce12[_0xc5fd('0x31')]=_[_0xc5fd('0x34')](db[_0xc5fd('0x2c')]['rawAttributes']);_0x17ce12[_0xc5fd('0x33')]=_[_0xc5fd('0x34')](_0x3e57da['query']);_0x17ce12['filters']=_[_0xc5fd('0x35')](_0x17ce12['model'],_0x17ce12['query']);_0x1297a1['attributes']=_[_0xc5fd('0x35')](_0x17ce12[_0xc5fd('0x31')],qs[_0xc5fd('0x37')](_0x3e57da[_0xc5fd('0x33')][_0xc5fd('0x37')]));_0x1297a1[_0xc5fd('0x36')]=_0x1297a1['attributes']['length']?_0x1297a1['attributes']:_0x17ce12[_0xc5fd('0x31')];if(_0x3e57da[_0xc5fd('0x33')][_0xc5fd('0x44')]){_0x1297a1['include']=[{'all':!![]}];}_0x1297a1=_[_0xc5fd('0x41')]({},_0x1297a1,_0x3e57da['options']);return db[_0xc5fd('0x2c')][_0xc5fd('0x47')](_0x1297a1)[_0xc5fd('0x24')](handleEntityNotFound(_0x48c8d4,null))[_0xc5fd('0x24')](respondWithResult(_0x48c8d4,null))[_0xc5fd('0x46')](handleError(_0x48c8d4,null));};exports[_0xc5fd('0x48')]=function(_0x54d86c,_0x6b2f77){return db[_0xc5fd('0x2c')]['create'](_0x54d86c['body'],{})[_0xc5fd('0x24')](function(_0x4eb26b){var _0x5723cb=_0x54d86c[_0xc5fd('0x49')][_0xc5fd('0x26')]({'plain':!![]});if(!_0x5723cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5723cb[_0xc5fd('0x4a')]===_0xc5fd('0x49')){var _0x5c49e7=_0x4eb26b[_0xc5fd('0x26')]({'plain':!![]});var _0x346718=_0xc5fd('0x27');return db[_0xc5fd('0x4b')][_0xc5fd('0x47')]({'where':{'name':_0x346718,'userProfileId':_0x5723cb[_0xc5fd('0x4c')]},'raw':!![]})[_0xc5fd('0x24')](function(_0x26bae0){if(_0x26bae0&&_0x26bae0[_0xc5fd('0x4d')]===0x0){return db[_0xc5fd('0x4e')][_0xc5fd('0x48')]({'name':_0x5c49e7['name'],'resourceId':_0x5c49e7['id'],'type':_0x26bae0[_0xc5fd('0x29')],'sectionId':_0x26bae0['id']},{})[_0xc5fd('0x24')](function(){return _0x4eb26b;});}else{return _0x4eb26b;}})[_0xc5fd('0x46')](function(_0x4989ce){logger[_0xc5fd('0x28')](_0xc5fd('0x4f'),_0x4989ce);throw _0x4989ce;});}return _0x4eb26b;})[_0xc5fd('0x24')](respondWithResult(_0x6b2f77,0xc9))[_0xc5fd('0x46')](handleError(_0x6b2f77,null));};exports['update']=function(_0xcbd63b,_0x5b5ecd){if(_0xcbd63b['body']['id']){delete _0xcbd63b[_0xc5fd('0x50')]['id'];}return db[_0xc5fd('0x2c')][_0xc5fd('0x47')]({'where':{'id':_0xcbd63b[_0xc5fd('0x51')]['id']}})[_0xc5fd('0x24')](handleEntityNotFound(_0x5b5ecd,null))['then'](saveUpdates(_0xcbd63b['body'],null))[_0xc5fd('0x24')](respondWithResult(_0x5b5ecd,null))[_0xc5fd('0x46')](handleError(_0x5b5ecd,null));};exports['destroy']=function(_0x4e9495,_0x50e0c7){return db[_0xc5fd('0x2c')]['find']({'where':{'id':_0x4e9495[_0xc5fd('0x51')]['id']}})[_0xc5fd('0x24')](handleEntityNotFound(_0x50e0c7,null))[_0xc5fd('0x24')](db[_0xc5fd('0x52')][_0xc5fd('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4e9495[_0xc5fd('0x51')]['id']}}))[_0xc5fd('0x24')](removeEntity(_0x50e0c7,null))['catch'](handleError(_0x50e0c7,null));}; \ No newline at end of file +var _0x8952=['name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','stack'];(function(_0x1a0e6a,_0x1b43de){var _0x4b3934=function(_0x81dc97){while(--_0x81dc97){_0x1a0e6a['push'](_0x1a0e6a['shift']());}};_0x4b3934(++_0x1b43de);}(_0x8952,0x17e));var _0x2895=function(_0x1b00a5,_0x2a9c0d){_0x1b00a5=_0x1b00a5-0x0;var _0x3e25e8=_0x8952[_0x1b00a5];return _0x3e25e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){var _0x4569b5=_0x511286[_0x2895('0x22')]({'plain':!![]});var _0x4a21cf=_0x2895('0x23');return db[_0x2895('0x24')]['destroy']({'where':{'type':_0x4a21cf,'resourceId':_0x4569b5['id']}})[_0x2895('0x21')](function(){return _0x511286;});})[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320661,_0x30f491){return function(_0x5eedfc){if(!_0x5eedfc){_0x320661[_0x2895('0x15')](0x194);}return _0x5eedfc;};}function handleError(_0x501898,_0x5d70f5){_0x5d70f5=_0x5d70f5||0x1f4;return function(_0x18a935){logger['error'](_0x18a935[_0x2895('0x25')]);if(_0x18a935[_0x2895('0x26')]){delete _0x18a935['name'];}_0x501898['status'](_0x5d70f5)[_0x2895('0x27')](_0x18a935);};}exports[_0x2895('0x28')]=function(_0x190e07,_0x14e343){var _0x14d150={},_0xa61689={},_0x34e110={'count':0x0,'rows':[]};var _0x546514=_[_0x2895('0x29')](db[_0x2895('0x2a')][_0x2895('0x2b')],function(_0x5546eb){return{'name':_0x5546eb[_0x2895('0x2c')],'type':_0x5546eb[_0x2895('0x2d')][_0x2895('0x2e')]};});_0xa61689[_0x2895('0x2f')]=_['map'](_0x546514,_0x2895('0x26'));_0xa61689[_0x2895('0x30')]=_[_0x2895('0x31')](_0x190e07[_0x2895('0x30')]);_0xa61689[_0x2895('0x32')]=_['intersection'](_0xa61689['model'],_0xa61689[_0x2895('0x30')]);_0x14d150[_0x2895('0x33')]=_['intersection'](_0xa61689[_0x2895('0x2f')],qs['fields'](_0x190e07[_0x2895('0x30')][_0x2895('0x34')]));_0x14d150['attributes']=_0x14d150[_0x2895('0x33')]['length']?_0x14d150[_0x2895('0x33')]:_0xa61689['model'];if(!_0x190e07['query'][_0x2895('0x35')](_0x2895('0x36'))){_0x14d150[_0x2895('0x1a')]=qs['limit'](_0x190e07[_0x2895('0x30')][_0x2895('0x1a')]);_0x14d150[_0x2895('0x18')]=qs[_0x2895('0x18')](_0x190e07[_0x2895('0x30')][_0x2895('0x18')]);}_0x14d150[_0x2895('0x37')]=qs[_0x2895('0x38')](_0x190e07[_0x2895('0x30')][_0x2895('0x38')]);_0x14d150['where']=qs[_0x2895('0x32')](_[_0x2895('0x39')](_0x190e07[_0x2895('0x30')],_0xa61689[_0x2895('0x32')]),_0x546514);if(_0x190e07[_0x2895('0x30')][_0x2895('0x3a')]){_0x14d150[_0x2895('0x3b')]=_['merge'](_0x14d150['where'],{'$or':_[_0x2895('0x29')](_0x546514,function(_0x29dc63){if(_0x29dc63[_0x2895('0x2d')]!==_0x2895('0x3c')){var _0x21bf07={};_0x21bf07[_0x29dc63[_0x2895('0x26')]]={'$like':'%'+_0x190e07['query']['filter']+'%'};return _0x21bf07;}})});}_0x14d150=_[_0x2895('0x3d')]({},_0x14d150,_0x190e07[_0x2895('0x3e')]);var _0x5ce598={'where':_0x14d150['where']};return db[_0x2895('0x2a')][_0x2895('0x1b')](_0x5ce598)[_0x2895('0x21')](function(_0x28967f){_0x34e110[_0x2895('0x1b')]=_0x28967f;if(_0x190e07[_0x2895('0x30')]['includeAll']){_0x14d150[_0x2895('0x3f')]=[{'all':!![]}];}return db[_0x2895('0x2a')][_0x2895('0x40')](_0x14d150);})[_0x2895('0x21')](function(_0x4af6d6){_0x34e110[_0x2895('0x41')]=_0x4af6d6;return _0x34e110;})[_0x2895('0x21')](respondWithFilteredResult(_0x14e343,_0x14d150))[_0x2895('0x42')](handleError(_0x14e343,null));};exports[_0x2895('0x43')]=function(_0x564983,_0x4ef9fe){var _0x46580f={'raw':!![],'where':{'id':_0x564983[_0x2895('0x44')]['id']}},_0x19ce85={};_0x19ce85[_0x2895('0x2f')]=_[_0x2895('0x31')](db['ContactItemType']['rawAttributes']);_0x19ce85[_0x2895('0x30')]=_[_0x2895('0x31')](_0x564983[_0x2895('0x30')]);_0x19ce85[_0x2895('0x32')]=_[_0x2895('0x45')](_0x19ce85[_0x2895('0x2f')],_0x19ce85[_0x2895('0x30')]);_0x46580f['attributes']=_[_0x2895('0x45')](_0x19ce85[_0x2895('0x2f')],qs[_0x2895('0x34')](_0x564983[_0x2895('0x30')][_0x2895('0x34')]));_0x46580f[_0x2895('0x33')]=_0x46580f[_0x2895('0x33')][_0x2895('0x46')]?_0x46580f['attributes']:_0x19ce85[_0x2895('0x2f')];if(_0x564983[_0x2895('0x30')][_0x2895('0x47')]){_0x46580f['include']=[{'all':!![]}];}_0x46580f=_[_0x2895('0x3d')]({},_0x46580f,_0x564983[_0x2895('0x3e')]);return db['ContactItemType'][_0x2895('0x48')](_0x46580f)[_0x2895('0x21')](handleEntityNotFound(_0x4ef9fe,null))[_0x2895('0x21')](respondWithResult(_0x4ef9fe,null))[_0x2895('0x42')](handleError(_0x4ef9fe,null));};exports[_0x2895('0x49')]=function(_0x3cc331,_0x11e53a){return db['ContactItemType'][_0x2895('0x49')](_0x3cc331[_0x2895('0x4a')],{})['then'](function(_0x4e1d47){var _0x574839=_0x3cc331[_0x2895('0x4b')][_0x2895('0x22')]({'plain':!![]});if(!_0x574839)throw new Error(_0x2895('0x4c'));if(_0x574839[_0x2895('0x4d')]===_0x2895('0x4b')){var _0x3c5261=_0x4e1d47[_0x2895('0x22')]({'plain':!![]});var _0x7df911=_0x2895('0x23');return db[_0x2895('0x4e')][_0x2895('0x48')]({'where':{'name':_0x7df911,'userProfileId':_0x574839[_0x2895('0x4f')]},'raw':!![]})[_0x2895('0x21')](function(_0x1481f5){if(_0x1481f5&&_0x1481f5[_0x2895('0x50')]===0x0){return db[_0x2895('0x24')][_0x2895('0x49')]({'name':_0x3c5261[_0x2895('0x26')],'resourceId':_0x3c5261['id'],'type':_0x1481f5[_0x2895('0x26')],'sectionId':_0x1481f5['id']},{})[_0x2895('0x21')](function(){return _0x4e1d47;});}else{return _0x4e1d47;}})[_0x2895('0x42')](function(_0x90ed5d){logger[_0x2895('0x51')](_0x2895('0x52'),_0x90ed5d);throw _0x90ed5d;});}return _0x4e1d47;})[_0x2895('0x21')](respondWithResult(_0x11e53a,0xc9))[_0x2895('0x42')](handleError(_0x11e53a,null));};exports[_0x2895('0x20')]=function(_0x290ed7,_0xc9e24e){if(_0x290ed7[_0x2895('0x4a')]['id']){delete _0x290ed7[_0x2895('0x4a')]['id'];}return db['ContactItemType'][_0x2895('0x48')]({'where':{'id':_0x290ed7[_0x2895('0x44')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xc9e24e,null))[_0x2895('0x21')](saveUpdates(_0x290ed7[_0x2895('0x4a')],null))[_0x2895('0x21')](respondWithResult(_0xc9e24e,null))['catch'](handleError(_0xc9e24e,null));};exports[_0x2895('0x53')]=function(_0x5579b3,_0xc31867){return db[_0x2895('0x2a')][_0x2895('0x48')]({'where':{'id':_0x5579b3[_0x2895('0x44')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xc31867,null))['then'](db['CmContactHasItem'][_0x2895('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5579b3[_0x2895('0x44')]['id']}}))[_0x2895('0x21')](removeEntity(_0xc31867,null))['catch'](handleError(_0xc31867,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9edf0fa..71e477e 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca90=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x2842ea,_0x51922e){var _0x504ab7=function(_0x8cfe02){while(--_0x8cfe02){_0x2842ea['push'](_0x2842ea['shift']());}};_0x504ab7(++_0x51922e);}(_0xca90,0xf0));var _0x0ca9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xca90[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x0ca9('0x0'));var util=require(_0x0ca9('0x1'));var logger=require(_0x0ca9('0x2'))(_0x0ca9('0x3'));var moment=require('moment');var BPromise=require(_0x0ca9('0x4'));var rp=require(_0x0ca9('0x5'));var fs=require('fs');var path=require(_0x0ca9('0x6'));var rimraf=require(_0x0ca9('0x7'));var config=require(_0x0ca9('0x8'));var attributes=require(_0x0ca9('0x9'));module[_0x0ca9('0xa')]=function(_0x857af8,_0x20d15b){return _0x857af8[_0x0ca9('0xb')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0814=['ContactItemType','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3ae6aa,_0x53ad57){var _0xf24a3d=function(_0x43e3d9){while(--_0x43e3d9){_0x3ae6aa['push'](_0x3ae6aa['shift']());}};_0xf24a3d(++_0x53ad57);}(_0x0814,0x101));var _0x4081=function(_0x35f3e5,_0x675e6d){_0x35f3e5=_0x35f3e5-0x0;var _0x4bb53e=_0x0814[_0x35f3e5];return _0x4bb53e;};'use strict';var _=require(_0x4081('0x0'));var util=require(_0x4081('0x1'));var logger=require(_0x4081('0x2'))(_0x4081('0x3'));var moment=require(_0x4081('0x4'));var BPromise=require(_0x4081('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4081('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x23ee03,_0x5b8568){return _0x23ee03['define'](_0x4081('0x7'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 7f2a6e1..3db752f 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda44=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xda44,0x175));var _0x4da4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xda44[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x4da4('0x0'));var util=require(_0x4da4('0x1'));var moment=require(_0x4da4('0x2'));var BPromise=require(_0x4da4('0x3'));var rs=require(_0x4da4('0x4'));var fs=require('fs');var Redis=require(_0x4da4('0x5'));var db=require(_0x4da4('0x6'))['db'];var utils=require(_0x4da4('0x7'));var logger=require(_0x4da4('0x8'))(_0x4da4('0x9'));var config=require(_0x4da4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4da4('0xb')][_0x4da4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x195401,_0x1b94f6,_0x18e9c8){return new BPromise(function(_0x2d8335,_0x38c1a2){return client[_0x4da4('0xd')](_0x195401,_0x18e9c8)[_0x4da4('0xe')](function(_0x15c9ba){logger[_0x4da4('0xf')](_0x4da4('0x10'),_0x1b94f6,_0x4da4('0x11'));logger['debug'](_0x4da4('0x12'),_0x1b94f6,_0x4da4('0x11'),JSON[_0x4da4('0x13')](_0x15c9ba));if(_0x15c9ba[_0x4da4('0x14')]){if(_0x15c9ba['error'][_0x4da4('0x15')]===0x1f4){logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x15c9ba['error'][_0x4da4('0x16')]);return _0x38c1a2(_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);}logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);return _0x2d8335(_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);}else{logger[_0x4da4('0xf')](_0x4da4('0x10'),_0x1b94f6,_0x4da4('0x11'));_0x2d8335(_0x15c9ba[_0x4da4('0x17')][_0x4da4('0x16')]);}})['catch'](function(_0x531ce5){logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x531ce5);_0x38c1a2(_0x531ce5);});});} \ No newline at end of file +var _0x6b24=['client','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6b24,0x1ce));var _0x46b2=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x6b24[_0x5c14f6];return _0x4949b3;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512905,_0x326eb7,_0x233ccf){return new BPromise(function(_0x1f81b8,_0x1531c){return client[_0x46b2('0x7')](_0x512905,_0x233ccf)[_0x46b2('0x8')](function(_0x3144df){logger[_0x46b2('0x9')](_0x46b2('0xa'),_0x326eb7,'request\x20sent');logger['debug'](_0x46b2('0xb'),_0x326eb7,_0x46b2('0xc'),JSON[_0x46b2('0xd')](_0x3144df));if(_0x3144df['error']){if(_0x3144df[_0x46b2('0xe')][_0x46b2('0xf')]===0x1f4){logger[_0x46b2('0xe')]('ContactItemType,\x20%s,\x20%s',_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1531c(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1f81b8(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}else{logger['info'](_0x46b2('0xa'),_0x326eb7,_0x46b2('0xc'));_0x1f81b8(_0x3144df['result'][_0x46b2('0x10')]);}})[_0x46b2('0x11')](function(_0xe3d3d9){logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0xe3d3d9);_0x1531c(_0xe3d3d9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5ac37b8..7cf5d85 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3a1=['connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','post','delete','destroy','multer','util','path'];(function(_0x4a8089,_0x48dcc7){var _0xe5ffa2=function(_0x54bc59){while(--_0x54bc59){_0x4a8089['push'](_0x4a8089['shift']());}};_0xe5ffa2(++_0x48dcc7);}(_0xb3a1,0xf9));var _0x1b3a=function(_0x23f877,_0x3494f3){_0x23f877=_0x23f877-0x0;var _0x39f573=_0xb3a1[_0x23f877];return _0x39f573;};'use strict';var multer=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var path=require(_0x1b3a('0x2'));var timeout=require(_0x1b3a('0x3'));var express=require(_0x1b3a('0x4'));var router=express[_0x1b3a('0x5')]();var fs_extra=require(_0x1b3a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x1b3a('0x7')]('/',auth[_0x1b3a('0x8')](),controller[_0x1b3a('0x9')]);router[_0x1b3a('0x7')](_0x1b3a('0xa'),auth[_0x1b3a('0x8')](),controller['show']);router[_0x1b3a('0xb')]('/',auth[_0x1b3a('0x8')](),controller['create']);router['put'](_0x1b3a('0xa'),auth[_0x1b3a('0x8')](),controller['update']);router[_0x1b3a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1b3a('0xd')]);module['exports']=router; \ No newline at end of file +var _0x873e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./contactItemType.controller','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x873e,0xc6));var _0xe873=function(_0x5d0fee,_0x44be15){_0x5d0fee=_0x5d0fee-0x0;var _0x1ade06=_0x873e[_0x5d0fee];return _0x1ade06;};'use strict';var multer=require('multer');var util=require(_0xe873('0x0'));var path=require(_0xe873('0x1'));var timeout=require(_0xe873('0x2'));var express=require(_0xe873('0x3'));var router=express[_0xe873('0x4')]();var fs_extra=require(_0xe873('0x5'));var auth=require(_0xe873('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe873('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe873('0x8')]);router['get'](_0xe873('0x9'),auth[_0xe873('0xa')](),controller[_0xe873('0xb')]);router[_0xe873('0xc')]('/',auth[_0xe873('0xa')](),controller[_0xe873('0xd')]);router[_0xe873('0xe')]('/:id',auth[_0xe873('0xa')](),controller['update']);router[_0xe873('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe873('0x10')]);module[_0xe873('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b3a35a7..eda03b1 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 _0xe706=['STRING','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe706,0xa3));var _0x6e70=function(_0x5e8b46,_0x21eb4a){_0x5e8b46=_0x5e8b46-0x0;var _0x252814=_0xe706[_0x5e8b46];return _0x252814;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x5405bf,_0x596521){var _0x562c8a=function(_0x20517c){while(--_0x20517c){_0x5405bf['push'](_0x5405bf['shift']());}};_0x562c8a(++_0x596521);}(_0x2032,0xd9));var _0x2203=function(_0x452dfd,_0x3927f1){_0x452dfd=_0x452dfd-0x0;var _0x32bd57=_0x2032[_0x452dfd];return _0x32bd57;};'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 f6ce081..c93ddd1 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 _0x9a6c=['widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','then','get','CustomDashboards','destroy','end','error','name','index','map','Dashboard','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','rawAttributes','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh'];(function(_0x173b28,_0xbdee46){var _0x6ee86b=function(_0x2f1ac3){while(--_0x2f1ac3){_0x173b28['push'](_0x173b28['shift']());}};_0x6ee86b(++_0xbdee46);}(_0x9a6c,0x87));var _0xc9a6=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9a6c[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9a6('0x0'));var zipdir=require(_0xc9a6('0x1'));var jsonpatch=require(_0xc9a6('0x2'));var rp=require('request-promise');var moment=require(_0xc9a6('0x3'));var BPromise=require(_0xc9a6('0x4'));var Mustache=require(_0xc9a6('0x5'));var util=require(_0xc9a6('0x6'));var path=require(_0xc9a6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc9a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9a6('0x9'));var squel=require(_0xc9a6('0xa'));var crypto=require(_0xc9a6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9a6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9a6('0xd'));var authService=require(_0xc9a6('0xe'));var qs=require(_0xc9a6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9a6('0x10'));var logger=require(_0xc9a6('0x11'))(_0xc9a6('0x12'));var utils=require('../../config/utils');var config=require(_0xc9a6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9a6('0x14'))['db'];config[_0xc9a6('0x15')]=_[_0xc9a6('0x16')](config[_0xc9a6('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9a6('0x17'))(new Redis(config[_0xc9a6('0x15')]));require(_0xc9a6('0x18'))[_0xc9a6('0x19')](socket);function respondWithStatusCode(_0x28225d,_0x4df461){_0x4df461=_0x4df461||0xcc;return function(_0x56153b){if(_0x56153b){return _0x28225d[_0xc9a6('0x1a')](_0x4df461);}return _0x28225d['status'](_0x4df461)['end']();};}function respondWithResult(_0x3ccf9e,_0xed2a72){_0xed2a72=_0xed2a72||0xc8;return function(_0x4af99b){if(_0x4af99b){return _0x3ccf9e['status'](_0xed2a72)[_0xc9a6('0x1b')](_0x4af99b);}};}function respondWithFilteredResult(_0x29e99d,_0x4a785c){return function(_0x273c6e){if(_0x273c6e){var _0x24e7f8=typeof _0x4a785c[_0xc9a6('0x1c')]===_0xc9a6('0x1d')&&typeof _0x4a785c[_0xc9a6('0x1e')]===_0xc9a6('0x1d');var _0x268501=_0x273c6e['count'];var _0x139662=_0x24e7f8?0x0:_0x4a785c[_0xc9a6('0x1c')];var _0x53aecf=_0x24e7f8?_0x273c6e[_0xc9a6('0x1f')]:_0x4a785c[_0xc9a6('0x1c')]+_0x4a785c['limit'];var _0x5c4a44;if(_0x53aecf>=_0x268501){_0x53aecf=_0x268501;_0x5c4a44=0xc8;}else{_0x5c4a44=0xce;}_0x29e99d[_0xc9a6('0x20')](_0x5c4a44);return _0x29e99d[_0xc9a6('0x21')]('Content-Range',_0x139662+'-'+_0x53aecf+'/'+_0x268501)['json'](_0x273c6e);}return null;};}function patchUpdates(_0x5d4498){return function(_0x32fa78){try{jsonpatch[_0xc9a6('0x22')](_0x32fa78,_0x5d4498,!![]);}catch(_0x424ad1){return BPromise[_0xc9a6('0x23')](_0x424ad1);}return _0x32fa78[_0xc9a6('0x24')]();};}function saveUpdates(_0x31774e,_0x5508e0){return function(_0x2f14e5){if(_0x2f14e5){return _0x2f14e5['update'](_0x31774e)[_0xc9a6('0x25')](function(_0x2fd923){return _0x2fd923;});}return null;};}function removeEntity(_0x53f617,_0x57a8c2){return function(_0x460d58){if(_0x460d58){return _0x460d58['destroy']()['then'](function(){var _0x59cee7=_0x460d58[_0xc9a6('0x26')]({'plain':!![]});var _0x44eea9=_0xc9a6('0x27');return db['UserProfileResource'][_0xc9a6('0x28')]({'where':{'type':_0x44eea9,'resourceId':_0x59cee7['id']}})[_0xc9a6('0x25')](function(){return _0x460d58;});})[_0xc9a6('0x25')](function(){_0x53f617[_0xc9a6('0x20')](0xcc)[_0xc9a6('0x29')]();});}};}function handleEntityNotFound(_0x4f7252,_0x1ab835){return function(_0x56d3fa){if(!_0x56d3fa){_0x4f7252[_0xc9a6('0x1a')](0x194);}return _0x56d3fa;};}function handleError(_0x3814e5,_0x1b6fa3){_0x1b6fa3=_0x1b6fa3||0x1f4;return function(_0x2c7308){logger[_0xc9a6('0x2a')](_0x2c7308['stack']);if(_0x2c7308[_0xc9a6('0x2b')]){delete _0x2c7308['name'];}_0x3814e5['status'](_0x1b6fa3)['send'](_0x2c7308);};}exports[_0xc9a6('0x2c')]=function(_0x540e95,_0x10e434){var _0x4ac138={},_0x510800={},_0x1b9e12={'count':0x0,'rows':[]};var _0x327878=_[_0xc9a6('0x2d')](db[_0xc9a6('0x2e')]['rawAttributes'],function(_0x3832f0){return{'name':_0x3832f0[_0xc9a6('0x2f')],'type':_0x3832f0[_0xc9a6('0x30')]['key']};});_0x510800[_0xc9a6('0x31')]=_['map'](_0x327878,_0xc9a6('0x2b'));_0x510800[_0xc9a6('0x32')]=_[_0xc9a6('0x33')](_0x540e95['query']);_0x510800[_0xc9a6('0x34')]=_[_0xc9a6('0x35')](_0x510800[_0xc9a6('0x31')],_0x510800['query']);_0x4ac138[_0xc9a6('0x36')]=_[_0xc9a6('0x35')](_0x510800['model'],qs[_0xc9a6('0x37')](_0x540e95['query'][_0xc9a6('0x37')]));_0x4ac138['attributes']=_0x4ac138[_0xc9a6('0x36')][_0xc9a6('0x38')]?_0x4ac138[_0xc9a6('0x36')]:_0x510800[_0xc9a6('0x31')];if(!_0x540e95[_0xc9a6('0x32')][_0xc9a6('0x39')]('nolimit')){_0x4ac138[_0xc9a6('0x1e')]=qs[_0xc9a6('0x1e')](_0x540e95[_0xc9a6('0x32')][_0xc9a6('0x1e')]);_0x4ac138[_0xc9a6('0x1c')]=qs[_0xc9a6('0x1c')](_0x540e95[_0xc9a6('0x32')][_0xc9a6('0x1c')]);}_0x4ac138[_0xc9a6('0x3a')]=qs['sort'](_0x540e95['query'][_0xc9a6('0x3b')]);_0x4ac138[_0xc9a6('0x3c')]=qs[_0xc9a6('0x34')](_[_0xc9a6('0x3d')](_0x540e95[_0xc9a6('0x32')],_0x510800[_0xc9a6('0x34')]),_0x327878);if(_0x540e95[_0xc9a6('0x32')]['filter']){_0x4ac138['where']=_[_0xc9a6('0x3e')](_0x4ac138[_0xc9a6('0x3c')],{'$or':_[_0xc9a6('0x2d')](_0x327878,function(_0x2dcfbe){if(_0x2dcfbe[_0xc9a6('0x30')]!=='VIRTUAL'){var _0x42b557={};_0x42b557[_0x2dcfbe['name']]={'$like':'%'+_0x540e95['query'][_0xc9a6('0x3f')]+'%'};return _0x42b557;}})});}_0x4ac138=_[_0xc9a6('0x3e')]({},_0x4ac138,_0x540e95[_0xc9a6('0x40')]);var _0x589ab4={'where':_0x4ac138[_0xc9a6('0x3c')]};return db['Dashboard'][_0xc9a6('0x1f')](_0x589ab4)['then'](function(_0x35307f){_0x1b9e12[_0xc9a6('0x1f')]=_0x35307f;if(_0x540e95[_0xc9a6('0x32')][_0xc9a6('0x41')]){_0x4ac138[_0xc9a6('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0xc9a6('0x43')](_0x4ac138);})['then'](function(_0x3edb9a){_0x1b9e12[_0xc9a6('0x44')]=_0x3edb9a;return _0x1b9e12;})[_0xc9a6('0x25')](respondWithFilteredResult(_0x10e434,_0x4ac138))[_0xc9a6('0x45')](handleError(_0x10e434,null));};exports[_0xc9a6('0x46')]=function(_0x4d13b5,_0x19fec9){var _0x5a0e47={'raw':![],'where':{'id':_0x4d13b5[_0xc9a6('0x47')]['id']}},_0x1e28ac={};_0x1e28ac[_0xc9a6('0x31')]=_['keys'](db['Dashboard']['rawAttributes']);_0x1e28ac[_0xc9a6('0x32')]=_['keys'](_0x4d13b5[_0xc9a6('0x32')]);_0x1e28ac[_0xc9a6('0x34')]=_[_0xc9a6('0x35')](_0x1e28ac['model'],_0x1e28ac[_0xc9a6('0x32')]);_0x5a0e47[_0xc9a6('0x36')]=_[_0xc9a6('0x35')](_0x1e28ac['model'],qs[_0xc9a6('0x37')](_0x4d13b5['query'][_0xc9a6('0x37')]));_0x5a0e47[_0xc9a6('0x36')]=_0x5a0e47[_0xc9a6('0x36')][_0xc9a6('0x38')]?_0x5a0e47[_0xc9a6('0x36')]:_0x1e28ac[_0xc9a6('0x31')];if(_0x4d13b5[_0xc9a6('0x32')][_0xc9a6('0x41')]){_0x5a0e47[_0xc9a6('0x42')]=[{'all':!![]}];}_0x5a0e47=_[_0xc9a6('0x3e')]({},_0x5a0e47,_0x4d13b5[_0xc9a6('0x40')]);return db[_0xc9a6('0x2e')][_0xc9a6('0x48')](_0x5a0e47)['then'](handleEntityNotFound(_0x19fec9,null))['then'](respondWithResult(_0x19fec9,null))['catch'](handleError(_0x19fec9,null));};exports[_0xc9a6('0x49')]=function(_0x35dd75,_0x231fca){return db[_0xc9a6('0x2e')][_0xc9a6('0x49')](_0x35dd75[_0xc9a6('0x4a')],{})['then'](function(_0x1584d9){var _0x16b3f8=_0x35dd75['user'][_0xc9a6('0x26')]({'plain':!![]});if(!_0x16b3f8)throw new Error(_0xc9a6('0x4b'));if(_0x16b3f8[_0xc9a6('0x4c')]===_0xc9a6('0x4d')){var _0x33fcad=_0x1584d9[_0xc9a6('0x26')]({'plain':!![]});var _0x6706cf=_0xc9a6('0x27');return db[_0xc9a6('0x4e')][_0xc9a6('0x48')]({'where':{'name':_0x6706cf,'userProfileId':_0x16b3f8[_0xc9a6('0x4f')]},'raw':!![]})['then'](function(_0x2ab18c){if(_0x2ab18c&&_0x2ab18c[_0xc9a6('0x50')]===0x0){return db[_0xc9a6('0x51')][_0xc9a6('0x49')]({'name':_0x33fcad[_0xc9a6('0x2b')],'resourceId':_0x33fcad['id'],'type':_0x2ab18c[_0xc9a6('0x2b')],'sectionId':_0x2ab18c['id']},{})[_0xc9a6('0x25')](function(){return _0x1584d9;});}else{return _0x1584d9;}})['catch'](function(_0x2f22eb){logger[_0xc9a6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f22eb);throw _0x2f22eb;});}return _0x1584d9;})['then'](respondWithResult(_0x231fca,0xc9))[_0xc9a6('0x45')](handleError(_0x231fca,null));};exports[_0xc9a6('0x52')]=function(_0x2254a6,_0x583847){var _0x20298f={'where':{'id':_0x2254a6['params']['id']}},_0x319512={};_0x319512[_0xc9a6('0x31')]=_[_0xc9a6('0x33')](db[_0xc9a6('0x2e')][_0xc9a6('0x53')]);_0x20298f[_0xc9a6('0x36')]=_[_0xc9a6('0x35')](_0x319512['model'],qs[_0xc9a6('0x37')](_0x2254a6[_0xc9a6('0x32')]['fields']));_0x20298f[_0xc9a6('0x36')]=_0x20298f[_0xc9a6('0x36')][_0xc9a6('0x38')]?_0x20298f['attributes']:_0x319512['model'];if(_0x2254a6[_0xc9a6('0x32')][_0xc9a6('0x41')]){_0x20298f['include']=[{'all':!![]}];}_0x20298f=_[_0xc9a6('0x3e')]({},_0x20298f,_0x2254a6[_0xc9a6('0x40')]);return db[_0xc9a6('0x2e')][_0xc9a6('0x48')](_0x20298f)[_0xc9a6('0x25')](handleEntityNotFound(_0x583847,null))[_0xc9a6('0x25')](function(_0x57223b){if(_0x57223b){var _0x2ec605=_0x57223b['get']({'plain':!![]});_0x2ec605=qs[_0xc9a6('0x54')](_0x2ec605,['id','createdAt',_0xc9a6('0x55')]);_0x2254a6[_0xc9a6('0x4a')]=_[_0xc9a6('0x54')](_0x2254a6[_0xc9a6('0x4a')],['id','createdAt',_0xc9a6('0x55')]);return db[_0xc9a6('0x2e')]['create'](_['merge'](_0x2ec605,_0x2254a6['body']),{'include':_0x2254a6[_0xc9a6('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xc9a6('0x25')](function(_0x26e350){var _0x195d2f=_0x2254a6[_0xc9a6('0x4d')][_0xc9a6('0x26')]({'plain':!![]});if(!_0x195d2f)throw new Error(_0xc9a6('0x4b'));if(_0x195d2f[_0xc9a6('0x4c')]==='user'){var _0x1eb114=_0x26e350['get']({'plain':!![]});var _0x2cb2e2=_0xc9a6('0x27');return db[_0xc9a6('0x4e')][_0xc9a6('0x48')]({'where':{'name':_0x2cb2e2,'userProfileId':_0x195d2f[_0xc9a6('0x4f')]},'raw':!![]})[_0xc9a6('0x25')](function(_0x40efc5){if(_0x40efc5&&_0x40efc5[_0xc9a6('0x50')]===0x0){return db[_0xc9a6('0x51')][_0xc9a6('0x49')]({'name':_0x1eb114[_0xc9a6('0x2b')],'resourceId':_0x1eb114['id'],'type':_0x40efc5['name'],'sectionId':_0x40efc5['id']},{})[_0xc9a6('0x25')](function(){return _0x26e350;});}else{return _0x26e350;}})[_0xc9a6('0x45')](function(_0x30f84c){logger[_0xc9a6('0x2a')](_0xc9a6('0x56'),_0x30f84c);throw _0x30f84c;});}return _0x26e350;});}})[_0xc9a6('0x25')](respondWithResult(_0x583847,0xc9))['catch'](handleError(_0x583847,null));};exports['update']=function(_0x27702a,_0x136d08){if(_0x27702a['body']['id']){delete _0x27702a[_0xc9a6('0x4a')]['id'];}return db['Dashboard'][_0xc9a6('0x48')]({'where':{'id':_0x27702a[_0xc9a6('0x47')]['id']}})[_0xc9a6('0x25')](handleEntityNotFound(_0x136d08,null))['then'](saveUpdates(_0x27702a[_0xc9a6('0x4a')],null))['then'](respondWithResult(_0x136d08,null))['catch'](handleError(_0x136d08,null));};exports[_0xc9a6('0x28')]=function(_0x3e6904,_0x437551){return db[_0xc9a6('0x2e')][_0xc9a6('0x48')]({'where':{'id':_0x3e6904[_0xc9a6('0x47')]['id']}})[_0xc9a6('0x25')](handleEntityNotFound(_0x437551,null))[_0xc9a6('0x25')](removeEntity(_0x437551,null))['catch'](handleError(_0x437551,null));};function widgetAttributes(_0x541e0f){try{switch(_0x541e0f[_0xc9a6('0x30')]){case _0xc9a6('0x57'):return[{'name':_0xc9a6('0x58'),'value':_0x541e0f[_0xc9a6('0x58')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f[_0xc9a6('0x59')][0x0][_0xc9a6('0x5a')]:undefined)||_0xc9a6('0x5b')}];case _0xc9a6('0x5c'):return[{'name':_0xc9a6('0x5d'),'value':_0x541e0f['attrPath']||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f[_0xc9a6('0x59')][0x0][_0xc9a6('0x5a')]:undefined)||''}];case _0xc9a6('0x5e'):return[{'name':_0xc9a6('0x5f'),'value':_0x541e0f[_0xc9a6('0x5f')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f[_0xc9a6('0x59')][0x0]['value']:undefined)||_0xc9a6('0x60')},{'name':_0xc9a6('0x61'),'value':_0x541e0f[_0xc9a6('0x61')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x1]?_0x541e0f[_0xc9a6('0x59')][0x1]['value']:undefined)||_0xc9a6('0x62')},{'name':_0xc9a6('0x63'),'value':_0x541e0f[_0xc9a6('0x63')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x2]?_0x541e0f['attrs'][0x2][_0xc9a6('0x5a')]:undefined)||0xc}];case'counter':return[{'name':_0xc9a6('0x64'),'value':_0x541e0f[_0xc9a6('0x64')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f[_0xc9a6('0x59')][0x0]['value']:undefined)||_0xc9a6('0x65')},{'name':'attrVoiceQueues','value':_0x541e0f[_0xc9a6('0x66')]||(_0x541e0f['attrs']&&_0x541e0f[_0xc9a6('0x59')][0x1]?_0x541e0f[_0xc9a6('0x59')][0x1][_0xc9a6('0x5a')]:undefined)||[]},{'name':_0xc9a6('0x63'),'value':_0x541e0f[_0xc9a6('0x63')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x2]?_0x541e0f[_0xc9a6('0x59')][0x2][_0xc9a6('0x5a')]:undefined)||0x14},{'name':_0xc9a6('0x67'),'value':_0x541e0f[_0xc9a6('0x67')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x3]?_0x541e0f[_0xc9a6('0x59')][0x3][_0xc9a6('0x5a')]:undefined)||'voice'},{'name':_0xc9a6('0x68'),'value':_0x541e0f[_0xc9a6('0x68')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f['attrs'][0x4]?_0x541e0f['attrs'][0x4]['value']:undefined)||''},{'name':_0xc9a6('0x69'),'value':_0x541e0f[_0xc9a6('0x69')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f['attrs'][0x5]?_0x541e0f['attrs'][0x5][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6a'),'value':_0x541e0f[_0xc9a6('0x6a')]||(_0x541e0f['attrs']&&_0x541e0f[_0xc9a6('0x59')][0x6]?_0x541e0f[_0xc9a6('0x59')][0x6][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6b'),'value':_0x541e0f[_0xc9a6('0x6b')]||(_0x541e0f['attrs']&&_0x541e0f[_0xc9a6('0x59')][0x7]?_0x541e0f[_0xc9a6('0x59')][0x7][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6c'),'value':_0x541e0f[_0xc9a6('0x6c')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x8]?_0x541e0f[_0xc9a6('0x59')][0x8][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6d'),'value':_0x541e0f[_0xc9a6('0x6d')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x9]?_0x541e0f[_0xc9a6('0x59')][0x9]['value']:undefined)||''}];case _0xc9a6('0x6e'):case'pie-chart':return[{'name':_0xc9a6('0x6f'),'value':_0x541e0f[_0xc9a6('0x6f')]||(_0x541e0f['attrs']&&_0x541e0f['attrs'][0x0]?_0x541e0f['attrs'][0x0][_0xc9a6('0x5a')]:undefined)||_0xc9a6('0x65')},{'name':_0xc9a6('0x70'),'value':_0x541e0f[_0xc9a6('0x70')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x1]?_0x541e0f[_0xc9a6('0x59')][0x1][_0xc9a6('0x5a')]:undefined)||null},{'name':_0xc9a6('0x71'),'value':_0x541e0f[_0xc9a6('0x71')]||(_0x541e0f['attrs']&&_0x541e0f[_0xc9a6('0x59')][0x2]?_0x541e0f[_0xc9a6('0x59')][0x2][_0xc9a6('0x5a')]:undefined)||null},{'name':_0xc9a6('0x66'),'value':_0x541e0f[_0xc9a6('0x66')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x3]?_0x541e0f[_0xc9a6('0x59')][0x3]['value']:undefined)||[]},{'name':_0xc9a6('0x67'),'value':_0x541e0f[_0xc9a6('0x67')]||(_0x541e0f['attrs']&&_0x541e0f['attrs'][0x4]?_0x541e0f[_0xc9a6('0x59')][0x4][_0xc9a6('0x5a')]:undefined)||_0xc9a6('0x72')},{'name':'attrEmailAccounts','value':_0x541e0f['attrEmailAccounts']||(_0x541e0f['attrs']&&_0x541e0f[_0xc9a6('0x59')][0x5]?_0x541e0f['attrs'][0x5][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x69'),'value':_0x541e0f['attrFaxAccounts']||(_0x541e0f['attrs']&&_0x541e0f['attrs'][0x6]?_0x541e0f['attrs'][0x6][_0xc9a6('0x5a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x541e0f[_0xc9a6('0x6a')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x7]?_0x541e0f['attrs'][0x7][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6b'),'value':_0x541e0f[_0xc9a6('0x6b')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x8]?_0x541e0f[_0xc9a6('0x59')][0x8][_0xc9a6('0x5a')]:undefined)||''},{'name':_0xc9a6('0x6c'),'value':_0x541e0f['attrWhatsappAccounts']||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x9]?_0x541e0f[_0xc9a6('0x59')][0x9][_0xc9a6('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x541e0f[_0xc9a6('0x6d')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0xa]?_0x541e0f[_0xc9a6('0x59')][0xa]['value']:undefined)||''}];case _0xc9a6('0x73'):return[{'name':'attrReport','type':_0x541e0f[_0xc9a6('0x74')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f['attrs'][0x0][_0xc9a6('0x30')]:undefined)||null,'value':_0x541e0f[_0xc9a6('0x75')]||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x0]?_0x541e0f[_0xc9a6('0x59')][0x0]['value']:undefined)||null},{'name':_0xc9a6('0x76'),'value':_0x541e0f['attrRefresh']||(_0x541e0f[_0xc9a6('0x59')]&&_0x541e0f[_0xc9a6('0x59')][0x1]?_0x541e0f['attrs'][0x1][_0xc9a6('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0xff5dae){logger['error'](_0xc9a6('0x77'),JSON[_0xc9a6('0x78')](_0xff5dae));return[];}}exports[_0xc9a6('0x79')]=function(_0x554341,_0x3909c9,_0x7928df){if(_0x554341[_0xc9a6('0x4a')]['id']){delete _0x554341[_0xc9a6('0x4a')]['id'];}return db[_0xc9a6('0x2e')][_0xc9a6('0x48')]({'where':{'id':_0x554341['params']['id']}})[_0xc9a6('0x25')](handleEntityNotFound(_0x3909c9,null))[_0xc9a6('0x25')](function(_0x51d724){if(_0x51d724){_0x554341[_0xc9a6('0x4a')][_0xc9a6('0x7a')]=_0x51d724['id'];_0x554341[_0xc9a6('0x4a')][_0xc9a6('0x59')]=widgetAttributes(_0x554341[_0xc9a6('0x4a')]);return db[_0xc9a6('0x7b')]['create'](_0x554341[_0xc9a6('0x4a')]);}})[_0xc9a6('0x25')](respondWithResult(_0x3909c9,null))[_0xc9a6('0x45')](handleError(_0x3909c9,null));};exports[_0xc9a6('0x7c')]=function(_0x273c76,_0x5e828d,_0x1596e4){var _0x3792ba={};var _0x533755={};var _0x19d049;var _0x3796eb;return db['Dashboard'][_0xc9a6('0x7d')]({'where':{'id':_0x273c76[_0xc9a6('0x47')]['id']}})[_0xc9a6('0x25')](handleEntityNotFound(_0x5e828d,null))[_0xc9a6('0x25')](function(_0x221ee7){if(_0x221ee7){_0x19d049=_0x221ee7;_0x533755[_0xc9a6('0x31')]=_[_0xc9a6('0x33')](db[_0xc9a6('0x7b')][_0xc9a6('0x53')]);_0x533755[_0xc9a6('0x32')]=_['keys'](_0x273c76[_0xc9a6('0x32')]);_0x533755[_0xc9a6('0x34')]=_[_0xc9a6('0x35')](_0x533755[_0xc9a6('0x31')],_0x533755[_0xc9a6('0x32')]);_0x3792ba[_0xc9a6('0x36')]=_[_0xc9a6('0x35')](_0x533755['model'],qs[_0xc9a6('0x37')](_0x273c76[_0xc9a6('0x32')][_0xc9a6('0x37')]));_0x3792ba[_0xc9a6('0x36')]=_0x3792ba[_0xc9a6('0x36')][_0xc9a6('0x38')]?_0x3792ba[_0xc9a6('0x36')]:_0x533755['model'];_0x3792ba[_0xc9a6('0x3a')]=qs[_0xc9a6('0x3b')](_0x273c76[_0xc9a6('0x32')]['sort']);_0x3792ba[_0xc9a6('0x3c')]=qs['filters'](_[_0xc9a6('0x3d')](_0x273c76[_0xc9a6('0x32')],_0x533755[_0xc9a6('0x34')]));if(_0x273c76[_0xc9a6('0x32')][_0xc9a6('0x3f')]){_0x3792ba[_0xc9a6('0x3c')]=_[_0xc9a6('0x3e')](_0x3792ba[_0xc9a6('0x3c')],{'$or':_[_0xc9a6('0x2d')](_0x3792ba[_0xc9a6('0x36')],function(_0x2d87c9){var _0x470452={};_0x470452[_0x2d87c9]={'$like':'%'+_0x273c76['query'][_0xc9a6('0x3f')]+'%'};return _0x470452;})});}_0x3792ba=_[_0xc9a6('0x3e')]({},_0x3792ba,_0x273c76[_0xc9a6('0x40')]);return _0x19d049[_0xc9a6('0x7c')](_0x3792ba);}})[_0xc9a6('0x25')](function(_0x1210aa){if(_0x1210aa){_0x3796eb=_0x1210aa['length'];if(!_0x273c76[_0xc9a6('0x32')][_0xc9a6('0x39')](_0xc9a6('0x7e'))){_0x3792ba[_0xc9a6('0x1e')]=qs[_0xc9a6('0x1e')](_0x273c76['query'][_0xc9a6('0x1e')]);_0x3792ba[_0xc9a6('0x1c')]=qs['offset'](_0x273c76[_0xc9a6('0x32')][_0xc9a6('0x1c')]);}return _0x19d049[_0xc9a6('0x7c')](_0x3792ba);}})[_0xc9a6('0x25')](function(_0x2a4eb2){if(_0x2a4eb2){return _0x2a4eb2?{'count':_0x3796eb,'rows':_0x2a4eb2}:null;}})['then'](respondWithResult(_0x5e828d,null))[_0xc9a6('0x45')](handleError(_0x5e828d,null));}; \ No newline at end of file +var _0x1687=['catch','body','role','user','CustomDashboards','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','show','params','find'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1687,0xb1));var _0x7168=function(_0x339286,_0x5f5421){_0x339286=_0x339286-0x0;var _0x145abf=_0x1687[_0x339286];return _0x145abf;};'use strict';var emlformat=require(_0x7168('0x0'));var rimraf=require(_0x7168('0x1'));var zipdir=require(_0x7168('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7168('0x3'));var moment=require(_0x7168('0x4'));var BPromise=require(_0x7168('0x5'));var Mustache=require(_0x7168('0x6'));var util=require(_0x7168('0x7'));var path=require(_0x7168('0x8'));var sox=require(_0x7168('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7168('0xa'));var _=require('lodash');var squel=require(_0x7168('0xb'));var crypto=require(_0x7168('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7168('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7168('0xe'));var Papa=require(_0x7168('0xf'));var Redis=require(_0x7168('0x10'));var authService=require(_0x7168('0x11'));var qs=require(_0x7168('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7168('0x13'))('api');var utils=require(_0x7168('0x14'));var config=require(_0x7168('0x15'));var licenseUtil=require(_0x7168('0x16'));var db=require(_0x7168('0x17'))['db'];config[_0x7168('0x18')]=_[_0x7168('0x19')](config[_0x7168('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7168('0x1a'))(new Redis(config['redis']));require(_0x7168('0x1b'))[_0x7168('0x1c')](socket);function respondWithStatusCode(_0x423235,_0x58b8c9){_0x58b8c9=_0x58b8c9||0xcc;return function(_0x3a49da){if(_0x3a49da){return _0x423235[_0x7168('0x1d')](_0x58b8c9);}return _0x423235['status'](_0x58b8c9)[_0x7168('0x1e')]();};}function respondWithResult(_0x2eb94e,_0x2ab7af){_0x2ab7af=_0x2ab7af||0xc8;return function(_0x1b07c9){if(_0x1b07c9){return _0x2eb94e[_0x7168('0x1f')](_0x2ab7af)[_0x7168('0x20')](_0x1b07c9);}};}function respondWithFilteredResult(_0x4559ee,_0x38ab14){return function(_0x545f62){if(_0x545f62){var _0x1ba9dd=typeof _0x38ab14[_0x7168('0x21')]==='undefined'&&typeof _0x38ab14[_0x7168('0x22')]===_0x7168('0x23');var _0x63e2e5=_0x545f62[_0x7168('0x24')];var _0x47a361=_0x1ba9dd?0x0:_0x38ab14['offset'];var _0x32ae29=_0x1ba9dd?_0x545f62[_0x7168('0x24')]:_0x38ab14[_0x7168('0x21')]+_0x38ab14[_0x7168('0x22')];var _0x154f47;if(_0x32ae29>=_0x63e2e5){_0x32ae29=_0x63e2e5;_0x154f47=0xc8;}else{_0x154f47=0xce;}_0x4559ee[_0x7168('0x1f')](_0x154f47);return _0x4559ee['set']('Content-Range',_0x47a361+'-'+_0x32ae29+'/'+_0x63e2e5)[_0x7168('0x20')](_0x545f62);}return null;};}function patchUpdates(_0x501544){return function(_0x43558f){try{jsonpatch[_0x7168('0x25')](_0x43558f,_0x501544,!![]);}catch(_0x50adb4){return BPromise[_0x7168('0x26')](_0x50adb4);}return _0x43558f[_0x7168('0x27')]();};}function saveUpdates(_0x3f3457,_0x112e4f){return function(_0x342b42){if(_0x342b42){return _0x342b42['update'](_0x3f3457)[_0x7168('0x28')](function(_0x1127e7){return _0x1127e7;});}return null;};}function removeEntity(_0x46b570,_0x8ce6ac){return function(_0x1a2ba2){if(_0x1a2ba2){return _0x1a2ba2[_0x7168('0x29')]()[_0x7168('0x28')](function(){var _0x3471e2=_0x1a2ba2[_0x7168('0x2a')]({'plain':!![]});var _0x41fa20='CustomDashboards';return db[_0x7168('0x2b')][_0x7168('0x29')]({'where':{'type':_0x41fa20,'resourceId':_0x3471e2['id']}})[_0x7168('0x28')](function(){return _0x1a2ba2;});})[_0x7168('0x28')](function(){_0x46b570[_0x7168('0x1f')](0xcc)[_0x7168('0x1e')]();});}};}function handleEntityNotFound(_0x162442,_0x145313){return function(_0x5b1584){if(!_0x5b1584){_0x162442[_0x7168('0x1d')](0x194);}return _0x5b1584;};}function handleError(_0x1a8fab,_0x4f81c3){_0x4f81c3=_0x4f81c3||0x1f4;return function(_0x580565){logger[_0x7168('0x2c')](_0x580565[_0x7168('0x2d')]);if(_0x580565[_0x7168('0x2e')]){delete _0x580565[_0x7168('0x2e')];}_0x1a8fab['status'](_0x4f81c3)['send'](_0x580565);};}exports['index']=function(_0x4de884,_0x223c79){var _0x89f2b={},_0x206ac8={},_0x95d546={'count':0x0,'rows':[]};var _0x1fb296=_[_0x7168('0x2f')](db[_0x7168('0x30')][_0x7168('0x31')],function(_0x51d8b0){return{'name':_0x51d8b0[_0x7168('0x32')],'type':_0x51d8b0[_0x7168('0x33')]['key']};});_0x206ac8[_0x7168('0x34')]=_[_0x7168('0x2f')](_0x1fb296,_0x7168('0x2e'));_0x206ac8[_0x7168('0x35')]=_[_0x7168('0x36')](_0x4de884[_0x7168('0x35')]);_0x206ac8[_0x7168('0x37')]=_[_0x7168('0x38')](_0x206ac8[_0x7168('0x34')],_0x206ac8['query']);_0x89f2b[_0x7168('0x39')]=_[_0x7168('0x38')](_0x206ac8['model'],qs[_0x7168('0x3a')](_0x4de884[_0x7168('0x35')][_0x7168('0x3a')]));_0x89f2b[_0x7168('0x39')]=_0x89f2b[_0x7168('0x39')][_0x7168('0x3b')]?_0x89f2b[_0x7168('0x39')]:_0x206ac8['model'];if(!_0x4de884[_0x7168('0x35')][_0x7168('0x3c')](_0x7168('0x3d'))){_0x89f2b[_0x7168('0x22')]=qs[_0x7168('0x22')](_0x4de884[_0x7168('0x35')]['limit']);_0x89f2b[_0x7168('0x21')]=qs[_0x7168('0x21')](_0x4de884[_0x7168('0x35')][_0x7168('0x21')]);}_0x89f2b['order']=qs[_0x7168('0x3e')](_0x4de884['query'][_0x7168('0x3e')]);_0x89f2b[_0x7168('0x3f')]=qs[_0x7168('0x37')](_[_0x7168('0x40')](_0x4de884['query'],_0x206ac8[_0x7168('0x37')]),_0x1fb296);if(_0x4de884[_0x7168('0x35')]['filter']){_0x89f2b['where']=_['merge'](_0x89f2b[_0x7168('0x3f')],{'$or':_['map'](_0x1fb296,function(_0x1add9c){if(_0x1add9c[_0x7168('0x33')]!==_0x7168('0x41')){var _0x572e7d={};_0x572e7d[_0x1add9c[_0x7168('0x2e')]]={'$like':'%'+_0x4de884[_0x7168('0x35')]['filter']+'%'};return _0x572e7d;}})});}_0x89f2b=_[_0x7168('0x42')]({},_0x89f2b,_0x4de884[_0x7168('0x43')]);var _0x3c8ba0={'where':_0x89f2b[_0x7168('0x3f')]};return db[_0x7168('0x30')]['count'](_0x3c8ba0)[_0x7168('0x28')](function(_0x2c944e){_0x95d546[_0x7168('0x24')]=_0x2c944e;if(_0x4de884[_0x7168('0x35')][_0x7168('0x44')]){_0x89f2b[_0x7168('0x45')]=[{'all':!![]}];}return db[_0x7168('0x30')]['findAll'](_0x89f2b);})[_0x7168('0x28')](function(_0x18810c){_0x95d546['rows']=_0x18810c;return _0x95d546;})[_0x7168('0x28')](respondWithFilteredResult(_0x223c79,_0x89f2b))['catch'](handleError(_0x223c79,null));};exports[_0x7168('0x46')]=function(_0x121ad2,_0x2a3d1c){var _0x2d113={'raw':![],'where':{'id':_0x121ad2[_0x7168('0x47')]['id']}},_0x1a69d1={};_0x1a69d1[_0x7168('0x34')]=_[_0x7168('0x36')](db[_0x7168('0x30')][_0x7168('0x31')]);_0x1a69d1[_0x7168('0x35')]=_[_0x7168('0x36')](_0x121ad2[_0x7168('0x35')]);_0x1a69d1['filters']=_[_0x7168('0x38')](_0x1a69d1['model'],_0x1a69d1[_0x7168('0x35')]);_0x2d113[_0x7168('0x39')]=_[_0x7168('0x38')](_0x1a69d1['model'],qs[_0x7168('0x3a')](_0x121ad2[_0x7168('0x35')][_0x7168('0x3a')]));_0x2d113['attributes']=_0x2d113[_0x7168('0x39')][_0x7168('0x3b')]?_0x2d113['attributes']:_0x1a69d1[_0x7168('0x34')];if(_0x121ad2[_0x7168('0x35')][_0x7168('0x44')]){_0x2d113[_0x7168('0x45')]=[{'all':!![]}];}_0x2d113=_['merge']({},_0x2d113,_0x121ad2[_0x7168('0x43')]);return db[_0x7168('0x30')][_0x7168('0x48')](_0x2d113)[_0x7168('0x28')](handleEntityNotFound(_0x2a3d1c,null))['then'](respondWithResult(_0x2a3d1c,null))[_0x7168('0x49')](handleError(_0x2a3d1c,null));};exports['create']=function(_0x40a161,_0x30b2b0){return db[_0x7168('0x30')]['create'](_0x40a161[_0x7168('0x4a')],{})['then'](function(_0x395bd7){var _0x1499a2=_0x40a161['user']['get']({'plain':!![]});if(!_0x1499a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1499a2[_0x7168('0x4b')]===_0x7168('0x4c')){var _0x3357ce=_0x395bd7[_0x7168('0x2a')]({'plain':!![]});var _0x3ede52=_0x7168('0x4d');return db[_0x7168('0x4e')][_0x7168('0x48')]({'where':{'name':_0x3ede52,'userProfileId':_0x1499a2['userProfileId']},'raw':!![]})[_0x7168('0x28')](function(_0x4a23cb){if(_0x4a23cb&&_0x4a23cb[_0x7168('0x4f')]===0x0){return db['UserProfileResource'][_0x7168('0x50')]({'name':_0x3357ce['name'],'resourceId':_0x3357ce['id'],'type':_0x4a23cb['name'],'sectionId':_0x4a23cb['id']},{})[_0x7168('0x28')](function(){return _0x395bd7;});}else{return _0x395bd7;}})['catch'](function(_0x25f710){logger[_0x7168('0x2c')](_0x7168('0x51'),_0x25f710);throw _0x25f710;});}return _0x395bd7;})[_0x7168('0x28')](respondWithResult(_0x30b2b0,0xc9))[_0x7168('0x49')](handleError(_0x30b2b0,null));};exports[_0x7168('0x52')]=function(_0x3fb18e,_0x21a481){var _0x26b630={'where':{'id':_0x3fb18e[_0x7168('0x47')]['id']}},_0x3322a7={};_0x3322a7[_0x7168('0x34')]=_[_0x7168('0x36')](db[_0x7168('0x30')][_0x7168('0x31')]);_0x26b630[_0x7168('0x39')]=_[_0x7168('0x38')](_0x3322a7['model'],qs[_0x7168('0x3a')](_0x3fb18e['query'][_0x7168('0x3a')]));_0x26b630[_0x7168('0x39')]=_0x26b630['attributes'][_0x7168('0x3b')]?_0x26b630[_0x7168('0x39')]:_0x3322a7[_0x7168('0x34')];if(_0x3fb18e[_0x7168('0x35')]['includeAll']){_0x26b630['include']=[{'all':!![]}];}_0x26b630=_[_0x7168('0x42')]({},_0x26b630,_0x3fb18e[_0x7168('0x43')]);return db[_0x7168('0x30')]['find'](_0x26b630)[_0x7168('0x28')](handleEntityNotFound(_0x21a481,null))[_0x7168('0x28')](function(_0x12a421){if(_0x12a421){var _0x45985d=_0x12a421['get']({'plain':!![]});_0x45985d=qs[_0x7168('0x53')](_0x45985d,['id',_0x7168('0x54'),_0x7168('0x55')]);_0x3fb18e[_0x7168('0x4a')]=_['omit'](_0x3fb18e['body'],['id','createdAt',_0x7168('0x55')]);return db[_0x7168('0x30')][_0x7168('0x50')](_[_0x7168('0x42')](_0x45985d,_0x3fb18e['body']),{'include':_0x3fb18e[_0x7168('0x35')][_0x7168('0x44')]?[{'all':!![]}]:undefined})[_0x7168('0x28')](function(_0x248444){var _0x593480=_0x3fb18e['user']['get']({'plain':!![]});if(!_0x593480)throw new Error(_0x7168('0x56'));if(_0x593480[_0x7168('0x4b')]===_0x7168('0x4c')){var _0x1b9f88=_0x248444[_0x7168('0x2a')]({'plain':!![]});var _0x26569b=_0x7168('0x4d');return db[_0x7168('0x4e')][_0x7168('0x48')]({'where':{'name':_0x26569b,'userProfileId':_0x593480['userProfileId']},'raw':!![]})[_0x7168('0x28')](function(_0x2afc5b){if(_0x2afc5b&&_0x2afc5b[_0x7168('0x4f')]===0x0){return db[_0x7168('0x2b')][_0x7168('0x50')]({'name':_0x1b9f88['name'],'resourceId':_0x1b9f88['id'],'type':_0x2afc5b[_0x7168('0x2e')],'sectionId':_0x2afc5b['id']},{})[_0x7168('0x28')](function(){return _0x248444;});}else{return _0x248444;}})[_0x7168('0x49')](function(_0x27cfe8){logger[_0x7168('0x2c')](_0x7168('0x51'),_0x27cfe8);throw _0x27cfe8;});}return _0x248444;});}})[_0x7168('0x28')](respondWithResult(_0x21a481,0xc9))[_0x7168('0x49')](handleError(_0x21a481,null));};exports[_0x7168('0x57')]=function(_0x1909e9,_0x45ac96){if(_0x1909e9['body']['id']){delete _0x1909e9[_0x7168('0x4a')]['id'];}return db[_0x7168('0x30')][_0x7168('0x48')]({'where':{'id':_0x1909e9[_0x7168('0x47')]['id']}})[_0x7168('0x28')](handleEntityNotFound(_0x45ac96,null))[_0x7168('0x28')](saveUpdates(_0x1909e9[_0x7168('0x4a')],null))[_0x7168('0x28')](respondWithResult(_0x45ac96,null))[_0x7168('0x49')](handleError(_0x45ac96,null));};exports['destroy']=function(_0x58d41b,_0x2564da){return db['Dashboard'][_0x7168('0x48')]({'where':{'id':_0x58d41b[_0x7168('0x47')]['id']}})[_0x7168('0x28')](handleEntityNotFound(_0x2564da,null))[_0x7168('0x28')](removeEntity(_0x2564da,null))['catch'](handleError(_0x2564da,null));};function widgetAttributes(_0x77c640){try{switch(_0x77c640[_0x7168('0x33')]){case _0x7168('0x58'):return[{'name':_0x7168('0x59'),'value':_0x77c640[_0x7168('0x59')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640[_0x7168('0x5a')][0x0][_0x7168('0x5b')]:undefined)||'https://'}];case _0x7168('0x5c'):return[{'name':_0x7168('0x5d'),'value':_0x77c640[_0x7168('0x5d')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640[_0x7168('0x5a')][0x0]['value']:undefined)||''}];case _0x7168('0x5e'):return[{'name':'attrHourFormat','value':_0x77c640['attrHourFormat']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640[_0x7168('0x5a')][0x0][_0x7168('0x5b')]:undefined)||_0x7168('0x5f')},{'name':_0x7168('0x60'),'value':_0x77c640[_0x7168('0x60')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x1]?_0x77c640[_0x7168('0x5a')][0x1][_0x7168('0x5b')]:undefined)||_0x7168('0x61')},{'name':'attrFontSize','value':_0x77c640['attrFontSize']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x2]?_0x77c640['attrs'][0x2][_0x7168('0x5b')]:undefined)||0xc}];case _0x7168('0x62'):return[{'name':_0x7168('0x63'),'value':_0x77c640[_0x7168('0x63')]||(_0x77c640['attrs']&&_0x77c640['attrs'][0x0]?_0x77c640[_0x7168('0x5a')][0x0][_0x7168('0x5b')]:undefined)||_0x7168('0x64')},{'name':_0x7168('0x65'),'value':_0x77c640['attrVoiceQueues']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x1]?_0x77c640[_0x7168('0x5a')][0x1][_0x7168('0x5b')]:undefined)||[]},{'name':_0x7168('0x66'),'value':_0x77c640[_0x7168('0x66')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640['attrs'][0x2]?_0x77c640[_0x7168('0x5a')][0x2][_0x7168('0x5b')]:undefined)||0x14},{'name':'attrChannel','value':_0x77c640[_0x7168('0x67')]||(_0x77c640['attrs']&&_0x77c640[_0x7168('0x5a')][0x3]?_0x77c640['attrs'][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x77c640[_0x7168('0x68')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x4]?_0x77c640[_0x7168('0x5a')][0x4][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x69'),'value':_0x77c640[_0x7168('0x69')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x5]?_0x77c640['attrs'][0x5][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x6a'),'value':_0x77c640['attrSmsAccounts']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x6]?_0x77c640[_0x7168('0x5a')][0x6][_0x7168('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x77c640[_0x7168('0x6b')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x7]?_0x77c640[_0x7168('0x5a')][0x7]['value']:undefined)||''},{'name':_0x7168('0x6c'),'value':_0x77c640[_0x7168('0x6c')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x8]?_0x77c640['attrs'][0x8][_0x7168('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x77c640['attrChatWebsites']||(_0x77c640['attrs']&&_0x77c640[_0x7168('0x5a')][0x9]?_0x77c640[_0x7168('0x5a')][0x9][_0x7168('0x5b')]:undefined)||''}];case'multibar-chart':case _0x7168('0x6d'):return[{'name':_0x7168('0x6e'),'value':_0x77c640['attrSerie1']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640['attrs'][0x0][_0x7168('0x5b')]:undefined)||_0x7168('0x64')},{'name':'attrSerie2','value':_0x77c640[_0x7168('0x6f')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640['attrs'][0x1]?_0x77c640[_0x7168('0x5a')][0x1][_0x7168('0x5b')]:undefined)||null},{'name':_0x7168('0x70'),'value':_0x77c640[_0x7168('0x70')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x2]?_0x77c640[_0x7168('0x5a')][0x2]['value']:undefined)||null},{'name':_0x7168('0x65'),'value':_0x77c640[_0x7168('0x65')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640['attrs'][0x3]?_0x77c640[_0x7168('0x5a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x77c640[_0x7168('0x67')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x4]?_0x77c640['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x7168('0x68'),'value':_0x77c640['attrEmailAccounts']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x5]?_0x77c640['attrs'][0x5][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x69'),'value':_0x77c640[_0x7168('0x69')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640['attrs'][0x6]?_0x77c640[_0x7168('0x5a')][0x6][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x6a'),'value':_0x77c640[_0x7168('0x6a')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640['attrs'][0x7]?_0x77c640[_0x7168('0x5a')][0x7][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x6b'),'value':_0x77c640['attrOpenchannelAccounts']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x8]?_0x77c640[_0x7168('0x5a')][0x8][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x6c'),'value':_0x77c640[_0x7168('0x6c')]||(_0x77c640['attrs']&&_0x77c640[_0x7168('0x5a')][0x9]?_0x77c640[_0x7168('0x5a')][0x9][_0x7168('0x5b')]:undefined)||''},{'name':_0x7168('0x71'),'value':_0x77c640['attrChatWebsites']||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0xa]?_0x77c640[_0x7168('0x5a')][0xa][_0x7168('0x5b')]:undefined)||''}];case _0x7168('0x72'):return[{'name':'attrReport','type':_0x77c640[_0x7168('0x73')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640[_0x7168('0x5a')][0x0][_0x7168('0x33')]:undefined)||null,'value':_0x77c640[_0x7168('0x74')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x0]?_0x77c640['attrs'][0x0][_0x7168('0x5b')]:undefined)||null},{'name':_0x7168('0x75'),'value':_0x77c640[_0x7168('0x75')]||(_0x77c640[_0x7168('0x5a')]&&_0x77c640[_0x7168('0x5a')][0x1]?_0x77c640[_0x7168('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x23ec14){logger[_0x7168('0x2c')](_0x7168('0x76'),JSON[_0x7168('0x77')](_0x23ec14));return[];}}exports[_0x7168('0x78')]=function(_0x4d94e2,_0x262800,_0x432916){if(_0x4d94e2[_0x7168('0x4a')]['id']){delete _0x4d94e2['body']['id'];}return db[_0x7168('0x30')][_0x7168('0x48')]({'where':{'id':_0x4d94e2['params']['id']}})[_0x7168('0x28')](handleEntityNotFound(_0x262800,null))[_0x7168('0x28')](function(_0x20bd47){if(_0x20bd47){_0x4d94e2[_0x7168('0x4a')][_0x7168('0x79')]=_0x20bd47['id'];_0x4d94e2['body']['attrs']=widgetAttributes(_0x4d94e2[_0x7168('0x4a')]);return db['DashboardItem'][_0x7168('0x50')](_0x4d94e2[_0x7168('0x4a')]);}})[_0x7168('0x28')](respondWithResult(_0x262800,null))[_0x7168('0x49')](handleError(_0x262800,null));};exports[_0x7168('0x7a')]=function(_0x20b573,_0x50e024,_0x5758c7){var _0x5def3d={};var _0x2ef6f6={};var _0x5bb7d9;var _0x4ab68f;return db[_0x7168('0x30')]['findOne']({'where':{'id':_0x20b573[_0x7168('0x47')]['id']}})['then'](handleEntityNotFound(_0x50e024,null))[_0x7168('0x28')](function(_0x5946ec){if(_0x5946ec){_0x5bb7d9=_0x5946ec;_0x2ef6f6[_0x7168('0x34')]=_['keys'](db[_0x7168('0x7b')][_0x7168('0x31')]);_0x2ef6f6[_0x7168('0x35')]=_[_0x7168('0x36')](_0x20b573['query']);_0x2ef6f6['filters']=_[_0x7168('0x38')](_0x2ef6f6[_0x7168('0x34')],_0x2ef6f6['query']);_0x5def3d['attributes']=_[_0x7168('0x38')](_0x2ef6f6['model'],qs['fields'](_0x20b573[_0x7168('0x35')][_0x7168('0x3a')]));_0x5def3d['attributes']=_0x5def3d[_0x7168('0x39')]['length']?_0x5def3d[_0x7168('0x39')]:_0x2ef6f6[_0x7168('0x34')];_0x5def3d['order']=qs[_0x7168('0x3e')](_0x20b573['query'][_0x7168('0x3e')]);_0x5def3d[_0x7168('0x3f')]=qs[_0x7168('0x37')](_[_0x7168('0x40')](_0x20b573[_0x7168('0x35')],_0x2ef6f6[_0x7168('0x37')]));if(_0x20b573[_0x7168('0x35')][_0x7168('0x7c')]){_0x5def3d[_0x7168('0x3f')]=_['merge'](_0x5def3d[_0x7168('0x3f')],{'$or':_[_0x7168('0x2f')](_0x5def3d['attributes'],function(_0x3938be){var _0x3dce05={};_0x3dce05[_0x3938be]={'$like':'%'+_0x20b573[_0x7168('0x35')][_0x7168('0x7c')]+'%'};return _0x3dce05;})});}_0x5def3d=_[_0x7168('0x42')]({},_0x5def3d,_0x20b573['options']);return _0x5bb7d9['getItems'](_0x5def3d);}})['then'](function(_0x5aaec0){if(_0x5aaec0){_0x4ab68f=_0x5aaec0[_0x7168('0x3b')];if(!_0x20b573['query'][_0x7168('0x3c')](_0x7168('0x3d'))){_0x5def3d[_0x7168('0x22')]=qs[_0x7168('0x22')](_0x20b573[_0x7168('0x35')][_0x7168('0x22')]);_0x5def3d[_0x7168('0x21')]=qs[_0x7168('0x21')](_0x20b573['query'][_0x7168('0x21')]);}return _0x5bb7d9[_0x7168('0x7a')](_0x5def3d);}})[_0x7168('0x28')](function(_0xf522bd){if(_0xf522bd){return _0xf522bd?{'count':_0x4ab68f,'rows':_0xf522bd}:null;}})[_0x7168('0x28')](respondWithResult(_0x50e024,null))[_0x7168('0x49')](handleError(_0x50e024,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 086991a..3c1f953 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 _0x1107=['events','../../mysqldb','Dashboard','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x356486,_0x15902f){var _0xf2cec1=function(_0x2a4534){while(--_0x2a4534){_0x356486['push'](_0x356486['shift']());}};_0xf2cec1(++_0x15902f);}(_0x1107,0xd8));var _0x7110=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x1107[_0x2cfb58];return _0xd99951;};'use strict';var EventEmitter=require(_0x7110('0x0'));var Dashboard=require(_0x7110('0x1'))['db'][_0x7110('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7110('0x3'),'afterDestroy':_0x7110('0x4')};function emitEvent(_0x5a5e14){return function(_0x250d85,_0x422095,_0x436cc3){DashboardEvents[_0x7110('0x5')](_0x5a5e14+':'+_0x250d85['id'],_0x250d85);DashboardEvents[_0x7110('0x5')](_0x5a5e14,_0x250d85);_0x436cc3(null);};}for(var e in events){if(events[_0x7110('0x6')](e)){var event=events[e];Dashboard[_0x7110('0x7')](e,emitEvent(event));}}module[_0x7110('0x8')]=DashboardEvents; \ No newline at end of file +var _0x2fd5=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2fd5,0x182));var _0x52fd=function(_0xd4cf96,_0x392cbd){_0xd4cf96=_0xd4cf96-0x0;var _0x1d15ce=_0x2fd5[_0xd4cf96];return _0x1d15ce;};'use strict';var EventEmitter=require(_0x52fd('0x0'));var Dashboard=require(_0x52fd('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x52fd('0x2'),'afterUpdate':_0x52fd('0x3'),'afterDestroy':_0x52fd('0x4')};function emitEvent(_0x4c4224){return function(_0x1a578e,_0x37f446,_0x4f8c8a){DashboardEvents[_0x52fd('0x5')](_0x4c4224+':'+_0x1a578e['id'],_0x1a578e);DashboardEvents[_0x52fd('0x5')](_0x4c4224,_0x1a578e);_0x4f8c8a(null);};}for(var e in events){if(events[_0x52fd('0x6')](e)){var event=events[e];Dashboard[_0x52fd('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 4703830..b8a40d1 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 _0xe211=['exports','define','Dashboard','dashboards','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x4d8198,_0x396bc9){var _0x505d08=function(_0xb93b9){while(--_0xb93b9){_0x4d8198['push'](_0x4d8198['shift']());}};_0x505d08(++_0x396bc9);}(_0xe211,0xfb));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var logger=require('../../config/logger')(_0x1e21('0x2'));var moment=require(_0x1e21('0x3'));var BPromise=require(_0x1e21('0x4'));var rp=require(_0x1e21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e21('0x6'));var config=require(_0x1e21('0x7'));var attributes=require(_0x1e21('0x8'));module[_0x1e21('0x9')]=function(_0x21df74,_0x14f996){return _0x21df74[_0x1e21('0xa')](_0x1e21('0xb'),attributes,{'tableName':_0x1e21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4181=['../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4181,0x101));var _0x1418=function(_0x3b031d,_0x3b1b70){_0x3b031d=_0x3b031d-0x0;var _0x412fa1=_0x4181[_0x3b031d];return _0x412fa1;};'use strict';var _=require(_0x1418('0x0'));var util=require(_0x1418('0x1'));var logger=require(_0x1418('0x2'))(_0x1418('0x3'));var moment=require('moment');var BPromise=require(_0x1418('0x4'));var rp=require(_0x1418('0x5'));var fs=require('fs');var path=require(_0x1418('0x6'));var rimraf=require('rimraf');var config=require(_0x1418('0x7'));var attributes=require(_0x1418('0x8'));module[_0x1418('0x9')]=function(_0x591405,_0x5967cb){return _0x591405['define'](_0x1418('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 1b4f61f..43d452a 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 _0xf01f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf01f,0x1bd));var _0xff01=function(_0x1ce27c,_0x5305dc){_0x1ce27c=_0x1ce27c-0x0;var _0x524482=_0xf01f[_0x1ce27c];return _0x524482;};'use strict';var _=require('lodash');var util=require(_0xff01('0x0'));var moment=require(_0xff01('0x1'));var BPromise=require(_0xff01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff01('0x3'))['db'];var utils=require(_0xff01('0x4'));var logger=require('../../config/logger')(_0xff01('0x5'));var config=require(_0xff01('0x6'));var jayson=require(_0xff01('0x7'));var client=jayson[_0xff01('0x8')][_0xff01('0x9')]({'port':0x232a});config[_0xff01('0xa')]=_[_0xff01('0xb')](config['redis'],{'host':_0xff01('0xc'),'port':0x18eb});var socket=require(_0xff01('0xd'))(new Redis(config[_0xff01('0xa')]));require(_0xff01('0xe'))['register'](socket);function respondWithRpcPromise(_0x34f187,_0x458356,_0x1a712c){return new BPromise(function(_0x4d6b36,_0x5dc57a){return client[_0xff01('0xf')](_0x34f187,_0x1a712c)[_0xff01('0x10')](function(_0x3f3967){logger[_0xff01('0x11')](_0xff01('0x12'),_0x458356,_0xff01('0x13'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x458356,_0xff01('0x13'),JSON['stringify'](_0x3f3967));if(_0x3f3967['error']){if(_0x3f3967[_0xff01('0x14')][_0xff01('0x15')]===0x1f4){logger[_0xff01('0x14')](_0xff01('0x12'),_0x458356,_0x3f3967[_0xff01('0x14')][_0xff01('0x16')]);return _0x5dc57a(_0x3f3967['error'][_0xff01('0x16')]);}logger[_0xff01('0x14')](_0xff01('0x12'),_0x458356,_0x3f3967[_0xff01('0x14')][_0xff01('0x16')]);return _0x4d6b36(_0x3f3967[_0xff01('0x14')][_0xff01('0x16')]);}else{logger[_0xff01('0x11')]('Dashboard,\x20%s,\x20%s',_0x458356,_0xff01('0x13'));_0x4d6b36(_0x3f3967[_0xff01('0x17')][_0xff01('0x16')]);}})[_0xff01('0x18')](function(_0x519d74){logger[_0xff01('0x14')](_0xff01('0x12'),_0x458356,_0x519d74);_0x5dc57a(_0x519d74);});});} \ No newline at end of file +var _0xf2c4=['stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x50f1d6,_0x21491b){var _0x33e074=function(_0x315ab2){while(--_0x315ab2){_0x50f1d6['push'](_0x50f1d6['shift']());}};_0x33e074(++_0x21491b);}(_0xf2c4,0xa6));var _0x4f2c=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xf2c4[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x4f2c('0x0'));var util=require(_0x4f2c('0x1'));var moment=require('moment');var BPromise=require(_0x4f2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f2c('0x3'));var db=require(_0x4f2c('0x4'))['db'];var utils=require(_0x4f2c('0x5'));var logger=require('../../config/logger')(_0x4f2c('0x6'));var config=require(_0x4f2c('0x7'));var jayson=require(_0x4f2c('0x8'));var client=jayson[_0x4f2c('0x9')][_0x4f2c('0xa')]({'port':0x232a});config[_0x4f2c('0xb')]=_[_0x4f2c('0xc')](config[_0x4f2c('0xb')],{'host':_0x4f2c('0xd'),'port':0x18eb});var socket=require(_0x4f2c('0xe'))(new Redis(config[_0x4f2c('0xb')]));require(_0x4f2c('0xf'))[_0x4f2c('0x10')](socket);function respondWithRpcPromise(_0x11b9f2,_0xf03af,_0x2b0826){return new BPromise(function(_0x51f096,_0x372ba1){return client[_0x4f2c('0x11')](_0x11b9f2,_0x2b0826)['then'](function(_0x183cdd){logger[_0x4f2c('0x12')](_0x4f2c('0x13'),_0xf03af,_0x4f2c('0x14'));logger[_0x4f2c('0x15')](_0x4f2c('0x16'),_0xf03af,'request\x20sent',JSON[_0x4f2c('0x17')](_0x183cdd));if(_0x183cdd[_0x4f2c('0x18')]){if(_0x183cdd[_0x4f2c('0x18')]['code']===0x1f4){logger[_0x4f2c('0x18')]('Dashboard,\x20%s,\x20%s',_0xf03af,_0x183cdd[_0x4f2c('0x18')][_0x4f2c('0x19')]);return _0x372ba1(_0x183cdd[_0x4f2c('0x18')][_0x4f2c('0x19')]);}logger[_0x4f2c('0x18')](_0x4f2c('0x13'),_0xf03af,_0x183cdd[_0x4f2c('0x18')][_0x4f2c('0x19')]);return _0x51f096(_0x183cdd[_0x4f2c('0x18')]['message']);}else{logger[_0x4f2c('0x12')](_0x4f2c('0x13'),_0xf03af,_0x4f2c('0x14'));_0x51f096(_0x183cdd[_0x4f2c('0x1a')][_0x4f2c('0x19')]);}})['catch'](function(_0x4c8769){logger['error']('Dashboard,\x20%s,\x20%s',_0xf03af,_0x4c8769);_0x372ba1(_0x4c8769);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bbbcacb..436015e 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 _0x0674=['register','length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x56e2ed,_0x1c4781){var _0x5237b2=function(_0x587150){while(--_0x587150){_0x56e2ed['push'](_0x56e2ed['shift']());}};_0x5237b2(++_0x1c4781);}(_0x0674,0x11a));var _0x4067=function(_0x78a04e,_0x512271){_0x78a04e=_0x78a04e-0x0;var _0x55b61d=_0x0674[_0x78a04e];return _0x55b61d;};'use strict';var DashboardEvents=require(_0x4067('0x0'));var events=[_0x4067('0x1'),_0x4067('0x2'),_0x4067('0x3')];function createListener(_0xb8a7c1,_0xce4529){return function(_0x4f2086){_0xce4529[_0x4067('0x4')](_0xb8a7c1,_0x4f2086);};}function removeListener(_0x3ce8b1,_0x2ef62a){return function(){DashboardEvents[_0x4067('0x5')](_0x3ce8b1,_0x2ef62a);};}exports[_0x4067('0x6')]=function(_0x5e70f1){for(var _0x3d66e5=0x0,_0x388a3b=events[_0x4067('0x7')];_0x3d66e5<_0x388a3b;_0x3d66e5++){var _0x3b9ad1=events[_0x3d66e5];var _0x3266b6=createListener(_0x4067('0x8')+_0x3b9ad1,_0x5e70f1);DashboardEvents['on'](_0x3b9ad1,_0x3266b6);}}; \ No newline at end of file +var _0x888e=['./dashboard.events','save','update','emit','removeListener','register','dashboard:'];(function(_0x55529e,_0x525112){var _0x1b443e=function(_0xc05d5c){while(--_0xc05d5c){_0x55529e['push'](_0x55529e['shift']());}};_0x1b443e(++_0x525112);}(_0x888e,0x1a4));var _0xe888=function(_0x32e8f5,_0x5a8cd1){_0x32e8f5=_0x32e8f5-0x0;var _0x28be04=_0x888e[_0x32e8f5];return _0x28be04;};'use strict';var DashboardEvents=require(_0xe888('0x0'));var events=[_0xe888('0x1'),'remove',_0xe888('0x2')];function createListener(_0x4da19b,_0x1222d6){return function(_0x133b97){_0x1222d6[_0xe888('0x3')](_0x4da19b,_0x133b97);};}function removeListener(_0x543246,_0x4f11f0){return function(){DashboardEvents[_0xe888('0x4')](_0x543246,_0x4f11f0);};}exports[_0xe888('0x5')]=function(_0xae20cb){for(var _0x47db83=0x0,_0xec6211=events['length'];_0x47db83<_0xec6211;_0x47db83++){var _0x4b4060=events[_0x47db83];var _0x2bb466=createListener(_0xe888('0x6')+_0x4b4060,_0xae20cb);DashboardEvents['on'](_0x4b4060,_0x2bb466);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index fd8efc0..99013a7 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 _0xd05b=['create','clone','addItem','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post'];(function(_0x3aa2ae,_0xd21e98){var _0x50f84c=function(_0x514776){while(--_0x514776){_0x3aa2ae['push'](_0x3aa2ae['shift']());}};_0x50f84c(++_0xd21e98);}(_0xd05b,0xfa));var _0xbd05=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd05b[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xbd05('0x0'));var util=require(_0xbd05('0x1'));var path=require('path');var timeout=require(_0xbd05('0x2'));var express=require('express');var router=express[_0xbd05('0x3')]();var fs_extra=require(_0xbd05('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd05('0x5'));var controller=require(_0xbd05('0x6'));router[_0xbd05('0x7')]('/',auth[_0xbd05('0x8')](),controller[_0xbd05('0x9')]);router[_0xbd05('0x7')]('/:id',auth[_0xbd05('0x8')](),controller[_0xbd05('0xa')]);router[_0xbd05('0x7')](_0xbd05('0xb'),auth[_0xbd05('0x8')](),controller[_0xbd05('0xc')]);router[_0xbd05('0xd')]('/',auth[_0xbd05('0x8')](),controller[_0xbd05('0xe')]);router['post']('/:id/clone',auth[_0xbd05('0x8')](),controller[_0xbd05('0xf')]);router['post'](_0xbd05('0xb'),auth['isAuthenticated'](),controller[_0xbd05('0x10')]);router[_0xbd05('0x11')](_0xbd05('0x12'),auth[_0xbd05('0x8')](),controller['update']);router[_0xbd05('0x13')](_0xbd05('0x12'),auth['isAuthenticated'](),controller[_0xbd05('0x14')]);module[_0xbd05('0x15')]=router; \ No newline at end of file +var _0xe9cd=['/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./dashboard.controller','isAuthenticated','get','/:id','show','/:id/items','getItems','post'];(function(_0x3e7674,_0x1aed65){var _0x637051=function(_0x5b5272){while(--_0x5b5272){_0x3e7674['push'](_0x3e7674['shift']());}};_0x637051(++_0x1aed65);}(_0xe9cd,0xee));var _0xde9c=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xe9cd[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xde9c('0x0'));var util=require(_0xde9c('0x1'));var path=require(_0xde9c('0x2'));var timeout=require(_0xde9c('0x3'));var express=require(_0xde9c('0x4'));var router=express[_0xde9c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde9c('0x6'));var config=require('../../config/environment');var controller=require(_0xde9c('0x7'));router['get']('/',auth[_0xde9c('0x8')](),controller['index']);router[_0xde9c('0x9')](_0xde9c('0xa'),auth[_0xde9c('0x8')](),controller[_0xde9c('0xb')]);router['get'](_0xde9c('0xc'),auth[_0xde9c('0x8')](),controller[_0xde9c('0xd')]);router[_0xde9c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xde9c('0xe')](_0xde9c('0xf'),auth[_0xde9c('0x8')](),controller[_0xde9c('0x10')]);router[_0xde9c('0xe')](_0xde9c('0xc'),auth[_0xde9c('0x8')](),controller[_0xde9c('0x11')]);router[_0xde9c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xde9c('0x13')]);router[_0xde9c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xde9c('0x15')]);module[_0xde9c('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5615359..d9ca397 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 _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xacf4,0xe7));var _0x4acf=function(_0x52edd0,_0x7319dc){_0x52edd0=_0x52edd0-0x0;var _0x42b12a=_0xacf4[_0x52edd0];return _0x42b12a;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x1967,0x173));var _0x7196=function(_0x5b2316,_0x444ed4){_0x5b2316=_0x5b2316-0x0;var _0x159a5e=_0x1967[_0x5b2316];return _0x159a5e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7196('0x0'));var _=require(_0x7196('0x1'));module[_0x7196('0x2')]={'title':{'type':Sequelize[_0x7196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x5')),'get':function(){try{return JSON[_0x7196('0x6')](this[_0x7196('0x7')](_0x7196('0x8')));}catch(_0x5c128f){return[];}},'set':function(_0x36b01e){try{this[_0x7196('0x9')](_0x7196('0x8'),JSON[_0x7196('0xa')](_0x36b01e));}catch(_0x266a6e){this[_0x7196('0x9')]('attrs',JSON[_0x7196('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7196('0xb')]},'col':{'type':Sequelize[_0x7196('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7196('0x3')],'allowNull':![],'defaultValue':_0x7196('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7196('0x3')]},'titleFontSize':{'type':Sequelize[_0x7196('0xb')],'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 fc0cf1e..58e72aa 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 _0x576b=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','show','params','keys','DashboardItem','rawAttributes','filters','intersection','model','query','attributes','fields','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x21e651,_0x4dbf7a){var _0x459170=function(_0x55b9c2){while(--_0x55b9c2){_0x21e651['push'](_0x21e651['shift']());}};_0x459170(++_0x4dbf7a);}(_0x576b,0x1d9));var _0xb576=function(_0x32ab7d,_0xf5abf6){_0x32ab7d=_0x32ab7d-0x0;var _0x54fe39=_0x576b[_0x32ab7d];return _0x54fe39;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb576('0x0'));var rp=require(_0xb576('0x1'));var moment=require('moment');var BPromise=require(_0xb576('0x2'));var Mustache=require(_0xb576('0x3'));var util=require('util');var path=require(_0xb576('0x4'));var sox=require(_0xb576('0x5'));var csv=require(_0xb576('0x6'));var ejs=require(_0xb576('0x7'));var fs=require('fs');var fs_extra=require(_0xb576('0x8'));var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require(_0xb576('0x6'));var querystring=require(_0xb576('0xe'));var Papa=require(_0xb576('0xf'));var Redis=require(_0xb576('0x10'));var authService=require(_0xb576('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb576('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb576('0x13'))(_0xb576('0x14'));var utils=require(_0xb576('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb576('0x16'))['db'];config[_0xb576('0x17')]=_[_0xb576('0x18')](config[_0xb576('0x17')],{'host':_0xb576('0x19'),'port':0x18eb});var socket=require(_0xb576('0x1a'))(new Redis(config[_0xb576('0x17')]));require(_0xb576('0x1b'))[_0xb576('0x1c')](socket);function respondWithStatusCode(_0x1791f0,_0x5aecc1){_0x5aecc1=_0x5aecc1||0xcc;return function(_0x5f4ab9){if(_0x5f4ab9){return _0x1791f0['sendStatus'](_0x5aecc1);}return _0x1791f0[_0xb576('0x1d')](_0x5aecc1)[_0xb576('0x1e')]();};}function respondWithResult(_0x18cd64,_0x1be7b0){_0x1be7b0=_0x1be7b0||0xc8;return function(_0x463fb2){if(_0x463fb2){return _0x18cd64[_0xb576('0x1d')](_0x1be7b0)['json'](_0x463fb2);}};}function respondWithFilteredResult(_0x91d029,_0x2bf599){return function(_0x5406c9){if(_0x5406c9){var _0x52a0ca=typeof _0x2bf599[_0xb576('0x1f')]===_0xb576('0x20')&&typeof _0x2bf599[_0xb576('0x21')]==='undefined';var _0x4e8677=_0x5406c9['count'];var _0x432e41=_0x52a0ca?0x0:_0x2bf599['offset'];var _0x587480=_0x52a0ca?_0x5406c9[_0xb576('0x22')]:_0x2bf599[_0xb576('0x1f')]+_0x2bf599[_0xb576('0x21')];var _0x2a95a3;if(_0x587480>=_0x4e8677){_0x587480=_0x4e8677;_0x2a95a3=0xc8;}else{_0x2a95a3=0xce;}_0x91d029['status'](_0x2a95a3);return _0x91d029[_0xb576('0x23')](_0xb576('0x24'),_0x432e41+'-'+_0x587480+'/'+_0x4e8677)[_0xb576('0x25')](_0x5406c9);}return null;};}function patchUpdates(_0x2295ed){return function(_0x1bb2c9){try{jsonpatch[_0xb576('0x26')](_0x1bb2c9,_0x2295ed,!![]);}catch(_0x2b6074){return BPromise[_0xb576('0x27')](_0x2b6074);}return _0x1bb2c9[_0xb576('0x28')]();};}function saveUpdates(_0x189c32,_0x3e748a){return function(_0xcc4605){if(_0xcc4605){return _0xcc4605[_0xb576('0x29')](_0x189c32)[_0xb576('0x2a')](function(_0x5c343f){return _0x5c343f;});}return null;};}function removeEntity(_0x456648,_0xa0be5e){return function(_0x1e858d){if(_0x1e858d){return _0x1e858d[_0xb576('0x2b')]()[_0xb576('0x2a')](function(){_0x456648[_0xb576('0x1d')](0xcc)[_0xb576('0x1e')]();});}};}function handleEntityNotFound(_0x535bb9,_0x30d966){return function(_0x6cd45e){if(!_0x6cd45e){_0x535bb9[_0xb576('0x2c')](0x194);}return _0x6cd45e;};}function handleError(_0x3e47a7,_0x18e36f){_0x18e36f=_0x18e36f||0x1f4;return function(_0x592dfc){logger[_0xb576('0x2d')](_0x592dfc['stack']);if(_0x592dfc[_0xb576('0x2e')]){delete _0x592dfc[_0xb576('0x2e')];}_0x3e47a7[_0xb576('0x1d')](_0x18e36f)[_0xb576('0x2f')](_0x592dfc);};}exports[_0xb576('0x30')]=function(_0x4ca597,_0x1be38b){var _0x5e3860={'raw':![],'where':{'id':_0x4ca597[_0xb576('0x31')]['id']}},_0x2f4e6c={};_0x2f4e6c['model']=_[_0xb576('0x32')](db[_0xb576('0x33')][_0xb576('0x34')]);_0x2f4e6c['query']=_['keys'](_0x4ca597['query']);_0x2f4e6c[_0xb576('0x35')]=_[_0xb576('0x36')](_0x2f4e6c[_0xb576('0x37')],_0x2f4e6c[_0xb576('0x38')]);_0x5e3860[_0xb576('0x39')]=_[_0xb576('0x36')](_0x2f4e6c[_0xb576('0x37')],qs[_0xb576('0x3a')](_0x4ca597[_0xb576('0x38')]['fields']));_0x5e3860[_0xb576('0x39')]=_0x5e3860['attributes']['length']?_0x5e3860[_0xb576('0x39')]:_0x2f4e6c[_0xb576('0x37')];if(_0x4ca597[_0xb576('0x38')]['includeAll']){_0x5e3860[_0xb576('0x3b')]=[{'all':!![]}];}_0x5e3860=_[_0xb576('0x3c')]({},_0x5e3860,_0x4ca597['options']);return db[_0xb576('0x33')][_0xb576('0x3d')](_0x5e3860)[_0xb576('0x2a')](handleEntityNotFound(_0x1be38b,null))[_0xb576('0x2a')](respondWithResult(_0x1be38b,null))[_0xb576('0x3e')](handleError(_0x1be38b,null));};exports[_0xb576('0x2b')]=function(_0xe4afbc,_0x368a80){return db[_0xb576('0x33')][_0xb576('0x3d')]({'where':{'id':_0xe4afbc[_0xb576('0x31')]['id']}})['then'](handleEntityNotFound(_0x368a80,null))['then'](removeEntity(_0x368a80,null))[_0xb576('0x3e')](handleError(_0x368a80,null));};function widgetAttributes(_0x5f4452){try{switch(_0x5f4452[_0xb576('0x3f')]){case _0xb576('0x40'):return[{'name':_0xb576('0x41'),'value':_0x5f4452[_0xb576('0x41')]||(_0x5f4452['attrs']&&_0x5f4452[_0xb576('0x42')][0x0]?_0x5f4452['attrs'][0x0][_0xb576('0x43')]:undefined)||_0xb576('0x44')}];case _0xb576('0x45'):return[{'name':'attrPath','value':_0x5f4452[_0xb576('0x46')]||(_0x5f4452['attrs']&&_0x5f4452['attrs'][0x0]?_0x5f4452[_0xb576('0x42')][0x0][_0xb576('0x43')]:undefined)||''}];case _0xb576('0x47'):return[{'name':_0xb576('0x48'),'value':_0x5f4452[_0xb576('0x48')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452['attrs'][0x0]?_0x5f4452[_0xb576('0x42')][0x0][_0xb576('0x43')]:undefined)||_0xb576('0x49')},{'name':_0xb576('0x4a'),'value':_0x5f4452[_0xb576('0x4a')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x1]?_0x5f4452[_0xb576('0x42')][0x1][_0xb576('0x43')]:undefined)||'0.00'},{'name':_0xb576('0x4b'),'value':_0x5f4452[_0xb576('0x4b')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x2]?_0x5f4452[_0xb576('0x42')][0x2][_0xb576('0x43')]:undefined)||0xc}];case _0xb576('0x4c'):return[{'name':_0xb576('0x4d'),'value':_0x5f4452[_0xb576('0x4d')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x0]?_0x5f4452['attrs'][0x0]['value']:undefined)||_0xb576('0x4e')},{'name':_0xb576('0x4f'),'value':_0x5f4452[_0xb576('0x4f')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x1]?_0x5f4452[_0xb576('0x42')][0x1][_0xb576('0x43')]:undefined)||[]},{'name':_0xb576('0x4b'),'value':_0x5f4452[_0xb576('0x4b')]||(_0x5f4452['attrs']&&_0x5f4452['attrs'][0x2]?_0x5f4452[_0xb576('0x42')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5f4452[_0xb576('0x50')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x3]?_0x5f4452['attrs'][0x3][_0xb576('0x43')]:undefined)||_0xb576('0x51')},{'name':_0xb576('0x52'),'value':_0x5f4452['attrEmailAccounts']||(_0x5f4452['attrs']&&_0x5f4452[_0xb576('0x42')][0x4]?_0x5f4452['attrs'][0x4][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x53'),'value':_0x5f4452['attrFaxAccounts']||(_0x5f4452['attrs']&&_0x5f4452[_0xb576('0x42')][0x5]?_0x5f4452[_0xb576('0x42')][0x5][_0xb576('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5f4452[_0xb576('0x54')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x6]?_0x5f4452[_0xb576('0x42')][0x6][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x55'),'value':_0x5f4452[_0xb576('0x55')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x7]?_0x5f4452[_0xb576('0x42')][0x7][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x56'),'value':_0x5f4452[_0xb576('0x56')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x8]?_0x5f4452[_0xb576('0x42')][0x8][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x57'),'value':_0x5f4452['attrChatWebsites']||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x9]?_0x5f4452[_0xb576('0x42')][0x9][_0xb576('0x43')]:undefined)||''}];case _0xb576('0x58'):case _0xb576('0x59'):return[{'name':_0xb576('0x5a'),'value':_0x5f4452['attrSerie1']||(_0x5f4452['attrs']&&_0x5f4452['attrs'][0x0]?_0x5f4452['attrs'][0x0][_0xb576('0x43')]:undefined)||'total'},{'name':_0xb576('0x5b'),'value':_0x5f4452['attrSerie2']||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452['attrs'][0x1]?_0x5f4452[_0xb576('0x42')][0x1][_0xb576('0x43')]:undefined)||null},{'name':_0xb576('0x5c'),'value':_0x5f4452[_0xb576('0x5c')]||(_0x5f4452['attrs']&&_0x5f4452['attrs'][0x2]?_0x5f4452[_0xb576('0x42')][0x2]['value']:undefined)||null},{'name':_0xb576('0x4f'),'value':_0x5f4452[_0xb576('0x4f')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452['attrs'][0x3]?_0x5f4452['attrs'][0x3][_0xb576('0x43')]:undefined)||[]},{'name':_0xb576('0x50'),'value':_0x5f4452[_0xb576('0x50')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x4]?_0x5f4452[_0xb576('0x42')][0x4][_0xb576('0x43')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5f4452[_0xb576('0x52')]||(_0x5f4452['attrs']&&_0x5f4452[_0xb576('0x42')][0x5]?_0x5f4452[_0xb576('0x42')][0x5][_0xb576('0x43')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5f4452[_0xb576('0x53')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x6]?_0x5f4452[_0xb576('0x42')][0x6][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x54'),'value':_0x5f4452[_0xb576('0x54')]||(_0x5f4452['attrs']&&_0x5f4452['attrs'][0x7]?_0x5f4452[_0xb576('0x42')][0x7][_0xb576('0x43')]:undefined)||''},{'name':_0xb576('0x55'),'value':_0x5f4452[_0xb576('0x55')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x8]?_0x5f4452['attrs'][0x8][_0xb576('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5f4452[_0xb576('0x56')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x9]?_0x5f4452[_0xb576('0x42')][0x9][_0xb576('0x43')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5f4452[_0xb576('0x57')]||(_0x5f4452['attrs']&&_0x5f4452[_0xb576('0x42')][0xa]?_0x5f4452[_0xb576('0x42')][0xa][_0xb576('0x43')]:undefined)||''}];case'web-report':return[{'name':_0xb576('0x5d'),'type':_0x5f4452['reportType']||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x0]?_0x5f4452['attrs'][0x0]['type']:undefined)||null,'value':_0x5f4452[_0xb576('0x5d')]||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x0]?_0x5f4452['attrs'][0x0][_0xb576('0x43')]:undefined)||null},{'name':_0xb576('0x5e'),'value':_0x5f4452['attrRefresh']||(_0x5f4452[_0xb576('0x42')]&&_0x5f4452[_0xb576('0x42')][0x1]?_0x5f4452[_0xb576('0x42')][0x1][_0xb576('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x54ed4d){logger[_0xb576('0x2d')](_0xb576('0x5f'),JSON['stringify'](_0x54ed4d));return[];}}exports[_0xb576('0x60')]=function(_0x1a5a34,_0x59505d){if(_0x1a5a34['body']){_0x1a5a34['body'][_0xb576('0x42')]=widgetAttributes(_0x1a5a34['body']);}return db[_0xb576('0x33')][_0xb576('0x60')](_0x1a5a34[_0xb576('0x61')],{})[_0xb576('0x2a')](respondWithResult(_0x59505d,0xc9))[_0xb576('0x3e')](handleError(_0x59505d,null));};exports[_0xb576('0x29')]=function(_0x50683a,_0x3e1805){if(_0x50683a['body']['id']){delete _0x50683a[_0xb576('0x61')]['id'];}_0x50683a[_0xb576('0x61')][_0xb576('0x42')]=widgetAttributes(_0x50683a[_0xb576('0x61')]);return db[_0xb576('0x33')][_0xb576('0x3d')]({'where':{'id':_0x50683a[_0xb576('0x31')]['id']}})[_0xb576('0x2a')](handleEntityNotFound(_0x3e1805,null))['then'](saveUpdates(_0x50683a[_0xb576('0x61')],null))[_0xb576('0x2a')](respondWithResult(_0x3e1805,null))[_0xb576('0x3e')](handleError(_0x3e1805,null));}; \ No newline at end of file +var _0x6132=['attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','DashboardItem','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','filters','query','attributes','intersection','fields','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report'];(function(_0x5daea6,_0x4e7c17){var _0x23d522=function(_0x3d57cf){while(--_0x3d57cf){_0x5daea6['push'](_0x5daea6['shift']());}};_0x23d522(++_0x4e7c17);}(_0x6132,0x13a));var _0x2613=function(_0x51e662,_0x244ebe){_0x51e662=_0x51e662-0x0;var _0x55cf9d=_0x6132[_0x51e662];return _0x55cf9d;};'use strict';var emlformat=require(_0x2613('0x0'));var rimraf=require(_0x2613('0x1'));var zipdir=require(_0x2613('0x2'));var jsonpatch=require(_0x2613('0x3'));var rp=require('request-promise');var moment=require(_0x2613('0x4'));var BPromise=require(_0x2613('0x5'));var Mustache=require(_0x2613('0x6'));var util=require(_0x2613('0x7'));var path=require('path');var sox=require(_0x2613('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2613('0x9'));var _=require(_0x2613('0xa'));var squel=require(_0x2613('0xb'));var crypto=require(_0x2613('0xc'));var jsforce=require(_0x2613('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2613('0xe'));var querystring=require(_0x2613('0xf'));var Papa=require(_0x2613('0x10'));var Redis=require('ioredis');var authService=require(_0x2613('0x11'));var qs=require(_0x2613('0x12'));var as=require(_0x2613('0x13'));var hardwareService=require(_0x2613('0x14'));var logger=require(_0x2613('0x15'))(_0x2613('0x16'));var utils=require(_0x2613('0x17'));var config=require(_0x2613('0x18'));var licenseUtil=require(_0x2613('0x19'));var db=require(_0x2613('0x1a'))['db'];config['redis']=_[_0x2613('0x1b')](config[_0x2613('0x1c')],{'host':_0x2613('0x1d'),'port':0x18eb});var socket=require(_0x2613('0x1e'))(new Redis(config['redis']));require(_0x2613('0x1f'))[_0x2613('0x20')](socket);function respondWithStatusCode(_0x45f3c9,_0x4defaf){_0x4defaf=_0x4defaf||0xcc;return function(_0x5b62b6){if(_0x5b62b6){return _0x45f3c9[_0x2613('0x21')](_0x4defaf);}return _0x45f3c9[_0x2613('0x22')](_0x4defaf)[_0x2613('0x23')]();};}function respondWithResult(_0x3e3620,_0x57170f){_0x57170f=_0x57170f||0xc8;return function(_0x35dd88){if(_0x35dd88){return _0x3e3620[_0x2613('0x22')](_0x57170f)['json'](_0x35dd88);}};}function respondWithFilteredResult(_0x37f961,_0x226197){return function(_0x207553){if(_0x207553){var _0x247e4c=typeof _0x226197[_0x2613('0x24')]==='undefined'&&typeof _0x226197[_0x2613('0x25')]===_0x2613('0x26');var _0x544a15=_0x207553[_0x2613('0x27')];var _0x2b5242=_0x247e4c?0x0:_0x226197[_0x2613('0x24')];var _0x8256f7=_0x247e4c?_0x207553['count']:_0x226197[_0x2613('0x24')]+_0x226197['limit'];var _0x525aec;if(_0x8256f7>=_0x544a15){_0x8256f7=_0x544a15;_0x525aec=0xc8;}else{_0x525aec=0xce;}_0x37f961[_0x2613('0x22')](_0x525aec);return _0x37f961['set'](_0x2613('0x28'),_0x2b5242+'-'+_0x8256f7+'/'+_0x544a15)[_0x2613('0x29')](_0x207553);}return null;};}function patchUpdates(_0x41a764){return function(_0x5b3893){try{jsonpatch['apply'](_0x5b3893,_0x41a764,!![]);}catch(_0x54a779){return BPromise[_0x2613('0x2a')](_0x54a779);}return _0x5b3893['save']();};}function saveUpdates(_0x1db1e9,_0x25b315){return function(_0x325e98){if(_0x325e98){return _0x325e98[_0x2613('0x2b')](_0x1db1e9)[_0x2613('0x2c')](function(_0x115f6f){return _0x115f6f;});}return null;};}function removeEntity(_0x16a222,_0xad2c6c){return function(_0x52898d){if(_0x52898d){return _0x52898d[_0x2613('0x2d')]()[_0x2613('0x2c')](function(){_0x16a222[_0x2613('0x22')](0xcc)[_0x2613('0x23')]();});}};}function handleEntityNotFound(_0xf81db,_0x329e65){return function(_0x15ee46){if(!_0x15ee46){_0xf81db[_0x2613('0x21')](0x194);}return _0x15ee46;};}function handleError(_0x1960cd,_0x5c1577){_0x5c1577=_0x5c1577||0x1f4;return function(_0x25bc15){logger[_0x2613('0x2e')](_0x25bc15[_0x2613('0x2f')]);if(_0x25bc15[_0x2613('0x30')]){delete _0x25bc15[_0x2613('0x30')];}_0x1960cd[_0x2613('0x22')](_0x5c1577)[_0x2613('0x31')](_0x25bc15);};}exports[_0x2613('0x32')]=function(_0x5b0c2f,_0x378ee1){var _0x151415={'raw':![],'where':{'id':_0x5b0c2f[_0x2613('0x33')]['id']}},_0x328ac2={};_0x328ac2[_0x2613('0x34')]=_[_0x2613('0x35')](db['DashboardItem'][_0x2613('0x36')]);_0x328ac2['query']=_[_0x2613('0x35')](_0x5b0c2f['query']);_0x328ac2[_0x2613('0x37')]=_['intersection'](_0x328ac2[_0x2613('0x34')],_0x328ac2[_0x2613('0x38')]);_0x151415[_0x2613('0x39')]=_[_0x2613('0x3a')](_0x328ac2[_0x2613('0x34')],qs['fields'](_0x5b0c2f[_0x2613('0x38')][_0x2613('0x3b')]));_0x151415[_0x2613('0x39')]=_0x151415['attributes']['length']?_0x151415[_0x2613('0x39')]:_0x328ac2[_0x2613('0x34')];if(_0x5b0c2f[_0x2613('0x38')][_0x2613('0x3c')]){_0x151415[_0x2613('0x3d')]=[{'all':!![]}];}_0x151415=_[_0x2613('0x3e')]({},_0x151415,_0x5b0c2f['options']);return db['DashboardItem'][_0x2613('0x3f')](_0x151415)['then'](handleEntityNotFound(_0x378ee1,null))['then'](respondWithResult(_0x378ee1,null))[_0x2613('0x40')](handleError(_0x378ee1,null));};exports[_0x2613('0x2d')]=function(_0x58a697,_0x436121){return db['DashboardItem'][_0x2613('0x3f')]({'where':{'id':_0x58a697[_0x2613('0x33')]['id']}})['then'](handleEntityNotFound(_0x436121,null))['then'](removeEntity(_0x436121,null))['catch'](handleError(_0x436121,null));};function widgetAttributes(_0x21440c){try{switch(_0x21440c[_0x2613('0x41')]){case _0x2613('0x42'):return[{'name':'attrUrl','value':_0x21440c[_0x2613('0x43')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x0]?_0x21440c[_0x2613('0x44')][0x0][_0x2613('0x45')]:undefined)||'https://'}];case'custom':return[{'name':_0x2613('0x46'),'value':_0x21440c[_0x2613('0x46')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c['attrs'][0x0]?_0x21440c['attrs'][0x0][_0x2613('0x45')]:undefined)||''}];case _0x2613('0x47'):return[{'name':_0x2613('0x48'),'value':_0x21440c['attrHourFormat']||(_0x21440c['attrs']&&_0x21440c['attrs'][0x0]?_0x21440c[_0x2613('0x44')][0x0][_0x2613('0x45')]:undefined)||_0x2613('0x49')},{'name':_0x2613('0x4a'),'value':_0x21440c[_0x2613('0x4a')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x1]?_0x21440c[_0x2613('0x44')][0x1][_0x2613('0x45')]:undefined)||_0x2613('0x4b')},{'name':_0x2613('0x4c'),'value':_0x21440c[_0x2613('0x4c')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c['attrs'][0x2]?_0x21440c[_0x2613('0x44')][0x2]['value']:undefined)||0xc}];case _0x2613('0x4d'):return[{'name':_0x2613('0x4e'),'value':_0x21440c[_0x2613('0x4e')]||(_0x21440c['attrs']&&_0x21440c['attrs'][0x0]?_0x21440c[_0x2613('0x44')][0x0][_0x2613('0x45')]:undefined)||_0x2613('0x4f')},{'name':_0x2613('0x50'),'value':_0x21440c[_0x2613('0x50')]||(_0x21440c['attrs']&&_0x21440c['attrs'][0x1]?_0x21440c['attrs'][0x1][_0x2613('0x45')]:undefined)||[]},{'name':_0x2613('0x4c'),'value':_0x21440c[_0x2613('0x4c')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c['attrs'][0x2]?_0x21440c[_0x2613('0x44')][0x2]['value']:undefined)||0x14},{'name':_0x2613('0x51'),'value':_0x21440c['attrChannel']||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x3]?_0x21440c[_0x2613('0x44')][0x3][_0x2613('0x45')]:undefined)||_0x2613('0x52')},{'name':_0x2613('0x53'),'value':_0x21440c[_0x2613('0x53')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x4]?_0x21440c['attrs'][0x4][_0x2613('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x21440c['attrFaxAccounts']||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x5]?_0x21440c['attrs'][0x5][_0x2613('0x45')]:undefined)||''},{'name':_0x2613('0x54'),'value':_0x21440c['attrSmsAccounts']||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x6]?_0x21440c['attrs'][0x6][_0x2613('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x21440c[_0x2613('0x55')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x7]?_0x21440c['attrs'][0x7][_0x2613('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x21440c[_0x2613('0x56')]||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x8]?_0x21440c[_0x2613('0x44')][0x8]['value']:undefined)||''},{'name':_0x2613('0x57'),'value':_0x21440c[_0x2613('0x57')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x9]?_0x21440c[_0x2613('0x44')][0x9][_0x2613('0x45')]:undefined)||''}];case'multibar-chart':case _0x2613('0x58'):return[{'name':_0x2613('0x59'),'value':_0x21440c[_0x2613('0x59')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x0]?_0x21440c['attrs'][0x0][_0x2613('0x45')]:undefined)||_0x2613('0x4f')},{'name':_0x2613('0x5a'),'value':_0x21440c[_0x2613('0x5a')]||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x1]?_0x21440c['attrs'][0x1][_0x2613('0x45')]:undefined)||null},{'name':_0x2613('0x5b'),'value':_0x21440c[_0x2613('0x5b')]||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x2]?_0x21440c['attrs'][0x2][_0x2613('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x21440c[_0x2613('0x50')]||(_0x21440c['attrs']&&_0x21440c['attrs'][0x3]?_0x21440c['attrs'][0x3][_0x2613('0x45')]:undefined)||[]},{'name':_0x2613('0x51'),'value':_0x21440c[_0x2613('0x51')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x4]?_0x21440c[_0x2613('0x44')][0x4]['value']:undefined)||_0x2613('0x52')},{'name':_0x2613('0x53'),'value':_0x21440c[_0x2613('0x53')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x5]?_0x21440c[_0x2613('0x44')][0x5][_0x2613('0x45')]:undefined)||''},{'name':_0x2613('0x5c'),'value':_0x21440c['attrFaxAccounts']||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x6]?_0x21440c[_0x2613('0x44')][0x6][_0x2613('0x45')]:undefined)||''},{'name':_0x2613('0x54'),'value':_0x21440c[_0x2613('0x54')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c['attrs'][0x7]?_0x21440c[_0x2613('0x44')][0x7][_0x2613('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x21440c[_0x2613('0x55')]||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x8]?_0x21440c[_0x2613('0x44')][0x8][_0x2613('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x21440c[_0x2613('0x56')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x9]?_0x21440c[_0x2613('0x44')][0x9][_0x2613('0x45')]:undefined)||''},{'name':_0x2613('0x57'),'value':_0x21440c['attrChatWebsites']||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0xa]?_0x21440c[_0x2613('0x44')][0xa][_0x2613('0x45')]:undefined)||''}];case _0x2613('0x5d'):return[{'name':_0x2613('0x5e'),'type':_0x21440c[_0x2613('0x5f')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x0]?_0x21440c[_0x2613('0x44')][0x0][_0x2613('0x41')]:undefined)||null,'value':_0x21440c['attrReport']||(_0x21440c['attrs']&&_0x21440c[_0x2613('0x44')][0x0]?_0x21440c['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x21440c[_0x2613('0x60')]||(_0x21440c[_0x2613('0x44')]&&_0x21440c[_0x2613('0x44')][0x1]?_0x21440c[_0x2613('0x44')][0x1][_0x2613('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x10614d){logger['error'](_0x2613('0x61'),JSON[_0x2613('0x62')](_0x10614d));return[];}}exports['create']=function(_0x24f2c4,_0x50c32a){if(_0x24f2c4[_0x2613('0x63')]){_0x24f2c4['body'][_0x2613('0x44')]=widgetAttributes(_0x24f2c4[_0x2613('0x63')]);}return db[_0x2613('0x64')][_0x2613('0x65')](_0x24f2c4[_0x2613('0x63')],{})[_0x2613('0x2c')](respondWithResult(_0x50c32a,0xc9))[_0x2613('0x40')](handleError(_0x50c32a,null));};exports[_0x2613('0x2b')]=function(_0x1a4555,_0x226ee4){if(_0x1a4555[_0x2613('0x63')]['id']){delete _0x1a4555[_0x2613('0x63')]['id'];}_0x1a4555[_0x2613('0x63')][_0x2613('0x44')]=widgetAttributes(_0x1a4555['body']);return db[_0x2613('0x64')]['find']({'where':{'id':_0x1a4555['params']['id']}})[_0x2613('0x2c')](handleEntityNotFound(_0x226ee4,null))[_0x2613('0x2c')](saveUpdates(_0x1a4555[_0x2613('0x63')],null))[_0x2613('0x2c')](respondWithResult(_0x226ee4,null))[_0x2613('0x40')](handleError(_0x226ee4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e26893e..f97a4a4 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 _0xbeb6=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x343315,_0x1d8c72){var _0xa45f5c=function(_0x51e708){while(--_0x51e708){_0x343315['push'](_0x343315['shift']());}};_0xa45f5c(++_0x1d8c72);}(_0xbeb6,0x19e));var _0x6beb=function(_0x2f9b5b,_0x3be646){_0x2f9b5b=_0x2f9b5b-0x0;var _0x369a3d=_0xbeb6[_0x2f9b5b];return _0x369a3d;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x6beb('0x0'))['db'][_0x6beb('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6beb('0x2')](0x0);var events={'afterCreate':_0x6beb('0x3'),'afterUpdate':_0x6beb('0x4'),'afterDestroy':_0x6beb('0x5')};function emitEvent(_0x2476a0){return function(_0x3be704,_0x2805b9,_0xe039e6){DashboardItemEvents[_0x6beb('0x6')](_0x2476a0+':'+_0x3be704['id'],_0x3be704);DashboardItemEvents[_0x6beb('0x6')](_0x2476a0,_0x3be704);_0xe039e6(null);};}for(var e in events){if(events[_0x6beb('0x7')](e)){var event=events[e];DashboardItem[_0x6beb('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xa3db=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x319412,_0x3e5995){var _0x2d78b3=function(_0x295ed6){while(--_0x295ed6){_0x319412['push'](_0x319412['shift']());}};_0x2d78b3(++_0x3e5995);}(_0xa3db,0x183));var _0xba3d=function(_0x464295,_0x532d70){_0x464295=_0x464295-0x0;var _0x200536=_0xa3db[_0x464295];return _0x200536;};'use strict';var EventEmitter=require(_0xba3d('0x0'));var DashboardItem=require(_0xba3d('0x1'))['db'][_0xba3d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xba3d('0x3')](0x0);var events={'afterCreate':_0xba3d('0x4'),'afterUpdate':_0xba3d('0x5'),'afterDestroy':_0xba3d('0x6')};function emitEvent(_0x5999f7){return function(_0x272a97,_0x435821,_0x14488b){DashboardItemEvents['emit'](_0x5999f7+':'+_0x272a97['id'],_0x272a97);DashboardItemEvents[_0xba3d('0x7')](_0x5999f7,_0x272a97);_0x14488b(null);};}for(var e in events){if(events[_0xba3d('0x8')](e)){var event=events[e];DashboardItem[_0xba3d('0x9')](e,emitEvent(event));}}module[_0xba3d('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b929a2e..7dd6544 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 _0x6931=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird'];(function(_0x10ae36,_0x4b0b72){var _0x305699=function(_0x146c08){while(--_0x146c08){_0x10ae36['push'](_0x10ae36['shift']());}};_0x305699(++_0x4b0b72);}(_0x6931,0x8c));var _0x1693=function(_0x427e8b,_0x739353){_0x427e8b=_0x427e8b-0x0;var _0xc675e9=_0x6931[_0x427e8b];return _0xc675e9;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1693('0x3'));var rp=require(_0x1693('0x4'));var fs=require('fs');var path=require(_0x1693('0x5'));var rimraf=require(_0x1693('0x6'));var config=require(_0x1693('0x7'));var attributes=require(_0x1693('0x8'));module[_0x1693('0x9')]=function(_0x50a217,_0x4a9b86){return _0x50a217['define'](_0x1693('0xa'),attributes,{'tableName':_0x1693('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb85=['moment','request-promise','./dashboardItem.attributes','exports','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x2323bc,_0x58f39a){var _0x3bc5fe=function(_0x1e85df){while(--_0x1e85df){_0x2323bc['push'](_0x2323bc['shift']());}};_0x3bc5fe(++_0x58f39a);}(_0xfb85,0x12e));var _0x5fb8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xfb85[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x5fb8('0x0'));var util=require(_0x5fb8('0x1'));var logger=require(_0x5fb8('0x2'))(_0x5fb8('0x3'));var moment=require(_0x5fb8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fb8('0x6'));module[_0x5fb8('0x7')]=function(_0x136060,_0x2bee8b){return _0x136060['define'](_0x5fb8('0x8'),attributes,{'tableName':'dashboard_items','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 9b31710..9685bde 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 _0xc324=['../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','ioredis','../../mysqldb'];(function(_0x5c8aeb,_0x3ce9a4){var _0x2bf950=function(_0x75ff58){while(--_0x75ff58){_0x5c8aeb['push'](_0x5c8aeb['shift']());}};_0x2bf950(++_0x3ce9a4);}(_0xc324,0x9d));var _0x4c32=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc324[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4c32('0x0'));var util=require(_0x4c32('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c32('0x2'));var db=require(_0x4c32('0x3'))['db'];var utils=require(_0x4c32('0x4'));var logger=require('../../config/logger')(_0x4c32('0x5'));var config=require('../../config/environment');var jayson=require(_0x4c32('0x6'));var client=jayson[_0x4c32('0x7')][_0x4c32('0x8')]({'port':0x232a});config[_0x4c32('0x9')]=_['defaults'](config['redis'],{'host':_0x4c32('0xa'),'port':0x18eb});var socket=require(_0x4c32('0xb'))(new Redis(config[_0x4c32('0x9')]));require(_0x4c32('0xc'))[_0x4c32('0xd')](socket);function respondWithRpcPromise(_0x5c0078,_0x511ef8,_0x4f0b5e){return new BPromise(function(_0x22ad79,_0x2ec9f4){return client[_0x4c32('0xe')](_0x5c0078,_0x4f0b5e)[_0x4c32('0xf')](function(_0x5b4876){logger['info'](_0x4c32('0x10'),_0x511ef8,'request\x20sent');logger['debug'](_0x4c32('0x11'),_0x511ef8,_0x4c32('0x12'),JSON['stringify'](_0x5b4876));if(_0x5b4876[_0x4c32('0x13')]){if(_0x5b4876[_0x4c32('0x13')]['code']===0x1f4){logger[_0x4c32('0x13')](_0x4c32('0x10'),_0x511ef8,_0x5b4876[_0x4c32('0x13')][_0x4c32('0x14')]);return _0x2ec9f4(_0x5b4876[_0x4c32('0x13')][_0x4c32('0x14')]);}logger[_0x4c32('0x13')](_0x4c32('0x10'),_0x511ef8,_0x5b4876['error']['message']);return _0x22ad79(_0x5b4876[_0x4c32('0x13')]['message']);}else{logger[_0x4c32('0x15')](_0x4c32('0x10'),_0x511ef8,_0x4c32('0x12'));_0x22ad79(_0x5b4876[_0x4c32('0x16')][_0x4c32('0x14')]);}})['catch'](function(_0x4165a9){logger[_0x4c32('0x13')](_0x4c32('0x10'),_0x511ef8,_0x4165a9);_0x2ec9f4(_0x4165a9);});});} \ No newline at end of file +var _0x01a5=['message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x106c8a,_0x38ce02){var _0x1b327a=function(_0x50784b){while(--_0x50784b){_0x106c8a['push'](_0x106c8a['shift']());}};_0x1b327a(++_0x38ce02);}(_0x01a5,0x19a));var _0x501a=function(_0xb94e1b,_0x11a39f){_0xb94e1b=_0xb94e1b-0x0;var _0x37fa5b=_0x01a5[_0xb94e1b];return _0x37fa5b;};'use strict';var _=require(_0x501a('0x0'));var util=require(_0x501a('0x1'));var moment=require(_0x501a('0x2'));var BPromise=require(_0x501a('0x3'));var rs=require(_0x501a('0x4'));var fs=require('fs');var Redis=require(_0x501a('0x5'));var db=require(_0x501a('0x6'))['db'];var utils=require(_0x501a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x501a('0x8'));var jayson=require(_0x501a('0x9'));var client=jayson[_0x501a('0xa')][_0x501a('0xb')]({'port':0x232a});config[_0x501a('0xc')]=_[_0x501a('0xd')](config[_0x501a('0xc')],{'host':_0x501a('0xe'),'port':0x18eb});var socket=require(_0x501a('0xf'))(new Redis(config['redis']));require(_0x501a('0x10'))['register'](socket);function respondWithRpcPromise(_0x57f2f3,_0x2433ad,_0xef0b5e){return new BPromise(function(_0x3c4cd0,_0x112bb7){return client[_0x501a('0x11')](_0x57f2f3,_0xef0b5e)[_0x501a('0x12')](function(_0x3b2c00){logger[_0x501a('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2433ad,_0x501a('0x14'));logger[_0x501a('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2433ad,_0x501a('0x14'),JSON[_0x501a('0x16')](_0x3b2c00));if(_0x3b2c00[_0x501a('0x17')]){if(_0x3b2c00[_0x501a('0x17')][_0x501a('0x18')]===0x1f4){logger[_0x501a('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2433ad,_0x3b2c00[_0x501a('0x17')][_0x501a('0x19')]);return _0x112bb7(_0x3b2c00['error'][_0x501a('0x19')]);}logger[_0x501a('0x17')](_0x501a('0x1a'),_0x2433ad,_0x3b2c00[_0x501a('0x17')]['message']);return _0x3c4cd0(_0x3b2c00[_0x501a('0x17')]['message']);}else{logger[_0x501a('0x13')](_0x501a('0x1a'),_0x2433ad,_0x501a('0x14'));_0x3c4cd0(_0x3b2c00[_0x501a('0x1b')][_0x501a('0x19')]);}})[_0x501a('0x1c')](function(_0x437738){logger[_0x501a('0x17')](_0x501a('0x1a'),_0x2433ad,_0x437738);_0x112bb7(_0x437738);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0080560..01f22e5 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 _0xe9d0=['length','dashboardItem:','save','emit','removeListener','register'];(function(_0x507bfe,_0x2f9dfd){var _0x2092c9=function(_0x44bdf6){while(--_0x44bdf6){_0x507bfe['push'](_0x507bfe['shift']());}};_0x2092c9(++_0x2f9dfd);}(_0xe9d0,0xb0));var _0x0e9d=function(_0x2324fb,_0x246bd1){_0x2324fb=_0x2324fb-0x0;var _0x423796=_0xe9d0[_0x2324fb];return _0x423796;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x0e9d('0x0'),'remove','update'];function createListener(_0x4e2789,_0x3b7670){return function(_0x5883cd){_0x3b7670[_0x0e9d('0x1')](_0x4e2789,_0x5883cd);};}function removeListener(_0x317df0,_0x53e1db){return function(){DashboardItemEvents[_0x0e9d('0x2')](_0x317df0,_0x53e1db);};}exports[_0x0e9d('0x3')]=function(_0x19cb7b){for(var _0x20f22d=0x0,_0x27a500=events[_0x0e9d('0x4')];_0x20f22d<_0x27a500;_0x20f22d++){var _0x30d0d0=events[_0x20f22d];var _0x3c1489=createListener(_0x0e9d('0x5')+_0x30d0d0,_0x19cb7b);DashboardItemEvents['on'](_0x30d0d0,_0x3c1489);}}; \ No newline at end of file +var _0x7321=['remove','update','removeListener','register','length','dashboardItem:','save'];(function(_0x2da924,_0x356cb2){var _0x3827ad=function(_0x5aea92){while(--_0x5aea92){_0x2da924['push'](_0x2da924['shift']());}};_0x3827ad(++_0x356cb2);}(_0x7321,0x1aa));var _0x1732=function(_0x5f5a37,_0x1156a1){_0x5f5a37=_0x5f5a37-0x0;var _0x23c6c2=_0x7321[_0x5f5a37];return _0x23c6c2;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x1732('0x0'),_0x1732('0x1'),_0x1732('0x2')];function createListener(_0x1a6d54,_0x563ed0){return function(_0x3c0e70){_0x563ed0['emit'](_0x1a6d54,_0x3c0e70);};}function removeListener(_0x37f1a1,_0x115be7){return function(){DashboardItemEvents[_0x1732('0x3')](_0x37f1a1,_0x115be7);};}exports[_0x1732('0x4')]=function(_0x5962ec){for(var _0x1ad26a=0x0,_0x1fd1fd=events[_0x1732('0x5')];_0x1ad26a<_0x1fd1fd;_0x1ad26a++){var _0xddacb6=events[_0x1ad26a];var _0x542202=createListener(_0x1732('0x6')+_0xddacb6,_0x5962ec);DashboardItemEvents['on'](_0xddacb6,_0x542202);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 01e0a56..fce7f32 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 _0x72e7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x2a8bbf,_0xbbb8b1){var _0x231b1c=function(_0x266cf4){while(--_0x266cf4){_0x2a8bbf['push'](_0x2a8bbf['shift']());}};_0x231b1c(++_0xbbb8b1);}(_0x72e7,0x17b));var _0x772e=function(_0x516012,_0x278ef5){_0x516012=_0x516012-0x0;var _0x4e3aae=_0x72e7[_0x516012];return _0x4e3aae;};'use strict';var multer=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var path=require('path');var timeout=require(_0x772e('0x2'));var express=require(_0x772e('0x3'));var router=express[_0x772e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x772e('0x5'));var interaction=require(_0x772e('0x6'));var config=require(_0x772e('0x7'));var controller=require(_0x772e('0x8'));router['get'](_0x772e('0x9'),auth[_0x772e('0xa')](),controller[_0x772e('0xb')]);router['post']('/',auth[_0x772e('0xa')](),controller[_0x772e('0xc')]);router[_0x772e('0xd')]('/:id',auth[_0x772e('0xa')](),controller[_0x772e('0xe')]);router[_0x772e('0xf')](_0x772e('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xce50=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','delete','destroy'];(function(_0x1fe8be,_0x5e7860){var _0x1449bb=function(_0x17b23e){while(--_0x17b23e){_0x1fe8be['push'](_0x1fe8be['shift']());}};_0x1449bb(++_0x5e7860);}(_0xce50,0x1dc));var _0x0ce5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xce50[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x0ce5('0x0'));var path=require(_0x0ce5('0x1'));var timeout=require(_0x0ce5('0x2'));var express=require(_0x0ce5('0x3'));var router=express[_0x0ce5('0x4')]();var fs_extra=require(_0x0ce5('0x5'));var auth=require(_0x0ce5('0x6'));var interaction=require(_0x0ce5('0x7'));var config=require(_0x0ce5('0x8'));var controller=require(_0x0ce5('0x9'));router[_0x0ce5('0xa')](_0x0ce5('0xb'),auth[_0x0ce5('0xc')](),controller[_0x0ce5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0ce5('0xe')]);router[_0x0ce5('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0ce5('0x10')](_0x0ce5('0xb'),auth[_0x0ce5('0xc')](),controller[_0x0ce5('0x11')]);module[_0x0ce5('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 97c471c..cc6733b 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 _0xe4b7=['sequelize','STRING','ENUM','first','third'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe4b7,0x18b));var _0x7e4b=function(_0x2f163c,_0x27bd79){_0x2f163c=_0x2f163c-0x0;var _0x3dd996=_0xe4b7[_0x2f163c];return _0x3dd996;};'use strict';var Sequelize=require(_0x7e4b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e4b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x7e4b('0x2')](_0x7e4b('0x3'),'second',_0x7e4b('0x4')),'allowNull':![],'defaultValue':_0x7e4b('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb09=['sequelize','exports','STRING','ENUM','second','first'];(function(_0x3fbaf6,_0x4f5563){var _0x3b8d8d=function(_0x59d450){while(--_0x59d450){_0x3fbaf6['push'](_0x3fbaf6['shift']());}};_0x3b8d8d(++_0x4f5563);}(_0xbb09,0x15c));var _0x9bb0=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xbb09[_0x2fff83];return _0xa2a722;};'use strict';var Sequelize=require(_0x9bb0('0x0'));module[_0x9bb0('0x1')]={'name':{'type':Sequelize[_0x9bb0('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9bb0('0x3')]('first',_0x9bb0('0x4'),'third'),'allowNull':![],'defaultValue':_0x9bb0('0x5')},'description':{'type':Sequelize[_0x9bb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6e3f52d..3068afb 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 _0xd0e7=['find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','length'];(function(_0x1e6527,_0x24d646){var _0x31883b=function(_0x362fca){while(--_0x362fca){_0x1e6527['push'](_0x1e6527['shift']());}};_0x31883b(++_0x24d646);}(_0xd0e7,0x10d));var _0x7d0e=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xd0e7[_0x56ba92];return _0x8fe94d;};'use strict';var emlformat=require(_0x7d0e('0x0'));var rimraf=require(_0x7d0e('0x1'));var zipdir=require(_0x7d0e('0x2'));var jsonpatch=require(_0x7d0e('0x3'));var rp=require('request-promise');var moment=require(_0x7d0e('0x4'));var BPromise=require(_0x7d0e('0x5'));var Mustache=require(_0x7d0e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7d0e('0x7'));var csv=require(_0x7d0e('0x8'));var ejs=require(_0x7d0e('0x9'));var fs=require('fs');var fs_extra=require(_0x7d0e('0xa'));var _=require(_0x7d0e('0xb'));var squel=require(_0x7d0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d0e('0xd'));var deskjs=require(_0x7d0e('0xe'));var toCsv=require(_0x7d0e('0x8'));var querystring=require(_0x7d0e('0xf'));var Papa=require(_0x7d0e('0x10'));var Redis=require(_0x7d0e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7d0e('0x12'));var as=require(_0x7d0e('0x13'));var hardwareService=require(_0x7d0e('0x14'));var logger=require('../../config/logger')(_0x7d0e('0x15'));var utils=require(_0x7d0e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7d0e('0x17'));var db=require(_0x7d0e('0x18'))['db'];function respondWithStatusCode(_0x3f991e,_0x19b5eb){_0x19b5eb=_0x19b5eb||0xcc;return function(_0xa94940){if(_0xa94940){return _0x3f991e[_0x7d0e('0x19')](_0x19b5eb);}return _0x3f991e[_0x7d0e('0x1a')](_0x19b5eb)[_0x7d0e('0x1b')]();};}function respondWithResult(_0x5036eb,_0x313ffe){_0x313ffe=_0x313ffe||0xc8;return function(_0x136b60){if(_0x136b60){return _0x5036eb[_0x7d0e('0x1a')](_0x313ffe)[_0x7d0e('0x1c')](_0x136b60);}};}function respondWithFilteredResult(_0x239b89,_0x5dd72c){return function(_0x2c930b){if(_0x2c930b){var _0x132638=typeof _0x5dd72c[_0x7d0e('0x1d')]==='undefined'&&typeof _0x5dd72c[_0x7d0e('0x1e')]===_0x7d0e('0x1f');var _0x12df3c=_0x2c930b[_0x7d0e('0x20')];var _0x4ded01=_0x132638?0x0:_0x5dd72c[_0x7d0e('0x1d')];var _0x3d53aa=_0x132638?_0x2c930b[_0x7d0e('0x20')]:_0x5dd72c[_0x7d0e('0x1d')]+_0x5dd72c[_0x7d0e('0x1e')];var _0x547643;if(_0x3d53aa>=_0x12df3c){_0x3d53aa=_0x12df3c;_0x547643=0xc8;}else{_0x547643=0xce;}_0x239b89['status'](_0x547643);return _0x239b89[_0x7d0e('0x21')](_0x7d0e('0x22'),_0x4ded01+'-'+_0x3d53aa+'/'+_0x12df3c)[_0x7d0e('0x1c')](_0x2c930b);}return null;};}function patchUpdates(_0x5b9b48){return function(_0x50cfe3){try{jsonpatch[_0x7d0e('0x23')](_0x50cfe3,_0x5b9b48,!![]);}catch(_0xcd429a){return BPromise['reject'](_0xcd429a);}return _0x50cfe3[_0x7d0e('0x24')]();};}function saveUpdates(_0x4f32a7,_0x475ff2){return function(_0x22cf8d){if(_0x22cf8d){return _0x22cf8d['update'](_0x4f32a7)[_0x7d0e('0x25')](function(_0x57c576){return _0x57c576;});}return null;};}function removeEntity(_0x1a2715,_0xd5dcdb){return function(_0x62af88){if(_0x62af88){return _0x62af88['destroy']()[_0x7d0e('0x25')](function(){var _0x8a4450=_0x62af88[_0x7d0e('0x26')]({'plain':!![]});var _0x1d6e6f=_0x7d0e('0x27');return db[_0x7d0e('0x28')]['destroy']({'where':{'type':_0x1d6e6f,'resourceId':_0x8a4450['id']}})[_0x7d0e('0x25')](function(){return _0x62af88;});})[_0x7d0e('0x25')](function(){_0x1a2715[_0x7d0e('0x1a')](0xcc)[_0x7d0e('0x1b')]();});}};}function handleEntityNotFound(_0x45297c,_0x52ad4b){return function(_0x67d62e){if(!_0x67d62e){_0x45297c[_0x7d0e('0x19')](0x194);}return _0x67d62e;};}function handleError(_0x343e90,_0x2bc2b0){_0x2bc2b0=_0x2bc2b0||0x1f4;return function(_0x1e6137){logger[_0x7d0e('0x29')](_0x1e6137[_0x7d0e('0x2a')]);if(_0x1e6137['name']){delete _0x1e6137[_0x7d0e('0x2b')];}_0x343e90[_0x7d0e('0x1a')](_0x2bc2b0)[_0x7d0e('0x2c')](_0x1e6137);};}exports[_0x7d0e('0x2d')]=function(_0x27ac5d,_0x30b31a){var _0x17eb4b={},_0x3636a9={},_0x334265={'count':0x0,'rows':[]};var _0x59a93e=_[_0x7d0e('0x2e')](db[_0x7d0e('0x2f')][_0x7d0e('0x30')],function(_0x1ba320){return{'name':_0x1ba320[_0x7d0e('0x31')],'type':_0x1ba320[_0x7d0e('0x32')][_0x7d0e('0x33')]};});_0x3636a9[_0x7d0e('0x34')]=_[_0x7d0e('0x2e')](_0x59a93e,_0x7d0e('0x2b'));_0x3636a9[_0x7d0e('0x35')]=_[_0x7d0e('0x36')](_0x27ac5d[_0x7d0e('0x35')]);_0x3636a9[_0x7d0e('0x37')]=_['intersection'](_0x3636a9[_0x7d0e('0x34')],_0x3636a9[_0x7d0e('0x35')]);_0x17eb4b['attributes']=_['intersection'](_0x3636a9[_0x7d0e('0x34')],qs['fields'](_0x27ac5d[_0x7d0e('0x35')][_0x7d0e('0x38')]));_0x17eb4b[_0x7d0e('0x39')]=_0x17eb4b[_0x7d0e('0x39')]['length']?_0x17eb4b[_0x7d0e('0x39')]:_0x3636a9['model'];if(!_0x27ac5d['query']['hasOwnProperty'](_0x7d0e('0x3a'))){_0x17eb4b[_0x7d0e('0x1e')]=qs[_0x7d0e('0x1e')](_0x27ac5d[_0x7d0e('0x35')][_0x7d0e('0x1e')]);_0x17eb4b[_0x7d0e('0x1d')]=qs['offset'](_0x27ac5d[_0x7d0e('0x35')]['offset']);}_0x17eb4b[_0x7d0e('0x3b')]=qs[_0x7d0e('0x3c')](_0x27ac5d['query'][_0x7d0e('0x3c')]);_0x17eb4b[_0x7d0e('0x3d')]=qs[_0x7d0e('0x37')](_[_0x7d0e('0x3e')](_0x27ac5d[_0x7d0e('0x35')],_0x3636a9['filters']),_0x59a93e);if(_0x27ac5d['query']['filter']){_0x17eb4b['where']=_[_0x7d0e('0x3f')](_0x17eb4b[_0x7d0e('0x3d')],{'$or':_[_0x7d0e('0x2e')](_0x59a93e,function(_0x134745){if(_0x134745['type']!==_0x7d0e('0x40')){var _0x35b786={};_0x35b786[_0x134745[_0x7d0e('0x2b')]]={'$like':'%'+_0x27ac5d[_0x7d0e('0x35')][_0x7d0e('0x41')]+'%'};return _0x35b786;}})});}_0x17eb4b=_['merge']({},_0x17eb4b,_0x27ac5d[_0x7d0e('0x42')]);var _0x1886bf={'where':_0x17eb4b[_0x7d0e('0x3d')]};return db[_0x7d0e('0x2f')][_0x7d0e('0x20')](_0x1886bf)[_0x7d0e('0x25')](function(_0x572493){_0x334265[_0x7d0e('0x20')]=_0x572493;if(_0x27ac5d[_0x7d0e('0x35')][_0x7d0e('0x43')]){_0x17eb4b[_0x7d0e('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x7d0e('0x45')](_0x17eb4b);})[_0x7d0e('0x25')](function(_0x9b9dbb){_0x334265[_0x7d0e('0x46')]=_0x9b9dbb;return _0x334265;})[_0x7d0e('0x25')](respondWithFilteredResult(_0x30b31a,_0x17eb4b))['catch'](handleError(_0x30b31a,null));};exports[_0x7d0e('0x47')]=function(_0x525ae8,_0x13e2dd){var _0x38e54a={'raw':!![],'where':{'id':_0x525ae8[_0x7d0e('0x48')]['id']}},_0x2fa1d3={};_0x2fa1d3[_0x7d0e('0x34')]=_[_0x7d0e('0x36')](db[_0x7d0e('0x2f')][_0x7d0e('0x30')]);_0x2fa1d3['query']=_['keys'](_0x525ae8['query']);_0x2fa1d3[_0x7d0e('0x37')]=_[_0x7d0e('0x49')](_0x2fa1d3[_0x7d0e('0x34')],_0x2fa1d3[_0x7d0e('0x35')]);_0x38e54a[_0x7d0e('0x39')]=_[_0x7d0e('0x49')](_0x2fa1d3[_0x7d0e('0x34')],qs[_0x7d0e('0x38')](_0x525ae8[_0x7d0e('0x35')][_0x7d0e('0x38')]));_0x38e54a['attributes']=_0x38e54a[_0x7d0e('0x39')][_0x7d0e('0x4a')]?_0x38e54a[_0x7d0e('0x39')]:_0x2fa1d3[_0x7d0e('0x34')];if(_0x525ae8[_0x7d0e('0x35')][_0x7d0e('0x43')]){_0x38e54a[_0x7d0e('0x44')]=[{'all':!![]}];}_0x38e54a=_[_0x7d0e('0x3f')]({},_0x38e54a,_0x525ae8[_0x7d0e('0x42')]);return db[_0x7d0e('0x2f')][_0x7d0e('0x4b')](_0x38e54a)[_0x7d0e('0x25')](handleEntityNotFound(_0x13e2dd,null))[_0x7d0e('0x25')](respondWithResult(_0x13e2dd,null))['catch'](handleError(_0x13e2dd,null));};exports[_0x7d0e('0x4c')]=function(_0x222e92,_0x95b983){return db['Disposition']['create'](_0x222e92[_0x7d0e('0x4d')],{})[_0x7d0e('0x25')](function(_0x2e3ceb){var _0x2e7422=_0x222e92[_0x7d0e('0x4e')]['get']({'plain':!![]});if(!_0x2e7422)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e7422[_0x7d0e('0x4f')]===_0x7d0e('0x4e')){var _0x38ab1c=_0x2e3ceb[_0x7d0e('0x26')]({'plain':!![]});var _0xea6a21=_0x7d0e('0x27');return db[_0x7d0e('0x50')][_0x7d0e('0x4b')]({'where':{'name':_0xea6a21,'userProfileId':_0x2e7422['userProfileId']},'raw':!![]})[_0x7d0e('0x25')](function(_0x4ebb3c){if(_0x4ebb3c&&_0x4ebb3c[_0x7d0e('0x51')]===0x0){return db[_0x7d0e('0x28')][_0x7d0e('0x4c')]({'name':_0x38ab1c[_0x7d0e('0x2b')],'resourceId':_0x38ab1c['id'],'type':_0x4ebb3c[_0x7d0e('0x2b')],'sectionId':_0x4ebb3c['id']},{})[_0x7d0e('0x25')](function(){return _0x2e3ceb;});}else{return _0x2e3ceb;}})[_0x7d0e('0x52')](function(_0x571765){logger[_0x7d0e('0x29')](_0x7d0e('0x53'),_0x571765);throw _0x571765;});}return _0x2e3ceb;})[_0x7d0e('0x25')](respondWithResult(_0x95b983,0xc9))[_0x7d0e('0x52')](handleError(_0x95b983,null));};exports[_0x7d0e('0x54')]=function(_0x218c66,_0x2f49ed){if(_0x218c66[_0x7d0e('0x4d')]['id']){delete _0x218c66['body']['id'];}return db[_0x7d0e('0x2f')][_0x7d0e('0x4b')]({'where':{'id':_0x218c66[_0x7d0e('0x48')]['id']}})[_0x7d0e('0x25')](handleEntityNotFound(_0x2f49ed,null))[_0x7d0e('0x25')](saveUpdates(_0x218c66[_0x7d0e('0x4d')],null))['then'](respondWithResult(_0x2f49ed,null))[_0x7d0e('0x52')](handleError(_0x2f49ed,null));};exports[_0x7d0e('0x55')]=function(_0x31a557,_0x18817c){return db['Disposition'][_0x7d0e('0x4b')]({'where':{'id':_0x31a557[_0x7d0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x18817c,null))[_0x7d0e('0x25')](removeEntity(_0x18817c,null))['catch'](handleError(_0x18817c,null));}; \ No newline at end of file +var _0x2a8d=['order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4ae2b5,_0x18e250){var _0x452abe=function(_0x503a72){while(--_0x503a72){_0x4ae2b5['push'](_0x4ae2b5['shift']());}};_0x452abe(++_0x18e250);}(_0x2a8d,0xbe));var _0xd2a8=function(_0x4b869a,_0x1f993d){_0x4b869a=_0x4b869a-0x0;var _0x10d713=_0x2a8d[_0x4b869a];return _0x10d713;};'use strict';var emlformat=require(_0xd2a8('0x0'));var rimraf=require(_0xd2a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2a8('0x2'));var BPromise=require(_0xd2a8('0x3'));var Mustache=require(_0xd2a8('0x4'));var util=require(_0xd2a8('0x5'));var path=require('path');var sox=require(_0xd2a8('0x6'));var csv=require('to-csv');var ejs=require(_0xd2a8('0x7'));var fs=require('fs');var fs_extra=require(_0xd2a8('0x8'));var _=require(_0xd2a8('0x9'));var squel=require('squel');var crypto=require(_0xd2a8('0xa'));var jsforce=require(_0xd2a8('0xb'));var deskjs=require(_0xd2a8('0xc'));var toCsv=require(_0xd2a8('0xd'));var querystring=require('querystring');var Papa=require(_0xd2a8('0xe'));var Redis=require(_0xd2a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd2a8('0x10'));var as=require(_0xd2a8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd2a8('0x12'));var utils=require('../../config/utils');var config=require(_0xd2a8('0x13'));var licenseUtil=require(_0xd2a8('0x14'));var db=require(_0xd2a8('0x15'))['db'];function respondWithStatusCode(_0x52b12d,_0x1663c7){_0x1663c7=_0x1663c7||0xcc;return function(_0x48773a){if(_0x48773a){return _0x52b12d['sendStatus'](_0x1663c7);}return _0x52b12d[_0xd2a8('0x16')](_0x1663c7)[_0xd2a8('0x17')]();};}function respondWithResult(_0x132609,_0x6b6561){_0x6b6561=_0x6b6561||0xc8;return function(_0x5accea){if(_0x5accea){return _0x132609['status'](_0x6b6561)[_0xd2a8('0x18')](_0x5accea);}};}function respondWithFilteredResult(_0x5027a7,_0x16daa1){return function(_0x11bd4f){if(_0x11bd4f){var _0x5d2947=typeof _0x16daa1[_0xd2a8('0x19')]===_0xd2a8('0x1a')&&typeof _0x16daa1[_0xd2a8('0x1b')]===_0xd2a8('0x1a');var _0x497a5e=_0x11bd4f[_0xd2a8('0x1c')];var _0x266373=_0x5d2947?0x0:_0x16daa1['offset'];var _0x5ce962=_0x5d2947?_0x11bd4f[_0xd2a8('0x1c')]:_0x16daa1[_0xd2a8('0x19')]+_0x16daa1[_0xd2a8('0x1b')];var _0x422bd4;if(_0x5ce962>=_0x497a5e){_0x5ce962=_0x497a5e;_0x422bd4=0xc8;}else{_0x422bd4=0xce;}_0x5027a7[_0xd2a8('0x16')](_0x422bd4);return _0x5027a7[_0xd2a8('0x1d')](_0xd2a8('0x1e'),_0x266373+'-'+_0x5ce962+'/'+_0x497a5e)[_0xd2a8('0x18')](_0x11bd4f);}return null;};}function patchUpdates(_0x42b8bc){return function(_0x22088c){try{jsonpatch[_0xd2a8('0x1f')](_0x22088c,_0x42b8bc,!![]);}catch(_0x47e9af){return BPromise[_0xd2a8('0x20')](_0x47e9af);}return _0x22088c[_0xd2a8('0x21')]();};}function saveUpdates(_0x45bb78,_0x3e7045){return function(_0x2eeba9){if(_0x2eeba9){return _0x2eeba9[_0xd2a8('0x22')](_0x45bb78)[_0xd2a8('0x23')](function(_0x412380){return _0x412380;});}return null;};}function removeEntity(_0x438a3a,_0x51658b){return function(_0x47ea5a){if(_0x47ea5a){return _0x47ea5a[_0xd2a8('0x24')]()['then'](function(){var _0x56c569=_0x47ea5a[_0xd2a8('0x25')]({'plain':!![]});var _0x3e5c56=_0xd2a8('0x26');return db[_0xd2a8('0x27')][_0xd2a8('0x24')]({'where':{'type':_0x3e5c56,'resourceId':_0x56c569['id']}})[_0xd2a8('0x23')](function(){return _0x47ea5a;});})[_0xd2a8('0x23')](function(){_0x438a3a[_0xd2a8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d59b,_0x19f330){return function(_0x1776f6){if(!_0x1776f6){_0x52d59b[_0xd2a8('0x28')](0x194);}return _0x1776f6;};}function handleError(_0x689b8b,_0x1a0f70){_0x1a0f70=_0x1a0f70||0x1f4;return function(_0x112d0c){logger[_0xd2a8('0x29')](_0x112d0c['stack']);if(_0x112d0c['name']){delete _0x112d0c[_0xd2a8('0x2a')];}_0x689b8b[_0xd2a8('0x16')](_0x1a0f70)[_0xd2a8('0x2b')](_0x112d0c);};}exports['index']=function(_0x1306fe,_0x475cdf){var _0x23d90b={},_0x9e118c={},_0x456ba2={'count':0x0,'rows':[]};var _0x20d2db=_[_0xd2a8('0x2c')](db[_0xd2a8('0x2d')][_0xd2a8('0x2e')],function(_0x412246){return{'name':_0x412246[_0xd2a8('0x2f')],'type':_0x412246[_0xd2a8('0x30')][_0xd2a8('0x31')]};});_0x9e118c[_0xd2a8('0x32')]=_[_0xd2a8('0x2c')](_0x20d2db,_0xd2a8('0x2a'));_0x9e118c[_0xd2a8('0x33')]=_['keys'](_0x1306fe[_0xd2a8('0x33')]);_0x9e118c[_0xd2a8('0x34')]=_[_0xd2a8('0x35')](_0x9e118c['model'],_0x9e118c[_0xd2a8('0x33')]);_0x23d90b[_0xd2a8('0x36')]=_[_0xd2a8('0x35')](_0x9e118c[_0xd2a8('0x32')],qs[_0xd2a8('0x37')](_0x1306fe[_0xd2a8('0x33')][_0xd2a8('0x37')]));_0x23d90b[_0xd2a8('0x36')]=_0x23d90b[_0xd2a8('0x36')][_0xd2a8('0x38')]?_0x23d90b[_0xd2a8('0x36')]:_0x9e118c['model'];if(!_0x1306fe['query'][_0xd2a8('0x39')](_0xd2a8('0x3a'))){_0x23d90b[_0xd2a8('0x1b')]=qs['limit'](_0x1306fe[_0xd2a8('0x33')][_0xd2a8('0x1b')]);_0x23d90b[_0xd2a8('0x19')]=qs[_0xd2a8('0x19')](_0x1306fe['query'][_0xd2a8('0x19')]);}_0x23d90b[_0xd2a8('0x3b')]=qs[_0xd2a8('0x3c')](_0x1306fe[_0xd2a8('0x33')][_0xd2a8('0x3c')]);_0x23d90b[_0xd2a8('0x3d')]=qs[_0xd2a8('0x34')](_['pick'](_0x1306fe['query'],_0x9e118c[_0xd2a8('0x34')]),_0x20d2db);if(_0x1306fe[_0xd2a8('0x33')][_0xd2a8('0x3e')]){_0x23d90b[_0xd2a8('0x3d')]=_[_0xd2a8('0x3f')](_0x23d90b[_0xd2a8('0x3d')],{'$or':_[_0xd2a8('0x2c')](_0x20d2db,function(_0x98c4e3){if(_0x98c4e3[_0xd2a8('0x30')]!==_0xd2a8('0x40')){var _0x5906cb={};_0x5906cb[_0x98c4e3[_0xd2a8('0x2a')]]={'$like':'%'+_0x1306fe[_0xd2a8('0x33')]['filter']+'%'};return _0x5906cb;}})});}_0x23d90b=_[_0xd2a8('0x3f')]({},_0x23d90b,_0x1306fe[_0xd2a8('0x41')]);var _0x27cefe={'where':_0x23d90b[_0xd2a8('0x3d')]};return db[_0xd2a8('0x2d')][_0xd2a8('0x1c')](_0x27cefe)[_0xd2a8('0x23')](function(_0x83da28){_0x456ba2['count']=_0x83da28;if(_0x1306fe['query']['includeAll']){_0x23d90b[_0xd2a8('0x42')]=[{'all':!![]}];}return db[_0xd2a8('0x2d')]['findAll'](_0x23d90b);})['then'](function(_0x3f8085){_0x456ba2[_0xd2a8('0x43')]=_0x3f8085;return _0x456ba2;})[_0xd2a8('0x23')](respondWithFilteredResult(_0x475cdf,_0x23d90b))[_0xd2a8('0x44')](handleError(_0x475cdf,null));};exports[_0xd2a8('0x45')]=function(_0x42c22e,_0x4b2d64){var _0x5822be={'raw':!![],'where':{'id':_0x42c22e[_0xd2a8('0x46')]['id']}},_0x1b0c47={};_0x1b0c47[_0xd2a8('0x32')]=_[_0xd2a8('0x47')](db[_0xd2a8('0x2d')]['rawAttributes']);_0x1b0c47[_0xd2a8('0x33')]=_[_0xd2a8('0x47')](_0x42c22e[_0xd2a8('0x33')]);_0x1b0c47[_0xd2a8('0x34')]=_[_0xd2a8('0x35')](_0x1b0c47[_0xd2a8('0x32')],_0x1b0c47['query']);_0x5822be[_0xd2a8('0x36')]=_[_0xd2a8('0x35')](_0x1b0c47['model'],qs[_0xd2a8('0x37')](_0x42c22e[_0xd2a8('0x33')][_0xd2a8('0x37')]));_0x5822be['attributes']=_0x5822be[_0xd2a8('0x36')][_0xd2a8('0x38')]?_0x5822be[_0xd2a8('0x36')]:_0x1b0c47['model'];if(_0x42c22e['query'][_0xd2a8('0x48')]){_0x5822be[_0xd2a8('0x42')]=[{'all':!![]}];}_0x5822be=_['merge']({},_0x5822be,_0x42c22e[_0xd2a8('0x41')]);return db['Disposition']['find'](_0x5822be)[_0xd2a8('0x23')](handleEntityNotFound(_0x4b2d64,null))['then'](respondWithResult(_0x4b2d64,null))[_0xd2a8('0x44')](handleError(_0x4b2d64,null));};exports[_0xd2a8('0x49')]=function(_0x49d5bb,_0x1c2d9b){return db[_0xd2a8('0x2d')][_0xd2a8('0x49')](_0x49d5bb[_0xd2a8('0x4a')],{})[_0xd2a8('0x23')](function(_0x43f203){var _0x42975c=_0x49d5bb[_0xd2a8('0x4b')][_0xd2a8('0x25')]({'plain':!![]});if(!_0x42975c)throw new Error(_0xd2a8('0x4c'));if(_0x42975c[_0xd2a8('0x4d')]===_0xd2a8('0x4b')){var _0x2f3332=_0x43f203[_0xd2a8('0x25')]({'plain':!![]});var _0x28a974='Dispositions';return db[_0xd2a8('0x4e')]['find']({'where':{'name':_0x28a974,'userProfileId':_0x42975c[_0xd2a8('0x4f')]},'raw':!![]})[_0xd2a8('0x23')](function(_0x29b710){if(_0x29b710&&_0x29b710[_0xd2a8('0x50')]===0x0){return db[_0xd2a8('0x27')]['create']({'name':_0x2f3332[_0xd2a8('0x2a')],'resourceId':_0x2f3332['id'],'type':_0x29b710['name'],'sectionId':_0x29b710['id']},{})[_0xd2a8('0x23')](function(){return _0x43f203;});}else{return _0x43f203;}})['catch'](function(_0x325c47){logger[_0xd2a8('0x29')](_0xd2a8('0x51'),_0x325c47);throw _0x325c47;});}return _0x43f203;})[_0xd2a8('0x23')](respondWithResult(_0x1c2d9b,0xc9))[_0xd2a8('0x44')](handleError(_0x1c2d9b,null));};exports[_0xd2a8('0x22')]=function(_0x3299c2,_0x100c07){if(_0x3299c2[_0xd2a8('0x4a')]['id']){delete _0x3299c2[_0xd2a8('0x4a')]['id'];}return db[_0xd2a8('0x2d')][_0xd2a8('0x52')]({'where':{'id':_0x3299c2[_0xd2a8('0x46')]['id']}})[_0xd2a8('0x23')](handleEntityNotFound(_0x100c07,null))[_0xd2a8('0x23')](saveUpdates(_0x3299c2['body'],null))[_0xd2a8('0x23')](respondWithResult(_0x100c07,null))[_0xd2a8('0x44')](handleError(_0x100c07,null));};exports[_0xd2a8('0x24')]=function(_0x3c0b23,_0x52c0ca){return db[_0xd2a8('0x2d')][_0xd2a8('0x52')]({'where':{'id':_0x3c0b23[_0xd2a8('0x46')]['id']}})[_0xd2a8('0x23')](handleEntityNotFound(_0x52c0ca,null))[_0xd2a8('0x23')](removeEntity(_0x52c0ca,null))[_0xd2a8('0x44')](handleError(_0x52c0ca,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3e80d37..e3afe5e 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 _0x5bba=['../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4bbaf9,_0x5d3179){var _0x1112a8=function(_0x25c54b){while(--_0x25c54b){_0x4bbaf9['push'](_0x4bbaf9['shift']());}};_0x1112a8(++_0x5d3179);}(_0x5bba,0x9b));var _0xa5bb=function(_0x5248fe,_0x340151){_0x5248fe=_0x5248fe-0x0;var _0x11448d=_0x5bba[_0x5248fe];return _0x11448d;};'use strict';var _=require('lodash');var util=require(_0xa5bb('0x0'));var logger=require(_0xa5bb('0x1'))(_0xa5bb('0x2'));var moment=require(_0xa5bb('0x3'));var BPromise=require('bluebird');var rp=require(_0xa5bb('0x4'));var fs=require('fs');var path=require(_0xa5bb('0x5'));var rimraf=require(_0xa5bb('0x6'));var config=require(_0xa5bb('0x7'));var attributes=require(_0xa5bb('0x8'));module[_0xa5bb('0x9')]=function(_0x3993f7,_0x1e667a){return _0x3993f7[_0xa5bb('0xa')](_0xa5bb('0xb'),attributes,{'tableName':_0xa5bb('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa5bb('0xd'),'fields':['name',_0xa5bb('0xe')]},{'unique':!![],'name':_0xa5bb('0xf'),'fields':[_0xa5bb('0x10'),_0xa5bb('0x11')]},{'unique':!![],'name':_0xa5bb('0x12'),'fields':[_0xa5bb('0x10'),_0xa5bb('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0xa5bb('0x10'),_0xa5bb('0x14')]},{'unique':!![],'name':_0xa5bb('0x15'),'fields':[_0xa5bb('0x10'),_0xa5bb('0x16')]},{'unique':!![],'name':_0xa5bb('0x17'),'fields':['name',_0xa5bb('0x18')]},{'unique':!![],'name':_0xa5bb('0x19'),'fields':[_0xa5bb('0x10'),_0xa5bb('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05a2=['util','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x543fd7,_0x15f9e7){var _0x24d322=function(_0xe55c67){while(--_0xe55c67){_0x543fd7['push'](_0x543fd7['shift']());}};_0x24d322(++_0x15f9e7);}(_0x05a2,0x112));var _0x205a=function(_0x31ccaf,_0x3db6d8){_0x31ccaf=_0x31ccaf-0x0;var _0x49b874=_0x05a2[_0x31ccaf];return _0x49b874;};'use strict';var _=require(_0x205a('0x0'));var util=require(_0x205a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x205a('0x2'));var BPromise=require(_0x205a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x205a('0x4'));var rimraf=require(_0x205a('0x5'));var config=require(_0x205a('0x6'));var attributes=require(_0x205a('0x7'));module[_0x205a('0x8')]=function(_0x5ea625,_0x11b93d){return _0x5ea625[_0x205a('0x9')](_0x205a('0xa'),attributes,{'tableName':_0x205a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x205a('0xc'),_0x205a('0xd')]},{'unique':!![],'name':_0x205a('0xe'),'fields':[_0x205a('0xc'),_0x205a('0xf')]},{'unique':!![],'name':_0x205a('0x10'),'fields':[_0x205a('0xc'),_0x205a('0x11')]},{'unique':!![],'name':_0x205a('0x12'),'fields':[_0x205a('0xc'),_0x205a('0x13')]},{'unique':!![],'name':_0x205a('0x14'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x205a('0x15'),'fields':[_0x205a('0xc'),_0x205a('0x16')]},{'unique':!![],'name':_0x205a('0x17'),'fields':[_0x205a('0xc'),_0x205a('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a5cfb29..4cf36d7 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(_0x197fcf,_0xc1a6b){var _0x45d2c7=function(_0xdcf261){while(--_0xdcf261){_0x197fcf['push'](_0x197fcf['shift']());}};_0x45d2c7(++_0xc1a6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x1a7b30,_0x3ae1a3){var _0x5ed04d=function(_0x1b36dd){while(--_0x1b36dd){_0x1a7b30['push'](_0x1a7b30['shift']());}};_0x5ed04d(++_0x3ae1a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 82837c7..a73d3e1 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 _0xbe64=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','multer'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xbe64,0x19d));var _0x4be6=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xbe64[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0x4be6('0x0'));var util=require(_0x4be6('0x1'));var path=require(_0x4be6('0x2'));var timeout=require('connect-timeout');var express=require(_0x4be6('0x3'));var router=express[_0x4be6('0x4')]();var fs_extra=require(_0x4be6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4be6('0x6'));var config=require(_0x4be6('0x7'));var controller=require(_0x4be6('0x8'));router[_0x4be6('0x9')]('/',auth['isAuthenticated'](),controller[_0x4be6('0xa')]);router['get'](_0x4be6('0xb'),auth[_0x4be6('0xc')](),controller[_0x4be6('0xd')]);router[_0x4be6('0xe')]('/',auth[_0x4be6('0xc')](),controller['create']);router[_0x4be6('0xf')]('/:id',auth[_0x4be6('0xc')](),controller[_0x4be6('0x10')]);router['delete'](_0x4be6('0xb'),auth['isAuthenticated'](),controller[_0x4be6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6b61=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x94d732,_0x288107){var _0x4cf3f9=function(_0x1554b0){while(--_0x1554b0){_0x94d732['push'](_0x94d732['shift']());}};_0x4cf3f9(++_0x288107);}(_0x6b61,0x81));var _0x16b6=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6b61[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x16b6('0x0'));var util=require(_0x16b6('0x1'));var path=require(_0x16b6('0x2'));var timeout=require(_0x16b6('0x3'));var express=require(_0x16b6('0x4'));var router=express[_0x16b6('0x5')]();var fs_extra=require(_0x16b6('0x6'));var auth=require(_0x16b6('0x7'));var interaction=require(_0x16b6('0x8'));var config=require(_0x16b6('0x9'));var controller=require(_0x16b6('0xa'));router[_0x16b6('0xb')]('/',auth[_0x16b6('0xc')](),controller[_0x16b6('0xd')]);router[_0x16b6('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x16b6('0xe')]('/',auth[_0x16b6('0xc')](),controller[_0x16b6('0xf')]);router[_0x16b6('0x10')](_0x16b6('0x11'),auth['isAuthenticated'](),controller[_0x16b6('0x12')]);router[_0x16b6('0x13')](_0x16b6('0x11'),auth[_0x16b6('0xc')](),controller[_0x16b6('0x14')]);module[_0x16b6('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 849ee10..c3d30a1 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 _0x9536=['4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM'];(function(_0x518b3e,_0x33e545){var _0x682c8e=function(_0x969e2c){while(--_0x969e2c){_0x518b3e['push'](_0x518b3e['shift']());}};_0x682c8e(++_0x33e545);}(_0x9536,0x179));var _0x6953=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x9536[_0x43a5c7];return _0x3b12a2;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6953('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x6953('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6953('0x2')],'defaultValue':_0x6953('0x4')},'localstationid':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x5')},'minrate':{'type':Sequelize[_0x6953('0x6')]('2400',_0x6953('0x7'),_0x6953('0x8'),_0x6953('0x9'),_0x6953('0xa'),_0x6953('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6953('0x6')](_0x6953('0xc'),_0x6953('0x7'),'7200',_0x6953('0x9'),_0x6953('0xa'),_0x6953('0xb')),'defaultValue':_0x6953('0xb')},'modem':{'type':Sequelize[_0x6953('0x2')],'defaultValue':_0x6953('0xd')},'gateway':{'type':Sequelize[_0x6953('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6953('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6953('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6953('0xf'),'IAX',_0x6953('0x10'),_0x6953('0x11')),'defaultValue':_0x6953('0xf')},'key':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6953('0x12')],'defaultValue':function(){return _0x6953('0x13');}},'notificationSound':{'type':Sequelize[_0x6953('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6953('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x6953('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b6dcb){if(!_0x1b6dcb)this[_0x6953('0x16')]('mandatoryDispositionPauseId',null);this[_0x6953('0x16')](_0x6953('0x17'),_0x1b6dcb);}}}; \ No newline at end of file +var _0xb138=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','INTEGER','SIP','IAX','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x3e0093,_0x35ad34){var _0x68ec8a=function(_0x282cfa){while(--_0x282cfa){_0x3e0093['push'](_0x3e0093['shift']());}};_0x68ec8a(++_0x35ad34);}(_0xb138,0x1dd));var _0x8b13=function(_0x51ab33,_0x71a8a8){_0x51ab33=_0x51ab33-0x0;var _0x5e1298=_0xb138[_0x51ab33];return _0x5e1298;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8b13('0x2')]},'ecm':{'type':Sequelize[_0x8b13('0x3')](_0x8b13('0x4'),'no'),'defaultValue':_0x8b13('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8b13('0x5')},'localstationid':{'type':Sequelize[_0x8b13('0x2')],'unique':_0x8b13('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x8b13('0x7'),_0x8b13('0x8'),'7200',_0x8b13('0x9'),_0x8b13('0xa'),_0x8b13('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x8b13('0x3')](_0x8b13('0x7'),'4800','7200',_0x8b13('0x9'),_0x8b13('0xa'),_0x8b13('0xb')),'defaultValue':_0x8b13('0xb')},'modem':{'type':Sequelize[_0x8b13('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8b13('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8b13('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8b13('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8b13('0x3')](_0x8b13('0xd'),_0x8b13('0xe'),'DADHI','KHOMP'),'defaultValue':_0x8b13('0xd')},'key':{'type':Sequelize[_0x8b13('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b13('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b13('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8b13('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8b13('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b13('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8b13('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b13('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x8b13('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x8b13('0xf')],'defaultValue':![],'comment':_0x8b13('0x11'),'set':function(_0x1fcfe6){if(!_0x1fcfe6)this[_0x8b13('0x12')](_0x8b13('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x1fcfe6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f2e76a0..3a0cbd3 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 _0xe667=['READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','localstationid','type','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','omit','tech','key','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','Owner','fullname','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS'];(function(_0x455853,_0x12941e){var _0x36284a=function(_0x2d93ba){while(--_0x2d93ba){_0x455853['push'](_0x455853['shift']());}};_0x36284a(++_0x12941e);}(_0xe667,0x112));var _0x7e66=function(_0x2fd74b,_0x3ab562){_0x2fd74b=_0x2fd74b-0x0;var _0x4ad895=_0xe667[_0x2fd74b];return _0x4ad895;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e66('0x0'));var rp=require('request-promise');var moment=require(_0x7e66('0x1'));var BPromise=require(_0x7e66('0x2'));var Mustache=require(_0x7e66('0x3'));var util=require(_0x7e66('0x4'));var path=require(_0x7e66('0x5'));var sox=require(_0x7e66('0x6'));var csv=require(_0x7e66('0x7'));var ejs=require(_0x7e66('0x8'));var fs=require('fs');var fs_extra=require(_0x7e66('0x9'));var _=require('lodash');var squel=require(_0x7e66('0xa'));var crypto=require(_0x7e66('0xb'));var jsforce=require(_0x7e66('0xc'));var deskjs=require(_0x7e66('0xd'));var toCsv=require(_0x7e66('0x7'));var querystring=require(_0x7e66('0xe'));var Papa=require(_0x7e66('0xf'));var Redis=require(_0x7e66('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e66('0x11'));var as=require(_0x7e66('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7e66('0x13'));var config=require(_0x7e66('0x14'));var licenseUtil=require(_0x7e66('0x15'));var db=require(_0x7e66('0x16'))['db'];config[_0x7e66('0x17')]=_[_0x7e66('0x18')](config['redis'],{'host':_0x7e66('0x19'),'port':0x18eb});var socket=require(_0x7e66('0x1a'))(new Redis(config[_0x7e66('0x17')]));require('./faxAccount.socket')[_0x7e66('0x1b')](socket);var jayson=require(_0x7e66('0x1c'));var client=jayson[_0x7e66('0x1d')][_0x7e66('0x1e')]({'port':0x232c});var client9002=jayson[_0x7e66('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x401c00,_0x1c9f47,_0x4f7044,_0x4c0953){return new BPromise(function(_0x3bf5c4,_0x32dec4){var _0x18408e=_0x4c0953||client;return _0x18408e[_0x7e66('0x1f')](_0x401c00,_0x4f7044)[_0x7e66('0x20')](function(_0x8dc6e6){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1c9f47,_0x7e66('0x21'));logger[_0x7e66('0x22')](_0x7e66('0x23'),_0x1c9f47,_0x7e66('0x21'),JSON['stringify'](_0x8dc6e6));if(_0x8dc6e6[_0x7e66('0x24')]){if(_0x8dc6e6['error'][_0x7e66('0x25')]===0x1f4){logger[_0x7e66('0x24')](_0x7e66('0x26'),_0x1c9f47,_0x8dc6e6[_0x7e66('0x24')][_0x7e66('0x27')]);return _0x32dec4(_0x8dc6e6[_0x7e66('0x24')][_0x7e66('0x27')]);}logger[_0x7e66('0x24')]('FaxAccount,\x20%s,\x20%s',_0x1c9f47,_0x8dc6e6[_0x7e66('0x24')]['message']);return _0x3bf5c4(_0x8dc6e6[_0x7e66('0x24')]['message']);}else{logger[_0x7e66('0x28')](_0x7e66('0x26'),_0x1c9f47,_0x7e66('0x21'));_0x3bf5c4(_0x8dc6e6['result'][_0x7e66('0x27')]);}})['catch'](function(_0x511dce){logger[_0x7e66('0x24')](_0x7e66('0x26'),_0x1c9f47,_0x511dce);_0x32dec4(_0x511dce);});});}function respondWithStatusCode(_0x3355ef,_0x4c14a6){_0x4c14a6=_0x4c14a6||0xcc;return function(_0x15d87c){if(_0x15d87c){return _0x3355ef[_0x7e66('0x29')](_0x4c14a6);}return _0x3355ef[_0x7e66('0x2a')](_0x4c14a6)[_0x7e66('0x2b')]();};}function respondWithResult(_0xab6277,_0x5c7201){_0x5c7201=_0x5c7201||0xc8;return function(_0x3ff4f6){if(_0x3ff4f6){return _0xab6277[_0x7e66('0x2a')](_0x5c7201)[_0x7e66('0x2c')](_0x3ff4f6);}};}function respondWithFilteredResult(_0x2a6ad6,_0x314d11){return function(_0x60fca6){if(_0x60fca6){var _0x55ce4e=typeof _0x314d11['offset']===_0x7e66('0x2d')&&typeof _0x314d11[_0x7e66('0x2e')]===_0x7e66('0x2d');var _0x3e59c4=_0x60fca6['count'];var _0x3aa6c1=_0x55ce4e?0x0:_0x314d11[_0x7e66('0x2f')];var _0x15bf98=_0x55ce4e?_0x60fca6[_0x7e66('0x30')]:_0x314d11[_0x7e66('0x2f')]+_0x314d11['limit'];var _0x88d27;if(_0x15bf98>=_0x3e59c4){_0x15bf98=_0x3e59c4;_0x88d27=0xc8;}else{_0x88d27=0xce;}_0x2a6ad6[_0x7e66('0x2a')](_0x88d27);return _0x2a6ad6['set'](_0x7e66('0x31'),_0x3aa6c1+'-'+_0x15bf98+'/'+_0x3e59c4)[_0x7e66('0x2c')](_0x60fca6);}return null;};}function patchUpdates(_0x183797){return function(_0x3fea1e){try{jsonpatch[_0x7e66('0x32')](_0x3fea1e,_0x183797,!![]);}catch(_0x20ae09){return BPromise[_0x7e66('0x33')](_0x20ae09);}return _0x3fea1e[_0x7e66('0x34')]();};}function saveUpdates(_0x4fc307,_0x482f9b){return function(_0x55cc83){if(_0x55cc83){return _0x55cc83[_0x7e66('0x35')](_0x4fc307)[_0x7e66('0x20')](function(_0x224036){return _0x224036;});}return null;};}function removeEntity(_0x550ca1,_0x26c61e){return function(_0x3a16b7){if(_0x3a16b7){return _0x3a16b7[_0x7e66('0x36')]()[_0x7e66('0x20')](function(){var _0x2ec261=_0x3a16b7['get']({'plain':!![]});var _0x2ddddb=_0x7e66('0x37');return db['UserProfileResource'][_0x7e66('0x36')]({'where':{'type':_0x2ddddb,'resourceId':_0x2ec261['id']}})[_0x7e66('0x20')](function(){return _0x3a16b7;});})[_0x7e66('0x20')](function(){_0x550ca1[_0x7e66('0x2a')](0xcc)[_0x7e66('0x2b')]();});}};}function handleEntityNotFound(_0x5f3173,_0x3b6df8){return function(_0x55b6a3){if(!_0x55b6a3){_0x5f3173[_0x7e66('0x29')](0x194);}return _0x55b6a3;};}function handleError(_0x1e68f4,_0x14e5aa){_0x14e5aa=_0x14e5aa||0x1f4;return function(_0x112904){logger['error'](_0x112904[_0x7e66('0x38')]);if(_0x112904[_0x7e66('0x39')]){delete _0x112904[_0x7e66('0x39')];}_0x1e68f4['status'](_0x14e5aa)[_0x7e66('0x3a')](_0x112904);};}exports[_0x7e66('0x3b')]=function(_0x2e1cb7,_0x5afb5b){var _0x22dd14={'include':[{'model':db[_0x7e66('0x3c')],'as':_0x7e66('0x3d')}]},_0x143fdf={},_0x51d0c0={'count':0x0,'rows':[]};var _0x48ce95=_['map'](db[_0x7e66('0x3e')][_0x7e66('0x3f')],function(_0x502645){return{'name':_0x502645[_0x7e66('0x40')],'type':_0x502645['type']['key']};});_0x143fdf[_0x7e66('0x41')]=_[_0x7e66('0x42')](_0x48ce95,'name');_0x143fdf['query']=_['keys'](_0x2e1cb7[_0x7e66('0x43')]);_0x143fdf[_0x7e66('0x44')]=_[_0x7e66('0x45')](_0x143fdf[_0x7e66('0x41')],_0x143fdf[_0x7e66('0x43')]);_0x22dd14[_0x7e66('0x46')]=_['intersection'](_0x143fdf[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x2e1cb7[_0x7e66('0x43')][_0x7e66('0x47')]));_0x22dd14[_0x7e66('0x46')]=_0x22dd14['attributes']['length']?_0x22dd14[_0x7e66('0x46')]:_0x143fdf[_0x7e66('0x41')];if(!_0x2e1cb7['query'][_0x7e66('0x48')](_0x7e66('0x49'))){_0x22dd14[_0x7e66('0x2e')]=qs['limit'](_0x2e1cb7['query'][_0x7e66('0x2e')]);_0x22dd14[_0x7e66('0x2f')]=qs[_0x7e66('0x2f')](_0x2e1cb7['query'][_0x7e66('0x2f')]);}_0x22dd14[_0x7e66('0x4a')]=qs[_0x7e66('0x4b')](_0x2e1cb7[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x22dd14[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_[_0x7e66('0x4d')](_0x2e1cb7[_0x7e66('0x43')],_0x143fdf['filters']),_0x48ce95);if(_0x2e1cb7['query'][_0x7e66('0x4e')]){_0x22dd14[_0x7e66('0x4c')]=_[_0x7e66('0x4f')](_0x22dd14['where'],{'$or':_[_0x7e66('0x42')](_0x48ce95,function(_0x5b70db){if(_0x5b70db['type']!==_0x7e66('0x50')){var _0xf6eb7={};_0xf6eb7[_0x5b70db[_0x7e66('0x39')]]={'$like':'%'+_0x2e1cb7[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0xf6eb7;}})});}_0x22dd14=_[_0x7e66('0x4f')]({},_0x22dd14,_0x2e1cb7[_0x7e66('0x51')]);var _0x1fc6de={'where':_0x22dd14[_0x7e66('0x4c')]};return db[_0x7e66('0x3e')][_0x7e66('0x30')](_0x1fc6de)[_0x7e66('0x20')](function(_0x35e54f){_0x51d0c0[_0x7e66('0x30')]=_0x35e54f;if(_0x2e1cb7[_0x7e66('0x43')][_0x7e66('0x52')]){_0x22dd14['include']=[{'all':!![]}];}return db[_0x7e66('0x3e')]['findAll'](_0x22dd14);})[_0x7e66('0x20')](function(_0x524f02){_0x51d0c0[_0x7e66('0x53')]=_0x524f02;return _0x51d0c0;})[_0x7e66('0x20')](respondWithFilteredResult(_0x5afb5b,_0x22dd14))[_0x7e66('0x54')](handleError(_0x5afb5b,null));};exports[_0x7e66('0x55')]=function(_0x387bba,_0x3af5f9){var _0x46bf7d={'raw':![],'where':{'id':_0x387bba[_0x7e66('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x7e66('0x3d')}]},_0x608578={};_0x608578[_0x7e66('0x41')]=_[_0x7e66('0x57')](db[_0x7e66('0x3e')][_0x7e66('0x3f')]);_0x608578[_0x7e66('0x43')]=_[_0x7e66('0x57')](_0x387bba[_0x7e66('0x43')]);_0x608578[_0x7e66('0x44')]=_[_0x7e66('0x45')](_0x608578[_0x7e66('0x41')],_0x608578['query']);_0x46bf7d[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x608578[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x387bba['query'][_0x7e66('0x47')]));_0x46bf7d[_0x7e66('0x46')]=_0x46bf7d['attributes'][_0x7e66('0x58')]?_0x46bf7d[_0x7e66('0x46')]:_0x608578[_0x7e66('0x41')];if(_0x387bba[_0x7e66('0x43')]['includeAll']){_0x46bf7d[_0x7e66('0x59')]=[{'all':!![]}];}_0x46bf7d=_['merge']({},_0x46bf7d,_0x387bba[_0x7e66('0x51')]);return db[_0x7e66('0x3e')][_0x7e66('0x5a')](_0x46bf7d)[_0x7e66('0x20')](handleEntityNotFound(_0x3af5f9,null))[_0x7e66('0x20')](respondWithResult(_0x3af5f9,null))[_0x7e66('0x54')](handleError(_0x3af5f9,null));};exports['create']=function(_0x3f1f4a,_0x1be4d3){return db[_0x7e66('0x3e')][_0x7e66('0x5b')](_0x3f1f4a[_0x7e66('0x5c')],{})[_0x7e66('0x20')](function(_0x45c2c3){var _0x3f53fb=_0x3f1f4a['user'][_0x7e66('0x5d')]({'plain':!![]});if(!_0x3f53fb)throw new Error(_0x7e66('0x5e'));if(_0x3f53fb[_0x7e66('0x5f')]===_0x7e66('0x60')){var _0x3eb7be=_0x45c2c3[_0x7e66('0x5d')]({'plain':!![]});var _0x37b721=_0x7e66('0x37');return db[_0x7e66('0x61')]['find']({'where':{'name':_0x37b721,'userProfileId':_0x3f53fb[_0x7e66('0x62')]},'raw':!![]})[_0x7e66('0x20')](function(_0x405ae0){if(_0x405ae0&&_0x405ae0[_0x7e66('0x63')]===0x0){return db[_0x7e66('0x64')][_0x7e66('0x5b')]({'name':_0x3eb7be[_0x7e66('0x39')],'resourceId':_0x3eb7be['id'],'type':_0x405ae0[_0x7e66('0x39')],'sectionId':_0x405ae0['id']},{})[_0x7e66('0x20')](function(){return _0x45c2c3;});}else{return _0x45c2c3;}})[_0x7e66('0x54')](function(_0x836880){logger[_0x7e66('0x24')](_0x7e66('0x65'),_0x836880);throw _0x836880;});}return _0x45c2c3;})[_0x7e66('0x20')](respondWithResult(_0x1be4d3,0xc9))[_0x7e66('0x54')](handleError(_0x1be4d3,null));};exports[_0x7e66('0x35')]=function(_0x2dbe0e,_0x26d15c){if(_0x2dbe0e['body']['id']){delete _0x2dbe0e['body']['id'];}return db[_0x7e66('0x3e')]['find']({'where':{'id':_0x2dbe0e[_0x7e66('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x7e66('0x3d')}]})['then'](handleEntityNotFound(_0x26d15c,null))['then'](saveUpdates(_0x2dbe0e[_0x7e66('0x5c')],null))['then'](respondWithResult(_0x26d15c,null))['catch'](handleError(_0x26d15c,null));};exports['destroy']=function(_0x4cad55,_0x320c4c){return db[_0x7e66('0x3e')]['find']({'where':{'id':_0x4cad55[_0x7e66('0x56')]['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x320c4c,null))[_0x7e66('0x20')](removeEntity(_0x320c4c,null))['catch'](handleError(_0x320c4c,null));};exports['describe']=function(_0x3e75c9,_0x4c4cf3){return db[_0x7e66('0x3e')]['describe']()['then'](respondWithResult(_0x4c4cf3,null))[_0x7e66('0x54')](handleError(_0x4c4cf3,null));};exports['addDisposition']=function(_0x49a4a7,_0x19b1de,_0x1dbfba){if(_0x49a4a7[_0x7e66('0x5c')]['id']){delete _0x49a4a7['body']['id'];}return db['FaxAccount'][_0x7e66('0x5a')]({'where':{'id':_0x49a4a7[_0x7e66('0x56')]['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x19b1de,null))[_0x7e66('0x20')](function(_0x53d077){if(_0x53d077){_0x49a4a7[_0x7e66('0x5c')][_0x7e66('0x66')]=_0x53d077['id'];return db[_0x7e66('0x67')][_0x7e66('0x5b')](_0x49a4a7['body']);}})[_0x7e66('0x20')](respondWithResult(_0x19b1de,null))[_0x7e66('0x54')](handleError(_0x19b1de,null));};exports[_0x7e66('0x68')]=function(_0x793f5f,_0x76aaed,_0x4e891f){var _0x48aa50={'raw':![],'where':{}};var _0x53a7a5={};var _0x38f73a={'count':0x0,'rows':[]};return db[_0x7e66('0x3e')][_0x7e66('0x69')]({'where':{'id':_0x793f5f[_0x7e66('0x56')]['id']}})['then'](handleEntityNotFound(_0x76aaed,null))['then'](function(_0x2e498b){if(_0x2e498b){_0x53a7a5[_0x7e66('0x41')]=_[_0x7e66('0x57')](db[_0x7e66('0x67')][_0x7e66('0x3f')]);_0x53a7a5['query']=_['keys'](_0x793f5f[_0x7e66('0x43')]);_0x53a7a5[_0x7e66('0x44')]=_[_0x7e66('0x45')](_0x53a7a5['model'],_0x53a7a5['query']);_0x48aa50[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x53a7a5[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x793f5f[_0x7e66('0x43')][_0x7e66('0x47')]));_0x48aa50[_0x7e66('0x46')]=_0x48aa50[_0x7e66('0x46')][_0x7e66('0x58')]?_0x48aa50[_0x7e66('0x46')]:_0x53a7a5[_0x7e66('0x41')];if(!_0x793f5f[_0x7e66('0x43')][_0x7e66('0x48')](_0x7e66('0x49'))){_0x48aa50['limit']=qs[_0x7e66('0x2e')](_0x793f5f[_0x7e66('0x43')]['limit']);_0x48aa50[_0x7e66('0x2f')]=qs[_0x7e66('0x2f')](_0x793f5f[_0x7e66('0x43')]['offset']);}_0x48aa50[_0x7e66('0x4a')]=qs['sort'](_0x793f5f[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x48aa50[_0x7e66('0x4c')]=qs['filters'](_[_0x7e66('0x4d')](_0x793f5f[_0x7e66('0x43')],_0x53a7a5[_0x7e66('0x44')]));_0x48aa50[_0x7e66('0x4c')][_0x7e66('0x66')]=_0x2e498b['id'];if(_0x793f5f[_0x7e66('0x43')][_0x7e66('0x4e')]){_0x48aa50['where']=_['merge'](_0x48aa50[_0x7e66('0x4c')],{'$or':_[_0x7e66('0x42')](_0x48aa50[_0x7e66('0x46')],function(_0x3525e0){var _0x1395f0={};_0x1395f0[_0x3525e0]={'$like':'%'+_0x793f5f[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x1395f0;})});}_0x48aa50=_[_0x7e66('0x4f')]({},_0x48aa50,_0x793f5f['options']);return db[_0x7e66('0x67')][_0x7e66('0x30')]({'where':_0x48aa50['where']})['then'](function(_0x10e6fe){_0x38f73a[_0x7e66('0x30')]=_0x10e6fe;if(_0x793f5f[_0x7e66('0x43')]['includeAll']){_0x48aa50[_0x7e66('0x59')]=[{'all':!![]}];}return db[_0x7e66('0x67')][_0x7e66('0x6a')](_0x48aa50);})[_0x7e66('0x20')](function(_0x57887d){_0x38f73a[_0x7e66('0x53')]=_0x57887d;return _0x38f73a;});}})[_0x7e66('0x20')](respondWithFilteredResult(_0x76aaed,_0x48aa50))['catch'](handleError(_0x76aaed,null));};exports[_0x7e66('0x6b')]=function(_0xf36034,_0x35704d,_0x42301f){return db[_0x7e66('0x3e')][_0x7e66('0x5a')]({'where':{'id':_0xf36034[_0x7e66('0x56')]['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x35704d,null))[_0x7e66('0x20')](function(_0x24b9ec){if(_0x24b9ec){return _0x24b9ec[_0x7e66('0x6b')](_0xf36034['query']['ids']);}})['then'](respondWithStatusCode(_0x35704d,null))[_0x7e66('0x54')](handleError(_0x35704d,null));};exports[_0x7e66('0x6c')]=function(_0x234273,_0x37eb8b,_0xf3de57){if(_0x234273['body']['id']){delete _0x234273['body']['id'];}return db[_0x7e66('0x3e')][_0x7e66('0x5a')]({'where':{'id':_0x234273['params']['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x37eb8b,null))['then'](function(_0x4d6f82){if(_0x4d6f82){_0x234273['body'][_0x7e66('0x66')]=_0x4d6f82['id'];return db[_0x7e66('0x6d')][_0x7e66('0x5b')](_0x234273[_0x7e66('0x5c')]);}})[_0x7e66('0x20')](respondWithResult(_0x37eb8b,null))[_0x7e66('0x54')](handleError(_0x37eb8b,null));};exports[_0x7e66('0x6e')]=function(_0x55948b,_0x47bd6f,_0x391a57){var _0x40a610={'raw':![],'where':{}};var _0x425ae0={};var _0x11a547={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7e66('0x69')]({'where':{'id':_0x55948b['params']['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x47bd6f,null))[_0x7e66('0x20')](function(_0x204c86){if(_0x204c86){_0x425ae0[_0x7e66('0x41')]=_['keys'](db['CannedAnswer'][_0x7e66('0x3f')]);_0x425ae0['query']=_['keys'](_0x55948b['query']);_0x425ae0[_0x7e66('0x44')]=_[_0x7e66('0x45')](_0x425ae0[_0x7e66('0x41')],_0x425ae0[_0x7e66('0x43')]);_0x40a610[_0x7e66('0x46')]=_['intersection'](_0x425ae0[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x55948b[_0x7e66('0x43')]['fields']));_0x40a610[_0x7e66('0x46')]=_0x40a610[_0x7e66('0x46')][_0x7e66('0x58')]?_0x40a610['attributes']:_0x425ae0[_0x7e66('0x41')];if(!_0x55948b[_0x7e66('0x43')]['hasOwnProperty'](_0x7e66('0x49'))){_0x40a610[_0x7e66('0x2e')]=qs['limit'](_0x55948b['query'][_0x7e66('0x2e')]);_0x40a610[_0x7e66('0x2f')]=qs['offset'](_0x55948b[_0x7e66('0x43')][_0x7e66('0x2f')]);}_0x40a610[_0x7e66('0x4a')]=qs[_0x7e66('0x4b')](_0x55948b[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x40a610[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_['pick'](_0x55948b[_0x7e66('0x43')],_0x425ae0[_0x7e66('0x44')]));_0x40a610[_0x7e66('0x4c')][_0x7e66('0x66')]=_0x204c86['id'];if(_0x55948b[_0x7e66('0x43')]['filter']){_0x40a610[_0x7e66('0x4c')]=_[_0x7e66('0x4f')](_0x40a610[_0x7e66('0x4c')],{'$or':_[_0x7e66('0x42')](_0x40a610[_0x7e66('0x46')],function(_0x411c06){var _0x318dce={};_0x318dce[_0x411c06]={'$like':'%'+_0x55948b[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x318dce;})});}_0x40a610=_['merge']({},_0x40a610,_0x55948b['options']);return db[_0x7e66('0x6d')][_0x7e66('0x30')]({'where':_0x40a610[_0x7e66('0x4c')]})['then'](function(_0x8539ec){_0x11a547[_0x7e66('0x30')]=_0x8539ec;if(_0x55948b['query'][_0x7e66('0x52')]){_0x40a610[_0x7e66('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7e66('0x6a')](_0x40a610);})['then'](function(_0x3156ef){_0x11a547['rows']=_0x3156ef;return _0x11a547;});}})[_0x7e66('0x20')](respondWithFilteredResult(_0x47bd6f,_0x40a610))[_0x7e66('0x54')](handleError(_0x47bd6f,null));};exports[_0x7e66('0x6f')]=function(_0x4e6e69,_0x50da37,_0x5e37f4){return db[_0x7e66('0x3e')][_0x7e66('0x5a')]({'where':{'id':_0x4e6e69[_0x7e66('0x56')]['id']}})['then'](handleEntityNotFound(_0x50da37,null))[_0x7e66('0x20')](function(_0x5836ab){if(_0x5836ab){return _0x5836ab['removeAnswers'](_0x4e6e69[_0x7e66('0x43')][_0x7e66('0x70')]);}})[_0x7e66('0x20')](respondWithStatusCode(_0x50da37,null))['catch'](handleError(_0x50da37,null));};exports['addInteraction']=function(_0x5cc8b1,_0x195240,_0x219d34){return db[_0x7e66('0x71')][_0x7e66('0x5a')]({'where':{'id':_0x5cc8b1[_0x7e66('0x56')]['id']}})['then'](handleEntityNotFound(_0x195240,null))[_0x7e66('0x20')](function(_0x3632dc){if(_0x3632dc){return _0x3632dc[_0x7e66('0x72')](_0x5cc8b1[_0x7e66('0x5c')][_0x7e66('0x70')],_['omit'](_0x5cc8b1[_0x7e66('0x5c')],[_0x7e66('0x70'),'id'])||{});}})[_0x7e66('0x20')](respondWithResult(_0x195240,null))['catch'](handleError(_0x195240,null));};exports[_0x7e66('0x73')]=function(_0x1be26c,_0x5c2312,_0x3f8bb1){var _0x4d5e6f={'raw':![],'where':{}};var _0x3da473={};var _0x35ad41={'count':0x0,'rows':[]};return db[_0x7e66('0x3e')][_0x7e66('0x69')]({'where':{'id':_0x1be26c[_0x7e66('0x56')]['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x5c2312,null))[_0x7e66('0x20')](function(_0x17c173){if(_0x17c173){_0x3da473[_0x7e66('0x41')]=_[_0x7e66('0x57')](db[_0x7e66('0x71')][_0x7e66('0x3f')]);_0x3da473[_0x7e66('0x43')]=_['keys'](_0x1be26c['query']);_0x3da473[_0x7e66('0x44')]=_[_0x7e66('0x45')](_0x3da473['model'],_0x3da473[_0x7e66('0x43')]);_0x4d5e6f[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x3da473[_0x7e66('0x41')],qs['fields'](_0x1be26c['query'][_0x7e66('0x47')]));_0x4d5e6f[_0x7e66('0x46')]=_0x4d5e6f[_0x7e66('0x46')][_0x7e66('0x58')]?_0x4d5e6f[_0x7e66('0x46')]:_0x3da473['model'];if(!_0x1be26c[_0x7e66('0x43')][_0x7e66('0x48')]('nolimit')){_0x4d5e6f[_0x7e66('0x2e')]=qs[_0x7e66('0x2e')](_0x1be26c['query'][_0x7e66('0x2e')]);_0x4d5e6f[_0x7e66('0x2f')]=qs[_0x7e66('0x2f')](_0x1be26c[_0x7e66('0x43')][_0x7e66('0x2f')]);}_0x4d5e6f[_0x7e66('0x4a')]=qs[_0x7e66('0x4b')](_0x1be26c[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x4d5e6f[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_[_0x7e66('0x4d')](_0x1be26c['query'],_0x3da473[_0x7e66('0x44')]));_0x4d5e6f[_0x7e66('0x4c')]['FaxAccountId']=_0x17c173['id'];if(_0x1be26c['query']['filter']){_0x4d5e6f[_0x7e66('0x4c')]=_[_0x7e66('0x4f')](_0x4d5e6f[_0x7e66('0x4c')],{'$or':_[_0x7e66('0x42')](_0x4d5e6f[_0x7e66('0x46')],function(_0x3f23cc){var _0x5e3b84={};_0x5e3b84[_0x3f23cc]={'$like':'%'+_0x1be26c[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x5e3b84;})});}_0x4d5e6f=_['merge']({},_0x4d5e6f,_0x1be26c[_0x7e66('0x51')]);return db['FaxInteraction'][_0x7e66('0x30')]({'where':_0x4d5e6f[_0x7e66('0x4c')]})[_0x7e66('0x20')](function(_0x5cdab5){_0x35ad41[_0x7e66('0x30')]=_0x5cdab5;if(_0x1be26c[_0x7e66('0x43')][_0x7e66('0x52')]){_0x4d5e6f[_0x7e66('0x59')]=[{'model':db[_0x7e66('0x74')],'as':_0x7e66('0x75'),'required':![]},{'model':db['User'],'as':_0x7e66('0x76'),'attributes':['name',_0x7e66('0x77'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7e66('0x39'),_0x7e66('0x78')],'where':_0x1be26c[_0x7e66('0x43')][_0x7e66('0x79')]?{'id':_0x1be26c['query'][_0x7e66('0x79')]}:undefined,'required':_0x1be26c[_0x7e66('0x43')][_0x7e66('0x79')]?!![]:![]}];}return db[_0x7e66('0x71')][_0x7e66('0x6a')](_0x4d5e6f);})[_0x7e66('0x20')](function(_0xc26626){_0x35ad41[_0x7e66('0x53')]=_0xc26626;return _0x35ad41;});}})[_0x7e66('0x20')](respondWithFilteredResult(_0x5c2312,_0x4d5e6f))[_0x7e66('0x54')](handleError(_0x5c2312,null));};exports['addApplications']=function(_0xd733eb,_0x566f3c){var _0x2b2b61=_0xd733eb['params']['id'];var _0x5d72ca=_0xd733eb['body'];var _0x560b21=0xc8;var _0x2d1c31=null;return db[_0x7e66('0x7a')][_0x7e66('0x7b')]({'isolationLevel':db['sequelize'][_0x7e66('0x7c')][_0x7e66('0x7d')][_0x7e66('0x7e')]},function(_0x2fc280){return db['FaxAccount'][_0x7e66('0x69')]({'where':{'id':_0x2b2b61},'transaction':_0x2fc280})['then'](function(_0x13bac4){if(_0x13bac4){return db['FaxApplication'][_0x7e66('0x36')]({'where':{'FaxAccountId':_0x2b2b61},'transaction':_0x2fc280})[_0x7e66('0x20')](function(){var _0xba01e0=_[_0x7e66('0x42')](_0x5d72ca,function(_0x100107){_0x100107[_0x7e66('0x66')]=_0x2b2b61;return _0x100107;});return db[_0x7e66('0x7f')][_0x7e66('0x80')](_0xba01e0,{'transaction':_0x2fc280});});}else{_0x560b21=0x194;_0x2d1c31=[];}});})[_0x7e66('0x20')](function(){if(_0x560b21!==0x194){return db[_0x7e66('0x7f')][_0x7e66('0x81')]({'where':{'FaxAccountId':_0x2b2b61},'order':_0x7e66('0x82')})['then'](function(_0xe9634){_0x2d1c31=_0xe9634;});}})['catch'](function(_0x15d4cc){_0x560b21=0x1f4;logger[_0x7e66('0x24')](_0x15d4cc[_0x7e66('0x38')]);if(_0x15d4cc[_0x7e66('0x39')]){delete _0x15d4cc[_0x7e66('0x39')];}_0x2d1c31=_0x15d4cc;})[_0x7e66('0x83')](function(){if(_0x2d1c31===null){_0x566f3c[_0x7e66('0x29')](_0x560b21);}else{if(_0x560b21===0x1f4){_0x566f3c[_0x7e66('0x2a')](_0x560b21)[_0x7e66('0x3a')](_0x2d1c31);}else{_0x566f3c[_0x7e66('0x2a')](_0x560b21)[_0x7e66('0x2c')](_0x2d1c31);}}});};exports[_0x7e66('0x84')]=function(_0x4b1096,_0x397cfb,_0x355d22){var _0x429f78={};var _0x4d4257={};var _0x560c47;var _0x20be6c;return db[_0x7e66('0x3e')]['findOne']({'where':{'id':_0x4b1096[_0x7e66('0x56')]['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x397cfb,null))['then'](function(_0x2518e3){if(_0x2518e3){_0x560c47=_0x2518e3;_0x4d4257['model']=_[_0x7e66('0x57')](db[_0x7e66('0x7f')][_0x7e66('0x3f')]);_0x4d4257[_0x7e66('0x43')]=_[_0x7e66('0x57')](_0x4b1096[_0x7e66('0x43')]);_0x4d4257['filters']=_[_0x7e66('0x45')](_0x4d4257[_0x7e66('0x41')],_0x4d4257[_0x7e66('0x43')]);_0x429f78[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x4d4257[_0x7e66('0x41')],qs['fields'](_0x4b1096[_0x7e66('0x43')][_0x7e66('0x47')]));_0x429f78[_0x7e66('0x46')]=_0x429f78[_0x7e66('0x46')][_0x7e66('0x58')]?_0x429f78[_0x7e66('0x46')]:_0x4d4257[_0x7e66('0x41')];_0x429f78[_0x7e66('0x4a')]=qs[_0x7e66('0x4b')](_0x4b1096[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x429f78[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_['pick'](_0x4b1096['query'],_0x4d4257[_0x7e66('0x44')]));if(_0x4b1096['query']['filter']){_0x429f78[_0x7e66('0x4c')]=_[_0x7e66('0x4f')](_0x429f78[_0x7e66('0x4c')],{'$or':_[_0x7e66('0x42')](_0x429f78[_0x7e66('0x46')],function(_0x3d8863){var _0x27636a={};_0x27636a[_0x3d8863]={'$like':'%'+_0x4b1096[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x27636a;})});}_0x429f78=_[_0x7e66('0x4f')]({},_0x429f78,_0x4b1096[_0x7e66('0x51')]);return _0x560c47['getApplications'](_0x429f78);}})[_0x7e66('0x20')](function(_0x3675f3){if(_0x3675f3){_0x20be6c=_0x3675f3[_0x7e66('0x58')];if(!_0x4b1096[_0x7e66('0x43')][_0x7e66('0x48')](_0x7e66('0x49'))){_0x429f78[_0x7e66('0x2e')]=qs[_0x7e66('0x2e')](_0x4b1096[_0x7e66('0x43')][_0x7e66('0x2e')]);_0x429f78['offset']=qs[_0x7e66('0x2f')](_0x4b1096[_0x7e66('0x43')]['offset']);}return _0x560c47[_0x7e66('0x84')](_0x429f78);}})[_0x7e66('0x20')](function(_0x1c002f){if(_0x1c002f){return _0x1c002f?{'count':_0x20be6c,'rows':_0x1c002f}:null;}})[_0x7e66('0x20')](respondWithResult(_0x397cfb,null))[_0x7e66('0x54')](handleError(_0x397cfb,null));};function Extension(_0x4bc0db,_0x9cb3d9,_0x135350,_0x4af909){this['context']='from-voip-provider';this['exten']=_0x4bc0db[_0x7e66('0x85')];this['app']=_0x4af909;this[_0x7e66('0x86')]=_0x7e66('0x87');this[_0x7e66('0x88')]=_0x7e66('0x89');this['FaxAccountId']=_0x4bc0db['id'];this[_0x7e66('0x82')]=_0x9cb3d9;this[_0x7e66('0x8a')]=_0x135350;}function createExtensionsReciveFax(_0x3a46dc){var _0x385ebd=0x1;var _0xb32a69=[];_0xb32a69['push'](new Extension(_0x3a46dc,_0x385ebd,'',_0x7e66('0x8b')));_0x385ebd+=0x1;_0xb32a69[_0x7e66('0x8c')](new Extension(_0x3a46dc,_0x385ebd,_0x7e66('0x8d'),_0x7e66('0x8e')));_0x385ebd+=0x1;for(var _0x321262 in _0x3a46dc){if(_0x3a46dc[_0x7e66('0x48')](_0x321262)&&(_0x321262===_0x7e66('0x8f')||_0x321262===_0x7e66('0x85')||_0x321262===_0x7e66('0x90')||_0x321262===_0x7e66('0x91')||_0x321262===_0x7e66('0x92')||_0x321262===_0x7e66('0x93')||_0x321262===_0x7e66('0x94')||_0x321262===_0x7e66('0x95')||_0x321262===_0x7e66('0x96'))){_0xb32a69['push'](new Extension(_0x3a46dc,_0x385ebd,_0x7e66('0x97')+_0x321262+')='+_0x3a46dc[_0x321262],_0x7e66('0x8e')));_0x385ebd+=0x1;}}_0xb32a69[_0x7e66('0x8c')](new Extension(_0x3a46dc,_0x385ebd,'6',_0x7e66('0x98')));_0x385ebd+=0x1;_0xb32a69[_0x7e66('0x8c')](new Extension(_0x3a46dc,_0x385ebd,_0x7e66('0x99'),_0x7e66('0x9a')));_0x385ebd=0x0;return _0xb32a69;}exports['addAccountApplications']=function(_0x2aad11,_0x8f89ab,_0x14c74d){var _0x3b93fc;return db['sequelize']['transaction'](function(_0x25589a){return db['FaxAccount'][_0x7e66('0x5b')](_0x2aad11[_0x7e66('0x5c')],{'transaction':_0x25589a})['then'](function(_0x38a6fc){_0x3b93fc=_0x38a6fc[_0x7e66('0x5d')]({'plain':!![]});return db[_0x7e66('0x9b')][_0x7e66('0x80')](createExtensionsReciveFax(_0x3b93fc),{'transaction':_0x25589a});});})['then'](function(){return _0x3b93fc;})[_0x7e66('0x20')](respondWithResult(_0x8f89ab,null))[_0x7e66('0x54')](handleError(_0x8f89ab,null));};exports['updateAccountApplications']=function(_0x389ef3,_0x5586a4,_0x1b6a51){var _0xcedcb5;return db[_0x7e66('0x7a')][_0x7e66('0x7b')](function(_0x63bd79){return db['FaxAccount']['update'](_0x389ef3[_0x7e66('0x5c')],{'where':{'id':_0x389ef3[_0x7e66('0x5c')]['id']},'transaction':_0x63bd79})[_0x7e66('0x20')](function(_0x344e0c){return db[_0x7e66('0x9b')][_0x7e66('0x36')]({'where':{'FaxAccountId':_0x389ef3['body']['id']},'transaction':_0x63bd79})[_0x7e66('0x20')](function(_0x1660dc){return db[_0x7e66('0x9b')][_0x7e66('0x80')](createExtensionsReciveFax(_[_0x7e66('0x9c')](_0x389ef3[_0x7e66('0x5c')],[_0x7e66('0x9d'),_0x7e66('0x9e'),_0x7e66('0x9f'),'updatedAt','TrunkId',_0x7e66('0xa0')])),{'transaction':_0x63bd79});});});})[_0x7e66('0x20')](function(){return db[_0x7e66('0x3e')][_0x7e66('0xa1')](_0x389ef3['body']['id']);})[_0x7e66('0x20')](respondWithResult(_0x5586a4,null))[_0x7e66('0x54')](handleError(_0x5586a4,null));};exports[_0x7e66('0xa2')]=function(_0x20fb41,_0x14759d,_0x8f8622){var _0x3a02b9={'raw':!![],'where':{}};var _0x1c6d5f={};var _0x5e53e4={'count':0x0,'rows':[]};return db[_0x7e66('0x3e')][_0x7e66('0x69')]({'where':{'id':_0x20fb41['params']['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x14759d,null))[_0x7e66('0x20')](function(_0xec9654){if(_0xec9654){_0x1c6d5f['model']=_[_0x7e66('0x57')](db[_0x7e66('0xa3')]['rawAttributes']);_0x1c6d5f[_0x7e66('0x43')]=_[_0x7e66('0x57')](_0x20fb41[_0x7e66('0x43')]);_0x1c6d5f['filters']=_[_0x7e66('0x45')](_0x1c6d5f[_0x7e66('0x41')],_0x1c6d5f[_0x7e66('0x43')]);_0x3a02b9[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x1c6d5f[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x20fb41[_0x7e66('0x43')]['fields']));_0x3a02b9[_0x7e66('0x46')]=_0x3a02b9[_0x7e66('0x46')][_0x7e66('0x58')]?_0x3a02b9[_0x7e66('0x46')]:_0x1c6d5f[_0x7e66('0x41')];if(!_0x20fb41['query'][_0x7e66('0x48')]('nolimit')){_0x3a02b9[_0x7e66('0x2e')]=qs[_0x7e66('0x2e')](_0x20fb41[_0x7e66('0x43')]['limit']);_0x3a02b9['offset']=qs[_0x7e66('0x2f')](_0x20fb41[_0x7e66('0x43')][_0x7e66('0x2f')]);}_0x3a02b9['order']=qs[_0x7e66('0x4b')](_0x20fb41[_0x7e66('0x43')][_0x7e66('0x4b')]);_0x3a02b9[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_['pick'](_0x20fb41[_0x7e66('0x43')],_0x1c6d5f['filters']));_0x3a02b9[_0x7e66('0x4c')][_0x7e66('0x66')]=_0xec9654['id'];if(_0x20fb41['query'][_0x7e66('0x4e')]){_0x3a02b9['where']=_[_0x7e66('0x4f')](_0x3a02b9['where'],{'$or':_['map'](_0x3a02b9['attributes'],function(_0x19db0f){var _0x1edc0c={};_0x1edc0c[_0x19db0f]={'$like':'%'+_0x20fb41[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x1edc0c;})});}if(_0x20fb41[_0x7e66('0x43')][_0x7e66('0xa4')]){var _0x57ecf4=_0x20fb41[_0x7e66('0x43')]['$gte'][_0x7e66('0xa5')](',');var _0x2094b7={};_0x2094b7[_0x57ecf4[0x0]]={'$gte':moment(_0x57ecf4[0x1])[_0x7e66('0xa6')](_0x7e66('0xa7'))};_0x3a02b9['where']=_['merge'](_0x3a02b9['where'],_0x2094b7);}_0x3a02b9=_[_0x7e66('0x4f')]({},_0x3a02b9,_0x20fb41['options']);return db['FaxMessage'][_0x7e66('0x30')]({'where':_0x3a02b9[_0x7e66('0x4c')]})[_0x7e66('0x20')](function(_0x1c8aaf){_0x5e53e4[_0x7e66('0x30')]=_0x1c8aaf;if(_0x20fb41[_0x7e66('0x43')][_0x7e66('0x52')]){_0x3a02b9[_0x7e66('0x59')]=[{'all':!![]}];}return db[_0x7e66('0xa3')][_0x7e66('0x6a')](_0x3a02b9);})[_0x7e66('0x20')](function(_0x336e97){_0x5e53e4['rows']=_0x336e97;return _0x5e53e4;});}})[_0x7e66('0x20')](respondWithFilteredResult(_0x14759d,_0x3a02b9))['catch'](handleError(_0x14759d,null));};exports[_0x7e66('0x3a')]=function(_0x3be458,_0x3d9d45,_0x4d003f){var _0x5d20b0,_0x38cd9f={},_0x344a29;if(_0x3be458[_0x7e66('0x5c')]['to']){_0x344a29=_0x3be458['body']['to'][0x0];}return db[_0x7e66('0x3e')]['find']({'where':{'id':_0x3be458[_0x7e66('0x56')]['id']},'include':[{'model':db[_0x7e66('0xa8')],'as':_0x7e66('0xa9'),'include':[{'model':db['CmContact'],'as':_0x7e66('0xaa'),'where':{'fax':_0x344a29},'limit':0x1,'order':[[_0x7e66('0xab'),_0x7e66('0xac')]]}]}]})[_0x7e66('0x20')](handleEntityNotFound(_0x3d9d45,null))[_0x7e66('0x20')](function(_0x584200){_0x5d20b0=_0x584200;if(_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')]&&_0x3be458[_0x7e66('0x5c')]['attachments'][_0x7e66('0x58')]){for(var _0x1fbbec=0x0;_0x1fbbec<_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][_0x7e66('0x58')];_0x1fbbec+=0x1){_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][_0x1fbbec]={'filename':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][_0x1fbbec]['name'],'id':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][_0x1fbbec]['id'],'path':path['join'](config[_0x7e66('0xae')],_0x7e66('0xaf'),_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][_0x1fbbec][_0x7e66('0xb0')])};}}return respondWithRpcPromise(_0x7e66('0xb1'),'CheckAfterSend',{'FaxAccountId':_[_0x7e66('0xb2')](_0x3be458[_0x7e66('0x56')]['id'])?undefined:_0x3be458[_0x7e66('0x56')]['id'],'path':_[_0x7e66('0xb2')](_0x3be458['body']['attachments'][0x0]['path'])?undefined:_0x3be458['body']['attachments'][0x0]['path'],'fax':_[_0x7e66('0xb2')](_0x3be458[_0x7e66('0x5c')]['to'][0x0])?undefined:_0x3be458[_0x7e66('0x5c')]['to'][0x0]},client9002);})[_0x7e66('0x20')](function(){if(_0x5d20b0){if(_[_0x7e66('0xb2')](_0x3be458[_0x7e66('0x5c')][_0x7e66('0xb3')])){_0x3be458[_0x7e66('0x5c')][_0x7e66('0xb3')]=util['format'](_0x7e66('0xb4'),_0x5d20b0['name'],_0x5d20b0[_0x7e66('0xb5')]);}if(_0x5d20b0['List']){if(_0x5d20b0['List'][_0x7e66('0xaa')]['length']){return _0x5d20b0[_0x7e66('0xa9')][_0x7e66('0xaa')][0x0];}else{return db[_0x7e66('0x74')][_0x7e66('0x5b')](_[_0x7e66('0x18')](_0x3be458[_0x7e66('0x5c')],{'firstName':_0x3be458[_0x7e66('0x5c')]['to'][0x0],'phone':_0x3be458[_0x7e66('0x5c')]['to'][0x0],'fax':_0x3be458[_0x7e66('0x5c')]['to'][0x0],'ListId':_0x5d20b0[_0x7e66('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x7e66('0xb6'));}})[_0x7e66('0x20')](function(_0x5326d4){if(_0x5326d4){return db[_0x7e66('0x71')][_0x7e66('0x5a')]({'where':{'ContactId':_0x5326d4['id'],'closed':![],'FaxAccountId':_0x5d20b0['id']}})['then'](function(_0xd84af5){if(_0xd84af5){return[_0xd84af5,![]];}return db[_0x7e66('0x71')][_0x7e66('0x5b')]({'UserId':_0x3be458['user']['id'],'ContactId':_0x5326d4['id'],'FaxAccountId':_0x5d20b0['id'],'fax':_0x3be458[_0x7e66('0x5c')]['to'][0x0],'firstMsgDirection':_0x7e66('0xb7'),'Messages':[_[_0x7e66('0x4f')](_0x3be458['body'],{'read':![],'body':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0][_0x7e66('0xb8')],'FaxAccountId':_0x5d20b0['id'],'UserId':_0x3be458[_0x7e66('0x60')]['id'],'ContactId':_0x5326d4['id'],'AttachmentId':_0x3be458[_0x7e66('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x7e66('0xb9')}]})[_0x7e66('0x20')](function(_0x3b13ed){return[_0x3b13ed,!![]];});});}else{throw new Error(_0x7e66('0xba'));}})[_0x7e66('0xbb')](function(_0x655bc6,_0x3ac76b){if(_0x3ac76b){return _0x655bc6;}return db['FaxMessage'][_0x7e66('0x5b')]({'direction':_0x7e66('0xb7'),'read':![],'body':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0][_0x7e66('0xb8')],'FaxAccountId':_0x5d20b0['id'],'FaxInteractionId':_0x655bc6['id'],'UserId':_0x3be458[_0x7e66('0x60')]['id'],'ContactId':_0x655bc6[_0x7e66('0xbc')],'AttachmentId':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0]['id']})['then'](function(_0x238612){_0x655bc6[_0x7e66('0xbd')][_0x7e66('0xb9')]=[];_0x655bc6[_0x7e66('0xbd')][_0x7e66('0xb9')][_0x7e66('0x8c')](_0x238612['dataValues']);return _0x655bc6;});})['then'](function(_0x5c93eb){respondWithRpcPromise(_0x7e66('0xbe'),_0x7e66('0xbe'),{'FaxAccountId':_[_0x7e66('0xb2')](_0x3be458[_0x7e66('0x56')]['id'])?undefined:_0x3be458[_0x7e66('0x56')]['id'],'path':_[_0x7e66('0xb2')](_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0][_0x7e66('0x5')])?undefined:_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0][_0x7e66('0x5')],'fax':_[_0x7e66('0xb2')](_0x3be458['body']['to'][0x0])?undefined:_0x3be458[_0x7e66('0x5c')]['to'][0x0],'AttachmentId':_0x3be458[_0x7e66('0x5c')][_0x7e66('0xad')][0x0]['id']},client9002)[_0x7e66('0x20')](function(_0x4530c6){logger[_0x7e66('0x28')]('SendFaxRpc,\x20%s',_0x4530c6);})[_0x7e66('0x54')](function(_0x263134){logger[_0x7e66('0x28')](_0x7e66('0xbf'),_0x263134);});return _0x5c93eb;})['then'](respondWithResult(_0x3d9d45,null))[_0x7e66('0x54')](handleError(_0x3d9d45,null));};exports[_0x7e66('0xc0')]=function(_0x60a014,_0x3d5220,_0x38591c){return db[_0x7e66('0x3e')][_0x7e66('0x5a')]({'where':{'id':_0x60a014['params']['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x3d5220,null))['then'](function(_0x4cf5cc){if(_0x4cf5cc){return _0x4cf5cc['addAgents'](_0x60a014['body'][_0x7e66('0x70')],_[_0x7e66('0x9c')](_0x60a014['body'],[_0x7e66('0x70'),'id'])||{})['spread'](function(_0x39b45c){for(var _0x27cf51=0x0;_0x27cf51<_0x60a014[_0x7e66('0x5c')][_0x7e66('0x70')][_0x7e66('0x58')];_0x27cf51+=0x1){socket[_0x7e66('0xc1')](_0x7e66('0xc2'),{'UserId':Number(_0x60a014['body']['ids'][_0x27cf51]),'FaxAccountId':Number(_0x60a014[_0x7e66('0x56')]['id'])});}return _0x39b45c;});}})[_0x7e66('0x20')](respondWithResult(_0x3d5220,null))['catch'](handleError(_0x3d5220,null));};exports[_0x7e66('0xc3')]=function(_0x5dd5ed,_0x25939d,_0x7cbf88){return db[_0x7e66('0x3e')][_0x7e66('0x5a')]({'where':{'id':_0x5dd5ed['params']['id']}})[_0x7e66('0x20')](handleEntityNotFound(_0x25939d,null))[_0x7e66('0x20')](function(_0x29bf31){if(_0x29bf31){return _0x29bf31[_0x7e66('0xc3')](_0x5dd5ed[_0x7e66('0x43')]['ids'])['then'](function(){if(_[_0x7e66('0xc4')](_0x5dd5ed[_0x7e66('0x43')][_0x7e66('0x70')])){for(var _0x3768f7=0x0;_0x3768f7<_0x5dd5ed[_0x7e66('0x43')][_0x7e66('0x70')][_0x7e66('0x58')];_0x3768f7+=0x1){socket[_0x7e66('0xc1')](_0x7e66('0xc5'),{'UserId':Number(_0x5dd5ed['query'][_0x7e66('0x70')][_0x3768f7]),'FaxAccountId':Number(_0x5dd5ed['params']['id'])});}}else{socket[_0x7e66('0xc1')](_0x7e66('0xc5'),{'UserId':Number(_0x5dd5ed['query'][_0x7e66('0x70')]),'FaxAccountId':Number(_0x5dd5ed[_0x7e66('0x56')]['id'])});}});}})[_0x7e66('0x20')](respondWithStatusCode(_0x25939d,null))[_0x7e66('0x54')](handleError(_0x25939d,null));};exports[_0x7e66('0xc6')]=function(_0x20e139,_0x4bd5fb,_0x7960b){var _0x2993c4={};var _0x1cd5b2={};var _0x175a39;var _0x556d4a;return db[_0x7e66('0x3e')][_0x7e66('0x69')]({'where':{'id':_0x20e139[_0x7e66('0x56')]['id']}})['then'](handleEntityNotFound(_0x4bd5fb,null))[_0x7e66('0x20')](function(_0x198ba5){if(_0x198ba5){_0x175a39=_0x198ba5;_0x1cd5b2[_0x7e66('0x41')]=_[_0x7e66('0x57')](db[_0x7e66('0xc7')][_0x7e66('0x3f')]);_0x1cd5b2[_0x7e66('0x43')]=_[_0x7e66('0x57')](_0x20e139['query']);_0x1cd5b2[_0x7e66('0x44')]=_['intersection'](_0x1cd5b2[_0x7e66('0x41')],_0x1cd5b2[_0x7e66('0x43')]);_0x2993c4[_0x7e66('0x46')]=_[_0x7e66('0x45')](_0x1cd5b2[_0x7e66('0x41')],qs[_0x7e66('0x47')](_0x20e139[_0x7e66('0x43')][_0x7e66('0x47')]));_0x2993c4[_0x7e66('0x46')]=_0x2993c4[_0x7e66('0x46')][_0x7e66('0x58')]?_0x2993c4['attributes']:_0x1cd5b2[_0x7e66('0x41')];_0x2993c4[_0x7e66('0x4a')]=qs[_0x7e66('0x4b')](_0x20e139[_0x7e66('0x43')]['sort']);_0x2993c4[_0x7e66('0x4c')]=qs[_0x7e66('0x44')](_[_0x7e66('0x4d')](_0x20e139[_0x7e66('0x43')],_0x1cd5b2[_0x7e66('0x44')]));if(_0x20e139[_0x7e66('0x43')][_0x7e66('0x4e')]){_0x2993c4['where']=_[_0x7e66('0x4f')](_0x2993c4[_0x7e66('0x4c')],{'$or':_['map'](_0x2993c4[_0x7e66('0x46')],function(_0x17dbfe){var _0x405a3c={};_0x405a3c[_0x17dbfe]={'$like':'%'+_0x20e139[_0x7e66('0x43')][_0x7e66('0x4e')]+'%'};return _0x405a3c;})});}_0x2993c4=_[_0x7e66('0x4f')]({},_0x2993c4,_0x20e139[_0x7e66('0x51')]);return _0x175a39['getAgents'](_0x2993c4);}})[_0x7e66('0x20')](function(_0x842bc3){if(_0x842bc3){_0x556d4a=_0x842bc3[_0x7e66('0x58')];if(!_0x20e139['query']['hasOwnProperty'](_0x7e66('0x49'))){_0x2993c4[_0x7e66('0x2e')]=qs[_0x7e66('0x2e')](_0x20e139['query'][_0x7e66('0x2e')]);_0x2993c4[_0x7e66('0x2f')]=qs[_0x7e66('0x2f')](_0x20e139[_0x7e66('0x43')][_0x7e66('0x2f')]);}return _0x175a39[_0x7e66('0xc6')](_0x2993c4);}})[_0x7e66('0x20')](function(_0x1646c1){if(_0x1646c1){return _0x1646c1?{'count':_0x556d4a,'rows':_0x1646c1}:null;}})[_0x7e66('0x20')](respondWithResult(_0x4bd5fb,null))[_0x7e66('0x54')](handleError(_0x4bd5fb,null));}; \ No newline at end of file +var _0x364d=['addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','FaxAccount','includeAll','include','rows','show','params','rawAttributes','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','merge','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','tag'];(function(_0x439977,_0x5cc225){var _0x2b069a=function(_0x2ca4c4){while(--_0x2ca4c4){_0x439977['push'](_0x439977['shift']());}};_0x2b069a(++_0x5cc225);}(_0x364d,0x113));var _0xd364=function(_0x22b695,_0x2a9c6e){_0x22b695=_0x22b695-0x0;var _0x2d41a7=_0x364d[_0x22b695];return _0x2d41a7;};'use strict';var emlformat=require(_0xd364('0x0'));var rimraf=require(_0xd364('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd364('0x2'));var rp=require(_0xd364('0x3'));var moment=require(_0xd364('0x4'));var BPromise=require(_0xd364('0x5'));var Mustache=require(_0xd364('0x6'));var util=require(_0xd364('0x7'));var path=require(_0xd364('0x8'));var sox=require(_0xd364('0x9'));var csv=require(_0xd364('0xa'));var ejs=require(_0xd364('0xb'));var fs=require('fs');var fs_extra=require(_0xd364('0xc'));var _=require('lodash');var squel=require(_0xd364('0xd'));var crypto=require(_0xd364('0xe'));var jsforce=require(_0xd364('0xf'));var deskjs=require(_0xd364('0x10'));var toCsv=require(_0xd364('0xa'));var querystring=require('querystring');var Papa=require(_0xd364('0x11'));var Redis=require(_0xd364('0x12'));var authService=require(_0xd364('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd364('0x14'));var hardwareService=require(_0xd364('0x15'));var logger=require(_0xd364('0x16'))(_0xd364('0x17'));var utils=require(_0xd364('0x18'));var config=require(_0xd364('0x19'));var licenseUtil=require(_0xd364('0x1a'));var db=require(_0xd364('0x1b'))['db'];config[_0xd364('0x1c')]=_[_0xd364('0x1d')](config[_0xd364('0x1c')],{'host':_0xd364('0x1e'),'port':0x18eb});var socket=require(_0xd364('0x1f'))(new Redis(config['redis']));require(_0xd364('0x20'))['register'](socket);var jayson=require(_0xd364('0x21'));var client=jayson[_0xd364('0x22')][_0xd364('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xd364('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1636db,_0x4fdcc5,_0x25f015,_0x25808d){return new BPromise(function(_0xf3998b,_0xa5f1e8){var _0x19d51c=_0x25808d||client;return _0x19d51c[_0xd364('0x24')](_0x1636db,_0x25f015)[_0xd364('0x25')](function(_0x108e5a){logger[_0xd364('0x26')](_0xd364('0x27'),_0x4fdcc5,_0xd364('0x28'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4fdcc5,_0xd364('0x28'),JSON['stringify'](_0x108e5a));if(_0x108e5a['error']){if(_0x108e5a['error'][_0xd364('0x29')]===0x1f4){logger[_0xd364('0x2a')](_0xd364('0x27'),_0x4fdcc5,_0x108e5a['error'][_0xd364('0x2b')]);return _0xa5f1e8(_0x108e5a[_0xd364('0x2a')][_0xd364('0x2b')]);}logger[_0xd364('0x2a')](_0xd364('0x27'),_0x4fdcc5,_0x108e5a['error'][_0xd364('0x2b')]);return _0xf3998b(_0x108e5a[_0xd364('0x2a')][_0xd364('0x2b')]);}else{logger['info'](_0xd364('0x27'),_0x4fdcc5,_0xd364('0x28'));_0xf3998b(_0x108e5a[_0xd364('0x2c')]['message']);}})[_0xd364('0x2d')](function(_0x314c84){logger[_0xd364('0x2a')](_0xd364('0x27'),_0x4fdcc5,_0x314c84);_0xa5f1e8(_0x314c84);});});}function respondWithStatusCode(_0x4716db,_0xbd97e2){_0xbd97e2=_0xbd97e2||0xcc;return function(_0x42355a){if(_0x42355a){return _0x4716db[_0xd364('0x2e')](_0xbd97e2);}return _0x4716db['status'](_0xbd97e2)[_0xd364('0x2f')]();};}function respondWithResult(_0x4ca9ec,_0x5038ed){_0x5038ed=_0x5038ed||0xc8;return function(_0x5a2133){if(_0x5a2133){return _0x4ca9ec[_0xd364('0x30')](_0x5038ed)[_0xd364('0x31')](_0x5a2133);}};}function respondWithFilteredResult(_0x3f1e9c,_0x47b6e2){return function(_0x168a77){if(_0x168a77){var _0x5f5723=typeof _0x47b6e2[_0xd364('0x32')]===_0xd364('0x33')&&typeof _0x47b6e2[_0xd364('0x34')]===_0xd364('0x33');var _0x26e3d6=_0x168a77[_0xd364('0x35')];var _0x480ae1=_0x5f5723?0x0:_0x47b6e2[_0xd364('0x32')];var _0x5984d8=_0x5f5723?_0x168a77[_0xd364('0x35')]:_0x47b6e2['offset']+_0x47b6e2[_0xd364('0x34')];var _0x245810;if(_0x5984d8>=_0x26e3d6){_0x5984d8=_0x26e3d6;_0x245810=0xc8;}else{_0x245810=0xce;}_0x3f1e9c[_0xd364('0x30')](_0x245810);return _0x3f1e9c[_0xd364('0x36')](_0xd364('0x37'),_0x480ae1+'-'+_0x5984d8+'/'+_0x26e3d6)[_0xd364('0x31')](_0x168a77);}return null;};}function patchUpdates(_0x1c3fa4){return function(_0x51fd5a){try{jsonpatch[_0xd364('0x38')](_0x51fd5a,_0x1c3fa4,!![]);}catch(_0x5effcb){return BPromise[_0xd364('0x39')](_0x5effcb);}return _0x51fd5a[_0xd364('0x3a')]();};}function saveUpdates(_0x57b27f,_0x36172e){return function(_0x204b0d){if(_0x204b0d){return _0x204b0d[_0xd364('0x3b')](_0x57b27f)[_0xd364('0x25')](function(_0x1bda76){return _0x1bda76;});}return null;};}function removeEntity(_0x22dfbd,_0xb2311b){return function(_0x40f31b){if(_0x40f31b){return _0x40f31b['destroy']()[_0xd364('0x25')](function(){var _0x20784f=_0x40f31b[_0xd364('0x3c')]({'plain':!![]});var _0x36d39b=_0xd364('0x3d');return db[_0xd364('0x3e')][_0xd364('0x3f')]({'where':{'type':_0x36d39b,'resourceId':_0x20784f['id']}})[_0xd364('0x25')](function(){return _0x40f31b;});})[_0xd364('0x25')](function(){_0x22dfbd[_0xd364('0x30')](0xcc)[_0xd364('0x2f')]();});}};}function handleEntityNotFound(_0x8235fc,_0x2bfb62){return function(_0x47e6dc){if(!_0x47e6dc){_0x8235fc['sendStatus'](0x194);}return _0x47e6dc;};}function handleError(_0x22fc74,_0x36da3c){_0x36da3c=_0x36da3c||0x1f4;return function(_0x3afeb5){logger['error'](_0x3afeb5[_0xd364('0x40')]);if(_0x3afeb5['name']){delete _0x3afeb5[_0xd364('0x41')];}_0x22fc74[_0xd364('0x30')](_0x36da3c)[_0xd364('0x42')](_0x3afeb5);};}exports[_0xd364('0x43')]=function(_0x246ebf,_0x3d931f){var _0x4eae03={'include':[{'model':db[_0xd364('0x44')],'as':_0xd364('0x45')}]},_0x3230f7={},_0x2845db={'count':0x0,'rows':[]};var _0x3ea1f8=_[_0xd364('0x46')](db['FaxAccount']['rawAttributes'],function(_0x1367bc){return{'name':_0x1367bc['fieldName'],'type':_0x1367bc[_0xd364('0x47')]['key']};});_0x3230f7[_0xd364('0x48')]=_[_0xd364('0x46')](_0x3ea1f8,_0xd364('0x41'));_0x3230f7['query']=_[_0xd364('0x49')](_0x246ebf[_0xd364('0x4a')]);_0x3230f7['filters']=_['intersection'](_0x3230f7[_0xd364('0x48')],_0x3230f7[_0xd364('0x4a')]);_0x4eae03[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0x3230f7['model'],qs[_0xd364('0x4d')](_0x246ebf[_0xd364('0x4a')][_0xd364('0x4d')]));_0x4eae03[_0xd364('0x4b')]=_0x4eae03[_0xd364('0x4b')]['length']?_0x4eae03[_0xd364('0x4b')]:_0x3230f7[_0xd364('0x48')];if(!_0x246ebf[_0xd364('0x4a')][_0xd364('0x4e')]('nolimit')){_0x4eae03[_0xd364('0x34')]=qs[_0xd364('0x34')](_0x246ebf[_0xd364('0x4a')]['limit']);_0x4eae03[_0xd364('0x32')]=qs['offset'](_0x246ebf[_0xd364('0x4a')]['offset']);}_0x4eae03['order']=qs[_0xd364('0x4f')](_0x246ebf[_0xd364('0x4a')][_0xd364('0x4f')]);_0x4eae03[_0xd364('0x50')]=qs[_0xd364('0x51')](_[_0xd364('0x52')](_0x246ebf['query'],_0x3230f7[_0xd364('0x51')]),_0x3ea1f8);if(_0x246ebf[_0xd364('0x4a')][_0xd364('0x53')]){_0x4eae03[_0xd364('0x50')]=_['merge'](_0x4eae03[_0xd364('0x50')],{'$or':_[_0xd364('0x46')](_0x3ea1f8,function(_0xdf60ad){if(_0xdf60ad[_0xd364('0x47')]!==_0xd364('0x54')){var _0x43c55d={};_0x43c55d[_0xdf60ad[_0xd364('0x41')]]={'$like':'%'+_0x246ebf['query'][_0xd364('0x53')]+'%'};return _0x43c55d;}})});}_0x4eae03=_['merge']({},_0x4eae03,_0x246ebf[_0xd364('0x55')]);var _0x1bbaaf={'where':_0x4eae03[_0xd364('0x50')]};return db[_0xd364('0x56')]['count'](_0x1bbaaf)['then'](function(_0x3725c8){_0x2845db[_0xd364('0x35')]=_0x3725c8;if(_0x246ebf[_0xd364('0x4a')][_0xd364('0x57')]){_0x4eae03[_0xd364('0x58')]=[{'all':!![]}];}return db[_0xd364('0x56')]['findAll'](_0x4eae03);})[_0xd364('0x25')](function(_0x5b776d){_0x2845db[_0xd364('0x59')]=_0x5b776d;return _0x2845db;})[_0xd364('0x25')](respondWithFilteredResult(_0x3d931f,_0x4eae03))[_0xd364('0x2d')](handleError(_0x3d931f,null));};exports[_0xd364('0x5a')]=function(_0x4440e0,_0x3019cc){var _0x716d64={'raw':![],'where':{'id':_0x4440e0[_0xd364('0x5b')]['id']},'include':[{'model':db[_0xd364('0x44')],'as':_0xd364('0x45')}]},_0x27e04a={};_0x27e04a[_0xd364('0x48')]=_['keys'](db[_0xd364('0x56')][_0xd364('0x5c')]);_0x27e04a[_0xd364('0x4a')]=_['keys'](_0x4440e0['query']);_0x27e04a[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x27e04a[_0xd364('0x48')],_0x27e04a[_0xd364('0x4a')]);_0x716d64[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0x27e04a[_0xd364('0x48')],qs[_0xd364('0x4d')](_0x4440e0['query'][_0xd364('0x4d')]));_0x716d64[_0xd364('0x4b')]=_0x716d64[_0xd364('0x4b')][_0xd364('0x5d')]?_0x716d64[_0xd364('0x4b')]:_0x27e04a[_0xd364('0x48')];if(_0x4440e0[_0xd364('0x4a')][_0xd364('0x57')]){_0x716d64[_0xd364('0x58')]=[{'all':!![]}];}_0x716d64=_['merge']({},_0x716d64,_0x4440e0[_0xd364('0x55')]);return db['FaxAccount']['find'](_0x716d64)['then'](handleEntityNotFound(_0x3019cc,null))[_0xd364('0x25')](respondWithResult(_0x3019cc,null))[_0xd364('0x2d')](handleError(_0x3019cc,null));};exports[_0xd364('0x5e')]=function(_0x2c9634,_0x396295){return db[_0xd364('0x56')][_0xd364('0x5e')](_0x2c9634[_0xd364('0x5f')],{})[_0xd364('0x25')](function(_0x40ac54){var _0x456ff5=_0x2c9634['user'][_0xd364('0x3c')]({'plain':!![]});if(!_0x456ff5)throw new Error(_0xd364('0x60'));if(_0x456ff5[_0xd364('0x61')]===_0xd364('0x62')){var _0x176062=_0x40ac54[_0xd364('0x3c')]({'plain':!![]});var _0x67aa04='FaxAccounts';return db['UserProfileSection'][_0xd364('0x63')]({'where':{'name':_0x67aa04,'userProfileId':_0x456ff5[_0xd364('0x64')]},'raw':!![]})['then'](function(_0x26cdd8){if(_0x26cdd8&&_0x26cdd8[_0xd364('0x65')]===0x0){return db['UserProfileResource'][_0xd364('0x5e')]({'name':_0x176062[_0xd364('0x41')],'resourceId':_0x176062['id'],'type':_0x26cdd8[_0xd364('0x41')],'sectionId':_0x26cdd8['id']},{})['then'](function(){return _0x40ac54;});}else{return _0x40ac54;}})[_0xd364('0x2d')](function(_0x38e9be){logger[_0xd364('0x2a')](_0xd364('0x66'),_0x38e9be);throw _0x38e9be;});}return _0x40ac54;})[_0xd364('0x25')](respondWithResult(_0x396295,0xc9))[_0xd364('0x2d')](handleError(_0x396295,null));};exports[_0xd364('0x3b')]=function(_0x1474d7,_0x2fa761){if(_0x1474d7['body']['id']){delete _0x1474d7[_0xd364('0x5f')]['id'];}return db[_0xd364('0x56')][_0xd364('0x63')]({'where':{'id':_0x1474d7[_0xd364('0x5b')]['id']},'include':[{'model':db[_0xd364('0x44')],'as':_0xd364('0x45')}]})[_0xd364('0x25')](handleEntityNotFound(_0x2fa761,null))[_0xd364('0x25')](saveUpdates(_0x1474d7['body'],null))[_0xd364('0x25')](respondWithResult(_0x2fa761,null))['catch'](handleError(_0x2fa761,null));};exports[_0xd364('0x3f')]=function(_0x3724d6,_0x31f0a9){return db[_0xd364('0x56')][_0xd364('0x63')]({'where':{'id':_0x3724d6['params']['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x31f0a9,null))[_0xd364('0x25')](removeEntity(_0x31f0a9,null))[_0xd364('0x2d')](handleError(_0x31f0a9,null));};exports[_0xd364('0x67')]=function(_0x30636f,_0x3eb33a){return db['FaxAccount']['describe']()[_0xd364('0x25')](respondWithResult(_0x3eb33a,null))[_0xd364('0x2d')](handleError(_0x3eb33a,null));};exports[_0xd364('0x68')]=function(_0x511e83,_0x13fc91,_0xc199){if(_0x511e83[_0xd364('0x5f')]['id']){delete _0x511e83[_0xd364('0x5f')]['id'];}return db[_0xd364('0x56')]['find']({'where':{'id':_0x511e83[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x13fc91,null))[_0xd364('0x25')](function(_0xd84ef6){if(_0xd84ef6){_0x511e83[_0xd364('0x5f')][_0xd364('0x69')]=_0xd84ef6['id'];return db[_0xd364('0x6a')][_0xd364('0x5e')](_0x511e83[_0xd364('0x5f')]);}})[_0xd364('0x25')](respondWithResult(_0x13fc91,null))[_0xd364('0x2d')](handleError(_0x13fc91,null));};exports[_0xd364('0x6b')]=function(_0x43aa5e,_0x403e5b,_0x1f0b16){var _0x2607a6={'raw':![],'where':{}};var _0x3b0b97={};var _0xd26076={'count':0x0,'rows':[]};return db[_0xd364('0x56')][_0xd364('0x6c')]({'where':{'id':_0x43aa5e['params']['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x403e5b,null))[_0xd364('0x25')](function(_0x35a254){if(_0x35a254){_0x3b0b97[_0xd364('0x48')]=_[_0xd364('0x49')](db[_0xd364('0x6a')]['rawAttributes']);_0x3b0b97[_0xd364('0x4a')]=_[_0xd364('0x49')](_0x43aa5e['query']);_0x3b0b97[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x3b0b97['model'],_0x3b0b97[_0xd364('0x4a')]);_0x2607a6[_0xd364('0x4b')]=_['intersection'](_0x3b0b97[_0xd364('0x48')],qs[_0xd364('0x4d')](_0x43aa5e[_0xd364('0x4a')][_0xd364('0x4d')]));_0x2607a6[_0xd364('0x4b')]=_0x2607a6[_0xd364('0x4b')][_0xd364('0x5d')]?_0x2607a6[_0xd364('0x4b')]:_0x3b0b97[_0xd364('0x48')];if(!_0x43aa5e[_0xd364('0x4a')][_0xd364('0x4e')](_0xd364('0x6d'))){_0x2607a6[_0xd364('0x34')]=qs[_0xd364('0x34')](_0x43aa5e[_0xd364('0x4a')][_0xd364('0x34')]);_0x2607a6['offset']=qs['offset'](_0x43aa5e[_0xd364('0x4a')]['offset']);}_0x2607a6[_0xd364('0x6e')]=qs[_0xd364('0x4f')](_0x43aa5e[_0xd364('0x4a')][_0xd364('0x4f')]);_0x2607a6['where']=qs['filters'](_[_0xd364('0x52')](_0x43aa5e[_0xd364('0x4a')],_0x3b0b97[_0xd364('0x51')]));_0x2607a6[_0xd364('0x50')][_0xd364('0x69')]=_0x35a254['id'];if(_0x43aa5e[_0xd364('0x4a')]['filter']){_0x2607a6[_0xd364('0x50')]=_[_0xd364('0x6f')](_0x2607a6['where'],{'$or':_[_0xd364('0x46')](_0x2607a6[_0xd364('0x4b')],function(_0x41b81f){var _0x443d3c={};_0x443d3c[_0x41b81f]={'$like':'%'+_0x43aa5e[_0xd364('0x4a')][_0xd364('0x53')]+'%'};return _0x443d3c;})});}_0x2607a6=_[_0xd364('0x6f')]({},_0x2607a6,_0x43aa5e['options']);return db[_0xd364('0x6a')]['count']({'where':_0x2607a6[_0xd364('0x50')]})['then'](function(_0x1da3cb){_0xd26076[_0xd364('0x35')]=_0x1da3cb;if(_0x43aa5e[_0xd364('0x4a')][_0xd364('0x57')]){_0x2607a6[_0xd364('0x58')]=[{'all':!![]}];}return db[_0xd364('0x6a')][_0xd364('0x70')](_0x2607a6);})['then'](function(_0x34ab2b){_0xd26076[_0xd364('0x59')]=_0x34ab2b;return _0xd26076;});}})[_0xd364('0x25')](respondWithFilteredResult(_0x403e5b,_0x2607a6))['catch'](handleError(_0x403e5b,null));};exports['removeDispositions']=function(_0x340bc6,_0x2115b0,_0x478bfd){return db['FaxAccount'][_0xd364('0x63')]({'where':{'id':_0x340bc6['params']['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x2115b0,null))[_0xd364('0x25')](function(_0x3690f6){if(_0x3690f6){return _0x3690f6[_0xd364('0x71')](_0x340bc6[_0xd364('0x4a')][_0xd364('0x72')]);}})[_0xd364('0x25')](respondWithStatusCode(_0x2115b0,null))[_0xd364('0x2d')](handleError(_0x2115b0,null));};exports[_0xd364('0x73')]=function(_0x4de095,_0x2322ca,_0x45262b){if(_0x4de095[_0xd364('0x5f')]['id']){delete _0x4de095[_0xd364('0x5f')]['id'];}return db[_0xd364('0x56')]['find']({'where':{'id':_0x4de095[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x2322ca,null))[_0xd364('0x25')](function(_0x205589){if(_0x205589){_0x4de095[_0xd364('0x5f')][_0xd364('0x69')]=_0x205589['id'];return db[_0xd364('0x74')]['create'](_0x4de095['body']);}})[_0xd364('0x25')](respondWithResult(_0x2322ca,null))[_0xd364('0x2d')](handleError(_0x2322ca,null));};exports[_0xd364('0x75')]=function(_0x311898,_0x129032,_0x26ec9f){var _0x17afd9={'raw':![],'where':{}};var _0xf9388b={};var _0xa34064={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd364('0x6c')]({'where':{'id':_0x311898[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x129032,null))['then'](function(_0x5bf99c){if(_0x5bf99c){_0xf9388b['model']=_[_0xd364('0x49')](db[_0xd364('0x74')][_0xd364('0x5c')]);_0xf9388b[_0xd364('0x4a')]=_['keys'](_0x311898[_0xd364('0x4a')]);_0xf9388b[_0xd364('0x51')]=_[_0xd364('0x4c')](_0xf9388b[_0xd364('0x48')],_0xf9388b[_0xd364('0x4a')]);_0x17afd9[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0xf9388b[_0xd364('0x48')],qs[_0xd364('0x4d')](_0x311898[_0xd364('0x4a')][_0xd364('0x4d')]));_0x17afd9[_0xd364('0x4b')]=_0x17afd9[_0xd364('0x4b')]['length']?_0x17afd9[_0xd364('0x4b')]:_0xf9388b['model'];if(!_0x311898[_0xd364('0x4a')][_0xd364('0x4e')](_0xd364('0x6d'))){_0x17afd9[_0xd364('0x34')]=qs[_0xd364('0x34')](_0x311898[_0xd364('0x4a')][_0xd364('0x34')]);_0x17afd9[_0xd364('0x32')]=qs[_0xd364('0x32')](_0x311898[_0xd364('0x4a')][_0xd364('0x32')]);}_0x17afd9[_0xd364('0x6e')]=qs[_0xd364('0x4f')](_0x311898[_0xd364('0x4a')][_0xd364('0x4f')]);_0x17afd9[_0xd364('0x50')]=qs[_0xd364('0x51')](_[_0xd364('0x52')](_0x311898[_0xd364('0x4a')],_0xf9388b[_0xd364('0x51')]));_0x17afd9[_0xd364('0x50')][_0xd364('0x69')]=_0x5bf99c['id'];if(_0x311898['query']['filter']){_0x17afd9['where']=_[_0xd364('0x6f')](_0x17afd9[_0xd364('0x50')],{'$or':_[_0xd364('0x46')](_0x17afd9['attributes'],function(_0x251a16){var _0x51c477={};_0x51c477[_0x251a16]={'$like':'%'+_0x311898['query'][_0xd364('0x53')]+'%'};return _0x51c477;})});}_0x17afd9=_[_0xd364('0x6f')]({},_0x17afd9,_0x311898['options']);return db[_0xd364('0x74')][_0xd364('0x35')]({'where':_0x17afd9[_0xd364('0x50')]})[_0xd364('0x25')](function(_0x4777c5){_0xa34064['count']=_0x4777c5;if(_0x311898['query'][_0xd364('0x57')]){_0x17afd9['include']=[{'all':!![]}];}return db[_0xd364('0x74')][_0xd364('0x70')](_0x17afd9);})[_0xd364('0x25')](function(_0x53c464){_0xa34064[_0xd364('0x59')]=_0x53c464;return _0xa34064;});}})[_0xd364('0x25')](respondWithFilteredResult(_0x129032,_0x17afd9))[_0xd364('0x2d')](handleError(_0x129032,null));};exports[_0xd364('0x76')]=function(_0x4a2d66,_0x12662a,_0x1d5d65){return db[_0xd364('0x56')][_0xd364('0x63')]({'where':{'id':_0x4a2d66['params']['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x12662a,null))['then'](function(_0x5242f6){if(_0x5242f6){return _0x5242f6[_0xd364('0x76')](_0x4a2d66[_0xd364('0x4a')]['ids']);}})[_0xd364('0x25')](respondWithStatusCode(_0x12662a,null))[_0xd364('0x2d')](handleError(_0x12662a,null));};exports[_0xd364('0x77')]=function(_0x262ccb,_0x46208b,_0x236f7c){return db[_0xd364('0x78')][_0xd364('0x63')]({'where':{'id':_0x262ccb[_0xd364('0x5b')]['id']}})['then'](handleEntityNotFound(_0x46208b,null))[_0xd364('0x25')](function(_0x37ec94){if(_0x37ec94){return _0x37ec94[_0xd364('0x77')](_0x262ccb['body'][_0xd364('0x72')],_[_0xd364('0x79')](_0x262ccb['body'],[_0xd364('0x72'),'id'])||{});}})[_0xd364('0x25')](respondWithResult(_0x46208b,null))[_0xd364('0x2d')](handleError(_0x46208b,null));};exports[_0xd364('0x7a')]=function(_0x385c31,_0x53aaea,_0x48a448){var _0x2be69d={'raw':![],'where':{}};var _0x1f89fc={};var _0x1d6ff7={'count':0x0,'rows':[]};return db[_0xd364('0x56')][_0xd364('0x6c')]({'where':{'id':_0x385c31[_0xd364('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53aaea,null))['then'](function(_0x30aee0){if(_0x30aee0){_0x1f89fc['model']=_[_0xd364('0x49')](db[_0xd364('0x78')][_0xd364('0x5c')]);_0x1f89fc[_0xd364('0x4a')]=_[_0xd364('0x49')](_0x385c31[_0xd364('0x4a')]);_0x1f89fc[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x1f89fc['model'],_0x1f89fc[_0xd364('0x4a')]);_0x2be69d[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0x1f89fc['model'],qs['fields'](_0x385c31[_0xd364('0x4a')]['fields']));_0x2be69d[_0xd364('0x4b')]=_0x2be69d['attributes'][_0xd364('0x5d')]?_0x2be69d[_0xd364('0x4b')]:_0x1f89fc[_0xd364('0x48')];if(!_0x385c31[_0xd364('0x4a')][_0xd364('0x4e')](_0xd364('0x6d'))){_0x2be69d[_0xd364('0x34')]=qs[_0xd364('0x34')](_0x385c31['query']['limit']);_0x2be69d[_0xd364('0x32')]=qs[_0xd364('0x32')](_0x385c31[_0xd364('0x4a')][_0xd364('0x32')]);}_0x2be69d[_0xd364('0x6e')]=qs[_0xd364('0x4f')](_0x385c31[_0xd364('0x4a')][_0xd364('0x4f')]);_0x2be69d[_0xd364('0x50')]=qs['filters'](_[_0xd364('0x52')](_0x385c31[_0xd364('0x4a')],_0x1f89fc[_0xd364('0x51')]));_0x2be69d[_0xd364('0x50')]['FaxAccountId']=_0x30aee0['id'];if(_0x385c31[_0xd364('0x4a')][_0xd364('0x53')]){_0x2be69d[_0xd364('0x50')]=_[_0xd364('0x6f')](_0x2be69d[_0xd364('0x50')],{'$or':_[_0xd364('0x46')](_0x2be69d[_0xd364('0x4b')],function(_0x1512f6){var _0x4a3c68={};_0x4a3c68[_0x1512f6]={'$like':'%'+_0x385c31['query'][_0xd364('0x53')]+'%'};return _0x4a3c68;})});}_0x2be69d=_[_0xd364('0x6f')]({},_0x2be69d,_0x385c31[_0xd364('0x55')]);return db[_0xd364('0x78')]['count']({'where':_0x2be69d[_0xd364('0x50')]})[_0xd364('0x25')](function(_0x2c5573){_0x1d6ff7[_0xd364('0x35')]=_0x2c5573;if(_0x385c31[_0xd364('0x4a')][_0xd364('0x57')]){_0x2be69d['include']=[{'model':db[_0xd364('0x7b')],'as':_0xd364('0x7c'),'required':![]},{'model':db[_0xd364('0x7d')],'as':'Owner','attributes':[_0xd364('0x41'),_0xd364('0x7e'),_0xd364('0x7f')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd364('0x41'),'color'],'where':_0x385c31[_0xd364('0x4a')]['tag']?{'id':_0x385c31['query'][_0xd364('0x80')]}:undefined,'required':_0x385c31['query'][_0xd364('0x80')]?!![]:![]}];}return db[_0xd364('0x78')][_0xd364('0x70')](_0x2be69d);})[_0xd364('0x25')](function(_0x376f95){_0x1d6ff7[_0xd364('0x59')]=_0x376f95;return _0x1d6ff7;});}})['then'](respondWithFilteredResult(_0x53aaea,_0x2be69d))['catch'](handleError(_0x53aaea,null));};exports[_0xd364('0x81')]=function(_0x1d96c7,_0x23292f){var _0x2ad214=_0x1d96c7[_0xd364('0x5b')]['id'];var _0x3cdc58=_0x1d96c7[_0xd364('0x5f')];var _0x58ae47=0xc8;var _0x134e29=null;return db[_0xd364('0x82')]['transaction']({'isolationLevel':db[_0xd364('0x82')][_0xd364('0x83')][_0xd364('0x84')][_0xd364('0x85')]},function(_0xe61f7e){return db[_0xd364('0x56')][_0xd364('0x6c')]({'where':{'id':_0x2ad214},'transaction':_0xe61f7e})[_0xd364('0x25')](function(_0x213552){if(_0x213552){return db[_0xd364('0x86')]['destroy']({'where':{'FaxAccountId':_0x2ad214},'transaction':_0xe61f7e})['then'](function(){var _0x300721=_[_0xd364('0x46')](_0x3cdc58,function(_0x2f0460){_0x2f0460[_0xd364('0x69')]=_0x2ad214;return _0x2f0460;});return db['FaxApplication'][_0xd364('0x87')](_0x300721,{'transaction':_0xe61f7e});});}else{_0x58ae47=0x194;_0x134e29=[];}});})['then'](function(){if(_0x58ae47!==0x194){return db['FaxApplication'][_0xd364('0x88')]({'where':{'FaxAccountId':_0x2ad214},'order':_0xd364('0x89')})[_0xd364('0x25')](function(_0x38d747){_0x134e29=_0x38d747;});}})[_0xd364('0x2d')](function(_0xabddf4){_0x58ae47=0x1f4;logger[_0xd364('0x2a')](_0xabddf4[_0xd364('0x40')]);if(_0xabddf4[_0xd364('0x41')]){delete _0xabddf4[_0xd364('0x41')];}_0x134e29=_0xabddf4;})['finally'](function(){if(_0x134e29===null){_0x23292f[_0xd364('0x2e')](_0x58ae47);}else{if(_0x58ae47===0x1f4){_0x23292f[_0xd364('0x30')](_0x58ae47)[_0xd364('0x42')](_0x134e29);}else{_0x23292f['status'](_0x58ae47)[_0xd364('0x31')](_0x134e29);}}});};exports[_0xd364('0x8a')]=function(_0x16eb8c,_0x293bf2,_0x4020df){var _0x2edaf7={};var _0x2bc700={};var _0x5baecd;var _0x2b715e;return db[_0xd364('0x56')][_0xd364('0x6c')]({'where':{'id':_0x16eb8c[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x293bf2,null))[_0xd364('0x25')](function(_0x20c5a3){if(_0x20c5a3){_0x5baecd=_0x20c5a3;_0x2bc700['model']=_[_0xd364('0x49')](db['FaxApplication'][_0xd364('0x5c')]);_0x2bc700['query']=_[_0xd364('0x49')](_0x16eb8c[_0xd364('0x4a')]);_0x2bc700[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x2bc700[_0xd364('0x48')],_0x2bc700[_0xd364('0x4a')]);_0x2edaf7[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0x2bc700[_0xd364('0x48')],qs[_0xd364('0x4d')](_0x16eb8c[_0xd364('0x4a')][_0xd364('0x4d')]));_0x2edaf7[_0xd364('0x4b')]=_0x2edaf7['attributes'][_0xd364('0x5d')]?_0x2edaf7[_0xd364('0x4b')]:_0x2bc700[_0xd364('0x48')];_0x2edaf7['order']=qs[_0xd364('0x4f')](_0x16eb8c[_0xd364('0x4a')]['sort']);_0x2edaf7[_0xd364('0x50')]=qs['filters'](_[_0xd364('0x52')](_0x16eb8c[_0xd364('0x4a')],_0x2bc700[_0xd364('0x51')]));if(_0x16eb8c[_0xd364('0x4a')][_0xd364('0x53')]){_0x2edaf7['where']=_[_0xd364('0x6f')](_0x2edaf7['where'],{'$or':_[_0xd364('0x46')](_0x2edaf7[_0xd364('0x4b')],function(_0x3601d9){var _0x5d042c={};_0x5d042c[_0x3601d9]={'$like':'%'+_0x16eb8c[_0xd364('0x4a')][_0xd364('0x53')]+'%'};return _0x5d042c;})});}_0x2edaf7=_['merge']({},_0x2edaf7,_0x16eb8c['options']);return _0x5baecd['getApplications'](_0x2edaf7);}})[_0xd364('0x25')](function(_0x174e25){if(_0x174e25){_0x2b715e=_0x174e25['length'];if(!_0x16eb8c[_0xd364('0x4a')]['hasOwnProperty'](_0xd364('0x6d'))){_0x2edaf7[_0xd364('0x34')]=qs['limit'](_0x16eb8c['query'][_0xd364('0x34')]);_0x2edaf7['offset']=qs['offset'](_0x16eb8c[_0xd364('0x4a')][_0xd364('0x32')]);}return _0x5baecd['getApplications'](_0x2edaf7);}})[_0xd364('0x25')](function(_0x30be0f){if(_0x30be0f){return _0x30be0f?{'count':_0x2b715e,'rows':_0x30be0f}:null;}})[_0xd364('0x25')](respondWithResult(_0x293bf2,null))['catch'](handleError(_0x293bf2,null));};function Extension(_0xb67794,_0x1bc580,_0x14ecad,_0x5dd6ce){this[_0xd364('0x8b')]='from-voip-provider';this[_0xd364('0x8c')]=_0xb67794[_0xd364('0x8d')];this[_0xd364('0x8e')]=_0x5dd6ce;this[_0xd364('0x47')]=_0xd364('0x8f');this[_0xd364('0x90')]=_0xd364('0x91');this[_0xd364('0x69')]=_0xb67794['id'];this['priority']=_0x1bc580;this[_0xd364('0x92')]=_0x14ecad;}function createExtensionsReciveFax(_0x346191){var _0x3dbe56=0x1;var _0x47a62d=[];_0x47a62d[_0xd364('0x93')](new Extension(_0x346191,_0x3dbe56,'',_0xd364('0x94')));_0x3dbe56+=0x1;_0x47a62d['push'](new Extension(_0x346191,_0x3dbe56,_0xd364('0x95'),_0xd364('0x96')));_0x3dbe56+=0x1;for(var _0x4c772f in _0x346191){if(_0x346191[_0xd364('0x4e')](_0x4c772f)&&(_0x4c772f==='ecm'||_0x4c772f===_0xd364('0x8d')||_0x4c772f===_0xd364('0x97')||_0x4c772f===_0xd364('0x98')||_0x4c772f==='headerinfo'||_0x4c772f===_0xd364('0x99')||_0x4c772f==='minrate'||_0x4c772f===_0xd364('0x9a')||_0x4c772f==='t38timeout')){_0x47a62d[_0xd364('0x93')](new Extension(_0x346191,_0x3dbe56,_0xd364('0x9b')+_0x4c772f+')='+_0x346191[_0x4c772f],_0xd364('0x96')));_0x3dbe56+=0x1;}}_0x47a62d[_0xd364('0x93')](new Extension(_0x346191,_0x3dbe56,'6',_0xd364('0x9c')));_0x3dbe56+=0x1;_0x47a62d[_0xd364('0x93')](new Extension(_0x346191,_0x3dbe56,_0xd364('0x9d'),_0xd364('0x9e')));_0x3dbe56=0x0;return _0x47a62d;}exports[_0xd364('0x9f')]=function(_0x56043b,_0x1d0242,_0x5a5782){var _0x335a1a;return db[_0xd364('0x82')][_0xd364('0xa0')](function(_0x3ba546){return db[_0xd364('0x56')][_0xd364('0x5e')](_0x56043b[_0xd364('0x5f')],{'transaction':_0x3ba546})[_0xd364('0x25')](function(_0x8cf58){_0x335a1a=_0x8cf58[_0xd364('0x3c')]({'plain':!![]});return db[_0xd364('0xa1')]['bulkCreate'](createExtensionsReciveFax(_0x335a1a),{'transaction':_0x3ba546});});})[_0xd364('0x25')](function(){return _0x335a1a;})['then'](respondWithResult(_0x1d0242,null))[_0xd364('0x2d')](handleError(_0x1d0242,null));};exports[_0xd364('0xa2')]=function(_0x4b2db2,_0x30ccb4,_0x26e3d2){var _0x1aeb29;return db[_0xd364('0x82')][_0xd364('0xa0')](function(_0x394c2e){return db[_0xd364('0x56')]['update'](_0x4b2db2['body'],{'where':{'id':_0x4b2db2[_0xd364('0x5f')]['id']},'transaction':_0x394c2e})[_0xd364('0x25')](function(_0x4ade7e){return db[_0xd364('0xa1')][_0xd364('0x3f')]({'where':{'FaxAccountId':_0x4b2db2[_0xd364('0x5f')]['id']},'transaction':_0x394c2e})['then'](function(_0x10bde6){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x4b2db2[_0xd364('0x5f')],[_0xd364('0xa3'),_0xd364('0xa4'),_0xd364('0xa5'),_0xd364('0xa6'),_0xd364('0xa7'),'ListId'])),{'transaction':_0x394c2e});});});})[_0xd364('0x25')](function(){return db[_0xd364('0x56')]['findById'](_0x4b2db2[_0xd364('0x5f')]['id']);})[_0xd364('0x25')](respondWithResult(_0x30ccb4,null))['catch'](handleError(_0x30ccb4,null));};exports[_0xd364('0xa8')]=function(_0x3125dc,_0x2244df,_0x50b9a4){var _0x57d5c7={'raw':!![],'where':{}};var _0x3a0587={};var _0x563a36={'count':0x0,'rows':[]};return db[_0xd364('0x56')]['findOne']({'where':{'id':_0x3125dc[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x2244df,null))[_0xd364('0x25')](function(_0xedcc3f){if(_0xedcc3f){_0x3a0587[_0xd364('0x48')]=_[_0xd364('0x49')](db[_0xd364('0xa9')]['rawAttributes']);_0x3a0587[_0xd364('0x4a')]=_[_0xd364('0x49')](_0x3125dc['query']);_0x3a0587[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x3a0587['model'],_0x3a0587[_0xd364('0x4a')]);_0x57d5c7['attributes']=_[_0xd364('0x4c')](_0x3a0587[_0xd364('0x48')],qs[_0xd364('0x4d')](_0x3125dc[_0xd364('0x4a')][_0xd364('0x4d')]));_0x57d5c7[_0xd364('0x4b')]=_0x57d5c7[_0xd364('0x4b')][_0xd364('0x5d')]?_0x57d5c7[_0xd364('0x4b')]:_0x3a0587[_0xd364('0x48')];if(!_0x3125dc['query']['hasOwnProperty'](_0xd364('0x6d'))){_0x57d5c7['limit']=qs[_0xd364('0x34')](_0x3125dc[_0xd364('0x4a')][_0xd364('0x34')]);_0x57d5c7[_0xd364('0x32')]=qs['offset'](_0x3125dc[_0xd364('0x4a')][_0xd364('0x32')]);}_0x57d5c7[_0xd364('0x6e')]=qs['sort'](_0x3125dc[_0xd364('0x4a')][_0xd364('0x4f')]);_0x57d5c7[_0xd364('0x50')]=qs[_0xd364('0x51')](_[_0xd364('0x52')](_0x3125dc['query'],_0x3a0587['filters']));_0x57d5c7[_0xd364('0x50')][_0xd364('0x69')]=_0xedcc3f['id'];if(_0x3125dc[_0xd364('0x4a')][_0xd364('0x53')]){_0x57d5c7[_0xd364('0x50')]=_[_0xd364('0x6f')](_0x57d5c7['where'],{'$or':_[_0xd364('0x46')](_0x57d5c7[_0xd364('0x4b')],function(_0x51ffc4){var _0x343996={};_0x343996[_0x51ffc4]={'$like':'%'+_0x3125dc[_0xd364('0x4a')]['filter']+'%'};return _0x343996;})});}if(_0x3125dc['query'][_0xd364('0xaa')]){var _0x4dd0fb=_0x3125dc[_0xd364('0x4a')][_0xd364('0xaa')][_0xd364('0xab')](',');var _0x549471={};_0x549471[_0x4dd0fb[0x0]]={'$gte':moment(_0x4dd0fb[0x1])[_0xd364('0xac')](_0xd364('0xad'))};_0x57d5c7[_0xd364('0x50')]=_[_0xd364('0x6f')](_0x57d5c7[_0xd364('0x50')],_0x549471);}_0x57d5c7=_['merge']({},_0x57d5c7,_0x3125dc[_0xd364('0x55')]);return db[_0xd364('0xa9')]['count']({'where':_0x57d5c7[_0xd364('0x50')]})[_0xd364('0x25')](function(_0x2a90ae){_0x563a36[_0xd364('0x35')]=_0x2a90ae;if(_0x3125dc['query'][_0xd364('0x57')]){_0x57d5c7[_0xd364('0x58')]=[{'all':!![]}];}return db[_0xd364('0xa9')][_0xd364('0x70')](_0x57d5c7);})[_0xd364('0x25')](function(_0x162c22){_0x563a36[_0xd364('0x59')]=_0x162c22;return _0x563a36;});}})[_0xd364('0x25')](respondWithFilteredResult(_0x2244df,_0x57d5c7))[_0xd364('0x2d')](handleError(_0x2244df,null));};exports[_0xd364('0x42')]=function(_0x1a2189,_0xb5b0bf,_0xb81cf1){var _0x2bf892,_0x59b2cc={},_0x1a4d31;if(_0x1a2189[_0xd364('0x5f')]['to']){_0x1a4d31=_0x1a2189[_0xd364('0x5f')]['to'][0x0];}return db[_0xd364('0x56')][_0xd364('0x63')]({'where':{'id':_0x1a2189['params']['id']},'include':[{'model':db[_0xd364('0xae')],'as':'List','include':[{'model':db[_0xd364('0x7b')],'as':_0xd364('0xaf'),'where':{'fax':_0x1a4d31},'limit':0x1,'order':[[_0xd364('0xa6'),'DESC']]}]}]})[_0xd364('0x25')](handleEntityNotFound(_0xb5b0bf,null))[_0xd364('0x25')](function(_0x682f33){_0x2bf892=_0x682f33;if(_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')]&&_0x1a2189[_0xd364('0x5f')]['attachments'][_0xd364('0x5d')]){for(var _0x20bbe2=0x0;_0x20bbe2<_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][_0xd364('0x5d')];_0x20bbe2+=0x1){_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][_0x20bbe2]={'filename':_0x1a2189[_0xd364('0x5f')]['attachments'][_0x20bbe2]['name'],'id':_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][_0x20bbe2]['id'],'path':path['join'](config[_0xd364('0xb1')],'server/files/attachments',_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][_0x20bbe2][_0xd364('0xb2')])};}}return respondWithRpcPromise(_0xd364('0xb3'),_0xd364('0xb3'),{'FaxAccountId':_['isNil'](_0x1a2189['params']['id'])?undefined:_0x1a2189[_0xd364('0x5b')]['id'],'path':_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][0x0][_0xd364('0x8')])?undefined:_0x1a2189[_0xd364('0x5f')]['attachments'][0x0]['path'],'fax':_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5f')]['to'][0x0])?undefined:_0x1a2189[_0xd364('0x5f')]['to'][0x0]},client9002);})[_0xd364('0x25')](function(){if(_0x2bf892){if(_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5f')][_0xd364('0xb5')])){_0x1a2189[_0xd364('0x5f')][_0xd364('0xb5')]=util[_0xd364('0xac')](_0xd364('0xb6'),_0x2bf892[_0xd364('0x41')],_0x2bf892[_0xd364('0xb7')]);}if(_0x2bf892[_0xd364('0xb8')]){if(_0x2bf892[_0xd364('0xb8')][_0xd364('0xaf')][_0xd364('0x5d')]){return _0x2bf892[_0xd364('0xb8')]['Contacts'][0x0];}else{return db[_0xd364('0x7b')][_0xd364('0x5e')](_['defaults'](_0x1a2189[_0xd364('0x5f')],{'firstName':_0x1a2189['body']['to'][0x0],'phone':_0x1a2189[_0xd364('0x5f')]['to'][0x0],'fax':_0x1a2189['body']['to'][0x0],'ListId':_0x2bf892[_0xd364('0xb9')]}));}}else{throw new Error(_0xd364('0xba'));}}else{throw new Error(_0xd364('0xbb'));}})[_0xd364('0x25')](function(_0x1b8526){if(_0x1b8526){return db[_0xd364('0x78')][_0xd364('0x63')]({'where':{'ContactId':_0x1b8526['id'],'closed':![],'FaxAccountId':_0x2bf892['id']}})[_0xd364('0x25')](function(_0x103f81){if(_0x103f81){return[_0x103f81,![]];}return db[_0xd364('0x78')][_0xd364('0x5e')]({'UserId':_0x1a2189[_0xd364('0x62')]['id'],'ContactId':_0x1b8526['id'],'FaxAccountId':_0x2bf892['id'],'fax':_0x1a2189[_0xd364('0x5f')]['to'][0x0],'firstMsgDirection':_0xd364('0xbc'),'Messages':[_[_0xd364('0x6f')](_0x1a2189[_0xd364('0x5f')],{'read':![],'body':_0x1a2189['body'][_0xd364('0xb0')][0x0][_0xd364('0xbd')],'FaxAccountId':_0x2bf892['id'],'UserId':_0x1a2189[_0xd364('0x62')]['id'],'ContactId':_0x1b8526['id'],'AttachmentId':_0x1a2189['body'][_0xd364('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xd364('0xa9')],'as':_0xd364('0xbe')}]})[_0xd364('0x25')](function(_0x1db67f){return[_0x1db67f,!![]];});});}else{throw new Error(_0xd364('0xbf'));}})[_0xd364('0xc0')](function(_0x254183,_0x171865){if(_0x171865){return _0x254183;}return db[_0xd364('0xa9')]['create']({'direction':'out','read':![],'body':_0x1a2189['body'][_0xd364('0xb0')][0x0][_0xd364('0xbd')],'FaxAccountId':_0x2bf892['id'],'FaxInteractionId':_0x254183['id'],'UserId':_0x1a2189[_0xd364('0x62')]['id'],'ContactId':_0x254183['ContactId'],'AttachmentId':_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][0x0]['id']})[_0xd364('0x25')](function(_0x166473){_0x254183['dataValues'][_0xd364('0xbe')]=[];_0x254183[_0xd364('0xc1')][_0xd364('0xbe')][_0xd364('0x93')](_0x166473[_0xd364('0xc1')]);return _0x254183;});})[_0xd364('0x25')](function(_0x17743c){respondWithRpcPromise(_0xd364('0xc2'),_0xd364('0xc2'),{'FaxAccountId':_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5b')]['id'])?undefined:_0x1a2189[_0xd364('0x5b')]['id'],'path':_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5f')][_0xd364('0xb0')][0x0][_0xd364('0x8')])?undefined:_0x1a2189['body'][_0xd364('0xb0')][0x0][_0xd364('0x8')],'fax':_[_0xd364('0xb4')](_0x1a2189[_0xd364('0x5f')]['to'][0x0])?undefined:_0x1a2189['body']['to'][0x0],'AttachmentId':_0x1a2189[_0xd364('0x5f')]['attachments'][0x0]['id']},client9002)[_0xd364('0x25')](function(_0x3fe657){logger['info']('SendFaxRpc,\x20%s',_0x3fe657);})[_0xd364('0x2d')](function(_0x1b95f7){logger['info']('SendFaxRpc,\x20%s',_0x1b95f7);});return _0x17743c;})[_0xd364('0x25')](respondWithResult(_0xb5b0bf,null))['catch'](handleError(_0xb5b0bf,null));};exports[_0xd364('0xc3')]=function(_0x4749b6,_0x39560a,_0x1777e8){return db[_0xd364('0x56')]['find']({'where':{'id':_0x4749b6[_0xd364('0x5b')]['id']}})['then'](handleEntityNotFound(_0x39560a,null))[_0xd364('0x25')](function(_0x123c7f){if(_0x123c7f){return _0x123c7f[_0xd364('0xc3')](_0x4749b6[_0xd364('0x5f')][_0xd364('0x72')],_[_0xd364('0x79')](_0x4749b6[_0xd364('0x5f')],[_0xd364('0x72'),'id'])||{})[_0xd364('0xc0')](function(_0x5f197d){for(var _0x1d724b=0x0;_0x1d724b<_0x4749b6[_0xd364('0x5f')][_0xd364('0x72')]['length'];_0x1d724b+=0x1){socket[_0xd364('0xc4')](_0xd364('0xc5'),{'UserId':Number(_0x4749b6['body']['ids'][_0x1d724b]),'FaxAccountId':Number(_0x4749b6[_0xd364('0x5b')]['id'])});}return _0x5f197d;});}})[_0xd364('0x25')](respondWithResult(_0x39560a,null))[_0xd364('0x2d')](handleError(_0x39560a,null));};exports[_0xd364('0xc6')]=function(_0x326bd1,_0x316b03,_0x8743db){return db[_0xd364('0x56')]['find']({'where':{'id':_0x326bd1[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x316b03,null))[_0xd364('0x25')](function(_0x355e2d){if(_0x355e2d){return _0x355e2d[_0xd364('0xc6')](_0x326bd1[_0xd364('0x4a')][_0xd364('0x72')])[_0xd364('0x25')](function(){if(_[_0xd364('0xc7')](_0x326bd1[_0xd364('0x4a')]['ids'])){for(var _0x3e9542=0x0;_0x3e9542<_0x326bd1[_0xd364('0x4a')][_0xd364('0x72')][_0xd364('0x5d')];_0x3e9542+=0x1){socket[_0xd364('0xc4')](_0xd364('0xc8'),{'UserId':Number(_0x326bd1[_0xd364('0x4a')][_0xd364('0x72')][_0x3e9542]),'FaxAccountId':Number(_0x326bd1[_0xd364('0x5b')]['id'])});}}else{socket['emit'](_0xd364('0xc8'),{'UserId':Number(_0x326bd1[_0xd364('0x4a')][_0xd364('0x72')]),'FaxAccountId':Number(_0x326bd1[_0xd364('0x5b')]['id'])});}});}})[_0xd364('0x25')](respondWithStatusCode(_0x316b03,null))[_0xd364('0x2d')](handleError(_0x316b03,null));};exports['getAgents']=function(_0x1ac6fc,_0x50f3fa,_0x2ed70a){var _0x1f12d2={};var _0x36f495={};var _0x1a0737;var _0x2d2f2b;return db[_0xd364('0x56')][_0xd364('0x6c')]({'where':{'id':_0x1ac6fc[_0xd364('0x5b')]['id']}})[_0xd364('0x25')](handleEntityNotFound(_0x50f3fa,null))[_0xd364('0x25')](function(_0x5dac1a){if(_0x5dac1a){_0x1a0737=_0x5dac1a;_0x36f495[_0xd364('0x48')]=_[_0xd364('0x49')](db['User'][_0xd364('0x5c')]);_0x36f495[_0xd364('0x4a')]=_[_0xd364('0x49')](_0x1ac6fc[_0xd364('0x4a')]);_0x36f495[_0xd364('0x51')]=_[_0xd364('0x4c')](_0x36f495['model'],_0x36f495[_0xd364('0x4a')]);_0x1f12d2[_0xd364('0x4b')]=_[_0xd364('0x4c')](_0x36f495['model'],qs[_0xd364('0x4d')](_0x1ac6fc[_0xd364('0x4a')][_0xd364('0x4d')]));_0x1f12d2[_0xd364('0x4b')]=_0x1f12d2[_0xd364('0x4b')][_0xd364('0x5d')]?_0x1f12d2['attributes']:_0x36f495[_0xd364('0x48')];_0x1f12d2['order']=qs[_0xd364('0x4f')](_0x1ac6fc[_0xd364('0x4a')][_0xd364('0x4f')]);_0x1f12d2[_0xd364('0x50')]=qs[_0xd364('0x51')](_[_0xd364('0x52')](_0x1ac6fc[_0xd364('0x4a')],_0x36f495['filters']));if(_0x1ac6fc[_0xd364('0x4a')][_0xd364('0x53')]){_0x1f12d2[_0xd364('0x50')]=_['merge'](_0x1f12d2['where'],{'$or':_['map'](_0x1f12d2[_0xd364('0x4b')],function(_0x4f2e26){var _0x183c13={};_0x183c13[_0x4f2e26]={'$like':'%'+_0x1ac6fc['query'][_0xd364('0x53')]+'%'};return _0x183c13;})});}_0x1f12d2=_[_0xd364('0x6f')]({},_0x1f12d2,_0x1ac6fc['options']);return _0x1a0737[_0xd364('0xc9')](_0x1f12d2);}})[_0xd364('0x25')](function(_0x45f657){if(_0x45f657){_0x2d2f2b=_0x45f657[_0xd364('0x5d')];if(!_0x1ac6fc['query'][_0xd364('0x4e')](_0xd364('0x6d'))){_0x1f12d2[_0xd364('0x34')]=qs['limit'](_0x1ac6fc[_0xd364('0x4a')][_0xd364('0x34')]);_0x1f12d2['offset']=qs[_0xd364('0x32')](_0x1ac6fc['query']['offset']);}return _0x1a0737[_0xd364('0xc9')](_0x1f12d2);}})['then'](function(_0x3d3636){if(_0x3d3636){return _0x3d3636?{'count':_0x2d2f2b,'rows':_0x3d3636}:null;}})[_0xd364('0x25')](respondWithResult(_0x50f3fa,null))[_0xd364('0x2d')](handleError(_0x50f3fa,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a5dbf26..bc3b977 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 _0x134d=['update','remove','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x669681,_0x26e8f0){var _0x12b4e7=function(_0x46e1bf){while(--_0x46e1bf){_0x669681['push'](_0x669681['shift']());}};_0x12b4e7(++_0x26e8f0);}(_0x134d,0x16c));var _0xd134=function(_0xa0bab3,_0x5b64d3){_0xa0bab3=_0xa0bab3-0x0;var _0x13dc7a=_0x134d[_0xa0bab3];return _0x13dc7a;};'use strict';var EventEmitter=require(_0xd134('0x0'));var FaxAccount=require(_0xd134('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd134('0x2')](0x0);var events={'afterCreate':_0xd134('0x3'),'afterUpdate':_0xd134('0x4'),'afterDestroy':_0xd134('0x5')};function emitEvent(_0x3d815a){return function(_0x259259,_0x523ea8,_0x349392){FaxAccountEvents['emit'](_0x3d815a+':'+_0x259259['id'],_0x259259);FaxAccountEvents['emit'](_0x3d815a,_0x259259);_0x349392(null);};}for(var e in events){if(events[_0xd134('0x6')](e)){var event=events[e];FaxAccount[_0xd134('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xed65=['FaxAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x587ddd,_0xb039e4){var _0x44012f=function(_0x5971e5){while(--_0x5971e5){_0x587ddd['push'](_0x587ddd['shift']());}};_0x44012f(++_0xb039e4);}(_0xed65,0xcf));var _0x5ed6=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0xed65[_0xbf1875];return _0x2e598b;};'use strict';var EventEmitter=require(_0x5ed6('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5ed6('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5ed6('0x2')](0x0);var events={'afterCreate':_0x5ed6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37218e){return function(_0x521d9e,_0x1d9181,_0x2eb10d){FaxAccountEvents[_0x5ed6('0x4')](_0x37218e+':'+_0x521d9e['id'],_0x521d9e);FaxAccountEvents[_0x5ed6('0x4')](_0x37218e,_0x521d9e);_0x2eb10d(null);};}for(var e in events){if(events[_0x5ed6('0x5')](e)){var event=events[e];FaxAccount[_0x5ed6('0x6')](e,emitEvent(event));}}module[_0x5ed6('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 0816000..6356627 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 _0xd040=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','util','../../config/logger','api','moment'];(function(_0x4e31a2,_0x413d43){var _0x27d91a=function(_0x2107e3){while(--_0x2107e3){_0x4e31a2['push'](_0x4e31a2['shift']());}};_0x27d91a(++_0x413d43);}(_0xd040,0x134));var _0x0d04=function(_0x30c6d8,_0x2f5d44){_0x30c6d8=_0x30c6d8-0x0;var _0x178069=_0xd040[_0x30c6d8];return _0x178069;};'use strict';var _=require('lodash');var util=require(_0x0d04('0x0'));var logger=require(_0x0d04('0x1'))(_0x0d04('0x2'));var moment=require(_0x0d04('0x3'));var BPromise=require(_0x0d04('0x4'));var rp=require(_0x0d04('0x5'));var fs=require('fs');var path=require(_0x0d04('0x6'));var rimraf=require(_0x0d04('0x7'));var config=require(_0x0d04('0x8'));var attributes=require(_0x0d04('0x9'));module['exports']=function(_0x324996,_0x2bb61f){return _0x324996[_0x0d04('0xa')]('FaxAccount',attributes,{'tableName':_0x0d04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccd9=['bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger'];(function(_0xfcf737,_0x132075){var _0x5eccbe=function(_0x2dc482){while(--_0x2dc482){_0xfcf737['push'](_0xfcf737['shift']());}};_0x5eccbe(++_0x132075);}(_0xccd9,0x1cb));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ccd('0x0'));var util=require(_0x9ccd('0x1'));var logger=require(_0x9ccd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9ccd('0x3'));var rp=require(_0x9ccd('0x4'));var fs=require('fs');var path=require(_0x9ccd('0x5'));var rimraf=require('rimraf');var config=require(_0x9ccd('0x6'));var attributes=require(_0x9ccd('0x7'));module[_0x9ccd('0x8')]=function(_0x33b480,_0x21c56e){return _0x33b480[_0x9ccd('0x9')]('FaxAccount',attributes,{'tableName':_0x9ccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index d622fe6..8a06d2f 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 _0x3d79=['FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','UserId','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','Contacts','FaxApplication','Applications','applications','list','orderBy','create'];(function(_0x2a1c35,_0x252c87){var _0x496fa3=function(_0x158380){while(--_0x158380){_0x2a1c35['push'](_0x2a1c35['shift']());}};_0x496fa3(++_0x252c87);}(_0x3d79,0x6e));var _0x93d7=function(_0x5b2854,_0x50e491){_0x5b2854=_0x5b2854-0x0;var _0x33ae67=_0x3d79[_0x5b2854];return _0x33ae67;};'use strict';var _=require(_0x93d7('0x0'));var util=require('util');var moment=require(_0x93d7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93d7('0x2'));var fs=require('fs');var Redis=require(_0x93d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93d7('0x4'));var logger=require('../../config/logger')(_0x93d7('0x5'));var config=require('../../config/environment');var jayson=require(_0x93d7('0x6'));var client=jayson[_0x93d7('0x7')][_0x93d7('0x8')]({'port':0x232c});config[_0x93d7('0x9')]=_[_0x93d7('0xa')](config[_0x93d7('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93d7('0x9')]));require(_0x93d7('0xb'))[_0x93d7('0xc')](socket);function respondWithRpcPromise(_0x35873b,_0x413c35,_0x1d4c49){return new BPromise(function(_0x3ff564,_0x34a7f7){return client[_0x93d7('0xd')](_0x35873b,_0x1d4c49)[_0x93d7('0xe')](function(_0x2b940e){logger[_0x93d7('0xf')](_0x93d7('0x10'),_0x413c35,'request\x20sent');logger[_0x93d7('0x11')](_0x93d7('0x12'),_0x413c35,'request\x20sent',JSON[_0x93d7('0x13')](_0x2b940e));if(_0x2b940e[_0x93d7('0x14')]){if(_0x2b940e['error'][_0x93d7('0x15')]===0x1f4){logger['error'](_0x93d7('0x10'),_0x413c35,_0x2b940e['error'][_0x93d7('0x16')]);return _0x34a7f7(_0x2b940e[_0x93d7('0x14')][_0x93d7('0x16')]);}logger[_0x93d7('0x14')](_0x93d7('0x10'),_0x413c35,_0x2b940e[_0x93d7('0x14')]['message']);return _0x3ff564(_0x2b940e[_0x93d7('0x14')][_0x93d7('0x16')]);}else{logger[_0x93d7('0xf')](_0x93d7('0x10'),_0x413c35,'request\x20sent');_0x3ff564(_0x2b940e[_0x93d7('0x17')][_0x93d7('0x16')]);}})[_0x93d7('0x18')](function(_0x2bda90){logger[_0x93d7('0x14')]('FaxAccount,\x20%s,\x20%s',_0x413c35,_0x2bda90);_0x34a7f7(_0x2bda90);});});}exports[_0x93d7('0x19')]=function(_0x370c3a){var _0xf457e2=this;return new Promise(function(_0x372254,_0x3aeb6e){return db[_0x93d7('0x1a')][_0x93d7('0x1b')]({'raw':_0x370c3a['options']?_0x370c3a[_0x93d7('0x1c')][_0x93d7('0x1d')]===undefined?!![]:![]:!![],'where':_0x370c3a['options']?_0x370c3a[_0x93d7('0x1c')][_0x93d7('0x1e')]||null:null,'attributes':_0x370c3a[_0x93d7('0x1c')]?_0x370c3a['options'][_0x93d7('0x1f')]||null:null,'limit':_0x370c3a[_0x93d7('0x1c')]?_0x370c3a[_0x93d7('0x1c')][_0x93d7('0x20')]||null:null,'include':_0x370c3a[_0x93d7('0x1c')]?_0x370c3a['options'][_0x93d7('0x21')]?_['map'](_0x370c3a[_0x93d7('0x1c')]['include'],function(_0x5e8609){return{'model':db[_0x5e8609[_0x93d7('0x22')]],'as':_0x5e8609['as'],'attributes':_0x5e8609[_0x93d7('0x1f')],'include':_0x5e8609[_0x93d7('0x21')]?_[_0x93d7('0x23')](_0x5e8609[_0x93d7('0x21')],function(_0x1ee3bc){return{'model':db[_0x1ee3bc[_0x93d7('0x22')]],'as':_0x1ee3bc['as'],'attributes':_0x1ee3bc[_0x93d7('0x1f')],'include':_0x1ee3bc[_0x93d7('0x21')]?_[_0x93d7('0x23')](_0x1ee3bc[_0x93d7('0x21')],function(_0x2e40cf){return{'model':db[_0x2e40cf[_0x93d7('0x22')]],'as':_0x2e40cf['as'],'attributes':_0x2e40cf[_0x93d7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44fe63){logger['info'](_0x93d7('0x19'),_0x370c3a);logger[_0x93d7('0x11')]('GetFaxAccount',_0x370c3a,JSON[_0x93d7('0x13')](_0x44fe63));_0x372254(_0x44fe63);})[_0x93d7('0x18')](function(_0x34e9d3){logger[_0x93d7('0x14')](_0x93d7('0x19'),_0x34e9d3[_0x93d7('0x16')],_0x370c3a);_0x3aeb6e(_0xf457e2[_0x93d7('0x14')](0x1f4,_0x34e9d3['message']));});});};exports[_0x93d7('0x24')]=function(_0x56de18,_0x45f661,_0x39ce77){var _0x14ba71=this;return new Promise(function(_0x93d007,_0x29de0e){var _0x30f55f={'body':_0x56de18[_0x93d7('0x25')],'channel':_0x93d7('0x26')};var _0x28300e=[];var _0x4940d1=[];var _0x168220={};return db[_0x93d7('0x27')]['describe']()[_0x93d7('0xe')](function(_0x4b103e){if(!_0x4b103e){throw new db[(_0x93d7('0x28'))][(_0x93d7('0x29'))](_0x93d7('0x2a'));}_0x28300e=_[_0x93d7('0x2b')](_[_0x93d7('0x2c')](_0x4b103e),[_0x93d7('0x2d'),_0x93d7('0x2e')]);_0x4940d1=_[_0x93d7('0x2b')](_['keys'](_0x4b103e),[_0x93d7('0x2d'),_0x93d7('0x2e'),_0x93d7('0x2f'),'ListId']);if(_0x56de18[_0x93d7('0x25')]['id']){delete _0x56de18['body']['id'];}if(_[_0x93d7('0x30')](_0x56de18[_0x93d7('0x25')]['from'])){throw new db[(_0x93d7('0x28'))]['ValidationError'](_0x93d7('0x31'));}if(_['isNil'](_0x56de18[_0x93d7('0x25')][_0x93d7('0x25')])||_0x56de18[_0x93d7('0x25')][_0x93d7('0x25')]===''){throw new db[(_0x93d7('0x28'))][(_0x93d7('0x29'))](_0x93d7('0x32'));}if(_[_0x93d7('0x30')](_0x56de18['body']['mapKey'])){throw new db[(_0x93d7('0x28'))][(_0x93d7('0x29'))](_0x93d7('0x33')+_0x4940d1);}if(!_[_0x93d7('0x34')](_0x4940d1,_0x56de18['body'][_0x93d7('0x35')])){throw new db[(_0x93d7('0x28'))][(_0x93d7('0x29'))](_0x93d7('0x36')+_0x4940d1);}_0x168220[_0x56de18[_0x93d7('0x25')][_0x93d7('0x35')]]=_0x56de18[_0x93d7('0x25')][_0x93d7('0x37')];})[_0x93d7('0xe')](function(){return db['FaxAccount'][_0x93d7('0x38')]({'where':{'id':_0x56de18[_0x93d7('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x93d7('0x3a'),'include':[{'model':db[_0x93d7('0x27')],'as':_0x93d7('0x3b'),'where':_0x168220,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x93d7('0x3c')],'as':_0x93d7('0x3d')}]});})[_0x93d7('0xe')](function(_0x556cc3){if(_0x556cc3&&_0x556cc3['List']){var _0xd2a46d=_0x556cc3['get']({'plain':!![]});_0x30f55f['account']=_0xd2a46d;_0x30f55f[_0x93d7('0x3e')]=_0xd2a46d[_0x93d7('0x3d')];_0x30f55f[_0x93d7('0x3f')]=_0xd2a46d['List'];_0x30f55f[_0x93d7('0x3e')]=_[_0x93d7('0x40')](_0x30f55f[_0x93d7('0x3e')],['priority'],['asc']);if(_0x30f55f[_0x93d7('0x39')][_0x93d7('0x3d')]){delete _0x30f55f[_0x93d7('0x39')][_0x93d7('0x3d')];}if(_0x30f55f['account'][_0x93d7('0x3a')]&&_0x30f55f[_0x93d7('0x39')][_0x93d7('0x3a')][_0x93d7('0x3b')]['length']){return _0x30f55f[_0x93d7('0x39')][_0x93d7('0x3a')][_0x93d7('0x3b')][0x0];}var _0x324da0=_['defaults'](_0x56de18[_0x93d7('0x25')],{'firstName':_0x56de18[_0x93d7('0x25')]['from'],'ListId':_0xd2a46d['ListId']});_0x324da0[_0x56de18[_0x93d7('0x25')][_0x93d7('0x35')]]=_0x56de18[_0x93d7('0x25')]['from'];return db[_0x93d7('0x27')][_0x93d7('0x41')](_0x324da0,{'fields':_0x28300e,'raw':!![]});}})[_0x93d7('0xe')](function(_0xc67edc){_0x30f55f['contact']=_0xc67edc;if(_0xc67edc){var _0x20a323={'ContactId':_0xc67edc['id'],'FaxAccountId':_0x56de18[_0x93d7('0x39')]['id'],'fax':_0xc67edc[_0x93d7('0x26')]};return db['FaxInteraction'][_0x93d7('0x38')]({'where':{'ContactId':_0xc67edc['id'],'closed':![],'FaxAccountId':_0x56de18['account']['id']}})['then'](function(_0x56b8dd){if(_0x56b8dd){return[_0x56b8dd,![]];}return db[_0x93d7('0x42')][_0x93d7('0x41')](_0x20a323)['then'](function(_0x34580a){return[_0x34580a,!![]];});});}else{throw new Error(_0x93d7('0x43'));}})[_0x93d7('0x44')](function(_0x2c17ab,_0x7407fb){var _0x182156=_0x2c17ab[_0x93d7('0x45')]({'plain':!![]});if(_0x7407fb){if(_0x30f55f['account'][_0x93d7('0x46')]){_0x30f55f['applications'][_0x93d7('0x47')]({'id':0x0,'priority':_0x30f55f[_0x93d7('0x3e')]['length']+0x1,'app':_0x93d7('0x48'),'appdata':_0x93d7('0x49'),'interval':_0x93d7('0x4a')});}_0x182156[_0x93d7('0x4b')]=!![];}else{_0x182156['created']=![];}_0x30f55f[_0x93d7('0x4c')]=_0x182156;return db[_0x93d7('0x4d')][_0x93d7('0x41')]({'body':_0x56de18[_0x93d7('0x25')][_0x93d7('0x25')],'FaxAccountId':_0x56de18[_0x93d7('0x39')]['id'],'FaxInteractionId':_0x2c17ab['id'],'direction':'in','ContactId':_0x2c17ab[_0x93d7('0x4e')],'AttachmentId':_0x56de18[_0x93d7('0x25')]['AttachmentId']});})[_0x93d7('0xe')](function(_0x12308b){_0x30f55f[_0x93d7('0x16')]=_0x12308b;if(!_0x30f55f[_0x93d7('0x4c')]['UserId'])return;return db[_0x93d7('0x4f')][_0x93d7('0x38')]({'attributes':['id','name'],'where':{'id':_0x30f55f[_0x93d7('0x4c')][_0x93d7('0x50')]}});})[_0x93d7('0xe')](function(_0x46b454){if(_0x46b454){_0x30f55f[_0x93d7('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x93d7('0x51'),'appdata':_0x46b454[_0x93d7('0x52')]+','+(_0x30f55f['account'][_0x93d7('0x53')]||0xa),'interval':_0x93d7('0x4a')});}if(!_0x30f55f['interaction'][_0x93d7('0x54')])return;return db[_0x93d7('0x55')][_0x93d7('0x38')]({'attributes':['id','name'],'where':{'id':_0x30f55f[_0x93d7('0x4c')][_0x93d7('0x54')]}});})[_0x93d7('0xe')](function(_0x484554){if(_0x484554){_0x30f55f[_0x93d7('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x93d7('0x56'),'appdata':_0x484554['name']+','+(_0x30f55f[_0x93d7('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':_0x93d7('0x4a')});}return respondWithRpcPromise(_0x93d7('0x57'),'startRouting',_0x30f55f);})['then'](function(_0x576022){_0x93d007(_0x576022);})[_0x93d7('0x18')](function(_0x177c7c){_0x29de0e(_0x14ba71[_0x93d7('0x14')](0x1f4,_0x177c7c[_0x93d7('0x16')]));});});}; \ No newline at end of file +var _0xbbcf=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','Contacts','FaxApplication','Applications','get','applications','orderBy','priority','asc','length','contact','create','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','lodash','moment','bluebird'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xbbcf,0x114));var _0xfbbc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbbcf[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xfbbc('0x0'));var util=require('util');var moment=require(_0xfbbc('0x1'));var BPromise=require(_0xfbbc('0x2'));var rs=require(_0xfbbc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbbc('0x4'))['db'];var utils=require(_0xfbbc('0x5'));var logger=require('../../config/logger')(_0xfbbc('0x6'));var config=require(_0xfbbc('0x7'));var jayson=require(_0xfbbc('0x8'));var client=jayson[_0xfbbc('0x9')][_0xfbbc('0xa')]({'port':0x232c});config[_0xfbbc('0xb')]=_[_0xfbbc('0xc')](config[_0xfbbc('0xb')],{'host':_0xfbbc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbbc('0xb')]));require('./faxAccount.socket')[_0xfbbc('0xe')](socket);function respondWithRpcPromise(_0x28a34f,_0x4688b2,_0x5cab5b){return new BPromise(function(_0x3a9217,_0x29cbfb){return client[_0xfbbc('0xf')](_0x28a34f,_0x5cab5b)[_0xfbbc('0x10')](function(_0x31b4ae){logger['info'](_0xfbbc('0x11'),_0x4688b2,_0xfbbc('0x12'));logger['debug'](_0xfbbc('0x13'),_0x4688b2,'request\x20sent',JSON[_0xfbbc('0x14')](_0x31b4ae));if(_0x31b4ae[_0xfbbc('0x15')]){if(_0x31b4ae[_0xfbbc('0x15')][_0xfbbc('0x16')]===0x1f4){logger[_0xfbbc('0x15')](_0xfbbc('0x11'),_0x4688b2,_0x31b4ae['error'][_0xfbbc('0x17')]);return _0x29cbfb(_0x31b4ae[_0xfbbc('0x15')]['message']);}logger[_0xfbbc('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4688b2,_0x31b4ae[_0xfbbc('0x15')]['message']);return _0x3a9217(_0x31b4ae[_0xfbbc('0x15')][_0xfbbc('0x17')]);}else{logger[_0xfbbc('0x18')]('FaxAccount,\x20%s,\x20%s',_0x4688b2,_0xfbbc('0x12'));_0x3a9217(_0x31b4ae[_0xfbbc('0x19')]['message']);}})[_0xfbbc('0x1a')](function(_0x458f9f){logger[_0xfbbc('0x15')](_0xfbbc('0x11'),_0x4688b2,_0x458f9f);_0x29cbfb(_0x458f9f);});});}exports[_0xfbbc('0x1b')]=function(_0x396495){var _0x7bd216=this;return new Promise(function(_0x55e98b,_0x1eb7df){return db[_0xfbbc('0x1c')][_0xfbbc('0x1d')]({'raw':_0x396495[_0xfbbc('0x1e')]?_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x1f')]===undefined?!![]:![]:!![],'where':_0x396495[_0xfbbc('0x1e')]?_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x20')]||null:null,'attributes':_0x396495[_0xfbbc('0x1e')]?_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x21')]||null:null,'limit':_0x396495[_0xfbbc('0x1e')]?_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x22')]||null:null,'include':_0x396495[_0xfbbc('0x1e')]?_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x23')]?_[_0xfbbc('0x24')](_0x396495[_0xfbbc('0x1e')][_0xfbbc('0x23')],function(_0x29cad3){return{'model':db[_0x29cad3[_0xfbbc('0x25')]],'as':_0x29cad3['as'],'attributes':_0x29cad3['attributes'],'include':_0x29cad3[_0xfbbc('0x23')]?_['map'](_0x29cad3[_0xfbbc('0x23')],function(_0x1c0fa8){return{'model':db[_0x1c0fa8[_0xfbbc('0x25')]],'as':_0x1c0fa8['as'],'attributes':_0x1c0fa8[_0xfbbc('0x21')],'include':_0x1c0fa8['include']?_['map'](_0x1c0fa8[_0xfbbc('0x23')],function(_0x5552be){return{'model':db[_0x5552be[_0xfbbc('0x25')]],'as':_0x5552be['as'],'attributes':_0x5552be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53fb29){logger[_0xfbbc('0x18')](_0xfbbc('0x1b'),_0x396495);logger[_0xfbbc('0x26')](_0xfbbc('0x1b'),_0x396495,JSON[_0xfbbc('0x14')](_0x53fb29));_0x55e98b(_0x53fb29);})[_0xfbbc('0x1a')](function(_0x29436d){logger[_0xfbbc('0x15')](_0xfbbc('0x1b'),_0x29436d['message'],_0x396495);_0x1eb7df(_0x7bd216['error'](0x1f4,_0x29436d[_0xfbbc('0x17')]));});});};exports[_0xfbbc('0x27')]=function(_0x3bc4c7,_0x5263bc,_0x488151){var _0x2f0afc=this;return new Promise(function(_0x29a35f,_0x5ec883){var _0x290591={'body':_0x3bc4c7[_0xfbbc('0x28')],'channel':_0xfbbc('0x29')};var _0x5d83fb=[];var _0x2fe30c=[];var _0x20fae9={};return db[_0xfbbc('0x2a')][_0xfbbc('0x2b')]()[_0xfbbc('0x10')](function(_0xae3c40){if(!_0xae3c40){throw new db[(_0xfbbc('0x2c'))][(_0xfbbc('0x2d'))](_0xfbbc('0x2e'));}_0x5d83fb=_[_0xfbbc('0x2f')](_[_0xfbbc('0x30')](_0xae3c40),[_0xfbbc('0x31'),_0xfbbc('0x32')]);_0x2fe30c=_['difference'](_[_0xfbbc('0x30')](_0xae3c40),['createdAt',_0xfbbc('0x32'),_0xfbbc('0x33'),'ListId']);if(_0x3bc4c7[_0xfbbc('0x28')]['id']){delete _0x3bc4c7[_0xfbbc('0x28')]['id'];}if(_[_0xfbbc('0x34')](_0x3bc4c7[_0xfbbc('0x28')][_0xfbbc('0x35')])){throw new db[(_0xfbbc('0x2c'))][(_0xfbbc('0x2d'))](_0xfbbc('0x36'));}if(_[_0xfbbc('0x34')](_0x3bc4c7[_0xfbbc('0x28')]['body'])||_0x3bc4c7['body'][_0xfbbc('0x28')]===''){throw new db[(_0xfbbc('0x2c'))][(_0xfbbc('0x2d'))](_0xfbbc('0x37'));}if(_['isNil'](_0x3bc4c7[_0xfbbc('0x28')]['mapKey'])){throw new db[(_0xfbbc('0x2c'))][(_0xfbbc('0x2d'))](_0xfbbc('0x38')+_0x2fe30c);}if(!_[_0xfbbc('0x39')](_0x2fe30c,_0x3bc4c7[_0xfbbc('0x28')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xfbbc('0x3a')+_0x2fe30c);}_0x20fae9[_0x3bc4c7['body'][_0xfbbc('0x3b')]]=_0x3bc4c7[_0xfbbc('0x28')][_0xfbbc('0x35')];})[_0xfbbc('0x10')](function(){return db['FaxAccount'][_0xfbbc('0x3c')]({'where':{'id':_0x3bc4c7[_0xfbbc('0x3d')]['id']},'include':[{'model':db['CmList'],'as':_0xfbbc('0x3e'),'include':[{'model':db['CmContact'],'as':_0xfbbc('0x3f'),'where':_0x20fae9,'limit':0x1,'order':[[_0xfbbc('0x32'),'DESC']]}]},{'model':db[_0xfbbc('0x40')],'as':_0xfbbc('0x41')}]});})[_0xfbbc('0x10')](function(_0x416bea){if(_0x416bea&&_0x416bea[_0xfbbc('0x3e')]){var _0x5e8538=_0x416bea[_0xfbbc('0x42')]({'plain':!![]});_0x290591[_0xfbbc('0x3d')]=_0x5e8538;_0x290591[_0xfbbc('0x43')]=_0x5e8538[_0xfbbc('0x41')];_0x290591['list']=_0x5e8538[_0xfbbc('0x3e')];_0x290591[_0xfbbc('0x43')]=_[_0xfbbc('0x44')](_0x290591[_0xfbbc('0x43')],[_0xfbbc('0x45')],[_0xfbbc('0x46')]);if(_0x290591[_0xfbbc('0x3d')][_0xfbbc('0x41')]){delete _0x290591[_0xfbbc('0x3d')][_0xfbbc('0x41')];}if(_0x290591[_0xfbbc('0x3d')]['List']&&_0x290591['account'][_0xfbbc('0x3e')][_0xfbbc('0x3f')][_0xfbbc('0x47')]){return _0x290591[_0xfbbc('0x3d')][_0xfbbc('0x3e')][_0xfbbc('0x3f')][0x0];}var _0x688cfb=_[_0xfbbc('0xc')](_0x3bc4c7['body'],{'firstName':_0x3bc4c7[_0xfbbc('0x28')][_0xfbbc('0x35')],'ListId':_0x5e8538['ListId']});_0x688cfb[_0x3bc4c7[_0xfbbc('0x28')][_0xfbbc('0x3b')]]=_0x3bc4c7[_0xfbbc('0x28')]['from'];return db[_0xfbbc('0x2a')]['create'](_0x688cfb,{'fields':_0x5d83fb,'raw':!![]});}})[_0xfbbc('0x10')](function(_0x12c592){_0x290591[_0xfbbc('0x48')]=_0x12c592;if(_0x12c592){var _0x42e990={'ContactId':_0x12c592['id'],'FaxAccountId':_0x3bc4c7[_0xfbbc('0x3d')]['id'],'fax':_0x12c592[_0xfbbc('0x29')]};return db['FaxInteraction'][_0xfbbc('0x3c')]({'where':{'ContactId':_0x12c592['id'],'closed':![],'FaxAccountId':_0x3bc4c7['account']['id']}})[_0xfbbc('0x10')](function(_0x5681da){if(_0x5681da){return[_0x5681da,![]];}return db['FaxInteraction'][_0xfbbc('0x49')](_0x42e990)[_0xfbbc('0x10')](function(_0x59557f){return[_0x59557f,!![]];});});}else{throw new Error(_0xfbbc('0x4a'));}})[_0xfbbc('0x4b')](function(_0x3ef8f7,_0x50560a){var _0x1a9f9a=_0x3ef8f7['get']({'plain':!![]});if(_0x50560a){if(_0x290591[_0xfbbc('0x3d')]['autoclose']){_0x290591[_0xfbbc('0x43')][_0xfbbc('0x4c')]({'id':0x0,'priority':_0x290591[_0xfbbc('0x43')][_0xfbbc('0x47')]+0x1,'app':_0xfbbc('0x4d'),'appdata':_0xfbbc('0x4e'),'interval':_0xfbbc('0x4f')});}_0x1a9f9a['created']=!![];}else{_0x1a9f9a[_0xfbbc('0x50')]=![];}_0x290591[_0xfbbc('0x51')]=_0x1a9f9a;return db['FaxMessage'][_0xfbbc('0x49')]({'body':_0x3bc4c7[_0xfbbc('0x28')]['body'],'FaxAccountId':_0x3bc4c7[_0xfbbc('0x3d')]['id'],'FaxInteractionId':_0x3ef8f7['id'],'direction':'in','ContactId':_0x3ef8f7[_0xfbbc('0x52')],'AttachmentId':_0x3bc4c7[_0xfbbc('0x28')]['AttachmentId']});})[_0xfbbc('0x10')](function(_0x27482d){_0x290591[_0xfbbc('0x17')]=_0x27482d;if(!_0x290591['interaction'][_0xfbbc('0x53')])return;return db['User'][_0xfbbc('0x3c')]({'attributes':['id',_0xfbbc('0x54')],'where':{'id':_0x290591['interaction']['UserId']}});})[_0xfbbc('0x10')](function(_0xe30903){if(_0xe30903){_0x290591[_0xfbbc('0x43')][_0xfbbc('0x55')]({'id':0x0,'priority':0x0,'app':_0xfbbc('0x56'),'appdata':_0xe30903[_0xfbbc('0x54')]+','+(_0x290591[_0xfbbc('0x3d')][_0xfbbc('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x290591['interaction'][_0xfbbc('0x58')])return;return db[_0xfbbc('0x59')][_0xfbbc('0x3c')]({'attributes':['id','name'],'where':{'id':_0x290591[_0xfbbc('0x51')][_0xfbbc('0x58')]}});})[_0xfbbc('0x10')](function(_0x2abd26){if(_0x2abd26){_0x290591[_0xfbbc('0x43')][_0xfbbc('0x55')]({'id':0x0,'priority':0x1,'app':_0xfbbc('0x5a'),'appdata':_0x2abd26['name']+','+(_0x290591[_0xfbbc('0x3d')][_0xfbbc('0x5b')]||0x12c),'interval':_0xfbbc('0x4f')});}return respondWithRpcPromise(_0xfbbc('0x5c'),'startRouting',_0x290591);})[_0xfbbc('0x10')](function(_0x5b7ad1){_0x29a35f(_0x5b7ad1);})['catch'](function(_0xe6034b){_0x5ec883(_0x2f0afc[_0xfbbc('0x15')](0x1f4,_0xe6034b[_0xfbbc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2274666..ce0919c 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 _0xb3e0=['remove','emit','register','faxAccount:','save'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xb3e0,0x194));var _0x0b3e=function(_0x27dacc,_0x1523ea){_0x27dacc=_0x27dacc-0x0;var _0x2076b4=_0xb3e0[_0x27dacc];return _0x2076b4;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x0b3e('0x0'),_0x0b3e('0x1'),'update'];function createListener(_0x3cb4fc,_0x5a575c){return function(_0x4020d6){_0x5a575c[_0x0b3e('0x2')](_0x3cb4fc,_0x4020d6);};}function removeListener(_0x3a155a,_0x46e2e6){return function(){FaxAccountEvents['removeListener'](_0x3a155a,_0x46e2e6);};}exports[_0x0b3e('0x3')]=function(_0x439643){for(var _0x3db3a9=0x0,_0x8da2c2=events['length'];_0x3db3a9<_0x8da2c2;_0x3db3a9++){var _0x1e7288=events[_0x3db3a9];var _0x306313=createListener(_0x0b3e('0x4')+_0x1e7288,_0x439643);FaxAccountEvents['on'](_0x1e7288,_0x306313);}}; \ No newline at end of file +var _0x7df8=['./faxAccount.events','remove','update','removeListener','register','length','faxAccount:'];(function(_0x1487a3,_0x2c4ad7){var _0x3b2f52=function(_0x33a130){while(--_0x33a130){_0x1487a3['push'](_0x1487a3['shift']());}};_0x3b2f52(++_0x2c4ad7);}(_0x7df8,0xbd));var _0x87df=function(_0x2173a8,_0x14cb4b){_0x2173a8=_0x2173a8-0x0;var _0x335e6b=_0x7df8[_0x2173a8];return _0x335e6b;};'use strict';var FaxAccountEvents=require(_0x87df('0x0'));var events=['save',_0x87df('0x1'),_0x87df('0x2')];function createListener(_0x5a27ff,_0xdaaa91){return function(_0x149f09){_0xdaaa91['emit'](_0x5a27ff,_0x149f09);};}function removeListener(_0x12e990,_0x54e36f){return function(){FaxAccountEvents[_0x87df('0x3')](_0x12e990,_0x54e36f);};}exports[_0x87df('0x4')]=function(_0x364ff5){for(var _0x25c1b8=0x0,_0x251f2e=events[_0x87df('0x5')];_0x25c1b8<_0x251f2e;_0x25c1b8++){var _0x4f9d8d=events[_0x25c1b8];var _0xd9a5f9=createListener(_0x87df('0x6')+_0x4f9d8d,_0x364ff5);FaxAccountEvents['on'](_0x4f9d8d,_0xd9a5f9);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6933fa4..38e5ea2 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 _0xde14=['addDisposition','/:id/canned_answers','addAnswer','/:id/applications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','/:id/users','put','delete','destroy','removeDispositions','removeAgents','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post','/:id/dispositions'];(function(_0x567b14,_0x4d0cd6){var _0x38a384=function(_0x330b49){while(--_0x330b49){_0x567b14['push'](_0x567b14['shift']());}};_0x38a384(++_0x4d0cd6);}(_0xde14,0x103));var _0x4de1=function(_0x5836d5,_0x3095bb){_0x5836d5=_0x5836d5-0x0;var _0x1c8e89=_0xde14[_0x5836d5];return _0x1c8e89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4de1('0x0'));var timeout=require(_0x4de1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4de1('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4de1('0x3'));var config=require(_0x4de1('0x4'));var controller=require(_0x4de1('0x5'));router[_0x4de1('0x6')]('/',auth[_0x4de1('0x7')](),controller[_0x4de1('0x8')]);router['get']('/describe',auth[_0x4de1('0x7')](),controller['describe']);router[_0x4de1('0x6')](_0x4de1('0x9'),auth[_0x4de1('0x7')](),controller[_0x4de1('0xa')]);router['get']('/:id/dispositions',auth[_0x4de1('0x7')](),controller[_0x4de1('0xb')]);router['get']('/:id/canned_answers',auth[_0x4de1('0x7')](),controller[_0x4de1('0xc')]);router['get'](_0x4de1('0xd'),auth[_0x4de1('0x7')](),controller[_0x4de1('0xe')]);router[_0x4de1('0x6')]('/:id/applications',auth[_0x4de1('0x7')](),controller[_0x4de1('0xf')]);router[_0x4de1('0x6')](_0x4de1('0x10'),auth['isAuthenticated'](),controller[_0x4de1('0x11')]);router[_0x4de1('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x4de1('0x12')]);router[_0x4de1('0x13')]('/',auth[_0x4de1('0x7')](),controller['create']);router[_0x4de1('0x13')](_0x4de1('0x14'),auth[_0x4de1('0x7')](),controller[_0x4de1('0x15')]);router[_0x4de1('0x13')](_0x4de1('0x16'),auth['isAuthenticated'](),controller[_0x4de1('0x17')]);router[_0x4de1('0x13')](_0x4de1('0xd'),auth[_0x4de1('0x7')](),controller['addInteraction']);router['post'](_0x4de1('0x18'),auth[_0x4de1('0x7')](),controller['addApplications']);router[_0x4de1('0x13')](_0x4de1('0x19'),auth[_0x4de1('0x7')](),controller[_0x4de1('0x1a')]);router[_0x4de1('0x13')]('/updateaccountapplications',auth[_0x4de1('0x7')](),controller[_0x4de1('0x1b')]);router[_0x4de1('0x13')]('/:id/send',auth[_0x4de1('0x7')](),controller[_0x4de1('0x1c')]);router['post'](_0x4de1('0x1d'),auth[_0x4de1('0x7')](),controller['addAgents']);router[_0x4de1('0x1e')]('/:id',auth[_0x4de1('0x7')](),controller['update']);router[_0x4de1('0x1f')](_0x4de1('0x9'),auth[_0x4de1('0x7')](),controller[_0x4de1('0x20')]);router[_0x4de1('0x1f')](_0x4de1('0x14'),auth['isAuthenticated'](),controller[_0x4de1('0x21')]);router[_0x4de1('0x1f')](_0x4de1('0x16'),auth[_0x4de1('0x7')](),controller['removeAnswers']);router[_0x4de1('0x1f')](_0x4de1('0x1d'),auth[_0x4de1('0x7')](),controller[_0x4de1('0x22')]);module['exports']=router; \ No newline at end of file +var _0x5283=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','removeDispositions','delete','removeAgents'];(function(_0x501e30,_0xe72e9a){var _0x5b7bc2=function(_0x4c0c7b){while(--_0x4c0c7b){_0x501e30['push'](_0x501e30['shift']());}};_0x5b7bc2(++_0xe72e9a);}(_0x5283,0x159));var _0x3528=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0x5283[_0x4327fe];return _0x138651;};'use strict';var multer=require(_0x3528('0x0'));var util=require(_0x3528('0x1'));var path=require(_0x3528('0x2'));var timeout=require(_0x3528('0x3'));var express=require(_0x3528('0x4'));var router=express[_0x3528('0x5')]();var fs_extra=require(_0x3528('0x6'));var auth=require(_0x3528('0x7'));var interaction=require(_0x3528('0x8'));var config=require(_0x3528('0x9'));var controller=require(_0x3528('0xa'));router[_0x3528('0xb')]('/',auth['isAuthenticated'](),controller[_0x3528('0xc')]);router[_0x3528('0xb')]('/describe',auth[_0x3528('0xd')](),controller[_0x3528('0xe')]);router[_0x3528('0xb')](_0x3528('0xf'),auth[_0x3528('0xd')](),controller[_0x3528('0x10')]);router[_0x3528('0xb')]('/:id/dispositions',auth[_0x3528('0xd')](),controller['getDispositions']);router[_0x3528('0xb')](_0x3528('0x11'),auth['isAuthenticated'](),controller[_0x3528('0x12')]);router[_0x3528('0xb')](_0x3528('0x13'),auth[_0x3528('0xd')](),controller[_0x3528('0x14')]);router[_0x3528('0xb')](_0x3528('0x15'),auth[_0x3528('0xd')](),controller[_0x3528('0x16')]);router[_0x3528('0xb')]('/:id/messages',auth[_0x3528('0xd')](),controller[_0x3528('0x17')]);router[_0x3528('0xb')](_0x3528('0x18'),auth[_0x3528('0xd')](),controller[_0x3528('0x19')]);router[_0x3528('0x1a')]('/',auth[_0x3528('0xd')](),controller['create']);router[_0x3528('0x1a')](_0x3528('0x1b'),auth[_0x3528('0xd')](),controller[_0x3528('0x1c')]);router[_0x3528('0x1a')]('/:id/canned_answers',auth[_0x3528('0xd')](),controller[_0x3528('0x1d')]);router[_0x3528('0x1a')]('/:id/interactions',auth[_0x3528('0xd')](),controller[_0x3528('0x1e')]);router[_0x3528('0x1a')](_0x3528('0x15'),auth[_0x3528('0xd')](),controller['addApplications']);router[_0x3528('0x1a')](_0x3528('0x1f'),auth['isAuthenticated'](),controller[_0x3528('0x20')]);router[_0x3528('0x1a')](_0x3528('0x21'),auth['isAuthenticated'](),controller[_0x3528('0x22')]);router[_0x3528('0x1a')](_0x3528('0x23'),auth[_0x3528('0xd')](),controller['send']);router[_0x3528('0x1a')]('/:id/users',auth[_0x3528('0xd')](),controller[_0x3528('0x24')]);router[_0x3528('0x25')](_0x3528('0xf'),auth[_0x3528('0xd')](),controller[_0x3528('0x26')]);router['delete']('/:id',auth[_0x3528('0xd')](),controller['destroy']);router['delete'](_0x3528('0x1b'),auth[_0x3528('0xd')](),controller[_0x3528('0x27')]);router[_0x3528('0x28')](_0x3528('0x11'),auth[_0x3528('0xd')](),controller['removeAnswers']);router[_0x3528('0x28')](_0x3528('0x18'),auth[_0x3528('0xd')](),controller[_0x3528('0x29')]);module[_0x3528('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e6a2979..4ea5c97 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 _0x378f=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x5b0578,_0x20039b){var _0x28897a=function(_0x5267b2){while(--_0x5267b2){_0x5b0578['push'](_0x5b0578['shift']());}};_0x28897a(++_0x20039b);}(_0x378f,0x9c));var _0xf378=function(_0x2b3f27,_0xb97e97){_0x2b3f27=_0x2b3f27-0x0;var _0x2afe62=_0x378f[_0x2b3f27];return _0x2afe62;};'use strict';var Sequelize=require(_0xf378('0x0'));module[_0xf378('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf378('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf378('0x3')]()},'description':{'type':Sequelize[_0xf378('0x2')]},'interval':{'type':Sequelize[_0xf378('0x2')],'defaultValue':_0xf378('0x4')}}; \ No newline at end of file +var _0x04b8=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x559d7f,_0x3700d0){var _0x4e175b=function(_0x56db1b){while(--_0x56db1b){_0x559d7f['push'](_0x559d7f['shift']());}};_0x4e175b(++_0x3700d0);}(_0x04b8,0x144));var _0x804b=function(_0xf11681,_0x39a858){_0xf11681=_0xf11681-0x0;var _0x199843=_0x04b8[_0xf11681];return _0x199843;};'use strict';var Sequelize=require(_0x804b('0x0'));module[_0x804b('0x1')]={'priority':{'type':Sequelize[_0x804b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x804b('0x3')],'allowNull':![],'defaultValue':_0x804b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x804b('0x3')]},'interval':{'type':Sequelize[_0x804b('0x3')],'defaultValue':_0x804b('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4cf7f96..c12d7df 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 _0xe7a7=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','FaxApplication','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe7a7,0x1bc));var _0x7e7a=function(_0x392a05,_0x3e65e2){_0x392a05=_0x392a05-0x0;var _0x1a3d41=_0xe7a7[_0x392a05];return _0x1a3d41;};'use strict';var emlformat=require(_0x7e7a('0x0'));var rimraf=require(_0x7e7a('0x1'));var zipdir=require(_0x7e7a('0x2'));var jsonpatch=require(_0x7e7a('0x3'));var rp=require('request-promise');var moment=require(_0x7e7a('0x4'));var BPromise=require(_0x7e7a('0x5'));var Mustache=require(_0x7e7a('0x6'));var util=require(_0x7e7a('0x7'));var path=require(_0x7e7a('0x8'));var sox=require(_0x7e7a('0x9'));var csv=require(_0x7e7a('0xa'));var ejs=require(_0x7e7a('0xb'));var fs=require('fs');var fs_extra=require(_0x7e7a('0xc'));var _=require(_0x7e7a('0xd'));var squel=require(_0x7e7a('0xe'));var crypto=require('crypto');var jsforce=require(_0x7e7a('0xf'));var deskjs=require(_0x7e7a('0x10'));var toCsv=require(_0x7e7a('0xa'));var querystring=require(_0x7e7a('0x11'));var Papa=require(_0x7e7a('0x12'));var Redis=require(_0x7e7a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7e7a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e7a('0x15'));var logger=require('../../config/logger')(_0x7e7a('0x16'));var utils=require(_0x7e7a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7e7a('0x18'))['db'];function respondWithStatusCode(_0x5374b1,_0x573aeb){_0x573aeb=_0x573aeb||0xcc;return function(_0x2ec396){if(_0x2ec396){return _0x5374b1['sendStatus'](_0x573aeb);}return _0x5374b1[_0x7e7a('0x19')](_0x573aeb)[_0x7e7a('0x1a')]();};}function respondWithResult(_0x5238db,_0x41b1af){_0x41b1af=_0x41b1af||0xc8;return function(_0x2f92a6){if(_0x2f92a6){return _0x5238db[_0x7e7a('0x19')](_0x41b1af)[_0x7e7a('0x1b')](_0x2f92a6);}};}function respondWithFilteredResult(_0x4fd275,_0x1c780d){return function(_0x1e1c03){if(_0x1e1c03){var _0x398191=typeof _0x1c780d['offset']===_0x7e7a('0x1c')&&typeof _0x1c780d[_0x7e7a('0x1d')]===_0x7e7a('0x1c');var _0x39420a=_0x1e1c03[_0x7e7a('0x1e')];var _0x4ea391=_0x398191?0x0:_0x1c780d['offset'];var _0x580ef9=_0x398191?_0x1e1c03[_0x7e7a('0x1e')]:_0x1c780d[_0x7e7a('0x1f')]+_0x1c780d['limit'];var _0x53ef7c;if(_0x580ef9>=_0x39420a){_0x580ef9=_0x39420a;_0x53ef7c=0xc8;}else{_0x53ef7c=0xce;}_0x4fd275[_0x7e7a('0x19')](_0x53ef7c);return _0x4fd275[_0x7e7a('0x20')](_0x7e7a('0x21'),_0x4ea391+'-'+_0x580ef9+'/'+_0x39420a)[_0x7e7a('0x1b')](_0x1e1c03);}return null;};}function patchUpdates(_0xb2fd12){return function(_0x223048){try{jsonpatch[_0x7e7a('0x22')](_0x223048,_0xb2fd12,!![]);}catch(_0x3c2494){return BPromise[_0x7e7a('0x23')](_0x3c2494);}return _0x223048[_0x7e7a('0x24')]();};}function saveUpdates(_0x345739,_0x40638d){return function(_0x5b7352){if(_0x5b7352){return _0x5b7352[_0x7e7a('0x25')](_0x345739)[_0x7e7a('0x26')](function(_0x31f89a){return _0x31f89a;});}return null;};}function removeEntity(_0x448c6b,_0x534eb4){return function(_0x2aaf9e){if(_0x2aaf9e){return _0x2aaf9e[_0x7e7a('0x27')]()['then'](function(){_0x448c6b[_0x7e7a('0x19')](0xcc)[_0x7e7a('0x1a')]();});}};}function handleEntityNotFound(_0x3b12dd,_0x238191){return function(_0x5b087d){if(!_0x5b087d){_0x3b12dd[_0x7e7a('0x28')](0x194);}return _0x5b087d;};}function handleError(_0xfbc9ac,_0x3b1067){_0x3b1067=_0x3b1067||0x1f4;return function(_0x3c19f8){logger[_0x7e7a('0x29')](_0x3c19f8[_0x7e7a('0x2a')]);if(_0x3c19f8[_0x7e7a('0x2b')]){delete _0x3c19f8[_0x7e7a('0x2b')];}_0xfbc9ac[_0x7e7a('0x19')](_0x3b1067)['send'](_0x3c19f8);};}exports['index']=function(_0x376178,_0x58b6ea){var _0x403f94={},_0x10483e={},_0x5de6fa={'count':0x0,'rows':[]};var _0x1a8d9d=_[_0x7e7a('0x2c')](db['FaxApplication'][_0x7e7a('0x2d')],function(_0x326892){return{'name':_0x326892['fieldName'],'type':_0x326892[_0x7e7a('0x2e')][_0x7e7a('0x2f')]};});_0x10483e[_0x7e7a('0x30')]=_[_0x7e7a('0x2c')](_0x1a8d9d,'name');_0x10483e[_0x7e7a('0x31')]=_['keys'](_0x376178[_0x7e7a('0x31')]);_0x10483e['filters']=_[_0x7e7a('0x32')](_0x10483e[_0x7e7a('0x30')],_0x10483e[_0x7e7a('0x31')]);_0x403f94[_0x7e7a('0x33')]=_['intersection'](_0x10483e['model'],qs[_0x7e7a('0x34')](_0x376178[_0x7e7a('0x31')][_0x7e7a('0x34')]));_0x403f94[_0x7e7a('0x33')]=_0x403f94[_0x7e7a('0x33')][_0x7e7a('0x35')]?_0x403f94['attributes']:_0x10483e[_0x7e7a('0x30')];if(!_0x376178[_0x7e7a('0x31')]['hasOwnProperty'](_0x7e7a('0x36'))){_0x403f94[_0x7e7a('0x1d')]=qs['limit'](_0x376178[_0x7e7a('0x31')][_0x7e7a('0x1d')]);_0x403f94[_0x7e7a('0x1f')]=qs[_0x7e7a('0x1f')](_0x376178[_0x7e7a('0x31')][_0x7e7a('0x1f')]);}_0x403f94[_0x7e7a('0x37')]=qs[_0x7e7a('0x38')](_0x376178[_0x7e7a('0x31')]['sort']);_0x403f94[_0x7e7a('0x39')]=qs['filters'](_[_0x7e7a('0x3a')](_0x376178['query'],_0x10483e[_0x7e7a('0x3b')]),_0x1a8d9d);if(_0x376178['query']['filter']){_0x403f94[_0x7e7a('0x39')]=_[_0x7e7a('0x3c')](_0x403f94['where'],{'$or':_[_0x7e7a('0x2c')](_0x1a8d9d,function(_0x543f1b){if(_0x543f1b['type']!==_0x7e7a('0x3d')){var _0x1b7f4f={};_0x1b7f4f[_0x543f1b['name']]={'$like':'%'+_0x376178['query'][_0x7e7a('0x3e')]+'%'};return _0x1b7f4f;}})});}_0x403f94=_[_0x7e7a('0x3c')]({},_0x403f94,_0x376178['options']);var _0x24574f={'where':_0x403f94[_0x7e7a('0x39')]};return db[_0x7e7a('0x3f')]['count'](_0x24574f)[_0x7e7a('0x26')](function(_0x595ecf){_0x5de6fa[_0x7e7a('0x1e')]=_0x595ecf;if(_0x376178[_0x7e7a('0x31')]['includeAll']){_0x403f94[_0x7e7a('0x40')]=[{'all':!![]}];}return db[_0x7e7a('0x3f')][_0x7e7a('0x41')](_0x403f94);})[_0x7e7a('0x26')](function(_0x244ae6){_0x5de6fa['rows']=_0x244ae6;return _0x5de6fa;})[_0x7e7a('0x26')](respondWithFilteredResult(_0x58b6ea,_0x403f94))[_0x7e7a('0x42')](handleError(_0x58b6ea,null));};exports[_0x7e7a('0x43')]=function(_0x1be13e,_0xedb9c5){var _0x3ac9e4={'raw':!![],'where':{'id':_0x1be13e[_0x7e7a('0x44')]['id']}},_0x2ef738={};_0x2ef738['model']=_[_0x7e7a('0x45')](db[_0x7e7a('0x3f')][_0x7e7a('0x2d')]);_0x2ef738['query']=_[_0x7e7a('0x45')](_0x1be13e[_0x7e7a('0x31')]);_0x2ef738['filters']=_[_0x7e7a('0x32')](_0x2ef738['model'],_0x2ef738[_0x7e7a('0x31')]);_0x3ac9e4['attributes']=_[_0x7e7a('0x32')](_0x2ef738['model'],qs[_0x7e7a('0x34')](_0x1be13e[_0x7e7a('0x31')]['fields']));_0x3ac9e4[_0x7e7a('0x33')]=_0x3ac9e4[_0x7e7a('0x33')][_0x7e7a('0x35')]?_0x3ac9e4[_0x7e7a('0x33')]:_0x2ef738[_0x7e7a('0x30')];if(_0x1be13e[_0x7e7a('0x31')][_0x7e7a('0x46')]){_0x3ac9e4[_0x7e7a('0x40')]=[{'all':!![]}];}_0x3ac9e4=_[_0x7e7a('0x3c')]({},_0x3ac9e4,_0x1be13e[_0x7e7a('0x47')]);return db['FaxApplication'][_0x7e7a('0x48')](_0x3ac9e4)[_0x7e7a('0x26')](handleEntityNotFound(_0xedb9c5,null))[_0x7e7a('0x26')](respondWithResult(_0xedb9c5,null))[_0x7e7a('0x42')](handleError(_0xedb9c5,null));};exports[_0x7e7a('0x49')]=function(_0xe28ed9,_0x1d1c1d){return db['FaxApplication']['create'](_0xe28ed9[_0x7e7a('0x4a')],{})[_0x7e7a('0x26')](respondWithResult(_0x1d1c1d,0xc9))['catch'](handleError(_0x1d1c1d,null));};exports[_0x7e7a('0x25')]=function(_0x2faf8d,_0x57fd78){if(_0x2faf8d['body']['id']){delete _0x2faf8d['body']['id'];}return db[_0x7e7a('0x3f')][_0x7e7a('0x48')]({'where':{'id':_0x2faf8d['params']['id']}})[_0x7e7a('0x26')](handleEntityNotFound(_0x57fd78,null))[_0x7e7a('0x26')](saveUpdates(_0x2faf8d[_0x7e7a('0x4a')],null))[_0x7e7a('0x26')](respondWithResult(_0x57fd78,null))['catch'](handleError(_0x57fd78,null));};exports[_0x7e7a('0x27')]=function(_0x3966ea,_0x1d44cb){return db[_0x7e7a('0x3f')][_0x7e7a('0x48')]({'where':{'id':_0x3966ea[_0x7e7a('0x44')]['id']}})[_0x7e7a('0x26')](handleEntityNotFound(_0x1d44cb,null))[_0x7e7a('0x26')](removeEntity(_0x1d44cb,null))[_0x7e7a('0x42')](handleError(_0x1d44cb,null));}; \ No newline at end of file +var _0x2d7b=['limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FaxApplication','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','status','end','json','offset','undefined'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x2d7b,0x141));var _0xb2d7=function(_0x57aa1a,_0xd85bfd){_0x57aa1a=_0x57aa1a-0x0;var _0x4374c9=_0x2d7b[_0x57aa1a];return _0x4374c9;};'use strict';var emlformat=require(_0xb2d7('0x0'));var rimraf=require(_0xb2d7('0x1'));var zipdir=require(_0xb2d7('0x2'));var jsonpatch=require(_0xb2d7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb2d7('0x4'));var util=require('util');var path=require(_0xb2d7('0x5'));var sox=require(_0xb2d7('0x6'));var csv=require('to-csv');var ejs=require(_0xb2d7('0x7'));var fs=require('fs');var fs_extra=require(_0xb2d7('0x8'));var _=require(_0xb2d7('0x9'));var squel=require('squel');var crypto=require(_0xb2d7('0xa'));var jsforce=require(_0xb2d7('0xb'));var deskjs=require(_0xb2d7('0xc'));var toCsv=require(_0xb2d7('0xd'));var querystring=require(_0xb2d7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb2d7('0xf'));var qs=require(_0xb2d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2d7('0x11'))('api');var utils=require(_0xb2d7('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eff74,_0x364d6a){_0x364d6a=_0x364d6a||0xcc;return function(_0x38d3f0){if(_0x38d3f0){return _0x3eff74['sendStatus'](_0x364d6a);}return _0x3eff74[_0xb2d7('0x13')](_0x364d6a)[_0xb2d7('0x14')]();};}function respondWithResult(_0x12d955,_0x11430e){_0x11430e=_0x11430e||0xc8;return function(_0xfc032b){if(_0xfc032b){return _0x12d955[_0xb2d7('0x13')](_0x11430e)[_0xb2d7('0x15')](_0xfc032b);}};}function respondWithFilteredResult(_0x18105f,_0x19ea92){return function(_0x8ae2bd){if(_0x8ae2bd){var _0x2319c4=typeof _0x19ea92[_0xb2d7('0x16')]===_0xb2d7('0x17')&&typeof _0x19ea92[_0xb2d7('0x18')]===_0xb2d7('0x17');var _0x16e4e4=_0x8ae2bd[_0xb2d7('0x19')];var _0x26ead0=_0x2319c4?0x0:_0x19ea92[_0xb2d7('0x16')];var _0x49aa30=_0x2319c4?_0x8ae2bd[_0xb2d7('0x19')]:_0x19ea92[_0xb2d7('0x16')]+_0x19ea92['limit'];var _0x39f434;if(_0x49aa30>=_0x16e4e4){_0x49aa30=_0x16e4e4;_0x39f434=0xc8;}else{_0x39f434=0xce;}_0x18105f[_0xb2d7('0x13')](_0x39f434);return _0x18105f['set'](_0xb2d7('0x1a'),_0x26ead0+'-'+_0x49aa30+'/'+_0x16e4e4)[_0xb2d7('0x15')](_0x8ae2bd);}return null;};}function patchUpdates(_0x53c5ac){return function(_0x4d1cb7){try{jsonpatch[_0xb2d7('0x1b')](_0x4d1cb7,_0x53c5ac,!![]);}catch(_0x823153){return BPromise[_0xb2d7('0x1c')](_0x823153);}return _0x4d1cb7[_0xb2d7('0x1d')]();};}function saveUpdates(_0x1cb855,_0x1bbb9e){return function(_0x3de009){if(_0x3de009){return _0x3de009[_0xb2d7('0x1e')](_0x1cb855)[_0xb2d7('0x1f')](function(_0x47be63){return _0x47be63;});}return null;};}function removeEntity(_0x2123fb,_0x1052bd){return function(_0x5877f6){if(_0x5877f6){return _0x5877f6[_0xb2d7('0x20')]()[_0xb2d7('0x1f')](function(){_0x2123fb[_0xb2d7('0x13')](0xcc)[_0xb2d7('0x14')]();});}};}function handleEntityNotFound(_0x56ec82,_0x31ea0c){return function(_0x3bcc7e){if(!_0x3bcc7e){_0x56ec82[_0xb2d7('0x21')](0x194);}return _0x3bcc7e;};}function handleError(_0x2a5264,_0x165adb){_0x165adb=_0x165adb||0x1f4;return function(_0x306fda){logger[_0xb2d7('0x22')](_0x306fda[_0xb2d7('0x23')]);if(_0x306fda[_0xb2d7('0x24')]){delete _0x306fda[_0xb2d7('0x24')];}_0x2a5264[_0xb2d7('0x13')](_0x165adb)[_0xb2d7('0x25')](_0x306fda);};}exports['index']=function(_0x158a12,_0x50bfaa){var _0x121aff={},_0x5e719d={},_0x361980={'count':0x0,'rows':[]};var _0x9d778b=_[_0xb2d7('0x26')](db[_0xb2d7('0x27')]['rawAttributes'],function(_0x2404c6){return{'name':_0x2404c6[_0xb2d7('0x28')],'type':_0x2404c6[_0xb2d7('0x29')][_0xb2d7('0x2a')]};});_0x5e719d[_0xb2d7('0x2b')]=_['map'](_0x9d778b,'name');_0x5e719d['query']=_[_0xb2d7('0x2c')](_0x158a12[_0xb2d7('0x2d')]);_0x5e719d[_0xb2d7('0x2e')]=_[_0xb2d7('0x2f')](_0x5e719d[_0xb2d7('0x2b')],_0x5e719d[_0xb2d7('0x2d')]);_0x121aff[_0xb2d7('0x30')]=_['intersection'](_0x5e719d[_0xb2d7('0x2b')],qs['fields'](_0x158a12[_0xb2d7('0x2d')][_0xb2d7('0x31')]));_0x121aff[_0xb2d7('0x30')]=_0x121aff[_0xb2d7('0x30')][_0xb2d7('0x32')]?_0x121aff['attributes']:_0x5e719d[_0xb2d7('0x2b')];if(!_0x158a12[_0xb2d7('0x2d')][_0xb2d7('0x33')](_0xb2d7('0x34'))){_0x121aff[_0xb2d7('0x18')]=qs[_0xb2d7('0x18')](_0x158a12[_0xb2d7('0x2d')][_0xb2d7('0x18')]);_0x121aff['offset']=qs['offset'](_0x158a12['query'][_0xb2d7('0x16')]);}_0x121aff['order']=qs[_0xb2d7('0x35')](_0x158a12['query'][_0xb2d7('0x35')]);_0x121aff['where']=qs['filters'](_['pick'](_0x158a12['query'],_0x5e719d[_0xb2d7('0x2e')]),_0x9d778b);if(_0x158a12[_0xb2d7('0x2d')]['filter']){_0x121aff[_0xb2d7('0x36')]=_[_0xb2d7('0x37')](_0x121aff[_0xb2d7('0x36')],{'$or':_['map'](_0x9d778b,function(_0x1dd95c){if(_0x1dd95c[_0xb2d7('0x29')]!==_0xb2d7('0x38')){var _0xcfed43={};_0xcfed43[_0x1dd95c[_0xb2d7('0x24')]]={'$like':'%'+_0x158a12[_0xb2d7('0x2d')][_0xb2d7('0x39')]+'%'};return _0xcfed43;}})});}_0x121aff=_[_0xb2d7('0x37')]({},_0x121aff,_0x158a12[_0xb2d7('0x3a')]);var _0x4dcb1d={'where':_0x121aff[_0xb2d7('0x36')]};return db[_0xb2d7('0x27')][_0xb2d7('0x19')](_0x4dcb1d)[_0xb2d7('0x1f')](function(_0x388035){_0x361980[_0xb2d7('0x19')]=_0x388035;if(_0x158a12[_0xb2d7('0x2d')][_0xb2d7('0x3b')]){_0x121aff[_0xb2d7('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0xb2d7('0x3d')](_0x121aff);})[_0xb2d7('0x1f')](function(_0x5b910c){_0x361980[_0xb2d7('0x3e')]=_0x5b910c;return _0x361980;})[_0xb2d7('0x1f')](respondWithFilteredResult(_0x50bfaa,_0x121aff))[_0xb2d7('0x3f')](handleError(_0x50bfaa,null));};exports[_0xb2d7('0x40')]=function(_0x24e6c7,_0x324240){var _0x11b84d={'raw':!![],'where':{'id':_0x24e6c7['params']['id']}},_0x59fc3f={};_0x59fc3f['model']=_[_0xb2d7('0x2c')](db[_0xb2d7('0x27')][_0xb2d7('0x41')]);_0x59fc3f[_0xb2d7('0x2d')]=_['keys'](_0x24e6c7['query']);_0x59fc3f[_0xb2d7('0x2e')]=_[_0xb2d7('0x2f')](_0x59fc3f[_0xb2d7('0x2b')],_0x59fc3f[_0xb2d7('0x2d')]);_0x11b84d['attributes']=_['intersection'](_0x59fc3f[_0xb2d7('0x2b')],qs[_0xb2d7('0x31')](_0x24e6c7['query']['fields']));_0x11b84d['attributes']=_0x11b84d['attributes'][_0xb2d7('0x32')]?_0x11b84d[_0xb2d7('0x30')]:_0x59fc3f[_0xb2d7('0x2b')];if(_0x24e6c7[_0xb2d7('0x2d')][_0xb2d7('0x3b')]){_0x11b84d['include']=[{'all':!![]}];}_0x11b84d=_['merge']({},_0x11b84d,_0x24e6c7[_0xb2d7('0x3a')]);return db['FaxApplication']['find'](_0x11b84d)[_0xb2d7('0x1f')](handleEntityNotFound(_0x324240,null))[_0xb2d7('0x1f')](respondWithResult(_0x324240,null))[_0xb2d7('0x3f')](handleError(_0x324240,null));};exports[_0xb2d7('0x42')]=function(_0x427214,_0x222e76){return db['FaxApplication']['create'](_0x427214[_0xb2d7('0x43')],{})[_0xb2d7('0x1f')](respondWithResult(_0x222e76,0xc9))[_0xb2d7('0x3f')](handleError(_0x222e76,null));};exports[_0xb2d7('0x1e')]=function(_0x25c634,_0x4a2ec0){if(_0x25c634[_0xb2d7('0x43')]['id']){delete _0x25c634[_0xb2d7('0x43')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x25c634['params']['id']}})['then'](handleEntityNotFound(_0x4a2ec0,null))[_0xb2d7('0x1f')](saveUpdates(_0x25c634[_0xb2d7('0x43')],null))['then'](respondWithResult(_0x4a2ec0,null))[_0xb2d7('0x3f')](handleError(_0x4a2ec0,null));};exports[_0xb2d7('0x20')]=function(_0x4e7e6f,_0x1190df){return db[_0xb2d7('0x27')]['find']({'where':{'id':_0x4e7e6f[_0xb2d7('0x44')]['id']}})[_0xb2d7('0x1f')](handleEntityNotFound(_0x1190df,null))[_0xb2d7('0x1f')](removeEntity(_0x1190df,null))[_0xb2d7('0x3f')](handleError(_0x1190df,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2e9bdb0..cbe842b 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 _0xeb61=['moment','bluebird','request-promise','./faxApplication.attributes','define','FaxApplication','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xeb61,0x1bf));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1eb6('0x0'));var util=require(_0x1eb6('0x1'));var logger=require('../../config/logger')(_0x1eb6('0x2'));var moment=require(_0x1eb6('0x3'));var BPromise=require(_0x1eb6('0x4'));var rp=require(_0x1eb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1eb6('0x6'));module['exports']=function(_0x424849,_0x27a984){return _0x424849[_0x1eb6('0x7')](_0x1eb6('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1eb6('0x9')});}; \ No newline at end of file +var _0xd800=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','FaxApplication','fax_applications'];(function(_0x52f55c,_0x1f57e5){var _0xfc5fc6=function(_0x329870){while(--_0x329870){_0x52f55c['push'](_0x52f55c['shift']());}};_0xfc5fc6(++_0x1f57e5);}(_0xd800,0xd1));var _0x0d80=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xd800[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x0d80('0x0'));var util=require(_0x0d80('0x1'));var logger=require(_0x0d80('0x2'))(_0x0d80('0x3'));var moment=require(_0x0d80('0x4'));var BPromise=require('bluebird');var rp=require(_0x0d80('0x5'));var fs=require('fs');var path=require(_0x0d80('0x6'));var rimraf=require(_0x0d80('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x0d80('0x8')]=function(_0x133875,_0x5c9fe3){return _0x133875['define'](_0x0d80('0x9'),attributes,{'tableName':_0x0d80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c06a24f..19c6936 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 _0x4cad=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxApplication','update','body','options','raw','where','limit','then','UpdateFaxApplication','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cad,0xe7));var _0xd4ca=function(_0x291d32,_0x24226b){_0x291d32=_0x291d32-0x0;var _0x4898fd=_0x4cad[_0x291d32];return _0x4898fd;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var moment=require(_0xd4ca('0x2'));var BPromise=require(_0xd4ca('0x3'));var rs=require(_0xd4ca('0x4'));var fs=require('fs');var Redis=require(_0xd4ca('0x5'));var db=require(_0xd4ca('0x6'))['db'];var utils=require(_0xd4ca('0x7'));var logger=require(_0xd4ca('0x8'))(_0xd4ca('0x9'));var config=require(_0xd4ca('0xa'));var jayson=require(_0xd4ca('0xb'));var client=jayson[_0xd4ca('0xc')][_0xd4ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1b5b6a,_0x41811a,_0x5b2aaf){return new BPromise(function(_0x520069,_0x2c3fef){return client[_0xd4ca('0xe')](_0x1b5b6a,_0x5b2aaf)['then'](function(_0x2e7bdd){logger[_0xd4ca('0xf')](_0xd4ca('0x10'),_0x41811a,_0xd4ca('0x11'));logger[_0xd4ca('0x12')](_0xd4ca('0x13'),_0x41811a,'request\x20sent',JSON['stringify'](_0x2e7bdd));if(_0x2e7bdd[_0xd4ca('0x14')]){if(_0x2e7bdd[_0xd4ca('0x14')][_0xd4ca('0x15')]===0x1f4){logger[_0xd4ca('0x14')](_0xd4ca('0x10'),_0x41811a,_0x2e7bdd[_0xd4ca('0x14')]['message']);return _0x2c3fef(_0x2e7bdd['error'][_0xd4ca('0x16')]);}logger['error'](_0xd4ca('0x10'),_0x41811a,_0x2e7bdd[_0xd4ca('0x14')][_0xd4ca('0x16')]);return _0x520069(_0x2e7bdd[_0xd4ca('0x14')][_0xd4ca('0x16')]);}else{logger[_0xd4ca('0xf')](_0xd4ca('0x10'),_0x41811a,_0xd4ca('0x11'));_0x520069(_0x2e7bdd['result'][_0xd4ca('0x16')]);}})[_0xd4ca('0x17')](function(_0x32aa92){logger['error']('FaxApplication,\x20%s,\x20%s',_0x41811a,_0x32aa92);_0x2c3fef(_0x32aa92);});});}exports['UpdateFaxApplication']=function(_0x434f86){var _0xe04a35=this;return new Promise(function(_0x3a33b7,_0x28bd0f){return db[_0xd4ca('0x18')][_0xd4ca('0x19')](_0x434f86[_0xd4ca('0x1a')],{'raw':_0x434f86['options']?_0x434f86[_0xd4ca('0x1b')][_0xd4ca('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434f86[_0xd4ca('0x1b')]?_0x434f86[_0xd4ca('0x1b')][_0xd4ca('0x1d')]||null:null,'attributes':_0x434f86[_0xd4ca('0x1b')]?_0x434f86[_0xd4ca('0x1b')]['attributes']||null:null,'limit':_0x434f86[_0xd4ca('0x1b')]?_0x434f86[_0xd4ca('0x1b')][_0xd4ca('0x1e')]||null:null})[_0xd4ca('0x1f')](function(_0x164da5){logger['info']('UpdateFaxApplication',_0x434f86);logger[_0xd4ca('0x12')](_0xd4ca('0x20'),_0x434f86,JSON[_0xd4ca('0x21')](_0x164da5));_0x3a33b7(_0x164da5);})[_0xd4ca('0x17')](function(_0x3c2dd9){logger[_0xd4ca('0x14')]('UpdateFaxApplication',_0x3c2dd9[_0xd4ca('0x16')],_0x434f86);_0x28bd0f(_0xe04a35[_0xd4ca('0x14')](0x1f4,_0x3c2dd9[_0xd4ca('0x16')]));});});}; \ No newline at end of file +var _0x60bd=['options','raw','where','attributes','limit','debug','stringify','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x60bd,0x163));var _0xd60b=function(_0x31f355,_0x810c4){_0x31f355=_0x31f355-0x0;var _0x1eadfb=_0x60bd[_0x31f355];return _0x1eadfb;};'use strict';var _=require(_0xd60b('0x0'));var util=require('util');var moment=require(_0xd60b('0x1'));var BPromise=require('bluebird');var rs=require(_0xd60b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd60b('0x3'));var logger=require(_0xd60b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd60b('0x5'));var client=jayson[_0xd60b('0x6')][_0xd60b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dacf8,_0x239eff,_0xabceee){return new BPromise(function(_0x17b426,_0x5391aa){return client[_0xd60b('0x8')](_0x1dacf8,_0xabceee)[_0xd60b('0x9')](function(_0x451752){logger[_0xd60b('0xa')]('FaxApplication,\x20%s,\x20%s',_0x239eff,'request\x20sent');logger['debug'](_0xd60b('0xb'),_0x239eff,_0xd60b('0xc'),JSON['stringify'](_0x451752));if(_0x451752[_0xd60b('0xd')]){if(_0x451752['error'][_0xd60b('0xe')]===0x1f4){logger[_0xd60b('0xd')](_0xd60b('0xf'),_0x239eff,_0x451752[_0xd60b('0xd')]['message']);return _0x5391aa(_0x451752[_0xd60b('0xd')][_0xd60b('0x10')]);}logger[_0xd60b('0xd')](_0xd60b('0xf'),_0x239eff,_0x451752[_0xd60b('0xd')][_0xd60b('0x10')]);return _0x17b426(_0x451752['error'][_0xd60b('0x10')]);}else{logger[_0xd60b('0xa')](_0xd60b('0xf'),_0x239eff,_0xd60b('0xc'));_0x17b426(_0x451752[_0xd60b('0x11')]['message']);}})[_0xd60b('0x12')](function(_0x290d3e){logger['error']('FaxApplication,\x20%s,\x20%s',_0x239eff,_0x290d3e);_0x5391aa(_0x290d3e);});});}exports[_0xd60b('0x13')]=function(_0x1f74fb){var _0x10335f=this;return new Promise(function(_0x23b14b,_0x369c76){return db['FaxApplication'][_0xd60b('0x14')](_0x1f74fb[_0xd60b('0x15')],{'raw':_0x1f74fb[_0xd60b('0x16')]?_0x1f74fb['options'][_0xd60b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f74fb[_0xd60b('0x16')]?_0x1f74fb['options'][_0xd60b('0x18')]||null:null,'attributes':_0x1f74fb['options']?_0x1f74fb['options'][_0xd60b('0x19')]||null:null,'limit':_0x1f74fb[_0xd60b('0x16')]?_0x1f74fb[_0xd60b('0x16')][_0xd60b('0x1a')]||null:null})[_0xd60b('0x9')](function(_0x2ec2ef){logger[_0xd60b('0xa')](_0xd60b('0x13'),_0x1f74fb);logger[_0xd60b('0x1b')](_0xd60b('0x13'),_0x1f74fb,JSON[_0xd60b('0x1c')](_0x2ec2ef));_0x23b14b(_0x2ec2ef);})['catch'](function(_0x3293d3){logger[_0xd60b('0xd')](_0xd60b('0x13'),_0x3293d3[_0xd60b('0x10')],_0x1f74fb);_0x369c76(_0x10335f[_0xd60b('0xd')](0x1f4,_0x3293d3[_0xd60b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 699ae3d..637c2bf 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 _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x1fb877,_0x1cc5db){var _0x17121d=function(_0x3dc71b){while(--_0x3dc71b){_0x1fb877['push'](_0x1fb877['shift']());}};_0x17121d(++_0x1cc5db);}(_0x13f6,0x124));var _0x613f=function(_0x2a9add,_0x19944c){_0x2a9add=_0x2a9add-0x0;var _0x2b16fa=_0x13f6[_0x2a9add];return _0x2b16fa;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5f3016,_0x56e1a9){_0x5f3016=_0x5f3016-0x0;var _0x4207bd=_0xf7b4[_0x5f3016];return _0x4207bd;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 52f42e3..6321a58 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 _0xd117=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x194618,_0x2b8535){var _0x3a6638=function(_0x3853f6){while(--_0x3853f6){_0x194618['push'](_0x194618['shift']());}};_0x3a6638(++_0x2b8535);}(_0xd117,0x182));var _0x7d11=function(_0x18474f,_0x51e0f9){_0x18474f=_0x18474f-0x0;var _0xab5297=_0xd117[_0x18474f];return _0xab5297;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'closed':{'type':Sequelize[_0x7d11('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d11('0x3')]},'disposition':{'type':Sequelize[_0x7d11('0x4')]},'secondDisposition':{'type':Sequelize[_0x7d11('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7d11('0x4')]},'note':{'type':Sequelize[_0x7d11('0x4')]},'read1stAt':{'type':Sequelize[_0x7d11('0x3')]},'fax':{'type':Sequelize[_0x7d11('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7d11('0x5')]('in',_0x7d11('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d11('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d11('0x5')]('in',_0x7d11('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x7d11('0x7')]}}; \ No newline at end of file +var _0x2ef3=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1ca7ed,_0x2cccb4){var _0x5d706a=function(_0x304db1){while(--_0x304db1){_0x1ca7ed['push'](_0x1ca7ed['shift']());}};_0x5d706a(++_0x2cccb4);}(_0x2ef3,0xba));var _0x32ef=function(_0x46266f,_0x459db0){_0x46266f=_0x46266f-0x0;var _0x104ab7=_0x2ef3[_0x46266f];return _0x104ab7;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'closed':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x32ef('0x3')]},'disposition':{'type':Sequelize[_0x32ef('0x4')]},'secondDisposition':{'type':Sequelize[_0x32ef('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x32ef('0x4')]},'read1stAt':{'type':Sequelize[_0x32ef('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x32ef('0x5')]('in',_0x32ef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x32ef('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x32ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index bc6d9bd..21f2a40 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 _0x5814=['status','end','json','offset','undefined','limit','count','set','Content-Range','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','query','user','show','model','keys','filters','attributes','intersection','length','includeAll','include','find','then','catch','create','body','update','params','destroy','describe','addMessage','FaxMessage','ids','getMessages','findOne','fields','order','sort','pick','where','FaxInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','findAll','color','faxInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','download','log','err','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus'];(function(_0x1ef224,_0x604ca1){var _0x426a03=function(_0x285e09){while(--_0x285e09){_0x1ef224['push'](_0x1ef224['shift']());}};_0x426a03(++_0x604ca1);}(_0x5814,0x115));var _0x4581=function(_0x3b52bc,_0x42350a){_0x3b52bc=_0x3b52bc-0x0;var _0x347969=_0x5814[_0x3b52bc];return _0x347969;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4581('0x0'));var moment=require(_0x4581('0x1'));var BPromise=require('bluebird');var util=require(_0x4581('0x2'));var path=require(_0x4581('0x3'));var fs=require('fs');var _=require(_0x4581('0x4'));var Redis=require(_0x4581('0x5'));var interaction=require(_0x4581('0x6'));var qs=require(_0x4581('0x7'));var logger=require(_0x4581('0x8'))(_0x4581('0x9'));var config=require(_0x4581('0xa'));var db=require(_0x4581('0xb'))['db'];config[_0x4581('0xc')]=_['defaults'](config[_0x4581('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4581('0xd'))(new Redis(config[_0x4581('0xc')]));require(_0x4581('0xe'))[_0x4581('0xf')](socket);function respondWithStatusCode(_0x13e74b,_0x2ae282){_0x2ae282=_0x2ae282||0xcc;return function(_0x4d9f6d){if(_0x4d9f6d){return _0x13e74b[_0x4581('0x10')](_0x2ae282);}return _0x13e74b[_0x4581('0x11')](_0x2ae282)[_0x4581('0x12')]();};}function respondWithResult(_0x27301d,_0xbf5638){_0xbf5638=_0xbf5638||0xc8;return function(_0x369ba8){if(_0x369ba8){return _0x27301d[_0x4581('0x11')](_0xbf5638)[_0x4581('0x13')](_0x369ba8);}};}function respondWithFilteredResult(_0x4d3e3c,_0x36f8dd){return function(_0x3f33c0){if(_0x3f33c0){var _0x22afbd=typeof _0x36f8dd[_0x4581('0x14')]===_0x4581('0x15')&&typeof _0x36f8dd[_0x4581('0x16')]==='undefined';var _0x586d5f=_0x3f33c0[_0x4581('0x17')];var _0x43d213=_0x22afbd?0x0:_0x36f8dd['offset'];var _0x54ba6a=_0x22afbd?_0x3f33c0['count']:_0x36f8dd[_0x4581('0x14')]+_0x36f8dd[_0x4581('0x16')];var _0x15a74c;if(_0x54ba6a>=_0x586d5f){_0x54ba6a=_0x586d5f;_0x15a74c=0xc8;}else{_0x15a74c=0xce;}_0x4d3e3c['status'](_0x15a74c);return _0x4d3e3c[_0x4581('0x18')](_0x4581('0x19'),_0x43d213+'-'+_0x54ba6a+'/'+_0x586d5f)[_0x4581('0x13')](_0x3f33c0);}return null;};}function saveUpdates(_0x1935b7){return function(_0x1cdbc4){if(_0x1cdbc4){return _0x1cdbc4['update'](_0x1935b7)['then'](function(_0x5150b0){return _0x5150b0;});}return null;};}function removeEntity(_0x28acf4){return function(_0x1ab21a){if(_0x1ab21a){return _0x1ab21a['destroy']()['then'](function(){_0x28acf4[_0x4581('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df0fd){return function(_0x413912){if(!_0x413912){_0x1df0fd[_0x4581('0x10')](0x194);}return _0x413912;};}function handleError(_0x46a8a4,_0x413b6f){_0x413b6f=_0x413b6f||0x1f4;return function(_0x940957){logger['error'](_0x940957['stack']);if(_0x940957[_0x4581('0x1a')]){delete _0x940957[_0x4581('0x1a')];}_0x46a8a4['status'](_0x413b6f)[_0x4581('0x1b')](_0x940957);};}exports[_0x4581('0x1c')]=function(_0x40d680,_0x3c9e16){var _0xdd556d={};var _0x3faa59=_[_0x4581('0x1d')](db[_0x4581('0x1e')][_0x4581('0x1f')],function(_0xeb01bd){return{'name':_0xeb01bd['fieldName'],'type':_0xeb01bd[_0x4581('0x20')][_0x4581('0x21')]};});_0xdd556d=qs[_0x4581('0x22')](_0x3faa59,_0x40d680);return interaction['findAll']('fax',_0x40d680[_0x4581('0x23')],_0x40d680[_0x4581('0x24')],_0xdd556d,_0x3faa59)['then'](respondWithFilteredResult(_0x3c9e16,_0xdd556d))['catch'](handleError(_0x3c9e16,null));};exports[_0x4581('0x25')]=function(_0x1ddaab,_0x351991){var _0x227c24={'raw':![],'where':{'id':_0x1ddaab['params']['id']}},_0x58bdfe={};_0x58bdfe[_0x4581('0x26')]=_['keys'](db[_0x4581('0x1e')][_0x4581('0x1f')]);_0x58bdfe[_0x4581('0x23')]=_[_0x4581('0x27')](_0x1ddaab[_0x4581('0x23')]);_0x58bdfe[_0x4581('0x28')]=_['intersection'](_0x58bdfe['model'],_0x58bdfe[_0x4581('0x23')]);_0x227c24[_0x4581('0x29')]=_[_0x4581('0x2a')](_0x58bdfe[_0x4581('0x26')],qs['fields'](_0x1ddaab[_0x4581('0x23')]['fields']));_0x227c24[_0x4581('0x29')]=_0x227c24['attributes'][_0x4581('0x2b')]?_0x227c24[_0x4581('0x29')]:_0x58bdfe['model'];if(_0x1ddaab[_0x4581('0x23')][_0x4581('0x2c')]){_0x227c24[_0x4581('0x2d')]=[{'all':!![]}];}_0x227c24=_['merge']({},_0x227c24,_0x1ddaab['options']);return db[_0x4581('0x1e')][_0x4581('0x2e')](_0x227c24)[_0x4581('0x2f')](handleEntityNotFound(_0x351991,null))[_0x4581('0x2f')](respondWithResult(_0x351991,null))[_0x4581('0x30')](handleError(_0x351991,null));};exports[_0x4581('0x31')]=function(_0x29ba92,_0x29ddea){return db[_0x4581('0x1e')]['create'](_0x29ba92[_0x4581('0x32')],{})['then'](respondWithResult(_0x29ddea,0xc9))[_0x4581('0x30')](handleError(_0x29ddea,null));};exports[_0x4581('0x33')]=function(_0x3bb309,_0x2c7cc3){if(_0x3bb309[_0x4581('0x32')]['id']){delete _0x3bb309['body']['id'];}return db[_0x4581('0x1e')][_0x4581('0x2e')]({'where':{'id':_0x3bb309[_0x4581('0x34')]['id']}})[_0x4581('0x2f')](handleEntityNotFound(_0x2c7cc3,null))[_0x4581('0x2f')](saveUpdates(_0x3bb309['body'],null))[_0x4581('0x2f')](respondWithResult(_0x2c7cc3,null))[_0x4581('0x30')](handleError(_0x2c7cc3,null));};exports[_0x4581('0x35')]=function(_0x162bf3,_0x2d6761){return db['FaxInteraction']['find']({'where':{'id':_0x162bf3['params']['id']}})[_0x4581('0x2f')](handleEntityNotFound(_0x2d6761,null))[_0x4581('0x2f')](removeEntity(_0x2d6761,null))['catch'](handleError(_0x2d6761,null));};exports['describe']=function(_0x54e33a,_0x331b95){return db[_0x4581('0x1e')][_0x4581('0x36')]()[_0x4581('0x2f')](respondWithResult(_0x331b95,null))[_0x4581('0x30')](handleError(_0x331b95,null));};exports[_0x4581('0x37')]=function(_0xc763cd,_0x1f6959){return db[_0x4581('0x38')]['find']({'where':{'id':_0xc763cd[_0x4581('0x34')]['id']}})['then'](handleEntityNotFound(_0x1f6959,null))[_0x4581('0x2f')](function(_0x2afaa3){if(_0x2afaa3){return _0x2afaa3[_0x4581('0x37')](_0xc763cd['body'][_0x4581('0x39')],_['omit'](_0xc763cd[_0x4581('0x32')],['ids','id'])||{});}})[_0x4581('0x2f')](respondWithResult(_0x1f6959,null))[_0x4581('0x30')](handleError(_0x1f6959,null));};exports[_0x4581('0x3a')]=function(_0x2fdd7b,_0x1bb3e1){var _0x27bd30={'raw':![],'where':{}};var _0x24453e={};var _0x2e11e9={'count':0x0,'rows':[]};return db[_0x4581('0x1e')][_0x4581('0x3b')]({'where':{'id':_0x2fdd7b[_0x4581('0x34')]['id']}})[_0x4581('0x2f')](handleEntityNotFound(_0x1bb3e1,null))['then'](function(_0x7b60f3){if(_0x7b60f3){_0x24453e[_0x4581('0x26')]=_[_0x4581('0x27')](db[_0x4581('0x38')][_0x4581('0x1f')]);_0x24453e[_0x4581('0x23')]=_[_0x4581('0x27')](_0x2fdd7b[_0x4581('0x23')]);_0x24453e['filters']=_['intersection'](_0x24453e[_0x4581('0x26')],_0x24453e[_0x4581('0x23')]);_0x27bd30[_0x4581('0x29')]=_[_0x4581('0x2a')](_0x24453e['model'],qs[_0x4581('0x3c')](_0x2fdd7b[_0x4581('0x23')][_0x4581('0x3c')]));_0x27bd30['attributes']=_0x27bd30[_0x4581('0x29')][_0x4581('0x2b')]?_0x27bd30['attributes']:_0x24453e['model'];if(!_0x2fdd7b[_0x4581('0x23')]['hasOwnProperty']('nolimit')){_0x27bd30['limit']=qs[_0x4581('0x16')](_0x2fdd7b[_0x4581('0x23')][_0x4581('0x16')]);_0x27bd30[_0x4581('0x14')]=qs['offset'](_0x2fdd7b[_0x4581('0x23')][_0x4581('0x14')]);}_0x27bd30[_0x4581('0x3d')]=qs[_0x4581('0x3e')](_0x2fdd7b['query'][_0x4581('0x3e')]);_0x27bd30['where']=qs[_0x4581('0x28')](_[_0x4581('0x3f')](_0x2fdd7b[_0x4581('0x23')],_0x24453e[_0x4581('0x28')]));_0x27bd30[_0x4581('0x40')][_0x4581('0x41')]=_0x7b60f3['id'];if(_0x2fdd7b[_0x4581('0x23')][_0x4581('0x42')]){_0x27bd30[_0x4581('0x40')]=_[_0x4581('0x43')](_0x27bd30[_0x4581('0x40')],{'$or':_[_0x4581('0x1d')](_0x27bd30['attributes'],function(_0x2caf32){var _0x2f4abc={};_0x2f4abc[_0x2caf32]={'$like':'%'+_0x2fdd7b['query'][_0x4581('0x42')]+'%'};return _0x2f4abc;})});}if(_0x2fdd7b['query'][_0x4581('0x44')]){var _0x525335=_0x2fdd7b[_0x4581('0x23')][_0x4581('0x44')]['split'](',');var _0x4ca7ce={};_0x4ca7ce[_0x525335[0x0]]={'$gte':moment(_0x525335[0x1])[_0x4581('0x45')](_0x4581('0x46'))};_0x27bd30['where']=_[_0x4581('0x43')](_0x27bd30[_0x4581('0x40')],_0x4ca7ce);}_0x27bd30=_[_0x4581('0x43')]({},_0x27bd30,_0x2fdd7b['options']);return db['FaxMessage']['count']({'where':_0x27bd30[_0x4581('0x40')]})[_0x4581('0x2f')](function(_0x6bc9d2){_0x2e11e9['count']=_0x6bc9d2;if(_0x2fdd7b[_0x4581('0x23')]['includeAll']){_0x27bd30['include']=[{'all':!![]}];}return db[_0x4581('0x38')]['findAll'](_0x27bd30);})['then'](function(_0x3ea365){_0x2e11e9[_0x4581('0x47')]=_0x3ea365;return _0x2e11e9;});}})[_0x4581('0x2f')](respondWithFilteredResult(_0x1bb3e1,_0x27bd30))[_0x4581('0x30')](handleError(_0x1bb3e1,null));};exports[_0x4581('0x48')]=function(_0x184fcb,_0x419380){return db[_0x4581('0x1e')]['find']({'where':{'id':_0x184fcb['params']['id']}})[_0x4581('0x2f')](handleEntityNotFound(_0x419380,null))[_0x4581('0x2f')](function(_0x2ed4f8){if(_0x2ed4f8){return _0x2ed4f8['setTags'](_0x184fcb[_0x4581('0x32')][_0x4581('0x39')],_[_0x4581('0x49')](_0x184fcb['body'],[_0x4581('0x39'),'id'])||{})[_0x4581('0x4a')](function(){return db['Tag'][_0x4581('0x4b')]({'attributes':['id','name',_0x4581('0x4c')],'where':{'id':_0x184fcb[_0x4581('0x32')]['ids']}});})['then'](function(_0x33fd06){socket['emit'](_0x4581('0x4d'),{'id':Number(_0x184fcb[_0x4581('0x34')]['id']),'tags':_0x33fd06||[]});return{'id':Number(_0x184fcb[_0x4581('0x34')]['id']),'tags':_0x33fd06||[]};});}})[_0x4581('0x2f')](respondWithResult(_0x419380,null))[_0x4581('0x30')](handleError(_0x419380,null));};exports[_0x4581('0x4e')]=function(_0x3feb51,_0x1794af){return db[_0x4581('0x1e')][_0x4581('0x2e')]({'where':{'id':_0x3feb51[_0x4581('0x34')]['id']}})['then'](handleEntityNotFound(_0x1794af,null))[_0x4581('0x2f')](function(_0x496965){if(_0x496965){return _0x496965['removeTags'](_0x3feb51[_0x4581('0x23')][_0x4581('0x39')]);}})[_0x4581('0x2f')](respondWithStatusCode(_0x1794af,null))[_0x4581('0x30')](handleError(_0x1794af,null));};exports['download']=function(_0x291386,_0x206b2e){var _0x3ebe08=moment()[_0x4581('0x4f')]()[_0x4581('0x50')]();var _0x22e443=path[_0x4581('0x51')](config['root'],_0x4581('0x52'),_0x4581('0x53'),_0x4581('0x54'));var _0x2f9de2=path['join'](config['root'],'server',_0x4581('0x53'),_0x4581('0x55'));var _0x5f55ed=path[_0x4581('0x51')](_0x22e443,_0x3ebe08);var _0x2704f6=util['format'](_0x4581('0x56'),_0x291386['params']['id'],_0x3ebe08);var _0xd55657=path[_0x4581('0x51')](_0x22e443,_0x2704f6);var _0x24a36c=[];_0x24a36c['push']({'model':db[_0x4581('0x57')],'as':_0x4581('0x57'),'raw':!![]});var _0x1274c4=[{'model':db[_0x4581('0x38')],'as':_0x4581('0x58'),'attributes':['id','body','createdAt'],'include':_0x24a36c}];return db[_0x4581('0x1e')][_0x4581('0x2e')]({'where':{'id':_0x291386[_0x4581('0x34')]['id']},'include':_0x1274c4})[_0x4581('0x2f')](handleEntityNotFound(_0x206b2e,null))[_0x4581('0x2f')](function(_0x5dd4d2){if(_0x5dd4d2&&_0x5dd4d2['Messages']){var _0x45c9cd=_0x5dd4d2[_0x4581('0x59')]({'plain':!![]});fs[_0x4581('0x5a')](_0x5f55ed);for(var _0x480483=0x0;_0x480483<_0x45c9cd[_0x4581('0x58')][_0x4581('0x2b')];_0x480483++){var _0x2b3f1d=_0x45c9cd[_0x4581('0x58')][_0x480483][_0x4581('0x57')];if(_0x2b3f1d){var _0x84f98b=path[_0x4581('0x51')](_0x2f9de2,_0x2b3f1d[_0x4581('0x5b')]);if(fs['existsSync'](_0x84f98b)){fs[_0x4581('0x5c')](_0x84f98b)['pipe'](fs[_0x4581('0x5d')](path[_0x4581('0x51')](_0x5f55ed,_0x2b3f1d[_0x4581('0x5b')])));}}}return BPromise[_0x4581('0x5e')]()['then'](function(){return new BPromise(function(_0x10f225,_0x3ba666){zipdir(_0x5f55ed,{'saveTo':_0xd55657},function(_0x1a1e61,_0x49da0d){if(_0x1a1e61)return _0x3ba666(_0x1a1e61);return _0x10f225(_0x49da0d);});})[_0x4581('0x2f')](function(){return new BPromise(function(_0x233f4d,_0x409a3a){rimraf(_0x5f55ed,function(_0x565dda){if(_0x565dda)_0x409a3a(_0x565dda);return _0x233f4d();});});})[_0x4581('0x2f')](function(){return _0x206b2e[_0x4581('0x5f')](_0xd55657,_0x2704f6,function(_0x14165c){if(_0x14165c){console[_0x4581('0x60')](_0x4581('0x61'),_0x14165c);}else{fs['unlinkSync'](_0xd55657);}});});});}else{return _0x206b2e[_0x4581('0x10')](0xc8);}})[_0x4581('0x30')](handleError(_0x206b2e,null));}; \ No newline at end of file +var _0x04a2=['includeAll','merge','options','find','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','resolve','log','err','unlinkSync','zip-dir','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','sendStatus','status','json','offset','undefined','count','limit','set','update','then','destroy','error','stack','name','map','key','getOptions','fax','query','user','catch','model','FaxInteraction','rawAttributes','keys','filters','attributes','intersection','fields','length'];(function(_0x4806bf,_0x4cb708){var _0x490007=function(_0x240cff){while(--_0x240cff){_0x4806bf['push'](_0x4806bf['shift']());}};_0x490007(++_0x4cb708);}(_0x04a2,0x9a));var _0x204a=function(_0x23a6f9,_0x37323a){_0x23a6f9=_0x23a6f9-0x0;var _0x412a38=_0x04a2[_0x23a6f9];return _0x412a38;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x204a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x204a('0x1'));var path=require(_0x204a('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x204a('0x3'));var interaction=require(_0x204a('0x4'));var qs=require(_0x204a('0x5'));var logger=require(_0x204a('0x6'))(_0x204a('0x7'));var config=require(_0x204a('0x8'));var db=require('../../mysqldb')['db'];config[_0x204a('0x9')]=_[_0x204a('0xa')](config[_0x204a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x204a('0xb'))(new Redis(config[_0x204a('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x51ff1e,_0x5c48b1){_0x5c48b1=_0x5c48b1||0xcc;return function(_0x54de2e){if(_0x54de2e){return _0x51ff1e[_0x204a('0xc')](_0x5c48b1);}return _0x51ff1e[_0x204a('0xd')](_0x5c48b1)['end']();};}function respondWithResult(_0x1ac4dd,_0x494e99){_0x494e99=_0x494e99||0xc8;return function(_0x45ca08){if(_0x45ca08){return _0x1ac4dd[_0x204a('0xd')](_0x494e99)[_0x204a('0xe')](_0x45ca08);}};}function respondWithFilteredResult(_0x23c4b6,_0x1897f2){return function(_0x16bf73){if(_0x16bf73){var _0x5744b7=typeof _0x1897f2[_0x204a('0xf')]==='undefined'&&typeof _0x1897f2['limit']===_0x204a('0x10');var _0x21659b=_0x16bf73[_0x204a('0x11')];var _0x55a7de=_0x5744b7?0x0:_0x1897f2[_0x204a('0xf')];var _0x55b19c=_0x5744b7?_0x16bf73[_0x204a('0x11')]:_0x1897f2['offset']+_0x1897f2[_0x204a('0x12')];var _0x3478c8;if(_0x55b19c>=_0x21659b){_0x55b19c=_0x21659b;_0x3478c8=0xc8;}else{_0x3478c8=0xce;}_0x23c4b6['status'](_0x3478c8);return _0x23c4b6[_0x204a('0x13')]('Content-Range',_0x55a7de+'-'+_0x55b19c+'/'+_0x21659b)[_0x204a('0xe')](_0x16bf73);}return null;};}function saveUpdates(_0x1ea2bc){return function(_0x5d407a){if(_0x5d407a){return _0x5d407a[_0x204a('0x14')](_0x1ea2bc)[_0x204a('0x15')](function(_0x362eeb){return _0x362eeb;});}return null;};}function removeEntity(_0x4a660a){return function(_0x1c5bf7){if(_0x1c5bf7){return _0x1c5bf7[_0x204a('0x16')]()['then'](function(){_0x4a660a[_0x204a('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef394){return function(_0x11ebe8){if(!_0x11ebe8){_0x4ef394[_0x204a('0xc')](0x194);}return _0x11ebe8;};}function handleError(_0x765862,_0x10cff1){_0x10cff1=_0x10cff1||0x1f4;return function(_0x1cbf49){logger[_0x204a('0x17')](_0x1cbf49[_0x204a('0x18')]);if(_0x1cbf49[_0x204a('0x19')]){delete _0x1cbf49[_0x204a('0x19')];}_0x765862[_0x204a('0xd')](_0x10cff1)['send'](_0x1cbf49);};}exports['index']=function(_0x24bf55,_0x5e655e){var _0x10fbf9={};var _0x484adf=_[_0x204a('0x1a')](db['FaxInteraction']['rawAttributes'],function(_0x2f4cea){return{'name':_0x2f4cea['fieldName'],'type':_0x2f4cea['type'][_0x204a('0x1b')]};});_0x10fbf9=qs[_0x204a('0x1c')](_0x484adf,_0x24bf55);return interaction['findAll'](_0x204a('0x1d'),_0x24bf55[_0x204a('0x1e')],_0x24bf55[_0x204a('0x1f')],_0x10fbf9,_0x484adf)['then'](respondWithFilteredResult(_0x5e655e,_0x10fbf9))[_0x204a('0x20')](handleError(_0x5e655e,null));};exports['show']=function(_0x3d06ab,_0xce63f7){var _0x36c2dd={'raw':![],'where':{'id':_0x3d06ab['params']['id']}},_0x5d2e89={};_0x5d2e89[_0x204a('0x21')]=_['keys'](db[_0x204a('0x22')][_0x204a('0x23')]);_0x5d2e89[_0x204a('0x1e')]=_[_0x204a('0x24')](_0x3d06ab[_0x204a('0x1e')]);_0x5d2e89[_0x204a('0x25')]=_['intersection'](_0x5d2e89[_0x204a('0x21')],_0x5d2e89[_0x204a('0x1e')]);_0x36c2dd[_0x204a('0x26')]=_[_0x204a('0x27')](_0x5d2e89[_0x204a('0x21')],qs[_0x204a('0x28')](_0x3d06ab[_0x204a('0x1e')][_0x204a('0x28')]));_0x36c2dd[_0x204a('0x26')]=_0x36c2dd[_0x204a('0x26')][_0x204a('0x29')]?_0x36c2dd['attributes']:_0x5d2e89[_0x204a('0x21')];if(_0x3d06ab['query'][_0x204a('0x2a')]){_0x36c2dd['include']=[{'all':!![]}];}_0x36c2dd=_[_0x204a('0x2b')]({},_0x36c2dd,_0x3d06ab[_0x204a('0x2c')]);return db[_0x204a('0x22')][_0x204a('0x2d')](_0x36c2dd)['then'](handleEntityNotFound(_0xce63f7,null))['then'](respondWithResult(_0xce63f7,null))[_0x204a('0x20')](handleError(_0xce63f7,null));};exports[_0x204a('0x2e')]=function(_0x4de3ee,_0x512c86){return db[_0x204a('0x22')][_0x204a('0x2e')](_0x4de3ee[_0x204a('0x2f')],{})[_0x204a('0x15')](respondWithResult(_0x512c86,0xc9))[_0x204a('0x20')](handleError(_0x512c86,null));};exports[_0x204a('0x14')]=function(_0x4f4be5,_0x4b6656){if(_0x4f4be5['body']['id']){delete _0x4f4be5[_0x204a('0x2f')]['id'];}return db['FaxInteraction'][_0x204a('0x2d')]({'where':{'id':_0x4f4be5['params']['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x4b6656,null))[_0x204a('0x15')](saveUpdates(_0x4f4be5[_0x204a('0x2f')],null))[_0x204a('0x15')](respondWithResult(_0x4b6656,null))[_0x204a('0x20')](handleError(_0x4b6656,null));};exports[_0x204a('0x16')]=function(_0x2bf929,_0x37b8d0){return db[_0x204a('0x22')][_0x204a('0x2d')]({'where':{'id':_0x2bf929[_0x204a('0x30')]['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x37b8d0,null))[_0x204a('0x15')](removeEntity(_0x37b8d0,null))[_0x204a('0x20')](handleError(_0x37b8d0,null));};exports['describe']=function(_0x4c5c13,_0x47f0a5){return db[_0x204a('0x22')][_0x204a('0x31')]()[_0x204a('0x15')](respondWithResult(_0x47f0a5,null))[_0x204a('0x20')](handleError(_0x47f0a5,null));};exports[_0x204a('0x32')]=function(_0x19f68b,_0x2ea35c){return db[_0x204a('0x33')][_0x204a('0x2d')]({'where':{'id':_0x19f68b[_0x204a('0x30')]['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x2ea35c,null))[_0x204a('0x15')](function(_0x425add){if(_0x425add){return _0x425add[_0x204a('0x32')](_0x19f68b[_0x204a('0x2f')][_0x204a('0x34')],_[_0x204a('0x35')](_0x19f68b['body'],[_0x204a('0x34'),'id'])||{});}})[_0x204a('0x15')](respondWithResult(_0x2ea35c,null))[_0x204a('0x20')](handleError(_0x2ea35c,null));};exports[_0x204a('0x36')]=function(_0x276094,_0x3bd33c){var _0x19a5f6={'raw':![],'where':{}};var _0x4ec289={};var _0x22e405={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x204a('0x37')]({'where':{'id':_0x276094[_0x204a('0x30')]['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x3bd33c,null))[_0x204a('0x15')](function(_0x3b441c){if(_0x3b441c){_0x4ec289[_0x204a('0x21')]=_['keys'](db['FaxMessage'][_0x204a('0x23')]);_0x4ec289[_0x204a('0x1e')]=_['keys'](_0x276094[_0x204a('0x1e')]);_0x4ec289[_0x204a('0x25')]=_['intersection'](_0x4ec289['model'],_0x4ec289[_0x204a('0x1e')]);_0x19a5f6['attributes']=_[_0x204a('0x27')](_0x4ec289[_0x204a('0x21')],qs[_0x204a('0x28')](_0x276094[_0x204a('0x1e')][_0x204a('0x28')]));_0x19a5f6[_0x204a('0x26')]=_0x19a5f6[_0x204a('0x26')][_0x204a('0x29')]?_0x19a5f6['attributes']:_0x4ec289['model'];if(!_0x276094[_0x204a('0x1e')][_0x204a('0x38')](_0x204a('0x39'))){_0x19a5f6[_0x204a('0x12')]=qs['limit'](_0x276094['query']['limit']);_0x19a5f6[_0x204a('0xf')]=qs['offset'](_0x276094[_0x204a('0x1e')][_0x204a('0xf')]);}_0x19a5f6[_0x204a('0x3a')]=qs[_0x204a('0x3b')](_0x276094['query']['sort']);_0x19a5f6[_0x204a('0x3c')]=qs[_0x204a('0x25')](_[_0x204a('0x3d')](_0x276094['query'],_0x4ec289[_0x204a('0x25')]));_0x19a5f6['where'][_0x204a('0x3e')]=_0x3b441c['id'];if(_0x276094[_0x204a('0x1e')][_0x204a('0x3f')]){_0x19a5f6[_0x204a('0x3c')]=_[_0x204a('0x2b')](_0x19a5f6[_0x204a('0x3c')],{'$or':_['map'](_0x19a5f6[_0x204a('0x26')],function(_0x274fb6){var _0x19d9dd={};_0x19d9dd[_0x274fb6]={'$like':'%'+_0x276094[_0x204a('0x1e')]['filter']+'%'};return _0x19d9dd;})});}if(_0x276094[_0x204a('0x1e')][_0x204a('0x40')]){var _0x17255f=_0x276094['query'][_0x204a('0x40')][_0x204a('0x41')](',');var _0x560230={};_0x560230[_0x17255f[0x0]]={'$gte':moment(_0x17255f[0x1])[_0x204a('0x42')](_0x204a('0x43'))};_0x19a5f6[_0x204a('0x3c')]=_[_0x204a('0x2b')](_0x19a5f6['where'],_0x560230);}_0x19a5f6=_[_0x204a('0x2b')]({},_0x19a5f6,_0x276094[_0x204a('0x2c')]);return db[_0x204a('0x33')]['count']({'where':_0x19a5f6[_0x204a('0x3c')]})[_0x204a('0x15')](function(_0x393eec){_0x22e405[_0x204a('0x11')]=_0x393eec;if(_0x276094[_0x204a('0x1e')][_0x204a('0x2a')]){_0x19a5f6[_0x204a('0x44')]=[{'all':!![]}];}return db['FaxMessage'][_0x204a('0x45')](_0x19a5f6);})[_0x204a('0x15')](function(_0x7df48d){_0x22e405[_0x204a('0x46')]=_0x7df48d;return _0x22e405;});}})[_0x204a('0x15')](respondWithFilteredResult(_0x3bd33c,_0x19a5f6))[_0x204a('0x20')](handleError(_0x3bd33c,null));};exports[_0x204a('0x47')]=function(_0x5e503b,_0x4a43f5){return db[_0x204a('0x22')][_0x204a('0x2d')]({'where':{'id':_0x5e503b['params']['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x4a43f5,null))['then'](function(_0x446ff5){if(_0x446ff5){return _0x446ff5[_0x204a('0x48')](_0x5e503b[_0x204a('0x2f')][_0x204a('0x34')],_['omit'](_0x5e503b['body'],[_0x204a('0x34'),'id'])||{})[_0x204a('0x49')](function(){return db[_0x204a('0x4a')][_0x204a('0x45')]({'attributes':['id','name',_0x204a('0x4b')],'where':{'id':_0x5e503b[_0x204a('0x2f')]['ids']}});})[_0x204a('0x15')](function(_0x4f9bfb){socket[_0x204a('0x4c')](_0x204a('0x4d'),{'id':Number(_0x5e503b[_0x204a('0x30')]['id']),'tags':_0x4f9bfb||[]});return{'id':Number(_0x5e503b[_0x204a('0x30')]['id']),'tags':_0x4f9bfb||[]};});}})[_0x204a('0x15')](respondWithResult(_0x4a43f5,null))[_0x204a('0x20')](handleError(_0x4a43f5,null));};exports[_0x204a('0x4e')]=function(_0x174120,_0x10a7a5){return db[_0x204a('0x22')][_0x204a('0x2d')]({'where':{'id':_0x174120[_0x204a('0x30')]['id']}})[_0x204a('0x15')](handleEntityNotFound(_0x10a7a5,null))[_0x204a('0x15')](function(_0x1a2342){if(_0x1a2342){return _0x1a2342['removeTags'](_0x174120[_0x204a('0x1e')][_0x204a('0x34')]);}})[_0x204a('0x15')](respondWithStatusCode(_0x10a7a5,null))['catch'](handleError(_0x10a7a5,null));};exports[_0x204a('0x4f')]=function(_0xb9494c,_0x94f32a){var _0x4d0b8e=moment()[_0x204a('0x50')]()[_0x204a('0x51')]();var _0x5ac9cc=path[_0x204a('0x52')](config[_0x204a('0x53')],_0x204a('0x54'),_0x204a('0x55'),'tmp');var _0x244ec9=path[_0x204a('0x52')](config[_0x204a('0x53')],_0x204a('0x54'),'files',_0x204a('0x56'));var _0x152092=path[_0x204a('0x52')](_0x5ac9cc,_0x4d0b8e);var _0x4888f0=util[_0x204a('0x42')](_0x204a('0x57'),_0xb9494c['params']['id'],_0x4d0b8e);var _0x3802eb=path[_0x204a('0x52')](_0x5ac9cc,_0x4888f0);var _0x2757d3=[];_0x2757d3['push']({'model':db[_0x204a('0x58')],'as':'Attachment','raw':!![]});var _0x20f941=[{'model':db[_0x204a('0x33')],'as':_0x204a('0x59'),'attributes':['id','body','createdAt'],'include':_0x2757d3}];return db[_0x204a('0x22')]['find']({'where':{'id':_0xb9494c[_0x204a('0x30')]['id']},'include':_0x20f941})[_0x204a('0x15')](handleEntityNotFound(_0x94f32a,null))[_0x204a('0x15')](function(_0x2cb4c1){if(_0x2cb4c1&&_0x2cb4c1[_0x204a('0x59')]){var _0x211b51=_0x2cb4c1['get']({'plain':!![]});fs[_0x204a('0x5a')](_0x152092);for(var _0x35c68b=0x0;_0x35c68b<_0x211b51['Messages'][_0x204a('0x29')];_0x35c68b++){var _0x295405=_0x211b51[_0x204a('0x59')][_0x35c68b][_0x204a('0x58')];if(_0x295405){var _0x1cfcc3=path['join'](_0x244ec9,_0x295405[_0x204a('0x5b')]);if(fs[_0x204a('0x5c')](_0x1cfcc3)){fs[_0x204a('0x5d')](_0x1cfcc3)['pipe'](fs['createWriteStream'](path[_0x204a('0x52')](_0x152092,_0x295405[_0x204a('0x5b')])));}}}return BPromise[_0x204a('0x5e')]()[_0x204a('0x15')](function(){return new BPromise(function(_0x357cc9,_0x273e46){zipdir(_0x152092,{'saveTo':_0x3802eb},function(_0xbd727a,_0x5a4305){if(_0xbd727a)return _0x273e46(_0xbd727a);return _0x357cc9(_0x5a4305);});})[_0x204a('0x15')](function(){return new BPromise(function(_0x944782,_0x245464){rimraf(_0x152092,function(_0x46680d){if(_0x46680d)_0x245464(_0x46680d);return _0x944782();});});})[_0x204a('0x15')](function(){return _0x94f32a[_0x204a('0x4f')](_0x3802eb,_0x4888f0,function(_0x4f0440){if(_0x4f0440){console[_0x204a('0x5f')](_0x204a('0x60'),_0x4f0440);}else{fs[_0x204a('0x61')](_0x3802eb);}});});});}else{return _0x94f32a['sendStatus'](0xc8);}})[_0x204a('0x20')](handleError(_0x94f32a,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 49d7d07..d06ce41 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 _0xad02=['emit','catch','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x3fefdf,_0x561404){var _0x2d8ce3=function(_0x596290){while(--_0x596290){_0x3fefdf['push'](_0x3fefdf['shift']());}};_0x2d8ce3(++_0x561404);}(_0xad02,0xdc));var _0x2ad0=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xad02[_0x58999b];return _0x5efc3a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2ad0('0x0'))['db'][_0x2ad0('0x1')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2ad0('0x2')](0x0);var events={'afterCreate':_0x2ad0('0x3'),'afterUpdate':_0x2ad0('0x4'),'afterDestroy':_0x2ad0('0x5')};function emitEvent(_0x5a577a){return function(_0x2d7290,_0x428736,_0x159e3d){_0x2d7290[_0x2ad0('0x6')]({'attributes':['id'],'raw':!![]})[_0x2ad0('0x7')](function(_0x3512a0){_0x2d7290[_0x2ad0('0x8')](_0x2ad0('0x9'),_0x3512a0[_0x2ad0('0xa')](function(_0x3b0bb7){return{'id':_0x3b0bb7['id']};}));return FaxMessage[_0x2ad0('0xb')]({'where':{'FaxInteractionId':_0x2d7290['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2ad0('0x7')](function(_0x33f385){_0x2d7290[_0x2ad0('0x8')](_0x2ad0('0xc'),_0x33f385[_0x2ad0('0xd')]);FaxInteractionEvents[_0x2ad0('0xe')](_0x5a577a+':'+_0x2d7290['id'],_0x2d7290);FaxInteractionEvents[_0x2ad0('0xe')](_0x5a577a,_0x2d7290);_0x159e3d(null);})[_0x2ad0('0xf')](_0x159e3d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x2ad0('0x10')](e,emitEvent(event));}}module[_0x2ad0('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x2c54=['exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1955ba,_0x3cc077){var _0x593a2b=function(_0x593f21){while(--_0x593f21){_0x1955ba['push'](_0x1955ba['shift']());}};_0x593a2b(++_0x3cc077);}(_0x2c54,0xf8));var _0x42c5=function(_0x25858d,_0x5d2b57){_0x25858d=_0x25858d-0x0;var _0x41ef82=_0x2c54[_0x25858d];return _0x41ef82;};'use strict';var EventEmitter=require(_0x42c5('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x42c5('0x1')];var FaxMessage=require(_0x42c5('0x2'))['db'][_0x42c5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x42c5('0x4')](0x0);var events={'afterCreate':_0x42c5('0x5'),'afterUpdate':_0x42c5('0x6'),'afterDestroy':'remove'};function emitEvent(_0xa28e84){return function(_0x5d1465,_0x7fd3df,_0x173c49){_0x5d1465[_0x42c5('0x7')]({'attributes':['id'],'raw':!![]})[_0x42c5('0x8')](function(_0x1a4c15){_0x5d1465[_0x42c5('0x9')](_0x42c5('0xa'),_0x1a4c15[_0x42c5('0xb')](function(_0xd148f9){return{'id':_0xd148f9['id']};}));return FaxMessage[_0x42c5('0xc')]({'where':{'FaxInteractionId':_0x5d1465['id'],'direction':'in','read':![]},'raw':!![]});})[_0x42c5('0x8')](function(_0x1c3023){_0x5d1465[_0x42c5('0x9')](_0x42c5('0xd'),_0x1c3023[_0x42c5('0xe')]);FaxInteractionEvents['emit'](_0xa28e84+':'+_0x5d1465['id'],_0x5d1465);FaxInteractionEvents[_0x42c5('0xf')](_0xa28e84,_0x5d1465);_0x173c49(null);})[_0x42c5('0x10')](_0x173c49(null));};}for(var e in events){if(events[_0x42c5('0x11')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x42c5('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7d7e7f0..1cb5c33 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 _0xae6e=['changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','request-promise','rimraf','FaxInteraction','fax_interactions'];(function(_0x81697e,_0x552c16){var _0x1f6e36=function(_0x2a6bbd){while(--_0x2a6bbd){_0x81697e['push'](_0x81697e['shift']());}};_0x1f6e36(++_0x552c16);}(_0xae6e,0x1e5));var _0xeae6=function(_0x36ef94,_0x1f7567){_0x36ef94=_0x36ef94-0x0;var _0x4c220c=_0xae6e[_0x36ef94];return _0x4c220c;};'use strict';var _=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var logger=require(_0xeae6('0x2'))(_0xeae6('0x3'));var moment=require(_0xeae6('0x4'));var BPromise=require('bluebird');var rp=require(_0xeae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeae6('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x1d06ba,_0x33ea23){return _0x1d06ba['define'](_0xeae6('0x7'),attributes,{'tableName':_0xeae6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59ec94,_0x551f45,_0x26e909){if(_0x59ec94[_0xeae6('0x9')](_0xeae6('0xa'))){_0x59ec94[_0xeae6('0xb')]=moment()[_0xeae6('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26e909(null,_0x59ec94);}}});}; \ No newline at end of file +var _0xb077=['FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxInteraction.attributes','define'];(function(_0x170592,_0x31acc3){var _0x17d43d=function(_0x5dcfdd){while(--_0x5dcfdd){_0x170592['push'](_0x170592['shift']());}};_0x17d43d(++_0x31acc3);}(_0xb077,0x1c6));var _0x7b07=function(_0x4126dc,_0x71bfcb){_0x4126dc=_0x4126dc-0x0;var _0x581fcf=_0xb077[_0x4126dc];return _0x581fcf;};'use strict';var _=require(_0x7b07('0x0'));var util=require(_0x7b07('0x1'));var logger=require(_0x7b07('0x2'))(_0x7b07('0x3'));var moment=require(_0x7b07('0x4'));var BPromise=require(_0x7b07('0x5'));var rp=require(_0x7b07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b07('0x7'));var attributes=require(_0x7b07('0x8'));module['exports']=function(_0x39441d,_0x8a21d9){return _0x39441d[_0x7b07('0x9')](_0x7b07('0xa'),attributes,{'tableName':_0x7b07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57bf92,_0x4c82c5,_0x3f606b){if(_0x57bf92[_0x7b07('0xc')]('closed')){_0x57bf92[_0x7b07('0xd')]=moment()[_0x7b07('0xe')](_0x7b07('0xf'));}_0x3f606b(null,_0x57bf92);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 245e0b1..5bb195a 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 _0x03c0=['request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxInteraction','update','body','options','where','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0x03c0,0x189));var _0x003c=function(_0x1d14c5,_0x185273){_0x1d14c5=_0x1d14c5-0x0;var _0xccb64f=_0x03c0[_0x1d14c5];return _0xccb64f;};'use strict';var _=require(_0x003c('0x0'));var util=require(_0x003c('0x1'));var moment=require(_0x003c('0x2'));var BPromise=require(_0x003c('0x3'));var rs=require(_0x003c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x003c('0x5'))['db'];var utils=require(_0x003c('0x6'));var logger=require('../../config/logger')(_0x003c('0x7'));var config=require('../../config/environment');var jayson=require(_0x003c('0x8'));var client=jayson[_0x003c('0x9')][_0x003c('0xa')]({'port':0x232a});config[_0x003c('0xb')]=_['defaults'](config['redis'],{'host':_0x003c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x003c('0xb')]));require(_0x003c('0xd'))['register'](socket);function respondWithRpcPromise(_0x584894,_0xbfd6eb,_0x441eee){return new BPromise(function(_0x36f4c4,_0x5ac181){return client[_0x003c('0xe')](_0x584894,_0x441eee)[_0x003c('0xf')](function(_0x3d04b2){logger[_0x003c('0x10')](_0x003c('0x11'),_0xbfd6eb,_0x003c('0x12'));logger['debug'](_0x003c('0x13'),_0xbfd6eb,_0x003c('0x12'),JSON[_0x003c('0x14')](_0x3d04b2));if(_0x3d04b2[_0x003c('0x15')]){if(_0x3d04b2[_0x003c('0x15')]['code']===0x1f4){logger[_0x003c('0x15')](_0x003c('0x11'),_0xbfd6eb,_0x3d04b2[_0x003c('0x15')][_0x003c('0x16')]);return _0x5ac181(_0x3d04b2[_0x003c('0x15')][_0x003c('0x16')]);}logger[_0x003c('0x15')](_0x003c('0x11'),_0xbfd6eb,_0x3d04b2[_0x003c('0x15')][_0x003c('0x16')]);return _0x36f4c4(_0x3d04b2[_0x003c('0x15')][_0x003c('0x16')]);}else{logger[_0x003c('0x10')](_0x003c('0x11'),_0xbfd6eb,_0x003c('0x12'));_0x36f4c4(_0x3d04b2[_0x003c('0x17')][_0x003c('0x16')]);}})[_0x003c('0x18')](function(_0x598879){logger[_0x003c('0x15')](_0x003c('0x11'),_0xbfd6eb,_0x598879);_0x5ac181(_0x598879);});});}exports['UpdateFaxInteraction']=function(_0x4a41dc){var _0x26ea00=this;return new Promise(function(_0x384ffe,_0x3c5544){return db[_0x003c('0x19')][_0x003c('0x1a')](_0x4a41dc[_0x003c('0x1b')],{'raw':_0x4a41dc[_0x003c('0x1c')]?_0x4a41dc[_0x003c('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a41dc[_0x003c('0x1c')]?_0x4a41dc[_0x003c('0x1c')][_0x003c('0x1d')]||null:null,'attributes':_0x4a41dc[_0x003c('0x1c')]?_0x4a41dc[_0x003c('0x1c')][_0x003c('0x1e')]||null:null,'limit':_0x4a41dc[_0x003c('0x1c')]?_0x4a41dc[_0x003c('0x1c')]['limit']||null:null})[_0x003c('0xf')](function(_0x12591c){logger[_0x003c('0x10')](_0x003c('0x1f'),_0x4a41dc);logger['debug']('UpdateFaxInteraction',_0x4a41dc,JSON[_0x003c('0x14')](_0x12591c));_0x384ffe(_0x12591c);})[_0x003c('0x18')](function(_0x59740a){logger[_0x003c('0x15')](_0x003c('0x1f'),_0x59740a[_0x003c('0x16')],_0x4a41dc);_0x3c5544(_0x26ea00[_0x003c('0x15')](0x1f4,_0x59740a['message']));});});};exports[_0x003c('0x20')]=function(_0x194253){return new Promise(function(_0xbd9002,_0x5d2ffa){return db[_0x003c('0x19')][_0x003c('0x21')]({'where':_0x194253['options']?_0x194253[_0x003c('0x1c')][_0x003c('0x1d')]||null:null})['then'](function(_0xfadfdb){if(_0xfadfdb){return _0xfadfdb[_0x003c('0x22')](_0x194253[_0x003c('0x1b')]['ids'],_[_0x003c('0x23')](_0x194253[_0x003c('0x1b')],['ids','id'])||{});}})['spread'](function(_0x492e0d){logger['info'](_0x003c('0x24'),_0x194253);logger['debug'](_0x003c('0x24'),_0x194253,JSON[_0x003c('0x14')](_0x492e0d));_0xbd9002(_0x492e0d);})[_0x003c('0x18')](function(_0x576490){logger['error']('AddTags',_0x576490[_0x003c('0x16')],_0x194253);_0x5d2ffa(_this[_0x003c('0x15')](0x1f4,_0x576490[_0x003c('0x16')]));});});}; \ No newline at end of file +var _0x0ab7=['then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateFaxInteraction','FaxInteraction','update','options','where','stringify','catch','AddTagsToFaxInteraction','find','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x416500,_0x4c97c7){var _0x4d37d4=function(_0x6aa19f){while(--_0x6aa19f){_0x416500['push'](_0x416500['shift']());}};_0x4d37d4(++_0x4c97c7);}(_0x0ab7,0x15f));var _0x70ab=function(_0x34b095,_0x39410f){_0x34b095=_0x34b095-0x0;var _0x47877a=_0x0ab7[_0x34b095];return _0x47877a;};'use strict';var _=require(_0x70ab('0x0'));var util=require(_0x70ab('0x1'));var moment=require(_0x70ab('0x2'));var BPromise=require(_0x70ab('0x3'));var rs=require(_0x70ab('0x4'));var fs=require('fs');var Redis=require(_0x70ab('0x5'));var db=require(_0x70ab('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x70ab('0x7'))(_0x70ab('0x8'));var config=require(_0x70ab('0x9'));var jayson=require(_0x70ab('0xa'));var client=jayson[_0x70ab('0xb')][_0x70ab('0xc')]({'port':0x232a});config[_0x70ab('0xd')]=_[_0x70ab('0xe')](config[_0x70ab('0xd')],{'host':_0x70ab('0xf'),'port':0x18eb});var socket=require(_0x70ab('0x10'))(new Redis(config[_0x70ab('0xd')]));require(_0x70ab('0x11'))['register'](socket);function respondWithRpcPromise(_0x3998b2,_0x4304c9,_0xe4dae7){return new BPromise(function(_0x1e7016,_0x5f5a29){return client['request'](_0x3998b2,_0xe4dae7)[_0x70ab('0x12')](function(_0x336a89){logger['info'](_0x70ab('0x13'),_0x4304c9,_0x70ab('0x14'));logger[_0x70ab('0x15')](_0x70ab('0x16'),_0x4304c9,'request\x20sent',JSON['stringify'](_0x336a89));if(_0x336a89['error']){if(_0x336a89[_0x70ab('0x17')][_0x70ab('0x18')]===0x1f4){logger[_0x70ab('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4304c9,_0x336a89[_0x70ab('0x17')][_0x70ab('0x19')]);return _0x5f5a29(_0x336a89['error'][_0x70ab('0x19')]);}logger[_0x70ab('0x17')](_0x70ab('0x13'),_0x4304c9,_0x336a89[_0x70ab('0x17')][_0x70ab('0x19')]);return _0x1e7016(_0x336a89[_0x70ab('0x17')][_0x70ab('0x19')]);}else{logger[_0x70ab('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x4304c9,_0x70ab('0x14'));_0x1e7016(_0x336a89[_0x70ab('0x1b')][_0x70ab('0x19')]);}})['catch'](function(_0xde0532){logger[_0x70ab('0x17')](_0x70ab('0x13'),_0x4304c9,_0xde0532);_0x5f5a29(_0xde0532);});});}exports[_0x70ab('0x1c')]=function(_0x1275d1){var _0x41e2b0=this;return new Promise(function(_0x4739b9,_0x20fba3){return db[_0x70ab('0x1d')][_0x70ab('0x1e')](_0x1275d1['body'],{'raw':_0x1275d1[_0x70ab('0x1f')]?_0x1275d1[_0x70ab('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1275d1[_0x70ab('0x1f')]?_0x1275d1[_0x70ab('0x1f')][_0x70ab('0x20')]||null:null,'attributes':_0x1275d1[_0x70ab('0x1f')]?_0x1275d1['options']['attributes']||null:null,'limit':_0x1275d1[_0x70ab('0x1f')]?_0x1275d1[_0x70ab('0x1f')]['limit']||null:null})[_0x70ab('0x12')](function(_0x292a1e){logger[_0x70ab('0x1a')]('UpdateFaxInteraction',_0x1275d1);logger['debug'](_0x70ab('0x1c'),_0x1275d1,JSON[_0x70ab('0x21')](_0x292a1e));_0x4739b9(_0x292a1e);})[_0x70ab('0x22')](function(_0x5a3627){logger['error'](_0x70ab('0x1c'),_0x5a3627[_0x70ab('0x19')],_0x1275d1);_0x20fba3(_0x41e2b0[_0x70ab('0x17')](0x1f4,_0x5a3627['message']));});});};exports[_0x70ab('0x23')]=function(_0x41d425){return new Promise(function(_0x48ead0,_0x5874b8){return db[_0x70ab('0x1d')][_0x70ab('0x24')]({'where':_0x41d425[_0x70ab('0x1f')]?_0x41d425[_0x70ab('0x1f')][_0x70ab('0x20')]||null:null})[_0x70ab('0x12')](function(_0x566cf0){if(_0x566cf0){return _0x566cf0['addTags'](_0x41d425[_0x70ab('0x25')][_0x70ab('0x26')],_[_0x70ab('0x27')](_0x41d425[_0x70ab('0x25')],[_0x70ab('0x26'),'id'])||{});}})['spread'](function(_0x242718){logger[_0x70ab('0x1a')](_0x70ab('0x28'),_0x41d425);logger[_0x70ab('0x15')]('AddTags',_0x41d425,JSON[_0x70ab('0x21')](_0x242718));_0x48ead0(_0x242718);})[_0x70ab('0x22')](function(_0x48d17d){logger[_0x70ab('0x17')](_0x70ab('0x28'),_0x48d17d['message'],_0x41d425);_0x5874b8(_this[_0x70ab('0x17')](0x1f4,_0x48d17d[_0x70ab('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b7b1820..09d6f4d 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 _0x9e03=['length','save','remove','update','emit','removeListener','register'];(function(_0x43992b,_0x4316d6){var _0x4e6121=function(_0x10bf14){while(--_0x10bf14){_0x43992b['push'](_0x43992b['shift']());}};_0x4e6121(++_0x4316d6);}(_0x9e03,0x1c1));var _0x39e0=function(_0x34c7ea,_0x497219){_0x34c7ea=_0x34c7ea-0x0;var _0x5838a8=_0x9e03[_0x34c7ea];return _0x5838a8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x39e0('0x0'),_0x39e0('0x1'),_0x39e0('0x2')];function createListener(_0x33b3d4,_0x3848b4){return function(_0x4083c8){_0x3848b4[_0x39e0('0x3')](_0x33b3d4,_0x4083c8);};}function removeListener(_0x162ffa,_0x1ab3c9){return function(){FaxInteractionEvents[_0x39e0('0x4')](_0x162ffa,_0x1ab3c9);};}exports[_0x39e0('0x5')]=function(_0x313013){for(var _0x1d97c3=0x0,_0x353400=events[_0x39e0('0x6')];_0x1d97c3<_0x353400;_0x1d97c3++){var _0x46a5c7=events[_0x1d97c3];var _0x16b97d=createListener('faxInteraction:'+_0x46a5c7,_0x313013);FaxInteractionEvents['on'](_0x46a5c7,_0x16b97d);}}; \ No newline at end of file +var _0xc24c=['./faxInteraction.events','save','update','emit','register','length','faxInteraction:'];(function(_0x446eff,_0x4e88e2){var _0x178fcf=function(_0x3c45ed){while(--_0x3c45ed){_0x446eff['push'](_0x446eff['shift']());}};_0x178fcf(++_0x4e88e2);}(_0xc24c,0x111));var _0xcc24=function(_0x381d7b,_0x3ffd33){_0x381d7b=_0x381d7b-0x0;var _0x30f15a=_0xc24c[_0x381d7b];return _0x30f15a;};'use strict';var FaxInteractionEvents=require(_0xcc24('0x0'));var events=[_0xcc24('0x1'),'remove',_0xcc24('0x2')];function createListener(_0x36f791,_0x2bcb7e){return function(_0x66a6af){_0x2bcb7e[_0xcc24('0x3')](_0x36f791,_0x66a6af);};}function removeListener(_0x3a0df5,_0x522872){return function(){FaxInteractionEvents['removeListener'](_0x3a0df5,_0x522872);};}exports[_0xcc24('0x4')]=function(_0x227821){for(var _0x36699c=0x0,_0x583439=events[_0xcc24('0x5')];_0x36699c<_0x583439;_0x36699c++){var _0x96f500=events[_0x36699c];var _0x51104b=createListener(_0xcc24('0x6')+_0x96f500,_0x227821);FaxInteractionEvents['on'](_0x96f500,_0x51104b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0371d4d..5a83f57 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 _0xf026=['faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','fax','faxinteraction:addtags','put','tracked'];(function(_0x4a1a15,_0x1e4a68){var _0x422bcb=function(_0x38b26f){while(--_0x38b26f){_0x4a1a15['push'](_0x4a1a15['shift']());}};_0x422bcb(++_0x1e4a68);}(_0xf026,0x106));var _0x6f02=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xf026[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var path=require('path');var timeout=require(_0x6f02('0x2'));var express=require(_0x6f02('0x3'));var router=express[_0x6f02('0x4')]();var fs_extra=require(_0x6f02('0x5'));var auth=require(_0x6f02('0x6'));var interaction=require(_0x6f02('0x7'));var config=require(_0x6f02('0x8'));var controller=require(_0x6f02('0x9'));router[_0x6f02('0xa')]('/',auth['isAuthenticated'](),controller[_0x6f02('0xb')]);router[_0x6f02('0xa')](_0x6f02('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6f02('0xd'),auth[_0x6f02('0xe')](),controller['show']);router[_0x6f02('0xa')](_0x6f02('0xf'),auth[_0x6f02('0xe')](),controller[_0x6f02('0x10')]);router[_0x6f02('0xa')](_0x6f02('0x11'),auth[_0x6f02('0xe')](),controller[_0x6f02('0x12')]);router[_0x6f02('0x13')]('/',auth[_0x6f02('0xe')](),controller[_0x6f02('0x14')]);router[_0x6f02('0x13')](_0x6f02('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x6f02('0x15'),auth[_0x6f02('0xe')](),interaction['tracked'](_0x6f02('0x16'),_0x6f02('0x17')),controller['addTags']);router[_0x6f02('0x18')](_0x6f02('0xd'),auth['isAuthenticated'](),interaction[_0x6f02('0x19')](_0x6f02('0x16'),_0x6f02('0x1a')),controller[_0x6f02('0x1b')]);router[_0x6f02('0x1c')]('/:id',auth[_0x6f02('0xe')](),interaction[_0x6f02('0x19')](_0x6f02('0x16'),_0x6f02('0x1d')),controller[_0x6f02('0x1e')]);router['delete']('/:id/tags',auth[_0x6f02('0xe')](),controller['removeTags']);module[_0x6f02('0x1f')]=router; \ No newline at end of file +var _0xe38c=['addMessage','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','removeTags','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download'];(function(_0x24a045,_0xd468a7){var _0x4ed2e8=function(_0x2ac114){while(--_0x2ac114){_0x24a045['push'](_0x24a045['shift']());}};_0x4ed2e8(++_0xd468a7);}(_0xe38c,0xbb));var _0xce38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe38c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce38('0x0'));var util=require('util');var path=require(_0xce38('0x1'));var timeout=require(_0xce38('0x2'));var express=require('express');var router=express[_0xce38('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce38('0x5'));var controller=require(_0xce38('0x6'));router[_0xce38('0x7')]('/',auth['isAuthenticated'](),controller[_0xce38('0x8')]);router[_0xce38('0x7')](_0xce38('0x9'),auth['isAuthenticated'](),controller[_0xce38('0xa')]);router[_0xce38('0x7')](_0xce38('0xb'),auth[_0xce38('0xc')](),controller['show']);router[_0xce38('0x7')](_0xce38('0xd'),auth[_0xce38('0xc')](),controller[_0xce38('0xe')]);router['get'](_0xce38('0xf'),auth[_0xce38('0xc')](),controller['download']);router['post']('/',auth[_0xce38('0xc')](),controller['create']);router['post'](_0xce38('0xd'),auth[_0xce38('0xc')](),controller[_0xce38('0x10')]);router[_0xce38('0x11')](_0xce38('0x12'),auth[_0xce38('0xc')](),interaction[_0xce38('0x13')](_0xce38('0x14'),_0xce38('0x15')),controller[_0xce38('0x16')]);router[_0xce38('0x17')](_0xce38('0xb'),auth[_0xce38('0xc')](),interaction['tracked'](_0xce38('0x14'),_0xce38('0x18')),controller[_0xce38('0x19')]);router[_0xce38('0x1a')](_0xce38('0xb'),auth['isAuthenticated'](),interaction[_0xce38('0x13')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0xce38('0x1a')](_0xce38('0x12'),auth[_0xce38('0xc')](),controller[_0xce38('0x1b')]);module[_0xce38('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 57420f4..c9fc911 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 _0x1ef3=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x1410a9,_0x2d4289){var _0x43339d=function(_0x37df0e){while(--_0x37df0e){_0x1410a9['push'](_0x1410a9['shift']());}};_0x43339d(++_0x2d4289);}(_0x1ef3,0x69));var _0x31ef=function(_0x33dd47,_0x460628){_0x33dd47=_0x33dd47-0x0;var _0x79f81=_0x1ef3[_0x33dd47];return _0x79f81;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x31ef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31ef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31ef('0x4')]('in','out'),'defaultValue':_0x31ef('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x31ef('0x6')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9b67=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x43af80,_0x317549){var _0x5b9365=function(_0x3058a0){while(--_0x3058a0){_0x43af80['push'](_0x43af80['shift']());}};_0x5b9365(++_0x317549);}(_0x9b67,0xf6));var _0x79b6=function(_0x4f62fc,_0x236579){_0x4f62fc=_0x4f62fc-0x0;var _0x33fa3e=_0x9b67[_0x4f62fc];return _0x33fa3e;};'use strict';var Sequelize=require(_0x79b6('0x0'));module[_0x79b6('0x1')]={'body':{'type':Sequelize[_0x79b6('0x2')](_0x79b6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x79b6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x79b6('0x5')),'defaultValue':_0x79b6('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'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 3dc8bb2..c0ccee4 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 _0xfd3a=['api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','type','merge','options','includeAll','include','show','params','rawAttributes','keys','find','body','describe','accept','acceptMessage','fax','UserId','agent','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','download','join','server','files','basename','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xfd3a,0x1be));var _0xafd3=function(_0x3db3e0,_0x4b2d35){_0x3db3e0=_0x3db3e0-0x0;var _0x58c1d8=_0xfd3a[_0x3db3e0];return _0x58c1d8;};'use strict';var util=require(_0xafd3('0x0'));var path=require(_0xafd3('0x1'));var _=require('lodash');var Redis=require(_0xafd3('0x2'));var interactionService=require(_0xafd3('0x3'));var qs=require(_0xafd3('0x4'));var logger=require(_0xafd3('0x5'))(_0xafd3('0x6'));var config=require(_0xafd3('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xafd3('0x8')](config[_0xafd3('0x9')],{'host':_0xafd3('0xa'),'port':0x18eb});var socket=require(_0xafd3('0xb'))(new Redis(config[_0xafd3('0x9')]));require(_0xafd3('0xc'))[_0xafd3('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xafd3('0xe')][_0xafd3('0xf')]({'port':0x232a});var interaction_log=require(_0xafd3('0x5'))(_0xafd3('0x10'));function respondWithRpcPromise(_0x3194ea,_0x2026d1,_0x45e54e,_0x277ef0){return new Promise(function(_0x5b84fa,_0x3eb8a8){var _0x2b0c3f=_0x277ef0||client;return _0x2b0c3f[_0xafd3('0x11')](_0x3194ea,_0x45e54e)[_0xafd3('0x12')](function(_0x2af9a5){logger[_0xafd3('0x13')](_0xafd3('0x14'),_0x2026d1,_0xafd3('0x15'));logger[_0xafd3('0x16')](_0xafd3('0x17'),_0x2026d1,_0xafd3('0x15'),JSON[_0xafd3('0x18')](_0x2af9a5));if(_0x2af9a5[_0xafd3('0x19')]){if(_0x2af9a5[_0xafd3('0x19')][_0xafd3('0x1a')]===0x1f4){logger[_0xafd3('0x19')](_0xafd3('0x14'),_0x2026d1,_0x2af9a5[_0xafd3('0x19')][_0xafd3('0x1b')]);return _0x3eb8a8(_0x2af9a5[_0xafd3('0x19')][_0xafd3('0x1b')]);}logger['error'](_0xafd3('0x14'),_0x2026d1,_0x2af9a5[_0xafd3('0x19')][_0xafd3('0x1b')]);return _0x5b84fa(_0x2af9a5[_0xafd3('0x19')][_0xafd3('0x1b')]);}else{logger[_0xafd3('0x13')]('FaxMessage,\x20%s,\x20%s',_0x2026d1,_0xafd3('0x15'));_0x5b84fa(_0x2af9a5[_0xafd3('0x1c')][_0xafd3('0x1b')]);}})[_0xafd3('0x1d')](function(_0x508bc4){logger['error'](_0xafd3('0x14'),_0x2026d1,_0x508bc4);_0x3eb8a8(_0x508bc4);});});}function respondWithResult(_0x39c5cc,_0xf66b70){_0xf66b70=_0xf66b70||0xc8;return function(_0x44d281){if(_0x44d281){return _0x39c5cc[_0xafd3('0x1e')](_0xf66b70)[_0xafd3('0x1f')](_0x44d281);}};}function respondWithFilteredResult(_0x4040c9,_0x3f6bf5){return function(_0x41155c){if(_0x41155c){var _0x2879b5=typeof _0x3f6bf5[_0xafd3('0x20')]===_0xafd3('0x21')&&typeof _0x3f6bf5[_0xafd3('0x22')]==='undefined';var _0x542a8f=_0x41155c['count'];var _0x685567=_0x2879b5?0x0:_0x3f6bf5['offset'];var _0x3c7e09=_0x2879b5?_0x41155c[_0xafd3('0x23')]:_0x3f6bf5[_0xafd3('0x20')]+_0x3f6bf5[_0xafd3('0x22')];var _0x1ba20f;if(_0x3c7e09>=_0x542a8f){_0x3c7e09=_0x542a8f;_0x1ba20f=0xc8;}else{_0x1ba20f=0xce;}_0x4040c9[_0xafd3('0x1e')](_0x1ba20f);return _0x4040c9[_0xafd3('0x24')](_0xafd3('0x25'),_0x685567+'-'+_0x3c7e09+'/'+_0x542a8f)[_0xafd3('0x1f')](_0x41155c);}return null;};}function saveUpdates(_0x1b7eb6){return function(_0x5f0c58){if(_0x5f0c58){return _0x5f0c58[_0xafd3('0x26')](_0x1b7eb6)[_0xafd3('0x12')](function(_0x3b2ae5){return _0x3b2ae5;});}return null;};}function removeEntity(_0x4ca2bb){return function(_0x1885eb){if(_0x1885eb){return _0x1885eb[_0xafd3('0x27')]()[_0xafd3('0x12')](function(){_0x4ca2bb[_0xafd3('0x1e')](0xcc)[_0xafd3('0x28')]();});}};}function handleEntityNotFound(_0x103384){return function(_0x189bbd){if(!_0x189bbd){_0x103384[_0xafd3('0x29')](0x194);}return _0x189bbd;};}function handleError(_0x338298,_0x292378){_0x292378=_0x292378||0x1f4;return function(_0xd9a392){logger[_0xafd3('0x19')](_0xd9a392[_0xafd3('0x2a')]);if(_0xd9a392[_0xafd3('0x2b')]){delete _0xd9a392[_0xafd3('0x2b')];}_0x338298[_0xafd3('0x1e')](_0x292378)[_0xafd3('0x2c')](_0xd9a392);};}exports[_0xafd3('0x2d')]=function(_0x1e88e2,_0x2ae56a){var _0xe583f9={},_0x3b57e7={},_0x2e6cda={'count':0x0,'rows':[]};var _0x3b7673=_[_0xafd3('0x2e')](db[_0xafd3('0x2f')]['rawAttributes'],function(_0xa79c2d){return{'name':_0xa79c2d[_0xafd3('0x30')],'type':_0xa79c2d['type'][_0xafd3('0x31')]};});_0x3b57e7[_0xafd3('0x32')]=_[_0xafd3('0x2e')](_0x3b7673,_0xafd3('0x2b'));_0x3b57e7[_0xafd3('0x33')]=_['keys'](_0x1e88e2[_0xafd3('0x33')]);_0x3b57e7['filters']=_['intersection'](_0x3b57e7[_0xafd3('0x32')],_0x3b57e7['query']);_0xe583f9[_0xafd3('0x34')]=_[_0xafd3('0x35')](_0x3b57e7['model'],qs[_0xafd3('0x36')](_0x1e88e2[_0xafd3('0x33')][_0xafd3('0x36')]));_0xe583f9[_0xafd3('0x34')]=_0xe583f9['attributes'][_0xafd3('0x37')]?_0xe583f9[_0xafd3('0x34')]:_0x3b57e7[_0xafd3('0x32')];if(!_0x1e88e2[_0xafd3('0x33')][_0xafd3('0x38')](_0xafd3('0x39'))){_0xe583f9['limit']=qs[_0xafd3('0x22')](_0x1e88e2[_0xafd3('0x33')][_0xafd3('0x22')]);_0xe583f9[_0xafd3('0x20')]=qs[_0xafd3('0x20')](_0x1e88e2[_0xafd3('0x33')][_0xafd3('0x20')]);}_0xe583f9['order']=qs[_0xafd3('0x3a')](_0x1e88e2[_0xafd3('0x33')][_0xafd3('0x3a')]);_0xe583f9[_0xafd3('0x3b')]=qs[_0xafd3('0x3c')](_['pick'](_0x1e88e2[_0xafd3('0x33')],_0x3b57e7['filters']),_0x3b7673);if(_0x1e88e2[_0xafd3('0x33')]['filter']){_0xe583f9[_0xafd3('0x3b')]=_['merge'](_0xe583f9['where'],{'$or':_['map'](_0x3b7673,function(_0x3966f2){if(_0x3966f2[_0xafd3('0x3d')]!=='VIRTUAL'){var _0x32f792={};_0x32f792[_0x3966f2[_0xafd3('0x2b')]]={'$like':'%'+_0x1e88e2[_0xafd3('0x33')]['filter']+'%'};return _0x32f792;}})});}_0xe583f9=_[_0xafd3('0x3e')]({},_0xe583f9,_0x1e88e2[_0xafd3('0x3f')]);var _0x9eca05={'where':_0xe583f9[_0xafd3('0x3b')]};return db[_0xafd3('0x2f')][_0xafd3('0x23')](_0x9eca05)[_0xafd3('0x12')](function(_0x21aae7){_0x2e6cda['count']=_0x21aae7;if(_0x1e88e2['query'][_0xafd3('0x40')]){_0xe583f9[_0xafd3('0x41')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0xe583f9);})[_0xafd3('0x12')](function(_0x59b172){_0x2e6cda['rows']=_0x59b172;return _0x2e6cda;})[_0xafd3('0x12')](respondWithFilteredResult(_0x2ae56a,_0xe583f9))[_0xafd3('0x1d')](handleError(_0x2ae56a,null));};exports[_0xafd3('0x42')]=function(_0x42c896,_0x1dc999){var _0x14ea8f={'raw':!![],'where':{'id':_0x42c896[_0xafd3('0x43')]['id']}},_0x36f7a2={};_0x36f7a2[_0xafd3('0x32')]=_['keys'](db['FaxMessage'][_0xafd3('0x44')]);_0x36f7a2[_0xafd3('0x33')]=_[_0xafd3('0x45')](_0x42c896[_0xafd3('0x33')]);_0x36f7a2[_0xafd3('0x3c')]=_['intersection'](_0x36f7a2['model'],_0x36f7a2[_0xafd3('0x33')]);_0x14ea8f[_0xafd3('0x34')]=_['intersection'](_0x36f7a2[_0xafd3('0x32')],qs[_0xafd3('0x36')](_0x42c896[_0xafd3('0x33')][_0xafd3('0x36')]));_0x14ea8f[_0xafd3('0x34')]=_0x14ea8f['attributes'][_0xafd3('0x37')]?_0x14ea8f[_0xafd3('0x34')]:_0x36f7a2['model'];if(_0x42c896[_0xafd3('0x33')][_0xafd3('0x40')]){_0x14ea8f['include']=[{'all':!![]}];}_0x14ea8f=_[_0xafd3('0x3e')]({},_0x14ea8f,_0x42c896[_0xafd3('0x3f')]);return db[_0xafd3('0x2f')][_0xafd3('0x46')](_0x14ea8f)[_0xafd3('0x12')](handleEntityNotFound(_0x1dc999,null))[_0xafd3('0x12')](respondWithResult(_0x1dc999,null))[_0xafd3('0x1d')](handleError(_0x1dc999,null));};exports['update']=function(_0x4801f0,_0x5d6173){if(_0x4801f0[_0xafd3('0x47')]['id']){delete _0x4801f0[_0xafd3('0x47')]['id'];}return db[_0xafd3('0x2f')][_0xafd3('0x46')]({'where':{'id':_0x4801f0[_0xafd3('0x43')]['id']}})[_0xafd3('0x12')](handleEntityNotFound(_0x5d6173,null))[_0xafd3('0x12')](saveUpdates(_0x4801f0['body'],null))['then'](respondWithResult(_0x5d6173,null))[_0xafd3('0x1d')](handleError(_0x5d6173,null));};exports['destroy']=function(_0x1dca75,_0x2a4da2){return db[_0xafd3('0x2f')][_0xafd3('0x46')]({'where':{'id':_0x1dca75[_0xafd3('0x43')]['id']}})[_0xafd3('0x12')](handleEntityNotFound(_0x2a4da2,null))[_0xafd3('0x12')](removeEntity(_0x2a4da2,null))[_0xafd3('0x1d')](handleError(_0x2a4da2,null));};exports[_0xafd3('0x48')]=function(_0x177bac,_0x234e3a){return db['FaxMessage'][_0xafd3('0x48')]()[_0xafd3('0x12')](respondWithResult(_0x234e3a,null))[_0xafd3('0x1d')](handleError(_0x234e3a,null));};exports[_0xafd3('0x49')]=function(_0x388b06,_0x40cc1b){var _0x47d528='sms';return interactionService[_0xafd3('0x4a')](_0x388b06,_0x47d528)['then'](respondWithResult(_0x40cc1b,null))[_0xafd3('0x1d')](handleError(_0x40cc1b,null));};exports[_0xafd3('0x49')]=function(_0x5a10aa,_0x177055){var _0x442d23=_0xafd3('0x4b');return interactionService['acceptMessage'](_0x5a10aa,_0x442d23)[_0xafd3('0x12')](respondWithResult(_0x177055,null))[_0xafd3('0x1d')](handleError(_0x177055,null));};exports['reject']=function(_0x221d3d,_0x4797e3){var _0x123f4e={'agent':{},'channel':_0xafd3('0x4b')};if(_0x221d3d[_0xafd3('0x47')]['id']){delete _0x221d3d[_0xafd3('0x47')]['id'];}_0x221d3d['body']['UserId']=_0x221d3d['body'][_0xafd3('0x4c')]||_0x221d3d['user']['id'];_0x123f4e[_0xafd3('0x4d')]['id']=_0x221d3d[_0xafd3('0x47')][_0xafd3('0x4c')];return db[_0xafd3('0x2f')][_0xafd3('0x46')]({'where':{'id':_0x221d3d['params']['id'],'UserId':null}})[_0xafd3('0x12')](handleEntityNotFound(_0x4797e3,null))[_0xafd3('0x12')](function(_0x1e88df){if(_0x1e88df){_0x123f4e['message']=_0x1e88df['get']({'plain':!![]});return db['FaxInteraction'][_0xafd3('0x46')]({'where':{'id':_0x1e88df['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4797e3,null))['then'](function(_0x1ce63e){if(_0x1ce63e){_0x123f4e['interaction']=_0x1ce63e[_0xafd3('0x4e')]({'plain':!![]});interaction_log[_0xafd3('0x13')](_0xafd3('0x4f'),_0x221d3d['user']['id'],_0x221d3d[_0xafd3('0x50')][_0xafd3('0x2b')],_0x221d3d[_0xafd3('0x50')][_0xafd3('0x51')],_0x123f4e[_0xafd3('0x52')]['id'],_0x221d3d[_0xafd3('0x47')]?JSON[_0xafd3('0x18')](_0x221d3d[_0xafd3('0x47')]):_0xafd3('0x53'));return respondWithRpcPromise(_0xafd3('0x54'),'rejectMessage',_0x123f4e);}return null;})[_0xafd3('0x12')](function(_0x514328){var _0x204d4d=_0xafd3('0x55')+_0x514328[_0xafd3('0x1b')][_0xafd3('0x56')];return db[_0xafd3('0x57')][_0xafd3('0x33')](_0x204d4d,{'type':db[_0xafd3('0x58')][_0xafd3('0x59')][_0xafd3('0x5a')],'raw':!![]})['then'](function(_0x4263f1){return _0x4263f1;});})['then'](function(_0x1bc383){if(_0x1bc383){_0x123f4e[_0xafd3('0x1b')][_0xafd3('0x5b')]=_0x1bc383[0x0];if(!_0x221d3d[_0xafd3('0x47')]['UserId'])return;return db[_0xafd3('0x5c')]['find']({'where':{'id':_0x221d3d[_0xafd3('0x47')][_0xafd3('0x4c')],'role':'agent'},'attributes':['id',_0xafd3('0x2b'),_0xafd3('0x5d'),'email',_0xafd3('0x5e')],'raw':!![]});}return null;})[_0xafd3('0x12')](function(_0x57b5d7){if(!_0x57b5d7)return null;_0x123f4e['message']['agent']=_0x57b5d7;return _0x123f4e;})['then'](function(_0x5caf5b){if(_0x5caf5b){_0x5caf5b[_0xafd3('0x1b')]['interface']=util[_0xafd3('0x5f')](_0xafd3('0x60'),_0x221d3d[_0xafd3('0x50')][_0xafd3('0x2b')]);_0x5caf5b[_0xafd3('0x1b')][_0xafd3('0x61')]=_0x123f4e[_0xafd3('0x61')];_0x5caf5b[_0xafd3('0x1b')][_0xafd3('0x62')]=_0x123f4e['channel'];_0x5caf5b[_0xafd3('0x1b')][_0xafd3('0x63')]='reject';respondWithRpcPromise(_0xafd3('0x64'),_0xafd3('0x64'),{'event':_0xafd3('0x65'),'message':_0x5caf5b[_0xafd3('0x1b')]},client9002);return _0x123f4e;}return null;})[_0xafd3('0x12')](respondWithResult(_0x4797e3,null))[_0xafd3('0x1d')](handleError(_0x4797e3,null));};exports[_0xafd3('0x66')]=function(_0x54d7bc,_0x56c0d6){var _0x28902d;return db['FaxMessage'][_0xafd3('0x66')](_0x54d7bc['body'],{})[_0xafd3('0x12')](function(_0x2f94cf){_0x28902d=_0x2f94cf;return db['CmContact'][_0xafd3('0x67')]({'where':{'id':_0x28902d[_0xafd3('0x56')]}});})[_0xafd3('0x12')](function(_0x135276){if(_[_0xafd3('0x68')](_0x135276)){return;}else{_0x28902d['fax']=_0x135276[_0xafd3('0x4b')];return db[_0xafd3('0x69')][_0xafd3('0x67')]({'where':{'id':_0x28902d[_0xafd3('0x6a')]}});}})['then'](function(_0x1cdb50){return respondWithRpcPromise('SendFax',_0xafd3('0x6b'),{'FaxAccountId':_[_0xafd3('0x68')](_0x54d7bc[_0xafd3('0x47')])?undefined:_0x54d7bc['body']['FaxAccountId'],'path':_['isNil'](_0x1cdb50)?undefined:util[_0xafd3('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x1cdb50['basename']),'fax':_[_0xafd3('0x68')](_0x28902d['fax'])?undefined:_0x28902d[_0xafd3('0x4b')],'AttachmentId':_0x28902d[_0xafd3('0x6a')]},client9002);})['then'](respondWithResult(_0x56c0d6,0xc9))[_0xafd3('0x1d')](handleError(_0x56c0d6,null));};exports[_0xafd3('0x6c')]=function(_0x51596b,_0x5e4327){var _0x339c2e=path[_0xafd3('0x6d')](config['root'],_0xafd3('0x6e'),_0xafd3('0x6f'),'attachments');return db[_0xafd3('0x2f')][_0xafd3('0x46')]({'where':{'id':_0x51596b[_0xafd3('0x43')]['id']},'include':[{'model':db[_0xafd3('0x69')],'as':_0xafd3('0x69')}]})[_0xafd3('0x12')](handleEntityNotFound(_0x5e4327,null))[_0xafd3('0x12')](function(_0x2ded57){if(_0x2ded57){return _0x5e4327[_0xafd3('0x6c')](path[_0xafd3('0x6d')](_0x339c2e,_0x2ded57[_0xafd3('0x69')][_0xafd3('0x70')]));}})['catch'](handleError(_0x5e4327,null));}; \ No newline at end of file +var _0xa27b=['contact','User','agent','fullname','email','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','ContactId','isNil','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','attachments','join','path','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','../../config/logger','fax-interactions','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','destroy','describe','sms','fax','acceptMessage','reject','UserId','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT'];(function(_0x2275b2,_0x118d54){var _0x7323e9=function(_0x3a7365){while(--_0x3a7365){_0x2275b2['push'](_0x2275b2['shift']());}};_0x7323e9(++_0x118d54);}(_0xa27b,0x181));var _0xba27=function(_0xb6500f,_0x5e8e6f){_0xb6500f=_0xb6500f-0x0;var _0x2b159b=_0xa27b[_0xb6500f];return _0x2b159b;};'use strict';var util=require('util');var path=require(_0xba27('0x0'));var _=require(_0xba27('0x1'));var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require(_0xba27('0x2'));var logger=require('../../config/logger')(_0xba27('0x3'));var config=require(_0xba27('0x4'));var db=require('../../mysqldb')['db'];config[_0xba27('0x5')]=_[_0xba27('0x6')](config['redis'],{'host':_0xba27('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba27('0x5')]));require(_0xba27('0x8'))[_0xba27('0x9')](socket);var jayson=require(_0xba27('0xa'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xba27('0xb')][_0xba27('0xc')]({'port':0x232a});var interaction_log=require(_0xba27('0xd'))(_0xba27('0xe'));function respondWithRpcPromise(_0x3b0772,_0x269b52,_0x10baf5,_0x241458){return new Promise(function(_0x97388b,_0x15392b){var _0xc4b36f=_0x241458||client;return _0xc4b36f['request'](_0x3b0772,_0x10baf5)[_0xba27('0xf')](function(_0x5bcc5c){logger['info'](_0xba27('0x10'),_0x269b52,_0xba27('0x11'));logger[_0xba27('0x12')](_0xba27('0x13'),_0x269b52,_0xba27('0x11'),JSON['stringify'](_0x5bcc5c));if(_0x5bcc5c[_0xba27('0x14')]){if(_0x5bcc5c[_0xba27('0x14')][_0xba27('0x15')]===0x1f4){logger[_0xba27('0x14')](_0xba27('0x10'),_0x269b52,_0x5bcc5c['error'][_0xba27('0x16')]);return _0x15392b(_0x5bcc5c[_0xba27('0x14')]['message']);}logger[_0xba27('0x14')]('FaxMessage,\x20%s,\x20%s',_0x269b52,_0x5bcc5c['error'][_0xba27('0x16')]);return _0x97388b(_0x5bcc5c[_0xba27('0x14')][_0xba27('0x16')]);}else{logger[_0xba27('0x17')](_0xba27('0x10'),_0x269b52,'request\x20sent');_0x97388b(_0x5bcc5c['result'][_0xba27('0x16')]);}})[_0xba27('0x18')](function(_0x327ddf){logger[_0xba27('0x14')](_0xba27('0x10'),_0x269b52,_0x327ddf);_0x15392b(_0x327ddf);});});}function respondWithResult(_0x581c5f,_0x4e9ad5){_0x4e9ad5=_0x4e9ad5||0xc8;return function(_0xa45a71){if(_0xa45a71){return _0x581c5f[_0xba27('0x19')](_0x4e9ad5)[_0xba27('0x1a')](_0xa45a71);}};}function respondWithFilteredResult(_0x1a7018,_0x5b2d35){return function(_0x3379d6){if(_0x3379d6){var _0x4e63e9=typeof _0x5b2d35[_0xba27('0x1b')]===_0xba27('0x1c')&&typeof _0x5b2d35[_0xba27('0x1d')]===_0xba27('0x1c');var _0x3e4169=_0x3379d6['count'];var _0x586064=_0x4e63e9?0x0:_0x5b2d35[_0xba27('0x1b')];var _0x1a189e=_0x4e63e9?_0x3379d6[_0xba27('0x1e')]:_0x5b2d35[_0xba27('0x1b')]+_0x5b2d35[_0xba27('0x1d')];var _0xeb3a44;if(_0x1a189e>=_0x3e4169){_0x1a189e=_0x3e4169;_0xeb3a44=0xc8;}else{_0xeb3a44=0xce;}_0x1a7018['status'](_0xeb3a44);return _0x1a7018[_0xba27('0x1f')](_0xba27('0x20'),_0x586064+'-'+_0x1a189e+'/'+_0x3e4169)[_0xba27('0x1a')](_0x3379d6);}return null;};}function saveUpdates(_0x4ee2de){return function(_0x262b0b){if(_0x262b0b){return _0x262b0b[_0xba27('0x21')](_0x4ee2de)['then'](function(_0x40fdb7){return _0x40fdb7;});}return null;};}function removeEntity(_0x3665db){return function(_0x1b505c){if(_0x1b505c){return _0x1b505c['destroy']()[_0xba27('0xf')](function(){_0x3665db[_0xba27('0x19')](0xcc)[_0xba27('0x22')]();});}};}function handleEntityNotFound(_0xb787d2){return function(_0x21ec8b){if(!_0x21ec8b){_0xb787d2[_0xba27('0x23')](0x194);}return _0x21ec8b;};}function handleError(_0x9cd1eb,_0x58e90b){_0x58e90b=_0x58e90b||0x1f4;return function(_0xfeb702){logger['error'](_0xfeb702[_0xba27('0x24')]);if(_0xfeb702[_0xba27('0x25')]){delete _0xfeb702[_0xba27('0x25')];}_0x9cd1eb[_0xba27('0x19')](_0x58e90b)[_0xba27('0x26')](_0xfeb702);};}exports['index']=function(_0x3aa1cc,_0xafb976){var _0x797959={},_0x1e70ed={},_0x1f02cd={'count':0x0,'rows':[]};var _0x4f936e=_[_0xba27('0x27')](db[_0xba27('0x28')][_0xba27('0x29')],function(_0x371962){return{'name':_0x371962[_0xba27('0x2a')],'type':_0x371962['type'][_0xba27('0x2b')]};});_0x1e70ed[_0xba27('0x2c')]=_['map'](_0x4f936e,_0xba27('0x25'));_0x1e70ed[_0xba27('0x2d')]=_[_0xba27('0x2e')](_0x3aa1cc[_0xba27('0x2d')]);_0x1e70ed['filters']=_[_0xba27('0x2f')](_0x1e70ed[_0xba27('0x2c')],_0x1e70ed[_0xba27('0x2d')]);_0x797959[_0xba27('0x30')]=_['intersection'](_0x1e70ed['model'],qs[_0xba27('0x31')](_0x3aa1cc['query'][_0xba27('0x31')]));_0x797959[_0xba27('0x30')]=_0x797959[_0xba27('0x30')][_0xba27('0x32')]?_0x797959[_0xba27('0x30')]:_0x1e70ed[_0xba27('0x2c')];if(!_0x3aa1cc['query'][_0xba27('0x33')]('nolimit')){_0x797959[_0xba27('0x1d')]=qs[_0xba27('0x1d')](_0x3aa1cc[_0xba27('0x2d')][_0xba27('0x1d')]);_0x797959[_0xba27('0x1b')]=qs['offset'](_0x3aa1cc['query']['offset']);}_0x797959['order']=qs[_0xba27('0x34')](_0x3aa1cc[_0xba27('0x2d')]['sort']);_0x797959[_0xba27('0x35')]=qs[_0xba27('0x36')](_[_0xba27('0x37')](_0x3aa1cc[_0xba27('0x2d')],_0x1e70ed[_0xba27('0x36')]),_0x4f936e);if(_0x3aa1cc[_0xba27('0x2d')][_0xba27('0x38')]){_0x797959[_0xba27('0x35')]=_['merge'](_0x797959[_0xba27('0x35')],{'$or':_['map'](_0x4f936e,function(_0x544506){if(_0x544506[_0xba27('0x39')]!==_0xba27('0x3a')){var _0x2e4568={};_0x2e4568[_0x544506[_0xba27('0x25')]]={'$like':'%'+_0x3aa1cc['query'][_0xba27('0x38')]+'%'};return _0x2e4568;}})});}_0x797959=_[_0xba27('0x3b')]({},_0x797959,_0x3aa1cc[_0xba27('0x3c')]);var _0x2af541={'where':_0x797959['where']};return db[_0xba27('0x28')][_0xba27('0x1e')](_0x2af541)[_0xba27('0xf')](function(_0x1e629b){_0x1f02cd['count']=_0x1e629b;if(_0x3aa1cc[_0xba27('0x2d')][_0xba27('0x3d')]){_0x797959[_0xba27('0x3e')]=[{'all':!![]}];}return db['FaxMessage'][_0xba27('0x3f')](_0x797959);})['then'](function(_0x5dc317){_0x1f02cd[_0xba27('0x40')]=_0x5dc317;return _0x1f02cd;})[_0xba27('0xf')](respondWithFilteredResult(_0xafb976,_0x797959))['catch'](handleError(_0xafb976,null));};exports[_0xba27('0x41')]=function(_0x4ea95c,_0x4994fe){var _0x3a37a7={'raw':!![],'where':{'id':_0x4ea95c[_0xba27('0x42')]['id']}},_0x20a753={};_0x20a753[_0xba27('0x2c')]=_['keys'](db['FaxMessage'][_0xba27('0x29')]);_0x20a753[_0xba27('0x2d')]=_[_0xba27('0x2e')](_0x4ea95c[_0xba27('0x2d')]);_0x20a753[_0xba27('0x36')]=_['intersection'](_0x20a753[_0xba27('0x2c')],_0x20a753['query']);_0x3a37a7['attributes']=_[_0xba27('0x2f')](_0x20a753[_0xba27('0x2c')],qs[_0xba27('0x31')](_0x4ea95c[_0xba27('0x2d')][_0xba27('0x31')]));_0x3a37a7[_0xba27('0x30')]=_0x3a37a7[_0xba27('0x30')][_0xba27('0x32')]?_0x3a37a7[_0xba27('0x30')]:_0x20a753[_0xba27('0x2c')];if(_0x4ea95c['query'][_0xba27('0x3d')]){_0x3a37a7['include']=[{'all':!![]}];}_0x3a37a7=_[_0xba27('0x3b')]({},_0x3a37a7,_0x4ea95c[_0xba27('0x3c')]);return db[_0xba27('0x28')][_0xba27('0x43')](_0x3a37a7)['then'](handleEntityNotFound(_0x4994fe,null))[_0xba27('0xf')](respondWithResult(_0x4994fe,null))['catch'](handleError(_0x4994fe,null));};exports[_0xba27('0x21')]=function(_0x25690f,_0x5a734d){if(_0x25690f['body']['id']){delete _0x25690f[_0xba27('0x44')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x25690f[_0xba27('0x42')]['id']}})[_0xba27('0xf')](handleEntityNotFound(_0x5a734d,null))[_0xba27('0xf')](saveUpdates(_0x25690f[_0xba27('0x44')],null))[_0xba27('0xf')](respondWithResult(_0x5a734d,null))[_0xba27('0x18')](handleError(_0x5a734d,null));};exports[_0xba27('0x45')]=function(_0x567360,_0x172596){return db['FaxMessage'][_0xba27('0x43')]({'where':{'id':_0x567360[_0xba27('0x42')]['id']}})[_0xba27('0xf')](handleEntityNotFound(_0x172596,null))[_0xba27('0xf')](removeEntity(_0x172596,null))[_0xba27('0x18')](handleError(_0x172596,null));};exports[_0xba27('0x46')]=function(_0x428f22,_0x563f4d){return db[_0xba27('0x28')][_0xba27('0x46')]()[_0xba27('0xf')](respondWithResult(_0x563f4d,null))[_0xba27('0x18')](handleError(_0x563f4d,null));};exports['accept']=function(_0x693bf3,_0x39fa5b){var _0x293e05=_0xba27('0x47');return interactionService['acceptMessage'](_0x693bf3,_0x293e05)['then'](respondWithResult(_0x39fa5b,null))[_0xba27('0x18')](handleError(_0x39fa5b,null));};exports['accept']=function(_0x48d04e,_0x240f80){var _0x3b4b5f=_0xba27('0x48');return interactionService[_0xba27('0x49')](_0x48d04e,_0x3b4b5f)[_0xba27('0xf')](respondWithResult(_0x240f80,null))[_0xba27('0x18')](handleError(_0x240f80,null));};exports[_0xba27('0x4a')]=function(_0x289005,_0x199920){var _0x5ba54e={'agent':{},'channel':_0xba27('0x48')};if(_0x289005['body']['id']){delete _0x289005['body']['id'];}_0x289005['body'][_0xba27('0x4b')]=_0x289005[_0xba27('0x44')][_0xba27('0x4b')]||_0x289005['user']['id'];_0x5ba54e['agent']['id']=_0x289005[_0xba27('0x44')][_0xba27('0x4b')];return db[_0xba27('0x28')][_0xba27('0x43')]({'where':{'id':_0x289005[_0xba27('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x199920,null))['then'](function(_0x3e551a){if(_0x3e551a){_0x5ba54e['message']=_0x3e551a[_0xba27('0x4c')]({'plain':!![]});return db[_0xba27('0x4d')][_0xba27('0x43')]({'where':{'id':_0x3e551a[_0xba27('0x4e')]}});}return null;})[_0xba27('0xf')](handleEntityNotFound(_0x199920,null))[_0xba27('0xf')](function(_0x32d318){if(_0x32d318){_0x5ba54e[_0xba27('0x4f')]=_0x32d318[_0xba27('0x4c')]({'plain':!![]});interaction_log[_0xba27('0x17')](_0xba27('0x50'),_0x289005[_0xba27('0x51')]['id'],_0x289005['user'][_0xba27('0x25')],_0x289005[_0xba27('0x51')][_0xba27('0x52')],_0x5ba54e[_0xba27('0x4f')]['id'],_0x289005[_0xba27('0x44')]?JSON[_0xba27('0x53')](_0x289005[_0xba27('0x44')]):_0xba27('0x54'));return respondWithRpcPromise(_0xba27('0x55'),_0xba27('0x56'),_0x5ba54e);}return null;})[_0xba27('0xf')](function(_0x293adc){var _0x23798b=_0xba27('0x57')+_0x293adc['message']['ContactId'];return db[_0xba27('0x58')][_0xba27('0x2d')](_0x23798b,{'type':db['Sequelize'][_0xba27('0x59')][_0xba27('0x5a')],'raw':!![]})[_0xba27('0xf')](function(_0x51acaf){return _0x51acaf;});})[_0xba27('0xf')](function(_0x228abb){if(_0x228abb){_0x5ba54e['message'][_0xba27('0x5b')]=_0x228abb[0x0];if(!_0x289005[_0xba27('0x44')]['UserId'])return;return db[_0xba27('0x5c')]['find']({'where':{'id':_0x289005['body'][_0xba27('0x4b')],'role':_0xba27('0x5d')},'attributes':['id','name',_0xba27('0x5e'),_0xba27('0x5f'),_0xba27('0x60')],'raw':!![]});}return null;})[_0xba27('0xf')](function(_0x482981){if(!_0x482981)return null;_0x5ba54e[_0xba27('0x16')][_0xba27('0x5d')]=_0x482981;return _0x5ba54e;})['then'](function(_0x1cff86){if(_0x1cff86){_0x1cff86[_0xba27('0x16')]['interface']=util[_0xba27('0x61')](_0xba27('0x62'),_0x289005[_0xba27('0x51')][_0xba27('0x25')]);_0x1cff86[_0xba27('0x16')][_0xba27('0x63')]=_0x5ba54e[_0xba27('0x63')];_0x1cff86['message'][_0xba27('0x64')]=_0x5ba54e[_0xba27('0x63')];_0x1cff86[_0xba27('0x16')][_0xba27('0x65')]=_0xba27('0x4a');respondWithRpcPromise(_0xba27('0x66'),_0xba27('0x66'),{'event':_0xba27('0x67'),'message':_0x1cff86[_0xba27('0x16')]},client9002);return _0x5ba54e;}return null;})['then'](respondWithResult(_0x199920,null))[_0xba27('0x18')](handleError(_0x199920,null));};exports[_0xba27('0x68')]=function(_0x517969,_0x49ecbd){var _0x5586c4;return db['FaxMessage']['create'](_0x517969[_0xba27('0x44')],{})[_0xba27('0xf')](function(_0x32d5e3){_0x5586c4=_0x32d5e3;return db[_0xba27('0x69')]['findOne']({'where':{'id':_0x5586c4[_0xba27('0x6a')]}});})['then'](function(_0x260dab){if(_[_0xba27('0x6b')](_0x260dab)){return;}else{_0x5586c4[_0xba27('0x48')]=_0x260dab['fax'];return db[_0xba27('0x6c')][_0xba27('0x6d')]({'where':{'id':_0x5586c4['AttachmentId']}});}})['then'](function(_0x4713ac){return respondWithRpcPromise(_0xba27('0x6e'),_0xba27('0x6e'),{'FaxAccountId':_[_0xba27('0x6b')](_0x517969['body'])?undefined:_0x517969[_0xba27('0x44')][_0xba27('0x6f')],'path':_[_0xba27('0x6b')](_0x4713ac)?undefined:util[_0xba27('0x61')](_0xba27('0x70'),_0x4713ac[_0xba27('0x71')]),'fax':_[_0xba27('0x6b')](_0x5586c4['fax'])?undefined:_0x5586c4[_0xba27('0x48')],'AttachmentId':_0x5586c4[_0xba27('0x72')]},client9002);})['then'](respondWithResult(_0x49ecbd,0xc9))[_0xba27('0x18')](handleError(_0x49ecbd,null));};exports[_0xba27('0x73')]=function(_0x8470d5,_0x1ddf14){var _0x6d0530=path['join'](config[_0xba27('0x74')],'server','files',_0xba27('0x75'));return db[_0xba27('0x28')][_0xba27('0x43')]({'where':{'id':_0x8470d5[_0xba27('0x42')]['id']},'include':[{'model':db[_0xba27('0x6c')],'as':_0xba27('0x6c')}]})[_0xba27('0xf')](handleEntityNotFound(_0x1ddf14,null))['then'](function(_0x9e8cc){if(_0x9e8cc){return _0x1ddf14['download'](path[_0xba27('0x76')](_0x6d0530,_0x9e8cc[_0xba27('0x6c')][_0xba27('0x71')]));}})[_0xba27('0x18')](handleError(_0x1ddf14,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e49e233..50e84d4 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 _0xfc4f=['save','update','remove','emit','hook','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0xfc4f,0x192));var _0xffc4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc4f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xffc4('0x0'))['db'][_0xffc4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xffc4('0x2')](0x0);var events={'afterCreate':_0xffc4('0x3'),'afterUpdate':_0xffc4('0x4'),'afterDestroy':_0xffc4('0x5')};function emitEvent(_0x27bcf3){return function(_0x5943be,_0x289659,_0x211cfa){FaxMessageEvents[_0xffc4('0x6')](_0x27bcf3+':'+_0x5943be['id'],_0x5943be);FaxMessageEvents[_0xffc4('0x6')](_0x27bcf3,_0x5943be);_0x211cfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xffc4('0x7')](e,emitEvent(event));}}module[_0xffc4('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x24bb=['exports','events','FaxMessage','save','update','emit'];(function(_0x3152c4,_0x5f37f7){var _0x5cfd6b=function(_0x1e4ca2){while(--_0x1e4ca2){_0x3152c4['push'](_0x3152c4['shift']());}};_0x5cfd6b(++_0x5f37f7);}(_0x24bb,0x19f));var _0xb24b=function(_0x1ba727,_0x4cc4d9){_0x1ba727=_0x1ba727-0x0;var _0x30e9c4=_0x24bb[_0x1ba727];return _0x30e9c4;};'use strict';var EventEmitter=require(_0xb24b('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xb24b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb24b('0x2'),'afterUpdate':_0xb24b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x264025){return function(_0x48ff68,_0x52eba3,_0x2af39f){FaxMessageEvents[_0xb24b('0x4')](_0x264025+':'+_0x48ff68['id'],_0x48ff68);FaxMessageEvents[_0xb24b('0x4')](_0x264025,_0x48ff68);_0x2af39f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xb24b('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 2be90ff..ff0a45f 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 _0x0866=['fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x493d9e,_0x257b15){var _0x5672d5=function(_0xffac9e){while(--_0xffac9e){_0x493d9e['push'](_0x493d9e['shift']());}};_0x5672d5(++_0x257b15);}(_0x0866,0x197));var _0x6086=function(_0x389875,_0x52d959){_0x389875=_0x389875-0x0;var _0x43e69e=_0x0866[_0x389875];return _0x43e69e;};'use strict';var _=require(_0x6086('0x0'));var util=require(_0x6086('0x1'));var logger=require(_0x6086('0x2'))(_0x6086('0x3'));var moment=require(_0x6086('0x4'));var BPromise=require(_0x6086('0x5'));var rp=require(_0x6086('0x6'));var fs=require('fs');var path=require(_0x6086('0x7'));var rimraf=require('rimraf');var config=require(_0x6086('0x8'));var attributes=require(_0x6086('0x9'));module[_0x6086('0xa')]=function(_0x4c3b24,_0x58bd0a){return _0x4c3b24[_0x6086('0xb')](_0x6086('0xc'),attributes,{'tableName':_0x6086('0xd'),'paranoid':![],'indexes':[{'name':_0x6086('0xe'),'fields':['body'],'type':_0x6086('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a1b94,_0x582e77,_0x5fa4ce){var _0x279b94=_0x4c3b24[_0x6086('0x10')];var _0x474d7e=_0x4a1b94['get']({'plain':!![]});if(_0x474d7e[_0x6086('0x11')][_0x6086('0x12')]()==='in'||_0x474d7e['direction'][_0x6086('0x12')]()===_0x6086('0x13')&&!_0x474d7e[_0x6086('0x14')]&&!_[_0x6086('0x15')](_0x474d7e[_0x6086('0x16')])){_0x279b94['FaxInteraction'][_0x6086('0x17')]({'where':{'id':_0x474d7e[_0x6086('0x18')]}})['then'](function(_0x729ad){if(_0x729ad){_0x729ad['update']({'lastMsgAt':_0x474d7e[_0x6086('0x19')],'lastMsgDirection':_0x474d7e['direction'][_0x6086('0x12')]()});}})[_0x6086('0x1a')](function(_0xfb69c5){console[_0x6086('0x1b')](_0xfb69c5);});}_0x5fa4ce();}},'charset':_0x6086('0x1c'),'collate':_0x6086('0x1d')});}; \ No newline at end of file +var _0x1b23=['fti_fax_messages','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','update','createdAt','catch','lodash','util','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x54a099,_0x55a7c8){var _0x484012=function(_0x5f3435){while(--_0x5f3435){_0x54a099['push'](_0x54a099['shift']());}};_0x484012(++_0x55a7c8);}(_0x1b23,0x1ed));var _0x31b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x31b2('0x0'));var util=require(_0x31b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31b2('0x2'));var BPromise=require(_0x31b2('0x3'));var rp=require(_0x31b2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31b2('0x5'));var attributes=require(_0x31b2('0x6'));module[_0x31b2('0x7')]=function(_0xe1411d,_0x48b318){return _0xe1411d[_0x31b2('0x8')](_0x31b2('0x9'),attributes,{'tableName':_0x31b2('0xa'),'paranoid':![],'indexes':[{'name':_0x31b2('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17e114,_0x5399de,_0x25895f){var _0xdb4d2f=_0xe1411d[_0x31b2('0xc')];var _0x464c63=_0x17e114[_0x31b2('0xd')]({'plain':!![]});if(_0x464c63[_0x31b2('0xe')][_0x31b2('0xf')]()==='in'||_0x464c63[_0x31b2('0xe')][_0x31b2('0xf')]()===_0x31b2('0x10')&&!_0x464c63[_0x31b2('0x11')]&&!_['isNil'](_0x464c63[_0x31b2('0x12')])){_0xdb4d2f[_0x31b2('0x13')][_0x31b2('0x14')]({'where':{'id':_0x464c63['FaxInteractionId']}})['then'](function(_0x329a81){if(_0x329a81){_0x329a81[_0x31b2('0x15')]({'lastMsgAt':_0x464c63[_0x31b2('0x16')],'lastMsgDirection':_0x464c63['direction'][_0x31b2('0xf')]()});}})[_0x31b2('0x17')](function(_0x572906){console['error'](_0x572906);});}_0x25895f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e0e73a9..84b8cfb 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x1df0ea,_0x2bcf5a){var _0x4d7a7e=function(_0x312083){while(--_0x312083){_0x1df0ea['push'](_0x1df0ea['shift']());}};_0x4d7a7e(++_0x2bcf5a);}(_0xac9d,0x14d));var _0xdac9=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0xac9d[_0x417baa];return _0x42724f;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x425d,0x1e0));var _0xd425=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x425d[_0x2ae2bc];return _0x53c290;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 64e95d7..482d6bf 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 _0xe825=['remove','update','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x13e519,_0x531b6f){var _0x30514d=function(_0x22ebe4){while(--_0x22ebe4){_0x13e519['push'](_0x13e519['shift']());}};_0x30514d(++_0x531b6f);}(_0xe825,0x116));var _0x5e82=function(_0x3d7e97,_0x17dc8d){_0x3d7e97=_0x3d7e97-0x0;var _0x26d356=_0xe825[_0x3d7e97];return _0x26d356;};'use strict';var FaxMessageEvents=require(_0x5e82('0x0'));var events=[_0x5e82('0x1'),_0x5e82('0x2'),_0x5e82('0x3')];function createListener(_0x214601,_0x34185a){return function(_0xdeafcc){_0x34185a['emit'](_0x214601,_0xdeafcc);};}function removeListener(_0x15b392,_0x424991){return function(){FaxMessageEvents[_0x5e82('0x4')](_0x15b392,_0x424991);};}exports[_0x5e82('0x5')]=function(_0x586476){for(var _0x3b24c1=0x0,_0x8dada9=events[_0x5e82('0x6')];_0x3b24c1<_0x8dada9;_0x3b24c1++){var _0xa9ba7=events[_0x3b24c1];var _0x257bbe=createListener(_0x5e82('0x7')+_0xa9ba7,_0x586476);FaxMessageEvents['on'](_0xa9ba7,_0x257bbe);}}; \ No newline at end of file +var _0x63a9=['register','length','faxMessage:','save','update','emit'];(function(_0x1b4aa9,_0x1dd24e){var _0x13381a=function(_0x3d071a){while(--_0x3d071a){_0x1b4aa9['push'](_0x1b4aa9['shift']());}};_0x13381a(++_0x1dd24e);}(_0x63a9,0x13b));var _0x963a=function(_0x116545,_0x247e78){_0x116545=_0x116545-0x0;var _0x143c6b=_0x63a9[_0x116545];return _0x143c6b;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x963a('0x0'),'remove',_0x963a('0x1')];function createListener(_0x3e2be4,_0x246e03){return function(_0x42877){_0x246e03[_0x963a('0x2')](_0x3e2be4,_0x42877);};}function removeListener(_0x550290,_0x3c66da){return function(){FaxMessageEvents['removeListener'](_0x550290,_0x3c66da);};}exports[_0x963a('0x3')]=function(_0x37f5a9){for(var _0x53f01e=0x0,_0x5826d0=events[_0x963a('0x4')];_0x53f01e<_0x5826d0;_0x53f01e++){var _0x50ebc7=events[_0x53f01e];var _0x869c=createListener(_0x963a('0x5')+_0x50ebc7,_0x37f5a9);FaxMessageEvents['on'](_0x50ebc7,_0x869c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a96017e..a8192a1 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 _0xa902=['reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','tracked','faxmessage:create','put','/:id/accept'];(function(_0x525639,_0x2431dc){var _0xe4f840=function(_0x5ef32e){while(--_0x5ef32e){_0x525639['push'](_0x525639['shift']());}};_0xe4f840(++_0x2431dc);}(_0xa902,0x8d));var _0x2a90=function(_0x1e440c,_0x3b2ca5){_0x1e440c=_0x1e440c-0x0;var _0x3cfab5=_0xa902[_0x1e440c];return _0x3cfab5;};'use strict';var multer=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var timeout=require(_0x2a90('0x3'));var express=require(_0x2a90('0x4'));var router=express['Router']();var fs_extra=require(_0x2a90('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a90('0x6'));var controller=require(_0x2a90('0x7'));router[_0x2a90('0x8')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0xa')]);router[_0x2a90('0x8')]('/describe',auth[_0x2a90('0x9')](),controller['describe']);router['get'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xc')]);router[_0x2a90('0x8')](_0x2a90('0xd'),auth['isAuthenticated'](),controller[_0x2a90('0xe')]);router[_0x2a90('0xf')]('/',auth[_0x2a90('0x9')](),interaction[_0x2a90('0x10')]('fax',_0x2a90('0x11')),controller['create']);router[_0x2a90('0x12')]('/:id',auth[_0x2a90('0x9')](),controller['update']);router[_0x2a90('0x12')](_0x2a90('0x13'),auth[_0x2a90('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0x2a90('0x9')](),controller[_0x2a90('0x14')]);router['delete'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0x15')]);module[_0x2a90('0x16')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4e079d,_0x478f2d){var _0x1b24bf=function(_0x53c8d1){while(--_0x53c8d1){_0x4e079d['push'](_0x4e079d['shift']());}};_0x1b24bf(++_0x478f2d);}(_0x0fd9,0xa3));var _0x90fd=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x0fd9[_0x470f63];return _0x4f09e2;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);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 363df46..1223d84 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 _0x9a37=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x1b2916,_0x46a392){var _0x337558=function(_0x123084){while(--_0x123084){_0x1b2916['push'](_0x1b2916['shift']());}};_0x337558(++_0x46a392);}(_0x9a37,0x7e));var _0x79a3=function(_0x13033f,_0x2045af){_0x13033f=_0x13033f-0x0;var _0x2ed576=_0x9a37[_0x13033f];return _0x2ed576;};'use strict';var Sequelize=require(_0x79a3('0x0'));module[_0x79a3('0x1')]={'name':{'type':Sequelize[_0x79a3('0x2')],'unique':_0x79a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79a3('0x2')]},'timeout':{'type':Sequelize[_0x79a3('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79a3('0x5')](_0x79a3('0x6'),'beepall',_0x79a3('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x79a3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd12a=['ENUM','roundrobin','INTEGER','exports','name'];(function(_0x467c05,_0x2cbb49){var _0x192eee=function(_0x258750){while(--_0x258750){_0x467c05['push'](_0x467c05['shift']());}};_0x192eee(++_0x2cbb49);}(_0xd12a,0x1f2));var _0xad12=function(_0x269ccb,_0x5eaeea){_0x269ccb=_0x269ccb-0x0;var _0x41e49=_0xd12a[_0x269ccb];return _0x41e49;};'use strict';var Sequelize=require('sequelize');module[_0xad12('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xad12('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xad12('0x2')]('rrmemory','beepall',_0xad12('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xad12('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 517e16f..b1960c6 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 _0x13c5=['addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','api','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','then','get','UserProfileResource','destroy','error','name','index','map','FaxQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','limit','order','sort','pick','filter','options','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove'];(function(_0x201a9c,_0x1e87eb){var _0x4315da=function(_0x2e9beb){while(--_0x2e9beb){_0x201a9c['push'](_0x201a9c['shift']());}};_0x4315da(++_0x1e87eb);}(_0x13c5,0x7a));var _0x513c=function(_0x1f82d1,_0x27d354){_0x1f82d1=_0x1f82d1-0x0;var _0x43ae7c=_0x13c5[_0x1f82d1];return _0x43ae7c;};'use strict';var BPromise=require(_0x513c('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x513c('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x513c('0x2')]=_[_0x513c('0x3')](config[_0x513c('0x2')],{'host':_0x513c('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x513c('0x5'))[_0x513c('0x6')](socket);function respondWithStatusCode(_0x42da79,_0x414e01){_0x414e01=_0x414e01||0xcc;return function(_0x42af7b){if(_0x42af7b){return _0x42da79[_0x513c('0x7')](_0x414e01);}return _0x42da79[_0x513c('0x8')](_0x414e01)[_0x513c('0x9')]();};}function respondWithResult(_0x4adc04,_0xd70448){_0xd70448=_0xd70448||0xc8;return function(_0x224eb2){if(_0x224eb2){return _0x4adc04['status'](_0xd70448)['json'](_0x224eb2);}};}function respondWithFilteredResult(_0x798eed,_0x1fc4da){return function(_0x5e31e5){if(_0x5e31e5){var _0x5b8585=typeof _0x1fc4da['offset']===_0x513c('0xa')&&typeof _0x1fc4da['limit']===_0x513c('0xa');var _0xde9a6e=_0x5e31e5['count'];var _0x1f7f70=_0x5b8585?0x0:_0x1fc4da[_0x513c('0xb')];var _0x29fa69=_0x5b8585?_0x5e31e5[_0x513c('0xc')]:_0x1fc4da[_0x513c('0xb')]+_0x1fc4da['limit'];var _0x31cad0;if(_0x29fa69>=_0xde9a6e){_0x29fa69=_0xde9a6e;_0x31cad0=0xc8;}else{_0x31cad0=0xce;}_0x798eed['status'](_0x31cad0);return _0x798eed[_0x513c('0xd')](_0x513c('0xe'),_0x1f7f70+'-'+_0x29fa69+'/'+_0xde9a6e)[_0x513c('0xf')](_0x5e31e5);}return null;};}function saveUpdates(_0x2fd03e){return function(_0x597794){if(_0x597794){return _0x597794['update'](_0x2fd03e)['then'](function(_0x100bc7){return _0x100bc7;});}return null;};}function removeEntity(_0x341b20){return function(_0x51196d){if(_0x51196d){return _0x51196d['destroy']()[_0x513c('0x10')](function(){var _0xaa7657=_0x51196d[_0x513c('0x11')]({'plain':!![]});var _0x1971d9='FaxQueues';return db[_0x513c('0x12')][_0x513c('0x13')]({'where':{'type':_0x1971d9,'resourceId':_0xaa7657['id']}})[_0x513c('0x10')](function(){return _0x51196d;});})[_0x513c('0x10')](function(){_0x341b20[_0x513c('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153132){return function(_0x47a67c){if(!_0x47a67c){_0x153132[_0x513c('0x7')](0x194);}return _0x47a67c;};}function handleError(_0x13cfe1,_0x9dc7ba){_0x9dc7ba=_0x9dc7ba||0x1f4;return function(_0xcd8a3b){logger[_0x513c('0x14')](_0xcd8a3b['stack']);if(_0xcd8a3b['name']){delete _0xcd8a3b[_0x513c('0x15')];}_0x13cfe1[_0x513c('0x8')](_0x9dc7ba)['send'](_0xcd8a3b);};}exports[_0x513c('0x16')]=function(_0x28c0ee,_0x4bc5f5){var _0x206e5b={};var _0x465522={'count':0x0,'rows':[]};var _0x437ed8=_[_0x513c('0x17')](db[_0x513c('0x18')][_0x513c('0x19')],function(_0x4574e2){return{'name':_0x4574e2['fieldName'],'type':_0x4574e2[_0x513c('0x1a')][_0x513c('0x1b')]};});_0x206e5b=qs[_0x513c('0x1c')](_0x437ed8,_0x28c0ee);var _0x18dec2={'where':_0x206e5b[_0x513c('0x1d')]};return db['FaxQueue'][_0x513c('0xc')](_0x18dec2)[_0x513c('0x10')](function(_0x3cbe93){_0x465522[_0x513c('0xc')]=_0x3cbe93;_0x206e5b[_0x513c('0x1e')]=qs[_0x513c('0x1e')](_0x28c0ee['query']);return db['FaxQueue'][_0x513c('0x1f')](_0x206e5b);})['then'](function(_0x2ee6aa){_0x465522[_0x513c('0x20')]=_0x2ee6aa;return _0x465522;})[_0x513c('0x10')](respondWithFilteredResult(_0x4bc5f5,_0x206e5b))['catch'](handleError(_0x4bc5f5,null));};exports[_0x513c('0x21')]=function(_0x24d971,_0x38924e){var _0xb8a558={'raw':!![],'where':{'id':_0x24d971[_0x513c('0x22')]['id']}},_0x508cf4={};_0x508cf4[_0x513c('0x23')]=_['keys'](db[_0x513c('0x18')][_0x513c('0x19')]);_0x508cf4['query']=_[_0x513c('0x24')](_0x24d971[_0x513c('0x25')]);_0x508cf4[_0x513c('0x26')]=_[_0x513c('0x27')](_0x508cf4[_0x513c('0x23')],_0x508cf4['query']);_0xb8a558['attributes']=_[_0x513c('0x27')](_0x508cf4['model'],qs[_0x513c('0x28')](_0x24d971[_0x513c('0x25')][_0x513c('0x28')]));_0xb8a558[_0x513c('0x29')]=_0xb8a558[_0x513c('0x29')][_0x513c('0x2a')]?_0xb8a558[_0x513c('0x29')]:_0x508cf4['model'];if(_0x24d971[_0x513c('0x25')][_0x513c('0x2b')]){_0xb8a558[_0x513c('0x1e')]=[{'all':!![]}];}_0xb8a558=_[_0x513c('0x2c')]({},_0xb8a558,_0x24d971['options']);return db[_0x513c('0x18')]['find'](_0xb8a558)[_0x513c('0x10')](handleEntityNotFound(_0x38924e,null))[_0x513c('0x10')](respondWithResult(_0x38924e,null))['catch'](handleError(_0x38924e,null));};exports['create']=function(_0x421eb6,_0x534fa4){return db['FaxQueue'][_0x513c('0x2d')](_0x421eb6['body'],{})[_0x513c('0x10')](function(_0x516c33){var _0x5cfc3b=_0x421eb6[_0x513c('0x2e')][_0x513c('0x11')]({'plain':!![]});if(!_0x5cfc3b)throw new Error(_0x513c('0x2f'));if(_0x5cfc3b['role']===_0x513c('0x2e')){var _0x4bc902=_0x516c33['get']({'plain':!![]});var _0x1b77f7=_0x513c('0x30');return db['UserProfileSection'][_0x513c('0x31')]({'where':{'name':_0x1b77f7,'userProfileId':_0x5cfc3b[_0x513c('0x32')]},'raw':!![]})[_0x513c('0x10')](function(_0x57d07f){if(_0x57d07f&&_0x57d07f[_0x513c('0x33')]===0x0){return db[_0x513c('0x12')][_0x513c('0x2d')]({'name':_0x4bc902[_0x513c('0x15')],'resourceId':_0x4bc902['id'],'type':_0x57d07f[_0x513c('0x15')],'sectionId':_0x57d07f['id']},{})[_0x513c('0x10')](function(){return _0x516c33;});}else{return _0x516c33;}})['catch'](function(_0x2abae5){logger[_0x513c('0x14')](_0x513c('0x34'),_0x2abae5);throw _0x2abae5;});}return _0x516c33;})['then'](respondWithResult(_0x534fa4,0xc9))[_0x513c('0x35')](handleError(_0x534fa4,null));};exports[_0x513c('0x36')]=function(_0x32826f,_0x34f1d8){if(_0x32826f[_0x513c('0x37')]['id']){delete _0x32826f[_0x513c('0x37')]['id'];}return db['FaxQueue'][_0x513c('0x31')]({'where':{'id':_0x32826f[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0x34f1d8,null))['then'](saveUpdates(_0x32826f[_0x513c('0x37')],null))[_0x513c('0x10')](respondWithResult(_0x34f1d8,null))[_0x513c('0x35')](handleError(_0x34f1d8,null));};exports[_0x513c('0x13')]=function(_0x30b8c4,_0x11a9b3){return db['FaxQueue'][_0x513c('0x31')]({'where':{'id':_0x30b8c4[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0x11a9b3,null))[_0x513c('0x10')](removeEntity(_0x11a9b3,null))[_0x513c('0x35')](handleError(_0x11a9b3,null));};exports[_0x513c('0x38')]=function(_0x14288a,_0x43f932){return db[_0x513c('0x18')]['describe']()['then'](respondWithResult(_0x43f932,null))['catch'](handleError(_0x43f932,null));};exports[_0x513c('0x39')]=function(_0x324723,_0x456374){var _0x531f4f={'raw':!![],'where':{}},_0x260027={},_0x2d37d3;return db[_0x513c('0x18')][_0x513c('0x3a')]({'where':{'id':_0x324723[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0x456374,null))[_0x513c('0x10')](function(_0x50ed97){if(_0x50ed97){_0x2d37d3=_0x50ed97['get']({'plain':!![]});_0x260027[_0x513c('0x23')]=_[_0x513c('0x24')](db[_0x513c('0x3b')][_0x513c('0x19')]);_0x260027[_0x513c('0x25')]=_[_0x513c('0x24')](_0x324723[_0x513c('0x25')]);_0x260027['filters']=_[_0x513c('0x27')](_0x260027[_0x513c('0x23')],_0x260027['query']);_0x531f4f['attributes']=_[_0x513c('0x27')](_0x260027[_0x513c('0x23')],qs[_0x513c('0x28')](_0x324723[_0x513c('0x25')][_0x513c('0x28')]));_0x531f4f[_0x513c('0x29')]=_0x531f4f[_0x513c('0x29')][_0x513c('0x2a')]?_0x531f4f[_0x513c('0x29')]:_0x260027[_0x513c('0x23')];if(!_0x324723['query'][_0x513c('0x3c')](_0x513c('0x3d'))){_0x531f4f[_0x513c('0x3e')]=qs['limit'](_0x324723['query'][_0x513c('0x3e')]);_0x531f4f[_0x513c('0xb')]=qs['offset'](_0x324723[_0x513c('0x25')]['offset']);}_0x531f4f[_0x513c('0x3f')]=qs[_0x513c('0x40')](_0x324723[_0x513c('0x25')]['sort']);_0x531f4f[_0x513c('0x1d')]=qs[_0x513c('0x26')](_[_0x513c('0x41')](_0x324723[_0x513c('0x25')],_0x260027['filters']));_0x531f4f[_0x513c('0x1d')]['FaxQueueId']=_0x50ed97['id'];if(_0x324723[_0x513c('0x25')][_0x513c('0x42')]){_0x531f4f['where']=_[_0x513c('0x2c')](_0x531f4f[_0x513c('0x1d')],{'$or':_[_0x513c('0x17')](_0x531f4f[_0x513c('0x29')],function(_0x658e24){var _0x38aa3a={};_0x38aa3a[_0x658e24]={'$like':'%'+_0x324723[_0x513c('0x25')][_0x513c('0x42')]+'%'};return _0x38aa3a;})});}_0x531f4f=_[_0x513c('0x2c')]({},_0x531f4f,_0x324723[_0x513c('0x43')]);return db[_0x513c('0x3b')][_0x513c('0x1f')](_0x531f4f);}})['then'](function(_0x269b60){if(_0x269b60){return db[_0x513c('0x44')][_0x513c('0x45')]({'where':{'id':_[_0x513c('0x17')](_0x269b60,_0x513c('0x46')),'role':_0x513c('0x47')},'attributes':['id',_0x513c('0x15'),_0x513c('0x48'),'updatedAt',_0x513c('0x49')]});}})['then'](function(_0xba5807){if(_0xba5807){return{'count':_0xba5807[_0x513c('0xc')],'rows':_['map'](_0xba5807[_0x513c('0x20')],function(_0x492356){return{'membername':_0x492356[_0x513c('0x15')],'UserId':_0x492356['id'],'queue_name':_0x2d37d3[_0x513c('0x15')],'FaxQueueId':_0x2d37d3['id'],'interface':util[_0x513c('0x4a')]('%s/%s',_0x513c('0x4b'),_0x492356[_0x513c('0x15')]),'penalty':0x0,'paused':_0x492356['faxPause'],'createdAt':_0x492356[_0x513c('0x49')],'updatedAt':_0x492356[_0x513c('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x513c('0x10')](respondWithFilteredResult(_0x456374,_0x531f4f))[_0x513c('0x35')](handleError(_0x456374,null));};exports['getTeams']=function(_0x4037a3,_0xb2c23a){var _0x3abc92={};var _0x514abe={};var _0x570fb4;var _0x300eb0;return db[_0x513c('0x18')]['findOne']({'where':{'id':_0x4037a3[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0xb2c23a,null))[_0x513c('0x10')](function(_0x5cb24a){if(_0x5cb24a){_0x570fb4=_0x5cb24a;_0x514abe[_0x513c('0x23')]=_[_0x513c('0x24')](db[_0x513c('0x4d')][_0x513c('0x19')]);_0x514abe[_0x513c('0x25')]=_[_0x513c('0x24')](_0x4037a3['query']);_0x514abe[_0x513c('0x26')]=_[_0x513c('0x27')](_0x514abe[_0x513c('0x23')],_0x514abe['query']);_0x3abc92[_0x513c('0x29')]=_[_0x513c('0x27')](_0x514abe[_0x513c('0x23')],qs[_0x513c('0x28')](_0x4037a3['query']['fields']));_0x3abc92[_0x513c('0x29')]=_0x3abc92[_0x513c('0x29')][_0x513c('0x2a')]?_0x3abc92['attributes']:_0x514abe[_0x513c('0x23')];_0x3abc92[_0x513c('0x3f')]=qs[_0x513c('0x40')](_0x4037a3[_0x513c('0x25')]['sort']);_0x3abc92[_0x513c('0x1d')]=qs[_0x513c('0x26')](_[_0x513c('0x41')](_0x4037a3[_0x513c('0x25')],_0x514abe[_0x513c('0x26')]));if(_0x4037a3['query'][_0x513c('0x42')]){_0x3abc92[_0x513c('0x1d')]=_[_0x513c('0x2c')](_0x3abc92[_0x513c('0x1d')],{'$or':_[_0x513c('0x17')](_0x3abc92[_0x513c('0x29')],function(_0x39b4a7){var _0x39192c={};_0x39192c[_0x39b4a7]={'$like':'%'+_0x4037a3['query'][_0x513c('0x42')]+'%'};return _0x39192c;})});}_0x3abc92=_['merge']({},_0x3abc92,_0x4037a3['options']);return _0x570fb4[_0x513c('0x4e')](_0x3abc92);}})[_0x513c('0x10')](function(_0x1264b4){if(_0x1264b4){_0x300eb0=_0x1264b4[_0x513c('0x2a')];if(!_0x4037a3['query'][_0x513c('0x3c')](_0x513c('0x3d'))){_0x3abc92['limit']=qs['limit'](_0x4037a3['query'][_0x513c('0x3e')]);_0x3abc92[_0x513c('0xb')]=qs[_0x513c('0xb')](_0x4037a3['query'][_0x513c('0xb')]);}return _0x570fb4[_0x513c('0x4e')](_0x3abc92);}})[_0x513c('0x10')](function(_0x583c98){if(_0x583c98){return _0x583c98?{'count':_0x300eb0,'rows':_0x583c98}:null;}})[_0x513c('0x10')](respondWithResult(_0xb2c23a,null))[_0x513c('0x35')](handleError(_0xb2c23a,null));};exports[_0x513c('0x4f')]=function(_0x23292b,_0x31b95c){var _0x355703=_0x23292b[_0x513c('0x37')][_0x513c('0x50')];return db['Team'][_0x513c('0x1f')]({'where':{'id':_0x355703},'attributes':['id'],'include':[{'model':db[_0x513c('0x44')],'as':_0x513c('0x51'),'attributes':['id',_0x513c('0x15'),'online',_0x513c('0x52'),_0x513c('0x53')],'raw':!![]}]})[_0x513c('0x10')](function(_0x383239){if(_0x383239){var _0x82181c=_['flatMap'](_0x383239,function(_0x7b5766){var _0x5143bc=_0x7b5766[_0x513c('0x11')]({'plain':!![]});return _0x5143bc[_0x513c('0x51')];});return db[_0x513c('0x18')][_0x513c('0x31')]({'where':{'id':_0x23292b['params']['id']}})['then'](function(_0x345e70){return db[_0x513c('0x54')][_0x513c('0x55')](function(_0x5de0cc){return _0x345e70['addTeams'](_0x355703,{'transaction':_0x5de0cc})[_0x513c('0x10')](function(){return BPromise[_0x513c('0x56')](_0x82181c,function(_0x583355){return db['UserFaxQueue'][_0x513c('0x57')]({'where':{'UserId':_0x583355['id'],'FaxQueueId':_0x23292b['params']['id']},'transaction':_0x5de0cc});});})[_0x513c('0x10')](function(){_0x82181c[_0x513c('0x58')](function(_0x1d665f){socket[_0x513c('0x59')]('userFaxQueue:save',{'UserId':_0x1d665f['id'],'FaxQueueId':_0x345e70['id']});});});});});}})[_0x513c('0x10')](respondWithStatusCode(_0x31b95c,null))[_0x513c('0x35')](handleError(_0x31b95c,null));};exports['removeTeams']=function(_0x25580a,_0xe994ef){return db['Team'][_0x513c('0x1f')]({'where':{'id':_0x25580a[_0x513c('0x25')][_0x513c('0x50')]},'attributes':['id'],'include':[{'model':db[_0x513c('0x44')],'as':_0x513c('0x51'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe994ef,null))[_0x513c('0x10')](function(_0x41ac37){var _0x591af8=_[_0x513c('0x17')](_0x41ac37,'id');var _0x581c88=[];var _0x14e978=[];var _0x5568b2=squel[_0x513c('0x5a')]();_0x5568b2['field'](_0x513c('0x5b'))[_0x513c('0x5c')](_0x513c('0x5d'),'tq')[_0x513c('0x5e')]('user_has_teams','ut',_0x513c('0x5f'))['where'](_0x513c('0x60'),_0x25580a[_0x513c('0x22')]['id']);for(var _0x4ebd51=0x0;_0x4ebd51<_0x41ac37[_0x513c('0x2a')];_0x4ebd51+=0x1){let _0x1edda2=_0x41ac37[_0x4ebd51];for(var _0x18c20e=0x0;_0x18c20e<_0x1edda2[_0x513c('0x51')][_0x513c('0x2a')];_0x18c20e+=0x1){let _0x3db405=_0x1edda2[_0x513c('0x51')][_0x18c20e];var _0x5d0d46=_0x5568b2[_0x513c('0x61')]();_0x5d0d46[_0x513c('0x1d')](_0x513c('0x62'),_0x3db405['id']);_0x14e978['push'](db[_0x513c('0x54')][_0x513c('0x25')](_0x5d0d46[_0x513c('0x63')](),{'type':db['sequelize'][_0x513c('0x64')]['SELECT']})[_0x513c('0x10')](function(_0x467ffe){if(_0x467ffe['length']===0x1){return _0x3db405['id'];}else{var _0x19dd14=_['every'](_[_0x513c('0x17')](_0x467ffe,_0x513c('0x65')),function(_0x3b2130){return _[_0x513c('0x66')](_0x591af8,_0x3b2130);});if(_0x19dd14){return _0x3db405['id'];}}}));}}return BPromise[_0x513c('0x67')](_0x14e978)[_0x513c('0x10')](function(_0x37b47d){_0x581c88=_(_0x581c88)[_0x513c('0x68')](_0x37b47d)[_0x513c('0x69')]()[_0x513c('0x6a')]();return db[_0x513c('0x18')][_0x513c('0x31')]({'where':{'id':_0x25580a[_0x513c('0x22')]['id']}})['then'](function(_0x363c44){return db['sequelize'][_0x513c('0x55')](function(_0x579d29){return _0x363c44['removeTeams'](_0x25580a['query'][_0x513c('0x50')],{'transaction':_0x579d29})[_0x513c('0x10')](function(){if(!_[_0x513c('0x6b')](_0x581c88)){return _0x363c44[_0x513c('0x6c')](_0x581c88,{'transaction':_0x579d29});}})[_0x513c('0x10')](function(){_0x581c88['forEach'](function(_0xfa2efc){socket[_0x513c('0x59')](_0x513c('0x6d'),{'UserId':_0xfa2efc,'FaxQueueId':_0x363c44['id']});});});});});});})[_0x513c('0x10')](respondWithStatusCode(_0xe994ef,null))[_0x513c('0x35')](handleError(_0xe994ef,null));};exports[_0x513c('0x6e')]=function(_0x2d4538,_0x387217){return db[_0x513c('0x18')][_0x513c('0x31')]({'where':{'id':_0x2d4538['params']['id']}})['then'](handleEntityNotFound(_0x387217,null))['then'](function(_0x24b6b7){if(_0x24b6b7){return _0x24b6b7['addAgents'](_0x2d4538[_0x513c('0x37')][_0x513c('0x50')],_[_0x513c('0x6f')](_0x2d4538[_0x513c('0x37')],[_0x513c('0x50'),'id'])||{})[_0x513c('0x70')](function(_0x42dead){for(var _0x4d1fd9=0x0;_0x4d1fd9<_0x2d4538[_0x513c('0x37')]['ids']['length'];_0x4d1fd9+=0x1){socket['emit'](_0x513c('0x71'),{'UserId':Number(_0x2d4538[_0x513c('0x37')][_0x513c('0x50')][_0x4d1fd9]),'FaxQueueId':Number(_0x2d4538[_0x513c('0x22')]['id'])});}return _0x42dead;});}})['then'](respondWithResult(_0x387217,null))[_0x513c('0x35')](handleError(_0x387217,null));};exports[_0x513c('0x6c')]=function(_0x2f4991,_0x29f075){return db[_0x513c('0x18')][_0x513c('0x31')]({'where':{'id':_0x2f4991[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0x29f075,null))['then'](function(_0x1e40ef){if(_0x1e40ef){return _0x1e40ef[_0x513c('0x6c')](_0x2f4991[_0x513c('0x25')][_0x513c('0x50')])[_0x513c('0x10')](function(){if(_[_0x513c('0x72')](_0x2f4991[_0x513c('0x25')][_0x513c('0x50')])){for(var _0x166875=0x0;_0x166875<_0x2f4991[_0x513c('0x25')][_0x513c('0x50')][_0x513c('0x2a')];_0x166875+=0x1){socket['emit'](_0x513c('0x6d'),{'UserId':Number(_0x2f4991[_0x513c('0x25')][_0x513c('0x50')][_0x166875]),'FaxQueueId':Number(_0x2f4991[_0x513c('0x22')]['id'])});}}else{socket[_0x513c('0x59')](_0x513c('0x6d'),{'UserId':Number(_0x2f4991[_0x513c('0x25')]['ids']),'FaxQueueId':Number(_0x2f4991[_0x513c('0x22')]['id'])});}});}})[_0x513c('0x10')](respondWithStatusCode(_0x29f075,null))[_0x513c('0x35')](handleError(_0x29f075,null));};exports[_0x513c('0x73')]=function(_0x3d16b9,_0x438e39){var _0x420b65={};var _0x1e2b16={};var _0x948cc;var _0x37f87f;return db[_0x513c('0x18')][_0x513c('0x3a')]({'where':{'id':_0x3d16b9[_0x513c('0x22')]['id']}})[_0x513c('0x10')](handleEntityNotFound(_0x438e39,null))[_0x513c('0x10')](function(_0x1fe519){if(_0x1fe519){_0x948cc=_0x1fe519;_0x1e2b16[_0x513c('0x23')]=_['keys'](db[_0x513c('0x44')][_0x513c('0x19')]);_0x1e2b16[_0x513c('0x25')]=_[_0x513c('0x24')](_0x3d16b9[_0x513c('0x25')]);_0x1e2b16[_0x513c('0x26')]=_[_0x513c('0x27')](_0x1e2b16[_0x513c('0x23')],_0x1e2b16[_0x513c('0x25')]);_0x420b65[_0x513c('0x29')]=_[_0x513c('0x27')](_0x1e2b16['model'],qs[_0x513c('0x28')](_0x3d16b9[_0x513c('0x25')][_0x513c('0x28')]));_0x420b65[_0x513c('0x29')]=_0x420b65['attributes']['length']?_0x420b65[_0x513c('0x29')]:_0x1e2b16[_0x513c('0x23')];_0x420b65[_0x513c('0x3f')]=qs[_0x513c('0x40')](_0x3d16b9[_0x513c('0x25')]['sort']);_0x420b65[_0x513c('0x1d')]=qs[_0x513c('0x26')](_[_0x513c('0x41')](_0x3d16b9[_0x513c('0x25')],_0x1e2b16['filters']));if(_0x3d16b9[_0x513c('0x25')][_0x513c('0x42')]){_0x420b65[_0x513c('0x1d')]=_[_0x513c('0x2c')](_0x420b65[_0x513c('0x1d')],{'$or':_['map'](_0x420b65[_0x513c('0x29')],function(_0x9a816a){var _0x4fac10={};_0x4fac10[_0x9a816a]={'$like':'%'+_0x3d16b9[_0x513c('0x25')][_0x513c('0x42')]+'%'};return _0x4fac10;})});}_0x420b65=_['merge']({},_0x420b65,_0x3d16b9['options']);return _0x948cc['getAgents'](_0x420b65);}})[_0x513c('0x10')](function(_0x67239){if(_0x67239){_0x37f87f=_0x67239[_0x513c('0x2a')];if(!_0x3d16b9[_0x513c('0x25')][_0x513c('0x3c')](_0x513c('0x3d'))){_0x420b65['limit']=qs[_0x513c('0x3e')](_0x3d16b9[_0x513c('0x25')][_0x513c('0x3e')]);_0x420b65[_0x513c('0xb')]=qs[_0x513c('0xb')](_0x3d16b9[_0x513c('0x25')][_0x513c('0xb')]);}return _0x948cc[_0x513c('0x73')](_0x420b65);}})[_0x513c('0x10')](function(_0x1e13de){if(_0x1e13de){return _0x1e13de?{'count':_0x37f87f,'rows':_0x1e13de}:null;}})[_0x513c('0x10')](respondWithResult(_0x438e39,null))[_0x513c('0x35')](handleError(_0x438e39,null));}; \ No newline at end of file +var _0x4975=['QueryTypes','SELECT','every','all','union','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','pick','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','getOptions','include','rows','params','keys','query','intersection','model','attributes','fields','length','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','UserFaxQueue','filters','hasOwnProperty','nolimit','order','sort','where','filter','merge','findAll','User','findAndCountAll','UserId','agent','faxPause','format','%s/%s','SIP','createdAt','getTeams','ids','Team','Agents','online','voicePause','interface','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','sequelize'];(function(_0x454f28,_0x3d0482){var _0x6367bd=function(_0x5cf9b5){while(--_0x5cf9b5){_0x454f28['push'](_0x454f28['shift']());}};_0x6367bd(++_0x3d0482);}(_0x4975,0x86));var _0x5497=function(_0x78f2da,_0x4684e1){_0x78f2da=_0x78f2da-0x0;var _0x35c101=_0x4975[_0x78f2da];return _0x35c101;};'use strict';var BPromise=require(_0x5497('0x0'));var util=require('util');var _=require(_0x5497('0x1'));var squel=require(_0x5497('0x2'));var Redis=require(_0x5497('0x3'));var qs=require(_0x5497('0x4'));var logger=require(_0x5497('0x5'))(_0x5497('0x6'));var config=require(_0x5497('0x7'));var db=require(_0x5497('0x8'))['db'];config[_0x5497('0x9')]=_[_0x5497('0xa')](config['redis'],{'host':_0x5497('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5497('0x9')]));require(_0x5497('0xc'))[_0x5497('0xd')](socket);function respondWithStatusCode(_0x57f930,_0x42af11){_0x42af11=_0x42af11||0xcc;return function(_0x49d94b){if(_0x49d94b){return _0x57f930[_0x5497('0xe')](_0x42af11);}return _0x57f930[_0x5497('0xf')](_0x42af11)[_0x5497('0x10')]();};}function respondWithResult(_0x32a8a2,_0x131627){_0x131627=_0x131627||0xc8;return function(_0x425288){if(_0x425288){return _0x32a8a2[_0x5497('0xf')](_0x131627)[_0x5497('0x11')](_0x425288);}};}function respondWithFilteredResult(_0x50d716,_0x5874ef){return function(_0x5b1162){if(_0x5b1162){var _0xc250bb=typeof _0x5874ef[_0x5497('0x12')]===_0x5497('0x13')&&typeof _0x5874ef[_0x5497('0x14')]===_0x5497('0x13');var _0x365144=_0x5b1162[_0x5497('0x15')];var _0xaca97d=_0xc250bb?0x0:_0x5874ef[_0x5497('0x12')];var _0x1a4c74=_0xc250bb?_0x5b1162['count']:_0x5874ef[_0x5497('0x12')]+_0x5874ef['limit'];var _0x4237a9;if(_0x1a4c74>=_0x365144){_0x1a4c74=_0x365144;_0x4237a9=0xc8;}else{_0x4237a9=0xce;}_0x50d716[_0x5497('0xf')](_0x4237a9);return _0x50d716[_0x5497('0x16')](_0x5497('0x17'),_0xaca97d+'-'+_0x1a4c74+'/'+_0x365144)[_0x5497('0x11')](_0x5b1162);}return null;};}function saveUpdates(_0x4073e6){return function(_0x2f2997){if(_0x2f2997){return _0x2f2997['update'](_0x4073e6)['then'](function(_0x3f4d20){return _0x3f4d20;});}return null;};}function removeEntity(_0x1bf442){return function(_0x3a47fd){if(_0x3a47fd){return _0x3a47fd['destroy']()[_0x5497('0x18')](function(){var _0xcbd71d=_0x3a47fd[_0x5497('0x19')]({'plain':!![]});var _0x43da2c=_0x5497('0x1a');return db[_0x5497('0x1b')][_0x5497('0x1c')]({'where':{'type':_0x43da2c,'resourceId':_0xcbd71d['id']}})[_0x5497('0x18')](function(){return _0x3a47fd;});})[_0x5497('0x18')](function(){_0x1bf442[_0x5497('0xf')](0xcc)[_0x5497('0x10')]();});}};}function handleEntityNotFound(_0x52c049){return function(_0x720767){if(!_0x720767){_0x52c049['sendStatus'](0x194);}return _0x720767;};}function handleError(_0x19200a,_0xd0868d){_0xd0868d=_0xd0868d||0x1f4;return function(_0x44265c){logger[_0x5497('0x1d')](_0x44265c[_0x5497('0x1e')]);if(_0x44265c[_0x5497('0x1f')]){delete _0x44265c['name'];}_0x19200a['status'](_0xd0868d)[_0x5497('0x20')](_0x44265c);};}exports[_0x5497('0x21')]=function(_0x24482a,_0x281155){var _0x5223b5={};var _0x13b7a4={'count':0x0,'rows':[]};var _0x57268c=_[_0x5497('0x22')](db[_0x5497('0x23')][_0x5497('0x24')],function(_0x34a1a5){return{'name':_0x34a1a5[_0x5497('0x25')],'type':_0x34a1a5[_0x5497('0x26')]['key']};});_0x5223b5=qs[_0x5497('0x27')](_0x57268c,_0x24482a);var _0x5406e2={'where':_0x5223b5['where']};return db['FaxQueue'][_0x5497('0x15')](_0x5406e2)['then'](function(_0x5e9356){_0x13b7a4[_0x5497('0x15')]=_0x5e9356;_0x5223b5[_0x5497('0x28')]=qs[_0x5497('0x28')](_0x24482a['query']);return db['FaxQueue']['findAll'](_0x5223b5);})[_0x5497('0x18')](function(_0x471e0b){_0x13b7a4[_0x5497('0x29')]=_0x471e0b;return _0x13b7a4;})['then'](respondWithFilteredResult(_0x281155,_0x5223b5))['catch'](handleError(_0x281155,null));};exports['show']=function(_0xa28dd8,_0x572460){var _0x438ee4={'raw':!![],'where':{'id':_0xa28dd8[_0x5497('0x2a')]['id']}},_0x258c2d={};_0x258c2d['model']=_[_0x5497('0x2b')](db[_0x5497('0x23')]['rawAttributes']);_0x258c2d[_0x5497('0x2c')]=_[_0x5497('0x2b')](_0xa28dd8[_0x5497('0x2c')]);_0x258c2d['filters']=_[_0x5497('0x2d')](_0x258c2d[_0x5497('0x2e')],_0x258c2d[_0x5497('0x2c')]);_0x438ee4[_0x5497('0x2f')]=_[_0x5497('0x2d')](_0x258c2d['model'],qs[_0x5497('0x30')](_0xa28dd8[_0x5497('0x2c')]['fields']));_0x438ee4[_0x5497('0x2f')]=_0x438ee4[_0x5497('0x2f')][_0x5497('0x31')]?_0x438ee4[_0x5497('0x2f')]:_0x258c2d[_0x5497('0x2e')];if(_0xa28dd8[_0x5497('0x2c')]['includeAll']){_0x438ee4[_0x5497('0x28')]=[{'all':!![]}];}_0x438ee4=_['merge']({},_0x438ee4,_0xa28dd8[_0x5497('0x32')]);return db[_0x5497('0x23')][_0x5497('0x33')](_0x438ee4)['then'](handleEntityNotFound(_0x572460,null))['then'](respondWithResult(_0x572460,null))[_0x5497('0x34')](handleError(_0x572460,null));};exports[_0x5497('0x35')]=function(_0x326d48,_0x429cbf){return db[_0x5497('0x23')][_0x5497('0x35')](_0x326d48['body'],{})[_0x5497('0x18')](function(_0x3ffa48){var _0x3de8fe=_0x326d48[_0x5497('0x36')][_0x5497('0x19')]({'plain':!![]});if(!_0x3de8fe)throw new Error(_0x5497('0x37'));if(_0x3de8fe[_0x5497('0x38')]===_0x5497('0x36')){var _0x59627b=_0x3ffa48['get']({'plain':!![]});var _0x3bb31a=_0x5497('0x1a');return db[_0x5497('0x39')][_0x5497('0x33')]({'where':{'name':_0x3bb31a,'userProfileId':_0x3de8fe[_0x5497('0x3a')]},'raw':!![]})[_0x5497('0x18')](function(_0x4299be){if(_0x4299be&&_0x4299be['autoAssociation']===0x0){return db[_0x5497('0x1b')][_0x5497('0x35')]({'name':_0x59627b[_0x5497('0x1f')],'resourceId':_0x59627b['id'],'type':_0x4299be[_0x5497('0x1f')],'sectionId':_0x4299be['id']},{})[_0x5497('0x18')](function(){return _0x3ffa48;});}else{return _0x3ffa48;}})[_0x5497('0x34')](function(_0x114471){logger['error'](_0x5497('0x3b'),_0x114471);throw _0x114471;});}return _0x3ffa48;})[_0x5497('0x18')](respondWithResult(_0x429cbf,0xc9))[_0x5497('0x34')](handleError(_0x429cbf,null));};exports[_0x5497('0x3c')]=function(_0x20e947,_0xd90608){if(_0x20e947[_0x5497('0x3d')]['id']){delete _0x20e947[_0x5497('0x3d')]['id'];}return db[_0x5497('0x23')][_0x5497('0x33')]({'where':{'id':_0x20e947['params']['id']}})[_0x5497('0x18')](handleEntityNotFound(_0xd90608,null))['then'](saveUpdates(_0x20e947[_0x5497('0x3d')],null))[_0x5497('0x18')](respondWithResult(_0xd90608,null))[_0x5497('0x34')](handleError(_0xd90608,null));};exports[_0x5497('0x1c')]=function(_0x133746,_0x510cfd){return db[_0x5497('0x23')][_0x5497('0x33')]({'where':{'id':_0x133746['params']['id']}})[_0x5497('0x18')](handleEntityNotFound(_0x510cfd,null))['then'](removeEntity(_0x510cfd,null))[_0x5497('0x34')](handleError(_0x510cfd,null));};exports['describe']=function(_0x133606,_0x1a0df5){return db[_0x5497('0x23')][_0x5497('0x3e')]()[_0x5497('0x18')](respondWithResult(_0x1a0df5,null))['catch'](handleError(_0x1a0df5,null));};exports['getMembers']=function(_0x498de5,_0x55f654){var _0x3cbe4b={'raw':!![],'where':{}},_0x43c430={},_0x417f31;return db[_0x5497('0x23')][_0x5497('0x3f')]({'where':{'id':_0x498de5[_0x5497('0x2a')]['id']}})[_0x5497('0x18')](handleEntityNotFound(_0x55f654,null))[_0x5497('0x18')](function(_0x2626bf){if(_0x2626bf){_0x417f31=_0x2626bf['get']({'plain':!![]});_0x43c430[_0x5497('0x2e')]=_[_0x5497('0x2b')](db[_0x5497('0x40')]['rawAttributes']);_0x43c430[_0x5497('0x2c')]=_['keys'](_0x498de5[_0x5497('0x2c')]);_0x43c430[_0x5497('0x41')]=_[_0x5497('0x2d')](_0x43c430['model'],_0x43c430[_0x5497('0x2c')]);_0x3cbe4b[_0x5497('0x2f')]=_['intersection'](_0x43c430[_0x5497('0x2e')],qs['fields'](_0x498de5[_0x5497('0x2c')]['fields']));_0x3cbe4b[_0x5497('0x2f')]=_0x3cbe4b[_0x5497('0x2f')][_0x5497('0x31')]?_0x3cbe4b[_0x5497('0x2f')]:_0x43c430[_0x5497('0x2e')];if(!_0x498de5[_0x5497('0x2c')][_0x5497('0x42')](_0x5497('0x43'))){_0x3cbe4b['limit']=qs[_0x5497('0x14')](_0x498de5['query']['limit']);_0x3cbe4b[_0x5497('0x12')]=qs[_0x5497('0x12')](_0x498de5['query'][_0x5497('0x12')]);}_0x3cbe4b[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x498de5[_0x5497('0x2c')]['sort']);_0x3cbe4b[_0x5497('0x46')]=qs['filters'](_['pick'](_0x498de5[_0x5497('0x2c')],_0x43c430[_0x5497('0x41')]));_0x3cbe4b[_0x5497('0x46')]['FaxQueueId']=_0x2626bf['id'];if(_0x498de5['query'][_0x5497('0x47')]){_0x3cbe4b['where']=_[_0x5497('0x48')](_0x3cbe4b['where'],{'$or':_[_0x5497('0x22')](_0x3cbe4b['attributes'],function(_0xb1eac0){var _0x41138e={};_0x41138e[_0xb1eac0]={'$like':'%'+_0x498de5['query'][_0x5497('0x47')]+'%'};return _0x41138e;})});}_0x3cbe4b=_['merge']({},_0x3cbe4b,_0x498de5['options']);return db[_0x5497('0x40')][_0x5497('0x49')](_0x3cbe4b);}})['then'](function(_0x37336a){if(_0x37336a){return db[_0x5497('0x4a')][_0x5497('0x4b')]({'where':{'id':_[_0x5497('0x22')](_0x37336a,_0x5497('0x4c')),'role':_0x5497('0x4d')},'attributes':['id','name',_0x5497('0x4e'),'updatedAt','createdAt']});}})['then'](function(_0x1f3965){if(_0x1f3965){return{'count':_0x1f3965[_0x5497('0x15')],'rows':_[_0x5497('0x22')](_0x1f3965['rows'],function(_0x53eafd){return{'membername':_0x53eafd['name'],'UserId':_0x53eafd['id'],'queue_name':_0x417f31['name'],'FaxQueueId':_0x417f31['id'],'interface':util[_0x5497('0x4f')](_0x5497('0x50'),_0x5497('0x51'),_0x53eafd[_0x5497('0x1f')]),'penalty':0x0,'paused':_0x53eafd[_0x5497('0x4e')],'createdAt':_0x53eafd[_0x5497('0x52')],'updatedAt':_0x53eafd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5497('0x18')](respondWithFilteredResult(_0x55f654,_0x3cbe4b))[_0x5497('0x34')](handleError(_0x55f654,null));};exports[_0x5497('0x53')]=function(_0xc783ce,_0x4b86a8){var _0x179be4={};var _0x1164df={};var _0x451a02;var _0x5b5298;return db['FaxQueue'][_0x5497('0x3f')]({'where':{'id':_0xc783ce[_0x5497('0x2a')]['id']}})[_0x5497('0x18')](handleEntityNotFound(_0x4b86a8,null))['then'](function(_0x1ab48f){if(_0x1ab48f){_0x451a02=_0x1ab48f;_0x1164df['model']=_['keys'](db['Team'][_0x5497('0x24')]);_0x1164df[_0x5497('0x2c')]=_[_0x5497('0x2b')](_0xc783ce['query']);_0x1164df[_0x5497('0x41')]=_[_0x5497('0x2d')](_0x1164df[_0x5497('0x2e')],_0x1164df[_0x5497('0x2c')]);_0x179be4['attributes']=_[_0x5497('0x2d')](_0x1164df[_0x5497('0x2e')],qs[_0x5497('0x30')](_0xc783ce['query'][_0x5497('0x30')]));_0x179be4[_0x5497('0x2f')]=_0x179be4[_0x5497('0x2f')][_0x5497('0x31')]?_0x179be4[_0x5497('0x2f')]:_0x1164df[_0x5497('0x2e')];_0x179be4[_0x5497('0x44')]=qs['sort'](_0xc783ce[_0x5497('0x2c')][_0x5497('0x45')]);_0x179be4[_0x5497('0x46')]=qs[_0x5497('0x41')](_['pick'](_0xc783ce['query'],_0x1164df['filters']));if(_0xc783ce[_0x5497('0x2c')][_0x5497('0x47')]){_0x179be4[_0x5497('0x46')]=_['merge'](_0x179be4[_0x5497('0x46')],{'$or':_[_0x5497('0x22')](_0x179be4[_0x5497('0x2f')],function(_0x464df3){var _0x3e92fb={};_0x3e92fb[_0x464df3]={'$like':'%'+_0xc783ce[_0x5497('0x2c')][_0x5497('0x47')]+'%'};return _0x3e92fb;})});}_0x179be4=_[_0x5497('0x48')]({},_0x179be4,_0xc783ce[_0x5497('0x32')]);return _0x451a02[_0x5497('0x53')](_0x179be4);}})[_0x5497('0x18')](function(_0x5a8b3a){if(_0x5a8b3a){_0x5b5298=_0x5a8b3a[_0x5497('0x31')];if(!_0xc783ce[_0x5497('0x2c')][_0x5497('0x42')]('nolimit')){_0x179be4[_0x5497('0x14')]=qs['limit'](_0xc783ce[_0x5497('0x2c')][_0x5497('0x14')]);_0x179be4['offset']=qs[_0x5497('0x12')](_0xc783ce[_0x5497('0x2c')][_0x5497('0x12')]);}return _0x451a02[_0x5497('0x53')](_0x179be4);}})['then'](function(_0x275a53){if(_0x275a53){return _0x275a53?{'count':_0x5b5298,'rows':_0x275a53}:null;}})[_0x5497('0x18')](respondWithResult(_0x4b86a8,null))[_0x5497('0x34')](handleError(_0x4b86a8,null));};exports['addTeams']=function(_0x53c450,_0x186165){var _0x53ebd4=_0x53c450[_0x5497('0x3d')][_0x5497('0x54')];return db[_0x5497('0x55')]['findAll']({'where':{'id':_0x53ebd4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5497('0x56'),'attributes':['id',_0x5497('0x1f'),_0x5497('0x57'),_0x5497('0x58'),_0x5497('0x59')],'raw':!![]}]})[_0x5497('0x18')](function(_0x13f1b7){if(_0x13f1b7){var _0x4e4d70=_['flatMap'](_0x13f1b7,function(_0x166daa){var _0x24a160=_0x166daa['get']({'plain':!![]});return _0x24a160[_0x5497('0x56')];});return db[_0x5497('0x23')][_0x5497('0x33')]({'where':{'id':_0x53c450['params']['id']}})[_0x5497('0x18')](function(_0x3e1e7f){return db['sequelize'][_0x5497('0x5a')](function(_0x16e2cf){return _0x3e1e7f[_0x5497('0x5b')](_0x53ebd4,{'transaction':_0x16e2cf})[_0x5497('0x18')](function(){return BPromise[_0x5497('0x5c')](_0x4e4d70,function(_0x552a29){return db[_0x5497('0x40')][_0x5497('0x5d')]({'where':{'UserId':_0x552a29['id'],'FaxQueueId':_0x53c450[_0x5497('0x2a')]['id']},'transaction':_0x16e2cf});});})[_0x5497('0x18')](function(){_0x4e4d70[_0x5497('0x5e')](function(_0x503a51){socket[_0x5497('0x5f')](_0x5497('0x60'),{'UserId':_0x503a51['id'],'FaxQueueId':_0x3e1e7f['id']});});});});});}})[_0x5497('0x18')](respondWithStatusCode(_0x186165,null))[_0x5497('0x34')](handleError(_0x186165,null));};exports['removeTeams']=function(_0x71a9d1,_0x21fc4e){return db['Team'][_0x5497('0x49')]({'where':{'id':_0x71a9d1[_0x5497('0x2c')][_0x5497('0x54')]},'attributes':['id'],'include':[{'model':db[_0x5497('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fc4e,null))['then'](function(_0x5343d5){var _0x594761=_[_0x5497('0x22')](_0x5343d5,'id');var _0x2375cc=[];var _0x15d0da=[];var _0x1f02d3=squel[_0x5497('0x61')]();_0x1f02d3['field']('tq.TeamId')[_0x5497('0x62')](_0x5497('0x63'),'tq')[_0x5497('0x64')](_0x5497('0x65'),'ut',_0x5497('0x66'))[_0x5497('0x46')](_0x5497('0x67'),_0x71a9d1[_0x5497('0x2a')]['id']);for(var _0x2aae94=0x0;_0x2aae94<_0x5343d5[_0x5497('0x31')];_0x2aae94+=0x1){let _0x4c41c4=_0x5343d5[_0x2aae94];for(var _0x1515f1=0x0;_0x1515f1<_0x4c41c4[_0x5497('0x56')][_0x5497('0x31')];_0x1515f1+=0x1){let _0x25f06e=_0x4c41c4[_0x5497('0x56')][_0x1515f1];var _0x22b019=_0x1f02d3['clone']();_0x22b019[_0x5497('0x46')]('ut.UserId\x20=\x20?',_0x25f06e['id']);_0x15d0da[_0x5497('0x68')](db[_0x5497('0x69')][_0x5497('0x2c')](_0x22b019['toString'](),{'type':db['sequelize'][_0x5497('0x6a')][_0x5497('0x6b')]})[_0x5497('0x18')](function(_0xeb52c9){if(_0xeb52c9[_0x5497('0x31')]===0x1){return _0x25f06e['id'];}else{var _0x1876d2=_[_0x5497('0x6c')](_[_0x5497('0x22')](_0xeb52c9,'TeamId'),function(_0x53257a){return _['includes'](_0x594761,_0x53257a);});if(_0x1876d2){return _0x25f06e['id'];}}}));}}return BPromise[_0x5497('0x6d')](_0x15d0da)[_0x5497('0x18')](function(_0x160b4b){_0x2375cc=_(_0x2375cc)[_0x5497('0x6e')](_0x160b4b)['compact']()['value']();return db[_0x5497('0x23')][_0x5497('0x33')]({'where':{'id':_0x71a9d1['params']['id']}})[_0x5497('0x18')](function(_0x2fc11a){return db[_0x5497('0x69')][_0x5497('0x5a')](function(_0x51e9fb){return _0x2fc11a['removeTeams'](_0x71a9d1['query']['ids'],{'transaction':_0x51e9fb})['then'](function(){if(!_[_0x5497('0x6f')](_0x2375cc)){return _0x2fc11a['removeAgents'](_0x2375cc,{'transaction':_0x51e9fb});}})[_0x5497('0x18')](function(){_0x2375cc['forEach'](function(_0x2a1424){socket[_0x5497('0x5f')](_0x5497('0x70'),{'UserId':_0x2a1424,'FaxQueueId':_0x2fc11a['id']});});});});});});})[_0x5497('0x18')](respondWithStatusCode(_0x21fc4e,null))[_0x5497('0x34')](handleError(_0x21fc4e,null));};exports[_0x5497('0x71')]=function(_0x525fe6,_0x77d52c){return db['FaxQueue'][_0x5497('0x33')]({'where':{'id':_0x525fe6[_0x5497('0x2a')]['id']}})[_0x5497('0x18')](handleEntityNotFound(_0x77d52c,null))[_0x5497('0x18')](function(_0x33cd5a){if(_0x33cd5a){return _0x33cd5a[_0x5497('0x71')](_0x525fe6[_0x5497('0x3d')][_0x5497('0x54')],_[_0x5497('0x72')](_0x525fe6[_0x5497('0x3d')],['ids','id'])||{})[_0x5497('0x73')](function(_0x556699){for(var _0x41ec68=0x0;_0x41ec68<_0x525fe6[_0x5497('0x3d')]['ids'][_0x5497('0x31')];_0x41ec68+=0x1){socket[_0x5497('0x5f')](_0x5497('0x60'),{'UserId':Number(_0x525fe6[_0x5497('0x3d')][_0x5497('0x54')][_0x41ec68]),'FaxQueueId':Number(_0x525fe6[_0x5497('0x2a')]['id'])});}return _0x556699;});}})[_0x5497('0x18')](respondWithResult(_0x77d52c,null))[_0x5497('0x34')](handleError(_0x77d52c,null));};exports[_0x5497('0x74')]=function(_0x188fc1,_0x208a62){return db[_0x5497('0x23')][_0x5497('0x33')]({'where':{'id':_0x188fc1[_0x5497('0x2a')]['id']}})['then'](handleEntityNotFound(_0x208a62,null))[_0x5497('0x18')](function(_0x163b5b){if(_0x163b5b){return _0x163b5b[_0x5497('0x74')](_0x188fc1[_0x5497('0x2c')][_0x5497('0x54')])['then'](function(){if(_[_0x5497('0x75')](_0x188fc1[_0x5497('0x2c')]['ids'])){for(var _0x58fe2a=0x0;_0x58fe2a<_0x188fc1[_0x5497('0x2c')][_0x5497('0x54')][_0x5497('0x31')];_0x58fe2a+=0x1){socket[_0x5497('0x5f')](_0x5497('0x70'),{'UserId':Number(_0x188fc1['query']['ids'][_0x58fe2a]),'FaxQueueId':Number(_0x188fc1[_0x5497('0x2a')]['id'])});}}else{socket['emit'](_0x5497('0x70'),{'UserId':Number(_0x188fc1[_0x5497('0x2c')][_0x5497('0x54')]),'FaxQueueId':Number(_0x188fc1[_0x5497('0x2a')]['id'])});}});}})[_0x5497('0x18')](respondWithStatusCode(_0x208a62,null))[_0x5497('0x34')](handleError(_0x208a62,null));};exports['getAgents']=function(_0x49df29,_0x85a1fa){var _0x40fce7={};var _0x1fd971={};var _0x48d628;var _0x2b26bc;return db['FaxQueue'][_0x5497('0x3f')]({'where':{'id':_0x49df29['params']['id']}})['then'](handleEntityNotFound(_0x85a1fa,null))[_0x5497('0x18')](function(_0x2aa9fa){if(_0x2aa9fa){_0x48d628=_0x2aa9fa;_0x1fd971['model']=_[_0x5497('0x2b')](db[_0x5497('0x4a')][_0x5497('0x24')]);_0x1fd971[_0x5497('0x2c')]=_['keys'](_0x49df29[_0x5497('0x2c')]);_0x1fd971[_0x5497('0x41')]=_[_0x5497('0x2d')](_0x1fd971[_0x5497('0x2e')],_0x1fd971[_0x5497('0x2c')]);_0x40fce7['attributes']=_[_0x5497('0x2d')](_0x1fd971['model'],qs[_0x5497('0x30')](_0x49df29[_0x5497('0x2c')][_0x5497('0x30')]));_0x40fce7[_0x5497('0x2f')]=_0x40fce7[_0x5497('0x2f')][_0x5497('0x31')]?_0x40fce7[_0x5497('0x2f')]:_0x1fd971[_0x5497('0x2e')];_0x40fce7[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x49df29[_0x5497('0x2c')]['sort']);_0x40fce7[_0x5497('0x46')]=qs[_0x5497('0x41')](_[_0x5497('0x76')](_0x49df29[_0x5497('0x2c')],_0x1fd971[_0x5497('0x41')]));if(_0x49df29[_0x5497('0x2c')][_0x5497('0x47')]){_0x40fce7[_0x5497('0x46')]=_[_0x5497('0x48')](_0x40fce7[_0x5497('0x46')],{'$or':_[_0x5497('0x22')](_0x40fce7['attributes'],function(_0xfc6e84){var _0x420407={};_0x420407[_0xfc6e84]={'$like':'%'+_0x49df29[_0x5497('0x2c')][_0x5497('0x47')]+'%'};return _0x420407;})});}_0x40fce7=_[_0x5497('0x48')]({},_0x40fce7,_0x49df29[_0x5497('0x32')]);return _0x48d628[_0x5497('0x77')](_0x40fce7);}})[_0x5497('0x18')](function(_0x2f10b0){if(_0x2f10b0){_0x2b26bc=_0x2f10b0[_0x5497('0x31')];if(!_0x49df29[_0x5497('0x2c')][_0x5497('0x42')](_0x5497('0x43'))){_0x40fce7[_0x5497('0x14')]=qs['limit'](_0x49df29['query'][_0x5497('0x14')]);_0x40fce7[_0x5497('0x12')]=qs[_0x5497('0x12')](_0x49df29['query'][_0x5497('0x12')]);}return _0x48d628[_0x5497('0x77')](_0x40fce7);}})[_0x5497('0x18')](function(_0x2bd48c){if(_0x2bd48c){return _0x2bd48c?{'count':_0x2b26bc,'rows':_0x2bd48c}:null;}})[_0x5497('0x18')](respondWithResult(_0x85a1fa,null))[_0x5497('0x34')](handleError(_0x85a1fa,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9a48c55..2653680 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 _0xdd78=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xdd78,0xbc));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8dd7('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8dd7('0x1')](0x0);var events={'afterCreate':_0x8dd7('0x2'),'afterUpdate':_0x8dd7('0x3'),'afterDestroy':_0x8dd7('0x4')};function emitEvent(_0x4774a9){return function(_0x183e7e,_0x2095e9,_0x3d261d){FaxQueueEvents[_0x8dd7('0x5')](_0x4774a9+':'+_0x183e7e['id'],_0x183e7e);FaxQueueEvents['emit'](_0x4774a9,_0x183e7e);_0x3d261d(null);};}for(var e in events){if(events[_0x8dd7('0x6')](e)){var event=events[e];FaxQueue[_0x8dd7('0x7')](e,emitEvent(event));}}module[_0x8dd7('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xbec7=['hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0xbec7,0x11a));var _0x7bec=function(_0x3d22e6,_0x5ee433){_0x3d22e6=_0x3d22e6-0x0;var _0xd3fe64=_0xbec7[_0x3d22e6];return _0xd3fe64;};'use strict';var EventEmitter=require(_0x7bec('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x7bec('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7bec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bec('0x3'),'afterDestroy':_0x7bec('0x4')};function emitEvent(_0x4cce67){return function(_0x450529,_0x531345,_0x571b00){FaxQueueEvents[_0x7bec('0x5')](_0x4cce67+':'+_0x450529['id'],_0x450529);FaxQueueEvents[_0x7bec('0x5')](_0x4cce67,_0x450529);_0x571b00(null);};}for(var e in events){if(events[_0x7bec('0x6')](e)){var event=events[e];FaxQueue[_0x7bec('0x7')](e,emitEvent(event));}}module[_0x7bec('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 86881aa..2ea795a 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 _0xf3a7=['bluebird','request-promise','../../config/environment','exports','define','FaxQueue','fax_queues','util','../../config/logger','api'];(function(_0x41bbaa,_0x532d97){var _0x2f639f=function(_0xa577a3){while(--_0xa577a3){_0x41bbaa['push'](_0x41bbaa['shift']());}};_0x2f639f(++_0x532d97);}(_0xf3a7,0x9d));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7f3a('0x0'));var logger=require(_0x7f3a('0x1'))(_0x7f3a('0x2'));var moment=require('moment');var BPromise=require(_0x7f3a('0x3'));var rp=require(_0x7f3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f3a('0x5'));var attributes=require('./faxQueue.attributes');module[_0x7f3a('0x6')]=function(_0x2fc91b,_0x32de40){return _0x2fc91b[_0x7f3a('0x7')](_0x7f3a('0x8'),attributes,{'tableName':_0x7f3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f1=['fax_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue'];(function(_0x304d85,_0x3bd383){var _0x570077=function(_0x59944d){while(--_0x59944d){_0x304d85['push'](_0x304d85['shift']());}};_0x570077(++_0x3bd383);}(_0xc4f1,0x109));var _0x1c4f=function(_0x215499,_0xc2ac8b){_0x215499=_0x215499-0x0;var _0x4724d2=_0xc4f1[_0x215499];return _0x4724d2;};'use strict';var _=require('lodash');var util=require(_0x1c4f('0x0'));var logger=require('../../config/logger')(_0x1c4f('0x1'));var moment=require(_0x1c4f('0x2'));var BPromise=require(_0x1c4f('0x3'));var rp=require(_0x1c4f('0x4'));var fs=require('fs');var path=require(_0x1c4f('0x5'));var rimraf=require(_0x1c4f('0x6'));var config=require(_0x1c4f('0x7'));var attributes=require(_0x1c4f('0x8'));module['exports']=function(_0x157c21,_0x1ba73f){return _0x157c21[_0x1c4f('0x9')](_0x1c4f('0xa'),attributes,{'tableName':_0x1c4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 3985d78..0925d70 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 _0xd780=['FaxQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','raw','options','attributes','include','model','map','ShowFaxQueue'];(function(_0x36f549,_0x38e28e){var _0x362522=function(_0x40d40c){while(--_0x40d40c){_0x36f549['push'](_0x36f549['shift']());}};_0x362522(++_0x38e28e);}(_0xd780,0x11b));var _0x0d78=function(_0x380d59,_0x4fd2df){_0x380d59=_0x380d59-0x0;var _0x317190=_0xd780[_0x380d59];return _0x317190;};'use strict';var _=require(_0x0d78('0x0'));var util=require(_0x0d78('0x1'));var moment=require(_0x0d78('0x2'));var BPromise=require(_0x0d78('0x3'));var rs=require(_0x0d78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d78('0x5'))['db'];var utils=require(_0x0d78('0x6'));var logger=require(_0x0d78('0x7'))('rpc');var config=require(_0x0d78('0x8'));var jayson=require(_0x0d78('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0d78('0xa')]=_[_0x0d78('0xb')](config[_0x0d78('0xa')],{'host':_0x0d78('0xc'),'port':0x18eb});var socket=require(_0x0d78('0xd'))(new Redis(config[_0x0d78('0xa')]));require(_0x0d78('0xe'))['register'](socket);function respondWithRpcPromise(_0x3542be,_0x18a7bd,_0x424e80){return new BPromise(function(_0x4d6f9a,_0x528e2d){return client[_0x0d78('0xf')](_0x3542be,_0x424e80)[_0x0d78('0x10')](function(_0x1fc7c5){logger[_0x0d78('0x11')](_0x0d78('0x12'),_0x18a7bd,_0x0d78('0x13'));logger[_0x0d78('0x14')](_0x0d78('0x15'),_0x18a7bd,'request\x20sent',JSON[_0x0d78('0x16')](_0x1fc7c5));if(_0x1fc7c5[_0x0d78('0x17')]){if(_0x1fc7c5['error'][_0x0d78('0x18')]===0x1f4){logger[_0x0d78('0x17')](_0x0d78('0x12'),_0x18a7bd,_0x1fc7c5[_0x0d78('0x17')][_0x0d78('0x19')]);return _0x528e2d(_0x1fc7c5[_0x0d78('0x17')]['message']);}logger[_0x0d78('0x17')]('FaxQueue,\x20%s,\x20%s',_0x18a7bd,_0x1fc7c5['error'][_0x0d78('0x19')]);return _0x4d6f9a(_0x1fc7c5[_0x0d78('0x17')][_0x0d78('0x19')]);}else{logger['info'](_0x0d78('0x12'),_0x18a7bd,_0x0d78('0x13'));_0x4d6f9a(_0x1fc7c5[_0x0d78('0x1a')][_0x0d78('0x19')]);}})[_0x0d78('0x1b')](function(_0x5d5309){logger[_0x0d78('0x17')](_0x0d78('0x12'),_0x18a7bd,_0x5d5309);_0x528e2d(_0x5d5309);});});}exports[_0x0d78('0x1c')]=function(_0x5e2160){var _0x2dfccd=this;return new Promise(function(_0x1b72c9,_0xf9027a){return db['FaxQueue'][_0x0d78('0x1d')]({'raw':_0x5e2160['options']?_0x5e2160['options'][_0x0d78('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e2160[_0x0d78('0x1f')]?_0x5e2160[_0x0d78('0x1f')]['where']||null:null,'attributes':_0x5e2160['options']?_0x5e2160['options'][_0x0d78('0x20')]||null:null,'limit':_0x5e2160['options']?_0x5e2160[_0x0d78('0x1f')]['limit']||null:null,'include':_0x5e2160['options']?_0x5e2160[_0x0d78('0x1f')][_0x0d78('0x21')]?_['map'](_0x5e2160[_0x0d78('0x1f')][_0x0d78('0x21')],function(_0x25b2d4){return{'model':db[_0x25b2d4[_0x0d78('0x22')]],'as':_0x25b2d4['as'],'attributes':_0x25b2d4[_0x0d78('0x20')],'include':_0x25b2d4[_0x0d78('0x21')]?_[_0x0d78('0x23')](_0x25b2d4[_0x0d78('0x21')],function(_0x251aa0){return{'model':db[_0x251aa0['model']],'as':_0x251aa0['as'],'attributes':_0x251aa0['attributes'],'include':_0x251aa0[_0x0d78('0x21')]?_[_0x0d78('0x23')](_0x251aa0[_0x0d78('0x21')],function(_0x383264){return{'model':db[_0x383264[_0x0d78('0x22')]],'as':_0x383264['as'],'attributes':_0x383264[_0x0d78('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0d78('0x10')](function(_0x23a737){logger['info'](_0x0d78('0x1c'),_0x5e2160);logger[_0x0d78('0x14')](_0x0d78('0x1c'),_0x5e2160,JSON[_0x0d78('0x16')](_0x23a737));_0x1b72c9(_0x23a737);})[_0x0d78('0x1b')](function(_0x5bc65b){logger[_0x0d78('0x17')]('GetFaxQueue',_0x5bc65b[_0x0d78('0x19')],_0x5e2160);_0xf9027a(_0x2dfccd[_0x0d78('0x17')](0x1f4,_0x5bc65b[_0x0d78('0x19')]));});});};exports[_0x0d78('0x24')]=function(_0x28eb0b){var _0x35c6b5=this;return new Promise(function(_0x4249f3,_0x2df898){return db[_0x0d78('0x25')][_0x0d78('0x26')]({'raw':_0x28eb0b[_0x0d78('0x1f')]?_0x28eb0b[_0x0d78('0x1f')][_0x0d78('0x1e')]===undefined?!![]:![]:!![],'where':_0x28eb0b[_0x0d78('0x1f')]?_0x28eb0b[_0x0d78('0x1f')][_0x0d78('0x27')]||null:null,'attributes':_0x28eb0b[_0x0d78('0x1f')]?_0x28eb0b[_0x0d78('0x1f')][_0x0d78('0x20')]||null:null,'include':_0x28eb0b[_0x0d78('0x1f')]?_0x28eb0b[_0x0d78('0x1f')][_0x0d78('0x21')]?_[_0x0d78('0x23')](_0x28eb0b[_0x0d78('0x1f')][_0x0d78('0x21')],function(_0x1efcf7){return{'model':db[_0x1efcf7[_0x0d78('0x22')]],'as':_0x1efcf7['as'],'attributes':_0x1efcf7[_0x0d78('0x20')],'include':_0x1efcf7[_0x0d78('0x21')]?_['map'](_0x1efcf7['include'],function(_0xdd4ea9){return{'model':db[_0xdd4ea9[_0x0d78('0x22')]],'as':_0xdd4ea9['as'],'attributes':_0xdd4ea9[_0x0d78('0x20')],'include':_0xdd4ea9['include']?_[_0x0d78('0x23')](_0xdd4ea9['include'],function(_0x4d73e2){return{'model':db[_0x4d73e2[_0x0d78('0x22')]],'as':_0x4d73e2['as'],'attributes':_0x4d73e2[_0x0d78('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0d78('0x10')](function(_0x188c9d){logger[_0x0d78('0x11')]('ShowFaxQueue',_0x28eb0b);logger['debug']('ShowFaxQueue',_0x28eb0b,JSON[_0x0d78('0x16')](_0x188c9d));_0x4249f3(_0x188c9d);})[_0x0d78('0x1b')](function(_0x2c5637){logger['error'](_0x0d78('0x24'),_0x2c5637[_0x0d78('0x19')],_0x28eb0b);_0x2df898(_0x35c6b5['error'](0x1f4,_0x2c5637[_0x0d78('0x19')]));});});}; \ No newline at end of file +var _0xa5ae=['attributes','limit','include','map','model','stringify','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x3178f6,_0x8df792){var _0x431cea=function(_0x2ca19a){while(--_0x2ca19a){_0x3178f6['push'](_0x3178f6['shift']());}};_0x431cea(++_0x8df792);}(_0xa5ae,0xc1));var _0xea5a=function(_0x361475,_0x32ecc5){_0x361475=_0x361475-0x0;var _0x317cf1=_0xa5ae[_0x361475];return _0x317cf1;};'use strict';var _=require(_0xea5a('0x0'));var util=require(_0xea5a('0x1'));var moment=require(_0xea5a('0x2'));var BPromise=require(_0xea5a('0x3'));var rs=require(_0xea5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea5a('0x5'))['db'];var utils=require(_0xea5a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xea5a('0x7'));var jayson=require(_0xea5a('0x8'));var client=jayson['client'][_0xea5a('0x9')]({'port':0x232a});config[_0xea5a('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea5a('0xa')]));require(_0xea5a('0xb'))[_0xea5a('0xc')](socket);function respondWithRpcPromise(_0x10d9fd,_0x531d89,_0x55ce67){return new BPromise(function(_0x10711c,_0x1c2554){return client[_0xea5a('0xd')](_0x10d9fd,_0x55ce67)[_0xea5a('0xe')](function(_0x596418){logger[_0xea5a('0xf')](_0xea5a('0x10'),_0x531d89,_0xea5a('0x11'));logger[_0xea5a('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x531d89,_0xea5a('0x11'),JSON['stringify'](_0x596418));if(_0x596418[_0xea5a('0x13')]){if(_0x596418[_0xea5a('0x13')][_0xea5a('0x14')]===0x1f4){logger[_0xea5a('0x13')]('FaxQueue,\x20%s,\x20%s',_0x531d89,_0x596418['error'][_0xea5a('0x15')]);return _0x1c2554(_0x596418[_0xea5a('0x13')]['message']);}logger[_0xea5a('0x13')]('FaxQueue,\x20%s,\x20%s',_0x531d89,_0x596418[_0xea5a('0x13')]['message']);return _0x10711c(_0x596418[_0xea5a('0x13')][_0xea5a('0x15')]);}else{logger[_0xea5a('0xf')](_0xea5a('0x10'),_0x531d89,_0xea5a('0x11'));_0x10711c(_0x596418['result'][_0xea5a('0x15')]);}})[_0xea5a('0x16')](function(_0x1574f1){logger[_0xea5a('0x13')](_0xea5a('0x10'),_0x531d89,_0x1574f1);_0x1c2554(_0x1574f1);});});}exports[_0xea5a('0x17')]=function(_0x388f52){var _0x400fc0=this;return new Promise(function(_0x222b0b,_0x5b89ce){return db[_0xea5a('0x18')][_0xea5a('0x19')]({'raw':_0x388f52['options']?_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1b')]===undefined?!![]:![]:!![],'where':_0x388f52['options']?_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1c')]||null:null,'attributes':_0x388f52[_0xea5a('0x1a')]?_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1d')]||null:null,'limit':_0x388f52[_0xea5a('0x1a')]?_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1e')]||null:null,'include':_0x388f52['options']?_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1f')]?_[_0xea5a('0x20')](_0x388f52[_0xea5a('0x1a')][_0xea5a('0x1f')],function(_0xee22fd){return{'model':db[_0xee22fd['model']],'as':_0xee22fd['as'],'attributes':_0xee22fd[_0xea5a('0x1d')],'include':_0xee22fd['include']?_[_0xea5a('0x20')](_0xee22fd[_0xea5a('0x1f')],function(_0x59bba4){return{'model':db[_0x59bba4[_0xea5a('0x21')]],'as':_0x59bba4['as'],'attributes':_0x59bba4[_0xea5a('0x1d')],'include':_0x59bba4[_0xea5a('0x1f')]?_[_0xea5a('0x20')](_0x59bba4[_0xea5a('0x1f')],function(_0x34c3f0){return{'model':db[_0x34c3f0[_0xea5a('0x21')]],'as':_0x34c3f0['as'],'attributes':_0x34c3f0[_0xea5a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dae6c){logger[_0xea5a('0xf')](_0xea5a('0x17'),_0x388f52);logger[_0xea5a('0x12')](_0xea5a('0x17'),_0x388f52,JSON[_0xea5a('0x22')](_0x4dae6c));_0x222b0b(_0x4dae6c);})[_0xea5a('0x16')](function(_0x51d2d0){logger['error'](_0xea5a('0x17'),_0x51d2d0[_0xea5a('0x15')],_0x388f52);_0x5b89ce(_0x400fc0[_0xea5a('0x13')](0x1f4,_0x51d2d0[_0xea5a('0x15')]));});});};exports[_0xea5a('0x23')]=function(_0x1a5ff1){var _0x5ec0f5=this;return new Promise(function(_0x4171e3,_0x42986a){return db[_0xea5a('0x18')][_0xea5a('0x24')]({'raw':_0x1a5ff1[_0xea5a('0x1a')]?_0x1a5ff1['options'][_0xea5a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a5ff1[_0xea5a('0x1a')]?_0x1a5ff1[_0xea5a('0x1a')]['where']||null:null,'attributes':_0x1a5ff1[_0xea5a('0x1a')]?_0x1a5ff1['options'][_0xea5a('0x1d')]||null:null,'include':_0x1a5ff1[_0xea5a('0x1a')]?_0x1a5ff1[_0xea5a('0x1a')]['include']?_[_0xea5a('0x20')](_0x1a5ff1[_0xea5a('0x1a')][_0xea5a('0x1f')],function(_0xbbd41b){return{'model':db[_0xbbd41b['model']],'as':_0xbbd41b['as'],'attributes':_0xbbd41b[_0xea5a('0x1d')],'include':_0xbbd41b['include']?_[_0xea5a('0x20')](_0xbbd41b['include'],function(_0x1425c3){return{'model':db[_0x1425c3[_0xea5a('0x21')]],'as':_0x1425c3['as'],'attributes':_0x1425c3[_0xea5a('0x1d')],'include':_0x1425c3[_0xea5a('0x1f')]?_[_0xea5a('0x20')](_0x1425c3[_0xea5a('0x1f')],function(_0x4a3ba2){return{'model':db[_0x4a3ba2[_0xea5a('0x21')]],'as':_0x4a3ba2['as'],'attributes':_0x4a3ba2[_0xea5a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xea5a('0xe')](function(_0x3d2da7){logger[_0xea5a('0xf')](_0xea5a('0x23'),_0x1a5ff1);logger[_0xea5a('0x12')]('ShowFaxQueue',_0x1a5ff1,JSON[_0xea5a('0x22')](_0x3d2da7));_0x4171e3(_0x3d2da7);})['catch'](function(_0x4a2a3d){logger[_0xea5a('0x13')](_0xea5a('0x23'),_0x4a2a3d[_0xea5a('0x15')],_0x1a5ff1);_0x42986a(_0x5ec0f5[_0xea5a('0x13')](0x1f4,_0x4a2a3d[_0xea5a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4350b4b..633c239 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 _0xe920=['./faxQueue.events','emit','register','faxQueue:'];(function(_0x1cd65a,_0x29fa8f){var _0xf93849=function(_0x29fbe1){while(--_0x29fbe1){_0x1cd65a['push'](_0x1cd65a['shift']());}};_0xf93849(++_0x29fa8f);}(_0xe920,0x11c));var _0x0e92=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xe920[_0x4327fe];return _0x138651;};'use strict';var FaxQueueEvents=require(_0x0e92('0x0'));var events=['save','remove','update'];function createListener(_0x134e2b,_0x2dad24){return function(_0x3904ef){_0x2dad24[_0x0e92('0x1')](_0x134e2b,_0x3904ef);};}function removeListener(_0x2975d2,_0x3c1136){return function(){FaxQueueEvents['removeListener'](_0x2975d2,_0x3c1136);};}exports[_0x0e92('0x2')]=function(_0xfdfcfe){for(var _0x20020a=0x0,_0xcb25c4=events['length'];_0x20020a<_0xcb25c4;_0x20020a++){var _0x4ce78c=events[_0x20020a];var _0xb81ed8=createListener(_0x0e92('0x3')+_0x4ce78c,_0xfdfcfe);FaxQueueEvents['on'](_0x4ce78c,_0xb81ed8);}}; \ No newline at end of file +var _0xa175=['remove','update','emit','removeListener','register','faxQueue:','save'];(function(_0x3a5ef2,_0x2da6d0){var _0x5754a1=function(_0x14b1f8){while(--_0x14b1f8){_0x3a5ef2['push'](_0x3a5ef2['shift']());}};_0x5754a1(++_0x2da6d0);}(_0xa175,0x15d));var _0x5a17=function(_0x328324,_0x3ff2d4){_0x328324=_0x328324-0x0;var _0x16014f=_0xa175[_0x328324];return _0x16014f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5a17('0x0'),_0x5a17('0x1'),_0x5a17('0x2')];function createListener(_0x11f3d9,_0xd29842){return function(_0x5e2873){_0xd29842[_0x5a17('0x3')](_0x11f3d9,_0x5e2873);};}function removeListener(_0x59bdd9,_0x1b8544){return function(){FaxQueueEvents[_0x5a17('0x4')](_0x59bdd9,_0x1b8544);};}exports[_0x5a17('0x5')]=function(_0x372d1b){for(var _0x3d425c=0x0,_0x6bf12f=events['length'];_0x3d425c<_0x6bf12f;_0x3d425c++){var _0x38b8d1=events[_0x3d425c];var _0x21e69d=createListener(_0x5a17('0x6')+_0x38b8d1,_0x372d1b);FaxQueueEvents['on'](_0x38b8d1,_0x21e69d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 791c883..3f6484e 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 _0xf2e3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','delete','destroy','removeAgents','exports'];(function(_0x236e03,_0x37677e){var _0x41b264=function(_0x253d48){while(--_0x253d48){_0x236e03['push'](_0x236e03['shift']());}};_0x41b264(++_0x37677e);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf2e3[_0x62c958];return _0x57ec61;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0xc')](_0x3f2e('0x11'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0xc')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0xc')]('/:id/users',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x15')]);router['post']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x16')]);router[_0x3f2e('0x17')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller['addTeams']);router[_0x3f2e('0x17')](_0x3f2e('0x18'),auth[_0x3f2e('0xa')](),controller['addAgents']);router[_0x3f2e('0x19')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1a')]);router[_0x3f2e('0x1b')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1c')]);router[_0x3f2e('0x1b')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller['removeTeams']);router[_0x3f2e('0x1b')](_0x3f2e('0x18'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1d')]);module[_0x3f2e('0x1e')]=router; \ No newline at end of file +var _0x4351=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addAgents','put','update','delete','destroy'];(function(_0x1f533c,_0x5a786d){var _0x46de54=function(_0x4c846d){while(--_0x4c846d){_0x1f533c['push'](_0x1f533c['shift']());}};_0x46de54(++_0x5a786d);}(_0x4351,0x1b5));var _0x1435=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4351[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var path=require(_0x1435('0x2'));var timeout=require(_0x1435('0x3'));var express=require(_0x1435('0x4'));var router=express[_0x1435('0x5')]();var fs_extra=require(_0x1435('0x6'));var auth=require(_0x1435('0x7'));var interaction=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var controller=require(_0x1435('0xa'));router[_0x1435('0xb')]('/',auth[_0x1435('0xc')](),controller[_0x1435('0xd')]);router[_0x1435('0xb')]('/describe',auth[_0x1435('0xc')](),controller['describe']);router['get'](_0x1435('0xe'),auth[_0x1435('0xc')](),controller[_0x1435('0xf')]);router[_0x1435('0xb')](_0x1435('0x10'),auth['isAuthenticated'](),controller[_0x1435('0x11')]);router[_0x1435('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1435('0x12')]);router['get'](_0x1435('0x13'),auth['isAuthenticated'](),controller[_0x1435('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1435('0x15')](_0x1435('0x16'),auth[_0x1435('0xc')](),controller['addTeams']);router['post'](_0x1435('0x13'),auth['isAuthenticated'](),controller[_0x1435('0x17')]);router[_0x1435('0x18')](_0x1435('0xe'),auth[_0x1435('0xc')](),controller[_0x1435('0x19')]);router[_0x1435('0x1a')](_0x1435('0xe'),auth[_0x1435('0xc')](),controller[_0x1435('0x1b')]);router[_0x1435('0x1a')](_0x1435('0x16'),auth[_0x1435('0xc')](),controller[_0x1435('0x1c')]);router[_0x1435('0x1a')](_0x1435('0x13'),auth['isAuthenticated'](),controller[_0x1435('0x1d')]);module[_0x1435('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2691931..d24fc03 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 _0xca44=['exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca44,0xb3));var _0x4ca4=function(_0x18e9c7,_0x4c3e5d){_0x18e9c7=_0x18e9c7-0x0;var _0xc3f084=_0xca44[_0x18e9c7];return _0xc3f084;};'use strict';var moment=require(_0x4ca4('0x0'));var Sequelize=require('sequelize');module[_0x4ca4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4ca4('0x2')]},'joinAt':{'type':Sequelize[_0x4ca4('0x3')]},'leaveAt':{'type':Sequelize[_0x4ca4('0x3')]},'acceptAt':{'type':Sequelize[_0x4ca4('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4ca4('0x2')]}}; \ No newline at end of file +var _0x7fd4=['sequelize','STRING','DATE'];(function(_0x175331,_0x2812ee){var _0x56e15c=function(_0x4ecba2){while(--_0x4ecba2){_0x175331['push'](_0x175331['shift']());}};_0x56e15c(++_0x2812ee);}(_0x7fd4,0x177));var _0x47fd=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x7fd4[_0x81dcac];return _0xc7803b;};'use strict';var moment=require('moment');var Sequelize=require(_0x47fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x47fd('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x47fd('0x1')]},'joinAt':{'type':Sequelize[_0x47fd('0x2')]},'leaveAt':{'type':Sequelize[_0x47fd('0x2')]},'acceptAt':{'type':Sequelize[_0x47fd('0x2')]},'exitAt':{'type':Sequelize[_0x47fd('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1e35289..531e76a 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 _0x8e44=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x129b92,_0x38ea5e){var _0x45ec3d=function(_0x3cacf8){while(--_0x3cacf8){_0x129b92['push'](_0x129b92['shift']());}};_0x45ec3d(++_0x38ea5e);}(_0x8e44,0x1ac));var _0x48e4=function(_0x139745,_0x503124){_0x139745=_0x139745-0x0;var _0x2cd695=_0x8e44[_0x139745];return _0x2cd695;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];function respondWithStatusCode(_0x13c61c,_0x55a9ab){_0x55a9ab=_0x55a9ab||0xcc;return function(_0x28c15a){if(_0x28c15a){return _0x13c61c['sendStatus'](_0x55a9ab);}return _0x13c61c[_0x48e4('0x18')](_0x55a9ab)[_0x48e4('0x19')]();};}function respondWithResult(_0x4146f4,_0xb1f558){_0xb1f558=_0xb1f558||0xc8;return function(_0x12f7af){if(_0x12f7af){return _0x4146f4[_0x48e4('0x18')](_0xb1f558)[_0x48e4('0x1a')](_0x12f7af);}};}function respondWithFilteredResult(_0x55ab05,_0x1c82d2){return function(_0x15519c){if(_0x15519c){var _0x5c8fe5=typeof _0x1c82d2[_0x48e4('0x1b')]===_0x48e4('0x1c')&&typeof _0x1c82d2['limit']===_0x48e4('0x1c');var _0x627366=_0x15519c[_0x48e4('0x1d')];var _0x4ffc0d=_0x5c8fe5?0x0:_0x1c82d2[_0x48e4('0x1b')];var _0x16e405=_0x5c8fe5?_0x15519c[_0x48e4('0x1d')]:_0x1c82d2['offset']+_0x1c82d2[_0x48e4('0x1e')];var _0x565916;if(_0x16e405>=_0x627366){_0x16e405=_0x627366;_0x565916=0xc8;}else{_0x565916=0xce;}_0x55ab05['status'](_0x565916);return _0x55ab05[_0x48e4('0x1f')](_0x48e4('0x20'),_0x4ffc0d+'-'+_0x16e405+'/'+_0x627366)[_0x48e4('0x1a')](_0x15519c);}return null;};}function patchUpdates(_0xad2f7d){return function(_0xda50d1){try{jsonpatch['apply'](_0xda50d1,_0xad2f7d,!![]);}catch(_0x59eff5){return BPromise[_0x48e4('0x21')](_0x59eff5);}return _0xda50d1[_0x48e4('0x22')]();};}function saveUpdates(_0x260f1a,_0x131817){return function(_0x846128){if(_0x846128){return _0x846128[_0x48e4('0x23')](_0x260f1a)[_0x48e4('0x24')](function(_0x378573){return _0x378573;});}return null;};}function removeEntity(_0x73f81c,_0x3c0082){return function(_0x1a80ed){if(_0x1a80ed){return _0x1a80ed['destroy']()[_0x48e4('0x24')](function(){_0x73f81c[_0x48e4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2beac2,_0x23b2ba){return function(_0x4abfbc){if(!_0x4abfbc){_0x2beac2[_0x48e4('0x25')](0x194);}return _0x4abfbc;};}function handleError(_0x17aee4,_0x3a446c){_0x3a446c=_0x3a446c||0x1f4;return function(_0xc113e3){logger[_0x48e4('0x26')](_0xc113e3[_0x48e4('0x27')]);if(_0xc113e3[_0x48e4('0x28')]){delete _0xc113e3['name'];}_0x17aee4[_0x48e4('0x18')](_0x3a446c)[_0x48e4('0x29')](_0xc113e3);};}exports['index']=function(_0x5679d9,_0x318d09){var _0x4b8f3c={},_0x346765={},_0x214def={'count':0x0,'rows':[]};var _0x5a7685=_[_0x48e4('0x2a')](db[_0x48e4('0x2b')][_0x48e4('0x2c')],function(_0xea1c5b){return{'name':_0xea1c5b[_0x48e4('0x2d')],'type':_0xea1c5b['type'][_0x48e4('0x2e')]};});_0x346765['model']=_['map'](_0x5a7685,'name');_0x346765[_0x48e4('0x2f')]=_[_0x48e4('0x30')](_0x5679d9[_0x48e4('0x2f')]);_0x346765[_0x48e4('0x31')]=_[_0x48e4('0x32')](_0x346765[_0x48e4('0x33')],_0x346765[_0x48e4('0x2f')]);_0x4b8f3c[_0x48e4('0x34')]=_[_0x48e4('0x32')](_0x346765[_0x48e4('0x33')],qs[_0x48e4('0x35')](_0x5679d9['query']['fields']));_0x4b8f3c['attributes']=_0x4b8f3c[_0x48e4('0x34')][_0x48e4('0x36')]?_0x4b8f3c['attributes']:_0x346765[_0x48e4('0x33')];if(!_0x5679d9[_0x48e4('0x2f')]['hasOwnProperty'](_0x48e4('0x37'))){_0x4b8f3c[_0x48e4('0x1e')]=qs[_0x48e4('0x1e')](_0x5679d9[_0x48e4('0x2f')]['limit']);_0x4b8f3c[_0x48e4('0x1b')]=qs[_0x48e4('0x1b')](_0x5679d9['query']['offset']);}_0x4b8f3c[_0x48e4('0x38')]=qs[_0x48e4('0x39')](_0x5679d9[_0x48e4('0x2f')]['sort']);_0x4b8f3c[_0x48e4('0x3a')]=qs[_0x48e4('0x31')](_['pick'](_0x5679d9[_0x48e4('0x2f')],_0x346765[_0x48e4('0x31')]),_0x5a7685);if(_0x5679d9[_0x48e4('0x2f')][_0x48e4('0x3b')]){_0x4b8f3c[_0x48e4('0x3a')]=_['merge'](_0x4b8f3c[_0x48e4('0x3a')],{'$or':_[_0x48e4('0x2a')](_0x5a7685,function(_0x44f206){if(_0x44f206['type']!==_0x48e4('0x3c')){var _0x557791={};_0x557791[_0x44f206[_0x48e4('0x28')]]={'$like':'%'+_0x5679d9[_0x48e4('0x2f')][_0x48e4('0x3b')]+'%'};return _0x557791;}})});}_0x4b8f3c=_[_0x48e4('0x3d')]({},_0x4b8f3c,_0x5679d9[_0x48e4('0x3e')]);var _0x36c615={'where':_0x4b8f3c[_0x48e4('0x3a')]};return db[_0x48e4('0x2b')][_0x48e4('0x1d')](_0x36c615)[_0x48e4('0x24')](function(_0x1bf553){_0x214def['count']=_0x1bf553;if(_0x5679d9[_0x48e4('0x2f')][_0x48e4('0x3f')]){_0x4b8f3c[_0x48e4('0x40')]=[{'all':!![]}];}return db[_0x48e4('0x2b')][_0x48e4('0x41')](_0x4b8f3c);})[_0x48e4('0x24')](function(_0x186451){_0x214def['rows']=_0x186451;return _0x214def;})[_0x48e4('0x24')](respondWithFilteredResult(_0x318d09,_0x4b8f3c))[_0x48e4('0x42')](handleError(_0x318d09,null));};exports[_0x48e4('0x43')]=function(_0x57390d,_0x1252b2){var _0x331980={'raw':!![],'where':{'id':_0x57390d['params']['id']}},_0x3cc197={};_0x3cc197['model']=_[_0x48e4('0x30')](db[_0x48e4('0x2b')]['rawAttributes']);_0x3cc197[_0x48e4('0x2f')]=_['keys'](_0x57390d['query']);_0x3cc197['filters']=_['intersection'](_0x3cc197[_0x48e4('0x33')],_0x3cc197[_0x48e4('0x2f')]);_0x331980[_0x48e4('0x34')]=_[_0x48e4('0x32')](_0x3cc197[_0x48e4('0x33')],qs[_0x48e4('0x35')](_0x57390d['query'][_0x48e4('0x35')]));_0x331980[_0x48e4('0x34')]=_0x331980['attributes']['length']?_0x331980[_0x48e4('0x34')]:_0x3cc197[_0x48e4('0x33')];if(_0x57390d[_0x48e4('0x2f')][_0x48e4('0x3f')]){_0x331980['include']=[{'all':!![]}];}_0x331980=_[_0x48e4('0x3d')]({},_0x331980,_0x57390d[_0x48e4('0x3e')]);return db[_0x48e4('0x2b')][_0x48e4('0x44')](_0x331980)[_0x48e4('0x24')](handleEntityNotFound(_0x1252b2,null))[_0x48e4('0x24')](respondWithResult(_0x1252b2,null))['catch'](handleError(_0x1252b2,null));};exports[_0x48e4('0x45')]=function(_0x46a119,_0x31ee7b){return db[_0x48e4('0x2b')][_0x48e4('0x45')](_0x46a119[_0x48e4('0x46')],{})[_0x48e4('0x24')](respondWithResult(_0x31ee7b,0xc9))[_0x48e4('0x42')](handleError(_0x31ee7b,null));};exports[_0x48e4('0x23')]=function(_0x2b1d16,_0x2436fb){if(_0x2b1d16['body']['id']){delete _0x2b1d16[_0x48e4('0x46')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2b1d16[_0x48e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x2436fb,null))[_0x48e4('0x24')](saveUpdates(_0x2b1d16[_0x48e4('0x46')],null))[_0x48e4('0x24')](respondWithResult(_0x2436fb,null))[_0x48e4('0x42')](handleError(_0x2436fb,null));};exports[_0x48e4('0x48')]=function(_0xb7525f,_0x10eb0c){return db['FaxQueueReport']['find']({'where':{'id':_0xb7525f[_0x48e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x10eb0c,null))[_0x48e4('0x24')](removeEntity(_0x10eb0c,null))[_0x48e4('0x42')](handleError(_0x10eb0c,null));};exports[_0x48e4('0x49')]=function(_0x545a4d,_0x14ed52){return db[_0x48e4('0x2b')][_0x48e4('0x49')]()['then'](respondWithResult(_0x14ed52,null))[_0x48e4('0x42')](handleError(_0x14ed52,null));}; \ No newline at end of file +var _0xdab2=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body'];(function(_0x46e96f,_0x8179e3){var _0x256dc9=function(_0x35ef2f){while(--_0x35ef2f){_0x46e96f['push'](_0x46e96f['shift']());}};_0x256dc9(++_0x8179e3);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2dab('0x0'));var rimraf=require(_0x2dab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dab('0x2'));var rp=require(_0x2dab('0x3'));var moment=require(_0x2dab('0x4'));var BPromise=require(_0x2dab('0x5'));var Mustache=require('mustache');var util=require(_0x2dab('0x6'));var path=require(_0x2dab('0x7'));var sox=require(_0x2dab('0x8'));var csv=require(_0x2dab('0x9'));var ejs=require(_0x2dab('0xa'));var fs=require('fs');var fs_extra=require(_0x2dab('0xb'));var _=require(_0x2dab('0xc'));var squel=require(_0x2dab('0xd'));var crypto=require(_0x2dab('0xe'));var jsforce=require(_0x2dab('0xf'));var deskjs=require(_0x2dab('0x10'));var toCsv=require(_0x2dab('0x9'));var querystring=require(_0x2dab('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dab('0x12'));var qs=require(_0x2dab('0x13'));var as=require(_0x2dab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2dab('0x15'));var utils=require(_0x2dab('0x16'));var config=require(_0x2dab('0x17'));var licenseUtil=require(_0x2dab('0x18'));var db=require(_0x2dab('0x19'))['db'];function respondWithStatusCode(_0x553435,_0x2653c8){_0x2653c8=_0x2653c8||0xcc;return function(_0x263f53){if(_0x263f53){return _0x553435['sendStatus'](_0x2653c8);}return _0x553435[_0x2dab('0x1a')](_0x2653c8)[_0x2dab('0x1b')]();};}function respondWithResult(_0x1b5161,_0x597a6e){_0x597a6e=_0x597a6e||0xc8;return function(_0x4040d8){if(_0x4040d8){return _0x1b5161[_0x2dab('0x1a')](_0x597a6e)['json'](_0x4040d8);}};}function respondWithFilteredResult(_0x3c00b1,_0x15a9e7){return function(_0x3e8613){if(_0x3e8613){var _0x2f64c8=typeof _0x15a9e7[_0x2dab('0x1c')]==='undefined'&&typeof _0x15a9e7[_0x2dab('0x1d')]===_0x2dab('0x1e');var _0x18d52c=_0x3e8613[_0x2dab('0x1f')];var _0x30bbde=_0x2f64c8?0x0:_0x15a9e7[_0x2dab('0x1c')];var _0x4ff9be=_0x2f64c8?_0x3e8613[_0x2dab('0x1f')]:_0x15a9e7[_0x2dab('0x1c')]+_0x15a9e7[_0x2dab('0x1d')];var _0x5d3c93;if(_0x4ff9be>=_0x18d52c){_0x4ff9be=_0x18d52c;_0x5d3c93=0xc8;}else{_0x5d3c93=0xce;}_0x3c00b1[_0x2dab('0x1a')](_0x5d3c93);return _0x3c00b1[_0x2dab('0x20')](_0x2dab('0x21'),_0x30bbde+'-'+_0x4ff9be+'/'+_0x18d52c)['json'](_0x3e8613);}return null;};}function patchUpdates(_0x477494){return function(_0x14e373){try{jsonpatch[_0x2dab('0x22')](_0x14e373,_0x477494,!![]);}catch(_0x37a4c0){return BPromise[_0x2dab('0x23')](_0x37a4c0);}return _0x14e373[_0x2dab('0x24')]();};}function saveUpdates(_0x528a8c,_0x343bfc){return function(_0x321469){if(_0x321469){return _0x321469['update'](_0x528a8c)[_0x2dab('0x25')](function(_0x3b0b84){return _0x3b0b84;});}return null;};}function removeEntity(_0xf16fec,_0x37cb08){return function(_0x119d38){if(_0x119d38){return _0x119d38[_0x2dab('0x26')]()[_0x2dab('0x25')](function(){_0xf16fec[_0x2dab('0x1a')](0xcc)[_0x2dab('0x1b')]();});}};}function handleEntityNotFound(_0x1b1c5b,_0x50153d){return function(_0x255478){if(!_0x255478){_0x1b1c5b['sendStatus'](0x194);}return _0x255478;};}function handleError(_0xbe611,_0x11454f){_0x11454f=_0x11454f||0x1f4;return function(_0x594f6f){logger[_0x2dab('0x27')](_0x594f6f[_0x2dab('0x28')]);if(_0x594f6f[_0x2dab('0x29')]){delete _0x594f6f[_0x2dab('0x29')];}_0xbe611['status'](_0x11454f)[_0x2dab('0x2a')](_0x594f6f);};}exports[_0x2dab('0x2b')]=function(_0xa93e,_0x2b15c0){var _0x31cde1={},_0x577a09={},_0x39a899={'count':0x0,'rows':[]};var _0x271d4f=_[_0x2dab('0x2c')](db[_0x2dab('0x2d')][_0x2dab('0x2e')],function(_0x11582d){return{'name':_0x11582d[_0x2dab('0x2f')],'type':_0x11582d[_0x2dab('0x30')][_0x2dab('0x31')]};});_0x577a09['model']=_['map'](_0x271d4f,'name');_0x577a09[_0x2dab('0x32')]=_[_0x2dab('0x33')](_0xa93e[_0x2dab('0x32')]);_0x577a09[_0x2dab('0x34')]=_[_0x2dab('0x35')](_0x577a09['model'],_0x577a09[_0x2dab('0x32')]);_0x31cde1['attributes']=_['intersection'](_0x577a09['model'],qs[_0x2dab('0x36')](_0xa93e[_0x2dab('0x32')]['fields']));_0x31cde1['attributes']=_0x31cde1[_0x2dab('0x37')][_0x2dab('0x38')]?_0x31cde1[_0x2dab('0x37')]:_0x577a09[_0x2dab('0x39')];if(!_0xa93e[_0x2dab('0x32')][_0x2dab('0x3a')]('nolimit')){_0x31cde1[_0x2dab('0x1d')]=qs['limit'](_0xa93e[_0x2dab('0x32')][_0x2dab('0x1d')]);_0x31cde1[_0x2dab('0x1c')]=qs[_0x2dab('0x1c')](_0xa93e[_0x2dab('0x32')][_0x2dab('0x1c')]);}_0x31cde1['order']=qs['sort'](_0xa93e[_0x2dab('0x32')][_0x2dab('0x3b')]);_0x31cde1[_0x2dab('0x3c')]=qs[_0x2dab('0x34')](_[_0x2dab('0x3d')](_0xa93e['query'],_0x577a09[_0x2dab('0x34')]),_0x271d4f);if(_0xa93e[_0x2dab('0x32')][_0x2dab('0x3e')]){_0x31cde1[_0x2dab('0x3c')]=_[_0x2dab('0x3f')](_0x31cde1[_0x2dab('0x3c')],{'$or':_[_0x2dab('0x2c')](_0x271d4f,function(_0x3e1b57){if(_0x3e1b57[_0x2dab('0x30')]!==_0x2dab('0x40')){var _0x4dc041={};_0x4dc041[_0x3e1b57[_0x2dab('0x29')]]={'$like':'%'+_0xa93e['query'][_0x2dab('0x3e')]+'%'};return _0x4dc041;}})});}_0x31cde1=_['merge']({},_0x31cde1,_0xa93e[_0x2dab('0x41')]);var _0x5d52b6={'where':_0x31cde1['where']};return db[_0x2dab('0x2d')][_0x2dab('0x1f')](_0x5d52b6)[_0x2dab('0x25')](function(_0x47967e){_0x39a899[_0x2dab('0x1f')]=_0x47967e;if(_0xa93e[_0x2dab('0x32')][_0x2dab('0x42')]){_0x31cde1[_0x2dab('0x43')]=[{'all':!![]}];}return db[_0x2dab('0x2d')][_0x2dab('0x44')](_0x31cde1);})[_0x2dab('0x25')](function(_0x23c7c2){_0x39a899[_0x2dab('0x45')]=_0x23c7c2;return _0x39a899;})[_0x2dab('0x25')](respondWithFilteredResult(_0x2b15c0,_0x31cde1))['catch'](handleError(_0x2b15c0,null));};exports[_0x2dab('0x46')]=function(_0x5c5b73,_0x53239d){var _0x25fd84={'raw':!![],'where':{'id':_0x5c5b73[_0x2dab('0x47')]['id']}},_0x964bad={};_0x964bad['model']=_['keys'](db['FaxQueueReport']['rawAttributes']);_0x964bad[_0x2dab('0x32')]=_['keys'](_0x5c5b73[_0x2dab('0x32')]);_0x964bad[_0x2dab('0x34')]=_[_0x2dab('0x35')](_0x964bad[_0x2dab('0x39')],_0x964bad[_0x2dab('0x32')]);_0x25fd84[_0x2dab('0x37')]=_['intersection'](_0x964bad[_0x2dab('0x39')],qs[_0x2dab('0x36')](_0x5c5b73['query'][_0x2dab('0x36')]));_0x25fd84[_0x2dab('0x37')]=_0x25fd84['attributes']['length']?_0x25fd84[_0x2dab('0x37')]:_0x964bad[_0x2dab('0x39')];if(_0x5c5b73[_0x2dab('0x32')][_0x2dab('0x42')]){_0x25fd84['include']=[{'all':!![]}];}_0x25fd84=_[_0x2dab('0x3f')]({},_0x25fd84,_0x5c5b73[_0x2dab('0x41')]);return db['FaxQueueReport'][_0x2dab('0x48')](_0x25fd84)[_0x2dab('0x25')](handleEntityNotFound(_0x53239d,null))[_0x2dab('0x25')](respondWithResult(_0x53239d,null))[_0x2dab('0x49')](handleError(_0x53239d,null));};exports[_0x2dab('0x4a')]=function(_0x2ee65c,_0x3b0056){return db[_0x2dab('0x2d')][_0x2dab('0x4a')](_0x2ee65c['body'],{})['then'](respondWithResult(_0x3b0056,0xc9))['catch'](handleError(_0x3b0056,null));};exports['update']=function(_0x4b117f,_0x358576){if(_0x4b117f[_0x2dab('0x4b')]['id']){delete _0x4b117f[_0x2dab('0x4b')]['id'];}return db['FaxQueueReport'][_0x2dab('0x48')]({'where':{'id':_0x4b117f[_0x2dab('0x47')]['id']}})[_0x2dab('0x25')](handleEntityNotFound(_0x358576,null))['then'](saveUpdates(_0x4b117f[_0x2dab('0x4b')],null))['then'](respondWithResult(_0x358576,null))[_0x2dab('0x49')](handleError(_0x358576,null));};exports[_0x2dab('0x26')]=function(_0x3d1bfd,_0x83d78d){return db[_0x2dab('0x2d')]['find']({'where':{'id':_0x3d1bfd[_0x2dab('0x47')]['id']}})[_0x2dab('0x25')](handleEntityNotFound(_0x83d78d,null))[_0x2dab('0x25')](removeEntity(_0x83d78d,null))['catch'](handleError(_0x83d78d,null));};exports['describe']=function(_0x580a33,_0x3ce70a){return db[_0x2dab('0x2d')]['describe']()[_0x2dab('0x25')](respondWithResult(_0x3ce70a,null))[_0x2dab('0x49')](handleError(_0x3ce70a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0da71bc..8f34137 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x314099,_0x53e96c){var _0x35c75b=function(_0x131a07){while(--_0x131a07){_0x314099['push'](_0x314099['shift']());}};_0x35c75b(++_0x53e96c);}(_0x53ec,0x192));var _0xc53e=function(_0x33199e,_0x428ded){_0x33199e=_0x33199e-0x0;var _0x2eef3c=_0x53ec[_0x33199e];return _0x2eef3c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x28de47,_0x575066){var _0x403053=function(_0x1b6621){while(--_0x1b6621){_0x28de47['push'](_0x28de47['shift']());}};_0x403053(++_0x575066);}(_0x7a54,0x106));var _0x47a5=function(_0x320f9d,_0x48ac77){_0x320f9d=_0x320f9d-0x0;var _0x59641b=_0x7a54[_0x320f9d];return _0x59641b;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 691c1b3..d1ef7e7 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 _0x6367=['client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','update','attributes','limit','debug','UpdateFaxQueueReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x364d5c,_0x1a2172){var _0x4214af=function(_0x1f713f){while(--_0x1f713f){_0x364d5c['push'](_0x364d5c['shift']());}};_0x4214af(++_0x1a2172);}(_0x6367,0x1e7));var _0x7636=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x6367[_0x1a8bbc];return _0x212fc2;};'use strict';var _=require('lodash');var util=require(_0x7636('0x0'));var moment=require(_0x7636('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7636('0x2'));var db=require(_0x7636('0x3'))['db'];var utils=require(_0x7636('0x4'));var logger=require(_0x7636('0x5'))('rpc');var config=require(_0x7636('0x6'));var jayson=require(_0x7636('0x7'));var client=jayson[_0x7636('0x8')][_0x7636('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af7e1,_0x4be578,_0x42c559){return new BPromise(function(_0xb5e549,_0x830bf3){return client[_0x7636('0xa')](_0x1af7e1,_0x42c559)[_0x7636('0xb')](function(_0x47791a){logger[_0x7636('0xc')](_0x7636('0xd'),_0x4be578,'request\x20sent');logger['debug'](_0x7636('0xe'),_0x4be578,_0x7636('0xf'),JSON[_0x7636('0x10')](_0x47791a));if(_0x47791a[_0x7636('0x11')]){if(_0x47791a[_0x7636('0x11')][_0x7636('0x12')]===0x1f4){logger[_0x7636('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4be578,_0x47791a[_0x7636('0x11')][_0x7636('0x13')]);return _0x830bf3(_0x47791a[_0x7636('0x11')][_0x7636('0x13')]);}logger[_0x7636('0x11')](_0x7636('0xd'),_0x4be578,_0x47791a[_0x7636('0x11')]['message']);return _0xb5e549(_0x47791a[_0x7636('0x11')][_0x7636('0x13')]);}else{logger[_0x7636('0xc')](_0x7636('0xd'),_0x4be578,_0x7636('0xf'));_0xb5e549(_0x47791a[_0x7636('0x14')]['message']);}})[_0x7636('0x15')](function(_0x4d890a){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x4be578,_0x4d890a);_0x830bf3(_0x4d890a);});});}exports['CreateFaxQueueReport']=function(_0x47104d){var _0x491325=this;return new Promise(function(_0x3e178c,_0x5133ea){return db[_0x7636('0x16')][_0x7636('0x17')](_0x47104d[_0x7636('0x18')],{'raw':_0x47104d['options']?_0x47104d[_0x7636('0x19')][_0x7636('0x1a')]===undefined?!![]:![]:!![]})[_0x7636('0xb')](function(_0x362a89){logger['info'](_0x7636('0x1b'),_0x47104d);logger['debug'](_0x7636('0x1b'),_0x47104d,JSON[_0x7636('0x10')](_0x362a89));_0x3e178c(_0x362a89);})[_0x7636('0x15')](function(_0xf785c4){logger[_0x7636('0x11')](_0x7636('0x1b'),_0xf785c4[_0x7636('0x13')],_0x47104d);_0x5133ea(_0x491325['error'](0x1f4,_0xf785c4['message']));});});};exports['UpdateFaxQueueReport']=function(_0x3a9b46){var _0x44f9a1=this;return new Promise(function(_0x7a09bd,_0x53a3e2){return db[_0x7636('0x16')][_0x7636('0x1c')](_0x3a9b46['body'],{'raw':_0x3a9b46['options']?_0x3a9b46[_0x7636('0x19')][_0x7636('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9b46[_0x7636('0x19')]?_0x3a9b46[_0x7636('0x19')]['where']||null:null,'attributes':_0x3a9b46[_0x7636('0x19')]?_0x3a9b46[_0x7636('0x19')][_0x7636('0x1d')]||null:null,'limit':_0x3a9b46[_0x7636('0x19')]?_0x3a9b46[_0x7636('0x19')][_0x7636('0x1e')]||null:null})[_0x7636('0xb')](function(_0x1b105b){logger[_0x7636('0xc')]('UpdateFaxQueueReport',_0x3a9b46);logger[_0x7636('0x1f')](_0x7636('0x20'),_0x3a9b46,JSON[_0x7636('0x10')](_0x1b105b));_0x7a09bd(_0x1b105b);})['catch'](function(_0x4b8eb2){logger[_0x7636('0x11')]('UpdateFaxQueueReport',_0x4b8eb2[_0x7636('0x13')],_0x3a9b46);_0x53a3e2(_0x44f9a1[_0x7636('0x11')](0x1f4,_0x4b8eb2[_0x7636('0x13')]));});});}; \ No newline at end of file +var _0x5c52=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','update','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e6858,_0x3996fd){var _0x5bac31=function(_0x4f8a72){while(--_0x4f8a72){_0x1e6858['push'](_0x1e6858['shift']());}};_0x5bac31(++_0x3996fd);}(_0x5c52,0x144));var _0x25c5=function(_0xd9c20f,_0x20237a){_0xd9c20f=_0xd9c20f-0x0;var _0x179951=_0x5c52[_0xd9c20f];return _0x179951;};'use strict';var _=require(_0x25c5('0x0'));var util=require(_0x25c5('0x1'));var moment=require('moment');var BPromise=require(_0x25c5('0x2'));var rs=require(_0x25c5('0x3'));var fs=require('fs');var Redis=require(_0x25c5('0x4'));var db=require(_0x25c5('0x5'))['db'];var utils=require(_0x25c5('0x6'));var logger=require(_0x25c5('0x7'))(_0x25c5('0x8'));var config=require(_0x25c5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x25c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f33cf,_0x1b79d2,_0x1cc145){return new BPromise(function(_0x28393c,_0x44d3a5){return client['request'](_0x3f33cf,_0x1cc145)[_0x25c5('0xb')](function(_0x570e9a){logger[_0x25c5('0xc')](_0x25c5('0xd'),_0x1b79d2,'request\x20sent');logger[_0x25c5('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1b79d2,_0x25c5('0xf'),JSON[_0x25c5('0x10')](_0x570e9a));if(_0x570e9a[_0x25c5('0x11')]){if(_0x570e9a[_0x25c5('0x11')][_0x25c5('0x12')]===0x1f4){logger[_0x25c5('0x11')](_0x25c5('0xd'),_0x1b79d2,_0x570e9a['error']['message']);return _0x44d3a5(_0x570e9a[_0x25c5('0x11')][_0x25c5('0x13')]);}logger[_0x25c5('0x11')](_0x25c5('0xd'),_0x1b79d2,_0x570e9a[_0x25c5('0x11')][_0x25c5('0x13')]);return _0x28393c(_0x570e9a['error'][_0x25c5('0x13')]);}else{logger[_0x25c5('0xc')](_0x25c5('0xd'),_0x1b79d2,'request\x20sent');_0x28393c(_0x570e9a[_0x25c5('0x14')][_0x25c5('0x13')]);}})[_0x25c5('0x15')](function(_0x173506){logger[_0x25c5('0x11')](_0x25c5('0xd'),_0x1b79d2,_0x173506);_0x44d3a5(_0x173506);});});}exports[_0x25c5('0x16')]=function(_0x583f1e){var _0x1a8f41=this;return new Promise(function(_0x3e9ee6,_0x25be96){return db[_0x25c5('0x17')][_0x25c5('0x18')](_0x583f1e[_0x25c5('0x19')],{'raw':_0x583f1e[_0x25c5('0x1a')]?_0x583f1e[_0x25c5('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x52865a){logger['info']('CreateFaxQueueReport',_0x583f1e);logger[_0x25c5('0xe')]('CreateFaxQueueReport',_0x583f1e,JSON[_0x25c5('0x10')](_0x52865a));_0x3e9ee6(_0x52865a);})[_0x25c5('0x15')](function(_0x1e7b44){logger[_0x25c5('0x11')](_0x25c5('0x16'),_0x1e7b44[_0x25c5('0x13')],_0x583f1e);_0x25be96(_0x1a8f41[_0x25c5('0x11')](0x1f4,_0x1e7b44[_0x25c5('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x179744){var _0x4cde96=this;return new Promise(function(_0x25a828,_0x5ed302){return db['FaxQueueReport'][_0x25c5('0x1b')](_0x179744[_0x25c5('0x19')],{'raw':_0x179744[_0x25c5('0x1a')]?_0x179744[_0x25c5('0x1a')][_0x25c5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179744[_0x25c5('0x1a')]?_0x179744['options'][_0x25c5('0x1d')]||null:null,'attributes':_0x179744['options']?_0x179744[_0x25c5('0x1a')][_0x25c5('0x1e')]||null:null,'limit':_0x179744[_0x25c5('0x1a')]?_0x179744[_0x25c5('0x1a')][_0x25c5('0x1f')]||null:null})[_0x25c5('0xb')](function(_0x45cadb){logger[_0x25c5('0xc')](_0x25c5('0x20'),_0x179744);logger['debug'](_0x25c5('0x20'),_0x179744,JSON['stringify'](_0x45cadb));_0x25a828(_0x45cadb);})[_0x25c5('0x15')](function(_0x6b6b){logger[_0x25c5('0x11')](_0x25c5('0x20'),_0x6b6b[_0x25c5('0x13')],_0x179744);_0x5ed302(_0x4cde96['error'](0x1f4,_0x6b6b[_0x25c5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0cceda0..3b1d01d 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 _0x837d=['fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x837d,0x10a));var _0xd837=function(_0x750565,_0x364297){_0x750565=_0x750565-0x0;var _0x4a8ae3=_0x837d[_0x750565];return _0x4a8ae3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd837('0x0'));var timeout=require(_0xd837('0x1'));var express=require(_0xd837('0x2'));var router=express[_0xd837('0x3')]();var fs_extra=require(_0xd837('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd837('0x5'));var controller=require('./faxQueueReport.controller');router[_0xd837('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd837('0x6')](_0xd837('0x7'),auth[_0xd837('0x8')](),controller[_0xd837('0x9')]);router[_0xd837('0x6')]('/:id',auth[_0xd837('0x8')](),controller[_0xd837('0xa')]);router[_0xd837('0xb')]('/',auth[_0xd837('0x8')](),controller[_0xd837('0xc')]);router[_0xd837('0xd')](_0xd837('0xe'),auth[_0xd837('0x8')](),controller[_0xd837('0xf')]);router[_0xd837('0x10')](_0xd837('0xe'),auth[_0xd837('0x8')](),controller[_0xd837('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4a29=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','create','delete','destroy','exports','util','path'];(function(_0x94e576,_0x1d46d2){var _0x480c5c=function(_0x27961f){while(--_0x27961f){_0x94e576['push'](_0x94e576['shift']());}};_0x480c5c(++_0x1d46d2);}(_0x4a29,0x83));var _0x94a2=function(_0x182447,_0x49d010){_0x182447=_0x182447-0x0;var _0x395c9f=_0x4a29[_0x182447];return _0x395c9f;};'use strict';var multer=require('multer');var util=require(_0x94a2('0x0'));var path=require(_0x94a2('0x1'));var timeout=require(_0x94a2('0x2'));var express=require(_0x94a2('0x3'));var router=express[_0x94a2('0x4')]();var fs_extra=require(_0x94a2('0x5'));var auth=require(_0x94a2('0x6'));var interaction=require(_0x94a2('0x7'));var config=require(_0x94a2('0x8'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x94a2('0x9')](),controller[_0x94a2('0xa')]);router[_0x94a2('0xb')](_0x94a2('0xc'),auth[_0x94a2('0x9')](),controller['describe']);router[_0x94a2('0xb')](_0x94a2('0xd'),auth[_0x94a2('0x9')](),controller['show']);router[_0x94a2('0xe')]('/',auth[_0x94a2('0x9')](),controller[_0x94a2('0xf')]);router['put'](_0x94a2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x94a2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x94a2('0x11')]);module[_0x94a2('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 b0d4fac..9bf3343 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x56285a,_0x1f408){var _0x39cf4d=function(_0x25e7a7){while(--_0x25e7a7){_0x56285a['push'](_0x56285a['shift']());}};_0x39cf4d(++_0x1f408);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x1e6737,_0x3a00b9){var _0x13209b=function(_0x161523){while(--_0x161523){_0x1e6737['push'](_0x1e6737['shift']());}};_0x13209b(++_0x3a00b9);}(_0x34e8,0x12c));var _0x834e=function(_0x417422,_0x2ef623){_0x417422=_0x417422-0x0;var _0x4f3798=_0x34e8[_0x417422];return _0x4f3798;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e8970e8..bb47131 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 _0xaf78=['undefined','limit','count','set','Content-Range','save','then','destroy','end','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','length','catch','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x526646,_0x465e10){var _0x331fe7=function(_0x18cc57){while(--_0x18cc57){_0x526646['push'](_0x526646['shift']());}};_0x331fe7(++_0x465e10);}(_0xaf78,0x79));var _0x8af7=function(_0x34807e,_0x1642be){_0x34807e=_0x34807e-0x0;var _0x4d2bf4=_0xaf78[_0x34807e];return _0x4d2bf4;};'use strict';var emlformat=require(_0x8af7('0x0'));var rimraf=require(_0x8af7('0x1'));var zipdir=require(_0x8af7('0x2'));var jsonpatch=require(_0x8af7('0x3'));var rp=require(_0x8af7('0x4'));var moment=require(_0x8af7('0x5'));var BPromise=require(_0x8af7('0x6'));var Mustache=require('mustache');var util=require(_0x8af7('0x7'));var path=require(_0x8af7('0x8'));var sox=require(_0x8af7('0x9'));var csv=require(_0x8af7('0xa'));var ejs=require(_0x8af7('0xb'));var fs=require('fs');var fs_extra=require(_0x8af7('0xc'));var _=require(_0x8af7('0xd'));var squel=require('squel');var crypto=require(_0x8af7('0xe'));var jsforce=require(_0x8af7('0xf'));var deskjs=require(_0x8af7('0x10'));var toCsv=require(_0x8af7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8af7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8af7('0x12'));var logger=require(_0x8af7('0x13'))(_0x8af7('0x14'));var utils=require(_0x8af7('0x15'));var config=require(_0x8af7('0x16'));var licenseUtil=require(_0x8af7('0x17'));var db=require(_0x8af7('0x18'))['db'];function respondWithStatusCode(_0x380e68,_0x39a5ad){_0x39a5ad=_0x39a5ad||0xcc;return function(_0x83ee73){if(_0x83ee73){return _0x380e68[_0x8af7('0x19')](_0x39a5ad);}return _0x380e68[_0x8af7('0x1a')](_0x39a5ad)['end']();};}function respondWithResult(_0x50ade4,_0x2e2f3){_0x2e2f3=_0x2e2f3||0xc8;return function(_0x4d3660){if(_0x4d3660){return _0x50ade4[_0x8af7('0x1a')](_0x2e2f3)[_0x8af7('0x1b')](_0x4d3660);}};}function respondWithFilteredResult(_0x4773c6,_0x520c7f){return function(_0x2cb792){if(_0x2cb792){var _0x1da9f0=typeof _0x520c7f[_0x8af7('0x1c')]===_0x8af7('0x1d')&&typeof _0x520c7f[_0x8af7('0x1e')]===_0x8af7('0x1d');var _0x27c079=_0x2cb792[_0x8af7('0x1f')];var _0x49b907=_0x1da9f0?0x0:_0x520c7f[_0x8af7('0x1c')];var _0x30ae5e=_0x1da9f0?_0x2cb792[_0x8af7('0x1f')]:_0x520c7f[_0x8af7('0x1c')]+_0x520c7f[_0x8af7('0x1e')];var _0x4a2cd9;if(_0x30ae5e>=_0x27c079){_0x30ae5e=_0x27c079;_0x4a2cd9=0xc8;}else{_0x4a2cd9=0xce;}_0x4773c6[_0x8af7('0x1a')](_0x4a2cd9);return _0x4773c6[_0x8af7('0x20')](_0x8af7('0x21'),_0x49b907+'-'+_0x30ae5e+'/'+_0x27c079)[_0x8af7('0x1b')](_0x2cb792);}return null;};}function patchUpdates(_0x2bd6f1){return function(_0x202266){try{jsonpatch['apply'](_0x202266,_0x2bd6f1,!![]);}catch(_0x5c9944){return BPromise['reject'](_0x5c9944);}return _0x202266[_0x8af7('0x22')]();};}function saveUpdates(_0x486924,_0xc749e){return function(_0x5f00e4){if(_0x5f00e4){return _0x5f00e4['update'](_0x486924)[_0x8af7('0x23')](function(_0x5739b9){return _0x5739b9;});}return null;};}function removeEntity(_0x252f01,_0x5ced83){return function(_0x2dd56f){if(_0x2dd56f){return _0x2dd56f[_0x8af7('0x24')]()['then'](function(){_0x252f01['status'](0xcc)[_0x8af7('0x25')]();});}};}function handleEntityNotFound(_0x537bf7,_0x9f09b4){return function(_0x49ec0e){if(!_0x49ec0e){_0x537bf7[_0x8af7('0x19')](0x194);}return _0x49ec0e;};}function handleError(_0x4561c6,_0x19f5c5){_0x19f5c5=_0x19f5c5||0x1f4;return function(_0x40fa20){logger['error'](_0x40fa20[_0x8af7('0x26')]);if(_0x40fa20[_0x8af7('0x27')]){delete _0x40fa20['name'];}_0x4561c6[_0x8af7('0x1a')](_0x19f5c5)[_0x8af7('0x28')](_0x40fa20);};}exports[_0x8af7('0x29')]=function(_0x2089b5,_0xc81720){var _0x4067e6={},_0x1fbc23={},_0x550952={'count':0x0,'rows':[]};var _0x5af5d8=_[_0x8af7('0x2a')](db[_0x8af7('0x2b')][_0x8af7('0x2c')],function(_0x4af2da){return{'name':_0x4af2da['fieldName'],'type':_0x4af2da[_0x8af7('0x2d')][_0x8af7('0x2e')]};});_0x1fbc23[_0x8af7('0x2f')]=_[_0x8af7('0x2a')](_0x5af5d8,_0x8af7('0x27'));_0x1fbc23[_0x8af7('0x30')]=_[_0x8af7('0x31')](_0x2089b5['query']);_0x1fbc23[_0x8af7('0x32')]=_[_0x8af7('0x33')](_0x1fbc23['model'],_0x1fbc23[_0x8af7('0x30')]);_0x4067e6[_0x8af7('0x34')]=_[_0x8af7('0x33')](_0x1fbc23['model'],qs[_0x8af7('0x35')](_0x2089b5[_0x8af7('0x30')]['fields']));_0x4067e6[_0x8af7('0x34')]=_0x4067e6['attributes']['length']?_0x4067e6[_0x8af7('0x34')]:_0x1fbc23[_0x8af7('0x2f')];if(!_0x2089b5[_0x8af7('0x30')][_0x8af7('0x36')](_0x8af7('0x37'))){_0x4067e6[_0x8af7('0x1e')]=qs[_0x8af7('0x1e')](_0x2089b5[_0x8af7('0x30')]['limit']);_0x4067e6[_0x8af7('0x1c')]=qs[_0x8af7('0x1c')](_0x2089b5[_0x8af7('0x30')]['offset']);}_0x4067e6[_0x8af7('0x38')]=qs[_0x8af7('0x39')](_0x2089b5[_0x8af7('0x30')][_0x8af7('0x39')]);_0x4067e6[_0x8af7('0x3a')]=qs['filters'](_[_0x8af7('0x3b')](_0x2089b5[_0x8af7('0x30')],_0x1fbc23[_0x8af7('0x32')]),_0x5af5d8);if(_0x2089b5[_0x8af7('0x30')][_0x8af7('0x3c')]){_0x4067e6[_0x8af7('0x3a')]=_[_0x8af7('0x3d')](_0x4067e6[_0x8af7('0x3a')],{'$or':_[_0x8af7('0x2a')](_0x5af5d8,function(_0x2e2fc){if(_0x2e2fc[_0x8af7('0x2d')]!==_0x8af7('0x3e')){var _0x2c0afe={};_0x2c0afe[_0x2e2fc['name']]={'$like':'%'+_0x2089b5['query'][_0x8af7('0x3c')]+'%'};return _0x2c0afe;}})});}_0x4067e6=_[_0x8af7('0x3d')]({},_0x4067e6,_0x2089b5[_0x8af7('0x3f')]);var _0x3a96f7={'where':_0x4067e6[_0x8af7('0x3a')]};return db[_0x8af7('0x2b')]['count'](_0x3a96f7)['then'](function(_0x374177){_0x550952[_0x8af7('0x1f')]=_0x374177;if(_0x2089b5[_0x8af7('0x30')][_0x8af7('0x40')]){_0x4067e6[_0x8af7('0x41')]=[{'all':!![]}];}return db[_0x8af7('0x2b')]['findAll'](_0x4067e6);})[_0x8af7('0x23')](function(_0x25217f){_0x550952[_0x8af7('0x42')]=_0x25217f;return _0x550952;})['then'](respondWithFilteredResult(_0xc81720,_0x4067e6))['catch'](handleError(_0xc81720,null));};exports['show']=function(_0x44bf1a,_0x558430){var _0x38bae0={'raw':!![],'where':{'id':_0x44bf1a[_0x8af7('0x43')]['id']}},_0x5ef612={};_0x5ef612['model']=_[_0x8af7('0x31')](db['FaxTransferReport']['rawAttributes']);_0x5ef612[_0x8af7('0x30')]=_[_0x8af7('0x31')](_0x44bf1a[_0x8af7('0x30')]);_0x5ef612[_0x8af7('0x32')]=_[_0x8af7('0x33')](_0x5ef612[_0x8af7('0x2f')],_0x5ef612[_0x8af7('0x30')]);_0x38bae0[_0x8af7('0x34')]=_[_0x8af7('0x33')](_0x5ef612['model'],qs[_0x8af7('0x35')](_0x44bf1a['query'][_0x8af7('0x35')]));_0x38bae0['attributes']=_0x38bae0[_0x8af7('0x34')][_0x8af7('0x44')]?_0x38bae0[_0x8af7('0x34')]:_0x5ef612[_0x8af7('0x2f')];if(_0x44bf1a[_0x8af7('0x30')][_0x8af7('0x40')]){_0x38bae0[_0x8af7('0x41')]=[{'all':!![]}];}_0x38bae0=_[_0x8af7('0x3d')]({},_0x38bae0,_0x44bf1a[_0x8af7('0x3f')]);return db[_0x8af7('0x2b')]['find'](_0x38bae0)[_0x8af7('0x23')](handleEntityNotFound(_0x558430,null))[_0x8af7('0x23')](respondWithResult(_0x558430,null))[_0x8af7('0x45')](handleError(_0x558430,null));};exports['create']=function(_0x2fc17c,_0x25382c){return db[_0x8af7('0x2b')][_0x8af7('0x46')](_0x2fc17c['body'],{})[_0x8af7('0x23')](respondWithResult(_0x25382c,0xc9))[_0x8af7('0x45')](handleError(_0x25382c,null));};exports[_0x8af7('0x47')]=function(_0x49ce7c,_0x3cb1b9){if(_0x49ce7c[_0x8af7('0x48')]['id']){delete _0x49ce7c['body']['id'];}return db['FaxTransferReport'][_0x8af7('0x49')]({'where':{'id':_0x49ce7c['params']['id']}})['then'](handleEntityNotFound(_0x3cb1b9,null))['then'](saveUpdates(_0x49ce7c['body'],null))[_0x8af7('0x23')](respondWithResult(_0x3cb1b9,null))[_0x8af7('0x45')](handleError(_0x3cb1b9,null));};exports[_0x8af7('0x24')]=function(_0x34caf0,_0x4d6040){return db[_0x8af7('0x2b')][_0x8af7('0x49')]({'where':{'id':_0x34caf0[_0x8af7('0x43')]['id']}})[_0x8af7('0x23')](handleEntityNotFound(_0x4d6040,null))[_0x8af7('0x23')](removeEntity(_0x4d6040,null))[_0x8af7('0x45')](handleError(_0x4d6040,null));};exports['describe']=function(_0xac2f36,_0x23c33f){return db[_0x8af7('0x2b')][_0x8af7('0x4a')]()[_0x8af7('0x23')](respondWithResult(_0x23c33f,null))[_0x8af7('0x45')](handleError(_0x23c33f,null));}; \ No newline at end of file +var _0x67ff=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','merge','map','VIRTUAL','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','length','create','body','destroy','find','describe','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x67ff,0xb5));var _0xf67f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x67ff[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf67f('0x0'));var rp=require(_0xf67f('0x1'));var moment=require(_0xf67f('0x2'));var BPromise=require(_0xf67f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf67f('0x4'));var sox=require('sox');var csv=require(_0xf67f('0x5'));var ejs=require(_0xf67f('0x6'));var fs=require('fs');var fs_extra=require(_0xf67f('0x7'));var _=require(_0xf67f('0x8'));var squel=require('squel');var crypto=require(_0xf67f('0x9'));var jsforce=require(_0xf67f('0xa'));var deskjs=require(_0xf67f('0xb'));var toCsv=require(_0xf67f('0x5'));var querystring=require(_0xf67f('0xc'));var Papa=require(_0xf67f('0xd'));var Redis=require(_0xf67f('0xe'));var authService=require(_0xf67f('0xf'));var qs=require(_0xf67f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf67f('0x11'));var utils=require(_0xf67f('0x12'));var config=require(_0xf67f('0x13'));var licenseUtil=require(_0xf67f('0x14'));var db=require(_0xf67f('0x15'))['db'];function respondWithStatusCode(_0xc828e4,_0x5326b0){_0x5326b0=_0x5326b0||0xcc;return function(_0x7d75bd){if(_0x7d75bd){return _0xc828e4[_0xf67f('0x16')](_0x5326b0);}return _0xc828e4[_0xf67f('0x17')](_0x5326b0)[_0xf67f('0x18')]();};}function respondWithResult(_0xeeb1c5,_0x521961){_0x521961=_0x521961||0xc8;return function(_0x505293){if(_0x505293){return _0xeeb1c5[_0xf67f('0x17')](_0x521961)[_0xf67f('0x19')](_0x505293);}};}function respondWithFilteredResult(_0x2cf37b,_0x74c553){return function(_0x28357a){if(_0x28357a){var _0x12d072=typeof _0x74c553[_0xf67f('0x1a')]===_0xf67f('0x1b')&&typeof _0x74c553[_0xf67f('0x1c')]===_0xf67f('0x1b');var _0x34aa3e=_0x28357a[_0xf67f('0x1d')];var _0xc5c2aa=_0x12d072?0x0:_0x74c553[_0xf67f('0x1a')];var _0x3ad3b1=_0x12d072?_0x28357a[_0xf67f('0x1d')]:_0x74c553[_0xf67f('0x1a')]+_0x74c553[_0xf67f('0x1c')];var _0x5720c9;if(_0x3ad3b1>=_0x34aa3e){_0x3ad3b1=_0x34aa3e;_0x5720c9=0xc8;}else{_0x5720c9=0xce;}_0x2cf37b[_0xf67f('0x17')](_0x5720c9);return _0x2cf37b['set'](_0xf67f('0x1e'),_0xc5c2aa+'-'+_0x3ad3b1+'/'+_0x34aa3e)['json'](_0x28357a);}return null;};}function patchUpdates(_0x356f37){return function(_0x3ba347){try{jsonpatch[_0xf67f('0x1f')](_0x3ba347,_0x356f37,!![]);}catch(_0x2aeaed){return BPromise['reject'](_0x2aeaed);}return _0x3ba347[_0xf67f('0x20')]();};}function saveUpdates(_0x3bf5d9,_0x57b6be){return function(_0x83215a){if(_0x83215a){return _0x83215a[_0xf67f('0x21')](_0x3bf5d9)[_0xf67f('0x22')](function(_0x2c047c){return _0x2c047c;});}return null;};}function removeEntity(_0x1d7ef3,_0x2b6d7f){return function(_0x579454){if(_0x579454){return _0x579454['destroy']()[_0xf67f('0x22')](function(){_0x1d7ef3[_0xf67f('0x17')](0xcc)[_0xf67f('0x18')]();});}};}function handleEntityNotFound(_0x317f8e,_0x3e7d8a){return function(_0x39a339){if(!_0x39a339){_0x317f8e['sendStatus'](0x194);}return _0x39a339;};}function handleError(_0x4af3d5,_0x2fdc24){_0x2fdc24=_0x2fdc24||0x1f4;return function(_0x36948f){logger[_0xf67f('0x23')](_0x36948f[_0xf67f('0x24')]);if(_0x36948f[_0xf67f('0x25')]){delete _0x36948f['name'];}_0x4af3d5[_0xf67f('0x17')](_0x2fdc24)[_0xf67f('0x26')](_0x36948f);};}exports[_0xf67f('0x27')]=function(_0x42c843,_0x378f8d){var _0x4f2eff={},_0x4ae947={},_0x439e27={'count':0x0,'rows':[]};var _0x187387=_['map'](db['FaxTransferReport'][_0xf67f('0x28')],function(_0x41a80f){return{'name':_0x41a80f[_0xf67f('0x29')],'type':_0x41a80f[_0xf67f('0x2a')][_0xf67f('0x2b')]};});_0x4ae947[_0xf67f('0x2c')]=_['map'](_0x187387,_0xf67f('0x25'));_0x4ae947['query']=_[_0xf67f('0x2d')](_0x42c843[_0xf67f('0x2e')]);_0x4ae947[_0xf67f('0x2f')]=_[_0xf67f('0x30')](_0x4ae947[_0xf67f('0x2c')],_0x4ae947['query']);_0x4f2eff[_0xf67f('0x31')]=_[_0xf67f('0x30')](_0x4ae947[_0xf67f('0x2c')],qs[_0xf67f('0x32')](_0x42c843[_0xf67f('0x2e')][_0xf67f('0x32')]));_0x4f2eff[_0xf67f('0x31')]=_0x4f2eff[_0xf67f('0x31')]['length']?_0x4f2eff[_0xf67f('0x31')]:_0x4ae947[_0xf67f('0x2c')];if(!_0x42c843[_0xf67f('0x2e')][_0xf67f('0x33')](_0xf67f('0x34'))){_0x4f2eff[_0xf67f('0x1c')]=qs['limit'](_0x42c843[_0xf67f('0x2e')][_0xf67f('0x1c')]);_0x4f2eff[_0xf67f('0x1a')]=qs['offset'](_0x42c843[_0xf67f('0x2e')][_0xf67f('0x1a')]);}_0x4f2eff[_0xf67f('0x35')]=qs['sort'](_0x42c843[_0xf67f('0x2e')]['sort']);_0x4f2eff['where']=qs[_0xf67f('0x2f')](_[_0xf67f('0x36')](_0x42c843[_0xf67f('0x2e')],_0x4ae947['filters']),_0x187387);if(_0x42c843['query'][_0xf67f('0x37')]){_0x4f2eff['where']=_[_0xf67f('0x38')](_0x4f2eff['where'],{'$or':_[_0xf67f('0x39')](_0x187387,function(_0x5838b4){if(_0x5838b4[_0xf67f('0x2a')]!==_0xf67f('0x3a')){var _0x200306={};_0x200306[_0x5838b4[_0xf67f('0x25')]]={'$like':'%'+_0x42c843[_0xf67f('0x2e')][_0xf67f('0x37')]+'%'};return _0x200306;}})});}_0x4f2eff=_[_0xf67f('0x38')]({},_0x4f2eff,_0x42c843[_0xf67f('0x3b')]);var _0x3fe30={'where':_0x4f2eff['where']};return db['FaxTransferReport'][_0xf67f('0x1d')](_0x3fe30)[_0xf67f('0x22')](function(_0x3730b9){_0x439e27[_0xf67f('0x1d')]=_0x3730b9;if(_0x42c843[_0xf67f('0x2e')][_0xf67f('0x3c')]){_0x4f2eff[_0xf67f('0x3d')]=[{'all':!![]}];}return db[_0xf67f('0x3e')][_0xf67f('0x3f')](_0x4f2eff);})[_0xf67f('0x22')](function(_0x49f081){_0x439e27[_0xf67f('0x40')]=_0x49f081;return _0x439e27;})[_0xf67f('0x22')](respondWithFilteredResult(_0x378f8d,_0x4f2eff))[_0xf67f('0x41')](handleError(_0x378f8d,null));};exports[_0xf67f('0x42')]=function(_0x3f25b5,_0xa16fd7){var _0x519d64={'raw':!![],'where':{'id':_0x3f25b5[_0xf67f('0x43')]['id']}},_0x4e61db={};_0x4e61db[_0xf67f('0x2c')]=_[_0xf67f('0x2d')](db[_0xf67f('0x3e')][_0xf67f('0x28')]);_0x4e61db['query']=_[_0xf67f('0x2d')](_0x3f25b5['query']);_0x4e61db[_0xf67f('0x2f')]=_[_0xf67f('0x30')](_0x4e61db[_0xf67f('0x2c')],_0x4e61db[_0xf67f('0x2e')]);_0x519d64[_0xf67f('0x31')]=_[_0xf67f('0x30')](_0x4e61db[_0xf67f('0x2c')],qs[_0xf67f('0x32')](_0x3f25b5['query'][_0xf67f('0x32')]));_0x519d64[_0xf67f('0x31')]=_0x519d64['attributes'][_0xf67f('0x44')]?_0x519d64[_0xf67f('0x31')]:_0x4e61db[_0xf67f('0x2c')];if(_0x3f25b5[_0xf67f('0x2e')][_0xf67f('0x3c')]){_0x519d64[_0xf67f('0x3d')]=[{'all':!![]}];}_0x519d64=_['merge']({},_0x519d64,_0x3f25b5[_0xf67f('0x3b')]);return db[_0xf67f('0x3e')]['find'](_0x519d64)[_0xf67f('0x22')](handleEntityNotFound(_0xa16fd7,null))[_0xf67f('0x22')](respondWithResult(_0xa16fd7,null))[_0xf67f('0x41')](handleError(_0xa16fd7,null));};exports[_0xf67f('0x45')]=function(_0x2982c2,_0x3f0267){return db[_0xf67f('0x3e')][_0xf67f('0x45')](_0x2982c2[_0xf67f('0x46')],{})['then'](respondWithResult(_0x3f0267,0xc9))['catch'](handleError(_0x3f0267,null));};exports['update']=function(_0x28eb8d,_0x42a98b){if(_0x28eb8d['body']['id']){delete _0x28eb8d[_0xf67f('0x46')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x28eb8d[_0xf67f('0x43')]['id']}})['then'](handleEntityNotFound(_0x42a98b,null))[_0xf67f('0x22')](saveUpdates(_0x28eb8d[_0xf67f('0x46')],null))[_0xf67f('0x22')](respondWithResult(_0x42a98b,null))[_0xf67f('0x41')](handleError(_0x42a98b,null));};exports[_0xf67f('0x47')]=function(_0x275916,_0x3bba08){return db['FaxTransferReport'][_0xf67f('0x48')]({'where':{'id':_0x275916[_0xf67f('0x43')]['id']}})[_0xf67f('0x22')](handleEntityNotFound(_0x3bba08,null))[_0xf67f('0x22')](removeEntity(_0x3bba08,null))['catch'](handleError(_0x3bba08,null));};exports['describe']=function(_0x464fcc,_0x266a3b){return db[_0xf67f('0x3e')][_0xf67f('0x49')]()['then'](respondWithResult(_0x266a3b,null))[_0xf67f('0x41')](handleError(_0x266a3b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 11958f7..30ea35d 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 _0x7759=['rimraf','../../config/environment','define','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb4cc77,_0x38f815){var _0x3c5fda=function(_0x324478){while(--_0x324478){_0xb4cc77['push'](_0xb4cc77['shift']());}};_0x3c5fda(++_0x38f815);}(_0x7759,0x143));var _0x9775=function(_0x1cf11d,_0x216d36){_0x1cf11d=_0x1cf11d-0x0;var _0x332dba=_0x7759[_0x1cf11d];return _0x332dba;};'use strict';var _=require(_0x9775('0x0'));var util=require('util');var logger=require(_0x9775('0x1'))(_0x9775('0x2'));var moment=require(_0x9775('0x3'));var BPromise=require(_0x9775('0x4'));var rp=require(_0x9775('0x5'));var fs=require('fs');var path=require(_0x9775('0x6'));var rimraf=require(_0x9775('0x7'));var config=require(_0x9775('0x8'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2543f1,_0x540bb3){return _0x2543f1[_0x9775('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x9775('0xa'),'fields':[_0x9775('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x359b=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes'];(function(_0x2eab1d,_0x54edd4){var _0x37cfed=function(_0xda2e04){while(--_0xda2e04){_0x2eab1d['push'](_0x2eab1d['shift']());}};_0x37cfed(++_0x54edd4);}(_0x359b,0xe5));var _0xb359=function(_0x371c4b,_0x23e807){_0x371c4b=_0x371c4b-0x0;var _0x5254b2=_0x359b[_0x371c4b];return _0x5254b2;};'use strict';var _=require(_0xb359('0x0'));var util=require(_0xb359('0x1'));var logger=require(_0xb359('0x2'))(_0xb359('0x3'));var moment=require(_0xb359('0x4'));var BPromise=require(_0xb359('0x5'));var rp=require(_0xb359('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb359('0x7'));var config=require('../../config/environment');var attributes=require(_0xb359('0x8'));module[_0xb359('0x9')]=function(_0x4facde,_0xe4b927){return _0x4facde[_0xb359('0xa')](_0xb359('0xb'),attributes,{'tableName':_0xb359('0xc'),'paranoid':![],'indexes':[{'name':_0xb359('0xd'),'fields':[_0xb359('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 430e10e..bddd829 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 _0x7f9a=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f9a,0x14a));var _0xa7f9=function(_0x437b4d,_0x5c6ff3){_0x437b4d=_0x437b4d-0x0;var _0x459f8a=_0x7f9a[_0x437b4d];return _0x459f8a;};'use strict';var _=require(_0xa7f9('0x0'));var util=require(_0xa7f9('0x1'));var moment=require(_0xa7f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7f9('0x3'));var fs=require('fs');var Redis=require(_0xa7f9('0x4'));var db=require(_0xa7f9('0x5'))['db'];var utils=require(_0xa7f9('0x6'));var logger=require(_0xa7f9('0x7'))(_0xa7f9('0x8'));var config=require(_0xa7f9('0x9'));var jayson=require(_0xa7f9('0xa'));var client=jayson[_0xa7f9('0xb')][_0xa7f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59f4e9,_0x25fe09,_0x22536e){return new BPromise(function(_0x594a16,_0x83117d){return client[_0xa7f9('0xd')](_0x59f4e9,_0x22536e)['then'](function(_0x8a92e9){logger['info'](_0xa7f9('0xe'),_0x25fe09,_0xa7f9('0xf'));logger[_0xa7f9('0x10')](_0xa7f9('0x11'),_0x25fe09,_0xa7f9('0xf'),JSON[_0xa7f9('0x12')](_0x8a92e9));if(_0x8a92e9['error']){if(_0x8a92e9[_0xa7f9('0x13')]['code']===0x1f4){logger['error'](_0xa7f9('0xe'),_0x25fe09,_0x8a92e9[_0xa7f9('0x13')][_0xa7f9('0x14')]);return _0x83117d(_0x8a92e9[_0xa7f9('0x13')][_0xa7f9('0x14')]);}logger[_0xa7f9('0x13')](_0xa7f9('0xe'),_0x25fe09,_0x8a92e9[_0xa7f9('0x13')]['message']);return _0x594a16(_0x8a92e9[_0xa7f9('0x13')]['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x25fe09,'request\x20sent');_0x594a16(_0x8a92e9[_0xa7f9('0x15')][_0xa7f9('0x14')]);}})[_0xa7f9('0x16')](function(_0x34b96f){logger[_0xa7f9('0x13')](_0xa7f9('0xe'),_0x25fe09,_0x34b96f);_0x83117d(_0x34b96f);});});} \ No newline at end of file +var _0x515a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x244c67,_0x127444){var _0x530f5c=function(_0x3c706b){while(--_0x3c706b){_0x244c67['push'](_0x244c67['shift']());}};_0x530f5c(++_0x127444);}(_0x515a,0x1cb));var _0xa515=function(_0x18201a,_0xf19284){_0x18201a=_0x18201a-0x0;var _0x118972=_0x515a[_0x18201a];return _0x118972;};'use strict';var _=require(_0xa515('0x0'));var util=require(_0xa515('0x1'));var moment=require(_0xa515('0x2'));var BPromise=require(_0xa515('0x3'));var rs=require(_0xa515('0x4'));var fs=require('fs');var Redis=require(_0xa515('0x5'));var db=require(_0xa515('0x6'))['db'];var utils=require(_0xa515('0x7'));var logger=require('../../config/logger')(_0xa515('0x8'));var config=require(_0xa515('0x9'));var jayson=require(_0xa515('0xa'));var client=jayson[_0xa515('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb5733,_0x278703,_0x5546d1){return new BPromise(function(_0x12dc16,_0x15d888){return client['request'](_0xdb5733,_0x5546d1)[_0xa515('0xc')](function(_0x4aa4b8){logger[_0xa515('0xd')](_0xa515('0xe'),_0x278703,_0xa515('0xf'));logger[_0xa515('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x278703,_0xa515('0xf'),JSON[_0xa515('0x11')](_0x4aa4b8));if(_0x4aa4b8[_0xa515('0x12')]){if(_0x4aa4b8['error'][_0xa515('0x13')]===0x1f4){logger[_0xa515('0x12')](_0xa515('0xe'),_0x278703,_0x4aa4b8[_0xa515('0x12')][_0xa515('0x14')]);return _0x15d888(_0x4aa4b8[_0xa515('0x12')]['message']);}logger[_0xa515('0x12')](_0xa515('0xe'),_0x278703,_0x4aa4b8['error'][_0xa515('0x14')]);return _0x12dc16(_0x4aa4b8['error'][_0xa515('0x14')]);}else{logger[_0xa515('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x278703,'request\x20sent');_0x12dc16(_0x4aa4b8[_0xa515('0x15')][_0xa515('0x14')]);}})[_0xa515('0x16')](function(_0xe23e96){logger[_0xa515('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x278703,_0xe23e96);_0x15d888(_0xe23e96);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4ee0341..cd96c0c 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 _0xade8=['post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1c33d2,_0x278c84){var _0x235ad2=function(_0x4e3418){while(--_0x4e3418){_0x1c33d2['push'](_0x1c33d2['shift']());}};_0x235ad2(++_0x278c84);}(_0xade8,0x17c));var _0x8ade=function(_0x3ece47,_0x57d241){_0x3ece47=_0x3ece47-0x0;var _0x2f93b7=_0xade8[_0x3ece47];return _0x2f93b7;};'use strict';var multer=require(_0x8ade('0x0'));var util=require(_0x8ade('0x1'));var path=require(_0x8ade('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ade('0x3'));var router=express[_0x8ade('0x4')]();var fs_extra=require(_0x8ade('0x5'));var auth=require(_0x8ade('0x6'));var interaction=require(_0x8ade('0x7'));var config=require(_0x8ade('0x8'));var controller=require(_0x8ade('0x9'));router[_0x8ade('0xa')]('/',auth[_0x8ade('0xb')](),controller[_0x8ade('0xc')]);router[_0x8ade('0xa')](_0x8ade('0xd'),auth[_0x8ade('0xb')](),controller[_0x8ade('0xe')]);router[_0x8ade('0xa')](_0x8ade('0xf'),auth[_0x8ade('0xb')](),controller['show']);router[_0x8ade('0x10')]('/',auth[_0x8ade('0xb')](),controller[_0x8ade('0x11')]);router[_0x8ade('0x12')]('/:id',auth[_0x8ade('0xb')](),controller[_0x8ade('0x13')]);router[_0x8ade('0x14')](_0x8ade('0xf'),auth[_0x8ade('0xb')](),controller[_0x8ade('0x15')]);module['exports']=router; \ No newline at end of file +var _0x264c=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1aabe5,_0x49872a){var _0x16bf2a=function(_0x44af12){while(--_0x44af12){_0x1aabe5['push'](_0x1aabe5['shift']());}};_0x16bf2a(++_0x49872a);}(_0x264c,0x19c));var _0xc264=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x264c[_0x13137e];return _0x346261;};'use strict';var multer=require(_0xc264('0x0'));var util=require(_0xc264('0x1'));var path=require(_0xc264('0x2'));var timeout=require('connect-timeout');var express=require(_0xc264('0x3'));var router=express[_0xc264('0x4')]();var fs_extra=require(_0xc264('0x5'));var auth=require(_0xc264('0x6'));var interaction=require(_0xc264('0x7'));var config=require(_0xc264('0x8'));var controller=require(_0xc264('0x9'));router[_0xc264('0xa')]('/',auth[_0xc264('0xb')](),controller['index']);router[_0xc264('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc264('0xa')](_0xc264('0xc'),auth[_0xc264('0xb')](),controller[_0xc264('0xd')]);router[_0xc264('0xe')]('/',auth[_0xc264('0xb')](),controller[_0xc264('0xf')]);router[_0xc264('0x10')](_0xc264('0xc'),auth[_0xc264('0xb')](),controller[_0xc264('0x11')]);router[_0xc264('0x12')](_0xc264('0xc'),auth[_0xc264('0xb')](),controller[_0xc264('0x13')]);module[_0xc264('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 193fd4f..fcbce19 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 _0x0a7b=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports'];(function(_0x22ccd5,_0x5ac590){var _0x2c79ee=function(_0xdd6d6d){while(--_0xdd6d6d){_0x22ccd5['push'](_0x22ccd5['shift']());}};_0x2c79ee(++_0x5ac590);}(_0x0a7b,0x160));var _0xb0a7=function(_0x3f9f29,_0x2ae26c){_0x3f9f29=_0x3f9f29-0x0;var _0x299eed=_0x0a7b[_0x3f9f29];return _0x299eed;};'use strict';var multer=require(_0xb0a7('0x0'));var util=require(_0xb0a7('0x1'));var path=require(_0xb0a7('0x2'));var timeout=require(_0xb0a7('0x3'));var express=require('express');var router=express[_0xb0a7('0x4')]();var fs_extra=require(_0xb0a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb0a7('0x6'));var config=require(_0xb0a7('0x7'));var controller=require('./intDeskAccount.controller');router[_0xb0a7('0x8')]('/',auth[_0xb0a7('0x9')](),controller['index']);router[_0xb0a7('0x8')](_0xb0a7('0xa'),auth[_0xb0a7('0x9')](),controller[_0xb0a7('0xb')]);router[_0xb0a7('0x8')]('/:id/configurations',auth[_0xb0a7('0x9')](),controller[_0xb0a7('0xc')]);router[_0xb0a7('0x8')](_0xb0a7('0xd'),auth[_0xb0a7('0x9')](),controller[_0xb0a7('0xe')]);router[_0xb0a7('0xf')]('/',auth[_0xb0a7('0x9')](),controller['create']);router[_0xb0a7('0xf')](_0xb0a7('0x10'),auth[_0xb0a7('0x9')](),controller[_0xb0a7('0x11')]);router[_0xb0a7('0x12')](_0xb0a7('0xa'),auth[_0xb0a7('0x9')](),controller['update']);router[_0xb0a7('0x13')](_0xb0a7('0xa'),auth[_0xb0a7('0x9')](),controller[_0xb0a7('0x14')]);module[_0xb0a7('0x15')]=router; \ No newline at end of file +var _0x3ec1=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','delete'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3ec1,0x16a));var _0x13ec=function(_0x5352aa,_0x13fbee){_0x5352aa=_0x5352aa-0x0;var _0x19b8ad=_0x3ec1[_0x5352aa];return _0x19b8ad;};'use strict';var multer=require(_0x13ec('0x0'));var util=require(_0x13ec('0x1'));var path=require(_0x13ec('0x2'));var timeout=require(_0x13ec('0x3'));var express=require('express');var router=express[_0x13ec('0x4')]();var fs_extra=require(_0x13ec('0x5'));var auth=require(_0x13ec('0x6'));var interaction=require(_0x13ec('0x7'));var config=require(_0x13ec('0x8'));var controller=require(_0x13ec('0x9'));router[_0x13ec('0xa')]('/',auth[_0x13ec('0xb')](),controller[_0x13ec('0xc')]);router[_0x13ec('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x13ec('0xa')](_0x13ec('0xd'),auth[_0x13ec('0xb')](),controller[_0x13ec('0xe')]);router[_0x13ec('0xa')](_0x13ec('0xf'),auth['isAuthenticated'](),controller[_0x13ec('0x10')]);router[_0x13ec('0x11')]('/',auth['isAuthenticated'](),controller[_0x13ec('0x12')]);router[_0x13ec('0x11')](_0x13ec('0xd'),auth['isAuthenticated'](),controller[_0x13ec('0x13')]);router['put'](_0x13ec('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x13ec('0x15')](_0x13ec('0x14'),auth['isAuthenticated'](),controller[_0x13ec('0x16')]);module[_0x13ec('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 49fba00..1622ae0 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 _0x62cf=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x62cf,0xee));var _0xf62c=function(_0x231b0,_0x43ce8f){_0x231b0=_0x231b0-0x0;var _0x2f0915=_0x62cf[_0x231b0];return _0x2f0915;};'use strict';var Sequelize=require(_0xf62c('0x0'));module[_0xf62c('0x1')]={'name':{'type':Sequelize[_0xf62c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf62c('0x2')]},'authType':{'type':Sequelize[_0xf62c('0x3')](_0xf62c('0x4')),'defaultValue':_0xf62c('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf62c('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf62c('0x2')]},'tokenSecret':{'type':Sequelize[_0xf62c('0x2')]},'serverUrl':{'type':Sequelize[_0xf62c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xf62c('0x5')),'defaultValue':_0xf62c('0x6')}}; \ No newline at end of file +var _0xb362=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0xb362,0x170));var _0x2b36=function(_0x256c3d,_0x4fbf51){_0x256c3d=_0x256c3d-0x0;var _0x3cf26e=_0xb362[_0x256c3d];return _0x3cf26e;};'use strict';var Sequelize=require(_0x2b36('0x0'));module[_0x2b36('0x1')]={'name':{'type':Sequelize[_0x2b36('0x2')]},'description':{'type':Sequelize[_0x2b36('0x2')]},'username':{'type':Sequelize[_0x2b36('0x2')]},'remoteUri':{'type':Sequelize[_0x2b36('0x2')]},'authType':{'type':Sequelize[_0x2b36('0x3')](_0x2b36('0x4')),'defaultValue':_0x2b36('0x4')},'password':{'type':Sequelize[_0x2b36('0x2')]},'consumerKey':{'type':Sequelize[_0x2b36('0x2')]},'consumerSecret':{'type':Sequelize[_0x2b36('0x2')]},'token':{'type':Sequelize[_0x2b36('0x2')]},'tokenSecret':{'type':Sequelize[_0x2b36('0x2')]},'serverUrl':{'type':Sequelize[_0x2b36('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2b36('0x3')](_0x2b36('0x5'),_0x2b36('0x6')),'defaultValue':_0x2b36('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9b3cffd..670a2e8 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 _0x134a=['model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','DeskAccount','includeAll','findAll','show','fields','include','catch','create','body','update','find','params','getConfigurations','findOne','DeskConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','test','statusCode','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','rawAttributes','fieldName','type'];(function(_0x447024,_0x71d3a7){var _0x2f311e=function(_0x321f2e){while(--_0x321f2e){_0x447024['push'](_0x447024['shift']());}};_0x2f311e(++_0x71d3a7);}(_0x134a,0x17c));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa134('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa134('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa134('0x2'));var moment=require(_0xa134('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa134('0x4'));var path=require('path');var sox=require(_0xa134('0x5'));var csv=require(_0xa134('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa134('0x7'));var _=require(_0xa134('0x8'));var squel=require(_0xa134('0x9'));var crypto=require('crypto');var jsforce=require(_0xa134('0xa'));var deskjs=require(_0xa134('0xb'));var toCsv=require(_0xa134('0x6'));var querystring=require('querystring');var Papa=require(_0xa134('0xc'));var Redis=require(_0xa134('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa134('0xe'));var as=require(_0xa134('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa134('0x10'));var utils=require(_0xa134('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa134('0x12'))['db'];var integrations=require(_0xa134('0x13'));function respondWithStatusCode(_0x3e787f,_0x5853c1){_0x5853c1=_0x5853c1||0xcc;return function(_0xb9940c){if(_0xb9940c){return _0x3e787f[_0xa134('0x14')](_0x5853c1);}return _0x3e787f[_0xa134('0x15')](_0x5853c1)[_0xa134('0x16')]();};}function respondWithResult(_0x43afa8,_0x30a3a8){_0x30a3a8=_0x30a3a8||0xc8;return function(_0x18c388){if(_0x18c388){return _0x43afa8[_0xa134('0x15')](_0x30a3a8)[_0xa134('0x17')](_0x18c388);}};}function respondWithFilteredResult(_0x2b58d2,_0x3ea5d1){return function(_0x9a4d4a){if(_0x9a4d4a){var _0x546b83=typeof _0x3ea5d1[_0xa134('0x18')]==='undefined'&&typeof _0x3ea5d1[_0xa134('0x19')]===_0xa134('0x1a');var _0x4ba571=_0x9a4d4a['count'];var _0x2bdad1=_0x546b83?0x0:_0x3ea5d1[_0xa134('0x18')];var _0x5bf9cf=_0x546b83?_0x9a4d4a[_0xa134('0x1b')]:_0x3ea5d1[_0xa134('0x18')]+_0x3ea5d1[_0xa134('0x19')];var _0x17fbc1;if(_0x5bf9cf>=_0x4ba571){_0x5bf9cf=_0x4ba571;_0x17fbc1=0xc8;}else{_0x17fbc1=0xce;}_0x2b58d2[_0xa134('0x15')](_0x17fbc1);return _0x2b58d2[_0xa134('0x1c')]('Content-Range',_0x2bdad1+'-'+_0x5bf9cf+'/'+_0x4ba571)[_0xa134('0x17')](_0x9a4d4a);}return null;};}function patchUpdates(_0x2abbc9){return function(_0x452722){try{jsonpatch[_0xa134('0x1d')](_0x452722,_0x2abbc9,!![]);}catch(_0x19c501){return BPromise[_0xa134('0x1e')](_0x19c501);}return _0x452722['save']();};}function saveUpdates(_0x1242c6,_0x2bff10){return function(_0x70f6f6){if(_0x70f6f6){return _0x70f6f6['update'](_0x1242c6)[_0xa134('0x1f')](function(_0x5a1c11){return _0x5a1c11;});}return null;};}function removeEntity(_0x5b7353,_0x449b0d){return function(_0x26567d){if(_0x26567d){return _0x26567d[_0xa134('0x20')]()[_0xa134('0x1f')](function(){_0x5b7353[_0xa134('0x15')](0xcc)[_0xa134('0x16')]();});}};}function handleEntityNotFound(_0x4eb211,_0x647098){return function(_0x41499d){if(!_0x41499d){_0x4eb211[_0xa134('0x14')](0x194);}return _0x41499d;};}function handleError(_0x4c0373,_0x1a6376){_0x1a6376=_0x1a6376||0x1f4;return function(_0x309341){logger[_0xa134('0x21')](_0x309341[_0xa134('0x22')]);if(_0x309341[_0xa134('0x23')]){delete _0x309341['name'];}_0x4c0373[_0xa134('0x15')](_0x1a6376)[_0xa134('0x24')](_0x309341);};}exports['index']=function(_0x4aa585,_0x4b7cae){var _0x2bff1c={},_0x180eaf={},_0x244baa={'count':0x0,'rows':[]};var _0x478970=_['map'](db['DeskAccount'][_0xa134('0x25')],function(_0x23e1e9){return{'name':_0x23e1e9[_0xa134('0x26')],'type':_0x23e1e9[_0xa134('0x27')]['key']};});_0x180eaf[_0xa134('0x28')]=_['map'](_0x478970,'name');_0x180eaf[_0xa134('0x29')]=_[_0xa134('0x2a')](_0x4aa585[_0xa134('0x29')]);_0x180eaf['filters']=_[_0xa134('0x2b')](_0x180eaf[_0xa134('0x28')],_0x180eaf[_0xa134('0x29')]);_0x2bff1c[_0xa134('0x2c')]=_[_0xa134('0x2b')](_0x180eaf[_0xa134('0x28')],qs['fields'](_0x4aa585['query']['fields']));_0x2bff1c[_0xa134('0x2c')]=_0x2bff1c['attributes'][_0xa134('0x2d')]?_0x2bff1c[_0xa134('0x2c')]:_0x180eaf[_0xa134('0x28')];if(!_0x4aa585['query'][_0xa134('0x2e')](_0xa134('0x2f'))){_0x2bff1c[_0xa134('0x19')]=qs[_0xa134('0x19')](_0x4aa585[_0xa134('0x29')]['limit']);_0x2bff1c[_0xa134('0x18')]=qs[_0xa134('0x18')](_0x4aa585['query'][_0xa134('0x18')]);}_0x2bff1c[_0xa134('0x30')]=qs[_0xa134('0x31')](_0x4aa585[_0xa134('0x29')][_0xa134('0x31')]);_0x2bff1c[_0xa134('0x32')]=qs[_0xa134('0x33')](_[_0xa134('0x34')](_0x4aa585['query'],_0x180eaf[_0xa134('0x33')]),_0x478970);if(_0x4aa585['query']['filter']){_0x2bff1c[_0xa134('0x32')]=_[_0xa134('0x35')](_0x2bff1c[_0xa134('0x32')],{'$or':_[_0xa134('0x36')](_0x478970,function(_0x1a8e25){if(_0x1a8e25[_0xa134('0x27')]!==_0xa134('0x37')){var _0x4191b3={};_0x4191b3[_0x1a8e25['name']]={'$like':'%'+_0x4aa585[_0xa134('0x29')]['filter']+'%'};return _0x4191b3;}})});}_0x2bff1c=_[_0xa134('0x35')]({},_0x2bff1c,_0x4aa585[_0xa134('0x38')]);var _0x466453={'where':_0x2bff1c[_0xa134('0x32')]};return db[_0xa134('0x39')]['count'](_0x466453)[_0xa134('0x1f')](function(_0x2e1212){_0x244baa[_0xa134('0x1b')]=_0x2e1212;if(_0x4aa585['query'][_0xa134('0x3a')]){_0x2bff1c['include']=[{'all':!![]}];}return db['DeskAccount'][_0xa134('0x3b')](_0x2bff1c);})[_0xa134('0x1f')](function(_0x4ea753){_0x244baa['rows']=_0x4ea753;return _0x244baa;})[_0xa134('0x1f')](respondWithFilteredResult(_0x4b7cae,_0x2bff1c))['catch'](handleError(_0x4b7cae,null));};exports[_0xa134('0x3c')]=function(_0xaaa2d,_0x22bdf5){var _0x362969={'raw':![],'where':{'id':_0xaaa2d['params']['id']}},_0x4d485b={};_0x4d485b[_0xa134('0x28')]=_[_0xa134('0x2a')](db[_0xa134('0x39')][_0xa134('0x25')]);_0x4d485b['query']=_[_0xa134('0x2a')](_0xaaa2d[_0xa134('0x29')]);_0x4d485b[_0xa134('0x33')]=_[_0xa134('0x2b')](_0x4d485b['model'],_0x4d485b[_0xa134('0x29')]);_0x362969[_0xa134('0x2c')]=_[_0xa134('0x2b')](_0x4d485b[_0xa134('0x28')],qs[_0xa134('0x3d')](_0xaaa2d[_0xa134('0x29')][_0xa134('0x3d')]));_0x362969['attributes']=_0x362969[_0xa134('0x2c')][_0xa134('0x2d')]?_0x362969[_0xa134('0x2c')]:_0x4d485b[_0xa134('0x28')];if(_0xaaa2d[_0xa134('0x29')][_0xa134('0x3a')]){_0x362969[_0xa134('0x3e')]=[{'all':!![]}];}_0x362969=_[_0xa134('0x35')]({},_0x362969,_0xaaa2d[_0xa134('0x38')]);return db['DeskAccount']['find'](_0x362969)[_0xa134('0x1f')](handleEntityNotFound(_0x22bdf5,null))[_0xa134('0x1f')](respondWithResult(_0x22bdf5,null))[_0xa134('0x3f')](handleError(_0x22bdf5,null));};exports[_0xa134('0x40')]=function(_0x496179,_0x2ae754){return db[_0xa134('0x39')][_0xa134('0x40')](_0x496179[_0xa134('0x41')],{})[_0xa134('0x1f')](respondWithResult(_0x2ae754,0xc9))['catch'](handleError(_0x2ae754,null));};exports[_0xa134('0x42')]=function(_0xc172a7,_0x5c2fd4){if(_0xc172a7['body']['id']){delete _0xc172a7[_0xa134('0x41')]['id'];}return db[_0xa134('0x39')][_0xa134('0x43')]({'where':{'id':_0xc172a7[_0xa134('0x44')]['id']}})[_0xa134('0x1f')](handleEntityNotFound(_0x5c2fd4,null))['then'](saveUpdates(_0xc172a7['body'],null))[_0xa134('0x1f')](respondWithResult(_0x5c2fd4,null))[_0xa134('0x3f')](handleError(_0x5c2fd4,null));};exports[_0xa134('0x20')]=function(_0x141f3a,_0x2e357f){return db[_0xa134('0x39')][_0xa134('0x43')]({'where':{'id':_0x141f3a[_0xa134('0x44')]['id']}})[_0xa134('0x1f')](handleEntityNotFound(_0x2e357f,null))[_0xa134('0x1f')](removeEntity(_0x2e357f,null))[_0xa134('0x3f')](handleError(_0x2e357f,null));};exports[_0xa134('0x45')]=function(_0x5231ac,_0x23d2a7,_0x6e8d77){var _0x4ffc52={};var _0x42d6e8={};var _0x181613;var _0x5406a5;return db[_0xa134('0x39')][_0xa134('0x46')]({'where':{'id':_0x5231ac[_0xa134('0x44')]['id']}})['then'](handleEntityNotFound(_0x23d2a7,null))[_0xa134('0x1f')](function(_0x42c0fc){if(_0x42c0fc){_0x181613=_0x42c0fc;_0x42d6e8[_0xa134('0x28')]=_[_0xa134('0x2a')](db[_0xa134('0x47')][_0xa134('0x25')]);_0x42d6e8['query']=_[_0xa134('0x2a')](_0x5231ac[_0xa134('0x29')]);_0x42d6e8[_0xa134('0x33')]=_[_0xa134('0x2b')](_0x42d6e8[_0xa134('0x28')],_0x42d6e8[_0xa134('0x29')]);_0x4ffc52[_0xa134('0x2c')]=_['intersection'](_0x42d6e8[_0xa134('0x28')],qs[_0xa134('0x3d')](_0x5231ac[_0xa134('0x29')][_0xa134('0x3d')]));_0x4ffc52[_0xa134('0x2c')]=_0x4ffc52[_0xa134('0x2c')][_0xa134('0x2d')]?_0x4ffc52[_0xa134('0x2c')]:_0x42d6e8[_0xa134('0x28')];_0x4ffc52[_0xa134('0x30')]=qs['sort'](_0x5231ac[_0xa134('0x29')][_0xa134('0x31')]);_0x4ffc52[_0xa134('0x32')]=qs[_0xa134('0x33')](_[_0xa134('0x34')](_0x5231ac[_0xa134('0x29')],_0x42d6e8['filters']));if(_0x5231ac[_0xa134('0x29')]['filter']){_0x4ffc52[_0xa134('0x32')]=_[_0xa134('0x35')](_0x4ffc52['where'],{'$or':_[_0xa134('0x36')](_0x4ffc52['attributes'],function(_0xe2e0d7){var _0x47e66c={};_0x47e66c[_0xe2e0d7]={'$like':'%'+_0x5231ac[_0xa134('0x29')][_0xa134('0x48')]+'%'};return _0x47e66c;})});}_0x4ffc52=_[_0xa134('0x35')]({},_0x4ffc52,_0x5231ac[_0xa134('0x38')]);return _0x181613[_0xa134('0x45')](_0x4ffc52);}})[_0xa134('0x1f')](function(_0x2784c0){if(_0x2784c0){_0x5406a5=_0x2784c0[_0xa134('0x2d')];if(!_0x5231ac[_0xa134('0x29')][_0xa134('0x2e')]('nolimit')){_0x4ffc52[_0xa134('0x19')]=qs['limit'](_0x5231ac['query'][_0xa134('0x19')]);_0x4ffc52[_0xa134('0x18')]=qs[_0xa134('0x18')](_0x5231ac[_0xa134('0x29')][_0xa134('0x18')]);}return _0x181613['getConfigurations'](_0x4ffc52);}})[_0xa134('0x1f')](function(_0x4f7364){if(_0x4f7364){return _0x4f7364?{'count':_0x5406a5,'rows':_0x4f7364}:null;}})[_0xa134('0x1f')](respondWithResult(_0x23d2a7,null))[_0xa134('0x3f')](handleError(_0x23d2a7,null));};exports[_0xa134('0x49')]=function(_0x788eae,_0x2d83a0,_0x9bfff8){if(_0x788eae[_0xa134('0x41')]['id']){delete _0x788eae[_0xa134('0x41')]['id'];}return db[_0xa134('0x39')][_0xa134('0x46')]({'where':{'id':_0x788eae[_0xa134('0x44')]['id']}})[_0xa134('0x1f')](handleEntityNotFound(_0x2d83a0,null))[_0xa134('0x1f')](function(_0x7cd897){if(_0x7cd897){_0x788eae[_0xa134('0x41')][_0xa134('0x4a')]=_0x7cd897['id'];_0x788eae[_0xa134('0x41')][_0xa134('0x4b')]=integrations[_0xa134('0x4c')](_0x788eae['body'][_0xa134('0x4d')],_0x788eae[_0xa134('0x41')]['type']);_0x788eae[_0xa134('0x41')][_0xa134('0x4e')]=integrations[_0xa134('0x4f')](_0x788eae[_0xa134('0x41')][_0xa134('0x4d')],_0x788eae[_0xa134('0x41')]['type']);return db[_0xa134('0x47')][_0xa134('0x40')](_0x788eae['body'],{'include':[{'model':db[_0xa134('0x50')],'as':_0xa134('0x4b')},{'model':db[_0xa134('0x50')],'as':'Descriptions'}]});}return null;})[_0xa134('0x1f')](respondWithResult(_0x2d83a0,null))['catch'](handleError(_0x2d83a0,null));};exports['getFields']=function(_0x4cd213,_0x244576,_0x119347){var _0x55c032=[{'name':_0xa134('0x51'),'label':'priority','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 _0x470df6='';return db[_0xa134('0x39')][_0xa134('0x46')]({'where':{'id':_0x4cd213[_0xa134('0x44')]['id']},'attributes':['id',_0xa134('0x52'),_0xa134('0x53'),_0xa134('0x54'),'password',_0xa134('0x55'),_0xa134('0x56'),_0xa134('0x57'),'tokenSecret']})[_0xa134('0x1f')](handleEntityNotFound(_0x244576,null))[_0xa134('0x1f')](function(_0x25a094){if(_0x25a094){_0x470df6=_0x25a094['remoteUri'];var _0x54ff5d=_0x470df6[_0xa134('0x58')](-0x1);if(_0x54ff5d==='/'){_0x470df6=_0x470df6[_0xa134('0x59')](0x0,_0x470df6[_0xa134('0x5a')](_0x54ff5d));}var _0x203b45={'method':_0xa134('0x5b'),'uri':util[_0xa134('0x5c')]('%s/custom_fields',_0x470df6),'headers':{'Content-Type':_0xa134('0x5d'),'Accept':_0xa134('0x5d')},'json':!![]};if(_0x25a094[_0xa134('0x53')]===_0xa134('0x5e')){_0x203b45['headers'][_0xa134('0x5f')]=util[_0xa134('0x5c')](_0xa134('0x60'),new Buffer(util['format'](_0xa134('0x61'),_0x25a094[_0xa134('0x54')],_0x25a094['password']))[_0xa134('0x62')](_0xa134('0x63')));}return rp(_0x203b45)[_0xa134('0x1f')](function(_0x4453e1){return _0x55c032['concat'](_[_0xa134('0x36')](_0x4453e1[_0xa134('0x64')][_0xa134('0x65')],function(_0x15c1f3){return{'id':_0x15c1f3[_0xa134('0x23')],'name':_0x15c1f3[_0xa134('0x23')],'type':_0x15c1f3[_0xa134('0x27')],'active':_0x15c1f3[_0xa134('0x66')],'label':_0x15c1f3['label'],'custom':!![]};}));});}})['then'](function(_0x317eda){return{'count':_0x317eda[_0xa134('0x2d')],'rows':_0x317eda};})[_0xa134('0x1f')](respondWithResult(_0x244576,null))[_0xa134('0x3f')](function(_0x15c98c){var _0x13d4de=_0x4cd213[_0xa134('0x29')][_0xa134('0x67')]?0x1f4:_0x15c98c[_0xa134('0x68')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x13d4de,JSON['stringify'](_0x15c98c));delete _0x15c98c[_0xa134('0x23')];if(_0x13d4de===0x191){_0x13d4de=0x190;}_0x244576[_0xa134('0x15')](_0x13d4de)['send'](_0x4cd213[_0xa134('0x29')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x15c98c[_0xa134('0x68')]}:_0x15c98c);});}; \ No newline at end of file +var _0x272d=['set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','username','toString','concat','_embedded','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','limit'];(function(_0x577c13,_0xddf707){var _0x969152=function(_0x298efc){while(--_0x298efc){_0x577c13['push'](_0x577c13['shift']());}};_0x969152(++_0xddf707);}(_0x272d,0x146));var _0xd272=function(_0x3bdf89,_0x585074){_0x3bdf89=_0x3bdf89-0x0;var _0x4f1dbb=_0x272d[_0x3bdf89];return _0x4f1dbb;};'use strict';var emlformat=require(_0xd272('0x0'));var rimraf=require(_0xd272('0x1'));var zipdir=require(_0xd272('0x2'));var jsonpatch=require(_0xd272('0x3'));var rp=require(_0xd272('0x4'));var moment=require('moment');var BPromise=require(_0xd272('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd272('0x6'));var sox=require('sox');var csv=require(_0xd272('0x7'));var ejs=require(_0xd272('0x8'));var fs=require('fs');var fs_extra=require(_0xd272('0x9'));var _=require(_0xd272('0xa'));var squel=require(_0xd272('0xb'));var crypto=require(_0xd272('0xc'));var jsforce=require(_0xd272('0xd'));var deskjs=require(_0xd272('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd272('0xf'));var Redis=require('ioredis');var authService=require(_0xd272('0x10'));var qs=require(_0xd272('0x11'));var as=require(_0xd272('0x12'));var hardwareService=require(_0xd272('0x13'));var logger=require(_0xd272('0x14'))(_0xd272('0x15'));var utils=require(_0xd272('0x16'));var config=require(_0xd272('0x17'));var licenseUtil=require(_0xd272('0x18'));var db=require(_0xd272('0x19'))['db'];var integrations=require(_0xd272('0x1a'));function respondWithStatusCode(_0x12145e,_0xe8b10){_0xe8b10=_0xe8b10||0xcc;return function(_0x20918f){if(_0x20918f){return _0x12145e['sendStatus'](_0xe8b10);}return _0x12145e['status'](_0xe8b10)[_0xd272('0x1b')]();};}function respondWithResult(_0x19205f,_0x44fd3b){_0x44fd3b=_0x44fd3b||0xc8;return function(_0x255fb6){if(_0x255fb6){return _0x19205f[_0xd272('0x1c')](_0x44fd3b)[_0xd272('0x1d')](_0x255fb6);}};}function respondWithFilteredResult(_0x4b27e3,_0x3d3e42){return function(_0x44ac32){if(_0x44ac32){var _0x4c0885=typeof _0x3d3e42[_0xd272('0x1e')]===_0xd272('0x1f')&&typeof _0x3d3e42['limit']===_0xd272('0x1f');var _0xdf904a=_0x44ac32[_0xd272('0x20')];var _0x5ef3fc=_0x4c0885?0x0:_0x3d3e42[_0xd272('0x1e')];var _0x358e0c=_0x4c0885?_0x44ac32[_0xd272('0x20')]:_0x3d3e42['offset']+_0x3d3e42[_0xd272('0x21')];var _0x179bfc;if(_0x358e0c>=_0xdf904a){_0x358e0c=_0xdf904a;_0x179bfc=0xc8;}else{_0x179bfc=0xce;}_0x4b27e3[_0xd272('0x1c')](_0x179bfc);return _0x4b27e3[_0xd272('0x22')](_0xd272('0x23'),_0x5ef3fc+'-'+_0x358e0c+'/'+_0xdf904a)[_0xd272('0x1d')](_0x44ac32);}return null;};}function patchUpdates(_0x3b9d6f){return function(_0xbea44){try{jsonpatch[_0xd272('0x24')](_0xbea44,_0x3b9d6f,!![]);}catch(_0x568dd4){return BPromise[_0xd272('0x25')](_0x568dd4);}return _0xbea44[_0xd272('0x26')]();};}function saveUpdates(_0xdfe114,_0xfe2fe3){return function(_0x2d360d){if(_0x2d360d){return _0x2d360d[_0xd272('0x27')](_0xdfe114)[_0xd272('0x28')](function(_0x158c0a){return _0x158c0a;});}return null;};}function removeEntity(_0x1ac7d2,_0x1f78e7){return function(_0x3e9c2c){if(_0x3e9c2c){return _0x3e9c2c[_0xd272('0x29')]()['then'](function(){_0x1ac7d2[_0xd272('0x1c')](0xcc)[_0xd272('0x1b')]();});}};}function handleEntityNotFound(_0x2eb872,_0x30ddfd){return function(_0xad2d8f){if(!_0xad2d8f){_0x2eb872[_0xd272('0x2a')](0x194);}return _0xad2d8f;};}function handleError(_0x43e400,_0x45a19e){_0x45a19e=_0x45a19e||0x1f4;return function(_0x43f94c){logger[_0xd272('0x2b')](_0x43f94c[_0xd272('0x2c')]);if(_0x43f94c[_0xd272('0x2d')]){delete _0x43f94c[_0xd272('0x2d')];}_0x43e400[_0xd272('0x1c')](_0x45a19e)[_0xd272('0x2e')](_0x43f94c);};}exports[_0xd272('0x2f')]=function(_0x34ebe7,_0xc6e9da){var _0x3df7d0={},_0x466076={},_0x25c065={'count':0x0,'rows':[]};var _0x43711b=_[_0xd272('0x30')](db[_0xd272('0x31')][_0xd272('0x32')],function(_0x20f44a){return{'name':_0x20f44a[_0xd272('0x33')],'type':_0x20f44a[_0xd272('0x34')][_0xd272('0x35')]};});_0x466076[_0xd272('0x36')]=_[_0xd272('0x30')](_0x43711b,_0xd272('0x2d'));_0x466076[_0xd272('0x37')]=_[_0xd272('0x38')](_0x34ebe7[_0xd272('0x37')]);_0x466076['filters']=_[_0xd272('0x39')](_0x466076['model'],_0x466076['query']);_0x3df7d0[_0xd272('0x3a')]=_['intersection'](_0x466076['model'],qs['fields'](_0x34ebe7[_0xd272('0x37')][_0xd272('0x3b')]));_0x3df7d0[_0xd272('0x3a')]=_0x3df7d0[_0xd272('0x3a')][_0xd272('0x3c')]?_0x3df7d0[_0xd272('0x3a')]:_0x466076[_0xd272('0x36')];if(!_0x34ebe7[_0xd272('0x37')]['hasOwnProperty'](_0xd272('0x3d'))){_0x3df7d0[_0xd272('0x21')]=qs[_0xd272('0x21')](_0x34ebe7['query'][_0xd272('0x21')]);_0x3df7d0[_0xd272('0x1e')]=qs[_0xd272('0x1e')](_0x34ebe7['query'][_0xd272('0x1e')]);}_0x3df7d0[_0xd272('0x3e')]=qs[_0xd272('0x3f')](_0x34ebe7[_0xd272('0x37')][_0xd272('0x3f')]);_0x3df7d0[_0xd272('0x40')]=qs[_0xd272('0x41')](_[_0xd272('0x42')](_0x34ebe7[_0xd272('0x37')],_0x466076[_0xd272('0x41')]),_0x43711b);if(_0x34ebe7['query']['filter']){_0x3df7d0['where']=_[_0xd272('0x43')](_0x3df7d0[_0xd272('0x40')],{'$or':_['map'](_0x43711b,function(_0x40c4c2){if(_0x40c4c2[_0xd272('0x34')]!==_0xd272('0x44')){var _0x15e43e={};_0x15e43e[_0x40c4c2[_0xd272('0x2d')]]={'$like':'%'+_0x34ebe7[_0xd272('0x37')][_0xd272('0x45')]+'%'};return _0x15e43e;}})});}_0x3df7d0=_[_0xd272('0x43')]({},_0x3df7d0,_0x34ebe7[_0xd272('0x46')]);var _0x3caf21={'where':_0x3df7d0[_0xd272('0x40')]};return db[_0xd272('0x31')][_0xd272('0x20')](_0x3caf21)[_0xd272('0x28')](function(_0x36b6c3){_0x25c065[_0xd272('0x20')]=_0x36b6c3;if(_0x34ebe7[_0xd272('0x37')][_0xd272('0x47')]){_0x3df7d0[_0xd272('0x48')]=[{'all':!![]}];}return db['DeskAccount'][_0xd272('0x49')](_0x3df7d0);})[_0xd272('0x28')](function(_0x233632){_0x25c065[_0xd272('0x4a')]=_0x233632;return _0x25c065;})['then'](respondWithFilteredResult(_0xc6e9da,_0x3df7d0))[_0xd272('0x4b')](handleError(_0xc6e9da,null));};exports[_0xd272('0x4c')]=function(_0x43574c,_0x5262de){var _0x4d9957={'raw':![],'where':{'id':_0x43574c['params']['id']}},_0x2807c0={};_0x2807c0[_0xd272('0x36')]=_['keys'](db['DeskAccount'][_0xd272('0x32')]);_0x2807c0[_0xd272('0x37')]=_[_0xd272('0x38')](_0x43574c[_0xd272('0x37')]);_0x2807c0['filters']=_[_0xd272('0x39')](_0x2807c0[_0xd272('0x36')],_0x2807c0['query']);_0x4d9957[_0xd272('0x3a')]=_['intersection'](_0x2807c0['model'],qs[_0xd272('0x3b')](_0x43574c[_0xd272('0x37')][_0xd272('0x3b')]));_0x4d9957[_0xd272('0x3a')]=_0x4d9957['attributes']['length']?_0x4d9957[_0xd272('0x3a')]:_0x2807c0[_0xd272('0x36')];if(_0x43574c[_0xd272('0x37')]['includeAll']){_0x4d9957[_0xd272('0x48')]=[{'all':!![]}];}_0x4d9957=_[_0xd272('0x43')]({},_0x4d9957,_0x43574c[_0xd272('0x46')]);return db['DeskAccount'][_0xd272('0x4d')](_0x4d9957)['then'](handleEntityNotFound(_0x5262de,null))[_0xd272('0x28')](respondWithResult(_0x5262de,null))[_0xd272('0x4b')](handleError(_0x5262de,null));};exports[_0xd272('0x4e')]=function(_0x1a7a31,_0x5e4270){return db[_0xd272('0x31')][_0xd272('0x4e')](_0x1a7a31[_0xd272('0x4f')],{})[_0xd272('0x28')](respondWithResult(_0x5e4270,0xc9))['catch'](handleError(_0x5e4270,null));};exports[_0xd272('0x27')]=function(_0x780050,_0x28b390){if(_0x780050[_0xd272('0x4f')]['id']){delete _0x780050[_0xd272('0x4f')]['id'];}return db[_0xd272('0x31')]['find']({'where':{'id':_0x780050[_0xd272('0x50')]['id']}})[_0xd272('0x28')](handleEntityNotFound(_0x28b390,null))['then'](saveUpdates(_0x780050[_0xd272('0x4f')],null))['then'](respondWithResult(_0x28b390,null))[_0xd272('0x4b')](handleError(_0x28b390,null));};exports[_0xd272('0x29')]=function(_0x2bfc9b,_0x780e2b){return db['DeskAccount'][_0xd272('0x4d')]({'where':{'id':_0x2bfc9b[_0xd272('0x50')]['id']}})[_0xd272('0x28')](handleEntityNotFound(_0x780e2b,null))[_0xd272('0x28')](removeEntity(_0x780e2b,null))[_0xd272('0x4b')](handleError(_0x780e2b,null));};exports[_0xd272('0x51')]=function(_0x27ee5f,_0x220620,_0x569e5d){var _0xc8375a={};var _0x55ac7b={};var _0x335765;var _0x6f8c3d;return db[_0xd272('0x31')][_0xd272('0x52')]({'where':{'id':_0x27ee5f[_0xd272('0x50')]['id']}})[_0xd272('0x28')](handleEntityNotFound(_0x220620,null))['then'](function(_0x5b5dc7){if(_0x5b5dc7){_0x335765=_0x5b5dc7;_0x55ac7b['model']=_['keys'](db[_0xd272('0x53')][_0xd272('0x32')]);_0x55ac7b[_0xd272('0x37')]=_[_0xd272('0x38')](_0x27ee5f[_0xd272('0x37')]);_0x55ac7b[_0xd272('0x41')]=_[_0xd272('0x39')](_0x55ac7b[_0xd272('0x36')],_0x55ac7b[_0xd272('0x37')]);_0xc8375a[_0xd272('0x3a')]=_[_0xd272('0x39')](_0x55ac7b['model'],qs['fields'](_0x27ee5f[_0xd272('0x37')][_0xd272('0x3b')]));_0xc8375a['attributes']=_0xc8375a[_0xd272('0x3a')][_0xd272('0x3c')]?_0xc8375a[_0xd272('0x3a')]:_0x55ac7b[_0xd272('0x36')];_0xc8375a['order']=qs[_0xd272('0x3f')](_0x27ee5f[_0xd272('0x37')][_0xd272('0x3f')]);_0xc8375a[_0xd272('0x40')]=qs[_0xd272('0x41')](_['pick'](_0x27ee5f[_0xd272('0x37')],_0x55ac7b['filters']));if(_0x27ee5f[_0xd272('0x37')][_0xd272('0x45')]){_0xc8375a[_0xd272('0x40')]=_[_0xd272('0x43')](_0xc8375a['where'],{'$or':_['map'](_0xc8375a['attributes'],function(_0x22c52d){var _0xb80e17={};_0xb80e17[_0x22c52d]={'$like':'%'+_0x27ee5f[_0xd272('0x37')][_0xd272('0x45')]+'%'};return _0xb80e17;})});}_0xc8375a=_[_0xd272('0x43')]({},_0xc8375a,_0x27ee5f[_0xd272('0x46')]);return _0x335765['getConfigurations'](_0xc8375a);}})[_0xd272('0x28')](function(_0x272f44){if(_0x272f44){_0x6f8c3d=_0x272f44[_0xd272('0x3c')];if(!_0x27ee5f[_0xd272('0x37')]['hasOwnProperty']('nolimit')){_0xc8375a[_0xd272('0x21')]=qs[_0xd272('0x21')](_0x27ee5f[_0xd272('0x37')][_0xd272('0x21')]);_0xc8375a[_0xd272('0x1e')]=qs[_0xd272('0x1e')](_0x27ee5f[_0xd272('0x37')][_0xd272('0x1e')]);}return _0x335765[_0xd272('0x51')](_0xc8375a);}})[_0xd272('0x28')](function(_0x5bbeef){if(_0x5bbeef){return _0x5bbeef?{'count':_0x6f8c3d,'rows':_0x5bbeef}:null;}})[_0xd272('0x28')](respondWithResult(_0x220620,null))[_0xd272('0x4b')](handleError(_0x220620,null));};exports[_0xd272('0x54')]=function(_0x5ff641,_0x28bc0a,_0x168793){if(_0x5ff641['body']['id']){delete _0x5ff641['body']['id'];}return db[_0xd272('0x31')]['findOne']({'where':{'id':_0x5ff641[_0xd272('0x50')]['id']}})[_0xd272('0x28')](handleEntityNotFound(_0x28bc0a,null))[_0xd272('0x28')](function(_0x5e3bbc){if(_0x5e3bbc){_0x5ff641[_0xd272('0x4f')][_0xd272('0x55')]=_0x5e3bbc['id'];_0x5ff641[_0xd272('0x4f')][_0xd272('0x56')]=integrations[_0xd272('0x57')](_0x5ff641[_0xd272('0x4f')][_0xd272('0x58')],_0x5ff641[_0xd272('0x4f')][_0xd272('0x34')]);_0x5ff641[_0xd272('0x4f')]['Descriptions']=integrations[_0xd272('0x59')](_0x5ff641['body'][_0xd272('0x58')],_0x5ff641['body']['type']);return db[_0xd272('0x53')][_0xd272('0x4e')](_0x5ff641['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xd272('0x5a')],'as':_0xd272('0x5b')}]});}return null;})[_0xd272('0x28')](respondWithResult(_0x28bc0a,null))['catch'](handleError(_0x28bc0a,null));};exports[_0xd272('0x5c')]=function(_0x4c22b6,_0x51b904,_0x465e75){var _0x442a97=[{'name':_0xd272('0x5d'),'label':_0xd272('0x5d'),'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 _0x177e30='';return db[_0xd272('0x31')][_0xd272('0x52')]({'where':{'id':_0x4c22b6['params']['id']},'attributes':['id',_0xd272('0x5e'),_0xd272('0x5f'),'username',_0xd272('0x60'),_0xd272('0x61'),'consumerSecret',_0xd272('0x62'),_0xd272('0x63')]})[_0xd272('0x28')](handleEntityNotFound(_0x51b904,null))['then'](function(_0x40eeb8){if(_0x40eeb8){_0x177e30=_0x40eeb8[_0xd272('0x5e')];var _0x1206c8=_0x177e30[_0xd272('0x64')](-0x1);if(_0x1206c8==='/'){_0x177e30=_0x177e30[_0xd272('0x65')](0x0,_0x177e30[_0xd272('0x66')](_0x1206c8));}var _0x57279c={'method':_0xd272('0x67'),'uri':util[_0xd272('0x68')](_0xd272('0x69'),_0x177e30),'headers':{'Content-Type':'application/json','Accept':_0xd272('0x6a')},'json':!![]};if(_0x40eeb8[_0xd272('0x5f')]===_0xd272('0x6b')){_0x57279c[_0xd272('0x6c')]['Authorization']=util[_0xd272('0x68')]('Basic\x20%s',new Buffer(util['format'](_0xd272('0x6d'),_0x40eeb8[_0xd272('0x6e')],_0x40eeb8[_0xd272('0x60')]))[_0xd272('0x6f')]('base64'));}return rp(_0x57279c)['then'](function(_0x5a2fe9){return _0x442a97[_0xd272('0x70')](_[_0xd272('0x30')](_0x5a2fe9[_0xd272('0x71')]['entries'],function(_0x59b42c){return{'id':_0x59b42c['name'],'name':_0x59b42c[_0xd272('0x2d')],'type':_0x59b42c[_0xd272('0x34')],'active':_0x59b42c['active'],'label':_0x59b42c[_0xd272('0x72')],'custom':!![]};}));});}})[_0xd272('0x28')](function(_0x1de75d){return{'count':_0x1de75d['length'],'rows':_0x1de75d};})[_0xd272('0x28')](respondWithResult(_0x51b904,null))[_0xd272('0x4b')](function(_0x5d0747){var _0x48b7e0=_0x4c22b6[_0xd272('0x37')][_0xd272('0x73')]?0x1f4:_0x5d0747[_0xd272('0x74')]||0x1f4;logger[_0xd272('0x2b')](_0xd272('0x75'),'getFields',_0x48b7e0,JSON[_0xd272('0x76')](_0x5d0747));delete _0x5d0747['name'];if(_0x48b7e0===0x191){_0x48b7e0=0x190;}_0x51b904[_0xd272('0x1c')](_0x48b7e0)[_0xd272('0x2e')](_0x4c22b6['query'][_0xd272('0x73')]?{'message':_0xd272('0x77'),'statusCode':_0x5d0747[_0xd272('0x74')]}:_0x5d0747);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eb2ca11..56b2c54 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 _0xef2f=['request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ebf10,_0x17baf3){var _0x1c7231=function(_0x5d2a7c){while(--_0x5d2a7c){_0x3ebf10['push'](_0x3ebf10['shift']());}};_0x1c7231(++_0x17baf3);}(_0xef2f,0xab));var _0xfef2=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xef2f[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xfef2('0x0'));var util=require(_0xfef2('0x1'));var logger=require(_0xfef2('0x2'))('api');var moment=require(_0xfef2('0x3'));var BPromise=require(_0xfef2('0x4'));var rp=require(_0xfef2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfef2('0x6'));var integrations=require(_0xfef2('0x7'));module[_0xfef2('0x8')]=function(_0x22840d,_0x3910aa){return _0x22840d[_0xfef2('0x9')](_0xfef2('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c18=['util','api','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x9c18,0x6b));var _0x89c1=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x9c18[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x89c1('0x0'));var util=require(_0x89c1('0x1'));var logger=require('../../config/logger')(_0x89c1('0x2'));var moment=require(_0x89c1('0x3'));var BPromise=require(_0x89c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89c1('0x5'));var rimraf=require('rimraf');var config=require(_0x89c1('0x6'));var attributes=require(_0x89c1('0x7'));var integrations=require(_0x89c1('0x8'));module[_0x89c1('0x9')]=function(_0x521f42,_0xe16d1f){return _0x521f42[_0x89c1('0xa')](_0x89c1('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 121baf8..850e0ef 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 _0x61be=['result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model','catch','find','ShowDeskAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x61be,0x10a));var _0xe61b=function(_0x451878,_0x20619f){_0x451878=_0x451878-0x0;var _0x3e4531=_0x61be[_0x451878];return _0x3e4531;};'use strict';var _=require(_0xe61b('0x0'));var util=require('util');var moment=require(_0xe61b('0x1'));var BPromise=require(_0xe61b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe61b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe61b('0x4'));var logger=require(_0xe61b('0x5'))(_0xe61b('0x6'));var config=require(_0xe61b('0x7'));var jayson=require(_0xe61b('0x8'));var client=jayson[_0xe61b('0x9')][_0xe61b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x188998,_0x513acb,_0x15de32){return new BPromise(function(_0x503a86,_0x59b1e9){return client[_0xe61b('0xb')](_0x188998,_0x15de32)[_0xe61b('0xc')](function(_0x485e26){logger[_0xe61b('0xd')](_0xe61b('0xe'),_0x513acb,_0xe61b('0xf'));logger[_0xe61b('0x10')](_0xe61b('0x11'),_0x513acb,_0xe61b('0xf'),JSON[_0xe61b('0x12')](_0x485e26));if(_0x485e26[_0xe61b('0x13')]){if(_0x485e26[_0xe61b('0x13')][_0xe61b('0x14')]===0x1f4){logger[_0xe61b('0x13')]('DeskAccount,\x20%s,\x20%s',_0x513acb,_0x485e26['error']['message']);return _0x59b1e9(_0x485e26['error']['message']);}logger[_0xe61b('0x13')](_0xe61b('0xe'),_0x513acb,_0x485e26['error'][_0xe61b('0x15')]);return _0x503a86(_0x485e26[_0xe61b('0x13')]['message']);}else{logger[_0xe61b('0xd')]('DeskAccount,\x20%s,\x20%s',_0x513acb,_0xe61b('0xf'));_0x503a86(_0x485e26[_0xe61b('0x16')]['message']);}})['catch'](function(_0xe804a8){logger['error'](_0xe61b('0xe'),_0x513acb,_0xe804a8);_0x59b1e9(_0xe804a8);});});}exports[_0xe61b('0x17')]=function(_0x3fefa0){var _0x1b8dc1=this;return new Promise(function(_0x53aa1f,_0x5c53b9){return db[_0xe61b('0x18')][_0xe61b('0x19')]({'raw':_0x3fefa0[_0xe61b('0x1a')]?_0x3fefa0[_0xe61b('0x1a')][_0xe61b('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fefa0[_0xe61b('0x1a')]?_0x3fefa0[_0xe61b('0x1a')][_0xe61b('0x1c')]||null:null,'attributes':_0x3fefa0[_0xe61b('0x1a')]?_0x3fefa0['options'][_0xe61b('0x1d')]||null:null,'limit':_0x3fefa0['options']?_0x3fefa0['options']['limit']||null:null,'include':_0x3fefa0['options']?_0x3fefa0['options']['include']?_[_0xe61b('0x1e')](_0x3fefa0['options'][_0xe61b('0x1f')],function(_0x59368d){return{'model':db[_0x59368d['model']],'as':_0x59368d['as'],'attributes':_0x59368d[_0xe61b('0x1d')],'include':_0x59368d[_0xe61b('0x1f')]?_[_0xe61b('0x1e')](_0x59368d[_0xe61b('0x1f')],function(_0x17d2f0){return{'model':db[_0x17d2f0['model']],'as':_0x17d2f0['as'],'attributes':_0x17d2f0['attributes'],'include':_0x17d2f0[_0xe61b('0x1f')]?_['map'](_0x17d2f0[_0xe61b('0x1f')],function(_0x10b68b){return{'model':db[_0x10b68b[_0xe61b('0x20')]],'as':_0x10b68b['as'],'attributes':_0x10b68b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe61b('0xc')](function(_0x1ee3ee){logger[_0xe61b('0xd')]('GetDeskAccount',_0x3fefa0);logger[_0xe61b('0x10')]('GetDeskAccount',_0x3fefa0,JSON[_0xe61b('0x12')](_0x1ee3ee));_0x53aa1f(_0x1ee3ee);})[_0xe61b('0x21')](function(_0x482abb){logger[_0xe61b('0x13')](_0xe61b('0x17'),_0x482abb['message'],_0x3fefa0);_0x5c53b9(_0x1b8dc1[_0xe61b('0x13')](0x1f4,_0x482abb['message']));});});};exports['ShowDeskAccount']=function(_0x59be09){var _0x7cd615=this;return new Promise(function(_0x5b5303,_0x3f1a60){return db[_0xe61b('0x18')][_0xe61b('0x22')]({'raw':_0x59be09[_0xe61b('0x1a')]?_0x59be09[_0xe61b('0x1a')][_0xe61b('0x1b')]===undefined?!![]:![]:!![],'where':_0x59be09[_0xe61b('0x1a')]?_0x59be09['options'][_0xe61b('0x1c')]||null:null,'attributes':_0x59be09[_0xe61b('0x1a')]?_0x59be09[_0xe61b('0x1a')]['attributes']||null:null,'include':_0x59be09[_0xe61b('0x1a')]?_0x59be09[_0xe61b('0x1a')]['include']?_[_0xe61b('0x1e')](_0x59be09[_0xe61b('0x1a')][_0xe61b('0x1f')],function(_0x3cb05a){return{'model':db[_0x3cb05a[_0xe61b('0x20')]],'as':_0x3cb05a['as'],'attributes':_0x3cb05a['attributes'],'include':_0x3cb05a[_0xe61b('0x1f')]?_[_0xe61b('0x1e')](_0x3cb05a[_0xe61b('0x1f')],function(_0xc4a3f1){return{'model':db[_0xc4a3f1[_0xe61b('0x20')]],'as':_0xc4a3f1['as'],'attributes':_0xc4a3f1[_0xe61b('0x1d')],'include':_0xc4a3f1[_0xe61b('0x1f')]?_[_0xe61b('0x1e')](_0xc4a3f1[_0xe61b('0x1f')],function(_0x310d9f){return{'model':db[_0x310d9f[_0xe61b('0x20')]],'as':_0x310d9f['as'],'attributes':_0x310d9f[_0xe61b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x290d40){logger[_0xe61b('0xd')]('ShowDeskAccount',_0x59be09);logger[_0xe61b('0x10')](_0xe61b('0x23'),_0x59be09,JSON[_0xe61b('0x12')](_0x290d40));_0x5b5303(_0x290d40);})['catch'](function(_0x2a5dff){logger[_0xe61b('0x13')](_0xe61b('0x23'),_0x2a5dff[_0xe61b('0x15')],_0x59be09);_0x3f1a60(_0x7cd615['error'](0x1f4,_0x2a5dff[_0xe61b('0x15')]));});});}; \ No newline at end of file +var _0x7ebc=['catch','find','raw','where','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','attributes','include','map','model','then'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x7ebc,0xb4));var _0xc7eb=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x7ebc[_0x154192];return _0x3c2792;};'use strict';var _=require(_0xc7eb('0x0'));var util=require(_0xc7eb('0x1'));var moment=require(_0xc7eb('0x2'));var BPromise=require(_0xc7eb('0x3'));var rs=require(_0xc7eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc7eb('0x5'))(_0xc7eb('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7eb('0x7'));var client=jayson[_0xc7eb('0x8')][_0xc7eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d972,_0x363ffe,_0x231785){return new BPromise(function(_0x5b1bcf,_0x1da0a4){return client[_0xc7eb('0xa')](_0x11d972,_0x231785)['then'](function(_0x11bf57){logger[_0xc7eb('0xb')](_0xc7eb('0xc'),_0x363ffe,_0xc7eb('0xd'));logger[_0xc7eb('0xe')](_0xc7eb('0xf'),_0x363ffe,_0xc7eb('0xd'),JSON[_0xc7eb('0x10')](_0x11bf57));if(_0x11bf57[_0xc7eb('0x11')]){if(_0x11bf57[_0xc7eb('0x11')][_0xc7eb('0x12')]===0x1f4){logger[_0xc7eb('0x11')](_0xc7eb('0xc'),_0x363ffe,_0x11bf57['error'][_0xc7eb('0x13')]);return _0x1da0a4(_0x11bf57[_0xc7eb('0x11')][_0xc7eb('0x13')]);}logger['error'](_0xc7eb('0xc'),_0x363ffe,_0x11bf57[_0xc7eb('0x11')][_0xc7eb('0x13')]);return _0x5b1bcf(_0x11bf57[_0xc7eb('0x11')][_0xc7eb('0x13')]);}else{logger['info'](_0xc7eb('0xc'),_0x363ffe,_0xc7eb('0xd'));_0x5b1bcf(_0x11bf57[_0xc7eb('0x14')][_0xc7eb('0x13')]);}})['catch'](function(_0x568f29){logger[_0xc7eb('0x11')](_0xc7eb('0xc'),_0x363ffe,_0x568f29);_0x1da0a4(_0x568f29);});});}exports[_0xc7eb('0x15')]=function(_0x2bf799){var _0x157d51=this;return new Promise(function(_0x22981a,_0x48e160){return db[_0xc7eb('0x16')][_0xc7eb('0x17')]({'raw':_0x2bf799[_0xc7eb('0x18')]?_0x2bf799[_0xc7eb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bf799[_0xc7eb('0x18')]?_0x2bf799['options']['where']||null:null,'attributes':_0x2bf799['options']?_0x2bf799[_0xc7eb('0x18')][_0xc7eb('0x19')]||null:null,'limit':_0x2bf799['options']?_0x2bf799['options']['limit']||null:null,'include':_0x2bf799[_0xc7eb('0x18')]?_0x2bf799[_0xc7eb('0x18')][_0xc7eb('0x1a')]?_[_0xc7eb('0x1b')](_0x2bf799[_0xc7eb('0x18')][_0xc7eb('0x1a')],function(_0x2a52ca){return{'model':db[_0x2a52ca[_0xc7eb('0x1c')]],'as':_0x2a52ca['as'],'attributes':_0x2a52ca[_0xc7eb('0x19')],'include':_0x2a52ca[_0xc7eb('0x1a')]?_[_0xc7eb('0x1b')](_0x2a52ca[_0xc7eb('0x1a')],function(_0x22f72d){return{'model':db[_0x22f72d['model']],'as':_0x22f72d['as'],'attributes':_0x22f72d[_0xc7eb('0x19')],'include':_0x22f72d[_0xc7eb('0x1a')]?_['map'](_0x22f72d[_0xc7eb('0x1a')],function(_0x4accd0){return{'model':db[_0x4accd0['model']],'as':_0x4accd0['as'],'attributes':_0x4accd0[_0xc7eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc7eb('0x1d')](function(_0x4db65b){logger[_0xc7eb('0xb')](_0xc7eb('0x15'),_0x2bf799);logger[_0xc7eb('0xe')](_0xc7eb('0x15'),_0x2bf799,JSON[_0xc7eb('0x10')](_0x4db65b));_0x22981a(_0x4db65b);})[_0xc7eb('0x1e')](function(_0x745790){logger['error'](_0xc7eb('0x15'),_0x745790[_0xc7eb('0x13')],_0x2bf799);_0x48e160(_0x157d51['error'](0x1f4,_0x745790[_0xc7eb('0x13')]));});});};exports['ShowDeskAccount']=function(_0x533fef){var _0x1b4b7b=this;return new Promise(function(_0x77196b,_0x7f0e78){return db[_0xc7eb('0x16')][_0xc7eb('0x1f')]({'raw':_0x533fef['options']?_0x533fef['options'][_0xc7eb('0x20')]===undefined?!![]:![]:!![],'where':_0x533fef[_0xc7eb('0x18')]?_0x533fef[_0xc7eb('0x18')][_0xc7eb('0x21')]||null:null,'attributes':_0x533fef['options']?_0x533fef[_0xc7eb('0x18')]['attributes']||null:null,'include':_0x533fef[_0xc7eb('0x18')]?_0x533fef[_0xc7eb('0x18')]['include']?_[_0xc7eb('0x1b')](_0x533fef[_0xc7eb('0x18')]['include'],function(_0x5bfb3b){return{'model':db[_0x5bfb3b['model']],'as':_0x5bfb3b['as'],'attributes':_0x5bfb3b[_0xc7eb('0x19')],'include':_0x5bfb3b[_0xc7eb('0x1a')]?_[_0xc7eb('0x1b')](_0x5bfb3b[_0xc7eb('0x1a')],function(_0x39b2c4){return{'model':db[_0x39b2c4[_0xc7eb('0x1c')]],'as':_0x39b2c4['as'],'attributes':_0x39b2c4['attributes'],'include':_0x39b2c4[_0xc7eb('0x1a')]?_['map'](_0x39b2c4[_0xc7eb('0x1a')],function(_0x182213){return{'model':db[_0x182213[_0xc7eb('0x1c')]],'as':_0x182213['as'],'attributes':_0x182213[_0xc7eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc7eb('0x1d')](function(_0x3aac6a){logger['info']('ShowDeskAccount',_0x533fef);logger['debug'](_0xc7eb('0x22'),_0x533fef,JSON[_0xc7eb('0x10')](_0x3aac6a));_0x77196b(_0x3aac6a);})[_0xc7eb('0x1e')](function(_0x56ae21){logger['error'](_0xc7eb('0x22'),_0x56ae21[_0xc7eb('0x13')],_0x533fef);_0x7f0e78(_0x1b4b7b[_0xc7eb('0x11')](0x1f4,_0x56ae21[_0xc7eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4d44a01..b12d504 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(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x55ca,0x126));var _0xa55c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x55ca[_0x39d544];return _0x5a5ff2;};'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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x4e3f62,_0x2af0b5){var _0x44db4d=function(_0x3ec8fd){while(--_0x3ec8fd){_0x4e3f62['push'](_0x4e3f62['shift']());}};_0x44db4d(++_0x2af0b5);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e61f3,_0x5cc8c7){_0x4e61f3=_0x4e61f3-0x0;var _0x358be2=_0xedd9[_0x4e61f3];return _0x358be2;};'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('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 18eaac7..01e8469 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 _0xb8c5=['sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb8c5,0x18c));var _0x5b8c=function(_0x28fcdc,_0x17e930){_0x28fcdc=_0x28fcdc-0x0;var _0x80bd4c=_0xb8c5[_0x28fcdc];return _0x80bd4c;};'use strict';var Sequelize=require(_0x5b8c('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b8c('0x1')]},'description':{'type':Sequelize[_0x5b8c('0x1')]}}; \ No newline at end of file +var _0x139e=['exports','STRING','sequelize'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x139e,0x137));var _0xe139=function(_0x15d403,_0x13d8b8){_0x15d403=_0x15d403-0x0;var _0x59a253=_0x139e[_0x15d403];return _0x59a253;};'use strict';var Sequelize=require(_0xe139('0x0'));module[_0xe139('0x1')]={'name':{'type':Sequelize[_0xe139('0x2')]},'description':{'type':Sequelize[_0xe139('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 06f87ab..562e4c0 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 _0xeb80=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','findOne','DeskField','getSubjects','getDescriptions','rawAttributes','order','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','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','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','DeskConfiguration','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xeb80,0xc5));var _0x0eb8=function(_0x46d3a2,_0x4c6f1c){_0x46d3a2=_0x46d3a2-0x0;var _0x572a52=_0xeb80[_0x46d3a2];return _0x572a52;};'use strict';var emlformat=require(_0x0eb8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb8('0x1'));var rp=require(_0x0eb8('0x2'));var moment=require(_0x0eb8('0x3'));var BPromise=require(_0x0eb8('0x4'));var Mustache=require(_0x0eb8('0x5'));var util=require(_0x0eb8('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0eb8('0x7'));var fs=require('fs');var fs_extra=require(_0x0eb8('0x8'));var _=require(_0x0eb8('0x9'));var squel=require(_0x0eb8('0xa'));var crypto=require(_0x0eb8('0xb'));var jsforce=require(_0x0eb8('0xc'));var deskjs=require(_0x0eb8('0xd'));var toCsv=require(_0x0eb8('0xe'));var querystring=require('querystring');var Papa=require(_0x0eb8('0xf'));var Redis=require(_0x0eb8('0x10'));var authService=require(_0x0eb8('0x11'));var qs=require(_0x0eb8('0x12'));var as=require(_0x0eb8('0x13'));var hardwareService=require(_0x0eb8('0x14'));var logger=require(_0x0eb8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0eb8('0x16'));var licenseUtil=require(_0x0eb8('0x17'));var db=require(_0x0eb8('0x18'))['db'];function respondWithStatusCode(_0x30b18,_0x4b8e6a){_0x4b8e6a=_0x4b8e6a||0xcc;return function(_0x5cdd0b){if(_0x5cdd0b){return _0x30b18['sendStatus'](_0x4b8e6a);}return _0x30b18[_0x0eb8('0x19')](_0x4b8e6a)[_0x0eb8('0x1a')]();};}function respondWithResult(_0x5cfec0,_0x4609b3){_0x4609b3=_0x4609b3||0xc8;return function(_0x5398d9){if(_0x5398d9){return _0x5cfec0[_0x0eb8('0x19')](_0x4609b3)[_0x0eb8('0x1b')](_0x5398d9);}};}function respondWithFilteredResult(_0x3a1eca,_0x15b9d1){return function(_0x410fe0){if(_0x410fe0){var _0x543b69=typeof _0x15b9d1[_0x0eb8('0x1c')]===_0x0eb8('0x1d')&&typeof _0x15b9d1[_0x0eb8('0x1e')]==='undefined';var _0x1b9eb6=_0x410fe0[_0x0eb8('0x1f')];var _0x4e5afa=_0x543b69?0x0:_0x15b9d1[_0x0eb8('0x1c')];var _0x5abb2a=_0x543b69?_0x410fe0[_0x0eb8('0x1f')]:_0x15b9d1[_0x0eb8('0x1c')]+_0x15b9d1[_0x0eb8('0x1e')];var _0x5b1ff7;if(_0x5abb2a>=_0x1b9eb6){_0x5abb2a=_0x1b9eb6;_0x5b1ff7=0xc8;}else{_0x5b1ff7=0xce;}_0x3a1eca[_0x0eb8('0x19')](_0x5b1ff7);return _0x3a1eca[_0x0eb8('0x20')](_0x0eb8('0x21'),_0x4e5afa+'-'+_0x5abb2a+'/'+_0x1b9eb6)[_0x0eb8('0x1b')](_0x410fe0);}return null;};}function patchUpdates(_0x261977){return function(_0x14fc5c){try{jsonpatch[_0x0eb8('0x22')](_0x14fc5c,_0x261977,!![]);}catch(_0x48a31e){return BPromise[_0x0eb8('0x23')](_0x48a31e);}return _0x14fc5c[_0x0eb8('0x24')]();};}function saveUpdates(_0x4cf137,_0x3887e7){return function(_0x237917){if(_0x237917){return _0x237917['update'](_0x4cf137)[_0x0eb8('0x25')](function(_0x56f4b9){return _0x56f4b9;});}return null;};}function removeEntity(_0x2813df,_0x5dcb24){return function(_0x540608){if(_0x540608){return _0x540608[_0x0eb8('0x26')]()[_0x0eb8('0x25')](function(){_0x2813df[_0x0eb8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52af27,_0x1c026e){return function(_0x25bab3){if(!_0x25bab3){_0x52af27[_0x0eb8('0x27')](0x194);}return _0x25bab3;};}function handleError(_0x4aa12b,_0x5f3b2c){_0x5f3b2c=_0x5f3b2c||0x1f4;return function(_0x524fc6){logger['error'](_0x524fc6[_0x0eb8('0x28')]);if(_0x524fc6[_0x0eb8('0x29')]){delete _0x524fc6['name'];}_0x4aa12b['status'](_0x5f3b2c)[_0x0eb8('0x2a')](_0x524fc6);};}exports['index']=function(_0x9c1ce3,_0x31d01c){var _0x924000={},_0x32dedc={},_0x448277={'count':0x0,'rows':[]};var _0x5edcd3=_[_0x0eb8('0x2b')](db[_0x0eb8('0x2c')]['rawAttributes'],function(_0x39c5dc){return{'name':_0x39c5dc[_0x0eb8('0x2d')],'type':_0x39c5dc['type']['key']};});_0x32dedc[_0x0eb8('0x2e')]=_[_0x0eb8('0x2b')](_0x5edcd3,_0x0eb8('0x29'));_0x32dedc[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x9c1ce3[_0x0eb8('0x2f')]);_0x32dedc[_0x0eb8('0x31')]=_[_0x0eb8('0x32')](_0x32dedc['model'],_0x32dedc[_0x0eb8('0x2f')]);_0x924000[_0x0eb8('0x33')]=_[_0x0eb8('0x32')](_0x32dedc[_0x0eb8('0x2e')],qs[_0x0eb8('0x34')](_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x34')]));_0x924000['attributes']=_0x924000[_0x0eb8('0x33')][_0x0eb8('0x35')]?_0x924000[_0x0eb8('0x33')]:_0x32dedc[_0x0eb8('0x2e')];if(!_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x36')](_0x0eb8('0x37'))){_0x924000[_0x0eb8('0x1e')]=qs[_0x0eb8('0x1e')](_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x1e')]);_0x924000[_0x0eb8('0x1c')]=qs[_0x0eb8('0x1c')](_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x1c')]);}_0x924000['order']=qs[_0x0eb8('0x38')](_0x9c1ce3['query'][_0x0eb8('0x38')]);_0x924000[_0x0eb8('0x39')]=qs[_0x0eb8('0x31')](_[_0x0eb8('0x3a')](_0x9c1ce3[_0x0eb8('0x2f')],_0x32dedc[_0x0eb8('0x31')]),_0x5edcd3);if(_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x3b')]){_0x924000[_0x0eb8('0x39')]=_[_0x0eb8('0x3c')](_0x924000[_0x0eb8('0x39')],{'$or':_[_0x0eb8('0x2b')](_0x5edcd3,function(_0x23c116){if(_0x23c116[_0x0eb8('0x3d')]!==_0x0eb8('0x3e')){var _0x17fe6d={};_0x17fe6d[_0x23c116[_0x0eb8('0x29')]]={'$like':'%'+_0x9c1ce3['query'][_0x0eb8('0x3b')]+'%'};return _0x17fe6d;}})});}_0x924000=_[_0x0eb8('0x3c')]({},_0x924000,_0x9c1ce3[_0x0eb8('0x3f')]);var _0x22b8dc={'where':_0x924000[_0x0eb8('0x39')]};return db['DeskConfiguration']['count'](_0x22b8dc)[_0x0eb8('0x25')](function(_0x590e0a){_0x448277[_0x0eb8('0x1f')]=_0x590e0a;if(_0x9c1ce3[_0x0eb8('0x2f')][_0x0eb8('0x40')]){_0x924000[_0x0eb8('0x41')]=[{'all':!![]}];}return db[_0x0eb8('0x2c')][_0x0eb8('0x42')](_0x924000);})['then'](function(_0x2dcc94){_0x448277['rows']=_0x2dcc94;return _0x448277;})[_0x0eb8('0x25')](respondWithFilteredResult(_0x31d01c,_0x924000))[_0x0eb8('0x43')](handleError(_0x31d01c,null));};exports[_0x0eb8('0x44')]=function(_0x5cf440,_0x217731){var _0x3068c7={'raw':![],'where':{'id':_0x5cf440[_0x0eb8('0x45')]['id']}},_0x22beb9={};_0x22beb9['model']=_[_0x0eb8('0x30')](db[_0x0eb8('0x2c')]['rawAttributes']);_0x22beb9[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x5cf440['query']);_0x22beb9[_0x0eb8('0x31')]=_[_0x0eb8('0x32')](_0x22beb9[_0x0eb8('0x2e')],_0x22beb9[_0x0eb8('0x2f')]);_0x3068c7[_0x0eb8('0x33')]=_[_0x0eb8('0x32')](_0x22beb9[_0x0eb8('0x2e')],qs['fields'](_0x5cf440[_0x0eb8('0x2f')][_0x0eb8('0x34')]));_0x3068c7[_0x0eb8('0x33')]=_0x3068c7['attributes']['length']?_0x3068c7['attributes']:_0x22beb9[_0x0eb8('0x2e')];if(_0x5cf440[_0x0eb8('0x2f')]['includeAll']){_0x3068c7[_0x0eb8('0x41')]=[{'all':!![]}];}_0x3068c7=_['merge']({},_0x3068c7,_0x5cf440[_0x0eb8('0x3f')]);return db[_0x0eb8('0x2c')][_0x0eb8('0x46')](_0x3068c7)['then'](handleEntityNotFound(_0x217731,null))[_0x0eb8('0x25')](respondWithResult(_0x217731,null))[_0x0eb8('0x43')](handleError(_0x217731,null));};exports[_0x0eb8('0x47')]=function(_0x145289,_0x10955e){return db[_0x0eb8('0x2c')][_0x0eb8('0x47')](_0x145289[_0x0eb8('0x48')],{})['then'](respondWithResult(_0x10955e,0xc9))['catch'](handleError(_0x10955e,null));};exports[_0x0eb8('0x49')]=function(_0x1de546,_0x57fefa){if(_0x1de546['body']['id']){delete _0x1de546['body']['id'];}return db[_0x0eb8('0x2c')][_0x0eb8('0x46')]({'where':{'id':_0x1de546[_0x0eb8('0x45')]['id']}})['then'](handleEntityNotFound(_0x57fefa,null))[_0x0eb8('0x25')](saveUpdates(_0x1de546[_0x0eb8('0x48')],null))[_0x0eb8('0x25')](respondWithResult(_0x57fefa,null))[_0x0eb8('0x43')](handleError(_0x57fefa,null));};exports[_0x0eb8('0x26')]=function(_0x565be4,_0x1da43b){return db['DeskConfiguration'][_0x0eb8('0x46')]({'where':{'id':_0x565be4[_0x0eb8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1da43b,null))['then'](removeEntity(_0x1da43b,null))['catch'](handleError(_0x1da43b,null));};exports[_0x0eb8('0x4a')]=function(_0x1c3eed,_0x41e989,_0x44d70d){var _0x104eee={};var _0x510bc9={};var _0x35ba65;var _0x5d5186;return db[_0x0eb8('0x2c')][_0x0eb8('0x4b')]({'where':{'id':_0x1c3eed[_0x0eb8('0x45')]['id']}})[_0x0eb8('0x25')](handleEntityNotFound(_0x41e989,null))[_0x0eb8('0x25')](function(_0x5becf9){if(_0x5becf9){_0x35ba65=_0x5becf9;_0x510bc9[_0x0eb8('0x2e')]=_['keys'](db[_0x0eb8('0x4c')]['rawAttributes']);_0x510bc9[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x1c3eed[_0x0eb8('0x2f')]);_0x510bc9[_0x0eb8('0x31')]=_[_0x0eb8('0x32')](_0x510bc9[_0x0eb8('0x2e')],_0x510bc9[_0x0eb8('0x2f')]);_0x104eee[_0x0eb8('0x33')]=_['intersection'](_0x510bc9[_0x0eb8('0x2e')],qs['fields'](_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x34')]));_0x104eee[_0x0eb8('0x33')]=_0x104eee[_0x0eb8('0x33')][_0x0eb8('0x35')]?_0x104eee[_0x0eb8('0x33')]:_0x510bc9['model'];_0x104eee['order']=qs[_0x0eb8('0x38')](_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x38')]);_0x104eee[_0x0eb8('0x39')]=qs['filters'](_[_0x0eb8('0x3a')](_0x1c3eed[_0x0eb8('0x2f')],_0x510bc9[_0x0eb8('0x31')]));if(_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x3b')]){_0x104eee[_0x0eb8('0x39')]=_[_0x0eb8('0x3c')](_0x104eee[_0x0eb8('0x39')],{'$or':_[_0x0eb8('0x2b')](_0x104eee['attributes'],function(_0x33b5cd){var _0x111bc2={};_0x111bc2[_0x33b5cd]={'$like':'%'+_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x3b')]+'%'};return _0x111bc2;})});}_0x104eee=_[_0x0eb8('0x3c')]({},_0x104eee,_0x1c3eed['options']);return _0x35ba65[_0x0eb8('0x4a')](_0x104eee);}})[_0x0eb8('0x25')](function(_0x5cb92d){if(_0x5cb92d){_0x5d5186=_0x5cb92d[_0x0eb8('0x35')];if(!_0x1c3eed['query']['hasOwnProperty'](_0x0eb8('0x37'))){_0x104eee[_0x0eb8('0x1e')]=qs[_0x0eb8('0x1e')](_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x1e')]);_0x104eee[_0x0eb8('0x1c')]=qs[_0x0eb8('0x1c')](_0x1c3eed[_0x0eb8('0x2f')][_0x0eb8('0x1c')]);}return _0x35ba65[_0x0eb8('0x4a')](_0x104eee);}})[_0x0eb8('0x25')](function(_0x596b8e){if(_0x596b8e){return _0x596b8e?{'count':_0x5d5186,'rows':_0x596b8e}:null;}})[_0x0eb8('0x25')](respondWithResult(_0x41e989,null))['catch'](handleError(_0x41e989,null));};exports['getSubjects']=function(_0x12d7aa,_0x1ace36,_0x1e7d77){var _0x4ce994={};var _0x1308c7={};var _0x1985d0;var _0x2ddb93;return db[_0x0eb8('0x2c')]['findOne']({'where':{'id':_0x12d7aa[_0x0eb8('0x45')]['id']}})[_0x0eb8('0x25')](handleEntityNotFound(_0x1ace36,null))[_0x0eb8('0x25')](function(_0x1f2c9b){if(_0x1f2c9b){_0x1985d0=_0x1f2c9b;_0x1308c7[_0x0eb8('0x2e')]=_['keys'](db[_0x0eb8('0x4c')]['rawAttributes']);_0x1308c7[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x12d7aa[_0x0eb8('0x2f')]);_0x1308c7[_0x0eb8('0x31')]=_['intersection'](_0x1308c7['model'],_0x1308c7[_0x0eb8('0x2f')]);_0x4ce994['attributes']=_[_0x0eb8('0x32')](_0x1308c7[_0x0eb8('0x2e')],qs[_0x0eb8('0x34')](_0x12d7aa['query'][_0x0eb8('0x34')]));_0x4ce994['attributes']=_0x4ce994[_0x0eb8('0x33')][_0x0eb8('0x35')]?_0x4ce994[_0x0eb8('0x33')]:_0x1308c7[_0x0eb8('0x2e')];_0x4ce994['order']=qs[_0x0eb8('0x38')](_0x12d7aa[_0x0eb8('0x2f')][_0x0eb8('0x38')]);_0x4ce994[_0x0eb8('0x39')]=qs['filters'](_[_0x0eb8('0x3a')](_0x12d7aa['query'],_0x1308c7[_0x0eb8('0x31')]));if(_0x12d7aa['query'][_0x0eb8('0x3b')]){_0x4ce994['where']=_[_0x0eb8('0x3c')](_0x4ce994[_0x0eb8('0x39')],{'$or':_[_0x0eb8('0x2b')](_0x4ce994[_0x0eb8('0x33')],function(_0x46df8d){var _0x571840={};_0x571840[_0x46df8d]={'$like':'%'+_0x12d7aa[_0x0eb8('0x2f')][_0x0eb8('0x3b')]+'%'};return _0x571840;})});}_0x4ce994=_[_0x0eb8('0x3c')]({},_0x4ce994,_0x12d7aa[_0x0eb8('0x3f')]);return _0x1985d0[_0x0eb8('0x4d')](_0x4ce994);}})[_0x0eb8('0x25')](function(_0x1aea81){if(_0x1aea81){_0x2ddb93=_0x1aea81[_0x0eb8('0x35')];if(!_0x12d7aa[_0x0eb8('0x2f')][_0x0eb8('0x36')]('nolimit')){_0x4ce994[_0x0eb8('0x1e')]=qs[_0x0eb8('0x1e')](_0x12d7aa[_0x0eb8('0x2f')]['limit']);_0x4ce994['offset']=qs['offset'](_0x12d7aa[_0x0eb8('0x2f')]['offset']);}return _0x1985d0['getSubjects'](_0x4ce994);}})[_0x0eb8('0x25')](function(_0x548716){if(_0x548716){return _0x548716?{'count':_0x2ddb93,'rows':_0x548716}:null;}})[_0x0eb8('0x25')](respondWithResult(_0x1ace36,null))[_0x0eb8('0x43')](handleError(_0x1ace36,null));};exports[_0x0eb8('0x4e')]=function(_0x1617c4,_0x154db1,_0x41b236){var _0x53515e={};var _0x1ee0c0={};var _0x2675e0;var _0x9308f2;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1617c4[_0x0eb8('0x45')]['id']}})[_0x0eb8('0x25')](handleEntityNotFound(_0x154db1,null))[_0x0eb8('0x25')](function(_0x1019b5){if(_0x1019b5){_0x2675e0=_0x1019b5;_0x1ee0c0[_0x0eb8('0x2e')]=_[_0x0eb8('0x30')](db[_0x0eb8('0x4c')][_0x0eb8('0x4f')]);_0x1ee0c0[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x1617c4[_0x0eb8('0x2f')]);_0x1ee0c0[_0x0eb8('0x31')]=_[_0x0eb8('0x32')](_0x1ee0c0[_0x0eb8('0x2e')],_0x1ee0c0[_0x0eb8('0x2f')]);_0x53515e[_0x0eb8('0x33')]=_[_0x0eb8('0x32')](_0x1ee0c0['model'],qs[_0x0eb8('0x34')](_0x1617c4[_0x0eb8('0x2f')]['fields']));_0x53515e[_0x0eb8('0x33')]=_0x53515e[_0x0eb8('0x33')][_0x0eb8('0x35')]?_0x53515e['attributes']:_0x1ee0c0[_0x0eb8('0x2e')];_0x53515e[_0x0eb8('0x50')]=qs[_0x0eb8('0x38')](_0x1617c4[_0x0eb8('0x2f')][_0x0eb8('0x38')]);_0x53515e[_0x0eb8('0x39')]=qs[_0x0eb8('0x31')](_[_0x0eb8('0x3a')](_0x1617c4[_0x0eb8('0x2f')],_0x1ee0c0[_0x0eb8('0x31')]));if(_0x1617c4[_0x0eb8('0x2f')]['filter']){_0x53515e[_0x0eb8('0x39')]=_[_0x0eb8('0x3c')](_0x53515e[_0x0eb8('0x39')],{'$or':_[_0x0eb8('0x2b')](_0x53515e[_0x0eb8('0x33')],function(_0x21b169){var _0x359bef={};_0x359bef[_0x21b169]={'$like':'%'+_0x1617c4[_0x0eb8('0x2f')][_0x0eb8('0x3b')]+'%'};return _0x359bef;})});}_0x53515e=_[_0x0eb8('0x3c')]({},_0x53515e,_0x1617c4['options']);return _0x2675e0[_0x0eb8('0x4e')](_0x53515e);}})[_0x0eb8('0x25')](function(_0x1f2dea){if(_0x1f2dea){_0x9308f2=_0x1f2dea[_0x0eb8('0x35')];if(!_0x1617c4[_0x0eb8('0x2f')][_0x0eb8('0x36')](_0x0eb8('0x37'))){_0x53515e[_0x0eb8('0x1e')]=qs[_0x0eb8('0x1e')](_0x1617c4[_0x0eb8('0x2f')][_0x0eb8('0x1e')]);_0x53515e[_0x0eb8('0x1c')]=qs[_0x0eb8('0x1c')](_0x1617c4[_0x0eb8('0x2f')][_0x0eb8('0x1c')]);}return _0x2675e0[_0x0eb8('0x4e')](_0x53515e);}})['then'](function(_0x59db7c){if(_0x59db7c){return _0x59db7c?{'count':_0x9308f2,'rows':_0x59db7c}:null;}})[_0x0eb8('0x25')](respondWithResult(_0x154db1,null))[_0x0eb8('0x43')](handleError(_0x154db1,null));};exports['getTags']=function(_0x8fd34f,_0x592094,_0x4ade42){var _0xe51af3={};var _0x86dd1c={};var _0xfb5e3b;var _0x28c43c;return db[_0x0eb8('0x2c')][_0x0eb8('0x4b')]({'where':{'id':_0x8fd34f[_0x0eb8('0x45')]['id']}})[_0x0eb8('0x25')](handleEntityNotFound(_0x592094,null))['then'](function(_0x1932d8){if(_0x1932d8){_0xfb5e3b=_0x1932d8;_0x86dd1c[_0x0eb8('0x2e')]=_['keys'](db[_0x0eb8('0x51')][_0x0eb8('0x4f')]);_0x86dd1c[_0x0eb8('0x2f')]=_[_0x0eb8('0x30')](_0x8fd34f[_0x0eb8('0x2f')]);_0x86dd1c[_0x0eb8('0x31')]=_[_0x0eb8('0x32')](_0x86dd1c[_0x0eb8('0x2e')],_0x86dd1c[_0x0eb8('0x2f')]);_0xe51af3[_0x0eb8('0x33')]=_['intersection'](_0x86dd1c['model'],qs['fields'](_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x34')]));_0xe51af3['attributes']=_0xe51af3['attributes'][_0x0eb8('0x35')]?_0xe51af3['attributes']:_0x86dd1c[_0x0eb8('0x2e')];_0xe51af3[_0x0eb8('0x50')]=qs[_0x0eb8('0x38')](_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x38')]);_0xe51af3[_0x0eb8('0x39')]=qs['filters'](_[_0x0eb8('0x3a')](_0x8fd34f[_0x0eb8('0x2f')],_0x86dd1c[_0x0eb8('0x31')]));if(_0x8fd34f[_0x0eb8('0x2f')]['filter']){_0xe51af3['where']=_[_0x0eb8('0x3c')](_0xe51af3[_0x0eb8('0x39')],{'$or':_['map'](_0xe51af3[_0x0eb8('0x33')],function(_0x1be557){var _0x289626={};_0x289626[_0x1be557]={'$like':'%'+_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x3b')]+'%'};return _0x289626;})});}_0xe51af3=_[_0x0eb8('0x3c')]({},_0xe51af3,_0x8fd34f['options']);return _0xfb5e3b['getTags'](_0xe51af3);}})[_0x0eb8('0x25')](function(_0x4be305){if(_0x4be305){_0x28c43c=_0x4be305[_0x0eb8('0x35')];if(!_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x36')](_0x0eb8('0x37'))){_0xe51af3[_0x0eb8('0x1e')]=qs[_0x0eb8('0x1e')](_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x1e')]);_0xe51af3[_0x0eb8('0x1c')]=qs['offset'](_0x8fd34f[_0x0eb8('0x2f')][_0x0eb8('0x1c')]);}return _0xfb5e3b[_0x0eb8('0x52')](_0xe51af3);}})[_0x0eb8('0x25')](function(_0x3c9bcd){if(_0x3c9bcd){return _0x3c9bcd?{'count':_0x28c43c,'rows':_0x3c9bcd}:null;}})[_0x0eb8('0x25')](respondWithResult(_0x592094,null))[_0x0eb8('0x43')](handleError(_0x592094,null));};exports['setTags']=function(_0x4fbbb9,_0x5ea28d,_0x39620f){if(_0x4fbbb9[_0x0eb8('0x48')]['id']){delete _0x4fbbb9[_0x0eb8('0x48')]['id'];}return db[_0x0eb8('0x2c')]['findOne']({'where':{'id':_0x4fbbb9['params']['id']}})[_0x0eb8('0x25')](handleEntityNotFound(_0x5ea28d,null))[_0x0eb8('0x25')](function(_0x2a365a){if(_0x2a365a){return _0x2a365a[_0x0eb8('0x53')](_0x4fbbb9[_0x0eb8('0x48')][_0x0eb8('0x54')]||[]);}return null;})[_0x0eb8('0x25')](respondWithResult(_0x5ea28d,null))[_0x0eb8('0x43')](handleError(_0x5ea28d,null));}; \ No newline at end of file +var _0x66b8=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','DeskConfiguration','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getFields','findOne','DeskField','rawAttributes','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x66b8,0xe1));var _0x866b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x66b8[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x866b('0x0'));var rimraf=require(_0x866b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x866b('0x2'));var moment=require(_0x866b('0x3'));var BPromise=require(_0x866b('0x4'));var Mustache=require('mustache');var util=require(_0x866b('0x5'));var path=require(_0x866b('0x6'));var sox=require(_0x866b('0x7'));var csv=require(_0x866b('0x8'));var ejs=require(_0x866b('0x9'));var fs=require('fs');var fs_extra=require(_0x866b('0xa'));var _=require(_0x866b('0xb'));var squel=require(_0x866b('0xc'));var crypto=require('crypto');var jsforce=require(_0x866b('0xd'));var deskjs=require(_0x866b('0xe'));var toCsv=require(_0x866b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x866b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x866b('0x10'));var hardwareService=require(_0x866b('0x11'));var logger=require('../../config/logger')(_0x866b('0x12'));var utils=require(_0x866b('0x13'));var config=require(_0x866b('0x14'));var licenseUtil=require(_0x866b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3985c5,_0x3715e8){_0x3715e8=_0x3715e8||0xcc;return function(_0x134f43){if(_0x134f43){return _0x3985c5[_0x866b('0x16')](_0x3715e8);}return _0x3985c5[_0x866b('0x17')](_0x3715e8)[_0x866b('0x18')]();};}function respondWithResult(_0x5a287d,_0x4779bc){_0x4779bc=_0x4779bc||0xc8;return function(_0x17fd63){if(_0x17fd63){return _0x5a287d[_0x866b('0x17')](_0x4779bc)[_0x866b('0x19')](_0x17fd63);}};}function respondWithFilteredResult(_0x3ff1b3,_0x2ad6e0){return function(_0x204531){if(_0x204531){var _0x53ffb4=typeof _0x2ad6e0[_0x866b('0x1a')]===_0x866b('0x1b')&&typeof _0x2ad6e0[_0x866b('0x1c')]===_0x866b('0x1b');var _0x40941b=_0x204531[_0x866b('0x1d')];var _0x49b776=_0x53ffb4?0x0:_0x2ad6e0[_0x866b('0x1a')];var _0x4f3bc5=_0x53ffb4?_0x204531[_0x866b('0x1d')]:_0x2ad6e0[_0x866b('0x1a')]+_0x2ad6e0[_0x866b('0x1c')];var _0x1fcfe4;if(_0x4f3bc5>=_0x40941b){_0x4f3bc5=_0x40941b;_0x1fcfe4=0xc8;}else{_0x1fcfe4=0xce;}_0x3ff1b3['status'](_0x1fcfe4);return _0x3ff1b3[_0x866b('0x1e')](_0x866b('0x1f'),_0x49b776+'-'+_0x4f3bc5+'/'+_0x40941b)['json'](_0x204531);}return null;};}function patchUpdates(_0x42e5c4){return function(_0x153456){try{jsonpatch[_0x866b('0x20')](_0x153456,_0x42e5c4,!![]);}catch(_0x2f69f1){return BPromise[_0x866b('0x21')](_0x2f69f1);}return _0x153456[_0x866b('0x22')]();};}function saveUpdates(_0x478641,_0xcbb2c3){return function(_0x49a655){if(_0x49a655){return _0x49a655['update'](_0x478641)[_0x866b('0x23')](function(_0x1adbac){return _0x1adbac;});}return null;};}function removeEntity(_0x4949cd,_0x12d03f){return function(_0x4849ba){if(_0x4849ba){return _0x4849ba['destroy']()[_0x866b('0x23')](function(){_0x4949cd['status'](0xcc)[_0x866b('0x18')]();});}};}function handleEntityNotFound(_0x3d859d,_0x332e1b){return function(_0x4ac5c7){if(!_0x4ac5c7){_0x3d859d['sendStatus'](0x194);}return _0x4ac5c7;};}function handleError(_0x1e3d2e,_0x30dd0e){_0x30dd0e=_0x30dd0e||0x1f4;return function(_0x2c6e59){logger[_0x866b('0x24')](_0x2c6e59[_0x866b('0x25')]);if(_0x2c6e59[_0x866b('0x26')]){delete _0x2c6e59[_0x866b('0x26')];}_0x1e3d2e[_0x866b('0x17')](_0x30dd0e)[_0x866b('0x27')](_0x2c6e59);};}exports[_0x866b('0x28')]=function(_0x495b17,_0x1ce6b1){var _0x55cef7={},_0x417801={},_0x1dc406={'count':0x0,'rows':[]};var _0x314d30=_['map'](db[_0x866b('0x29')]['rawAttributes'],function(_0x2fba91){return{'name':_0x2fba91['fieldName'],'type':_0x2fba91[_0x866b('0x2a')][_0x866b('0x2b')]};});_0x417801[_0x866b('0x2c')]=_[_0x866b('0x2d')](_0x314d30,_0x866b('0x26'));_0x417801[_0x866b('0x2e')]=_['keys'](_0x495b17[_0x866b('0x2e')]);_0x417801['filters']=_[_0x866b('0x2f')](_0x417801[_0x866b('0x2c')],_0x417801['query']);_0x55cef7['attributes']=_[_0x866b('0x2f')](_0x417801[_0x866b('0x2c')],qs[_0x866b('0x30')](_0x495b17['query'][_0x866b('0x30')]));_0x55cef7[_0x866b('0x31')]=_0x55cef7[_0x866b('0x31')][_0x866b('0x32')]?_0x55cef7[_0x866b('0x31')]:_0x417801[_0x866b('0x2c')];if(!_0x495b17[_0x866b('0x2e')][_0x866b('0x33')](_0x866b('0x34'))){_0x55cef7[_0x866b('0x1c')]=qs[_0x866b('0x1c')](_0x495b17[_0x866b('0x2e')][_0x866b('0x1c')]);_0x55cef7[_0x866b('0x1a')]=qs[_0x866b('0x1a')](_0x495b17[_0x866b('0x2e')][_0x866b('0x1a')]);}_0x55cef7[_0x866b('0x35')]=qs[_0x866b('0x36')](_0x495b17[_0x866b('0x2e')][_0x866b('0x36')]);_0x55cef7[_0x866b('0x37')]=qs[_0x866b('0x38')](_[_0x866b('0x39')](_0x495b17[_0x866b('0x2e')],_0x417801[_0x866b('0x38')]),_0x314d30);if(_0x495b17[_0x866b('0x2e')][_0x866b('0x3a')]){_0x55cef7['where']=_[_0x866b('0x3b')](_0x55cef7['where'],{'$or':_[_0x866b('0x2d')](_0x314d30,function(_0xa59f2c){if(_0xa59f2c[_0x866b('0x2a')]!==_0x866b('0x3c')){var _0x40a636={};_0x40a636[_0xa59f2c['name']]={'$like':'%'+_0x495b17['query'][_0x866b('0x3a')]+'%'};return _0x40a636;}})});}_0x55cef7=_[_0x866b('0x3b')]({},_0x55cef7,_0x495b17[_0x866b('0x3d')]);var _0x351872={'where':_0x55cef7['where']};return db['DeskConfiguration'][_0x866b('0x1d')](_0x351872)[_0x866b('0x23')](function(_0x20060f){_0x1dc406[_0x866b('0x1d')]=_0x20060f;if(_0x495b17[_0x866b('0x2e')][_0x866b('0x3e')]){_0x55cef7[_0x866b('0x3f')]=[{'all':!![]}];}return db[_0x866b('0x29')][_0x866b('0x40')](_0x55cef7);})[_0x866b('0x23')](function(_0x408612){_0x1dc406[_0x866b('0x41')]=_0x408612;return _0x1dc406;})[_0x866b('0x23')](respondWithFilteredResult(_0x1ce6b1,_0x55cef7))[_0x866b('0x42')](handleError(_0x1ce6b1,null));};exports[_0x866b('0x43')]=function(_0x2bedf1,_0x43e9ca){var _0x478118={'raw':![],'where':{'id':_0x2bedf1[_0x866b('0x44')]['id']}},_0x1205fc={};_0x1205fc[_0x866b('0x2c')]=_[_0x866b('0x45')](db[_0x866b('0x29')]['rawAttributes']);_0x1205fc[_0x866b('0x2e')]=_[_0x866b('0x45')](_0x2bedf1[_0x866b('0x2e')]);_0x1205fc[_0x866b('0x38')]=_[_0x866b('0x2f')](_0x1205fc[_0x866b('0x2c')],_0x1205fc[_0x866b('0x2e')]);_0x478118[_0x866b('0x31')]=_['intersection'](_0x1205fc[_0x866b('0x2c')],qs[_0x866b('0x30')](_0x2bedf1[_0x866b('0x2e')][_0x866b('0x30')]));_0x478118[_0x866b('0x31')]=_0x478118['attributes'][_0x866b('0x32')]?_0x478118['attributes']:_0x1205fc[_0x866b('0x2c')];if(_0x2bedf1[_0x866b('0x2e')][_0x866b('0x3e')]){_0x478118['include']=[{'all':!![]}];}_0x478118=_[_0x866b('0x3b')]({},_0x478118,_0x2bedf1[_0x866b('0x3d')]);return db['DeskConfiguration'][_0x866b('0x46')](_0x478118)[_0x866b('0x23')](handleEntityNotFound(_0x43e9ca,null))[_0x866b('0x23')](respondWithResult(_0x43e9ca,null))[_0x866b('0x42')](handleError(_0x43e9ca,null));};exports[_0x866b('0x47')]=function(_0x4e97e2,_0x7881ae){return db[_0x866b('0x29')]['create'](_0x4e97e2[_0x866b('0x48')],{})[_0x866b('0x23')](respondWithResult(_0x7881ae,0xc9))[_0x866b('0x42')](handleError(_0x7881ae,null));};exports[_0x866b('0x49')]=function(_0x412adb,_0x2754d5){if(_0x412adb[_0x866b('0x48')]['id']){delete _0x412adb[_0x866b('0x48')]['id'];}return db['DeskConfiguration'][_0x866b('0x46')]({'where':{'id':_0x412adb[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0x2754d5,null))[_0x866b('0x23')](saveUpdates(_0x412adb[_0x866b('0x48')],null))[_0x866b('0x23')](respondWithResult(_0x2754d5,null))['catch'](handleError(_0x2754d5,null));};exports['destroy']=function(_0x4de331,_0xa09238){return db[_0x866b('0x29')][_0x866b('0x46')]({'where':{'id':_0x4de331[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0xa09238,null))['then'](removeEntity(_0xa09238,null))[_0x866b('0x42')](handleError(_0xa09238,null));};exports[_0x866b('0x4a')]=function(_0x252ebc,_0x253275,_0x5159e8){var _0x5b37ea={};var _0x277887={};var _0x29a8d1;var _0x61c18d;return db[_0x866b('0x29')][_0x866b('0x4b')]({'where':{'id':_0x252ebc[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0x253275,null))['then'](function(_0x5163b0){if(_0x5163b0){_0x29a8d1=_0x5163b0;_0x277887[_0x866b('0x2c')]=_[_0x866b('0x45')](db[_0x866b('0x4c')][_0x866b('0x4d')]);_0x277887[_0x866b('0x2e')]=_[_0x866b('0x45')](_0x252ebc[_0x866b('0x2e')]);_0x277887[_0x866b('0x38')]=_[_0x866b('0x2f')](_0x277887[_0x866b('0x2c')],_0x277887[_0x866b('0x2e')]);_0x5b37ea[_0x866b('0x31')]=_[_0x866b('0x2f')](_0x277887['model'],qs['fields'](_0x252ebc[_0x866b('0x2e')][_0x866b('0x30')]));_0x5b37ea[_0x866b('0x31')]=_0x5b37ea[_0x866b('0x31')][_0x866b('0x32')]?_0x5b37ea[_0x866b('0x31')]:_0x277887['model'];_0x5b37ea[_0x866b('0x35')]=qs['sort'](_0x252ebc[_0x866b('0x2e')][_0x866b('0x36')]);_0x5b37ea['where']=qs[_0x866b('0x38')](_[_0x866b('0x39')](_0x252ebc['query'],_0x277887[_0x866b('0x38')]));if(_0x252ebc[_0x866b('0x2e')]['filter']){_0x5b37ea[_0x866b('0x37')]=_[_0x866b('0x3b')](_0x5b37ea[_0x866b('0x37')],{'$or':_[_0x866b('0x2d')](_0x5b37ea[_0x866b('0x31')],function(_0x369b3f){var _0x3be117={};_0x3be117[_0x369b3f]={'$like':'%'+_0x252ebc[_0x866b('0x2e')][_0x866b('0x3a')]+'%'};return _0x3be117;})});}_0x5b37ea=_['merge']({},_0x5b37ea,_0x252ebc[_0x866b('0x3d')]);return _0x29a8d1[_0x866b('0x4a')](_0x5b37ea);}})[_0x866b('0x23')](function(_0x2faef3){if(_0x2faef3){_0x61c18d=_0x2faef3[_0x866b('0x32')];if(!_0x252ebc[_0x866b('0x2e')][_0x866b('0x33')](_0x866b('0x34'))){_0x5b37ea[_0x866b('0x1c')]=qs[_0x866b('0x1c')](_0x252ebc[_0x866b('0x2e')][_0x866b('0x1c')]);_0x5b37ea[_0x866b('0x1a')]=qs['offset'](_0x252ebc[_0x866b('0x2e')][_0x866b('0x1a')]);}return _0x29a8d1[_0x866b('0x4a')](_0x5b37ea);}})[_0x866b('0x23')](function(_0x1202e7){if(_0x1202e7){return _0x1202e7?{'count':_0x61c18d,'rows':_0x1202e7}:null;}})[_0x866b('0x23')](respondWithResult(_0x253275,null))[_0x866b('0x42')](handleError(_0x253275,null));};exports[_0x866b('0x4e')]=function(_0x742310,_0x45eb6e,_0x1ed714){var _0x3ac90d={};var _0x38aab2={};var _0xb66e48;var _0x5d1479;return db[_0x866b('0x29')][_0x866b('0x4b')]({'where':{'id':_0x742310[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0x45eb6e,null))['then'](function(_0x52c109){if(_0x52c109){_0xb66e48=_0x52c109;_0x38aab2[_0x866b('0x2c')]=_[_0x866b('0x45')](db[_0x866b('0x4c')]['rawAttributes']);_0x38aab2[_0x866b('0x2e')]=_[_0x866b('0x45')](_0x742310[_0x866b('0x2e')]);_0x38aab2[_0x866b('0x38')]=_['intersection'](_0x38aab2[_0x866b('0x2c')],_0x38aab2['query']);_0x3ac90d[_0x866b('0x31')]=_[_0x866b('0x2f')](_0x38aab2[_0x866b('0x2c')],qs['fields'](_0x742310[_0x866b('0x2e')][_0x866b('0x30')]));_0x3ac90d[_0x866b('0x31')]=_0x3ac90d[_0x866b('0x31')]['length']?_0x3ac90d[_0x866b('0x31')]:_0x38aab2[_0x866b('0x2c')];_0x3ac90d[_0x866b('0x35')]=qs['sort'](_0x742310[_0x866b('0x2e')][_0x866b('0x36')]);_0x3ac90d[_0x866b('0x37')]=qs[_0x866b('0x38')](_[_0x866b('0x39')](_0x742310[_0x866b('0x2e')],_0x38aab2[_0x866b('0x38')]));if(_0x742310[_0x866b('0x2e')][_0x866b('0x3a')]){_0x3ac90d[_0x866b('0x37')]=_[_0x866b('0x3b')](_0x3ac90d[_0x866b('0x37')],{'$or':_[_0x866b('0x2d')](_0x3ac90d['attributes'],function(_0x2d4b3e){var _0x62ab9a={};_0x62ab9a[_0x2d4b3e]={'$like':'%'+_0x742310[_0x866b('0x2e')][_0x866b('0x3a')]+'%'};return _0x62ab9a;})});}_0x3ac90d=_['merge']({},_0x3ac90d,_0x742310[_0x866b('0x3d')]);return _0xb66e48[_0x866b('0x4e')](_0x3ac90d);}})[_0x866b('0x23')](function(_0x235986){if(_0x235986){_0x5d1479=_0x235986[_0x866b('0x32')];if(!_0x742310[_0x866b('0x2e')]['hasOwnProperty']('nolimit')){_0x3ac90d['limit']=qs[_0x866b('0x1c')](_0x742310[_0x866b('0x2e')]['limit']);_0x3ac90d[_0x866b('0x1a')]=qs[_0x866b('0x1a')](_0x742310[_0x866b('0x2e')][_0x866b('0x1a')]);}return _0xb66e48[_0x866b('0x4e')](_0x3ac90d);}})['then'](function(_0x134758){if(_0x134758){return _0x134758?{'count':_0x5d1479,'rows':_0x134758}:null;}})['then'](respondWithResult(_0x45eb6e,null))['catch'](handleError(_0x45eb6e,null));};exports['getDescriptions']=function(_0x385105,_0x1e56fb,_0x1ac387){var _0x1ae251={};var _0x4eaf7e={};var _0x34773a;var _0x276ee5;return db[_0x866b('0x29')][_0x866b('0x4b')]({'where':{'id':_0x385105[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0x1e56fb,null))['then'](function(_0x53012d){if(_0x53012d){_0x34773a=_0x53012d;_0x4eaf7e[_0x866b('0x2c')]=_['keys'](db['DeskField'][_0x866b('0x4d')]);_0x4eaf7e[_0x866b('0x2e')]=_[_0x866b('0x45')](_0x385105[_0x866b('0x2e')]);_0x4eaf7e['filters']=_[_0x866b('0x2f')](_0x4eaf7e[_0x866b('0x2c')],_0x4eaf7e[_0x866b('0x2e')]);_0x1ae251[_0x866b('0x31')]=_[_0x866b('0x2f')](_0x4eaf7e[_0x866b('0x2c')],qs['fields'](_0x385105[_0x866b('0x2e')][_0x866b('0x30')]));_0x1ae251[_0x866b('0x31')]=_0x1ae251[_0x866b('0x31')][_0x866b('0x32')]?_0x1ae251[_0x866b('0x31')]:_0x4eaf7e[_0x866b('0x2c')];_0x1ae251['order']=qs[_0x866b('0x36')](_0x385105[_0x866b('0x2e')][_0x866b('0x36')]);_0x1ae251[_0x866b('0x37')]=qs[_0x866b('0x38')](_[_0x866b('0x39')](_0x385105[_0x866b('0x2e')],_0x4eaf7e[_0x866b('0x38')]));if(_0x385105[_0x866b('0x2e')][_0x866b('0x3a')]){_0x1ae251[_0x866b('0x37')]=_[_0x866b('0x3b')](_0x1ae251[_0x866b('0x37')],{'$or':_[_0x866b('0x2d')](_0x1ae251[_0x866b('0x31')],function(_0x1d61f3){var _0x1762c1={};_0x1762c1[_0x1d61f3]={'$like':'%'+_0x385105['query'][_0x866b('0x3a')]+'%'};return _0x1762c1;})});}_0x1ae251=_[_0x866b('0x3b')]({},_0x1ae251,_0x385105[_0x866b('0x3d')]);return _0x34773a[_0x866b('0x4f')](_0x1ae251);}})[_0x866b('0x23')](function(_0x299ebd){if(_0x299ebd){_0x276ee5=_0x299ebd['length'];if(!_0x385105[_0x866b('0x2e')][_0x866b('0x33')](_0x866b('0x34'))){_0x1ae251['limit']=qs[_0x866b('0x1c')](_0x385105[_0x866b('0x2e')][_0x866b('0x1c')]);_0x1ae251[_0x866b('0x1a')]=qs['offset'](_0x385105[_0x866b('0x2e')][_0x866b('0x1a')]);}return _0x34773a['getDescriptions'](_0x1ae251);}})[_0x866b('0x23')](function(_0x12da27){if(_0x12da27){return _0x12da27?{'count':_0x276ee5,'rows':_0x12da27}:null;}})[_0x866b('0x23')](respondWithResult(_0x1e56fb,null))['catch'](handleError(_0x1e56fb,null));};exports[_0x866b('0x50')]=function(_0x2a3f84,_0xfebd32,_0xa8852e){var _0x7bf5bb={};var _0x4c6834={};var _0x20ce66;var _0x1dfc8f;return db['DeskConfiguration'][_0x866b('0x4b')]({'where':{'id':_0x2a3f84[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0xfebd32,null))['then'](function(_0x2cbdb1){if(_0x2cbdb1){_0x20ce66=_0x2cbdb1;_0x4c6834[_0x866b('0x2c')]=_[_0x866b('0x45')](db['Tag'][_0x866b('0x4d')]);_0x4c6834[_0x866b('0x2e')]=_['keys'](_0x2a3f84[_0x866b('0x2e')]);_0x4c6834[_0x866b('0x38')]=_['intersection'](_0x4c6834[_0x866b('0x2c')],_0x4c6834[_0x866b('0x2e')]);_0x7bf5bb[_0x866b('0x31')]=_[_0x866b('0x2f')](_0x4c6834[_0x866b('0x2c')],qs[_0x866b('0x30')](_0x2a3f84[_0x866b('0x2e')][_0x866b('0x30')]));_0x7bf5bb[_0x866b('0x31')]=_0x7bf5bb[_0x866b('0x31')]['length']?_0x7bf5bb[_0x866b('0x31')]:_0x4c6834[_0x866b('0x2c')];_0x7bf5bb['order']=qs[_0x866b('0x36')](_0x2a3f84[_0x866b('0x2e')][_0x866b('0x36')]);_0x7bf5bb[_0x866b('0x37')]=qs[_0x866b('0x38')](_[_0x866b('0x39')](_0x2a3f84[_0x866b('0x2e')],_0x4c6834['filters']));if(_0x2a3f84[_0x866b('0x2e')][_0x866b('0x3a')]){_0x7bf5bb[_0x866b('0x37')]=_[_0x866b('0x3b')](_0x7bf5bb['where'],{'$or':_[_0x866b('0x2d')](_0x7bf5bb[_0x866b('0x31')],function(_0x75ba66){var _0x38e5da={};_0x38e5da[_0x75ba66]={'$like':'%'+_0x2a3f84[_0x866b('0x2e')]['filter']+'%'};return _0x38e5da;})});}_0x7bf5bb=_[_0x866b('0x3b')]({},_0x7bf5bb,_0x2a3f84['options']);return _0x20ce66['getTags'](_0x7bf5bb);}})[_0x866b('0x23')](function(_0x1df0e7){if(_0x1df0e7){_0x1dfc8f=_0x1df0e7['length'];if(!_0x2a3f84[_0x866b('0x2e')][_0x866b('0x33')](_0x866b('0x34'))){_0x7bf5bb[_0x866b('0x1c')]=qs['limit'](_0x2a3f84[_0x866b('0x2e')][_0x866b('0x1c')]);_0x7bf5bb[_0x866b('0x1a')]=qs[_0x866b('0x1a')](_0x2a3f84[_0x866b('0x2e')][_0x866b('0x1a')]);}return _0x20ce66[_0x866b('0x50')](_0x7bf5bb);}})['then'](function(_0x2faec4){if(_0x2faec4){return _0x2faec4?{'count':_0x1dfc8f,'rows':_0x2faec4}:null;}})[_0x866b('0x23')](respondWithResult(_0xfebd32,null))['catch'](handleError(_0xfebd32,null));};exports[_0x866b('0x51')]=function(_0x30d23f,_0xdcfcfb,_0xe72a1d){if(_0x30d23f[_0x866b('0x48')]['id']){delete _0x30d23f['body']['id'];}return db['DeskConfiguration'][_0x866b('0x4b')]({'where':{'id':_0x30d23f[_0x866b('0x44')]['id']}})[_0x866b('0x23')](handleEntityNotFound(_0xdcfcfb,null))[_0x866b('0x23')](function(_0x52afd1){if(_0x52afd1){return _0x52afd1['setTags'](_0x30d23f[_0x866b('0x48')][_0x866b('0x52')]||[]);}return null;})['then'](respondWithResult(_0xdcfcfb,null))['catch'](handleError(_0xdcfcfb,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f99ce2f..3424c4a 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 _0x0224=['DeskConfiguration','lodash','../../config/logger','api','path','rimraf','exports','define'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0224,0xe9));var _0x4022=function(_0xe5287b,_0x26b8ab){_0xe5287b=_0xe5287b-0x0;var _0x346f77=_0x0224[_0xe5287b];return _0x346f77;};'use strict';var _=require(_0x4022('0x0'));var util=require('util');var logger=require(_0x4022('0x1'))(_0x4022('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4022('0x3'));var rimraf=require(_0x4022('0x4'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x4022('0x5')]=function(_0x54ca72,_0x51784f){return _0x54ca72[_0x4022('0x6')](_0x4022('0x7'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb965=['bluebird','request-promise','path','rimraf','exports','define','int_desk_configurations','lodash','util','moment'];(function(_0x5f19be,_0x1ae757){var _0x319c2e=function(_0x203871){while(--_0x203871){_0x5f19be['push'](_0x5f19be['shift']());}};_0x319c2e(++_0x1ae757);}(_0xb965,0x9d));var _0x5b96=function(_0x264c84,_0x598700){_0x264c84=_0x264c84-0x0;var _0x1fd84c=_0xb965[_0x264c84];return _0x1fd84c;};'use strict';var _=require(_0x5b96('0x0'));var util=require(_0x5b96('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5b96('0x2'));var BPromise=require(_0x5b96('0x3'));var rp=require(_0x5b96('0x4'));var fs=require('fs');var path=require(_0x5b96('0x5'));var rimraf=require(_0x5b96('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x5b96('0x7')]=function(_0x3d9d78,_0x502072){return _0x3d9d78[_0x5b96('0x8')]('DeskConfiguration',attributes,{'tableName':_0x5b96('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 48dc47b..85ebb97 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x1f3e7b,_0x45bc1e){var _0x261343=function(_0x42543c){while(--_0x42543c){_0x1f3e7b['push'](_0x1f3e7b['shift']());}};_0x261343(++_0x45bc1e);}(_0x1a85,0x178));var _0x51a8=function(_0xa1f3d9,_0x2a0fa4){_0xa1f3d9=_0xa1f3d9-0x0;var _0x5dcb0a=_0x1a85[_0xa1f3d9];return _0x5dcb0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0x9ab8,0x81));var _0x89ab=function(_0x4337f1,_0x5ef8a2){_0x4337f1=_0x4337f1-0x0;var _0x2789f5=_0x9ab8[_0x4337f1];return _0x2789f5;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2a39c22..1d10e21 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 _0x93e9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x48ea09,_0xc6e938){var _0x2fee78=function(_0x301a12){while(--_0x301a12){_0x48ea09['push'](_0x48ea09['shift']());}};_0x2fee78(++_0xc6e938);}(_0x93e9,0xcc));var _0x993e=function(_0x1404c3,_0x588b81){_0x1404c3=_0x1404c3-0x0;var _0x5740a9=_0x93e9[_0x1404c3];return _0x5740a9;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0xd')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0xf')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x10')]);router['delete'](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x57fa=['get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x44aceb,_0x13340e){var _0x4a6886=function(_0x2575a1){while(--_0x2575a1){_0x44aceb['push'](_0x44aceb['shift']());}};_0x4a6886(++_0x13340e);}(_0x57fa,0x127));var _0xa57f=function(_0x26c724,_0x101104){_0x26c724=_0x26c724-0x0;var _0x4a5df1=_0x57fa[_0x26c724];return _0x4a5df1;};'use strict';var multer=require(_0xa57f('0x0'));var util=require(_0xa57f('0x1'));var path=require('path');var timeout=require(_0xa57f('0x2'));var express=require('express');var router=express[_0xa57f('0x3')]();var fs_extra=require(_0xa57f('0x4'));var auth=require(_0xa57f('0x5'));var interaction=require(_0xa57f('0x6'));var config=require(_0xa57f('0x7'));var controller=require(_0xa57f('0x8'));router[_0xa57f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa57f('0x9')]('/:id',auth[_0xa57f('0xa')](),controller[_0xa57f('0xb')]);router[_0xa57f('0xc')]('/',auth[_0xa57f('0xa')](),controller[_0xa57f('0xd')]);router['put'](_0xa57f('0xe'),auth[_0xa57f('0xa')](),controller[_0xa57f('0xf')]);router[_0xa57f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa57f('0x11')]);module[_0xa57f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f029187..98d2eed 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 _0xc1d2=['keyValue','STRING','ENUM','string','BOOLEAN','variable','customVariable'];(function(_0x26c543,_0x381fd2){var _0x25f6b5=function(_0x3b9c8e){while(--_0x3b9c8e){_0x26c543['push'](_0x26c543['shift']());}};_0x25f6b5(++_0x381fd2);}(_0xc1d2,0x83));var _0x2c1d=function(_0x307eca,_0x25404e){_0x307eca=_0x307eca-0x0;var _0x192697=_0xc1d2[_0x307eca];return _0x192697;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x2c1d('0x0'),_0x2c1d('0x1'),_0x2c1d('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2c1d('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c1d('0x4')](_0x2c1d('0x5'),_0x2c1d('0x0'),_0x2c1d('0x1'))},'keyContent':{'type':Sequelize[_0x2c1d('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2c1d('0x3')]},'customField':{'type':Sequelize[_0x2c1d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c1d('0x3')]}}; \ No newline at end of file +var _0xbb89=['BOOLEAN','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x3fb906,_0x587f38){var _0x1f9ce4=function(_0x586dfd){while(--_0x586dfd){_0x3fb906['push'](_0x3fb906['shift']());}};_0x1f9ce4(++_0x587f38);}(_0xbb89,0x69));var _0x9bb8=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbb89[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9bb8('0x0')](_0x9bb8('0x1'),_0x9bb8('0x2'),'customVariable',_0x9bb8('0x3'),_0x9bb8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9bb8('0x5')]},'key':{'type':Sequelize[_0x9bb8('0x5')]},'keyType':{'type':Sequelize[_0x9bb8('0x0')](_0x9bb8('0x1'),_0x9bb8('0x2'),_0x9bb8('0x6'))},'keyContent':{'type':Sequelize[_0x9bb8('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9bb8('0x5')]},'customField':{'type':Sequelize[_0x9bb8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9bb8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b30efe9..c57a397 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 _0xee87=['where','pick','filter','merge','VIRTUAL','DeskField','then','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x557a5e,_0x19bbca){var _0x1d68ff=function(_0x525662){while(--_0x525662){_0x557a5e['push'](_0x557a5e['shift']());}};_0x1d68ff(++_0x19bbca);}(_0xee87,0x193));var _0x7ee8=function(_0x2c9979,_0x2e20f5){_0x2c9979=_0x2c9979-0x0;var _0xac582a=_0xee87[_0x2c9979];return _0xac582a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ee8('0x1'));var BPromise=require(_0x7ee8('0x2'));var Mustache=require(_0x7ee8('0x3'));var util=require('util');var path=require(_0x7ee8('0x4'));var sox=require(_0x7ee8('0x5'));var csv=require('to-csv');var ejs=require(_0x7ee8('0x6'));var fs=require('fs');var fs_extra=require(_0x7ee8('0x7'));var _=require(_0x7ee8('0x8'));var squel=require(_0x7ee8('0x9'));var crypto=require(_0x7ee8('0xa'));var jsforce=require(_0x7ee8('0xb'));var deskjs=require(_0x7ee8('0xc'));var toCsv=require(_0x7ee8('0xd'));var querystring=require(_0x7ee8('0xe'));var Papa=require(_0x7ee8('0xf'));var Redis=require(_0x7ee8('0x10'));var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ee8('0x13'));var logger=require(_0x7ee8('0x14'))(_0x7ee8('0x15'));var utils=require(_0x7ee8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x322707,_0x16ab62){_0x16ab62=_0x16ab62||0xcc;return function(_0x14a856){if(_0x14a856){return _0x322707[_0x7ee8('0x19')](_0x16ab62);}return _0x322707[_0x7ee8('0x1a')](_0x16ab62)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x19dcd2,_0x170d84){_0x170d84=_0x170d84||0xc8;return function(_0x24d5e8){if(_0x24d5e8){return _0x19dcd2[_0x7ee8('0x1a')](_0x170d84)[_0x7ee8('0x1c')](_0x24d5e8);}};}function respondWithFilteredResult(_0x3ff469,_0x3a3b48){return function(_0xd275fb){if(_0xd275fb){var _0x1ddb6a=typeof _0x3a3b48[_0x7ee8('0x1d')]===_0x7ee8('0x1e')&&typeof _0x3a3b48[_0x7ee8('0x1f')]==='undefined';var _0x3b167c=_0xd275fb[_0x7ee8('0x20')];var _0x20fc7c=_0x1ddb6a?0x0:_0x3a3b48[_0x7ee8('0x1d')];var _0x2ef79f=_0x1ddb6a?_0xd275fb[_0x7ee8('0x20')]:_0x3a3b48[_0x7ee8('0x1d')]+_0x3a3b48['limit'];var _0x359da2;if(_0x2ef79f>=_0x3b167c){_0x2ef79f=_0x3b167c;_0x359da2=0xc8;}else{_0x359da2=0xce;}_0x3ff469['status'](_0x359da2);return _0x3ff469[_0x7ee8('0x21')]('Content-Range',_0x20fc7c+'-'+_0x2ef79f+'/'+_0x3b167c)[_0x7ee8('0x1c')](_0xd275fb);}return null;};}function patchUpdates(_0x1e3f04){return function(_0x37ca34){try{jsonpatch[_0x7ee8('0x22')](_0x37ca34,_0x1e3f04,!![]);}catch(_0x391035){return BPromise[_0x7ee8('0x23')](_0x391035);}return _0x37ca34[_0x7ee8('0x24')]();};}function saveUpdates(_0x13c3a7,_0x2ce7b5){return function(_0xb160a1){if(_0xb160a1){return _0xb160a1[_0x7ee8('0x25')](_0x13c3a7)['then'](function(_0x7d8f2f){return _0x7d8f2f;});}return null;};}function removeEntity(_0x3870d7,_0x252dde){return function(_0x314663){if(_0x314663){return _0x314663[_0x7ee8('0x26')]()['then'](function(){_0x3870d7[_0x7ee8('0x1a')](0xcc)[_0x7ee8('0x1b')]();});}};}function handleEntityNotFound(_0x1aaa8f,_0x330d08){return function(_0x411181){if(!_0x411181){_0x1aaa8f[_0x7ee8('0x19')](0x194);}return _0x411181;};}function handleError(_0x5698bd,_0x331966){_0x331966=_0x331966||0x1f4;return function(_0x57cf44){logger[_0x7ee8('0x27')](_0x57cf44[_0x7ee8('0x28')]);if(_0x57cf44[_0x7ee8('0x29')]){delete _0x57cf44[_0x7ee8('0x29')];}_0x5698bd['status'](_0x331966)[_0x7ee8('0x2a')](_0x57cf44);};}exports[_0x7ee8('0x2b')]=function(_0x3792fa,_0x43fe07){var _0x4a5e5c={},_0x1b604c={},_0x322cff={'count':0x0,'rows':[]};var _0x53c97e=_[_0x7ee8('0x2c')](db['DeskField'][_0x7ee8('0x2d')],function(_0x2b67ba){return{'name':_0x2b67ba[_0x7ee8('0x2e')],'type':_0x2b67ba[_0x7ee8('0x2f')][_0x7ee8('0x30')]};});_0x1b604c['model']=_['map'](_0x53c97e,_0x7ee8('0x29'));_0x1b604c[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x3792fa['query']);_0x1b604c[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x1b604c[_0x7ee8('0x35')],_0x1b604c['query']);_0x4a5e5c['attributes']=_['intersection'](_0x1b604c[_0x7ee8('0x35')],qs['fields'](_0x3792fa['query'][_0x7ee8('0x36')]));_0x4a5e5c[_0x7ee8('0x37')]=_0x4a5e5c[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x4a5e5c[_0x7ee8('0x37')]:_0x1b604c[_0x7ee8('0x35')];if(!_0x3792fa[_0x7ee8('0x31')]['hasOwnProperty'](_0x7ee8('0x39'))){_0x4a5e5c[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x3792fa['query'][_0x7ee8('0x1f')]);_0x4a5e5c[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x1d')]);}_0x4a5e5c[_0x7ee8('0x3a')]=qs['sort'](_0x3792fa['query']['sort']);_0x4a5e5c[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x3792fa[_0x7ee8('0x31')],_0x1b604c[_0x7ee8('0x33')]),_0x53c97e);if(_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x4a5e5c[_0x7ee8('0x3b')]=_[_0x7ee8('0x3e')](_0x4a5e5c['where'],{'$or':_[_0x7ee8('0x2c')](_0x53c97e,function(_0x320c8c){if(_0x320c8c[_0x7ee8('0x2f')]!==_0x7ee8('0x3f')){var _0x11dc71={};_0x11dc71[_0x320c8c[_0x7ee8('0x29')]]={'$like':'%'+_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x11dc71;}})});}_0x4a5e5c=_[_0x7ee8('0x3e')]({},_0x4a5e5c,_0x3792fa['options']);var _0x9255f3={'where':_0x4a5e5c[_0x7ee8('0x3b')]};return db[_0x7ee8('0x40')][_0x7ee8('0x20')](_0x9255f3)[_0x7ee8('0x41')](function(_0xfce36a){_0x322cff['count']=_0xfce36a;if(_0x3792fa[_0x7ee8('0x31')]['includeAll']){_0x4a5e5c[_0x7ee8('0x42')]=[{'all':!![]}];}return db[_0x7ee8('0x40')][_0x7ee8('0x43')](_0x4a5e5c);})['then'](function(_0x4ce466){_0x322cff[_0x7ee8('0x44')]=_0x4ce466;return _0x322cff;})[_0x7ee8('0x41')](respondWithFilteredResult(_0x43fe07,_0x4a5e5c))[_0x7ee8('0x45')](handleError(_0x43fe07,null));};exports[_0x7ee8('0x46')]=function(_0x790d32,_0x685490){var _0x16b91f={'raw':!![],'where':{'id':_0x790d32['params']['id']}},_0x128ad6={};_0x128ad6[_0x7ee8('0x35')]=_['keys'](db['DeskField']['rawAttributes']);_0x128ad6[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x790d32[_0x7ee8('0x31')]);_0x128ad6[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],_0x128ad6[_0x7ee8('0x31')]);_0x16b91f['attributes']=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],qs[_0x7ee8('0x36')](_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x16b91f['attributes']=_0x16b91f[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x16b91f[_0x7ee8('0x37')]:_0x128ad6[_0x7ee8('0x35')];if(_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x47')]){_0x16b91f[_0x7ee8('0x42')]=[{'all':!![]}];}_0x16b91f=_['merge']({},_0x16b91f,_0x790d32[_0x7ee8('0x48')]);return db[_0x7ee8('0x40')][_0x7ee8('0x49')](_0x16b91f)[_0x7ee8('0x41')](handleEntityNotFound(_0x685490,null))[_0x7ee8('0x41')](respondWithResult(_0x685490,null))[_0x7ee8('0x45')](handleError(_0x685490,null));};exports[_0x7ee8('0x4a')]=function(_0x162049,_0x51e205){return db[_0x7ee8('0x40')][_0x7ee8('0x4a')](_0x162049[_0x7ee8('0x4b')],{})['then'](respondWithResult(_0x51e205,0xc9))[_0x7ee8('0x45')](handleError(_0x51e205,null));};exports['update']=function(_0x4d6b40,_0x379943){if(_0x4d6b40[_0x7ee8('0x4b')]['id']){delete _0x4d6b40[_0x7ee8('0x4b')]['id'];}return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4d6b40[_0x7ee8('0x4c')]['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x379943,null))[_0x7ee8('0x41')](saveUpdates(_0x4d6b40[_0x7ee8('0x4b')],null))[_0x7ee8('0x41')](respondWithResult(_0x379943,null))[_0x7ee8('0x45')](handleError(_0x379943,null));};exports[_0x7ee8('0x26')]=function(_0x4ce4d6,_0x4b38e7){return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4ce4d6['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x4b38e7,null))[_0x7ee8('0x41')](removeEntity(_0x4b38e7,null))['catch'](handleError(_0x4b38e7,null));}; \ No newline at end of file +var _0xe861=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','DeskField','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model'];(function(_0xfafede,_0x45f07a){var _0x37ecc0=function(_0x53fd4c){while(--_0x53fd4c){_0xfafede['push'](_0xfafede['shift']());}};_0x37ecc0(++_0x45f07a);}(_0xe861,0xb3));var _0x1e86=function(_0x7ead36,_0x1609f0){_0x7ead36=_0x7ead36-0x0;var _0x52ee97=_0xe861[_0x7ead36];return _0x52ee97;};'use strict';var emlformat=require(_0x1e86('0x0'));var rimraf=require(_0x1e86('0x1'));var zipdir=require(_0x1e86('0x2'));var jsonpatch=require(_0x1e86('0x3'));var rp=require(_0x1e86('0x4'));var moment=require(_0x1e86('0x5'));var BPromise=require(_0x1e86('0x6'));var Mustache=require('mustache');var util=require(_0x1e86('0x7'));var path=require(_0x1e86('0x8'));var sox=require(_0x1e86('0x9'));var csv=require(_0x1e86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e86('0xb'));var squel=require(_0x1e86('0xc'));var crypto=require(_0x1e86('0xd'));var jsforce=require(_0x1e86('0xe'));var deskjs=require(_0x1e86('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e86('0x10'));var qs=require(_0x1e86('0x11'));var as=require(_0x1e86('0x12'));var hardwareService=require(_0x1e86('0x13'));var logger=require('../../config/logger')(_0x1e86('0x14'));var utils=require(_0x1e86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e86('0x16'));var db=require(_0x1e86('0x17'))['db'];function respondWithStatusCode(_0x1fd6e7,_0x2e3bc0){_0x2e3bc0=_0x2e3bc0||0xcc;return function(_0x4da152){if(_0x4da152){return _0x1fd6e7['sendStatus'](_0x2e3bc0);}return _0x1fd6e7[_0x1e86('0x18')](_0x2e3bc0)['end']();};}function respondWithResult(_0x1ade52,_0x407632){_0x407632=_0x407632||0xc8;return function(_0x11d062){if(_0x11d062){return _0x1ade52['status'](_0x407632)['json'](_0x11d062);}};}function respondWithFilteredResult(_0x3522ab,_0x2f552d){return function(_0x259293){if(_0x259293){var _0xca4493=typeof _0x2f552d[_0x1e86('0x19')]===_0x1e86('0x1a')&&typeof _0x2f552d[_0x1e86('0x1b')]===_0x1e86('0x1a');var _0x151466=_0x259293[_0x1e86('0x1c')];var _0x40a02f=_0xca4493?0x0:_0x2f552d['offset'];var _0x3447da=_0xca4493?_0x259293[_0x1e86('0x1c')]:_0x2f552d['offset']+_0x2f552d['limit'];var _0x2bc828;if(_0x3447da>=_0x151466){_0x3447da=_0x151466;_0x2bc828=0xc8;}else{_0x2bc828=0xce;}_0x3522ab[_0x1e86('0x18')](_0x2bc828);return _0x3522ab[_0x1e86('0x1d')](_0x1e86('0x1e'),_0x40a02f+'-'+_0x3447da+'/'+_0x151466)[_0x1e86('0x1f')](_0x259293);}return null;};}function patchUpdates(_0x280ec2){return function(_0xe28caa){try{jsonpatch[_0x1e86('0x20')](_0xe28caa,_0x280ec2,!![]);}catch(_0x491a16){return BPromise[_0x1e86('0x21')](_0x491a16);}return _0xe28caa[_0x1e86('0x22')]();};}function saveUpdates(_0x446ec9,_0x261ca4){return function(_0x33d822){if(_0x33d822){return _0x33d822[_0x1e86('0x23')](_0x446ec9)['then'](function(_0x2cd835){return _0x2cd835;});}return null;};}function removeEntity(_0x19a8fa,_0x51afb2){return function(_0x5a5177){if(_0x5a5177){return _0x5a5177[_0x1e86('0x24')]()[_0x1e86('0x25')](function(){_0x19a8fa[_0x1e86('0x18')](0xcc)[_0x1e86('0x26')]();});}};}function handleEntityNotFound(_0x48bd32,_0x1346f3){return function(_0x291d12){if(!_0x291d12){_0x48bd32[_0x1e86('0x27')](0x194);}return _0x291d12;};}function handleError(_0x3eb14b,_0x5f3fec){_0x5f3fec=_0x5f3fec||0x1f4;return function(_0x7a3df2){logger[_0x1e86('0x28')](_0x7a3df2[_0x1e86('0x29')]);if(_0x7a3df2[_0x1e86('0x2a')]){delete _0x7a3df2[_0x1e86('0x2a')];}_0x3eb14b['status'](_0x5f3fec)[_0x1e86('0x2b')](_0x7a3df2);};}exports[_0x1e86('0x2c')]=function(_0x332b03,_0x46de22){var _0x53c5ce={},_0x873fc0={},_0x3c6ca3={'count':0x0,'rows':[]};var _0x4fa745=_[_0x1e86('0x2d')](db['DeskField'][_0x1e86('0x2e')],function(_0x27954e){return{'name':_0x27954e[_0x1e86('0x2f')],'type':_0x27954e['type']['key']};});_0x873fc0[_0x1e86('0x30')]=_[_0x1e86('0x2d')](_0x4fa745,_0x1e86('0x2a'));_0x873fc0['query']=_['keys'](_0x332b03[_0x1e86('0x31')]);_0x873fc0[_0x1e86('0x32')]=_[_0x1e86('0x33')](_0x873fc0[_0x1e86('0x30')],_0x873fc0['query']);_0x53c5ce[_0x1e86('0x34')]=_['intersection'](_0x873fc0[_0x1e86('0x30')],qs['fields'](_0x332b03[_0x1e86('0x31')][_0x1e86('0x35')]));_0x53c5ce['attributes']=_0x53c5ce[_0x1e86('0x34')][_0x1e86('0x36')]?_0x53c5ce['attributes']:_0x873fc0[_0x1e86('0x30')];if(!_0x332b03[_0x1e86('0x31')]['hasOwnProperty'](_0x1e86('0x37'))){_0x53c5ce['limit']=qs[_0x1e86('0x1b')](_0x332b03[_0x1e86('0x31')][_0x1e86('0x1b')]);_0x53c5ce[_0x1e86('0x19')]=qs[_0x1e86('0x19')](_0x332b03[_0x1e86('0x31')]['offset']);}_0x53c5ce[_0x1e86('0x38')]=qs['sort'](_0x332b03[_0x1e86('0x31')][_0x1e86('0x39')]);_0x53c5ce[_0x1e86('0x3a')]=qs[_0x1e86('0x32')](_[_0x1e86('0x3b')](_0x332b03[_0x1e86('0x31')],_0x873fc0[_0x1e86('0x32')]),_0x4fa745);if(_0x332b03[_0x1e86('0x31')]['filter']){_0x53c5ce[_0x1e86('0x3a')]=_[_0x1e86('0x3c')](_0x53c5ce[_0x1e86('0x3a')],{'$or':_[_0x1e86('0x2d')](_0x4fa745,function(_0x5aa164){if(_0x5aa164[_0x1e86('0x3d')]!==_0x1e86('0x3e')){var _0x561390={};_0x561390[_0x5aa164[_0x1e86('0x2a')]]={'$like':'%'+_0x332b03[_0x1e86('0x31')][_0x1e86('0x3f')]+'%'};return _0x561390;}})});}_0x53c5ce=_[_0x1e86('0x3c')]({},_0x53c5ce,_0x332b03['options']);var _0x2a72aa={'where':_0x53c5ce[_0x1e86('0x3a')]};return db[_0x1e86('0x40')][_0x1e86('0x1c')](_0x2a72aa)['then'](function(_0x24707){_0x3c6ca3[_0x1e86('0x1c')]=_0x24707;if(_0x332b03[_0x1e86('0x31')][_0x1e86('0x41')]){_0x53c5ce['include']=[{'all':!![]}];}return db[_0x1e86('0x40')][_0x1e86('0x42')](_0x53c5ce);})[_0x1e86('0x25')](function(_0x379d12){_0x3c6ca3[_0x1e86('0x43')]=_0x379d12;return _0x3c6ca3;})['then'](respondWithFilteredResult(_0x46de22,_0x53c5ce))[_0x1e86('0x44')](handleError(_0x46de22,null));};exports[_0x1e86('0x45')]=function(_0x4bba34,_0x3fd0a8){var _0x201e0d={'raw':!![],'where':{'id':_0x4bba34[_0x1e86('0x46')]['id']}},_0x2ad0c6={};_0x2ad0c6[_0x1e86('0x30')]=_['keys'](db[_0x1e86('0x40')][_0x1e86('0x2e')]);_0x2ad0c6[_0x1e86('0x31')]=_['keys'](_0x4bba34['query']);_0x2ad0c6[_0x1e86('0x32')]=_[_0x1e86('0x33')](_0x2ad0c6['model'],_0x2ad0c6[_0x1e86('0x31')]);_0x201e0d['attributes']=_[_0x1e86('0x33')](_0x2ad0c6[_0x1e86('0x30')],qs[_0x1e86('0x35')](_0x4bba34['query'][_0x1e86('0x35')]));_0x201e0d['attributes']=_0x201e0d[_0x1e86('0x34')][_0x1e86('0x36')]?_0x201e0d[_0x1e86('0x34')]:_0x2ad0c6[_0x1e86('0x30')];if(_0x4bba34[_0x1e86('0x31')]['includeAll']){_0x201e0d[_0x1e86('0x47')]=[{'all':!![]}];}_0x201e0d=_[_0x1e86('0x3c')]({},_0x201e0d,_0x4bba34[_0x1e86('0x48')]);return db['DeskField'][_0x1e86('0x49')](_0x201e0d)['then'](handleEntityNotFound(_0x3fd0a8,null))[_0x1e86('0x25')](respondWithResult(_0x3fd0a8,null))[_0x1e86('0x44')](handleError(_0x3fd0a8,null));};exports[_0x1e86('0x4a')]=function(_0x2321a0,_0x31c1ec){return db[_0x1e86('0x40')][_0x1e86('0x4a')](_0x2321a0[_0x1e86('0x4b')],{})[_0x1e86('0x25')](respondWithResult(_0x31c1ec,0xc9))[_0x1e86('0x44')](handleError(_0x31c1ec,null));};exports[_0x1e86('0x23')]=function(_0x5f0035,_0x34feff){if(_0x5f0035[_0x1e86('0x4b')]['id']){delete _0x5f0035[_0x1e86('0x4b')]['id'];}return db[_0x1e86('0x40')]['find']({'where':{'id':_0x5f0035[_0x1e86('0x46')]['id']}})[_0x1e86('0x25')](handleEntityNotFound(_0x34feff,null))[_0x1e86('0x25')](saveUpdates(_0x5f0035[_0x1e86('0x4b')],null))[_0x1e86('0x25')](respondWithResult(_0x34feff,null))[_0x1e86('0x44')](handleError(_0x34feff,null));};exports[_0x1e86('0x24')]=function(_0x11de1a,_0x26af8d){return db[_0x1e86('0x40')][_0x1e86('0x49')]({'where':{'id':_0x11de1a[_0x1e86('0x46')]['id']}})[_0x1e86('0x25')](handleEntityNotFound(_0x26af8d,null))[_0x1e86('0x25')](removeEntity(_0x26af8d,null))['catch'](handleError(_0x26af8d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 484ff87..de1c655 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 _0x4292=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x4c537a,_0x5ef670){var _0x14ddfd=function(_0x328a03){while(--_0x328a03){_0x4c537a['push'](_0x4c537a['shift']());}};_0x14ddfd(++_0x5ef670);}(_0x4292,0x1c4));var _0x2429=function(_0x1b87a5,_0x5875ef){_0x1b87a5=_0x1b87a5-0x0;var _0x212666=_0x4292[_0x1b87a5];return _0x212666;};'use strict';var _=require(_0x2429('0x0'));var util=require('util');var logger=require(_0x2429('0x1'))('api');var moment=require(_0x2429('0x2'));var BPromise=require(_0x2429('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2429('0x4'));var rimraf=require(_0x2429('0x5'));var config=require(_0x2429('0x6'));var attributes=require(_0x2429('0x7'));module[_0x2429('0x8')]=function(_0x13cc65,_0x18ccce){return _0x13cc65[_0x2429('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2429('0xa'),'fields':[_0x2429('0xb'),_0x2429('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfea=['define','DeskField','desk_unique_index','idField','FieldId','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x4b7727,_0x4eddad){var _0x25f5ba=function(_0x10aa2f){while(--_0x10aa2f){_0x4b7727['push'](_0x4b7727['shift']());}};_0x25f5ba(++_0x4eddad);}(_0xdfea,0x139));var _0xadfe=function(_0x5a3d33,_0x276178){_0x5a3d33=_0x5a3d33-0x0;var _0x120ae2=_0xdfea[_0x5a3d33];return _0x120ae2;};'use strict';var _=require('lodash');var util=require(_0xadfe('0x0'));var logger=require('../../config/logger')(_0xadfe('0x1'));var moment=require(_0xadfe('0x2'));var BPromise=require('bluebird');var rp=require(_0xadfe('0x3'));var fs=require('fs');var path=require(_0xadfe('0x4'));var rimraf=require(_0xadfe('0x5'));var config=require(_0xadfe('0x6'));var attributes=require(_0xadfe('0x7'));module[_0xadfe('0x8')]=function(_0x23a995,_0x4cc308){return _0x23a995[_0xadfe('0x9')](_0xadfe('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xadfe('0xb'),'fields':[_0xadfe('0xc'),_0xadfe('0xd')],'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 f5df424..eb1ba80 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 _0xcb3b=['request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xcb3b,0x182));var _0xbcb3=function(_0x538fca,_0x3f93b4){_0x538fca=_0x538fca-0x0;var _0x539d88=_0xcb3b[_0x538fca];return _0x539d88;};'use strict';var _=require(_0xbcb3('0x0'));var util=require(_0xbcb3('0x1'));var moment=require('moment');var BPromise=require(_0xbcb3('0x2'));var rs=require(_0xbcb3('0x3'));var fs=require('fs');var Redis=require(_0xbcb3('0x4'));var db=require(_0xbcb3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcb3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcb3('0x7'));var client=jayson[_0xbcb3('0x8')][_0xbcb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f4b17,_0x57135f,_0x4af3c1){return new BPromise(function(_0x23832f,_0x12dc92){return client[_0xbcb3('0xa')](_0x5f4b17,_0x4af3c1)['then'](function(_0xe972b7){logger[_0xbcb3('0xb')](_0xbcb3('0xc'),_0x57135f,_0xbcb3('0xd'));logger['debug'](_0xbcb3('0xe'),_0x57135f,_0xbcb3('0xd'),JSON[_0xbcb3('0xf')](_0xe972b7));if(_0xe972b7[_0xbcb3('0x10')]){if(_0xe972b7[_0xbcb3('0x10')]['code']===0x1f4){logger[_0xbcb3('0x10')]('DeskField,\x20%s,\x20%s',_0x57135f,_0xe972b7[_0xbcb3('0x10')]['message']);return _0x12dc92(_0xe972b7[_0xbcb3('0x10')][_0xbcb3('0x11')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x57135f,_0xe972b7['error'][_0xbcb3('0x11')]);return _0x23832f(_0xe972b7['error'][_0xbcb3('0x11')]);}else{logger['info'](_0xbcb3('0xc'),_0x57135f,_0xbcb3('0xd'));_0x23832f(_0xe972b7[_0xbcb3('0x12')]['message']);}})['catch'](function(_0x42b179){logger[_0xbcb3('0x10')](_0xbcb3('0xc'),_0x57135f,_0x42b179);_0x12dc92(_0x42b179);});});} \ No newline at end of file +var _0xbd92=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd92,0xed));var _0x2bd9=function(_0x35787a,_0x22fc2c){_0x35787a=_0x35787a-0x0;var _0x50866b=_0xbd92[_0x35787a];return _0x50866b;};'use strict';var _=require(_0x2bd9('0x0'));var util=require(_0x2bd9('0x1'));var moment=require(_0x2bd9('0x2'));var BPromise=require(_0x2bd9('0x3'));var rs=require(_0x2bd9('0x4'));var fs=require('fs');var Redis=require(_0x2bd9('0x5'));var db=require(_0x2bd9('0x6'))['db'];var utils=require(_0x2bd9('0x7'));var logger=require(_0x2bd9('0x8'))(_0x2bd9('0x9'));var config=require(_0x2bd9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2bd9('0xb')][_0x2bd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x554058,_0x4ef4b2,_0x2a99c5){return new BPromise(function(_0x1f9c6e,_0x213717){return client[_0x2bd9('0xd')](_0x554058,_0x2a99c5)['then'](function(_0x3cec2a){logger[_0x2bd9('0xe')]('DeskField,\x20%s,\x20%s',_0x4ef4b2,'request\x20sent');logger[_0x2bd9('0xf')](_0x2bd9('0x10'),_0x4ef4b2,_0x2bd9('0x11'),JSON[_0x2bd9('0x12')](_0x3cec2a));if(_0x3cec2a[_0x2bd9('0x13')]){if(_0x3cec2a[_0x2bd9('0x13')]['code']===0x1f4){logger[_0x2bd9('0x13')](_0x2bd9('0x14'),_0x4ef4b2,_0x3cec2a['error'][_0x2bd9('0x15')]);return _0x213717(_0x3cec2a[_0x2bd9('0x13')][_0x2bd9('0x15')]);}logger[_0x2bd9('0x13')](_0x2bd9('0x14'),_0x4ef4b2,_0x3cec2a[_0x2bd9('0x13')][_0x2bd9('0x15')]);return _0x1f9c6e(_0x3cec2a['error'][_0x2bd9('0x15')]);}else{logger[_0x2bd9('0xe')](_0x2bd9('0x14'),_0x4ef4b2,_0x2bd9('0x11'));_0x1f9c6e(_0x3cec2a[_0x2bd9('0x16')][_0x2bd9('0x15')]);}})['catch'](function(_0x2cbce6){logger[_0x2bd9('0x13')](_0x2bd9('0x14'),_0x4ef4b2,_0x2cbce6);_0x213717(_0x2cbce6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a4f2d05..67db89d 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 _0xe97d=['index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','/:id','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated'];(function(_0x3dacfa,_0x3c0e93){var _0x337680=function(_0x5081ec){while(--_0x5081ec){_0x3dacfa['push'](_0x3dacfa['shift']());}};_0x337680(++_0x3c0e93);}(_0xe97d,0x80));var _0xde97=function(_0x25e35c,_0x2f09b8){_0x25e35c=_0x25e35c-0x0;var _0x27dcc4=_0xe97d[_0x25e35c];return _0x27dcc4;};'use strict';var multer=require(_0xde97('0x0'));var util=require('util');var path=require(_0xde97('0x1'));var timeout=require(_0xde97('0x2'));var express=require(_0xde97('0x3'));var router=express['Router']();var fs_extra=require(_0xde97('0x4'));var auth=require(_0xde97('0x5'));var interaction=require(_0xde97('0x6'));var config=require(_0xde97('0x7'));var controller=require(_0xde97('0x8'));router['get']('/',auth[_0xde97('0x9')](),controller[_0xde97('0xa')]);router[_0xde97('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xde97('0xc')]);router[_0xde97('0xb')](_0xde97('0xd'),auth[_0xde97('0x9')](),controller[_0xde97('0xe')]);router['get'](_0xde97('0xf'),auth[_0xde97('0x9')](),controller['getFields']);router[_0xde97('0x10')]('/',auth[_0xde97('0x9')](),controller[_0xde97('0x11')]);router[_0xde97('0x10')](_0xde97('0xd'),auth[_0xde97('0x9')](),controller[_0xde97('0x12')]);router[_0xde97('0x13')]('/:id',auth[_0xde97('0x9')](),controller[_0xde97('0x14')]);router['delete'](_0xde97('0x15'),auth[_0xde97('0x9')](),controller['destroy']);module[_0xde97('0x16')]=router; \ No newline at end of file +var _0x6e6c=['update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x22a1ae,_0x389993){var _0x25153b=function(_0x3e42dd){while(--_0x3e42dd){_0x22a1ae['push'](_0x22a1ae['shift']());}};_0x25153b(++_0x389993);}(_0x6e6c,0x16b));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require(_0xc6e6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc6e6('0x3')]();var fs_extra=require(_0xc6e6('0x4'));var auth=require(_0xc6e6('0x5'));var interaction=require(_0xc6e6('0x6'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x7'));router[_0xc6e6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc6e6('0x8')]('/:id',auth[_0xc6e6('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0xc6e6('0x9')](),controller['getConfigurations']);router[_0xc6e6('0x8')](_0xc6e6('0xa'),auth[_0xc6e6('0x9')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0xc')]('/',auth[_0xc6e6('0x9')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xc')](_0xc6e6('0xe'),auth[_0xc6e6('0x9')](),controller[_0xc6e6('0xf')]);router[_0xc6e6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc6e6('0x11')]);router[_0xc6e6('0x12')]('/:id',auth[_0xc6e6('0x9')](),controller['destroy']);module[_0xc6e6('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 f4ac57c..8875ecf 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x150992,_0x29399e){var _0x4e84a4=function(_0x1d0f6e){while(--_0x1d0f6e){_0x150992['push'](_0x150992['shift']());}};_0x4e84a4(++_0x29399e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x5fc3[_0x212bf5];return _0xfcad21;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'tenantId':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize[_0x35fc('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x35fc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'modernAuthentication':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2b83=['STRING','exports'];(function(_0x1afbe0,_0x548f3f){var _0x280995=function(_0x5dedce){while(--_0x5dedce){_0x1afbe0['push'](_0x1afbe0['shift']());}};_0x280995(++_0x548f3f);}(_0x2b83,0x1d3));var _0x32b8=function(_0x545e5d,_0x351027){_0x545e5d=_0x545e5d-0x0;var _0x30a1f7=_0x2b83[_0x545e5d];return _0x30a1f7;};'use strict';var Sequelize=require('sequelize');module[_0x32b8('0x0')]={'name':{'type':Sequelize[_0x32b8('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x32b8('0x1')]},'remoteUri':{'type':Sequelize[_0x32b8('0x1')]},'tenantId':{'type':Sequelize[_0x32b8('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x32b8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x32b8('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9a492e7..d43ae80 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 _0x636f=['name','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','access_token','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','includes','LogicalName','@odata.type','push','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack'];(function(_0x23f50a,_0x1e0fbc){var _0x3d48e2=function(_0x103d6e){while(--_0x103d6e){_0x23f50a['push'](_0x23f50a['shift']());}};_0x3d48e2(++_0x1e0fbc);}(_0x636f,0x164));var _0xf636=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x636f[_0x3b380d];return _0x54502b;};'use strict';var rp=require(_0xf636('0x0'));var util=require(_0xf636('0x1'));var _=require(_0xf636('0x2'));var qs=require(_0xf636('0x3'));var logger=require('../../config/logger')(_0xf636('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf636('0x5'));function respondWithResult(_0xcf976e,_0x5368db){_0x5368db=_0x5368db||0xc8;return function(_0x4abe0f){if(_0x4abe0f){return _0xcf976e[_0xf636('0x6')](_0x5368db)[_0xf636('0x7')](_0x4abe0f);}};}function respondWithFilteredResult(_0x2396af,_0x82fad8){return function(_0x1dbb4c){if(_0x1dbb4c){var _0x2211dd=typeof _0x82fad8[_0xf636('0x8')]===_0xf636('0x9')&&typeof _0x82fad8[_0xf636('0xa')]==='undefined';var _0x25bf2c=_0x1dbb4c[_0xf636('0xb')];var _0x1dff36=_0x2211dd?0x0:_0x82fad8[_0xf636('0x8')];var _0x369c1d=_0x2211dd?_0x1dbb4c[_0xf636('0xb')]:_0x82fad8[_0xf636('0x8')]+_0x82fad8[_0xf636('0xa')];var _0x2b5261;if(_0x369c1d>=_0x25bf2c){_0x369c1d=_0x25bf2c;_0x2b5261=0xc8;}else{_0x2b5261=0xce;}_0x2396af['status'](_0x2b5261);return _0x2396af[_0xf636('0xc')](_0xf636('0xd'),_0x1dff36+'-'+_0x369c1d+'/'+_0x25bf2c)[_0xf636('0x7')](_0x1dbb4c);}return null;};}function saveUpdates(_0x55cea4){return function(_0xea8f64){if(_0xea8f64){return _0xea8f64['update'](_0x55cea4)[_0xf636('0xe')](function(_0x1eb797){return _0x1eb797;});}return null;};}function removeEntity(_0x89a3b){return function(_0x4dc489){if(_0x4dc489){return _0x4dc489[_0xf636('0xf')]()[_0xf636('0xe')](function(){_0x89a3b[_0xf636('0x6')](0xcc)[_0xf636('0x10')]();});}};}function handleEntityNotFound(_0x315224){return function(_0x5afae7){if(!_0x5afae7){_0x315224[_0xf636('0x11')](0x194);}return _0x5afae7;};}function handleError(_0x3f9cfc,_0x3349aa){_0x3349aa=_0x3349aa||0x1f4;return function(_0x29731e){logger[_0xf636('0x12')](_0x29731e[_0xf636('0x13')]);if(_0x29731e[_0xf636('0x14')]){delete _0x29731e[_0xf636('0x14')];}_0x3f9cfc[_0xf636('0x6')](_0x3349aa)['send'](_0x29731e);};}exports['index']=function(_0x31b0de,_0x542af0){var _0x4608f7={},_0x1fecf2={},_0x12ccd1={'count':0x0,'rows':[]};var _0x37d8e0=_[_0xf636('0x15')](db[_0xf636('0x16')][_0xf636('0x17')],function(_0x371705){return{'name':_0x371705[_0xf636('0x18')],'type':_0x371705[_0xf636('0x19')][_0xf636('0x1a')]};});_0x1fecf2[_0xf636('0x1b')]=_[_0xf636('0x15')](_0x37d8e0,'name');_0x1fecf2['query']=_[_0xf636('0x1c')](_0x31b0de[_0xf636('0x1d')]);_0x1fecf2[_0xf636('0x1e')]=_[_0xf636('0x1f')](_0x1fecf2[_0xf636('0x1b')],_0x1fecf2[_0xf636('0x1d')]);_0x4608f7['attributes']=_[_0xf636('0x1f')](_0x1fecf2[_0xf636('0x1b')],qs['fields'](_0x31b0de[_0xf636('0x1d')]['fields']));_0x4608f7[_0xf636('0x20')]=_0x4608f7[_0xf636('0x20')][_0xf636('0x21')]?_0x4608f7['attributes']:_0x1fecf2[_0xf636('0x1b')];if(!_0x31b0de['query'][_0xf636('0x22')](_0xf636('0x23'))){_0x4608f7[_0xf636('0xa')]=qs[_0xf636('0xa')](_0x31b0de[_0xf636('0x1d')][_0xf636('0xa')]);_0x4608f7[_0xf636('0x8')]=qs['offset'](_0x31b0de[_0xf636('0x1d')][_0xf636('0x8')]);}_0x4608f7[_0xf636('0x24')]=qs[_0xf636('0x25')](_0x31b0de[_0xf636('0x1d')]['sort']);_0x4608f7[_0xf636('0x26')]=qs[_0xf636('0x1e')](_[_0xf636('0x27')](_0x31b0de[_0xf636('0x1d')],_0x1fecf2[_0xf636('0x1e')]),_0x37d8e0);if(_0x31b0de[_0xf636('0x1d')][_0xf636('0x28')]){_0x4608f7['where']=_[_0xf636('0x29')](_0x4608f7[_0xf636('0x26')],{'$or':_[_0xf636('0x15')](_0x37d8e0,function(_0xa9e63a){if(_0xa9e63a[_0xf636('0x19')]!==_0xf636('0x2a')){var _0x3cc488={};_0x3cc488[_0xa9e63a['name']]={'$like':'%'+_0x31b0de[_0xf636('0x1d')][_0xf636('0x28')]+'%'};return _0x3cc488;}})});}_0x4608f7=_[_0xf636('0x29')]({},_0x4608f7,_0x31b0de[_0xf636('0x2b')]);var _0x1184d1={'where':_0x4608f7[_0xf636('0x26')]};return db[_0xf636('0x16')]['count'](_0x1184d1)[_0xf636('0xe')](function(_0x3f3886){_0x12ccd1[_0xf636('0xb')]=_0x3f3886;if(_0x31b0de['query'][_0xf636('0x2c')]){_0x4608f7[_0xf636('0x2d')]=[{'all':!![]}];}return db[_0xf636('0x16')][_0xf636('0x2e')](_0x4608f7);})['then'](function(_0x2dad23){_0x12ccd1[_0xf636('0x2f')]=_0x2dad23;return _0x12ccd1;})[_0xf636('0xe')](respondWithFilteredResult(_0x542af0,_0x4608f7))[_0xf636('0x30')](handleError(_0x542af0,null));};exports[_0xf636('0x31')]=function(_0x3bc9a5,_0x19f28b){var _0x36261d={'raw':![],'where':{'id':_0x3bc9a5[_0xf636('0x32')]['id']}},_0x2c83be={};_0x2c83be[_0xf636('0x1b')]=_['keys'](db[_0xf636('0x16')][_0xf636('0x17')]);_0x2c83be[_0xf636('0x1d')]=_[_0xf636('0x1c')](_0x3bc9a5[_0xf636('0x1d')]);_0x2c83be[_0xf636('0x1e')]=_['intersection'](_0x2c83be[_0xf636('0x1b')],_0x2c83be[_0xf636('0x1d')]);_0x36261d[_0xf636('0x20')]=_['intersection'](_0x2c83be['model'],qs[_0xf636('0x33')](_0x3bc9a5[_0xf636('0x1d')][_0xf636('0x33')]));_0x36261d[_0xf636('0x20')]=_0x36261d[_0xf636('0x20')]['length']?_0x36261d[_0xf636('0x20')]:_0x2c83be[_0xf636('0x1b')];if(_0x3bc9a5['query']['includeAll']){_0x36261d[_0xf636('0x2d')]=[{'all':!![]}];}_0x36261d=_[_0xf636('0x29')]({},_0x36261d,_0x3bc9a5[_0xf636('0x2b')]);return db['Dynamics365Account'][_0xf636('0x34')](_0x36261d)[_0xf636('0xe')](handleEntityNotFound(_0x19f28b,null))[_0xf636('0xe')](respondWithResult(_0x19f28b,null))['catch'](handleError(_0x19f28b,null));};exports[_0xf636('0x35')]=function(_0x5c9390,_0x30a27c){return db[_0xf636('0x16')][_0xf636('0x35')](_0x5c9390['body'],{})['then'](respondWithResult(_0x30a27c,0xc9))[_0xf636('0x30')](handleError(_0x30a27c,null));};exports['update']=function(_0x1c4e06,_0x3ac1ee){if(_0x1c4e06[_0xf636('0x36')]['id']){delete _0x1c4e06[_0xf636('0x36')]['id'];}return db[_0xf636('0x16')][_0xf636('0x34')]({'where':{'id':_0x1c4e06['params']['id']}})['then'](handleEntityNotFound(_0x3ac1ee,null))[_0xf636('0xe')](saveUpdates(_0x1c4e06[_0xf636('0x36')],null))[_0xf636('0xe')](respondWithResult(_0x3ac1ee,null))['catch'](handleError(_0x3ac1ee,null));};exports[_0xf636('0xf')]=function(_0x2dc8f6,_0x453ed7){return db[_0xf636('0x16')][_0xf636('0x34')]({'where':{'id':_0x2dc8f6[_0xf636('0x32')]['id']}})[_0xf636('0xe')](handleEntityNotFound(_0x453ed7,null))[_0xf636('0xe')](removeEntity(_0x453ed7,null))[_0xf636('0x30')](handleError(_0x453ed7,null));};exports[_0xf636('0x37')]=function(_0x140fc5,_0x1bc605){var _0x6c6cdc={};var _0x2ca6a6={};var _0x14e01d;var _0x24176d;return db[_0xf636('0x16')][_0xf636('0x38')]({'where':{'id':_0x140fc5[_0xf636('0x32')]['id']}})['then'](handleEntityNotFound(_0x1bc605,null))[_0xf636('0xe')](function(_0x472e13){if(_0x472e13){_0x14e01d=_0x472e13;_0x2ca6a6[_0xf636('0x1b')]=_[_0xf636('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0x2ca6a6[_0xf636('0x1d')]=_[_0xf636('0x1c')](_0x140fc5[_0xf636('0x1d')]);_0x2ca6a6[_0xf636('0x1e')]=_['intersection'](_0x2ca6a6[_0xf636('0x1b')],_0x2ca6a6[_0xf636('0x1d')]);_0x6c6cdc['attributes']=_[_0xf636('0x1f')](_0x2ca6a6[_0xf636('0x1b')],qs[_0xf636('0x33')](_0x140fc5['query'][_0xf636('0x33')]));_0x6c6cdc['attributes']=_0x6c6cdc['attributes'][_0xf636('0x21')]?_0x6c6cdc[_0xf636('0x20')]:_0x2ca6a6['model'];_0x6c6cdc[_0xf636('0x24')]=qs[_0xf636('0x25')](_0x140fc5[_0xf636('0x1d')]['sort']);_0x6c6cdc[_0xf636('0x26')]=qs[_0xf636('0x1e')](_['pick'](_0x140fc5[_0xf636('0x1d')],_0x2ca6a6[_0xf636('0x1e')]));if(_0x140fc5[_0xf636('0x1d')][_0xf636('0x28')]){_0x6c6cdc[_0xf636('0x26')]=_[_0xf636('0x29')](_0x6c6cdc[_0xf636('0x26')],{'$or':_[_0xf636('0x15')](_0x6c6cdc[_0xf636('0x20')],function(_0x1c5df9){var _0x4646b6={};_0x4646b6[_0x1c5df9]={'$like':'%'+_0x140fc5[_0xf636('0x1d')]['filter']+'%'};return _0x4646b6;})});}_0x6c6cdc=_[_0xf636('0x29')]({},_0x6c6cdc,_0x140fc5[_0xf636('0x2b')]);return _0x14e01d[_0xf636('0x37')](_0x6c6cdc);}})[_0xf636('0xe')](function(_0xcce43f){if(_0xcce43f){_0x24176d=_0xcce43f[_0xf636('0x21')];if(!_0x140fc5[_0xf636('0x1d')]['hasOwnProperty'](_0xf636('0x23'))){_0x6c6cdc[_0xf636('0xa')]=qs[_0xf636('0xa')](_0x140fc5[_0xf636('0x1d')]['limit']);_0x6c6cdc['offset']=qs[_0xf636('0x8')](_0x140fc5[_0xf636('0x1d')]['offset']);}return _0x14e01d['getConfigurations'](_0x6c6cdc);}})[_0xf636('0xe')](function(_0x406d9c){if(_0x406d9c){return _0x406d9c?{'count':_0x24176d,'rows':_0x406d9c}:null;}})['then'](respondWithResult(_0x1bc605,null))[_0xf636('0x30')](handleError(_0x1bc605,null));};exports['addConfiguration']=function(_0x262db8,_0x3dd29e){if(_0x262db8[_0xf636('0x36')]['id']){delete _0x262db8['body']['id'];}return db[_0xf636('0x16')][_0xf636('0x38')]({'where':{'id':_0x262db8[_0xf636('0x32')]['id']}})[_0xf636('0xe')](handleEntityNotFound(_0x3dd29e,null))[_0xf636('0xe')](function(_0x1afcf0){if(_0x1afcf0){_0x262db8[_0xf636('0x36')][_0xf636('0x39')]=_0x1afcf0['id'];_0x262db8[_0xf636('0x36')][_0xf636('0x3a')]=integrations[_0xf636('0x3b')](_0x262db8[_0xf636('0x36')][_0xf636('0x3c')],_0x262db8[_0xf636('0x36')][_0xf636('0x19')]);_0x262db8[_0xf636('0x36')][_0xf636('0x3d')]=integrations['getDescriptions'](_0x262db8['body'][_0xf636('0x3c')],_0x262db8[_0xf636('0x36')][_0xf636('0x19')]);return db[_0xf636('0x3e')][_0xf636('0x35')](_0x262db8[_0xf636('0x36')],{'include':[{'model':db[_0xf636('0x3f')],'as':'Subjects'},{'model':db[_0xf636('0x3f')],'as':_0xf636('0x3d')}]});}return null;})['then'](respondWithResult(_0x3dd29e,null))[_0xf636('0x30')](handleError(_0x3dd29e,null));};function sanitizeRemoteUri(_0x237cd8){var _0x16f794=_0x237cd8[_0xf636('0x40')](-0x1);if(_0x16f794==='/')return _0x237cd8[_0xf636('0x41')](0x0,_0x237cd8[_0xf636('0x42')](_0x16f794));return _0x237cd8;}function getWebApiUrl(_0x43b03c){return util[_0xf636('0x43')](_0xf636('0x44'),_0x43b03c);}exports['getFields']=function(_0x2793ea,_0x46df60){var _0x9d1949=_0x2793ea[_0xf636('0x1d')][_0xf636('0x45')];var _0x2e92c0=_0x9d1949==='incident'?_0xf636('0x46'):_0xf636('0x47');var _0xa6358d='';var _0x267253='';var _0x46d286='';var _0x4bcf55='';var _0x801dea='';var _0x37eb2a='';var _0x4297b4='';var _0x39a7b3='';var _0x692eb8=[_0xf636('0x48'),_0xf636('0x49'),_0xf636('0x4a'),'ownerid',_0xf636('0x4b'),_0xf636('0x4c'),_0xf636('0x4d'),_0xf636('0x4e'),_0xf636('0x4f'),_0xf636('0x50')];var _0x45ad24=['accountidname',_0xf636('0x51'),_0xf636('0x52'),_0xf636('0x53'),_0xf636('0x54'),_0xf636('0x55'),_0xf636('0x56'),_0xf636('0x57'),_0xf636('0x58'),_0xf636('0x59'),_0xf636('0x5a'),_0xf636('0x5b'),'createdon',_0xf636('0x5c'),_0xf636('0x5d'),_0xf636('0x5e'),_0xf636('0x5f'),_0xf636('0x60'),'emailaddress',_0xf636('0x61'),'entityimage_timestamp',_0xf636('0x62'),_0xf636('0x63'),'exchangerate',_0xf636('0x64'),_0xf636('0x65'),_0xf636('0x66'),'influencescore','kbarticleidname','lastonholdtime',_0xf636('0x67'),_0xf636('0x68'),_0xf636('0x69'),'modifiedbyname','modifiedbyyominame','modifiedon',_0xf636('0x6a'),_0xf636('0x6b'),_0xf636('0x6c'),_0xf636('0x6d'),_0xf636('0x6e'),_0xf636('0x6f'),_0xf636('0x70'),_0xf636('0x71'),_0xf636('0x72'),_0xf636('0x73'),'parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename',_0xf636('0x74'),_0xf636('0x75'),_0xf636('0x76'),_0xf636('0x77'),_0xf636('0x78'),'responsiblecontactidname','responsiblecontactidyominame',_0xf636('0x79'),_0xf636('0x7a'),'slaname',_0xf636('0x7b'),_0xf636('0x7c'),_0xf636('0x7d'),_0xf636('0x7e'),_0xf636('0x7f'),'timezoneruleversionnumber','transactioncurrencyidname',_0xf636('0x80'),_0xf636('0x81'),_0xf636('0x82')];var _0x49c7e6=_0x692eb8[_0xf636('0x83')](_0x45ad24);return db[_0xf636('0x16')][_0xf636('0x38')]({'where':{'id':_0x2793ea[_0xf636('0x32')]['id']},'attributes':['id','username',_0xf636('0x84'),'remoteUri',_0xf636('0x85'),_0xf636('0x86'),_0xf636('0x87'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0xf636('0xe')](handleEntityNotFound(_0x46df60,null))['then'](function(_0x45fac5){if(_0x45fac5){if(_0x45fac5['modernAuthentication']){_0x45fac5[_0xf636('0x88')]=_0x45fac5[_0xf636('0x89')][_0xf636('0x8a')];_0x39a7b3=sanitizeRemoteUri(_0x45fac5[_0xf636('0x89')][_0xf636('0x8b')]);_0x4297b4=getWebApiUrl(_0x39a7b3);return _0x45fac5;}_0x39a7b3=sanitizeRemoteUri(_0x45fac5['remoteUri']);_0x4297b4=getWebApiUrl(_0x39a7b3);var _0x43bd70={'method':_0xf636('0x8c'),'uri':_0xf636('0x8d')+_0x45fac5[_0xf636('0x85')]+_0xf636('0x8e'),'form':{'client_id':_0x45fac5['clientId'],'resource':_0x39a7b3,'username':_0x45fac5[_0xf636('0x8f')],'password':_0x45fac5[_0xf636('0x84')],'grant_type':'password','client_secret':_0x45fac5[_0xf636('0x87')]},'json':!![]};return rp(_0x43bd70);}})[_0xf636('0xe')](function(_0x13d28f){_0x37eb2a=_0x13d28f[_0xf636('0x88')];var _0x47349b={'method':_0xf636('0x90'),'uri':encodeURI(_0x4297b4+_0xf636('0x91')+_0x2e92c0+'\x27'),'headers':{'Authorization':_0xf636('0x92')+_0x37eb2a,'If-None-Match':null,'OData-Version':_0xf636('0x93')},'json':!![]};return rp(_0x47349b);})[_0xf636('0xe')](function(_0x3ef721){var _0x36a9d2=_0x3ef721[_0xf636('0x94')][0x0];var _0x33f1f1=_0x36a9d2['MetadataId'];var _0x4da94a={'method':_0xf636('0x90'),'uri':_0x4297b4+_0xf636('0x95')+_0x33f1f1+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf636('0x92')+_0x37eb2a,'If-None-Match':null,'OData-Version':_0xf636('0x93')},'json':!![]};return rp(_0x4da94a);})[_0xf636('0xe')](function(_0x2b86fa){_0xa6358d=_0x2b86fa;_0x267253=_0xa6358d[_0xf636('0x96')];_0x267253=_['remove'](_0x267253,function(_0x1bac5a){return!_0x49c7e6[_0xf636('0x97')](_0x1bac5a[_0xf636('0x98')]);});var _0x40467c=[];var _0x43c075=[];_0x267253['forEach'](function(_0x5cac0f){if(_0x5cac0f[_0xf636('0x99')]){var _0x4efa51=_0x5cac0f[_0xf636('0x99')][_0xf636('0x41')](_0x5cac0f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4efa51==='PicklistAttributeMetadata'){_0x40467c[_0xf636('0x9a')](getSelectList(_0x4297b4,_0x9d1949,_0x43c075,_0xa6358d[_0xf636('0x9b')],_0x5cac0f['MetadataId'],_0x37eb2a));}}});return Promise[_0xf636('0x9c')](_0x40467c);})['then'](function(_0x1b1d19){_0x46d286=_0x1b1d19[0x0];var _0x5ef833=[];var _0x229700=[];_0x267253[_0xf636('0x9d')](function(_0x1905b8){if(!_[_0xf636('0x9e')](_0x1905b8['@odata.type'])){var _0x232009=_0x1905b8[_0xf636('0x99')][_0xf636('0x41')](_0x1905b8['@odata.type'][_0xf636('0x42')]('.')+0x1);if(_0x232009===_0xf636('0x9f')){_0x5ef833[_0xf636('0x9a')](getBooleanList(_0x4297b4,_0x9d1949,_0x229700,_0xa6358d[_0xf636('0x9b')],_0x1905b8[_0xf636('0x9b')],_0x37eb2a));}}});return Promise[_0xf636('0x9c')](_0x5ef833);})[_0xf636('0xe')](function(_0x5cb4a3){_0x4bcf55=_0x5cb4a3[0x0];var _0x443478=[];var _0x5b7720=[];_0x267253[_0xf636('0x9d')](function(_0x50a1be){if(_0x50a1be['@odata.type']){var _0x332df9=_0x50a1be['@odata.type']['substring'](_0x50a1be[_0xf636('0x99')][_0xf636('0x42')]('.')+0x1);if(_0x332df9==='StringAttributeMetadata'||_0x332df9===_0xf636('0xa0')||_0x332df9===_0xf636('0xa1')||_0x332df9===_0xf636('0xa2')||_0x332df9==='MemoAttributeMetadata'||_0x332df9===_0xf636('0xa3')||_0x332df9===_0xf636('0xa4')||_0x332df9===_0xf636('0xa5')||_0x332df9===_0xf636('0xa6')||_0x332df9===_0xf636('0xa7')){_0x443478[_0xf636('0x9a')](getInputList(_0x4297b4,_0x9d1949,_0x332df9,_0x5b7720,_0xa6358d[_0xf636('0x9b')],_0x50a1be['MetadataId'],_0x37eb2a));}}});return Promise['all'](_0x443478);})[_0xf636('0xe')](function(_0x415506){_0x801dea=_0x415506[0x0];var _0x6cd52=_0x46d286[_0xf636('0x83')](_0x4bcf55)[_0xf636('0x83')](_0x801dea);var _0x2f6fb8={'count':_0x6cd52[_0xf636('0x21')],'rows':_0x6cd52};return _0x2f6fb8;})[_0xf636('0xe')](respondWithResult(_0x46df60,null))[_0xf636('0x30')](function(_0x36c026){var _0x56a55e=_0x2793ea[_0xf636('0x1d')][_0xf636('0xa8')]?0x1f4:_0x36c026[_0xf636('0xa9')]||0x1f4;logger['error'](_0x36c026[_0xf636('0x13')]);delete _0x36c026[_0xf636('0x14')];if(_0x56a55e===0x191){_0x56a55e=0x190;}_0x46df60[_0xf636('0x6')](_0x56a55e)[_0xf636('0xaa')](_0x2793ea['query']['test']?{'message':_0xf636('0xab'),'statusCode':_0x36c026[_0xf636('0xa9')]}:_0x36c026);});};function getSelectList(_0x3d4dab,_0x2472a6,_0x1e3374,_0x1347f3,_0x35e592,_0x28ee7b){var _0x13280f={'method':_0xf636('0x90'),'uri':_0x3d4dab+_0xf636('0x95')+_0x1347f3+_0xf636('0xac')+_0x35e592+_0xf636('0xad')+_0xf636('0xae'),'headers':{'Authorization':_0xf636('0x92')+_0x28ee7b,'If-None-Match':null,'OData-Version':_0xf636('0x93')},'json':!![]};return rp(_0x13280f)['then'](function(_0x273714){var _0x4eae81=[];var _0x21b5d6=_0x273714[_0xf636('0xaf')][_0xf636('0xb0')];_0x21b5d6[_0xf636('0x9d')](function(_0x57eab9){_0x4eae81[_0xf636('0x9a')]({'name':_0x57eab9[_0xf636('0xb1')][_0xf636('0xb2')][_0xf636('0xb1')],'value':String(_0x57eab9[_0xf636('0xb3')])});});var _0x538406={'id':_0x2472a6+'_'+_0x273714[_0xf636('0x98')],'name':_0x273714[_0xf636('0xb4')]['UserLocalizedLabel'][_0xf636('0xb1')],'custom':![],'options':_0x4eae81};_0x1e3374[_0xf636('0x9a')](_0x538406);return _0x1e3374;});}function getBooleanList(_0x3c1c85,_0x8b1c17,_0x4bc0a8,_0x25a319,_0x36de46,_0x395c7e){var _0x45fd25={'method':_0xf636('0x90'),'uri':_0x3c1c85+'EntityDefinitions('+_0x25a319+_0xf636('0xac')+_0x36de46+_0xf636('0xb5'),'headers':{'Authorization':_0xf636('0x92')+_0x395c7e,'If-None-Match':null,'OData-Version':_0xf636('0x93')},'json':!![]};return rp(_0x45fd25)[_0xf636('0xe')](function(_0xc7a985){var _0x1e1529=[];_0x1e1529[_0xf636('0x9a')]({'name':_0xc7a985[_0xf636('0xaf')][_0xf636('0xb6')][_0xf636('0xb1')][_0xf636('0xb2')][_0xf636('0xb1')],'value':_0xf636('0xb7')},{'name':_0xc7a985[_0xf636('0xaf')][_0xf636('0xb8')]['Label'][_0xf636('0xb2')]['Label'],'value':_0xf636('0xb9')});var _0x57c43a={'id':_0x8b1c17+'_'+_0xc7a985[_0xf636('0x98')],'name':_0xc7a985[_0xf636('0xb4')][_0xf636('0xb2')][_0xf636('0xb1')],'custom':![],'options':_0x1e1529};_0x4bc0a8[_0xf636('0x9a')](_0x57c43a);return _0x4bc0a8;});}function getInputList(_0x24e39d,_0x2b025c,_0x932402,_0x7b01f1,_0xa1f6e4,_0x41614a,_0x11e539){var _0x458acf={'method':_0xf636('0x90'),'uri':_0x24e39d+_0xf636('0x95')+_0xa1f6e4+_0xf636('0xac')+_0x41614a+_0xf636('0xba')+_0x932402+_0xf636('0xbb'),'headers':{'Authorization':_0xf636('0x92')+_0x11e539,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x458acf)[_0xf636('0xe')](function(_0x4c51bc){var _0x171949={'id':_0x2b025c+'_'+_0x4c51bc['LogicalName'],'name':_0x4c51bc[_0xf636('0xb4')]['UserLocalizedLabel']?_0x4c51bc[_0xf636('0xb4')]['UserLocalizedLabel'][_0xf636('0xb1')]:_0x4c51bc['LogicalName'],'custom':![],'options':[]};_0x7b01f1[_0xf636('0x9a')](_0x171949);return _0x7b01f1;});} \ No newline at end of file +var _0x9755=['modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','value','MetadataId','EntityDefinitions(','Bearer\x20','4.0','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','all','isNil','push','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','FalseOption','request-promise','lodash','../../components/parsers/qs','../../config/logger','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','Dynamics365Account','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','length','create','body','find','getConfigurations','findOne','Dynamics365Configuration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9755,0x1c6));var _0x5975=function(_0x3f3c46,_0x33e972){_0x3f3c46=_0x3f3c46-0x0;var _0x7d1132=_0x9755[_0x3f3c46];return _0x7d1132;};'use strict';var rp=require(_0x5975('0x0'));var util=require('util');var _=require(_0x5975('0x1'));var qs=require(_0x5975('0x2'));var logger=require(_0x5975('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x261737,_0x453917){_0x453917=_0x453917||0xc8;return function(_0x2b7c96){if(_0x2b7c96){return _0x261737[_0x5975('0x4')](_0x453917)[_0x5975('0x5')](_0x2b7c96);}};}function respondWithFilteredResult(_0x1839fb,_0x365ac3){return function(_0x56fc2e){if(_0x56fc2e){var _0x48d8b5=typeof _0x365ac3[_0x5975('0x6')]==='undefined'&&typeof _0x365ac3[_0x5975('0x7')]===_0x5975('0x8');var _0x15ebfd=_0x56fc2e['count'];var _0xa869fe=_0x48d8b5?0x0:_0x365ac3['offset'];var _0x5d7957=_0x48d8b5?_0x56fc2e[_0x5975('0x9')]:_0x365ac3[_0x5975('0x6')]+_0x365ac3[_0x5975('0x7')];var _0x5119f8;if(_0x5d7957>=_0x15ebfd){_0x5d7957=_0x15ebfd;_0x5119f8=0xc8;}else{_0x5119f8=0xce;}_0x1839fb[_0x5975('0x4')](_0x5119f8);return _0x1839fb[_0x5975('0xa')](_0x5975('0xb'),_0xa869fe+'-'+_0x5d7957+'/'+_0x15ebfd)['json'](_0x56fc2e);}return null;};}function saveUpdates(_0x119571){return function(_0x2ad3ed){if(_0x2ad3ed){return _0x2ad3ed[_0x5975('0xc')](_0x119571)[_0x5975('0xd')](function(_0x4ff4e7){return _0x4ff4e7;});}return null;};}function removeEntity(_0x5e355a){return function(_0x331385){if(_0x331385){return _0x331385[_0x5975('0xe')]()[_0x5975('0xd')](function(){_0x5e355a['status'](0xcc)[_0x5975('0xf')]();});}};}function handleEntityNotFound(_0x4de825){return function(_0x145f39){if(!_0x145f39){_0x4de825['sendStatus'](0x194);}return _0x145f39;};}function handleError(_0x2d9d4c,_0x30685f){_0x30685f=_0x30685f||0x1f4;return function(_0x16706c){logger[_0x5975('0x10')](_0x16706c[_0x5975('0x11')]);if(_0x16706c[_0x5975('0x12')]){delete _0x16706c[_0x5975('0x12')];}_0x2d9d4c['status'](_0x30685f)[_0x5975('0x13')](_0x16706c);};}exports['index']=function(_0x5ad271,_0x5355bf){var _0x296185={},_0x5bd954={},_0xfe6e88={'count':0x0,'rows':[]};var _0x2e9b66=_[_0x5975('0x14')](db[_0x5975('0x15')]['rawAttributes'],function(_0x9a4f5b){return{'name':_0x9a4f5b[_0x5975('0x16')],'type':_0x9a4f5b[_0x5975('0x17')]['key']};});_0x5bd954[_0x5975('0x18')]=_[_0x5975('0x14')](_0x2e9b66,_0x5975('0x12'));_0x5bd954[_0x5975('0x19')]=_['keys'](_0x5ad271['query']);_0x5bd954[_0x5975('0x1a')]=_[_0x5975('0x1b')](_0x5bd954['model'],_0x5bd954[_0x5975('0x19')]);_0x296185['attributes']=_[_0x5975('0x1b')](_0x5bd954['model'],qs['fields'](_0x5ad271[_0x5975('0x19')]['fields']));_0x296185[_0x5975('0x1c')]=_0x296185[_0x5975('0x1c')]['length']?_0x296185['attributes']:_0x5bd954[_0x5975('0x18')];if(!_0x5ad271[_0x5975('0x19')][_0x5975('0x1d')](_0x5975('0x1e'))){_0x296185[_0x5975('0x7')]=qs[_0x5975('0x7')](_0x5ad271[_0x5975('0x19')][_0x5975('0x7')]);_0x296185[_0x5975('0x6')]=qs['offset'](_0x5ad271[_0x5975('0x19')][_0x5975('0x6')]);}_0x296185[_0x5975('0x1f')]=qs['sort'](_0x5ad271[_0x5975('0x19')]['sort']);_0x296185['where']=qs[_0x5975('0x1a')](_[_0x5975('0x20')](_0x5ad271[_0x5975('0x19')],_0x5bd954[_0x5975('0x1a')]),_0x2e9b66);if(_0x5ad271[_0x5975('0x19')]['filter']){_0x296185[_0x5975('0x21')]=_[_0x5975('0x22')](_0x296185['where'],{'$or':_['map'](_0x2e9b66,function(_0x56b278){if(_0x56b278[_0x5975('0x17')]!==_0x5975('0x23')){var _0x1d9e83={};_0x1d9e83[_0x56b278[_0x5975('0x12')]]={'$like':'%'+_0x5ad271[_0x5975('0x19')][_0x5975('0x24')]+'%'};return _0x1d9e83;}})});}_0x296185=_[_0x5975('0x22')]({},_0x296185,_0x5ad271[_0x5975('0x25')]);var _0x12f8f6={'where':_0x296185[_0x5975('0x21')]};return db[_0x5975('0x15')][_0x5975('0x9')](_0x12f8f6)[_0x5975('0xd')](function(_0x15de18){_0xfe6e88[_0x5975('0x9')]=_0x15de18;if(_0x5ad271[_0x5975('0x19')][_0x5975('0x26')]){_0x296185[_0x5975('0x27')]=[{'all':!![]}];}return db[_0x5975('0x15')][_0x5975('0x28')](_0x296185);})['then'](function(_0x488a3c){_0xfe6e88[_0x5975('0x29')]=_0x488a3c;return _0xfe6e88;})['then'](respondWithFilteredResult(_0x5355bf,_0x296185))[_0x5975('0x2a')](handleError(_0x5355bf,null));};exports[_0x5975('0x2b')]=function(_0x376ecc,_0x491831){var _0x1cb7db={'raw':![],'where':{'id':_0x376ecc[_0x5975('0x2c')]['id']}},_0x17c044={};_0x17c044['model']=_[_0x5975('0x2d')](db[_0x5975('0x15')][_0x5975('0x2e')]);_0x17c044['query']=_['keys'](_0x376ecc[_0x5975('0x19')]);_0x17c044[_0x5975('0x1a')]=_['intersection'](_0x17c044['model'],_0x17c044['query']);_0x1cb7db[_0x5975('0x1c')]=_[_0x5975('0x1b')](_0x17c044[_0x5975('0x18')],qs[_0x5975('0x2f')](_0x376ecc[_0x5975('0x19')]['fields']));_0x1cb7db[_0x5975('0x1c')]=_0x1cb7db[_0x5975('0x1c')][_0x5975('0x30')]?_0x1cb7db[_0x5975('0x1c')]:_0x17c044[_0x5975('0x18')];if(_0x376ecc['query']['includeAll']){_0x1cb7db['include']=[{'all':!![]}];}_0x1cb7db=_[_0x5975('0x22')]({},_0x1cb7db,_0x376ecc[_0x5975('0x25')]);return db[_0x5975('0x15')]['find'](_0x1cb7db)[_0x5975('0xd')](handleEntityNotFound(_0x491831,null))[_0x5975('0xd')](respondWithResult(_0x491831,null))[_0x5975('0x2a')](handleError(_0x491831,null));};exports['create']=function(_0x127816,_0x994e00){return db[_0x5975('0x15')][_0x5975('0x31')](_0x127816['body'],{})[_0x5975('0xd')](respondWithResult(_0x994e00,0xc9))[_0x5975('0x2a')](handleError(_0x994e00,null));};exports[_0x5975('0xc')]=function(_0x2844d9,_0x1a6825){if(_0x2844d9[_0x5975('0x32')]['id']){delete _0x2844d9[_0x5975('0x32')]['id'];}return db['Dynamics365Account'][_0x5975('0x33')]({'where':{'id':_0x2844d9[_0x5975('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1a6825,null))['then'](saveUpdates(_0x2844d9[_0x5975('0x32')],null))[_0x5975('0xd')](respondWithResult(_0x1a6825,null))[_0x5975('0x2a')](handleError(_0x1a6825,null));};exports['destroy']=function(_0x1f9892,_0x4c55eb){return db[_0x5975('0x15')][_0x5975('0x33')]({'where':{'id':_0x1f9892[_0x5975('0x2c')]['id']}})[_0x5975('0xd')](handleEntityNotFound(_0x4c55eb,null))[_0x5975('0xd')](removeEntity(_0x4c55eb,null))[_0x5975('0x2a')](handleError(_0x4c55eb,null));};exports[_0x5975('0x34')]=function(_0x21e84b,_0x397088){var _0x1c89cf={};var _0x12a127={};var _0x4278da;var _0x3c57b3;return db['Dynamics365Account'][_0x5975('0x35')]({'where':{'id':_0x21e84b[_0x5975('0x2c')]['id']}})[_0x5975('0xd')](handleEntityNotFound(_0x397088,null))[_0x5975('0xd')](function(_0x350077){if(_0x350077){_0x4278da=_0x350077;_0x12a127['model']=_[_0x5975('0x2d')](db[_0x5975('0x36')]['rawAttributes']);_0x12a127[_0x5975('0x19')]=_[_0x5975('0x2d')](_0x21e84b[_0x5975('0x19')]);_0x12a127[_0x5975('0x1a')]=_['intersection'](_0x12a127[_0x5975('0x18')],_0x12a127[_0x5975('0x19')]);_0x1c89cf[_0x5975('0x1c')]=_[_0x5975('0x1b')](_0x12a127['model'],qs[_0x5975('0x2f')](_0x21e84b['query'][_0x5975('0x2f')]));_0x1c89cf['attributes']=_0x1c89cf[_0x5975('0x1c')][_0x5975('0x30')]?_0x1c89cf['attributes']:_0x12a127[_0x5975('0x18')];_0x1c89cf[_0x5975('0x1f')]=qs[_0x5975('0x37')](_0x21e84b[_0x5975('0x19')][_0x5975('0x37')]);_0x1c89cf['where']=qs[_0x5975('0x1a')](_['pick'](_0x21e84b[_0x5975('0x19')],_0x12a127['filters']));if(_0x21e84b[_0x5975('0x19')]['filter']){_0x1c89cf[_0x5975('0x21')]=_[_0x5975('0x22')](_0x1c89cf['where'],{'$or':_[_0x5975('0x14')](_0x1c89cf[_0x5975('0x1c')],function(_0x4566d6){var _0x24c2f7={};_0x24c2f7[_0x4566d6]={'$like':'%'+_0x21e84b[_0x5975('0x19')]['filter']+'%'};return _0x24c2f7;})});}_0x1c89cf=_[_0x5975('0x22')]({},_0x1c89cf,_0x21e84b[_0x5975('0x25')]);return _0x4278da[_0x5975('0x34')](_0x1c89cf);}})[_0x5975('0xd')](function(_0x1637f4){if(_0x1637f4){_0x3c57b3=_0x1637f4[_0x5975('0x30')];if(!_0x21e84b[_0x5975('0x19')][_0x5975('0x1d')](_0x5975('0x1e'))){_0x1c89cf['limit']=qs[_0x5975('0x7')](_0x21e84b['query'][_0x5975('0x7')]);_0x1c89cf[_0x5975('0x6')]=qs[_0x5975('0x6')](_0x21e84b[_0x5975('0x19')][_0x5975('0x6')]);}return _0x4278da['getConfigurations'](_0x1c89cf);}})[_0x5975('0xd')](function(_0x1f0603){if(_0x1f0603){return _0x1f0603?{'count':_0x3c57b3,'rows':_0x1f0603}:null;}})[_0x5975('0xd')](respondWithResult(_0x397088,null))[_0x5975('0x2a')](handleError(_0x397088,null));};exports[_0x5975('0x38')]=function(_0x3734e7,_0x1ab5d1){if(_0x3734e7[_0x5975('0x32')]['id']){delete _0x3734e7[_0x5975('0x32')]['id'];}return db[_0x5975('0x15')]['findOne']({'where':{'id':_0x3734e7['params']['id']}})['then'](handleEntityNotFound(_0x1ab5d1,null))[_0x5975('0xd')](function(_0x4a143b){if(_0x4a143b){_0x3734e7[_0x5975('0x32')][_0x5975('0x39')]=_0x4a143b['id'];_0x3734e7[_0x5975('0x32')][_0x5975('0x3a')]=integrations[_0x5975('0x3b')](_0x3734e7[_0x5975('0x32')][_0x5975('0x3c')],_0x3734e7[_0x5975('0x32')][_0x5975('0x17')]);_0x3734e7['body'][_0x5975('0x3d')]=integrations[_0x5975('0x3e')](_0x3734e7['body']['channel'],_0x3734e7[_0x5975('0x32')][_0x5975('0x17')]);return db[_0x5975('0x36')]['create'](_0x3734e7[_0x5975('0x32')],{'include':[{'model':db[_0x5975('0x3f')],'as':_0x5975('0x3a')},{'model':db[_0x5975('0x3f')],'as':_0x5975('0x3d')}]});}return null;})['then'](respondWithResult(_0x1ab5d1,null))[_0x5975('0x2a')](handleError(_0x1ab5d1,null));};function sanitizeRemoteUri(_0x1e0336){var _0x17db22=_0x1e0336[_0x5975('0x40')](-0x1);if(_0x17db22==='/')return _0x1e0336[_0x5975('0x41')](0x0,_0x1e0336[_0x5975('0x42')](_0x17db22));return _0x1e0336;}function getWebApiUrl(_0xa775a9){return util[_0x5975('0x43')]('%s/api/data/v9.0/',_0xa775a9);}exports[_0x5975('0x44')]=function(_0x4c5bb5,_0x2dd06c){var _0x802b8f=_0x4c5bb5[_0x5975('0x19')][_0x5975('0x45')];var _0x4ba36f=_0x802b8f===_0x5975('0x46')?_0x5975('0x47'):_0x5975('0x48');var _0x2b8563='';var _0x274d30='';var _0x366bfa='';var _0x39eadc='';var _0x542d9a='';var _0x5b01fc='';var _0x5dcea1='';var _0x4025c8='';var _0x5da6e7=[_0x5975('0x49'),_0x5975('0x4a'),'customerid',_0x5975('0x4b'),_0x5975('0x4c'),_0x5975('0x4d'),_0x5975('0x4e'),'regardingobjectid',_0x5975('0x4f'),_0x5975('0x50')];var _0xb6baa9=[_0x5975('0x51'),_0x5975('0x52'),_0x5975('0x53'),_0x5975('0x54'),_0x5975('0x55'),_0x5975('0x56'),_0x5975('0x57'),_0x5975('0x58'),_0x5975('0x59'),_0x5975('0x5a'),_0x5975('0x5b'),_0x5975('0x5c'),_0x5975('0x5d'),_0x5975('0x5e'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x5975('0x5f'),'emailaddress','entitlementidname',_0x5975('0x60'),_0x5975('0x61'),_0x5975('0x62'),_0x5975('0x63'),'firstresponsebykpiidname',_0x5975('0x64'),_0x5975('0x65'),_0x5975('0x66'),_0x5975('0x67'),_0x5975('0x68'),_0x5975('0x69'),_0x5975('0x6a'),_0x5975('0x6b'),_0x5975('0x6c'),_0x5975('0x6d'),'modifiedon',_0x5975('0x6e'),_0x5975('0x6f'),_0x5975('0x70'),_0x5975('0x71'),_0x5975('0x72'),_0x5975('0x73'),_0x5975('0x74'),_0x5975('0x75'),_0x5975('0x76'),_0x5975('0x77'),_0x5975('0x78'),_0x5975('0x79'),'primarycontactidyominame',_0x5975('0x7a'),_0x5975('0x7b'),_0x5975('0x7c'),'resolveby','resolvebykpiidname',_0x5975('0x7d'),'responsiblecontactidname',_0x5975('0x7e'),_0x5975('0x7f'),'slainvokedidname',_0x5975('0x80'),_0x5975('0x81'),_0x5975('0x82'),'statuscode','subjectidname',_0x5975('0x83'),_0x5975('0x84'),_0x5975('0x85'),_0x5975('0x86'),_0x5975('0x87'),_0x5975('0x88')];var _0x403421=_0x5da6e7[_0x5975('0x89')](_0xb6baa9);return db[_0x5975('0x15')][_0x5975('0x35')]({'where':{'id':_0x4c5bb5[_0x5975('0x2c')]['id']},'attributes':['id',_0x5975('0x8a'),'password',_0x5975('0x8b'),_0x5975('0x8c'),_0x5975('0x8d'),_0x5975('0x8e'),_0x5975('0x8f')],'include':[{'model':db[_0x5975('0x90')],'as':_0x5975('0x90'),'attributes':['id',_0x5975('0x91'),_0x5975('0x92')]}]})[_0x5975('0xd')](handleEntityNotFound(_0x2dd06c,null))[_0x5975('0xd')](function(_0x21744f){if(_0x21744f){if(_0x21744f[_0x5975('0x8f')]){_0x21744f[_0x5975('0x93')]=_0x21744f['CloudProvider'][_0x5975('0x91')];_0x4025c8=sanitizeRemoteUri(_0x21744f['CloudProvider'][_0x5975('0x92')]);_0x5dcea1=getWebApiUrl(_0x4025c8);return _0x21744f;}_0x4025c8=sanitizeRemoteUri(_0x21744f[_0x5975('0x8b')]);_0x5dcea1=getWebApiUrl(_0x4025c8);var _0x471d02={'method':_0x5975('0x94'),'uri':_0x5975('0x95')+_0x21744f[_0x5975('0x8c')]+_0x5975('0x96'),'form':{'client_id':_0x21744f['clientId'],'resource':_0x4025c8,'username':_0x21744f[_0x5975('0x8a')],'password':_0x21744f[_0x5975('0x97')],'grant_type':_0x5975('0x97'),'client_secret':_0x21744f[_0x5975('0x8e')]},'json':!![]};return rp(_0x471d02);}})[_0x5975('0xd')](function(_0x3b981a){_0x5b01fc=_0x3b981a[_0x5975('0x93')];var _0x16c69c={'method':_0x5975('0x98'),'uri':encodeURI(_0x5dcea1+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4ba36f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5b01fc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16c69c);})[_0x5975('0xd')](function(_0x30f587){var _0x137052=_0x30f587[_0x5975('0x99')][0x0];var _0x210f70=_0x137052[_0x5975('0x9a')];var _0x52b4fc={'method':_0x5975('0x98'),'uri':_0x5dcea1+_0x5975('0x9b')+_0x210f70+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x5975('0x9c')+_0x5b01fc,'If-None-Match':null,'OData-Version':_0x5975('0x9d')},'json':!![]};return rp(_0x52b4fc);})['then'](function(_0x20d331){_0x2b8563=_0x20d331;_0x274d30=_0x2b8563[_0x5975('0x9e')];_0x274d30=_['remove'](_0x274d30,function(_0x370ef6){return!_0x403421[_0x5975('0x9f')](_0x370ef6[_0x5975('0xa0')]);});var _0x4f3bd7=[];var _0x3b4424=[];_0x274d30['forEach'](function(_0xbb6188){if(_0xbb6188[_0x5975('0xa1')]){var _0xf3acef=_0xbb6188[_0x5975('0xa1')]['substring'](_0xbb6188['@odata.type']['lastIndexOf']('.')+0x1);if(_0xf3acef===_0x5975('0xa2')){_0x4f3bd7['push'](getSelectList(_0x5dcea1,_0x802b8f,_0x3b4424,_0x2b8563[_0x5975('0x9a')],_0xbb6188[_0x5975('0x9a')],_0x5b01fc));}}});return Promise[_0x5975('0xa3')](_0x4f3bd7);})[_0x5975('0xd')](function(_0x1e043d){_0x366bfa=_0x1e043d[0x0];var _0x4498de=[];var _0x417ba0=[];_0x274d30['forEach'](function(_0x1fbcd5){if(!_[_0x5975('0xa4')](_0x1fbcd5[_0x5975('0xa1')])){var _0x18a407=_0x1fbcd5[_0x5975('0xa1')][_0x5975('0x41')](_0x1fbcd5[_0x5975('0xa1')][_0x5975('0x42')]('.')+0x1);if(_0x18a407==='BooleanAttributeMetadata'){_0x4498de[_0x5975('0xa5')](getBooleanList(_0x5dcea1,_0x802b8f,_0x417ba0,_0x2b8563[_0x5975('0x9a')],_0x1fbcd5[_0x5975('0x9a')],_0x5b01fc));}}});return Promise[_0x5975('0xa3')](_0x4498de);})[_0x5975('0xd')](function(_0x490f62){_0x39eadc=_0x490f62[0x0];var _0x126092=[];var _0x245f0c=[];_0x274d30[_0x5975('0xa6')](function(_0xdd7704){if(_0xdd7704[_0x5975('0xa1')]){var _0x5a9c9f=_0xdd7704[_0x5975('0xa1')]['substring'](_0xdd7704[_0x5975('0xa1')]['lastIndexOf']('.')+0x1);if(_0x5a9c9f===_0x5975('0xa7')||_0x5a9c9f===_0x5975('0xa8')||_0x5a9c9f===_0x5975('0xa9')||_0x5a9c9f===_0x5975('0xaa')||_0x5a9c9f===_0x5975('0xab')||_0x5a9c9f==='DateTimeAttributeMetadata'||_0x5a9c9f===_0x5975('0xac')||_0x5a9c9f===_0x5975('0xad')||_0x5a9c9f==='StateAttributeMetadata'||_0x5a9c9f===_0x5975('0xae')){_0x126092[_0x5975('0xa5')](getInputList(_0x5dcea1,_0x802b8f,_0x5a9c9f,_0x245f0c,_0x2b8563[_0x5975('0x9a')],_0xdd7704[_0x5975('0x9a')],_0x5b01fc));}}});return Promise[_0x5975('0xa3')](_0x126092);})[_0x5975('0xd')](function(_0x3fdb26){_0x542d9a=_0x3fdb26[0x0];var _0x33adf2=_0x366bfa['concat'](_0x39eadc)[_0x5975('0x89')](_0x542d9a);var _0x38156a={'count':_0x33adf2['length'],'rows':_0x33adf2};return _0x38156a;})[_0x5975('0xd')](respondWithResult(_0x2dd06c,null))[_0x5975('0x2a')](function(_0x5df4c6){var _0x4acddb=_0x4c5bb5[_0x5975('0x19')][_0x5975('0xaf')]?0x1f4:_0x5df4c6[_0x5975('0xb0')]||0x1f4;logger[_0x5975('0x10')](_0x5df4c6['stack']);delete _0x5df4c6['name'];if(_0x4acddb===0x191){_0x4acddb=0x190;}_0x2dd06c[_0x5975('0x4')](_0x4acddb)[_0x5975('0x13')](_0x4c5bb5[_0x5975('0x19')][_0x5975('0xaf')]?{'message':_0x5975('0xb1'),'statusCode':_0x5df4c6[_0x5975('0xb0')]}:_0x5df4c6);});};function getSelectList(_0xb8b5ce,_0x5edcbb,_0x3e7563,_0x4fe85c,_0x441114,_0x21ee21){var _0x511e59={'method':_0x5975('0x98'),'uri':_0xb8b5ce+_0x5975('0x9b')+_0x4fe85c+_0x5975('0xb2')+_0x441114+_0x5975('0xb3')+_0x5975('0xb4'),'headers':{'Authorization':_0x5975('0x9c')+_0x21ee21,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x511e59)[_0x5975('0xd')](function(_0xb2481c){var _0x32b463=[];var _0x46def2=_0xb2481c['OptionSet'][_0x5975('0xb5')];_0x46def2[_0x5975('0xa6')](function(_0x26e9ad){_0x32b463[_0x5975('0xa5')]({'name':_0x26e9ad['Label'][_0x5975('0xb6')][_0x5975('0xb7')],'value':String(_0x26e9ad['Value'])});});var _0x1a049b={'id':_0x5edcbb+'_'+_0xb2481c[_0x5975('0xa0')],'name':_0xb2481c[_0x5975('0xb8')]['UserLocalizedLabel'][_0x5975('0xb7')],'custom':![],'options':_0x32b463};_0x3e7563['push'](_0x1a049b);return _0x3e7563;});}function getBooleanList(_0x14dedd,_0x5911fd,_0x59cecb,_0x3d94df,_0x1abb7e,_0x59692c){var _0x4e8ee9={'method':_0x5975('0x98'),'uri':_0x14dedd+_0x5975('0x9b')+_0x3d94df+')/Attributes('+_0x1abb7e+_0x5975('0xb9'),'headers':{'Authorization':_0x5975('0x9c')+_0x59692c,'If-None-Match':null,'OData-Version':_0x5975('0x9d')},'json':!![]};return rp(_0x4e8ee9)[_0x5975('0xd')](function(_0x519ea8){var _0x2ae1ae=[];_0x2ae1ae[_0x5975('0xa5')]({'name':_0x519ea8[_0x5975('0xba')]['TrueOption'][_0x5975('0xb7')]['UserLocalizedLabel'][_0x5975('0xb7')],'value':'true'},{'name':_0x519ea8[_0x5975('0xba')][_0x5975('0xbb')]['Label']['UserLocalizedLabel']['Label'],'value':'false'});var _0xef15b6={'id':_0x5911fd+'_'+_0x519ea8[_0x5975('0xa0')],'name':_0x519ea8[_0x5975('0xb8')][_0x5975('0xb6')]['Label'],'custom':![],'options':_0x2ae1ae};_0x59cecb[_0x5975('0xa5')](_0xef15b6);return _0x59cecb;});}function getInputList(_0x5c2a01,_0x110c90,_0x2bb095,_0x57e2ce,_0x2794a1,_0x3b2c68,_0x15d4c2){var _0x460029={'method':_0x5975('0x98'),'uri':_0x5c2a01+'EntityDefinitions('+_0x2794a1+')/Attributes('+_0x3b2c68+')/Microsoft.Dynamics.CRM.'+_0x2bb095+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x15d4c2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x460029)[_0x5975('0xd')](function(_0x50fe7a){var _0x1a02ac={'id':_0x110c90+'_'+_0x50fe7a[_0x5975('0xa0')],'name':_0x50fe7a['DisplayName']['UserLocalizedLabel']?_0x50fe7a[_0x5975('0xb8')][_0x5975('0xb6')][_0x5975('0xb7')]:_0x50fe7a['LogicalName'],'custom':![],'options':[]};_0x57e2ce[_0x5975('0xa5')](_0x1a02ac);return _0x57e2ce;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d9d4da6..80788e7 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x7bff1e,_0x1bd7b5){var _0x247ea2=function(_0x495481){while(--_0x495481){_0x7bff1e['push'](_0x7bff1e['shift']());}};_0x247ea2(++_0x1bd7b5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xcb91[_0x553a87];return _0x12d1e6;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('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(_0x560d75,_0x1492a3){var _0x3734f3=function(_0x4173e1){while(--_0x4173e1){_0x560d75['push'](_0x560d75['shift']());}};_0x3734f3(++_0x1492a3);}(_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 49c13ba..0a48fcb 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 _0x0926=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','GetDynamics365Account','Dynamics365Account','options','where','attributes','include','model','map','then','stringify','ShowDynamics365Account','find','raw','catch','lodash','util'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x0926,0x1a2));var _0x6092=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x0926[_0x257a28];return _0x13bccc;};'use strict';var _=require(_0x6092('0x0'));var util=require(_0x6092('0x1'));var moment=require(_0x6092('0x2'));var BPromise=require(_0x6092('0x3'));var rs=require(_0x6092('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6092('0x5'))['db'];var utils=require(_0x6092('0x6'));var logger=require(_0x6092('0x7'))(_0x6092('0x8'));var config=require(_0x6092('0x9'));var jayson=require(_0x6092('0xa'));var client=jayson[_0x6092('0xb')][_0x6092('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19b87f,_0x3d938f,_0x32caee){return new BPromise(function(_0xc5ed29,_0x34b0b3){return client[_0x6092('0xd')](_0x19b87f,_0x32caee)['then'](function(_0x43f8ef){logger[_0x6092('0xe')](_0x6092('0xf'),_0x3d938f,_0x6092('0x10'));logger[_0x6092('0x11')](_0x6092('0x12'),_0x3d938f,'request\x20sent',JSON['stringify'](_0x43f8ef));if(_0x43f8ef[_0x6092('0x13')]){if(_0x43f8ef[_0x6092('0x13')]['code']===0x1f4){logger[_0x6092('0x13')](_0x6092('0xf'),_0x3d938f,_0x43f8ef[_0x6092('0x13')][_0x6092('0x14')]);return _0x34b0b3(_0x43f8ef[_0x6092('0x13')][_0x6092('0x14')]);}logger['error'](_0x6092('0xf'),_0x3d938f,_0x43f8ef[_0x6092('0x13')][_0x6092('0x14')]);return _0xc5ed29(_0x43f8ef[_0x6092('0x13')][_0x6092('0x14')]);}else{logger[_0x6092('0xe')](_0x6092('0xf'),_0x3d938f,_0x6092('0x10'));_0xc5ed29(_0x43f8ef['result'][_0x6092('0x14')]);}})['catch'](function(_0x9dd119){logger[_0x6092('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x3d938f,_0x9dd119);_0x34b0b3(_0x9dd119);});});}exports[_0x6092('0x15')]=function(_0xaaca19){var _0x4f4207=this;return new Promise(function(_0x384571,_0x2e38f8){return db[_0x6092('0x16')]['findAll']({'raw':_0xaaca19['options']?_0xaaca19[_0x6092('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaaca19['options']?_0xaaca19[_0x6092('0x17')][_0x6092('0x18')]||null:null,'attributes':_0xaaca19[_0x6092('0x17')]?_0xaaca19['options'][_0x6092('0x19')]||null:null,'limit':_0xaaca19[_0x6092('0x17')]?_0xaaca19[_0x6092('0x17')]['limit']||null:null,'include':_0xaaca19[_0x6092('0x17')]?_0xaaca19['options']['include']?_['map'](_0xaaca19[_0x6092('0x17')][_0x6092('0x1a')],function(_0x36a022){return{'model':db[_0x36a022[_0x6092('0x1b')]],'as':_0x36a022['as'],'attributes':_0x36a022['attributes'],'include':_0x36a022['include']?_[_0x6092('0x1c')](_0x36a022[_0x6092('0x1a')],function(_0x3c0ef1){return{'model':db[_0x3c0ef1['model']],'as':_0x3c0ef1['as'],'attributes':_0x3c0ef1[_0x6092('0x19')],'include':_0x3c0ef1[_0x6092('0x1a')]?_[_0x6092('0x1c')](_0x3c0ef1[_0x6092('0x1a')],function(_0x195a15){return{'model':db[_0x195a15['model']],'as':_0x195a15['as'],'attributes':_0x195a15[_0x6092('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6092('0x1d')](function(_0x462861){logger[_0x6092('0xe')](_0x6092('0x15'),_0xaaca19);logger[_0x6092('0x11')](_0x6092('0x15'),_0xaaca19,JSON[_0x6092('0x1e')](_0x462861));_0x384571(_0x462861);})['catch'](function(_0x4a2981){logger['error'](_0x6092('0x15'),_0x4a2981[_0x6092('0x14')],_0xaaca19);_0x2e38f8(_0x4f4207[_0x6092('0x13')](0x1f4,_0x4a2981[_0x6092('0x14')]));});});};exports[_0x6092('0x1f')]=function(_0x949458){var _0x5979e2=this;return new Promise(function(_0x3c5812,_0x245bb5){return db[_0x6092('0x16')][_0x6092('0x20')]({'raw':_0x949458[_0x6092('0x17')]?_0x949458['options'][_0x6092('0x21')]===undefined?!![]:![]:!![],'where':_0x949458[_0x6092('0x17')]?_0x949458['options'][_0x6092('0x18')]||null:null,'attributes':_0x949458['options']?_0x949458[_0x6092('0x17')][_0x6092('0x19')]||null:null,'include':_0x949458[_0x6092('0x17')]?_0x949458[_0x6092('0x17')]['include']?_[_0x6092('0x1c')](_0x949458[_0x6092('0x17')][_0x6092('0x1a')],function(_0x400166){return{'model':db[_0x400166[_0x6092('0x1b')]],'as':_0x400166['as'],'attributes':_0x400166[_0x6092('0x19')],'include':_0x400166[_0x6092('0x1a')]?_[_0x6092('0x1c')](_0x400166[_0x6092('0x1a')],function(_0x1a4cf3){return{'model':db[_0x1a4cf3[_0x6092('0x1b')]],'as':_0x1a4cf3['as'],'attributes':_0x1a4cf3[_0x6092('0x19')],'include':_0x1a4cf3[_0x6092('0x1a')]?_[_0x6092('0x1c')](_0x1a4cf3[_0x6092('0x1a')],function(_0xdfa18c){return{'model':db[_0xdfa18c['model']],'as':_0xdfa18c['as'],'attributes':_0xdfa18c[_0x6092('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6092('0x1d')](function(_0x3fc446){logger[_0x6092('0xe')](_0x6092('0x1f'),_0x949458);logger[_0x6092('0x11')](_0x6092('0x1f'),_0x949458,JSON[_0x6092('0x1e')](_0x3fc446));_0x3c5812(_0x3fc446);})[_0x6092('0x22')](function(_0x11c287){logger[_0x6092('0x13')]('ShowDynamics365Account',_0x11c287[_0x6092('0x14')],_0x949458);_0x245bb5(_0x5979e2[_0x6092('0x13')](0x1f4,_0x11c287['message']));});});}; \ No newline at end of file +var _0x7fab=['where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetDynamics365Account','Dynamics365Account','findAll','raw','options','attributes','include','map','model','debug','catch','ShowDynamics365Account','find'];(function(_0x304936,_0x260419){var _0x10349b=function(_0x40c2ce){while(--_0x40c2ce){_0x304936['push'](_0x304936['shift']());}};_0x10349b(++_0x260419);}(_0x7fab,0x169));var _0xb7fa=function(_0x3f8965,_0x3c80b9){_0x3f8965=_0x3f8965-0x0;var _0xcdf5c9=_0x7fab[_0x3f8965];return _0xcdf5c9;};'use strict';var _=require(_0xb7fa('0x0'));var util=require(_0xb7fa('0x1'));var moment=require(_0xb7fa('0x2'));var BPromise=require(_0xb7fa('0x3'));var rs=require(_0xb7fa('0x4'));var fs=require('fs');var Redis=require(_0xb7fa('0x5'));var db=require(_0xb7fa('0x6'))['db'];var utils=require(_0xb7fa('0x7'));var logger=require(_0xb7fa('0x8'))(_0xb7fa('0x9'));var config=require(_0xb7fa('0xa'));var jayson=require(_0xb7fa('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1364c7,_0xef9572,_0x35d750){return new BPromise(function(_0x881b2a,_0x21b230){return client[_0xb7fa('0xc')](_0x1364c7,_0x35d750)[_0xb7fa('0xd')](function(_0x22b81a){logger[_0xb7fa('0xe')](_0xb7fa('0xf'),_0xef9572,_0xb7fa('0x10'));logger['debug'](_0xb7fa('0x11'),_0xef9572,_0xb7fa('0x10'),JSON[_0xb7fa('0x12')](_0x22b81a));if(_0x22b81a['error']){if(_0x22b81a['error'][_0xb7fa('0x13')]===0x1f4){logger[_0xb7fa('0x14')](_0xb7fa('0xf'),_0xef9572,_0x22b81a[_0xb7fa('0x14')][_0xb7fa('0x15')]);return _0x21b230(_0x22b81a[_0xb7fa('0x14')]['message']);}logger[_0xb7fa('0x14')](_0xb7fa('0xf'),_0xef9572,_0x22b81a['error'][_0xb7fa('0x15')]);return _0x881b2a(_0x22b81a[_0xb7fa('0x14')][_0xb7fa('0x15')]);}else{logger[_0xb7fa('0xe')](_0xb7fa('0xf'),_0xef9572,_0xb7fa('0x10'));_0x881b2a(_0x22b81a['result']['message']);}})['catch'](function(_0x5409a8){logger[_0xb7fa('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0xef9572,_0x5409a8);_0x21b230(_0x5409a8);});});}exports[_0xb7fa('0x16')]=function(_0x1ddc7a){var _0x47cc7f=this;return new Promise(function(_0x53891b,_0x59bf20){return db[_0xb7fa('0x17')][_0xb7fa('0x18')]({'raw':_0x1ddc7a['options']?_0x1ddc7a['options'][_0xb7fa('0x19')]===undefined?!![]:![]:!![],'where':_0x1ddc7a['options']?_0x1ddc7a[_0xb7fa('0x1a')]['where']||null:null,'attributes':_0x1ddc7a[_0xb7fa('0x1a')]?_0x1ddc7a[_0xb7fa('0x1a')][_0xb7fa('0x1b')]||null:null,'limit':_0x1ddc7a[_0xb7fa('0x1a')]?_0x1ddc7a[_0xb7fa('0x1a')]['limit']||null:null,'include':_0x1ddc7a[_0xb7fa('0x1a')]?_0x1ddc7a[_0xb7fa('0x1a')][_0xb7fa('0x1c')]?_[_0xb7fa('0x1d')](_0x1ddc7a[_0xb7fa('0x1a')][_0xb7fa('0x1c')],function(_0x1a6524){return{'model':db[_0x1a6524[_0xb7fa('0x1e')]],'as':_0x1a6524['as'],'attributes':_0x1a6524[_0xb7fa('0x1b')],'include':_0x1a6524[_0xb7fa('0x1c')]?_[_0xb7fa('0x1d')](_0x1a6524[_0xb7fa('0x1c')],function(_0x34a7c2){return{'model':db[_0x34a7c2['model']],'as':_0x34a7c2['as'],'attributes':_0x34a7c2[_0xb7fa('0x1b')],'include':_0x34a7c2['include']?_[_0xb7fa('0x1d')](_0x34a7c2[_0xb7fa('0x1c')],function(_0x46ca49){return{'model':db[_0x46ca49[_0xb7fa('0x1e')]],'as':_0x46ca49['as'],'attributes':_0x46ca49['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7fa('0xd')](function(_0x3a1727){logger[_0xb7fa('0xe')](_0xb7fa('0x16'),_0x1ddc7a);logger[_0xb7fa('0x1f')]('GetDynamics365Account',_0x1ddc7a,JSON['stringify'](_0x3a1727));_0x53891b(_0x3a1727);})[_0xb7fa('0x20')](function(_0x23c1e2){logger['error'](_0xb7fa('0x16'),_0x23c1e2[_0xb7fa('0x15')],_0x1ddc7a);_0x59bf20(_0x47cc7f[_0xb7fa('0x14')](0x1f4,_0x23c1e2['message']));});});};exports[_0xb7fa('0x21')]=function(_0x4c6fba){var _0x1847e9=this;return new Promise(function(_0x28e7f9,_0x233ad0){return db[_0xb7fa('0x17')][_0xb7fa('0x22')]({'raw':_0x4c6fba[_0xb7fa('0x1a')]?_0x4c6fba[_0xb7fa('0x1a')][_0xb7fa('0x19')]===undefined?!![]:![]:!![],'where':_0x4c6fba[_0xb7fa('0x1a')]?_0x4c6fba[_0xb7fa('0x1a')][_0xb7fa('0x23')]||null:null,'attributes':_0x4c6fba['options']?_0x4c6fba[_0xb7fa('0x1a')]['attributes']||null:null,'include':_0x4c6fba[_0xb7fa('0x1a')]?_0x4c6fba[_0xb7fa('0x1a')][_0xb7fa('0x1c')]?_[_0xb7fa('0x1d')](_0x4c6fba['options']['include'],function(_0x50de29){return{'model':db[_0x50de29[_0xb7fa('0x1e')]],'as':_0x50de29['as'],'attributes':_0x50de29[_0xb7fa('0x1b')],'include':_0x50de29[_0xb7fa('0x1c')]?_[_0xb7fa('0x1d')](_0x50de29[_0xb7fa('0x1c')],function(_0x3451b1){return{'model':db[_0x3451b1[_0xb7fa('0x1e')]],'as':_0x3451b1['as'],'attributes':_0x3451b1[_0xb7fa('0x1b')],'include':_0x3451b1[_0xb7fa('0x1c')]?_[_0xb7fa('0x1d')](_0x3451b1['include'],function(_0x8d8108){return{'model':db[_0x8d8108[_0xb7fa('0x1e')]],'as':_0x8d8108['as'],'attributes':_0x8d8108[_0xb7fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb7fa('0xd')](function(_0x3de656){logger[_0xb7fa('0xe')](_0xb7fa('0x21'),_0x4c6fba);logger[_0xb7fa('0x1f')](_0xb7fa('0x21'),_0x4c6fba,JSON[_0xb7fa('0x12')](_0x3de656));_0x28e7f9(_0x3de656);})[_0xb7fa('0x20')](function(_0x204c71){logger[_0xb7fa('0x14')](_0xb7fa('0x21'),_0x204c71['message'],_0x4c6fba);_0x233ad0(_0x1847e9[_0xb7fa('0x14')](0x1f4,_0x204c71[_0xb7fa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 40f12cb..f12417f 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 _0x5098=['post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x3b5d0a,_0x35b8cb){var _0x5c9765=function(_0x7618e2){while(--_0x7618e2){_0x3b5d0a['push'](_0x3b5d0a['shift']());}};_0x5c9765(++_0x35b8cb);}(_0x5098,0x6a));var _0x8509=function(_0x49f991,_0x1222d4){_0x49f991=_0x49f991-0x0;var _0x3daa63=_0x5098[_0x49f991];return _0x3daa63;};'use strict';var multer=require(_0x8509('0x0'));var util=require('util');var path=require(_0x8509('0x1'));var timeout=require(_0x8509('0x2'));var express=require(_0x8509('0x3'));var router=express[_0x8509('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8509('0x5'));var interaction=require(_0x8509('0x6'));var config=require(_0x8509('0x7'));var controller=require(_0x8509('0x8'));router[_0x8509('0x9')]('/',auth[_0x8509('0xa')](),controller[_0x8509('0xb')]);router[_0x8509('0x9')](_0x8509('0xc'),auth['isAuthenticated'](),controller[_0x8509('0xd')]);router['get'](_0x8509('0xe'),auth[_0x8509('0xa')](),controller[_0x8509('0xf')]);router['get'](_0x8509('0x10'),auth['isAuthenticated'](),controller[_0x8509('0x11')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x8509('0x12')]);router[_0x8509('0x13')]('/',auth[_0x8509('0xa')](),controller[_0x8509('0x14')]);router[_0x8509('0x15')](_0x8509('0xc'),auth[_0x8509('0xa')](),controller['update']);router[_0x8509('0x16')](_0x8509('0xc'),auth['isAuthenticated'](),controller[_0x8509('0x17')]);module[_0x8509('0x18')]=router; \ No newline at end of file +var _0x8aa7=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8aa7,0x1c4));var _0x78aa=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x8aa7[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require(_0x78aa('0x0'));var util=require(_0x78aa('0x1'));var path=require(_0x78aa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78aa('0x3')]();var fs_extra=require(_0x78aa('0x4'));var auth=require(_0x78aa('0x5'));var interaction=require(_0x78aa('0x6'));var config=require('../../config/environment');var controller=require(_0x78aa('0x7'));router['get']('/',auth[_0x78aa('0x8')](),controller[_0x78aa('0x9')]);router[_0x78aa('0xa')](_0x78aa('0xb'),auth[_0x78aa('0x8')](),controller[_0x78aa('0xc')]);router[_0x78aa('0xa')](_0x78aa('0xd'),auth[_0x78aa('0x8')](),controller[_0x78aa('0xe')]);router['get'](_0x78aa('0xf'),auth[_0x78aa('0x8')](),controller[_0x78aa('0x10')]);router['get']('/:id/descriptions',auth[_0x78aa('0x8')](),controller['getDescriptions']);router[_0x78aa('0x11')]('/',auth[_0x78aa('0x8')](),controller[_0x78aa('0x12')]);router['put'](_0x78aa('0xb'),auth[_0x78aa('0x8')](),controller[_0x78aa('0x13')]);router[_0x78aa('0x14')]('/:id',auth[_0x78aa('0x8')](),controller[_0x78aa('0x15')]);module[_0x78aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9f8e7ab..c2c2847 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 _0x579d=['exports','STRING','ENUM','incident','nothing','contact','BOOLEAN','sequelize'];(function(_0x390512,_0xbb41e9){var _0x589502=function(_0x2d07bf){while(--_0x2d07bf){_0x390512['push'](_0x390512['shift']());}};_0x589502(++_0xbb41e9);}(_0x579d,0x18f));var _0xd579=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x579d[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xd579('0x0'));module[_0xd579('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd579('0x2')]},'ticketType':{'type':Sequelize[_0xd579('0x3')](_0xd579('0x4'),'phonecall'),'defaultValue':_0xd579('0x4')},'moduleCreate':{'type':Sequelize[_0xd579('0x3')]('contact',_0xd579('0x5')),'defaultValue':_0xd579('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xd579('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xd579('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0404=['sequelize','STRING','ENUM','incident','phonecall','nothing','contact','BOOLEAN'];(function(_0x316520,_0x34c77a){var _0x3160b0=function(_0x1ab736){while(--_0x1ab736){_0x316520['push'](_0x316520['shift']());}};_0x3160b0(++_0x34c77a);}(_0x0404,0xa8));var _0x4040=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x0404[_0x5a1a51];return _0x47edd7;};'use strict';var Sequelize=require(_0x4040('0x0'));module['exports']={'name':{'type':Sequelize[_0x4040('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4040('0x2')](_0x4040('0x3'),_0x4040('0x4')),'defaultValue':_0x4040('0x3')},'moduleCreate':{'type':Sequelize[_0x4040('0x2')]('contact',_0x4040('0x5')),'defaultValue':_0x4040('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4040('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7a05456..3d73a83 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 _0xb306=['merge','VIRTUAL','findAll','catch','show','rawAttributes','includeAll','include','options','find','create','body','params','getFields','Dynamics365Field','filter','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x46075c,_0x1befde){var _0x46147d=function(_0xdd64fc){while(--_0xdd64fc){_0x46075c['push'](_0x46075c['shift']());}};_0x46147d(++_0x1befde);}(_0xb306,0xab));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6b30('0x0'));var rimraf=require(_0x6b30('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b30('0x2'));var rp=require('request-promise');var moment=require(_0x6b30('0x3'));var BPromise=require(_0x6b30('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b30('0x5'));var sox=require('sox');var csv=require(_0x6b30('0x6'));var ejs=require(_0x6b30('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b30('0x8'));var squel=require(_0x6b30('0x9'));var crypto=require('crypto');var jsforce=require(_0x6b30('0xa'));var deskjs=require(_0x6b30('0xb'));var toCsv=require(_0x6b30('0x6'));var querystring=require(_0x6b30('0xc'));var Papa=require(_0x6b30('0xd'));var Redis=require(_0x6b30('0xe'));var authService=require(_0x6b30('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b30('0x10'));var logger=require(_0x6b30('0x11'))(_0x6b30('0x12'));var utils=require(_0x6b30('0x13'));var config=require(_0x6b30('0x14'));var licenseUtil=require(_0x6b30('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6a2a,_0x5d232f){_0x5d232f=_0x5d232f||0xcc;return function(_0x490068){if(_0x490068){return _0x5b6a2a[_0x6b30('0x16')](_0x5d232f);}return _0x5b6a2a['status'](_0x5d232f)[_0x6b30('0x17')]();};}function respondWithResult(_0x3dff80,_0x28a82b){_0x28a82b=_0x28a82b||0xc8;return function(_0x1da3c1){if(_0x1da3c1){return _0x3dff80[_0x6b30('0x18')](_0x28a82b)[_0x6b30('0x19')](_0x1da3c1);}};}function respondWithFilteredResult(_0x12602d,_0x3236ff){return function(_0x370512){if(_0x370512){var _0x4423ed=typeof _0x3236ff[_0x6b30('0x1a')]===_0x6b30('0x1b')&&typeof _0x3236ff['limit']==='undefined';var _0x19b34b=_0x370512['count'];var _0x254b74=_0x4423ed?0x0:_0x3236ff['offset'];var _0x3788aa=_0x4423ed?_0x370512[_0x6b30('0x1c')]:_0x3236ff[_0x6b30('0x1a')]+_0x3236ff[_0x6b30('0x1d')];var _0x12c499;if(_0x3788aa>=_0x19b34b){_0x3788aa=_0x19b34b;_0x12c499=0xc8;}else{_0x12c499=0xce;}_0x12602d[_0x6b30('0x18')](_0x12c499);return _0x12602d[_0x6b30('0x1e')](_0x6b30('0x1f'),_0x254b74+'-'+_0x3788aa+'/'+_0x19b34b)['json'](_0x370512);}return null;};}function patchUpdates(_0x7be553){return function(_0x320106){try{jsonpatch[_0x6b30('0x20')](_0x320106,_0x7be553,!![]);}catch(_0x57e9e8){return BPromise['reject'](_0x57e9e8);}return _0x320106['save']();};}function saveUpdates(_0x128ae0,_0x432d07){return function(_0x5b3aa5){if(_0x5b3aa5){return _0x5b3aa5[_0x6b30('0x21')](_0x128ae0)[_0x6b30('0x22')](function(_0x133f8d){return _0x133f8d;});}return null;};}function removeEntity(_0x2edc74,_0x2ce67b){return function(_0x385e82){if(_0x385e82){return _0x385e82[_0x6b30('0x23')]()[_0x6b30('0x22')](function(){_0x2edc74[_0x6b30('0x18')](0xcc)[_0x6b30('0x17')]();});}};}function handleEntityNotFound(_0x378e2f,_0x2ddfc6){return function(_0x213a44){if(!_0x213a44){_0x378e2f[_0x6b30('0x16')](0x194);}return _0x213a44;};}function handleError(_0x2a63a4,_0x381e5e){_0x381e5e=_0x381e5e||0x1f4;return function(_0x5aee6e){logger[_0x6b30('0x24')](_0x5aee6e['stack']);if(_0x5aee6e[_0x6b30('0x25')]){delete _0x5aee6e['name'];}_0x2a63a4['status'](_0x381e5e)['send'](_0x5aee6e);};}exports['index']=function(_0x11ef64,_0x2909a7){var _0x32652b={},_0x26c535={},_0x5b5535={'count':0x0,'rows':[]};var _0x1649e0=_[_0x6b30('0x26')](db[_0x6b30('0x27')]['rawAttributes'],function(_0x50f2b9){return{'name':_0x50f2b9[_0x6b30('0x28')],'type':_0x50f2b9[_0x6b30('0x29')][_0x6b30('0x2a')]};});_0x26c535[_0x6b30('0x2b')]=_[_0x6b30('0x26')](_0x1649e0,'name');_0x26c535[_0x6b30('0x2c')]=_[_0x6b30('0x2d')](_0x11ef64[_0x6b30('0x2c')]);_0x26c535[_0x6b30('0x2e')]=_[_0x6b30('0x2f')](_0x26c535[_0x6b30('0x2b')],_0x26c535[_0x6b30('0x2c')]);_0x32652b[_0x6b30('0x30')]=_[_0x6b30('0x2f')](_0x26c535[_0x6b30('0x2b')],qs[_0x6b30('0x31')](_0x11ef64['query'][_0x6b30('0x31')]));_0x32652b[_0x6b30('0x30')]=_0x32652b['attributes'][_0x6b30('0x32')]?_0x32652b[_0x6b30('0x30')]:_0x26c535[_0x6b30('0x2b')];if(!_0x11ef64[_0x6b30('0x2c')][_0x6b30('0x33')](_0x6b30('0x34'))){_0x32652b['limit']=qs[_0x6b30('0x1d')](_0x11ef64[_0x6b30('0x2c')][_0x6b30('0x1d')]);_0x32652b[_0x6b30('0x1a')]=qs[_0x6b30('0x1a')](_0x11ef64[_0x6b30('0x2c')]['offset']);}_0x32652b[_0x6b30('0x35')]=qs[_0x6b30('0x36')](_0x11ef64['query']['sort']);_0x32652b[_0x6b30('0x37')]=qs[_0x6b30('0x2e')](_[_0x6b30('0x38')](_0x11ef64[_0x6b30('0x2c')],_0x26c535[_0x6b30('0x2e')]),_0x1649e0);if(_0x11ef64[_0x6b30('0x2c')]['filter']){_0x32652b['where']=_[_0x6b30('0x39')](_0x32652b[_0x6b30('0x37')],{'$or':_[_0x6b30('0x26')](_0x1649e0,function(_0x285a26){if(_0x285a26[_0x6b30('0x29')]!==_0x6b30('0x3a')){var _0x442b49={};_0x442b49[_0x285a26['name']]={'$like':'%'+_0x11ef64['query']['filter']+'%'};return _0x442b49;}})});}_0x32652b=_[_0x6b30('0x39')]({},_0x32652b,_0x11ef64['options']);var _0x5dd7cb={'where':_0x32652b['where']};return db['Dynamics365Configuration']['count'](_0x5dd7cb)['then'](function(_0x43085c){_0x5b5535['count']=_0x43085c;if(_0x11ef64['query']['includeAll']){_0x32652b['include']=[{'all':!![]}];}return db[_0x6b30('0x27')][_0x6b30('0x3b')](_0x32652b);})['then'](function(_0x963a29){_0x5b5535['rows']=_0x963a29;return _0x5b5535;})['then'](respondWithFilteredResult(_0x2909a7,_0x32652b))[_0x6b30('0x3c')](handleError(_0x2909a7,null));};exports[_0x6b30('0x3d')]=function(_0x478b0d,_0x57b040){var _0x425370={'raw':![],'where':{'id':_0x478b0d['params']['id']}},_0x5a6da8={};_0x5a6da8[_0x6b30('0x2b')]=_[_0x6b30('0x2d')](db['Dynamics365Configuration'][_0x6b30('0x3e')]);_0x5a6da8[_0x6b30('0x2c')]=_[_0x6b30('0x2d')](_0x478b0d[_0x6b30('0x2c')]);_0x5a6da8[_0x6b30('0x2e')]=_['intersection'](_0x5a6da8[_0x6b30('0x2b')],_0x5a6da8[_0x6b30('0x2c')]);_0x425370[_0x6b30('0x30')]=_['intersection'](_0x5a6da8[_0x6b30('0x2b')],qs[_0x6b30('0x31')](_0x478b0d[_0x6b30('0x2c')][_0x6b30('0x31')]));_0x425370[_0x6b30('0x30')]=_0x425370[_0x6b30('0x30')][_0x6b30('0x32')]?_0x425370[_0x6b30('0x30')]:_0x5a6da8[_0x6b30('0x2b')];if(_0x478b0d['query'][_0x6b30('0x3f')]){_0x425370[_0x6b30('0x40')]=[{'all':!![]}];}_0x425370=_[_0x6b30('0x39')]({},_0x425370,_0x478b0d[_0x6b30('0x41')]);return db[_0x6b30('0x27')][_0x6b30('0x42')](_0x425370)[_0x6b30('0x22')](handleEntityNotFound(_0x57b040,null))['then'](respondWithResult(_0x57b040,null))['catch'](handleError(_0x57b040,null));};exports[_0x6b30('0x43')]=function(_0x4458d3,_0x3de738){return db[_0x6b30('0x27')][_0x6b30('0x43')](_0x4458d3['body'],{})[_0x6b30('0x22')](respondWithResult(_0x3de738,0xc9))[_0x6b30('0x3c')](handleError(_0x3de738,null));};exports[_0x6b30('0x21')]=function(_0x4e50b9,_0xec0996){if(_0x4e50b9[_0x6b30('0x44')]['id']){delete _0x4e50b9['body']['id'];}return db[_0x6b30('0x27')][_0x6b30('0x42')]({'where':{'id':_0x4e50b9[_0x6b30('0x45')]['id']}})[_0x6b30('0x22')](handleEntityNotFound(_0xec0996,null))['then'](saveUpdates(_0x4e50b9[_0x6b30('0x44')],null))[_0x6b30('0x22')](respondWithResult(_0xec0996,null))['catch'](handleError(_0xec0996,null));};exports[_0x6b30('0x23')]=function(_0x9f1be1,_0x56ba70){return db[_0x6b30('0x27')]['find']({'where':{'id':_0x9f1be1[_0x6b30('0x45')]['id']}})[_0x6b30('0x22')](handleEntityNotFound(_0x56ba70,null))['then'](removeEntity(_0x56ba70,null))[_0x6b30('0x3c')](handleError(_0x56ba70,null));};exports[_0x6b30('0x46')]=function(_0x3a4071,_0x5c8347,_0x1cd027){var _0x40c7d7={};var _0x23eb71={};var _0x2ce727;var _0x272d36;return db[_0x6b30('0x27')]['findOne']({'where':{'id':_0x3a4071[_0x6b30('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c8347,null))[_0x6b30('0x22')](function(_0x1b6ab2){if(_0x1b6ab2){_0x2ce727=_0x1b6ab2;_0x23eb71[_0x6b30('0x2b')]=_[_0x6b30('0x2d')](db[_0x6b30('0x47')][_0x6b30('0x3e')]);_0x23eb71[_0x6b30('0x2c')]=_['keys'](_0x3a4071[_0x6b30('0x2c')]);_0x23eb71[_0x6b30('0x2e')]=_[_0x6b30('0x2f')](_0x23eb71[_0x6b30('0x2b')],_0x23eb71[_0x6b30('0x2c')]);_0x40c7d7[_0x6b30('0x30')]=_[_0x6b30('0x2f')](_0x23eb71[_0x6b30('0x2b')],qs[_0x6b30('0x31')](_0x3a4071[_0x6b30('0x2c')]['fields']));_0x40c7d7[_0x6b30('0x30')]=_0x40c7d7['attributes'][_0x6b30('0x32')]?_0x40c7d7[_0x6b30('0x30')]:_0x23eb71[_0x6b30('0x2b')];_0x40c7d7[_0x6b30('0x35')]=qs[_0x6b30('0x36')](_0x3a4071['query'][_0x6b30('0x36')]);_0x40c7d7[_0x6b30('0x37')]=qs['filters'](_[_0x6b30('0x38')](_0x3a4071[_0x6b30('0x2c')],_0x23eb71[_0x6b30('0x2e')]));if(_0x3a4071[_0x6b30('0x2c')][_0x6b30('0x48')]){_0x40c7d7['where']=_[_0x6b30('0x39')](_0x40c7d7['where'],{'$or':_[_0x6b30('0x26')](_0x40c7d7[_0x6b30('0x30')],function(_0x220a62){var _0x542271={};_0x542271[_0x220a62]={'$like':'%'+_0x3a4071[_0x6b30('0x2c')][_0x6b30('0x48')]+'%'};return _0x542271;})});}_0x40c7d7=_[_0x6b30('0x39')]({},_0x40c7d7,_0x3a4071[_0x6b30('0x41')]);return _0x2ce727['getFields'](_0x40c7d7);}})['then'](function(_0x238501){if(_0x238501){_0x272d36=_0x238501[_0x6b30('0x32')];if(!_0x3a4071[_0x6b30('0x2c')]['hasOwnProperty'](_0x6b30('0x34'))){_0x40c7d7[_0x6b30('0x1d')]=qs[_0x6b30('0x1d')](_0x3a4071[_0x6b30('0x2c')][_0x6b30('0x1d')]);_0x40c7d7[_0x6b30('0x1a')]=qs[_0x6b30('0x1a')](_0x3a4071[_0x6b30('0x2c')][_0x6b30('0x1a')]);}return _0x2ce727[_0x6b30('0x46')](_0x40c7d7);}})['then'](function(_0x5957a6){if(_0x5957a6){return _0x5957a6?{'count':_0x272d36,'rows':_0x5957a6}:null;}})[_0x6b30('0x22')](respondWithResult(_0x5c8347,null))[_0x6b30('0x3c')](handleError(_0x5c8347,null));};exports[_0x6b30('0x49')]=function(_0x5d2747,_0x324258,_0x5b72c4){var _0x55aff6={};var _0x26925a={};var _0x17cc72;var _0x5a40b2;return db[_0x6b30('0x27')][_0x6b30('0x4a')]({'where':{'id':_0x5d2747['params']['id']}})['then'](handleEntityNotFound(_0x324258,null))[_0x6b30('0x22')](function(_0x523344){if(_0x523344){_0x17cc72=_0x523344;_0x26925a[_0x6b30('0x2b')]=_[_0x6b30('0x2d')](db[_0x6b30('0x47')][_0x6b30('0x3e')]);_0x26925a[_0x6b30('0x2c')]=_[_0x6b30('0x2d')](_0x5d2747[_0x6b30('0x2c')]);_0x26925a['filters']=_[_0x6b30('0x2f')](_0x26925a['model'],_0x26925a[_0x6b30('0x2c')]);_0x55aff6[_0x6b30('0x30')]=_[_0x6b30('0x2f')](_0x26925a[_0x6b30('0x2b')],qs['fields'](_0x5d2747[_0x6b30('0x2c')][_0x6b30('0x31')]));_0x55aff6[_0x6b30('0x30')]=_0x55aff6[_0x6b30('0x30')][_0x6b30('0x32')]?_0x55aff6[_0x6b30('0x30')]:_0x26925a['model'];_0x55aff6[_0x6b30('0x35')]=qs[_0x6b30('0x36')](_0x5d2747['query'][_0x6b30('0x36')]);_0x55aff6[_0x6b30('0x37')]=qs[_0x6b30('0x2e')](_['pick'](_0x5d2747[_0x6b30('0x2c')],_0x26925a['filters']));if(_0x5d2747[_0x6b30('0x2c')]['filter']){_0x55aff6[_0x6b30('0x37')]=_[_0x6b30('0x39')](_0x55aff6[_0x6b30('0x37')],{'$or':_[_0x6b30('0x26')](_0x55aff6[_0x6b30('0x30')],function(_0xcf7a16){var _0x1abafe={};_0x1abafe[_0xcf7a16]={'$like':'%'+_0x5d2747['query'][_0x6b30('0x48')]+'%'};return _0x1abafe;})});}_0x55aff6=_[_0x6b30('0x39')]({},_0x55aff6,_0x5d2747[_0x6b30('0x41')]);return _0x17cc72['getSubjects'](_0x55aff6);}})[_0x6b30('0x22')](function(_0x28f095){if(_0x28f095){_0x5a40b2=_0x28f095['length'];if(!_0x5d2747['query'][_0x6b30('0x33')](_0x6b30('0x34'))){_0x55aff6[_0x6b30('0x1d')]=qs[_0x6b30('0x1d')](_0x5d2747[_0x6b30('0x2c')]['limit']);_0x55aff6[_0x6b30('0x1a')]=qs[_0x6b30('0x1a')](_0x5d2747[_0x6b30('0x2c')][_0x6b30('0x1a')]);}return _0x17cc72[_0x6b30('0x49')](_0x55aff6);}})['then'](function(_0x4b76b4){if(_0x4b76b4){return _0x4b76b4?{'count':_0x5a40b2,'rows':_0x4b76b4}:null;}})[_0x6b30('0x22')](respondWithResult(_0x324258,null))[_0x6b30('0x3c')](handleError(_0x324258,null));};exports[_0x6b30('0x4b')]=function(_0x524377,_0x31cdd3,_0x179f54){var _0x3b6b7c={};var _0x3058c2={};var _0x23e31a;var _0xc4fc31;return db[_0x6b30('0x27')][_0x6b30('0x4a')]({'where':{'id':_0x524377[_0x6b30('0x45')]['id']}})['then'](handleEntityNotFound(_0x31cdd3,null))[_0x6b30('0x22')](function(_0x552071){if(_0x552071){_0x23e31a=_0x552071;_0x3058c2[_0x6b30('0x2b')]=_[_0x6b30('0x2d')](db[_0x6b30('0x47')][_0x6b30('0x3e')]);_0x3058c2[_0x6b30('0x2c')]=_['keys'](_0x524377[_0x6b30('0x2c')]);_0x3058c2[_0x6b30('0x2e')]=_[_0x6b30('0x2f')](_0x3058c2[_0x6b30('0x2b')],_0x3058c2[_0x6b30('0x2c')]);_0x3b6b7c[_0x6b30('0x30')]=_['intersection'](_0x3058c2[_0x6b30('0x2b')],qs[_0x6b30('0x31')](_0x524377[_0x6b30('0x2c')][_0x6b30('0x31')]));_0x3b6b7c['attributes']=_0x3b6b7c[_0x6b30('0x30')][_0x6b30('0x32')]?_0x3b6b7c[_0x6b30('0x30')]:_0x3058c2[_0x6b30('0x2b')];_0x3b6b7c[_0x6b30('0x35')]=qs[_0x6b30('0x36')](_0x524377[_0x6b30('0x2c')][_0x6b30('0x36')]);_0x3b6b7c['where']=qs['filters'](_[_0x6b30('0x38')](_0x524377[_0x6b30('0x2c')],_0x3058c2[_0x6b30('0x2e')]));if(_0x524377[_0x6b30('0x2c')][_0x6b30('0x48')]){_0x3b6b7c['where']=_[_0x6b30('0x39')](_0x3b6b7c['where'],{'$or':_[_0x6b30('0x26')](_0x3b6b7c['attributes'],function(_0x269f5e){var _0x9f80f7={};_0x9f80f7[_0x269f5e]={'$like':'%'+_0x524377[_0x6b30('0x2c')][_0x6b30('0x48')]+'%'};return _0x9f80f7;})});}_0x3b6b7c=_[_0x6b30('0x39')]({},_0x3b6b7c,_0x524377[_0x6b30('0x41')]);return _0x23e31a[_0x6b30('0x4b')](_0x3b6b7c);}})[_0x6b30('0x22')](function(_0x2864f1){if(_0x2864f1){_0xc4fc31=_0x2864f1[_0x6b30('0x32')];if(!_0x524377['query'][_0x6b30('0x33')]('nolimit')){_0x3b6b7c[_0x6b30('0x1d')]=qs['limit'](_0x524377['query'][_0x6b30('0x1d')]);_0x3b6b7c['offset']=qs[_0x6b30('0x1a')](_0x524377[_0x6b30('0x2c')][_0x6b30('0x1a')]);}return _0x23e31a[_0x6b30('0x4b')](_0x3b6b7c);}})['then'](function(_0x5ac357){if(_0x5ac357){return _0x5ac357?{'count':_0xc4fc31,'rows':_0x5ac357}:null;}})[_0x6b30('0x22')](respondWithResult(_0x31cdd3,null))['catch'](handleError(_0x31cdd3,null));}; \ No newline at end of file +var _0x9339=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Dynamics365Configuration','include','then','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','Dynamics365Field','order','pick','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy'];(function(_0x1e7e12,_0x586d42){var _0x32781c=function(_0x39ee5b){while(--_0x39ee5b){_0x1e7e12['push'](_0x1e7e12['shift']());}};_0x32781c(++_0x586d42);}(_0x9339,0x128));var _0x9933=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x9339[_0x257642];return _0x3d813b;};'use strict';var emlformat=require(_0x9933('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9933('0x1'));var rp=require(_0x9933('0x2'));var moment=require(_0x9933('0x3'));var BPromise=require(_0x9933('0x4'));var Mustache=require(_0x9933('0x5'));var util=require(_0x9933('0x6'));var path=require(_0x9933('0x7'));var sox=require(_0x9933('0x8'));var csv=require(_0x9933('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9933('0xa'));var _=require('lodash');var squel=require(_0x9933('0xb'));var crypto=require(_0x9933('0xc'));var jsforce=require(_0x9933('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9933('0xe'));var Papa=require(_0x9933('0xf'));var Redis=require(_0x9933('0x10'));var authService=require(_0x9933('0x11'));var qs=require(_0x9933('0x12'));var as=require(_0x9933('0x13'));var hardwareService=require(_0x9933('0x14'));var logger=require(_0x9933('0x15'))(_0x9933('0x16'));var utils=require(_0x9933('0x17'));var config=require(_0x9933('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9933('0x19'))['db'];function respondWithStatusCode(_0x4a736e,_0x36e3a2){_0x36e3a2=_0x36e3a2||0xcc;return function(_0x480293){if(_0x480293){return _0x4a736e[_0x9933('0x1a')](_0x36e3a2);}return _0x4a736e[_0x9933('0x1b')](_0x36e3a2)[_0x9933('0x1c')]();};}function respondWithResult(_0x3e2eb0,_0x4c7567){_0x4c7567=_0x4c7567||0xc8;return function(_0x40333a){if(_0x40333a){return _0x3e2eb0[_0x9933('0x1b')](_0x4c7567)[_0x9933('0x1d')](_0x40333a);}};}function respondWithFilteredResult(_0x3df7e1,_0xde9048){return function(_0x37db34){if(_0x37db34){var _0x96eb07=typeof _0xde9048['offset']==='undefined'&&typeof _0xde9048[_0x9933('0x1e')]===_0x9933('0x1f');var _0x33d11c=_0x37db34[_0x9933('0x20')];var _0x239f19=_0x96eb07?0x0:_0xde9048['offset'];var _0x52f851=_0x96eb07?_0x37db34[_0x9933('0x20')]:_0xde9048[_0x9933('0x21')]+_0xde9048[_0x9933('0x1e')];var _0x1abc24;if(_0x52f851>=_0x33d11c){_0x52f851=_0x33d11c;_0x1abc24=0xc8;}else{_0x1abc24=0xce;}_0x3df7e1['status'](_0x1abc24);return _0x3df7e1[_0x9933('0x22')]('Content-Range',_0x239f19+'-'+_0x52f851+'/'+_0x33d11c)[_0x9933('0x1d')](_0x37db34);}return null;};}function patchUpdates(_0x56dd66){return function(_0x127f46){try{jsonpatch[_0x9933('0x23')](_0x127f46,_0x56dd66,!![]);}catch(_0x5ea7b0){return BPromise[_0x9933('0x24')](_0x5ea7b0);}return _0x127f46[_0x9933('0x25')]();};}function saveUpdates(_0x2cc01f,_0x428f1a){return function(_0x482f98){if(_0x482f98){return _0x482f98[_0x9933('0x26')](_0x2cc01f)['then'](function(_0x23ce29){return _0x23ce29;});}return null;};}function removeEntity(_0x4e350a,_0x487e55){return function(_0x5a23fc){if(_0x5a23fc){return _0x5a23fc[_0x9933('0x27')]()['then'](function(){_0x4e350a[_0x9933('0x1b')](0xcc)[_0x9933('0x1c')]();});}};}function handleEntityNotFound(_0x150c04,_0x11d23d){return function(_0x2e227c){if(!_0x2e227c){_0x150c04[_0x9933('0x1a')](0x194);}return _0x2e227c;};}function handleError(_0x37e260,_0x505118){_0x505118=_0x505118||0x1f4;return function(_0x551d55){logger[_0x9933('0x28')](_0x551d55[_0x9933('0x29')]);if(_0x551d55[_0x9933('0x2a')]){delete _0x551d55['name'];}_0x37e260['status'](_0x505118)[_0x9933('0x2b')](_0x551d55);};}exports[_0x9933('0x2c')]=function(_0x2c16ed,_0x3c287d){var _0x2c9d46={},_0x20e68f={},_0x580c8c={'count':0x0,'rows':[]};var _0x3c988c=_[_0x9933('0x2d')](db['Dynamics365Configuration'][_0x9933('0x2e')],function(_0xae391b){return{'name':_0xae391b[_0x9933('0x2f')],'type':_0xae391b[_0x9933('0x30')][_0x9933('0x31')]};});_0x20e68f[_0x9933('0x32')]=_[_0x9933('0x2d')](_0x3c988c,_0x9933('0x2a'));_0x20e68f[_0x9933('0x33')]=_[_0x9933('0x34')](_0x2c16ed[_0x9933('0x33')]);_0x20e68f[_0x9933('0x35')]=_['intersection'](_0x20e68f[_0x9933('0x32')],_0x20e68f[_0x9933('0x33')]);_0x2c9d46[_0x9933('0x36')]=_[_0x9933('0x37')](_0x20e68f['model'],qs[_0x9933('0x38')](_0x2c16ed[_0x9933('0x33')]['fields']));_0x2c9d46[_0x9933('0x36')]=_0x2c9d46[_0x9933('0x36')][_0x9933('0x39')]?_0x2c9d46[_0x9933('0x36')]:_0x20e68f['model'];if(!_0x2c16ed[_0x9933('0x33')][_0x9933('0x3a')](_0x9933('0x3b'))){_0x2c9d46[_0x9933('0x1e')]=qs[_0x9933('0x1e')](_0x2c16ed['query'][_0x9933('0x1e')]);_0x2c9d46[_0x9933('0x21')]=qs[_0x9933('0x21')](_0x2c16ed[_0x9933('0x33')][_0x9933('0x21')]);}_0x2c9d46['order']=qs[_0x9933('0x3c')](_0x2c16ed[_0x9933('0x33')][_0x9933('0x3c')]);_0x2c9d46[_0x9933('0x3d')]=qs[_0x9933('0x35')](_['pick'](_0x2c16ed[_0x9933('0x33')],_0x20e68f[_0x9933('0x35')]),_0x3c988c);if(_0x2c16ed[_0x9933('0x33')][_0x9933('0x3e')]){_0x2c9d46['where']=_[_0x9933('0x3f')](_0x2c9d46[_0x9933('0x3d')],{'$or':_[_0x9933('0x2d')](_0x3c988c,function(_0x501448){if(_0x501448['type']!==_0x9933('0x40')){var _0x3d3744={};_0x3d3744[_0x501448[_0x9933('0x2a')]]={'$like':'%'+_0x2c16ed[_0x9933('0x33')][_0x9933('0x3e')]+'%'};return _0x3d3744;}})});}_0x2c9d46=_[_0x9933('0x3f')]({},_0x2c9d46,_0x2c16ed[_0x9933('0x41')]);var _0x52068d={'where':_0x2c9d46[_0x9933('0x3d')]};return db[_0x9933('0x42')]['count'](_0x52068d)['then'](function(_0xb914c2){_0x580c8c[_0x9933('0x20')]=_0xb914c2;if(_0x2c16ed['query']['includeAll']){_0x2c9d46[_0x9933('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x2c9d46);})[_0x9933('0x44')](function(_0x500120){_0x580c8c[_0x9933('0x45')]=_0x500120;return _0x580c8c;})[_0x9933('0x44')](respondWithFilteredResult(_0x3c287d,_0x2c9d46))[_0x9933('0x46')](handleError(_0x3c287d,null));};exports[_0x9933('0x47')]=function(_0xc607e9,_0x5d2a4a){var _0x6e250a={'raw':![],'where':{'id':_0xc607e9[_0x9933('0x48')]['id']}},_0x586700={};_0x586700['model']=_[_0x9933('0x34')](db[_0x9933('0x42')][_0x9933('0x2e')]);_0x586700[_0x9933('0x33')]=_['keys'](_0xc607e9[_0x9933('0x33')]);_0x586700[_0x9933('0x35')]=_[_0x9933('0x37')](_0x586700[_0x9933('0x32')],_0x586700[_0x9933('0x33')]);_0x6e250a['attributes']=_[_0x9933('0x37')](_0x586700[_0x9933('0x32')],qs[_0x9933('0x38')](_0xc607e9[_0x9933('0x33')][_0x9933('0x38')]));_0x6e250a[_0x9933('0x36')]=_0x6e250a['attributes']['length']?_0x6e250a[_0x9933('0x36')]:_0x586700[_0x9933('0x32')];if(_0xc607e9[_0x9933('0x33')][_0x9933('0x49')]){_0x6e250a['include']=[{'all':!![]}];}_0x6e250a=_[_0x9933('0x3f')]({},_0x6e250a,_0xc607e9[_0x9933('0x41')]);return db[_0x9933('0x42')][_0x9933('0x4a')](_0x6e250a)[_0x9933('0x44')](handleEntityNotFound(_0x5d2a4a,null))['then'](respondWithResult(_0x5d2a4a,null))[_0x9933('0x46')](handleError(_0x5d2a4a,null));};exports[_0x9933('0x4b')]=function(_0x3c6f97,_0x52852c){return db[_0x9933('0x42')][_0x9933('0x4b')](_0x3c6f97[_0x9933('0x4c')],{})[_0x9933('0x44')](respondWithResult(_0x52852c,0xc9))[_0x9933('0x46')](handleError(_0x52852c,null));};exports[_0x9933('0x26')]=function(_0x580c13,_0x2a3456){if(_0x580c13['body']['id']){delete _0x580c13[_0x9933('0x4c')]['id'];}return db[_0x9933('0x42')][_0x9933('0x4a')]({'where':{'id':_0x580c13[_0x9933('0x48')]['id']}})[_0x9933('0x44')](handleEntityNotFound(_0x2a3456,null))[_0x9933('0x44')](saveUpdates(_0x580c13[_0x9933('0x4c')],null))['then'](respondWithResult(_0x2a3456,null))[_0x9933('0x46')](handleError(_0x2a3456,null));};exports[_0x9933('0x27')]=function(_0x220991,_0x5c13c9){return db['Dynamics365Configuration'][_0x9933('0x4a')]({'where':{'id':_0x220991[_0x9933('0x48')]['id']}})[_0x9933('0x44')](handleEntityNotFound(_0x5c13c9,null))['then'](removeEntity(_0x5c13c9,null))[_0x9933('0x46')](handleError(_0x5c13c9,null));};exports[_0x9933('0x4d')]=function(_0x17013f,_0x25f652,_0x129b38){var _0x52958b={};var _0x55e541={};var _0x2a8b62;var _0x26d92a;return db['Dynamics365Configuration'][_0x9933('0x4e')]({'where':{'id':_0x17013f[_0x9933('0x48')]['id']}})[_0x9933('0x44')](handleEntityNotFound(_0x25f652,null))[_0x9933('0x44')](function(_0x2f816f){if(_0x2f816f){_0x2a8b62=_0x2f816f;_0x55e541[_0x9933('0x32')]=_[_0x9933('0x34')](db[_0x9933('0x4f')][_0x9933('0x2e')]);_0x55e541[_0x9933('0x33')]=_['keys'](_0x17013f[_0x9933('0x33')]);_0x55e541[_0x9933('0x35')]=_[_0x9933('0x37')](_0x55e541[_0x9933('0x32')],_0x55e541['query']);_0x52958b[_0x9933('0x36')]=_['intersection'](_0x55e541[_0x9933('0x32')],qs[_0x9933('0x38')](_0x17013f[_0x9933('0x33')][_0x9933('0x38')]));_0x52958b['attributes']=_0x52958b[_0x9933('0x36')][_0x9933('0x39')]?_0x52958b[_0x9933('0x36')]:_0x55e541[_0x9933('0x32')];_0x52958b[_0x9933('0x50')]=qs['sort'](_0x17013f['query'][_0x9933('0x3c')]);_0x52958b[_0x9933('0x3d')]=qs[_0x9933('0x35')](_[_0x9933('0x51')](_0x17013f[_0x9933('0x33')],_0x55e541['filters']));if(_0x17013f[_0x9933('0x33')][_0x9933('0x3e')]){_0x52958b[_0x9933('0x3d')]=_[_0x9933('0x3f')](_0x52958b[_0x9933('0x3d')],{'$or':_[_0x9933('0x2d')](_0x52958b[_0x9933('0x36')],function(_0xaa9876){var _0x429c45={};_0x429c45[_0xaa9876]={'$like':'%'+_0x17013f['query'][_0x9933('0x3e')]+'%'};return _0x429c45;})});}_0x52958b=_[_0x9933('0x3f')]({},_0x52958b,_0x17013f[_0x9933('0x41')]);return _0x2a8b62[_0x9933('0x4d')](_0x52958b);}})[_0x9933('0x44')](function(_0x5df2f7){if(_0x5df2f7){_0x26d92a=_0x5df2f7['length'];if(!_0x17013f['query'][_0x9933('0x3a')](_0x9933('0x3b'))){_0x52958b[_0x9933('0x1e')]=qs[_0x9933('0x1e')](_0x17013f['query'][_0x9933('0x1e')]);_0x52958b[_0x9933('0x21')]=qs['offset'](_0x17013f[_0x9933('0x33')][_0x9933('0x21')]);}return _0x2a8b62[_0x9933('0x4d')](_0x52958b);}})['then'](function(_0x10620d){if(_0x10620d){return _0x10620d?{'count':_0x26d92a,'rows':_0x10620d}:null;}})['then'](respondWithResult(_0x25f652,null))[_0x9933('0x46')](handleError(_0x25f652,null));};exports[_0x9933('0x52')]=function(_0x495b1a,_0x545478,_0x54855f){var _0x368aa2={};var _0x49337e={};var _0x4099b6;var _0x59a66f;return db['Dynamics365Configuration'][_0x9933('0x4e')]({'where':{'id':_0x495b1a[_0x9933('0x48')]['id']}})[_0x9933('0x44')](handleEntityNotFound(_0x545478,null))[_0x9933('0x44')](function(_0x4e3892){if(_0x4e3892){_0x4099b6=_0x4e3892;_0x49337e[_0x9933('0x32')]=_['keys'](db['Dynamics365Field'][_0x9933('0x2e')]);_0x49337e['query']=_[_0x9933('0x34')](_0x495b1a['query']);_0x49337e['filters']=_[_0x9933('0x37')](_0x49337e[_0x9933('0x32')],_0x49337e[_0x9933('0x33')]);_0x368aa2[_0x9933('0x36')]=_[_0x9933('0x37')](_0x49337e[_0x9933('0x32')],qs[_0x9933('0x38')](_0x495b1a[_0x9933('0x33')][_0x9933('0x38')]));_0x368aa2[_0x9933('0x36')]=_0x368aa2[_0x9933('0x36')][_0x9933('0x39')]?_0x368aa2['attributes']:_0x49337e[_0x9933('0x32')];_0x368aa2[_0x9933('0x50')]=qs[_0x9933('0x3c')](_0x495b1a[_0x9933('0x33')][_0x9933('0x3c')]);_0x368aa2[_0x9933('0x3d')]=qs[_0x9933('0x35')](_[_0x9933('0x51')](_0x495b1a[_0x9933('0x33')],_0x49337e[_0x9933('0x35')]));if(_0x495b1a['query'][_0x9933('0x3e')]){_0x368aa2['where']=_[_0x9933('0x3f')](_0x368aa2[_0x9933('0x3d')],{'$or':_[_0x9933('0x2d')](_0x368aa2[_0x9933('0x36')],function(_0x88339f){var _0x4310dc={};_0x4310dc[_0x88339f]={'$like':'%'+_0x495b1a[_0x9933('0x33')][_0x9933('0x3e')]+'%'};return _0x4310dc;})});}_0x368aa2=_[_0x9933('0x3f')]({},_0x368aa2,_0x495b1a[_0x9933('0x41')]);return _0x4099b6[_0x9933('0x52')](_0x368aa2);}})[_0x9933('0x44')](function(_0x46d0c3){if(_0x46d0c3){_0x59a66f=_0x46d0c3[_0x9933('0x39')];if(!_0x495b1a[_0x9933('0x33')][_0x9933('0x3a')](_0x9933('0x3b'))){_0x368aa2[_0x9933('0x1e')]=qs['limit'](_0x495b1a['query'][_0x9933('0x1e')]);_0x368aa2['offset']=qs[_0x9933('0x21')](_0x495b1a[_0x9933('0x33')][_0x9933('0x21')]);}return _0x4099b6[_0x9933('0x52')](_0x368aa2);}})[_0x9933('0x44')](function(_0x513cbd){if(_0x513cbd){return _0x513cbd?{'count':_0x59a66f,'rows':_0x513cbd}:null;}})['then'](respondWithResult(_0x545478,null))[_0x9933('0x46')](handleError(_0x545478,null));};exports[_0x9933('0x53')]=function(_0x4d268b,_0x392cb4,_0x116c28){var _0x462aa5={};var _0x5b5656={};var _0x258d50;var _0x1fd303;return db[_0x9933('0x42')][_0x9933('0x4e')]({'where':{'id':_0x4d268b['params']['id']}})[_0x9933('0x44')](handleEntityNotFound(_0x392cb4,null))['then'](function(_0x18f2f7){if(_0x18f2f7){_0x258d50=_0x18f2f7;_0x5b5656['model']=_[_0x9933('0x34')](db['Dynamics365Field'][_0x9933('0x2e')]);_0x5b5656['query']=_['keys'](_0x4d268b[_0x9933('0x33')]);_0x5b5656['filters']=_[_0x9933('0x37')](_0x5b5656['model'],_0x5b5656[_0x9933('0x33')]);_0x462aa5[_0x9933('0x36')]=_['intersection'](_0x5b5656[_0x9933('0x32')],qs['fields'](_0x4d268b['query']['fields']));_0x462aa5[_0x9933('0x36')]=_0x462aa5[_0x9933('0x36')][_0x9933('0x39')]?_0x462aa5['attributes']:_0x5b5656[_0x9933('0x32')];_0x462aa5[_0x9933('0x50')]=qs[_0x9933('0x3c')](_0x4d268b['query'][_0x9933('0x3c')]);_0x462aa5[_0x9933('0x3d')]=qs[_0x9933('0x35')](_['pick'](_0x4d268b[_0x9933('0x33')],_0x5b5656[_0x9933('0x35')]));if(_0x4d268b[_0x9933('0x33')][_0x9933('0x3e')]){_0x462aa5[_0x9933('0x3d')]=_['merge'](_0x462aa5[_0x9933('0x3d')],{'$or':_[_0x9933('0x2d')](_0x462aa5[_0x9933('0x36')],function(_0x229474){var _0x283a0a={};_0x283a0a[_0x229474]={'$like':'%'+_0x4d268b['query'][_0x9933('0x3e')]+'%'};return _0x283a0a;})});}_0x462aa5=_['merge']({},_0x462aa5,_0x4d268b[_0x9933('0x41')]);return _0x258d50[_0x9933('0x53')](_0x462aa5);}})[_0x9933('0x44')](function(_0x3a63e2){if(_0x3a63e2){_0x1fd303=_0x3a63e2[_0x9933('0x39')];if(!_0x4d268b[_0x9933('0x33')]['hasOwnProperty'](_0x9933('0x3b'))){_0x462aa5['limit']=qs[_0x9933('0x1e')](_0x4d268b[_0x9933('0x33')]['limit']);_0x462aa5['offset']=qs['offset'](_0x4d268b[_0x9933('0x33')]['offset']);}return _0x258d50[_0x9933('0x53')](_0x462aa5);}})[_0x9933('0x44')](function(_0x411f5b){if(_0x411f5b){return _0x411f5b?{'count':_0x1fd303,'rows':_0x411f5b}:null;}})[_0x9933('0x44')](respondWithResult(_0x392cb4,null))[_0x9933('0x46')](handleError(_0x392cb4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 02a5b18..06d9729 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0xdbce5b,_0x16ca01){var _0x3d4946=function(_0x67726){while(--_0x67726){_0xdbce5b['push'](_0xdbce5b['shift']());}};_0x3d4946(++_0x16ca01);}(_0x9bde,0xe1));var _0xe9bd=function(_0x30b852,_0xe8e99b){_0x30b852=_0x30b852-0x0;var _0x300172=_0x9bde[_0x30b852];return _0x300172;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x19eb3a,_0x3f28c7){var _0x57f785=function(_0x105934){while(--_0x105934){_0x19eb3a['push'](_0x19eb3a['shift']());}};_0x57f785(++_0x3f28c7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x397408,_0x16e98b){_0x397408=_0x397408-0x0;var _0x5a1fd6=_0x9bde[_0x397408];return _0x5a1fd6;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 a51e71b..028fdc8 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 _0x01dc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x289e88,_0xfffa81){var _0x568cbd=function(_0x45f251){while(--_0x45f251){_0x289e88['push'](_0x289e88['shift']());}};_0x568cbd(++_0xfffa81);}(_0x01dc,0x1be));var _0xc01d=function(_0xf30ac2,_0x273d34){_0xf30ac2=_0xf30ac2-0x0;var _0x53c148=_0x01dc[_0xf30ac2];return _0x53c148;};'use strict';var _=require(_0xc01d('0x0'));var util=require(_0xc01d('0x1'));var moment=require(_0xc01d('0x2'));var BPromise=require(_0xc01d('0x3'));var rs=require(_0xc01d('0x4'));var fs=require('fs');var Redis=require(_0xc01d('0x5'));var db=require(_0xc01d('0x6'))['db'];var utils=require(_0xc01d('0x7'));var logger=require(_0xc01d('0x8'))(_0xc01d('0x9'));var config=require(_0xc01d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc01d('0xb')][_0xc01d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13f07d,_0x55f02d,_0x1e145f){return new BPromise(function(_0x5ac596,_0x51efbc){return client[_0xc01d('0xd')](_0x13f07d,_0x1e145f)['then'](function(_0x1757e3){logger[_0xc01d('0xe')](_0xc01d('0xf'),_0x55f02d,_0xc01d('0x10'));logger[_0xc01d('0x11')](_0xc01d('0x12'),_0x55f02d,'request\x20sent',JSON[_0xc01d('0x13')](_0x1757e3));if(_0x1757e3[_0xc01d('0x14')]){if(_0x1757e3[_0xc01d('0x14')][_0xc01d('0x15')]===0x1f4){logger[_0xc01d('0x14')](_0xc01d('0xf'),_0x55f02d,_0x1757e3[_0xc01d('0x14')][_0xc01d('0x16')]);return _0x51efbc(_0x1757e3[_0xc01d('0x14')][_0xc01d('0x16')]);}logger[_0xc01d('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55f02d,_0x1757e3['error']['message']);return _0x5ac596(_0x1757e3[_0xc01d('0x14')][_0xc01d('0x16')]);}else{logger[_0xc01d('0xe')](_0xc01d('0xf'),_0x55f02d,_0xc01d('0x10'));_0x5ac596(_0x1757e3[_0xc01d('0x17')][_0xc01d('0x16')]);}})[_0xc01d('0x18')](function(_0x48b218){logger['error'](_0xc01d('0xf'),_0x55f02d,_0x48b218);_0x51efbc(_0x48b218);});});} \ No newline at end of file +var _0xe98d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x200c7e,_0x2d3fa9){var _0x14b817=function(_0x52f527){while(--_0x52f527){_0x200c7e['push'](_0x200c7e['shift']());}};_0x14b817(++_0x2d3fa9);}(_0xe98d,0xf2));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde98('0x0'));var util=require(_0xde98('0x1'));var moment=require(_0xde98('0x2'));var BPromise=require(_0xde98('0x3'));var rs=require(_0xde98('0x4'));var fs=require('fs');var Redis=require(_0xde98('0x5'));var db=require(_0xde98('0x6'))['db'];var utils=require(_0xde98('0x7'));var logger=require(_0xde98('0x8'))(_0xde98('0x9'));var config=require(_0xde98('0xa'));var jayson=require(_0xde98('0xb'));var client=jayson[_0xde98('0xc')][_0xde98('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f4315,_0x3bc38f,_0x36be30){return new BPromise(function(_0x233473,_0x38eb10){return client[_0xde98('0xe')](_0x4f4315,_0x36be30)[_0xde98('0xf')](function(_0x85848e){logger[_0xde98('0x10')](_0xde98('0x11'),_0x3bc38f,_0xde98('0x12'));logger['debug'](_0xde98('0x13'),_0x3bc38f,_0xde98('0x12'),JSON[_0xde98('0x14')](_0x85848e));if(_0x85848e[_0xde98('0x15')]){if(_0x85848e[_0xde98('0x15')][_0xde98('0x16')]===0x1f4){logger[_0xde98('0x15')](_0xde98('0x11'),_0x3bc38f,_0x85848e[_0xde98('0x15')][_0xde98('0x17')]);return _0x38eb10(_0x85848e['error'][_0xde98('0x17')]);}logger[_0xde98('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3bc38f,_0x85848e[_0xde98('0x15')][_0xde98('0x17')]);return _0x233473(_0x85848e[_0xde98('0x15')][_0xde98('0x17')]);}else{logger['info'](_0xde98('0x11'),_0x3bc38f,_0xde98('0x12'));_0x233473(_0x85848e[_0xde98('0x18')]['message']);}})['catch'](function(_0x2dc024){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3bc38f,_0x2dc024);_0x38eb10(_0x2dc024);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3a15132..4012e44 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 _0xf3e1=['create','put','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d550d,_0x37f4ba){var _0x5d5147=function(_0x17107a){while(--_0x17107a){_0x1d550d['push'](_0x1d550d['shift']());}};_0x5d5147(++_0x37f4ba);}(_0xf3e1,0x1b4));var _0x1f3e=function(_0xb8f65,_0x5b3d4f){_0xb8f65=_0xb8f65-0x0;var _0x537221=_0xf3e1[_0xb8f65];return _0x537221;};'use strict';var multer=require('multer');var util=require(_0x1f3e('0x0'));var path=require('path');var timeout=require(_0x1f3e('0x1'));var express=require(_0x1f3e('0x2'));var router=express[_0x1f3e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f3e('0x4'));var interaction=require(_0x1f3e('0x5'));var config=require(_0x1f3e('0x6'));var controller=require(_0x1f3e('0x7'));router[_0x1f3e('0x8')]('/',auth[_0x1f3e('0x9')](),controller[_0x1f3e('0xa')]);router[_0x1f3e('0x8')](_0x1f3e('0xb'),auth[_0x1f3e('0x9')](),controller[_0x1f3e('0xc')]);router[_0x1f3e('0xd')]('/',auth['isAuthenticated'](),controller[_0x1f3e('0xe')]);router[_0x1f3e('0xf')](_0x1f3e('0xb'),auth[_0x1f3e('0x9')](),controller[_0x1f3e('0x10')]);router['delete'](_0x1f3e('0xb'),auth[_0x1f3e('0x9')](),controller['destroy']);module[_0x1f3e('0x11')]=router; \ No newline at end of file +var _0xbcdf=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0x422eae,_0x2bbd48){var _0x442cca=function(_0x23a141){while(--_0x23a141){_0x422eae['push'](_0x422eae['shift']());}};_0x442cca(++_0x2bbd48);}(_0xbcdf,0x66));var _0xfbcd=function(_0x4ff443,_0x5e1148){_0x4ff443=_0x4ff443-0x0;var _0x12832a=_0xbcdf[_0x4ff443];return _0x12832a;};'use strict';var multer=require('multer');var util=require(_0xfbcd('0x0'));var path=require(_0xfbcd('0x1'));var timeout=require(_0xfbcd('0x2'));var express=require(_0xfbcd('0x3'));var router=express[_0xfbcd('0x4')]();var fs_extra=require(_0xfbcd('0x5'));var auth=require(_0xfbcd('0x6'));var interaction=require(_0xfbcd('0x7'));var config=require(_0xfbcd('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xfbcd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbcd('0x9')]('/:id',auth[_0xfbcd('0xa')](),controller[_0xfbcd('0xb')]);router['post']('/',auth[_0xfbcd('0xa')](),controller[_0xfbcd('0xc')]);router[_0xfbcd('0xd')](_0xfbcd('0xe'),auth[_0xfbcd('0xa')](),controller[_0xfbcd('0xf')]);router[_0xfbcd('0x10')](_0xfbcd('0xe'),auth[_0xfbcd('0xa')](),controller[_0xfbcd('0x11')]);module[_0xfbcd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fb7534d..dbcc26e 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 _0xe28e=['STRING','variable','sequelize','exports','string','customVariable'];(function(_0x52812a,_0x38cc57){var _0x83cfa9=function(_0x596897){while(--_0x596897){_0x52812a['push'](_0x52812a['shift']());}};_0x83cfa9(++_0x38cc57);}(_0xe28e,0x14c));var _0xee28=function(_0x6a4eff,_0x5998c5){_0x6a4eff=_0x6a4eff-0x0;var _0x3354e1=_0xe28e[_0x6a4eff];return _0x3354e1;};'use strict';var Sequelize=require(_0xee28('0x0'));module[_0xee28('0x1')]={'type':{'type':Sequelize['ENUM'](_0xee28('0x2'),'variable',_0xee28('0x3'),'keyValue','picklist'),'defaultValue':_0xee28('0x2')},'content':{'type':Sequelize[_0xee28('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xee28('0x2'),_0xee28('0x5'),_0xee28('0x3'))},'keyContent':{'type':Sequelize[_0xee28('0x4')]},'idField':{'type':Sequelize[_0xee28('0x4')]},'nameField':{'type':Sequelize[_0xee28('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee28('0x4')]}}; \ No newline at end of file +var _0xba6e=['string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize'];(function(_0x4b0e87,_0x51718d){var _0x25abcb=function(_0x591d0e){while(--_0x591d0e){_0x4b0e87['push'](_0x4b0e87['shift']());}};_0x25abcb(++_0x51718d);}(_0xba6e,0x1d3));var _0xeba6=function(_0x293e5f,_0x20c257){_0x293e5f=_0x293e5f-0x0;var _0xa8b271=_0xba6e[_0x293e5f];return _0xa8b271;};'use strict';var Sequelize=require(_0xeba6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xeba6('0x1'),_0xeba6('0x2'),'customVariable',_0xeba6('0x3'),_0xeba6('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeba6('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeba6('0x6')](_0xeba6('0x1'),_0xeba6('0x2'),_0xeba6('0x7'))},'keyContent':{'type':Sequelize[_0xeba6('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xeba6('0x5')]},'customField':{'type':Sequelize[_0xeba6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 53ad5ec..0e905cc 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 _0x9e55=['attributes','fields','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','params','intersection','length','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','model'];(function(_0x5a2ab9,_0x12eaa6){var _0x325ebc=function(_0x576ed6){while(--_0x576ed6){_0x5a2ab9['push'](_0x5a2ab9['shift']());}};_0x325ebc(++_0x12eaa6);}(_0x9e55,0x149));var _0x59e5=function(_0x43366b,_0x3db8f8){_0x43366b=_0x43366b-0x0;var _0x2932aa=_0x9e55[_0x43366b];return _0x2932aa;};'use strict';var emlformat=require(_0x59e5('0x0'));var rimraf=require(_0x59e5('0x1'));var zipdir=require(_0x59e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59e5('0x3'));var moment=require(_0x59e5('0x4'));var BPromise=require(_0x59e5('0x5'));var Mustache=require('mustache');var util=require(_0x59e5('0x6'));var path=require('path');var sox=require(_0x59e5('0x7'));var csv=require(_0x59e5('0x8'));var ejs=require(_0x59e5('0x9'));var fs=require('fs');var fs_extra=require(_0x59e5('0xa'));var _=require(_0x59e5('0xb'));var squel=require('squel');var crypto=require(_0x59e5('0xc'));var jsforce=require(_0x59e5('0xd'));var deskjs=require(_0x59e5('0xe'));var toCsv=require(_0x59e5('0x8'));var querystring=require('querystring');var Papa=require(_0x59e5('0xf'));var Redis=require(_0x59e5('0x10'));var authService=require(_0x59e5('0x11'));var qs=require(_0x59e5('0x12'));var as=require(_0x59e5('0x13'));var hardwareService=require(_0x59e5('0x14'));var logger=require(_0x59e5('0x15'))(_0x59e5('0x16'));var utils=require(_0x59e5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x59e5('0x18'));var db=require(_0x59e5('0x19'))['db'];function respondWithStatusCode(_0x17ac2e,_0x23003d){_0x23003d=_0x23003d||0xcc;return function(_0x5493dd){if(_0x5493dd){return _0x17ac2e[_0x59e5('0x1a')](_0x23003d);}return _0x17ac2e[_0x59e5('0x1b')](_0x23003d)[_0x59e5('0x1c')]();};}function respondWithResult(_0x3d8e19,_0x1de34d){_0x1de34d=_0x1de34d||0xc8;return function(_0x581874){if(_0x581874){return _0x3d8e19[_0x59e5('0x1b')](_0x1de34d)[_0x59e5('0x1d')](_0x581874);}};}function respondWithFilteredResult(_0x576129,_0x5d7b65){return function(_0x38687f){if(_0x38687f){var _0x2daf8d=typeof _0x5d7b65[_0x59e5('0x1e')]===_0x59e5('0x1f')&&typeof _0x5d7b65[_0x59e5('0x20')]===_0x59e5('0x1f');var _0x2c9c56=_0x38687f[_0x59e5('0x21')];var _0x359486=_0x2daf8d?0x0:_0x5d7b65[_0x59e5('0x1e')];var _0x65d22a=_0x2daf8d?_0x38687f[_0x59e5('0x21')]:_0x5d7b65[_0x59e5('0x1e')]+_0x5d7b65[_0x59e5('0x20')];var _0x7316c0;if(_0x65d22a>=_0x2c9c56){_0x65d22a=_0x2c9c56;_0x7316c0=0xc8;}else{_0x7316c0=0xce;}_0x576129[_0x59e5('0x1b')](_0x7316c0);return _0x576129[_0x59e5('0x22')](_0x59e5('0x23'),_0x359486+'-'+_0x65d22a+'/'+_0x2c9c56)[_0x59e5('0x1d')](_0x38687f);}return null;};}function patchUpdates(_0x49202e){return function(_0x528fec){try{jsonpatch[_0x59e5('0x24')](_0x528fec,_0x49202e,!![]);}catch(_0x52ad1d){return BPromise[_0x59e5('0x25')](_0x52ad1d);}return _0x528fec[_0x59e5('0x26')]();};}function saveUpdates(_0x51cc2b,_0x249bff){return function(_0xbe194b){if(_0xbe194b){return _0xbe194b[_0x59e5('0x27')](_0x51cc2b)[_0x59e5('0x28')](function(_0x4cd9c4){return _0x4cd9c4;});}return null;};}function removeEntity(_0xc20a20,_0x358d70){return function(_0x215b9c){if(_0x215b9c){return _0x215b9c[_0x59e5('0x29')]()[_0x59e5('0x28')](function(){_0xc20a20[_0x59e5('0x1b')](0xcc)[_0x59e5('0x1c')]();});}};}function handleEntityNotFound(_0x49a62c,_0x3c2756){return function(_0x1931b9){if(!_0x1931b9){_0x49a62c['sendStatus'](0x194);}return _0x1931b9;};}function handleError(_0x3300b1,_0x552551){_0x552551=_0x552551||0x1f4;return function(_0x5da64e){logger[_0x59e5('0x2a')](_0x5da64e[_0x59e5('0x2b')]);if(_0x5da64e['name']){delete _0x5da64e[_0x59e5('0x2c')];}_0x3300b1[_0x59e5('0x1b')](_0x552551)[_0x59e5('0x2d')](_0x5da64e);};}exports['index']=function(_0xceb3a0,_0x230f03){var _0x28cd22={},_0x536376={},_0x1ae991={'count':0x0,'rows':[]};var _0x120ad3=_[_0x59e5('0x2e')](db[_0x59e5('0x2f')][_0x59e5('0x30')],function(_0xba782e){return{'name':_0xba782e[_0x59e5('0x31')],'type':_0xba782e[_0x59e5('0x32')][_0x59e5('0x33')]};});_0x536376['model']=_[_0x59e5('0x2e')](_0x120ad3,_0x59e5('0x2c'));_0x536376[_0x59e5('0x34')]=_[_0x59e5('0x35')](_0xceb3a0['query']);_0x536376[_0x59e5('0x36')]=_['intersection'](_0x536376[_0x59e5('0x37')],_0x536376[_0x59e5('0x34')]);_0x28cd22[_0x59e5('0x38')]=_['intersection'](_0x536376[_0x59e5('0x37')],qs[_0x59e5('0x39')](_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x39')]));_0x28cd22['attributes']=_0x28cd22['attributes']['length']?_0x28cd22[_0x59e5('0x38')]:_0x536376[_0x59e5('0x37')];if(!_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x3a')]('nolimit')){_0x28cd22[_0x59e5('0x20')]=qs[_0x59e5('0x20')](_0xceb3a0[_0x59e5('0x34')]['limit']);_0x28cd22[_0x59e5('0x1e')]=qs[_0x59e5('0x1e')](_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x1e')]);}_0x28cd22['order']=qs[_0x59e5('0x3b')](_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x3b')]);_0x28cd22['where']=qs[_0x59e5('0x36')](_[_0x59e5('0x3c')](_0xceb3a0[_0x59e5('0x34')],_0x536376[_0x59e5('0x36')]),_0x120ad3);if(_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x3d')]){_0x28cd22['where']=_[_0x59e5('0x3e')](_0x28cd22['where'],{'$or':_[_0x59e5('0x2e')](_0x120ad3,function(_0x237e26){if(_0x237e26[_0x59e5('0x32')]!==_0x59e5('0x3f')){var _0x3f0dfe={};_0x3f0dfe[_0x237e26[_0x59e5('0x2c')]]={'$like':'%'+_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x3d')]+'%'};return _0x3f0dfe;}})});}_0x28cd22=_[_0x59e5('0x3e')]({},_0x28cd22,_0xceb3a0[_0x59e5('0x40')]);var _0x4f9ddd={'where':_0x28cd22[_0x59e5('0x41')]};return db[_0x59e5('0x2f')][_0x59e5('0x21')](_0x4f9ddd)[_0x59e5('0x28')](function(_0x4354e1){_0x1ae991[_0x59e5('0x21')]=_0x4354e1;if(_0xceb3a0[_0x59e5('0x34')][_0x59e5('0x42')]){_0x28cd22['include']=[{'all':!![]}];}return db[_0x59e5('0x2f')][_0x59e5('0x43')](_0x28cd22);})[_0x59e5('0x28')](function(_0x4a9cad){_0x1ae991[_0x59e5('0x44')]=_0x4a9cad;return _0x1ae991;})[_0x59e5('0x28')](respondWithFilteredResult(_0x230f03,_0x28cd22))['catch'](handleError(_0x230f03,null));};exports[_0x59e5('0x45')]=function(_0xc763fc,_0x3ee222){var _0x2ff10e={'raw':!![],'where':{'id':_0xc763fc[_0x59e5('0x46')]['id']}},_0x32c14c={};_0x32c14c[_0x59e5('0x37')]=_['keys'](db['Dynamics365Field'][_0x59e5('0x30')]);_0x32c14c['query']=_[_0x59e5('0x35')](_0xc763fc[_0x59e5('0x34')]);_0x32c14c['filters']=_[_0x59e5('0x47')](_0x32c14c[_0x59e5('0x37')],_0x32c14c[_0x59e5('0x34')]);_0x2ff10e[_0x59e5('0x38')]=_['intersection'](_0x32c14c[_0x59e5('0x37')],qs[_0x59e5('0x39')](_0xc763fc[_0x59e5('0x34')][_0x59e5('0x39')]));_0x2ff10e[_0x59e5('0x38')]=_0x2ff10e[_0x59e5('0x38')][_0x59e5('0x48')]?_0x2ff10e[_0x59e5('0x38')]:_0x32c14c[_0x59e5('0x37')];if(_0xc763fc[_0x59e5('0x34')][_0x59e5('0x42')]){_0x2ff10e['include']=[{'all':!![]}];}_0x2ff10e=_[_0x59e5('0x3e')]({},_0x2ff10e,_0xc763fc['options']);return db[_0x59e5('0x2f')][_0x59e5('0x49')](_0x2ff10e)[_0x59e5('0x28')](handleEntityNotFound(_0x3ee222,null))[_0x59e5('0x28')](respondWithResult(_0x3ee222,null))['catch'](handleError(_0x3ee222,null));};exports[_0x59e5('0x4a')]=function(_0x3079bc,_0x2a5d32){return db[_0x59e5('0x2f')][_0x59e5('0x4a')](_0x3079bc[_0x59e5('0x4b')],{})[_0x59e5('0x28')](respondWithResult(_0x2a5d32,0xc9))[_0x59e5('0x4c')](handleError(_0x2a5d32,null));};exports[_0x59e5('0x27')]=function(_0x34182a,_0x69250){if(_0x34182a[_0x59e5('0x4b')]['id']){delete _0x34182a['body']['id'];}return db[_0x59e5('0x2f')]['find']({'where':{'id':_0x34182a[_0x59e5('0x46')]['id']}})[_0x59e5('0x28')](handleEntityNotFound(_0x69250,null))[_0x59e5('0x28')](saveUpdates(_0x34182a['body'],null))[_0x59e5('0x28')](respondWithResult(_0x69250,null))[_0x59e5('0x4c')](handleError(_0x69250,null));};exports[_0x59e5('0x29')]=function(_0x2fe313,_0x3b9bbc){return db[_0x59e5('0x2f')][_0x59e5('0x49')]({'where':{'id':_0x2fe313[_0x59e5('0x46')]['id']}})[_0x59e5('0x28')](handleEntityNotFound(_0x3b9bbc,null))[_0x59e5('0x28')](removeEntity(_0x3b9bbc,null))[_0x59e5('0x4c')](handleError(_0x3b9bbc,null));}; \ No newline at end of file +var _0xbba7=['map','Dynamics365Field','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x447cf1,_0x219c10){var _0x4860ff=function(_0x3194e4){while(--_0x3194e4){_0x447cf1['push'](_0x447cf1['shift']());}};_0x4860ff(++_0x219c10);}(_0xbba7,0x1a7));var _0x7bba=function(_0x3b048d,_0x450938){_0x3b048d=_0x3b048d-0x0;var _0x31b2d4=_0xbba7[_0x3b048d];return _0x31b2d4;};'use strict';var emlformat=require(_0x7bba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7bba('0x1'));var rp=require(_0x7bba('0x2'));var moment=require(_0x7bba('0x3'));var BPromise=require(_0x7bba('0x4'));var Mustache=require(_0x7bba('0x5'));var util=require(_0x7bba('0x6'));var path=require(_0x7bba('0x7'));var sox=require('sox');var csv=require(_0x7bba('0x8'));var ejs=require(_0x7bba('0x9'));var fs=require('fs');var fs_extra=require(_0x7bba('0xa'));var _=require(_0x7bba('0xb'));var squel=require(_0x7bba('0xc'));var crypto=require(_0x7bba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7bba('0xe'));var toCsv=require(_0x7bba('0x8'));var querystring=require(_0x7bba('0xf'));var Papa=require('papaparse');var Redis=require(_0x7bba('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7bba('0x11'));var as=require(_0x7bba('0x12'));var hardwareService=require(_0x7bba('0x13'));var logger=require(_0x7bba('0x14'))(_0x7bba('0x15'));var utils=require(_0x7bba('0x16'));var config=require(_0x7bba('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bba('0x18'))['db'];function respondWithStatusCode(_0x4c4272,_0x52e9ad){_0x52e9ad=_0x52e9ad||0xcc;return function(_0x44de88){if(_0x44de88){return _0x4c4272[_0x7bba('0x19')](_0x52e9ad);}return _0x4c4272[_0x7bba('0x1a')](_0x52e9ad)[_0x7bba('0x1b')]();};}function respondWithResult(_0x3897db,_0x5a37a3){_0x5a37a3=_0x5a37a3||0xc8;return function(_0x1a42d9){if(_0x1a42d9){return _0x3897db[_0x7bba('0x1a')](_0x5a37a3)[_0x7bba('0x1c')](_0x1a42d9);}};}function respondWithFilteredResult(_0x2ea2b6,_0x4193fc){return function(_0x3f1ab9){if(_0x3f1ab9){var _0x1f8f60=typeof _0x4193fc[_0x7bba('0x1d')]===_0x7bba('0x1e')&&typeof _0x4193fc['limit']===_0x7bba('0x1e');var _0x58bf36=_0x3f1ab9['count'];var _0x4000f8=_0x1f8f60?0x0:_0x4193fc[_0x7bba('0x1d')];var _0x20ebaa=_0x1f8f60?_0x3f1ab9[_0x7bba('0x1f')]:_0x4193fc[_0x7bba('0x1d')]+_0x4193fc[_0x7bba('0x20')];var _0x365ca7;if(_0x20ebaa>=_0x58bf36){_0x20ebaa=_0x58bf36;_0x365ca7=0xc8;}else{_0x365ca7=0xce;}_0x2ea2b6[_0x7bba('0x1a')](_0x365ca7);return _0x2ea2b6[_0x7bba('0x21')](_0x7bba('0x22'),_0x4000f8+'-'+_0x20ebaa+'/'+_0x58bf36)[_0x7bba('0x1c')](_0x3f1ab9);}return null;};}function patchUpdates(_0xb19e45){return function(_0x30c0c9){try{jsonpatch[_0x7bba('0x23')](_0x30c0c9,_0xb19e45,!![]);}catch(_0x56f9bd){return BPromise[_0x7bba('0x24')](_0x56f9bd);}return _0x30c0c9[_0x7bba('0x25')]();};}function saveUpdates(_0x58caeb,_0x3e2467){return function(_0x2e757d){if(_0x2e757d){return _0x2e757d[_0x7bba('0x26')](_0x58caeb)['then'](function(_0x1471aa){return _0x1471aa;});}return null;};}function removeEntity(_0x22e589,_0x368fdb){return function(_0x28b92d){if(_0x28b92d){return _0x28b92d[_0x7bba('0x27')]()[_0x7bba('0x28')](function(){_0x22e589[_0x7bba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b6f5,_0x32c736){return function(_0x372ca0){if(!_0x372ca0){_0x13b6f5[_0x7bba('0x19')](0x194);}return _0x372ca0;};}function handleError(_0x3a51b7,_0x5ba998){_0x5ba998=_0x5ba998||0x1f4;return function(_0x24aa60){logger[_0x7bba('0x29')](_0x24aa60[_0x7bba('0x2a')]);if(_0x24aa60['name']){delete _0x24aa60[_0x7bba('0x2b')];}_0x3a51b7['status'](_0x5ba998)[_0x7bba('0x2c')](_0x24aa60);};}exports['index']=function(_0x36754c,_0x55d67e){var _0x56ad11={},_0x3f8827={},_0x21a28d={'count':0x0,'rows':[]};var _0x217dc6=_[_0x7bba('0x2d')](db[_0x7bba('0x2e')]['rawAttributes'],function(_0x3719f9){return{'name':_0x3719f9[_0x7bba('0x2f')],'type':_0x3719f9[_0x7bba('0x30')][_0x7bba('0x31')]};});_0x3f8827['model']=_[_0x7bba('0x2d')](_0x217dc6,'name');_0x3f8827[_0x7bba('0x32')]=_['keys'](_0x36754c[_0x7bba('0x32')]);_0x3f8827[_0x7bba('0x33')]=_[_0x7bba('0x34')](_0x3f8827[_0x7bba('0x35')],_0x3f8827[_0x7bba('0x32')]);_0x56ad11[_0x7bba('0x36')]=_[_0x7bba('0x34')](_0x3f8827[_0x7bba('0x35')],qs[_0x7bba('0x37')](_0x36754c[_0x7bba('0x32')][_0x7bba('0x37')]));_0x56ad11['attributes']=_0x56ad11[_0x7bba('0x36')][_0x7bba('0x38')]?_0x56ad11[_0x7bba('0x36')]:_0x3f8827[_0x7bba('0x35')];if(!_0x36754c[_0x7bba('0x32')][_0x7bba('0x39')](_0x7bba('0x3a'))){_0x56ad11[_0x7bba('0x20')]=qs[_0x7bba('0x20')](_0x36754c['query'][_0x7bba('0x20')]);_0x56ad11[_0x7bba('0x1d')]=qs[_0x7bba('0x1d')](_0x36754c[_0x7bba('0x32')][_0x7bba('0x1d')]);}_0x56ad11[_0x7bba('0x3b')]=qs[_0x7bba('0x3c')](_0x36754c[_0x7bba('0x32')][_0x7bba('0x3c')]);_0x56ad11['where']=qs[_0x7bba('0x33')](_[_0x7bba('0x3d')](_0x36754c['query'],_0x3f8827[_0x7bba('0x33')]),_0x217dc6);if(_0x36754c[_0x7bba('0x32')][_0x7bba('0x3e')]){_0x56ad11[_0x7bba('0x3f')]=_[_0x7bba('0x40')](_0x56ad11[_0x7bba('0x3f')],{'$or':_[_0x7bba('0x2d')](_0x217dc6,function(_0x168218){if(_0x168218[_0x7bba('0x30')]!=='VIRTUAL'){var _0x498945={};_0x498945[_0x168218[_0x7bba('0x2b')]]={'$like':'%'+_0x36754c['query'][_0x7bba('0x3e')]+'%'};return _0x498945;}})});}_0x56ad11=_['merge']({},_0x56ad11,_0x36754c[_0x7bba('0x41')]);var _0x22ca83={'where':_0x56ad11[_0x7bba('0x3f')]};return db[_0x7bba('0x2e')]['count'](_0x22ca83)[_0x7bba('0x28')](function(_0x102a2b){_0x21a28d[_0x7bba('0x1f')]=_0x102a2b;if(_0x36754c[_0x7bba('0x32')][_0x7bba('0x42')]){_0x56ad11[_0x7bba('0x43')]=[{'all':!![]}];}return db[_0x7bba('0x2e')][_0x7bba('0x44')](_0x56ad11);})[_0x7bba('0x28')](function(_0x7e6c2b){_0x21a28d[_0x7bba('0x45')]=_0x7e6c2b;return _0x21a28d;})[_0x7bba('0x28')](respondWithFilteredResult(_0x55d67e,_0x56ad11))[_0x7bba('0x46')](handleError(_0x55d67e,null));};exports[_0x7bba('0x47')]=function(_0x3c255d,_0x5c5b10){var _0x504092={'raw':!![],'where':{'id':_0x3c255d[_0x7bba('0x48')]['id']}},_0x2c32fa={};_0x2c32fa['model']=_[_0x7bba('0x49')](db['Dynamics365Field'][_0x7bba('0x4a')]);_0x2c32fa['query']=_['keys'](_0x3c255d['query']);_0x2c32fa[_0x7bba('0x33')]=_[_0x7bba('0x34')](_0x2c32fa[_0x7bba('0x35')],_0x2c32fa['query']);_0x504092[_0x7bba('0x36')]=_[_0x7bba('0x34')](_0x2c32fa[_0x7bba('0x35')],qs[_0x7bba('0x37')](_0x3c255d[_0x7bba('0x32')][_0x7bba('0x37')]));_0x504092[_0x7bba('0x36')]=_0x504092['attributes']['length']?_0x504092[_0x7bba('0x36')]:_0x2c32fa[_0x7bba('0x35')];if(_0x3c255d[_0x7bba('0x32')]['includeAll']){_0x504092[_0x7bba('0x43')]=[{'all':!![]}];}_0x504092=_['merge']({},_0x504092,_0x3c255d[_0x7bba('0x41')]);return db[_0x7bba('0x2e')][_0x7bba('0x4b')](_0x504092)['then'](handleEntityNotFound(_0x5c5b10,null))['then'](respondWithResult(_0x5c5b10,null))['catch'](handleError(_0x5c5b10,null));};exports[_0x7bba('0x4c')]=function(_0x89e219,_0x9866c){return db[_0x7bba('0x2e')][_0x7bba('0x4c')](_0x89e219[_0x7bba('0x4d')],{})[_0x7bba('0x28')](respondWithResult(_0x9866c,0xc9))['catch'](handleError(_0x9866c,null));};exports[_0x7bba('0x26')]=function(_0x49f303,_0x276591){if(_0x49f303[_0x7bba('0x4d')]['id']){delete _0x49f303[_0x7bba('0x4d')]['id'];}return db[_0x7bba('0x2e')][_0x7bba('0x4b')]({'where':{'id':_0x49f303[_0x7bba('0x48')]['id']}})['then'](handleEntityNotFound(_0x276591,null))[_0x7bba('0x28')](saveUpdates(_0x49f303['body'],null))[_0x7bba('0x28')](respondWithResult(_0x276591,null))[_0x7bba('0x46')](handleError(_0x276591,null));};exports[_0x7bba('0x27')]=function(_0x56fb6c,_0x34515a){return db[_0x7bba('0x2e')][_0x7bba('0x4b')]({'where':{'id':_0x56fb6c['params']['id']}})[_0x7bba('0x28')](handleEntityNotFound(_0x34515a,null))['then'](removeEntity(_0x34515a,null))[_0x7bba('0x46')](handleError(_0x34515a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8dd5f61..7b3d5d7 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 _0x45c1=['../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','api','moment','request-promise','rimraf'];(function(_0x3a1f53,_0x49d291){var _0x253956=function(_0x915207){while(--_0x915207){_0x3a1f53['push'](_0x3a1f53['shift']());}};_0x253956(++_0x49d291);}(_0x45c1,0x14a));var _0x145c=function(_0x9ccff7,_0x1443d2){_0x9ccff7=_0x9ccff7-0x0;var _0x22af94=_0x45c1[_0x9ccff7];return _0x22af94;};'use strict';var _=require(_0x145c('0x0'));var util=require(_0x145c('0x1'));var logger=require('../../config/logger')(_0x145c('0x2'));var moment=require(_0x145c('0x3'));var BPromise=require('bluebird');var rp=require(_0x145c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x145c('0x5'));var config=require(_0x145c('0x6'));var attributes=require(_0x145c('0x7'));module['exports']=function(_0x5f56ad,_0x3dbc3a){return _0x5f56ad[_0x145c('0x8')](_0x145c('0x9'),attributes,{'tableName':_0x145c('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x145c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c4=['api','moment','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger'];(function(_0x416a91,_0x3008b3){var _0x59552a=function(_0x7dd072){while(--_0x7dd072){_0x416a91['push'](_0x416a91['shift']());}};_0x59552a(++_0x3008b3);}(_0xc3c4,0x1d9));var _0x4c3c=function(_0x2b9b40,_0x379b17){_0x2b9b40=_0x2b9b40-0x0;var _0x273121=_0xc3c4[_0x2b9b40];return _0x273121;};'use strict';var _=require(_0x4c3c('0x0'));var util=require(_0x4c3c('0x1'));var logger=require(_0x4c3c('0x2'))(_0x4c3c('0x3'));var moment=require(_0x4c3c('0x4'));var BPromise=require('bluebird');var rp=require(_0x4c3c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c3c('0x6'));var config=require(_0x4c3c('0x7'));var attributes=require(_0x4c3c('0x8'));module['exports']=function(_0x283af0,_0x52b342){return _0x283af0[_0x4c3c('0x9')](_0x4c3c('0xa'),attributes,{'tableName':_0x4c3c('0xb'),'paranoid':![],'indexes':[{'name':_0x4c3c('0xc'),'fields':[_0x4c3c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index cdb8b3a..e37c21d 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 _0xc1f7=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0xe511fc,_0x5bde75){var _0x452533=function(_0x4bf5c9){while(--_0x4bf5c9){_0xe511fc['push'](_0xe511fc['shift']());}};_0x452533(++_0x5bde75);}(_0xc1f7,0x179));var _0x7c1f=function(_0x3c1c4c,_0x8ecada){_0x3c1c4c=_0x3c1c4c-0x0;var _0x3adc20=_0xc1f7[_0x3c1c4c];return _0x3adc20;};'use strict';var _=require(_0x7c1f('0x0'));var util=require(_0x7c1f('0x1'));var moment=require(_0x7c1f('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c1f('0x3'));var fs=require('fs');var Redis=require(_0x7c1f('0x4'));var db=require(_0x7c1f('0x5'))['db'];var utils=require(_0x7c1f('0x6'));var logger=require(_0x7c1f('0x7'))(_0x7c1f('0x8'));var config=require(_0x7c1f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7c1f('0xa')][_0x7c1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5397ba,_0x820b8f,_0x1ed573){return new BPromise(function(_0xa74616,_0xe32b58){return client[_0x7c1f('0xc')](_0x5397ba,_0x1ed573)['then'](function(_0x1322d7){logger[_0x7c1f('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x820b8f,_0x7c1f('0xe'));logger[_0x7c1f('0xf')](_0x7c1f('0x10'),_0x820b8f,_0x7c1f('0xe'),JSON[_0x7c1f('0x11')](_0x1322d7));if(_0x1322d7[_0x7c1f('0x12')]){if(_0x1322d7[_0x7c1f('0x12')][_0x7c1f('0x13')]===0x1f4){logger[_0x7c1f('0x12')](_0x7c1f('0x14'),_0x820b8f,_0x1322d7[_0x7c1f('0x12')]['message']);return _0xe32b58(_0x1322d7[_0x7c1f('0x12')][_0x7c1f('0x15')]);}logger[_0x7c1f('0x12')](_0x7c1f('0x14'),_0x820b8f,_0x1322d7['error'][_0x7c1f('0x15')]);return _0xa74616(_0x1322d7[_0x7c1f('0x12')][_0x7c1f('0x15')]);}else{logger[_0x7c1f('0xd')](_0x7c1f('0x14'),_0x820b8f,_0x7c1f('0xe'));_0xa74616(_0x1322d7[_0x7c1f('0x16')][_0x7c1f('0x15')]);}})['catch'](function(_0x4c5744){logger[_0x7c1f('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x820b8f,_0x4c5744);_0xe32b58(_0x4c5744);});});} \ No newline at end of file +var _0x86b0=['util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x32bc9f,_0x110665){var _0x3cbc9d=function(_0x52ff7c){while(--_0x52ff7c){_0x32bc9f['push'](_0x32bc9f['shift']());}};_0x3cbc9d(++_0x110665);}(_0x86b0,0x92));var _0x086b=function(_0x489879,_0x2ec824){_0x489879=_0x489879-0x0;var _0x1f4960=_0x86b0[_0x489879];return _0x1f4960;};'use strict';var _=require(_0x086b('0x0'));var util=require(_0x086b('0x1'));var moment=require(_0x086b('0x2'));var BPromise=require(_0x086b('0x3'));var rs=require(_0x086b('0x4'));var fs=require('fs');var Redis=require(_0x086b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x086b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x086b('0x7')][_0x086b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x179f6c,_0x47b6d7,_0x42ed4c){return new BPromise(function(_0x1df4a1,_0x1da3a6){return client[_0x086b('0x9')](_0x179f6c,_0x42ed4c)[_0x086b('0xa')](function(_0x584f1f){logger['info'](_0x086b('0xb'),_0x47b6d7,_0x086b('0xc'));logger[_0x086b('0xd')](_0x086b('0xe'),_0x47b6d7,_0x086b('0xc'),JSON[_0x086b('0xf')](_0x584f1f));if(_0x584f1f[_0x086b('0x10')]){if(_0x584f1f[_0x086b('0x10')][_0x086b('0x11')]===0x1f4){logger['error'](_0x086b('0xb'),_0x47b6d7,_0x584f1f[_0x086b('0x10')][_0x086b('0x12')]);return _0x1da3a6(_0x584f1f[_0x086b('0x10')][_0x086b('0x12')]);}logger[_0x086b('0x10')](_0x086b('0xb'),_0x47b6d7,_0x584f1f['error']['message']);return _0x1df4a1(_0x584f1f[_0x086b('0x10')][_0x086b('0x12')]);}else{logger[_0x086b('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x47b6d7,_0x086b('0xc'));_0x1df4a1(_0x584f1f[_0x086b('0x14')][_0x086b('0x12')]);}})['catch'](function(_0x5463e6){logger[_0x086b('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x47b6d7,_0x5463e6);_0x1da3a6(_0x5463e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5ac63e2..e8e8ea2 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 _0x55f0=['./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x12fdd2,_0x20a11b){var _0x429c5b=function(_0x9e119c){while(--_0x9e119c){_0x12fdd2['push'](_0x12fdd2['shift']());}};_0x429c5b(++_0x20a11b);}(_0x55f0,0x1c6));var _0x055f=function(_0x4ddc7a,_0x5b6cb8){_0x4ddc7a=_0x4ddc7a-0x0;var _0x4547c1=_0x55f0[_0x4ddc7a];return _0x4547c1;};'use strict';var multer=require(_0x055f('0x0'));var util=require(_0x055f('0x1'));var path=require(_0x055f('0x2'));var timeout=require(_0x055f('0x3'));var express=require(_0x055f('0x4'));var router=express['Router']();var fs_extra=require(_0x055f('0x5'));var auth=require(_0x055f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x055f('0x7'));var controller=require(_0x055f('0x8'));router[_0x055f('0x9')]('/',auth[_0x055f('0xa')](),controller[_0x055f('0xb')]);router[_0x055f('0x9')]('/:id',auth[_0x055f('0xa')](),controller[_0x055f('0xc')]);router['get'](_0x055f('0xd'),auth[_0x055f('0xa')](),controller[_0x055f('0xe')]);router[_0x055f('0x9')]('/:id/fields',auth[_0x055f('0xa')](),controller[_0x055f('0xf')]);router[_0x055f('0x10')]('/',auth[_0x055f('0xa')](),controller['create']);router['post'](_0x055f('0xd'),auth[_0x055f('0xa')](),controller['addConfiguration']);router['put'](_0x055f('0x11'),auth[_0x055f('0xa')](),controller[_0x055f('0x12')]);router[_0x055f('0x13')](_0x055f('0x11'),auth[_0x055f('0xa')](),controller[_0x055f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0f89=['create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','post'];(function(_0x1678e9,_0x1e7197){var _0x595cbb=function(_0x188ad5){while(--_0x188ad5){_0x1678e9['push'](_0x1678e9['shift']());}};_0x595cbb(++_0x1e7197);}(_0x0f89,0x1eb));var _0x90f8=function(_0x24a64c,_0x14bba5){_0x24a64c=_0x24a64c-0x0;var _0x3bf411=_0x0f89[_0x24a64c];return _0x3bf411;};'use strict';var multer=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var path=require(_0x90f8('0x2'));var timeout=require(_0x90f8('0x3'));var express=require(_0x90f8('0x4'));var router=express[_0x90f8('0x5')]();var fs_extra=require(_0x90f8('0x6'));var auth=require(_0x90f8('0x7'));var interaction=require(_0x90f8('0x8'));var config=require(_0x90f8('0x9'));var controller=require(_0x90f8('0xa'));router[_0x90f8('0xb')]('/',auth[_0x90f8('0xc')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x90f8('0xd')]);router[_0x90f8('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x90f8('0xb')]('/:id/fields',auth[_0x90f8('0xc')](),controller['getFields']);router[_0x90f8('0xe')]('/',auth[_0x90f8('0xc')](),controller[_0x90f8('0xf')]);router[_0x90f8('0xe')](_0x90f8('0x10'),auth[_0x90f8('0xc')](),controller[_0x90f8('0x11')]);router[_0x90f8('0x12')](_0x90f8('0x13'),auth[_0x90f8('0xc')](),controller[_0x90f8('0x14')]);router['delete']('/:id',auth[_0x90f8('0xc')](),controller[_0x90f8('0x15')]);module[_0x90f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c7dc12d..ccded8c 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 _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x2f5f7b,_0x1ebcee){var _0x39b486=function(_0x55aab){while(--_0x55aab){_0x2f5f7b['push'](_0x2f5f7b['shift']());}};_0x39b486(++_0x1ebcee);}(_0x627e,0x14a));var _0xe627=function(_0x287a7d,_0x352358){_0x287a7d=_0x287a7d-0x0;var _0x4b3a60=_0x627e[_0x287a7d];return _0x4b3a60;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x056b=['username','remoteUri','exports','STRING'];(function(_0x5bff3f,_0x2616c9){var _0x3c11c7=function(_0x5423b4){while(--_0x5423b4){_0x5bff3f['push'](_0x5bff3f['shift']());}};_0x3c11c7(++_0x2616c9);}(_0x056b,0xb6));var _0xb056=function(_0x334aba,_0x370e0c){_0x334aba=_0x334aba-0x0;var _0x4e5e7d=_0x056b[_0x334aba];return _0x4e5e7d;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('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 3c2e568..e26a13f 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 _0xe1aa=['getFields','remoteUri','apiKey','slice','substring','format','%s:X','toString','base64','requester','subject','agent','description','group','source','ticket_type','company','remove','includes','custom_dropdown','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','send','map','FreshdeskAccount','fieldName','type','key','name','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','fields','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe1aa,0xfc));var _0xae1a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe1aa[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xae1a('0x0'));var rimraf=require(_0xae1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae1a('0x2'));var moment=require(_0xae1a('0x3'));var BPromise=require(_0xae1a('0x4'));var Mustache=require(_0xae1a('0x5'));var util=require(_0xae1a('0x6'));var path=require('path');var sox=require(_0xae1a('0x7'));var csv=require('to-csv');var ejs=require(_0xae1a('0x8'));var fs=require('fs');var fs_extra=require(_0xae1a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xae1a('0xa'));var jsforce=require(_0xae1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xae1a('0xc'));var querystring=require(_0xae1a('0xd'));var Papa=require('papaparse');var Redis=require(_0xae1a('0xe'));var authService=require(_0xae1a('0xf'));var qs=require(_0xae1a('0x10'));var as=require(_0xae1a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae1a('0x12'))(_0xae1a('0x13'));var utils=require('../../config/utils');var config=require(_0xae1a('0x14'));var licenseUtil=require(_0xae1a('0x15'));var db=require(_0xae1a('0x16'))['db'];var integrations=require(_0xae1a('0x17'));function respondWithStatusCode(_0x2f55ae,_0x1f6419){_0x1f6419=_0x1f6419||0xcc;return function(_0x352749){if(_0x352749){return _0x2f55ae[_0xae1a('0x18')](_0x1f6419);}return _0x2f55ae[_0xae1a('0x19')](_0x1f6419)[_0xae1a('0x1a')]();};}function respondWithResult(_0x47ce8e,_0x53dc19){_0x53dc19=_0x53dc19||0xc8;return function(_0x580f1c){if(_0x580f1c){return _0x47ce8e['status'](_0x53dc19)[_0xae1a('0x1b')](_0x580f1c);}};}function respondWithFilteredResult(_0x21109c,_0x2eb725){return function(_0x261d1d){if(_0x261d1d){var _0x407778=typeof _0x2eb725['offset']===_0xae1a('0x1c')&&typeof _0x2eb725[_0xae1a('0x1d')]==='undefined';var _0x1e05df=_0x261d1d[_0xae1a('0x1e')];var _0x2e0951=_0x407778?0x0:_0x2eb725[_0xae1a('0x1f')];var _0x1931b9=_0x407778?_0x261d1d[_0xae1a('0x1e')]:_0x2eb725[_0xae1a('0x1f')]+_0x2eb725[_0xae1a('0x1d')];var _0x448961;if(_0x1931b9>=_0x1e05df){_0x1931b9=_0x1e05df;_0x448961=0xc8;}else{_0x448961=0xce;}_0x21109c[_0xae1a('0x19')](_0x448961);return _0x21109c['set'](_0xae1a('0x20'),_0x2e0951+'-'+_0x1931b9+'/'+_0x1e05df)[_0xae1a('0x1b')](_0x261d1d);}return null;};}function patchUpdates(_0x376b61){return function(_0xae6fa5){try{jsonpatch[_0xae1a('0x21')](_0xae6fa5,_0x376b61,!![]);}catch(_0x53fac4){return BPromise[_0xae1a('0x22')](_0x53fac4);}return _0xae6fa5[_0xae1a('0x23')]();};}function saveUpdates(_0x39c190,_0x584fb4){return function(_0x45d15d){if(_0x45d15d){return _0x45d15d[_0xae1a('0x24')](_0x39c190)[_0xae1a('0x25')](function(_0x1ec64c){return _0x1ec64c;});}return null;};}function removeEntity(_0xb3e00d,_0x29a121){return function(_0x5c5b60){if(_0x5c5b60){return _0x5c5b60[_0xae1a('0x26')]()['then'](function(){_0xb3e00d['status'](0xcc)[_0xae1a('0x1a')]();});}};}function handleEntityNotFound(_0x2f13dc,_0x3907c6){return function(_0x22ed5b){if(!_0x22ed5b){_0x2f13dc[_0xae1a('0x18')](0x194);}return _0x22ed5b;};}function handleError(_0x4ecb5b,_0x270e66){_0x270e66=_0x270e66||0x1f4;return function(_0x454142){logger[_0xae1a('0x27')](_0x454142['stack']);if(_0x454142['name']){delete _0x454142['name'];}_0x4ecb5b[_0xae1a('0x19')](_0x270e66)[_0xae1a('0x28')](_0x454142);};}exports['index']=function(_0x5b3d63,_0x1d84f8){var _0x40e32c={},_0x127d6d={},_0x57d2e={'count':0x0,'rows':[]};var _0x29fef2=_[_0xae1a('0x29')](db[_0xae1a('0x2a')]['rawAttributes'],function(_0x5821a7){return{'name':_0x5821a7[_0xae1a('0x2b')],'type':_0x5821a7[_0xae1a('0x2c')][_0xae1a('0x2d')]};});_0x127d6d['model']=_[_0xae1a('0x29')](_0x29fef2,_0xae1a('0x2e'));_0x127d6d[_0xae1a('0x2f')]=_['keys'](_0x5b3d63[_0xae1a('0x2f')]);_0x127d6d[_0xae1a('0x30')]=_['intersection'](_0x127d6d[_0xae1a('0x31')],_0x127d6d[_0xae1a('0x2f')]);_0x40e32c[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x127d6d['model'],qs['fields'](_0x5b3d63['query']['fields']));_0x40e32c[_0xae1a('0x32')]=_0x40e32c['attributes'][_0xae1a('0x34')]?_0x40e32c['attributes']:_0x127d6d['model'];if(!_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x35')](_0xae1a('0x36'))){_0x40e32c['limit']=qs[_0xae1a('0x1d')](_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x1d')]);_0x40e32c[_0xae1a('0x1f')]=qs['offset'](_0x5b3d63['query']['offset']);}_0x40e32c[_0xae1a('0x37')]=qs[_0xae1a('0x38')](_0x5b3d63['query'][_0xae1a('0x38')]);_0x40e32c[_0xae1a('0x39')]=qs[_0xae1a('0x30')](_[_0xae1a('0x3a')](_0x5b3d63['query'],_0x127d6d[_0xae1a('0x30')]),_0x29fef2);if(_0x5b3d63['query'][_0xae1a('0x3b')]){_0x40e32c[_0xae1a('0x39')]=_[_0xae1a('0x3c')](_0x40e32c[_0xae1a('0x39')],{'$or':_[_0xae1a('0x29')](_0x29fef2,function(_0x220423){if(_0x220423[_0xae1a('0x2c')]!=='VIRTUAL'){var _0x416213={};_0x416213[_0x220423[_0xae1a('0x2e')]]={'$like':'%'+_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x3b')]+'%'};return _0x416213;}})});}_0x40e32c=_[_0xae1a('0x3c')]({},_0x40e32c,_0x5b3d63[_0xae1a('0x3d')]);var _0x5c8655={'where':_0x40e32c['where']};return db['FreshdeskAccount'][_0xae1a('0x1e')](_0x5c8655)['then'](function(_0x3eab4b){_0x57d2e[_0xae1a('0x1e')]=_0x3eab4b;if(_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x3e')]){_0x40e32c[_0xae1a('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x40e32c);})[_0xae1a('0x25')](function(_0x47a307){_0x57d2e[_0xae1a('0x40')]=_0x47a307;return _0x57d2e;})[_0xae1a('0x25')](respondWithFilteredResult(_0x1d84f8,_0x40e32c))['catch'](handleError(_0x1d84f8,null));};exports[_0xae1a('0x41')]=function(_0x511aef,_0x5df42a){var _0x26e55b={'raw':![],'where':{'id':_0x511aef[_0xae1a('0x42')]['id']}},_0x4be3fb={};_0x4be3fb['model']=_[_0xae1a('0x43')](db[_0xae1a('0x2a')][_0xae1a('0x44')]);_0x4be3fb[_0xae1a('0x2f')]=_[_0xae1a('0x43')](_0x511aef['query']);_0x4be3fb['filters']=_['intersection'](_0x4be3fb['model'],_0x4be3fb['query']);_0x26e55b[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x4be3fb['model'],qs['fields'](_0x511aef['query'][_0xae1a('0x45')]));_0x26e55b[_0xae1a('0x32')]=_0x26e55b[_0xae1a('0x32')][_0xae1a('0x34')]?_0x26e55b[_0xae1a('0x32')]:_0x4be3fb[_0xae1a('0x31')];if(_0x511aef[_0xae1a('0x2f')][_0xae1a('0x3e')]){_0x26e55b[_0xae1a('0x3f')]=[{'all':!![]}];}_0x26e55b=_[_0xae1a('0x3c')]({},_0x26e55b,_0x511aef[_0xae1a('0x3d')]);return db['FreshdeskAccount'][_0xae1a('0x46')](_0x26e55b)['then'](handleEntityNotFound(_0x5df42a,null))[_0xae1a('0x25')](respondWithResult(_0x5df42a,null))[_0xae1a('0x47')](handleError(_0x5df42a,null));};exports[_0xae1a('0x48')]=function(_0x24017b,_0x1884b){return db[_0xae1a('0x2a')][_0xae1a('0x48')](_0x24017b[_0xae1a('0x49')],{})[_0xae1a('0x25')](respondWithResult(_0x1884b,0xc9))['catch'](handleError(_0x1884b,null));};exports['update']=function(_0x5aceaf,_0x338c05){if(_0x5aceaf[_0xae1a('0x49')]['id']){delete _0x5aceaf['body']['id'];}return db[_0xae1a('0x2a')][_0xae1a('0x46')]({'where':{'id':_0x5aceaf['params']['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x338c05,null))[_0xae1a('0x25')](saveUpdates(_0x5aceaf[_0xae1a('0x49')],null))['then'](respondWithResult(_0x338c05,null))[_0xae1a('0x47')](handleError(_0x338c05,null));};exports['destroy']=function(_0x48a0ed,_0x400fb4){return db[_0xae1a('0x2a')][_0xae1a('0x46')]({'where':{'id':_0x48a0ed[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x400fb4,null))[_0xae1a('0x25')](removeEntity(_0x400fb4,null))['catch'](handleError(_0x400fb4,null));};exports[_0xae1a('0x4a')]=function(_0x11bcfa,_0x161348,_0x2a15e9){var _0x444d4a={};var _0x3d77ac={};var _0x67fe08;var _0x19131b;return db[_0xae1a('0x2a')][_0xae1a('0x4b')]({'where':{'id':_0x11bcfa[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x161348,null))[_0xae1a('0x25')](function(_0x4d057a){if(_0x4d057a){_0x67fe08=_0x4d057a;_0x3d77ac[_0xae1a('0x31')]=_[_0xae1a('0x43')](db[_0xae1a('0x4c')]['rawAttributes']);_0x3d77ac[_0xae1a('0x2f')]=_[_0xae1a('0x43')](_0x11bcfa[_0xae1a('0x2f')]);_0x3d77ac[_0xae1a('0x30')]=_[_0xae1a('0x33')](_0x3d77ac[_0xae1a('0x31')],_0x3d77ac['query']);_0x444d4a[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x3d77ac['model'],qs[_0xae1a('0x45')](_0x11bcfa['query'][_0xae1a('0x45')]));_0x444d4a[_0xae1a('0x32')]=_0x444d4a[_0xae1a('0x32')][_0xae1a('0x34')]?_0x444d4a[_0xae1a('0x32')]:_0x3d77ac[_0xae1a('0x31')];_0x444d4a['order']=qs[_0xae1a('0x38')](_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x38')]);_0x444d4a['where']=qs[_0xae1a('0x30')](_[_0xae1a('0x3a')](_0x11bcfa[_0xae1a('0x2f')],_0x3d77ac[_0xae1a('0x30')]));if(_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x3b')]){_0x444d4a[_0xae1a('0x39')]=_[_0xae1a('0x3c')](_0x444d4a[_0xae1a('0x39')],{'$or':_[_0xae1a('0x29')](_0x444d4a['attributes'],function(_0x1873a5){var _0x10783d={};_0x10783d[_0x1873a5]={'$like':'%'+_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x3b')]+'%'};return _0x10783d;})});}_0x444d4a=_[_0xae1a('0x3c')]({},_0x444d4a,_0x11bcfa[_0xae1a('0x3d')]);return _0x67fe08[_0xae1a('0x4a')](_0x444d4a);}})[_0xae1a('0x25')](function(_0x1c4f02){if(_0x1c4f02){_0x19131b=_0x1c4f02[_0xae1a('0x34')];if(!_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x35')](_0xae1a('0x36'))){_0x444d4a[_0xae1a('0x1d')]=qs[_0xae1a('0x1d')](_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x1d')]);_0x444d4a[_0xae1a('0x1f')]=qs[_0xae1a('0x1f')](_0x11bcfa['query'][_0xae1a('0x1f')]);}return _0x67fe08[_0xae1a('0x4a')](_0x444d4a);}})[_0xae1a('0x25')](function(_0x55f8f5){if(_0x55f8f5){return _0x55f8f5?{'count':_0x19131b,'rows':_0x55f8f5}:null;}})[_0xae1a('0x25')](respondWithResult(_0x161348,null))['catch'](handleError(_0x161348,null));};exports[_0xae1a('0x4d')]=function(_0xfc9e2c,_0x1966ee,_0x42c39f){if(_0xfc9e2c[_0xae1a('0x49')]['id']){delete _0xfc9e2c[_0xae1a('0x49')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xfc9e2c[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x1966ee,null))[_0xae1a('0x25')](function(_0x1af6a4){if(_0x1af6a4){_0xfc9e2c['body'][_0xae1a('0x4e')]=_0x1af6a4['id'];_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x4f')]=integrations[_0xae1a('0x50')](_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x51')],_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x2c')]);_0xfc9e2c['body'][_0xae1a('0x52')]=integrations['getDescriptions'](_0xfc9e2c['body'][_0xae1a('0x51')],_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x2c')]);return db[_0xae1a('0x4c')]['create'](_0xfc9e2c['body'],{'include':[{'model':db[_0xae1a('0x53')],'as':_0xae1a('0x4f')},{'model':db[_0xae1a('0x53')],'as':_0xae1a('0x52')}]});}return null;})['then'](respondWithResult(_0x1966ee,null))[_0xae1a('0x47')](handleError(_0x1966ee,null));};exports[_0xae1a('0x54')]=function(_0x4b6d0c,_0x12aadf,_0x22198a){var _0x4352d5='';return db[_0xae1a('0x2a')][_0xae1a('0x4b')]({'where':{'id':_0x4b6d0c[_0xae1a('0x42')]['id']},'attributes':['id',_0xae1a('0x55'),_0xae1a('0x56')]})[_0xae1a('0x25')](handleEntityNotFound(_0x12aadf,null))[_0xae1a('0x25')](function(_0x52b438){if(_0x52b438){_0x4352d5=_0x52b438[_0xae1a('0x55')];var _0x4d45ff=_0x4352d5[_0xae1a('0x57')](-0x1);if(_0x4d45ff==='/'){_0x4352d5=_0x4352d5[_0xae1a('0x58')](0x0,_0x4352d5['lastIndexOf'](_0x4d45ff));}return rp({'method':'GET','uri':util[_0xae1a('0x59')]('%s/%s',_0x4352d5,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xae1a('0x59')]('Basic\x20%s',new Buffer(util['format'](_0xae1a('0x5a'),_0x52b438[_0xae1a('0x56')]))[_0xae1a('0x5b')](_0xae1a('0x5c')))},'json':!![]});}})[_0xae1a('0x25')](function(_0x42863f){if(_0x42863f){var _0x3c32e0=[_0xae1a('0x5d'),_0xae1a('0x5e'),_0xae1a('0x5f'),_0xae1a('0x60'),_0xae1a('0x19'),'priority',_0xae1a('0x61'),_0xae1a('0x62'),_0xae1a('0x63'),_0xae1a('0x61'),_0xae1a('0x64')];_[_0xae1a('0x65')](_0x42863f,function(_0x4113c9){return _0x3c32e0[_0xae1a('0x66')](_0x4113c9[_0xae1a('0x2e')])||!_0x4113c9['default']&&_0x4113c9[_0xae1a('0x2c')]!=='custom_text'&&_0x4113c9[_0xae1a('0x2c')]!==_0xae1a('0x67');});return{'count':_0x42863f[_0xae1a('0x34')],'rows':_[_0xae1a('0x29')](_0x42863f,function(_0x363eb5){return{'id':_0x363eb5['name'],'name':_0x363eb5[_0xae1a('0x68')],'custom':!_0x363eb5[_0xae1a('0x69')],'options':_0x363eb5[_0xae1a('0x6a')]?_[_0xae1a('0x29')](_0x363eb5[_0xae1a('0x6a')],function(_0x381786){return{'name':_[_0xae1a('0x6b')](_0x381786),'value':_0x381786};}):[]};})};}})['then'](respondWithResult(_0x12aadf,null))[_0xae1a('0x47')](function(_0x3f3b0b){var _0x30017a=_0x4b6d0c[_0xae1a('0x2f')][_0xae1a('0x6c')]?0x1f4:_0x3f3b0b['statusCode']||0x1f4;logger['error'](_0xae1a('0x6d'),_0xae1a('0x54'),_0x30017a,JSON[_0xae1a('0x6e')](_0x3f3b0b));delete _0x3f3b0b[_0xae1a('0x2e')];if(_0x30017a===0x191){_0x30017a=0x190;}_0x12aadf['status'](_0x30017a)[_0xae1a('0x28')](_0x4b6d0c['query'][_0xae1a('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x3f3b0b[_0xae1a('0x6f')]}:_0x3f3b0b);});}; \ No newline at end of file +var _0x4a47=['model','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','getFields','apiKey','remoteUri','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','keys','query','filters'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x4a47,0xb5));var _0x74a4=function(_0x188341,_0x54ba0f){_0x188341=_0x188341-0x0;var _0x2e86cf=_0x4a47[_0x188341];return _0x2e86cf;};'use strict';var emlformat=require(_0x74a4('0x0'));var rimraf=require(_0x74a4('0x1'));var zipdir=require(_0x74a4('0x2'));var jsonpatch=require(_0x74a4('0x3'));var rp=require(_0x74a4('0x4'));var moment=require('moment');var BPromise=require(_0x74a4('0x5'));var Mustache=require('mustache');var util=require(_0x74a4('0x6'));var path=require(_0x74a4('0x7'));var sox=require('sox');var csv=require(_0x74a4('0x8'));var ejs=require(_0x74a4('0x9'));var fs=require('fs');var fs_extra=require(_0x74a4('0xa'));var _=require('lodash');var squel=require(_0x74a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74a4('0x8'));var querystring=require(_0x74a4('0xd'));var Papa=require(_0x74a4('0xe'));var Redis=require(_0x74a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74a4('0x10'));var as=require(_0x74a4('0x11'));var hardwareService=require(_0x74a4('0x12'));var logger=require(_0x74a4('0x13'))('api');var utils=require(_0x74a4('0x14'));var config=require(_0x74a4('0x15'));var licenseUtil=require(_0x74a4('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43ffb8,_0x20eb02){_0x20eb02=_0x20eb02||0xcc;return function(_0x46d788){if(_0x46d788){return _0x43ffb8[_0x74a4('0x17')](_0x20eb02);}return _0x43ffb8[_0x74a4('0x18')](_0x20eb02)[_0x74a4('0x19')]();};}function respondWithResult(_0x391be4,_0x1d6f41){_0x1d6f41=_0x1d6f41||0xc8;return function(_0x39e2b4){if(_0x39e2b4){return _0x391be4[_0x74a4('0x18')](_0x1d6f41)[_0x74a4('0x1a')](_0x39e2b4);}};}function respondWithFilteredResult(_0x28c364,_0xc6796e){return function(_0x3c9fc9){if(_0x3c9fc9){var _0x3d9b8c=typeof _0xc6796e[_0x74a4('0x1b')]==='undefined'&&typeof _0xc6796e[_0x74a4('0x1c')]===_0x74a4('0x1d');var _0x327562=_0x3c9fc9[_0x74a4('0x1e')];var _0x55cf53=_0x3d9b8c?0x0:_0xc6796e[_0x74a4('0x1b')];var _0x105998=_0x3d9b8c?_0x3c9fc9[_0x74a4('0x1e')]:_0xc6796e[_0x74a4('0x1b')]+_0xc6796e['limit'];var _0x1eb6fb;if(_0x105998>=_0x327562){_0x105998=_0x327562;_0x1eb6fb=0xc8;}else{_0x1eb6fb=0xce;}_0x28c364[_0x74a4('0x18')](_0x1eb6fb);return _0x28c364['set'](_0x74a4('0x1f'),_0x55cf53+'-'+_0x105998+'/'+_0x327562)[_0x74a4('0x1a')](_0x3c9fc9);}return null;};}function patchUpdates(_0x5438d2){return function(_0x5d08d9){try{jsonpatch[_0x74a4('0x20')](_0x5d08d9,_0x5438d2,!![]);}catch(_0x3d6464){return BPromise[_0x74a4('0x21')](_0x3d6464);}return _0x5d08d9[_0x74a4('0x22')]();};}function saveUpdates(_0x484802,_0x4139af){return function(_0x506bac){if(_0x506bac){return _0x506bac['update'](_0x484802)[_0x74a4('0x23')](function(_0x404128){return _0x404128;});}return null;};}function removeEntity(_0x2eabd8,_0x5c3362){return function(_0x22f0fa){if(_0x22f0fa){return _0x22f0fa[_0x74a4('0x24')]()['then'](function(){_0x2eabd8[_0x74a4('0x18')](0xcc)[_0x74a4('0x19')]();});}};}function handleEntityNotFound(_0x4f4fc0,_0x12895a){return function(_0x3d9270){if(!_0x3d9270){_0x4f4fc0[_0x74a4('0x17')](0x194);}return _0x3d9270;};}function handleError(_0x54f5ed,_0x408140){_0x408140=_0x408140||0x1f4;return function(_0x23a74c){logger[_0x74a4('0x25')](_0x23a74c[_0x74a4('0x26')]);if(_0x23a74c[_0x74a4('0x27')]){delete _0x23a74c[_0x74a4('0x27')];}_0x54f5ed['status'](_0x408140)['send'](_0x23a74c);};}exports[_0x74a4('0x28')]=function(_0x4fe101,_0x1d252f){var _0x4a4a3d={},_0x446340={},_0x55f21e={'count':0x0,'rows':[]};var _0x5a1dad=_[_0x74a4('0x29')](db[_0x74a4('0x2a')][_0x74a4('0x2b')],function(_0x4b833d){return{'name':_0x4b833d['fieldName'],'type':_0x4b833d['type']['key']};});_0x446340['model']=_['map'](_0x5a1dad,_0x74a4('0x27'));_0x446340['query']=_[_0x74a4('0x2c')](_0x4fe101[_0x74a4('0x2d')]);_0x446340[_0x74a4('0x2e')]=_['intersection'](_0x446340[_0x74a4('0x2f')],_0x446340[_0x74a4('0x2d')]);_0x4a4a3d[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x446340[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x4a4a3d['attributes']=_0x4a4a3d[_0x74a4('0x30')][_0x74a4('0x33')]?_0x4a4a3d['attributes']:_0x446340[_0x74a4('0x2f')];if(!_0x4fe101['query']['hasOwnProperty'](_0x74a4('0x34'))){_0x4a4a3d[_0x74a4('0x1c')]=qs[_0x74a4('0x1c')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1c')]);_0x4a4a3d[_0x74a4('0x1b')]=qs[_0x74a4('0x1b')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1b')]);}_0x4a4a3d['order']=qs[_0x74a4('0x35')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x35')]);_0x4a4a3d[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_['pick'](_0x4fe101[_0x74a4('0x2d')],_0x446340[_0x74a4('0x2e')]),_0x5a1dad);if(_0x4fe101['query'][_0x74a4('0x37')]){_0x4a4a3d[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x4a4a3d[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x5a1dad,function(_0x19c228){if(_0x19c228['type']!==_0x74a4('0x39')){var _0x2a0d4c={};_0x2a0d4c[_0x19c228['name']]={'$like':'%'+_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x37')]+'%'};return _0x2a0d4c;}})});}_0x4a4a3d=_[_0x74a4('0x38')]({},_0x4a4a3d,_0x4fe101[_0x74a4('0x3a')]);var _0x3088e9={'where':_0x4a4a3d['where']};return db[_0x74a4('0x2a')][_0x74a4('0x1e')](_0x3088e9)['then'](function(_0x200a70){_0x55f21e[_0x74a4('0x1e')]=_0x200a70;if(_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x3b')]){_0x4a4a3d['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x74a4('0x3c')](_0x4a4a3d);})['then'](function(_0x4bfa7a){_0x55f21e[_0x74a4('0x3d')]=_0x4bfa7a;return _0x55f21e;})[_0x74a4('0x23')](respondWithFilteredResult(_0x1d252f,_0x4a4a3d))[_0x74a4('0x3e')](handleError(_0x1d252f,null));};exports['show']=function(_0x399c84,_0xf23a8a){var _0x53207c={'raw':![],'where':{'id':_0x399c84[_0x74a4('0x3f')]['id']}},_0x2df134={};_0x2df134[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db['FreshdeskAccount'][_0x74a4('0x2b')]);_0x2df134[_0x74a4('0x2d')]=_['keys'](_0x399c84[_0x74a4('0x2d')]);_0x2df134[_0x74a4('0x2e')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],_0x2df134[_0x74a4('0x2d')]);_0x53207c[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x399c84[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x53207c['attributes']=_0x53207c[_0x74a4('0x30')]['length']?_0x53207c[_0x74a4('0x30')]:_0x2df134[_0x74a4('0x2f')];if(_0x399c84[_0x74a4('0x2d')]['includeAll']){_0x53207c[_0x74a4('0x40')]=[{'all':!![]}];}_0x53207c=_[_0x74a4('0x38')]({},_0x53207c,_0x399c84['options']);return db[_0x74a4('0x2a')][_0x74a4('0x41')](_0x53207c)[_0x74a4('0x23')](handleEntityNotFound(_0xf23a8a,null))[_0x74a4('0x23')](respondWithResult(_0xf23a8a,null))[_0x74a4('0x3e')](handleError(_0xf23a8a,null));};exports['create']=function(_0x49d4d0,_0x4fa783){return db[_0x74a4('0x2a')][_0x74a4('0x42')](_0x49d4d0[_0x74a4('0x43')],{})['then'](respondWithResult(_0x4fa783,0xc9))[_0x74a4('0x3e')](handleError(_0x4fa783,null));};exports[_0x74a4('0x44')]=function(_0x1c0ebf,_0x13697b){if(_0x1c0ebf['body']['id']){delete _0x1c0ebf[_0x74a4('0x43')]['id'];}return db[_0x74a4('0x2a')]['find']({'where':{'id':_0x1c0ebf['params']['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x13697b,null))[_0x74a4('0x23')](saveUpdates(_0x1c0ebf['body'],null))[_0x74a4('0x23')](respondWithResult(_0x13697b,null))[_0x74a4('0x3e')](handleError(_0x13697b,null));};exports['destroy']=function(_0x3fbead,_0x3c8df2){return db[_0x74a4('0x2a')][_0x74a4('0x41')]({'where':{'id':_0x3fbead[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x3c8df2,null))[_0x74a4('0x23')](removeEntity(_0x3c8df2,null))[_0x74a4('0x3e')](handleError(_0x3c8df2,null));};exports[_0x74a4('0x45')]=function(_0x21be32,_0x1a86d3,_0x86d342){var _0x9007b7={};var _0x29891c={};var _0x5d3ead;var _0xf2bbca;return db['FreshdeskAccount'][_0x74a4('0x46')]({'where':{'id':_0x21be32[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x1a86d3,null))[_0x74a4('0x23')](function(_0x7e745e){if(_0x7e745e){_0x5d3ead=_0x7e745e;_0x29891c[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db[_0x74a4('0x47')]['rawAttributes']);_0x29891c[_0x74a4('0x2d')]=_[_0x74a4('0x2c')](_0x21be32['query']);_0x29891c[_0x74a4('0x2e')]=_['intersection'](_0x29891c[_0x74a4('0x2f')],_0x29891c[_0x74a4('0x2d')]);_0x9007b7[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x29891c[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x21be32[_0x74a4('0x2d')]['fields']));_0x9007b7[_0x74a4('0x30')]=_0x9007b7[_0x74a4('0x30')][_0x74a4('0x33')]?_0x9007b7[_0x74a4('0x30')]:_0x29891c[_0x74a4('0x2f')];_0x9007b7['order']=qs['sort'](_0x21be32['query']['sort']);_0x9007b7[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_[_0x74a4('0x48')](_0x21be32[_0x74a4('0x2d')],_0x29891c[_0x74a4('0x2e')]));if(_0x21be32[_0x74a4('0x2d')][_0x74a4('0x37')]){_0x9007b7[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x9007b7[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x9007b7[_0x74a4('0x30')],function(_0x24e1c2){var _0xc27550={};_0xc27550[_0x24e1c2]={'$like':'%'+_0x21be32['query'][_0x74a4('0x37')]+'%'};return _0xc27550;})});}_0x9007b7=_[_0x74a4('0x38')]({},_0x9007b7,_0x21be32['options']);return _0x5d3ead['getConfigurations'](_0x9007b7);}})[_0x74a4('0x23')](function(_0x5afcce){if(_0x5afcce){_0xf2bbca=_0x5afcce[_0x74a4('0x33')];if(!_0x21be32[_0x74a4('0x2d')][_0x74a4('0x49')](_0x74a4('0x34'))){_0x9007b7[_0x74a4('0x1c')]=qs['limit'](_0x21be32['query'][_0x74a4('0x1c')]);_0x9007b7['offset']=qs[_0x74a4('0x1b')](_0x21be32['query'][_0x74a4('0x1b')]);}return _0x5d3ead[_0x74a4('0x45')](_0x9007b7);}})[_0x74a4('0x23')](function(_0x157fbb){if(_0x157fbb){return _0x157fbb?{'count':_0xf2bbca,'rows':_0x157fbb}:null;}})[_0x74a4('0x23')](respondWithResult(_0x1a86d3,null))[_0x74a4('0x3e')](handleError(_0x1a86d3,null));};exports[_0x74a4('0x4a')]=function(_0x443d10,_0x54b89b,_0x562462){if(_0x443d10['body']['id']){delete _0x443d10['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x443d10[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x54b89b,null))[_0x74a4('0x23')](function(_0x4972dd){if(_0x4972dd){_0x443d10[_0x74a4('0x43')][_0x74a4('0x4b')]=_0x4972dd['id'];_0x443d10[_0x74a4('0x43')][_0x74a4('0x4c')]=integrations[_0x74a4('0x4d')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10['body'][_0x74a4('0x4f')]);_0x443d10[_0x74a4('0x43')][_0x74a4('0x50')]=integrations[_0x74a4('0x51')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10[_0x74a4('0x43')]['type']);return db[_0x74a4('0x47')][_0x74a4('0x42')](_0x443d10[_0x74a4('0x43')],{'include':[{'model':db['FreshdeskField'],'as':_0x74a4('0x4c')},{'model':db['FreshdeskField'],'as':_0x74a4('0x50')}]});}return null;})[_0x74a4('0x23')](respondWithResult(_0x54b89b,null))[_0x74a4('0x3e')](handleError(_0x54b89b,null));};exports[_0x74a4('0x52')]=function(_0x42b265,_0x24d2ef,_0x5b3235){var _0x56858b='';return db[_0x74a4('0x2a')][_0x74a4('0x46')]({'where':{'id':_0x42b265[_0x74a4('0x3f')]['id']},'attributes':['id','remoteUri',_0x74a4('0x53')]})[_0x74a4('0x23')](handleEntityNotFound(_0x24d2ef,null))['then'](function(_0x89c771){if(_0x89c771){_0x56858b=_0x89c771[_0x74a4('0x54')];var _0x328f1b=_0x56858b[_0x74a4('0x55')](-0x1);if(_0x328f1b==='/'){_0x56858b=_0x56858b['substring'](0x0,_0x56858b[_0x74a4('0x56')](_0x328f1b));}return rp({'method':_0x74a4('0x57'),'uri':util[_0x74a4('0x58')]('%s/%s',_0x56858b,_0x74a4('0x59')),'headers':{'Authorization':util[_0x74a4('0x58')](_0x74a4('0x5a'),new Buffer(util['format'](_0x74a4('0x5b'),_0x89c771[_0x74a4('0x53')]))[_0x74a4('0x5c')](_0x74a4('0x5d')))},'json':!![]});}})[_0x74a4('0x23')](function(_0x3b2710){if(_0x3b2710){var _0x337cf2=[_0x74a4('0x5e'),_0x74a4('0x5f'),_0x74a4('0x60'),_0x74a4('0x61'),_0x74a4('0x18'),_0x74a4('0x62'),_0x74a4('0x63'),_0x74a4('0x64'),_0x74a4('0x65'),'group','company'];_[_0x74a4('0x66')](_0x3b2710,function(_0xaccd33){return _0x337cf2[_0x74a4('0x67')](_0xaccd33[_0x74a4('0x27')])||!_0xaccd33[_0x74a4('0x68')]&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x69')&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x6a');});return{'count':_0x3b2710[_0x74a4('0x33')],'rows':_['map'](_0x3b2710,function(_0x284105){return{'id':_0x284105['name'],'name':_0x284105[_0x74a4('0x6b')],'custom':!_0x284105['default'],'options':_0x284105[_0x74a4('0x6c')]?_[_0x74a4('0x29')](_0x284105[_0x74a4('0x6c')],function(_0x4ba23e){return{'name':_[_0x74a4('0x6d')](_0x4ba23e),'value':_0x4ba23e};}):[]};})};}})['then'](respondWithResult(_0x24d2ef,null))['catch'](function(_0x1669d9){var _0x5c97a1=_0x42b265[_0x74a4('0x2d')]['test']?0x1f4:_0x1669d9[_0x74a4('0x6e')]||0x1f4;logger[_0x74a4('0x25')](_0x74a4('0x6f'),_0x74a4('0x52'),_0x5c97a1,JSON[_0x74a4('0x70')](_0x1669d9));delete _0x1669d9[_0x74a4('0x27')];if(_0x5c97a1===0x191){_0x5c97a1=0x190;}_0x24d2ef['status'](_0x5c97a1)['send'](_0x42b265[_0x74a4('0x2d')][_0x74a4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1669d9[_0x74a4('0x6e')]}:_0x1669d9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index efd051e..a56bc40 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 _0x09d1=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ec0a1,_0x201efb){var _0x3ca802=function(_0x55fe5f){while(--_0x55fe5f){_0x1ec0a1['push'](_0x1ec0a1['shift']());}};_0x3ca802(++_0x201efb);}(_0x09d1,0x1ce));var _0x109d=function(_0x11d818,_0x448bf9){_0x11d818=_0x11d818-0x0;var _0x56f638=_0x09d1[_0x11d818];return _0x56f638;};'use strict';var _=require(_0x109d('0x0'));var util=require('util');var logger=require(_0x109d('0x1'))(_0x109d('0x2'));var moment=require(_0x109d('0x3'));var BPromise=require(_0x109d('0x4'));var rp=require(_0x109d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x109d('0x6'));var config=require(_0x109d('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x109d('0x8'));module[_0x109d('0x9')]=function(_0x10d7b9,_0xbc9dce){return _0x10d7b9[_0x109d('0xa')](_0x109d('0xb'),attributes,{'tableName':_0x109d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf70e=['path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','api','moment','bluebird'];(function(_0xe67e22,_0x547e07){var _0x39ff12=function(_0x4496d2){while(--_0x4496d2){_0xe67e22['push'](_0xe67e22['shift']());}};_0x39ff12(++_0x547e07);}(_0xf70e,0xc4));var _0xef70=function(_0x5c4504,_0x43bd6d){_0x5c4504=_0x5c4504-0x0;var _0xa9e952=_0xf70e[_0x5c4504];return _0xa9e952;};'use strict';var _=require(_0xef70('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef70('0x1'));var moment=require(_0xef70('0x2'));var BPromise=require(_0xef70('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef70('0x4'));var rimraf=require(_0xef70('0x5'));var config=require('../../config/environment');var attributes=require(_0xef70('0x6'));var integrations=require(_0xef70('0x7'));module[_0xef70('0x8')]=function(_0xa575e0,_0x147f0a){return _0xa575e0['define'](_0xef70('0x9'),attributes,{'tableName':'int_freshdesk_accounts','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 d4edfd9..8ffb908 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 _0xafe6=['map','model','debug','catch','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetFreshdeskAccount','options','raw','where','attributes','limit','include'];(function(_0x41d59b,_0x1c0113){var _0x280a74=function(_0x5b40d9){while(--_0x5b40d9){_0x41d59b['push'](_0x41d59b['shift']());}};_0x280a74(++_0x1c0113);}(_0xafe6,0xac));var _0x6afe=function(_0x1f74c0,_0x1ada2c){_0x1f74c0=_0x1f74c0-0x0;var _0xe0dcde=_0xafe6[_0x1f74c0];return _0xe0dcde;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6afe('0x2'));var fs=require('fs');var Redis=require(_0x6afe('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6afe('0x4'))(_0x6afe('0x5'));var config=require(_0x6afe('0x6'));var jayson=require(_0x6afe('0x7'));var client=jayson[_0x6afe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302747,_0x2fb2c9,_0x59badb){return new BPromise(function(_0x1d3c11,_0x4c4c6f){return client[_0x6afe('0x9')](_0x302747,_0x59badb)[_0x6afe('0xa')](function(_0xd7ebad){logger[_0x6afe('0xb')](_0x6afe('0xc'),_0x2fb2c9,_0x6afe('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2fb2c9,_0x6afe('0xd'),JSON[_0x6afe('0xe')](_0xd7ebad));if(_0xd7ebad['error']){if(_0xd7ebad['error'][_0x6afe('0xf')]===0x1f4){logger[_0x6afe('0x10')](_0x6afe('0xc'),_0x2fb2c9,_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);return _0x4c4c6f(_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);}logger['error'](_0x6afe('0xc'),_0x2fb2c9,_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);return _0x1d3c11(_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);}else{logger[_0x6afe('0xb')](_0x6afe('0xc'),_0x2fb2c9,'request\x20sent');_0x1d3c11(_0xd7ebad[_0x6afe('0x12')]['message']);}})['catch'](function(_0x4296c7){logger[_0x6afe('0x10')](_0x6afe('0xc'),_0x2fb2c9,_0x4296c7);_0x4c4c6f(_0x4296c7);});});}exports[_0x6afe('0x13')]=function(_0x1bc331){var _0x2197c4=this;return new Promise(function(_0x3699e8,_0x1fd5e3){return db['FreshdeskAccount']['findAll']({'raw':_0x1bc331[_0x6afe('0x14')]?_0x1bc331[_0x6afe('0x14')][_0x6afe('0x15')]===undefined?!![]:![]:!![],'where':_0x1bc331['options']?_0x1bc331['options'][_0x6afe('0x16')]||null:null,'attributes':_0x1bc331[_0x6afe('0x14')]?_0x1bc331[_0x6afe('0x14')][_0x6afe('0x17')]||null:null,'limit':_0x1bc331[_0x6afe('0x14')]?_0x1bc331[_0x6afe('0x14')][_0x6afe('0x18')]||null:null,'include':_0x1bc331[_0x6afe('0x14')]?_0x1bc331[_0x6afe('0x14')][_0x6afe('0x19')]?_[_0x6afe('0x1a')](_0x1bc331[_0x6afe('0x14')][_0x6afe('0x19')],function(_0x23fc00){return{'model':db[_0x23fc00[_0x6afe('0x1b')]],'as':_0x23fc00['as'],'attributes':_0x23fc00['attributes'],'include':_0x23fc00['include']?_[_0x6afe('0x1a')](_0x23fc00['include'],function(_0x4b0399){return{'model':db[_0x4b0399[_0x6afe('0x1b')]],'as':_0x4b0399['as'],'attributes':_0x4b0399[_0x6afe('0x17')],'include':_0x4b0399[_0x6afe('0x19')]?_[_0x6afe('0x1a')](_0x4b0399[_0x6afe('0x19')],function(_0x3bb392){return{'model':db[_0x3bb392[_0x6afe('0x1b')]],'as':_0x3bb392['as'],'attributes':_0x3bb392[_0x6afe('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6afe('0xa')](function(_0x2c6ac3){logger[_0x6afe('0xb')](_0x6afe('0x13'),_0x1bc331);logger[_0x6afe('0x1c')]('GetFreshdeskAccount',_0x1bc331,JSON[_0x6afe('0xe')](_0x2c6ac3));_0x3699e8(_0x2c6ac3);})[_0x6afe('0x1d')](function(_0x17e5d5){logger['error'](_0x6afe('0x13'),_0x17e5d5['message'],_0x1bc331);_0x1fd5e3(_0x2197c4[_0x6afe('0x10')](0x1f4,_0x17e5d5[_0x6afe('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x5ac797){var _0x14af12=this;return new Promise(function(_0x613477,_0xe6f98f){return db[_0x6afe('0x1e')][_0x6afe('0x1f')]({'raw':_0x5ac797[_0x6afe('0x14')]?_0x5ac797[_0x6afe('0x14')][_0x6afe('0x15')]===undefined?!![]:![]:!![],'where':_0x5ac797[_0x6afe('0x14')]?_0x5ac797[_0x6afe('0x14')][_0x6afe('0x16')]||null:null,'attributes':_0x5ac797[_0x6afe('0x14')]?_0x5ac797[_0x6afe('0x14')][_0x6afe('0x17')]||null:null,'include':_0x5ac797[_0x6afe('0x14')]?_0x5ac797[_0x6afe('0x14')][_0x6afe('0x19')]?_[_0x6afe('0x1a')](_0x5ac797[_0x6afe('0x14')][_0x6afe('0x19')],function(_0x477294){return{'model':db[_0x477294['model']],'as':_0x477294['as'],'attributes':_0x477294['attributes'],'include':_0x477294[_0x6afe('0x19')]?_[_0x6afe('0x1a')](_0x477294[_0x6afe('0x19')],function(_0x61a544){return{'model':db[_0x61a544[_0x6afe('0x1b')]],'as':_0x61a544['as'],'attributes':_0x61a544['attributes'],'include':_0x61a544[_0x6afe('0x19')]?_['map'](_0x61a544['include'],function(_0x4462ce){return{'model':db[_0x4462ce[_0x6afe('0x1b')]],'as':_0x4462ce['as'],'attributes':_0x4462ce[_0x6afe('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6afe('0xa')](function(_0x5954df){logger['info'](_0x6afe('0x20'),_0x5ac797);logger[_0x6afe('0x1c')](_0x6afe('0x20'),_0x5ac797,JSON['stringify'](_0x5954df));_0x613477(_0x5954df);})[_0x6afe('0x1d')](function(_0xb89100){logger[_0x6afe('0x10')](_0x6afe('0x20'),_0xb89100[_0x6afe('0x11')],_0x5ac797);_0xe6f98f(_0x14af12[_0x6afe('0x10')](0x1f4,_0xb89100[_0x6afe('0x11')]));});});}; \ No newline at end of file +var _0xe7f2=['FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','then','debug','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3f9d90,_0x3dc68f){var _0x3c73c8=function(_0x477960){while(--_0x477960){_0x3f9d90['push'](_0x3f9d90['shift']());}};_0x3c73c8(++_0x3dc68f);}(_0xe7f2,0x10e));var _0x2e7f=function(_0x29090c,_0x1dce06){_0x29090c=_0x29090c-0x0;var _0x269e06=_0xe7f2[_0x29090c];return _0x269e06;};'use strict';var _=require(_0x2e7f('0x0'));var util=require(_0x2e7f('0x1'));var moment=require(_0x2e7f('0x2'));var BPromise=require(_0x2e7f('0x3'));var rs=require(_0x2e7f('0x4'));var fs=require('fs');var Redis=require(_0x2e7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e7f('0x6'));var logger=require(_0x2e7f('0x7'))('rpc');var config=require(_0x2e7f('0x8'));var jayson=require(_0x2e7f('0x9'));var client=jayson[_0x2e7f('0xa')][_0x2e7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab511,_0x28c64c,_0x4dc2b0){return new BPromise(function(_0x11c9a7,_0x477ffe){return client['request'](_0x5ab511,_0x4dc2b0)['then'](function(_0x371fb6){logger[_0x2e7f('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x28c64c,'request\x20sent');logger['debug'](_0x2e7f('0xd'),_0x28c64c,_0x2e7f('0xe'),JSON[_0x2e7f('0xf')](_0x371fb6));if(_0x371fb6[_0x2e7f('0x10')]){if(_0x371fb6[_0x2e7f('0x10')][_0x2e7f('0x11')]===0x1f4){logger[_0x2e7f('0x10')](_0x2e7f('0x12'),_0x28c64c,_0x371fb6[_0x2e7f('0x10')]['message']);return _0x477ffe(_0x371fb6[_0x2e7f('0x10')]['message']);}logger[_0x2e7f('0x10')](_0x2e7f('0x12'),_0x28c64c,_0x371fb6['error']['message']);return _0x11c9a7(_0x371fb6[_0x2e7f('0x10')][_0x2e7f('0x13')]);}else{logger[_0x2e7f('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x28c64c,_0x2e7f('0xe'));_0x11c9a7(_0x371fb6[_0x2e7f('0x14')][_0x2e7f('0x13')]);}})['catch'](function(_0x5cea5c){logger[_0x2e7f('0x10')](_0x2e7f('0x12'),_0x28c64c,_0x5cea5c);_0x477ffe(_0x5cea5c);});});}exports[_0x2e7f('0x15')]=function(_0x4cc1ea){var _0x4183fb=this;return new Promise(function(_0x480467,_0x16c466){return db[_0x2e7f('0x16')][_0x2e7f('0x17')]({'raw':_0x4cc1ea['options']?_0x4cc1ea[_0x2e7f('0x18')][_0x2e7f('0x19')]===undefined?!![]:![]:!![],'where':_0x4cc1ea['options']?_0x4cc1ea[_0x2e7f('0x18')][_0x2e7f('0x1a')]||null:null,'attributes':_0x4cc1ea[_0x2e7f('0x18')]?_0x4cc1ea['options'][_0x2e7f('0x1b')]||null:null,'limit':_0x4cc1ea['options']?_0x4cc1ea['options']['limit']||null:null,'include':_0x4cc1ea[_0x2e7f('0x18')]?_0x4cc1ea[_0x2e7f('0x18')][_0x2e7f('0x1c')]?_[_0x2e7f('0x1d')](_0x4cc1ea['options'][_0x2e7f('0x1c')],function(_0x4aec93){return{'model':db[_0x4aec93[_0x2e7f('0x1e')]],'as':_0x4aec93['as'],'attributes':_0x4aec93['attributes'],'include':_0x4aec93[_0x2e7f('0x1c')]?_[_0x2e7f('0x1d')](_0x4aec93['include'],function(_0x4e6eeb){return{'model':db[_0x4e6eeb['model']],'as':_0x4e6eeb['as'],'attributes':_0x4e6eeb['attributes'],'include':_0x4e6eeb['include']?_[_0x2e7f('0x1d')](_0x4e6eeb[_0x2e7f('0x1c')],function(_0x495bc5){return{'model':db[_0x495bc5[_0x2e7f('0x1e')]],'as':_0x495bc5['as'],'attributes':_0x495bc5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e7f('0x1f')](function(_0x4672b1){logger[_0x2e7f('0xc')](_0x2e7f('0x15'),_0x4cc1ea);logger[_0x2e7f('0x20')](_0x2e7f('0x15'),_0x4cc1ea,JSON['stringify'](_0x4672b1));_0x480467(_0x4672b1);})[_0x2e7f('0x21')](function(_0x123acd){logger['error'](_0x2e7f('0x15'),_0x123acd['message'],_0x4cc1ea);_0x16c466(_0x4183fb[_0x2e7f('0x10')](0x1f4,_0x123acd[_0x2e7f('0x13')]));});});};exports[_0x2e7f('0x22')]=function(_0x1eb37a){var _0x397053=this;return new Promise(function(_0xa9e635,_0xd37e0c){return db['FreshdeskAccount'][_0x2e7f('0x23')]({'raw':_0x1eb37a['options']?_0x1eb37a[_0x2e7f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb37a[_0x2e7f('0x18')]?_0x1eb37a[_0x2e7f('0x18')]['where']||null:null,'attributes':_0x1eb37a[_0x2e7f('0x18')]?_0x1eb37a[_0x2e7f('0x18')][_0x2e7f('0x1b')]||null:null,'include':_0x1eb37a[_0x2e7f('0x18')]?_0x1eb37a[_0x2e7f('0x18')][_0x2e7f('0x1c')]?_[_0x2e7f('0x1d')](_0x1eb37a[_0x2e7f('0x18')][_0x2e7f('0x1c')],function(_0xa8bf10){return{'model':db[_0xa8bf10[_0x2e7f('0x1e')]],'as':_0xa8bf10['as'],'attributes':_0xa8bf10[_0x2e7f('0x1b')],'include':_0xa8bf10[_0x2e7f('0x1c')]?_[_0x2e7f('0x1d')](_0xa8bf10[_0x2e7f('0x1c')],function(_0x30cd18){return{'model':db[_0x30cd18[_0x2e7f('0x1e')]],'as':_0x30cd18['as'],'attributes':_0x30cd18['attributes'],'include':_0x30cd18[_0x2e7f('0x1c')]?_['map'](_0x30cd18['include'],function(_0x286302){return{'model':db[_0x286302[_0x2e7f('0x1e')]],'as':_0x286302['as'],'attributes':_0x286302[_0x2e7f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44cc8c){logger[_0x2e7f('0xc')](_0x2e7f('0x22'),_0x1eb37a);logger[_0x2e7f('0x20')](_0x2e7f('0x22'),_0x1eb37a,JSON['stringify'](_0x44cc8c));_0xa9e635(_0x44cc8c);})['catch'](function(_0x56a7c9){logger[_0x2e7f('0x10')](_0x2e7f('0x22'),_0x56a7c9[_0x2e7f('0x13')],_0x1eb37a);_0xd37e0c(_0x397053['error'](0x1f4,_0x56a7c9[_0x2e7f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 88f1f88..3090b14 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 _0x0b23=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5dcbfb,_0x4997c2){var _0x1a1bb4=function(_0x446ed3){while(--_0x446ed3){_0x5dcbfb['push'](_0x5dcbfb['shift']());}};_0x1a1bb4(++_0x4997c2);}(_0x0b23,0x10f));var _0x30b2=function(_0x1caabb,_0x5ce7ef){_0x1caabb=_0x1caabb-0x0;var _0x1243f6=_0x0b23[_0x1caabb];return _0x1243f6;};'use strict';var multer=require(_0x30b2('0x0'));var util=require(_0x30b2('0x1'));var path=require(_0x30b2('0x2'));var timeout=require(_0x30b2('0x3'));var express=require(_0x30b2('0x4'));var router=express[_0x30b2('0x5')]();var fs_extra=require(_0x30b2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30b2('0x7'));var config=require(_0x30b2('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x30b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x30b2('0x9')](_0x30b2('0xa'),auth[_0x30b2('0xb')](),controller[_0x30b2('0xc')]);router[_0x30b2('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x30b2('0x9')]('/:id/subjects',auth[_0x30b2('0xb')](),controller['getSubjects']);router[_0x30b2('0x9')]('/:id/descriptions',auth[_0x30b2('0xb')](),controller[_0x30b2('0xd')]);router[_0x30b2('0x9')](_0x30b2('0xe'),auth['isAuthenticated'](),controller[_0x30b2('0xf')]);router[_0x30b2('0x10')]('/',auth[_0x30b2('0xb')](),controller[_0x30b2('0x11')]);router[_0x30b2('0x10')](_0x30b2('0xe'),auth[_0x30b2('0xb')](),controller[_0x30b2('0x12')]);router['put'](_0x30b2('0xa'),auth[_0x30b2('0xb')](),controller[_0x30b2('0x13')]);router[_0x30b2('0x14')]('/:id',auth[_0x30b2('0xb')](),controller[_0x30b2('0x15')]);module[_0x30b2('0x16')]=router; \ No newline at end of file +var _0x3096=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3e454d,_0x2cc78a){var _0x183aed=function(_0x1a241d){while(--_0x1a241d){_0x3e454d['push'](_0x3e454d['shift']());}};_0x183aed(++_0x2cc78a);}(_0x3096,0x14f));var _0x6309=function(_0x33655c,_0x504e6c){_0x33655c=_0x33655c-0x0;var _0x59245f=_0x3096[_0x33655c];return _0x59245f;};'use strict';var multer=require(_0x6309('0x0'));var util=require(_0x6309('0x1'));var path=require(_0x6309('0x2'));var timeout=require(_0x6309('0x3'));var express=require(_0x6309('0x4'));var router=express[_0x6309('0x5')]();var fs_extra=require(_0x6309('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6309('0x7'));var config=require(_0x6309('0x8'));var controller=require(_0x6309('0x9'));router[_0x6309('0xa')]('/',auth[_0x6309('0xb')](),controller[_0x6309('0xc')]);router['get'](_0x6309('0xd'),auth[_0x6309('0xb')](),controller[_0x6309('0xe')]);router['get'](_0x6309('0xf'),auth[_0x6309('0xb')](),controller[_0x6309('0x10')]);router[_0x6309('0xa')](_0x6309('0x11'),auth[_0x6309('0xb')](),controller[_0x6309('0x12')]);router[_0x6309('0xa')](_0x6309('0x13'),auth[_0x6309('0xb')](),controller[_0x6309('0x14')]);router['get'](_0x6309('0x15'),auth[_0x6309('0xb')](),controller[_0x6309('0x16')]);router[_0x6309('0x17')]('/',auth[_0x6309('0xb')](),controller[_0x6309('0x18')]);router[_0x6309('0x17')](_0x6309('0x15'),auth[_0x6309('0xb')](),controller[_0x6309('0x19')]);router[_0x6309('0x1a')](_0x6309('0xd'),auth[_0x6309('0xb')](),controller[_0x6309('0x1b')]);router[_0x6309('0x1c')]('/:id',auth[_0x6309('0xb')](),controller[_0x6309('0x1d')]);module[_0x6309('0x1e')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1590173..17aca38 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 _0xabd7=['sequelize','STRING'];(function(_0x51e59e,_0x266819){var _0x5ad1ee=function(_0x1a4fb0){while(--_0x1a4fb0){_0x51e59e['push'](_0x51e59e['shift']());}};_0x5ad1ee(++_0x266819);}(_0xabd7,0x94));var _0x7abd=function(_0x263ea1,_0x22aefd){_0x263ea1=_0x263ea1-0x0;var _0x397316=_0xabd7[_0x263ea1];return _0x397316;};'use strict';var Sequelize=require(_0x7abd('0x0'));module['exports']={'name':{'type':Sequelize[_0x7abd('0x1')]},'description':{'type':Sequelize[_0x7abd('0x1')]}}; \ No newline at end of file +var _0x1f0c=['sequelize','exports','STRING'];(function(_0x937303,_0x456ac5){var _0x33bf98=function(_0xf1f11b){while(--_0xf1f11b){_0x937303['push'](_0x937303['shift']());}};_0x33bf98(++_0x456ac5);}(_0x1f0c,0x1e9));var _0xc1f0=function(_0x21dd0f,_0x3e6c36){_0x21dd0f=_0x21dd0f-0x0;var _0x4002bb=_0x1f0c[_0x21dd0f];return _0x4002bb;};'use strict';var Sequelize=require(_0xc1f0('0x0'));module[_0xc1f0('0x1')]={'name':{'type':Sequelize[_0xc1f0('0x2')]},'description':{'type':Sequelize[_0xc1f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index bff9d99..a1fd468 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 _0x6b8a=['length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','create','body','find','FreshdeskField','getFields','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','destroy','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields'];(function(_0x5b1904,_0x2c79b4){var _0x3bd288=function(_0x5e413b){while(--_0x5e413b){_0x5b1904['push'](_0x5b1904['shift']());}};_0x3bd288(++_0x2c79b4);}(_0x6b8a,0xc9));var _0xa6b8=function(_0x4316ef,_0x422eee){_0x4316ef=_0x4316ef-0x0;var _0x4e9cf9=_0x6b8a[_0x4316ef];return _0x4e9cf9;};'use strict';var emlformat=require(_0xa6b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6b8('0x1'));var jsonpatch=require(_0xa6b8('0x2'));var rp=require(_0xa6b8('0x3'));var moment=require('moment');var BPromise=require(_0xa6b8('0x4'));var Mustache=require(_0xa6b8('0x5'));var util=require(_0xa6b8('0x6'));var path=require(_0xa6b8('0x7'));var sox=require(_0xa6b8('0x8'));var csv=require(_0xa6b8('0x9'));var ejs=require(_0xa6b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6b8('0xb'));var squel=require(_0xa6b8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6b8('0xd'));var toCsv=require(_0xa6b8('0x9'));var querystring=require(_0xa6b8('0xe'));var Papa=require(_0xa6b8('0xf'));var Redis=require(_0xa6b8('0x10'));var authService=require(_0xa6b8('0x11'));var qs=require(_0xa6b8('0x12'));var as=require(_0xa6b8('0x13'));var hardwareService=require(_0xa6b8('0x14'));var logger=require(_0xa6b8('0x15'))(_0xa6b8('0x16'));var utils=require(_0xa6b8('0x17'));var config=require(_0xa6b8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fbd46,_0x1accd5){_0x1accd5=_0x1accd5||0xcc;return function(_0x1a0ae5){if(_0x1a0ae5){return _0x4fbd46['sendStatus'](_0x1accd5);}return _0x4fbd46['status'](_0x1accd5)[_0xa6b8('0x19')]();};}function respondWithResult(_0x40c19b,_0x18b5ad){_0x18b5ad=_0x18b5ad||0xc8;return function(_0xcf71b6){if(_0xcf71b6){return _0x40c19b['status'](_0x18b5ad)[_0xa6b8('0x1a')](_0xcf71b6);}};}function respondWithFilteredResult(_0x574169,_0x12f2a2){return function(_0x1f4403){if(_0x1f4403){var _0x2f3a98=typeof _0x12f2a2[_0xa6b8('0x1b')]==='undefined'&&typeof _0x12f2a2['limit']===_0xa6b8('0x1c');var _0x1d963d=_0x1f4403['count'];var _0x4c9f2f=_0x2f3a98?0x0:_0x12f2a2[_0xa6b8('0x1b')];var _0xdad2ac=_0x2f3a98?_0x1f4403[_0xa6b8('0x1d')]:_0x12f2a2[_0xa6b8('0x1b')]+_0x12f2a2[_0xa6b8('0x1e')];var _0xa60151;if(_0xdad2ac>=_0x1d963d){_0xdad2ac=_0x1d963d;_0xa60151=0xc8;}else{_0xa60151=0xce;}_0x574169[_0xa6b8('0x1f')](_0xa60151);return _0x574169[_0xa6b8('0x20')](_0xa6b8('0x21'),_0x4c9f2f+'-'+_0xdad2ac+'/'+_0x1d963d)[_0xa6b8('0x1a')](_0x1f4403);}return null;};}function patchUpdates(_0x21ddda){return function(_0x304c5f){try{jsonpatch[_0xa6b8('0x22')](_0x304c5f,_0x21ddda,!![]);}catch(_0x206c5d){return BPromise['reject'](_0x206c5d);}return _0x304c5f[_0xa6b8('0x23')]();};}function saveUpdates(_0x13d0e0,_0x559238){return function(_0x1d8cbc){if(_0x1d8cbc){return _0x1d8cbc[_0xa6b8('0x24')](_0x13d0e0)['then'](function(_0x354df7){return _0x354df7;});}return null;};}function removeEntity(_0x45e3cb,_0x3b5f11){return function(_0xfc844c){if(_0xfc844c){return _0xfc844c[_0xa6b8('0x25')]()['then'](function(){_0x45e3cb[_0xa6b8('0x1f')](0xcc)[_0xa6b8('0x19')]();});}};}function handleEntityNotFound(_0x909f99,_0x187f7a){return function(_0x581052){if(!_0x581052){_0x909f99[_0xa6b8('0x26')](0x194);}return _0x581052;};}function handleError(_0x10cc32,_0x33d026){_0x33d026=_0x33d026||0x1f4;return function(_0x5c1b74){logger[_0xa6b8('0x27')](_0x5c1b74['stack']);if(_0x5c1b74[_0xa6b8('0x28')]){delete _0x5c1b74[_0xa6b8('0x28')];}_0x10cc32[_0xa6b8('0x1f')](_0x33d026)[_0xa6b8('0x29')](_0x5c1b74);};}exports[_0xa6b8('0x2a')]=function(_0x10efbf,_0x223ab6){var _0x134b0a={},_0x3bd252={},_0x3a12e3={'count':0x0,'rows':[]};var _0xd18183=_[_0xa6b8('0x2b')](db[_0xa6b8('0x2c')][_0xa6b8('0x2d')],function(_0x13d508){return{'name':_0x13d508[_0xa6b8('0x2e')],'type':_0x13d508[_0xa6b8('0x2f')]['key']};});_0x3bd252[_0xa6b8('0x30')]=_[_0xa6b8('0x2b')](_0xd18183,_0xa6b8('0x28'));_0x3bd252[_0xa6b8('0x31')]=_[_0xa6b8('0x32')](_0x10efbf[_0xa6b8('0x31')]);_0x3bd252[_0xa6b8('0x33')]=_[_0xa6b8('0x34')](_0x3bd252[_0xa6b8('0x30')],_0x3bd252[_0xa6b8('0x31')]);_0x134b0a['attributes']=_[_0xa6b8('0x34')](_0x3bd252[_0xa6b8('0x30')],qs[_0xa6b8('0x35')](_0x10efbf['query'][_0xa6b8('0x35')]));_0x134b0a['attributes']=_0x134b0a['attributes'][_0xa6b8('0x36')]?_0x134b0a[_0xa6b8('0x37')]:_0x3bd252['model'];if(!_0x10efbf[_0xa6b8('0x31')][_0xa6b8('0x38')](_0xa6b8('0x39'))){_0x134b0a[_0xa6b8('0x1e')]=qs[_0xa6b8('0x1e')](_0x10efbf[_0xa6b8('0x31')][_0xa6b8('0x1e')]);_0x134b0a[_0xa6b8('0x1b')]=qs['offset'](_0x10efbf[_0xa6b8('0x31')][_0xa6b8('0x1b')]);}_0x134b0a[_0xa6b8('0x3a')]=qs[_0xa6b8('0x3b')](_0x10efbf[_0xa6b8('0x31')][_0xa6b8('0x3b')]);_0x134b0a[_0xa6b8('0x3c')]=qs['filters'](_[_0xa6b8('0x3d')](_0x10efbf[_0xa6b8('0x31')],_0x3bd252[_0xa6b8('0x33')]),_0xd18183);if(_0x10efbf['query'][_0xa6b8('0x3e')]){_0x134b0a['where']=_[_0xa6b8('0x3f')](_0x134b0a[_0xa6b8('0x3c')],{'$or':_['map'](_0xd18183,function(_0x126a44){if(_0x126a44[_0xa6b8('0x2f')]!==_0xa6b8('0x40')){var _0x5b5b57={};_0x5b5b57[_0x126a44['name']]={'$like':'%'+_0x10efbf['query'][_0xa6b8('0x3e')]+'%'};return _0x5b5b57;}})});}_0x134b0a=_[_0xa6b8('0x3f')]({},_0x134b0a,_0x10efbf[_0xa6b8('0x41')]);var _0x8ab286={'where':_0x134b0a[_0xa6b8('0x3c')]};return db[_0xa6b8('0x2c')][_0xa6b8('0x1d')](_0x8ab286)['then'](function(_0x36f7d9){_0x3a12e3['count']=_0x36f7d9;if(_0x10efbf[_0xa6b8('0x31')][_0xa6b8('0x42')]){_0x134b0a[_0xa6b8('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xa6b8('0x44')](_0x134b0a);})[_0xa6b8('0x45')](function(_0x45a040){_0x3a12e3['rows']=_0x45a040;return _0x3a12e3;})['then'](respondWithFilteredResult(_0x223ab6,_0x134b0a))[_0xa6b8('0x46')](handleError(_0x223ab6,null));};exports[_0xa6b8('0x47')]=function(_0x34de45,_0x46ea86){var _0x2524f5={'raw':![],'where':{'id':_0x34de45[_0xa6b8('0x48')]['id']}},_0x5a4e5a={};_0x5a4e5a[_0xa6b8('0x30')]=_['keys'](db[_0xa6b8('0x2c')][_0xa6b8('0x2d')]);_0x5a4e5a[_0xa6b8('0x31')]=_[_0xa6b8('0x32')](_0x34de45['query']);_0x5a4e5a[_0xa6b8('0x33')]=_[_0xa6b8('0x34')](_0x5a4e5a[_0xa6b8('0x30')],_0x5a4e5a[_0xa6b8('0x31')]);_0x2524f5[_0xa6b8('0x37')]=_[_0xa6b8('0x34')](_0x5a4e5a[_0xa6b8('0x30')],qs['fields'](_0x34de45['query'][_0xa6b8('0x35')]));_0x2524f5[_0xa6b8('0x37')]=_0x2524f5[_0xa6b8('0x37')][_0xa6b8('0x36')]?_0x2524f5[_0xa6b8('0x37')]:_0x5a4e5a[_0xa6b8('0x30')];if(_0x34de45[_0xa6b8('0x31')]['includeAll']){_0x2524f5[_0xa6b8('0x43')]=[{'all':!![]}];}_0x2524f5=_[_0xa6b8('0x3f')]({},_0x2524f5,_0x34de45[_0xa6b8('0x41')]);return db[_0xa6b8('0x2c')]['find'](_0x2524f5)[_0xa6b8('0x45')](handleEntityNotFound(_0x46ea86,null))['then'](respondWithResult(_0x46ea86,null))[_0xa6b8('0x46')](handleError(_0x46ea86,null));};exports[_0xa6b8('0x49')]=function(_0x2fa060,_0x556758){return db[_0xa6b8('0x2c')]['create'](_0x2fa060['body'],{})[_0xa6b8('0x45')](respondWithResult(_0x556758,0xc9))[_0xa6b8('0x46')](handleError(_0x556758,null));};exports[_0xa6b8('0x24')]=function(_0x183146,_0x5391ba){if(_0x183146[_0xa6b8('0x4a')]['id']){delete _0x183146[_0xa6b8('0x4a')]['id'];}return db[_0xa6b8('0x2c')]['find']({'where':{'id':_0x183146[_0xa6b8('0x48')]['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x5391ba,null))[_0xa6b8('0x45')](saveUpdates(_0x183146[_0xa6b8('0x4a')],null))[_0xa6b8('0x45')](respondWithResult(_0x5391ba,null))['catch'](handleError(_0x5391ba,null));};exports['destroy']=function(_0x2cf04d,_0x5537f2){return db['FreshdeskConfiguration'][_0xa6b8('0x4b')]({'where':{'id':_0x2cf04d['params']['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x5537f2,null))[_0xa6b8('0x45')](removeEntity(_0x5537f2,null))[_0xa6b8('0x46')](handleError(_0x5537f2,null));};exports['getFields']=function(_0x466c9a,_0x238272,_0x3c35eb){var _0x8d14fb={};var _0x3232a1={};var _0x575ca9;var _0x15570c;return db[_0xa6b8('0x2c')]['findOne']({'where':{'id':_0x466c9a[_0xa6b8('0x48')]['id']}})['then'](handleEntityNotFound(_0x238272,null))['then'](function(_0x2755ac){if(_0x2755ac){_0x575ca9=_0x2755ac;_0x3232a1[_0xa6b8('0x30')]=_[_0xa6b8('0x32')](db[_0xa6b8('0x4c')][_0xa6b8('0x2d')]);_0x3232a1[_0xa6b8('0x31')]=_[_0xa6b8('0x32')](_0x466c9a[_0xa6b8('0x31')]);_0x3232a1[_0xa6b8('0x33')]=_[_0xa6b8('0x34')](_0x3232a1[_0xa6b8('0x30')],_0x3232a1[_0xa6b8('0x31')]);_0x8d14fb[_0xa6b8('0x37')]=_['intersection'](_0x3232a1['model'],qs[_0xa6b8('0x35')](_0x466c9a[_0xa6b8('0x31')][_0xa6b8('0x35')]));_0x8d14fb[_0xa6b8('0x37')]=_0x8d14fb['attributes'][_0xa6b8('0x36')]?_0x8d14fb[_0xa6b8('0x37')]:_0x3232a1[_0xa6b8('0x30')];_0x8d14fb[_0xa6b8('0x3a')]=qs[_0xa6b8('0x3b')](_0x466c9a[_0xa6b8('0x31')][_0xa6b8('0x3b')]);_0x8d14fb[_0xa6b8('0x3c')]=qs['filters'](_[_0xa6b8('0x3d')](_0x466c9a[_0xa6b8('0x31')],_0x3232a1[_0xa6b8('0x33')]));if(_0x466c9a['query'][_0xa6b8('0x3e')]){_0x8d14fb[_0xa6b8('0x3c')]=_[_0xa6b8('0x3f')](_0x8d14fb[_0xa6b8('0x3c')],{'$or':_[_0xa6b8('0x2b')](_0x8d14fb['attributes'],function(_0xb23b4a){var _0x326824={};_0x326824[_0xb23b4a]={'$like':'%'+_0x466c9a[_0xa6b8('0x31')][_0xa6b8('0x3e')]+'%'};return _0x326824;})});}_0x8d14fb=_[_0xa6b8('0x3f')]({},_0x8d14fb,_0x466c9a['options']);return _0x575ca9[_0xa6b8('0x4d')](_0x8d14fb);}})[_0xa6b8('0x45')](function(_0x3a3d7a){if(_0x3a3d7a){_0x15570c=_0x3a3d7a[_0xa6b8('0x36')];if(!_0x466c9a[_0xa6b8('0x31')][_0xa6b8('0x38')]('nolimit')){_0x8d14fb[_0xa6b8('0x1e')]=qs[_0xa6b8('0x1e')](_0x466c9a[_0xa6b8('0x31')]['limit']);_0x8d14fb[_0xa6b8('0x1b')]=qs[_0xa6b8('0x1b')](_0x466c9a[_0xa6b8('0x31')][_0xa6b8('0x1b')]);}return _0x575ca9['getFields'](_0x8d14fb);}})[_0xa6b8('0x45')](function(_0x1ba9bd){if(_0x1ba9bd){return _0x1ba9bd?{'count':_0x15570c,'rows':_0x1ba9bd}:null;}})[_0xa6b8('0x45')](respondWithResult(_0x238272,null))[_0xa6b8('0x46')](handleError(_0x238272,null));};exports['getSubjects']=function(_0x5c31ab,_0x26ea33,_0x512ba1){var _0x18a9c5={};var _0x1fa760={};var _0x270bd7;var _0x3376b7;return db[_0xa6b8('0x2c')]['findOne']({'where':{'id':_0x5c31ab[_0xa6b8('0x48')]['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x26ea33,null))['then'](function(_0x2f8d42){if(_0x2f8d42){_0x270bd7=_0x2f8d42;_0x1fa760[_0xa6b8('0x30')]=_[_0xa6b8('0x32')](db['FreshdeskField'][_0xa6b8('0x2d')]);_0x1fa760[_0xa6b8('0x31')]=_['keys'](_0x5c31ab['query']);_0x1fa760[_0xa6b8('0x33')]=_[_0xa6b8('0x34')](_0x1fa760[_0xa6b8('0x30')],_0x1fa760[_0xa6b8('0x31')]);_0x18a9c5['attributes']=_[_0xa6b8('0x34')](_0x1fa760[_0xa6b8('0x30')],qs[_0xa6b8('0x35')](_0x5c31ab['query']['fields']));_0x18a9c5[_0xa6b8('0x37')]=_0x18a9c5['attributes'][_0xa6b8('0x36')]?_0x18a9c5[_0xa6b8('0x37')]:_0x1fa760[_0xa6b8('0x30')];_0x18a9c5['order']=qs[_0xa6b8('0x3b')](_0x5c31ab[_0xa6b8('0x31')]['sort']);_0x18a9c5['where']=qs[_0xa6b8('0x33')](_[_0xa6b8('0x3d')](_0x5c31ab[_0xa6b8('0x31')],_0x1fa760[_0xa6b8('0x33')]));if(_0x5c31ab['query'][_0xa6b8('0x3e')]){_0x18a9c5['where']=_[_0xa6b8('0x3f')](_0x18a9c5[_0xa6b8('0x3c')],{'$or':_['map'](_0x18a9c5['attributes'],function(_0x15b07d){var _0x1d4594={};_0x1d4594[_0x15b07d]={'$like':'%'+_0x5c31ab['query'][_0xa6b8('0x3e')]+'%'};return _0x1d4594;})});}_0x18a9c5=_[_0xa6b8('0x3f')]({},_0x18a9c5,_0x5c31ab[_0xa6b8('0x41')]);return _0x270bd7[_0xa6b8('0x4e')](_0x18a9c5);}})[_0xa6b8('0x45')](function(_0x2f08aa){if(_0x2f08aa){_0x3376b7=_0x2f08aa[_0xa6b8('0x36')];if(!_0x5c31ab['query'][_0xa6b8('0x38')]('nolimit')){_0x18a9c5['limit']=qs['limit'](_0x5c31ab[_0xa6b8('0x31')][_0xa6b8('0x1e')]);_0x18a9c5[_0xa6b8('0x1b')]=qs[_0xa6b8('0x1b')](_0x5c31ab[_0xa6b8('0x31')]['offset']);}return _0x270bd7[_0xa6b8('0x4e')](_0x18a9c5);}})[_0xa6b8('0x45')](function(_0x415c77){if(_0x415c77){return _0x415c77?{'count':_0x3376b7,'rows':_0x415c77}:null;}})[_0xa6b8('0x45')](respondWithResult(_0x26ea33,null))['catch'](handleError(_0x26ea33,null));};exports[_0xa6b8('0x4f')]=function(_0x490376,_0x5a0955,_0x5eb102){var _0x3b7f0d={};var _0x27768d={};var _0x129e10;var _0x3ad534;return db[_0xa6b8('0x2c')][_0xa6b8('0x50')]({'where':{'id':_0x490376[_0xa6b8('0x48')]['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x5a0955,null))['then'](function(_0x4ad825){if(_0x4ad825){_0x129e10=_0x4ad825;_0x27768d[_0xa6b8('0x30')]=_[_0xa6b8('0x32')](db[_0xa6b8('0x4c')][_0xa6b8('0x2d')]);_0x27768d['query']=_[_0xa6b8('0x32')](_0x490376[_0xa6b8('0x31')]);_0x27768d[_0xa6b8('0x33')]=_[_0xa6b8('0x34')](_0x27768d[_0xa6b8('0x30')],_0x27768d['query']);_0x3b7f0d[_0xa6b8('0x37')]=_[_0xa6b8('0x34')](_0x27768d[_0xa6b8('0x30')],qs[_0xa6b8('0x35')](_0x490376['query'][_0xa6b8('0x35')]));_0x3b7f0d[_0xa6b8('0x37')]=_0x3b7f0d[_0xa6b8('0x37')]['length']?_0x3b7f0d['attributes']:_0x27768d[_0xa6b8('0x30')];_0x3b7f0d['order']=qs[_0xa6b8('0x3b')](_0x490376['query'][_0xa6b8('0x3b')]);_0x3b7f0d['where']=qs[_0xa6b8('0x33')](_[_0xa6b8('0x3d')](_0x490376[_0xa6b8('0x31')],_0x27768d[_0xa6b8('0x33')]));if(_0x490376[_0xa6b8('0x31')]['filter']){_0x3b7f0d[_0xa6b8('0x3c')]=_[_0xa6b8('0x3f')](_0x3b7f0d[_0xa6b8('0x3c')],{'$or':_[_0xa6b8('0x2b')](_0x3b7f0d[_0xa6b8('0x37')],function(_0x107039){var _0x37bf35={};_0x37bf35[_0x107039]={'$like':'%'+_0x490376['query'][_0xa6b8('0x3e')]+'%'};return _0x37bf35;})});}_0x3b7f0d=_[_0xa6b8('0x3f')]({},_0x3b7f0d,_0x490376[_0xa6b8('0x41')]);return _0x129e10[_0xa6b8('0x4f')](_0x3b7f0d);}})[_0xa6b8('0x45')](function(_0x17661c){if(_0x17661c){_0x3ad534=_0x17661c['length'];if(!_0x490376['query'][_0xa6b8('0x38')](_0xa6b8('0x39'))){_0x3b7f0d[_0xa6b8('0x1e')]=qs['limit'](_0x490376[_0xa6b8('0x31')][_0xa6b8('0x1e')]);_0x3b7f0d[_0xa6b8('0x1b')]=qs[_0xa6b8('0x1b')](_0x490376[_0xa6b8('0x31')][_0xa6b8('0x1b')]);}return _0x129e10[_0xa6b8('0x4f')](_0x3b7f0d);}})['then'](function(_0x6ab247){if(_0x6ab247){return _0x6ab247?{'count':_0x3ad534,'rows':_0x6ab247}:null;}})[_0xa6b8('0x45')](respondWithResult(_0x5a0955,null))[_0xa6b8('0x46')](handleError(_0x5a0955,null));};exports[_0xa6b8('0x51')]=function(_0x74aef1,_0x4216ac,_0x197859){var _0xeae43d={};var _0x1867aa={};var _0x57c31c;var _0x40ed04;return db[_0xa6b8('0x2c')]['findOne']({'where':{'id':_0x74aef1[_0xa6b8('0x48')]['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x4216ac,null))[_0xa6b8('0x45')](function(_0x2683b3){if(_0x2683b3){_0x57c31c=_0x2683b3;_0x1867aa[_0xa6b8('0x30')]=_[_0xa6b8('0x32')](db[_0xa6b8('0x52')][_0xa6b8('0x2d')]);_0x1867aa['query']=_['keys'](_0x74aef1[_0xa6b8('0x31')]);_0x1867aa['filters']=_[_0xa6b8('0x34')](_0x1867aa['model'],_0x1867aa[_0xa6b8('0x31')]);_0xeae43d[_0xa6b8('0x37')]=_[_0xa6b8('0x34')](_0x1867aa[_0xa6b8('0x30')],qs[_0xa6b8('0x35')](_0x74aef1['query'][_0xa6b8('0x35')]));_0xeae43d[_0xa6b8('0x37')]=_0xeae43d[_0xa6b8('0x37')]['length']?_0xeae43d[_0xa6b8('0x37')]:_0x1867aa[_0xa6b8('0x30')];_0xeae43d['order']=qs['sort'](_0x74aef1[_0xa6b8('0x31')]['sort']);_0xeae43d['where']=qs[_0xa6b8('0x33')](_[_0xa6b8('0x3d')](_0x74aef1[_0xa6b8('0x31')],_0x1867aa[_0xa6b8('0x33')]));if(_0x74aef1[_0xa6b8('0x31')]['filter']){_0xeae43d[_0xa6b8('0x3c')]=_[_0xa6b8('0x3f')](_0xeae43d[_0xa6b8('0x3c')],{'$or':_[_0xa6b8('0x2b')](_0xeae43d[_0xa6b8('0x37')],function(_0x54501a){var _0x5b42a3={};_0x5b42a3[_0x54501a]={'$like':'%'+_0x74aef1[_0xa6b8('0x31')][_0xa6b8('0x3e')]+'%'};return _0x5b42a3;})});}_0xeae43d=_[_0xa6b8('0x3f')]({},_0xeae43d,_0x74aef1['options']);return _0x57c31c[_0xa6b8('0x51')](_0xeae43d);}})['then'](function(_0xca65e3){if(_0xca65e3){_0x40ed04=_0xca65e3['length'];if(!_0x74aef1['query']['hasOwnProperty'](_0xa6b8('0x39'))){_0xeae43d[_0xa6b8('0x1e')]=qs[_0xa6b8('0x1e')](_0x74aef1[_0xa6b8('0x31')][_0xa6b8('0x1e')]);_0xeae43d[_0xa6b8('0x1b')]=qs['offset'](_0x74aef1[_0xa6b8('0x31')][_0xa6b8('0x1b')]);}return _0x57c31c[_0xa6b8('0x51')](_0xeae43d);}})[_0xa6b8('0x45')](function(_0x23ef2c){if(_0x23ef2c){return _0x23ef2c?{'count':_0x40ed04,'rows':_0x23ef2c}:null;}})[_0xa6b8('0x45')](respondWithResult(_0x4216ac,null))[_0xa6b8('0x46')](handleError(_0x4216ac,null));};exports[_0xa6b8('0x53')]=function(_0xc5b23c,_0x2eb07a,_0x30c6ac){if(_0xc5b23c['body']['id']){delete _0xc5b23c[_0xa6b8('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0xa6b8('0x50')]({'where':{'id':_0xc5b23c[_0xa6b8('0x48')]['id']}})[_0xa6b8('0x45')](handleEntityNotFound(_0x2eb07a,null))[_0xa6b8('0x45')](function(_0x122f0f){if(_0x122f0f){return _0x122f0f[_0xa6b8('0x53')](_0xc5b23c['body'][_0xa6b8('0x54')]||[]);}return null;})[_0xa6b8('0x45')](respondWithResult(_0x2eb07a,null))['catch'](handleError(_0x2eb07a,null));}; \ No newline at end of file +var _0x6fe5=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','find','catch','create','body','getFields','FreshdeskField','options','findOne','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6fe5,0x196));var _0x56fe=function(_0x1b2352,_0x42c2aa){_0x1b2352=_0x1b2352-0x0;var _0x5027f6=_0x6fe5[_0x1b2352];return _0x5027f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56fe('0x0'));var zipdir=require(_0x56fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56fe('0x2'));var moment=require(_0x56fe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x56fe('0x4'));var util=require(_0x56fe('0x5'));var path=require(_0x56fe('0x6'));var sox=require(_0x56fe('0x7'));var csv=require(_0x56fe('0x8'));var ejs=require(_0x56fe('0x9'));var fs=require('fs');var fs_extra=require(_0x56fe('0xa'));var _=require(_0x56fe('0xb'));var squel=require('squel');var crypto=require(_0x56fe('0xc'));var jsforce=require(_0x56fe('0xd'));var deskjs=require(_0x56fe('0xe'));var toCsv=require(_0x56fe('0x8'));var querystring=require(_0x56fe('0xf'));var Papa=require(_0x56fe('0x10'));var Redis=require(_0x56fe('0x11'));var authService=require(_0x56fe('0x12'));var qs=require(_0x56fe('0x13'));var as=require(_0x56fe('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x56fe('0x15'));var utils=require(_0x56fe('0x16'));var config=require(_0x56fe('0x17'));var licenseUtil=require(_0x56fe('0x18'));var db=require(_0x56fe('0x19'))['db'];function respondWithStatusCode(_0x425439,_0x50cf8b){_0x50cf8b=_0x50cf8b||0xcc;return function(_0x2c5e19){if(_0x2c5e19){return _0x425439[_0x56fe('0x1a')](_0x50cf8b);}return _0x425439[_0x56fe('0x1b')](_0x50cf8b)[_0x56fe('0x1c')]();};}function respondWithResult(_0x7ee515,_0x3631c6){_0x3631c6=_0x3631c6||0xc8;return function(_0x1592be){if(_0x1592be){return _0x7ee515[_0x56fe('0x1b')](_0x3631c6)[_0x56fe('0x1d')](_0x1592be);}};}function respondWithFilteredResult(_0x4d462b,_0x43fb1c){return function(_0x3e30fa){if(_0x3e30fa){var _0x305533=typeof _0x43fb1c['offset']===_0x56fe('0x1e')&&typeof _0x43fb1c[_0x56fe('0x1f')]==='undefined';var _0x261f64=_0x3e30fa[_0x56fe('0x20')];var _0x39e2f5=_0x305533?0x0:_0x43fb1c[_0x56fe('0x21')];var _0x251663=_0x305533?_0x3e30fa[_0x56fe('0x20')]:_0x43fb1c[_0x56fe('0x21')]+_0x43fb1c['limit'];var _0x2ac740;if(_0x251663>=_0x261f64){_0x251663=_0x261f64;_0x2ac740=0xc8;}else{_0x2ac740=0xce;}_0x4d462b[_0x56fe('0x1b')](_0x2ac740);return _0x4d462b['set']('Content-Range',_0x39e2f5+'-'+_0x251663+'/'+_0x261f64)[_0x56fe('0x1d')](_0x3e30fa);}return null;};}function patchUpdates(_0x52c6c5){return function(_0x5c42e4){try{jsonpatch[_0x56fe('0x22')](_0x5c42e4,_0x52c6c5,!![]);}catch(_0x1e84f4){return BPromise[_0x56fe('0x23')](_0x1e84f4);}return _0x5c42e4[_0x56fe('0x24')]();};}function saveUpdates(_0x368b86,_0xae90da){return function(_0x15910d){if(_0x15910d){return _0x15910d[_0x56fe('0x25')](_0x368b86)[_0x56fe('0x26')](function(_0x2c7ba6){return _0x2c7ba6;});}return null;};}function removeEntity(_0x169126,_0x4e57d7){return function(_0x2fdc4f){if(_0x2fdc4f){return _0x2fdc4f[_0x56fe('0x27')]()[_0x56fe('0x26')](function(){_0x169126[_0x56fe('0x1b')](0xcc)[_0x56fe('0x1c')]();});}};}function handleEntityNotFound(_0x89491d,_0x2db449){return function(_0x52e36f){if(!_0x52e36f){_0x89491d[_0x56fe('0x1a')](0x194);}return _0x52e36f;};}function handleError(_0x6f5c0e,_0x1677ed){_0x1677ed=_0x1677ed||0x1f4;return function(_0x630265){logger[_0x56fe('0x28')](_0x630265['stack']);if(_0x630265[_0x56fe('0x29')]){delete _0x630265[_0x56fe('0x29')];}_0x6f5c0e[_0x56fe('0x1b')](_0x1677ed)[_0x56fe('0x2a')](_0x630265);};}exports[_0x56fe('0x2b')]=function(_0x527482,_0x2ff003){var _0x1d7d67={},_0x40df26={},_0x47c264={'count':0x0,'rows':[]};var _0x5aea88=_[_0x56fe('0x2c')](db[_0x56fe('0x2d')][_0x56fe('0x2e')],function(_0x564409){return{'name':_0x564409[_0x56fe('0x2f')],'type':_0x564409['type'][_0x56fe('0x30')]};});_0x40df26[_0x56fe('0x31')]=_['map'](_0x5aea88,_0x56fe('0x29'));_0x40df26[_0x56fe('0x32')]=_[_0x56fe('0x33')](_0x527482[_0x56fe('0x32')]);_0x40df26[_0x56fe('0x34')]=_['intersection'](_0x40df26[_0x56fe('0x31')],_0x40df26[_0x56fe('0x32')]);_0x1d7d67[_0x56fe('0x35')]=_[_0x56fe('0x36')](_0x40df26[_0x56fe('0x31')],qs[_0x56fe('0x37')](_0x527482['query'][_0x56fe('0x37')]));_0x1d7d67[_0x56fe('0x35')]=_0x1d7d67['attributes'][_0x56fe('0x38')]?_0x1d7d67[_0x56fe('0x35')]:_0x40df26[_0x56fe('0x31')];if(!_0x527482['query'][_0x56fe('0x39')](_0x56fe('0x3a'))){_0x1d7d67['limit']=qs[_0x56fe('0x1f')](_0x527482[_0x56fe('0x32')][_0x56fe('0x1f')]);_0x1d7d67['offset']=qs[_0x56fe('0x21')](_0x527482[_0x56fe('0x32')]['offset']);}_0x1d7d67[_0x56fe('0x3b')]=qs[_0x56fe('0x3c')](_0x527482['query']['sort']);_0x1d7d67[_0x56fe('0x3d')]=qs[_0x56fe('0x34')](_[_0x56fe('0x3e')](_0x527482[_0x56fe('0x32')],_0x40df26[_0x56fe('0x34')]),_0x5aea88);if(_0x527482['query'][_0x56fe('0x3f')]){_0x1d7d67[_0x56fe('0x3d')]=_[_0x56fe('0x40')](_0x1d7d67[_0x56fe('0x3d')],{'$or':_[_0x56fe('0x2c')](_0x5aea88,function(_0x55a776){if(_0x55a776['type']!==_0x56fe('0x41')){var _0x483a1e={};_0x483a1e[_0x55a776[_0x56fe('0x29')]]={'$like':'%'+_0x527482[_0x56fe('0x32')][_0x56fe('0x3f')]+'%'};return _0x483a1e;}})});}_0x1d7d67=_[_0x56fe('0x40')]({},_0x1d7d67,_0x527482['options']);var _0x39331a={'where':_0x1d7d67[_0x56fe('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x39331a)[_0x56fe('0x26')](function(_0x25acec){_0x47c264['count']=_0x25acec;if(_0x527482[_0x56fe('0x32')]['includeAll']){_0x1d7d67[_0x56fe('0x42')]=[{'all':!![]}];}return db[_0x56fe('0x2d')][_0x56fe('0x43')](_0x1d7d67);})[_0x56fe('0x26')](function(_0x127be1){_0x47c264[_0x56fe('0x44')]=_0x127be1;return _0x47c264;})[_0x56fe('0x26')](respondWithFilteredResult(_0x2ff003,_0x1d7d67))['catch'](handleError(_0x2ff003,null));};exports['show']=function(_0x6a865b,_0x55a7d6){var _0x55e0a7={'raw':![],'where':{'id':_0x6a865b[_0x56fe('0x45')]['id']}},_0x42642b={};_0x42642b[_0x56fe('0x31')]=_[_0x56fe('0x33')](db[_0x56fe('0x2d')][_0x56fe('0x2e')]);_0x42642b[_0x56fe('0x32')]=_['keys'](_0x6a865b[_0x56fe('0x32')]);_0x42642b[_0x56fe('0x34')]=_[_0x56fe('0x36')](_0x42642b[_0x56fe('0x31')],_0x42642b[_0x56fe('0x32')]);_0x55e0a7[_0x56fe('0x35')]=_[_0x56fe('0x36')](_0x42642b[_0x56fe('0x31')],qs[_0x56fe('0x37')](_0x6a865b[_0x56fe('0x32')]['fields']));_0x55e0a7['attributes']=_0x55e0a7[_0x56fe('0x35')]['length']?_0x55e0a7['attributes']:_0x42642b[_0x56fe('0x31')];if(_0x6a865b[_0x56fe('0x32')][_0x56fe('0x46')]){_0x55e0a7[_0x56fe('0x42')]=[{'all':!![]}];}_0x55e0a7=_['merge']({},_0x55e0a7,_0x6a865b['options']);return db[_0x56fe('0x2d')][_0x56fe('0x47')](_0x55e0a7)[_0x56fe('0x26')](handleEntityNotFound(_0x55a7d6,null))['then'](respondWithResult(_0x55a7d6,null))[_0x56fe('0x48')](handleError(_0x55a7d6,null));};exports[_0x56fe('0x49')]=function(_0x5843a6,_0x6e4333){return db[_0x56fe('0x2d')][_0x56fe('0x49')](_0x5843a6[_0x56fe('0x4a')],{})['then'](respondWithResult(_0x6e4333,0xc9))[_0x56fe('0x48')](handleError(_0x6e4333,null));};exports['update']=function(_0x4f2dc9,_0x1338bd){if(_0x4f2dc9[_0x56fe('0x4a')]['id']){delete _0x4f2dc9[_0x56fe('0x4a')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4f2dc9[_0x56fe('0x45')]['id']}})[_0x56fe('0x26')](handleEntityNotFound(_0x1338bd,null))['then'](saveUpdates(_0x4f2dc9['body'],null))[_0x56fe('0x26')](respondWithResult(_0x1338bd,null))[_0x56fe('0x48')](handleError(_0x1338bd,null));};exports[_0x56fe('0x27')]=function(_0x20c725,_0xa2130a){return db[_0x56fe('0x2d')][_0x56fe('0x47')]({'where':{'id':_0x20c725[_0x56fe('0x45')]['id']}})[_0x56fe('0x26')](handleEntityNotFound(_0xa2130a,null))['then'](removeEntity(_0xa2130a,null))[_0x56fe('0x48')](handleError(_0xa2130a,null));};exports[_0x56fe('0x4b')]=function(_0x458cc9,_0x4e4be1,_0x581139){var _0x52199b={};var _0xeeb37={};var _0x463d14;var _0x32b7ab;return db[_0x56fe('0x2d')]['findOne']({'where':{'id':_0x458cc9[_0x56fe('0x45')]['id']}})[_0x56fe('0x26')](handleEntityNotFound(_0x4e4be1,null))[_0x56fe('0x26')](function(_0x55a50f){if(_0x55a50f){_0x463d14=_0x55a50f;_0xeeb37[_0x56fe('0x31')]=_[_0x56fe('0x33')](db[_0x56fe('0x4c')][_0x56fe('0x2e')]);_0xeeb37[_0x56fe('0x32')]=_[_0x56fe('0x33')](_0x458cc9[_0x56fe('0x32')]);_0xeeb37[_0x56fe('0x34')]=_[_0x56fe('0x36')](_0xeeb37['model'],_0xeeb37[_0x56fe('0x32')]);_0x52199b[_0x56fe('0x35')]=_[_0x56fe('0x36')](_0xeeb37[_0x56fe('0x31')],qs[_0x56fe('0x37')](_0x458cc9[_0x56fe('0x32')][_0x56fe('0x37')]));_0x52199b[_0x56fe('0x35')]=_0x52199b['attributes']['length']?_0x52199b[_0x56fe('0x35')]:_0xeeb37['model'];_0x52199b['order']=qs[_0x56fe('0x3c')](_0x458cc9[_0x56fe('0x32')][_0x56fe('0x3c')]);_0x52199b[_0x56fe('0x3d')]=qs[_0x56fe('0x34')](_[_0x56fe('0x3e')](_0x458cc9[_0x56fe('0x32')],_0xeeb37[_0x56fe('0x34')]));if(_0x458cc9[_0x56fe('0x32')][_0x56fe('0x3f')]){_0x52199b['where']=_[_0x56fe('0x40')](_0x52199b['where'],{'$or':_['map'](_0x52199b[_0x56fe('0x35')],function(_0x1f3b4f){var _0x13a4a4={};_0x13a4a4[_0x1f3b4f]={'$like':'%'+_0x458cc9['query']['filter']+'%'};return _0x13a4a4;})});}_0x52199b=_['merge']({},_0x52199b,_0x458cc9[_0x56fe('0x4d')]);return _0x463d14[_0x56fe('0x4b')](_0x52199b);}})[_0x56fe('0x26')](function(_0x2e9e07){if(_0x2e9e07){_0x32b7ab=_0x2e9e07[_0x56fe('0x38')];if(!_0x458cc9[_0x56fe('0x32')][_0x56fe('0x39')](_0x56fe('0x3a'))){_0x52199b['limit']=qs[_0x56fe('0x1f')](_0x458cc9['query'][_0x56fe('0x1f')]);_0x52199b[_0x56fe('0x21')]=qs[_0x56fe('0x21')](_0x458cc9[_0x56fe('0x32')][_0x56fe('0x21')]);}return _0x463d14[_0x56fe('0x4b')](_0x52199b);}})[_0x56fe('0x26')](function(_0x218770){if(_0x218770){return _0x218770?{'count':_0x32b7ab,'rows':_0x218770}:null;}})[_0x56fe('0x26')](respondWithResult(_0x4e4be1,null))[_0x56fe('0x48')](handleError(_0x4e4be1,null));};exports['getSubjects']=function(_0x31f9e3,_0x5512fe,_0x46be97){var _0x235df3={};var _0x491b42={};var _0x2a0819;var _0x205b6a;return db['FreshdeskConfiguration'][_0x56fe('0x4e')]({'where':{'id':_0x31f9e3[_0x56fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x5512fe,null))[_0x56fe('0x26')](function(_0x4e9adb){if(_0x4e9adb){_0x2a0819=_0x4e9adb;_0x491b42[_0x56fe('0x31')]=_[_0x56fe('0x33')](db[_0x56fe('0x4c')]['rawAttributes']);_0x491b42['query']=_[_0x56fe('0x33')](_0x31f9e3[_0x56fe('0x32')]);_0x491b42['filters']=_[_0x56fe('0x36')](_0x491b42[_0x56fe('0x31')],_0x491b42[_0x56fe('0x32')]);_0x235df3[_0x56fe('0x35')]=_[_0x56fe('0x36')](_0x491b42[_0x56fe('0x31')],qs[_0x56fe('0x37')](_0x31f9e3[_0x56fe('0x32')][_0x56fe('0x37')]));_0x235df3[_0x56fe('0x35')]=_0x235df3['attributes'][_0x56fe('0x38')]?_0x235df3[_0x56fe('0x35')]:_0x491b42[_0x56fe('0x31')];_0x235df3[_0x56fe('0x3b')]=qs[_0x56fe('0x3c')](_0x31f9e3['query'][_0x56fe('0x3c')]);_0x235df3[_0x56fe('0x3d')]=qs['filters'](_[_0x56fe('0x3e')](_0x31f9e3[_0x56fe('0x32')],_0x491b42[_0x56fe('0x34')]));if(_0x31f9e3[_0x56fe('0x32')]['filter']){_0x235df3[_0x56fe('0x3d')]=_['merge'](_0x235df3[_0x56fe('0x3d')],{'$or':_[_0x56fe('0x2c')](_0x235df3[_0x56fe('0x35')],function(_0x484a18){var _0x1d122d={};_0x1d122d[_0x484a18]={'$like':'%'+_0x31f9e3['query'][_0x56fe('0x3f')]+'%'};return _0x1d122d;})});}_0x235df3=_[_0x56fe('0x40')]({},_0x235df3,_0x31f9e3[_0x56fe('0x4d')]);return _0x2a0819[_0x56fe('0x4f')](_0x235df3);}})[_0x56fe('0x26')](function(_0x4876d0){if(_0x4876d0){_0x205b6a=_0x4876d0[_0x56fe('0x38')];if(!_0x31f9e3[_0x56fe('0x32')][_0x56fe('0x39')](_0x56fe('0x3a'))){_0x235df3[_0x56fe('0x1f')]=qs[_0x56fe('0x1f')](_0x31f9e3['query']['limit']);_0x235df3[_0x56fe('0x21')]=qs[_0x56fe('0x21')](_0x31f9e3[_0x56fe('0x32')]['offset']);}return _0x2a0819[_0x56fe('0x4f')](_0x235df3);}})[_0x56fe('0x26')](function(_0x3f38a0){if(_0x3f38a0){return _0x3f38a0?{'count':_0x205b6a,'rows':_0x3f38a0}:null;}})[_0x56fe('0x26')](respondWithResult(_0x5512fe,null))[_0x56fe('0x48')](handleError(_0x5512fe,null));};exports[_0x56fe('0x50')]=function(_0x2a2b23,_0x1e60e2,_0x43edef){var _0x3a24e4={};var _0xb2baa9={};var _0x4ad670;var _0x379fca;return db[_0x56fe('0x2d')][_0x56fe('0x4e')]({'where':{'id':_0x2a2b23[_0x56fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e60e2,null))[_0x56fe('0x26')](function(_0x234530){if(_0x234530){_0x4ad670=_0x234530;_0xb2baa9[_0x56fe('0x31')]=_[_0x56fe('0x33')](db[_0x56fe('0x4c')][_0x56fe('0x2e')]);_0xb2baa9[_0x56fe('0x32')]=_[_0x56fe('0x33')](_0x2a2b23['query']);_0xb2baa9['filters']=_[_0x56fe('0x36')](_0xb2baa9[_0x56fe('0x31')],_0xb2baa9[_0x56fe('0x32')]);_0x3a24e4[_0x56fe('0x35')]=_[_0x56fe('0x36')](_0xb2baa9[_0x56fe('0x31')],qs[_0x56fe('0x37')](_0x2a2b23[_0x56fe('0x32')]['fields']));_0x3a24e4[_0x56fe('0x35')]=_0x3a24e4['attributes']['length']?_0x3a24e4[_0x56fe('0x35')]:_0xb2baa9[_0x56fe('0x31')];_0x3a24e4[_0x56fe('0x3b')]=qs[_0x56fe('0x3c')](_0x2a2b23[_0x56fe('0x32')][_0x56fe('0x3c')]);_0x3a24e4['where']=qs[_0x56fe('0x34')](_[_0x56fe('0x3e')](_0x2a2b23[_0x56fe('0x32')],_0xb2baa9[_0x56fe('0x34')]));if(_0x2a2b23[_0x56fe('0x32')][_0x56fe('0x3f')]){_0x3a24e4['where']=_[_0x56fe('0x40')](_0x3a24e4['where'],{'$or':_[_0x56fe('0x2c')](_0x3a24e4[_0x56fe('0x35')],function(_0x1802e4){var _0x25a7c9={};_0x25a7c9[_0x1802e4]={'$like':'%'+_0x2a2b23[_0x56fe('0x32')][_0x56fe('0x3f')]+'%'};return _0x25a7c9;})});}_0x3a24e4=_[_0x56fe('0x40')]({},_0x3a24e4,_0x2a2b23[_0x56fe('0x4d')]);return _0x4ad670[_0x56fe('0x50')](_0x3a24e4);}})[_0x56fe('0x26')](function(_0x19bfcd){if(_0x19bfcd){_0x379fca=_0x19bfcd[_0x56fe('0x38')];if(!_0x2a2b23[_0x56fe('0x32')][_0x56fe('0x39')](_0x56fe('0x3a'))){_0x3a24e4[_0x56fe('0x1f')]=qs[_0x56fe('0x1f')](_0x2a2b23['query'][_0x56fe('0x1f')]);_0x3a24e4[_0x56fe('0x21')]=qs[_0x56fe('0x21')](_0x2a2b23['query'][_0x56fe('0x21')]);}return _0x4ad670[_0x56fe('0x50')](_0x3a24e4);}})[_0x56fe('0x26')](function(_0xa92394){if(_0xa92394){return _0xa92394?{'count':_0x379fca,'rows':_0xa92394}:null;}})['then'](respondWithResult(_0x1e60e2,null))[_0x56fe('0x48')](handleError(_0x1e60e2,null));};exports['getTags']=function(_0x16d61d,_0x75d8c1,_0x276160){var _0x3e797b={};var _0x2d5b94={};var _0x3b9638;var _0x90dd24;return db[_0x56fe('0x2d')][_0x56fe('0x4e')]({'where':{'id':_0x16d61d[_0x56fe('0x45')]['id']}})[_0x56fe('0x26')](handleEntityNotFound(_0x75d8c1,null))[_0x56fe('0x26')](function(_0x3076b0){if(_0x3076b0){_0x3b9638=_0x3076b0;_0x2d5b94[_0x56fe('0x31')]=_[_0x56fe('0x33')](db[_0x56fe('0x51')][_0x56fe('0x2e')]);_0x2d5b94['query']=_[_0x56fe('0x33')](_0x16d61d[_0x56fe('0x32')]);_0x2d5b94['filters']=_[_0x56fe('0x36')](_0x2d5b94[_0x56fe('0x31')],_0x2d5b94[_0x56fe('0x32')]);_0x3e797b['attributes']=_[_0x56fe('0x36')](_0x2d5b94['model'],qs['fields'](_0x16d61d[_0x56fe('0x32')][_0x56fe('0x37')]));_0x3e797b[_0x56fe('0x35')]=_0x3e797b[_0x56fe('0x35')][_0x56fe('0x38')]?_0x3e797b[_0x56fe('0x35')]:_0x2d5b94[_0x56fe('0x31')];_0x3e797b[_0x56fe('0x3b')]=qs[_0x56fe('0x3c')](_0x16d61d[_0x56fe('0x32')][_0x56fe('0x3c')]);_0x3e797b['where']=qs[_0x56fe('0x34')](_[_0x56fe('0x3e')](_0x16d61d[_0x56fe('0x32')],_0x2d5b94[_0x56fe('0x34')]));if(_0x16d61d[_0x56fe('0x32')][_0x56fe('0x3f')]){_0x3e797b[_0x56fe('0x3d')]=_['merge'](_0x3e797b[_0x56fe('0x3d')],{'$or':_[_0x56fe('0x2c')](_0x3e797b[_0x56fe('0x35')],function(_0x24ce67){var _0x7d56b5={};_0x7d56b5[_0x24ce67]={'$like':'%'+_0x16d61d[_0x56fe('0x32')][_0x56fe('0x3f')]+'%'};return _0x7d56b5;})});}_0x3e797b=_[_0x56fe('0x40')]({},_0x3e797b,_0x16d61d[_0x56fe('0x4d')]);return _0x3b9638[_0x56fe('0x52')](_0x3e797b);}})['then'](function(_0x1e848c){if(_0x1e848c){_0x90dd24=_0x1e848c[_0x56fe('0x38')];if(!_0x16d61d['query']['hasOwnProperty'](_0x56fe('0x3a'))){_0x3e797b[_0x56fe('0x1f')]=qs['limit'](_0x16d61d['query'][_0x56fe('0x1f')]);_0x3e797b['offset']=qs['offset'](_0x16d61d[_0x56fe('0x32')][_0x56fe('0x21')]);}return _0x3b9638['getTags'](_0x3e797b);}})[_0x56fe('0x26')](function(_0x140f5e){if(_0x140f5e){return _0x140f5e?{'count':_0x90dd24,'rows':_0x140f5e}:null;}})[_0x56fe('0x26')](respondWithResult(_0x75d8c1,null))[_0x56fe('0x48')](handleError(_0x75d8c1,null));};exports[_0x56fe('0x53')]=function(_0x168569,_0x333383,_0xa42443){if(_0x168569[_0x56fe('0x4a')]['id']){delete _0x168569[_0x56fe('0x4a')]['id'];}return db[_0x56fe('0x2d')][_0x56fe('0x4e')]({'where':{'id':_0x168569['params']['id']}})[_0x56fe('0x26')](handleEntityNotFound(_0x333383,null))[_0x56fe('0x26')](function(_0x48d721){if(_0x48d721){return _0x48d721[_0x56fe('0x53')](_0x168569[_0x56fe('0x4a')][_0x56fe('0x54')]||[]);}return null;})['then'](respondWithResult(_0x333383,null))['catch'](handleError(_0x333383,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 70753e4..18c433f 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 _0x7cbc=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x10b363,_0x144ca3){var _0x46c7d7=function(_0x2f8d97){while(--_0x2f8d97){_0x10b363['push'](_0x10b363['shift']());}};_0x46c7d7(++_0x144ca3);}(_0x7cbc,0x145));var _0xc7cb=function(_0x365d62,_0x59c176){_0x365d62=_0x365d62-0x0;var _0x539d92=_0x7cbc[_0x365d62];return _0x539d92;};'use strict';var _=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var logger=require(_0xc7cb('0x2'))(_0xc7cb('0x3'));var moment=require(_0xc7cb('0x4'));var BPromise=require(_0xc7cb('0x5'));var rp=require(_0xc7cb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cb('0x7'));var config=require(_0xc7cb('0x8'));var attributes=require(_0xc7cb('0x9'));module[_0xc7cb('0xa')]=function(_0x1aa68a,_0x1ee8cb){return _0x1aa68a[_0xc7cb('0xb')](_0xc7cb('0xc'),attributes,{'tableName':_0xc7cb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x489b=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x489b,0x65));var _0xb489=function(_0x4142eb,_0x2bbc7c){_0x4142eb=_0x4142eb-0x0;var _0xe43ebf=_0x489b[_0x4142eb];return _0xe43ebf;};'use strict';var _=require(_0xb489('0x0'));var util=require(_0xb489('0x1'));var logger=require(_0xb489('0x2'))('api');var moment=require(_0xb489('0x3'));var BPromise=require('bluebird');var rp=require(_0xb489('0x4'));var fs=require('fs');var path=require(_0xb489('0x5'));var rimraf=require(_0xb489('0x6'));var config=require(_0xb489('0x7'));var attributes=require(_0xb489('0x8'));module['exports']=function(_0x467cf1,_0x42b763){return _0x467cf1[_0xb489('0x9')](_0xb489('0xa'),attributes,{'tableName':_0xb489('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 228bfad..424e913 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 _0x003a=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x3972ac,_0x519760){var _0x5e403d=function(_0x27f34e){while(--_0x27f34e){_0x3972ac['push'](_0x3972ac['shift']());}};_0x5e403d(++_0x519760);}(_0x003a,0x10a));var _0xa003=function(_0x5bc771,_0x2b9eb9){_0x5bc771=_0x5bc771-0x0;var _0x13e36c=_0x003a[_0x5bc771];return _0x13e36c;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var moment=require(_0xa003('0x2'));var BPromise=require(_0xa003('0x3'));var rs=require(_0xa003('0x4'));var fs=require('fs');var Redis=require(_0xa003('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa003('0x6'));var logger=require(_0xa003('0x7'))(_0xa003('0x8'));var config=require('../../config/environment');var jayson=require(_0xa003('0x9'));var client=jayson[_0xa003('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549fe4,_0x5f3c83,_0x544244){return new BPromise(function(_0x33a0c3,_0x3a1e71){return client[_0xa003('0xb')](_0x549fe4,_0x544244)[_0xa003('0xc')](function(_0x44435f){logger[_0xa003('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5f3c83,_0xa003('0xe'));logger[_0xa003('0xf')](_0xa003('0x10'),_0x5f3c83,_0xa003('0xe'),JSON[_0xa003('0x11')](_0x44435f));if(_0x44435f[_0xa003('0x12')]){if(_0x44435f[_0xa003('0x12')]['code']===0x1f4){logger[_0xa003('0x12')](_0xa003('0x13'),_0x5f3c83,_0x44435f[_0xa003('0x12')][_0xa003('0x14')]);return _0x3a1e71(_0x44435f[_0xa003('0x12')][_0xa003('0x14')]);}logger[_0xa003('0x12')](_0xa003('0x13'),_0x5f3c83,_0x44435f[_0xa003('0x12')]['message']);return _0x33a0c3(_0x44435f['error'][_0xa003('0x14')]);}else{logger[_0xa003('0xd')](_0xa003('0x13'),_0x5f3c83,_0xa003('0xe'));_0x33a0c3(_0x44435f[_0xa003('0x15')]['message']);}})['catch'](function(_0x2571ba){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5f3c83,_0x2571ba);_0x3a1e71(_0x2571ba);});});} \ No newline at end of file +var _0x2762=['stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2762,0x195));var _0x2276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2762[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2276('0x0'));var BPromise=require(_0x2276('0x1'));var rs=require(_0x2276('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2276('0x3'))['db'];var utils=require(_0x2276('0x4'));var logger=require(_0x2276('0x5'))('rpc');var config=require(_0x2276('0x6'));var jayson=require(_0x2276('0x7'));var client=jayson['client'][_0x2276('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4271d4,_0x1fbc28,_0x29b043){return new BPromise(function(_0x28175e,_0x403b06){return client[_0x2276('0x9')](_0x4271d4,_0x29b043)[_0x2276('0xa')](function(_0x2ecda4){logger[_0x2276('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fbc28,'request\x20sent');logger[_0x2276('0xc')](_0x2276('0xd'),_0x1fbc28,_0x2276('0xe'),JSON[_0x2276('0xf')](_0x2ecda4));if(_0x2ecda4[_0x2276('0x10')]){if(_0x2ecda4['error']['code']===0x1f4){logger['error'](_0x2276('0x11'),_0x1fbc28,_0x2ecda4['error'][_0x2276('0x12')]);return _0x403b06(_0x2ecda4[_0x2276('0x10')][_0x2276('0x12')]);}logger[_0x2276('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fbc28,_0x2ecda4[_0x2276('0x10')][_0x2276('0x12')]);return _0x28175e(_0x2ecda4['error'][_0x2276('0x12')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fbc28,'request\x20sent');_0x28175e(_0x2ecda4[_0x2276('0x13')][_0x2276('0x12')]);}})[_0x2276('0x14')](function(_0x19bab2){logger[_0x2276('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fbc28,_0x19bab2);_0x403b06(_0x19bab2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b49cfe6..50c83bc 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 _0x7978=['post','create','put','destroy','util','path','express','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1cf19a,_0x2d2760){var _0x175179=function(_0x1f0620){while(--_0x1f0620){_0x1cf19a['push'](_0x1cf19a['shift']());}};_0x175179(++_0x2d2760);}(_0x7978,0x1e4));var _0x8797=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7978[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require(_0x8797('0x0'));var path=require(_0x8797('0x1'));var timeout=require('connect-timeout');var express=require(_0x8797('0x2'));var router=express['Router']();var fs_extra=require(_0x8797('0x3'));var auth=require(_0x8797('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8797('0x5'));router[_0x8797('0x6')]('/',auth[_0x8797('0x7')](),controller[_0x8797('0x8')]);router[_0x8797('0x6')](_0x8797('0x9'),auth[_0x8797('0x7')](),controller[_0x8797('0xa')]);router[_0x8797('0xb')]('/',auth['isAuthenticated'](),controller[_0x8797('0xc')]);router[_0x8797('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8797('0xe')]);module['exports']=router; \ No newline at end of file +var _0x51da=['post','put','/:id','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','isAuthenticated','show'];(function(_0x414d02,_0xf25ab3){var _0x19db72=function(_0xfce081){while(--_0xfce081){_0x414d02['push'](_0x414d02['shift']());}};_0x19db72(++_0xf25ab3);}(_0x51da,0xd6));var _0xa51d=function(_0x3c1129,_0x4d0617){_0x3c1129=_0x3c1129-0x0;var _0x5ec8f4=_0x51da[_0x3c1129];return _0x5ec8f4;};'use strict';var multer=require('multer');var util=require(_0xa51d('0x0'));var path=require(_0xa51d('0x1'));var timeout=require(_0xa51d('0x2'));var express=require(_0xa51d('0x3'));var router=express[_0xa51d('0x4')]();var fs_extra=require(_0xa51d('0x5'));var auth=require(_0xa51d('0x6'));var interaction=require(_0xa51d('0x7'));var config=require(_0xa51d('0x8'));var controller=require(_0xa51d('0x9'));router[_0xa51d('0xa')]('/',auth['isAuthenticated'](),controller[_0xa51d('0xb')]);router[_0xa51d('0xa')]('/:id',auth[_0xa51d('0xc')](),controller[_0xa51d('0xd')]);router[_0xa51d('0xe')]('/',auth[_0xa51d('0xc')](),controller['create']);router[_0xa51d('0xf')](_0xa51d('0x10'),auth[_0xa51d('0xc')](),controller[_0xa51d('0x11')]);router['delete'](_0xa51d('0x10'),auth[_0xa51d('0xc')](),controller[_0xa51d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 35b73a9..a65d6b6 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 _0xf4b3=['STRING','variable','customVariable','sequelize','exports','ENUM','string','picklist'];(function(_0x2efb96,_0x40a4ce){var _0x50d38d=function(_0x22eaa9){while(--_0x22eaa9){_0x2efb96['push'](_0x2efb96['shift']());}};_0x50d38d(++_0x40a4ce);}(_0xf4b3,0x173));var _0x3f4b=function(_0x25510b,_0x46fc92){_0x25510b=_0x25510b-0x0;var _0x5a07e9=_0xf4b3[_0x25510b];return _0x5a07e9;};'use strict';var Sequelize=require(_0x3f4b('0x0'));module[_0x3f4b('0x1')]={'type':{'type':Sequelize[_0x3f4b('0x2')](_0x3f4b('0x3'),'variable','customVariable','keyValue',_0x3f4b('0x4')),'defaultValue':_0x3f4b('0x3')},'content':{'type':Sequelize[_0x3f4b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3f4b('0x2')](_0x3f4b('0x3'),_0x3f4b('0x6'),_0x3f4b('0x7'))},'keyContent':{'type':Sequelize[_0x3f4b('0x5')]},'idField':{'type':Sequelize[_0x3f4b('0x5')]},'nameField':{'type':Sequelize[_0x3f4b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc57e=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x8a197e,_0xe8df8b){var _0x174b5f=function(_0x370894){while(--_0x370894){_0x8a197e['push'](_0x8a197e['shift']());}};_0x174b5f(++_0xe8df8b);}(_0xc57e,0x77));var _0xec57=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc57e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xec57('0x0')]={'type':{'type':Sequelize[_0xec57('0x1')](_0xec57('0x2'),_0xec57('0x3'),_0xec57('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xec57('0x5')]},'key':{'type':Sequelize[_0xec57('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xec57('0x4'))},'keyContent':{'type':Sequelize[_0xec57('0x5')]},'idField':{'type':Sequelize[_0xec57('0x5')]},'nameField':{'type':Sequelize[_0xec57('0x5')]},'customField':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8ce711a..a181165 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 _0x9434=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x24c4e2,_0x197547){var _0x959ecd=function(_0x81b7ec){while(--_0x81b7ec){_0x24c4e2['push'](_0x24c4e2['shift']());}};_0x959ecd(++_0x197547);}(_0x9434,0x168));var _0x4943=function(_0xcfc5ad,_0x55bfc7){_0xcfc5ad=_0xcfc5ad-0x0;var _0x2c1b91=_0x9434[_0xcfc5ad];return _0x2c1b91;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x5d8cbe,_0x41f98d){return function(_0xd49582){if(!_0xd49582){_0x5d8cbe['sendStatus'](0x194);}return _0xd49582;};}function handleError(_0x8a63cb,_0x1499c7){_0x1499c7=_0x1499c7||0x1f4;return function(_0x43cbfe){logger[_0x4943('0x22')](_0x43cbfe[_0x4943('0x23')]);if(_0x43cbfe[_0x4943('0x24')]){delete _0x43cbfe[_0x4943('0x24')];}_0x8a63cb[_0x4943('0x16')](_0x1499c7)[_0x4943('0x25')](_0x43cbfe);};}exports[_0x4943('0x26')]=function(_0x170e78,_0x3b733f){var _0xa71fec={},_0x83bbd8={},_0x38b0a0={'count':0x0,'rows':[]};var _0x1cbb1e=_[_0x4943('0x27')](db[_0x4943('0x28')]['rawAttributes'],function(_0x43b11f){return{'name':_0x43b11f['fieldName'],'type':_0x43b11f[_0x4943('0x29')][_0x4943('0x2a')]};});_0x83bbd8[_0x4943('0x2b')]=_[_0x4943('0x27')](_0x1cbb1e,_0x4943('0x24'));_0x83bbd8[_0x4943('0x2c')]=_[_0x4943('0x2d')](_0x170e78[_0x4943('0x2c')]);_0x83bbd8['filters']=_[_0x4943('0x2e')](_0x83bbd8[_0x4943('0x2b')],_0x83bbd8['query']);_0xa71fec[_0x4943('0x2f')]=_[_0x4943('0x2e')](_0x83bbd8['model'],qs[_0x4943('0x30')](_0x170e78[_0x4943('0x2c')][_0x4943('0x30')]));_0xa71fec['attributes']=_0xa71fec[_0x4943('0x2f')][_0x4943('0x31')]?_0xa71fec[_0x4943('0x2f')]:_0x83bbd8[_0x4943('0x2b')];if(!_0x170e78[_0x4943('0x2c')]['hasOwnProperty'](_0x4943('0x32'))){_0xa71fec[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x170e78[_0x4943('0x2c')][_0x4943('0x1b')]);_0xa71fec[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x170e78[_0x4943('0x2c')][_0x4943('0x19')]);}_0xa71fec[_0x4943('0x33')]=qs[_0x4943('0x34')](_0x170e78['query'][_0x4943('0x34')]);_0xa71fec[_0x4943('0x35')]=qs[_0x4943('0x36')](_[_0x4943('0x37')](_0x170e78[_0x4943('0x2c')],_0x83bbd8['filters']),_0x1cbb1e);if(_0x170e78['query']['filter']){_0xa71fec[_0x4943('0x35')]=_[_0x4943('0x38')](_0xa71fec['where'],{'$or':_[_0x4943('0x27')](_0x1cbb1e,function(_0x4e970c){if(_0x4e970c[_0x4943('0x29')]!==_0x4943('0x39')){var _0x2fb5a7={};_0x2fb5a7[_0x4e970c[_0x4943('0x24')]]={'$like':'%'+_0x170e78[_0x4943('0x2c')][_0x4943('0x3a')]+'%'};return _0x2fb5a7;}})});}_0xa71fec=_[_0x4943('0x38')]({},_0xa71fec,_0x170e78[_0x4943('0x3b')]);var _0x41eaff={'where':_0xa71fec[_0x4943('0x35')]};return db[_0x4943('0x28')][_0x4943('0x1c')](_0x41eaff)[_0x4943('0x21')](function(_0x1b78bc){_0x38b0a0[_0x4943('0x1c')]=_0x1b78bc;if(_0x170e78[_0x4943('0x2c')][_0x4943('0x3c')]){_0xa71fec[_0x4943('0x3d')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x3e')](_0xa71fec);})[_0x4943('0x21')](function(_0x11ee4a){_0x38b0a0[_0x4943('0x3f')]=_0x11ee4a;return _0x38b0a0;})[_0x4943('0x21')](respondWithFilteredResult(_0x3b733f,_0xa71fec))[_0x4943('0x40')](handleError(_0x3b733f,null));};exports[_0x4943('0x41')]=function(_0xe27ab,_0x5c4702){var _0x11a362={'raw':!![],'where':{'id':_0xe27ab['params']['id']}},_0x147179={};_0x147179['model']=_[_0x4943('0x2d')](db['FreshdeskField'][_0x4943('0x42')]);_0x147179['query']=_[_0x4943('0x2d')](_0xe27ab['query']);_0x147179[_0x4943('0x36')]=_['intersection'](_0x147179[_0x4943('0x2b')],_0x147179[_0x4943('0x2c')]);_0x11a362[_0x4943('0x2f')]=_['intersection'](_0x147179['model'],qs[_0x4943('0x30')](_0xe27ab['query'][_0x4943('0x30')]));_0x11a362['attributes']=_0x11a362[_0x4943('0x2f')][_0x4943('0x31')]?_0x11a362[_0x4943('0x2f')]:_0x147179[_0x4943('0x2b')];if(_0xe27ab['query']['includeAll']){_0x11a362[_0x4943('0x3d')]=[{'all':!![]}];}_0x11a362=_['merge']({},_0x11a362,_0xe27ab['options']);return db[_0x4943('0x28')][_0x4943('0x43')](_0x11a362)[_0x4943('0x21')](handleEntityNotFound(_0x5c4702,null))[_0x4943('0x21')](respondWithResult(_0x5c4702,null))[_0x4943('0x40')](handleError(_0x5c4702,null));};exports[_0x4943('0x44')]=function(_0x2c0287,_0x5c8e07){return db[_0x4943('0x28')][_0x4943('0x44')](_0x2c0287['body'],{})[_0x4943('0x21')](respondWithResult(_0x5c8e07,0xc9))[_0x4943('0x40')](handleError(_0x5c8e07,null));};exports[_0x4943('0x20')]=function(_0x4d1a31,_0x350f55){if(_0x4d1a31[_0x4943('0x45')]['id']){delete _0x4d1a31['body']['id'];}return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x4d1a31['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x350f55,null))[_0x4943('0x21')](saveUpdates(_0x4d1a31[_0x4943('0x45')],null))['then'](respondWithResult(_0x350f55,null))[_0x4943('0x40')](handleError(_0x350f55,null));};exports['destroy']=function(_0x51636a,_0x1f4f57){return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x51636a['params']['id']}})['then'](handleEntityNotFound(_0x1f4f57,null))['then'](removeEntity(_0x1f4f57,null))[_0x4943('0x40')](handleError(_0x1f4f57,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(_0x2891c2,_0xd7df0){var _0x373d3b=function(_0x44407b){while(--_0x44407b){_0x2891c2['push'](_0x2891c2['shift']());}};_0x373d3b(++_0xd7df0);}(_0x1bca,0xb6));var _0xa1bc=function(_0x350bb6,_0x2869d6){_0x350bb6=_0x350bb6-0x0;var _0x3350f9=_0x1bca[_0x350bb6];return _0x3350f9;};'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 dea6c54..fa5d3bc 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 _0x777f=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x47ae1f,_0x328d68){var _0x2a0233=function(_0x53dd41){while(--_0x53dd41){_0x47ae1f['push'](_0x47ae1f['shift']());}};_0x2a0233(++_0x328d68);}(_0x777f,0x9f));var _0xf777=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x777f[_0x5be7aa];return _0x215408;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fs=require('fs');var path=require(_0xf777('0x7'));var rimraf=require('rimraf');var config=require(_0xf777('0x8'));var attributes=require(_0xf777('0x9'));module['exports']=function(_0x5b7903,_0x5df5dc){return _0x5b7903[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'paranoid':![],'indexes':[{'name':_0xf777('0xd'),'fields':[_0xf777('0xe'),_0xf777('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd2=['FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x11b287,_0x261c40){var _0x3ba3e9=function(_0x387b41){while(--_0x387b41){_0x11b287['push'](_0x11b287['shift']());}};_0x3ba3e9(++_0x261c40);}(_0x0cd2,0x1cb));var _0x20cd=function(_0x4c293d,_0x2b8e6e){_0x4c293d=_0x4c293d-0x0;var _0x2b3f74=_0x0cd2[_0x4c293d];return _0x2b3f74;};'use strict';var _=require(_0x20cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20cd('0x1'));var moment=require(_0x20cd('0x2'));var BPromise=require(_0x20cd('0x3'));var rp=require(_0x20cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20cd('0x5'));var config=require(_0x20cd('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x20cd('0x7')]=function(_0x2171fb,_0x5af7b0){return _0x2171fb[_0x20cd('0x8')](_0x20cd('0x9'),attributes,{'tableName':_0x20cd('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x20cd('0xb'),_0x20cd('0xc')],'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 e9d4062..ef02402 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 _0x5504=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x4dbee1,_0x328a21){var _0x3a4426=function(_0xce5e19){while(--_0xce5e19){_0x4dbee1['push'](_0x4dbee1['shift']());}};_0x3a4426(++_0x328a21);}(_0x5504,0x1ec));var _0x4550=function(_0x26a84c,_0x5724a7){_0x26a84c=_0x26a84c-0x0;var _0xa7793f=_0x5504[_0x26a84c];return _0xa7793f;};'use strict';var _=require(_0x4550('0x0'));var util=require(_0x4550('0x1'));var moment=require('moment');var BPromise=require(_0x4550('0x2'));var rs=require(_0x4550('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4550('0x4'))['db'];var utils=require(_0x4550('0x5'));var logger=require(_0x4550('0x6'))(_0x4550('0x7'));var config=require('../../config/environment');var jayson=require(_0x4550('0x8'));var client=jayson[_0x4550('0x9')][_0x4550('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5018cd,_0x3688fa,_0x17b530){return new BPromise(function(_0xea6b81,_0x55f33b){return client['request'](_0x5018cd,_0x17b530)[_0x4550('0xb')](function(_0x19cf3b){logger[_0x4550('0xc')](_0x4550('0xd'),_0x3688fa,_0x4550('0xe'));logger['debug'](_0x4550('0xf'),_0x3688fa,'request\x20sent',JSON[_0x4550('0x10')](_0x19cf3b));if(_0x19cf3b[_0x4550('0x11')]){if(_0x19cf3b['error'][_0x4550('0x12')]===0x1f4){logger[_0x4550('0x11')](_0x4550('0xd'),_0x3688fa,_0x19cf3b[_0x4550('0x11')][_0x4550('0x13')]);return _0x55f33b(_0x19cf3b['error'][_0x4550('0x13')]);}logger['error'](_0x4550('0xd'),_0x3688fa,_0x19cf3b[_0x4550('0x11')][_0x4550('0x13')]);return _0xea6b81(_0x19cf3b[_0x4550('0x11')][_0x4550('0x13')]);}else{logger['info'](_0x4550('0xd'),_0x3688fa,_0x4550('0xe'));_0xea6b81(_0x19cf3b[_0x4550('0x14')][_0x4550('0x13')]);}})['catch'](function(_0x21f993){logger[_0x4550('0x11')](_0x4550('0xd'),_0x3688fa,_0x21f993);_0x55f33b(_0x21f993);});});} \ No newline at end of file +var _0x94dd=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x2e1a18,_0x34c93b){var _0x3dcb6a=function(_0x18ee1a){while(--_0x18ee1a){_0x2e1a18['push'](_0x2e1a18['shift']());}};_0x3dcb6a(++_0x34c93b);}(_0x94dd,0x80));var _0xd94d=function(_0x4052e0,_0x4b1428){_0x4052e0=_0x4052e0-0x0;var _0x19a313=_0x94dd[_0x4052e0];return _0x19a313;};'use strict';var _=require('lodash');var util=require(_0xd94d('0x0'));var moment=require(_0xd94d('0x1'));var BPromise=require(_0xd94d('0x2'));var rs=require(_0xd94d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd94d('0x4'))['db'];var utils=require(_0xd94d('0x5'));var logger=require(_0xd94d('0x6'))(_0xd94d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc9113,_0x5ee66c,_0x1b56f3){return new BPromise(function(_0x3817c6,_0x26d440){return client[_0xd94d('0x8')](_0xfc9113,_0x1b56f3)[_0xd94d('0x9')](function(_0x5937d0){logger['info'](_0xd94d('0xa'),_0x5ee66c,_0xd94d('0xb'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x5ee66c,_0xd94d('0xb'),JSON[_0xd94d('0xc')](_0x5937d0));if(_0x5937d0['error']){if(_0x5937d0['error']['code']===0x1f4){logger[_0xd94d('0xd')](_0xd94d('0xa'),_0x5ee66c,_0x5937d0['error'][_0xd94d('0xe')]);return _0x26d440(_0x5937d0[_0xd94d('0xd')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x5ee66c,_0x5937d0[_0xd94d('0xd')][_0xd94d('0xe')]);return _0x3817c6(_0x5937d0['error'][_0xd94d('0xe')]);}else{logger[_0xd94d('0xf')](_0xd94d('0xa'),_0x5ee66c,'request\x20sent');_0x3817c6(_0x5937d0[_0xd94d('0x10')][_0xd94d('0xe')]);}})[_0xd94d('0x11')](function(_0x3f80a1){logger[_0xd94d('0xd')](_0xd94d('0xa'),_0x5ee66c,_0x3f80a1);_0x26d440(_0x3f80a1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 65d7570..da34a03 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 _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x3fd4fb,_0x360428){var _0x4a8315=function(_0x39fcf2){while(--_0x39fcf2){_0x3fd4fb['push'](_0x3fd4fb['shift']());}};_0x4a8315(++_0x360428);}(_0xa478,0x136));var _0x8a47=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xa478[_0x51ac09];return _0x3f827d;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0x97c1=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getFields']);router[_0x197c('0xf')]('/',auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0xf')](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0x11')]);router[_0x197c('0x12')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x14')]);module[_0x197c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1e42dd8..3bcea1f 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 _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x41d0b3,_0x2e4749){var _0x37abc5=function(_0x5724db){while(--_0x5724db){_0x41d0b3['push'](_0x41d0b3['shift']());}};_0x37abc5(++_0x2e4749);}(_0x7708,0x188));var _0x8770=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x7708[_0x1e381c];return _0x9b5ea9;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3a6d=['exports','STRING','username','sequelize'];(function(_0x58c1ad,_0x349e71){var _0x22bddf=function(_0x2a6bb5){while(--_0x2a6bb5){_0x58c1ad['push'](_0x58c1ad['shift']());}};_0x22bddf(++_0x349e71);}(_0x3a6d,0x143));var _0xd3a6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3a6d[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'apiKey':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize[_0xd3a6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd3a6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index c0334f8..90e22d8 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 _0x878e=['VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','options','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','rimraf','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','name','map','FreshsalesAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge'];(function(_0x835cb7,_0x1e574d){var _0x3ef599=function(_0x2874f2){while(--_0x2874f2){_0x835cb7['push'](_0x835cb7['shift']());}};_0x3ef599(++_0x1e574d);}(_0x878e,0x9b));var _0xe878=function(_0x5b734b,_0x486a7f){_0x5b734b=_0x5b734b-0x0;var _0x2a15a3=_0x878e[_0x5b734b];return _0x2a15a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe878('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe878('0x1'));var rp=require('request-promise');var moment=require(_0xe878('0x2'));var BPromise=require(_0xe878('0x3'));var Mustache=require(_0xe878('0x4'));var util=require(_0xe878('0x5'));var path=require(_0xe878('0x6'));var sox=require(_0xe878('0x7'));var csv=require(_0xe878('0x8'));var ejs=require(_0xe878('0x9'));var fs=require('fs');var fs_extra=require(_0xe878('0xa'));var _=require(_0xe878('0xb'));var squel=require(_0xe878('0xc'));var crypto=require(_0xe878('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe878('0x8'));var querystring=require(_0xe878('0xe'));var Papa=require(_0xe878('0xf'));var Redis=require(_0xe878('0x10'));var authService=require(_0xe878('0x11'));var qs=require(_0xe878('0x12'));var as=require(_0xe878('0x13'));var hardwareService=require(_0xe878('0x14'));var logger=require(_0xe878('0x15'))('api');var utils=require(_0xe878('0x16'));var config=require(_0xe878('0x17'));var licenseUtil=require(_0xe878('0x18'));var db=require(_0xe878('0x19'))['db'];var integrations=require(_0xe878('0x1a'));function respondWithStatusCode(_0x122ebf,_0xf95eb){_0xf95eb=_0xf95eb||0xcc;return function(_0x1f6853){if(_0x1f6853){return _0x122ebf['sendStatus'](_0xf95eb);}return _0x122ebf[_0xe878('0x1b')](_0xf95eb)[_0xe878('0x1c')]();};}function respondWithResult(_0x53f170,_0x3fa822){_0x3fa822=_0x3fa822||0xc8;return function(_0x5a40fd){if(_0x5a40fd){return _0x53f170[_0xe878('0x1b')](_0x3fa822)[_0xe878('0x1d')](_0x5a40fd);}};}function respondWithFilteredResult(_0x323429,_0x29668b){return function(_0x4ee783){if(_0x4ee783){var _0x112cef=typeof _0x29668b[_0xe878('0x1e')]===_0xe878('0x1f')&&typeof _0x29668b[_0xe878('0x20')]===_0xe878('0x1f');var _0xcff154=_0x4ee783['count'];var _0x46e179=_0x112cef?0x0:_0x29668b[_0xe878('0x1e')];var _0x227bab=_0x112cef?_0x4ee783[_0xe878('0x21')]:_0x29668b[_0xe878('0x1e')]+_0x29668b[_0xe878('0x20')];var _0x3acbf2;if(_0x227bab>=_0xcff154){_0x227bab=_0xcff154;_0x3acbf2=0xc8;}else{_0x3acbf2=0xce;}_0x323429[_0xe878('0x1b')](_0x3acbf2);return _0x323429['set']('Content-Range',_0x46e179+'-'+_0x227bab+'/'+_0xcff154)[_0xe878('0x1d')](_0x4ee783);}return null;};}function patchUpdates(_0x28607b){return function(_0x50471a){try{jsonpatch[_0xe878('0x22')](_0x50471a,_0x28607b,!![]);}catch(_0x35799){return BPromise[_0xe878('0x23')](_0x35799);}return _0x50471a[_0xe878('0x24')]();};}function saveUpdates(_0x5da4d2,_0x3db4d2){return function(_0x29496d){if(_0x29496d){return _0x29496d[_0xe878('0x25')](_0x5da4d2)[_0xe878('0x26')](function(_0x2da0a4){return _0x2da0a4;});}return null;};}function removeEntity(_0x363581,_0x8e1dee){return function(_0x55c1f3){if(_0x55c1f3){return _0x55c1f3[_0xe878('0x27')]()[_0xe878('0x26')](function(){_0x363581[_0xe878('0x1b')](0xcc)[_0xe878('0x1c')]();});}};}function handleEntityNotFound(_0x40ab44,_0x1ad531){return function(_0x5574e4){if(!_0x5574e4){_0x40ab44[_0xe878('0x28')](0x194);}return _0x5574e4;};}function handleError(_0x52d936,_0x123ae6){_0x123ae6=_0x123ae6||0x1f4;return function(_0x4ea2a9){logger['error'](_0x4ea2a9['stack']);if(_0x4ea2a9[_0xe878('0x29')]){delete _0x4ea2a9['name'];}_0x52d936[_0xe878('0x1b')](_0x123ae6)['send'](_0x4ea2a9);};}exports['index']=function(_0xb3c9e8,_0x1daf9d){var _0x2d7541={},_0x10fc84={},_0x17bf34={'count':0x0,'rows':[]};var _0x439624=_[_0xe878('0x2a')](db[_0xe878('0x2b')]['rawAttributes'],function(_0x16fbe2){return{'name':_0x16fbe2[_0xe878('0x2c')],'type':_0x16fbe2[_0xe878('0x2d')][_0xe878('0x2e')]};});_0x10fc84['model']=_[_0xe878('0x2a')](_0x439624,_0xe878('0x29'));_0x10fc84[_0xe878('0x2f')]=_[_0xe878('0x30')](_0xb3c9e8[_0xe878('0x2f')]);_0x10fc84[_0xe878('0x31')]=_[_0xe878('0x32')](_0x10fc84[_0xe878('0x33')],_0x10fc84['query']);_0x2d7541[_0xe878('0x34')]=_[_0xe878('0x32')](_0x10fc84['model'],qs[_0xe878('0x35')](_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x35')]));_0x2d7541[_0xe878('0x34')]=_0x2d7541[_0xe878('0x34')][_0xe878('0x36')]?_0x2d7541[_0xe878('0x34')]:_0x10fc84[_0xe878('0x33')];if(!_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x37')]('nolimit')){_0x2d7541['limit']=qs[_0xe878('0x20')](_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x20')]);_0x2d7541[_0xe878('0x1e')]=qs[_0xe878('0x1e')](_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x1e')]);}_0x2d7541[_0xe878('0x38')]=qs['sort'](_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x39')]);_0x2d7541[_0xe878('0x3a')]=qs[_0xe878('0x31')](_[_0xe878('0x3b')](_0xb3c9e8[_0xe878('0x2f')],_0x10fc84[_0xe878('0x31')]),_0x439624);if(_0xb3c9e8[_0xe878('0x2f')]['filter']){_0x2d7541[_0xe878('0x3a')]=_[_0xe878('0x3c')](_0x2d7541[_0xe878('0x3a')],{'$or':_[_0xe878('0x2a')](_0x439624,function(_0x345846){if(_0x345846[_0xe878('0x2d')]!==_0xe878('0x3d')){var _0x122281={};_0x122281[_0x345846[_0xe878('0x29')]]={'$like':'%'+_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x3e')]+'%'};return _0x122281;}})});}_0x2d7541=_['merge']({},_0x2d7541,_0xb3c9e8['options']);var _0x37a225={'where':_0x2d7541[_0xe878('0x3a')]};return db[_0xe878('0x2b')][_0xe878('0x21')](_0x37a225)[_0xe878('0x26')](function(_0x1e68a1){_0x17bf34[_0xe878('0x21')]=_0x1e68a1;if(_0xb3c9e8[_0xe878('0x2f')][_0xe878('0x3f')]){_0x2d7541[_0xe878('0x40')]=[{'all':!![]}];}return db[_0xe878('0x2b')][_0xe878('0x41')](_0x2d7541);})['then'](function(_0x3fdb08){_0x17bf34[_0xe878('0x42')]=_0x3fdb08;return _0x17bf34;})[_0xe878('0x26')](respondWithFilteredResult(_0x1daf9d,_0x2d7541))[_0xe878('0x43')](handleError(_0x1daf9d,null));};exports[_0xe878('0x44')]=function(_0x217cc7,_0x5354c2){var _0x5ff123={'raw':![],'where':{'id':_0x217cc7[_0xe878('0x45')]['id']}},_0x2865ae={};_0x2865ae['model']=_[_0xe878('0x30')](db[_0xe878('0x2b')][_0xe878('0x46')]);_0x2865ae[_0xe878('0x2f')]=_['keys'](_0x217cc7[_0xe878('0x2f')]);_0x2865ae[_0xe878('0x31')]=_[_0xe878('0x32')](_0x2865ae[_0xe878('0x33')],_0x2865ae[_0xe878('0x2f')]);_0x5ff123['attributes']=_[_0xe878('0x32')](_0x2865ae[_0xe878('0x33')],qs[_0xe878('0x35')](_0x217cc7[_0xe878('0x2f')][_0xe878('0x35')]));_0x5ff123[_0xe878('0x34')]=_0x5ff123[_0xe878('0x34')][_0xe878('0x36')]?_0x5ff123['attributes']:_0x2865ae[_0xe878('0x33')];if(_0x217cc7[_0xe878('0x2f')][_0xe878('0x3f')]){_0x5ff123[_0xe878('0x40')]=[{'all':!![]}];}_0x5ff123=_['merge']({},_0x5ff123,_0x217cc7['options']);return db[_0xe878('0x2b')][_0xe878('0x47')](_0x5ff123)['then'](handleEntityNotFound(_0x5354c2,null))['then'](respondWithResult(_0x5354c2,null))[_0xe878('0x43')](handleError(_0x5354c2,null));};exports[_0xe878('0x48')]=function(_0x4d85d1,_0x25dfa7){return db['FreshsalesAccount'][_0xe878('0x48')](_0x4d85d1[_0xe878('0x49')],{})['then'](respondWithResult(_0x25dfa7,0xc9))[_0xe878('0x43')](handleError(_0x25dfa7,null));};exports[_0xe878('0x25')]=function(_0xdb4f32,_0x2cdf3b){if(_0xdb4f32['body']['id']){delete _0xdb4f32[_0xe878('0x49')]['id'];}return db[_0xe878('0x2b')][_0xe878('0x47')]({'where':{'id':_0xdb4f32[_0xe878('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cdf3b,null))[_0xe878('0x26')](saveUpdates(_0xdb4f32[_0xe878('0x49')],null))[_0xe878('0x26')](respondWithResult(_0x2cdf3b,null))['catch'](handleError(_0x2cdf3b,null));};exports[_0xe878('0x27')]=function(_0x43ade9,_0x156448){return db[_0xe878('0x2b')][_0xe878('0x47')]({'where':{'id':_0x43ade9[_0xe878('0x45')]['id']}})[_0xe878('0x26')](handleEntityNotFound(_0x156448,null))[_0xe878('0x26')](removeEntity(_0x156448,null))['catch'](handleError(_0x156448,null));};exports[_0xe878('0x4a')]=function(_0x596deb,_0x208990,_0x272b2e){var _0x183c32={};var _0x5bbf8d={};var _0x15195a;var _0x5ec01b;return db[_0xe878('0x2b')][_0xe878('0x4b')]({'where':{'id':_0x596deb['params']['id']}})[_0xe878('0x26')](handleEntityNotFound(_0x208990,null))[_0xe878('0x26')](function(_0x3f8115){if(_0x3f8115){_0x15195a=_0x3f8115;_0x5bbf8d[_0xe878('0x33')]=_[_0xe878('0x30')](db[_0xe878('0x4c')][_0xe878('0x46')]);_0x5bbf8d[_0xe878('0x2f')]=_['keys'](_0x596deb[_0xe878('0x2f')]);_0x5bbf8d[_0xe878('0x31')]=_[_0xe878('0x32')](_0x5bbf8d[_0xe878('0x33')],_0x5bbf8d[_0xe878('0x2f')]);_0x183c32[_0xe878('0x34')]=_['intersection'](_0x5bbf8d[_0xe878('0x33')],qs['fields'](_0x596deb[_0xe878('0x2f')][_0xe878('0x35')]));_0x183c32[_0xe878('0x34')]=_0x183c32[_0xe878('0x34')][_0xe878('0x36')]?_0x183c32[_0xe878('0x34')]:_0x5bbf8d[_0xe878('0x33')];_0x183c32[_0xe878('0x38')]=qs['sort'](_0x596deb[_0xe878('0x2f')][_0xe878('0x39')]);_0x183c32[_0xe878('0x3a')]=qs[_0xe878('0x31')](_[_0xe878('0x3b')](_0x596deb[_0xe878('0x2f')],_0x5bbf8d['filters']));if(_0x596deb[_0xe878('0x2f')][_0xe878('0x3e')]){_0x183c32['where']=_[_0xe878('0x3c')](_0x183c32[_0xe878('0x3a')],{'$or':_[_0xe878('0x2a')](_0x183c32[_0xe878('0x34')],function(_0x399e51){var _0x46d6c9={};_0x46d6c9[_0x399e51]={'$like':'%'+_0x596deb['query'][_0xe878('0x3e')]+'%'};return _0x46d6c9;})});}_0x183c32=_[_0xe878('0x3c')]({},_0x183c32,_0x596deb[_0xe878('0x4d')]);return _0x15195a[_0xe878('0x4a')](_0x183c32);}})[_0xe878('0x26')](function(_0x5c7b5e){if(_0x5c7b5e){_0x5ec01b=_0x5c7b5e[_0xe878('0x36')];if(!_0x596deb['query'][_0xe878('0x37')](_0xe878('0x4e'))){_0x183c32[_0xe878('0x20')]=qs['limit'](_0x596deb['query'][_0xe878('0x20')]);_0x183c32['offset']=qs['offset'](_0x596deb[_0xe878('0x2f')][_0xe878('0x1e')]);}return _0x15195a['getConfigurations'](_0x183c32);}})[_0xe878('0x26')](function(_0x293af5){if(_0x293af5){return _0x293af5?{'count':_0x5ec01b,'rows':_0x293af5}:null;}})[_0xe878('0x26')](respondWithResult(_0x208990,null))[_0xe878('0x43')](handleError(_0x208990,null));};exports['addConfiguration']=function(_0x9af1bd,_0x5206c9,_0x535dcd){if(_0x9af1bd[_0xe878('0x49')]['id']){delete _0x9af1bd[_0xe878('0x49')]['id'];}return db['FreshsalesAccount'][_0xe878('0x4b')]({'where':{'id':_0x9af1bd[_0xe878('0x45')]['id']}})[_0xe878('0x26')](handleEntityNotFound(_0x5206c9,null))['then'](function(_0x1009c0){if(_0x1009c0){_0x9af1bd[_0xe878('0x49')][_0xe878('0x4f')]=_0x1009c0['id'];_0x9af1bd[_0xe878('0x49')][_0xe878('0x50')]=integrations[_0xe878('0x51')](_0x9af1bd[_0xe878('0x49')][_0xe878('0x52')],_0x9af1bd[_0xe878('0x49')][_0xe878('0x2d')]);_0x9af1bd[_0xe878('0x49')][_0xe878('0x53')]=integrations[_0xe878('0x54')](_0x9af1bd[_0xe878('0x49')][_0xe878('0x52')],_0x9af1bd[_0xe878('0x49')][_0xe878('0x2d')]);return db['FreshsalesConfiguration'][_0xe878('0x48')](_0x9af1bd[_0xe878('0x49')],{'include':[{'model':db[_0xe878('0x55')],'as':_0xe878('0x50')},{'model':db[_0xe878('0x55')],'as':_0xe878('0x53')}]});}return null;})[_0xe878('0x26')](respondWithResult(_0x5206c9,null))[_0xe878('0x43')](handleError(_0x5206c9,null));};exports['getFields']=function(_0x362e90,_0x1b4de4,_0x5b19dc){var _0x45e2ad='';var _0x4c97da='';return db[_0xe878('0x2b')][_0xe878('0x4b')]({'where':{'id':_0x362e90[_0xe878('0x45')]['id']},'attributes':['id',_0xe878('0x56'),'remoteUri',_0xe878('0x57')]})[_0xe878('0x26')](handleEntityNotFound(_0x1b4de4,null))[_0xe878('0x26')](function(_0x3d4582){if(_0x3d4582){_0x4c97da=_0x3d4582['username'];_0x45e2ad=_0x3d4582[_0xe878('0x58')];var _0x112af9=_0x3d4582[_0xe878('0x58')][_0xe878('0x59')](-0x1);if(_0x112af9==='/'){_0x45e2ad=_0x45e2ad[_0xe878('0x5a')](0x0,_0x45e2ad[_0xe878('0x5b')](_0x112af9));}return rp({'method':_0xe878('0x5c'),'uri':util[_0xe878('0x5d')](_0xe878('0x5e'),_0x45e2ad,_0xe878('0x5f')),'headers':{'Authorization':_0xe878('0x60')+_0x3d4582['apiKey']},'json':!![]});}})[_0xe878('0x26')](function(_0x5970e6){if(_0x5970e6){var _0x4481b4=_0x5970e6[_0xe878('0x61')];var _0x2385dd=![];var _0x5476ae=null;for(_0x5476ae=0x0;_0x5476ae<_0x4481b4[_0xe878('0x36')];_0x5476ae++){if(_0x4481b4[_0x5476ae][_0xe878('0x62')]===_0x4c97da){_0x2385dd=!![];}}if(_0x2385dd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe878('0x63')});}}})[_0xe878('0x26')](respondWithResult(_0x1b4de4,null))['catch'](function(_0x55da8a){var _0x8deeae=_0x362e90['query']['test']?0x1f4:_0x55da8a[_0xe878('0x64')]||0x1f4;logger[_0xe878('0x65')](_0xe878('0x66'),_0xe878('0x67'),_0x8deeae,JSON[_0xe878('0x68')](_0x55da8a));delete _0x55da8a[_0xe878('0x29')];if(_0x8deeae===0x191){_0x8deeae=0x190;}_0x1b4de4['status'](_0x8deeae)[_0xe878('0x69')](_0x362e90[_0xe878('0x2f')][_0xe878('0x6a')]?{'message':_0xe878('0x6b'),'statusCode':_0x55da8a[_0xe878('0x64')]}:_0x55da8a);});}; \ No newline at end of file +var _0x7cf9=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','update','findOne','FreshsalesConfiguration','pick','options','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','model','query'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x7cf9,0x9f));var _0x97cf=function(_0x2e616e,_0x42f760){_0x2e616e=_0x2e616e-0x0;var _0x5d3228=_0x7cf9[_0x2e616e];return _0x5d3228;};'use strict';var emlformat=require(_0x97cf('0x0'));var rimraf=require(_0x97cf('0x1'));var zipdir=require(_0x97cf('0x2'));var jsonpatch=require(_0x97cf('0x3'));var rp=require(_0x97cf('0x4'));var moment=require(_0x97cf('0x5'));var BPromise=require(_0x97cf('0x6'));var Mustache=require('mustache');var util=require(_0x97cf('0x7'));var path=require(_0x97cf('0x8'));var sox=require(_0x97cf('0x9'));var csv=require(_0x97cf('0xa'));var ejs=require(_0x97cf('0xb'));var fs=require('fs');var fs_extra=require(_0x97cf('0xc'));var _=require(_0x97cf('0xd'));var squel=require(_0x97cf('0xe'));var crypto=require(_0x97cf('0xf'));var jsforce=require(_0x97cf('0x10'));var deskjs=require(_0x97cf('0x11'));var toCsv=require(_0x97cf('0xa'));var querystring=require(_0x97cf('0x12'));var Papa=require(_0x97cf('0x13'));var Redis=require(_0x97cf('0x14'));var authService=require(_0x97cf('0x15'));var qs=require(_0x97cf('0x16'));var as=require(_0x97cf('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97cf('0x18'))('api');var utils=require(_0x97cf('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x97cf('0x1a'))['db'];var integrations=require(_0x97cf('0x1b'));function respondWithStatusCode(_0x5a627a,_0x556b1c){_0x556b1c=_0x556b1c||0xcc;return function(_0x1e01ac){if(_0x1e01ac){return _0x5a627a[_0x97cf('0x1c')](_0x556b1c);}return _0x5a627a[_0x97cf('0x1d')](_0x556b1c)[_0x97cf('0x1e')]();};}function respondWithResult(_0x1cf17e,_0x32ba10){_0x32ba10=_0x32ba10||0xc8;return function(_0xb2591b){if(_0xb2591b){return _0x1cf17e[_0x97cf('0x1d')](_0x32ba10)[_0x97cf('0x1f')](_0xb2591b);}};}function respondWithFilteredResult(_0x150378,_0xd4f8c1){return function(_0x1885bf){if(_0x1885bf){var _0x1e8409=typeof _0xd4f8c1['offset']==='undefined'&&typeof _0xd4f8c1['limit']===_0x97cf('0x20');var _0x31bb1b=_0x1885bf['count'];var _0x2dd328=_0x1e8409?0x0:_0xd4f8c1[_0x97cf('0x21')];var _0x11a20e=_0x1e8409?_0x1885bf[_0x97cf('0x22')]:_0xd4f8c1[_0x97cf('0x21')]+_0xd4f8c1[_0x97cf('0x23')];var _0x31c9b5;if(_0x11a20e>=_0x31bb1b){_0x11a20e=_0x31bb1b;_0x31c9b5=0xc8;}else{_0x31c9b5=0xce;}_0x150378[_0x97cf('0x1d')](_0x31c9b5);return _0x150378[_0x97cf('0x24')](_0x97cf('0x25'),_0x2dd328+'-'+_0x11a20e+'/'+_0x31bb1b)[_0x97cf('0x1f')](_0x1885bf);}return null;};}function patchUpdates(_0x5ceb69){return function(_0x58009d){try{jsonpatch[_0x97cf('0x26')](_0x58009d,_0x5ceb69,!![]);}catch(_0xe3e8d0){return BPromise[_0x97cf('0x27')](_0xe3e8d0);}return _0x58009d[_0x97cf('0x28')]();};}function saveUpdates(_0x6add8d,_0x23b313){return function(_0x285fc8){if(_0x285fc8){return _0x285fc8['update'](_0x6add8d)[_0x97cf('0x29')](function(_0x3b5fe9){return _0x3b5fe9;});}return null;};}function removeEntity(_0x9602ec,_0x495855){return function(_0x220a32){if(_0x220a32){return _0x220a32[_0x97cf('0x2a')]()[_0x97cf('0x29')](function(){_0x9602ec[_0x97cf('0x1d')](0xcc)[_0x97cf('0x1e')]();});}};}function handleEntityNotFound(_0x4c6d01,_0x2fd101){return function(_0x5d8971){if(!_0x5d8971){_0x4c6d01[_0x97cf('0x1c')](0x194);}return _0x5d8971;};}function handleError(_0x4398b3,_0x3b6701){_0x3b6701=_0x3b6701||0x1f4;return function(_0x3f3a63){logger[_0x97cf('0x2b')](_0x3f3a63[_0x97cf('0x2c')]);if(_0x3f3a63[_0x97cf('0x2d')]){delete _0x3f3a63[_0x97cf('0x2d')];}_0x4398b3[_0x97cf('0x1d')](_0x3b6701)[_0x97cf('0x2e')](_0x3f3a63);};}exports[_0x97cf('0x2f')]=function(_0x37e3fe,_0x2df5f7){var _0x12620d={},_0x44f52c={},_0x4fab21={'count':0x0,'rows':[]};var _0x4d358f=_[_0x97cf('0x30')](db[_0x97cf('0x31')]['rawAttributes'],function(_0x4c2e63){return{'name':_0x4c2e63[_0x97cf('0x32')],'type':_0x4c2e63['type']['key']};});_0x44f52c[_0x97cf('0x33')]=_[_0x97cf('0x30')](_0x4d358f,'name');_0x44f52c[_0x97cf('0x34')]=_[_0x97cf('0x35')](_0x37e3fe['query']);_0x44f52c[_0x97cf('0x36')]=_[_0x97cf('0x37')](_0x44f52c[_0x97cf('0x33')],_0x44f52c['query']);_0x12620d[_0x97cf('0x38')]=_['intersection'](_0x44f52c[_0x97cf('0x33')],qs[_0x97cf('0x39')](_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x39')]));_0x12620d[_0x97cf('0x38')]=_0x12620d[_0x97cf('0x38')][_0x97cf('0x3a')]?_0x12620d[_0x97cf('0x38')]:_0x44f52c[_0x97cf('0x33')];if(!_0x37e3fe[_0x97cf('0x34')]['hasOwnProperty'](_0x97cf('0x3b'))){_0x12620d[_0x97cf('0x23')]=qs['limit'](_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x23')]);_0x12620d[_0x97cf('0x21')]=qs[_0x97cf('0x21')](_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x21')]);}_0x12620d[_0x97cf('0x3c')]=qs[_0x97cf('0x3d')](_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x3d')]);_0x12620d[_0x97cf('0x3e')]=qs[_0x97cf('0x36')](_['pick'](_0x37e3fe[_0x97cf('0x34')],_0x44f52c['filters']),_0x4d358f);if(_0x37e3fe['query'][_0x97cf('0x3f')]){_0x12620d[_0x97cf('0x3e')]=_[_0x97cf('0x40')](_0x12620d['where'],{'$or':_[_0x97cf('0x30')](_0x4d358f,function(_0x9eef19){if(_0x9eef19[_0x97cf('0x41')]!==_0x97cf('0x42')){var _0x4b3114={};_0x4b3114[_0x9eef19['name']]={'$like':'%'+_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x3f')]+'%'};return _0x4b3114;}})});}_0x12620d=_[_0x97cf('0x40')]({},_0x12620d,_0x37e3fe['options']);var _0x202ddd={'where':_0x12620d[_0x97cf('0x3e')]};return db[_0x97cf('0x31')][_0x97cf('0x22')](_0x202ddd)[_0x97cf('0x29')](function(_0x2a0f3d){_0x4fab21[_0x97cf('0x22')]=_0x2a0f3d;if(_0x37e3fe[_0x97cf('0x34')][_0x97cf('0x43')]){_0x12620d[_0x97cf('0x44')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x97cf('0x45')](_0x12620d);})[_0x97cf('0x29')](function(_0x5cf4bc){_0x4fab21[_0x97cf('0x46')]=_0x5cf4bc;return _0x4fab21;})['then'](respondWithFilteredResult(_0x2df5f7,_0x12620d))['catch'](handleError(_0x2df5f7,null));};exports['show']=function(_0x32d588,_0x142449){var _0x24b4d9={'raw':![],'where':{'id':_0x32d588[_0x97cf('0x47')]['id']}},_0xc8821d={};_0xc8821d[_0x97cf('0x33')]=_[_0x97cf('0x35')](db[_0x97cf('0x31')][_0x97cf('0x48')]);_0xc8821d[_0x97cf('0x34')]=_[_0x97cf('0x35')](_0x32d588[_0x97cf('0x34')]);_0xc8821d[_0x97cf('0x36')]=_['intersection'](_0xc8821d['model'],_0xc8821d[_0x97cf('0x34')]);_0x24b4d9[_0x97cf('0x38')]=_[_0x97cf('0x37')](_0xc8821d['model'],qs[_0x97cf('0x39')](_0x32d588['query'][_0x97cf('0x39')]));_0x24b4d9[_0x97cf('0x38')]=_0x24b4d9[_0x97cf('0x38')][_0x97cf('0x3a')]?_0x24b4d9[_0x97cf('0x38')]:_0xc8821d[_0x97cf('0x33')];if(_0x32d588['query'][_0x97cf('0x43')]){_0x24b4d9[_0x97cf('0x44')]=[{'all':!![]}];}_0x24b4d9=_['merge']({},_0x24b4d9,_0x32d588['options']);return db[_0x97cf('0x31')][_0x97cf('0x49')](_0x24b4d9)[_0x97cf('0x29')](handleEntityNotFound(_0x142449,null))[_0x97cf('0x29')](respondWithResult(_0x142449,null))[_0x97cf('0x4a')](handleError(_0x142449,null));};exports[_0x97cf('0x4b')]=function(_0x110d62,_0x3c4e2b){return db['FreshsalesAccount']['create'](_0x110d62[_0x97cf('0x4c')],{})[_0x97cf('0x29')](respondWithResult(_0x3c4e2b,0xc9))[_0x97cf('0x4a')](handleError(_0x3c4e2b,null));};exports[_0x97cf('0x4d')]=function(_0xafc9bb,_0x5890ac){if(_0xafc9bb['body']['id']){delete _0xafc9bb[_0x97cf('0x4c')]['id'];}return db[_0x97cf('0x31')]['find']({'where':{'id':_0xafc9bb[_0x97cf('0x47')]['id']}})[_0x97cf('0x29')](handleEntityNotFound(_0x5890ac,null))[_0x97cf('0x29')](saveUpdates(_0xafc9bb[_0x97cf('0x4c')],null))[_0x97cf('0x29')](respondWithResult(_0x5890ac,null))[_0x97cf('0x4a')](handleError(_0x5890ac,null));};exports[_0x97cf('0x2a')]=function(_0x456779,_0x1249a8){return db[_0x97cf('0x31')][_0x97cf('0x49')]({'where':{'id':_0x456779[_0x97cf('0x47')]['id']}})[_0x97cf('0x29')](handleEntityNotFound(_0x1249a8,null))['then'](removeEntity(_0x1249a8,null))[_0x97cf('0x4a')](handleError(_0x1249a8,null));};exports['getConfigurations']=function(_0x117e25,_0x486b9e,_0x3954ff){var _0x2bc441={};var _0x5f1c49={};var _0x1b9c4f;var _0x4e1075;return db[_0x97cf('0x31')][_0x97cf('0x4e')]({'where':{'id':_0x117e25[_0x97cf('0x47')]['id']}})[_0x97cf('0x29')](handleEntityNotFound(_0x486b9e,null))['then'](function(_0x2567cc){if(_0x2567cc){_0x1b9c4f=_0x2567cc;_0x5f1c49[_0x97cf('0x33')]=_[_0x97cf('0x35')](db[_0x97cf('0x4f')][_0x97cf('0x48')]);_0x5f1c49[_0x97cf('0x34')]=_[_0x97cf('0x35')](_0x117e25[_0x97cf('0x34')]);_0x5f1c49[_0x97cf('0x36')]=_[_0x97cf('0x37')](_0x5f1c49[_0x97cf('0x33')],_0x5f1c49[_0x97cf('0x34')]);_0x2bc441[_0x97cf('0x38')]=_[_0x97cf('0x37')](_0x5f1c49[_0x97cf('0x33')],qs['fields'](_0x117e25[_0x97cf('0x34')][_0x97cf('0x39')]));_0x2bc441[_0x97cf('0x38')]=_0x2bc441[_0x97cf('0x38')][_0x97cf('0x3a')]?_0x2bc441['attributes']:_0x5f1c49[_0x97cf('0x33')];_0x2bc441['order']=qs[_0x97cf('0x3d')](_0x117e25[_0x97cf('0x34')][_0x97cf('0x3d')]);_0x2bc441[_0x97cf('0x3e')]=qs['filters'](_[_0x97cf('0x50')](_0x117e25[_0x97cf('0x34')],_0x5f1c49[_0x97cf('0x36')]));if(_0x117e25[_0x97cf('0x34')][_0x97cf('0x3f')]){_0x2bc441[_0x97cf('0x3e')]=_[_0x97cf('0x40')](_0x2bc441[_0x97cf('0x3e')],{'$or':_[_0x97cf('0x30')](_0x2bc441[_0x97cf('0x38')],function(_0x5ce052){var _0x32c4fb={};_0x32c4fb[_0x5ce052]={'$like':'%'+_0x117e25['query']['filter']+'%'};return _0x32c4fb;})});}_0x2bc441=_[_0x97cf('0x40')]({},_0x2bc441,_0x117e25[_0x97cf('0x51')]);return _0x1b9c4f[_0x97cf('0x52')](_0x2bc441);}})[_0x97cf('0x29')](function(_0x3fb00a){if(_0x3fb00a){_0x4e1075=_0x3fb00a[_0x97cf('0x3a')];if(!_0x117e25[_0x97cf('0x34')][_0x97cf('0x53')](_0x97cf('0x3b'))){_0x2bc441[_0x97cf('0x23')]=qs['limit'](_0x117e25[_0x97cf('0x34')][_0x97cf('0x23')]);_0x2bc441['offset']=qs[_0x97cf('0x21')](_0x117e25[_0x97cf('0x34')][_0x97cf('0x21')]);}return _0x1b9c4f['getConfigurations'](_0x2bc441);}})[_0x97cf('0x29')](function(_0x17795c){if(_0x17795c){return _0x17795c?{'count':_0x4e1075,'rows':_0x17795c}:null;}})['then'](respondWithResult(_0x486b9e,null))['catch'](handleError(_0x486b9e,null));};exports[_0x97cf('0x54')]=function(_0x26910d,_0x231f4f,_0x54cc04){if(_0x26910d[_0x97cf('0x4c')]['id']){delete _0x26910d[_0x97cf('0x4c')]['id'];}return db[_0x97cf('0x31')][_0x97cf('0x4e')]({'where':{'id':_0x26910d[_0x97cf('0x47')]['id']}})[_0x97cf('0x29')](handleEntityNotFound(_0x231f4f,null))['then'](function(_0x586e0e){if(_0x586e0e){_0x26910d[_0x97cf('0x4c')][_0x97cf('0x55')]=_0x586e0e['id'];_0x26910d[_0x97cf('0x4c')]['Subjects']=integrations[_0x97cf('0x56')](_0x26910d[_0x97cf('0x4c')][_0x97cf('0x57')],_0x26910d[_0x97cf('0x4c')]['type']);_0x26910d['body']['Descriptions']=integrations[_0x97cf('0x58')](_0x26910d[_0x97cf('0x4c')]['channel'],_0x26910d[_0x97cf('0x4c')][_0x97cf('0x41')]);return db[_0x97cf('0x4f')][_0x97cf('0x4b')](_0x26910d['body'],{'include':[{'model':db[_0x97cf('0x59')],'as':'Subjects'},{'model':db[_0x97cf('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x231f4f,null))[_0x97cf('0x4a')](handleError(_0x231f4f,null));};exports[_0x97cf('0x5a')]=function(_0x293e41,_0x3872ac,_0x1ca4ed){var _0x1c37a2='';var _0x6df671='';return db[_0x97cf('0x31')][_0x97cf('0x4e')]({'where':{'id':_0x293e41[_0x97cf('0x47')]['id']},'attributes':['id','username',_0x97cf('0x5b'),_0x97cf('0x5c')]})[_0x97cf('0x29')](handleEntityNotFound(_0x3872ac,null))[_0x97cf('0x29')](function(_0x5b384c){if(_0x5b384c){_0x6df671=_0x5b384c[_0x97cf('0x5d')];_0x1c37a2=_0x5b384c[_0x97cf('0x5b')];var _0x220e53=_0x5b384c[_0x97cf('0x5b')]['slice'](-0x1);if(_0x220e53==='/'){_0x1c37a2=_0x1c37a2[_0x97cf('0x5e')](0x0,_0x1c37a2[_0x97cf('0x5f')](_0x220e53));}return rp({'method':'GET','uri':util[_0x97cf('0x60')](_0x97cf('0x61'),_0x1c37a2,_0x97cf('0x62')),'headers':{'Authorization':_0x97cf('0x63')+_0x5b384c[_0x97cf('0x5c')]},'json':!![]});}})[_0x97cf('0x29')](function(_0x49750b){if(_0x49750b){var _0x1bc60e=_0x49750b[_0x97cf('0x64')];var _0xd58d5a=![];var _0x3f0770=null;for(_0x3f0770=0x0;_0x3f0770<_0x1bc60e[_0x97cf('0x3a')];_0x3f0770++){if(_0x1bc60e[_0x3f0770][_0x97cf('0x65')]===_0x6df671){_0xd58d5a=!![];}}if(_0xd58d5a){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x3872ac,null))[_0x97cf('0x4a')](function(_0x31908b){var _0x5bdf79=_0x293e41[_0x97cf('0x34')]['test']?0x1f4:_0x31908b[_0x97cf('0x66')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x97cf('0x5a'),_0x5bdf79,JSON[_0x97cf('0x67')](_0x31908b));delete _0x31908b['name'];if(_0x5bdf79===0x191){_0x5bdf79=0x190;}_0x3872ac['status'](_0x5bdf79)[_0x97cf('0x2e')](_0x293e41['query'][_0x97cf('0x68')]?{'message':_0x97cf('0x69'),'statusCode':_0x31908b[_0x97cf('0x66')]}:_0x31908b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c79a5db..9f1129b 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 _0xe2fe=['define','int_freshsales_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x189889,_0x253e7b){var _0x556e13=function(_0x301e31){while(--_0x301e31){_0x189889['push'](_0x189889['shift']());}};_0x556e13(++_0x253e7b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['rimraf','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2c6eec,_0x174533){var _0x27eda4=function(_0x2166bd){while(--_0x2166bd){_0x2c6eec['push'](_0x2c6eec['shift']());}};_0x27eda4(++_0x174533);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2f9e6a,_0x196fdc){_0x2f9e6a=_0x2f9e6a-0x0;var _0x766f0c=_0xc1c6[_0x2f9e6a];return _0x766f0c;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'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 6de883f..fb95fe9 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 _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x95d45,_0x4bb3f1){var _0x38086f=function(_0x344b59){while(--_0x344b59){_0x95d45['push'](_0x95d45['shift']());}};_0x38086f(++_0x4bb3f1);}(_0xef0f,0x168));var _0xfef0=function(_0x7b9970,_0x5e2161){_0x7b9970=_0x7b9970-0x0;var _0x368eaf=_0xef0f[_0x7b9970];return _0x368eaf;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});}; \ No newline at end of file +var _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x18c01a,_0x432a72){_0x18c01a=_0x18c01a-0x0;var _0x378ed9=_0x4975[_0x18c01a];return _0x378ed9;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index cea02e0..05be3d3 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 _0x5c99=['/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x5c99,0x107));var _0x95c9=function(_0x34bd11,_0x322433){_0x34bd11=_0x34bd11-0x0;var _0x2a4f5c=_0x5c99[_0x34bd11];return _0x2a4f5c;};'use strict';var multer=require('multer');var util=require(_0x95c9('0x0'));var path=require('path');var timeout=require(_0x95c9('0x1'));var express=require(_0x95c9('0x2'));var router=express[_0x95c9('0x3')]();var fs_extra=require(_0x95c9('0x4'));var auth=require(_0x95c9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x95c9('0x6'));router[_0x95c9('0x7')]('/',auth[_0x95c9('0x8')](),controller[_0x95c9('0x9')]);router[_0x95c9('0x7')](_0x95c9('0xa'),auth[_0x95c9('0x8')](),controller[_0x95c9('0xb')]);router[_0x95c9('0x7')](_0x95c9('0xc'),auth[_0x95c9('0x8')](),controller[_0x95c9('0xd')]);router[_0x95c9('0x7')](_0x95c9('0xe'),auth[_0x95c9('0x8')](),controller[_0x95c9('0xf')]);router[_0x95c9('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x95c9('0x10')]);router[_0x95c9('0x11')]('/',auth['isAuthenticated'](),controller[_0x95c9('0x12')]);router['put'](_0x95c9('0xa'),auth[_0x95c9('0x8')](),controller[_0x95c9('0x13')]);router[_0x95c9('0x14')](_0x95c9('0xa'),auth[_0x95c9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x90e5=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x13d645,_0x1158fe){var _0x58aada=function(_0x2615c0){while(--_0x2615c0){_0x13d645['push'](_0x13d645['shift']());}};_0x58aada(++_0x1158fe);}(_0x90e5,0xf6));var _0x590e=function(_0x1b2e78,_0x509fe0){_0x1b2e78=_0x1b2e78-0x0;var _0x4eb4e5=_0x90e5[_0x1b2e78];return _0x4eb4e5;};'use strict';var multer=require(_0x590e('0x0'));var util=require(_0x590e('0x1'));var path=require(_0x590e('0x2'));var timeout=require(_0x590e('0x3'));var express=require('express');var router=express[_0x590e('0x4')]();var fs_extra=require(_0x590e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x590e('0x6'));var controller=require(_0x590e('0x7'));router[_0x590e('0x8')]('/',auth[_0x590e('0x9')](),controller[_0x590e('0xa')]);router[_0x590e('0x8')](_0x590e('0xb'),auth[_0x590e('0x9')](),controller['show']);router['get'](_0x590e('0xc'),auth[_0x590e('0x9')](),controller[_0x590e('0xd')]);router['get'](_0x590e('0xe'),auth[_0x590e('0x9')](),controller[_0x590e('0xf')]);router[_0x590e('0x8')](_0x590e('0x10'),auth[_0x590e('0x9')](),controller[_0x590e('0x11')]);router[_0x590e('0x12')]('/',auth[_0x590e('0x9')](),controller[_0x590e('0x13')]);router[_0x590e('0x14')](_0x590e('0xb'),auth[_0x590e('0x9')](),controller[_0x590e('0x15')]);router['delete'](_0x590e('0xb'),auth[_0x590e('0x9')](),controller[_0x590e('0x16')]);module[_0x590e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6d5425c..d1d0495 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 _0x756d=['exports','STRING'];(function(_0x5e8aeb,_0x18f178){var _0x15b364=function(_0x20c4a7){while(--_0x20c4a7){_0x5e8aeb['push'](_0x5e8aeb['shift']());}};_0x15b364(++_0x18f178);}(_0x756d,0x140));var _0xd756=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x756d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0xd756('0x0')]={'name':{'type':Sequelize[_0xd756('0x1')]},'description':{'type':Sequelize[_0xd756('0x1')]}}; \ No newline at end of file +var _0xa0d3=['STRING','exports'];(function(_0x459867,_0x4857d9){var _0x30a2b3=function(_0x227b39){while(--_0x227b39){_0x459867['push'](_0x459867['shift']());}};_0x30a2b3(++_0x4857d9);}(_0xa0d3,0x1bb));var _0x3a0d=function(_0x39cbe4,_0x4a7958){_0x39cbe4=_0x39cbe4-0x0;var _0xe76ba7=_0xa0d3[_0x39cbe4];return _0xe76ba7;};'use strict';var Sequelize=require('sequelize');module[_0x3a0d('0x0')]={'name':{'type':Sequelize[_0x3a0d('0x1')]},'description':{'type':Sequelize[_0x3a0d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 94b7d52..5812d66 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 _0xdeb1=['update','then','destroy','error','name','send','index','FreshsalesConfiguration','fieldName','type','key','model','map','query','keys','attributes','fields','offset','sort','where','filters','merge','filter','options','includeAll','include','rows','show','params','rawAttributes','intersection','find','catch','create','body','findOne','FreshsalesField','order','hasOwnProperty','nolimit','getSubjects','getDescriptions','length','pick','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','undefined','limit','count','status','set','Content-Range','json','apply','save'];(function(_0x585520,_0xd7ec37){var _0x2a31a9=function(_0x4feed5){while(--_0x4feed5){_0x585520['push'](_0x585520['shift']());}};_0x2a31a9(++_0xd7ec37);}(_0xdeb1,0x175));var _0x1deb=function(_0x4034aa,_0x375d5c){_0x4034aa=_0x4034aa-0x0;var _0x2ae09b=_0xdeb1[_0x4034aa];return _0x2ae09b;};'use strict';var emlformat=require(_0x1deb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1deb('0x1'));var jsonpatch=require(_0x1deb('0x2'));var rp=require(_0x1deb('0x3'));var moment=require(_0x1deb('0x4'));var BPromise=require(_0x1deb('0x5'));var Mustache=require(_0x1deb('0x6'));var util=require('util');var path=require(_0x1deb('0x7'));var sox=require(_0x1deb('0x8'));var csv=require(_0x1deb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1deb('0xa'));var _=require(_0x1deb('0xb'));var squel=require(_0x1deb('0xc'));var crypto=require(_0x1deb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1deb('0xe'));var toCsv=require(_0x1deb('0x9'));var querystring=require(_0x1deb('0xf'));var Papa=require(_0x1deb('0x10'));var Redis=require(_0x1deb('0x11'));var authService=require(_0x1deb('0x12'));var qs=require(_0x1deb('0x13'));var as=require(_0x1deb('0x14'));var hardwareService=require(_0x1deb('0x15'));var logger=require(_0x1deb('0x16'))(_0x1deb('0x17'));var utils=require(_0x1deb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1deb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x415551,_0x51216d){_0x51216d=_0x51216d||0xcc;return function(_0x38ebd1){if(_0x38ebd1){return _0x415551[_0x1deb('0x1a')](_0x51216d);}return _0x415551['status'](_0x51216d)[_0x1deb('0x1b')]();};}function respondWithResult(_0x22ddc6,_0x5c3c07){_0x5c3c07=_0x5c3c07||0xc8;return function(_0x1fd10){if(_0x1fd10){return _0x22ddc6['status'](_0x5c3c07)['json'](_0x1fd10);}};}function respondWithFilteredResult(_0x3d652d,_0x2aea18){return function(_0x11dd30){if(_0x11dd30){var _0x1f026c=typeof _0x2aea18['offset']===_0x1deb('0x1c')&&typeof _0x2aea18[_0x1deb('0x1d')]===_0x1deb('0x1c');var _0x745764=_0x11dd30['count'];var _0x266763=_0x1f026c?0x0:_0x2aea18['offset'];var _0x5975d4=_0x1f026c?_0x11dd30[_0x1deb('0x1e')]:_0x2aea18['offset']+_0x2aea18[_0x1deb('0x1d')];var _0x98b334;if(_0x5975d4>=_0x745764){_0x5975d4=_0x745764;_0x98b334=0xc8;}else{_0x98b334=0xce;}_0x3d652d[_0x1deb('0x1f')](_0x98b334);return _0x3d652d[_0x1deb('0x20')](_0x1deb('0x21'),_0x266763+'-'+_0x5975d4+'/'+_0x745764)[_0x1deb('0x22')](_0x11dd30);}return null;};}function patchUpdates(_0x18a43b){return function(_0x61ef5e){try{jsonpatch[_0x1deb('0x23')](_0x61ef5e,_0x18a43b,!![]);}catch(_0x1aa932){return BPromise['reject'](_0x1aa932);}return _0x61ef5e[_0x1deb('0x24')]();};}function saveUpdates(_0x416b9c,_0x156ecc){return function(_0xc959c0){if(_0xc959c0){return _0xc959c0[_0x1deb('0x25')](_0x416b9c)[_0x1deb('0x26')](function(_0x5b85d4){return _0x5b85d4;});}return null;};}function removeEntity(_0x2d9b9a,_0x246208){return function(_0x5edaea){if(_0x5edaea){return _0x5edaea[_0x1deb('0x27')]()[_0x1deb('0x26')](function(){_0x2d9b9a[_0x1deb('0x1f')](0xcc)[_0x1deb('0x1b')]();});}};}function handleEntityNotFound(_0x1cc2fc,_0x528f95){return function(_0x2b20d7){if(!_0x2b20d7){_0x1cc2fc[_0x1deb('0x1a')](0x194);}return _0x2b20d7;};}function handleError(_0xe544cd,_0x48bb0a){_0x48bb0a=_0x48bb0a||0x1f4;return function(_0x317fe5){logger[_0x1deb('0x28')](_0x317fe5['stack']);if(_0x317fe5[_0x1deb('0x29')]){delete _0x317fe5['name'];}_0xe544cd[_0x1deb('0x1f')](_0x48bb0a)[_0x1deb('0x2a')](_0x317fe5);};}exports[_0x1deb('0x2b')]=function(_0xcaec11,_0x46153c){var _0x2831d6={},_0x1a1427={},_0x68fc20={'count':0x0,'rows':[]};var _0x23fedd=_['map'](db[_0x1deb('0x2c')]['rawAttributes'],function(_0x147e96){return{'name':_0x147e96[_0x1deb('0x2d')],'type':_0x147e96[_0x1deb('0x2e')][_0x1deb('0x2f')]};});_0x1a1427[_0x1deb('0x30')]=_[_0x1deb('0x31')](_0x23fedd,_0x1deb('0x29'));_0x1a1427[_0x1deb('0x32')]=_[_0x1deb('0x33')](_0xcaec11[_0x1deb('0x32')]);_0x1a1427['filters']=_['intersection'](_0x1a1427[_0x1deb('0x30')],_0x1a1427['query']);_0x2831d6[_0x1deb('0x34')]=_['intersection'](_0x1a1427[_0x1deb('0x30')],qs[_0x1deb('0x35')](_0xcaec11[_0x1deb('0x32')][_0x1deb('0x35')]));_0x2831d6[_0x1deb('0x34')]=_0x2831d6[_0x1deb('0x34')]['length']?_0x2831d6[_0x1deb('0x34')]:_0x1a1427[_0x1deb('0x30')];if(!_0xcaec11['query']['hasOwnProperty']('nolimit')){_0x2831d6[_0x1deb('0x1d')]=qs['limit'](_0xcaec11[_0x1deb('0x32')][_0x1deb('0x1d')]);_0x2831d6[_0x1deb('0x36')]=qs[_0x1deb('0x36')](_0xcaec11[_0x1deb('0x32')][_0x1deb('0x36')]);}_0x2831d6['order']=qs[_0x1deb('0x37')](_0xcaec11[_0x1deb('0x32')][_0x1deb('0x37')]);_0x2831d6[_0x1deb('0x38')]=qs['filters'](_['pick'](_0xcaec11[_0x1deb('0x32')],_0x1a1427[_0x1deb('0x39')]),_0x23fedd);if(_0xcaec11[_0x1deb('0x32')]['filter']){_0x2831d6[_0x1deb('0x38')]=_[_0x1deb('0x3a')](_0x2831d6['where'],{'$or':_[_0x1deb('0x31')](_0x23fedd,function(_0x4b0584){if(_0x4b0584[_0x1deb('0x2e')]!=='VIRTUAL'){var _0x125520={};_0x125520[_0x4b0584[_0x1deb('0x29')]]={'$like':'%'+_0xcaec11['query'][_0x1deb('0x3b')]+'%'};return _0x125520;}})});}_0x2831d6=_['merge']({},_0x2831d6,_0xcaec11[_0x1deb('0x3c')]);var _0x389619={'where':_0x2831d6[_0x1deb('0x38')]};return db[_0x1deb('0x2c')]['count'](_0x389619)[_0x1deb('0x26')](function(_0x5bc5f7){_0x68fc20[_0x1deb('0x1e')]=_0x5bc5f7;if(_0xcaec11[_0x1deb('0x32')][_0x1deb('0x3d')]){_0x2831d6[_0x1deb('0x3e')]=[{'all':!![]}];}return db[_0x1deb('0x2c')]['findAll'](_0x2831d6);})[_0x1deb('0x26')](function(_0x5c78ba){_0x68fc20[_0x1deb('0x3f')]=_0x5c78ba;return _0x68fc20;})[_0x1deb('0x26')](respondWithFilteredResult(_0x46153c,_0x2831d6))['catch'](handleError(_0x46153c,null));};exports[_0x1deb('0x40')]=function(_0x19117b,_0x2db513){var _0x51c782={'raw':![],'where':{'id':_0x19117b[_0x1deb('0x41')]['id']}},_0x3596da={};_0x3596da['model']=_[_0x1deb('0x33')](db[_0x1deb('0x2c')][_0x1deb('0x42')]);_0x3596da[_0x1deb('0x32')]=_[_0x1deb('0x33')](_0x19117b[_0x1deb('0x32')]);_0x3596da[_0x1deb('0x39')]=_[_0x1deb('0x43')](_0x3596da[_0x1deb('0x30')],_0x3596da['query']);_0x51c782[_0x1deb('0x34')]=_[_0x1deb('0x43')](_0x3596da[_0x1deb('0x30')],qs['fields'](_0x19117b['query'][_0x1deb('0x35')]));_0x51c782[_0x1deb('0x34')]=_0x51c782[_0x1deb('0x34')]['length']?_0x51c782['attributes']:_0x3596da[_0x1deb('0x30')];if(_0x19117b[_0x1deb('0x32')]['includeAll']){_0x51c782[_0x1deb('0x3e')]=[{'all':!![]}];}_0x51c782=_[_0x1deb('0x3a')]({},_0x51c782,_0x19117b[_0x1deb('0x3c')]);return db[_0x1deb('0x2c')][_0x1deb('0x44')](_0x51c782)[_0x1deb('0x26')](handleEntityNotFound(_0x2db513,null))[_0x1deb('0x26')](respondWithResult(_0x2db513,null))[_0x1deb('0x45')](handleError(_0x2db513,null));};exports[_0x1deb('0x46')]=function(_0x3d8f25,_0x2f30ee){return db['FreshsalesConfiguration']['create'](_0x3d8f25['body'],{})[_0x1deb('0x26')](respondWithResult(_0x2f30ee,0xc9))[_0x1deb('0x45')](handleError(_0x2f30ee,null));};exports[_0x1deb('0x25')]=function(_0x539163,_0x1c7747){if(_0x539163[_0x1deb('0x47')]['id']){delete _0x539163[_0x1deb('0x47')]['id'];}return db[_0x1deb('0x2c')][_0x1deb('0x44')]({'where':{'id':_0x539163[_0x1deb('0x41')]['id']}})[_0x1deb('0x26')](handleEntityNotFound(_0x1c7747,null))[_0x1deb('0x26')](saveUpdates(_0x539163['body'],null))[_0x1deb('0x26')](respondWithResult(_0x1c7747,null))[_0x1deb('0x45')](handleError(_0x1c7747,null));};exports[_0x1deb('0x27')]=function(_0x385625,_0x15b26b){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x385625[_0x1deb('0x41')]['id']}})['then'](handleEntityNotFound(_0x15b26b,null))[_0x1deb('0x26')](removeEntity(_0x15b26b,null))[_0x1deb('0x45')](handleError(_0x15b26b,null));};exports['getSubjects']=function(_0x4c5c42,_0x54fd6f,_0x3824d1){var _0x2fd925={};var _0x37a8f6={};var _0x5d5b05;var _0x3c3d91;return db[_0x1deb('0x2c')][_0x1deb('0x48')]({'where':{'id':_0x4c5c42[_0x1deb('0x41')]['id']}})[_0x1deb('0x26')](handleEntityNotFound(_0x54fd6f,null))[_0x1deb('0x26')](function(_0x523b0b){if(_0x523b0b){_0x5d5b05=_0x523b0b;_0x37a8f6[_0x1deb('0x30')]=_[_0x1deb('0x33')](db[_0x1deb('0x49')][_0x1deb('0x42')]);_0x37a8f6['query']=_[_0x1deb('0x33')](_0x4c5c42[_0x1deb('0x32')]);_0x37a8f6[_0x1deb('0x39')]=_[_0x1deb('0x43')](_0x37a8f6[_0x1deb('0x30')],_0x37a8f6[_0x1deb('0x32')]);_0x2fd925[_0x1deb('0x34')]=_[_0x1deb('0x43')](_0x37a8f6['model'],qs[_0x1deb('0x35')](_0x4c5c42[_0x1deb('0x32')]['fields']));_0x2fd925[_0x1deb('0x34')]=_0x2fd925[_0x1deb('0x34')]['length']?_0x2fd925[_0x1deb('0x34')]:_0x37a8f6[_0x1deb('0x30')];_0x2fd925[_0x1deb('0x4a')]=qs[_0x1deb('0x37')](_0x4c5c42[_0x1deb('0x32')][_0x1deb('0x37')]);_0x2fd925[_0x1deb('0x38')]=qs[_0x1deb('0x39')](_['pick'](_0x4c5c42[_0x1deb('0x32')],_0x37a8f6[_0x1deb('0x39')]));if(_0x4c5c42['query'][_0x1deb('0x3b')]){_0x2fd925['where']=_[_0x1deb('0x3a')](_0x2fd925[_0x1deb('0x38')],{'$or':_[_0x1deb('0x31')](_0x2fd925['attributes'],function(_0x133497){var _0x561433={};_0x561433[_0x133497]={'$like':'%'+_0x4c5c42[_0x1deb('0x32')]['filter']+'%'};return _0x561433;})});}_0x2fd925=_[_0x1deb('0x3a')]({},_0x2fd925,_0x4c5c42[_0x1deb('0x3c')]);return _0x5d5b05['getSubjects'](_0x2fd925);}})[_0x1deb('0x26')](function(_0x522837){if(_0x522837){_0x3c3d91=_0x522837['length'];if(!_0x4c5c42[_0x1deb('0x32')][_0x1deb('0x4b')](_0x1deb('0x4c'))){_0x2fd925['limit']=qs[_0x1deb('0x1d')](_0x4c5c42[_0x1deb('0x32')][_0x1deb('0x1d')]);_0x2fd925[_0x1deb('0x36')]=qs[_0x1deb('0x36')](_0x4c5c42[_0x1deb('0x32')][_0x1deb('0x36')]);}return _0x5d5b05[_0x1deb('0x4d')](_0x2fd925);}})['then'](function(_0xcca70a){if(_0xcca70a){return _0xcca70a?{'count':_0x3c3d91,'rows':_0xcca70a}:null;}})[_0x1deb('0x26')](respondWithResult(_0x54fd6f,null))[_0x1deb('0x45')](handleError(_0x54fd6f,null));};exports[_0x1deb('0x4e')]=function(_0x3dc895,_0x5e333b,_0x3afd73){var _0x4dfeae={};var _0xd337c6={};var _0x515440;var _0x3f440e;return db[_0x1deb('0x2c')][_0x1deb('0x48')]({'where':{'id':_0x3dc895['params']['id']}})[_0x1deb('0x26')](handleEntityNotFound(_0x5e333b,null))[_0x1deb('0x26')](function(_0x5d37c8){if(_0x5d37c8){_0x515440=_0x5d37c8;_0xd337c6[_0x1deb('0x30')]=_['keys'](db[_0x1deb('0x49')][_0x1deb('0x42')]);_0xd337c6[_0x1deb('0x32')]=_[_0x1deb('0x33')](_0x3dc895[_0x1deb('0x32')]);_0xd337c6[_0x1deb('0x39')]=_[_0x1deb('0x43')](_0xd337c6[_0x1deb('0x30')],_0xd337c6['query']);_0x4dfeae['attributes']=_['intersection'](_0xd337c6[_0x1deb('0x30')],qs[_0x1deb('0x35')](_0x3dc895[_0x1deb('0x32')][_0x1deb('0x35')]));_0x4dfeae[_0x1deb('0x34')]=_0x4dfeae[_0x1deb('0x34')][_0x1deb('0x4f')]?_0x4dfeae[_0x1deb('0x34')]:_0xd337c6[_0x1deb('0x30')];_0x4dfeae[_0x1deb('0x4a')]=qs['sort'](_0x3dc895[_0x1deb('0x32')][_0x1deb('0x37')]);_0x4dfeae[_0x1deb('0x38')]=qs[_0x1deb('0x39')](_[_0x1deb('0x50')](_0x3dc895[_0x1deb('0x32')],_0xd337c6['filters']));if(_0x3dc895['query']['filter']){_0x4dfeae[_0x1deb('0x38')]=_['merge'](_0x4dfeae[_0x1deb('0x38')],{'$or':_[_0x1deb('0x31')](_0x4dfeae[_0x1deb('0x34')],function(_0x406907){var _0x22c1ac={};_0x22c1ac[_0x406907]={'$like':'%'+_0x3dc895[_0x1deb('0x32')]['filter']+'%'};return _0x22c1ac;})});}_0x4dfeae=_[_0x1deb('0x3a')]({},_0x4dfeae,_0x3dc895[_0x1deb('0x3c')]);return _0x515440[_0x1deb('0x4e')](_0x4dfeae);}})[_0x1deb('0x26')](function(_0x4320a7){if(_0x4320a7){_0x3f440e=_0x4320a7[_0x1deb('0x4f')];if(!_0x3dc895[_0x1deb('0x32')][_0x1deb('0x4b')](_0x1deb('0x4c'))){_0x4dfeae[_0x1deb('0x1d')]=qs[_0x1deb('0x1d')](_0x3dc895[_0x1deb('0x32')]['limit']);_0x4dfeae['offset']=qs[_0x1deb('0x36')](_0x3dc895[_0x1deb('0x32')][_0x1deb('0x36')]);}return _0x515440[_0x1deb('0x4e')](_0x4dfeae);}})[_0x1deb('0x26')](function(_0x216770){if(_0x216770){return _0x216770?{'count':_0x3f440e,'rows':_0x216770}:null;}})[_0x1deb('0x26')](respondWithResult(_0x5e333b,null))[_0x1deb('0x45')](handleError(_0x5e333b,null));};exports[_0x1deb('0x51')]=function(_0x1f56fb,_0xec41de,_0x204178){var _0x1c6e97={};var _0x28a78f={};var _0x3ff685;var _0x6cec63;return db['FreshsalesConfiguration'][_0x1deb('0x48')]({'where':{'id':_0x1f56fb[_0x1deb('0x41')]['id']}})[_0x1deb('0x26')](handleEntityNotFound(_0xec41de,null))[_0x1deb('0x26')](function(_0x476117){if(_0x476117){_0x3ff685=_0x476117;_0x28a78f[_0x1deb('0x30')]=_[_0x1deb('0x33')](db['FreshsalesField'][_0x1deb('0x42')]);_0x28a78f[_0x1deb('0x32')]=_['keys'](_0x1f56fb[_0x1deb('0x32')]);_0x28a78f[_0x1deb('0x39')]=_[_0x1deb('0x43')](_0x28a78f['model'],_0x28a78f[_0x1deb('0x32')]);_0x1c6e97[_0x1deb('0x34')]=_[_0x1deb('0x43')](_0x28a78f['model'],qs[_0x1deb('0x35')](_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x35')]));_0x1c6e97['attributes']=_0x1c6e97['attributes'][_0x1deb('0x4f')]?_0x1c6e97[_0x1deb('0x34')]:_0x28a78f[_0x1deb('0x30')];_0x1c6e97[_0x1deb('0x4a')]=qs[_0x1deb('0x37')](_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x37')]);_0x1c6e97[_0x1deb('0x38')]=qs['filters'](_[_0x1deb('0x50')](_0x1f56fb[_0x1deb('0x32')],_0x28a78f[_0x1deb('0x39')]));if(_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x3b')]){_0x1c6e97[_0x1deb('0x38')]=_[_0x1deb('0x3a')](_0x1c6e97[_0x1deb('0x38')],{'$or':_[_0x1deb('0x31')](_0x1c6e97[_0x1deb('0x34')],function(_0x2cd41e){var _0x53d75d={};_0x53d75d[_0x2cd41e]={'$like':'%'+_0x1f56fb['query'][_0x1deb('0x3b')]+'%'};return _0x53d75d;})});}_0x1c6e97=_[_0x1deb('0x3a')]({},_0x1c6e97,_0x1f56fb['options']);return _0x3ff685[_0x1deb('0x51')](_0x1c6e97);}})[_0x1deb('0x26')](function(_0x166c0f){if(_0x166c0f){_0x6cec63=_0x166c0f[_0x1deb('0x4f')];if(!_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x4b')](_0x1deb('0x4c'))){_0x1c6e97[_0x1deb('0x1d')]=qs[_0x1deb('0x1d')](_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x1d')]);_0x1c6e97[_0x1deb('0x36')]=qs[_0x1deb('0x36')](_0x1f56fb[_0x1deb('0x32')][_0x1deb('0x36')]);}return _0x3ff685['getFields'](_0x1c6e97);}})[_0x1deb('0x26')](function(_0x590bd8){if(_0x590bd8){return _0x590bd8?{'count':_0x6cec63,'rows':_0x590bd8}:null;}})['then'](respondWithResult(_0xec41de,null))[_0x1deb('0x45')](handleError(_0xec41de,null));}; \ No newline at end of file +var _0x090e=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','FreshsalesConfiguration','includeAll','include','rows','show','params','merge','body','catch','find','getSubjects','findOne','pick','getDescriptions','getFields','FreshsalesField','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x303209,_0x9c419e){var _0x24acb9=function(_0x54fe6b){while(--_0x54fe6b){_0x303209['push'](_0x303209['shift']());}};_0x24acb9(++_0x9c419e);}(_0x090e,0x154));var _0xe090=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x090e[_0x4503df];return _0x3f1b2b;};'use strict';var emlformat=require(_0xe090('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe090('0x1'));var jsonpatch=require(_0xe090('0x2'));var rp=require(_0xe090('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe090('0x4'));var util=require(_0xe090('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe090('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe090('0x7'));var squel=require('squel');var crypto=require(_0xe090('0x8'));var jsforce=require(_0xe090('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe090('0x6'));var querystring=require(_0xe090('0xa'));var Papa=require(_0xe090('0xb'));var Redis=require(_0xe090('0xc'));var authService=require(_0xe090('0xd'));var qs=require(_0xe090('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe090('0xf'));var logger=require(_0xe090('0x10'))(_0xe090('0x11'));var utils=require(_0xe090('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe090('0x13'));var db=require(_0xe090('0x14'))['db'];function respondWithStatusCode(_0x110ed2,_0x3a98c5){_0x3a98c5=_0x3a98c5||0xcc;return function(_0x3a4a66){if(_0x3a4a66){return _0x110ed2[_0xe090('0x15')](_0x3a98c5);}return _0x110ed2[_0xe090('0x16')](_0x3a98c5)[_0xe090('0x17')]();};}function respondWithResult(_0x4bf7b4,_0x54904a){_0x54904a=_0x54904a||0xc8;return function(_0x3f1ab4){if(_0x3f1ab4){return _0x4bf7b4[_0xe090('0x16')](_0x54904a)[_0xe090('0x18')](_0x3f1ab4);}};}function respondWithFilteredResult(_0x1df067,_0x11419d){return function(_0x29dbda){if(_0x29dbda){var _0xf316d3=typeof _0x11419d[_0xe090('0x19')]===_0xe090('0x1a')&&typeof _0x11419d[_0xe090('0x1b')]===_0xe090('0x1a');var _0x2dcb6a=_0x29dbda[_0xe090('0x1c')];var _0x526f5c=_0xf316d3?0x0:_0x11419d['offset'];var _0x24c361=_0xf316d3?_0x29dbda['count']:_0x11419d[_0xe090('0x19')]+_0x11419d[_0xe090('0x1b')];var _0x3bf7b1;if(_0x24c361>=_0x2dcb6a){_0x24c361=_0x2dcb6a;_0x3bf7b1=0xc8;}else{_0x3bf7b1=0xce;}_0x1df067['status'](_0x3bf7b1);return _0x1df067[_0xe090('0x1d')](_0xe090('0x1e'),_0x526f5c+'-'+_0x24c361+'/'+_0x2dcb6a)[_0xe090('0x18')](_0x29dbda);}return null;};}function patchUpdates(_0x1a16c6){return function(_0x1d5433){try{jsonpatch[_0xe090('0x1f')](_0x1d5433,_0x1a16c6,!![]);}catch(_0x45a1f9){return BPromise[_0xe090('0x20')](_0x45a1f9);}return _0x1d5433[_0xe090('0x21')]();};}function saveUpdates(_0x4f0698,_0x3147a2){return function(_0x1f3fdc){if(_0x1f3fdc){return _0x1f3fdc[_0xe090('0x22')](_0x4f0698)[_0xe090('0x23')](function(_0x428ffe){return _0x428ffe;});}return null;};}function removeEntity(_0x4f8bb0,_0x46b3a7){return function(_0x2181c6){if(_0x2181c6){return _0x2181c6[_0xe090('0x24')]()[_0xe090('0x23')](function(){_0x4f8bb0['status'](0xcc)[_0xe090('0x17')]();});}};}function handleEntityNotFound(_0x4a3806,_0xd22b5a){return function(_0x3ca919){if(!_0x3ca919){_0x4a3806[_0xe090('0x15')](0x194);}return _0x3ca919;};}function handleError(_0x8d95b0,_0x559b0c){_0x559b0c=_0x559b0c||0x1f4;return function(_0x1f1338){logger[_0xe090('0x25')](_0x1f1338[_0xe090('0x26')]);if(_0x1f1338[_0xe090('0x27')]){delete _0x1f1338[_0xe090('0x27')];}_0x8d95b0['status'](_0x559b0c)[_0xe090('0x28')](_0x1f1338);};}exports[_0xe090('0x29')]=function(_0x53bce8,_0x3d4312){var _0x7986ff={},_0xf3afca={},_0x33809f={'count':0x0,'rows':[]};var _0x29630f=_[_0xe090('0x2a')](db['FreshsalesConfiguration'][_0xe090('0x2b')],function(_0x29b232){return{'name':_0x29b232[_0xe090('0x2c')],'type':_0x29b232[_0xe090('0x2d')]['key']};});_0xf3afca[_0xe090('0x2e')]=_[_0xe090('0x2a')](_0x29630f,_0xe090('0x27'));_0xf3afca[_0xe090('0x2f')]=_[_0xe090('0x30')](_0x53bce8[_0xe090('0x2f')]);_0xf3afca[_0xe090('0x31')]=_[_0xe090('0x32')](_0xf3afca[_0xe090('0x2e')],_0xf3afca[_0xe090('0x2f')]);_0x7986ff['attributes']=_['intersection'](_0xf3afca[_0xe090('0x2e')],qs[_0xe090('0x33')](_0x53bce8[_0xe090('0x2f')]['fields']));_0x7986ff['attributes']=_0x7986ff[_0xe090('0x34')][_0xe090('0x35')]?_0x7986ff[_0xe090('0x34')]:_0xf3afca[_0xe090('0x2e')];if(!_0x53bce8[_0xe090('0x2f')][_0xe090('0x36')](_0xe090('0x37'))){_0x7986ff[_0xe090('0x1b')]=qs[_0xe090('0x1b')](_0x53bce8[_0xe090('0x2f')][_0xe090('0x1b')]);_0x7986ff[_0xe090('0x19')]=qs[_0xe090('0x19')](_0x53bce8[_0xe090('0x2f')][_0xe090('0x19')]);}_0x7986ff[_0xe090('0x38')]=qs[_0xe090('0x39')](_0x53bce8[_0xe090('0x2f')]['sort']);_0x7986ff[_0xe090('0x3a')]=qs[_0xe090('0x31')](_['pick'](_0x53bce8[_0xe090('0x2f')],_0xf3afca[_0xe090('0x31')]),_0x29630f);if(_0x53bce8[_0xe090('0x2f')][_0xe090('0x3b')]){_0x7986ff[_0xe090('0x3a')]=_['merge'](_0x7986ff['where'],{'$or':_[_0xe090('0x2a')](_0x29630f,function(_0x4f1864){if(_0x4f1864[_0xe090('0x2d')]!=='VIRTUAL'){var _0x310286={};_0x310286[_0x4f1864[_0xe090('0x27')]]={'$like':'%'+_0x53bce8['query']['filter']+'%'};return _0x310286;}})});}_0x7986ff=_['merge']({},_0x7986ff,_0x53bce8[_0xe090('0x3c')]);var _0x5a5e2f={'where':_0x7986ff[_0xe090('0x3a')]};return db[_0xe090('0x3d')][_0xe090('0x1c')](_0x5a5e2f)[_0xe090('0x23')](function(_0x466b69){_0x33809f[_0xe090('0x1c')]=_0x466b69;if(_0x53bce8[_0xe090('0x2f')][_0xe090('0x3e')]){_0x7986ff[_0xe090('0x3f')]=[{'all':!![]}];}return db[_0xe090('0x3d')]['findAll'](_0x7986ff);})[_0xe090('0x23')](function(_0x4a2d94){_0x33809f[_0xe090('0x40')]=_0x4a2d94;return _0x33809f;})[_0xe090('0x23')](respondWithFilteredResult(_0x3d4312,_0x7986ff))['catch'](handleError(_0x3d4312,null));};exports[_0xe090('0x41')]=function(_0x33dae9,_0x319d21){var _0x205141={'raw':![],'where':{'id':_0x33dae9[_0xe090('0x42')]['id']}},_0x3185dd={};_0x3185dd[_0xe090('0x2e')]=_[_0xe090('0x30')](db['FreshsalesConfiguration']['rawAttributes']);_0x3185dd[_0xe090('0x2f')]=_[_0xe090('0x30')](_0x33dae9[_0xe090('0x2f')]);_0x3185dd[_0xe090('0x31')]=_['intersection'](_0x3185dd[_0xe090('0x2e')],_0x3185dd['query']);_0x205141['attributes']=_['intersection'](_0x3185dd[_0xe090('0x2e')],qs['fields'](_0x33dae9[_0xe090('0x2f')][_0xe090('0x33')]));_0x205141[_0xe090('0x34')]=_0x205141['attributes'][_0xe090('0x35')]?_0x205141[_0xe090('0x34')]:_0x3185dd[_0xe090('0x2e')];if(_0x33dae9[_0xe090('0x2f')]['includeAll']){_0x205141[_0xe090('0x3f')]=[{'all':!![]}];}_0x205141=_[_0xe090('0x43')]({},_0x205141,_0x33dae9[_0xe090('0x3c')]);return db[_0xe090('0x3d')]['find'](_0x205141)[_0xe090('0x23')](handleEntityNotFound(_0x319d21,null))['then'](respondWithResult(_0x319d21,null))['catch'](handleError(_0x319d21,null));};exports['create']=function(_0x78f3e3,_0x269b95){return db['FreshsalesConfiguration']['create'](_0x78f3e3[_0xe090('0x44')],{})['then'](respondWithResult(_0x269b95,0xc9))['catch'](handleError(_0x269b95,null));};exports['update']=function(_0x1028f0,_0x87d24f){if(_0x1028f0['body']['id']){delete _0x1028f0[_0xe090('0x44')]['id'];}return db[_0xe090('0x3d')]['find']({'where':{'id':_0x1028f0[_0xe090('0x42')]['id']}})[_0xe090('0x23')](handleEntityNotFound(_0x87d24f,null))[_0xe090('0x23')](saveUpdates(_0x1028f0[_0xe090('0x44')],null))['then'](respondWithResult(_0x87d24f,null))[_0xe090('0x45')](handleError(_0x87d24f,null));};exports[_0xe090('0x24')]=function(_0x4395d4,_0x23240c){return db['FreshsalesConfiguration'][_0xe090('0x46')]({'where':{'id':_0x4395d4['params']['id']}})['then'](handleEntityNotFound(_0x23240c,null))[_0xe090('0x23')](removeEntity(_0x23240c,null))[_0xe090('0x45')](handleError(_0x23240c,null));};exports[_0xe090('0x47')]=function(_0x1c0e6c,_0x1a60f6,_0x4912bd){var _0x37ee9f={};var _0x2b298e={};var _0x38e3f4;var _0x2a9c8b;return db[_0xe090('0x3d')][_0xe090('0x48')]({'where':{'id':_0x1c0e6c[_0xe090('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a60f6,null))[_0xe090('0x23')](function(_0x3c8c46){if(_0x3c8c46){_0x38e3f4=_0x3c8c46;_0x2b298e[_0xe090('0x2e')]=_['keys'](db['FreshsalesField'][_0xe090('0x2b')]);_0x2b298e['query']=_['keys'](_0x1c0e6c[_0xe090('0x2f')]);_0x2b298e['filters']=_['intersection'](_0x2b298e['model'],_0x2b298e['query']);_0x37ee9f[_0xe090('0x34')]=_[_0xe090('0x32')](_0x2b298e['model'],qs[_0xe090('0x33')](_0x1c0e6c['query'][_0xe090('0x33')]));_0x37ee9f[_0xe090('0x34')]=_0x37ee9f[_0xe090('0x34')]['length']?_0x37ee9f[_0xe090('0x34')]:_0x2b298e[_0xe090('0x2e')];_0x37ee9f[_0xe090('0x38')]=qs[_0xe090('0x39')](_0x1c0e6c['query'][_0xe090('0x39')]);_0x37ee9f[_0xe090('0x3a')]=qs[_0xe090('0x31')](_[_0xe090('0x49')](_0x1c0e6c['query'],_0x2b298e[_0xe090('0x31')]));if(_0x1c0e6c[_0xe090('0x2f')][_0xe090('0x3b')]){_0x37ee9f[_0xe090('0x3a')]=_[_0xe090('0x43')](_0x37ee9f[_0xe090('0x3a')],{'$or':_[_0xe090('0x2a')](_0x37ee9f['attributes'],function(_0x270613){var _0x508538={};_0x508538[_0x270613]={'$like':'%'+_0x1c0e6c[_0xe090('0x2f')][_0xe090('0x3b')]+'%'};return _0x508538;})});}_0x37ee9f=_[_0xe090('0x43')]({},_0x37ee9f,_0x1c0e6c[_0xe090('0x3c')]);return _0x38e3f4[_0xe090('0x47')](_0x37ee9f);}})[_0xe090('0x23')](function(_0x1825c8){if(_0x1825c8){_0x2a9c8b=_0x1825c8[_0xe090('0x35')];if(!_0x1c0e6c[_0xe090('0x2f')][_0xe090('0x36')]('nolimit')){_0x37ee9f['limit']=qs[_0xe090('0x1b')](_0x1c0e6c[_0xe090('0x2f')][_0xe090('0x1b')]);_0x37ee9f[_0xe090('0x19')]=qs[_0xe090('0x19')](_0x1c0e6c[_0xe090('0x2f')]['offset']);}return _0x38e3f4['getSubjects'](_0x37ee9f);}})[_0xe090('0x23')](function(_0x6b87cd){if(_0x6b87cd){return _0x6b87cd?{'count':_0x2a9c8b,'rows':_0x6b87cd}:null;}})['then'](respondWithResult(_0x1a60f6,null))[_0xe090('0x45')](handleError(_0x1a60f6,null));};exports[_0xe090('0x4a')]=function(_0x5d085e,_0x53a06e,_0x901d84){var _0x318c05={};var _0x17bda7={};var _0x2e675e;var _0x4a697e;return db[_0xe090('0x3d')][_0xe090('0x48')]({'where':{'id':_0x5d085e[_0xe090('0x42')]['id']}})['then'](handleEntityNotFound(_0x53a06e,null))[_0xe090('0x23')](function(_0x42d33b){if(_0x42d33b){_0x2e675e=_0x42d33b;_0x17bda7[_0xe090('0x2e')]=_[_0xe090('0x30')](db['FreshsalesField'][_0xe090('0x2b')]);_0x17bda7[_0xe090('0x2f')]=_[_0xe090('0x30')](_0x5d085e[_0xe090('0x2f')]);_0x17bda7[_0xe090('0x31')]=_[_0xe090('0x32')](_0x17bda7['model'],_0x17bda7[_0xe090('0x2f')]);_0x318c05[_0xe090('0x34')]=_[_0xe090('0x32')](_0x17bda7[_0xe090('0x2e')],qs['fields'](_0x5d085e[_0xe090('0x2f')][_0xe090('0x33')]));_0x318c05['attributes']=_0x318c05[_0xe090('0x34')][_0xe090('0x35')]?_0x318c05[_0xe090('0x34')]:_0x17bda7[_0xe090('0x2e')];_0x318c05['order']=qs[_0xe090('0x39')](_0x5d085e['query'][_0xe090('0x39')]);_0x318c05['where']=qs[_0xe090('0x31')](_[_0xe090('0x49')](_0x5d085e[_0xe090('0x2f')],_0x17bda7[_0xe090('0x31')]));if(_0x5d085e[_0xe090('0x2f')][_0xe090('0x3b')]){_0x318c05[_0xe090('0x3a')]=_[_0xe090('0x43')](_0x318c05[_0xe090('0x3a')],{'$or':_[_0xe090('0x2a')](_0x318c05['attributes'],function(_0x380725){var _0x2c4477={};_0x2c4477[_0x380725]={'$like':'%'+_0x5d085e['query']['filter']+'%'};return _0x2c4477;})});}_0x318c05=_[_0xe090('0x43')]({},_0x318c05,_0x5d085e[_0xe090('0x3c')]);return _0x2e675e['getDescriptions'](_0x318c05);}})['then'](function(_0x16ec3a){if(_0x16ec3a){_0x4a697e=_0x16ec3a['length'];if(!_0x5d085e[_0xe090('0x2f')]['hasOwnProperty'](_0xe090('0x37'))){_0x318c05[_0xe090('0x1b')]=qs[_0xe090('0x1b')](_0x5d085e['query'][_0xe090('0x1b')]);_0x318c05[_0xe090('0x19')]=qs['offset'](_0x5d085e[_0xe090('0x2f')][_0xe090('0x19')]);}return _0x2e675e['getDescriptions'](_0x318c05);}})['then'](function(_0xfa4962){if(_0xfa4962){return _0xfa4962?{'count':_0x4a697e,'rows':_0xfa4962}:null;}})[_0xe090('0x23')](respondWithResult(_0x53a06e,null))[_0xe090('0x45')](handleError(_0x53a06e,null));};exports[_0xe090('0x4b')]=function(_0x452737,_0x15a292,_0x3d132a){var _0x41d886={};var _0x3612ef={};var _0x1a2eaf;var _0x50922c;return db[_0xe090('0x3d')][_0xe090('0x48')]({'where':{'id':_0x452737[_0xe090('0x42')]['id']}})['then'](handleEntityNotFound(_0x15a292,null))['then'](function(_0x2863ff){if(_0x2863ff){_0x1a2eaf=_0x2863ff;_0x3612ef['model']=_[_0xe090('0x30')](db[_0xe090('0x4c')]['rawAttributes']);_0x3612ef['query']=_[_0xe090('0x30')](_0x452737[_0xe090('0x2f')]);_0x3612ef[_0xe090('0x31')]=_['intersection'](_0x3612ef[_0xe090('0x2e')],_0x3612ef[_0xe090('0x2f')]);_0x41d886[_0xe090('0x34')]=_[_0xe090('0x32')](_0x3612ef[_0xe090('0x2e')],qs[_0xe090('0x33')](_0x452737[_0xe090('0x2f')]['fields']));_0x41d886[_0xe090('0x34')]=_0x41d886[_0xe090('0x34')][_0xe090('0x35')]?_0x41d886[_0xe090('0x34')]:_0x3612ef['model'];_0x41d886[_0xe090('0x38')]=qs[_0xe090('0x39')](_0x452737[_0xe090('0x2f')][_0xe090('0x39')]);_0x41d886[_0xe090('0x3a')]=qs[_0xe090('0x31')](_[_0xe090('0x49')](_0x452737['query'],_0x3612ef[_0xe090('0x31')]));if(_0x452737[_0xe090('0x2f')][_0xe090('0x3b')]){_0x41d886['where']=_[_0xe090('0x43')](_0x41d886[_0xe090('0x3a')],{'$or':_['map'](_0x41d886[_0xe090('0x34')],function(_0x2cc19f){var _0x1ca025={};_0x1ca025[_0x2cc19f]={'$like':'%'+_0x452737[_0xe090('0x2f')][_0xe090('0x3b')]+'%'};return _0x1ca025;})});}_0x41d886=_['merge']({},_0x41d886,_0x452737[_0xe090('0x3c')]);return _0x1a2eaf['getFields'](_0x41d886);}})[_0xe090('0x23')](function(_0x12991e){if(_0x12991e){_0x50922c=_0x12991e['length'];if(!_0x452737[_0xe090('0x2f')]['hasOwnProperty'](_0xe090('0x37'))){_0x41d886[_0xe090('0x1b')]=qs[_0xe090('0x1b')](_0x452737['query']['limit']);_0x41d886[_0xe090('0x19')]=qs[_0xe090('0x19')](_0x452737[_0xe090('0x2f')][_0xe090('0x19')]);}return _0x1a2eaf[_0xe090('0x4b')](_0x41d886);}})[_0xe090('0x23')](function(_0x1e38c5){if(_0x1e38c5){return _0x1e38c5?{'count':_0x50922c,'rows':_0x1e38c5}:null;}})[_0xe090('0x23')](respondWithResult(_0x15a292,null))[_0xe090('0x45')](handleError(_0x15a292,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3d3228b..22f02c6 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 _0xebf0=['api','moment','bluebird','request-promise','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0xdbf8f2,_0x409a32){var _0x4ed5d2=function(_0xe7819c){while(--_0xe7819c){_0xdbf8f2['push'](_0xdbf8f2['shift']());}};_0x4ed5d2(++_0x409a32);}(_0xebf0,0x166));var _0x0ebf=function(_0x132ba5,_0xa689f0){_0x132ba5=_0x132ba5-0x0;var _0x47298c=_0xebf0[_0x132ba5];return _0x47298c;};'use strict';var _=require('lodash');var util=require(_0x0ebf('0x0'));var logger=require(_0x0ebf('0x1'))(_0x0ebf('0x2'));var moment=require(_0x0ebf('0x3'));var BPromise=require(_0x0ebf('0x4'));var rp=require(_0x0ebf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0ebf('0x6')]=function(_0x31cc5a,_0x23b132){return _0x31cc5a[_0x0ebf('0x7')](_0x0ebf('0x8'),attributes,{'tableName':_0x0ebf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa989=['bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','moment'];(function(_0xbdafc3,_0x121178){var _0x5de68c=function(_0x43d25e){while(--_0x43d25e){_0xbdafc3['push'](_0xbdafc3['shift']());}};_0x5de68c(++_0x121178);}(_0xa989,0xa1));var _0x9a98=function(_0xff8bf4,_0x38361d){_0xff8bf4=_0xff8bf4-0x0;var _0x4dd041=_0xa989[_0xff8bf4];return _0x4dd041;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9a98('0x0'));var BPromise=require(_0x9a98('0x1'));var rp=require(_0x9a98('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a98('0x3'));var attributes=require(_0x9a98('0x4'));module[_0x9a98('0x5')]=function(_0x44ec56,_0x63afb5){return _0x44ec56[_0x9a98('0x6')](_0x9a98('0x7'),attributes,{'tableName':_0x9a98('0x8'),'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 b2403fe..1de83ac 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 _0x23fe=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5e3121,_0xa76626){var _0x150f5a=function(_0x16e881){while(--_0x16e881){_0x5e3121['push'](_0x5e3121['shift']());}};_0x150f5a(++_0xa76626);}(_0x23fe,0x186));var _0xe23f=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x23fe[_0x2f1762];return _0x8ab21;};'use strict';var _=require('lodash');var util=require(_0xe23f('0x0'));var moment=require(_0xe23f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe23f('0x2'));var fs=require('fs');var Redis=require(_0xe23f('0x3'));var db=require(_0xe23f('0x4'))['db'];var utils=require(_0xe23f('0x5'));var logger=require('../../config/logger')(_0xe23f('0x6'));var config=require(_0xe23f('0x7'));var jayson=require(_0xe23f('0x8'));var client=jayson['client'][_0xe23f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ef5b,_0x4423f0,_0xf101e9){return new BPromise(function(_0x345c73,_0xd6d5a6){return client[_0xe23f('0xa')](_0x47ef5b,_0xf101e9)[_0xe23f('0xb')](function(_0x43717a){logger[_0xe23f('0xc')](_0xe23f('0xd'),_0x4423f0,'request\x20sent');logger['debug'](_0xe23f('0xe'),_0x4423f0,_0xe23f('0xf'),JSON['stringify'](_0x43717a));if(_0x43717a['error']){if(_0x43717a['error'][_0xe23f('0x10')]===0x1f4){logger[_0xe23f('0x11')](_0xe23f('0xd'),_0x4423f0,_0x43717a[_0xe23f('0x11')][_0xe23f('0x12')]);return _0xd6d5a6(_0x43717a[_0xe23f('0x11')]['message']);}logger[_0xe23f('0x11')](_0xe23f('0xd'),_0x4423f0,_0x43717a[_0xe23f('0x11')][_0xe23f('0x12')]);return _0x345c73(_0x43717a[_0xe23f('0x11')]['message']);}else{logger[_0xe23f('0xc')](_0xe23f('0xd'),_0x4423f0,_0xe23f('0xf'));_0x345c73(_0x43717a[_0xe23f('0x13')][_0xe23f('0x12')]);}})[_0xe23f('0x14')](function(_0x4ab682){logger['error'](_0xe23f('0xd'),_0x4423f0,_0x4ab682);_0xd6d5a6(_0x4ab682);});});} \ No newline at end of file +var _0x3998=['client','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5212cf,_0xf4d01){var _0x471ea2=function(_0x38ed9f){while(--_0x38ed9f){_0x5212cf['push'](_0x5212cf['shift']());}};_0x471ea2(++_0xf4d01);}(_0x3998,0x116));var _0x8399=function(_0x14801f,_0x304b57){_0x14801f=_0x14801f-0x0;var _0x51b24e=_0x3998[_0x14801f];return _0x51b24e;};'use strict';var _=require('lodash');var util=require(_0x8399('0x0'));var moment=require(_0x8399('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8399('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8399('0x3'));var logger=require('../../config/logger')(_0x8399('0x4'));var config=require(_0x8399('0x5'));var jayson=require(_0x8399('0x6'));var client=jayson[_0x8399('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184d51,_0x5f02eb,_0x56d183){return new BPromise(function(_0x24b6ca,_0xc0a83e){return client['request'](_0x184d51,_0x56d183)['then'](function(_0x5130a3){logger[_0x8399('0x8')](_0x8399('0x9'),_0x5f02eb,'request\x20sent');logger[_0x8399('0xa')](_0x8399('0xb'),_0x5f02eb,'request\x20sent',JSON[_0x8399('0xc')](_0x5130a3));if(_0x5130a3['error']){if(_0x5130a3['error'][_0x8399('0xd')]===0x1f4){logger[_0x8399('0xe')](_0x8399('0x9'),_0x5f02eb,_0x5130a3[_0x8399('0xe')][_0x8399('0xf')]);return _0xc0a83e(_0x5130a3[_0x8399('0xe')][_0x8399('0xf')]);}logger['error'](_0x8399('0x9'),_0x5f02eb,_0x5130a3[_0x8399('0xe')]['message']);return _0x24b6ca(_0x5130a3[_0x8399('0xe')]['message']);}else{logger[_0x8399('0x8')](_0x8399('0x9'),_0x5f02eb,_0x8399('0x10'));_0x24b6ca(_0x5130a3[_0x8399('0x11')][_0x8399('0xf')]);}})[_0x8399('0x12')](function(_0x416056){logger[_0x8399('0xe')](_0x8399('0x9'),_0x5f02eb,_0x416056);_0xc0a83e(_0x416056);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2b5f8a2..a0a1f93 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 _0x644a=['path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x644a,0xfd));var _0xa644=function(_0xa1e2fd,_0x1c9305){_0xa1e2fd=_0xa1e2fd-0x0;var _0x218880=_0x644a[_0xa1e2fd];return _0x218880;};'use strict';var multer=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var path=require(_0xa644('0x2'));var timeout=require(_0xa644('0x3'));var express=require(_0xa644('0x4'));var router=express['Router']();var fs_extra=require(_0xa644('0x5'));var auth=require(_0xa644('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa644('0x7'));router[_0xa644('0x8')]('/',auth[_0xa644('0x9')](),controller['index']);router[_0xa644('0x8')](_0xa644('0xa'),auth['isAuthenticated'](),controller[_0xa644('0xb')]);router[_0xa644('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa644('0xd')](_0xa644('0xa'),auth['isAuthenticated'](),controller[_0xa644('0xe')]);router[_0xa644('0xf')](_0xa644('0xa'),auth[_0xa644('0x9')](),controller[_0xa644('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa37e=['post','isAuthenticated','create','/:id','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','show'];(function(_0x58f630,_0x47fd13){var _0x1738a0=function(_0x53e5c7){while(--_0x53e5c7){_0x58f630['push'](_0x58f630['shift']());}};_0x1738a0(++_0x47fd13);}(_0xa37e,0x97));var _0xea37=function(_0x593883,_0x584df3){_0x593883=_0x593883-0x0;var _0x4eb1a7=_0xa37e[_0x593883];return _0x4eb1a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xea37('0x8')]);router[_0xea37('0x9')]('/',auth[_0xea37('0xa')](),controller[_0xea37('0xb')]);router['put'](_0xea37('0xc'),auth[_0xea37('0xa')](),controller[_0xea37('0xd')]);router['delete']('/:id',auth[_0xea37('0xa')](),controller[_0xea37('0xe')]);module[_0xea37('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4b8340c..192224f 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 _0x8399=['customVariable','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5afae9,_0x37814a){var _0x4ccd1a=function(_0x5bcd58){while(--_0x5bcd58){_0x5afae9['push'](_0x5afae9['shift']());}};_0x4ccd1a(++_0x37814a);}(_0x8399,0x7c));var _0x9839=function(_0x117f87,_0x4a1be5){_0x117f87=_0x117f87-0x0;var _0x3b46ad=_0x8399[_0x117f87];return _0x3b46ad;};'use strict';var Sequelize=require(_0x9839('0x0'));module[_0x9839('0x1')]={'type':{'type':Sequelize[_0x9839('0x2')](_0x9839('0x3'),'variable',_0x9839('0x4'),'keyValue','picklist'),'defaultValue':_0x9839('0x3')},'content':{'type':Sequelize[_0x9839('0x5')]},'key':{'type':Sequelize[_0x9839('0x5')]},'keyType':{'type':Sequelize[_0x9839('0x2')]('string',_0x9839('0x6'),_0x9839('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9839('0x5')]},'nameField':{'type':Sequelize[_0x9839('0x5')]},'customField':{'type':Sequelize[_0x9839('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9839('0x5')]}}; \ No newline at end of file +var _0xd3f3=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3f3125,_0x3f49d2){var _0x28bf12=function(_0xb9d9cb){while(--_0xb9d9cb){_0x3f3125['push'](_0x3f3125['shift']());}};_0x28bf12(++_0x3f49d2);}(_0xd3f3,0xcb));var _0x3d3f=function(_0x1d8f93,_0x5d1289){_0x1d8f93=_0x1d8f93-0x0;var _0x53dd06=_0xd3f3[_0x1d8f93];return _0x53dd06;};'use strict';var Sequelize=require(_0x3d3f('0x0'));module[_0x3d3f('0x1')]={'type':{'type':Sequelize[_0x3d3f('0x2')](_0x3d3f('0x3'),_0x3d3f('0x4'),_0x3d3f('0x5'),_0x3d3f('0x6'),_0x3d3f('0x7')),'defaultValue':_0x3d3f('0x3')},'content':{'type':Sequelize[_0x3d3f('0x8')]},'key':{'type':Sequelize[_0x3d3f('0x8')]},'keyType':{'type':Sequelize[_0x3d3f('0x2')]('string',_0x3d3f('0x4'),_0x3d3f('0x5'))},'keyContent':{'type':Sequelize[_0x3d3f('0x8')]},'idField':{'type':Sequelize[_0x3d3f('0x8')]},'nameField':{'type':Sequelize[_0x3d3f('0x8')]},'customField':{'type':Sequelize[_0x3d3f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d3f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fabe49c..eb7c637 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 _0x0a65=['filter','merge','options','FreshsalesField','includeAll','include','rows','catch','show','model','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0a65,0xa1));var _0x50a6=function(_0x30abb1,_0x40b407){_0x30abb1=_0x30abb1-0x0;var _0x7d05a7=_0x0a65[_0x30abb1];return _0x7d05a7;};'use strict';var emlformat=require(_0x50a6('0x0'));var rimraf=require(_0x50a6('0x1'));var zipdir=require(_0x50a6('0x2'));var jsonpatch=require(_0x50a6('0x3'));var rp=require(_0x50a6('0x4'));var moment=require(_0x50a6('0x5'));var BPromise=require(_0x50a6('0x6'));var Mustache=require('mustache');var util=require(_0x50a6('0x7'));var path=require('path');var sox=require(_0x50a6('0x8'));var csv=require('to-csv');var ejs=require(_0x50a6('0x9'));var fs=require('fs');var fs_extra=require(_0x50a6('0xa'));var _=require(_0x50a6('0xb'));var squel=require(_0x50a6('0xc'));var crypto=require(_0x50a6('0xd'));var jsforce=require(_0x50a6('0xe'));var deskjs=require(_0x50a6('0xf'));var toCsv=require(_0x50a6('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50a6('0x11'));var authService=require(_0x50a6('0x12'));var qs=require(_0x50a6('0x13'));var as=require(_0x50a6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50a6('0x15'))(_0x50a6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x50a6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x463f37,_0x52ec95){_0x52ec95=_0x52ec95||0xcc;return function(_0x299a5a){if(_0x299a5a){return _0x463f37[_0x50a6('0x18')](_0x52ec95);}return _0x463f37[_0x50a6('0x19')](_0x52ec95)[_0x50a6('0x1a')]();};}function respondWithResult(_0x3ff37b,_0x22d506){_0x22d506=_0x22d506||0xc8;return function(_0x45c008){if(_0x45c008){return _0x3ff37b[_0x50a6('0x19')](_0x22d506)['json'](_0x45c008);}};}function respondWithFilteredResult(_0x2ee1df,_0x4072f6){return function(_0x5ea27c){if(_0x5ea27c){var _0x5eaa4a=typeof _0x4072f6[_0x50a6('0x1b')]===_0x50a6('0x1c')&&typeof _0x4072f6['limit']===_0x50a6('0x1c');var _0x19f440=_0x5ea27c[_0x50a6('0x1d')];var _0x5e7501=_0x5eaa4a?0x0:_0x4072f6[_0x50a6('0x1b')];var _0x370481=_0x5eaa4a?_0x5ea27c[_0x50a6('0x1d')]:_0x4072f6[_0x50a6('0x1b')]+_0x4072f6[_0x50a6('0x1e')];var _0x391025;if(_0x370481>=_0x19f440){_0x370481=_0x19f440;_0x391025=0xc8;}else{_0x391025=0xce;}_0x2ee1df[_0x50a6('0x19')](_0x391025);return _0x2ee1df[_0x50a6('0x1f')]('Content-Range',_0x5e7501+'-'+_0x370481+'/'+_0x19f440)[_0x50a6('0x20')](_0x5ea27c);}return null;};}function patchUpdates(_0x15e984){return function(_0x1c7927){try{jsonpatch[_0x50a6('0x21')](_0x1c7927,_0x15e984,!![]);}catch(_0x40bb2f){return BPromise[_0x50a6('0x22')](_0x40bb2f);}return _0x1c7927[_0x50a6('0x23')]();};}function saveUpdates(_0x4d2f07,_0x3c8307){return function(_0xd57846){if(_0xd57846){return _0xd57846[_0x50a6('0x24')](_0x4d2f07)[_0x50a6('0x25')](function(_0x5b68b0){return _0x5b68b0;});}return null;};}function removeEntity(_0x3cbf49,_0x5b9010){return function(_0x21ddbc){if(_0x21ddbc){return _0x21ddbc[_0x50a6('0x26')]()[_0x50a6('0x25')](function(){_0x3cbf49[_0x50a6('0x19')](0xcc)[_0x50a6('0x1a')]();});}};}function handleEntityNotFound(_0x2c3281,_0x505c92){return function(_0x40968a){if(!_0x40968a){_0x2c3281[_0x50a6('0x18')](0x194);}return _0x40968a;};}function handleError(_0x4af7cf,_0x2ea9d6){_0x2ea9d6=_0x2ea9d6||0x1f4;return function(_0x33ea40){logger['error'](_0x33ea40[_0x50a6('0x27')]);if(_0x33ea40[_0x50a6('0x28')]){delete _0x33ea40[_0x50a6('0x28')];}_0x4af7cf[_0x50a6('0x19')](_0x2ea9d6)[_0x50a6('0x29')](_0x33ea40);};}exports['index']=function(_0x5bf4e2,_0x3c1271){var _0x365219={},_0xf697d1={},_0x3eae52={'count':0x0,'rows':[]};var _0xe4c1d3=_[_0x50a6('0x2a')](db['FreshsalesField'][_0x50a6('0x2b')],function(_0x215514){return{'name':_0x215514[_0x50a6('0x2c')],'type':_0x215514['type'][_0x50a6('0x2d')]};});_0xf697d1['model']=_['map'](_0xe4c1d3,_0x50a6('0x28'));_0xf697d1[_0x50a6('0x2e')]=_[_0x50a6('0x2f')](_0x5bf4e2[_0x50a6('0x2e')]);_0xf697d1[_0x50a6('0x30')]=_[_0x50a6('0x31')](_0xf697d1['model'],_0xf697d1[_0x50a6('0x2e')]);_0x365219['attributes']=_[_0x50a6('0x31')](_0xf697d1['model'],qs['fields'](_0x5bf4e2[_0x50a6('0x2e')][_0x50a6('0x32')]));_0x365219[_0x50a6('0x33')]=_0x365219['attributes']['length']?_0x365219[_0x50a6('0x33')]:_0xf697d1['model'];if(!_0x5bf4e2[_0x50a6('0x2e')][_0x50a6('0x34')]('nolimit')){_0x365219['limit']=qs['limit'](_0x5bf4e2[_0x50a6('0x2e')]['limit']);_0x365219[_0x50a6('0x1b')]=qs['offset'](_0x5bf4e2[_0x50a6('0x2e')][_0x50a6('0x1b')]);}_0x365219[_0x50a6('0x35')]=qs[_0x50a6('0x36')](_0x5bf4e2[_0x50a6('0x2e')][_0x50a6('0x36')]);_0x365219[_0x50a6('0x37')]=qs['filters'](_[_0x50a6('0x38')](_0x5bf4e2[_0x50a6('0x2e')],_0xf697d1[_0x50a6('0x30')]),_0xe4c1d3);if(_0x5bf4e2[_0x50a6('0x2e')]['filter']){_0x365219[_0x50a6('0x37')]=_['merge'](_0x365219[_0x50a6('0x37')],{'$or':_[_0x50a6('0x2a')](_0xe4c1d3,function(_0x57bb3e){if(_0x57bb3e['type']!==_0x50a6('0x39')){var _0x169fb8={};_0x169fb8[_0x57bb3e[_0x50a6('0x28')]]={'$like':'%'+_0x5bf4e2[_0x50a6('0x2e')][_0x50a6('0x3a')]+'%'};return _0x169fb8;}})});}_0x365219=_[_0x50a6('0x3b')]({},_0x365219,_0x5bf4e2[_0x50a6('0x3c')]);var _0x43b81d={'where':_0x365219[_0x50a6('0x37')]};return db[_0x50a6('0x3d')][_0x50a6('0x1d')](_0x43b81d)['then'](function(_0x1590d2){_0x3eae52['count']=_0x1590d2;if(_0x5bf4e2['query'][_0x50a6('0x3e')]){_0x365219[_0x50a6('0x3f')]=[{'all':!![]}];}return db[_0x50a6('0x3d')]['findAll'](_0x365219);})[_0x50a6('0x25')](function(_0x129610){_0x3eae52[_0x50a6('0x40')]=_0x129610;return _0x3eae52;})[_0x50a6('0x25')](respondWithFilteredResult(_0x3c1271,_0x365219))[_0x50a6('0x41')](handleError(_0x3c1271,null));};exports[_0x50a6('0x42')]=function(_0x49317b,_0x3768ca){var _0x182183={'raw':!![],'where':{'id':_0x49317b['params']['id']}},_0x404627={};_0x404627[_0x50a6('0x43')]=_[_0x50a6('0x2f')](db[_0x50a6('0x3d')][_0x50a6('0x2b')]);_0x404627[_0x50a6('0x2e')]=_['keys'](_0x49317b['query']);_0x404627['filters']=_[_0x50a6('0x31')](_0x404627[_0x50a6('0x43')],_0x404627['query']);_0x182183[_0x50a6('0x33')]=_[_0x50a6('0x31')](_0x404627['model'],qs['fields'](_0x49317b[_0x50a6('0x2e')][_0x50a6('0x32')]));_0x182183[_0x50a6('0x33')]=_0x182183[_0x50a6('0x33')][_0x50a6('0x44')]?_0x182183['attributes']:_0x404627[_0x50a6('0x43')];if(_0x49317b[_0x50a6('0x2e')][_0x50a6('0x3e')]){_0x182183[_0x50a6('0x3f')]=[{'all':!![]}];}_0x182183=_[_0x50a6('0x3b')]({},_0x182183,_0x49317b[_0x50a6('0x3c')]);return db[_0x50a6('0x3d')][_0x50a6('0x45')](_0x182183)[_0x50a6('0x25')](handleEntityNotFound(_0x3768ca,null))[_0x50a6('0x25')](respondWithResult(_0x3768ca,null))[_0x50a6('0x41')](handleError(_0x3768ca,null));};exports[_0x50a6('0x46')]=function(_0x39cf0f,_0x1598c7){return db[_0x50a6('0x3d')][_0x50a6('0x46')](_0x39cf0f[_0x50a6('0x47')],{})[_0x50a6('0x25')](respondWithResult(_0x1598c7,0xc9))['catch'](handleError(_0x1598c7,null));};exports[_0x50a6('0x24')]=function(_0x552c24,_0x3a23a7){if(_0x552c24[_0x50a6('0x47')]['id']){delete _0x552c24[_0x50a6('0x47')]['id'];}return db[_0x50a6('0x3d')][_0x50a6('0x45')]({'where':{'id':_0x552c24['params']['id']}})[_0x50a6('0x25')](handleEntityNotFound(_0x3a23a7,null))[_0x50a6('0x25')](saveUpdates(_0x552c24[_0x50a6('0x47')],null))[_0x50a6('0x25')](respondWithResult(_0x3a23a7,null))['catch'](handleError(_0x3a23a7,null));};exports[_0x50a6('0x26')]=function(_0x23f1b4,_0x324bea){return db['FreshsalesField'][_0x50a6('0x45')]({'where':{'id':_0x23f1b4[_0x50a6('0x48')]['id']}})['then'](handleEntityNotFound(_0x324bea,null))[_0x50a6('0x25')](removeEntity(_0x324bea,null))[_0x50a6('0x41')](handleError(_0x324bea,null));}; \ No newline at end of file +var _0x008b=['catch','FreshsalesField','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows'];(function(_0x3f9edd,_0x43c0bf){var _0x167d51=function(_0x346377){while(--_0x346377){_0x3f9edd['push'](_0x3f9edd['shift']());}};_0x167d51(++_0x43c0bf);}(_0x008b,0x1c2));var _0xb008=function(_0x3ddbcc,_0x54be6b){_0x3ddbcc=_0x3ddbcc-0x0;var _0x381b48=_0x008b[_0x3ddbcc];return _0x381b48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb008('0x0'));var jsonpatch=require(_0xb008('0x1'));var rp=require(_0xb008('0x2'));var moment=require(_0xb008('0x3'));var BPromise=require(_0xb008('0x4'));var Mustache=require(_0xb008('0x5'));var util=require('util');var path=require(_0xb008('0x6'));var sox=require(_0xb008('0x7'));var csv=require('to-csv');var ejs=require(_0xb008('0x8'));var fs=require('fs');var fs_extra=require(_0xb008('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb008('0xa'));var jsforce=require(_0xb008('0xb'));var deskjs=require(_0xb008('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb008('0xd'));var Redis=require(_0xb008('0xe'));var authService=require(_0xb008('0xf'));var qs=require(_0xb008('0x10'));var as=require(_0xb008('0x11'));var hardwareService=require(_0xb008('0x12'));var logger=require(_0xb008('0x13'))(_0xb008('0x14'));var utils=require('../../config/utils');var config=require(_0xb008('0x15'));var licenseUtil=require(_0xb008('0x16'));var db=require(_0xb008('0x17'))['db'];function respondWithStatusCode(_0x48460b,_0x1f6dc0){_0x1f6dc0=_0x1f6dc0||0xcc;return function(_0x16504e){if(_0x16504e){return _0x48460b[_0xb008('0x18')](_0x1f6dc0);}return _0x48460b[_0xb008('0x19')](_0x1f6dc0)[_0xb008('0x1a')]();};}function respondWithResult(_0x44ee41,_0x183ca6){_0x183ca6=_0x183ca6||0xc8;return function(_0x1a4f00){if(_0x1a4f00){return _0x44ee41['status'](_0x183ca6)[_0xb008('0x1b')](_0x1a4f00);}};}function respondWithFilteredResult(_0x517744,_0x4a219b){return function(_0x282083){if(_0x282083){var _0x36629d=typeof _0x4a219b[_0xb008('0x1c')]===_0xb008('0x1d')&&typeof _0x4a219b['limit']==='undefined';var _0x46779d=_0x282083['count'];var _0x41fe2d=_0x36629d?0x0:_0x4a219b['offset'];var _0x45f18a=_0x36629d?_0x282083[_0xb008('0x1e')]:_0x4a219b[_0xb008('0x1c')]+_0x4a219b[_0xb008('0x1f')];var _0x18287b;if(_0x45f18a>=_0x46779d){_0x45f18a=_0x46779d;_0x18287b=0xc8;}else{_0x18287b=0xce;}_0x517744[_0xb008('0x19')](_0x18287b);return _0x517744['set'](_0xb008('0x20'),_0x41fe2d+'-'+_0x45f18a+'/'+_0x46779d)[_0xb008('0x1b')](_0x282083);}return null;};}function patchUpdates(_0x4be0c8){return function(_0x1d0f0c){try{jsonpatch[_0xb008('0x21')](_0x1d0f0c,_0x4be0c8,!![]);}catch(_0x1e7304){return BPromise[_0xb008('0x22')](_0x1e7304);}return _0x1d0f0c[_0xb008('0x23')]();};}function saveUpdates(_0x3e9a35,_0x530e40){return function(_0x5b71ea){if(_0x5b71ea){return _0x5b71ea[_0xb008('0x24')](_0x3e9a35)['then'](function(_0x2a5aeb){return _0x2a5aeb;});}return null;};}function removeEntity(_0x12e62e,_0x3dbafa){return function(_0x3672d3){if(_0x3672d3){return _0x3672d3[_0xb008('0x25')]()['then'](function(){_0x12e62e[_0xb008('0x19')](0xcc)[_0xb008('0x1a')]();});}};}function handleEntityNotFound(_0x2f73a8,_0x590e2d){return function(_0x1ce6fd){if(!_0x1ce6fd){_0x2f73a8['sendStatus'](0x194);}return _0x1ce6fd;};}function handleError(_0x4c5945,_0x5b081a){_0x5b081a=_0x5b081a||0x1f4;return function(_0x4f0905){logger[_0xb008('0x26')](_0x4f0905[_0xb008('0x27')]);if(_0x4f0905[_0xb008('0x28')]){delete _0x4f0905[_0xb008('0x28')];}_0x4c5945[_0xb008('0x19')](_0x5b081a)[_0xb008('0x29')](_0x4f0905);};}exports['index']=function(_0x3f1def,_0x499ba3){var _0x76d64e={},_0x5d4041={},_0x1c1314={'count':0x0,'rows':[]};var _0x464551=_[_0xb008('0x2a')](db['FreshsalesField'][_0xb008('0x2b')],function(_0x59ea71){return{'name':_0x59ea71[_0xb008('0x2c')],'type':_0x59ea71[_0xb008('0x2d')][_0xb008('0x2e')]};});_0x5d4041[_0xb008('0x2f')]=_[_0xb008('0x2a')](_0x464551,_0xb008('0x28'));_0x5d4041[_0xb008('0x30')]=_[_0xb008('0x31')](_0x3f1def['query']);_0x5d4041[_0xb008('0x32')]=_[_0xb008('0x33')](_0x5d4041[_0xb008('0x2f')],_0x5d4041[_0xb008('0x30')]);_0x76d64e[_0xb008('0x34')]=_[_0xb008('0x33')](_0x5d4041[_0xb008('0x2f')],qs[_0xb008('0x35')](_0x3f1def[_0xb008('0x30')]['fields']));_0x76d64e[_0xb008('0x34')]=_0x76d64e[_0xb008('0x34')][_0xb008('0x36')]?_0x76d64e[_0xb008('0x34')]:_0x5d4041[_0xb008('0x2f')];if(!_0x3f1def['query'][_0xb008('0x37')]('nolimit')){_0x76d64e[_0xb008('0x1f')]=qs[_0xb008('0x1f')](_0x3f1def[_0xb008('0x30')][_0xb008('0x1f')]);_0x76d64e['offset']=qs[_0xb008('0x1c')](_0x3f1def[_0xb008('0x30')][_0xb008('0x1c')]);}_0x76d64e[_0xb008('0x38')]=qs[_0xb008('0x39')](_0x3f1def[_0xb008('0x30')]['sort']);_0x76d64e['where']=qs['filters'](_[_0xb008('0x3a')](_0x3f1def[_0xb008('0x30')],_0x5d4041['filters']),_0x464551);if(_0x3f1def['query']['filter']){_0x76d64e[_0xb008('0x3b')]=_['merge'](_0x76d64e[_0xb008('0x3b')],{'$or':_[_0xb008('0x2a')](_0x464551,function(_0x193cd1){if(_0x193cd1[_0xb008('0x2d')]!==_0xb008('0x3c')){var _0x5d6b2c={};_0x5d6b2c[_0x193cd1['name']]={'$like':'%'+_0x3f1def[_0xb008('0x30')][_0xb008('0x3d')]+'%'};return _0x5d6b2c;}})});}_0x76d64e=_[_0xb008('0x3e')]({},_0x76d64e,_0x3f1def['options']);var _0x2d95be={'where':_0x76d64e[_0xb008('0x3b')]};return db['FreshsalesField'][_0xb008('0x1e')](_0x2d95be)[_0xb008('0x3f')](function(_0x56ab5f){_0x1c1314[_0xb008('0x1e')]=_0x56ab5f;if(_0x3f1def['query'][_0xb008('0x40')]){_0x76d64e[_0xb008('0x41')]=[{'all':!![]}];}return db['FreshsalesField'][_0xb008('0x42')](_0x76d64e);})[_0xb008('0x3f')](function(_0x236744){_0x1c1314[_0xb008('0x43')]=_0x236744;return _0x1c1314;})['then'](respondWithFilteredResult(_0x499ba3,_0x76d64e))[_0xb008('0x44')](handleError(_0x499ba3,null));};exports['show']=function(_0x147cc8,_0x5e4dc5){var _0xd857c1={'raw':!![],'where':{'id':_0x147cc8['params']['id']}},_0x22ac0b={};_0x22ac0b[_0xb008('0x2f')]=_[_0xb008('0x31')](db[_0xb008('0x45')][_0xb008('0x2b')]);_0x22ac0b[_0xb008('0x30')]=_[_0xb008('0x31')](_0x147cc8[_0xb008('0x30')]);_0x22ac0b[_0xb008('0x32')]=_['intersection'](_0x22ac0b[_0xb008('0x2f')],_0x22ac0b[_0xb008('0x30')]);_0xd857c1[_0xb008('0x34')]=_[_0xb008('0x33')](_0x22ac0b[_0xb008('0x2f')],qs[_0xb008('0x35')](_0x147cc8[_0xb008('0x30')]['fields']));_0xd857c1[_0xb008('0x34')]=_0xd857c1['attributes'][_0xb008('0x36')]?_0xd857c1[_0xb008('0x34')]:_0x22ac0b['model'];if(_0x147cc8['query'][_0xb008('0x40')]){_0xd857c1[_0xb008('0x41')]=[{'all':!![]}];}_0xd857c1=_['merge']({},_0xd857c1,_0x147cc8['options']);return db[_0xb008('0x45')][_0xb008('0x46')](_0xd857c1)[_0xb008('0x3f')](handleEntityNotFound(_0x5e4dc5,null))[_0xb008('0x3f')](respondWithResult(_0x5e4dc5,null))[_0xb008('0x44')](handleError(_0x5e4dc5,null));};exports[_0xb008('0x47')]=function(_0x30ac6d,_0x58e77b){return db[_0xb008('0x45')][_0xb008('0x47')](_0x30ac6d[_0xb008('0x48')],{})[_0xb008('0x3f')](respondWithResult(_0x58e77b,0xc9))[_0xb008('0x44')](handleError(_0x58e77b,null));};exports[_0xb008('0x24')]=function(_0x1e5a17,_0x61d5a6){if(_0x1e5a17[_0xb008('0x48')]['id']){delete _0x1e5a17[_0xb008('0x48')]['id'];}return db[_0xb008('0x45')][_0xb008('0x46')]({'where':{'id':_0x1e5a17[_0xb008('0x49')]['id']}})[_0xb008('0x3f')](handleEntityNotFound(_0x61d5a6,null))[_0xb008('0x3f')](saveUpdates(_0x1e5a17[_0xb008('0x48')],null))['then'](respondWithResult(_0x61d5a6,null))[_0xb008('0x44')](handleError(_0x61d5a6,null));};exports[_0xb008('0x25')]=function(_0x40f3be,_0x49e6e9){return db[_0xb008('0x45')][_0xb008('0x46')]({'where':{'id':_0x40f3be['params']['id']}})['then'](handleEntityNotFound(_0x49e6e9,null))[_0xb008('0x3f')](removeEntity(_0x49e6e9,null))[_0xb008('0x44')](handleError(_0x49e6e9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7a69aff..d2b0935 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 _0xa3e8=['bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x5f27c4,_0x2c7e36){var _0x4a3f30=function(_0x53f951){while(--_0x53f951){_0x5f27c4['push'](_0x5f27c4['shift']());}};_0x4a3f30(++_0x2c7e36);}(_0xa3e8,0x127));var _0x8a3e=function(_0x651326,_0x118be1){_0x651326=_0x651326-0x0;var _0x4f5d32=_0xa3e8[_0x651326];return _0x4f5d32;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var logger=require(_0x8a3e('0x2'))('api');var moment=require(_0x8a3e('0x3'));var BPromise=require(_0x8a3e('0x4'));var rp=require(_0x8a3e('0x5'));var fs=require('fs');var path=require(_0x8a3e('0x6'));var rimraf=require(_0x8a3e('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x920901,_0xe682f5){return _0x920901[_0x8a3e('0x8')]('FreshsalesField',attributes,{'tableName':_0x8a3e('0x9'),'paranoid':![],'indexes':[{'name':_0x8a3e('0xa'),'fields':[_0x8a3e('0xb'),_0x8a3e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d62=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9d62,0xaf));var _0x29d6=function(_0x140543,_0x5c2826){_0x140543=_0x140543-0x0;var _0x4a3db9=_0x9d62[_0x140543];return _0x4a3db9;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var logger=require(_0x29d6('0x2'))(_0x29d6('0x3'));var moment=require(_0x29d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x29d6('0x5'));var fs=require('fs');var path=require(_0x29d6('0x6'));var rimraf=require(_0x29d6('0x7'));var config=require(_0x29d6('0x8'));var attributes=require(_0x29d6('0x9'));module['exports']=function(_0x2962a9,_0x468e41){return _0x2962a9[_0x29d6('0xa')](_0x29d6('0xb'),attributes,{'tableName':_0x29d6('0xc'),'paranoid':![],'indexes':[{'name':_0x29d6('0xd'),'fields':['idField',_0x29d6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 66848b6..89a2562 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 _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1cb028,_0x494c84){var _0x4b589d=function(_0x37f615){while(--_0x37f615){_0x1cb028['push'](_0x1cb028['shift']());}};_0x4b589d(++_0x494c84);}(_0x2542,0x169));var _0x2254=function(_0x59d073,_0x55b8fc){_0x59d073=_0x59d073-0x0;var _0x46d3df=_0x2542[_0x59d073];return _0x46d3df;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3b97d8,_0x1fd15a){var _0x5ba73b=function(_0x3f751f){while(--_0x3f751f){_0x3b97d8['push'](_0x3b97d8['shift']());}};_0x5ba73b(++_0x1fd15a);}(_0x326f,0xd1));var _0xf326=function(_0x3a4e16,_0x3d91ba){_0x3a4e16=_0x3a4e16-0x0;var _0x35fc20=_0x326f[_0x3a4e16];return _0x35fc20;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3c97677..0f25c74 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(_0x1b3632,_0x122fe4){var _0x4ca30d=function(_0x574288){while(--_0x574288){_0x1b3632['push'](_0x1b3632['shift']());}};_0x4ca30d(++_0x122fe4);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x464e74,_0x440f9c){var _0x522fd4=function(_0x41a390){while(--_0x41a390){_0x464e74['push'](_0x464e74['shift']());}};_0x522fd4(++_0x440f9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 e0bed21..43bbf7d 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 _0x1967=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x518de9,_0x380b2c){var _0xd3a835=function(_0x14086c){while(--_0x14086c){_0x518de9['push'](_0x518de9['shift']());}};_0xd3a835(++_0x380b2c);}(_0x1967,0x173));var _0x7196=function(_0x315a2b,_0x4f1166){_0x315a2b=_0x315a2b-0x0;var _0x3a5148=_0x1967[_0x315a2b];return _0x3a5148;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'remoteUri':{'type':Sequelize[_0x7196('0x1')]},'password':{'type':Sequelize[_0x7196('0x1')]},'clientId':{'type':Sequelize[_0x7196('0x1')]},'clientSecret':{'type':Sequelize[_0x7196('0x1')]},'securityToken':{'type':Sequelize[_0x7196('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](_0x7196('0x4'),_0x7196('0x5')),'defaultValue':_0x7196('0x4')}}; \ No newline at end of file +var _0xd824=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x5685bb,_0x2315c5){var _0x103054=function(_0x12064b){while(--_0x12064b){_0x5685bb['push'](_0x5685bb['shift']());}};_0x103054(++_0x2315c5);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'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')},'remoteUri':{'type':Sequelize[_0x4d82('0x2')]},'password':{'type':Sequelize[_0x4d82('0x2')]},'clientId':{'type':Sequelize[_0x4d82('0x2')]},'clientSecret':{'type':Sequelize[_0x4d82('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d82('0x4')]('integrationTab','newTab'),'defaultValue':_0x4d82('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e4414af..3a4082b 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 _0x0e5b=['IsRecurrence','Subject','Description','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','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/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','fields','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','username','password','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','describe','OwnerId','ActivityDate','IsReminderSet'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x0e5b,0x18e));var _0xb0e5=function(_0x2fd88e,_0x46a4ee){_0x2fd88e=_0x2fd88e-0x0;var _0x26424d=_0x0e5b[_0x2fd88e];return _0x26424d;};'use strict';var emlformat=require(_0xb0e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0e5('0x1'));var rp=require('request-promise');var moment=require(_0xb0e5('0x2'));var BPromise=require(_0xb0e5('0x3'));var Mustache=require(_0xb0e5('0x4'));var util=require(_0xb0e5('0x5'));var path=require(_0xb0e5('0x6'));var sox=require(_0xb0e5('0x7'));var csv=require('to-csv');var ejs=require(_0xb0e5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb0e5('0x9'));var jsforce=require(_0xb0e5('0xa'));var deskjs=require(_0xb0e5('0xb'));var toCsv=require(_0xb0e5('0xc'));var querystring=require(_0xb0e5('0xd'));var Papa=require(_0xb0e5('0xe'));var Redis=require(_0xb0e5('0xf'));var authService=require(_0xb0e5('0x10'));var qs=require(_0xb0e5('0x11'));var as=require(_0xb0e5('0x12'));var hardwareService=require(_0xb0e5('0x13'));var logger=require('../../config/logger')(_0xb0e5('0x14'));var utils=require(_0xb0e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb0e5('0x16'));var db=require(_0xb0e5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x80466e,_0x21d622){_0x21d622=_0x21d622||0xcc;return function(_0x461e9d){if(_0x461e9d){return _0x80466e[_0xb0e5('0x18')](_0x21d622);}return _0x80466e[_0xb0e5('0x19')](_0x21d622)[_0xb0e5('0x1a')]();};}function respondWithResult(_0x26684e,_0x4afd92){_0x4afd92=_0x4afd92||0xc8;return function(_0x3a0fdc){if(_0x3a0fdc){return _0x26684e[_0xb0e5('0x19')](_0x4afd92)['json'](_0x3a0fdc);}};}function respondWithFilteredResult(_0x2b9fd7,_0xd21864){return function(_0x28e231){if(_0x28e231){var _0x51369c=typeof _0xd21864['offset']===_0xb0e5('0x1b')&&typeof _0xd21864['limit']===_0xb0e5('0x1b');var _0x367aa4=_0x28e231[_0xb0e5('0x1c')];var _0x13d8fc=_0x51369c?0x0:_0xd21864['offset'];var _0x4f25b1=_0x51369c?_0x28e231[_0xb0e5('0x1c')]:_0xd21864[_0xb0e5('0x1d')]+_0xd21864[_0xb0e5('0x1e')];var _0x5e35b7;if(_0x4f25b1>=_0x367aa4){_0x4f25b1=_0x367aa4;_0x5e35b7=0xc8;}else{_0x5e35b7=0xce;}_0x2b9fd7[_0xb0e5('0x19')](_0x5e35b7);return _0x2b9fd7[_0xb0e5('0x1f')]('Content-Range',_0x13d8fc+'-'+_0x4f25b1+'/'+_0x367aa4)[_0xb0e5('0x20')](_0x28e231);}return null;};}function patchUpdates(_0x551daa){return function(_0x2e7b60){try{jsonpatch['apply'](_0x2e7b60,_0x551daa,!![]);}catch(_0x653266){return BPromise[_0xb0e5('0x21')](_0x653266);}return _0x2e7b60[_0xb0e5('0x22')]();};}function saveUpdates(_0x452a7e,_0x24481f){return function(_0x45ab2a){if(_0x45ab2a){return _0x45ab2a[_0xb0e5('0x23')](_0x452a7e)[_0xb0e5('0x24')](function(_0x5f575b){return _0x5f575b;});}return null;};}function removeEntity(_0x202e87,_0x19546a){return function(_0x3aabcf){if(_0x3aabcf){return _0x3aabcf[_0xb0e5('0x25')]()[_0xb0e5('0x24')](function(){_0x202e87['status'](0xcc)[_0xb0e5('0x1a')]();});}};}function handleEntityNotFound(_0x5f1b64,_0x59e41f){return function(_0x2d1d3e){if(!_0x2d1d3e){_0x5f1b64[_0xb0e5('0x18')](0x194);}return _0x2d1d3e;};}function handleError(_0x29e346,_0x102349){_0x102349=_0x102349||0x1f4;return function(_0x5910e){logger['error'](_0x5910e[_0xb0e5('0x26')]);if(_0x5910e[_0xb0e5('0x27')]){delete _0x5910e['name'];}_0x29e346[_0xb0e5('0x19')](_0x102349)[_0xb0e5('0x28')](_0x5910e);};}exports[_0xb0e5('0x29')]=function(_0x20c5b5,_0xaf54e1){var _0x32a11b={},_0x518685={},_0x1e3369={'count':0x0,'rows':[]};var _0x2a0a50=_['map'](db[_0xb0e5('0x2a')][_0xb0e5('0x2b')],function(_0x348d45){return{'name':_0x348d45['fieldName'],'type':_0x348d45[_0xb0e5('0x2c')][_0xb0e5('0x2d')]};});_0x518685[_0xb0e5('0x2e')]=_[_0xb0e5('0x2f')](_0x2a0a50,'name');_0x518685[_0xb0e5('0x30')]=_[_0xb0e5('0x31')](_0x20c5b5[_0xb0e5('0x30')]);_0x518685['filters']=_[_0xb0e5('0x32')](_0x518685[_0xb0e5('0x2e')],_0x518685[_0xb0e5('0x30')]);_0x32a11b[_0xb0e5('0x33')]=_['intersection'](_0x518685[_0xb0e5('0x2e')],qs['fields'](_0x20c5b5[_0xb0e5('0x30')]['fields']));_0x32a11b[_0xb0e5('0x33')]=_0x32a11b[_0xb0e5('0x33')][_0xb0e5('0x34')]?_0x32a11b[_0xb0e5('0x33')]:_0x518685[_0xb0e5('0x2e')];if(!_0x20c5b5[_0xb0e5('0x30')][_0xb0e5('0x35')](_0xb0e5('0x36'))){_0x32a11b[_0xb0e5('0x1e')]=qs[_0xb0e5('0x1e')](_0x20c5b5[_0xb0e5('0x30')][_0xb0e5('0x1e')]);_0x32a11b['offset']=qs[_0xb0e5('0x1d')](_0x20c5b5['query'][_0xb0e5('0x1d')]);}_0x32a11b['order']=qs['sort'](_0x20c5b5[_0xb0e5('0x30')][_0xb0e5('0x37')]);_0x32a11b[_0xb0e5('0x38')]=qs[_0xb0e5('0x39')](_[_0xb0e5('0x3a')](_0x20c5b5['query'],_0x518685[_0xb0e5('0x39')]),_0x2a0a50);if(_0x20c5b5[_0xb0e5('0x30')][_0xb0e5('0x3b')]){_0x32a11b[_0xb0e5('0x38')]=_['merge'](_0x32a11b[_0xb0e5('0x38')],{'$or':_['map'](_0x2a0a50,function(_0xa09d49){if(_0xa09d49[_0xb0e5('0x2c')]!==_0xb0e5('0x3c')){var _0x5df021={};_0x5df021[_0xa09d49[_0xb0e5('0x27')]]={'$like':'%'+_0x20c5b5[_0xb0e5('0x30')]['filter']+'%'};return _0x5df021;}})});}_0x32a11b=_[_0xb0e5('0x3d')]({},_0x32a11b,_0x20c5b5[_0xb0e5('0x3e')]);var _0x3985fd={'where':_0x32a11b[_0xb0e5('0x38')]};return db[_0xb0e5('0x2a')]['count'](_0x3985fd)[_0xb0e5('0x24')](function(_0x1fc1fe){_0x1e3369[_0xb0e5('0x1c')]=_0x1fc1fe;if(_0x20c5b5[_0xb0e5('0x30')][_0xb0e5('0x3f')]){_0x32a11b[_0xb0e5('0x40')]=[{'all':!![]}];}return db[_0xb0e5('0x2a')][_0xb0e5('0x41')](_0x32a11b);})[_0xb0e5('0x24')](function(_0x5c7379){_0x1e3369[_0xb0e5('0x42')]=_0x5c7379;return _0x1e3369;})[_0xb0e5('0x24')](respondWithFilteredResult(_0xaf54e1,_0x32a11b))['catch'](handleError(_0xaf54e1,null));};exports[_0xb0e5('0x43')]=function(_0x234d11,_0x4704ac){var _0x1e72c1={'raw':![],'where':{'id':_0x234d11['params']['id']}},_0x31fc84={};_0x31fc84[_0xb0e5('0x2e')]=_[_0xb0e5('0x31')](db[_0xb0e5('0x2a')][_0xb0e5('0x2b')]);_0x31fc84[_0xb0e5('0x30')]=_[_0xb0e5('0x31')](_0x234d11['query']);_0x31fc84['filters']=_[_0xb0e5('0x32')](_0x31fc84[_0xb0e5('0x2e')],_0x31fc84[_0xb0e5('0x30')]);_0x1e72c1['attributes']=_[_0xb0e5('0x32')](_0x31fc84[_0xb0e5('0x2e')],qs[_0xb0e5('0x44')](_0x234d11[_0xb0e5('0x30')][_0xb0e5('0x44')]));_0x1e72c1[_0xb0e5('0x33')]=_0x1e72c1[_0xb0e5('0x33')][_0xb0e5('0x34')]?_0x1e72c1[_0xb0e5('0x33')]:_0x31fc84[_0xb0e5('0x2e')];if(_0x234d11[_0xb0e5('0x30')]['includeAll']){_0x1e72c1['include']=[{'all':!![]}];}_0x1e72c1=_['merge']({},_0x1e72c1,_0x234d11[_0xb0e5('0x3e')]);return db[_0xb0e5('0x2a')][_0xb0e5('0x45')](_0x1e72c1)[_0xb0e5('0x24')](handleEntityNotFound(_0x4704ac,null))[_0xb0e5('0x24')](respondWithResult(_0x4704ac,null))[_0xb0e5('0x46')](handleError(_0x4704ac,null));};exports['create']=function(_0x490b2b,_0x676015){return db[_0xb0e5('0x2a')][_0xb0e5('0x47')](_0x490b2b[_0xb0e5('0x48')],{})['then'](respondWithResult(_0x676015,0xc9))[_0xb0e5('0x46')](handleError(_0x676015,null));};exports[_0xb0e5('0x23')]=function(_0x18cde4,_0x1e2829){if(_0x18cde4[_0xb0e5('0x48')]['id']){delete _0x18cde4['body']['id'];}return db[_0xb0e5('0x2a')][_0xb0e5('0x45')]({'where':{'id':_0x18cde4[_0xb0e5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e2829,null))['then'](saveUpdates(_0x18cde4[_0xb0e5('0x48')],null))[_0xb0e5('0x24')](respondWithResult(_0x1e2829,null))[_0xb0e5('0x46')](handleError(_0x1e2829,null));};exports[_0xb0e5('0x25')]=function(_0x5d4b34,_0x8a080a){return db['SalesforceAccount'][_0xb0e5('0x45')]({'where':{'id':_0x5d4b34[_0xb0e5('0x49')]['id']}})[_0xb0e5('0x24')](handleEntityNotFound(_0x8a080a,null))[_0xb0e5('0x24')](removeEntity(_0x8a080a,null))[_0xb0e5('0x46')](handleError(_0x8a080a,null));};exports[_0xb0e5('0x4a')]=function(_0x58c9d0,_0x205af6,_0x116b70){var _0x3172ee={};var _0x10c171={};var _0x5911cb;var _0x2cce8b;return db[_0xb0e5('0x2a')][_0xb0e5('0x4b')]({'where':{'id':_0x58c9d0['params']['id']}})['then'](handleEntityNotFound(_0x205af6,null))[_0xb0e5('0x24')](function(_0x56e4e5){if(_0x56e4e5){_0x5911cb=_0x56e4e5;_0x10c171[_0xb0e5('0x2e')]=_[_0xb0e5('0x31')](db[_0xb0e5('0x4c')][_0xb0e5('0x2b')]);_0x10c171['query']=_[_0xb0e5('0x31')](_0x58c9d0[_0xb0e5('0x30')]);_0x10c171['filters']=_['intersection'](_0x10c171[_0xb0e5('0x2e')],_0x10c171['query']);_0x3172ee[_0xb0e5('0x33')]=_['intersection'](_0x10c171['model'],qs[_0xb0e5('0x44')](_0x58c9d0['query']['fields']));_0x3172ee[_0xb0e5('0x33')]=_0x3172ee[_0xb0e5('0x33')][_0xb0e5('0x34')]?_0x3172ee['attributes']:_0x10c171['model'];_0x3172ee[_0xb0e5('0x4d')]=qs[_0xb0e5('0x37')](_0x58c9d0[_0xb0e5('0x30')][_0xb0e5('0x37')]);_0x3172ee[_0xb0e5('0x38')]=qs[_0xb0e5('0x39')](_[_0xb0e5('0x3a')](_0x58c9d0[_0xb0e5('0x30')],_0x10c171['filters']));if(_0x58c9d0['query'][_0xb0e5('0x3b')]){_0x3172ee[_0xb0e5('0x38')]=_['merge'](_0x3172ee[_0xb0e5('0x38')],{'$or':_[_0xb0e5('0x2f')](_0x3172ee[_0xb0e5('0x33')],function(_0x12bc3c){var _0x121554={};_0x121554[_0x12bc3c]={'$like':'%'+_0x58c9d0['query'][_0xb0e5('0x3b')]+'%'};return _0x121554;})});}_0x3172ee=_[_0xb0e5('0x3d')]({},_0x3172ee,_0x58c9d0[_0xb0e5('0x3e')]);return _0x5911cb['getConfigurations'](_0x3172ee);}})[_0xb0e5('0x24')](function(_0x36aa65){if(_0x36aa65){_0x2cce8b=_0x36aa65['length'];if(!_0x58c9d0[_0xb0e5('0x30')]['hasOwnProperty'](_0xb0e5('0x36'))){_0x3172ee[_0xb0e5('0x1e')]=qs['limit'](_0x58c9d0['query'][_0xb0e5('0x1e')]);_0x3172ee[_0xb0e5('0x1d')]=qs[_0xb0e5('0x1d')](_0x58c9d0['query'][_0xb0e5('0x1d')]);}return _0x5911cb[_0xb0e5('0x4a')](_0x3172ee);}})[_0xb0e5('0x24')](function(_0x5537df){if(_0x5537df){return _0x5537df?{'count':_0x2cce8b,'rows':_0x5537df}:null;}})[_0xb0e5('0x24')](respondWithResult(_0x205af6,null))[_0xb0e5('0x46')](handleError(_0x205af6,null));};exports[_0xb0e5('0x4e')]=function(_0x4797ee,_0x3e80e6,_0x50c82b){if(_0x4797ee[_0xb0e5('0x48')]['id']){delete _0x4797ee[_0xb0e5('0x48')]['id'];}return db['SalesforceAccount'][_0xb0e5('0x4b')]({'where':{'id':_0x4797ee[_0xb0e5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e80e6,null))[_0xb0e5('0x24')](function(_0x338271){if(_0x338271){_0x4797ee[_0xb0e5('0x48')][_0xb0e5('0x4f')]=_0x338271['id'];_0x4797ee[_0xb0e5('0x48')][_0xb0e5('0x50')]=integrations[_0xb0e5('0x51')](_0x4797ee[_0xb0e5('0x48')][_0xb0e5('0x52')],_0x4797ee[_0xb0e5('0x48')][_0xb0e5('0x2c')]);_0x4797ee[_0xb0e5('0x48')][_0xb0e5('0x53')]=integrations[_0xb0e5('0x54')](_0x4797ee[_0xb0e5('0x48')]['channel'],_0x4797ee['body']['type']);return db[_0xb0e5('0x4c')][_0xb0e5('0x47')](_0x4797ee[_0xb0e5('0x48')],{'include':[{'model':db[_0xb0e5('0x55')],'as':_0xb0e5('0x50')},{'model':db[_0xb0e5('0x55')],'as':_0xb0e5('0x53')}]});}return null;})[_0xb0e5('0x24')](respondWithResult(_0x3e80e6,null))[_0xb0e5('0x46')](handleError(_0x3e80e6,null));};exports['getFields']=function(_0xa51a01,_0x23bb6c,_0x36b140){var _0x39f0ce;var _0x13f1d9='';var _0x1bacbb=_0xb0e5('0x56');return db[_0xb0e5('0x2a')][_0xb0e5('0x4b')]({'where':{'id':_0xa51a01[_0xb0e5('0x49')]['id']},'attributes':['id',_0xb0e5('0x57'),_0xb0e5('0x58'),'clientSecret',_0xb0e5('0x59'),_0xb0e5('0x5a'),'securityToken']})['then'](handleEntityNotFound(_0x23bb6c,null))[_0xb0e5('0x24')](function(_0x54e647){if(_0x54e647){_0x13f1d9=_0x54e647[_0xb0e5('0x57')];var _0x2d9e34=_0x13f1d9['slice'](-0x1);if(_0x2d9e34==='/'){_0x13f1d9=_0x13f1d9[_0xb0e5('0x5b')](0x0,_0x13f1d9[_0xb0e5('0x5c')](_0x2d9e34));}_0x39f0ce=new jsforce[(_0xb0e5('0x5d'))]({'oauth2':{'loginUrl':_0x13f1d9,'clientId':_0x54e647['clientId'],'clientSecret':_0x54e647['clientSecret']}});return _0x39f0ce[_0xb0e5('0x5e')](_0x54e647['username'],_0x54e647[_0xb0e5('0x5a')][_0xb0e5('0x5f')](_0x54e647[_0xb0e5('0x60')]));}})[_0xb0e5('0x24')](function(_0x34adec){if(_0x34adec){if(!_['isNil'](_0xa51a01[_0xb0e5('0x30')][_0xb0e5('0x61')])){_0x1bacbb=_0xa51a01[_0xb0e5('0x30')]['ticketType'];}return _0x39f0ce['sobject'](_0x1bacbb)[_0xb0e5('0x62')]();}})['then'](function(_0x41d868){var _0x68a564=[_0xb0e5('0x63'),_0xb0e5('0x64'),_0xb0e5('0x65'),_0xb0e5('0x66'),_0xb0e5('0x67'),_0xb0e5('0x68')];var _0x5c48f6=['string','int','picklist',_0xb0e5('0x69'),_0xb0e5('0x6a'),_0xb0e5('0x6b'),_0xb0e5('0x6c')];if(_0x41d868){_[_0xb0e5('0x6d')](_0x41d868[_0xb0e5('0x44')],function(_0xad5727){return _0x68a564['includes'](_0xad5727[_0xb0e5('0x27')])||!_0x5c48f6[_0xb0e5('0x6e')](_0xad5727[_0xb0e5('0x2c')]);});return{'count':_0x41d868[_0xb0e5('0x44')][_0xb0e5('0x34')],'rows':_[_0xb0e5('0x2f')](_0x41d868[_0xb0e5('0x44')],function(_0x486e89){return{'id':_0x486e89[_0xb0e5('0x27')],'name':_0x486e89[_0xb0e5('0x6f')],'custom':_0x486e89[_0xb0e5('0x70')],'options':_0x486e89['picklistValues'][_0xb0e5('0x34')]>0x0?_[_0xb0e5('0x2f')](_0x486e89[_0xb0e5('0x71')],function(_0x30725e){return{'name':_0x30725e[_0xb0e5('0x6f')],'value':_0x30725e[_0xb0e5('0x72')]};}):_0x486e89[_0xb0e5('0x2c')]==_0xb0e5('0x69')?[{'name':_0xb0e5('0x73'),'value':_0xb0e5('0x74')},{'name':_0xb0e5('0x75'),'value':_0xb0e5('0x76')}]:[]};})};}})[_0xb0e5('0x24')](respondWithResult(_0x23bb6c,null))[_0xb0e5('0x46')](function(_0x2f3969){var _0xeb486=_0xa51a01['query']['test']?0x1f4:_0x2f3969['statusCode']||0x1f4;logger[_0xb0e5('0x77')](_0xb0e5('0x78'),_0xb0e5('0x79'),_0xeb486,JSON[_0xb0e5('0x7a')](_0x2f3969));delete _0x2f3969[_0xb0e5('0x27')];if(_0xeb486===0x191){_0xeb486=0x190;}_0x23bb6c[_0xb0e5('0x19')](_0xeb486)['send'](_0xa51a01['query']['test']?{'message':_0xb0e5('0x7b'),'statusCode':_0x2f3969[_0xb0e5('0x7c')]}:_0x2f3969);});}; \ No newline at end of file +var _0x57dc=['send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','SalesforceAccount','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57dc,0x140));var _0xc57d=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x57dc[_0x142ec2];return _0x45ef4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc57d('0x0'));var zipdir=require(_0xc57d('0x1'));var jsonpatch=require(_0xc57d('0x2'));var rp=require(_0xc57d('0x3'));var moment=require(_0xc57d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc57d('0x5'));var util=require(_0xc57d('0x6'));var path=require('path');var sox=require(_0xc57d('0x7'));var csv=require('to-csv');var ejs=require(_0xc57d('0x8'));var fs=require('fs');var fs_extra=require(_0xc57d('0x9'));var _=require(_0xc57d('0xa'));var squel=require('squel');var crypto=require(_0xc57d('0xb'));var jsforce=require(_0xc57d('0xc'));var deskjs=require(_0xc57d('0xd'));var toCsv=require(_0xc57d('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc57d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc57d('0x10'));var as=require(_0xc57d('0x11'));var hardwareService=require(_0xc57d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc57d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc57d('0x14'))['db'];var integrations=require(_0xc57d('0x15'));function respondWithStatusCode(_0x2229db,_0x98bab1){_0x98bab1=_0x98bab1||0xcc;return function(_0x464926){if(_0x464926){return _0x2229db['sendStatus'](_0x98bab1);}return _0x2229db[_0xc57d('0x16')](_0x98bab1)[_0xc57d('0x17')]();};}function respondWithResult(_0x5161aa,_0x28ae2d){_0x28ae2d=_0x28ae2d||0xc8;return function(_0x2aa7cc){if(_0x2aa7cc){return _0x5161aa[_0xc57d('0x16')](_0x28ae2d)[_0xc57d('0x18')](_0x2aa7cc);}};}function respondWithFilteredResult(_0x3deb4f,_0x43a4cc){return function(_0x49b4a4){if(_0x49b4a4){var _0x39e1dc=typeof _0x43a4cc['offset']===_0xc57d('0x19')&&typeof _0x43a4cc[_0xc57d('0x1a')]===_0xc57d('0x19');var _0x5f08e0=_0x49b4a4[_0xc57d('0x1b')];var _0x9b3e84=_0x39e1dc?0x0:_0x43a4cc['offset'];var _0x1c0f76=_0x39e1dc?_0x49b4a4[_0xc57d('0x1b')]:_0x43a4cc[_0xc57d('0x1c')]+_0x43a4cc[_0xc57d('0x1a')];var _0x29b725;if(_0x1c0f76>=_0x5f08e0){_0x1c0f76=_0x5f08e0;_0x29b725=0xc8;}else{_0x29b725=0xce;}_0x3deb4f['status'](_0x29b725);return _0x3deb4f['set'](_0xc57d('0x1d'),_0x9b3e84+'-'+_0x1c0f76+'/'+_0x5f08e0)['json'](_0x49b4a4);}return null;};}function patchUpdates(_0x4909c9){return function(_0x418e7c){try{jsonpatch['apply'](_0x418e7c,_0x4909c9,!![]);}catch(_0x21eae9){return BPromise[_0xc57d('0x1e')](_0x21eae9);}return _0x418e7c[_0xc57d('0x1f')]();};}function saveUpdates(_0x2c3555,_0xb79e34){return function(_0x3fb3fd){if(_0x3fb3fd){return _0x3fb3fd[_0xc57d('0x20')](_0x2c3555)[_0xc57d('0x21')](function(_0x3798c5){return _0x3798c5;});}return null;};}function removeEntity(_0x16cc57,_0x1e417f){return function(_0xa04c3e){if(_0xa04c3e){return _0xa04c3e[_0xc57d('0x22')]()[_0xc57d('0x21')](function(){_0x16cc57['status'](0xcc)[_0xc57d('0x17')]();});}};}function handleEntityNotFound(_0xc7918c,_0x48b0bc){return function(_0x37e65c){if(!_0x37e65c){_0xc7918c[_0xc57d('0x23')](0x194);}return _0x37e65c;};}function handleError(_0x28a66e,_0x5608d8){_0x5608d8=_0x5608d8||0x1f4;return function(_0x1bf383){logger['error'](_0x1bf383['stack']);if(_0x1bf383[_0xc57d('0x24')]){delete _0x1bf383[_0xc57d('0x24')];}_0x28a66e[_0xc57d('0x16')](_0x5608d8)[_0xc57d('0x25')](_0x1bf383);};}exports[_0xc57d('0x26')]=function(_0x3a6376,_0x44d75a){var _0x4e8209={},_0x541977={},_0x4f346e={'count':0x0,'rows':[]};var _0x2dcef2=_[_0xc57d('0x27')](db['SalesforceAccount'][_0xc57d('0x28')],function(_0xa6ac76){return{'name':_0xa6ac76[_0xc57d('0x29')],'type':_0xa6ac76[_0xc57d('0x2a')][_0xc57d('0x2b')]};});_0x541977[_0xc57d('0x2c')]=_[_0xc57d('0x27')](_0x2dcef2,_0xc57d('0x24'));_0x541977[_0xc57d('0x2d')]=_[_0xc57d('0x2e')](_0x3a6376['query']);_0x541977['filters']=_[_0xc57d('0x2f')](_0x541977[_0xc57d('0x2c')],_0x541977[_0xc57d('0x2d')]);_0x4e8209[_0xc57d('0x30')]=_[_0xc57d('0x2f')](_0x541977[_0xc57d('0x2c')],qs[_0xc57d('0x31')](_0x3a6376['query'][_0xc57d('0x31')]));_0x4e8209[_0xc57d('0x30')]=_0x4e8209['attributes']['length']?_0x4e8209[_0xc57d('0x30')]:_0x541977['model'];if(!_0x3a6376['query'][_0xc57d('0x32')](_0xc57d('0x33'))){_0x4e8209[_0xc57d('0x1a')]=qs[_0xc57d('0x1a')](_0x3a6376[_0xc57d('0x2d')]['limit']);_0x4e8209['offset']=qs['offset'](_0x3a6376[_0xc57d('0x2d')][_0xc57d('0x1c')]);}_0x4e8209[_0xc57d('0x34')]=qs[_0xc57d('0x35')](_0x3a6376[_0xc57d('0x2d')][_0xc57d('0x35')]);_0x4e8209[_0xc57d('0x36')]=qs[_0xc57d('0x37')](_['pick'](_0x3a6376['query'],_0x541977[_0xc57d('0x37')]),_0x2dcef2);if(_0x3a6376['query']['filter']){_0x4e8209[_0xc57d('0x36')]=_[_0xc57d('0x38')](_0x4e8209[_0xc57d('0x36')],{'$or':_[_0xc57d('0x27')](_0x2dcef2,function(_0x3e6b67){if(_0x3e6b67[_0xc57d('0x2a')]!=='VIRTUAL'){var _0x517e2c={};_0x517e2c[_0x3e6b67[_0xc57d('0x24')]]={'$like':'%'+_0x3a6376['query'][_0xc57d('0x39')]+'%'};return _0x517e2c;}})});}_0x4e8209=_[_0xc57d('0x38')]({},_0x4e8209,_0x3a6376[_0xc57d('0x3a')]);var _0x5c6c44={'where':_0x4e8209['where']};return db['SalesforceAccount'][_0xc57d('0x1b')](_0x5c6c44)[_0xc57d('0x21')](function(_0x491a6a){_0x4f346e[_0xc57d('0x1b')]=_0x491a6a;if(_0x3a6376[_0xc57d('0x2d')][_0xc57d('0x3b')]){_0x4e8209[_0xc57d('0x3c')]=[{'all':!![]}];}return db[_0xc57d('0x3d')][_0xc57d('0x3e')](_0x4e8209);})['then'](function(_0x57211a){_0x4f346e[_0xc57d('0x3f')]=_0x57211a;return _0x4f346e;})[_0xc57d('0x21')](respondWithFilteredResult(_0x44d75a,_0x4e8209))[_0xc57d('0x40')](handleError(_0x44d75a,null));};exports[_0xc57d('0x41')]=function(_0x3073b6,_0x11eb24){var _0x178370={'raw':![],'where':{'id':_0x3073b6[_0xc57d('0x42')]['id']}},_0xbe2904={};_0xbe2904[_0xc57d('0x2c')]=_[_0xc57d('0x2e')](db[_0xc57d('0x3d')][_0xc57d('0x28')]);_0xbe2904[_0xc57d('0x2d')]=_['keys'](_0x3073b6[_0xc57d('0x2d')]);_0xbe2904[_0xc57d('0x37')]=_[_0xc57d('0x2f')](_0xbe2904[_0xc57d('0x2c')],_0xbe2904[_0xc57d('0x2d')]);_0x178370[_0xc57d('0x30')]=_[_0xc57d('0x2f')](_0xbe2904[_0xc57d('0x2c')],qs[_0xc57d('0x31')](_0x3073b6['query'][_0xc57d('0x31')]));_0x178370[_0xc57d('0x30')]=_0x178370[_0xc57d('0x30')][_0xc57d('0x43')]?_0x178370['attributes']:_0xbe2904[_0xc57d('0x2c')];if(_0x3073b6[_0xc57d('0x2d')][_0xc57d('0x3b')]){_0x178370[_0xc57d('0x3c')]=[{'all':!![]}];}_0x178370=_[_0xc57d('0x38')]({},_0x178370,_0x3073b6[_0xc57d('0x3a')]);return db[_0xc57d('0x3d')][_0xc57d('0x44')](_0x178370)['then'](handleEntityNotFound(_0x11eb24,null))['then'](respondWithResult(_0x11eb24,null))[_0xc57d('0x40')](handleError(_0x11eb24,null));};exports[_0xc57d('0x45')]=function(_0x2b50a,_0x4401a9){return db['SalesforceAccount'][_0xc57d('0x45')](_0x2b50a[_0xc57d('0x46')],{})[_0xc57d('0x21')](respondWithResult(_0x4401a9,0xc9))[_0xc57d('0x40')](handleError(_0x4401a9,null));};exports[_0xc57d('0x20')]=function(_0x59d86c,_0x299c7d){if(_0x59d86c[_0xc57d('0x46')]['id']){delete _0x59d86c[_0xc57d('0x46')]['id'];}return db[_0xc57d('0x3d')]['find']({'where':{'id':_0x59d86c[_0xc57d('0x42')]['id']}})[_0xc57d('0x21')](handleEntityNotFound(_0x299c7d,null))[_0xc57d('0x21')](saveUpdates(_0x59d86c['body'],null))[_0xc57d('0x21')](respondWithResult(_0x299c7d,null))[_0xc57d('0x40')](handleError(_0x299c7d,null));};exports[_0xc57d('0x22')]=function(_0x2dd535,_0x42dcdd){return db[_0xc57d('0x3d')][_0xc57d('0x44')]({'where':{'id':_0x2dd535[_0xc57d('0x42')]['id']}})[_0xc57d('0x21')](handleEntityNotFound(_0x42dcdd,null))['then'](removeEntity(_0x42dcdd,null))[_0xc57d('0x40')](handleError(_0x42dcdd,null));};exports[_0xc57d('0x47')]=function(_0x1f8264,_0x3f0a81,_0x12ec90){var _0x28da37={};var _0x4a15ce={};var _0x144623;var _0x55ff01;return db['SalesforceAccount'][_0xc57d('0x48')]({'where':{'id':_0x1f8264[_0xc57d('0x42')]['id']}})[_0xc57d('0x21')](handleEntityNotFound(_0x3f0a81,null))[_0xc57d('0x21')](function(_0x54dbef){if(_0x54dbef){_0x144623=_0x54dbef;_0x4a15ce[_0xc57d('0x2c')]=_[_0xc57d('0x2e')](db[_0xc57d('0x49')]['rawAttributes']);_0x4a15ce[_0xc57d('0x2d')]=_[_0xc57d('0x2e')](_0x1f8264[_0xc57d('0x2d')]);_0x4a15ce[_0xc57d('0x37')]=_['intersection'](_0x4a15ce[_0xc57d('0x2c')],_0x4a15ce[_0xc57d('0x2d')]);_0x28da37[_0xc57d('0x30')]=_[_0xc57d('0x2f')](_0x4a15ce[_0xc57d('0x2c')],qs[_0xc57d('0x31')](_0x1f8264[_0xc57d('0x2d')]['fields']));_0x28da37[_0xc57d('0x30')]=_0x28da37[_0xc57d('0x30')][_0xc57d('0x43')]?_0x28da37[_0xc57d('0x30')]:_0x4a15ce[_0xc57d('0x2c')];_0x28da37['order']=qs[_0xc57d('0x35')](_0x1f8264[_0xc57d('0x2d')]['sort']);_0x28da37[_0xc57d('0x36')]=qs[_0xc57d('0x37')](_[_0xc57d('0x4a')](_0x1f8264[_0xc57d('0x2d')],_0x4a15ce[_0xc57d('0x37')]));if(_0x1f8264[_0xc57d('0x2d')]['filter']){_0x28da37['where']=_[_0xc57d('0x38')](_0x28da37[_0xc57d('0x36')],{'$or':_[_0xc57d('0x27')](_0x28da37[_0xc57d('0x30')],function(_0xa4a557){var _0x142ece={};_0x142ece[_0xa4a557]={'$like':'%'+_0x1f8264[_0xc57d('0x2d')][_0xc57d('0x39')]+'%'};return _0x142ece;})});}_0x28da37=_[_0xc57d('0x38')]({},_0x28da37,_0x1f8264[_0xc57d('0x3a')]);return _0x144623['getConfigurations'](_0x28da37);}})['then'](function(_0x3471d4){if(_0x3471d4){_0x55ff01=_0x3471d4[_0xc57d('0x43')];if(!_0x1f8264['query']['hasOwnProperty'](_0xc57d('0x33'))){_0x28da37[_0xc57d('0x1a')]=qs[_0xc57d('0x1a')](_0x1f8264[_0xc57d('0x2d')][_0xc57d('0x1a')]);_0x28da37[_0xc57d('0x1c')]=qs[_0xc57d('0x1c')](_0x1f8264['query']['offset']);}return _0x144623['getConfigurations'](_0x28da37);}})[_0xc57d('0x21')](function(_0x14fccd){if(_0x14fccd){return _0x14fccd?{'count':_0x55ff01,'rows':_0x14fccd}:null;}})[_0xc57d('0x21')](respondWithResult(_0x3f0a81,null))[_0xc57d('0x40')](handleError(_0x3f0a81,null));};exports[_0xc57d('0x4b')]=function(_0x19b48a,_0x22aef6,_0x52142d){if(_0x19b48a['body']['id']){delete _0x19b48a['body']['id'];}return db[_0xc57d('0x3d')][_0xc57d('0x48')]({'where':{'id':_0x19b48a['params']['id']}})[_0xc57d('0x21')](handleEntityNotFound(_0x22aef6,null))[_0xc57d('0x21')](function(_0x40c2a8){if(_0x40c2a8){_0x19b48a['body'][_0xc57d('0x4c')]=_0x40c2a8['id'];_0x19b48a[_0xc57d('0x46')][_0xc57d('0x4d')]=integrations[_0xc57d('0x4e')](_0x19b48a[_0xc57d('0x46')][_0xc57d('0x4f')],_0x19b48a[_0xc57d('0x46')][_0xc57d('0x2a')]);_0x19b48a['body'][_0xc57d('0x50')]=integrations[_0xc57d('0x51')](_0x19b48a[_0xc57d('0x46')]['channel'],_0x19b48a[_0xc57d('0x46')][_0xc57d('0x2a')]);return db[_0xc57d('0x49')][_0xc57d('0x45')](_0x19b48a['body'],{'include':[{'model':db[_0xc57d('0x52')],'as':'Subjects'},{'model':db[_0xc57d('0x52')],'as':_0xc57d('0x50')}]});}return null;})['then'](respondWithResult(_0x22aef6,null))[_0xc57d('0x40')](handleError(_0x22aef6,null));};exports[_0xc57d('0x53')]=function(_0x56d706,_0x262f89,_0x265534){var _0x57a82a;var _0x5f51f3='';var _0x92ceae='Task';return db[_0xc57d('0x3d')][_0xc57d('0x48')]({'where':{'id':_0x56d706[_0xc57d('0x42')]['id']},'attributes':['id',_0xc57d('0x54'),_0xc57d('0x55'),_0xc57d('0x56'),_0xc57d('0x57'),_0xc57d('0x58'),_0xc57d('0x59')]})[_0xc57d('0x21')](handleEntityNotFound(_0x262f89,null))['then'](function(_0x14baac){if(_0x14baac){_0x5f51f3=_0x14baac['remoteUri'];var _0x4c865d=_0x5f51f3[_0xc57d('0x5a')](-0x1);if(_0x4c865d==='/'){_0x5f51f3=_0x5f51f3[_0xc57d('0x5b')](0x0,_0x5f51f3[_0xc57d('0x5c')](_0x4c865d));}_0x57a82a=new jsforce[(_0xc57d('0x5d'))]({'oauth2':{'loginUrl':_0x5f51f3,'clientId':_0x14baac['clientId'],'clientSecret':_0x14baac[_0xc57d('0x56')]}});return _0x57a82a[_0xc57d('0x5e')](_0x14baac[_0xc57d('0x57')],_0x14baac[_0xc57d('0x58')][_0xc57d('0x5f')](_0x14baac['securityToken']));}})['then'](function(_0x2c400f){if(_0x2c400f){if(!_[_0xc57d('0x60')](_0x56d706['query'][_0xc57d('0x61')])){_0x92ceae=_0x56d706[_0xc57d('0x2d')][_0xc57d('0x61')];}return _0x57a82a[_0xc57d('0x62')](_0x92ceae)['describe']();}})[_0xc57d('0x21')](function(_0x12ce6c){var _0x1e7716=[_0xc57d('0x63'),_0xc57d('0x64'),_0xc57d('0x65'),_0xc57d('0x66'),'Subject','Description'];var _0x2438f5=['string','int',_0xc57d('0x67'),_0xc57d('0x68'),_0xc57d('0x69'),_0xc57d('0x6a'),_0xc57d('0x6b')];if(_0x12ce6c){_[_0xc57d('0x6c')](_0x12ce6c['fields'],function(_0x4102a8){return _0x1e7716[_0xc57d('0x6d')](_0x4102a8[_0xc57d('0x24')])||!_0x2438f5['includes'](_0x4102a8[_0xc57d('0x2a')]);});return{'count':_0x12ce6c[_0xc57d('0x31')][_0xc57d('0x43')],'rows':_[_0xc57d('0x27')](_0x12ce6c[_0xc57d('0x31')],function(_0x42ef76){return{'id':_0x42ef76[_0xc57d('0x24')],'name':_0x42ef76[_0xc57d('0x6e')],'custom':_0x42ef76['custom'],'options':_0x42ef76[_0xc57d('0x6f')]['length']>0x0?_[_0xc57d('0x27')](_0x42ef76['picklistValues'],function(_0x3d6074){return{'name':_0x3d6074[_0xc57d('0x6e')],'value':_0x3d6074[_0xc57d('0x70')]};}):_0x42ef76[_0xc57d('0x2a')]=='boolean'?[{'name':_0xc57d('0x71'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})[_0xc57d('0x21')](respondWithResult(_0x262f89,null))[_0xc57d('0x40')](function(_0x97dfcd){var _0x240046=_0x56d706[_0xc57d('0x2d')][_0xc57d('0x72')]?0x1f4:_0x97dfcd[_0xc57d('0x73')]||0x1f4;logger[_0xc57d('0x74')](_0xc57d('0x75'),_0xc57d('0x53'),_0x240046,JSON[_0xc57d('0x76')](_0x97dfcd));delete _0x97dfcd[_0xc57d('0x24')];if(_0x240046===0x191){_0x240046=0x190;}_0x262f89[_0xc57d('0x16')](_0x240046)[_0xc57d('0x25')](_0x56d706[_0xc57d('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x97dfcd['statusCode']}:_0x97dfcd);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 239e5d9..cb5e55b 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 _0x1a39=['SalesforceAccount','int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a39,0x106));var _0x91a3=function(_0x260c9e,_0x44fd29){_0x260c9e=_0x260c9e-0x0;var _0x5d49f4=_0x1a39[_0x260c9e];return _0x5d49f4;};'use strict';var _=require(_0x91a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x91a3('0x1'));var moment=require(_0x91a3('0x2'));var BPromise=require(_0x91a3('0x3'));var rp=require(_0x91a3('0x4'));var fs=require('fs');var path=require(_0x91a3('0x5'));var rimraf=require(_0x91a3('0x6'));var config=require(_0x91a3('0x7'));var attributes=require(_0x91a3('0x8'));var integrations=require(_0x91a3('0x9'));module['exports']=function(_0x18055e,_0x26c50d){return _0x18055e[_0x91a3('0xa')](_0x91a3('0xb'),attributes,{'tableName':_0x91a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62ec=['../../config/environment','../../components/integrations/configuration','exports','int_salesforce_accounts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1c8e04,_0x6fb850){var _0x474bd5=function(_0x5d8db8){while(--_0x5d8db8){_0x1c8e04['push'](_0x1c8e04['shift']());}};_0x474bd5(++_0x6fb850);}(_0x62ec,0xca));var _0xc62e=function(_0x3e50e2,_0x56adfe){_0x3e50e2=_0x3e50e2-0x0;var _0x21dd7d=_0x62ec[_0x3e50e2];return _0x21dd7d;};'use strict';var _=require('lodash');var util=require(_0xc62e('0x0'));var logger=require('../../config/logger')(_0xc62e('0x1'));var moment=require(_0xc62e('0x2'));var BPromise=require(_0xc62e('0x3'));var rp=require(_0xc62e('0x4'));var fs=require('fs');var path=require(_0xc62e('0x5'));var rimraf=require(_0xc62e('0x6'));var config=require(_0xc62e('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xc62e('0x8'));module[_0xc62e('0x9')]=function(_0xd328df,_0x532369){return _0xd328df['define']('SalesforceAccount',attributes,{'tableName':_0xc62e('0xa'),'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 d10396d..6b7e8c5 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 _0xee78=['debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSalesforceAccount'];(function(_0x103791,_0x4eb72b){var _0x4aaa96=function(_0x386fe1){while(--_0x386fe1){_0x103791['push'](_0x103791['shift']());}};_0x4aaa96(++_0x4eb72b);}(_0xee78,0xce));var _0x8ee7=function(_0x4952da,_0x5f5194){_0x4952da=_0x4952da-0x0;var _0x5cbf48=_0xee78[_0x4952da];return _0x5cbf48;};'use strict';var _=require(_0x8ee7('0x0'));var util=require(_0x8ee7('0x1'));var moment=require(_0x8ee7('0x2'));var BPromise=require(_0x8ee7('0x3'));var rs=require(_0x8ee7('0x4'));var fs=require('fs');var Redis=require(_0x8ee7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ee7('0x6'));var logger=require('../../config/logger')(_0x8ee7('0x7'));var config=require(_0x8ee7('0x8'));var jayson=require(_0x8ee7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b19ea,_0x41c80d,_0x2711e6){return new BPromise(function(_0x293636,_0x1ed4da){return client[_0x8ee7('0xa')](_0x4b19ea,_0x2711e6)[_0x8ee7('0xb')](function(_0x4d10aa){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x41c80d,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x41c80d,_0x8ee7('0xc'),JSON[_0x8ee7('0xd')](_0x4d10aa));if(_0x4d10aa[_0x8ee7('0xe')]){if(_0x4d10aa['error'][_0x8ee7('0xf')]===0x1f4){logger['error'](_0x8ee7('0x10'),_0x41c80d,_0x4d10aa[_0x8ee7('0xe')][_0x8ee7('0x11')]);return _0x1ed4da(_0x4d10aa[_0x8ee7('0xe')][_0x8ee7('0x11')]);}logger[_0x8ee7('0xe')](_0x8ee7('0x10'),_0x41c80d,_0x4d10aa['error'][_0x8ee7('0x11')]);return _0x293636(_0x4d10aa['error'][_0x8ee7('0x11')]);}else{logger[_0x8ee7('0x12')](_0x8ee7('0x10'),_0x41c80d,_0x8ee7('0xc'));_0x293636(_0x4d10aa[_0x8ee7('0x13')][_0x8ee7('0x11')]);}})['catch'](function(_0x37ffe1){logger[_0x8ee7('0xe')](_0x8ee7('0x10'),_0x41c80d,_0x37ffe1);_0x1ed4da(_0x37ffe1);});});}exports[_0x8ee7('0x14')]=function(_0x1ae36a){var _0x295955=this;return new Promise(function(_0x3ffa1b,_0x48b93e){return db[_0x8ee7('0x15')][_0x8ee7('0x16')]({'raw':_0x1ae36a[_0x8ee7('0x17')]?_0x1ae36a[_0x8ee7('0x17')][_0x8ee7('0x18')]===undefined?!![]:![]:!![],'where':_0x1ae36a[_0x8ee7('0x17')]?_0x1ae36a['options'][_0x8ee7('0x19')]||null:null,'attributes':_0x1ae36a[_0x8ee7('0x17')]?_0x1ae36a[_0x8ee7('0x17')][_0x8ee7('0x1a')]||null:null,'limit':_0x1ae36a[_0x8ee7('0x17')]?_0x1ae36a[_0x8ee7('0x17')][_0x8ee7('0x1b')]||null:null,'include':_0x1ae36a[_0x8ee7('0x17')]?_0x1ae36a['options'][_0x8ee7('0x1c')]?_['map'](_0x1ae36a[_0x8ee7('0x17')][_0x8ee7('0x1c')],function(_0x5b843d){return{'model':db[_0x5b843d[_0x8ee7('0x1d')]],'as':_0x5b843d['as'],'attributes':_0x5b843d[_0x8ee7('0x1a')],'include':_0x5b843d[_0x8ee7('0x1c')]?_[_0x8ee7('0x1e')](_0x5b843d[_0x8ee7('0x1c')],function(_0x1c8b72){return{'model':db[_0x1c8b72['model']],'as':_0x1c8b72['as'],'attributes':_0x1c8b72[_0x8ee7('0x1a')],'include':_0x1c8b72[_0x8ee7('0x1c')]?_[_0x8ee7('0x1e')](_0x1c8b72[_0x8ee7('0x1c')],function(_0x532cc4){return{'model':db[_0x532cc4[_0x8ee7('0x1d')]],'as':_0x532cc4['as'],'attributes':_0x532cc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ee7('0xb')](function(_0x11bd31){logger['info'](_0x8ee7('0x14'),_0x1ae36a);logger['debug'](_0x8ee7('0x14'),_0x1ae36a,JSON[_0x8ee7('0xd')](_0x11bd31));_0x3ffa1b(_0x11bd31);})['catch'](function(_0x574886){logger['error'](_0x8ee7('0x14'),_0x574886[_0x8ee7('0x11')],_0x1ae36a);_0x48b93e(_0x295955[_0x8ee7('0xe')](0x1f4,_0x574886[_0x8ee7('0x11')]));});});};exports[_0x8ee7('0x1f')]=function(_0x35bb18){var _0x45c3ec=this;return new Promise(function(_0x1df59b,_0x25a285){return db[_0x8ee7('0x15')]['find']({'raw':_0x35bb18[_0x8ee7('0x17')]?_0x35bb18[_0x8ee7('0x17')][_0x8ee7('0x18')]===undefined?!![]:![]:!![],'where':_0x35bb18[_0x8ee7('0x17')]?_0x35bb18[_0x8ee7('0x17')][_0x8ee7('0x19')]||null:null,'attributes':_0x35bb18[_0x8ee7('0x17')]?_0x35bb18[_0x8ee7('0x17')][_0x8ee7('0x1a')]||null:null,'include':_0x35bb18[_0x8ee7('0x17')]?_0x35bb18[_0x8ee7('0x17')][_0x8ee7('0x1c')]?_[_0x8ee7('0x1e')](_0x35bb18[_0x8ee7('0x17')][_0x8ee7('0x1c')],function(_0x5ed6e9){return{'model':db[_0x5ed6e9[_0x8ee7('0x1d')]],'as':_0x5ed6e9['as'],'attributes':_0x5ed6e9[_0x8ee7('0x1a')],'include':_0x5ed6e9[_0x8ee7('0x1c')]?_[_0x8ee7('0x1e')](_0x5ed6e9[_0x8ee7('0x1c')],function(_0x331b73){return{'model':db[_0x331b73[_0x8ee7('0x1d')]],'as':_0x331b73['as'],'attributes':_0x331b73['attributes'],'include':_0x331b73['include']?_[_0x8ee7('0x1e')](_0x331b73[_0x8ee7('0x1c')],function(_0x127e67){return{'model':db[_0x127e67[_0x8ee7('0x1d')]],'as':_0x127e67['as'],'attributes':_0x127e67[_0x8ee7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ee7('0xb')](function(_0xe85dd3){logger[_0x8ee7('0x12')](_0x8ee7('0x1f'),_0x35bb18);logger[_0x8ee7('0x20')]('ShowSalesforceAccount',_0x35bb18,JSON[_0x8ee7('0xd')](_0xe85dd3));_0x1df59b(_0xe85dd3);})[_0x8ee7('0x21')](function(_0x3a6431){logger['error'](_0x8ee7('0x1f'),_0x3a6431[_0x8ee7('0x11')],_0x35bb18);_0x25a285(_0x45c3ec[_0x8ee7('0xe')](0x1f4,_0x3a6431[_0x8ee7('0x11')]));});});}; \ No newline at end of file +var _0x1dbb=['limit','include','map','model','where','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','attributes'];(function(_0x4e6639,_0x5d746d){var _0xf1a622=function(_0x224ed1){while(--_0x224ed1){_0x4e6639['push'](_0x4e6639['shift']());}};_0xf1a622(++_0x5d746d);}(_0x1dbb,0xed));var _0xb1db=function(_0x328c41,_0x3c1085){_0x328c41=_0x328c41-0x0;var _0x344f6d=_0x1dbb[_0x328c41];return _0x344f6d;};'use strict';var _=require(_0xb1db('0x0'));var util=require(_0xb1db('0x1'));var moment=require(_0xb1db('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1db('0x3'));var fs=require('fs');var Redis=require(_0xb1db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1db('0x5'));var logger=require('../../config/logger')(_0xb1db('0x6'));var config=require(_0xb1db('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d1a16,_0x71c4db,_0x24470){return new BPromise(function(_0x4a5dd8,_0x2589a4){return client[_0xb1db('0x9')](_0x1d1a16,_0x24470)[_0xb1db('0xa')](function(_0x4823b3){logger[_0xb1db('0xb')](_0xb1db('0xc'),_0x71c4db,_0xb1db('0xd'));logger[_0xb1db('0xe')](_0xb1db('0xf'),_0x71c4db,'request\x20sent',JSON[_0xb1db('0x10')](_0x4823b3));if(_0x4823b3[_0xb1db('0x11')]){if(_0x4823b3[_0xb1db('0x11')][_0xb1db('0x12')]===0x1f4){logger[_0xb1db('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x71c4db,_0x4823b3['error']['message']);return _0x2589a4(_0x4823b3['error'][_0xb1db('0x13')]);}logger[_0xb1db('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x71c4db,_0x4823b3[_0xb1db('0x11')][_0xb1db('0x13')]);return _0x4a5dd8(_0x4823b3[_0xb1db('0x11')][_0xb1db('0x13')]);}else{logger[_0xb1db('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x71c4db,_0xb1db('0xd'));_0x4a5dd8(_0x4823b3[_0xb1db('0x14')]['message']);}})[_0xb1db('0x15')](function(_0x2e404e){logger[_0xb1db('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x71c4db,_0x2e404e);_0x2589a4(_0x2e404e);});});}exports[_0xb1db('0x16')]=function(_0x58171c){var _0x1dd8e7=this;return new Promise(function(_0x598658,_0x520b2f){return db['SalesforceAccount'][_0xb1db('0x17')]({'raw':_0x58171c[_0xb1db('0x18')]?_0x58171c[_0xb1db('0x18')][_0xb1db('0x19')]===undefined?!![]:![]:!![],'where':_0x58171c['options']?_0x58171c[_0xb1db('0x18')]['where']||null:null,'attributes':_0x58171c[_0xb1db('0x18')]?_0x58171c[_0xb1db('0x18')][_0xb1db('0x1a')]||null:null,'limit':_0x58171c[_0xb1db('0x18')]?_0x58171c['options'][_0xb1db('0x1b')]||null:null,'include':_0x58171c['options']?_0x58171c['options'][_0xb1db('0x1c')]?_[_0xb1db('0x1d')](_0x58171c[_0xb1db('0x18')][_0xb1db('0x1c')],function(_0xb16830){return{'model':db[_0xb16830['model']],'as':_0xb16830['as'],'attributes':_0xb16830[_0xb1db('0x1a')],'include':_0xb16830[_0xb1db('0x1c')]?_[_0xb1db('0x1d')](_0xb16830[_0xb1db('0x1c')],function(_0x35df56){return{'model':db[_0x35df56[_0xb1db('0x1e')]],'as':_0x35df56['as'],'attributes':_0x35df56['attributes'],'include':_0x35df56[_0xb1db('0x1c')]?_[_0xb1db('0x1d')](_0x35df56['include'],function(_0x3af3ac){return{'model':db[_0x3af3ac[_0xb1db('0x1e')]],'as':_0x3af3ac['as'],'attributes':_0x3af3ac[_0xb1db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb1db('0xa')](function(_0x9389cf){logger[_0xb1db('0xb')]('GetSalesforceAccount',_0x58171c);logger[_0xb1db('0xe')](_0xb1db('0x16'),_0x58171c,JSON[_0xb1db('0x10')](_0x9389cf));_0x598658(_0x9389cf);})[_0xb1db('0x15')](function(_0x1b404e){logger[_0xb1db('0x11')]('GetSalesforceAccount',_0x1b404e['message'],_0x58171c);_0x520b2f(_0x1dd8e7['error'](0x1f4,_0x1b404e['message']));});});};exports['ShowSalesforceAccount']=function(_0x3d1929){var _0x3e3705=this;return new Promise(function(_0x295e28,_0x5d2a55){return db['SalesforceAccount']['find']({'raw':_0x3d1929['options']?_0x3d1929[_0xb1db('0x18')][_0xb1db('0x19')]===undefined?!![]:![]:!![],'where':_0x3d1929[_0xb1db('0x18')]?_0x3d1929[_0xb1db('0x18')][_0xb1db('0x1f')]||null:null,'attributes':_0x3d1929[_0xb1db('0x18')]?_0x3d1929[_0xb1db('0x18')][_0xb1db('0x1a')]||null:null,'include':_0x3d1929[_0xb1db('0x18')]?_0x3d1929[_0xb1db('0x18')]['include']?_[_0xb1db('0x1d')](_0x3d1929[_0xb1db('0x18')][_0xb1db('0x1c')],function(_0x470c6a){return{'model':db[_0x470c6a[_0xb1db('0x1e')]],'as':_0x470c6a['as'],'attributes':_0x470c6a[_0xb1db('0x1a')],'include':_0x470c6a['include']?_[_0xb1db('0x1d')](_0x470c6a[_0xb1db('0x1c')],function(_0x13ef53){return{'model':db[_0x13ef53[_0xb1db('0x1e')]],'as':_0x13ef53['as'],'attributes':_0x13ef53[_0xb1db('0x1a')],'include':_0x13ef53[_0xb1db('0x1c')]?_[_0xb1db('0x1d')](_0x13ef53[_0xb1db('0x1c')],function(_0x5b7694){return{'model':db[_0x5b7694[_0xb1db('0x1e')]],'as':_0x5b7694['as'],'attributes':_0x5b7694[_0xb1db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb1db('0xa')](function(_0xc3e796){logger['info'](_0xb1db('0x20'),_0x3d1929);logger[_0xb1db('0xe')](_0xb1db('0x20'),_0x3d1929,JSON['stringify'](_0xc3e796));_0x295e28(_0xc3e796);})[_0xb1db('0x15')](function(_0x1cf74e){logger[_0xb1db('0x11')]('ShowSalesforceAccount',_0x1cf74e[_0xb1db('0x13')],_0x3d1929);_0x5d2a55(_0x3e3705[_0xb1db('0x11')](0x1f4,_0x1cf74e[_0xb1db('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index af92929..aca6594 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x27b2c9,_0xf9afe4){var _0x1c4fff=function(_0x585a09){while(--_0x585a09){_0x27b2c9['push'](_0x27b2c9['shift']());}};_0x1c4fff(++_0xf9afe4);}(_0xadb5,0xad));var _0x5adb=function(_0x18655b,_0x51aa41){_0x18655b=_0x18655b-0x0;var _0x4ee6bb=_0xadb5[_0x18655b];return _0x4ee6bb;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xdb28,0x106));var _0x8db2=function(_0x3bbe97,_0x789c54){_0x3bbe97=_0x3bbe97-0x0;var _0x2393dd=_0xdb28[_0x3bbe97];return _0x2393dd;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 28d6399..8e10390 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 _0x335e=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x30b0f1,_0x56483d){var _0x23d8c2=function(_0x190dd0){while(--_0x190dd0){_0x30b0f1['push'](_0x30b0f1['shift']());}};_0x23d8c2(++_0x56483d);}(_0x335e,0x6e));var _0xe335=function(_0x711bb9,_0x56abba){_0x711bb9=_0x711bb9-0x0;var _0xfd9c26=_0x335e[_0x711bb9];return _0xfd9c26;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe335('0x0')]},'description':{'type':Sequelize[_0xe335('0x0')]},'ticketType':{'type':Sequelize[_0xe335('0x1')](_0xe335('0x2'),_0xe335('0x3')),'defaultValue':_0xe335('0x2')},'moduleSearch':{'type':Sequelize[_0xe335('0x1')](_0xe335('0x4'),_0xe335('0x5'),_0xe335('0x6'),_0xe335('0x7'),_0xe335('0x8')),'defaultValue':_0xe335('0x4')},'moduleCreate':{'type':Sequelize[_0xe335('0x1')](_0xe335('0x9'),'contact',_0xe335('0x6'),_0xe335('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xe335('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xe335('0x0')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc80c=['account_contact_lead','account','contact_lead','nothing','lead','sequelize','STRING','Task','Case','ENUM','contact'];(function(_0x8cb470,_0x2b9757){var _0x2ca139=function(_0x5251be){while(--_0x5251be){_0x8cb470['push'](_0x8cb470['shift']());}};_0x2ca139(++_0x2b9757);}(_0xc80c,0x94));var _0xcc80=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xc80c[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xcc80('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc80('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xcc80('0x2'),_0xcc80('0x3')),'defaultValue':_0xcc80('0x2')},'moduleSearch':{'type':Sequelize[_0xcc80('0x4')]('contact_lead',_0xcc80('0x5'),'lead',_0xcc80('0x6'),_0xcc80('0x7')),'defaultValue':_0xcc80('0x8')},'moduleCreate':{'type':Sequelize[_0xcc80('0x4')](_0xcc80('0x9'),_0xcc80('0x5'),_0xcc80('0xa'),_0xcc80('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xcc80('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xcc80('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xcc80('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a846bd5..bab49cb 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 _0xec82=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','update','then','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xec82,0x83));var _0x2ec8=function(_0x3046a3,_0x3191be){_0x3046a3=_0x3046a3-0x0;var _0x46ae3f=_0xec82[_0x3046a3];return _0x46ae3f;};'use strict';var emlformat=require(_0x2ec8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ec8('0x1'));var rp=require(_0x2ec8('0x2'));var moment=require('moment');var BPromise=require(_0x2ec8('0x3'));var Mustache=require(_0x2ec8('0x4'));var util=require(_0x2ec8('0x5'));var path=require(_0x2ec8('0x6'));var sox=require(_0x2ec8('0x7'));var csv=require(_0x2ec8('0x8'));var ejs=require(_0x2ec8('0x9'));var fs=require('fs');var fs_extra=require(_0x2ec8('0xa'));var _=require(_0x2ec8('0xb'));var squel=require(_0x2ec8('0xc'));var crypto=require(_0x2ec8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ec8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ec8('0xf'));var Redis=require(_0x2ec8('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ec8('0x11'));var hardwareService=require(_0x2ec8('0x12'));var logger=require(_0x2ec8('0x13'))(_0x2ec8('0x14'));var utils=require(_0x2ec8('0x15'));var config=require(_0x2ec8('0x16'));var licenseUtil=require(_0x2ec8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x286433,_0x35727e){_0x35727e=_0x35727e||0xcc;return function(_0x500f44){if(_0x500f44){return _0x286433[_0x2ec8('0x18')](_0x35727e);}return _0x286433[_0x2ec8('0x19')](_0x35727e)[_0x2ec8('0x1a')]();};}function respondWithResult(_0x2d65ef,_0x2c7b4f){_0x2c7b4f=_0x2c7b4f||0xc8;return function(_0x100659){if(_0x100659){return _0x2d65ef['status'](_0x2c7b4f)[_0x2ec8('0x1b')](_0x100659);}};}function respondWithFilteredResult(_0x56bd68,_0x6eb3a){return function(_0x8e7a6a){if(_0x8e7a6a){var _0x12d01d=typeof _0x6eb3a[_0x2ec8('0x1c')]==='undefined'&&typeof _0x6eb3a[_0x2ec8('0x1d')]===_0x2ec8('0x1e');var _0x2a5bc1=_0x8e7a6a['count'];var _0x4a571f=_0x12d01d?0x0:_0x6eb3a[_0x2ec8('0x1c')];var _0x5bd1f9=_0x12d01d?_0x8e7a6a['count']:_0x6eb3a[_0x2ec8('0x1c')]+_0x6eb3a[_0x2ec8('0x1d')];var _0x2e821a;if(_0x5bd1f9>=_0x2a5bc1){_0x5bd1f9=_0x2a5bc1;_0x2e821a=0xc8;}else{_0x2e821a=0xce;}_0x56bd68[_0x2ec8('0x19')](_0x2e821a);return _0x56bd68['set'](_0x2ec8('0x1f'),_0x4a571f+'-'+_0x5bd1f9+'/'+_0x2a5bc1)[_0x2ec8('0x1b')](_0x8e7a6a);}return null;};}function patchUpdates(_0x5681e4){return function(_0x4d09cc){try{jsonpatch['apply'](_0x4d09cc,_0x5681e4,!![]);}catch(_0x59c548){return BPromise[_0x2ec8('0x20')](_0x59c548);}return _0x4d09cc['save']();};}function saveUpdates(_0x5d8959,_0x18b8ba){return function(_0x5e0160){if(_0x5e0160){return _0x5e0160[_0x2ec8('0x21')](_0x5d8959)['then'](function(_0x4d2dc4){return _0x4d2dc4;});}return null;};}function removeEntity(_0x2bf50b,_0x397dca){return function(_0x5df72e){if(_0x5df72e){return _0x5df72e['destroy']()[_0x2ec8('0x22')](function(){_0x2bf50b[_0x2ec8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9edefd,_0x3ab01a){return function(_0x1d9b6e){if(!_0x1d9b6e){_0x9edefd[_0x2ec8('0x18')](0x194);}return _0x1d9b6e;};}function handleError(_0x68bb95,_0x4bad55){_0x4bad55=_0x4bad55||0x1f4;return function(_0x28a35b){logger[_0x2ec8('0x23')](_0x28a35b[_0x2ec8('0x24')]);if(_0x28a35b[_0x2ec8('0x25')]){delete _0x28a35b['name'];}_0x68bb95['status'](_0x4bad55)[_0x2ec8('0x26')](_0x28a35b);};}exports['index']=function(_0x316bbf,_0x52307d){var _0x421917={},_0x10e6ce={},_0x54a5d2={'count':0x0,'rows':[]};var _0x4f93fa=_[_0x2ec8('0x27')](db[_0x2ec8('0x28')]['rawAttributes'],function(_0x45a464){return{'name':_0x45a464[_0x2ec8('0x29')],'type':_0x45a464[_0x2ec8('0x2a')][_0x2ec8('0x2b')]};});_0x10e6ce[_0x2ec8('0x2c')]=_[_0x2ec8('0x27')](_0x4f93fa,'name');_0x10e6ce[_0x2ec8('0x2d')]=_[_0x2ec8('0x2e')](_0x316bbf[_0x2ec8('0x2d')]);_0x10e6ce['filters']=_[_0x2ec8('0x2f')](_0x10e6ce[_0x2ec8('0x2c')],_0x10e6ce[_0x2ec8('0x2d')]);_0x421917['attributes']=_[_0x2ec8('0x2f')](_0x10e6ce[_0x2ec8('0x2c')],qs[_0x2ec8('0x30')](_0x316bbf[_0x2ec8('0x2d')][_0x2ec8('0x30')]));_0x421917[_0x2ec8('0x31')]=_0x421917[_0x2ec8('0x31')][_0x2ec8('0x32')]?_0x421917['attributes']:_0x10e6ce['model'];if(!_0x316bbf[_0x2ec8('0x2d')][_0x2ec8('0x33')](_0x2ec8('0x34'))){_0x421917[_0x2ec8('0x1d')]=qs[_0x2ec8('0x1d')](_0x316bbf[_0x2ec8('0x2d')][_0x2ec8('0x1d')]);_0x421917['offset']=qs['offset'](_0x316bbf['query'][_0x2ec8('0x1c')]);}_0x421917[_0x2ec8('0x35')]=qs['sort'](_0x316bbf['query'][_0x2ec8('0x36')]);_0x421917[_0x2ec8('0x37')]=qs[_0x2ec8('0x38')](_['pick'](_0x316bbf[_0x2ec8('0x2d')],_0x10e6ce['filters']),_0x4f93fa);if(_0x316bbf[_0x2ec8('0x2d')][_0x2ec8('0x39')]){_0x421917['where']=_[_0x2ec8('0x3a')](_0x421917[_0x2ec8('0x37')],{'$or':_[_0x2ec8('0x27')](_0x4f93fa,function(_0x2a0e9d){if(_0x2a0e9d[_0x2ec8('0x2a')]!==_0x2ec8('0x3b')){var _0x1bff59={};_0x1bff59[_0x2a0e9d['name']]={'$like':'%'+_0x316bbf[_0x2ec8('0x2d')]['filter']+'%'};return _0x1bff59;}})});}_0x421917=_[_0x2ec8('0x3a')]({},_0x421917,_0x316bbf[_0x2ec8('0x3c')]);var _0x283831={'where':_0x421917[_0x2ec8('0x37')]};return db['SalesforceConfiguration'][_0x2ec8('0x3d')](_0x283831)['then'](function(_0x2b7ca2){_0x54a5d2[_0x2ec8('0x3d')]=_0x2b7ca2;if(_0x316bbf[_0x2ec8('0x2d')]['includeAll']){_0x421917['include']=[{'all':!![]}];}return db[_0x2ec8('0x28')]['findAll'](_0x421917);})[_0x2ec8('0x22')](function(_0x111a88){_0x54a5d2['rows']=_0x111a88;return _0x54a5d2;})[_0x2ec8('0x22')](respondWithFilteredResult(_0x52307d,_0x421917))[_0x2ec8('0x3e')](handleError(_0x52307d,null));};exports[_0x2ec8('0x3f')]=function(_0x5c087d,_0x24df02){var _0x5e7536={'raw':![],'where':{'id':_0x5c087d[_0x2ec8('0x40')]['id']}},_0xe375dc={};_0xe375dc[_0x2ec8('0x2c')]=_['keys'](db['SalesforceConfiguration'][_0x2ec8('0x41')]);_0xe375dc[_0x2ec8('0x2d')]=_[_0x2ec8('0x2e')](_0x5c087d[_0x2ec8('0x2d')]);_0xe375dc[_0x2ec8('0x38')]=_[_0x2ec8('0x2f')](_0xe375dc['model'],_0xe375dc[_0x2ec8('0x2d')]);_0x5e7536[_0x2ec8('0x31')]=_[_0x2ec8('0x2f')](_0xe375dc[_0x2ec8('0x2c')],qs[_0x2ec8('0x30')](_0x5c087d[_0x2ec8('0x2d')][_0x2ec8('0x30')]));_0x5e7536[_0x2ec8('0x31')]=_0x5e7536[_0x2ec8('0x31')][_0x2ec8('0x32')]?_0x5e7536[_0x2ec8('0x31')]:_0xe375dc[_0x2ec8('0x2c')];if(_0x5c087d[_0x2ec8('0x2d')][_0x2ec8('0x42')]){_0x5e7536['include']=[{'all':!![]}];}_0x5e7536=_[_0x2ec8('0x3a')]({},_0x5e7536,_0x5c087d[_0x2ec8('0x3c')]);return db[_0x2ec8('0x28')][_0x2ec8('0x43')](_0x5e7536)[_0x2ec8('0x22')](handleEntityNotFound(_0x24df02,null))[_0x2ec8('0x22')](respondWithResult(_0x24df02,null))[_0x2ec8('0x3e')](handleError(_0x24df02,null));};exports[_0x2ec8('0x44')]=function(_0x151440,_0x4dbf27){return db[_0x2ec8('0x28')]['create'](_0x151440[_0x2ec8('0x45')],{})[_0x2ec8('0x22')](respondWithResult(_0x4dbf27,0xc9))[_0x2ec8('0x3e')](handleError(_0x4dbf27,null));};exports[_0x2ec8('0x21')]=function(_0x4a9681,_0x13d9d3){if(_0x4a9681[_0x2ec8('0x45')]['id']){delete _0x4a9681[_0x2ec8('0x45')]['id'];}return db[_0x2ec8('0x28')]['find']({'where':{'id':_0x4a9681[_0x2ec8('0x40')]['id']}})[_0x2ec8('0x22')](handleEntityNotFound(_0x13d9d3,null))[_0x2ec8('0x22')](saveUpdates(_0x4a9681[_0x2ec8('0x45')],null))[_0x2ec8('0x22')](respondWithResult(_0x13d9d3,null))[_0x2ec8('0x3e')](handleError(_0x13d9d3,null));};exports['destroy']=function(_0x59f54f,_0x1fba5b){return db[_0x2ec8('0x28')][_0x2ec8('0x43')]({'where':{'id':_0x59f54f[_0x2ec8('0x40')]['id']}})[_0x2ec8('0x22')](handleEntityNotFound(_0x1fba5b,null))['then'](removeEntity(_0x1fba5b,null))['catch'](handleError(_0x1fba5b,null));};exports[_0x2ec8('0x46')]=function(_0x386cd3,_0x56a04a,_0x47b41d){var _0x54450a={};var _0x3193d0={};var _0x50c861;var _0x3b3f96;return db[_0x2ec8('0x28')][_0x2ec8('0x47')]({'where':{'id':_0x386cd3['params']['id']}})[_0x2ec8('0x22')](handleEntityNotFound(_0x56a04a,null))[_0x2ec8('0x22')](function(_0x285de3){if(_0x285de3){_0x50c861=_0x285de3;_0x3193d0[_0x2ec8('0x2c')]=_['keys'](db[_0x2ec8('0x48')][_0x2ec8('0x41')]);_0x3193d0[_0x2ec8('0x2d')]=_['keys'](_0x386cd3[_0x2ec8('0x2d')]);_0x3193d0['filters']=_[_0x2ec8('0x2f')](_0x3193d0[_0x2ec8('0x2c')],_0x3193d0['query']);_0x54450a['attributes']=_[_0x2ec8('0x2f')](_0x3193d0['model'],qs[_0x2ec8('0x30')](_0x386cd3[_0x2ec8('0x2d')][_0x2ec8('0x30')]));_0x54450a[_0x2ec8('0x31')]=_0x54450a[_0x2ec8('0x31')]['length']?_0x54450a[_0x2ec8('0x31')]:_0x3193d0['model'];_0x54450a[_0x2ec8('0x35')]=qs[_0x2ec8('0x36')](_0x386cd3['query'][_0x2ec8('0x36')]);_0x54450a[_0x2ec8('0x37')]=qs[_0x2ec8('0x38')](_[_0x2ec8('0x49')](_0x386cd3[_0x2ec8('0x2d')],_0x3193d0[_0x2ec8('0x38')]));if(_0x386cd3[_0x2ec8('0x2d')][_0x2ec8('0x39')]){_0x54450a[_0x2ec8('0x37')]=_[_0x2ec8('0x3a')](_0x54450a[_0x2ec8('0x37')],{'$or':_[_0x2ec8('0x27')](_0x54450a[_0x2ec8('0x31')],function(_0x54090e){var _0x52fe98={};_0x52fe98[_0x54090e]={'$like':'%'+_0x386cd3[_0x2ec8('0x2d')]['filter']+'%'};return _0x52fe98;})});}_0x54450a=_[_0x2ec8('0x3a')]({},_0x54450a,_0x386cd3[_0x2ec8('0x3c')]);return _0x50c861['getFields'](_0x54450a);}})['then'](function(_0x5d299c){if(_0x5d299c){_0x3b3f96=_0x5d299c['length'];if(!_0x386cd3['query'][_0x2ec8('0x33')]('nolimit')){_0x54450a['limit']=qs['limit'](_0x386cd3[_0x2ec8('0x2d')]['limit']);_0x54450a[_0x2ec8('0x1c')]=qs[_0x2ec8('0x1c')](_0x386cd3[_0x2ec8('0x2d')]['offset']);}return _0x50c861['getFields'](_0x54450a);}})[_0x2ec8('0x22')](function(_0x1a7aec){if(_0x1a7aec){return _0x1a7aec?{'count':_0x3b3f96,'rows':_0x1a7aec}:null;}})[_0x2ec8('0x22')](respondWithResult(_0x56a04a,null))[_0x2ec8('0x3e')](handleError(_0x56a04a,null));};exports['getSubjects']=function(_0x43cde2,_0x38c34b,_0x11ccc3){var _0x1372b5={};var _0x41cdba={};var _0x1eeaaa;var _0x429cf3;return db[_0x2ec8('0x28')][_0x2ec8('0x47')]({'where':{'id':_0x43cde2[_0x2ec8('0x40')]['id']}})['then'](handleEntityNotFound(_0x38c34b,null))['then'](function(_0x41772a){if(_0x41772a){_0x1eeaaa=_0x41772a;_0x41cdba[_0x2ec8('0x2c')]=_[_0x2ec8('0x2e')](db[_0x2ec8('0x48')][_0x2ec8('0x41')]);_0x41cdba['query']=_[_0x2ec8('0x2e')](_0x43cde2[_0x2ec8('0x2d')]);_0x41cdba[_0x2ec8('0x38')]=_['intersection'](_0x41cdba[_0x2ec8('0x2c')],_0x41cdba[_0x2ec8('0x2d')]);_0x1372b5[_0x2ec8('0x31')]=_[_0x2ec8('0x2f')](_0x41cdba['model'],qs[_0x2ec8('0x30')](_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x30')]));_0x1372b5[_0x2ec8('0x31')]=_0x1372b5[_0x2ec8('0x31')][_0x2ec8('0x32')]?_0x1372b5[_0x2ec8('0x31')]:_0x41cdba[_0x2ec8('0x2c')];_0x1372b5['order']=qs[_0x2ec8('0x36')](_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x36')]);_0x1372b5[_0x2ec8('0x37')]=qs[_0x2ec8('0x38')](_['pick'](_0x43cde2[_0x2ec8('0x2d')],_0x41cdba[_0x2ec8('0x38')]));if(_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x39')]){_0x1372b5[_0x2ec8('0x37')]=_[_0x2ec8('0x3a')](_0x1372b5['where'],{'$or':_['map'](_0x1372b5[_0x2ec8('0x31')],function(_0x31b309){var _0x4e00f3={};_0x4e00f3[_0x31b309]={'$like':'%'+_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x39')]+'%'};return _0x4e00f3;})});}_0x1372b5=_[_0x2ec8('0x3a')]({},_0x1372b5,_0x43cde2[_0x2ec8('0x3c')]);return _0x1eeaaa['getSubjects'](_0x1372b5);}})[_0x2ec8('0x22')](function(_0x2d8969){if(_0x2d8969){_0x429cf3=_0x2d8969[_0x2ec8('0x32')];if(!_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x33')](_0x2ec8('0x34'))){_0x1372b5[_0x2ec8('0x1d')]=qs[_0x2ec8('0x1d')](_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x1d')]);_0x1372b5[_0x2ec8('0x1c')]=qs[_0x2ec8('0x1c')](_0x43cde2[_0x2ec8('0x2d')][_0x2ec8('0x1c')]);}return _0x1eeaaa[_0x2ec8('0x4a')](_0x1372b5);}})[_0x2ec8('0x22')](function(_0x1f6b3b){if(_0x1f6b3b){return _0x1f6b3b?{'count':_0x429cf3,'rows':_0x1f6b3b}:null;}})[_0x2ec8('0x22')](respondWithResult(_0x38c34b,null))['catch'](handleError(_0x38c34b,null));};exports[_0x2ec8('0x4b')]=function(_0x737e92,_0x5d6893,_0x34f72a){var _0x340468={};var _0x28f2f2={};var _0x551efa;var _0x27b463;return db[_0x2ec8('0x28')][_0x2ec8('0x47')]({'where':{'id':_0x737e92[_0x2ec8('0x40')]['id']}})[_0x2ec8('0x22')](handleEntityNotFound(_0x5d6893,null))[_0x2ec8('0x22')](function(_0x24e95b){if(_0x24e95b){_0x551efa=_0x24e95b;_0x28f2f2[_0x2ec8('0x2c')]=_[_0x2ec8('0x2e')](db[_0x2ec8('0x48')][_0x2ec8('0x41')]);_0x28f2f2['query']=_[_0x2ec8('0x2e')](_0x737e92[_0x2ec8('0x2d')]);_0x28f2f2[_0x2ec8('0x38')]=_[_0x2ec8('0x2f')](_0x28f2f2['model'],_0x28f2f2[_0x2ec8('0x2d')]);_0x340468[_0x2ec8('0x31')]=_[_0x2ec8('0x2f')](_0x28f2f2[_0x2ec8('0x2c')],qs[_0x2ec8('0x30')](_0x737e92[_0x2ec8('0x2d')]['fields']));_0x340468['attributes']=_0x340468[_0x2ec8('0x31')]['length']?_0x340468['attributes']:_0x28f2f2[_0x2ec8('0x2c')];_0x340468[_0x2ec8('0x35')]=qs[_0x2ec8('0x36')](_0x737e92[_0x2ec8('0x2d')][_0x2ec8('0x36')]);_0x340468[_0x2ec8('0x37')]=qs[_0x2ec8('0x38')](_['pick'](_0x737e92[_0x2ec8('0x2d')],_0x28f2f2['filters']));if(_0x737e92['query'][_0x2ec8('0x39')]){_0x340468[_0x2ec8('0x37')]=_['merge'](_0x340468['where'],{'$or':_[_0x2ec8('0x27')](_0x340468[_0x2ec8('0x31')],function(_0x5d5200){var _0x4ed6fe={};_0x4ed6fe[_0x5d5200]={'$like':'%'+_0x737e92[_0x2ec8('0x2d')][_0x2ec8('0x39')]+'%'};return _0x4ed6fe;})});}_0x340468=_[_0x2ec8('0x3a')]({},_0x340468,_0x737e92[_0x2ec8('0x3c')]);return _0x551efa[_0x2ec8('0x4b')](_0x340468);}})['then'](function(_0x4a1eee){if(_0x4a1eee){_0x27b463=_0x4a1eee[_0x2ec8('0x32')];if(!_0x737e92[_0x2ec8('0x2d')]['hasOwnProperty'](_0x2ec8('0x34'))){_0x340468['limit']=qs[_0x2ec8('0x1d')](_0x737e92[_0x2ec8('0x2d')][_0x2ec8('0x1d')]);_0x340468[_0x2ec8('0x1c')]=qs[_0x2ec8('0x1c')](_0x737e92[_0x2ec8('0x2d')][_0x2ec8('0x1c')]);}return _0x551efa['getDescriptions'](_0x340468);}})[_0x2ec8('0x22')](function(_0x294cc3){if(_0x294cc3){return _0x294cc3?{'count':_0x27b463,'rows':_0x294cc3}:null;}})[_0x2ec8('0x22')](respondWithResult(_0x5d6893,null))['catch'](handleError(_0x5d6893,null));}; \ No newline at end of file +var _0x98be=['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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','save','update','destroy','end','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','params','keys','find','catch','create','body','findOne','SalesforceField','rawAttributes','order','getFields','getSubjects','getDescriptions','eml-format'];(function(_0x2d9435,_0x293042){var _0x2f8628=function(_0x5a6a21){while(--_0x5a6a21){_0x2d9435['push'](_0x2d9435['shift']());}};_0x2f8628(++_0x293042);}(_0x98be,0x1e5));var _0xe98b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x98be[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0xe98b('0x0'));var rimraf=require(_0xe98b('0x1'));var zipdir=require(_0xe98b('0x2'));var jsonpatch=require(_0xe98b('0x3'));var rp=require('request-promise');var moment=require(_0xe98b('0x4'));var BPromise=require(_0xe98b('0x5'));var Mustache=require(_0xe98b('0x6'));var util=require(_0xe98b('0x7'));var path=require(_0xe98b('0x8'));var sox=require(_0xe98b('0x9'));var csv=require(_0xe98b('0xa'));var ejs=require(_0xe98b('0xb'));var fs=require('fs');var fs_extra=require(_0xe98b('0xc'));var _=require(_0xe98b('0xd'));var squel=require(_0xe98b('0xe'));var crypto=require(_0xe98b('0xf'));var jsforce=require(_0xe98b('0x10'));var deskjs=require(_0xe98b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe98b('0x12'));var Papa=require('papaparse');var Redis=require(_0xe98b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe98b('0x14'));var as=require(_0xe98b('0x15'));var hardwareService=require(_0xe98b('0x16'));var logger=require('../../config/logger')(_0xe98b('0x17'));var utils=require(_0xe98b('0x18'));var config=require(_0xe98b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392a08,_0x3aac08){_0x3aac08=_0x3aac08||0xcc;return function(_0x12dcd0){if(_0x12dcd0){return _0x392a08[_0xe98b('0x1a')](_0x3aac08);}return _0x392a08[_0xe98b('0x1b')](_0x3aac08)['end']();};}function respondWithResult(_0x2e615a,_0xe187b5){_0xe187b5=_0xe187b5||0xc8;return function(_0x379433){if(_0x379433){return _0x2e615a[_0xe98b('0x1b')](_0xe187b5)['json'](_0x379433);}};}function respondWithFilteredResult(_0x3aa8f1,_0x36ba2b){return function(_0x269af6){if(_0x269af6){var _0x2bd843=typeof _0x36ba2b[_0xe98b('0x1c')]===_0xe98b('0x1d')&&typeof _0x36ba2b[_0xe98b('0x1e')]===_0xe98b('0x1d');var _0x40e848=_0x269af6[_0xe98b('0x1f')];var _0x187bde=_0x2bd843?0x0:_0x36ba2b['offset'];var _0x2b0c09=_0x2bd843?_0x269af6[_0xe98b('0x1f')]:_0x36ba2b[_0xe98b('0x1c')]+_0x36ba2b[_0xe98b('0x1e')];var _0x1abd0f;if(_0x2b0c09>=_0x40e848){_0x2b0c09=_0x40e848;_0x1abd0f=0xc8;}else{_0x1abd0f=0xce;}_0x3aa8f1[_0xe98b('0x1b')](_0x1abd0f);return _0x3aa8f1[_0xe98b('0x20')](_0xe98b('0x21'),_0x187bde+'-'+_0x2b0c09+'/'+_0x40e848)['json'](_0x269af6);}return null;};}function patchUpdates(_0x11215b){return function(_0x329111){try{jsonpatch['apply'](_0x329111,_0x11215b,!![]);}catch(_0x150342){return BPromise['reject'](_0x150342);}return _0x329111[_0xe98b('0x22')]();};}function saveUpdates(_0x4b23b2,_0x3f9efa){return function(_0x3d3a68){if(_0x3d3a68){return _0x3d3a68[_0xe98b('0x23')](_0x4b23b2)['then'](function(_0x3cc02f){return _0x3cc02f;});}return null;};}function removeEntity(_0x516723,_0x16e058){return function(_0x379418){if(_0x379418){return _0x379418[_0xe98b('0x24')]()['then'](function(){_0x516723[_0xe98b('0x1b')](0xcc)[_0xe98b('0x25')]();});}};}function handleEntityNotFound(_0x3ca4b0,_0x2d2c64){return function(_0x337c74){if(!_0x337c74){_0x3ca4b0[_0xe98b('0x1a')](0x194);}return _0x337c74;};}function handleError(_0x2bddde,_0x196b77){_0x196b77=_0x196b77||0x1f4;return function(_0x486d66){logger[_0xe98b('0x26')](_0x486d66[_0xe98b('0x27')]);if(_0x486d66[_0xe98b('0x28')]){delete _0x486d66[_0xe98b('0x28')];}_0x2bddde['status'](_0x196b77)[_0xe98b('0x29')](_0x486d66);};}exports[_0xe98b('0x2a')]=function(_0x53c4c4,_0x5cd5ad){var _0x26f24c={},_0x21f4bb={},_0x5aa895={'count':0x0,'rows':[]};var _0x3ce846=_[_0xe98b('0x2b')](db[_0xe98b('0x2c')]['rawAttributes'],function(_0x232806){return{'name':_0x232806[_0xe98b('0x2d')],'type':_0x232806[_0xe98b('0x2e')][_0xe98b('0x2f')]};});_0x21f4bb[_0xe98b('0x30')]=_[_0xe98b('0x2b')](_0x3ce846,_0xe98b('0x28'));_0x21f4bb[_0xe98b('0x31')]=_['keys'](_0x53c4c4['query']);_0x21f4bb[_0xe98b('0x32')]=_['intersection'](_0x21f4bb[_0xe98b('0x30')],_0x21f4bb[_0xe98b('0x31')]);_0x26f24c[_0xe98b('0x33')]=_[_0xe98b('0x34')](_0x21f4bb['model'],qs[_0xe98b('0x35')](_0x53c4c4[_0xe98b('0x31')]['fields']));_0x26f24c[_0xe98b('0x33')]=_0x26f24c[_0xe98b('0x33')][_0xe98b('0x36')]?_0x26f24c[_0xe98b('0x33')]:_0x21f4bb[_0xe98b('0x30')];if(!_0x53c4c4['query'][_0xe98b('0x37')](_0xe98b('0x38'))){_0x26f24c[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x53c4c4[_0xe98b('0x31')][_0xe98b('0x1e')]);_0x26f24c[_0xe98b('0x1c')]=qs[_0xe98b('0x1c')](_0x53c4c4[_0xe98b('0x31')]['offset']);}_0x26f24c['order']=qs['sort'](_0x53c4c4[_0xe98b('0x31')][_0xe98b('0x39')]);_0x26f24c[_0xe98b('0x3a')]=qs[_0xe98b('0x32')](_[_0xe98b('0x3b')](_0x53c4c4[_0xe98b('0x31')],_0x21f4bb[_0xe98b('0x32')]),_0x3ce846);if(_0x53c4c4['query'][_0xe98b('0x3c')]){_0x26f24c[_0xe98b('0x3a')]=_[_0xe98b('0x3d')](_0x26f24c[_0xe98b('0x3a')],{'$or':_['map'](_0x3ce846,function(_0x29a94c){if(_0x29a94c[_0xe98b('0x2e')]!==_0xe98b('0x3e')){var _0x1603e7={};_0x1603e7[_0x29a94c['name']]={'$like':'%'+_0x53c4c4[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x1603e7;}})});}_0x26f24c=_[_0xe98b('0x3d')]({},_0x26f24c,_0x53c4c4[_0xe98b('0x3f')]);var _0x3a2763={'where':_0x26f24c[_0xe98b('0x3a')]};return db[_0xe98b('0x2c')][_0xe98b('0x1f')](_0x3a2763)[_0xe98b('0x40')](function(_0x2f3fcd){_0x5aa895['count']=_0x2f3fcd;if(_0x53c4c4[_0xe98b('0x31')][_0xe98b('0x41')]){_0x26f24c[_0xe98b('0x42')]=[{'all':!![]}];}return db[_0xe98b('0x2c')][_0xe98b('0x43')](_0x26f24c);})[_0xe98b('0x40')](function(_0x92faa0){_0x5aa895['rows']=_0x92faa0;return _0x5aa895;})[_0xe98b('0x40')](respondWithFilteredResult(_0x5cd5ad,_0x26f24c))['catch'](handleError(_0x5cd5ad,null));};exports['show']=function(_0x69ccf4,_0x495d8c){var _0x346599={'raw':![],'where':{'id':_0x69ccf4[_0xe98b('0x44')]['id']}},_0x43a2a9={};_0x43a2a9[_0xe98b('0x30')]=_[_0xe98b('0x45')](db[_0xe98b('0x2c')]['rawAttributes']);_0x43a2a9[_0xe98b('0x31')]=_['keys'](_0x69ccf4[_0xe98b('0x31')]);_0x43a2a9[_0xe98b('0x32')]=_['intersection'](_0x43a2a9[_0xe98b('0x30')],_0x43a2a9[_0xe98b('0x31')]);_0x346599[_0xe98b('0x33')]=_[_0xe98b('0x34')](_0x43a2a9[_0xe98b('0x30')],qs[_0xe98b('0x35')](_0x69ccf4[_0xe98b('0x31')][_0xe98b('0x35')]));_0x346599[_0xe98b('0x33')]=_0x346599['attributes']['length']?_0x346599[_0xe98b('0x33')]:_0x43a2a9[_0xe98b('0x30')];if(_0x69ccf4[_0xe98b('0x31')][_0xe98b('0x41')]){_0x346599[_0xe98b('0x42')]=[{'all':!![]}];}_0x346599=_[_0xe98b('0x3d')]({},_0x346599,_0x69ccf4['options']);return db[_0xe98b('0x2c')][_0xe98b('0x46')](_0x346599)[_0xe98b('0x40')](handleEntityNotFound(_0x495d8c,null))[_0xe98b('0x40')](respondWithResult(_0x495d8c,null))[_0xe98b('0x47')](handleError(_0x495d8c,null));};exports[_0xe98b('0x48')]=function(_0x514637,_0x42d506){return db[_0xe98b('0x2c')][_0xe98b('0x48')](_0x514637['body'],{})[_0xe98b('0x40')](respondWithResult(_0x42d506,0xc9))['catch'](handleError(_0x42d506,null));};exports[_0xe98b('0x23')]=function(_0x56b84a,_0x55180e){if(_0x56b84a[_0xe98b('0x49')]['id']){delete _0x56b84a[_0xe98b('0x49')]['id'];}return db[_0xe98b('0x2c')][_0xe98b('0x46')]({'where':{'id':_0x56b84a['params']['id']}})[_0xe98b('0x40')](handleEntityNotFound(_0x55180e,null))[_0xe98b('0x40')](saveUpdates(_0x56b84a[_0xe98b('0x49')],null))[_0xe98b('0x40')](respondWithResult(_0x55180e,null))['catch'](handleError(_0x55180e,null));};exports[_0xe98b('0x24')]=function(_0x436637,_0x1c0619){return db[_0xe98b('0x2c')]['find']({'where':{'id':_0x436637[_0xe98b('0x44')]['id']}})[_0xe98b('0x40')](handleEntityNotFound(_0x1c0619,null))['then'](removeEntity(_0x1c0619,null))[_0xe98b('0x47')](handleError(_0x1c0619,null));};exports['getFields']=function(_0x484e66,_0x16a1fc,_0x562b1c){var _0x2568af={};var _0x504d0c={};var _0xc07a75;var _0x9e3bd2;return db[_0xe98b('0x2c')][_0xe98b('0x4a')]({'where':{'id':_0x484e66[_0xe98b('0x44')]['id']}})[_0xe98b('0x40')](handleEntityNotFound(_0x16a1fc,null))[_0xe98b('0x40')](function(_0x292c68){if(_0x292c68){_0xc07a75=_0x292c68;_0x504d0c[_0xe98b('0x30')]=_['keys'](db[_0xe98b('0x4b')][_0xe98b('0x4c')]);_0x504d0c[_0xe98b('0x31')]=_[_0xe98b('0x45')](_0x484e66[_0xe98b('0x31')]);_0x504d0c[_0xe98b('0x32')]=_[_0xe98b('0x34')](_0x504d0c[_0xe98b('0x30')],_0x504d0c[_0xe98b('0x31')]);_0x2568af[_0xe98b('0x33')]=_['intersection'](_0x504d0c['model'],qs['fields'](_0x484e66[_0xe98b('0x31')][_0xe98b('0x35')]));_0x2568af[_0xe98b('0x33')]=_0x2568af[_0xe98b('0x33')][_0xe98b('0x36')]?_0x2568af[_0xe98b('0x33')]:_0x504d0c[_0xe98b('0x30')];_0x2568af[_0xe98b('0x4d')]=qs[_0xe98b('0x39')](_0x484e66[_0xe98b('0x31')][_0xe98b('0x39')]);_0x2568af['where']=qs['filters'](_[_0xe98b('0x3b')](_0x484e66[_0xe98b('0x31')],_0x504d0c[_0xe98b('0x32')]));if(_0x484e66[_0xe98b('0x31')]['filter']){_0x2568af[_0xe98b('0x3a')]=_['merge'](_0x2568af['where'],{'$or':_[_0xe98b('0x2b')](_0x2568af[_0xe98b('0x33')],function(_0x515f9a){var _0x455acd={};_0x455acd[_0x515f9a]={'$like':'%'+_0x484e66[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x455acd;})});}_0x2568af=_[_0xe98b('0x3d')]({},_0x2568af,_0x484e66['options']);return _0xc07a75['getFields'](_0x2568af);}})['then'](function(_0x2d78b8){if(_0x2d78b8){_0x9e3bd2=_0x2d78b8[_0xe98b('0x36')];if(!_0x484e66[_0xe98b('0x31')][_0xe98b('0x37')]('nolimit')){_0x2568af[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x484e66[_0xe98b('0x31')][_0xe98b('0x1e')]);_0x2568af[_0xe98b('0x1c')]=qs['offset'](_0x484e66[_0xe98b('0x31')][_0xe98b('0x1c')]);}return _0xc07a75[_0xe98b('0x4e')](_0x2568af);}})[_0xe98b('0x40')](function(_0x2643cb){if(_0x2643cb){return _0x2643cb?{'count':_0x9e3bd2,'rows':_0x2643cb}:null;}})[_0xe98b('0x40')](respondWithResult(_0x16a1fc,null))[_0xe98b('0x47')](handleError(_0x16a1fc,null));};exports[_0xe98b('0x4f')]=function(_0x3463a1,_0x1e14ad,_0x36f66e){var _0x196419={};var _0x9af75c={};var _0x567286;var _0xa37972;return db[_0xe98b('0x2c')]['findOne']({'where':{'id':_0x3463a1[_0xe98b('0x44')]['id']}})[_0xe98b('0x40')](handleEntityNotFound(_0x1e14ad,null))[_0xe98b('0x40')](function(_0x464228){if(_0x464228){_0x567286=_0x464228;_0x9af75c[_0xe98b('0x30')]=_[_0xe98b('0x45')](db[_0xe98b('0x4b')][_0xe98b('0x4c')]);_0x9af75c[_0xe98b('0x31')]=_[_0xe98b('0x45')](_0x3463a1[_0xe98b('0x31')]);_0x9af75c[_0xe98b('0x32')]=_['intersection'](_0x9af75c[_0xe98b('0x30')],_0x9af75c['query']);_0x196419['attributes']=_['intersection'](_0x9af75c['model'],qs[_0xe98b('0x35')](_0x3463a1[_0xe98b('0x31')][_0xe98b('0x35')]));_0x196419[_0xe98b('0x33')]=_0x196419[_0xe98b('0x33')][_0xe98b('0x36')]?_0x196419[_0xe98b('0x33')]:_0x9af75c[_0xe98b('0x30')];_0x196419['order']=qs[_0xe98b('0x39')](_0x3463a1[_0xe98b('0x31')][_0xe98b('0x39')]);_0x196419[_0xe98b('0x3a')]=qs[_0xe98b('0x32')](_[_0xe98b('0x3b')](_0x3463a1[_0xe98b('0x31')],_0x9af75c[_0xe98b('0x32')]));if(_0x3463a1['query']['filter']){_0x196419[_0xe98b('0x3a')]=_[_0xe98b('0x3d')](_0x196419[_0xe98b('0x3a')],{'$or':_[_0xe98b('0x2b')](_0x196419['attributes'],function(_0x1007b2){var _0xeecb68={};_0xeecb68[_0x1007b2]={'$like':'%'+_0x3463a1[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0xeecb68;})});}_0x196419=_[_0xe98b('0x3d')]({},_0x196419,_0x3463a1[_0xe98b('0x3f')]);return _0x567286['getSubjects'](_0x196419);}})[_0xe98b('0x40')](function(_0x40df16){if(_0x40df16){_0xa37972=_0x40df16[_0xe98b('0x36')];if(!_0x3463a1[_0xe98b('0x31')][_0xe98b('0x37')](_0xe98b('0x38'))){_0x196419[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x3463a1[_0xe98b('0x31')][_0xe98b('0x1e')]);_0x196419[_0xe98b('0x1c')]=qs['offset'](_0x3463a1['query']['offset']);}return _0x567286[_0xe98b('0x4f')](_0x196419);}})[_0xe98b('0x40')](function(_0x5237b9){if(_0x5237b9){return _0x5237b9?{'count':_0xa37972,'rows':_0x5237b9}:null;}})[_0xe98b('0x40')](respondWithResult(_0x1e14ad,null))[_0xe98b('0x47')](handleError(_0x1e14ad,null));};exports[_0xe98b('0x50')]=function(_0x45a1b6,_0x34c9c3,_0x531dcc){var _0x3fffe4={};var _0x349324={};var _0x22b2a7;var _0x5f2957;return db[_0xe98b('0x2c')][_0xe98b('0x4a')]({'where':{'id':_0x45a1b6[_0xe98b('0x44')]['id']}})[_0xe98b('0x40')](handleEntityNotFound(_0x34c9c3,null))[_0xe98b('0x40')](function(_0x106746){if(_0x106746){_0x22b2a7=_0x106746;_0x349324['model']=_[_0xe98b('0x45')](db['SalesforceField']['rawAttributes']);_0x349324[_0xe98b('0x31')]=_[_0xe98b('0x45')](_0x45a1b6['query']);_0x349324[_0xe98b('0x32')]=_['intersection'](_0x349324[_0xe98b('0x30')],_0x349324[_0xe98b('0x31')]);_0x3fffe4[_0xe98b('0x33')]=_[_0xe98b('0x34')](_0x349324[_0xe98b('0x30')],qs[_0xe98b('0x35')](_0x45a1b6[_0xe98b('0x31')]['fields']));_0x3fffe4[_0xe98b('0x33')]=_0x3fffe4[_0xe98b('0x33')][_0xe98b('0x36')]?_0x3fffe4[_0xe98b('0x33')]:_0x349324[_0xe98b('0x30')];_0x3fffe4[_0xe98b('0x4d')]=qs[_0xe98b('0x39')](_0x45a1b6[_0xe98b('0x31')][_0xe98b('0x39')]);_0x3fffe4['where']=qs[_0xe98b('0x32')](_[_0xe98b('0x3b')](_0x45a1b6[_0xe98b('0x31')],_0x349324['filters']));if(_0x45a1b6['query'][_0xe98b('0x3c')]){_0x3fffe4[_0xe98b('0x3a')]=_[_0xe98b('0x3d')](_0x3fffe4[_0xe98b('0x3a')],{'$or':_['map'](_0x3fffe4[_0xe98b('0x33')],function(_0x463f85){var _0x4c6667={};_0x4c6667[_0x463f85]={'$like':'%'+_0x45a1b6[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x4c6667;})});}_0x3fffe4=_[_0xe98b('0x3d')]({},_0x3fffe4,_0x45a1b6[_0xe98b('0x3f')]);return _0x22b2a7[_0xe98b('0x50')](_0x3fffe4);}})[_0xe98b('0x40')](function(_0x23d80d){if(_0x23d80d){_0x5f2957=_0x23d80d[_0xe98b('0x36')];if(!_0x45a1b6[_0xe98b('0x31')][_0xe98b('0x37')](_0xe98b('0x38'))){_0x3fffe4[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x45a1b6['query'][_0xe98b('0x1e')]);_0x3fffe4[_0xe98b('0x1c')]=qs['offset'](_0x45a1b6[_0xe98b('0x31')]['offset']);}return _0x22b2a7[_0xe98b('0x50')](_0x3fffe4);}})[_0xe98b('0x40')](function(_0x56ed7f){if(_0x56ed7f){return _0x56ed7f?{'count':_0x5f2957,'rows':_0x56ed7f}:null;}})[_0xe98b('0x40')](respondWithResult(_0x34c9c3,null))['catch'](handleError(_0x34c9c3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6034083..95e2389 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 _0xb631=['request-promise','../../config/environment','exports','define','SalesforceConfiguration','lodash','../../config/logger','api','moment','bluebird'];(function(_0x24173d,_0x275d23){var _0x42a9a9=function(_0x4d4ad5){while(--_0x4d4ad5){_0x24173d['push'](_0x24173d['shift']());}};_0x42a9a9(++_0x275d23);}(_0xb631,0x13b));var _0x1b63=function(_0x563827,_0x4e218a){_0x563827=_0x563827-0x0;var _0x1bbde4=_0xb631[_0x563827];return _0x1bbde4;};'use strict';var _=require(_0x1b63('0x0'));var util=require('util');var logger=require(_0x1b63('0x1'))(_0x1b63('0x2'));var moment=require(_0x1b63('0x3'));var BPromise=require(_0x1b63('0x4'));var rp=require(_0x1b63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b63('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1b63('0x7')]=function(_0xcb8048,_0x330c9a){return _0xcb8048[_0x1b63('0x8')](_0x1b63('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa172=['request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','api','bluebird'];(function(_0x448f80,_0x27f0ad){var _0x15b3ae=function(_0x4f8065){while(--_0x4f8065){_0x448f80['push'](_0x448f80['shift']());}};_0x15b3ae(++_0x27f0ad);}(_0xa172,0x129));var _0x2a17=function(_0xc31fc3,_0x44666c){_0xc31fc3=_0xc31fc3-0x0;var _0x16bca7=_0xa172[_0xc31fc3];return _0x16bca7;};'use strict';var _=require(_0x2a17('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a17('0x1'));var moment=require('moment');var BPromise=require(_0x2a17('0x2'));var rp=require(_0x2a17('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a17('0x4'));var attributes=require(_0x2a17('0x5'));module[_0x2a17('0x6')]=function(_0x1c16d9,_0x247926){return _0x1c16d9[_0x2a17('0x7')](_0x2a17('0x8'),attributes,{'tableName':_0x2a17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index e4698f4..c055474 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 _0xd805=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x2d78a4,_0x362f5){var _0x38d29a=function(_0x314265){while(--_0x314265){_0x2d78a4['push'](_0x2d78a4['shift']());}};_0x38d29a(++_0x362f5);}(_0xd805,0xe6));var _0x5d80=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xd805[_0x303c30];return _0x43161b;};'use strict';var _=require('lodash');var util=require(_0x5d80('0x0'));var moment=require(_0x5d80('0x1'));var BPromise=require(_0x5d80('0x2'));var rs=require(_0x5d80('0x3'));var fs=require('fs');var Redis=require(_0x5d80('0x4'));var db=require(_0x5d80('0x5'))['db'];var utils=require(_0x5d80('0x6'));var logger=require('../../config/logger')(_0x5d80('0x7'));var config=require(_0x5d80('0x8'));var jayson=require(_0x5d80('0x9'));var client=jayson['client'][_0x5d80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c5b0b,_0x1eec79,_0x5c97a6){return new BPromise(function(_0x3e5de5,_0x5959da){return client['request'](_0x2c5b0b,_0x5c97a6)[_0x5d80('0xb')](function(_0x309f49){logger[_0x5d80('0xc')](_0x5d80('0xd'),_0x1eec79,_0x5d80('0xe'));logger[_0x5d80('0xf')](_0x5d80('0x10'),_0x1eec79,_0x5d80('0xe'),JSON[_0x5d80('0x11')](_0x309f49));if(_0x309f49[_0x5d80('0x12')]){if(_0x309f49[_0x5d80('0x12')]['code']===0x1f4){logger[_0x5d80('0x12')](_0x5d80('0xd'),_0x1eec79,_0x309f49[_0x5d80('0x12')][_0x5d80('0x13')]);return _0x5959da(_0x309f49[_0x5d80('0x12')][_0x5d80('0x13')]);}logger[_0x5d80('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eec79,_0x309f49[_0x5d80('0x12')]['message']);return _0x3e5de5(_0x309f49[_0x5d80('0x12')][_0x5d80('0x13')]);}else{logger[_0x5d80('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eec79,'request\x20sent');_0x3e5de5(_0x309f49[_0x5d80('0x14')][_0x5d80('0x13')]);}})['catch'](function(_0x4c60ae){logger[_0x5d80('0x12')](_0x5d80('0xd'),_0x1eec79,_0x4c60ae);_0x5959da(_0x4c60ae);});});} \ No newline at end of file +var _0xd8e5=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5ee6d6,_0x28cd9c){var _0x22fc33=function(_0x10ee1d){while(--_0x10ee1d){_0x5ee6d6['push'](_0x5ee6d6['shift']());}};_0x22fc33(++_0x28cd9c);}(_0xd8e5,0x1c1));var _0x5d8e=function(_0x24154b,_0x6c5891){_0x24154b=_0x24154b-0x0;var _0xc1914d=_0xd8e5[_0x24154b];return _0xc1914d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5d8e('0x0'));var rs=require(_0x5d8e('0x1'));var fs=require('fs');var Redis=require(_0x5d8e('0x2'));var db=require(_0x5d8e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d8e('0x4'))(_0x5d8e('0x5'));var config=require(_0x5d8e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5d8e('0x7')][_0x5d8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x178852,_0x1a501c,_0x318d1a){return new BPromise(function(_0x58453e,_0x11a693){return client[_0x5d8e('0x9')](_0x178852,_0x318d1a)[_0x5d8e('0xa')](function(_0x2d16d9){logger[_0x5d8e('0xb')](_0x5d8e('0xc'),_0x1a501c,_0x5d8e('0xd'));logger[_0x5d8e('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1a501c,_0x5d8e('0xd'),JSON[_0x5d8e('0xf')](_0x2d16d9));if(_0x2d16d9[_0x5d8e('0x10')]){if(_0x2d16d9[_0x5d8e('0x10')][_0x5d8e('0x11')]===0x1f4){logger[_0x5d8e('0x10')](_0x5d8e('0xc'),_0x1a501c,_0x2d16d9[_0x5d8e('0x10')][_0x5d8e('0x12')]);return _0x11a693(_0x2d16d9[_0x5d8e('0x10')][_0x5d8e('0x12')]);}logger[_0x5d8e('0x10')](_0x5d8e('0xc'),_0x1a501c,_0x2d16d9['error'][_0x5d8e('0x12')]);return _0x58453e(_0x2d16d9[_0x5d8e('0x10')][_0x5d8e('0x12')]);}else{logger[_0x5d8e('0xb')](_0x5d8e('0xc'),_0x1a501c,_0x5d8e('0xd'));_0x58453e(_0x2d16d9[_0x5d8e('0x13')]['message']);}})['catch'](function(_0x1c5902){logger['error'](_0x5d8e('0xc'),_0x1a501c,_0x1c5902);_0x11a693(_0x1c5902);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 65e0704..d28dd57 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 _0xe1f6=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1f6,0x1c0));var _0x6e1f=function(_0x3ff454,_0x564d83){_0x3ff454=_0x3ff454-0x0;var _0x40f602=_0xe1f6[_0x3ff454];return _0x40f602;};'use strict';var multer=require(_0x6e1f('0x0'));var util=require(_0x6e1f('0x1'));var path=require(_0x6e1f('0x2'));var timeout=require(_0x6e1f('0x3'));var express=require(_0x6e1f('0x4'));var router=express[_0x6e1f('0x5')]();var fs_extra=require(_0x6e1f('0x6'));var auth=require(_0x6e1f('0x7'));var interaction=require(_0x6e1f('0x8'));var config=require(_0x6e1f('0x9'));var controller=require(_0x6e1f('0xa'));router[_0x6e1f('0xb')]('/',auth[_0x6e1f('0xc')](),controller[_0x6e1f('0xd')]);router[_0x6e1f('0xb')](_0x6e1f('0xe'),auth[_0x6e1f('0xc')](),controller[_0x6e1f('0xf')]);router[_0x6e1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6e1f('0x11')]);router['put'](_0x6e1f('0xe'),auth['isAuthenticated'](),controller[_0x6e1f('0x12')]);router[_0x6e1f('0x13')](_0x6e1f('0xe'),auth['isAuthenticated'](),controller[_0x6e1f('0x14')]);module[_0x6e1f('0x15')]=router; \ No newline at end of file +var _0xadb4=['index','/:id','post','create','put','isAuthenticated','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xadb4,0x7b));var _0x4adb=function(_0x5d4464,_0x7825c0){_0x5d4464=_0x5d4464-0x0;var _0x35032b=_0xadb4[_0x5d4464];return _0x35032b;};'use strict';var multer=require(_0x4adb('0x0'));var util=require(_0x4adb('0x1'));var path=require(_0x4adb('0x2'));var timeout=require('connect-timeout');var express=require(_0x4adb('0x3'));var router=express[_0x4adb('0x4')]();var fs_extra=require(_0x4adb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4adb('0x6'));var config=require(_0x4adb('0x7'));var controller=require(_0x4adb('0x8'));router[_0x4adb('0x9')]('/',auth['isAuthenticated'](),controller[_0x4adb('0xa')]);router[_0x4adb('0x9')](_0x4adb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4adb('0xc')]('/',auth['isAuthenticated'](),controller[_0x4adb('0xd')]);router[_0x4adb('0xe')](_0x4adb('0xb'),auth[_0x4adb('0xf')](),controller[_0x4adb('0x10')]);router['delete']('/:id',auth[_0x4adb('0xf')](),controller[_0x4adb('0x11')]);module[_0x4adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c2e27ef..9ebe46a 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 _0xa5f2=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0xa5f2,0xbd));var _0x2a5f=function(_0x3c1463,_0x368f5a){_0x3c1463=_0x3c1463-0x0;var _0x140f4b=_0xa5f2[_0x3c1463];return _0x140f4b;};'use strict';var Sequelize=require(_0x2a5f('0x0'));module[_0x2a5f('0x1')]={'type':{'type':Sequelize[_0x2a5f('0x2')](_0x2a5f('0x3'),'variable',_0x2a5f('0x4'),_0x2a5f('0x5'),_0x2a5f('0x6')),'defaultValue':_0x2a5f('0x3')},'content':{'type':Sequelize[_0x2a5f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a5f('0x2')](_0x2a5f('0x3'),_0x2a5f('0x8'),_0x2a5f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x2a5f('0x7')]}}; \ No newline at end of file +var _0xca63=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca63,0x157));var _0x3ca6=function(_0x468718,_0x55f85c){_0x468718=_0x468718-0x0;var _0x4c41fe=_0xca63[_0x468718];return _0x4c41fe;};'use strict';var Sequelize=require(_0x3ca6('0x0'));module['exports']={'type':{'type':Sequelize[_0x3ca6('0x1')](_0x3ca6('0x2'),_0x3ca6('0x3'),_0x3ca6('0x4'),'keyValue',_0x3ca6('0x5')),'defaultValue':_0x3ca6('0x2')},'content':{'type':Sequelize[_0x3ca6('0x6')]},'key':{'type':Sequelize[_0x3ca6('0x6')]},'keyType':{'type':Sequelize[_0x3ca6('0x1')]('string',_0x3ca6('0x3'),_0x3ca6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3ca6('0x6')]},'variableName':{'type':Sequelize[_0x3ca6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 694f294..d10c98b 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 _0x4000=['../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4000,0x14b));var _0x0400=function(_0x40a954,_0x1e36c4){_0x40a954=_0x40a954-0x0;var _0x341a18=_0x4000[_0x40a954];return _0x341a18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0400('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0400('0x1'));var rp=require(_0x0400('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0400('0x3'));var util=require(_0x0400('0x4'));var path=require('path');var sox=require(_0x0400('0x5'));var csv=require(_0x0400('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0400('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0400('0x8'));var deskjs=require(_0x0400('0x9'));var toCsv=require(_0x0400('0x6'));var querystring=require(_0x0400('0xa'));var Papa=require(_0x0400('0xb'));var Redis=require(_0x0400('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0400('0xd'));var as=require(_0x0400('0xe'));var hardwareService=require(_0x0400('0xf'));var logger=require('../../config/logger')(_0x0400('0x10'));var utils=require(_0x0400('0x11'));var config=require(_0x0400('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0400('0x13'))['db'];function respondWithStatusCode(_0x2fe935,_0x5329a7){_0x5329a7=_0x5329a7||0xcc;return function(_0x29375a){if(_0x29375a){return _0x2fe935['sendStatus'](_0x5329a7);}return _0x2fe935[_0x0400('0x14')](_0x5329a7)['end']();};}function respondWithResult(_0x35d64b,_0x26b100){_0x26b100=_0x26b100||0xc8;return function(_0x2c04f4){if(_0x2c04f4){return _0x35d64b['status'](_0x26b100)[_0x0400('0x15')](_0x2c04f4);}};}function respondWithFilteredResult(_0x1f47c4,_0x53fd7c){return function(_0x2afb76){if(_0x2afb76){var _0x158908=typeof _0x53fd7c[_0x0400('0x16')]===_0x0400('0x17')&&typeof _0x53fd7c[_0x0400('0x18')]===_0x0400('0x17');var _0x4b14ec=_0x2afb76[_0x0400('0x19')];var _0x5bf664=_0x158908?0x0:_0x53fd7c[_0x0400('0x16')];var _0x329eff=_0x158908?_0x2afb76['count']:_0x53fd7c[_0x0400('0x16')]+_0x53fd7c[_0x0400('0x18')];var _0x245af9;if(_0x329eff>=_0x4b14ec){_0x329eff=_0x4b14ec;_0x245af9=0xc8;}else{_0x245af9=0xce;}_0x1f47c4[_0x0400('0x14')](_0x245af9);return _0x1f47c4[_0x0400('0x1a')]('Content-Range',_0x5bf664+'-'+_0x329eff+'/'+_0x4b14ec)[_0x0400('0x15')](_0x2afb76);}return null;};}function patchUpdates(_0xf6588e){return function(_0x546863){try{jsonpatch[_0x0400('0x1b')](_0x546863,_0xf6588e,!![]);}catch(_0x3223fa){return BPromise[_0x0400('0x1c')](_0x3223fa);}return _0x546863[_0x0400('0x1d')]();};}function saveUpdates(_0x17feec,_0x32be43){return function(_0x3775a6){if(_0x3775a6){return _0x3775a6[_0x0400('0x1e')](_0x17feec)['then'](function(_0x2a8301){return _0x2a8301;});}return null;};}function removeEntity(_0x5e2a71,_0x2d81d3){return function(_0x28a0b5){if(_0x28a0b5){return _0x28a0b5[_0x0400('0x1f')]()[_0x0400('0x20')](function(){_0x5e2a71[_0x0400('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4be0,_0x2171ee){return function(_0x3e42af){if(!_0x3e42af){_0x3e4be0[_0x0400('0x21')](0x194);}return _0x3e42af;};}function handleError(_0x38d591,_0x4122d9){_0x4122d9=_0x4122d9||0x1f4;return function(_0x13675b){logger['error'](_0x13675b[_0x0400('0x22')]);if(_0x13675b[_0x0400('0x23')]){delete _0x13675b[_0x0400('0x23')];}_0x38d591['status'](_0x4122d9)['send'](_0x13675b);};}exports[_0x0400('0x24')]=function(_0x2c728e,_0x53e13d){var _0x46d384={},_0x26c534={},_0x17471e={'count':0x0,'rows':[]};var _0x33c18b=_[_0x0400('0x25')](db[_0x0400('0x26')][_0x0400('0x27')],function(_0x593bf6){return{'name':_0x593bf6[_0x0400('0x28')],'type':_0x593bf6[_0x0400('0x29')][_0x0400('0x2a')]};});_0x26c534[_0x0400('0x2b')]=_['map'](_0x33c18b,_0x0400('0x23'));_0x26c534[_0x0400('0x2c')]=_[_0x0400('0x2d')](_0x2c728e[_0x0400('0x2c')]);_0x26c534[_0x0400('0x2e')]=_[_0x0400('0x2f')](_0x26c534['model'],_0x26c534[_0x0400('0x2c')]);_0x46d384[_0x0400('0x30')]=_[_0x0400('0x2f')](_0x26c534[_0x0400('0x2b')],qs[_0x0400('0x31')](_0x2c728e[_0x0400('0x2c')][_0x0400('0x31')]));_0x46d384[_0x0400('0x30')]=_0x46d384[_0x0400('0x30')][_0x0400('0x32')]?_0x46d384[_0x0400('0x30')]:_0x26c534[_0x0400('0x2b')];if(!_0x2c728e['query'][_0x0400('0x33')](_0x0400('0x34'))){_0x46d384[_0x0400('0x18')]=qs['limit'](_0x2c728e[_0x0400('0x2c')][_0x0400('0x18')]);_0x46d384[_0x0400('0x16')]=qs[_0x0400('0x16')](_0x2c728e[_0x0400('0x2c')][_0x0400('0x16')]);}_0x46d384[_0x0400('0x35')]=qs[_0x0400('0x36')](_0x2c728e[_0x0400('0x2c')][_0x0400('0x36')]);_0x46d384[_0x0400('0x37')]=qs[_0x0400('0x2e')](_[_0x0400('0x38')](_0x2c728e['query'],_0x26c534[_0x0400('0x2e')]),_0x33c18b);if(_0x2c728e[_0x0400('0x2c')][_0x0400('0x39')]){_0x46d384[_0x0400('0x37')]=_[_0x0400('0x3a')](_0x46d384['where'],{'$or':_[_0x0400('0x25')](_0x33c18b,function(_0x402e48){if(_0x402e48[_0x0400('0x29')]!==_0x0400('0x3b')){var _0x1832b3={};_0x1832b3[_0x402e48[_0x0400('0x23')]]={'$like':'%'+_0x2c728e[_0x0400('0x2c')][_0x0400('0x39')]+'%'};return _0x1832b3;}})});}_0x46d384=_[_0x0400('0x3a')]({},_0x46d384,_0x2c728e[_0x0400('0x3c')]);var _0x545900={'where':_0x46d384[_0x0400('0x37')]};return db[_0x0400('0x26')][_0x0400('0x19')](_0x545900)[_0x0400('0x20')](function(_0x5d84b6){_0x17471e[_0x0400('0x19')]=_0x5d84b6;if(_0x2c728e['query'][_0x0400('0x3d')]){_0x46d384[_0x0400('0x3e')]=[{'all':!![]}];}return db[_0x0400('0x26')][_0x0400('0x3f')](_0x46d384);})['then'](function(_0x304402){_0x17471e[_0x0400('0x40')]=_0x304402;return _0x17471e;})['then'](respondWithFilteredResult(_0x53e13d,_0x46d384))[_0x0400('0x41')](handleError(_0x53e13d,null));};exports['show']=function(_0x427628,_0x16288c){var _0xf2d6d7={'raw':!![],'where':{'id':_0x427628['params']['id']}},_0xe3927b={};_0xe3927b['model']=_[_0x0400('0x2d')](db[_0x0400('0x26')][_0x0400('0x27')]);_0xe3927b['query']=_['keys'](_0x427628['query']);_0xe3927b['filters']=_['intersection'](_0xe3927b[_0x0400('0x2b')],_0xe3927b[_0x0400('0x2c')]);_0xf2d6d7[_0x0400('0x30')]=_[_0x0400('0x2f')](_0xe3927b[_0x0400('0x2b')],qs['fields'](_0x427628[_0x0400('0x2c')][_0x0400('0x31')]));_0xf2d6d7[_0x0400('0x30')]=_0xf2d6d7[_0x0400('0x30')][_0x0400('0x32')]?_0xf2d6d7['attributes']:_0xe3927b[_0x0400('0x2b')];if(_0x427628[_0x0400('0x2c')][_0x0400('0x3d')]){_0xf2d6d7[_0x0400('0x3e')]=[{'all':!![]}];}_0xf2d6d7=_[_0x0400('0x3a')]({},_0xf2d6d7,_0x427628[_0x0400('0x3c')]);return db[_0x0400('0x26')][_0x0400('0x42')](_0xf2d6d7)[_0x0400('0x20')](handleEntityNotFound(_0x16288c,null))['then'](respondWithResult(_0x16288c,null))[_0x0400('0x41')](handleError(_0x16288c,null));};exports[_0x0400('0x43')]=function(_0xd4a275,_0x2d373c){return db[_0x0400('0x26')][_0x0400('0x43')](_0xd4a275[_0x0400('0x44')],{})[_0x0400('0x20')](respondWithResult(_0x2d373c,0xc9))[_0x0400('0x41')](handleError(_0x2d373c,null));};exports['update']=function(_0x18cf99,_0xc6388f){if(_0x18cf99[_0x0400('0x44')]['id']){delete _0x18cf99[_0x0400('0x44')]['id'];}return db[_0x0400('0x26')][_0x0400('0x42')]({'where':{'id':_0x18cf99['params']['id']}})[_0x0400('0x20')](handleEntityNotFound(_0xc6388f,null))['then'](saveUpdates(_0x18cf99['body'],null))[_0x0400('0x20')](respondWithResult(_0xc6388f,null))[_0x0400('0x41')](handleError(_0xc6388f,null));};exports[_0x0400('0x1f')]=function(_0x30333a,_0x1889ad){return db[_0x0400('0x26')]['find']({'where':{'id':_0x30333a[_0x0400('0x45')]['id']}})['then'](handleEntityNotFound(_0x1889ad,null))['then'](removeEntity(_0x1889ad,null))[_0x0400('0x41')](handleError(_0x1889ad,null));}; \ No newline at end of file +var _0x2371=['../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','set','json','apply','reject','save','update','destroy','then','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','include','catch','show','params','keys','filters','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2371,0x1e1));var _0x1237=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x2371[_0x491faa];return _0x414440;};'use strict';var emlformat=require(_0x1237('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1237('0x1'));var jsonpatch=require(_0x1237('0x2'));var rp=require(_0x1237('0x3'));var moment=require(_0x1237('0x4'));var BPromise=require(_0x1237('0x5'));var Mustache=require(_0x1237('0x6'));var util=require(_0x1237('0x7'));var path=require(_0x1237('0x8'));var sox=require(_0x1237('0x9'));var csv=require(_0x1237('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1237('0xb'));var squel=require(_0x1237('0xc'));var crypto=require(_0x1237('0xd'));var jsforce=require(_0x1237('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1237('0xf'));var Papa=require(_0x1237('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1237('0x11'));var hardwareService=require(_0x1237('0x12'));var logger=require(_0x1237('0x13'))(_0x1237('0x14'));var utils=require(_0x1237('0x15'));var config=require(_0x1237('0x16'));var licenseUtil=require(_0x1237('0x17'));var db=require(_0x1237('0x18'))['db'];function respondWithStatusCode(_0x3e4783,_0x573152){_0x573152=_0x573152||0xcc;return function(_0x57ddac){if(_0x57ddac){return _0x3e4783[_0x1237('0x19')](_0x573152);}return _0x3e4783['status'](_0x573152)[_0x1237('0x1a')]();};}function respondWithResult(_0x330afd,_0x2120c9){_0x2120c9=_0x2120c9||0xc8;return function(_0x30d015){if(_0x30d015){return _0x330afd[_0x1237('0x1b')](_0x2120c9)['json'](_0x30d015);}};}function respondWithFilteredResult(_0x317796,_0x15491f){return function(_0x12fb3d){if(_0x12fb3d){var _0x13cd12=typeof _0x15491f['offset']==='undefined'&&typeof _0x15491f[_0x1237('0x1c')]==='undefined';var _0x72b5a6=_0x12fb3d[_0x1237('0x1d')];var _0x3d6873=_0x13cd12?0x0:_0x15491f[_0x1237('0x1e')];var _0xb1aec8=_0x13cd12?_0x12fb3d[_0x1237('0x1d')]:_0x15491f[_0x1237('0x1e')]+_0x15491f[_0x1237('0x1c')];var _0x2b9037;if(_0xb1aec8>=_0x72b5a6){_0xb1aec8=_0x72b5a6;_0x2b9037=0xc8;}else{_0x2b9037=0xce;}_0x317796[_0x1237('0x1b')](_0x2b9037);return _0x317796[_0x1237('0x1f')]('Content-Range',_0x3d6873+'-'+_0xb1aec8+'/'+_0x72b5a6)[_0x1237('0x20')](_0x12fb3d);}return null;};}function patchUpdates(_0x2b3566){return function(_0x2994b5){try{jsonpatch[_0x1237('0x21')](_0x2994b5,_0x2b3566,!![]);}catch(_0x212fdf){return BPromise[_0x1237('0x22')](_0x212fdf);}return _0x2994b5[_0x1237('0x23')]();};}function saveUpdates(_0x347eec,_0x5f34c5){return function(_0x29dbc2){if(_0x29dbc2){return _0x29dbc2[_0x1237('0x24')](_0x347eec)['then'](function(_0x5ee892){return _0x5ee892;});}return null;};}function removeEntity(_0x14b85b,_0x397299){return function(_0x5d8f04){if(_0x5d8f04){return _0x5d8f04[_0x1237('0x25')]()[_0x1237('0x26')](function(){_0x14b85b[_0x1237('0x1b')](0xcc)[_0x1237('0x1a')]();});}};}function handleEntityNotFound(_0x3bdbf1,_0x2bbcaa){return function(_0x40ba1b){if(!_0x40ba1b){_0x3bdbf1[_0x1237('0x19')](0x194);}return _0x40ba1b;};}function handleError(_0x55c954,_0x33d295){_0x33d295=_0x33d295||0x1f4;return function(_0x105449){logger[_0x1237('0x27')](_0x105449['stack']);if(_0x105449[_0x1237('0x28')]){delete _0x105449[_0x1237('0x28')];}_0x55c954['status'](_0x33d295)[_0x1237('0x29')](_0x105449);};}exports[_0x1237('0x2a')]=function(_0x253060,_0x186e82){var _0x1dec0b={},_0x282a1a={},_0xf1b68d={'count':0x0,'rows':[]};var _0x5f44c8=_[_0x1237('0x2b')](db[_0x1237('0x2c')][_0x1237('0x2d')],function(_0x124365){return{'name':_0x124365[_0x1237('0x2e')],'type':_0x124365[_0x1237('0x2f')][_0x1237('0x30')]};});_0x282a1a[_0x1237('0x31')]=_[_0x1237('0x2b')](_0x5f44c8,_0x1237('0x28'));_0x282a1a[_0x1237('0x32')]=_['keys'](_0x253060[_0x1237('0x32')]);_0x282a1a['filters']=_[_0x1237('0x33')](_0x282a1a[_0x1237('0x31')],_0x282a1a[_0x1237('0x32')]);_0x1dec0b[_0x1237('0x34')]=_[_0x1237('0x33')](_0x282a1a[_0x1237('0x31')],qs[_0x1237('0x35')](_0x253060[_0x1237('0x32')]['fields']));_0x1dec0b[_0x1237('0x34')]=_0x1dec0b[_0x1237('0x34')][_0x1237('0x36')]?_0x1dec0b[_0x1237('0x34')]:_0x282a1a['model'];if(!_0x253060[_0x1237('0x32')][_0x1237('0x37')]('nolimit')){_0x1dec0b[_0x1237('0x1c')]=qs[_0x1237('0x1c')](_0x253060[_0x1237('0x32')][_0x1237('0x1c')]);_0x1dec0b[_0x1237('0x1e')]=qs[_0x1237('0x1e')](_0x253060['query'][_0x1237('0x1e')]);}_0x1dec0b[_0x1237('0x38')]=qs[_0x1237('0x39')](_0x253060[_0x1237('0x32')][_0x1237('0x39')]);_0x1dec0b['where']=qs['filters'](_[_0x1237('0x3a')](_0x253060[_0x1237('0x32')],_0x282a1a['filters']),_0x5f44c8);if(_0x253060[_0x1237('0x32')][_0x1237('0x3b')]){_0x1dec0b['where']=_[_0x1237('0x3c')](_0x1dec0b[_0x1237('0x3d')],{'$or':_[_0x1237('0x2b')](_0x5f44c8,function(_0x4eb055){if(_0x4eb055[_0x1237('0x2f')]!=='VIRTUAL'){var _0xf7e5c8={};_0xf7e5c8[_0x4eb055[_0x1237('0x28')]]={'$like':'%'+_0x253060[_0x1237('0x32')][_0x1237('0x3b')]+'%'};return _0xf7e5c8;}})});}_0x1dec0b=_[_0x1237('0x3c')]({},_0x1dec0b,_0x253060[_0x1237('0x3e')]);var _0x57cc27={'where':_0x1dec0b[_0x1237('0x3d')]};return db['SalesforceField'][_0x1237('0x1d')](_0x57cc27)[_0x1237('0x26')](function(_0x27c2a4){_0xf1b68d['count']=_0x27c2a4;if(_0x253060[_0x1237('0x32')][_0x1237('0x3f')]){_0x1dec0b[_0x1237('0x40')]=[{'all':!![]}];}return db[_0x1237('0x2c')]['findAll'](_0x1dec0b);})[_0x1237('0x26')](function(_0x5a01d6){_0xf1b68d['rows']=_0x5a01d6;return _0xf1b68d;})[_0x1237('0x26')](respondWithFilteredResult(_0x186e82,_0x1dec0b))[_0x1237('0x41')](handleError(_0x186e82,null));};exports[_0x1237('0x42')]=function(_0x40fef3,_0xd97e34){var _0x2a3fbd={'raw':!![],'where':{'id':_0x40fef3[_0x1237('0x43')]['id']}},_0x34c7d9={};_0x34c7d9['model']=_[_0x1237('0x44')](db[_0x1237('0x2c')][_0x1237('0x2d')]);_0x34c7d9[_0x1237('0x32')]=_[_0x1237('0x44')](_0x40fef3[_0x1237('0x32')]);_0x34c7d9[_0x1237('0x45')]=_['intersection'](_0x34c7d9['model'],_0x34c7d9[_0x1237('0x32')]);_0x2a3fbd[_0x1237('0x34')]=_[_0x1237('0x33')](_0x34c7d9['model'],qs['fields'](_0x40fef3['query'][_0x1237('0x35')]));_0x2a3fbd[_0x1237('0x34')]=_0x2a3fbd[_0x1237('0x34')][_0x1237('0x36')]?_0x2a3fbd[_0x1237('0x34')]:_0x34c7d9[_0x1237('0x31')];if(_0x40fef3[_0x1237('0x32')]['includeAll']){_0x2a3fbd[_0x1237('0x40')]=[{'all':!![]}];}_0x2a3fbd=_[_0x1237('0x3c')]({},_0x2a3fbd,_0x40fef3[_0x1237('0x3e')]);return db[_0x1237('0x2c')]['find'](_0x2a3fbd)['then'](handleEntityNotFound(_0xd97e34,null))[_0x1237('0x26')](respondWithResult(_0xd97e34,null))[_0x1237('0x41')](handleError(_0xd97e34,null));};exports['create']=function(_0x4c7527,_0x3b1db3){return db['SalesforceField'][_0x1237('0x46')](_0x4c7527['body'],{})[_0x1237('0x26')](respondWithResult(_0x3b1db3,0xc9))['catch'](handleError(_0x3b1db3,null));};exports[_0x1237('0x24')]=function(_0x169480,_0x305ed7){if(_0x169480[_0x1237('0x47')]['id']){delete _0x169480[_0x1237('0x47')]['id'];}return db[_0x1237('0x2c')]['find']({'where':{'id':_0x169480[_0x1237('0x43')]['id']}})['then'](handleEntityNotFound(_0x305ed7,null))[_0x1237('0x26')](saveUpdates(_0x169480[_0x1237('0x47')],null))['then'](respondWithResult(_0x305ed7,null))[_0x1237('0x41')](handleError(_0x305ed7,null));};exports['destroy']=function(_0xe30bf2,_0x4dbdb5){return db[_0x1237('0x2c')]['find']({'where':{'id':_0xe30bf2['params']['id']}})['then'](handleEntityNotFound(_0x4dbdb5,null))[_0x1237('0x26')](removeEntity(_0x4dbdb5,null))[_0x1237('0x41')](handleError(_0x4dbdb5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 128435d..eb1ec54 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 _0x3e88=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e88,0xed));var _0x83e8=function(_0x200a9c,_0x133ada){_0x200a9c=_0x200a9c-0x0;var _0x8224dd=_0x3e88[_0x200a9c];return _0x8224dd;};'use strict';var _=require(_0x83e8('0x0'));var util=require('util');var logger=require(_0x83e8('0x1'))(_0x83e8('0x2'));var moment=require(_0x83e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x83e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83e8('0x5'));var config=require(_0x83e8('0x6'));var attributes=require(_0x83e8('0x7'));module['exports']=function(_0x418e63,_0x359ba9){return _0x418e63['define'](_0x83e8('0x8'),attributes,{'tableName':_0x83e8('0x9'),'paranoid':![],'indexes':[{'name':_0x83e8('0xa'),'fields':[_0x83e8('0xb'),_0x83e8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x334b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x40f310,_0x1f0cdd){var _0x3f58c7=function(_0x5d360f){while(--_0x5d360f){_0x40f310['push'](_0x40f310['shift']());}};_0x3f58c7(++_0x1f0cdd);}(_0x334b,0x156));var _0xb334=function(_0x31a1a4,_0x4ac6eb){_0x31a1a4=_0x31a1a4-0x0;var _0x1e55df=_0x334b[_0x31a1a4];return _0x1e55df;};'use strict';var _=require(_0xb334('0x0'));var util=require(_0xb334('0x1'));var logger=require(_0xb334('0x2'))('api');var moment=require(_0xb334('0x3'));var BPromise=require(_0xb334('0x4'));var rp=require(_0xb334('0x5'));var fs=require('fs');var path=require(_0xb334('0x6'));var rimraf=require(_0xb334('0x7'));var config=require(_0xb334('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xb334('0x9')]=function(_0x101a12,_0x32448d){return _0x101a12[_0xb334('0xa')](_0xb334('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xb334('0xc'),'fields':[_0xb334('0xd'),_0xb334('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d205e0c..6566630 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 _0x21ee=['request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21ee,0x145));var _0xe21e=function(_0x59091c,_0x5ba7a4){_0x59091c=_0x59091c-0x0;var _0x2b6f38=_0x21ee[_0x59091c];return _0x2b6f38;};'use strict';var _=require(_0xe21e('0x0'));var util=require(_0xe21e('0x1'));var moment=require(_0xe21e('0x2'));var BPromise=require(_0xe21e('0x3'));var rs=require(_0xe21e('0x4'));var fs=require('fs');var Redis=require(_0xe21e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe21e('0x6'));var logger=require(_0xe21e('0x7'))(_0xe21e('0x8'));var config=require(_0xe21e('0x9'));var jayson=require(_0xe21e('0xa'));var client=jayson[_0xe21e('0xb')][_0xe21e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3daa8c,_0xa03e45,_0x1e7755){return new BPromise(function(_0x215f92,_0x480329){return client[_0xe21e('0xd')](_0x3daa8c,_0x1e7755)[_0xe21e('0xe')](function(_0x723b1b){logger[_0xe21e('0xf')](_0xe21e('0x10'),_0xa03e45,_0xe21e('0x11'));logger[_0xe21e('0x12')](_0xe21e('0x13'),_0xa03e45,'request\x20sent',JSON[_0xe21e('0x14')](_0x723b1b));if(_0x723b1b[_0xe21e('0x15')]){if(_0x723b1b[_0xe21e('0x15')][_0xe21e('0x16')]===0x1f4){logger[_0xe21e('0x15')](_0xe21e('0x10'),_0xa03e45,_0x723b1b[_0xe21e('0x15')]['message']);return _0x480329(_0x723b1b[_0xe21e('0x15')][_0xe21e('0x17')]);}logger[_0xe21e('0x15')](_0xe21e('0x10'),_0xa03e45,_0x723b1b[_0xe21e('0x15')][_0xe21e('0x17')]);return _0x215f92(_0x723b1b[_0xe21e('0x15')][_0xe21e('0x17')]);}else{logger[_0xe21e('0xf')](_0xe21e('0x10'),_0xa03e45,_0xe21e('0x11'));_0x215f92(_0x723b1b[_0xe21e('0x18')][_0xe21e('0x17')]);}})[_0xe21e('0x19')](function(_0x29e633){logger['error'](_0xe21e('0x10'),_0xa03e45,_0x29e633);_0x480329(_0x29e633);});});} \ No newline at end of file +var _0xce21=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0xff6f91,_0x2dacd2){var _0x1c7f2b=function(_0x7c3462){while(--_0x7c3462){_0xff6f91['push'](_0xff6f91['shift']());}};_0x1c7f2b(++_0x2dacd2);}(_0xce21,0x11d));var _0x1ce2=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xce21[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x1ce2('0x0'));var util=require(_0x1ce2('0x1'));var moment=require(_0x1ce2('0x2'));var BPromise=require(_0x1ce2('0x3'));var rs=require(_0x1ce2('0x4'));var fs=require('fs');var Redis=require(_0x1ce2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ce2('0x6'));var logger=require(_0x1ce2('0x7'))(_0x1ce2('0x8'));var config=require(_0x1ce2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ce2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5ba0,_0x320216,_0x157ab7){return new BPromise(function(_0x249ee1,_0xa27386){return client[_0x1ce2('0xb')](_0x3d5ba0,_0x157ab7)[_0x1ce2('0xc')](function(_0xd3aa3f){logger[_0x1ce2('0xd')]('SalesforceField,\x20%s,\x20%s',_0x320216,_0x1ce2('0xe'));logger[_0x1ce2('0xf')](_0x1ce2('0x10'),_0x320216,_0x1ce2('0xe'),JSON[_0x1ce2('0x11')](_0xd3aa3f));if(_0xd3aa3f[_0x1ce2('0x12')]){if(_0xd3aa3f[_0x1ce2('0x12')][_0x1ce2('0x13')]===0x1f4){logger['error'](_0x1ce2('0x14'),_0x320216,_0xd3aa3f[_0x1ce2('0x12')][_0x1ce2('0x15')]);return _0xa27386(_0xd3aa3f[_0x1ce2('0x12')][_0x1ce2('0x15')]);}logger[_0x1ce2('0x12')]('SalesforceField,\x20%s,\x20%s',_0x320216,_0xd3aa3f[_0x1ce2('0x12')][_0x1ce2('0x15')]);return _0x249ee1(_0xd3aa3f[_0x1ce2('0x12')]['message']);}else{logger[_0x1ce2('0xd')](_0x1ce2('0x14'),_0x320216,_0x1ce2('0xe'));_0x249ee1(_0xd3aa3f[_0x1ce2('0x16')]['message']);}})[_0x1ce2('0x17')](function(_0x382dff){logger['error'](_0x1ce2('0x14'),_0x320216,_0x382dff);_0xa27386(_0x382dff);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a5a8a83..5795b24 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 _0xc560=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x55eebd,_0xa5e352){var _0x57f660=function(_0x89b569){while(--_0x89b569){_0x55eebd['push'](_0x55eebd['shift']());}};_0x57f660(++_0xa5e352);}(_0xc560,0x82));var _0x0c56=function(_0x4316e7,_0x1606f0){_0x4316e7=_0x4316e7-0x0;var _0x44987c=_0xc560[_0x4316e7];return _0x44987c;};'use strict';var multer=require(_0x0c56('0x0'));var util=require('util');var path=require(_0x0c56('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c56('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0c56('0x3'));var interaction=require(_0x0c56('0x4'));var config=require(_0x0c56('0x5'));var controller=require(_0x0c56('0x6'));router['get']('/',auth[_0x0c56('0x7')](),controller[_0x0c56('0x8')]);router[_0x0c56('0x9')](_0x0c56('0xa'),auth['isAuthenticated'](),controller[_0x0c56('0xb')]);router['get'](_0x0c56('0xc'),auth[_0x0c56('0x7')](),controller[_0x0c56('0xd')]);router['get'](_0x0c56('0xe'),auth[_0x0c56('0x7')](),controller[_0x0c56('0xf')]);router['post']('/',auth[_0x0c56('0x7')](),controller[_0x0c56('0x10')]);router[_0x0c56('0x11')](_0x0c56('0xc'),auth[_0x0c56('0x7')](),controller[_0x0c56('0x12')]);router[_0x0c56('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0c56('0x14')]);router[_0x0c56('0x15')](_0x0c56('0xa'),auth[_0x0c56('0x7')](),controller[_0x0c56('0x16')]);module[_0x0c56('0x17')]=router; \ No newline at end of file +var _0x4c06=['create','addConfiguration','put','/:id','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4c06,0x9a));var _0x64c0=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x4c06[_0x43aee5];return _0x76d1d0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x64c0('0x0'));var express=require(_0x64c0('0x1'));var router=express[_0x64c0('0x2')]();var fs_extra=require(_0x64c0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x64c0('0x4'));var config=require(_0x64c0('0x5'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x64c0('0x6')](),controller[_0x64c0('0x7')]);router[_0x64c0('0x8')]('/:id',auth[_0x64c0('0x6')](),controller[_0x64c0('0x9')]);router['get'](_0x64c0('0xa'),auth[_0x64c0('0x6')](),controller[_0x64c0('0xb')]);router['get']('/:id/fields',auth[_0x64c0('0x6')](),controller[_0x64c0('0xc')]);router[_0x64c0('0xd')]('/',auth[_0x64c0('0x6')](),controller[_0x64c0('0xe')]);router[_0x64c0('0xd')](_0x64c0('0xa'),auth[_0x64c0('0x6')](),controller[_0x64c0('0xf')]);router[_0x64c0('0x10')](_0x64c0('0x11'),auth[_0x64c0('0x6')](),controller[_0x64c0('0x12')]);router[_0x64c0('0x13')](_0x64c0('0x11'),auth[_0x64c0('0x6')](),controller['destroy']);module[_0x64c0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1227cca..32689e0 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 _0x1fa0=['exports','STRING','remoteUri','sequelize'];(function(_0x7f70ec,_0x82eb8b){var _0x397ff9=function(_0x51edf4){while(--_0x51edf4){_0x7f70ec['push'](_0x7f70ec['shift']());}};_0x397ff9(++_0x82eb8b);}(_0x1fa0,0x1bf));var _0x01fa=function(_0x2e10df,_0x20494d){_0x2e10df=_0x2e10df-0x0;var _0x200d43=_0x1fa0[_0x2e10df];return _0x200d43;};'use strict';var Sequelize=require(_0x01fa('0x0'));module[_0x01fa('0x1')]={'name':{'type':Sequelize[_0x01fa('0x2')]},'description':{'type':Sequelize[_0x01fa('0x2')]},'username':{'type':Sequelize[_0x01fa('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x01fa('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x01fa('0x2')],'unique':_0x01fa('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x97f4=['sequelize','exports','STRING','remoteUri'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x97f4,0xc0));var _0x497f=function(_0xd91485,_0x4c7758){_0xd91485=_0xd91485-0x0;var _0x200206=_0x97f4[_0xd91485];return _0x200206;};'use strict';var Sequelize=require(_0x497f('0x0'));module[_0x497f('0x1')]={'name':{'type':Sequelize[_0x497f('0x2')]},'description':{'type':Sequelize[_0x497f('0x2')]},'username':{'type':Sequelize[_0x497f('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x497f('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x497f('0x3')},'serverUrl':{'type':Sequelize[_0x497f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b071a31..94f3730 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 _0xcb00=['index','map','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','include','ServicenowAccount','catch','show','params','includeAll','find','create','body','update','getConfigurations','findOne','pick','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','made_sla','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','result','log','incident\x20table\x20objects','assign','includes','internalType','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','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','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0xf60cd0,_0x34bf81){var _0x32ad56=function(_0x44cf0b){while(--_0x44cf0b){_0xf60cd0['push'](_0xf60cd0['shift']());}};_0x32ad56(++_0x34bf81);}(_0xcb00,0x159));var _0x0cb0=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xcb00[_0x334599];return _0x4cdff2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0cb0('0x0'));var rp=require('request-promise');var moment=require(_0x0cb0('0x1'));var BPromise=require(_0x0cb0('0x2'));var Mustache=require(_0x0cb0('0x3'));var util=require(_0x0cb0('0x4'));var path=require(_0x0cb0('0x5'));var sox=require(_0x0cb0('0x6'));var csv=require(_0x0cb0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cb0('0x8'));var _=require(_0x0cb0('0x9'));var squel=require('squel');var crypto=require(_0x0cb0('0xa'));var jsforce=require(_0x0cb0('0xb'));var deskjs=require(_0x0cb0('0xc'));var toCsv=require(_0x0cb0('0x7'));var querystring=require(_0x0cb0('0xd'));var Papa=require('papaparse');var Redis=require(_0x0cb0('0xe'));var authService=require(_0x0cb0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0cb0('0x10'));var hardwareService=require(_0x0cb0('0x11'));var logger=require(_0x0cb0('0x12'))(_0x0cb0('0x13'));var utils=require(_0x0cb0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0cb0('0x15'));var db=require(_0x0cb0('0x16'))['db'];var integrations=require(_0x0cb0('0x17'));function respondWithStatusCode(_0x288611,_0x18ba18){_0x18ba18=_0x18ba18||0xcc;return function(_0x198036){if(_0x198036){return _0x288611[_0x0cb0('0x18')](_0x18ba18);}return _0x288611[_0x0cb0('0x19')](_0x18ba18)[_0x0cb0('0x1a')]();};}function respondWithResult(_0x27b262,_0x524c7d){_0x524c7d=_0x524c7d||0xc8;return function(_0x2da450){if(_0x2da450){return _0x27b262[_0x0cb0('0x19')](_0x524c7d)[_0x0cb0('0x1b')](_0x2da450);}};}function respondWithFilteredResult(_0x47d5ac,_0x39ac97){return function(_0x154491){if(_0x154491){var _0x511867=typeof _0x39ac97[_0x0cb0('0x1c')]===_0x0cb0('0x1d')&&typeof _0x39ac97['limit']===_0x0cb0('0x1d');var _0x418a36=_0x154491['count'];var _0x30fe61=_0x511867?0x0:_0x39ac97[_0x0cb0('0x1c')];var _0x4201ad=_0x511867?_0x154491['count']:_0x39ac97[_0x0cb0('0x1c')]+_0x39ac97[_0x0cb0('0x1e')];var _0x315f5a;if(_0x4201ad>=_0x418a36){_0x4201ad=_0x418a36;_0x315f5a=0xc8;}else{_0x315f5a=0xce;}_0x47d5ac[_0x0cb0('0x19')](_0x315f5a);return _0x47d5ac[_0x0cb0('0x1f')]('Content-Range',_0x30fe61+'-'+_0x4201ad+'/'+_0x418a36)[_0x0cb0('0x1b')](_0x154491);}return null;};}function patchUpdates(_0xdfca97){return function(_0x5da917){try{jsonpatch[_0x0cb0('0x20')](_0x5da917,_0xdfca97,!![]);}catch(_0x273dd8){return BPromise[_0x0cb0('0x21')](_0x273dd8);}return _0x5da917[_0x0cb0('0x22')]();};}function saveUpdates(_0x5702a3,_0x4a5d68){return function(_0x2ecfba){if(_0x2ecfba){return _0x2ecfba['update'](_0x5702a3)[_0x0cb0('0x23')](function(_0x1af56b){return _0x1af56b;});}return null;};}function removeEntity(_0x57c7cd,_0xc05ee8){return function(_0x53a526){if(_0x53a526){return _0x53a526[_0x0cb0('0x24')]()[_0x0cb0('0x23')](function(){_0x57c7cd[_0x0cb0('0x19')](0xcc)[_0x0cb0('0x1a')]();});}};}function handleEntityNotFound(_0x141d00,_0x2a862f){return function(_0x4378ae){if(!_0x4378ae){_0x141d00['sendStatus'](0x194);}return _0x4378ae;};}function handleError(_0x29f4e3,_0xcefafb){_0xcefafb=_0xcefafb||0x1f4;return function(_0x55a6b3){logger[_0x0cb0('0x25')](_0x55a6b3[_0x0cb0('0x26')]);if(_0x55a6b3[_0x0cb0('0x27')]){delete _0x55a6b3[_0x0cb0('0x27')];}_0x29f4e3[_0x0cb0('0x19')](_0xcefafb)[_0x0cb0('0x28')](_0x55a6b3);};}exports[_0x0cb0('0x29')]=function(_0x4d141b,_0x169d46){var _0x3ea6cc={},_0x340667={},_0x3cd520={'count':0x0,'rows':[]};var _0x53c651=_[_0x0cb0('0x2a')](db['ServicenowAccount']['rawAttributes'],function(_0x3674f6){return{'name':_0x3674f6[_0x0cb0('0x2b')],'type':_0x3674f6['type']['key']};});_0x340667[_0x0cb0('0x2c')]=_[_0x0cb0('0x2a')](_0x53c651,_0x0cb0('0x27'));_0x340667[_0x0cb0('0x2d')]=_[_0x0cb0('0x2e')](_0x4d141b[_0x0cb0('0x2d')]);_0x340667['filters']=_[_0x0cb0('0x2f')](_0x340667['model'],_0x340667[_0x0cb0('0x2d')]);_0x3ea6cc[_0x0cb0('0x30')]=_['intersection'](_0x340667['model'],qs[_0x0cb0('0x31')](_0x4d141b[_0x0cb0('0x2d')]['fields']));_0x3ea6cc[_0x0cb0('0x30')]=_0x3ea6cc[_0x0cb0('0x30')][_0x0cb0('0x32')]?_0x3ea6cc[_0x0cb0('0x30')]:_0x340667[_0x0cb0('0x2c')];if(!_0x4d141b['query'][_0x0cb0('0x33')]('nolimit')){_0x3ea6cc['limit']=qs[_0x0cb0('0x1e')](_0x4d141b[_0x0cb0('0x2d')][_0x0cb0('0x1e')]);_0x3ea6cc[_0x0cb0('0x1c')]=qs[_0x0cb0('0x1c')](_0x4d141b['query'][_0x0cb0('0x1c')]);}_0x3ea6cc[_0x0cb0('0x34')]=qs[_0x0cb0('0x35')](_0x4d141b[_0x0cb0('0x2d')]['sort']);_0x3ea6cc[_0x0cb0('0x36')]=qs[_0x0cb0('0x37')](_['pick'](_0x4d141b[_0x0cb0('0x2d')],_0x340667['filters']),_0x53c651);if(_0x4d141b[_0x0cb0('0x2d')][_0x0cb0('0x38')]){_0x3ea6cc[_0x0cb0('0x36')]=_[_0x0cb0('0x39')](_0x3ea6cc[_0x0cb0('0x36')],{'$or':_[_0x0cb0('0x2a')](_0x53c651,function(_0x585a43){if(_0x585a43[_0x0cb0('0x3a')]!==_0x0cb0('0x3b')){var _0x55293d={};_0x55293d[_0x585a43[_0x0cb0('0x27')]]={'$like':'%'+_0x4d141b[_0x0cb0('0x2d')]['filter']+'%'};return _0x55293d;}})});}_0x3ea6cc=_['merge']({},_0x3ea6cc,_0x4d141b[_0x0cb0('0x3c')]);var _0x23869b={'where':_0x3ea6cc[_0x0cb0('0x36')]};return db['ServicenowAccount'][_0x0cb0('0x3d')](_0x23869b)['then'](function(_0x1f2266){_0x3cd520['count']=_0x1f2266;if(_0x4d141b[_0x0cb0('0x2d')]['includeAll']){_0x3ea6cc[_0x0cb0('0x3e')]=[{'all':!![]}];}return db[_0x0cb0('0x3f')]['findAll'](_0x3ea6cc);})[_0x0cb0('0x23')](function(_0x485062){_0x3cd520['rows']=_0x485062;return _0x3cd520;})[_0x0cb0('0x23')](respondWithFilteredResult(_0x169d46,_0x3ea6cc))[_0x0cb0('0x40')](handleError(_0x169d46,null));};exports[_0x0cb0('0x41')]=function(_0x4cd6c9,_0x1df959){var _0x2fd048={'raw':![],'where':{'id':_0x4cd6c9[_0x0cb0('0x42')]['id']}},_0x59bbaf={};_0x59bbaf[_0x0cb0('0x2c')]=_[_0x0cb0('0x2e')](db[_0x0cb0('0x3f')]['rawAttributes']);_0x59bbaf[_0x0cb0('0x2d')]=_[_0x0cb0('0x2e')](_0x4cd6c9[_0x0cb0('0x2d')]);_0x59bbaf[_0x0cb0('0x37')]=_[_0x0cb0('0x2f')](_0x59bbaf[_0x0cb0('0x2c')],_0x59bbaf[_0x0cb0('0x2d')]);_0x2fd048[_0x0cb0('0x30')]=_['intersection'](_0x59bbaf[_0x0cb0('0x2c')],qs['fields'](_0x4cd6c9[_0x0cb0('0x2d')]['fields']));_0x2fd048['attributes']=_0x2fd048[_0x0cb0('0x30')][_0x0cb0('0x32')]?_0x2fd048['attributes']:_0x59bbaf[_0x0cb0('0x2c')];if(_0x4cd6c9[_0x0cb0('0x2d')][_0x0cb0('0x43')]){_0x2fd048[_0x0cb0('0x3e')]=[{'all':!![]}];}_0x2fd048=_[_0x0cb0('0x39')]({},_0x2fd048,_0x4cd6c9[_0x0cb0('0x3c')]);return db['ServicenowAccount'][_0x0cb0('0x44')](_0x2fd048)[_0x0cb0('0x23')](handleEntityNotFound(_0x1df959,null))[_0x0cb0('0x23')](respondWithResult(_0x1df959,null))[_0x0cb0('0x40')](handleError(_0x1df959,null));};exports[_0x0cb0('0x45')]=function(_0x2037a7,_0x485ecb){return db[_0x0cb0('0x3f')]['create'](_0x2037a7[_0x0cb0('0x46')],{})[_0x0cb0('0x23')](respondWithResult(_0x485ecb,0xc9))[_0x0cb0('0x40')](handleError(_0x485ecb,null));};exports[_0x0cb0('0x47')]=function(_0x4f7a3c,_0x25edb2){if(_0x4f7a3c[_0x0cb0('0x46')]['id']){delete _0x4f7a3c[_0x0cb0('0x46')]['id'];}return db['ServicenowAccount'][_0x0cb0('0x44')]({'where':{'id':_0x4f7a3c[_0x0cb0('0x42')]['id']}})[_0x0cb0('0x23')](handleEntityNotFound(_0x25edb2,null))['then'](saveUpdates(_0x4f7a3c[_0x0cb0('0x46')],null))[_0x0cb0('0x23')](respondWithResult(_0x25edb2,null))[_0x0cb0('0x40')](handleError(_0x25edb2,null));};exports[_0x0cb0('0x24')]=function(_0x5a075f,_0x1aaba9){return db[_0x0cb0('0x3f')][_0x0cb0('0x44')]({'where':{'id':_0x5a075f['params']['id']}})[_0x0cb0('0x23')](handleEntityNotFound(_0x1aaba9,null))['then'](removeEntity(_0x1aaba9,null))[_0x0cb0('0x40')](handleError(_0x1aaba9,null));};exports[_0x0cb0('0x48')]=function(_0x4d74db,_0x248efc,_0x42e1cd){var _0x5f169c={};var _0x47ca5d={};var _0x2d9a4a;var _0x4a5565;return db[_0x0cb0('0x3f')][_0x0cb0('0x49')]({'where':{'id':_0x4d74db['params']['id']}})[_0x0cb0('0x23')](handleEntityNotFound(_0x248efc,null))[_0x0cb0('0x23')](function(_0x2b5daf){if(_0x2b5daf){_0x2d9a4a=_0x2b5daf;_0x47ca5d[_0x0cb0('0x2c')]=_[_0x0cb0('0x2e')](db['ServicenowConfiguration']['rawAttributes']);_0x47ca5d['query']=_[_0x0cb0('0x2e')](_0x4d74db['query']);_0x47ca5d['filters']=_[_0x0cb0('0x2f')](_0x47ca5d[_0x0cb0('0x2c')],_0x47ca5d[_0x0cb0('0x2d')]);_0x5f169c[_0x0cb0('0x30')]=_['intersection'](_0x47ca5d['model'],qs[_0x0cb0('0x31')](_0x4d74db[_0x0cb0('0x2d')][_0x0cb0('0x31')]));_0x5f169c[_0x0cb0('0x30')]=_0x5f169c['attributes']['length']?_0x5f169c[_0x0cb0('0x30')]:_0x47ca5d['model'];_0x5f169c[_0x0cb0('0x34')]=qs[_0x0cb0('0x35')](_0x4d74db[_0x0cb0('0x2d')][_0x0cb0('0x35')]);_0x5f169c[_0x0cb0('0x36')]=qs[_0x0cb0('0x37')](_[_0x0cb0('0x4a')](_0x4d74db[_0x0cb0('0x2d')],_0x47ca5d[_0x0cb0('0x37')]));if(_0x4d74db[_0x0cb0('0x2d')][_0x0cb0('0x38')]){_0x5f169c['where']=_['merge'](_0x5f169c[_0x0cb0('0x36')],{'$or':_[_0x0cb0('0x2a')](_0x5f169c[_0x0cb0('0x30')],function(_0x1be784){var _0x5a08b0={};_0x5a08b0[_0x1be784]={'$like':'%'+_0x4d74db[_0x0cb0('0x2d')][_0x0cb0('0x38')]+'%'};return _0x5a08b0;})});}_0x5f169c=_[_0x0cb0('0x39')]({},_0x5f169c,_0x4d74db[_0x0cb0('0x3c')]);return _0x2d9a4a[_0x0cb0('0x48')](_0x5f169c);}})['then'](function(_0x3621c3){if(_0x3621c3){_0x4a5565=_0x3621c3[_0x0cb0('0x32')];if(!_0x4d74db['query'][_0x0cb0('0x33')](_0x0cb0('0x4b'))){_0x5f169c[_0x0cb0('0x1e')]=qs[_0x0cb0('0x1e')](_0x4d74db['query']['limit']);_0x5f169c[_0x0cb0('0x1c')]=qs[_0x0cb0('0x1c')](_0x4d74db[_0x0cb0('0x2d')][_0x0cb0('0x1c')]);}return _0x2d9a4a[_0x0cb0('0x48')](_0x5f169c);}})[_0x0cb0('0x23')](function(_0x5c88be){if(_0x5c88be){return _0x5c88be?{'count':_0x4a5565,'rows':_0x5c88be}:null;}})[_0x0cb0('0x23')](respondWithResult(_0x248efc,null))['catch'](handleError(_0x248efc,null));};exports[_0x0cb0('0x4c')]=function(_0x51715f,_0x261f01,_0x3fbadc){if(_0x51715f[_0x0cb0('0x46')]['id']){delete _0x51715f[_0x0cb0('0x46')]['id'];}return db[_0x0cb0('0x3f')]['findOne']({'where':{'id':_0x51715f[_0x0cb0('0x42')]['id']}})['then'](handleEntityNotFound(_0x261f01,null))['then'](function(_0xf2a27a){if(_0xf2a27a){_0x51715f[_0x0cb0('0x46')]['AccountId']=_0xf2a27a['id'];_0x51715f['body'][_0x0cb0('0x4d')]=integrations['getSubjects'](_0x51715f[_0x0cb0('0x46')][_0x0cb0('0x4e')],_0x51715f['body'][_0x0cb0('0x3a')]);_0x51715f[_0x0cb0('0x46')][_0x0cb0('0x4f')]=integrations[_0x0cb0('0x50')](_0x51715f[_0x0cb0('0x46')][_0x0cb0('0x4e')],_0x51715f[_0x0cb0('0x46')][_0x0cb0('0x3a')]);return db['ServicenowConfiguration'][_0x0cb0('0x45')](_0x51715f['body'],{'include':[{'model':db[_0x0cb0('0x51')],'as':_0x0cb0('0x4d')},{'model':db[_0x0cb0('0x51')],'as':_0x0cb0('0x4f')}]});}return null;})[_0x0cb0('0x23')](respondWithResult(_0x261f01,null))[_0x0cb0('0x40')](handleError(_0x261f01,null));};exports[_0x0cb0('0x52')]=function(_0x31f696,_0x4c178c,_0x1ad54a){var _0x10b162=['made_sla',_0x0cb0('0x53'),_0x0cb0('0x54'),_0x0cb0('0x55'),_0x0cb0('0x56'),_0x0cb0('0x57'),_0x0cb0('0x58'),_0x0cb0('0x59'),'category'];var _0x3a22e9=[_0x0cb0('0x5a'),_0x0cb0('0x5b'),'caused_by',_0x0cb0('0x5c'),_0x0cb0('0x5d'),_0x0cb0('0x5e'),'child_incidents',_0x0cb0('0x53'),'approval_history',_0x0cb0('0x5f'),_0x0cb0('0x60'),_0x0cb0('0x61'),_0x0cb0('0x62'),_0x0cb0('0x63'),_0x0cb0('0x64'),_0x0cb0('0x65'),_0x0cb0('0x66'),_0x0cb0('0x67'),_0x0cb0('0x54'),'order','calendar_stc',_0x0cb0('0x68'),_0x0cb0('0x69'),_0x0cb0('0x6a'),_0x0cb0('0x6b'),'active',_0x0cb0('0x6c'),_0x0cb0('0x6d'),_0x0cb0('0x6e'),_0x0cb0('0x6f'),_0x0cb0('0x70'),_0x0cb0('0x71'),_0x0cb0('0x72'),_0x0cb0('0x73'),_0x0cb0('0x74'),_0x0cb0('0x75'),_0x0cb0('0x76'),_0x0cb0('0x77'),_0x0cb0('0x78'),_0x0cb0('0x79'),_0x0cb0('0x7a'),_0x0cb0('0x55'),_0x0cb0('0x7b'),_0x0cb0('0x7c'),'close_code',_0x0cb0('0x7d'),_0x0cb0('0x7e'),_0x0cb0('0x7f'),_0x0cb0('0x80'),_0x0cb0('0x81'),_0x0cb0('0x82'),_0x0cb0('0x83'),_0x0cb0('0x84'),_0x0cb0('0x57'),_0x0cb0('0x85'),_0x0cb0('0x86'),_0x0cb0('0x87'),_0x0cb0('0x88'),_0x0cb0('0x89'),_0x0cb0('0x8a'),_0x0cb0('0x8b'),_0x0cb0('0x8c'),'incident_state',_0x0cb0('0x8d'),_0x0cb0('0x8e'),_0x0cb0('0x8f'),_0x0cb0('0x90'),_0x0cb0('0x91'),_0x0cb0('0x92'),_0x0cb0('0x59'),_0x0cb0('0x93'),_0x0cb0('0x94'),_0x0cb0('0x95'),'comments_and_work_notes',_0x0cb0('0x96'),_0x0cb0('0x97'),_0x0cb0('0x98'),_0x0cb0('0x99'),_0x0cb0('0x9a'),_0x0cb0('0x9b'),_0x0cb0('0x9c'),_0x0cb0('0x9d'),'category'];var _0x2f18be='';var _0x185ac1='';var _0x5e2e12=[];var _0xa765a3='';var _0xa0107='';var _0x4260f0=[];var _0x6be036='';var _0x45e0f1='';var _0x44f389={};var _0x387dc3='';return db[_0x0cb0('0x3f')][_0x0cb0('0x49')]({'where':{'id':_0x31f696[_0x0cb0('0x42')]['id']},'attributes':['id',_0x0cb0('0x9e'),_0x0cb0('0x9f'),_0x0cb0('0xa0'),_0x0cb0('0xa1'),_0x0cb0('0xa2')]})[_0x0cb0('0x23')](handleEntityNotFound(_0x4c178c,null))[_0x0cb0('0x23')](function(_0x2a1371){if(_0x2a1371){_0x387dc3=_0x2a1371[_0x0cb0('0xa1')];var _0x26be30=_0x387dc3['slice'](-0x1);if(_0x26be30==='/'){_0x387dc3=_0x387dc3[_0x0cb0('0xa3')](0x0,_0x387dc3[_0x0cb0('0xa4')](_0x26be30));}_0x45e0f1=util['format'](_0x0cb0('0xa5'),_0x387dc3);_0x6be036=util[_0x0cb0('0xa6')](_0x0cb0('0xa7'),_0x387dc3);_0x44f389={'user':_0x2a1371['username'],'pass':_0x2a1371[_0x0cb0('0x9f')]};var _0x4bbceb={'method':'GET','uri':_0x45e0f1+'incident?sysparm_display_value=all','auth':_0x44f389,'json':!![]};return rp(_0x4bbceb);}})['then'](function(_0x5684fa){if(_0x5684fa[_0x0cb0('0xa8')]['length']>0x0){_0x2f18be=_0x5684fa['result'];}console[_0x0cb0('0xa9')](_0x0cb0('0xaa'),_0x2f18be);_0x4260f0=[];_0x185ac1=Object[_0x0cb0('0xab')]([],_0x2f18be);_['remove'](_0x185ac1,function(_0x20fa49){return!_0x10b162[_0x0cb0('0xac')](_0x20fa49[_0x0cb0('0x27')]);});_0x185ac1['forEach'](function(_0x34b2cc){var _0x62eb51=createFieldObject(_0x6be036,_0x44f389,_0x34b2cc[_0x0cb0('0xad')],_0x34b2cc['name'],_0x34b2cc['label'],![]);_0x4260f0['push'](_0x62eb51);});return Promise['all'](_0x4260f0);})[_0x0cb0('0x23')](function(_0x556daf){_0x5e2e12=_0x556daf;_0xa765a3=Object[_0x0cb0('0xab')]([],_0x2f18be);console[_0x0cb0('0xa9')]('TCL:\x20_object',_0x2f18be);_[_0x0cb0('0xae')](_0xa765a3,function(_0x176cd1){return _0x3a22e9[_0x0cb0('0xac')](_0x176cd1['name']);});console[_0x0cb0('0xa9')](_0x0cb0('0xaf'),_0xa765a3);_0x4260f0=[];_0xa765a3[_0x0cb0('0xb0')](function(_0xbdeb74){var _0xa7f7a7=createFieldObject(_0x6be036,_0x44f389,_0xbdeb74[_0x0cb0('0xad')],_0xbdeb74[_0x0cb0('0x27')],_0xbdeb74[_0x0cb0('0xb1')],!![]);_0x4260f0[_0x0cb0('0xb2')](_0xa7f7a7);});return Promise[_0x0cb0('0xb3')](_0x4260f0);})['then'](function(_0x4453de){_0xa0107=_0x4453de;var _0x1e2f0f=_0x5e2e12[_0x0cb0('0xb4')](_0xa0107);return{'count':_0x1e2f0f[_0x0cb0('0x32')],'rows':_0x1e2f0f};})[_0x0cb0('0x23')](respondWithResult(_0x4c178c,null))['catch'](function(_0x310acd){console[_0x0cb0('0xa9')](_0x0cb0('0xb5')+_0x310acd);var _0x38dab7=_0x31f696[_0x0cb0('0x2d')][_0x0cb0('0xb6')]?0x1f4:_0x310acd[_0x0cb0('0xb7')]||0x1f4;logger[_0x0cb0('0x25')](_0x310acd[_0x0cb0('0x26')]);delete _0x310acd[_0x0cb0('0x27')];if(_0x38dab7===0x191){_0x38dab7=0x190;}_0x4c178c['status'](_0x38dab7)[_0x0cb0('0x28')](_0x31f696[_0x0cb0('0x2d')]['test']?{'message':_0x0cb0('0xb8'),'statusCode':_0x310acd[_0x0cb0('0xb7')]}:_0x310acd);});};function createFieldObject(_0x75a6bb,_0x5d005d,_0x332c5f,_0x14ca8f,_0x40f0d8,_0x16f650){return new Promise(function(_0x59d2f8,_0x3d3650){var _0x536b00={'id':_0x14ca8f,'name':_0x40f0d8,'custom':_0x16f650};if(_0x332c5f===_0x0cb0('0xb9')){_0x536b00[_0x0cb0('0x3c')]=[{'name':_0x0cb0('0xba'),'value':'true'},{'name':_0x0cb0('0xbb'),'value':_0x0cb0('0xbc')}];_0x59d2f8(_0x536b00);}else{var _0xc40f74={'method':_0x0cb0('0xbd'),'uri':_0x75a6bb+_0x0cb0('0xbe')+_0x14ca8f,'auth':_0x5d005d,'json':!![]};return rp(_0xc40f74)[_0x0cb0('0x23')](function(_0x181fdd){var _0x568091=[];if(_0x181fdd[_0x0cb0('0xa8')][_0x0cb0('0x32')]>0x0){_0x181fdd[_0x0cb0('0xa8')][_0x0cb0('0xb0')](function(_0x42fa77){if(_0x42fa77[_0x0cb0('0xbf')]==='false'){var _0xe0c825={'name':_0x42fa77[_0x0cb0('0xb1')],'value':_0x42fa77[_0x0cb0('0xc0')]};_0x568091[_0x0cb0('0xb2')](_0xe0c825);}});}_0x536b00[_0x0cb0('0x3c')]=_0x568091;if(_0x536b00[_0x0cb0('0x3c')]['length']>0x0){_0x59d2f8(_0x536b00);}else{if(_0x16f650==![]){_0x59d2f8();}else{_0x59d2f8(_0x536b00);}}});}});} \ No newline at end of file +var _0x1f55=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','findAll','show','params','options','find','catch','create','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','body','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','subcategory','work_notes','short_description','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','send','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4a6bbd,_0x405ca7){var _0x16fcac=function(_0x16a0db){while(--_0x16a0db){_0x4a6bbd['push'](_0x4a6bbd['shift']());}};_0x16fcac(++_0x405ca7);}(_0x1f55,0x159));var _0x51f5=function(_0x4ffdb2,_0x3b3dac){_0x4ffdb2=_0x4ffdb2-0x0;var _0x104b78=_0x1f55[_0x4ffdb2];return _0x104b78;};'use strict';var emlformat=require(_0x51f5('0x0'));var rimraf=require(_0x51f5('0x1'));var zipdir=require(_0x51f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51f5('0x3'));var moment=require(_0x51f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51f5('0x5'));var util=require(_0x51f5('0x6'));var path=require(_0x51f5('0x7'));var sox=require(_0x51f5('0x8'));var csv=require(_0x51f5('0x9'));var ejs=require(_0x51f5('0xa'));var fs=require('fs');var fs_extra=require(_0x51f5('0xb'));var _=require(_0x51f5('0xc'));var squel=require('squel');var crypto=require(_0x51f5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x51f5('0x9'));var querystring=require(_0x51f5('0xe'));var Papa=require('papaparse');var Redis=require(_0x51f5('0xf'));var authService=require(_0x51f5('0x10'));var qs=require(_0x51f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51f5('0x12'));var logger=require(_0x51f5('0x13'))(_0x51f5('0x14'));var utils=require(_0x51f5('0x15'));var config=require(_0x51f5('0x16'));var licenseUtil=require(_0x51f5('0x17'));var db=require(_0x51f5('0x18'))['db'];var integrations=require(_0x51f5('0x19'));function respondWithStatusCode(_0x627bcf,_0x23055b){_0x23055b=_0x23055b||0xcc;return function(_0x3ad93a){if(_0x3ad93a){return _0x627bcf[_0x51f5('0x1a')](_0x23055b);}return _0x627bcf[_0x51f5('0x1b')](_0x23055b)[_0x51f5('0x1c')]();};}function respondWithResult(_0x390d1d,_0x2caf3d){_0x2caf3d=_0x2caf3d||0xc8;return function(_0x9db6e0){if(_0x9db6e0){return _0x390d1d[_0x51f5('0x1b')](_0x2caf3d)[_0x51f5('0x1d')](_0x9db6e0);}};}function respondWithFilteredResult(_0xc02881,_0x54d884){return function(_0x25bde7){if(_0x25bde7){var _0x4d1b27=typeof _0x54d884[_0x51f5('0x1e')]===_0x51f5('0x1f')&&typeof _0x54d884[_0x51f5('0x20')]===_0x51f5('0x1f');var _0x1f8991=_0x25bde7[_0x51f5('0x21')];var _0x5c0c8b=_0x4d1b27?0x0:_0x54d884['offset'];var _0x263269=_0x4d1b27?_0x25bde7[_0x51f5('0x21')]:_0x54d884[_0x51f5('0x1e')]+_0x54d884[_0x51f5('0x20')];var _0x16762d;if(_0x263269>=_0x1f8991){_0x263269=_0x1f8991;_0x16762d=0xc8;}else{_0x16762d=0xce;}_0xc02881[_0x51f5('0x1b')](_0x16762d);return _0xc02881[_0x51f5('0x22')](_0x51f5('0x23'),_0x5c0c8b+'-'+_0x263269+'/'+_0x1f8991)[_0x51f5('0x1d')](_0x25bde7);}return null;};}function patchUpdates(_0x466b33){return function(_0x4c4ac9){try{jsonpatch['apply'](_0x4c4ac9,_0x466b33,!![]);}catch(_0x36145f){return BPromise[_0x51f5('0x24')](_0x36145f);}return _0x4c4ac9['save']();};}function saveUpdates(_0x1d6b78,_0x320771){return function(_0x26850b){if(_0x26850b){return _0x26850b[_0x51f5('0x25')](_0x1d6b78)[_0x51f5('0x26')](function(_0x38f593){return _0x38f593;});}return null;};}function removeEntity(_0x19a450,_0x465640){return function(_0x3b77cc){if(_0x3b77cc){return _0x3b77cc['destroy']()[_0x51f5('0x26')](function(){_0x19a450['status'](0xcc)[_0x51f5('0x1c')]();});}};}function handleEntityNotFound(_0x17d890,_0x2b410d){return function(_0x16da27){if(!_0x16da27){_0x17d890[_0x51f5('0x1a')](0x194);}return _0x16da27;};}function handleError(_0x41e5bb,_0x3ea8bd){_0x3ea8bd=_0x3ea8bd||0x1f4;return function(_0x3ed6dd){logger[_0x51f5('0x27')](_0x3ed6dd[_0x51f5('0x28')]);if(_0x3ed6dd[_0x51f5('0x29')]){delete _0x3ed6dd['name'];}_0x41e5bb[_0x51f5('0x1b')](_0x3ea8bd)['send'](_0x3ed6dd);};}exports[_0x51f5('0x2a')]=function(_0x4a5549,_0x219f7c){var _0x450105={},_0x929212={},_0x1ab3d9={'count':0x0,'rows':[]};var _0x2bc9fa=_[_0x51f5('0x2b')](db[_0x51f5('0x2c')][_0x51f5('0x2d')],function(_0x4e9de9){return{'name':_0x4e9de9[_0x51f5('0x2e')],'type':_0x4e9de9[_0x51f5('0x2f')][_0x51f5('0x30')]};});_0x929212['model']=_[_0x51f5('0x2b')](_0x2bc9fa,_0x51f5('0x29'));_0x929212[_0x51f5('0x31')]=_[_0x51f5('0x32')](_0x4a5549[_0x51f5('0x31')]);_0x929212[_0x51f5('0x33')]=_[_0x51f5('0x34')](_0x929212[_0x51f5('0x35')],_0x929212[_0x51f5('0x31')]);_0x450105['attributes']=_[_0x51f5('0x34')](_0x929212[_0x51f5('0x35')],qs[_0x51f5('0x36')](_0x4a5549[_0x51f5('0x31')]['fields']));_0x450105[_0x51f5('0x37')]=_0x450105['attributes'][_0x51f5('0x38')]?_0x450105[_0x51f5('0x37')]:_0x929212[_0x51f5('0x35')];if(!_0x4a5549[_0x51f5('0x31')][_0x51f5('0x39')](_0x51f5('0x3a'))){_0x450105[_0x51f5('0x20')]=qs[_0x51f5('0x20')](_0x4a5549[_0x51f5('0x31')]['limit']);_0x450105[_0x51f5('0x1e')]=qs['offset'](_0x4a5549[_0x51f5('0x31')][_0x51f5('0x1e')]);}_0x450105[_0x51f5('0x3b')]=qs[_0x51f5('0x3c')](_0x4a5549[_0x51f5('0x31')][_0x51f5('0x3c')]);_0x450105[_0x51f5('0x3d')]=qs['filters'](_['pick'](_0x4a5549[_0x51f5('0x31')],_0x929212[_0x51f5('0x33')]),_0x2bc9fa);if(_0x4a5549[_0x51f5('0x31')]['filter']){_0x450105['where']=_[_0x51f5('0x3e')](_0x450105[_0x51f5('0x3d')],{'$or':_['map'](_0x2bc9fa,function(_0x484c75){if(_0x484c75[_0x51f5('0x2f')]!=='VIRTUAL'){var _0x481ef4={};_0x481ef4[_0x484c75[_0x51f5('0x29')]]={'$like':'%'+_0x4a5549[_0x51f5('0x31')]['filter']+'%'};return _0x481ef4;}})});}_0x450105=_[_0x51f5('0x3e')]({},_0x450105,_0x4a5549['options']);var _0x47a930={'where':_0x450105[_0x51f5('0x3d')]};return db[_0x51f5('0x2c')]['count'](_0x47a930)[_0x51f5('0x26')](function(_0x29ac32){_0x1ab3d9[_0x51f5('0x21')]=_0x29ac32;if(_0x4a5549[_0x51f5('0x31')][_0x51f5('0x3f')]){_0x450105['include']=[{'all':!![]}];}return db[_0x51f5('0x2c')][_0x51f5('0x40')](_0x450105);})[_0x51f5('0x26')](function(_0x146af7){_0x1ab3d9['rows']=_0x146af7;return _0x1ab3d9;})[_0x51f5('0x26')](respondWithFilteredResult(_0x219f7c,_0x450105))['catch'](handleError(_0x219f7c,null));};exports[_0x51f5('0x41')]=function(_0x3fdb00,_0x4fc4cf){var _0x428ed={'raw':![],'where':{'id':_0x3fdb00[_0x51f5('0x42')]['id']}},_0x13b893={};_0x13b893[_0x51f5('0x35')]=_[_0x51f5('0x32')](db['ServicenowAccount'][_0x51f5('0x2d')]);_0x13b893[_0x51f5('0x31')]=_['keys'](_0x3fdb00['query']);_0x13b893['filters']=_['intersection'](_0x13b893[_0x51f5('0x35')],_0x13b893[_0x51f5('0x31')]);_0x428ed[_0x51f5('0x37')]=_['intersection'](_0x13b893['model'],qs[_0x51f5('0x36')](_0x3fdb00['query'][_0x51f5('0x36')]));_0x428ed[_0x51f5('0x37')]=_0x428ed['attributes'][_0x51f5('0x38')]?_0x428ed['attributes']:_0x13b893[_0x51f5('0x35')];if(_0x3fdb00[_0x51f5('0x31')][_0x51f5('0x3f')]){_0x428ed['include']=[{'all':!![]}];}_0x428ed=_[_0x51f5('0x3e')]({},_0x428ed,_0x3fdb00[_0x51f5('0x43')]);return db[_0x51f5('0x2c')][_0x51f5('0x44')](_0x428ed)[_0x51f5('0x26')](handleEntityNotFound(_0x4fc4cf,null))[_0x51f5('0x26')](respondWithResult(_0x4fc4cf,null))[_0x51f5('0x45')](handleError(_0x4fc4cf,null));};exports[_0x51f5('0x46')]=function(_0xf4be0e,_0x2a17bd){return db[_0x51f5('0x2c')]['create'](_0xf4be0e['body'],{})[_0x51f5('0x26')](respondWithResult(_0x2a17bd,0xc9))[_0x51f5('0x45')](handleError(_0x2a17bd,null));};exports[_0x51f5('0x25')]=function(_0x447057,_0x572756){if(_0x447057['body']['id']){delete _0x447057['body']['id'];}return db[_0x51f5('0x2c')][_0x51f5('0x44')]({'where':{'id':_0x447057[_0x51f5('0x42')]['id']}})[_0x51f5('0x26')](handleEntityNotFound(_0x572756,null))[_0x51f5('0x26')](saveUpdates(_0x447057['body'],null))[_0x51f5('0x26')](respondWithResult(_0x572756,null))[_0x51f5('0x45')](handleError(_0x572756,null));};exports[_0x51f5('0x47')]=function(_0x5b6a14,_0x57f768){return db[_0x51f5('0x2c')][_0x51f5('0x44')]({'where':{'id':_0x5b6a14[_0x51f5('0x42')]['id']}})[_0x51f5('0x26')](handleEntityNotFound(_0x57f768,null))[_0x51f5('0x26')](removeEntity(_0x57f768,null))[_0x51f5('0x45')](handleError(_0x57f768,null));};exports[_0x51f5('0x48')]=function(_0x18a0da,_0x52a6b3,_0x69ed72){var _0x1fcb6e={};var _0x4186db={};var _0x38a9f1;var _0x25338f;return db['ServicenowAccount'][_0x51f5('0x49')]({'where':{'id':_0x18a0da[_0x51f5('0x42')]['id']}})[_0x51f5('0x26')](handleEntityNotFound(_0x52a6b3,null))[_0x51f5('0x26')](function(_0x5bb23f){if(_0x5bb23f){_0x38a9f1=_0x5bb23f;_0x4186db['model']=_[_0x51f5('0x32')](db[_0x51f5('0x4a')][_0x51f5('0x2d')]);_0x4186db[_0x51f5('0x31')]=_[_0x51f5('0x32')](_0x18a0da['query']);_0x4186db[_0x51f5('0x33')]=_[_0x51f5('0x34')](_0x4186db[_0x51f5('0x35')],_0x4186db[_0x51f5('0x31')]);_0x1fcb6e['attributes']=_[_0x51f5('0x34')](_0x4186db[_0x51f5('0x35')],qs['fields'](_0x18a0da[_0x51f5('0x31')][_0x51f5('0x36')]));_0x1fcb6e[_0x51f5('0x37')]=_0x1fcb6e['attributes'][_0x51f5('0x38')]?_0x1fcb6e[_0x51f5('0x37')]:_0x4186db[_0x51f5('0x35')];_0x1fcb6e[_0x51f5('0x3b')]=qs[_0x51f5('0x3c')](_0x18a0da[_0x51f5('0x31')]['sort']);_0x1fcb6e['where']=qs[_0x51f5('0x33')](_[_0x51f5('0x4b')](_0x18a0da[_0x51f5('0x31')],_0x4186db[_0x51f5('0x33')]));if(_0x18a0da[_0x51f5('0x31')]['filter']){_0x1fcb6e[_0x51f5('0x3d')]=_[_0x51f5('0x3e')](_0x1fcb6e[_0x51f5('0x3d')],{'$or':_[_0x51f5('0x2b')](_0x1fcb6e['attributes'],function(_0x4ff889){var _0x58d4c1={};_0x58d4c1[_0x4ff889]={'$like':'%'+_0x18a0da['query']['filter']+'%'};return _0x58d4c1;})});}_0x1fcb6e=_[_0x51f5('0x3e')]({},_0x1fcb6e,_0x18a0da['options']);return _0x38a9f1[_0x51f5('0x48')](_0x1fcb6e);}})[_0x51f5('0x26')](function(_0x3ee4b4){if(_0x3ee4b4){_0x25338f=_0x3ee4b4[_0x51f5('0x38')];if(!_0x18a0da[_0x51f5('0x31')]['hasOwnProperty'](_0x51f5('0x3a'))){_0x1fcb6e[_0x51f5('0x20')]=qs[_0x51f5('0x20')](_0x18a0da['query']['limit']);_0x1fcb6e['offset']=qs[_0x51f5('0x1e')](_0x18a0da['query'][_0x51f5('0x1e')]);}return _0x38a9f1[_0x51f5('0x48')](_0x1fcb6e);}})[_0x51f5('0x26')](function(_0x377784){if(_0x377784){return _0x377784?{'count':_0x25338f,'rows':_0x377784}:null;}})['then'](respondWithResult(_0x52a6b3,null))[_0x51f5('0x45')](handleError(_0x52a6b3,null));};exports[_0x51f5('0x4c')]=function(_0x3e2d12,_0x5260af,_0x488622){if(_0x3e2d12[_0x51f5('0x4d')]['id']){delete _0x3e2d12[_0x51f5('0x4d')]['id'];}return db[_0x51f5('0x2c')][_0x51f5('0x49')]({'where':{'id':_0x3e2d12[_0x51f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x5260af,null))[_0x51f5('0x26')](function(_0x2ad468){if(_0x2ad468){_0x3e2d12[_0x51f5('0x4d')]['AccountId']=_0x2ad468['id'];_0x3e2d12['body'][_0x51f5('0x4e')]=integrations[_0x51f5('0x4f')](_0x3e2d12[_0x51f5('0x4d')][_0x51f5('0x50')],_0x3e2d12[_0x51f5('0x4d')][_0x51f5('0x2f')]);_0x3e2d12[_0x51f5('0x4d')][_0x51f5('0x51')]=integrations[_0x51f5('0x52')](_0x3e2d12['body'][_0x51f5('0x50')],_0x3e2d12['body'][_0x51f5('0x2f')]);return db[_0x51f5('0x4a')][_0x51f5('0x46')](_0x3e2d12[_0x51f5('0x4d')],{'include':[{'model':db[_0x51f5('0x53')],'as':_0x51f5('0x4e')},{'model':db[_0x51f5('0x53')],'as':_0x51f5('0x51')}]});}return null;})[_0x51f5('0x26')](respondWithResult(_0x5260af,null))[_0x51f5('0x45')](handleError(_0x5260af,null));};exports['getFields']=function(_0x30d9b8,_0x288289,_0xadc359){var _0x3b4b3b=[_0x51f5('0x54'),_0x51f5('0x55'),_0x51f5('0x56'),'subcategory',_0x51f5('0x57'),_0x51f5('0x58'),_0x51f5('0x59'),_0x51f5('0x5a'),'category'];var _0x121bde=[_0x51f5('0x5b'),_0x51f5('0x54'),_0x51f5('0x5c'),_0x51f5('0x5d'),_0x51f5('0x5e'),_0x51f5('0x5f'),_0x51f5('0x60'),'hold_reason',_0x51f5('0x61'),'number','resolved_by',_0x51f5('0x62'),_0x51f5('0x63'),_0x51f5('0x64'),_0x51f5('0x65'),_0x51f5('0x66'),_0x51f5('0x67'),_0x51f5('0x68'),'knowledge',_0x51f5('0x3b'),_0x51f5('0x69'),_0x51f5('0x6a'),_0x51f5('0x6b'),_0x51f5('0x6c'),'impact',_0x51f5('0x6d'),_0x51f5('0x6e'),_0x51f5('0x6f'),_0x51f5('0x70'),_0x51f5('0x71'),'rfc',_0x51f5('0x72'),_0x51f5('0x73'),_0x51f5('0x74'),_0x51f5('0x75'),_0x51f5('0x76'),'work_end',_0x51f5('0x77'),'resolved_at',_0x51f5('0x78'),'approval_set',_0x51f5('0x79'),_0x51f5('0x7a'),_0x51f5('0x7b'),_0x51f5('0x57'),'correlation_display','delivery_task','work_start',_0x51f5('0x7c'),_0x51f5('0x7d'),_0x51f5('0x7e'),_0x51f5('0x7f'),_0x51f5('0x80'),'notify','sys_class_name',_0x51f5('0x81'),'closed_by',_0x51f5('0x82'),_0x51f5('0x83'),_0x51f5('0x84'),_0x51f5('0x85'),_0x51f5('0x86'),_0x51f5('0x59'),_0x51f5('0x87'),_0x51f5('0x88'),_0x51f5('0x89'),_0x51f5('0x8a'),'activity_due',_0x51f5('0x8b'),_0x51f5('0x5a'),_0x51f5('0x8c'),_0x51f5('0x8d'),_0x51f5('0x8e'),'comments_and_work_notes',_0x51f5('0x8f'),_0x51f5('0x90'),_0x51f5('0x91'),_0x51f5('0x92'),'escalation','upon_approval',_0x51f5('0x93'),_0x51f5('0x94'),'category'];var _0x34c17a='';var _0x2db671='';var _0x1bf36e=[];var _0xc21b83='';var _0x3c8fd3='';var _0x36e0e5=[];var _0x3546cd='';var _0x46237b='';var _0x38015d={};var _0x59e9ee='';return db[_0x51f5('0x2c')][_0x51f5('0x49')]({'where':{'id':_0x30d9b8[_0x51f5('0x42')]['id']},'attributes':['id',_0x51f5('0x95'),_0x51f5('0x96'),'email',_0x51f5('0x97'),_0x51f5('0x98')]})[_0x51f5('0x26')](handleEntityNotFound(_0x288289,null))[_0x51f5('0x26')](function(_0x341de8){if(_0x341de8){_0x59e9ee=_0x341de8[_0x51f5('0x97')];var _0x89f32a=_0x59e9ee[_0x51f5('0x99')](-0x1);if(_0x89f32a==='/'){_0x59e9ee=_0x59e9ee[_0x51f5('0x9a')](0x0,_0x59e9ee[_0x51f5('0x9b')](_0x89f32a));}_0x46237b=util[_0x51f5('0x9c')](_0x51f5('0x9d'),_0x59e9ee);_0x3546cd=util[_0x51f5('0x9c')]('%s/api/now/table/',_0x59e9ee);_0x38015d={'user':_0x341de8[_0x51f5('0x95')],'pass':_0x341de8[_0x51f5('0x96')]};var _0x1c4001={'method':_0x51f5('0x9e'),'uri':_0x46237b+'incident?sysparm_display_value=all','auth':_0x38015d,'json':!![]};return rp(_0x1c4001);}})['then'](function(_0x589b9a){if(_0x589b9a['result']['length']>0x0){_0x34c17a=_0x589b9a[_0x51f5('0x9f')];}console[_0x51f5('0xa0')](_0x51f5('0xa1'),_0x34c17a);_0x36e0e5=[];_0x2db671=Object[_0x51f5('0xa2')]([],_0x34c17a);_[_0x51f5('0xa3')](_0x2db671,function(_0x352912){return!_0x3b4b3b[_0x51f5('0xa4')](_0x352912[_0x51f5('0x29')]);});_0x2db671[_0x51f5('0xa5')](function(_0x110ba4){var _0x337c96=createFieldObject(_0x3546cd,_0x38015d,_0x110ba4[_0x51f5('0xa6')],_0x110ba4[_0x51f5('0x29')],_0x110ba4[_0x51f5('0xa7')],![]);_0x36e0e5[_0x51f5('0xa8')](_0x337c96);});return Promise[_0x51f5('0xa9')](_0x36e0e5);})[_0x51f5('0x26')](function(_0x56ea4c){_0x1bf36e=_0x56ea4c;_0xc21b83=Object[_0x51f5('0xa2')]([],_0x34c17a);console['log'](_0x51f5('0xaa'),_0x34c17a);_[_0x51f5('0xa3')](_0xc21b83,function(_0x1e4d17){return _0x121bde[_0x51f5('0xa4')](_0x1e4d17['name']);});console[_0x51f5('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xc21b83);_0x36e0e5=[];_0xc21b83[_0x51f5('0xa5')](function(_0x316fe2){var _0x511c13=createFieldObject(_0x3546cd,_0x38015d,_0x316fe2[_0x51f5('0xa6')],_0x316fe2[_0x51f5('0x29')],_0x316fe2['label'],!![]);_0x36e0e5['push'](_0x511c13);});return Promise[_0x51f5('0xa9')](_0x36e0e5);})[_0x51f5('0x26')](function(_0x18accd){_0x3c8fd3=_0x18accd;var _0x10927f=_0x1bf36e[_0x51f5('0xab')](_0x3c8fd3);return{'count':_0x10927f['length'],'rows':_0x10927f};})[_0x51f5('0x26')](respondWithResult(_0x288289,null))[_0x51f5('0x45')](function(_0x3255ac){console[_0x51f5('0xa0')](_0x51f5('0xac')+_0x3255ac);var _0x316d03=_0x30d9b8[_0x51f5('0x31')][_0x51f5('0xad')]?0x1f4:_0x3255ac[_0x51f5('0xae')]||0x1f4;logger[_0x51f5('0x27')](_0x3255ac[_0x51f5('0x28')]);delete _0x3255ac['name'];if(_0x316d03===0x191){_0x316d03=0x190;}_0x288289[_0x51f5('0x1b')](_0x316d03)[_0x51f5('0xaf')](_0x30d9b8[_0x51f5('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3255ac[_0x51f5('0xae')]}:_0x3255ac);});};function createFieldObject(_0x558638,_0x10dd13,_0x4e31a5,_0x506848,_0x448400,_0x22251b){return new Promise(function(_0x29055f,_0x5e0731){var _0x13b5c2={'id':_0x506848,'name':_0x448400,'custom':_0x22251b};if(_0x4e31a5===_0x51f5('0xb0')){_0x13b5c2[_0x51f5('0x43')]=[{'name':_0x51f5('0xb1'),'value':_0x51f5('0xb2')},{'name':_0x51f5('0xb3'),'value':_0x51f5('0xb4')}];_0x29055f(_0x13b5c2);}else{var _0x2ba9aa={'method':_0x51f5('0x9e'),'uri':_0x558638+_0x51f5('0xb5')+_0x506848,'auth':_0x10dd13,'json':!![]};return rp(_0x2ba9aa)[_0x51f5('0x26')](function(_0x37740b){var _0x2be24b=[];if(_0x37740b[_0x51f5('0x9f')][_0x51f5('0x38')]>0x0){_0x37740b[_0x51f5('0x9f')][_0x51f5('0xa5')](function(_0x5f3a18){if(_0x5f3a18[_0x51f5('0xb6')]==='false'){var _0x3e5f95={'name':_0x5f3a18[_0x51f5('0xa7')],'value':_0x5f3a18[_0x51f5('0xb7')]};_0x2be24b[_0x51f5('0xa8')](_0x3e5f95);}});}_0x13b5c2['options']=_0x2be24b;if(_0x13b5c2[_0x51f5('0x43')][_0x51f5('0x38')]>0x0){_0x29055f(_0x13b5c2);}else{if(_0x22251b==![]){_0x29055f();}else{_0x29055f(_0x13b5c2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ae25432..f67cd75 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 _0x5d58=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','bluebird'];(function(_0x1857c6,_0x48840c){var _0x51011c=function(_0x3a4736){while(--_0x3a4736){_0x1857c6['push'](_0x1857c6['shift']());}};_0x51011c(++_0x48840c);}(_0x5d58,0x187));var _0x85d5=function(_0x35daa6,_0xae90dc){_0x35daa6=_0x35daa6-0x0;var _0x49a12c=_0x5d58[_0x35daa6];return _0x49a12c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x85d5('0x4'));module[_0x85d5('0x5')]=function(_0x578fad,_0x46e7b4){return _0x578fad['define'](_0x85d5('0x6'),attributes,{'tableName':_0x85d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x1883,0xab));var _0x3188=function(_0x2804c3,_0x4a611e){_0x2804c3=_0x2804c3-0x0;var _0x2657d4=_0x1883[_0x2804c3];return _0x2657d4;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 395a726..2b973cd 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 _0x851c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','GetServicenowAccount','ShowServicenowAccount','find'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x851c,0x186));var _0xc851=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x851c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var moment=require(_0xc851('0x2'));var BPromise=require(_0xc851('0x3'));var rs=require(_0xc851('0x4'));var fs=require('fs');var Redis=require(_0xc851('0x5'));var db=require(_0xc851('0x6'))['db'];var utils=require(_0xc851('0x7'));var logger=require(_0xc851('0x8'))(_0xc851('0x9'));var config=require(_0xc851('0xa'));var jayson=require(_0xc851('0xb'));var client=jayson[_0xc851('0xc')][_0xc851('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6d619d,_0xb275c3,_0x7d912f){return new BPromise(function(_0x5391b4,_0x433a92){return client[_0xc851('0xe')](_0x6d619d,_0x7d912f)[_0xc851('0xf')](function(_0x1c3a01){logger[_0xc851('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xb275c3,'request\x20sent');logger[_0xc851('0x11')](_0xc851('0x12'),_0xb275c3,'request\x20sent',JSON[_0xc851('0x13')](_0x1c3a01));if(_0x1c3a01[_0xc851('0x14')]){if(_0x1c3a01[_0xc851('0x14')][_0xc851('0x15')]===0x1f4){logger[_0xc851('0x14')](_0xc851('0x16'),_0xb275c3,_0x1c3a01[_0xc851('0x14')][_0xc851('0x17')]);return _0x433a92(_0x1c3a01[_0xc851('0x14')]['message']);}logger[_0xc851('0x14')](_0xc851('0x16'),_0xb275c3,_0x1c3a01[_0xc851('0x14')][_0xc851('0x17')]);return _0x5391b4(_0x1c3a01[_0xc851('0x14')][_0xc851('0x17')]);}else{logger[_0xc851('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xb275c3,_0xc851('0x18'));_0x5391b4(_0x1c3a01[_0xc851('0x19')][_0xc851('0x17')]);}})[_0xc851('0x1a')](function(_0x2c5b85){logger[_0xc851('0x14')](_0xc851('0x16'),_0xb275c3,_0x2c5b85);_0x433a92(_0x2c5b85);});});}exports['GetServicenowAccount']=function(_0x4da347){var _0x266c49=this;return new Promise(function(_0x358845,_0x3bdbbd){return db[_0xc851('0x1b')][_0xc851('0x1c')]({'raw':_0x4da347[_0xc851('0x1d')]?_0x4da347[_0xc851('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4da347[_0xc851('0x1d')]?_0x4da347[_0xc851('0x1d')][_0xc851('0x1e')]||null:null,'attributes':_0x4da347[_0xc851('0x1d')]?_0x4da347['options'][_0xc851('0x1f')]||null:null,'limit':_0x4da347[_0xc851('0x1d')]?_0x4da347[_0xc851('0x1d')][_0xc851('0x20')]||null:null,'include':_0x4da347[_0xc851('0x1d')]?_0x4da347[_0xc851('0x1d')][_0xc851('0x21')]?_['map'](_0x4da347[_0xc851('0x1d')]['include'],function(_0x56ff82){return{'model':db[_0x56ff82[_0xc851('0x22')]],'as':_0x56ff82['as'],'attributes':_0x56ff82['attributes'],'include':_0x56ff82[_0xc851('0x21')]?_[_0xc851('0x23')](_0x56ff82[_0xc851('0x21')],function(_0x4f657d){return{'model':db[_0x4f657d[_0xc851('0x22')]],'as':_0x4f657d['as'],'attributes':_0x4f657d['attributes'],'include':_0x4f657d[_0xc851('0x21')]?_[_0xc851('0x23')](_0x4f657d[_0xc851('0x21')],function(_0x3fcf8b){return{'model':db[_0x3fcf8b[_0xc851('0x22')]],'as':_0x3fcf8b['as'],'attributes':_0x3fcf8b[_0xc851('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc851('0xf')](function(_0x559a97){logger[_0xc851('0x10')]('GetServicenowAccount',_0x4da347);logger[_0xc851('0x11')]('GetServicenowAccount',_0x4da347,JSON['stringify'](_0x559a97));_0x358845(_0x559a97);})[_0xc851('0x1a')](function(_0x23d53e){logger[_0xc851('0x14')](_0xc851('0x24'),_0x23d53e['message'],_0x4da347);_0x3bdbbd(_0x266c49['error'](0x1f4,_0x23d53e[_0xc851('0x17')]));});});};exports[_0xc851('0x25')]=function(_0x51666f){var _0x39373e=this;return new Promise(function(_0x5c691c,_0x32f044){return db[_0xc851('0x1b')][_0xc851('0x26')]({'raw':_0x51666f[_0xc851('0x1d')]?_0x51666f['options']['raw']===undefined?!![]:![]:!![],'where':_0x51666f[_0xc851('0x1d')]?_0x51666f[_0xc851('0x1d')][_0xc851('0x1e')]||null:null,'attributes':_0x51666f[_0xc851('0x1d')]?_0x51666f[_0xc851('0x1d')][_0xc851('0x1f')]||null:null,'include':_0x51666f['options']?_0x51666f['options']['include']?_[_0xc851('0x23')](_0x51666f[_0xc851('0x1d')]['include'],function(_0xe958c2){return{'model':db[_0xe958c2[_0xc851('0x22')]],'as':_0xe958c2['as'],'attributes':_0xe958c2['attributes'],'include':_0xe958c2['include']?_['map'](_0xe958c2[_0xc851('0x21')],function(_0x2ca6a2){return{'model':db[_0x2ca6a2['model']],'as':_0x2ca6a2['as'],'attributes':_0x2ca6a2[_0xc851('0x1f')],'include':_0x2ca6a2['include']?_[_0xc851('0x23')](_0x2ca6a2[_0xc851('0x21')],function(_0xf55343){return{'model':db[_0xf55343[_0xc851('0x22')]],'as':_0xf55343['as'],'attributes':_0xf55343[_0xc851('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc851('0xf')](function(_0x20fc22){logger[_0xc851('0x10')](_0xc851('0x25'),_0x51666f);logger[_0xc851('0x11')](_0xc851('0x25'),_0x51666f,JSON[_0xc851('0x13')](_0x20fc22));_0x5c691c(_0x20fc22);})[_0xc851('0x1a')](function(_0x5c6f27){logger['error'](_0xc851('0x25'),_0x5c6f27[_0xc851('0x17')],_0x51666f);_0x32f044(_0x39373e[_0xc851('0x14')](0x1f4,_0x5c6f27[_0xc851('0x17')]));});});}; \ No newline at end of file +var _0x512e=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','options','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','raw','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x512e,0xd2));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe512('0x0'));var util=require(_0xe512('0x1'));var moment=require(_0xe512('0x2'));var BPromise=require(_0xe512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe512('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe512('0x5'));var jayson=require(_0xe512('0x6'));var client=jayson[_0xe512('0x7')][_0xe512('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x290e36,_0x4fcd37,_0x581ecd){return new BPromise(function(_0x39fc41,_0x440dc8){return client[_0xe512('0x9')](_0x290e36,_0x581ecd)[_0xe512('0xa')](function(_0x5db600){logger[_0xe512('0xb')](_0xe512('0xc'),_0x4fcd37,_0xe512('0xd'));logger[_0xe512('0xe')](_0xe512('0xf'),_0x4fcd37,_0xe512('0xd'),JSON[_0xe512('0x10')](_0x5db600));if(_0x5db600[_0xe512('0x11')]){if(_0x5db600[_0xe512('0x11')][_0xe512('0x12')]===0x1f4){logger[_0xe512('0x11')](_0xe512('0xc'),_0x4fcd37,_0x5db600[_0xe512('0x11')][_0xe512('0x13')]);return _0x440dc8(_0x5db600[_0xe512('0x11')][_0xe512('0x13')]);}logger[_0xe512('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4fcd37,_0x5db600[_0xe512('0x11')][_0xe512('0x13')]);return _0x39fc41(_0x5db600['error'][_0xe512('0x13')]);}else{logger[_0xe512('0xb')](_0xe512('0xc'),_0x4fcd37,_0xe512('0xd'));_0x39fc41(_0x5db600['result']['message']);}})[_0xe512('0x14')](function(_0x5e15d5){logger[_0xe512('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4fcd37,_0x5e15d5);_0x440dc8(_0x5e15d5);});});}exports[_0xe512('0x15')]=function(_0x4933dc){var _0x27a455=this;return new Promise(function(_0xfc08e7,_0x4b37eb){return db['ServicenowAccount']['findAll']({'raw':_0x4933dc['options']?_0x4933dc[_0xe512('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4933dc['options']?_0x4933dc[_0xe512('0x16')][_0xe512('0x17')]||null:null,'attributes':_0x4933dc[_0xe512('0x16')]?_0x4933dc['options'][_0xe512('0x18')]||null:null,'limit':_0x4933dc['options']?_0x4933dc[_0xe512('0x16')][_0xe512('0x19')]||null:null,'include':_0x4933dc[_0xe512('0x16')]?_0x4933dc[_0xe512('0x16')][_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x4933dc[_0xe512('0x16')]['include'],function(_0x1a819d){return{'model':db[_0x1a819d[_0xe512('0x1c')]],'as':_0x1a819d['as'],'attributes':_0x1a819d[_0xe512('0x18')],'include':_0x1a819d[_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x1a819d[_0xe512('0x1a')],function(_0x131701){return{'model':db[_0x131701[_0xe512('0x1c')]],'as':_0x131701['as'],'attributes':_0x131701[_0xe512('0x18')],'include':_0x131701[_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x131701[_0xe512('0x1a')],function(_0x3a8042){return{'model':db[_0x3a8042[_0xe512('0x1c')]],'as':_0x3a8042['as'],'attributes':_0x3a8042[_0xe512('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe512('0xa')](function(_0x435a10){logger[_0xe512('0xb')]('GetServicenowAccount',_0x4933dc);logger[_0xe512('0xe')]('GetServicenowAccount',_0x4933dc,JSON['stringify'](_0x435a10));_0xfc08e7(_0x435a10);})[_0xe512('0x14')](function(_0x29c870){logger['error'](_0xe512('0x15'),_0x29c870[_0xe512('0x13')],_0x4933dc);_0x4b37eb(_0x27a455[_0xe512('0x11')](0x1f4,_0x29c870['message']));});});};exports[_0xe512('0x1d')]=function(_0x145474){var _0x41f0ab=this;return new Promise(function(_0x4f4193,_0x1e6e03){return db[_0xe512('0x1e')]['find']({'raw':_0x145474['options']?_0x145474['options'][_0xe512('0x1f')]===undefined?!![]:![]:!![],'where':_0x145474[_0xe512('0x16')]?_0x145474[_0xe512('0x16')][_0xe512('0x17')]||null:null,'attributes':_0x145474[_0xe512('0x16')]?_0x145474['options']['attributes']||null:null,'include':_0x145474[_0xe512('0x16')]?_0x145474[_0xe512('0x16')][_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x145474[_0xe512('0x16')][_0xe512('0x1a')],function(_0x1117c0){return{'model':db[_0x1117c0[_0xe512('0x1c')]],'as':_0x1117c0['as'],'attributes':_0x1117c0[_0xe512('0x18')],'include':_0x1117c0[_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x1117c0['include'],function(_0x5b3bb3){return{'model':db[_0x5b3bb3[_0xe512('0x1c')]],'as':_0x5b3bb3['as'],'attributes':_0x5b3bb3['attributes'],'include':_0x5b3bb3[_0xe512('0x1a')]?_[_0xe512('0x1b')](_0x5b3bb3[_0xe512('0x1a')],function(_0x4511c0){return{'model':db[_0x4511c0[_0xe512('0x1c')]],'as':_0x4511c0['as'],'attributes':_0x4511c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe512('0xa')](function(_0x116cc5){logger['info'](_0xe512('0x1d'),_0x145474);logger[_0xe512('0xe')]('ShowServicenowAccount',_0x145474,JSON[_0xe512('0x10')](_0x116cc5));_0x4f4193(_0x116cc5);})[_0xe512('0x14')](function(_0x5d2ed6){logger['error']('ShowServicenowAccount',_0x5d2ed6[_0xe512('0x13')],_0x145474);_0x1e6e03(_0x41f0ab[_0xe512('0x11')](0x1f4,_0x5d2ed6[_0xe512('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 05f6c18..ed2cc18 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 _0x0d7d=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete'];(function(_0x231bcc,_0x4f9696){var _0x3c8863=function(_0x2c0118){while(--_0x2c0118){_0x231bcc['push'](_0x231bcc['shift']());}};_0x3c8863(++_0x4f9696);}(_0x0d7d,0x11d));var _0xd0d7=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0x0d7d[_0x10a904];return _0x53815a;};'use strict';var multer=require(_0xd0d7('0x0'));var util=require(_0xd0d7('0x1'));var path=require(_0xd0d7('0x2'));var timeout=require(_0xd0d7('0x3'));var express=require('express');var router=express[_0xd0d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d7('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xd0d7('0x7')](),controller[_0xd0d7('0x8')]);router[_0xd0d7('0x9')](_0xd0d7('0xa'),auth[_0xd0d7('0x7')](),controller[_0xd0d7('0xb')]);router[_0xd0d7('0x9')]('/:id/fields',auth[_0xd0d7('0x7')](),controller[_0xd0d7('0xc')]);router[_0xd0d7('0x9')](_0xd0d7('0xd'),auth[_0xd0d7('0x7')](),controller[_0xd0d7('0xe')]);router[_0xd0d7('0x9')](_0xd0d7('0xf'),auth[_0xd0d7('0x7')](),controller['getDescriptions']);router[_0xd0d7('0x10')]('/',auth[_0xd0d7('0x7')](),controller['create']);router[_0xd0d7('0x11')](_0xd0d7('0xa'),auth[_0xd0d7('0x7')](),controller['update']);router[_0xd0d7('0x12')](_0xd0d7('0xa'),auth[_0xd0d7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ade=['post','create','put','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8ade,0x180));var _0xe8ad=function(_0x49f9f9,_0x212d15){_0x49f9f9=_0x49f9f9-0x0;var _0x10c1a4=_0x8ade[_0x49f9f9];return _0x10c1a4;};'use strict';var multer=require('multer');var util=require(_0xe8ad('0x0'));var path=require(_0xe8ad('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8ad('0x2'));var router=express['Router']();var fs_extra=require(_0xe8ad('0x3'));var auth=require(_0xe8ad('0x4'));var interaction=require(_0xe8ad('0x5'));var config=require('../../config/environment');var controller=require(_0xe8ad('0x6'));router['get']('/',auth[_0xe8ad('0x7')](),controller[_0xe8ad('0x8')]);router[_0xe8ad('0x9')](_0xe8ad('0xa'),auth[_0xe8ad('0x7')](),controller[_0xe8ad('0xb')]);router[_0xe8ad('0x9')](_0xe8ad('0xc'),auth[_0xe8ad('0x7')](),controller[_0xe8ad('0xd')]);router['get'](_0xe8ad('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe8ad('0x9')](_0xe8ad('0xf'),auth[_0xe8ad('0x7')](),controller['getDescriptions']);router[_0xe8ad('0x10')]('/',auth['isAuthenticated'](),controller[_0xe8ad('0x11')]);router[_0xe8ad('0x12')]('/:id',auth[_0xe8ad('0x7')](),controller['update']);router['delete'](_0xe8ad('0xa'),auth[_0xe8ad('0x7')](),controller['destroy']);module[_0xe8ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index bda4c73..e46f07a 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 _0xc322=['sequelize','exports','STRING'];(function(_0x20cab1,_0x4f7269){var _0x3296b9=function(_0x178adf){while(--_0x178adf){_0x20cab1['push'](_0x20cab1['shift']());}};_0x3296b9(++_0x4f7269);}(_0xc322,0xb7));var _0x2c32=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xc322[_0x587fb5];return _0x551105;};'use strict';var Sequelize=require(_0x2c32('0x0'));module[_0x2c32('0x1')]={'name':{'type':Sequelize[_0x2c32('0x2')]},'description':{'type':Sequelize[_0x2c32('0x2')]}}; \ No newline at end of file +var _0x6ae1=['exports','STRING','sequelize'];(function(_0x24ddd0,_0x6a8738){var _0x442c40=function(_0x1d2fb4){while(--_0x1d2fb4){_0x24ddd0['push'](_0x24ddd0['shift']());}};_0x442c40(++_0x6a8738);}(_0x6ae1,0xf2));var _0x16ae=function(_0x566ee1,_0x21e9b5){_0x566ee1=_0x566ee1-0x0;var _0x583c27=_0x6ae1[_0x566ee1];return _0x583c27;};'use strict';var Sequelize=require(_0x16ae('0x0'));module[_0x16ae('0x1')]={'name':{'type':Sequelize[_0x16ae('0x2')]},'description':{'type':Sequelize[_0x16ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index acfe7dd..2e2eea3 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 _0x049b=['params','include','find','create','update','body','getFields','findOne','ServicenowField','nolimit','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x297ec5,_0x860cf4){var _0x367d44=function(_0x1d96b3){while(--_0x1d96b3){_0x297ec5['push'](_0x297ec5['shift']());}};_0x367d44(++_0x860cf4);}(_0x049b,0x169));var _0xb049=function(_0x4ec8db,_0x21e100){_0x4ec8db=_0x4ec8db-0x0;var _0x59a7a3=_0x049b[_0x4ec8db];return _0x59a7a3;};'use strict';var emlformat=require(_0xb049('0x0'));var rimraf=require(_0xb049('0x1'));var zipdir=require(_0xb049('0x2'));var jsonpatch=require(_0xb049('0x3'));var rp=require('request-promise');var moment=require(_0xb049('0x4'));var BPromise=require(_0xb049('0x5'));var Mustache=require(_0xb049('0x6'));var util=require(_0xb049('0x7'));var path=require(_0xb049('0x8'));var sox=require(_0xb049('0x9'));var csv=require(_0xb049('0xa'));var ejs=require(_0xb049('0xb'));var fs=require('fs');var fs_extra=require(_0xb049('0xc'));var _=require('lodash');var squel=require(_0xb049('0xd'));var crypto=require(_0xb049('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb049('0xf'));var toCsv=require(_0xb049('0xa'));var querystring=require(_0xb049('0x10'));var Papa=require(_0xb049('0x11'));var Redis=require(_0xb049('0x12'));var authService=require(_0xb049('0x13'));var qs=require(_0xb049('0x14'));var as=require(_0xb049('0x15'));var hardwareService=require(_0xb049('0x16'));var logger=require(_0xb049('0x17'))(_0xb049('0x18'));var utils=require(_0xb049('0x19'));var config=require(_0xb049('0x1a'));var licenseUtil=require(_0xb049('0x1b'));var db=require(_0xb049('0x1c'))['db'];function respondWithStatusCode(_0x10f519,_0xb3b97a){_0xb3b97a=_0xb3b97a||0xcc;return function(_0x23b58e){if(_0x23b58e){return _0x10f519[_0xb049('0x1d')](_0xb3b97a);}return _0x10f519[_0xb049('0x1e')](_0xb3b97a)[_0xb049('0x1f')]();};}function respondWithResult(_0x191720,_0x539c57){_0x539c57=_0x539c57||0xc8;return function(_0x4516f5){if(_0x4516f5){return _0x191720[_0xb049('0x1e')](_0x539c57)['json'](_0x4516f5);}};}function respondWithFilteredResult(_0x1a1eb7,_0x162829){return function(_0x214b15){if(_0x214b15){var _0x24b2c0=typeof _0x162829[_0xb049('0x20')]===_0xb049('0x21')&&typeof _0x162829[_0xb049('0x22')]===_0xb049('0x21');var _0x574f97=_0x214b15['count'];var _0x24281c=_0x24b2c0?0x0:_0x162829[_0xb049('0x20')];var _0x36bfea=_0x24b2c0?_0x214b15[_0xb049('0x23')]:_0x162829[_0xb049('0x20')]+_0x162829[_0xb049('0x22')];var _0x2c15a5;if(_0x36bfea>=_0x574f97){_0x36bfea=_0x574f97;_0x2c15a5=0xc8;}else{_0x2c15a5=0xce;}_0x1a1eb7['status'](_0x2c15a5);return _0x1a1eb7[_0xb049('0x24')](_0xb049('0x25'),_0x24281c+'-'+_0x36bfea+'/'+_0x574f97)[_0xb049('0x26')](_0x214b15);}return null;};}function patchUpdates(_0x51f357){return function(_0x33cb13){try{jsonpatch[_0xb049('0x27')](_0x33cb13,_0x51f357,!![]);}catch(_0x26cff5){return BPromise[_0xb049('0x28')](_0x26cff5);}return _0x33cb13[_0xb049('0x29')]();};}function saveUpdates(_0x176e26,_0x1246eb){return function(_0x3e5535){if(_0x3e5535){return _0x3e5535['update'](_0x176e26)[_0xb049('0x2a')](function(_0x5c77dd){return _0x5c77dd;});}return null;};}function removeEntity(_0x1569db,_0x51c4cb){return function(_0x887b1c){if(_0x887b1c){return _0x887b1c[_0xb049('0x2b')]()['then'](function(){_0x1569db[_0xb049('0x1e')](0xcc)[_0xb049('0x1f')]();});}};}function handleEntityNotFound(_0x4961c6,_0x48dbfb){return function(_0x2dc9ae){if(!_0x2dc9ae){_0x4961c6[_0xb049('0x1d')](0x194);}return _0x2dc9ae;};}function handleError(_0x109d8a,_0x35551a){_0x35551a=_0x35551a||0x1f4;return function(_0x132ac0){logger['error'](_0x132ac0['stack']);if(_0x132ac0[_0xb049('0x2c')]){delete _0x132ac0[_0xb049('0x2c')];}_0x109d8a['status'](_0x35551a)[_0xb049('0x2d')](_0x132ac0);};}exports[_0xb049('0x2e')]=function(_0x2130fb,_0x2a7cf1){var _0x2c67fb={},_0x35d42b={},_0x8e3816={'count':0x0,'rows':[]};var _0x20fe90=_[_0xb049('0x2f')](db[_0xb049('0x30')][_0xb049('0x31')],function(_0x1e2a9b){return{'name':_0x1e2a9b[_0xb049('0x32')],'type':_0x1e2a9b[_0xb049('0x33')][_0xb049('0x34')]};});_0x35d42b[_0xb049('0x35')]=_[_0xb049('0x2f')](_0x20fe90,_0xb049('0x2c'));_0x35d42b[_0xb049('0x36')]=_[_0xb049('0x37')](_0x2130fb[_0xb049('0x36')]);_0x35d42b['filters']=_[_0xb049('0x38')](_0x35d42b[_0xb049('0x35')],_0x35d42b[_0xb049('0x36')]);_0x2c67fb[_0xb049('0x39')]=_[_0xb049('0x38')](_0x35d42b[_0xb049('0x35')],qs[_0xb049('0x3a')](_0x2130fb['query']['fields']));_0x2c67fb[_0xb049('0x39')]=_0x2c67fb['attributes'][_0xb049('0x3b')]?_0x2c67fb[_0xb049('0x39')]:_0x35d42b[_0xb049('0x35')];if(!_0x2130fb[_0xb049('0x36')][_0xb049('0x3c')]('nolimit')){_0x2c67fb['limit']=qs[_0xb049('0x22')](_0x2130fb['query'][_0xb049('0x22')]);_0x2c67fb[_0xb049('0x20')]=qs[_0xb049('0x20')](_0x2130fb['query']['offset']);}_0x2c67fb[_0xb049('0x3d')]=qs[_0xb049('0x3e')](_0x2130fb[_0xb049('0x36')]['sort']);_0x2c67fb['where']=qs['filters'](_['pick'](_0x2130fb['query'],_0x35d42b[_0xb049('0x3f')]),_0x20fe90);if(_0x2130fb[_0xb049('0x36')][_0xb049('0x40')]){_0x2c67fb[_0xb049('0x41')]=_[_0xb049('0x42')](_0x2c67fb['where'],{'$or':_[_0xb049('0x2f')](_0x20fe90,function(_0x48c8b2){if(_0x48c8b2['type']!==_0xb049('0x43')){var _0x5730f4={};_0x5730f4[_0x48c8b2[_0xb049('0x2c')]]={'$like':'%'+_0x2130fb[_0xb049('0x36')][_0xb049('0x40')]+'%'};return _0x5730f4;}})});}_0x2c67fb=_[_0xb049('0x42')]({},_0x2c67fb,_0x2130fb[_0xb049('0x44')]);var _0x5bbeb6={'where':_0x2c67fb[_0xb049('0x41')]};return db['ServicenowConfiguration']['count'](_0x5bbeb6)[_0xb049('0x2a')](function(_0x12a382){_0x8e3816[_0xb049('0x23')]=_0x12a382;if(_0x2130fb[_0xb049('0x36')][_0xb049('0x45')]){_0x2c67fb['include']=[{'all':!![]}];}return db[_0xb049('0x30')][_0xb049('0x46')](_0x2c67fb);})[_0xb049('0x2a')](function(_0x4f0da){_0x8e3816[_0xb049('0x47')]=_0x4f0da;return _0x8e3816;})[_0xb049('0x2a')](respondWithFilteredResult(_0x2a7cf1,_0x2c67fb))[_0xb049('0x48')](handleError(_0x2a7cf1,null));};exports[_0xb049('0x49')]=function(_0x3f447e,_0x3dc3aa){var _0x48fb87={'raw':![],'where':{'id':_0x3f447e[_0xb049('0x4a')]['id']}},_0x1a5ce3={};_0x1a5ce3[_0xb049('0x35')]=_[_0xb049('0x37')](db[_0xb049('0x30')][_0xb049('0x31')]);_0x1a5ce3[_0xb049('0x36')]=_[_0xb049('0x37')](_0x3f447e[_0xb049('0x36')]);_0x1a5ce3[_0xb049('0x3f')]=_[_0xb049('0x38')](_0x1a5ce3[_0xb049('0x35')],_0x1a5ce3['query']);_0x48fb87[_0xb049('0x39')]=_[_0xb049('0x38')](_0x1a5ce3[_0xb049('0x35')],qs[_0xb049('0x3a')](_0x3f447e[_0xb049('0x36')][_0xb049('0x3a')]));_0x48fb87[_0xb049('0x39')]=_0x48fb87['attributes'][_0xb049('0x3b')]?_0x48fb87[_0xb049('0x39')]:_0x1a5ce3['model'];if(_0x3f447e['query'][_0xb049('0x45')]){_0x48fb87[_0xb049('0x4b')]=[{'all':!![]}];}_0x48fb87=_['merge']({},_0x48fb87,_0x3f447e[_0xb049('0x44')]);return db[_0xb049('0x30')][_0xb049('0x4c')](_0x48fb87)[_0xb049('0x2a')](handleEntityNotFound(_0x3dc3aa,null))['then'](respondWithResult(_0x3dc3aa,null))['catch'](handleError(_0x3dc3aa,null));};exports[_0xb049('0x4d')]=function(_0x5df69d,_0x1a58fb){return db[_0xb049('0x30')][_0xb049('0x4d')](_0x5df69d['body'],{})[_0xb049('0x2a')](respondWithResult(_0x1a58fb,0xc9))[_0xb049('0x48')](handleError(_0x1a58fb,null));};exports[_0xb049('0x4e')]=function(_0x5788f0,_0x423119){if(_0x5788f0['body']['id']){delete _0x5788f0[_0xb049('0x4f')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x5788f0[_0xb049('0x4a')]['id']}})[_0xb049('0x2a')](handleEntityNotFound(_0x423119,null))[_0xb049('0x2a')](saveUpdates(_0x5788f0[_0xb049('0x4f')],null))[_0xb049('0x2a')](respondWithResult(_0x423119,null))[_0xb049('0x48')](handleError(_0x423119,null));};exports['destroy']=function(_0xe2473c,_0x4f7447){return db['ServicenowConfiguration'][_0xb049('0x4c')]({'where':{'id':_0xe2473c[_0xb049('0x4a')]['id']}})[_0xb049('0x2a')](handleEntityNotFound(_0x4f7447,null))['then'](removeEntity(_0x4f7447,null))[_0xb049('0x48')](handleError(_0x4f7447,null));};exports[_0xb049('0x50')]=function(_0x39ab11,_0x1f3873,_0x1076a8){var _0x4fc8dd={};var _0xac2880={};var _0x5c5947;var _0xd5601d;return db[_0xb049('0x30')][_0xb049('0x51')]({'where':{'id':_0x39ab11[_0xb049('0x4a')]['id']}})[_0xb049('0x2a')](handleEntityNotFound(_0x1f3873,null))[_0xb049('0x2a')](function(_0x1080ab){if(_0x1080ab){_0x5c5947=_0x1080ab;_0xac2880[_0xb049('0x35')]=_[_0xb049('0x37')](db[_0xb049('0x52')][_0xb049('0x31')]);_0xac2880[_0xb049('0x36')]=_['keys'](_0x39ab11['query']);_0xac2880[_0xb049('0x3f')]=_[_0xb049('0x38')](_0xac2880[_0xb049('0x35')],_0xac2880['query']);_0x4fc8dd[_0xb049('0x39')]=_[_0xb049('0x38')](_0xac2880[_0xb049('0x35')],qs['fields'](_0x39ab11[_0xb049('0x36')]['fields']));_0x4fc8dd['attributes']=_0x4fc8dd['attributes'][_0xb049('0x3b')]?_0x4fc8dd[_0xb049('0x39')]:_0xac2880[_0xb049('0x35')];_0x4fc8dd[_0xb049('0x3d')]=qs[_0xb049('0x3e')](_0x39ab11['query']['sort']);_0x4fc8dd['where']=qs[_0xb049('0x3f')](_['pick'](_0x39ab11[_0xb049('0x36')],_0xac2880['filters']));if(_0x39ab11[_0xb049('0x36')][_0xb049('0x40')]){_0x4fc8dd[_0xb049('0x41')]=_[_0xb049('0x42')](_0x4fc8dd[_0xb049('0x41')],{'$or':_['map'](_0x4fc8dd['attributes'],function(_0x360505){var _0x249d62={};_0x249d62[_0x360505]={'$like':'%'+_0x39ab11[_0xb049('0x36')][_0xb049('0x40')]+'%'};return _0x249d62;})});}_0x4fc8dd=_[_0xb049('0x42')]({},_0x4fc8dd,_0x39ab11['options']);return _0x5c5947['getFields'](_0x4fc8dd);}})['then'](function(_0x38c703){if(_0x38c703){_0xd5601d=_0x38c703[_0xb049('0x3b')];if(!_0x39ab11[_0xb049('0x36')]['hasOwnProperty'](_0xb049('0x53'))){_0x4fc8dd['limit']=qs[_0xb049('0x22')](_0x39ab11[_0xb049('0x36')][_0xb049('0x22')]);_0x4fc8dd[_0xb049('0x20')]=qs[_0xb049('0x20')](_0x39ab11['query'][_0xb049('0x20')]);}return _0x5c5947[_0xb049('0x50')](_0x4fc8dd);}})[_0xb049('0x2a')](function(_0xba19c1){if(_0xba19c1){return _0xba19c1?{'count':_0xd5601d,'rows':_0xba19c1}:null;}})['then'](respondWithResult(_0x1f3873,null))[_0xb049('0x48')](handleError(_0x1f3873,null));};exports[_0xb049('0x54')]=function(_0x38ea55,_0x2513db,_0x2973fe){var _0x17b453={};var _0x48136f={};var _0x3f2c76;var _0x4b03ff;return db['ServicenowConfiguration'][_0xb049('0x51')]({'where':{'id':_0x38ea55[_0xb049('0x4a')]['id']}})[_0xb049('0x2a')](handleEntityNotFound(_0x2513db,null))[_0xb049('0x2a')](function(_0x164092){if(_0x164092){_0x3f2c76=_0x164092;_0x48136f[_0xb049('0x35')]=_[_0xb049('0x37')](db[_0xb049('0x52')][_0xb049('0x31')]);_0x48136f['query']=_[_0xb049('0x37')](_0x38ea55[_0xb049('0x36')]);_0x48136f['filters']=_[_0xb049('0x38')](_0x48136f['model'],_0x48136f[_0xb049('0x36')]);_0x17b453[_0xb049('0x39')]=_['intersection'](_0x48136f['model'],qs[_0xb049('0x3a')](_0x38ea55[_0xb049('0x36')][_0xb049('0x3a')]));_0x17b453[_0xb049('0x39')]=_0x17b453[_0xb049('0x39')][_0xb049('0x3b')]?_0x17b453['attributes']:_0x48136f[_0xb049('0x35')];_0x17b453[_0xb049('0x3d')]=qs[_0xb049('0x3e')](_0x38ea55[_0xb049('0x36')][_0xb049('0x3e')]);_0x17b453[_0xb049('0x41')]=qs[_0xb049('0x3f')](_[_0xb049('0x55')](_0x38ea55[_0xb049('0x36')],_0x48136f['filters']));if(_0x38ea55[_0xb049('0x36')][_0xb049('0x40')]){_0x17b453['where']=_[_0xb049('0x42')](_0x17b453['where'],{'$or':_[_0xb049('0x2f')](_0x17b453[_0xb049('0x39')],function(_0x18f4db){var _0x12006d={};_0x12006d[_0x18f4db]={'$like':'%'+_0x38ea55[_0xb049('0x36')]['filter']+'%'};return _0x12006d;})});}_0x17b453=_['merge']({},_0x17b453,_0x38ea55[_0xb049('0x44')]);return _0x3f2c76['getSubjects'](_0x17b453);}})[_0xb049('0x2a')](function(_0x5e9f1d){if(_0x5e9f1d){_0x4b03ff=_0x5e9f1d[_0xb049('0x3b')];if(!_0x38ea55[_0xb049('0x36')][_0xb049('0x3c')](_0xb049('0x53'))){_0x17b453['limit']=qs[_0xb049('0x22')](_0x38ea55['query']['limit']);_0x17b453[_0xb049('0x20')]=qs[_0xb049('0x20')](_0x38ea55['query']['offset']);}return _0x3f2c76[_0xb049('0x54')](_0x17b453);}})['then'](function(_0x859da1){if(_0x859da1){return _0x859da1?{'count':_0x4b03ff,'rows':_0x859da1}:null;}})[_0xb049('0x2a')](respondWithResult(_0x2513db,null))['catch'](handleError(_0x2513db,null));};exports[_0xb049('0x56')]=function(_0x563ca3,_0x59e6d7,_0x4e0ea1){var _0x53d33a={};var _0x3603af={};var _0x5e0e02;var _0x3815d6;return db[_0xb049('0x30')]['findOne']({'where':{'id':_0x563ca3[_0xb049('0x4a')]['id']}})[_0xb049('0x2a')](handleEntityNotFound(_0x59e6d7,null))[_0xb049('0x2a')](function(_0x263c29){if(_0x263c29){_0x5e0e02=_0x263c29;_0x3603af['model']=_[_0xb049('0x37')](db[_0xb049('0x52')][_0xb049('0x31')]);_0x3603af[_0xb049('0x36')]=_[_0xb049('0x37')](_0x563ca3[_0xb049('0x36')]);_0x3603af[_0xb049('0x3f')]=_[_0xb049('0x38')](_0x3603af['model'],_0x3603af['query']);_0x53d33a[_0xb049('0x39')]=_[_0xb049('0x38')](_0x3603af['model'],qs[_0xb049('0x3a')](_0x563ca3[_0xb049('0x36')][_0xb049('0x3a')]));_0x53d33a[_0xb049('0x39')]=_0x53d33a[_0xb049('0x39')][_0xb049('0x3b')]?_0x53d33a[_0xb049('0x39')]:_0x3603af['model'];_0x53d33a[_0xb049('0x3d')]=qs[_0xb049('0x3e')](_0x563ca3[_0xb049('0x36')][_0xb049('0x3e')]);_0x53d33a[_0xb049('0x41')]=qs['filters'](_[_0xb049('0x55')](_0x563ca3[_0xb049('0x36')],_0x3603af[_0xb049('0x3f')]));if(_0x563ca3[_0xb049('0x36')][_0xb049('0x40')]){_0x53d33a[_0xb049('0x41')]=_[_0xb049('0x42')](_0x53d33a[_0xb049('0x41')],{'$or':_[_0xb049('0x2f')](_0x53d33a[_0xb049('0x39')],function(_0x236183){var _0x260586={};_0x260586[_0x236183]={'$like':'%'+_0x563ca3[_0xb049('0x36')][_0xb049('0x40')]+'%'};return _0x260586;})});}_0x53d33a=_['merge']({},_0x53d33a,_0x563ca3[_0xb049('0x44')]);return _0x5e0e02[_0xb049('0x56')](_0x53d33a);}})['then'](function(_0x24c659){if(_0x24c659){_0x3815d6=_0x24c659[_0xb049('0x3b')];if(!_0x563ca3['query'][_0xb049('0x3c')](_0xb049('0x53'))){_0x53d33a[_0xb049('0x22')]=qs[_0xb049('0x22')](_0x563ca3['query'][_0xb049('0x22')]);_0x53d33a['offset']=qs[_0xb049('0x20')](_0x563ca3[_0xb049('0x36')][_0xb049('0x20')]);}return _0x5e0e02[_0xb049('0x56')](_0x53d33a);}})['then'](function(_0x2282cd){if(_0x2282cd){return _0x2282cd?{'count':_0x3815d6,'rows':_0x2282cd}:null;}})[_0xb049('0x2a')](respondWithResult(_0x59e6d7,null))[_0xb049('0x48')](handleError(_0x59e6d7,null));}; \ No newline at end of file +var _0x3c38=['Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','length','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','catch','show','params','fields','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','status'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3c38,0x1b8));var _0x83c3=function(_0x35b378,_0x35674d){_0x35b378=_0x35b378-0x0;var _0x592edd=_0x3c38[_0x35b378];return _0x592edd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83c3('0x1'));var rp=require(_0x83c3('0x2'));var moment=require(_0x83c3('0x3'));var BPromise=require(_0x83c3('0x4'));var Mustache=require(_0x83c3('0x5'));var util=require('util');var path=require(_0x83c3('0x6'));var sox=require(_0x83c3('0x7'));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(_0x83c3('0x8'));var crypto=require(_0x83c3('0x9'));var jsforce=require(_0x83c3('0xa'));var deskjs=require(_0x83c3('0xb'));var toCsv=require(_0x83c3('0xc'));var querystring=require('querystring');var Papa=require(_0x83c3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83c3('0xe'));var as=require(_0x83c3('0xf'));var hardwareService=require(_0x83c3('0x10'));var logger=require(_0x83c3('0x11'))(_0x83c3('0x12'));var utils=require(_0x83c3('0x13'));var config=require(_0x83c3('0x14'));var licenseUtil=require(_0x83c3('0x15'));var db=require(_0x83c3('0x16'))['db'];function respondWithStatusCode(_0xdeeb17,_0x51e795){_0x51e795=_0x51e795||0xcc;return function(_0x304c5d){if(_0x304c5d){return _0xdeeb17['sendStatus'](_0x51e795);}return _0xdeeb17['status'](_0x51e795)[_0x83c3('0x17')]();};}function respondWithResult(_0x39221e,_0x4baaa0){_0x4baaa0=_0x4baaa0||0xc8;return function(_0x2835c7){if(_0x2835c7){return _0x39221e['status'](_0x4baaa0)['json'](_0x2835c7);}};}function respondWithFilteredResult(_0x44833a,_0x401f43){return function(_0x41d4e6){if(_0x41d4e6){var _0x4dcbf6=typeof _0x401f43[_0x83c3('0x18')]===_0x83c3('0x19')&&typeof _0x401f43[_0x83c3('0x1a')]===_0x83c3('0x19');var _0x520fe6=_0x41d4e6['count'];var _0x53fa03=_0x4dcbf6?0x0:_0x401f43[_0x83c3('0x18')];var _0x16d4d0=_0x4dcbf6?_0x41d4e6['count']:_0x401f43['offset']+_0x401f43[_0x83c3('0x1a')];var _0x1eff82;if(_0x16d4d0>=_0x520fe6){_0x16d4d0=_0x520fe6;_0x1eff82=0xc8;}else{_0x1eff82=0xce;}_0x44833a[_0x83c3('0x1b')](_0x1eff82);return _0x44833a['set'](_0x83c3('0x1c'),_0x53fa03+'-'+_0x16d4d0+'/'+_0x520fe6)[_0x83c3('0x1d')](_0x41d4e6);}return null;};}function patchUpdates(_0x49be6a){return function(_0x1408cd){try{jsonpatch['apply'](_0x1408cd,_0x49be6a,!![]);}catch(_0xdc688){return BPromise[_0x83c3('0x1e')](_0xdc688);}return _0x1408cd[_0x83c3('0x1f')]();};}function saveUpdates(_0x8f5793,_0x243599){return function(_0x25dc8d){if(_0x25dc8d){return _0x25dc8d[_0x83c3('0x20')](_0x8f5793)[_0x83c3('0x21')](function(_0xce6f41){return _0xce6f41;});}return null;};}function removeEntity(_0x1d8e89,_0x3bfc3){return function(_0x22bc2c){if(_0x22bc2c){return _0x22bc2c[_0x83c3('0x22')]()[_0x83c3('0x21')](function(){_0x1d8e89['status'](0xcc)[_0x83c3('0x17')]();});}};}function handleEntityNotFound(_0x391732,_0x23dc00){return function(_0x45f95e){if(!_0x45f95e){_0x391732['sendStatus'](0x194);}return _0x45f95e;};}function handleError(_0x547db9,_0x29c2fb){_0x29c2fb=_0x29c2fb||0x1f4;return function(_0x38cfa5){logger[_0x83c3('0x23')](_0x38cfa5[_0x83c3('0x24')]);if(_0x38cfa5[_0x83c3('0x25')]){delete _0x38cfa5[_0x83c3('0x25')];}_0x547db9['status'](_0x29c2fb)[_0x83c3('0x26')](_0x38cfa5);};}exports[_0x83c3('0x27')]=function(_0x4f07e5,_0x4be265){var _0x1c1608={},_0x296a35={},_0x59a265={'count':0x0,'rows':[]};var _0x501429=_['map'](db[_0x83c3('0x28')][_0x83c3('0x29')],function(_0x3036d1){return{'name':_0x3036d1[_0x83c3('0x2a')],'type':_0x3036d1['type'][_0x83c3('0x2b')]};});_0x296a35['model']=_[_0x83c3('0x2c')](_0x501429,'name');_0x296a35['query']=_[_0x83c3('0x2d')](_0x4f07e5[_0x83c3('0x2e')]);_0x296a35[_0x83c3('0x2f')]=_[_0x83c3('0x30')](_0x296a35[_0x83c3('0x31')],_0x296a35['query']);_0x1c1608[_0x83c3('0x32')]=_['intersection'](_0x296a35[_0x83c3('0x31')],qs['fields'](_0x4f07e5['query']['fields']));_0x1c1608[_0x83c3('0x32')]=_0x1c1608[_0x83c3('0x32')][_0x83c3('0x33')]?_0x1c1608['attributes']:_0x296a35[_0x83c3('0x31')];if(!_0x4f07e5['query']['hasOwnProperty']('nolimit')){_0x1c1608['limit']=qs[_0x83c3('0x1a')](_0x4f07e5[_0x83c3('0x2e')]['limit']);_0x1c1608[_0x83c3('0x18')]=qs[_0x83c3('0x18')](_0x4f07e5[_0x83c3('0x2e')]['offset']);}_0x1c1608[_0x83c3('0x34')]=qs[_0x83c3('0x35')](_0x4f07e5[_0x83c3('0x2e')]['sort']);_0x1c1608[_0x83c3('0x36')]=qs[_0x83c3('0x2f')](_[_0x83c3('0x37')](_0x4f07e5[_0x83c3('0x2e')],_0x296a35['filters']),_0x501429);if(_0x4f07e5[_0x83c3('0x2e')][_0x83c3('0x38')]){_0x1c1608['where']=_[_0x83c3('0x39')](_0x1c1608[_0x83c3('0x36')],{'$or':_[_0x83c3('0x2c')](_0x501429,function(_0x24cf8d){if(_0x24cf8d[_0x83c3('0x3a')]!=='VIRTUAL'){var _0x179f5b={};_0x179f5b[_0x24cf8d[_0x83c3('0x25')]]={'$like':'%'+_0x4f07e5[_0x83c3('0x2e')][_0x83c3('0x38')]+'%'};return _0x179f5b;}})});}_0x1c1608=_[_0x83c3('0x39')]({},_0x1c1608,_0x4f07e5[_0x83c3('0x3b')]);var _0x27bc5a={'where':_0x1c1608['where']};return db[_0x83c3('0x28')][_0x83c3('0x3c')](_0x27bc5a)[_0x83c3('0x21')](function(_0xd542bf){_0x59a265[_0x83c3('0x3c')]=_0xd542bf;if(_0x4f07e5[_0x83c3('0x2e')][_0x83c3('0x3d')]){_0x1c1608[_0x83c3('0x3e')]=[{'all':!![]}];}return db[_0x83c3('0x28')][_0x83c3('0x3f')](_0x1c1608);})['then'](function(_0x335f1a){_0x59a265['rows']=_0x335f1a;return _0x59a265;})['then'](respondWithFilteredResult(_0x4be265,_0x1c1608))[_0x83c3('0x40')](handleError(_0x4be265,null));};exports[_0x83c3('0x41')]=function(_0x323a12,_0x4e4289){var _0x15de29={'raw':![],'where':{'id':_0x323a12[_0x83c3('0x42')]['id']}},_0x4b78a6={};_0x4b78a6[_0x83c3('0x31')]=_[_0x83c3('0x2d')](db[_0x83c3('0x28')]['rawAttributes']);_0x4b78a6[_0x83c3('0x2e')]=_[_0x83c3('0x2d')](_0x323a12[_0x83c3('0x2e')]);_0x4b78a6[_0x83c3('0x2f')]=_[_0x83c3('0x30')](_0x4b78a6[_0x83c3('0x31')],_0x4b78a6['query']);_0x15de29['attributes']=_['intersection'](_0x4b78a6[_0x83c3('0x31')],qs[_0x83c3('0x43')](_0x323a12['query'][_0x83c3('0x43')]));_0x15de29['attributes']=_0x15de29[_0x83c3('0x32')][_0x83c3('0x33')]?_0x15de29['attributes']:_0x4b78a6[_0x83c3('0x31')];if(_0x323a12[_0x83c3('0x2e')][_0x83c3('0x3d')]){_0x15de29[_0x83c3('0x3e')]=[{'all':!![]}];}_0x15de29=_[_0x83c3('0x39')]({},_0x15de29,_0x323a12[_0x83c3('0x3b')]);return db[_0x83c3('0x28')][_0x83c3('0x44')](_0x15de29)['then'](handleEntityNotFound(_0x4e4289,null))[_0x83c3('0x21')](respondWithResult(_0x4e4289,null))[_0x83c3('0x40')](handleError(_0x4e4289,null));};exports[_0x83c3('0x45')]=function(_0x1e83d5,_0x112b03){return db[_0x83c3('0x28')]['create'](_0x1e83d5[_0x83c3('0x46')],{})[_0x83c3('0x21')](respondWithResult(_0x112b03,0xc9))[_0x83c3('0x40')](handleError(_0x112b03,null));};exports[_0x83c3('0x20')]=function(_0x118b26,_0x2f3068){if(_0x118b26[_0x83c3('0x46')]['id']){delete _0x118b26[_0x83c3('0x46')]['id'];}return db[_0x83c3('0x28')][_0x83c3('0x44')]({'where':{'id':_0x118b26['params']['id']}})['then'](handleEntityNotFound(_0x2f3068,null))[_0x83c3('0x21')](saveUpdates(_0x118b26[_0x83c3('0x46')],null))[_0x83c3('0x21')](respondWithResult(_0x2f3068,null))[_0x83c3('0x40')](handleError(_0x2f3068,null));};exports['destroy']=function(_0x1cd181,_0x2d6049){return db[_0x83c3('0x28')][_0x83c3('0x44')]({'where':{'id':_0x1cd181[_0x83c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6049,null))['then'](removeEntity(_0x2d6049,null))[_0x83c3('0x40')](handleError(_0x2d6049,null));};exports[_0x83c3('0x47')]=function(_0x2f36a4,_0x422094,_0x105fb9){var _0x1cf800={};var _0x5ba801={};var _0x107ddf;var _0x372eb7;return db[_0x83c3('0x28')][_0x83c3('0x48')]({'where':{'id':_0x2f36a4[_0x83c3('0x42')]['id']}})[_0x83c3('0x21')](handleEntityNotFound(_0x422094,null))[_0x83c3('0x21')](function(_0x56338d){if(_0x56338d){_0x107ddf=_0x56338d;_0x5ba801['model']=_[_0x83c3('0x2d')](db[_0x83c3('0x49')][_0x83c3('0x29')]);_0x5ba801[_0x83c3('0x2e')]=_[_0x83c3('0x2d')](_0x2f36a4[_0x83c3('0x2e')]);_0x5ba801[_0x83c3('0x2f')]=_[_0x83c3('0x30')](_0x5ba801[_0x83c3('0x31')],_0x5ba801[_0x83c3('0x2e')]);_0x1cf800['attributes']=_[_0x83c3('0x30')](_0x5ba801[_0x83c3('0x31')],qs['fields'](_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x43')]));_0x1cf800[_0x83c3('0x32')]=_0x1cf800[_0x83c3('0x32')]['length']?_0x1cf800['attributes']:_0x5ba801[_0x83c3('0x31')];_0x1cf800[_0x83c3('0x34')]=qs[_0x83c3('0x35')](_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x35')]);_0x1cf800[_0x83c3('0x36')]=qs['filters'](_[_0x83c3('0x37')](_0x2f36a4[_0x83c3('0x2e')],_0x5ba801[_0x83c3('0x2f')]));if(_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x38')]){_0x1cf800[_0x83c3('0x36')]=_[_0x83c3('0x39')](_0x1cf800[_0x83c3('0x36')],{'$or':_[_0x83c3('0x2c')](_0x1cf800['attributes'],function(_0x166618){var _0x24924c={};_0x24924c[_0x166618]={'$like':'%'+_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x38')]+'%'};return _0x24924c;})});}_0x1cf800=_[_0x83c3('0x39')]({},_0x1cf800,_0x2f36a4[_0x83c3('0x3b')]);return _0x107ddf['getFields'](_0x1cf800);}})[_0x83c3('0x21')](function(_0x3d1a59){if(_0x3d1a59){_0x372eb7=_0x3d1a59[_0x83c3('0x33')];if(!_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x4a')]('nolimit')){_0x1cf800['limit']=qs['limit'](_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x1a')]);_0x1cf800['offset']=qs['offset'](_0x2f36a4[_0x83c3('0x2e')][_0x83c3('0x18')]);}return _0x107ddf[_0x83c3('0x47')](_0x1cf800);}})[_0x83c3('0x21')](function(_0x3acaf7){if(_0x3acaf7){return _0x3acaf7?{'count':_0x372eb7,'rows':_0x3acaf7}:null;}})['then'](respondWithResult(_0x422094,null))['catch'](handleError(_0x422094,null));};exports[_0x83c3('0x4b')]=function(_0x5480c7,_0x1e0559,_0x22fc0f){var _0x13a4f6={};var _0x318677={};var _0x31f6b5;var _0x4ad9d;return db[_0x83c3('0x28')][_0x83c3('0x48')]({'where':{'id':_0x5480c7['params']['id']}})[_0x83c3('0x21')](handleEntityNotFound(_0x1e0559,null))['then'](function(_0x278801){if(_0x278801){_0x31f6b5=_0x278801;_0x318677['model']=_[_0x83c3('0x2d')](db['ServicenowField'][_0x83c3('0x29')]);_0x318677[_0x83c3('0x2e')]=_['keys'](_0x5480c7[_0x83c3('0x2e')]);_0x318677[_0x83c3('0x2f')]=_['intersection'](_0x318677[_0x83c3('0x31')],_0x318677['query']);_0x13a4f6[_0x83c3('0x32')]=_[_0x83c3('0x30')](_0x318677['model'],qs['fields'](_0x5480c7[_0x83c3('0x2e')]['fields']));_0x13a4f6[_0x83c3('0x32')]=_0x13a4f6[_0x83c3('0x32')]['length']?_0x13a4f6['attributes']:_0x318677[_0x83c3('0x31')];_0x13a4f6[_0x83c3('0x34')]=qs['sort'](_0x5480c7[_0x83c3('0x2e')][_0x83c3('0x35')]);_0x13a4f6[_0x83c3('0x36')]=qs[_0x83c3('0x2f')](_[_0x83c3('0x37')](_0x5480c7[_0x83c3('0x2e')],_0x318677[_0x83c3('0x2f')]));if(_0x5480c7['query']['filter']){_0x13a4f6[_0x83c3('0x36')]=_[_0x83c3('0x39')](_0x13a4f6[_0x83c3('0x36')],{'$or':_[_0x83c3('0x2c')](_0x13a4f6[_0x83c3('0x32')],function(_0x503481){var _0x14cae2={};_0x14cae2[_0x503481]={'$like':'%'+_0x5480c7['query'][_0x83c3('0x38')]+'%'};return _0x14cae2;})});}_0x13a4f6=_[_0x83c3('0x39')]({},_0x13a4f6,_0x5480c7[_0x83c3('0x3b')]);return _0x31f6b5[_0x83c3('0x4b')](_0x13a4f6);}})[_0x83c3('0x21')](function(_0x3774e6){if(_0x3774e6){_0x4ad9d=_0x3774e6['length'];if(!_0x5480c7[_0x83c3('0x2e')][_0x83c3('0x4a')]('nolimit')){_0x13a4f6[_0x83c3('0x1a')]=qs['limit'](_0x5480c7[_0x83c3('0x2e')]['limit']);_0x13a4f6[_0x83c3('0x18')]=qs[_0x83c3('0x18')](_0x5480c7[_0x83c3('0x2e')][_0x83c3('0x18')]);}return _0x31f6b5[_0x83c3('0x4b')](_0x13a4f6);}})[_0x83c3('0x21')](function(_0x3738ee){if(_0x3738ee){return _0x3738ee?{'count':_0x4ad9d,'rows':_0x3738ee}:null;}})[_0x83c3('0x21')](respondWithResult(_0x1e0559,null))[_0x83c3('0x40')](handleError(_0x1e0559,null));};exports[_0x83c3('0x4c')]=function(_0x304b96,_0x27616e,_0x2fbabb){var _0x19fda3={};var _0x28a21e={};var _0xa3a533;var _0x308bad;return db[_0x83c3('0x28')][_0x83c3('0x48')]({'where':{'id':_0x304b96[_0x83c3('0x42')]['id']}})[_0x83c3('0x21')](handleEntityNotFound(_0x27616e,null))[_0x83c3('0x21')](function(_0x59349d){if(_0x59349d){_0xa3a533=_0x59349d;_0x28a21e[_0x83c3('0x31')]=_[_0x83c3('0x2d')](db[_0x83c3('0x49')][_0x83c3('0x29')]);_0x28a21e[_0x83c3('0x2e')]=_[_0x83c3('0x2d')](_0x304b96[_0x83c3('0x2e')]);_0x28a21e[_0x83c3('0x2f')]=_[_0x83c3('0x30')](_0x28a21e[_0x83c3('0x31')],_0x28a21e[_0x83c3('0x2e')]);_0x19fda3['attributes']=_['intersection'](_0x28a21e[_0x83c3('0x31')],qs[_0x83c3('0x43')](_0x304b96[_0x83c3('0x2e')][_0x83c3('0x43')]));_0x19fda3[_0x83c3('0x32')]=_0x19fda3[_0x83c3('0x32')][_0x83c3('0x33')]?_0x19fda3['attributes']:_0x28a21e[_0x83c3('0x31')];_0x19fda3[_0x83c3('0x34')]=qs['sort'](_0x304b96[_0x83c3('0x2e')][_0x83c3('0x35')]);_0x19fda3['where']=qs['filters'](_['pick'](_0x304b96[_0x83c3('0x2e')],_0x28a21e[_0x83c3('0x2f')]));if(_0x304b96['query']['filter']){_0x19fda3[_0x83c3('0x36')]=_[_0x83c3('0x39')](_0x19fda3[_0x83c3('0x36')],{'$or':_['map'](_0x19fda3[_0x83c3('0x32')],function(_0xc331a7){var _0x48f11c={};_0x48f11c[_0xc331a7]={'$like':'%'+_0x304b96[_0x83c3('0x2e')][_0x83c3('0x38')]+'%'};return _0x48f11c;})});}_0x19fda3=_[_0x83c3('0x39')]({},_0x19fda3,_0x304b96['options']);return _0xa3a533[_0x83c3('0x4c')](_0x19fda3);}})['then'](function(_0x3e512c){if(_0x3e512c){_0x308bad=_0x3e512c[_0x83c3('0x33')];if(!_0x304b96[_0x83c3('0x2e')]['hasOwnProperty'](_0x83c3('0x4d'))){_0x19fda3[_0x83c3('0x1a')]=qs['limit'](_0x304b96[_0x83c3('0x2e')]['limit']);_0x19fda3[_0x83c3('0x18')]=qs[_0x83c3('0x18')](_0x304b96[_0x83c3('0x2e')][_0x83c3('0x18')]);}return _0xa3a533['getDescriptions'](_0x19fda3);}})[_0x83c3('0x21')](function(_0x65392d){if(_0x65392d){return _0x65392d?{'count':_0x308bad,'rows':_0x65392d}:null;}})[_0x83c3('0x21')](respondWithResult(_0x27616e,null))[_0x83c3('0x40')](handleError(_0x27616e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index aa83d2f..c5f24c4 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 _0x7033=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1e916e,_0x1fe905){var _0x43c506=function(_0x58a1fd){while(--_0x58a1fd){_0x1e916e['push'](_0x1e916e['shift']());}};_0x43c506(++_0x1fe905);}(_0x7033,0x19e));var _0x3703=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7033[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var logger=require(_0x3703('0x2'))(_0x3703('0x3'));var moment=require('moment');var BPromise=require(_0x3703('0x4'));var rp=require(_0x3703('0x5'));var fs=require('fs');var path=require(_0x3703('0x6'));var rimraf=require(_0x3703('0x7'));var config=require(_0x3703('0x8'));var attributes=require(_0x3703('0x9'));module[_0x3703('0xa')]=function(_0x283af9,_0x1170b6){return _0x283af9[_0x3703('0xb')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1219=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x37df82,_0x353a89){var _0x4c74c9=function(_0x32bf62){while(--_0x32bf62){_0x37df82['push'](_0x37df82['shift']());}};_0x4c74c9(++_0x353a89);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var logger=require(_0x9121('0x2'))(_0x9121('0x3'));var moment=require(_0x9121('0x4'));var BPromise=require('bluebird');var rp=require(_0x9121('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var attributes=require(_0x9121('0x8'));module[_0x9121('0x9')]=function(_0x420b62,_0x430583){return _0x420b62[_0x9121('0xa')](_0x9121('0xb'),attributes,{'tableName':_0x9121('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 425c20a..88dc808 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 _0x9790=['jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x47689e,_0x2d78b2){var _0x146791=function(_0x216e36){while(--_0x216e36){_0x47689e['push'](_0x47689e['shift']());}};_0x146791(++_0x2d78b2);}(_0x9790,0xc1));var _0x0979=function(_0x48a49d,_0x5000e0){_0x48a49d=_0x48a49d-0x0;var _0x2a123f=_0x9790[_0x48a49d];return _0x2a123f;};'use strict';var _=require(_0x0979('0x0'));var util=require(_0x0979('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0979('0x2'));var fs=require('fs');var Redis=require(_0x0979('0x3'));var db=require(_0x0979('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0979('0x5'))('rpc');var config=require(_0x0979('0x6'));var jayson=require(_0x0979('0x7'));var client=jayson[_0x0979('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fe6d8,_0x1e1a30,_0x10dce7){return new BPromise(function(_0x30da8d,_0x2322fd){return client[_0x0979('0x9')](_0x1fe6d8,_0x10dce7)[_0x0979('0xa')](function(_0x5da5c6){logger[_0x0979('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1e1a30,'request\x20sent');logger['debug'](_0x0979('0xc'),_0x1e1a30,_0x0979('0xd'),JSON['stringify'](_0x5da5c6));if(_0x5da5c6[_0x0979('0xe')]){if(_0x5da5c6['error'][_0x0979('0xf')]===0x1f4){logger['error'](_0x0979('0x10'),_0x1e1a30,_0x5da5c6[_0x0979('0xe')]['message']);return _0x2322fd(_0x5da5c6[_0x0979('0xe')]['message']);}logger[_0x0979('0xe')](_0x0979('0x10'),_0x1e1a30,_0x5da5c6['error'][_0x0979('0x11')]);return _0x30da8d(_0x5da5c6[_0x0979('0xe')]['message']);}else{logger[_0x0979('0xb')](_0x0979('0x10'),_0x1e1a30,'request\x20sent');_0x30da8d(_0x5da5c6[_0x0979('0x12')][_0x0979('0x11')]);}})[_0x0979('0x13')](function(_0x2e74ee){logger[_0x0979('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1e1a30,_0x2e74ee);_0x2322fd(_0x2e74ee);});});} \ No newline at end of file +var _0xb6f3=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x88ffb8,_0x42e87b){var _0x3840d7=function(_0x3d78d9){while(--_0x3d78d9){_0x88ffb8['push'](_0x88ffb8['shift']());}};_0x3840d7(++_0x42e87b);}(_0xb6f3,0x1c4));var _0x3b6f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb6f3[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3b6f('0x0'));var util=require(_0x3b6f('0x1'));var moment=require(_0x3b6f('0x2'));var BPromise=require(_0x3b6f('0x3'));var rs=require(_0x3b6f('0x4'));var fs=require('fs');var Redis=require(_0x3b6f('0x5'));var db=require(_0x3b6f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b6f('0x7'))(_0x3b6f('0x8'));var config=require(_0x3b6f('0x9'));var jayson=require(_0x3b6f('0xa'));var client=jayson[_0x3b6f('0xb')][_0x3b6f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1434db,_0x42d264,_0x46d4f4){return new BPromise(function(_0x381b55,_0x5c6931){return client[_0x3b6f('0xd')](_0x1434db,_0x46d4f4)[_0x3b6f('0xe')](function(_0x55a3f6){logger[_0x3b6f('0xf')](_0x3b6f('0x10'),_0x42d264,_0x3b6f('0x11'));logger[_0x3b6f('0x12')](_0x3b6f('0x13'),_0x42d264,_0x3b6f('0x11'),JSON[_0x3b6f('0x14')](_0x55a3f6));if(_0x55a3f6[_0x3b6f('0x15')]){if(_0x55a3f6[_0x3b6f('0x15')][_0x3b6f('0x16')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x42d264,_0x55a3f6[_0x3b6f('0x15')][_0x3b6f('0x17')]);return _0x5c6931(_0x55a3f6[_0x3b6f('0x15')][_0x3b6f('0x17')]);}logger[_0x3b6f('0x15')](_0x3b6f('0x10'),_0x42d264,_0x55a3f6[_0x3b6f('0x15')][_0x3b6f('0x17')]);return _0x381b55(_0x55a3f6[_0x3b6f('0x15')][_0x3b6f('0x17')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x42d264,'request\x20sent');_0x381b55(_0x55a3f6[_0x3b6f('0x18')][_0x3b6f('0x17')]);}})[_0x3b6f('0x19')](function(_0xbc02ee){logger[_0x3b6f('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x42d264,_0xbc02ee);_0x5c6931(_0xbc02ee);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e1eeb6a..4f9a43a 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 _0x17e2=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x55fa10,_0x555718){var _0x4155ca=function(_0xe115c8){while(--_0xe115c8){_0x55fa10['push'](_0x55fa10['shift']());}};_0x4155ca(++_0x555718);}(_0x17e2,0xc2));var _0x217e=function(_0x2ed2d9,_0x5a55ec){_0x2ed2d9=_0x2ed2d9-0x0;var _0x71c934=_0x17e2[_0x2ed2d9];return _0x71c934;};'use strict';var multer=require(_0x217e('0x0'));var util=require(_0x217e('0x1'));var path=require(_0x217e('0x2'));var timeout=require('connect-timeout');var express=require(_0x217e('0x3'));var router=express[_0x217e('0x4')]();var fs_extra=require(_0x217e('0x5'));var auth=require(_0x217e('0x6'));var interaction=require(_0x217e('0x7'));var config=require(_0x217e('0x8'));var controller=require('./intServicenowField.controller');router[_0x217e('0x9')]('/',auth[_0x217e('0xa')](),controller[_0x217e('0xb')]);router[_0x217e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x217e('0xc')]);router[_0x217e('0xd')]('/',auth[_0x217e('0xa')](),controller[_0x217e('0xe')]);router[_0x217e('0xf')](_0x217e('0x10'),auth[_0x217e('0xa')](),controller[_0x217e('0x11')]);router['delete'](_0x217e('0x10'),auth[_0x217e('0xa')](),controller[_0x217e('0x12')]);module[_0x217e('0x13')]=router; \ No newline at end of file +var _0xe16d=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe16d,0x1c6));var _0xde16=function(_0x5e59a7,_0x5648ae){_0x5e59a7=_0x5e59a7-0x0;var _0x19c8c1=_0xe16d[_0x5e59a7];return _0x19c8c1;};'use strict';var multer=require(_0xde16('0x0'));var util=require(_0xde16('0x1'));var path=require(_0xde16('0x2'));var timeout=require('connect-timeout');var express=require(_0xde16('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xde16('0x4'));var interaction=require(_0xde16('0x5'));var config=require(_0xde16('0x6'));var controller=require(_0xde16('0x7'));router[_0xde16('0x8')]('/',auth[_0xde16('0x9')](),controller[_0xde16('0xa')]);router[_0xde16('0x8')](_0xde16('0xb'),auth['isAuthenticated'](),controller[_0xde16('0xc')]);router[_0xde16('0xd')]('/',auth['isAuthenticated'](),controller[_0xde16('0xe')]);router[_0xde16('0xf')](_0xde16('0xb'),auth[_0xde16('0x9')](),controller[_0xde16('0x10')]);router[_0xde16('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xde16('0x12')]);module[_0xde16('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ec089a3..835a19f 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 _0x6f3b=['string','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x6f3b,0xe5));var _0xb6f3=function(_0x233ab2,_0x43cd05){_0x233ab2=_0x233ab2-0x0;var _0x4d893f=_0x6f3b[_0x233ab2];return _0x4d893f;};'use strict';var Sequelize=require(_0xb6f3('0x0'));module[_0xb6f3('0x1')]={'type':{'type':Sequelize[_0xb6f3('0x2')](_0xb6f3('0x3'),'variable',_0xb6f3('0x4'),_0xb6f3('0x5'),'picklist'),'defaultValue':_0xb6f3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb6f3('0x2')](_0xb6f3('0x3'),'variable',_0xb6f3('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb6f3('0x6')]},'nameField':{'type':Sequelize[_0xb6f3('0x6')]},'customField':{'type':Sequelize[_0xb6f3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6f3('0x6')]}}; \ No newline at end of file +var _0x9557=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x9557,0xf4));var _0x7955=function(_0x53aed2,_0x55513f){_0x53aed2=_0x53aed2-0x0;var _0x53f2b4=_0x9557[_0x53aed2];return _0x53f2b4;};'use strict';var Sequelize=require(_0x7955('0x0'));module[_0x7955('0x1')]={'type':{'type':Sequelize[_0x7955('0x2')]('string',_0x7955('0x3'),_0x7955('0x4'),_0x7955('0x5'),'picklist'),'defaultValue':_0x7955('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7955('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7955('0x6'),'variable',_0x7955('0x4'))},'keyContent':{'type':Sequelize[_0x7955('0x7')]},'idField':{'type':Sequelize[_0x7955('0x7')]},'nameField':{'type':Sequelize[_0x7955('0x7')]},'customField':{'type':Sequelize[_0x7955('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7955('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0a1607e..68556e3 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 _0x8b83=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty'];(function(_0x5a780c,_0x46304a){var _0x5097e7=function(_0x489962){while(--_0x489962){_0x5a780c['push'](_0x5a780c['shift']());}};_0x5097e7(++_0x46304a);}(_0x8b83,0x14a));var _0x38b8=function(_0x1d2a00,_0x15a511){_0x1d2a00=_0x1d2a00-0x0;var _0x21adc1=_0x8b83[_0x1d2a00];return _0x21adc1;};'use strict';var emlformat=require(_0x38b8('0x0'));var rimraf=require(_0x38b8('0x1'));var zipdir=require(_0x38b8('0x2'));var jsonpatch=require(_0x38b8('0x3'));var rp=require(_0x38b8('0x4'));var moment=require(_0x38b8('0x5'));var BPromise=require(_0x38b8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38b8('0x7'));var sox=require(_0x38b8('0x8'));var csv=require(_0x38b8('0x9'));var ejs=require(_0x38b8('0xa'));var fs=require('fs');var fs_extra=require(_0x38b8('0xb'));var _=require(_0x38b8('0xc'));var squel=require(_0x38b8('0xd'));var crypto=require(_0x38b8('0xe'));var jsforce=require(_0x38b8('0xf'));var deskjs=require(_0x38b8('0x10'));var toCsv=require(_0x38b8('0x9'));var querystring=require(_0x38b8('0x11'));var Papa=require(_0x38b8('0x12'));var Redis=require(_0x38b8('0x13'));var authService=require(_0x38b8('0x14'));var qs=require(_0x38b8('0x15'));var as=require(_0x38b8('0x16'));var hardwareService=require(_0x38b8('0x17'));var logger=require('../../config/logger')(_0x38b8('0x18'));var utils=require(_0x38b8('0x19'));var config=require(_0x38b8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x38b8('0x1b'))['db'];function respondWithStatusCode(_0x327a56,_0x41b7f9){_0x41b7f9=_0x41b7f9||0xcc;return function(_0x416fc4){if(_0x416fc4){return _0x327a56[_0x38b8('0x1c')](_0x41b7f9);}return _0x327a56[_0x38b8('0x1d')](_0x41b7f9)[_0x38b8('0x1e')]();};}function respondWithResult(_0x234323,_0x4a1efc){_0x4a1efc=_0x4a1efc||0xc8;return function(_0x46d675){if(_0x46d675){return _0x234323[_0x38b8('0x1d')](_0x4a1efc)[_0x38b8('0x1f')](_0x46d675);}};}function respondWithFilteredResult(_0x24be65,_0x1ea6b0){return function(_0x5208b2){if(_0x5208b2){var _0x37823a=typeof _0x1ea6b0[_0x38b8('0x20')]===_0x38b8('0x21')&&typeof _0x1ea6b0[_0x38b8('0x22')]===_0x38b8('0x21');var _0x2c3365=_0x5208b2['count'];var _0x2ed71e=_0x37823a?0x0:_0x1ea6b0[_0x38b8('0x20')];var _0x135857=_0x37823a?_0x5208b2[_0x38b8('0x23')]:_0x1ea6b0[_0x38b8('0x20')]+_0x1ea6b0[_0x38b8('0x22')];var _0x204920;if(_0x135857>=_0x2c3365){_0x135857=_0x2c3365;_0x204920=0xc8;}else{_0x204920=0xce;}_0x24be65[_0x38b8('0x1d')](_0x204920);return _0x24be65[_0x38b8('0x24')](_0x38b8('0x25'),_0x2ed71e+'-'+_0x135857+'/'+_0x2c3365)[_0x38b8('0x1f')](_0x5208b2);}return null;};}function patchUpdates(_0x1684aa){return function(_0x7426b8){try{jsonpatch[_0x38b8('0x26')](_0x7426b8,_0x1684aa,!![]);}catch(_0x1db6ba){return BPromise['reject'](_0x1db6ba);}return _0x7426b8[_0x38b8('0x27')]();};}function saveUpdates(_0x4c39fe,_0x525be9){return function(_0x2d1840){if(_0x2d1840){return _0x2d1840['update'](_0x4c39fe)[_0x38b8('0x28')](function(_0x4cf668){return _0x4cf668;});}return null;};}function removeEntity(_0x444ee8,_0x25861d){return function(_0x20f68f){if(_0x20f68f){return _0x20f68f['destroy']()[_0x38b8('0x28')](function(){_0x444ee8[_0x38b8('0x1d')](0xcc)[_0x38b8('0x1e')]();});}};}function handleEntityNotFound(_0x36c932,_0x18e2cd){return function(_0x53e7d3){if(!_0x53e7d3){_0x36c932[_0x38b8('0x1c')](0x194);}return _0x53e7d3;};}function handleError(_0x29c5f8,_0x6f6ec6){_0x6f6ec6=_0x6f6ec6||0x1f4;return function(_0x4c1eef){logger[_0x38b8('0x29')](_0x4c1eef[_0x38b8('0x2a')]);if(_0x4c1eef[_0x38b8('0x2b')]){delete _0x4c1eef[_0x38b8('0x2b')];}_0x29c5f8[_0x38b8('0x1d')](_0x6f6ec6)[_0x38b8('0x2c')](_0x4c1eef);};}exports[_0x38b8('0x2d')]=function(_0x49d193,_0x135e71){var _0x4d33a1={},_0x35183b={},_0x1fda4b={'count':0x0,'rows':[]};var _0x2a8e80=_[_0x38b8('0x2e')](db[_0x38b8('0x2f')][_0x38b8('0x30')],function(_0x205985){return{'name':_0x205985[_0x38b8('0x31')],'type':_0x205985[_0x38b8('0x32')][_0x38b8('0x33')]};});_0x35183b['model']=_['map'](_0x2a8e80,_0x38b8('0x2b'));_0x35183b['query']=_[_0x38b8('0x34')](_0x49d193[_0x38b8('0x35')]);_0x35183b[_0x38b8('0x36')]=_['intersection'](_0x35183b['model'],_0x35183b[_0x38b8('0x35')]);_0x4d33a1[_0x38b8('0x37')]=_[_0x38b8('0x38')](_0x35183b[_0x38b8('0x39')],qs[_0x38b8('0x3a')](_0x49d193[_0x38b8('0x35')]['fields']));_0x4d33a1[_0x38b8('0x37')]=_0x4d33a1[_0x38b8('0x37')]['length']?_0x4d33a1[_0x38b8('0x37')]:_0x35183b[_0x38b8('0x39')];if(!_0x49d193[_0x38b8('0x35')][_0x38b8('0x3b')](_0x38b8('0x3c'))){_0x4d33a1['limit']=qs['limit'](_0x49d193['query'][_0x38b8('0x22')]);_0x4d33a1[_0x38b8('0x20')]=qs[_0x38b8('0x20')](_0x49d193[_0x38b8('0x35')]['offset']);}_0x4d33a1[_0x38b8('0x3d')]=qs[_0x38b8('0x3e')](_0x49d193['query'][_0x38b8('0x3e')]);_0x4d33a1[_0x38b8('0x3f')]=qs['filters'](_[_0x38b8('0x40')](_0x49d193[_0x38b8('0x35')],_0x35183b[_0x38b8('0x36')]),_0x2a8e80);if(_0x49d193['query'][_0x38b8('0x41')]){_0x4d33a1[_0x38b8('0x3f')]=_['merge'](_0x4d33a1[_0x38b8('0x3f')],{'$or':_[_0x38b8('0x2e')](_0x2a8e80,function(_0x4b4032){if(_0x4b4032['type']!=='VIRTUAL'){var _0x125698={};_0x125698[_0x4b4032[_0x38b8('0x2b')]]={'$like':'%'+_0x49d193[_0x38b8('0x35')]['filter']+'%'};return _0x125698;}})});}_0x4d33a1=_[_0x38b8('0x42')]({},_0x4d33a1,_0x49d193[_0x38b8('0x43')]);var _0x9e9af2={'where':_0x4d33a1[_0x38b8('0x3f')]};return db['ServicenowField'][_0x38b8('0x23')](_0x9e9af2)[_0x38b8('0x28')](function(_0x488505){_0x1fda4b['count']=_0x488505;if(_0x49d193[_0x38b8('0x35')][_0x38b8('0x44')]){_0x4d33a1[_0x38b8('0x45')]=[{'all':!![]}];}return db[_0x38b8('0x2f')][_0x38b8('0x46')](_0x4d33a1);})[_0x38b8('0x28')](function(_0x15c340){_0x1fda4b[_0x38b8('0x47')]=_0x15c340;return _0x1fda4b;})[_0x38b8('0x28')](respondWithFilteredResult(_0x135e71,_0x4d33a1))['catch'](handleError(_0x135e71,null));};exports[_0x38b8('0x48')]=function(_0x53eea4,_0x25a808){var _0x2c5463={'raw':!![],'where':{'id':_0x53eea4[_0x38b8('0x49')]['id']}},_0x5c20b0={};_0x5c20b0[_0x38b8('0x39')]=_[_0x38b8('0x34')](db['ServicenowField'][_0x38b8('0x30')]);_0x5c20b0['query']=_[_0x38b8('0x34')](_0x53eea4['query']);_0x5c20b0['filters']=_[_0x38b8('0x38')](_0x5c20b0[_0x38b8('0x39')],_0x5c20b0[_0x38b8('0x35')]);_0x2c5463[_0x38b8('0x37')]=_[_0x38b8('0x38')](_0x5c20b0[_0x38b8('0x39')],qs[_0x38b8('0x3a')](_0x53eea4['query'][_0x38b8('0x3a')]));_0x2c5463[_0x38b8('0x37')]=_0x2c5463[_0x38b8('0x37')]['length']?_0x2c5463[_0x38b8('0x37')]:_0x5c20b0[_0x38b8('0x39')];if(_0x53eea4['query'][_0x38b8('0x44')]){_0x2c5463[_0x38b8('0x45')]=[{'all':!![]}];}_0x2c5463=_['merge']({},_0x2c5463,_0x53eea4[_0x38b8('0x43')]);return db[_0x38b8('0x2f')][_0x38b8('0x4a')](_0x2c5463)[_0x38b8('0x28')](handleEntityNotFound(_0x25a808,null))['then'](respondWithResult(_0x25a808,null))[_0x38b8('0x4b')](handleError(_0x25a808,null));};exports[_0x38b8('0x4c')]=function(_0x5eba2a,_0x1829f0){return db[_0x38b8('0x2f')][_0x38b8('0x4c')](_0x5eba2a[_0x38b8('0x4d')],{})['then'](respondWithResult(_0x1829f0,0xc9))[_0x38b8('0x4b')](handleError(_0x1829f0,null));};exports['update']=function(_0x2252c3,_0x463807){if(_0x2252c3[_0x38b8('0x4d')]['id']){delete _0x2252c3['body']['id'];}return db['ServicenowField'][_0x38b8('0x4a')]({'where':{'id':_0x2252c3[_0x38b8('0x49')]['id']}})['then'](handleEntityNotFound(_0x463807,null))[_0x38b8('0x28')](saveUpdates(_0x2252c3[_0x38b8('0x4d')],null))[_0x38b8('0x28')](respondWithResult(_0x463807,null))[_0x38b8('0x4b')](handleError(_0x463807,null));};exports['destroy']=function(_0x27adeb,_0xed0f10){return db[_0x38b8('0x2f')][_0x38b8('0x4a')]({'where':{'id':_0x27adeb[_0x38b8('0x49')]['id']}})['then'](handleEntityNotFound(_0xed0f10,null))[_0x38b8('0x28')](removeEntity(_0xed0f10,null))[_0x38b8('0x4b')](handleError(_0xed0f10,null));}; \ No newline at end of file +var _0xf25a=['intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','ServicenowField','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','eml-format','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf25a,0x9f));var _0xaf25=function(_0x5de42f,_0x2c087b){_0x5de42f=_0x5de42f-0x0;var _0xfefdeb=_0xf25a[_0x5de42f];return _0xfefdeb;};'use strict';var emlformat=require(_0xaf25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf25('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaf25('0x2'));var Mustache=require(_0xaf25('0x3'));var util=require(_0xaf25('0x4'));var path=require('path');var sox=require(_0xaf25('0x5'));var csv=require('to-csv');var ejs=require(_0xaf25('0x6'));var fs=require('fs');var fs_extra=require(_0xaf25('0x7'));var _=require(_0xaf25('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf25('0x9'));var toCsv=require(_0xaf25('0xa'));var querystring=require(_0xaf25('0xb'));var Papa=require(_0xaf25('0xc'));var Redis=require(_0xaf25('0xd'));var authService=require(_0xaf25('0xe'));var qs=require(_0xaf25('0xf'));var as=require(_0xaf25('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf25('0x11'));var utils=require(_0xaf25('0x12'));var config=require(_0xaf25('0x13'));var licenseUtil=require(_0xaf25('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4518c4,_0x464713){_0x464713=_0x464713||0xcc;return function(_0xe96beb){if(_0xe96beb){return _0x4518c4['sendStatus'](_0x464713);}return _0x4518c4['status'](_0x464713)[_0xaf25('0x15')]();};}function respondWithResult(_0x447adb,_0x4e7dfc){_0x4e7dfc=_0x4e7dfc||0xc8;return function(_0x3fc5c0){if(_0x3fc5c0){return _0x447adb[_0xaf25('0x16')](_0x4e7dfc)['json'](_0x3fc5c0);}};}function respondWithFilteredResult(_0x20ebab,_0x35af94){return function(_0x1b8087){if(_0x1b8087){var _0x5d2896=typeof _0x35af94[_0xaf25('0x17')]==='undefined'&&typeof _0x35af94[_0xaf25('0x18')]===_0xaf25('0x19');var _0x303078=_0x1b8087[_0xaf25('0x1a')];var _0x46bc55=_0x5d2896?0x0:_0x35af94['offset'];var _0x2cb2bc=_0x5d2896?_0x1b8087['count']:_0x35af94['offset']+_0x35af94[_0xaf25('0x18')];var _0x6f0058;if(_0x2cb2bc>=_0x303078){_0x2cb2bc=_0x303078;_0x6f0058=0xc8;}else{_0x6f0058=0xce;}_0x20ebab[_0xaf25('0x16')](_0x6f0058);return _0x20ebab[_0xaf25('0x1b')]('Content-Range',_0x46bc55+'-'+_0x2cb2bc+'/'+_0x303078)['json'](_0x1b8087);}return null;};}function patchUpdates(_0x491d90){return function(_0x232a55){try{jsonpatch[_0xaf25('0x1c')](_0x232a55,_0x491d90,!![]);}catch(_0x2b4edf){return BPromise['reject'](_0x2b4edf);}return _0x232a55[_0xaf25('0x1d')]();};}function saveUpdates(_0x22522f,_0x5404e8){return function(_0x422f29){if(_0x422f29){return _0x422f29[_0xaf25('0x1e')](_0x22522f)[_0xaf25('0x1f')](function(_0x28bd34){return _0x28bd34;});}return null;};}function removeEntity(_0x36f5a9,_0x1014d1){return function(_0x2077ad){if(_0x2077ad){return _0x2077ad[_0xaf25('0x20')]()[_0xaf25('0x1f')](function(){_0x36f5a9[_0xaf25('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2251b6,_0x307ad5){return function(_0x5b17b6){if(!_0x5b17b6){_0x2251b6['sendStatus'](0x194);}return _0x5b17b6;};}function handleError(_0x4c8112,_0x2ca0f0){_0x2ca0f0=_0x2ca0f0||0x1f4;return function(_0x10a1c1){logger[_0xaf25('0x21')](_0x10a1c1[_0xaf25('0x22')]);if(_0x10a1c1[_0xaf25('0x23')]){delete _0x10a1c1['name'];}_0x4c8112[_0xaf25('0x16')](_0x2ca0f0)[_0xaf25('0x24')](_0x10a1c1);};}exports['index']=function(_0x1120ff,_0x4f3eff){var _0x348a9a={},_0x539966={},_0x4d355b={'count':0x0,'rows':[]};var _0x2dfe6b=_[_0xaf25('0x25')](db['ServicenowField'][_0xaf25('0x26')],function(_0x4b5b77){return{'name':_0x4b5b77[_0xaf25('0x27')],'type':_0x4b5b77[_0xaf25('0x28')][_0xaf25('0x29')]};});_0x539966[_0xaf25('0x2a')]=_[_0xaf25('0x25')](_0x2dfe6b,'name');_0x539966['query']=_['keys'](_0x1120ff[_0xaf25('0x2b')]);_0x539966[_0xaf25('0x2c')]=_[_0xaf25('0x2d')](_0x539966[_0xaf25('0x2a')],_0x539966[_0xaf25('0x2b')]);_0x348a9a[_0xaf25('0x2e')]=_[_0xaf25('0x2d')](_0x539966[_0xaf25('0x2a')],qs[_0xaf25('0x2f')](_0x1120ff[_0xaf25('0x2b')][_0xaf25('0x2f')]));_0x348a9a[_0xaf25('0x2e')]=_0x348a9a[_0xaf25('0x2e')]['length']?_0x348a9a[_0xaf25('0x2e')]:_0x539966[_0xaf25('0x2a')];if(!_0x1120ff[_0xaf25('0x2b')]['hasOwnProperty'](_0xaf25('0x30'))){_0x348a9a[_0xaf25('0x18')]=qs[_0xaf25('0x18')](_0x1120ff['query'][_0xaf25('0x18')]);_0x348a9a[_0xaf25('0x17')]=qs[_0xaf25('0x17')](_0x1120ff[_0xaf25('0x2b')][_0xaf25('0x17')]);}_0x348a9a['order']=qs['sort'](_0x1120ff['query'][_0xaf25('0x31')]);_0x348a9a[_0xaf25('0x32')]=qs[_0xaf25('0x2c')](_[_0xaf25('0x33')](_0x1120ff[_0xaf25('0x2b')],_0x539966[_0xaf25('0x2c')]),_0x2dfe6b);if(_0x1120ff[_0xaf25('0x2b')][_0xaf25('0x34')]){_0x348a9a['where']=_[_0xaf25('0x35')](_0x348a9a[_0xaf25('0x32')],{'$or':_[_0xaf25('0x25')](_0x2dfe6b,function(_0x1a8d5d){if(_0x1a8d5d[_0xaf25('0x28')]!=='VIRTUAL'){var _0xe8d191={};_0xe8d191[_0x1a8d5d[_0xaf25('0x23')]]={'$like':'%'+_0x1120ff[_0xaf25('0x2b')][_0xaf25('0x34')]+'%'};return _0xe8d191;}})});}_0x348a9a=_[_0xaf25('0x35')]({},_0x348a9a,_0x1120ff[_0xaf25('0x36')]);var _0xd0ba1e={'where':_0x348a9a['where']};return db[_0xaf25('0x37')]['count'](_0xd0ba1e)[_0xaf25('0x1f')](function(_0xc68285){_0x4d355b[_0xaf25('0x1a')]=_0xc68285;if(_0x1120ff[_0xaf25('0x2b')][_0xaf25('0x38')]){_0x348a9a[_0xaf25('0x39')]=[{'all':!![]}];}return db[_0xaf25('0x37')][_0xaf25('0x3a')](_0x348a9a);})[_0xaf25('0x1f')](function(_0x277a52){_0x4d355b[_0xaf25('0x3b')]=_0x277a52;return _0x4d355b;})[_0xaf25('0x1f')](respondWithFilteredResult(_0x4f3eff,_0x348a9a))['catch'](handleError(_0x4f3eff,null));};exports[_0xaf25('0x3c')]=function(_0x590a88,_0x352f55){var _0x4f08fe={'raw':!![],'where':{'id':_0x590a88[_0xaf25('0x3d')]['id']}},_0x36efb9={};_0x36efb9[_0xaf25('0x2a')]=_[_0xaf25('0x3e')](db['ServicenowField'][_0xaf25('0x26')]);_0x36efb9[_0xaf25('0x2b')]=_[_0xaf25('0x3e')](_0x590a88['query']);_0x36efb9['filters']=_['intersection'](_0x36efb9[_0xaf25('0x2a')],_0x36efb9[_0xaf25('0x2b')]);_0x4f08fe[_0xaf25('0x2e')]=_['intersection'](_0x36efb9['model'],qs[_0xaf25('0x2f')](_0x590a88[_0xaf25('0x2b')]['fields']));_0x4f08fe[_0xaf25('0x2e')]=_0x4f08fe[_0xaf25('0x2e')][_0xaf25('0x3f')]?_0x4f08fe[_0xaf25('0x2e')]:_0x36efb9[_0xaf25('0x2a')];if(_0x590a88[_0xaf25('0x2b')][_0xaf25('0x38')]){_0x4f08fe['include']=[{'all':!![]}];}_0x4f08fe=_[_0xaf25('0x35')]({},_0x4f08fe,_0x590a88[_0xaf25('0x36')]);return db[_0xaf25('0x37')][_0xaf25('0x40')](_0x4f08fe)[_0xaf25('0x1f')](handleEntityNotFound(_0x352f55,null))[_0xaf25('0x1f')](respondWithResult(_0x352f55,null))[_0xaf25('0x41')](handleError(_0x352f55,null));};exports[_0xaf25('0x42')]=function(_0x3104d3,_0x56a867){return db[_0xaf25('0x37')]['create'](_0x3104d3[_0xaf25('0x43')],{})[_0xaf25('0x1f')](respondWithResult(_0x56a867,0xc9))[_0xaf25('0x41')](handleError(_0x56a867,null));};exports['update']=function(_0x45f7d1,_0x5af7a6){if(_0x45f7d1[_0xaf25('0x43')]['id']){delete _0x45f7d1[_0xaf25('0x43')]['id'];}return db[_0xaf25('0x37')][_0xaf25('0x40')]({'where':{'id':_0x45f7d1[_0xaf25('0x3d')]['id']}})[_0xaf25('0x1f')](handleEntityNotFound(_0x5af7a6,null))[_0xaf25('0x1f')](saveUpdates(_0x45f7d1[_0xaf25('0x43')],null))[_0xaf25('0x1f')](respondWithResult(_0x5af7a6,null))['catch'](handleError(_0x5af7a6,null));};exports[_0xaf25('0x20')]=function(_0x3fd0d9,_0x2acfda){return db[_0xaf25('0x37')]['find']({'where':{'id':_0x3fd0d9[_0xaf25('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2acfda,null))[_0xaf25('0x1f')](removeEntity(_0x2acfda,null))[_0xaf25('0x41')](handleError(_0x2acfda,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d96a7df..57cd17b 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 _0xf613=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0xf613,0x70));var _0x3f61=function(_0x3b6a3f,_0x1537d5){_0x3b6a3f=_0x3b6a3f-0x0;var _0x3f7379=_0xf613[_0x3b6a3f];return _0x3f7379;};'use strict';var _=require(_0x3f61('0x0'));var util=require(_0x3f61('0x1'));var logger=require(_0x3f61('0x2'))('api');var moment=require(_0x3f61('0x3'));var BPromise=require(_0x3f61('0x4'));var rp=require(_0x3f61('0x5'));var fs=require('fs');var path=require(_0x3f61('0x6'));var rimraf=require(_0x3f61('0x7'));var config=require(_0x3f61('0x8'));var attributes=require(_0x3f61('0x9'));module[_0x3f61('0xa')]=function(_0x4e96ce,_0x51d4a4){return _0x4e96ce[_0x3f61('0xb')]('ServicenowField',attributes,{'tableName':_0x3f61('0xc'),'paranoid':![],'indexes':[{'name':_0x3f61('0xd'),'fields':[_0x3f61('0xe'),_0x3f61('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfaee=['bluebird','request-promise','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x230fd3,_0x385940){var _0x9d6d1f=function(_0x51e262){while(--_0x51e262){_0x230fd3['push'](_0x230fd3['shift']());}};_0x9d6d1f(++_0x385940);}(_0xfaee,0x1bb));var _0xefae=function(_0x298374,_0x4d34c4){_0x298374=_0x298374-0x0;var _0x42ada1=_0xfaee[_0x298374];return _0x42ada1;};'use strict';var _=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var logger=require(_0xefae('0x2'))(_0xefae('0x3'));var moment=require(_0xefae('0x4'));var BPromise=require(_0xefae('0x5'));var rp=require(_0xefae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefae('0x7'));var config=require('../../config/environment');var attributes=require(_0xefae('0x8'));module[_0xefae('0x9')]=function(_0x78a368,_0x2492bb){return _0x78a368[_0xefae('0xa')](_0xefae('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xefae('0xc'),_0xefae('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 2756620..3b8c88e 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19a884,_0x16ea39){var _0x2291fe=function(_0x282a8f){while(--_0x282a8f){_0x19a884['push'](_0x19a884['shift']());}};_0x2291fe(++_0x16ea39);}(_0x70e0,0x17b));var _0x070e=function(_0x21969e,_0x8ed6b5){_0x21969e=_0x21969e-0x0;var _0x40cb9d=_0x70e0[_0x21969e];return _0x40cb9d;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xabbd65,_0x546d99){var _0x1d005a=function(_0x11694e){while(--_0x11694e){_0xabbd65['push'](_0xabbd65['shift']());}};_0x1d005a(++_0x546d99);}(_0xaa88,0x137));var _0x8aa8=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0xaa88[_0x138836];return _0x322688;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 88d6baf..d8a9b50 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 _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(_0x45737a,_0x130ab6){var _0x556a3a=function(_0x3d3d82){while(--_0x3d3d82){_0x45737a['push'](_0x45737a['shift']());}};_0x556a3a(++_0x130ab6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 +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(_0x58efb4,_0x222362){var _0xf89bb3=function(_0x3154c6){while(--_0x3154c6){_0x58efb4['push'](_0x58efb4['shift']());}};_0xf89bb3(++_0x222362);}(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 7aeb0dd..d99e760 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(_0x179dfb,_0x27a311){var _0x19001f=function(_0x223803){while(--_0x223803){_0x179dfb['push'](_0x179dfb['shift']());}};_0x19001f(++_0x27a311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x12347f,_0x44b910){var _0xb63ca9=function(_0x20a9d9){while(--_0x20a9d9){_0x12347f['push'](_0x12347f['shift']());}};_0xb63ca9(++_0x44b910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 eb79dfc..96e4aff 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 _0x9a0b=['get_module_fields','Calls','values','remove','includes','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','date_start','duration_hours','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a0b,0xff));var _0xb9a0=function(_0x1a405c,_0x2cdb39){_0x1a405c=_0x1a405c-0x0;var _0x22703d=_0x9a0b[_0x1a405c];return _0x22703d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb9a0('0x0'));var jsonpatch=require(_0xb9a0('0x1'));var rp=require('request-promise');var moment=require(_0xb9a0('0x2'));var BPromise=require(_0xb9a0('0x3'));var Mustache=require(_0xb9a0('0x4'));var util=require(_0xb9a0('0x5'));var path=require(_0xb9a0('0x6'));var sox=require(_0xb9a0('0x7'));var csv=require(_0xb9a0('0x8'));var ejs=require(_0xb9a0('0x9'));var fs=require('fs');var fs_extra=require(_0xb9a0('0xa'));var _=require(_0xb9a0('0xb'));var squel=require(_0xb9a0('0xc'));var crypto=require(_0xb9a0('0xd'));var jsforce=require(_0xb9a0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9a0('0xf'));var Papa=require(_0xb9a0('0x10'));var Redis=require('ioredis');var authService=require(_0xb9a0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9a0('0x12'));var hardwareService=require(_0xb9a0('0x13'));var logger=require(_0xb9a0('0x14'))(_0xb9a0('0x15'));var utils=require(_0xb9a0('0x16'));var config=require(_0xb9a0('0x17'));var licenseUtil=require(_0xb9a0('0x18'));var db=require(_0xb9a0('0x19'))['db'];var integrations=require(_0xb9a0('0x1a'));function respondWithStatusCode(_0x45533b,_0x26d99e){_0x26d99e=_0x26d99e||0xcc;return function(_0x29bd77){if(_0x29bd77){return _0x45533b[_0xb9a0('0x1b')](_0x26d99e);}return _0x45533b[_0xb9a0('0x1c')](_0x26d99e)[_0xb9a0('0x1d')]();};}function respondWithResult(_0x38f17f,_0x197573){_0x197573=_0x197573||0xc8;return function(_0x59fc4e){if(_0x59fc4e){return _0x38f17f[_0xb9a0('0x1c')](_0x197573)[_0xb9a0('0x1e')](_0x59fc4e);}};}function respondWithFilteredResult(_0x2670df,_0x39fe85){return function(_0x2395c3){if(_0x2395c3){var _0x280365=typeof _0x39fe85[_0xb9a0('0x1f')]===_0xb9a0('0x20')&&typeof _0x39fe85['limit']===_0xb9a0('0x20');var _0x2aa592=_0x2395c3[_0xb9a0('0x21')];var _0x4967e0=_0x280365?0x0:_0x39fe85[_0xb9a0('0x1f')];var _0x53e62d=_0x280365?_0x2395c3[_0xb9a0('0x21')]:_0x39fe85[_0xb9a0('0x1f')]+_0x39fe85[_0xb9a0('0x22')];var _0xe0a836;if(_0x53e62d>=_0x2aa592){_0x53e62d=_0x2aa592;_0xe0a836=0xc8;}else{_0xe0a836=0xce;}_0x2670df['status'](_0xe0a836);return _0x2670df[_0xb9a0('0x23')]('Content-Range',_0x4967e0+'-'+_0x53e62d+'/'+_0x2aa592)[_0xb9a0('0x1e')](_0x2395c3);}return null;};}function patchUpdates(_0x1a3f6c){return function(_0x2d952c){try{jsonpatch[_0xb9a0('0x24')](_0x2d952c,_0x1a3f6c,!![]);}catch(_0x4979e0){return BPromise[_0xb9a0('0x25')](_0x4979e0);}return _0x2d952c[_0xb9a0('0x26')]();};}function saveUpdates(_0x5015b0,_0x13297a){return function(_0x3de599){if(_0x3de599){return _0x3de599[_0xb9a0('0x27')](_0x5015b0)[_0xb9a0('0x28')](function(_0x282c29){return _0x282c29;});}return null;};}function removeEntity(_0x4820a3,_0x3117d1){return function(_0x5e6baf){if(_0x5e6baf){return _0x5e6baf[_0xb9a0('0x29')]()[_0xb9a0('0x28')](function(){_0x4820a3[_0xb9a0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4338be,_0x592eca){return function(_0x13dee3){if(!_0x13dee3){_0x4338be[_0xb9a0('0x1b')](0x194);}return _0x13dee3;};}function handleError(_0x3dea8a,_0x3bc9a7){_0x3bc9a7=_0x3bc9a7||0x1f4;return function(_0x12c56c){logger[_0xb9a0('0x2a')](_0x12c56c[_0xb9a0('0x2b')]);if(_0x12c56c[_0xb9a0('0x2c')]){delete _0x12c56c[_0xb9a0('0x2c')];}_0x3dea8a[_0xb9a0('0x1c')](_0x3bc9a7)['send'](_0x12c56c);};}exports[_0xb9a0('0x2d')]=function(_0x37e6f6,_0x5cd33a){var _0x2811e1={},_0x2547bf={},_0x214f9f={'count':0x0,'rows':[]};var _0x50eef2=_[_0xb9a0('0x2e')](db[_0xb9a0('0x2f')]['rawAttributes'],function(_0x356f84){return{'name':_0x356f84[_0xb9a0('0x30')],'type':_0x356f84['type'][_0xb9a0('0x31')]};});_0x2547bf['model']=_[_0xb9a0('0x2e')](_0x50eef2,_0xb9a0('0x2c'));_0x2547bf[_0xb9a0('0x32')]=_[_0xb9a0('0x33')](_0x37e6f6[_0xb9a0('0x32')]);_0x2547bf[_0xb9a0('0x34')]=_[_0xb9a0('0x35')](_0x2547bf[_0xb9a0('0x36')],_0x2547bf[_0xb9a0('0x32')]);_0x2811e1['attributes']=_[_0xb9a0('0x35')](_0x2547bf[_0xb9a0('0x36')],qs[_0xb9a0('0x37')](_0x37e6f6[_0xb9a0('0x32')][_0xb9a0('0x37')]));_0x2811e1[_0xb9a0('0x38')]=_0x2811e1['attributes'][_0xb9a0('0x39')]?_0x2811e1['attributes']:_0x2547bf[_0xb9a0('0x36')];if(!_0x37e6f6[_0xb9a0('0x32')]['hasOwnProperty'](_0xb9a0('0x3a'))){_0x2811e1['limit']=qs[_0xb9a0('0x22')](_0x37e6f6[_0xb9a0('0x32')][_0xb9a0('0x22')]);_0x2811e1[_0xb9a0('0x1f')]=qs['offset'](_0x37e6f6[_0xb9a0('0x32')]['offset']);}_0x2811e1[_0xb9a0('0x3b')]=qs[_0xb9a0('0x3c')](_0x37e6f6['query'][_0xb9a0('0x3c')]);_0x2811e1['where']=qs[_0xb9a0('0x34')](_[_0xb9a0('0x3d')](_0x37e6f6['query'],_0x2547bf['filters']),_0x50eef2);if(_0x37e6f6[_0xb9a0('0x32')][_0xb9a0('0x3e')]){_0x2811e1[_0xb9a0('0x3f')]=_['merge'](_0x2811e1[_0xb9a0('0x3f')],{'$or':_[_0xb9a0('0x2e')](_0x50eef2,function(_0x30f626){if(_0x30f626[_0xb9a0('0x40')]!==_0xb9a0('0x41')){var _0x4e8319={};_0x4e8319[_0x30f626['name']]={'$like':'%'+_0x37e6f6['query']['filter']+'%'};return _0x4e8319;}})});}_0x2811e1=_[_0xb9a0('0x42')]({},_0x2811e1,_0x37e6f6[_0xb9a0('0x43')]);var _0x2ab023={'where':_0x2811e1['where']};return db['SugarcrmAccount'][_0xb9a0('0x21')](_0x2ab023)[_0xb9a0('0x28')](function(_0x4bb043){_0x214f9f[_0xb9a0('0x21')]=_0x4bb043;if(_0x37e6f6[_0xb9a0('0x32')][_0xb9a0('0x44')]){_0x2811e1['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xb9a0('0x45')](_0x2811e1);})['then'](function(_0x71ce98){_0x214f9f[_0xb9a0('0x46')]=_0x71ce98;return _0x214f9f;})['then'](respondWithFilteredResult(_0x5cd33a,_0x2811e1))[_0xb9a0('0x47')](handleError(_0x5cd33a,null));};exports[_0xb9a0('0x48')]=function(_0x206de4,_0x58afe8){var _0xd823d4={'raw':![],'where':{'id':_0x206de4['params']['id']}},_0x511d25={};_0x511d25[_0xb9a0('0x36')]=_[_0xb9a0('0x33')](db[_0xb9a0('0x2f')][_0xb9a0('0x49')]);_0x511d25[_0xb9a0('0x32')]=_[_0xb9a0('0x33')](_0x206de4['query']);_0x511d25['filters']=_['intersection'](_0x511d25['model'],_0x511d25['query']);_0xd823d4[_0xb9a0('0x38')]=_[_0xb9a0('0x35')](_0x511d25[_0xb9a0('0x36')],qs[_0xb9a0('0x37')](_0x206de4['query']['fields']));_0xd823d4['attributes']=_0xd823d4[_0xb9a0('0x38')]['length']?_0xd823d4[_0xb9a0('0x38')]:_0x511d25[_0xb9a0('0x36')];if(_0x206de4['query'][_0xb9a0('0x44')]){_0xd823d4[_0xb9a0('0x4a')]=[{'all':!![]}];}_0xd823d4=_[_0xb9a0('0x42')]({},_0xd823d4,_0x206de4[_0xb9a0('0x43')]);return db['SugarcrmAccount'][_0xb9a0('0x4b')](_0xd823d4)['then'](handleEntityNotFound(_0x58afe8,null))[_0xb9a0('0x28')](respondWithResult(_0x58afe8,null))[_0xb9a0('0x47')](handleError(_0x58afe8,null));};exports[_0xb9a0('0x4c')]=function(_0xc83db1,_0x4df346){return db[_0xb9a0('0x2f')]['create'](_0xc83db1['body'],{})[_0xb9a0('0x28')](respondWithResult(_0x4df346,0xc9))[_0xb9a0('0x47')](handleError(_0x4df346,null));};exports['update']=function(_0x16f248,_0x6b41cd){if(_0x16f248[_0xb9a0('0x4d')]['id']){delete _0x16f248[_0xb9a0('0x4d')]['id'];}return db[_0xb9a0('0x2f')][_0xb9a0('0x4b')]({'where':{'id':_0x16f248[_0xb9a0('0x4e')]['id']}})[_0xb9a0('0x28')](handleEntityNotFound(_0x6b41cd,null))[_0xb9a0('0x28')](saveUpdates(_0x16f248[_0xb9a0('0x4d')],null))[_0xb9a0('0x28')](respondWithResult(_0x6b41cd,null))[_0xb9a0('0x47')](handleError(_0x6b41cd,null));};exports[_0xb9a0('0x29')]=function(_0x24b9fe,_0x2e0e79){return db[_0xb9a0('0x2f')][_0xb9a0('0x4b')]({'where':{'id':_0x24b9fe['params']['id']}})[_0xb9a0('0x28')](handleEntityNotFound(_0x2e0e79,null))['then'](removeEntity(_0x2e0e79,null))['catch'](handleError(_0x2e0e79,null));};exports[_0xb9a0('0x4f')]=function(_0x50f744,_0x4830d4,_0xd790f0){var _0x41db2b={};var _0xb3fce={};var _0x3cc602;var _0x449a6b;return db[_0xb9a0('0x2f')][_0xb9a0('0x50')]({'where':{'id':_0x50f744[_0xb9a0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4830d4,null))['then'](function(_0x4a8210){if(_0x4a8210){_0x3cc602=_0x4a8210;_0xb3fce[_0xb9a0('0x36')]=_[_0xb9a0('0x33')](db[_0xb9a0('0x51')][_0xb9a0('0x49')]);_0xb3fce['query']=_[_0xb9a0('0x33')](_0x50f744[_0xb9a0('0x32')]);_0xb3fce['filters']=_[_0xb9a0('0x35')](_0xb3fce[_0xb9a0('0x36')],_0xb3fce[_0xb9a0('0x32')]);_0x41db2b['attributes']=_[_0xb9a0('0x35')](_0xb3fce['model'],qs['fields'](_0x50f744[_0xb9a0('0x32')][_0xb9a0('0x37')]));_0x41db2b[_0xb9a0('0x38')]=_0x41db2b[_0xb9a0('0x38')]['length']?_0x41db2b[_0xb9a0('0x38')]:_0xb3fce[_0xb9a0('0x36')];_0x41db2b['order']=qs[_0xb9a0('0x3c')](_0x50f744[_0xb9a0('0x32')][_0xb9a0('0x3c')]);_0x41db2b[_0xb9a0('0x3f')]=qs[_0xb9a0('0x34')](_[_0xb9a0('0x3d')](_0x50f744['query'],_0xb3fce[_0xb9a0('0x34')]));if(_0x50f744[_0xb9a0('0x32')]['filter']){_0x41db2b[_0xb9a0('0x3f')]=_[_0xb9a0('0x42')](_0x41db2b[_0xb9a0('0x3f')],{'$or':_[_0xb9a0('0x2e')](_0x41db2b[_0xb9a0('0x38')],function(_0x2bf169){var _0x43adf1={};_0x43adf1[_0x2bf169]={'$like':'%'+_0x50f744['query'][_0xb9a0('0x3e')]+'%'};return _0x43adf1;})});}_0x41db2b=_[_0xb9a0('0x42')]({},_0x41db2b,_0x50f744[_0xb9a0('0x43')]);return _0x3cc602[_0xb9a0('0x4f')](_0x41db2b);}})[_0xb9a0('0x28')](function(_0x560e36){if(_0x560e36){_0x449a6b=_0x560e36[_0xb9a0('0x39')];if(!_0x50f744[_0xb9a0('0x32')][_0xb9a0('0x52')]('nolimit')){_0x41db2b['limit']=qs[_0xb9a0('0x22')](_0x50f744['query']['limit']);_0x41db2b[_0xb9a0('0x1f')]=qs[_0xb9a0('0x1f')](_0x50f744[_0xb9a0('0x32')][_0xb9a0('0x1f')]);}return _0x3cc602[_0xb9a0('0x4f')](_0x41db2b);}})[_0xb9a0('0x28')](function(_0x33e83d){if(_0x33e83d){return _0x33e83d?{'count':_0x449a6b,'rows':_0x33e83d}:null;}})[_0xb9a0('0x28')](respondWithResult(_0x4830d4,null))[_0xb9a0('0x47')](handleError(_0x4830d4,null));};exports['addConfiguration']=function(_0x1b7386,_0x428007,_0x28c93d){if(_0x1b7386['body']['id']){delete _0x1b7386[_0xb9a0('0x4d')]['id'];}return db['SugarcrmAccount'][_0xb9a0('0x50')]({'where':{'id':_0x1b7386[_0xb9a0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x428007,null))[_0xb9a0('0x28')](function(_0x2fb1f4){if(_0x2fb1f4){_0x1b7386[_0xb9a0('0x4d')][_0xb9a0('0x53')]=_0x2fb1f4['id'];_0x1b7386[_0xb9a0('0x4d')][_0xb9a0('0x54')]=integrations[_0xb9a0('0x55')](_0x1b7386[_0xb9a0('0x4d')][_0xb9a0('0x56')],_0x1b7386[_0xb9a0('0x4d')]['type']);_0x1b7386['body']['Descriptions']=integrations[_0xb9a0('0x57')](_0x1b7386[_0xb9a0('0x4d')][_0xb9a0('0x56')],_0x1b7386[_0xb9a0('0x4d')][_0xb9a0('0x40')]);return db[_0xb9a0('0x51')][_0xb9a0('0x4c')](_0x1b7386['body'],{'include':[{'model':db[_0xb9a0('0x58')],'as':'Subjects'},{'model':db[_0xb9a0('0x58')],'as':_0xb9a0('0x59')}]});}return null;})[_0xb9a0('0x28')](respondWithResult(_0x428007,null))[_0xb9a0('0x47')](handleError(_0x428007,null));};exports[_0xb9a0('0x5a')]=function(_0x292fb7,_0x23555d,_0x4271ba){var _0x2a5dc2='';var _0x51a15a=['id',_0xb9a0('0x2c'),_0xb9a0('0x5b'),'created_by','description',_0xb9a0('0x5c'),_0xb9a0('0x5d'),'duration_minutes','parent_id',_0xb9a0('0x5e'),'parent_name',_0xb9a0('0x5f')];return db[_0xb9a0('0x2f')][_0xb9a0('0x50')]({'where':{'id':_0x292fb7[_0xb9a0('0x4e')]['id']},'attributes':['id',_0xb9a0('0x60'),_0xb9a0('0x61'),'remoteUri']})[_0xb9a0('0x28')](handleEntityNotFound(_0x23555d,null))['then'](function(_0x1009bb){if(_0x1009bb){_0x2a5dc2=_0x1009bb[_0xb9a0('0x62')];var _0x29177b=_0x2a5dc2[_0xb9a0('0x63')](-0x1);if(_0x29177b==='/'){_0x2a5dc2=_0x2a5dc2[_0xb9a0('0x64')](0x0,_0x2a5dc2[_0xb9a0('0x65')](_0x29177b));}return rp({'method':_0xb9a0('0x66'),'uri':util[_0xb9a0('0x67')](_0xb9a0('0x68'),_0x2a5dc2,_0xb9a0('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xb9a0('0x6a'),'rest_data':JSON[_0xb9a0('0x6b')]({'user_auth':{'user_name':_0x1009bb[_0xb9a0('0x60')],'password':_0x1009bb[_0xb9a0('0x61')],'encryption':'PLAIN'},'application':_0xb9a0('0x6c')})}});}})[_0xb9a0('0x28')](function(_0x4a6485){if(_0x4a6485&&_0x4a6485[_0xb9a0('0x2c')]!==_0xb9a0('0x6d')&&_0x4a6485[_0xb9a0('0x2c')]!==_0xb9a0('0x6e')){return rp({'method':'POST','uri':util[_0xb9a0('0x67')](_0xb9a0('0x68'),_0x2a5dc2,_0xb9a0('0x69')),'json':!![],'form':{'method':_0xb9a0('0x6f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb9a0('0x6b')]({'session':_0x4a6485['id'],'module_name':_0xb9a0('0x70')})}})[_0xb9a0('0x28')](function(_0xda24cf){if(_0xda24cf){var _0x27e0cc=_[_0xb9a0('0x71')](_0xda24cf['module_fields']);_[_0xb9a0('0x72')](_0x27e0cc,function(_0x302aa5){return _0x51a15a[_0xb9a0('0x73')](_0x302aa5[_0xb9a0('0x2c')]);});return{'count':_0x27e0cc[_0xb9a0('0x39')],'rows':_['map'](_0x27e0cc,function(_0x47e171){return{'id':_0x47e171[_0xb9a0('0x2c')],'name':_0x47e171[_0xb9a0('0x74')],'custom':_['endsWith'](_0x47e171[_0xb9a0('0x2c')],'_c')?!![]:![],'options':_0x47e171[_0xb9a0('0x43')]?_[_0xb9a0('0x2e')](_[_0xb9a0('0x71')](_0x47e171[_0xb9a0('0x43')]),function(_0x3086d4){return{'name':_0x3086d4['value'],'value':_0x3086d4[_0xb9a0('0x2c')]};}):[]};})};}})[_0xb9a0('0x28')](respondWithResult(_0x23555d,null))[_0xb9a0('0x47')](function(_0x36b1a3){var _0x3a1fd0=_0x292fb7['query'][_0xb9a0('0x75')]?0x1f4:_0x36b1a3[_0xb9a0('0x76')]||0x1f4;logger[_0xb9a0('0x2a')](_0xb9a0('0x77'),_0xb9a0('0x5a'),_0x3a1fd0,JSON[_0xb9a0('0x6b')](_0x36b1a3));delete _0x36b1a3['name'];if(_0x3a1fd0===0x191){_0x3a1fd0=0x190;}_0x23555d[_0xb9a0('0x1c')](_0x3a1fd0)[_0xb9a0('0x78')](_0x292fb7[_0xb9a0('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x36b1a3[_0xb9a0('0x76')]}:_0x36b1a3);});}else{var _0x2a9400=0x1f4;_0x23555d[_0xb9a0('0x1c')](_0x2a9400)[_0xb9a0('0x78')]({'message':_0xb9a0('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xabfb=['length','create','body','params','find','getConfigurations','findOne','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','remove','includes','label','value','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','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x4b281d,_0x17ec63){var _0x103c12=function(_0x4763be){while(--_0x4763be){_0x4b281d['push'](_0x4b281d['shift']());}};_0x103c12(++_0x17ec63);}(_0xabfb,0x1a2));var _0xbabf=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xabfb[_0x37b3e5];return _0x207f20;};'use strict';var emlformat=require(_0xbabf('0x0'));var rimraf=require(_0xbabf('0x1'));var zipdir=require(_0xbabf('0x2'));var jsonpatch=require(_0xbabf('0x3'));var rp=require(_0xbabf('0x4'));var moment=require(_0xbabf('0x5'));var BPromise=require(_0xbabf('0x6'));var Mustache=require(_0xbabf('0x7'));var util=require(_0xbabf('0x8'));var path=require(_0xbabf('0x9'));var sox=require('sox');var csv=require(_0xbabf('0xa'));var ejs=require(_0xbabf('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbabf('0xc'));var squel=require(_0xbabf('0xd'));var crypto=require(_0xbabf('0xe'));var jsforce=require(_0xbabf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbabf('0xa'));var querystring=require(_0xbabf('0x10'));var Papa=require(_0xbabf('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbabf('0x12'));var as=require(_0xbabf('0x13'));var hardwareService=require(_0xbabf('0x14'));var logger=require(_0xbabf('0x15'))(_0xbabf('0x16'));var utils=require(_0xbabf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbabf('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbabf('0x19'));function respondWithStatusCode(_0x39c80a,_0x1e9f7a){_0x1e9f7a=_0x1e9f7a||0xcc;return function(_0x285757){if(_0x285757){return _0x39c80a[_0xbabf('0x1a')](_0x1e9f7a);}return _0x39c80a[_0xbabf('0x1b')](_0x1e9f7a)[_0xbabf('0x1c')]();};}function respondWithResult(_0x40715a,_0x231777){_0x231777=_0x231777||0xc8;return function(_0x29fe14){if(_0x29fe14){return _0x40715a[_0xbabf('0x1b')](_0x231777)[_0xbabf('0x1d')](_0x29fe14);}};}function respondWithFilteredResult(_0xa30f51,_0xcd6d50){return function(_0x3ec09c){if(_0x3ec09c){var _0x59ac2a=typeof _0xcd6d50[_0xbabf('0x1e')]===_0xbabf('0x1f')&&typeof _0xcd6d50['limit']==='undefined';var _0x5b5d52=_0x3ec09c[_0xbabf('0x20')];var _0x526f4a=_0x59ac2a?0x0:_0xcd6d50[_0xbabf('0x1e')];var _0x3c9b3f=_0x59ac2a?_0x3ec09c[_0xbabf('0x20')]:_0xcd6d50['offset']+_0xcd6d50[_0xbabf('0x21')];var _0x4a067f;if(_0x3c9b3f>=_0x5b5d52){_0x3c9b3f=_0x5b5d52;_0x4a067f=0xc8;}else{_0x4a067f=0xce;}_0xa30f51[_0xbabf('0x1b')](_0x4a067f);return _0xa30f51[_0xbabf('0x22')](_0xbabf('0x23'),_0x526f4a+'-'+_0x3c9b3f+'/'+_0x5b5d52)[_0xbabf('0x1d')](_0x3ec09c);}return null;};}function patchUpdates(_0x5639aa){return function(_0x3f6909){try{jsonpatch[_0xbabf('0x24')](_0x3f6909,_0x5639aa,!![]);}catch(_0x30a396){return BPromise[_0xbabf('0x25')](_0x30a396);}return _0x3f6909[_0xbabf('0x26')]();};}function saveUpdates(_0x23d2be,_0x1ae610){return function(_0x7b925c){if(_0x7b925c){return _0x7b925c[_0xbabf('0x27')](_0x23d2be)[_0xbabf('0x28')](function(_0x321fb2){return _0x321fb2;});}return null;};}function removeEntity(_0x2a2c14,_0x37a4d2){return function(_0x27746b){if(_0x27746b){return _0x27746b[_0xbabf('0x29')]()[_0xbabf('0x28')](function(){_0x2a2c14[_0xbabf('0x1b')](0xcc)[_0xbabf('0x1c')]();});}};}function handleEntityNotFound(_0x24b0aa,_0x4c7ed2){return function(_0x32b301){if(!_0x32b301){_0x24b0aa[_0xbabf('0x1a')](0x194);}return _0x32b301;};}function handleError(_0x111dce,_0x25b941){_0x25b941=_0x25b941||0x1f4;return function(_0xfd2cee){logger[_0xbabf('0x2a')](_0xfd2cee[_0xbabf('0x2b')]);if(_0xfd2cee[_0xbabf('0x2c')]){delete _0xfd2cee['name'];}_0x111dce[_0xbabf('0x1b')](_0x25b941)[_0xbabf('0x2d')](_0xfd2cee);};}exports[_0xbabf('0x2e')]=function(_0xcca342,_0x38bb5a){var _0x3bf8cf={},_0x1707e7={},_0x3e97dc={'count':0x0,'rows':[]};var _0x14174d=_[_0xbabf('0x2f')](db[_0xbabf('0x30')][_0xbabf('0x31')],function(_0x3ac69f){return{'name':_0x3ac69f['fieldName'],'type':_0x3ac69f[_0xbabf('0x32')][_0xbabf('0x33')]};});_0x1707e7[_0xbabf('0x34')]=_[_0xbabf('0x2f')](_0x14174d,'name');_0x1707e7[_0xbabf('0x35')]=_['keys'](_0xcca342[_0xbabf('0x35')]);_0x1707e7['filters']=_['intersection'](_0x1707e7['model'],_0x1707e7[_0xbabf('0x35')]);_0x3bf8cf['attributes']=_[_0xbabf('0x36')](_0x1707e7[_0xbabf('0x34')],qs[_0xbabf('0x37')](_0xcca342[_0xbabf('0x35')][_0xbabf('0x37')]));_0x3bf8cf['attributes']=_0x3bf8cf['attributes']['length']?_0x3bf8cf[_0xbabf('0x38')]:_0x1707e7[_0xbabf('0x34')];if(!_0xcca342[_0xbabf('0x35')][_0xbabf('0x39')](_0xbabf('0x3a'))){_0x3bf8cf[_0xbabf('0x21')]=qs[_0xbabf('0x21')](_0xcca342[_0xbabf('0x35')]['limit']);_0x3bf8cf[_0xbabf('0x1e')]=qs[_0xbabf('0x1e')](_0xcca342[_0xbabf('0x35')][_0xbabf('0x1e')]);}_0x3bf8cf['order']=qs['sort'](_0xcca342[_0xbabf('0x35')][_0xbabf('0x3b')]);_0x3bf8cf[_0xbabf('0x3c')]=qs[_0xbabf('0x3d')](_[_0xbabf('0x3e')](_0xcca342[_0xbabf('0x35')],_0x1707e7[_0xbabf('0x3d')]),_0x14174d);if(_0xcca342[_0xbabf('0x35')][_0xbabf('0x3f')]){_0x3bf8cf['where']=_[_0xbabf('0x40')](_0x3bf8cf[_0xbabf('0x3c')],{'$or':_[_0xbabf('0x2f')](_0x14174d,function(_0x184b78){if(_0x184b78[_0xbabf('0x32')]!==_0xbabf('0x41')){var _0x494fe5={};_0x494fe5[_0x184b78[_0xbabf('0x2c')]]={'$like':'%'+_0xcca342[_0xbabf('0x35')][_0xbabf('0x3f')]+'%'};return _0x494fe5;}})});}_0x3bf8cf=_[_0xbabf('0x40')]({},_0x3bf8cf,_0xcca342[_0xbabf('0x42')]);var _0x4e4ad5={'where':_0x3bf8cf[_0xbabf('0x3c')]};return db[_0xbabf('0x30')][_0xbabf('0x20')](_0x4e4ad5)['then'](function(_0x1043be){_0x3e97dc['count']=_0x1043be;if(_0xcca342[_0xbabf('0x35')][_0xbabf('0x43')]){_0x3bf8cf[_0xbabf('0x44')]=[{'all':!![]}];}return db[_0xbabf('0x30')][_0xbabf('0x45')](_0x3bf8cf);})['then'](function(_0x13cf9d){_0x3e97dc[_0xbabf('0x46')]=_0x13cf9d;return _0x3e97dc;})[_0xbabf('0x28')](respondWithFilteredResult(_0x38bb5a,_0x3bf8cf))[_0xbabf('0x47')](handleError(_0x38bb5a,null));};exports[_0xbabf('0x48')]=function(_0x387a95,_0x153318){var _0x1d9435={'raw':![],'where':{'id':_0x387a95['params']['id']}},_0xd64f0f={};_0xd64f0f[_0xbabf('0x34')]=_[_0xbabf('0x49')](db[_0xbabf('0x30')]['rawAttributes']);_0xd64f0f[_0xbabf('0x35')]=_[_0xbabf('0x49')](_0x387a95['query']);_0xd64f0f['filters']=_[_0xbabf('0x36')](_0xd64f0f[_0xbabf('0x34')],_0xd64f0f['query']);_0x1d9435[_0xbabf('0x38')]=_[_0xbabf('0x36')](_0xd64f0f[_0xbabf('0x34')],qs[_0xbabf('0x37')](_0x387a95['query'][_0xbabf('0x37')]));_0x1d9435['attributes']=_0x1d9435[_0xbabf('0x38')][_0xbabf('0x4a')]?_0x1d9435[_0xbabf('0x38')]:_0xd64f0f[_0xbabf('0x34')];if(_0x387a95['query'][_0xbabf('0x43')]){_0x1d9435[_0xbabf('0x44')]=[{'all':!![]}];}_0x1d9435=_[_0xbabf('0x40')]({},_0x1d9435,_0x387a95['options']);return db[_0xbabf('0x30')]['find'](_0x1d9435)['then'](handleEntityNotFound(_0x153318,null))[_0xbabf('0x28')](respondWithResult(_0x153318,null))[_0xbabf('0x47')](handleError(_0x153318,null));};exports[_0xbabf('0x4b')]=function(_0x3ec6f4,_0x1db383){return db['SugarcrmAccount'][_0xbabf('0x4b')](_0x3ec6f4[_0xbabf('0x4c')],{})['then'](respondWithResult(_0x1db383,0xc9))['catch'](handleError(_0x1db383,null));};exports[_0xbabf('0x27')]=function(_0x26e80c,_0x4da486){if(_0x26e80c[_0xbabf('0x4c')]['id']){delete _0x26e80c[_0xbabf('0x4c')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x26e80c[_0xbabf('0x4d')]['id']}})[_0xbabf('0x28')](handleEntityNotFound(_0x4da486,null))[_0xbabf('0x28')](saveUpdates(_0x26e80c[_0xbabf('0x4c')],null))[_0xbabf('0x28')](respondWithResult(_0x4da486,null))[_0xbabf('0x47')](handleError(_0x4da486,null));};exports[_0xbabf('0x29')]=function(_0x257a31,_0xd68299){return db[_0xbabf('0x30')][_0xbabf('0x4e')]({'where':{'id':_0x257a31['params']['id']}})[_0xbabf('0x28')](handleEntityNotFound(_0xd68299,null))[_0xbabf('0x28')](removeEntity(_0xd68299,null))[_0xbabf('0x47')](handleError(_0xd68299,null));};exports[_0xbabf('0x4f')]=function(_0x5055c9,_0x290eb8,_0xb71003){var _0x577700={};var _0x195e7e={};var _0x8197c6;var _0x427d27;return db['SugarcrmAccount'][_0xbabf('0x50')]({'where':{'id':_0x5055c9['params']['id']}})['then'](handleEntityNotFound(_0x290eb8,null))[_0xbabf('0x28')](function(_0x1132a4){if(_0x1132a4){_0x8197c6=_0x1132a4;_0x195e7e['model']=_[_0xbabf('0x49')](db['SugarcrmConfiguration'][_0xbabf('0x31')]);_0x195e7e['query']=_[_0xbabf('0x49')](_0x5055c9[_0xbabf('0x35')]);_0x195e7e['filters']=_[_0xbabf('0x36')](_0x195e7e['model'],_0x195e7e[_0xbabf('0x35')]);_0x577700[_0xbabf('0x38')]=_['intersection'](_0x195e7e[_0xbabf('0x34')],qs[_0xbabf('0x37')](_0x5055c9[_0xbabf('0x35')][_0xbabf('0x37')]));_0x577700['attributes']=_0x577700[_0xbabf('0x38')][_0xbabf('0x4a')]?_0x577700[_0xbabf('0x38')]:_0x195e7e[_0xbabf('0x34')];_0x577700[_0xbabf('0x51')]=qs[_0xbabf('0x3b')](_0x5055c9[_0xbabf('0x35')][_0xbabf('0x3b')]);_0x577700['where']=qs['filters'](_['pick'](_0x5055c9[_0xbabf('0x35')],_0x195e7e['filters']));if(_0x5055c9[_0xbabf('0x35')]['filter']){_0x577700[_0xbabf('0x3c')]=_[_0xbabf('0x40')](_0x577700[_0xbabf('0x3c')],{'$or':_[_0xbabf('0x2f')](_0x577700[_0xbabf('0x38')],function(_0x3429ba){var _0x1c7424={};_0x1c7424[_0x3429ba]={'$like':'%'+_0x5055c9[_0xbabf('0x35')]['filter']+'%'};return _0x1c7424;})});}_0x577700=_['merge']({},_0x577700,_0x5055c9[_0xbabf('0x42')]);return _0x8197c6[_0xbabf('0x4f')](_0x577700);}})[_0xbabf('0x28')](function(_0x34c554){if(_0x34c554){_0x427d27=_0x34c554[_0xbabf('0x4a')];if(!_0x5055c9[_0xbabf('0x35')][_0xbabf('0x39')](_0xbabf('0x3a'))){_0x577700[_0xbabf('0x21')]=qs[_0xbabf('0x21')](_0x5055c9[_0xbabf('0x35')]['limit']);_0x577700[_0xbabf('0x1e')]=qs[_0xbabf('0x1e')](_0x5055c9[_0xbabf('0x35')]['offset']);}return _0x8197c6[_0xbabf('0x4f')](_0x577700);}})[_0xbabf('0x28')](function(_0x36445c){if(_0x36445c){return _0x36445c?{'count':_0x427d27,'rows':_0x36445c}:null;}})[_0xbabf('0x28')](respondWithResult(_0x290eb8,null))['catch'](handleError(_0x290eb8,null));};exports[_0xbabf('0x52')]=function(_0x31b13a,_0x15d2dc,_0xd1105){if(_0x31b13a['body']['id']){delete _0x31b13a[_0xbabf('0x4c')]['id'];}return db['SugarcrmAccount'][_0xbabf('0x50')]({'where':{'id':_0x31b13a['params']['id']}})[_0xbabf('0x28')](handleEntityNotFound(_0x15d2dc,null))[_0xbabf('0x28')](function(_0x3ac624){if(_0x3ac624){_0x31b13a[_0xbabf('0x4c')][_0xbabf('0x53')]=_0x3ac624['id'];_0x31b13a[_0xbabf('0x4c')]['Subjects']=integrations[_0xbabf('0x54')](_0x31b13a[_0xbabf('0x4c')][_0xbabf('0x55')],_0x31b13a[_0xbabf('0x4c')][_0xbabf('0x32')]);_0x31b13a[_0xbabf('0x4c')][_0xbabf('0x56')]=integrations[_0xbabf('0x57')](_0x31b13a[_0xbabf('0x4c')][_0xbabf('0x55')],_0x31b13a['body'][_0xbabf('0x32')]);return db['SugarcrmConfiguration'][_0xbabf('0x4b')](_0x31b13a[_0xbabf('0x4c')],{'include':[{'model':db['SugarcrmField'],'as':_0xbabf('0x58')},{'model':db[_0xbabf('0x59')],'as':_0xbabf('0x56')}]});}return null;})[_0xbabf('0x28')](respondWithResult(_0x15d2dc,null))[_0xbabf('0x47')](handleError(_0x15d2dc,null));};exports[_0xbabf('0x5a')]=function(_0x222422,_0x1faee4,_0x52ccf4){var _0x4921a1='';var _0x53abc9=['id',_0xbabf('0x2c'),_0xbabf('0x5b'),_0xbabf('0x5c'),'description',_0xbabf('0x5d'),'duration_hours',_0xbabf('0x5e'),_0xbabf('0x5f'),_0xbabf('0x60'),_0xbabf('0x61'),_0xbabf('0x62')];return db[_0xbabf('0x30')]['findOne']({'where':{'id':_0x222422['params']['id']},'attributes':['id',_0xbabf('0x63'),_0xbabf('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0x1faee4,null))[_0xbabf('0x28')](function(_0x57212d){if(_0x57212d){_0x4921a1=_0x57212d[_0xbabf('0x65')];var _0x2ce86e=_0x4921a1['slice'](-0x1);if(_0x2ce86e==='/'){_0x4921a1=_0x4921a1[_0xbabf('0x66')](0x0,_0x4921a1[_0xbabf('0x67')](_0x2ce86e));}return rp({'method':'POST','uri':util[_0xbabf('0x68')](_0xbabf('0x69'),_0x4921a1,_0xbabf('0x6a')),'json':!![],'form':{'method':_0xbabf('0x6b'),'input_type':_0xbabf('0x6c'),'response_type':_0xbabf('0x6c'),'rest_data':JSON[_0xbabf('0x6d')]({'user_auth':{'user_name':_0x57212d[_0xbabf('0x63')],'password':_0x57212d[_0xbabf('0x64')],'encryption':_0xbabf('0x6e')},'application':_0xbabf('0x6f')})}});}})[_0xbabf('0x28')](function(_0x32319e){if(_0x32319e&&_0x32319e[_0xbabf('0x2c')]!=='Invalid\x20Login'&&_0x32319e[_0xbabf('0x2c')]!==_0xbabf('0x70')){return rp({'method':'POST','uri':util[_0xbabf('0x68')](_0xbabf('0x69'),_0x4921a1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xbabf('0x71'),'input_type':_0xbabf('0x6c'),'response_type':'JSON','rest_data':JSON[_0xbabf('0x6d')]({'session':_0x32319e['id'],'module_name':_0xbabf('0x72')})}})[_0xbabf('0x28')](function(_0x5ab2f3){if(_0x5ab2f3){var _0x83af73=_[_0xbabf('0x73')](_0x5ab2f3['module_fields']);_[_0xbabf('0x74')](_0x83af73,function(_0xeef16e){return _0x53abc9[_0xbabf('0x75')](_0xeef16e[_0xbabf('0x2c')]);});return{'count':_0x83af73[_0xbabf('0x4a')],'rows':_[_0xbabf('0x2f')](_0x83af73,function(_0x18fb97){return{'id':_0x18fb97[_0xbabf('0x2c')],'name':_0x18fb97[_0xbabf('0x76')],'custom':_['endsWith'](_0x18fb97['name'],'_c')?!![]:![],'options':_0x18fb97[_0xbabf('0x42')]?_[_0xbabf('0x2f')](_['values'](_0x18fb97['options']),function(_0x17f29b){return{'name':_0x17f29b[_0xbabf('0x77')],'value':_0x17f29b['name']};}):[]};})};}})[_0xbabf('0x28')](respondWithResult(_0x1faee4,null))['catch'](function(_0x4b917e){var _0x4f6dfa=_0x222422[_0xbabf('0x35')]['test']?0x1f4:_0x4b917e[_0xbabf('0x78')]||0x1f4;logger[_0xbabf('0x2a')](_0xbabf('0x79'),_0xbabf('0x5a'),_0x4f6dfa,JSON['stringify'](_0x4b917e));delete _0x4b917e['name'];if(_0x4f6dfa===0x191){_0x4f6dfa=0x190;}_0x1faee4[_0xbabf('0x1b')](_0x4f6dfa)[_0xbabf('0x2d')](_0x222422[_0xbabf('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4b917e[_0xbabf('0x78')]}:_0x4b917e);});}else{var _0x1f26eb=0x1f4;_0x1faee4[_0xbabf('0x1b')](_0x1f26eb)['send']({'message':_0xbabf('0x7a'),'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 e73a268..5c739c4 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 _0x8ff4=['int_sugarcrm_accounts','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x1e927a,_0x1974b2){var _0x32a169=function(_0x4ac262){while(--_0x4ac262){_0x1e927a['push'](_0x1e927a['shift']());}};_0x32a169(++_0x1974b2);}(_0x8ff4,0x11f));var _0x48ff=function(_0x246426,_0x505c21){_0x246426=_0x246426-0x0;var _0x320fcf=_0x8ff4[_0x246426];return _0x320fcf;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ff('0x1'));var moment=require(_0x48ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x48ff('0x3'));var fs=require('fs');var path=require(_0x48ff('0x4'));var rimraf=require(_0x48ff('0x5'));var config=require(_0x48ff('0x6'));var attributes=require(_0x48ff('0x7'));var integrations=require(_0x48ff('0x8'));module[_0x48ff('0x9')]=function(_0x61d3b9,_0x28505e){return _0x61d3b9[_0x48ff('0xa')](_0x48ff('0xb'),attributes,{'tableName':_0x48ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d2a=['int_sugarcrm_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount'];(function(_0x52a439,_0x2d9d04){var _0x52427e=function(_0x2020f3){while(--_0x2020f3){_0x52a439['push'](_0x52a439['shift']());}};_0x52427e(++_0x2d9d04);}(_0x5d2a,0x139));var _0xa5d2=function(_0x21d97e,_0x2d1c5a){_0x21d97e=_0x21d97e-0x0;var _0x6bf4da=_0x5d2a[_0x21d97e];return _0x6bf4da;};'use strict';var _=require('lodash');var util=require(_0xa5d2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa5d2('0x1'));var BPromise=require(_0xa5d2('0x2'));var rp=require(_0xa5d2('0x3'));var fs=require('fs');var path=require(_0xa5d2('0x4'));var rimraf=require(_0xa5d2('0x5'));var config=require(_0xa5d2('0x6'));var attributes=require(_0xa5d2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa5d2('0x8')]=function(_0x43b112,_0xdafecb){return _0x43b112[_0xa5d2('0x9')](_0xa5d2('0xa'),attributes,{'tableName':_0xa5d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1f7dd6f..5b63749 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 _0x8d06=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','SugarcrmAccount','raw','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','stringify','lodash','util','moment','randomstring'];(function(_0x2a7812,_0x1ce83a){var _0x3e1342=function(_0x3ff9fb){while(--_0x3ff9fb){_0x2a7812['push'](_0x2a7812['shift']());}};_0x3e1342(++_0x1ce83a);}(_0x8d06,0x1b8));var _0x68d0=function(_0x5853fa,_0xc1a5e2){_0x5853fa=_0x5853fa-0x0;var _0x588860=_0x8d06[_0x5853fa];return _0x588860;};'use strict';var _=require(_0x68d0('0x0'));var util=require(_0x68d0('0x1'));var moment=require(_0x68d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x68d0('0x3'));var fs=require('fs');var Redis=require(_0x68d0('0x4'));var db=require(_0x68d0('0x5'))['db'];var utils=require(_0x68d0('0x6'));var logger=require(_0x68d0('0x7'))(_0x68d0('0x8'));var config=require(_0x68d0('0x9'));var jayson=require(_0x68d0('0xa'));var client=jayson[_0x68d0('0xb')][_0x68d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52002d,_0x342549,_0x4a28ff){return new BPromise(function(_0x1530a4,_0x37a376){return client[_0x68d0('0xd')](_0x52002d,_0x4a28ff)[_0x68d0('0xe')](function(_0x323e3a){logger[_0x68d0('0xf')](_0x68d0('0x10'),_0x342549,_0x68d0('0x11'));logger[_0x68d0('0x12')](_0x68d0('0x13'),_0x342549,'request\x20sent',JSON['stringify'](_0x323e3a));if(_0x323e3a['error']){if(_0x323e3a['error'][_0x68d0('0x14')]===0x1f4){logger['error'](_0x68d0('0x10'),_0x342549,_0x323e3a[_0x68d0('0x15')][_0x68d0('0x16')]);return _0x37a376(_0x323e3a[_0x68d0('0x15')]['message']);}logger[_0x68d0('0x15')](_0x68d0('0x10'),_0x342549,_0x323e3a[_0x68d0('0x15')]['message']);return _0x1530a4(_0x323e3a[_0x68d0('0x15')][_0x68d0('0x16')]);}else{logger[_0x68d0('0xf')](_0x68d0('0x10'),_0x342549,_0x68d0('0x11'));_0x1530a4(_0x323e3a[_0x68d0('0x17')][_0x68d0('0x16')]);}})['catch'](function(_0x5a7074){logger[_0x68d0('0x15')](_0x68d0('0x10'),_0x342549,_0x5a7074);_0x37a376(_0x5a7074);});});}exports['GetSugarcrmAccount']=function(_0x4361c0){var _0x9ae37c=this;return new Promise(function(_0x120f89,_0x57ad7a){return db[_0x68d0('0x18')]['findAll']({'raw':_0x4361c0['options']?_0x4361c0['options'][_0x68d0('0x19')]===undefined?!![]:![]:!![],'where':_0x4361c0['options']?_0x4361c0[_0x68d0('0x1a')][_0x68d0('0x1b')]||null:null,'attributes':_0x4361c0[_0x68d0('0x1a')]?_0x4361c0['options'][_0x68d0('0x1c')]||null:null,'limit':_0x4361c0[_0x68d0('0x1a')]?_0x4361c0[_0x68d0('0x1a')][_0x68d0('0x1d')]||null:null,'include':_0x4361c0[_0x68d0('0x1a')]?_0x4361c0[_0x68d0('0x1a')][_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0x4361c0['options'][_0x68d0('0x1e')],function(_0x3ff5ae){return{'model':db[_0x3ff5ae[_0x68d0('0x20')]],'as':_0x3ff5ae['as'],'attributes':_0x3ff5ae[_0x68d0('0x1c')],'include':_0x3ff5ae[_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0x3ff5ae[_0x68d0('0x1e')],function(_0x422418){return{'model':db[_0x422418['model']],'as':_0x422418['as'],'attributes':_0x422418[_0x68d0('0x1c')],'include':_0x422418[_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0x422418[_0x68d0('0x1e')],function(_0x52a47c){return{'model':db[_0x52a47c['model']],'as':_0x52a47c['as'],'attributes':_0x52a47c[_0x68d0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x68d0('0xe')](function(_0x5de1fc){logger[_0x68d0('0xf')](_0x68d0('0x21'),_0x4361c0);logger[_0x68d0('0x12')](_0x68d0('0x21'),_0x4361c0,JSON['stringify'](_0x5de1fc));_0x120f89(_0x5de1fc);})[_0x68d0('0x22')](function(_0x171d3e){logger[_0x68d0('0x15')](_0x68d0('0x21'),_0x171d3e[_0x68d0('0x16')],_0x4361c0);_0x57ad7a(_0x9ae37c[_0x68d0('0x15')](0x1f4,_0x171d3e[_0x68d0('0x16')]));});});};exports[_0x68d0('0x23')]=function(_0x28eaa2){var _0x361ab2=this;return new Promise(function(_0x4f6199,_0x275f29){return db[_0x68d0('0x18')]['find']({'raw':_0x28eaa2['options']?_0x28eaa2['options'][_0x68d0('0x19')]===undefined?!![]:![]:!![],'where':_0x28eaa2[_0x68d0('0x1a')]?_0x28eaa2[_0x68d0('0x1a')][_0x68d0('0x1b')]||null:null,'attributes':_0x28eaa2[_0x68d0('0x1a')]?_0x28eaa2['options'][_0x68d0('0x1c')]||null:null,'include':_0x28eaa2[_0x68d0('0x1a')]?_0x28eaa2[_0x68d0('0x1a')][_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0x28eaa2[_0x68d0('0x1a')][_0x68d0('0x1e')],function(_0x56189f){return{'model':db[_0x56189f[_0x68d0('0x20')]],'as':_0x56189f['as'],'attributes':_0x56189f[_0x68d0('0x1c')],'include':_0x56189f[_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0x56189f['include'],function(_0xe9e58){return{'model':db[_0xe9e58['model']],'as':_0xe9e58['as'],'attributes':_0xe9e58[_0x68d0('0x1c')],'include':_0xe9e58[_0x68d0('0x1e')]?_[_0x68d0('0x1f')](_0xe9e58[_0x68d0('0x1e')],function(_0xb963f4){return{'model':db[_0xb963f4[_0x68d0('0x20')]],'as':_0xb963f4['as'],'attributes':_0xb963f4[_0x68d0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x68d0('0xe')](function(_0x9baa0b){logger[_0x68d0('0xf')]('ShowSugarcrmAccount',_0x28eaa2);logger[_0x68d0('0x12')](_0x68d0('0x23'),_0x28eaa2,JSON[_0x68d0('0x24')](_0x9baa0b));_0x4f6199(_0x9baa0b);})[_0x68d0('0x22')](function(_0xcca6bd){logger[_0x68d0('0x15')]('ShowSugarcrmAccount',_0xcca6bd[_0x68d0('0x16')],_0x28eaa2);_0x275f29(_0x361ab2[_0x68d0('0x15')](0x1f4,_0xcca6bd[_0x68d0('0x16')]));});});}; \ No newline at end of file +var _0x4c58=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x585cb3,_0x2f6f91){var _0x19eabe=function(_0x2bbc6b){while(--_0x2bbc6b){_0x585cb3['push'](_0x585cb3['shift']());}};_0x19eabe(++_0x2f6f91);}(_0x4c58,0x99));var _0x84c5=function(_0x1ac202,_0x562f44){_0x1ac202=_0x1ac202-0x0;var _0x1cbd54=_0x4c58[_0x1ac202];return _0x1cbd54;};'use strict';var _=require('lodash');var util=require(_0x84c5('0x0'));var moment=require('moment');var BPromise=require(_0x84c5('0x1'));var rs=require(_0x84c5('0x2'));var fs=require('fs');var Redis=require(_0x84c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84c5('0x4'));var logger=require(_0x84c5('0x5'))(_0x84c5('0x6'));var config=require(_0x84c5('0x7'));var jayson=require(_0x84c5('0x8'));var client=jayson['client'][_0x84c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff7e4,_0x1c3307,_0x4b6f19){return new BPromise(function(_0x171951,_0x55fb12){return client[_0x84c5('0xa')](_0x1ff7e4,_0x4b6f19)[_0x84c5('0xb')](function(_0x1072de){logger[_0x84c5('0xc')](_0x84c5('0xd'),_0x1c3307,_0x84c5('0xe'));logger['debug'](_0x84c5('0xf'),_0x1c3307,'request\x20sent',JSON[_0x84c5('0x10')](_0x1072de));if(_0x1072de[_0x84c5('0x11')]){if(_0x1072de[_0x84c5('0x11')][_0x84c5('0x12')]===0x1f4){logger['error'](_0x84c5('0xd'),_0x1c3307,_0x1072de[_0x84c5('0x11')][_0x84c5('0x13')]);return _0x55fb12(_0x1072de['error'][_0x84c5('0x13')]);}logger['error'](_0x84c5('0xd'),_0x1c3307,_0x1072de['error'][_0x84c5('0x13')]);return _0x171951(_0x1072de[_0x84c5('0x11')][_0x84c5('0x13')]);}else{logger[_0x84c5('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x1c3307,'request\x20sent');_0x171951(_0x1072de[_0x84c5('0x14')][_0x84c5('0x13')]);}})[_0x84c5('0x15')](function(_0x2f99fb){logger[_0x84c5('0x11')](_0x84c5('0xd'),_0x1c3307,_0x2f99fb);_0x55fb12(_0x2f99fb);});});}exports[_0x84c5('0x16')]=function(_0x42d73b){var _0x4d8367=this;return new Promise(function(_0x190ced,_0x3eb20b){return db['SugarcrmAccount'][_0x84c5('0x17')]({'raw':_0x42d73b[_0x84c5('0x18')]?_0x42d73b[_0x84c5('0x18')][_0x84c5('0x19')]===undefined?!![]:![]:!![],'where':_0x42d73b[_0x84c5('0x18')]?_0x42d73b[_0x84c5('0x18')][_0x84c5('0x1a')]||null:null,'attributes':_0x42d73b[_0x84c5('0x18')]?_0x42d73b[_0x84c5('0x18')][_0x84c5('0x1b')]||null:null,'limit':_0x42d73b[_0x84c5('0x18')]?_0x42d73b[_0x84c5('0x18')]['limit']||null:null,'include':_0x42d73b[_0x84c5('0x18')]?_0x42d73b[_0x84c5('0x18')][_0x84c5('0x1c')]?_[_0x84c5('0x1d')](_0x42d73b[_0x84c5('0x18')][_0x84c5('0x1c')],function(_0x3c5a24){return{'model':db[_0x3c5a24[_0x84c5('0x1e')]],'as':_0x3c5a24['as'],'attributes':_0x3c5a24['attributes'],'include':_0x3c5a24['include']?_[_0x84c5('0x1d')](_0x3c5a24[_0x84c5('0x1c')],function(_0x12b83e){return{'model':db[_0x12b83e[_0x84c5('0x1e')]],'as':_0x12b83e['as'],'attributes':_0x12b83e[_0x84c5('0x1b')],'include':_0x12b83e[_0x84c5('0x1c')]?_[_0x84c5('0x1d')](_0x12b83e[_0x84c5('0x1c')],function(_0x39c557){return{'model':db[_0x39c557[_0x84c5('0x1e')]],'as':_0x39c557['as'],'attributes':_0x39c557[_0x84c5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84c5('0xb')](function(_0x472706){logger[_0x84c5('0xc')](_0x84c5('0x16'),_0x42d73b);logger['debug'](_0x84c5('0x16'),_0x42d73b,JSON[_0x84c5('0x10')](_0x472706));_0x190ced(_0x472706);})[_0x84c5('0x15')](function(_0x26cf84){logger[_0x84c5('0x11')](_0x84c5('0x16'),_0x26cf84[_0x84c5('0x13')],_0x42d73b);_0x3eb20b(_0x4d8367['error'](0x1f4,_0x26cf84[_0x84c5('0x13')]));});});};exports[_0x84c5('0x1f')]=function(_0x433015){var _0x45d58a=this;return new Promise(function(_0x145517,_0x558b89){return db[_0x84c5('0x20')]['find']({'raw':_0x433015['options']?_0x433015[_0x84c5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x433015[_0x84c5('0x18')]?_0x433015[_0x84c5('0x18')][_0x84c5('0x1a')]||null:null,'attributes':_0x433015['options']?_0x433015[_0x84c5('0x18')][_0x84c5('0x1b')]||null:null,'include':_0x433015[_0x84c5('0x18')]?_0x433015[_0x84c5('0x18')][_0x84c5('0x1c')]?_['map'](_0x433015[_0x84c5('0x18')][_0x84c5('0x1c')],function(_0x4cb14f){return{'model':db[_0x4cb14f[_0x84c5('0x1e')]],'as':_0x4cb14f['as'],'attributes':_0x4cb14f[_0x84c5('0x1b')],'include':_0x4cb14f[_0x84c5('0x1c')]?_[_0x84c5('0x1d')](_0x4cb14f['include'],function(_0x5790b5){return{'model':db[_0x5790b5[_0x84c5('0x1e')]],'as':_0x5790b5['as'],'attributes':_0x5790b5[_0x84c5('0x1b')],'include':_0x5790b5[_0x84c5('0x1c')]?_[_0x84c5('0x1d')](_0x5790b5[_0x84c5('0x1c')],function(_0x3d71c0){return{'model':db[_0x3d71c0[_0x84c5('0x1e')]],'as':_0x3d71c0['as'],'attributes':_0x3d71c0[_0x84c5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84c5('0xb')](function(_0x437062){logger['info']('ShowSugarcrmAccount',_0x433015);logger['debug']('ShowSugarcrmAccount',_0x433015,JSON[_0x84c5('0x10')](_0x437062));_0x145517(_0x437062);})[_0x84c5('0x15')](function(_0x1dc13e){logger[_0x84c5('0x11')](_0x84c5('0x1f'),_0x1dc13e['message'],_0x433015);_0x558b89(_0x45d58a['error'](0x1f4,_0x1dc13e[_0x84c5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8e7e93e..c7913e2 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 _0xd1c4=['getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x2b9dda,_0xa7040d){var _0x264a74=function(_0x2287b9){while(--_0x2287b9){_0x2b9dda['push'](_0x2b9dda['shift']());}};_0x264a74(++_0xa7040d);}(_0xd1c4,0x198));var _0x4d1c=function(_0x39fa9c,_0x2ffbd0){_0x39fa9c=_0x39fa9c-0x0;var _0x198882=_0xd1c4[_0x39fa9c];return _0x198882;};'use strict';var multer=require(_0x4d1c('0x0'));var util=require(_0x4d1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d1c('0x2'));var router=express['Router']();var fs_extra=require(_0x4d1c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4d1c('0x4'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x4d1c('0x5')]('/',auth[_0x4d1c('0x6')](),controller[_0x4d1c('0x7')]);router[_0x4d1c('0x5')](_0x4d1c('0x8'),auth[_0x4d1c('0x6')](),controller['show']);router[_0x4d1c('0x5')](_0x4d1c('0x9'),auth['isAuthenticated'](),controller[_0x4d1c('0xa')]);router[_0x4d1c('0x5')](_0x4d1c('0xb'),auth[_0x4d1c('0x6')](),controller[_0x4d1c('0xc')]);router[_0x4d1c('0x5')](_0x4d1c('0xd'),auth[_0x4d1c('0x6')](),controller['getDescriptions']);router[_0x4d1c('0xe')]('/',auth[_0x4d1c('0x6')](),controller['create']);router[_0x4d1c('0xf')](_0x4d1c('0x8'),auth['isAuthenticated'](),controller[_0x4d1c('0x10')]);router[_0x4d1c('0x11')](_0x4d1c('0x8'),auth[_0x4d1c('0x6')](),controller[_0x4d1c('0x12')]);module[_0x4d1c('0x13')]=router; \ No newline at end of file +var _0x81fa=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x81fa,0xdd));var _0xa81f=function(_0x7b4def,_0x56546f){_0x7b4def=_0x7b4def-0x0;var _0x42f47b=_0x81fa[_0x7b4def];return _0x42f47b;};'use strict';var multer=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var path=require('path');var timeout=require(_0xa81f('0x2'));var express=require(_0xa81f('0x3'));var router=express[_0xa81f('0x4')]();var fs_extra=require(_0xa81f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var controller=require(_0xa81f('0x8'));router[_0xa81f('0x9')]('/',auth[_0xa81f('0xa')](),controller[_0xa81f('0xb')]);router[_0xa81f('0x9')](_0xa81f('0xc'),auth[_0xa81f('0xa')](),controller[_0xa81f('0xd')]);router[_0xa81f('0x9')](_0xa81f('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xa81f('0x9')](_0xa81f('0xf'),auth['isAuthenticated'](),controller[_0xa81f('0x10')]);router['get'](_0xa81f('0x11'),auth['isAuthenticated'](),controller[_0xa81f('0x12')]);router['post']('/',auth[_0xa81f('0xa')](),controller['create']);router[_0xa81f('0x13')]('/:id',auth[_0xa81f('0xa')](),controller[_0xa81f('0x14')]);router[_0xa81f('0x15')](_0xa81f('0xc'),auth['isAuthenticated'](),controller[_0xa81f('0x16')]);module[_0xa81f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5cb2736..8296822 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 _0x72b0=['exports','STRING','sequelize'];(function(_0x5bf9f4,_0x58e0d7){var _0x1032e5=function(_0x470de2){while(--_0x470de2){_0x5bf9f4['push'](_0x5bf9f4['shift']());}};_0x1032e5(++_0x58e0d7);}(_0x72b0,0x1b8));var _0x072b=function(_0x2ca794,_0x3e0030){_0x2ca794=_0x2ca794-0x0;var _0x27b67b=_0x72b0[_0x2ca794];return _0x27b67b;};'use strict';var Sequelize=require(_0x072b('0x0'));module[_0x072b('0x1')]={'name':{'type':Sequelize[_0x072b('0x2')]},'description':{'type':Sequelize[_0x072b('0x2')]}}; \ No newline at end of file +var _0x1539=['STRING','sequelize','exports'];(function(_0x1428b8,_0x3817ce){var _0x581af5=function(_0x12fd2b){while(--_0x12fd2b){_0x1428b8['push'](_0x1428b8['shift']());}};_0x581af5(++_0x3817ce);}(_0x1539,0x17b));var _0x9153=function(_0x447648,_0x71f8b3){_0x447648=_0x447648-0x0;var _0x2e3d9a=_0x1539[_0x447648];return _0x2e3d9a;};'use strict';var Sequelize=require(_0x9153('0x0'));module[_0x9153('0x1')]={'name':{'type':Sequelize[_0x9153('0x2')]},'description':{'type':Sequelize[_0x9153('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a3f6bca..53e82f2 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 _0x1fdd=['json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','findOne','SugarcrmField','sort','getFields','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3c709a,_0x2d592d){var _0x94cf35=function(_0x400931){while(--_0x400931){_0x3c709a['push'](_0x3c709a['shift']());}};_0x94cf35(++_0x2d592d);}(_0x1fdd,0x10d));var _0xd1fd=function(_0x4f73b2,_0xecd3da){_0x4f73b2=_0x4f73b2-0x0;var _0x5d7e8c=_0x1fdd[_0x4f73b2];return _0x5d7e8c;};'use strict';var emlformat=require(_0xd1fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1fd('0x1'));var jsonpatch=require(_0xd1fd('0x2'));var rp=require(_0xd1fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd1fd('0x4'));var util=require(_0xd1fd('0x5'));var path=require('path');var sox=require(_0xd1fd('0x6'));var csv=require(_0xd1fd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1fd('0x8'));var _=require(_0xd1fd('0x9'));var squel=require('squel');var crypto=require(_0xd1fd('0xa'));var jsforce=require(_0xd1fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd1fd('0x7'));var querystring=require(_0xd1fd('0xc'));var Papa=require(_0xd1fd('0xd'));var Redis=require('ioredis');var authService=require(_0xd1fd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd1fd('0xf'));var hardwareService=require(_0xd1fd('0x10'));var logger=require('../../config/logger')(_0xd1fd('0x11'));var utils=require('../../config/utils');var config=require(_0xd1fd('0x12'));var licenseUtil=require(_0xd1fd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ee02,_0x46cb67){_0x46cb67=_0x46cb67||0xcc;return function(_0xa8808c){if(_0xa8808c){return _0x29ee02[_0xd1fd('0x14')](_0x46cb67);}return _0x29ee02[_0xd1fd('0x15')](_0x46cb67)[_0xd1fd('0x16')]();};}function respondWithResult(_0x1af9ed,_0xd164d7){_0xd164d7=_0xd164d7||0xc8;return function(_0x4a2546){if(_0x4a2546){return _0x1af9ed[_0xd1fd('0x15')](_0xd164d7)[_0xd1fd('0x17')](_0x4a2546);}};}function respondWithFilteredResult(_0x21de5c,_0xe58a84){return function(_0x34b554){if(_0x34b554){var _0x2a1d84=typeof _0xe58a84[_0xd1fd('0x18')]==='undefined'&&typeof _0xe58a84[_0xd1fd('0x19')]==='undefined';var _0x4cc3e7=_0x34b554[_0xd1fd('0x1a')];var _0xdf9528=_0x2a1d84?0x0:_0xe58a84['offset'];var _0x2ff16d=_0x2a1d84?_0x34b554['count']:_0xe58a84['offset']+_0xe58a84[_0xd1fd('0x19')];var _0x35d27a;if(_0x2ff16d>=_0x4cc3e7){_0x2ff16d=_0x4cc3e7;_0x35d27a=0xc8;}else{_0x35d27a=0xce;}_0x21de5c[_0xd1fd('0x15')](_0x35d27a);return _0x21de5c['set'](_0xd1fd('0x1b'),_0xdf9528+'-'+_0x2ff16d+'/'+_0x4cc3e7)[_0xd1fd('0x17')](_0x34b554);}return null;};}function patchUpdates(_0x243311){return function(_0x30cbf0){try{jsonpatch[_0xd1fd('0x1c')](_0x30cbf0,_0x243311,!![]);}catch(_0x49477a){return BPromise[_0xd1fd('0x1d')](_0x49477a);}return _0x30cbf0['save']();};}function saveUpdates(_0x2ba366,_0x129a4f){return function(_0x13de99){if(_0x13de99){return _0x13de99[_0xd1fd('0x1e')](_0x2ba366)[_0xd1fd('0x1f')](function(_0x2d5f3){return _0x2d5f3;});}return null;};}function removeEntity(_0x4fef49,_0x2f7f8a){return function(_0x3c42cd){if(_0x3c42cd){return _0x3c42cd[_0xd1fd('0x20')]()['then'](function(){_0x4fef49[_0xd1fd('0x15')](0xcc)[_0xd1fd('0x16')]();});}};}function handleEntityNotFound(_0x35c14a,_0x34aed9){return function(_0x281ba7){if(!_0x281ba7){_0x35c14a['sendStatus'](0x194);}return _0x281ba7;};}function handleError(_0x25b357,_0x29989d){_0x29989d=_0x29989d||0x1f4;return function(_0x2d9928){logger[_0xd1fd('0x21')](_0x2d9928['stack']);if(_0x2d9928[_0xd1fd('0x22')]){delete _0x2d9928[_0xd1fd('0x22')];}_0x25b357[_0xd1fd('0x15')](_0x29989d)['send'](_0x2d9928);};}exports['index']=function(_0x1c32d8,_0x5ce028){var _0x2b46de={},_0x3cc5c9={},_0x21ff28={'count':0x0,'rows':[]};var _0x536138=_[_0xd1fd('0x23')](db[_0xd1fd('0x24')][_0xd1fd('0x25')],function(_0x2ff078){return{'name':_0x2ff078[_0xd1fd('0x26')],'type':_0x2ff078[_0xd1fd('0x27')][_0xd1fd('0x28')]};});_0x3cc5c9[_0xd1fd('0x29')]=_[_0xd1fd('0x23')](_0x536138,_0xd1fd('0x22'));_0x3cc5c9[_0xd1fd('0x2a')]=_['keys'](_0x1c32d8[_0xd1fd('0x2a')]);_0x3cc5c9[_0xd1fd('0x2b')]=_[_0xd1fd('0x2c')](_0x3cc5c9['model'],_0x3cc5c9[_0xd1fd('0x2a')]);_0x2b46de['attributes']=_['intersection'](_0x3cc5c9[_0xd1fd('0x29')],qs[_0xd1fd('0x2d')](_0x1c32d8[_0xd1fd('0x2a')][_0xd1fd('0x2d')]));_0x2b46de[_0xd1fd('0x2e')]=_0x2b46de[_0xd1fd('0x2e')][_0xd1fd('0x2f')]?_0x2b46de[_0xd1fd('0x2e')]:_0x3cc5c9[_0xd1fd('0x29')];if(!_0x1c32d8[_0xd1fd('0x2a')][_0xd1fd('0x30')](_0xd1fd('0x31'))){_0x2b46de[_0xd1fd('0x19')]=qs[_0xd1fd('0x19')](_0x1c32d8['query'][_0xd1fd('0x19')]);_0x2b46de[_0xd1fd('0x18')]=qs[_0xd1fd('0x18')](_0x1c32d8[_0xd1fd('0x2a')]['offset']);}_0x2b46de['order']=qs['sort'](_0x1c32d8[_0xd1fd('0x2a')]['sort']);_0x2b46de['where']=qs[_0xd1fd('0x2b')](_[_0xd1fd('0x32')](_0x1c32d8[_0xd1fd('0x2a')],_0x3cc5c9[_0xd1fd('0x2b')]),_0x536138);if(_0x1c32d8['query']['filter']){_0x2b46de[_0xd1fd('0x33')]=_[_0xd1fd('0x34')](_0x2b46de['where'],{'$or':_[_0xd1fd('0x23')](_0x536138,function(_0x324d73){if(_0x324d73[_0xd1fd('0x27')]!==_0xd1fd('0x35')){var _0x22bcc9={};_0x22bcc9[_0x324d73[_0xd1fd('0x22')]]={'$like':'%'+_0x1c32d8[_0xd1fd('0x2a')][_0xd1fd('0x36')]+'%'};return _0x22bcc9;}})});}_0x2b46de=_[_0xd1fd('0x34')]({},_0x2b46de,_0x1c32d8[_0xd1fd('0x37')]);var _0x3f9670={'where':_0x2b46de['where']};return db[_0xd1fd('0x24')]['count'](_0x3f9670)[_0xd1fd('0x1f')](function(_0x43b95d){_0x21ff28['count']=_0x43b95d;if(_0x1c32d8[_0xd1fd('0x2a')][_0xd1fd('0x38')]){_0x2b46de[_0xd1fd('0x39')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xd1fd('0x3a')](_0x2b46de);})[_0xd1fd('0x1f')](function(_0xb58ec7){_0x21ff28[_0xd1fd('0x3b')]=_0xb58ec7;return _0x21ff28;})['then'](respondWithFilteredResult(_0x5ce028,_0x2b46de))[_0xd1fd('0x3c')](handleError(_0x5ce028,null));};exports[_0xd1fd('0x3d')]=function(_0x148604,_0x23ec20){var _0x19c9f7={'raw':![],'where':{'id':_0x148604[_0xd1fd('0x3e')]['id']}},_0x303535={};_0x303535['model']=_[_0xd1fd('0x3f')](db[_0xd1fd('0x24')][_0xd1fd('0x25')]);_0x303535[_0xd1fd('0x2a')]=_[_0xd1fd('0x3f')](_0x148604[_0xd1fd('0x2a')]);_0x303535[_0xd1fd('0x2b')]=_[_0xd1fd('0x2c')](_0x303535[_0xd1fd('0x29')],_0x303535[_0xd1fd('0x2a')]);_0x19c9f7[_0xd1fd('0x2e')]=_[_0xd1fd('0x2c')](_0x303535[_0xd1fd('0x29')],qs[_0xd1fd('0x2d')](_0x148604[_0xd1fd('0x2a')][_0xd1fd('0x2d')]));_0x19c9f7[_0xd1fd('0x2e')]=_0x19c9f7[_0xd1fd('0x2e')][_0xd1fd('0x2f')]?_0x19c9f7['attributes']:_0x303535[_0xd1fd('0x29')];if(_0x148604['query'][_0xd1fd('0x38')]){_0x19c9f7[_0xd1fd('0x39')]=[{'all':!![]}];}_0x19c9f7=_['merge']({},_0x19c9f7,_0x148604[_0xd1fd('0x37')]);return db[_0xd1fd('0x24')]['find'](_0x19c9f7)['then'](handleEntityNotFound(_0x23ec20,null))['then'](respondWithResult(_0x23ec20,null))['catch'](handleError(_0x23ec20,null));};exports['create']=function(_0x251878,_0x4ce108){return db[_0xd1fd('0x24')]['create'](_0x251878[_0xd1fd('0x40')],{})[_0xd1fd('0x1f')](respondWithResult(_0x4ce108,0xc9))[_0xd1fd('0x3c')](handleError(_0x4ce108,null));};exports[_0xd1fd('0x1e')]=function(_0x15f0c9,_0x33da12){if(_0x15f0c9['body']['id']){delete _0x15f0c9[_0xd1fd('0x40')]['id'];}return db[_0xd1fd('0x24')][_0xd1fd('0x41')]({'where':{'id':_0x15f0c9['params']['id']}})[_0xd1fd('0x1f')](handleEntityNotFound(_0x33da12,null))['then'](saveUpdates(_0x15f0c9['body'],null))['then'](respondWithResult(_0x33da12,null))['catch'](handleError(_0x33da12,null));};exports[_0xd1fd('0x20')]=function(_0xb320a0,_0xc5db4){return db['SugarcrmConfiguration'][_0xd1fd('0x41')]({'where':{'id':_0xb320a0[_0xd1fd('0x3e')]['id']}})[_0xd1fd('0x1f')](handleEntityNotFound(_0xc5db4,null))[_0xd1fd('0x1f')](removeEntity(_0xc5db4,null))[_0xd1fd('0x3c')](handleError(_0xc5db4,null));};exports['getFields']=function(_0x281dfd,_0x323f05,_0x4a7d02){var _0x32f93d={};var _0xbd0f41={};var _0x1450ee;var _0x47e932;return db[_0xd1fd('0x24')][_0xd1fd('0x42')]({'where':{'id':_0x281dfd['params']['id']}})['then'](handleEntityNotFound(_0x323f05,null))['then'](function(_0x472aee){if(_0x472aee){_0x1450ee=_0x472aee;_0xbd0f41[_0xd1fd('0x29')]=_['keys'](db[_0xd1fd('0x43')][_0xd1fd('0x25')]);_0xbd0f41[_0xd1fd('0x2a')]=_[_0xd1fd('0x3f')](_0x281dfd[_0xd1fd('0x2a')]);_0xbd0f41[_0xd1fd('0x2b')]=_['intersection'](_0xbd0f41['model'],_0xbd0f41['query']);_0x32f93d['attributes']=_[_0xd1fd('0x2c')](_0xbd0f41[_0xd1fd('0x29')],qs['fields'](_0x281dfd[_0xd1fd('0x2a')][_0xd1fd('0x2d')]));_0x32f93d[_0xd1fd('0x2e')]=_0x32f93d[_0xd1fd('0x2e')][_0xd1fd('0x2f')]?_0x32f93d['attributes']:_0xbd0f41[_0xd1fd('0x29')];_0x32f93d['order']=qs[_0xd1fd('0x44')](_0x281dfd[_0xd1fd('0x2a')][_0xd1fd('0x44')]);_0x32f93d[_0xd1fd('0x33')]=qs[_0xd1fd('0x2b')](_[_0xd1fd('0x32')](_0x281dfd[_0xd1fd('0x2a')],_0xbd0f41['filters']));if(_0x281dfd[_0xd1fd('0x2a')]['filter']){_0x32f93d[_0xd1fd('0x33')]=_['merge'](_0x32f93d[_0xd1fd('0x33')],{'$or':_[_0xd1fd('0x23')](_0x32f93d[_0xd1fd('0x2e')],function(_0x5a059b){var _0x33da6e={};_0x33da6e[_0x5a059b]={'$like':'%'+_0x281dfd['query'][_0xd1fd('0x36')]+'%'};return _0x33da6e;})});}_0x32f93d=_[_0xd1fd('0x34')]({},_0x32f93d,_0x281dfd[_0xd1fd('0x37')]);return _0x1450ee['getFields'](_0x32f93d);}})['then'](function(_0x41b543){if(_0x41b543){_0x47e932=_0x41b543[_0xd1fd('0x2f')];if(!_0x281dfd[_0xd1fd('0x2a')][_0xd1fd('0x30')](_0xd1fd('0x31'))){_0x32f93d[_0xd1fd('0x19')]=qs['limit'](_0x281dfd['query'][_0xd1fd('0x19')]);_0x32f93d['offset']=qs['offset'](_0x281dfd['query'][_0xd1fd('0x18')]);}return _0x1450ee[_0xd1fd('0x45')](_0x32f93d);}})['then'](function(_0x484fd3){if(_0x484fd3){return _0x484fd3?{'count':_0x47e932,'rows':_0x484fd3}:null;}})[_0xd1fd('0x1f')](respondWithResult(_0x323f05,null))[_0xd1fd('0x3c')](handleError(_0x323f05,null));};exports[_0xd1fd('0x46')]=function(_0x4a08a0,_0x579e4f,_0x380107){var _0x2603f9={};var _0x2dd53c={};var _0x5e09b3;var _0xbd1bab;return db[_0xd1fd('0x24')][_0xd1fd('0x42')]({'where':{'id':_0x4a08a0[_0xd1fd('0x3e')]['id']}})[_0xd1fd('0x1f')](handleEntityNotFound(_0x579e4f,null))[_0xd1fd('0x1f')](function(_0x426438){if(_0x426438){_0x5e09b3=_0x426438;_0x2dd53c[_0xd1fd('0x29')]=_[_0xd1fd('0x3f')](db[_0xd1fd('0x43')]['rawAttributes']);_0x2dd53c[_0xd1fd('0x2a')]=_[_0xd1fd('0x3f')](_0x4a08a0[_0xd1fd('0x2a')]);_0x2dd53c[_0xd1fd('0x2b')]=_['intersection'](_0x2dd53c[_0xd1fd('0x29')],_0x2dd53c[_0xd1fd('0x2a')]);_0x2603f9[_0xd1fd('0x2e')]=_['intersection'](_0x2dd53c['model'],qs[_0xd1fd('0x2d')](_0x4a08a0[_0xd1fd('0x2a')]['fields']));_0x2603f9['attributes']=_0x2603f9['attributes'][_0xd1fd('0x2f')]?_0x2603f9[_0xd1fd('0x2e')]:_0x2dd53c[_0xd1fd('0x29')];_0x2603f9[_0xd1fd('0x47')]=qs['sort'](_0x4a08a0['query'][_0xd1fd('0x44')]);_0x2603f9[_0xd1fd('0x33')]=qs['filters'](_[_0xd1fd('0x32')](_0x4a08a0[_0xd1fd('0x2a')],_0x2dd53c[_0xd1fd('0x2b')]));if(_0x4a08a0[_0xd1fd('0x2a')][_0xd1fd('0x36')]){_0x2603f9['where']=_['merge'](_0x2603f9[_0xd1fd('0x33')],{'$or':_['map'](_0x2603f9[_0xd1fd('0x2e')],function(_0x2df965){var _0x3d1880={};_0x3d1880[_0x2df965]={'$like':'%'+_0x4a08a0[_0xd1fd('0x2a')][_0xd1fd('0x36')]+'%'};return _0x3d1880;})});}_0x2603f9=_[_0xd1fd('0x34')]({},_0x2603f9,_0x4a08a0[_0xd1fd('0x37')]);return _0x5e09b3[_0xd1fd('0x46')](_0x2603f9);}})[_0xd1fd('0x1f')](function(_0x3627ac){if(_0x3627ac){_0xbd1bab=_0x3627ac['length'];if(!_0x4a08a0['query'][_0xd1fd('0x30')]('nolimit')){_0x2603f9[_0xd1fd('0x19')]=qs[_0xd1fd('0x19')](_0x4a08a0['query'][_0xd1fd('0x19')]);_0x2603f9['offset']=qs[_0xd1fd('0x18')](_0x4a08a0['query'][_0xd1fd('0x18')]);}return _0x5e09b3[_0xd1fd('0x46')](_0x2603f9);}})[_0xd1fd('0x1f')](function(_0x3e6673){if(_0x3e6673){return _0x3e6673?{'count':_0xbd1bab,'rows':_0x3e6673}:null;}})['then'](respondWithResult(_0x579e4f,null))[_0xd1fd('0x3c')](handleError(_0x579e4f,null));};exports['getDescriptions']=function(_0x19bc59,_0x2c02b7,_0x1e4200){var _0x620638={};var _0xbe8834={};var _0x820566;var _0x4162f7;return db[_0xd1fd('0x24')][_0xd1fd('0x42')]({'where':{'id':_0x19bc59[_0xd1fd('0x3e')]['id']}})[_0xd1fd('0x1f')](handleEntityNotFound(_0x2c02b7,null))['then'](function(_0xbbb239){if(_0xbbb239){_0x820566=_0xbbb239;_0xbe8834['model']=_[_0xd1fd('0x3f')](db[_0xd1fd('0x43')][_0xd1fd('0x25')]);_0xbe8834[_0xd1fd('0x2a')]=_[_0xd1fd('0x3f')](_0x19bc59[_0xd1fd('0x2a')]);_0xbe8834[_0xd1fd('0x2b')]=_[_0xd1fd('0x2c')](_0xbe8834[_0xd1fd('0x29')],_0xbe8834['query']);_0x620638[_0xd1fd('0x2e')]=_[_0xd1fd('0x2c')](_0xbe8834[_0xd1fd('0x29')],qs[_0xd1fd('0x2d')](_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x2d')]));_0x620638['attributes']=_0x620638['attributes'][_0xd1fd('0x2f')]?_0x620638[_0xd1fd('0x2e')]:_0xbe8834[_0xd1fd('0x29')];_0x620638[_0xd1fd('0x47')]=qs[_0xd1fd('0x44')](_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x44')]);_0x620638[_0xd1fd('0x33')]=qs['filters'](_[_0xd1fd('0x32')](_0x19bc59['query'],_0xbe8834[_0xd1fd('0x2b')]));if(_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x36')]){_0x620638['where']=_[_0xd1fd('0x34')](_0x620638['where'],{'$or':_['map'](_0x620638[_0xd1fd('0x2e')],function(_0x58f031){var _0x3c144f={};_0x3c144f[_0x58f031]={'$like':'%'+_0x19bc59[_0xd1fd('0x2a')]['filter']+'%'};return _0x3c144f;})});}_0x620638=_['merge']({},_0x620638,_0x19bc59[_0xd1fd('0x37')]);return _0x820566['getDescriptions'](_0x620638);}})[_0xd1fd('0x1f')](function(_0x4ba5f2){if(_0x4ba5f2){_0x4162f7=_0x4ba5f2['length'];if(!_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x30')](_0xd1fd('0x31'))){_0x620638[_0xd1fd('0x19')]=qs[_0xd1fd('0x19')](_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x19')]);_0x620638[_0xd1fd('0x18')]=qs[_0xd1fd('0x18')](_0x19bc59[_0xd1fd('0x2a')][_0xd1fd('0x18')]);}return _0x820566[_0xd1fd('0x48')](_0x620638);}})[_0xd1fd('0x1f')](function(_0x2dc74a){if(_0x2dc74a){return _0x2dc74a?{'count':_0x4162f7,'rows':_0x2dc74a}:null;}})[_0xd1fd('0x1f')](respondWithResult(_0x2c02b7,null))[_0xd1fd('0x3c')](handleError(_0x2c02b7,null));}; \ No newline at end of file +var _0x75e4=['moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','rows','catch','show','params','includeAll','include','create','body','find','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x23ef4f,_0x5c109e){var _0x3b9138=function(_0x45752f){while(--_0x45752f){_0x23ef4f['push'](_0x23ef4f['shift']());}};_0x3b9138(++_0x5c109e);}(_0x75e4,0xee));var _0x475e=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x75e4[_0x1b70e3];return _0x1452ab;};'use strict';var emlformat=require(_0x475e('0x0'));var rimraf=require(_0x475e('0x1'));var zipdir=require(_0x475e('0x2'));var jsonpatch=require(_0x475e('0x3'));var rp=require(_0x475e('0x4'));var moment=require(_0x475e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x475e('0x6'));var util=require(_0x475e('0x7'));var path=require('path');var sox=require(_0x475e('0x8'));var csv=require(_0x475e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x475e('0xa'));var _=require(_0x475e('0xb'));var squel=require('squel');var crypto=require(_0x475e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x475e('0xd'));var toCsv=require(_0x475e('0x9'));var querystring=require(_0x475e('0xe'));var Papa=require(_0x475e('0xf'));var Redis=require('ioredis');var authService=require(_0x475e('0x10'));var qs=require(_0x475e('0x11'));var as=require(_0x475e('0x12'));var hardwareService=require(_0x475e('0x13'));var logger=require(_0x475e('0x14'))(_0x475e('0x15'));var utils=require(_0x475e('0x16'));var config=require(_0x475e('0x17'));var licenseUtil=require(_0x475e('0x18'));var db=require(_0x475e('0x19'))['db'];function respondWithStatusCode(_0x4f0dd3,_0x344a1b){_0x344a1b=_0x344a1b||0xcc;return function(_0x1fbf90){if(_0x1fbf90){return _0x4f0dd3[_0x475e('0x1a')](_0x344a1b);}return _0x4f0dd3['status'](_0x344a1b)['end']();};}function respondWithResult(_0x57252b,_0x3588b0){_0x3588b0=_0x3588b0||0xc8;return function(_0xd0d0b5){if(_0xd0d0b5){return _0x57252b[_0x475e('0x1b')](_0x3588b0)[_0x475e('0x1c')](_0xd0d0b5);}};}function respondWithFilteredResult(_0x5f3c88,_0x1d7798){return function(_0x399aa0){if(_0x399aa0){var _0x25edb7=typeof _0x1d7798[_0x475e('0x1d')]===_0x475e('0x1e')&&typeof _0x1d7798[_0x475e('0x1f')]===_0x475e('0x1e');var _0x135437=_0x399aa0[_0x475e('0x20')];var _0x31607d=_0x25edb7?0x0:_0x1d7798[_0x475e('0x1d')];var _0x56e800=_0x25edb7?_0x399aa0[_0x475e('0x20')]:_0x1d7798[_0x475e('0x1d')]+_0x1d7798['limit'];var _0x2a1c8f;if(_0x56e800>=_0x135437){_0x56e800=_0x135437;_0x2a1c8f=0xc8;}else{_0x2a1c8f=0xce;}_0x5f3c88['status'](_0x2a1c8f);return _0x5f3c88[_0x475e('0x21')]('Content-Range',_0x31607d+'-'+_0x56e800+'/'+_0x135437)[_0x475e('0x1c')](_0x399aa0);}return null;};}function patchUpdates(_0x106235){return function(_0x346e2d){try{jsonpatch[_0x475e('0x22')](_0x346e2d,_0x106235,!![]);}catch(_0xacc919){return BPromise[_0x475e('0x23')](_0xacc919);}return _0x346e2d[_0x475e('0x24')]();};}function saveUpdates(_0x22f1ff,_0x22a70a){return function(_0x32d74d){if(_0x32d74d){return _0x32d74d[_0x475e('0x25')](_0x22f1ff)[_0x475e('0x26')](function(_0x18bb4c){return _0x18bb4c;});}return null;};}function removeEntity(_0x4944f9,_0xe0dda5){return function(_0x39c6c6){if(_0x39c6c6){return _0x39c6c6[_0x475e('0x27')]()['then'](function(){_0x4944f9[_0x475e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8c493,_0x1da65c){return function(_0x22c1b7){if(!_0x22c1b7){_0xf8c493['sendStatus'](0x194);}return _0x22c1b7;};}function handleError(_0x3bfab2,_0x45ade9){_0x45ade9=_0x45ade9||0x1f4;return function(_0x30532c){logger[_0x475e('0x28')](_0x30532c[_0x475e('0x29')]);if(_0x30532c[_0x475e('0x2a')]){delete _0x30532c[_0x475e('0x2a')];}_0x3bfab2[_0x475e('0x1b')](_0x45ade9)['send'](_0x30532c);};}exports[_0x475e('0x2b')]=function(_0x37623f,_0x59125e){var _0x2f9237={},_0x3d3188={},_0x42147a={'count':0x0,'rows':[]};var _0x374352=_['map'](db[_0x475e('0x2c')][_0x475e('0x2d')],function(_0x4fcd99){return{'name':_0x4fcd99[_0x475e('0x2e')],'type':_0x4fcd99[_0x475e('0x2f')]['key']};});_0x3d3188['model']=_[_0x475e('0x30')](_0x374352,_0x475e('0x2a'));_0x3d3188[_0x475e('0x31')]=_[_0x475e('0x32')](_0x37623f[_0x475e('0x31')]);_0x3d3188[_0x475e('0x33')]=_[_0x475e('0x34')](_0x3d3188['model'],_0x3d3188[_0x475e('0x31')]);_0x2f9237[_0x475e('0x35')]=_[_0x475e('0x34')](_0x3d3188['model'],qs[_0x475e('0x36')](_0x37623f[_0x475e('0x31')][_0x475e('0x36')]));_0x2f9237[_0x475e('0x35')]=_0x2f9237[_0x475e('0x35')][_0x475e('0x37')]?_0x2f9237[_0x475e('0x35')]:_0x3d3188[_0x475e('0x38')];if(!_0x37623f[_0x475e('0x31')][_0x475e('0x39')](_0x475e('0x3a'))){_0x2f9237['limit']=qs['limit'](_0x37623f['query']['limit']);_0x2f9237[_0x475e('0x1d')]=qs[_0x475e('0x1d')](_0x37623f[_0x475e('0x31')]['offset']);}_0x2f9237[_0x475e('0x3b')]=qs[_0x475e('0x3c')](_0x37623f['query'][_0x475e('0x3c')]);_0x2f9237['where']=qs[_0x475e('0x33')](_['pick'](_0x37623f[_0x475e('0x31')],_0x3d3188[_0x475e('0x33')]),_0x374352);if(_0x37623f[_0x475e('0x31')][_0x475e('0x3d')]){_0x2f9237['where']=_[_0x475e('0x3e')](_0x2f9237[_0x475e('0x3f')],{'$or':_['map'](_0x374352,function(_0x1e047f){if(_0x1e047f[_0x475e('0x2f')]!==_0x475e('0x40')){var _0x12e460={};_0x12e460[_0x1e047f[_0x475e('0x2a')]]={'$like':'%'+_0x37623f[_0x475e('0x31')]['filter']+'%'};return _0x12e460;}})});}_0x2f9237=_[_0x475e('0x3e')]({},_0x2f9237,_0x37623f[_0x475e('0x41')]);var _0x24494b={'where':_0x2f9237[_0x475e('0x3f')]};return db[_0x475e('0x2c')][_0x475e('0x20')](_0x24494b)[_0x475e('0x26')](function(_0x1dc1ad){_0x42147a['count']=_0x1dc1ad;if(_0x37623f['query']['includeAll']){_0x2f9237['include']=[{'all':!![]}];}return db[_0x475e('0x2c')]['findAll'](_0x2f9237);})['then'](function(_0x1e1706){_0x42147a[_0x475e('0x42')]=_0x1e1706;return _0x42147a;})[_0x475e('0x26')](respondWithFilteredResult(_0x59125e,_0x2f9237))[_0x475e('0x43')](handleError(_0x59125e,null));};exports[_0x475e('0x44')]=function(_0x23e333,_0x31084c){var _0xeb21a9={'raw':![],'where':{'id':_0x23e333[_0x475e('0x45')]['id']}},_0x4e553c={};_0x4e553c[_0x475e('0x38')]=_[_0x475e('0x32')](db[_0x475e('0x2c')][_0x475e('0x2d')]);_0x4e553c[_0x475e('0x31')]=_[_0x475e('0x32')](_0x23e333[_0x475e('0x31')]);_0x4e553c['filters']=_[_0x475e('0x34')](_0x4e553c['model'],_0x4e553c[_0x475e('0x31')]);_0xeb21a9[_0x475e('0x35')]=_[_0x475e('0x34')](_0x4e553c[_0x475e('0x38')],qs[_0x475e('0x36')](_0x23e333['query'][_0x475e('0x36')]));_0xeb21a9[_0x475e('0x35')]=_0xeb21a9['attributes']['length']?_0xeb21a9['attributes']:_0x4e553c[_0x475e('0x38')];if(_0x23e333[_0x475e('0x31')][_0x475e('0x46')]){_0xeb21a9[_0x475e('0x47')]=[{'all':!![]}];}_0xeb21a9=_[_0x475e('0x3e')]({},_0xeb21a9,_0x23e333['options']);return db[_0x475e('0x2c')]['find'](_0xeb21a9)[_0x475e('0x26')](handleEntityNotFound(_0x31084c,null))[_0x475e('0x26')](respondWithResult(_0x31084c,null))[_0x475e('0x43')](handleError(_0x31084c,null));};exports[_0x475e('0x48')]=function(_0x491e34,_0xe56b08){return db[_0x475e('0x2c')][_0x475e('0x48')](_0x491e34[_0x475e('0x49')],{})[_0x475e('0x26')](respondWithResult(_0xe56b08,0xc9))[_0x475e('0x43')](handleError(_0xe56b08,null));};exports['update']=function(_0x43bab1,_0x1ac143){if(_0x43bab1[_0x475e('0x49')]['id']){delete _0x43bab1[_0x475e('0x49')]['id'];}return db[_0x475e('0x2c')][_0x475e('0x4a')]({'where':{'id':_0x43bab1['params']['id']}})[_0x475e('0x26')](handleEntityNotFound(_0x1ac143,null))[_0x475e('0x26')](saveUpdates(_0x43bab1[_0x475e('0x49')],null))['then'](respondWithResult(_0x1ac143,null))[_0x475e('0x43')](handleError(_0x1ac143,null));};exports[_0x475e('0x27')]=function(_0x2f5f0b,_0x511f10){return db[_0x475e('0x2c')][_0x475e('0x4a')]({'where':{'id':_0x2f5f0b[_0x475e('0x45')]['id']}})[_0x475e('0x26')](handleEntityNotFound(_0x511f10,null))[_0x475e('0x26')](removeEntity(_0x511f10,null))[_0x475e('0x43')](handleError(_0x511f10,null));};exports[_0x475e('0x4b')]=function(_0x49b45d,_0x40e73e,_0x4f96c5){var _0x55c1bd={};var _0x2ab845={};var _0x580276;var _0x5eabb9;return db[_0x475e('0x2c')][_0x475e('0x4c')]({'where':{'id':_0x49b45d[_0x475e('0x45')]['id']}})[_0x475e('0x26')](handleEntityNotFound(_0x40e73e,null))['then'](function(_0x598f2b){if(_0x598f2b){_0x580276=_0x598f2b;_0x2ab845[_0x475e('0x38')]=_[_0x475e('0x32')](db[_0x475e('0x4d')]['rawAttributes']);_0x2ab845[_0x475e('0x31')]=_[_0x475e('0x32')](_0x49b45d['query']);_0x2ab845[_0x475e('0x33')]=_[_0x475e('0x34')](_0x2ab845[_0x475e('0x38')],_0x2ab845['query']);_0x55c1bd[_0x475e('0x35')]=_[_0x475e('0x34')](_0x2ab845[_0x475e('0x38')],qs[_0x475e('0x36')](_0x49b45d[_0x475e('0x31')]['fields']));_0x55c1bd[_0x475e('0x35')]=_0x55c1bd[_0x475e('0x35')][_0x475e('0x37')]?_0x55c1bd[_0x475e('0x35')]:_0x2ab845['model'];_0x55c1bd[_0x475e('0x3b')]=qs[_0x475e('0x3c')](_0x49b45d[_0x475e('0x31')][_0x475e('0x3c')]);_0x55c1bd[_0x475e('0x3f')]=qs[_0x475e('0x33')](_[_0x475e('0x4e')](_0x49b45d[_0x475e('0x31')],_0x2ab845['filters']));if(_0x49b45d[_0x475e('0x31')]['filter']){_0x55c1bd[_0x475e('0x3f')]=_[_0x475e('0x3e')](_0x55c1bd['where'],{'$or':_[_0x475e('0x30')](_0x55c1bd['attributes'],function(_0x4c6dbb){var _0x26cc18={};_0x26cc18[_0x4c6dbb]={'$like':'%'+_0x49b45d[_0x475e('0x31')]['filter']+'%'};return _0x26cc18;})});}_0x55c1bd=_['merge']({},_0x55c1bd,_0x49b45d[_0x475e('0x41')]);return _0x580276[_0x475e('0x4b')](_0x55c1bd);}})['then'](function(_0x5b7266){if(_0x5b7266){_0x5eabb9=_0x5b7266[_0x475e('0x37')];if(!_0x49b45d['query'][_0x475e('0x39')](_0x475e('0x3a'))){_0x55c1bd[_0x475e('0x1f')]=qs[_0x475e('0x1f')](_0x49b45d['query'][_0x475e('0x1f')]);_0x55c1bd[_0x475e('0x1d')]=qs[_0x475e('0x1d')](_0x49b45d[_0x475e('0x31')]['offset']);}return _0x580276['getFields'](_0x55c1bd);}})[_0x475e('0x26')](function(_0xb0dd4a){if(_0xb0dd4a){return _0xb0dd4a?{'count':_0x5eabb9,'rows':_0xb0dd4a}:null;}})[_0x475e('0x26')](respondWithResult(_0x40e73e,null))[_0x475e('0x43')](handleError(_0x40e73e,null));};exports[_0x475e('0x4f')]=function(_0x1a7c4e,_0x90f64d,_0x1d5f91){var _0x28fe1a={};var _0x1269b0={};var _0x42a341;var _0x369717;return db['SugarcrmConfiguration'][_0x475e('0x4c')]({'where':{'id':_0x1a7c4e[_0x475e('0x45')]['id']}})[_0x475e('0x26')](handleEntityNotFound(_0x90f64d,null))[_0x475e('0x26')](function(_0x2b12aa){if(_0x2b12aa){_0x42a341=_0x2b12aa;_0x1269b0[_0x475e('0x38')]=_[_0x475e('0x32')](db[_0x475e('0x4d')][_0x475e('0x2d')]);_0x1269b0[_0x475e('0x31')]=_[_0x475e('0x32')](_0x1a7c4e[_0x475e('0x31')]);_0x1269b0[_0x475e('0x33')]=_[_0x475e('0x34')](_0x1269b0['model'],_0x1269b0[_0x475e('0x31')]);_0x28fe1a['attributes']=_[_0x475e('0x34')](_0x1269b0[_0x475e('0x38')],qs[_0x475e('0x36')](_0x1a7c4e[_0x475e('0x31')][_0x475e('0x36')]));_0x28fe1a[_0x475e('0x35')]=_0x28fe1a[_0x475e('0x35')][_0x475e('0x37')]?_0x28fe1a['attributes']:_0x1269b0[_0x475e('0x38')];_0x28fe1a[_0x475e('0x3b')]=qs['sort'](_0x1a7c4e[_0x475e('0x31')][_0x475e('0x3c')]);_0x28fe1a[_0x475e('0x3f')]=qs[_0x475e('0x33')](_[_0x475e('0x4e')](_0x1a7c4e[_0x475e('0x31')],_0x1269b0[_0x475e('0x33')]));if(_0x1a7c4e[_0x475e('0x31')][_0x475e('0x3d')]){_0x28fe1a[_0x475e('0x3f')]=_[_0x475e('0x3e')](_0x28fe1a[_0x475e('0x3f')],{'$or':_[_0x475e('0x30')](_0x28fe1a[_0x475e('0x35')],function(_0x14456e){var _0xea35b={};_0xea35b[_0x14456e]={'$like':'%'+_0x1a7c4e[_0x475e('0x31')][_0x475e('0x3d')]+'%'};return _0xea35b;})});}_0x28fe1a=_[_0x475e('0x3e')]({},_0x28fe1a,_0x1a7c4e['options']);return _0x42a341[_0x475e('0x4f')](_0x28fe1a);}})[_0x475e('0x26')](function(_0x147324){if(_0x147324){_0x369717=_0x147324[_0x475e('0x37')];if(!_0x1a7c4e[_0x475e('0x31')]['hasOwnProperty']('nolimit')){_0x28fe1a[_0x475e('0x1f')]=qs['limit'](_0x1a7c4e[_0x475e('0x31')][_0x475e('0x1f')]);_0x28fe1a['offset']=qs[_0x475e('0x1d')](_0x1a7c4e[_0x475e('0x31')][_0x475e('0x1d')]);}return _0x42a341[_0x475e('0x4f')](_0x28fe1a);}})[_0x475e('0x26')](function(_0x46b3b7){if(_0x46b3b7){return _0x46b3b7?{'count':_0x369717,'rows':_0x46b3b7}:null;}})[_0x475e('0x26')](respondWithResult(_0x90f64d,null))[_0x475e('0x43')](handleError(_0x90f64d,null));};exports['getDescriptions']=function(_0x469027,_0x5af4e7,_0x404579){var _0x46015f={};var _0x215119={};var _0x5a3181;var _0x16de18;return db[_0x475e('0x2c')]['findOne']({'where':{'id':_0x469027['params']['id']}})[_0x475e('0x26')](handleEntityNotFound(_0x5af4e7,null))[_0x475e('0x26')](function(_0x2656e5){if(_0x2656e5){_0x5a3181=_0x2656e5;_0x215119['model']=_[_0x475e('0x32')](db[_0x475e('0x4d')][_0x475e('0x2d')]);_0x215119[_0x475e('0x31')]=_['keys'](_0x469027['query']);_0x215119[_0x475e('0x33')]=_['intersection'](_0x215119[_0x475e('0x38')],_0x215119[_0x475e('0x31')]);_0x46015f[_0x475e('0x35')]=_['intersection'](_0x215119[_0x475e('0x38')],qs['fields'](_0x469027[_0x475e('0x31')]['fields']));_0x46015f['attributes']=_0x46015f[_0x475e('0x35')][_0x475e('0x37')]?_0x46015f[_0x475e('0x35')]:_0x215119[_0x475e('0x38')];_0x46015f['order']=qs[_0x475e('0x3c')](_0x469027[_0x475e('0x31')][_0x475e('0x3c')]);_0x46015f[_0x475e('0x3f')]=qs[_0x475e('0x33')](_['pick'](_0x469027['query'],_0x215119[_0x475e('0x33')]));if(_0x469027[_0x475e('0x31')]['filter']){_0x46015f[_0x475e('0x3f')]=_['merge'](_0x46015f['where'],{'$or':_[_0x475e('0x30')](_0x46015f[_0x475e('0x35')],function(_0x7f52ed){var _0x1f398f={};_0x1f398f[_0x7f52ed]={'$like':'%'+_0x469027[_0x475e('0x31')][_0x475e('0x3d')]+'%'};return _0x1f398f;})});}_0x46015f=_[_0x475e('0x3e')]({},_0x46015f,_0x469027['options']);return _0x5a3181[_0x475e('0x50')](_0x46015f);}})['then'](function(_0x23d431){if(_0x23d431){_0x16de18=_0x23d431[_0x475e('0x37')];if(!_0x469027[_0x475e('0x31')][_0x475e('0x39')](_0x475e('0x3a'))){_0x46015f[_0x475e('0x1f')]=qs['limit'](_0x469027[_0x475e('0x31')][_0x475e('0x1f')]);_0x46015f[_0x475e('0x1d')]=qs[_0x475e('0x1d')](_0x469027[_0x475e('0x31')]['offset']);}return _0x5a3181[_0x475e('0x50')](_0x46015f);}})[_0x475e('0x26')](function(_0x39fc30){if(_0x39fc30){return _0x39fc30?{'count':_0x16de18,'rows':_0x39fc30}:null;}})[_0x475e('0x26')](respondWithResult(_0x5af4e7,null))[_0x475e('0x43')](handleError(_0x5af4e7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 64e9d82..8794bd6 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 _0xca68=['SugarcrmConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0xf71c0e,_0x6d222b){var _0x48fecb=function(_0x58b6bc){while(--_0x58b6bc){_0xf71c0e['push'](_0xf71c0e['shift']());}};_0x48fecb(++_0x6d222b);}(_0xca68,0x90));var _0x8ca6=function(_0x20e62d,_0x225c1f){_0x20e62d=_0x20e62d-0x0;var _0x360cd8=_0xca68[_0x20e62d];return _0x360cd8;};'use strict';var _=require(_0x8ca6('0x0'));var util=require('util');var logger=require(_0x8ca6('0x1'))(_0x8ca6('0x2'));var moment=require(_0x8ca6('0x3'));var BPromise=require(_0x8ca6('0x4'));var rp=require(_0x8ca6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ca6('0x6'));var config=require(_0x8ca6('0x7'));var attributes=require(_0x8ca6('0x8'));module[_0x8ca6('0x9')]=function(_0x2d72d3,_0x297e0){return _0x2d72d3['define'](_0x8ca6('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedcd=['../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird','request-promise','path'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xedcd,0x190));var _0xdedc=function(_0xb9e225,_0x5827cb){_0xb9e225=_0xb9e225-0x0;var _0x504f63=_0xedcd[_0xb9e225];return _0x504f63;};'use strict';var _=require('lodash');var util=require(_0xdedc('0x0'));var logger=require('../../config/logger')(_0xdedc('0x1'));var moment=require('moment');var BPromise=require(_0xdedc('0x2'));var rp=require(_0xdedc('0x3'));var fs=require('fs');var path=require(_0xdedc('0x4'));var rimraf=require('rimraf');var config=require(_0xdedc('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x4a8f8f,_0x319a80){return _0x4a8f8f[_0xdedc('0x6')](_0xdedc('0x7'),attributes,{'tableName':_0xdedc('0x8'),'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 59f4748..999b4f5 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 _0x31a9=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x53fdd8,_0xbe348b){var _0x5ca476=function(_0x38156c){while(--_0x38156c){_0x53fdd8['push'](_0x53fdd8['shift']());}};_0x5ca476(++_0xbe348b);}(_0x31a9,0x14c));var _0x931a=function(_0x37087e,_0x719222){_0x37087e=_0x37087e-0x0;var _0x117e6f=_0x31a9[_0x37087e];return _0x117e6f;};'use strict';var _=require('lodash');var util=require(_0x931a('0x0'));var moment=require(_0x931a('0x1'));var BPromise=require(_0x931a('0x2'));var rs=require(_0x931a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x931a('0x4'));var logger=require(_0x931a('0x5'))(_0x931a('0x6'));var config=require(_0x931a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x931a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e48af,_0x979440,_0x976c9b){return new BPromise(function(_0x5da7f5,_0x250826){return client[_0x931a('0x9')](_0x2e48af,_0x976c9b)[_0x931a('0xa')](function(_0x4979a1){logger[_0x931a('0xb')](_0x931a('0xc'),_0x979440,_0x931a('0xd'));logger[_0x931a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x979440,_0x931a('0xd'),JSON['stringify'](_0x4979a1));if(_0x4979a1[_0x931a('0xf')]){if(_0x4979a1['error'][_0x931a('0x10')]===0x1f4){logger[_0x931a('0xf')](_0x931a('0xc'),_0x979440,_0x4979a1[_0x931a('0xf')][_0x931a('0x11')]);return _0x250826(_0x4979a1[_0x931a('0xf')][_0x931a('0x11')]);}logger['error'](_0x931a('0xc'),_0x979440,_0x4979a1[_0x931a('0xf')][_0x931a('0x11')]);return _0x5da7f5(_0x4979a1[_0x931a('0xf')][_0x931a('0x11')]);}else{logger[_0x931a('0xb')](_0x931a('0xc'),_0x979440,_0x931a('0xd'));_0x5da7f5(_0x4979a1[_0x931a('0x12')][_0x931a('0x11')]);}})[_0x931a('0x13')](function(_0x30e9d4){logger[_0x931a('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x979440,_0x30e9d4);_0x250826(_0x30e9d4);});});} \ No newline at end of file +var _0x6e11=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0xce50ab,_0x4c503b){var _0x9432bb=function(_0x4827e7){while(--_0x4827e7){_0xce50ab['push'](_0xce50ab['shift']());}};_0x9432bb(++_0x4c503b);}(_0x6e11,0x11e));var _0x16e1=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x6e11[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0x16e1('0x0'));var util=require(_0x16e1('0x1'));var moment=require(_0x16e1('0x2'));var BPromise=require(_0x16e1('0x3'));var rs=require(_0x16e1('0x4'));var fs=require('fs');var Redis=require(_0x16e1('0x5'));var db=require(_0x16e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x16e1('0x7'))(_0x16e1('0x8'));var config=require('../../config/environment');var jayson=require(_0x16e1('0x9'));var client=jayson[_0x16e1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5913b7,_0x17a356,_0x4fb01f){return new BPromise(function(_0x3a9730,_0x54d51d){return client[_0x16e1('0xb')](_0x5913b7,_0x4fb01f)[_0x16e1('0xc')](function(_0x3e9371){logger[_0x16e1('0xd')](_0x16e1('0xe'),_0x17a356,_0x16e1('0xf'));logger[_0x16e1('0x10')](_0x16e1('0x11'),_0x17a356,_0x16e1('0xf'),JSON[_0x16e1('0x12')](_0x3e9371));if(_0x3e9371[_0x16e1('0x13')]){if(_0x3e9371[_0x16e1('0x13')][_0x16e1('0x14')]===0x1f4){logger[_0x16e1('0x13')](_0x16e1('0xe'),_0x17a356,_0x3e9371[_0x16e1('0x13')][_0x16e1('0x15')]);return _0x54d51d(_0x3e9371[_0x16e1('0x13')]['message']);}logger[_0x16e1('0x13')](_0x16e1('0xe'),_0x17a356,_0x3e9371[_0x16e1('0x13')][_0x16e1('0x15')]);return _0x3a9730(_0x3e9371[_0x16e1('0x13')][_0x16e1('0x15')]);}else{logger[_0x16e1('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17a356,_0x16e1('0xf'));_0x3a9730(_0x3e9371[_0x16e1('0x16')][_0x16e1('0x15')]);}})[_0x16e1('0x17')](function(_0xc63af7){logger[_0x16e1('0x13')](_0x16e1('0xe'),_0x17a356,_0xc63af7);_0x54d51d(_0xc63af7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 19ef9df..f87ee74 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 _0x778b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x50ee1b,_0x3f7b7f){var _0x5603f=function(_0x8708fd){while(--_0x8708fd){_0x50ee1b['push'](_0x50ee1b['shift']());}};_0x5603f(++_0x3f7b7f);}(_0x778b,0x152));var _0xb778=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x778b[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xb778('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb778('0x1'));var express=require(_0xb778('0x2'));var router=express[_0xb778('0x3')]();var fs_extra=require(_0xb778('0x4'));var auth=require(_0xb778('0x5'));var interaction=require(_0xb778('0x6'));var config=require(_0xb778('0x7'));var controller=require(_0xb778('0x8'));router['get']('/',auth[_0xb778('0x9')](),controller['index']);router['get'](_0xb778('0xa'),auth[_0xb778('0x9')](),controller[_0xb778('0xb')]);router['post']('/',auth[_0xb778('0x9')](),controller[_0xb778('0xc')]);router[_0xb778('0xd')](_0xb778('0xa'),auth['isAuthenticated'](),controller[_0xb778('0xe')]);router[_0xb778('0xf')](_0xb778('0xa'),auth[_0xb778('0x9')](),controller[_0xb778('0x10')]);module[_0xb778('0x11')]=router; \ No newline at end of file +var _0x5542=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x5641a8,_0x45d885){var _0x4b6997=function(_0x386cb8){while(--_0x386cb8){_0x5641a8['push'](_0x5641a8['shift']());}};_0x4b6997(++_0x45d885);}(_0x5542,0x170));var _0x2554=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x5542[_0x2181fc];return _0x315da1;};'use strict';var multer=require(_0x2554('0x0'));var util=require(_0x2554('0x1'));var path=require('path');var timeout=require(_0x2554('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2554('0x3'));var interaction=require(_0x2554('0x4'));var config=require('../../config/environment');var controller=require(_0x2554('0x5'));router[_0x2554('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2554('0x6')](_0x2554('0x7'),auth[_0x2554('0x8')](),controller[_0x2554('0x9')]);router['post']('/',auth[_0x2554('0x8')](),controller[_0x2554('0xa')]);router[_0x2554('0xb')]('/:id',auth[_0x2554('0x8')](),controller[_0x2554('0xc')]);router[_0x2554('0xd')]('/:id',auth[_0x2554('0x8')](),controller[_0x2554('0xe')]);module[_0x2554('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6faf97d..b1ac449 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 _0xb2e7=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x22ffc6,_0x3e1c88){var _0x394c61=function(_0x201bfd){while(--_0x201bfd){_0x22ffc6['push'](_0x22ffc6['shift']());}};_0x394c61(++_0x3e1c88);}(_0xb2e7,0xbd));var _0x7b2e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2e7[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x7b2e('0x0'));module[_0x7b2e('0x1')]={'type':{'type':Sequelize[_0x7b2e('0x2')](_0x7b2e('0x3'),_0x7b2e('0x4'),_0x7b2e('0x5'),_0x7b2e('0x6'),'picklist'),'defaultValue':_0x7b2e('0x3')},'content':{'type':Sequelize[_0x7b2e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7b2e('0x2')](_0x7b2e('0x3'),_0x7b2e('0x4'),_0x7b2e('0x5'))},'keyContent':{'type':Sequelize[_0x7b2e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7b2e('0x7')]},'customField':{'type':Sequelize[_0x7b2e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b2e('0x7')]}}; \ No newline at end of file +var _0xa09f=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','picklist'];(function(_0x565272,_0x411967){var _0x331a8f=function(_0x554301){while(--_0x554301){_0x565272['push'](_0x565272['shift']());}};_0x331a8f(++_0x411967);}(_0xa09f,0x183));var _0xfa09=function(_0x2944b2,_0x4eadb6){_0x2944b2=_0x2944b2-0x0;var _0x3ccbf7=_0xa09f[_0x2944b2];return _0x3ccbf7;};'use strict';var Sequelize=require(_0xfa09('0x0'));module['exports']={'type':{'type':Sequelize[_0xfa09('0x1')](_0xfa09('0x2'),_0xfa09('0x3'),'customVariable','keyValue',_0xfa09('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfa09('0x5')]},'key':{'type':Sequelize[_0xfa09('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xfa09('0x2'),'variable',_0xfa09('0x6'))},'keyContent':{'type':Sequelize[_0xfa09('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfa09('0x5')]},'customField':{'type':Sequelize[_0xfa09('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa09('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c89eb93..1be3da1 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 _0x9164=['undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x9164,0x10f));var _0x4916=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9164[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4916('0x0'));var rimraf=require(_0x4916('0x1'));var zipdir=require(_0x4916('0x2'));var jsonpatch=require(_0x4916('0x3'));var rp=require(_0x4916('0x4'));var moment=require(_0x4916('0x5'));var BPromise=require(_0x4916('0x6'));var Mustache=require('mustache');var util=require(_0x4916('0x7'));var path=require(_0x4916('0x8'));var sox=require(_0x4916('0x9'));var csv=require('to-csv');var ejs=require(_0x4916('0xa'));var fs=require('fs');var fs_extra=require(_0x4916('0xb'));var _=require(_0x4916('0xc'));var squel=require('squel');var crypto=require(_0x4916('0xd'));var jsforce=require(_0x4916('0xe'));var deskjs=require(_0x4916('0xf'));var toCsv=require(_0x4916('0x10'));var querystring=require('querystring');var Papa=require(_0x4916('0x11'));var Redis=require('ioredis');var authService=require(_0x4916('0x12'));var qs=require(_0x4916('0x13'));var as=require(_0x4916('0x14'));var hardwareService=require(_0x4916('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4916('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4916('0x17'))['db'];function respondWithStatusCode(_0x8eb920,_0x24dabd){_0x24dabd=_0x24dabd||0xcc;return function(_0x3b5c1b){if(_0x3b5c1b){return _0x8eb920[_0x4916('0x18')](_0x24dabd);}return _0x8eb920['status'](_0x24dabd)[_0x4916('0x19')]();};}function respondWithResult(_0x23d8d5,_0x112231){_0x112231=_0x112231||0xc8;return function(_0x101ee2){if(_0x101ee2){return _0x23d8d5[_0x4916('0x1a')](_0x112231)[_0x4916('0x1b')](_0x101ee2);}};}function respondWithFilteredResult(_0x83a256,_0x19b2e5){return function(_0x778aad){if(_0x778aad){var _0x1f63fb=typeof _0x19b2e5[_0x4916('0x1c')]===_0x4916('0x1d')&&typeof _0x19b2e5[_0x4916('0x1e')]==='undefined';var _0x8e52ff=_0x778aad[_0x4916('0x1f')];var _0x4d401d=_0x1f63fb?0x0:_0x19b2e5[_0x4916('0x1c')];var _0x18a93e=_0x1f63fb?_0x778aad[_0x4916('0x1f')]:_0x19b2e5[_0x4916('0x1c')]+_0x19b2e5[_0x4916('0x1e')];var _0x34b3fe;if(_0x18a93e>=_0x8e52ff){_0x18a93e=_0x8e52ff;_0x34b3fe=0xc8;}else{_0x34b3fe=0xce;}_0x83a256[_0x4916('0x1a')](_0x34b3fe);return _0x83a256[_0x4916('0x20')](_0x4916('0x21'),_0x4d401d+'-'+_0x18a93e+'/'+_0x8e52ff)[_0x4916('0x1b')](_0x778aad);}return null;};}function patchUpdates(_0x27bf12){return function(_0x38d3d3){try{jsonpatch['apply'](_0x38d3d3,_0x27bf12,!![]);}catch(_0x38f98c){return BPromise[_0x4916('0x22')](_0x38f98c);}return _0x38d3d3[_0x4916('0x23')]();};}function saveUpdates(_0x5522b7,_0x235f19){return function(_0x5b4c16){if(_0x5b4c16){return _0x5b4c16[_0x4916('0x24')](_0x5522b7)[_0x4916('0x25')](function(_0x16de9e){return _0x16de9e;});}return null;};}function removeEntity(_0x55371f,_0x136542){return function(_0x1360d5){if(_0x1360d5){return _0x1360d5[_0x4916('0x26')]()[_0x4916('0x25')](function(){_0x55371f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e951,_0x30baed){return function(_0x1d7e21){if(!_0x1d7e21){_0x35e951[_0x4916('0x18')](0x194);}return _0x1d7e21;};}function handleError(_0x45e91,_0x376d4d){_0x376d4d=_0x376d4d||0x1f4;return function(_0x99192f){logger[_0x4916('0x27')](_0x99192f[_0x4916('0x28')]);if(_0x99192f[_0x4916('0x29')]){delete _0x99192f['name'];}_0x45e91[_0x4916('0x1a')](_0x376d4d)[_0x4916('0x2a')](_0x99192f);};}exports['index']=function(_0xb073fa,_0xb0538f){var _0x47f7c6={},_0x5238ad={},_0x212ae3={'count':0x0,'rows':[]};var _0x38ab3e=_['map'](db[_0x4916('0x2b')][_0x4916('0x2c')],function(_0x476021){return{'name':_0x476021[_0x4916('0x2d')],'type':_0x476021[_0x4916('0x2e')][_0x4916('0x2f')]};});_0x5238ad[_0x4916('0x30')]=_[_0x4916('0x31')](_0x38ab3e,_0x4916('0x29'));_0x5238ad[_0x4916('0x32')]=_[_0x4916('0x33')](_0xb073fa['query']);_0x5238ad[_0x4916('0x34')]=_['intersection'](_0x5238ad[_0x4916('0x30')],_0x5238ad[_0x4916('0x32')]);_0x47f7c6[_0x4916('0x35')]=_[_0x4916('0x36')](_0x5238ad[_0x4916('0x30')],qs['fields'](_0xb073fa['query'][_0x4916('0x37')]));_0x47f7c6['attributes']=_0x47f7c6['attributes'][_0x4916('0x38')]?_0x47f7c6['attributes']:_0x5238ad['model'];if(!_0xb073fa[_0x4916('0x32')][_0x4916('0x39')](_0x4916('0x3a'))){_0x47f7c6['limit']=qs['limit'](_0xb073fa['query'][_0x4916('0x1e')]);_0x47f7c6['offset']=qs['offset'](_0xb073fa[_0x4916('0x32')][_0x4916('0x1c')]);}_0x47f7c6[_0x4916('0x3b')]=qs[_0x4916('0x3c')](_0xb073fa['query'][_0x4916('0x3c')]);_0x47f7c6[_0x4916('0x3d')]=qs[_0x4916('0x34')](_[_0x4916('0x3e')](_0xb073fa[_0x4916('0x32')],_0x5238ad[_0x4916('0x34')]),_0x38ab3e);if(_0xb073fa[_0x4916('0x32')][_0x4916('0x3f')]){_0x47f7c6[_0x4916('0x3d')]=_['merge'](_0x47f7c6[_0x4916('0x3d')],{'$or':_[_0x4916('0x31')](_0x38ab3e,function(_0x4b1c75){if(_0x4b1c75[_0x4916('0x2e')]!==_0x4916('0x40')){var _0x520c6e={};_0x520c6e[_0x4b1c75[_0x4916('0x29')]]={'$like':'%'+_0xb073fa[_0x4916('0x32')][_0x4916('0x3f')]+'%'};return _0x520c6e;}})});}_0x47f7c6=_[_0x4916('0x41')]({},_0x47f7c6,_0xb073fa['options']);var _0x61e6d8={'where':_0x47f7c6[_0x4916('0x3d')]};return db[_0x4916('0x2b')][_0x4916('0x1f')](_0x61e6d8)['then'](function(_0x1dd3d2){_0x212ae3['count']=_0x1dd3d2;if(_0xb073fa[_0x4916('0x32')][_0x4916('0x42')]){_0x47f7c6[_0x4916('0x43')]=[{'all':!![]}];}return db[_0x4916('0x2b')]['findAll'](_0x47f7c6);})[_0x4916('0x25')](function(_0xe479a7){_0x212ae3['rows']=_0xe479a7;return _0x212ae3;})[_0x4916('0x25')](respondWithFilteredResult(_0xb0538f,_0x47f7c6))[_0x4916('0x44')](handleError(_0xb0538f,null));};exports[_0x4916('0x45')]=function(_0x27c005,_0x1a6382){var _0x291fde={'raw':!![],'where':{'id':_0x27c005['params']['id']}},_0x288df4={};_0x288df4[_0x4916('0x30')]=_[_0x4916('0x33')](db['SugarcrmField'][_0x4916('0x2c')]);_0x288df4[_0x4916('0x32')]=_['keys'](_0x27c005['query']);_0x288df4['filters']=_[_0x4916('0x36')](_0x288df4[_0x4916('0x30')],_0x288df4[_0x4916('0x32')]);_0x291fde[_0x4916('0x35')]=_[_0x4916('0x36')](_0x288df4['model'],qs[_0x4916('0x37')](_0x27c005[_0x4916('0x32')][_0x4916('0x37')]));_0x291fde[_0x4916('0x35')]=_0x291fde['attributes'][_0x4916('0x38')]?_0x291fde[_0x4916('0x35')]:_0x288df4[_0x4916('0x30')];if(_0x27c005[_0x4916('0x32')][_0x4916('0x42')]){_0x291fde['include']=[{'all':!![]}];}_0x291fde=_['merge']({},_0x291fde,_0x27c005[_0x4916('0x46')]);return db[_0x4916('0x2b')]['find'](_0x291fde)[_0x4916('0x25')](handleEntityNotFound(_0x1a6382,null))['then'](respondWithResult(_0x1a6382,null))[_0x4916('0x44')](handleError(_0x1a6382,null));};exports[_0x4916('0x47')]=function(_0x45ec11,_0x2c0437){return db[_0x4916('0x2b')]['create'](_0x45ec11[_0x4916('0x48')],{})[_0x4916('0x25')](respondWithResult(_0x2c0437,0xc9))[_0x4916('0x44')](handleError(_0x2c0437,null));};exports[_0x4916('0x24')]=function(_0x4044b9,_0x3a6264){if(_0x4044b9[_0x4916('0x48')]['id']){delete _0x4044b9[_0x4916('0x48')]['id'];}return db[_0x4916('0x2b')][_0x4916('0x49')]({'where':{'id':_0x4044b9[_0x4916('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a6264,null))[_0x4916('0x25')](saveUpdates(_0x4044b9[_0x4916('0x48')],null))[_0x4916('0x25')](respondWithResult(_0x3a6264,null))['catch'](handleError(_0x3a6264,null));};exports[_0x4916('0x26')]=function(_0x263580,_0x4d51d8){return db[_0x4916('0x2b')][_0x4916('0x49')]({'where':{'id':_0x263580[_0x4916('0x4a')]['id']}})[_0x4916('0x25')](handleEntityNotFound(_0x4d51d8,null))[_0x4916('0x25')](removeEntity(_0x4d51d8,null))[_0x4916('0x44')](handleError(_0x4d51d8,null));}; \ No newline at end of file +var _0xb23b=['set','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmField','fieldName','type','model','query','filters','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','keys','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3bf96b,_0x241008){var _0x431ced=function(_0x2fa96e){while(--_0x2fa96e){_0x3bf96b['push'](_0x3bf96b['shift']());}};_0x431ced(++_0x241008);}(_0xb23b,0xbf));var _0xbb23=function(_0x28888c,_0x426db0){_0x28888c=_0x28888c-0x0;var _0x176462=_0xb23b[_0x28888c];return _0x176462;};'use strict';var emlformat=require(_0xbb23('0x0'));var rimraf=require(_0xbb23('0x1'));var zipdir=require(_0xbb23('0x2'));var jsonpatch=require(_0xbb23('0x3'));var rp=require(_0xbb23('0x4'));var moment=require(_0xbb23('0x5'));var BPromise=require(_0xbb23('0x6'));var Mustache=require(_0xbb23('0x7'));var util=require('util');var path=require(_0xbb23('0x8'));var sox=require('sox');var csv=require(_0xbb23('0x9'));var ejs=require(_0xbb23('0xa'));var fs=require('fs');var fs_extra=require(_0xbb23('0xb'));var _=require(_0xbb23('0xc'));var squel=require(_0xbb23('0xd'));var crypto=require(_0xbb23('0xe'));var jsforce=require(_0xbb23('0xf'));var deskjs=require(_0xbb23('0x10'));var toCsv=require(_0xbb23('0x9'));var querystring=require(_0xbb23('0x11'));var Papa=require('papaparse');var Redis=require(_0xbb23('0x12'));var authService=require(_0xbb23('0x13'));var qs=require(_0xbb23('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb23('0x15'))('api');var utils=require(_0xbb23('0x16'));var config=require(_0xbb23('0x17'));var licenseUtil=require(_0xbb23('0x18'));var db=require(_0xbb23('0x19'))['db'];function respondWithStatusCode(_0x228ea6,_0x2111e9){_0x2111e9=_0x2111e9||0xcc;return function(_0x4d13fe){if(_0x4d13fe){return _0x228ea6[_0xbb23('0x1a')](_0x2111e9);}return _0x228ea6[_0xbb23('0x1b')](_0x2111e9)[_0xbb23('0x1c')]();};}function respondWithResult(_0x42d79f,_0x10f747){_0x10f747=_0x10f747||0xc8;return function(_0x45e399){if(_0x45e399){return _0x42d79f['status'](_0x10f747)[_0xbb23('0x1d')](_0x45e399);}};}function respondWithFilteredResult(_0xfb4db6,_0x4def73){return function(_0x2ad936){if(_0x2ad936){var _0x4f845d=typeof _0x4def73[_0xbb23('0x1e')]==='undefined'&&typeof _0x4def73['limit']===_0xbb23('0x1f');var _0x48a558=_0x2ad936[_0xbb23('0x20')];var _0x3f7173=_0x4f845d?0x0:_0x4def73[_0xbb23('0x1e')];var _0xa441a1=_0x4f845d?_0x2ad936[_0xbb23('0x20')]:_0x4def73[_0xbb23('0x1e')]+_0x4def73[_0xbb23('0x21')];var _0x10561c;if(_0xa441a1>=_0x48a558){_0xa441a1=_0x48a558;_0x10561c=0xc8;}else{_0x10561c=0xce;}_0xfb4db6[_0xbb23('0x1b')](_0x10561c);return _0xfb4db6[_0xbb23('0x22')]('Content-Range',_0x3f7173+'-'+_0xa441a1+'/'+_0x48a558)['json'](_0x2ad936);}return null;};}function patchUpdates(_0x215a99){return function(_0xd8d214){try{jsonpatch[_0xbb23('0x23')](_0xd8d214,_0x215a99,!![]);}catch(_0x94c9cf){return BPromise[_0xbb23('0x24')](_0x94c9cf);}return _0xd8d214[_0xbb23('0x25')]();};}function saveUpdates(_0x25dbea,_0x5ede74){return function(_0x504488){if(_0x504488){return _0x504488[_0xbb23('0x26')](_0x25dbea)[_0xbb23('0x27')](function(_0x18bc3f){return _0x18bc3f;});}return null;};}function removeEntity(_0x40c5fd,_0x2bc1f2){return function(_0x38829c){if(_0x38829c){return _0x38829c[_0xbb23('0x28')]()['then'](function(){_0x40c5fd[_0xbb23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xada7b8,_0x465497){return function(_0x4778fe){if(!_0x4778fe){_0xada7b8[_0xbb23('0x1a')](0x194);}return _0x4778fe;};}function handleError(_0xb6bc33,_0x11de0a){_0x11de0a=_0x11de0a||0x1f4;return function(_0x238558){logger[_0xbb23('0x29')](_0x238558['stack']);if(_0x238558[_0xbb23('0x2a')]){delete _0x238558['name'];}_0xb6bc33[_0xbb23('0x1b')](_0x11de0a)[_0xbb23('0x2b')](_0x238558);};}exports[_0xbb23('0x2c')]=function(_0x39fa3f,_0x5edb70){var _0x82e836={},_0x1c29ec={},_0x26cee9={'count':0x0,'rows':[]};var _0x1c465e=_[_0xbb23('0x2d')](db[_0xbb23('0x2e')]['rawAttributes'],function(_0x2def81){return{'name':_0x2def81[_0xbb23('0x2f')],'type':_0x2def81[_0xbb23('0x30')]['key']};});_0x1c29ec[_0xbb23('0x31')]=_[_0xbb23('0x2d')](_0x1c465e,_0xbb23('0x2a'));_0x1c29ec[_0xbb23('0x32')]=_['keys'](_0x39fa3f['query']);_0x1c29ec[_0xbb23('0x33')]=_['intersection'](_0x1c29ec[_0xbb23('0x31')],_0x1c29ec['query']);_0x82e836[_0xbb23('0x34')]=_['intersection'](_0x1c29ec['model'],qs[_0xbb23('0x35')](_0x39fa3f[_0xbb23('0x32')][_0xbb23('0x35')]));_0x82e836[_0xbb23('0x34')]=_0x82e836[_0xbb23('0x34')]['length']?_0x82e836[_0xbb23('0x34')]:_0x1c29ec[_0xbb23('0x31')];if(!_0x39fa3f[_0xbb23('0x32')]['hasOwnProperty'](_0xbb23('0x36'))){_0x82e836[_0xbb23('0x21')]=qs['limit'](_0x39fa3f['query'][_0xbb23('0x21')]);_0x82e836['offset']=qs[_0xbb23('0x1e')](_0x39fa3f[_0xbb23('0x32')][_0xbb23('0x1e')]);}_0x82e836[_0xbb23('0x37')]=qs[_0xbb23('0x38')](_0x39fa3f[_0xbb23('0x32')][_0xbb23('0x38')]);_0x82e836['where']=qs[_0xbb23('0x33')](_['pick'](_0x39fa3f[_0xbb23('0x32')],_0x1c29ec[_0xbb23('0x33')]),_0x1c465e);if(_0x39fa3f['query']['filter']){_0x82e836[_0xbb23('0x39')]=_[_0xbb23('0x3a')](_0x82e836[_0xbb23('0x39')],{'$or':_['map'](_0x1c465e,function(_0x54581b){if(_0x54581b[_0xbb23('0x30')]!==_0xbb23('0x3b')){var _0x1ffa9f={};_0x1ffa9f[_0x54581b[_0xbb23('0x2a')]]={'$like':'%'+_0x39fa3f['query'][_0xbb23('0x3c')]+'%'};return _0x1ffa9f;}})});}_0x82e836=_[_0xbb23('0x3a')]({},_0x82e836,_0x39fa3f[_0xbb23('0x3d')]);var _0x3cc222={'where':_0x82e836[_0xbb23('0x39')]};return db[_0xbb23('0x2e')]['count'](_0x3cc222)[_0xbb23('0x27')](function(_0x22c310){_0x26cee9[_0xbb23('0x20')]=_0x22c310;if(_0x39fa3f['query']['includeAll']){_0x82e836[_0xbb23('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0xbb23('0x3f')](_0x82e836);})['then'](function(_0x190ac4){_0x26cee9[_0xbb23('0x40')]=_0x190ac4;return _0x26cee9;})['then'](respondWithFilteredResult(_0x5edb70,_0x82e836))[_0xbb23('0x41')](handleError(_0x5edb70,null));};exports[_0xbb23('0x42')]=function(_0xf32f5f,_0x50bd4f){var _0x5a4970={'raw':!![],'where':{'id':_0xf32f5f[_0xbb23('0x43')]['id']}},_0x45aac2={};_0x45aac2[_0xbb23('0x31')]=_['keys'](db['SugarcrmField'][_0xbb23('0x44')]);_0x45aac2[_0xbb23('0x32')]=_[_0xbb23('0x45')](_0xf32f5f[_0xbb23('0x32')]);_0x45aac2[_0xbb23('0x33')]=_[_0xbb23('0x46')](_0x45aac2['model'],_0x45aac2[_0xbb23('0x32')]);_0x5a4970[_0xbb23('0x34')]=_[_0xbb23('0x46')](_0x45aac2['model'],qs[_0xbb23('0x35')](_0xf32f5f[_0xbb23('0x32')][_0xbb23('0x35')]));_0x5a4970[_0xbb23('0x34')]=_0x5a4970[_0xbb23('0x34')]['length']?_0x5a4970[_0xbb23('0x34')]:_0x45aac2[_0xbb23('0x31')];if(_0xf32f5f[_0xbb23('0x32')][_0xbb23('0x47')]){_0x5a4970[_0xbb23('0x3e')]=[{'all':!![]}];}_0x5a4970=_[_0xbb23('0x3a')]({},_0x5a4970,_0xf32f5f[_0xbb23('0x3d')]);return db['SugarcrmField'][_0xbb23('0x48')](_0x5a4970)[_0xbb23('0x27')](handleEntityNotFound(_0x50bd4f,null))[_0xbb23('0x27')](respondWithResult(_0x50bd4f,null))[_0xbb23('0x41')](handleError(_0x50bd4f,null));};exports[_0xbb23('0x49')]=function(_0x38984a,_0x328d69){return db['SugarcrmField']['create'](_0x38984a[_0xbb23('0x4a')],{})[_0xbb23('0x27')](respondWithResult(_0x328d69,0xc9))['catch'](handleError(_0x328d69,null));};exports[_0xbb23('0x26')]=function(_0x371cde,_0x780a3e){if(_0x371cde[_0xbb23('0x4a')]['id']){delete _0x371cde[_0xbb23('0x4a')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x371cde[_0xbb23('0x43')]['id']}})[_0xbb23('0x27')](handleEntityNotFound(_0x780a3e,null))[_0xbb23('0x27')](saveUpdates(_0x371cde[_0xbb23('0x4a')],null))[_0xbb23('0x27')](respondWithResult(_0x780a3e,null))['catch'](handleError(_0x780a3e,null));};exports[_0xbb23('0x28')]=function(_0x57721d,_0x45f393){return db['SugarcrmField'][_0xbb23('0x48')]({'where':{'id':_0x57721d[_0xbb23('0x43')]['id']}})[_0xbb23('0x27')](handleEntityNotFound(_0x45f393,null))[_0xbb23('0x27')](removeEntity(_0x45f393,null))[_0xbb23('0x41')](handleError(_0x45f393,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 98f6d6d..9540851 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 _0x547a=['rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x349a6f,_0x295963){var _0x4a6b3d=function(_0x21b84c){while(--_0x21b84c){_0x349a6f['push'](_0x349a6f['shift']());}};_0x4a6b3d(++_0x295963);}(_0x547a,0x119));var _0xa547=function(_0x4b90f8,_0x3a3331){_0x4b90f8=_0x4b90f8-0x0;var _0x3723f3=_0x547a[_0x4b90f8];return _0x3723f3;};'use strict';var _=require(_0xa547('0x0'));var util=require(_0xa547('0x1'));var logger=require(_0xa547('0x2'))(_0xa547('0x3'));var moment=require(_0xa547('0x4'));var BPromise=require(_0xa547('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa547('0x6'));var rimraf=require(_0xa547('0x7'));var config=require(_0xa547('0x8'));var attributes=require(_0xa547('0x9'));module['exports']=function(_0x2005d5,_0x492f2e){return _0x2005d5[_0xa547('0xa')](_0xa547('0xb'),attributes,{'tableName':_0xa547('0xc'),'paranoid':![],'indexes':[{'name':_0xa547('0xd'),'fields':[_0xa547('0xe'),_0xa547('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d2e=['exports','define','SugarcrmField','int_sugarcrm_fields','idField','util','../../config/logger','moment','request-promise','path','../../config/environment','./intSugarcrmField.attributes'];(function(_0xa680db,_0x15bc2a){var _0x11733f=function(_0x15a596){while(--_0x15a596){_0xa680db['push'](_0xa680db['shift']());}};_0x11733f(++_0x15bc2a);}(_0x2d2e,0x7d));var _0xe2d2=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0x2d2e[_0x11b8ae];return _0x35a448;};'use strict';var _=require('lodash');var util=require(_0xe2d2('0x0'));var logger=require(_0xe2d2('0x1'))('api');var moment=require(_0xe2d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xe2d2('0x3'));var fs=require('fs');var path=require(_0xe2d2('0x4'));var rimraf=require('rimraf');var config=require(_0xe2d2('0x5'));var attributes=require(_0xe2d2('0x6'));module[_0xe2d2('0x7')]=function(_0x473f2d,_0x3cb5f8){return _0x473f2d[_0xe2d2('0x8')](_0xe2d2('0x9'),attributes,{'tableName':_0xe2d2('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xe2d2('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 1b17db4..f8a2b25 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 _0x12dd=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x389972,_0x3ef65c){var _0x1ae3e3=function(_0x2c2d0c){while(--_0x2c2d0c){_0x389972['push'](_0x389972['shift']());}};_0x1ae3e3(++_0x3ef65c);}(_0x12dd,0x16a));var _0xd12d=function(_0x381cd7,_0x5cd931){_0x381cd7=_0x381cd7-0x0;var _0x42fb4d=_0x12dd[_0x381cd7];return _0x42fb4d;};'use strict';var _=require(_0xd12d('0x0'));var util=require(_0xd12d('0x1'));var moment=require(_0xd12d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd12d('0x3'));var fs=require('fs');var Redis=require(_0xd12d('0x4'));var db=require(_0xd12d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd12d('0x6'))('rpc');var config=require(_0xd12d('0x7'));var jayson=require(_0xd12d('0x8'));var client=jayson['client'][_0xd12d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9127b,_0x5e4bb8,_0x3e45ca){return new BPromise(function(_0x172c35,_0x198410){return client[_0xd12d('0xa')](_0xc9127b,_0x3e45ca)[_0xd12d('0xb')](function(_0x35b892){logger['info'](_0xd12d('0xc'),_0x5e4bb8,_0xd12d('0xd'));logger[_0xd12d('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5e4bb8,_0xd12d('0xd'),JSON[_0xd12d('0xf')](_0x35b892));if(_0x35b892[_0xd12d('0x10')]){if(_0x35b892[_0xd12d('0x10')][_0xd12d('0x11')]===0x1f4){logger['error'](_0xd12d('0xc'),_0x5e4bb8,_0x35b892[_0xd12d('0x10')][_0xd12d('0x12')]);return _0x198410(_0x35b892[_0xd12d('0x10')]['message']);}logger['error'](_0xd12d('0xc'),_0x5e4bb8,_0x35b892[_0xd12d('0x10')]['message']);return _0x172c35(_0x35b892[_0xd12d('0x10')][_0xd12d('0x12')]);}else{logger[_0xd12d('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x5e4bb8,_0xd12d('0xd'));_0x172c35(_0x35b892[_0xd12d('0x14')]['message']);}})[_0xd12d('0x15')](function(_0x28310){logger[_0xd12d('0x10')](_0xd12d('0xc'),_0x5e4bb8,_0x28310);_0x198410(_0x28310);});});} \ No newline at end of file +var _0x68df=['randomstring','ioredis','../../mysqldb','../../config/utils','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird'];(function(_0x3ec7b1,_0x522a49){var _0x371498=function(_0x119506){while(--_0x119506){_0x3ec7b1['push'](_0x3ec7b1['shift']());}};_0x371498(++_0x522a49);}(_0x68df,0x167));var _0xf68d=function(_0x3227c2,_0x22390f){_0x3227c2=_0x3227c2-0x0;var _0x1dc977=_0x68df[_0x3227c2];return _0x1dc977;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf68d('0x0'));var BPromise=require(_0xf68d('0x1'));var rs=require(_0xf68d('0x2'));var fs=require('fs');var Redis=require(_0xf68d('0x3'));var db=require(_0xf68d('0x4'))['db'];var utils=require(_0xf68d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf68d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1eb4d8,_0x2471be,_0x590ed2){return new BPromise(function(_0x53dbcf,_0x5adb9a){return client[_0xf68d('0x7')](_0x1eb4d8,_0x590ed2)['then'](function(_0x24bb71){logger['info'](_0xf68d('0x8'),_0x2471be,_0xf68d('0x9'));logger[_0xf68d('0xa')](_0xf68d('0xb'),_0x2471be,_0xf68d('0x9'),JSON[_0xf68d('0xc')](_0x24bb71));if(_0x24bb71[_0xf68d('0xd')]){if(_0x24bb71[_0xf68d('0xd')][_0xf68d('0xe')]===0x1f4){logger[_0xf68d('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2471be,_0x24bb71[_0xf68d('0xd')][_0xf68d('0xf')]);return _0x5adb9a(_0x24bb71[_0xf68d('0xd')][_0xf68d('0xf')]);}logger[_0xf68d('0xd')](_0xf68d('0x8'),_0x2471be,_0x24bb71[_0xf68d('0xd')][_0xf68d('0xf')]);return _0x53dbcf(_0x24bb71[_0xf68d('0xd')]['message']);}else{logger[_0xf68d('0x10')](_0xf68d('0x8'),_0x2471be,'request\x20sent');_0x53dbcf(_0x24bb71[_0xf68d('0x11')][_0xf68d('0xf')]);}})[_0xf68d('0x12')](function(_0xeb05c6){logger[_0xf68d('0xd')](_0xf68d('0x8'),_0x2471be,_0xeb05c6);_0x5adb9a(_0xeb05c6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 698f69a..d41b133 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 _0xe81d=['/:id','show','/:id/fields','getFields','create','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xe81d,0xc4));var _0xde81=function(_0x1dbe89,_0x224628){_0x1dbe89=_0x1dbe89-0x0;var _0xaeb544=_0xe81d[_0x1dbe89];return _0xaeb544;};'use strict';var multer=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var path=require(_0xde81('0x2'));var timeout=require(_0xde81('0x3'));var express=require(_0xde81('0x4'));var router=express[_0xde81('0x5')]();var fs_extra=require(_0xde81('0x6'));var auth=require(_0xde81('0x7'));var interaction=require(_0xde81('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0xde81('0x9')]('/',auth[_0xde81('0xa')](),controller['index']);router[_0xde81('0x9')](_0xde81('0xb'),auth[_0xde81('0xa')](),controller[_0xde81('0xc')]);router[_0xde81('0x9')]('/:id/configurations',auth[_0xde81('0xa')](),controller['getConfigurations']);router[_0xde81('0x9')](_0xde81('0xd'),auth[_0xde81('0xa')](),controller[_0xde81('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xde81('0xf')]);router[_0xde81('0x10')](_0xde81('0x11'),auth[_0xde81('0xa')](),controller['addConfiguration']);router[_0xde81('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xde81('0x13')]);router[_0xde81('0x14')](_0xde81('0xb'),auth['isAuthenticated'](),controller[_0xde81('0x15')]);module[_0xde81('0x16')]=router; \ No newline at end of file +var _0x19ea=['destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','delete'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x19ea,0xfe));var _0xa19e=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x19ea[_0x12bcf7];return _0x2825a;};'use strict';var multer=require(_0xa19e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa19e('0x1'));var express=require('express');var router=express[_0xa19e('0x2')]();var fs_extra=require(_0xa19e('0x3'));var auth=require(_0xa19e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa19e('0x5'));router[_0xa19e('0x6')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0x8')]);router[_0xa19e('0x6')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xa')]);router[_0xa19e('0x6')](_0xa19e('0xb'),auth[_0xa19e('0x7')](),controller['getConfigurations']);router[_0xa19e('0x6')](_0xa19e('0xc'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xd')]);router['post']('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0xe')]);router[_0xa19e('0xf')]('/:id/configurations',auth[_0xa19e('0x7')](),controller[_0xa19e('0x10')]);router[_0xa19e('0x11')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller['update']);router[_0xa19e('0x12')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0x13')]);module[_0xa19e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2cbd521..68dd89f 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 _0x022f=['STRING','HelpDesk','sequelize','exports'];(function(_0x18810d,_0x857dc0){var _0x42f1c0=function(_0x24d153){while(--_0x24d153){_0x18810d['push'](_0x18810d['shift']());}};_0x42f1c0(++_0x857dc0);}(_0x022f,0x1a6));var _0xf022=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x022f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf022('0x0'));module[_0xf022('0x1')]={'name':{'type':Sequelize[_0xf022('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf022('0x2')]},'username':{'type':Sequelize[_0xf022('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf022('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf022('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf022('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc95b=['exports','STRING','HelpDesk'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc95b,0x1e6));var _0xbc95=function(_0x3ed3c6,_0x2df262){_0x3ed3c6=_0x3ed3c6-0x0;var _0xafbade=_0xc95b[_0x3ed3c6];return _0xafbade;};'use strict';var Sequelize=require('sequelize');module[_0xbc95('0x0')]={'name':{'type':Sequelize[_0xbc95('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbc95('0x1')]},'username':{'type':Sequelize[_0xbc95('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbc95('0x1')],'allowNull':![],'defaultValue':_0xbc95('0x2')},'remoteUri':{'type':Sequelize[_0xbc95('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1e1c961..787e803 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 _0x9ad0=['remove','includes','editable','false','result','label','picklist','picklistValues','value','vTiger\x20error:\x20','test','stringify','send','statusCode','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','end','error','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','intersection','fields','length','attributes','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','findAll','show','params','keys','include','options','find','create','body','catch','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','autogenerated'];(function(_0x4d1101,_0x415b12){var _0x4fe135=function(_0x2266c1){while(--_0x2266c1){_0x4d1101['push'](_0x4d1101['shift']());}};_0x4fe135(++_0x415b12);}(_0x9ad0,0xf0));var _0x09ad=function(_0x1e1a42,_0x2b3c46){_0x1e1a42=_0x1e1a42-0x0;var _0x43d5de=_0x9ad0[_0x1e1a42];return _0x43d5de;};'use strict';var emlformat=require(_0x09ad('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09ad('0x1'));var rp=require(_0x09ad('0x2'));var moment=require('moment');var BPromise=require(_0x09ad('0x3'));var Mustache=require('mustache');var util=require(_0x09ad('0x4'));var path=require('path');var sox=require(_0x09ad('0x5'));var csv=require(_0x09ad('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09ad('0x7'));var squel=require(_0x09ad('0x8'));var crypto=require('crypto');var jsforce=require(_0x09ad('0x9'));var deskjs=require(_0x09ad('0xa'));var toCsv=require('to-csv');var querystring=require(_0x09ad('0xb'));var Papa=require(_0x09ad('0xc'));var Redis=require(_0x09ad('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ad('0xe'));var logger=require(_0x09ad('0xf'))(_0x09ad('0x10'));var utils=require(_0x09ad('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x09ad('0x12'));var db=require(_0x09ad('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59cf0f,_0xdc9be8){_0xdc9be8=_0xdc9be8||0xcc;return function(_0x41b011){if(_0x41b011){return _0x59cf0f[_0x09ad('0x14')](_0xdc9be8);}return _0x59cf0f[_0x09ad('0x15')](_0xdc9be8)['end']();};}function respondWithResult(_0x50049d,_0x3da0e0){_0x3da0e0=_0x3da0e0||0xc8;return function(_0x57c7fd){if(_0x57c7fd){return _0x50049d['status'](_0x3da0e0)[_0x09ad('0x16')](_0x57c7fd);}};}function respondWithFilteredResult(_0x1a6234,_0x1a0121){return function(_0x397da9){if(_0x397da9){var _0x5a8ac3=typeof _0x1a0121[_0x09ad('0x17')]==='undefined'&&typeof _0x1a0121['limit']===_0x09ad('0x18');var _0xb8b2c5=_0x397da9[_0x09ad('0x19')];var _0x42e0a2=_0x5a8ac3?0x0:_0x1a0121['offset'];var _0x288f75=_0x5a8ac3?_0x397da9['count']:_0x1a0121[_0x09ad('0x17')]+_0x1a0121[_0x09ad('0x1a')];var _0x24707f;if(_0x288f75>=_0xb8b2c5){_0x288f75=_0xb8b2c5;_0x24707f=0xc8;}else{_0x24707f=0xce;}_0x1a6234[_0x09ad('0x15')](_0x24707f);return _0x1a6234['set'](_0x09ad('0x1b'),_0x42e0a2+'-'+_0x288f75+'/'+_0xb8b2c5)['json'](_0x397da9);}return null;};}function patchUpdates(_0xd7bc8d){return function(_0x3d6dbb){try{jsonpatch['apply'](_0x3d6dbb,_0xd7bc8d,!![]);}catch(_0x18f24c){return BPromise['reject'](_0x18f24c);}return _0x3d6dbb['save']();};}function saveUpdates(_0x25f3d6,_0x3ca44f){return function(_0x38161f){if(_0x38161f){return _0x38161f[_0x09ad('0x1c')](_0x25f3d6)[_0x09ad('0x1d')](function(_0x2554d1){return _0x2554d1;});}return null;};}function removeEntity(_0x207853,_0x383068){return function(_0x44b2cd){if(_0x44b2cd){return _0x44b2cd[_0x09ad('0x1e')]()[_0x09ad('0x1d')](function(){_0x207853[_0x09ad('0x15')](0xcc)[_0x09ad('0x1f')]();});}};}function handleEntityNotFound(_0x2898d2,_0x53f316){return function(_0x550ae0){if(!_0x550ae0){_0x2898d2['sendStatus'](0x194);}return _0x550ae0;};}function handleError(_0x431b7d,_0xd2b6a4){_0xd2b6a4=_0xd2b6a4||0x1f4;return function(_0x27b6fd){logger[_0x09ad('0x20')](_0x27b6fd['stack']);if(_0x27b6fd[_0x09ad('0x21')]){delete _0x27b6fd[_0x09ad('0x21')];}_0x431b7d[_0x09ad('0x15')](_0xd2b6a4)['send'](_0x27b6fd);};}exports[_0x09ad('0x22')]=function(_0x112373,_0x545cf8){var _0x1a8ee8={},_0x29c885={},_0x355ec7={'count':0x0,'rows':[]};var _0x529487=_[_0x09ad('0x23')](db[_0x09ad('0x24')][_0x09ad('0x25')],function(_0x211def){return{'name':_0x211def[_0x09ad('0x26')],'type':_0x211def['type'][_0x09ad('0x27')]};});_0x29c885[_0x09ad('0x28')]=_[_0x09ad('0x23')](_0x529487,_0x09ad('0x21'));_0x29c885[_0x09ad('0x29')]=_['keys'](_0x112373['query']);_0x29c885['filters']=_[_0x09ad('0x2a')](_0x29c885[_0x09ad('0x28')],_0x29c885[_0x09ad('0x29')]);_0x1a8ee8['attributes']=_['intersection'](_0x29c885['model'],qs[_0x09ad('0x2b')](_0x112373[_0x09ad('0x29')][_0x09ad('0x2b')]));_0x1a8ee8['attributes']=_0x1a8ee8['attributes'][_0x09ad('0x2c')]?_0x1a8ee8[_0x09ad('0x2d')]:_0x29c885[_0x09ad('0x28')];if(!_0x112373[_0x09ad('0x29')]['hasOwnProperty'](_0x09ad('0x2e'))){_0x1a8ee8[_0x09ad('0x1a')]=qs[_0x09ad('0x1a')](_0x112373[_0x09ad('0x29')][_0x09ad('0x1a')]);_0x1a8ee8['offset']=qs[_0x09ad('0x17')](_0x112373['query'][_0x09ad('0x17')]);}_0x1a8ee8['order']=qs[_0x09ad('0x2f')](_0x112373[_0x09ad('0x29')][_0x09ad('0x2f')]);_0x1a8ee8[_0x09ad('0x30')]=qs[_0x09ad('0x31')](_[_0x09ad('0x32')](_0x112373['query'],_0x29c885[_0x09ad('0x31')]),_0x529487);if(_0x112373[_0x09ad('0x29')]['filter']){_0x1a8ee8[_0x09ad('0x30')]=_[_0x09ad('0x33')](_0x1a8ee8[_0x09ad('0x30')],{'$or':_[_0x09ad('0x23')](_0x529487,function(_0x27f983){if(_0x27f983[_0x09ad('0x34')]!==_0x09ad('0x35')){var _0x472cee={};_0x472cee[_0x27f983[_0x09ad('0x21')]]={'$like':'%'+_0x112373['query'][_0x09ad('0x36')]+'%'};return _0x472cee;}})});}_0x1a8ee8=_['merge']({},_0x1a8ee8,_0x112373['options']);var _0x443ded={'where':_0x1a8ee8[_0x09ad('0x30')]};return db[_0x09ad('0x24')][_0x09ad('0x19')](_0x443ded)[_0x09ad('0x1d')](function(_0x222583){_0x355ec7['count']=_0x222583;if(_0x112373['query'][_0x09ad('0x37')]){_0x1a8ee8['include']=[{'all':!![]}];}return db[_0x09ad('0x24')][_0x09ad('0x38')](_0x1a8ee8);})[_0x09ad('0x1d')](function(_0x4ee80f){_0x355ec7['rows']=_0x4ee80f;return _0x355ec7;})[_0x09ad('0x1d')](respondWithFilteredResult(_0x545cf8,_0x1a8ee8))['catch'](handleError(_0x545cf8,null));};exports[_0x09ad('0x39')]=function(_0x96f0e8,_0x2c6cb7){var _0x2558cb={'raw':![],'where':{'id':_0x96f0e8[_0x09ad('0x3a')]['id']}},_0x28ec4f={};_0x28ec4f['model']=_[_0x09ad('0x3b')](db['VtigerAccount'][_0x09ad('0x25')]);_0x28ec4f['query']=_['keys'](_0x96f0e8['query']);_0x28ec4f[_0x09ad('0x31')]=_[_0x09ad('0x2a')](_0x28ec4f[_0x09ad('0x28')],_0x28ec4f[_0x09ad('0x29')]);_0x2558cb['attributes']=_[_0x09ad('0x2a')](_0x28ec4f[_0x09ad('0x28')],qs['fields'](_0x96f0e8[_0x09ad('0x29')][_0x09ad('0x2b')]));_0x2558cb[_0x09ad('0x2d')]=_0x2558cb[_0x09ad('0x2d')][_0x09ad('0x2c')]?_0x2558cb[_0x09ad('0x2d')]:_0x28ec4f['model'];if(_0x96f0e8[_0x09ad('0x29')][_0x09ad('0x37')]){_0x2558cb[_0x09ad('0x3c')]=[{'all':!![]}];}_0x2558cb=_[_0x09ad('0x33')]({},_0x2558cb,_0x96f0e8[_0x09ad('0x3d')]);return db[_0x09ad('0x24')][_0x09ad('0x3e')](_0x2558cb)[_0x09ad('0x1d')](handleEntityNotFound(_0x2c6cb7,null))[_0x09ad('0x1d')](respondWithResult(_0x2c6cb7,null))['catch'](handleError(_0x2c6cb7,null));};exports[_0x09ad('0x3f')]=function(_0x586076,_0x6c7ea5){return db[_0x09ad('0x24')][_0x09ad('0x3f')](_0x586076[_0x09ad('0x40')],{})[_0x09ad('0x1d')](respondWithResult(_0x6c7ea5,0xc9))[_0x09ad('0x41')](handleError(_0x6c7ea5,null));};exports['update']=function(_0x219d16,_0x55d0c2){if(_0x219d16['body']['id']){delete _0x219d16[_0x09ad('0x40')]['id'];}return db['VtigerAccount'][_0x09ad('0x3e')]({'where':{'id':_0x219d16[_0x09ad('0x3a')]['id']}})[_0x09ad('0x1d')](handleEntityNotFound(_0x55d0c2,null))[_0x09ad('0x1d')](saveUpdates(_0x219d16[_0x09ad('0x40')],null))[_0x09ad('0x1d')](respondWithResult(_0x55d0c2,null))['catch'](handleError(_0x55d0c2,null));};exports[_0x09ad('0x1e')]=function(_0x299428,_0x5444dd){return db[_0x09ad('0x24')][_0x09ad('0x3e')]({'where':{'id':_0x299428[_0x09ad('0x3a')]['id']}})[_0x09ad('0x1d')](handleEntityNotFound(_0x5444dd,null))[_0x09ad('0x1d')](removeEntity(_0x5444dd,null))[_0x09ad('0x41')](handleError(_0x5444dd,null));};exports[_0x09ad('0x42')]=function(_0x464b9b,_0x404a3f,_0x212c15){var _0x14f297={};var _0x425a5c={};var _0x4465b1;var _0x2bb807;return db[_0x09ad('0x24')][_0x09ad('0x43')]({'where':{'id':_0x464b9b['params']['id']}})[_0x09ad('0x1d')](handleEntityNotFound(_0x404a3f,null))[_0x09ad('0x1d')](function(_0x1d496d){if(_0x1d496d){_0x4465b1=_0x1d496d;_0x425a5c[_0x09ad('0x28')]=_[_0x09ad('0x3b')](db['VtigerConfiguration'][_0x09ad('0x25')]);_0x425a5c[_0x09ad('0x29')]=_[_0x09ad('0x3b')](_0x464b9b[_0x09ad('0x29')]);_0x425a5c[_0x09ad('0x31')]=_[_0x09ad('0x2a')](_0x425a5c[_0x09ad('0x28')],_0x425a5c[_0x09ad('0x29')]);_0x14f297[_0x09ad('0x2d')]=_[_0x09ad('0x2a')](_0x425a5c[_0x09ad('0x28')],qs['fields'](_0x464b9b['query']['fields']));_0x14f297['attributes']=_0x14f297[_0x09ad('0x2d')][_0x09ad('0x2c')]?_0x14f297[_0x09ad('0x2d')]:_0x425a5c['model'];_0x14f297[_0x09ad('0x44')]=qs[_0x09ad('0x2f')](_0x464b9b[_0x09ad('0x29')]['sort']);_0x14f297[_0x09ad('0x30')]=qs[_0x09ad('0x31')](_[_0x09ad('0x32')](_0x464b9b['query'],_0x425a5c[_0x09ad('0x31')]));if(_0x464b9b[_0x09ad('0x29')][_0x09ad('0x36')]){_0x14f297[_0x09ad('0x30')]=_[_0x09ad('0x33')](_0x14f297[_0x09ad('0x30')],{'$or':_[_0x09ad('0x23')](_0x14f297[_0x09ad('0x2d')],function(_0x27f7c2){var _0x21f0de={};_0x21f0de[_0x27f7c2]={'$like':'%'+_0x464b9b[_0x09ad('0x29')]['filter']+'%'};return _0x21f0de;})});}_0x14f297=_['merge']({},_0x14f297,_0x464b9b[_0x09ad('0x3d')]);return _0x4465b1[_0x09ad('0x42')](_0x14f297);}})[_0x09ad('0x1d')](function(_0x16f40a){if(_0x16f40a){_0x2bb807=_0x16f40a[_0x09ad('0x2c')];if(!_0x464b9b[_0x09ad('0x29')][_0x09ad('0x45')](_0x09ad('0x2e'))){_0x14f297['limit']=qs[_0x09ad('0x1a')](_0x464b9b['query'][_0x09ad('0x1a')]);_0x14f297[_0x09ad('0x17')]=qs['offset'](_0x464b9b['query'][_0x09ad('0x17')]);}return _0x4465b1['getConfigurations'](_0x14f297);}})[_0x09ad('0x1d')](function(_0x2fe6bb){if(_0x2fe6bb){return _0x2fe6bb?{'count':_0x2bb807,'rows':_0x2fe6bb}:null;}})[_0x09ad('0x1d')](respondWithResult(_0x404a3f,null))[_0x09ad('0x41')](handleError(_0x404a3f,null));};exports[_0x09ad('0x46')]=function(_0x5b1817,_0x366d2f,_0x3b8282){if(_0x5b1817['body']['id']){delete _0x5b1817[_0x09ad('0x40')]['id'];}return db[_0x09ad('0x24')][_0x09ad('0x43')]({'where':{'id':_0x5b1817[_0x09ad('0x3a')]['id']}})[_0x09ad('0x1d')](handleEntityNotFound(_0x366d2f,null))[_0x09ad('0x1d')](function(_0x567e76){if(_0x567e76){_0x5b1817[_0x09ad('0x40')]['AccountId']=_0x567e76['id'];_0x5b1817[_0x09ad('0x40')][_0x09ad('0x47')]=integrations[_0x09ad('0x48')](_0x5b1817[_0x09ad('0x40')][_0x09ad('0x49')],_0x5b1817[_0x09ad('0x40')]['type']);_0x5b1817[_0x09ad('0x40')][_0x09ad('0x4a')]=integrations[_0x09ad('0x4b')](_0x5b1817[_0x09ad('0x40')][_0x09ad('0x49')],_0x5b1817[_0x09ad('0x40')][_0x09ad('0x34')]);return db[_0x09ad('0x4c')][_0x09ad('0x3f')](_0x5b1817[_0x09ad('0x40')],{'include':[{'model':db[_0x09ad('0x4d')],'as':_0x09ad('0x47')},{'model':db[_0x09ad('0x4d')],'as':_0x09ad('0x4a')}]});}return null;})['then'](respondWithResult(_0x366d2f,null))['catch'](handleError(_0x366d2f,null));};var md5=require(_0x09ad('0x4e'));exports[_0x09ad('0x4f')]=function(_0x4f057b,_0x225b6d,_0x2ccec4){var _0x278cdc=null;var _0x48c7f9=null;var _0x375f9f=null;var _0x31c683=null;var _0x1aba16='';return db[_0x09ad('0x24')][_0x09ad('0x43')]({'where':{'id':_0x4f057b[_0x09ad('0x3a')]['id']},'attributes':['id',_0x09ad('0x21'),'username','description',_0x09ad('0x50'),_0x09ad('0x51'),_0x09ad('0x52'),_0x09ad('0x53')]})[_0x09ad('0x1d')](handleEntityNotFound(_0x225b6d,null))[_0x09ad('0x1d')](function(_0x21088a){if(_0x21088a){_0x278cdc=_0x21088a[_0x09ad('0x54')];_0x48c7f9=_0x21088a[_0x09ad('0x53')];_0x375f9f=_0x21088a[_0x09ad('0x50')];_0x1aba16=_0x21088a[_0x09ad('0x51')];var _0xed273a=_0x1aba16[_0x09ad('0x55')](-0x1);if(_0xed273a==='/'){_0x1aba16=_0x1aba16[_0x09ad('0x56')](0x0,_0x1aba16[_0x09ad('0x57')](_0xed273a));}_0x31c683=util[_0x09ad('0x58')](_0x09ad('0x59'),_0x1aba16);var _0x331b36={'method':'GET','uri':_0x31c683,'qs':{'operation':_0x09ad('0x5a'),'username':_0x21088a[_0x09ad('0x54')]},'json':!![]};return rp(_0x331b36);}})['then'](function(_0x41bc28){if(_0x41bc28[_0x09ad('0x5b')]){var _0x107b07={'method':_0x09ad('0x5c'),'uri':_0x31c683,'form':{'operation':_0x09ad('0x5d'),'username':_0x278cdc,'accessKey':md5(_0x41bc28['result'][_0x09ad('0x5e')]+_0x48c7f9)},'json':!![]};return rp(_0x107b07);}})['then'](function(_0x450fc6){if(_0x450fc6[_0x09ad('0x5b')]){var _0x1b3697={'method':_0x09ad('0x5f'),'uri':_0x31c683,'qs':{'operation':_0x09ad('0x60'),'username':_0x278cdc,'sessionName':_0x450fc6['result'][_0x09ad('0x61')],'elementType':_0x375f9f},'json':!![]};return rp(_0x1b3697);}})[_0x09ad('0x1d')](function(_0x4d6445){if(_0x4d6445['success']){var _0x4f9838=[_0x09ad('0x62'),'reference','owner'];_[_0x09ad('0x63')](_0x4d6445['result'][_0x09ad('0x2b')],function(_0x295d4d){return _0x4f9838[_0x09ad('0x64')](_0x295d4d[_0x09ad('0x34')][_0x09ad('0x21')]);});_[_0x09ad('0x63')](_0x4d6445['result'][_0x09ad('0x2b')],function(_0x22e3ee){return _0x22e3ee[_0x09ad('0x65')]===_0x09ad('0x66');});return{'count':_0x4d6445[_0x09ad('0x67')][_0x09ad('0x2b')]['length'],'rows':_[_0x09ad('0x23')](_0x4d6445[_0x09ad('0x67')]['fields'],function(_0x25518c){return{'id':_0x25518c[_0x09ad('0x21')],'name':_0x25518c[_0x09ad('0x68')],'custom':_['startsWith'](_0x25518c['name'],'cf_')?!![]:![],'options':_0x25518c['type'][_0x09ad('0x21')]===_0x09ad('0x69')&&_0x25518c['type'][_0x09ad('0x6a')][_0x09ad('0x2c')]>0x0?_[_0x09ad('0x23')](_0x25518c[_0x09ad('0x34')][_0x09ad('0x6a')],function(_0x179e13){return{'name':_0x179e13['label'],'value':_0x179e13[_0x09ad('0x6b')]};}):[]};})};}})['then'](respondWithResult(_0x225b6d,null))[_0x09ad('0x41')](function(_0x37c773){console['log'](_0x09ad('0x6c')+_0x37c773);var _0x5a2b84=_0x4f057b['query'][_0x09ad('0x6d')]?0x1f4:_0x37c773['statusCode']||0x1f4;logger[_0x09ad('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x09ad('0x4f'),_0x5a2b84,JSON[_0x09ad('0x6e')](_0x37c773));delete _0x37c773[_0x09ad('0x21')];if(_0x5a2b84===0x191){_0x5a2b84=0x190;}_0x225b6d[_0x09ad('0x15')](_0x5a2b84)[_0x09ad('0x6f')](_0x4f057b[_0x09ad('0x29')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x37c773[_0x09ad('0x70')]}:_0x37c773);});}; \ No newline at end of file +var _0x88f5=['create','body','destroy','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','VtigerField','getFields','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','format','%s/webservice.php','GET','success','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','picklistValues','log','vTiger\x20error:\x20','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','VtigerAccount','includeAll','include','rows','catch','show','params','find'];(function(_0x5e204c,_0x4f21c5){var _0x3f8601=function(_0x2a6032){while(--_0x2a6032){_0x5e204c['push'](_0x5e204c['shift']());}};_0x3f8601(++_0x4f21c5);}(_0x88f5,0xa8));var _0x588f=function(_0x457d86,_0xf6ff81){_0x457d86=_0x457d86-0x0;var _0x3a8b14=_0x88f5[_0x457d86];return _0x3a8b14;};'use strict';var emlformat=require(_0x588f('0x0'));var rimraf=require(_0x588f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x588f('0x2'));var rp=require(_0x588f('0x3'));var moment=require(_0x588f('0x4'));var BPromise=require(_0x588f('0x5'));var Mustache=require(_0x588f('0x6'));var util=require(_0x588f('0x7'));var path=require(_0x588f('0x8'));var sox=require(_0x588f('0x9'));var csv=require(_0x588f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x588f('0xb'));var _=require(_0x588f('0xc'));var squel=require(_0x588f('0xd'));var crypto=require(_0x588f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x588f('0xa'));var querystring=require(_0x588f('0xf'));var Papa=require('papaparse');var Redis=require(_0x588f('0x10'));var authService=require(_0x588f('0x11'));var qs=require(_0x588f('0x12'));var as=require(_0x588f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x588f('0x14'));var utils=require(_0x588f('0x15'));var config=require(_0x588f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x588f('0x17'))['db'];var integrations=require(_0x588f('0x18'));function respondWithStatusCode(_0x21147e,_0x235525){_0x235525=_0x235525||0xcc;return function(_0x7012be){if(_0x7012be){return _0x21147e['sendStatus'](_0x235525);}return _0x21147e['status'](_0x235525)[_0x588f('0x19')]();};}function respondWithResult(_0x2f8f3b,_0x11bd83){_0x11bd83=_0x11bd83||0xc8;return function(_0x1baec3){if(_0x1baec3){return _0x2f8f3b[_0x588f('0x1a')](_0x11bd83)[_0x588f('0x1b')](_0x1baec3);}};}function respondWithFilteredResult(_0x312ce2,_0x1db6e5){return function(_0x4c64dd){if(_0x4c64dd){var _0x12dc11=typeof _0x1db6e5[_0x588f('0x1c')]==='undefined'&&typeof _0x1db6e5[_0x588f('0x1d')]===_0x588f('0x1e');var _0x51ffe1=_0x4c64dd[_0x588f('0x1f')];var _0x4dd1c9=_0x12dc11?0x0:_0x1db6e5[_0x588f('0x1c')];var _0x37ee72=_0x12dc11?_0x4c64dd['count']:_0x1db6e5[_0x588f('0x1c')]+_0x1db6e5['limit'];var _0x12bd6b;if(_0x37ee72>=_0x51ffe1){_0x37ee72=_0x51ffe1;_0x12bd6b=0xc8;}else{_0x12bd6b=0xce;}_0x312ce2['status'](_0x12bd6b);return _0x312ce2[_0x588f('0x20')](_0x588f('0x21'),_0x4dd1c9+'-'+_0x37ee72+'/'+_0x51ffe1)[_0x588f('0x1b')](_0x4c64dd);}return null;};}function patchUpdates(_0x9d817f){return function(_0x1b4819){try{jsonpatch[_0x588f('0x22')](_0x1b4819,_0x9d817f,!![]);}catch(_0x3c161c){return BPromise[_0x588f('0x23')](_0x3c161c);}return _0x1b4819[_0x588f('0x24')]();};}function saveUpdates(_0x3adb93,_0x4b9c92){return function(_0x300977){if(_0x300977){return _0x300977[_0x588f('0x25')](_0x3adb93)[_0x588f('0x26')](function(_0x2e7214){return _0x2e7214;});}return null;};}function removeEntity(_0x4aec91,_0x302e7c){return function(_0x2b3062){if(_0x2b3062){return _0x2b3062['destroy']()[_0x588f('0x26')](function(){_0x4aec91[_0x588f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c67ad,_0x1c387a){return function(_0x131e62){if(!_0x131e62){_0x1c67ad[_0x588f('0x27')](0x194);}return _0x131e62;};}function handleError(_0x1f054c,_0x412c76){_0x412c76=_0x412c76||0x1f4;return function(_0x2f7eb1){logger[_0x588f('0x28')](_0x2f7eb1['stack']);if(_0x2f7eb1[_0x588f('0x29')]){delete _0x2f7eb1[_0x588f('0x29')];}_0x1f054c['status'](_0x412c76)['send'](_0x2f7eb1);};}exports[_0x588f('0x2a')]=function(_0xc30a7e,_0x508234){var _0x282be5={},_0x1b3fe1={},_0x3db196={'count':0x0,'rows':[]};var _0x4bb64a=_[_0x588f('0x2b')](db['VtigerAccount'][_0x588f('0x2c')],function(_0x1bdc21){return{'name':_0x1bdc21[_0x588f('0x2d')],'type':_0x1bdc21[_0x588f('0x2e')][_0x588f('0x2f')]};});_0x1b3fe1[_0x588f('0x30')]=_[_0x588f('0x2b')](_0x4bb64a,'name');_0x1b3fe1[_0x588f('0x31')]=_[_0x588f('0x32')](_0xc30a7e[_0x588f('0x31')]);_0x1b3fe1['filters']=_['intersection'](_0x1b3fe1[_0x588f('0x30')],_0x1b3fe1[_0x588f('0x31')]);_0x282be5[_0x588f('0x33')]=_[_0x588f('0x34')](_0x1b3fe1[_0x588f('0x30')],qs[_0x588f('0x35')](_0xc30a7e[_0x588f('0x31')][_0x588f('0x35')]));_0x282be5[_0x588f('0x33')]=_0x282be5[_0x588f('0x33')][_0x588f('0x36')]?_0x282be5[_0x588f('0x33')]:_0x1b3fe1[_0x588f('0x30')];if(!_0xc30a7e[_0x588f('0x31')][_0x588f('0x37')](_0x588f('0x38'))){_0x282be5['limit']=qs[_0x588f('0x1d')](_0xc30a7e[_0x588f('0x31')]['limit']);_0x282be5[_0x588f('0x1c')]=qs[_0x588f('0x1c')](_0xc30a7e[_0x588f('0x31')][_0x588f('0x1c')]);}_0x282be5[_0x588f('0x39')]=qs[_0x588f('0x3a')](_0xc30a7e['query']['sort']);_0x282be5[_0x588f('0x3b')]=qs['filters'](_[_0x588f('0x3c')](_0xc30a7e[_0x588f('0x31')],_0x1b3fe1[_0x588f('0x3d')]),_0x4bb64a);if(_0xc30a7e[_0x588f('0x31')][_0x588f('0x3e')]){_0x282be5[_0x588f('0x3b')]=_[_0x588f('0x3f')](_0x282be5[_0x588f('0x3b')],{'$or':_['map'](_0x4bb64a,function(_0x33831c){if(_0x33831c[_0x588f('0x2e')]!==_0x588f('0x40')){var _0x17983d={};_0x17983d[_0x33831c[_0x588f('0x29')]]={'$like':'%'+_0xc30a7e[_0x588f('0x31')][_0x588f('0x3e')]+'%'};return _0x17983d;}})});}_0x282be5=_['merge']({},_0x282be5,_0xc30a7e[_0x588f('0x41')]);var _0x5a7525={'where':_0x282be5['where']};return db[_0x588f('0x42')][_0x588f('0x1f')](_0x5a7525)['then'](function(_0x5688a1){_0x3db196[_0x588f('0x1f')]=_0x5688a1;if(_0xc30a7e[_0x588f('0x31')][_0x588f('0x43')]){_0x282be5[_0x588f('0x44')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x282be5);})['then'](function(_0x4d7745){_0x3db196[_0x588f('0x45')]=_0x4d7745;return _0x3db196;})['then'](respondWithFilteredResult(_0x508234,_0x282be5))[_0x588f('0x46')](handleError(_0x508234,null));};exports[_0x588f('0x47')]=function(_0xb4dc69,_0x15d7fa){var _0x1de16f={'raw':![],'where':{'id':_0xb4dc69[_0x588f('0x48')]['id']}},_0x3af697={};_0x3af697[_0x588f('0x30')]=_['keys'](db[_0x588f('0x42')]['rawAttributes']);_0x3af697[_0x588f('0x31')]=_[_0x588f('0x32')](_0xb4dc69[_0x588f('0x31')]);_0x3af697[_0x588f('0x3d')]=_[_0x588f('0x34')](_0x3af697['model'],_0x3af697[_0x588f('0x31')]);_0x1de16f[_0x588f('0x33')]=_['intersection'](_0x3af697[_0x588f('0x30')],qs[_0x588f('0x35')](_0xb4dc69[_0x588f('0x31')][_0x588f('0x35')]));_0x1de16f[_0x588f('0x33')]=_0x1de16f[_0x588f('0x33')][_0x588f('0x36')]?_0x1de16f[_0x588f('0x33')]:_0x3af697['model'];if(_0xb4dc69['query'][_0x588f('0x43')]){_0x1de16f[_0x588f('0x44')]=[{'all':!![]}];}_0x1de16f=_['merge']({},_0x1de16f,_0xb4dc69[_0x588f('0x41')]);return db[_0x588f('0x42')][_0x588f('0x49')](_0x1de16f)[_0x588f('0x26')](handleEntityNotFound(_0x15d7fa,null))[_0x588f('0x26')](respondWithResult(_0x15d7fa,null))[_0x588f('0x46')](handleError(_0x15d7fa,null));};exports[_0x588f('0x4a')]=function(_0x3424e6,_0x4a0e58){return db[_0x588f('0x42')][_0x588f('0x4a')](_0x3424e6[_0x588f('0x4b')],{})[_0x588f('0x26')](respondWithResult(_0x4a0e58,0xc9))[_0x588f('0x46')](handleError(_0x4a0e58,null));};exports[_0x588f('0x25')]=function(_0x9f89bb,_0x2eabba){if(_0x9f89bb['body']['id']){delete _0x9f89bb[_0x588f('0x4b')]['id'];}return db[_0x588f('0x42')]['find']({'where':{'id':_0x9f89bb[_0x588f('0x48')]['id']}})[_0x588f('0x26')](handleEntityNotFound(_0x2eabba,null))['then'](saveUpdates(_0x9f89bb[_0x588f('0x4b')],null))['then'](respondWithResult(_0x2eabba,null))[_0x588f('0x46')](handleError(_0x2eabba,null));};exports[_0x588f('0x4c')]=function(_0x64ae9a,_0x55b85f){return db[_0x588f('0x42')][_0x588f('0x49')]({'where':{'id':_0x64ae9a['params']['id']}})[_0x588f('0x26')](handleEntityNotFound(_0x55b85f,null))[_0x588f('0x26')](removeEntity(_0x55b85f,null))[_0x588f('0x46')](handleError(_0x55b85f,null));};exports['getConfigurations']=function(_0x2a0898,_0x343888,_0xf81c47){var _0x493b65={};var _0x4538ae={};var _0x2105db;var _0x227f91;return db[_0x588f('0x42')][_0x588f('0x4d')]({'where':{'id':_0x2a0898[_0x588f('0x48')]['id']}})[_0x588f('0x26')](handleEntityNotFound(_0x343888,null))['then'](function(_0x3e861f){if(_0x3e861f){_0x2105db=_0x3e861f;_0x4538ae[_0x588f('0x30')]=_['keys'](db[_0x588f('0x4e')]['rawAttributes']);_0x4538ae[_0x588f('0x31')]=_['keys'](_0x2a0898['query']);_0x4538ae[_0x588f('0x3d')]=_['intersection'](_0x4538ae['model'],_0x4538ae['query']);_0x493b65[_0x588f('0x33')]=_[_0x588f('0x34')](_0x4538ae[_0x588f('0x30')],qs['fields'](_0x2a0898[_0x588f('0x31')][_0x588f('0x35')]));_0x493b65[_0x588f('0x33')]=_0x493b65['attributes'][_0x588f('0x36')]?_0x493b65['attributes']:_0x4538ae[_0x588f('0x30')];_0x493b65[_0x588f('0x39')]=qs[_0x588f('0x3a')](_0x2a0898['query'][_0x588f('0x3a')]);_0x493b65[_0x588f('0x3b')]=qs[_0x588f('0x3d')](_[_0x588f('0x3c')](_0x2a0898[_0x588f('0x31')],_0x4538ae['filters']));if(_0x2a0898[_0x588f('0x31')][_0x588f('0x3e')]){_0x493b65[_0x588f('0x3b')]=_[_0x588f('0x3f')](_0x493b65[_0x588f('0x3b')],{'$or':_[_0x588f('0x2b')](_0x493b65[_0x588f('0x33')],function(_0x3cd740){var _0x49ecdf={};_0x49ecdf[_0x3cd740]={'$like':'%'+_0x2a0898[_0x588f('0x31')]['filter']+'%'};return _0x49ecdf;})});}_0x493b65=_[_0x588f('0x3f')]({},_0x493b65,_0x2a0898[_0x588f('0x41')]);return _0x2105db[_0x588f('0x4f')](_0x493b65);}})[_0x588f('0x26')](function(_0x5ca591){if(_0x5ca591){_0x227f91=_0x5ca591[_0x588f('0x36')];if(!_0x2a0898[_0x588f('0x31')]['hasOwnProperty']('nolimit')){_0x493b65[_0x588f('0x1d')]=qs['limit'](_0x2a0898[_0x588f('0x31')][_0x588f('0x1d')]);_0x493b65['offset']=qs[_0x588f('0x1c')](_0x2a0898[_0x588f('0x31')][_0x588f('0x1c')]);}return _0x2105db[_0x588f('0x4f')](_0x493b65);}})['then'](function(_0x460dd8){if(_0x460dd8){return _0x460dd8?{'count':_0x227f91,'rows':_0x460dd8}:null;}})['then'](respondWithResult(_0x343888,null))[_0x588f('0x46')](handleError(_0x343888,null));};exports[_0x588f('0x50')]=function(_0x172db0,_0x2756ec,_0x3205c5){if(_0x172db0[_0x588f('0x4b')]['id']){delete _0x172db0[_0x588f('0x4b')]['id'];}return db[_0x588f('0x42')][_0x588f('0x4d')]({'where':{'id':_0x172db0['params']['id']}})[_0x588f('0x26')](handleEntityNotFound(_0x2756ec,null))['then'](function(_0x30abb9){if(_0x30abb9){_0x172db0[_0x588f('0x4b')][_0x588f('0x51')]=_0x30abb9['id'];_0x172db0[_0x588f('0x4b')][_0x588f('0x52')]=integrations[_0x588f('0x53')](_0x172db0[_0x588f('0x4b')]['channel'],_0x172db0['body'][_0x588f('0x2e')]);_0x172db0[_0x588f('0x4b')][_0x588f('0x54')]=integrations['getDescriptions'](_0x172db0[_0x588f('0x4b')][_0x588f('0x55')],_0x172db0[_0x588f('0x4b')][_0x588f('0x2e')]);return db[_0x588f('0x4e')][_0x588f('0x4a')](_0x172db0[_0x588f('0x4b')],{'include':[{'model':db[_0x588f('0x56')],'as':_0x588f('0x52')},{'model':db[_0x588f('0x56')],'as':_0x588f('0x54')}]});}return null;})['then'](respondWithResult(_0x2756ec,null))[_0x588f('0x46')](handleError(_0x2756ec,null));};var md5=require('md5');exports[_0x588f('0x57')]=function(_0xe3ce67,_0x34b051,_0x52ed7f){var _0x2af348=null;var _0x38bad2=null;var _0x3a2c36=null;var _0x396095=null;var _0x6628c1='';return db[_0x588f('0x42')][_0x588f('0x4d')]({'where':{'id':_0xe3ce67['params']['id']},'attributes':['id',_0x588f('0x29'),'username',_0x588f('0x58'),_0x588f('0x59'),'remoteUri',_0x588f('0x5a'),_0x588f('0x5b')]})[_0x588f('0x26')](handleEntityNotFound(_0x34b051,null))['then'](function(_0x174b74){if(_0x174b74){_0x2af348=_0x174b74[_0x588f('0x5c')];_0x38bad2=_0x174b74[_0x588f('0x5b')];_0x3a2c36=_0x174b74[_0x588f('0x59')];_0x6628c1=_0x174b74[_0x588f('0x5d')];var _0x298cc1=_0x6628c1[_0x588f('0x5e')](-0x1);if(_0x298cc1==='/'){_0x6628c1=_0x6628c1[_0x588f('0x5f')](0x0,_0x6628c1['lastIndexOf'](_0x298cc1));}_0x396095=util[_0x588f('0x60')](_0x588f('0x61'),_0x6628c1);var _0x1fb4f0={'method':_0x588f('0x62'),'uri':_0x396095,'qs':{'operation':'getchallenge','username':_0x174b74['username']},'json':!![]};return rp(_0x1fb4f0);}})[_0x588f('0x26')](function(_0x25bf10){if(_0x25bf10[_0x588f('0x63')]){var _0x7dfaba={'method':'POST','uri':_0x396095,'form':{'operation':_0x588f('0x64'),'username':_0x2af348,'accessKey':md5(_0x25bf10[_0x588f('0x65')][_0x588f('0x66')]+_0x38bad2)},'json':!![]};return rp(_0x7dfaba);}})['then'](function(_0x4f3bf1){if(_0x4f3bf1[_0x588f('0x63')]){var _0x1b5f0e={'method':_0x588f('0x62'),'uri':_0x396095,'qs':{'operation':_0x588f('0x67'),'username':_0x2af348,'sessionName':_0x4f3bf1[_0x588f('0x65')][_0x588f('0x68')],'elementType':_0x3a2c36},'json':!![]};return rp(_0x1b5f0e);}})[_0x588f('0x26')](function(_0x351c52){if(_0x351c52['success']){var _0x55f432=[_0x588f('0x69'),_0x588f('0x6a'),'owner'];_[_0x588f('0x6b')](_0x351c52[_0x588f('0x65')][_0x588f('0x35')],function(_0x29b955){return _0x55f432[_0x588f('0x6c')](_0x29b955[_0x588f('0x2e')][_0x588f('0x29')]);});_[_0x588f('0x6b')](_0x351c52[_0x588f('0x65')][_0x588f('0x35')],function(_0xc634fc){return _0xc634fc[_0x588f('0x6d')]===_0x588f('0x6e');});return{'count':_0x351c52['result']['fields'][_0x588f('0x36')],'rows':_['map'](_0x351c52['result']['fields'],function(_0x5c909){return{'id':_0x5c909[_0x588f('0x29')],'name':_0x5c909[_0x588f('0x6f')],'custom':_[_0x588f('0x70')](_0x5c909[_0x588f('0x29')],'cf_')?!![]:![],'options':_0x5c909['type'][_0x588f('0x29')]==='picklist'&&_0x5c909[_0x588f('0x2e')][_0x588f('0x71')][_0x588f('0x36')]>0x0?_['map'](_0x5c909[_0x588f('0x2e')][_0x588f('0x71')],function(_0x47d653){return{'name':_0x47d653[_0x588f('0x6f')],'value':_0x47d653['value']};}):[]};})};}})['then'](respondWithResult(_0x34b051,null))['catch'](function(_0x140475){console[_0x588f('0x72')](_0x588f('0x73')+_0x140475);var _0x4f93c7=_0xe3ce67[_0x588f('0x31')][_0x588f('0x74')]?0x1f4:_0x140475[_0x588f('0x75')]||0x1f4;logger[_0x588f('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x588f('0x57'),_0x4f93c7,JSON[_0x588f('0x76')](_0x140475));delete _0x140475[_0x588f('0x29')];if(_0x4f93c7===0x191){_0x4f93c7=0x190;}_0x34b051[_0x588f('0x1a')](_0x4f93c7)[_0x588f('0x77')](_0xe3ce67[_0x588f('0x31')][_0x588f('0x74')]?{'message':_0x588f('0x78'),'statusCode':_0x140475[_0x588f('0x75')]}:_0x140475);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f672f1a..8bfe0c2 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 _0x41f7=['path','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x18d677,_0x5d7115){var _0x171e51=function(_0x307dc6){while(--_0x307dc6){_0x18d677['push'](_0x18d677['shift']());}};_0x171e51(++_0x5d7115);}(_0x41f7,0x1c5));var _0x741f=function(_0x1a728a,_0x461c23){_0x1a728a=_0x1a728a-0x0;var _0x5afe63=_0x41f7[_0x1a728a];return _0x5afe63;};'use strict';var _=require(_0x741f('0x0'));var util=require(_0x741f('0x1'));var logger=require(_0x741f('0x2'))(_0x741f('0x3'));var moment=require(_0x741f('0x4'));var BPromise=require(_0x741f('0x5'));var rp=require(_0x741f('0x6'));var fs=require('fs');var path=require(_0x741f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x10b854,_0xbfde9f){return _0x10b854['define'](_0x741f('0x8'),attributes,{'tableName':_0x741f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe55=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x22b879,_0x1000e2){var _0x3db636=function(_0x1aa745){while(--_0x1aa745){_0x22b879['push'](_0x22b879['shift']());}};_0x3db636(++_0x1000e2);}(_0xbe55,0x149));var _0x5be5=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xbe55[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x5be5('0x0'));var util=require(_0x5be5('0x1'));var logger=require(_0x5be5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5be5('0x3'));var rp=require(_0x5be5('0x4'));var fs=require('fs');var path=require(_0x5be5('0x5'));var rimraf=require(_0x5be5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5be5('0x7'));var integrations=require(_0x5be5('0x8'));module[_0x5be5('0x9')]=function(_0x389eba,_0x265e4a){return _0x389eba[_0x5be5('0xa')](_0x5be5('0xb'),attributes,{'tableName':_0x5be5('0xc'),'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 4dacc96..5439d8a 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 _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xab40=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VtigerAccount','findAll','options','limit','include','model','map','attributes','GetVtigerAccount','ShowVtigerAccount','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59b098,_0x46ea74){var _0x5bcb15=function(_0x138638){while(--_0x138638){_0x59b098['push'](_0x59b098['shift']());}};_0x5bcb15(++_0x46ea74);}(_0xab40,0xcd));var _0x0ab4=function(_0x966b22,_0x50f2d9){_0x966b22=_0x966b22-0x0;var _0x45fe48=_0xab40[_0x966b22];return _0x45fe48;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetVtigerAccount']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetVtigerAccount',_0x17422f);logger['debug']('GetVtigerAccount',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['VtigerAccount']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bd097b2..e18e473 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 _0x03ad=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0xc85513,_0x49e852){var _0x3e70be=function(_0x53bbd6){while(--_0x53bbd6){_0xc85513['push'](_0xc85513['shift']());}};_0x3e70be(++_0x49e852);}(_0x03ad,0x133));var _0xd03a=function(_0x8290f1,_0x1ab791){_0x8290f1=_0x8290f1-0x0;var _0xd8bfcc=_0x03ad[_0x8290f1];return _0xd8bfcc;};'use strict';var multer=require(_0xd03a('0x0'));var util=require(_0xd03a('0x1'));var path=require(_0xd03a('0x2'));var timeout=require(_0xd03a('0x3'));var express=require(_0xd03a('0x4'));var router=express[_0xd03a('0x5')]();var fs_extra=require(_0xd03a('0x6'));var auth=require(_0xd03a('0x7'));var interaction=require(_0xd03a('0x8'));var config=require(_0xd03a('0x9'));var controller=require(_0xd03a('0xa'));router[_0xd03a('0xb')]('/',auth[_0xd03a('0xc')](),controller[_0xd03a('0xd')]);router[_0xd03a('0xb')](_0xd03a('0xe'),auth[_0xd03a('0xc')](),controller[_0xd03a('0xf')]);router[_0xd03a('0xb')](_0xd03a('0x10'),auth[_0xd03a('0xc')](),controller['getFields']);router[_0xd03a('0xb')](_0xd03a('0x11'),auth[_0xd03a('0xc')](),controller['getSubjects']);router[_0xd03a('0xb')](_0xd03a('0x12'),auth[_0xd03a('0xc')](),controller[_0xd03a('0x13')]);router[_0xd03a('0x14')]('/',auth['isAuthenticated'](),controller[_0xd03a('0x15')]);router[_0xd03a('0x16')]('/:id',auth[_0xd03a('0xc')](),controller[_0xd03a('0x17')]);router[_0xd03a('0x18')]('/:id',auth[_0xd03a('0xc')](),controller[_0xd03a('0x19')]);module[_0xd03a('0x1a')]=router; \ No newline at end of file +var _0xec33=['../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4edb2b,_0x24cc81){var _0x22fc86=function(_0x11bfb0){while(--_0x11bfb0){_0x4edb2b['push'](_0x4edb2b['shift']());}};_0x22fc86(++_0x24cc81);}(_0xec33,0xf7));var _0x3ec3=function(_0x48561c,_0x23b443){_0x48561c=_0x48561c-0x0;var _0x123a6b=_0xec33[_0x48561c];return _0x123a6b;};'use strict';var multer=require('multer');var util=require(_0x3ec3('0x0'));var path=require('path');var timeout=require(_0x3ec3('0x1'));var express=require('express');var router=express[_0x3ec3('0x2')]();var fs_extra=require(_0x3ec3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3ec3('0x4'));var config=require(_0x3ec3('0x5'));var controller=require(_0x3ec3('0x6'));router[_0x3ec3('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ec3('0x8')]);router['get'](_0x3ec3('0x9'),auth[_0x3ec3('0xa')](),controller['show']);router[_0x3ec3('0x7')](_0x3ec3('0xb'),auth[_0x3ec3('0xa')](),controller[_0x3ec3('0xc')]);router['get']('/:id/subjects',auth[_0x3ec3('0xa')](),controller[_0x3ec3('0xd')]);router[_0x3ec3('0x7')](_0x3ec3('0xe'),auth[_0x3ec3('0xa')](),controller[_0x3ec3('0xf')]);router['post']('/',auth[_0x3ec3('0xa')](),controller[_0x3ec3('0x10')]);router[_0x3ec3('0x11')]('/:id',auth[_0x3ec3('0xa')](),controller[_0x3ec3('0x12')]);router[_0x3ec3('0x13')]('/:id',auth[_0x3ec3('0xa')](),controller[_0x3ec3('0x14')]);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 485a84f..1d251fd 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 _0x9b6f=['STRING','sequelize','exports'];(function(_0x5a5fc5,_0x458433){var _0x116945=function(_0x3e6441){while(--_0x3e6441){_0x5a5fc5['push'](_0x5a5fc5['shift']());}};_0x116945(++_0x458433);}(_0x9b6f,0x154));var _0xf9b6=function(_0x1f0b46,_0x12b7d5){_0x1f0b46=_0x1f0b46-0x0;var _0x33fa37=_0x9b6f[_0x1f0b46];return _0x33fa37;};'use strict';var Sequelize=require(_0xf9b6('0x0'));module[_0xf9b6('0x1')]={'name':{'type':Sequelize[_0xf9b6('0x2')]},'description':{'type':Sequelize[_0xf9b6('0x2')]}}; \ No newline at end of file +var _0xfda7=['sequelize','exports','STRING'];(function(_0x5e7894,_0x15bbb5){var _0x47257c=function(_0x4e1dc8){while(--_0x4e1dc8){_0x5e7894['push'](_0x5e7894['shift']());}};_0x47257c(++_0x15bbb5);}(_0xfda7,0x1bc));var _0x7fda=function(_0x4b09f5,_0x14dd7a){_0x4b09f5=_0x4b09f5-0x0;var _0x39bce0=_0xfda7[_0x4b09f5];return _0x39bce0;};'use strict';var Sequelize=require(_0x7fda('0x0'));module[_0x7fda('0x1')]={'name':{'type':Sequelize[_0x7fda('0x2')]},'description':{'type':Sequelize[_0x7fda('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 07018b2..5e58387 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 _0x4d3a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','rawAttributes','getSubjects','getDescriptions','rimraf'];(function(_0x4fff25,_0x30ca7f){var _0x5d9d9a=function(_0x163e47){while(--_0x163e47){_0x4fff25['push'](_0x4fff25['shift']());}};_0x5d9d9a(++_0x30ca7f);}(_0x4d3a,0x157));var _0xa4d3=function(_0x41deb8,_0x458105){_0x41deb8=_0x41deb8-0x0;var _0x1e2084=_0x4d3a[_0x41deb8];return _0x1e2084;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4d3('0x0'));var zipdir=require(_0xa4d3('0x1'));var jsonpatch=require(_0xa4d3('0x2'));var rp=require(_0xa4d3('0x3'));var moment=require(_0xa4d3('0x4'));var BPromise=require(_0xa4d3('0x5'));var Mustache=require(_0xa4d3('0x6'));var util=require(_0xa4d3('0x7'));var path=require(_0xa4d3('0x8'));var sox=require('sox');var csv=require(_0xa4d3('0x9'));var ejs=require(_0xa4d3('0xa'));var fs=require('fs');var fs_extra=require(_0xa4d3('0xb'));var _=require(_0xa4d3('0xc'));var squel=require(_0xa4d3('0xd'));var crypto=require(_0xa4d3('0xe'));var jsforce=require(_0xa4d3('0xf'));var deskjs=require(_0xa4d3('0x10'));var toCsv=require(_0xa4d3('0x9'));var querystring=require(_0xa4d3('0x11'));var Papa=require(_0xa4d3('0x12'));var Redis=require(_0xa4d3('0x13'));var authService=require(_0xa4d3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa4d3('0x15'));var hardwareService=require(_0xa4d3('0x16'));var logger=require(_0xa4d3('0x17'))(_0xa4d3('0x18'));var utils=require(_0xa4d3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa4d3('0x1a'));var db=require(_0xa4d3('0x1b'))['db'];function respondWithStatusCode(_0x128272,_0xb89020){_0xb89020=_0xb89020||0xcc;return function(_0x470a43){if(_0x470a43){return _0x128272[_0xa4d3('0x1c')](_0xb89020);}return _0x128272[_0xa4d3('0x1d')](_0xb89020)[_0xa4d3('0x1e')]();};}function respondWithResult(_0x7d321c,_0x5439ab){_0x5439ab=_0x5439ab||0xc8;return function(_0xf1be9){if(_0xf1be9){return _0x7d321c[_0xa4d3('0x1d')](_0x5439ab)['json'](_0xf1be9);}};}function respondWithFilteredResult(_0x19fb37,_0x42ad6d){return function(_0x28d83e){if(_0x28d83e){var _0x4441d1=typeof _0x42ad6d[_0xa4d3('0x1f')]===_0xa4d3('0x20')&&typeof _0x42ad6d[_0xa4d3('0x21')]==='undefined';var _0xe2376f=_0x28d83e[_0xa4d3('0x22')];var _0x46773b=_0x4441d1?0x0:_0x42ad6d['offset'];var _0xd4a052=_0x4441d1?_0x28d83e[_0xa4d3('0x22')]:_0x42ad6d['offset']+_0x42ad6d[_0xa4d3('0x21')];var _0x5adfda;if(_0xd4a052>=_0xe2376f){_0xd4a052=_0xe2376f;_0x5adfda=0xc8;}else{_0x5adfda=0xce;}_0x19fb37[_0xa4d3('0x1d')](_0x5adfda);return _0x19fb37[_0xa4d3('0x23')]('Content-Range',_0x46773b+'-'+_0xd4a052+'/'+_0xe2376f)[_0xa4d3('0x24')](_0x28d83e);}return null;};}function patchUpdates(_0x17a7a6){return function(_0x22811b){try{jsonpatch[_0xa4d3('0x25')](_0x22811b,_0x17a7a6,!![]);}catch(_0x1fd1fe){return BPromise[_0xa4d3('0x26')](_0x1fd1fe);}return _0x22811b[_0xa4d3('0x27')]();};}function saveUpdates(_0x4389fa,_0x212193){return function(_0x42cd51){if(_0x42cd51){return _0x42cd51[_0xa4d3('0x28')](_0x4389fa)[_0xa4d3('0x29')](function(_0x5f533c){return _0x5f533c;});}return null;};}function removeEntity(_0x608798,_0x512abb){return function(_0x507568){if(_0x507568){return _0x507568[_0xa4d3('0x2a')]()[_0xa4d3('0x29')](function(){_0x608798[_0xa4d3('0x1d')](0xcc)[_0xa4d3('0x1e')]();});}};}function handleEntityNotFound(_0x4707bb,_0x477ff4){return function(_0x32c6f0){if(!_0x32c6f0){_0x4707bb[_0xa4d3('0x1c')](0x194);}return _0x32c6f0;};}function handleError(_0xd71837,_0x311ed0){_0x311ed0=_0x311ed0||0x1f4;return function(_0x528341){logger[_0xa4d3('0x2b')](_0x528341[_0xa4d3('0x2c')]);if(_0x528341['name']){delete _0x528341[_0xa4d3('0x2d')];}_0xd71837[_0xa4d3('0x1d')](_0x311ed0)[_0xa4d3('0x2e')](_0x528341);};}exports[_0xa4d3('0x2f')]=function(_0x5cf00a,_0x47fae8){var _0x3d9bff={},_0x2bb764={},_0xd84d56={'count':0x0,'rows':[]};var _0x5efc7d=_[_0xa4d3('0x30')](db[_0xa4d3('0x31')]['rawAttributes'],function(_0x509961){return{'name':_0x509961[_0xa4d3('0x32')],'type':_0x509961[_0xa4d3('0x33')]['key']};});_0x2bb764[_0xa4d3('0x34')]=_[_0xa4d3('0x30')](_0x5efc7d,'name');_0x2bb764[_0xa4d3('0x35')]=_[_0xa4d3('0x36')](_0x5cf00a[_0xa4d3('0x35')]);_0x2bb764[_0xa4d3('0x37')]=_[_0xa4d3('0x38')](_0x2bb764[_0xa4d3('0x34')],_0x2bb764[_0xa4d3('0x35')]);_0x3d9bff[_0xa4d3('0x39')]=_[_0xa4d3('0x38')](_0x2bb764[_0xa4d3('0x34')],qs[_0xa4d3('0x3a')](_0x5cf00a[_0xa4d3('0x35')][_0xa4d3('0x3a')]));_0x3d9bff[_0xa4d3('0x39')]=_0x3d9bff[_0xa4d3('0x39')][_0xa4d3('0x3b')]?_0x3d9bff['attributes']:_0x2bb764[_0xa4d3('0x34')];if(!_0x5cf00a[_0xa4d3('0x35')][_0xa4d3('0x3c')](_0xa4d3('0x3d'))){_0x3d9bff[_0xa4d3('0x21')]=qs[_0xa4d3('0x21')](_0x5cf00a[_0xa4d3('0x35')]['limit']);_0x3d9bff[_0xa4d3('0x1f')]=qs['offset'](_0x5cf00a[_0xa4d3('0x35')][_0xa4d3('0x1f')]);}_0x3d9bff[_0xa4d3('0x3e')]=qs[_0xa4d3('0x3f')](_0x5cf00a[_0xa4d3('0x35')][_0xa4d3('0x3f')]);_0x3d9bff[_0xa4d3('0x40')]=qs[_0xa4d3('0x37')](_[_0xa4d3('0x41')](_0x5cf00a[_0xa4d3('0x35')],_0x2bb764[_0xa4d3('0x37')]),_0x5efc7d);if(_0x5cf00a[_0xa4d3('0x35')]['filter']){_0x3d9bff[_0xa4d3('0x40')]=_[_0xa4d3('0x42')](_0x3d9bff[_0xa4d3('0x40')],{'$or':_[_0xa4d3('0x30')](_0x5efc7d,function(_0x2bea82){if(_0x2bea82[_0xa4d3('0x33')]!==_0xa4d3('0x43')){var _0xe5fd13={};_0xe5fd13[_0x2bea82[_0xa4d3('0x2d')]]={'$like':'%'+_0x5cf00a[_0xa4d3('0x35')][_0xa4d3('0x44')]+'%'};return _0xe5fd13;}})});}_0x3d9bff=_[_0xa4d3('0x42')]({},_0x3d9bff,_0x5cf00a[_0xa4d3('0x45')]);var _0x59449b={'where':_0x3d9bff[_0xa4d3('0x40')]};return db['VtigerConfiguration'][_0xa4d3('0x22')](_0x59449b)['then'](function(_0x5122ee){_0xd84d56[_0xa4d3('0x22')]=_0x5122ee;if(_0x5cf00a['query'][_0xa4d3('0x46')]){_0x3d9bff[_0xa4d3('0x47')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa4d3('0x48')](_0x3d9bff);})[_0xa4d3('0x29')](function(_0x4a334b){_0xd84d56[_0xa4d3('0x49')]=_0x4a334b;return _0xd84d56;})[_0xa4d3('0x29')](respondWithFilteredResult(_0x47fae8,_0x3d9bff))[_0xa4d3('0x4a')](handleError(_0x47fae8,null));};exports[_0xa4d3('0x4b')]=function(_0x139456,_0x2eeaea){var _0x3e6d00={'raw':![],'where':{'id':_0x139456[_0xa4d3('0x4c')]['id']}},_0x1a9c3b={};_0x1a9c3b['model']=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x1a9c3b[_0xa4d3('0x35')]=_['keys'](_0x139456[_0xa4d3('0x35')]);_0x1a9c3b['filters']=_[_0xa4d3('0x38')](_0x1a9c3b[_0xa4d3('0x34')],_0x1a9c3b[_0xa4d3('0x35')]);_0x3e6d00['attributes']=_[_0xa4d3('0x38')](_0x1a9c3b['model'],qs[_0xa4d3('0x3a')](_0x139456['query'][_0xa4d3('0x3a')]));_0x3e6d00[_0xa4d3('0x39')]=_0x3e6d00[_0xa4d3('0x39')][_0xa4d3('0x3b')]?_0x3e6d00[_0xa4d3('0x39')]:_0x1a9c3b[_0xa4d3('0x34')];if(_0x139456[_0xa4d3('0x35')]['includeAll']){_0x3e6d00[_0xa4d3('0x47')]=[{'all':!![]}];}_0x3e6d00=_['merge']({},_0x3e6d00,_0x139456[_0xa4d3('0x45')]);return db[_0xa4d3('0x31')][_0xa4d3('0x4d')](_0x3e6d00)[_0xa4d3('0x29')](handleEntityNotFound(_0x2eeaea,null))['then'](respondWithResult(_0x2eeaea,null))[_0xa4d3('0x4a')](handleError(_0x2eeaea,null));};exports[_0xa4d3('0x4e')]=function(_0x2f22f0,_0x19421f){return db[_0xa4d3('0x31')][_0xa4d3('0x4e')](_0x2f22f0[_0xa4d3('0x4f')],{})[_0xa4d3('0x29')](respondWithResult(_0x19421f,0xc9))['catch'](handleError(_0x19421f,null));};exports[_0xa4d3('0x28')]=function(_0x46e853,_0x5a3468){if(_0x46e853[_0xa4d3('0x4f')]['id']){delete _0x46e853[_0xa4d3('0x4f')]['id'];}return db[_0xa4d3('0x31')][_0xa4d3('0x4d')]({'where':{'id':_0x46e853[_0xa4d3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a3468,null))[_0xa4d3('0x29')](saveUpdates(_0x46e853['body'],null))[_0xa4d3('0x29')](respondWithResult(_0x5a3468,null))['catch'](handleError(_0x5a3468,null));};exports['destroy']=function(_0x15ca97,_0x5db83a){return db[_0xa4d3('0x31')][_0xa4d3('0x4d')]({'where':{'id':_0x15ca97['params']['id']}})[_0xa4d3('0x29')](handleEntityNotFound(_0x5db83a,null))[_0xa4d3('0x29')](removeEntity(_0x5db83a,null))[_0xa4d3('0x4a')](handleError(_0x5db83a,null));};exports[_0xa4d3('0x50')]=function(_0x436eb5,_0x5e08f9,_0x5abdf3){var _0x3b258f={};var _0x11d62d={};var _0x2bcc35;var _0x19edad;return db['VtigerConfiguration'][_0xa4d3('0x51')]({'where':{'id':_0x436eb5['params']['id']}})['then'](handleEntityNotFound(_0x5e08f9,null))['then'](function(_0x98bf11){if(_0x98bf11){_0x2bcc35=_0x98bf11;_0x11d62d['model']=_['keys'](db['VtigerField']['rawAttributes']);_0x11d62d[_0xa4d3('0x35')]=_[_0xa4d3('0x36')](_0x436eb5['query']);_0x11d62d[_0xa4d3('0x37')]=_['intersection'](_0x11d62d[_0xa4d3('0x34')],_0x11d62d[_0xa4d3('0x35')]);_0x3b258f[_0xa4d3('0x39')]=_[_0xa4d3('0x38')](_0x11d62d[_0xa4d3('0x34')],qs[_0xa4d3('0x3a')](_0x436eb5['query'][_0xa4d3('0x3a')]));_0x3b258f[_0xa4d3('0x39')]=_0x3b258f['attributes'][_0xa4d3('0x3b')]?_0x3b258f['attributes']:_0x11d62d['model'];_0x3b258f['order']=qs[_0xa4d3('0x3f')](_0x436eb5[_0xa4d3('0x35')][_0xa4d3('0x3f')]);_0x3b258f[_0xa4d3('0x40')]=qs[_0xa4d3('0x37')](_[_0xa4d3('0x41')](_0x436eb5['query'],_0x11d62d[_0xa4d3('0x37')]));if(_0x436eb5[_0xa4d3('0x35')]['filter']){_0x3b258f[_0xa4d3('0x40')]=_[_0xa4d3('0x42')](_0x3b258f['where'],{'$or':_['map'](_0x3b258f['attributes'],function(_0x3248f8){var _0x42137b={};_0x42137b[_0x3248f8]={'$like':'%'+_0x436eb5[_0xa4d3('0x35')]['filter']+'%'};return _0x42137b;})});}_0x3b258f=_['merge']({},_0x3b258f,_0x436eb5['options']);return _0x2bcc35[_0xa4d3('0x50')](_0x3b258f);}})['then'](function(_0x28990a){if(_0x28990a){_0x19edad=_0x28990a[_0xa4d3('0x3b')];if(!_0x436eb5[_0xa4d3('0x35')]['hasOwnProperty'](_0xa4d3('0x3d'))){_0x3b258f[_0xa4d3('0x21')]=qs[_0xa4d3('0x21')](_0x436eb5[_0xa4d3('0x35')]['limit']);_0x3b258f[_0xa4d3('0x1f')]=qs[_0xa4d3('0x1f')](_0x436eb5['query'][_0xa4d3('0x1f')]);}return _0x2bcc35['getFields'](_0x3b258f);}})[_0xa4d3('0x29')](function(_0x276464){if(_0x276464){return _0x276464?{'count':_0x19edad,'rows':_0x276464}:null;}})[_0xa4d3('0x29')](respondWithResult(_0x5e08f9,null))['catch'](handleError(_0x5e08f9,null));};exports['getSubjects']=function(_0x55e05a,_0x251667,_0x3c73da){var _0x31a4d7={};var _0x588df1={};var _0x7ebc71;var _0x4d5ce2;return db[_0xa4d3('0x31')]['findOne']({'where':{'id':_0x55e05a[_0xa4d3('0x4c')]['id']}})[_0xa4d3('0x29')](handleEntityNotFound(_0x251667,null))[_0xa4d3('0x29')](function(_0x2d07bb){if(_0x2d07bb){_0x7ebc71=_0x2d07bb;_0x588df1[_0xa4d3('0x34')]=_[_0xa4d3('0x36')](db[_0xa4d3('0x52')][_0xa4d3('0x53')]);_0x588df1[_0xa4d3('0x35')]=_['keys'](_0x55e05a[_0xa4d3('0x35')]);_0x588df1[_0xa4d3('0x37')]=_['intersection'](_0x588df1[_0xa4d3('0x34')],_0x588df1[_0xa4d3('0x35')]);_0x31a4d7[_0xa4d3('0x39')]=_[_0xa4d3('0x38')](_0x588df1[_0xa4d3('0x34')],qs[_0xa4d3('0x3a')](_0x55e05a[_0xa4d3('0x35')]['fields']));_0x31a4d7[_0xa4d3('0x39')]=_0x31a4d7[_0xa4d3('0x39')][_0xa4d3('0x3b')]?_0x31a4d7['attributes']:_0x588df1['model'];_0x31a4d7[_0xa4d3('0x3e')]=qs[_0xa4d3('0x3f')](_0x55e05a[_0xa4d3('0x35')]['sort']);_0x31a4d7[_0xa4d3('0x40')]=qs[_0xa4d3('0x37')](_['pick'](_0x55e05a[_0xa4d3('0x35')],_0x588df1[_0xa4d3('0x37')]));if(_0x55e05a[_0xa4d3('0x35')]['filter']){_0x31a4d7[_0xa4d3('0x40')]=_[_0xa4d3('0x42')](_0x31a4d7['where'],{'$or':_[_0xa4d3('0x30')](_0x31a4d7[_0xa4d3('0x39')],function(_0x262f62){var _0xdf47c={};_0xdf47c[_0x262f62]={'$like':'%'+_0x55e05a[_0xa4d3('0x35')][_0xa4d3('0x44')]+'%'};return _0xdf47c;})});}_0x31a4d7=_['merge']({},_0x31a4d7,_0x55e05a[_0xa4d3('0x45')]);return _0x7ebc71[_0xa4d3('0x54')](_0x31a4d7);}})[_0xa4d3('0x29')](function(_0x195fae){if(_0x195fae){_0x4d5ce2=_0x195fae['length'];if(!_0x55e05a[_0xa4d3('0x35')][_0xa4d3('0x3c')]('nolimit')){_0x31a4d7[_0xa4d3('0x21')]=qs['limit'](_0x55e05a['query']['limit']);_0x31a4d7[_0xa4d3('0x1f')]=qs[_0xa4d3('0x1f')](_0x55e05a[_0xa4d3('0x35')][_0xa4d3('0x1f')]);}return _0x7ebc71[_0xa4d3('0x54')](_0x31a4d7);}})['then'](function(_0x404fe1){if(_0x404fe1){return _0x404fe1?{'count':_0x4d5ce2,'rows':_0x404fe1}:null;}})[_0xa4d3('0x29')](respondWithResult(_0x251667,null))[_0xa4d3('0x4a')](handleError(_0x251667,null));};exports[_0xa4d3('0x55')]=function(_0x11820e,_0x54ecd2,_0x130c79){var _0x2ec84e={};var _0x2ad9d8={};var _0x410658;var _0x226da4;return db[_0xa4d3('0x31')][_0xa4d3('0x51')]({'where':{'id':_0x11820e[_0xa4d3('0x4c')]['id']}})[_0xa4d3('0x29')](handleEntityNotFound(_0x54ecd2,null))['then'](function(_0x5a03e6){if(_0x5a03e6){_0x410658=_0x5a03e6;_0x2ad9d8['model']=_[_0xa4d3('0x36')](db[_0xa4d3('0x52')]['rawAttributes']);_0x2ad9d8[_0xa4d3('0x35')]=_[_0xa4d3('0x36')](_0x11820e[_0xa4d3('0x35')]);_0x2ad9d8[_0xa4d3('0x37')]=_[_0xa4d3('0x38')](_0x2ad9d8[_0xa4d3('0x34')],_0x2ad9d8[_0xa4d3('0x35')]);_0x2ec84e[_0xa4d3('0x39')]=_[_0xa4d3('0x38')](_0x2ad9d8[_0xa4d3('0x34')],qs[_0xa4d3('0x3a')](_0x11820e[_0xa4d3('0x35')][_0xa4d3('0x3a')]));_0x2ec84e[_0xa4d3('0x39')]=_0x2ec84e[_0xa4d3('0x39')]['length']?_0x2ec84e[_0xa4d3('0x39')]:_0x2ad9d8[_0xa4d3('0x34')];_0x2ec84e[_0xa4d3('0x3e')]=qs['sort'](_0x11820e[_0xa4d3('0x35')][_0xa4d3('0x3f')]);_0x2ec84e[_0xa4d3('0x40')]=qs[_0xa4d3('0x37')](_[_0xa4d3('0x41')](_0x11820e['query'],_0x2ad9d8[_0xa4d3('0x37')]));if(_0x11820e[_0xa4d3('0x35')]['filter']){_0x2ec84e[_0xa4d3('0x40')]=_[_0xa4d3('0x42')](_0x2ec84e[_0xa4d3('0x40')],{'$or':_[_0xa4d3('0x30')](_0x2ec84e['attributes'],function(_0x1e0333){var _0x4f4751={};_0x4f4751[_0x1e0333]={'$like':'%'+_0x11820e[_0xa4d3('0x35')][_0xa4d3('0x44')]+'%'};return _0x4f4751;})});}_0x2ec84e=_[_0xa4d3('0x42')]({},_0x2ec84e,_0x11820e[_0xa4d3('0x45')]);return _0x410658[_0xa4d3('0x55')](_0x2ec84e);}})[_0xa4d3('0x29')](function(_0x4d93dd){if(_0x4d93dd){_0x226da4=_0x4d93dd[_0xa4d3('0x3b')];if(!_0x11820e[_0xa4d3('0x35')][_0xa4d3('0x3c')](_0xa4d3('0x3d'))){_0x2ec84e[_0xa4d3('0x21')]=qs[_0xa4d3('0x21')](_0x11820e['query'][_0xa4d3('0x21')]);_0x2ec84e[_0xa4d3('0x1f')]=qs['offset'](_0x11820e['query'][_0xa4d3('0x1f')]);}return _0x410658[_0xa4d3('0x55')](_0x2ec84e);}})[_0xa4d3('0x29')](function(_0x2e97ac){if(_0x2e97ac){return _0x2e97ac?{'count':_0x226da4,'rows':_0x2e97ac}:null;}})[_0xa4d3('0x29')](respondWithResult(_0x54ecd2,null))[_0xa4d3('0x4a')](handleError(_0x54ecd2,null));}; \ No newline at end of file +var _0x98e5=['../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters','find','create','body','getFields','findOne','VtigerField','options','getSubjects','getDescriptions','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x236b03,_0x385568){var _0x1c8de8=function(_0xbe77f9){while(--_0xbe77f9){_0x236b03['push'](_0x236b03['shift']());}};_0x1c8de8(++_0x385568);}(_0x98e5,0x8a));var _0x598e=function(_0x28d41e,_0x4c974e){_0x28d41e=_0x28d41e-0x0;var _0x130856=_0x98e5[_0x28d41e];return _0x130856;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x598e('0x0'));var rp=require(_0x598e('0x1'));var moment=require('moment');var BPromise=require(_0x598e('0x2'));var Mustache=require(_0x598e('0x3'));var util=require('util');var path=require(_0x598e('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x598e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x598e('0x6'));var squel=require(_0x598e('0x7'));var crypto=require(_0x598e('0x8'));var jsforce=require(_0x598e('0x9'));var deskjs=require(_0x598e('0xa'));var toCsv=require(_0x598e('0xb'));var querystring=require(_0x598e('0xc'));var Papa=require(_0x598e('0xd'));var Redis=require(_0x598e('0xe'));var authService=require(_0x598e('0xf'));var qs=require(_0x598e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x598e('0x11'));var logger=require(_0x598e('0x12'))('api');var utils=require(_0x598e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x598e('0x14'));var db=require(_0x598e('0x15'))['db'];function respondWithStatusCode(_0x2e3614,_0xd29d12){_0xd29d12=_0xd29d12||0xcc;return function(_0x3811b2){if(_0x3811b2){return _0x2e3614['sendStatus'](_0xd29d12);}return _0x2e3614[_0x598e('0x16')](_0xd29d12)['end']();};}function respondWithResult(_0x1c3f37,_0x51d7f0){_0x51d7f0=_0x51d7f0||0xc8;return function(_0x4e253a){if(_0x4e253a){return _0x1c3f37[_0x598e('0x16')](_0x51d7f0)[_0x598e('0x17')](_0x4e253a);}};}function respondWithFilteredResult(_0x3d6571,_0x38868b){return function(_0x34c672){if(_0x34c672){var _0x93ba6c=typeof _0x38868b[_0x598e('0x18')]==='undefined'&&typeof _0x38868b[_0x598e('0x19')]===_0x598e('0x1a');var _0x3521bc=_0x34c672[_0x598e('0x1b')];var _0x50ffbb=_0x93ba6c?0x0:_0x38868b[_0x598e('0x18')];var _0x2ecb1e=_0x93ba6c?_0x34c672[_0x598e('0x1b')]:_0x38868b[_0x598e('0x18')]+_0x38868b[_0x598e('0x19')];var _0x1c1085;if(_0x2ecb1e>=_0x3521bc){_0x2ecb1e=_0x3521bc;_0x1c1085=0xc8;}else{_0x1c1085=0xce;}_0x3d6571[_0x598e('0x16')](_0x1c1085);return _0x3d6571[_0x598e('0x1c')](_0x598e('0x1d'),_0x50ffbb+'-'+_0x2ecb1e+'/'+_0x3521bc)[_0x598e('0x17')](_0x34c672);}return null;};}function patchUpdates(_0x17e5f1){return function(_0x2a1a65){try{jsonpatch[_0x598e('0x1e')](_0x2a1a65,_0x17e5f1,!![]);}catch(_0x20c1bb){return BPromise[_0x598e('0x1f')](_0x20c1bb);}return _0x2a1a65[_0x598e('0x20')]();};}function saveUpdates(_0x233f16,_0x5b9c3){return function(_0x4a483b){if(_0x4a483b){return _0x4a483b[_0x598e('0x21')](_0x233f16)['then'](function(_0xdec363){return _0xdec363;});}return null;};}function removeEntity(_0x3cea88,_0x5df3ba){return function(_0x45e7ee){if(_0x45e7ee){return _0x45e7ee[_0x598e('0x22')]()[_0x598e('0x23')](function(){_0x3cea88[_0x598e('0x16')](0xcc)[_0x598e('0x24')]();});}};}function handleEntityNotFound(_0x3e434e,_0x2cb735){return function(_0x2a8fbc){if(!_0x2a8fbc){_0x3e434e[_0x598e('0x25')](0x194);}return _0x2a8fbc;};}function handleError(_0x19d4f8,_0x1a8d85){_0x1a8d85=_0x1a8d85||0x1f4;return function(_0x5d63ce){logger[_0x598e('0x26')](_0x5d63ce['stack']);if(_0x5d63ce[_0x598e('0x27')]){delete _0x5d63ce[_0x598e('0x27')];}_0x19d4f8[_0x598e('0x16')](_0x1a8d85)['send'](_0x5d63ce);};}exports[_0x598e('0x28')]=function(_0xc81d68,_0x158681){var _0x884e0f={},_0x43ddf0={},_0x5ecac3={'count':0x0,'rows':[]};var _0x4fad2d=_['map'](db[_0x598e('0x29')][_0x598e('0x2a')],function(_0x2ee4a5){return{'name':_0x2ee4a5[_0x598e('0x2b')],'type':_0x2ee4a5[_0x598e('0x2c')][_0x598e('0x2d')]};});_0x43ddf0['model']=_[_0x598e('0x2e')](_0x4fad2d,_0x598e('0x27'));_0x43ddf0[_0x598e('0x2f')]=_[_0x598e('0x30')](_0xc81d68[_0x598e('0x2f')]);_0x43ddf0['filters']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],_0x43ddf0[_0x598e('0x2f')]);_0x884e0f['attributes']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],qs['fields'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x33')]));_0x884e0f[_0x598e('0x34')]=_0x884e0f[_0x598e('0x34')][_0x598e('0x35')]?_0x884e0f[_0x598e('0x34')]:_0x43ddf0['model'];if(!_0xc81d68[_0x598e('0x2f')][_0x598e('0x36')](_0x598e('0x37'))){_0x884e0f['limit']=qs['limit'](_0xc81d68[_0x598e('0x2f')]['limit']);_0x884e0f[_0x598e('0x18')]=qs[_0x598e('0x18')](_0xc81d68['query']['offset']);}_0x884e0f[_0x598e('0x38')]=qs['sort'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x39')]);_0x884e0f[_0x598e('0x3a')]=qs['filters'](_[_0x598e('0x3b')](_0xc81d68['query'],_0x43ddf0['filters']),_0x4fad2d);if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]){_0x884e0f['where']=_['merge'](_0x884e0f[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x4fad2d,function(_0x5254e5){if(_0x5254e5[_0x598e('0x2c')]!==_0x598e('0x3d')){var _0x38142c={};_0x38142c[_0x5254e5[_0x598e('0x27')]]={'$like':'%'+_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]+'%'};return _0x38142c;}})});}_0x884e0f=_[_0x598e('0x3e')]({},_0x884e0f,_0xc81d68['options']);var _0x3ee264={'where':_0x884e0f[_0x598e('0x3a')]};return db[_0x598e('0x29')][_0x598e('0x1b')](_0x3ee264)[_0x598e('0x23')](function(_0x25af45){_0x5ecac3[_0x598e('0x1b')]=_0x25af45;if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3f')]){_0x884e0f[_0x598e('0x40')]=[{'all':!![]}];}return db[_0x598e('0x29')][_0x598e('0x41')](_0x884e0f);})[_0x598e('0x23')](function(_0x5633c9){_0x5ecac3['rows']=_0x5633c9;return _0x5ecac3;})[_0x598e('0x23')](respondWithFilteredResult(_0x158681,_0x884e0f))[_0x598e('0x42')](handleError(_0x158681,null));};exports[_0x598e('0x43')]=function(_0x3c7828,_0x4d3273){var _0x3799c7={'raw':![],'where':{'id':_0x3c7828[_0x598e('0x44')]['id']}},_0x22f24b={};_0x22f24b['model']=_[_0x598e('0x30')](db[_0x598e('0x29')][_0x598e('0x2a')]);_0x22f24b[_0x598e('0x2f')]=_[_0x598e('0x30')](_0x3c7828[_0x598e('0x2f')]);_0x22f24b[_0x598e('0x45')]=_[_0x598e('0x31')](_0x22f24b[_0x598e('0x32')],_0x22f24b[_0x598e('0x2f')]);_0x3799c7[_0x598e('0x34')]=_['intersection'](_0x22f24b['model'],qs['fields'](_0x3c7828[_0x598e('0x2f')][_0x598e('0x33')]));_0x3799c7[_0x598e('0x34')]=_0x3799c7['attributes'][_0x598e('0x35')]?_0x3799c7[_0x598e('0x34')]:_0x22f24b[_0x598e('0x32')];if(_0x3c7828['query'][_0x598e('0x3f')]){_0x3799c7[_0x598e('0x40')]=[{'all':!![]}];}_0x3799c7=_[_0x598e('0x3e')]({},_0x3799c7,_0x3c7828['options']);return db[_0x598e('0x29')][_0x598e('0x46')](_0x3799c7)[_0x598e('0x23')](handleEntityNotFound(_0x4d3273,null))[_0x598e('0x23')](respondWithResult(_0x4d3273,null))[_0x598e('0x42')](handleError(_0x4d3273,null));};exports[_0x598e('0x47')]=function(_0x5ec8d8,_0x2c7c8f){return db[_0x598e('0x29')]['create'](_0x5ec8d8[_0x598e('0x48')],{})[_0x598e('0x23')](respondWithResult(_0x2c7c8f,0xc9))[_0x598e('0x42')](handleError(_0x2c7c8f,null));};exports['update']=function(_0x59e67b,_0x57b11a){if(_0x59e67b[_0x598e('0x48')]['id']){delete _0x59e67b[_0x598e('0x48')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x59e67b[_0x598e('0x44')]['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x57b11a,null))['then'](saveUpdates(_0x59e67b['body'],null))[_0x598e('0x23')](respondWithResult(_0x57b11a,null))[_0x598e('0x42')](handleError(_0x57b11a,null));};exports[_0x598e('0x22')]=function(_0x34a43d,_0x5cbe61){return db['VtigerConfiguration'][_0x598e('0x46')]({'where':{'id':_0x34a43d['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x5cbe61,null))['then'](removeEntity(_0x5cbe61,null))[_0x598e('0x42')](handleError(_0x5cbe61,null));};exports[_0x598e('0x49')]=function(_0x16105d,_0x46d71f,_0x40eb24){var _0x23782a={};var _0x2532fc={};var _0x5b06b5;var _0x4539f9;return db[_0x598e('0x29')][_0x598e('0x4a')]({'where':{'id':_0x16105d[_0x598e('0x44')]['id']}})['then'](handleEntityNotFound(_0x46d71f,null))[_0x598e('0x23')](function(_0x36fc15){if(_0x36fc15){_0x5b06b5=_0x36fc15;_0x2532fc[_0x598e('0x32')]=_[_0x598e('0x30')](db[_0x598e('0x4b')][_0x598e('0x2a')]);_0x2532fc[_0x598e('0x2f')]=_['keys'](_0x16105d[_0x598e('0x2f')]);_0x2532fc[_0x598e('0x45')]=_[_0x598e('0x31')](_0x2532fc[_0x598e('0x32')],_0x2532fc['query']);_0x23782a[_0x598e('0x34')]=_['intersection'](_0x2532fc['model'],qs[_0x598e('0x33')](_0x16105d[_0x598e('0x2f')][_0x598e('0x33')]));_0x23782a[_0x598e('0x34')]=_0x23782a[_0x598e('0x34')][_0x598e('0x35')]?_0x23782a[_0x598e('0x34')]:_0x2532fc[_0x598e('0x32')];_0x23782a[_0x598e('0x38')]=qs[_0x598e('0x39')](_0x16105d['query']['sort']);_0x23782a[_0x598e('0x3a')]=qs[_0x598e('0x45')](_[_0x598e('0x3b')](_0x16105d[_0x598e('0x2f')],_0x2532fc[_0x598e('0x45')]));if(_0x16105d[_0x598e('0x2f')][_0x598e('0x3c')]){_0x23782a[_0x598e('0x3a')]=_[_0x598e('0x3e')](_0x23782a['where'],{'$or':_['map'](_0x23782a[_0x598e('0x34')],function(_0xa4ff6a){var _0x14d98b={};_0x14d98b[_0xa4ff6a]={'$like':'%'+_0x16105d['query'][_0x598e('0x3c')]+'%'};return _0x14d98b;})});}_0x23782a=_[_0x598e('0x3e')]({},_0x23782a,_0x16105d[_0x598e('0x4c')]);return _0x5b06b5[_0x598e('0x49')](_0x23782a);}})['then'](function(_0x52bf2d){if(_0x52bf2d){_0x4539f9=_0x52bf2d['length'];if(!_0x16105d[_0x598e('0x2f')]['hasOwnProperty'](_0x598e('0x37'))){_0x23782a[_0x598e('0x19')]=qs[_0x598e('0x19')](_0x16105d[_0x598e('0x2f')][_0x598e('0x19')]);_0x23782a[_0x598e('0x18')]=qs[_0x598e('0x18')](_0x16105d['query'][_0x598e('0x18')]);}return _0x5b06b5['getFields'](_0x23782a);}})[_0x598e('0x23')](function(_0x4c2f61){if(_0x4c2f61){return _0x4c2f61?{'count':_0x4539f9,'rows':_0x4c2f61}:null;}})[_0x598e('0x23')](respondWithResult(_0x46d71f,null))[_0x598e('0x42')](handleError(_0x46d71f,null));};exports[_0x598e('0x4d')]=function(_0x400fea,_0x21dfcd,_0x467d10){var _0x14f6cc={};var _0x1a1673={};var _0x25933e;var _0x1893e;return db[_0x598e('0x29')]['findOne']({'where':{'id':_0x400fea['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x21dfcd,null))['then'](function(_0x98649a){if(_0x98649a){_0x25933e=_0x98649a;_0x1a1673[_0x598e('0x32')]=_['keys'](db['VtigerField'][_0x598e('0x2a')]);_0x1a1673['query']=_[_0x598e('0x30')](_0x400fea[_0x598e('0x2f')]);_0x1a1673[_0x598e('0x45')]=_[_0x598e('0x31')](_0x1a1673[_0x598e('0x32')],_0x1a1673['query']);_0x14f6cc[_0x598e('0x34')]=_['intersection'](_0x1a1673[_0x598e('0x32')],qs['fields'](_0x400fea[_0x598e('0x2f')]['fields']));_0x14f6cc['attributes']=_0x14f6cc[_0x598e('0x34')][_0x598e('0x35')]?_0x14f6cc[_0x598e('0x34')]:_0x1a1673[_0x598e('0x32')];_0x14f6cc[_0x598e('0x38')]=qs['sort'](_0x400fea[_0x598e('0x2f')][_0x598e('0x39')]);_0x14f6cc['where']=qs[_0x598e('0x45')](_[_0x598e('0x3b')](_0x400fea[_0x598e('0x2f')],_0x1a1673[_0x598e('0x45')]));if(_0x400fea[_0x598e('0x2f')]['filter']){_0x14f6cc['where']=_['merge'](_0x14f6cc[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x14f6cc[_0x598e('0x34')],function(_0x51c5f2){var _0xd9a61={};_0xd9a61[_0x51c5f2]={'$like':'%'+_0x400fea['query'][_0x598e('0x3c')]+'%'};return _0xd9a61;})});}_0x14f6cc=_[_0x598e('0x3e')]({},_0x14f6cc,_0x400fea[_0x598e('0x4c')]);return _0x25933e[_0x598e('0x4d')](_0x14f6cc);}})[_0x598e('0x23')](function(_0x155775){if(_0x155775){_0x1893e=_0x155775['length'];if(!_0x400fea['query'][_0x598e('0x36')]('nolimit')){_0x14f6cc[_0x598e('0x19')]=qs[_0x598e('0x19')](_0x400fea[_0x598e('0x2f')][_0x598e('0x19')]);_0x14f6cc[_0x598e('0x18')]=qs[_0x598e('0x18')](_0x400fea['query'][_0x598e('0x18')]);}return _0x25933e[_0x598e('0x4d')](_0x14f6cc);}})['then'](function(_0x29f2d9){if(_0x29f2d9){return _0x29f2d9?{'count':_0x1893e,'rows':_0x29f2d9}:null;}})[_0x598e('0x23')](respondWithResult(_0x21dfcd,null))['catch'](handleError(_0x21dfcd,null));};exports[_0x598e('0x4e')]=function(_0x5d89a3,_0xeb7d05,_0x375943){var _0x33a308={};var _0x736281={};var _0x267f18;var _0x31da9b;return db['VtigerConfiguration'][_0x598e('0x4a')]({'where':{'id':_0x5d89a3['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0xeb7d05,null))['then'](function(_0x227092){if(_0x227092){_0x267f18=_0x227092;_0x736281[_0x598e('0x32')]=_[_0x598e('0x30')](db[_0x598e('0x4b')][_0x598e('0x2a')]);_0x736281['query']=_['keys'](_0x5d89a3[_0x598e('0x2f')]);_0x736281[_0x598e('0x45')]=_[_0x598e('0x31')](_0x736281[_0x598e('0x32')],_0x736281[_0x598e('0x2f')]);_0x33a308['attributes']=_[_0x598e('0x31')](_0x736281['model'],qs[_0x598e('0x33')](_0x5d89a3[_0x598e('0x2f')][_0x598e('0x33')]));_0x33a308[_0x598e('0x34')]=_0x33a308['attributes'][_0x598e('0x35')]?_0x33a308['attributes']:_0x736281[_0x598e('0x32')];_0x33a308[_0x598e('0x38')]=qs['sort'](_0x5d89a3[_0x598e('0x2f')][_0x598e('0x39')]);_0x33a308['where']=qs['filters'](_['pick'](_0x5d89a3['query'],_0x736281[_0x598e('0x45')]));if(_0x5d89a3[_0x598e('0x2f')]['filter']){_0x33a308[_0x598e('0x3a')]=_[_0x598e('0x3e')](_0x33a308['where'],{'$or':_[_0x598e('0x2e')](_0x33a308[_0x598e('0x34')],function(_0x24440e){var _0x18cad9={};_0x18cad9[_0x24440e]={'$like':'%'+_0x5d89a3[_0x598e('0x2f')]['filter']+'%'};return _0x18cad9;})});}_0x33a308=_[_0x598e('0x3e')]({},_0x33a308,_0x5d89a3[_0x598e('0x4c')]);return _0x267f18[_0x598e('0x4e')](_0x33a308);}})[_0x598e('0x23')](function(_0x37fde4){if(_0x37fde4){_0x31da9b=_0x37fde4[_0x598e('0x35')];if(!_0x5d89a3['query'][_0x598e('0x36')](_0x598e('0x37'))){_0x33a308[_0x598e('0x19')]=qs['limit'](_0x5d89a3['query'][_0x598e('0x19')]);_0x33a308['offset']=qs[_0x598e('0x18')](_0x5d89a3['query']['offset']);}return _0x267f18[_0x598e('0x4e')](_0x33a308);}})[_0x598e('0x23')](function(_0x1d7774){if(_0x1d7774){return _0x1d7774?{'count':_0x31da9b,'rows':_0x1d7774}:null;}})['then'](respondWithResult(_0xeb7d05,null))[_0x598e('0x42')](handleError(_0xeb7d05,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b35211c..0acfdaa 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 _0xcf97=['util','api','path','rimraf','../../config/environment','exports','define','int_vtiger_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf97,0x7d));var _0x7cf9=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xcf97[_0x176329];return _0x31997c;};'use strict';var _=require(_0x7cf9('0x0'));var util=require(_0x7cf9('0x1'));var logger=require('../../config/logger')(_0x7cf9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf9('0x3'));var rimraf=require(_0x7cf9('0x4'));var config=require(_0x7cf9('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7cf9('0x6')]=function(_0x6bfc3,_0x5b94cd){return _0x6bfc3[_0x7cf9('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x7cf9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc546=['../../config/environment','exports','VtigerConfiguration','lodash','util','api','request-promise','path','rimraf'];(function(_0x3f73ba,_0x43f4b6){var _0x5ec10d=function(_0x2be5ca){while(--_0x2be5ca){_0x3f73ba['push'](_0x3f73ba['shift']());}};_0x5ec10d(++_0x43f4b6);}(_0xc546,0x198));var _0x6c54=function(_0xe20f52,_0x3515e2){_0xe20f52=_0xe20f52-0x0;var _0x372d78=_0xc546[_0xe20f52];return _0x372d78;};'use strict';var _=require(_0x6c54('0x0'));var util=require(_0x6c54('0x1'));var logger=require('../../config/logger')(_0x6c54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c54('0x3'));var fs=require('fs');var path=require(_0x6c54('0x4'));var rimraf=require(_0x6c54('0x5'));var config=require(_0x6c54('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6c54('0x7')]=function(_0x289a8f,_0xdf75d6){return _0x289a8f['define'](_0x6c54('0x8'),attributes,{'tableName':'int_vtiger_configurations','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 d0900e3..cee27ac 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 _0x0716=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1710ad,_0x5d36bb){var _0x21dc6d=function(_0x27c724){while(--_0x27c724){_0x1710ad['push'](_0x1710ad['shift']());}};_0x21dc6d(++_0x5d36bb);}(_0x0716,0x16a));var _0x6071=function(_0x52ddc8,_0xada5d6){_0x52ddc8=_0x52ddc8-0x0;var _0x41e9c3=_0x0716[_0x52ddc8];return _0x41e9c3;};'use strict';var _=require(_0x6071('0x0'));var util=require(_0x6071('0x1'));var moment=require(_0x6071('0x2'));var BPromise=require('bluebird');var rs=require(_0x6071('0x3'));var fs=require('fs');var Redis=require(_0x6071('0x4'));var db=require(_0x6071('0x5'))['db'];var utils=require(_0x6071('0x6'));var logger=require('../../config/logger')(_0x6071('0x7'));var config=require('../../config/environment');var jayson=require(_0x6071('0x8'));var client=jayson[_0x6071('0x9')][_0x6071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14a8e6,_0x11ef23,_0x1999c6){return new BPromise(function(_0x36b901,_0x294a56){return client[_0x6071('0xb')](_0x14a8e6,_0x1999c6)[_0x6071('0xc')](function(_0x2c9b52){logger[_0x6071('0xd')](_0x6071('0xe'),_0x11ef23,_0x6071('0xf'));logger['debug'](_0x6071('0x10'),_0x11ef23,_0x6071('0xf'),JSON['stringify'](_0x2c9b52));if(_0x2c9b52[_0x6071('0x11')]){if(_0x2c9b52[_0x6071('0x11')][_0x6071('0x12')]===0x1f4){logger[_0x6071('0x11')](_0x6071('0xe'),_0x11ef23,_0x2c9b52[_0x6071('0x11')]['message']);return _0x294a56(_0x2c9b52['error'][_0x6071('0x13')]);}logger['error'](_0x6071('0xe'),_0x11ef23,_0x2c9b52['error']['message']);return _0x36b901(_0x2c9b52['error'][_0x6071('0x13')]);}else{logger[_0x6071('0xd')](_0x6071('0xe'),_0x11ef23,_0x6071('0xf'));_0x36b901(_0x2c9b52['result'][_0x6071('0x13')]);}})[_0x6071('0x14')](function(_0x25150a){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x11ef23,_0x25150a);_0x294a56(_0x25150a);});});} \ No newline at end of file +var _0xdf59=['VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0xdf59,0xec));var _0x9df5=function(_0x451a50,_0xaaed7d){_0x451a50=_0x451a50-0x0;var _0x442d5e=_0xdf59[_0x451a50];return _0x442d5e;};'use strict';var _=require('lodash');var util=require(_0x9df5('0x0'));var moment=require(_0x9df5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9df5('0x2'));var db=require(_0x9df5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9df5('0x4'))(_0x9df5('0x5'));var config=require(_0x9df5('0x6'));var jayson=require(_0x9df5('0x7'));var client=jayson[_0x9df5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154437,_0xb5bb57,_0x467c31){return new BPromise(function(_0xf2816a,_0x2a0298){return client['request'](_0x154437,_0x467c31)[_0x9df5('0x9')](function(_0x54ff85){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xb5bb57,_0x9df5('0xa'));logger[_0x9df5('0xb')](_0x9df5('0xc'),_0xb5bb57,_0x9df5('0xa'),JSON[_0x9df5('0xd')](_0x54ff85));if(_0x54ff85[_0x9df5('0xe')]){if(_0x54ff85[_0x9df5('0xe')][_0x9df5('0xf')]===0x1f4){logger[_0x9df5('0xe')](_0x9df5('0x10'),_0xb5bb57,_0x54ff85['error']['message']);return _0x2a0298(_0x54ff85[_0x9df5('0xe')][_0x9df5('0x11')]);}logger[_0x9df5('0xe')](_0x9df5('0x10'),_0xb5bb57,_0x54ff85[_0x9df5('0xe')][_0x9df5('0x11')]);return _0xf2816a(_0x54ff85[_0x9df5('0xe')][_0x9df5('0x11')]);}else{logger[_0x9df5('0x12')](_0x9df5('0x10'),_0xb5bb57,_0x9df5('0xa'));_0xf2816a(_0x54ff85[_0x9df5('0x13')]['message']);}})[_0x9df5('0x14')](function(_0x4ede1d){logger[_0x9df5('0xe')](_0x9df5('0x10'),_0xb5bb57,_0x4ede1d);_0x2a0298(_0x4ede1d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 637a6de..6256326 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 _0x9826=['../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','post','create','put','update','/:id','exports','path','connect-timeout','express','fs-extra'];(function(_0x44db1f,_0x28676d){var _0x3a364f=function(_0x2f8a1b){while(--_0x2f8a1b){_0x44db1f['push'](_0x44db1f['shift']());}};_0x3a364f(++_0x28676d);}(_0x9826,0xf8));var _0x6982=function(_0x1251f4,_0x449224){_0x1251f4=_0x1251f4-0x0;var _0x1bcd5b=_0x9826[_0x1251f4];return _0x1bcd5b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6982('0x0'));var timeout=require(_0x6982('0x1'));var express=require(_0x6982('0x2'));var router=express['Router']();var fs_extra=require(_0x6982('0x3'));var auth=require(_0x6982('0x4'));var interaction=require(_0x6982('0x5'));var config=require('../../config/environment');var controller=require(_0x6982('0x6'));router[_0x6982('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6982('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6982('0x8')]('/',auth['isAuthenticated'](),controller[_0x6982('0x9')]);router[_0x6982('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6982('0xb')]);router['delete'](_0x6982('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6982('0xd')]=router; \ No newline at end of file +var _0x724e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x724e,0xe6));var _0xe724=function(_0x3a1a51,_0x149430){_0x3a1a51=_0x3a1a51-0x0;var _0x2ae25d=_0x724e[_0x3a1a51];return _0x2ae25d;};'use strict';var multer=require(_0xe724('0x0'));var util=require('util');var path=require(_0xe724('0x1'));var timeout=require(_0xe724('0x2'));var express=require(_0xe724('0x3'));var router=express[_0xe724('0x4')]();var fs_extra=require(_0xe724('0x5'));var auth=require(_0xe724('0x6'));var interaction=require(_0xe724('0x7'));var config=require(_0xe724('0x8'));var controller=require('./intVtigerField.controller');router[_0xe724('0x9')]('/',auth[_0xe724('0xa')](),controller[_0xe724('0xb')]);router[_0xe724('0x9')](_0xe724('0xc'),auth[_0xe724('0xa')](),controller[_0xe724('0xd')]);router[_0xe724('0xe')]('/',auth[_0xe724('0xa')](),controller[_0xe724('0xf')]);router[_0xe724('0x10')](_0xe724('0xc'),auth['isAuthenticated'](),controller[_0xe724('0x11')]);router[_0xe724('0x12')](_0xe724('0xc'),auth[_0xe724('0xa')](),controller[_0xe724('0x13')]);module[_0xe724('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 3afe4c7..1e4a161 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 _0x9d7d=['ENUM','BOOLEAN','sequelize','exports','variable','string','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9d7d,0xe9));var _0xd9d7=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x9d7d[_0x531e48];return _0x202971;};'use strict';var Sequelize=require(_0xd9d7('0x0'));module[_0xd9d7('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xd9d7('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0xd9d7('0x3')},'content':{'type':Sequelize[_0xd9d7('0x4')]},'key':{'type':Sequelize[_0xd9d7('0x4')]},'keyType':{'type':Sequelize[_0xd9d7('0x5')]('string',_0xd9d7('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd9d7('0x4')]},'nameField':{'type':Sequelize[_0xd9d7('0x4')]},'customField':{'type':Sequelize[_0xd9d7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd9d7('0x4')]}}; \ No newline at end of file +var _0x5fd2=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x44e796,_0x587609){var _0x44a08e=function(_0x13cfdb){while(--_0x13cfdb){_0x44e796['push'](_0x44e796['shift']());}};_0x44a08e(++_0x587609);}(_0x5fd2,0xdc));var _0x25fd=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5fd2[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x25fd('0x0'));module[_0x25fd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x25fd('0x2'),'variable',_0x25fd('0x3'),_0x25fd('0x4'),_0x25fd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x25fd('0x6')]},'keyType':{'type':Sequelize[_0x25fd('0x7')]('string',_0x25fd('0x8'),_0x25fd('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x25fd('0x6')]},'nameField':{'type':Sequelize[_0x25fd('0x6')]},'customField':{'type':Sequelize[_0x25fd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x25fd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ea1f10e..5a322a1 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 _0xf911=['ejs','fs-extra','lodash','squel','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x174a2d,_0x44cf92){var _0x3a58c3=function(_0x43afaf){while(--_0x43afaf){_0x174a2d['push'](_0x174a2d['shift']());}};_0x3a58c3(++_0x44cf92);}(_0xf911,0xe2));var _0x1f91=function(_0x186787,_0x4a5de2){_0x186787=_0x186787-0x0;var _0x3f5a8f=_0xf911[_0x186787];return _0x3f5a8f;};'use strict';var emlformat=require(_0x1f91('0x0'));var rimraf=require(_0x1f91('0x1'));var zipdir=require(_0x1f91('0x2'));var jsonpatch=require(_0x1f91('0x3'));var rp=require(_0x1f91('0x4'));var moment=require(_0x1f91('0x5'));var BPromise=require(_0x1f91('0x6'));var Mustache=require(_0x1f91('0x7'));var util=require('util');var path=require(_0x1f91('0x8'));var sox=require(_0x1f91('0x9'));var csv=require(_0x1f91('0xa'));var ejs=require(_0x1f91('0xb'));var fs=require('fs');var fs_extra=require(_0x1f91('0xc'));var _=require(_0x1f91('0xd'));var squel=require(_0x1f91('0xe'));var crypto=require('crypto');var jsforce=require(_0x1f91('0xf'));var deskjs=require(_0x1f91('0x10'));var toCsv=require(_0x1f91('0xa'));var querystring=require(_0x1f91('0x11'));var Papa=require(_0x1f91('0x12'));var Redis=require(_0x1f91('0x13'));var authService=require(_0x1f91('0x14'));var qs=require(_0x1f91('0x15'));var as=require(_0x1f91('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f91('0x17'))(_0x1f91('0x18'));var utils=require(_0x1f91('0x19'));var config=require(_0x1f91('0x1a'));var licenseUtil=require(_0x1f91('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb538a7,_0xf38020){_0xf38020=_0xf38020||0xcc;return function(_0x1c9de4){if(_0x1c9de4){return _0xb538a7['sendStatus'](_0xf38020);}return _0xb538a7['status'](_0xf38020)[_0x1f91('0x1c')]();};}function respondWithResult(_0x58100c,_0x4a93f1){_0x4a93f1=_0x4a93f1||0xc8;return function(_0x562870){if(_0x562870){return _0x58100c[_0x1f91('0x1d')](_0x4a93f1)[_0x1f91('0x1e')](_0x562870);}};}function respondWithFilteredResult(_0x48b387,_0x39b34e){return function(_0x4e575e){if(_0x4e575e){var _0x26bbe0=typeof _0x39b34e[_0x1f91('0x1f')]===_0x1f91('0x20')&&typeof _0x39b34e[_0x1f91('0x21')]===_0x1f91('0x20');var _0x5ccfc7=_0x4e575e['count'];var _0x19f408=_0x26bbe0?0x0:_0x39b34e[_0x1f91('0x1f')];var _0x422c99=_0x26bbe0?_0x4e575e[_0x1f91('0x22')]:_0x39b34e[_0x1f91('0x1f')]+_0x39b34e[_0x1f91('0x21')];var _0x430675;if(_0x422c99>=_0x5ccfc7){_0x422c99=_0x5ccfc7;_0x430675=0xc8;}else{_0x430675=0xce;}_0x48b387[_0x1f91('0x1d')](_0x430675);return _0x48b387[_0x1f91('0x23')](_0x1f91('0x24'),_0x19f408+'-'+_0x422c99+'/'+_0x5ccfc7)['json'](_0x4e575e);}return null;};}function patchUpdates(_0x512c00){return function(_0x43353f){try{jsonpatch[_0x1f91('0x25')](_0x43353f,_0x512c00,!![]);}catch(_0x4b66d3){return BPromise[_0x1f91('0x26')](_0x4b66d3);}return _0x43353f[_0x1f91('0x27')]();};}function saveUpdates(_0x10ec47,_0x49f246){return function(_0x3e2c60){if(_0x3e2c60){return _0x3e2c60['update'](_0x10ec47)[_0x1f91('0x28')](function(_0xfe7869){return _0xfe7869;});}return null;};}function removeEntity(_0x12edd5,_0x1ba914){return function(_0x2e3e5){if(_0x2e3e5){return _0x2e3e5[_0x1f91('0x29')]()[_0x1f91('0x28')](function(){_0x12edd5[_0x1f91('0x1d')](0xcc)[_0x1f91('0x1c')]();});}};}function handleEntityNotFound(_0x575886,_0x49e4e9){return function(_0x3dcddc){if(!_0x3dcddc){_0x575886[_0x1f91('0x2a')](0x194);}return _0x3dcddc;};}function handleError(_0x2c198c,_0x3b80c1){_0x3b80c1=_0x3b80c1||0x1f4;return function(_0x229c8c){logger['error'](_0x229c8c[_0x1f91('0x2b')]);if(_0x229c8c[_0x1f91('0x2c')]){delete _0x229c8c[_0x1f91('0x2c')];}_0x2c198c['status'](_0x3b80c1)[_0x1f91('0x2d')](_0x229c8c);};}exports['index']=function(_0x189d90,_0x4e4552){var _0x483b3f={},_0x838277={},_0xcb72af={'count':0x0,'rows':[]};var _0x28eb04=_[_0x1f91('0x2e')](db[_0x1f91('0x2f')][_0x1f91('0x30')],function(_0x19ce52){return{'name':_0x19ce52[_0x1f91('0x31')],'type':_0x19ce52[_0x1f91('0x32')][_0x1f91('0x33')]};});_0x838277['model']=_[_0x1f91('0x2e')](_0x28eb04,_0x1f91('0x2c'));_0x838277[_0x1f91('0x34')]=_['keys'](_0x189d90[_0x1f91('0x34')]);_0x838277[_0x1f91('0x35')]=_['intersection'](_0x838277['model'],_0x838277[_0x1f91('0x34')]);_0x483b3f[_0x1f91('0x36')]=_[_0x1f91('0x37')](_0x838277[_0x1f91('0x38')],qs[_0x1f91('0x39')](_0x189d90[_0x1f91('0x34')][_0x1f91('0x39')]));_0x483b3f['attributes']=_0x483b3f[_0x1f91('0x36')][_0x1f91('0x3a')]?_0x483b3f[_0x1f91('0x36')]:_0x838277[_0x1f91('0x38')];if(!_0x189d90[_0x1f91('0x34')][_0x1f91('0x3b')](_0x1f91('0x3c'))){_0x483b3f[_0x1f91('0x21')]=qs[_0x1f91('0x21')](_0x189d90[_0x1f91('0x34')]['limit']);_0x483b3f[_0x1f91('0x1f')]=qs['offset'](_0x189d90[_0x1f91('0x34')]['offset']);}_0x483b3f[_0x1f91('0x3d')]=qs[_0x1f91('0x3e')](_0x189d90[_0x1f91('0x34')][_0x1f91('0x3e')]);_0x483b3f[_0x1f91('0x3f')]=qs[_0x1f91('0x35')](_['pick'](_0x189d90[_0x1f91('0x34')],_0x838277[_0x1f91('0x35')]),_0x28eb04);if(_0x189d90[_0x1f91('0x34')][_0x1f91('0x40')]){_0x483b3f[_0x1f91('0x3f')]=_[_0x1f91('0x41')](_0x483b3f['where'],{'$or':_['map'](_0x28eb04,function(_0x4628e3){if(_0x4628e3[_0x1f91('0x32')]!==_0x1f91('0x42')){var _0x330bd4={};_0x330bd4[_0x4628e3[_0x1f91('0x2c')]]={'$like':'%'+_0x189d90[_0x1f91('0x34')][_0x1f91('0x40')]+'%'};return _0x330bd4;}})});}_0x483b3f=_[_0x1f91('0x41')]({},_0x483b3f,_0x189d90[_0x1f91('0x43')]);var _0x28c0c9={'where':_0x483b3f['where']};return db[_0x1f91('0x2f')]['count'](_0x28c0c9)[_0x1f91('0x28')](function(_0x124c0e){_0xcb72af[_0x1f91('0x22')]=_0x124c0e;if(_0x189d90[_0x1f91('0x34')][_0x1f91('0x44')]){_0x483b3f[_0x1f91('0x45')]=[{'all':!![]}];}return db[_0x1f91('0x2f')][_0x1f91('0x46')](_0x483b3f);})[_0x1f91('0x28')](function(_0x365c9e){_0xcb72af[_0x1f91('0x47')]=_0x365c9e;return _0xcb72af;})[_0x1f91('0x28')](respondWithFilteredResult(_0x4e4552,_0x483b3f))[_0x1f91('0x48')](handleError(_0x4e4552,null));};exports[_0x1f91('0x49')]=function(_0x16e1c8,_0x480bf9){var _0x4c8c16={'raw':!![],'where':{'id':_0x16e1c8[_0x1f91('0x4a')]['id']}},_0x15400c={};_0x15400c['model']=_[_0x1f91('0x4b')](db[_0x1f91('0x2f')][_0x1f91('0x30')]);_0x15400c['query']=_[_0x1f91('0x4b')](_0x16e1c8[_0x1f91('0x34')]);_0x15400c['filters']=_['intersection'](_0x15400c[_0x1f91('0x38')],_0x15400c[_0x1f91('0x34')]);_0x4c8c16['attributes']=_[_0x1f91('0x37')](_0x15400c[_0x1f91('0x38')],qs[_0x1f91('0x39')](_0x16e1c8[_0x1f91('0x34')][_0x1f91('0x39')]));_0x4c8c16[_0x1f91('0x36')]=_0x4c8c16[_0x1f91('0x36')][_0x1f91('0x3a')]?_0x4c8c16[_0x1f91('0x36')]:_0x15400c['model'];if(_0x16e1c8['query'][_0x1f91('0x44')]){_0x4c8c16['include']=[{'all':!![]}];}_0x4c8c16=_[_0x1f91('0x41')]({},_0x4c8c16,_0x16e1c8['options']);return db['VtigerField'][_0x1f91('0x4c')](_0x4c8c16)[_0x1f91('0x28')](handleEntityNotFound(_0x480bf9,null))[_0x1f91('0x28')](respondWithResult(_0x480bf9,null))[_0x1f91('0x48')](handleError(_0x480bf9,null));};exports['create']=function(_0x3f1485,_0x291525){return db['VtigerField']['create'](_0x3f1485['body'],{})[_0x1f91('0x28')](respondWithResult(_0x291525,0xc9))[_0x1f91('0x48')](handleError(_0x291525,null));};exports[_0x1f91('0x4d')]=function(_0x105cd2,_0x2f8bb3){if(_0x105cd2[_0x1f91('0x4e')]['id']){delete _0x105cd2[_0x1f91('0x4e')]['id'];}return db[_0x1f91('0x2f')]['find']({'where':{'id':_0x105cd2[_0x1f91('0x4a')]['id']}})[_0x1f91('0x28')](handleEntityNotFound(_0x2f8bb3,null))[_0x1f91('0x28')](saveUpdates(_0x105cd2[_0x1f91('0x4e')],null))['then'](respondWithResult(_0x2f8bb3,null))[_0x1f91('0x48')](handleError(_0x2f8bb3,null));};exports[_0x1f91('0x29')]=function(_0x427a13,_0x2bac17){return db['VtigerField']['find']({'where':{'id':_0x427a13['params']['id']}})['then'](handleEntityNotFound(_0x2bac17,null))['then'](removeEntity(_0x2bac17,null))[_0x1f91('0x48')](handleError(_0x2bac17,null));}; \ No newline at end of file +var _0xd8fd=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','update','eml-format','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','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0xd8fd,0x107));var _0xdd8f=function(_0x23521f,_0x661e98){_0x23521f=_0x23521f-0x0;var _0x3db7ff=_0xd8fd[_0x23521f];return _0x3db7ff;};'use strict';var emlformat=require(_0xdd8f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd8f('0x1'));var rp=require(_0xdd8f('0x2'));var moment=require(_0xdd8f('0x3'));var BPromise=require(_0xdd8f('0x4'));var Mustache=require(_0xdd8f('0x5'));var util=require(_0xdd8f('0x6'));var path=require(_0xdd8f('0x7'));var sox=require(_0xdd8f('0x8'));var csv=require('to-csv');var ejs=require(_0xdd8f('0x9'));var fs=require('fs');var fs_extra=require(_0xdd8f('0xa'));var _=require(_0xdd8f('0xb'));var squel=require(_0xdd8f('0xc'));var crypto=require(_0xdd8f('0xd'));var jsforce=require(_0xdd8f('0xe'));var deskjs=require(_0xdd8f('0xf'));var toCsv=require(_0xdd8f('0x10'));var querystring=require(_0xdd8f('0x11'));var Papa=require(_0xdd8f('0x12'));var Redis=require(_0xdd8f('0x13'));var authService=require(_0xdd8f('0x14'));var qs=require(_0xdd8f('0x15'));var as=require(_0xdd8f('0x16'));var hardwareService=require(_0xdd8f('0x17'));var logger=require(_0xdd8f('0x18'))(_0xdd8f('0x19'));var utils=require(_0xdd8f('0x1a'));var config=require(_0xdd8f('0x1b'));var licenseUtil=require(_0xdd8f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56e81c,_0x5a70eb){_0x5a70eb=_0x5a70eb||0xcc;return function(_0x54ee60){if(_0x54ee60){return _0x56e81c[_0xdd8f('0x1d')](_0x5a70eb);}return _0x56e81c[_0xdd8f('0x1e')](_0x5a70eb)[_0xdd8f('0x1f')]();};}function respondWithResult(_0x24f9f9,_0x3b78e5){_0x3b78e5=_0x3b78e5||0xc8;return function(_0x12ecea){if(_0x12ecea){return _0x24f9f9[_0xdd8f('0x1e')](_0x3b78e5)['json'](_0x12ecea);}};}function respondWithFilteredResult(_0xfb0a94,_0x3d7991){return function(_0x40f79b){if(_0x40f79b){var _0x1f4a3b=typeof _0x3d7991[_0xdd8f('0x20')]===_0xdd8f('0x21')&&typeof _0x3d7991['limit']===_0xdd8f('0x21');var _0x73a949=_0x40f79b[_0xdd8f('0x22')];var _0x6838d0=_0x1f4a3b?0x0:_0x3d7991[_0xdd8f('0x20')];var _0x427308=_0x1f4a3b?_0x40f79b['count']:_0x3d7991[_0xdd8f('0x20')]+_0x3d7991[_0xdd8f('0x23')];var _0x5b70b3;if(_0x427308>=_0x73a949){_0x427308=_0x73a949;_0x5b70b3=0xc8;}else{_0x5b70b3=0xce;}_0xfb0a94[_0xdd8f('0x1e')](_0x5b70b3);return _0xfb0a94[_0xdd8f('0x24')](_0xdd8f('0x25'),_0x6838d0+'-'+_0x427308+'/'+_0x73a949)[_0xdd8f('0x26')](_0x40f79b);}return null;};}function patchUpdates(_0x19ee78){return function(_0x1ad6f5){try{jsonpatch[_0xdd8f('0x27')](_0x1ad6f5,_0x19ee78,!![]);}catch(_0x36c4b3){return BPromise[_0xdd8f('0x28')](_0x36c4b3);}return _0x1ad6f5[_0xdd8f('0x29')]();};}function saveUpdates(_0x16bef5,_0x3123d4){return function(_0x40f8a9){if(_0x40f8a9){return _0x40f8a9['update'](_0x16bef5)[_0xdd8f('0x2a')](function(_0x548a8c){return _0x548a8c;});}return null;};}function removeEntity(_0x1d3274,_0x306d7e){return function(_0x48ea34){if(_0x48ea34){return _0x48ea34[_0xdd8f('0x2b')]()[_0xdd8f('0x2a')](function(){_0x1d3274['status'](0xcc)[_0xdd8f('0x1f')]();});}};}function handleEntityNotFound(_0x306745,_0x56e2bd){return function(_0x3db412){if(!_0x3db412){_0x306745['sendStatus'](0x194);}return _0x3db412;};}function handleError(_0x5b3caa,_0x346e47){_0x346e47=_0x346e47||0x1f4;return function(_0x335f05){logger[_0xdd8f('0x2c')](_0x335f05[_0xdd8f('0x2d')]);if(_0x335f05[_0xdd8f('0x2e')]){delete _0x335f05['name'];}_0x5b3caa['status'](_0x346e47)['send'](_0x335f05);};}exports[_0xdd8f('0x2f')]=function(_0x4f897a,_0x407356){var _0x5c54c2={},_0x31d26c={},_0x44e27c={'count':0x0,'rows':[]};var _0x34b311=_['map'](db[_0xdd8f('0x30')][_0xdd8f('0x31')],function(_0x595d54){return{'name':_0x595d54[_0xdd8f('0x32')],'type':_0x595d54[_0xdd8f('0x33')][_0xdd8f('0x34')]};});_0x31d26c[_0xdd8f('0x35')]=_[_0xdd8f('0x36')](_0x34b311,_0xdd8f('0x2e'));_0x31d26c['query']=_[_0xdd8f('0x37')](_0x4f897a[_0xdd8f('0x38')]);_0x31d26c[_0xdd8f('0x39')]=_['intersection'](_0x31d26c[_0xdd8f('0x35')],_0x31d26c['query']);_0x5c54c2['attributes']=_[_0xdd8f('0x3a')](_0x31d26c[_0xdd8f('0x35')],qs[_0xdd8f('0x3b')](_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x3b')]));_0x5c54c2[_0xdd8f('0x3c')]=_0x5c54c2[_0xdd8f('0x3c')][_0xdd8f('0x3d')]?_0x5c54c2[_0xdd8f('0x3c')]:_0x31d26c['model'];if(!_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x3e')](_0xdd8f('0x3f'))){_0x5c54c2[_0xdd8f('0x23')]=qs[_0xdd8f('0x23')](_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x23')]);_0x5c54c2[_0xdd8f('0x20')]=qs[_0xdd8f('0x20')](_0x4f897a['query'][_0xdd8f('0x20')]);}_0x5c54c2['order']=qs[_0xdd8f('0x40')](_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x40')]);_0x5c54c2[_0xdd8f('0x41')]=qs[_0xdd8f('0x39')](_[_0xdd8f('0x42')](_0x4f897a[_0xdd8f('0x38')],_0x31d26c[_0xdd8f('0x39')]),_0x34b311);if(_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x43')]){_0x5c54c2[_0xdd8f('0x41')]=_[_0xdd8f('0x44')](_0x5c54c2[_0xdd8f('0x41')],{'$or':_['map'](_0x34b311,function(_0x45ae35){if(_0x45ae35['type']!==_0xdd8f('0x45')){var _0x59ab56={};_0x59ab56[_0x45ae35['name']]={'$like':'%'+_0x4f897a[_0xdd8f('0x38')][_0xdd8f('0x43')]+'%'};return _0x59ab56;}})});}_0x5c54c2=_[_0xdd8f('0x44')]({},_0x5c54c2,_0x4f897a[_0xdd8f('0x46')]);var _0x28e0d8={'where':_0x5c54c2[_0xdd8f('0x41')]};return db[_0xdd8f('0x30')][_0xdd8f('0x22')](_0x28e0d8)[_0xdd8f('0x2a')](function(_0x3f27de){_0x44e27c['count']=_0x3f27de;if(_0x4f897a[_0xdd8f('0x38')]['includeAll']){_0x5c54c2[_0xdd8f('0x47')]=[{'all':!![]}];}return db['VtigerField'][_0xdd8f('0x48')](_0x5c54c2);})['then'](function(_0x458da2){_0x44e27c[_0xdd8f('0x49')]=_0x458da2;return _0x44e27c;})[_0xdd8f('0x2a')](respondWithFilteredResult(_0x407356,_0x5c54c2))['catch'](handleError(_0x407356,null));};exports[_0xdd8f('0x4a')]=function(_0x4dd900,_0xa01052){var _0x4a52e7={'raw':!![],'where':{'id':_0x4dd900[_0xdd8f('0x4b')]['id']}},_0x4863b8={};_0x4863b8[_0xdd8f('0x35')]=_[_0xdd8f('0x37')](db[_0xdd8f('0x30')][_0xdd8f('0x31')]);_0x4863b8['query']=_[_0xdd8f('0x37')](_0x4dd900[_0xdd8f('0x38')]);_0x4863b8[_0xdd8f('0x39')]=_['intersection'](_0x4863b8[_0xdd8f('0x35')],_0x4863b8[_0xdd8f('0x38')]);_0x4a52e7[_0xdd8f('0x3c')]=_[_0xdd8f('0x3a')](_0x4863b8[_0xdd8f('0x35')],qs[_0xdd8f('0x3b')](_0x4dd900[_0xdd8f('0x38')][_0xdd8f('0x3b')]));_0x4a52e7['attributes']=_0x4a52e7[_0xdd8f('0x3c')][_0xdd8f('0x3d')]?_0x4a52e7[_0xdd8f('0x3c')]:_0x4863b8[_0xdd8f('0x35')];if(_0x4dd900[_0xdd8f('0x38')][_0xdd8f('0x4c')]){_0x4a52e7[_0xdd8f('0x47')]=[{'all':!![]}];}_0x4a52e7=_['merge']({},_0x4a52e7,_0x4dd900[_0xdd8f('0x46')]);return db[_0xdd8f('0x30')][_0xdd8f('0x4d')](_0x4a52e7)[_0xdd8f('0x2a')](handleEntityNotFound(_0xa01052,null))[_0xdd8f('0x2a')](respondWithResult(_0xa01052,null))['catch'](handleError(_0xa01052,null));};exports[_0xdd8f('0x4e')]=function(_0x59ed46,_0xc1884c){return db[_0xdd8f('0x30')][_0xdd8f('0x4e')](_0x59ed46[_0xdd8f('0x4f')],{})[_0xdd8f('0x2a')](respondWithResult(_0xc1884c,0xc9))[_0xdd8f('0x50')](handleError(_0xc1884c,null));};exports[_0xdd8f('0x51')]=function(_0x488d1c,_0x594721){if(_0x488d1c[_0xdd8f('0x4f')]['id']){delete _0x488d1c['body']['id'];}return db[_0xdd8f('0x30')][_0xdd8f('0x4d')]({'where':{'id':_0x488d1c['params']['id']}})[_0xdd8f('0x2a')](handleEntityNotFound(_0x594721,null))[_0xdd8f('0x2a')](saveUpdates(_0x488d1c[_0xdd8f('0x4f')],null))[_0xdd8f('0x2a')](respondWithResult(_0x594721,null))['catch'](handleError(_0x594721,null));};exports[_0xdd8f('0x2b')]=function(_0x2d8af7,_0x18a489){return db[_0xdd8f('0x30')][_0xdd8f('0x4d')]({'where':{'id':_0x2d8af7[_0xdd8f('0x4b')]['id']}})[_0xdd8f('0x2a')](handleEntityNotFound(_0x18a489,null))[_0xdd8f('0x2a')](removeEntity(_0x18a489,null))['catch'](handleError(_0x18a489,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ab3116d..4dd6404 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 _0xd458=['rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5cdc79,_0x24beb1){var _0x22ddcf=function(_0x1f92bf){while(--_0x1f92bf){_0x5cdc79['push'](_0x5cdc79['shift']());}};_0x22ddcf(++_0x24beb1);}(_0xd458,0xbd));var _0x8d45=function(_0x3ecc4a,_0x11ff08){_0x3ecc4a=_0x3ecc4a-0x0;var _0x35a927=_0xd458[_0x3ecc4a];return _0x35a927;};'use strict';var _=require('lodash');var util=require(_0x8d45('0x0'));var logger=require(_0x8d45('0x1'))(_0x8d45('0x2'));var moment=require(_0x8d45('0x3'));var BPromise=require(_0x8d45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d45('0x5'));var rimraf=require(_0x8d45('0x6'));var config=require(_0x8d45('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x8d45('0x8')]=function(_0x394475,_0x5dec28){return _0x394475[_0x8d45('0x9')](_0x8d45('0xa'),attributes,{'tableName':_0x8d45('0xb'),'paranoid':![],'indexes':[{'name':_0x8d45('0xc'),'fields':[_0x8d45('0xd'),_0x8d45('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68cc=['path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x38ec17,_0x258cd6){var _0x3e34fc=function(_0x448132){while(--_0x448132){_0x38ec17['push'](_0x38ec17['shift']());}};_0x3e34fc(++_0x258cd6);}(_0x68cc,0xf9));var _0xc68c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x68cc[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xc68c('0x0'));var util=require(_0xc68c('0x1'));var logger=require(_0xc68c('0x2'))(_0xc68c('0x3'));var moment=require(_0xc68c('0x4'));var BPromise=require(_0xc68c('0x5'));var rp=require(_0xc68c('0x6'));var fs=require('fs');var path=require(_0xc68c('0x7'));var rimraf=require(_0xc68c('0x8'));var config=require(_0xc68c('0x9'));var attributes=require(_0xc68c('0xa'));module['exports']=function(_0x49a06c,_0x10e87d){return _0x49a06c[_0xc68c('0xb')](_0xc68c('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xc68c('0xd'),'fields':[_0xc68c('0xe'),_0xc68c('0xf')],'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 d8e8013..2234fe9 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 _0x56f7=['then','info','VtigerField,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2d7b8c,_0x16e03e){var _0x186912=function(_0x11ec88){while(--_0x11ec88){_0x2d7b8c['push'](_0x2d7b8c['shift']());}};_0x186912(++_0x16e03e);}(_0x56f7,0xcb));var _0x756f=function(_0x144503,_0x3924a7){_0x144503=_0x144503-0x0;var _0x32ac61=_0x56f7[_0x144503];return _0x32ac61;};'use strict';var _=require(_0x756f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x756f('0x1'));var rs=require(_0x756f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x756f('0x3'));var logger=require(_0x756f('0x4'))('rpc');var config=require(_0x756f('0x5'));var jayson=require(_0x756f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dd5e6,_0x115c9b,_0x6e9ebd){return new BPromise(function(_0x1229bc,_0x5f4cd0){return client['request'](_0x4dd5e6,_0x6e9ebd)[_0x756f('0x7')](function(_0x3781ff){logger[_0x756f('0x8')](_0x756f('0x9'),_0x115c9b,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x115c9b,'request\x20sent',JSON['stringify'](_0x3781ff));if(_0x3781ff[_0x756f('0xa')]){if(_0x3781ff['error'][_0x756f('0xb')]===0x1f4){logger[_0x756f('0xa')](_0x756f('0x9'),_0x115c9b,_0x3781ff[_0x756f('0xa')]['message']);return _0x5f4cd0(_0x3781ff['error'][_0x756f('0xc')]);}logger[_0x756f('0xa')]('VtigerField,\x20%s,\x20%s',_0x115c9b,_0x3781ff['error'][_0x756f('0xc')]);return _0x1229bc(_0x3781ff[_0x756f('0xa')]['message']);}else{logger[_0x756f('0x8')]('VtigerField,\x20%s,\x20%s',_0x115c9b,_0x756f('0xd'));_0x1229bc(_0x3781ff[_0x756f('0xe')]['message']);}})['catch'](function(_0x23d688){logger[_0x756f('0xa')]('VtigerField,\x20%s,\x20%s',_0x115c9b,_0x23d688);_0x5f4cd0(_0x23d688);});});} \ No newline at end of file +var _0xf8b9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf8b9,0x11a));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9f8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f8b('0x1'));var db=require(_0x9f8b('0x2'))['db'];var utils=require(_0x9f8b('0x3'));var logger=require(_0x9f8b('0x4'))(_0x9f8b('0x5'));var config=require(_0x9f8b('0x6'));var jayson=require(_0x9f8b('0x7'));var client=jayson[_0x9f8b('0x8')][_0x9f8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c5649,_0x5baf99,_0x4420e7){return new BPromise(function(_0x450f8b,_0x1265fa){return client[_0x9f8b('0xa')](_0x2c5649,_0x4420e7)['then'](function(_0xbabd7b){logger[_0x9f8b('0xb')](_0x9f8b('0xc'),_0x5baf99,_0x9f8b('0xd'));logger[_0x9f8b('0xe')](_0x9f8b('0xf'),_0x5baf99,_0x9f8b('0xd'),JSON[_0x9f8b('0x10')](_0xbabd7b));if(_0xbabd7b[_0x9f8b('0x11')]){if(_0xbabd7b[_0x9f8b('0x11')][_0x9f8b('0x12')]===0x1f4){logger[_0x9f8b('0x11')]('VtigerField,\x20%s,\x20%s',_0x5baf99,_0xbabd7b['error'][_0x9f8b('0x13')]);return _0x1265fa(_0xbabd7b[_0x9f8b('0x11')][_0x9f8b('0x13')]);}logger[_0x9f8b('0x11')](_0x9f8b('0xc'),_0x5baf99,_0xbabd7b[_0x9f8b('0x11')][_0x9f8b('0x13')]);return _0x450f8b(_0xbabd7b[_0x9f8b('0x11')][_0x9f8b('0x13')]);}else{logger[_0x9f8b('0xb')]('VtigerField,\x20%s,\x20%s',_0x5baf99,'request\x20sent');_0x450f8b(_0xbabd7b[_0x9f8b('0x14')][_0x9f8b('0x13')]);}})[_0x9f8b('0x15')](function(_0x3c7a29){logger['error'](_0x9f8b('0xc'),_0x5baf99,_0x3c7a29);_0x1265fa(_0x3c7a29);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3dabe8e..0683b33 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 _0xa2e4=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id'];(function(_0x519bb5,_0x5676b1){var _0x2cda53=function(_0x1373e8){while(--_0x1373e8){_0x519bb5['push'](_0x519bb5['shift']());}};_0x2cda53(++_0x5676b1);}(_0xa2e4,0xee));var _0x4a2e=function(_0x310eaf,_0x5024e1){_0x310eaf=_0x310eaf-0x0;var _0xbab0d8=_0xa2e4[_0x310eaf];return _0xbab0d8;};'use strict';var multer=require(_0x4a2e('0x0'));var util=require(_0x4a2e('0x1'));var path=require('path');var timeout=require(_0x4a2e('0x2'));var express=require(_0x4a2e('0x3'));var router=express[_0x4a2e('0x4')]();var fs_extra=require(_0x4a2e('0x5'));var auth=require(_0x4a2e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4a2e('0x7'));var controller=require(_0x4a2e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4a2e('0x9')]);router[_0x4a2e('0xa')](_0x4a2e('0xb'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0xd')]);router['get'](_0x4a2e('0xe'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0xf')]);router['get'](_0x4a2e('0x10'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0x11')]);router[_0x4a2e('0x12')]('/',auth[_0x4a2e('0xc')](),controller[_0x4a2e('0x13')]);router['post'](_0x4a2e('0xe'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0x14')]);router[_0x4a2e('0x15')](_0x4a2e('0xb'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0x16')]);router['delete'](_0x4a2e('0xb'),auth[_0x4a2e('0xc')](),controller[_0x4a2e('0x17')]);module[_0x4a2e('0x18')]=router; \ No newline at end of file +var _0x070f=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','getConfigurations','getFields','post','isAuthenticated','create','/:id/configurations','put','delete','destroy','exports','multer'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x070f,0x13a));var _0xf070=function(_0x4e060e,_0x37f5c5){_0x4e060e=_0x4e060e-0x0;var _0x4d1fed=_0x070f[_0x4e060e];return _0x4d1fed;};'use strict';var multer=require(_0xf070('0x0'));var util=require('util');var path=require(_0xf070('0x1'));var timeout=require('connect-timeout');var express=require(_0xf070('0x2'));var router=express[_0xf070('0x3')]();var fs_extra=require(_0xf070('0x4'));var auth=require(_0xf070('0x5'));var interaction=require(_0xf070('0x6'));var config=require(_0xf070('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xf070('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf070('0x9'),auth['isAuthenticated'](),controller[_0xf070('0xa')]);router[_0xf070('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf070('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xf070('0xc')]);router[_0xf070('0xd')]('/',auth[_0xf070('0xe')](),controller[_0xf070('0xf')]);router[_0xf070('0xd')](_0xf070('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xf070('0x11')]('/:id',auth[_0xf070('0xe')](),controller['update']);router[_0xf070('0x12')](_0xf070('0x9'),auth[_0xf070('0xe')](),controller[_0xf070('0x13')]);module[_0xf070('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2ab2517..e766f8d 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 _0x81c6=['remoteUri','ENUM','password','token','integrationTab','exports','username','STRING'];(function(_0x43f731,_0x349b1a){var _0x3de17b=function(_0x2c5adc){while(--_0x2c5adc){_0x43f731['push'](_0x43f731['shift']());}};_0x3de17b(++_0x349b1a);}(_0x81c6,0x1d5));var _0x681c=function(_0x4aadbc,_0x4afc4d){_0x4aadbc=_0x4aadbc-0x0;var _0x372f33=_0x81c6[_0x4aadbc];return _0x372f33;};'use strict';var Sequelize=require('sequelize');module[_0x681c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x681c('0x1')},'password':{'type':Sequelize[_0x681c('0x2')]},'token':{'type':Sequelize[_0x681c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x681c('0x3')},'authType':{'type':Sequelize[_0x681c('0x4')](_0x681c('0x5'),_0x681c('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x681c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x681c('0x4')]('integrationTab','newTab'),'defaultValue':_0x681c('0x7')}}; \ No newline at end of file +var _0x9af6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9af6,0x1d7));var _0x69af=function(_0x3c1e46,_0x5f4a2a){_0x3c1e46=_0x3c1e46-0x0;var _0x31f069=_0x9af6[_0x3c1e46];return _0x31f069;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x69af('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x69af('0x2')],'unique':_0x69af('0x4')},'authType':{'type':Sequelize[_0x69af('0x5')]('password',_0x69af('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x69af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69af('0x5')](_0x69af('0x7'),_0x69af('0x8')),'defaultValue':_0x69af('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 568bb86..307fb13 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 _0x9ffd=['catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','findOne','username','password','token','authType','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../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','set','update','then','stack','name','index','map','ZendeskAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x45dab6,_0xbb46ff){var _0x4b245f=function(_0x5b8362){while(--_0x5b8362){_0x45dab6['push'](_0x45dab6['shift']());}};_0x4b245f(++_0xbb46ff);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x37733c,_0x385a91){_0x37733c=_0x37733c-0x0;var _0x6e0dc6=_0x9ffd[_0x37733c];return _0x6e0dc6;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47b0d7,_0xaaf7af){_0xaaf7af=_0xaaf7af||0xcc;return function(_0x16a0d9){if(_0x16a0d9){return _0x47b0d7[_0xd9ff('0x1a')](_0xaaf7af);}return _0x47b0d7[_0xd9ff('0x1b')](_0xaaf7af)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x556aa4,_0x2f78c1){_0x2f78c1=_0x2f78c1||0xc8;return function(_0x3c9ace){if(_0x3c9ace){return _0x556aa4['status'](_0x2f78c1)[_0xd9ff('0x1d')](_0x3c9ace);}};}function respondWithFilteredResult(_0x5db010,_0x4ffe54){return function(_0x547e28){if(_0x547e28){var _0x4c5718=typeof _0x4ffe54[_0xd9ff('0x1e')]==='undefined'&&typeof _0x4ffe54[_0xd9ff('0x1f')]===_0xd9ff('0x20');var _0x39c6ce=_0x547e28[_0xd9ff('0x21')];var _0x5f45c4=_0x4c5718?0x0:_0x4ffe54[_0xd9ff('0x1e')];var _0x3ccf15=_0x4c5718?_0x547e28[_0xd9ff('0x21')]:_0x4ffe54[_0xd9ff('0x1e')]+_0x4ffe54[_0xd9ff('0x1f')];var _0x3ea97d;if(_0x3ccf15>=_0x39c6ce){_0x3ccf15=_0x39c6ce;_0x3ea97d=0xc8;}else{_0x3ea97d=0xce;}_0x5db010[_0xd9ff('0x1b')](_0x3ea97d);return _0x5db010[_0xd9ff('0x22')]('Content-Range',_0x5f45c4+'-'+_0x3ccf15+'/'+_0x39c6ce)['json'](_0x547e28);}return null;};}function patchUpdates(_0x264a3d){return function(_0x3eed13){try{jsonpatch['apply'](_0x3eed13,_0x264a3d,!![]);}catch(_0x588151){return BPromise['reject'](_0x588151);}return _0x3eed13['save']();};}function saveUpdates(_0x1f4d9e,_0x58eb5f){return function(_0x4c486a){if(_0x4c486a){return _0x4c486a[_0xd9ff('0x23')](_0x1f4d9e)[_0xd9ff('0x24')](function(_0x9f074e){return _0x9f074e;});}return null;};}function removeEntity(_0x278b66,_0x42a828){return function(_0x4b058a){if(_0x4b058a){return _0x4b058a['destroy']()[_0xd9ff('0x24')](function(){_0x278b66['status'](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x4d86fe,_0x285002){return function(_0x5d45b3){if(!_0x5d45b3){_0x4d86fe[_0xd9ff('0x1a')](0x194);}return _0x5d45b3;};}function handleError(_0x159e56,_0x2138b4){_0x2138b4=_0x2138b4||0x1f4;return function(_0x2970e8){logger['error'](_0x2970e8[_0xd9ff('0x25')]);if(_0x2970e8[_0xd9ff('0x26')]){delete _0x2970e8[_0xd9ff('0x26')];}_0x159e56[_0xd9ff('0x1b')](_0x2138b4)['send'](_0x2970e8);};}exports[_0xd9ff('0x27')]=function(_0x3792d9,_0x44b5a7){var _0x45fb63={},_0x263d3a={},_0xe516e2={'count':0x0,'rows':[]};var _0x420ffa=_[_0xd9ff('0x28')](db[_0xd9ff('0x29')]['rawAttributes'],function(_0xcea5db){return{'name':_0xcea5db['fieldName'],'type':_0xcea5db[_0xd9ff('0x2a')][_0xd9ff('0x2b')]};});_0x263d3a[_0xd9ff('0x2c')]=_['map'](_0x420ffa,_0xd9ff('0x26'));_0x263d3a[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x3792d9[_0xd9ff('0x2d')]);_0x263d3a['filters']=_[_0xd9ff('0x2f')](_0x263d3a['model'],_0x263d3a[_0xd9ff('0x2d')]);_0x45fb63[_0xd9ff('0x30')]=_[_0xd9ff('0x2f')](_0x263d3a[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x45fb63[_0xd9ff('0x30')]=_0x45fb63[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x45fb63[_0xd9ff('0x30')]:_0x263d3a[_0xd9ff('0x2c')];if(!_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x33')]('nolimit')){_0x45fb63[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3792d9[_0xd9ff('0x2d')]['limit']);_0x45fb63[_0xd9ff('0x1e')]=qs['offset'](_0x3792d9[_0xd9ff('0x2d')]['offset']);}_0x45fb63[_0xd9ff('0x34')]=qs['sort'](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x45fb63[_0xd9ff('0x36')]=qs['filters'](_['pick'](_0x3792d9['query'],_0x263d3a[_0xd9ff('0x37')]),_0x420ffa);if(_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x45fb63[_0xd9ff('0x36')]=_[_0xd9ff('0x39')](_0x45fb63[_0xd9ff('0x36')],{'$or':_['map'](_0x420ffa,function(_0x4c00c2){if(_0x4c00c2['type']!==_0xd9ff('0x3a')){var _0x252edc={};_0x252edc[_0x4c00c2[_0xd9ff('0x26')]]={'$like':'%'+_0x3792d9[_0xd9ff('0x2d')]['filter']+'%'};return _0x252edc;}})});}_0x45fb63=_[_0xd9ff('0x39')]({},_0x45fb63,_0x3792d9['options']);var _0x3cff52={'where':_0x45fb63[_0xd9ff('0x36')]};return db[_0xd9ff('0x29')][_0xd9ff('0x21')](_0x3cff52)['then'](function(_0x1e34da){_0xe516e2[_0xd9ff('0x21')]=_0x1e34da;if(_0x3792d9['query'][_0xd9ff('0x3b')]){_0x45fb63[_0xd9ff('0x3c')]=[{'all':!![]}];}return db[_0xd9ff('0x29')][_0xd9ff('0x3d')](_0x45fb63);})[_0xd9ff('0x24')](function(_0x1cc848){_0xe516e2['rows']=_0x1cc848;return _0xe516e2;})[_0xd9ff('0x24')](respondWithFilteredResult(_0x44b5a7,_0x45fb63))[_0xd9ff('0x3e')](handleError(_0x44b5a7,null));};exports[_0xd9ff('0x3f')]=function(_0x39fbbb,_0x472724){var _0x52aab8={'raw':![],'where':{'id':_0x39fbbb[_0xd9ff('0x40')]['id']}},_0x3178cd={};_0x3178cd[_0xd9ff('0x2c')]=_['keys'](db['ZendeskAccount'][_0xd9ff('0x41')]);_0x3178cd[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x39fbbb[_0xd9ff('0x2d')]);_0x3178cd[_0xd9ff('0x37')]=_[_0xd9ff('0x2f')](_0x3178cd['model'],_0x3178cd[_0xd9ff('0x2d')]);_0x52aab8[_0xd9ff('0x30')]=_['intersection'](_0x3178cd[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x39fbbb[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x52aab8[_0xd9ff('0x30')]=_0x52aab8['attributes']['length']?_0x52aab8['attributes']:_0x3178cd[_0xd9ff('0x2c')];if(_0x39fbbb['query'][_0xd9ff('0x3b')]){_0x52aab8[_0xd9ff('0x3c')]=[{'all':!![]}];}_0x52aab8=_[_0xd9ff('0x39')]({},_0x52aab8,_0x39fbbb['options']);return db[_0xd9ff('0x29')][_0xd9ff('0x42')](_0x52aab8)['then'](handleEntityNotFound(_0x472724,null))[_0xd9ff('0x24')](respondWithResult(_0x472724,null))[_0xd9ff('0x3e')](handleError(_0x472724,null));};exports[_0xd9ff('0x43')]=function(_0x316854,_0x559101){return db[_0xd9ff('0x29')]['create'](_0x316854[_0xd9ff('0x44')],{})['then'](respondWithResult(_0x559101,0xc9))[_0xd9ff('0x3e')](handleError(_0x559101,null));};exports[_0xd9ff('0x23')]=function(_0x2bf37a,_0x1760c3){if(_0x2bf37a[_0xd9ff('0x44')]['id']){delete _0x2bf37a['body']['id'];}return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x2bf37a[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x1760c3,null))['then'](saveUpdates(_0x2bf37a['body'],null))['then'](respondWithResult(_0x1760c3,null))[_0xd9ff('0x3e')](handleError(_0x1760c3,null));};exports[_0xd9ff('0x45')]=function(_0x29c6bd,_0x572618){return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x29c6bd[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x572618,null))[_0xd9ff('0x24')](removeEntity(_0x572618,null))[_0xd9ff('0x3e')](handleError(_0x572618,null));};exports[_0xd9ff('0x46')]=function(_0x1e1364,_0x1ad160,_0x10d9d0){var _0x5dcb5={};var _0x3d6143={};var _0x2533d7;var _0x487b07;return db[_0xd9ff('0x29')]['findOne']({'where':{'id':_0x1e1364[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ad160,null))[_0xd9ff('0x24')](function(_0x49623d){if(_0x49623d){_0x2533d7=_0x49623d;_0x3d6143[_0xd9ff('0x2c')]=_['keys'](db[_0xd9ff('0x47')]['rawAttributes']);_0x3d6143[_0xd9ff('0x2d')]=_['keys'](_0x1e1364[_0xd9ff('0x2d')]);_0x3d6143['filters']=_[_0xd9ff('0x2f')](_0x3d6143[_0xd9ff('0x2c')],_0x3d6143[_0xd9ff('0x2d')]);_0x5dcb5[_0xd9ff('0x30')]=_['intersection'](_0x3d6143[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x1e1364[_0xd9ff('0x2d')]['fields']));_0x5dcb5[_0xd9ff('0x30')]=_0x5dcb5[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x5dcb5[_0xd9ff('0x30')]:_0x3d6143[_0xd9ff('0x2c')];_0x5dcb5['order']=qs[_0xd9ff('0x35')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x5dcb5[_0xd9ff('0x36')]=qs[_0xd9ff('0x37')](_[_0xd9ff('0x48')](_0x1e1364[_0xd9ff('0x2d')],_0x3d6143['filters']));if(_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x5dcb5['where']=_[_0xd9ff('0x39')](_0x5dcb5[_0xd9ff('0x36')],{'$or':_['map'](_0x5dcb5[_0xd9ff('0x30')],function(_0x36d5c2){var _0x25d8d1={};_0x25d8d1[_0x36d5c2]={'$like':'%'+_0x1e1364['query']['filter']+'%'};return _0x25d8d1;})});}_0x5dcb5=_[_0xd9ff('0x39')]({},_0x5dcb5,_0x1e1364['options']);return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x31907e){if(_0x31907e){_0x487b07=_0x31907e[_0xd9ff('0x32')];if(!_0x1e1364['query']['hasOwnProperty']('nolimit')){_0x5dcb5[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x1f')]);_0x5dcb5[_0xd9ff('0x1e')]=qs['offset'](_0x1e1364[_0xd9ff('0x2d')]['offset']);}return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x3f92c3){if(_0x3f92c3){return _0x3f92c3?{'count':_0x487b07,'rows':_0x3f92c3}:null;}})[_0xd9ff('0x24')](respondWithResult(_0x1ad160,null))[_0xd9ff('0x3e')](handleError(_0x1ad160,null));};exports[_0xd9ff('0x49')]=function(_0xed12df,_0xfcafbe,_0x5d633b){if(_0xed12df[_0xd9ff('0x44')]['id']){delete _0xed12df[_0xd9ff('0x44')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0xed12df[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0xfcafbe,null))[_0xd9ff('0x24')](function(_0x34fca4){if(_0x34fca4){_0xed12df['body'][_0xd9ff('0x4a')]=_0x34fca4['id'];_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4b')]=integrations[_0xd9ff('0x4c')](_0xed12df[_0xd9ff('0x44')]['channel'],_0xed12df[_0xd9ff('0x44')]['type']);_0xed12df['body'][_0xd9ff('0x4d')]=integrations[_0xd9ff('0x4e')](_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4f')],_0xed12df['body'][_0xd9ff('0x2a')]);return db[_0xd9ff('0x47')][_0xd9ff('0x43')](_0xed12df[_0xd9ff('0x44')],{'include':[{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4b')},{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4d')}]});}return null;})['then'](respondWithResult(_0xfcafbe,null))['catch'](handleError(_0xfcafbe,null));};exports['getFields']=function(_0x275fb9,_0x31db27,_0x514d59){var _0x196670='';return db[_0xd9ff('0x29')][_0xd9ff('0x51')]({'where':{'id':_0x275fb9[_0xd9ff('0x40')]['id']},'attributes':['id',_0xd9ff('0x52'),_0xd9ff('0x53'),_0xd9ff('0x54'),_0xd9ff('0x55'),'remoteUri']})[_0xd9ff('0x24')](handleEntityNotFound(_0x31db27,null))[_0xd9ff('0x24')](function(_0x228413){if(_0x228413){_0x196670=_0x228413['remoteUri'];var _0x14e936=_0x196670['slice'](-0x1);if(_0x14e936==='/'){_0x196670=_0x196670[_0xd9ff('0x56')](0x0,_0x196670[_0xd9ff('0x57')](_0x14e936));}var _0x25ee82={'method':'GET','uri':util[_0xd9ff('0x58')](_0xd9ff('0x59'),_0x196670,_0xd9ff('0x5a')),'json':!![]};switch(_0x228413[_0xd9ff('0x55')]){case'password':_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5d'),_0x228413[_0xd9ff('0x52')],_0x228413[_0xd9ff('0x53')]))['toString'](_0xd9ff('0x5e')))};break;case _0xd9ff('0x54'):_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5f'),_0x228413[_0xd9ff('0x52')],_0x228413['token']))[_0xd9ff('0x60')](_0xd9ff('0x5e')))};break;default:throw new db[(_0xd9ff('0x61'))]['ValidationError'](_0xd9ff('0x62'));}return rp(_0x25ee82);}})['then'](function(_0x1e46fc){if(_0x1e46fc){var _0x478e0d=[_0xd9ff('0x63'),_0xd9ff('0x64'),_0xd9ff('0x65'),_0xd9ff('0x66')];_[_0xd9ff('0x67')](_0x1e46fc[_0xd9ff('0x5a')],function(_0xda0003){return _0x478e0d[_0xd9ff('0x68')](_0xda0003[_0xd9ff('0x2a')]);});return{'count':_0x1e46fc[_0xd9ff('0x5a')]['length'],'rows':_[_0xd9ff('0x28')](_0x1e46fc[_0xd9ff('0x5a')],function(_0x1f6cb9){return{'id':_0x1f6cb9['id'],'name':_0x1f6cb9[_0xd9ff('0x69')]>0x7?_0x1f6cb9[_0xd9ff('0x6a')]:_0x1f6cb9[_0xd9ff('0x2a')],'custom':_0x1f6cb9['position']>0x7?!![]:![],'options':_0x1f6cb9['system_field_options']?_0x1f6cb9[_0xd9ff('0x6b')]:_0x1f6cb9[_0xd9ff('0x6c')]?_0x1f6cb9[_0xd9ff('0x6c')]:[]};})};}})[_0xd9ff('0x24')](respondWithResult(_0x31db27,null))[_0xd9ff('0x3e')](function(_0x183199){var _0x5b234c=_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?0x1f4:_0x183199[_0xd9ff('0x6e')]||0x1f4;logger[_0xd9ff('0x6f')](_0xd9ff('0x70'),_0xd9ff('0x71'),_0x5b234c,JSON['stringify'](_0x183199));delete _0x183199[_0xd9ff('0x26')];if(_0x5b234c===0x191){_0x5b234c=0x190;}_0x31db27[_0xd9ff('0x1b')](_0x5b234c)[_0xd9ff('0x72')](_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?{'message':_0xd9ff('0x73'),'statusCode':_0x183199[_0xd9ff('0x6e')]}:_0x183199);});}; \ No newline at end of file +var _0xb58b=['headers','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','findOne','token','authType','remoteUri','substring','GET','format','%s/%s','password'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x37f9f5,_0x38373d){_0x37f9f5=_0x37f9f5-0x0;var _0x2d0771=_0xb58b[_0x37f9f5];return _0x2d0771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb58('0x18'));function respondWithStatusCode(_0x18810f,_0x4cda21){_0x4cda21=_0x4cda21||0xcc;return function(_0x132511){if(_0x132511){return _0x18810f[_0xbb58('0x19')](_0x4cda21);}return _0x18810f[_0xbb58('0x1a')](_0x4cda21)[_0xbb58('0x1b')]();};}function respondWithResult(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xc8;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1a')](_0x58245f)['json'](_0x110944);}};}function respondWithFilteredResult(_0x4ba30e,_0x33c20f){return function(_0x445b1f){if(_0x445b1f){var _0x38d69a=typeof _0x33c20f['offset']==='undefined'&&typeof _0x33c20f['limit']==='undefined';var _0x28637b=_0x445b1f[_0xbb58('0x1c')];var _0x48f3e0=_0x38d69a?0x0:_0x33c20f[_0xbb58('0x1d')];var _0x497653=_0x38d69a?_0x445b1f[_0xbb58('0x1c')]:_0x33c20f[_0xbb58('0x1d')]+_0x33c20f[_0xbb58('0x1e')];var _0xb8f982;if(_0x497653>=_0x28637b){_0x497653=_0x28637b;_0xb8f982=0xc8;}else{_0xb8f982=0xce;}_0x4ba30e[_0xbb58('0x1a')](_0xb8f982);return _0x4ba30e[_0xbb58('0x1f')](_0xbb58('0x20'),_0x48f3e0+'-'+_0x497653+'/'+_0x28637b)['json'](_0x445b1f);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x21')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x22')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x23')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x24')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x25')]()[_0xbb58('0x24')](function(){_0x21964d[_0xbb58('0x1a')](0xcc)[_0xbb58('0x1b')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x19')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x26')](_0x8e9ed9[_0xbb58('0x27')]);if(_0x8e9ed9[_0xbb58('0x28')]){delete _0x8e9ed9[_0xbb58('0x28')];}_0x1be0ae[_0xbb58('0x1a')](_0x129094)[_0xbb58('0x29')](_0x8e9ed9);};}exports[_0xbb58('0x2a')]=function(_0x2a0481,_0x4157c4){var _0x3559b6={},_0x573cca={},_0x2b0f73={'count':0x0,'rows':[]};var _0xe46bc1=_[_0xbb58('0x2b')](db[_0xbb58('0x2c')][_0xbb58('0x2d')],function(_0x9d379f){return{'name':_0x9d379f[_0xbb58('0x2e')],'type':_0x9d379f[_0xbb58('0x2f')][_0xbb58('0x30')]};});_0x573cca['model']=_[_0xbb58('0x2b')](_0xe46bc1,_0xbb58('0x28'));_0x573cca[_0xbb58('0x31')]=_[_0xbb58('0x32')](_0x2a0481[_0xbb58('0x31')]);_0x573cca[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],_0x573cca[_0xbb58('0x31')]);_0x3559b6[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x2a0481['query']['fields']));_0x3559b6['attributes']=_0x3559b6[_0xbb58('0x36')][_0xbb58('0x38')]?_0x3559b6[_0xbb58('0x36')]:_0x573cca[_0xbb58('0x35')];if(!_0x2a0481[_0xbb58('0x31')][_0xbb58('0x39')](_0xbb58('0x3a'))){_0x3559b6[_0xbb58('0x1e')]=qs['limit'](_0x2a0481[_0xbb58('0x31')][_0xbb58('0x1e')]);_0x3559b6['offset']=qs[_0xbb58('0x1d')](_0x2a0481['query'][_0xbb58('0x1d')]);}_0x3559b6['order']=qs[_0xbb58('0x3b')](_0x2a0481[_0xbb58('0x31')]['sort']);_0x3559b6[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x2a0481[_0xbb58('0x31')],_0x573cca[_0xbb58('0x33')]),_0xe46bc1);if(_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]){_0x3559b6[_0xbb58('0x3c')]=_['merge'](_0x3559b6[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0xe46bc1,function(_0x2da5ff){if(_0x2da5ff['type']!=='VIRTUAL'){var _0x133d56={};_0x133d56[_0x2da5ff['name']]={'$like':'%'+_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x133d56;}})});}_0x3559b6=_[_0xbb58('0x3f')]({},_0x3559b6,_0x2a0481['options']);var _0x485830={'where':_0x3559b6[_0xbb58('0x3c')]};return db[_0xbb58('0x2c')][_0xbb58('0x1c')](_0x485830)[_0xbb58('0x24')](function(_0x34a745){_0x2b0f73[_0xbb58('0x1c')]=_0x34a745;if(_0x2a0481['query'][_0xbb58('0x40')]){_0x3559b6[_0xbb58('0x41')]=[{'all':!![]}];}return db[_0xbb58('0x2c')][_0xbb58('0x42')](_0x3559b6);})[_0xbb58('0x24')](function(_0x301e15){_0x2b0f73['rows']=_0x301e15;return _0x2b0f73;})[_0xbb58('0x24')](respondWithFilteredResult(_0x4157c4,_0x3559b6))['catch'](handleError(_0x4157c4,null));};exports[_0xbb58('0x43')]=function(_0x285ad4,_0x29fb1c){var _0x45817f={'raw':![],'where':{'id':_0x285ad4[_0xbb58('0x44')]['id']}},_0x54099f={};_0x54099f[_0xbb58('0x35')]=_[_0xbb58('0x32')](db[_0xbb58('0x2c')]['rawAttributes']);_0x54099f[_0xbb58('0x31')]=_['keys'](_0x285ad4[_0xbb58('0x31')]);_0x54099f[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],_0x54099f[_0xbb58('0x31')]);_0x45817f[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x285ad4[_0xbb58('0x31')][_0xbb58('0x37')]));_0x45817f[_0xbb58('0x36')]=_0x45817f[_0xbb58('0x36')]['length']?_0x45817f[_0xbb58('0x36')]:_0x54099f['model'];if(_0x285ad4['query'][_0xbb58('0x40')]){_0x45817f[_0xbb58('0x41')]=[{'all':!![]}];}_0x45817f=_[_0xbb58('0x3f')]({},_0x45817f,_0x285ad4[_0xbb58('0x45')]);return db[_0xbb58('0x2c')][_0xbb58('0x46')](_0x45817f)[_0xbb58('0x24')](handleEntityNotFound(_0x29fb1c,null))[_0xbb58('0x24')](respondWithResult(_0x29fb1c,null))[_0xbb58('0x47')](handleError(_0x29fb1c,null));};exports[_0xbb58('0x48')]=function(_0x440fb3,_0x59a8cf){return db[_0xbb58('0x2c')][_0xbb58('0x48')](_0x440fb3['body'],{})[_0xbb58('0x24')](respondWithResult(_0x59a8cf,0xc9))[_0xbb58('0x47')](handleError(_0x59a8cf,null));};exports[_0xbb58('0x49')]=function(_0xdb0ff7,_0x5de68e){if(_0xdb0ff7[_0xbb58('0x4a')]['id']){delete _0xdb0ff7['body']['id'];}return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0xdb0ff7[_0xbb58('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de68e,null))[_0xbb58('0x24')](saveUpdates(_0xdb0ff7[_0xbb58('0x4a')],null))['then'](respondWithResult(_0x5de68e,null))[_0xbb58('0x47')](handleError(_0x5de68e,null));};exports['destroy']=function(_0x28301d,_0x2d81e0){return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0x28301d[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x2d81e0,null))[_0xbb58('0x24')](removeEntity(_0x2d81e0,null))['catch'](handleError(_0x2d81e0,null));};exports[_0xbb58('0x4b')]=function(_0x1fd892,_0x592da8,_0x3efbc6){var _0x98157={};var _0x5c19b7={};var _0x22802c;var _0x44636b;return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x1fd892[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x592da8,null))[_0xbb58('0x24')](function(_0x592879){if(_0x592879){_0x22802c=_0x592879;_0x5c19b7[_0xbb58('0x35')]=_['keys'](db[_0xbb58('0x4c')][_0xbb58('0x2d')]);_0x5c19b7[_0xbb58('0x31')]=_['keys'](_0x1fd892['query']);_0x5c19b7[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x5c19b7[_0xbb58('0x35')],_0x5c19b7[_0xbb58('0x31')]);_0x98157[_0xbb58('0x36')]=_['intersection'](_0x5c19b7[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x1fd892[_0xbb58('0x31')]['fields']));_0x98157[_0xbb58('0x36')]=_0x98157[_0xbb58('0x36')][_0xbb58('0x38')]?_0x98157[_0xbb58('0x36')]:_0x5c19b7[_0xbb58('0x35')];_0x98157['order']=qs[_0xbb58('0x3b')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3b')]);_0x98157[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x1fd892[_0xbb58('0x31')],_0x5c19b7[_0xbb58('0x33')]));if(_0x1fd892['query'][_0xbb58('0x3e')]){_0x98157['where']=_[_0xbb58('0x3f')](_0x98157[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0x98157[_0xbb58('0x36')],function(_0x3d6fba){var _0x1dbbd9={};_0x1dbbd9[_0x3d6fba]={'$like':'%'+_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x1dbbd9;})});}_0x98157=_[_0xbb58('0x3f')]({},_0x98157,_0x1fd892[_0xbb58('0x45')]);return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x3933f0){if(_0x3933f0){_0x44636b=_0x3933f0[_0xbb58('0x38')];if(!_0x1fd892[_0xbb58('0x31')]['hasOwnProperty'](_0xbb58('0x3a'))){_0x98157['limit']=qs[_0xbb58('0x1e')](_0x1fd892[_0xbb58('0x31')]['limit']);_0x98157[_0xbb58('0x1d')]=qs[_0xbb58('0x1d')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x1d')]);}return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x54bf2e){if(_0x54bf2e){return _0x54bf2e?{'count':_0x44636b,'rows':_0x54bf2e}:null;}})[_0xbb58('0x24')](respondWithResult(_0x592da8,null))[_0xbb58('0x47')](handleError(_0x592da8,null));};exports[_0xbb58('0x4d')]=function(_0x4bbccf,_0x11d41e,_0x419215){if(_0x4bbccf['body']['id']){delete _0x4bbccf[_0xbb58('0x4a')]['id'];}return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x4bbccf[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x11d41e,null))[_0xbb58('0x24')](function(_0x3c932e){if(_0x3c932e){_0x4bbccf[_0xbb58('0x4a')]['AccountId']=_0x3c932e['id'];_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x4e')]=integrations[_0xbb58('0x4f')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf['body']['type']);_0x4bbccf[_0xbb58('0x4a')]['Descriptions']=integrations[_0xbb58('0x51')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x2f')]);return db[_0xbb58('0x4c')][_0xbb58('0x48')](_0x4bbccf[_0xbb58('0x4a')],{'include':[{'model':db[_0xbb58('0x52')],'as':_0xbb58('0x4e')},{'model':db['ZendeskField'],'as':_0xbb58('0x53')}]});}return null;})[_0xbb58('0x24')](respondWithResult(_0x11d41e,null))[_0xbb58('0x47')](handleError(_0x11d41e,null));};exports['getFields']=function(_0x50bf24,_0x4bdc30,_0x5e9319){var _0x1e315e='';return db[_0xbb58('0x2c')][_0xbb58('0x54')]({'where':{'id':_0x50bf24[_0xbb58('0x44')]['id']},'attributes':['id','username','password',_0xbb58('0x55'),_0xbb58('0x56'),'remoteUri']})[_0xbb58('0x24')](handleEntityNotFound(_0x4bdc30,null))[_0xbb58('0x24')](function(_0x3cd96a){if(_0x3cd96a){_0x1e315e=_0x3cd96a[_0xbb58('0x57')];var _0x382d16=_0x1e315e['slice'](-0x1);if(_0x382d16==='/'){_0x1e315e=_0x1e315e[_0xbb58('0x58')](0x0,_0x1e315e['lastIndexOf'](_0x382d16));}var _0x52cf79={'method':_0xbb58('0x59'),'uri':util[_0xbb58('0x5a')](_0xbb58('0x5b'),_0x1e315e,'ticket_fields'),'json':!![]};switch(_0x3cd96a[_0xbb58('0x56')]){case _0xbb58('0x5c'):_0x52cf79[_0xbb58('0x5d')]={'Authorization':util[_0xbb58('0x5a')]('Basic\x20%s',new Buffer(util[_0xbb58('0x5a')]('%s:%s',_0x3cd96a['username'],_0x3cd96a[_0xbb58('0x5c')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;case'token':_0x52cf79['headers']={'Authorization':util[_0xbb58('0x5a')](_0xbb58('0x60'),new Buffer(util[_0xbb58('0x5a')](_0xbb58('0x61'),_0x3cd96a[_0xbb58('0x62')],_0x3cd96a[_0xbb58('0x55')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;default:throw new db[(_0xbb58('0x63'))][(_0xbb58('0x64'))](_0xbb58('0x65'));}return rp(_0x52cf79);}})['then'](function(_0x502f55){if(_0x502f55){var _0x36e2eb=[_0xbb58('0x66'),_0xbb58('0x67'),'group',_0xbb58('0x68')];_[_0xbb58('0x69')](_0x502f55[_0xbb58('0x6a')],function(_0x494c33){return _0x36e2eb[_0xbb58('0x6b')](_0x494c33['type']);});return{'count':_0x502f55[_0xbb58('0x6a')]['length'],'rows':_[_0xbb58('0x2b')](_0x502f55[_0xbb58('0x6a')],function(_0xaf9d6){return{'id':_0xaf9d6['id'],'name':_0xaf9d6[_0xbb58('0x6c')]>0x7?_0xaf9d6[_0xbb58('0x6d')]:_0xaf9d6[_0xbb58('0x2f')],'custom':_0xaf9d6['position']>0x7?!![]:![],'options':_0xaf9d6['system_field_options']?_0xaf9d6[_0xbb58('0x6e')]:_0xaf9d6[_0xbb58('0x6f')]?_0xaf9d6['custom_field_options']:[]};})};}})[_0xbb58('0x24')](respondWithResult(_0x4bdc30,null))[_0xbb58('0x47')](function(_0x43eb15){var _0x5604d1=_0x50bf24[_0xbb58('0x31')]['test']?0x1f4:_0x43eb15[_0xbb58('0x70')]||0x1f4;logger[_0xbb58('0x26')](_0xbb58('0x71'),_0xbb58('0x72'),_0x5604d1,JSON[_0xbb58('0x73')](_0x43eb15));delete _0x43eb15[_0xbb58('0x28')];if(_0x5604d1===0x191){_0x5604d1=0x190;}_0x4bdc30[_0xbb58('0x1a')](_0x5604d1)['send'](_0x50bf24[_0xbb58('0x31')][_0xbb58('0x74')]?{'message':_0xbb58('0x75'),'statusCode':_0x43eb15['statusCode']}:_0x43eb15);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7749e77..df711b7 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 _0x3668=['int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intZendeskAccount.attributes','define'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x3668,0x79));var _0x8366=function(_0x32fb66,_0x2e169d){_0x32fb66=_0x32fb66-0x0;var _0x4cfd9d=_0x3668[_0x32fb66];return _0x4cfd9d;};'use strict';var _=require(_0x8366('0x0'));var util=require(_0x8366('0x1'));var logger=require(_0x8366('0x2'))(_0x8366('0x3'));var moment=require('moment');var BPromise=require(_0x8366('0x4'));var rp=require(_0x8366('0x5'));var fs=require('fs');var path=require(_0x8366('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8366('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3a7bb1,_0x87d736){return _0x3a7bb1[_0x8366('0x8')]('ZendeskAccount',attributes,{'tableName':_0x8366('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a91=['../../config/environment','./intZendeskAccount.attributes','exports','ZendeskAccount','int_zendesk_accounts','util','api','bluebird','request-promise','path','rimraf'];(function(_0x462c0c,_0x46989e){var _0x803350=function(_0xc7c985){while(--_0xc7c985){_0x462c0c['push'](_0x462c0c['shift']());}};_0x803350(++_0x46989e);}(_0x1a91,0xb5));var _0x11a9=function(_0x5ec78f,_0x4f821d){_0x5ec78f=_0x5ec78f-0x0;var _0x19ea35=_0x1a91[_0x5ec78f];return _0x19ea35;};'use strict';var _=require('lodash');var util=require(_0x11a9('0x0'));var logger=require('../../config/logger')(_0x11a9('0x1'));var moment=require('moment');var BPromise=require(_0x11a9('0x2'));var rp=require(_0x11a9('0x3'));var fs=require('fs');var path=require(_0x11a9('0x4'));var rimraf=require(_0x11a9('0x5'));var config=require(_0x11a9('0x6'));var attributes=require(_0x11a9('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x11a9('0x8')]=function(_0x3af493,_0x446b5a){return _0x3af493['define'](_0x11a9('0x9'),attributes,{'tableName':_0x11a9('0xa'),'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 75d7f1b..899a4a3 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 _0x78fb=['stringify','error','code','message','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowZendeskAccount','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5ab191,_0x3048f5){var _0x3926b3=function(_0x444bb7){while(--_0x444bb7){_0x5ab191['push'](_0x5ab191['shift']());}};_0x3926b3(++_0x3048f5);}(_0x78fb,0x1c1));var _0xb78f=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x78fb[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xb78f('0x0'));var util=require(_0xb78f('0x1'));var moment=require('moment');var BPromise=require(_0xb78f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb78f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb78f('0x4'))('rpc');var config=require(_0xb78f('0x5'));var jayson=require(_0xb78f('0x6'));var client=jayson[_0xb78f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3473af,_0x58dca6,_0x39954b){return new BPromise(function(_0x391cee,_0x1a5aac){return client['request'](_0x3473af,_0x39954b)[_0xb78f('0x8')](function(_0x5a5e12){logger['info'](_0xb78f('0x9'),_0x58dca6,_0xb78f('0xa'));logger[_0xb78f('0xb')](_0xb78f('0xc'),_0x58dca6,_0xb78f('0xa'),JSON[_0xb78f('0xd')](_0x5a5e12));if(_0x5a5e12[_0xb78f('0xe')]){if(_0x5a5e12[_0xb78f('0xe')][_0xb78f('0xf')]===0x1f4){logger[_0xb78f('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x58dca6,_0x5a5e12['error']['message']);return _0x1a5aac(_0x5a5e12['error'][_0xb78f('0x10')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x58dca6,_0x5a5e12[_0xb78f('0xe')][_0xb78f('0x10')]);return _0x391cee(_0x5a5e12[_0xb78f('0xe')][_0xb78f('0x10')]);}else{logger[_0xb78f('0x11')](_0xb78f('0x9'),_0x58dca6,_0xb78f('0xa'));_0x391cee(_0x5a5e12[_0xb78f('0x12')][_0xb78f('0x10')]);}})['catch'](function(_0x38b6b1){logger[_0xb78f('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x58dca6,_0x38b6b1);_0x1a5aac(_0x38b6b1);});});}exports[_0xb78f('0x13')]=function(_0x5a3aa4){var _0x281681=this;return new Promise(function(_0x54ced5,_0xbcdb01){return db[_0xb78f('0x14')][_0xb78f('0x15')]({'raw':_0x5a3aa4[_0xb78f('0x16')]?_0x5a3aa4[_0xb78f('0x16')][_0xb78f('0x17')]===undefined?!![]:![]:!![],'where':_0x5a3aa4[_0xb78f('0x16')]?_0x5a3aa4['options'][_0xb78f('0x18')]||null:null,'attributes':_0x5a3aa4[_0xb78f('0x16')]?_0x5a3aa4['options'][_0xb78f('0x19')]||null:null,'limit':_0x5a3aa4[_0xb78f('0x16')]?_0x5a3aa4['options'][_0xb78f('0x1a')]||null:null,'include':_0x5a3aa4['options']?_0x5a3aa4[_0xb78f('0x16')][_0xb78f('0x1b')]?_[_0xb78f('0x1c')](_0x5a3aa4[_0xb78f('0x16')][_0xb78f('0x1b')],function(_0x1d70b1){return{'model':db[_0x1d70b1[_0xb78f('0x1d')]],'as':_0x1d70b1['as'],'attributes':_0x1d70b1[_0xb78f('0x19')],'include':_0x1d70b1['include']?_[_0xb78f('0x1c')](_0x1d70b1[_0xb78f('0x1b')],function(_0x259e2d){return{'model':db[_0x259e2d[_0xb78f('0x1d')]],'as':_0x259e2d['as'],'attributes':_0x259e2d['attributes'],'include':_0x259e2d[_0xb78f('0x1b')]?_[_0xb78f('0x1c')](_0x259e2d[_0xb78f('0x1b')],function(_0x4867bc){return{'model':db[_0x4867bc[_0xb78f('0x1d')]],'as':_0x4867bc['as'],'attributes':_0x4867bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xb78f('0x8')](function(_0x4c3116){logger[_0xb78f('0x11')]('GetZendeskAccount',_0x5a3aa4);logger['debug'](_0xb78f('0x13'),_0x5a3aa4,JSON['stringify'](_0x4c3116));_0x54ced5(_0x4c3116);})[_0xb78f('0x1e')](function(_0x43c9e2){logger[_0xb78f('0xe')](_0xb78f('0x13'),_0x43c9e2[_0xb78f('0x10')],_0x5a3aa4);_0xbcdb01(_0x281681[_0xb78f('0xe')](0x1f4,_0x43c9e2[_0xb78f('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x504386){var _0x436602=this;return new Promise(function(_0x482fc2,_0x57703b){return db[_0xb78f('0x14')][_0xb78f('0x1f')]({'raw':_0x504386[_0xb78f('0x16')]?_0x504386[_0xb78f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x504386['options']?_0x504386[_0xb78f('0x16')]['where']||null:null,'attributes':_0x504386[_0xb78f('0x16')]?_0x504386[_0xb78f('0x16')]['attributes']||null:null,'include':_0x504386['options']?_0x504386[_0xb78f('0x16')][_0xb78f('0x1b')]?_[_0xb78f('0x1c')](_0x504386[_0xb78f('0x16')][_0xb78f('0x1b')],function(_0x4bcbfd){return{'model':db[_0x4bcbfd[_0xb78f('0x1d')]],'as':_0x4bcbfd['as'],'attributes':_0x4bcbfd['attributes'],'include':_0x4bcbfd[_0xb78f('0x1b')]?_[_0xb78f('0x1c')](_0x4bcbfd[_0xb78f('0x1b')],function(_0x42a718){return{'model':db[_0x42a718[_0xb78f('0x1d')]],'as':_0x42a718['as'],'attributes':_0x42a718['attributes'],'include':_0x42a718['include']?_[_0xb78f('0x1c')](_0x42a718['include'],function(_0x16a074){return{'model':db[_0x16a074[_0xb78f('0x1d')]],'as':_0x16a074['as'],'attributes':_0x16a074[_0xb78f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x81e46b){logger[_0xb78f('0x11')](_0xb78f('0x20'),_0x504386);logger['debug']('ShowZendeskAccount',_0x504386,JSON['stringify'](_0x81e46b));_0x482fc2(_0x81e46b);})[_0xb78f('0x1e')](function(_0xde6e90){logger['error'](_0xb78f('0x20'),_0xde6e90['message'],_0x504386);_0x57703b(_0x436602[_0xb78f('0xe')](0x1f4,_0xde6e90[_0xb78f('0x10')]));});});}; \ No newline at end of file +var _0x9b78=['include','model','map','then','stringify','ShowZendeskAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ZendeskAccount','findAll','options','where','attributes','limit'];(function(_0x444958,_0x2fc23c){var _0x36403e=function(_0x46935d){while(--_0x46935d){_0x444958['push'](_0x444958['shift']());}};_0x36403e(++_0x2fc23c);}(_0x9b78,0x19f));var _0x89b7=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x9b78[_0x2984d0];return _0x2885f2;};'use strict';var _=require(_0x89b7('0x0'));var util=require('util');var moment=require(_0x89b7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b7('0x2'));var db=require(_0x89b7('0x3'))['db'];var utils=require(_0x89b7('0x4'));var logger=require(_0x89b7('0x5'))(_0x89b7('0x6'));var config=require(_0x89b7('0x7'));var jayson=require(_0x89b7('0x8'));var client=jayson['client'][_0x89b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c65c7,_0x18cecd,_0x4c0034){return new BPromise(function(_0x55c41d,_0x3172c0){return client[_0x89b7('0xa')](_0x3c65c7,_0x4c0034)['then'](function(_0x122647){logger['info'](_0x89b7('0xb'),_0x18cecd,_0x89b7('0xc'));logger[_0x89b7('0xd')](_0x89b7('0xe'),_0x18cecd,_0x89b7('0xc'),JSON['stringify'](_0x122647));if(_0x122647[_0x89b7('0xf')]){if(_0x122647[_0x89b7('0xf')][_0x89b7('0x10')]===0x1f4){logger[_0x89b7('0xf')](_0x89b7('0xb'),_0x18cecd,_0x122647[_0x89b7('0xf')][_0x89b7('0x11')]);return _0x3172c0(_0x122647[_0x89b7('0xf')]['message']);}logger[_0x89b7('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x18cecd,_0x122647[_0x89b7('0xf')]['message']);return _0x55c41d(_0x122647['error'][_0x89b7('0x11')]);}else{logger[_0x89b7('0x12')](_0x89b7('0xb'),_0x18cecd,_0x89b7('0xc'));_0x55c41d(_0x122647[_0x89b7('0x13')][_0x89b7('0x11')]);}})[_0x89b7('0x14')](function(_0x515ab0){logger['error'](_0x89b7('0xb'),_0x18cecd,_0x515ab0);_0x3172c0(_0x515ab0);});});}exports['GetZendeskAccount']=function(_0xedde21){var _0xd5c552=this;return new Promise(function(_0x4f9ae8,_0x1d1293){return db[_0x89b7('0x15')][_0x89b7('0x16')]({'raw':_0xedde21[_0x89b7('0x17')]?_0xedde21[_0x89b7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xedde21['options']?_0xedde21[_0x89b7('0x17')][_0x89b7('0x18')]||null:null,'attributes':_0xedde21[_0x89b7('0x17')]?_0xedde21['options'][_0x89b7('0x19')]||null:null,'limit':_0xedde21[_0x89b7('0x17')]?_0xedde21[_0x89b7('0x17')][_0x89b7('0x1a')]||null:null,'include':_0xedde21['options']?_0xedde21[_0x89b7('0x17')][_0x89b7('0x1b')]?_['map'](_0xedde21[_0x89b7('0x17')]['include'],function(_0x400ae9){return{'model':db[_0x400ae9[_0x89b7('0x1c')]],'as':_0x400ae9['as'],'attributes':_0x400ae9['attributes'],'include':_0x400ae9[_0x89b7('0x1b')]?_['map'](_0x400ae9[_0x89b7('0x1b')],function(_0x395fa7){return{'model':db[_0x395fa7['model']],'as':_0x395fa7['as'],'attributes':_0x395fa7[_0x89b7('0x19')],'include':_0x395fa7[_0x89b7('0x1b')]?_[_0x89b7('0x1d')](_0x395fa7[_0x89b7('0x1b')],function(_0x1dd28c){return{'model':db[_0x1dd28c['model']],'as':_0x1dd28c['as'],'attributes':_0x1dd28c['attributes']};}):[]};}):[]};}):[]:[]})[_0x89b7('0x1e')](function(_0x5ae876){logger['info']('GetZendeskAccount',_0xedde21);logger[_0x89b7('0xd')]('GetZendeskAccount',_0xedde21,JSON[_0x89b7('0x1f')](_0x5ae876));_0x4f9ae8(_0x5ae876);})[_0x89b7('0x14')](function(_0x2dfc3a){logger['error']('GetZendeskAccount',_0x2dfc3a['message'],_0xedde21);_0x1d1293(_0xd5c552[_0x89b7('0xf')](0x1f4,_0x2dfc3a['message']));});});};exports[_0x89b7('0x20')]=function(_0x42bd21){var _0x101c7a=this;return new Promise(function(_0x2431db,_0x2a23e9){return db['ZendeskAccount'][_0x89b7('0x21')]({'raw':_0x42bd21[_0x89b7('0x17')]?_0x42bd21[_0x89b7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x42bd21[_0x89b7('0x17')]?_0x42bd21[_0x89b7('0x17')][_0x89b7('0x18')]||null:null,'attributes':_0x42bd21[_0x89b7('0x17')]?_0x42bd21['options'][_0x89b7('0x19')]||null:null,'include':_0x42bd21[_0x89b7('0x17')]?_0x42bd21[_0x89b7('0x17')][_0x89b7('0x1b')]?_[_0x89b7('0x1d')](_0x42bd21[_0x89b7('0x17')][_0x89b7('0x1b')],function(_0x555ae1){return{'model':db[_0x555ae1[_0x89b7('0x1c')]],'as':_0x555ae1['as'],'attributes':_0x555ae1[_0x89b7('0x19')],'include':_0x555ae1[_0x89b7('0x1b')]?_[_0x89b7('0x1d')](_0x555ae1['include'],function(_0x3daa3e){return{'model':db[_0x3daa3e['model']],'as':_0x3daa3e['as'],'attributes':_0x3daa3e[_0x89b7('0x19')],'include':_0x3daa3e[_0x89b7('0x1b')]?_[_0x89b7('0x1d')](_0x3daa3e[_0x89b7('0x1b')],function(_0x53040b){return{'model':db[_0x53040b[_0x89b7('0x1c')]],'as':_0x53040b['as'],'attributes':_0x53040b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x92ddf9){logger[_0x89b7('0x12')]('ShowZendeskAccount',_0x42bd21);logger[_0x89b7('0xd')]('ShowZendeskAccount',_0x42bd21,JSON[_0x89b7('0x1f')](_0x92ddf9));_0x2431db(_0x92ddf9);})[_0x89b7('0x14')](function(_0x45621b){logger['error'](_0x89b7('0x20'),_0x45621b[_0x89b7('0x11')],_0x42bd21);_0x2a23e9(_0x101c7a[_0x89b7('0xf')](0x1f4,_0x45621b[_0x89b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 475d6d0..fef084d 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x4ddf63,_0x124ae3){var _0x525aa7=function(_0x392bc0){while(--_0x392bc0){_0x4ddf63['push'](_0x4ddf63['shift']());}};_0x525aa7(++_0x124ae3);}(_0x750a,0x140));var _0xa750=function(_0x1dd233,_0xebd01b){_0x1dd233=_0x1dd233-0x0;var _0x1a5c34=_0x750a[_0x1dd233];return _0x1a5c34;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x878f,0x173));var _0xf878=function(_0x3f5c83,_0x30f6d0){_0x3f5c83=_0x3f5c83-0x0;var _0x4d1170=_0x878f[_0x3f5c83];return _0x4d1170;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 75f1965..2ce4fbf 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 _0x35dd=['STRING','sequelize'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0x35dd,0xa7));var _0xd35d=function(_0x55c431,_0x2b8c90){_0x55c431=_0x55c431-0x0;var _0x3c8307=_0x35dd[_0x55c431];return _0x3c8307;};'use strict';var Sequelize=require(_0xd35d('0x0'));module['exports']={'name':{'type':Sequelize[_0xd35d('0x1')]},'description':{'type':Sequelize[_0xd35d('0x1')]}}; \ No newline at end of file +var _0x08ee=['sequelize','STRING'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x08ee,0x1da));var _0xe08e=function(_0x2c9004,_0x9bcc79){_0x2c9004=_0x2c9004-0x0;var _0x4e6116=_0x08ee[_0x2c9004];return _0x4e6116;};'use strict';var Sequelize=require(_0xe08e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe08e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 82c4449..4f15b20 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 _0x14d6=['sendStatus','name','send','index','map','rawAttributes','key','keys','intersection','model','attributes','fields','query','length','nolimit','order','sort','where','pick','filters','filter','merge','type','options','include','ZendeskConfiguration','findAll','catch','show','params','includeAll','find','create','body','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','reject','save','update','then'];(function(_0x457277,_0x377cc0){var _0x3cd18b=function(_0x1e203a){while(--_0x1e203a){_0x457277['push'](_0x457277['shift']());}};_0x3cd18b(++_0x377cc0);}(_0x14d6,0x7c));var _0x614d=function(_0x5eb3ad,_0x5247da){_0x5eb3ad=_0x5eb3ad-0x0;var _0x5ae3bc=_0x14d6[_0x5eb3ad];return _0x5ae3bc;};'use strict';var emlformat=require(_0x614d('0x0'));var rimraf=require(_0x614d('0x1'));var zipdir=require(_0x614d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x614d('0x3'));var Mustache=require(_0x614d('0x4'));var util=require(_0x614d('0x5'));var path=require(_0x614d('0x6'));var sox=require(_0x614d('0x7'));var csv=require('to-csv');var ejs=require(_0x614d('0x8'));var fs=require('fs');var fs_extra=require(_0x614d('0x9'));var _=require(_0x614d('0xa'));var squel=require(_0x614d('0xb'));var crypto=require(_0x614d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x614d('0xd'));var toCsv=require(_0x614d('0xe'));var querystring=require(_0x614d('0xf'));var Papa=require('papaparse');var Redis=require(_0x614d('0x10'));var authService=require(_0x614d('0x11'));var qs=require(_0x614d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x614d('0x13'));var logger=require(_0x614d('0x14'))('api');var utils=require(_0x614d('0x15'));var config=require(_0x614d('0x16'));var licenseUtil=require(_0x614d('0x17'));var db=require(_0x614d('0x18'))['db'];function respondWithStatusCode(_0x3896ee,_0x387ead){_0x387ead=_0x387ead||0xcc;return function(_0x2c829f){if(_0x2c829f){return _0x3896ee['sendStatus'](_0x387ead);}return _0x3896ee[_0x614d('0x19')](_0x387ead)[_0x614d('0x1a')]();};}function respondWithResult(_0x1b1349,_0x513c7e){_0x513c7e=_0x513c7e||0xc8;return function(_0x5c1c36){if(_0x5c1c36){return _0x1b1349[_0x614d('0x19')](_0x513c7e)[_0x614d('0x1b')](_0x5c1c36);}};}function respondWithFilteredResult(_0x32aa28,_0x476d47){return function(_0x5dd04d){if(_0x5dd04d){var _0x489eca=typeof _0x476d47['offset']===_0x614d('0x1c')&&typeof _0x476d47['limit']===_0x614d('0x1c');var _0x2a8025=_0x5dd04d['count'];var _0x59e0bf=_0x489eca?0x0:_0x476d47[_0x614d('0x1d')];var _0x273414=_0x489eca?_0x5dd04d[_0x614d('0x1e')]:_0x476d47['offset']+_0x476d47[_0x614d('0x1f')];var _0x1ddebc;if(_0x273414>=_0x2a8025){_0x273414=_0x2a8025;_0x1ddebc=0xc8;}else{_0x1ddebc=0xce;}_0x32aa28[_0x614d('0x19')](_0x1ddebc);return _0x32aa28['set']('Content-Range',_0x59e0bf+'-'+_0x273414+'/'+_0x2a8025)[_0x614d('0x1b')](_0x5dd04d);}return null;};}function patchUpdates(_0x54f706){return function(_0x5777a7){try{jsonpatch['apply'](_0x5777a7,_0x54f706,!![]);}catch(_0x32da9f){return BPromise[_0x614d('0x20')](_0x32da9f);}return _0x5777a7[_0x614d('0x21')]();};}function saveUpdates(_0x3d6301,_0x337064){return function(_0x2a137d){if(_0x2a137d){return _0x2a137d[_0x614d('0x22')](_0x3d6301)[_0x614d('0x23')](function(_0x5da83e){return _0x5da83e;});}return null;};}function removeEntity(_0x2f789b,_0xc2f400){return function(_0x2bccca){if(_0x2bccca){return _0x2bccca['destroy']()['then'](function(){_0x2f789b['status'](0xcc)[_0x614d('0x1a')]();});}};}function handleEntityNotFound(_0xdacff9,_0x5ea9a7){return function(_0x332a50){if(!_0x332a50){_0xdacff9[_0x614d('0x24')](0x194);}return _0x332a50;};}function handleError(_0x1f473c,_0x2c185c){_0x2c185c=_0x2c185c||0x1f4;return function(_0x193c3b){logger['error'](_0x193c3b['stack']);if(_0x193c3b[_0x614d('0x25')]){delete _0x193c3b['name'];}_0x1f473c[_0x614d('0x19')](_0x2c185c)[_0x614d('0x26')](_0x193c3b);};}exports[_0x614d('0x27')]=function(_0x30d7b3,_0x28a370){var _0x4c27cd={},_0x26d0ab={},_0x1fb283={'count':0x0,'rows':[]};var _0x95a11c=_[_0x614d('0x28')](db['ZendeskConfiguration'][_0x614d('0x29')],function(_0x518e8d){return{'name':_0x518e8d['fieldName'],'type':_0x518e8d['type'][_0x614d('0x2a')]};});_0x26d0ab['model']=_[_0x614d('0x28')](_0x95a11c,'name');_0x26d0ab['query']=_[_0x614d('0x2b')](_0x30d7b3['query']);_0x26d0ab['filters']=_[_0x614d('0x2c')](_0x26d0ab[_0x614d('0x2d')],_0x26d0ab['query']);_0x4c27cd[_0x614d('0x2e')]=_['intersection'](_0x26d0ab['model'],qs[_0x614d('0x2f')](_0x30d7b3[_0x614d('0x30')]['fields']));_0x4c27cd['attributes']=_0x4c27cd[_0x614d('0x2e')][_0x614d('0x31')]?_0x4c27cd[_0x614d('0x2e')]:_0x26d0ab[_0x614d('0x2d')];if(!_0x30d7b3[_0x614d('0x30')]['hasOwnProperty'](_0x614d('0x32'))){_0x4c27cd['limit']=qs['limit'](_0x30d7b3[_0x614d('0x30')][_0x614d('0x1f')]);_0x4c27cd['offset']=qs['offset'](_0x30d7b3[_0x614d('0x30')][_0x614d('0x1d')]);}_0x4c27cd[_0x614d('0x33')]=qs[_0x614d('0x34')](_0x30d7b3[_0x614d('0x30')][_0x614d('0x34')]);_0x4c27cd[_0x614d('0x35')]=qs['filters'](_[_0x614d('0x36')](_0x30d7b3[_0x614d('0x30')],_0x26d0ab[_0x614d('0x37')]),_0x95a11c);if(_0x30d7b3[_0x614d('0x30')][_0x614d('0x38')]){_0x4c27cd['where']=_[_0x614d('0x39')](_0x4c27cd[_0x614d('0x35')],{'$or':_[_0x614d('0x28')](_0x95a11c,function(_0x113746){if(_0x113746[_0x614d('0x3a')]!=='VIRTUAL'){var _0x567b58={};_0x567b58[_0x113746[_0x614d('0x25')]]={'$like':'%'+_0x30d7b3[_0x614d('0x30')][_0x614d('0x38')]+'%'};return _0x567b58;}})});}_0x4c27cd=_[_0x614d('0x39')]({},_0x4c27cd,_0x30d7b3[_0x614d('0x3b')]);var _0x347b6c={'where':_0x4c27cd['where']};return db['ZendeskConfiguration'][_0x614d('0x1e')](_0x347b6c)[_0x614d('0x23')](function(_0x378e7d){_0x1fb283['count']=_0x378e7d;if(_0x30d7b3[_0x614d('0x30')]['includeAll']){_0x4c27cd[_0x614d('0x3c')]=[{'all':!![]}];}return db[_0x614d('0x3d')][_0x614d('0x3e')](_0x4c27cd);})[_0x614d('0x23')](function(_0x1deab7){_0x1fb283['rows']=_0x1deab7;return _0x1fb283;})[_0x614d('0x23')](respondWithFilteredResult(_0x28a370,_0x4c27cd))[_0x614d('0x3f')](handleError(_0x28a370,null));};exports[_0x614d('0x40')]=function(_0x42d5f5,_0x47cb45){var _0x2dca93={'raw':![],'where':{'id':_0x42d5f5[_0x614d('0x41')]['id']}},_0x644f03={};_0x644f03[_0x614d('0x2d')]=_[_0x614d('0x2b')](db['ZendeskConfiguration'][_0x614d('0x29')]);_0x644f03['query']=_[_0x614d('0x2b')](_0x42d5f5[_0x614d('0x30')]);_0x644f03[_0x614d('0x37')]=_[_0x614d('0x2c')](_0x644f03[_0x614d('0x2d')],_0x644f03[_0x614d('0x30')]);_0x2dca93[_0x614d('0x2e')]=_[_0x614d('0x2c')](_0x644f03['model'],qs['fields'](_0x42d5f5['query'][_0x614d('0x2f')]));_0x2dca93[_0x614d('0x2e')]=_0x2dca93['attributes'][_0x614d('0x31')]?_0x2dca93[_0x614d('0x2e')]:_0x644f03[_0x614d('0x2d')];if(_0x42d5f5[_0x614d('0x30')][_0x614d('0x42')]){_0x2dca93['include']=[{'all':!![]}];}_0x2dca93=_[_0x614d('0x39')]({},_0x2dca93,_0x42d5f5[_0x614d('0x3b')]);return db['ZendeskConfiguration'][_0x614d('0x43')](_0x2dca93)[_0x614d('0x23')](handleEntityNotFound(_0x47cb45,null))['then'](respondWithResult(_0x47cb45,null))[_0x614d('0x3f')](handleError(_0x47cb45,null));};exports[_0x614d('0x44')]=function(_0x3356f4,_0xcee10b){return db['ZendeskConfiguration'][_0x614d('0x44')](_0x3356f4['body'],{})['then'](respondWithResult(_0xcee10b,0xc9))[_0x614d('0x3f')](handleError(_0xcee10b,null));};exports[_0x614d('0x22')]=function(_0xb01898,_0x56a7d1){if(_0xb01898[_0x614d('0x45')]['id']){delete _0xb01898[_0x614d('0x45')]['id'];}return db[_0x614d('0x3d')][_0x614d('0x43')]({'where':{'id':_0xb01898[_0x614d('0x41')]['id']}})[_0x614d('0x23')](handleEntityNotFound(_0x56a7d1,null))[_0x614d('0x23')](saveUpdates(_0xb01898[_0x614d('0x45')],null))[_0x614d('0x23')](respondWithResult(_0x56a7d1,null))[_0x614d('0x3f')](handleError(_0x56a7d1,null));};exports[_0x614d('0x46')]=function(_0x3ba268,_0xb86a13){return db[_0x614d('0x3d')][_0x614d('0x43')]({'where':{'id':_0x3ba268[_0x614d('0x41')]['id']}})[_0x614d('0x23')](handleEntityNotFound(_0xb86a13,null))[_0x614d('0x23')](removeEntity(_0xb86a13,null))['catch'](handleError(_0xb86a13,null));};exports[_0x614d('0x47')]=function(_0x42f5ef,_0x35d97c,_0x586019){var _0x3efed5={};var _0x5208de={};var _0x4a5f53;var _0x114038;return db[_0x614d('0x3d')][_0x614d('0x48')]({'where':{'id':_0x42f5ef[_0x614d('0x41')]['id']}})[_0x614d('0x23')](handleEntityNotFound(_0x35d97c,null))[_0x614d('0x23')](function(_0xdad3b3){if(_0xdad3b3){_0x4a5f53=_0xdad3b3;_0x5208de[_0x614d('0x2d')]=_[_0x614d('0x2b')](db[_0x614d('0x49')][_0x614d('0x29')]);_0x5208de['query']=_[_0x614d('0x2b')](_0x42f5ef[_0x614d('0x30')]);_0x5208de[_0x614d('0x37')]=_[_0x614d('0x2c')](_0x5208de[_0x614d('0x2d')],_0x5208de[_0x614d('0x30')]);_0x3efed5[_0x614d('0x2e')]=_[_0x614d('0x2c')](_0x5208de[_0x614d('0x2d')],qs[_0x614d('0x2f')](_0x42f5ef[_0x614d('0x30')][_0x614d('0x2f')]));_0x3efed5['attributes']=_0x3efed5[_0x614d('0x2e')][_0x614d('0x31')]?_0x3efed5['attributes']:_0x5208de[_0x614d('0x2d')];_0x3efed5[_0x614d('0x33')]=qs[_0x614d('0x34')](_0x42f5ef[_0x614d('0x30')][_0x614d('0x34')]);_0x3efed5['where']=qs[_0x614d('0x37')](_[_0x614d('0x36')](_0x42f5ef['query'],_0x5208de[_0x614d('0x37')]));if(_0x42f5ef['query'][_0x614d('0x38')]){_0x3efed5[_0x614d('0x35')]=_[_0x614d('0x39')](_0x3efed5['where'],{'$or':_[_0x614d('0x28')](_0x3efed5['attributes'],function(_0x28db52){var _0x213391={};_0x213391[_0x28db52]={'$like':'%'+_0x42f5ef[_0x614d('0x30')][_0x614d('0x38')]+'%'};return _0x213391;})});}_0x3efed5=_[_0x614d('0x39')]({},_0x3efed5,_0x42f5ef['options']);return _0x4a5f53['getFields'](_0x3efed5);}})[_0x614d('0x23')](function(_0x210168){if(_0x210168){_0x114038=_0x210168[_0x614d('0x31')];if(!_0x42f5ef['query']['hasOwnProperty'](_0x614d('0x32'))){_0x3efed5['limit']=qs[_0x614d('0x1f')](_0x42f5ef[_0x614d('0x30')]['limit']);_0x3efed5[_0x614d('0x1d')]=qs[_0x614d('0x1d')](_0x42f5ef[_0x614d('0x30')][_0x614d('0x1d')]);}return _0x4a5f53['getFields'](_0x3efed5);}})[_0x614d('0x23')](function(_0x2b0730){if(_0x2b0730){return _0x2b0730?{'count':_0x114038,'rows':_0x2b0730}:null;}})['then'](respondWithResult(_0x35d97c,null))[_0x614d('0x3f')](handleError(_0x35d97c,null));};exports['getSubjects']=function(_0x3f4695,_0x15eda2,_0x3a2614){var _0x44b230={};var _0x30bf47={};var _0x2089d2;var _0xe43724;return db['ZendeskConfiguration'][_0x614d('0x48')]({'where':{'id':_0x3f4695[_0x614d('0x41')]['id']}})[_0x614d('0x23')](handleEntityNotFound(_0x15eda2,null))[_0x614d('0x23')](function(_0x230016){if(_0x230016){_0x2089d2=_0x230016;_0x30bf47[_0x614d('0x2d')]=_[_0x614d('0x2b')](db[_0x614d('0x49')][_0x614d('0x29')]);_0x30bf47[_0x614d('0x30')]=_[_0x614d('0x2b')](_0x3f4695['query']);_0x30bf47['filters']=_[_0x614d('0x2c')](_0x30bf47[_0x614d('0x2d')],_0x30bf47[_0x614d('0x30')]);_0x44b230[_0x614d('0x2e')]=_[_0x614d('0x2c')](_0x30bf47[_0x614d('0x2d')],qs[_0x614d('0x2f')](_0x3f4695['query'][_0x614d('0x2f')]));_0x44b230[_0x614d('0x2e')]=_0x44b230['attributes'][_0x614d('0x31')]?_0x44b230[_0x614d('0x2e')]:_0x30bf47[_0x614d('0x2d')];_0x44b230[_0x614d('0x33')]=qs[_0x614d('0x34')](_0x3f4695[_0x614d('0x30')]['sort']);_0x44b230['where']=qs['filters'](_[_0x614d('0x36')](_0x3f4695[_0x614d('0x30')],_0x30bf47[_0x614d('0x37')]));if(_0x3f4695[_0x614d('0x30')][_0x614d('0x38')]){_0x44b230[_0x614d('0x35')]=_['merge'](_0x44b230[_0x614d('0x35')],{'$or':_['map'](_0x44b230[_0x614d('0x2e')],function(_0x254b48){var _0x2a8c24={};_0x2a8c24[_0x254b48]={'$like':'%'+_0x3f4695['query'][_0x614d('0x38')]+'%'};return _0x2a8c24;})});}_0x44b230=_[_0x614d('0x39')]({},_0x44b230,_0x3f4695[_0x614d('0x3b')]);return _0x2089d2['getSubjects'](_0x44b230);}})[_0x614d('0x23')](function(_0x57cb80){if(_0x57cb80){_0xe43724=_0x57cb80['length'];if(!_0x3f4695[_0x614d('0x30')][_0x614d('0x4a')](_0x614d('0x32'))){_0x44b230['limit']=qs[_0x614d('0x1f')](_0x3f4695[_0x614d('0x30')][_0x614d('0x1f')]);_0x44b230[_0x614d('0x1d')]=qs['offset'](_0x3f4695[_0x614d('0x30')]['offset']);}return _0x2089d2[_0x614d('0x4b')](_0x44b230);}})[_0x614d('0x23')](function(_0x4ea549){if(_0x4ea549){return _0x4ea549?{'count':_0xe43724,'rows':_0x4ea549}:null;}})['then'](respondWithResult(_0x15eda2,null))['catch'](handleError(_0x15eda2,null));};exports[_0x614d('0x4c')]=function(_0x245fe7,_0x2b56e6,_0x470f76){var _0x27485b={};var _0x49f409={};var _0x35f2e2;var _0x9dfedc;return db[_0x614d('0x3d')]['findOne']({'where':{'id':_0x245fe7['params']['id']}})['then'](handleEntityNotFound(_0x2b56e6,null))[_0x614d('0x23')](function(_0x597850){if(_0x597850){_0x35f2e2=_0x597850;_0x49f409[_0x614d('0x2d')]=_[_0x614d('0x2b')](db[_0x614d('0x49')]['rawAttributes']);_0x49f409['query']=_['keys'](_0x245fe7['query']);_0x49f409[_0x614d('0x37')]=_[_0x614d('0x2c')](_0x49f409[_0x614d('0x2d')],_0x49f409['query']);_0x27485b[_0x614d('0x2e')]=_[_0x614d('0x2c')](_0x49f409[_0x614d('0x2d')],qs[_0x614d('0x2f')](_0x245fe7[_0x614d('0x30')][_0x614d('0x2f')]));_0x27485b['attributes']=_0x27485b[_0x614d('0x2e')][_0x614d('0x31')]?_0x27485b[_0x614d('0x2e')]:_0x49f409[_0x614d('0x2d')];_0x27485b[_0x614d('0x33')]=qs[_0x614d('0x34')](_0x245fe7[_0x614d('0x30')]['sort']);_0x27485b[_0x614d('0x35')]=qs[_0x614d('0x37')](_[_0x614d('0x36')](_0x245fe7['query'],_0x49f409[_0x614d('0x37')]));if(_0x245fe7[_0x614d('0x30')][_0x614d('0x38')]){_0x27485b[_0x614d('0x35')]=_['merge'](_0x27485b[_0x614d('0x35')],{'$or':_['map'](_0x27485b[_0x614d('0x2e')],function(_0xc0401a){var _0xd3bbd={};_0xd3bbd[_0xc0401a]={'$like':'%'+_0x245fe7[_0x614d('0x30')][_0x614d('0x38')]+'%'};return _0xd3bbd;})});}_0x27485b=_[_0x614d('0x39')]({},_0x27485b,_0x245fe7['options']);return _0x35f2e2['getDescriptions'](_0x27485b);}})[_0x614d('0x23')](function(_0x4c1a85){if(_0x4c1a85){_0x9dfedc=_0x4c1a85['length'];if(!_0x245fe7[_0x614d('0x30')][_0x614d('0x4a')](_0x614d('0x32'))){_0x27485b[_0x614d('0x1f')]=qs[_0x614d('0x1f')](_0x245fe7['query'][_0x614d('0x1f')]);_0x27485b['offset']=qs[_0x614d('0x1d')](_0x245fe7['query'][_0x614d('0x1d')]);}return _0x35f2e2[_0x614d('0x4c')](_0x27485b);}})['then'](function(_0x11a08a){if(_0x11a08a){return _0x11a08a?{'count':_0x9dfedc,'rows':_0x11a08a}:null;}})[_0x614d('0x23')](respondWithResult(_0x2b56e6,null))['catch'](handleError(_0x2b56e6,null));};exports[_0x614d('0x4d')]=function(_0x3fffca,_0x36fd6f,_0x2e7618){var _0x4ee17f={};var _0x57aac4={};var _0x3e9c68;var _0x403c1c;return db[_0x614d('0x3d')][_0x614d('0x48')]({'where':{'id':_0x3fffca[_0x614d('0x41')]['id']}})['then'](handleEntityNotFound(_0x36fd6f,null))[_0x614d('0x23')](function(_0x34ab6a){if(_0x34ab6a){_0x3e9c68=_0x34ab6a;_0x57aac4['model']=_['keys'](db[_0x614d('0x4e')]['rawAttributes']);_0x57aac4['query']=_[_0x614d('0x2b')](_0x3fffca[_0x614d('0x30')]);_0x57aac4[_0x614d('0x37')]=_[_0x614d('0x2c')](_0x57aac4['model'],_0x57aac4[_0x614d('0x30')]);_0x4ee17f[_0x614d('0x2e')]=_[_0x614d('0x2c')](_0x57aac4[_0x614d('0x2d')],qs[_0x614d('0x2f')](_0x3fffca['query'][_0x614d('0x2f')]));_0x4ee17f['attributes']=_0x4ee17f[_0x614d('0x2e')][_0x614d('0x31')]?_0x4ee17f[_0x614d('0x2e')]:_0x57aac4[_0x614d('0x2d')];_0x4ee17f[_0x614d('0x33')]=qs[_0x614d('0x34')](_0x3fffca['query']['sort']);_0x4ee17f[_0x614d('0x35')]=qs[_0x614d('0x37')](_[_0x614d('0x36')](_0x3fffca[_0x614d('0x30')],_0x57aac4[_0x614d('0x37')]));if(_0x3fffca[_0x614d('0x30')]['filter']){_0x4ee17f[_0x614d('0x35')]=_[_0x614d('0x39')](_0x4ee17f[_0x614d('0x35')],{'$or':_[_0x614d('0x28')](_0x4ee17f[_0x614d('0x2e')],function(_0x22e21a){var _0x26d248={};_0x26d248[_0x22e21a]={'$like':'%'+_0x3fffca[_0x614d('0x30')][_0x614d('0x38')]+'%'};return _0x26d248;})});}_0x4ee17f=_[_0x614d('0x39')]({},_0x4ee17f,_0x3fffca['options']);return _0x3e9c68['getTags'](_0x4ee17f);}})[_0x614d('0x23')](function(_0x56248d){if(_0x56248d){_0x403c1c=_0x56248d[_0x614d('0x31')];if(!_0x3fffca[_0x614d('0x30')][_0x614d('0x4a')](_0x614d('0x32'))){_0x4ee17f[_0x614d('0x1f')]=qs[_0x614d('0x1f')](_0x3fffca[_0x614d('0x30')][_0x614d('0x1f')]);_0x4ee17f[_0x614d('0x1d')]=qs[_0x614d('0x1d')](_0x3fffca[_0x614d('0x30')][_0x614d('0x1d')]);}return _0x3e9c68['getTags'](_0x4ee17f);}})['then'](function(_0x134776){if(_0x134776){return _0x134776?{'count':_0x403c1c,'rows':_0x134776}:null;}})['then'](respondWithResult(_0x36fd6f,null))[_0x614d('0x3f')](handleError(_0x36fd6f,null));};exports['setTags']=function(_0x2f2669,_0x4ff1b8,_0x4c0b63){if(_0x2f2669[_0x614d('0x45')]['id']){delete _0x2f2669[_0x614d('0x45')]['id'];}return db[_0x614d('0x3d')][_0x614d('0x48')]({'where':{'id':_0x2f2669[_0x614d('0x41')]['id']}})[_0x614d('0x23')](handleEntityNotFound(_0x4ff1b8,null))[_0x614d('0x23')](function(_0x1cf18c){if(_0x1cf18c){return _0x1cf18c[_0x614d('0x4f')](_0x2f2669[_0x614d('0x45')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4ff1b8,null))[_0x614d('0x3f')](handleError(_0x4ff1b8,null));}; \ No newline at end of file +var _0x0077=['attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','keys','options','find','create','body','params','catch','destroy','getFields','ZendeskField','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','error','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','filters','intersection','query'];(function(_0x4031bd,_0x467553){var _0x5ed562=function(_0xdbccde){while(--_0xdbccde){_0x4031bd['push'](_0x4031bd['shift']());}};_0x5ed562(++_0x467553);}(_0x0077,0xbf));var _0x7007=function(_0x4d89cd,_0x250b1a){_0x4d89cd=_0x4d89cd-0x0;var _0x4e6d96=_0x0077[_0x4d89cd];return _0x4e6d96;};'use strict';var emlformat=require(_0x7007('0x0'));var rimraf=require(_0x7007('0x1'));var zipdir=require(_0x7007('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7007('0x3'));var moment=require('moment');var BPromise=require(_0x7007('0x4'));var Mustache=require(_0x7007('0x5'));var util=require(_0x7007('0x6'));var path=require(_0x7007('0x7'));var sox=require(_0x7007('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7007('0x9'));var _=require(_0x7007('0xa'));var squel=require(_0x7007('0xb'));var crypto=require(_0x7007('0xc'));var jsforce=require(_0x7007('0xd'));var deskjs=require(_0x7007('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7007('0xf'));var Papa=require(_0x7007('0x10'));var Redis=require('ioredis');var authService=require(_0x7007('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7007('0x12'));var logger=require(_0x7007('0x13'))('api');var utils=require(_0x7007('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7007('0x15'));var db=require(_0x7007('0x16'))['db'];function respondWithStatusCode(_0x1e1763,_0x375347){_0x375347=_0x375347||0xcc;return function(_0x4096cb){if(_0x4096cb){return _0x1e1763[_0x7007('0x17')](_0x375347);}return _0x1e1763[_0x7007('0x18')](_0x375347)[_0x7007('0x19')]();};}function respondWithResult(_0x4f0e80,_0x10f73f){_0x10f73f=_0x10f73f||0xc8;return function(_0x102753){if(_0x102753){return _0x4f0e80[_0x7007('0x18')](_0x10f73f)['json'](_0x102753);}};}function respondWithFilteredResult(_0x5c947b,_0x5b81fb){return function(_0x46b55f){if(_0x46b55f){var _0x115bc4=typeof _0x5b81fb[_0x7007('0x1a')]===_0x7007('0x1b')&&typeof _0x5b81fb[_0x7007('0x1c')]==='undefined';var _0x42a74e=_0x46b55f['count'];var _0x572c66=_0x115bc4?0x0:_0x5b81fb[_0x7007('0x1a')];var _0x45edd3=_0x115bc4?_0x46b55f[_0x7007('0x1d')]:_0x5b81fb['offset']+_0x5b81fb[_0x7007('0x1c')];var _0x444ce7;if(_0x45edd3>=_0x42a74e){_0x45edd3=_0x42a74e;_0x444ce7=0xc8;}else{_0x444ce7=0xce;}_0x5c947b['status'](_0x444ce7);return _0x5c947b['set'](_0x7007('0x1e'),_0x572c66+'-'+_0x45edd3+'/'+_0x42a74e)[_0x7007('0x1f')](_0x46b55f);}return null;};}function patchUpdates(_0x530b40){return function(_0x5d9fd7){try{jsonpatch['apply'](_0x5d9fd7,_0x530b40,!![]);}catch(_0x64005c){return BPromise['reject'](_0x64005c);}return _0x5d9fd7[_0x7007('0x20')]();};}function saveUpdates(_0x5ca83b,_0x11ae8a){return function(_0x4d0463){if(_0x4d0463){return _0x4d0463[_0x7007('0x21')](_0x5ca83b)[_0x7007('0x22')](function(_0x44273c){return _0x44273c;});}return null;};}function removeEntity(_0x5f6b35,_0x1c25cc){return function(_0x2f9fd8){if(_0x2f9fd8){return _0x2f9fd8['destroy']()[_0x7007('0x22')](function(){_0x5f6b35[_0x7007('0x18')](0xcc)[_0x7007('0x19')]();});}};}function handleEntityNotFound(_0x2363eb,_0x569417){return function(_0x163fb8){if(!_0x163fb8){_0x2363eb[_0x7007('0x17')](0x194);}return _0x163fb8;};}function handleError(_0x29cfc7,_0x23672c){_0x23672c=_0x23672c||0x1f4;return function(_0x48c196){logger[_0x7007('0x23')](_0x48c196[_0x7007('0x24')]);if(_0x48c196[_0x7007('0x25')]){delete _0x48c196[_0x7007('0x25')];}_0x29cfc7[_0x7007('0x18')](_0x23672c)['send'](_0x48c196);};}exports[_0x7007('0x26')]=function(_0x554a8b,_0x245387){var _0x13213f={},_0x404fba={},_0x966d99={'count':0x0,'rows':[]};var _0x222da5=_['map'](db[_0x7007('0x27')][_0x7007('0x28')],function(_0x3acb63){return{'name':_0x3acb63[_0x7007('0x29')],'type':_0x3acb63[_0x7007('0x2a')][_0x7007('0x2b')]};});_0x404fba[_0x7007('0x2c')]=_[_0x7007('0x2d')](_0x222da5,_0x7007('0x25'));_0x404fba['query']=_['keys'](_0x554a8b['query']);_0x404fba[_0x7007('0x2e')]=_[_0x7007('0x2f')](_0x404fba[_0x7007('0x2c')],_0x404fba[_0x7007('0x30')]);_0x13213f[_0x7007('0x31')]=_[_0x7007('0x2f')](_0x404fba['model'],qs[_0x7007('0x32')](_0x554a8b[_0x7007('0x30')][_0x7007('0x32')]));_0x13213f[_0x7007('0x31')]=_0x13213f[_0x7007('0x31')][_0x7007('0x33')]?_0x13213f[_0x7007('0x31')]:_0x404fba['model'];if(!_0x554a8b[_0x7007('0x30')]['hasOwnProperty'](_0x7007('0x34'))){_0x13213f[_0x7007('0x1c')]=qs[_0x7007('0x1c')](_0x554a8b[_0x7007('0x30')][_0x7007('0x1c')]);_0x13213f['offset']=qs['offset'](_0x554a8b[_0x7007('0x30')][_0x7007('0x1a')]);}_0x13213f[_0x7007('0x35')]=qs[_0x7007('0x36')](_0x554a8b['query']['sort']);_0x13213f[_0x7007('0x37')]=qs['filters'](_['pick'](_0x554a8b[_0x7007('0x30')],_0x404fba[_0x7007('0x2e')]),_0x222da5);if(_0x554a8b['query'][_0x7007('0x38')]){_0x13213f[_0x7007('0x37')]=_[_0x7007('0x39')](_0x13213f[_0x7007('0x37')],{'$or':_[_0x7007('0x2d')](_0x222da5,function(_0x7a659a){if(_0x7a659a[_0x7007('0x2a')]!==_0x7007('0x3a')){var _0x371776={};_0x371776[_0x7a659a[_0x7007('0x25')]]={'$like':'%'+_0x554a8b[_0x7007('0x30')][_0x7007('0x38')]+'%'};return _0x371776;}})});}_0x13213f=_[_0x7007('0x39')]({},_0x13213f,_0x554a8b['options']);var _0x3a1778={'where':_0x13213f['where']};return db[_0x7007('0x27')][_0x7007('0x1d')](_0x3a1778)['then'](function(_0x1058e1){_0x966d99[_0x7007('0x1d')]=_0x1058e1;if(_0x554a8b['query'][_0x7007('0x3b')]){_0x13213f[_0x7007('0x3c')]=[{'all':!![]}];}return db[_0x7007('0x27')]['findAll'](_0x13213f);})[_0x7007('0x22')](function(_0x114192){_0x966d99['rows']=_0x114192;return _0x966d99;})[_0x7007('0x22')](respondWithFilteredResult(_0x245387,_0x13213f))['catch'](handleError(_0x245387,null));};exports['show']=function(_0xad7524,_0x193b52){var _0x161160={'raw':![],'where':{'id':_0xad7524['params']['id']}},_0x4cf201={};_0x4cf201[_0x7007('0x2c')]=_[_0x7007('0x3d')](db[_0x7007('0x27')][_0x7007('0x28')]);_0x4cf201[_0x7007('0x30')]=_[_0x7007('0x3d')](_0xad7524[_0x7007('0x30')]);_0x4cf201['filters']=_['intersection'](_0x4cf201[_0x7007('0x2c')],_0x4cf201[_0x7007('0x30')]);_0x161160[_0x7007('0x31')]=_[_0x7007('0x2f')](_0x4cf201['model'],qs[_0x7007('0x32')](_0xad7524[_0x7007('0x30')]['fields']));_0x161160['attributes']=_0x161160[_0x7007('0x31')][_0x7007('0x33')]?_0x161160[_0x7007('0x31')]:_0x4cf201['model'];if(_0xad7524['query']['includeAll']){_0x161160[_0x7007('0x3c')]=[{'all':!![]}];}_0x161160=_['merge']({},_0x161160,_0xad7524[_0x7007('0x3e')]);return db[_0x7007('0x27')][_0x7007('0x3f')](_0x161160)[_0x7007('0x22')](handleEntityNotFound(_0x193b52,null))[_0x7007('0x22')](respondWithResult(_0x193b52,null))['catch'](handleError(_0x193b52,null));};exports['create']=function(_0xface1e,_0xb2a84f){return db[_0x7007('0x27')][_0x7007('0x40')](_0xface1e[_0x7007('0x41')],{})[_0x7007('0x22')](respondWithResult(_0xb2a84f,0xc9))['catch'](handleError(_0xb2a84f,null));};exports[_0x7007('0x21')]=function(_0x58a3a2,_0xcf8d15){if(_0x58a3a2[_0x7007('0x41')]['id']){delete _0x58a3a2[_0x7007('0x41')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x58a3a2[_0x7007('0x42')]['id']}})[_0x7007('0x22')](handleEntityNotFound(_0xcf8d15,null))[_0x7007('0x22')](saveUpdates(_0x58a3a2[_0x7007('0x41')],null))[_0x7007('0x22')](respondWithResult(_0xcf8d15,null))[_0x7007('0x43')](handleError(_0xcf8d15,null));};exports[_0x7007('0x44')]=function(_0x39c438,_0x394bae){return db[_0x7007('0x27')][_0x7007('0x3f')]({'where':{'id':_0x39c438[_0x7007('0x42')]['id']}})['then'](handleEntityNotFound(_0x394bae,null))[_0x7007('0x22')](removeEntity(_0x394bae,null))[_0x7007('0x43')](handleError(_0x394bae,null));};exports[_0x7007('0x45')]=function(_0x18d9db,_0x382999,_0x593877){var _0x771c5a={};var _0x47b348={};var _0xe74d2e;var _0x4241fb;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x18d9db[_0x7007('0x42')]['id']}})['then'](handleEntityNotFound(_0x382999,null))[_0x7007('0x22')](function(_0x24801f){if(_0x24801f){_0xe74d2e=_0x24801f;_0x47b348[_0x7007('0x2c')]=_[_0x7007('0x3d')](db[_0x7007('0x46')]['rawAttributes']);_0x47b348['query']=_[_0x7007('0x3d')](_0x18d9db[_0x7007('0x30')]);_0x47b348[_0x7007('0x2e')]=_[_0x7007('0x2f')](_0x47b348[_0x7007('0x2c')],_0x47b348[_0x7007('0x30')]);_0x771c5a['attributes']=_[_0x7007('0x2f')](_0x47b348[_0x7007('0x2c')],qs[_0x7007('0x32')](_0x18d9db[_0x7007('0x30')][_0x7007('0x32')]));_0x771c5a['attributes']=_0x771c5a['attributes'][_0x7007('0x33')]?_0x771c5a[_0x7007('0x31')]:_0x47b348['model'];_0x771c5a[_0x7007('0x35')]=qs[_0x7007('0x36')](_0x18d9db['query'][_0x7007('0x36')]);_0x771c5a[_0x7007('0x37')]=qs['filters'](_[_0x7007('0x47')](_0x18d9db[_0x7007('0x30')],_0x47b348[_0x7007('0x2e')]));if(_0x18d9db[_0x7007('0x30')][_0x7007('0x38')]){_0x771c5a[_0x7007('0x37')]=_['merge'](_0x771c5a[_0x7007('0x37')],{'$or':_[_0x7007('0x2d')](_0x771c5a['attributes'],function(_0x4a847e){var _0x59e083={};_0x59e083[_0x4a847e]={'$like':'%'+_0x18d9db[_0x7007('0x30')][_0x7007('0x38')]+'%'};return _0x59e083;})});}_0x771c5a=_[_0x7007('0x39')]({},_0x771c5a,_0x18d9db[_0x7007('0x3e')]);return _0xe74d2e['getFields'](_0x771c5a);}})[_0x7007('0x22')](function(_0x4ac4e8){if(_0x4ac4e8){_0x4241fb=_0x4ac4e8[_0x7007('0x33')];if(!_0x18d9db[_0x7007('0x30')][_0x7007('0x48')](_0x7007('0x34'))){_0x771c5a[_0x7007('0x1c')]=qs[_0x7007('0x1c')](_0x18d9db[_0x7007('0x30')][_0x7007('0x1c')]);_0x771c5a[_0x7007('0x1a')]=qs[_0x7007('0x1a')](_0x18d9db['query']['offset']);}return _0xe74d2e['getFields'](_0x771c5a);}})[_0x7007('0x22')](function(_0x2103ba){if(_0x2103ba){return _0x2103ba?{'count':_0x4241fb,'rows':_0x2103ba}:null;}})[_0x7007('0x22')](respondWithResult(_0x382999,null))[_0x7007('0x43')](handleError(_0x382999,null));};exports[_0x7007('0x49')]=function(_0x32fce9,_0x46e36f,_0x4dd6e9){var _0x1efd19={};var _0x2070c4={};var _0x239943;var _0xec0750;return db[_0x7007('0x27')][_0x7007('0x4a')]({'where':{'id':_0x32fce9[_0x7007('0x42')]['id']}})[_0x7007('0x22')](handleEntityNotFound(_0x46e36f,null))[_0x7007('0x22')](function(_0x51400c){if(_0x51400c){_0x239943=_0x51400c;_0x2070c4['model']=_[_0x7007('0x3d')](db[_0x7007('0x46')][_0x7007('0x28')]);_0x2070c4[_0x7007('0x30')]=_[_0x7007('0x3d')](_0x32fce9[_0x7007('0x30')]);_0x2070c4[_0x7007('0x2e')]=_[_0x7007('0x2f')](_0x2070c4['model'],_0x2070c4[_0x7007('0x30')]);_0x1efd19[_0x7007('0x31')]=_[_0x7007('0x2f')](_0x2070c4[_0x7007('0x2c')],qs[_0x7007('0x32')](_0x32fce9['query'][_0x7007('0x32')]));_0x1efd19[_0x7007('0x31')]=_0x1efd19['attributes']['length']?_0x1efd19[_0x7007('0x31')]:_0x2070c4[_0x7007('0x2c')];_0x1efd19[_0x7007('0x35')]=qs[_0x7007('0x36')](_0x32fce9[_0x7007('0x30')][_0x7007('0x36')]);_0x1efd19['where']=qs['filters'](_['pick'](_0x32fce9[_0x7007('0x30')],_0x2070c4['filters']));if(_0x32fce9[_0x7007('0x30')][_0x7007('0x38')]){_0x1efd19[_0x7007('0x37')]=_['merge'](_0x1efd19['where'],{'$or':_[_0x7007('0x2d')](_0x1efd19[_0x7007('0x31')],function(_0x11b395){var _0x32744c={};_0x32744c[_0x11b395]={'$like':'%'+_0x32fce9[_0x7007('0x30')][_0x7007('0x38')]+'%'};return _0x32744c;})});}_0x1efd19=_['merge']({},_0x1efd19,_0x32fce9[_0x7007('0x3e')]);return _0x239943[_0x7007('0x49')](_0x1efd19);}})[_0x7007('0x22')](function(_0x446992){if(_0x446992){_0xec0750=_0x446992[_0x7007('0x33')];if(!_0x32fce9[_0x7007('0x30')]['hasOwnProperty'](_0x7007('0x34'))){_0x1efd19[_0x7007('0x1c')]=qs[_0x7007('0x1c')](_0x32fce9[_0x7007('0x30')]['limit']);_0x1efd19[_0x7007('0x1a')]=qs['offset'](_0x32fce9['query'][_0x7007('0x1a')]);}return _0x239943[_0x7007('0x49')](_0x1efd19);}})[_0x7007('0x22')](function(_0x3868e7){if(_0x3868e7){return _0x3868e7?{'count':_0xec0750,'rows':_0x3868e7}:null;}})[_0x7007('0x22')](respondWithResult(_0x46e36f,null))[_0x7007('0x43')](handleError(_0x46e36f,null));};exports['getDescriptions']=function(_0x155114,_0x1650f7,_0x860089){var _0x3034bf={};var _0x24dfcf={};var _0x169694;var _0x3c1077;return db[_0x7007('0x27')][_0x7007('0x4a')]({'where':{'id':_0x155114['params']['id']}})[_0x7007('0x22')](handleEntityNotFound(_0x1650f7,null))[_0x7007('0x22')](function(_0x5a1a14){if(_0x5a1a14){_0x169694=_0x5a1a14;_0x24dfcf['model']=_[_0x7007('0x3d')](db['ZendeskField'][_0x7007('0x28')]);_0x24dfcf[_0x7007('0x30')]=_[_0x7007('0x3d')](_0x155114['query']);_0x24dfcf['filters']=_[_0x7007('0x2f')](_0x24dfcf['model'],_0x24dfcf[_0x7007('0x30')]);_0x3034bf[_0x7007('0x31')]=_['intersection'](_0x24dfcf[_0x7007('0x2c')],qs[_0x7007('0x32')](_0x155114[_0x7007('0x30')][_0x7007('0x32')]));_0x3034bf[_0x7007('0x31')]=_0x3034bf['attributes'][_0x7007('0x33')]?_0x3034bf[_0x7007('0x31')]:_0x24dfcf[_0x7007('0x2c')];_0x3034bf[_0x7007('0x35')]=qs[_0x7007('0x36')](_0x155114[_0x7007('0x30')][_0x7007('0x36')]);_0x3034bf['where']=qs['filters'](_[_0x7007('0x47')](_0x155114['query'],_0x24dfcf[_0x7007('0x2e')]));if(_0x155114[_0x7007('0x30')][_0x7007('0x38')]){_0x3034bf[_0x7007('0x37')]=_[_0x7007('0x39')](_0x3034bf['where'],{'$or':_[_0x7007('0x2d')](_0x3034bf['attributes'],function(_0x2c6c71){var _0x307f39={};_0x307f39[_0x2c6c71]={'$like':'%'+_0x155114['query']['filter']+'%'};return _0x307f39;})});}_0x3034bf=_[_0x7007('0x39')]({},_0x3034bf,_0x155114['options']);return _0x169694[_0x7007('0x4b')](_0x3034bf);}})[_0x7007('0x22')](function(_0x1416c3){if(_0x1416c3){_0x3c1077=_0x1416c3[_0x7007('0x33')];if(!_0x155114['query'][_0x7007('0x48')]('nolimit')){_0x3034bf[_0x7007('0x1c')]=qs[_0x7007('0x1c')](_0x155114[_0x7007('0x30')][_0x7007('0x1c')]);_0x3034bf['offset']=qs[_0x7007('0x1a')](_0x155114[_0x7007('0x30')]['offset']);}return _0x169694[_0x7007('0x4b')](_0x3034bf);}})[_0x7007('0x22')](function(_0x5da021){if(_0x5da021){return _0x5da021?{'count':_0x3c1077,'rows':_0x5da021}:null;}})[_0x7007('0x22')](respondWithResult(_0x1650f7,null))[_0x7007('0x43')](handleError(_0x1650f7,null));};exports[_0x7007('0x4c')]=function(_0x2ac372,_0x49e455,_0x445865){var _0x4d8791={};var _0x402e9a={};var _0x88763d;var _0x16d7b1;return db['ZendeskConfiguration'][_0x7007('0x4a')]({'where':{'id':_0x2ac372[_0x7007('0x42')]['id']}})[_0x7007('0x22')](handleEntityNotFound(_0x49e455,null))[_0x7007('0x22')](function(_0x2d59ef){if(_0x2d59ef){_0x88763d=_0x2d59ef;_0x402e9a['model']=_[_0x7007('0x3d')](db[_0x7007('0x4d')][_0x7007('0x28')]);_0x402e9a['query']=_['keys'](_0x2ac372[_0x7007('0x30')]);_0x402e9a[_0x7007('0x2e')]=_['intersection'](_0x402e9a[_0x7007('0x2c')],_0x402e9a[_0x7007('0x30')]);_0x4d8791['attributes']=_['intersection'](_0x402e9a[_0x7007('0x2c')],qs['fields'](_0x2ac372[_0x7007('0x30')][_0x7007('0x32')]));_0x4d8791[_0x7007('0x31')]=_0x4d8791['attributes'][_0x7007('0x33')]?_0x4d8791['attributes']:_0x402e9a[_0x7007('0x2c')];_0x4d8791[_0x7007('0x35')]=qs['sort'](_0x2ac372[_0x7007('0x30')][_0x7007('0x36')]);_0x4d8791[_0x7007('0x37')]=qs[_0x7007('0x2e')](_[_0x7007('0x47')](_0x2ac372[_0x7007('0x30')],_0x402e9a[_0x7007('0x2e')]));if(_0x2ac372[_0x7007('0x30')][_0x7007('0x38')]){_0x4d8791[_0x7007('0x37')]=_[_0x7007('0x39')](_0x4d8791['where'],{'$or':_[_0x7007('0x2d')](_0x4d8791[_0x7007('0x31')],function(_0x5a9bfc){var _0x112698={};_0x112698[_0x5a9bfc]={'$like':'%'+_0x2ac372['query'][_0x7007('0x38')]+'%'};return _0x112698;})});}_0x4d8791=_['merge']({},_0x4d8791,_0x2ac372[_0x7007('0x3e')]);return _0x88763d[_0x7007('0x4c')](_0x4d8791);}})[_0x7007('0x22')](function(_0x76e448){if(_0x76e448){_0x16d7b1=_0x76e448[_0x7007('0x33')];if(!_0x2ac372['query'][_0x7007('0x48')]('nolimit')){_0x4d8791[_0x7007('0x1c')]=qs[_0x7007('0x1c')](_0x2ac372[_0x7007('0x30')][_0x7007('0x1c')]);_0x4d8791[_0x7007('0x1a')]=qs[_0x7007('0x1a')](_0x2ac372[_0x7007('0x30')][_0x7007('0x1a')]);}return _0x88763d['getTags'](_0x4d8791);}})[_0x7007('0x22')](function(_0xb0a95c){if(_0xb0a95c){return _0xb0a95c?{'count':_0x16d7b1,'rows':_0xb0a95c}:null;}})['then'](respondWithResult(_0x49e455,null))[_0x7007('0x43')](handleError(_0x49e455,null));};exports[_0x7007('0x4e')]=function(_0x42f23e,_0x4450c3,_0x41ca05){if(_0x42f23e[_0x7007('0x41')]['id']){delete _0x42f23e[_0x7007('0x41')]['id'];}return db[_0x7007('0x27')]['findOne']({'where':{'id':_0x42f23e[_0x7007('0x42')]['id']}})['then'](handleEntityNotFound(_0x4450c3,null))['then'](function(_0x2d875e){if(_0x2d875e){return _0x2d875e[_0x7007('0x4e')](_0x42f23e['body'][_0x7007('0x4f')]||[]);}return null;})[_0x7007('0x22')](respondWithResult(_0x4450c3,null))[_0x7007('0x43')](handleError(_0x4450c3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a4b2bdd..0b1e172 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 _0x9ffd=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x406cdb,_0xbb5ecb){var _0x3965a0=function(_0x503797){while(--_0x503797){_0x406cdb['push'](_0x406cdb['shift']());}};_0x3965a0(++_0xbb5ecb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1db389,_0x57fbde){_0x1db389=_0x1db389-0x0;var _0x4036b9=_0x9ffd[_0x1db389];return _0x4036b9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','api'];(function(_0x54b0e2,_0x479890){var _0x3628f3=function(_0xbffc3b){while(--_0xbffc3b){_0x54b0e2['push'](_0x54b0e2['shift']());}};_0x3628f3(++_0x479890);}(_0xe511,0x16f));var _0x1e51=function(_0x27828f,_0x2617e2){_0x27828f=_0x27828f-0x0;var _0x4c8b4f=_0xe511[_0x27828f];return _0x4c8b4f;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 81de3d1..0cb1258 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 _0x8c05=['code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23777d,_0x540c97){var _0x3ac6da=function(_0x3f8f48){while(--_0x3f8f48){_0x23777d['push'](_0x23777d['shift']());}};_0x3ac6da(++_0x540c97);}(_0x8c05,0xb5));var _0x58c0=function(_0x15cc05,_0x526746){_0x15cc05=_0x15cc05-0x0;var _0x521808=_0x8c05[_0x15cc05];return _0x521808;};'use strict';var _=require(_0x58c0('0x0'));var util=require('util');var moment=require(_0x58c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x58c0('0x2'));var fs=require('fs');var Redis=require(_0x58c0('0x3'));var db=require(_0x58c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58c0('0x5'));var config=require(_0x58c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x58c0('0x7')][_0x58c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50deb9,_0x228b46,_0x13cf80){return new BPromise(function(_0x358485,_0x99d0c5){return client[_0x58c0('0x9')](_0x50deb9,_0x13cf80)[_0x58c0('0xa')](function(_0x2f2535){logger[_0x58c0('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x228b46,_0x58c0('0xc'));logger[_0x58c0('0xd')](_0x58c0('0xe'),_0x228b46,_0x58c0('0xc'),JSON[_0x58c0('0xf')](_0x2f2535));if(_0x2f2535[_0x58c0('0x10')]){if(_0x2f2535['error'][_0x58c0('0x11')]===0x1f4){logger[_0x58c0('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x228b46,_0x2f2535[_0x58c0('0x10')][_0x58c0('0x12')]);return _0x99d0c5(_0x2f2535[_0x58c0('0x10')][_0x58c0('0x12')]);}logger['error'](_0x58c0('0x13'),_0x228b46,_0x2f2535[_0x58c0('0x10')][_0x58c0('0x12')]);return _0x358485(_0x2f2535[_0x58c0('0x10')][_0x58c0('0x12')]);}else{logger['info'](_0x58c0('0x13'),_0x228b46,_0x58c0('0xc'));_0x358485(_0x2f2535[_0x58c0('0x14')][_0x58c0('0x12')]);}})[_0x58c0('0x15')](function(_0x58aed5){logger[_0x58c0('0x10')](_0x58c0('0x13'),_0x228b46,_0x58aed5);_0x99d0c5(_0x58aed5);});});} \ No newline at end of file +var _0x7440=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x304693,_0x10c573){var _0xaed0a1=function(_0x4bb1e4){while(--_0x4bb1e4){_0x304693['push'](_0x304693['shift']());}};_0xaed0a1(++_0x10c573);}(_0x7440,0x108));var _0x0744=function(_0x16adcb,_0x130abd){_0x16adcb=_0x16adcb-0x0;var _0x2a1997=_0x7440[_0x16adcb];return _0x2a1997;};'use strict';var _=require(_0x0744('0x0'));var util=require(_0x0744('0x1'));var moment=require(_0x0744('0x2'));var BPromise=require(_0x0744('0x3'));var rs=require(_0x0744('0x4'));var fs=require('fs');var Redis=require(_0x0744('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0744('0x6'));var config=require(_0x0744('0x7'));var jayson=require(_0x0744('0x8'));var client=jayson[_0x0744('0x9')][_0x0744('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1302,_0x5a0a38,_0x30814b){return new BPromise(function(_0xd66be4,_0x2dd4b6){return client[_0x0744('0xb')](_0x5f1302,_0x30814b)[_0x0744('0xc')](function(_0x3457fc){logger[_0x0744('0xd')](_0x0744('0xe'),_0x5a0a38,_0x0744('0xf'));logger[_0x0744('0x10')](_0x0744('0x11'),_0x5a0a38,'request\x20sent',JSON[_0x0744('0x12')](_0x3457fc));if(_0x3457fc[_0x0744('0x13')]){if(_0x3457fc[_0x0744('0x13')]['code']===0x1f4){logger[_0x0744('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5a0a38,_0x3457fc['error'][_0x0744('0x14')]);return _0x2dd4b6(_0x3457fc['error'][_0x0744('0x14')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5a0a38,_0x3457fc[_0x0744('0x13')][_0x0744('0x14')]);return _0xd66be4(_0x3457fc[_0x0744('0x13')][_0x0744('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5a0a38,'request\x20sent');_0xd66be4(_0x3457fc[_0x0744('0x15')][_0x0744('0x14')]);}})[_0x0744('0x16')](function(_0x2c456f){logger[_0x0744('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5a0a38,_0x2c456f);_0x2dd4b6(_0x2c456f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3e21dd3..6d87845 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 _0x27b1=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','get','index','/:id','isAuthenticated'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x27b1,0xe4));var _0x127b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x27b1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x127b('0x0'));var util=require('util');var path=require(_0x127b('0x1'));var timeout=require(_0x127b('0x2'));var express=require(_0x127b('0x3'));var router=express[_0x127b('0x4')]();var fs_extra=require(_0x127b('0x5'));var auth=require(_0x127b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x127b('0x7'));router[_0x127b('0x8')]('/',auth['isAuthenticated'](),controller[_0x127b('0x9')]);router['get'](_0x127b('0xa'),auth[_0x127b('0xb')](),controller[_0x127b('0xc')]);router[_0x127b('0xd')]('/',auth[_0x127b('0xb')](),controller[_0x127b('0xe')]);router[_0x127b('0xf')](_0x127b('0xa'),auth['isAuthenticated'](),controller[_0x127b('0x10')]);router[_0x127b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x127b('0x12')]);module[_0x127b('0x13')]=router; \ No newline at end of file +var _0x4b21=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x48e289,_0x4ac436){var _0x3406c6=function(_0x17a92d){while(--_0x17a92d){_0x48e289['push'](_0x48e289['shift']());}};_0x3406c6(++_0x4ac436);}(_0x4b21,0xc8));var _0x14b2=function(_0x2d97d5,_0x49e18c){_0x2d97d5=_0x2d97d5-0x0;var _0x504d86=_0x4b21[_0x2d97d5];return _0x504d86;};'use strict';var multer=require(_0x14b2('0x0'));var util=require(_0x14b2('0x1'));var path=require('path');var timeout=require(_0x14b2('0x2'));var express=require('express');var router=express[_0x14b2('0x3')]();var fs_extra=require(_0x14b2('0x4'));var auth=require(_0x14b2('0x5'));var interaction=require(_0x14b2('0x6'));var config=require(_0x14b2('0x7'));var controller=require(_0x14b2('0x8'));router['get']('/',auth[_0x14b2('0x9')](),controller[_0x14b2('0xa')]);router[_0x14b2('0xb')](_0x14b2('0xc'),auth[_0x14b2('0x9')](),controller[_0x14b2('0xd')]);router[_0x14b2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x14b2('0xf')](_0x14b2('0xc'),auth[_0x14b2('0x9')](),controller[_0x14b2('0x10')]);router[_0x14b2('0x11')](_0x14b2('0xc'),auth[_0x14b2('0x9')](),controller[_0x14b2('0x12')]);module[_0x14b2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ae5943a..e0aefc1 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 _0xb813=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x15ca74,_0x16d1e4){var _0x72f393=function(_0x151b74){while(--_0x151b74){_0x15ca74['push'](_0x15ca74['shift']());}};_0x72f393(++_0x16d1e4);}(_0xb813,0x144));var _0x3b81=function(_0x23bd0e,_0x37529f){_0x23bd0e=_0x23bd0e-0x0;var _0x48fa0f=_0xb813[_0x23bd0e];return _0x48fa0f;};'use strict';var Sequelize=require(_0x3b81('0x0'));module['exports']={'type':{'type':Sequelize[_0x3b81('0x1')](_0x3b81('0x2'),_0x3b81('0x3'),_0x3b81('0x4'),_0x3b81('0x5'),'picklist'),'defaultValue':_0x3b81('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x3b81('0x2'),_0x3b81('0x3'),_0x3b81('0x4'))},'keyContent':{'type':Sequelize[_0x3b81('0x6')]},'idField':{'type':Sequelize[_0x3b81('0x6')]},'nameField':{'type':Sequelize[_0x3b81('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90ca=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x2f3d16,_0x2cad43){var _0x45de8c=function(_0x3d773b){while(--_0x3d773b){_0x2f3d16['push'](_0x2f3d16['shift']());}};_0x45de8c(++_0x2cad43);}(_0x90ca,0x157));var _0xa90c=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x90ca[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xa90c('0x0'));module['exports']={'type':{'type':Sequelize[_0xa90c('0x1')](_0xa90c('0x2'),_0xa90c('0x3'),_0xa90c('0x4'),'keyValue',_0xa90c('0x5')),'defaultValue':_0xa90c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa90c('0x6')]},'keyType':{'type':Sequelize[_0xa90c('0x1')]('string',_0xa90c('0x3'),_0xa90c('0x4'))},'keyContent':{'type':Sequelize[_0xa90c('0x6')]},'idField':{'type':Sequelize[_0xa90c('0x6')]},'nameField':{'type':Sequelize[_0xa90c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8502b5e..ddd71ee 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 _0x138d=['error','name','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','filter','where','merge','options','ZendeskField','includeAll','include','findAll','rows','params','length','catch','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','then','destroy'];(function(_0x354b61,_0x3a611d){var _0x1aedb4=function(_0x45e8e8){while(--_0x45e8e8){_0x354b61['push'](_0x354b61['shift']());}};_0x1aedb4(++_0x3a611d);}(_0x138d,0x1ab));var _0xd138=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0x138d[_0x4147e6];return _0x3305ba;};'use strict';var emlformat=require(_0xd138('0x0'));var rimraf=require(_0xd138('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd138('0x2'));var rp=require(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var BPromise=require(_0xd138('0x5'));var Mustache=require(_0xd138('0x6'));var util=require(_0xd138('0x7'));var path=require('path');var sox=require(_0xd138('0x8'));var csv=require(_0xd138('0x9'));var ejs=require(_0xd138('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd138('0xb'));var squel=require(_0xd138('0xc'));var crypto=require(_0xd138('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd138('0x9'));var querystring=require(_0xd138('0xe'));var Papa=require(_0xd138('0xf'));var Redis=require('ioredis');var authService=require(_0xd138('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd138('0x11'));var logger=require(_0xd138('0x12'))(_0xd138('0x13'));var utils=require(_0xd138('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd138('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429f16,_0x29e963){_0x29e963=_0x29e963||0xcc;return function(_0x11ed68){if(_0x11ed68){return _0x429f16[_0xd138('0x16')](_0x29e963);}return _0x429f16[_0xd138('0x17')](_0x29e963)[_0xd138('0x18')]();};}function respondWithResult(_0x24f99,_0x297102){_0x297102=_0x297102||0xc8;return function(_0x402d2c){if(_0x402d2c){return _0x24f99[_0xd138('0x17')](_0x297102)[_0xd138('0x19')](_0x402d2c);}};}function respondWithFilteredResult(_0x1f4ac1,_0x5cbee9){return function(_0x1526e9){if(_0x1526e9){var _0x3f8932=typeof _0x5cbee9['offset']==='undefined'&&typeof _0x5cbee9['limit']===_0xd138('0x1a');var _0x3a0d9b=_0x1526e9['count'];var _0x43a67d=_0x3f8932?0x0:_0x5cbee9[_0xd138('0x1b')];var _0x421d25=_0x3f8932?_0x1526e9[_0xd138('0x1c')]:_0x5cbee9['offset']+_0x5cbee9[_0xd138('0x1d')];var _0x36f021;if(_0x421d25>=_0x3a0d9b){_0x421d25=_0x3a0d9b;_0x36f021=0xc8;}else{_0x36f021=0xce;}_0x1f4ac1[_0xd138('0x17')](_0x36f021);return _0x1f4ac1[_0xd138('0x1e')](_0xd138('0x1f'),_0x43a67d+'-'+_0x421d25+'/'+_0x3a0d9b)[_0xd138('0x19')](_0x1526e9);}return null;};}function patchUpdates(_0x1755e5){return function(_0x4bd987){try{jsonpatch[_0xd138('0x20')](_0x4bd987,_0x1755e5,!![]);}catch(_0x2a5bfb){return BPromise['reject'](_0x2a5bfb);}return _0x4bd987['save']();};}function saveUpdates(_0x20c57a,_0x5e0f89){return function(_0x5ef010){if(_0x5ef010){return _0x5ef010['update'](_0x20c57a)[_0xd138('0x21')](function(_0x1bc6ef){return _0x1bc6ef;});}return null;};}function removeEntity(_0x2700ae,_0x4569f5){return function(_0x5bd0eb){if(_0x5bd0eb){return _0x5bd0eb[_0xd138('0x22')]()[_0xd138('0x21')](function(){_0x2700ae[_0xd138('0x17')](0xcc)[_0xd138('0x18')]();});}};}function handleEntityNotFound(_0x425cd8,_0x5b11d0){return function(_0x294757){if(!_0x294757){_0x425cd8[_0xd138('0x16')](0x194);}return _0x294757;};}function handleError(_0x136048,_0x413d5c){_0x413d5c=_0x413d5c||0x1f4;return function(_0x1d45b7){logger[_0xd138('0x23')](_0x1d45b7['stack']);if(_0x1d45b7[_0xd138('0x24')]){delete _0x1d45b7['name'];}_0x136048[_0xd138('0x17')](_0x413d5c)['send'](_0x1d45b7);};}exports['index']=function(_0x5df7c1,_0x15c73e){var _0x46acdf={},_0x250da9={},_0xda4456={'count':0x0,'rows':[]};var _0x5d66e1=_[_0xd138('0x25')](db['ZendeskField'][_0xd138('0x26')],function(_0x2d60f4){return{'name':_0x2d60f4[_0xd138('0x27')],'type':_0x2d60f4['type'][_0xd138('0x28')]};});_0x250da9[_0xd138('0x29')]=_['map'](_0x5d66e1,_0xd138('0x24'));_0x250da9['query']=_[_0xd138('0x2a')](_0x5df7c1[_0xd138('0x2b')]);_0x250da9[_0xd138('0x2c')]=_[_0xd138('0x2d')](_0x250da9[_0xd138('0x29')],_0x250da9[_0xd138('0x2b')]);_0x46acdf['attributes']=_[_0xd138('0x2d')](_0x250da9[_0xd138('0x29')],qs[_0xd138('0x2e')](_0x5df7c1['query'][_0xd138('0x2e')]));_0x46acdf['attributes']=_0x46acdf[_0xd138('0x2f')]['length']?_0x46acdf[_0xd138('0x2f')]:_0x250da9[_0xd138('0x29')];if(!_0x5df7c1[_0xd138('0x2b')]['hasOwnProperty'](_0xd138('0x30'))){_0x46acdf['limit']=qs[_0xd138('0x1d')](_0x5df7c1[_0xd138('0x2b')]['limit']);_0x46acdf['offset']=qs[_0xd138('0x1b')](_0x5df7c1['query'][_0xd138('0x1b')]);}_0x46acdf[_0xd138('0x31')]=qs['sort'](_0x5df7c1['query']['sort']);_0x46acdf['where']=qs[_0xd138('0x2c')](_['pick'](_0x5df7c1[_0xd138('0x2b')],_0x250da9[_0xd138('0x2c')]),_0x5d66e1);if(_0x5df7c1[_0xd138('0x2b')][_0xd138('0x32')]){_0x46acdf[_0xd138('0x33')]=_[_0xd138('0x34')](_0x46acdf[_0xd138('0x33')],{'$or':_[_0xd138('0x25')](_0x5d66e1,function(_0x51d934){if(_0x51d934['type']!=='VIRTUAL'){var _0x2fd523={};_0x2fd523[_0x51d934[_0xd138('0x24')]]={'$like':'%'+_0x5df7c1[_0xd138('0x2b')][_0xd138('0x32')]+'%'};return _0x2fd523;}})});}_0x46acdf=_['merge']({},_0x46acdf,_0x5df7c1[_0xd138('0x35')]);var _0x52a62c={'where':_0x46acdf[_0xd138('0x33')]};return db[_0xd138('0x36')][_0xd138('0x1c')](_0x52a62c)[_0xd138('0x21')](function(_0xf4161a){_0xda4456[_0xd138('0x1c')]=_0xf4161a;if(_0x5df7c1[_0xd138('0x2b')][_0xd138('0x37')]){_0x46acdf[_0xd138('0x38')]=[{'all':!![]}];}return db['ZendeskField'][_0xd138('0x39')](_0x46acdf);})[_0xd138('0x21')](function(_0x3b56c5){_0xda4456[_0xd138('0x3a')]=_0x3b56c5;return _0xda4456;})[_0xd138('0x21')](respondWithFilteredResult(_0x15c73e,_0x46acdf))['catch'](handleError(_0x15c73e,null));};exports['show']=function(_0x16c7e6,_0x43c81f){var _0x325ea1={'raw':!![],'where':{'id':_0x16c7e6[_0xd138('0x3b')]['id']}},_0x95282e={};_0x95282e[_0xd138('0x29')]=_[_0xd138('0x2a')](db[_0xd138('0x36')][_0xd138('0x26')]);_0x95282e[_0xd138('0x2b')]=_[_0xd138('0x2a')](_0x16c7e6[_0xd138('0x2b')]);_0x95282e['filters']=_[_0xd138('0x2d')](_0x95282e[_0xd138('0x29')],_0x95282e[_0xd138('0x2b')]);_0x325ea1['attributes']=_[_0xd138('0x2d')](_0x95282e[_0xd138('0x29')],qs[_0xd138('0x2e')](_0x16c7e6[_0xd138('0x2b')][_0xd138('0x2e')]));_0x325ea1[_0xd138('0x2f')]=_0x325ea1['attributes'][_0xd138('0x3c')]?_0x325ea1[_0xd138('0x2f')]:_0x95282e['model'];if(_0x16c7e6[_0xd138('0x2b')]['includeAll']){_0x325ea1[_0xd138('0x38')]=[{'all':!![]}];}_0x325ea1=_[_0xd138('0x34')]({},_0x325ea1,_0x16c7e6[_0xd138('0x35')]);return db['ZendeskField']['find'](_0x325ea1)[_0xd138('0x21')](handleEntityNotFound(_0x43c81f,null))[_0xd138('0x21')](respondWithResult(_0x43c81f,null))[_0xd138('0x3d')](handleError(_0x43c81f,null));};exports[_0xd138('0x3e')]=function(_0x3b5005,_0x5e195c){return db['ZendeskField']['create'](_0x3b5005[_0xd138('0x3f')],{})[_0xd138('0x21')](respondWithResult(_0x5e195c,0xc9))[_0xd138('0x3d')](handleError(_0x5e195c,null));};exports[_0xd138('0x40')]=function(_0x5c7c02,_0x5e9973){if(_0x5c7c02[_0xd138('0x3f')]['id']){delete _0x5c7c02[_0xd138('0x3f')]['id'];}return db[_0xd138('0x36')][_0xd138('0x41')]({'where':{'id':_0x5c7c02['params']['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x5e9973,null))[_0xd138('0x21')](saveUpdates(_0x5c7c02[_0xd138('0x3f')],null))['then'](respondWithResult(_0x5e9973,null))[_0xd138('0x3d')](handleError(_0x5e9973,null));};exports[_0xd138('0x22')]=function(_0x3d2ed0,_0x5d89a7){return db['ZendeskField']['find']({'where':{'id':_0x3d2ed0[_0xd138('0x3b')]['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x5d89a7,null))[_0xd138('0x21')](removeEntity(_0x5d89a7,null))[_0xd138('0x3d')](handleError(_0x5d89a7,null));}; \ No newline at end of file +var _0x2932=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','then','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x108de9,_0x59c896){var _0x3038af=function(_0x417e23){while(--_0x417e23){_0x108de9['push'](_0x108de9['shift']());}};_0x3038af(++_0x59c896);}(_0x2932,0x198));var _0x2293=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x2932[_0x34b6aa];return _0x3ead29;};'use strict';var emlformat=require(_0x2293('0x0'));var rimraf=require(_0x2293('0x1'));var zipdir=require(_0x2293('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2293('0x3'));var moment=require(_0x2293('0x4'));var BPromise=require(_0x2293('0x5'));var Mustache=require(_0x2293('0x6'));var util=require(_0x2293('0x7'));var path=require(_0x2293('0x8'));var sox=require('sox');var csv=require(_0x2293('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2293('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2293('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2293('0x9'));var querystring=require('querystring');var Papa=require(_0x2293('0xc'));var Redis=require(_0x2293('0xd'));var authService=require(_0x2293('0xe'));var qs=require(_0x2293('0xf'));var as=require(_0x2293('0x10'));var hardwareService=require(_0x2293('0x11'));var logger=require(_0x2293('0x12'))(_0x2293('0x13'));var utils=require(_0x2293('0x14'));var config=require(_0x2293('0x15'));var licenseUtil=require(_0x2293('0x16'));var db=require(_0x2293('0x17'))['db'];function respondWithStatusCode(_0x5b0610,_0x2d6e3d){_0x2d6e3d=_0x2d6e3d||0xcc;return function(_0x512d5e){if(_0x512d5e){return _0x5b0610[_0x2293('0x18')](_0x2d6e3d);}return _0x5b0610[_0x2293('0x19')](_0x2d6e3d)[_0x2293('0x1a')]();};}function respondWithResult(_0x19e71e,_0x4ff8ab){_0x4ff8ab=_0x4ff8ab||0xc8;return function(_0x5cc4ea){if(_0x5cc4ea){return _0x19e71e[_0x2293('0x19')](_0x4ff8ab)['json'](_0x5cc4ea);}};}function respondWithFilteredResult(_0x5aeaf1,_0x4980d3){return function(_0x1273f5){if(_0x1273f5){var _0x2fa66e=typeof _0x4980d3[_0x2293('0x1b')]===_0x2293('0x1c')&&typeof _0x4980d3[_0x2293('0x1d')]===_0x2293('0x1c');var _0x36666b=_0x1273f5[_0x2293('0x1e')];var _0x39ca46=_0x2fa66e?0x0:_0x4980d3[_0x2293('0x1b')];var _0x5bb611=_0x2fa66e?_0x1273f5[_0x2293('0x1e')]:_0x4980d3[_0x2293('0x1b')]+_0x4980d3[_0x2293('0x1d')];var _0x1568d4;if(_0x5bb611>=_0x36666b){_0x5bb611=_0x36666b;_0x1568d4=0xc8;}else{_0x1568d4=0xce;}_0x5aeaf1[_0x2293('0x19')](_0x1568d4);return _0x5aeaf1['set']('Content-Range',_0x39ca46+'-'+_0x5bb611+'/'+_0x36666b)[_0x2293('0x1f')](_0x1273f5);}return null;};}function patchUpdates(_0x40e2aa){return function(_0x581d33){try{jsonpatch['apply'](_0x581d33,_0x40e2aa,!![]);}catch(_0x25c634){return BPromise[_0x2293('0x20')](_0x25c634);}return _0x581d33['save']();};}function saveUpdates(_0x46337a,_0x1782c1){return function(_0x5bfc2c){if(_0x5bfc2c){return _0x5bfc2c[_0x2293('0x21')](_0x46337a)[_0x2293('0x22')](function(_0x54320f){return _0x54320f;});}return null;};}function removeEntity(_0x509b9b,_0x36fa1e){return function(_0x517402){if(_0x517402){return _0x517402['destroy']()[_0x2293('0x22')](function(){_0x509b9b[_0x2293('0x19')](0xcc)[_0x2293('0x1a')]();});}};}function handleEntityNotFound(_0x5d48e0,_0x3529f1){return function(_0x1b9712){if(!_0x1b9712){_0x5d48e0[_0x2293('0x18')](0x194);}return _0x1b9712;};}function handleError(_0x474182,_0x2fbdae){_0x2fbdae=_0x2fbdae||0x1f4;return function(_0x365d78){logger[_0x2293('0x23')](_0x365d78['stack']);if(_0x365d78[_0x2293('0x24')]){delete _0x365d78[_0x2293('0x24')];}_0x474182[_0x2293('0x19')](_0x2fbdae)['send'](_0x365d78);};}exports[_0x2293('0x25')]=function(_0xf46b58,_0xdf86a7){var _0x3364dc={},_0x3703d7={},_0x2172d8={'count':0x0,'rows':[]};var _0x3d8895=_[_0x2293('0x26')](db[_0x2293('0x27')][_0x2293('0x28')],function(_0x447051){return{'name':_0x447051[_0x2293('0x29')],'type':_0x447051[_0x2293('0x2a')][_0x2293('0x2b')]};});_0x3703d7['model']=_['map'](_0x3d8895,_0x2293('0x24'));_0x3703d7[_0x2293('0x2c')]=_[_0x2293('0x2d')](_0xf46b58['query']);_0x3703d7[_0x2293('0x2e')]=_[_0x2293('0x2f')](_0x3703d7[_0x2293('0x30')],_0x3703d7[_0x2293('0x2c')]);_0x3364dc[_0x2293('0x31')]=_[_0x2293('0x2f')](_0x3703d7['model'],qs[_0x2293('0x32')](_0xf46b58['query']['fields']));_0x3364dc[_0x2293('0x31')]=_0x3364dc['attributes'][_0x2293('0x33')]?_0x3364dc[_0x2293('0x31')]:_0x3703d7[_0x2293('0x30')];if(!_0xf46b58['query']['hasOwnProperty'](_0x2293('0x34'))){_0x3364dc[_0x2293('0x1d')]=qs[_0x2293('0x1d')](_0xf46b58[_0x2293('0x2c')][_0x2293('0x1d')]);_0x3364dc[_0x2293('0x1b')]=qs['offset'](_0xf46b58[_0x2293('0x2c')]['offset']);}_0x3364dc['order']=qs[_0x2293('0x35')](_0xf46b58[_0x2293('0x2c')][_0x2293('0x35')]);_0x3364dc[_0x2293('0x36')]=qs[_0x2293('0x2e')](_[_0x2293('0x37')](_0xf46b58['query'],_0x3703d7[_0x2293('0x2e')]),_0x3d8895);if(_0xf46b58[_0x2293('0x2c')][_0x2293('0x38')]){_0x3364dc[_0x2293('0x36')]=_[_0x2293('0x39')](_0x3364dc[_0x2293('0x36')],{'$or':_['map'](_0x3d8895,function(_0x16f148){if(_0x16f148[_0x2293('0x2a')]!==_0x2293('0x3a')){var _0x759e59={};_0x759e59[_0x16f148[_0x2293('0x24')]]={'$like':'%'+_0xf46b58[_0x2293('0x2c')]['filter']+'%'};return _0x759e59;}})});}_0x3364dc=_[_0x2293('0x39')]({},_0x3364dc,_0xf46b58[_0x2293('0x3b')]);var _0x4ab70b={'where':_0x3364dc[_0x2293('0x36')]};return db[_0x2293('0x27')][_0x2293('0x1e')](_0x4ab70b)[_0x2293('0x22')](function(_0x4f111e){_0x2172d8[_0x2293('0x1e')]=_0x4f111e;if(_0xf46b58[_0x2293('0x2c')][_0x2293('0x3c')]){_0x3364dc[_0x2293('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0x2293('0x3e')](_0x3364dc);})[_0x2293('0x22')](function(_0x4d8224){_0x2172d8[_0x2293('0x3f')]=_0x4d8224;return _0x2172d8;})['then'](respondWithFilteredResult(_0xdf86a7,_0x3364dc))[_0x2293('0x40')](handleError(_0xdf86a7,null));};exports[_0x2293('0x41')]=function(_0x2f043a,_0xd55ab9){var _0x50db62={'raw':!![],'where':{'id':_0x2f043a[_0x2293('0x42')]['id']}},_0x566028={};_0x566028['model']=_[_0x2293('0x2d')](db[_0x2293('0x27')][_0x2293('0x28')]);_0x566028['query']=_[_0x2293('0x2d')](_0x2f043a['query']);_0x566028[_0x2293('0x2e')]=_[_0x2293('0x2f')](_0x566028['model'],_0x566028['query']);_0x50db62[_0x2293('0x31')]=_['intersection'](_0x566028[_0x2293('0x30')],qs[_0x2293('0x32')](_0x2f043a[_0x2293('0x2c')][_0x2293('0x32')]));_0x50db62[_0x2293('0x31')]=_0x50db62[_0x2293('0x31')]['length']?_0x50db62[_0x2293('0x31')]:_0x566028[_0x2293('0x30')];if(_0x2f043a[_0x2293('0x2c')][_0x2293('0x3c')]){_0x50db62['include']=[{'all':!![]}];}_0x50db62=_[_0x2293('0x39')]({},_0x50db62,_0x2f043a['options']);return db[_0x2293('0x27')][_0x2293('0x43')](_0x50db62)[_0x2293('0x22')](handleEntityNotFound(_0xd55ab9,null))[_0x2293('0x22')](respondWithResult(_0xd55ab9,null))[_0x2293('0x40')](handleError(_0xd55ab9,null));};exports['create']=function(_0x48e05e,_0x317e46){return db[_0x2293('0x27')][_0x2293('0x44')](_0x48e05e[_0x2293('0x45')],{})['then'](respondWithResult(_0x317e46,0xc9))[_0x2293('0x40')](handleError(_0x317e46,null));};exports[_0x2293('0x21')]=function(_0x56748f,_0x3053dc){if(_0x56748f['body']['id']){delete _0x56748f[_0x2293('0x45')]['id'];}return db[_0x2293('0x27')][_0x2293('0x43')]({'where':{'id':_0x56748f['params']['id']}})[_0x2293('0x22')](handleEntityNotFound(_0x3053dc,null))[_0x2293('0x22')](saveUpdates(_0x56748f['body'],null))['then'](respondWithResult(_0x3053dc,null))[_0x2293('0x40')](handleError(_0x3053dc,null));};exports[_0x2293('0x46')]=function(_0x2d1b2a,_0x3daae4){return db[_0x2293('0x27')][_0x2293('0x43')]({'where':{'id':_0x2d1b2a['params']['id']}})[_0x2293('0x22')](handleEntityNotFound(_0x3daae4,null))[_0x2293('0x22')](removeEntity(_0x3daae4,null))[_0x2293('0x40')](handleError(_0x3daae4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a4d03ba..a732f90 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 _0xe4b5=['request-promise','path','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xe4b5,0x19f));var _0x5e4b=function(_0x4529b,_0x5b4431){_0x4529b=_0x4529b-0x0;var _0x1de62a=_0xe4b5[_0x4529b];return _0x1de62a;};'use strict';var _=require(_0x5e4b('0x0'));var util=require(_0x5e4b('0x1'));var logger=require(_0x5e4b('0x2'))('api');var moment=require(_0x5e4b('0x3'));var BPromise=require(_0x5e4b('0x4'));var rp=require(_0x5e4b('0x5'));var fs=require('fs');var path=require(_0x5e4b('0x6'));var rimraf=require('rimraf');var config=require(_0x5e4b('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x5e4b('0x8')]=function(_0x36f135,_0x548acd){return _0x36f135[_0x5e4b('0x9')](_0x5e4b('0xa'),attributes,{'tableName':_0x5e4b('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x5e4b('0xc'),_0x5e4b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x810d=['bluebird','request-promise','path','rimraf','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x14c2c3,_0x3d0374){var _0x89792=function(_0xb0ca98){while(--_0xb0ca98){_0x14c2c3['push'](_0x14c2c3['shift']());}};_0x89792(++_0x3d0374);}(_0x810d,0x1db));var _0xd810=function(_0x5d8adc,_0x4cdbe6){_0x5d8adc=_0x5d8adc-0x0;var _0x572773=_0x810d[_0x5d8adc];return _0x572773;};'use strict';var _=require(_0xd810('0x0'));var util=require(_0xd810('0x1'));var logger=require(_0xd810('0x2'))(_0xd810('0x3'));var moment=require(_0xd810('0x4'));var BPromise=require(_0xd810('0x5'));var rp=require(_0xd810('0x6'));var fs=require('fs');var path=require(_0xd810('0x7'));var rimraf=require(_0xd810('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xd810('0x9')]=function(_0x7e03ae,_0x106d14){return _0x7e03ae[_0xd810('0xa')](_0xd810('0xb'),attributes,{'tableName':_0xd810('0xc'),'paranoid':![],'indexes':[{'name':_0xd810('0xd'),'fields':[_0xd810('0xe'),_0xd810('0xf')],'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 38c59f9..00b3281 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 _0x2940=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x318cf2,_0x40a058){var _0x5a9dc8=function(_0x4ebeb6){while(--_0x4ebeb6){_0x318cf2['push'](_0x318cf2['shift']());}};_0x5a9dc8(++_0x40a058);}(_0x2940,0x84));var _0x0294=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x2940[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x0294('0x0'));var util=require(_0x0294('0x1'));var moment=require('moment');var BPromise=require(_0x0294('0x2'));var rs=require(_0x0294('0x3'));var fs=require('fs');var Redis=require(_0x0294('0x4'));var db=require(_0x0294('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0294('0x6'))(_0x0294('0x7'));var config=require(_0x0294('0x8'));var jayson=require(_0x0294('0x9'));var client=jayson[_0x0294('0xa')][_0x0294('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22cac4,_0xbc4608,_0x32da36){return new BPromise(function(_0x26fb96,_0x2f3176){return client[_0x0294('0xc')](_0x22cac4,_0x32da36)[_0x0294('0xd')](function(_0x160bf0){logger[_0x0294('0xe')](_0x0294('0xf'),_0xbc4608,'request\x20sent');logger[_0x0294('0x10')](_0x0294('0x11'),_0xbc4608,_0x0294('0x12'),JSON[_0x0294('0x13')](_0x160bf0));if(_0x160bf0[_0x0294('0x14')]){if(_0x160bf0[_0x0294('0x14')][_0x0294('0x15')]===0x1f4){logger[_0x0294('0x14')](_0x0294('0xf'),_0xbc4608,_0x160bf0[_0x0294('0x14')][_0x0294('0x16')]);return _0x2f3176(_0x160bf0['error'][_0x0294('0x16')]);}logger[_0x0294('0x14')](_0x0294('0xf'),_0xbc4608,_0x160bf0[_0x0294('0x14')][_0x0294('0x16')]);return _0x26fb96(_0x160bf0[_0x0294('0x14')][_0x0294('0x16')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xbc4608,_0x0294('0x12'));_0x26fb96(_0x160bf0[_0x0294('0x17')][_0x0294('0x16')]);}})[_0x0294('0x18')](function(_0x99ef7f){logger[_0x0294('0x14')]('ZendeskField,\x20%s,\x20%s',_0xbc4608,_0x99ef7f);_0x2f3176(_0x99ef7f);});});} \ No newline at end of file +var _0x8775=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8775,0x1a3));var _0x5877=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x8775[_0x1af5b2];return _0xf1aa2d;};'use strict';var _=require(_0x5877('0x0'));var util=require(_0x5877('0x1'));var moment=require(_0x5877('0x2'));var BPromise=require('bluebird');var rs=require(_0x5877('0x3'));var fs=require('fs');var Redis=require(_0x5877('0x4'));var db=require(_0x5877('0x5'))['db'];var utils=require(_0x5877('0x6'));var logger=require(_0x5877('0x7'))(_0x5877('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5877('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b58f4,_0x49460d,_0x44fe42){return new BPromise(function(_0x3fb54d,_0x21401c){return client[_0x5877('0xa')](_0x5b58f4,_0x44fe42)[_0x5877('0xb')](function(_0x2f8e9b){logger[_0x5877('0xc')](_0x5877('0xd'),_0x49460d,_0x5877('0xe'));logger['debug'](_0x5877('0xf'),_0x49460d,_0x5877('0xe'),JSON[_0x5877('0x10')](_0x2f8e9b));if(_0x2f8e9b[_0x5877('0x11')]){if(_0x2f8e9b[_0x5877('0x11')][_0x5877('0x12')]===0x1f4){logger[_0x5877('0x11')]('ZendeskField,\x20%s,\x20%s',_0x49460d,_0x2f8e9b[_0x5877('0x11')][_0x5877('0x13')]);return _0x21401c(_0x2f8e9b[_0x5877('0x11')]['message']);}logger[_0x5877('0x11')](_0x5877('0xd'),_0x49460d,_0x2f8e9b[_0x5877('0x11')][_0x5877('0x13')]);return _0x3fb54d(_0x2f8e9b[_0x5877('0x11')][_0x5877('0x13')]);}else{logger[_0x5877('0xc')](_0x5877('0xd'),_0x49460d,'request\x20sent');_0x3fb54d(_0x2f8e9b[_0x5877('0x14')][_0x5877('0x13')]);}})[_0x5877('0x15')](function(_0x18a64f){logger[_0x5877('0x11')](_0x5877('0xd'),_0x49460d,_0x18a64f);_0x21401c(_0x18a64f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 83a58ce..6428383 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 _0x99e2=['/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x425a4f,_0x53cb01){var _0x565698=function(_0x14cc22){while(--_0x14cc22){_0x425a4f['push'](_0x425a4f['shift']());}};_0x565698(++_0x53cb01);}(_0x99e2,0x13c));var _0x299e=function(_0x162a0f,_0x339ea7){_0x162a0f=_0x162a0f-0x0;var _0x3fafc8=_0x99e2[_0x162a0f];return _0x3fafc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x299e('0x0'));var timeout=require(_0x299e('0x1'));var express=require(_0x299e('0x2'));var router=express['Router']();var fs_extra=require(_0x299e('0x3'));var auth=require(_0x299e('0x4'));var interaction=require(_0x299e('0x5'));var config=require(_0x299e('0x6'));var controller=require(_0x299e('0x7'));router[_0x299e('0x8')]('/',auth[_0x299e('0x9')](),controller[_0x299e('0xa')]);router[_0x299e('0x8')](_0x299e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x299e('0x8')](_0x299e('0xc'),auth['isAuthenticated'](),controller[_0x299e('0xd')]);router['get'](_0x299e('0xe'),auth[_0x299e('0x9')](),controller[_0x299e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x299e('0x10')](_0x299e('0xc'),auth[_0x299e('0x9')](),controller[_0x299e('0x11')]);router[_0x299e('0x12')](_0x299e('0xb'),auth[_0x299e('0x9')](),controller['update']);router[_0x299e('0x13')](_0x299e('0xb'),auth['isAuthenticated'](),controller[_0x299e('0x14')]);module[_0x299e('0x15')]=router; \ No newline at end of file +var _0x5e36=['destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put'];(function(_0x49b83c,_0x5d32c6){var _0x160e93=function(_0x3d348c){while(--_0x3d348c){_0x49b83c['push'](_0x49b83c['shift']());}};_0x160e93(++_0x5d32c6);}(_0x5e36,0x1bc));var _0x65e3=function(_0x31bf44,_0x1c954e){_0x31bf44=_0x31bf44-0x0;var _0x55151a=_0x5e36[_0x31bf44];return _0x55151a;};'use strict';var multer=require(_0x65e3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65e3('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x65e3('0x2'));var interaction=require(_0x65e3('0x3'));var config=require('../../config/environment');var controller=require(_0x65e3('0x4'));router[_0x65e3('0x5')]('/',auth[_0x65e3('0x6')](),controller['index']);router[_0x65e3('0x5')](_0x65e3('0x7'),auth[_0x65e3('0x6')](),controller[_0x65e3('0x8')]);router[_0x65e3('0x5')](_0x65e3('0x9'),auth[_0x65e3('0x6')](),controller[_0x65e3('0xa')]);router[_0x65e3('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x65e3('0xb')]);router[_0x65e3('0xc')]('/',auth[_0x65e3('0x6')](),controller[_0x65e3('0xd')]);router[_0x65e3('0xc')](_0x65e3('0x9'),auth[_0x65e3('0x6')](),controller['addConfiguration']);router[_0x65e3('0xe')](_0x65e3('0x7'),auth[_0x65e3('0x6')](),controller['update']);router['delete'](_0x65e3('0x7'),auth[_0x65e3('0x6')](),controller[_0x65e3('0xf')]);module[_0x65e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 23201ad..f250492 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 _0x5b02=['exports','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5b02,0xe9));var _0x25b0=function(_0x49f840,_0x4f408d){_0x49f840=_0x49f840-0x0;var _0x217590=_0x5b02[_0x49f840];return _0x217590;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')]},'description':{'type':Sequelize[_0x25b0('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x25b0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x25b0('0x2')]},'refreshToken':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x1af91a,_0x308ab2){var _0x5c1fa6=function(_0x5cd9ab){while(--_0x5cd9ab){_0x1af91a['push'](_0x1af91a['shift']());}};_0x5c1fa6(++_0x308ab2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d869f93..7be7fe0 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 _0x4c59=['picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','status','stack','name','send','map','ZohoAccount','rawAttributes','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','update','getConfigurations','findOne','params','addConfiguration','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type'];(function(_0xf51c90,_0x219d5f){var _0x53bb6d=function(_0xc89542){while(--_0xc89542){_0xf51c90['push'](_0xf51c90['shift']());}};_0x53bb6d(++_0x219d5f);}(_0x4c59,0x112));var _0x94c5=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x4c59[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94c5('0x0'));var zipdir=require(_0x94c5('0x1'));var jsonpatch=require(_0x94c5('0x2'));var rp=require(_0x94c5('0x3'));var moment=require(_0x94c5('0x4'));var BPromise=require(_0x94c5('0x5'));var Mustache=require(_0x94c5('0x6'));var util=require(_0x94c5('0x7'));var path=require(_0x94c5('0x8'));var sox=require(_0x94c5('0x9'));var csv=require(_0x94c5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94c5('0xb'));var _=require(_0x94c5('0xc'));var squel=require(_0x94c5('0xd'));var crypto=require(_0x94c5('0xe'));var jsforce=require(_0x94c5('0xf'));var deskjs=require(_0x94c5('0x10'));var toCsv=require(_0x94c5('0xa'));var querystring=require(_0x94c5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94c5('0x12'));var qs=require(_0x94c5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94c5('0x14'));var logger=require(_0x94c5('0x15'))(_0x94c5('0x16'));var utils=require(_0x94c5('0x17'));var config=require(_0x94c5('0x18'));var licenseUtil=require(_0x94c5('0x19'));var db=require(_0x94c5('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2673b5,_0x2d0e86){_0x2d0e86=_0x2d0e86||0xcc;return function(_0xfd2db6){if(_0xfd2db6){return _0x2673b5[_0x94c5('0x1b')](_0x2d0e86);}return _0x2673b5['status'](_0x2d0e86)[_0x94c5('0x1c')]();};}function respondWithResult(_0x2e2df6,_0xfd7d9){_0xfd7d9=_0xfd7d9||0xc8;return function(_0x2343c5){if(_0x2343c5){return _0x2e2df6['status'](_0xfd7d9)[_0x94c5('0x1d')](_0x2343c5);}};}function respondWithFilteredResult(_0x41dfd4,_0x2df889){return function(_0x1bd5cf){if(_0x1bd5cf){var _0x4894b5=typeof _0x2df889[_0x94c5('0x1e')]==='undefined'&&typeof _0x2df889[_0x94c5('0x1f')]===_0x94c5('0x20');var _0x3fb70b=_0x1bd5cf[_0x94c5('0x21')];var _0x16a561=_0x4894b5?0x0:_0x2df889[_0x94c5('0x1e')];var _0x3f10a4=_0x4894b5?_0x1bd5cf[_0x94c5('0x21')]:_0x2df889[_0x94c5('0x1e')]+_0x2df889[_0x94c5('0x1f')];var _0x58be7c;if(_0x3f10a4>=_0x3fb70b){_0x3f10a4=_0x3fb70b;_0x58be7c=0xc8;}else{_0x58be7c=0xce;}_0x41dfd4['status'](_0x58be7c);return _0x41dfd4[_0x94c5('0x22')](_0x94c5('0x23'),_0x16a561+'-'+_0x3f10a4+'/'+_0x3fb70b)[_0x94c5('0x1d')](_0x1bd5cf);}return null;};}function patchUpdates(_0x13c4c7){return function(_0x530873){try{jsonpatch['apply'](_0x530873,_0x13c4c7,!![]);}catch(_0x630364){return BPromise[_0x94c5('0x24')](_0x630364);}return _0x530873[_0x94c5('0x25')]();};}function saveUpdates(_0x418f71,_0x1c7dfc){return function(_0x2c388c){if(_0x2c388c){return _0x2c388c['update'](_0x418f71)['then'](function(_0x5deee5){return _0x5deee5;});}return null;};}function removeEntity(_0x21833a,_0x490088){return function(_0x37c326){if(_0x37c326){return _0x37c326[_0x94c5('0x26')]()[_0x94c5('0x27')](function(){_0x21833a[_0x94c5('0x28')](0xcc)[_0x94c5('0x1c')]();});}};}function handleEntityNotFound(_0x211def,_0x864589){return function(_0x516335){if(!_0x516335){_0x211def[_0x94c5('0x1b')](0x194);}return _0x516335;};}function handleError(_0x2d6023,_0x2cf20d){_0x2cf20d=_0x2cf20d||0x1f4;return function(_0x3253e3){logger['error'](_0x3253e3[_0x94c5('0x29')]);if(_0x3253e3[_0x94c5('0x2a')]){delete _0x3253e3['name'];}_0x2d6023[_0x94c5('0x28')](_0x2cf20d)[_0x94c5('0x2b')](_0x3253e3);};}exports['index']=function(_0x4b2165,_0x56037d){var _0x3de84a={},_0x21c4f5={},_0x4de210={'count':0x0,'rows':[]};var _0x2e6ed0=_[_0x94c5('0x2c')](db[_0x94c5('0x2d')][_0x94c5('0x2e')],function(_0x39eb04){return{'name':_0x39eb04['fieldName'],'type':_0x39eb04['type'][_0x94c5('0x2f')]};});_0x21c4f5[_0x94c5('0x30')]=_[_0x94c5('0x2c')](_0x2e6ed0,_0x94c5('0x2a'));_0x21c4f5[_0x94c5('0x31')]=_['keys'](_0x4b2165[_0x94c5('0x31')]);_0x21c4f5['filters']=_[_0x94c5('0x32')](_0x21c4f5['model'],_0x21c4f5['query']);_0x3de84a[_0x94c5('0x33')]=_[_0x94c5('0x32')](_0x21c4f5['model'],qs[_0x94c5('0x34')](_0x4b2165[_0x94c5('0x31')][_0x94c5('0x34')]));_0x3de84a[_0x94c5('0x33')]=_0x3de84a[_0x94c5('0x33')]['length']?_0x3de84a['attributes']:_0x21c4f5[_0x94c5('0x30')];if(!_0x4b2165[_0x94c5('0x31')][_0x94c5('0x35')](_0x94c5('0x36'))){_0x3de84a[_0x94c5('0x1f')]=qs[_0x94c5('0x1f')](_0x4b2165[_0x94c5('0x31')]['limit']);_0x3de84a['offset']=qs['offset'](_0x4b2165[_0x94c5('0x31')][_0x94c5('0x1e')]);}_0x3de84a[_0x94c5('0x37')]=qs[_0x94c5('0x38')](_0x4b2165[_0x94c5('0x31')][_0x94c5('0x38')]);_0x3de84a[_0x94c5('0x39')]=qs[_0x94c5('0x3a')](_[_0x94c5('0x3b')](_0x4b2165[_0x94c5('0x31')],_0x21c4f5[_0x94c5('0x3a')]),_0x2e6ed0);if(_0x4b2165[_0x94c5('0x31')][_0x94c5('0x3c')]){_0x3de84a[_0x94c5('0x39')]=_[_0x94c5('0x3d')](_0x3de84a[_0x94c5('0x39')],{'$or':_[_0x94c5('0x2c')](_0x2e6ed0,function(_0x343cd8){if(_0x343cd8[_0x94c5('0x3e')]!==_0x94c5('0x3f')){var _0x2d6096={};_0x2d6096[_0x343cd8[_0x94c5('0x2a')]]={'$like':'%'+_0x4b2165[_0x94c5('0x31')]['filter']+'%'};return _0x2d6096;}})});}_0x3de84a=_[_0x94c5('0x3d')]({},_0x3de84a,_0x4b2165[_0x94c5('0x40')]);var _0x2d2b08={'where':_0x3de84a[_0x94c5('0x39')]};return db[_0x94c5('0x2d')][_0x94c5('0x21')](_0x2d2b08)[_0x94c5('0x27')](function(_0x55475b){_0x4de210[_0x94c5('0x21')]=_0x55475b;if(_0x4b2165[_0x94c5('0x31')][_0x94c5('0x41')]){_0x3de84a[_0x94c5('0x42')]=[{'all':!![]}];}return db[_0x94c5('0x2d')][_0x94c5('0x43')](_0x3de84a);})[_0x94c5('0x27')](function(_0x3ea18a){_0x4de210[_0x94c5('0x44')]=_0x3ea18a;return _0x4de210;})[_0x94c5('0x27')](respondWithFilteredResult(_0x56037d,_0x3de84a))[_0x94c5('0x45')](handleError(_0x56037d,null));};exports['show']=function(_0x52559d,_0x68251){var _0x548776={'raw':![],'where':{'id':_0x52559d['params']['id']}},_0x11b3ca={};_0x11b3ca[_0x94c5('0x30')]=_[_0x94c5('0x46')](db[_0x94c5('0x2d')][_0x94c5('0x2e')]);_0x11b3ca[_0x94c5('0x31')]=_[_0x94c5('0x46')](_0x52559d[_0x94c5('0x31')]);_0x11b3ca[_0x94c5('0x3a')]=_['intersection'](_0x11b3ca[_0x94c5('0x30')],_0x11b3ca[_0x94c5('0x31')]);_0x548776[_0x94c5('0x33')]=_[_0x94c5('0x32')](_0x11b3ca[_0x94c5('0x30')],qs[_0x94c5('0x34')](_0x52559d['query'][_0x94c5('0x34')]));_0x548776[_0x94c5('0x33')]=_0x548776[_0x94c5('0x33')][_0x94c5('0x47')]?_0x548776[_0x94c5('0x33')]:_0x11b3ca[_0x94c5('0x30')];if(_0x52559d[_0x94c5('0x31')][_0x94c5('0x41')]){_0x548776[_0x94c5('0x42')]=[{'all':!![]}];}_0x548776=_[_0x94c5('0x3d')]({},_0x548776,_0x52559d[_0x94c5('0x40')]);return db['ZohoAccount'][_0x94c5('0x48')](_0x548776)['then'](handleEntityNotFound(_0x68251,null))['then'](respondWithResult(_0x68251,null))[_0x94c5('0x45')](handleError(_0x68251,null));};exports[_0x94c5('0x49')]=function(_0x1b4b54,_0x4a5b9e){return db[_0x94c5('0x2d')][_0x94c5('0x49')](_0x1b4b54[_0x94c5('0x4a')],{})[_0x94c5('0x27')](respondWithResult(_0x4a5b9e,0xc9))[_0x94c5('0x45')](handleError(_0x4a5b9e,null));};exports[_0x94c5('0x4b')]=function(_0x4cb5b2,_0x455404){if(_0x4cb5b2['body']['id']){delete _0x4cb5b2['body']['id'];}return db[_0x94c5('0x2d')][_0x94c5('0x48')]({'where':{'id':_0x4cb5b2['params']['id']}})['then'](handleEntityNotFound(_0x455404,null))[_0x94c5('0x27')](saveUpdates(_0x4cb5b2[_0x94c5('0x4a')],null))['then'](respondWithResult(_0x455404,null))['catch'](handleError(_0x455404,null));};exports['destroy']=function(_0x5c90bf,_0x12c75c){return db['ZohoAccount']['find']({'where':{'id':_0x5c90bf['params']['id']}})[_0x94c5('0x27')](handleEntityNotFound(_0x12c75c,null))[_0x94c5('0x27')](removeEntity(_0x12c75c,null))[_0x94c5('0x45')](handleError(_0x12c75c,null));};exports[_0x94c5('0x4c')]=function(_0x4f9054,_0x25a8c5,_0x53fb7b){var _0x20587e={};var _0x170d0e={};var _0x5a496a;var _0x459ebb;return db[_0x94c5('0x2d')][_0x94c5('0x4d')]({'where':{'id':_0x4f9054[_0x94c5('0x4e')]['id']}})[_0x94c5('0x27')](handleEntityNotFound(_0x25a8c5,null))[_0x94c5('0x27')](function(_0x7152d3){if(_0x7152d3){_0x5a496a=_0x7152d3;_0x170d0e[_0x94c5('0x30')]=_[_0x94c5('0x46')](db['ZohoConfiguration'][_0x94c5('0x2e')]);_0x170d0e[_0x94c5('0x31')]=_[_0x94c5('0x46')](_0x4f9054[_0x94c5('0x31')]);_0x170d0e[_0x94c5('0x3a')]=_[_0x94c5('0x32')](_0x170d0e[_0x94c5('0x30')],_0x170d0e[_0x94c5('0x31')]);_0x20587e[_0x94c5('0x33')]=_[_0x94c5('0x32')](_0x170d0e[_0x94c5('0x30')],qs[_0x94c5('0x34')](_0x4f9054['query'][_0x94c5('0x34')]));_0x20587e[_0x94c5('0x33')]=_0x20587e['attributes'][_0x94c5('0x47')]?_0x20587e['attributes']:_0x170d0e[_0x94c5('0x30')];_0x20587e[_0x94c5('0x37')]=qs[_0x94c5('0x38')](_0x4f9054[_0x94c5('0x31')][_0x94c5('0x38')]);_0x20587e['where']=qs[_0x94c5('0x3a')](_[_0x94c5('0x3b')](_0x4f9054[_0x94c5('0x31')],_0x170d0e['filters']));if(_0x4f9054[_0x94c5('0x31')]['filter']){_0x20587e[_0x94c5('0x39')]=_[_0x94c5('0x3d')](_0x20587e['where'],{'$or':_[_0x94c5('0x2c')](_0x20587e[_0x94c5('0x33')],function(_0x3416ec){var _0x17137a={};_0x17137a[_0x3416ec]={'$like':'%'+_0x4f9054[_0x94c5('0x31')][_0x94c5('0x3c')]+'%'};return _0x17137a;})});}_0x20587e=_[_0x94c5('0x3d')]({},_0x20587e,_0x4f9054[_0x94c5('0x40')]);return _0x5a496a[_0x94c5('0x4c')](_0x20587e);}})['then'](function(_0x15125f){if(_0x15125f){_0x459ebb=_0x15125f[_0x94c5('0x47')];if(!_0x4f9054['query']['hasOwnProperty'](_0x94c5('0x36'))){_0x20587e[_0x94c5('0x1f')]=qs[_0x94c5('0x1f')](_0x4f9054[_0x94c5('0x31')][_0x94c5('0x1f')]);_0x20587e[_0x94c5('0x1e')]=qs['offset'](_0x4f9054[_0x94c5('0x31')][_0x94c5('0x1e')]);}return _0x5a496a[_0x94c5('0x4c')](_0x20587e);}})[_0x94c5('0x27')](function(_0x29060e){if(_0x29060e){return _0x29060e?{'count':_0x459ebb,'rows':_0x29060e}:null;}})[_0x94c5('0x27')](respondWithResult(_0x25a8c5,null))['catch'](handleError(_0x25a8c5,null));};exports[_0x94c5('0x4f')]=function(_0x46abf3,_0x677815,_0x4b87f9){if(_0x46abf3[_0x94c5('0x4a')]['id']){delete _0x46abf3[_0x94c5('0x4a')]['id'];}return db['ZohoAccount'][_0x94c5('0x4d')]({'where':{'id':_0x46abf3['params']['id']}})[_0x94c5('0x27')](handleEntityNotFound(_0x677815,null))[_0x94c5('0x27')](function(_0x492b23){if(_0x492b23){_0x46abf3[_0x94c5('0x4a')]['AccountId']=_0x492b23['id'];_0x46abf3[_0x94c5('0x4a')]['Subjects']=integrations['getSubjects'](_0x46abf3[_0x94c5('0x4a')][_0x94c5('0x50')],_0x46abf3[_0x94c5('0x4a')][_0x94c5('0x3e')]);_0x46abf3[_0x94c5('0x4a')][_0x94c5('0x51')]=integrations[_0x94c5('0x52')](_0x46abf3[_0x94c5('0x4a')][_0x94c5('0x50')],_0x46abf3[_0x94c5('0x4a')][_0x94c5('0x3e')]);return db[_0x94c5('0x53')]['create'](_0x46abf3[_0x94c5('0x4a')],{'include':[{'model':db[_0x94c5('0x54')],'as':_0x94c5('0x55')},{'model':db[_0x94c5('0x54')],'as':_0x94c5('0x51')}]});}return null;})['then'](respondWithResult(_0x677815,null))[_0x94c5('0x45')](handleError(_0x677815,null));};function getAccessToken(_0x2d2f2a){return new Promise(function(_0xcdec4a,_0x22dd5a){var _0x9ecbee;switch(_0x2d2f2a[_0x94c5('0x56')]){case'US':_0x9ecbee=_0x94c5('0x57');break;case'AU':_0x9ecbee=_0x94c5('0x58');break;case'EU':_0x9ecbee=_0x94c5('0x59');break;case'IN':_0x9ecbee=_0x94c5('0x5a');break;case'CN':_0x9ecbee=_0x94c5('0x5b');break;default:_0x9ecbee='https://accounts.zoho.eu';break;}var _0x7178ed={'method':_0x94c5('0x5c'),'uri':_0x9ecbee+'/oauth/v2/token','qs':{'refresh_token':_0x2d2f2a['refreshToken'],'client_id':_0x2d2f2a[_0x94c5('0x5d')],'client_secret':_0x2d2f2a[_0x94c5('0x5e')],'grant_type':_0x94c5('0x5f')},'json':!![]};return rp(_0x7178ed)[_0x94c5('0x27')](function(_0x3421a1){if(_0x3421a1['access_token']){_0xcdec4a(_0x3421a1[_0x94c5('0x60')]);}else{_0x22dd5a(_0x94c5('0x61'));}})[_0x94c5('0x45')](function(_0xa826f2){_0x22dd5a(_0xa826f2);});});}exports[_0x94c5('0x62')]=function(_0x51e692,_0x3d54dc,_0x2874c2){var _0x26fa95,_0x59487c,_0x54bf6c,_0x9c6c13,_0x18425f;return db[_0x94c5('0x2d')][_0x94c5('0x4d')]({'where':{'id':_0x51e692['params']['id']},'attributes':['id',_0x94c5('0x63'),'zone','clientId',_0x94c5('0x5e'),_0x94c5('0x64'),_0x94c5('0x65'),_0x94c5('0x66')]})[_0x94c5('0x27')](handleEntityNotFound(_0x3d54dc,null))['then'](function(_0x492191){_0x18425f=_0x492191;_0x26fa95=_0x18425f[_0x94c5('0x63')];_0x59487c=_0x26fa95===_0x94c5('0x67')?'eu':_0x94c5('0x68');_0x54bf6c=_0x18425f[_0x94c5('0x64')];var _0x20428b=_0x54bf6c[_0x94c5('0x69')](-0x1);if(_0x20428b==='/'||_0x20428b==='\x5c'||_0x20428b===':'){_0x54bf6c=_0x54bf6c[_0x94c5('0x6a')](0x0,_0x54bf6c[_0x94c5('0x6b')](_0x20428b));}if(!_0x18425f[_0x94c5('0x66')]){throw new Error(_0x94c5('0x6c'));}return getAccessToken(_0x18425f);})[_0x94c5('0x27')](function(_0x4d244d){if(_0x4d244d){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x59487c),'qs':{'module':'Calls'},'headers':{'Authorization':_0x94c5('0x6d')+_0x4d244d},'json':!![]});}})['then'](function(_0x25319a){if(_0x25319a){if(_0x25319a[_0x94c5('0x6e')]&&_0x25319a[_0x94c5('0x6e')][_0x94c5('0x6f')]){throw new Error(_0x25319a['response']['error'][_0x94c5('0x70')]);}var _0x18aa95=[];var _0x1488a2=[];var _0x16db64=[_0x94c5('0x71'),_0x94c5('0x72'),_0x94c5('0x73'),_0x94c5('0x74'),'Call_Duration',_0x94c5('0x75'),_0x94c5('0x76'),_0x94c5('0x77')];_0x1488a2=_[_0x94c5('0x78')](_0x25319a[_0x94c5('0x34')],function(_0x25cb89){return _0x16db64[_0x94c5('0x79')](_0x25cb89[_0x94c5('0x7a')]);});for(var _0x3386a9=0x0;_0x3386a9<_0x1488a2[_0x94c5('0x47')];_0x3386a9++){if(_0x1488a2[_0x3386a9][_0x94c5('0x7b')]===![]){_0x18aa95[_0x94c5('0x7c')]({'id':_0x1488a2[_0x3386a9]['id'],'name':_0x1488a2[_0x3386a9][_0x94c5('0x7d')],'custom':_0x1488a2[_0x3386a9][_0x94c5('0x7e')],'options':_0x1488a2[_0x3386a9][_0x94c5('0x7f')]===_0x94c5('0x80')&&_0x1488a2[_0x3386a9][_0x94c5('0x81')][_0x94c5('0x47')]>-0x1?_[_0x94c5('0x2c')](_0x1488a2[_0x3386a9]['pick_list_values'],function(_0x304fbb){return{'name':_0x304fbb,'value':_0x304fbb};}):[]});}}return{'count':_0x18aa95['length'],'rows':_0x18aa95};}else{return{'count':0x0,'rows':[]};}})[_0x94c5('0x27')](respondWithResult(_0x3d54dc,null))[_0x94c5('0x45')](function(_0x44acae){var _0x37cb72=_0x51e692['query']['test']?0x1f4:_0x44acae[_0x94c5('0x82')]||0x1f4;logger[_0x94c5('0x6f')](_0x94c5('0x83'),'getFields',_0x37cb72,JSON['stringify'](_0x44acae));delete _0x44acae['name'];if(_0x37cb72===0x191){_0x37cb72=0x190;}_0x3d54dc[_0x94c5('0x28')](_0x37cb72)[_0x94c5('0x2b')](_0x51e692[_0x94c5('0x31')][_0x94c5('0x84')]?{'message':_0x94c5('0x85'),'statusCode':_0x44acae[_0x94c5('0x82')]}:_0x44acae);});}; \ No newline at end of file +var _0xa106=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','rows','catch','show','params','keys','include','find','create','body','update','findOne','ZohoConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','refresh_token','access_token','getFields','clientSecret','code','host','com','serverUrl','slice','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','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel'];(function(_0x1a0b7a,_0x452717){var _0xf749b5=function(_0x25257f){while(--_0x25257f){_0x1a0b7a['push'](_0x1a0b7a['shift']());}};_0xf749b5(++_0x452717);}(_0xa106,0xf6));var _0x6a10=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0xa106[_0x4e82ff];return _0x495205;};'use strict';var emlformat=require(_0x6a10('0x0'));var rimraf=require(_0x6a10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a10('0x2'));var BPromise=require(_0x6a10('0x3'));var Mustache=require(_0x6a10('0x4'));var util=require(_0x6a10('0x5'));var path=require(_0x6a10('0x6'));var sox=require(_0x6a10('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a10('0x8'));var squel=require(_0x6a10('0x9'));var crypto=require(_0x6a10('0xa'));var jsforce=require(_0x6a10('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a10('0xc'));var querystring=require(_0x6a10('0xd'));var Papa=require(_0x6a10('0xe'));var Redis=require(_0x6a10('0xf'));var authService=require(_0x6a10('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a10('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a10('0x12'))(_0x6a10('0x13'));var utils=require('../../config/utils');var config=require(_0x6a10('0x14'));var licenseUtil=require(_0x6a10('0x15'));var db=require(_0x6a10('0x16'))['db'];var integrations=require(_0x6a10('0x17'));function respondWithStatusCode(_0x562c78,_0x5ba946){_0x5ba946=_0x5ba946||0xcc;return function(_0x373455){if(_0x373455){return _0x562c78[_0x6a10('0x18')](_0x5ba946);}return _0x562c78[_0x6a10('0x19')](_0x5ba946)[_0x6a10('0x1a')]();};}function respondWithResult(_0x18d083,_0xca1c1){_0xca1c1=_0xca1c1||0xc8;return function(_0x499c49){if(_0x499c49){return _0x18d083[_0x6a10('0x19')](_0xca1c1)[_0x6a10('0x1b')](_0x499c49);}};}function respondWithFilteredResult(_0x2a8f54,_0x2e25e9){return function(_0x2ac4b9){if(_0x2ac4b9){var _0x4aa4ea=typeof _0x2e25e9[_0x6a10('0x1c')]===_0x6a10('0x1d')&&typeof _0x2e25e9['limit']===_0x6a10('0x1d');var _0x971bc6=_0x2ac4b9[_0x6a10('0x1e')];var _0x4c1cb3=_0x4aa4ea?0x0:_0x2e25e9['offset'];var _0xa4b921=_0x4aa4ea?_0x2ac4b9['count']:_0x2e25e9[_0x6a10('0x1c')]+_0x2e25e9[_0x6a10('0x1f')];var _0x4daa33;if(_0xa4b921>=_0x971bc6){_0xa4b921=_0x971bc6;_0x4daa33=0xc8;}else{_0x4daa33=0xce;}_0x2a8f54[_0x6a10('0x19')](_0x4daa33);return _0x2a8f54['set'](_0x6a10('0x20'),_0x4c1cb3+'-'+_0xa4b921+'/'+_0x971bc6)[_0x6a10('0x1b')](_0x2ac4b9);}return null;};}function patchUpdates(_0x5b0eff){return function(_0x17aab0){try{jsonpatch[_0x6a10('0x21')](_0x17aab0,_0x5b0eff,!![]);}catch(_0x5a9b1b){return BPromise['reject'](_0x5a9b1b);}return _0x17aab0[_0x6a10('0x22')]();};}function saveUpdates(_0x161659,_0x2ecde3){return function(_0x141525){if(_0x141525){return _0x141525['update'](_0x161659)[_0x6a10('0x23')](function(_0x159336){return _0x159336;});}return null;};}function removeEntity(_0x3b22df,_0xa62722){return function(_0x4f861a){if(_0x4f861a){return _0x4f861a[_0x6a10('0x24')]()['then'](function(){_0x3b22df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x983325,_0x1829e8){return function(_0x4ad944){if(!_0x4ad944){_0x983325[_0x6a10('0x18')](0x194);}return _0x4ad944;};}function handleError(_0x54b58e,_0x1b7fb4){_0x1b7fb4=_0x1b7fb4||0x1f4;return function(_0x4bc5d1){logger[_0x6a10('0x25')](_0x4bc5d1[_0x6a10('0x26')]);if(_0x4bc5d1[_0x6a10('0x27')]){delete _0x4bc5d1[_0x6a10('0x27')];}_0x54b58e[_0x6a10('0x19')](_0x1b7fb4)[_0x6a10('0x28')](_0x4bc5d1);};}exports['index']=function(_0x241873,_0x7e2981){var _0x569d01={},_0x37e4f4={},_0x2b5089={'count':0x0,'rows':[]};var _0x108edd=_[_0x6a10('0x29')](db[_0x6a10('0x2a')][_0x6a10('0x2b')],function(_0x11c76f){return{'name':_0x11c76f[_0x6a10('0x2c')],'type':_0x11c76f[_0x6a10('0x2d')][_0x6a10('0x2e')]};});_0x37e4f4[_0x6a10('0x2f')]=_[_0x6a10('0x29')](_0x108edd,_0x6a10('0x27'));_0x37e4f4[_0x6a10('0x30')]=_['keys'](_0x241873[_0x6a10('0x30')]);_0x37e4f4[_0x6a10('0x31')]=_[_0x6a10('0x32')](_0x37e4f4['model'],_0x37e4f4[_0x6a10('0x30')]);_0x569d01[_0x6a10('0x33')]=_['intersection'](_0x37e4f4[_0x6a10('0x2f')],qs['fields'](_0x241873[_0x6a10('0x30')][_0x6a10('0x34')]));_0x569d01['attributes']=_0x569d01[_0x6a10('0x33')][_0x6a10('0x35')]?_0x569d01['attributes']:_0x37e4f4[_0x6a10('0x2f')];if(!_0x241873[_0x6a10('0x30')][_0x6a10('0x36')]('nolimit')){_0x569d01[_0x6a10('0x1f')]=qs[_0x6a10('0x1f')](_0x241873['query'][_0x6a10('0x1f')]);_0x569d01['offset']=qs[_0x6a10('0x1c')](_0x241873[_0x6a10('0x30')][_0x6a10('0x1c')]);}_0x569d01[_0x6a10('0x37')]=qs['sort'](_0x241873['query'][_0x6a10('0x38')]);_0x569d01['where']=qs[_0x6a10('0x31')](_['pick'](_0x241873[_0x6a10('0x30')],_0x37e4f4[_0x6a10('0x31')]),_0x108edd);if(_0x241873[_0x6a10('0x30')][_0x6a10('0x39')]){_0x569d01[_0x6a10('0x3a')]=_[_0x6a10('0x3b')](_0x569d01[_0x6a10('0x3a')],{'$or':_[_0x6a10('0x29')](_0x108edd,function(_0x2a33cc){if(_0x2a33cc[_0x6a10('0x2d')]!==_0x6a10('0x3c')){var _0x2d2d03={};_0x2d2d03[_0x2a33cc[_0x6a10('0x27')]]={'$like':'%'+_0x241873[_0x6a10('0x30')][_0x6a10('0x39')]+'%'};return _0x2d2d03;}})});}_0x569d01=_[_0x6a10('0x3b')]({},_0x569d01,_0x241873[_0x6a10('0x3d')]);var _0x3e339d={'where':_0x569d01['where']};return db[_0x6a10('0x2a')][_0x6a10('0x1e')](_0x3e339d)['then'](function(_0x1b9fa0){_0x2b5089[_0x6a10('0x1e')]=_0x1b9fa0;if(_0x241873[_0x6a10('0x30')]['includeAll']){_0x569d01['include']=[{'all':!![]}];}return db[_0x6a10('0x2a')]['findAll'](_0x569d01);})['then'](function(_0x1c68d7){_0x2b5089[_0x6a10('0x3e')]=_0x1c68d7;return _0x2b5089;})[_0x6a10('0x23')](respondWithFilteredResult(_0x7e2981,_0x569d01))[_0x6a10('0x3f')](handleError(_0x7e2981,null));};exports[_0x6a10('0x40')]=function(_0x48849c,_0x1b6274){var _0x434aa2={'raw':![],'where':{'id':_0x48849c[_0x6a10('0x41')]['id']}},_0x595336={};_0x595336['model']=_[_0x6a10('0x42')](db[_0x6a10('0x2a')]['rawAttributes']);_0x595336[_0x6a10('0x30')]=_[_0x6a10('0x42')](_0x48849c['query']);_0x595336[_0x6a10('0x31')]=_['intersection'](_0x595336[_0x6a10('0x2f')],_0x595336[_0x6a10('0x30')]);_0x434aa2[_0x6a10('0x33')]=_[_0x6a10('0x32')](_0x595336[_0x6a10('0x2f')],qs['fields'](_0x48849c[_0x6a10('0x30')]['fields']));_0x434aa2[_0x6a10('0x33')]=_0x434aa2['attributes'][_0x6a10('0x35')]?_0x434aa2[_0x6a10('0x33')]:_0x595336[_0x6a10('0x2f')];if(_0x48849c['query']['includeAll']){_0x434aa2[_0x6a10('0x43')]=[{'all':!![]}];}_0x434aa2=_[_0x6a10('0x3b')]({},_0x434aa2,_0x48849c[_0x6a10('0x3d')]);return db[_0x6a10('0x2a')][_0x6a10('0x44')](_0x434aa2)[_0x6a10('0x23')](handleEntityNotFound(_0x1b6274,null))[_0x6a10('0x23')](respondWithResult(_0x1b6274,null))[_0x6a10('0x3f')](handleError(_0x1b6274,null));};exports[_0x6a10('0x45')]=function(_0x48841c,_0x1a389e){return db[_0x6a10('0x2a')][_0x6a10('0x45')](_0x48841c[_0x6a10('0x46')],{})['then'](respondWithResult(_0x1a389e,0xc9))[_0x6a10('0x3f')](handleError(_0x1a389e,null));};exports[_0x6a10('0x47')]=function(_0x2f86d0,_0x76c464){if(_0x2f86d0['body']['id']){delete _0x2f86d0[_0x6a10('0x46')]['id'];}return db[_0x6a10('0x2a')]['find']({'where':{'id':_0x2f86d0[_0x6a10('0x41')]['id']}})['then'](handleEntityNotFound(_0x76c464,null))['then'](saveUpdates(_0x2f86d0[_0x6a10('0x46')],null))[_0x6a10('0x23')](respondWithResult(_0x76c464,null))['catch'](handleError(_0x76c464,null));};exports[_0x6a10('0x24')]=function(_0x51959c,_0x3c01f9){return db[_0x6a10('0x2a')][_0x6a10('0x44')]({'where':{'id':_0x51959c[_0x6a10('0x41')]['id']}})[_0x6a10('0x23')](handleEntityNotFound(_0x3c01f9,null))['then'](removeEntity(_0x3c01f9,null))[_0x6a10('0x3f')](handleError(_0x3c01f9,null));};exports['getConfigurations']=function(_0xbc6d33,_0x139777,_0x4b386e){var _0x1c0dd6={};var _0x39c75e={};var _0x31c613;var _0xc9a96a;return db['ZohoAccount'][_0x6a10('0x48')]({'where':{'id':_0xbc6d33[_0x6a10('0x41')]['id']}})[_0x6a10('0x23')](handleEntityNotFound(_0x139777,null))[_0x6a10('0x23')](function(_0x8976c5){if(_0x8976c5){_0x31c613=_0x8976c5;_0x39c75e[_0x6a10('0x2f')]=_['keys'](db[_0x6a10('0x49')][_0x6a10('0x2b')]);_0x39c75e[_0x6a10('0x30')]=_[_0x6a10('0x42')](_0xbc6d33[_0x6a10('0x30')]);_0x39c75e[_0x6a10('0x31')]=_[_0x6a10('0x32')](_0x39c75e[_0x6a10('0x2f')],_0x39c75e[_0x6a10('0x30')]);_0x1c0dd6[_0x6a10('0x33')]=_[_0x6a10('0x32')](_0x39c75e[_0x6a10('0x2f')],qs[_0x6a10('0x34')](_0xbc6d33[_0x6a10('0x30')][_0x6a10('0x34')]));_0x1c0dd6['attributes']=_0x1c0dd6[_0x6a10('0x33')]['length']?_0x1c0dd6[_0x6a10('0x33')]:_0x39c75e[_0x6a10('0x2f')];_0x1c0dd6[_0x6a10('0x37')]=qs[_0x6a10('0x38')](_0xbc6d33[_0x6a10('0x30')][_0x6a10('0x38')]);_0x1c0dd6['where']=qs[_0x6a10('0x31')](_['pick'](_0xbc6d33[_0x6a10('0x30')],_0x39c75e[_0x6a10('0x31')]));if(_0xbc6d33[_0x6a10('0x30')][_0x6a10('0x39')]){_0x1c0dd6[_0x6a10('0x3a')]=_[_0x6a10('0x3b')](_0x1c0dd6[_0x6a10('0x3a')],{'$or':_['map'](_0x1c0dd6[_0x6a10('0x33')],function(_0xd62b22){var _0x282563={};_0x282563[_0xd62b22]={'$like':'%'+_0xbc6d33['query'][_0x6a10('0x39')]+'%'};return _0x282563;})});}_0x1c0dd6=_['merge']({},_0x1c0dd6,_0xbc6d33[_0x6a10('0x3d')]);return _0x31c613[_0x6a10('0x4a')](_0x1c0dd6);}})[_0x6a10('0x23')](function(_0x319512){if(_0x319512){_0xc9a96a=_0x319512[_0x6a10('0x35')];if(!_0xbc6d33['query'][_0x6a10('0x36')](_0x6a10('0x4b'))){_0x1c0dd6['limit']=qs[_0x6a10('0x1f')](_0xbc6d33['query'][_0x6a10('0x1f')]);_0x1c0dd6[_0x6a10('0x1c')]=qs[_0x6a10('0x1c')](_0xbc6d33[_0x6a10('0x30')][_0x6a10('0x1c')]);}return _0x31c613[_0x6a10('0x4a')](_0x1c0dd6);}})[_0x6a10('0x23')](function(_0x241bde){if(_0x241bde){return _0x241bde?{'count':_0xc9a96a,'rows':_0x241bde}:null;}})[_0x6a10('0x23')](respondWithResult(_0x139777,null))[_0x6a10('0x3f')](handleError(_0x139777,null));};exports[_0x6a10('0x4c')]=function(_0x63129b,_0x5d669e,_0x2d9915){if(_0x63129b[_0x6a10('0x46')]['id']){delete _0x63129b['body']['id'];}return db[_0x6a10('0x2a')][_0x6a10('0x48')]({'where':{'id':_0x63129b['params']['id']}})[_0x6a10('0x23')](handleEntityNotFound(_0x5d669e,null))['then'](function(_0x5088c5){if(_0x5088c5){_0x63129b[_0x6a10('0x46')][_0x6a10('0x4d')]=_0x5088c5['id'];_0x63129b['body'][_0x6a10('0x4e')]=integrations[_0x6a10('0x4f')](_0x63129b[_0x6a10('0x46')][_0x6a10('0x50')],_0x63129b[_0x6a10('0x46')][_0x6a10('0x2d')]);_0x63129b[_0x6a10('0x46')]['Descriptions']=integrations[_0x6a10('0x51')](_0x63129b[_0x6a10('0x46')][_0x6a10('0x50')],_0x63129b[_0x6a10('0x46')][_0x6a10('0x2d')]);return db[_0x6a10('0x49')][_0x6a10('0x45')](_0x63129b[_0x6a10('0x46')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x6a10('0x52')],'as':_0x6a10('0x53')}]});}return null;})[_0x6a10('0x23')](respondWithResult(_0x5d669e,null))[_0x6a10('0x3f')](handleError(_0x5d669e,null));};function getAccessToken(_0x4bd1ec){return new Promise(function(_0x674c73,_0x2be1cd){var _0x309dd4;switch(_0x4bd1ec[_0x6a10('0x54')]){case'US':_0x309dd4=_0x6a10('0x55');break;case'AU':_0x309dd4=_0x6a10('0x56');break;case'EU':_0x309dd4='https://accounts.zoho.eu';break;case'IN':_0x309dd4='https://accounts.zoho.in';break;case'CN':_0x309dd4=_0x6a10('0x57');break;default:_0x309dd4=_0x6a10('0x58');break;}var _0x5b5ce8={'method':'POST','uri':_0x309dd4+_0x6a10('0x59'),'qs':{'refresh_token':_0x4bd1ec['refreshToken'],'client_id':_0x4bd1ec[_0x6a10('0x5a')],'client_secret':_0x4bd1ec['clientSecret'],'grant_type':_0x6a10('0x5b')},'json':!![]};return rp(_0x5b5ce8)['then'](function(_0xd8862e){if(_0xd8862e['access_token']){_0x674c73(_0xd8862e[_0x6a10('0x5c')]);}else{_0x2be1cd('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x46cb5b){_0x2be1cd(_0x46cb5b);});});}exports[_0x6a10('0x5d')]=function(_0x1d2cc6,_0x1bc09f,_0x1fad7d){var _0x51e3e5,_0x419c5f,_0x2d68dd,_0x20ac6a,_0x46f84f;return db[_0x6a10('0x2a')][_0x6a10('0x48')]({'where':{'id':_0x1d2cc6[_0x6a10('0x41')]['id']},'attributes':['id','host',_0x6a10('0x54'),'clientId',_0x6a10('0x5e'),'serverUrl',_0x6a10('0x5f'),'refreshToken']})[_0x6a10('0x23')](handleEntityNotFound(_0x1bc09f,null))[_0x6a10('0x23')](function(_0x5cdc40){_0x46f84f=_0x5cdc40;_0x51e3e5=_0x46f84f[_0x6a10('0x60')];_0x419c5f=_0x51e3e5==='zoho.eu'?'eu':_0x6a10('0x61');_0x2d68dd=_0x46f84f[_0x6a10('0x62')];var _0x319525=_0x2d68dd[_0x6a10('0x63')](-0x1);if(_0x319525==='/'||_0x319525==='\x5c'||_0x319525===':'){_0x2d68dd=_0x2d68dd[_0x6a10('0x64')](0x0,_0x2d68dd[_0x6a10('0x65')](_0x319525));}if(!_0x46f84f['refreshToken']){throw new Error(_0x6a10('0x66'));}return getAccessToken(_0x46f84f);})['then'](function(_0x46a613){if(_0x46a613){return rp({'method':_0x6a10('0x67'),'uri':util[_0x6a10('0x68')](_0x6a10('0x69'),_0x419c5f),'qs':{'module':_0x6a10('0x6a')},'headers':{'Authorization':_0x6a10('0x6b')+_0x46a613},'json':!![]});}})['then'](function(_0xb9464e){if(_0xb9464e){if(_0xb9464e[_0x6a10('0x6c')]&&_0xb9464e['response'][_0x6a10('0x25')]){throw new Error(_0xb9464e['response'][_0x6a10('0x25')][_0x6a10('0x6d')]);}var _0x2d6d57=[];var _0x21f8af=[];var _0x36d626=[_0x6a10('0x6e'),_0x6a10('0x6f'),'Description',_0x6a10('0x70'),_0x6a10('0x71'),_0x6a10('0x72'),_0x6a10('0x73'),_0x6a10('0x74')];_0x21f8af=_[_0x6a10('0x75')](_0xb9464e[_0x6a10('0x34')],function(_0x94ec6b){return _0x36d626[_0x6a10('0x76')](_0x94ec6b[_0x6a10('0x77')]);});for(var _0x36d06d=0x0;_0x36d06d<_0x21f8af[_0x6a10('0x35')];_0x36d06d++){if(_0x21f8af[_0x36d06d]['system_mandatory']===![]){_0x2d6d57[_0x6a10('0x78')]({'id':_0x21f8af[_0x36d06d]['id'],'name':_0x21f8af[_0x36d06d][_0x6a10('0x79')],'custom':_0x21f8af[_0x36d06d]['custom_field'],'options':_0x21f8af[_0x36d06d][_0x6a10('0x7a')]===_0x6a10('0x7b')&&_0x21f8af[_0x36d06d][_0x6a10('0x7c')][_0x6a10('0x35')]>-0x1?_['map'](_0x21f8af[_0x36d06d][_0x6a10('0x7c')],function(_0x2ebd98){return{'name':_0x2ebd98,'value':_0x2ebd98};}):[]});}}return{'count':_0x2d6d57[_0x6a10('0x35')],'rows':_0x2d6d57};}else{return{'count':0x0,'rows':[]};}})[_0x6a10('0x23')](respondWithResult(_0x1bc09f,null))[_0x6a10('0x3f')](function(_0xa1b465){var _0x322241=_0x1d2cc6[_0x6a10('0x30')][_0x6a10('0x7d')]?0x1f4:_0xa1b465['statusCode']||0x1f4;logger[_0x6a10('0x25')](_0x6a10('0x7e'),'getFields',_0x322241,JSON['stringify'](_0xa1b465));delete _0xa1b465['name'];if(_0x322241===0x191){_0x322241=0x190;}_0x1bc09f['status'](_0x322241)[_0x6a10('0x28')](_0x1d2cc6['query'][_0x6a10('0x7d')]?{'message':_0x6a10('0x7f'),'statusCode':_0xa1b465['statusCode']}:_0xa1b465);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e10cabf..20d5a17 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 _0x865a=['changed','zone','serverUrl','clientId','clientSecret','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice','substring','https://accounts.zoho.in','lodash','util','api','moment','bluebird','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x865a,0x16d));var _0xa865=function(_0x3dd3b6,_0x419ebb){_0x3dd3b6=_0x3dd3b6-0x0;var _0x14d8ca=_0x865a[_0x3dd3b6];return _0x14d8ca;};'use strict';var _=require(_0xa865('0x0'));var util=require(_0xa865('0x1'));var logger=require('../../config/logger')(_0xa865('0x2'));var moment=require(_0xa865('0x3'));var BPromise=require(_0xa865('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa865('0x5'));var rimraf=require(_0xa865('0x6'));var config=require('../../config/environment');var attributes=require(_0xa865('0x7'));var integrations=require(_0xa865('0x8'));module[_0xa865('0x9')]=function(_0xf3a283,_0xe20335){return _0xf3a283[_0xa865('0xa')](_0xa865('0xb'),attributes,{'tableName':_0xa865('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x135792,_0x2c8598,_0x3bc9c9){if(_0x135792[_0xa865('0xd')](_0xa865('0xe'))||_0x135792['changed'](_0xa865('0xf'))||_0x135792[_0xa865('0xd')](_0xa865('0x10'))||_0x135792[_0xa865('0xd')](_0xa865('0x11'))||_0x135792['changed'](_0xa865('0x12'))||_0x135792['changed'](_0xa865('0x13'))){var _0x147bec,_0x387a2b;_0x147bec=_0x135792[_0xa865('0xf')];var _0x7aa473=_0x147bec['slice'](-0x1);if(_0x7aa473==='/'||_0x7aa473==='\x5c'||_0x7aa473===':'){_0x147bec=_0x147bec['substring'](0x0,_0x147bec[_0xa865('0x14')](_0x7aa473));}switch(_0x135792[_0xa865('0xe')]){case'US':_0x387a2b=_0xa865('0x15');break;case'AU':_0x387a2b=_0xa865('0x16');break;case'IN':_0x387a2b='https://accounts.zoho.in';break;case'CN':_0x387a2b=_0xa865('0x17');break;default:_0x387a2b=_0xa865('0x18');break;}var _0x4f0176={'method':_0xa865('0x19'),'uri':_0x387a2b+_0xa865('0x1a'),'form':{'grant_type':_0xa865('0x1b'),'client_id':_0x135792[_0xa865('0x10')],'client_secret':_0x135792['clientSecret'],'redirect_uri':_0x135792[_0xa865('0xf')],'code':_0x135792[_0xa865('0x12')]},'headers':{'Content-Type':_0xa865('0x1c')}};return rp(_0x4f0176)[_0xa865('0x1d')](function(_0x5ba736){var _0xd9dbe9=JSON[_0xa865('0x1e')](_0x5ba736);if(_0xd9dbe9[_0xa865('0x1f')]){_0x135792['refreshToken']=_0xd9dbe9[_0xa865('0x1f')];logger['info'](util['format'](_0xa865('0x20'),_0x135792[_0xa865('0x21')],_0x135792['id']));}else{logger[_0xa865('0x22')](util[_0xa865('0x23')](_0xa865('0x24'),_0x135792[_0xa865('0x21')],_0x135792['id']),util['inspect'](_0xd9dbe9,{'showHidden':![],'depth':null}));}return _0x3bc9c9(null,_0x2c8598);})[_0xa865('0x25')](function(_0x2a4f92){logger[_0xa865('0x22')](util[_0xa865('0x23')](_0xa865('0x24'),_0x135792[_0xa865('0x21')],_0x135792['id']),util[_0xa865('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3bc9c9(_0x2a4f92);});}else{return _0x3bc9c9(null,_0x2c8598);}},'beforeUpdate':function(_0x40a25d,_0x4f6bfc,_0x3c6de2){if(_0x40a25d[_0xa865('0xd')]('zone')||_0x40a25d['changed']('serverUrl')||_0x40a25d['changed'](_0xa865('0x10'))||_0x40a25d[_0xa865('0xd')](_0xa865('0x11'))||_0x40a25d[_0xa865('0xd')](_0xa865('0x12'))||_0x40a25d[_0xa865('0xd')]('host')){var _0x2040e8,_0xe000bd;_0x2040e8=_0x40a25d['serverUrl'];var _0x1116d0=_0x2040e8[_0xa865('0x27')](-0x1);if(_0x1116d0==='/'||_0x1116d0==='\x5c'||_0x1116d0===':'){_0x2040e8=_0x2040e8[_0xa865('0x28')](0x0,_0x2040e8[_0xa865('0x14')](_0x1116d0));}switch(_0x40a25d['zone']){case'US':_0xe000bd=_0xa865('0x15');break;case'AU':_0xe000bd='https://accounts.zoho.com.au';break;case'IN':_0xe000bd=_0xa865('0x29');break;case'CN':_0xe000bd=_0xa865('0x17');break;default:_0xe000bd='https://accounts.zoho.eu';break;}var _0x1f7db9={'method':_0xa865('0x19'),'uri':_0xe000bd+'/oauth/v2/token','form':{'grant_type':_0xa865('0x1b'),'client_id':_0x40a25d[_0xa865('0x10')],'client_secret':_0x40a25d[_0xa865('0x11')],'redirect_uri':_0x40a25d[_0xa865('0xf')],'code':_0x40a25d['code']},'headers':{'Content-Type':_0xa865('0x1c')}};return rp(_0x1f7db9)['then'](function(_0x3d3c33){var _0x5297eb=JSON[_0xa865('0x1e')](_0x3d3c33);if(_0x5297eb[_0xa865('0x1f')]){_0x40a25d['refreshToken']=_0x5297eb[_0xa865('0x1f')];logger['info'](util[_0xa865('0x23')](_0xa865('0x20'),_0x40a25d[_0xa865('0x21')],_0x40a25d['id']));}else{logger[_0xa865('0x22')](util[_0xa865('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40a25d['name'],_0x40a25d['id']),util[_0xa865('0x26')](_0x5297eb,{'showHidden':![],'depth':null}));}return _0x3c6de2(null,_0x4f6bfc);})[_0xa865('0x25')](function(_0x5e961b){logger[_0xa865('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40a25d[_0xa865('0x21')],_0x40a25d['id']),util[_0xa865('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3c6de2(_0x5e961b);});}else{return _0x3c6de2(null,_0x4f6bfc);}}}});}; \ No newline at end of file +var _0x0f65=['rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','clientSecret','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','/oauth/v2/token','authorization_code','lodash','util','moment','request-promise'];(function(_0x234a4a,_0x52509b){var _0x43dd2f=function(_0x535998){while(--_0x535998){_0x234a4a['push'](_0x234a4a['shift']());}};_0x43dd2f(++_0x52509b);}(_0x0f65,0x9c));var _0x50f6=function(_0x52a862,_0x474c09){_0x52a862=_0x52a862-0x0;var _0x544829=_0x0f65[_0x52a862];return _0x544829;};'use strict';var _=require(_0x50f6('0x0'));var util=require(_0x50f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50f6('0x2'));var BPromise=require('bluebird');var rp=require(_0x50f6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50f6('0x4'));var config=require(_0x50f6('0x5'));var attributes=require(_0x50f6('0x6'));var integrations=require(_0x50f6('0x7'));module[_0x50f6('0x8')]=function(_0x53175a,_0x416962){return _0x53175a[_0x50f6('0x9')](_0x50f6('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9ed274,_0x29a081,_0x2f9021){if(_0x9ed274[_0x50f6('0xb')]('zone')||_0x9ed274[_0x50f6('0xb')](_0x50f6('0xc'))||_0x9ed274[_0x50f6('0xb')](_0x50f6('0xd'))||_0x9ed274['changed']('clientSecret')||_0x9ed274['changed']('code')||_0x9ed274[_0x50f6('0xb')](_0x50f6('0xe'))){var _0x54072c,_0xdf5e55;_0x54072c=_0x9ed274[_0x50f6('0xc')];var _0x2c7d54=_0x54072c['slice'](-0x1);if(_0x2c7d54==='/'||_0x2c7d54==='\x5c'||_0x2c7d54===':'){_0x54072c=_0x54072c[_0x50f6('0xf')](0x0,_0x54072c[_0x50f6('0x10')](_0x2c7d54));}switch(_0x9ed274[_0x50f6('0x11')]){case'US':_0xdf5e55=_0x50f6('0x12');break;case'AU':_0xdf5e55=_0x50f6('0x13');break;case'IN':_0xdf5e55=_0x50f6('0x14');break;case'CN':_0xdf5e55='https://accounts.zoho.com.cn';break;default:_0xdf5e55=_0x50f6('0x15');break;}var _0x1bb965={'method':_0x50f6('0x16'),'uri':_0xdf5e55+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x9ed274[_0x50f6('0xd')],'client_secret':_0x9ed274[_0x50f6('0x17')],'redirect_uri':_0x9ed274['serverUrl'],'code':_0x9ed274[_0x50f6('0x18')]},'headers':{'Content-Type':_0x50f6('0x19')}};return rp(_0x1bb965)[_0x50f6('0x1a')](function(_0xa72aec){var _0x3a5271=JSON[_0x50f6('0x1b')](_0xa72aec);if(_0x3a5271['refresh_token']){_0x9ed274[_0x50f6('0x1c')]=_0x3a5271[_0x50f6('0x1d')];logger[_0x50f6('0x1e')](util['format'](_0x50f6('0x1f'),_0x9ed274[_0x50f6('0x20')],_0x9ed274['id']));}else{logger[_0x50f6('0x21')](util[_0x50f6('0x22')](_0x50f6('0x23'),_0x9ed274[_0x50f6('0x20')],_0x9ed274['id']),util[_0x50f6('0x24')](_0x3a5271,{'showHidden':![],'depth':null}));}return _0x2f9021(null,_0x29a081);})['catch'](function(_0x3d217b){logger[_0x50f6('0x21')](util[_0x50f6('0x22')](_0x50f6('0x23'),_0x9ed274[_0x50f6('0x20')],_0x9ed274['id']),util[_0x50f6('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2f9021(_0x3d217b);});}else{return _0x2f9021(null,_0x29a081);}},'beforeUpdate':function(_0x31748c,_0x1ba9a5,_0x12ab69){if(_0x31748c['changed'](_0x50f6('0x11'))||_0x31748c[_0x50f6('0xb')]('serverUrl')||_0x31748c[_0x50f6('0xb')]('clientId')||_0x31748c[_0x50f6('0xb')](_0x50f6('0x17'))||_0x31748c[_0x50f6('0xb')](_0x50f6('0x18'))||_0x31748c['changed'](_0x50f6('0xe'))){var _0x92a35c,_0x498d32;_0x92a35c=_0x31748c['serverUrl'];var _0x3d9bc9=_0x92a35c[_0x50f6('0x25')](-0x1);if(_0x3d9bc9==='/'||_0x3d9bc9==='\x5c'||_0x3d9bc9===':'){_0x92a35c=_0x92a35c[_0x50f6('0xf')](0x0,_0x92a35c[_0x50f6('0x10')](_0x3d9bc9));}switch(_0x31748c['zone']){case'US':_0x498d32=_0x50f6('0x12');break;case'AU':_0x498d32=_0x50f6('0x13');break;case'IN':_0x498d32=_0x50f6('0x14');break;case'CN':_0x498d32='https://accounts.zoho.com.cn';break;default:_0x498d32=_0x50f6('0x15');break;}var _0x14be96={'method':'POST','uri':_0x498d32+_0x50f6('0x26'),'form':{'grant_type':_0x50f6('0x27'),'client_id':_0x31748c[_0x50f6('0xd')],'client_secret':_0x31748c[_0x50f6('0x17')],'redirect_uri':_0x31748c[_0x50f6('0xc')],'code':_0x31748c[_0x50f6('0x18')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x14be96)[_0x50f6('0x1a')](function(_0x486193){var _0x4102a0=JSON[_0x50f6('0x1b')](_0x486193);if(_0x4102a0[_0x50f6('0x1d')]){_0x31748c[_0x50f6('0x1c')]=_0x4102a0[_0x50f6('0x1d')];logger['info'](util[_0x50f6('0x22')](_0x50f6('0x1f'),_0x31748c[_0x50f6('0x20')],_0x31748c['id']));}else{logger[_0x50f6('0x21')](util['format'](_0x50f6('0x23'),_0x31748c[_0x50f6('0x20')],_0x31748c['id']),util['inspect'](_0x4102a0,{'showHidden':![],'depth':null}));}return _0x12ab69(null,_0x1ba9a5);})['catch'](function(_0x59196b){logger[_0x50f6('0x21')](util[_0x50f6('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31748c[_0x50f6('0x20')],_0x31748c['id']),util[_0x50f6('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x12ab69(_0x59196b);});}else{return _0x12ab69(null,_0x1ba9a5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bd43cad..9d043f8 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 _0x88c7=['info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','include','map','model','ShowZohoAccount','find','raw','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x88c7,0x6f));var _0x788c=function(_0x4472cd,_0x125645){_0x4472cd=_0x4472cd-0x0;var _0x3c52fa=_0x88c7[_0x4472cd];return _0x3c52fa;};'use strict';var _=require(_0x788c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x788c('0x1'));var rs=require(_0x788c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x788c('0x3'));var logger=require(_0x788c('0x4'))('rpc');var config=require(_0x788c('0x5'));var jayson=require(_0x788c('0x6'));var client=jayson['client'][_0x788c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ed470,_0x54808d,_0x5dde40){return new BPromise(function(_0xe8843b,_0x27abaf){return client[_0x788c('0x8')](_0x2ed470,_0x5dde40)[_0x788c('0x9')](function(_0x43f746){logger['info'](_0x788c('0xa'),_0x54808d,_0x788c('0xb'));logger[_0x788c('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x54808d,_0x788c('0xb'),JSON[_0x788c('0xd')](_0x43f746));if(_0x43f746[_0x788c('0xe')]){if(_0x43f746[_0x788c('0xe')][_0x788c('0xf')]===0x1f4){logger[_0x788c('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x54808d,_0x43f746[_0x788c('0xe')]['message']);return _0x27abaf(_0x43f746[_0x788c('0xe')]['message']);}logger[_0x788c('0xe')](_0x788c('0xa'),_0x54808d,_0x43f746[_0x788c('0xe')][_0x788c('0x10')]);return _0xe8843b(_0x43f746[_0x788c('0xe')][_0x788c('0x10')]);}else{logger[_0x788c('0x11')](_0x788c('0xa'),_0x54808d,_0x788c('0xb'));_0xe8843b(_0x43f746[_0x788c('0x12')][_0x788c('0x10')]);}})[_0x788c('0x13')](function(_0x2c57c3){logger['error'](_0x788c('0xa'),_0x54808d,_0x2c57c3);_0x27abaf(_0x2c57c3);});});}exports[_0x788c('0x14')]=function(_0x2812db){var _0x2988df=this;return new Promise(function(_0x3f16a4,_0x8125){return db[_0x788c('0x15')][_0x788c('0x16')]({'raw':_0x2812db[_0x788c('0x17')]?_0x2812db[_0x788c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2812db[_0x788c('0x17')]?_0x2812db[_0x788c('0x17')][_0x788c('0x18')]||null:null,'attributes':_0x2812db[_0x788c('0x17')]?_0x2812db[_0x788c('0x17')][_0x788c('0x19')]||null:null,'limit':_0x2812db[_0x788c('0x17')]?_0x2812db[_0x788c('0x17')]['limit']||null:null,'include':_0x2812db[_0x788c('0x17')]?_0x2812db[_0x788c('0x17')][_0x788c('0x1a')]?_[_0x788c('0x1b')](_0x2812db[_0x788c('0x17')][_0x788c('0x1a')],function(_0x14deb4){return{'model':db[_0x14deb4[_0x788c('0x1c')]],'as':_0x14deb4['as'],'attributes':_0x14deb4['attributes'],'include':_0x14deb4[_0x788c('0x1a')]?_[_0x788c('0x1b')](_0x14deb4['include'],function(_0x14e2f1){return{'model':db[_0x14e2f1[_0x788c('0x1c')]],'as':_0x14e2f1['as'],'attributes':_0x14e2f1[_0x788c('0x19')],'include':_0x14e2f1['include']?_[_0x788c('0x1b')](_0x14e2f1[_0x788c('0x1a')],function(_0x28fa56){return{'model':db[_0x28fa56[_0x788c('0x1c')]],'as':_0x28fa56['as'],'attributes':_0x28fa56[_0x788c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x788c('0x9')](function(_0x271218){logger[_0x788c('0x11')](_0x788c('0x14'),_0x2812db);logger['debug'](_0x788c('0x14'),_0x2812db,JSON[_0x788c('0xd')](_0x271218));_0x3f16a4(_0x271218);})[_0x788c('0x13')](function(_0x18b271){logger[_0x788c('0xe')](_0x788c('0x14'),_0x18b271[_0x788c('0x10')],_0x2812db);_0x8125(_0x2988df[_0x788c('0xe')](0x1f4,_0x18b271[_0x788c('0x10')]));});});};exports[_0x788c('0x1d')]=function(_0x4d41ac){var _0xedb12e=this;return new Promise(function(_0x4e9b20,_0x2b9bbb){return db[_0x788c('0x15')][_0x788c('0x1e')]({'raw':_0x4d41ac[_0x788c('0x17')]?_0x4d41ac[_0x788c('0x17')][_0x788c('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d41ac['options']?_0x4d41ac[_0x788c('0x17')]['where']||null:null,'attributes':_0x4d41ac[_0x788c('0x17')]?_0x4d41ac['options'][_0x788c('0x19')]||null:null,'include':_0x4d41ac['options']?_0x4d41ac[_0x788c('0x17')]['include']?_['map'](_0x4d41ac[_0x788c('0x17')][_0x788c('0x1a')],function(_0x4eced2){return{'model':db[_0x4eced2[_0x788c('0x1c')]],'as':_0x4eced2['as'],'attributes':_0x4eced2[_0x788c('0x19')],'include':_0x4eced2['include']?_[_0x788c('0x1b')](_0x4eced2['include'],function(_0x581e7e){return{'model':db[_0x581e7e[_0x788c('0x1c')]],'as':_0x581e7e['as'],'attributes':_0x581e7e[_0x788c('0x19')],'include':_0x581e7e[_0x788c('0x1a')]?_['map'](_0x581e7e['include'],function(_0x468557){return{'model':db[_0x468557[_0x788c('0x1c')]],'as':_0x468557['as'],'attributes':_0x468557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5040f0){logger[_0x788c('0x11')]('ShowZohoAccount',_0x4d41ac);logger[_0x788c('0xc')](_0x788c('0x1d'),_0x4d41ac,JSON[_0x788c('0xd')](_0x5040f0));_0x4e9b20(_0x5040f0);})[_0x788c('0x13')](function(_0x9a0da7){logger[_0x788c('0xe')]('ShowZohoAccount',_0x9a0da7[_0x788c('0x10')],_0x4d41ac);_0x2b9bbb(_0xedb12e[_0x788c('0xe')](0x1f4,_0x9a0da7[_0x788c('0x10')]));});});}; \ No newline at end of file +var _0x288a=['limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','raw','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZohoAccount','findAll','options','where','attributes'];(function(_0x293d1c,_0x554a9c){var _0xacceed=function(_0x2cb653){while(--_0x2cb653){_0x293d1c['push'](_0x293d1c['shift']());}};_0xacceed(++_0x554a9c);}(_0x288a,0x188));var _0xa288=function(_0x27fcea,_0x56421d){_0x27fcea=_0x27fcea-0x0;var _0x1544ff=_0x288a[_0x27fcea];return _0x1544ff;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var moment=require(_0xa288('0x1'));var BPromise=require(_0xa288('0x2'));var rs=require(_0xa288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa288('0x4'));var logger=require('../../config/logger')(_0xa288('0x5'));var config=require(_0xa288('0x6'));var jayson=require(_0xa288('0x7'));var client=jayson['client'][_0xa288('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaee90c,_0x156720,_0x57f445){return new BPromise(function(_0x14e4a6,_0x1e8412){return client[_0xa288('0x9')](_0xaee90c,_0x57f445)[_0xa288('0xa')](function(_0x1a0c06){logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x156720,'request\x20sent',JSON[_0xa288('0xe')](_0x1a0c06));if(_0x1a0c06[_0xa288('0xf')]){if(_0x1a0c06['error'][_0xa288('0x10')]===0x1f4){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x1e8412(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x14e4a6(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}else{logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));_0x14e4a6(_0x1a0c06['result'][_0xa288('0x11')]);}})[_0xa288('0x12')](function(_0x299ede){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x299ede);_0x1e8412(_0x299ede);});});}exports[_0xa288('0x13')]=function(_0x49d93c){var _0x2adc53=this;return new Promise(function(_0x3f14b7,_0x56bd2d){return db['ZohoAccount'][_0xa288('0x14')]({'raw':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')][_0xa288('0x16')]||null:null,'attributes':_0x49d93c['options']?_0x49d93c[_0xa288('0x15')][_0xa288('0x17')]||null:null,'limit':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')][_0xa288('0x18')]||null:null,'include':_0x49d93c['options']?_0x49d93c['options'][_0xa288('0x19')]?_[_0xa288('0x1a')](_0x49d93c[_0xa288('0x15')][_0xa288('0x19')],function(_0x4895bb){return{'model':db[_0x4895bb[_0xa288('0x1b')]],'as':_0x4895bb['as'],'attributes':_0x4895bb[_0xa288('0x17')],'include':_0x4895bb[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x4895bb[_0xa288('0x19')],function(_0x23f7b8){return{'model':db[_0x23f7b8[_0xa288('0x1b')]],'as':_0x23f7b8['as'],'attributes':_0x23f7b8[_0xa288('0x17')],'include':_0x23f7b8[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x23f7b8[_0xa288('0x19')],function(_0xffc6b4){return{'model':db[_0xffc6b4[_0xa288('0x1b')]],'as':_0xffc6b4['as'],'attributes':_0xffc6b4[_0xa288('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa288('0xa')](function(_0x5878fb){logger['info'](_0xa288('0x13'),_0x49d93c);logger[_0xa288('0x1c')](_0xa288('0x13'),_0x49d93c,JSON[_0xa288('0xe')](_0x5878fb));_0x3f14b7(_0x5878fb);})[_0xa288('0x12')](function(_0x3bbbc8){logger[_0xa288('0xf')](_0xa288('0x13'),_0x3bbbc8[_0xa288('0x11')],_0x49d93c);_0x56bd2d(_0x2adc53[_0xa288('0xf')](0x1f4,_0x3bbbc8[_0xa288('0x11')]));});});};exports[_0xa288('0x1d')]=function(_0xba620d){var _0x307c5b=this;return new Promise(function(_0x1c0b93,_0x3080d8){return db[_0xa288('0x1e')]['find']({'raw':_0xba620d[_0xa288('0x15')]?_0xba620d['options'][_0xa288('0x1f')]===undefined?!![]:![]:!![],'where':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')]['where']||null:null,'attributes':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')][_0xa288('0x17')]||null:null,'include':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')][_0xa288('0x19')]?_[_0xa288('0x1a')](_0xba620d[_0xa288('0x15')][_0xa288('0x19')],function(_0x5b37f8){return{'model':db[_0x5b37f8['model']],'as':_0x5b37f8['as'],'attributes':_0x5b37f8['attributes'],'include':_0x5b37f8[_0xa288('0x19')]?_['map'](_0x5b37f8[_0xa288('0x19')],function(_0x15f103){return{'model':db[_0x15f103[_0xa288('0x1b')]],'as':_0x15f103['as'],'attributes':_0x15f103[_0xa288('0x17')],'include':_0x15f103[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x15f103['include'],function(_0x5b0a8b){return{'model':db[_0x5b0a8b['model']],'as':_0x5b0a8b['as'],'attributes':_0x5b0a8b[_0xa288('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa288('0xa')](function(_0x539821){logger[_0xa288('0xb')](_0xa288('0x1d'),_0xba620d);logger['debug'](_0xa288('0x1d'),_0xba620d,JSON[_0xa288('0xe')](_0x539821));_0x1c0b93(_0x539821);})[_0xa288('0x12')](function(_0xc80e41){logger[_0xa288('0xf')](_0xa288('0x1d'),_0xc80e41['message'],_0xba620d);_0x3080d8(_0x307c5b[_0xa288('0xf')](0x1f4,_0xc80e41[_0xa288('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 768a021..dc86c9e 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 _0x16fd=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x491b4e,_0x1d5402){var _0x5a556b=function(_0xa3d21d){while(--_0xa3d21d){_0x491b4e['push'](_0x491b4e['shift']());}};_0x5a556b(++_0x1d5402);}(_0x16fd,0xf6));var _0xd16f=function(_0x3a3fcc,_0x38afb3){_0x3a3fcc=_0x3a3fcc-0x0;var _0xe16438=_0x16fd[_0x3a3fcc];return _0xe16438;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd16f('0x0'));var express=require(_0xd16f('0x1'));var router=express[_0xd16f('0x2')]();var fs_extra=require(_0xd16f('0x3'));var auth=require(_0xd16f('0x4'));var interaction=require(_0xd16f('0x5'));var config=require(_0xd16f('0x6'));var controller=require(_0xd16f('0x7'));router[_0xd16f('0x8')]('/',auth[_0xd16f('0x9')](),controller['index']);router[_0xd16f('0x8')]('/:id',auth[_0xd16f('0x9')](),controller[_0xd16f('0xa')]);router[_0xd16f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd16f('0x8')](_0xd16f('0xb'),auth['isAuthenticated'](),controller[_0xd16f('0xc')]);router['get'](_0xd16f('0xd'),auth[_0xd16f('0x9')](),controller[_0xd16f('0xe')]);router[_0xd16f('0xf')]('/',auth[_0xd16f('0x9')](),controller[_0xd16f('0x10')]);router['put'](_0xd16f('0x11'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x12')]);router[_0xd16f('0x13')](_0xd16f('0x11'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x985f=['delete','multer','path','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update'];(function(_0x38f550,_0x1bcba0){var _0x5d3ebe=function(_0x49367d){while(--_0x49367d){_0x38f550['push'](_0x38f550['shift']());}};_0x5d3ebe(++_0x1bcba0);}(_0x985f,0x16a));var _0xf985=function(_0x21337f,_0x370199){_0x21337f=_0x21337f-0x0;var _0x5e8636=_0x985f[_0x21337f];return _0x5e8636;};'use strict';var multer=require(_0xf985('0x0'));var util=require('util');var path=require(_0xf985('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf985('0x2'));var interaction=require(_0xf985('0x3'));var config=require('../../config/environment');var controller=require(_0xf985('0x4'));router[_0xf985('0x5')]('/',auth[_0xf985('0x6')](),controller[_0xf985('0x7')]);router[_0xf985('0x5')](_0xf985('0x8'),auth[_0xf985('0x6')](),controller[_0xf985('0x9')]);router['get'](_0xf985('0xa'),auth['isAuthenticated'](),controller[_0xf985('0xb')]);router[_0xf985('0x5')](_0xf985('0xc'),auth[_0xf985('0x6')](),controller[_0xf985('0xd')]);router[_0xf985('0x5')](_0xf985('0xe'),auth[_0xf985('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0xf985('0x6')](),controller[_0xf985('0xf')]);router[_0xf985('0x10')](_0xf985('0x8'),auth[_0xf985('0x6')](),controller[_0xf985('0x11')]);router[_0xf985('0x12')](_0xf985('0x8'),auth[_0xf985('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 47df500..9f84e4b 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 _0xf36f=['ENUM','contact','nothing','lead','contact_lead','sequelize','exports','STRING'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0xf36f,0x155));var _0xff36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf36f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xff36('0x0'));module[_0xff36('0x1')]={'name':{'type':Sequelize[_0xff36('0x2')]},'moduleCreate':{'type':Sequelize[_0xff36('0x3')]('lead',_0xff36('0x4'),_0xff36('0x5')),'defaultValue':_0xff36('0x6')},'moduleSearch':{'type':Sequelize[_0xff36('0x3')]('contact_lead',_0xff36('0x4'),_0xff36('0x6')),'defaultValue':_0xff36('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8bce=['lead','contact','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bce,0x1d1));var _0xe8bc=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x8bce[_0x53b8e0];return _0x10630c;};'use strict';var Sequelize=require(_0xe8bc('0x0'));module[_0xe8bc('0x1')]={'name':{'type':Sequelize[_0xe8bc('0x2')]},'moduleCreate':{'type':Sequelize[_0xe8bc('0x3')](_0xe8bc('0x4'),_0xe8bc('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe8bc('0x3')](_0xe8bc('0x6'),_0xe8bc('0x5'),'lead'),'defaultValue':_0xe8bc('0x6')},'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 3802f36..8dc4f06 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 _0xf10f=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','count','save','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ZohoConfiguration','findAll','rows','catch','show','params','includeAll','include','find','create','update','body','getFields','findOne','hasOwnProperty','ZohoField','rawAttributes','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x201f2b,_0x344c1f){var _0x52cc9b=function(_0x1e4980){while(--_0x1e4980){_0x201f2b['push'](_0x201f2b['shift']());}};_0x52cc9b(++_0x344c1f);}(_0xf10f,0xe9));var _0xff10=function(_0x48e609,_0x4e40cf){_0x48e609=_0x48e609-0x0;var _0x336d5f=_0xf10f[_0x48e609];return _0x336d5f;};'use strict';var emlformat=require(_0xff10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff10('0x1'));var jsonpatch=require(_0xff10('0x2'));var rp=require(_0xff10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff10('0x4'));var util=require(_0xff10('0x5'));var path=require(_0xff10('0x6'));var sox=require(_0xff10('0x7'));var csv=require('to-csv');var ejs=require(_0xff10('0x8'));var fs=require('fs');var fs_extra=require(_0xff10('0x9'));var _=require(_0xff10('0xa'));var squel=require(_0xff10('0xb'));var crypto=require('crypto');var jsforce=require(_0xff10('0xc'));var deskjs=require(_0xff10('0xd'));var toCsv=require(_0xff10('0xe'));var querystring=require(_0xff10('0xf'));var Papa=require('papaparse');var Redis=require(_0xff10('0x10'));var authService=require(_0xff10('0x11'));var qs=require(_0xff10('0x12'));var as=require(_0xff10('0x13'));var hardwareService=require(_0xff10('0x14'));var logger=require(_0xff10('0x15'))(_0xff10('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff10('0x17'))['db'];function respondWithStatusCode(_0x57d1c3,_0x5ae2f0){_0x5ae2f0=_0x5ae2f0||0xcc;return function(_0x187f1e){if(_0x187f1e){return _0x57d1c3[_0xff10('0x18')](_0x5ae2f0);}return _0x57d1c3[_0xff10('0x19')](_0x5ae2f0)[_0xff10('0x1a')]();};}function respondWithResult(_0x5bd40f,_0x55fee9){_0x55fee9=_0x55fee9||0xc8;return function(_0xcaf454){if(_0xcaf454){return _0x5bd40f[_0xff10('0x19')](_0x55fee9)[_0xff10('0x1b')](_0xcaf454);}};}function respondWithFilteredResult(_0x126ca7,_0x435a91){return function(_0x4d7b03){if(_0x4d7b03){var _0x4cfce7=typeof _0x435a91[_0xff10('0x1c')]==='undefined'&&typeof _0x435a91[_0xff10('0x1d')]==='undefined';var _0x17785b=_0x4d7b03[_0xff10('0x1e')];var _0x47c57d=_0x4cfce7?0x0:_0x435a91[_0xff10('0x1c')];var _0x5c5742=_0x4cfce7?_0x4d7b03[_0xff10('0x1e')]:_0x435a91[_0xff10('0x1c')]+_0x435a91['limit'];var _0xa59923;if(_0x5c5742>=_0x17785b){_0x5c5742=_0x17785b;_0xa59923=0xc8;}else{_0xa59923=0xce;}_0x126ca7['status'](_0xa59923);return _0x126ca7['set']('Content-Range',_0x47c57d+'-'+_0x5c5742+'/'+_0x17785b)[_0xff10('0x1b')](_0x4d7b03);}return null;};}function patchUpdates(_0x3ca881){return function(_0xafc73c){try{jsonpatch['apply'](_0xafc73c,_0x3ca881,!![]);}catch(_0x2305f1){return BPromise['reject'](_0x2305f1);}return _0xafc73c[_0xff10('0x1f')]();};}function saveUpdates(_0x4742de,_0x159777){return function(_0x26b694){if(_0x26b694){return _0x26b694['update'](_0x4742de)[_0xff10('0x20')](function(_0x4b06a7){return _0x4b06a7;});}return null;};}function removeEntity(_0x444282,_0x4eb1bd){return function(_0x40c24c){if(_0x40c24c){return _0x40c24c[_0xff10('0x21')]()[_0xff10('0x20')](function(){_0x444282[_0xff10('0x19')](0xcc)[_0xff10('0x1a')]();});}};}function handleEntityNotFound(_0x96e898,_0x10b49f){return function(_0x5276fc){if(!_0x5276fc){_0x96e898[_0xff10('0x18')](0x194);}return _0x5276fc;};}function handleError(_0x49ebec,_0x321eee){_0x321eee=_0x321eee||0x1f4;return function(_0xaad263){logger[_0xff10('0x22')](_0xaad263[_0xff10('0x23')]);if(_0xaad263[_0xff10('0x24')]){delete _0xaad263[_0xff10('0x24')];}_0x49ebec[_0xff10('0x19')](_0x321eee)[_0xff10('0x25')](_0xaad263);};}exports[_0xff10('0x26')]=function(_0x509669,_0x10699d){var _0x21daac={},_0x23f806={},_0x540cd1={'count':0x0,'rows':[]};var _0x379539=_[_0xff10('0x27')](db['ZohoConfiguration']['rawAttributes'],function(_0x3c59f0){return{'name':_0x3c59f0[_0xff10('0x28')],'type':_0x3c59f0['type'][_0xff10('0x29')]};});_0x23f806[_0xff10('0x2a')]=_[_0xff10('0x27')](_0x379539,_0xff10('0x24'));_0x23f806[_0xff10('0x2b')]=_[_0xff10('0x2c')](_0x509669[_0xff10('0x2b')]);_0x23f806[_0xff10('0x2d')]=_[_0xff10('0x2e')](_0x23f806['model'],_0x23f806[_0xff10('0x2b')]);_0x21daac['attributes']=_[_0xff10('0x2e')](_0x23f806[_0xff10('0x2a')],qs[_0xff10('0x2f')](_0x509669[_0xff10('0x2b')]['fields']));_0x21daac[_0xff10('0x30')]=_0x21daac[_0xff10('0x30')][_0xff10('0x31')]?_0x21daac[_0xff10('0x30')]:_0x23f806[_0xff10('0x2a')];if(!_0x509669[_0xff10('0x2b')]['hasOwnProperty'](_0xff10('0x32'))){_0x21daac[_0xff10('0x1d')]=qs[_0xff10('0x1d')](_0x509669[_0xff10('0x2b')][_0xff10('0x1d')]);_0x21daac[_0xff10('0x1c')]=qs[_0xff10('0x1c')](_0x509669[_0xff10('0x2b')][_0xff10('0x1c')]);}_0x21daac[_0xff10('0x33')]=qs[_0xff10('0x34')](_0x509669['query'][_0xff10('0x34')]);_0x21daac[_0xff10('0x35')]=qs['filters'](_[_0xff10('0x36')](_0x509669[_0xff10('0x2b')],_0x23f806[_0xff10('0x2d')]),_0x379539);if(_0x509669[_0xff10('0x2b')]['filter']){_0x21daac[_0xff10('0x35')]=_[_0xff10('0x37')](_0x21daac['where'],{'$or':_[_0xff10('0x27')](_0x379539,function(_0x2a1178){if(_0x2a1178[_0xff10('0x38')]!==_0xff10('0x39')){var _0xecc269={};_0xecc269[_0x2a1178[_0xff10('0x24')]]={'$like':'%'+_0x509669[_0xff10('0x2b')][_0xff10('0x3a')]+'%'};return _0xecc269;}})});}_0x21daac=_[_0xff10('0x37')]({},_0x21daac,_0x509669[_0xff10('0x3b')]);var _0x576714={'where':_0x21daac['where']};return db[_0xff10('0x3c')][_0xff10('0x1e')](_0x576714)['then'](function(_0x5b3549){_0x540cd1[_0xff10('0x1e')]=_0x5b3549;if(_0x509669[_0xff10('0x2b')]['includeAll']){_0x21daac['include']=[{'all':!![]}];}return db[_0xff10('0x3c')][_0xff10('0x3d')](_0x21daac);})[_0xff10('0x20')](function(_0x2c8c98){_0x540cd1[_0xff10('0x3e')]=_0x2c8c98;return _0x540cd1;})['then'](respondWithFilteredResult(_0x10699d,_0x21daac))[_0xff10('0x3f')](handleError(_0x10699d,null));};exports[_0xff10('0x40')]=function(_0x4bb65b,_0x6bf039){var _0x230a1f={'raw':![],'where':{'id':_0x4bb65b[_0xff10('0x41')]['id']}},_0x5d4fc6={};_0x5d4fc6['model']=_['keys'](db[_0xff10('0x3c')]['rawAttributes']);_0x5d4fc6['query']=_[_0xff10('0x2c')](_0x4bb65b['query']);_0x5d4fc6[_0xff10('0x2d')]=_[_0xff10('0x2e')](_0x5d4fc6[_0xff10('0x2a')],_0x5d4fc6['query']);_0x230a1f[_0xff10('0x30')]=_[_0xff10('0x2e')](_0x5d4fc6['model'],qs[_0xff10('0x2f')](_0x4bb65b[_0xff10('0x2b')]['fields']));_0x230a1f['attributes']=_0x230a1f['attributes'][_0xff10('0x31')]?_0x230a1f['attributes']:_0x5d4fc6[_0xff10('0x2a')];if(_0x4bb65b[_0xff10('0x2b')][_0xff10('0x42')]){_0x230a1f[_0xff10('0x43')]=[{'all':!![]}];}_0x230a1f=_[_0xff10('0x37')]({},_0x230a1f,_0x4bb65b[_0xff10('0x3b')]);return db[_0xff10('0x3c')][_0xff10('0x44')](_0x230a1f)['then'](handleEntityNotFound(_0x6bf039,null))[_0xff10('0x20')](respondWithResult(_0x6bf039,null))[_0xff10('0x3f')](handleError(_0x6bf039,null));};exports[_0xff10('0x45')]=function(_0x1a6e9b,_0xee0b3b){return db[_0xff10('0x3c')][_0xff10('0x45')](_0x1a6e9b['body'],{})[_0xff10('0x20')](respondWithResult(_0xee0b3b,0xc9))[_0xff10('0x3f')](handleError(_0xee0b3b,null));};exports[_0xff10('0x46')]=function(_0x7911aa,_0x4d473b){if(_0x7911aa[_0xff10('0x47')]['id']){delete _0x7911aa['body']['id'];}return db[_0xff10('0x3c')][_0xff10('0x44')]({'where':{'id':_0x7911aa['params']['id']}})[_0xff10('0x20')](handleEntityNotFound(_0x4d473b,null))[_0xff10('0x20')](saveUpdates(_0x7911aa[_0xff10('0x47')],null))[_0xff10('0x20')](respondWithResult(_0x4d473b,null))[_0xff10('0x3f')](handleError(_0x4d473b,null));};exports[_0xff10('0x21')]=function(_0x37c81f,_0x42481d){return db[_0xff10('0x3c')][_0xff10('0x44')]({'where':{'id':_0x37c81f[_0xff10('0x41')]['id']}})['then'](handleEntityNotFound(_0x42481d,null))['then'](removeEntity(_0x42481d,null))['catch'](handleError(_0x42481d,null));};exports[_0xff10('0x48')]=function(_0x2962e5,_0x1c2329,_0x56fa09){var _0x38cd9d={};var _0x248ae2={};var _0x3ced66;var _0x42ceff;return db[_0xff10('0x3c')][_0xff10('0x49')]({'where':{'id':_0x2962e5[_0xff10('0x41')]['id']}})[_0xff10('0x20')](handleEntityNotFound(_0x1c2329,null))[_0xff10('0x20')](function(_0x356e24){if(_0x356e24){_0x3ced66=_0x356e24;_0x248ae2[_0xff10('0x2a')]=_[_0xff10('0x2c')](db['ZohoField']['rawAttributes']);_0x248ae2['query']=_[_0xff10('0x2c')](_0x2962e5['query']);_0x248ae2[_0xff10('0x2d')]=_['intersection'](_0x248ae2[_0xff10('0x2a')],_0x248ae2[_0xff10('0x2b')]);_0x38cd9d['attributes']=_[_0xff10('0x2e')](_0x248ae2['model'],qs[_0xff10('0x2f')](_0x2962e5[_0xff10('0x2b')]['fields']));_0x38cd9d[_0xff10('0x30')]=_0x38cd9d['attributes'][_0xff10('0x31')]?_0x38cd9d[_0xff10('0x30')]:_0x248ae2['model'];_0x38cd9d['order']=qs[_0xff10('0x34')](_0x2962e5['query'][_0xff10('0x34')]);_0x38cd9d[_0xff10('0x35')]=qs[_0xff10('0x2d')](_['pick'](_0x2962e5[_0xff10('0x2b')],_0x248ae2['filters']));if(_0x2962e5[_0xff10('0x2b')][_0xff10('0x3a')]){_0x38cd9d[_0xff10('0x35')]=_[_0xff10('0x37')](_0x38cd9d[_0xff10('0x35')],{'$or':_[_0xff10('0x27')](_0x38cd9d[_0xff10('0x30')],function(_0x118458){var _0xc33ca2={};_0xc33ca2[_0x118458]={'$like':'%'+_0x2962e5['query'][_0xff10('0x3a')]+'%'};return _0xc33ca2;})});}_0x38cd9d=_[_0xff10('0x37')]({},_0x38cd9d,_0x2962e5[_0xff10('0x3b')]);return _0x3ced66[_0xff10('0x48')](_0x38cd9d);}})[_0xff10('0x20')](function(_0x3dd7e7){if(_0x3dd7e7){_0x42ceff=_0x3dd7e7[_0xff10('0x31')];if(!_0x2962e5[_0xff10('0x2b')][_0xff10('0x4a')](_0xff10('0x32'))){_0x38cd9d[_0xff10('0x1d')]=qs[_0xff10('0x1d')](_0x2962e5[_0xff10('0x2b')]['limit']);_0x38cd9d['offset']=qs['offset'](_0x2962e5[_0xff10('0x2b')][_0xff10('0x1c')]);}return _0x3ced66[_0xff10('0x48')](_0x38cd9d);}})[_0xff10('0x20')](function(_0x21f323){if(_0x21f323){return _0x21f323?{'count':_0x42ceff,'rows':_0x21f323}:null;}})[_0xff10('0x20')](respondWithResult(_0x1c2329,null))[_0xff10('0x3f')](handleError(_0x1c2329,null));};exports['getSubjects']=function(_0x3214de,_0x25638b,_0x552128){var _0x46eebe={};var _0x5cc0fa={};var _0x5188ea;var _0x16c268;return db[_0xff10('0x3c')][_0xff10('0x49')]({'where':{'id':_0x3214de[_0xff10('0x41')]['id']}})[_0xff10('0x20')](handleEntityNotFound(_0x25638b,null))[_0xff10('0x20')](function(_0x5727cf){if(_0x5727cf){_0x5188ea=_0x5727cf;_0x5cc0fa['model']=_['keys'](db[_0xff10('0x4b')][_0xff10('0x4c')]);_0x5cc0fa['query']=_[_0xff10('0x2c')](_0x3214de[_0xff10('0x2b')]);_0x5cc0fa[_0xff10('0x2d')]=_[_0xff10('0x2e')](_0x5cc0fa[_0xff10('0x2a')],_0x5cc0fa[_0xff10('0x2b')]);_0x46eebe['attributes']=_[_0xff10('0x2e')](_0x5cc0fa['model'],qs['fields'](_0x3214de['query'][_0xff10('0x2f')]));_0x46eebe[_0xff10('0x30')]=_0x46eebe['attributes'][_0xff10('0x31')]?_0x46eebe[_0xff10('0x30')]:_0x5cc0fa[_0xff10('0x2a')];_0x46eebe[_0xff10('0x33')]=qs[_0xff10('0x34')](_0x3214de[_0xff10('0x2b')][_0xff10('0x34')]);_0x46eebe[_0xff10('0x35')]=qs[_0xff10('0x2d')](_['pick'](_0x3214de[_0xff10('0x2b')],_0x5cc0fa[_0xff10('0x2d')]));if(_0x3214de['query']['filter']){_0x46eebe[_0xff10('0x35')]=_[_0xff10('0x37')](_0x46eebe[_0xff10('0x35')],{'$or':_[_0xff10('0x27')](_0x46eebe[_0xff10('0x30')],function(_0x1c6e85){var _0x44949b={};_0x44949b[_0x1c6e85]={'$like':'%'+_0x3214de[_0xff10('0x2b')][_0xff10('0x3a')]+'%'};return _0x44949b;})});}_0x46eebe=_[_0xff10('0x37')]({},_0x46eebe,_0x3214de[_0xff10('0x3b')]);return _0x5188ea[_0xff10('0x4d')](_0x46eebe);}})[_0xff10('0x20')](function(_0x309ab6){if(_0x309ab6){_0x16c268=_0x309ab6[_0xff10('0x31')];if(!_0x3214de[_0xff10('0x2b')][_0xff10('0x4a')](_0xff10('0x32'))){_0x46eebe[_0xff10('0x1d')]=qs[_0xff10('0x1d')](_0x3214de['query'][_0xff10('0x1d')]);_0x46eebe['offset']=qs[_0xff10('0x1c')](_0x3214de[_0xff10('0x2b')][_0xff10('0x1c')]);}return _0x5188ea[_0xff10('0x4d')](_0x46eebe);}})[_0xff10('0x20')](function(_0x55f106){if(_0x55f106){return _0x55f106?{'count':_0x16c268,'rows':_0x55f106}:null;}})['then'](respondWithResult(_0x25638b,null))[_0xff10('0x3f')](handleError(_0x25638b,null));};exports[_0xff10('0x4e')]=function(_0x592d33,_0x23fa4e,_0x3e1a51){var _0xaf52e0={};var _0x19da45={};var _0x4ec19e;var _0x4b1617;return db[_0xff10('0x3c')]['findOne']({'where':{'id':_0x592d33['params']['id']}})[_0xff10('0x20')](handleEntityNotFound(_0x23fa4e,null))[_0xff10('0x20')](function(_0x4a1e91){if(_0x4a1e91){_0x4ec19e=_0x4a1e91;_0x19da45[_0xff10('0x2a')]=_[_0xff10('0x2c')](db[_0xff10('0x4b')][_0xff10('0x4c')]);_0x19da45['query']=_['keys'](_0x592d33[_0xff10('0x2b')]);_0x19da45[_0xff10('0x2d')]=_[_0xff10('0x2e')](_0x19da45['model'],_0x19da45[_0xff10('0x2b')]);_0xaf52e0[_0xff10('0x30')]=_[_0xff10('0x2e')](_0x19da45[_0xff10('0x2a')],qs[_0xff10('0x2f')](_0x592d33[_0xff10('0x2b')]['fields']));_0xaf52e0[_0xff10('0x30')]=_0xaf52e0[_0xff10('0x30')]['length']?_0xaf52e0[_0xff10('0x30')]:_0x19da45[_0xff10('0x2a')];_0xaf52e0[_0xff10('0x33')]=qs['sort'](_0x592d33[_0xff10('0x2b')][_0xff10('0x34')]);_0xaf52e0['where']=qs['filters'](_['pick'](_0x592d33[_0xff10('0x2b')],_0x19da45['filters']));if(_0x592d33[_0xff10('0x2b')][_0xff10('0x3a')]){_0xaf52e0[_0xff10('0x35')]=_[_0xff10('0x37')](_0xaf52e0[_0xff10('0x35')],{'$or':_[_0xff10('0x27')](_0xaf52e0[_0xff10('0x30')],function(_0x5aa287){var _0x2d93b4={};_0x2d93b4[_0x5aa287]={'$like':'%'+_0x592d33[_0xff10('0x2b')][_0xff10('0x3a')]+'%'};return _0x2d93b4;})});}_0xaf52e0=_[_0xff10('0x37')]({},_0xaf52e0,_0x592d33[_0xff10('0x3b')]);return _0x4ec19e[_0xff10('0x4e')](_0xaf52e0);}})[_0xff10('0x20')](function(_0x4f12d0){if(_0x4f12d0){_0x4b1617=_0x4f12d0[_0xff10('0x31')];if(!_0x592d33[_0xff10('0x2b')][_0xff10('0x4a')](_0xff10('0x32'))){_0xaf52e0[_0xff10('0x1d')]=qs['limit'](_0x592d33[_0xff10('0x2b')][_0xff10('0x1d')]);_0xaf52e0[_0xff10('0x1c')]=qs['offset'](_0x592d33[_0xff10('0x2b')][_0xff10('0x1c')]);}return _0x4ec19e[_0xff10('0x4e')](_0xaf52e0);}})[_0xff10('0x20')](function(_0x593b63){if(_0x593b63){return _0x593b63?{'count':_0x4b1617,'rows':_0x593b63}:null;}})['then'](respondWithResult(_0x23fa4e,null))[_0xff10('0x3f')](handleError(_0x23fa4e,null));}; \ No newline at end of file +var _0x785b=['fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','ZohoConfiguration','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x1fd563,_0x196466){var _0x4673f3=function(_0x15e015){while(--_0x15e015){_0x1fd563['push'](_0x1fd563['shift']());}};_0x4673f3(++_0x196466);}(_0x785b,0x1a7));var _0xb785=function(_0x25985f,_0x384f27){_0x25985f=_0x25985f-0x0;var _0x256030=_0x785b[_0x25985f];return _0x256030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb785('0x0'));var zipdir=require(_0xb785('0x1'));var jsonpatch=require(_0xb785('0x2'));var rp=require(_0xb785('0x3'));var moment=require(_0xb785('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb785('0x5'));var util=require(_0xb785('0x6'));var path=require('path');var sox=require(_0xb785('0x7'));var csv=require(_0xb785('0x8'));var ejs=require(_0xb785('0x9'));var fs=require('fs');var fs_extra=require(_0xb785('0xa'));var _=require(_0xb785('0xb'));var squel=require(_0xb785('0xc'));var crypto=require(_0xb785('0xd'));var jsforce=require(_0xb785('0xe'));var deskjs=require(_0xb785('0xf'));var toCsv=require(_0xb785('0x8'));var querystring=require(_0xb785('0x10'));var Papa=require(_0xb785('0x11'));var Redis=require('ioredis');var authService=require(_0xb785('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb785('0x13'));var hardwareService=require(_0xb785('0x14'));var logger=require(_0xb785('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb785('0x16'));var licenseUtil=require(_0xb785('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e75a,_0x48de8c){_0x48de8c=_0x48de8c||0xcc;return function(_0x4558ab){if(_0x4558ab){return _0x51e75a[_0xb785('0x18')](_0x48de8c);}return _0x51e75a['status'](_0x48de8c)[_0xb785('0x19')]();};}function respondWithResult(_0x2e541e,_0x4c5ce4){_0x4c5ce4=_0x4c5ce4||0xc8;return function(_0x1dbe23){if(_0x1dbe23){return _0x2e541e[_0xb785('0x1a')](_0x4c5ce4)[_0xb785('0x1b')](_0x1dbe23);}};}function respondWithFilteredResult(_0x11ed7f,_0x33e751){return function(_0x44d8fe){if(_0x44d8fe){var _0x6d5e06=typeof _0x33e751['offset']===_0xb785('0x1c')&&typeof _0x33e751[_0xb785('0x1d')]===_0xb785('0x1c');var _0x2a9259=_0x44d8fe[_0xb785('0x1e')];var _0x565913=_0x6d5e06?0x0:_0x33e751['offset'];var _0x3d8c80=_0x6d5e06?_0x44d8fe[_0xb785('0x1e')]:_0x33e751[_0xb785('0x1f')]+_0x33e751['limit'];var _0x28fa48;if(_0x3d8c80>=_0x2a9259){_0x3d8c80=_0x2a9259;_0x28fa48=0xc8;}else{_0x28fa48=0xce;}_0x11ed7f[_0xb785('0x1a')](_0x28fa48);return _0x11ed7f['set'](_0xb785('0x20'),_0x565913+'-'+_0x3d8c80+'/'+_0x2a9259)[_0xb785('0x1b')](_0x44d8fe);}return null;};}function patchUpdates(_0x2a3d37){return function(_0x4af8b5){try{jsonpatch[_0xb785('0x21')](_0x4af8b5,_0x2a3d37,!![]);}catch(_0x171400){return BPromise[_0xb785('0x22')](_0x171400);}return _0x4af8b5[_0xb785('0x23')]();};}function saveUpdates(_0x1471bb,_0x140c6c){return function(_0x241373){if(_0x241373){return _0x241373['update'](_0x1471bb)['then'](function(_0x2a4c37){return _0x2a4c37;});}return null;};}function removeEntity(_0x93a5ec,_0x50c299){return function(_0x35460e){if(_0x35460e){return _0x35460e[_0xb785('0x24')]()[_0xb785('0x25')](function(){_0x93a5ec[_0xb785('0x1a')](0xcc)[_0xb785('0x19')]();});}};}function handleEntityNotFound(_0x5da883,_0x326acc){return function(_0x1dadfb){if(!_0x1dadfb){_0x5da883[_0xb785('0x18')](0x194);}return _0x1dadfb;};}function handleError(_0xc4c2c2,_0xbe506){_0xbe506=_0xbe506||0x1f4;return function(_0xf5720c){logger[_0xb785('0x26')](_0xf5720c['stack']);if(_0xf5720c[_0xb785('0x27')]){delete _0xf5720c[_0xb785('0x27')];}_0xc4c2c2['status'](_0xbe506)[_0xb785('0x28')](_0xf5720c);};}exports[_0xb785('0x29')]=function(_0x42fba3,_0x1d8aaf){var _0x2d7160={},_0x2c8ae4={},_0x348f1f={'count':0x0,'rows':[]};var _0x455d56=_[_0xb785('0x2a')](db['ZohoConfiguration']['rawAttributes'],function(_0xea0ee9){return{'name':_0xea0ee9[_0xb785('0x2b')],'type':_0xea0ee9[_0xb785('0x2c')][_0xb785('0x2d')]};});_0x2c8ae4[_0xb785('0x2e')]=_[_0xb785('0x2a')](_0x455d56,_0xb785('0x27'));_0x2c8ae4[_0xb785('0x2f')]=_[_0xb785('0x30')](_0x42fba3[_0xb785('0x2f')]);_0x2c8ae4['filters']=_[_0xb785('0x31')](_0x2c8ae4[_0xb785('0x2e')],_0x2c8ae4[_0xb785('0x2f')]);_0x2d7160[_0xb785('0x32')]=_['intersection'](_0x2c8ae4['model'],qs[_0xb785('0x33')](_0x42fba3[_0xb785('0x2f')]['fields']));_0x2d7160[_0xb785('0x32')]=_0x2d7160[_0xb785('0x32')][_0xb785('0x34')]?_0x2d7160[_0xb785('0x32')]:_0x2c8ae4['model'];if(!_0x42fba3[_0xb785('0x2f')][_0xb785('0x35')](_0xb785('0x36'))){_0x2d7160[_0xb785('0x1d')]=qs[_0xb785('0x1d')](_0x42fba3[_0xb785('0x2f')]['limit']);_0x2d7160[_0xb785('0x1f')]=qs['offset'](_0x42fba3[_0xb785('0x2f')]['offset']);}_0x2d7160[_0xb785('0x37')]=qs[_0xb785('0x38')](_0x42fba3[_0xb785('0x2f')][_0xb785('0x38')]);_0x2d7160['where']=qs[_0xb785('0x39')](_[_0xb785('0x3a')](_0x42fba3[_0xb785('0x2f')],_0x2c8ae4[_0xb785('0x39')]),_0x455d56);if(_0x42fba3[_0xb785('0x2f')]['filter']){_0x2d7160[_0xb785('0x3b')]=_[_0xb785('0x3c')](_0x2d7160[_0xb785('0x3b')],{'$or':_['map'](_0x455d56,function(_0x514381){if(_0x514381[_0xb785('0x2c')]!==_0xb785('0x3d')){var _0x2ceec8={};_0x2ceec8[_0x514381[_0xb785('0x27')]]={'$like':'%'+_0x42fba3['query'][_0xb785('0x3e')]+'%'};return _0x2ceec8;}})});}_0x2d7160=_[_0xb785('0x3c')]({},_0x2d7160,_0x42fba3[_0xb785('0x3f')]);var _0x5ae219={'where':_0x2d7160[_0xb785('0x3b')]};return db[_0xb785('0x40')][_0xb785('0x1e')](_0x5ae219)[_0xb785('0x25')](function(_0x1125dc){_0x348f1f[_0xb785('0x1e')]=_0x1125dc;if(_0x42fba3[_0xb785('0x2f')][_0xb785('0x41')]){_0x2d7160[_0xb785('0x42')]=[{'all':!![]}];}return db[_0xb785('0x40')][_0xb785('0x43')](_0x2d7160);})[_0xb785('0x25')](function(_0x40b801){_0x348f1f['rows']=_0x40b801;return _0x348f1f;})[_0xb785('0x25')](respondWithFilteredResult(_0x1d8aaf,_0x2d7160))[_0xb785('0x44')](handleError(_0x1d8aaf,null));};exports['show']=function(_0x30bc77,_0x43240b){var _0x1083db={'raw':![],'where':{'id':_0x30bc77[_0xb785('0x45')]['id']}},_0x200546={};_0x200546['model']=_[_0xb785('0x30')](db[_0xb785('0x40')][_0xb785('0x46')]);_0x200546['query']=_[_0xb785('0x30')](_0x30bc77[_0xb785('0x2f')]);_0x200546['filters']=_['intersection'](_0x200546[_0xb785('0x2e')],_0x200546[_0xb785('0x2f')]);_0x1083db['attributes']=_[_0xb785('0x31')](_0x200546[_0xb785('0x2e')],qs[_0xb785('0x33')](_0x30bc77[_0xb785('0x2f')][_0xb785('0x33')]));_0x1083db[_0xb785('0x32')]=_0x1083db[_0xb785('0x32')][_0xb785('0x34')]?_0x1083db[_0xb785('0x32')]:_0x200546['model'];if(_0x30bc77[_0xb785('0x2f')]['includeAll']){_0x1083db[_0xb785('0x42')]=[{'all':!![]}];}_0x1083db=_[_0xb785('0x3c')]({},_0x1083db,_0x30bc77[_0xb785('0x3f')]);return db['ZohoConfiguration']['find'](_0x1083db)['then'](handleEntityNotFound(_0x43240b,null))[_0xb785('0x25')](respondWithResult(_0x43240b,null))[_0xb785('0x44')](handleError(_0x43240b,null));};exports['create']=function(_0x3565ca,_0x91be66){return db['ZohoConfiguration'][_0xb785('0x47')](_0x3565ca[_0xb785('0x48')],{})[_0xb785('0x25')](respondWithResult(_0x91be66,0xc9))[_0xb785('0x44')](handleError(_0x91be66,null));};exports['update']=function(_0x2c825d,_0xd598){if(_0x2c825d[_0xb785('0x48')]['id']){delete _0x2c825d[_0xb785('0x48')]['id'];}return db[_0xb785('0x40')][_0xb785('0x49')]({'where':{'id':_0x2c825d[_0xb785('0x45')]['id']}})['then'](handleEntityNotFound(_0xd598,null))[_0xb785('0x25')](saveUpdates(_0x2c825d[_0xb785('0x48')],null))['then'](respondWithResult(_0xd598,null))[_0xb785('0x44')](handleError(_0xd598,null));};exports[_0xb785('0x24')]=function(_0x8a4b84,_0x3f306d){return db[_0xb785('0x40')]['find']({'where':{'id':_0x8a4b84[_0xb785('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f306d,null))[_0xb785('0x25')](removeEntity(_0x3f306d,null))[_0xb785('0x44')](handleError(_0x3f306d,null));};exports[_0xb785('0x4a')]=function(_0x3784eb,_0x338cdc,_0x224ebe){var _0x34bb34={};var _0x5c7a41={};var _0x1e620b;var _0x21014d;return db[_0xb785('0x40')][_0xb785('0x4b')]({'where':{'id':_0x3784eb[_0xb785('0x45')]['id']}})['then'](handleEntityNotFound(_0x338cdc,null))[_0xb785('0x25')](function(_0x12a1bf){if(_0x12a1bf){_0x1e620b=_0x12a1bf;_0x5c7a41[_0xb785('0x2e')]=_[_0xb785('0x30')](db[_0xb785('0x4c')]['rawAttributes']);_0x5c7a41[_0xb785('0x2f')]=_[_0xb785('0x30')](_0x3784eb['query']);_0x5c7a41[_0xb785('0x39')]=_[_0xb785('0x31')](_0x5c7a41[_0xb785('0x2e')],_0x5c7a41[_0xb785('0x2f')]);_0x34bb34[_0xb785('0x32')]=_['intersection'](_0x5c7a41[_0xb785('0x2e')],qs[_0xb785('0x33')](_0x3784eb[_0xb785('0x2f')][_0xb785('0x33')]));_0x34bb34[_0xb785('0x32')]=_0x34bb34['attributes'][_0xb785('0x34')]?_0x34bb34[_0xb785('0x32')]:_0x5c7a41['model'];_0x34bb34['order']=qs[_0xb785('0x38')](_0x3784eb[_0xb785('0x2f')][_0xb785('0x38')]);_0x34bb34[_0xb785('0x3b')]=qs['filters'](_[_0xb785('0x3a')](_0x3784eb[_0xb785('0x2f')],_0x5c7a41[_0xb785('0x39')]));if(_0x3784eb[_0xb785('0x2f')]['filter']){_0x34bb34[_0xb785('0x3b')]=_['merge'](_0x34bb34[_0xb785('0x3b')],{'$or':_[_0xb785('0x2a')](_0x34bb34[_0xb785('0x32')],function(_0x421830){var _0x235089={};_0x235089[_0x421830]={'$like':'%'+_0x3784eb[_0xb785('0x2f')][_0xb785('0x3e')]+'%'};return _0x235089;})});}_0x34bb34=_[_0xb785('0x3c')]({},_0x34bb34,_0x3784eb['options']);return _0x1e620b['getFields'](_0x34bb34);}})[_0xb785('0x25')](function(_0x27fce1){if(_0x27fce1){_0x21014d=_0x27fce1[_0xb785('0x34')];if(!_0x3784eb[_0xb785('0x2f')][_0xb785('0x35')](_0xb785('0x36'))){_0x34bb34[_0xb785('0x1d')]=qs[_0xb785('0x1d')](_0x3784eb['query'][_0xb785('0x1d')]);_0x34bb34['offset']=qs[_0xb785('0x1f')](_0x3784eb['query'][_0xb785('0x1f')]);}return _0x1e620b['getFields'](_0x34bb34);}})[_0xb785('0x25')](function(_0x47a78f){if(_0x47a78f){return _0x47a78f?{'count':_0x21014d,'rows':_0x47a78f}:null;}})[_0xb785('0x25')](respondWithResult(_0x338cdc,null))[_0xb785('0x44')](handleError(_0x338cdc,null));};exports['getSubjects']=function(_0x4c16f7,_0x14beb5,_0x42a96a){var _0x40b71d={};var _0x46a414={};var _0x2128c3;var _0x20f7de;return db['ZohoConfiguration'][_0xb785('0x4b')]({'where':{'id':_0x4c16f7['params']['id']}})[_0xb785('0x25')](handleEntityNotFound(_0x14beb5,null))[_0xb785('0x25')](function(_0x30788d){if(_0x30788d){_0x2128c3=_0x30788d;_0x46a414[_0xb785('0x2e')]=_['keys'](db[_0xb785('0x4c')][_0xb785('0x46')]);_0x46a414[_0xb785('0x2f')]=_[_0xb785('0x30')](_0x4c16f7['query']);_0x46a414['filters']=_[_0xb785('0x31')](_0x46a414['model'],_0x46a414['query']);_0x40b71d[_0xb785('0x32')]=_[_0xb785('0x31')](_0x46a414['model'],qs[_0xb785('0x33')](_0x4c16f7['query'][_0xb785('0x33')]));_0x40b71d[_0xb785('0x32')]=_0x40b71d['attributes']['length']?_0x40b71d[_0xb785('0x32')]:_0x46a414[_0xb785('0x2e')];_0x40b71d[_0xb785('0x37')]=qs[_0xb785('0x38')](_0x4c16f7[_0xb785('0x2f')][_0xb785('0x38')]);_0x40b71d[_0xb785('0x3b')]=qs[_0xb785('0x39')](_[_0xb785('0x3a')](_0x4c16f7[_0xb785('0x2f')],_0x46a414[_0xb785('0x39')]));if(_0x4c16f7[_0xb785('0x2f')][_0xb785('0x3e')]){_0x40b71d[_0xb785('0x3b')]=_[_0xb785('0x3c')](_0x40b71d[_0xb785('0x3b')],{'$or':_[_0xb785('0x2a')](_0x40b71d[_0xb785('0x32')],function(_0x5d28e0){var _0x14c696={};_0x14c696[_0x5d28e0]={'$like':'%'+_0x4c16f7[_0xb785('0x2f')]['filter']+'%'};return _0x14c696;})});}_0x40b71d=_[_0xb785('0x3c')]({},_0x40b71d,_0x4c16f7['options']);return _0x2128c3[_0xb785('0x4d')](_0x40b71d);}})['then'](function(_0x5c57ee){if(_0x5c57ee){_0x20f7de=_0x5c57ee[_0xb785('0x34')];if(!_0x4c16f7[_0xb785('0x2f')][_0xb785('0x35')](_0xb785('0x36'))){_0x40b71d['limit']=qs[_0xb785('0x1d')](_0x4c16f7['query'][_0xb785('0x1d')]);_0x40b71d['offset']=qs[_0xb785('0x1f')](_0x4c16f7[_0xb785('0x2f')][_0xb785('0x1f')]);}return _0x2128c3['getSubjects'](_0x40b71d);}})['then'](function(_0x2cde2a){if(_0x2cde2a){return _0x2cde2a?{'count':_0x20f7de,'rows':_0x2cde2a}:null;}})[_0xb785('0x25')](respondWithResult(_0x14beb5,null))[_0xb785('0x44')](handleError(_0x14beb5,null));};exports[_0xb785('0x4e')]=function(_0x599434,_0x4fff42,_0x4e7373){var _0x356e5b={};var _0x5a5149={};var _0x49a901;var _0x4596bd;return db[_0xb785('0x40')][_0xb785('0x4b')]({'where':{'id':_0x599434[_0xb785('0x45')]['id']}})[_0xb785('0x25')](handleEntityNotFound(_0x4fff42,null))[_0xb785('0x25')](function(_0x20d4fb){if(_0x20d4fb){_0x49a901=_0x20d4fb;_0x5a5149['model']=_[_0xb785('0x30')](db[_0xb785('0x4c')][_0xb785('0x46')]);_0x5a5149[_0xb785('0x2f')]=_['keys'](_0x599434[_0xb785('0x2f')]);_0x5a5149[_0xb785('0x39')]=_['intersection'](_0x5a5149[_0xb785('0x2e')],_0x5a5149['query']);_0x356e5b[_0xb785('0x32')]=_[_0xb785('0x31')](_0x5a5149[_0xb785('0x2e')],qs[_0xb785('0x33')](_0x599434['query']['fields']));_0x356e5b['attributes']=_0x356e5b[_0xb785('0x32')][_0xb785('0x34')]?_0x356e5b[_0xb785('0x32')]:_0x5a5149[_0xb785('0x2e')];_0x356e5b['order']=qs[_0xb785('0x38')](_0x599434[_0xb785('0x2f')][_0xb785('0x38')]);_0x356e5b[_0xb785('0x3b')]=qs[_0xb785('0x39')](_[_0xb785('0x3a')](_0x599434[_0xb785('0x2f')],_0x5a5149['filters']));if(_0x599434[_0xb785('0x2f')][_0xb785('0x3e')]){_0x356e5b[_0xb785('0x3b')]=_['merge'](_0x356e5b[_0xb785('0x3b')],{'$or':_['map'](_0x356e5b['attributes'],function(_0x5b6143){var _0x32922a={};_0x32922a[_0x5b6143]={'$like':'%'+_0x599434['query'][_0xb785('0x3e')]+'%'};return _0x32922a;})});}_0x356e5b=_[_0xb785('0x3c')]({},_0x356e5b,_0x599434['options']);return _0x49a901[_0xb785('0x4e')](_0x356e5b);}})['then'](function(_0x1df0d1){if(_0x1df0d1){_0x4596bd=_0x1df0d1[_0xb785('0x34')];if(!_0x599434[_0xb785('0x2f')]['hasOwnProperty'](_0xb785('0x36'))){_0x356e5b[_0xb785('0x1d')]=qs[_0xb785('0x1d')](_0x599434[_0xb785('0x2f')][_0xb785('0x1d')]);_0x356e5b[_0xb785('0x1f')]=qs[_0xb785('0x1f')](_0x599434[_0xb785('0x2f')][_0xb785('0x1f')]);}return _0x49a901[_0xb785('0x4e')](_0x356e5b);}})[_0xb785('0x25')](function(_0x123f90){if(_0x123f90){return _0x123f90?{'count':_0x4596bd,'rows':_0x123f90}:null;}})[_0xb785('0x25')](respondWithResult(_0x4fff42,null))[_0xb785('0x44')](handleError(_0x4fff42,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d8e9310..d69a496 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 _0x8b3d=['ZohoConfiguration','util','api','moment','rimraf','../../config/environment','exports'];(function(_0x1f92b9,_0xd2671b){var _0x4055a1=function(_0x46ab6e){while(--_0x46ab6e){_0x1f92b9['push'](_0x1f92b9['shift']());}};_0x4055a1(++_0xd2671b);}(_0x8b3d,0x78));var _0xd8b3=function(_0x43cbbc,_0xf60032){_0x43cbbc=_0x43cbbc-0x0;var _0x25a28d=_0x8b3d[_0x43cbbc];return _0x25a28d;};'use strict';var _=require('lodash');var util=require(_0xd8b3('0x0'));var logger=require('../../config/logger')(_0xd8b3('0x1'));var moment=require(_0xd8b3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8b3('0x3'));var config=require(_0xd8b3('0x4'));var attributes=require('./intZohoConfiguration.attributes');module[_0xd8b3('0x5')]=function(_0x15f1ee,_0x428fd7){return _0x15f1ee['define'](_0xd8b3('0x6'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3718=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x2af01,_0x2e2892){var _0x37865e=function(_0x59f94b){while(--_0x59f94b){_0x2af01['push'](_0x2af01['shift']());}};_0x37865e(++_0x2e2892);}(_0x3718,0x6a));var _0x8371=function(_0xfa3e6d,_0x148bff){_0xfa3e6d=_0xfa3e6d-0x0;var _0x4790d8=_0x3718[_0xfa3e6d];return _0x4790d8;};'use strict';var _=require('lodash');var util=require(_0x8371('0x0'));var logger=require(_0x8371('0x1'))(_0x8371('0x2'));var moment=require(_0x8371('0x3'));var BPromise=require(_0x8371('0x4'));var rp=require(_0x8371('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8371('0x6'));var config=require(_0x8371('0x7'));var attributes=require(_0x8371('0x8'));module[_0x8371('0x9')]=function(_0x2265ff,_0x445a4d){return _0x2265ff['define'](_0x8371('0xa'),attributes,{'tableName':_0x8371('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 e09ff7c..ab30501 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 _0x76cf=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x76cf,0xc5));var _0xf76c=function(_0x141e95,_0x12dd9d){_0x141e95=_0x141e95-0x0;var _0x501b36=_0x76cf[_0x141e95];return _0x501b36;};'use strict';var _=require('lodash');var util=require(_0xf76c('0x0'));var moment=require(_0xf76c('0x1'));var BPromise=require(_0xf76c('0x2'));var rs=require(_0xf76c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf76c('0x4'))['db'];var utils=require(_0xf76c('0x5'));var logger=require(_0xf76c('0x6'))('rpc');var config=require(_0xf76c('0x7'));var jayson=require(_0xf76c('0x8'));var client=jayson[_0xf76c('0x9')][_0xf76c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x430fa5,_0x77b84f,_0x415ba2){return new BPromise(function(_0xe77865,_0x54e4b0){return client[_0xf76c('0xb')](_0x430fa5,_0x415ba2)['then'](function(_0x6d16f6){logger[_0xf76c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x77b84f,_0xf76c('0xd'));logger['debug'](_0xf76c('0xe'),_0x77b84f,_0xf76c('0xd'),JSON['stringify'](_0x6d16f6));if(_0x6d16f6['error']){if(_0x6d16f6[_0xf76c('0xf')]['code']===0x1f4){logger[_0xf76c('0xf')](_0xf76c('0x10'),_0x77b84f,_0x6d16f6[_0xf76c('0xf')][_0xf76c('0x11')]);return _0x54e4b0(_0x6d16f6[_0xf76c('0xf')][_0xf76c('0x11')]);}logger[_0xf76c('0xf')](_0xf76c('0x10'),_0x77b84f,_0x6d16f6[_0xf76c('0xf')]['message']);return _0xe77865(_0x6d16f6[_0xf76c('0xf')]['message']);}else{logger[_0xf76c('0xc')](_0xf76c('0x10'),_0x77b84f,_0xf76c('0xd'));_0xe77865(_0x6d16f6[_0xf76c('0x12')][_0xf76c('0x11')]);}})[_0xf76c('0x13')](function(_0x33c593){logger[_0xf76c('0xf')](_0xf76c('0x10'),_0x77b84f,_0x33c593);_0x54e4b0(_0x33c593);});});} \ No newline at end of file +var _0x4971=['request\x20sent','debug','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','http','request','then','info'];(function(_0x503e35,_0x3f4ffa){var _0x46eced=function(_0x310299){while(--_0x310299){_0x503e35['push'](_0x503e35['shift']());}};_0x46eced(++_0x3f4ffa);}(_0x4971,0x1a5));var _0x1497=function(_0x3e9aca,_0x2ce960){_0x3e9aca=_0x3e9aca-0x0;var _0x182544=_0x4971[_0x3e9aca];return _0x182544;};'use strict';var _=require(_0x1497('0x0'));var util=require(_0x1497('0x1'));var moment=require(_0x1497('0x2'));var BPromise=require(_0x1497('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1497('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1497('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1497('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1497('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11c0fa,_0x1d0c33,_0x3f566b){return new BPromise(function(_0xff3171,_0x47e206){return client[_0x1497('0x8')](_0x11c0fa,_0x3f566b)[_0x1497('0x9')](function(_0x507bdf){logger[_0x1497('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x1d0c33,_0x1497('0xb'));logger[_0x1497('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1d0c33,_0x1497('0xb'),JSON['stringify'](_0x507bdf));if(_0x507bdf[_0x1497('0xd')]){if(_0x507bdf['error']['code']===0x1f4){logger[_0x1497('0xd')](_0x1497('0xe'),_0x1d0c33,_0x507bdf['error'][_0x1497('0xf')]);return _0x47e206(_0x507bdf[_0x1497('0xd')][_0x1497('0xf')]);}logger['error'](_0x1497('0xe'),_0x1d0c33,_0x507bdf['error'][_0x1497('0xf')]);return _0xff3171(_0x507bdf['error'][_0x1497('0xf')]);}else{logger[_0x1497('0xa')](_0x1497('0xe'),_0x1d0c33,_0x1497('0xb'));_0xff3171(_0x507bdf[_0x1497('0x10')][_0x1497('0xf')]);}})[_0x1497('0x11')](function(_0x5b175e){logger[_0x1497('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x1d0c33,_0x5b175e);_0x47e206(_0x5b175e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 61f7509..83dc9de 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 _0x11e5=['/:id','post','create','put','update','delete','exports','util','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x11e5,0x117));var _0x511e=function(_0x221abd,_0x621d76){_0x221abd=_0x221abd-0x0;var _0x47e399=_0x11e5[_0x221abd];return _0x47e399;};'use strict';var multer=require('multer');var util=require(_0x511e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x511e('0x1'));var router=express[_0x511e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x511e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x4'));var controller=require(_0x511e('0x5'));router[_0x511e('0x6')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x6')](_0x511e('0x9'),auth[_0x511e('0x7')](),controller['show']);router[_0x511e('0xa')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0xb')]);router[_0x511e('0xc')](_0x511e('0x9'),auth[_0x511e('0x7')](),controller[_0x511e('0xd')]);router[_0x511e('0xe')]('/:id',auth[_0x511e('0x7')](),controller['destroy']);module[_0x511e('0xf')]=router; \ No newline at end of file +var _0x5fdc=['put','update','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5fdc,0x162));var _0xc5fd=function(_0xf752f,_0x337d9b){_0xf752f=_0xf752f-0x0;var _0x17877b=_0x5fdc[_0xf752f];return _0x17877b;};'use strict';var multer=require('multer');var util=require(_0xc5fd('0x0'));var path=require(_0xc5fd('0x1'));var timeout=require('connect-timeout');var express=require(_0xc5fd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc5fd('0x3'));var interaction=require(_0xc5fd('0x4'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xc5fd('0x5')]('/',auth[_0xc5fd('0x6')](),controller[_0xc5fd('0x7')]);router[_0xc5fd('0x5')](_0xc5fd('0x8'),auth[_0xc5fd('0x6')](),controller['show']);router[_0xc5fd('0x9')]('/',auth[_0xc5fd('0x6')](),controller['create']);router[_0xc5fd('0xa')]('/:id',auth[_0xc5fd('0x6')](),controller[_0xc5fd('0xb')]);router[_0xc5fd('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc5fd('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a912df7..527a5dc 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 _0xb2ad=['ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0xb2ad,0x7e));var _0xdb2a=function(_0x551920,_0x46f783){_0x551920=_0x551920-0x0;var _0x184443=_0xb2ad[_0x551920];return _0x184443;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdb2a('0x0')](_0xdb2a('0x1'),_0xdb2a('0x2'),_0xdb2a('0x3'),_0xdb2a('0x4'),'picklist'),'defaultValue':_0xdb2a('0x1')},'content':{'type':Sequelize[_0xdb2a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xdb2a('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb2a('0x5')]}}; \ No newline at end of file +var _0xc686=['STRING','ENUM','customVariable','sequelize','exports','variable','keyValue','picklist','string'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xc686,0xae));var _0x6c68=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc686[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x6c68('0x0'));module[_0x6c68('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6c68('0x2'),'customVariable',_0x6c68('0x3'),_0x6c68('0x4')),'defaultValue':_0x6c68('0x5')},'content':{'type':Sequelize[_0x6c68('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6c68('0x7')](_0x6c68('0x5'),_0x6c68('0x2'),_0x6c68('0x8'))},'keyContent':{'type':Sequelize[_0x6c68('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6c68('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c68('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f531c8b..9aab2bc 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 _0xa1e0=['attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','model','query','keys','intersection','fields'];(function(_0x51e7b7,_0x4a0241){var _0x5ae963=function(_0x55e02a){while(--_0x55e02a){_0x51e7b7['push'](_0x51e7b7['shift']());}};_0x5ae963(++_0x4a0241);}(_0xa1e0,0xb2));var _0x0a1e=function(_0x5a02b6,_0x5cf355){_0x5a02b6=_0x5a02b6-0x0;var _0x2c26da=_0xa1e0[_0x5a02b6];return _0x2c26da;};'use strict';var emlformat=require(_0x0a1e('0x0'));var rimraf=require(_0x0a1e('0x1'));var zipdir=require(_0x0a1e('0x2'));var jsonpatch=require(_0x0a1e('0x3'));var rp=require(_0x0a1e('0x4'));var moment=require('moment');var BPromise=require(_0x0a1e('0x5'));var Mustache=require(_0x0a1e('0x6'));var util=require(_0x0a1e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0a1e('0x8'));var ejs=require(_0x0a1e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a1e('0xa'));var _=require(_0x0a1e('0xb'));var squel=require(_0x0a1e('0xc'));var crypto=require(_0x0a1e('0xd'));var jsforce=require(_0x0a1e('0xe'));var deskjs=require(_0x0a1e('0xf'));var toCsv=require(_0x0a1e('0x8'));var querystring=require(_0x0a1e('0x10'));var Papa=require('papaparse');var Redis=require(_0x0a1e('0x11'));var authService=require(_0x0a1e('0x12'));var qs=require(_0x0a1e('0x13'));var as=require(_0x0a1e('0x14'));var hardwareService=require(_0x0a1e('0x15'));var logger=require('../../config/logger')(_0x0a1e('0x16'));var utils=require(_0x0a1e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0a1e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0af8,_0x4d6a54){_0x4d6a54=_0x4d6a54||0xcc;return function(_0x5e1b05){if(_0x5e1b05){return _0x4b0af8['sendStatus'](_0x4d6a54);}return _0x4b0af8[_0x0a1e('0x19')](_0x4d6a54)[_0x0a1e('0x1a')]();};}function respondWithResult(_0x2a5615,_0x5c557d){_0x5c557d=_0x5c557d||0xc8;return function(_0xb4a1f0){if(_0xb4a1f0){return _0x2a5615['status'](_0x5c557d)[_0x0a1e('0x1b')](_0xb4a1f0);}};}function respondWithFilteredResult(_0x4868ca,_0x2a1f64){return function(_0x3bed57){if(_0x3bed57){var _0x2f3a15=typeof _0x2a1f64[_0x0a1e('0x1c')]===_0x0a1e('0x1d')&&typeof _0x2a1f64['limit']===_0x0a1e('0x1d');var _0x4c973b=_0x3bed57[_0x0a1e('0x1e')];var _0x5a221c=_0x2f3a15?0x0:_0x2a1f64[_0x0a1e('0x1c')];var _0x1abc96=_0x2f3a15?_0x3bed57['count']:_0x2a1f64[_0x0a1e('0x1c')]+_0x2a1f64[_0x0a1e('0x1f')];var _0x2efa9f;if(_0x1abc96>=_0x4c973b){_0x1abc96=_0x4c973b;_0x2efa9f=0xc8;}else{_0x2efa9f=0xce;}_0x4868ca[_0x0a1e('0x19')](_0x2efa9f);return _0x4868ca[_0x0a1e('0x20')](_0x0a1e('0x21'),_0x5a221c+'-'+_0x1abc96+'/'+_0x4c973b)[_0x0a1e('0x1b')](_0x3bed57);}return null;};}function patchUpdates(_0xdc03dc){return function(_0x7dcaba){try{jsonpatch[_0x0a1e('0x22')](_0x7dcaba,_0xdc03dc,!![]);}catch(_0x2d58b4){return BPromise[_0x0a1e('0x23')](_0x2d58b4);}return _0x7dcaba[_0x0a1e('0x24')]();};}function saveUpdates(_0x3e38f9,_0x8a8ca8){return function(_0x2cbd0a){if(_0x2cbd0a){return _0x2cbd0a[_0x0a1e('0x25')](_0x3e38f9)[_0x0a1e('0x26')](function(_0x484953){return _0x484953;});}return null;};}function removeEntity(_0x32fa89,_0x129c7f){return function(_0x1b4b08){if(_0x1b4b08){return _0x1b4b08['destroy']()['then'](function(){_0x32fa89['status'](0xcc)[_0x0a1e('0x1a')]();});}};}function handleEntityNotFound(_0x392cf1,_0xdc8145){return function(_0x12ffa5){if(!_0x12ffa5){_0x392cf1[_0x0a1e('0x27')](0x194);}return _0x12ffa5;};}function handleError(_0x3a8175,_0x5e74c9){_0x5e74c9=_0x5e74c9||0x1f4;return function(_0x2824da){logger[_0x0a1e('0x28')](_0x2824da[_0x0a1e('0x29')]);if(_0x2824da[_0x0a1e('0x2a')]){delete _0x2824da[_0x0a1e('0x2a')];}_0x3a8175['status'](_0x5e74c9)[_0x0a1e('0x2b')](_0x2824da);};}exports['index']=function(_0x5c642c,_0x2365f1){var _0x3b9d69={},_0x4c5da7={},_0x10124b={'count':0x0,'rows':[]};var _0x3e864c=_[_0x0a1e('0x2c')](db[_0x0a1e('0x2d')][_0x0a1e('0x2e')],function(_0x5ebf49){return{'name':_0x5ebf49[_0x0a1e('0x2f')],'type':_0x5ebf49['type']['key']};});_0x4c5da7[_0x0a1e('0x30')]=_[_0x0a1e('0x2c')](_0x3e864c,_0x0a1e('0x2a'));_0x4c5da7[_0x0a1e('0x31')]=_[_0x0a1e('0x32')](_0x5c642c[_0x0a1e('0x31')]);_0x4c5da7['filters']=_['intersection'](_0x4c5da7[_0x0a1e('0x30')],_0x4c5da7[_0x0a1e('0x31')]);_0x3b9d69['attributes']=_[_0x0a1e('0x33')](_0x4c5da7[_0x0a1e('0x30')],qs[_0x0a1e('0x34')](_0x5c642c[_0x0a1e('0x31')][_0x0a1e('0x34')]));_0x3b9d69[_0x0a1e('0x35')]=_0x3b9d69[_0x0a1e('0x35')][_0x0a1e('0x36')]?_0x3b9d69[_0x0a1e('0x35')]:_0x4c5da7[_0x0a1e('0x30')];if(!_0x5c642c[_0x0a1e('0x31')][_0x0a1e('0x37')](_0x0a1e('0x38'))){_0x3b9d69[_0x0a1e('0x1f')]=qs[_0x0a1e('0x1f')](_0x5c642c[_0x0a1e('0x31')][_0x0a1e('0x1f')]);_0x3b9d69['offset']=qs[_0x0a1e('0x1c')](_0x5c642c[_0x0a1e('0x31')][_0x0a1e('0x1c')]);}_0x3b9d69[_0x0a1e('0x39')]=qs[_0x0a1e('0x3a')](_0x5c642c[_0x0a1e('0x31')][_0x0a1e('0x3a')]);_0x3b9d69['where']=qs[_0x0a1e('0x3b')](_[_0x0a1e('0x3c')](_0x5c642c[_0x0a1e('0x31')],_0x4c5da7[_0x0a1e('0x3b')]),_0x3e864c);if(_0x5c642c[_0x0a1e('0x31')]['filter']){_0x3b9d69[_0x0a1e('0x3d')]=_[_0x0a1e('0x3e')](_0x3b9d69[_0x0a1e('0x3d')],{'$or':_['map'](_0x3e864c,function(_0x4c8261){if(_0x4c8261[_0x0a1e('0x3f')]!==_0x0a1e('0x40')){var _0x259ac2={};_0x259ac2[_0x4c8261[_0x0a1e('0x2a')]]={'$like':'%'+_0x5c642c['query'][_0x0a1e('0x41')]+'%'};return _0x259ac2;}})});}_0x3b9d69=_[_0x0a1e('0x3e')]({},_0x3b9d69,_0x5c642c['options']);var _0x122af1={'where':_0x3b9d69[_0x0a1e('0x3d')]};return db['ZohoField'][_0x0a1e('0x1e')](_0x122af1)['then'](function(_0x4edb5b){_0x10124b[_0x0a1e('0x1e')]=_0x4edb5b;if(_0x5c642c['query'][_0x0a1e('0x42')]){_0x3b9d69['include']=[{'all':!![]}];}return db[_0x0a1e('0x2d')][_0x0a1e('0x43')](_0x3b9d69);})[_0x0a1e('0x26')](function(_0x4e33aa){_0x10124b[_0x0a1e('0x44')]=_0x4e33aa;return _0x10124b;})['then'](respondWithFilteredResult(_0x2365f1,_0x3b9d69))[_0x0a1e('0x45')](handleError(_0x2365f1,null));};exports['show']=function(_0x42fb79,_0x516343){var _0x589b70={'raw':!![],'where':{'id':_0x42fb79[_0x0a1e('0x46')]['id']}},_0x259806={};_0x259806[_0x0a1e('0x30')]=_[_0x0a1e('0x32')](db[_0x0a1e('0x2d')][_0x0a1e('0x2e')]);_0x259806[_0x0a1e('0x31')]=_[_0x0a1e('0x32')](_0x42fb79[_0x0a1e('0x31')]);_0x259806[_0x0a1e('0x3b')]=_[_0x0a1e('0x33')](_0x259806['model'],_0x259806[_0x0a1e('0x31')]);_0x589b70[_0x0a1e('0x35')]=_[_0x0a1e('0x33')](_0x259806[_0x0a1e('0x30')],qs[_0x0a1e('0x34')](_0x42fb79['query'][_0x0a1e('0x34')]));_0x589b70[_0x0a1e('0x35')]=_0x589b70[_0x0a1e('0x35')][_0x0a1e('0x36')]?_0x589b70['attributes']:_0x259806[_0x0a1e('0x30')];if(_0x42fb79[_0x0a1e('0x31')][_0x0a1e('0x42')]){_0x589b70[_0x0a1e('0x47')]=[{'all':!![]}];}_0x589b70=_[_0x0a1e('0x3e')]({},_0x589b70,_0x42fb79[_0x0a1e('0x48')]);return db[_0x0a1e('0x2d')][_0x0a1e('0x49')](_0x589b70)['then'](handleEntityNotFound(_0x516343,null))[_0x0a1e('0x26')](respondWithResult(_0x516343,null))[_0x0a1e('0x45')](handleError(_0x516343,null));};exports[_0x0a1e('0x4a')]=function(_0x2e7668,_0x536627){return db[_0x0a1e('0x2d')][_0x0a1e('0x4a')](_0x2e7668[_0x0a1e('0x4b')],{})[_0x0a1e('0x26')](respondWithResult(_0x536627,0xc9))[_0x0a1e('0x45')](handleError(_0x536627,null));};exports[_0x0a1e('0x25')]=function(_0x578d03,_0x3aa4e6){if(_0x578d03[_0x0a1e('0x4b')]['id']){delete _0x578d03[_0x0a1e('0x4b')]['id'];}return db[_0x0a1e('0x2d')]['find']({'where':{'id':_0x578d03[_0x0a1e('0x46')]['id']}})[_0x0a1e('0x26')](handleEntityNotFound(_0x3aa4e6,null))[_0x0a1e('0x26')](saveUpdates(_0x578d03[_0x0a1e('0x4b')],null))[_0x0a1e('0x26')](respondWithResult(_0x3aa4e6,null))[_0x0a1e('0x45')](handleError(_0x3aa4e6,null));};exports[_0x0a1e('0x4c')]=function(_0x245402,_0x21381f){return db[_0x0a1e('0x2d')][_0x0a1e('0x49')]({'where':{'id':_0x245402[_0x0a1e('0x46')]['id']}})[_0x0a1e('0x26')](handleEntityNotFound(_0x21381f,null))[_0x0a1e('0x26')](removeEntity(_0x21381f,null))[_0x0a1e('0x45')](handleError(_0x21381f,null));}; \ No newline at end of file +var _0x1b81=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','ZohoField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','zip-dir','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js'];(function(_0x35b99b,_0x2efd45){var _0xc34057=function(_0x59ffe9){while(--_0x59ffe9){_0x35b99b['push'](_0x35b99b['shift']());}};_0xc34057(++_0x2efd45);}(_0x1b81,0x7d));var _0x11b8=function(_0x27ba4e,_0xc0c86c){_0x27ba4e=_0x27ba4e-0x0;var _0x540238=_0x1b81[_0x27ba4e];return _0x540238;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11b8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x11b8('0x1'));var Mustache=require(_0x11b8('0x2'));var util=require('util');var path=require(_0x11b8('0x3'));var sox=require(_0x11b8('0x4'));var csv=require('to-csv');var ejs=require(_0x11b8('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11b8('0x6'));var squel=require('squel');var crypto=require(_0x11b8('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x11b8('0x8'));var toCsv=require(_0x11b8('0x9'));var querystring=require(_0x11b8('0xa'));var Papa=require(_0x11b8('0xb'));var Redis=require(_0x11b8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x11b8('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11b8('0xe'));var logger=require(_0x11b8('0xf'))(_0x11b8('0x10'));var utils=require('../../config/utils');var config=require(_0x11b8('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372757,_0xbe406b){_0xbe406b=_0xbe406b||0xcc;return function(_0x28368b){if(_0x28368b){return _0x372757[_0x11b8('0x12')](_0xbe406b);}return _0x372757[_0x11b8('0x13')](_0xbe406b)[_0x11b8('0x14')]();};}function respondWithResult(_0x4f7c23,_0x18bf5b){_0x18bf5b=_0x18bf5b||0xc8;return function(_0x110c9a){if(_0x110c9a){return _0x4f7c23[_0x11b8('0x13')](_0x18bf5b)[_0x11b8('0x15')](_0x110c9a);}};}function respondWithFilteredResult(_0x4d63a4,_0x46fb65){return function(_0x2b9799){if(_0x2b9799){var _0x36f7c6=typeof _0x46fb65[_0x11b8('0x16')]===_0x11b8('0x17')&&typeof _0x46fb65[_0x11b8('0x18')]==='undefined';var _0x385d38=_0x2b9799[_0x11b8('0x19')];var _0x2aa27c=_0x36f7c6?0x0:_0x46fb65['offset'];var _0x13bdb2=_0x36f7c6?_0x2b9799['count']:_0x46fb65[_0x11b8('0x16')]+_0x46fb65['limit'];var _0xaa80d8;if(_0x13bdb2>=_0x385d38){_0x13bdb2=_0x385d38;_0xaa80d8=0xc8;}else{_0xaa80d8=0xce;}_0x4d63a4[_0x11b8('0x13')](_0xaa80d8);return _0x4d63a4['set'](_0x11b8('0x1a'),_0x2aa27c+'-'+_0x13bdb2+'/'+_0x385d38)[_0x11b8('0x15')](_0x2b9799);}return null;};}function patchUpdates(_0x1721e4){return function(_0xb75923){try{jsonpatch[_0x11b8('0x1b')](_0xb75923,_0x1721e4,!![]);}catch(_0x1090d7){return BPromise[_0x11b8('0x1c')](_0x1090d7);}return _0xb75923['save']();};}function saveUpdates(_0x505780,_0x47c900){return function(_0x29fc51){if(_0x29fc51){return _0x29fc51[_0x11b8('0x1d')](_0x505780)['then'](function(_0x38a8d4){return _0x38a8d4;});}return null;};}function removeEntity(_0x471811,_0x519b57){return function(_0x16a0ef){if(_0x16a0ef){return _0x16a0ef[_0x11b8('0x1e')]()[_0x11b8('0x1f')](function(){_0x471811[_0x11b8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x294512,_0x468771){return function(_0x29a5ec){if(!_0x29a5ec){_0x294512[_0x11b8('0x12')](0x194);}return _0x29a5ec;};}function handleError(_0x2f8169,_0x3b6f4f){_0x3b6f4f=_0x3b6f4f||0x1f4;return function(_0x40d87e){logger['error'](_0x40d87e[_0x11b8('0x20')]);if(_0x40d87e[_0x11b8('0x21')]){delete _0x40d87e[_0x11b8('0x21')];}_0x2f8169[_0x11b8('0x13')](_0x3b6f4f)[_0x11b8('0x22')](_0x40d87e);};}exports[_0x11b8('0x23')]=function(_0x5a1f65,_0x1628b8){var _0x287f06={},_0xbe691e={},_0x8dca6f={'count':0x0,'rows':[]};var _0x376684=_['map'](db[_0x11b8('0x24')][_0x11b8('0x25')],function(_0x1e0db6){return{'name':_0x1e0db6['fieldName'],'type':_0x1e0db6[_0x11b8('0x26')][_0x11b8('0x27')]};});_0xbe691e[_0x11b8('0x28')]=_[_0x11b8('0x29')](_0x376684,_0x11b8('0x21'));_0xbe691e[_0x11b8('0x2a')]=_[_0x11b8('0x2b')](_0x5a1f65[_0x11b8('0x2a')]);_0xbe691e[_0x11b8('0x2c')]=_[_0x11b8('0x2d')](_0xbe691e[_0x11b8('0x28')],_0xbe691e['query']);_0x287f06[_0x11b8('0x2e')]=_['intersection'](_0xbe691e[_0x11b8('0x28')],qs[_0x11b8('0x2f')](_0x5a1f65[_0x11b8('0x2a')][_0x11b8('0x2f')]));_0x287f06['attributes']=_0x287f06[_0x11b8('0x2e')][_0x11b8('0x30')]?_0x287f06['attributes']:_0xbe691e[_0x11b8('0x28')];if(!_0x5a1f65[_0x11b8('0x2a')][_0x11b8('0x31')](_0x11b8('0x32'))){_0x287f06['limit']=qs[_0x11b8('0x18')](_0x5a1f65['query'][_0x11b8('0x18')]);_0x287f06[_0x11b8('0x16')]=qs[_0x11b8('0x16')](_0x5a1f65[_0x11b8('0x2a')]['offset']);}_0x287f06[_0x11b8('0x33')]=qs['sort'](_0x5a1f65['query'][_0x11b8('0x34')]);_0x287f06['where']=qs[_0x11b8('0x2c')](_['pick'](_0x5a1f65[_0x11b8('0x2a')],_0xbe691e[_0x11b8('0x2c')]),_0x376684);if(_0x5a1f65[_0x11b8('0x2a')][_0x11b8('0x35')]){_0x287f06[_0x11b8('0x36')]=_[_0x11b8('0x37')](_0x287f06['where'],{'$or':_[_0x11b8('0x29')](_0x376684,function(_0x497072){if(_0x497072[_0x11b8('0x26')]!=='VIRTUAL'){var _0x31a035={};_0x31a035[_0x497072[_0x11b8('0x21')]]={'$like':'%'+_0x5a1f65[_0x11b8('0x2a')][_0x11b8('0x35')]+'%'};return _0x31a035;}})});}_0x287f06=_[_0x11b8('0x37')]({},_0x287f06,_0x5a1f65[_0x11b8('0x38')]);var _0x3f20ce={'where':_0x287f06['where']};return db['ZohoField']['count'](_0x3f20ce)[_0x11b8('0x1f')](function(_0x4317e7){_0x8dca6f[_0x11b8('0x19')]=_0x4317e7;if(_0x5a1f65[_0x11b8('0x2a')][_0x11b8('0x39')]){_0x287f06[_0x11b8('0x3a')]=[{'all':!![]}];}return db[_0x11b8('0x24')][_0x11b8('0x3b')](_0x287f06);})['then'](function(_0x99df9c){_0x8dca6f[_0x11b8('0x3c')]=_0x99df9c;return _0x8dca6f;})[_0x11b8('0x1f')](respondWithFilteredResult(_0x1628b8,_0x287f06))['catch'](handleError(_0x1628b8,null));};exports[_0x11b8('0x3d')]=function(_0x2dc8d4,_0x1ef748){var _0x44617f={'raw':!![],'where':{'id':_0x2dc8d4[_0x11b8('0x3e')]['id']}},_0x63d632={};_0x63d632[_0x11b8('0x28')]=_[_0x11b8('0x2b')](db[_0x11b8('0x24')]['rawAttributes']);_0x63d632[_0x11b8('0x2a')]=_[_0x11b8('0x2b')](_0x2dc8d4[_0x11b8('0x2a')]);_0x63d632['filters']=_[_0x11b8('0x2d')](_0x63d632[_0x11b8('0x28')],_0x63d632['query']);_0x44617f[_0x11b8('0x2e')]=_[_0x11b8('0x2d')](_0x63d632['model'],qs['fields'](_0x2dc8d4['query'][_0x11b8('0x2f')]));_0x44617f['attributes']=_0x44617f['attributes'][_0x11b8('0x30')]?_0x44617f[_0x11b8('0x2e')]:_0x63d632[_0x11b8('0x28')];if(_0x2dc8d4['query']['includeAll']){_0x44617f[_0x11b8('0x3a')]=[{'all':!![]}];}_0x44617f=_['merge']({},_0x44617f,_0x2dc8d4[_0x11b8('0x38')]);return db[_0x11b8('0x24')][_0x11b8('0x3f')](_0x44617f)[_0x11b8('0x1f')](handleEntityNotFound(_0x1ef748,null))['then'](respondWithResult(_0x1ef748,null))[_0x11b8('0x40')](handleError(_0x1ef748,null));};exports[_0x11b8('0x41')]=function(_0x580083,_0xf54867){return db[_0x11b8('0x24')][_0x11b8('0x41')](_0x580083[_0x11b8('0x42')],{})[_0x11b8('0x1f')](respondWithResult(_0xf54867,0xc9))['catch'](handleError(_0xf54867,null));};exports['update']=function(_0x598b04,_0x32a46b){if(_0x598b04[_0x11b8('0x42')]['id']){delete _0x598b04[_0x11b8('0x42')]['id'];}return db['ZohoField'][_0x11b8('0x3f')]({'where':{'id':_0x598b04['params']['id']}})[_0x11b8('0x1f')](handleEntityNotFound(_0x32a46b,null))[_0x11b8('0x1f')](saveUpdates(_0x598b04['body'],null))[_0x11b8('0x1f')](respondWithResult(_0x32a46b,null))[_0x11b8('0x40')](handleError(_0x32a46b,null));};exports[_0x11b8('0x1e')]=function(_0x47938b,_0x350304){return db[_0x11b8('0x24')]['find']({'where':{'id':_0x47938b[_0x11b8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x350304,null))[_0x11b8('0x1f')](removeEntity(_0x350304,null))[_0x11b8('0x40')](handleError(_0x350304,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 66f6066..3ee3afd 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 _0x4325=['../../config/environment','./intZohoField.attributes','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['lodash','util','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0xed1c,0xe4));var _0xced1=function(_0x1a9b15,_0x3c0f23){_0x1a9b15=_0x1a9b15-0x0;var _0x4d4f37=_0xed1c[_0x1a9b15];return _0x4d4f37;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[{'name':_0xced1('0x9'),'fields':[_0xced1('0xa'),_0xced1('0xb')],'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 9c46ac3..b5a7133 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 _0x2444=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2444,0x190));var _0x4244=function(_0x78fbb4,_0x23da36){_0x78fbb4=_0x78fbb4-0x0;var _0x3a67e8=_0x2444[_0x78fbb4];return _0x3a67e8;};'use strict';var _=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var moment=require(_0x4244('0x2'));var BPromise=require('bluebird');var rs=require(_0x4244('0x3'));var fs=require('fs');var Redis=require(_0x4244('0x4'));var db=require(_0x4244('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4244('0x6'))(_0x4244('0x7'));var config=require(_0x4244('0x8'));var jayson=require(_0x4244('0x9'));var client=jayson[_0x4244('0xa')][_0x4244('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31d709,_0x40a267,_0x5c8c2e){return new BPromise(function(_0x30506b,_0x51b782){return client['request'](_0x31d709,_0x5c8c2e)['then'](function(_0x364521){logger[_0x4244('0xc')](_0x4244('0xd'),_0x40a267,_0x4244('0xe'));logger[_0x4244('0xf')](_0x4244('0x10'),_0x40a267,_0x4244('0xe'),JSON[_0x4244('0x11')](_0x364521));if(_0x364521[_0x4244('0x12')]){if(_0x364521[_0x4244('0x12')][_0x4244('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x40a267,_0x364521[_0x4244('0x12')][_0x4244('0x14')]);return _0x51b782(_0x364521[_0x4244('0x12')][_0x4244('0x14')]);}logger[_0x4244('0x12')](_0x4244('0xd'),_0x40a267,_0x364521[_0x4244('0x12')][_0x4244('0x14')]);return _0x30506b(_0x364521['error'][_0x4244('0x14')]);}else{logger[_0x4244('0xc')](_0x4244('0xd'),_0x40a267,_0x4244('0xe'));_0x30506b(_0x364521[_0x4244('0x15')][_0x4244('0x14')]);}})[_0x4244('0x16')](function(_0x23ad06){logger['error']('ZohoField,\x20%s,\x20%s',_0x40a267,_0x23ad06);_0x51b782(_0x23ad06);});});} \ No newline at end of file +var _0xfb69=['ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring'];(function(_0x49258d,_0x5bcf0e){var _0x2a9044=function(_0x1a629e){while(--_0x1a629e){_0x49258d['push'](_0x49258d['shift']());}};_0x2a9044(++_0x5bcf0e);}(_0xfb69,0x1d8));var _0x9fb6=function(_0x828c71,_0x209482){_0x828c71=_0x828c71-0x0;var _0x29e093=_0xfb69[_0x828c71];return _0x29e093;};'use strict';var _=require('lodash');var util=require(_0x9fb6('0x0'));var moment=require('moment');var BPromise=require(_0x9fb6('0x1'));var rs=require(_0x9fb6('0x2'));var fs=require('fs');var Redis=require(_0x9fb6('0x3'));var db=require(_0x9fb6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fb6('0x5'))(_0x9fb6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9fb6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dbf48,_0x1eace9,_0x4af423){return new BPromise(function(_0x75f456,_0x3435c6){return client[_0x9fb6('0x8')](_0x4dbf48,_0x4af423)[_0x9fb6('0x9')](function(_0x22aba1){logger['info'](_0x9fb6('0xa'),_0x1eace9,_0x9fb6('0xb'));logger['debug'](_0x9fb6('0xc'),_0x1eace9,_0x9fb6('0xb'),JSON['stringify'](_0x22aba1));if(_0x22aba1[_0x9fb6('0xd')]){if(_0x22aba1[_0x9fb6('0xd')][_0x9fb6('0xe')]===0x1f4){logger['error'](_0x9fb6('0xa'),_0x1eace9,_0x22aba1[_0x9fb6('0xd')][_0x9fb6('0xf')]);return _0x3435c6(_0x22aba1['error'][_0x9fb6('0xf')]);}logger[_0x9fb6('0xd')](_0x9fb6('0xa'),_0x1eace9,_0x22aba1['error']['message']);return _0x75f456(_0x22aba1['error'][_0x9fb6('0xf')]);}else{logger[_0x9fb6('0x10')](_0x9fb6('0xa'),_0x1eace9,_0x9fb6('0xb'));_0x75f456(_0x22aba1[_0x9fb6('0x11')][_0x9fb6('0xf')]);}})[_0x9fb6('0x12')](function(_0x4e0bdc){logger['error']('ZohoField,\x20%s,\x20%s',_0x1eace9,_0x4e0bdc);_0x3435c6(_0x4e0bdc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bf16318..d1a6336 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x12e5be,_0x42870f){var _0x25d1a7=function(_0x35fdd8){while(--_0x35fdd8){_0x12e5be['push'](_0x12e5be['shift']());}};_0x25d1a7(++_0x42870f);}(_0xe706,0xa3));var _0x6e70=function(_0x1401e1,_0xabb499){_0x1401e1=_0x1401e1-0x0;var _0x1aab56=_0xe706[_0x1401e1];return _0x1aab56;};'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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5a65c3,_0x513ff1){var _0x4920ad=function(_0x178b41){while(--_0x178b41){_0x5a65c3['push'](_0x5a65c3['shift']());}};_0x4920ad(++_0x513ff1);}(_0x70e0,0x17b));var _0x070e=function(_0x130176,_0xe63903){_0x130176=_0x130176-0x0;var _0x6866de=_0x70e0[_0x130176];return _0x6866de;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c60f160..16a14f6 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 _0x18a9=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','STRING'];(function(_0x2e5b96,_0x162882){var _0x19b3c0=function(_0x5ac711){while(--_0x5ac711){_0x2e5b96['push'](_0x2e5b96['shift']());}};_0x19b3c0(++_0x162882);}(_0x18a9,0x15b));var _0x918a=function(_0x714a8d,_0x32672a){_0x714a8d=_0x714a8d-0x0;var _0x3f07ac=_0x18a9[_0x714a8d];return _0x3f07ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x918a('0x0')],'allowNull':![],'unique':_0x918a('0x1')},'version':{'type':Sequelize[_0x918a('0x0')],'allowNull':![],'unique':_0x918a('0x1')},'main':{'type':Sequelize[_0x918a('0x0')],'defaultValue':_0x918a('0x2')},'filename':{'type':Sequelize[_0x918a('0x0')]},'path':{'type':Sequelize[_0x918a('0x0')]},'type':{'type':Sequelize[_0x918a('0x0')]},'size':{'type':Sequelize[_0x918a('0x3')]},'active':{'type':Sequelize[_0x918a('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x918a('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x918a('0x0')],'unique':_0x918a('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x918a('0x0')]},'remoteUri':{'type':Sequelize[_0x918a('0x0')]},'link':{'type':Sequelize[_0x918a('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4e8b=['STRING','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x4e8b,0xb8));var _0xb4e8=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x4e8b[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0xb4e8('0x0'));module[_0xb4e8('0x1')]={'name':{'type':Sequelize[_0xb4e8('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xb4e8('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb4e8('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xb4e8('0x2')]},'type':{'type':Sequelize[_0xb4e8('0x2')]},'size':{'type':Sequelize[_0xb4e8('0x3')]},'active':{'type':Sequelize[_0xb4e8('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb4e8('0x2')]},'logo':{'type':Sequelize[_0xb4e8('0x2')]},'state':{'type':Sequelize[_0xb4e8('0x2')],'unique':_0xb4e8('0x5')},'description':{'type':Sequelize[_0xb4e8('0x2')]},'title':{'type':Sequelize[_0xb4e8('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xb4e8('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 ad9f45d..072b861 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 _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x57aef3,_0x5d70b7){var _0x196933=function(_0x6bc411){while(--_0x6bc411){_0x57aef3['push'](_0x57aef3['shift']());}};_0x196933(++_0x5d70b7);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','Integration','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x5852a4,_0x281dd2){var _0x4f0ea6=function(_0x2424b7){while(--_0x2424b7){_0x5852a4['push'](_0x5852a4['shift']());}};_0x4f0ea6(++_0x281dd2);}(_0xdb28,0x106));var _0x8db2=function(_0x29a2b3,_0x599f64){_0x29a2b3=_0x29a2b3-0x0;var _0x486431=_0xdb28[_0x29a2b3];return _0x486431;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8cba4e9..8fb37a5 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 _0x43f8=['rimraf','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2e3ed4,_0x5ce3bb){var _0x2a204e=function(_0x290550){while(--_0x290550){_0x2e3ed4['push'](_0x2e3ed4['shift']());}};_0x2a204e(++_0x5ce3bb);}(_0x43f8,0x95));var _0x843f=function(_0x40c79c,_0x5f1dd8){_0x40c79c=_0x40c79c-0x0;var _0x9419bc=_0x43f8[_0x40c79c];return _0x9419bc;};'use strict';var _=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var logger=require(_0x843f('0x2'))(_0x843f('0x3'));var moment=require(_0x843f('0x4'));var BPromise=require('bluebird');var rp=require(_0x843f('0x5'));var fs=require('fs');var path=require(_0x843f('0x6'));var rimraf=require(_0x843f('0x7'));var config=require('../../config/environment');var attributes=require(_0x843f('0x8'));module[_0x843f('0x9')]=function(_0x406d9d,_0x252f82){return _0x406d9d['define'](_0x843f('0xa'),attributes,{'tableName':_0x843f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x612e=['rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','api'];(function(_0x292893,_0xda9f1a){var _0x434903=function(_0x205c50){while(--_0x205c50){_0x292893['push'](_0x292893['shift']());}};_0x434903(++_0xda9f1a);}(_0x612e,0x1ad));var _0xe612=function(_0x259f65,_0x17af35){_0x259f65=_0x259f65-0x0;var _0x347d79=_0x612e[_0x259f65];return _0x347d79;};'use strict';var _=require(_0xe612('0x0'));var util=require(_0xe612('0x1'));var logger=require('../../config/logger')(_0xe612('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe612('0x3'));var config=require('../../config/environment');var attributes=require(_0xe612('0x4'));module[_0xe612('0x5')]=function(_0x36d3c8,_0x1cd59a){return _0x36d3c8[_0xe612('0x6')](_0xe612('0x7'),attributes,{'tableName':_0xe612('0x8'),'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 50fcca3..a64fef6 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 _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(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x0b0e[_0x4b12ae];return _0x16957b;};'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 +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x1b768e,_0x8ee33c){var _0x31ea76=function(_0x4adf75){while(--_0x4adf75){_0x1b768e['push'](_0x1b768e['shift']());}};_0x31ea76(++_0x8ee33c);}(_0xda2d,0x102));var _0xdda2=function(_0x551fd6,_0x402cec){_0x551fd6=_0x551fd6-0x0;var _0x16c20c=_0xda2d[_0x551fd6];return _0x16c20c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bd0a75c..bbe2a01 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1107ac,_0x45de13){var _0xe10cd=function(_0x5844a8){while(--_0x5844a8){_0x1107ac['push'](_0x1107ac['shift']());}};_0xe10cd(++_0x45de13);}(_0x187d,0x93));var _0xd187=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x187d[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x920bbd,_0x444bfd){var _0x1fda02=function(_0x4f97e0){while(--_0x4f97e0){_0x920bbd['push'](_0x920bbd['shift']());}};_0x1fda02(++_0x444bfd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x81ac77,_0x3c787e){_0x81ac77=_0x81ac77-0x0;var _0x16ecc7=_0xc6ac[_0x81ac77];return _0x16ecc7;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a76592c..aa3d04a 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 _0x5cbc=['STRING','DATE','BOOLEAN','INTEGER','TEXT','SENDING','RECEIVED','sequelize','exports'];(function(_0xd8bae7,_0x589fc4){var _0x23a527=function(_0x491e09){while(--_0x491e09){_0xd8bae7['push'](_0xd8bae7['shift']());}};_0x23a527(++_0x589fc4);}(_0x5cbc,0xbb));var _0xc5cb=function(_0x7fa8a1,_0x52c9be){_0x7fa8a1=_0x7fa8a1-0x0;var _0x41fa61=_0x5cbc[_0x7fa8a1];return _0x41fa61;};'use strict';var Sequelize=require(_0xc5cb('0x0'));module[_0xc5cb('0x1')]={'integration':{'type':Sequelize[_0xc5cb('0x2')]},'eventChannel':{'type':Sequelize[_0xc5cb('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xc5cb('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc5cb('0x2')]},'calleridnum':{'type':Sequelize[_0xc5cb('0x2')]},'calleridname':{'type':Sequelize[_0xc5cb('0x2')]},'queue':{'type':Sequelize[_0xc5cb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc5cb('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc5cb('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc5cb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc5cb('0x3')]},'talktime':{'type':Sequelize[_0xc5cb('0x5')]},'agentacw':{'type':Sequelize[_0xc5cb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc5cb('0x5')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xc5cb('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc5cb('0x3')]},'agentdump':{'type':Sequelize[_0xc5cb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc5cb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc5cb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc5cb('0x2')]},'accountcode':{'type':Sequelize[_0xc5cb('0x2')]},'context':{'type':Sequelize[_0xc5cb('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc5cb('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc5cb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xc5cb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc5cb('0x2')]},'destcalleridname':{'type':Sequelize[_0xc5cb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc5cb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc5cb('0x2')]},'destlanguage':{'type':Sequelize[_0xc5cb('0x2')]},'destaccountcode':{'type':Sequelize[_0xc5cb('0x2')]},'destcontext':{'type':Sequelize[_0xc5cb('0x2')]},'destexten':{'type':Sequelize[_0xc5cb('0x2')]},'destpriority':{'type':Sequelize[_0xc5cb('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xc5cb('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xc5cb('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xc5cb('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0xc5cb('0x7'),_0xc5cb('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc5cb('0x2')]},'appdata':{'type':Sequelize[_0xc5cb('0x2')]},'projectId':{'type':Sequelize[_0xc5cb('0x5')]}}; \ No newline at end of file +var _0xe9a5=['BOOLEAN','INTEGER','TEXT','SENDING','FAILED','sequelize','exports','STRING','DATE'];(function(_0x48edff,_0x5f336c){var _0x584be6=function(_0x532097){while(--_0x532097){_0x48edff['push'](_0x48edff['shift']());}};_0x584be6(++_0x5f336c);}(_0xe9a5,0x1eb));var _0x5e9a=function(_0x3a55bd,_0x309ae1){_0x3a55bd=_0x3a55bd-0x0;var _0x2d2472=_0xe9a5[_0x3a55bd];return _0x2d2472;};'use strict';var Sequelize=require(_0x5e9a('0x0'));module[_0x5e9a('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5e9a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5e9a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5e9a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5e9a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5e9a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5e9a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5e9a('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x5e9a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5e9a('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5e9a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5e9a('0x2')]},'connectedlinename':{'type':Sequelize[_0x5e9a('0x2')]},'language':{'type':Sequelize[_0x5e9a('0x2')]},'accountcode':{'type':Sequelize[_0x5e9a('0x2')]},'context':{'type':Sequelize[_0x5e9a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5e9a('0x2')]},'destchannel':{'type':Sequelize[_0x5e9a('0x2')]},'destchannelstate':{'type':Sequelize[_0x5e9a('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x5e9a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x5e9a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5e9a('0x2')]},'destlanguage':{'type':Sequelize[_0x5e9a('0x2')]},'destaccountcode':{'type':Sequelize[_0x5e9a('0x2')]},'destcontext':{'type':Sequelize[_0x5e9a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5e9a('0x2')]},'destuniqueid':{'type':Sequelize[_0x5e9a('0x2')]},'messageId':{'type':Sequelize[_0x5e9a('0x2')]},'inReplyTo':{'type':Sequelize[_0x5e9a('0x2')]},'subject':{'type':Sequelize[_0x5e9a('0x2')]},'from':{'type':Sequelize[_0x5e9a('0x2')]},'to':{'type':Sequelize[_0x5e9a('0x2')]},'cc':{'type':Sequelize[_0x5e9a('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x5e9a('0x6')]},'text':{'type':Sequelize[_0x5e9a('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x5e9a('0x7'),'RECEIVED',_0x5e9a('0x8'))},'url':{'type':Sequelize[_0x5e9a('0x2')]},'app':{'type':Sequelize[_0x5e9a('0x2')]},'appdata':{'type':Sequelize[_0x5e9a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4f0495c..b41b533 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 _0x29dc=['rows','catch','show','params','length','find','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x5126aa,_0x5dd4b8){var _0x35329b=function(_0x1a6cc7){while(--_0x1a6cc7){_0x5126aa['push'](_0x5126aa['shift']());}};_0x35329b(++_0x5dd4b8);}(_0x29dc,0xe0));var _0xc29d=function(_0x4fd009,_0x259424){_0x4fd009=_0x4fd009-0x0;var _0x54933b=_0x29dc[_0x4fd009];return _0x54933b;};'use strict';var emlformat=require(_0xc29d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc29d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc29d('0x2'));var moment=require('moment');var BPromise=require(_0xc29d('0x3'));var Mustache=require(_0xc29d('0x4'));var util=require(_0xc29d('0x5'));var path=require(_0xc29d('0x6'));var sox=require(_0xc29d('0x7'));var csv=require('to-csv');var ejs=require(_0xc29d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc29d('0x9'));var squel=require(_0xc29d('0xa'));var crypto=require(_0xc29d('0xb'));var jsforce=require(_0xc29d('0xc'));var deskjs=require(_0xc29d('0xd'));var toCsv=require(_0xc29d('0xe'));var querystring=require(_0xc29d('0xf'));var Papa=require(_0xc29d('0x10'));var Redis=require(_0xc29d('0x11'));var authService=require(_0xc29d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc29d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc29d('0x14'))(_0xc29d('0x15'));var utils=require('../../config/utils');var config=require(_0xc29d('0x16'));var licenseUtil=require(_0xc29d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8c4828,_0xf16ebe){_0xf16ebe=_0xf16ebe||0xcc;return function(_0xf8ba32){if(_0xf8ba32){return _0x8c4828[_0xc29d('0x18')](_0xf16ebe);}return _0x8c4828[_0xc29d('0x19')](_0xf16ebe)['end']();};}function respondWithResult(_0x4627ee,_0x2c6ddd){_0x2c6ddd=_0x2c6ddd||0xc8;return function(_0x310255){if(_0x310255){return _0x4627ee[_0xc29d('0x19')](_0x2c6ddd)[_0xc29d('0x1a')](_0x310255);}};}function respondWithFilteredResult(_0x4341fe,_0x118532){return function(_0x134072){if(_0x134072){var _0x3ead48=typeof _0x118532['offset']==='undefined'&&typeof _0x118532['limit']==='undefined';var _0x13d2e4=_0x134072[_0xc29d('0x1b')];var _0x40e8a0=_0x3ead48?0x0:_0x118532['offset'];var _0x3bff7=_0x3ead48?_0x134072['count']:_0x118532[_0xc29d('0x1c')]+_0x118532[_0xc29d('0x1d')];var _0x3354ea;if(_0x3bff7>=_0x13d2e4){_0x3bff7=_0x13d2e4;_0x3354ea=0xc8;}else{_0x3354ea=0xce;}_0x4341fe[_0xc29d('0x19')](_0x3354ea);return _0x4341fe[_0xc29d('0x1e')](_0xc29d('0x1f'),_0x40e8a0+'-'+_0x3bff7+'/'+_0x13d2e4)['json'](_0x134072);}return null;};}function patchUpdates(_0x18b3b4){return function(_0x763059){try{jsonpatch[_0xc29d('0x20')](_0x763059,_0x18b3b4,!![]);}catch(_0x5a775e){return BPromise[_0xc29d('0x21')](_0x5a775e);}return _0x763059['save']();};}function saveUpdates(_0x23416f,_0x265b04){return function(_0x52720d){if(_0x52720d){return _0x52720d[_0xc29d('0x22')](_0x23416f)[_0xc29d('0x23')](function(_0x49c256){return _0x49c256;});}return null;};}function removeEntity(_0xa79297,_0x2950e0){return function(_0x56df8e){if(_0x56df8e){return _0x56df8e[_0xc29d('0x24')]()[_0xc29d('0x23')](function(){_0xa79297[_0xc29d('0x19')](0xcc)[_0xc29d('0x25')]();});}};}function handleEntityNotFound(_0x3a29bb,_0x49af56){return function(_0x1f7200){if(!_0x1f7200){_0x3a29bb['sendStatus'](0x194);}return _0x1f7200;};}function handleError(_0x21a514,_0x475167){_0x475167=_0x475167||0x1f4;return function(_0x11bcb9){logger[_0xc29d('0x26')](_0x11bcb9['stack']);if(_0x11bcb9[_0xc29d('0x27')]){delete _0x11bcb9[_0xc29d('0x27')];}_0x21a514[_0xc29d('0x19')](_0x475167)['send'](_0x11bcb9);};}exports[_0xc29d('0x28')]=function(_0x2bb684,_0x248721){var _0xdae5ed={},_0xef2a41={},_0x2788f9={'count':0x0,'rows':[]};var _0x47b364=_[_0xc29d('0x29')](db[_0xc29d('0x2a')][_0xc29d('0x2b')],function(_0x407d04){return{'name':_0x407d04[_0xc29d('0x2c')],'type':_0x407d04['type'][_0xc29d('0x2d')]};});_0xef2a41[_0xc29d('0x2e')]=_['map'](_0x47b364,_0xc29d('0x27'));_0xef2a41['query']=_[_0xc29d('0x2f')](_0x2bb684[_0xc29d('0x30')]);_0xef2a41[_0xc29d('0x31')]=_[_0xc29d('0x32')](_0xef2a41[_0xc29d('0x2e')],_0xef2a41[_0xc29d('0x30')]);_0xdae5ed['attributes']=_[_0xc29d('0x32')](_0xef2a41[_0xc29d('0x2e')],qs[_0xc29d('0x33')](_0x2bb684['query'][_0xc29d('0x33')]));_0xdae5ed[_0xc29d('0x34')]=_0xdae5ed['attributes']['length']?_0xdae5ed['attributes']:_0xef2a41[_0xc29d('0x2e')];if(!_0x2bb684[_0xc29d('0x30')][_0xc29d('0x35')](_0xc29d('0x36'))){_0xdae5ed['limit']=qs[_0xc29d('0x1d')](_0x2bb684[_0xc29d('0x30')][_0xc29d('0x1d')]);_0xdae5ed[_0xc29d('0x1c')]=qs[_0xc29d('0x1c')](_0x2bb684[_0xc29d('0x30')]['offset']);}_0xdae5ed['order']=qs[_0xc29d('0x37')](_0x2bb684[_0xc29d('0x30')][_0xc29d('0x37')]);_0xdae5ed['where']=qs['filters'](_['pick'](_0x2bb684['query'],_0xef2a41[_0xc29d('0x31')]),_0x47b364);if(_0x2bb684[_0xc29d('0x30')][_0xc29d('0x38')]){_0xdae5ed[_0xc29d('0x39')]=_[_0xc29d('0x3a')](_0xdae5ed[_0xc29d('0x39')],{'$or':_['map'](_0x47b364,function(_0x4c4e94){if(_0x4c4e94[_0xc29d('0x3b')]!==_0xc29d('0x3c')){var _0x2f4611={};_0x2f4611[_0x4c4e94['name']]={'$like':'%'+_0x2bb684['query'][_0xc29d('0x38')]+'%'};return _0x2f4611;}})});}_0xdae5ed=_[_0xc29d('0x3a')]({},_0xdae5ed,_0x2bb684[_0xc29d('0x3d')]);var _0x243586={'where':_0xdae5ed[_0xc29d('0x39')]};return db[_0xc29d('0x2a')][_0xc29d('0x1b')](_0x243586)[_0xc29d('0x23')](function(_0xdbdd5b){_0x2788f9[_0xc29d('0x1b')]=_0xdbdd5b;if(_0x2bb684[_0xc29d('0x30')][_0xc29d('0x3e')]){_0xdae5ed[_0xc29d('0x3f')]=[{'all':!![]}];}return db[_0xc29d('0x2a')]['findAll'](_0xdae5ed);})[_0xc29d('0x23')](function(_0x5e0601){_0x2788f9[_0xc29d('0x40')]=_0x5e0601;return _0x2788f9;})['then'](respondWithFilteredResult(_0x248721,_0xdae5ed))[_0xc29d('0x41')](handleError(_0x248721,null));};exports[_0xc29d('0x42')]=function(_0x5810e8,_0x14c6cd){var _0x41a59c={'raw':![],'where':{'id':_0x5810e8[_0xc29d('0x43')]['id']}},_0x208c9b={};_0x208c9b[_0xc29d('0x2e')]=_[_0xc29d('0x2f')](db['IntegrationReport'][_0xc29d('0x2b')]);_0x208c9b[_0xc29d('0x30')]=_[_0xc29d('0x2f')](_0x5810e8['query']);_0x208c9b[_0xc29d('0x31')]=_[_0xc29d('0x32')](_0x208c9b[_0xc29d('0x2e')],_0x208c9b[_0xc29d('0x30')]);_0x41a59c[_0xc29d('0x34')]=_[_0xc29d('0x32')](_0x208c9b[_0xc29d('0x2e')],qs[_0xc29d('0x33')](_0x5810e8[_0xc29d('0x30')][_0xc29d('0x33')]));_0x41a59c[_0xc29d('0x34')]=_0x41a59c[_0xc29d('0x34')][_0xc29d('0x44')]?_0x41a59c[_0xc29d('0x34')]:_0x208c9b[_0xc29d('0x2e')];if(_0x5810e8[_0xc29d('0x30')][_0xc29d('0x3e')]){_0x41a59c[_0xc29d('0x3f')]=[{'all':!![]}];}_0x41a59c=_['merge']({},_0x41a59c,_0x5810e8[_0xc29d('0x3d')]);return db[_0xc29d('0x2a')][_0xc29d('0x45')](_0x41a59c)['then'](handleEntityNotFound(_0x14c6cd,null))['then'](respondWithResult(_0x14c6cd,null))[_0xc29d('0x41')](handleError(_0x14c6cd,null));};exports['create']=function(_0x5802ad,_0x117483){return db[_0xc29d('0x2a')]['create'](_0x5802ad[_0xc29d('0x46')],{})['then'](respondWithResult(_0x117483,0xc9))['catch'](handleError(_0x117483,null));};exports[_0xc29d('0x22')]=function(_0x1223af,_0x15af63){if(_0x1223af['body']['id']){delete _0x1223af[_0xc29d('0x46')]['id'];}return db[_0xc29d('0x2a')][_0xc29d('0x45')]({'where':{'id':_0x1223af[_0xc29d('0x43')]['id']}})[_0xc29d('0x23')](handleEntityNotFound(_0x15af63,null))[_0xc29d('0x23')](saveUpdates(_0x1223af['body'],null))[_0xc29d('0x23')](respondWithResult(_0x15af63,null))[_0xc29d('0x41')](handleError(_0x15af63,null));};exports[_0xc29d('0x24')]=function(_0x2282bd,_0x5e8c51){return db['IntegrationReport'][_0xc29d('0x45')]({'where':{'id':_0x2282bd[_0xc29d('0x43')]['id']}})[_0xc29d('0x23')](handleEntityNotFound(_0x5e8c51,null))['then'](removeEntity(_0x5e8c51,null))['catch'](handleError(_0x5e8c51,null));};exports[_0xc29d('0x47')]=function(_0x27ae14,_0x90867){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x90867,null))[_0xc29d('0x41')](handleError(_0x90867,null));}; \ No newline at end of file +var _0x98ec=['sort','where','pick','filter','options','include','findAll','rows','catch','params','includeAll','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x22ea59,_0x387ed1){var _0x444611=function(_0x5b2fea){while(--_0x5b2fea){_0x22ea59['push'](_0x22ea59['shift']());}};_0x444611(++_0x387ed1);}(_0x98ec,0x148));var _0xc98e=function(_0x10731e,_0x2d326d){_0x10731e=_0x10731e-0x0;var _0x4fcfe3=_0x98ec[_0x10731e];return _0x4fcfe3;};'use strict';var emlformat=require(_0xc98e('0x0'));var rimraf=require(_0xc98e('0x1'));var zipdir=require(_0xc98e('0x2'));var jsonpatch=require(_0xc98e('0x3'));var rp=require(_0xc98e('0x4'));var moment=require(_0xc98e('0x5'));var BPromise=require(_0xc98e('0x6'));var Mustache=require('mustache');var util=require(_0xc98e('0x7'));var path=require('path');var sox=require(_0xc98e('0x8'));var csv=require(_0xc98e('0x9'));var ejs=require(_0xc98e('0xa'));var fs=require('fs');var fs_extra=require(_0xc98e('0xb'));var _=require(_0xc98e('0xc'));var squel=require(_0xc98e('0xd'));var crypto=require(_0xc98e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc98e('0xf'));var toCsv=require(_0xc98e('0x9'));var querystring=require(_0xc98e('0x10'));var Papa=require(_0xc98e('0x11'));var Redis=require(_0xc98e('0x12'));var authService=require(_0xc98e('0x13'));var qs=require(_0xc98e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc98e('0x15'))(_0xc98e('0x16'));var utils=require(_0xc98e('0x17'));var config=require(_0xc98e('0x18'));var licenseUtil=require(_0xc98e('0x19'));var db=require(_0xc98e('0x1a'))['db'];function respondWithStatusCode(_0x2deed8,_0x1dcb2a){_0x1dcb2a=_0x1dcb2a||0xcc;return function(_0x4d01a7){if(_0x4d01a7){return _0x2deed8[_0xc98e('0x1b')](_0x1dcb2a);}return _0x2deed8[_0xc98e('0x1c')](_0x1dcb2a)[_0xc98e('0x1d')]();};}function respondWithResult(_0x26ffca,_0x336359){_0x336359=_0x336359||0xc8;return function(_0x2cdd9b){if(_0x2cdd9b){return _0x26ffca['status'](_0x336359)['json'](_0x2cdd9b);}};}function respondWithFilteredResult(_0x3371f1,_0x759ec){return function(_0x217c13){if(_0x217c13){var _0x36b490=typeof _0x759ec[_0xc98e('0x1e')]===_0xc98e('0x1f')&&typeof _0x759ec[_0xc98e('0x20')]==='undefined';var _0xb35fd6=_0x217c13[_0xc98e('0x21')];var _0x5a69b=_0x36b490?0x0:_0x759ec['offset'];var _0x50291f=_0x36b490?_0x217c13[_0xc98e('0x21')]:_0x759ec[_0xc98e('0x1e')]+_0x759ec[_0xc98e('0x20')];var _0x1f1952;if(_0x50291f>=_0xb35fd6){_0x50291f=_0xb35fd6;_0x1f1952=0xc8;}else{_0x1f1952=0xce;}_0x3371f1['status'](_0x1f1952);return _0x3371f1[_0xc98e('0x22')](_0xc98e('0x23'),_0x5a69b+'-'+_0x50291f+'/'+_0xb35fd6)[_0xc98e('0x24')](_0x217c13);}return null;};}function patchUpdates(_0x4d1f94){return function(_0x92b23){try{jsonpatch[_0xc98e('0x25')](_0x92b23,_0x4d1f94,!![]);}catch(_0x4e4138){return BPromise['reject'](_0x4e4138);}return _0x92b23[_0xc98e('0x26')]();};}function saveUpdates(_0x533173,_0x24067f){return function(_0x8e2f2){if(_0x8e2f2){return _0x8e2f2[_0xc98e('0x27')](_0x533173)[_0xc98e('0x28')](function(_0x504be4){return _0x504be4;});}return null;};}function removeEntity(_0x40c17b,_0x44f4ba){return function(_0x1e14dc){if(_0x1e14dc){return _0x1e14dc[_0xc98e('0x29')]()[_0xc98e('0x28')](function(){_0x40c17b['status'](0xcc)[_0xc98e('0x1d')]();});}};}function handleEntityNotFound(_0x4b8681,_0x14396d){return function(_0x112fcf){if(!_0x112fcf){_0x4b8681[_0xc98e('0x1b')](0x194);}return _0x112fcf;};}function handleError(_0x5adc34,_0x40c7bf){_0x40c7bf=_0x40c7bf||0x1f4;return function(_0x39ab3b){logger[_0xc98e('0x2a')](_0x39ab3b[_0xc98e('0x2b')]);if(_0x39ab3b[_0xc98e('0x2c')]){delete _0x39ab3b[_0xc98e('0x2c')];}_0x5adc34[_0xc98e('0x1c')](_0x40c7bf)['send'](_0x39ab3b);};}exports[_0xc98e('0x2d')]=function(_0x5b9d1c,_0x674229){var _0x12d938={},_0x3ecd52={},_0x41edde={'count':0x0,'rows':[]};var _0x3d143d=_[_0xc98e('0x2e')](db[_0xc98e('0x2f')][_0xc98e('0x30')],function(_0x54821a){return{'name':_0x54821a[_0xc98e('0x31')],'type':_0x54821a[_0xc98e('0x32')][_0xc98e('0x33')]};});_0x3ecd52[_0xc98e('0x34')]=_[_0xc98e('0x2e')](_0x3d143d,_0xc98e('0x2c'));_0x3ecd52[_0xc98e('0x35')]=_[_0xc98e('0x36')](_0x5b9d1c[_0xc98e('0x35')]);_0x3ecd52[_0xc98e('0x37')]=_[_0xc98e('0x38')](_0x3ecd52['model'],_0x3ecd52['query']);_0x12d938[_0xc98e('0x39')]=_['intersection'](_0x3ecd52[_0xc98e('0x34')],qs['fields'](_0x5b9d1c['query'][_0xc98e('0x3a')]));_0x12d938[_0xc98e('0x39')]=_0x12d938[_0xc98e('0x39')][_0xc98e('0x3b')]?_0x12d938[_0xc98e('0x39')]:_0x3ecd52[_0xc98e('0x34')];if(!_0x5b9d1c[_0xc98e('0x35')][_0xc98e('0x3c')](_0xc98e('0x3d'))){_0x12d938['limit']=qs[_0xc98e('0x20')](_0x5b9d1c[_0xc98e('0x35')][_0xc98e('0x20')]);_0x12d938[_0xc98e('0x1e')]=qs[_0xc98e('0x1e')](_0x5b9d1c[_0xc98e('0x35')][_0xc98e('0x1e')]);}_0x12d938['order']=qs[_0xc98e('0x3e')](_0x5b9d1c[_0xc98e('0x35')]['sort']);_0x12d938[_0xc98e('0x3f')]=qs['filters'](_[_0xc98e('0x40')](_0x5b9d1c['query'],_0x3ecd52[_0xc98e('0x37')]),_0x3d143d);if(_0x5b9d1c[_0xc98e('0x35')]['filter']){_0x12d938[_0xc98e('0x3f')]=_['merge'](_0x12d938[_0xc98e('0x3f')],{'$or':_['map'](_0x3d143d,function(_0x42d6b3){if(_0x42d6b3[_0xc98e('0x32')]!=='VIRTUAL'){var _0x1f7225={};_0x1f7225[_0x42d6b3[_0xc98e('0x2c')]]={'$like':'%'+_0x5b9d1c['query'][_0xc98e('0x41')]+'%'};return _0x1f7225;}})});}_0x12d938=_['merge']({},_0x12d938,_0x5b9d1c[_0xc98e('0x42')]);var _0x28651a={'where':_0x12d938['where']};return db[_0xc98e('0x2f')][_0xc98e('0x21')](_0x28651a)[_0xc98e('0x28')](function(_0x331520){_0x41edde[_0xc98e('0x21')]=_0x331520;if(_0x5b9d1c[_0xc98e('0x35')]['includeAll']){_0x12d938[_0xc98e('0x43')]=[{'all':!![]}];}return db[_0xc98e('0x2f')][_0xc98e('0x44')](_0x12d938);})[_0xc98e('0x28')](function(_0x283486){_0x41edde[_0xc98e('0x45')]=_0x283486;return _0x41edde;})[_0xc98e('0x28')](respondWithFilteredResult(_0x674229,_0x12d938))[_0xc98e('0x46')](handleError(_0x674229,null));};exports['show']=function(_0x11b552,_0x92bfb8){var _0x388b65={'raw':![],'where':{'id':_0x11b552[_0xc98e('0x47')]['id']}},_0x11cebe={};_0x11cebe[_0xc98e('0x34')]=_['keys'](db[_0xc98e('0x2f')][_0xc98e('0x30')]);_0x11cebe[_0xc98e('0x35')]=_[_0xc98e('0x36')](_0x11b552[_0xc98e('0x35')]);_0x11cebe[_0xc98e('0x37')]=_[_0xc98e('0x38')](_0x11cebe[_0xc98e('0x34')],_0x11cebe[_0xc98e('0x35')]);_0x388b65[_0xc98e('0x39')]=_['intersection'](_0x11cebe[_0xc98e('0x34')],qs[_0xc98e('0x3a')](_0x11b552[_0xc98e('0x35')][_0xc98e('0x3a')]));_0x388b65[_0xc98e('0x39')]=_0x388b65[_0xc98e('0x39')]['length']?_0x388b65[_0xc98e('0x39')]:_0x11cebe[_0xc98e('0x34')];if(_0x11b552[_0xc98e('0x35')][_0xc98e('0x48')]){_0x388b65[_0xc98e('0x43')]=[{'all':!![]}];}_0x388b65=_[_0xc98e('0x49')]({},_0x388b65,_0x11b552[_0xc98e('0x42')]);return db[_0xc98e('0x2f')][_0xc98e('0x4a')](_0x388b65)[_0xc98e('0x28')](handleEntityNotFound(_0x92bfb8,null))['then'](respondWithResult(_0x92bfb8,null))[_0xc98e('0x46')](handleError(_0x92bfb8,null));};exports[_0xc98e('0x4b')]=function(_0x21144c,_0x113f8e){return db[_0xc98e('0x2f')][_0xc98e('0x4b')](_0x21144c[_0xc98e('0x4c')],{})[_0xc98e('0x28')](respondWithResult(_0x113f8e,0xc9))[_0xc98e('0x46')](handleError(_0x113f8e,null));};exports[_0xc98e('0x27')]=function(_0x16a891,_0x2a04a5){if(_0x16a891['body']['id']){delete _0x16a891[_0xc98e('0x4c')]['id'];}return db[_0xc98e('0x2f')]['find']({'where':{'id':_0x16a891[_0xc98e('0x47')]['id']}})[_0xc98e('0x28')](handleEntityNotFound(_0x2a04a5,null))[_0xc98e('0x28')](saveUpdates(_0x16a891[_0xc98e('0x4c')],null))['then'](respondWithResult(_0x2a04a5,null))['catch'](handleError(_0x2a04a5,null));};exports[_0xc98e('0x29')]=function(_0x3b5f6a,_0x52cba6){return db[_0xc98e('0x2f')][_0xc98e('0x4a')]({'where':{'id':_0x3b5f6a[_0xc98e('0x47')]['id']}})['then'](handleEntityNotFound(_0x52cba6,null))[_0xc98e('0x28')](removeEntity(_0x52cba6,null))[_0xc98e('0x46')](handleError(_0x52cba6,null));};exports[_0xc98e('0x4d')]=function(_0x480fe5,_0x5dd279){return db[_0xc98e('0x2f')][_0xc98e('0x4d')]()[_0xc98e('0x28')](respondWithResult(_0x5dd279,null))['catch'](handleError(_0x5dd279,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b2601f4..9050a73 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 _0xfda5=['request-promise','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x524621,_0x6595c){var _0x228276=function(_0x3514e6){while(--_0x3514e6){_0x524621['push'](_0x524621['shift']());}};_0x228276(++_0x6595c);}(_0xfda5,0x159));var _0x5fda=function(_0x5260cd,_0x128b56){_0x5260cd=_0x5260cd-0x0;var _0x342305=_0xfda5[_0x5260cd];return _0x342305;};'use strict';var _=require(_0x5fda('0x0'));var util=require(_0x5fda('0x1'));var logger=require(_0x5fda('0x2'))(_0x5fda('0x3'));var moment=require(_0x5fda('0x4'));var BPromise=require(_0x5fda('0x5'));var rp=require(_0x5fda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fda('0x7'));var config=require(_0x5fda('0x8'));var attributes=require(_0x5fda('0x9'));module['exports']=function(_0x2f3a7b,_0x500d33){return _0x2f3a7b[_0x5fda('0xa')](_0x5fda('0xb'),attributes,{'tableName':_0x5fda('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb7=['moment','bluebird','request-promise','path','../../config/environment','define','report_integration','lodash','util','../../config/logger','api'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x7bb7,0x15c));var _0x77bb=function(_0x581bfe,_0x12ddf6){_0x581bfe=_0x581bfe-0x0;var _0x3d3aa6=_0x7bb7[_0x581bfe];return _0x3d3aa6;};'use strict';var _=require(_0x77bb('0x0'));var util=require(_0x77bb('0x1'));var logger=require(_0x77bb('0x2'))(_0x77bb('0x3'));var moment=require(_0x77bb('0x4'));var BPromise=require(_0x77bb('0x5'));var rp=require(_0x77bb('0x6'));var fs=require('fs');var path=require(_0x77bb('0x7'));var rimraf=require('rimraf');var config=require(_0x77bb('0x8'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x11c0ab,_0x1a45cb){return _0x11c0ab[_0x77bb('0x9')]('IntegrationReport',attributes,{'tableName':_0x77bb('0xa'),'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 52ffd28..24e5f5d 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0x524e,0x15e));var _0xe524=function(_0x4842fb,_0x58a0e8){_0x4842fb=_0x4842fb-0x0;var _0x3418e5=_0x524e[_0x4842fb];return _0x3418e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ 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','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xadb5,0xad));var _0x5adb=function(_0x32c225,_0x2678df){_0x32c225=_0x32c225-0x0;var _0x512aa5=_0xadb5[_0x32c225];return _0x512aa5;};'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']('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 8274e04..20ac734 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 _0x6df0=['/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0x6df0,0x15d));var _0x06df=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x6df0[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require(_0x06df('0x0'));var util=require(_0x06df('0x1'));var path=require(_0x06df('0x2'));var timeout=require(_0x06df('0x3'));var express=require(_0x06df('0x4'));var router=express[_0x06df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x06df('0x6'));var interaction=require(_0x06df('0x7'));var config=require(_0x06df('0x8'));var controller=require(_0x06df('0x9'));router[_0x06df('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x06df('0xa')](_0x06df('0xb'),auth[_0x06df('0xc')](),controller[_0x06df('0xd')]);router[_0x06df('0xa')](_0x06df('0xe'),auth[_0x06df('0xc')](),controller[_0x06df('0xf')]);router[_0x06df('0x10')]('/',auth['isAuthenticated'](),controller[_0x06df('0x11')]);router['post'](_0x06df('0xe'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x06df('0x12'),auth[_0x06df('0xc')](),controller['addIntervals']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x06df('0xb'),auth[_0x06df('0xc')](),controller[_0x06df('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2f38=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer'];(function(_0x21f6fe,_0x46fc2d){var _0x4d3240=function(_0x45a02e){while(--_0x45a02e){_0x21f6fe['push'](_0x21f6fe['shift']());}};_0x4d3240(++_0x46fc2d);}(_0x2f38,0x95));var _0x82f3=function(_0x11a788,_0x4890b8){_0x11a788=_0x11a788-0x0;var _0x163ea3=_0x2f38[_0x11a788];return _0x163ea3;};'use strict';var multer=require(_0x82f3('0x0'));var util=require('util');var path=require(_0x82f3('0x1'));var timeout=require(_0x82f3('0x2'));var express=require(_0x82f3('0x3'));var router=express[_0x82f3('0x4')]();var fs_extra=require(_0x82f3('0x5'));var auth=require(_0x82f3('0x6'));var interaction=require(_0x82f3('0x7'));var config=require(_0x82f3('0x8'));var controller=require(_0x82f3('0x9'));router['get']('/',auth[_0x82f3('0xa')](),controller[_0x82f3('0xb')]);router[_0x82f3('0xc')](_0x82f3('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x82f3('0xe'),auth[_0x82f3('0xa')](),controller[_0x82f3('0xf')]);router['post']('/',auth[_0x82f3('0xa')](),controller[_0x82f3('0x10')]);router[_0x82f3('0x11')](_0x82f3('0xe'),auth[_0x82f3('0xa')](),controller[_0x82f3('0x12')]);router[_0x82f3('0x11')](_0x82f3('0x13'),auth[_0x82f3('0xa')](),controller['addIntervals']);router[_0x82f3('0x14')]('/:id',auth[_0x82f3('0xa')](),controller[_0x82f3('0x15')]);router[_0x82f3('0x16')](_0x82f3('0xd'),auth['isAuthenticated'](),controller[_0x82f3('0x17')]);module[_0x82f3('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7c5605f..43bd237 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 _0x25d7=['exports','STRING'];(function(_0x4c0d7,_0x17bc54){var _0x4f6d0d=function(_0x1879ca){while(--_0x1879ca){_0x4c0d7['push'](_0x4c0d7['shift']());}};_0x4f6d0d(++_0x17bc54);}(_0x25d7,0x122));var _0x725d=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x25d7[_0xd7b0a4];return _0x184e9e;};'use strict';var Sequelize=require('sequelize');module[_0x725d('0x0')]={'name':{'type':Sequelize[_0x725d('0x1')]},'description':{'type':Sequelize[_0x725d('0x1')]},'interval':{'type':Sequelize[_0x725d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xcc47=['STRING','sequelize','exports'];(function(_0x13a7e2,_0x39e8c6){var _0x348148=function(_0x218130){while(--_0x218130){_0x13a7e2['push'](_0x13a7e2['shift']());}};_0x348148(++_0x39e8c6);}(_0xcc47,0x196));var _0x7cc4=function(_0x683307,_0x10b026){_0x683307=_0x683307-0x0;var _0x33ddfe=_0xcc47[_0x683307];return _0x33ddfe;};'use strict';var Sequelize=require(_0x7cc4('0x0'));module[_0x7cc4('0x1')]={'name':{'type':Sequelize[_0x7cc4('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7cc4('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 7b04cdb..964987c 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 _0x49a0=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Intervals','UserProfileResource','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','destroy','addInterval','IntervalId','getIntervals','findOne','order','nolimit','addIntervals','transaction','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49a0,0x9d));var _0x049a=function(_0x259cdb,_0x3696ff){_0x259cdb=_0x259cdb-0x0;var _0x102792=_0x49a0[_0x259cdb];return _0x102792;};'use strict';var emlformat=require(_0x049a('0x0'));var rimraf=require(_0x049a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x049a('0x2'));var rp=require(_0x049a('0x3'));var moment=require(_0x049a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x049a('0x5'));var util=require(_0x049a('0x6'));var path=require(_0x049a('0x7'));var sox=require(_0x049a('0x8'));var csv=require(_0x049a('0x9'));var ejs=require(_0x049a('0xa'));var fs=require('fs');var fs_extra=require(_0x049a('0xb'));var _=require(_0x049a('0xc'));var squel=require(_0x049a('0xd'));var crypto=require(_0x049a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x049a('0x9'));var querystring=require(_0x049a('0xf'));var Papa=require(_0x049a('0x10'));var Redis=require(_0x049a('0x11'));var authService=require(_0x049a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x049a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x049a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x049a('0x15'));var db=require(_0x049a('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x14cdbb,_0x47a19c){_0x47a19c=_0x47a19c||0xcc;return function(_0x5e247f){if(_0x5e247f){return _0x14cdbb[_0x049a('0x17')](_0x47a19c);}return _0x14cdbb[_0x049a('0x18')](_0x47a19c)[_0x049a('0x19')]();};}function respondWithResult(_0x5400fa,_0x88342e){_0x88342e=_0x88342e||0xc8;return function(_0x2de458){if(_0x2de458){return _0x5400fa[_0x049a('0x18')](_0x88342e)[_0x049a('0x1a')](_0x2de458);}};}function respondWithFilteredResult(_0x3067cd,_0x3fe7e2){return function(_0x52bced){if(_0x52bced){var _0x5427a8=typeof _0x3fe7e2[_0x049a('0x1b')]===_0x049a('0x1c')&&typeof _0x3fe7e2[_0x049a('0x1d')]===_0x049a('0x1c');var _0x14ecfe=_0x52bced[_0x049a('0x1e')];var _0x49ec5f=_0x5427a8?0x0:_0x3fe7e2[_0x049a('0x1b')];var _0x503317=_0x5427a8?_0x52bced['count']:_0x3fe7e2['offset']+_0x3fe7e2[_0x049a('0x1d')];var _0x28bbcf;if(_0x503317>=_0x14ecfe){_0x503317=_0x14ecfe;_0x28bbcf=0xc8;}else{_0x28bbcf=0xce;}_0x3067cd[_0x049a('0x18')](_0x28bbcf);return _0x3067cd['set'](_0x049a('0x1f'),_0x49ec5f+'-'+_0x503317+'/'+_0x14ecfe)[_0x049a('0x1a')](_0x52bced);}return null;};}function patchUpdates(_0x31ca5a){return function(_0xd383cd){try{jsonpatch[_0x049a('0x20')](_0xd383cd,_0x31ca5a,!![]);}catch(_0x240164){return BPromise[_0x049a('0x21')](_0x240164);}return _0xd383cd['save']();};}function saveUpdates(_0x5538a0,_0xf7def9){return function(_0x3a4d15){if(_0x3a4d15){return _0x3a4d15[_0x049a('0x22')](_0x5538a0)[_0x049a('0x23')](function(_0x5466f5){return _0x5466f5;});}return null;};}function removeEntity(_0x1a41fa,_0x25823a){return function(_0x6efa4b){if(_0x6efa4b){return _0x6efa4b['destroy']()[_0x049a('0x23')](function(){var _0x1ec0a4=_0x6efa4b[_0x049a('0x24')]({'plain':!![]});var _0x1990fe=_0x049a('0x25');return db[_0x049a('0x26')]['destroy']({'where':{'type':_0x1990fe,'resourceId':_0x1ec0a4['id']}})[_0x049a('0x23')](function(){return _0x6efa4b;});})[_0x049a('0x23')](function(){_0x1a41fa[_0x049a('0x18')](0xcc)[_0x049a('0x19')]();});}};}function handleEntityNotFound(_0x54d014,_0x49c478){return function(_0x5ae10f){if(!_0x5ae10f){_0x54d014[_0x049a('0x17')](0x194);}return _0x5ae10f;};}function handleError(_0xe6a374,_0x20b678){_0x20b678=_0x20b678||0x1f4;return function(_0x5d0434){logger['error'](_0x5d0434['stack']);if(_0x5d0434[_0x049a('0x27')]){delete _0x5d0434['name'];}_0xe6a374['status'](_0x20b678)[_0x049a('0x28')](_0x5d0434);};}exports[_0x049a('0x29')]=function(_0x3b6301,_0xa213f1){var _0x21d04b={},_0x5ec10c={},_0x5b3dcd={'count':0x0,'rows':[]};var _0x462a9b=_[_0x049a('0x2a')](db[_0x049a('0x2b')][_0x049a('0x2c')],function(_0x8ec6fb){return{'name':_0x8ec6fb[_0x049a('0x2d')],'type':_0x8ec6fb[_0x049a('0x2e')][_0x049a('0x2f')]};});_0x5ec10c[_0x049a('0x30')]=_['map'](_0x462a9b,_0x049a('0x27'));_0x5ec10c[_0x049a('0x31')]=_[_0x049a('0x32')](_0x3b6301[_0x049a('0x31')]);_0x5ec10c[_0x049a('0x33')]=_[_0x049a('0x34')](_0x5ec10c[_0x049a('0x30')],_0x5ec10c['query']);_0x21d04b[_0x049a('0x35')]=_['intersection'](_0x5ec10c['model'],qs[_0x049a('0x36')](_0x3b6301[_0x049a('0x31')][_0x049a('0x36')]));_0x21d04b[_0x049a('0x35')]=_0x21d04b[_0x049a('0x35')][_0x049a('0x37')]?_0x21d04b['attributes']:_0x5ec10c['model'];if(!_0x3b6301[_0x049a('0x31')][_0x049a('0x38')]('nolimit')){_0x21d04b['limit']=qs[_0x049a('0x1d')](_0x3b6301[_0x049a('0x31')][_0x049a('0x1d')]);_0x21d04b[_0x049a('0x1b')]=qs[_0x049a('0x1b')](_0x3b6301[_0x049a('0x31')][_0x049a('0x1b')]);}_0x21d04b['order']=qs[_0x049a('0x39')](_0x3b6301[_0x049a('0x31')][_0x049a('0x39')]);_0x21d04b['where']=qs[_0x049a('0x33')](_[_0x049a('0x3a')](_0x3b6301['query'],_0x5ec10c[_0x049a('0x33')]),_0x462a9b);if(_0x3b6301['query'][_0x049a('0x3b')]){_0x21d04b['where']=_[_0x049a('0x3c')](_0x21d04b[_0x049a('0x3d')],{'$or':_[_0x049a('0x2a')](_0x462a9b,function(_0x2e2c20){if(_0x2e2c20[_0x049a('0x2e')]!==_0x049a('0x3e')){var _0x169d82={};_0x169d82[_0x2e2c20[_0x049a('0x27')]]={'$like':'%'+_0x3b6301[_0x049a('0x31')]['filter']+'%'};return _0x169d82;}})});}_0x21d04b=_['merge']({},_0x21d04b,_0x3b6301['options']);var _0x49c8ce={'where':_0x21d04b['where']};return db[_0x049a('0x2b')]['count'](_0x49c8ce)[_0x049a('0x23')](function(_0x3082e7){_0x5b3dcd[_0x049a('0x1e')]=_0x3082e7;if(_0x3b6301[_0x049a('0x31')][_0x049a('0x3f')]){_0x21d04b[_0x049a('0x40')]=[{'all':!![]}];}return db[_0x049a('0x2b')]['findAll'](_0x21d04b);})[_0x049a('0x23')](function(_0xdc14a8){_0x5b3dcd[_0x049a('0x41')]=_0xdc14a8;return _0x5b3dcd;})[_0x049a('0x23')](respondWithFilteredResult(_0xa213f1,_0x21d04b))[_0x049a('0x42')](handleError(_0xa213f1,null));};exports[_0x049a('0x43')]=function(_0xe8eba5,_0x4447a4){var _0x32067e={'raw':!![],'where':{'id':_0xe8eba5['params']['id']}},_0x4366f3={};_0x4366f3[_0x049a('0x30')]=_[_0x049a('0x32')](db[_0x049a('0x2b')][_0x049a('0x2c')]);_0x4366f3[_0x049a('0x31')]=_[_0x049a('0x32')](_0xe8eba5['query']);_0x4366f3['filters']=_[_0x049a('0x34')](_0x4366f3[_0x049a('0x30')],_0x4366f3[_0x049a('0x31')]);_0x32067e['attributes']=_['intersection'](_0x4366f3[_0x049a('0x30')],qs['fields'](_0xe8eba5[_0x049a('0x31')][_0x049a('0x36')]));_0x32067e[_0x049a('0x35')]=_0x32067e[_0x049a('0x35')][_0x049a('0x37')]?_0x32067e[_0x049a('0x35')]:_0x4366f3[_0x049a('0x30')];if(_0xe8eba5[_0x049a('0x31')][_0x049a('0x3f')]){_0x32067e[_0x049a('0x40')]=[{'all':!![]}];}_0x32067e=_['merge']({},_0x32067e,_0xe8eba5[_0x049a('0x44')]);return db[_0x049a('0x2b')]['find'](_0x32067e)[_0x049a('0x23')](handleEntityNotFound(_0x4447a4,null))[_0x049a('0x23')](respondWithResult(_0x4447a4,null))[_0x049a('0x42')](handleError(_0x4447a4,null));};exports[_0x049a('0x45')]=function(_0x41d64c,_0x29dcac){return db[_0x049a('0x2b')][_0x049a('0x45')](_0x41d64c['body'],{})[_0x049a('0x23')](function(_0x9b6d2a){var _0x3fc849=_0x41d64c[_0x049a('0x46')]['get']({'plain':!![]});if(!_0x3fc849)throw new Error(_0x049a('0x47'));if(_0x3fc849[_0x049a('0x48')]==='user'){var _0x4a23fe=_0x9b6d2a['get']({'plain':!![]});var _0x20c937=_0x049a('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x20c937,'userProfileId':_0x3fc849[_0x049a('0x49')]},'raw':!![]})[_0x049a('0x23')](function(_0x37555a){if(_0x37555a&&_0x37555a[_0x049a('0x4a')]===0x0){return db['UserProfileResource'][_0x049a('0x45')]({'name':_0x4a23fe['name'],'resourceId':_0x4a23fe['id'],'type':_0x37555a[_0x049a('0x27')],'sectionId':_0x37555a['id']},{})[_0x049a('0x23')](function(){return _0x9b6d2a;});}else{return _0x9b6d2a;}})['catch'](function(_0x168c71){logger[_0x049a('0x4b')](_0x049a('0x4c'),_0x168c71);throw _0x168c71;});}return _0x9b6d2a;})['then'](respondWithResult(_0x29dcac,0xc9))[_0x049a('0x42')](handleError(_0x29dcac,null));};exports[_0x049a('0x22')]=function(_0x4bc6e4,_0x64c4c3){if(_0x4bc6e4[_0x049a('0x4d')]['id']){delete _0x4bc6e4[_0x049a('0x4d')]['id'];}return db[_0x049a('0x2b')][_0x049a('0x4e')]({'where':{'id':_0x4bc6e4[_0x049a('0x4f')]['id']}})[_0x049a('0x23')](handleEntityNotFound(_0x64c4c3,null))[_0x049a('0x23')](saveUpdates(_0x4bc6e4[_0x049a('0x4d')],null))[_0x049a('0x23')](respondWithResult(_0x64c4c3,null))['catch'](handleError(_0x64c4c3,null));};exports[_0x049a('0x50')]=function(_0x5a6de2,_0x2085ff){return db['Interval'][_0x049a('0x4e')]({'where':{'id':_0x5a6de2['params']['id']}})[_0x049a('0x23')](handleEntityNotFound(_0x2085ff,null))[_0x049a('0x23')](removeEntity(_0x2085ff,null))['catch'](handleError(_0x2085ff,null));};exports[_0x049a('0x51')]=function(_0x7e003e,_0x4a5954,_0xd5b6f3){if(_0x7e003e[_0x049a('0x4d')]['id']){delete _0x7e003e[_0x049a('0x4d')]['id'];}return db['Interval'][_0x049a('0x4e')]({'where':{'id':_0x7e003e[_0x049a('0x4f')]['id']}})[_0x049a('0x23')](handleEntityNotFound(_0x4a5954,null))[_0x049a('0x23')](function(_0x10d1c5){if(_0x10d1c5){_0x7e003e[_0x049a('0x4d')][_0x049a('0x52')]=_0x10d1c5['id'];return db[_0x049a('0x2b')][_0x049a('0x45')](_0x7e003e['body']);}})['then'](respondWithResult(_0x4a5954,null))[_0x049a('0x42')](handleError(_0x4a5954,null));};exports[_0x049a('0x53')]=function(_0x5153cd,_0x3a0aab,_0x1106cc){var _0x3fd75c={};var _0x356957={};var _0x29ad16;var _0xee2f9e;return db[_0x049a('0x2b')][_0x049a('0x54')]({'where':{'id':_0x5153cd[_0x049a('0x4f')]['id']}})[_0x049a('0x23')](handleEntityNotFound(_0x3a0aab,null))[_0x049a('0x23')](function(_0x2ecdcf){if(_0x2ecdcf){_0x29ad16=_0x2ecdcf;_0x356957[_0x049a('0x30')]=_[_0x049a('0x32')](db[_0x049a('0x2b')]['rawAttributes']);_0x356957[_0x049a('0x31')]=_[_0x049a('0x32')](_0x5153cd['query']);_0x356957['filters']=_[_0x049a('0x34')](_0x356957[_0x049a('0x30')],_0x356957[_0x049a('0x31')]);_0x3fd75c[_0x049a('0x35')]=_[_0x049a('0x34')](_0x356957[_0x049a('0x30')],qs[_0x049a('0x36')](_0x5153cd[_0x049a('0x31')][_0x049a('0x36')]));_0x3fd75c[_0x049a('0x35')]=_0x3fd75c['attributes']['length']?_0x3fd75c[_0x049a('0x35')]:_0x356957['model'];_0x3fd75c[_0x049a('0x55')]=qs[_0x049a('0x39')](_0x5153cd['query']['sort']);_0x3fd75c[_0x049a('0x3d')]=qs['filters'](_[_0x049a('0x3a')](_0x5153cd[_0x049a('0x31')],_0x356957[_0x049a('0x33')]));if(_0x5153cd[_0x049a('0x31')][_0x049a('0x3b')]){_0x3fd75c[_0x049a('0x3d')]=_[_0x049a('0x3c')](_0x3fd75c[_0x049a('0x3d')],{'$or':_['map'](_0x3fd75c[_0x049a('0x35')],function(_0x2134bb){var _0xf7fcf1={};_0xf7fcf1[_0x2134bb]={'$like':'%'+_0x5153cd[_0x049a('0x31')][_0x049a('0x3b')]+'%'};return _0xf7fcf1;})});}_0x3fd75c=_[_0x049a('0x3c')]({},_0x3fd75c,_0x5153cd[_0x049a('0x44')]);return _0x29ad16['getIntervals'](_0x3fd75c);}})[_0x049a('0x23')](function(_0x53e43a){if(_0x53e43a){_0xee2f9e=_0x53e43a[_0x049a('0x37')];if(!_0x5153cd[_0x049a('0x31')][_0x049a('0x38')](_0x049a('0x56'))){_0x3fd75c[_0x049a('0x1d')]=qs[_0x049a('0x1d')](_0x5153cd[_0x049a('0x31')][_0x049a('0x1d')]);_0x3fd75c[_0x049a('0x1b')]=qs[_0x049a('0x1b')](_0x5153cd['query'][_0x049a('0x1b')]);}return _0x29ad16[_0x049a('0x53')](_0x3fd75c);}})[_0x049a('0x23')](function(_0x469b5e){if(_0x469b5e){return _0x469b5e?{'count':_0xee2f9e,'rows':_0x469b5e}:null;}})[_0x049a('0x23')](respondWithResult(_0x3a0aab,null))[_0x049a('0x42')](handleError(_0x3a0aab,null));};exports[_0x049a('0x57')]=function(_0x4b2b19,_0x5b0dbc,_0x529460){return db[_0x049a('0x2b')][_0x049a('0x54')]({'where':{'id':_0x4b2b19[_0x049a('0x4f')]['id']}})[_0x049a('0x23')](handleEntityNotFound(_0x5b0dbc,null))[_0x049a('0x23')](function(_0x14156c){if(_0x14156c){return db['sequelize'][_0x049a('0x58')](function(_0x512bfe){return db[_0x049a('0x2b')][_0x049a('0x50')]({'where':{'IntervalId':_0x4b2b19[_0x049a('0x4f')]['id']},'transaction':_0x512bfe})[_0x049a('0x23')](function(_0x4c282c){var _0x4afe80=_[_0x049a('0x2a')](_0x4b2b19[_0x049a('0x4d')],function(_0x11a68a){delete _0x11a68a['id'];_0x11a68a[_0x049a('0x52')]=_0x4b2b19[_0x049a('0x4f')]['id'];return _0x11a68a;});return db[_0x049a('0x2b')]['bulkCreate'](_0x4afe80,{'transaction':_0x512bfe});});})[_0x049a('0x23')](function(){return db[_0x049a('0x2b')][_0x049a('0x59')]({'where':{'IntervalId':_0x4b2b19[_0x049a('0x4f')]['id']}});});}})[_0x049a('0x23')](respondWithResult(_0x5b0dbc,null))[_0x049a('0x42')](handleError(_0x5b0dbc,null));}; \ No newline at end of file +var _0x5748=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','error','stack','send','Interval','rawAttributes','type','key','model','map','name','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','includeAll','findAll','rows','catch','show','intersection','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','order','addIntervals','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4b8ecc,_0x4cd01c){var _0x48c1b9=function(_0x308aa3){while(--_0x308aa3){_0x4b8ecc['push'](_0x4b8ecc['shift']());}};_0x48c1b9(++_0x4cd01c);}(_0x5748,0x15c));var _0x8574=function(_0x552079,_0x524aa9){_0x552079=_0x552079-0x0;var _0xa147a7=_0x5748[_0x552079];return _0xa147a7;};'use strict';var emlformat=require(_0x8574('0x0'));var rimraf=require(_0x8574('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8574('0x2'));var rp=require(_0x8574('0x3'));var moment=require('moment');var BPromise=require(_0x8574('0x4'));var Mustache=require(_0x8574('0x5'));var util=require(_0x8574('0x6'));var path=require('path');var sox=require(_0x8574('0x7'));var csv=require(_0x8574('0x8'));var ejs=require(_0x8574('0x9'));var fs=require('fs');var fs_extra=require(_0x8574('0xa'));var _=require(_0x8574('0xb'));var squel=require(_0x8574('0xc'));var crypto=require(_0x8574('0xd'));var jsforce=require(_0x8574('0xe'));var deskjs=require(_0x8574('0xf'));var toCsv=require(_0x8574('0x8'));var querystring=require('querystring');var Papa=require(_0x8574('0x10'));var Redis=require(_0x8574('0x11'));var authService=require(_0x8574('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8574('0x13'));var hardwareService=require(_0x8574('0x14'));var logger=require(_0x8574('0x15'))(_0x8574('0x16'));var utils=require(_0x8574('0x17'));var config=require(_0x8574('0x18'));var licenseUtil=require(_0x8574('0x19'));var db=require(_0x8574('0x1a'))['db'];var extensions=require(_0x8574('0x1b'));function respondWithStatusCode(_0x47106e,_0x2613d1){_0x2613d1=_0x2613d1||0xcc;return function(_0x4a52e1){if(_0x4a52e1){return _0x47106e[_0x8574('0x1c')](_0x2613d1);}return _0x47106e[_0x8574('0x1d')](_0x2613d1)[_0x8574('0x1e')]();};}function respondWithResult(_0x306a65,_0x2e6fe1){_0x2e6fe1=_0x2e6fe1||0xc8;return function(_0x367486){if(_0x367486){return _0x306a65[_0x8574('0x1d')](_0x2e6fe1)['json'](_0x367486);}};}function respondWithFilteredResult(_0x422829,_0x1531cb){return function(_0x4205f1){if(_0x4205f1){var _0x26c820=typeof _0x1531cb['offset']==='undefined'&&typeof _0x1531cb[_0x8574('0x1f')]===_0x8574('0x20');var _0x1971d0=_0x4205f1[_0x8574('0x21')];var _0x196316=_0x26c820?0x0:_0x1531cb[_0x8574('0x22')];var _0x3577e4=_0x26c820?_0x4205f1[_0x8574('0x21')]:_0x1531cb['offset']+_0x1531cb['limit'];var _0x3547e6;if(_0x3577e4>=_0x1971d0){_0x3577e4=_0x1971d0;_0x3547e6=0xc8;}else{_0x3547e6=0xce;}_0x422829[_0x8574('0x1d')](_0x3547e6);return _0x422829[_0x8574('0x23')](_0x8574('0x24'),_0x196316+'-'+_0x3577e4+'/'+_0x1971d0)[_0x8574('0x25')](_0x4205f1);}return null;};}function patchUpdates(_0x52123f){return function(_0x39c184){try{jsonpatch[_0x8574('0x26')](_0x39c184,_0x52123f,!![]);}catch(_0x4e0d55){return BPromise[_0x8574('0x27')](_0x4e0d55);}return _0x39c184[_0x8574('0x28')]();};}function saveUpdates(_0x329cb7,_0x259d7a){return function(_0x6f1ea7){if(_0x6f1ea7){return _0x6f1ea7[_0x8574('0x29')](_0x329cb7)[_0x8574('0x2a')](function(_0x197a17){return _0x197a17;});}return null;};}function removeEntity(_0x40fb52,_0x18b2c7){return function(_0xaf00c0){if(_0xaf00c0){return _0xaf00c0['destroy']()['then'](function(){var _0x2af2c0=_0xaf00c0[_0x8574('0x2b')]({'plain':!![]});var _0x36a21a='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x36a21a,'resourceId':_0x2af2c0['id']}})[_0x8574('0x2a')](function(){return _0xaf00c0;});})[_0x8574('0x2a')](function(){_0x40fb52[_0x8574('0x1d')](0xcc)[_0x8574('0x1e')]();});}};}function handleEntityNotFound(_0x5244e2,_0x252a8f){return function(_0x1ffbd6){if(!_0x1ffbd6){_0x5244e2['sendStatus'](0x194);}return _0x1ffbd6;};}function handleError(_0x17ee72,_0x218f5d){_0x218f5d=_0x218f5d||0x1f4;return function(_0x1e9dc9){logger[_0x8574('0x2c')](_0x1e9dc9[_0x8574('0x2d')]);if(_0x1e9dc9['name']){delete _0x1e9dc9['name'];}_0x17ee72[_0x8574('0x1d')](_0x218f5d)[_0x8574('0x2e')](_0x1e9dc9);};}exports['index']=function(_0xef3ae1,_0x4d533c){var _0x99a665={},_0x1750d9={},_0xef746e={'count':0x0,'rows':[]};var _0x2c9b6a=_['map'](db[_0x8574('0x2f')][_0x8574('0x30')],function(_0x1f10d6){return{'name':_0x1f10d6['fieldName'],'type':_0x1f10d6[_0x8574('0x31')][_0x8574('0x32')]};});_0x1750d9[_0x8574('0x33')]=_[_0x8574('0x34')](_0x2c9b6a,_0x8574('0x35'));_0x1750d9[_0x8574('0x36')]=_[_0x8574('0x37')](_0xef3ae1[_0x8574('0x36')]);_0x1750d9['filters']=_['intersection'](_0x1750d9[_0x8574('0x33')],_0x1750d9[_0x8574('0x36')]);_0x99a665[_0x8574('0x38')]=_['intersection'](_0x1750d9['model'],qs[_0x8574('0x39')](_0xef3ae1['query'][_0x8574('0x39')]));_0x99a665[_0x8574('0x38')]=_0x99a665[_0x8574('0x38')][_0x8574('0x3a')]?_0x99a665['attributes']:_0x1750d9[_0x8574('0x33')];if(!_0xef3ae1[_0x8574('0x36')][_0x8574('0x3b')](_0x8574('0x3c'))){_0x99a665[_0x8574('0x1f')]=qs['limit'](_0xef3ae1['query'][_0x8574('0x1f')]);_0x99a665[_0x8574('0x22')]=qs[_0x8574('0x22')](_0xef3ae1[_0x8574('0x36')]['offset']);}_0x99a665['order']=qs[_0x8574('0x3d')](_0xef3ae1[_0x8574('0x36')][_0x8574('0x3d')]);_0x99a665[_0x8574('0x3e')]=qs[_0x8574('0x3f')](_[_0x8574('0x40')](_0xef3ae1[_0x8574('0x36')],_0x1750d9[_0x8574('0x3f')]),_0x2c9b6a);if(_0xef3ae1['query'][_0x8574('0x41')]){_0x99a665[_0x8574('0x3e')]=_['merge'](_0x99a665[_0x8574('0x3e')],{'$or':_[_0x8574('0x34')](_0x2c9b6a,function(_0x45ee6f){if(_0x45ee6f['type']!=='VIRTUAL'){var _0x2352de={};_0x2352de[_0x45ee6f[_0x8574('0x35')]]={'$like':'%'+_0xef3ae1[_0x8574('0x36')][_0x8574('0x41')]+'%'};return _0x2352de;}})});}_0x99a665=_['merge']({},_0x99a665,_0xef3ae1['options']);var _0x3ecb26={'where':_0x99a665['where']};return db[_0x8574('0x2f')][_0x8574('0x21')](_0x3ecb26)[_0x8574('0x2a')](function(_0xe70f3){_0xef746e[_0x8574('0x21')]=_0xe70f3;if(_0xef3ae1[_0x8574('0x36')][_0x8574('0x42')]){_0x99a665['include']=[{'all':!![]}];}return db[_0x8574('0x2f')][_0x8574('0x43')](_0x99a665);})[_0x8574('0x2a')](function(_0x1822a8){_0xef746e[_0x8574('0x44')]=_0x1822a8;return _0xef746e;})[_0x8574('0x2a')](respondWithFilteredResult(_0x4d533c,_0x99a665))[_0x8574('0x45')](handleError(_0x4d533c,null));};exports[_0x8574('0x46')]=function(_0x521b27,_0x3ca6a4){var _0x2f6fe1={'raw':!![],'where':{'id':_0x521b27['params']['id']}},_0x14bcf2={};_0x14bcf2['model']=_[_0x8574('0x37')](db[_0x8574('0x2f')][_0x8574('0x30')]);_0x14bcf2[_0x8574('0x36')]=_[_0x8574('0x37')](_0x521b27['query']);_0x14bcf2[_0x8574('0x3f')]=_[_0x8574('0x47')](_0x14bcf2[_0x8574('0x33')],_0x14bcf2['query']);_0x2f6fe1[_0x8574('0x38')]=_['intersection'](_0x14bcf2['model'],qs[_0x8574('0x39')](_0x521b27[_0x8574('0x36')][_0x8574('0x39')]));_0x2f6fe1['attributes']=_0x2f6fe1[_0x8574('0x38')]['length']?_0x2f6fe1[_0x8574('0x38')]:_0x14bcf2[_0x8574('0x33')];if(_0x521b27['query']['includeAll']){_0x2f6fe1[_0x8574('0x48')]=[{'all':!![]}];}_0x2f6fe1=_[_0x8574('0x49')]({},_0x2f6fe1,_0x521b27[_0x8574('0x4a')]);return db[_0x8574('0x2f')][_0x8574('0x4b')](_0x2f6fe1)[_0x8574('0x2a')](handleEntityNotFound(_0x3ca6a4,null))[_0x8574('0x2a')](respondWithResult(_0x3ca6a4,null))[_0x8574('0x45')](handleError(_0x3ca6a4,null));};exports[_0x8574('0x4c')]=function(_0x39807e,_0x58887f){return db['Interval']['create'](_0x39807e[_0x8574('0x4d')],{})[_0x8574('0x2a')](function(_0x525df4){var _0x25d2bd=_0x39807e[_0x8574('0x4e')][_0x8574('0x2b')]({'plain':!![]});if(!_0x25d2bd)throw new Error(_0x8574('0x4f'));if(_0x25d2bd[_0x8574('0x50')]===_0x8574('0x4e')){var _0x35374f=_0x525df4['get']({'plain':!![]});var _0x28f9ce=_0x8574('0x51');return db[_0x8574('0x52')][_0x8574('0x4b')]({'where':{'name':_0x28f9ce,'userProfileId':_0x25d2bd[_0x8574('0x53')]},'raw':!![]})[_0x8574('0x2a')](function(_0x3c574a){if(_0x3c574a&&_0x3c574a['autoAssociation']===0x0){return db[_0x8574('0x54')]['create']({'name':_0x35374f[_0x8574('0x35')],'resourceId':_0x35374f['id'],'type':_0x3c574a[_0x8574('0x35')],'sectionId':_0x3c574a['id']},{})[_0x8574('0x2a')](function(){return _0x525df4;});}else{return _0x525df4;}})[_0x8574('0x45')](function(_0x349b3b){logger[_0x8574('0x2c')](_0x8574('0x55'),_0x349b3b);throw _0x349b3b;});}return _0x525df4;})[_0x8574('0x2a')](respondWithResult(_0x58887f,0xc9))['catch'](handleError(_0x58887f,null));};exports[_0x8574('0x29')]=function(_0x39d189,_0x450e56){if(_0x39d189['body']['id']){delete _0x39d189[_0x8574('0x4d')]['id'];}return db[_0x8574('0x2f')][_0x8574('0x4b')]({'where':{'id':_0x39d189[_0x8574('0x56')]['id']}})['then'](handleEntityNotFound(_0x450e56,null))[_0x8574('0x2a')](saveUpdates(_0x39d189['body'],null))[_0x8574('0x2a')](respondWithResult(_0x450e56,null))[_0x8574('0x45')](handleError(_0x450e56,null));};exports['destroy']=function(_0x35b552,_0x57be54){return db[_0x8574('0x2f')][_0x8574('0x4b')]({'where':{'id':_0x35b552[_0x8574('0x56')]['id']}})[_0x8574('0x2a')](handleEntityNotFound(_0x57be54,null))['then'](removeEntity(_0x57be54,null))[_0x8574('0x45')](handleError(_0x57be54,null));};exports[_0x8574('0x57')]=function(_0x1f3d0a,_0x848c52,_0x418657){if(_0x1f3d0a[_0x8574('0x4d')]['id']){delete _0x1f3d0a[_0x8574('0x4d')]['id'];}return db[_0x8574('0x2f')][_0x8574('0x4b')]({'where':{'id':_0x1f3d0a[_0x8574('0x56')]['id']}})[_0x8574('0x2a')](handleEntityNotFound(_0x848c52,null))[_0x8574('0x2a')](function(_0x1982e4){if(_0x1982e4){_0x1f3d0a['body']['IntervalId']=_0x1982e4['id'];return db[_0x8574('0x2f')][_0x8574('0x4c')](_0x1f3d0a[_0x8574('0x4d')]);}})['then'](respondWithResult(_0x848c52,null))[_0x8574('0x45')](handleError(_0x848c52,null));};exports[_0x8574('0x58')]=function(_0x41cc02,_0x70360c,_0x3455b4){var _0x427034={};var _0x371b2b={};var _0x396979;var _0x3a62db;return db[_0x8574('0x2f')]['findOne']({'where':{'id':_0x41cc02[_0x8574('0x56')]['id']}})['then'](handleEntityNotFound(_0x70360c,null))['then'](function(_0x31a382){if(_0x31a382){_0x396979=_0x31a382;_0x371b2b[_0x8574('0x33')]=_[_0x8574('0x37')](db[_0x8574('0x2f')][_0x8574('0x30')]);_0x371b2b['query']=_[_0x8574('0x37')](_0x41cc02[_0x8574('0x36')]);_0x371b2b[_0x8574('0x3f')]=_[_0x8574('0x47')](_0x371b2b[_0x8574('0x33')],_0x371b2b['query']);_0x427034[_0x8574('0x38')]=_['intersection'](_0x371b2b[_0x8574('0x33')],qs[_0x8574('0x39')](_0x41cc02[_0x8574('0x36')][_0x8574('0x39')]));_0x427034[_0x8574('0x38')]=_0x427034['attributes'][_0x8574('0x3a')]?_0x427034['attributes']:_0x371b2b[_0x8574('0x33')];_0x427034[_0x8574('0x59')]=qs[_0x8574('0x3d')](_0x41cc02[_0x8574('0x36')]['sort']);_0x427034[_0x8574('0x3e')]=qs[_0x8574('0x3f')](_[_0x8574('0x40')](_0x41cc02[_0x8574('0x36')],_0x371b2b[_0x8574('0x3f')]));if(_0x41cc02[_0x8574('0x36')][_0x8574('0x41')]){_0x427034[_0x8574('0x3e')]=_[_0x8574('0x49')](_0x427034[_0x8574('0x3e')],{'$or':_[_0x8574('0x34')](_0x427034[_0x8574('0x38')],function(_0x5083e6){var _0x2fca30={};_0x2fca30[_0x5083e6]={'$like':'%'+_0x41cc02[_0x8574('0x36')][_0x8574('0x41')]+'%'};return _0x2fca30;})});}_0x427034=_[_0x8574('0x49')]({},_0x427034,_0x41cc02['options']);return _0x396979['getIntervals'](_0x427034);}})[_0x8574('0x2a')](function(_0x305b08){if(_0x305b08){_0x3a62db=_0x305b08[_0x8574('0x3a')];if(!_0x41cc02['query'][_0x8574('0x3b')](_0x8574('0x3c'))){_0x427034['limit']=qs[_0x8574('0x1f')](_0x41cc02['query']['limit']);_0x427034[_0x8574('0x22')]=qs['offset'](_0x41cc02[_0x8574('0x36')][_0x8574('0x22')]);}return _0x396979['getIntervals'](_0x427034);}})[_0x8574('0x2a')](function(_0x1c84cb){if(_0x1c84cb){return _0x1c84cb?{'count':_0x3a62db,'rows':_0x1c84cb}:null;}})[_0x8574('0x2a')](respondWithResult(_0x70360c,null))[_0x8574('0x45')](handleError(_0x70360c,null));};exports[_0x8574('0x5a')]=function(_0x2ac716,_0x5aff99,_0x2a1809){return db['Interval']['findOne']({'where':{'id':_0x2ac716[_0x8574('0x56')]['id']}})[_0x8574('0x2a')](handleEntityNotFound(_0x5aff99,null))[_0x8574('0x2a')](function(_0x120ab1){if(_0x120ab1){return db['sequelize']['transaction'](function(_0x546302){return db['Interval'][_0x8574('0x5b')]({'where':{'IntervalId':_0x2ac716[_0x8574('0x56')]['id']},'transaction':_0x546302})['then'](function(_0xc12212){var _0x35995c=_['map'](_0x2ac716['body'],function(_0x52f68e){delete _0x52f68e['id'];_0x52f68e['IntervalId']=_0x2ac716[_0x8574('0x56')]['id'];return _0x52f68e;});return db['Interval']['bulkCreate'](_0x35995c,{'transaction':_0x546302});});})['then'](function(){return db[_0x8574('0x2f')][_0x8574('0x43')]({'where':{'IntervalId':_0x2ac716['params']['id']}});});}})[_0x8574('0x2a')](respondWithResult(_0x5aff99,null))[_0x8574('0x45')](handleError(_0x5aff99,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3f16fc7..5fe2c17 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 _0xac31=['define','Interval','tools_intervals','rewrite','string','interval','getIntervals','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xac31,0x1bd));var _0x1ac3=function(_0x4b9aba,_0x5c993f){_0x4b9aba=_0x4b9aba-0x0;var _0x1044e0=_0xac31[_0x4b9aba];return _0x1044e0;};'use strict';var attributes=require(_0x1ac3('0x0'));var extensions=require(_0x1ac3('0x1'));var iftime=require(_0x1ac3('0x2'))['iftime'];module['exports']=function(_0x525ace){return _0x525ace[_0x1ac3('0x3')](_0x1ac3('0x4'),attributes,{'tableName':_0x1ac3('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ed661){extensions['rewrite'](_0x525ace,_0x2ed661);},'afterBulkCreate':function(_0x38bcb4,_0x1b4f01,_0x44f10e){_0x44f10e();extensions[_0x1ac3('0x6')](_0x525ace,_0x38bcb4[0x0]);},'afterUpdate':function(_0x1a4297){extensions['rewrite'](_0x525ace,_0x1a4297);},'afterDestroy':function(_0xf9e7c6){extensions[_0x1ac3('0x6')](_0x525ace,_0xf9e7c6);}},'instanceMethods':{'ifTime':function(_0x4606eb=undefined,_0x4b58d4=new Date()){if(typeof this['interval']===_0x1ac3('0x7')){return iftime(this[_0x1ac3('0x8')],_0x4606eb,_0x4b58d4);}else{return this[_0x1ac3('0x9')]()['then'](function(_0x12211b){return Promise[_0x1ac3('0xa')](_0x12211b[_0x1ac3('0xb')](function(_0x40d161){return _0x40d161[_0x1ac3('0xc')](_0x4606eb,_0x4b58d4);}));})['then'](function(_0x5ab63c){return _0x5ab63c[_0x1ac3('0xd')](function(_0x3b2629,_0x5b5bd3){return _0x3b2629||_0x5b5bd3;},![]);});}}}});}; \ No newline at end of file +var _0x3c51=['then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x5e0e4c,_0x152934){var _0x45a3a1=function(_0x2bf758){while(--_0x2bf758){_0x5e0e4c['push'](_0x5e0e4c['shift']());}};_0x45a3a1(++_0x152934);}(_0x3c51,0x82));var _0x13c5=function(_0x211c47,_0x3ec4c8){_0x211c47=_0x211c47-0x0;var _0x1e35c9=_0x3c51[_0x211c47];return _0x1e35c9;};'use strict';var attributes=require(_0x13c5('0x0'));var extensions=require(_0x13c5('0x1'));var iftime=require(_0x13c5('0x2'))[_0x13c5('0x3')];module[_0x13c5('0x4')]=function(_0x5dc2a4){return _0x5dc2a4['define']('Interval',attributes,{'tableName':_0x13c5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1194ef){extensions[_0x13c5('0x6')](_0x5dc2a4,_0x1194ef);},'afterBulkCreate':function(_0x2b14ff,_0x549693,_0x372f89){_0x372f89();extensions[_0x13c5('0x6')](_0x5dc2a4,_0x2b14ff[0x0]);},'afterUpdate':function(_0x269e68){extensions[_0x13c5('0x6')](_0x5dc2a4,_0x269e68);},'afterDestroy':function(_0x2b4e4b){extensions[_0x13c5('0x6')](_0x5dc2a4,_0x2b4e4b);}},'instanceMethods':{'ifTime':function(_0x33b74a=undefined,_0x55f213=new Date()){if(typeof this[_0x13c5('0x7')]===_0x13c5('0x8')){return iftime(this[_0x13c5('0x7')],_0x33b74a,_0x55f213);}else{return this[_0x13c5('0x9')]()[_0x13c5('0xa')](function(_0x4c8dc3){return Promise[_0x13c5('0xb')](_0x4c8dc3[_0x13c5('0xc')](function(_0x256bb7){return _0x256bb7['ifTime'](_0x33b74a,_0x55f213);}));})[_0x13c5('0xa')](function(_0x2d80c0){return _0x2d80c0[_0x13c5('0xd')](function(_0x5dc119,_0x6c68f2){return _0x5dc119||_0x6c68f2;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 91ecc28..5cd9bb6 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 _0x67d4=['intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','util','../../mysqldb','../../config/logger','rpc','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetInterval','stringify','catch','error','message','ShowInterval','debug','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime'];(function(_0x4cde0a,_0x2d1444){var _0x33a5e3=function(_0x3f6a9f){while(--_0x3f6a9f){_0x4cde0a['push'](_0x4cde0a['shift']());}};_0x33a5e3(++_0x2d1444);}(_0x67d4,0x18e));var _0x467d=function(_0x1fb2c9,_0x1237d6){_0x1fb2c9=_0x1fb2c9-0x0;var _0xbac9a5=_0x67d4[_0x1fb2c9];return _0xbac9a5;};'use strict';var _=require('lodash');var util=require(_0x467d('0x0'));var db=require(_0x467d('0x1'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x467d('0x2'))(_0x467d('0x3'));exports['GetInterval']=function(_0x1a0746){var _0x372f81=this;return new Promise(function(_0x2dddfb,_0x4d7762){return db[_0x467d('0x4')][_0x467d('0x5')]({'raw':_0x1a0746[_0x467d('0x6')]?_0x1a0746[_0x467d('0x6')][_0x467d('0x7')]===undefined?!![]:![]:!![],'where':_0x1a0746[_0x467d('0x6')]?_0x1a0746[_0x467d('0x6')][_0x467d('0x8')]||null:null,'attributes':_0x1a0746[_0x467d('0x6')]?_0x1a0746[_0x467d('0x6')][_0x467d('0x9')]||null:null,'limit':_0x1a0746['options']?_0x1a0746[_0x467d('0x6')][_0x467d('0xa')]||null:null,'include':_0x1a0746[_0x467d('0x6')]?_0x1a0746['options']['include']?_['map'](_0x1a0746[_0x467d('0x6')][_0x467d('0xb')],function(_0x4c3316){return{'model':db[_0x4c3316['model']],'as':_0x4c3316['as'],'attributes':_0x4c3316['attributes'],'include':_0x4c3316['include']?_[_0x467d('0xc')](_0x4c3316[_0x467d('0xb')],function(_0x52814f){return{'model':db[_0x52814f[_0x467d('0xd')]],'as':_0x52814f['as'],'attributes':_0x52814f['attributes'],'include':_0x52814f[_0x467d('0xb')]?_[_0x467d('0xc')](_0x52814f[_0x467d('0xb')],function(_0x8f2fbe){return{'model':db[_0x8f2fbe[_0x467d('0xd')]],'as':_0x8f2fbe['as'],'attributes':_0x8f2fbe[_0x467d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x467d('0xe')](function(_0x58b8c3){logger[_0x467d('0xf')]('GetInterval',_0x1a0746);logger['debug'](_0x467d('0x10'),_0x1a0746,JSON[_0x467d('0x11')](_0x58b8c3));_0x2dddfb(_0x58b8c3);})[_0x467d('0x12')](function(_0x334b17){logger[_0x467d('0x13')](_0x467d('0x10'),_0x334b17[_0x467d('0x14')],_0x1a0746);_0x4d7762(_0x372f81[_0x467d('0x13')](0x1f4,_0x334b17[_0x467d('0x14')]));});});};exports[_0x467d('0x15')]=function(_0x1506e5){var _0x5b1ae1=this;return new Promise(function(_0x33c352,_0x452a88){return db[_0x467d('0x4')]['find']({'raw':_0x1506e5[_0x467d('0x6')]?_0x1506e5[_0x467d('0x6')][_0x467d('0x7')]===undefined?!![]:![]:!![],'where':_0x1506e5[_0x467d('0x6')]?_0x1506e5[_0x467d('0x6')]['where']||null:null,'attributes':_0x1506e5[_0x467d('0x6')]?_0x1506e5[_0x467d('0x6')][_0x467d('0x9')]||null:null,'include':_0x1506e5[_0x467d('0x6')]?_0x1506e5['options'][_0x467d('0xb')]?_[_0x467d('0xc')](_0x1506e5['options']['include'],function(_0x9c3971){return{'model':db[_0x9c3971[_0x467d('0xd')]],'as':_0x9c3971['as'],'attributes':_0x9c3971[_0x467d('0x9')],'include':_0x9c3971[_0x467d('0xb')]?_['map'](_0x9c3971[_0x467d('0xb')],function(_0x11a6b1){return{'model':db[_0x11a6b1[_0x467d('0xd')]],'as':_0x11a6b1['as'],'attributes':_0x11a6b1[_0x467d('0x9')],'include':_0x11a6b1[_0x467d('0xb')]?_[_0x467d('0xc')](_0x11a6b1['include'],function(_0xe4944d){return{'model':db[_0xe4944d[_0x467d('0xd')]],'as':_0xe4944d['as'],'attributes':_0xe4944d[_0x467d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x467d('0xe')](function(_0x3391db){logger[_0x467d('0xf')](_0x467d('0x15'),_0x1506e5);logger[_0x467d('0x16')]('ShowInterval',_0x1506e5,JSON[_0x467d('0x11')](_0x3391db));_0x33c352(_0x3391db);})['catch'](function(_0x4cb7c5){logger[_0x467d('0x13')](_0x467d('0x15'),_0x4cb7c5[_0x467d('0x14')],_0x1506e5);_0x452a88(_0x5b1ae1[_0x467d('0x13')](0x1f4,_0x4cb7c5['message']));});});};function checkArrayOfIntervals(_0x41bceb,_0x2be798){var _0x4b1e5d=[];return db[_0x467d('0x4')][_0x467d('0x5')]({'where':{'id':_0x41bceb}})[_0x467d('0xe')](function(_0x573680){_0x4b1e5d=_0x573680;return Promise[_0x467d('0x17')](_0x4b1e5d[_0x467d('0xc')](function(_0x2641c0){return _0x2641c0[_0x467d('0x18')](_0x2be798);}));})[_0x467d('0xe')](function(_0x3f7e1c){var _0x59fa01=_0x3f7e1c['reduce'](function(_0x12017c,_0x406cc9){return _0x12017c||_0x406cc9;},![]);logger[_0x467d('0xf')](util[_0x467d('0x19')](_0x467d('0x1a'),_0x4b1e5d[_0x467d('0xc')](function(_0x467043){return _0x467043[_0x467d('0x1b')];})[_0x467d('0x1c')](',\x20'),_0x4b1e5d['map'](function(_0x42cf9d){return _0x42cf9d['id'];})[_0x467d('0x1c')](',\x20')));return _0x59fa01;});}function checkSingleInterval(_0x5fe52a,_0x3f9995){return db[_0x467d('0x4')][_0x467d('0x1d')](_0x5fe52a)['then'](function(_0x58c316){if(_0x58c316){logger[_0x467d('0xf')](util[_0x467d('0x19')](_0x467d('0x1e'),_0x58c316[_0x467d('0x1b')],_0x58c316['id']));return _0x58c316[_0x467d('0x18')](_0x3f9995);}});}exports[_0x467d('0x1f')]=function(_0x2b5bb1){var _0x52ca54=_0x2b5bb1[_0x467d('0x20')];var _0x30ca7c=Array[_0x467d('0x21')](_0x2b5bb1['intervals'])?_0x2b5bb1[_0x467d('0x22')]:typeof _0x2b5bb1[_0x467d('0x22')]===_0x467d('0x23')?[_0x2b5bb1[_0x467d('0x22')]]:[];var _0x1b996f=_0x2b5bb1[_0x467d('0x24')]||undefined;var _0x2a9316=![];if(_0x30ca7c[_0x467d('0x25')]){logger[_0x467d('0xf')](util[_0x467d('0x19')](_0x467d('0x26'),_0x30ca7c[_0x467d('0x1c')](';\x20')));}if(_0x1b996f){logger[_0x467d('0xf')](util[_0x467d('0x19')](_0x467d('0x27'),_0x1b996f));}logger[_0x467d('0x16')](_0x467d('0x28'),_0x2a9316);logger['silly'](_0x467d('0x1f'),_0x2b5bb1);return Promise[_0x467d('0x29')]()['then'](function(){if(Array['isArray'](_0x52ca54)){return checkArrayOfIntervals(_0x52ca54,_0x1b996f);}else if(_0x52ca54){return checkSingleInterval(_0x52ca54,_0x1b996f);}})['then'](function(_0x1b6a31){var _0x19270e=_0x30ca7c[_0x467d('0x2a')](function(_0x5aa8ca,_0xfae6c4){return _0x5aa8ca||iftime(_0xfae6c4,_0x1b996f);},![]);_0x2a9316=_0x1b6a31||_0x19270e;return _0x2a9316;})[_0x467d('0x12')](function(_0x59a418){logger[_0x467d('0x13')]('IntervalIftime',_0x2b5bb1,_0x59a418);throw this[_0x467d('0x13')](0x1f4,_0x59a418['message']);});}; \ No newline at end of file +var _0x363d=['../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','include','model','map','attributes','then','debug','stringify','catch','error','message','ShowInterval','find','info','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','../../mysqldb','iftime'];(function(_0x393eac,_0x3b7946){var _0x142617=function(_0x585c3a){while(--_0x585c3a){_0x393eac['push'](_0x393eac['shift']());}};_0x142617(++_0x3b7946);}(_0x363d,0xa9));var _0xd363=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x363d[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0xd363('0x0'));var util=require('util');var db=require(_0xd363('0x1'))['db'];var iftime=require('../../utils/iftime')[_0xd363('0x2')];var logger=require(_0xd363('0x3'))(_0xd363('0x4'));exports[_0xd363('0x5')]=function(_0x4df6a7){var _0x506ff3=this;return new Promise(function(_0xd4e568,_0x5c6c6e){return db[_0xd363('0x6')][_0xd363('0x7')]({'raw':_0x4df6a7[_0xd363('0x8')]?_0x4df6a7[_0xd363('0x8')][_0xd363('0x9')]===undefined?!![]:![]:!![],'where':_0x4df6a7[_0xd363('0x8')]?_0x4df6a7[_0xd363('0x8')][_0xd363('0xa')]||null:null,'attributes':_0x4df6a7[_0xd363('0x8')]?_0x4df6a7[_0xd363('0x8')]['attributes']||null:null,'limit':_0x4df6a7[_0xd363('0x8')]?_0x4df6a7['options']['limit']||null:null,'include':_0x4df6a7[_0xd363('0x8')]?_0x4df6a7[_0xd363('0x8')][_0xd363('0xb')]?_['map'](_0x4df6a7[_0xd363('0x8')][_0xd363('0xb')],function(_0x58b1f7){return{'model':db[_0x58b1f7[_0xd363('0xc')]],'as':_0x58b1f7['as'],'attributes':_0x58b1f7['attributes'],'include':_0x58b1f7[_0xd363('0xb')]?_[_0xd363('0xd')](_0x58b1f7[_0xd363('0xb')],function(_0x2e2aef){return{'model':db[_0x2e2aef[_0xd363('0xc')]],'as':_0x2e2aef['as'],'attributes':_0x2e2aef[_0xd363('0xe')],'include':_0x2e2aef[_0xd363('0xb')]?_[_0xd363('0xd')](_0x2e2aef[_0xd363('0xb')],function(_0x13fc31){return{'model':db[_0x13fc31['model']],'as':_0x13fc31['as'],'attributes':_0x13fc31['attributes']};}):[]};}):[]};}):[]:[]})[_0xd363('0xf')](function(_0x1bc77e){logger['info']('GetInterval',_0x4df6a7);logger[_0xd363('0x10')](_0xd363('0x5'),_0x4df6a7,JSON[_0xd363('0x11')](_0x1bc77e));_0xd4e568(_0x1bc77e);})[_0xd363('0x12')](function(_0x199362){logger[_0xd363('0x13')]('GetInterval',_0x199362[_0xd363('0x14')],_0x4df6a7);_0x5c6c6e(_0x506ff3[_0xd363('0x13')](0x1f4,_0x199362[_0xd363('0x14')]));});});};exports[_0xd363('0x15')]=function(_0x311699){var _0x4f3bfa=this;return new Promise(function(_0xf3cb54,_0x45a11e){return db[_0xd363('0x6')][_0xd363('0x16')]({'raw':_0x311699[_0xd363('0x8')]?_0x311699['options'][_0xd363('0x9')]===undefined?!![]:![]:!![],'where':_0x311699['options']?_0x311699[_0xd363('0x8')][_0xd363('0xa')]||null:null,'attributes':_0x311699[_0xd363('0x8')]?_0x311699[_0xd363('0x8')][_0xd363('0xe')]||null:null,'include':_0x311699[_0xd363('0x8')]?_0x311699[_0xd363('0x8')][_0xd363('0xb')]?_[_0xd363('0xd')](_0x311699[_0xd363('0x8')][_0xd363('0xb')],function(_0x305ffc){return{'model':db[_0x305ffc[_0xd363('0xc')]],'as':_0x305ffc['as'],'attributes':_0x305ffc['attributes'],'include':_0x305ffc[_0xd363('0xb')]?_[_0xd363('0xd')](_0x305ffc[_0xd363('0xb')],function(_0x397302){return{'model':db[_0x397302[_0xd363('0xc')]],'as':_0x397302['as'],'attributes':_0x397302[_0xd363('0xe')],'include':_0x397302[_0xd363('0xb')]?_[_0xd363('0xd')](_0x397302['include'],function(_0x27ff77){return{'model':db[_0x27ff77[_0xd363('0xc')]],'as':_0x27ff77['as'],'attributes':_0x27ff77[_0xd363('0xe')]};}):[]};}):[]};}):[]:[]})[_0xd363('0xf')](function(_0x697132){logger[_0xd363('0x17')](_0xd363('0x15'),_0x311699);logger[_0xd363('0x10')](_0xd363('0x15'),_0x311699,JSON[_0xd363('0x11')](_0x697132));_0xf3cb54(_0x697132);})[_0xd363('0x12')](function(_0x1bd852){logger[_0xd363('0x13')](_0xd363('0x15'),_0x1bd852[_0xd363('0x14')],_0x311699);_0x45a11e(_0x4f3bfa[_0xd363('0x13')](0x1f4,_0x1bd852['message']));});});};function checkArrayOfIntervals(_0x2e05cc,_0x34c44e){var _0x4012fd=[];return db['Interval'][_0xd363('0x7')]({'where':{'id':_0x2e05cc}})[_0xd363('0xf')](function(_0x476e7a){_0x4012fd=_0x476e7a;return Promise['all'](_0x4012fd[_0xd363('0xd')](function(_0x4ac84d){return _0x4ac84d[_0xd363('0x18')](_0x34c44e);}));})['then'](function(_0x5001a7){var _0x3a5efd=_0x5001a7[_0xd363('0x19')](function(_0x1a9f6a,_0x25cb9d){return _0x1a9f6a||_0x25cb9d;},![]);logger[_0xd363('0x17')](util[_0xd363('0x1a')](_0xd363('0x1b'),_0x4012fd[_0xd363('0xd')](function(_0x5edb64){return _0x5edb64[_0xd363('0x1c')];})[_0xd363('0x1d')](',\x20'),_0x4012fd[_0xd363('0xd')](function(_0x4a5382){return _0x4a5382['id'];})[_0xd363('0x1d')](',\x20')));return _0x3a5efd;});}function checkSingleInterval(_0x4bd04f,_0x5790e8){return db[_0xd363('0x6')][_0xd363('0x1e')](_0x4bd04f)[_0xd363('0xf')](function(_0x1cdcdf){if(_0x1cdcdf){logger[_0xd363('0x17')](util[_0xd363('0x1a')](_0xd363('0x1f'),_0x1cdcdf[_0xd363('0x1c')],_0x1cdcdf['id']));return _0x1cdcdf[_0xd363('0x18')](_0x5790e8);}});}exports[_0xd363('0x20')]=function(_0xa7fc12){var _0x161eac=_0xa7fc12[_0xd363('0x21')];var _0x2cb2c5=Array[_0xd363('0x22')](_0xa7fc12[_0xd363('0x23')])?_0xa7fc12['intervals']:typeof _0xa7fc12[_0xd363('0x23')]==='string'?[_0xa7fc12[_0xd363('0x23')]]:[];var _0x3a603b=_0xa7fc12[_0xd363('0x24')]||undefined;var _0x3dc613=![];if(_0x2cb2c5[_0xd363('0x25')]){logger['info'](util[_0xd363('0x1a')](_0xd363('0x26'),_0x2cb2c5[_0xd363('0x1d')](';\x20')));}if(_0x3a603b){logger[_0xd363('0x17')](util[_0xd363('0x1a')](_0xd363('0x27'),_0x3a603b));}logger[_0xd363('0x10')](_0xd363('0x28'),_0x3dc613);logger[_0xd363('0x29')](_0xd363('0x20'),_0xa7fc12);return Promise[_0xd363('0x2a')]()[_0xd363('0xf')](function(){if(Array[_0xd363('0x22')](_0x161eac)){return checkArrayOfIntervals(_0x161eac,_0x3a603b);}else if(_0x161eac){return checkSingleInterval(_0x161eac,_0x3a603b);}})['then'](function(_0x155ff0){var _0x17eb94=_0x2cb2c5[_0xd363('0x19')](function(_0x5ef87c,_0x3493b0){return _0x5ef87c||iftime(_0x3493b0,_0x3a603b);},![]);_0x3dc613=_0x155ff0||_0x17eb94;return _0x3dc613;})[_0xd363('0x12')](function(_0x27e283){logger['error'](_0xd363('0x20'),_0xa7fc12,_0x27e283);throw this[_0xd363('0x13')](0x1f4,_0x27e283['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8adbe81..8771024 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(_0x13485b,_0x29fb3e){var _0x4ae5e8=function(_0x229799){while(--_0x229799){_0x13485b['push'](_0x13485b['shift']());}};_0x4ae5e8(++_0x29fb3e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e3db4,_0x808f5b){_0x3e3db4=_0x3e3db4-0x0;var _0x4ac1c5=_0x5f2f[_0x3e3db4];return _0x4ac1c5;};'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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x19c0b7,_0x4ccf97){var _0x25d143=function(_0x45fd77){while(--_0x45fd77){_0x19c0b7['push'](_0x19c0b7['shift']());}};_0x25d143(++_0x4ccf97);}(_0xdb28,0x106));var _0x8db2=function(_0x2e17b6,_0x3dbd57){_0x2e17b6=_0x2e17b6-0x0;var _0x5fb03c=_0xdb28[_0x2e17b6];return _0x5fb03c;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d6535b1..b2f5f17 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 _0x4910=['description','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','end','json','parse','error','status','write','headers','connection','remoteAddress','socket','body','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20'];(function(_0x36211c,_0x178508){var _0xd2487b=function(_0x101cd8){while(--_0x101cd8){_0x36211c['push'](_0x36211c['shift']());}};_0xd2487b(++_0x178508);}(_0x4910,0xb1));var _0x0491=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4910[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var https=require(_0x0491('0x0'));var logger=require('../../config/logger')(_0x0491('0x1'));var USERNAME=_0x0491('0x2');var PASSWORD=_0x0491('0x3');function openIssue(_0x448b26,_0xaefac5){var _0x1ec166={'fields':{'project':{'key':_0x448b26[_0x0491('0x4')]||_0x0491('0x5')},'summary':(_0x448b26[_0x0491('0x6')]||'Report')+_0x0491('0x7')+_0x448b26['ip'],'description':_0x448b26[_0x0491('0x8')]||JSON['stringify'](_0x448b26),'issuetype':{'name':_0x448b26[_0x0491('0x9')]||'Bug'}}};_0x1ec166[_0x0491('0xa')][_0x0491('0xb')]=_0x448b26[_0x0491('0xc')];_0x1ec166[_0x0491('0xa')][_0x0491('0xd')]=_0x448b26[_0x0491('0xe')];_0x1ec166[_0x0491('0xa')][_0x0491('0xf')]=_0x448b26[_0x0491('0x10')];_0x1ec166[_0x0491('0xa')]['customfield_11503']=_0x448b26[_0x0491('0x11')];_0x1ec166[_0x0491('0xa')]['customfield_11504']=_0x448b26['reason'];_0x1ec166[_0x0491('0xa')][_0x0491('0x12')]=_0x448b26['ip'];var _0x454f4f={'host':_0x0491('0x13'),'port':0x1bb,'path':_0x0491('0x14'),'method':_0x0491('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x0491('0x16'),'Authorization':_0x0491('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x0491('0x18')]('base64')}};var _0x10eaec=JSON[_0x0491('0x19')](_0x1ec166);var _0x126f4a=https['request'](_0x454f4f,function(_0xd0be50){_0xd0be50['setEncoding']('utf8');var _0x39857c='';_0xd0be50['on']('data',function(_0x13ed5e){_0x39857c+=_0x13ed5e;});_0xd0be50['on'](_0x0491('0x1a'),function(){if(_0xaefac5){return _0xaefac5['status'](_0xd0be50['statusCode'])[_0x0491('0x1b')](JSON[_0x0491('0x1c')](_0x39857c));}});});_0x126f4a['on'](_0x0491('0x1d'),function(_0x4fdc47){if(_0xaefac5){return _0xaefac5[_0x0491('0x1e')](0x1f4)[_0x0491('0x1b')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x126f4a[_0x0491('0x1f')](_0x10eaec);_0x126f4a['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x2fcbfd,_0x4e779f){_0x2fcbfd['body']['ip']=_0x2fcbfd[_0x0491('0x20')]['x-forwarded-for']||_0x2fcbfd[_0x0491('0x21')][_0x0491('0x22')]||_0x2fcbfd[_0x0491('0x23')][_0x0491('0x22')]||_0x2fcbfd[_0x0491('0x21')][_0x0491('0x23')][_0x0491('0x22')];return openIssue(_0x2fcbfd[_0x0491('0x24')],_0x4e779f);}; \ No newline at end of file +var _0x117e=['toString','base64','request','setEncoding','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x117e,0x194));var _0xe117=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x117e[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xe117('0x0'));var https=require(_0xe117('0x1'));var logger=require(_0xe117('0x2'))(_0xe117('0x3'));var USERNAME=_0xe117('0x4');var PASSWORD=_0xe117('0x5');function openIssue(_0xcfb2f0,_0x9a91ad){var _0x3d3914={'fields':{'project':{'key':_0xcfb2f0[_0xe117('0x6')]||'MOTGUI'},'summary':(_0xcfb2f0[_0xe117('0x7')]||_0xe117('0x8'))+_0xe117('0x9')+_0xcfb2f0['ip'],'description':_0xcfb2f0[_0xe117('0xa')]||JSON[_0xe117('0xb')](_0xcfb2f0),'issuetype':{'name':_0xcfb2f0['issuetype']||_0xe117('0xc')}}};_0x3d3914[_0xe117('0xd')][_0xe117('0xe')]=_0xcfb2f0[_0xe117('0xf')];_0x3d3914['fields'][_0xe117('0x10')]=_0xcfb2f0['oldToken'];_0x3d3914[_0xe117('0xd')][_0xe117('0x11')]=_0xcfb2f0[_0xe117('0x12')];_0x3d3914[_0xe117('0xd')][_0xe117('0x13')]=_0xcfb2f0['name'];_0x3d3914[_0xe117('0xd')][_0xe117('0x14')]=_0xcfb2f0[_0xe117('0x15')];_0x3d3914['fields'][_0xe117('0x16')]=_0xcfb2f0['ip'];var _0x5aa79d={'host':_0xe117('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xe117('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xe117('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xe117('0x1a')](_0xe117('0x1b'))}};var _0xa5d03f=JSON[_0xe117('0xb')](_0x3d3914);var _0x3bb333=https[_0xe117('0x1c')](_0x5aa79d,function(_0x249b3b){_0x249b3b[_0xe117('0x1d')]('utf8');var _0xf201e0='';_0x249b3b['on']('data',function(_0x4dd6a6){_0xf201e0+=_0x4dd6a6;});_0x249b3b['on'](_0xe117('0x1e'),function(){if(_0x9a91ad){return _0x9a91ad[_0xe117('0x1f')](_0x249b3b[_0xe117('0x20')])[_0xe117('0x21')](JSON['parse'](_0xf201e0));}});});_0x3bb333['on']('error',function(_0xf2292f){if(_0x9a91ad){return _0x9a91ad['status'](0x1f4)[_0xe117('0x21')]({'errors':[{'message':_0xe117('0x22'),'type':_0xe117('0x23')}]});}});_0x3bb333['write'](_0xa5d03f);_0x3bb333[_0xe117('0x1e')]();}exports[_0xe117('0x24')]=openIssue;exports['send']=function(_0x456ab5,_0x36deda){_0x456ab5['body']['ip']=_0x456ab5[_0xe117('0x25')][_0xe117('0x26')]||_0x456ab5[_0xe117('0x27')][_0xe117('0x28')]||_0x456ab5[_0xe117('0x29')][_0xe117('0x28')]||_0x456ab5['connection'][_0xe117('0x29')][_0xe117('0x28')];return openIssue(_0x456ab5[_0xe117('0x2a')],_0x36deda);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e34b4f0..14aa5ec 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x18c3ca,_0x3c800f){var _0xa9521a=function(_0x1a1c89){while(--_0x1a1c89){_0x18c3ca['push'](_0x18c3ca['shift']());}};_0xa9521a(++_0x3c800f);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +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','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x5d85e7,_0x54730b){var _0x933a9a=function(_0x7d28af){while(--_0x7d28af){_0x5d85e7['push'](_0x5d85e7['shift']());}};_0x933a9a(++_0x54730b);}(_0xe706,0xa3));var _0x6e70=function(_0xf7aa86,_0x171456){_0xf7aa86=_0xf7aa86-0x0;var _0x5eb1ed=_0xe706[_0xf7aa86];return _0x5eb1ed;};'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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6e0abb4..f5cd7bf 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4dbb11,_0x2ed538){_0x4dbb11=_0x4dbb11-0x0;var _0x45a584=_0x7a54[_0x4dbb11];return _0x45a584;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x410e89,_0x4caf5d){_0x410e89=_0x410e89-0x0;var _0x17241c=_0x7a54[_0x410e89];return _0x17241c;};'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 b3dd61f..b3d6c34 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 _0xae30=['offset','apply','reject','end','sendStatus','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','then','rows','catch','show','params','includeAll','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/utils','../../config/environment','status','json','undefined','limit','count'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xae30,0x10a));var _0x0ae3=function(_0x573010,_0x2923c4){_0x573010=_0x573010-0x0;var _0x84c43d=_0xae30[_0x573010];return _0x84c43d;};'use strict';var emlformat=require(_0x0ae3('0x0'));var rimraf=require(_0x0ae3('0x1'));var zipdir=require(_0x0ae3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae3('0x3'));var moment=require(_0x0ae3('0x4'));var BPromise=require(_0x0ae3('0x5'));var Mustache=require(_0x0ae3('0x6'));var util=require('util');var path=require(_0x0ae3('0x7'));var sox=require(_0x0ae3('0x8'));var csv=require(_0x0ae3('0x9'));var ejs=require(_0x0ae3('0xa'));var fs=require('fs');var fs_extra=require(_0x0ae3('0xb'));var _=require(_0x0ae3('0xc'));var squel=require(_0x0ae3('0xd'));var crypto=require(_0x0ae3('0xe'));var jsforce=require(_0x0ae3('0xf'));var deskjs=require(_0x0ae3('0x10'));var toCsv=require(_0x0ae3('0x9'));var querystring=require(_0x0ae3('0x11'));var Papa=require(_0x0ae3('0x12'));var Redis=require('ioredis');var authService=require(_0x0ae3('0x13'));var qs=require(_0x0ae3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ae3('0x15'))(_0x0ae3('0x16'));var utils=require(_0x0ae3('0x17'));var config=require(_0x0ae3('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245ac0,_0x45242d){_0x45242d=_0x45242d||0xcc;return function(_0x50cee6){if(_0x50cee6){return _0x245ac0['sendStatus'](_0x45242d);}return _0x245ac0[_0x0ae3('0x19')](_0x45242d)['end']();};}function respondWithResult(_0x1b1e46,_0x450000){_0x450000=_0x450000||0xc8;return function(_0x1a6c69){if(_0x1a6c69){return _0x1b1e46[_0x0ae3('0x19')](_0x450000)[_0x0ae3('0x1a')](_0x1a6c69);}};}function respondWithFilteredResult(_0x1600bc,_0x28b547){return function(_0x5af348){if(_0x5af348){var _0x17f280=typeof _0x28b547['offset']===_0x0ae3('0x1b')&&typeof _0x28b547[_0x0ae3('0x1c')]===_0x0ae3('0x1b');var _0x59d0de=_0x5af348[_0x0ae3('0x1d')];var _0x40edc6=_0x17f280?0x0:_0x28b547[_0x0ae3('0x1e')];var _0x1bf406=_0x17f280?_0x5af348[_0x0ae3('0x1d')]:_0x28b547['offset']+_0x28b547[_0x0ae3('0x1c')];var _0x4b8949;if(_0x1bf406>=_0x59d0de){_0x1bf406=_0x59d0de;_0x4b8949=0xc8;}else{_0x4b8949=0xce;}_0x1600bc['status'](_0x4b8949);return _0x1600bc['set']('Content-Range',_0x40edc6+'-'+_0x1bf406+'/'+_0x59d0de)['json'](_0x5af348);}return null;};}function patchUpdates(_0x4e8135){return function(_0x4d1385){try{jsonpatch[_0x0ae3('0x1f')](_0x4d1385,_0x4e8135,!![]);}catch(_0x1fd946){return BPromise[_0x0ae3('0x20')](_0x1fd946);}return _0x4d1385['save']();};}function saveUpdates(_0x1cdd85,_0x5ecc45){return function(_0xfcf4a8){if(_0xfcf4a8){return _0xfcf4a8['update'](_0x1cdd85)['then'](function(_0x5ab18d){return _0x5ab18d;});}return null;};}function removeEntity(_0x281adf,_0x3b49a0){return function(_0x51e7d1){if(_0x51e7d1){return _0x51e7d1['destroy']()['then'](function(){_0x281adf[_0x0ae3('0x19')](0xcc)[_0x0ae3('0x21')]();});}};}function handleEntityNotFound(_0x5a76e5,_0x36ce4e){return function(_0x1613c3){if(!_0x1613c3){_0x5a76e5[_0x0ae3('0x22')](0x194);}return _0x1613c3;};}function handleError(_0x5b0117,_0x2f8134){_0x2f8134=_0x2f8134||0x1f4;return function(_0x1f9cde){logger[_0x0ae3('0x23')](_0x1f9cde['stack']);if(_0x1f9cde[_0x0ae3('0x24')]){delete _0x1f9cde[_0x0ae3('0x24')];}_0x5b0117[_0x0ae3('0x19')](_0x2f8134)['send'](_0x1f9cde);};}exports[_0x0ae3('0x25')]=function(_0x247623,_0xf0e310){var _0x152876={},_0x1f8f61={},_0x10a7bd={'count':0x0,'rows':[]};var _0x5e8979=_[_0x0ae3('0x26')](db[_0x0ae3('0x27')][_0x0ae3('0x28')],function(_0x4032f4){return{'name':_0x4032f4[_0x0ae3('0x29')],'type':_0x4032f4[_0x0ae3('0x2a')][_0x0ae3('0x2b')]};});_0x1f8f61[_0x0ae3('0x2c')]=_['map'](_0x5e8979,_0x0ae3('0x24'));_0x1f8f61[_0x0ae3('0x2d')]=_[_0x0ae3('0x2e')](_0x247623[_0x0ae3('0x2d')]);_0x1f8f61['filters']=_[_0x0ae3('0x2f')](_0x1f8f61[_0x0ae3('0x2c')],_0x1f8f61[_0x0ae3('0x2d')]);_0x152876[_0x0ae3('0x30')]=_[_0x0ae3('0x2f')](_0x1f8f61[_0x0ae3('0x2c')],qs['fields'](_0x247623[_0x0ae3('0x2d')][_0x0ae3('0x31')]));_0x152876[_0x0ae3('0x30')]=_0x152876[_0x0ae3('0x30')][_0x0ae3('0x32')]?_0x152876[_0x0ae3('0x30')]:_0x1f8f61[_0x0ae3('0x2c')];if(!_0x247623['query']['hasOwnProperty'](_0x0ae3('0x33'))){_0x152876[_0x0ae3('0x1c')]=qs[_0x0ae3('0x1c')](_0x247623['query']['limit']);_0x152876[_0x0ae3('0x1e')]=qs[_0x0ae3('0x1e')](_0x247623[_0x0ae3('0x2d')][_0x0ae3('0x1e')]);}_0x152876[_0x0ae3('0x34')]=qs[_0x0ae3('0x35')](_0x247623[_0x0ae3('0x2d')]['sort']);_0x152876[_0x0ae3('0x36')]=qs[_0x0ae3('0x37')](_[_0x0ae3('0x38')](_0x247623['query'],_0x1f8f61['filters']),_0x5e8979);if(_0x247623['query'][_0x0ae3('0x39')]){_0x152876[_0x0ae3('0x36')]=_['merge'](_0x152876[_0x0ae3('0x36')],{'$or':_[_0x0ae3('0x26')](_0x5e8979,function(_0x3ee862){if(_0x3ee862['type']!==_0x0ae3('0x3a')){var _0x5dd8d7={};_0x5dd8d7[_0x3ee862[_0x0ae3('0x24')]]={'$like':'%'+_0x247623[_0x0ae3('0x2d')]['filter']+'%'};return _0x5dd8d7;}})});}_0x152876=_[_0x0ae3('0x3b')]({},_0x152876,_0x247623[_0x0ae3('0x3c')]);var _0xfa6c7f={'where':_0x152876[_0x0ae3('0x36')]};return db[_0x0ae3('0x27')]['count'](_0xfa6c7f)['then'](function(_0x2e95e5){_0x10a7bd[_0x0ae3('0x1d')]=_0x2e95e5;if(_0x247623['query']['includeAll']){_0x152876['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0ae3('0x3d')](_0x152876);})[_0x0ae3('0x3e')](function(_0x325153){_0x10a7bd[_0x0ae3('0x3f')]=_0x325153;return _0x10a7bd;})[_0x0ae3('0x3e')](respondWithFilteredResult(_0xf0e310,_0x152876))[_0x0ae3('0x40')](handleError(_0xf0e310,null));};exports[_0x0ae3('0x41')]=function(_0x3166af,_0x2cfc16){var _0x1230c9={'raw':!![],'where':{'id':_0x3166af[_0x0ae3('0x42')]['id']}},_0x5a0e74={};_0x5a0e74[_0x0ae3('0x2c')]=_['keys'](db[_0x0ae3('0x27')][_0x0ae3('0x28')]);_0x5a0e74[_0x0ae3('0x2d')]=_[_0x0ae3('0x2e')](_0x3166af[_0x0ae3('0x2d')]);_0x5a0e74['filters']=_[_0x0ae3('0x2f')](_0x5a0e74[_0x0ae3('0x2c')],_0x5a0e74[_0x0ae3('0x2d')]);_0x1230c9[_0x0ae3('0x30')]=_['intersection'](_0x5a0e74[_0x0ae3('0x2c')],qs[_0x0ae3('0x31')](_0x3166af['query'][_0x0ae3('0x31')]));_0x1230c9[_0x0ae3('0x30')]=_0x1230c9['attributes']['length']?_0x1230c9[_0x0ae3('0x30')]:_0x5a0e74[_0x0ae3('0x2c')];if(_0x3166af[_0x0ae3('0x2d')][_0x0ae3('0x43')]){_0x1230c9[_0x0ae3('0x44')]=[{'all':!![]}];}_0x1230c9=_['merge']({},_0x1230c9,_0x3166af['options']);return db[_0x0ae3('0x27')]['find'](_0x1230c9)[_0x0ae3('0x3e')](handleEntityNotFound(_0x2cfc16,null))[_0x0ae3('0x3e')](respondWithResult(_0x2cfc16,null))['catch'](handleError(_0x2cfc16,null));};exports[_0x0ae3('0x45')]=function(_0x3e4bfb,_0x53e018){return db[_0x0ae3('0x27')][_0x0ae3('0x45')](_0x3e4bfb[_0x0ae3('0x46')],{})[_0x0ae3('0x3e')](respondWithResult(_0x53e018,0xc9))[_0x0ae3('0x40')](handleError(_0x53e018,null));};exports['update']=function(_0x3ad6b3,_0x53393b){if(_0x3ad6b3[_0x0ae3('0x46')]['id']){delete _0x3ad6b3[_0x0ae3('0x46')]['id'];}return db[_0x0ae3('0x27')][_0x0ae3('0x47')]({'where':{'id':_0x3ad6b3[_0x0ae3('0x42')]['id']}})[_0x0ae3('0x3e')](handleEntityNotFound(_0x53393b,null))[_0x0ae3('0x3e')](saveUpdates(_0x3ad6b3[_0x0ae3('0x46')],null))['then'](respondWithResult(_0x53393b,null))[_0x0ae3('0x40')](handleError(_0x53393b,null));};exports[_0x0ae3('0x48')]=function(_0x29479f,_0x12ea03){return db[_0x0ae3('0x27')][_0x0ae3('0x47')]({'where':{'id':_0x29479f[_0x0ae3('0x42')]['id']}})[_0x0ae3('0x3e')](handleEntityNotFound(_0x12ea03,null))[_0x0ae3('0x3e')](removeEntity(_0x12ea03,null))[_0x0ae3('0x40')](handleError(_0x12ea03,null));};exports[_0x0ae3('0x49')]=function(_0x572166,_0x256dc5){return db['JscriptyAnswerReport'][_0x0ae3('0x49')]()[_0x0ae3('0x3e')](respondWithResult(_0x256dc5,null))[_0x0ae3('0x40')](handleError(_0x256dc5,null));}; \ No newline at end of file +var _0x8ca9=['show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','sendStatus','stack','index','map','JscriptyAnswerReport','type','key','name','keys','filters','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x8ca9,0x9c));var _0x98ca=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x8ca9[_0x3b150c];return _0x5cd414;};'use strict';var emlformat=require(_0x98ca('0x0'));var rimraf=require(_0x98ca('0x1'));var zipdir=require(_0x98ca('0x2'));var jsonpatch=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var moment=require(_0x98ca('0x5'));var BPromise=require(_0x98ca('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98ca('0x7'));var sox=require('sox');var csv=require(_0x98ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ca('0x9'));var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0x8'));var querystring=require(_0x98ca('0xf'));var Papa=require(_0x98ca('0x10'));var Redis=require(_0x98ca('0x11'));var authService=require(_0x98ca('0x12'));var qs=require(_0x98ca('0x13'));var as=require(_0x98ca('0x14'));var hardwareService=require(_0x98ca('0x15'));var logger=require(_0x98ca('0x16'))(_0x98ca('0x17'));var utils=require(_0x98ca('0x18'));var config=require(_0x98ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1a'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1b')](_0xba3887)[_0x98ca('0x1c')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1b')](_0xa2bab4)[_0x98ca('0x1d')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=typeof _0x330713[_0x98ca('0x1e')]==='undefined'&&typeof _0x330713[_0x98ca('0x1f')]===_0x98ca('0x20');var _0xe9f8ad=_0x29df1b[_0x98ca('0x21')];var _0x4523bb=_0x29f46b?0x0:_0x330713[_0x98ca('0x1e')];var _0x28c8a6=_0x29f46b?_0x29df1b[_0x98ca('0x21')]:_0x330713[_0x98ca('0x1e')]+_0x330713[_0x98ca('0x1f')];var _0x1b2c69;if(_0x28c8a6>=_0xe9f8ad){_0x28c8a6=_0xe9f8ad;_0x1b2c69=0xc8;}else{_0x1b2c69=0xce;}_0x4940ca['status'](_0x1b2c69);return _0x4940ca[_0x98ca('0x22')]('Content-Range',_0x4523bb+'-'+_0x28c8a6+'/'+_0xe9f8ad)[_0x98ca('0x1d')](_0x29df1b);}return null;};}function patchUpdates(_0x2fe568){return function(_0x50f8b4){try{jsonpatch['apply'](_0x50f8b4,_0x2fe568,!![]);}catch(_0x4620e3){return BPromise[_0x98ca('0x23')](_0x4620e3);}return _0x50f8b4[_0x98ca('0x24')]();};}function saveUpdates(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['update'](_0x519927)[_0x98ca('0x25')](function(_0x5dc400){return _0x5dc400;});}return null;};}function removeEntity(_0x3fd0bd,_0x323cdb){return function(_0x430d16){if(_0x430d16){return _0x430d16[_0x98ca('0x26')]()[_0x98ca('0x25')](function(){_0x3fd0bd[_0x98ca('0x1b')](0xcc)[_0x98ca('0x1c')]();});}};}function handleEntityNotFound(_0x50b1a2,_0x2029cb){return function(_0x4fc3c9){if(!_0x4fc3c9){_0x50b1a2[_0x98ca('0x27')](0x194);}return _0x4fc3c9;};}function handleError(_0x1bdb75,_0x5eb829){_0x5eb829=_0x5eb829||0x1f4;return function(_0x1f569b){logger['error'](_0x1f569b[_0x98ca('0x28')]);if(_0x1f569b['name']){delete _0x1f569b['name'];}_0x1bdb75[_0x98ca('0x1b')](_0x5eb829)['send'](_0x1f569b);};}exports[_0x98ca('0x29')]=function(_0x35b920,_0x13f766){var _0x21a12a={},_0x3b3e60={},_0x1e7fcf={'count':0x0,'rows':[]};var _0x11389a=_[_0x98ca('0x2a')](db[_0x98ca('0x2b')]['rawAttributes'],function(_0x2ebf28){return{'name':_0x2ebf28['fieldName'],'type':_0x2ebf28[_0x98ca('0x2c')][_0x98ca('0x2d')]};});_0x3b3e60['model']=_['map'](_0x11389a,_0x98ca('0x2e'));_0x3b3e60['query']=_[_0x98ca('0x2f')](_0x35b920['query']);_0x3b3e60[_0x98ca('0x30')]=_['intersection'](_0x3b3e60[_0x98ca('0x31')],_0x3b3e60[_0x98ca('0x32')]);_0x21a12a['attributes']=_[_0x98ca('0x33')](_0x3b3e60[_0x98ca('0x31')],qs['fields'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x34')]));_0x21a12a['attributes']=_0x21a12a[_0x98ca('0x35')][_0x98ca('0x36')]?_0x21a12a[_0x98ca('0x35')]:_0x3b3e60[_0x98ca('0x31')];if(!_0x35b920[_0x98ca('0x32')]['hasOwnProperty'](_0x98ca('0x37'))){_0x21a12a[_0x98ca('0x1f')]=qs['limit'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1f')]);_0x21a12a[_0x98ca('0x1e')]=qs['offset'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1e')]);}_0x21a12a[_0x98ca('0x38')]=qs['sort'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x39')]);_0x21a12a[_0x98ca('0x3a')]=qs['filters'](_['pick'](_0x35b920[_0x98ca('0x32')],_0x3b3e60[_0x98ca('0x30')]),_0x11389a);if(_0x35b920[_0x98ca('0x32')]['filter']){_0x21a12a[_0x98ca('0x3a')]=_[_0x98ca('0x3b')](_0x21a12a[_0x98ca('0x3a')],{'$or':_['map'](_0x11389a,function(_0x1f513b){if(_0x1f513b[_0x98ca('0x2c')]!==_0x98ca('0x3c')){var _0x450745={};_0x450745[_0x1f513b[_0x98ca('0x2e')]]={'$like':'%'+_0x35b920['query']['filter']+'%'};return _0x450745;}})});}_0x21a12a=_['merge']({},_0x21a12a,_0x35b920[_0x98ca('0x3d')]);var _0x2ef2f4={'where':_0x21a12a[_0x98ca('0x3a')]};return db[_0x98ca('0x2b')][_0x98ca('0x21')](_0x2ef2f4)[_0x98ca('0x25')](function(_0x29801f){_0x1e7fcf['count']=_0x29801f;if(_0x35b920['query'][_0x98ca('0x3e')]){_0x21a12a[_0x98ca('0x3f')]=[{'all':!![]}];}return db[_0x98ca('0x2b')][_0x98ca('0x40')](_0x21a12a);})[_0x98ca('0x25')](function(_0x535fdc){_0x1e7fcf['rows']=_0x535fdc;return _0x1e7fcf;})['then'](respondWithFilteredResult(_0x13f766,_0x21a12a))[_0x98ca('0x41')](handleError(_0x13f766,null));};exports[_0x98ca('0x42')]=function(_0x914606,_0x3f260b){var _0x4ede34={'raw':!![],'where':{'id':_0x914606[_0x98ca('0x43')]['id']}},_0x4c2515={};_0x4c2515[_0x98ca('0x31')]=_[_0x98ca('0x2f')](db[_0x98ca('0x2b')][_0x98ca('0x44')]);_0x4c2515[_0x98ca('0x32')]=_[_0x98ca('0x2f')](_0x914606[_0x98ca('0x32')]);_0x4c2515[_0x98ca('0x30')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],_0x4c2515['query']);_0x4ede34[_0x98ca('0x35')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],qs[_0x98ca('0x34')](_0x914606[_0x98ca('0x32')][_0x98ca('0x34')]));_0x4ede34[_0x98ca('0x35')]=_0x4ede34[_0x98ca('0x35')][_0x98ca('0x36')]?_0x4ede34['attributes']:_0x4c2515[_0x98ca('0x31')];if(_0x914606[_0x98ca('0x32')]['includeAll']){_0x4ede34[_0x98ca('0x3f')]=[{'all':!![]}];}_0x4ede34=_['merge']({},_0x4ede34,_0x914606[_0x98ca('0x3d')]);return db[_0x98ca('0x2b')][_0x98ca('0x45')](_0x4ede34)[_0x98ca('0x25')](handleEntityNotFound(_0x3f260b,null))[_0x98ca('0x25')](respondWithResult(_0x3f260b,null))[_0x98ca('0x41')](handleError(_0x3f260b,null));};exports[_0x98ca('0x46')]=function(_0x15ed74,_0x2c7d53){return db[_0x98ca('0x2b')][_0x98ca('0x46')](_0x15ed74[_0x98ca('0x47')],{})['then'](respondWithResult(_0x2c7d53,0xc9))[_0x98ca('0x41')](handleError(_0x2c7d53,null));};exports[_0x98ca('0x48')]=function(_0x40498f,_0x19dc39){if(_0x40498f['body']['id']){delete _0x40498f[_0x98ca('0x47')]['id'];}return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x40498f[_0x98ca('0x43')]['id']}})[_0x98ca('0x25')](handleEntityNotFound(_0x19dc39,null))[_0x98ca('0x25')](saveUpdates(_0x40498f[_0x98ca('0x47')],null))['then'](respondWithResult(_0x19dc39,null))['catch'](handleError(_0x19dc39,null));};exports['destroy']=function(_0x3247af,_0x3715cb){return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x3247af['params']['id']}})['then'](handleEntityNotFound(_0x3715cb,null))[_0x98ca('0x25')](removeEntity(_0x3715cb,null))[_0x98ca('0x41')](handleError(_0x3715cb,null));};exports[_0x98ca('0x49')]=function(_0x408266,_0x46bb13){return db[_0x98ca('0x2b')][_0x98ca('0x49')]()[_0x98ca('0x25')](respondWithResult(_0x46bb13,null))[_0x98ca('0x41')](handleError(_0x46bb13,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 219c01b..f1a7240 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 _0x3a46=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash'];(function(_0x49d68f,_0x191c6e){var _0x1ffc33=function(_0x201919){while(--_0x201919){_0x49d68f['push'](_0x49d68f['shift']());}};_0x1ffc33(++_0x191c6e);}(_0x3a46,0xbf));var _0x63a4=function(_0x44db02,_0x1dc06d){_0x44db02=_0x44db02-0x0;var _0xb48362=_0x3a46[_0x44db02];return _0xb48362;};'use strict';var _=require(_0x63a4('0x0'));var util=require(_0x63a4('0x1'));var logger=require('../../config/logger')(_0x63a4('0x2'));var moment=require('moment');var BPromise=require(_0x63a4('0x3'));var rp=require(_0x63a4('0x4'));var fs=require('fs');var path=require(_0x63a4('0x5'));var rimraf=require(_0x63a4('0x6'));var config=require(_0x63a4('0x7'));var attributes=require(_0x63a4('0x8'));module[_0x63a4('0x9')]=function(_0x534a2b,_0xc9418c){return _0x534a2b[_0x63a4('0xa')](_0x63a4('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0410=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x5dccbe,_0x3ff48e){var _0x137723=function(_0x4a0781){while(--_0x4a0781){_0x5dccbe['push'](_0x5dccbe['shift']());}};_0x137723(++_0x3ff48e);}(_0x0410,0x1df));var _0x0041=function(_0x54644e,_0x515f82){_0x54644e=_0x54644e-0x0;var _0x2a15d6=_0x0410[_0x54644e];return _0x2a15d6;};'use strict';var _=require(_0x0041('0x0'));var util=require(_0x0041('0x1'));var logger=require('../../config/logger')(_0x0041('0x2'));var moment=require(_0x0041('0x3'));var BPromise=require(_0x0041('0x4'));var rp=require(_0x0041('0x5'));var fs=require('fs');var path=require(_0x0041('0x6'));var rimraf=require(_0x0041('0x7'));var config=require(_0x0041('0x8'));var attributes=require(_0x0041('0x9'));module[_0x0041('0xa')]=function(_0x1015a7,_0x16ad7a){return _0x1015a7['define'](_0x0041('0xb'),attributes,{'tableName':_0x0041('0xc'),'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 e15d02c..5afa33a 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 _0xf1d9=['client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x9ce60d,_0x3b8653){var _0x3dfa51=function(_0x24fe0c){while(--_0x24fe0c){_0x9ce60d['push'](_0x9ce60d['shift']());}};_0x3dfa51(++_0x3b8653);}(_0xf1d9,0x1ac));var _0x9f1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9f1d('0x0'));var moment=require(_0x9f1d('0x1'));var BPromise=require(_0x9f1d('0x2'));var rs=require(_0x9f1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f1d('0x4'))['db'];var utils=require(_0x9f1d('0x5'));var logger=require(_0x9f1d('0x6'))(_0x9f1d('0x7'));var config=require(_0x9f1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f1d('0x9')][_0x9f1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x396696,_0x1c5718,_0x175533){return new BPromise(function(_0x143c8c,_0x50ee22){return client[_0x9f1d('0xb')](_0x396696,_0x175533)['then'](function(_0x36aa7a){logger[_0x9f1d('0xc')](_0x9f1d('0xd'),_0x1c5718,'request\x20sent');logger[_0x9f1d('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1c5718,'request\x20sent',JSON[_0x9f1d('0xf')](_0x36aa7a));if(_0x36aa7a[_0x9f1d('0x10')]){if(_0x36aa7a['error']['code']===0x1f4){logger['error'](_0x9f1d('0xd'),_0x1c5718,_0x36aa7a['error'][_0x9f1d('0x11')]);return _0x50ee22(_0x36aa7a[_0x9f1d('0x10')]['message']);}logger[_0x9f1d('0x10')](_0x9f1d('0xd'),_0x1c5718,_0x36aa7a[_0x9f1d('0x10')][_0x9f1d('0x11')]);return _0x143c8c(_0x36aa7a[_0x9f1d('0x10')][_0x9f1d('0x11')]);}else{logger[_0x9f1d('0xc')](_0x9f1d('0xd'),_0x1c5718,'request\x20sent');_0x143c8c(_0x36aa7a['result'][_0x9f1d('0x11')]);}})[_0x9f1d('0x12')](function(_0x10d6cb){logger[_0x9f1d('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1c5718,_0x10d6cb);_0x50ee22(_0x10d6cb);});});} \ No newline at end of file +var _0x74b5=['error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c4f5d,_0x1f82ac){var _0x160920=function(_0x2005bf){while(--_0x2005bf){_0x4c4f5d['push'](_0x4c4f5d['shift']());}};_0x160920(++_0x1f82ac);}(_0x74b5,0x11d));var _0x574b=function(_0x2f9a98,_0x206f96){_0x2f9a98=_0x2f9a98-0x0;var _0x2d7280=_0x74b5[_0x2f9a98];return _0x2d7280;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x574b('0x0'));var BPromise=require(_0x574b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x574b('0x2'));var db=require(_0x574b('0x3'))['db'];var utils=require(_0x574b('0x4'));var logger=require(_0x574b('0x5'))('rpc');var config=require(_0x574b('0x6'));var jayson=require(_0x574b('0x7'));var client=jayson[_0x574b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2b39,_0x75501e,_0x437ab4){return new BPromise(function(_0x6ee276,_0x231a51){return client[_0x574b('0x9')](_0x4e2b39,_0x437ab4)[_0x574b('0xa')](function(_0x15ff53){logger[_0x574b('0xb')](_0x574b('0xc'),_0x75501e,_0x574b('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x75501e,'request\x20sent',JSON[_0x574b('0xe')](_0x15ff53));if(_0x15ff53['error']){if(_0x15ff53[_0x574b('0xf')][_0x574b('0x10')]===0x1f4){logger[_0x574b('0xf')](_0x574b('0xc'),_0x75501e,_0x15ff53['error'][_0x574b('0x11')]);return _0x231a51(_0x15ff53[_0x574b('0xf')][_0x574b('0x11')]);}logger[_0x574b('0xf')](_0x574b('0xc'),_0x75501e,_0x15ff53['error'][_0x574b('0x11')]);return _0x6ee276(_0x15ff53[_0x574b('0xf')]['message']);}else{logger['info'](_0x574b('0xc'),_0x75501e,_0x574b('0xd'));_0x6ee276(_0x15ff53[_0x574b('0x12')]['message']);}})[_0x574b('0x13')](function(_0x205b0f){logger[_0x574b('0xf')](_0x574b('0xc'),_0x75501e,_0x205b0f);_0x231a51(_0x205b0f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3e915ba..a6c2bd1 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 _0xc036=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','put','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x48261b,_0xea7b92){var _0xbe8b07=function(_0x1e8486){while(--_0x1e8486){_0x48261b['push'](_0x48261b['shift']());}};_0xbe8b07(++_0xea7b92);}(_0xc036,0x13f));var _0x6c03=function(_0x23f58d,_0x22b11c){_0x23f58d=_0x23f58d-0x0;var _0x515d10=_0xc036[_0x23f58d];return _0x515d10;};'use strict';var multer=require('multer');var util=require(_0x6c03('0x0'));var path=require('path');var timeout=require(_0x6c03('0x1'));var express=require(_0x6c03('0x2'));var router=express[_0x6c03('0x3')]();var fs_extra=require(_0x6c03('0x4'));var auth=require(_0x6c03('0x5'));var interaction=require(_0x6c03('0x6'));var config=require(_0x6c03('0x7'));var controller=require(_0x6c03('0x8'));router[_0x6c03('0x9')]('/',auth[_0x6c03('0xa')](),controller[_0x6c03('0xb')]);router[_0x6c03('0x9')](_0x6c03('0xc'),auth[_0x6c03('0xa')](),controller[_0x6c03('0xd')]);router['get'](_0x6c03('0xe'),auth['isAuthenticated'](),controller[_0x6c03('0xf')]);router[_0x6c03('0x9')]('/:id/answers',auth[_0x6c03('0xa')](),controller[_0x6c03('0x10')]);router[_0x6c03('0x9')](_0x6c03('0x11'),auth[_0x6c03('0xa')](),timeout('30s'),controller[_0x6c03('0x12')]);router[_0x6c03('0x13')]('/',auth[_0x6c03('0xa')](),controller[_0x6c03('0x14')]);router['post'](_0x6c03('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x6c03('0x16')](_0x6c03('0xc'),auth[_0x6c03('0xa')](),controller[_0x6c03('0x17')]);router[_0x6c03('0x18')]('/:id',auth[_0x6c03('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2d82=['./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x38b6b5,_0x3ff3bc){var _0x5599dc=function(_0x49338b){while(--_0x49338b){_0x38b6b5['push'](_0x38b6b5['shift']());}};_0x5599dc(++_0x3ff3bc);}(_0x2d82,0xb5));var _0x22d8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2d82[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x22d8('0x0'));var util=require('util');var path=require(_0x22d8('0x1'));var timeout=require(_0x22d8('0x2'));var express=require(_0x22d8('0x3'));var router=express[_0x22d8('0x4')]();var fs_extra=require(_0x22d8('0x5'));var auth=require(_0x22d8('0x6'));var interaction=require(_0x22d8('0x7'));var config=require('../../config/environment');var controller=require(_0x22d8('0x8'));router[_0x22d8('0x9')]('/',auth['isAuthenticated'](),controller[_0x22d8('0xa')]);router[_0x22d8('0x9')]('/:id',auth[_0x22d8('0xb')](),controller[_0x22d8('0xc')]);router['get'](_0x22d8('0xd'),auth[_0x22d8('0xb')](),controller[_0x22d8('0xe')]);router[_0x22d8('0x9')]('/:id/answers',auth['isAuthenticated'](),controller[_0x22d8('0xf')]);router[_0x22d8('0x9')](_0x22d8('0x10'),auth[_0x22d8('0xb')](),timeout(_0x22d8('0x11')),controller[_0x22d8('0x12')]);router[_0x22d8('0x13')]('/',auth['isAuthenticated'](),controller[_0x22d8('0x14')]);router[_0x22d8('0x13')]('/:id/clone',auth[_0x22d8('0xb')](),controller[_0x22d8('0x15')]);router[_0x22d8('0x16')]('/:id',auth[_0x22d8('0xb')](),controller[_0x22d8('0x17')]);router['delete'](_0x22d8('0x18'),auth['isAuthenticated'](),controller[_0x22d8('0x19')]);module[_0x22d8('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 ceb24f9..4c40ff0 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 _0x39fd=['name','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x4c117f,_0x51e880){var _0x49bc6e=function(_0x5eb7f3){while(--_0x5eb7f3){_0x4c117f['push'](_0x4c117f['shift']());}};_0x49bc6e(++_0x51e880);}(_0x39fd,0x69));var _0xd39f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39fd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd39f('0x0'));var _=require(_0xd39f('0x1'));var util=require(_0xd39f('0x2'));module['exports']={'name':{'type':Sequelize[_0xd39f('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd39f('0x3')]},'formData':{'type':Sequelize[_0xd39f('0x4')](_0xd39f('0x5')),'set':function(_0x5beaef){if(_[_0xd39f('0x6')](_0x5beaef)){this[_0xd39f('0x7')]('formData',JSON[_0xd39f('0x8')](_0x5beaef));}else if(_[_0xd39f('0x9')](_0x5beaef)){this[_0xd39f('0x7')](_0xd39f('0xa'),_0x5beaef);}else{this['setDataValue'](_0xd39f('0xa'),util[_0xd39f('0xb')](_0xd39f('0xc'),this[_0xd39f('0xd')](_0xd39f('0xe'))||'',this[_0xd39f('0xd')](_0xd39f('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd39f('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd39f('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xe9db=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format'];(function(_0x40920b,_0x486a1b){var _0x30bff4=function(_0x467f23){while(--_0x467f23){_0x40920b['push'](_0x40920b['shift']());}};_0x30bff4(++_0x486a1b);}(_0xe9db,0x184));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbe9d('0x0'));var _=require(_0xbe9d('0x1'));var util=require(_0xbe9d('0x2'));module[_0xbe9d('0x3')]={'name':{'type':Sequelize[_0xbe9d('0x4')],'unique':_0xbe9d('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xbe9d('0x6')](_0xbe9d('0x7')),'set':function(_0x2a3d47){if(_[_0xbe9d('0x8')](_0x2a3d47)){this[_0xbe9d('0x9')](_0xbe9d('0xa'),JSON['stringify'](_0x2a3d47));}else if(_['isString'](_0x2a3d47)){this['setDataValue'](_0xbe9d('0xa'),_0x2a3d47);}else{this[_0xbe9d('0x9')](_0xbe9d('0xa'),util[_0xbe9d('0xb')](_0xbe9d('0xc'),this['getDataValue']('name')||'',this[_0xbe9d('0xd')](_0xbe9d('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ba51b31..1d5abef 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 _0xb19a=['status','end','json','limit','undefined','count','offset','apply','reject','update','then','destroy','get','Projects','error','name','send','map','JscriptyProject','fieldName','key','model','keys','query','filters','attributes','intersection','fields','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','params','omit','createdAt','updatedAt','UserProfileResource','getSessions','hasOwnProperty','nolimit','order','ProjectId','JscriptySessionReport','findOne','JscriptyAnswerReport','length','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0xb19a,0xd0));var _0xab19=function(_0x3419cf,_0x246cee){_0x3419cf=_0x3419cf-0x0;var _0x280f37=_0xb19a[_0x3419cf];return _0x280f37;};'use strict';var emlformat=require(_0xab19('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab19('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab19('0x2'));var Mustache=require(_0xab19('0x3'));var util=require(_0xab19('0x4'));var path=require(_0xab19('0x5'));var sox=require(_0xab19('0x6'));var csv=require(_0xab19('0x7'));var ejs=require(_0xab19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab19('0x9'));var squel=require(_0xab19('0xa'));var crypto=require('crypto');var jsforce=require(_0xab19('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xab19('0x7'));var querystring=require(_0xab19('0xc'));var Papa=require(_0xab19('0xd'));var Redis=require(_0xab19('0xe'));var authService=require(_0xab19('0xf'));var qs=require(_0xab19('0x10'));var as=require(_0xab19('0x11'));var hardwareService=require(_0xab19('0x12'));var logger=require(_0xab19('0x13'))(_0xab19('0x14'));var utils=require(_0xab19('0x15'));var config=require(_0xab19('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cec9e,_0x55c2ed){_0x55c2ed=_0x55c2ed||0xcc;return function(_0x391721){if(_0x391721){return _0x2cec9e[_0xab19('0x17')](_0x55c2ed);}return _0x2cec9e[_0xab19('0x18')](_0x55c2ed)[_0xab19('0x19')]();};}function respondWithResult(_0x336470,_0x475596){_0x475596=_0x475596||0xc8;return function(_0x10fc99){if(_0x10fc99){return _0x336470['status'](_0x475596)[_0xab19('0x1a')](_0x10fc99);}};}function respondWithFilteredResult(_0x43aece,_0x581c6d){return function(_0x4257d7){if(_0x4257d7){var _0x30d3f1=typeof _0x581c6d['offset']==='undefined'&&typeof _0x581c6d[_0xab19('0x1b')]===_0xab19('0x1c');var _0x766d6=_0x4257d7[_0xab19('0x1d')];var _0x5d00db=_0x30d3f1?0x0:_0x581c6d[_0xab19('0x1e')];var _0x45d2bc=_0x30d3f1?_0x4257d7['count']:_0x581c6d[_0xab19('0x1e')]+_0x581c6d[_0xab19('0x1b')];var _0x1232cd;if(_0x45d2bc>=_0x766d6){_0x45d2bc=_0x766d6;_0x1232cd=0xc8;}else{_0x1232cd=0xce;}_0x43aece['status'](_0x1232cd);return _0x43aece['set']('Content-Range',_0x5d00db+'-'+_0x45d2bc+'/'+_0x766d6)[_0xab19('0x1a')](_0x4257d7);}return null;};}function patchUpdates(_0x4279e7){return function(_0x4d6f8c){try{jsonpatch[_0xab19('0x1f')](_0x4d6f8c,_0x4279e7,!![]);}catch(_0x5490cd){return BPromise[_0xab19('0x20')](_0x5490cd);}return _0x4d6f8c['save']();};}function saveUpdates(_0x57814e,_0x5e1d7a){return function(_0x27635c){if(_0x27635c){return _0x27635c[_0xab19('0x21')](_0x57814e)[_0xab19('0x22')](function(_0x3c86b3){return _0x3c86b3;});}return null;};}function removeEntity(_0x562df6,_0x278948){return function(_0x1685eb){if(_0x1685eb){return _0x1685eb[_0xab19('0x23')]()[_0xab19('0x22')](function(){var _0x1c1ff4=_0x1685eb[_0xab19('0x24')]({'plain':!![]});var _0x3743c7=_0xab19('0x25');return db['UserProfileResource'][_0xab19('0x23')]({'where':{'type':_0x3743c7,'resourceId':_0x1c1ff4['id']}})[_0xab19('0x22')](function(){return _0x1685eb;});})[_0xab19('0x22')](function(){_0x562df6[_0xab19('0x18')](0xcc)[_0xab19('0x19')]();});}};}function handleEntityNotFound(_0x168fa5,_0x3f4d5e){return function(_0x1538e5){if(!_0x1538e5){_0x168fa5['sendStatus'](0x194);}return _0x1538e5;};}function handleError(_0x2452c8,_0x233da0){_0x233da0=_0x233da0||0x1f4;return function(_0x5c0074){logger[_0xab19('0x26')](_0x5c0074['stack']);if(_0x5c0074[_0xab19('0x27')]){delete _0x5c0074[_0xab19('0x27')];}_0x2452c8['status'](_0x233da0)[_0xab19('0x28')](_0x5c0074);};}exports['index']=function(_0x3d67ce,_0x50e936){var _0x1dabc1={},_0x17af97={},_0x5df46c={'count':0x0,'rows':[]};var _0x18c291=_[_0xab19('0x29')](db[_0xab19('0x2a')]['rawAttributes'],function(_0xc232d3){return{'name':_0xc232d3[_0xab19('0x2b')],'type':_0xc232d3['type'][_0xab19('0x2c')]};});_0x17af97[_0xab19('0x2d')]=_[_0xab19('0x29')](_0x18c291,_0xab19('0x27'));_0x17af97['query']=_[_0xab19('0x2e')](_0x3d67ce[_0xab19('0x2f')]);_0x17af97[_0xab19('0x30')]=_['intersection'](_0x17af97['model'],_0x17af97[_0xab19('0x2f')]);_0x1dabc1[_0xab19('0x31')]=_[_0xab19('0x32')](_0x17af97['model'],qs[_0xab19('0x33')](_0x3d67ce['query'][_0xab19('0x33')]));_0x1dabc1[_0xab19('0x31')]=_0x1dabc1[_0xab19('0x31')]['length']?_0x1dabc1[_0xab19('0x31')]:_0x17af97[_0xab19('0x2d')];if(!_0x3d67ce[_0xab19('0x2f')]['hasOwnProperty']('nolimit')){_0x1dabc1[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x3d67ce[_0xab19('0x2f')][_0xab19('0x1b')]);_0x1dabc1[_0xab19('0x1e')]=qs[_0xab19('0x1e')](_0x3d67ce[_0xab19('0x2f')][_0xab19('0x1e')]);}_0x1dabc1['order']=qs['sort'](_0x3d67ce[_0xab19('0x2f')][_0xab19('0x34')]);_0x1dabc1[_0xab19('0x35')]=qs[_0xab19('0x30')](_[_0xab19('0x36')](_0x3d67ce[_0xab19('0x2f')],_0x17af97[_0xab19('0x30')]),_0x18c291);if(_0x3d67ce[_0xab19('0x2f')][_0xab19('0x37')]){_0x1dabc1[_0xab19('0x35')]=_[_0xab19('0x38')](_0x1dabc1['where'],{'$or':_[_0xab19('0x29')](_0x18c291,function(_0x5140e8){if(_0x5140e8[_0xab19('0x39')]!==_0xab19('0x3a')){var _0x14cbd5={};_0x14cbd5[_0x5140e8['name']]={'$like':'%'+_0x3d67ce[_0xab19('0x2f')][_0xab19('0x37')]+'%'};return _0x14cbd5;}})});}_0x1dabc1=_[_0xab19('0x38')]({},_0x1dabc1,_0x3d67ce[_0xab19('0x3b')]);var _0x48a038={'where':_0x1dabc1['where']};return db[_0xab19('0x2a')][_0xab19('0x1d')](_0x48a038)[_0xab19('0x22')](function(_0x445025){_0x5df46c[_0xab19('0x1d')]=_0x445025;if(_0x3d67ce[_0xab19('0x2f')][_0xab19('0x3c')]){_0x1dabc1[_0xab19('0x3d')]=[{'all':!![]}];}return db[_0xab19('0x2a')][_0xab19('0x3e')](_0x1dabc1);})[_0xab19('0x22')](function(_0x23c233){_0x5df46c[_0xab19('0x3f')]=_0x23c233;return _0x5df46c;})[_0xab19('0x22')](respondWithFilteredResult(_0x50e936,_0x1dabc1))['catch'](handleError(_0x50e936,null));};exports[_0xab19('0x40')]=function(_0x241456,_0x2173f1){var _0x309d1c={'raw':![],'where':{'id':_0x241456['params']['id']}},_0x1b094d={};_0x1b094d[_0xab19('0x2d')]=_[_0xab19('0x2e')](db[_0xab19('0x2a')][_0xab19('0x41')]);_0x1b094d['query']=_[_0xab19('0x2e')](_0x241456[_0xab19('0x2f')]);_0x1b094d[_0xab19('0x30')]=_[_0xab19('0x32')](_0x1b094d[_0xab19('0x2d')],_0x1b094d['query']);_0x309d1c['attributes']=_['intersection'](_0x1b094d[_0xab19('0x2d')],qs[_0xab19('0x33')](_0x241456[_0xab19('0x2f')][_0xab19('0x33')]));_0x309d1c[_0xab19('0x31')]=_0x309d1c['attributes']['length']?_0x309d1c['attributes']:_0x1b094d[_0xab19('0x2d')];if(_0x241456[_0xab19('0x2f')][_0xab19('0x3c')]){_0x309d1c[_0xab19('0x3d')]=[{'all':!![]}];}_0x309d1c=_[_0xab19('0x38')]({},_0x309d1c,_0x241456[_0xab19('0x3b')]);return db['JscriptyProject'][_0xab19('0x42')](_0x309d1c)[_0xab19('0x22')](handleEntityNotFound(_0x2173f1,null))[_0xab19('0x22')](respondWithResult(_0x2173f1,null))[_0xab19('0x43')](handleError(_0x2173f1,null));};exports[_0xab19('0x44')]=function(_0x495957,_0x447971){return db[_0xab19('0x2a')][_0xab19('0x44')](_0x495957[_0xab19('0x45')],{})[_0xab19('0x22')](function(_0xc518cd){var _0x2d243a=_0x495957[_0xab19('0x46')][_0xab19('0x24')]({'plain':!![]});if(!_0x2d243a)throw new Error(_0xab19('0x47'));if(_0x2d243a[_0xab19('0x48')]===_0xab19('0x46')){var _0x1bb53d=_0xc518cd[_0xab19('0x24')]({'plain':!![]});var _0x8f376a=_0xab19('0x25');return db[_0xab19('0x49')][_0xab19('0x42')]({'where':{'name':_0x8f376a,'userProfileId':_0x2d243a[_0xab19('0x4a')]},'raw':!![]})[_0xab19('0x22')](function(_0x7c0665){if(_0x7c0665&&_0x7c0665['autoAssociation']===0x0){return db['UserProfileResource'][_0xab19('0x44')]({'name':_0x1bb53d[_0xab19('0x27')],'resourceId':_0x1bb53d['id'],'type':_0x7c0665[_0xab19('0x27')],'sectionId':_0x7c0665['id']},{})[_0xab19('0x22')](function(){return _0xc518cd;});}else{return _0xc518cd;}})[_0xab19('0x43')](function(_0x2b4c1e){logger[_0xab19('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4c1e);throw _0x2b4c1e;});}return _0xc518cd;})[_0xab19('0x22')](respondWithResult(_0x447971,0xc9))[_0xab19('0x43')](handleError(_0x447971,null));};exports[_0xab19('0x4b')]=function(_0x37e884,_0x1ddfa1){var _0x9970ba={'where':{'id':_0x37e884[_0xab19('0x4c')]['id']}},_0x4e439e={};_0x4e439e['model']=_[_0xab19('0x2e')](db['JscriptyProject'][_0xab19('0x41')]);_0x9970ba[_0xab19('0x31')]=_['intersection'](_0x4e439e['model'],qs[_0xab19('0x33')](_0x37e884[_0xab19('0x2f')]['fields']));_0x9970ba[_0xab19('0x31')]=_0x9970ba[_0xab19('0x31')]['length']?_0x9970ba[_0xab19('0x31')]:_0x4e439e[_0xab19('0x2d')];if(_0x37e884[_0xab19('0x2f')][_0xab19('0x3c')]){_0x9970ba[_0xab19('0x3d')]=[{'all':!![]}];}_0x9970ba=_[_0xab19('0x38')]({},_0x9970ba,_0x37e884[_0xab19('0x3b')]);return db['JscriptyProject'][_0xab19('0x42')](_0x9970ba)[_0xab19('0x22')](handleEntityNotFound(_0x1ddfa1,null))[_0xab19('0x22')](function(_0x388072){if(_0x388072){var _0x129f28=_0x388072[_0xab19('0x24')]({'plain':!![]});_0x129f28=qs[_0xab19('0x4d')](_0x129f28,['id','createdAt','updatedAt']);_0x37e884['body']=_[_0xab19('0x4d')](_0x37e884[_0xab19('0x45')],['id',_0xab19('0x4e'),_0xab19('0x4f')]);return db[_0xab19('0x2a')][_0xab19('0x44')](_[_0xab19('0x38')](_0x129f28,_0x37e884[_0xab19('0x45')]),{'include':_0x37e884['query'][_0xab19('0x3c')]?[{'all':!![]}]:undefined})[_0xab19('0x22')](function(_0x485424){var _0xf5e31=_0x37e884[_0xab19('0x46')]['get']({'plain':!![]});if(!_0xf5e31)throw new Error(_0xab19('0x47'));if(_0xf5e31['role']==='user'){var _0x3c3b26=_0x485424['get']({'plain':!![]});var _0x241d67=_0xab19('0x25');return db[_0xab19('0x49')][_0xab19('0x42')]({'where':{'name':_0x241d67,'userProfileId':_0xf5e31[_0xab19('0x4a')]},'raw':!![]})['then'](function(_0x548445){if(_0x548445&&_0x548445['autoAssociation']===0x0){return db[_0xab19('0x50')][_0xab19('0x44')]({'name':_0x3c3b26[_0xab19('0x27')],'resourceId':_0x3c3b26['id'],'type':_0x548445[_0xab19('0x27')],'sectionId':_0x548445['id']},{})[_0xab19('0x22')](function(){return _0x485424;});}else{return _0x485424;}})['catch'](function(_0x488e98){logger[_0xab19('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x488e98);throw _0x488e98;});}return _0x485424;});}})[_0xab19('0x22')](respondWithResult(_0x1ddfa1,0xc9))[_0xab19('0x43')](handleError(_0x1ddfa1,null));};exports[_0xab19('0x21')]=function(_0x10ad3e,_0x4f5467){if(_0x10ad3e[_0xab19('0x45')]['id']){delete _0x10ad3e[_0xab19('0x45')]['id'];}return db['JscriptyProject'][_0xab19('0x42')]({'where':{'id':_0x10ad3e[_0xab19('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f5467,null))[_0xab19('0x22')](saveUpdates(_0x10ad3e[_0xab19('0x45')],null))[_0xab19('0x22')](respondWithResult(_0x4f5467,null))[_0xab19('0x43')](handleError(_0x4f5467,null));};exports[_0xab19('0x23')]=function(_0x5e07c8,_0x1f73fd){return db[_0xab19('0x2a')][_0xab19('0x42')]({'where':{'id':_0x5e07c8[_0xab19('0x4c')]['id']}})[_0xab19('0x22')](handleEntityNotFound(_0x1f73fd,null))['then'](removeEntity(_0x1f73fd,null))['catch'](handleError(_0x1f73fd,null));};exports[_0xab19('0x51')]=function(_0x15cc96,_0x41080b,_0x2df4e7){var _0x241fef={'raw':!![],'where':{}};var _0x13bd35={};var _0x2fb03d={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x15cc96['params']['id']}})[_0xab19('0x22')](handleEntityNotFound(_0x41080b,null))[_0xab19('0x22')](function(_0x5dfa02){if(_0x5dfa02){_0x13bd35['model']=_[_0xab19('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x13bd35[_0xab19('0x2f')]=_[_0xab19('0x2e')](_0x15cc96[_0xab19('0x2f')]);_0x13bd35[_0xab19('0x30')]=_[_0xab19('0x32')](_0x13bd35[_0xab19('0x2d')],_0x13bd35[_0xab19('0x2f')]);_0x241fef[_0xab19('0x31')]=_[_0xab19('0x32')](_0x13bd35[_0xab19('0x2d')],qs[_0xab19('0x33')](_0x15cc96[_0xab19('0x2f')]['fields']));_0x241fef[_0xab19('0x31')]=_0x241fef[_0xab19('0x31')]['length']?_0x241fef[_0xab19('0x31')]:_0x13bd35[_0xab19('0x2d')];if(!_0x15cc96[_0xab19('0x2f')][_0xab19('0x52')](_0xab19('0x53'))){_0x241fef[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x15cc96[_0xab19('0x2f')][_0xab19('0x1b')]);_0x241fef[_0xab19('0x1e')]=qs[_0xab19('0x1e')](_0x15cc96[_0xab19('0x2f')][_0xab19('0x1e')]);}_0x241fef[_0xab19('0x54')]=qs[_0xab19('0x34')](_0x15cc96['query'][_0xab19('0x34')]);_0x241fef[_0xab19('0x35')]=qs[_0xab19('0x30')](_[_0xab19('0x36')](_0x15cc96[_0xab19('0x2f')],_0x13bd35[_0xab19('0x30')]));_0x241fef['where'][_0xab19('0x55')]=_0x5dfa02['id'];if(_0x15cc96[_0xab19('0x2f')]['filter']){_0x241fef[_0xab19('0x35')]=_[_0xab19('0x38')](_0x241fef[_0xab19('0x35')],{'$or':_[_0xab19('0x29')](_0x241fef[_0xab19('0x31')],function(_0x370873){var _0x4f9de0={};_0x4f9de0[_0x370873]={'$like':'%'+_0x15cc96[_0xab19('0x2f')][_0xab19('0x37')]+'%'};return _0x4f9de0;})});}_0x241fef=_[_0xab19('0x38')]({},_0x241fef,_0x15cc96[_0xab19('0x3b')]);return db[_0xab19('0x56')][_0xab19('0x1d')]({'where':_0x241fef['where']})[_0xab19('0x22')](function(_0x5ac17c){_0x2fb03d['count']=_0x5ac17c;if(_0x15cc96[_0xab19('0x2f')][_0xab19('0x3c')]){_0x241fef[_0xab19('0x3d')]=[{'all':!![]}];}return db[_0xab19('0x56')][_0xab19('0x3e')](_0x241fef);})[_0xab19('0x22')](function(_0x174817){_0x2fb03d[_0xab19('0x3f')]=_0x174817;return _0x2fb03d;});}})['then'](respondWithFilteredResult(_0x41080b,_0x241fef))[_0xab19('0x43')](handleError(_0x41080b,null));};exports['getAnswers']=function(_0x108169,_0x5a0917,_0x52de2a){var _0x2c105f={'raw':!![],'where':{}};var _0x5a7da7={};var _0x4d5467={'count':0x0,'rows':[]};return db[_0xab19('0x2a')][_0xab19('0x57')]({'where':{'id':_0x108169['params']['id']}})[_0xab19('0x22')](handleEntityNotFound(_0x5a0917,null))[_0xab19('0x22')](function(_0x5ca7a2){if(_0x5ca7a2){_0x5a7da7[_0xab19('0x2d')]=_[_0xab19('0x2e')](db[_0xab19('0x58')][_0xab19('0x41')]);_0x5a7da7[_0xab19('0x2f')]=_[_0xab19('0x2e')](_0x108169[_0xab19('0x2f')]);_0x5a7da7['filters']=_[_0xab19('0x32')](_0x5a7da7[_0xab19('0x2d')],_0x5a7da7[_0xab19('0x2f')]);_0x2c105f['attributes']=_[_0xab19('0x32')](_0x5a7da7['model'],qs[_0xab19('0x33')](_0x108169['query'][_0xab19('0x33')]));_0x2c105f[_0xab19('0x31')]=_0x2c105f[_0xab19('0x31')][_0xab19('0x59')]?_0x2c105f['attributes']:_0x5a7da7['model'];if(!_0x108169[_0xab19('0x2f')][_0xab19('0x52')](_0xab19('0x53'))){_0x2c105f[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x108169[_0xab19('0x2f')][_0xab19('0x1b')]);_0x2c105f[_0xab19('0x1e')]=qs[_0xab19('0x1e')](_0x108169[_0xab19('0x2f')]['offset']);}_0x2c105f[_0xab19('0x54')]=qs[_0xab19('0x34')](_0x108169['query'][_0xab19('0x34')]);_0x2c105f[_0xab19('0x35')]=qs[_0xab19('0x30')](_[_0xab19('0x36')](_0x108169[_0xab19('0x2f')],_0x5a7da7['filters']));_0x2c105f[_0xab19('0x35')][_0xab19('0x55')]=_0x5ca7a2['id'];if(_0x108169[_0xab19('0x2f')][_0xab19('0x37')]){_0x2c105f[_0xab19('0x35')]=_['merge'](_0x2c105f['where'],{'$or':_['map'](_0x2c105f[_0xab19('0x31')],function(_0x1f9568){var _0x17f7a3={};_0x17f7a3[_0x1f9568]={'$like':'%'+_0x108169[_0xab19('0x2f')][_0xab19('0x37')]+'%'};return _0x17f7a3;})});}_0x2c105f=_['merge']({},_0x2c105f,_0x108169[_0xab19('0x3b')]);return db[_0xab19('0x58')][_0xab19('0x1d')]({'where':_0x2c105f[_0xab19('0x35')]})[_0xab19('0x22')](function(_0x33ae7a){_0x4d5467['count']=_0x33ae7a;if(_0x108169['query']['includeAll']){_0x2c105f[_0xab19('0x3d')]=[{'all':!![]}];}return db[_0xab19('0x58')][_0xab19('0x3e')](_0x2c105f);})[_0xab19('0x22')](function(_0x3b75c0){_0x4d5467[_0xab19('0x3f')]=_0x3b75c0;return _0x4d5467;});}})[_0xab19('0x22')](respondWithFilteredResult(_0x5a0917,_0x2c105f))[_0xab19('0x43')](handleError(_0x5a0917,null));};function char(_0x1d2b59){return _0xab19('0x5a')===typeof _0x1d2b59?String[_0xab19('0x5b')][_0xab19('0x1f')](null,arguments):_0x1d2b59;}function needsEncapsulation(_0x84b161){return!!_0x84b161&&(_0x84b161[_0xab19('0x5c')]()[_0xab19('0x5d')](char(0xd))>=0x0||_0x84b161[_0xab19('0x5c')]()[_0xab19('0x5d')](char(0xa))>=0x0||_0x84b161[_0xab19('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x84b161[_0xab19('0x5c')]()[_0xab19('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x5be463){var _0x21d276=char(0x22),_0xeccbd8='\x5c'+char(0x22),_0xdb9acc=_0x5be463['toString']()[_0xab19('0x5e')](new RegExp(_0x21d276,'g'),_0xeccbd8);return _0x21d276+_0xdb9acc+_0x21d276;}exports[_0xab19('0x5f')]=function(_0xe59ab4,_0x3c27bb,_0x2ca568){var _0x3d8378,_0x38224;var _0x18627f={'where':{'ProjectId':_0xe59ab4[_0xab19('0x4c')]['id']}};if(_0xe59ab4[_0xab19('0x2f')]['startTime']){_0x18627f[_0xab19('0x35')][_0xab19('0x60')]=JSON[_0xab19('0x61')](_0xe59ab4[_0xab19('0x2f')][_0xab19('0x62')]);}return db[_0xab19('0x56')][_0xab19('0x3e')](_0x18627f)['then'](handleEntityNotFound(_0x3c27bb,null))['then'](function(_0x3311aa){if(_0x3311aa){_0x3d8378=_0x3311aa;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xab19('0x29')](_0x3d8378,'id')},'ProjectId':_0xe59ab4['params']['id']},'order':_0xab19('0x63')});}})[_0xab19('0x22')](handleEntityNotFound(_0x3c27bb,null))[_0xab19('0x22')](function(_0x40883f){if(_0x40883f){_0x38224=_0x40883f;var _0x4d6583={};for(var _0xbd4f33=0x0,_0x1195ab=_0x38224['length'];_0xbd4f33<_0x1195ab;_0xbd4f33++){if(!_0x4d6583['hasOwnProperty'](_0x38224[_0xbd4f33][_0xab19('0x64')])){_0x4d6583[_0x38224[_0xbd4f33][_0xab19('0x64')]]=needsEncapsulation(_0x38224[_0xbd4f33][_0xab19('0x65')])?encapsulate(_0x38224[_0xbd4f33]['question']):_0x38224[_0xbd4f33][_0xab19('0x65')];}}var _0x5bad8c=[],_0x32b2bf={};for(var _0x3ad541=0x0,_0x34ce44=_0x3d8378[_0xab19('0x59')];_0x3ad541<_0x34ce44;_0x3ad541++){_0x32b2bf={'ProjectId':_0xe59ab4[_0xab19('0x4c')]['id'],'SessionId':_0x3d8378[_0x3ad541]['id'],'StartTime':moment(_0x3d8378[_0x3ad541][_0xab19('0x60')])[_0xab19('0x66')](_0xab19('0x67'))};for(var _0x1312f2=0x0,_0x524ce2=_0x38224['length'];_0x1312f2<_0x524ce2;_0x1312f2++){if(_0x38224[_0x1312f2][_0xab19('0x68')]==_0x3d8378[_0x3ad541]['id']&&_0x4d6583[_0xab19('0x52')](_0x38224[_0x1312f2]['questionId'])){_0x32b2bf[_0x4d6583[_0x38224[_0x1312f2]['questionId']]]=_0x38224[_0x1312f2][_0xab19('0x69')];}}for(var _0x3e493e in _0x4d6583){if(!_0x32b2bf['hasOwnProperty'](_0x4d6583[_0x3e493e])){_0x32b2bf[_0x4d6583[_0x3e493e]]=null;}}_0x5bad8c[_0xab19('0x6a')](_0x32b2bf);}return _0x5bad8c;}})[_0xab19('0x22')](function(_0xa88a89){if(!_[_0xab19('0x6b')](_0xa88a89)){var _0x1c239f=toCsv(_0xa88a89);var _0x534ced=Date[_0xab19('0x6c')]();fs[_0xab19('0x6d')](util[_0xab19('0x66')](_0xab19('0x6e'),_0xe59ab4[_0xab19('0x4c')]['id'],_0x534ced),_0x1c239f);_0x3c27bb[_0xab19('0x6f')](_0xab19('0x70'),_0xab19('0x71')+util[_0xab19('0x66')](_0xab19('0x72'),_0xe59ab4[_0xab19('0x4c')]['id'],_0x534ced));_0x3c27bb[_0xab19('0x6f')](_0xab19('0x73'),'text/csv');return _0x3c27bb['download'](util[_0xab19('0x66')](_0xab19('0x6e'),_0xe59ab4[_0xab19('0x4c')]['id'],_0x534ced));}else{return _0x3c27bb['sendStatus'](0xcc);}})[_0xab19('0x43')](handleError(_0x3c27bb,null));}; \ No newline at end of file +var _0xd61e=['json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyProject','findAll','catch','show','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','omit','createdAt','updatedAt','userProfileId','UserProfileResource','update','getSessions','findOne','JscriptySessionReport','rawAttributes','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','sendStatus','end','status'];(function(_0x331cec,_0x3dedc){var _0x111108=function(_0x317d13){while(--_0x317d13){_0x331cec['push'](_0x331cec['shift']());}};_0x111108(++_0x3dedc);}(_0xd61e,0x13d));var _0xed61=function(_0x3e252e,_0x475a28){_0x3e252e=_0x3e252e-0x0;var _0x22977a=_0xd61e[_0x3e252e];return _0x22977a;};'use strict';var emlformat=require(_0xed61('0x0'));var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require(_0xed61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require(_0xed61('0xa'));var ejs=require(_0xed61('0xb'));var fs=require('fs');var fs_extra=require(_0xed61('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed61('0xa'));var querystring=require(_0xed61('0xd'));var Papa=require(_0xed61('0xe'));var Redis=require(_0xed61('0xf'));var authService=require(_0xed61('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed61('0x11'))(_0xed61('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeedb63,_0x21511d){_0x21511d=_0x21511d||0xcc;return function(_0x19c74c){if(_0x19c74c){return _0xeedb63[_0xed61('0x13')](_0x21511d);}return _0xeedb63['status'](_0x21511d)[_0xed61('0x14')]();};}function respondWithResult(_0x28f4cb,_0xe08d33){_0xe08d33=_0xe08d33||0xc8;return function(_0x4ac6e2){if(_0x4ac6e2){return _0x28f4cb[_0xed61('0x15')](_0xe08d33)[_0xed61('0x16')](_0x4ac6e2);}};}function respondWithFilteredResult(_0x16fa20,_0x2ad52a){return function(_0x4d3930){if(_0x4d3930){var _0x15198a=typeof _0x2ad52a[_0xed61('0x17')]===_0xed61('0x18')&&typeof _0x2ad52a[_0xed61('0x19')]==='undefined';var _0x39b1d1=_0x4d3930[_0xed61('0x1a')];var _0x4bd841=_0x15198a?0x0:_0x2ad52a[_0xed61('0x17')];var _0x11a277=_0x15198a?_0x4d3930[_0xed61('0x1a')]:_0x2ad52a['offset']+_0x2ad52a[_0xed61('0x19')];var _0xb7879f;if(_0x11a277>=_0x39b1d1){_0x11a277=_0x39b1d1;_0xb7879f=0xc8;}else{_0xb7879f=0xce;}_0x16fa20[_0xed61('0x15')](_0xb7879f);return _0x16fa20['set'](_0xed61('0x1b'),_0x4bd841+'-'+_0x11a277+'/'+_0x39b1d1)[_0xed61('0x16')](_0x4d3930);}return null;};}function patchUpdates(_0xce408c){return function(_0x5ee0b9){try{jsonpatch[_0xed61('0x1c')](_0x5ee0b9,_0xce408c,!![]);}catch(_0x16d63a){return BPromise['reject'](_0x16d63a);}return _0x5ee0b9[_0xed61('0x1d')]();};}function saveUpdates(_0x315020,_0x864dfa){return function(_0x5f3d0f){if(_0x5f3d0f){return _0x5f3d0f['update'](_0x315020)[_0xed61('0x1e')](function(_0x544d49){return _0x544d49;});}return null;};}function removeEntity(_0xa17a06,_0x217e93){return function(_0x2722d0){if(_0x2722d0){return _0x2722d0[_0xed61('0x1f')]()[_0xed61('0x1e')](function(){var _0x5a71f0=_0x2722d0['get']({'plain':!![]});var _0x4a3e02='Projects';return db['UserProfileResource'][_0xed61('0x1f')]({'where':{'type':_0x4a3e02,'resourceId':_0x5a71f0['id']}})['then'](function(){return _0x2722d0;});})[_0xed61('0x1e')](function(){_0xa17a06[_0xed61('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x503bc7,_0x14d140){return function(_0xca7c0c){if(!_0xca7c0c){_0x503bc7[_0xed61('0x13')](0x194);}return _0xca7c0c;};}function handleError(_0x5b83b2,_0x20de9b){_0x20de9b=_0x20de9b||0x1f4;return function(_0xd809ce){logger[_0xed61('0x20')](_0xd809ce['stack']);if(_0xd809ce[_0xed61('0x21')]){delete _0xd809ce['name'];}_0x5b83b2[_0xed61('0x15')](_0x20de9b)[_0xed61('0x22')](_0xd809ce);};}exports[_0xed61('0x23')]=function(_0x50b19d,_0x260ac4){var _0xa5a8aa={},_0x2f23d5={},_0x690795={'count':0x0,'rows':[]};var _0x4b1294=_[_0xed61('0x24')](db['JscriptyProject']['rawAttributes'],function(_0x2df5b6){return{'name':_0x2df5b6[_0xed61('0x25')],'type':_0x2df5b6[_0xed61('0x26')][_0xed61('0x27')]};});_0x2f23d5['model']=_['map'](_0x4b1294,_0xed61('0x21'));_0x2f23d5[_0xed61('0x28')]=_[_0xed61('0x29')](_0x50b19d[_0xed61('0x28')]);_0x2f23d5[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2f23d5[_0xed61('0x2c')],_0x2f23d5['query']);_0xa5a8aa['attributes']=_[_0xed61('0x2b')](_0x2f23d5['model'],qs[_0xed61('0x2d')](_0x50b19d['query']['fields']));_0xa5a8aa['attributes']=_0xa5a8aa['attributes']['length']?_0xa5a8aa[_0xed61('0x2e')]:_0x2f23d5[_0xed61('0x2c')];if(!_0x50b19d[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0xa5a8aa[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x50b19d[_0xed61('0x28')]['limit']);_0xa5a8aa['offset']=qs[_0xed61('0x17')](_0x50b19d[_0xed61('0x28')][_0xed61('0x17')]);}_0xa5a8aa[_0xed61('0x31')]=qs['sort'](_0x50b19d[_0xed61('0x28')][_0xed61('0x32')]);_0xa5a8aa['where']=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x50b19d[_0xed61('0x28')],_0x2f23d5[_0xed61('0x2a')]),_0x4b1294);if(_0x50b19d['query'][_0xed61('0x34')]){_0xa5a8aa[_0xed61('0x35')]=_[_0xed61('0x36')](_0xa5a8aa[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x4b1294,function(_0x23d66d){if(_0x23d66d[_0xed61('0x26')]!=='VIRTUAL'){var _0x3abfa6={};_0x3abfa6[_0x23d66d[_0xed61('0x21')]]={'$like':'%'+_0x50b19d[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x3abfa6;}})});}_0xa5a8aa=_[_0xed61('0x36')]({},_0xa5a8aa,_0x50b19d[_0xed61('0x37')]);var _0x35ad22={'where':_0xa5a8aa[_0xed61('0x35')]};return db[_0xed61('0x38')][_0xed61('0x1a')](_0x35ad22)[_0xed61('0x1e')](function(_0x16720e){_0x690795[_0xed61('0x1a')]=_0x16720e;if(_0x50b19d[_0xed61('0x28')]['includeAll']){_0xa5a8aa['include']=[{'all':!![]}];}return db[_0xed61('0x38')][_0xed61('0x39')](_0xa5a8aa);})['then'](function(_0x5b9bef){_0x690795['rows']=_0x5b9bef;return _0x690795;})['then'](respondWithFilteredResult(_0x260ac4,_0xa5a8aa))[_0xed61('0x3a')](handleError(_0x260ac4,null));};exports[_0xed61('0x3b')]=function(_0xd92795,_0x16ac3f){var _0x434384={'raw':![],'where':{'id':_0xd92795['params']['id']}},_0x41e094={};_0x41e094[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x38')]['rawAttributes']);_0x41e094[_0xed61('0x28')]=_[_0xed61('0x29')](_0xd92795[_0xed61('0x28')]);_0x41e094[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x41e094['model'],_0x41e094['query']);_0x434384[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x41e094[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0xd92795['query'][_0xed61('0x2d')]));_0x434384[_0xed61('0x2e')]=_0x434384[_0xed61('0x2e')]['length']?_0x434384[_0xed61('0x2e')]:_0x41e094[_0xed61('0x2c')];if(_0xd92795['query'][_0xed61('0x3c')]){_0x434384[_0xed61('0x3d')]=[{'all':!![]}];}_0x434384=_[_0xed61('0x36')]({},_0x434384,_0xd92795[_0xed61('0x37')]);return db[_0xed61('0x38')][_0xed61('0x3e')](_0x434384)[_0xed61('0x1e')](handleEntityNotFound(_0x16ac3f,null))[_0xed61('0x1e')](respondWithResult(_0x16ac3f,null))[_0xed61('0x3a')](handleError(_0x16ac3f,null));};exports[_0xed61('0x3f')]=function(_0x2bf758,_0x3a6693){return db[_0xed61('0x38')][_0xed61('0x3f')](_0x2bf758[_0xed61('0x40')],{})[_0xed61('0x1e')](function(_0x38059f){var _0x43031b=_0x2bf758[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0x43031b)throw new Error(_0xed61('0x43'));if(_0x43031b[_0xed61('0x44')]===_0xed61('0x41')){var _0x4908f3=_0x38059f['get']({'plain':!![]});var _0x28950f=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x28950f,'userProfileId':_0x43031b['userProfileId']},'raw':!![]})[_0xed61('0x1e')](function(_0x3ec791){if(_0x3ec791&&_0x3ec791[_0xed61('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x4908f3['name'],'resourceId':_0x4908f3['id'],'type':_0x3ec791[_0xed61('0x21')],'sectionId':_0x3ec791['id']},{})[_0xed61('0x1e')](function(){return _0x38059f;});}else{return _0x38059f;}})[_0xed61('0x3a')](function(_0x1d3b9d){logger[_0xed61('0x20')](_0xed61('0x48'),_0x1d3b9d);throw _0x1d3b9d;});}return _0x38059f;})[_0xed61('0x1e')](respondWithResult(_0x3a6693,0xc9))[_0xed61('0x3a')](handleError(_0x3a6693,null));};exports['clone']=function(_0x2bb9b9,_0x258a40){var _0x4c1762={'where':{'id':_0x2bb9b9[_0xed61('0x49')]['id']}},_0x116eea={};_0x116eea[_0xed61('0x2c')]=_['keys'](db[_0xed61('0x38')]['rawAttributes']);_0x4c1762[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x116eea[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x2bb9b9[_0xed61('0x28')][_0xed61('0x2d')]));_0x4c1762[_0xed61('0x2e')]=_0x4c1762['attributes'][_0xed61('0x4a')]?_0x4c1762[_0xed61('0x2e')]:_0x116eea[_0xed61('0x2c')];if(_0x2bb9b9[_0xed61('0x28')][_0xed61('0x3c')]){_0x4c1762[_0xed61('0x3d')]=[{'all':!![]}];}_0x4c1762=_['merge']({},_0x4c1762,_0x2bb9b9[_0xed61('0x37')]);return db['JscriptyProject'][_0xed61('0x3e')](_0x4c1762)['then'](handleEntityNotFound(_0x258a40,null))[_0xed61('0x1e')](function(_0x44588a){if(_0x44588a){var _0x591909=_0x44588a[_0xed61('0x42')]({'plain':!![]});_0x591909=qs[_0xed61('0x4b')](_0x591909,['id',_0xed61('0x4c'),_0xed61('0x4d')]);_0x2bb9b9[_0xed61('0x40')]=_['omit'](_0x2bb9b9[_0xed61('0x40')],['id',_0xed61('0x4c'),_0xed61('0x4d')]);return db[_0xed61('0x38')][_0xed61('0x3f')](_[_0xed61('0x36')](_0x591909,_0x2bb9b9[_0xed61('0x40')]),{'include':_0x2bb9b9['query']['includeAll']?[{'all':!![]}]:undefined})[_0xed61('0x1e')](function(_0x4729f3){var _0xcd868e=_0x2bb9b9[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0xcd868e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcd868e[_0xed61('0x44')]===_0xed61('0x41')){var _0x4efb8f=_0x4729f3['get']({'plain':!![]});var _0x22f3d1=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x22f3d1,'userProfileId':_0xcd868e[_0xed61('0x4e')]},'raw':!![]})['then'](function(_0x55ef0b){if(_0x55ef0b&&_0x55ef0b[_0xed61('0x47')]===0x0){return db[_0xed61('0x4f')][_0xed61('0x3f')]({'name':_0x4efb8f[_0xed61('0x21')],'resourceId':_0x4efb8f['id'],'type':_0x55ef0b[_0xed61('0x21')],'sectionId':_0x55ef0b['id']},{})[_0xed61('0x1e')](function(){return _0x4729f3;});}else{return _0x4729f3;}})[_0xed61('0x3a')](function(_0x2882a0){logger[_0xed61('0x20')](_0xed61('0x48'),_0x2882a0);throw _0x2882a0;});}return _0x4729f3;});}})['then'](respondWithResult(_0x258a40,0xc9))[_0xed61('0x3a')](handleError(_0x258a40,null));};exports[_0xed61('0x50')]=function(_0x5aeffd,_0x298a12){if(_0x5aeffd[_0xed61('0x40')]['id']){delete _0x5aeffd[_0xed61('0x40')]['id'];}return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5aeffd['params']['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x298a12,null))['then'](saveUpdates(_0x5aeffd['body'],null))[_0xed61('0x1e')](respondWithResult(_0x298a12,null))[_0xed61('0x3a')](handleError(_0x298a12,null));};exports[_0xed61('0x1f')]=function(_0x5e862d,_0x1dc280){return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5e862d[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x1dc280,null))['then'](removeEntity(_0x1dc280,null))['catch'](handleError(_0x1dc280,null));};exports[_0xed61('0x51')]=function(_0x32f435,_0xb952c,_0x21ab9c){var _0x32db02={'raw':!![],'where':{}};var _0x5d5d15={};var _0xe89a4={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x32f435[_0xed61('0x49')]['id']}})['then'](handleEntityNotFound(_0xb952c,null))[_0xed61('0x1e')](function(_0x2efa4a){if(_0x2efa4a){_0x5d5d15['model']=_[_0xed61('0x29')](db[_0xed61('0x53')][_0xed61('0x54')]);_0x5d5d15[_0xed61('0x28')]=_[_0xed61('0x29')](_0x32f435[_0xed61('0x28')]);_0x5d5d15[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x5d5d15[_0xed61('0x2c')],_0x5d5d15[_0xed61('0x28')]);_0x32db02['attributes']=_['intersection'](_0x5d5d15[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x32f435[_0xed61('0x28')]['fields']));_0x32db02['attributes']=_0x32db02[_0xed61('0x2e')][_0xed61('0x4a')]?_0x32db02[_0xed61('0x2e')]:_0x5d5d15[_0xed61('0x2c')];if(!_0x32f435[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x32db02[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x32f435['query'][_0xed61('0x19')]);_0x32db02[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x32f435[_0xed61('0x28')][_0xed61('0x17')]);}_0x32db02[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x32f435[_0xed61('0x28')]['sort']);_0x32db02[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x32f435[_0xed61('0x28')],_0x5d5d15[_0xed61('0x2a')]));_0x32db02[_0xed61('0x35')][_0xed61('0x55')]=_0x2efa4a['id'];if(_0x32f435[_0xed61('0x28')][_0xed61('0x34')]){_0x32db02[_0xed61('0x35')]=_[_0xed61('0x36')](_0x32db02[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x32db02[_0xed61('0x2e')],function(_0x11af28){var _0x56d2c2={};_0x56d2c2[_0x11af28]={'$like':'%'+_0x32f435[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x56d2c2;})});}_0x32db02=_[_0xed61('0x36')]({},_0x32db02,_0x32f435[_0xed61('0x37')]);return db[_0xed61('0x53')][_0xed61('0x1a')]({'where':_0x32db02['where']})[_0xed61('0x1e')](function(_0x2cfcad){_0xe89a4[_0xed61('0x1a')]=_0x2cfcad;if(_0x32f435[_0xed61('0x28')][_0xed61('0x3c')]){_0x32db02[_0xed61('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xed61('0x39')](_0x32db02);})['then'](function(_0x2a67f3){_0xe89a4[_0xed61('0x56')]=_0x2a67f3;return _0xe89a4;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0xb952c,_0x32db02))['catch'](handleError(_0xb952c,null));};exports[_0xed61('0x57')]=function(_0x5f1c64,_0x4fe78d,_0x1b1140){var _0x1dc2a5={'raw':!![],'where':{}};var _0x2d2037={};var _0x3dfa42={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x5f1c64[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x4fe78d,null))[_0xed61('0x1e')](function(_0x23d06d){if(_0x23d06d){_0x2d2037[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x58')][_0xed61('0x54')]);_0x2d2037[_0xed61('0x28')]=_[_0xed61('0x29')](_0x5f1c64[_0xed61('0x28')]);_0x2d2037[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2d2037[_0xed61('0x2c')],_0x2d2037[_0xed61('0x28')]);_0x1dc2a5[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x2d2037['model'],qs['fields'](_0x5f1c64['query'][_0xed61('0x2d')]));_0x1dc2a5[_0xed61('0x2e')]=_0x1dc2a5['attributes'][_0xed61('0x4a')]?_0x1dc2a5[_0xed61('0x2e')]:_0x2d2037[_0xed61('0x2c')];if(!_0x5f1c64[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x1dc2a5[_0xed61('0x19')]=qs['limit'](_0x5f1c64[_0xed61('0x28')][_0xed61('0x19')]);_0x1dc2a5[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x5f1c64[_0xed61('0x28')][_0xed61('0x17')]);}_0x1dc2a5[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x5f1c64[_0xed61('0x28')]['sort']);_0x1dc2a5[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x5f1c64[_0xed61('0x28')],_0x2d2037[_0xed61('0x2a')]));_0x1dc2a5[_0xed61('0x35')]['ProjectId']=_0x23d06d['id'];if(_0x5f1c64['query']['filter']){_0x1dc2a5[_0xed61('0x35')]=_['merge'](_0x1dc2a5['where'],{'$or':_[_0xed61('0x24')](_0x1dc2a5['attributes'],function(_0x16ebc7){var _0x1cbabc={};_0x1cbabc[_0x16ebc7]={'$like':'%'+_0x5f1c64[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x1cbabc;})});}_0x1dc2a5=_[_0xed61('0x36')]({},_0x1dc2a5,_0x5f1c64[_0xed61('0x37')]);return db[_0xed61('0x58')]['count']({'where':_0x1dc2a5[_0xed61('0x35')]})[_0xed61('0x1e')](function(_0xe42f6){_0x3dfa42['count']=_0xe42f6;if(_0x5f1c64[_0xed61('0x28')][_0xed61('0x3c')]){_0x1dc2a5[_0xed61('0x3d')]=[{'all':!![]}];}return db[_0xed61('0x58')][_0xed61('0x39')](_0x1dc2a5);})[_0xed61('0x1e')](function(_0x320285){_0x3dfa42[_0xed61('0x56')]=_0x320285;return _0x3dfa42;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0x4fe78d,_0x1dc2a5))[_0xed61('0x3a')](handleError(_0x4fe78d,null));};function char(_0xe8e904){return _0xed61('0x59')===typeof _0xe8e904?String[_0xed61('0x5a')][_0xed61('0x1c')](null,arguments):_0xe8e904;}function needsEncapsulation(_0x1a7f79){return!!_0x1a7f79&&(_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x2c))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x22a64a){var _0x5a74c5=char(0x22),_0x20aec3='\x5c'+char(0x22),_0x5eef48=_0x22a64a[_0xed61('0x5b')]()[_0xed61('0x5d')](new RegExp(_0x5a74c5,'g'),_0x20aec3);return _0x5a74c5+_0x5eef48+_0x5a74c5;}exports[_0xed61('0x5e')]=function(_0xe460f9,_0x32a763,_0x1cf2d9){var _0x351241,_0x508ed0;var _0x3c600a={'where':{'ProjectId':_0xe460f9[_0xed61('0x49')]['id']}};if(_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]){_0x3c600a['where']['starttime']=JSON['parse'](_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]);}return db['JscriptySessionReport']['findAll'](_0x3c600a)[_0xed61('0x1e')](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313de){if(_0x4313de){_0x351241=_0x4313de;return db[_0xed61('0x60')][_0xed61('0x39')]({'where':{'SessionId':{'$in':_[_0xed61('0x24')](_0x351241,'id')},'ProjectId':_0xe460f9[_0xed61('0x49')]['id']},'order':_0xed61('0x61')});}})['then'](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313d2){if(_0x4313d2){_0x508ed0=_0x4313d2;var _0x3f7eb1={};for(var _0x416931=0x0,_0x399f30=_0x508ed0['length'];_0x416931<_0x399f30;_0x416931++){if(!_0x3f7eb1['hasOwnProperty'](_0x508ed0[_0x416931]['questionId'])){_0x3f7eb1[_0x508ed0[_0x416931][_0xed61('0x62')]]=needsEncapsulation(_0x508ed0[_0x416931][_0xed61('0x63')])?encapsulate(_0x508ed0[_0x416931][_0xed61('0x63')]):_0x508ed0[_0x416931]['question'];}}var _0x499015=[],_0x10860e={};for(var _0x14a0e5=0x0,_0x1f07fd=_0x351241[_0xed61('0x4a')];_0x14a0e5<_0x1f07fd;_0x14a0e5++){_0x10860e={'ProjectId':_0xe460f9[_0xed61('0x49')]['id'],'SessionId':_0x351241[_0x14a0e5]['id'],'StartTime':moment(_0x351241[_0x14a0e5][_0xed61('0x64')])[_0xed61('0x65')](_0xed61('0x66'))};for(var _0x4f66e6=0x0,_0x47483f=_0x508ed0[_0xed61('0x4a')];_0x4f66e6<_0x47483f;_0x4f66e6++){if(_0x508ed0[_0x4f66e6][_0xed61('0x67')]==_0x351241[_0x14a0e5]['id']&&_0x3f7eb1[_0xed61('0x2f')](_0x508ed0[_0x4f66e6]['questionId'])){_0x10860e[_0x3f7eb1[_0x508ed0[_0x4f66e6][_0xed61('0x62')]]]=_0x508ed0[_0x4f66e6][_0xed61('0x68')];}}for(var _0x5a065c in _0x3f7eb1){if(!_0x10860e[_0xed61('0x2f')](_0x3f7eb1[_0x5a065c])){_0x10860e[_0x3f7eb1[_0x5a065c]]=null;}}_0x499015[_0xed61('0x69')](_0x10860e);}return _0x499015;}})[_0xed61('0x1e')](function(_0x1cd9b9){if(!_[_0xed61('0x6a')](_0x1cd9b9)){var _0x7c4425=toCsv(_0x1cd9b9);var _0xd7ae25=Date[_0xed61('0x6b')]();fs[_0xed61('0x6c')](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25),_0x7c4425);_0x32a763[_0xed61('0x6e')](_0xed61('0x6f'),_0xed61('0x70')+util[_0xed61('0x65')]('Jscripty_Project_%d_Summary_%s.csv',_0xe460f9['params']['id'],_0xd7ae25));_0x32a763[_0xed61('0x6e')]('Content-type','text/csv');return _0x32a763['download'](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25));}else{return _0x32a763[_0xed61('0x13')](0xcc);}})[_0xed61('0x3a')](handleError(_0x32a763,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a026596..58033a0 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 _0xf360=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf360,0x9e));var _0x0f36=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf360[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require(_0x0f36('0x2'))('api');var moment=require(_0x0f36('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f36('0x4'));var fs=require('fs');var path=require(_0x0f36('0x5'));var rimraf=require(_0x0f36('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f36('0x7'));module[_0x0f36('0x8')]=function(_0x13d262,_0x110709){return _0x13d262[_0x0f36('0x9')](_0x0f36('0xa'),attributes,{'tableName':_0x0f36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b69=['../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0xe64d65,_0xc44934){var _0x2fe669=function(_0x5637ac){while(--_0x5637ac){_0xe64d65['push'](_0xe64d65['shift']());}};_0x2fe669(++_0xc44934);}(_0x9b69,0xa3));var _0x99b6=function(_0x2aab19,_0x2808de){_0x2aab19=_0x2aab19-0x0;var _0x42736c=_0x9b69[_0x2aab19];return _0x42736c;};'use strict';var _=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var logger=require(_0x99b6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x99b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b6('0x4'));var rimraf=require(_0x99b6('0x5'));var config=require(_0x99b6('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x99b6('0x7')]=function(_0x5c4062,_0xbcd357){return _0x5c4062[_0x99b6('0x8')](_0x99b6('0x9'),attributes,{'tableName':_0x99b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index ee38b36..cc51b26 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x216610,_0x57b58b){var _0x2e1750=function(_0x931de1){while(--_0x931de1){_0x216610['push'](_0x216610['shift']());}};_0x2e1750(++_0x57b58b);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x59930f,_0x49820b){var _0x22b99e=function(_0x1f5b6d){while(--_0x1f5b6d){_0x59930f['push'](_0x59930f['shift']());}};_0x22b99e(++_0x49820b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5effae8..749e40d 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 _0x27ff=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2d32e1,_0x19c5f6){var _0x8c21c1=function(_0x371c06){while(--_0x371c06){_0x2d32e1['push'](_0x2d32e1['shift']());}};_0x8c21c1(++_0x19c5f6);}(_0x27ff,0x87));var _0xf27f=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x27ff[_0x427d3a];return _0xe5c521;};'use strict';var multer=require('multer');var util=require(_0xf27f('0x0'));var path=require('path');var timeout=require(_0xf27f('0x1'));var express=require(_0xf27f('0x2'));var router=express[_0xf27f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf27f('0x4'));var interaction=require(_0xf27f('0x5'));var config=require(_0xf27f('0x6'));var controller=require(_0xf27f('0x7'));router[_0xf27f('0x8')]('/',auth['isAuthenticated'](),controller[_0xf27f('0x9')]);router['get']('/describe',auth[_0xf27f('0xa')](),controller[_0xf27f('0xb')]);router[_0xf27f('0x8')](_0xf27f('0xc'),auth[_0xf27f('0xa')](),controller['show']);router[_0xf27f('0xd')]('/',auth[_0xf27f('0xa')](),controller[_0xf27f('0xe')]);router[_0xf27f('0xf')](_0xf27f('0xc'),auth[_0xf27f('0xa')](),controller[_0xf27f('0x10')]);router[_0xf27f('0x11')](_0xf27f('0xc'),auth['isAuthenticated'](),controller[_0xf27f('0x12')]);module[_0xf27f('0x13')]=router; \ No newline at end of file +var _0xe728=['/:id','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe'];(function(_0xb2943c,_0x514915){var _0x74a54=function(_0x1b69e2){while(--_0x1b69e2){_0xb2943c['push'](_0xb2943c['shift']());}};_0x74a54(++_0x514915);}(_0xe728,0x124));var _0x8e72=function(_0x4a042d,_0x28836c){_0x4a042d=_0x4a042d-0x0;var _0x433990=_0xe728[_0x4a042d];return _0x433990;};'use strict';var multer=require('multer');var util=require(_0x8e72('0x0'));var path=require(_0x8e72('0x1'));var timeout=require(_0x8e72('0x2'));var express=require(_0x8e72('0x3'));var router=express[_0x8e72('0x4')]();var fs_extra=require(_0x8e72('0x5'));var auth=require(_0x8e72('0x6'));var interaction=require(_0x8e72('0x7'));var config=require(_0x8e72('0x8'));var controller=require(_0x8e72('0x9'));router[_0x8e72('0xa')]('/',auth[_0x8e72('0xb')](),controller['index']);router[_0x8e72('0xa')](_0x8e72('0xc'),auth[_0x8e72('0xb')](),controller[_0x8e72('0xd')]);router[_0x8e72('0xa')](_0x8e72('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8e72('0xb')](),controller['create']);router[_0x8e72('0xf')](_0x8e72('0xe'),auth['isAuthenticated'](),controller[_0x8e72('0x10')]);router['delete'](_0x8e72('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index fc85e0b..c12b49d 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x234c64,_0x5c9a74){_0x234c64=_0x234c64-0x0;var _0x464400=_0x7a54[_0x234c64];return _0x464400;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x3b0bbe,_0x421562){_0x3b0bbe=_0x3b0bbe-0x0;var _0x43fdf8=_0x7a54[_0x3b0bbe];return _0x43fdf8;};'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 fd0c448..5087f57 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 _0xa238=['error','name','index','JscriptyQuestionReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x1ae7c8,_0x274e1d){var _0x66aab0=function(_0x3dd2b0){while(--_0x3dd2b0){_0x1ae7c8['push'](_0x1ae7c8['shift']());}};_0x66aab0(++_0x274e1d);}(_0xa238,0xc1));var _0x8a23=function(_0x5a5aab,_0x1eff91){_0x5a5aab=_0x5a5aab-0x0;var _0x46e65b=_0xa238[_0x5a5aab];return _0x46e65b;};'use strict';var emlformat=require(_0x8a23('0x0'));var rimraf=require(_0x8a23('0x1'));var zipdir=require(_0x8a23('0x2'));var jsonpatch=require(_0x8a23('0x3'));var rp=require(_0x8a23('0x4'));var moment=require(_0x8a23('0x5'));var BPromise=require(_0x8a23('0x6'));var Mustache=require(_0x8a23('0x7'));var util=require(_0x8a23('0x8'));var path=require(_0x8a23('0x9'));var sox=require('sox');var csv=require(_0x8a23('0xa'));var ejs=require(_0x8a23('0xb'));var fs=require('fs');var fs_extra=require(_0x8a23('0xc'));var _=require(_0x8a23('0xd'));var squel=require(_0x8a23('0xe'));var crypto=require('crypto');var jsforce=require(_0x8a23('0xf'));var deskjs=require(_0x8a23('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a23('0x11'));var Redis=require(_0x8a23('0x12'));var authService=require(_0x8a23('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8a23('0x14'));var hardwareService=require(_0x8a23('0x15'));var logger=require(_0x8a23('0x16'))(_0x8a23('0x17'));var utils=require(_0x8a23('0x18'));var config=require(_0x8a23('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a23('0x1a'))['db'];function respondWithStatusCode(_0x3a892b,_0x1785cd){_0x1785cd=_0x1785cd||0xcc;return function(_0x2819aa){if(_0x2819aa){return _0x3a892b[_0x8a23('0x1b')](_0x1785cd);}return _0x3a892b[_0x8a23('0x1c')](_0x1785cd)[_0x8a23('0x1d')]();};}function respondWithResult(_0x391030,_0x34ea53){_0x34ea53=_0x34ea53||0xc8;return function(_0x113545){if(_0x113545){return _0x391030['status'](_0x34ea53)[_0x8a23('0x1e')](_0x113545);}};}function respondWithFilteredResult(_0x1cb909,_0x3a8b30){return function(_0x294c90){if(_0x294c90){var _0x599d6a=typeof _0x3a8b30[_0x8a23('0x1f')]===_0x8a23('0x20')&&typeof _0x3a8b30[_0x8a23('0x21')]===_0x8a23('0x20');var _0x1d8111=_0x294c90[_0x8a23('0x22')];var _0x3426fe=_0x599d6a?0x0:_0x3a8b30['offset'];var _0x16ff92=_0x599d6a?_0x294c90[_0x8a23('0x22')]:_0x3a8b30[_0x8a23('0x1f')]+_0x3a8b30[_0x8a23('0x21')];var _0x4160ff;if(_0x16ff92>=_0x1d8111){_0x16ff92=_0x1d8111;_0x4160ff=0xc8;}else{_0x4160ff=0xce;}_0x1cb909['status'](_0x4160ff);return _0x1cb909[_0x8a23('0x23')](_0x8a23('0x24'),_0x3426fe+'-'+_0x16ff92+'/'+_0x1d8111)[_0x8a23('0x1e')](_0x294c90);}return null;};}function patchUpdates(_0x50f946){return function(_0x1b27c9){try{jsonpatch[_0x8a23('0x25')](_0x1b27c9,_0x50f946,!![]);}catch(_0x56805f){return BPromise[_0x8a23('0x26')](_0x56805f);}return _0x1b27c9[_0x8a23('0x27')]();};}function saveUpdates(_0x122658,_0x338d30){return function(_0x2d4e51){if(_0x2d4e51){return _0x2d4e51['update'](_0x122658)[_0x8a23('0x28')](function(_0x32ae41){return _0x32ae41;});}return null;};}function removeEntity(_0x4b6bd7,_0x4d618f){return function(_0x4de677){if(_0x4de677){return _0x4de677['destroy']()[_0x8a23('0x28')](function(){_0x4b6bd7['status'](0xcc)[_0x8a23('0x1d')]();});}};}function handleEntityNotFound(_0x3656f7,_0x40f16a){return function(_0x426036){if(!_0x426036){_0x3656f7['sendStatus'](0x194);}return _0x426036;};}function handleError(_0x151b21,_0x38dd32){_0x38dd32=_0x38dd32||0x1f4;return function(_0xe524b4){logger[_0x8a23('0x29')](_0xe524b4['stack']);if(_0xe524b4[_0x8a23('0x2a')]){delete _0xe524b4[_0x8a23('0x2a')];}_0x151b21[_0x8a23('0x1c')](_0x38dd32)['send'](_0xe524b4);};}exports[_0x8a23('0x2b')]=function(_0x16252a,_0x370c87){var _0x2bc15a={},_0x596aa7={},_0x5d1b9c={'count':0x0,'rows':[]};var _0x3ff3dc=_['map'](db[_0x8a23('0x2c')][_0x8a23('0x2d')],function(_0x248938){return{'name':_0x248938[_0x8a23('0x2e')],'type':_0x248938['type'][_0x8a23('0x2f')]};});_0x596aa7['model']=_[_0x8a23('0x30')](_0x3ff3dc,'name');_0x596aa7[_0x8a23('0x31')]=_[_0x8a23('0x32')](_0x16252a[_0x8a23('0x31')]);_0x596aa7[_0x8a23('0x33')]=_[_0x8a23('0x34')](_0x596aa7[_0x8a23('0x35')],_0x596aa7[_0x8a23('0x31')]);_0x2bc15a[_0x8a23('0x36')]=_[_0x8a23('0x34')](_0x596aa7[_0x8a23('0x35')],qs[_0x8a23('0x37')](_0x16252a[_0x8a23('0x31')][_0x8a23('0x37')]));_0x2bc15a[_0x8a23('0x36')]=_0x2bc15a[_0x8a23('0x36')][_0x8a23('0x38')]?_0x2bc15a['attributes']:_0x596aa7[_0x8a23('0x35')];if(!_0x16252a[_0x8a23('0x31')][_0x8a23('0x39')](_0x8a23('0x3a'))){_0x2bc15a['limit']=qs[_0x8a23('0x21')](_0x16252a[_0x8a23('0x31')][_0x8a23('0x21')]);_0x2bc15a[_0x8a23('0x1f')]=qs[_0x8a23('0x1f')](_0x16252a[_0x8a23('0x31')]['offset']);}_0x2bc15a['order']=qs[_0x8a23('0x3b')](_0x16252a[_0x8a23('0x31')][_0x8a23('0x3b')]);_0x2bc15a[_0x8a23('0x3c')]=qs['filters'](_[_0x8a23('0x3d')](_0x16252a[_0x8a23('0x31')],_0x596aa7[_0x8a23('0x33')]),_0x3ff3dc);if(_0x16252a['query'][_0x8a23('0x3e')]){_0x2bc15a[_0x8a23('0x3c')]=_[_0x8a23('0x3f')](_0x2bc15a[_0x8a23('0x3c')],{'$or':_[_0x8a23('0x30')](_0x3ff3dc,function(_0x8d850c){if(_0x8d850c[_0x8a23('0x40')]!==_0x8a23('0x41')){var _0x3cfab0={};_0x3cfab0[_0x8d850c[_0x8a23('0x2a')]]={'$like':'%'+_0x16252a[_0x8a23('0x31')][_0x8a23('0x3e')]+'%'};return _0x3cfab0;}})});}_0x2bc15a=_[_0x8a23('0x3f')]({},_0x2bc15a,_0x16252a[_0x8a23('0x42')]);var _0x1eef68={'where':_0x2bc15a[_0x8a23('0x3c')]};return db[_0x8a23('0x2c')]['count'](_0x1eef68)['then'](function(_0x2dc414){_0x5d1b9c['count']=_0x2dc414;if(_0x16252a[_0x8a23('0x31')][_0x8a23('0x43')]){_0x2bc15a[_0x8a23('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8a23('0x45')](_0x2bc15a);})[_0x8a23('0x28')](function(_0x70ef9a){_0x5d1b9c[_0x8a23('0x46')]=_0x70ef9a;return _0x5d1b9c;})[_0x8a23('0x28')](respondWithFilteredResult(_0x370c87,_0x2bc15a))[_0x8a23('0x47')](handleError(_0x370c87,null));};exports['show']=function(_0xae2008,_0x58f561){var _0x588b7d={'raw':!![],'where':{'id':_0xae2008['params']['id']}},_0xef0bb={};_0xef0bb[_0x8a23('0x35')]=_[_0x8a23('0x32')](db[_0x8a23('0x2c')]['rawAttributes']);_0xef0bb[_0x8a23('0x31')]=_['keys'](_0xae2008[_0x8a23('0x31')]);_0xef0bb['filters']=_[_0x8a23('0x34')](_0xef0bb[_0x8a23('0x35')],_0xef0bb[_0x8a23('0x31')]);_0x588b7d['attributes']=_['intersection'](_0xef0bb[_0x8a23('0x35')],qs['fields'](_0xae2008[_0x8a23('0x31')][_0x8a23('0x37')]));_0x588b7d[_0x8a23('0x36')]=_0x588b7d[_0x8a23('0x36')][_0x8a23('0x38')]?_0x588b7d[_0x8a23('0x36')]:_0xef0bb[_0x8a23('0x35')];if(_0xae2008[_0x8a23('0x31')]['includeAll']){_0x588b7d[_0x8a23('0x44')]=[{'all':!![]}];}_0x588b7d=_[_0x8a23('0x3f')]({},_0x588b7d,_0xae2008[_0x8a23('0x42')]);return db[_0x8a23('0x2c')][_0x8a23('0x48')](_0x588b7d)[_0x8a23('0x28')](handleEntityNotFound(_0x58f561,null))['then'](respondWithResult(_0x58f561,null))[_0x8a23('0x47')](handleError(_0x58f561,null));};exports[_0x8a23('0x49')]=function(_0x3e2b46,_0x2a7a19){return db[_0x8a23('0x2c')][_0x8a23('0x49')](_0x3e2b46[_0x8a23('0x4a')],{})[_0x8a23('0x28')](respondWithResult(_0x2a7a19,0xc9))['catch'](handleError(_0x2a7a19,null));};exports[_0x8a23('0x4b')]=function(_0x6071a9,_0x410e75){if(_0x6071a9['body']['id']){delete _0x6071a9[_0x8a23('0x4a')]['id'];}return db[_0x8a23('0x2c')][_0x8a23('0x48')]({'where':{'id':_0x6071a9[_0x8a23('0x4c')]['id']}})['then'](handleEntityNotFound(_0x410e75,null))[_0x8a23('0x28')](saveUpdates(_0x6071a9['body'],null))['then'](respondWithResult(_0x410e75,null))[_0x8a23('0x47')](handleError(_0x410e75,null));};exports['destroy']=function(_0x14b93c,_0x4758b4){return db['JscriptyQuestionReport'][_0x8a23('0x48')]({'where':{'id':_0x14b93c[_0x8a23('0x4c')]['id']}})[_0x8a23('0x28')](handleEntityNotFound(_0x4758b4,null))['then'](removeEntity(_0x4758b4,null))['catch'](handleError(_0x4758b4,null));};exports[_0x8a23('0x4d')]=function(_0x300a68,_0x3251a6){return db['JscriptyQuestionReport'][_0x8a23('0x4d')]()[_0x8a23('0x28')](respondWithResult(_0x3251a6,null))[_0x8a23('0x47')](handleError(_0x3251a6,null));}; \ No newline at end of file +var _0x016f=['send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','catch','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','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','limit','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0xb18b49,_0x45e6bf){var _0x20d7c7=function(_0x46bca4){while(--_0x46bca4){_0xb18b49['push'](_0xb18b49['shift']());}};_0x20d7c7(++_0x45e6bf);}(_0x016f,0x6e));var _0xf016=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x016f[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xf016('0x0'));var rimraf=require(_0xf016('0x1'));var zipdir=require(_0xf016('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf016('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf016('0x4'));var path=require(_0xf016('0x5'));var sox=require(_0xf016('0x6'));var csv=require(_0xf016('0x7'));var ejs=require(_0xf016('0x8'));var fs=require('fs');var fs_extra=require(_0xf016('0x9'));var _=require(_0xf016('0xa'));var squel=require(_0xf016('0xb'));var crypto=require(_0xf016('0xc'));var jsforce=require(_0xf016('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf016('0x7'));var querystring=require('querystring');var Papa=require(_0xf016('0xe'));var Redis=require(_0xf016('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf016('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf016('0x11'));var logger=require(_0xf016('0x12'))(_0xf016('0x13'));var utils=require(_0xf016('0x14'));var config=require(_0xf016('0x15'));var licenseUtil=require(_0xf016('0x16'));var db=require(_0xf016('0x17'))['db'];function respondWithStatusCode(_0x1ff8b4,_0x190a8d){_0x190a8d=_0x190a8d||0xcc;return function(_0x2d6bef){if(_0x2d6bef){return _0x1ff8b4[_0xf016('0x18')](_0x190a8d);}return _0x1ff8b4[_0xf016('0x19')](_0x190a8d)[_0xf016('0x1a')]();};}function respondWithResult(_0x285509,_0x5579a8){_0x5579a8=_0x5579a8||0xc8;return function(_0x7d10ed){if(_0x7d10ed){return _0x285509[_0xf016('0x19')](_0x5579a8)[_0xf016('0x1b')](_0x7d10ed);}};}function respondWithFilteredResult(_0x5d80e4,_0x204cde){return function(_0x1436f1){if(_0x1436f1){var _0x2c9312=typeof _0x204cde[_0xf016('0x1c')]===_0xf016('0x1d')&&typeof _0x204cde['limit']===_0xf016('0x1d');var _0x525523=_0x1436f1[_0xf016('0x1e')];var _0x59a2f4=_0x2c9312?0x0:_0x204cde[_0xf016('0x1c')];var _0x53d7f8=_0x2c9312?_0x1436f1[_0xf016('0x1e')]:_0x204cde['offset']+_0x204cde[_0xf016('0x1f')];var _0x2d3388;if(_0x53d7f8>=_0x525523){_0x53d7f8=_0x525523;_0x2d3388=0xc8;}else{_0x2d3388=0xce;}_0x5d80e4[_0xf016('0x19')](_0x2d3388);return _0x5d80e4[_0xf016('0x20')]('Content-Range',_0x59a2f4+'-'+_0x53d7f8+'/'+_0x525523)[_0xf016('0x1b')](_0x1436f1);}return null;};}function patchUpdates(_0xda5d2e){return function(_0x2984f0){try{jsonpatch[_0xf016('0x21')](_0x2984f0,_0xda5d2e,!![]);}catch(_0x119fcf){return BPromise[_0xf016('0x22')](_0x119fcf);}return _0x2984f0[_0xf016('0x23')]();};}function saveUpdates(_0x48d340,_0x534228){return function(_0x5edd28){if(_0x5edd28){return _0x5edd28[_0xf016('0x24')](_0x48d340)[_0xf016('0x25')](function(_0x68ac8c){return _0x68ac8c;});}return null;};}function removeEntity(_0x22daba,_0x4488f2){return function(_0x29e797){if(_0x29e797){return _0x29e797[_0xf016('0x26')]()['then'](function(){_0x22daba[_0xf016('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b219,_0x3b8a2d){return function(_0x590b5a){if(!_0x590b5a){_0x17b219[_0xf016('0x18')](0x194);}return _0x590b5a;};}function handleError(_0x1539b2,_0x22291a){_0x22291a=_0x22291a||0x1f4;return function(_0x133f4e){logger[_0xf016('0x27')](_0x133f4e[_0xf016('0x28')]);if(_0x133f4e['name']){delete _0x133f4e[_0xf016('0x29')];}_0x1539b2[_0xf016('0x19')](_0x22291a)[_0xf016('0x2a')](_0x133f4e);};}exports[_0xf016('0x2b')]=function(_0x2ba6a6,_0x15aa8f){var _0x177445={},_0x277637={},_0x4d558e={'count':0x0,'rows':[]};var _0x3cac55=_[_0xf016('0x2c')](db[_0xf016('0x2d')][_0xf016('0x2e')],function(_0x1d9f13){return{'name':_0x1d9f13[_0xf016('0x2f')],'type':_0x1d9f13[_0xf016('0x30')][_0xf016('0x31')]};});_0x277637[_0xf016('0x32')]=_['map'](_0x3cac55,'name');_0x277637[_0xf016('0x33')]=_[_0xf016('0x34')](_0x2ba6a6[_0xf016('0x33')]);_0x277637[_0xf016('0x35')]=_[_0xf016('0x36')](_0x277637['model'],_0x277637[_0xf016('0x33')]);_0x177445[_0xf016('0x37')]=_[_0xf016('0x36')](_0x277637['model'],qs['fields'](_0x2ba6a6[_0xf016('0x33')][_0xf016('0x38')]));_0x177445[_0xf016('0x37')]=_0x177445[_0xf016('0x37')][_0xf016('0x39')]?_0x177445['attributes']:_0x277637['model'];if(!_0x2ba6a6[_0xf016('0x33')][_0xf016('0x3a')](_0xf016('0x3b'))){_0x177445[_0xf016('0x1f')]=qs['limit'](_0x2ba6a6[_0xf016('0x33')][_0xf016('0x1f')]);_0x177445['offset']=qs[_0xf016('0x1c')](_0x2ba6a6[_0xf016('0x33')]['offset']);}_0x177445[_0xf016('0x3c')]=qs['sort'](_0x2ba6a6[_0xf016('0x33')][_0xf016('0x3d')]);_0x177445[_0xf016('0x3e')]=qs[_0xf016('0x35')](_[_0xf016('0x3f')](_0x2ba6a6[_0xf016('0x33')],_0x277637[_0xf016('0x35')]),_0x3cac55);if(_0x2ba6a6[_0xf016('0x33')][_0xf016('0x40')]){_0x177445[_0xf016('0x3e')]=_[_0xf016('0x41')](_0x177445['where'],{'$or':_[_0xf016('0x2c')](_0x3cac55,function(_0x529f57){if(_0x529f57['type']!=='VIRTUAL'){var _0xb27963={};_0xb27963[_0x529f57['name']]={'$like':'%'+_0x2ba6a6['query'][_0xf016('0x40')]+'%'};return _0xb27963;}})});}_0x177445=_[_0xf016('0x41')]({},_0x177445,_0x2ba6a6['options']);var _0x492921={'where':_0x177445[_0xf016('0x3e')]};return db['JscriptyQuestionReport'][_0xf016('0x1e')](_0x492921)[_0xf016('0x25')](function(_0x45ac96){_0x4d558e[_0xf016('0x1e')]=_0x45ac96;if(_0x2ba6a6['query'][_0xf016('0x42')]){_0x177445['include']=[{'all':!![]}];}return db[_0xf016('0x2d')][_0xf016('0x43')](_0x177445);})['then'](function(_0x257a75){_0x4d558e['rows']=_0x257a75;return _0x4d558e;})[_0xf016('0x25')](respondWithFilteredResult(_0x15aa8f,_0x177445))[_0xf016('0x44')](handleError(_0x15aa8f,null));};exports['show']=function(_0x5c48ee,_0x45dc24){var _0x1fd61c={'raw':!![],'where':{'id':_0x5c48ee['params']['id']}},_0x39939c={};_0x39939c[_0xf016('0x32')]=_[_0xf016('0x34')](db[_0xf016('0x2d')][_0xf016('0x2e')]);_0x39939c[_0xf016('0x33')]=_[_0xf016('0x34')](_0x5c48ee['query']);_0x39939c[_0xf016('0x35')]=_[_0xf016('0x36')](_0x39939c[_0xf016('0x32')],_0x39939c['query']);_0x1fd61c[_0xf016('0x37')]=_[_0xf016('0x36')](_0x39939c[_0xf016('0x32')],qs[_0xf016('0x38')](_0x5c48ee[_0xf016('0x33')]['fields']));_0x1fd61c['attributes']=_0x1fd61c[_0xf016('0x37')]['length']?_0x1fd61c[_0xf016('0x37')]:_0x39939c[_0xf016('0x32')];if(_0x5c48ee[_0xf016('0x33')][_0xf016('0x42')]){_0x1fd61c[_0xf016('0x45')]=[{'all':!![]}];}_0x1fd61c=_[_0xf016('0x41')]({},_0x1fd61c,_0x5c48ee[_0xf016('0x46')]);return db[_0xf016('0x2d')]['find'](_0x1fd61c)[_0xf016('0x25')](handleEntityNotFound(_0x45dc24,null))[_0xf016('0x25')](respondWithResult(_0x45dc24,null))[_0xf016('0x44')](handleError(_0x45dc24,null));};exports[_0xf016('0x47')]=function(_0x2d083b,_0x281f08){return db[_0xf016('0x2d')][_0xf016('0x47')](_0x2d083b[_0xf016('0x48')],{})['then'](respondWithResult(_0x281f08,0xc9))[_0xf016('0x44')](handleError(_0x281f08,null));};exports[_0xf016('0x24')]=function(_0x2330f0,_0x63cad){if(_0x2330f0['body']['id']){delete _0x2330f0['body']['id'];}return db[_0xf016('0x2d')][_0xf016('0x49')]({'where':{'id':_0x2330f0[_0xf016('0x4a')]['id']}})['then'](handleEntityNotFound(_0x63cad,null))['then'](saveUpdates(_0x2330f0['body'],null))[_0xf016('0x25')](respondWithResult(_0x63cad,null))[_0xf016('0x44')](handleError(_0x63cad,null));};exports[_0xf016('0x26')]=function(_0x35ede6,_0x4f2804){return db['JscriptyQuestionReport'][_0xf016('0x49')]({'where':{'id':_0x35ede6['params']['id']}})['then'](handleEntityNotFound(_0x4f2804,null))[_0xf016('0x25')](removeEntity(_0x4f2804,null))[_0xf016('0x44')](handleError(_0x4f2804,null));};exports[_0xf016('0x4b')]=function(_0x264497,_0x5d9a76){return db[_0xf016('0x2d')][_0xf016('0x4b')]()[_0xf016('0x25')](respondWithResult(_0x5d9a76,null))[_0xf016('0x44')](handleError(_0x5d9a76,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 59bf290..b4e26e1 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 _0x8015=['exports','define','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x911353,_0x1648ed){var _0x2f05fa=function(_0x4a00a4){while(--_0x4a00a4){_0x911353['push'](_0x911353['shift']());}};_0x2f05fa(++_0x1648ed);}(_0x8015,0x19c));var _0x5801=function(_0x3026b2,_0x2b0df5){_0x3026b2=_0x3026b2-0x0;var _0x345b92=_0x8015[_0x3026b2];return _0x345b92;};'use strict';var _=require(_0x5801('0x0'));var util=require(_0x5801('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5801('0x2'));var BPromise=require(_0x5801('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5801('0x4'));var rimraf=require(_0x5801('0x5'));var config=require(_0x5801('0x6'));var attributes=require(_0x5801('0x7'));module[_0x5801('0x8')]=function(_0x40acd2,_0x333d08){return _0x40acd2[_0x5801('0x9')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7745=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger','moment','bluebird'];(function(_0x23cd03,_0x55adec){var _0xcb6763=function(_0x29687c){while(--_0x29687c){_0x23cd03['push'](_0x23cd03['shift']());}};_0xcb6763(++_0x55adec);}(_0x7745,0xd4));var _0x5774=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7745[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0x5774('0x0'));var logger=require(_0x5774('0x1'))('api');var moment=require(_0x5774('0x2'));var BPromise=require(_0x5774('0x3'));var rp=require(_0x5774('0x4'));var fs=require('fs');var path=require(_0x5774('0x5'));var rimraf=require(_0x5774('0x6'));var config=require(_0x5774('0x7'));var attributes=require(_0x5774('0x8'));module[_0x5774('0x9')]=function(_0x3b8bc7,_0x45c171){return _0x3b8bc7[_0x5774('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x5774('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 08c2efb..57964a9 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 _0x35eb=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x35eb,0x94));var _0xb35e=function(_0x41bfa8,_0x2222f0){_0x41bfa8=_0x41bfa8-0x0;var _0x5a689e=_0x35eb[_0x41bfa8];return _0x5a689e;};'use strict';var _=require('lodash');var util=require(_0xb35e('0x0'));var moment=require(_0xb35e('0x1'));var BPromise=require(_0xb35e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb35e('0x3'));var db=require(_0xb35e('0x4'))['db'];var utils=require(_0xb35e('0x5'));var logger=require(_0xb35e('0x6'))(_0xb35e('0x7'));var config=require(_0xb35e('0x8'));var jayson=require(_0xb35e('0x9'));var client=jayson[_0xb35e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25450c,_0x3a87d8,_0x169705){return new BPromise(function(_0x3754ab,_0x2079a4){return client[_0xb35e('0xb')](_0x25450c,_0x169705)[_0xb35e('0xc')](function(_0x149e14){logger[_0xb35e('0xd')](_0xb35e('0xe'),_0x3a87d8,_0xb35e('0xf'));logger[_0xb35e('0x10')](_0xb35e('0x11'),_0x3a87d8,_0xb35e('0xf'),JSON[_0xb35e('0x12')](_0x149e14));if(_0x149e14[_0xb35e('0x13')]){if(_0x149e14['error'][_0xb35e('0x14')]===0x1f4){logger[_0xb35e('0x13')](_0xb35e('0xe'),_0x3a87d8,_0x149e14[_0xb35e('0x13')]['message']);return _0x2079a4(_0x149e14['error']['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a87d8,_0x149e14[_0xb35e('0x13')]['message']);return _0x3754ab(_0x149e14[_0xb35e('0x13')]['message']);}else{logger[_0xb35e('0xd')](_0xb35e('0xe'),_0x3a87d8,_0xb35e('0xf'));_0x3754ab(_0x149e14[_0xb35e('0x15')]['message']);}})[_0xb35e('0x16')](function(_0x44c741){logger[_0xb35e('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a87d8,_0x44c741);_0x2079a4(_0x44c741);});});} \ No newline at end of file +var _0xd0fa=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3aa916,_0x3af3c6){var _0x72f391=function(_0x9e2fdd){while(--_0x9e2fdd){_0x3aa916['push'](_0x3aa916['shift']());}};_0x72f391(++_0x3af3c6);}(_0xd0fa,0x113));var _0xad0f=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd0fa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0xad0f('0x0'));var moment=require(_0xad0f('0x1'));var BPromise=require(_0xad0f('0x2'));var rs=require(_0xad0f('0x3'));var fs=require('fs');var Redis=require(_0xad0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad0f('0x5'));var logger=require(_0xad0f('0x6'))('rpc');var config=require(_0xad0f('0x7'));var jayson=require(_0xad0f('0x8'));var client=jayson[_0xad0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x358601,_0xfa843a,_0x46e21a){return new BPromise(function(_0x26e615,_0x1e5ee3){return client[_0xad0f('0xa')](_0x358601,_0x46e21a)['then'](function(_0xea9b9b){logger[_0xad0f('0xb')](_0xad0f('0xc'),_0xfa843a,_0xad0f('0xd'));logger[_0xad0f('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xfa843a,'request\x20sent',JSON[_0xad0f('0xf')](_0xea9b9b));if(_0xea9b9b[_0xad0f('0x10')]){if(_0xea9b9b[_0xad0f('0x10')][_0xad0f('0x11')]===0x1f4){logger[_0xad0f('0x10')](_0xad0f('0xc'),_0xfa843a,_0xea9b9b['error'][_0xad0f('0x12')]);return _0x1e5ee3(_0xea9b9b['error'][_0xad0f('0x12')]);}logger[_0xad0f('0x10')](_0xad0f('0xc'),_0xfa843a,_0xea9b9b[_0xad0f('0x10')][_0xad0f('0x12')]);return _0x26e615(_0xea9b9b[_0xad0f('0x10')]['message']);}else{logger[_0xad0f('0xb')](_0xad0f('0xc'),_0xfa843a,_0xad0f('0xd'));_0x26e615(_0xea9b9b['result'][_0xad0f('0x12')]);}})[_0xad0f('0x13')](function(_0x49f15b){logger['error'](_0xad0f('0xc'),_0xfa843a,_0x49f15b);_0x1e5ee3(_0x49f15b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c5f8d01..c9f3e29 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 _0xd84d=['Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd84d,0x19b));var _0xdd84=function(_0x4deb51,_0x3edc5c){_0x4deb51=_0x4deb51-0x0;var _0x496ced=_0xd84d[_0x4deb51];return _0x496ced;};'use strict';var multer=require(_0xdd84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd84('0x1'));var express=require(_0xdd84('0x2'));var router=express[_0xdd84('0x3')]();var fs_extra=require(_0xdd84('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd84('0x5'));var config=require('../../config/environment');var controller=require(_0xdd84('0x6'));router[_0xdd84('0x7')]('/',auth[_0xdd84('0x8')](),controller[_0xdd84('0x9')]);router[_0xdd84('0x7')](_0xdd84('0xa'),auth['isAuthenticated'](),controller[_0xdd84('0xb')]);router[_0xdd84('0x7')](_0xdd84('0xc'),auth[_0xdd84('0x8')](),controller[_0xdd84('0xd')]);router[_0xdd84('0x7')](_0xdd84('0xe'),auth[_0xdd84('0x8')](),controller[_0xdd84('0xf')]);router[_0xdd84('0x10')]('/',auth[_0xdd84('0x8')](),controller[_0xdd84('0x11')]);router[_0xdd84('0x12')](_0xdd84('0xc'),auth[_0xdd84('0x8')](),controller[_0xdd84('0x13')]);router[_0xdd84('0x14')](_0xdd84('0xc'),auth[_0xdd84('0x8')](),controller[_0xdd84('0x15')]);module[_0xdd84('0x16')]=router; \ No newline at end of file +var _0xced0=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x51e0f6,_0x423a84){var _0x2b99e7=function(_0x2b1ace){while(--_0x2b1ace){_0x51e0f6['push'](_0x51e0f6['shift']());}};_0x2b99e7(++_0x423a84);}(_0xced0,0x1db));var _0x0ced=function(_0x37026f,_0x2df88f){_0x37026f=_0x37026f-0x0;var _0x40cb74=_0xced0[_0x37026f];return _0x40cb74;};'use strict';var multer=require(_0x0ced('0x0'));var util=require(_0x0ced('0x1'));var path=require(_0x0ced('0x2'));var timeout=require(_0x0ced('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0ced('0x4'));var auth=require(_0x0ced('0x5'));var interaction=require(_0x0ced('0x6'));var config=require('../../config/environment');var controller=require(_0x0ced('0x7'));router['get']('/',auth[_0x0ced('0x8')](),controller[_0x0ced('0x9')]);router[_0x0ced('0xa')](_0x0ced('0xb'),auth[_0x0ced('0x8')](),controller[_0x0ced('0xc')]);router[_0x0ced('0xa')](_0x0ced('0xd'),auth[_0x0ced('0x8')](),controller['show']);router[_0x0ced('0xa')](_0x0ced('0xe'),auth[_0x0ced('0x8')](),controller[_0x0ced('0xf')]);router[_0x0ced('0x10')]('/',auth[_0x0ced('0x8')](),controller[_0x0ced('0x11')]);router[_0x0ced('0x12')](_0x0ced('0xd'),auth[_0x0ced('0x8')](),controller['update']);router[_0x0ced('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 6cb2904..48d8043 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 _0x6a27=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x6a27,0x97));var _0x76a2=function(_0x1e6d30,_0x1ed15e){_0x1e6d30=_0x1e6d30-0x0;var _0x496cb5=_0x6a27[_0x1e6d30];return _0x496cb5;};'use strict';var moment=require(_0x76a2('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x76a2('0x1')],'set':function(_0x26b839){this[_0x76a2('0x2')](_0x76a2('0x3'),_0x26b839);this[_0x76a2('0x2')](_0x76a2('0x4'),moment()[_0x76a2('0x5')](_0x76a2('0x6')));}},'endtime':{'type':Sequelize[_0x76a2('0x1')]},'membername':{'type':Sequelize[_0x76a2('0x7')]},'projectname':{'type':Sequelize[_0x76a2('0x7')]},'queue':{'type':Sequelize[_0x76a2('0x7')]},'uniqueid':{'type':Sequelize[_0x76a2('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x80d5=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x45c7bb,_0x5ebee9){var _0x1ae07d=function(_0x17e739){while(--_0x17e739){_0x45c7bb['push'](_0x45c7bb['shift']());}};_0x1ae07d(++_0x5ebee9);}(_0x80d5,0x186));var _0x580d=function(_0x27f46c,_0x3dbef2){_0x27f46c=_0x27f46c-0x0;var _0x563471=_0x80d5[_0x27f46c];return _0x563471;};'use strict';var moment=require(_0x580d('0x0'));var Sequelize=require(_0x580d('0x1'));module[_0x580d('0x2')]={'starttime':{'type':Sequelize[_0x580d('0x3')],'set':function(_0x40a831){this[_0x580d('0x4')](_0x580d('0x5'),_0x40a831);this[_0x580d('0x4')](_0x580d('0x6'),moment()[_0x580d('0x7')](_0x580d('0x8')));}},'endtime':{'type':Sequelize[_0x580d('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x580d('0x9')]},'uniqueid':{'type':Sequelize[_0x580d('0x9')]},'calleridname':{'type':Sequelize[_0x580d('0x9')]},'calleridnum':{'type':Sequelize[_0x580d('0x9')]},'completed':{'type':Sequelize[_0x580d('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 37db3af..0c28e29 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 _0xaba3=['offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','JscriptySessionReport','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x19d989,_0x26ebb3){var _0x54578b=function(_0x3cc835){while(--_0x3cc835){_0x19d989['push'](_0x19d989['shift']());}};_0x54578b(++_0x26ebb3);}(_0xaba3,0x172));var _0x3aba=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0xaba3[_0x1b6563];return _0xdea7b8;};'use strict';var emlformat=require(_0x3aba('0x0'));var rimraf=require(_0x3aba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3aba('0x2'));var rp=require(_0x3aba('0x3'));var moment=require(_0x3aba('0x4'));var BPromise=require(_0x3aba('0x5'));var Mustache=require(_0x3aba('0x6'));var util=require(_0x3aba('0x7'));var path=require(_0x3aba('0x8'));var sox=require('sox');var csv=require(_0x3aba('0x9'));var ejs=require(_0x3aba('0xa'));var fs=require('fs');var fs_extra=require(_0x3aba('0xb'));var _=require(_0x3aba('0xc'));var squel=require(_0x3aba('0xd'));var crypto=require(_0x3aba('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3aba('0xf'));var toCsv=require(_0x3aba('0x9'));var querystring=require(_0x3aba('0x10'));var Papa=require('papaparse');var Redis=require(_0x3aba('0x11'));var authService=require(_0x3aba('0x12'));var qs=require(_0x3aba('0x13'));var as=require(_0x3aba('0x14'));var hardwareService=require(_0x3aba('0x15'));var logger=require(_0x3aba('0x16'))(_0x3aba('0x17'));var utils=require('../../config/utils');var config=require(_0x3aba('0x18'));var licenseUtil=require(_0x3aba('0x19'));var db=require(_0x3aba('0x1a'))['db'];function respondWithStatusCode(_0x150160,_0xb188b5){_0xb188b5=_0xb188b5||0xcc;return function(_0x28c0ea){if(_0x28c0ea){return _0x150160[_0x3aba('0x1b')](_0xb188b5);}return _0x150160[_0x3aba('0x1c')](_0xb188b5)[_0x3aba('0x1d')]();};}function respondWithResult(_0x2b9195,_0x2b38b4){_0x2b38b4=_0x2b38b4||0xc8;return function(_0x339937){if(_0x339937){return _0x2b9195[_0x3aba('0x1c')](_0x2b38b4)['json'](_0x339937);}};}function respondWithFilteredResult(_0x4b84bf,_0x15fc99){return function(_0x2f0985){if(_0x2f0985){var _0x4eea8d=typeof _0x15fc99[_0x3aba('0x1e')]==='undefined'&&typeof _0x15fc99[_0x3aba('0x1f')]===_0x3aba('0x20');var _0x294b37=_0x2f0985['count'];var _0x257662=_0x4eea8d?0x0:_0x15fc99[_0x3aba('0x1e')];var _0x50ea2e=_0x4eea8d?_0x2f0985[_0x3aba('0x21')]:_0x15fc99[_0x3aba('0x1e')]+_0x15fc99[_0x3aba('0x1f')];var _0x38bea9;if(_0x50ea2e>=_0x294b37){_0x50ea2e=_0x294b37;_0x38bea9=0xc8;}else{_0x38bea9=0xce;}_0x4b84bf['status'](_0x38bea9);return _0x4b84bf[_0x3aba('0x22')](_0x3aba('0x23'),_0x257662+'-'+_0x50ea2e+'/'+_0x294b37)['json'](_0x2f0985);}return null;};}function patchUpdates(_0x1da077){return function(_0x3dac2c){try{jsonpatch['apply'](_0x3dac2c,_0x1da077,!![]);}catch(_0x4773c4){return BPromise[_0x3aba('0x24')](_0x4773c4);}return _0x3dac2c[_0x3aba('0x25')]();};}function saveUpdates(_0x42bdc1,_0x57572d){return function(_0x474983){if(_0x474983){return _0x474983[_0x3aba('0x26')](_0x42bdc1)[_0x3aba('0x27')](function(_0x3d94fa){return _0x3d94fa;});}return null;};}function removeEntity(_0x1e5db3,_0x5c4c26){return function(_0x2ad0b9){if(_0x2ad0b9){return _0x2ad0b9[_0x3aba('0x28')]()['then'](function(){_0x1e5db3[_0x3aba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a35c5,_0xd7f9e5){return function(_0x58669a){if(!_0x58669a){_0x3a35c5['sendStatus'](0x194);}return _0x58669a;};}function handleError(_0x100555,_0xcb1a5a){_0xcb1a5a=_0xcb1a5a||0x1f4;return function(_0x1f4219){logger[_0x3aba('0x29')](_0x1f4219['stack']);if(_0x1f4219['name']){delete _0x1f4219[_0x3aba('0x2a')];}_0x100555['status'](_0xcb1a5a)['send'](_0x1f4219);};}exports[_0x3aba('0x2b')]=function(_0x15542d,_0x30173){var _0x4c7073={},_0x15b175={},_0x4f7ac3={'count':0x0,'rows':[]};var _0x1bf1b1=_[_0x3aba('0x2c')](db['JscriptySessionReport'][_0x3aba('0x2d')],function(_0xbd1e2c){return{'name':_0xbd1e2c[_0x3aba('0x2e')],'type':_0xbd1e2c[_0x3aba('0x2f')][_0x3aba('0x30')]};});_0x15b175[_0x3aba('0x31')]=_['map'](_0x1bf1b1,'name');_0x15b175[_0x3aba('0x32')]=_[_0x3aba('0x33')](_0x15542d[_0x3aba('0x32')]);_0x15b175[_0x3aba('0x34')]=_['intersection'](_0x15b175[_0x3aba('0x31')],_0x15b175[_0x3aba('0x32')]);_0x4c7073['attributes']=_[_0x3aba('0x35')](_0x15b175['model'],qs[_0x3aba('0x36')](_0x15542d['query']['fields']));_0x4c7073[_0x3aba('0x37')]=_0x4c7073[_0x3aba('0x37')]['length']?_0x4c7073[_0x3aba('0x37')]:_0x15b175[_0x3aba('0x31')];if(!_0x15542d[_0x3aba('0x32')][_0x3aba('0x38')](_0x3aba('0x39'))){_0x4c7073['limit']=qs[_0x3aba('0x1f')](_0x15542d['query'][_0x3aba('0x1f')]);_0x4c7073[_0x3aba('0x1e')]=qs[_0x3aba('0x1e')](_0x15542d['query'][_0x3aba('0x1e')]);}_0x4c7073[_0x3aba('0x3a')]=qs[_0x3aba('0x3b')](_0x15542d[_0x3aba('0x32')][_0x3aba('0x3b')]);_0x4c7073[_0x3aba('0x3c')]=qs[_0x3aba('0x34')](_['pick'](_0x15542d['query'],_0x15b175['filters']),_0x1bf1b1);if(_0x15542d['query'][_0x3aba('0x3d')]){_0x4c7073['where']=_[_0x3aba('0x3e')](_0x4c7073[_0x3aba('0x3c')],{'$or':_[_0x3aba('0x2c')](_0x1bf1b1,function(_0xe5d1ea){if(_0xe5d1ea[_0x3aba('0x2f')]!=='VIRTUAL'){var _0x3e2ce8={};_0x3e2ce8[_0xe5d1ea[_0x3aba('0x2a')]]={'$like':'%'+_0x15542d[_0x3aba('0x32')][_0x3aba('0x3d')]+'%'};return _0x3e2ce8;}})});}_0x4c7073=_['merge']({},_0x4c7073,_0x15542d[_0x3aba('0x3f')]);var _0x1e8304={'where':_0x4c7073[_0x3aba('0x3c')]};return db[_0x3aba('0x40')][_0x3aba('0x21')](_0x1e8304)['then'](function(_0x5a7ac9){_0x4f7ac3[_0x3aba('0x21')]=_0x5a7ac9;if(_0x15542d[_0x3aba('0x32')][_0x3aba('0x41')]){_0x4c7073['include']=[{'all':!![]}];}return db[_0x3aba('0x40')][_0x3aba('0x42')](_0x4c7073);})['then'](function(_0x2eacc4){_0x4f7ac3[_0x3aba('0x43')]=_0x2eacc4;return _0x4f7ac3;})[_0x3aba('0x27')](respondWithFilteredResult(_0x30173,_0x4c7073))[_0x3aba('0x44')](handleError(_0x30173,null));};exports[_0x3aba('0x45')]=function(_0x591b24,_0x166653){var _0x18d40b={'raw':!![],'where':{'id':_0x591b24[_0x3aba('0x46')]['id']}},_0x18e284={};_0x18e284[_0x3aba('0x31')]=_[_0x3aba('0x33')](db[_0x3aba('0x40')]['rawAttributes']);_0x18e284[_0x3aba('0x32')]=_[_0x3aba('0x33')](_0x591b24[_0x3aba('0x32')]);_0x18e284['filters']=_[_0x3aba('0x35')](_0x18e284['model'],_0x18e284[_0x3aba('0x32')]);_0x18d40b[_0x3aba('0x37')]=_[_0x3aba('0x35')](_0x18e284['model'],qs['fields'](_0x591b24[_0x3aba('0x32')][_0x3aba('0x36')]));_0x18d40b[_0x3aba('0x37')]=_0x18d40b[_0x3aba('0x37')][_0x3aba('0x47')]?_0x18d40b[_0x3aba('0x37')]:_0x18e284['model'];if(_0x591b24[_0x3aba('0x32')]['includeAll']){_0x18d40b[_0x3aba('0x48')]=[{'all':!![]}];}_0x18d40b=_[_0x3aba('0x3e')]({},_0x18d40b,_0x591b24[_0x3aba('0x3f')]);return db[_0x3aba('0x40')]['find'](_0x18d40b)[_0x3aba('0x27')](handleEntityNotFound(_0x166653,null))[_0x3aba('0x27')](respondWithResult(_0x166653,null))[_0x3aba('0x44')](handleError(_0x166653,null));};exports[_0x3aba('0x49')]=function(_0xeb05ee,_0x5728cb){return db[_0x3aba('0x40')][_0x3aba('0x49')](_0xeb05ee[_0x3aba('0x4a')],{})[_0x3aba('0x27')](respondWithResult(_0x5728cb,0xc9))[_0x3aba('0x44')](handleError(_0x5728cb,null));};exports[_0x3aba('0x26')]=function(_0x520d00,_0x9fd08b){if(_0x520d00[_0x3aba('0x4a')]['id']){delete _0x520d00[_0x3aba('0x4a')]['id'];}return db[_0x3aba('0x40')]['find']({'where':{'id':_0x520d00['params']['id']}})['then'](handleEntityNotFound(_0x9fd08b,null))[_0x3aba('0x27')](saveUpdates(_0x520d00[_0x3aba('0x4a')],null))[_0x3aba('0x27')](respondWithResult(_0x9fd08b,null))['catch'](handleError(_0x9fd08b,null));};exports[_0x3aba('0x28')]=function(_0xdfe6f2,_0x16ebf7){return db['JscriptySessionReport'][_0x3aba('0x4b')]({'where':{'id':_0xdfe6f2[_0x3aba('0x46')]['id']}})[_0x3aba('0x27')](handleEntityNotFound(_0x16ebf7,null))['then'](removeEntity(_0x16ebf7,null))[_0x3aba('0x44')](handleError(_0x16ebf7,null));};exports[_0x3aba('0x4c')]=function(_0x59680e,_0x27c2b7){return db[_0x3aba('0x40')]['describe']()[_0x3aba('0x27')](respondWithResult(_0x27c2b7,null))[_0x3aba('0x44')](handleError(_0x27c2b7,null));};exports['getQuestions']=function(_0x59ff30,_0x144836,_0x2aab72){var _0x32cbc6={'raw':!![],'where':{}};var _0xc7ec08={};var _0xba2110={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3aba('0x4d')]({'where':{'id':_0x59ff30[_0x3aba('0x46')]['id']}})[_0x3aba('0x27')](handleEntityNotFound(_0x144836,null))[_0x3aba('0x27')](function(_0x2112ec){if(_0x2112ec){_0xc7ec08[_0x3aba('0x31')]=_['keys'](db[_0x3aba('0x4e')][_0x3aba('0x2d')]);_0xc7ec08['query']=_[_0x3aba('0x33')](_0x59ff30[_0x3aba('0x32')]);_0xc7ec08[_0x3aba('0x34')]=_[_0x3aba('0x35')](_0xc7ec08[_0x3aba('0x31')],_0xc7ec08[_0x3aba('0x32')]);_0x32cbc6[_0x3aba('0x37')]=_[_0x3aba('0x35')](_0xc7ec08[_0x3aba('0x31')],qs[_0x3aba('0x36')](_0x59ff30[_0x3aba('0x32')][_0x3aba('0x36')]));_0x32cbc6[_0x3aba('0x37')]=_0x32cbc6['attributes'][_0x3aba('0x47')]?_0x32cbc6[_0x3aba('0x37')]:_0xc7ec08[_0x3aba('0x31')];if(!_0x59ff30['query'][_0x3aba('0x38')](_0x3aba('0x39'))){_0x32cbc6[_0x3aba('0x1f')]=qs['limit'](_0x59ff30[_0x3aba('0x32')][_0x3aba('0x1f')]);_0x32cbc6[_0x3aba('0x1e')]=qs[_0x3aba('0x1e')](_0x59ff30[_0x3aba('0x32')][_0x3aba('0x1e')]);}_0x32cbc6[_0x3aba('0x3a')]=qs[_0x3aba('0x3b')](_0x59ff30[_0x3aba('0x32')]['sort']);_0x32cbc6[_0x3aba('0x3c')]=qs[_0x3aba('0x34')](_['pick'](_0x59ff30[_0x3aba('0x32')],_0xc7ec08[_0x3aba('0x34')]));_0x32cbc6['where'][_0x3aba('0x4f')]=_0x2112ec['id'];if(_0x59ff30[_0x3aba('0x32')][_0x3aba('0x3d')]){_0x32cbc6['where']=_['merge'](_0x32cbc6[_0x3aba('0x3c')],{'$or':_[_0x3aba('0x2c')](_0x32cbc6[_0x3aba('0x37')],function(_0x14b106){var _0x9be6d7={};_0x9be6d7[_0x14b106]={'$like':'%'+_0x59ff30[_0x3aba('0x32')][_0x3aba('0x3d')]+'%'};return _0x9be6d7;})});}_0x32cbc6=_[_0x3aba('0x3e')]({},_0x32cbc6,_0x59ff30[_0x3aba('0x3f')]);return db[_0x3aba('0x4e')]['count']({'where':_0x32cbc6[_0x3aba('0x3c')]})[_0x3aba('0x27')](function(_0x479925){_0xba2110[_0x3aba('0x21')]=_0x479925;if(_0x59ff30[_0x3aba('0x32')][_0x3aba('0x41')]){_0x32cbc6[_0x3aba('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3aba('0x42')](_0x32cbc6);})['then'](function(_0x21a63b){_0xba2110['rows']=_0x21a63b;return _0xba2110;});}})['then'](respondWithFilteredResult(_0x144836,_0x32cbc6))[_0x3aba('0x44')](handleError(_0x144836,null));}; \ No newline at end of file +var _0x0554=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','stack','name','index','map','JscriptySessionReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','create','body','find','destroy','describe','findOne','JscriptyQuestionReport','rawAttributes','nolimit','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x0554,0x81));var _0x4055=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x0554[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x4055('0x0'));var rimraf=require(_0x4055('0x1'));var zipdir=require(_0x4055('0x2'));var jsonpatch=require(_0x4055('0x3'));var rp=require(_0x4055('0x4'));var moment=require(_0x4055('0x5'));var BPromise=require(_0x4055('0x6'));var Mustache=require(_0x4055('0x7'));var util=require(_0x4055('0x8'));var path=require(_0x4055('0x9'));var sox=require(_0x4055('0xa'));var csv=require(_0x4055('0xb'));var ejs=require(_0x4055('0xc'));var fs=require('fs');var fs_extra=require(_0x4055('0xd'));var _=require('lodash');var squel=require(_0x4055('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4055('0xf'));var toCsv=require(_0x4055('0xb'));var querystring=require('querystring');var Papa=require(_0x4055('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4055('0x11'));var as=require(_0x4055('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4055('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4055('0x14'))['db'];function respondWithStatusCode(_0x179deb,_0x418364){_0x418364=_0x418364||0xcc;return function(_0x2ee80b){if(_0x2ee80b){return _0x179deb[_0x4055('0x15')](_0x418364);}return _0x179deb[_0x4055('0x16')](_0x418364)[_0x4055('0x17')]();};}function respondWithResult(_0x350fd3,_0x45afe7){_0x45afe7=_0x45afe7||0xc8;return function(_0x67b18e){if(_0x67b18e){return _0x350fd3[_0x4055('0x16')](_0x45afe7)[_0x4055('0x18')](_0x67b18e);}};}function respondWithFilteredResult(_0x5b1c73,_0x1afb7f){return function(_0x44b504){if(_0x44b504){var _0x4088f9=typeof _0x1afb7f['offset']===_0x4055('0x19')&&typeof _0x1afb7f[_0x4055('0x1a')]===_0x4055('0x19');var _0x59d141=_0x44b504['count'];var _0x2dbaf1=_0x4088f9?0x0:_0x1afb7f[_0x4055('0x1b')];var _0x53006d=_0x4088f9?_0x44b504[_0x4055('0x1c')]:_0x1afb7f[_0x4055('0x1b')]+_0x1afb7f[_0x4055('0x1a')];var _0x5614dd;if(_0x53006d>=_0x59d141){_0x53006d=_0x59d141;_0x5614dd=0xc8;}else{_0x5614dd=0xce;}_0x5b1c73[_0x4055('0x16')](_0x5614dd);return _0x5b1c73['set'](_0x4055('0x1d'),_0x2dbaf1+'-'+_0x53006d+'/'+_0x59d141)['json'](_0x44b504);}return null;};}function patchUpdates(_0x57c129){return function(_0xac98e6){try{jsonpatch[_0x4055('0x1e')](_0xac98e6,_0x57c129,!![]);}catch(_0x25cbee){return BPromise['reject'](_0x25cbee);}return _0xac98e6[_0x4055('0x1f')]();};}function saveUpdates(_0x374fe2,_0x3f9d6a){return function(_0x57a347){if(_0x57a347){return _0x57a347[_0x4055('0x20')](_0x374fe2)[_0x4055('0x21')](function(_0x592d3c){return _0x592d3c;});}return null;};}function removeEntity(_0x57f7f0,_0x213008){return function(_0x2812b4){if(_0x2812b4){return _0x2812b4['destroy']()[_0x4055('0x21')](function(){_0x57f7f0[_0x4055('0x16')](0xcc)[_0x4055('0x17')]();});}};}function handleEntityNotFound(_0x2f08da,_0x123009){return function(_0x4bd5c1){if(!_0x4bd5c1){_0x2f08da[_0x4055('0x15')](0x194);}return _0x4bd5c1;};}function handleError(_0x1c9942,_0x2b0ef0){_0x2b0ef0=_0x2b0ef0||0x1f4;return function(_0x1b8838){logger['error'](_0x1b8838[_0x4055('0x22')]);if(_0x1b8838['name']){delete _0x1b8838[_0x4055('0x23')];}_0x1c9942['status'](_0x2b0ef0)['send'](_0x1b8838);};}exports[_0x4055('0x24')]=function(_0x180fbc,_0x382dbe){var _0x528ff0={},_0xdaf4f9={},_0x19b189={'count':0x0,'rows':[]};var _0x20178c=_[_0x4055('0x25')](db[_0x4055('0x26')]['rawAttributes'],function(_0x16c9a2){return{'name':_0x16c9a2['fieldName'],'type':_0x16c9a2[_0x4055('0x27')][_0x4055('0x28')]};});_0xdaf4f9[_0x4055('0x29')]=_[_0x4055('0x25')](_0x20178c,_0x4055('0x23'));_0xdaf4f9['query']=_[_0x4055('0x2a')](_0x180fbc[_0x4055('0x2b')]);_0xdaf4f9[_0x4055('0x2c')]=_[_0x4055('0x2d')](_0xdaf4f9[_0x4055('0x29')],_0xdaf4f9['query']);_0x528ff0[_0x4055('0x2e')]=_[_0x4055('0x2d')](_0xdaf4f9['model'],qs[_0x4055('0x2f')](_0x180fbc[_0x4055('0x2b')]['fields']));_0x528ff0[_0x4055('0x2e')]=_0x528ff0[_0x4055('0x2e')][_0x4055('0x30')]?_0x528ff0[_0x4055('0x2e')]:_0xdaf4f9[_0x4055('0x29')];if(!_0x180fbc[_0x4055('0x2b')][_0x4055('0x31')]('nolimit')){_0x528ff0[_0x4055('0x1a')]=qs[_0x4055('0x1a')](_0x180fbc['query']['limit']);_0x528ff0[_0x4055('0x1b')]=qs[_0x4055('0x1b')](_0x180fbc[_0x4055('0x2b')][_0x4055('0x1b')]);}_0x528ff0[_0x4055('0x32')]=qs[_0x4055('0x33')](_0x180fbc[_0x4055('0x2b')][_0x4055('0x33')]);_0x528ff0[_0x4055('0x34')]=qs['filters'](_[_0x4055('0x35')](_0x180fbc[_0x4055('0x2b')],_0xdaf4f9[_0x4055('0x2c')]),_0x20178c);if(_0x180fbc[_0x4055('0x2b')][_0x4055('0x36')]){_0x528ff0[_0x4055('0x34')]=_[_0x4055('0x37')](_0x528ff0[_0x4055('0x34')],{'$or':_[_0x4055('0x25')](_0x20178c,function(_0x3676a4){if(_0x3676a4['type']!=='VIRTUAL'){var _0x451b34={};_0x451b34[_0x3676a4[_0x4055('0x23')]]={'$like':'%'+_0x180fbc['query'][_0x4055('0x36')]+'%'};return _0x451b34;}})});}_0x528ff0=_[_0x4055('0x37')]({},_0x528ff0,_0x180fbc[_0x4055('0x38')]);var _0x3835d5={'where':_0x528ff0[_0x4055('0x34')]};return db[_0x4055('0x26')][_0x4055('0x1c')](_0x3835d5)[_0x4055('0x21')](function(_0x18dfa5){_0x19b189[_0x4055('0x1c')]=_0x18dfa5;if(_0x180fbc[_0x4055('0x2b')][_0x4055('0x39')]){_0x528ff0[_0x4055('0x3a')]=[{'all':!![]}];}return db[_0x4055('0x26')]['findAll'](_0x528ff0);})['then'](function(_0x27cff1){_0x19b189[_0x4055('0x3b')]=_0x27cff1;return _0x19b189;})[_0x4055('0x21')](respondWithFilteredResult(_0x382dbe,_0x528ff0))[_0x4055('0x3c')](handleError(_0x382dbe,null));};exports['show']=function(_0x43e682,_0x207d40){var _0x5d8ef4={'raw':!![],'where':{'id':_0x43e682[_0x4055('0x3d')]['id']}},_0x18cbe1={};_0x18cbe1[_0x4055('0x29')]=_[_0x4055('0x2a')](db[_0x4055('0x26')]['rawAttributes']);_0x18cbe1[_0x4055('0x2b')]=_['keys'](_0x43e682[_0x4055('0x2b')]);_0x18cbe1[_0x4055('0x2c')]=_['intersection'](_0x18cbe1[_0x4055('0x29')],_0x18cbe1[_0x4055('0x2b')]);_0x5d8ef4[_0x4055('0x2e')]=_[_0x4055('0x2d')](_0x18cbe1[_0x4055('0x29')],qs[_0x4055('0x2f')](_0x43e682[_0x4055('0x2b')][_0x4055('0x2f')]));_0x5d8ef4[_0x4055('0x2e')]=_0x5d8ef4[_0x4055('0x2e')][_0x4055('0x30')]?_0x5d8ef4[_0x4055('0x2e')]:_0x18cbe1[_0x4055('0x29')];if(_0x43e682[_0x4055('0x2b')]['includeAll']){_0x5d8ef4['include']=[{'all':!![]}];}_0x5d8ef4=_[_0x4055('0x37')]({},_0x5d8ef4,_0x43e682['options']);return db['JscriptySessionReport']['find'](_0x5d8ef4)[_0x4055('0x21')](handleEntityNotFound(_0x207d40,null))[_0x4055('0x21')](respondWithResult(_0x207d40,null))[_0x4055('0x3c')](handleError(_0x207d40,null));};exports['create']=function(_0x2e0190,_0x74e388){return db[_0x4055('0x26')][_0x4055('0x3e')](_0x2e0190['body'],{})['then'](respondWithResult(_0x74e388,0xc9))[_0x4055('0x3c')](handleError(_0x74e388,null));};exports['update']=function(_0x5cb49d,_0x3ddf9c){if(_0x5cb49d[_0x4055('0x3f')]['id']){delete _0x5cb49d['body']['id'];}return db[_0x4055('0x26')][_0x4055('0x40')]({'where':{'id':_0x5cb49d['params']['id']}})[_0x4055('0x21')](handleEntityNotFound(_0x3ddf9c,null))[_0x4055('0x21')](saveUpdates(_0x5cb49d[_0x4055('0x3f')],null))[_0x4055('0x21')](respondWithResult(_0x3ddf9c,null))[_0x4055('0x3c')](handleError(_0x3ddf9c,null));};exports[_0x4055('0x41')]=function(_0x328e61,_0x38d15c){return db['JscriptySessionReport']['find']({'where':{'id':_0x328e61[_0x4055('0x3d')]['id']}})['then'](handleEntityNotFound(_0x38d15c,null))[_0x4055('0x21')](removeEntity(_0x38d15c,null))[_0x4055('0x3c')](handleError(_0x38d15c,null));};exports[_0x4055('0x42')]=function(_0x569187,_0x2b409e){return db[_0x4055('0x26')]['describe']()[_0x4055('0x21')](respondWithResult(_0x2b409e,null))[_0x4055('0x3c')](handleError(_0x2b409e,null));};exports['getQuestions']=function(_0x4be876,_0x43de6d,_0x4c4d4b){var _0x4bd944={'raw':!![],'where':{}};var _0x289409={};var _0x301eaa={'count':0x0,'rows':[]};return db[_0x4055('0x26')][_0x4055('0x43')]({'where':{'id':_0x4be876[_0x4055('0x3d')]['id']}})['then'](handleEntityNotFound(_0x43de6d,null))[_0x4055('0x21')](function(_0x2ea658){if(_0x2ea658){_0x289409[_0x4055('0x29')]=_['keys'](db[_0x4055('0x44')][_0x4055('0x45')]);_0x289409[_0x4055('0x2b')]=_[_0x4055('0x2a')](_0x4be876[_0x4055('0x2b')]);_0x289409[_0x4055('0x2c')]=_['intersection'](_0x289409[_0x4055('0x29')],_0x289409[_0x4055('0x2b')]);_0x4bd944['attributes']=_['intersection'](_0x289409['model'],qs[_0x4055('0x2f')](_0x4be876[_0x4055('0x2b')][_0x4055('0x2f')]));_0x4bd944[_0x4055('0x2e')]=_0x4bd944[_0x4055('0x2e')][_0x4055('0x30')]?_0x4bd944[_0x4055('0x2e')]:_0x289409[_0x4055('0x29')];if(!_0x4be876[_0x4055('0x2b')][_0x4055('0x31')](_0x4055('0x46'))){_0x4bd944[_0x4055('0x1a')]=qs[_0x4055('0x1a')](_0x4be876[_0x4055('0x2b')][_0x4055('0x1a')]);_0x4bd944[_0x4055('0x1b')]=qs[_0x4055('0x1b')](_0x4be876['query'][_0x4055('0x1b')]);}_0x4bd944[_0x4055('0x32')]=qs[_0x4055('0x33')](_0x4be876[_0x4055('0x2b')]['sort']);_0x4bd944[_0x4055('0x34')]=qs['filters'](_[_0x4055('0x35')](_0x4be876[_0x4055('0x2b')],_0x289409[_0x4055('0x2c')]));_0x4bd944['where'][_0x4055('0x47')]=_0x2ea658['id'];if(_0x4be876[_0x4055('0x2b')][_0x4055('0x36')]){_0x4bd944[_0x4055('0x34')]=_[_0x4055('0x37')](_0x4bd944[_0x4055('0x34')],{'$or':_[_0x4055('0x25')](_0x4bd944[_0x4055('0x2e')],function(_0x5abe5f){var _0x1eeb37={};_0x1eeb37[_0x5abe5f]={'$like':'%'+_0x4be876[_0x4055('0x2b')][_0x4055('0x36')]+'%'};return _0x1eeb37;})});}_0x4bd944=_[_0x4055('0x37')]({},_0x4bd944,_0x4be876[_0x4055('0x38')]);return db['JscriptyQuestionReport'][_0x4055('0x1c')]({'where':_0x4bd944[_0x4055('0x34')]})[_0x4055('0x21')](function(_0x89861f){_0x301eaa[_0x4055('0x1c')]=_0x89861f;if(_0x4be876[_0x4055('0x2b')]['includeAll']){_0x4bd944['include']=[{'all':!![]}];}return db[_0x4055('0x44')][_0x4055('0x48')](_0x4bd944);})['then'](function(_0x22eabe){_0x301eaa[_0x4055('0x3b')]=_0x22eabe;return _0x301eaa;});}})['then'](respondWithFilteredResult(_0x43de6d,_0x4bd944))['catch'](handleError(_0x43de6d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index dd53385..881ad58 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 _0xb091=['moment','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x391c6d,_0x218804){var _0x5df800=function(_0x121afd){while(--_0x121afd){_0x391c6d['push'](_0x391c6d['shift']());}};_0x5df800(++_0x218804);}(_0xb091,0x16e));var _0x1b09=function(_0x27bdaa,_0x5c90e4){_0x27bdaa=_0x27bdaa-0x0;var _0x5b25ae=_0xb091[_0x27bdaa];return _0x5b25ae;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8f=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x333c29,_0x46dfb7){var _0x4aa84b=function(_0x38de80){while(--_0x38de80){_0x333c29['push'](_0x333c29['shift']());}};_0x4aa84b(++_0x46dfb7);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x482662,_0x1051d9){_0x482662=_0x482662-0x0;var _0x222493=_0x6b8f[_0x482662];return _0x222493;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index dac8652..1dccf5e 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 _0x323f=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5eef82,_0x2c35c4){var _0x47a474=function(_0x3448db){while(--_0x3448db){_0x5eef82['push'](_0x5eef82['shift']());}};_0x47a474(++_0x2c35c4);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7a75c17..a5ff056 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 _0xc829=['./license.controller','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1019a6,_0x58c1fe){var _0x222260=function(_0xaa0b4d){while(--_0xaa0b4d){_0x1019a6['push'](_0x1019a6['shift']());}};_0x222260(++_0x58c1fe);}(_0xc829,0x14c));var _0x9c82=function(_0x564e39,_0x404131){_0x564e39=_0x564e39-0x0;var _0x11621f=_0xc829[_0x564e39];return _0x11621f;};'use strict';var multer=require(_0x9c82('0x0'));var util=require('util');var path=require(_0x9c82('0x1'));var timeout=require(_0x9c82('0x2'));var express=require(_0x9c82('0x3'));var router=express['Router']();var fs_extra=require(_0x9c82('0x4'));var auth=require(_0x9c82('0x5'));var interaction=require(_0x9c82('0x6'));var config=require(_0x9c82('0x7'));var controller=require(_0x9c82('0x8'));router['get']('/',controller[_0x9c82('0x9')]);router[_0x9c82('0xa')](_0x9c82('0xb'),auth[_0x9c82('0xc')](),controller[_0x9c82('0xd')]);router['get'](_0x9c82('0xe'),auth[_0x9c82('0xc')](),controller[_0x9c82('0xf')]);module[_0x9c82('0x10')]=router; \ No newline at end of file +var _0xfc33=['update','downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xfc33,0xf0));var _0x3fc3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xfc33[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0x3fc3('0x0'));var util=require(_0x3fc3('0x1'));var path=require(_0x3fc3('0x2'));var timeout=require(_0x3fc3('0x3'));var express=require(_0x3fc3('0x4'));var router=express[_0x3fc3('0x5')]();var fs_extra=require(_0x3fc3('0x6'));var auth=require(_0x3fc3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3fc3('0x8'));var controller=require(_0x3fc3('0x9'));router[_0x3fc3('0xa')]('/',controller[_0x3fc3('0xb')]);router[_0x3fc3('0xc')](_0x3fc3('0xd'),auth[_0x3fc3('0xe')](),controller[_0x3fc3('0xf')]);router['get']('/download_log_file',auth[_0x3fc3('0xe')](),controller[_0x3fc3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b5ef708..d85f604 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 _0x144e=['INTEGER','exports','TEXT','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x144e,0x199));var _0xe144=function(_0x300a78,_0x3962a8){_0x300a78=_0x300a78-0x0;var _0x5bb58c=_0x144e[_0x300a78];return _0x5bb58c;};'use strict';var Sequelize=require('sequelize');module[_0xe144('0x0')]={'license':{'type':Sequelize[_0xe144('0x1')]},'data1':{'type':Sequelize[_0xe144('0x2')]},'data2':{'type':Sequelize[_0xe144('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe144('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5902=['exports','STRING'];(function(_0x51f429,_0x3fb077){var _0x401388=function(_0x5d006a){while(--_0x5d006a){_0x51f429['push'](_0x51f429['shift']());}};_0x401388(++_0x3fb077);}(_0x5902,0x1d6));var _0x2590=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5902[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x2590('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2590('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 0428551..920ee9a 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 _0xca73=['set','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','apply','reject','update','then','destroy','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','/var','log','setHeader','Content-disposition','attachment;\x20filename='];(function(_0x4dbeaa,_0x3fb85d){var _0x889e79=function(_0x737998){while(--_0x737998){_0x4dbeaa['push'](_0x4dbeaa['shift']());}};_0x889e79(++_0x3fb85d);}(_0xca73,0xd0));var _0x3ca7=function(_0x5ca5d3,_0x532add){_0x5ca5d3=_0x5ca5d3-0x0;var _0xb1712d=_0xca73[_0x5ca5d3];return _0xb1712d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ca7('0x0'));var zipdir=require(_0x3ca7('0x1'));var jsonpatch=require(_0x3ca7('0x2'));var rp=require(_0x3ca7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ca7('0x4'));var path=require(_0x3ca7('0x5'));var sox=require(_0x3ca7('0x6'));var csv=require(_0x3ca7('0x7'));var ejs=require(_0x3ca7('0x8'));var fs=require('fs');var fs_extra=require(_0x3ca7('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ca7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3ca7('0xb'));var toCsv=require(_0x3ca7('0x7'));var querystring=require(_0x3ca7('0xc'));var Papa=require(_0x3ca7('0xd'));var Redis=require(_0x3ca7('0xe'));var authService=require(_0x3ca7('0xf'));var qs=require(_0x3ca7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ca7('0x11'));var utils=require(_0x3ca7('0x12'));var config=require(_0x3ca7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ca7('0x14'))['db'];function respondWithStatusCode(_0x47ab00,_0x1fe49e){_0x1fe49e=_0x1fe49e||0xcc;return function(_0x7d2b4b){if(_0x7d2b4b){return _0x47ab00[_0x3ca7('0x15')](_0x1fe49e);}return _0x47ab00['status'](_0x1fe49e)[_0x3ca7('0x16')]();};}function respondWithResult(_0x1e0c2e,_0x2e504c){_0x2e504c=_0x2e504c||0xc8;return function(_0x53b426){if(_0x53b426){return _0x1e0c2e[_0x3ca7('0x17')](_0x2e504c)[_0x3ca7('0x18')](_0x53b426);}};}function respondWithFilteredResult(_0x5bc6b6,_0x253da2){return function(_0x2be675){if(_0x2be675){var _0x1e6290=typeof _0x253da2[_0x3ca7('0x19')]==='undefined'&&typeof _0x253da2['limit']===_0x3ca7('0x1a');var _0x366a95=_0x2be675[_0x3ca7('0x1b')];var _0x1b3325=_0x1e6290?0x0:_0x253da2[_0x3ca7('0x19')];var _0x15d82b=_0x1e6290?_0x2be675[_0x3ca7('0x1b')]:_0x253da2[_0x3ca7('0x19')]+_0x253da2['limit'];var _0x52e6b3;if(_0x15d82b>=_0x366a95){_0x15d82b=_0x366a95;_0x52e6b3=0xc8;}else{_0x52e6b3=0xce;}_0x5bc6b6[_0x3ca7('0x17')](_0x52e6b3);return _0x5bc6b6['set']('Content-Range',_0x1b3325+'-'+_0x15d82b+'/'+_0x366a95)[_0x3ca7('0x18')](_0x2be675);}return null;};}function patchUpdates(_0x2f251e){return function(_0x7e2737){try{jsonpatch[_0x3ca7('0x1c')](_0x7e2737,_0x2f251e,!![]);}catch(_0x5d7f72){return BPromise[_0x3ca7('0x1d')](_0x5d7f72);}return _0x7e2737['save']();};}function saveUpdates(_0x54bc48,_0xbd039c){return function(_0x4f84e9){if(_0x4f84e9){return _0x4f84e9[_0x3ca7('0x1e')](_0x54bc48)[_0x3ca7('0x1f')](function(_0x5a7930){return _0x5a7930;});}return null;};}function removeEntity(_0x438c5b,_0x280669){return function(_0x5e15e2){if(_0x5e15e2){return _0x5e15e2[_0x3ca7('0x20')]()[_0x3ca7('0x1f')](function(){_0x438c5b[_0x3ca7('0x17')](0xcc)[_0x3ca7('0x16')]();});}};}function handleEntityNotFound(_0x1df0c5,_0x422378){return function(_0x325f62){if(!_0x325f62){_0x1df0c5['sendStatus'](0x194);}return _0x325f62;};}function handleError(_0x30de9d,_0x20c033){_0x20c033=_0x20c033||0x1f4;return function(_0x55d85a){logger['error'](_0x55d85a[_0x3ca7('0x21')]);if(_0x55d85a[_0x3ca7('0x22')]){delete _0x55d85a[_0x3ca7('0x22')];}_0x30de9d[_0x3ca7('0x17')](_0x20c033)[_0x3ca7('0x23')](_0x55d85a);};}var utilLicense=require('../../config/license/util');exports[_0x3ca7('0x24')]=function(_0x36540a,_0x145f2d){var _0x52128a={'raw':!![],'where':{'id':0x1}},_0x3e1c8b={};_0x3e1c8b[_0x3ca7('0x25')]=_[_0x3ca7('0x26')](db['License'][_0x3ca7('0x27')]);_0x3e1c8b[_0x3ca7('0x28')]=_['keys'](_0x36540a[_0x3ca7('0x28')]);_0x3e1c8b[_0x3ca7('0x29')]=_[_0x3ca7('0x2a')](_0x3e1c8b[_0x3ca7('0x25')],_0x3e1c8b[_0x3ca7('0x28')]);_0x52128a[_0x3ca7('0x2b')]=_[_0x3ca7('0x2a')](_0x3e1c8b[_0x3ca7('0x25')],qs[_0x3ca7('0x2c')](_0x36540a[_0x3ca7('0x28')]['fields']));_0x52128a[_0x3ca7('0x2b')]=_0x52128a[_0x3ca7('0x2b')][_0x3ca7('0x2d')]?_0x52128a['attributes']:_0x3e1c8b[_0x3ca7('0x25')];_0x52128a=_[_0x3ca7('0x2e')]({},_0x52128a,_0x36540a[_0x3ca7('0x2f')]);return utilLicense[_0x3ca7('0x30')](_0x52128a)[_0x3ca7('0x1f')](respondWithResult(_0x145f2d,null))[_0x3ca7('0x31')](handleError(_0x145f2d,null));};exports[_0x3ca7('0x1e')]=function(_0x328f21,_0x4edded){if(_0x328f21[_0x3ca7('0x32')]['id']){delete _0x328f21['body']['id'];}return db[_0x3ca7('0x33')][_0x3ca7('0x34')]({'where':{'id':_0x328f21[_0x3ca7('0x35')]['id']}})[_0x3ca7('0x1f')](handleEntityNotFound(_0x4edded,null))[_0x3ca7('0x1f')](function(_0x50cbd8){var _0x34de3b=_0x50cbd8[_0x3ca7('0x36')]({'plain':!![]});return utilLicense[_0x3ca7('0x37')](_0x34de3b,_0x328f21[_0x3ca7('0x32')][_0x3ca7('0x38')]);})[_0x3ca7('0x1f')](function(_0x1fe402){if(!_0x1fe402[_0x3ca7('0x39')]){return saveUpdates(_0x328f21[_0x3ca7('0x32')],null);}return _0x1fe402;})[_0x3ca7('0x1f')](respondWithResult(_0x4edded,null))[_0x3ca7('0x31')](handleError(_0x4edded,null));};exports[_0x3ca7('0x3a')]=function(_0x36fba7,_0x13438b){var _0x348126='license-info.log';var _0x52c6a3=path['join'](_0x3ca7('0x3b'),_0x3ca7('0x3c'),'xcally',_0x348126);_0x13438b[_0x3ca7('0x3d')](_0x3ca7('0x3e'),_0x3ca7('0x3f')+_0x348126);_0x13438b[_0x3ca7('0x40')](_0x3ca7('0x41'),_0x3ca7('0x42'));_0x13438b[_0x3ca7('0x43')](_0x52c6a3);}; \ No newline at end of file +var _0xe9cd=['send','index','keys','query','model','intersection','attributes','length','options','getLicense','catch','License','find','get','checkLicense','body','demo','license-info.log','join','/var','log','Content-disposition','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe9cd,0x12b));var _0xde9c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe9cd[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xde9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde9c('0x1'));var jsonpatch=require(_0xde9c('0x2'));var rp=require(_0xde9c('0x3'));var moment=require(_0xde9c('0x4'));var BPromise=require(_0xde9c('0x5'));var Mustache=require(_0xde9c('0x6'));var util=require(_0xde9c('0x7'));var path=require(_0xde9c('0x8'));var sox=require(_0xde9c('0x9'));var csv=require(_0xde9c('0xa'));var ejs=require(_0xde9c('0xb'));var fs=require('fs');var fs_extra=require(_0xde9c('0xc'));var _=require('lodash');var squel=require(_0xde9c('0xd'));var crypto=require(_0xde9c('0xe'));var jsforce=require(_0xde9c('0xf'));var deskjs=require(_0xde9c('0x10'));var toCsv=require(_0xde9c('0xa'));var querystring=require(_0xde9c('0x11'));var Papa=require(_0xde9c('0x12'));var Redis=require(_0xde9c('0x13'));var authService=require(_0xde9c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xde9c('0x15'));var hardwareService=require(_0xde9c('0x16'));var logger=require(_0xde9c('0x17'))('api');var utils=require(_0xde9c('0x18'));var config=require(_0xde9c('0x19'));var licenseUtil=require(_0xde9c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124f4e,_0x119539){_0x119539=_0x119539||0xcc;return function(_0x1f4f49){if(_0x1f4f49){return _0x124f4e['sendStatus'](_0x119539);}return _0x124f4e[_0xde9c('0x1b')](_0x119539)[_0xde9c('0x1c')]();};}function respondWithResult(_0x1568c6,_0x535618){_0x535618=_0x535618||0xc8;return function(_0x499327){if(_0x499327){return _0x1568c6[_0xde9c('0x1b')](_0x535618)[_0xde9c('0x1d')](_0x499327);}};}function respondWithFilteredResult(_0x2684c0,_0x1c6835){return function(_0x54c260){if(_0x54c260){var _0xb54540=typeof _0x1c6835[_0xde9c('0x1e')]==='undefined'&&typeof _0x1c6835[_0xde9c('0x1f')]===_0xde9c('0x20');var _0x43fe6e=_0x54c260[_0xde9c('0x21')];var _0x42e677=_0xb54540?0x0:_0x1c6835[_0xde9c('0x1e')];var _0xfe79b2=_0xb54540?_0x54c260[_0xde9c('0x21')]:_0x1c6835[_0xde9c('0x1e')]+_0x1c6835['limit'];var _0x36695a;if(_0xfe79b2>=_0x43fe6e){_0xfe79b2=_0x43fe6e;_0x36695a=0xc8;}else{_0x36695a=0xce;}_0x2684c0[_0xde9c('0x1b')](_0x36695a);return _0x2684c0[_0xde9c('0x22')](_0xde9c('0x23'),_0x42e677+'-'+_0xfe79b2+'/'+_0x43fe6e)['json'](_0x54c260);}return null;};}function patchUpdates(_0x13f32a){return function(_0x12fa66){try{jsonpatch[_0xde9c('0x24')](_0x12fa66,_0x13f32a,!![]);}catch(_0xc08bd){return BPromise[_0xde9c('0x25')](_0xc08bd);}return _0x12fa66[_0xde9c('0x26')]();};}function saveUpdates(_0x215513,_0xcf7494){return function(_0x3e9a65){if(_0x3e9a65){return _0x3e9a65[_0xde9c('0x27')](_0x215513)[_0xde9c('0x28')](function(_0x1221b9){return _0x1221b9;});}return null;};}function removeEntity(_0x2e1fa7,_0xebb25f){return function(_0x4f5dc4){if(_0x4f5dc4){return _0x4f5dc4[_0xde9c('0x29')]()['then'](function(){_0x2e1fa7[_0xde9c('0x1b')](0xcc)[_0xde9c('0x1c')]();});}};}function handleEntityNotFound(_0x33d8b8,_0x16a097){return function(_0x47fb62){if(!_0x47fb62){_0x33d8b8[_0xde9c('0x2a')](0x194);}return _0x47fb62;};}function handleError(_0xc8bb2d,_0x2b1e21){_0x2b1e21=_0x2b1e21||0x1f4;return function(_0x274309){logger[_0xde9c('0x2b')](_0x274309[_0xde9c('0x2c')]);if(_0x274309[_0xde9c('0x2d')]){delete _0x274309[_0xde9c('0x2d')];}_0xc8bb2d[_0xde9c('0x1b')](_0x2b1e21)[_0xde9c('0x2e')](_0x274309);};}var utilLicense=require(_0xde9c('0x1a'));exports[_0xde9c('0x2f')]=function(_0x2a711d,_0x1271c6){var _0x7c4527={'raw':!![],'where':{'id':0x1}},_0x425c95={};_0x425c95['model']=_[_0xde9c('0x30')](db['License']['rawAttributes']);_0x425c95[_0xde9c('0x31')]=_[_0xde9c('0x30')](_0x2a711d[_0xde9c('0x31')]);_0x425c95['filters']=_['intersection'](_0x425c95[_0xde9c('0x32')],_0x425c95[_0xde9c('0x31')]);_0x7c4527['attributes']=_[_0xde9c('0x33')](_0x425c95['model'],qs['fields'](_0x2a711d[_0xde9c('0x31')]['fields']));_0x7c4527[_0xde9c('0x34')]=_0x7c4527[_0xde9c('0x34')][_0xde9c('0x35')]?_0x7c4527[_0xde9c('0x34')]:_0x425c95[_0xde9c('0x32')];_0x7c4527=_['merge']({},_0x7c4527,_0x2a711d[_0xde9c('0x36')]);return utilLicense[_0xde9c('0x37')](_0x7c4527)['then'](respondWithResult(_0x1271c6,null))[_0xde9c('0x38')](handleError(_0x1271c6,null));};exports[_0xde9c('0x27')]=function(_0x483d92,_0x57d333){if(_0x483d92['body']['id']){delete _0x483d92['body']['id'];}return db[_0xde9c('0x39')][_0xde9c('0x3a')]({'where':{'id':_0x483d92['params']['id']}})[_0xde9c('0x28')](handleEntityNotFound(_0x57d333,null))[_0xde9c('0x28')](function(_0x22284e){var _0x40f713=_0x22284e[_0xde9c('0x3b')]({'plain':!![]});return utilLicense[_0xde9c('0x3c')](_0x40f713,_0x483d92[_0xde9c('0x3d')]['key']);})[_0xde9c('0x28')](function(_0x52c12a){if(!_0x52c12a[_0xde9c('0x3e')]){return saveUpdates(_0x483d92[_0xde9c('0x3d')],null);}return _0x52c12a;})[_0xde9c('0x28')](respondWithResult(_0x57d333,null))[_0xde9c('0x38')](handleError(_0x57d333,null));};exports['downloadLogFile']=function(_0x183cfd,_0x4d7dfb){var _0x3b32a3=_0xde9c('0x3f');var _0x3b0344=path[_0xde9c('0x40')](_0xde9c('0x41'),_0xde9c('0x42'),'xcally',_0x3b32a3);_0x4d7dfb['setHeader'](_0xde9c('0x43'),'attachment;\x20filename='+_0x3b32a3);_0x4d7dfb['set']('Content-Type','text/plain');_0x4d7dfb[_0xde9c('0x44')](_0x3b0344);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c9d35a8..c62c6b6 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 _0xefcc=['moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','../../config/logger','api'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xefcc,0x98));var _0xcefc=function(_0x176390,_0x547139){_0x176390=_0x176390-0x0;var _0x20f96b=_0xefcc[_0x176390];return _0x20f96b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcefc('0x0'))(_0xcefc('0x1'));var moment=require(_0xcefc('0x2'));var BPromise=require('bluebird');var rp=require(_0xcefc('0x3'));var fs=require('fs');var path=require(_0xcefc('0x4'));var rimraf=require(_0xcefc('0x5'));var config=require(_0xcefc('0x6'));var attributes=require(_0xcefc('0x7'));module['exports']=function(_0xe82936,_0x4a8321){return _0xe82936[_0xcefc('0x8')](_0xcefc('0x9'),attributes,{'tableName':_0xcefc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d64=['license','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x305ad1,_0x2d9379){var _0x385713=function(_0x4a16db){while(--_0x4a16db){_0x305ad1['push'](_0x305ad1['shift']());}};_0x385713(++_0x2d9379);}(_0x7d64,0xd9));var _0x47d6=function(_0x2a833c,_0x4ecd5d){_0x2a833c=_0x2a833c-0x0;var _0x49f618=_0x7d64[_0x2a833c];return _0x49f618;};'use strict';var _=require(_0x47d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x47d6('0x1'));var moment=require(_0x47d6('0x2'));var BPromise=require(_0x47d6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47d6('0x4'));var rimraf=require(_0x47d6('0x5'));var config=require(_0x47d6('0x6'));var attributes=require(_0x47d6('0x7'));module[_0x47d6('0x8')]=function(_0x5da7de,_0x14e9a5){return _0x5da7de[_0x47d6('0x9')](_0x47d6('0xa'),attributes,{'tableName':_0x47d6('0xb'),'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 4a88696..3e4ab63 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 _0xa003=['../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x11dbfc,_0x466d76){var _0x532257=function(_0x50527d){while(--_0x50527d){_0x11dbfc['push'](_0x11dbfc['shift']());}};_0x532257(++_0x466d76);}(_0xa003,0x1c7));var _0x3a00=function(_0x5c6aa3,_0x4cd43e){_0x5c6aa3=_0x5c6aa3-0x0;var _0x1769bd=_0xa003[_0x5c6aa3];return _0x1769bd;};'use strict';var _=require('lodash');var util=require(_0x3a00('0x0'));var moment=require(_0x3a00('0x1'));var BPromise=require(_0x3a00('0x2'));var rs=require(_0x3a00('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a00('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a00('0x5'))(_0x3a00('0x6'));var config=require(_0x3a00('0x7'));var jayson=require(_0x3a00('0x8'));var client=jayson[_0x3a00('0x9')][_0x3a00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2270fc,_0xad3d77,_0x4ad865){return new BPromise(function(_0x19a72e,_0x47e066){return client[_0x3a00('0xb')](_0x2270fc,_0x4ad865)[_0x3a00('0xc')](function(_0x40938b){logger['info'](_0x3a00('0xd'),_0xad3d77,_0x3a00('0xe'));logger[_0x3a00('0xf')]('License,\x20%s,\x20%s,\x20%s',_0xad3d77,'request\x20sent',JSON['stringify'](_0x40938b));if(_0x40938b[_0x3a00('0x10')]){if(_0x40938b[_0x3a00('0x10')][_0x3a00('0x11')]===0x1f4){logger[_0x3a00('0x10')](_0x3a00('0xd'),_0xad3d77,_0x40938b[_0x3a00('0x10')]['message']);return _0x47e066(_0x40938b[_0x3a00('0x10')][_0x3a00('0x12')]);}logger['error'](_0x3a00('0xd'),_0xad3d77,_0x40938b['error'][_0x3a00('0x12')]);return _0x19a72e(_0x40938b[_0x3a00('0x10')][_0x3a00('0x12')]);}else{logger[_0x3a00('0x13')](_0x3a00('0xd'),_0xad3d77,'request\x20sent');_0x19a72e(_0x40938b[_0x3a00('0x14')][_0x3a00('0x12')]);}})[_0x3a00('0x15')](function(_0x5819ea){logger[_0x3a00('0x10')](_0x3a00('0xd'),_0xad3d77,_0x5819ea);_0x47e066(_0x5819ea);});});} \ No newline at end of file +var _0x51c6=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x59e255,_0x193b15){var _0x5a81b3=function(_0x125e84){while(--_0x125e84){_0x59e255['push'](_0x59e255['shift']());}};_0x5a81b3(++_0x193b15);}(_0x51c6,0x1ca));var _0x651c=function(_0x56acf6,_0xb13a2d){_0x56acf6=_0x56acf6-0x0;var _0x488d60=_0x51c6[_0x56acf6];return _0x488d60;};'use strict';var _=require(_0x651c('0x0'));var util=require(_0x651c('0x1'));var moment=require(_0x651c('0x2'));var BPromise=require(_0x651c('0x3'));var rs=require(_0x651c('0x4'));var fs=require('fs');var Redis=require(_0x651c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x651c('0x6'));var logger=require('../../config/logger')(_0x651c('0x7'));var config=require('../../config/environment');var jayson=require(_0x651c('0x8'));var client=jayson[_0x651c('0x9')][_0x651c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aacfb,_0x1bb78a,_0x32d419){return new BPromise(function(_0x2bbe87,_0xf634a1){return client[_0x651c('0xb')](_0x1aacfb,_0x32d419)[_0x651c('0xc')](function(_0x2b18c1){logger[_0x651c('0xd')](_0x651c('0xe'),_0x1bb78a,'request\x20sent');logger['debug'](_0x651c('0xf'),_0x1bb78a,_0x651c('0x10'),JSON[_0x651c('0x11')](_0x2b18c1));if(_0x2b18c1[_0x651c('0x12')]){if(_0x2b18c1[_0x651c('0x12')][_0x651c('0x13')]===0x1f4){logger[_0x651c('0x12')](_0x651c('0xe'),_0x1bb78a,_0x2b18c1[_0x651c('0x12')][_0x651c('0x14')]);return _0xf634a1(_0x2b18c1[_0x651c('0x12')][_0x651c('0x14')]);}logger[_0x651c('0x12')](_0x651c('0xe'),_0x1bb78a,_0x2b18c1[_0x651c('0x12')]['message']);return _0x2bbe87(_0x2b18c1[_0x651c('0x12')][_0x651c('0x14')]);}else{logger['info'](_0x651c('0xe'),_0x1bb78a,_0x651c('0x10'));_0x2bbe87(_0x2b18c1[_0x651c('0x15')][_0x651c('0x14')]);}})[_0x651c('0x16')](function(_0x2cb617){logger[_0x651c('0x12')]('License,\x20%s,\x20%s',_0x1bb78a,_0x2cb617);_0xf634a1(_0x2cb617);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a92eb2e..45b29c1 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 _0xbe4d=['/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0xbe4d,0x18d));var _0xdbe4=function(_0x123518,_0x406834){_0x123518=_0x123518-0x0;var _0x2607eb=_0xbe4d[_0x123518];return _0x2607eb;};'use strict';var multer=require(_0xdbe4('0x0'));var util=require(_0xdbe4('0x1'));var path=require(_0xdbe4('0x2'));var timeout=require(_0xdbe4('0x3'));var express=require(_0xdbe4('0x4'));var router=express[_0xdbe4('0x5')]();var fs_extra=require(_0xdbe4('0x6'));var auth=require(_0xdbe4('0x7'));var interaction=require(_0xdbe4('0x8'));var config=require(_0xdbe4('0x9'));var controller=require(_0xdbe4('0xa'));router[_0xdbe4('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbe4('0xc')]);router[_0xdbe4('0xb')](_0xdbe4('0xd'),auth[_0xdbe4('0xe')](),controller['describe']);router['get'](_0xdbe4('0xf'),auth[_0xdbe4('0xe')](),controller['show']);router[_0xdbe4('0xb')](_0xdbe4('0x10'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x11')]);router[_0xdbe4('0xb')](_0xdbe4('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xdbe4('0xb')](_0xdbe4('0x13'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x14')]);router[_0xdbe4('0xb')]('/:id/out_servers',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x15')]);router[_0xdbe4('0xb')](_0xdbe4('0x16'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x17')]);router[_0xdbe4('0xb')](_0xdbe4('0x18'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x19')]);router[_0xdbe4('0xb')]('/:id/messages',auth[_0xdbe4('0xe')](),controller['getMessages']);router[_0xdbe4('0xb')](_0xdbe4('0x1a'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x1b')]);router[_0xdbe4('0xb')](_0xdbe4('0x1c'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x1d')]);router[_0xdbe4('0x1e')]('/:id/dispositions',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x1f')]);router[_0xdbe4('0x1e')](_0xdbe4('0x12'),auth['isAuthenticated'](),controller[_0xdbe4('0x20')]);router['post']('/',auth[_0xdbe4('0xe')](),controller['create']);router['post']('/:id/in_servers',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x21')]);router[_0xdbe4('0x1e')]('/:id/out_servers',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x22')]);router['post'](_0xdbe4('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xdbe4('0x1e')](_0xdbe4('0x18'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x23')]);router[_0xdbe4('0x1e')](_0xdbe4('0x24'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x25')]);router['post']('/:id/users',auth[_0xdbe4('0xe')](),controller['addAgents']);router[_0xdbe4('0x26')](_0xdbe4('0xf'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x27')]);router[_0xdbe4('0x28')](_0xdbe4('0x10'),auth['isAuthenticated'](),controller[_0xdbe4('0x29')]);router['delete'](_0xdbe4('0x12'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x2a')]);router[_0xdbe4('0x28')](_0xdbe4('0x13'),auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x2b')]);router[_0xdbe4('0x28')]('/:id/out_servers',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x2c')]);router[_0xdbe4('0x28')]('/:id',auth[_0xdbe4('0xe')](),controller[_0xdbe4('0x2d')]);router['delete']('/:id/users',auth[_0xdbe4('0xe')](),controller['removeAgents']);module[_0xdbe4('0x2e')]=router; \ No newline at end of file +var _0xe915=['update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put'];(function(_0x38f131,_0x58abf3){var _0x5af71e=function(_0x29a42b){while(--_0x29a42b){_0x38f131['push'](_0x38f131['shift']());}};_0x5af71e(++_0x58abf3);}(_0xe915,0x10f));var _0x5e91=function(_0x1a585f,_0x18f8bb){_0x1a585f=_0x1a585f-0x0;var _0x791d82=_0xe915[_0x1a585f];return _0x791d82;};'use strict';var multer=require('multer');var util=require(_0x5e91('0x0'));var path=require('path');var timeout=require(_0x5e91('0x1'));var express=require('express');var router=express[_0x5e91('0x2')]();var fs_extra=require(_0x5e91('0x3'));var auth=require(_0x5e91('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x5e91('0x5')]('/',auth[_0x5e91('0x6')](),controller[_0x5e91('0x7')]);router[_0x5e91('0x5')]('/describe',auth[_0x5e91('0x6')](),controller[_0x5e91('0x8')]);router['get'](_0x5e91('0x9'),auth['isAuthenticated'](),controller[_0x5e91('0xa')]);router[_0x5e91('0x5')]('/:id/dispositions',auth[_0x5e91('0x6')](),controller[_0x5e91('0xb')]);router[_0x5e91('0x5')](_0x5e91('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5e91('0x5')](_0x5e91('0xd'),auth[_0x5e91('0x6')](),controller[_0x5e91('0xe')]);router[_0x5e91('0x5')](_0x5e91('0xf'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x10')]);router[_0x5e91('0x5')](_0x5e91('0x11'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x12')]);router[_0x5e91('0x5')]('/:id/applications',auth[_0x5e91('0x6')](),controller[_0x5e91('0x13')]);router[_0x5e91('0x5')](_0x5e91('0x14'),auth[_0x5e91('0x6')](),controller['getMessages']);router['get'](_0x5e91('0x15'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x16')]);router[_0x5e91('0x5')]('/:id/users',auth['isAuthenticated'](),controller[_0x5e91('0x17')]);router[_0x5e91('0x18')](_0x5e91('0x19'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x1a')]);router['post'](_0x5e91('0xc'),auth['isAuthenticated'](),controller[_0x5e91('0x1b')]);router['post']('/',auth[_0x5e91('0x6')](),controller['create']);router[_0x5e91('0x18')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x5e91('0x1c')]);router['post'](_0x5e91('0xf'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x1d')]);router[_0x5e91('0x18')](_0x5e91('0x11'),auth['isAuthenticated'](),controller[_0x5e91('0x1e')]);router[_0x5e91('0x18')]('/:id/applications',auth[_0x5e91('0x6')](),controller[_0x5e91('0x1f')]);router[_0x5e91('0x18')](_0x5e91('0x20'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x21')]);router[_0x5e91('0x18')](_0x5e91('0x22'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x23')]);router[_0x5e91('0x24')](_0x5e91('0x9'),auth['isAuthenticated'](),controller[_0x5e91('0x25')]);router['delete']('/:id/dispositions',auth[_0x5e91('0x6')](),controller[_0x5e91('0x26')]);router['delete'](_0x5e91('0xc'),auth[_0x5e91('0x6')](),controller['removeAnswers']);router[_0x5e91('0x27')](_0x5e91('0xd'),auth['isAuthenticated'](),controller[_0x5e91('0x28')]);router[_0x5e91('0x27')](_0x5e91('0xf'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x29')]);router[_0x5e91('0x27')]('/:id',auth[_0x5e91('0x6')](),controller[_0x5e91('0x2a')]);router[_0x5e91('0x27')](_0x5e91('0x22'),auth[_0x5e91('0x6')](),controller[_0x5e91('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 39ed6d6..2d9d784 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 _0xa808=['mandatoryDispositionPauseId','mandatoryDisposition','gmail','yahoo','outlook365','getDataValue','provider','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5c7dd2,_0xa7f3f2){var _0x512735=function(_0x375195){while(--_0x375195){_0x5c7dd2['push'](_0x5c7dd2['shift']());}};_0x512735(++_0xa7f3f2);}(_0xa808,0x139));var _0x8a80=function(_0x2e885f,_0x4a71dd){_0x2e885f=_0x2e885f-0x0;var _0x1fe294=_0xa808[_0x2e885f];return _0x1fe294;};'use strict';var Sequelize=require(_0x8a80('0x0'));module['exports']={'description':{'type':Sequelize[_0x8a80('0x1')]},'name':{'type':Sequelize[_0x8a80('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8a80('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x8a80('0x3')]},'markAsUnread':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8a80('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x8a80('0x4')](0x2)[_0x8a80('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8a80('0x3')],'defaultValue':function(){return _0x8a80('0x6');}},'notificationSound':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8a80('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a80('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a80('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a80('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x8a80('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x8a80('0x2')],'defaultValue':![],'comment':_0x8a80('0x8'),'set':function(_0x3b1087){if(!_0x3b1087)this[_0x8a80('0x9')](_0x8a80('0xa'),null);this[_0x8a80('0x9')](_0x8a80('0xb'),_0x3b1087);}},'provider':{'type':Sequelize['ENUM'](_0x8a80('0xc'),'hotmail',_0x8a80('0xd'),_0x8a80('0xe')),'defaultValue':null,'get':function(){var _0x494478=this[_0x8a80('0xf')]('provider');return _0x494478||'custom';},'set':function(_0x51d148){if(_0x51d148==='custom'){_0x51d148=null;}return this[_0x8a80('0x9')](_0x8a80('0x10'),_0x51d148);}}}; \ No newline at end of file +var _0x96ae=['setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1c8253,_0x1c4de2){var _0x380d59=function(_0x5bbf67){while(--_0x5bbf67){_0x1c8253['push'](_0x1c8253['shift']());}};_0x380d59(++_0x1c4de2);}(_0x96ae,0xee));var _0xe96a=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0x96ae[_0x38894d];return _0x5614fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe96a('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe96a('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xe96a('0x2')]},'markAsUnread':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe96a('0x0')],'allowNull':![],'defaultValue':_0xe96a('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xe96a('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe96a('0x2')],'defaultValue':function(){return _0xe96a('0x5');}},'notificationSound':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe96a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe96a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe96a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe96a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xe96a('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe96a('0x1')],'defaultValue':![],'comment':_0xe96a('0x8'),'set':function(_0x474b37){if(!_0x474b37)this[_0xe96a('0x9')]('mandatoryDispositionPauseId',null);this[_0xe96a('0x9')](_0xe96a('0xa'),_0x474b37);}},'provider':{'type':Sequelize[_0xe96a('0xb')](_0xe96a('0xc'),_0xe96a('0xd'),_0xe96a('0xe'),_0xe96a('0xf')),'defaultValue':null,'get':function(){var _0xe0fb55=this[_0xe96a('0x10')](_0xe96a('0x11'));return _0xe0fb55||'custom';},'set':function(_0x44cba1){if(_0x44cba1===_0xe96a('0x12')){_0x44cba1=null;}return this[_0xe96a('0x9')]('provider',_0x44cba1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9e879dd..da17d2b 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 _0x99b2=['MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','MailInteraction','addInteraction','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','CmContact','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','service','authentication','username','Imap','Smtp','index','MailServerIn','Pause','MailAccount','rawAttributes','map','keys','query','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','type','include','findAll','mandatoryDispositionPause','length','includeAll','options','find','body','provider','custom','secure','params'];(function(_0xca04ff,_0xcb449f){var _0x6b547=function(_0xc91e4b){while(--_0xc91e4b){_0xca04ff['push'](_0xca04ff['shift']());}};_0x6b547(++_0xcb449f);}(_0x99b2,0x1e1));var _0x299b=function(_0x2b0006,_0x2c0f23){_0x2b0006=_0x2b0006-0x0;var _0x5b284b=_0x99b2[_0x2b0006];return _0x5b284b;};'use strict';var moment=require(_0x299b('0x0'));var BPromise=require('bluebird');var util=require(_0x299b('0x1'));var path=require(_0x299b('0x2'));var _=require(_0x299b('0x3'));var juice=require(_0x299b('0x4'));var Redis=require('ioredis');var qs=require(_0x299b('0x5'));var logger=require(_0x299b('0x6'))('api');var config=require(_0x299b('0x7'));var db=require(_0x299b('0x8'))['db'];config[_0x299b('0x9')]=_['defaults'](config['redis'],{'host':_0x299b('0xa'),'port':0x18eb});var socket=require(_0x299b('0xb'))(new Redis(config['redis']));require(_0x299b('0xc'))[_0x299b('0xd')](socket);var jayson=require(_0x299b('0xe'));var client=jayson[_0x299b('0xf')][_0x299b('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x2426f2,_0x5155f2,_0x3abf88,_0x2c69da){return new BPromise(function(_0x36dbf4,_0x3c0666){var _0x48b254=_0x2c69da||client;return _0x48b254[_0x299b('0x11')](_0x2426f2,_0x3abf88)[_0x299b('0x12')](function(_0x11708c){logger[_0x299b('0x13')](_0x299b('0x14'),_0x5155f2,_0x299b('0x15'));logger[_0x299b('0x16')](_0x299b('0x17'),_0x5155f2,'request\x20sent',JSON[_0x299b('0x18')](_0x11708c));if(_0x11708c[_0x299b('0x19')]){if(_0x11708c[_0x299b('0x19')][_0x299b('0x1a')]===0x1f4){logger[_0x299b('0x19')](_0x299b('0x14'),_0x5155f2,_0x11708c[_0x299b('0x19')]['message']);return _0x3c0666(_0x11708c[_0x299b('0x19')][_0x299b('0x1b')]);}logger['error'](_0x299b('0x14'),_0x5155f2,_0x11708c[_0x299b('0x19')][_0x299b('0x1b')]);return _0x36dbf4(_0x11708c[_0x299b('0x19')][_0x299b('0x1b')]);}else{logger[_0x299b('0x13')](_0x299b('0x14'),_0x5155f2,_0x299b('0x15'));_0x36dbf4(_0x11708c['result']['message']);}})[_0x299b('0x1c')](function(_0x17ae13){logger[_0x299b('0x19')](_0x299b('0x14'),_0x5155f2,_0x17ae13);_0x3c0666(_0x17ae13);});});}function respondWithStatusCode(_0x151414,_0x5f0e9d){_0x5f0e9d=_0x5f0e9d||0xcc;return function(_0x209bff){if(_0x209bff){return _0x151414[_0x299b('0x1d')](_0x5f0e9d);}return _0x151414[_0x299b('0x1e')](_0x5f0e9d)['end']();};}function respondWithResult(_0x354dc6,_0x3bba77){_0x3bba77=_0x3bba77||0xc8;return function(_0x77da6){if(_0x77da6){return _0x354dc6['status'](_0x3bba77)[_0x299b('0x1f')](_0x77da6);}};}function respondWithFilteredResult(_0xa26210,_0x1354be){return function(_0x2b333a){if(_0x2b333a){var _0x5b4a38=typeof _0x1354be['offset']===_0x299b('0x20')&&typeof _0x1354be[_0x299b('0x21')]===_0x299b('0x20');var _0xd9a5f1=_0x2b333a[_0x299b('0x22')];var _0x3373fc=_0x5b4a38?0x0:_0x1354be[_0x299b('0x23')];var _0x4df7d5=_0x5b4a38?_0x2b333a[_0x299b('0x22')]:_0x1354be['offset']+_0x1354be[_0x299b('0x21')];var _0x59a8f0;if(_0x4df7d5>=_0xd9a5f1){_0x4df7d5=_0xd9a5f1;_0x59a8f0=0xc8;}else{_0x59a8f0=0xce;}_0xa26210[_0x299b('0x1e')](_0x59a8f0);return _0xa26210[_0x299b('0x24')](_0x299b('0x25'),_0x3373fc+'-'+_0x4df7d5+'/'+_0xd9a5f1)[_0x299b('0x1f')](_0x2b333a);}return null;};}function saveUpdates(_0x461df3){return function(_0x239441){if(_0x239441){return _0x239441[_0x299b('0x26')](_0x461df3)[_0x299b('0x12')](function(_0x37207f){return _0x37207f;});}return null;};}function removeEntity(_0x277df6){return function(_0x358608){if(_0x358608){return _0x358608[_0x299b('0x27')]()['then'](function(){var _0x5e9681=_0x358608[_0x299b('0x28')]({'plain':!![]});var _0x251585=_0x299b('0x29');return db[_0x299b('0x2a')][_0x299b('0x27')]({'where':{'type':_0x251585,'resourceId':_0x5e9681['id']}})['then'](function(){return _0x358608;});})[_0x299b('0x12')](function(){_0x277df6[_0x299b('0x1e')](0xcc)[_0x299b('0x2b')]();});}};}function handleEntityNotFound(_0x3310fb){return function(_0x179b73){if(!_0x179b73){_0x3310fb['sendStatus'](0x194);}return _0x179b73;};}function handleError(_0x56c134,_0x4d342a){_0x4d342a=_0x4d342a||0x1f4;return function(_0x53c3f7){logger[_0x299b('0x19')](_0x53c3f7[_0x299b('0x2c')]);if(_0x53c3f7[_0x299b('0x2d')]){delete _0x53c3f7[_0x299b('0x2d')];}_0x56c134[_0x299b('0x1e')](_0x4d342a)[_0x299b('0x2e')](_0x53c3f7);};}function getImapHost(_0x2e3a6e){switch(_0x2e3a6e){case _0x299b('0x2f'):return'imap.gmail.com';case _0x299b('0x30'):return _0x299b('0x31');case _0x299b('0x32'):return'imap-mail.outlook.com';case _0x299b('0x33'):return'outlook.office365.com';}throw new Error(_0x299b('0x34'),_0x2e3a6e);}function getSmtpHost(_0x2bb0ee){switch(_0x2bb0ee){case _0x299b('0x2f'):return _0x299b('0x35');case _0x299b('0x30'):return _0x299b('0x36');case _0x299b('0x32'):return _0x299b('0x37');case _0x299b('0x33'):return _0x299b('0x38');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2bb0ee);}function getAuthenticationOptions(_0x8733c6,_0x1b7b4f){var _0x31d871={};var _0x2a5f54={};if(_0x8733c6){_0x31d871[_0x299b('0x39')]=_0x2a5f54['user']=_0x1b7b4f['username'];_0x31d871[_0x299b('0x3a')]=_0x2a5f54['pass']=_0x1b7b4f['password'];if(_0x1b7b4f[_0x299b('0x3b')]){_0x31d871[_0x299b('0x3b')]=_0x2a5f54[_0x299b('0x3b')]=!![];_0x31d871[_0x299b('0x3c')]=_0x2a5f54['CloudProviderId']=_0x1b7b4f[_0x299b('0x3c')];_0x31d871[_0x299b('0x3a')]=_0x2a5f54[_0x299b('0x3d')]=null;}else{_0x31d871[_0x299b('0x3c')]=_0x2a5f54[_0x299b('0x3c')]=null;}_0x31d871[_0x299b('0x3e')]=getImapHost(_0x8733c6);_0x31d871[_0x299b('0x3f')]=0x3e1;_0x2a5f54[_0x299b('0x3e')]=getSmtpHost(_0x8733c6);_0x2a5f54[_0x299b('0x3f')]=0x24b;_0x2a5f54['secure']=![];_0x31d871[_0x299b('0x40')]=_0x2a5f54['service']=null;}else{if(_0x1b7b4f[_0x299b('0x41')]){_0x31d871['user']=_0x2a5f54[_0x299b('0x39')]=_0x1b7b4f[_0x299b('0x42')];_0x31d871[_0x299b('0x3a')]=_0x2a5f54[_0x299b('0x3d')]=_0x1b7b4f['password'];}else{_0x31d871['authentication']=_0x2a5f54[_0x299b('0x41')]=![];_0x31d871[_0x299b('0x39')]=_0x2a5f54[_0x299b('0x39')]=null;_0x31d871[_0x299b('0x3a')]=_0x2a5f54[_0x299b('0x3d')]=null;}_0x31d871['host']=_0x1b7b4f['Imap']['host'];_0x31d871[_0x299b('0x3f')]=_0x1b7b4f[_0x299b('0x43')][_0x299b('0x3f')];_0x2a5f54[_0x299b('0x3e')]=_0x1b7b4f[_0x299b('0x44')]['host'];_0x2a5f54['port']=_0x1b7b4f['Smtp'][_0x299b('0x3f')];}return{'Imap':_0x31d871,'Smtp':_0x2a5f54};}exports[_0x299b('0x45')]=function(_0x3babcf,_0x526ad7){var _0x4d9136={'include':[{'model':db[_0x299b('0x46')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x299b('0x44')},{'model':db[_0x299b('0x47')],'as':'mandatoryDispositionPause'}]},_0x285c06={},_0x15387f={'count':0x0,'rows':[]};var _0x390254=_['map'](db[_0x299b('0x48')][_0x299b('0x49')],function(_0x441ff){return{'name':_0x441ff['fieldName'],'type':_0x441ff['type']['key']};});_0x285c06['model']=_[_0x299b('0x4a')](_0x390254,_0x299b('0x2d'));_0x285c06['query']=_[_0x299b('0x4b')](_0x3babcf[_0x299b('0x4c')]);_0x285c06[_0x299b('0x4d')]=_[_0x299b('0x4e')](_0x285c06[_0x299b('0x4f')],_0x285c06[_0x299b('0x4c')]);_0x4d9136['attributes']=_['intersection'](_0x285c06['model'],qs[_0x299b('0x50')](_0x3babcf['query']['fields']));_0x4d9136['attributes']=_0x4d9136[_0x299b('0x51')]['length']?_0x4d9136['attributes']:_0x285c06['model'];if(!_0x3babcf[_0x299b('0x4c')]['hasOwnProperty']('nolimit')){_0x4d9136['limit']=qs[_0x299b('0x21')](_0x3babcf['query'][_0x299b('0x21')]);_0x4d9136[_0x299b('0x23')]=qs[_0x299b('0x23')](_0x3babcf['query']['offset']);}_0x4d9136[_0x299b('0x52')]=qs[_0x299b('0x53')](_0x3babcf[_0x299b('0x4c')][_0x299b('0x53')]);_0x4d9136[_0x299b('0x54')]=qs[_0x299b('0x4d')](_[_0x299b('0x55')](_0x3babcf['query'],_0x285c06['filters']),_0x390254);if(_0x3babcf[_0x299b('0x4c')][_0x299b('0x56')]){_0x4d9136[_0x299b('0x54')]=_[_0x299b('0x57')](_0x4d9136[_0x299b('0x54')],{'$or':_[_0x299b('0x4a')](_0x390254,function(_0x37a2e2){if(_0x37a2e2[_0x299b('0x58')]!=='VIRTUAL'){var _0x100d38={};_0x100d38[_0x37a2e2['name']]={'$like':'%'+_0x3babcf[_0x299b('0x4c')][_0x299b('0x56')]+'%'};return _0x100d38;}})});}_0x4d9136=_[_0x299b('0x57')]({},_0x4d9136,_0x3babcf['options']);var _0x297b24={'where':_0x4d9136[_0x299b('0x54')]};return db[_0x299b('0x48')]['count'](_0x297b24)[_0x299b('0x12')](function(_0x5edcfc){_0x15387f[_0x299b('0x22')]=_0x5edcfc;if(_0x3babcf[_0x299b('0x4c')]['includeAll']){_0x4d9136[_0x299b('0x59')]=[{'all':!![]}];}return db[_0x299b('0x48')][_0x299b('0x5a')](_0x4d9136);})[_0x299b('0x12')](function(_0x13fc12){_0x15387f['rows']=_0x13fc12;return _0x15387f;})[_0x299b('0x12')](respondWithFilteredResult(_0x526ad7,_0x4d9136))['catch'](handleError(_0x526ad7,null));};exports['show']=function(_0x25975f,_0xfa60e9){var _0x2434d2={'raw':![],'where':{'id':_0x25975f['params']['id']},'include':[{'model':db[_0x299b('0x46')],'as':_0x299b('0x43')},{'model':db['MailServerOut'],'as':_0x299b('0x44')},{'model':db[_0x299b('0x47')],'as':_0x299b('0x5b')}]},_0x1943d5={};_0x1943d5[_0x299b('0x4f')]=_[_0x299b('0x4b')](db['MailAccount'][_0x299b('0x49')]);_0x1943d5['query']=_[_0x299b('0x4b')](_0x25975f[_0x299b('0x4c')]);_0x1943d5['filters']=_[_0x299b('0x4e')](_0x1943d5[_0x299b('0x4f')],_0x1943d5[_0x299b('0x4c')]);_0x2434d2[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x1943d5[_0x299b('0x4f')],qs[_0x299b('0x50')](_0x25975f[_0x299b('0x4c')]['fields']));_0x2434d2[_0x299b('0x51')]=_0x2434d2[_0x299b('0x51')][_0x299b('0x5c')]?_0x2434d2['attributes']:_0x1943d5[_0x299b('0x4f')];if(_0x25975f[_0x299b('0x4c')][_0x299b('0x5d')]){_0x2434d2[_0x299b('0x59')]=[{'all':!![]}];}_0x2434d2=_['merge']({},_0x2434d2,_0x25975f[_0x299b('0x5e')]);return db[_0x299b('0x48')][_0x299b('0x5f')](_0x2434d2)['then'](handleEntityNotFound(_0xfa60e9,null))[_0x299b('0x12')](respondWithResult(_0xfa60e9,null))[_0x299b('0x1c')](handleError(_0xfa60e9,null));};exports['update']=function(_0x5d7b1a,_0x5038c6){if(_0x5d7b1a[_0x299b('0x60')]['id']){delete _0x5d7b1a[_0x299b('0x60')]['id'];}var _0xe15403=_0x5d7b1a['body'][_0x299b('0x61')]===_0x299b('0x62')?null:_0x5d7b1a[_0x299b('0x60')]['provider'];var _0x4a4e39=_0x5d7b1a['body'][_0x299b('0x43')]||{};var _0x232b4c=_0x5d7b1a[_0x299b('0x60')][_0x299b('0x44')]||{};if(_0xe15403){_0x4a4e39[_0x299b('0x3e')]=getImapHost(_0xe15403);_0x4a4e39[_0x299b('0x3f')]=0x3e1;_0x232b4c[_0x299b('0x3e')]=getSmtpHost(_0xe15403);_0x232b4c[_0x299b('0x3f')]=0x24b;_0x232b4c[_0x299b('0x63')]=![];}if(_0x232b4c[_0x299b('0x3b')]){_0x232b4c['secure']=![];}else{_0x232b4c['CloudProviderId']=null;}if(!_0x4a4e39[_0x299b('0x3b')])_0x4a4e39[_0x299b('0x3c')]=null;_0x5d7b1a[_0x299b('0x60')][_0x299b('0x43')]=_0x4a4e39;_0x5d7b1a[_0x299b('0x60')]['Smtp']=_0x232b4c;return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x5d7b1a[_0x299b('0x64')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x299b('0x43')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x299b('0x47')],'as':'mandatoryDispositionPause'}]})[_0x299b('0x12')](handleEntityNotFound(_0x5038c6,null))[_0x299b('0x12')](function(_0x95ac1f){if(!_0x95ac1f)throw new Error('Mail\x20Account\x20not\x20found');if(_0x95ac1f[_0x299b('0x40')])delete _0x5d7b1a[_0x299b('0x60')][_0x299b('0x43')];return _0x95ac1f;})[_0x299b('0x12')](saveUpdates(_0x5d7b1a[_0x299b('0x60')],null))[_0x299b('0x12')](function(_0x20ec6c){if(!_0x5d7b1a[_0x299b('0x60')]['Imap'])return _0x20ec6c;return db[_0x299b('0x46')][_0x299b('0x26')](_0x5d7b1a['body'][_0x299b('0x43')],{'where':{'MailAccountId':_0x20ec6c['id']}})['then'](function(){return _0x20ec6c;});})['then'](function(_0x2e0c68){if(!_0x5d7b1a[_0x299b('0x60')][_0x299b('0x44')])return _0x2e0c68;return db[_0x299b('0x65')][_0x299b('0x26')](_0x5d7b1a[_0x299b('0x60')]['Smtp'],{'where':{'MailAccountId':_0x2e0c68['id']}})[_0x299b('0x12')](function(){return _0x2e0c68;});})[_0x299b('0x12')](respondWithResult(_0x5038c6,null))[_0x299b('0x1c')](handleError(_0x5038c6,null));};exports['describe']=function(_0x406b28,_0x187f31){return db[_0x299b('0x48')][_0x299b('0x66')]()[_0x299b('0x12')](respondWithResult(_0x187f31,null))[_0x299b('0x1c')](handleError(_0x187f31,null));};exports[_0x299b('0x67')]=function(_0x1a5380,_0x70d877){if(_0x1a5380[_0x299b('0x60')]['id']){delete _0x1a5380[_0x299b('0x60')]['id'];}return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x1a5380[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x70d877,null))['then'](function(_0x228836){if(_0x228836){_0x1a5380[_0x299b('0x60')][_0x299b('0x68')]=_0x228836['id'];return db[_0x299b('0x69')][_0x299b('0x6a')](_0x1a5380[_0x299b('0x60')]);}})['then'](respondWithResult(_0x70d877,null))[_0x299b('0x1c')](handleError(_0x70d877,null));};exports['getDispositions']=function(_0x3e0c6f,_0x104ca4){var _0x187de7={'raw':![],'where':{}};var _0x396b06={};var _0x58a9e0={'count':0x0,'rows':[]};return db['MailAccount'][_0x299b('0x6b')]({'where':{'id':_0x3e0c6f[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x104ca4,null))['then'](function(_0x6621ab){if(_0x6621ab){_0x396b06['model']=_[_0x299b('0x4b')](db[_0x299b('0x69')][_0x299b('0x49')]);_0x396b06[_0x299b('0x4c')]=_[_0x299b('0x4b')](_0x3e0c6f[_0x299b('0x4c')]);_0x396b06[_0x299b('0x4d')]=_[_0x299b('0x4e')](_0x396b06[_0x299b('0x4f')],_0x396b06[_0x299b('0x4c')]);_0x187de7[_0x299b('0x51')]=_['intersection'](_0x396b06[_0x299b('0x4f')],qs[_0x299b('0x50')](_0x3e0c6f[_0x299b('0x4c')][_0x299b('0x50')]));_0x187de7[_0x299b('0x51')]=_0x187de7['attributes']['length']?_0x187de7[_0x299b('0x51')]:_0x396b06[_0x299b('0x4f')];if(!_0x3e0c6f['query'][_0x299b('0x6c')](_0x299b('0x6d'))){_0x187de7['limit']=qs[_0x299b('0x21')](_0x3e0c6f['query'][_0x299b('0x21')]);_0x187de7[_0x299b('0x23')]=qs[_0x299b('0x23')](_0x3e0c6f[_0x299b('0x4c')][_0x299b('0x23')]);}_0x187de7['order']=qs[_0x299b('0x53')](_0x3e0c6f[_0x299b('0x4c')][_0x299b('0x53')]);_0x187de7[_0x299b('0x54')]=qs[_0x299b('0x4d')](_[_0x299b('0x55')](_0x3e0c6f['query'],_0x396b06[_0x299b('0x4d')]));_0x187de7[_0x299b('0x54')][_0x299b('0x68')]=_0x6621ab['id'];if(_0x3e0c6f['query'][_0x299b('0x56')]){_0x187de7[_0x299b('0x54')]=_['merge'](_0x187de7[_0x299b('0x54')],{'$or':_[_0x299b('0x4a')](_0x187de7['attributes'],function(_0x30f039){var _0x21877d={};_0x21877d[_0x30f039]={'$like':'%'+_0x3e0c6f['query'][_0x299b('0x56')]+'%'};return _0x21877d;})});}_0x187de7=_[_0x299b('0x57')]({},_0x187de7,_0x3e0c6f[_0x299b('0x5e')]);return db[_0x299b('0x69')][_0x299b('0x22')]({'where':_0x187de7['where']})[_0x299b('0x12')](function(_0x329ecb){_0x58a9e0[_0x299b('0x22')]=_0x329ecb;if(_0x3e0c6f['query'][_0x299b('0x5d')]){_0x187de7['include']=[{'all':!![]}];}return db[_0x299b('0x69')]['findAll'](_0x187de7);})[_0x299b('0x12')](function(_0x3202b2){_0x58a9e0[_0x299b('0x6e')]=_0x3202b2;return _0x58a9e0;});}})[_0x299b('0x12')](respondWithFilteredResult(_0x104ca4,_0x187de7))[_0x299b('0x1c')](handleError(_0x104ca4,null));};exports[_0x299b('0x6f')]=function(_0x1f1122,_0x515da5){return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x1f1122[_0x299b('0x64')]['id']}})['then'](handleEntityNotFound(_0x515da5,null))[_0x299b('0x12')](function(_0x201149){if(_0x201149){return _0x201149['removeDispositions'](_0x1f1122[_0x299b('0x4c')][_0x299b('0x70')]);}})[_0x299b('0x12')](respondWithStatusCode(_0x515da5,null))[_0x299b('0x1c')](handleError(_0x515da5,null));};exports[_0x299b('0x71')]=function(_0xa0f742,_0x5dcda7){if(_0xa0f742[_0x299b('0x60')]['id']){delete _0xa0f742[_0x299b('0x60')]['id'];}return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0xa0f742['params']['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x5dcda7,null))[_0x299b('0x12')](function(_0x4ed992){if(_0x4ed992){_0xa0f742[_0x299b('0x60')][_0x299b('0x68')]=_0x4ed992['id'];return db[_0x299b('0x72')][_0x299b('0x6a')](_0xa0f742['body']);}})['then'](respondWithResult(_0x5dcda7,null))[_0x299b('0x1c')](handleError(_0x5dcda7,null));};exports[_0x299b('0x73')]=function(_0x2a736c,_0x3e4c2d){var _0x1e966d={'raw':![],'where':{}};var _0x35ef0e={};var _0x1792dd={'count':0x0,'rows':[]};return db['MailAccount'][_0x299b('0x6b')]({'where':{'id':_0x2a736c[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x3e4c2d,null))[_0x299b('0x12')](function(_0x5c9522){if(_0x5c9522){_0x35ef0e[_0x299b('0x4f')]=_['keys'](db[_0x299b('0x72')][_0x299b('0x49')]);_0x35ef0e[_0x299b('0x4c')]=_[_0x299b('0x4b')](_0x2a736c[_0x299b('0x4c')]);_0x35ef0e[_0x299b('0x4d')]=_['intersection'](_0x35ef0e['model'],_0x35ef0e[_0x299b('0x4c')]);_0x1e966d[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x35ef0e[_0x299b('0x4f')],qs[_0x299b('0x50')](_0x2a736c[_0x299b('0x4c')][_0x299b('0x50')]));_0x1e966d[_0x299b('0x51')]=_0x1e966d[_0x299b('0x51')][_0x299b('0x5c')]?_0x1e966d[_0x299b('0x51')]:_0x35ef0e[_0x299b('0x4f')];if(!_0x2a736c[_0x299b('0x4c')][_0x299b('0x6c')](_0x299b('0x6d'))){_0x1e966d[_0x299b('0x21')]=qs[_0x299b('0x21')](_0x2a736c['query']['limit']);_0x1e966d[_0x299b('0x23')]=qs[_0x299b('0x23')](_0x2a736c[_0x299b('0x4c')][_0x299b('0x23')]);}_0x1e966d[_0x299b('0x52')]=qs['sort'](_0x2a736c[_0x299b('0x4c')][_0x299b('0x53')]);_0x1e966d[_0x299b('0x54')]=qs[_0x299b('0x4d')](_[_0x299b('0x55')](_0x2a736c[_0x299b('0x4c')],_0x35ef0e[_0x299b('0x4d')]));_0x1e966d['where'][_0x299b('0x68')]=_0x5c9522['id'];if(_0x2a736c['query'][_0x299b('0x56')]){_0x1e966d[_0x299b('0x54')]=_[_0x299b('0x57')](_0x1e966d[_0x299b('0x54')],{'$or':_[_0x299b('0x4a')](_0x1e966d[_0x299b('0x51')],function(_0x26f181){var _0x4e6d4e={};_0x4e6d4e[_0x26f181]={'$like':'%'+_0x2a736c[_0x299b('0x4c')][_0x299b('0x56')]+'%'};return _0x4e6d4e;})});}_0x1e966d=_[_0x299b('0x57')]({},_0x1e966d,_0x2a736c['options']);return db[_0x299b('0x72')][_0x299b('0x22')]({'where':_0x1e966d[_0x299b('0x54')]})[_0x299b('0x12')](function(_0x3e498a){_0x1792dd[_0x299b('0x22')]=_0x3e498a;if(_0x2a736c[_0x299b('0x4c')]['includeAll']){_0x1e966d[_0x299b('0x59')]=[{'all':!![]}];}return db[_0x299b('0x72')]['findAll'](_0x1e966d);})[_0x299b('0x12')](function(_0x4450c2){_0x1792dd[_0x299b('0x6e')]=_0x4450c2;return _0x1792dd;});}})[_0x299b('0x12')](respondWithFilteredResult(_0x3e4c2d,_0x1e966d))[_0x299b('0x1c')](handleError(_0x3e4c2d,null));};exports['removeAnswers']=function(_0x561279,_0x3f1244){return db[_0x299b('0x48')]['find']({'where':{'id':_0x561279[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x3f1244,null))[_0x299b('0x12')](function(_0x398b06){if(_0x398b06){return _0x398b06[_0x299b('0x74')](_0x561279[_0x299b('0x4c')][_0x299b('0x70')]);}})[_0x299b('0x12')](respondWithStatusCode(_0x3f1244,null))[_0x299b('0x1c')](handleError(_0x3f1244,null));};exports['create']=function(_0x2e1f56,_0x188b83){var _0x24df60={'name':_0x2e1f56['body']['name'],'key':_0x2e1f56[_0x299b('0x60')][_0x299b('0x75')],'provider':_0x2e1f56[_0x299b('0x60')]['provider']===_0x299b('0x62')?null:_0x2e1f56[_0x299b('0x60')][_0x299b('0x61')],'email':_0x2e1f56['body'][_0x299b('0x76')],'ListId':_0x2e1f56[_0x299b('0x60')][_0x299b('0x77')],'active':!_[_0x299b('0x78')](_0x2e1f56[_0x299b('0x60')][_0x299b('0x79')])?_0x2e1f56[_0x299b('0x60')][_0x299b('0x79')]:!![],'description':_0x2e1f56[_0x299b('0x60')][_0x299b('0x7a')]||null};var _0x354edd=getAuthenticationOptions(_0x24df60['provider'],_0x2e1f56[_0x299b('0x60')]);_0x24df60[_0x299b('0x43')]=_0x354edd[_0x299b('0x43')];_0x24df60[_0x299b('0x44')]=_0x354edd[_0x299b('0x44')];return db['MailAccount'][_0x299b('0x6a')](_0x24df60,{'include':[{'model':db[_0x299b('0x65')],'as':_0x299b('0x44')},{'model':db[_0x299b('0x46')],'as':_0x299b('0x43')}]})[_0x299b('0x12')](function(_0x42d493){var _0x3526fe=_0x2e1f56[_0x299b('0x39')][_0x299b('0x28')]({'plain':!![]});if(!_0x3526fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3526fe[_0x299b('0x7b')]===_0x299b('0x39')){var _0xf22c3e=_0x42d493[_0x299b('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x299b('0x29'),'userProfileId':_0x3526fe['userProfileId']},'raw':!![]})[_0x299b('0x12')](function(_0x27bdc4){if(_0x27bdc4&&_0x27bdc4[_0x299b('0x7c')]===0x0){return db[_0x299b('0x2a')][_0x299b('0x6a')]({'name':_0xf22c3e[_0x299b('0x2d')],'resourceId':_0xf22c3e['id'],'type':_0x27bdc4[_0x299b('0x2d')],'sectionId':_0x27bdc4['id']},{})[_0x299b('0x12')](function(){return _0x42d493;});}else{return _0x42d493;}})['catch'](function(_0x5d5c66){logger['error'](_0x299b('0x7d'),_0x5d5c66);throw _0x5d5c66;});}return _0x42d493;})[_0x299b('0x12')](respondWithResult(_0x188b83,0xc9))[_0x299b('0x1c')](handleError(_0x188b83,null));};exports[_0x299b('0x7e')]=function(_0x3517eb,_0x3c3338){return db[_0x299b('0x48')]['findOne']({'where':{'id':_0x3517eb['params']['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x3c3338,null))[_0x299b('0x12')](function(_0x56627b){if(_0x56627b){return _0x56627b[_0x299b('0x7e')]();}return null;})[_0x299b('0x12')](respondWithResult(_0x3c3338,null))[_0x299b('0x1c')](handleError(_0x3c3338,null));};exports['addImap']=function(_0x1d23e7,_0x5443ae){if(_0x1d23e7[_0x299b('0x60')]['id']){delete _0x1d23e7['body']['id'];}return db[_0x299b('0x48')]['find']({'where':{'id':_0x1d23e7[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x5443ae,null))['then'](function(_0x47278c){if(_0x47278c){_0x1d23e7[_0x299b('0x60')]['MailAccountId']=_0x47278c['id'];return db[_0x299b('0x46')][_0x299b('0x6a')](_0x1d23e7['body']);}})[_0x299b('0x12')](respondWithResult(_0x5443ae,null))['catch'](handleError(_0x5443ae,null));};exports[_0x299b('0x7f')]=function(_0x55d187,_0x3a1316){return db['MailAccount']['findOne']({'where':{'id':_0x55d187[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x3a1316,null))[_0x299b('0x12')](function(_0x537067){if(_0x537067){return _0x537067[_0x299b('0x80')](null);}return null;})[_0x299b('0x12')](respondWithStatusCode(_0x3a1316,null))['catch'](handleError(_0x3a1316,null));};exports['getSmtp']=function(_0x45f05b,_0x293058){return db[_0x299b('0x48')][_0x299b('0x6b')]({'where':{'id':_0x45f05b['params']['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x293058,null))[_0x299b('0x12')](function(_0x1f1bbb){if(_0x1f1bbb){return _0x1f1bbb[_0x299b('0x81')]();}return null;})[_0x299b('0x12')](respondWithResult(_0x293058,null))[_0x299b('0x1c')](handleError(_0x293058,null));};exports[_0x299b('0x82')]=function(_0x4e61f8,_0x6bb2b5){if(_0x4e61f8[_0x299b('0x60')]['id']){delete _0x4e61f8[_0x299b('0x60')]['id'];}return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x4e61f8['params']['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x6bb2b5,null))['then'](function(_0x1ab246){if(_0x1ab246){_0x4e61f8[_0x299b('0x60')]['MailAccountId']=_0x1ab246['id'];return db[_0x299b('0x65')]['create'](_0x4e61f8[_0x299b('0x60')]);}})[_0x299b('0x12')](respondWithResult(_0x6bb2b5,null))['catch'](handleError(_0x6bb2b5,null));};exports['removeSmtp']=function(_0x5cc7f0,_0x2f31a8){return db['MailAccount'][_0x299b('0x6b')]({'where':{'id':_0x5cc7f0[_0x299b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2f31a8,null))[_0x299b('0x12')](function(_0x195039){if(_0x195039){return _0x195039['setSmtp'](null);}return null;})[_0x299b('0x12')](respondWithStatusCode(_0x2f31a8,null))['catch'](handleError(_0x2f31a8,null));};exports['addInteraction']=function(_0x213773,_0x1d9bdc){return db[_0x299b('0x83')][_0x299b('0x5f')]({'where':{'id':_0x213773[_0x299b('0x64')]['id']}})['then'](handleEntityNotFound(_0x1d9bdc,null))[_0x299b('0x12')](function(_0x3098e3){if(_0x3098e3){return _0x3098e3[_0x299b('0x84')](_0x213773[_0x299b('0x60')][_0x299b('0x70')],_['omit'](_0x213773['body'],[_0x299b('0x70'),'id'])||{});}})['then'](respondWithResult(_0x1d9bdc,null))[_0x299b('0x1c')](handleError(_0x1d9bdc,null));};exports['getInteractions']=function(_0xeb98d4,_0xfc4910){var _0x4125a8={'raw':![],'where':{}};var _0x4c924a={};var _0x357e44={'count':0x0,'rows':[]};return db[_0x299b('0x48')][_0x299b('0x6b')]({'where':{'id':_0xeb98d4[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0xfc4910,null))[_0x299b('0x12')](function(_0x1af9ae){if(_0x1af9ae){_0x4c924a[_0x299b('0x4f')]=_['keys'](db[_0x299b('0x83')][_0x299b('0x49')]);_0x4c924a[_0x299b('0x4c')]=_[_0x299b('0x4b')](_0xeb98d4[_0x299b('0x4c')]);_0x4c924a['filters']=_[_0x299b('0x4e')](_0x4c924a[_0x299b('0x4f')],_0x4c924a[_0x299b('0x4c')]);_0x4125a8[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x4c924a['model'],qs[_0x299b('0x50')](_0xeb98d4[_0x299b('0x4c')][_0x299b('0x50')]));_0x4125a8[_0x299b('0x51')]=_0x4125a8['attributes'][_0x299b('0x5c')]?_0x4125a8[_0x299b('0x51')]:_0x4c924a[_0x299b('0x4f')];if(!_0xeb98d4['query'][_0x299b('0x6c')]('nolimit')){_0x4125a8[_0x299b('0x21')]=qs[_0x299b('0x21')](_0xeb98d4[_0x299b('0x4c')][_0x299b('0x21')]);_0x4125a8[_0x299b('0x23')]=qs[_0x299b('0x23')](_0xeb98d4[_0x299b('0x4c')]['offset']);}_0x4125a8['order']=qs[_0x299b('0x53')](_0xeb98d4[_0x299b('0x4c')][_0x299b('0x53')]);_0x4125a8[_0x299b('0x54')]=qs['filters'](_[_0x299b('0x55')](_0xeb98d4['query'],_0x4c924a[_0x299b('0x4d')]));_0x4125a8[_0x299b('0x54')][_0x299b('0x68')]=_0x1af9ae['id'];if(_0xeb98d4[_0x299b('0x4c')][_0x299b('0x56')]){_0x4125a8[_0x299b('0x54')]=_[_0x299b('0x57')](_0x4125a8[_0x299b('0x54')],{'$or':_[_0x299b('0x4a')](_0x4125a8[_0x299b('0x51')],function(_0x48d4b5){var _0x2e6ba3={};_0x2e6ba3[_0x48d4b5]={'$like':'%'+_0xeb98d4[_0x299b('0x4c')][_0x299b('0x56')]+'%'};return _0x2e6ba3;})});}_0x4125a8=_['merge']({},_0x4125a8,_0xeb98d4[_0x299b('0x5e')]);return db[_0x299b('0x83')][_0x299b('0x22')]({'where':_0x4125a8['where']})[_0x299b('0x12')](function(_0x1c215a){_0x357e44[_0x299b('0x22')]=_0x1c215a;if(_0xeb98d4[_0x299b('0x4c')]['includeAll']){_0x4125a8[_0x299b('0x59')]=[{'model':db['CmContact'],'as':_0x299b('0x85'),'required':![]},{'model':db[_0x299b('0x86')],'as':_0x299b('0x87'),'attributes':[_0x299b('0x2d'),_0x299b('0x88'),_0x299b('0x89')],'required':![]},{'model':db['Tag'],'as':_0x299b('0x8a'),'attributes':['id',_0x299b('0x2d'),_0x299b('0x8b')],'where':_0xeb98d4[_0x299b('0x4c')]['tag']?{'id':_0xeb98d4['query']['tag']}:undefined,'required':_0xeb98d4[_0x299b('0x4c')][_0x299b('0x8c')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x4125a8);})[_0x299b('0x12')](function(_0x2cc188){_0x357e44['rows']=_0x2cc188;return _0x357e44;});}})[_0x299b('0x12')](respondWithFilteredResult(_0xfc4910,_0x4125a8))[_0x299b('0x1c')](handleError(_0xfc4910,null));};exports[_0x299b('0x8d')]=function addApplications(_0x1c8a43,_0x256cf5){var _0x522945=_0x1c8a43[_0x299b('0x64')]['id'];var _0x2e6787=_0x1c8a43[_0x299b('0x60')];var _0x2cac6c=0xc8;var _0x3f2a7a=null;return db['sequelize'][_0x299b('0x8e')]({'isolationLevel':db['sequelize'][_0x299b('0x8f')][_0x299b('0x90')][_0x299b('0x91')]},function(_0x6edfa5){return db[_0x299b('0x48')][_0x299b('0x6b')]({'where':{'id':_0x522945},'transaction':_0x6edfa5})['then'](function(_0x52f1b5){if(_0x52f1b5){return db[_0x299b('0x92')][_0x299b('0x27')]({'where':{'MailAccountId':_0x522945},'transaction':_0x6edfa5})[_0x299b('0x12')](function(){var _0x1e0770=_[_0x299b('0x4a')](_0x2e6787,function(_0x231602){_0x231602[_0x299b('0x68')]=_0x522945;return _0x231602;});return db[_0x299b('0x92')][_0x299b('0x93')](_0x1e0770,{'transaction':_0x6edfa5});});}else{_0x2cac6c=0x194;_0x3f2a7a=[];}});})['then'](function(){if(_0x2cac6c!==0x194){return db['MailApplication'][_0x299b('0x94')]({'where':{'MailAccountId':_0x522945},'order':_0x299b('0x95')})['then'](function(_0x392707){_0x3f2a7a=_0x392707;});}})[_0x299b('0x1c')](function(_0x82a291){_0x2cac6c=0x1f4;logger['error'](_0x82a291[_0x299b('0x2c')]);if(_0x82a291[_0x299b('0x2d')]){delete _0x82a291[_0x299b('0x2d')];}_0x3f2a7a=_0x82a291;})['finally'](function(){if(_0x3f2a7a===null){_0x256cf5[_0x299b('0x1d')](_0x2cac6c);}else{if(_0x2cac6c===0x1f4){_0x256cf5[_0x299b('0x1e')](_0x2cac6c)['send'](_0x3f2a7a);}else{_0x256cf5[_0x299b('0x1e')](_0x2cac6c)['json'](_0x3f2a7a);}}});};exports[_0x299b('0x96')]=function(_0x13c79b,_0x3bc9c0){var _0x3b9a33={};var _0x3f6f22={};var _0x90b9c3;var _0x17aefb;return db[_0x299b('0x48')]['findOne']({'where':{'id':_0x13c79b[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x3bc9c0,null))[_0x299b('0x12')](function(_0x1756c7){if(_0x1756c7){_0x90b9c3=_0x1756c7;_0x3f6f22[_0x299b('0x4f')]=_[_0x299b('0x4b')](db['MailApplication'][_0x299b('0x49')]);_0x3f6f22[_0x299b('0x4c')]=_[_0x299b('0x4b')](_0x13c79b[_0x299b('0x4c')]);_0x3f6f22['filters']=_[_0x299b('0x4e')](_0x3f6f22[_0x299b('0x4f')],_0x3f6f22['query']);_0x3b9a33[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x3f6f22[_0x299b('0x4f')],qs[_0x299b('0x50')](_0x13c79b[_0x299b('0x4c')][_0x299b('0x50')]));_0x3b9a33[_0x299b('0x51')]=_0x3b9a33[_0x299b('0x51')][_0x299b('0x5c')]?_0x3b9a33[_0x299b('0x51')]:_0x3f6f22['model'];_0x3b9a33[_0x299b('0x52')]=qs[_0x299b('0x53')](_0x13c79b[_0x299b('0x4c')]['sort']);_0x3b9a33[_0x299b('0x54')]=qs['filters'](_[_0x299b('0x55')](_0x13c79b[_0x299b('0x4c')],_0x3f6f22[_0x299b('0x4d')]));if(_0x13c79b[_0x299b('0x4c')][_0x299b('0x56')]){_0x3b9a33[_0x299b('0x54')]=_[_0x299b('0x57')](_0x3b9a33[_0x299b('0x54')],{'$or':_[_0x299b('0x4a')](_0x3b9a33[_0x299b('0x51')],function(_0x16c10d){var _0x16502f={};_0x16502f[_0x16c10d]={'$like':'%'+_0x13c79b[_0x299b('0x4c')][_0x299b('0x56')]+'%'};return _0x16502f;})});}_0x3b9a33=_['merge']({},_0x3b9a33,_0x13c79b[_0x299b('0x5e')]);return _0x90b9c3['getApplications'](_0x3b9a33);}})[_0x299b('0x12')](function(_0x25e739){if(_0x25e739){_0x17aefb=_0x25e739[_0x299b('0x5c')];if(!_0x13c79b[_0x299b('0x4c')][_0x299b('0x6c')](_0x299b('0x6d'))){_0x3b9a33[_0x299b('0x21')]=qs[_0x299b('0x21')](_0x13c79b['query']['limit']);_0x3b9a33['offset']=qs[_0x299b('0x23')](_0x13c79b[_0x299b('0x4c')]['offset']);}return _0x90b9c3[_0x299b('0x96')](_0x3b9a33);}})['then'](function(_0x1cabe5){if(_0x1cabe5){return _0x1cabe5?{'count':_0x17aefb,'rows':_0x1cabe5}:null;}})[_0x299b('0x12')](respondWithResult(_0x3bc9c0,null))[_0x299b('0x1c')](handleError(_0x3bc9c0,null));};exports['getMessages']=function(_0x4b03f0,_0x5aa38d){var _0x3f3e2b={'raw':!![],'where':{}};var _0x2d5a8f={};var _0x533c0e={'count':0x0,'rows':[]};return db['MailAccount'][_0x299b('0x6b')]({'where':{'id':_0x4b03f0[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x5aa38d,null))[_0x299b('0x12')](function(_0x5a0579){if(_0x5a0579){_0x2d5a8f[_0x299b('0x4f')]=_[_0x299b('0x4b')](db[_0x299b('0x97')][_0x299b('0x49')]);_0x2d5a8f['query']=_[_0x299b('0x4b')](_0x4b03f0[_0x299b('0x4c')]);_0x2d5a8f[_0x299b('0x4d')]=_[_0x299b('0x4e')](_0x2d5a8f[_0x299b('0x4f')],_0x2d5a8f[_0x299b('0x4c')]);_0x3f3e2b[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x2d5a8f[_0x299b('0x4f')],qs['fields'](_0x4b03f0[_0x299b('0x4c')][_0x299b('0x50')]));_0x3f3e2b[_0x299b('0x51')]=_0x3f3e2b[_0x299b('0x51')]['length']?_0x3f3e2b[_0x299b('0x51')]:_0x2d5a8f[_0x299b('0x4f')];if(!_0x4b03f0[_0x299b('0x4c')][_0x299b('0x6c')]('nolimit')){_0x3f3e2b['limit']=qs[_0x299b('0x21')](_0x4b03f0['query'][_0x299b('0x21')]);_0x3f3e2b[_0x299b('0x23')]=qs[_0x299b('0x23')](_0x4b03f0[_0x299b('0x4c')][_0x299b('0x23')]);}_0x3f3e2b[_0x299b('0x52')]=qs['sort'](_0x4b03f0[_0x299b('0x4c')][_0x299b('0x53')]);_0x3f3e2b['where']=qs[_0x299b('0x4d')](_[_0x299b('0x55')](_0x4b03f0[_0x299b('0x4c')],_0x2d5a8f[_0x299b('0x4d')]));_0x3f3e2b[_0x299b('0x54')][_0x299b('0x68')]=_0x5a0579['id'];if(_0x4b03f0[_0x299b('0x4c')][_0x299b('0x56')]){_0x3f3e2b['where']=_[_0x299b('0x57')](_0x3f3e2b['where'],{'$or':_[_0x299b('0x4a')](_0x3f3e2b['attributes'],function(_0x279328){var _0x2d3913={};_0x2d3913[_0x279328]={'$like':'%'+_0x4b03f0[_0x299b('0x4c')][_0x299b('0x56')]+'%'};return _0x2d3913;})});}if(_0x4b03f0[_0x299b('0x4c')][_0x299b('0x98')]){var _0x904ae4=_0x4b03f0[_0x299b('0x4c')][_0x299b('0x98')][_0x299b('0x99')](',');var _0x2e0880={};_0x2e0880[_0x904ae4[0x0]]={'$gte':moment(_0x904ae4[0x1])[_0x299b('0x9a')](_0x299b('0x9b'))};_0x3f3e2b['where']=_[_0x299b('0x57')](_0x3f3e2b[_0x299b('0x54')],_0x2e0880);}_0x3f3e2b=_[_0x299b('0x57')]({},_0x3f3e2b,_0x4b03f0[_0x299b('0x5e')]);return db[_0x299b('0x97')][_0x299b('0x22')]({'where':_0x3f3e2b['where']})['then'](function(_0x5c6b50){_0x533c0e[_0x299b('0x22')]=_0x5c6b50;if(_0x4b03f0[_0x299b('0x4c')][_0x299b('0x5d')]){_0x3f3e2b[_0x299b('0x59')]=[{'all':!![]}];}return db[_0x299b('0x97')][_0x299b('0x5a')](_0x3f3e2b);})[_0x299b('0x12')](function(_0x738a99){if(_0x4b03f0[_0x299b('0x4c')][_0x299b('0x9c')]===_0x299b('0x9d')){for(var _0x2ebb99=0x0;_0x2ebb99<_0x738a99[_0x299b('0x5c')];_0x2ebb99++){_0x738a99[_0x2ebb99][_0x299b('0x60')]=juice(_0x738a99[_0x2ebb99][_0x299b('0x60')]);}}_0x533c0e['rows']=_0x738a99;return _0x533c0e;});}})[_0x299b('0x12')](respondWithFilteredResult(_0x5aa38d,_0x3f3e2b))['catch'](handleError(_0x5aa38d,null));};exports[_0x299b('0x2e')]=function(_0x459bd7,_0x5ed74e){var _0x339f9d,_0xd67ef2={},_0x46f4a5;if(_0x459bd7[_0x299b('0x60')]['to']){_0x46f4a5=_0x459bd7[_0x299b('0x60')]['to'][_0x299b('0x99')](',')[0x0];}return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x459bd7['params']['id']},'include':[{'model':db[_0x299b('0x9e')],'as':'List','include':[{'model':db[_0x299b('0x9f')],'as':_0x299b('0xa0'),'where':{'email':_0x46f4a5},'limit':0x1,'order':[[_0x299b('0xa1'),'DESC']]}]},{'model':db[_0x299b('0x65')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x299b('0xa2')],'as':_0x299b('0xa2'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5ed74e,null))[_0x299b('0x12')](function(_0x5582b9){if(!_0x5582b9)return;_0x339f9d=_0x5582b9;if(!_0x5582b9[_0x299b('0x44')])throw new Error(_0x299b('0xa3'));if(_['isNil'](_0x459bd7[_0x299b('0x60')][_0x299b('0xa4')])){_0x459bd7[_0x299b('0x60')][_0x299b('0xa4')]=util[_0x299b('0x9a')](_0x299b('0xa5'),_0x5582b9[_0x299b('0x2d')],_0x5582b9[_0x299b('0x76')]||_0x5582b9[_0x299b('0x44')][_0x299b('0x39')]);}if(_0x459bd7[_0x299b('0x60')][_0x299b('0xa6')]&&_0x459bd7[_0x299b('0x60')][_0x299b('0xa6')][_0x299b('0x5c')]){for(var _0x63414c=0x0;_0x63414c<_0x459bd7[_0x299b('0x60')][_0x299b('0xa6')][_0x299b('0x5c')];_0x63414c+=0x1){_0x459bd7[_0x299b('0x60')][_0x299b('0xa6')][_0x63414c]={'filename':_0x459bd7[_0x299b('0x60')][_0x299b('0xa6')][_0x63414c]['name'],'path':path[_0x299b('0xa7')](config[_0x299b('0xa8')],_0x299b('0xa9'),_0x459bd7[_0x299b('0x60')]['attachments'][_0x63414c][_0x299b('0xaa')])};}}var _0x3140b6=_0x5582b9[_0x299b('0xab')]();return respondWithRpcPromise('SendMail',_0x299b('0xac'),{'account':_0x3140b6,'message':_0x459bd7[_0x299b('0x60')]});})[_0x299b('0x12')](function(_0xd3d81e){if(!_0xd3d81e)return;_0xd67ef2=_0xd3d81e;if(!_0x339f9d[_0x299b('0xad')])throw new Error(_0x299b('0xae'));if(_0x339f9d[_0x299b('0xad')][_0x299b('0xa0')][_0x299b('0x5c')])return _0x339f9d[_0x299b('0xad')]['Contacts'][0x0];return db['CmContact'][_0x299b('0x6a')](_[_0x299b('0xaf')](_0x459bd7[_0x299b('0x60')],{'firstName':_0x459bd7[_0x299b('0x60')]['to'],'email':_0x459bd7[_0x299b('0x60')]['to'],'phone':_0x459bd7[_0x299b('0x60')]['to'],'ListId':_0x339f9d['ListId']}));})[_0x299b('0x12')](function(_0x37beda){if(!_0x37beda)return;var _0x5de220={'UserId':_0x459bd7[_0x299b('0x39')]['id'],'ContactId':_0x37beda['id'],'MailAccountId':_0x339f9d['id'],'inReplyTo':_0xd67ef2[_0x299b('0xb0')],'to':_0x459bd7[_0x299b('0x60')][_0x299b('0xa4')],'cc':_0x459bd7[_0x299b('0x60')]['cc'],'subject':_0x459bd7[_0x299b('0x60')][_0x299b('0xb1')],'attach':_0x459bd7[_0x299b('0x60')][_0x299b('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x299b('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x299b('0xb3'),'Messages':[_[_0x299b('0x57')](_0x459bd7[_0x299b('0x60')],{'messageId':_0xd67ef2[_0x299b('0xb0')],'sentAt':moment()['format'](_0x299b('0x9b')),'read':!![],'MailAccountId':_0x339f9d['id'],'UserId':_0x459bd7[_0x299b('0x39')]['id'],'ContactId':_0x37beda['id']})]};if(_0x459bd7[_0x299b('0x60')][_0x299b('0xb4')]){_0x5de220=_[_0x299b('0x57')](_0x5de220,_0x459bd7[_0x299b('0x60')][_0x299b('0xb4')]);}return db[_0x299b('0x83')][_0x299b('0x6a')](_0x5de220,{'include':[{'model':db[_0x299b('0x97')],'as':_0x299b('0xb5')}]});})['then'](respondWithResult(_0x5ed74e,null))[_0x299b('0x1c')](handleError(_0x5ed74e,null));};exports['verifySmtp']=function(_0x2415e6,_0x447cd9){return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x2415e6[_0x299b('0x64')]['id']},'include':[{'model':db[_0x299b('0x65')],'as':_0x299b('0x44'),'raw':!![],'include':[{'model':db[_0x299b('0xa2')],'as':_0x299b('0xa2'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x447cd9,null))[_0x299b('0x12')](function(_0x207384){if(!_0x207384[_0x299b('0x44')])return;var _0x5efefa=_0x207384[_0x299b('0xab')]();return respondWithRpcPromise(_0x299b('0xb6'),'verifySmtp',{'account':_0x5efefa});})[_0x299b('0x12')](respondWithResult(_0x447cd9,null))[_0x299b('0x1c')](handleError(_0x447cd9,null));};exports[_0x299b('0x27')]=function(_0x57eb05,_0x5b0a49){return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x57eb05[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x5b0a49,null))[_0x299b('0x12')](function(_0x30adb2){if(_0x30adb2&&_0x30adb2[_0x299b('0x40')]){throw new db[(_0x299b('0xb7'))][(_0x299b('0xb8'))](_0x299b('0xb9'));}return _0x30adb2;})['then'](removeEntity(_0x5b0a49,null))[_0x299b('0x1c')](handleError(_0x5b0a49,null));};exports['addAgents']=function(_0x11d817,_0x2027a2){return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0x11d817[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x2027a2,null))[_0x299b('0x12')](function(_0x169d89){if(_0x169d89){return _0x169d89['addAgents'](_0x11d817[_0x299b('0x60')]['ids'],_[_0x299b('0xba')](_0x11d817[_0x299b('0x60')],[_0x299b('0x70'),'id'])||{})[_0x299b('0xbb')](function(_0x555234){for(var _0x590cfb=0x0;_0x590cfb<_0x11d817[_0x299b('0x60')][_0x299b('0x70')][_0x299b('0x5c')];_0x590cfb+=0x1){socket[_0x299b('0xbc')](_0x299b('0xbd'),{'UserId':Number(_0x11d817[_0x299b('0x60')][_0x299b('0x70')][_0x590cfb]),'MailAccountId':Number(_0x11d817['params']['id'])});}return _0x555234;});}})[_0x299b('0x12')](respondWithResult(_0x2027a2,null))[_0x299b('0x1c')](handleError(_0x2027a2,null));};exports[_0x299b('0xbe')]=function(_0xff06cb,_0x27f1b0){return db[_0x299b('0x48')][_0x299b('0x5f')]({'where':{'id':_0xff06cb[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x27f1b0,null))[_0x299b('0x12')](function(_0x2a8c59){if(_0x2a8c59){return _0x2a8c59[_0x299b('0xbe')](_0xff06cb['query'][_0x299b('0x70')])['then'](function(){if(_[_0x299b('0xbf')](_0xff06cb['query'][_0x299b('0x70')])){for(var _0x531cc2=0x0;_0x531cc2<_0xff06cb[_0x299b('0x4c')][_0x299b('0x70')]['length'];_0x531cc2+=0x1){socket[_0x299b('0xbc')]('userMailAccount:remove',{'UserId':Number(_0xff06cb[_0x299b('0x4c')]['ids'][_0x531cc2]),'MailAccountId':Number(_0xff06cb[_0x299b('0x64')]['id'])});}}else{socket[_0x299b('0xbc')](_0x299b('0xc0'),{'UserId':Number(_0xff06cb[_0x299b('0x4c')]['ids']),'MailAccountId':Number(_0xff06cb[_0x299b('0x64')]['id'])});}});}})[_0x299b('0x12')](respondWithStatusCode(_0x27f1b0,null))[_0x299b('0x1c')](handleError(_0x27f1b0,null));};exports['getAgents']=function(_0x2d9971,_0x2fed7c){var _0x1989b4={};var _0x5e33dd={};var _0x4cea54;var _0x3602a1;return db[_0x299b('0x48')][_0x299b('0x6b')]({'where':{'id':_0x2d9971[_0x299b('0x64')]['id']}})[_0x299b('0x12')](handleEntityNotFound(_0x2fed7c,null))['then'](function(_0x436aa0){if(_0x436aa0){_0x4cea54=_0x436aa0;_0x5e33dd[_0x299b('0x4f')]=_[_0x299b('0x4b')](db['User']['rawAttributes']);_0x5e33dd['query']=_[_0x299b('0x4b')](_0x2d9971[_0x299b('0x4c')]);_0x5e33dd[_0x299b('0x4d')]=_['intersection'](_0x5e33dd[_0x299b('0x4f')],_0x5e33dd[_0x299b('0x4c')]);_0x1989b4[_0x299b('0x51')]=_[_0x299b('0x4e')](_0x5e33dd[_0x299b('0x4f')],qs[_0x299b('0x50')](_0x2d9971[_0x299b('0x4c')][_0x299b('0x50')]));_0x1989b4[_0x299b('0x51')]=_0x1989b4[_0x299b('0x51')][_0x299b('0x5c')]?_0x1989b4['attributes']:_0x5e33dd[_0x299b('0x4f')];_0x1989b4['order']=qs[_0x299b('0x53')](_0x2d9971['query'][_0x299b('0x53')]);_0x1989b4[_0x299b('0x54')]=qs[_0x299b('0x4d')](_['pick'](_0x2d9971[_0x299b('0x4c')],_0x5e33dd[_0x299b('0x4d')]));if(_0x2d9971['query'][_0x299b('0x56')]){_0x1989b4['where']=_[_0x299b('0x57')](_0x1989b4[_0x299b('0x54')],{'$or':_['map'](_0x1989b4[_0x299b('0x51')],function(_0x22a20e){var _0x14f076={};_0x14f076[_0x22a20e]={'$like':'%'+_0x2d9971['query'][_0x299b('0x56')]+'%'};return _0x14f076;})});}_0x1989b4=_[_0x299b('0x57')]({},_0x1989b4,_0x2d9971[_0x299b('0x5e')]);return _0x4cea54[_0x299b('0xc1')](_0x1989b4);}})[_0x299b('0x12')](function(_0x2de372){if(_0x2de372){_0x3602a1=_0x2de372[_0x299b('0x5c')];if(!_0x2d9971[_0x299b('0x4c')][_0x299b('0x6c')](_0x299b('0x6d'))){_0x1989b4[_0x299b('0x21')]=qs[_0x299b('0x21')](_0x2d9971['query'][_0x299b('0x21')]);_0x1989b4[_0x299b('0x23')]=qs[_0x299b('0x23')](_0x2d9971[_0x299b('0x4c')]['offset']);}return _0x4cea54['getAgents'](_0x1989b4);}})[_0x299b('0x12')](function(_0x3d1ed7){if(_0x3d1ed7){return _0x3d1ed7?{'count':_0x3602a1,'rows':_0x3d1ed7}:null;}})[_0x299b('0x12')](respondWithResult(_0x2fed7c,null))[_0x299b('0x1c')](handleError(_0x2fed7c,null));}; \ No newline at end of file +var _0xc70e=['defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','MailAccount,\x20%s,\x20%s','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','end','stack','name','send','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','outlook365','smtp.office365.com','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','user','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','body','provider','custom','MailServerOut','Pause','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','getDispositions','findOne','nolimit','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','Contacts','messageId','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','bluebird','util','path','lodash','juice','ioredis','api','../../mysqldb','redis'];(function(_0x454032,_0x234137){var _0x1f7f33=function(_0x50af0b){while(--_0x50af0b){_0x454032['push'](_0x454032['shift']());}};_0x1f7f33(++_0x234137);}(_0xc70e,0xbb));var _0xec70=function(_0x27dce9,_0x10d2f8){_0x27dce9=_0x27dce9-0x0;var _0x1fec31=_0xc70e[_0x27dce9];return _0x1fec31;};'use strict';var moment=require('moment');var BPromise=require(_0xec70('0x0'));var util=require(_0xec70('0x1'));var path=require(_0xec70('0x2'));var _=require(_0xec70('0x3'));var juice=require(_0xec70('0x4'));var Redis=require(_0xec70('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xec70('0x6'));var config=require('../../config/environment');var db=require(_0xec70('0x7'))['db'];config[_0xec70('0x8')]=_[_0xec70('0x9')](config[_0xec70('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xec70('0xa'))(new Redis(config[_0xec70('0x8')]));require(_0xec70('0xb'))[_0xec70('0xc')](socket);var jayson=require(_0xec70('0xd'));var client=jayson[_0xec70('0xe')][_0xec70('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x5e4b1c,_0x105575,_0x45eb86,_0x510d85){return new BPromise(function(_0x453f13,_0x550029){var _0x4e5152=_0x510d85||client;return _0x4e5152['request'](_0x5e4b1c,_0x45eb86)[_0xec70('0x10')](function(_0x7a5e3b){logger[_0xec70('0x11')]('MailAccount,\x20%s,\x20%s',_0x105575,_0xec70('0x12'));logger[_0xec70('0x13')](_0xec70('0x14'),_0x105575,_0xec70('0x12'),JSON[_0xec70('0x15')](_0x7a5e3b));if(_0x7a5e3b[_0xec70('0x16')]){if(_0x7a5e3b[_0xec70('0x16')]['code']===0x1f4){logger[_0xec70('0x16')]('MailAccount,\x20%s,\x20%s',_0x105575,_0x7a5e3b['error'][_0xec70('0x17')]);return _0x550029(_0x7a5e3b[_0xec70('0x16')][_0xec70('0x17')]);}logger[_0xec70('0x16')](_0xec70('0x18'),_0x105575,_0x7a5e3b['error']['message']);return _0x453f13(_0x7a5e3b[_0xec70('0x16')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x105575,_0xec70('0x12'));_0x453f13(_0x7a5e3b['result'][_0xec70('0x17')]);}})[_0xec70('0x19')](function(_0x511310){logger[_0xec70('0x16')](_0xec70('0x18'),_0x105575,_0x511310);_0x550029(_0x511310);});});}function respondWithStatusCode(_0x2eb44a,_0x5430c4){_0x5430c4=_0x5430c4||0xcc;return function(_0x49e8e4){if(_0x49e8e4){return _0x2eb44a['sendStatus'](_0x5430c4);}return _0x2eb44a[_0xec70('0x1a')](_0x5430c4)['end']();};}function respondWithResult(_0x523916,_0x438a49){_0x438a49=_0x438a49||0xc8;return function(_0x596131){if(_0x596131){return _0x523916[_0xec70('0x1a')](_0x438a49)[_0xec70('0x1b')](_0x596131);}};}function respondWithFilteredResult(_0x308252,_0x2f697a){return function(_0x52a149){if(_0x52a149){var _0x59419e=typeof _0x2f697a[_0xec70('0x1c')]==='undefined'&&typeof _0x2f697a[_0xec70('0x1d')]===_0xec70('0x1e');var _0x5cf5e5=_0x52a149['count'];var _0x477963=_0x59419e?0x0:_0x2f697a[_0xec70('0x1c')];var _0x38893f=_0x59419e?_0x52a149[_0xec70('0x1f')]:_0x2f697a[_0xec70('0x1c')]+_0x2f697a[_0xec70('0x1d')];var _0x22d75e;if(_0x38893f>=_0x5cf5e5){_0x38893f=_0x5cf5e5;_0x22d75e=0xc8;}else{_0x22d75e=0xce;}_0x308252['status'](_0x22d75e);return _0x308252[_0xec70('0x20')](_0xec70('0x21'),_0x477963+'-'+_0x38893f+'/'+_0x5cf5e5)[_0xec70('0x1b')](_0x52a149);}return null;};}function saveUpdates(_0x1bf75e){return function(_0xf79e96){if(_0xf79e96){return _0xf79e96[_0xec70('0x22')](_0x1bf75e)[_0xec70('0x10')](function(_0x33f6f6){return _0x33f6f6;});}return null;};}function removeEntity(_0x1875a5){return function(_0x4fc64f){if(_0x4fc64f){return _0x4fc64f['destroy']()[_0xec70('0x10')](function(){var _0x12b0eb=_0x4fc64f[_0xec70('0x23')]({'plain':!![]});var _0xcdffb5=_0xec70('0x24');return db[_0xec70('0x25')][_0xec70('0x26')]({'where':{'type':_0xcdffb5,'resourceId':_0x12b0eb['id']}})[_0xec70('0x10')](function(){return _0x4fc64f;});})[_0xec70('0x10')](function(){_0x1875a5[_0xec70('0x1a')](0xcc)[_0xec70('0x27')]();});}};}function handleEntityNotFound(_0x3ecdac){return function(_0x5998fe){if(!_0x5998fe){_0x3ecdac['sendStatus'](0x194);}return _0x5998fe;};}function handleError(_0x17a2b5,_0x3de468){_0x3de468=_0x3de468||0x1f4;return function(_0x3e9115){logger[_0xec70('0x16')](_0x3e9115[_0xec70('0x28')]);if(_0x3e9115['name']){delete _0x3e9115[_0xec70('0x29')];}_0x17a2b5['status'](_0x3de468)[_0xec70('0x2a')](_0x3e9115);};}function getImapHost(_0x2985af){switch(_0x2985af){case'gmail':return'imap.gmail.com';case _0xec70('0x2b'):return _0xec70('0x2c');case _0xec70('0x2d'):return'imap-mail.outlook.com';case'outlook365':return _0xec70('0x2e');}throw new Error(_0xec70('0x2f'),_0x2985af);}function getSmtpHost(_0x4924ec){switch(_0x4924ec){case _0xec70('0x30'):return _0xec70('0x31');case'yahoo':return _0xec70('0x32');case _0xec70('0x2d'):return'smtp-mail.outlook.com';case _0xec70('0x33'):return _0xec70('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4924ec);}function getAuthenticationOptions(_0x1c89bd,_0x4bba8a){var _0xa4dd66={};var _0x4d2e94={};if(_0x1c89bd){_0xa4dd66['user']=_0x4d2e94['user']=_0x4bba8a[_0xec70('0x35')];_0xa4dd66['password']=_0x4d2e94[_0xec70('0x36')]=_0x4bba8a[_0xec70('0x37')];if(_0x4bba8a[_0xec70('0x38')]){_0xa4dd66[_0xec70('0x38')]=_0x4d2e94[_0xec70('0x38')]=!![];_0xa4dd66[_0xec70('0x39')]=_0x4d2e94['CloudProviderId']=_0x4bba8a[_0xec70('0x39')];_0xa4dd66[_0xec70('0x37')]=_0x4d2e94[_0xec70('0x36')]=null;}else{_0xa4dd66[_0xec70('0x39')]=_0x4d2e94[_0xec70('0x39')]=null;}_0xa4dd66[_0xec70('0x3a')]=getImapHost(_0x1c89bd);_0xa4dd66[_0xec70('0x3b')]=0x3e1;_0x4d2e94['host']=getSmtpHost(_0x1c89bd);_0x4d2e94['port']=0x24b;_0x4d2e94[_0xec70('0x3c')]=![];_0xa4dd66['service']=_0x4d2e94[_0xec70('0x3d')]=null;}else{if(_0x4bba8a['authentication']){_0xa4dd66['user']=_0x4d2e94[_0xec70('0x3e')]=_0x4bba8a[_0xec70('0x35')];_0xa4dd66['password']=_0x4d2e94['pass']=_0x4bba8a[_0xec70('0x37')];}else{_0xa4dd66[_0xec70('0x3f')]=_0x4d2e94[_0xec70('0x3f')]=![];_0xa4dd66[_0xec70('0x3e')]=_0x4d2e94[_0xec70('0x3e')]=null;_0xa4dd66[_0xec70('0x37')]=_0x4d2e94['pass']=null;}_0xa4dd66[_0xec70('0x3a')]=_0x4bba8a['Imap'][_0xec70('0x3a')];_0xa4dd66[_0xec70('0x3b')]=_0x4bba8a[_0xec70('0x40')][_0xec70('0x3b')];_0x4d2e94[_0xec70('0x3a')]=_0x4bba8a[_0xec70('0x41')][_0xec70('0x3a')];_0x4d2e94[_0xec70('0x3b')]=_0x4bba8a['Smtp'][_0xec70('0x3b')];}return{'Imap':_0xa4dd66,'Smtp':_0x4d2e94};}exports[_0xec70('0x42')]=function(_0xf3dbe5,_0x2d1aa2){var _0x456459={'include':[{'model':db[_0xec70('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xec70('0x41')},{'model':db['Pause'],'as':_0xec70('0x44')}]},_0x1ccd68={},_0x1e43a0={'count':0x0,'rows':[]};var _0x1d90f6=_[_0xec70('0x45')](db[_0xec70('0x46')][_0xec70('0x47')],function(_0x4956d8){return{'name':_0x4956d8['fieldName'],'type':_0x4956d8[_0xec70('0x48')][_0xec70('0x49')]};});_0x1ccd68[_0xec70('0x4a')]=_[_0xec70('0x45')](_0x1d90f6,_0xec70('0x29'));_0x1ccd68[_0xec70('0x4b')]=_[_0xec70('0x4c')](_0xf3dbe5['query']);_0x1ccd68[_0xec70('0x4d')]=_[_0xec70('0x4e')](_0x1ccd68[_0xec70('0x4a')],_0x1ccd68[_0xec70('0x4b')]);_0x456459[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x1ccd68[_0xec70('0x4a')],qs[_0xec70('0x50')](_0xf3dbe5[_0xec70('0x4b')]['fields']));_0x456459[_0xec70('0x4f')]=_0x456459[_0xec70('0x4f')][_0xec70('0x51')]?_0x456459[_0xec70('0x4f')]:_0x1ccd68[_0xec70('0x4a')];if(!_0xf3dbe5[_0xec70('0x4b')][_0xec70('0x52')]('nolimit')){_0x456459['limit']=qs[_0xec70('0x1d')](_0xf3dbe5[_0xec70('0x4b')][_0xec70('0x1d')]);_0x456459[_0xec70('0x1c')]=qs['offset'](_0xf3dbe5[_0xec70('0x4b')][_0xec70('0x1c')]);}_0x456459[_0xec70('0x53')]=qs['sort'](_0xf3dbe5['query'][_0xec70('0x54')]);_0x456459[_0xec70('0x55')]=qs['filters'](_[_0xec70('0x56')](_0xf3dbe5['query'],_0x1ccd68[_0xec70('0x4d')]),_0x1d90f6);if(_0xf3dbe5[_0xec70('0x4b')]['filter']){_0x456459['where']=_[_0xec70('0x57')](_0x456459[_0xec70('0x55')],{'$or':_['map'](_0x1d90f6,function(_0x4a2c05){if(_0x4a2c05[_0xec70('0x48')]!==_0xec70('0x58')){var _0x1d265e={};_0x1d265e[_0x4a2c05[_0xec70('0x29')]]={'$like':'%'+_0xf3dbe5[_0xec70('0x4b')][_0xec70('0x59')]+'%'};return _0x1d265e;}})});}_0x456459=_[_0xec70('0x57')]({},_0x456459,_0xf3dbe5[_0xec70('0x5a')]);var _0x5641da={'where':_0x456459[_0xec70('0x55')]};return db['MailAccount'][_0xec70('0x1f')](_0x5641da)[_0xec70('0x10')](function(_0x532e58){_0x1e43a0[_0xec70('0x1f')]=_0x532e58;if(_0xf3dbe5[_0xec70('0x4b')][_0xec70('0x5b')]){_0x456459['include']=[{'all':!![]}];}return db['MailAccount'][_0xec70('0x5c')](_0x456459);})[_0xec70('0x10')](function(_0x4af771){_0x1e43a0[_0xec70('0x5d')]=_0x4af771;return _0x1e43a0;})[_0xec70('0x10')](respondWithFilteredResult(_0x2d1aa2,_0x456459))[_0xec70('0x19')](handleError(_0x2d1aa2,null));};exports[_0xec70('0x5e')]=function(_0x212c90,_0x4f3ab5){var _0x320b61={'raw':![],'where':{'id':_0x212c90[_0xec70('0x5f')]['id']},'include':[{'model':db[_0xec70('0x43')],'as':_0xec70('0x40')},{'model':db['MailServerOut'],'as':_0xec70('0x41')},{'model':db['Pause'],'as':_0xec70('0x44')}]},_0x1c5b75={};_0x1c5b75[_0xec70('0x4a')]=_['keys'](db[_0xec70('0x46')][_0xec70('0x47')]);_0x1c5b75[_0xec70('0x4b')]=_[_0xec70('0x4c')](_0x212c90[_0xec70('0x4b')]);_0x1c5b75[_0xec70('0x4d')]=_[_0xec70('0x4e')](_0x1c5b75[_0xec70('0x4a')],_0x1c5b75[_0xec70('0x4b')]);_0x320b61[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x1c5b75[_0xec70('0x4a')],qs[_0xec70('0x50')](_0x212c90[_0xec70('0x4b')][_0xec70('0x50')]));_0x320b61['attributes']=_0x320b61[_0xec70('0x4f')][_0xec70('0x51')]?_0x320b61[_0xec70('0x4f')]:_0x1c5b75[_0xec70('0x4a')];if(_0x212c90['query']['includeAll']){_0x320b61[_0xec70('0x60')]=[{'all':!![]}];}_0x320b61=_[_0xec70('0x57')]({},_0x320b61,_0x212c90[_0xec70('0x5a')]);return db[_0xec70('0x46')][_0xec70('0x61')](_0x320b61)[_0xec70('0x10')](handleEntityNotFound(_0x4f3ab5,null))[_0xec70('0x10')](respondWithResult(_0x4f3ab5,null))[_0xec70('0x19')](handleError(_0x4f3ab5,null));};exports[_0xec70('0x22')]=function(_0x309211,_0x35633f){if(_0x309211[_0xec70('0x62')]['id']){delete _0x309211[_0xec70('0x62')]['id'];}var _0x1aec6a=_0x309211[_0xec70('0x62')][_0xec70('0x63')]===_0xec70('0x64')?null:_0x309211[_0xec70('0x62')][_0xec70('0x63')];var _0xd7700a=_0x309211[_0xec70('0x62')][_0xec70('0x40')]||{};var _0x4ef0e8=_0x309211[_0xec70('0x62')][_0xec70('0x41')]||{};if(_0x1aec6a){_0xd7700a[_0xec70('0x3a')]=getImapHost(_0x1aec6a);_0xd7700a['port']=0x3e1;_0x4ef0e8['host']=getSmtpHost(_0x1aec6a);_0x4ef0e8[_0xec70('0x3b')]=0x24b;_0x4ef0e8[_0xec70('0x3c')]=![];}if(_0x4ef0e8[_0xec70('0x38')]){_0x4ef0e8[_0xec70('0x3c')]=![];}else{_0x4ef0e8['CloudProviderId']=null;}if(!_0xd7700a[_0xec70('0x38')])_0xd7700a[_0xec70('0x39')]=null;_0x309211['body'][_0xec70('0x40')]=_0xd7700a;_0x309211[_0xec70('0x62')][_0xec70('0x41')]=_0x4ef0e8;return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x309211[_0xec70('0x5f')]['id']},'include':[{'model':db[_0xec70('0x43')],'as':_0xec70('0x40')},{'model':db[_0xec70('0x65')],'as':_0xec70('0x41')},{'model':db[_0xec70('0x66')],'as':_0xec70('0x44')}]})[_0xec70('0x10')](handleEntityNotFound(_0x35633f,null))[_0xec70('0x10')](function(_0x55cfda){if(!_0x55cfda)throw new Error(_0xec70('0x67'));if(_0x55cfda[_0xec70('0x3d')])delete _0x309211['body'][_0xec70('0x40')];return _0x55cfda;})[_0xec70('0x10')](saveUpdates(_0x309211[_0xec70('0x62')],null))[_0xec70('0x10')](function(_0x3f1618){if(!_0x309211[_0xec70('0x62')][_0xec70('0x40')])return _0x3f1618;return db[_0xec70('0x43')][_0xec70('0x22')](_0x309211[_0xec70('0x62')]['Imap'],{'where':{'MailAccountId':_0x3f1618['id']}})['then'](function(){return _0x3f1618;});})[_0xec70('0x10')](function(_0xc7f51e){if(!_0x309211[_0xec70('0x62')][_0xec70('0x41')])return _0xc7f51e;return db[_0xec70('0x65')][_0xec70('0x22')](_0x309211[_0xec70('0x62')][_0xec70('0x41')],{'where':{'MailAccountId':_0xc7f51e['id']}})['then'](function(){return _0xc7f51e;});})[_0xec70('0x10')](respondWithResult(_0x35633f,null))[_0xec70('0x19')](handleError(_0x35633f,null));};exports['describe']=function(_0x155315,_0x56c33e){return db[_0xec70('0x46')]['describe']()[_0xec70('0x10')](respondWithResult(_0x56c33e,null))[_0xec70('0x19')](handleError(_0x56c33e,null));};exports[_0xec70('0x68')]=function(_0x47d84a,_0x2528e9){if(_0x47d84a[_0xec70('0x62')]['id']){delete _0x47d84a[_0xec70('0x62')]['id'];}return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x47d84a[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x2528e9,null))[_0xec70('0x10')](function(_0x486b07){if(_0x486b07){_0x47d84a[_0xec70('0x62')][_0xec70('0x69')]=_0x486b07['id'];return db['Disposition'][_0xec70('0x6a')](_0x47d84a[_0xec70('0x62')]);}})[_0xec70('0x10')](respondWithResult(_0x2528e9,null))[_0xec70('0x19')](handleError(_0x2528e9,null));};exports[_0xec70('0x6b')]=function(_0x4702b0,_0x1ea6d8){var _0x533644={'raw':![],'where':{}};var _0x5d2d7d={};var _0xea7896={'count':0x0,'rows':[]};return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x4702b0[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x1ea6d8,null))[_0xec70('0x10')](function(_0x2a5571){if(_0x2a5571){_0x5d2d7d[_0xec70('0x4a')]=_[_0xec70('0x4c')](db['Disposition']['rawAttributes']);_0x5d2d7d[_0xec70('0x4b')]=_[_0xec70('0x4c')](_0x4702b0[_0xec70('0x4b')]);_0x5d2d7d[_0xec70('0x4d')]=_[_0xec70('0x4e')](_0x5d2d7d[_0xec70('0x4a')],_0x5d2d7d[_0xec70('0x4b')]);_0x533644[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x5d2d7d[_0xec70('0x4a')],qs[_0xec70('0x50')](_0x4702b0[_0xec70('0x4b')]['fields']));_0x533644['attributes']=_0x533644['attributes'][_0xec70('0x51')]?_0x533644[_0xec70('0x4f')]:_0x5d2d7d[_0xec70('0x4a')];if(!_0x4702b0[_0xec70('0x4b')]['hasOwnProperty'](_0xec70('0x6d'))){_0x533644[_0xec70('0x1d')]=qs[_0xec70('0x1d')](_0x4702b0['query']['limit']);_0x533644[_0xec70('0x1c')]=qs[_0xec70('0x1c')](_0x4702b0['query']['offset']);}_0x533644[_0xec70('0x53')]=qs[_0xec70('0x54')](_0x4702b0[_0xec70('0x4b')][_0xec70('0x54')]);_0x533644[_0xec70('0x55')]=qs[_0xec70('0x4d')](_[_0xec70('0x56')](_0x4702b0['query'],_0x5d2d7d[_0xec70('0x4d')]));_0x533644[_0xec70('0x55')][_0xec70('0x69')]=_0x2a5571['id'];if(_0x4702b0[_0xec70('0x4b')][_0xec70('0x59')]){_0x533644[_0xec70('0x55')]=_[_0xec70('0x57')](_0x533644['where'],{'$or':_['map'](_0x533644[_0xec70('0x4f')],function(_0x3f8f86){var _0x5d3740={};_0x5d3740[_0x3f8f86]={'$like':'%'+_0x4702b0['query']['filter']+'%'};return _0x5d3740;})});}_0x533644=_['merge']({},_0x533644,_0x4702b0['options']);return db[_0xec70('0x6e')][_0xec70('0x1f')]({'where':_0x533644['where']})[_0xec70('0x10')](function(_0x4a063c){_0xea7896[_0xec70('0x1f')]=_0x4a063c;if(_0x4702b0[_0xec70('0x4b')][_0xec70('0x5b')]){_0x533644[_0xec70('0x60')]=[{'all':!![]}];}return db[_0xec70('0x6e')][_0xec70('0x5c')](_0x533644);})[_0xec70('0x10')](function(_0x38ebdd){_0xea7896['rows']=_0x38ebdd;return _0xea7896;});}})[_0xec70('0x10')](respondWithFilteredResult(_0x1ea6d8,_0x533644))[_0xec70('0x19')](handleError(_0x1ea6d8,null));};exports[_0xec70('0x6f')]=function(_0x15fcf7,_0x49c0a6){return db[_0xec70('0x46')]['find']({'where':{'id':_0x15fcf7[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x49c0a6,null))[_0xec70('0x10')](function(_0x42c7e1){if(_0x42c7e1){return _0x42c7e1[_0xec70('0x6f')](_0x15fcf7[_0xec70('0x4b')][_0xec70('0x70')]);}})['then'](respondWithStatusCode(_0x49c0a6,null))[_0xec70('0x19')](handleError(_0x49c0a6,null));};exports['addAnswer']=function(_0x595b7e,_0x6af803){if(_0x595b7e[_0xec70('0x62')]['id']){delete _0x595b7e['body']['id'];}return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x595b7e['params']['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x6af803,null))[_0xec70('0x10')](function(_0x4bcb2d){if(_0x4bcb2d){_0x595b7e[_0xec70('0x62')][_0xec70('0x69')]=_0x4bcb2d['id'];return db[_0xec70('0x71')][_0xec70('0x6a')](_0x595b7e[_0xec70('0x62')]);}})[_0xec70('0x10')](respondWithResult(_0x6af803,null))[_0xec70('0x19')](handleError(_0x6af803,null));};exports[_0xec70('0x72')]=function(_0x1a90ee,_0x220de5){var _0x385f48={'raw':![],'where':{}};var _0x557d70={};var _0x51871a={'count':0x0,'rows':[]};return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x1a90ee[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x220de5,null))[_0xec70('0x10')](function(_0x182b9f){if(_0x182b9f){_0x557d70[_0xec70('0x4a')]=_['keys'](db['CannedAnswer'][_0xec70('0x47')]);_0x557d70['query']=_[_0xec70('0x4c')](_0x1a90ee[_0xec70('0x4b')]);_0x557d70['filters']=_[_0xec70('0x4e')](_0x557d70[_0xec70('0x4a')],_0x557d70[_0xec70('0x4b')]);_0x385f48[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x557d70['model'],qs[_0xec70('0x50')](_0x1a90ee[_0xec70('0x4b')]['fields']));_0x385f48[_0xec70('0x4f')]=_0x385f48[_0xec70('0x4f')][_0xec70('0x51')]?_0x385f48[_0xec70('0x4f')]:_0x557d70[_0xec70('0x4a')];if(!_0x1a90ee['query'][_0xec70('0x52')](_0xec70('0x6d'))){_0x385f48[_0xec70('0x1d')]=qs[_0xec70('0x1d')](_0x1a90ee['query'][_0xec70('0x1d')]);_0x385f48[_0xec70('0x1c')]=qs[_0xec70('0x1c')](_0x1a90ee['query'][_0xec70('0x1c')]);}_0x385f48[_0xec70('0x53')]=qs[_0xec70('0x54')](_0x1a90ee[_0xec70('0x4b')][_0xec70('0x54')]);_0x385f48[_0xec70('0x55')]=qs[_0xec70('0x4d')](_[_0xec70('0x56')](_0x1a90ee['query'],_0x557d70[_0xec70('0x4d')]));_0x385f48[_0xec70('0x55')][_0xec70('0x69')]=_0x182b9f['id'];if(_0x1a90ee[_0xec70('0x4b')][_0xec70('0x59')]){_0x385f48[_0xec70('0x55')]=_[_0xec70('0x57')](_0x385f48['where'],{'$or':_[_0xec70('0x45')](_0x385f48[_0xec70('0x4f')],function(_0x191466){var _0x1c0b62={};_0x1c0b62[_0x191466]={'$like':'%'+_0x1a90ee[_0xec70('0x4b')][_0xec70('0x59')]+'%'};return _0x1c0b62;})});}_0x385f48=_[_0xec70('0x57')]({},_0x385f48,_0x1a90ee[_0xec70('0x5a')]);return db[_0xec70('0x71')][_0xec70('0x1f')]({'where':_0x385f48[_0xec70('0x55')]})[_0xec70('0x10')](function(_0x2b7177){_0x51871a[_0xec70('0x1f')]=_0x2b7177;if(_0x1a90ee[_0xec70('0x4b')]['includeAll']){_0x385f48[_0xec70('0x60')]=[{'all':!![]}];}return db[_0xec70('0x71')][_0xec70('0x5c')](_0x385f48);})[_0xec70('0x10')](function(_0x75f703){_0x51871a[_0xec70('0x5d')]=_0x75f703;return _0x51871a;});}})[_0xec70('0x10')](respondWithFilteredResult(_0x220de5,_0x385f48))['catch'](handleError(_0x220de5,null));};exports[_0xec70('0x73')]=function(_0x447880,_0x357214){return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x447880[_0xec70('0x5f')]['id']}})['then'](handleEntityNotFound(_0x357214,null))[_0xec70('0x10')](function(_0x1d1cd9){if(_0x1d1cd9){return _0x1d1cd9[_0xec70('0x73')](_0x447880['query'][_0xec70('0x70')]);}})['then'](respondWithStatusCode(_0x357214,null))['catch'](handleError(_0x357214,null));};exports[_0xec70('0x6a')]=function(_0x5ba4ed,_0x5d1286){var _0x30b752={'name':_0x5ba4ed[_0xec70('0x62')][_0xec70('0x29')],'key':_0x5ba4ed[_0xec70('0x62')][_0xec70('0x49')],'provider':_0x5ba4ed[_0xec70('0x62')][_0xec70('0x63')]===_0xec70('0x64')?null:_0x5ba4ed['body'][_0xec70('0x63')],'email':_0x5ba4ed[_0xec70('0x62')][_0xec70('0x74')],'ListId':_0x5ba4ed['body'][_0xec70('0x75')],'active':!_[_0xec70('0x76')](_0x5ba4ed[_0xec70('0x62')][_0xec70('0x77')])?_0x5ba4ed[_0xec70('0x62')][_0xec70('0x77')]:!![],'description':_0x5ba4ed[_0xec70('0x62')]['description']||null};var _0x2a7317=getAuthenticationOptions(_0x30b752['provider'],_0x5ba4ed[_0xec70('0x62')]);_0x30b752[_0xec70('0x40')]=_0x2a7317['Imap'];_0x30b752[_0xec70('0x41')]=_0x2a7317[_0xec70('0x41')];return db['MailAccount']['create'](_0x30b752,{'include':[{'model':db[_0xec70('0x65')],'as':_0xec70('0x41')},{'model':db[_0xec70('0x43')],'as':'Imap'}]})[_0xec70('0x10')](function(_0x2d0da1){var _0x3da151=_0x5ba4ed['user'][_0xec70('0x23')]({'plain':!![]});if(!_0x3da151)throw new Error(_0xec70('0x78'));if(_0x3da151[_0xec70('0x79')]===_0xec70('0x3e')){var _0xbdbe52=_0x2d0da1[_0xec70('0x23')]({'plain':!![]});return db[_0xec70('0x7a')][_0xec70('0x61')]({'where':{'name':_0xec70('0x24'),'userProfileId':_0x3da151['userProfileId']},'raw':!![]})['then'](function(_0x5535f5){if(_0x5535f5&&_0x5535f5[_0xec70('0x7b')]===0x0){return db['UserProfileResource'][_0xec70('0x6a')]({'name':_0xbdbe52[_0xec70('0x29')],'resourceId':_0xbdbe52['id'],'type':_0x5535f5[_0xec70('0x29')],'sectionId':_0x5535f5['id']},{})[_0xec70('0x10')](function(){return _0x2d0da1;});}else{return _0x2d0da1;}})[_0xec70('0x19')](function(_0x3bfed8){logger[_0xec70('0x16')](_0xec70('0x7c'),_0x3bfed8);throw _0x3bfed8;});}return _0x2d0da1;})[_0xec70('0x10')](respondWithResult(_0x5d1286,0xc9))['catch'](handleError(_0x5d1286,null));};exports[_0xec70('0x7d')]=function(_0x285e60,_0x3d0de2){return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x285e60['params']['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x3d0de2,null))[_0xec70('0x10')](function(_0x1c6882){if(_0x1c6882){return _0x1c6882['getImap']();}return null;})[_0xec70('0x10')](respondWithResult(_0x3d0de2,null))['catch'](handleError(_0x3d0de2,null));};exports[_0xec70('0x7e')]=function(_0x3df21e,_0x55e7c5){if(_0x3df21e[_0xec70('0x62')]['id']){delete _0x3df21e['body']['id'];}return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x3df21e['params']['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x55e7c5,null))['then'](function(_0x343010){if(_0x343010){_0x3df21e[_0xec70('0x62')]['MailAccountId']=_0x343010['id'];return db[_0xec70('0x43')][_0xec70('0x6a')](_0x3df21e[_0xec70('0x62')]);}})[_0xec70('0x10')](respondWithResult(_0x55e7c5,null))[_0xec70('0x19')](handleError(_0x55e7c5,null));};exports['removeImap']=function(_0x507882,_0x2df79a){return db[_0xec70('0x46')]['findOne']({'where':{'id':_0x507882[_0xec70('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2df79a,null))[_0xec70('0x10')](function(_0x2fbae8){if(_0x2fbae8){return _0x2fbae8['setImap'](null);}return null;})[_0xec70('0x10')](respondWithStatusCode(_0x2df79a,null))['catch'](handleError(_0x2df79a,null));};exports[_0xec70('0x7f')]=function(_0x14b003,_0x56b15f){return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x14b003[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x56b15f,null))['then'](function(_0x967683){if(_0x967683){return _0x967683[_0xec70('0x7f')]();}return null;})[_0xec70('0x10')](respondWithResult(_0x56b15f,null))[_0xec70('0x19')](handleError(_0x56b15f,null));};exports[_0xec70('0x80')]=function(_0x17df10,_0x21dca8){if(_0x17df10['body']['id']){delete _0x17df10['body']['id'];}return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x17df10[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x21dca8,null))[_0xec70('0x10')](function(_0x493ac1){if(_0x493ac1){_0x17df10[_0xec70('0x62')]['MailAccountId']=_0x493ac1['id'];return db[_0xec70('0x65')][_0xec70('0x6a')](_0x17df10[_0xec70('0x62')]);}})[_0xec70('0x10')](respondWithResult(_0x21dca8,null))[_0xec70('0x19')](handleError(_0x21dca8,null));};exports[_0xec70('0x81')]=function(_0x58970b,_0xa8a3){return db['MailAccount'][_0xec70('0x6c')]({'where':{'id':_0x58970b[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0xa8a3,null))[_0xec70('0x10')](function(_0x160b6f){if(_0x160b6f){return _0x160b6f['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0xa8a3,null))[_0xec70('0x19')](handleError(_0xa8a3,null));};exports['addInteraction']=function(_0x3da9ed,_0xc5f8b1){return db[_0xec70('0x82')][_0xec70('0x61')]({'where':{'id':_0x3da9ed[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0xc5f8b1,null))[_0xec70('0x10')](function(_0x3678a6){if(_0x3678a6){return _0x3678a6[_0xec70('0x83')](_0x3da9ed['body'][_0xec70('0x70')],_[_0xec70('0x84')](_0x3da9ed['body'],['ids','id'])||{});}})[_0xec70('0x10')](respondWithResult(_0xc5f8b1,null))['catch'](handleError(_0xc5f8b1,null));};exports['getInteractions']=function(_0x490a87,_0x1ad076){var _0x334f0a={'raw':![],'where':{}};var _0x4da926={};var _0x5219a3={'count':0x0,'rows':[]};return db['MailAccount'][_0xec70('0x6c')]({'where':{'id':_0x490a87[_0xec70('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1ad076,null))[_0xec70('0x10')](function(_0x1d7e04){if(_0x1d7e04){_0x4da926[_0xec70('0x4a')]=_[_0xec70('0x4c')](db[_0xec70('0x82')][_0xec70('0x47')]);_0x4da926[_0xec70('0x4b')]=_['keys'](_0x490a87['query']);_0x4da926[_0xec70('0x4d')]=_[_0xec70('0x4e')](_0x4da926[_0xec70('0x4a')],_0x4da926[_0xec70('0x4b')]);_0x334f0a[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x4da926[_0xec70('0x4a')],qs[_0xec70('0x50')](_0x490a87['query']['fields']));_0x334f0a[_0xec70('0x4f')]=_0x334f0a[_0xec70('0x4f')]['length']?_0x334f0a[_0xec70('0x4f')]:_0x4da926[_0xec70('0x4a')];if(!_0x490a87[_0xec70('0x4b')]['hasOwnProperty'](_0xec70('0x6d'))){_0x334f0a[_0xec70('0x1d')]=qs[_0xec70('0x1d')](_0x490a87['query']['limit']);_0x334f0a[_0xec70('0x1c')]=qs[_0xec70('0x1c')](_0x490a87['query'][_0xec70('0x1c')]);}_0x334f0a[_0xec70('0x53')]=qs[_0xec70('0x54')](_0x490a87[_0xec70('0x4b')][_0xec70('0x54')]);_0x334f0a[_0xec70('0x55')]=qs[_0xec70('0x4d')](_[_0xec70('0x56')](_0x490a87[_0xec70('0x4b')],_0x4da926[_0xec70('0x4d')]));_0x334f0a[_0xec70('0x55')][_0xec70('0x69')]=_0x1d7e04['id'];if(_0x490a87[_0xec70('0x4b')][_0xec70('0x59')]){_0x334f0a['where']=_[_0xec70('0x57')](_0x334f0a[_0xec70('0x55')],{'$or':_[_0xec70('0x45')](_0x334f0a[_0xec70('0x4f')],function(_0x2cf787){var _0x1978e8={};_0x1978e8[_0x2cf787]={'$like':'%'+_0x490a87[_0xec70('0x4b')][_0xec70('0x59')]+'%'};return _0x1978e8;})});}_0x334f0a=_[_0xec70('0x57')]({},_0x334f0a,_0x490a87[_0xec70('0x5a')]);return db['MailInteraction'][_0xec70('0x1f')]({'where':_0x334f0a['where']})['then'](function(_0x239f0a){_0x5219a3[_0xec70('0x1f')]=_0x239f0a;if(_0x490a87[_0xec70('0x4b')]['includeAll']){_0x334f0a[_0xec70('0x60')]=[{'model':db[_0xec70('0x85')],'as':_0xec70('0x86'),'required':![]},{'model':db[_0xec70('0x87')],'as':_0xec70('0x88'),'attributes':[_0xec70('0x29'),_0xec70('0x89'),_0xec70('0x8a')],'required':![]},{'model':db[_0xec70('0x8b')],'as':_0xec70('0x8c'),'attributes':['id','name',_0xec70('0x8d')],'where':_0x490a87[_0xec70('0x4b')][_0xec70('0x8e')]?{'id':_0x490a87[_0xec70('0x4b')][_0xec70('0x8e')]}:undefined,'required':_0x490a87['query'][_0xec70('0x8e')]?!![]:![]}];}return db[_0xec70('0x82')][_0xec70('0x5c')](_0x334f0a);})[_0xec70('0x10')](function(_0x389667){_0x5219a3[_0xec70('0x5d')]=_0x389667;return _0x5219a3;});}})[_0xec70('0x10')](respondWithFilteredResult(_0x1ad076,_0x334f0a))[_0xec70('0x19')](handleError(_0x1ad076,null));};exports[_0xec70('0x8f')]=function addApplications(_0x61bbd9,_0x5e9827){var _0x1fff0a=_0x61bbd9[_0xec70('0x5f')]['id'];var _0x576c77=_0x61bbd9[_0xec70('0x62')];var _0x58ba71=0xc8;var _0x432571=null;return db[_0xec70('0x90')][_0xec70('0x91')]({'isolationLevel':db['sequelize'][_0xec70('0x92')][_0xec70('0x93')][_0xec70('0x94')]},function(_0x2f01c4){return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x1fff0a},'transaction':_0x2f01c4})[_0xec70('0x10')](function(_0x527b67){if(_0x527b67){return db[_0xec70('0x95')][_0xec70('0x26')]({'where':{'MailAccountId':_0x1fff0a},'transaction':_0x2f01c4})[_0xec70('0x10')](function(){var _0x4bb7d2=_[_0xec70('0x45')](_0x576c77,function(_0x55fd13){_0x55fd13[_0xec70('0x69')]=_0x1fff0a;return _0x55fd13;});return db[_0xec70('0x95')][_0xec70('0x96')](_0x4bb7d2,{'transaction':_0x2f01c4});});}else{_0x58ba71=0x194;_0x432571=[];}});})[_0xec70('0x10')](function(){if(_0x58ba71!==0x194){return db[_0xec70('0x95')][_0xec70('0x97')]({'where':{'MailAccountId':_0x1fff0a},'order':_0xec70('0x98')})[_0xec70('0x10')](function(_0x50611c){_0x432571=_0x50611c;});}})['catch'](function(_0x10074){_0x58ba71=0x1f4;logger[_0xec70('0x16')](_0x10074[_0xec70('0x28')]);if(_0x10074[_0xec70('0x29')]){delete _0x10074[_0xec70('0x29')];}_0x432571=_0x10074;})[_0xec70('0x99')](function(){if(_0x432571===null){_0x5e9827['sendStatus'](_0x58ba71);}else{if(_0x58ba71===0x1f4){_0x5e9827[_0xec70('0x1a')](_0x58ba71)[_0xec70('0x2a')](_0x432571);}else{_0x5e9827[_0xec70('0x1a')](_0x58ba71)[_0xec70('0x1b')](_0x432571);}}});};exports[_0xec70('0x9a')]=function(_0x2dc1f5,_0x193bbb){var _0x4bd9b4={};var _0x5dc7f6={};var _0x587a20;var _0x55f7e5;return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x2dc1f5[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x193bbb,null))['then'](function(_0x502b7f){if(_0x502b7f){_0x587a20=_0x502b7f;_0x5dc7f6[_0xec70('0x4a')]=_[_0xec70('0x4c')](db[_0xec70('0x95')][_0xec70('0x47')]);_0x5dc7f6[_0xec70('0x4b')]=_[_0xec70('0x4c')](_0x2dc1f5['query']);_0x5dc7f6['filters']=_[_0xec70('0x4e')](_0x5dc7f6['model'],_0x5dc7f6['query']);_0x4bd9b4[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x5dc7f6[_0xec70('0x4a')],qs[_0xec70('0x50')](_0x2dc1f5[_0xec70('0x4b')][_0xec70('0x50')]));_0x4bd9b4[_0xec70('0x4f')]=_0x4bd9b4['attributes'][_0xec70('0x51')]?_0x4bd9b4[_0xec70('0x4f')]:_0x5dc7f6['model'];_0x4bd9b4[_0xec70('0x53')]=qs[_0xec70('0x54')](_0x2dc1f5[_0xec70('0x4b')][_0xec70('0x54')]);_0x4bd9b4[_0xec70('0x55')]=qs['filters'](_[_0xec70('0x56')](_0x2dc1f5[_0xec70('0x4b')],_0x5dc7f6['filters']));if(_0x2dc1f5[_0xec70('0x4b')][_0xec70('0x59')]){_0x4bd9b4[_0xec70('0x55')]=_['merge'](_0x4bd9b4['where'],{'$or':_[_0xec70('0x45')](_0x4bd9b4[_0xec70('0x4f')],function(_0x4fdd33){var _0x367587={};_0x367587[_0x4fdd33]={'$like':'%'+_0x2dc1f5[_0xec70('0x4b')][_0xec70('0x59')]+'%'};return _0x367587;})});}_0x4bd9b4=_[_0xec70('0x57')]({},_0x4bd9b4,_0x2dc1f5['options']);return _0x587a20[_0xec70('0x9a')](_0x4bd9b4);}})[_0xec70('0x10')](function(_0x90e52f){if(_0x90e52f){_0x55f7e5=_0x90e52f[_0xec70('0x51')];if(!_0x2dc1f5[_0xec70('0x4b')]['hasOwnProperty'](_0xec70('0x6d'))){_0x4bd9b4[_0xec70('0x1d')]=qs[_0xec70('0x1d')](_0x2dc1f5['query'][_0xec70('0x1d')]);_0x4bd9b4['offset']=qs[_0xec70('0x1c')](_0x2dc1f5[_0xec70('0x4b')][_0xec70('0x1c')]);}return _0x587a20[_0xec70('0x9a')](_0x4bd9b4);}})[_0xec70('0x10')](function(_0x415b96){if(_0x415b96){return _0x415b96?{'count':_0x55f7e5,'rows':_0x415b96}:null;}})['then'](respondWithResult(_0x193bbb,null))[_0xec70('0x19')](handleError(_0x193bbb,null));};exports[_0xec70('0x9b')]=function(_0x3b5a22,_0x220fb4){var _0x1c4c0e={'raw':!![],'where':{}};var _0x3b94e8={};var _0x1b1879={'count':0x0,'rows':[]};return db[_0xec70('0x46')][_0xec70('0x6c')]({'where':{'id':_0x3b5a22[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x220fb4,null))['then'](function(_0x8559a4){if(_0x8559a4){_0x3b94e8[_0xec70('0x4a')]=_['keys'](db[_0xec70('0x9c')][_0xec70('0x47')]);_0x3b94e8[_0xec70('0x4b')]=_[_0xec70('0x4c')](_0x3b5a22[_0xec70('0x4b')]);_0x3b94e8['filters']=_['intersection'](_0x3b94e8['model'],_0x3b94e8['query']);_0x1c4c0e[_0xec70('0x4f')]=_[_0xec70('0x4e')](_0x3b94e8[_0xec70('0x4a')],qs[_0xec70('0x50')](_0x3b5a22['query'][_0xec70('0x50')]));_0x1c4c0e[_0xec70('0x4f')]=_0x1c4c0e[_0xec70('0x4f')][_0xec70('0x51')]?_0x1c4c0e[_0xec70('0x4f')]:_0x3b94e8[_0xec70('0x4a')];if(!_0x3b5a22['query'][_0xec70('0x52')](_0xec70('0x6d'))){_0x1c4c0e[_0xec70('0x1d')]=qs['limit'](_0x3b5a22[_0xec70('0x4b')][_0xec70('0x1d')]);_0x1c4c0e[_0xec70('0x1c')]=qs[_0xec70('0x1c')](_0x3b5a22[_0xec70('0x4b')][_0xec70('0x1c')]);}_0x1c4c0e[_0xec70('0x53')]=qs['sort'](_0x3b5a22[_0xec70('0x4b')][_0xec70('0x54')]);_0x1c4c0e[_0xec70('0x55')]=qs[_0xec70('0x4d')](_['pick'](_0x3b5a22[_0xec70('0x4b')],_0x3b94e8['filters']));_0x1c4c0e['where'][_0xec70('0x69')]=_0x8559a4['id'];if(_0x3b5a22[_0xec70('0x4b')][_0xec70('0x59')]){_0x1c4c0e[_0xec70('0x55')]=_[_0xec70('0x57')](_0x1c4c0e[_0xec70('0x55')],{'$or':_[_0xec70('0x45')](_0x1c4c0e['attributes'],function(_0xad5f63){var _0x3ff6cf={};_0x3ff6cf[_0xad5f63]={'$like':'%'+_0x3b5a22[_0xec70('0x4b')]['filter']+'%'};return _0x3ff6cf;})});}if(_0x3b5a22[_0xec70('0x4b')][_0xec70('0x9d')]){var _0x3d58da=_0x3b5a22['query'][_0xec70('0x9d')][_0xec70('0x9e')](',');var _0x426729={};_0x426729[_0x3d58da[0x0]]={'$gte':moment(_0x3d58da[0x1])[_0xec70('0x9f')](_0xec70('0xa0'))};_0x1c4c0e[_0xec70('0x55')]=_[_0xec70('0x57')](_0x1c4c0e[_0xec70('0x55')],_0x426729);}_0x1c4c0e=_[_0xec70('0x57')]({},_0x1c4c0e,_0x3b5a22['options']);return db['MailMessage'][_0xec70('0x1f')]({'where':_0x1c4c0e[_0xec70('0x55')]})[_0xec70('0x10')](function(_0x21c7bb){_0x1b1879['count']=_0x21c7bb;if(_0x3b5a22[_0xec70('0x4b')][_0xec70('0x5b')]){_0x1c4c0e['include']=[{'all':!![]}];}return db[_0xec70('0x9c')][_0xec70('0x5c')](_0x1c4c0e);})['then'](function(_0x5f17f1){if(_0x3b5a22[_0xec70('0x4b')]['inlineCss']===_0xec70('0xa1')){for(var _0x1b0b09=0x0;_0x1b0b09<_0x5f17f1['length'];_0x1b0b09++){_0x5f17f1[_0x1b0b09][_0xec70('0x62')]=juice(_0x5f17f1[_0x1b0b09][_0xec70('0x62')]);}}_0x1b1879[_0xec70('0x5d')]=_0x5f17f1;return _0x1b1879;});}})['then'](respondWithFilteredResult(_0x220fb4,_0x1c4c0e))[_0xec70('0x19')](handleError(_0x220fb4,null));};exports[_0xec70('0x2a')]=function(_0x3a22dc,_0x3b11a2){var _0x1d5068,_0x1d82cf={},_0x4b6fbb;if(_0x3a22dc[_0xec70('0x62')]['to']){_0x4b6fbb=_0x3a22dc[_0xec70('0x62')]['to']['split'](',')[0x0];}return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x3a22dc['params']['id']},'include':[{'model':db[_0xec70('0xa2')],'as':_0xec70('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4b6fbb},'limit':0x1,'order':[[_0xec70('0xa4'),_0xec70('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0xec70('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xec70('0xa6'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3b11a2,null))['then'](function(_0x4f299b){if(!_0x4f299b)return;_0x1d5068=_0x4f299b;if(!_0x4f299b[_0xec70('0x41')])throw new Error(_0xec70('0xa7'));if(_['isNil'](_0x3a22dc[_0xec70('0x62')][_0xec70('0xa8')])){_0x3a22dc[_0xec70('0x62')][_0xec70('0xa8')]=util[_0xec70('0x9f')](_0xec70('0xa9'),_0x4f299b[_0xec70('0x29')],_0x4f299b[_0xec70('0x74')]||_0x4f299b['Smtp'][_0xec70('0x3e')]);}if(_0x3a22dc['body']['attachments']&&_0x3a22dc['body'][_0xec70('0xaa')][_0xec70('0x51')]){for(var _0x5a2a41=0x0;_0x5a2a41<_0x3a22dc['body'][_0xec70('0xaa')]['length'];_0x5a2a41+=0x1){_0x3a22dc[_0xec70('0x62')][_0xec70('0xaa')][_0x5a2a41]={'filename':_0x3a22dc[_0xec70('0x62')][_0xec70('0xaa')][_0x5a2a41][_0xec70('0x29')],'path':path[_0xec70('0xab')](config['root'],_0xec70('0xac'),_0x3a22dc[_0xec70('0x62')][_0xec70('0xaa')][_0x5a2a41][_0xec70('0xad')])};}}var _0x2b9c81=_0x4f299b[_0xec70('0xae')]();return respondWithRpcPromise('SendMail',_0xec70('0xaf'),{'account':_0x2b9c81,'message':_0x3a22dc[_0xec70('0x62')]});})['then'](function(_0x4c2ba3){if(!_0x4c2ba3)return;_0x1d82cf=_0x4c2ba3;if(!_0x1d5068[_0xec70('0xa3')])throw new Error(_0xec70('0xb0'));if(_0x1d5068[_0xec70('0xa3')]['Contacts']['length'])return _0x1d5068['List'][_0xec70('0xb1')][0x0];return db['CmContact'][_0xec70('0x6a')](_[_0xec70('0x9')](_0x3a22dc[_0xec70('0x62')],{'firstName':_0x3a22dc[_0xec70('0x62')]['to'],'email':_0x3a22dc[_0xec70('0x62')]['to'],'phone':_0x3a22dc[_0xec70('0x62')]['to'],'ListId':_0x1d5068['ListId']}));})[_0xec70('0x10')](function(_0x25137b){if(!_0x25137b)return;var _0x37f37e={'UserId':_0x3a22dc[_0xec70('0x3e')]['id'],'ContactId':_0x25137b['id'],'MailAccountId':_0x1d5068['id'],'inReplyTo':_0x1d82cf[_0xec70('0xb2')],'to':_0x3a22dc[_0xec70('0x62')][_0xec70('0xa8')],'cc':_0x3a22dc['body']['cc'],'subject':_0x3a22dc[_0xec70('0x62')]['subject'],'attach':_0x3a22dc[_0xec70('0x62')][_0xec70('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xec70('0x9f')](_0xec70('0xa0')),'lastMsgDirection':_0xec70('0xb4'),'Messages':[_['merge'](_0x3a22dc['body'],{'messageId':_0x1d82cf[_0xec70('0xb2')],'sentAt':moment()['format'](_0xec70('0xa0')),'read':!![],'MailAccountId':_0x1d5068['id'],'UserId':_0x3a22dc[_0xec70('0x3e')]['id'],'ContactId':_0x25137b['id']})]};if(_0x3a22dc['body']['Interaction']){_0x37f37e=_[_0xec70('0x57')](_0x37f37e,_0x3a22dc[_0xec70('0x62')][_0xec70('0xb5')]);}return db[_0xec70('0x82')][_0xec70('0x6a')](_0x37f37e,{'include':[{'model':db[_0xec70('0x9c')],'as':_0xec70('0xb6')}]});})[_0xec70('0x10')](respondWithResult(_0x3b11a2,null))[_0xec70('0x19')](handleError(_0x3b11a2,null));};exports['verifySmtp']=function(_0x552b68,_0x383835){return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x552b68[_0xec70('0x5f')]['id']},'include':[{'model':db[_0xec70('0x65')],'as':_0xec70('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xec70('0xa6'),'raw':!![]}]}]})[_0xec70('0x10')](handleEntityNotFound(_0x383835,null))[_0xec70('0x10')](function(_0x56ccae){if(!_0x56ccae[_0xec70('0x41')])return;var _0x2f6be6=_0x56ccae[_0xec70('0xae')]();return respondWithRpcPromise(_0xec70('0xb7'),_0xec70('0xb8'),{'account':_0x2f6be6});})[_0xec70('0x10')](respondWithResult(_0x383835,null))[_0xec70('0x19')](handleError(_0x383835,null));};exports['destroy']=function(_0x4e8242,_0x2ce416){return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x4e8242[_0xec70('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2ce416,null))[_0xec70('0x10')](function(_0x2fa2ba){if(_0x2fa2ba&&_0x2fa2ba[_0xec70('0x3d')]){throw new db[(_0xec70('0xb9'))][(_0xec70('0xba'))](_0xec70('0xbb'));}return _0x2fa2ba;})['then'](removeEntity(_0x2ce416,null))[_0xec70('0x19')](handleError(_0x2ce416,null));};exports[_0xec70('0xbc')]=function(_0x214dc5,_0x3cef0d){return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x214dc5[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x3cef0d,null))['then'](function(_0x4772a4){if(_0x4772a4){return _0x4772a4[_0xec70('0xbc')](_0x214dc5[_0xec70('0x62')][_0xec70('0x70')],_[_0xec70('0x84')](_0x214dc5[_0xec70('0x62')],[_0xec70('0x70'),'id'])||{})[_0xec70('0xbd')](function(_0x3aa33b){for(var _0x519418=0x0;_0x519418<_0x214dc5[_0xec70('0x62')][_0xec70('0x70')]['length'];_0x519418+=0x1){socket['emit'](_0xec70('0xbe'),{'UserId':Number(_0x214dc5[_0xec70('0x62')]['ids'][_0x519418]),'MailAccountId':Number(_0x214dc5['params']['id'])});}return _0x3aa33b;});}})[_0xec70('0x10')](respondWithResult(_0x3cef0d,null))[_0xec70('0x19')](handleError(_0x3cef0d,null));};exports[_0xec70('0xbf')]=function(_0x40d1b2,_0x6b9ab0){return db[_0xec70('0x46')][_0xec70('0x61')]({'where':{'id':_0x40d1b2[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x6b9ab0,null))[_0xec70('0x10')](function(_0x577041){if(_0x577041){return _0x577041[_0xec70('0xbf')](_0x40d1b2[_0xec70('0x4b')]['ids'])[_0xec70('0x10')](function(){if(_[_0xec70('0xc0')](_0x40d1b2[_0xec70('0x4b')][_0xec70('0x70')])){for(var _0x23d53a=0x0;_0x23d53a<_0x40d1b2[_0xec70('0x4b')][_0xec70('0x70')][_0xec70('0x51')];_0x23d53a+=0x1){socket['emit'](_0xec70('0xc1'),{'UserId':Number(_0x40d1b2[_0xec70('0x4b')][_0xec70('0x70')][_0x23d53a]),'MailAccountId':Number(_0x40d1b2[_0xec70('0x5f')]['id'])});}}else{socket[_0xec70('0xc2')](_0xec70('0xc1'),{'UserId':Number(_0x40d1b2[_0xec70('0x4b')]['ids']),'MailAccountId':Number(_0x40d1b2['params']['id'])});}});}})[_0xec70('0x10')](respondWithStatusCode(_0x6b9ab0,null))[_0xec70('0x19')](handleError(_0x6b9ab0,null));};exports[_0xec70('0xc3')]=function(_0x1ed278,_0x395cf0){var _0x3dc622={};var _0x23df21={};var _0x33bd76;var _0x53dcf;return db['MailAccount'][_0xec70('0x6c')]({'where':{'id':_0x1ed278[_0xec70('0x5f')]['id']}})[_0xec70('0x10')](handleEntityNotFound(_0x395cf0,null))[_0xec70('0x10')](function(_0x326340){if(_0x326340){_0x33bd76=_0x326340;_0x23df21[_0xec70('0x4a')]=_[_0xec70('0x4c')](db['User'][_0xec70('0x47')]);_0x23df21['query']=_[_0xec70('0x4c')](_0x1ed278[_0xec70('0x4b')]);_0x23df21[_0xec70('0x4d')]=_[_0xec70('0x4e')](_0x23df21['model'],_0x23df21[_0xec70('0x4b')]);_0x3dc622[_0xec70('0x4f')]=_['intersection'](_0x23df21['model'],qs[_0xec70('0x50')](_0x1ed278[_0xec70('0x4b')]['fields']));_0x3dc622[_0xec70('0x4f')]=_0x3dc622[_0xec70('0x4f')][_0xec70('0x51')]?_0x3dc622[_0xec70('0x4f')]:_0x23df21[_0xec70('0x4a')];_0x3dc622[_0xec70('0x53')]=qs[_0xec70('0x54')](_0x1ed278['query']['sort']);_0x3dc622[_0xec70('0x55')]=qs[_0xec70('0x4d')](_['pick'](_0x1ed278[_0xec70('0x4b')],_0x23df21['filters']));if(_0x1ed278[_0xec70('0x4b')][_0xec70('0x59')]){_0x3dc622['where']=_[_0xec70('0x57')](_0x3dc622[_0xec70('0x55')],{'$or':_[_0xec70('0x45')](_0x3dc622[_0xec70('0x4f')],function(_0x3816ec){var _0x14cd8a={};_0x14cd8a[_0x3816ec]={'$like':'%'+_0x1ed278[_0xec70('0x4b')][_0xec70('0x59')]+'%'};return _0x14cd8a;})});}_0x3dc622=_[_0xec70('0x57')]({},_0x3dc622,_0x1ed278['options']);return _0x33bd76[_0xec70('0xc3')](_0x3dc622);}})[_0xec70('0x10')](function(_0x39b647){if(_0x39b647){_0x53dcf=_0x39b647[_0xec70('0x51')];if(!_0x1ed278[_0xec70('0x4b')]['hasOwnProperty'](_0xec70('0x6d'))){_0x3dc622[_0xec70('0x1d')]=qs[_0xec70('0x1d')](_0x1ed278[_0xec70('0x4b')]['limit']);_0x3dc622[_0xec70('0x1c')]=qs[_0xec70('0x1c')](_0x1ed278[_0xec70('0x4b')][_0xec70('0x1c')]);}return _0x33bd76[_0xec70('0xc3')](_0x3dc622);}})['then'](function(_0x37c611){if(_0x37c611){return _0x37c611?{'count':_0x53dcf,'rows':_0x37c611}:null;}})[_0xec70('0x10')](respondWithResult(_0x395cf0,null))[_0xec70('0x19')](handleError(_0x395cf0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2b0b329..e79982e 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 _0x1be0=['MailAccount','setMaxListeners','save','remove','emit','exports','../../mysqldb'];(function(_0x43fdd7,_0x1431e5){var _0xc478bd=function(_0x107186){while(--_0x107186){_0x43fdd7['push'](_0x43fdd7['shift']());}};_0xc478bd(++_0x1431e5);}(_0x1be0,0x16b));var _0x01be=function(_0x11907d,_0x1c2b1b){_0x11907d=_0x11907d-0x0;var _0x30ac85=_0x1be0[_0x11907d];return _0x30ac85;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x01be('0x0'))['db'][_0x01be('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x01be('0x2')](0x0);var events={'afterCreate':_0x01be('0x3'),'afterUpdate':'update','afterDestroy':_0x01be('0x4')};function emitEvent(_0x225de0){return function(_0x3b9df4,_0xd632ab,_0x53a68b){MailAccountEvents[_0x01be('0x5')](_0x225de0+':'+_0x3b9df4['id'],_0x3b9df4);MailAccountEvents[_0x01be('0x5')](_0x225de0,_0x3b9df4);_0x53a68b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x01be('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xa945=['events','../../mysqldb','MailAccount','update','emit','hook','exports'];(function(_0x5c0d8f,_0x5e92b3){var _0x5f5852=function(_0x2c3ce7){while(--_0x2c3ce7){_0x5c0d8f['push'](_0x5c0d8f['shift']());}};_0x5f5852(++_0x5e92b3);}(_0xa945,0x118));var _0x5a94=function(_0x52c100,_0x5853dc){_0x52c100=_0x52c100-0x0;var _0x8f3c80=_0xa945[_0x52c100];return _0x8f3c80;};'use strict';var EventEmitter=require(_0x5a94('0x0'));var MailAccount=require(_0x5a94('0x1'))['db'][_0x5a94('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a94('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4693eb){return function(_0x53b6c7,_0x27c3db,_0x4b5341){MailAccountEvents[_0x5a94('0x4')](_0x4693eb+':'+_0x53b6c7['id'],_0x53b6c7);MailAccountEvents[_0x5a94('0x4')](_0x4693eb,_0x53b6c7);_0x4b5341(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x5a94('0x5')](e,emitEvent(event));}}module[_0x5a94('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 227793c..ef83cb8 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 _0x4b8b=['data5','auth','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider','OAuth2','user'];(function(_0x4b67e1,_0x1f1e43){var _0x46a20f=function(_0x3026e7){while(--_0x3026e7){_0x4b67e1['push'](_0x4b67e1['shift']());}};_0x46a20f(++_0x1f1e43);}(_0x4b8b,0x18e));var _0xb4b8=function(_0x29a40a,_0x234214){_0x29a40a=_0x29a40a-0x0;var _0x6182e9=_0x4b8b[_0x29a40a];return _0x6182e9;};'use strict';var attributes=require(_0xb4b8('0x0'));module[_0xb4b8('0x1')]=function(_0x1d9556){return _0x1d9556[_0xb4b8('0x2')](_0xb4b8('0x3'),attributes,{'tableName':_0xb4b8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x29270f=this;var _0x16a686={'id':_0x29270f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29270f[_0xb4b8('0x5')]!==_0xb4b8('0x6')){_0x16a686[_0xb4b8('0x7')]=_0x29270f[_0xb4b8('0x5')];}else{_0x16a686[_0xb4b8('0x8')]=_0x29270f[_0xb4b8('0x9')][_0xb4b8('0x8')];_0x16a686[_0xb4b8('0xa')]=_0x29270f[_0xb4b8('0x9')][_0xb4b8('0xa')];_0x16a686['secure']=_0x29270f[_0xb4b8('0x9')][_0xb4b8('0xb')];}if(_0x29270f[_0xb4b8('0x9')][_0xb4b8('0xc')]){if(_0x29270f[_0xb4b8('0x9')]['modernAuthentication']){if(!_0x29270f['Smtp'][_0xb4b8('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x16a686['auth']={'type':_0xb4b8('0xe'),'user':_0x29270f[_0xb4b8('0x9')][_0xb4b8('0xf')],'accessToken':_0x29270f['Smtp']['CloudProvider'][_0xb4b8('0x10')]};}else{_0x16a686[_0xb4b8('0x11')]={'user':_0x29270f['Smtp']['user'],'pass':_0x29270f[_0xb4b8('0x9')]['pass']};}}return _0x16a686;}}});}; \ No newline at end of file +var _0xb543=['host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','define','MailAccount','service'];(function(_0x3e1532,_0x375b29){var _0x1d07b1=function(_0x212ea0){while(--_0x212ea0){_0x3e1532['push'](_0x3e1532['shift']());}};_0x1d07b1(++_0x375b29);}(_0xb543,0x155));var _0x3b54=function(_0x34c715,_0x579b32){_0x34c715=_0x34c715-0x0;var _0x33f443=_0xb543[_0x34c715];return _0x33f443;};'use strict';var attributes=require(_0x3b54('0x0'));module['exports']=function(_0x274d1b){return _0x274d1b[_0x3b54('0x1')](_0x3b54('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4dbe12=this;var _0x62c932={'id':_0x4dbe12['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4dbe12['provider']!=='custom'){_0x62c932[_0x3b54('0x3')]=_0x4dbe12['provider'];}else{_0x62c932[_0x3b54('0x4')]=_0x4dbe12[_0x3b54('0x5')][_0x3b54('0x4')];_0x62c932[_0x3b54('0x6')]=_0x4dbe12['Smtp']['port'];_0x62c932[_0x3b54('0x7')]=_0x4dbe12[_0x3b54('0x5')][_0x3b54('0x7')];}if(_0x4dbe12[_0x3b54('0x5')]['authentication']){if(_0x4dbe12[_0x3b54('0x5')][_0x3b54('0x8')]){if(!_0x4dbe12[_0x3b54('0x5')][_0x3b54('0x9')])throw new Error(_0x3b54('0xa'));_0x62c932[_0x3b54('0xb')]={'type':'OAuth2','user':_0x4dbe12[_0x3b54('0x5')][_0x3b54('0xc')],'accessToken':_0x4dbe12[_0x3b54('0x5')][_0x3b54('0x9')][_0x3b54('0xd')]};}else{_0x62c932[_0x3b54('0xb')]={'user':_0x4dbe12[_0x3b54('0x5')][_0x3b54('0xc')],'pass':_0x4dbe12[_0x3b54('0x5')][_0x3b54('0xe')]};}}return _0x62c932;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9e9f171..cab5638 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 _0x938d=['where','attributes','limit','include','map','model','catch','ShowMailAccount','find','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','MailAccount','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','account','applications','list','orderBy','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','interaction','created','MailMessage','attachments','originTo','bcc','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailAccount','findAll','options','raw'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd938('0x0'));var moment=require(_0xd938('0x1'));var BPromise=require('bluebird');var rs=require(_0xd938('0x2'));var Redis=require(_0xd938('0x3'));var db=require(_0xd938('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xd938('0x5'));var jayson=require(_0xd938('0x6'));var client=jayson[_0xd938('0x7')]['http']({'port':0x232c});config[_0xd938('0x8')]=_[_0xd938('0x9')](config[_0xd938('0x8')],{'host':_0xd938('0xa'),'port':0x18eb});var socket=require(_0xd938('0xb'))(new Redis(config[_0xd938('0x8')]));require('./mailAccount.socket')[_0xd938('0xc')](socket);function respondWithRpcPromise(_0x39d8ad,_0x19fac0,_0x35f2d7){return new BPromise(function(_0x3cfacd,_0x401f19){return client['request'](_0x39d8ad,_0x35f2d7)[_0xd938('0xd')](function(_0x8b97d4){logger[_0xd938('0xe')](_0xd938('0xf'),_0x19fac0,_0xd938('0x10'));logger[_0xd938('0x11')](_0xd938('0x12'),_0x19fac0,_0xd938('0x10'),JSON[_0xd938('0x13')](_0x8b97d4));if(_0x8b97d4[_0xd938('0x14')]){if(_0x8b97d4[_0xd938('0x14')][_0xd938('0x15')]===0x1f4){logger[_0xd938('0x14')]('MailAccount,\x20%s,\x20%s',_0x19fac0,_0x8b97d4['error']['message']);return _0x401f19(_0x8b97d4[_0xd938('0x14')][_0xd938('0x16')]);}logger[_0xd938('0x14')]('MailAccount,\x20%s,\x20%s',_0x19fac0,_0x8b97d4['error'][_0xd938('0x16')]);return _0x3cfacd(_0x8b97d4[_0xd938('0x14')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x19fac0,_0xd938('0x10'));_0x3cfacd(_0x8b97d4[_0xd938('0x17')][_0xd938('0x16')]);}})['catch'](function(_0x103e84){logger[_0xd938('0x14')](_0xd938('0xf'),_0x19fac0,_0x103e84);_0x401f19(_0x103e84);});});}exports[_0xd938('0x18')]=function(_0x1f31bc){var _0x4dec6b=this;return new Promise(function(_0x3fa45c,_0x4e5938){return db['MailAccount'][_0xd938('0x19')]({'raw':_0x1f31bc['options']?_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f31bc[_0xd938('0x1a')]?_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1c')]||null:null,'attributes':_0x1f31bc['options']?_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1d')]||null:null,'limit':_0x1f31bc[_0xd938('0x1a')]?_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1e')]||null:null,'include':_0x1f31bc[_0xd938('0x1a')]?_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1f')]?_[_0xd938('0x20')](_0x1f31bc[_0xd938('0x1a')][_0xd938('0x1f')],function(_0x5bc216){return{'model':db[_0x5bc216['model']],'as':_0x5bc216['as'],'attributes':_0x5bc216[_0xd938('0x1d')],'include':_0x5bc216[_0xd938('0x1f')]?_[_0xd938('0x20')](_0x5bc216['include'],function(_0x10044c){return{'model':db[_0x10044c['model']],'as':_0x10044c['as'],'attributes':_0x10044c[_0xd938('0x1d')],'include':_0x10044c['include']?_[_0xd938('0x20')](_0x10044c['include'],function(_0x1f0f53){return{'model':db[_0x1f0f53[_0xd938('0x21')]],'as':_0x1f0f53['as'],'attributes':_0x1f0f53[_0xd938('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd938('0xd')](function(_0x483d11){logger[_0xd938('0xe')](_0xd938('0x18'),_0x1f31bc);logger[_0xd938('0x11')](_0xd938('0x18'),_0x1f31bc,JSON['stringify'](_0x483d11));_0x3fa45c(_0x483d11);})[_0xd938('0x22')](function(_0x350e6e){logger[_0xd938('0x14')]('GetMailAccount',_0x350e6e[_0xd938('0x16')],_0x1f31bc);_0x4e5938(_0x4dec6b[_0xd938('0x14')](0x1f4,_0x350e6e[_0xd938('0x16')]));});});};exports[_0xd938('0x23')]=function(_0x3ea8af){var _0x3b5735=this;return new Promise(function(_0x805c54,_0x327aaa){return db['MailAccount'][_0xd938('0x24')]({'raw':_0x3ea8af[_0xd938('0x1a')]?_0x3ea8af[_0xd938('0x1a')][_0xd938('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ea8af['options']?_0x3ea8af[_0xd938('0x1a')][_0xd938('0x1c')]||null:null,'attributes':_0x3ea8af[_0xd938('0x1a')]?_0x3ea8af[_0xd938('0x1a')]['attributes']||null:null,'include':_0x3ea8af[_0xd938('0x1a')]?_0x3ea8af[_0xd938('0x1a')][_0xd938('0x1f')]?_[_0xd938('0x20')](_0x3ea8af['options'][_0xd938('0x1f')],function(_0x1a77fc){return{'model':db[_0x1a77fc['model']],'as':_0x1a77fc['as'],'attributes':_0x1a77fc[_0xd938('0x1d')],'include':_0x1a77fc['include']?_['map'](_0x1a77fc[_0xd938('0x1f')],function(_0x216627){return{'model':db[_0x216627[_0xd938('0x21')]],'as':_0x216627['as'],'attributes':_0x216627['attributes'],'include':_0x216627[_0xd938('0x1f')]?_[_0xd938('0x20')](_0x216627[_0xd938('0x1f')],function(_0x20708e){return{'model':db[_0x20708e['model']],'as':_0x20708e['as'],'attributes':_0x20708e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd938('0xd')](function(_0x4478a2){if(_0x3ea8af['options']['smtp']===!![])_0x4478a2['setDataValue'](_0xd938('0x25'),_0x4478a2[_0xd938('0x26')]());logger[_0xd938('0xe')](_0xd938('0x23'),_0x3ea8af);logger[_0xd938('0x11')](_0xd938('0x23'),_0x3ea8af,JSON['stringify'](_0x4478a2));_0x805c54(_0x4478a2);})[_0xd938('0x22')](function(_0x46d0a0){logger[_0xd938('0x14')]('ShowMailAccount',_0x46d0a0['message'],_0x3ea8af);_0x327aaa(_0x3b5735[_0xd938('0x14')](0x1f4,_0x46d0a0['message']));});});};exports[_0xd938('0x27')]=function(_0x16ae39){var _0x1aa74c=this;return new Promise(function(_0x449f1a,_0x2c43fe){var _0x342910={'body':_0x16ae39[_0xd938('0x28')],'channel':'mail'};var _0x70880e=_[_0xd938('0x29')](_[_0xd938('0x2a')](db[_0xd938('0x2b')][_0xd938('0x2c')]),[_0xd938('0x2d'),_0xd938('0x2e'),'CompanyId',_0xd938('0x2f')]);var _0x2db702=![];if(_0x16ae39['body']['id']){delete _0x16ae39[_0xd938('0x28')]['id'];}if(_[_0xd938('0x30')](_0x16ae39['body'][_0xd938('0x31')])){return _0x2c43fe(_0x1aa74c[_0xd938('0x14')](0x1f4,_0xd938('0x32')));}if(_[_0xd938('0x30')](_0x16ae39['body']['body'])||_0x16ae39[_0xd938('0x28')][_0xd938('0x28')]===''){return _0x2c43fe(_0x1aa74c[_0xd938('0x14')](0x1f4,_0xd938('0x33')));}if(_[_0xd938('0x30')](_0x16ae39['body'][_0xd938('0x34')])){return _0x2c43fe(_0x1aa74c[_0xd938('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x70880e));}if(!_[_0xd938('0x35')](_0x70880e,_0x16ae39['body'][_0xd938('0x34')])){return _0x2c43fe(_0x1aa74c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x70880e));}var _0x1c3910={};_0x1c3910[_0x16ae39['body'][_0xd938('0x34')]]=_0x16ae39[_0xd938('0x28')]['from'];return db[_0xd938('0x36')][_0xd938('0x24')]({'where':{'id':_0x16ae39['account']['id']},'include':[{'model':db[_0xd938('0x37')],'as':_0xd938('0x38'),'include':[{'model':db['CmContact'],'as':_0xd938('0x39'),'where':_0x1c3910,'limit':0x1,'order':[[_0xd938('0x2e'),_0xd938('0x3a')]]}]},{'model':db[_0xd938('0x3b')],'as':_0xd938('0x3c')},{'model':db[_0xd938('0x3d')],'as':_0xd938('0x3e'),'include':[{'model':db['CloudProvider'],'as':_0xd938('0x3f')}]}]})[_0xd938('0xd')](function(_0x2242be){if(_0x2242be&&_0x2242be[_0xd938('0x38')]){var _0x16efe4=_0x2242be[_0xd938('0x40')]({'plain':!![]});_0x342910['account']=_[_0xd938('0x41')](_0x16efe4,[_0xd938('0x3c'),_0xd938('0x38')]);_0x342910[_0xd938('0x42')][_0xd938('0x25')]=_0x2242be[_0xd938('0x26')]();_0x342910[_0xd938('0x43')]=_0x16efe4[_0xd938('0x3c')];_0x342910[_0xd938('0x44')]=_0x16efe4[_0xd938('0x38')];_0x342910[_0xd938('0x43')]=_[_0xd938('0x45')](_0x342910['applications'],['priority'],['asc']);if(_0x342910[_0xd938('0x42')]&&_0x342910[_0xd938('0x42')][_0xd938('0x46')]){_0x342910[_0xd938('0x43')][_0xd938('0x47')]({'id':0x0,'priority':_0x342910[_0xd938('0x43')][_0xd938('0x48')]+0x1,'app':'close','appdata':'autoclose','interval':_0xd938('0x49')});}if(_0x342910[_0xd938('0x42')][_0xd938('0x3c')]){delete _0x342910['account'][_0xd938('0x3c')];}if(_0x342910[_0xd938('0x42')]['List']){delete _0x342910['account'][_0xd938('0x38')];}if(_0x16efe4['List'][_0xd938('0x39')][_0xd938('0x48')]){return _0x16efe4[_0xd938('0x38')][_0xd938('0x39')][0x0];}var _0xb80fcf=_[_0xd938('0x9')](_0x16ae39[_0xd938('0x28')],{'firstName':_0x16ae39['body'][_0xd938('0x31')],'ListId':_0x16efe4[_0xd938('0x2f')]});_0xb80fcf[_0x16ae39[_0xd938('0x28')]['mapKey']]=_0x16ae39[_0xd938('0x28')][_0xd938('0x31')];return db[_0xd938('0x2b')][_0xd938('0x4a')](_0xb80fcf);}else{throw new Error(_0xd938('0x4b'));}})['then'](function(_0xca678a){_0x342910[_0xd938('0x4c')]=_0xca678a;if(_0xca678a){if(!_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x4d')]){_0x16ae39['body'][_0xd938('0x16')][_0xd938('0x4d')]=rs[_0xd938('0x4e')]()+'\x20'+_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x31')];}var _0x288ac4={'ContactId':_0xca678a['id'],'MailAccountId':_0x16ae39['account']['id'],'inReplyTo':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x4d')],'to':_0x16ae39['body']['message'][_0xd938('0x31')],'cc':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')]['cc'],'subject':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x4f')],'attach':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x50')],'lastMsgAt':moment()[_0xd938('0x51')](_0xd938('0x52')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd938('0x24')]({'where':{'closed':![],'MailAccountId':_0x16ae39[_0xd938('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xd938('0x4d')],'where':{'messageId':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')]['inReplyTo']}}]})['then'](function(_0x100c53){if(_0x100c53){return[_0x100c53,![]];}return db[_0xd938('0x53')][_0xd938('0x4a')](_0x288ac4)[_0xd938('0xd')](function(_0x1a7555){return[_0x1a7555,!![]];});});}else{throw new Error(_0xd938('0x54'));}})[_0xd938('0x55')](function(_0x5567f8,_0x384ad4){if(_0x5567f8){_0x2db702=_0x384ad4;if(!_0x384ad4){return _0x5567f8['update']({'inReplyTo':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x4d')],'to':_0x16ae39['body'][_0xd938('0x16')][_0xd938('0x31')],'cc':_0x16ae39[_0xd938('0x28')]['message']['cc'],'subject':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x4f')],'attach':_0x5567f8[_0xd938('0x50')]?_0x5567f8[_0xd938('0x50')]:_0x16ae39[_0xd938('0x28')]['message'][_0xd938('0x50')],'substatus':null,'substatusAt':moment()[_0xd938('0x51')](_0xd938('0x52')),'lastMsgAt':moment()[_0xd938('0x51')](_0xd938('0x52')),'lastMsgDirection':'in'});}else{return _0x5567f8;}}})[_0xd938('0xd')](function(_0x4eea5d){_0x342910['interaction']=_0x4eea5d[_0xd938('0x40')]({'plain':!![]});_0x342910[_0xd938('0x56')][_0xd938('0x57')]=_0x2db702;return db[_0xd938('0x58')][_0xd938('0x4a')]({'body':_0x16ae39[_0xd938('0x28')][_0xd938('0x28')],'MailAccountId':_0x16ae39[_0xd938('0x42')]['id'],'MailInteractionId':_0x4eea5d['id'],'direction':'in','ContactId':_0x342910[_0xd938('0x4c')]['id'],'messageId':_0x16ae39[_0xd938('0x28')]['message'][_0xd938('0x4d')],'from':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x31')],'to':_0x16ae39[_0xd938('0x28')]['message']['to'],'cc':_0x16ae39[_0xd938('0x28')]['message']['cc'],'subject':_0x16ae39[_0xd938('0x28')]['message'][_0xd938('0x4f')],'attach':_0x16ae39['body'][_0xd938('0x16')][_0xd938('0x50')],'Attachments':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x59')],'originTo':_0x16ae39['body'][_0xd938('0x16')][_0xd938('0x5a')],'originCc':_0x16ae39[_0xd938('0x28')]['message']['originCc'],'bcc':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x5b')],'ChatWebsiteId':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')]['ChatWebsiteId']||null,'originChannel':_0x16ae39['body'][_0xd938('0x16')][_0xd938('0x5c')]||_0xd938('0x5d'),'ChatOfflineMessageId':_0x16ae39[_0xd938('0x28')][_0xd938('0x16')][_0xd938('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0xd938('0x5f')}]});})[_0xd938('0xd')](function(_0x239afb){_0x342910[_0xd938('0x16')]=_0x239afb;if(!_0x342910['interaction'][_0xd938('0x60')]){return;}return db['User'][_0xd938('0x24')]({'attributes':['id',_0xd938('0x61')],'where':{'id':_0x342910[_0xd938('0x56')]['UserId']}});})[_0xd938('0xd')](function(_0x43f15e){if(_0x43f15e){_0x342910['applications'][_0xd938('0x62')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43f15e[_0xd938('0x61')]+','+(_0x342910[_0xd938('0x42')][_0xd938('0x63')]||0xa),'interval':_0xd938('0x49')});}if(!_0x342910[_0xd938('0x56')][_0xd938('0x64')]){return;}return db[_0xd938('0x65')]['find']({'attributes':['id',_0xd938('0x61')],'where':{'id':_0x342910[_0xd938('0x56')][_0xd938('0x64')]}});})[_0xd938('0xd')](function(_0x2839e9){if(_0x2839e9){_0x342910['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xd938('0x66'),'appdata':_0x2839e9[_0xd938('0x61')]+','+(_0x342910[_0xd938('0x42')][_0xd938('0x67')]||0x12c),'interval':_0xd938('0x49')});}return respondWithRpcPromise(_0xd938('0x68'),_0xd938('0x69'),_0x342910);})[_0xd938('0xd')](function(_0x5b43fb){_0x449f1a(_0x5b43fb);})['catch'](function(_0x4275e9){_0x2c43fe(_0x1aa74c['error'](0x1f4,_0x4275e9[_0xd938('0x16')]));});});}; \ No newline at end of file +var _0xafc4=['lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Smtp','CloudProvider','get','account','omit','Applications','list','applications','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachments','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','startRouting'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0xafc4,0x69));var _0x4afc=function(_0x3677d4,_0x4e4782){_0x3677d4=_0x3677d4-0x0;var _0x3e90cd=_0xafc4[_0x3677d4];return _0x3e90cd;};'use strict';var _=require(_0x4afc('0x0'));var moment=require('moment');var BPromise=require(_0x4afc('0x1'));var rs=require('randomstring');var Redis=require(_0x4afc('0x2'));var db=require(_0x4afc('0x3'))['db'];var logger=require(_0x4afc('0x4'))(_0x4afc('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4afc('0x6')]({'port':0x232c});config[_0x4afc('0x7')]=_[_0x4afc('0x8')](config[_0x4afc('0x7')],{'host':_0x4afc('0x9'),'port':0x18eb});var socket=require(_0x4afc('0xa'))(new Redis(config['redis']));require(_0x4afc('0xb'))[_0x4afc('0xc')](socket);function respondWithRpcPromise(_0x134aad,_0x1e6bf5,_0x1b8981){return new BPromise(function(_0x458fde,_0x5542ec){return client['request'](_0x134aad,_0x1b8981)[_0x4afc('0xd')](function(_0x49222e){logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,'request\x20sent');logger[_0x4afc('0x10')](_0x4afc('0x11'),_0x1e6bf5,_0x4afc('0x12'),JSON[_0x4afc('0x13')](_0x49222e));if(_0x49222e[_0x4afc('0x14')]){if(_0x49222e[_0x4afc('0x14')][_0x4afc('0x15')]===0x1f4){logger[_0x4afc('0x14')]('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);return _0x5542ec(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')]['message']);return _0x458fde(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}else{logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,_0x4afc('0x12'));_0x458fde(_0x49222e[_0x4afc('0x17')][_0x4afc('0x16')]);}})[_0x4afc('0x18')](function(_0x16365f){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x1e6bf5,_0x16365f);_0x5542ec(_0x16365f);});});}exports['GetMailAccount']=function(_0x1a8f49){var _0x25603b=this;return new Promise(function(_0x32865e,_0x14558a){return db['MailAccount'][_0x4afc('0x19')]({'raw':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1c')]||null:null,'attributes':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'limit':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')]['limit']||null:null,'include':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x20')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x1d')],'include':_0x40a0db[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x40a0db[_0x4afc('0x1e')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x1d')],'include':_0x35f5b3[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x35f5b3['include'],function(_0x52212d){return{'model':db[_0x52212d['model']],'as':_0x52212d['as'],'attributes':_0x52212d[_0x4afc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x5e4747){logger[_0x4afc('0xe')](_0x4afc('0x21'),_0x1a8f49);logger['debug']('GetMailAccount',_0x1a8f49,JSON['stringify'](_0x5e4747));_0x32865e(_0x5e4747);})[_0x4afc('0x18')](function(_0x34434a){logger[_0x4afc('0x14')](_0x4afc('0x21'),_0x34434a[_0x4afc('0x16')],_0x1a8f49);_0x14558a(_0x25603b[_0x4afc('0x14')](0x1f4,_0x34434a['message']));});});};exports[_0x4afc('0x22')]=function(_0x3d1693){var _0x1ba6b5=this;return new Promise(function(_0x2f178c,_0x2b115d){return db[_0x4afc('0x23')][_0x4afc('0x24')]({'raw':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693['options'][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d1693['options']?_0x3d1693['options'][_0x4afc('0x1c')]||null:null,'attributes':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'include':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')]['include']?_[_0x4afc('0x1f')](_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x127ac8){return{'model':db[_0x127ac8[_0x4afc('0x20')]],'as':_0x127ac8['as'],'attributes':_0x127ac8[_0x4afc('0x1d')],'include':_0x127ac8['include']?_[_0x4afc('0x1f')](_0x127ac8[_0x4afc('0x1e')],function(_0x91565d){return{'model':db[_0x91565d[_0x4afc('0x20')]],'as':_0x91565d['as'],'attributes':_0x91565d['attributes'],'include':_0x91565d['include']?_[_0x4afc('0x1f')](_0x91565d[_0x4afc('0x1e')],function(_0x17ea03){return{'model':db[_0x17ea03['model']],'as':_0x17ea03['as'],'attributes':_0x17ea03['attributes']};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x4a06cf){if(_0x3d1693['options'][_0x4afc('0x25')]===!![])_0x4a06cf[_0x4afc('0x26')](_0x4afc('0x27'),_0x4a06cf[_0x4afc('0x28')]());logger[_0x4afc('0xe')](_0x4afc('0x22'),_0x3d1693);logger[_0x4afc('0x10')](_0x4afc('0x22'),_0x3d1693,JSON[_0x4afc('0x13')](_0x4a06cf));_0x2f178c(_0x4a06cf);})[_0x4afc('0x18')](function(_0x26e59f){logger[_0x4afc('0x14')](_0x4afc('0x22'),_0x26e59f[_0x4afc('0x16')],_0x3d1693);_0x2b115d(_0x1ba6b5[_0x4afc('0x14')](0x1f4,_0x26e59f['message']));});});};exports[_0x4afc('0x29')]=function(_0x6a8345){var _0x4357a6=this;return new Promise(function(_0xe6db12,_0x12db1d){var _0x260b06={'body':_0x6a8345[_0x4afc('0x2a')],'channel':'mail'};var _0x5e97f4=_['difference'](_[_0x4afc('0x2b')](db[_0x4afc('0x2c')]['rawAttributes']),[_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')]);var _0x545109=![];if(_0x6a8345[_0x4afc('0x2a')]['id']){delete _0x6a8345[_0x4afc('0x2a')]['id'];}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x32')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4afc('0x31')](_0x6a8345['body'][_0x4afc('0x2a')])||_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')]===''){return _0x12db1d(_0x4357a6['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x4afc('0x34')+_0x5e97f4));}if(!_[_0x4afc('0x35')](_0x5e97f4,_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6['error'](0x1f4,_0x4afc('0x36')+_0x5e97f4));}var _0xb1e91e={};_0xb1e91e[_0x6a8345['body'][_0x4afc('0x33')]]=_0x6a8345['body'][_0x4afc('0x32')];return db[_0x4afc('0x23')][_0x4afc('0x24')]({'where':{'id':_0x6a8345['account']['id']},'include':[{'model':db[_0x4afc('0x37')],'as':_0x4afc('0x38'),'include':[{'model':db[_0x4afc('0x2c')],'as':_0x4afc('0x39'),'where':_0xb1e91e,'limit':0x1,'order':[[_0x4afc('0x2e'),_0x4afc('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x4afc('0x3b'),'include':[{'model':db[_0x4afc('0x3c')],'as':_0x4afc('0x3c')}]}]})[_0x4afc('0xd')](function(_0xb5cca9){if(_0xb5cca9&&_0xb5cca9[_0x4afc('0x38')]){var _0x22e8b0=_0xb5cca9[_0x4afc('0x3d')]({'plain':!![]});_0x260b06[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x22e8b0,['Applications',_0x4afc('0x38')]);_0x260b06['account']['smtpOptions']=_0xb5cca9[_0x4afc('0x28')]();_0x260b06['applications']=_0x22e8b0[_0x4afc('0x40')];_0x260b06[_0x4afc('0x41')]=_0x22e8b0[_0x4afc('0x38')];_0x260b06[_0x4afc('0x42')]=_['orderBy'](_0x260b06[_0x4afc('0x42')],['priority'],[_0x4afc('0x43')]);if(_0x260b06[_0x4afc('0x3e')]&&_0x260b06[_0x4afc('0x3e')][_0x4afc('0x44')]){_0x260b06[_0x4afc('0x42')][_0x4afc('0x45')]({'id':0x0,'priority':_0x260b06[_0x4afc('0x42')][_0x4afc('0x46')]+0x1,'app':_0x4afc('0x47'),'appdata':_0x4afc('0x44'),'interval':_0x4afc('0x48')});}if(_0x260b06[_0x4afc('0x3e')]['Applications']){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x40')];}if(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')]){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')];}if(_0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][_0x4afc('0x46')]){return _0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][0x0];}var _0x2aa927=_[_0x4afc('0x8')](_0x6a8345['body'],{'firstName':_0x6a8345[_0x4afc('0x2a')]['from'],'ListId':_0x22e8b0[_0x4afc('0x30')]});_0x2aa927[_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')]]=_0x6a8345[_0x4afc('0x2a')]['from'];return db['CmContact'][_0x4afc('0x49')](_0x2aa927);}else{throw new Error(_0x4afc('0x4a'));}})['then'](function(_0x40021e){_0x260b06[_0x4afc('0x4b')]=_0x40021e;if(_0x40021e){if(!_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]){_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]=rs[_0x4afc('0x4d')]()+'\x20'+_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')];}var _0x22f586={'ContactId':_0x40021e['id'],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id'],'inReplyTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4c')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body']['message'][_0x4afc('0x4f')],'lastMsgAt':moment()[_0x4afc('0x50')](_0x4afc('0x51')),'lastMsgDirection':'in'};return db[_0x4afc('0x52')][_0x4afc('0x24')]({'where':{'closed':![],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id']},'include':[{'model':db[_0x4afc('0x53')],'as':_0x4afc('0x54'),'attributes':[_0x4afc('0x4c')],'where':{'messageId':_0x6a8345[_0x4afc('0x2a')]['message']['inReplyTo']}}]})[_0x4afc('0xd')](function(_0x139786){if(_0x139786){return[_0x139786,![]];}return db['MailInteraction'][_0x4afc('0x49')](_0x22f586)[_0x4afc('0xd')](function(_0x5be1a7){return[_0x5be1a7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4afc('0x55')](function(_0x26f4ee,_0x576ea0){if(_0x26f4ee){_0x545109=_0x576ea0;if(!_0x576ea0){return _0x26f4ee['update']({'inReplyTo':_0x6a8345[_0x4afc('0x2a')]['message']['messageId'],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x26f4ee[_0x4afc('0x4f')]?_0x26f4ee['attach']:_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4f')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x4afc('0x51')),'lastMsgDirection':'in'});}else{return _0x26f4ee;}}})[_0x4afc('0xd')](function(_0x195378){_0x260b06['interaction']=_0x195378[_0x4afc('0x3d')]({'plain':!![]});_0x260b06['interaction']['created']=_0x545109;return db['MailMessage'][_0x4afc('0x49')]({'body':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')],'MailAccountId':_0x6a8345['account']['id'],'MailInteractionId':_0x195378['id'],'direction':'in','ContactId':_0x260b06[_0x4afc('0x4b')]['id'],'messageId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['messageId'],'from':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['to'],'cc':_0x6a8345['body']['message']['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4f')],'Attachments':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x56')],'originTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x57')],'originCc':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x58')],'bcc':_0x6a8345[_0x4afc('0x2a')]['message'][_0x4afc('0x59')],'ChatWebsiteId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5a')]||null,'originChannel':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5b')]||_0x4afc('0x5c'),'ChatOfflineMessageId':_0x6a8345['body'][_0x4afc('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x4afc('0x5d')}]});})[_0x4afc('0xd')](function(_0x1354f1){_0x260b06['message']=_0x1354f1;if(!_0x260b06['interaction'][_0x4afc('0x5e')]){return;}return db[_0x4afc('0x5f')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x5e')]}});})[_0x4afc('0xd')](function(_0x198ec9){if(_0x198ec9){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x0,'app':_0x4afc('0x63'),'appdata':_0x198ec9[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x64')]||0xa),'interval':_0x4afc('0x48')});}if(!_0x260b06[_0x4afc('0x61')]['queueId']){return;}return db[_0x4afc('0x65')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x66')]}});})[_0x4afc('0xd')](function(_0x3fddd1){if(_0x3fddd1){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3fddd1[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x67')]||0x12c),'interval':_0x4afc('0x48')});}return respondWithRpcPromise('Start',_0x4afc('0x68'),_0x260b06);})[_0x4afc('0xd')](function(_0x4ce81a){_0xe6db12(_0x4ce81a);})[_0x4afc('0x18')](function(_0x46fe52){_0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x46fe52[_0x4afc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 376e065..f3e5a90 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 _0xffc8=['removeListener','length','mailAccount:','remove','update'];(function(_0x22eb37,_0x320894){var _0x1a174b=function(_0x1ace53){while(--_0x1ace53){_0x22eb37['push'](_0x22eb37['shift']());}};_0x1a174b(++_0x320894);}(_0xffc8,0x111));var _0x8ffc=function(_0x27aa03,_0x4a1131){_0x27aa03=_0x27aa03-0x0;var _0x3f13a9=_0xffc8[_0x27aa03];return _0x3f13a9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x8ffc('0x0'),_0x8ffc('0x1')];function createListener(_0x1b0b87,_0x242cb5){return function(_0x385192){_0x242cb5['emit'](_0x1b0b87,_0x385192);};}function removeListener(_0x534266,_0x51ecac){return function(){MailAccountEvents[_0x8ffc('0x2')](_0x534266,_0x51ecac);};}exports['register']=function(_0x1a820e){for(var _0x20aea6=0x0,_0x5afcd7=events[_0x8ffc('0x3')];_0x20aea6<_0x5afcd7;_0x20aea6++){var _0x3e2dff=events[_0x20aea6];var _0x52067e=createListener(_0x8ffc('0x4')+_0x3e2dff,_0x1a820e);MailAccountEvents['on'](_0x3e2dff,_0x52067e);}}; \ No newline at end of file +var _0xb8cb=['update','mailAccount:','./mailAccount.events','save','remove'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x46294f,_0x6fbd6c){_0x46294f=_0x46294f-0x0;var _0x2d4732=_0xb8cb[_0x46294f];return _0x2d4732;};'use strict';var MailAccountEvents=require(_0xbb8c('0x0'));var events=[_0xbb8c('0x1'),_0xbb8c('0x2'),_0xbb8c('0x3')];function createListener(_0x61bd68,_0x1d6a40){return function(_0x1f01cd){_0x1d6a40['emit'](_0x61bd68,_0x1f01cd);};}function removeListener(_0x35a692,_0xee3b40){return function(){MailAccountEvents['removeListener'](_0x35a692,_0xee3b40);};}exports['register']=function(_0x3b2ad2){for(var _0x27c59e=0x0,_0x3eb759=events['length'];_0x27c59e<_0x3eb759;_0x27c59e++){var _0x31224b=events[_0x27c59e];var _0x3eda24=createListener(_0xbb8c('0x4')+_0x31224b,_0x3b2ad2);MailAccountEvents['on'](_0x31224b,_0x3eda24);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fea6116..ff9f5f2 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 _0xb494=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','update','delete','destroy','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb494,0x1ad));var _0x4b49=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xb494[_0x2aecb2];return _0x3ebb80;};'use strict';var multer=require(_0x4b49('0x0'));var util=require('util');var path=require(_0x4b49('0x1'));var timeout=require(_0x4b49('0x2'));var express=require(_0x4b49('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4b49('0x4'));var interaction=require(_0x4b49('0x5'));var config=require(_0x4b49('0x6'));var controller=require('./mailApplication.controller');router['get']('/:id',auth[_0x4b49('0x7')](),controller[_0x4b49('0x8')]);router['put']('/:id',auth[_0x4b49('0x7')](),controller[_0x4b49('0x9')]);router[_0x4b49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4b49('0xb')]);module[_0x4b49('0xc')]=router; \ No newline at end of file +var _0xdbbe=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','update','delete','/:id'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xdbbe,0x145));var _0xedbb=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xdbbe[_0x3f4891];return _0x54f2d8;};'use strict';var multer=require(_0xedbb('0x0'));var util=require(_0xedbb('0x1'));var path=require(_0xedbb('0x2'));var timeout=require('connect-timeout');var express=require(_0xedbb('0x3'));var router=express[_0xedbb('0x4')]();var fs_extra=require(_0xedbb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xedbb('0x6'));var config=require(_0xedbb('0x7'));var controller=require('./mailApplication.controller');router[_0xedbb('0x8')]('/:id',auth[_0xedbb('0x9')](),controller[_0xedbb('0xa')]);router[_0xedbb('0xb')]('/:id',auth[_0xedbb('0x9')](),controller[_0xedbb('0xc')]);router[_0xedbb('0xd')](_0xedbb('0xe'),auth[_0xedbb('0x9')](),controller[_0xedbb('0xf')]);module[_0xedbb('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index bb520ff..35212ea 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 _0x7494=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x44859f,_0x275c0e){var _0x3d789e=function(_0x2279d9){while(--_0x2279d9){_0x44859f['push'](_0x44859f['shift']());}};_0x3d789e(++_0x275c0e);}(_0x7494,0x184));var _0x4749=function(_0x1ca3cb,_0x5b5cd0){_0x1ca3cb=_0x1ca3cb-0x0;var _0x5eea53=_0x7494[_0x1ca3cb];return _0x5eea53;};'use strict';var Sequelize=require('sequelize');module[_0x4749('0x0')]={'priority':{'type':Sequelize[_0x4749('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4749('0x2')],'allowNull':![],'defaultValue':_0x4749('0x3')},'appdata':{'type':Sequelize[_0x4749('0x4')]()},'description':{'type':Sequelize[_0x4749('0x2')]},'interval':{'type':Sequelize[_0x4749('0x2')],'defaultValue':_0x4749('0x5')}}; \ No newline at end of file +var _0x6ff7=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3d4c3d,_0x35045c){var _0x10fd85=function(_0x42be43){while(--_0x42be43){_0x3d4c3d['push'](_0x3d4c3d['shift']());}};_0x10fd85(++_0x35045c);}(_0x6ff7,0x139));var _0x76ff=function(_0x5da61f,_0x3ccc4d){_0x5da61f=_0x5da61f-0x0;var _0x4b0abb=_0x6ff7[_0x5da61f];return _0x4b0abb;};'use strict';var Sequelize=require('sequelize');module[_0x76ff('0x0')]={'priority':{'type':Sequelize[_0x76ff('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x76ff('0x2')],'allowNull':![],'defaultValue':_0x76ff('0x3')},'appdata':{'type':Sequelize[_0x76ff('0x4')]()},'description':{'type':Sequelize[_0x76ff('0x2')]},'interval':{'type':Sequelize[_0x76ff('0x2')],'defaultValue':_0x76ff('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index fb19792..64b718a 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x22ba54,_0x3c105b){_0x22ba54=_0x22ba54-0x0;var _0x17af5b=_0xbdb7[_0x22ba54];return _0x17af5b;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xedd9,0xfc));var _0x9edd=function(_0xa3ef4d,_0x27f0a4){_0xa3ef4d=_0xa3ef4d-0x0;var _0x55227a=_0xedd9[_0xa3ef4d];return _0x55227a;};'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={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 34f327e..f4f718c 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 _0xd5be=['mail_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x3f02f4,_0x4b5a04){var _0x481012=function(_0x7f1aa5){while(--_0x7f1aa5){_0x3f02f4['push'](_0x3f02f4['shift']());}};_0x481012(++_0x4b5a04);}(_0xd5be,0x152));var _0xed5b=function(_0x3a2225,_0xb6600){_0x3a2225=_0x3a2225-0x0;var _0x5c8040=_0xd5be[_0x3a2225];return _0x5c8040;};'use strict';var _=require(_0xed5b('0x0'));var util=require(_0xed5b('0x1'));var logger=require(_0xed5b('0x2'))(_0xed5b('0x3'));var moment=require('moment');var BPromise=require(_0xed5b('0x4'));var rp=require(_0xed5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed5b('0x6'));var config=require(_0xed5b('0x7'));var attributes=require(_0xed5b('0x8'));module[_0xed5b('0x9')]=function(_0x22483c,_0x2619c4){return _0x22483c[_0xed5b('0xa')](_0xed5b('0xb'),attributes,{'tableName':_0xed5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed5b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8430=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8430,0x101));var _0x0843=function(_0xb1937e,_0x330b2f){_0xb1937e=_0xb1937e-0x0;var _0x44474f=_0x8430[_0xb1937e];return _0x44474f;};'use strict';var _=require(_0x0843('0x0'));var util=require(_0x0843('0x1'));var logger=require('../../config/logger')(_0x0843('0x2'));var moment=require('moment');var BPromise=require(_0x0843('0x3'));var rp=require(_0x0843('0x4'));var fs=require('fs');var path=require(_0x0843('0x5'));var rimraf=require(_0x0843('0x6'));var config=require(_0x0843('0x7'));var attributes=require(_0x0843('0x8'));module[_0x0843('0x9')]=function(_0x5840c9,_0x68650f){return _0x5840c9['define'](_0x0843('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0843('0xb'),'collate':_0x0843('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 1b80f39..78db7c7 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 _0x6c19=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','body','raw','options','debug','stringify','util','bluebird','randomstring','ioredis'];(function(_0x316b13,_0x21c7b3){var _0x29ab59=function(_0x4e5145){while(--_0x4e5145){_0x316b13['push'](_0x316b13['shift']());}};_0x29ab59(++_0x21c7b3);}(_0x6c19,0x1be));var _0x96c1=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x6c19[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require('lodash');var util=require(_0x96c1('0x0'));var moment=require('moment');var BPromise=require(_0x96c1('0x1'));var rs=require(_0x96c1('0x2'));var fs=require('fs');var Redis=require(_0x96c1('0x3'));var db=require(_0x96c1('0x4'))['db'];var utils=require(_0x96c1('0x5'));var logger=require('../../config/logger')(_0x96c1('0x6'));var config=require(_0x96c1('0x7'));var jayson=require(_0x96c1('0x8'));var client=jayson[_0x96c1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288e3d,_0x3da53f,_0x3fb35b){return new BPromise(function(_0x36af45,_0x450171){return client[_0x96c1('0xa')](_0x288e3d,_0x3fb35b)[_0x96c1('0xb')](function(_0x3d1f2f){logger[_0x96c1('0xc')]('MailApplication,\x20%s,\x20%s',_0x3da53f,_0x96c1('0xd'));logger['debug'](_0x96c1('0xe'),_0x3da53f,'request\x20sent',JSON['stringify'](_0x3d1f2f));if(_0x3d1f2f[_0x96c1('0xf')]){if(_0x3d1f2f[_0x96c1('0xf')][_0x96c1('0x10')]===0x1f4){logger['error'](_0x96c1('0x11'),_0x3da53f,_0x3d1f2f[_0x96c1('0xf')][_0x96c1('0x12')]);return _0x450171(_0x3d1f2f[_0x96c1('0xf')]['message']);}logger[_0x96c1('0xf')](_0x96c1('0x11'),_0x3da53f,_0x3d1f2f[_0x96c1('0xf')][_0x96c1('0x12')]);return _0x36af45(_0x3d1f2f[_0x96c1('0xf')]['message']);}else{logger[_0x96c1('0xc')](_0x96c1('0x11'),_0x3da53f,_0x96c1('0xd'));_0x36af45(_0x3d1f2f[_0x96c1('0x13')][_0x96c1('0x12')]);}})['catch'](function(_0x35ecdb){logger[_0x96c1('0xf')](_0x96c1('0x11'),_0x3da53f,_0x35ecdb);_0x450171(_0x35ecdb);});});}exports['UpdateMailApplication']=function(_0x4ded40){var _0x57a94a=this;return new Promise(function(_0xa49243,_0x468783){return db['MailApplication']['update'](_0x4ded40[_0x96c1('0x14')],{'raw':_0x4ded40['options']?_0x4ded40['options'][_0x96c1('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ded40[_0x96c1('0x16')]?_0x4ded40[_0x96c1('0x16')]['where']||null:null,'attributes':_0x4ded40['options']?_0x4ded40[_0x96c1('0x16')]['attributes']||null:null,'limit':_0x4ded40[_0x96c1('0x16')]?_0x4ded40['options']['limit']||null:null})['then'](function(_0x46c523){logger['info']('UpdateMailApplication',_0x4ded40);logger[_0x96c1('0x17')]('UpdateMailApplication',_0x4ded40,JSON[_0x96c1('0x18')](_0x46c523));_0xa49243(_0x46c523);})['catch'](function(_0x3fbca3){logger[_0x96c1('0xf')]('UpdateMailApplication',_0x3fbca3[_0x96c1('0x12')],_0x4ded40);_0x468783(_0x57a94a[_0x96c1('0xf')](0x1f4,_0x3fbca3[_0x96c1('0x12')]));});});}; \ No newline at end of file +var _0x59c6=['moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update','body','options','raw','limit','then','stringify','lodash','util'];(function(_0x44c708,_0x346e58){var _0x577296=function(_0x1d3af3){while(--_0x1d3af3){_0x44c708['push'](_0x44c708['shift']());}};_0x577296(++_0x346e58);}(_0x59c6,0x186));var _0x659c=function(_0x4a4fc9,_0x4acc29){_0x4a4fc9=_0x4a4fc9-0x0;var _0x322e30=_0x59c6[_0x4a4fc9];return _0x322e30;};'use strict';var _=require(_0x659c('0x0'));var util=require(_0x659c('0x1'));var moment=require(_0x659c('0x2'));var BPromise=require(_0x659c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x659c('0x4'))['db'];var utils=require(_0x659c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x659c('0x6'));var jayson=require(_0x659c('0x7'));var client=jayson[_0x659c('0x8')][_0x659c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x281af0,_0xfb19e7,_0x15bce5){return new BPromise(function(_0x5e91fe,_0x3009bf){return client[_0x659c('0xa')](_0x281af0,_0x15bce5)['then'](function(_0xf4dbb9){logger[_0x659c('0xb')]('MailApplication,\x20%s,\x20%s',_0xfb19e7,_0x659c('0xc'));logger[_0x659c('0xd')](_0x659c('0xe'),_0xfb19e7,_0x659c('0xc'),JSON['stringify'](_0xf4dbb9));if(_0xf4dbb9[_0x659c('0xf')]){if(_0xf4dbb9['error']['code']===0x1f4){logger[_0x659c('0xf')](_0x659c('0x10'),_0xfb19e7,_0xf4dbb9[_0x659c('0xf')]['message']);return _0x3009bf(_0xf4dbb9[_0x659c('0xf')]['message']);}logger[_0x659c('0xf')](_0x659c('0x10'),_0xfb19e7,_0xf4dbb9[_0x659c('0xf')][_0x659c('0x11')]);return _0x5e91fe(_0xf4dbb9[_0x659c('0xf')][_0x659c('0x11')]);}else{logger[_0x659c('0xb')](_0x659c('0x10'),_0xfb19e7,_0x659c('0xc'));_0x5e91fe(_0xf4dbb9[_0x659c('0x12')]['message']);}})[_0x659c('0x13')](function(_0x57b0e1){logger['error'](_0x659c('0x10'),_0xfb19e7,_0x57b0e1);_0x3009bf(_0x57b0e1);});});}exports[_0x659c('0x14')]=function(_0x511254){var _0x30e623=this;return new Promise(function(_0x3a9a3b,_0x9d327c){return db['MailApplication'][_0x659c('0x15')](_0x511254[_0x659c('0x16')],{'raw':_0x511254[_0x659c('0x17')]?_0x511254['options'][_0x659c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x511254['options']?_0x511254[_0x659c('0x17')]['where']||null:null,'attributes':_0x511254[_0x659c('0x17')]?_0x511254[_0x659c('0x17')]['attributes']||null:null,'limit':_0x511254[_0x659c('0x17')]?_0x511254[_0x659c('0x17')][_0x659c('0x19')]||null:null})[_0x659c('0x1a')](function(_0x3ebba6){logger[_0x659c('0xb')](_0x659c('0x14'),_0x511254);logger['debug'](_0x659c('0x14'),_0x511254,JSON[_0x659c('0x1b')](_0x3ebba6));_0x3a9a3b(_0x3ebba6);})[_0x659c('0x13')](function(_0x136cd2){logger[_0x659c('0xf')](_0x659c('0x14'),_0x136cd2[_0x659c('0x11')],_0x511254);_0x9d327c(_0x30e623[_0x659c('0xf')](0x1f4,_0x136cd2[_0x659c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 722c89c..4121b21 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 _0xb01b=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','update','delete','mailinteraction:destroy','destroy','express','Router'];(function(_0x2fe176,_0x40f0da){var _0x5816a5=function(_0x469238){while(--_0x469238){_0x2fe176['push'](_0x2fe176['shift']());}};_0x5816a5(++_0x40f0da);}(_0xb01b,0x8e));var _0xbb01=function(_0x4ac90e,_0x59c810){_0x4ac90e=_0x4ac90e-0x0;var _0x31b7d2=_0xb01b[_0x4ac90e];return _0x31b7d2;};'use strict';var express=require(_0xbb01('0x0'));var router=express[_0xbb01('0x1')]();var auth=require(_0xbb01('0x2'));var interaction=require(_0xbb01('0x3'));var controller=require('./mailInteraction.controller');router[_0xbb01('0x4')]('/',auth[_0xbb01('0x5')](),controller[_0xbb01('0x6')]);router[_0xbb01('0x4')]('/describe',auth[_0xbb01('0x5')](),controller['describe']);router['get']('/:id',auth[_0xbb01('0x5')](),controller[_0xbb01('0x7')]);router['get'](_0xbb01('0x8'),auth[_0xbb01('0x5')](),controller[_0xbb01('0x9')]);router['get'](_0xbb01('0xa'),auth['isAuthenticated'](),controller[_0xbb01('0xb')]);router['post']('/',auth[_0xbb01('0x5')](),controller[_0xbb01('0xc')]);router[_0xbb01('0xd')](_0xbb01('0x8'),auth[_0xbb01('0x5')](),controller[_0xbb01('0xe')]);router[_0xbb01('0xd')](_0xbb01('0xf'),auth['isAuthenticated'](),interaction[_0xbb01('0x10')](_0xbb01('0x11'),_0xbb01('0x12')),controller['addTags']);router[_0xbb01('0x13')]('/:id',auth[_0xbb01('0x5')](),interaction[_0xbb01('0x10')](_0xbb01('0x11'),'mailinteraction:update'),controller[_0xbb01('0x14')]);router[_0xbb01('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xbb01('0x10')](_0xbb01('0x11'),_0xbb01('0x16')),controller[_0xbb01('0x17')]);router[_0xbb01('0x15')]('/:id/tags',auth[_0xbb01('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xbd29=['tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','removeTags','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','post','create','/:id/tags'];(function(_0x35e680,_0x5f46a0){var _0x1d4b50=function(_0x13a3f2){while(--_0x13a3f2){_0x35e680['push'](_0x35e680['shift']());}};_0x1d4b50(++_0x5f46a0);}(_0xbd29,0x15e));var _0x9bd2=function(_0x315600,_0x1183ae){_0x315600=_0x315600-0x0;var _0x3f66e7=_0xbd29[_0x315600];return _0x3f66e7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x9bd2('0x0'));var interaction=require(_0x9bd2('0x1'));var controller=require(_0x9bd2('0x2'));router[_0x9bd2('0x3')]('/',auth[_0x9bd2('0x4')](),controller[_0x9bd2('0x5')]);router[_0x9bd2('0x3')](_0x9bd2('0x6'),auth[_0x9bd2('0x4')](),controller[_0x9bd2('0x7')]);router[_0x9bd2('0x3')]('/:id',auth[_0x9bd2('0x4')](),controller[_0x9bd2('0x8')]);router[_0x9bd2('0x3')](_0x9bd2('0x9'),auth[_0x9bd2('0x4')](),controller['getMessages']);router[_0x9bd2('0x3')](_0x9bd2('0xa'),auth[_0x9bd2('0x4')](),controller['download']);router[_0x9bd2('0xb')]('/',auth[_0x9bd2('0x4')](),controller[_0x9bd2('0xc')]);router[_0x9bd2('0xb')](_0x9bd2('0x9'),auth[_0x9bd2('0x4')](),controller['addMessage']);router['post'](_0x9bd2('0xd'),auth[_0x9bd2('0x4')](),interaction[_0x9bd2('0xe')](_0x9bd2('0xf'),_0x9bd2('0x10')),controller[_0x9bd2('0x11')]);router[_0x9bd2('0x12')]('/:id',auth[_0x9bd2('0x4')](),interaction[_0x9bd2('0xe')](_0x9bd2('0xf'),_0x9bd2('0x13')),controller[_0x9bd2('0x14')]);router[_0x9bd2('0x15')](_0x9bd2('0x16'),auth[_0x9bd2('0x4')](),interaction[_0x9bd2('0xe')](_0x9bd2('0xf'),_0x9bd2('0x17')),controller['destroy']);router[_0x9bd2('0x15')]('/:id/tags',auth[_0x9bd2('0x4')](),controller[_0x9bd2('0x18')]);module[_0x9bd2('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 67cd020..7b27368 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 _0x13f9=['BOOLEAN','ENUM','out','INTEGER','iconv','exports','DATE','STRING','TEXT','long'];(function(_0x42c224,_0x4a367e){var _0x397625=function(_0x557cf4){while(--_0x557cf4){_0x42c224['push'](_0x42c224['shift']());}};_0x397625(++_0x4a367e);}(_0x13f9,0x18a));var _0x913f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x13f9[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x913f('0x0'));module[_0x913f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x913f('0x2')]},'disposition':{'type':Sequelize[_0x913f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x913f('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x913f('0x3')]},'cc':{'type':Sequelize[_0x913f('0x4')](_0x913f('0x5'))},'subject':{'type':Sequelize[_0x913f('0x4')]()},'attach':{'type':Sequelize[_0x913f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x913f('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x913f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x913f('0x7')]('in',_0x913f('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x913f('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x913f('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x913f('0x9')]}}; \ No newline at end of file +var _0xdc51=['BOOLEAN','DATE','STRING','TEXT','long','out','ENUM','INTEGER','exports'];(function(_0x7ac570,_0x26e35b){var _0x135da=function(_0xc2ecf6){while(--_0xc2ecf6){_0x7ac570['push'](_0x7ac570['shift']());}};_0x135da(++_0x26e35b);}(_0xdc51,0x1af));var _0x1dc5=function(_0x1730d2,_0x4a8a91){_0x1730d2=_0x1730d2-0x0;var _0x2a63d9=_0xdc51[_0x1730d2];return _0x2a63d9;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x1dc5('0x0')]={'closed':{'type':Sequelize[_0x1dc5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1dc5('0x2')]},'disposition':{'type':Sequelize[_0x1dc5('0x3')]},'secondDisposition':{'type':Sequelize[_0x1dc5('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1dc5('0x3')]},'inReplyTo':{'type':Sequelize[_0x1dc5('0x3')](0x1fe)},'to':{'type':Sequelize[_0x1dc5('0x3')]},'cc':{'type':Sequelize[_0x1dc5('0x4')](_0x1dc5('0x5'))},'subject':{'type':Sequelize[_0x1dc5('0x4')]()},'attach':{'type':Sequelize[_0x1dc5('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1dc5('0x2')]},'substatus':{'type':Sequelize[_0x1dc5('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x1dc5('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1dc5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1dc5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1dc5('0x7')]('in',_0x1dc5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1dc5('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1dc5('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 743a8ae..8ffd051 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 _0xad0b=['server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachments','MailMessage','Messages','from','bcc','subject','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','update','then','destroy','error','stack','name','index','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','MailInteractionId','filter','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join'];(function(_0x5e8f42,_0x3d8462){var _0xbdfb5a=function(_0xa3bbfc){while(--_0xa3bbfc){_0x5e8f42['push'](_0x5e8f42['shift']());}};_0xbdfb5a(++_0x3d8462);}(_0xad0b,0x167));var _0xbad0=function(_0x28aca4,_0x10c8f0){_0x28aca4=_0x28aca4-0x0;var _0x3d8722=_0xad0b[_0x28aca4];return _0x3d8722;};'use strict';var emlformat=require(_0xbad0('0x0'));var rimraf=require(_0xbad0('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xbad0('0x2'));var path=require(_0xbad0('0x3'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xbad0('0x4'));var interaction=require(_0xbad0('0x5'));var qs=require(_0xbad0('0x6'));var logger=require(_0xbad0('0x7'))('api');var config=require(_0xbad0('0x8'));var db=require(_0xbad0('0x9'))['db'];var htmlEntities=require(_0xbad0('0xa'));config['redis']=_[_0xbad0('0xb')](config[_0xbad0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbad0('0xd'))(new Redis(config[_0xbad0('0xc')]));require(_0xbad0('0xe'))[_0xbad0('0xf')](socket);function respondWithStatusCode(_0x4f5682,_0x38c98b){_0x38c98b=_0x38c98b||0xcc;return function(_0x57b6b0){if(_0x57b6b0){return _0x4f5682[_0xbad0('0x10')](_0x38c98b);}return _0x4f5682[_0xbad0('0x11')](_0x38c98b)[_0xbad0('0x12')]();};}function respondWithResult(_0x2c43bf,_0x115853){_0x115853=_0x115853||0xc8;return function(_0x1dc8cc){if(_0x1dc8cc){return _0x2c43bf[_0xbad0('0x11')](_0x115853)[_0xbad0('0x13')](_0x1dc8cc);}};}function respondWithFilteredResult(_0x2c028c,_0x465a7c){return function(_0x319a70){if(_0x319a70){var _0xf453e1=typeof _0x465a7c['offset']===_0xbad0('0x14')&&typeof _0x465a7c[_0xbad0('0x15')]==='undefined';var _0x54194c=_0x319a70[_0xbad0('0x16')];var _0x3e6cd1=_0xf453e1?0x0:_0x465a7c[_0xbad0('0x17')];var _0x10788e=_0xf453e1?_0x319a70['count']:_0x465a7c[_0xbad0('0x17')]+_0x465a7c['limit'];var _0x5efdd4;if(_0x10788e>=_0x54194c){_0x10788e=_0x54194c;_0x5efdd4=0xc8;}else{_0x5efdd4=0xce;}_0x2c028c[_0xbad0('0x11')](_0x5efdd4);return _0x2c028c['set']('Content-Range',_0x3e6cd1+'-'+_0x10788e+'/'+_0x54194c)[_0xbad0('0x13')](_0x319a70);}return null;};}function saveUpdates(_0x5d67c0){return function(_0x1805ff){if(_0x1805ff){return _0x1805ff[_0xbad0('0x18')](_0x5d67c0)[_0xbad0('0x19')](function(_0xe205bb){return _0xe205bb;});}return null;};}function removeEntity(_0x938762){return function(_0x5c2001){if(_0x5c2001){return _0x5c2001[_0xbad0('0x1a')]()[_0xbad0('0x19')](function(){_0x938762[_0xbad0('0x11')](0xcc)[_0xbad0('0x12')]();});}};}function handleEntityNotFound(_0x30df25){return function(_0x47c9a1){if(!_0x47c9a1){_0x30df25[_0xbad0('0x10')](0x194);}return _0x47c9a1;};}function handleError(_0x196d3b,_0x40fe63){_0x40fe63=_0x40fe63||0x1f4;return function(_0x39754b){logger[_0xbad0('0x1b')](_0x39754b[_0xbad0('0x1c')]);if(_0x39754b[_0xbad0('0x1d')]){delete _0x39754b[_0xbad0('0x1d')];}_0x196d3b['status'](_0x40fe63)['send'](_0x39754b);};}exports[_0xbad0('0x1e')]=function(_0x1002aa,_0x5e3951){var _0x299507={};var _0x1e0cf2=_['map'](db[_0xbad0('0x1f')][_0xbad0('0x20')],function(_0x2ed8f6){return{'name':_0x2ed8f6[_0xbad0('0x21')],'type':_0x2ed8f6[_0xbad0('0x22')]['key']};});_0x299507=qs[_0xbad0('0x23')](_0x1e0cf2,_0x1002aa);return interaction[_0xbad0('0x24')](_0xbad0('0x25'),_0x1002aa[_0xbad0('0x26')],_0x1002aa['user'],_0x299507,_0x1e0cf2)[_0xbad0('0x19')](respondWithFilteredResult(_0x5e3951,_0x299507))[_0xbad0('0x27')](handleError(_0x5e3951,null));};exports[_0xbad0('0x28')]=function(_0x1f13b0,_0x371013){var _0x460fa2={'raw':![],'where':{'id':_0x1f13b0[_0xbad0('0x29')]['id']}},_0x17f7e9={};_0x17f7e9[_0xbad0('0x2a')]=_[_0xbad0('0x2b')](db[_0xbad0('0x1f')]['rawAttributes']);_0x17f7e9[_0xbad0('0x26')]=_[_0xbad0('0x2b')](_0x1f13b0[_0xbad0('0x26')]);_0x17f7e9[_0xbad0('0x2c')]=_[_0xbad0('0x2d')](_0x17f7e9[_0xbad0('0x2a')],_0x17f7e9['query']);_0x460fa2[_0xbad0('0x2e')]=_['intersection'](_0x17f7e9[_0xbad0('0x2a')],qs[_0xbad0('0x2f')](_0x1f13b0[_0xbad0('0x26')][_0xbad0('0x2f')]));_0x460fa2[_0xbad0('0x2e')]=_0x460fa2[_0xbad0('0x2e')][_0xbad0('0x30')]?_0x460fa2[_0xbad0('0x2e')]:_0x17f7e9[_0xbad0('0x2a')];if(_0x1f13b0['query'][_0xbad0('0x31')]){_0x460fa2['include']=[{'all':!![]}];}_0x460fa2=_[_0xbad0('0x32')]({},_0x460fa2,_0x1f13b0[_0xbad0('0x33')]);return db[_0xbad0('0x1f')][_0xbad0('0x34')](_0x460fa2)[_0xbad0('0x19')](handleEntityNotFound(_0x371013,null))['then'](respondWithResult(_0x371013,null))[_0xbad0('0x27')](handleError(_0x371013,null));};exports[_0xbad0('0x35')]=function(_0x1dad76,_0x5e627e){return db[_0xbad0('0x1f')][_0xbad0('0x35')](_0x1dad76[_0xbad0('0x36')],{})['then'](respondWithResult(_0x5e627e,0xc9))[_0xbad0('0x27')](handleError(_0x5e627e,null));};exports[_0xbad0('0x18')]=function(_0x49fc36,_0x523962){if(_0x49fc36[_0xbad0('0x36')]['id']){delete _0x49fc36['body']['id'];}return db[_0xbad0('0x1f')][_0xbad0('0x34')]({'where':{'id':_0x49fc36[_0xbad0('0x29')]['id']}})[_0xbad0('0x19')](handleEntityNotFound(_0x523962,null))[_0xbad0('0x19')](saveUpdates(_0x49fc36[_0xbad0('0x36')],null))[_0xbad0('0x19')](respondWithResult(_0x523962,null))[_0xbad0('0x27')](handleError(_0x523962,null));};exports[_0xbad0('0x1a')]=function(_0x46624a,_0x274439){return db[_0xbad0('0x1f')]['find']({'where':{'id':_0x46624a['params']['id']}})[_0xbad0('0x19')](handleEntityNotFound(_0x274439,null))[_0xbad0('0x19')](removeEntity(_0x274439,null))[_0xbad0('0x27')](handleError(_0x274439,null));};exports['describe']=function(_0x1bb278,_0x43ac36){return db[_0xbad0('0x1f')]['describe']()[_0xbad0('0x19')](respondWithResult(_0x43ac36,null))['catch'](handleError(_0x43ac36,null));};exports[_0xbad0('0x37')]=function(_0x15bb52,_0x2bf7d1){return db['MailMessage'][_0xbad0('0x34')]({'where':{'id':_0x15bb52[_0xbad0('0x29')]['id']}})[_0xbad0('0x19')](handleEntityNotFound(_0x2bf7d1,null))[_0xbad0('0x19')](function(_0x458502){if(_0x458502){return _0x458502[_0xbad0('0x37')](_0x15bb52[_0xbad0('0x36')][_0xbad0('0x38')],_[_0xbad0('0x39')](_0x15bb52['body'],[_0xbad0('0x38'),'id'])||{});}})[_0xbad0('0x19')](respondWithResult(_0x2bf7d1,null))[_0xbad0('0x27')](handleError(_0x2bf7d1,null));};exports[_0xbad0('0x3a')]=function(_0x15fb98,_0x2aa897){var _0x1d71d5={'raw':![],'where':{}};var _0xfa9677={};var _0x4a7958={'count':0x0,'rows':[]};return db[_0xbad0('0x1f')][_0xbad0('0x3b')]({'where':{'id':_0x15fb98[_0xbad0('0x29')]['id']}})['then'](handleEntityNotFound(_0x2aa897,null))[_0xbad0('0x19')](function(_0x437af2){if(_0x437af2){_0xfa9677[_0xbad0('0x2a')]=_[_0xbad0('0x2b')](db['MailMessage'][_0xbad0('0x20')]);_0xfa9677[_0xbad0('0x26')]=_[_0xbad0('0x2b')](_0x15fb98['query']);_0xfa9677[_0xbad0('0x2c')]=_['intersection'](_0xfa9677[_0xbad0('0x2a')],_0xfa9677[_0xbad0('0x26')]);_0x1d71d5[_0xbad0('0x2e')]=_['intersection'](_0xfa9677['model'],qs[_0xbad0('0x2f')](_0x15fb98['query'][_0xbad0('0x2f')]));_0x1d71d5[_0xbad0('0x2e')]=_0x1d71d5[_0xbad0('0x2e')][_0xbad0('0x30')]?_0x1d71d5[_0xbad0('0x2e')]:_0xfa9677['model'];if(!_0x15fb98[_0xbad0('0x26')][_0xbad0('0x3c')]('nolimit')){_0x1d71d5['limit']=qs[_0xbad0('0x15')](_0x15fb98[_0xbad0('0x26')][_0xbad0('0x15')]);_0x1d71d5[_0xbad0('0x17')]=qs['offset'](_0x15fb98[_0xbad0('0x26')][_0xbad0('0x17')]);}_0x1d71d5[_0xbad0('0x3d')]=qs['sort'](_0x15fb98['query'][_0xbad0('0x3e')]);_0x1d71d5['where']=qs[_0xbad0('0x2c')](_['pick'](_0x15fb98[_0xbad0('0x26')],_0xfa9677[_0xbad0('0x2c')]));_0x1d71d5['where'][_0xbad0('0x3f')]=_0x437af2['id'];if(_0x15fb98[_0xbad0('0x26')][_0xbad0('0x40')]){_0x1d71d5[_0xbad0('0x41')]=_['merge'](_0x1d71d5[_0xbad0('0x41')],{'$or':_[_0xbad0('0x42')](_0x1d71d5[_0xbad0('0x2e')],function(_0x421fee){var _0x37c379={};_0x37c379[_0x421fee]={'$like':'%'+_0x15fb98[_0xbad0('0x26')]['filter']+'%'};return _0x37c379;})});}if(_0x15fb98[_0xbad0('0x26')][_0xbad0('0x43')]){var _0x33cd3f=_0x15fb98[_0xbad0('0x26')][_0xbad0('0x43')][_0xbad0('0x44')](',');var _0x1bcd44={};_0x1bcd44[_0x33cd3f[0x0]]={'$gte':moment(_0x33cd3f[0x1])[_0xbad0('0x45')](_0xbad0('0x46'))};_0x1d71d5[_0xbad0('0x41')]=_[_0xbad0('0x32')](_0x1d71d5[_0xbad0('0x41')],_0x1bcd44);}_0x1d71d5=_['merge']({},_0x1d71d5,_0x15fb98[_0xbad0('0x33')]);return db['MailMessage']['count']({'where':_0x1d71d5[_0xbad0('0x41')]})[_0xbad0('0x19')](function(_0x3e9053){_0x4a7958[_0xbad0('0x16')]=_0x3e9053;if(_0x15fb98[_0xbad0('0x26')][_0xbad0('0x31')]){_0x1d71d5[_0xbad0('0x47')]=[{'all':!![]}];}return db['MailMessage'][_0xbad0('0x24')](_0x1d71d5);})[_0xbad0('0x19')](function(_0x504464){if(_0x15fb98[_0xbad0('0x26')]['inlineCss']===_0xbad0('0x48')){for(var _0x31aefd=0x0;_0x31aefd<_0x504464[_0xbad0('0x30')];_0x31aefd++){_0x504464[_0x31aefd][_0xbad0('0x36')]=juice(_0x504464[_0x31aefd]['body']);}}_0x4a7958[_0xbad0('0x49')]=_0x504464;return _0x4a7958;});}})[_0xbad0('0x19')](respondWithFilteredResult(_0x2aa897,_0x1d71d5))[_0xbad0('0x27')](handleError(_0x2aa897,null));};exports[_0xbad0('0x4a')]=function(_0x299962,_0x5d3264){return db['MailInteraction'][_0xbad0('0x34')]({'where':{'id':_0x299962[_0xbad0('0x29')]['id']}})[_0xbad0('0x19')](handleEntityNotFound(_0x5d3264,null))[_0xbad0('0x19')](function(_0x81604c){if(_0x81604c){return _0x81604c[_0xbad0('0x4b')](_0x299962[_0xbad0('0x36')]['ids'],_[_0xbad0('0x39')](_0x299962[_0xbad0('0x36')],[_0xbad0('0x38'),'id'])||{})[_0xbad0('0x4c')](function(){return db[_0xbad0('0x4d')]['findAll']({'attributes':['id',_0xbad0('0x1d'),_0xbad0('0x4e')],'where':{'id':_0x299962[_0xbad0('0x36')][_0xbad0('0x38')]}});})[_0xbad0('0x19')](function(_0x58c291){socket[_0xbad0('0x4f')](_0xbad0('0x50'),{'id':Number(_0x299962[_0xbad0('0x29')]['id']),'tags':_0x58c291||[]});return{'id':Number(_0x299962[_0xbad0('0x29')]['id']),'tags':_0x58c291||[]};});}})[_0xbad0('0x19')](respondWithResult(_0x5d3264,null))[_0xbad0('0x27')](handleError(_0x5d3264,null));};exports[_0xbad0('0x51')]=function(_0xdfc197,_0x244f86){return db[_0xbad0('0x1f')][_0xbad0('0x34')]({'where':{'id':_0xdfc197[_0xbad0('0x29')]['id']}})['then'](handleEntityNotFound(_0x244f86,null))['then'](function(_0x4b4908){if(_0x4b4908){return _0x4b4908['removeTags'](_0xdfc197[_0xbad0('0x26')][_0xbad0('0x38')]);}})[_0xbad0('0x19')](respondWithStatusCode(_0x244f86,null))[_0xbad0('0x27')](handleError(_0x244f86,null));};exports['download']=function(_0x3805a1,_0x58eb51){var _0x2b0dbe=moment()[_0xbad0('0x52')]()[_0xbad0('0x53')]();var _0x38a624=path[_0xbad0('0x54')](config['root'],_0xbad0('0x55'),_0xbad0('0x56'),_0xbad0('0x57'));var _0x274aa5=path[_0xbad0('0x54')](config[_0xbad0('0x58')],_0xbad0('0x55'),_0xbad0('0x56'),_0xbad0('0x59'));var _0x2fc27a=path[_0xbad0('0x54')](_0x38a624,_0x2b0dbe);var _0xd96723=util[_0xbad0('0x45')](_0xbad0('0x5a'),_0x3805a1['params']['id'],_0x2b0dbe);var _0x38c8f9=path['join'](_0x38a624,_0xd96723);var _0x4dd6ea=[];if(_0x3805a1[_0xbad0('0x26')][_0xbad0('0x59')]){_0x4dd6ea[_0xbad0('0x5b')]({'model':db['Attachment'],'as':_0xbad0('0x5c'),'raw':!![]});}var _0x408c8c=[{'model':db[_0xbad0('0x5d')],'as':_0xbad0('0x5e'),'attributes':['id',_0xbad0('0x36'),_0xbad0('0x5f'),'to','cc',_0xbad0('0x60'),_0xbad0('0x61'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbad0('0x3e')]('id'),'include':_0x4dd6ea}];return db['MailInteraction'][_0xbad0('0x34')]({'where':{'id':_0x3805a1[_0xbad0('0x29')]['id']},'include':_0x408c8c})[_0xbad0('0x19')](handleEntityNotFound(_0x58eb51,null))[_0xbad0('0x19')](function(_0x5a1591){if(_0x5a1591&&_0x5a1591[_0xbad0('0x5e')]){var _0x59485a=_0x5a1591['get']({'plain':!![]});fs['mkdirSync'](_0x2fc27a);return BPromise[_0xbad0('0x62')](_0x59485a['Messages'],function(_0x332ef3,_0x40451f){var _0x40eca1={'from':_0x332ef3[_0xbad0('0x5f')],'to':_0x332ef3['to']||_0xbad0('0x63'),'subject':_0x332ef3['subject'],'html':htmlEntities[_0xbad0('0x64')](_0x332ef3[_0xbad0('0x36')]),'headers':{'Date':moment(_0x332ef3[_0xbad0('0x65')])['format'](_0xbad0('0x66'))},'attachments':[]};if(_0x332ef3['cc']){_0x40eca1[_0xbad0('0x67')]['Cc']=_0x332ef3['cc'];}if(_0x332ef3[_0xbad0('0x60')]){_0x40eca1['headers']['Bcc']=_0x332ef3[_0xbad0('0x60')];}return new BPromise(function(_0x34c179,_0x1b6fa1){if(_0x332ef3[_0xbad0('0x5c')]){for(var _0x13bf52=0x0;_0x13bf52<_0x332ef3[_0xbad0('0x5c')]['length'];_0x13bf52++){var _0x507a5a=_0x332ef3[_0xbad0('0x5c')][_0x13bf52];var _0x53ab57=path[_0xbad0('0x54')](_0x274aa5,_0x507a5a[_0xbad0('0x68')]);if(fs[_0xbad0('0x69')](_0x53ab57)){_0x40eca1[_0xbad0('0x59')][_0xbad0('0x5b')]({'name':_0x507a5a['name'],'contentType':_0x507a5a[_0xbad0('0x22')],'data':fs[_0xbad0('0x6a')](_0x53ab57)});}}}emlformat[_0xbad0('0x6b')](_0x40eca1,function(_0x26419d,_0xdf2e3c){if(_0x26419d)return _0x1b6fa1(_0x26419d);fs[_0xbad0('0x6c')](path[_0xbad0('0x54')](_0x2fc27a,util[_0xbad0('0x45')](_0xbad0('0x6d'),_0x40451f)),_0xdf2e3c);return _0x34c179(_0xdf2e3c);});});})[_0xbad0('0x19')](function(){return new BPromise(function(_0x27a36d,_0xda4836){zipdir(_0x2fc27a,{'saveTo':_0x38c8f9},function(_0x450c47,_0x552a5d){if(_0x450c47)return _0xda4836(_0x450c47);return _0x27a36d(_0x552a5d);});})[_0xbad0('0x19')](function(){return new BPromise(function(_0x205064,_0xca5b03){rimraf(_0x2fc27a,function(_0x5ce2b9){if(_0x5ce2b9)_0xca5b03(_0x5ce2b9);return _0x205064();});});})[_0xbad0('0x19')](function(){return _0x58eb51['download'](_0x38c8f9,_0xd96723,function(_0x51895d){if(!_0x51895d)fs[_0xbad0('0x6e')](_0x38c8f9);});});});}else{return _0x58eb51[_0xbad0('0x10')](0xc8);}})['catch'](handleError(_0x58eb51,null));}; \ No newline at end of file +var _0xe0d5=['set','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','params','keys','filters','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','MailInteraction','describe','MailMessage','addMessage','ids','omit','findOne','intersection','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','spread','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','Attachment','Attachments','Messages','from','bcc','createdAt','mkdirSync','each','missing.recipient@your.company.com','subject','headers','Bcc','existsSync','push','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','api','../../config/environment','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3f2cfe,_0x16fd1c){var _0x36c4ae=function(_0x5893cb){while(--_0x5893cb){_0x3f2cfe['push'](_0x3f2cfe['shift']());}};_0x36c4ae(++_0x16fd1c);}(_0xe0d5,0x132));var _0x5e0d=function(_0x44fe7a,_0xa5d7df){_0x44fe7a=_0x44fe7a-0x0;var _0x294dd3=_0xe0d5[_0x44fe7a];return _0x294dd3;};'use strict';var emlformat=require(_0x5e0d('0x0'));var rimraf=require(_0x5e0d('0x1'));var zipdir=require(_0x5e0d('0x2'));var moment=require(_0x5e0d('0x3'));var BPromise=require(_0x5e0d('0x4'));var util=require(_0x5e0d('0x5'));var path=require(_0x5e0d('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0x5e0d('0x7'));var Redis=require(_0x5e0d('0x8'));var interaction=require(_0x5e0d('0x9'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5e0d('0xa'));var config=require(_0x5e0d('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x5e0d('0xc')]=_[_0x5e0d('0xd')](config[_0x5e0d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e0d('0xe'))(new Redis(config['redis']));require(_0x5e0d('0xf'))[_0x5e0d('0x10')](socket);function respondWithStatusCode(_0x22ee01,_0x5a4e13){_0x5a4e13=_0x5a4e13||0xcc;return function(_0x454f81){if(_0x454f81){return _0x22ee01[_0x5e0d('0x11')](_0x5a4e13);}return _0x22ee01[_0x5e0d('0x12')](_0x5a4e13)['end']();};}function respondWithResult(_0x50f2f9,_0x5a11b1){_0x5a11b1=_0x5a11b1||0xc8;return function(_0x867dca){if(_0x867dca){return _0x50f2f9[_0x5e0d('0x12')](_0x5a11b1)[_0x5e0d('0x13')](_0x867dca);}};}function respondWithFilteredResult(_0x5050bb,_0x1daf50){return function(_0x55456a){if(_0x55456a){var _0x4a74b0=typeof _0x1daf50[_0x5e0d('0x14')]===_0x5e0d('0x15')&&typeof _0x1daf50[_0x5e0d('0x16')]===_0x5e0d('0x15');var _0x4a6e30=_0x55456a[_0x5e0d('0x17')];var _0xb40d46=_0x4a74b0?0x0:_0x1daf50['offset'];var _0x46aa4a=_0x4a74b0?_0x55456a['count']:_0x1daf50['offset']+_0x1daf50[_0x5e0d('0x16')];var _0x4b6060;if(_0x46aa4a>=_0x4a6e30){_0x46aa4a=_0x4a6e30;_0x4b6060=0xc8;}else{_0x4b6060=0xce;}_0x5050bb[_0x5e0d('0x12')](_0x4b6060);return _0x5050bb[_0x5e0d('0x18')]('Content-Range',_0xb40d46+'-'+_0x46aa4a+'/'+_0x4a6e30)[_0x5e0d('0x13')](_0x55456a);}return null;};}function saveUpdates(_0x5eb489){return function(_0x4603f9){if(_0x4603f9){return _0x4603f9[_0x5e0d('0x19')](_0x5eb489)[_0x5e0d('0x1a')](function(_0x322654){return _0x322654;});}return null;};}function removeEntity(_0x290076){return function(_0x589d84){if(_0x589d84){return _0x589d84[_0x5e0d('0x1b')]()['then'](function(){_0x290076[_0x5e0d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279a5c){return function(_0x8001f8){if(!_0x8001f8){_0x279a5c[_0x5e0d('0x11')](0x194);}return _0x8001f8;};}function handleError(_0x276ab1,_0x292c37){_0x292c37=_0x292c37||0x1f4;return function(_0x2fe493){logger['error'](_0x2fe493[_0x5e0d('0x1c')]);if(_0x2fe493[_0x5e0d('0x1d')]){delete _0x2fe493['name'];}_0x276ab1[_0x5e0d('0x12')](_0x292c37)['send'](_0x2fe493);};}exports[_0x5e0d('0x1e')]=function(_0x4070f4,_0xb4b83a){var _0x340020={};var _0x51ec26=_['map'](db['MailInteraction'][_0x5e0d('0x1f')],function(_0x319db6){return{'name':_0x319db6[_0x5e0d('0x20')],'type':_0x319db6[_0x5e0d('0x21')][_0x5e0d('0x22')]};});_0x340020=qs[_0x5e0d('0x23')](_0x51ec26,_0x4070f4);return interaction[_0x5e0d('0x24')]('mail',_0x4070f4[_0x5e0d('0x25')],_0x4070f4[_0x5e0d('0x26')],_0x340020,_0x51ec26)[_0x5e0d('0x1a')](respondWithFilteredResult(_0xb4b83a,_0x340020))['catch'](handleError(_0xb4b83a,null));};exports[_0x5e0d('0x27')]=function(_0x1c153d,_0x1ca1de){var _0x1ed853={'raw':![],'where':{'id':_0x1c153d[_0x5e0d('0x28')]['id']}},_0x3b07f1={};_0x3b07f1['model']=_[_0x5e0d('0x29')](db['MailInteraction'][_0x5e0d('0x1f')]);_0x3b07f1['query']=_['keys'](_0x1c153d[_0x5e0d('0x25')]);_0x3b07f1[_0x5e0d('0x2a')]=_['intersection'](_0x3b07f1[_0x5e0d('0x2b')],_0x3b07f1[_0x5e0d('0x25')]);_0x1ed853[_0x5e0d('0x2c')]=_['intersection'](_0x3b07f1[_0x5e0d('0x2b')],qs[_0x5e0d('0x2d')](_0x1c153d['query'][_0x5e0d('0x2d')]));_0x1ed853[_0x5e0d('0x2c')]=_0x1ed853['attributes'][_0x5e0d('0x2e')]?_0x1ed853['attributes']:_0x3b07f1[_0x5e0d('0x2b')];if(_0x1c153d['query'][_0x5e0d('0x2f')]){_0x1ed853['include']=[{'all':!![]}];}_0x1ed853=_[_0x5e0d('0x30')]({},_0x1ed853,_0x1c153d[_0x5e0d('0x31')]);return db['MailInteraction'][_0x5e0d('0x32')](_0x1ed853)[_0x5e0d('0x1a')](handleEntityNotFound(_0x1ca1de,null))['then'](respondWithResult(_0x1ca1de,null))[_0x5e0d('0x33')](handleError(_0x1ca1de,null));};exports[_0x5e0d('0x34')]=function(_0x5f271e,_0x47256b){return db['MailInteraction'][_0x5e0d('0x34')](_0x5f271e[_0x5e0d('0x35')],{})[_0x5e0d('0x1a')](respondWithResult(_0x47256b,0xc9))[_0x5e0d('0x33')](handleError(_0x47256b,null));};exports[_0x5e0d('0x19')]=function(_0x420ec2,_0x153542){if(_0x420ec2[_0x5e0d('0x35')]['id']){delete _0x420ec2[_0x5e0d('0x35')]['id'];}return db[_0x5e0d('0x36')][_0x5e0d('0x32')]({'where':{'id':_0x420ec2[_0x5e0d('0x28')]['id']}})['then'](handleEntityNotFound(_0x153542,null))[_0x5e0d('0x1a')](saveUpdates(_0x420ec2['body'],null))[_0x5e0d('0x1a')](respondWithResult(_0x153542,null))[_0x5e0d('0x33')](handleError(_0x153542,null));};exports[_0x5e0d('0x1b')]=function(_0x55965a,_0x5ec13c){return db[_0x5e0d('0x36')][_0x5e0d('0x32')]({'where':{'id':_0x55965a[_0x5e0d('0x28')]['id']}})[_0x5e0d('0x1a')](handleEntityNotFound(_0x5ec13c,null))['then'](removeEntity(_0x5ec13c,null))[_0x5e0d('0x33')](handleError(_0x5ec13c,null));};exports[_0x5e0d('0x37')]=function(_0x169a7f,_0x290b0b){return db['MailInteraction'][_0x5e0d('0x37')]()[_0x5e0d('0x1a')](respondWithResult(_0x290b0b,null))[_0x5e0d('0x33')](handleError(_0x290b0b,null));};exports['addMessage']=function(_0x457673,_0x3de77b){return db[_0x5e0d('0x38')][_0x5e0d('0x32')]({'where':{'id':_0x457673['params']['id']}})['then'](handleEntityNotFound(_0x3de77b,null))[_0x5e0d('0x1a')](function(_0x8cca63){if(_0x8cca63){return _0x8cca63[_0x5e0d('0x39')](_0x457673['body'][_0x5e0d('0x3a')],_[_0x5e0d('0x3b')](_0x457673['body'],['ids','id'])||{});}})[_0x5e0d('0x1a')](respondWithResult(_0x3de77b,null))['catch'](handleError(_0x3de77b,null));};exports['getMessages']=function(_0x1db630,_0x4b3142){var _0x33ba40={'raw':![],'where':{}};var _0x5d62c9={};var _0x12792d={'count':0x0,'rows':[]};return db[_0x5e0d('0x36')][_0x5e0d('0x3c')]({'where':{'id':_0x1db630['params']['id']}})['then'](handleEntityNotFound(_0x4b3142,null))['then'](function(_0x58bf77){if(_0x58bf77){_0x5d62c9[_0x5e0d('0x2b')]=_['keys'](db[_0x5e0d('0x38')][_0x5e0d('0x1f')]);_0x5d62c9[_0x5e0d('0x25')]=_[_0x5e0d('0x29')](_0x1db630[_0x5e0d('0x25')]);_0x5d62c9[_0x5e0d('0x2a')]=_[_0x5e0d('0x3d')](_0x5d62c9[_0x5e0d('0x2b')],_0x5d62c9[_0x5e0d('0x25')]);_0x33ba40[_0x5e0d('0x2c')]=_['intersection'](_0x5d62c9[_0x5e0d('0x2b')],qs[_0x5e0d('0x2d')](_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x2d')]));_0x33ba40[_0x5e0d('0x2c')]=_0x33ba40[_0x5e0d('0x2c')]['length']?_0x33ba40['attributes']:_0x5d62c9[_0x5e0d('0x2b')];if(!_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x3e')](_0x5e0d('0x3f'))){_0x33ba40['limit']=qs[_0x5e0d('0x16')](_0x1db630['query'][_0x5e0d('0x16')]);_0x33ba40[_0x5e0d('0x14')]=qs[_0x5e0d('0x14')](_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x14')]);}_0x33ba40['order']=qs[_0x5e0d('0x40')](_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x40')]);_0x33ba40[_0x5e0d('0x41')]=qs[_0x5e0d('0x2a')](_[_0x5e0d('0x42')](_0x1db630['query'],_0x5d62c9['filters']));_0x33ba40[_0x5e0d('0x41')][_0x5e0d('0x43')]=_0x58bf77['id'];if(_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x44')]){_0x33ba40[_0x5e0d('0x41')]=_[_0x5e0d('0x30')](_0x33ba40[_0x5e0d('0x41')],{'$or':_[_0x5e0d('0x45')](_0x33ba40[_0x5e0d('0x2c')],function(_0x4613a7){var _0x5d6561={};_0x5d6561[_0x4613a7]={'$like':'%'+_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x44')]+'%'};return _0x5d6561;})});}if(_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x46')]){var _0x7ae80=_0x1db630[_0x5e0d('0x25')]['$gte'][_0x5e0d('0x47')](',');var _0x375b32={};_0x375b32[_0x7ae80[0x0]]={'$gte':moment(_0x7ae80[0x1])[_0x5e0d('0x48')](_0x5e0d('0x49'))};_0x33ba40[_0x5e0d('0x41')]=_[_0x5e0d('0x30')](_0x33ba40[_0x5e0d('0x41')],_0x375b32);}_0x33ba40=_[_0x5e0d('0x30')]({},_0x33ba40,_0x1db630['options']);return db['MailMessage'][_0x5e0d('0x17')]({'where':_0x33ba40['where']})[_0x5e0d('0x1a')](function(_0x23c8a9){_0x12792d[_0x5e0d('0x17')]=_0x23c8a9;if(_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x2f')]){_0x33ba40['include']=[{'all':!![]}];}return db[_0x5e0d('0x38')][_0x5e0d('0x24')](_0x33ba40);})[_0x5e0d('0x1a')](function(_0x129491){if(_0x1db630[_0x5e0d('0x25')][_0x5e0d('0x4a')]===_0x5e0d('0x4b')){for(var _0x35bcdd=0x0;_0x35bcdd<_0x129491[_0x5e0d('0x2e')];_0x35bcdd++){_0x129491[_0x35bcdd]['body']=juice(_0x129491[_0x35bcdd][_0x5e0d('0x35')]);}}_0x12792d[_0x5e0d('0x4c')]=_0x129491;return _0x12792d;});}})['then'](respondWithFilteredResult(_0x4b3142,_0x33ba40))['catch'](handleError(_0x4b3142,null));};exports['addTags']=function(_0xaba975,_0x595215){return db['MailInteraction'][_0x5e0d('0x32')]({'where':{'id':_0xaba975['params']['id']}})[_0x5e0d('0x1a')](handleEntityNotFound(_0x595215,null))['then'](function(_0x49e1a7){if(_0x49e1a7){return _0x49e1a7[_0x5e0d('0x4d')](_0xaba975[_0x5e0d('0x35')][_0x5e0d('0x3a')],_[_0x5e0d('0x3b')](_0xaba975[_0x5e0d('0x35')],[_0x5e0d('0x3a'),'id'])||{})[_0x5e0d('0x4e')](function(){return db['Tag'][_0x5e0d('0x24')]({'attributes':['id',_0x5e0d('0x1d'),_0x5e0d('0x4f')],'where':{'id':_0xaba975[_0x5e0d('0x35')][_0x5e0d('0x3a')]}});})[_0x5e0d('0x1a')](function(_0x3b2bde){socket[_0x5e0d('0x50')](_0x5e0d('0x51'),{'id':Number(_0xaba975[_0x5e0d('0x28')]['id']),'tags':_0x3b2bde||[]});return{'id':Number(_0xaba975[_0x5e0d('0x28')]['id']),'tags':_0x3b2bde||[]};});}})[_0x5e0d('0x1a')](respondWithResult(_0x595215,null))[_0x5e0d('0x33')](handleError(_0x595215,null));};exports[_0x5e0d('0x52')]=function(_0xe801af,_0x45aae9){return db[_0x5e0d('0x36')][_0x5e0d('0x32')]({'where':{'id':_0xe801af[_0x5e0d('0x28')]['id']}})[_0x5e0d('0x1a')](handleEntityNotFound(_0x45aae9,null))[_0x5e0d('0x1a')](function(_0x305713){if(_0x305713){return _0x305713['removeTags'](_0xe801af[_0x5e0d('0x25')][_0x5e0d('0x3a')]);}})[_0x5e0d('0x1a')](respondWithStatusCode(_0x45aae9,null))['catch'](handleError(_0x45aae9,null));};exports[_0x5e0d('0x53')]=function(_0x255988,_0x4fd0a4){var _0x389dd3=moment()[_0x5e0d('0x54')]()[_0x5e0d('0x55')]();var _0x32940f=path['join'](config[_0x5e0d('0x56')],_0x5e0d('0x57'),_0x5e0d('0x58'),_0x5e0d('0x59'));var _0x4b67d4=path['join'](config['root'],_0x5e0d('0x57'),_0x5e0d('0x58'),_0x5e0d('0x5a'));var _0x4a2dbb=path[_0x5e0d('0x5b')](_0x32940f,_0x389dd3);var _0x339545=util[_0x5e0d('0x48')]('transcript-%d-%s.zip',_0x255988[_0x5e0d('0x28')]['id'],_0x389dd3);var _0x3b2c44=path[_0x5e0d('0x5b')](_0x32940f,_0x339545);var _0x76d090=[];if(_0x255988[_0x5e0d('0x25')][_0x5e0d('0x5a')]){_0x76d090['push']({'model':db[_0x5e0d('0x5c')],'as':_0x5e0d('0x5d'),'raw':!![]});}var _0x5c41cd=[{'model':db[_0x5e0d('0x38')],'as':_0x5e0d('0x5e'),'attributes':['id',_0x5e0d('0x35'),_0x5e0d('0x5f'),'to','cc',_0x5e0d('0x60'),'subject',_0x5e0d('0x61')],'where':{'secret':![]},'order':qs[_0x5e0d('0x40')]('id'),'include':_0x76d090}];return db[_0x5e0d('0x36')][_0x5e0d('0x32')]({'where':{'id':_0x255988['params']['id']},'include':_0x5c41cd})[_0x5e0d('0x1a')](handleEntityNotFound(_0x4fd0a4,null))['then'](function(_0x1dec68){if(_0x1dec68&&_0x1dec68[_0x5e0d('0x5e')]){var _0x1cdc05=_0x1dec68['get']({'plain':!![]});fs[_0x5e0d('0x62')](_0x4a2dbb);return BPromise[_0x5e0d('0x63')](_0x1cdc05[_0x5e0d('0x5e')],function(_0x2c7406,_0x5550f0){var _0x5d83f4={'from':_0x2c7406[_0x5e0d('0x5f')],'to':_0x2c7406['to']||_0x5e0d('0x64'),'subject':_0x2c7406[_0x5e0d('0x65')],'html':htmlEntities['decode'](_0x2c7406['body']),'headers':{'Date':moment(_0x2c7406[_0x5e0d('0x61')])[_0x5e0d('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2c7406['cc']){_0x5d83f4[_0x5e0d('0x66')]['Cc']=_0x2c7406['cc'];}if(_0x2c7406['bcc']){_0x5d83f4[_0x5e0d('0x66')][_0x5e0d('0x67')]=_0x2c7406['bcc'];}return new BPromise(function(_0x7d0fc8,_0x506dca){if(_0x2c7406['Attachments']){for(var _0x27d09f=0x0;_0x27d09f<_0x2c7406[_0x5e0d('0x5d')][_0x5e0d('0x2e')];_0x27d09f++){var _0x3539be=_0x2c7406[_0x5e0d('0x5d')][_0x27d09f];var _0x4712dd=path['join'](_0x4b67d4,_0x3539be['basename']);if(fs[_0x5e0d('0x68')](_0x4712dd)){_0x5d83f4[_0x5e0d('0x5a')][_0x5e0d('0x69')]({'name':_0x3539be[_0x5e0d('0x1d')],'contentType':_0x3539be[_0x5e0d('0x21')],'data':fs[_0x5e0d('0x6a')](_0x4712dd)});}}}emlformat['build'](_0x5d83f4,function(_0x25d19f,_0x146394){if(_0x25d19f)return _0x506dca(_0x25d19f);fs[_0x5e0d('0x6b')](path[_0x5e0d('0x5b')](_0x4a2dbb,util[_0x5e0d('0x48')](_0x5e0d('0x6c'),_0x5550f0)),_0x146394);return _0x7d0fc8(_0x146394);});});})[_0x5e0d('0x1a')](function(){return new BPromise(function(_0x153757,_0x43bf57){zipdir(_0x4a2dbb,{'saveTo':_0x3b2c44},function(_0x562c66,_0x53a2ce){if(_0x562c66)return _0x43bf57(_0x562c66);return _0x153757(_0x53a2ce);});})[_0x5e0d('0x1a')](function(){return new BPromise(function(_0xde2d53,_0x1af302){rimraf(_0x4a2dbb,function(_0x52c3ae){if(_0x52c3ae)_0x1af302(_0x52c3ae);return _0xde2d53();});});})[_0x5e0d('0x1a')](function(){return _0x4fd0a4[_0x5e0d('0x53')](_0x3b2c44,_0x339545,function(_0x2c08ca){if(!_0x2c08ca)fs[_0x5e0d('0x6d')](_0x3b2c44);});});});}else{return _0x4fd0a4[_0x5e0d('0x11')](0xc8);}})['catch'](handleError(_0x4fd0a4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 93af845..f4588bd 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 _0x7fae=['save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x55e068,_0x1b607e){var _0x2a9b0d=function(_0x447fd4){while(--_0x447fd4){_0x55e068['push'](_0x55e068['shift']());}};_0x2a9b0d(++_0x1b607e);}(_0x7fae,0x183));var _0xe7fa=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7fae[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xe7fa('0x0'));var MailInteraction=require(_0xe7fa('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xe7fa('0x1'))['db'][_0xe7fa('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe7fa('0x3')](0x0);var events={'afterCreate':_0xe7fa('0x4'),'afterUpdate':_0xe7fa('0x5'),'afterDestroy':_0xe7fa('0x6')};function emitEvent(_0xe9f485){return function(_0x23d98b,_0x378713,_0x4053d3){_0x23d98b[_0xe7fa('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x358047){_0x23d98b[_0xe7fa('0x8')]('Users',_0x358047[_0xe7fa('0x9')](function(_0x2aa07c){return{'id':_0x2aa07c['id']};}));return MailMessage[_0xe7fa('0xa')]({'where':{'MailInteractionId':_0x23d98b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe7fa('0xb')](function(_0x5308f6){_0x23d98b['setDataValue'](_0xe7fa('0xc'),_0x5308f6[_0xe7fa('0xd')]);MailInteractionEvents[_0xe7fa('0xe')](_0xe9f485+':'+_0x23d98b['id'],_0x23d98b);MailInteractionEvents[_0xe7fa('0xe')](_0xe9f485,_0x23d98b);_0x4053d3(null);})[_0xe7fa('0xf')](_0x4053d3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xe7fa('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x500f=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save'];(function(_0x35c5b7,_0x513f34){var _0x114645=function(_0x590252){while(--_0x590252){_0x35c5b7['push'](_0x35c5b7['shift']());}};_0x114645(++_0x513f34);}(_0x500f,0xd7));var _0xf500=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x500f[_0x5a6961];return _0x4af0a6;};'use strict';var EventEmitter=require(_0xf500('0x0'));var MailInteraction=require(_0xf500('0x1'))['db'][_0xf500('0x2')];var MailMessage=require(_0xf500('0x1'))['db'][_0xf500('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf500('0x4')](0x0);var events={'afterCreate':_0xf500('0x5'),'afterUpdate':'update','afterDestroy':_0xf500('0x6')};function emitEvent(_0x3d1d2e){return function(_0x15f420,_0x1ee91f,_0x77cd17){_0x15f420[_0xf500('0x7')]({'attributes':['id'],'raw':!![]})[_0xf500('0x8')](function(_0x1c3d66){_0x15f420[_0xf500('0x9')](_0xf500('0xa'),_0x1c3d66[_0xf500('0xb')](function(_0x1bf2c0){return{'id':_0x1bf2c0['id']};}));return MailMessage[_0xf500('0xc')]({'where':{'MailInteractionId':_0x15f420['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf500('0x8')](function(_0x157314){_0x15f420[_0xf500('0x9')](_0xf500('0xd'),_0x157314['length']);MailInteractionEvents[_0xf500('0xe')](_0x3d1d2e+':'+_0x15f420['id'],_0x15f420);MailInteractionEvents['emit'](_0x3d1d2e,_0x15f420);_0x77cd17(null);})[_0xf500('0xf')](_0x77cd17(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xf500('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f4ebd35..21383cc 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 _0xc20f=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','MailInteraction','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x154427,_0x282416){var _0x2ac21c=function(_0x4748bb){while(--_0x4748bb){_0x154427['push'](_0x154427['shift']());}};_0x2ac21c(++_0x282416);}(_0xc20f,0xe0));var _0xfc20=function(_0x2b8ea6,_0x35c773){_0x2b8ea6=_0x2b8ea6-0x0;var _0x1d8fb0=_0xc20f[_0x2b8ea6];return _0x1d8fb0;};'use strict';var _=require(_0xfc20('0x0'));var util=require(_0xfc20('0x1'));var logger=require(_0xfc20('0x2'))(_0xfc20('0x3'));var moment=require(_0xfc20('0x4'));var BPromise=require(_0xfc20('0x5'));var rp=require(_0xfc20('0x6'));var fs=require('fs');var path=require(_0xfc20('0x7'));var rimraf=require('rimraf');var config=require(_0xfc20('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0xebcae5,_0x394c6a){return _0xebcae5['define'](_0xfc20('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfc20('0xa'),'to'],'type':_0xfc20('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e2683,_0x18db22,_0x5c1615){if(_0x3e2683[_0xfc20('0xc')]){_0x3e2683[_0xfc20('0xd')]=moment()[_0xfc20('0xe')](_0xfc20('0xf'));}if(_0x3e2683[_0xfc20('0x10')]){_0x3e2683[_0xfc20('0x11')]=moment()[_0xfc20('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c1615(null,_0x18db22);},'beforeUpdate':function(_0x62da75,_0x1bc994,_0x4c24eb){if(_0x62da75[_0xfc20('0x12')](_0xfc20('0xc'))){_0x62da75[_0xfc20('0xd')]=_0x62da75[_0xfc20('0xc')]?moment()[_0xfc20('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x62da75[_0xfc20('0x12')](_0xfc20('0x10'))){_0x62da75['closedAt']=moment()[_0xfc20('0xe')](_0xfc20('0xf'));_0x62da75['substatus']=null;_0x62da75[_0xfc20('0xd')]=null;}_0x4c24eb(null,_0x62da75);},'afterUpdate':function(_0x11e9bf,_0x1473ca,_0x49db61){var _0x58f906=_0xebcae5[_0xfc20('0x13')];var _0x1e6802=_0x11e9bf[_0xfc20('0x14')]({'plain':!![]});if(_0x1e6802[_0xfc20('0x10')]){return _0x58f906[_0xfc20('0x15')][_0xfc20('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1e6802['id']}})['then'](function(){_0x49db61();})['catch'](function(_0x7fbb31){_0x49db61(_0x7fbb31);});}else{_0x49db61();}}},'charset':_0xfc20('0x17'),'collate':_0xfc20('0x18')});}; \ No newline at end of file +var _0xa710=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','closed','YYYY-MM-DD\x20HH:mm:ss','changed','format','closedAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa710,0xb1));var _0x0a71=function(_0x4df777,_0x40ddd4){_0x4df777=_0x4df777-0x0;var _0x524c05=_0xa710[_0x4df777];return _0x524c05;};'use strict';var _=require(_0x0a71('0x0'));var util=require(_0x0a71('0x1'));var logger=require(_0x0a71('0x2'))(_0x0a71('0x3'));var moment=require('moment');var BPromise=require(_0x0a71('0x4'));var rp=require(_0x0a71('0x5'));var fs=require('fs');var path=require(_0x0a71('0x6'));var rimraf=require(_0x0a71('0x7'));var config=require(_0x0a71('0x8'));var attributes=require(_0x0a71('0x9'));module[_0x0a71('0xa')]=function(_0x2cf02b,_0x5acce4){return _0x2cf02b[_0x0a71('0xb')](_0x0a71('0xc'),attributes,{'tableName':_0x0a71('0xd'),'paranoid':![],'indexes':[{'name':_0x0a71('0xe'),'fields':[_0x0a71('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x513e6f,_0x31bf65,_0x5325cb){if(_0x513e6f[_0x0a71('0x10')]){_0x513e6f[_0x0a71('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x513e6f[_0x0a71('0x12')]){_0x513e6f['closedAt']=moment()['format'](_0x0a71('0x13'));}_0x5325cb(null,_0x31bf65);},'beforeUpdate':function(_0x2d1c67,_0x134f69,_0xc41a9f){if(_0x2d1c67[_0x0a71('0x14')](_0x0a71('0x10'))){_0x2d1c67[_0x0a71('0x11')]=_0x2d1c67[_0x0a71('0x10')]?moment()[_0x0a71('0x15')](_0x0a71('0x13')):null;}if(_0x2d1c67[_0x0a71('0x14')](_0x0a71('0x12'))){_0x2d1c67[_0x0a71('0x16')]=moment()[_0x0a71('0x15')](_0x0a71('0x13'));_0x2d1c67['substatus']=null;_0x2d1c67['substatusAt']=null;}_0xc41a9f(null,_0x2d1c67);},'afterUpdate':function(_0x4f2bbf,_0x15a2dc,_0x4d59bf){var _0x4d98b4=_0x2cf02b[_0x0a71('0x17')];var _0x52e34e=_0x4f2bbf[_0x0a71('0x18')]({'plain':!![]});if(_0x52e34e['closed']){return _0x4d98b4[_0x0a71('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x52e34e['id']}})[_0x0a71('0x1a')](function(){_0x4d59bf();})[_0x0a71('0x1b')](function(_0x59f915){_0x4d59bf(_0x59f915);});}else{_0x4d59bf();}}},'charset':_0x0a71('0x1c'),'collate':_0x0a71('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d354d4e..616fd98 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 _0xe79c=['defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','debug','catch','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3ca072,_0x96b71b){var _0x5c865f=function(_0x3889e5){while(--_0x3889e5){_0x3ca072['push'](_0x3ca072['shift']());}};_0x5c865f(++_0x96b71b);}(_0xe79c,0x9f));var _0xce79=function(_0x403f26,_0x422931){_0x403f26=_0x403f26-0x0;var _0x272b76=_0xe79c[_0x403f26];return _0x272b76;};'use strict';var _=require(_0xce79('0x0'));var util=require('util');var moment=require(_0xce79('0x1'));var BPromise=require(_0xce79('0x2'));var rs=require(_0xce79('0x3'));var fs=require('fs');var Redis=require(_0xce79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce79('0x5'));var logger=require(_0xce79('0x6'))(_0xce79('0x7'));var config=require(_0xce79('0x8'));var jayson=require(_0xce79('0x9'));var client=jayson[_0xce79('0xa')][_0xce79('0xb')]({'port':0x232a});config[_0xce79('0xc')]=_[_0xce79('0xd')](config[_0xce79('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xce79('0xe'))(new Redis(config[_0xce79('0xc')]));require(_0xce79('0xf'))[_0xce79('0x10')](socket);function respondWithRpcPromise(_0x4ef8e2,_0x3bfed5,_0x322e17){return new BPromise(function(_0x5d01cd,_0xf46cd){return client['request'](_0x4ef8e2,_0x322e17)[_0xce79('0x11')](function(_0x2b861e){logger[_0xce79('0x12')](_0xce79('0x13'),_0x3bfed5,'request\x20sent');logger['debug'](_0xce79('0x14'),_0x3bfed5,_0xce79('0x15'),JSON[_0xce79('0x16')](_0x2b861e));if(_0x2b861e[_0xce79('0x17')]){if(_0x2b861e[_0xce79('0x17')][_0xce79('0x18')]===0x1f4){logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);return _0xf46cd(_0x2b861e['error']['message']);}logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);return _0x5d01cd(_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);}else{logger[_0xce79('0x12')](_0xce79('0x13'),_0x3bfed5,_0xce79('0x15'));_0x5d01cd(_0x2b861e[_0xce79('0x1a')]['message']);}})['catch'](function(_0x300f14){logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x300f14);_0xf46cd(_0x300f14);});});}exports[_0xce79('0x1b')]=function(_0x1a1b02){var _0x5655af=this;return new Promise(function(_0x2aabe,_0x1f3988){return db[_0xce79('0x1c')][_0xce79('0x1d')](_0x1a1b02[_0xce79('0x1e')],{'raw':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1b02[_0xce79('0x1f')]?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x21')]||null:null,'attributes':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')]['attributes']||null:null,'limit':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x22')]||null:null})['then'](function(_0x4021d2){logger[_0xce79('0x12')]('UpdateMailInteraction',_0x1a1b02);logger[_0xce79('0x23')]('UpdateMailInteraction',_0x1a1b02,JSON[_0xce79('0x16')](_0x4021d2));_0x2aabe(_0x4021d2);})[_0xce79('0x24')](function(_0x43221a){logger[_0xce79('0x17')](_0xce79('0x1b'),_0x43221a[_0xce79('0x19')],_0x1a1b02);_0x1f3988(_0x5655af[_0xce79('0x17')](0x1f4,_0x43221a[_0xce79('0x19')]));});});};exports[_0xce79('0x25')]=function(_0x56db56){return new Promise(function(_0x16cc20,_0x41bee7){return db[_0xce79('0x1c')][_0xce79('0x26')]({'where':_0x56db56[_0xce79('0x1f')]?_0x56db56[_0xce79('0x1f')][_0xce79('0x21')]||null:null})[_0xce79('0x11')](function(_0x21d3cc){if(_0x21d3cc){return _0x21d3cc[_0xce79('0x27')](_0x56db56[_0xce79('0x1e')][_0xce79('0x28')],_[_0xce79('0x29')](_0x56db56[_0xce79('0x1e')],[_0xce79('0x28'),'id'])||{});}})['spread'](function(_0x498dc8){logger[_0xce79('0x12')]('AddTags',_0x56db56);logger[_0xce79('0x23')]('AddTags',_0x56db56,JSON['stringify'](_0x498dc8));_0x16cc20(_0x498dc8);})[_0xce79('0x24')](function(_0x592a72){logger[_0xce79('0x17')](_0xce79('0x2a'),_0x592a72[_0xce79('0x19')],_0x56db56);_0x41bee7(_this[_0xce79('0x17')](0x1f4,_0x592a72['message']));});});}; \ No newline at end of file +var _0xf360=['defaults','socket.io-emitter','register','request','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','MailInteraction,\x20%s,\x20%s','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x2badec,_0x6fb750){var _0x17e25a=function(_0x366fdc){while(--_0x366fdc){_0x2badec['push'](_0x2badec['shift']());}};_0x17e25a(++_0x6fb750);}(_0xf360,0x13c));var _0x0f36=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf360[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0f36('0x0'));var util=require('util');var moment=require(_0x0f36('0x1'));var BPromise=require(_0x0f36('0x2'));var rs=require(_0x0f36('0x3'));var fs=require('fs');var Redis=require(_0x0f36('0x4'));var db=require(_0x0f36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f36('0x6'))(_0x0f36('0x7'));var config=require(_0x0f36('0x8'));var jayson=require(_0x0f36('0x9'));var client=jayson['client'][_0x0f36('0xa')]({'port':0x232a});config[_0x0f36('0xb')]=_[_0x0f36('0xc')](config[_0x0f36('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f36('0xd'))(new Redis(config[_0x0f36('0xb')]));require('./mailInteraction.socket')[_0x0f36('0xe')](socket);function respondWithRpcPromise(_0x2ab6c3,_0x198855,_0x42ddf1){return new BPromise(function(_0x5cd1ad,_0x41aac7){return client[_0x0f36('0xf')](_0x2ab6c3,_0x42ddf1)[_0x0f36('0x10')](function(_0x4330c3){logger['info']('MailInteraction,\x20%s,\x20%s',_0x198855,_0x0f36('0x11'));logger[_0x0f36('0x12')](_0x0f36('0x13'),_0x198855,_0x0f36('0x11'),JSON['stringify'](_0x4330c3));if(_0x4330c3[_0x0f36('0x14')]){if(_0x4330c3['error']['code']===0x1f4){logger[_0x0f36('0x14')]('MailInteraction,\x20%s,\x20%s',_0x198855,_0x4330c3[_0x0f36('0x14')][_0x0f36('0x15')]);return _0x41aac7(_0x4330c3[_0x0f36('0x14')][_0x0f36('0x15')]);}logger[_0x0f36('0x14')](_0x0f36('0x16'),_0x198855,_0x4330c3['error'][_0x0f36('0x15')]);return _0x5cd1ad(_0x4330c3['error'][_0x0f36('0x15')]);}else{logger[_0x0f36('0x17')](_0x0f36('0x16'),_0x198855,_0x0f36('0x11'));_0x5cd1ad(_0x4330c3[_0x0f36('0x18')][_0x0f36('0x15')]);}})[_0x0f36('0x19')](function(_0x517122){logger['error'](_0x0f36('0x16'),_0x198855,_0x517122);_0x41aac7(_0x517122);});});}exports[_0x0f36('0x1a')]=function(_0x1d5ea7){var _0x15c9fc=this;return new Promise(function(_0x276da8,_0x507541){return db[_0x0f36('0x1b')][_0x0f36('0x1c')](_0x1d5ea7[_0x0f36('0x1d')],{'raw':_0x1d5ea7[_0x0f36('0x1e')]?_0x1d5ea7[_0x0f36('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d5ea7[_0x0f36('0x1e')]?_0x1d5ea7[_0x0f36('0x1e')][_0x0f36('0x1f')]||null:null,'attributes':_0x1d5ea7[_0x0f36('0x1e')]?_0x1d5ea7['options'][_0x0f36('0x20')]||null:null,'limit':_0x1d5ea7[_0x0f36('0x1e')]?_0x1d5ea7[_0x0f36('0x1e')][_0x0f36('0x21')]||null:null})[_0x0f36('0x10')](function(_0x172498){logger['info'](_0x0f36('0x1a'),_0x1d5ea7);logger[_0x0f36('0x12')](_0x0f36('0x1a'),_0x1d5ea7,JSON[_0x0f36('0x22')](_0x172498));_0x276da8(_0x172498);})[_0x0f36('0x19')](function(_0x374c27){logger[_0x0f36('0x14')]('UpdateMailInteraction',_0x374c27[_0x0f36('0x15')],_0x1d5ea7);_0x507541(_0x15c9fc[_0x0f36('0x14')](0x1f4,_0x374c27['message']));});});};exports[_0x0f36('0x23')]=function(_0xa2873e){return new Promise(function(_0x17dc73,_0x137568){return db[_0x0f36('0x1b')][_0x0f36('0x24')]({'where':_0xa2873e[_0x0f36('0x1e')]?_0xa2873e[_0x0f36('0x1e')]['where']||null:null})[_0x0f36('0x10')](function(_0x5622c7){if(_0x5622c7){return _0x5622c7[_0x0f36('0x25')](_0xa2873e['body']['ids'],_['omit'](_0xa2873e[_0x0f36('0x1d')],[_0x0f36('0x26'),'id'])||{});}})[_0x0f36('0x27')](function(_0x38c8c5){logger[_0x0f36('0x17')](_0x0f36('0x28'),_0xa2873e);logger[_0x0f36('0x12')]('AddTags',_0xa2873e,JSON[_0x0f36('0x22')](_0x38c8c5));_0x17dc73(_0x38c8c5);})[_0x0f36('0x19')](function(_0x422652){logger['error']('AddTags',_0x422652[_0x0f36('0x15')],_0xa2873e);_0x137568(_this[_0x0f36('0x14')](0x1f4,_0x422652[_0x0f36('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1f03ed6..f85db61 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 _0x2eea=['register','save','update','emit','removeListener'];(function(_0x41e5ee,_0x5433fd){var _0x4c9c7b=function(_0x347c78){while(--_0x347c78){_0x41e5ee['push'](_0x41e5ee['shift']());}};_0x4c9c7b(++_0x5433fd);}(_0x2eea,0x65));var _0xa2ee=function(_0x35c935,_0x56c834){_0x35c935=_0x35c935-0x0;var _0x1f91b5=_0x2eea[_0x35c935];return _0x1f91b5;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa2ee('0x0'),'remove',_0xa2ee('0x1')];function createListener(_0x379a12,_0x415975){return function(_0x3e34ed){_0x415975[_0xa2ee('0x2')](_0x379a12,_0x3e34ed);};}function removeListener(_0x5a73ba,_0x206458){return function(){MailInteractionEvents[_0xa2ee('0x3')](_0x5a73ba,_0x206458);};}exports[_0xa2ee('0x4')]=function(_0x417e5c){for(var _0x5bdafd=0x0,_0x32687c=events['length'];_0x5bdafd<_0x32687c;_0x5bdafd++){var _0x199674=events[_0x5bdafd];var _0x5785b4=createListener('mailInteraction:'+_0x199674,_0x417e5c);MailInteractionEvents['on'](_0x199674,_0x5785b4);}}; \ No newline at end of file +var _0xf895=['removeListener','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf895,0x16b));var _0x5f89=function(_0x3c302a,_0x4e3573){_0x3c302a=_0x3c302a-0x0;var _0x21db99=_0xf895[_0x3c302a];return _0x21db99;};'use strict';var MailInteractionEvents=require(_0x5f89('0x0'));var events=['save',_0x5f89('0x1'),_0x5f89('0x2')];function createListener(_0x502406,_0x3fa1fe){return function(_0x1ba020){_0x3fa1fe['emit'](_0x502406,_0x1ba020);};}function removeListener(_0x5cea64,_0xfa85aa){return function(){MailInteractionEvents[_0x5f89('0x3')](_0x5cea64,_0xfa85aa);};}exports['register']=function(_0x5584c3){for(var _0x1199b3=0x0,_0x59383f=events[_0x5f89('0x4')];_0x1199b3<_0x59383f;_0x1199b3++){var _0x112beb=events[_0x1199b3];var _0x555e30=createListener(_0x5f89('0x5')+_0x112beb,_0x5584c3);MailInteractionEvents['on'](_0x112beb,_0x555e30);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 2fc44ba..1541728 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46fa=['../../components/auth/service','./mailInteractionHasTag.controller','get','isAuthenticated','describe','exports','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x46fa,0x76));var _0xa46f=function(_0x505553,_0x401309){_0x505553=_0x505553-0x0;var _0x350ab4=_0x46fa[_0x505553];return _0x350ab4;};'use strict';var express=require(_0xa46f('0x0'));var router=express['Router']();var auth=require(_0xa46f('0x1'));var controller=require(_0xa46f('0x2'));router[_0xa46f('0x3')]('/describe',auth[_0xa46f('0x4')](),controller[_0xa46f('0x5')]);module[_0xa46f('0x6')]=router; \ No newline at end of file +var _0xc50f=['./mailInteractionHasTag.controller','/describe','exports','express','Router','../../components/auth/service'];(function(_0x4a5f75,_0x5d8aa3){var _0x5f3604=function(_0x8e6c46){while(--_0x8e6c46){_0x4a5f75['push'](_0x4a5f75['shift']());}};_0x5f3604(++_0x5d8aa3);}(_0xc50f,0x153));var _0xfc50=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc50f[_0xa464c9];return _0x3d73c4;};'use strict';var express=require(_0xfc50('0x0'));var router=express[_0xfc50('0x1')]();var auth=require(_0xfc50('0x2'));var controller=require(_0xfc50('0x3'));router['get'](_0xfc50('0x4'),auth['isAuthenticated'](),controller['describe']);module[_0xfc50('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 0d81324..f4460df 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x246bda,_0x2ccab5){var _0x26733b=function(_0x5ab50a){while(--_0x5ab50a){_0x246bda['push'](_0x246bda['shift']());}};_0x26733b(++_0x2ccab5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1da98a,_0x18e552){var _0x5217cb=function(_0x38dcc0){while(--_0x38dcc0){_0x1da98a['push'](_0x1da98a['shift']());}};_0x5217cb(++_0x18e552);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index b31bd07..847efe1 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5740=['INTEGER','sequelize','exports'];(function(_0x5a47de,_0x57a87c){var _0x400ee6=function(_0x46745b){while(--_0x46745b){_0x5a47de['push'](_0x5a47de['shift']());}};_0x400ee6(++_0x57a87c);}(_0x5740,0x19c));var _0x0574=function(_0x4e260b,_0x2ab7f5){_0x4e260b=_0x4e260b-0x0;var _0x284872=_0x5740[_0x4e260b];return _0x284872;};'use strict';var Sequelize=require(_0x0574('0x0'));module[_0x0574('0x1')]={'MailInteractionId':{'type':Sequelize[_0x0574('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x0574('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xa33b=['exports','INTEGER','sequelize'];(function(_0x1a3bd2,_0x344d4a){var _0x4222e6=function(_0x4a20c8){while(--_0x4a20c8){_0x1a3bd2['push'](_0x1a3bd2['shift']());}};_0x4222e6(++_0x344d4a);}(_0xa33b,0x10d));var _0xba33=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa33b[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xba33('0x0'));module[_0xba33('0x1')]={'MailInteractionId':{'type':Sequelize[_0xba33('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xba33('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index ac3ddc2..c36138d 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x192a=['define','./mailInteractionHasTag'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0x192a,0x185));var _0xa192=function(_0x20addf,_0xe16447){_0x20addf=_0x20addf-0x0;var _0x26e9d6=_0x192a[_0x20addf];return _0x26e9d6;};'use strict';var attributes=require(_0xa192('0x0'));module['exports']=function(_0x57477e){return _0x57477e[_0xa192('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b62=['mail_interaction_has_tags','./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x54bdf9,_0x1d58a5){var _0x447729=function(_0x378d07){while(--_0x378d07){_0x54bdf9['push'](_0x54bdf9['shift']());}};_0x447729(++_0x1d58a5);}(_0x8b62,0x1dd));var _0x28b6=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x8b62[_0x3e0b8f];return _0x22f742;};'use strict';var attributes=require(_0x28b6('0x0'));module[_0x28b6('0x1')]=function(_0x23a87c){return _0x23a87c['define'](_0x28b6('0x2'),attributes,{'tableName':_0x28b6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bb4e4a9..7f7ca48 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 _0x7e6b=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','/:id/accept','/:id/reject','reject','destroy','path'];(function(_0x328b61,_0x3c35c2){var _0x1cc1d1=function(_0x3a9623){while(--_0x3a9623){_0x328b61['push'](_0x328b61['shift']());}};_0x1cc1d1(++_0x3c35c2);}(_0x7e6b,0x186));var _0xb7e6=function(_0x160fe3,_0xbb7fdd){_0x160fe3=_0x160fe3-0x0;var _0x598b13=_0x7e6b[_0x160fe3];return _0x598b13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb7e6('0x0'));var timeout=require(_0xb7e6('0x1'));var express=require('express');var router=express[_0xb7e6('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb7e6('0x3'));var config=require(_0xb7e6('0x4'));var controller=require(_0xb7e6('0x5'));router[_0xb7e6('0x6')]('/',auth[_0xb7e6('0x7')](),controller['index']);router['get'](_0xb7e6('0x8'),auth[_0xb7e6('0x7')](),controller[_0xb7e6('0x9')]);router[_0xb7e6('0x6')](_0xb7e6('0xa'),auth['isAuthenticated'](),controller[_0xb7e6('0xb')]);router[_0xb7e6('0x6')](_0xb7e6('0xc'),auth['isAuthenticated'](),controller[_0xb7e6('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xb7e6('0xe')](_0xb7e6('0xf'),_0xb7e6('0x10')),controller[_0xb7e6('0x11')]);router[_0xb7e6('0x12')](_0xb7e6('0xa'),auth['isAuthenticated'](),controller['update']);router['put'](_0xb7e6('0x13'),auth[_0xb7e6('0x7')](),controller['accept']);router['put'](_0xb7e6('0x14'),auth[_0xb7e6('0x7')](),controller[_0xb7e6('0x15')]);router['delete'](_0xb7e6('0xa'),auth[_0xb7e6('0x7')](),controller[_0xb7e6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2843=['isAuthenticated','index','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get'];(function(_0x305c85,_0xa213c7){var _0x1f1fd7=function(_0x5d00f2){while(--_0x5d00f2){_0x305c85['push'](_0x305c85['shift']());}};_0x1f1fd7(++_0xa213c7);}(_0x2843,0x6a));var _0x3284=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x2843[_0x595bd1];return _0xd0344f;};'use strict';var multer=require(_0x3284('0x0'));var util=require(_0x3284('0x1'));var path=require(_0x3284('0x2'));var timeout=require(_0x3284('0x3'));var express=require(_0x3284('0x4'));var router=express[_0x3284('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3284('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3284('0x7'));var controller=require(_0x3284('0x8'));router[_0x3284('0x9')]('/',auth[_0x3284('0xa')](),controller[_0x3284('0xb')]);router[_0x3284('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3284('0xc')]);router['get'](_0x3284('0xd'),auth[_0x3284('0xa')](),controller['show']);router['get'](_0x3284('0xe'),auth[_0x3284('0xa')](),controller[_0x3284('0xf')]);router[_0x3284('0x10')]('/',auth[_0x3284('0xa')](),interaction[_0x3284('0x11')](_0x3284('0x12'),_0x3284('0x13')),controller[_0x3284('0x14')]);router['put'](_0x3284('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3284('0x15')](_0x3284('0x16'),auth[_0x3284('0xa')](),controller[_0x3284('0x17')]);router[_0x3284('0x15')](_0x3284('0x18'),auth[_0x3284('0xa')](),controller[_0x3284('0x19')]);router[_0x3284('0x1a')](_0x3284('0xd'),auth['isAuthenticated'](),controller[_0x3284('0x1b')]);module[_0x3284('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 08fb141..b028285 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 _0xcf39=['Email','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcf39,0xd2));var _0x9cf3=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xcf39[_0x3712e2];return _0x1faff4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9cf3('0x0'));module[_0x9cf3('0x1')]={'body':{'type':Sequelize[_0x9cf3('0x2')](_0x9cf3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9cf3('0x2')]('medium')},'read':{'type':Sequelize[_0x9cf3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9cf3('0x5')]('in',_0x9cf3('0x6')),'defaultValue':_0x9cf3('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9cf3('0x7')](0x1fe)},'from':{'type':Sequelize[_0x9cf3('0x7')]},'to':{'type':Sequelize['TEXT'](_0x9cf3('0x3'))},'cc':{'type':Sequelize[_0x9cf3('0x2')](_0x9cf3('0x3'))},'bcc':{'type':Sequelize[_0x9cf3('0x2')](_0x9cf3('0x3'))},'subject':{'type':Sequelize[_0x9cf3('0x2')]},'sentAt':{'type':Sequelize[_0x9cf3('0x8')]},'attach':{'type':Sequelize[_0x9cf3('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9cf3('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9cf3('0x8')]},'originTo':{'type':Sequelize[_0x9cf3('0x2')](_0x9cf3('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x9cf3('0x3'))},'originChannel':{'type':Sequelize[_0x9cf3('0x5')]('Email','Chat'),'defaultValue':_0x9cf3('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x6a8e=['DATE','Email','Chat','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x45b1a8,_0x4e2752){var _0x53d0e7=function(_0x43277c){while(--_0x43277c){_0x45b1a8['push'](_0x45b1a8['shift']());}};_0x53d0e7(++_0x4e2752);}(_0x6a8e,0x93));var _0xe6a8=function(_0x5e4d64,_0x4c641b){_0x5e4d64=_0x5e4d64-0x0;var _0x239a93=_0x6a8e[_0x5e4d64];return _0x239a93;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe6a8('0x0'));module[_0xe6a8('0x1')]={'body':{'type':Sequelize[_0xe6a8('0x2')](_0xe6a8('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe6a8('0x2')](_0xe6a8('0x4'))},'read':{'type':Sequelize[_0xe6a8('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe6a8('0x6')]('in',_0xe6a8('0x7')),'defaultValue':_0xe6a8('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe6a8('0x8')](0x1fe)},'from':{'type':Sequelize[_0xe6a8('0x8')]},'to':{'type':Sequelize[_0xe6a8('0x2')]('long')},'cc':{'type':Sequelize[_0xe6a8('0x2')](_0xe6a8('0x3'))},'bcc':{'type':Sequelize[_0xe6a8('0x2')](_0xe6a8('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xe6a8('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe6a8('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe6a8('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xe6a8('0x3'))},'originCc':{'type':Sequelize[_0xe6a8('0x2')](_0xe6a8('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xe6a8('0xa'),_0xe6a8('0xb')),'defaultValue':_0xe6a8('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e174f85..22cb1d2 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 _0x6271=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','body','params','describe','create','direction','out','split','CmList','List','CmContact','Contacts','DESC','Smtp','CloudProvider','attachments','root','server/files/attachments','defaults','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','UserId','user','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','event','fromString','EventManager','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','html-entities','./mailMessage.socket','register','client','http','request','request\x20sent','error','code','MailMessage,\x20%s,\x20%s','message','undefined','limit','count','set','Content-Range','json','update','then','destroy','status','end','sendStatus','send','index','map','MailMessage'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x6271,0x68));var _0x1627=function(_0x275aa8,_0x2f848c){_0x275aa8=_0x275aa8-0x0;var _0x3af8ff=_0x6271[_0x275aa8];return _0x3af8ff;};'use strict';var emlformat=require('eml-format');var moment=require(_0x1627('0x0'));var util=require(_0x1627('0x1'));var path=require(_0x1627('0x2'));var fs=require('fs');var _=require(_0x1627('0x3'));var Redis=require(_0x1627('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0x1627('0x5'));var qs=require(_0x1627('0x6'));var logger=require(_0x1627('0x7'))('api');var interaction_log=require('../../config/logger')(_0x1627('0x8'));var config=require(_0x1627('0x9'));var db=require(_0x1627('0xa'))['db'];config[_0x1627('0xb')]=_['defaults'](config[_0x1627('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x1627('0xc'));require(_0x1627('0xd'))[_0x1627('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1627('0xf')][_0x1627('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x1627('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x1627('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2d3286,_0x46f68d,_0x4b9a27,_0x198166){return new Promise(function(_0x496e00,_0x5cf610){var _0x3e177c=_0x198166||client;return _0x3e177c[_0x1627('0x11')](_0x2d3286,_0x4b9a27)['then'](function(_0x3c82dc){logger['info']('MailMessage,\x20%s,\x20%s',_0x46f68d,_0x1627('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x46f68d,_0x1627('0x12'),JSON['stringify'](_0x3c82dc));if(_0x3c82dc[_0x1627('0x13')]){if(_0x3c82dc[_0x1627('0x13')][_0x1627('0x14')]===0x1f4){logger[_0x1627('0x13')](_0x1627('0x15'),_0x46f68d,_0x3c82dc['error'][_0x1627('0x16')]);return _0x5cf610(_0x3c82dc['error'][_0x1627('0x16')]);}logger['error'](_0x1627('0x15'),_0x46f68d,_0x3c82dc[_0x1627('0x13')][_0x1627('0x16')]);return _0x496e00(_0x3c82dc[_0x1627('0x13')][_0x1627('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x46f68d,'request\x20sent');_0x496e00(_0x3c82dc['result'][_0x1627('0x16')]);}})['catch'](function(_0x4228dc){logger[_0x1627('0x13')](_0x1627('0x15'),_0x46f68d,_0x4228dc);_0x5cf610(_0x4228dc);});});}function respondWithResult(_0x10bbf9,_0x1516e0){_0x1516e0=_0x1516e0||0xc8;return function(_0x540095){if(_0x540095){return _0x10bbf9['status'](_0x1516e0)['json'](_0x540095);}};}function respondWithFilteredResult(_0x3a969e,_0x589c48){return function(_0x21cabd){if(_0x21cabd){var _0x19be67=typeof _0x589c48['offset']===_0x1627('0x17')&&typeof _0x589c48[_0x1627('0x18')]===_0x1627('0x17');var _0x4c3f38=_0x21cabd[_0x1627('0x19')];var _0x17dd3b=_0x19be67?0x0:_0x589c48['offset'];var _0xc2ce19=_0x19be67?_0x21cabd[_0x1627('0x19')]:_0x589c48['offset']+_0x589c48[_0x1627('0x18')];var _0x193ec6;if(_0xc2ce19>=_0x4c3f38){_0xc2ce19=_0x4c3f38;_0x193ec6=0xc8;}else{_0x193ec6=0xce;}_0x3a969e['status'](_0x193ec6);return _0x3a969e[_0x1627('0x1a')](_0x1627('0x1b'),_0x17dd3b+'-'+_0xc2ce19+'/'+_0x4c3f38)[_0x1627('0x1c')](_0x21cabd);}return null;};}function saveUpdates(_0x3a279d){return function(_0x16aa35){if(_0x16aa35){return _0x16aa35[_0x1627('0x1d')](_0x3a279d)[_0x1627('0x1e')](function(_0x5a3cfe){return _0x5a3cfe;});}return null;};}function removeEntity(_0x27ea15){return function(_0x63fad){if(_0x63fad){return _0x63fad[_0x1627('0x1f')]()[_0x1627('0x1e')](function(){_0x27ea15[_0x1627('0x20')](0xcc)[_0x1627('0x21')]();});}};}function handleEntityNotFound(_0x3a4396){return function(_0x2fa876){if(!_0x2fa876){_0x3a4396[_0x1627('0x22')](0x194);}return _0x2fa876;};}function handleError(_0x4e456a,_0x31aa30){_0x31aa30=_0x31aa30||0x1f4;return function(_0x4bfa3e){logger[_0x1627('0x13')](_0x4bfa3e['stack']);if(_0x4bfa3e['name']){delete _0x4bfa3e['name'];}_0x4e456a['status'](_0x31aa30)[_0x1627('0x23')](_0x4bfa3e);};}exports[_0x1627('0x24')]=function(_0x1f02ff,_0x3ab529){var _0x597412={},_0x2a8932={},_0x8a435e={'count':0x0,'rows':[]};var _0x22d777=_[_0x1627('0x25')](db[_0x1627('0x26')][_0x1627('0x27')],function(_0x5a1984){return{'name':_0x5a1984[_0x1627('0x28')],'type':_0x5a1984[_0x1627('0x29')]['key']};});_0x2a8932[_0x1627('0x2a')]=_[_0x1627('0x25')](_0x22d777,'name');_0x2a8932[_0x1627('0x2b')]=_[_0x1627('0x2c')](_0x1f02ff[_0x1627('0x2b')]);_0x2a8932[_0x1627('0x2d')]=_[_0x1627('0x2e')](_0x2a8932[_0x1627('0x2a')],_0x2a8932[_0x1627('0x2b')]);_0x597412[_0x1627('0x2f')]=_[_0x1627('0x2e')](_0x2a8932[_0x1627('0x2a')],qs[_0x1627('0x30')](_0x1f02ff[_0x1627('0x2b')][_0x1627('0x30')]));_0x597412[_0x1627('0x2f')]=_0x597412[_0x1627('0x2f')][_0x1627('0x31')]?_0x597412['attributes']:_0x2a8932[_0x1627('0x2a')];if(!_0x1f02ff[_0x1627('0x2b')]['hasOwnProperty'](_0x1627('0x32'))){_0x597412[_0x1627('0x18')]=qs[_0x1627('0x18')](_0x1f02ff[_0x1627('0x2b')][_0x1627('0x18')]);_0x597412['offset']=qs['offset'](_0x1f02ff[_0x1627('0x2b')][_0x1627('0x33')]);}_0x597412[_0x1627('0x34')]=qs['sort'](_0x1f02ff[_0x1627('0x2b')][_0x1627('0x35')]);_0x597412[_0x1627('0x36')]=qs[_0x1627('0x2d')](_[_0x1627('0x37')](_0x1f02ff[_0x1627('0x2b')],_0x2a8932[_0x1627('0x2d')]),_0x22d777);if(_0x1f02ff[_0x1627('0x2b')][_0x1627('0x38')]){_0x597412['where']=_[_0x1627('0x39')](_0x597412['where'],{'$or':_[_0x1627('0x25')](_0x22d777,function(_0x118a3e){if(_0x118a3e[_0x1627('0x29')]!=='VIRTUAL'){var _0x265d57={};_0x265d57[_0x118a3e[_0x1627('0x3a')]]={'$like':'%'+_0x1f02ff[_0x1627('0x2b')][_0x1627('0x38')]+'%'};return _0x265d57;}})});}_0x597412=_[_0x1627('0x39')]({},_0x597412,_0x1f02ff[_0x1627('0x3b')]);var _0x152c1f={'where':_0x597412[_0x1627('0x36')]};return db[_0x1627('0x26')]['count'](_0x152c1f)[_0x1627('0x1e')](function(_0x4e32ff){_0x8a435e[_0x1627('0x19')]=_0x4e32ff;if(_0x1f02ff[_0x1627('0x2b')]['includeAll']){_0x597412['include']=[{'all':!![]}];}return db[_0x1627('0x26')][_0x1627('0x3c')](_0x597412);})[_0x1627('0x1e')](function(_0x14c4e4){_0x8a435e[_0x1627('0x3d')]=_0x14c4e4;return _0x8a435e;})[_0x1627('0x1e')](respondWithFilteredResult(_0x3ab529,_0x597412))[_0x1627('0x3e')](handleError(_0x3ab529,null));};exports[_0x1627('0x3f')]=function(_0x46f97a,_0x243f50){var _0x4189c1={'raw':!![],'where':{'id':_0x46f97a['params']['id']}},_0x5cb142={};_0x5cb142[_0x1627('0x2a')]=_[_0x1627('0x2c')](db[_0x1627('0x26')][_0x1627('0x27')]);_0x5cb142[_0x1627('0x2b')]=_[_0x1627('0x2c')](_0x46f97a[_0x1627('0x2b')]);_0x5cb142['filters']=_[_0x1627('0x2e')](_0x5cb142['model'],_0x5cb142[_0x1627('0x2b')]);_0x4189c1['attributes']=_[_0x1627('0x2e')](_0x5cb142['model'],qs[_0x1627('0x30')](_0x46f97a[_0x1627('0x2b')]['fields']));_0x4189c1[_0x1627('0x2f')]=_0x4189c1[_0x1627('0x2f')]['length']?_0x4189c1['attributes']:_0x5cb142['model'];if(_0x46f97a[_0x1627('0x2b')][_0x1627('0x40')]){_0x4189c1[_0x1627('0x41')]=[{'all':!![]}];}_0x4189c1=_[_0x1627('0x39')]({},_0x4189c1,_0x46f97a['options']);return db['MailMessage'][_0x1627('0x42')](_0x4189c1)[_0x1627('0x1e')](handleEntityNotFound(_0x243f50,null))[_0x1627('0x1e')](respondWithResult(_0x243f50,null))[_0x1627('0x3e')](handleError(_0x243f50,null));};exports[_0x1627('0x1d')]=function(_0x4bc324,_0x435616){if(_0x4bc324['body']['id']){delete _0x4bc324[_0x1627('0x43')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4bc324[_0x1627('0x44')]['id']}})['then'](handleEntityNotFound(_0x435616,null))[_0x1627('0x1e')](saveUpdates(_0x4bc324[_0x1627('0x43')],null))[_0x1627('0x1e')](respondWithResult(_0x435616,null))[_0x1627('0x3e')](handleError(_0x435616,null));};exports['destroy']=function(_0x233e86,_0x5c7568){return db['MailMessage'][_0x1627('0x42')]({'where':{'id':_0x233e86[_0x1627('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c7568,null))[_0x1627('0x1e')](removeEntity(_0x5c7568,null))[_0x1627('0x3e')](handleError(_0x5c7568,null));};exports[_0x1627('0x45')]=function(_0x2117f5,_0x5d9ab9){return db[_0x1627('0x26')][_0x1627('0x45')]()['then'](respondWithResult(_0x5d9ab9,null))['catch'](handleError(_0x5d9ab9,null));};exports[_0x1627('0x46')]=function(_0x4f08cb,_0x28cf59){return db[_0x1627('0x26')][_0x1627('0x46')](_0x4f08cb[_0x1627('0x43')])['then'](function(_0x4f4af3){if(_0x4f4af3){if(_0x4f4af3[_0x1627('0x47')]===_0x1627('0x48')&&!_0x4f4af3['secret']){var _0x39eb38,_0x4d8e56,_0x3e20d8;if(_0x4f08cb[_0x1627('0x43')]['to']){_0x4d8e56=_0x4f08cb[_0x1627('0x43')]['to'][_0x1627('0x49')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x4f4af3['MailAccountId']},'include':[{'model':db[_0x1627('0x4a')],'as':_0x1627('0x4b'),'include':[{'model':db[_0x1627('0x4c')],'as':_0x1627('0x4d'),'where':{'email':_0x4d8e56},'limit':0x1,'order':[['updatedAt',_0x1627('0x4e')]]}]},{'model':db['MailServerOut'],'as':_0x1627('0x4f'),'raw':!![],'include':[{'model':db[_0x1627('0x50')],'as':_0x1627('0x50'),'raw':!![]}]}]})[_0x1627('0x1e')](function(_0x1274bb){_0x39eb38=_0x1274bb;if(!_0x39eb38||!_0x39eb38[_0x1627('0x4f')])return;var _0x35c426=_0x39eb38['getSmtpOptions']();if(_0x4f08cb[_0x1627('0x43')]['attachments']&&_0x4f08cb[_0x1627('0x43')][_0x1627('0x51')]['length']){for(var _0x310051=0x0;_0x310051<_0x4f08cb[_0x1627('0x43')][_0x1627('0x51')]['length'];_0x310051+=0x1){_0x4f08cb[_0x1627('0x43')][_0x1627('0x51')][_0x310051]={'filename':_0x4f08cb['body']['attachments'][_0x310051][_0x1627('0x3a')],'path':path['join'](config[_0x1627('0x52')],_0x1627('0x53'),_0x4f08cb['body']['attachments'][_0x310051]['basename'])};}}_0x3e20d8={'account':_0x35c426,'message':_0x4f08cb['body']};return;})['then'](function(){if(_0x39eb38['List']){if(_0x39eb38[_0x1627('0x4b')][_0x1627('0x4d')][_0x1627('0x31')]){return _0x39eb38[_0x1627('0x4b')]['Contacts'][0x0];}else{return db[_0x1627('0x4c')][_0x1627('0x46')](_[_0x1627('0x54')](_0x4f08cb[_0x1627('0x43')],{'firstName':_0x4f08cb[_0x1627('0x43')]['to'],'email':_0x4f08cb[_0x1627('0x43')]['to'],'phone':_0x4f08cb['body']['to'],'ListId':_0x39eb38[_0x1627('0x55')]}));}}else{throw new Error(_0x1627('0x56'));}})[_0x1627('0x1e')](function(){if(_0x3e20d8){return respondWithRpcPromise(_0x1627('0x57'),'sendMail',_0x3e20d8,client9003)[_0x1627('0x1e')](function(_0x39ab2b){return _0x4f4af3[_0x1627('0x1d')]({'read':!![],'messageId':_0x39ab2b[_0x1627('0x58')],'sentAt':moment()[_0x1627('0x59')](_0x1627('0x5a'))});})[_0x1627('0x3e')](function(_0x54f94e){logger['error']('%s',JSON[_0x1627('0x5b')](_0x54f94e));return _0x4f4af3;});}return _0x4f4af3;});}return _0x4f4af3;}})[_0x1627('0x1e')](respondWithResult(_0x28cf59,0xc9))[_0x1627('0x3e')](handleError(_0x28cf59,null));};exports[_0x1627('0x5c')]=function(_0x3794e0,_0x4bca8b){var _0x1a0367=_0x1627('0x5d');return interactionService[_0x1627('0x5e')](_0x3794e0,_0x1a0367)[_0x1627('0x1e')](respondWithResult(_0x4bca8b,null))[_0x1627('0x3e')](handleError(_0x4bca8b,null));};exports['reject']=function(_0x58fe04,_0xed7d02){var _0x6f184a={'agent':{},'channel':_0x1627('0x5d')};if(_0x58fe04[_0x1627('0x43')]['id']){delete _0x58fe04[_0x1627('0x43')]['id'];}_0x58fe04['body'][_0x1627('0x5f')]=_0x58fe04[_0x1627('0x43')][_0x1627('0x5f')]||_0x58fe04[_0x1627('0x60')]['id'];_0x6f184a[_0x1627('0x61')]['id']=_0x58fe04[_0x1627('0x43')][_0x1627('0x5f')];return db[_0x1627('0x26')][_0x1627('0x42')]({'where':{'id':_0x58fe04[_0x1627('0x44')]['id'],'UserId':null}})[_0x1627('0x1e')](handleEntityNotFound(_0xed7d02,null))[_0x1627('0x1e')](function(_0x3b4150){if(_0x3b4150){_0x6f184a['message']=_0x3b4150[_0x1627('0x62')]({'plain':!![]});return db[_0x1627('0x63')][_0x1627('0x42')]({'where':{'id':_0x3b4150[_0x1627('0x64')]}});}return null;})[_0x1627('0x1e')](handleEntityNotFound(_0xed7d02,null))[_0x1627('0x1e')](function(_0x12d2e2){if(_0x12d2e2){_0x6f184a[_0x1627('0x65')]=_0x12d2e2[_0x1627('0x62')]({'plain':!![]});interaction_log['info'](_0x1627('0x66'),_0x58fe04['user']['id'],_0x58fe04['user'][_0x1627('0x3a')],_0x58fe04[_0x1627('0x60')][_0x1627('0x67')],_0x6f184a['interaction']['id'],_0x58fe04[_0x1627('0x43')]?JSON[_0x1627('0x5b')](_0x58fe04[_0x1627('0x43')]):'null');return respondWithRpcPromise('RejectMessage',_0x1627('0x68'),_0x6f184a);}return null;})['then'](function(_0x3b5d03){var _0x2ed79b=_0x1627('0x69')+_0x3b5d03[_0x1627('0x16')][_0x1627('0x6a')];return db['sequelize'][_0x1627('0x2b')](_0x2ed79b,{'type':db[_0x1627('0x6b')][_0x1627('0x6c')][_0x1627('0x6d')],'raw':!![]})['then'](function(_0x33dcad){return _0x33dcad;});})['then'](function(_0x2c286f){if(_0x2c286f){_0x6f184a[_0x1627('0x16')][_0x1627('0x6e')]=_0x2c286f[0x0];if(!_0x58fe04[_0x1627('0x43')][_0x1627('0x5f')])return;return db[_0x1627('0x6f')][_0x1627('0x42')]({'where':{'id':_0x58fe04[_0x1627('0x43')][_0x1627('0x5f')],'role':_0x1627('0x61')},'attributes':['id',_0x1627('0x3a'),'fullname',_0x1627('0x70'),_0x1627('0x71')],'raw':!![]});}return null;})[_0x1627('0x1e')](function(_0x5004e4){if(!_0x5004e4)return null;_0x6f184a['message']['agent']=_0x5004e4;return _0x6f184a;})[_0x1627('0x1e')](function(_0x40893e){if(_0x40893e){_0x40893e[_0x1627('0x16')][_0x1627('0x72')]=util[_0x1627('0x59')](_0x1627('0x73'),_0x58fe04['user'][_0x1627('0x3a')]);_0x40893e['message'][_0x1627('0x74')]=_0x6f184a[_0x1627('0x74')];_0x40893e[_0x1627('0x16')]['motionChannel']=_0x6f184a[_0x1627('0x74')];_0x40893e[_0x1627('0x16')][_0x1627('0x75')]='reject';_0x40893e[_0x1627('0x16')][_0x1627('0x43')]=htmlToText[_0x1627('0x76')](_0x6f184a['message'][_0x1627('0x43')]);respondWithRpcPromise(_0x1627('0x77'),'EventManager',{'event':_0x1627('0x78'),'message':_0x40893e[_0x1627('0x16')]},client9002);return _0x6f184a;}return null;})[_0x1627('0x1e')](respondWithResult(_0xed7d02,null))[_0x1627('0x3e')](handleError(_0xed7d02,null));};exports[_0x1627('0x79')]=function(_0x63161c,_0x17f127){var _0xca8f28=moment()[_0x1627('0x7a')]()[_0x1627('0x7b')]();var _0x8dcaf3=path[_0x1627('0x7c')](config['root'],_0x1627('0x7d'),_0x1627('0x7e'),_0x1627('0x7f'));var _0x4600f6=path[_0x1627('0x7c')](config[_0x1627('0x52')],_0x1627('0x7d'),_0x1627('0x7e'),'attachments');var _0x52f4e7=util['format'](_0x1627('0x80'),_0xca8f28);return db[_0x1627('0x26')][_0x1627('0x42')]({'where':{'id':_0x63161c['params']['id']},'attributes':['id',_0x1627('0x43'),_0x1627('0x81'),'to','cc',_0x1627('0x82'),_0x1627('0x83'),'createdAt'],'include':_0x63161c['query'][_0x1627('0x51')]?[{'model':db[_0x1627('0x84')],'as':_0x1627('0x85')}]:undefined})[_0x1627('0x1e')](handleEntityNotFound(_0x17f127,null))[_0x1627('0x1e')](function(_0x344eed){if(_0x344eed){var _0x2e7f44=_0x344eed;var _0x4fe63c={'from':_0x2e7f44[_0x1627('0x81')],'to':_0x2e7f44['to'],'subject':_0x2e7f44[_0x1627('0x83')],'html':htmlEntities[_0x1627('0x86')](_0x2e7f44[_0x1627('0x43')]),'headers':{'Date':moment(_0x2e7f44[_0x1627('0x87')])[_0x1627('0x59')](_0x1627('0x88'))},'attachments':[]};if(_0x344eed['cc']){_0x4fe63c['headers']['Cc']=_0x344eed['cc'];}if(_0x344eed[_0x1627('0x82')]){_0x4fe63c[_0x1627('0x89')][_0x1627('0x8a')]=_0x344eed['bcc'];}return new Promise(function(_0x1ea5af,_0x28884a){if(_0x344eed['Attachments']){for(var _0x2db860=0x0;_0x2db860<_0x344eed[_0x1627('0x85')][_0x1627('0x31')];_0x2db860++){var _0x51a2e0=_0x344eed[_0x1627('0x85')][_0x2db860];var _0x52dbba=path[_0x1627('0x7c')](_0x4600f6,_0x51a2e0['basename']);if(fs['existsSync'](_0x52dbba)){_0x4fe63c[_0x1627('0x51')][_0x1627('0x8b')]({'name':_0x51a2e0[_0x1627('0x3a')],'contentType':_0x51a2e0['type'],'data':fs[_0x1627('0x8c')](_0x52dbba)});}}}emlformat[_0x1627('0x8d')](_0x4fe63c,function(_0x3a4bce,_0x3c9aab){if(_0x3a4bce)return _0x28884a(_0x3a4bce);fs[_0x1627('0x8e')](path[_0x1627('0x7c')](_0x8dcaf3,_0x52f4e7),_0x3c9aab);return _0x1ea5af(_0x3c9aab);});});}})['then'](function(_0x160db6){if(_0x160db6){return _0x17f127[_0x1627('0x79')](path[_0x1627('0x7c')](_0x8dcaf3,_0x52f4e7),_0x52f4e7,function(_0x1be155){if(!_0x1be155)fs['unlinkSync'](path[_0x1627('0x7c')](_0x8dcaf3,_0x52f4e7));});}})[_0x1627('0x3e')](handleError(_0x17f127,null));}; \ No newline at end of file +var _0x5bc5=['push','readFileSync','writeFileSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','json','offset','limit','undefined','count','status','set','Content-Range','destroy','sendStatus','stack','name','send','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','merge','where','options','rows','show','includeAll','include','find','update','body','params','describe','create','direction','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','CloudProvider','attachments','join','root','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','reject','UserId','get','MailInteraction','interaction','user','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','motionChannel','event','fromString','EventManager','rejectmessage','download','unix','server','files','tmp','bcc','createdAt','Attachments','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','basename','existsSync'];(function(_0x2cf95b,_0x5b44a6){var _0x6147f=function(_0xedfc16){while(--_0xedfc16){_0x2cf95b['push'](_0x2cf95b['shift']());}};_0x6147f(++_0x5b44a6);}(_0x5bc5,0x127));var _0x55bc=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x5bc5[_0xcd0918];return _0x250704;};'use strict';var emlformat=require(_0x55bc('0x0'));var moment=require(_0x55bc('0x1'));var util=require('util');var path=require(_0x55bc('0x2'));var fs=require('fs');var _=require(_0x55bc('0x3'));var Redis=require(_0x55bc('0x4'));var htmlToText=require(_0x55bc('0x5'));var interactionService=require(_0x55bc('0x6'));var qs=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var interaction_log=require('../../config/logger')(_0x55bc('0xa'));var config=require(_0x55bc('0xb'));var db=require(_0x55bc('0xc'))['db'];config['redis']=_[_0x55bc('0xd')](config[_0x55bc('0xe')],{'host':_0x55bc('0xf'),'port':0x18eb});var socket=require(_0x55bc('0x10'))(new Redis(config[_0x55bc('0xe')]));var htmlEntities=require(_0x55bc('0x11'));require(_0x55bc('0x12'))[_0x55bc('0x13')](socket);var jayson=require(_0x55bc('0x14'));var client=jayson[_0x55bc('0x15')]['http']({'port':0x232c});var client9003=jayson[_0x55bc('0x15')][_0x55bc('0x16')]({'port':0x232b});var client9002=jayson['client'][_0x55bc('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2ac750,_0xdceea2,_0x587368,_0x52b5b7){return new Promise(function(_0x518198,_0x1bbe5c){var _0x34686f=_0x52b5b7||client;return _0x34686f['request'](_0x2ac750,_0x587368)[_0x55bc('0x17')](function(_0x3b6bff){logger[_0x55bc('0x18')](_0x55bc('0x19'),_0xdceea2,'request\x20sent');logger[_0x55bc('0x1a')](_0x55bc('0x1b'),_0xdceea2,_0x55bc('0x1c'),JSON['stringify'](_0x3b6bff));if(_0x3b6bff[_0x55bc('0x1d')]){if(_0x3b6bff[_0x55bc('0x1d')][_0x55bc('0x1e')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xdceea2,_0x3b6bff[_0x55bc('0x1d')][_0x55bc('0x1f')]);return _0x1bbe5c(_0x3b6bff[_0x55bc('0x1d')][_0x55bc('0x1f')]);}logger[_0x55bc('0x1d')](_0x55bc('0x19'),_0xdceea2,_0x3b6bff[_0x55bc('0x1d')][_0x55bc('0x1f')]);return _0x518198(_0x3b6bff[_0x55bc('0x1d')][_0x55bc('0x1f')]);}else{logger[_0x55bc('0x18')]('MailMessage,\x20%s,\x20%s',_0xdceea2,_0x55bc('0x1c'));_0x518198(_0x3b6bff[_0x55bc('0x20')]['message']);}})[_0x55bc('0x21')](function(_0x48b00c){logger[_0x55bc('0x1d')]('MailMessage,\x20%s,\x20%s',_0xdceea2,_0x48b00c);_0x1bbe5c(_0x48b00c);});});}function respondWithResult(_0xadb82d,_0x48329d){_0x48329d=_0x48329d||0xc8;return function(_0x429ca1){if(_0x429ca1){return _0xadb82d['status'](_0x48329d)[_0x55bc('0x22')](_0x429ca1);}};}function respondWithFilteredResult(_0x42c6e2,_0x3c2c92){return function(_0x172361){if(_0x172361){var _0x4a15e3=typeof _0x3c2c92[_0x55bc('0x23')]==='undefined'&&typeof _0x3c2c92[_0x55bc('0x24')]===_0x55bc('0x25');var _0x2d54d1=_0x172361[_0x55bc('0x26')];var _0x668e3e=_0x4a15e3?0x0:_0x3c2c92[_0x55bc('0x23')];var _0x1b5ddd=_0x4a15e3?_0x172361['count']:_0x3c2c92[_0x55bc('0x23')]+_0x3c2c92[_0x55bc('0x24')];var _0xbdeb60;if(_0x1b5ddd>=_0x2d54d1){_0x1b5ddd=_0x2d54d1;_0xbdeb60=0xc8;}else{_0xbdeb60=0xce;}_0x42c6e2[_0x55bc('0x27')](_0xbdeb60);return _0x42c6e2[_0x55bc('0x28')](_0x55bc('0x29'),_0x668e3e+'-'+_0x1b5ddd+'/'+_0x2d54d1)[_0x55bc('0x22')](_0x172361);}return null;};}function saveUpdates(_0x441b66){return function(_0x30db06){if(_0x30db06){return _0x30db06['update'](_0x441b66)[_0x55bc('0x17')](function(_0x3b361f){return _0x3b361f;});}return null;};}function removeEntity(_0x23fd9e){return function(_0xf552f1){if(_0xf552f1){return _0xf552f1[_0x55bc('0x2a')]()[_0x55bc('0x17')](function(){_0x23fd9e[_0x55bc('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22112b){return function(_0xa4f44d){if(!_0xa4f44d){_0x22112b[_0x55bc('0x2b')](0x194);}return _0xa4f44d;};}function handleError(_0x5c0a81,_0x1d2d36){_0x1d2d36=_0x1d2d36||0x1f4;return function(_0x59a6e7){logger[_0x55bc('0x1d')](_0x59a6e7[_0x55bc('0x2c')]);if(_0x59a6e7[_0x55bc('0x2d')]){delete _0x59a6e7[_0x55bc('0x2d')];}_0x5c0a81[_0x55bc('0x27')](_0x1d2d36)[_0x55bc('0x2e')](_0x59a6e7);};}exports['index']=function(_0x25f5f5,_0x2b25ce){var _0x12032b={},_0x3eb9a0={},_0x5ae076={'count':0x0,'rows':[]};var _0x519590=_['map'](db[_0x55bc('0x2f')][_0x55bc('0x30')],function(_0x3dc8bb){return{'name':_0x3dc8bb[_0x55bc('0x31')],'type':_0x3dc8bb[_0x55bc('0x32')][_0x55bc('0x33')]};});_0x3eb9a0[_0x55bc('0x34')]=_[_0x55bc('0x35')](_0x519590,_0x55bc('0x2d'));_0x3eb9a0[_0x55bc('0x36')]=_[_0x55bc('0x37')](_0x25f5f5[_0x55bc('0x36')]);_0x3eb9a0['filters']=_[_0x55bc('0x38')](_0x3eb9a0[_0x55bc('0x34')],_0x3eb9a0[_0x55bc('0x36')]);_0x12032b['attributes']=_['intersection'](_0x3eb9a0[_0x55bc('0x34')],qs['fields'](_0x25f5f5[_0x55bc('0x36')][_0x55bc('0x39')]));_0x12032b[_0x55bc('0x3a')]=_0x12032b[_0x55bc('0x3a')][_0x55bc('0x3b')]?_0x12032b[_0x55bc('0x3a')]:_0x3eb9a0[_0x55bc('0x34')];if(!_0x25f5f5[_0x55bc('0x36')]['hasOwnProperty'](_0x55bc('0x3c'))){_0x12032b[_0x55bc('0x24')]=qs['limit'](_0x25f5f5[_0x55bc('0x36')]['limit']);_0x12032b[_0x55bc('0x23')]=qs['offset'](_0x25f5f5[_0x55bc('0x36')][_0x55bc('0x23')]);}_0x12032b[_0x55bc('0x3d')]=qs[_0x55bc('0x3e')](_0x25f5f5[_0x55bc('0x36')][_0x55bc('0x3e')]);_0x12032b['where']=qs[_0x55bc('0x3f')](_[_0x55bc('0x40')](_0x25f5f5['query'],_0x3eb9a0['filters']),_0x519590);if(_0x25f5f5[_0x55bc('0x36')]['filter']){_0x12032b['where']=_[_0x55bc('0x41')](_0x12032b[_0x55bc('0x42')],{'$or':_[_0x55bc('0x35')](_0x519590,function(_0x38fb71){if(_0x38fb71[_0x55bc('0x32')]!=='VIRTUAL'){var _0x1a71d8={};_0x1a71d8[_0x38fb71[_0x55bc('0x2d')]]={'$like':'%'+_0x25f5f5[_0x55bc('0x36')]['filter']+'%'};return _0x1a71d8;}})});}_0x12032b=_[_0x55bc('0x41')]({},_0x12032b,_0x25f5f5[_0x55bc('0x43')]);var _0x52b830={'where':_0x12032b[_0x55bc('0x42')]};return db['MailMessage']['count'](_0x52b830)[_0x55bc('0x17')](function(_0x36165b){_0x5ae076['count']=_0x36165b;if(_0x25f5f5['query']['includeAll']){_0x12032b['include']=[{'all':!![]}];}return db[_0x55bc('0x2f')]['findAll'](_0x12032b);})[_0x55bc('0x17')](function(_0x52af72){_0x5ae076[_0x55bc('0x44')]=_0x52af72;return _0x5ae076;})[_0x55bc('0x17')](respondWithFilteredResult(_0x2b25ce,_0x12032b))[_0x55bc('0x21')](handleError(_0x2b25ce,null));};exports[_0x55bc('0x45')]=function(_0x405e80,_0x2aac74){var _0x2f5e95={'raw':!![],'where':{'id':_0x405e80['params']['id']}},_0x482688={};_0x482688[_0x55bc('0x34')]=_[_0x55bc('0x37')](db[_0x55bc('0x2f')][_0x55bc('0x30')]);_0x482688['query']=_[_0x55bc('0x37')](_0x405e80[_0x55bc('0x36')]);_0x482688[_0x55bc('0x3f')]=_['intersection'](_0x482688[_0x55bc('0x34')],_0x482688[_0x55bc('0x36')]);_0x2f5e95[_0x55bc('0x3a')]=_[_0x55bc('0x38')](_0x482688[_0x55bc('0x34')],qs[_0x55bc('0x39')](_0x405e80[_0x55bc('0x36')][_0x55bc('0x39')]));_0x2f5e95['attributes']=_0x2f5e95[_0x55bc('0x3a')]['length']?_0x2f5e95[_0x55bc('0x3a')]:_0x482688[_0x55bc('0x34')];if(_0x405e80[_0x55bc('0x36')][_0x55bc('0x46')]){_0x2f5e95[_0x55bc('0x47')]=[{'all':!![]}];}_0x2f5e95=_[_0x55bc('0x41')]({},_0x2f5e95,_0x405e80['options']);return db[_0x55bc('0x2f')][_0x55bc('0x48')](_0x2f5e95)[_0x55bc('0x17')](handleEntityNotFound(_0x2aac74,null))['then'](respondWithResult(_0x2aac74,null))[_0x55bc('0x21')](handleError(_0x2aac74,null));};exports[_0x55bc('0x49')]=function(_0x76f8c7,_0x5c4847){if(_0x76f8c7[_0x55bc('0x4a')]['id']){delete _0x76f8c7[_0x55bc('0x4a')]['id'];}return db[_0x55bc('0x2f')][_0x55bc('0x48')]({'where':{'id':_0x76f8c7['params']['id']}})[_0x55bc('0x17')](handleEntityNotFound(_0x5c4847,null))[_0x55bc('0x17')](saveUpdates(_0x76f8c7[_0x55bc('0x4a')],null))[_0x55bc('0x17')](respondWithResult(_0x5c4847,null))[_0x55bc('0x21')](handleError(_0x5c4847,null));};exports['destroy']=function(_0x5a19bd,_0x32e077){return db[_0x55bc('0x2f')]['find']({'where':{'id':_0x5a19bd[_0x55bc('0x4b')]['id']}})[_0x55bc('0x17')](handleEntityNotFound(_0x32e077,null))[_0x55bc('0x17')](removeEntity(_0x32e077,null))[_0x55bc('0x21')](handleError(_0x32e077,null));};exports['describe']=function(_0x3832ba,_0x30f94e){return db[_0x55bc('0x2f')][_0x55bc('0x4c')]()[_0x55bc('0x17')](respondWithResult(_0x30f94e,null))[_0x55bc('0x21')](handleError(_0x30f94e,null));};exports['create']=function(_0x3bfd57,_0x4b31f8){return db['MailMessage'][_0x55bc('0x4d')](_0x3bfd57[_0x55bc('0x4a')])[_0x55bc('0x17')](function(_0x22859a){if(_0x22859a){if(_0x22859a[_0x55bc('0x4e')]===_0x55bc('0x4f')&&!_0x22859a[_0x55bc('0x50')]){var _0x59d22b,_0x50d58a,_0x181c4f;if(_0x3bfd57[_0x55bc('0x4a')]['to']){_0x50d58a=_0x3bfd57['body']['to']['split'](',')[0x0];}return db[_0x55bc('0x51')]['findOne']({'where':{'id':_0x22859a[_0x55bc('0x52')]},'include':[{'model':db[_0x55bc('0x53')],'as':_0x55bc('0x54'),'include':[{'model':db[_0x55bc('0x55')],'as':_0x55bc('0x56'),'where':{'email':_0x50d58a},'limit':0x1,'order':[['updatedAt',_0x55bc('0x57')]]}]},{'model':db[_0x55bc('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x55bc('0x59'),'raw':!![]}]}]})[_0x55bc('0x17')](function(_0x5ece85){_0x59d22b=_0x5ece85;if(!_0x59d22b||!_0x59d22b['Smtp'])return;var _0x40d783=_0x59d22b['getSmtpOptions']();if(_0x3bfd57[_0x55bc('0x4a')]['attachments']&&_0x3bfd57[_0x55bc('0x4a')]['attachments'][_0x55bc('0x3b')]){for(var _0x14a5a4=0x0;_0x14a5a4<_0x3bfd57[_0x55bc('0x4a')]['attachments']['length'];_0x14a5a4+=0x1){_0x3bfd57[_0x55bc('0x4a')][_0x55bc('0x5a')][_0x14a5a4]={'filename':_0x3bfd57[_0x55bc('0x4a')][_0x55bc('0x5a')][_0x14a5a4][_0x55bc('0x2d')],'path':path[_0x55bc('0x5b')](config[_0x55bc('0x5c')],'server/files/attachments',_0x3bfd57[_0x55bc('0x4a')][_0x55bc('0x5a')][_0x14a5a4]['basename'])};}}_0x181c4f={'account':_0x40d783,'message':_0x3bfd57[_0x55bc('0x4a')]};return;})[_0x55bc('0x17')](function(){if(_0x59d22b[_0x55bc('0x54')]){if(_0x59d22b[_0x55bc('0x54')]['Contacts'][_0x55bc('0x3b')]){return _0x59d22b[_0x55bc('0x54')][_0x55bc('0x56')][0x0];}else{return db['CmContact']['create'](_[_0x55bc('0xd')](_0x3bfd57['body'],{'firstName':_0x3bfd57[_0x55bc('0x4a')]['to'],'email':_0x3bfd57[_0x55bc('0x4a')]['to'],'phone':_0x3bfd57[_0x55bc('0x4a')]['to'],'ListId':_0x59d22b[_0x55bc('0x5d')]}));}}else{throw new Error(_0x55bc('0x5e'));}})['then'](function(){if(_0x181c4f){return respondWithRpcPromise(_0x55bc('0x5f'),_0x55bc('0x60'),_0x181c4f,client9003)[_0x55bc('0x17')](function(_0x5b5bf8){return _0x22859a[_0x55bc('0x49')]({'read':!![],'messageId':_0x5b5bf8[_0x55bc('0x61')],'sentAt':moment()[_0x55bc('0x62')](_0x55bc('0x63'))});})[_0x55bc('0x21')](function(_0x40e719){logger[_0x55bc('0x1d')]('%s',JSON[_0x55bc('0x64')](_0x40e719));return _0x22859a;});}return _0x22859a;});}return _0x22859a;}})[_0x55bc('0x17')](respondWithResult(_0x4b31f8,0xc9))[_0x55bc('0x21')](handleError(_0x4b31f8,null));};exports[_0x55bc('0x65')]=function(_0xeacb2c,_0x4a4ef8){var _0x4b6795=_0x55bc('0x66');return interactionService[_0x55bc('0x67')](_0xeacb2c,_0x4b6795)['then'](respondWithResult(_0x4a4ef8,null))[_0x55bc('0x21')](handleError(_0x4a4ef8,null));};exports[_0x55bc('0x68')]=function(_0xfa78f4,_0x95cd61){var _0x495e25={'agent':{},'channel':_0x55bc('0x66')};if(_0xfa78f4[_0x55bc('0x4a')]['id']){delete _0xfa78f4[_0x55bc('0x4a')]['id'];}_0xfa78f4[_0x55bc('0x4a')][_0x55bc('0x69')]=_0xfa78f4[_0x55bc('0x4a')][_0x55bc('0x69')]||_0xfa78f4['user']['id'];_0x495e25['agent']['id']=_0xfa78f4[_0x55bc('0x4a')][_0x55bc('0x69')];return db[_0x55bc('0x2f')][_0x55bc('0x48')]({'where':{'id':_0xfa78f4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x95cd61,null))[_0x55bc('0x17')](function(_0x2fe270){if(_0x2fe270){_0x495e25[_0x55bc('0x1f')]=_0x2fe270[_0x55bc('0x6a')]({'plain':!![]});return db[_0x55bc('0x6b')][_0x55bc('0x48')]({'where':{'id':_0x2fe270['MailInteractionId']}});}return null;})[_0x55bc('0x17')](handleEntityNotFound(_0x95cd61,null))[_0x55bc('0x17')](function(_0x5a88f2){if(_0x5a88f2){_0x495e25[_0x55bc('0x6c')]=_0x5a88f2[_0x55bc('0x6a')]({'plain':!![]});interaction_log[_0x55bc('0x18')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xfa78f4[_0x55bc('0x6d')]['id'],_0xfa78f4[_0x55bc('0x6d')]['name'],_0xfa78f4[_0x55bc('0x6d')][_0x55bc('0x6e')],_0x495e25['interaction']['id'],_0xfa78f4['body']?JSON[_0x55bc('0x64')](_0xfa78f4[_0x55bc('0x4a')]):'null');return respondWithRpcPromise(_0x55bc('0x6f'),'rejectMessage',_0x495e25);}return null;})['then'](function(_0xd54e02){var _0x5e89ac=_0x55bc('0x70')+_0xd54e02[_0x55bc('0x1f')][_0x55bc('0x71')];return db['sequelize'][_0x55bc('0x36')](_0x5e89ac,{'type':db['Sequelize'][_0x55bc('0x72')][_0x55bc('0x73')],'raw':!![]})[_0x55bc('0x17')](function(_0x156863){return _0x156863;});})['then'](function(_0x39244d){if(_0x39244d){_0x495e25[_0x55bc('0x1f')][_0x55bc('0x74')]=_0x39244d[0x0];if(!_0xfa78f4['body'][_0x55bc('0x69')])return;return db[_0x55bc('0x75')][_0x55bc('0x48')]({'where':{'id':_0xfa78f4[_0x55bc('0x4a')][_0x55bc('0x69')],'role':_0x55bc('0x76')},'attributes':['id',_0x55bc('0x2d'),_0x55bc('0x77'),_0x55bc('0x78'),_0x55bc('0x79')],'raw':!![]});}return null;})[_0x55bc('0x17')](function(_0x408fe9){if(!_0x408fe9)return null;_0x495e25['message'][_0x55bc('0x76')]=_0x408fe9;return _0x495e25;})[_0x55bc('0x17')](function(_0x12ac93){if(_0x12ac93){_0x12ac93[_0x55bc('0x1f')][_0x55bc('0x7a')]=util['format']('SIP/%s',_0xfa78f4[_0x55bc('0x6d')][_0x55bc('0x2d')]);_0x12ac93[_0x55bc('0x1f')]['channel']=_0x495e25['channel'];_0x12ac93[_0x55bc('0x1f')][_0x55bc('0x7b')]=_0x495e25['channel'];_0x12ac93[_0x55bc('0x1f')][_0x55bc('0x7c')]=_0x55bc('0x68');_0x12ac93['message'][_0x55bc('0x4a')]=htmlToText[_0x55bc('0x7d')](_0x495e25['message'][_0x55bc('0x4a')]);respondWithRpcPromise(_0x55bc('0x7e'),_0x55bc('0x7e'),{'event':_0x55bc('0x7f'),'message':_0x12ac93[_0x55bc('0x1f')]},client9002);return _0x495e25;}return null;})[_0x55bc('0x17')](respondWithResult(_0x95cd61,null))['catch'](handleError(_0x95cd61,null));};exports[_0x55bc('0x80')]=function(_0x2ddcc2,_0x3c440c){var _0x1abcd9=moment()[_0x55bc('0x81')]()['toString']();var _0x3aeb0a=path['join'](config[_0x55bc('0x5c')],_0x55bc('0x82'),_0x55bc('0x83'),_0x55bc('0x84'));var _0x4ed027=path['join'](config[_0x55bc('0x5c')],_0x55bc('0x82'),_0x55bc('0x83'),_0x55bc('0x5a'));var _0x1f0810=util[_0x55bc('0x62')]('message-%s.eml',_0x1abcd9);return db[_0x55bc('0x2f')][_0x55bc('0x48')]({'where':{'id':_0x2ddcc2[_0x55bc('0x4b')]['id']},'attributes':['id',_0x55bc('0x4a'),'from','to','cc',_0x55bc('0x85'),'subject',_0x55bc('0x86')],'include':_0x2ddcc2[_0x55bc('0x36')]['attachments']?[{'model':db['Attachment'],'as':_0x55bc('0x87')}]:undefined})[_0x55bc('0x17')](handleEntityNotFound(_0x3c440c,null))['then'](function(_0x3bc33c){if(_0x3bc33c){var _0x2da4d2=_0x3bc33c;var _0xcd280={'from':_0x2da4d2[_0x55bc('0x88')],'to':_0x2da4d2['to'],'subject':_0x2da4d2[_0x55bc('0x89')],'html':htmlEntities[_0x55bc('0x8a')](_0x2da4d2[_0x55bc('0x4a')]),'headers':{'Date':moment(_0x2da4d2[_0x55bc('0x86')])[_0x55bc('0x62')](_0x55bc('0x8b'))},'attachments':[]};if(_0x3bc33c['cc']){_0xcd280['headers']['Cc']=_0x3bc33c['cc'];}if(_0x3bc33c[_0x55bc('0x85')]){_0xcd280['headers'][_0x55bc('0x8c')]=_0x3bc33c[_0x55bc('0x85')];}return new Promise(function(_0x3faf43,_0x4ef9db){if(_0x3bc33c[_0x55bc('0x87')]){for(var _0x17a101=0x0;_0x17a101<_0x3bc33c['Attachments'][_0x55bc('0x3b')];_0x17a101++){var _0x51e946=_0x3bc33c[_0x55bc('0x87')][_0x17a101];var _0x1e2306=path[_0x55bc('0x5b')](_0x4ed027,_0x51e946[_0x55bc('0x8d')]);if(fs[_0x55bc('0x8e')](_0x1e2306)){_0xcd280[_0x55bc('0x5a')][_0x55bc('0x8f')]({'name':_0x51e946[_0x55bc('0x2d')],'contentType':_0x51e946[_0x55bc('0x32')],'data':fs[_0x55bc('0x90')](_0x1e2306)});}}}emlformat['build'](_0xcd280,function(_0x3e7c61,_0x1d510d){if(_0x3e7c61)return _0x4ef9db(_0x3e7c61);fs[_0x55bc('0x91')](path['join'](_0x3aeb0a,_0x1f0810),_0x1d510d);return _0x3faf43(_0x1d510d);});});}})['then'](function(_0x3ee17d){if(_0x3ee17d){return _0x3c440c[_0x55bc('0x80')](path[_0x55bc('0x5b')](_0x3aeb0a,_0x1f0810),_0x1f0810,function(_0x25bd46){if(!_0x25bd46)fs['unlinkSync'](path[_0x55bc('0x5b')](_0x3aeb0a,_0x1f0810));});}})[_0x55bc('0x21')](handleError(_0x3c440c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e42fdce..797ef6e 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 _0x1ab8=['hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1ab8,0xe3));var _0x81ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1ab8[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x81ab('0x0'))['db'][_0x81ab('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x81ab('0x2')](0x0);var events={'afterCreate':_0x81ab('0x3'),'afterUpdate':_0x81ab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4667b3){return function(_0x5c04e4,_0x5b73c2,_0x547429){MailMessageEvents['emit'](_0x4667b3+':'+_0x5c04e4['id'],_0x5c04e4);MailMessageEvents[_0x81ab('0x5')](_0x4667b3,_0x5c04e4);_0x547429(null);};}for(var e in events){if(events[_0x81ab('0x6')](e)){var event=events[e];MailMessage[_0x81ab('0x7')](e,emitEvent(event));}}module[_0x81ab('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb9d5=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x28085c,_0x35283e){var _0x23d4fe=function(_0x1d9dfc){while(--_0x1d9dfc){_0x28085c['push'](_0x28085c['shift']());}};_0x23d4fe(++_0x35283e);}(_0xb9d5,0x1a9));var _0x5b9d=function(_0x2ecf04,_0x5be55e){_0x2ecf04=_0x2ecf04-0x0;var _0xbaa7c9=_0xb9d5[_0x2ecf04];return _0xbaa7c9;};'use strict';var EventEmitter=require(_0x5b9d('0x0'));var MailMessage=require(_0x5b9d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5b9d('0x2')](0x0);var events={'afterCreate':_0x5b9d('0x3'),'afterUpdate':_0x5b9d('0x4'),'afterDestroy':_0x5b9d('0x5')};function emitEvent(_0x48ed35){return function(_0x29692e,_0xc56d7f,_0x42012e){MailMessageEvents[_0x5b9d('0x6')](_0x48ed35+':'+_0x29692e['id'],_0x29692e);MailMessageEvents[_0x5b9d('0x6')](_0x48ed35,_0x29692e);_0x42012e(null);};}for(var e in events){if(events[_0x5b9d('0x7')](e)){var event=events[e];MailMessage[_0x5b9d('0x8')](e,emitEvent(event));}}module[_0x5b9d('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d9b7362..036fd9b 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 _0xf719=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','direction','toLowerCase','out','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4'];(function(_0x154cbb,_0x43c57f){var _0x494584=function(_0x971bd9){while(--_0x971bd9){_0x154cbb['push'](_0x154cbb['shift']());}};_0x494584(++_0x43c57f);}(_0xf719,0x18d));var _0x9f71=function(_0x173c92,_0x1215b7){_0x173c92=_0x173c92-0x0;var _0x5b1687=_0xf719[_0x173c92];return _0x5b1687;};'use strict';var _=require(_0x9f71('0x0'));var util=require(_0x9f71('0x1'));var logger=require(_0x9f71('0x2'))(_0x9f71('0x3'));var moment=require('moment');var BPromise=require(_0x9f71('0x4'));var rp=require('request-promise');var htmlToText=require(_0x9f71('0x5'));var fs=require('fs');var path=require(_0x9f71('0x6'));var rimraf=require(_0x9f71('0x7'));var config=require(_0x9f71('0x8'));var attributes=require(_0x9f71('0x9'));module[_0x9f71('0xa')]=function(_0x458238,_0x19099a){return _0x458238[_0x9f71('0xb')]('MailMessage',attributes,{'tableName':_0x9f71('0xc'),'paranoid':![],'indexes':[{'name':_0x9f71('0xd'),'fields':[_0x9f71('0xd')]},{'name':'fti_mail_messages','fields':[_0x9f71('0xe'),_0x9f71('0xf')],'type':_0x9f71('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ff59a,_0x14c2d4,_0x39fff2){if(_0x2ff59a[_0x9f71('0x11')]){_0x2ff59a['plainBody']=htmlToText[_0x9f71('0x12')](_0x2ff59a[_0x9f71('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x39fff2(null,_0x14c2d4);},'afterCreate':function(_0x5ec07c,_0x7c535f,_0x441528){var _0x133ffd=_0x458238['models'];var _0x257e04=_0x5ec07c['get']({'plain':!![]});if(_0x257e04[_0x9f71('0x13')]['toLowerCase']()==='in'||_0x257e04['direction'][_0x9f71('0x14')]()===_0x9f71('0x15')&&!_0x257e04['secret']&&!_[_0x9f71('0x16')](_0x257e04[_0x9f71('0x17')])){_0x133ffd[_0x9f71('0x18')]['findOne']({'where':{'id':_0x257e04[_0x9f71('0x19')]}})[_0x9f71('0x1a')](function(_0x1ae2e2){if(_0x1ae2e2){_0x1ae2e2[_0x9f71('0x1b')]({'lastMsgAt':_0x257e04[_0x9f71('0x1c')],'lastMsgDirection':_0x257e04[_0x9f71('0x13')]['toLowerCase']()});}})[_0x9f71('0x1d')](function(_0x1ef7d3){console[_0x9f71('0x1e')](_0x1ef7d3);});}_0x441528();}},'charset':_0x9f71('0x1f'),'collate':_0x9f71('0x20')});}; \ No newline at end of file +var _0x845a=['html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x410e04,_0x5e444f){var _0x390704=function(_0x1ba6ef){while(--_0x1ba6ef){_0x410e04['push'](_0x410e04['shift']());}};_0x390704(++_0x5e444f);}(_0x845a,0x185));var _0xa845=function(_0x4ba578,_0x134193){_0x4ba578=_0x4ba578-0x0;var _0x358cd=_0x845a[_0x4ba578];return _0x358cd;};'use strict';var _=require(_0xa845('0x0'));var util=require(_0xa845('0x1'));var logger=require(_0xa845('0x2'))(_0xa845('0x3'));var moment=require(_0xa845('0x4'));var BPromise=require(_0xa845('0x5'));var rp=require(_0xa845('0x6'));var htmlToText=require(_0xa845('0x7'));var fs=require('fs');var path=require(_0xa845('0x8'));var rimraf=require(_0xa845('0x9'));var config=require(_0xa845('0xa'));var attributes=require(_0xa845('0xb'));module[_0xa845('0xc')]=function(_0xa9b50d,_0xaa5d7f){return _0xa9b50d[_0xa845('0xd')](_0xa845('0xe'),attributes,{'tableName':_0xa845('0xf'),'paranoid':![],'indexes':[{'name':_0xa845('0x10'),'fields':[_0xa845('0x10')]},{'name':_0xa845('0x11'),'fields':[_0xa845('0x12'),_0xa845('0x13')],'type':_0xa845('0x14')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18750d,_0x1a7590,_0x1bf6c6){if(_0x18750d[_0xa845('0x15')]){_0x18750d['plainBody']=htmlToText[_0xa845('0x16')](_0x18750d[_0xa845('0x15')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1bf6c6(null,_0x1a7590);},'afterCreate':function(_0x5984ca,_0xa7a021,_0x15daa2){var _0x3763e2=_0xa9b50d['models'];var _0x4f26fb=_0x5984ca[_0xa845('0x17')]({'plain':!![]});if(_0x4f26fb[_0xa845('0x18')]['toLowerCase']()==='in'||_0x4f26fb[_0xa845('0x18')][_0xa845('0x19')]()===_0xa845('0x1a')&&!_0x4f26fb[_0xa845('0x1b')]&&!_['isNil'](_0x4f26fb[_0xa845('0x1c')])){_0x3763e2[_0xa845('0x1d')]['findOne']({'where':{'id':_0x4f26fb['MailInteractionId']}})[_0xa845('0x1e')](function(_0x83ab84){if(_0x83ab84){_0x83ab84[_0xa845('0x1f')]({'lastMsgAt':_0x4f26fb[_0xa845('0x20')],'lastMsgDirection':_0x4f26fb['direction'][_0xa845('0x19')]()});}})[_0xa845('0x21')](function(_0x13215d){console[_0xa845('0x22')](_0x13215d);});}_0x15daa2();}},'charset':'utf8mb4','collate':_0xa845('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f962027..364e9e9 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 _0x160f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf160('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf160('0xd'))[_0xf160('0xe')](socket);function respondWithRpcPromise(_0x393f70,_0x2736b8,_0x5e09c6){return new BPromise(function(_0x4a0639,_0xf8ec3d){return client[_0xf160('0xf')](_0x393f70,_0x5e09c6)[_0xf160('0x10')](function(_0x56072f){logger[_0xf160('0x11')](_0xf160('0x12'),_0x2736b8,_0xf160('0x13'));logger[_0xf160('0x14')](_0xf160('0x15'),_0x2736b8,'request\x20sent',JSON[_0xf160('0x16')](_0x56072f));if(_0x56072f['error']){if(_0x56072f[_0xf160('0x17')][_0xf160('0x18')]===0x1f4){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0xf8ec3d(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}logger[_0xf160('0x17')]('MailMessage,\x20%s,\x20%s',_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0x4a0639(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}else{logger['info'](_0xf160('0x12'),_0x2736b8,'request\x20sent');_0x4a0639(_0x56072f[_0xf160('0x1a')][_0xf160('0x19')]);}})[_0xf160('0x1b')](function(_0x1e09f3){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x1e09f3);_0xf8ec3d(_0x1e09f3);});});}exports[_0xf160('0x1c')]=function(_0x2a8cb4){var _0x1fdb38=this;return new Promise(function(_0x4a58d9,_0x40ccf0){return db[_0xf160('0x1d')][_0xf160('0x1e')](_0x2a8cb4['body'],{'raw':_0x2a8cb4[_0xf160('0x1f')]?_0x2a8cb4[_0xf160('0x1f')][_0xf160('0x20')]===undefined?!![]:![]:!![]})[_0xf160('0x10')](function(_0x2e03c8){logger[_0xf160('0x11')](_0xf160('0x1c'),_0x2a8cb4);logger['debug'](_0xf160('0x1c'),_0x2a8cb4,JSON[_0xf160('0x16')](_0x2e03c8));_0x4a58d9(_0x2e03c8);})[_0xf160('0x1b')](function(_0x49bb5c){logger['error'](_0xf160('0x1c'),_0x49bb5c[_0xf160('0x19')],_0x2a8cb4);_0x40ccf0(_0x1fdb38['error'](0x1f4,_0x49bb5c['message']));});});}; \ No newline at end of file +var _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x18f995,_0x2e87b8){var _0x2e281f=function(_0x34c2ec){while(--_0x34c2ec){_0x18f995['push'](_0x18f995['shift']());}};_0x2e281f(++_0x2e87b8);}(_0x955f,0x1eb));var _0xf955=function(_0x58155a,_0x1b6742){_0x58155a=_0x58155a-0x0;var _0x50e5b7=_0x955f[_0x58155a];return _0x50e5b7;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});config['redis']=_[_0xf955('0xa')](config[_0xf955('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0xc'))(new Redis(config[_0xf955('0xb')]));require(_0xf955('0xd'))[_0xf955('0xe')](socket);function respondWithRpcPromise(_0x134c1b,_0x421e4a,_0x186719){return new BPromise(function(_0x4d213a,_0xf7e3e){return client['request'](_0x134c1b,_0x186719)[_0xf955('0xf')](function(_0x5d6211){logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,_0xf955('0x11'));logger['debug'](_0xf955('0x12'),_0x421e4a,'request\x20sent',JSON[_0xf955('0x13')](_0x5d6211));if(_0x5d6211[_0xf955('0x14')]){if(_0x5d6211[_0xf955('0x14')][_0xf955('0x15')]===0x1f4){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);return _0xf7e3e(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}logger['error'](_0xf955('0x16'),_0x421e4a,_0x5d6211['error'][_0xf955('0x17')]);return _0x4d213a(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}else{logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,'request\x20sent');_0x4d213a(_0x5d6211[_0xf955('0x18')][_0xf955('0x17')]);}})[_0xf955('0x19')](function(_0x4d7b5b){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x4d7b5b);_0xf7e3e(_0x4d7b5b);});});}exports[_0xf955('0x1a')]=function(_0x3f960e){var _0x3ae4fb=this;return new Promise(function(_0x5f4d9a,_0x17d86a){return db[_0xf955('0x1b')][_0xf955('0x1c')](_0x3f960e['body'],{'raw':_0x3f960e[_0xf955('0x1d')]?_0x3f960e['options'][_0xf955('0x1e')]===undefined?!![]:![]:!![]})[_0xf955('0xf')](function(_0x37143d){logger[_0xf955('0x10')](_0xf955('0x1a'),_0x3f960e);logger['debug'](_0xf955('0x1a'),_0x3f960e,JSON[_0xf955('0x13')](_0x37143d));_0x5f4d9a(_0x37143d);})[_0xf955('0x19')](function(_0x13a1a7){logger[_0xf955('0x14')](_0xf955('0x1a'),_0x13a1a7[_0xf955('0x17')],_0x3f960e);_0x17d86a(_0x3ae4fb['error'](0x1f4,_0x13a1a7[_0xf955('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c2e5f2a..5f085c9 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 _0x4e8e=['length','mailMessage:','./mailMessage.events','save','emit','removeListener','register'];(function(_0x521e26,_0x20250e){var _0x3162f5=function(_0x19e5b6){while(--_0x19e5b6){_0x521e26['push'](_0x521e26['shift']());}};_0x3162f5(++_0x20250e);}(_0x4e8e,0x95));var _0xe4e8=function(_0x234325,_0x143e53){_0x234325=_0x234325-0x0;var _0x32dcce=_0x4e8e[_0x234325];return _0x32dcce;};'use strict';var MailMessageEvents=require(_0xe4e8('0x0'));var events=[_0xe4e8('0x1'),'remove','update'];function createListener(_0x1f1b8d,_0x2d09b4){return function(_0x42a4aa){_0x2d09b4[_0xe4e8('0x2')](_0x1f1b8d,_0x42a4aa);};}function removeListener(_0x53cfb5,_0x46c61f){return function(){MailMessageEvents[_0xe4e8('0x3')](_0x53cfb5,_0x46c61f);};}exports[_0xe4e8('0x4')]=function(_0x4b7f06){for(var _0x270768=0x0,_0x18099e=events[_0xe4e8('0x5')];_0x270768<_0x18099e;_0x270768++){var _0x1b1d37=events[_0x270768];var _0x507016=createListener(_0xe4e8('0x6')+_0x1b1d37,_0x4b7f06);MailMessageEvents['on'](_0x1b1d37,_0x507016);}}; \ No newline at end of file +var _0xd847=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd847,0x18a));var _0x7d84=function(_0x305795,_0x260eb7){_0x305795=_0x305795-0x0;var _0x5ee0b9=_0xd847[_0x305795];return _0x5ee0b9;};'use strict';var MailMessageEvents=require(_0x7d84('0x0'));var events=[_0x7d84('0x1'),_0x7d84('0x2'),_0x7d84('0x3')];function createListener(_0x58816d,_0x5a1e39){return function(_0x4492d5){_0x5a1e39[_0x7d84('0x4')](_0x58816d,_0x4492d5);};}function removeListener(_0x207e6f,_0x15f200){return function(){MailMessageEvents[_0x7d84('0x5')](_0x207e6f,_0x15f200);};}exports['register']=function(_0x1544e7){for(var _0x5d8f76=0x0,_0x3c57cd=events[_0x7d84('0x6')];_0x5d8f76<_0x3c57cd;_0x5d8f76++){var _0x1d6297=events[_0x5d8f76];var _0x32da6d=createListener(_0x7d84('0x7')+_0x1d6297,_0x1544e7);MailMessageEvents['on'](_0x1d6297,_0x32da6d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5d2fcd1..352bf95 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 _0x43fe=['removeTeams','removeAgents','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','destroy','delete','/:id/teams'];(function(_0x9453d5,_0x100560){var _0x59d0b9=function(_0x16c69e){while(--_0x16c69e){_0x9453d5['push'](_0x9453d5['shift']());}};_0x59d0b9(++_0x100560);}(_0x43fe,0x120));var _0xe43f=function(_0x5786b9,_0x4e27da){_0x5786b9=_0x5786b9-0x0;var _0x32884a=_0x43fe[_0x5786b9];return _0x32884a;};'use strict';var multer=require(_0xe43f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe43f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe43f('0x2'));var auth=require(_0xe43f('0x3'));var interaction=require(_0xe43f('0x4'));var config=require(_0xe43f('0x5'));var controller=require(_0xe43f('0x6'));router[_0xe43f('0x7')]('/',auth[_0xe43f('0x8')](),controller['index']);router[_0xe43f('0x7')](_0xe43f('0x9'),auth[_0xe43f('0x8')](),controller['describe']);router[_0xe43f('0x7')](_0xe43f('0xa'),auth[_0xe43f('0x8')](),controller['show']);router[_0xe43f('0x7')](_0xe43f('0xb'),auth['isAuthenticated'](),controller[_0xe43f('0xc')]);router['get']('/:id/teams',auth[_0xe43f('0x8')](),controller[_0xe43f('0xd')]);router[_0xe43f('0x7')](_0xe43f('0xe'),auth[_0xe43f('0x8')](),controller[_0xe43f('0xf')]);router[_0xe43f('0x10')]('/',auth[_0xe43f('0x8')](),controller[_0xe43f('0x11')]);router[_0xe43f('0x10')]('/:id/teams',auth[_0xe43f('0x8')](),controller[_0xe43f('0x12')]);router['post'](_0xe43f('0xe'),auth[_0xe43f('0x8')](),controller[_0xe43f('0x13')]);router['put'](_0xe43f('0xa'),auth[_0xe43f('0x8')](),controller[_0xe43f('0x14')]);router['delete'](_0xe43f('0xa'),auth[_0xe43f('0x8')](),controller[_0xe43f('0x15')]);router[_0xe43f('0x16')](_0xe43f('0x17'),auth[_0xe43f('0x8')](),controller[_0xe43f('0x18')]);router['delete']('/:id/users',auth[_0xe43f('0x8')](),controller[_0xe43f('0x19')]);module['exports']=router; \ No newline at end of file +var _0x150c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2dd6b1,_0x4485d7){var _0x494306=function(_0x46d23d){while(--_0x46d23d){_0x2dd6b1['push'](_0x2dd6b1['shift']());}};_0x494306(++_0x4485d7);}(_0x150c,0x119));var _0xc150=function(_0x37b0e1,_0x5f3934){_0x37b0e1=_0x37b0e1-0x0;var _0x24e3b2=_0x150c[_0x37b0e1];return _0x24e3b2;};'use strict';var multer=require(_0xc150('0x0'));var util=require(_0xc150('0x1'));var path=require(_0xc150('0x2'));var timeout=require(_0xc150('0x3'));var express=require(_0xc150('0x4'));var router=express[_0xc150('0x5')]();var fs_extra=require(_0xc150('0x6'));var auth=require(_0xc150('0x7'));var interaction=require(_0xc150('0x8'));var config=require(_0xc150('0x9'));var controller=require(_0xc150('0xa'));router[_0xc150('0xb')]('/',auth[_0xc150('0xc')](),controller[_0xc150('0xd')]);router[_0xc150('0xb')](_0xc150('0xe'),auth[_0xc150('0xc')](),controller[_0xc150('0xf')]);router[_0xc150('0xb')](_0xc150('0x10'),auth[_0xc150('0xc')](),controller[_0xc150('0x11')]);router['get'](_0xc150('0x12'),auth['isAuthenticated'](),controller[_0xc150('0x13')]);router[_0xc150('0xb')](_0xc150('0x14'),auth['isAuthenticated'](),controller[_0xc150('0x15')]);router[_0xc150('0xb')](_0xc150('0x16'),auth['isAuthenticated'](),controller[_0xc150('0x17')]);router[_0xc150('0x18')]('/',auth[_0xc150('0xc')](),controller['create']);router['post'](_0xc150('0x14'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xc150('0x16'),auth[_0xc150('0xc')](),controller[_0xc150('0x19')]);router['put']('/:id',auth[_0xc150('0xc')](),controller[_0xc150('0x1a')]);router[_0xc150('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xc150('0x1c')]);router[_0xc150('0x1b')](_0xc150('0x14'),auth[_0xc150('0xc')](),controller[_0xc150('0x1d')]);router[_0xc150('0x1b')](_0xc150('0x16'),auth[_0xc150('0xc')](),controller[_0xc150('0x1e')]);module[_0xc150('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index fbfe908..e0ffc29 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 _0xb783=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x31d5a5,_0xb03e66){var _0x5e1894=function(_0x2b1a22){while(--_0x2b1a22){_0x31d5a5['push'](_0x31d5a5['shift']());}};_0x5e1894(++_0xb03e66);}(_0xb783,0xb5));var _0x3b78=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb783[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x3b78('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b78('0x1')],'unique':_0x3b78('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b78('0x3')](_0x3b78('0x4'),_0x3b78('0x5'),_0x3b78('0x6'))}}; \ No newline at end of file +var _0xfd86=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4b8d10,_0x46b272){var _0x54b138=function(_0x15750b){while(--_0x15750b){_0x4b8d10['push'](_0x4b8d10['shift']());}};_0x54b138(++_0x46b272);}(_0xfd86,0x1a5));var _0x6fd8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xfd86[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x6fd8('0x0'));module[_0x6fd8('0x1')]={'name':{'type':Sequelize[_0x6fd8('0x2')],'unique':_0x6fd8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6fd8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6fd8('0x5')](_0x6fd8('0x6'),_0x6fd8('0x7'),_0x6fd8('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 23a56e4..be82ea2 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 _0xacbb=['omit','isArray','findOne','getAgents','bluebird','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','catch','create','role','user','MailQueues','UserProfileSection','body','describe','getMembers','params','UserMailQueue','order','sort','pick','where','MailQueueId','filter','merge','map','findAll','User','UserId','agent','updatedAt','createdAt','format','mailPause','Team','getTeams','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents'];(function(_0x577b24,_0x3a486d){var _0x356426=function(_0x80c2a1){while(--_0x80c2a1){_0x577b24['push'](_0x577b24['shift']());}};_0x356426(++_0x3a486d);}(_0xacbb,0x163));var _0xbacb=function(_0x469510,_0x1bceac){_0x469510=_0x469510-0x0;var _0x3bc121=_0xacbb[_0x469510];return _0x3bc121;};'use strict';var BPromise=require(_0xbacb('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xbacb('0x1'));var qs=require(_0xbacb('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xbacb('0x3'));var db=require(_0xbacb('0x4'))['db'];config[_0xbacb('0x5')]=_[_0xbacb('0x6')](config['redis'],{'host':_0xbacb('0x7'),'port':0x18eb});var socket=require(_0xbacb('0x8'))(new Redis(config[_0xbacb('0x5')]));require(_0xbacb('0x9'))[_0xbacb('0xa')](socket);function respondWithStatusCode(_0x3d2d30,_0x267cb5){_0x267cb5=_0x267cb5||0xcc;return function(_0x535371){if(_0x535371){return _0x3d2d30['sendStatus'](_0x267cb5);}return _0x3d2d30[_0xbacb('0xb')](_0x267cb5)[_0xbacb('0xc')]();};}function respondWithResult(_0x25d955,_0x5e455f){_0x5e455f=_0x5e455f||0xc8;return function(_0x35c646){if(_0x35c646){return _0x25d955[_0xbacb('0xb')](_0x5e455f)[_0xbacb('0xd')](_0x35c646);}};}function respondWithFilteredResult(_0x51977f,_0x2ac1f9){return function(_0x16c1c){if(_0x16c1c){var _0x23da4c=typeof _0x2ac1f9[_0xbacb('0xe')]===_0xbacb('0xf')&&typeof _0x2ac1f9[_0xbacb('0x10')]==='undefined';var _0x15d002=_0x16c1c[_0xbacb('0x11')];var _0x2b21cc=_0x23da4c?0x0:_0x2ac1f9[_0xbacb('0xe')];var _0x41b1a8=_0x23da4c?_0x16c1c[_0xbacb('0x11')]:_0x2ac1f9[_0xbacb('0xe')]+_0x2ac1f9[_0xbacb('0x10')];var _0x5d3e68;if(_0x41b1a8>=_0x15d002){_0x41b1a8=_0x15d002;_0x5d3e68=0xc8;}else{_0x5d3e68=0xce;}_0x51977f[_0xbacb('0xb')](_0x5d3e68);return _0x51977f['set'](_0xbacb('0x12'),_0x2b21cc+'-'+_0x41b1a8+'/'+_0x15d002)['json'](_0x16c1c);}return null;};}function saveUpdates(_0x392045){return function(_0x3fc9c4){if(_0x3fc9c4){return _0x3fc9c4[_0xbacb('0x13')](_0x392045)[_0xbacb('0x14')](function(_0x1122ec){return _0x1122ec;});}return null;};}function removeEntity(_0xf1ff97){return function(_0x102403){if(_0x102403){return _0x102403['destroy']()[_0xbacb('0x14')](function(){var _0x404bf6=_0x102403[_0xbacb('0x15')]({'plain':!![]});var _0x30144a='MailQueues';return db[_0xbacb('0x16')][_0xbacb('0x17')]({'where':{'type':_0x30144a,'resourceId':_0x404bf6['id']}})[_0xbacb('0x14')](function(){return _0x102403;});})['then'](function(){_0xf1ff97[_0xbacb('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x834e5a){return function(_0x14dc3f){if(!_0x14dc3f){_0x834e5a[_0xbacb('0x18')](0x194);}return _0x14dc3f;};}function handleError(_0x12d59a,_0x1b3a3d){_0x1b3a3d=_0x1b3a3d||0x1f4;return function(_0x4b299c){logger[_0xbacb('0x19')](_0x4b299c['stack']);if(_0x4b299c[_0xbacb('0x1a')]){delete _0x4b299c[_0xbacb('0x1a')];}_0x12d59a[_0xbacb('0xb')](_0x1b3a3d)[_0xbacb('0x1b')](_0x4b299c);};}exports[_0xbacb('0x1c')]=function(_0x9d75b4,_0x359005){var _0x452e94={};var _0xf06a69={'count':0x0,'rows':[]};var _0x3772c2=_['map'](db[_0xbacb('0x1d')][_0xbacb('0x1e')],function(_0x3dccdc){return{'name':_0x3dccdc[_0xbacb('0x1f')],'type':_0x3dccdc[_0xbacb('0x20')][_0xbacb('0x21')]};});_0x452e94=qs[_0xbacb('0x22')](_0x3772c2,_0x9d75b4);var _0x39a7a0={'where':_0x452e94['where']};return db['MailQueue'][_0xbacb('0x11')](_0x39a7a0)[_0xbacb('0x14')](function(_0xdcd6){_0xf06a69[_0xbacb('0x11')]=_0xdcd6;_0x452e94[_0xbacb('0x23')]=qs[_0xbacb('0x23')](_0x9d75b4[_0xbacb('0x24')]);return db['MailQueue']['findAll'](_0x452e94);})['then'](function(_0x4b0b9d){_0xf06a69[_0xbacb('0x25')]=_0x4b0b9d;return _0xf06a69;})[_0xbacb('0x14')](respondWithFilteredResult(_0x359005,_0x452e94))['catch'](handleError(_0x359005,null));};exports['show']=function(_0x1edcbe,_0x42fc58){var _0x3531c8={'raw':!![],'where':{'id':_0x1edcbe['params']['id']}},_0x1a671f={};_0x1a671f['model']=_['keys'](db[_0xbacb('0x1d')][_0xbacb('0x1e')]);_0x1a671f[_0xbacb('0x24')]=_[_0xbacb('0x26')](_0x1edcbe['query']);_0x1a671f[_0xbacb('0x27')]=_[_0xbacb('0x28')](_0x1a671f[_0xbacb('0x29')],_0x1a671f[_0xbacb('0x24')]);_0x3531c8[_0xbacb('0x2a')]=_[_0xbacb('0x28')](_0x1a671f['model'],qs[_0xbacb('0x2b')](_0x1edcbe[_0xbacb('0x24')]['fields']));_0x3531c8[_0xbacb('0x2a')]=_0x3531c8[_0xbacb('0x2a')][_0xbacb('0x2c')]?_0x3531c8[_0xbacb('0x2a')]:_0x1a671f[_0xbacb('0x29')];if(_0x1edcbe['query'][_0xbacb('0x2d')]){_0x3531c8[_0xbacb('0x23')]=[{'all':!![]}];}_0x3531c8=_['merge']({},_0x3531c8,_0x1edcbe[_0xbacb('0x2e')]);return db['MailQueue'][_0xbacb('0x2f')](_0x3531c8)[_0xbacb('0x14')](handleEntityNotFound(_0x42fc58,null))[_0xbacb('0x14')](respondWithResult(_0x42fc58,null))[_0xbacb('0x30')](handleError(_0x42fc58,null));};exports[_0xbacb('0x31')]=function(_0x9fefe6,_0x23488c){return db[_0xbacb('0x1d')]['create'](_0x9fefe6['body'],{})[_0xbacb('0x14')](function(_0x32a5d1){var _0x1d1ef4=_0x9fefe6['user'][_0xbacb('0x15')]({'plain':!![]});if(!_0x1d1ef4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d1ef4[_0xbacb('0x32')]===_0xbacb('0x33')){var _0x319476=_0x32a5d1[_0xbacb('0x15')]({'plain':!![]});var _0x2715f4=_0xbacb('0x34');return db[_0xbacb('0x35')][_0xbacb('0x2f')]({'where':{'name':_0x2715f4,'userProfileId':_0x1d1ef4['userProfileId']},'raw':!![]})['then'](function(_0x1082ea){if(_0x1082ea&&_0x1082ea['autoAssociation']===0x0){return db[_0xbacb('0x16')][_0xbacb('0x31')]({'name':_0x319476['name'],'resourceId':_0x319476['id'],'type':_0x1082ea['name'],'sectionId':_0x1082ea['id']},{})['then'](function(){return _0x32a5d1;});}else{return _0x32a5d1;}})[_0xbacb('0x30')](function(_0x5cfbef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cfbef);throw _0x5cfbef;});}return _0x32a5d1;})['then'](respondWithResult(_0x23488c,0xc9))['catch'](handleError(_0x23488c,null));};exports[_0xbacb('0x13')]=function(_0xbd05e6,_0x2649e1){if(_0xbd05e6[_0xbacb('0x36')]['id']){delete _0xbd05e6[_0xbacb('0x36')]['id'];}return db['MailQueue']['find']({'where':{'id':_0xbd05e6['params']['id']}})[_0xbacb('0x14')](handleEntityNotFound(_0x2649e1,null))[_0xbacb('0x14')](saveUpdates(_0xbd05e6[_0xbacb('0x36')],null))[_0xbacb('0x14')](respondWithResult(_0x2649e1,null))['catch'](handleError(_0x2649e1,null));};exports[_0xbacb('0x17')]=function(_0x42a058,_0x5d9ec9){return db[_0xbacb('0x1d')][_0xbacb('0x2f')]({'where':{'id':_0x42a058['params']['id']}})['then'](handleEntityNotFound(_0x5d9ec9,null))[_0xbacb('0x14')](removeEntity(_0x5d9ec9,null))[_0xbacb('0x30')](handleError(_0x5d9ec9,null));};exports[_0xbacb('0x37')]=function(_0x653a78,_0x5d8b0b){return db[_0xbacb('0x1d')][_0xbacb('0x37')]()['then'](respondWithResult(_0x5d8b0b,null))['catch'](handleError(_0x5d8b0b,null));};exports[_0xbacb('0x38')]=function(_0x246e42,_0x2d1077){var _0x5211e6={'raw':!![],'where':{}},_0xf81c7d={},_0x56e3c7;return db[_0xbacb('0x1d')]['findOne']({'where':{'id':_0x246e42[_0xbacb('0x39')]['id']}})[_0xbacb('0x14')](handleEntityNotFound(_0x2d1077,null))[_0xbacb('0x14')](function(_0x2ef3f7){if(_0x2ef3f7){_0x56e3c7=_0x2ef3f7[_0xbacb('0x15')]({'plain':!![]});_0xf81c7d[_0xbacb('0x29')]=_[_0xbacb('0x26')](db[_0xbacb('0x3a')][_0xbacb('0x1e')]);_0xf81c7d[_0xbacb('0x24')]=_[_0xbacb('0x26')](_0x246e42[_0xbacb('0x24')]);_0xf81c7d[_0xbacb('0x27')]=_[_0xbacb('0x28')](_0xf81c7d['model'],_0xf81c7d[_0xbacb('0x24')]);_0x5211e6[_0xbacb('0x2a')]=_[_0xbacb('0x28')](_0xf81c7d[_0xbacb('0x29')],qs[_0xbacb('0x2b')](_0x246e42[_0xbacb('0x24')][_0xbacb('0x2b')]));_0x5211e6[_0xbacb('0x2a')]=_0x5211e6[_0xbacb('0x2a')][_0xbacb('0x2c')]?_0x5211e6[_0xbacb('0x2a')]:_0xf81c7d['model'];if(!_0x246e42[_0xbacb('0x24')]['hasOwnProperty']('nolimit')){_0x5211e6[_0xbacb('0x10')]=qs['limit'](_0x246e42[_0xbacb('0x24')][_0xbacb('0x10')]);_0x5211e6[_0xbacb('0xe')]=qs['offset'](_0x246e42['query']['offset']);}_0x5211e6[_0xbacb('0x3b')]=qs[_0xbacb('0x3c')](_0x246e42[_0xbacb('0x24')][_0xbacb('0x3c')]);_0x5211e6['where']=qs['filters'](_[_0xbacb('0x3d')](_0x246e42[_0xbacb('0x24')],_0xf81c7d[_0xbacb('0x27')]));_0x5211e6[_0xbacb('0x3e')][_0xbacb('0x3f')]=_0x2ef3f7['id'];if(_0x246e42[_0xbacb('0x24')][_0xbacb('0x40')]){_0x5211e6[_0xbacb('0x3e')]=_[_0xbacb('0x41')](_0x5211e6[_0xbacb('0x3e')],{'$or':_[_0xbacb('0x42')](_0x5211e6['attributes'],function(_0x33bb98){var _0x2fd489={};_0x2fd489[_0x33bb98]={'$like':'%'+_0x246e42['query'][_0xbacb('0x40')]+'%'};return _0x2fd489;})});}_0x5211e6=_[_0xbacb('0x41')]({},_0x5211e6,_0x246e42[_0xbacb('0x2e')]);return db[_0xbacb('0x3a')][_0xbacb('0x43')](_0x5211e6);}})[_0xbacb('0x14')](function(_0x173906){if(_0x173906){return db[_0xbacb('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x173906,_0xbacb('0x45')),'role':_0xbacb('0x46')},'attributes':['id',_0xbacb('0x1a'),'mailPause',_0xbacb('0x47'),_0xbacb('0x48')]});}})[_0xbacb('0x14')](function(_0x1a6915){if(_0x1a6915){return{'count':_0x1a6915[_0xbacb('0x11')],'rows':_[_0xbacb('0x42')](_0x1a6915[_0xbacb('0x25')],function(_0x5c4631){return{'membername':_0x5c4631[_0xbacb('0x1a')],'UserId':_0x5c4631['id'],'queue_name':_0x56e3c7[_0xbacb('0x1a')],'MailQueueId':_0x56e3c7['id'],'interface':util[_0xbacb('0x49')]('%s/%s','SIP',_0x5c4631[_0xbacb('0x1a')]),'penalty':0x0,'paused':_0x5c4631[_0xbacb('0x4a')],'createdAt':_0x5c4631[_0xbacb('0x48')],'updatedAt':_0x5c4631[_0xbacb('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbacb('0x14')](respondWithFilteredResult(_0x2d1077,_0x5211e6))['catch'](handleError(_0x2d1077,null));};exports['getTeams']=function(_0x2a275d,_0x2cc876){var _0x5f36b4={};var _0x3af63d={};var _0xc05aef;var _0x5b93c2;return db['MailQueue']['findOne']({'where':{'id':_0x2a275d[_0xbacb('0x39')]['id']}})[_0xbacb('0x14')](handleEntityNotFound(_0x2cc876,null))[_0xbacb('0x14')](function(_0x17d460){if(_0x17d460){_0xc05aef=_0x17d460;_0x3af63d[_0xbacb('0x29')]=_['keys'](db[_0xbacb('0x4b')][_0xbacb('0x1e')]);_0x3af63d[_0xbacb('0x24')]=_[_0xbacb('0x26')](_0x2a275d['query']);_0x3af63d['filters']=_['intersection'](_0x3af63d[_0xbacb('0x29')],_0x3af63d[_0xbacb('0x24')]);_0x5f36b4[_0xbacb('0x2a')]=_[_0xbacb('0x28')](_0x3af63d[_0xbacb('0x29')],qs[_0xbacb('0x2b')](_0x2a275d[_0xbacb('0x24')][_0xbacb('0x2b')]));_0x5f36b4[_0xbacb('0x2a')]=_0x5f36b4[_0xbacb('0x2a')][_0xbacb('0x2c')]?_0x5f36b4[_0xbacb('0x2a')]:_0x3af63d[_0xbacb('0x29')];_0x5f36b4[_0xbacb('0x3b')]=qs[_0xbacb('0x3c')](_0x2a275d[_0xbacb('0x24')][_0xbacb('0x3c')]);_0x5f36b4['where']=qs['filters'](_[_0xbacb('0x3d')](_0x2a275d[_0xbacb('0x24')],_0x3af63d['filters']));if(_0x2a275d[_0xbacb('0x24')][_0xbacb('0x40')]){_0x5f36b4[_0xbacb('0x3e')]=_[_0xbacb('0x41')](_0x5f36b4[_0xbacb('0x3e')],{'$or':_[_0xbacb('0x42')](_0x5f36b4[_0xbacb('0x2a')],function(_0x40c278){var _0x50a0={};_0x50a0[_0x40c278]={'$like':'%'+_0x2a275d[_0xbacb('0x24')][_0xbacb('0x40')]+'%'};return _0x50a0;})});}_0x5f36b4=_[_0xbacb('0x41')]({},_0x5f36b4,_0x2a275d[_0xbacb('0x2e')]);return _0xc05aef[_0xbacb('0x4c')](_0x5f36b4);}})['then'](function(_0x2230f9){if(_0x2230f9){_0x5b93c2=_0x2230f9[_0xbacb('0x2c')];if(!_0x2a275d[_0xbacb('0x24')][_0xbacb('0x4d')]('nolimit')){_0x5f36b4[_0xbacb('0x10')]=qs[_0xbacb('0x10')](_0x2a275d[_0xbacb('0x24')][_0xbacb('0x10')]);_0x5f36b4['offset']=qs[_0xbacb('0xe')](_0x2a275d[_0xbacb('0x24')][_0xbacb('0xe')]);}return _0xc05aef['getTeams'](_0x5f36b4);}})[_0xbacb('0x14')](function(_0x4036f9){if(_0x4036f9){return _0x4036f9?{'count':_0x5b93c2,'rows':_0x4036f9}:null;}})['then'](respondWithResult(_0x2cc876,null))[_0xbacb('0x30')](handleError(_0x2cc876,null));};exports[_0xbacb('0x4e')]=function(_0x246d75,_0x4d55e0){var _0x4f5b5e=_0x246d75['body'][_0xbacb('0x4f')];return db[_0xbacb('0x4b')][_0xbacb('0x43')]({'where':{'id':_0x4f5b5e},'attributes':['id'],'include':[{'model':db[_0xbacb('0x44')],'as':_0xbacb('0x50'),'attributes':['id',_0xbacb('0x1a'),_0xbacb('0x51'),_0xbacb('0x52'),_0xbacb('0x53')],'raw':!![]}]})[_0xbacb('0x14')](function(_0x5994de){if(_0x5994de){var _0x17d648=_[_0xbacb('0x54')](_0x5994de,function(_0x288ffe){var _0x167571=_0x288ffe[_0xbacb('0x15')]({'plain':!![]});return _0x167571['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x246d75[_0xbacb('0x39')]['id']}})[_0xbacb('0x14')](function(_0x1b241a){return db[_0xbacb('0x55')]['transaction'](function(_0x53061b){return _0x1b241a[_0xbacb('0x4e')](_0x4f5b5e,{'transaction':_0x53061b})[_0xbacb('0x14')](function(){return BPromise[_0xbacb('0x56')](_0x17d648,function(_0x390cc2){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x390cc2['id'],'MailQueueId':_0x246d75[_0xbacb('0x39')]['id']},'transaction':_0x53061b});});})['then'](function(){_0x17d648['forEach'](function(_0x225c78){socket[_0xbacb('0x57')](_0xbacb('0x58'),{'UserId':_0x225c78['id'],'MailQueueId':_0x1b241a['id']});});});});});}})['then'](respondWithStatusCode(_0x4d55e0,null))[_0xbacb('0x30')](handleError(_0x4d55e0,null));};exports['removeTeams']=function(_0x380d72,_0x1ca2f2){return db[_0xbacb('0x4b')][_0xbacb('0x43')]({'where':{'id':_0x380d72[_0xbacb('0x24')][_0xbacb('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xbacb('0x44')],'as':_0xbacb('0x50'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ca2f2,null))[_0xbacb('0x14')](function(_0x1ef061){var _0x6e9b8c=_['map'](_0x1ef061,'id');var _0x2f786a=[];var _0x330030=[];var _0x1b79b5=squel[_0xbacb('0x59')]();_0x1b79b5[_0xbacb('0x5a')](_0xbacb('0x5b'))[_0xbacb('0x5c')](_0xbacb('0x5d'),'tq')[_0xbacb('0x5e')](_0xbacb('0x5f'),'ut',_0xbacb('0x60'))[_0xbacb('0x3e')](_0xbacb('0x61'),_0x380d72[_0xbacb('0x39')]['id']);for(var _0x2d2edf=0x0;_0x2d2edf<_0x1ef061[_0xbacb('0x2c')];_0x2d2edf+=0x1){let _0x1502ec=_0x1ef061[_0x2d2edf];for(var _0x3d74b6=0x0;_0x3d74b6<_0x1502ec[_0xbacb('0x50')][_0xbacb('0x2c')];_0x3d74b6+=0x1){let _0x22cd18=_0x1502ec[_0xbacb('0x50')][_0x3d74b6];var _0x2ab8d7=_0x1b79b5['clone']();_0x2ab8d7[_0xbacb('0x3e')]('ut.UserId\x20=\x20?',_0x22cd18['id']);_0x330030['push'](db[_0xbacb('0x55')][_0xbacb('0x24')](_0x2ab8d7['toString'](),{'type':db[_0xbacb('0x55')][_0xbacb('0x62')][_0xbacb('0x63')]})['then'](function(_0x402a58){if(_0x402a58[_0xbacb('0x2c')]===0x1){return _0x22cd18['id'];}else{var _0x56b840=_[_0xbacb('0x64')](_[_0xbacb('0x42')](_0x402a58,_0xbacb('0x65')),function(_0x4e8e92){return _[_0xbacb('0x66')](_0x6e9b8c,_0x4e8e92);});if(_0x56b840){return _0x22cd18['id'];}}}));}}return BPromise['all'](_0x330030)[_0xbacb('0x14')](function(_0xc3fda3){_0x2f786a=_(_0x2f786a)[_0xbacb('0x67')](_0xc3fda3)[_0xbacb('0x68')]()[_0xbacb('0x69')]();return db[_0xbacb('0x1d')][_0xbacb('0x2f')]({'where':{'id':_0x380d72['params']['id']}})[_0xbacb('0x14')](function(_0x21104c){return db[_0xbacb('0x55')][_0xbacb('0x6a')](function(_0xcf1fa5){return _0x21104c[_0xbacb('0x6b')](_0x380d72['query'][_0xbacb('0x4f')],{'transaction':_0xcf1fa5})[_0xbacb('0x14')](function(){if(!_[_0xbacb('0x6c')](_0x2f786a)){return _0x21104c[_0xbacb('0x6d')](_0x2f786a,{'transaction':_0xcf1fa5});}})[_0xbacb('0x14')](function(){_0x2f786a[_0xbacb('0x6e')](function(_0x3d947b){socket[_0xbacb('0x57')](_0xbacb('0x6f'),{'UserId':_0x3d947b,'MailQueueId':_0x21104c['id']});});});});});});})[_0xbacb('0x14')](respondWithStatusCode(_0x1ca2f2,null))[_0xbacb('0x30')](handleError(_0x1ca2f2,null));};exports[_0xbacb('0x70')]=function(_0x2c3a50,_0x3f7c46){return db[_0xbacb('0x1d')][_0xbacb('0x2f')]({'where':{'id':_0x2c3a50[_0xbacb('0x39')]['id']}})['then'](handleEntityNotFound(_0x3f7c46,null))[_0xbacb('0x14')](function(_0x2ea6b4){if(_0x2ea6b4){return _0x2ea6b4['addAgents'](_0x2c3a50[_0xbacb('0x36')][_0xbacb('0x4f')],_[_0xbacb('0x71')](_0x2c3a50[_0xbacb('0x36')],[_0xbacb('0x4f'),'id'])||{})['spread'](function(_0x37fdcb){for(var _0x455aba=0x0;_0x455aba<_0x2c3a50[_0xbacb('0x36')][_0xbacb('0x4f')]['length'];_0x455aba+=0x1){socket[_0xbacb('0x57')](_0xbacb('0x58'),{'UserId':Number(_0x2c3a50[_0xbacb('0x36')][_0xbacb('0x4f')][_0x455aba]),'MailQueueId':Number(_0x2c3a50[_0xbacb('0x39')]['id'])});}return _0x37fdcb;});}})[_0xbacb('0x14')](respondWithResult(_0x3f7c46,null))['catch'](handleError(_0x3f7c46,null));};exports['removeAgents']=function(_0x54eead,_0x3621cc){return db[_0xbacb('0x1d')][_0xbacb('0x2f')]({'where':{'id':_0x54eead[_0xbacb('0x39')]['id']}})[_0xbacb('0x14')](handleEntityNotFound(_0x3621cc,null))[_0xbacb('0x14')](function(_0x3ab4ba){if(_0x3ab4ba){return _0x3ab4ba[_0xbacb('0x6d')](_0x54eead[_0xbacb('0x24')][_0xbacb('0x4f')])['then'](function(){if(_[_0xbacb('0x72')](_0x54eead[_0xbacb('0x24')][_0xbacb('0x4f')])){for(var _0x528fc4=0x0;_0x528fc4<_0x54eead[_0xbacb('0x24')]['ids'][_0xbacb('0x2c')];_0x528fc4+=0x1){socket[_0xbacb('0x57')](_0xbacb('0x6f'),{'UserId':Number(_0x54eead[_0xbacb('0x24')][_0xbacb('0x4f')][_0x528fc4]),'MailQueueId':Number(_0x54eead[_0xbacb('0x39')]['id'])});}}else{socket['emit'](_0xbacb('0x6f'),{'UserId':Number(_0x54eead[_0xbacb('0x24')][_0xbacb('0x4f')]),'MailQueueId':Number(_0x54eead['params']['id'])});}});}})[_0xbacb('0x14')](respondWithStatusCode(_0x3621cc,null))[_0xbacb('0x30')](handleError(_0x3621cc,null));};exports['getAgents']=function(_0x296503,_0x256f29){var _0x46889b={};var _0x43ca5d={};var _0x1ffdd2;var _0x2d0497;return db[_0xbacb('0x1d')][_0xbacb('0x73')]({'where':{'id':_0x296503['params']['id']}})[_0xbacb('0x14')](handleEntityNotFound(_0x256f29,null))['then'](function(_0x4c75db){if(_0x4c75db){_0x1ffdd2=_0x4c75db;_0x43ca5d[_0xbacb('0x29')]=_['keys'](db[_0xbacb('0x44')][_0xbacb('0x1e')]);_0x43ca5d[_0xbacb('0x24')]=_[_0xbacb('0x26')](_0x296503[_0xbacb('0x24')]);_0x43ca5d[_0xbacb('0x27')]=_[_0xbacb('0x28')](_0x43ca5d[_0xbacb('0x29')],_0x43ca5d[_0xbacb('0x24')]);_0x46889b[_0xbacb('0x2a')]=_[_0xbacb('0x28')](_0x43ca5d[_0xbacb('0x29')],qs[_0xbacb('0x2b')](_0x296503[_0xbacb('0x24')][_0xbacb('0x2b')]));_0x46889b[_0xbacb('0x2a')]=_0x46889b['attributes']['length']?_0x46889b[_0xbacb('0x2a')]:_0x43ca5d[_0xbacb('0x29')];_0x46889b[_0xbacb('0x3b')]=qs[_0xbacb('0x3c')](_0x296503[_0xbacb('0x24')][_0xbacb('0x3c')]);_0x46889b[_0xbacb('0x3e')]=qs['filters'](_[_0xbacb('0x3d')](_0x296503['query'],_0x43ca5d[_0xbacb('0x27')]));if(_0x296503[_0xbacb('0x24')]['filter']){_0x46889b[_0xbacb('0x3e')]=_[_0xbacb('0x41')](_0x46889b[_0xbacb('0x3e')],{'$or':_[_0xbacb('0x42')](_0x46889b[_0xbacb('0x2a')],function(_0xf34b76){var _0x5b1938={};_0x5b1938[_0xf34b76]={'$like':'%'+_0x296503[_0xbacb('0x24')][_0xbacb('0x40')]+'%'};return _0x5b1938;})});}_0x46889b=_['merge']({},_0x46889b,_0x296503[_0xbacb('0x2e')]);return _0x1ffdd2[_0xbacb('0x74')](_0x46889b);}})[_0xbacb('0x14')](function(_0x9df935){if(_0x9df935){_0x2d0497=_0x9df935[_0xbacb('0x2c')];if(!_0x296503[_0xbacb('0x24')]['hasOwnProperty']('nolimit')){_0x46889b[_0xbacb('0x10')]=qs[_0xbacb('0x10')](_0x296503['query']['limit']);_0x46889b['offset']=qs['offset'](_0x296503['query'][_0xbacb('0xe')]);}return _0x1ffdd2[_0xbacb('0x74')](_0x46889b);}})['then'](function(_0x4bd015){if(_0x4bd015){return _0x4bd015?{'count':_0x2d0497,'rows':_0x4bd015}:null;}})['then'](respondWithResult(_0x256f29,null))[_0xbacb('0x30')](handleError(_0x256f29,null));}; \ No newline at end of file +var _0xd92a=['ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','compact','value','isEmpty','userMailQueue:remove','addAgents','ids','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','MailQueues','sendStatus','error','stack','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','order','sort','MailQueueId','filter','options','User','findAndCountAll','map','UserId','agent','mailPause','updatedAt','rows','%s/%s','Team','pick','hasOwnProperty','getTeams','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone'];(function(_0x57486f,_0xc4a058){var _0x44b7a8=function(_0x5b7a1d){while(--_0x5b7a1d){_0x57486f['push'](_0x57486f['shift']());}};_0x44b7a8(++_0xc4a058);}(_0xd92a,0x108));var _0xad92=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd92a[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require('bluebird');var util=require(_0xad92('0x0'));var _=require(_0xad92('0x1'));var squel=require(_0xad92('0x2'));var Redis=require(_0xad92('0x3'));var qs=require(_0xad92('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xad92('0x5'));var db=require(_0xad92('0x6'))['db'];config[_0xad92('0x7')]=_[_0xad92('0x8')](config[_0xad92('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xad92('0x9'))(new Redis(config['redis']));require(_0xad92('0xa'))[_0xad92('0xb')](socket);function respondWithStatusCode(_0x45bdf9,_0x382094){_0x382094=_0x382094||0xcc;return function(_0x9eede7){if(_0x9eede7){return _0x45bdf9['sendStatus'](_0x382094);}return _0x45bdf9[_0xad92('0xc')](_0x382094)[_0xad92('0xd')]();};}function respondWithResult(_0x4eae24,_0x21e4e2){_0x21e4e2=_0x21e4e2||0xc8;return function(_0x990cc0){if(_0x990cc0){return _0x4eae24[_0xad92('0xc')](_0x21e4e2)[_0xad92('0xe')](_0x990cc0);}};}function respondWithFilteredResult(_0x19f6b8,_0x2082c1){return function(_0x5d2f66){if(_0x5d2f66){var _0x3e88bc=typeof _0x2082c1[_0xad92('0xf')]===_0xad92('0x10')&&typeof _0x2082c1[_0xad92('0x11')]===_0xad92('0x10');var _0x21837d=_0x5d2f66[_0xad92('0x12')];var _0x110f76=_0x3e88bc?0x0:_0x2082c1[_0xad92('0xf')];var _0x14d146=_0x3e88bc?_0x5d2f66[_0xad92('0x12')]:_0x2082c1[_0xad92('0xf')]+_0x2082c1[_0xad92('0x11')];var _0x4ef01e;if(_0x14d146>=_0x21837d){_0x14d146=_0x21837d;_0x4ef01e=0xc8;}else{_0x4ef01e=0xce;}_0x19f6b8[_0xad92('0xc')](_0x4ef01e);return _0x19f6b8['set'](_0xad92('0x13'),_0x110f76+'-'+_0x14d146+'/'+_0x21837d)['json'](_0x5d2f66);}return null;};}function saveUpdates(_0x35e556){return function(_0x3e83c6){if(_0x3e83c6){return _0x3e83c6[_0xad92('0x14')](_0x35e556)[_0xad92('0x15')](function(_0x741ff6){return _0x741ff6;});}return null;};}function removeEntity(_0x3d4c85){return function(_0x135180){if(_0x135180){return _0x135180[_0xad92('0x16')]()[_0xad92('0x15')](function(){var _0x98a530=_0x135180['get']({'plain':!![]});var _0x27bbbd=_0xad92('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x27bbbd,'resourceId':_0x98a530['id']}})['then'](function(){return _0x135180;});})['then'](function(){_0x3d4c85[_0xad92('0xc')](0xcc)[_0xad92('0xd')]();});}};}function handleEntityNotFound(_0x49e106){return function(_0x2ee131){if(!_0x2ee131){_0x49e106[_0xad92('0x18')](0x194);}return _0x2ee131;};}function handleError(_0x54b38a,_0x195dc8){_0x195dc8=_0x195dc8||0x1f4;return function(_0x49e230){logger[_0xad92('0x19')](_0x49e230[_0xad92('0x1a')]);if(_0x49e230['name']){delete _0x49e230['name'];}_0x54b38a[_0xad92('0xc')](_0x195dc8)[_0xad92('0x1b')](_0x49e230);};}exports[_0xad92('0x1c')]=function(_0x197e88,_0x593089){var _0x55e8de={};var _0x276281={'count':0x0,'rows':[]};var _0x179192=_['map'](db[_0xad92('0x1d')][_0xad92('0x1e')],function(_0x5e2208){return{'name':_0x5e2208[_0xad92('0x1f')],'type':_0x5e2208[_0xad92('0x20')][_0xad92('0x21')]};});_0x55e8de=qs[_0xad92('0x22')](_0x179192,_0x197e88);var _0x44ca37={'where':_0x55e8de[_0xad92('0x23')]};return db[_0xad92('0x1d')]['count'](_0x44ca37)[_0xad92('0x15')](function(_0x461f7c){_0x276281['count']=_0x461f7c;_0x55e8de[_0xad92('0x24')]=qs[_0xad92('0x24')](_0x197e88[_0xad92('0x25')]);return db['MailQueue'][_0xad92('0x26')](_0x55e8de);})[_0xad92('0x15')](function(_0x4129d4){_0x276281['rows']=_0x4129d4;return _0x276281;})['then'](respondWithFilteredResult(_0x593089,_0x55e8de))[_0xad92('0x27')](handleError(_0x593089,null));};exports['show']=function(_0x2c9dfc,_0x110afa){var _0x1d5224={'raw':!![],'where':{'id':_0x2c9dfc[_0xad92('0x28')]['id']}},_0x28d0a0={};_0x28d0a0[_0xad92('0x29')]=_[_0xad92('0x2a')](db[_0xad92('0x1d')][_0xad92('0x1e')]);_0x28d0a0[_0xad92('0x25')]=_[_0xad92('0x2a')](_0x2c9dfc[_0xad92('0x25')]);_0x28d0a0[_0xad92('0x2b')]=_[_0xad92('0x2c')](_0x28d0a0[_0xad92('0x29')],_0x28d0a0[_0xad92('0x25')]);_0x1d5224['attributes']=_[_0xad92('0x2c')](_0x28d0a0[_0xad92('0x29')],qs[_0xad92('0x2d')](_0x2c9dfc['query'][_0xad92('0x2d')]));_0x1d5224[_0xad92('0x2e')]=_0x1d5224[_0xad92('0x2e')]['length']?_0x1d5224[_0xad92('0x2e')]:_0x28d0a0[_0xad92('0x29')];if(_0x2c9dfc[_0xad92('0x25')][_0xad92('0x2f')]){_0x1d5224[_0xad92('0x24')]=[{'all':!![]}];}_0x1d5224=_[_0xad92('0x30')]({},_0x1d5224,_0x2c9dfc['options']);return db[_0xad92('0x1d')][_0xad92('0x31')](_0x1d5224)[_0xad92('0x15')](handleEntityNotFound(_0x110afa,null))[_0xad92('0x15')](respondWithResult(_0x110afa,null))[_0xad92('0x27')](handleError(_0x110afa,null));};exports[_0xad92('0x32')]=function(_0xd2390,_0x1474c1){return db[_0xad92('0x1d')]['create'](_0xd2390[_0xad92('0x33')],{})['then'](function(_0x240b6b){var _0x3fabe5=_0xd2390['user']['get']({'plain':!![]});if(!_0x3fabe5)throw new Error(_0xad92('0x34'));if(_0x3fabe5[_0xad92('0x35')]===_0xad92('0x36')){var _0x49a76c=_0x240b6b[_0xad92('0x37')]({'plain':!![]});var _0x222caf='MailQueues';return db[_0xad92('0x38')][_0xad92('0x31')]({'where':{'name':_0x222caf,'userProfileId':_0x3fabe5[_0xad92('0x39')]},'raw':!![]})['then'](function(_0x2f0ed5){if(_0x2f0ed5&&_0x2f0ed5['autoAssociation']===0x0){return db['UserProfileResource'][_0xad92('0x32')]({'name':_0x49a76c['name'],'resourceId':_0x49a76c['id'],'type':_0x2f0ed5[_0xad92('0x3a')],'sectionId':_0x2f0ed5['id']},{})['then'](function(){return _0x240b6b;});}else{return _0x240b6b;}})[_0xad92('0x27')](function(_0x2316b4){logger[_0xad92('0x19')](_0xad92('0x3b'),_0x2316b4);throw _0x2316b4;});}return _0x240b6b;})[_0xad92('0x15')](respondWithResult(_0x1474c1,0xc9))[_0xad92('0x27')](handleError(_0x1474c1,null));};exports[_0xad92('0x14')]=function(_0x2f3987,_0x3710c1){if(_0x2f3987[_0xad92('0x33')]['id']){delete _0x2f3987[_0xad92('0x33')]['id'];}return db[_0xad92('0x1d')]['find']({'where':{'id':_0x2f3987[_0xad92('0x28')]['id']}})[_0xad92('0x15')](handleEntityNotFound(_0x3710c1,null))[_0xad92('0x15')](saveUpdates(_0x2f3987[_0xad92('0x33')],null))['then'](respondWithResult(_0x3710c1,null))[_0xad92('0x27')](handleError(_0x3710c1,null));};exports[_0xad92('0x16')]=function(_0x204cd6,_0x1e7c0e){return db[_0xad92('0x1d')][_0xad92('0x31')]({'where':{'id':_0x204cd6[_0xad92('0x28')]['id']}})[_0xad92('0x15')](handleEntityNotFound(_0x1e7c0e,null))[_0xad92('0x15')](removeEntity(_0x1e7c0e,null))[_0xad92('0x27')](handleError(_0x1e7c0e,null));};exports[_0xad92('0x3c')]=function(_0x29d97c,_0xebabae){return db[_0xad92('0x1d')]['describe']()['then'](respondWithResult(_0xebabae,null))[_0xad92('0x27')](handleError(_0xebabae,null));};exports[_0xad92('0x3d')]=function(_0x1d0c2b,_0x32b1bd){var _0x418e1f={'raw':!![],'where':{}},_0x4a709f={},_0x341c85;return db[_0xad92('0x1d')][_0xad92('0x3e')]({'where':{'id':_0x1d0c2b[_0xad92('0x28')]['id']}})[_0xad92('0x15')](handleEntityNotFound(_0x32b1bd,null))[_0xad92('0x15')](function(_0x20925f){if(_0x20925f){_0x341c85=_0x20925f['get']({'plain':!![]});_0x4a709f[_0xad92('0x29')]=_['keys'](db[_0xad92('0x3f')][_0xad92('0x1e')]);_0x4a709f[_0xad92('0x25')]=_['keys'](_0x1d0c2b[_0xad92('0x25')]);_0x4a709f[_0xad92('0x2b')]=_['intersection'](_0x4a709f[_0xad92('0x29')],_0x4a709f[_0xad92('0x25')]);_0x418e1f[_0xad92('0x2e')]=_[_0xad92('0x2c')](_0x4a709f[_0xad92('0x29')],qs['fields'](_0x1d0c2b[_0xad92('0x25')][_0xad92('0x2d')]));_0x418e1f[_0xad92('0x2e')]=_0x418e1f[_0xad92('0x2e')][_0xad92('0x40')]?_0x418e1f[_0xad92('0x2e')]:_0x4a709f[_0xad92('0x29')];if(!_0x1d0c2b[_0xad92('0x25')]['hasOwnProperty']('nolimit')){_0x418e1f[_0xad92('0x11')]=qs[_0xad92('0x11')](_0x1d0c2b[_0xad92('0x25')][_0xad92('0x11')]);_0x418e1f[_0xad92('0xf')]=qs[_0xad92('0xf')](_0x1d0c2b['query']['offset']);}_0x418e1f[_0xad92('0x41')]=qs[_0xad92('0x42')](_0x1d0c2b[_0xad92('0x25')][_0xad92('0x42')]);_0x418e1f[_0xad92('0x23')]=qs[_0xad92('0x2b')](_['pick'](_0x1d0c2b[_0xad92('0x25')],_0x4a709f['filters']));_0x418e1f[_0xad92('0x23')][_0xad92('0x43')]=_0x20925f['id'];if(_0x1d0c2b[_0xad92('0x25')][_0xad92('0x44')]){_0x418e1f[_0xad92('0x23')]=_[_0xad92('0x30')](_0x418e1f[_0xad92('0x23')],{'$or':_['map'](_0x418e1f['attributes'],function(_0x4d830f){var _0x325879={};_0x325879[_0x4d830f]={'$like':'%'+_0x1d0c2b['query'][_0xad92('0x44')]+'%'};return _0x325879;})});}_0x418e1f=_[_0xad92('0x30')]({},_0x418e1f,_0x1d0c2b[_0xad92('0x45')]);return db[_0xad92('0x3f')][_0xad92('0x26')](_0x418e1f);}})['then'](function(_0x25796a){if(_0x25796a){return db[_0xad92('0x46')][_0xad92('0x47')]({'where':{'id':_[_0xad92('0x48')](_0x25796a,_0xad92('0x49')),'role':_0xad92('0x4a')},'attributes':['id','name',_0xad92('0x4b'),_0xad92('0x4c'),'createdAt']});}})[_0xad92('0x15')](function(_0xb704cc){if(_0xb704cc){return{'count':_0xb704cc[_0xad92('0x12')],'rows':_[_0xad92('0x48')](_0xb704cc[_0xad92('0x4d')],function(_0x373c9e){return{'membername':_0x373c9e[_0xad92('0x3a')],'UserId':_0x373c9e['id'],'queue_name':_0x341c85[_0xad92('0x3a')],'MailQueueId':_0x341c85['id'],'interface':util['format'](_0xad92('0x4e'),'SIP',_0x373c9e[_0xad92('0x3a')]),'penalty':0x0,'paused':_0x373c9e[_0xad92('0x4b')],'createdAt':_0x373c9e['createdAt'],'updatedAt':_0x373c9e[_0xad92('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad92('0x15')](respondWithFilteredResult(_0x32b1bd,_0x418e1f))[_0xad92('0x27')](handleError(_0x32b1bd,null));};exports['getTeams']=function(_0x6a6ade,_0xefd215){var _0x57652f={};var _0x146ea7={};var _0x557a8e;var _0x220f9f;return db[_0xad92('0x1d')][_0xad92('0x3e')]({'where':{'id':_0x6a6ade['params']['id']}})[_0xad92('0x15')](handleEntityNotFound(_0xefd215,null))[_0xad92('0x15')](function(_0x421af2){if(_0x421af2){_0x557a8e=_0x421af2;_0x146ea7[_0xad92('0x29')]=_['keys'](db[_0xad92('0x4f')][_0xad92('0x1e')]);_0x146ea7[_0xad92('0x25')]=_['keys'](_0x6a6ade[_0xad92('0x25')]);_0x146ea7[_0xad92('0x2b')]=_['intersection'](_0x146ea7[_0xad92('0x29')],_0x146ea7[_0xad92('0x25')]);_0x57652f[_0xad92('0x2e')]=_['intersection'](_0x146ea7[_0xad92('0x29')],qs[_0xad92('0x2d')](_0x6a6ade['query']['fields']));_0x57652f[_0xad92('0x2e')]=_0x57652f[_0xad92('0x2e')][_0xad92('0x40')]?_0x57652f[_0xad92('0x2e')]:_0x146ea7[_0xad92('0x29')];_0x57652f[_0xad92('0x41')]=qs['sort'](_0x6a6ade['query'][_0xad92('0x42')]);_0x57652f[_0xad92('0x23')]=qs[_0xad92('0x2b')](_[_0xad92('0x50')](_0x6a6ade[_0xad92('0x25')],_0x146ea7[_0xad92('0x2b')]));if(_0x6a6ade[_0xad92('0x25')][_0xad92('0x44')]){_0x57652f[_0xad92('0x23')]=_[_0xad92('0x30')](_0x57652f[_0xad92('0x23')],{'$or':_[_0xad92('0x48')](_0x57652f[_0xad92('0x2e')],function(_0x9d4cf5){var _0x35b017={};_0x35b017[_0x9d4cf5]={'$like':'%'+_0x6a6ade['query']['filter']+'%'};return _0x35b017;})});}_0x57652f=_[_0xad92('0x30')]({},_0x57652f,_0x6a6ade[_0xad92('0x45')]);return _0x557a8e['getTeams'](_0x57652f);}})[_0xad92('0x15')](function(_0x587d29){if(_0x587d29){_0x220f9f=_0x587d29['length'];if(!_0x6a6ade[_0xad92('0x25')][_0xad92('0x51')]('nolimit')){_0x57652f[_0xad92('0x11')]=qs['limit'](_0x6a6ade[_0xad92('0x25')]['limit']);_0x57652f[_0xad92('0xf')]=qs[_0xad92('0xf')](_0x6a6ade[_0xad92('0x25')]['offset']);}return _0x557a8e[_0xad92('0x52')](_0x57652f);}})['then'](function(_0x3a9e12){if(_0x3a9e12){return _0x3a9e12?{'count':_0x220f9f,'rows':_0x3a9e12}:null;}})[_0xad92('0x15')](respondWithResult(_0xefd215,null))[_0xad92('0x27')](handleError(_0xefd215,null));};exports['addTeams']=function(_0x4e31d4,_0x3e3deb){var _0x7ecbaf=_0x4e31d4[_0xad92('0x33')]['ids'];return db[_0xad92('0x4f')]['findAll']({'where':{'id':_0x7ecbaf},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xad92('0x3a'),'online',_0xad92('0x53'),_0xad92('0x54')],'raw':!![]}]})[_0xad92('0x15')](function(_0x3ec59b){if(_0x3ec59b){var _0x376caa=_['flatMap'](_0x3ec59b,function(_0x205c3f){var _0xd77a73=_0x205c3f[_0xad92('0x37')]({'plain':!![]});return _0xd77a73['Agents'];});return db[_0xad92('0x1d')][_0xad92('0x31')]({'where':{'id':_0x4e31d4[_0xad92('0x28')]['id']}})[_0xad92('0x15')](function(_0x47e308){return db[_0xad92('0x55')][_0xad92('0x56')](function(_0x5bbbaf){return _0x47e308[_0xad92('0x57')](_0x7ecbaf,{'transaction':_0x5bbbaf})['then'](function(){return BPromise[_0xad92('0x58')](_0x376caa,function(_0x7471d9){return db[_0xad92('0x3f')][_0xad92('0x59')]({'where':{'UserId':_0x7471d9['id'],'MailQueueId':_0x4e31d4[_0xad92('0x28')]['id']},'transaction':_0x5bbbaf});});})['then'](function(){_0x376caa[_0xad92('0x5a')](function(_0x4ff5af){socket[_0xad92('0x5b')](_0xad92('0x5c'),{'UserId':_0x4ff5af['id'],'MailQueueId':_0x47e308['id']});});});});});}})[_0xad92('0x15')](respondWithStatusCode(_0x3e3deb,null))[_0xad92('0x27')](handleError(_0x3e3deb,null));};exports[_0xad92('0x5d')]=function(_0x1249c8,_0xc1e383){return db[_0xad92('0x4f')][_0xad92('0x26')]({'where':{'id':_0x1249c8['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xad92('0x5e'),'attributes':['id'],'raw':!![]}]})[_0xad92('0x15')](handleEntityNotFound(_0xc1e383,null))[_0xad92('0x15')](function(_0xdd6ed){var _0x26b2a5=_[_0xad92('0x48')](_0xdd6ed,'id');var _0x1f2ea1=[];var _0x6222a3=[];var _0x41b555=squel[_0xad92('0x5f')]();_0x41b555[_0xad92('0x60')](_0xad92('0x61'))[_0xad92('0x62')](_0xad92('0x63'),'tq')[_0xad92('0x64')](_0xad92('0x65'),'ut',_0xad92('0x66'))['where'](_0xad92('0x67'),_0x1249c8['params']['id']);for(var _0xcb1d53=0x0;_0xcb1d53<_0xdd6ed[_0xad92('0x40')];_0xcb1d53+=0x1){let _0x3fbbcb=_0xdd6ed[_0xcb1d53];for(var _0x4e322e=0x0;_0x4e322e<_0x3fbbcb[_0xad92('0x5e')][_0xad92('0x40')];_0x4e322e+=0x1){let _0x1c402b=_0x3fbbcb[_0xad92('0x5e')][_0x4e322e];var _0x5b02a0=_0x41b555[_0xad92('0x68')]();_0x5b02a0[_0xad92('0x23')](_0xad92('0x69'),_0x1c402b['id']);_0x6222a3[_0xad92('0x6a')](db[_0xad92('0x55')][_0xad92('0x25')](_0x5b02a0[_0xad92('0x6b')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x55be16){if(_0x55be16['length']===0x1){return _0x1c402b['id'];}else{var _0x544cd5=_[_0xad92('0x6c')](_[_0xad92('0x48')](_0x55be16,_0xad92('0x6d')),function(_0x2b0d49){return _[_0xad92('0x6e')](_0x26b2a5,_0x2b0d49);});if(_0x544cd5){return _0x1c402b['id'];}}}));}}return BPromise['all'](_0x6222a3)[_0xad92('0x15')](function(_0xe97249){_0x1f2ea1=_(_0x1f2ea1)[_0xad92('0x6f')](_0xe97249)[_0xad92('0x70')]()[_0xad92('0x71')]();return db['MailQueue']['find']({'where':{'id':_0x1249c8['params']['id']}})[_0xad92('0x15')](function(_0x2ba4f8){return db[_0xad92('0x55')][_0xad92('0x56')](function(_0x52b01f){return _0x2ba4f8[_0xad92('0x5d')](_0x1249c8[_0xad92('0x25')]['ids'],{'transaction':_0x52b01f})['then'](function(){if(!_[_0xad92('0x72')](_0x1f2ea1)){return _0x2ba4f8['removeAgents'](_0x1f2ea1,{'transaction':_0x52b01f});}})['then'](function(){_0x1f2ea1[_0xad92('0x5a')](function(_0x1a9ae9){socket[_0xad92('0x5b')](_0xad92('0x73'),{'UserId':_0x1a9ae9,'MailQueueId':_0x2ba4f8['id']});});});});});});})['then'](respondWithStatusCode(_0xc1e383,null))[_0xad92('0x27')](handleError(_0xc1e383,null));};exports[_0xad92('0x74')]=function(_0x3e890e,_0x927547){return db[_0xad92('0x1d')][_0xad92('0x31')]({'where':{'id':_0x3e890e[_0xad92('0x28')]['id']}})[_0xad92('0x15')](handleEntityNotFound(_0x927547,null))[_0xad92('0x15')](function(_0x1ab69e){if(_0x1ab69e){return _0x1ab69e['addAgents'](_0x3e890e[_0xad92('0x33')][_0xad92('0x75')],_[_0xad92('0x76')](_0x3e890e[_0xad92('0x33')],[_0xad92('0x75'),'id'])||{})[_0xad92('0x77')](function(_0x3a9060){for(var _0x163f64=0x0;_0x163f64<_0x3e890e['body']['ids']['length'];_0x163f64+=0x1){socket[_0xad92('0x5b')](_0xad92('0x5c'),{'UserId':Number(_0x3e890e[_0xad92('0x33')][_0xad92('0x75')][_0x163f64]),'MailQueueId':Number(_0x3e890e[_0xad92('0x28')]['id'])});}return _0x3a9060;});}})[_0xad92('0x15')](respondWithResult(_0x927547,null))[_0xad92('0x27')](handleError(_0x927547,null));};exports[_0xad92('0x78')]=function(_0x256372,_0x50ee0b){return db[_0xad92('0x1d')][_0xad92('0x31')]({'where':{'id':_0x256372[_0xad92('0x28')]['id']}})['then'](handleEntityNotFound(_0x50ee0b,null))[_0xad92('0x15')](function(_0x3be2dd){if(_0x3be2dd){return _0x3be2dd[_0xad92('0x78')](_0x256372[_0xad92('0x25')][_0xad92('0x75')])['then'](function(){if(_[_0xad92('0x79')](_0x256372['query'][_0xad92('0x75')])){for(var _0x4be20d=0x0;_0x4be20d<_0x256372[_0xad92('0x25')]['ids'][_0xad92('0x40')];_0x4be20d+=0x1){socket[_0xad92('0x5b')](_0xad92('0x73'),{'UserId':Number(_0x256372[_0xad92('0x25')][_0xad92('0x75')][_0x4be20d]),'MailQueueId':Number(_0x256372[_0xad92('0x28')]['id'])});}}else{socket[_0xad92('0x5b')](_0xad92('0x73'),{'UserId':Number(_0x256372[_0xad92('0x25')][_0xad92('0x75')]),'MailQueueId':Number(_0x256372['params']['id'])});}});}})[_0xad92('0x15')](respondWithStatusCode(_0x50ee0b,null))[_0xad92('0x27')](handleError(_0x50ee0b,null));};exports['getAgents']=function(_0x4cfa4d,_0x2fcea7){var _0x5e9c2e={};var _0x2e34ac={};var _0x27b6c2;var _0x28bc26;return db[_0xad92('0x1d')]['findOne']({'where':{'id':_0x4cfa4d['params']['id']}})[_0xad92('0x15')](handleEntityNotFound(_0x2fcea7,null))[_0xad92('0x15')](function(_0x96f473){if(_0x96f473){_0x27b6c2=_0x96f473;_0x2e34ac[_0xad92('0x29')]=_[_0xad92('0x2a')](db[_0xad92('0x46')][_0xad92('0x1e')]);_0x2e34ac['query']=_[_0xad92('0x2a')](_0x4cfa4d[_0xad92('0x25')]);_0x2e34ac[_0xad92('0x2b')]=_[_0xad92('0x2c')](_0x2e34ac[_0xad92('0x29')],_0x2e34ac[_0xad92('0x25')]);_0x5e9c2e[_0xad92('0x2e')]=_['intersection'](_0x2e34ac[_0xad92('0x29')],qs[_0xad92('0x2d')](_0x4cfa4d[_0xad92('0x25')][_0xad92('0x2d')]));_0x5e9c2e[_0xad92('0x2e')]=_0x5e9c2e['attributes']['length']?_0x5e9c2e[_0xad92('0x2e')]:_0x2e34ac[_0xad92('0x29')];_0x5e9c2e[_0xad92('0x41')]=qs[_0xad92('0x42')](_0x4cfa4d[_0xad92('0x25')][_0xad92('0x42')]);_0x5e9c2e['where']=qs['filters'](_['pick'](_0x4cfa4d[_0xad92('0x25')],_0x2e34ac[_0xad92('0x2b')]));if(_0x4cfa4d['query'][_0xad92('0x44')]){_0x5e9c2e[_0xad92('0x23')]=_[_0xad92('0x30')](_0x5e9c2e[_0xad92('0x23')],{'$or':_[_0xad92('0x48')](_0x5e9c2e[_0xad92('0x2e')],function(_0x50e4cc){var _0x26a557={};_0x26a557[_0x50e4cc]={'$like':'%'+_0x4cfa4d[_0xad92('0x25')][_0xad92('0x44')]+'%'};return _0x26a557;})});}_0x5e9c2e=_[_0xad92('0x30')]({},_0x5e9c2e,_0x4cfa4d[_0xad92('0x45')]);return _0x27b6c2['getAgents'](_0x5e9c2e);}})['then'](function(_0x3a4fd8){if(_0x3a4fd8){_0x28bc26=_0x3a4fd8[_0xad92('0x40')];if(!_0x4cfa4d[_0xad92('0x25')]['hasOwnProperty']('nolimit')){_0x5e9c2e['limit']=qs['limit'](_0x4cfa4d[_0xad92('0x25')]['limit']);_0x5e9c2e[_0xad92('0xf')]=qs[_0xad92('0xf')](_0x4cfa4d[_0xad92('0x25')]['offset']);}return _0x27b6c2[_0xad92('0x7a')](_0x5e9c2e);}})[_0xad92('0x15')](function(_0x4fc484){if(_0x4fc484){return _0x4fc484?{'count':_0x28bc26,'rows':_0x4fc484}:null;}})[_0xad92('0x15')](respondWithResult(_0x2fcea7,null))['catch'](handleError(_0x2fcea7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a4e7250..f73d3f1 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 _0x3520=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3eaeb6,_0x106cd2){var _0x4dae5b=function(_0x23cefc){while(--_0x23cefc){_0x3eaeb6['push'](_0x3eaeb6['shift']());}};_0x4dae5b(++_0x106cd2);}(_0x3520,0xf3));var _0x0352=function(_0x2689cb,_0x160b8e){_0x2689cb=_0x2689cb-0x0;var _0x480679=_0x3520[_0x2689cb];return _0x480679;};'use strict';var EventEmitter=require(_0x0352('0x0'));var MailQueue=require(_0x0352('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0352('0x2')](0x0);var events={'afterCreate':_0x0352('0x3'),'afterUpdate':_0x0352('0x4'),'afterDestroy':_0x0352('0x5')};function emitEvent(_0x1a986c){return function(_0x275ece,_0x2aa479,_0x468e4e){MailQueueEvents[_0x0352('0x6')](_0x1a986c+':'+_0x275ece['id'],_0x275ece);MailQueueEvents[_0x0352('0x6')](_0x1a986c,_0x275ece);_0x468e4e(null);};}for(var e in events){if(events[_0x0352('0x7')](e)){var event=events[e];MailQueue[_0x0352('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x5f44=['emit','hook','events','../../mysqldb','MailQueue','save','update'];(function(_0x1346d0,_0xa887f6){var _0x5003ab=function(_0x49d8cf){while(--_0x49d8cf){_0x1346d0['push'](_0x1346d0['shift']());}};_0x5003ab(++_0xa887f6);}(_0x5f44,0x80));var _0x45f4=function(_0x5a85ac,_0x5f0d3f){_0x5a85ac=_0x5a85ac-0x0;var _0x2e8945=_0x5f44[_0x5a85ac];return _0x2e8945;};'use strict';var EventEmitter=require(_0x45f4('0x0'));var MailQueue=require(_0x45f4('0x1'))['db'][_0x45f4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x45f4('0x3'),'afterUpdate':_0x45f4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42fe54){return function(_0x3a2a83,_0x9140cb,_0x13c52b){MailQueueEvents[_0x45f4('0x5')](_0x42fe54+':'+_0x3a2a83['id'],_0x3a2a83);MailQueueEvents['emit'](_0x42fe54,_0x3a2a83);_0x13c52b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x45f4('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c52b857..27d7bcc 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 _0x6b46=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x46b96c,_0x5c18a5){var _0x36417a=function(_0x1e57e6){while(--_0x1e57e6){_0x46b96c['push'](_0x46b96c['shift']());}};_0x36417a(++_0x5c18a5);}(_0x6b46,0xdc));var _0x66b4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6b46[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x66b4('0x0'));var util=require('util');var logger=require(_0x66b4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x66b4('0x2'));var rp=require(_0x66b4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66b4('0x4'));var config=require(_0x66b4('0x5'));var attributes=require(_0x66b4('0x6'));module[_0x66b4('0x7')]=function(_0x30a993,_0x5c0622){return _0x30a993[_0x66b4('0x8')](_0x66b4('0x9'),attributes,{'tableName':_0x66b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0012=['bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x0012,0x80));var _0x2001=function(_0x557c5c,_0x2174a6){_0x557c5c=_0x557c5c-0x0;var _0x3018ce=_0x0012[_0x557c5c];return _0x3018ce;};'use strict';var _=require(_0x2001('0x0'));var util=require(_0x2001('0x1'));var logger=require(_0x2001('0x2'))('api');var moment=require(_0x2001('0x3'));var BPromise=require(_0x2001('0x4'));var rp=require(_0x2001('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2001('0x6'));var config=require(_0x2001('0x7'));var attributes=require(_0x2001('0x8'));module['exports']=function(_0x2501a9,_0x417a3f){return _0x2501a9[_0x2001('0x9')](_0x2001('0xa'),attributes,{'tableName':_0x2001('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3fd8ce4..070356c 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 _0xfb7d=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','GetMailQueue','findAll','options','attributes','include','map','model','then','debug','catch','ShowMailQueue','MailQueue','find','where'];(function(_0xde8b80,_0x162272){var _0xe5fdd7=function(_0x5165e7){while(--_0x5165e7){_0xde8b80['push'](_0xde8b80['shift']());}};_0xe5fdd7(++_0x162272);}(_0xfb7d,0x94));var _0xdfb7=function(_0x2a732f,_0x22be1d){_0x2a732f=_0x2a732f-0x0;var _0x4be448=_0xfb7d[_0x2a732f];return _0x4be448;};'use strict';var _=require(_0xdfb7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdfb7('0x1'));var rs=require(_0xdfb7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfb7('0x3'))['db'];var utils=require(_0xdfb7('0x4'));var logger=require(_0xdfb7('0x5'))(_0xdfb7('0x6'));var config=require(_0xdfb7('0x7'));var jayson=require(_0xdfb7('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xdfb7('0x9')]=_[_0xdfb7('0xa')](config[_0xdfb7('0x9')],{'host':_0xdfb7('0xb'),'port':0x18eb});var socket=require(_0xdfb7('0xc'))(new Redis(config['redis']));require(_0xdfb7('0xd'))[_0xdfb7('0xe')](socket);function respondWithRpcPromise(_0x9848df,_0x4c1db5,_0x3884b8){return new BPromise(function(_0x141433,_0x4e9562){return client['request'](_0x9848df,_0x3884b8)['then'](function(_0x28a5dd){logger[_0xdfb7('0xf')]('MailQueue,\x20%s,\x20%s',_0x4c1db5,_0xdfb7('0x10'));logger['debug'](_0xdfb7('0x11'),_0x4c1db5,_0xdfb7('0x10'),JSON[_0xdfb7('0x12')](_0x28a5dd));if(_0x28a5dd[_0xdfb7('0x13')]){if(_0x28a5dd['error'][_0xdfb7('0x14')]===0x1f4){logger[_0xdfb7('0x13')](_0xdfb7('0x15'),_0x4c1db5,_0x28a5dd[_0xdfb7('0x13')][_0xdfb7('0x16')]);return _0x4e9562(_0x28a5dd[_0xdfb7('0x13')]['message']);}logger[_0xdfb7('0x13')](_0xdfb7('0x15'),_0x4c1db5,_0x28a5dd[_0xdfb7('0x13')][_0xdfb7('0x16')]);return _0x141433(_0x28a5dd['error']['message']);}else{logger[_0xdfb7('0xf')]('MailQueue,\x20%s,\x20%s',_0x4c1db5,'request\x20sent');_0x141433(_0x28a5dd['result']['message']);}})['catch'](function(_0x4b5316){logger[_0xdfb7('0x13')](_0xdfb7('0x15'),_0x4c1db5,_0x4b5316);_0x4e9562(_0x4b5316);});});}exports[_0xdfb7('0x17')]=function(_0x5f17a7){var _0x55a0f5=this;return new Promise(function(_0x1c680b,_0x212b83){return db['MailQueue'][_0xdfb7('0x18')]({'raw':_0x5f17a7['options']?_0x5f17a7[_0xdfb7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5f17a7[_0xdfb7('0x19')]?_0x5f17a7['options']['where']||null:null,'attributes':_0x5f17a7[_0xdfb7('0x19')]?_0x5f17a7['options'][_0xdfb7('0x1a')]||null:null,'limit':_0x5f17a7[_0xdfb7('0x19')]?_0x5f17a7['options']['limit']||null:null,'include':_0x5f17a7[_0xdfb7('0x19')]?_0x5f17a7[_0xdfb7('0x19')][_0xdfb7('0x1b')]?_[_0xdfb7('0x1c')](_0x5f17a7[_0xdfb7('0x19')]['include'],function(_0x3a2e49){return{'model':db[_0x3a2e49[_0xdfb7('0x1d')]],'as':_0x3a2e49['as'],'attributes':_0x3a2e49[_0xdfb7('0x1a')],'include':_0x3a2e49[_0xdfb7('0x1b')]?_[_0xdfb7('0x1c')](_0x3a2e49[_0xdfb7('0x1b')],function(_0x42802c){return{'model':db[_0x42802c['model']],'as':_0x42802c['as'],'attributes':_0x42802c[_0xdfb7('0x1a')],'include':_0x42802c['include']?_[_0xdfb7('0x1c')](_0x42802c[_0xdfb7('0x1b')],function(_0x2bfb92){return{'model':db[_0x2bfb92[_0xdfb7('0x1d')]],'as':_0x2bfb92['as'],'attributes':_0x2bfb92[_0xdfb7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdfb7('0x1e')](function(_0x4f2a73){logger['info'](_0xdfb7('0x17'),_0x5f17a7);logger[_0xdfb7('0x1f')](_0xdfb7('0x17'),_0x5f17a7,JSON[_0xdfb7('0x12')](_0x4f2a73));_0x1c680b(_0x4f2a73);})[_0xdfb7('0x20')](function(_0x3c45b7){logger[_0xdfb7('0x13')](_0xdfb7('0x17'),_0x3c45b7[_0xdfb7('0x16')],_0x5f17a7);_0x212b83(_0x55a0f5['error'](0x1f4,_0x3c45b7[_0xdfb7('0x16')]));});});};exports[_0xdfb7('0x21')]=function(_0x41ba51){var _0x2f5572=this;return new Promise(function(_0x1842aa,_0x5bd2ed){return db[_0xdfb7('0x22')][_0xdfb7('0x23')]({'raw':_0x41ba51['options']?_0x41ba51['options']['raw']===undefined?!![]:![]:!![],'where':_0x41ba51[_0xdfb7('0x19')]?_0x41ba51['options'][_0xdfb7('0x24')]||null:null,'attributes':_0x41ba51[_0xdfb7('0x19')]?_0x41ba51[_0xdfb7('0x19')][_0xdfb7('0x1a')]||null:null,'include':_0x41ba51[_0xdfb7('0x19')]?_0x41ba51[_0xdfb7('0x19')][_0xdfb7('0x1b')]?_['map'](_0x41ba51[_0xdfb7('0x19')][_0xdfb7('0x1b')],function(_0xad6e75){return{'model':db[_0xad6e75[_0xdfb7('0x1d')]],'as':_0xad6e75['as'],'attributes':_0xad6e75['attributes'],'include':_0xad6e75[_0xdfb7('0x1b')]?_['map'](_0xad6e75[_0xdfb7('0x1b')],function(_0x29d5cc){return{'model':db[_0x29d5cc[_0xdfb7('0x1d')]],'as':_0x29d5cc['as'],'attributes':_0x29d5cc[_0xdfb7('0x1a')],'include':_0x29d5cc[_0xdfb7('0x1b')]?_['map'](_0x29d5cc[_0xdfb7('0x1b')],function(_0x158c08){return{'model':db[_0x158c08[_0xdfb7('0x1d')]],'as':_0x158c08['as'],'attributes':_0x158c08[_0xdfb7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdfb7('0x1e')](function(_0x1f435a){logger[_0xdfb7('0xf')](_0xdfb7('0x21'),_0x41ba51);logger['debug'](_0xdfb7('0x21'),_0x41ba51,JSON[_0xdfb7('0x12')](_0x1f435a));_0x1842aa(_0x1f435a);})[_0xdfb7('0x20')](function(_0x209de3){logger[_0xdfb7('0x13')]('ShowMailQueue',_0x209de3[_0xdfb7('0x16')],_0x41ba51);_0x5bd2ed(_0x2f5572[_0xdfb7('0x13')](0x1f4,_0x209de3[_0xdfb7('0x16')]));});});}; \ No newline at end of file +var _0x1ce4=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','findAll','options','raw','where','map','include','model','attributes','GetMailQueue','ShowMailQueue','MailQueue','lodash','util','moment'];(function(_0x165d79,_0x18a3bc){var _0x324215=function(_0x299a8a){while(--_0x299a8a){_0x165d79['push'](_0x165d79['shift']());}};_0x324215(++_0x18a3bc);}(_0x1ce4,0x179));var _0x41ce=function(_0x2b7d43,_0x262529){_0x2b7d43=_0x2b7d43-0x0;var _0x16eb24=_0x1ce4[_0x2b7d43];return _0x16eb24;};'use strict';var _=require(_0x41ce('0x0'));var util=require(_0x41ce('0x1'));var moment=require(_0x41ce('0x2'));var BPromise=require(_0x41ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41ce('0x4'));var db=require(_0x41ce('0x5'))['db'];var utils=require(_0x41ce('0x6'));var logger=require(_0x41ce('0x7'))(_0x41ce('0x8'));var config=require('../../config/environment');var jayson=require(_0x41ce('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x41ce('0xa')](config[_0x41ce('0xb')],{'host':_0x41ce('0xc'),'port':0x18eb});var socket=require(_0x41ce('0xd'))(new Redis(config[_0x41ce('0xb')]));require(_0x41ce('0xe'))[_0x41ce('0xf')](socket);function respondWithRpcPromise(_0x27ee42,_0x2eb355,_0x16f628){return new BPromise(function(_0x8cd5d1,_0xbbccc0){return client['request'](_0x27ee42,_0x16f628)[_0x41ce('0x10')](function(_0x298c16){logger[_0x41ce('0x11')](_0x41ce('0x12'),_0x2eb355,'request\x20sent');logger[_0x41ce('0x13')](_0x41ce('0x14'),_0x2eb355,'request\x20sent',JSON[_0x41ce('0x15')](_0x298c16));if(_0x298c16[_0x41ce('0x16')]){if(_0x298c16[_0x41ce('0x16')][_0x41ce('0x17')]===0x1f4){logger['error'](_0x41ce('0x12'),_0x2eb355,_0x298c16['error'][_0x41ce('0x18')]);return _0xbbccc0(_0x298c16[_0x41ce('0x16')][_0x41ce('0x18')]);}logger[_0x41ce('0x16')](_0x41ce('0x12'),_0x2eb355,_0x298c16[_0x41ce('0x16')][_0x41ce('0x18')]);return _0x8cd5d1(_0x298c16[_0x41ce('0x16')][_0x41ce('0x18')]);}else{logger[_0x41ce('0x11')]('MailQueue,\x20%s,\x20%s',_0x2eb355,_0x41ce('0x19'));_0x8cd5d1(_0x298c16['result'][_0x41ce('0x18')]);}})[_0x41ce('0x1a')](function(_0x1650ac){logger[_0x41ce('0x16')](_0x41ce('0x12'),_0x2eb355,_0x1650ac);_0xbbccc0(_0x1650ac);});});}exports['GetMailQueue']=function(_0x2ad1ce){var _0x5c3299=this;return new Promise(function(_0x232fef,_0x25c37a){return db['MailQueue'][_0x41ce('0x1b')]({'raw':_0x2ad1ce[_0x41ce('0x1c')]?_0x2ad1ce['options'][_0x41ce('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ad1ce[_0x41ce('0x1c')]?_0x2ad1ce[_0x41ce('0x1c')][_0x41ce('0x1e')]||null:null,'attributes':_0x2ad1ce[_0x41ce('0x1c')]?_0x2ad1ce[_0x41ce('0x1c')]['attributes']||null:null,'limit':_0x2ad1ce['options']?_0x2ad1ce[_0x41ce('0x1c')]['limit']||null:null,'include':_0x2ad1ce[_0x41ce('0x1c')]?_0x2ad1ce[_0x41ce('0x1c')]['include']?_[_0x41ce('0x1f')](_0x2ad1ce[_0x41ce('0x1c')][_0x41ce('0x20')],function(_0x332132){return{'model':db[_0x332132[_0x41ce('0x21')]],'as':_0x332132['as'],'attributes':_0x332132[_0x41ce('0x22')],'include':_0x332132['include']?_[_0x41ce('0x1f')](_0x332132[_0x41ce('0x20')],function(_0x59980c){return{'model':db[_0x59980c[_0x41ce('0x21')]],'as':_0x59980c['as'],'attributes':_0x59980c[_0x41ce('0x22')],'include':_0x59980c['include']?_[_0x41ce('0x1f')](_0x59980c[_0x41ce('0x20')],function(_0x42f802){return{'model':db[_0x42f802[_0x41ce('0x21')]],'as':_0x42f802['as'],'attributes':_0x42f802[_0x41ce('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dbab3){logger[_0x41ce('0x11')](_0x41ce('0x23'),_0x2ad1ce);logger[_0x41ce('0x13')]('GetMailQueue',_0x2ad1ce,JSON[_0x41ce('0x15')](_0x5dbab3));_0x232fef(_0x5dbab3);})['catch'](function(_0x526dd3){logger[_0x41ce('0x16')]('GetMailQueue',_0x526dd3[_0x41ce('0x18')],_0x2ad1ce);_0x25c37a(_0x5c3299[_0x41ce('0x16')](0x1f4,_0x526dd3[_0x41ce('0x18')]));});});};exports[_0x41ce('0x24')]=function(_0x2e678c){var _0x3d8b7b=this;return new Promise(function(_0x8cb465,_0x20214c){return db[_0x41ce('0x25')]['find']({'raw':_0x2e678c['options']?_0x2e678c[_0x41ce('0x1c')][_0x41ce('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e678c[_0x41ce('0x1c')]?_0x2e678c[_0x41ce('0x1c')][_0x41ce('0x1e')]||null:null,'attributes':_0x2e678c['options']?_0x2e678c['options'][_0x41ce('0x22')]||null:null,'include':_0x2e678c[_0x41ce('0x1c')]?_0x2e678c[_0x41ce('0x1c')][_0x41ce('0x20')]?_[_0x41ce('0x1f')](_0x2e678c[_0x41ce('0x1c')][_0x41ce('0x20')],function(_0x370b80){return{'model':db[_0x370b80['model']],'as':_0x370b80['as'],'attributes':_0x370b80[_0x41ce('0x22')],'include':_0x370b80[_0x41ce('0x20')]?_[_0x41ce('0x1f')](_0x370b80[_0x41ce('0x20')],function(_0x5c78fc){return{'model':db[_0x5c78fc[_0x41ce('0x21')]],'as':_0x5c78fc['as'],'attributes':_0x5c78fc[_0x41ce('0x22')],'include':_0x5c78fc['include']?_[_0x41ce('0x1f')](_0x5c78fc[_0x41ce('0x20')],function(_0x2f2595){return{'model':db[_0x2f2595[_0x41ce('0x21')]],'as':_0x2f2595['as'],'attributes':_0x2f2595[_0x41ce('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c5d8b){logger[_0x41ce('0x11')](_0x41ce('0x24'),_0x2e678c);logger['debug'](_0x41ce('0x24'),_0x2e678c,JSON[_0x41ce('0x15')](_0x5c5d8b));_0x8cb465(_0x5c5d8b);})[_0x41ce('0x1a')](function(_0x1e751b){logger[_0x41ce('0x16')](_0x41ce('0x24'),_0x1e751b['message'],_0x2e678c);_0x20214c(_0x3d8b7b['error'](0x1f4,_0x1e751b[_0x41ce('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7180592..5feeb1d 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 _0xccac=['update','removeListener','register','mailQueue:','./mailQueue.events','save','remove'];(function(_0x8ea575,_0x3829da){var _0x4e358d=function(_0x35fbac){while(--_0x35fbac){_0x8ea575['push'](_0x8ea575['shift']());}};_0x4e358d(++_0x3829da);}(_0xccac,0x1cb));var _0xccca=function(_0x1e744a,_0xa8fdb1){_0x1e744a=_0x1e744a-0x0;var _0x1ac4d0=_0xccac[_0x1e744a];return _0x1ac4d0;};'use strict';var MailQueueEvents=require(_0xccca('0x0'));var events=[_0xccca('0x1'),_0xccca('0x2'),_0xccca('0x3')];function createListener(_0x234af2,_0x305b79){return function(_0x4df391){_0x305b79['emit'](_0x234af2,_0x4df391);};}function removeListener(_0x2cdbed,_0x5e4e60){return function(){MailQueueEvents[_0xccca('0x4')](_0x2cdbed,_0x5e4e60);};}exports[_0xccca('0x5')]=function(_0x346c79){for(var _0x1be72e=0x0,_0x461c34=events['length'];_0x1be72e<_0x461c34;_0x1be72e++){var _0x57f5a2=events[_0x1be72e];var _0x6fbff0=createListener(_0xccca('0x6')+_0x57f5a2,_0x346c79);MailQueueEvents['on'](_0x57f5a2,_0x6fbff0);}}; \ No newline at end of file +var _0x3cbb=['update','removeListener','length','save','remove'];(function(_0x5ad28d,_0x509581){var _0x393215=function(_0x346054){while(--_0x346054){_0x5ad28d['push'](_0x5ad28d['shift']());}};_0x393215(++_0x509581);}(_0x3cbb,0x175));var _0xb3cb=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3cbb[_0x92c450];return _0x2a9599;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xb3cb('0x0'),_0xb3cb('0x1'),_0xb3cb('0x2')];function createListener(_0x210e71,_0x1ff56a){return function(_0x5e1a06){_0x1ff56a['emit'](_0x210e71,_0x5e1a06);};}function removeListener(_0x12bac7,_0x5608f4){return function(){MailQueueEvents[_0xb3cb('0x3')](_0x12bac7,_0x5608f4);};}exports['register']=function(_0x5ac812){for(var _0x569f6a=0x0,_0x58a17c=events[_0xb3cb('0x4')];_0x569f6a<_0x58a17c;_0x569f6a++){var _0x4352fa=events[_0x569f6a];var _0x2e115b=createListener('mailQueue:'+_0x4352fa,_0x5ac812);MailQueueEvents['on'](_0x4352fa,_0x2e115b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a302dd8..7942a84 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 _0x9820=['Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9820,0x1de));var _0x0982=function(_0x3eed87,_0x4f2ec8){_0x3eed87=_0x3eed87-0x0;var _0x5574f8=_0x9820[_0x3eed87];return _0x5574f8;};'use strict';var multer=require(_0x0982('0x0'));var util=require(_0x0982('0x1'));var path=require(_0x0982('0x2'));var timeout=require(_0x0982('0x3'));var express=require(_0x0982('0x4'));var router=express[_0x0982('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0982('0x6'));var config=require(_0x0982('0x7'));var controller=require(_0x0982('0x8'));router[_0x0982('0x9')]('/',auth[_0x0982('0xa')](),controller['index']);router[_0x0982('0x9')](_0x0982('0xb'),auth[_0x0982('0xa')](),controller[_0x0982('0xc')]);router[_0x0982('0x9')](_0x0982('0xd'),auth[_0x0982('0xa')](),controller[_0x0982('0xe')]);router[_0x0982('0xf')]('/',auth[_0x0982('0xa')](),controller['create']);router[_0x0982('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0982('0x11')]);router[_0x0982('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0982('0x13')]);module[_0x0982('0x14')]=router; \ No newline at end of file +var _0xe057=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe057,0xea));var _0x7e05=function(_0x206781,_0xa2ee66){_0x206781=_0x206781-0x0;var _0x24bea7=_0xe057[_0x206781];return _0x24bea7;};'use strict';var multer=require(_0x7e05('0x0'));var util=require('util');var path=require(_0x7e05('0x1'));var timeout=require(_0x7e05('0x2'));var express=require(_0x7e05('0x3'));var router=express[_0x7e05('0x4')]();var fs_extra=require(_0x7e05('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e05('0x6'));var config=require(_0x7e05('0x7'));var controller=require(_0x7e05('0x8'));router[_0x7e05('0x9')]('/',auth[_0x7e05('0xa')](),controller[_0x7e05('0xb')]);router[_0x7e05('0x9')](_0x7e05('0xc'),auth[_0x7e05('0xa')](),controller[_0x7e05('0xd')]);router['get'](_0x7e05('0xe'),auth[_0x7e05('0xa')](),controller[_0x7e05('0xf')]);router[_0x7e05('0x10')]('/',auth[_0x7e05('0xa')](),controller[_0x7e05('0x11')]);router[_0x7e05('0x12')]('/:id',auth[_0x7e05('0xa')](),controller['update']);router[_0x7e05('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7e05('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 021e1c6..673fcbf 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 _0x05f8=['STRING','DATE','moment'];(function(_0x610f31,_0x5a45ea){var _0x520d7e=function(_0x30f7bc){while(--_0x30f7bc){_0x610f31['push'](_0x610f31['shift']());}};_0x520d7e(++_0x5a45ea);}(_0x05f8,0x8f));var _0x805f=function(_0x37f9f4,_0xcc5bed){_0x37f9f4=_0x37f9f4-0x0;var _0x173c18=_0x05f8[_0x37f9f4];return _0x173c18;};'use strict';var moment=require(_0x805f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x805f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x805f('0x1')]},'joinAt':{'type':Sequelize[_0x805f('0x2')]},'leaveAt':{'type':Sequelize[_0x805f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x805f('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa50d=['sequelize','exports','STRING','DATE','moment'];(function(_0x9bb803,_0x3462a3){var _0x2b1ee8=function(_0xa321c7){while(--_0xa321c7){_0x9bb803['push'](_0x9bb803['shift']());}};_0x2b1ee8(++_0x3462a3);}(_0xa50d,0x86));var _0xda50=function(_0x514695,_0x575749){_0x514695=_0x514695-0x0;var _0x26c516=_0xa50d[_0x514695];return _0x26c516;};'use strict';var moment=require(_0xda50('0x0'));var Sequelize=require(_0xda50('0x1'));module[_0xda50('0x2')]={'uniqueid':{'type':Sequelize[_0xda50('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xda50('0x3')]},'joinAt':{'type':Sequelize[_0xda50('0x4')]},'leaveAt':{'type':Sequelize[_0xda50('0x4')]},'acceptAt':{'type':Sequelize[_0xda50('0x4')]},'exitAt':{'type':Sequelize[_0xda50('0x4')]},'reason':{'type':Sequelize[_0xda50('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 59604be..c09894b 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 _0x0424=['index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x0424,0x159));var _0x4042=function(_0x353c53,_0x2102c0){_0x353c53=_0x353c53-0x0;var _0x2c55da=_0x0424[_0x353c53];return _0x2c55da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){_0x6d12a5[_0x4042('0x18')](0xcc)[_0x4042('0x19')]();});}};}function handleEntityNotFound(_0x5d5c6d,_0x461c5e){return function(_0x3b9e78){if(!_0x3b9e78){_0x5d5c6d[_0x4042('0x17')](0x194);}return _0x3b9e78;};}function handleError(_0xbdadc8,_0x1c4d9f){_0x1c4d9f=_0x1c4d9f||0x1f4;return function(_0x52e575){logger['error'](_0x52e575[_0x4042('0x25')]);if(_0x52e575[_0x4042('0x26')]){delete _0x52e575[_0x4042('0x26')];}_0xbdadc8[_0x4042('0x18')](_0x1c4d9f)[_0x4042('0x27')](_0x52e575);};}exports[_0x4042('0x28')]=function(_0x5eb84b,_0x33733b){var _0x1e9bd7={},_0x4a6a6e={},_0xae26c2={'count':0x0,'rows':[]};var _0x89e16=_[_0x4042('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x3d1f48){return{'name':_0x3d1f48[_0x4042('0x2a')],'type':_0x3d1f48['type'][_0x4042('0x2b')]};});_0x4a6a6e[_0x4042('0x2c')]=_[_0x4042('0x29')](_0x89e16,_0x4042('0x26'));_0x4a6a6e[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x5eb84b[_0x4042('0x2d')]);_0x4a6a6e[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x4a6a6e['model'],_0x4a6a6e[_0x4042('0x2d')]);_0x1e9bd7[_0x4042('0x31')]=_['intersection'](_0x4a6a6e[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x5eb84b['query'][_0x4042('0x32')]));_0x1e9bd7[_0x4042('0x31')]=_0x1e9bd7[_0x4042('0x31')][_0x4042('0x33')]?_0x1e9bd7[_0x4042('0x31')]:_0x4a6a6e[_0x4042('0x2c')];if(!_0x5eb84b[_0x4042('0x2d')][_0x4042('0x34')](_0x4042('0x35'))){_0x1e9bd7[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1d')]);_0x1e9bd7[_0x4042('0x1b')]=qs[_0x4042('0x1b')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1b')]);}_0x1e9bd7[_0x4042('0x36')]=qs[_0x4042('0x37')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x37')]);_0x1e9bd7['where']=qs[_0x4042('0x2f')](_[_0x4042('0x38')](_0x5eb84b[_0x4042('0x2d')],_0x4a6a6e[_0x4042('0x2f')]),_0x89e16);if(_0x5eb84b['query'][_0x4042('0x39')]){_0x1e9bd7[_0x4042('0x3a')]=_[_0x4042('0x3b')](_0x1e9bd7[_0x4042('0x3a')],{'$or':_[_0x4042('0x29')](_0x89e16,function(_0x13da64){if(_0x13da64[_0x4042('0x3c')]!==_0x4042('0x3d')){var _0x341083={};_0x341083[_0x13da64[_0x4042('0x26')]]={'$like':'%'+_0x5eb84b['query'][_0x4042('0x39')]+'%'};return _0x341083;}})});}_0x1e9bd7=_[_0x4042('0x3b')]({},_0x1e9bd7,_0x5eb84b[_0x4042('0x3e')]);var _0x1eab87={'where':_0x1e9bd7[_0x4042('0x3a')]};return db[_0x4042('0x3f')][_0x4042('0x1e')](_0x1eab87)[_0x4042('0x24')](function(_0x52b1bd){_0xae26c2['count']=_0x52b1bd;if(_0x5eb84b[_0x4042('0x2d')][_0x4042('0x40')]){_0x1e9bd7[_0x4042('0x41')]=[{'all':!![]}];}return db[_0x4042('0x3f')][_0x4042('0x42')](_0x1e9bd7);})[_0x4042('0x24')](function(_0xdfb5cb){_0xae26c2[_0x4042('0x43')]=_0xdfb5cb;return _0xae26c2;})[_0x4042('0x24')](respondWithFilteredResult(_0x33733b,_0x1e9bd7))[_0x4042('0x44')](handleError(_0x33733b,null));};exports[_0x4042('0x45')]=function(_0x35fdc2,_0x5666ed){var _0x5dea57={'raw':!![],'where':{'id':_0x35fdc2[_0x4042('0x46')]['id']}},_0x929884={};_0x929884['model']=_[_0x4042('0x2e')](db['MailQueueReport'][_0x4042('0x47')]);_0x929884[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x35fdc2['query']);_0x929884[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x929884['model'],_0x929884[_0x4042('0x2d')]);_0x5dea57[_0x4042('0x31')]=_[_0x4042('0x30')](_0x929884[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x35fdc2['query']['fields']));_0x5dea57['attributes']=_0x5dea57[_0x4042('0x31')][_0x4042('0x33')]?_0x5dea57['attributes']:_0x929884['model'];if(_0x35fdc2['query'][_0x4042('0x40')]){_0x5dea57['include']=[{'all':!![]}];}_0x5dea57=_['merge']({},_0x5dea57,_0x35fdc2[_0x4042('0x3e')]);return db[_0x4042('0x3f')][_0x4042('0x48')](_0x5dea57)[_0x4042('0x24')](handleEntityNotFound(_0x5666ed,null))[_0x4042('0x24')](respondWithResult(_0x5666ed,null))[_0x4042('0x44')](handleError(_0x5666ed,null));};exports[_0x4042('0x49')]=function(_0x2abc13,_0x198209){return db['MailQueueReport']['create'](_0x2abc13['body'],{})['then'](respondWithResult(_0x198209,0xc9))[_0x4042('0x44')](handleError(_0x198209,null));};exports[_0x4042('0x23')]=function(_0xd898ea,_0x250434){if(_0xd898ea[_0x4042('0x4a')]['id']){delete _0xd898ea[_0x4042('0x4a')]['id'];}return db[_0x4042('0x3f')][_0x4042('0x48')]({'where':{'id':_0xd898ea['params']['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x250434,null))[_0x4042('0x24')](saveUpdates(_0xd898ea[_0x4042('0x4a')],null))[_0x4042('0x24')](respondWithResult(_0x250434,null))[_0x4042('0x44')](handleError(_0x250434,null));};exports[_0x4042('0x4b')]=function(_0xf5f38a,_0x591a0f){return db['MailQueueReport']['find']({'where':{'id':_0xf5f38a[_0x4042('0x46')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x591a0f,null))['then'](removeEntity(_0x591a0f,null))[_0x4042('0x44')](handleError(_0x591a0f,null));};exports[_0x4042('0x4c')]=function(_0x5d42a7,_0x4ec047){return db[_0x4042('0x3f')][_0x4042('0x4c')]()[_0x4042('0x24')](respondWithResult(_0x4ec047,null))[_0x4042('0x44')](handleError(_0x4ec047,null));}; \ No newline at end of file +var _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2f503b,_0x44f428){var _0x667d79=function(_0x9659f8){while(--_0x9659f8){_0x2f503b['push'](_0x2f503b['shift']());}};_0x667d79(++_0x44f428);}(_0x32b6,0x1d1));var _0x632b=function(_0x35acc7,_0x4bab94){_0x35acc7=_0x35acc7-0x0;var _0x1344ef=_0x32b6[_0x35acc7];return _0x1344ef;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));};exports['describe']=function(_0xda006b,_0x1d35b2){return db[_0x632b('0x2c')]['describe']()[_0x632b('0x23')](respondWithResult(_0x1d35b2,null))[_0x632b('0x47')](handleError(_0x1d35b2,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1c3c557..095bd81 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 _0x8ab1=['moment','bluebird','path','rimraf','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0xb3a4b8,_0x1c8570){var _0x64070e=function(_0x4603ba){while(--_0x4603ba){_0xb3a4b8['push'](_0xb3a4b8['shift']());}};_0x64070e(++_0x1c8570);}(_0x8ab1,0xbc));var _0x18ab=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x8ab1[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x18ab('0x0'));var util=require(_0x18ab('0x1'));var logger=require(_0x18ab('0x2'))(_0x18ab('0x3'));var moment=require(_0x18ab('0x4'));var BPromise=require(_0x18ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ab('0x6'));var rimraf=require(_0x18ab('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x18ab('0x8')]=function(_0x34728a,_0x27cfb2){return _0x34728a['define'](_0x18ab('0x9'),attributes,{'tableName':_0x18ab('0xa'),'paranoid':![],'indexes':[{'name':_0x18ab('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bbc=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x239721,_0x13d55e){var _0x29fbe7=function(_0x14f17a){while(--_0x14f17a){_0x239721['push'](_0x239721['shift']());}};_0x29fbe7(++_0x13d55e);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x5dd8ec,_0x37befd){_0x5dd8ec=_0x5dd8ec-0x0;var _0x5ab460=_0x2bbc[_0x5dd8ec];return _0x5ab460;};'use strict';var _=require(_0xc2bb('0x0'));var util=require(_0xc2bb('0x1'));var logger=require(_0xc2bb('0x2'))(_0xc2bb('0x3'));var moment=require('moment');var BPromise=require(_0xc2bb('0x4'));var rp=require(_0xc2bb('0x5'));var fs=require('fs');var path=require(_0xc2bb('0x6'));var rimraf=require(_0xc2bb('0x7'));var config=require(_0xc2bb('0x8'));var attributes=require(_0xc2bb('0x9'));module['exports']=function(_0x32d66c,_0xa597f2){return _0x32d66c[_0xc2bb('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','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 9049b5d..62450c6 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(_0x5235ef,_0x577d77){var _0x5f4c49=function(_0x4cf591){while(--_0x4cf591){_0x5235ef['push'](_0x5235ef['shift']());}};_0x5f4c49(++_0x577d77);}(_0x7a54,0x106));var _0x47a5=function(_0x1bb753,_0x27f2a5){_0x1bb753=_0x1bb753-0x0;var _0x2dc416=_0x7a54[_0x1bb753];return _0x2dc416;};'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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x49477f,_0x33254f){var _0x106d2e=function(_0x4201a7){while(--_0x4201a7){_0x49477f['push'](_0x49477f['shift']());}};_0x106d2e(++_0x33254f);}(_0xadb5,0xad));var _0x5adb=function(_0x2b99ee,_0x224920){_0x2b99ee=_0x2b99ee-0x0;var _0x1836e8=_0xadb5[_0x2b99ee];return _0x1836e8;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2179fb4..d0259b8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x58836f,_0x5351e2){var _0x28f9b1=function(_0x30a6cc){while(--_0x30a6cc){_0x58836f['push'](_0x58836f['shift']());}};_0x28f9b1(++_0x5351e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x67a5fe,_0x5b1510){var _0x2703c3=function(_0x13ba71){while(--_0x13ba71){_0x67a5fe['push'](_0x67a5fe['shift']());}};_0x2703c3(++_0x5b1510);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 858acdf..97cf7f2 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 _0xd14e=['sequelize','STRING','INBOX','INTEGER','BOOLEAN'];(function(_0x4af008,_0x1140fe){var _0x25283e=function(_0x356c49){while(--_0x356c49){_0x4af008['push'](_0x4af008['shift']());}};_0x25283e(++_0x1140fe);}(_0xd14e,0x1b8));var _0xed14=function(_0x52309f,_0x3fbbaa){_0x52309f=_0x52309f-0x0;var _0x235487=_0xd14e[_0x52309f];return _0x235487;};'use strict';var Sequelize=require(_0xed14('0x0'));module['exports']={'description':{'type':Sequelize[_0xed14('0x1')]},'host':{'type':Sequelize[_0xed14('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xed14('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xed14('0x2')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xed14('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xed14('0x1')]},'modernAuthentication':{'type':Sequelize[_0xed14('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x14d9=['STRING','INTEGER','BOOLEAN','INBOX','exports'];(function(_0x569b5f,_0x3db327){var _0x3e551a=function(_0x8adc60){while(--_0x8adc60){_0x569b5f['push'](_0x569b5f['shift']());}};_0x3e551a(++_0x3db327);}(_0x14d9,0x126));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x914d('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x914d('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x914d('0x2')]},'tls':{'type':Sequelize[_0x914d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x914d('0x1')],'defaultValue':_0x914d('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x914d('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x914d('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d06b9f4..98c58a4 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 _0x6e2d=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x581cc3,_0x472dbe){var _0x2d8dff=function(_0x7d139){while(--_0x7d139){_0x581cc3['push'](_0x581cc3['shift']());}};_0x2d8dff(++_0x472dbe);}(_0x6e2d,0xfe));var _0xd6e2=function(_0x5dda63,_0x1c96a2){_0x5dda63=_0x5dda63-0x0;var _0xb53e0c=_0x6e2d[_0x5dda63];return _0xb53e0c;};'use strict';var _=require(_0xd6e2('0x0'));var util=require(_0xd6e2('0x1'));var logger=require(_0xd6e2('0x2'))(_0xd6e2('0x3'));var moment=require('moment');var BPromise=require(_0xd6e2('0x4'));var rp=require(_0xd6e2('0x5'));var fs=require('fs');var path=require(_0xd6e2('0x6'));var rimraf=require(_0xd6e2('0x7'));var config=require(_0xd6e2('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x17f4cf,_0x40b6ae){return _0x17f4cf[_0xd6e2('0x9')](_0xd6e2('0xa'),attributes,{'tableName':_0xd6e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadf4=['rimraf','../../config/environment','exports','define','mail_servers_in','lodash','util','moment','bluebird','request-promise','path'];(function(_0x57d232,_0x1eb10c){var _0x4c7e6d=function(_0x1080cd){while(--_0x1080cd){_0x57d232['push'](_0x57d232['shift']());}};_0x4c7e6d(++_0x1eb10c);}(_0xadf4,0x94));var _0x4adf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadf4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4adf('0x0'));var util=require(_0x4adf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4adf('0x2'));var BPromise=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var fs=require('fs');var path=require(_0x4adf('0x5'));var rimraf=require(_0x4adf('0x6'));var config=require(_0x4adf('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x4adf('0x8')]=function(_0x1e46ff,_0x3cf45c){return _0x1e46ff[_0x4adf('0x9')]('MailServerIn',attributes,{'tableName':_0x4adf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index bee634d..91e3bfb 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 _0xe88e=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','options','raw','where','attributes','include','map','model','GetMailServerIn','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xe88e,0x167));var _0xee88=function(_0x150bbe,_0x412085){_0x150bbe=_0x150bbe-0x0;var _0x3418d5=_0xe88e[_0x150bbe];return _0x3418d5;};'use strict';var _=require(_0xee88('0x0'));var util=require(_0xee88('0x1'));var moment=require(_0xee88('0x2'));var BPromise=require(_0xee88('0x3'));var rs=require(_0xee88('0x4'));var fs=require('fs');var Redis=require(_0xee88('0x5'));var db=require(_0xee88('0x6'))['db'];var utils=require(_0xee88('0x7'));var logger=require(_0xee88('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee88('0x9'));var client=jayson[_0xee88('0xa')][_0xee88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5adfcd,_0x1f90c0,_0x4658b9){return new BPromise(function(_0x56dc6d,_0x56c390){return client[_0xee88('0xc')](_0x5adfcd,_0x4658b9)[_0xee88('0xd')](function(_0x3796bd){logger[_0xee88('0xe')](_0xee88('0xf'),_0x1f90c0,_0xee88('0x10'));logger[_0xee88('0x11')](_0xee88('0x12'),_0x1f90c0,_0xee88('0x10'),JSON[_0xee88('0x13')](_0x3796bd));if(_0x3796bd[_0xee88('0x14')]){if(_0x3796bd[_0xee88('0x14')][_0xee88('0x15')]===0x1f4){logger[_0xee88('0x14')](_0xee88('0xf'),_0x1f90c0,_0x3796bd[_0xee88('0x14')][_0xee88('0x16')]);return _0x56c390(_0x3796bd['error'][_0xee88('0x16')]);}logger[_0xee88('0x14')]('MailServerIn,\x20%s,\x20%s',_0x1f90c0,_0x3796bd[_0xee88('0x14')][_0xee88('0x16')]);return _0x56dc6d(_0x3796bd[_0xee88('0x14')][_0xee88('0x16')]);}else{logger[_0xee88('0xe')](_0xee88('0xf'),_0x1f90c0,_0xee88('0x10'));_0x56dc6d(_0x3796bd[_0xee88('0x17')]['message']);}})[_0xee88('0x18')](function(_0x2e1d97){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1f90c0,_0x2e1d97);_0x56c390(_0x2e1d97);});});}exports['GetMailServerIn']=function(_0x32000f){var _0x4f555d=this;return new Promise(function(_0xc4d755,_0x376cf1){return db[_0xee88('0x19')]['findAll']({'raw':_0x32000f['options']?_0x32000f[_0xee88('0x1a')][_0xee88('0x1b')]===undefined?!![]:![]:!![],'where':_0x32000f[_0xee88('0x1a')]?_0x32000f[_0xee88('0x1a')][_0xee88('0x1c')]||null:null,'attributes':_0x32000f[_0xee88('0x1a')]?_0x32000f[_0xee88('0x1a')][_0xee88('0x1d')]||null:null,'limit':_0x32000f[_0xee88('0x1a')]?_0x32000f['options']['limit']||null:null,'include':_0x32000f[_0xee88('0x1a')]?_0x32000f[_0xee88('0x1a')][_0xee88('0x1e')]?_[_0xee88('0x1f')](_0x32000f[_0xee88('0x1a')][_0xee88('0x1e')],function(_0x15cc82){return{'model':db[_0x15cc82['model']],'as':_0x15cc82['as'],'attributes':_0x15cc82[_0xee88('0x1d')],'include':_0x15cc82[_0xee88('0x1e')]?_[_0xee88('0x1f')](_0x15cc82[_0xee88('0x1e')],function(_0x14376f){return{'model':db[_0x14376f[_0xee88('0x20')]],'as':_0x14376f['as'],'attributes':_0x14376f[_0xee88('0x1d')],'include':_0x14376f[_0xee88('0x1e')]?_[_0xee88('0x1f')](_0x14376f[_0xee88('0x1e')],function(_0x3a3ce2){return{'model':db[_0x3a3ce2[_0xee88('0x20')]],'as':_0x3a3ce2['as'],'attributes':_0x3a3ce2[_0xee88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xee88('0xd')](function(_0x194351){logger[_0xee88('0xe')]('GetMailServerIn',_0x32000f);logger[_0xee88('0x11')](_0xee88('0x21'),_0x32000f,JSON[_0xee88('0x13')](_0x194351));_0xc4d755(_0x194351);})[_0xee88('0x18')](function(_0xadac0c){logger[_0xee88('0x14')]('GetMailServerIn',_0xadac0c[_0xee88('0x16')],_0x32000f);_0x376cf1(_0x4f555d[_0xee88('0x14')](0x1f4,_0xadac0c[_0xee88('0x16')]));});});}; \ No newline at end of file +var _0xb223=['map','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailServerIn','findAll','options','where','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb223,0x157));var _0x3b22=function(_0x26bfee,_0x4bb52b){_0x26bfee=_0x26bfee-0x0;var _0x550794=_0xb223[_0x26bfee];return _0x550794;};'use strict';var _=require(_0x3b22('0x0'));var util=require(_0x3b22('0x1'));var moment=require('moment');var BPromise=require(_0x3b22('0x2'));var rs=require(_0x3b22('0x3'));var fs=require('fs');var Redis=require(_0x3b22('0x4'));var db=require(_0x3b22('0x5'))['db'];var utils=require(_0x3b22('0x6'));var logger=require(_0x3b22('0x7'))(_0x3b22('0x8'));var config=require(_0x3b22('0x9'));var jayson=require(_0x3b22('0xa'));var client=jayson[_0x3b22('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c82f8,_0x2f8c9d,_0x134763){return new BPromise(function(_0x846ed,_0x4511fe){return client[_0x3b22('0xc')](_0x2c82f8,_0x134763)['then'](function(_0x36f113){logger['info'](_0x3b22('0xd'),_0x2f8c9d,_0x3b22('0xe'));logger[_0x3b22('0xf')](_0x3b22('0x10'),_0x2f8c9d,'request\x20sent',JSON[_0x3b22('0x11')](_0x36f113));if(_0x36f113['error']){if(_0x36f113[_0x3b22('0x12')][_0x3b22('0x13')]===0x1f4){logger[_0x3b22('0x12')](_0x3b22('0xd'),_0x2f8c9d,_0x36f113['error']['message']);return _0x4511fe(_0x36f113['error'][_0x3b22('0x14')]);}logger[_0x3b22('0x12')](_0x3b22('0xd'),_0x2f8c9d,_0x36f113[_0x3b22('0x12')][_0x3b22('0x14')]);return _0x846ed(_0x36f113['error']['message']);}else{logger[_0x3b22('0x15')](_0x3b22('0xd'),_0x2f8c9d,'request\x20sent');_0x846ed(_0x36f113[_0x3b22('0x16')][_0x3b22('0x14')]);}})[_0x3b22('0x17')](function(_0x1f264e){logger['error'](_0x3b22('0xd'),_0x2f8c9d,_0x1f264e);_0x4511fe(_0x1f264e);});});}exports[_0x3b22('0x18')]=function(_0xc40ed0){var _0x6f2161=this;return new Promise(function(_0x3b4241,_0x143c79){return db['MailServerIn'][_0x3b22('0x19')]({'raw':_0xc40ed0[_0x3b22('0x1a')]?_0xc40ed0['options']['raw']===undefined?!![]:![]:!![],'where':_0xc40ed0[_0x3b22('0x1a')]?_0xc40ed0[_0x3b22('0x1a')][_0x3b22('0x1b')]||null:null,'attributes':_0xc40ed0[_0x3b22('0x1a')]?_0xc40ed0['options'][_0x3b22('0x1c')]||null:null,'limit':_0xc40ed0['options']?_0xc40ed0['options'][_0x3b22('0x1d')]||null:null,'include':_0xc40ed0[_0x3b22('0x1a')]?_0xc40ed0[_0x3b22('0x1a')][_0x3b22('0x1e')]?_['map'](_0xc40ed0[_0x3b22('0x1a')][_0x3b22('0x1e')],function(_0x44a9f1){return{'model':db[_0x44a9f1['model']],'as':_0x44a9f1['as'],'attributes':_0x44a9f1[_0x3b22('0x1c')],'include':_0x44a9f1['include']?_[_0x3b22('0x1f')](_0x44a9f1[_0x3b22('0x1e')],function(_0x217d48){return{'model':db[_0x217d48['model']],'as':_0x217d48['as'],'attributes':_0x217d48[_0x3b22('0x1c')],'include':_0x217d48[_0x3b22('0x1e')]?_[_0x3b22('0x1f')](_0x217d48[_0x3b22('0x1e')],function(_0x3bafd0){return{'model':db[_0x3bafd0[_0x3b22('0x20')]],'as':_0x3bafd0['as'],'attributes':_0x3bafd0[_0x3b22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3b22('0x21')](function(_0x258608){logger[_0x3b22('0x15')](_0x3b22('0x18'),_0xc40ed0);logger[_0x3b22('0xf')](_0x3b22('0x18'),_0xc40ed0,JSON['stringify'](_0x258608));_0x3b4241(_0x258608);})[_0x3b22('0x17')](function(_0x4b4950){logger[_0x3b22('0x12')](_0x3b22('0x18'),_0x4b4950[_0x3b22('0x14')],_0xc40ed0);_0x143c79(_0x6f2161[_0x3b22('0x12')](0x1f4,_0x4b4950['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6d9afd8..1b809ef 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 _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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_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('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 +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(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x407c2e,_0x194458){_0x407c2e=_0x407c2e-0x0;var _0x283dfd=_0x7a54[_0x407c2e];return _0x283dfd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 21060a0..fce616f 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 _0x36ee=['BOOLEAN','STRING','INTEGER'];(function(_0x51491a,_0x8858df){var _0x3f2b9d=function(_0x1239d3){while(--_0x1239d3){_0x51491a['push'](_0x51491a['shift']());}};_0x3f2b9d(++_0x8858df);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe36e('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe36e('0x0')]},'pass':{'type':Sequelize[_0xe36e('0x0')]},'port':{'type':Sequelize[_0xe36e('0x1')]},'secure':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xe36e('0x0')]},'authentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x5452bb,_0xf5efa3){var _0x2f8efa=function(_0x337af4){while(--_0x337af4){_0x5452bb['push'](_0x5452bb['shift']());}};_0x2f8efa(++_0xf5efa3);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9349d8f..38fb15a 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 _0x3fef=['nolimit','order','sort','where','filters','merge','filter','MailServerOut','include','rows','catch','show','params','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x526085,_0x303b9e){var _0x1c6dde=function(_0x1c847c){while(--_0x1c847c){_0x526085['push'](_0x526085['shift']());}};_0x1c6dde(++_0x303b9e);}(_0x3fef,0x1f4));var _0xf3fe=function(_0x230c08,_0x3c1ba0){_0x230c08=_0x230c08-0x0;var _0x1f6b33=_0x3fef[_0x230c08];return _0x1f6b33;};'use strict';var emlformat=require(_0xf3fe('0x0'));var rimraf=require(_0xf3fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3fe('0x2'));var moment=require(_0xf3fe('0x3'));var BPromise=require(_0xf3fe('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf3fe('0x5'));var sox=require(_0xf3fe('0x6'));var csv=require('to-csv');var ejs=require(_0xf3fe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3fe('0x8'));var squel=require(_0xf3fe('0x9'));var crypto=require('crypto');var jsforce=require(_0xf3fe('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf3fe('0xb'));var Papa=require(_0xf3fe('0xc'));var Redis=require(_0xf3fe('0xd'));var authService=require(_0xf3fe('0xe'));var qs=require(_0xf3fe('0xf'));var as=require(_0xf3fe('0x10'));var hardwareService=require(_0xf3fe('0x11'));var logger=require('../../config/logger')(_0xf3fe('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3fe('0x13'));var db=require(_0xf3fe('0x14'))['db'];function respondWithStatusCode(_0x1c5208,_0x416ad2){_0x416ad2=_0x416ad2||0xcc;return function(_0xcef894){if(_0xcef894){return _0x1c5208[_0xf3fe('0x15')](_0x416ad2);}return _0x1c5208['status'](_0x416ad2)[_0xf3fe('0x16')]();};}function respondWithResult(_0x1dd9f4,_0x24358d){_0x24358d=_0x24358d||0xc8;return function(_0x25c4b3){if(_0x25c4b3){return _0x1dd9f4[_0xf3fe('0x17')](_0x24358d)['json'](_0x25c4b3);}};}function respondWithFilteredResult(_0x2e6034,_0x303237){return function(_0x5a20d1){if(_0x5a20d1){var _0x5198b9=typeof _0x303237[_0xf3fe('0x18')]==='undefined'&&typeof _0x303237[_0xf3fe('0x19')]==='undefined';var _0x57b49e=_0x5a20d1[_0xf3fe('0x1a')];var _0x3916ff=_0x5198b9?0x0:_0x303237[_0xf3fe('0x18')];var _0x5022ac=_0x5198b9?_0x5a20d1[_0xf3fe('0x1a')]:_0x303237['offset']+_0x303237[_0xf3fe('0x19')];var _0x15c13c;if(_0x5022ac>=_0x57b49e){_0x5022ac=_0x57b49e;_0x15c13c=0xc8;}else{_0x15c13c=0xce;}_0x2e6034[_0xf3fe('0x17')](_0x15c13c);return _0x2e6034[_0xf3fe('0x1b')](_0xf3fe('0x1c'),_0x3916ff+'-'+_0x5022ac+'/'+_0x57b49e)[_0xf3fe('0x1d')](_0x5a20d1);}return null;};}function patchUpdates(_0x2b7330){return function(_0x2680d9){try{jsonpatch[_0xf3fe('0x1e')](_0x2680d9,_0x2b7330,!![]);}catch(_0x4cb430){return BPromise[_0xf3fe('0x1f')](_0x4cb430);}return _0x2680d9[_0xf3fe('0x20')]();};}function saveUpdates(_0x4ada54,_0x1960eb){return function(_0x2f3caa){if(_0x2f3caa){return _0x2f3caa[_0xf3fe('0x21')](_0x4ada54)[_0xf3fe('0x22')](function(_0x3a8715){return _0x3a8715;});}return null;};}function removeEntity(_0x4c01d7,_0x246b06){return function(_0x29fefc){if(_0x29fefc){return _0x29fefc[_0xf3fe('0x23')]()[_0xf3fe('0x22')](function(){_0x4c01d7[_0xf3fe('0x17')](0xcc)[_0xf3fe('0x16')]();});}};}function handleEntityNotFound(_0x59542e,_0x107f56){return function(_0x27c7ba){if(!_0x27c7ba){_0x59542e[_0xf3fe('0x15')](0x194);}return _0x27c7ba;};}function handleError(_0x26ceb6,_0x48fc43){_0x48fc43=_0x48fc43||0x1f4;return function(_0x1fed55){logger[_0xf3fe('0x24')](_0x1fed55[_0xf3fe('0x25')]);if(_0x1fed55[_0xf3fe('0x26')]){delete _0x1fed55['name'];}_0x26ceb6[_0xf3fe('0x17')](_0x48fc43)['send'](_0x1fed55);};}exports[_0xf3fe('0x27')]=function(_0x29f2e7,_0x4abbae){var _0x46a008={},_0x5d8b3d={},_0xbe134={'count':0x0,'rows':[]};var _0x23baf8=_[_0xf3fe('0x28')](db['MailServerOut'][_0xf3fe('0x29')],function(_0x3696e9){return{'name':_0x3696e9[_0xf3fe('0x2a')],'type':_0x3696e9[_0xf3fe('0x2b')]['key']};});_0x5d8b3d[_0xf3fe('0x2c')]=_[_0xf3fe('0x28')](_0x23baf8,_0xf3fe('0x26'));_0x5d8b3d[_0xf3fe('0x2d')]=_[_0xf3fe('0x2e')](_0x29f2e7[_0xf3fe('0x2d')]);_0x5d8b3d['filters']=_[_0xf3fe('0x2f')](_0x5d8b3d[_0xf3fe('0x2c')],_0x5d8b3d[_0xf3fe('0x2d')]);_0x46a008[_0xf3fe('0x30')]=_[_0xf3fe('0x2f')](_0x5d8b3d[_0xf3fe('0x2c')],qs[_0xf3fe('0x31')](_0x29f2e7[_0xf3fe('0x2d')][_0xf3fe('0x31')]));_0x46a008[_0xf3fe('0x30')]=_0x46a008[_0xf3fe('0x30')][_0xf3fe('0x32')]?_0x46a008[_0xf3fe('0x30')]:_0x5d8b3d['model'];if(!_0x29f2e7['query'][_0xf3fe('0x33')](_0xf3fe('0x34'))){_0x46a008[_0xf3fe('0x19')]=qs[_0xf3fe('0x19')](_0x29f2e7[_0xf3fe('0x2d')]['limit']);_0x46a008['offset']=qs[_0xf3fe('0x18')](_0x29f2e7['query'][_0xf3fe('0x18')]);}_0x46a008[_0xf3fe('0x35')]=qs[_0xf3fe('0x36')](_0x29f2e7[_0xf3fe('0x2d')][_0xf3fe('0x36')]);_0x46a008[_0xf3fe('0x37')]=qs[_0xf3fe('0x38')](_['pick'](_0x29f2e7[_0xf3fe('0x2d')],_0x5d8b3d[_0xf3fe('0x38')]),_0x23baf8);if(_0x29f2e7[_0xf3fe('0x2d')]['filter']){_0x46a008[_0xf3fe('0x37')]=_[_0xf3fe('0x39')](_0x46a008['where'],{'$or':_[_0xf3fe('0x28')](_0x23baf8,function(_0x3f4226){if(_0x3f4226[_0xf3fe('0x2b')]!=='VIRTUAL'){var _0x264edf={};_0x264edf[_0x3f4226[_0xf3fe('0x26')]]={'$like':'%'+_0x29f2e7['query'][_0xf3fe('0x3a')]+'%'};return _0x264edf;}})});}_0x46a008=_[_0xf3fe('0x39')]({},_0x46a008,_0x29f2e7['options']);var _0x2e3e4e={'where':_0x46a008[_0xf3fe('0x37')]};return db[_0xf3fe('0x3b')]['count'](_0x2e3e4e)[_0xf3fe('0x22')](function(_0x29376b){_0xbe134['count']=_0x29376b;if(_0x29f2e7[_0xf3fe('0x2d')]['includeAll']){_0x46a008[_0xf3fe('0x3c')]=[{'all':!![]}];}return db[_0xf3fe('0x3b')]['findAll'](_0x46a008);})[_0xf3fe('0x22')](function(_0x336641){_0xbe134[_0xf3fe('0x3d')]=_0x336641;return _0xbe134;})[_0xf3fe('0x22')](respondWithFilteredResult(_0x4abbae,_0x46a008))[_0xf3fe('0x3e')](handleError(_0x4abbae,null));};exports[_0xf3fe('0x3f')]=function(_0x4d9a07,_0x12f16d){var _0x5b595e={'raw':!![],'where':{'id':_0x4d9a07[_0xf3fe('0x40')]['id']}},_0x47a898={};_0x47a898[_0xf3fe('0x2c')]=_[_0xf3fe('0x2e')](db[_0xf3fe('0x3b')][_0xf3fe('0x29')]);_0x47a898[_0xf3fe('0x2d')]=_[_0xf3fe('0x2e')](_0x4d9a07[_0xf3fe('0x2d')]);_0x47a898[_0xf3fe('0x38')]=_[_0xf3fe('0x2f')](_0x47a898['model'],_0x47a898[_0xf3fe('0x2d')]);_0x5b595e[_0xf3fe('0x30')]=_[_0xf3fe('0x2f')](_0x47a898[_0xf3fe('0x2c')],qs[_0xf3fe('0x31')](_0x4d9a07[_0xf3fe('0x2d')]['fields']));_0x5b595e[_0xf3fe('0x30')]=_0x5b595e[_0xf3fe('0x30')][_0xf3fe('0x32')]?_0x5b595e[_0xf3fe('0x30')]:_0x47a898[_0xf3fe('0x2c')];if(_0x4d9a07['query']['includeAll']){_0x5b595e[_0xf3fe('0x3c')]=[{'all':!![]}];}_0x5b595e=_['merge']({},_0x5b595e,_0x4d9a07[_0xf3fe('0x41')]);return db['MailServerOut'][_0xf3fe('0x42')](_0x5b595e)['then'](handleEntityNotFound(_0x12f16d,null))[_0xf3fe('0x22')](respondWithResult(_0x12f16d,null))[_0xf3fe('0x3e')](handleError(_0x12f16d,null));};exports['create']=function(_0x33451d,_0x3e0269){return db[_0xf3fe('0x3b')][_0xf3fe('0x43')](_0x33451d[_0xf3fe('0x44')],{})[_0xf3fe('0x22')](respondWithResult(_0x3e0269,0xc9))[_0xf3fe('0x3e')](handleError(_0x3e0269,null));};exports[_0xf3fe('0x21')]=function(_0x34318d,_0x359da2){if(_0x34318d[_0xf3fe('0x44')]['id']){delete _0x34318d[_0xf3fe('0x44')]['id'];}return db[_0xf3fe('0x3b')][_0xf3fe('0x42')]({'where':{'id':_0x34318d[_0xf3fe('0x40')]['id']}})['then'](handleEntityNotFound(_0x359da2,null))['then'](saveUpdates(_0x34318d[_0xf3fe('0x44')],null))[_0xf3fe('0x22')](respondWithResult(_0x359da2,null))['catch'](handleError(_0x359da2,null));};exports[_0xf3fe('0x23')]=function(_0x4b76da,_0x414366){return db[_0xf3fe('0x3b')][_0xf3fe('0x42')]({'where':{'id':_0x4b76da[_0xf3fe('0x40')]['id']}})['then'](handleEntityNotFound(_0x414366,null))[_0xf3fe('0x22')](removeEntity(_0x414366,null))[_0xf3fe('0x3e')](handleError(_0x414366,null));}; \ No newline at end of file +var _0xda61=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','offset','count','limit','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','MailServerOut','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format'];(function(_0x507c3d,_0x918f4c){var _0x3581dd=function(_0x26b98e){while(--_0x26b98e){_0x507c3d['push'](_0x507c3d['shift']());}};_0x3581dd(++_0x918f4c);}(_0xda61,0x1af));var _0x1da6=function(_0xb40841,_0xb587f8){_0xb40841=_0xb40841-0x0;var _0x4cce06=_0xda61[_0xb40841];return _0x4cce06;};'use strict';var emlformat=require(_0x1da6('0x0'));var rimraf=require(_0x1da6('0x1'));var zipdir=require(_0x1da6('0x2'));var jsonpatch=require(_0x1da6('0x3'));var rp=require(_0x1da6('0x4'));var moment=require('moment');var BPromise=require(_0x1da6('0x5'));var Mustache=require('mustache');var util=require(_0x1da6('0x6'));var path=require(_0x1da6('0x7'));var sox=require(_0x1da6('0x8'));var csv=require(_0x1da6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1da6('0xa'));var _=require(_0x1da6('0xb'));var squel=require(_0x1da6('0xc'));var crypto=require(_0x1da6('0xd'));var jsforce=require(_0x1da6('0xe'));var deskjs=require(_0x1da6('0xf'));var toCsv=require(_0x1da6('0x9'));var querystring=require(_0x1da6('0x10'));var Papa=require(_0x1da6('0x11'));var Redis=require('ioredis');var authService=require(_0x1da6('0x12'));var qs=require(_0x1da6('0x13'));var as=require(_0x1da6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1da6('0x15'));var utils=require('../../config/utils');var config=require(_0x1da6('0x16'));var licenseUtil=require(_0x1da6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291586,_0x3dbae2){_0x3dbae2=_0x3dbae2||0xcc;return function(_0x341575){if(_0x341575){return _0x291586[_0x1da6('0x18')](_0x3dbae2);}return _0x291586[_0x1da6('0x19')](_0x3dbae2)['end']();};}function respondWithResult(_0x11c88d,_0x2569cf){_0x2569cf=_0x2569cf||0xc8;return function(_0xfb7841){if(_0xfb7841){return _0x11c88d[_0x1da6('0x19')](_0x2569cf)['json'](_0xfb7841);}};}function respondWithFilteredResult(_0x36261c,_0x5845b1){return function(_0x5ac7be){if(_0x5ac7be){var _0x3763d1=typeof _0x5845b1[_0x1da6('0x1a')]==='undefined'&&typeof _0x5845b1['limit']==='undefined';var _0x4d24be=_0x5ac7be[_0x1da6('0x1b')];var _0x5dbe43=_0x3763d1?0x0:_0x5845b1[_0x1da6('0x1a')];var _0x316e43=_0x3763d1?_0x5ac7be[_0x1da6('0x1b')]:_0x5845b1[_0x1da6('0x1a')]+_0x5845b1[_0x1da6('0x1c')];var _0xe07f10;if(_0x316e43>=_0x4d24be){_0x316e43=_0x4d24be;_0xe07f10=0xc8;}else{_0xe07f10=0xce;}_0x36261c[_0x1da6('0x19')](_0xe07f10);return _0x36261c['set'](_0x1da6('0x1d'),_0x5dbe43+'-'+_0x316e43+'/'+_0x4d24be)[_0x1da6('0x1e')](_0x5ac7be);}return null;};}function patchUpdates(_0x35c65b){return function(_0x36d784){try{jsonpatch[_0x1da6('0x1f')](_0x36d784,_0x35c65b,!![]);}catch(_0x2bd1e2){return BPromise['reject'](_0x2bd1e2);}return _0x36d784[_0x1da6('0x20')]();};}function saveUpdates(_0x2e1d02,_0x3b579b){return function(_0x7f5b5b){if(_0x7f5b5b){return _0x7f5b5b[_0x1da6('0x21')](_0x2e1d02)['then'](function(_0x4b77f3){return _0x4b77f3;});}return null;};}function removeEntity(_0x3bcffb,_0x22d142){return function(_0x2aa7e3){if(_0x2aa7e3){return _0x2aa7e3[_0x1da6('0x22')]()[_0x1da6('0x23')](function(){_0x3bcffb[_0x1da6('0x19')](0xcc)[_0x1da6('0x24')]();});}};}function handleEntityNotFound(_0x1f9fed,_0x48b833){return function(_0x37f080){if(!_0x37f080){_0x1f9fed[_0x1da6('0x18')](0x194);}return _0x37f080;};}function handleError(_0x4ea4d8,_0x2e7127){_0x2e7127=_0x2e7127||0x1f4;return function(_0x15269b){logger['error'](_0x15269b[_0x1da6('0x25')]);if(_0x15269b[_0x1da6('0x26')]){delete _0x15269b[_0x1da6('0x26')];}_0x4ea4d8[_0x1da6('0x19')](_0x2e7127)[_0x1da6('0x27')](_0x15269b);};}exports[_0x1da6('0x28')]=function(_0x37ddca,_0x463ee2){var _0x35f93c={},_0x58924b={},_0x483ba7={'count':0x0,'rows':[]};var _0x5009e5=_[_0x1da6('0x29')](db['MailServerOut'][_0x1da6('0x2a')],function(_0x561a3f){return{'name':_0x561a3f[_0x1da6('0x2b')],'type':_0x561a3f[_0x1da6('0x2c')][_0x1da6('0x2d')]};});_0x58924b[_0x1da6('0x2e')]=_[_0x1da6('0x29')](_0x5009e5,_0x1da6('0x26'));_0x58924b[_0x1da6('0x2f')]=_[_0x1da6('0x30')](_0x37ddca['query']);_0x58924b[_0x1da6('0x31')]=_[_0x1da6('0x32')](_0x58924b[_0x1da6('0x2e')],_0x58924b['query']);_0x35f93c[_0x1da6('0x33')]=_[_0x1da6('0x32')](_0x58924b['model'],qs['fields'](_0x37ddca['query'][_0x1da6('0x34')]));_0x35f93c[_0x1da6('0x33')]=_0x35f93c[_0x1da6('0x33')][_0x1da6('0x35')]?_0x35f93c[_0x1da6('0x33')]:_0x58924b[_0x1da6('0x2e')];if(!_0x37ddca[_0x1da6('0x2f')][_0x1da6('0x36')](_0x1da6('0x37'))){_0x35f93c[_0x1da6('0x1c')]=qs[_0x1da6('0x1c')](_0x37ddca[_0x1da6('0x2f')][_0x1da6('0x1c')]);_0x35f93c[_0x1da6('0x1a')]=qs[_0x1da6('0x1a')](_0x37ddca[_0x1da6('0x2f')]['offset']);}_0x35f93c['order']=qs[_0x1da6('0x38')](_0x37ddca[_0x1da6('0x2f')]['sort']);_0x35f93c[_0x1da6('0x39')]=qs[_0x1da6('0x31')](_['pick'](_0x37ddca[_0x1da6('0x2f')],_0x58924b['filters']),_0x5009e5);if(_0x37ddca[_0x1da6('0x2f')][_0x1da6('0x3a')]){_0x35f93c[_0x1da6('0x39')]=_[_0x1da6('0x3b')](_0x35f93c[_0x1da6('0x39')],{'$or':_[_0x1da6('0x29')](_0x5009e5,function(_0x3df46b){if(_0x3df46b[_0x1da6('0x2c')]!=='VIRTUAL'){var _0x56fb2f={};_0x56fb2f[_0x3df46b[_0x1da6('0x26')]]={'$like':'%'+_0x37ddca['query'][_0x1da6('0x3a')]+'%'};return _0x56fb2f;}})});}_0x35f93c=_[_0x1da6('0x3b')]({},_0x35f93c,_0x37ddca[_0x1da6('0x3c')]);var _0x34b2cc={'where':_0x35f93c[_0x1da6('0x39')]};return db[_0x1da6('0x3d')][_0x1da6('0x1b')](_0x34b2cc)[_0x1da6('0x23')](function(_0x5f4908){_0x483ba7[_0x1da6('0x1b')]=_0x5f4908;if(_0x37ddca['query']['includeAll']){_0x35f93c[_0x1da6('0x3e')]=[{'all':!![]}];}return db[_0x1da6('0x3d')][_0x1da6('0x3f')](_0x35f93c);})['then'](function(_0x3088c5){_0x483ba7[_0x1da6('0x40')]=_0x3088c5;return _0x483ba7;})[_0x1da6('0x23')](respondWithFilteredResult(_0x463ee2,_0x35f93c))[_0x1da6('0x41')](handleError(_0x463ee2,null));};exports[_0x1da6('0x42')]=function(_0x1e5039,_0x39f192){var _0x19f115={'raw':!![],'where':{'id':_0x1e5039['params']['id']}},_0x3f9ca5={};_0x3f9ca5[_0x1da6('0x2e')]=_[_0x1da6('0x30')](db[_0x1da6('0x3d')][_0x1da6('0x2a')]);_0x3f9ca5['query']=_[_0x1da6('0x30')](_0x1e5039[_0x1da6('0x2f')]);_0x3f9ca5[_0x1da6('0x31')]=_[_0x1da6('0x32')](_0x3f9ca5[_0x1da6('0x2e')],_0x3f9ca5[_0x1da6('0x2f')]);_0x19f115[_0x1da6('0x33')]=_[_0x1da6('0x32')](_0x3f9ca5[_0x1da6('0x2e')],qs[_0x1da6('0x34')](_0x1e5039[_0x1da6('0x2f')][_0x1da6('0x34')]));_0x19f115[_0x1da6('0x33')]=_0x19f115['attributes']['length']?_0x19f115[_0x1da6('0x33')]:_0x3f9ca5[_0x1da6('0x2e')];if(_0x1e5039[_0x1da6('0x2f')][_0x1da6('0x43')]){_0x19f115[_0x1da6('0x3e')]=[{'all':!![]}];}_0x19f115=_[_0x1da6('0x3b')]({},_0x19f115,_0x1e5039[_0x1da6('0x3c')]);return db[_0x1da6('0x3d')][_0x1da6('0x44')](_0x19f115)[_0x1da6('0x23')](handleEntityNotFound(_0x39f192,null))[_0x1da6('0x23')](respondWithResult(_0x39f192,null))[_0x1da6('0x41')](handleError(_0x39f192,null));};exports[_0x1da6('0x45')]=function(_0x32dab7,_0x25a784){return db[_0x1da6('0x3d')]['create'](_0x32dab7['body'],{})[_0x1da6('0x23')](respondWithResult(_0x25a784,0xc9))[_0x1da6('0x41')](handleError(_0x25a784,null));};exports[_0x1da6('0x21')]=function(_0x319b58,_0x1f0e1e){if(_0x319b58[_0x1da6('0x46')]['id']){delete _0x319b58[_0x1da6('0x46')]['id'];}return db[_0x1da6('0x3d')]['find']({'where':{'id':_0x319b58['params']['id']}})[_0x1da6('0x23')](handleEntityNotFound(_0x1f0e1e,null))[_0x1da6('0x23')](saveUpdates(_0x319b58[_0x1da6('0x46')],null))[_0x1da6('0x23')](respondWithResult(_0x1f0e1e,null))[_0x1da6('0x41')](handleError(_0x1f0e1e,null));};exports['destroy']=function(_0x6bd256,_0x5c68a2){return db[_0x1da6('0x3d')][_0x1da6('0x44')]({'where':{'id':_0x6bd256[_0x1da6('0x47')]['id']}})[_0x1da6('0x23')](handleEntityNotFound(_0x5c68a2,null))[_0x1da6('0x23')](removeEntity(_0x5c68a2,null))['catch'](handleError(_0x5c68a2,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7f807d5..27a6b95 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 _0x83d0=['api','moment','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger'];(function(_0xef6978,_0x2bc786){var _0x42e3f4=function(_0xd7b566){while(--_0xd7b566){_0xef6978['push'](_0xef6978['shift']());}};_0x42e3f4(++_0x2bc786);}(_0x83d0,0x1b9));var _0x083d=function(_0x95b5bb,_0x42e3b1){_0x95b5bb=_0x95b5bb-0x0;var _0x5b2964=_0x83d0[_0x95b5bb];return _0x5b2964;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var logger=require(_0x083d('0x2'))(_0x083d('0x3'));var moment=require(_0x083d('0x4'));var BPromise=require('bluebird');var rp=require(_0x083d('0x5'));var fs=require('fs');var path=require(_0x083d('0x6'));var rimraf=require(_0x083d('0x7'));var config=require('../../config/environment');var attributes=require(_0x083d('0x8'));module[_0x083d('0x9')]=function(_0x4f7de3,_0x4caee5){return _0x4f7de3[_0x083d('0xa')]('MailServerOut',attributes,{'tableName':_0x083d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa306=['util','../../config/logger','moment','request-promise','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0xa306,0x12c));var _0x6a30=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xa306[_0x25d386];return _0x857f4a;};'use strict';var _=require('lodash');var util=require(_0x6a30('0x0'));var logger=require(_0x6a30('0x1'))('api');var moment=require(_0x6a30('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a30('0x3'));var fs=require('fs');var path=require(_0x6a30('0x4'));var rimraf=require('rimraf');var config=require(_0x6a30('0x5'));var attributes=require(_0x6a30('0x6'));module['exports']=function(_0x8172ea,_0x162ca0){return _0x8172ea[_0x6a30('0x7')](_0x6a30('0x8'),attributes,{'tableName':_0x6a30('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 8f460cd..312f248 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5f49bc,_0x548555){var _0x44bbb9=function(_0x5e2caf){while(--_0x5e2caf){_0x5f49bc['push'](_0x5f49bc['shift']());}};_0x44bbb9(++_0x548555);}(_0xadb5,0xad));var _0x5adb=function(_0x4c1d34,_0x4998ef){_0x4c1d34=_0x4c1d34-0x0;var _0x5e403c=_0xadb5[_0x4c1d34];return _0x5e403c;};'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']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2803ce,_0x383e2f){var _0x1ddb4b=function(_0xca1eb4){while(--_0xca1eb4){_0x2803ce['push'](_0x2803ce['shift']());}};_0x1ddb4b(++_0x383e2f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14189f,_0x1de4a3){_0x14189f=_0x14189f-0x0;var _0x59ac9c=_0x5f2f[_0x14189f];return _0x59ac9c;};'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')]('MailServerOut,\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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b638202..3b836aa 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 _0x629b=['../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x629b,0xde));var _0xb629=function(_0x36cd6c,_0x3e6f2e){_0x36cd6c=_0x36cd6c-0x0;var _0x28a708=_0x629b[_0x36cd6c];return _0x28a708;};'use strict';var multer=require(_0xb629('0x0'));var util=require(_0xb629('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb629('0x2')]();var fs_extra=require(_0xb629('0x3'));var auth=require(_0xb629('0x4'));var interaction=require(_0xb629('0x5'));var config=require(_0xb629('0x6'));var controller=require(_0xb629('0x7'));router['get']('/',auth[_0xb629('0x8')](),controller[_0xb629('0x9')]);router[_0xb629('0xa')]('/describe',auth[_0xb629('0x8')](),controller['describe']);router[_0xb629('0xa')](_0xb629('0xb'),auth['isAuthenticated'](),controller[_0xb629('0xc')]);router[_0xb629('0xd')]('/',auth[_0xb629('0x8')](),controller[_0xb629('0xe')]);router[_0xb629('0xf')]('/:id',auth[_0xb629('0x8')](),controller[_0xb629('0x10')]);router[_0xb629('0x11')]('/:id',auth[_0xb629('0x8')](),controller['destroy']);module[_0xb629('0x12')]=router; \ No newline at end of file +var _0x91ea=['get','index','/describe','/:id','show','isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailSubstatus.controller'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x91ea,0xd0));var _0xa91e=function(_0x29dd7a,_0x2710e7){_0x29dd7a=_0x29dd7a-0x0;var _0x4b862d=_0x91ea[_0x29dd7a];return _0x4b862d;};'use strict';var multer=require(_0xa91e('0x0'));var util=require(_0xa91e('0x1'));var path=require(_0xa91e('0x2'));var timeout=require(_0xa91e('0x3'));var express=require(_0xa91e('0x4'));var router=express['Router']();var fs_extra=require(_0xa91e('0x5'));var auth=require(_0xa91e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa91e('0x7'));router[_0xa91e('0x8')]('/',auth['isAuthenticated'](),controller[_0xa91e('0x9')]);router[_0xa91e('0x8')](_0xa91e('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa91e('0xb'),auth['isAuthenticated'](),controller[_0xa91e('0xc')]);router['post']('/',auth[_0xa91e('0xd')](),controller[_0xa91e('0xe')]);router['put']('/:id',auth[_0xa91e('0xd')](),controller[_0xa91e('0xf')]);router[_0xa91e('0x10')]('/:id',auth[_0xa91e('0xd')](),controller['destroy']);module[_0xa91e('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 45dcd6c..0a953a1 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 _0xa498=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa498,0x1d6));var _0x8a49=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0xa498[_0xd13171];return _0x452bd0;};'use strict';var Sequelize=require('sequelize');module[_0x8a49('0x0')]={'name':{'type':Sequelize[_0x8a49('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf072=['STRING','sequelize','exports'];(function(_0x341549,_0x3bce60){var _0x534527=function(_0xf6e9d5){while(--_0xf6e9d5){_0x341549['push'](_0x341549['shift']());}};_0x534527(++_0x3bce60);}(_0xf072,0x1cf));var _0x2f07=function(_0x19ca16,_0x3e3ec8){_0x19ca16=_0x19ca16-0x0;var _0x1fa0ff=_0xf072[_0x19ca16];return _0x1fa0ff;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index eb39dd9..7bf6cca 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 _0x5e3d=['index','MailSubstatus','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','pick','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','then','end','stack','name','send'];(function(_0x527a53,_0x3265d6){var _0x2332f5=function(_0x3b2d90){while(--_0x3b2d90){_0x527a53['push'](_0x527a53['shift']());}};_0x2332f5(++_0x3265d6);}(_0x5e3d,0x1c9));var _0xd5e3=function(_0x424fa8,_0x546150){_0x424fa8=_0x424fa8-0x0;var _0x291ab0=_0x5e3d[_0x424fa8];return _0x291ab0;};'use strict';var emlformat=require(_0xd5e3('0x0'));var rimraf=require(_0xd5e3('0x1'));var zipdir=require(_0xd5e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e3('0x3'));var moment=require(_0xd5e3('0x4'));var BPromise=require(_0xd5e3('0x5'));var Mustache=require('mustache');var util=require(_0xd5e3('0x6'));var path=require(_0xd5e3('0x7'));var sox=require(_0xd5e3('0x8'));var csv=require(_0xd5e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5e3('0xa'));var squel=require('squel');var crypto=require(_0xd5e3('0xb'));var jsforce=require(_0xd5e3('0xc'));var deskjs=require(_0xd5e3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e3('0xe'));var Redis=require(_0xd5e3('0xf'));var authService=require(_0xd5e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd5e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5e3('0x12'))(_0xd5e3('0x13'));var utils=require(_0xd5e3('0x14'));var config=require(_0xd5e3('0x15'));var licenseUtil=require(_0xd5e3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac5c0,_0x45993c){_0x45993c=_0x45993c||0xcc;return function(_0x3dc18c){if(_0x3dc18c){return _0x2ac5c0[_0xd5e3('0x17')](_0x45993c);}return _0x2ac5c0[_0xd5e3('0x18')](_0x45993c)['end']();};}function respondWithResult(_0xc4bb1d,_0x58a208){_0x58a208=_0x58a208||0xc8;return function(_0x45c785){if(_0x45c785){return _0xc4bb1d[_0xd5e3('0x18')](_0x58a208)[_0xd5e3('0x19')](_0x45c785);}};}function respondWithFilteredResult(_0xd1243b,_0x29883e){return function(_0x3f5f8b){if(_0x3f5f8b){var _0x23b034=typeof _0x29883e['offset']===_0xd5e3('0x1a')&&typeof _0x29883e['limit']===_0xd5e3('0x1a');var _0x5a5f35=_0x3f5f8b[_0xd5e3('0x1b')];var _0x2ecffa=_0x23b034?0x0:_0x29883e[_0xd5e3('0x1c')];var _0x5ede63=_0x23b034?_0x3f5f8b[_0xd5e3('0x1b')]:_0x29883e['offset']+_0x29883e[_0xd5e3('0x1d')];var _0x484bd7;if(_0x5ede63>=_0x5a5f35){_0x5ede63=_0x5a5f35;_0x484bd7=0xc8;}else{_0x484bd7=0xce;}_0xd1243b[_0xd5e3('0x18')](_0x484bd7);return _0xd1243b[_0xd5e3('0x1e')](_0xd5e3('0x1f'),_0x2ecffa+'-'+_0x5ede63+'/'+_0x5a5f35)['json'](_0x3f5f8b);}return null;};}function patchUpdates(_0x148704){return function(_0x4d34e2){try{jsonpatch[_0xd5e3('0x20')](_0x4d34e2,_0x148704,!![]);}catch(_0x9e5433){return BPromise['reject'](_0x9e5433);}return _0x4d34e2['save']();};}function saveUpdates(_0x55c090,_0x20941d){return function(_0x1e74d6){if(_0x1e74d6){return _0x1e74d6[_0xd5e3('0x21')](_0x55c090)['then'](function(_0x2a5b15){return _0x2a5b15;});}return null;};}function removeEntity(_0x47e23a,_0x483103){return function(_0x410def){if(_0x410def){return _0x410def[_0xd5e3('0x22')]()[_0xd5e3('0x23')](function(){_0x47e23a[_0xd5e3('0x18')](0xcc)[_0xd5e3('0x24')]();});}};}function handleEntityNotFound(_0x45d58c,_0x3bf220){return function(_0x3bc3e7){if(!_0x3bc3e7){_0x45d58c[_0xd5e3('0x17')](0x194);}return _0x3bc3e7;};}function handleError(_0x2bdfcd,_0x35f99b){_0x35f99b=_0x35f99b||0x1f4;return function(_0x1fe7b1){logger['error'](_0x1fe7b1[_0xd5e3('0x25')]);if(_0x1fe7b1[_0xd5e3('0x26')]){delete _0x1fe7b1[_0xd5e3('0x26')];}_0x2bdfcd[_0xd5e3('0x18')](_0x35f99b)[_0xd5e3('0x27')](_0x1fe7b1);};}exports[_0xd5e3('0x28')]=function(_0x5d5079,_0x1c9476){var _0x1b2f0c={},_0x355088={},_0x337284={'count':0x0,'rows':[]};var _0x231d31=_['map'](db[_0xd5e3('0x29')][_0xd5e3('0x2a')],function(_0x31a211){return{'name':_0x31a211['fieldName'],'type':_0x31a211[_0xd5e3('0x2b')][_0xd5e3('0x2c')]};});_0x355088['model']=_[_0xd5e3('0x2d')](_0x231d31,'name');_0x355088[_0xd5e3('0x2e')]=_[_0xd5e3('0x2f')](_0x5d5079[_0xd5e3('0x2e')]);_0x355088[_0xd5e3('0x30')]=_[_0xd5e3('0x31')](_0x355088['model'],_0x355088[_0xd5e3('0x2e')]);_0x1b2f0c[_0xd5e3('0x32')]=_[_0xd5e3('0x31')](_0x355088[_0xd5e3('0x33')],qs['fields'](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x34')]));_0x1b2f0c[_0xd5e3('0x32')]=_0x1b2f0c[_0xd5e3('0x32')][_0xd5e3('0x35')]?_0x1b2f0c[_0xd5e3('0x32')]:_0x355088['model'];if(!_0x5d5079[_0xd5e3('0x2e')]['hasOwnProperty'](_0xd5e3('0x36'))){_0x1b2f0c[_0xd5e3('0x1d')]=qs[_0xd5e3('0x1d')](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x1d')]);_0x1b2f0c['offset']=qs['offset'](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x1c')]);}_0x1b2f0c[_0xd5e3('0x37')]=qs['sort'](_0x5d5079[_0xd5e3('0x2e')]['sort']);_0x1b2f0c['where']=qs[_0xd5e3('0x30')](_[_0xd5e3('0x38')](_0x5d5079['query'],_0x355088[_0xd5e3('0x30')]),_0x231d31);if(_0x5d5079['query']['filter']){_0x1b2f0c[_0xd5e3('0x39')]=_[_0xd5e3('0x3a')](_0x1b2f0c[_0xd5e3('0x39')],{'$or':_[_0xd5e3('0x2d')](_0x231d31,function(_0x11bd1e){if(_0x11bd1e['type']!==_0xd5e3('0x3b')){var _0x2922b9={};_0x2922b9[_0x11bd1e[_0xd5e3('0x26')]]={'$like':'%'+_0x5d5079[_0xd5e3('0x2e')]['filter']+'%'};return _0x2922b9;}})});}_0x1b2f0c=_['merge']({},_0x1b2f0c,_0x5d5079[_0xd5e3('0x3c')]);var _0x3fbfe8={'where':_0x1b2f0c[_0xd5e3('0x39')]};return db['MailSubstatus'][_0xd5e3('0x1b')](_0x3fbfe8)[_0xd5e3('0x23')](function(_0x240909){_0x337284[_0xd5e3('0x1b')]=_0x240909;if(_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x3d')]){_0x1b2f0c[_0xd5e3('0x3e')]=[{'all':!![]}];}return db[_0xd5e3('0x29')]['findAll'](_0x1b2f0c);})[_0xd5e3('0x23')](function(_0xe93ce1){_0x337284[_0xd5e3('0x3f')]=_0xe93ce1;return _0x337284;})[_0xd5e3('0x23')](respondWithFilteredResult(_0x1c9476,_0x1b2f0c))['catch'](handleError(_0x1c9476,null));};exports[_0xd5e3('0x40')]=function(_0x312047,_0x57dce9){var _0x24da6e={'raw':!![],'where':{'id':_0x312047[_0xd5e3('0x41')]['id']}},_0x5d6001={};_0x5d6001['model']=_['keys'](db['MailSubstatus'][_0xd5e3('0x2a')]);_0x5d6001[_0xd5e3('0x2e')]=_['keys'](_0x312047[_0xd5e3('0x2e')]);_0x5d6001[_0xd5e3('0x30')]=_['intersection'](_0x5d6001['model'],_0x5d6001[_0xd5e3('0x2e')]);_0x24da6e[_0xd5e3('0x32')]=_[_0xd5e3('0x31')](_0x5d6001['model'],qs[_0xd5e3('0x34')](_0x312047[_0xd5e3('0x2e')][_0xd5e3('0x34')]));_0x24da6e['attributes']=_0x24da6e[_0xd5e3('0x32')][_0xd5e3('0x35')]?_0x24da6e[_0xd5e3('0x32')]:_0x5d6001[_0xd5e3('0x33')];if(_0x312047['query'][_0xd5e3('0x3d')]){_0x24da6e[_0xd5e3('0x3e')]=[{'all':!![]}];}_0x24da6e=_[_0xd5e3('0x3a')]({},_0x24da6e,_0x312047[_0xd5e3('0x3c')]);return db[_0xd5e3('0x29')][_0xd5e3('0x42')](_0x24da6e)[_0xd5e3('0x23')](handleEntityNotFound(_0x57dce9,null))['then'](respondWithResult(_0x57dce9,null))[_0xd5e3('0x43')](handleError(_0x57dce9,null));};exports['create']=function(_0x3eae7f,_0x2a0a2d){return db[_0xd5e3('0x29')][_0xd5e3('0x44')](_0x3eae7f[_0xd5e3('0x45')],{})['then'](respondWithResult(_0x2a0a2d,0xc9))[_0xd5e3('0x43')](handleError(_0x2a0a2d,null));};exports['update']=function(_0x11c4cb,_0x3295cb){if(_0x11c4cb[_0xd5e3('0x45')]['id']){delete _0x11c4cb[_0xd5e3('0x45')]['id'];}return db[_0xd5e3('0x29')][_0xd5e3('0x42')]({'where':{'id':_0x11c4cb['params']['id']}})[_0xd5e3('0x23')](handleEntityNotFound(_0x3295cb,null))[_0xd5e3('0x23')](saveUpdates(_0x11c4cb[_0xd5e3('0x45')],null))[_0xd5e3('0x23')](respondWithResult(_0x3295cb,null))['catch'](handleError(_0x3295cb,null));};exports['destroy']=function(_0x444e5d,_0x222406){return db[_0xd5e3('0x29')][_0xd5e3('0x42')]({'where':{'id':_0x444e5d[_0xd5e3('0x41')]['id']}})[_0xd5e3('0x23')](handleEntityNotFound(_0x222406,null))['then'](removeEntity(_0x222406,null))[_0xd5e3('0x43')](handleError(_0x222406,null));};exports['describe']=function(_0x2868da,_0x296c25){return db[_0xd5e3('0x29')][_0xd5e3('0x46')]()[_0xd5e3('0x23')](respondWithResult(_0x296c25,null))[_0xd5e3('0x43')](handleError(_0x296c25,null));}; \ No newline at end of file +var _0x9f0e=['count','limit','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset'];(function(_0x42d918,_0x4b76ca){var _0x5ac230=function(_0x22bf3d){while(--_0x22bf3d){_0x42d918['push'](_0x42d918['shift']());}};_0x5ac230(++_0x4b76ca);}(_0x9f0e,0x1d6));var _0xe9f0=function(_0x328b67,_0x579ccc){_0x328b67=_0x328b67-0x0;var _0x2fd9b8=_0x9f0e[_0x328b67];return _0x2fd9b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9f0('0x0'));var zipdir=require(_0xe9f0('0x1'));var jsonpatch=require(_0xe9f0('0x2'));var rp=require(_0xe9f0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x4'));var util=require(_0xe9f0('0x5'));var path=require(_0xe9f0('0x6'));var sox=require(_0xe9f0('0x7'));var csv=require(_0xe9f0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9f0('0x9'));var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9f0('0xc'));var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x8'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9f0('0x13'));var logger=require(_0xe9f0('0x14'))('api');var utils=require(_0xe9f0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe9f0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284821,_0x183517){_0x183517=_0x183517||0xcc;return function(_0x5c89db){if(_0x5c89db){return _0x284821['sendStatus'](_0x183517);}return _0x284821[_0xe9f0('0x17')](_0x183517)[_0xe9f0('0x18')]();};}function respondWithResult(_0x5ddf63,_0x1abd1b){_0x1abd1b=_0x1abd1b||0xc8;return function(_0x3a3038){if(_0x3a3038){return _0x5ddf63[_0xe9f0('0x17')](_0x1abd1b)[_0xe9f0('0x19')](_0x3a3038);}};}function respondWithFilteredResult(_0xfd4313,_0x2cfa03){return function(_0x2bbf61){if(_0x2bbf61){var _0x7b493d=typeof _0x2cfa03[_0xe9f0('0x1a')]==='undefined'&&typeof _0x2cfa03['limit']==='undefined';var _0x298bb5=_0x2bbf61['count'];var _0x5b5425=_0x7b493d?0x0:_0x2cfa03[_0xe9f0('0x1a')];var _0x53126=_0x7b493d?_0x2bbf61[_0xe9f0('0x1b')]:_0x2cfa03[_0xe9f0('0x1a')]+_0x2cfa03[_0xe9f0('0x1c')];var _0x220d7f;if(_0x53126>=_0x298bb5){_0x53126=_0x298bb5;_0x220d7f=0xc8;}else{_0x220d7f=0xce;}_0xfd4313[_0xe9f0('0x17')](_0x220d7f);return _0xfd4313[_0xe9f0('0x1d')]('Content-Range',_0x5b5425+'-'+_0x53126+'/'+_0x298bb5)[_0xe9f0('0x19')](_0x2bbf61);}return null;};}function patchUpdates(_0x37d619){return function(_0x2da712){try{jsonpatch['apply'](_0x2da712,_0x37d619,!![]);}catch(_0x47d6b6){return BPromise[_0xe9f0('0x1e')](_0x47d6b6);}return _0x2da712[_0xe9f0('0x1f')]();};}function saveUpdates(_0x9697cf,_0x24d65a){return function(_0x144dc4){if(_0x144dc4){return _0x144dc4[_0xe9f0('0x20')](_0x9697cf)[_0xe9f0('0x21')](function(_0x2371a7){return _0x2371a7;});}return null;};}function removeEntity(_0x577a6e,_0x486ffd){return function(_0x412b31){if(_0x412b31){return _0x412b31['destroy']()[_0xe9f0('0x21')](function(){_0x577a6e['status'](0xcc)[_0xe9f0('0x18')]();});}};}function handleEntityNotFound(_0x173511,_0x464ab8){return function(_0x4739bf){if(!_0x4739bf){_0x173511[_0xe9f0('0x22')](0x194);}return _0x4739bf;};}function handleError(_0xfcf2c6,_0x509136){_0x509136=_0x509136||0x1f4;return function(_0x185384){logger[_0xe9f0('0x23')](_0x185384[_0xe9f0('0x24')]);if(_0x185384['name']){delete _0x185384[_0xe9f0('0x25')];}_0xfcf2c6[_0xe9f0('0x17')](_0x509136)[_0xe9f0('0x26')](_0x185384);};}exports[_0xe9f0('0x27')]=function(_0x1742a1,_0x42e8e6){var _0x477a29={},_0x359e73={},_0x2793aa={'count':0x0,'rows':[]};var _0x2f7193=_[_0xe9f0('0x28')](db[_0xe9f0('0x29')][_0xe9f0('0x2a')],function(_0x156436){return{'name':_0x156436['fieldName'],'type':_0x156436[_0xe9f0('0x2b')]['key']};});_0x359e73[_0xe9f0('0x2c')]=_[_0xe9f0('0x28')](_0x2f7193,_0xe9f0('0x25'));_0x359e73['query']=_[_0xe9f0('0x2d')](_0x1742a1[_0xe9f0('0x2e')]);_0x359e73[_0xe9f0('0x2f')]=_['intersection'](_0x359e73[_0xe9f0('0x2c')],_0x359e73[_0xe9f0('0x2e')]);_0x477a29[_0xe9f0('0x30')]=_[_0xe9f0('0x31')](_0x359e73[_0xe9f0('0x2c')],qs[_0xe9f0('0x32')](_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x32')]));_0x477a29['attributes']=_0x477a29['attributes'][_0xe9f0('0x33')]?_0x477a29['attributes']:_0x359e73[_0xe9f0('0x2c')];if(!_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x34')](_0xe9f0('0x35'))){_0x477a29[_0xe9f0('0x1c')]=qs[_0xe9f0('0x1c')](_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x1c')]);_0x477a29[_0xe9f0('0x1a')]=qs['offset'](_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x1a')]);}_0x477a29['order']=qs['sort'](_0x1742a1['query']['sort']);_0x477a29[_0xe9f0('0x36')]=qs[_0xe9f0('0x2f')](_[_0xe9f0('0x37')](_0x1742a1[_0xe9f0('0x2e')],_0x359e73['filters']),_0x2f7193);if(_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x38')]){_0x477a29['where']=_[_0xe9f0('0x39')](_0x477a29[_0xe9f0('0x36')],{'$or':_[_0xe9f0('0x28')](_0x2f7193,function(_0x75b98b){if(_0x75b98b[_0xe9f0('0x2b')]!==_0xe9f0('0x3a')){var _0x174d9a={};_0x174d9a[_0x75b98b[_0xe9f0('0x25')]]={'$like':'%'+_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x38')]+'%'};return _0x174d9a;}})});}_0x477a29=_[_0xe9f0('0x39')]({},_0x477a29,_0x1742a1[_0xe9f0('0x3b')]);var _0x49179a={'where':_0x477a29[_0xe9f0('0x36')]};return db[_0xe9f0('0x29')][_0xe9f0('0x1b')](_0x49179a)[_0xe9f0('0x21')](function(_0xb8ae6d){_0x2793aa[_0xe9f0('0x1b')]=_0xb8ae6d;if(_0x1742a1[_0xe9f0('0x2e')][_0xe9f0('0x3c')]){_0x477a29[_0xe9f0('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0xe9f0('0x3e')](_0x477a29);})['then'](function(_0x314ef3){_0x2793aa[_0xe9f0('0x3f')]=_0x314ef3;return _0x2793aa;})['then'](respondWithFilteredResult(_0x42e8e6,_0x477a29))[_0xe9f0('0x40')](handleError(_0x42e8e6,null));};exports['show']=function(_0x25dca4,_0x3682ae){var _0x406506={'raw':!![],'where':{'id':_0x25dca4[_0xe9f0('0x41')]['id']}},_0x2474bb={};_0x2474bb[_0xe9f0('0x2c')]=_[_0xe9f0('0x2d')](db[_0xe9f0('0x29')][_0xe9f0('0x2a')]);_0x2474bb[_0xe9f0('0x2e')]=_[_0xe9f0('0x2d')](_0x25dca4['query']);_0x2474bb['filters']=_[_0xe9f0('0x31')](_0x2474bb['model'],_0x2474bb['query']);_0x406506['attributes']=_['intersection'](_0x2474bb[_0xe9f0('0x2c')],qs['fields'](_0x25dca4['query'][_0xe9f0('0x32')]));_0x406506[_0xe9f0('0x30')]=_0x406506[_0xe9f0('0x30')][_0xe9f0('0x33')]?_0x406506[_0xe9f0('0x30')]:_0x2474bb[_0xe9f0('0x2c')];if(_0x25dca4[_0xe9f0('0x2e')][_0xe9f0('0x3c')]){_0x406506['include']=[{'all':!![]}];}_0x406506=_[_0xe9f0('0x39')]({},_0x406506,_0x25dca4['options']);return db[_0xe9f0('0x29')][_0xe9f0('0x42')](_0x406506)[_0xe9f0('0x21')](handleEntityNotFound(_0x3682ae,null))[_0xe9f0('0x21')](respondWithResult(_0x3682ae,null))[_0xe9f0('0x40')](handleError(_0x3682ae,null));};exports[_0xe9f0('0x43')]=function(_0x1c4f8a,_0x22d4c4){return db['MailSubstatus'][_0xe9f0('0x43')](_0x1c4f8a['body'],{})[_0xe9f0('0x21')](respondWithResult(_0x22d4c4,0xc9))[_0xe9f0('0x40')](handleError(_0x22d4c4,null));};exports[_0xe9f0('0x20')]=function(_0x14e49c,_0x16edf0){if(_0x14e49c[_0xe9f0('0x44')]['id']){delete _0x14e49c['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x14e49c[_0xe9f0('0x41')]['id']}})[_0xe9f0('0x21')](handleEntityNotFound(_0x16edf0,null))[_0xe9f0('0x21')](saveUpdates(_0x14e49c[_0xe9f0('0x44')],null))['then'](respondWithResult(_0x16edf0,null))[_0xe9f0('0x40')](handleError(_0x16edf0,null));};exports[_0xe9f0('0x45')]=function(_0x59b7ee,_0x35dc96){return db[_0xe9f0('0x29')][_0xe9f0('0x42')]({'where':{'id':_0x59b7ee['params']['id']}})[_0xe9f0('0x21')](handleEntityNotFound(_0x35dc96,null))[_0xe9f0('0x21')](removeEntity(_0x35dc96,null))[_0xe9f0('0x40')](handleError(_0x35dc96,null));};exports[_0xe9f0('0x46')]=function(_0x400436,_0x132cb6){return db[_0xe9f0('0x29')][_0xe9f0('0x46')]()[_0xe9f0('0x21')](respondWithResult(_0x132cb6,null))[_0xe9f0('0x40')](handleError(_0x132cb6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ed5274a..e65a1b9 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 _0x05f1=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x05f1,0x110));var _0x105f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x05f1[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x105f('0x0'));var MailSubstatus=require(_0x105f('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x105f('0x2')](0x0);var events={'afterUpdate':_0x105f('0x3')};function emitEvent(_0x50c660){return function(_0x201681,_0x6db4ec,_0x2760b9){MailSubstatusEvents[_0x105f('0x4')](_0x50c660+':'+_0x201681['id'],_0x201681);MailSubstatusEvents[_0x105f('0x4')](_0x50c660,_0x201681);_0x2760b9(null);};}for(var e in events){if(events[_0x105f('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x105f('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x5e83=['MailSubstatus','update','emit','events','../../mysqldb'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5e83,0xbc));var _0x35e8=function(_0x28ad0a,_0x1c7181){_0x28ad0a=_0x28ad0a-0x0;var _0x1d1116=_0x5e83[_0x28ad0a];return _0x1d1116;};'use strict';var EventEmitter=require(_0x35e8('0x0'));var MailSubstatus=require(_0x35e8('0x1'))['db'][_0x35e8('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x35e8('0x3')};function emitEvent(_0x2c2fee){return function(_0x12fbfb,_0x2c74e6,_0x3ebebd){MailSubstatusEvents[_0x35e8('0x4')](_0x2c2fee+':'+_0x12fbfb['id'],_0x12fbfb);MailSubstatusEvents['emit'](_0x2c2fee,_0x12fbfb);_0x3ebebd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a955b29..14e0afc 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 _0x469a=['define','MailSubstatus','mail_substatuses','update','name','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x203c18,_0x677d84){var _0x2674e1=function(_0x2c7bb3){while(--_0x2c7bb3){_0x203c18['push'](_0x203c18['shift']());}};_0x2674e1(++_0x677d84);}(_0x469a,0x1ca));var _0xa469=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x469a[_0x368bba];return _0x409f8f;};'use strict';var attributes=require(_0xa469('0x0'));module['exports']=function(_0x2ad32f){var _0x2c2e46=_0x2ad32f['models'];return _0x2ad32f[_0xa469('0x1')](_0xa469('0x2'),attributes,{'tableName':_0xa469('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x240ceb,_0x113cb9,_0x4db8dd){return _0x2c2e46['Condition'][_0xa469('0x4')]({'value':_0x240ceb[_0xa469('0x5')]},{'where':{'field':'mailSubstatus','value':_0x240ceb[_0xa469('0x6')][_0xa469('0x5')]}})[_0xa469('0x7')](function(){_0x4db8dd();})[_0xa469('0x8')](function(_0x2f43f7){_0x4db8dd(_0x2f43f7);});}}});}; \ No newline at end of file +var _0x4be6=['exports','models','define','mail_substatuses','Condition','update','_previousDataValues','catch','./mailSubstatus.attributes'];(function(_0x6656b1,_0x3421ee){var _0x45ae3a=function(_0x4ba6f5){while(--_0x4ba6f5){_0x6656b1['push'](_0x6656b1['shift']());}};_0x45ae3a(++_0x3421ee);}(_0x4be6,0x74));var _0x64be=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x4be6[_0x55969b];return _0x3d7fc1;};'use strict';var attributes=require(_0x64be('0x0'));module[_0x64be('0x1')]=function(_0x2f6127){var _0xb4315=_0x2f6127[_0x64be('0x2')];return _0x2f6127[_0x64be('0x3')]('MailSubstatus',attributes,{'tableName':_0x64be('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2f2775,_0x326c4c,_0x39ded0){return _0xb4315[_0x64be('0x5')][_0x64be('0x6')]({'value':_0x2f2775['name']},{'where':{'field':'mailSubstatus','value':_0x2f2775[_0x64be('0x7')]['name']}})['then'](function(){_0x39ded0();})[_0x64be('0x8')](function(_0xb21dbd){_0x39ded0(_0xb21dbd);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 87fb098..d5341b3 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 _0xa1ff=['MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x310500,_0x3533f7){var _0x573c1d=function(_0x7156f7){while(--_0x7156f7){_0x310500['push'](_0x310500['shift']());}};_0x573c1d(++_0x3533f7);}(_0xa1ff,0x86));var _0xfa1f=function(_0x403062,_0x4a6cef){_0x403062=_0x403062-0x0;var _0x4a9249=_0xa1ff[_0x403062];return _0x4a9249;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa1f('0x0'));var BPromise=require(_0xfa1f('0x1'));var rs=require(_0xfa1f('0x2'));var fs=require('fs');var Redis=require(_0xfa1f('0x3'));var db=require(_0xfa1f('0x4'))['db'];var utils=require(_0xfa1f('0x5'));var logger=require(_0xfa1f('0x6'))(_0xfa1f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa1f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580b1e,_0x2a1c73,_0x21704f){return new BPromise(function(_0x4bf1a8,_0x4607d8){return client[_0xfa1f('0x9')](_0x580b1e,_0x21704f)['then'](function(_0x573b04){logger['info'](_0xfa1f('0xa'),_0x2a1c73,'request\x20sent');logger['debug'](_0xfa1f('0xb'),_0x2a1c73,_0xfa1f('0xc'),JSON[_0xfa1f('0xd')](_0x573b04));if(_0x573b04[_0xfa1f('0xe')]){if(_0x573b04[_0xfa1f('0xe')]['code']===0x1f4){logger[_0xfa1f('0xe')](_0xfa1f('0xa'),_0x2a1c73,_0x573b04[_0xfa1f('0xe')][_0xfa1f('0xf')]);return _0x4607d8(_0x573b04[_0xfa1f('0xe')][_0xfa1f('0xf')]);}logger[_0xfa1f('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x2a1c73,_0x573b04['error'][_0xfa1f('0xf')]);return _0x4bf1a8(_0x573b04[_0xfa1f('0xe')]['message']);}else{logger[_0xfa1f('0x10')](_0xfa1f('0xa'),_0x2a1c73,_0xfa1f('0xc'));_0x4bf1a8(_0x573b04['result'][_0xfa1f('0xf')]);}})[_0xfa1f('0x11')](function(_0x362ac6){logger[_0xfa1f('0xe')](_0xfa1f('0xa'),_0x2a1c73,_0x362ac6);_0x4607d8(_0x362ac6);});});} \ No newline at end of file +var _0x3474=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x373db9,_0x5819cd){var _0x3b423f=function(_0x1256cc){while(--_0x1256cc){_0x373db9['push'](_0x373db9['shift']());}};_0x3b423f(++_0x5819cd);}(_0x3474,0x14d));var _0x4347=function(_0x3d75cb,_0x3737e1){_0x3d75cb=_0x3d75cb-0x0;var _0x49a38f=_0x3474[_0x3d75cb];return _0x49a38f;};'use strict';var _=require(_0x4347('0x0'));var util=require('util');var moment=require(_0x4347('0x1'));var BPromise=require(_0x4347('0x2'));var rs=require(_0x4347('0x3'));var fs=require('fs');var Redis=require(_0x4347('0x4'));var db=require(_0x4347('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4347('0x6'))(_0x4347('0x7'));var config=require(_0x4347('0x8'));var jayson=require(_0x4347('0x9'));var client=jayson['client'][_0x4347('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530155,_0x4ea5de,_0x202705){return new BPromise(function(_0x5503b1,_0x2b1c79){return client[_0x4347('0xb')](_0x530155,_0x202705)[_0x4347('0xc')](function(_0x4521ca){logger['info'](_0x4347('0xd'),_0x4ea5de,_0x4347('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4ea5de,_0x4347('0xe'),JSON[_0x4347('0xf')](_0x4521ca));if(_0x4521ca[_0x4347('0x10')]){if(_0x4521ca['error'][_0x4347('0x11')]===0x1f4){logger[_0x4347('0x10')](_0x4347('0xd'),_0x4ea5de,_0x4521ca[_0x4347('0x10')][_0x4347('0x12')]);return _0x2b1c79(_0x4521ca[_0x4347('0x10')][_0x4347('0x12')]);}logger[_0x4347('0x10')](_0x4347('0xd'),_0x4ea5de,_0x4521ca[_0x4347('0x10')][_0x4347('0x12')]);return _0x5503b1(_0x4521ca[_0x4347('0x10')][_0x4347('0x12')]);}else{logger['info'](_0x4347('0xd'),_0x4ea5de,_0x4347('0xe'));_0x5503b1(_0x4521ca[_0x4347('0x13')]['message']);}})[_0x4347('0x14')](function(_0x44166c){logger[_0x4347('0x10')](_0x4347('0xd'),_0x4ea5de,_0x44166c);_0x2b1c79(_0x44166c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 53b18b4..5b2e1b1 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 _0x0059=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x0059,0x14d));var _0x9005=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x0059[_0x6aad74];return _0x5b1c38;};'use strict';var multer=require(_0x9005('0x0'));var util=require('util');var path=require(_0x9005('0x1'));var timeout=require(_0x9005('0x2'));var express=require(_0x9005('0x3'));var router=express[_0x9005('0x4')]();var fs_extra=require(_0x9005('0x5'));var auth=require(_0x9005('0x6'));var interaction=require(_0x9005('0x7'));var config=require(_0x9005('0x8'));var controller=require('./mailTransferReport.controller');router[_0x9005('0x9')]('/',auth[_0x9005('0xa')](),controller[_0x9005('0xb')]);router[_0x9005('0x9')](_0x9005('0xc'),auth[_0x9005('0xa')](),controller[_0x9005('0xd')]);router[_0x9005('0x9')](_0x9005('0xe'),auth[_0x9005('0xa')](),controller[_0x9005('0xf')]);router[_0x9005('0x10')]('/',auth[_0x9005('0xa')](),controller[_0x9005('0x11')]);router[_0x9005('0x12')](_0x9005('0xe'),auth[_0x9005('0xa')](),controller[_0x9005('0x13')]);router['delete'](_0x9005('0xe'),auth['isAuthenticated'](),controller[_0x9005('0x14')]);module[_0x9005('0x15')]=router; \ No newline at end of file +var _0x19a2=['../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4f15d2,_0x2086cb){var _0x2522b6=function(_0x42f918){while(--_0x42f918){_0x4f15d2['push'](_0x4f15d2['shift']());}};_0x2522b6(++_0x2086cb);}(_0x19a2,0x1c7));var _0x219a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x19a2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x219a('0x0'));var util=require(_0x219a('0x1'));var path=require(_0x219a('0x2'));var timeout=require(_0x219a('0x3'));var express=require(_0x219a('0x4'));var router=express[_0x219a('0x5')]();var fs_extra=require(_0x219a('0x6'));var auth=require(_0x219a('0x7'));var interaction=require(_0x219a('0x8'));var config=require('../../config/environment');var controller=require(_0x219a('0x9'));router['get']('/',auth[_0x219a('0xa')](),controller[_0x219a('0xb')]);router[_0x219a('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x219a('0xd')]);router[_0x219a('0xc')](_0x219a('0xe'),auth[_0x219a('0xa')](),controller[_0x219a('0xf')]);router[_0x219a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x219a('0x11')](_0x219a('0xe'),auth[_0x219a('0xa')](),controller[_0x219a('0x12')]);router[_0x219a('0x13')](_0x219a('0xe'),auth[_0x219a('0xa')](),controller[_0x219a('0x14')]);module[_0x219a('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2186ded..36570a0 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xccfe68,_0x4447f4){var _0x452fda=function(_0x4c50cb){while(--_0x4c50cb){_0xccfe68['push'](_0xccfe68['shift']());}};_0x452fda(++_0x4447f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2f0244,_0x5c752b){var _0x1699a1=function(_0x32d4f9){while(--_0x32d4f9){_0x2f0244['push'](_0x2f0244['shift']());}};_0x1699a1(++_0x5c752b);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4a3b6df..edd3283 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 _0x080c=['options','includeAll','MailTransferReport','findAll','rows','catch','include','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL'];(function(_0x26e602,_0x302c2d){var _0xc105bd=function(_0x3b5b4f){while(--_0x3b5b4f){_0x26e602['push'](_0x26e602['shift']());}};_0xc105bd(++_0x302c2d);}(_0x080c,0xe7));var _0xc080=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x080c[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0xc080('0x0'));var rimraf=require(_0xc080('0x1'));var zipdir=require(_0xc080('0x2'));var jsonpatch=require(_0xc080('0x3'));var rp=require(_0xc080('0x4'));var moment=require('moment');var BPromise=require(_0xc080('0x5'));var Mustache=require('mustache');var util=require(_0xc080('0x6'));var path=require('path');var sox=require(_0xc080('0x7'));var csv=require('to-csv');var ejs=require(_0xc080('0x8'));var fs=require('fs');var fs_extra=require(_0xc080('0x9'));var _=require('lodash');var squel=require(_0xc080('0xa'));var crypto=require('crypto');var jsforce=require(_0xc080('0xb'));var deskjs=require(_0xc080('0xc'));var toCsv=require(_0xc080('0xd'));var querystring=require(_0xc080('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc080('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc080('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc080('0x11'))(_0xc080('0x12'));var utils=require(_0xc080('0x13'));var config=require(_0xc080('0x14'));var licenseUtil=require(_0xc080('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d87fd,_0x42a577){_0x42a577=_0x42a577||0xcc;return function(_0x3e3eab){if(_0x3e3eab){return _0x3d87fd[_0xc080('0x16')](_0x42a577);}return _0x3d87fd[_0xc080('0x17')](_0x42a577)['end']();};}function respondWithResult(_0x1991f1,_0x4318d6){_0x4318d6=_0x4318d6||0xc8;return function(_0x7bbe56){if(_0x7bbe56){return _0x1991f1['status'](_0x4318d6)['json'](_0x7bbe56);}};}function respondWithFilteredResult(_0x230eea,_0x4c3560){return function(_0x43b9df){if(_0x43b9df){var _0x247799=typeof _0x4c3560[_0xc080('0x18')]===_0xc080('0x19')&&typeof _0x4c3560[_0xc080('0x1a')]==='undefined';var _0x272ba9=_0x43b9df[_0xc080('0x1b')];var _0x3e06f3=_0x247799?0x0:_0x4c3560[_0xc080('0x18')];var _0x430c94=_0x247799?_0x43b9df[_0xc080('0x1b')]:_0x4c3560[_0xc080('0x18')]+_0x4c3560[_0xc080('0x1a')];var _0x23f562;if(_0x430c94>=_0x272ba9){_0x430c94=_0x272ba9;_0x23f562=0xc8;}else{_0x23f562=0xce;}_0x230eea['status'](_0x23f562);return _0x230eea[_0xc080('0x1c')](_0xc080('0x1d'),_0x3e06f3+'-'+_0x430c94+'/'+_0x272ba9)[_0xc080('0x1e')](_0x43b9df);}return null;};}function patchUpdates(_0x54d866){return function(_0x56e75c){try{jsonpatch['apply'](_0x56e75c,_0x54d866,!![]);}catch(_0x238339){return BPromise[_0xc080('0x1f')](_0x238339);}return _0x56e75c[_0xc080('0x20')]();};}function saveUpdates(_0x279008,_0x3f47b8){return function(_0x1420f1){if(_0x1420f1){return _0x1420f1[_0xc080('0x21')](_0x279008)[_0xc080('0x22')](function(_0x44c9ac){return _0x44c9ac;});}return null;};}function removeEntity(_0x40b9fa,_0x2552e4){return function(_0x525ded){if(_0x525ded){return _0x525ded['destroy']()['then'](function(){_0x40b9fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x554783,_0x4da0eb){return function(_0x47e321){if(!_0x47e321){_0x554783[_0xc080('0x16')](0x194);}return _0x47e321;};}function handleError(_0x3aac05,_0xd368f0){_0xd368f0=_0xd368f0||0x1f4;return function(_0x5f3cc0){logger[_0xc080('0x23')](_0x5f3cc0[_0xc080('0x24')]);if(_0x5f3cc0[_0xc080('0x25')]){delete _0x5f3cc0[_0xc080('0x25')];}_0x3aac05[_0xc080('0x17')](_0xd368f0)[_0xc080('0x26')](_0x5f3cc0);};}exports[_0xc080('0x27')]=function(_0x1c481c,_0xcfad32){var _0x4b178d={},_0x121455={},_0x124b31={'count':0x0,'rows':[]};var _0x4995a1=_[_0xc080('0x28')](db['MailTransferReport'][_0xc080('0x29')],function(_0x17d2c0){return{'name':_0x17d2c0[_0xc080('0x2a')],'type':_0x17d2c0['type'][_0xc080('0x2b')]};});_0x121455[_0xc080('0x2c')]=_[_0xc080('0x28')](_0x4995a1,_0xc080('0x25'));_0x121455['query']=_[_0xc080('0x2d')](_0x1c481c[_0xc080('0x2e')]);_0x121455[_0xc080('0x2f')]=_[_0xc080('0x30')](_0x121455['model'],_0x121455['query']);_0x4b178d[_0xc080('0x31')]=_[_0xc080('0x30')](_0x121455['model'],qs[_0xc080('0x32')](_0x1c481c[_0xc080('0x2e')][_0xc080('0x32')]));_0x4b178d[_0xc080('0x31')]=_0x4b178d['attributes'][_0xc080('0x33')]?_0x4b178d[_0xc080('0x31')]:_0x121455[_0xc080('0x2c')];if(!_0x1c481c[_0xc080('0x2e')][_0xc080('0x34')](_0xc080('0x35'))){_0x4b178d[_0xc080('0x1a')]=qs[_0xc080('0x1a')](_0x1c481c[_0xc080('0x2e')][_0xc080('0x1a')]);_0x4b178d[_0xc080('0x18')]=qs[_0xc080('0x18')](_0x1c481c[_0xc080('0x2e')][_0xc080('0x18')]);}_0x4b178d[_0xc080('0x36')]=qs[_0xc080('0x37')](_0x1c481c[_0xc080('0x2e')][_0xc080('0x37')]);_0x4b178d['where']=qs[_0xc080('0x2f')](_['pick'](_0x1c481c[_0xc080('0x2e')],_0x121455[_0xc080('0x2f')]),_0x4995a1);if(_0x1c481c['query'][_0xc080('0x38')]){_0x4b178d[_0xc080('0x39')]=_[_0xc080('0x3a')](_0x4b178d['where'],{'$or':_[_0xc080('0x28')](_0x4995a1,function(_0x2a8316){if(_0x2a8316[_0xc080('0x3b')]!==_0xc080('0x3c')){var _0x112853={};_0x112853[_0x2a8316[_0xc080('0x25')]]={'$like':'%'+_0x1c481c[_0xc080('0x2e')]['filter']+'%'};return _0x112853;}})});}_0x4b178d=_[_0xc080('0x3a')]({},_0x4b178d,_0x1c481c[_0xc080('0x3d')]);var _0x149288={'where':_0x4b178d[_0xc080('0x39')]};return db['MailTransferReport'][_0xc080('0x1b')](_0x149288)[_0xc080('0x22')](function(_0x117316){_0x124b31[_0xc080('0x1b')]=_0x117316;if(_0x1c481c[_0xc080('0x2e')][_0xc080('0x3e')]){_0x4b178d['include']=[{'all':!![]}];}return db[_0xc080('0x3f')][_0xc080('0x40')](_0x4b178d);})['then'](function(_0x51030f){_0x124b31[_0xc080('0x41')]=_0x51030f;return _0x124b31;})[_0xc080('0x22')](respondWithFilteredResult(_0xcfad32,_0x4b178d))[_0xc080('0x42')](handleError(_0xcfad32,null));};exports['show']=function(_0x5b8cc4,_0x5628fb){var _0x472f06={'raw':!![],'where':{'id':_0x5b8cc4['params']['id']}},_0x1a055b={};_0x1a055b['model']=_[_0xc080('0x2d')](db[_0xc080('0x3f')][_0xc080('0x29')]);_0x1a055b[_0xc080('0x2e')]=_['keys'](_0x5b8cc4[_0xc080('0x2e')]);_0x1a055b[_0xc080('0x2f')]=_[_0xc080('0x30')](_0x1a055b['model'],_0x1a055b[_0xc080('0x2e')]);_0x472f06['attributes']=_[_0xc080('0x30')](_0x1a055b[_0xc080('0x2c')],qs[_0xc080('0x32')](_0x5b8cc4[_0xc080('0x2e')][_0xc080('0x32')]));_0x472f06[_0xc080('0x31')]=_0x472f06['attributes'][_0xc080('0x33')]?_0x472f06[_0xc080('0x31')]:_0x1a055b[_0xc080('0x2c')];if(_0x5b8cc4[_0xc080('0x2e')]['includeAll']){_0x472f06[_0xc080('0x43')]=[{'all':!![]}];}_0x472f06=_[_0xc080('0x3a')]({},_0x472f06,_0x5b8cc4['options']);return db[_0xc080('0x3f')][_0xc080('0x44')](_0x472f06)[_0xc080('0x22')](handleEntityNotFound(_0x5628fb,null))[_0xc080('0x22')](respondWithResult(_0x5628fb,null))[_0xc080('0x42')](handleError(_0x5628fb,null));};exports['create']=function(_0x3ac68e,_0x528d5e){return db['MailTransferReport']['create'](_0x3ac68e[_0xc080('0x45')],{})[_0xc080('0x22')](respondWithResult(_0x528d5e,0xc9))[_0xc080('0x42')](handleError(_0x528d5e,null));};exports[_0xc080('0x21')]=function(_0x44a134,_0x3c3474){if(_0x44a134['body']['id']){delete _0x44a134[_0xc080('0x45')]['id'];}return db['MailTransferReport'][_0xc080('0x44')]({'where':{'id':_0x44a134[_0xc080('0x46')]['id']}})[_0xc080('0x22')](handleEntityNotFound(_0x3c3474,null))[_0xc080('0x22')](saveUpdates(_0x44a134[_0xc080('0x45')],null))[_0xc080('0x22')](respondWithResult(_0x3c3474,null))[_0xc080('0x42')](handleError(_0x3c3474,null));};exports[_0xc080('0x47')]=function(_0x5c19d7,_0x25af98){return db['MailTransferReport'][_0xc080('0x44')]({'where':{'id':_0x5c19d7['params']['id']}})[_0xc080('0x22')](handleEntityNotFound(_0x25af98,null))['then'](removeEntity(_0x25af98,null))[_0xc080('0x42')](handleError(_0x25af98,null));};exports[_0xc080('0x48')]=function(_0x1d8fd2,_0x5ccc2d){return db[_0xc080('0x3f')][_0xc080('0x48')]()[_0xc080('0x22')](respondWithResult(_0x5ccc2d,null))[_0xc080('0x42')](handleError(_0x5ccc2d,null));}; \ No newline at end of file +var _0x5909=['body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','include','find','create'];(function(_0x4e7967,_0x501f5c){var _0x3f5adf=function(_0x121819){while(--_0x121819){_0x4e7967['push'](_0x4e7967['shift']());}};_0x3f5adf(++_0x501f5c);}(_0x5909,0xde));var _0x9590=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x5909[_0x160248];return _0x4e589d;};'use strict';var emlformat=require(_0x9590('0x0'));var rimraf=require(_0x9590('0x1'));var zipdir=require(_0x9590('0x2'));var jsonpatch=require(_0x9590('0x3'));var rp=require(_0x9590('0x4'));var moment=require('moment');var BPromise=require(_0x9590('0x5'));var Mustache=require(_0x9590('0x6'));var util=require(_0x9590('0x7'));var path=require('path');var sox=require(_0x9590('0x8'));var csv=require(_0x9590('0x9'));var ejs=require(_0x9590('0xa'));var fs=require('fs');var fs_extra=require(_0x9590('0xb'));var _=require(_0x9590('0xc'));var squel=require(_0x9590('0xd'));var crypto=require(_0x9590('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9590('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9590('0x10'));var Papa=require('papaparse');var Redis=require(_0x9590('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9590('0x12'));var logger=require(_0x9590('0x13'))(_0x9590('0x14'));var utils=require('../../config/utils');var config=require(_0x9590('0x15'));var licenseUtil=require(_0x9590('0x16'));var db=require(_0x9590('0x17'))['db'];function respondWithStatusCode(_0xde3484,_0x533773){_0x533773=_0x533773||0xcc;return function(_0xfd083d){if(_0xfd083d){return _0xde3484[_0x9590('0x18')](_0x533773);}return _0xde3484[_0x9590('0x19')](_0x533773)['end']();};}function respondWithResult(_0x482521,_0x5c3fca){_0x5c3fca=_0x5c3fca||0xc8;return function(_0x45c8d7){if(_0x45c8d7){return _0x482521[_0x9590('0x19')](_0x5c3fca)[_0x9590('0x1a')](_0x45c8d7);}};}function respondWithFilteredResult(_0x13e0bd,_0x21f49d){return function(_0x5ebf93){if(_0x5ebf93){var _0x2398f3=typeof _0x21f49d[_0x9590('0x1b')]===_0x9590('0x1c')&&typeof _0x21f49d[_0x9590('0x1d')]===_0x9590('0x1c');var _0x49ccc2=_0x5ebf93['count'];var _0x2b9d3a=_0x2398f3?0x0:_0x21f49d[_0x9590('0x1b')];var _0x5902c0=_0x2398f3?_0x5ebf93[_0x9590('0x1e')]:_0x21f49d['offset']+_0x21f49d['limit'];var _0x2e82b2;if(_0x5902c0>=_0x49ccc2){_0x5902c0=_0x49ccc2;_0x2e82b2=0xc8;}else{_0x2e82b2=0xce;}_0x13e0bd[_0x9590('0x19')](_0x2e82b2);return _0x13e0bd[_0x9590('0x1f')]('Content-Range',_0x2b9d3a+'-'+_0x5902c0+'/'+_0x49ccc2)[_0x9590('0x1a')](_0x5ebf93);}return null;};}function patchUpdates(_0x4f29c0){return function(_0x1816e5){try{jsonpatch[_0x9590('0x20')](_0x1816e5,_0x4f29c0,!![]);}catch(_0x1dd3fc){return BPromise[_0x9590('0x21')](_0x1dd3fc);}return _0x1816e5['save']();};}function saveUpdates(_0x17e794,_0x5a226a){return function(_0xa8f417){if(_0xa8f417){return _0xa8f417[_0x9590('0x22')](_0x17e794)[_0x9590('0x23')](function(_0x184be7){return _0x184be7;});}return null;};}function removeEntity(_0x133f00,_0x225e19){return function(_0x51a709){if(_0x51a709){return _0x51a709[_0x9590('0x24')]()[_0x9590('0x23')](function(){_0x133f00['status'](0xcc)[_0x9590('0x25')]();});}};}function handleEntityNotFound(_0xace9b2,_0x455786){return function(_0x1e6e3b){if(!_0x1e6e3b){_0xace9b2[_0x9590('0x18')](0x194);}return _0x1e6e3b;};}function handleError(_0x3914cc,_0x4d5d92){_0x4d5d92=_0x4d5d92||0x1f4;return function(_0x216196){logger[_0x9590('0x26')](_0x216196[_0x9590('0x27')]);if(_0x216196[_0x9590('0x28')]){delete _0x216196['name'];}_0x3914cc[_0x9590('0x19')](_0x4d5d92)[_0x9590('0x29')](_0x216196);};}exports['index']=function(_0x482e32,_0x1ff705){var _0x144fdd={},_0x4094bd={},_0x56f3d0={'count':0x0,'rows':[]};var _0x30895a=_[_0x9590('0x2a')](db[_0x9590('0x2b')][_0x9590('0x2c')],function(_0x301a77){return{'name':_0x301a77[_0x9590('0x2d')],'type':_0x301a77[_0x9590('0x2e')][_0x9590('0x2f')]};});_0x4094bd[_0x9590('0x30')]=_[_0x9590('0x2a')](_0x30895a,_0x9590('0x28'));_0x4094bd[_0x9590('0x31')]=_[_0x9590('0x32')](_0x482e32[_0x9590('0x31')]);_0x4094bd['filters']=_[_0x9590('0x33')](_0x4094bd[_0x9590('0x30')],_0x4094bd[_0x9590('0x31')]);_0x144fdd[_0x9590('0x34')]=_[_0x9590('0x33')](_0x4094bd[_0x9590('0x30')],qs[_0x9590('0x35')](_0x482e32[_0x9590('0x31')]['fields']));_0x144fdd[_0x9590('0x34')]=_0x144fdd[_0x9590('0x34')][_0x9590('0x36')]?_0x144fdd[_0x9590('0x34')]:_0x4094bd[_0x9590('0x30')];if(!_0x482e32[_0x9590('0x31')]['hasOwnProperty'](_0x9590('0x37'))){_0x144fdd[_0x9590('0x1d')]=qs[_0x9590('0x1d')](_0x482e32[_0x9590('0x31')][_0x9590('0x1d')]);_0x144fdd[_0x9590('0x1b')]=qs['offset'](_0x482e32[_0x9590('0x31')][_0x9590('0x1b')]);}_0x144fdd['order']=qs[_0x9590('0x38')](_0x482e32[_0x9590('0x31')][_0x9590('0x38')]);_0x144fdd['where']=qs[_0x9590('0x39')](_[_0x9590('0x3a')](_0x482e32[_0x9590('0x31')],_0x4094bd['filters']),_0x30895a);if(_0x482e32[_0x9590('0x31')][_0x9590('0x3b')]){_0x144fdd[_0x9590('0x3c')]=_[_0x9590('0x3d')](_0x144fdd[_0x9590('0x3c')],{'$or':_[_0x9590('0x2a')](_0x30895a,function(_0x2bb80e){if(_0x2bb80e[_0x9590('0x2e')]!==_0x9590('0x3e')){var _0x26a7ba={};_0x26a7ba[_0x2bb80e[_0x9590('0x28')]]={'$like':'%'+_0x482e32[_0x9590('0x31')][_0x9590('0x3b')]+'%'};return _0x26a7ba;}})});}_0x144fdd=_[_0x9590('0x3d')]({},_0x144fdd,_0x482e32[_0x9590('0x3f')]);var _0x21b2e1={'where':_0x144fdd['where']};return db[_0x9590('0x2b')][_0x9590('0x1e')](_0x21b2e1)[_0x9590('0x23')](function(_0x4a9469){_0x56f3d0[_0x9590('0x1e')]=_0x4a9469;if(_0x482e32[_0x9590('0x31')][_0x9590('0x40')]){_0x144fdd['include']=[{'all':!![]}];}return db[_0x9590('0x2b')]['findAll'](_0x144fdd);})[_0x9590('0x23')](function(_0x44a337){_0x56f3d0['rows']=_0x44a337;return _0x56f3d0;})['then'](respondWithFilteredResult(_0x1ff705,_0x144fdd))[_0x9590('0x41')](handleError(_0x1ff705,null));};exports[_0x9590('0x42')]=function(_0x50f828,_0x1a300c){var _0x20bce7={'raw':!![],'where':{'id':_0x50f828['params']['id']}},_0x4c59a6={};_0x4c59a6[_0x9590('0x30')]=_[_0x9590('0x32')](db[_0x9590('0x2b')][_0x9590('0x2c')]);_0x4c59a6[_0x9590('0x31')]=_[_0x9590('0x32')](_0x50f828[_0x9590('0x31')]);_0x4c59a6['filters']=_[_0x9590('0x33')](_0x4c59a6[_0x9590('0x30')],_0x4c59a6[_0x9590('0x31')]);_0x20bce7[_0x9590('0x34')]=_[_0x9590('0x33')](_0x4c59a6[_0x9590('0x30')],qs[_0x9590('0x35')](_0x50f828[_0x9590('0x31')][_0x9590('0x35')]));_0x20bce7[_0x9590('0x34')]=_0x20bce7[_0x9590('0x34')][_0x9590('0x36')]?_0x20bce7[_0x9590('0x34')]:_0x4c59a6[_0x9590('0x30')];if(_0x50f828[_0x9590('0x31')]['includeAll']){_0x20bce7[_0x9590('0x43')]=[{'all':!![]}];}_0x20bce7=_[_0x9590('0x3d')]({},_0x20bce7,_0x50f828[_0x9590('0x3f')]);return db['MailTransferReport'][_0x9590('0x44')](_0x20bce7)[_0x9590('0x23')](handleEntityNotFound(_0x1a300c,null))[_0x9590('0x23')](respondWithResult(_0x1a300c,null))[_0x9590('0x41')](handleError(_0x1a300c,null));};exports[_0x9590('0x45')]=function(_0x55b89e,_0x122a59){return db[_0x9590('0x2b')][_0x9590('0x45')](_0x55b89e['body'],{})[_0x9590('0x23')](respondWithResult(_0x122a59,0xc9))['catch'](handleError(_0x122a59,null));};exports[_0x9590('0x22')]=function(_0x44bd8e,_0x5d2a6f){if(_0x44bd8e[_0x9590('0x46')]['id']){delete _0x44bd8e[_0x9590('0x46')]['id'];}return db[_0x9590('0x2b')][_0x9590('0x44')]({'where':{'id':_0x44bd8e[_0x9590('0x47')]['id']}})[_0x9590('0x23')](handleEntityNotFound(_0x5d2a6f,null))[_0x9590('0x23')](saveUpdates(_0x44bd8e[_0x9590('0x46')],null))[_0x9590('0x23')](respondWithResult(_0x5d2a6f,null))[_0x9590('0x41')](handleError(_0x5d2a6f,null));};exports['destroy']=function(_0x2a18b5,_0x265908){return db[_0x9590('0x2b')][_0x9590('0x44')]({'where':{'id':_0x2a18b5[_0x9590('0x47')]['id']}})['then'](handleEntityNotFound(_0x265908,null))[_0x9590('0x23')](removeEntity(_0x265908,null))[_0x9590('0x41')](handleError(_0x265908,null));};exports[_0x9590('0x48')]=function(_0x4f4b41,_0x56fa85){return db[_0x9590('0x2b')]['describe']()['then'](respondWithResult(_0x56fa85,null))[_0x9590('0x41')](handleError(_0x56fa85,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index be211d8..b935658 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 _0x34d2=['moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x34d2,0x7b));var _0x234d=function(_0x239551,_0x4c6b21){_0x239551=_0x239551-0x0;var _0x48d082=_0x34d2[_0x239551];return _0x48d082;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var logger=require(_0x234d('0x1'))(_0x234d('0x2'));var moment=require(_0x234d('0x3'));var BPromise=require(_0x234d('0x4'));var rp=require(_0x234d('0x5'));var fs=require('fs');var path=require(_0x234d('0x6'));var rimraf=require(_0x234d('0x7'));var config=require('../../config/environment');var attributes=require(_0x234d('0x8'));module[_0x234d('0x9')]=function(_0x5dfaf4,_0x244090){return _0x5dfaf4[_0x234d('0xa')](_0x234d('0xb'),attributes,{'tableName':_0x234d('0xc'),'paranoid':![],'indexes':[{'name':_0x234d('0xd'),'fields':[_0x234d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf849=['../../config/logger','moment','bluebird','request-promise','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','util'];(function(_0x5b0537,_0x57a9d8){var _0x2b4a09=function(_0xb7d140){while(--_0xb7d140){_0x5b0537['push'](_0x5b0537['shift']());}};_0x2b4a09(++_0x57a9d8);}(_0xf849,0x193));var _0x9f84=function(_0x26fa43,_0x30a86c){_0x26fa43=_0x26fa43-0x0;var _0x81ca8d=_0xf849[_0x26fa43];return _0x81ca8d;};'use strict';var _=require(_0x9f84('0x0'));var util=require(_0x9f84('0x1'));var logger=require(_0x9f84('0x2'))('api');var moment=require(_0x9f84('0x3'));var BPromise=require(_0x9f84('0x4'));var rp=require(_0x9f84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f84('0x6'));module['exports']=function(_0x4ce658,_0x1c0717){return _0x4ce658['define']('MailTransferReport',attributes,{'tableName':_0x9f84('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9f84('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7a813fc..0799330 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 _0x1d06=['message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x580843,_0x3185a6){var _0x2c3364=function(_0x3b7092){while(--_0x3b7092){_0x580843['push'](_0x580843['shift']());}};_0x2c3364(++_0x3185a6);}(_0x1d06,0x12a));var _0x61d0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1d06[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x61d0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61d0('0x1'));var fs=require('fs');var Redis=require(_0x61d0('0x2'));var db=require(_0x61d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x61d0('0x4'))(_0x61d0('0x5'));var config=require(_0x61d0('0x6'));var jayson=require(_0x61d0('0x7'));var client=jayson[_0x61d0('0x8')][_0x61d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x264d4e,_0x24028b,_0x37f836){return new BPromise(function(_0x3c6310,_0x7e059c){return client[_0x61d0('0xa')](_0x264d4e,_0x37f836)[_0x61d0('0xb')](function(_0x3a4c2d){logger['info'](_0x61d0('0xc'),_0x24028b,'request\x20sent');logger['debug'](_0x61d0('0xd'),_0x24028b,_0x61d0('0xe'),JSON[_0x61d0('0xf')](_0x3a4c2d));if(_0x3a4c2d[_0x61d0('0x10')]){if(_0x3a4c2d[_0x61d0('0x10')]['code']===0x1f4){logger[_0x61d0('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x24028b,_0x3a4c2d['error'][_0x61d0('0x11')]);return _0x7e059c(_0x3a4c2d[_0x61d0('0x10')][_0x61d0('0x11')]);}logger[_0x61d0('0x10')](_0x61d0('0xc'),_0x24028b,_0x3a4c2d['error'][_0x61d0('0x11')]);return _0x3c6310(_0x3a4c2d['error']['message']);}else{logger[_0x61d0('0x12')](_0x61d0('0xc'),_0x24028b,_0x61d0('0xe'));_0x3c6310(_0x3a4c2d[_0x61d0('0x13')][_0x61d0('0x11')]);}})[_0x61d0('0x14')](function(_0x1eb9e8){logger[_0x61d0('0x10')](_0x61d0('0xc'),_0x24028b,_0x1eb9e8);_0x7e059c(_0x1eb9e8);});});} \ No newline at end of file +var _0x82d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x17473a,_0x39c3e2){var _0x185150=function(_0x51828f){while(--_0x51828f){_0x17473a['push'](_0x17473a['shift']());}};_0x185150(++_0x39c3e2);}(_0x82d3,0x13f));var _0x382d=function(_0x18befc,_0x1a514b){_0x18befc=_0x18befc-0x0;var _0x4f8cf7=_0x82d3[_0x18befc];return _0x4f8cf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x382d('0x0'));var BPromise=require(_0x382d('0x1'));var rs=require(_0x382d('0x2'));var fs=require('fs');var Redis=require(_0x382d('0x3'));var db=require(_0x382d('0x4'))['db'];var utils=require(_0x382d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x382d('0x6'));var client=jayson[_0x382d('0x7')][_0x382d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8feccb,_0x79256a,_0x440b2a){return new BPromise(function(_0x373023,_0x1b9227){return client[_0x382d('0x9')](_0x8feccb,_0x440b2a)['then'](function(_0x16fbfa){logger[_0x382d('0xa')](_0x382d('0xb'),_0x79256a,_0x382d('0xc'));logger[_0x382d('0xd')](_0x382d('0xe'),_0x79256a,_0x382d('0xc'),JSON[_0x382d('0xf')](_0x16fbfa));if(_0x16fbfa[_0x382d('0x10')]){if(_0x16fbfa[_0x382d('0x10')][_0x382d('0x11')]===0x1f4){logger['error'](_0x382d('0xb'),_0x79256a,_0x16fbfa[_0x382d('0x10')][_0x382d('0x12')]);return _0x1b9227(_0x16fbfa[_0x382d('0x10')][_0x382d('0x12')]);}logger[_0x382d('0x10')](_0x382d('0xb'),_0x79256a,_0x16fbfa[_0x382d('0x10')][_0x382d('0x12')]);return _0x373023(_0x16fbfa[_0x382d('0x10')][_0x382d('0x12')]);}else{logger[_0x382d('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x79256a,'request\x20sent');_0x373023(_0x16fbfa['result'][_0x382d('0x12')]);}})[_0x382d('0x13')](function(_0x370ef8){logger[_0x382d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x79256a,_0x370ef8);_0x1b9227(_0x370ef8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 4f69de5..d6198e4 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 _0x3068=['isAuthenticated','get','/describe','/:id','show','post','create','put','update','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3068,0x199));var _0x8306=function(_0x2c3008,_0x3a574f){_0x2c3008=_0x2c3008-0x0;var _0x1b35c6=_0x3068[_0x2c3008];return _0x1b35c6;};'use strict';var multer=require('multer');var util=require(_0x8306('0x0'));var path=require(_0x8306('0x1'));var timeout=require(_0x8306('0x2'));var express=require('express');var router=express[_0x8306('0x3')]();var fs_extra=require(_0x8306('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8306('0x5'));var controller=require(_0x8306('0x6'));router['get']('/',auth[_0x8306('0x7')](),controller['index']);router[_0x8306('0x8')](_0x8306('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8306('0x8')](_0x8306('0xa'),auth[_0x8306('0x7')](),controller[_0x8306('0xb')]);router[_0x8306('0xc')]('/',auth[_0x8306('0x7')](),controller[_0x8306('0xd')]);router[_0x8306('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8306('0xf')]);router['delete'](_0x8306('0xa'),auth[_0x8306('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb13d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','delete','destroy'];(function(_0x4afef5,_0x3f590f){var _0x485e30=function(_0x26d51f){while(--_0x26d51f){_0x4afef5['push'](_0x4afef5['shift']());}};_0x485e30(++_0x3f590f);}(_0xb13d,0x1ba));var _0xdb13=function(_0x4c2b5f,_0x36833f){_0x4c2b5f=_0x4c2b5f-0x0;var _0x4e77a0=_0xb13d[_0x4c2b5f];return _0x4e77a0;};'use strict';var multer=require(_0xdb13('0x0'));var util=require(_0xdb13('0x1'));var path=require(_0xdb13('0x2'));var timeout=require(_0xdb13('0x3'));var express=require(_0xdb13('0x4'));var router=express[_0xdb13('0x5')]();var fs_extra=require(_0xdb13('0x6'));var auth=require(_0xdb13('0x7'));var interaction=require(_0xdb13('0x8'));var config=require(_0xdb13('0x9'));var controller=require(_0xdb13('0xa'));router[_0xdb13('0xb')]('/',auth[_0xdb13('0xc')](),controller[_0xdb13('0xd')]);router[_0xdb13('0xb')](_0xdb13('0xe'),auth[_0xdb13('0xc')](),controller[_0xdb13('0xf')]);router['get'](_0xdb13('0x10'),auth[_0xdb13('0xc')](),controller['show']);router['post']('/',auth[_0xdb13('0xc')](),controller[_0xdb13('0x11')]);router['put']('/:id',auth[_0xdb13('0xc')](),controller['update']);router[_0xdb13('0x12')](_0xdb13('0x10'),auth[_0xdb13('0xc')](),controller[_0xdb13('0x13')]);module[_0xdb13('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 030aed1..05dc74b 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 _0x3297=['sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]'];(function(_0x458c2f,_0x588750){var _0x5e6a18=function(_0x3f7e71){while(--_0x3f7e71){_0x458c2f['push'](_0x458c2f['shift']());}};_0x5e6a18(++_0x588750);}(_0x3297,0x80));var _0x7329=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x3297[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x7329('0x0'));var moment=require('moment');module[_0x7329('0x1')]={'channel':{'type':Sequelize[_0x7329('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7329('0x2')],'defaultValue':_0x7329('0x3'),'comment':_0x7329('0x4')},'duration':{'type':Sequelize[_0x7329('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x87c41c){var _0x211c7b=moment(_0x87c41c);var _0x3e3dd1=moment(this[_0x7329('0x6')]('enterAt'));var _0x39a2fe=_0x211c7b[_0x7329('0x7')](_0x3e3dd1,_0x7329('0x8'));this[_0x7329('0x9')](_0x7329('0xa'),_0x87c41c);this[_0x7329('0x9')](_0x7329('0xb'),_0x39a2fe>=0x0?_0x39a2fe:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x7329('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x7329('0xd')},'data3':{'type':Sequelize[_0x7329('0x2')],'comment':_0x7329('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x7329('0x2')],'comment':_0x7329('0xf')},'role':{'type':Sequelize[_0x7329('0x2')]},'internal':{'type':Sequelize[_0x7329('0x5')]},'uniqueid':{'type':Sequelize[_0x7329('0x2')]}}; \ No newline at end of file +var _0x9bda=['enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x5e059a,_0x4b2345){var _0x10a9e4=function(_0x372ba7){while(--_0x372ba7){_0x5e059a['push'](_0x5e059a['shift']());}};_0x10a9e4(++_0x4b2345);}(_0x9bda,0xbe));var _0xa9bd=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0x9bda[_0x257017];return _0x38536d;};'use strict';var Sequelize=require(_0xa9bd('0x0'));var moment=require(_0xa9bd('0x1'));module['exports']={'channel':{'type':Sequelize[_0xa9bd('0x2')]},'membername':{'type':Sequelize[_0xa9bd('0x2')]},'interface':{'type':Sequelize[_0xa9bd('0x2')]},'type':{'type':Sequelize[_0xa9bd('0x2')],'defaultValue':_0xa9bd('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xa9bd('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x46e5cf){var _0x521068=moment(_0x46e5cf);var _0x1fa309=moment(this['getDataValue'](_0xa9bd('0x5')));var _0x39c038=_0x521068[_0xa9bd('0x6')](_0x1fa309,'seconds');this[_0xa9bd('0x7')](_0xa9bd('0x8'),_0x46e5cf);this[_0xa9bd('0x7')](_0xa9bd('0x9'),_0x39c038>=0x0?_0x39c038:null);}},'data1':{'type':Sequelize[_0xa9bd('0x2')],'comment':_0xa9bd('0xa')},'data2':{'type':Sequelize[_0xa9bd('0x2')],'comment':_0xa9bd('0xb')},'data3':{'type':Sequelize[_0xa9bd('0x2')],'comment':_0xa9bd('0xc')},'data4':{'type':Sequelize[_0xa9bd('0x2')],'comment':_0xa9bd('0xd')},'data5':{'type':Sequelize[_0xa9bd('0x2')],'comment':_0xa9bd('0xe')},'role':{'type':Sequelize[_0xa9bd('0x2')]},'internal':{'type':Sequelize[_0xa9bd('0x4')]},'uniqueid':{'type':Sequelize[_0xa9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 07d05f8..5fbe7b4 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 _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x267b97,_0xa9c150){var _0x3b05c1=function(_0x4f6d63){while(--_0x4f6d63){_0x267b97['push'](_0x267b97['shift']());}};_0x3b05c1(++_0xa9c150);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1b9b865..9c61633 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 _0x5acd=['./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x511302,_0x5ca5f3){var _0x480413=function(_0x275616){while(--_0x275616){_0x511302['push'](_0x511302['shift']());}};_0x480413(++_0x5ca5f3);}(_0x5acd,0x149));var _0xd5ac=function(_0xa86e6c,_0x1a11fa){_0xa86e6c=_0xa86e6c-0x0;var _0x276294=_0x5acd[_0xa86e6c];return _0x276294;};'use strict';var _=require(_0xd5ac('0x0'));var util=require('util');var logger=require(_0xd5ac('0x1'))(_0xd5ac('0x2'));var moment=require(_0xd5ac('0x3'));var BPromise=require(_0xd5ac('0x4'));var rp=require(_0xd5ac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5ac('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5ac('0x7'));module['exports']=function(_0x3bc1b2,_0x1517bb){return _0x3bc1b2[_0xd5ac('0x8')](_0xd5ac('0x9'),attributes,{'tableName':_0xd5ac('0xa'),'paranoid':![],'indexes':[{'name':_0xd5ac('0xb'),'fields':[_0xd5ac('0xc'),_0xd5ac('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc809=['./memberReport.attributes','exports','define','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x19f2d7,_0x2f4bf8){var _0x5ef4bb=function(_0x2370af){while(--_0x2370af){_0x19f2d7['push'](_0x19f2d7['shift']());}};_0x5ef4bb(++_0x2f4bf8);}(_0xc809,0x1b8));var _0x9c80=function(_0x5b501b,_0xb343be){_0x5b501b=_0x5b501b-0x0;var _0x389ca0=_0xc809[_0x5b501b];return _0x389ca0;};'use strict';var _=require(_0x9c80('0x0'));var util=require(_0x9c80('0x1'));var logger=require(_0x9c80('0x2'))(_0x9c80('0x3'));var moment=require(_0x9c80('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c80('0x5'));var rimraf=require(_0x9c80('0x6'));var config=require(_0x9c80('0x7'));var attributes=require(_0x9c80('0x8'));module[_0x9c80('0x9')]=function(_0x33cc78,_0xa571b4){return _0x33cc78[_0x9c80('0xa')]('MemberReport',attributes,{'tableName':_0x9c80('0xb'),'paranoid':![],'indexes':[{'name':_0x9c80('0xc'),'fields':['membername',_0x9c80('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index eb242f5..ffe95dd 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 _0x975f=['UpdateMemberReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateMemberReport','create','body','then','update'];(function(_0x31bb1d,_0x8eea6b){var _0x2eb906=function(_0xee1dbf){while(--_0xee1dbf){_0x31bb1d['push'](_0x31bb1d['shift']());}};_0x2eb906(++_0x8eea6b);}(_0x975f,0x191));var _0xf975=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x975f[_0x1f8053];return _0x174fd8;};'use strict';var _=require(_0xf975('0x0'));var util=require('util');var moment=require(_0xf975('0x1'));var BPromise=require(_0xf975('0x2'));var rs=require(_0xf975('0x3'));var fs=require('fs');var Redis=require(_0xf975('0x4'));var db=require(_0xf975('0x5'))['db'];var utils=require(_0xf975('0x6'));var logger=require('../../config/logger')(_0xf975('0x7'));var config=require(_0xf975('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf975('0x9')][_0xf975('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x198617,_0x14ae33,_0xe62d83){return new BPromise(function(_0x197cad,_0x5d5860){return client[_0xf975('0xb')](_0x198617,_0xe62d83)['then'](function(_0x137d54){logger['info'](_0xf975('0xc'),_0x14ae33,_0xf975('0xd'));logger['debug'](_0xf975('0xe'),_0x14ae33,_0xf975('0xd'),JSON[_0xf975('0xf')](_0x137d54));if(_0x137d54['error']){if(_0x137d54['error'][_0xf975('0x10')]===0x1f4){logger[_0xf975('0x11')]('MemberReport,\x20%s,\x20%s',_0x14ae33,_0x137d54['error'][_0xf975('0x12')]);return _0x5d5860(_0x137d54[_0xf975('0x11')][_0xf975('0x12')]);}logger[_0xf975('0x11')](_0xf975('0xc'),_0x14ae33,_0x137d54[_0xf975('0x11')][_0xf975('0x12')]);return _0x197cad(_0x137d54[_0xf975('0x11')]['message']);}else{logger[_0xf975('0x13')](_0xf975('0xc'),_0x14ae33,_0xf975('0xd'));_0x197cad(_0x137d54[_0xf975('0x14')][_0xf975('0x12')]);}})[_0xf975('0x15')](function(_0x3e3f9e){logger[_0xf975('0x11')](_0xf975('0xc'),_0x14ae33,_0x3e3f9e);_0x5d5860(_0x3e3f9e);});});}exports[_0xf975('0x16')]=function(_0x3ef820){var _0xf52469=this;return new Promise(function(_0x1f46d4,_0x4df721){return db[_0xf975('0x17')][_0xf975('0x18')]({'raw':_0x3ef820[_0xf975('0x19')]?_0x3ef820['options'][_0xf975('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ef820['options']?_0x3ef820['options'][_0xf975('0x1b')]||null:null,'attributes':_0x3ef820[_0xf975('0x19')]?_0x3ef820[_0xf975('0x19')][_0xf975('0x1c')]||null:null,'limit':_0x3ef820[_0xf975('0x19')]?_0x3ef820[_0xf975('0x19')][_0xf975('0x1d')]||null:null,'include':_0x3ef820[_0xf975('0x19')]?_0x3ef820[_0xf975('0x19')][_0xf975('0x1e')]?_[_0xf975('0x1f')](_0x3ef820[_0xf975('0x19')][_0xf975('0x1e')],function(_0x10e24c){return{'model':db[_0x10e24c[_0xf975('0x20')]],'as':_0x10e24c['as'],'attributes':_0x10e24c[_0xf975('0x1c')],'include':_0x10e24c['include']?_[_0xf975('0x1f')](_0x10e24c[_0xf975('0x1e')],function(_0x14f6c0){return{'model':db[_0x14f6c0[_0xf975('0x20')]],'as':_0x14f6c0['as'],'attributes':_0x14f6c0[_0xf975('0x1c')],'include':_0x14f6c0[_0xf975('0x1e')]?_[_0xf975('0x1f')](_0x14f6c0[_0xf975('0x1e')],function(_0x2e37fa){return{'model':db[_0x2e37fa[_0xf975('0x20')]],'as':_0x2e37fa['as'],'attributes':_0x2e37fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x565e35){logger[_0xf975('0x13')](_0xf975('0x16'),_0x3ef820);logger[_0xf975('0x21')](_0xf975('0x16'),_0x3ef820,JSON[_0xf975('0xf')](_0x565e35));_0x1f46d4(_0x565e35);})[_0xf975('0x15')](function(_0x4450b6){logger[_0xf975('0x11')](_0xf975('0x16'),_0x4450b6[_0xf975('0x12')],_0x3ef820);_0x4df721(_0xf52469[_0xf975('0x11')](0x1f4,_0x4450b6[_0xf975('0x12')]));});});};exports[_0xf975('0x22')]=function(_0x3bf1c1){var _0x2f724a=this;return new Promise(function(_0x3342a1,_0x36f990){return db[_0xf975('0x17')][_0xf975('0x23')](_0x3bf1c1[_0xf975('0x24')],{'raw':_0x3bf1c1['options']?_0x3bf1c1[_0xf975('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf975('0x25')](function(_0xcdfb7e){logger[_0xf975('0x13')](_0xf975('0x22'),_0x3bf1c1);logger[_0xf975('0x21')]('CreateMemberReport',_0x3bf1c1,JSON[_0xf975('0xf')](_0xcdfb7e));_0x3342a1(_0xcdfb7e);})[_0xf975('0x15')](function(_0x4cc2cf){logger[_0xf975('0x11')](_0xf975('0x22'),_0x4cc2cf[_0xf975('0x12')],_0x3bf1c1);_0x36f990(_0x2f724a['error'](0x1f4,_0x4cc2cf['message']));});});};exports['UpdateMemberReport']=function(_0x5d7a91){var _0x122997=this;return new Promise(function(_0x2f7083,_0x21e3ca){return db[_0xf975('0x17')][_0xf975('0x26')](_0x5d7a91[_0xf975('0x24')],{'raw':_0x5d7a91[_0xf975('0x19')]?_0x5d7a91['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7a91[_0xf975('0x19')]?_0x5d7a91[_0xf975('0x19')][_0xf975('0x1b')]||null:null,'attributes':_0x5d7a91[_0xf975('0x19')]?_0x5d7a91['options'][_0xf975('0x1c')]||null:null,'limit':_0x5d7a91['options']?_0x5d7a91[_0xf975('0x19')]['limit']||null:null})['then'](function(_0x4f043f){logger['info'](_0xf975('0x27'),_0x5d7a91);logger['debug'](_0xf975('0x27'),_0x5d7a91,JSON[_0xf975('0xf')](_0x4f043f));_0x2f7083(_0x4f043f);})[_0xf975('0x15')](function(_0x2ce78b){logger['error'](_0xf975('0x27'),_0x2ce78b[_0xf975('0x12')],_0x5d7a91);_0x21e3ca(_0x122997[_0xf975('0x11')](0x1f4,_0x2ce78b[_0xf975('0x12')]));});});}; \ No newline at end of file +var _0x5a43=['where','limit','include','model','map','attributes','debug','stringify','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x5a43,0xf1));var _0x35a4=function(_0x4b75d3,_0x57a11e){_0x4b75d3=_0x4b75d3-0x0;var _0x3d357f=_0x5a43[_0x4b75d3];return _0x3d357f;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('MemberReport,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetMemberReport',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetMemberReport',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')](_0x1da508[_0x35a4('0x23')],{'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![]})[_0x35a4('0xb')](function(_0x293d05){logger[_0x35a4('0xc')]('CreateMemberReport',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x293d05));_0x160bb5(_0x293d05);})['catch'](function(_0xa62fb5){logger[_0x35a4('0xf')](_0x35a4('0x21'),_0xa62fb5['message'],_0x1da508);_0x2e6d5d(_0x2e1985['error'](0x1f4,_0xa62fb5[_0x35a4('0x11')]));});});};exports['UpdateMemberReport']=function(_0x418725){var _0x206d65=this;return new Promise(function(_0x274237,_0x4ea3b0){return db['MemberReport'][_0x35a4('0x24')](_0x418725[_0x35a4('0x23')],{'raw':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x418725['options']?_0x418725['options'][_0x35a4('0x1e')]||null:null,'limit':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null})[_0x35a4('0xb')](function(_0x5033a1){logger[_0x35a4('0xc')]('UpdateMemberReport',_0x418725);logger[_0x35a4('0x1f')]('UpdateMemberReport',_0x418725,JSON[_0x35a4('0x20')](_0x5033a1));_0x274237(_0x5033a1);})[_0x35a4('0x13')](function(_0x432c1d){logger[_0x35a4('0xf')](_0x35a4('0x25'),_0x432c1d[_0x35a4('0x11')],_0x418725);_0x4ea3b0(_0x206d65['error'](0x1f4,_0x432c1d[_0x35a4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index df6f112..b451bcd 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 _0xb475=['get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x225986,_0x543383){var _0x45261e=function(_0x56eccc){while(--_0x56eccc){_0x225986['push'](_0x225986['shift']());}};_0x45261e(++_0x543383);}(_0xb475,0xc7));var _0x5b47=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xb475[_0xcfd89f];return _0x59acd4;};'use strict';var multer=require(_0x5b47('0x0'));var util=require(_0x5b47('0x1'));var path=require(_0x5b47('0x2'));var timeout=require(_0x5b47('0x3'));var express=require(_0x5b47('0x4'));var router=express[_0x5b47('0x5')]();var fs_extra=require(_0x5b47('0x6'));var auth=require(_0x5b47('0x7'));var interaction=require(_0x5b47('0x8'));var config=require(_0x5b47('0x9'));var controller=require(_0x5b47('0xa'));router[_0x5b47('0xb')]('/',controller[_0x5b47('0xc')]);module[_0x5b47('0xd')]=router; \ No newline at end of file +var _0xa8b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','index','exports','multer','path'];(function(_0x4505da,_0x328eea){var _0x191417=function(_0x2bd9c6){while(--_0x2bd9c6){_0x4505da['push'](_0x4505da['shift']());}};_0x191417(++_0x328eea);}(_0xa8b1,0xae));var _0x1a8b=function(_0x4475ad,_0x513efe){_0x4475ad=_0x4475ad-0x0;var _0xa323c=_0xa8b1[_0x4475ad];return _0xa323c;};'use strict';var multer=require(_0x1a8b('0x0'));var util=require('util');var path=require(_0x1a8b('0x1'));var timeout=require(_0x1a8b('0x2'));var express=require(_0x1a8b('0x3'));var router=express[_0x1a8b('0x4')]();var fs_extra=require(_0x1a8b('0x5'));var auth=require(_0x1a8b('0x6'));var interaction=require(_0x1a8b('0x7'));var config=require('../../config/environment');var controller=require(_0x1a8b('0x8'));router['get']('/',controller[_0x1a8b('0x9')]);module[_0x1a8b('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2d6f34f..e3734dc 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 _0x74f6=['version','sequelize','exports','STRING'];(function(_0x353086,_0x22605d){var _0x3984b4=function(_0x2ed469){while(--_0x2ed469){_0x353086['push'](_0x353086['shift']());}};_0x3984b4(++_0x22605d);}(_0x74f6,0xcd));var _0x674f=function(_0xf744cf,_0x2c3a21){_0xf744cf=_0xf744cf-0x0;var _0x5da7fb=_0x74f6[_0xf744cf];return _0x5da7fb;};'use strict';var Sequelize=require(_0x674f('0x0'));module[_0x674f('0x1')]={'version':{'type':Sequelize[_0x674f('0x2')],'unique':_0x674f('0x3')}}; \ No newline at end of file +var _0xc441=['exports','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc441,0x19f));var _0x1c44=function(_0x15019c,_0x1ef006){_0x15019c=_0x15019c-0x0;var _0x1cac8b=_0xc441[_0x15019c];return _0x1cac8b;};'use strict';var Sequelize=require(_0x1c44('0x0'));module[_0x1c44('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7e1e0ad..80eb415 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 _0x8202=['where','pick','merge','VIRTUAL','filter','Migration','include','findAll','rows','catch','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x2ee3b0,_0x5c5999){var _0x6e15c6=function(_0x6412ce){while(--_0x6412ce){_0x2ee3b0['push'](_0x2ee3b0['shift']());}};_0x6e15c6(++_0x5c5999);}(_0x8202,0x1ba));var _0x2820=function(_0x31a75f,_0x156f80){_0x31a75f=_0x31a75f-0x0;var _0x4e5f56=_0x8202[_0x31a75f];return _0x4e5f56;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2820('0x0'));var rp=require(_0x2820('0x1'));var moment=require(_0x2820('0x2'));var BPromise=require(_0x2820('0x3'));var Mustache=require(_0x2820('0x4'));var util=require(_0x2820('0x5'));var path=require(_0x2820('0x6'));var sox=require(_0x2820('0x7'));var csv=require(_0x2820('0x8'));var ejs=require(_0x2820('0x9'));var fs=require('fs');var fs_extra=require(_0x2820('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2820('0xb'));var jsforce=require(_0x2820('0xc'));var deskjs=require(_0x2820('0xd'));var toCsv=require(_0x2820('0x8'));var querystring=require(_0x2820('0xe'));var Papa=require(_0x2820('0xf'));var Redis=require(_0x2820('0x10'));var authService=require(_0x2820('0x11'));var qs=require(_0x2820('0x12'));var as=require(_0x2820('0x13'));var hardwareService=require(_0x2820('0x14'));var logger=require(_0x2820('0x15'))(_0x2820('0x16'));var utils=require(_0x2820('0x17'));var config=require(_0x2820('0x18'));var licenseUtil=require(_0x2820('0x19'));var db=require(_0x2820('0x1a'))['db'];function respondWithStatusCode(_0x5b12a0,_0x9f9dde){_0x9f9dde=_0x9f9dde||0xcc;return function(_0x541d78){if(_0x541d78){return _0x5b12a0[_0x2820('0x1b')](_0x9f9dde);}return _0x5b12a0[_0x2820('0x1c')](_0x9f9dde)['end']();};}function respondWithResult(_0x5b0253,_0x19fa9e){_0x19fa9e=_0x19fa9e||0xc8;return function(_0x5cdfa4){if(_0x5cdfa4){return _0x5b0253[_0x2820('0x1c')](_0x19fa9e)[_0x2820('0x1d')](_0x5cdfa4);}};}function respondWithFilteredResult(_0x5de8b9,_0x481086){return function(_0x64f0d7){if(_0x64f0d7){var _0x112100=typeof _0x481086[_0x2820('0x1e')]===_0x2820('0x1f')&&typeof _0x481086['limit']===_0x2820('0x1f');var _0x3d73fb=_0x64f0d7[_0x2820('0x20')];var _0x210c6e=_0x112100?0x0:_0x481086[_0x2820('0x1e')];var _0x27e29c=_0x112100?_0x64f0d7[_0x2820('0x20')]:_0x481086['offset']+_0x481086['limit'];var _0x57973f;if(_0x27e29c>=_0x3d73fb){_0x27e29c=_0x3d73fb;_0x57973f=0xc8;}else{_0x57973f=0xce;}_0x5de8b9[_0x2820('0x1c')](_0x57973f);return _0x5de8b9[_0x2820('0x21')]('Content-Range',_0x210c6e+'-'+_0x27e29c+'/'+_0x3d73fb)[_0x2820('0x1d')](_0x64f0d7);}return null;};}function patchUpdates(_0xa5ec71){return function(_0x3b43ed){try{jsonpatch[_0x2820('0x22')](_0x3b43ed,_0xa5ec71,!![]);}catch(_0x4ffffa){return BPromise[_0x2820('0x23')](_0x4ffffa);}return _0x3b43ed[_0x2820('0x24')]();};}function saveUpdates(_0x5ad0f4,_0x48e2a5){return function(_0x2f992a){if(_0x2f992a){return _0x2f992a[_0x2820('0x25')](_0x5ad0f4)[_0x2820('0x26')](function(_0x46a670){return _0x46a670;});}return null;};}function removeEntity(_0x4672db,_0x19488e){return function(_0x444a74){if(_0x444a74){return _0x444a74[_0x2820('0x27')]()[_0x2820('0x26')](function(){_0x4672db[_0x2820('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a15fc,_0x1873ba){return function(_0x5ae2d3){if(!_0x5ae2d3){_0x3a15fc[_0x2820('0x1b')](0x194);}return _0x5ae2d3;};}function handleError(_0x4f43e7,_0x8ff027){_0x8ff027=_0x8ff027||0x1f4;return function(_0x6d4ef2){logger[_0x2820('0x28')](_0x6d4ef2[_0x2820('0x29')]);if(_0x6d4ef2[_0x2820('0x2a')]){delete _0x6d4ef2[_0x2820('0x2a')];}_0x4f43e7[_0x2820('0x1c')](_0x8ff027)[_0x2820('0x2b')](_0x6d4ef2);};}exports[_0x2820('0x2c')]=function(_0x1f21df,_0xadc463){var _0x2daa19={},_0x4b0fae={},_0x25e65a={'count':0x0,'rows':[]};var _0x11ff08=_[_0x2820('0x2d')](db['Migration']['rawAttributes'],function(_0x4dd0b5){return{'name':_0x4dd0b5[_0x2820('0x2e')],'type':_0x4dd0b5[_0x2820('0x2f')][_0x2820('0x30')]};});_0x4b0fae[_0x2820('0x31')]=_[_0x2820('0x2d')](_0x11ff08,_0x2820('0x2a'));_0x4b0fae[_0x2820('0x32')]=_[_0x2820('0x33')](_0x1f21df[_0x2820('0x32')]);_0x4b0fae[_0x2820('0x34')]=_[_0x2820('0x35')](_0x4b0fae[_0x2820('0x31')],_0x4b0fae[_0x2820('0x32')]);_0x2daa19[_0x2820('0x36')]=_[_0x2820('0x35')](_0x4b0fae['model'],qs[_0x2820('0x37')](_0x1f21df[_0x2820('0x32')][_0x2820('0x37')]));_0x2daa19[_0x2820('0x36')]=_0x2daa19[_0x2820('0x36')][_0x2820('0x38')]?_0x2daa19['attributes']:_0x4b0fae[_0x2820('0x31')];if(!_0x1f21df[_0x2820('0x32')][_0x2820('0x39')](_0x2820('0x3a'))){_0x2daa19[_0x2820('0x3b')]=qs[_0x2820('0x3b')](_0x1f21df[_0x2820('0x32')]['limit']);_0x2daa19[_0x2820('0x1e')]=qs[_0x2820('0x1e')](_0x1f21df[_0x2820('0x32')][_0x2820('0x1e')]);}_0x2daa19[_0x2820('0x3c')]=qs['sort'](_0x1f21df[_0x2820('0x32')][_0x2820('0x3d')]);_0x2daa19[_0x2820('0x3e')]=qs[_0x2820('0x34')](_[_0x2820('0x3f')](_0x1f21df[_0x2820('0x32')],_0x4b0fae[_0x2820('0x34')]),_0x11ff08);if(_0x1f21df[_0x2820('0x32')]['filter']){_0x2daa19[_0x2820('0x3e')]=_[_0x2820('0x40')](_0x2daa19[_0x2820('0x3e')],{'$or':_[_0x2820('0x2d')](_0x11ff08,function(_0x38ded0){if(_0x38ded0['type']!==_0x2820('0x41')){var _0x3806aa={};_0x3806aa[_0x38ded0[_0x2820('0x2a')]]={'$like':'%'+_0x1f21df['query'][_0x2820('0x42')]+'%'};return _0x3806aa;}})});}_0x2daa19=_[_0x2820('0x40')]({},_0x2daa19,_0x1f21df['options']);var _0xd5dd88={'where':_0x2daa19[_0x2820('0x3e')]};return db[_0x2820('0x43')][_0x2820('0x20')](_0xd5dd88)['then'](function(_0x5d4e0e){_0x25e65a[_0x2820('0x20')]=_0x5d4e0e;if(_0x1f21df[_0x2820('0x32')]['includeAll']){_0x2daa19[_0x2820('0x44')]=[{'all':!![]}];}return db[_0x2820('0x43')][_0x2820('0x45')](_0x2daa19);})['then'](function(_0x2b4b67){_0x25e65a[_0x2820('0x46')]=_0x2b4b67;return _0x25e65a;})[_0x2820('0x26')](respondWithFilteredResult(_0xadc463,_0x2daa19))[_0x2820('0x47')](handleError(_0xadc463,null));}; \ No newline at end of file +var _0x4c7d=['fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','error','name','send','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','count','include','findAll','catch','rimraf','zip-dir'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x4c7d,0x1ce));var _0xd4c7=function(_0x3d5696,_0x5c02d5){_0x3d5696=_0x3d5696-0x0;var _0x98decd=_0x4c7d[_0x3d5696];return _0x98decd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4c7('0x0'));var zipdir=require(_0xd4c7('0x1'));var jsonpatch=require(_0xd4c7('0x2'));var rp=require('request-promise');var moment=require(_0xd4c7('0x3'));var BPromise=require(_0xd4c7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd4c7('0x5'));var csv=require(_0xd4c7('0x6'));var ejs=require(_0xd4c7('0x7'));var fs=require('fs');var fs_extra=require(_0xd4c7('0x8'));var _=require(_0xd4c7('0x9'));var squel=require(_0xd4c7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4c7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4c7('0xb'));var authService=require(_0xd4c7('0xc'));var qs=require(_0xd4c7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4c7('0xe'));var logger=require('../../config/logger')(_0xd4c7('0xf'));var utils=require(_0xd4c7('0x10'));var config=require(_0xd4c7('0x11'));var licenseUtil=require(_0xd4c7('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186874,_0x5b93ec){_0x5b93ec=_0x5b93ec||0xcc;return function(_0xe26837){if(_0xe26837){return _0x186874[_0xd4c7('0x13')](_0x5b93ec);}return _0x186874['status'](_0x5b93ec)['end']();};}function respondWithResult(_0x303672,_0x47a245){_0x47a245=_0x47a245||0xc8;return function(_0x2b24b0){if(_0x2b24b0){return _0x303672[_0xd4c7('0x14')](_0x47a245)[_0xd4c7('0x15')](_0x2b24b0);}};}function respondWithFilteredResult(_0x34dca7,_0x5112a0){return function(_0x5eaafc){if(_0x5eaafc){var _0x25ea21=typeof _0x5112a0[_0xd4c7('0x16')]==='undefined'&&typeof _0x5112a0[_0xd4c7('0x17')]===_0xd4c7('0x18');var _0x375ff5=_0x5eaafc['count'];var _0x45fbec=_0x25ea21?0x0:_0x5112a0[_0xd4c7('0x16')];var _0x3fafee=_0x25ea21?_0x5eaafc['count']:_0x5112a0[_0xd4c7('0x16')]+_0x5112a0[_0xd4c7('0x17')];var _0x267c31;if(_0x3fafee>=_0x375ff5){_0x3fafee=_0x375ff5;_0x267c31=0xc8;}else{_0x267c31=0xce;}_0x34dca7[_0xd4c7('0x14')](_0x267c31);return _0x34dca7[_0xd4c7('0x19')](_0xd4c7('0x1a'),_0x45fbec+'-'+_0x3fafee+'/'+_0x375ff5)[_0xd4c7('0x15')](_0x5eaafc);}return null;};}function patchUpdates(_0x2154c1){return function(_0xeb5728){try{jsonpatch[_0xd4c7('0x1b')](_0xeb5728,_0x2154c1,!![]);}catch(_0x24d29f){return BPromise[_0xd4c7('0x1c')](_0x24d29f);}return _0xeb5728[_0xd4c7('0x1d')]();};}function saveUpdates(_0x128878,_0x5a8c27){return function(_0xeeee0e){if(_0xeeee0e){return _0xeeee0e['update'](_0x128878)[_0xd4c7('0x1e')](function(_0x440245){return _0x440245;});}return null;};}function removeEntity(_0x36d5a1,_0xfe5b4d){return function(_0x5f0f45){if(_0x5f0f45){return _0x5f0f45['destroy']()[_0xd4c7('0x1e')](function(){_0x36d5a1[_0xd4c7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40ba94,_0x52a766){return function(_0x14cfbd){if(!_0x14cfbd){_0x40ba94[_0xd4c7('0x13')](0x194);}return _0x14cfbd;};}function handleError(_0x21ce29,_0x1143c7){_0x1143c7=_0x1143c7||0x1f4;return function(_0x1079b8){logger[_0xd4c7('0x1f')](_0x1079b8['stack']);if(_0x1079b8['name']){delete _0x1079b8[_0xd4c7('0x20')];}_0x21ce29['status'](_0x1143c7)[_0xd4c7('0x21')](_0x1079b8);};}exports['index']=function(_0x4732dd,_0x44b72e){var _0x10ea03={},_0x39333b={},_0x45ce85={'count':0x0,'rows':[]};var _0x4dde41=_[_0xd4c7('0x22')](db[_0xd4c7('0x23')][_0xd4c7('0x24')],function(_0x176b63){return{'name':_0x176b63[_0xd4c7('0x25')],'type':_0x176b63[_0xd4c7('0x26')]['key']};});_0x39333b[_0xd4c7('0x27')]=_['map'](_0x4dde41,_0xd4c7('0x20'));_0x39333b[_0xd4c7('0x28')]=_[_0xd4c7('0x29')](_0x4732dd[_0xd4c7('0x28')]);_0x39333b[_0xd4c7('0x2a')]=_[_0xd4c7('0x2b')](_0x39333b[_0xd4c7('0x27')],_0x39333b[_0xd4c7('0x28')]);_0x10ea03[_0xd4c7('0x2c')]=_[_0xd4c7('0x2b')](_0x39333b['model'],qs[_0xd4c7('0x2d')](_0x4732dd[_0xd4c7('0x28')]['fields']));_0x10ea03['attributes']=_0x10ea03[_0xd4c7('0x2c')][_0xd4c7('0x2e')]?_0x10ea03[_0xd4c7('0x2c')]:_0x39333b[_0xd4c7('0x27')];if(!_0x4732dd[_0xd4c7('0x28')]['hasOwnProperty']('nolimit')){_0x10ea03[_0xd4c7('0x17')]=qs[_0xd4c7('0x17')](_0x4732dd[_0xd4c7('0x28')]['limit']);_0x10ea03[_0xd4c7('0x16')]=qs[_0xd4c7('0x16')](_0x4732dd[_0xd4c7('0x28')]['offset']);}_0x10ea03[_0xd4c7('0x2f')]=qs[_0xd4c7('0x30')](_0x4732dd['query'][_0xd4c7('0x30')]);_0x10ea03[_0xd4c7('0x31')]=qs[_0xd4c7('0x2a')](_[_0xd4c7('0x32')](_0x4732dd['query'],_0x39333b[_0xd4c7('0x2a')]),_0x4dde41);if(_0x4732dd[_0xd4c7('0x28')][_0xd4c7('0x33')]){_0x10ea03[_0xd4c7('0x31')]=_['merge'](_0x10ea03[_0xd4c7('0x31')],{'$or':_[_0xd4c7('0x22')](_0x4dde41,function(_0x1ce264){if(_0x1ce264[_0xd4c7('0x26')]!==_0xd4c7('0x34')){var _0x4ec754={};_0x4ec754[_0x1ce264[_0xd4c7('0x20')]]={'$like':'%'+_0x4732dd[_0xd4c7('0x28')][_0xd4c7('0x33')]+'%'};return _0x4ec754;}})});}_0x10ea03=_[_0xd4c7('0x35')]({},_0x10ea03,_0x4732dd['options']);var _0x4bee6d={'where':_0x10ea03['where']};return db[_0xd4c7('0x23')][_0xd4c7('0x36')](_0x4bee6d)['then'](function(_0x1ad4c0){_0x45ce85[_0xd4c7('0x36')]=_0x1ad4c0;if(_0x4732dd[_0xd4c7('0x28')]['includeAll']){_0x10ea03[_0xd4c7('0x37')]=[{'all':!![]}];}return db[_0xd4c7('0x23')][_0xd4c7('0x38')](_0x10ea03);})['then'](function(_0x559e30){_0x45ce85['rows']=_0x559e30;return _0x45ce85;})[_0xd4c7('0x1e')](respondWithFilteredResult(_0x44b72e,_0x10ea03))[_0xd4c7('0x39')](handleError(_0x44b72e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 83c1db1..55a5ecb 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 _0x8c9e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util'];(function(_0x41a7da,_0xe4c8ed){var _0x313230=function(_0x5a9299){while(--_0x5a9299){_0x41a7da['push'](_0x41a7da['shift']());}};_0x313230(++_0xe4c8ed);}(_0x8c9e,0x8a));var _0xe8c9=function(_0x484c5c,_0x5d67b2){_0x484c5c=_0x484c5c-0x0;var _0x1b8928=_0x8c9e[_0x484c5c];return _0x1b8928;};'use strict';var _=require(_0xe8c9('0x0'));var util=require(_0xe8c9('0x1'));var logger=require(_0xe8c9('0x2'))(_0xe8c9('0x3'));var moment=require(_0xe8c9('0x4'));var BPromise=require(_0xe8c9('0x5'));var rp=require(_0xe8c9('0x6'));var fs=require('fs');var path=require(_0xe8c9('0x7'));var rimraf=require(_0xe8c9('0x8'));var config=require(_0xe8c9('0x9'));var attributes=require('./migration.attributes');module[_0xe8c9('0xa')]=function(_0x763af8,_0x34c63f){return _0x763af8[_0xe8c9('0xb')](_0xe8c9('0xc'),attributes,{'tableName':_0xe8c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb22=['exports','define','lodash','util','api','moment','rimraf','../../config/environment','./migration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb22,0x6e));var _0x2cb2=function(_0x1fac1b,_0x5aa87f){_0x1fac1b=_0x1fac1b-0x0;var _0x5ca6c3=_0xcb22[_0x1fac1b];return _0x5ca6c3;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var logger=require('../../config/logger')(_0x2cb2('0x2'));var moment=require(_0x2cb2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2cb2('0x4'));var config=require(_0x2cb2('0x5'));var attributes=require(_0x2cb2('0x6'));module[_0x2cb2('0x7')]=function(_0x2589ac,_0x370de9){return _0x2589ac[_0x2cb2('0x8')]('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 848acb9..4242e90 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 _0x05b0=['client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05b0,0x188));var _0x005b=function(_0x50842b,_0x452c64){_0x50842b=_0x50842b-0x0;var _0x4cce0a=_0x05b0[_0x50842b];return _0x4cce0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x98e71c,_0x224c8d,_0x35998d){return new BPromise(function(_0x263bc9,_0x5cff7f){return client[_0x005b('0x9')](_0x98e71c,_0x35998d)[_0x005b('0xa')](function(_0x4c5552){logger['info'](_0x005b('0xb'),_0x224c8d,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x224c8d,_0x005b('0xc'),JSON[_0x005b('0xd')](_0x4c5552));if(_0x4c5552['error']){if(_0x4c5552[_0x005b('0xe')][_0x005b('0xf')]===0x1f4){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0x4c5552[_0x005b('0xe')][_0x005b('0x10')]);return _0x5cff7f(_0x4c5552[_0x005b('0xe')]['message']);}logger['error']('Migration,\x20%s,\x20%s',_0x224c8d,_0x4c5552[_0x005b('0xe')]['message']);return _0x263bc9(_0x4c5552[_0x005b('0xe')]['message']);}else{logger[_0x005b('0x11')](_0x005b('0xb'),_0x224c8d,_0x005b('0xc'));_0x263bc9(_0x4c5552[_0x005b('0x12')][_0x005b('0x10')]);}})['catch'](function(_0xa3c3fb){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0xa3c3fb);_0x5cff7f(_0xa3c3fb);});});} \ No newline at end of file +var _0x7cda=['rpc','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3fc818,_0x3ffffb){var _0x3b4e66=function(_0xf9f628){while(--_0xf9f628){_0x3fc818['push'](_0x3fc818['shift']());}};_0x3b4e66(++_0x3ffffb);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa7cd('0x0'));var moment=require(_0xa7cd('0x1'));var BPromise=require(_0xa7cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7cd('0x3'));var db=require(_0xa7cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7cd('0x5'))(_0xa7cd('0x6'));var config=require(_0xa7cd('0x7'));var jayson=require(_0xa7cd('0x8'));var client=jayson['client'][_0xa7cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c2b39,_0x596ad6,_0x6525a){return new BPromise(function(_0x4a9e39,_0x2554e8){return client[_0xa7cd('0xa')](_0x5c2b39,_0x6525a)[_0xa7cd('0xb')](function(_0x6d21d3){logger[_0xa7cd('0xc')](_0xa7cd('0xd'),_0x596ad6,_0xa7cd('0xe'));logger[_0xa7cd('0xf')](_0xa7cd('0x10'),_0x596ad6,'request\x20sent',JSON['stringify'](_0x6d21d3));if(_0x6d21d3[_0xa7cd('0x11')]){if(_0x6d21d3[_0xa7cd('0x11')]['code']===0x1f4){logger[_0xa7cd('0x11')](_0xa7cd('0xd'),_0x596ad6,_0x6d21d3['error'][_0xa7cd('0x12')]);return _0x2554e8(_0x6d21d3[_0xa7cd('0x11')][_0xa7cd('0x12')]);}logger['error'](_0xa7cd('0xd'),_0x596ad6,_0x6d21d3[_0xa7cd('0x11')][_0xa7cd('0x12')]);return _0x4a9e39(_0x6d21d3[_0xa7cd('0x11')][_0xa7cd('0x12')]);}else{logger[_0xa7cd('0xc')]('Migration,\x20%s,\x20%s',_0x596ad6,'request\x20sent');_0x4a9e39(_0x6d21d3[_0xa7cd('0x13')][_0xa7cd('0x12')]);}})[_0xa7cd('0x14')](function(_0x5dd129){logger[_0xa7cd('0x11')](_0xa7cd('0xd'),_0x596ad6,_0x5dd129);_0x2554e8(_0x5dd129);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e6a271c..02ebcd2 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0xba34,0x119));var _0x4ba3=function(_0x44676a,_0x250f50){_0x44676a=_0x44676a-0x0;var _0x39ec7a=_0xba34[_0x44676a];return _0x39ec7a;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xf'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router[_0x4ba3('0x11')](_0x4ba3('0xf'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x0b36=['destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0xc092a6,_0xfdb8a6){var _0x1db0c6=function(_0x3117ed){while(--_0x3117ed){_0xc092a6['push'](_0xc092a6['shift']());}};_0x1db0c6(++_0xfdb8a6);}(_0x0b36,0x10c));var _0x60b3=function(_0x237a99,_0x3e4ff9){_0x237a99=_0x237a99-0x0;var _0x2ae3ca=_0x0b36[_0x237a99];return _0x2ae3ca;};'use strict';var multer=require(_0x60b3('0x0'));var util=require(_0x60b3('0x1'));var path=require(_0x60b3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x60b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x60b3('0x4'));var config=require(_0x60b3('0x5'));var controller=require(_0x60b3('0x6'));router[_0x60b3('0x7')]('/',auth[_0x60b3('0x8')](),controller[_0x60b3('0x9')]);router['get']('/:id',auth[_0x60b3('0x8')](),controller[_0x60b3('0xa')]);router[_0x60b3('0xb')]('/',auth[_0x60b3('0x8')](),controller[_0x60b3('0xc')]);router[_0x60b3('0xd')](_0x60b3('0xe'),auth['isAuthenticated'](),controller[_0x60b3('0xf')]);router[_0x60b3('0x10')]('/:id',auth[_0x60b3('0x8')](),controller[_0x60b3('0x11')]);module[_0x60b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 061497e..a63f455 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 _0xb255=['sequelize','exports','localnet','externip','turn','STRING'];(function(_0x135b97,_0x9fa195){var _0x503581=function(_0x503155){while(--_0x503155){_0x135b97['push'](_0x135b97['shift']());}};_0x503581(++_0x9fa195);}(_0xb255,0x9c));var _0x5b25=function(_0x5cf1d6,_0x4a4fb6){_0x5cf1d6=_0x5cf1d6-0x0;var _0x408043=_0xb255[_0x5cf1d6];return _0x408043;};'use strict';var Sequelize=require(_0x5b25('0x0'));module[_0x5b25('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5b25('0x2'),_0x5b25('0x3'),'stun',_0x5b25('0x4'))},'value':{'type':Sequelize[_0x5b25('0x5')]},'username':{'type':Sequelize[_0x5b25('0x5')]},'password':{'type':Sequelize[_0x5b25('0x5')]}}; \ No newline at end of file +var _0x8da9=['ENUM','externip','stun','turn','STRING','sequelize','exports'];(function(_0x18e34c,_0x1f87c5){var _0x5ad33e=function(_0x1d10e5){while(--_0x1d10e5){_0x18e34c['push'](_0x18e34c['shift']());}};_0x5ad33e(++_0x1f87c5);}(_0x8da9,0x186));var _0x98da=function(_0x2eb779,_0x1193ab){_0x2eb779=_0x2eb779-0x0;var _0x1fa827=_0x8da9[_0x2eb779];return _0x1fa827;};'use strict';var Sequelize=require(_0x98da('0x0'));module[_0x98da('0x1')]={'type':{'type':Sequelize[_0x98da('0x2')]('localnet',_0x98da('0x3'),_0x98da('0x4'),_0x98da('0x5'))},'value':{'type':Sequelize[_0x98da('0x6')]},'username':{'type':Sequelize[_0x98da('0x6')]},'password':{'type':Sequelize[_0x98da('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 40a25be..b3f2708 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 _0x6c2b=['stack','name','send','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','/etc/asterisk/turn_xcally.conf','root','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','destroy','server/files/templates/network.ejs','format','path','lodash','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','status','json','offset','undefined','limit','count','Content-Range','update','end','sendStatus'];(function(_0x496e59,_0x462efe){var _0x5704b8=function(_0x3ba5a1){while(--_0x3ba5a1){_0x496e59['push'](_0x496e59['shift']());}};_0x5704b8(++_0x462efe);}(_0x6c2b,0x17b));var _0xb6c2=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x6c2b[_0x57fa7e];return _0x320671;};'use strict';var util=require('util');var path=require(_0xb6c2('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb6c2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xb6c2('0x2'))('api');var config=require(_0xb6c2('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb6c2('0x4'));var client=jayson[_0xb6c2('0x5')][_0xb6c2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x397569,_0x23a20b,_0x4285bc,_0x3e7f93){return new Promise(function(_0xd87d5e,_0x5e95db){var _0x39989b=_0x3e7f93||client;return _0x39989b['request'](_0x397569,_0x4285bc)[_0xb6c2('0x7')](function(_0x4e1f39){logger[_0xb6c2('0x8')](_0xb6c2('0x9'),_0x23a20b,_0xb6c2('0xa'));logger[_0xb6c2('0xb')](_0xb6c2('0xc'),_0x23a20b,'request\x20sent',JSON[_0xb6c2('0xd')](_0x4e1f39));if(_0x4e1f39[_0xb6c2('0xe')]){if(_0x4e1f39[_0xb6c2('0xe')]['code']===0x1f4){logger[_0xb6c2('0xe')](_0xb6c2('0x9'),_0x23a20b,_0x4e1f39[_0xb6c2('0xe')]['message']);return _0x5e95db(_0x4e1f39['error'][_0xb6c2('0xf')]);}logger[_0xb6c2('0xe')]('Network,\x20%s,\x20%s',_0x23a20b,_0x4e1f39[_0xb6c2('0xe')]['message']);return _0xd87d5e(_0x4e1f39[_0xb6c2('0xe')]['message']);}else{logger[_0xb6c2('0x8')](_0xb6c2('0x9'),_0x23a20b,_0xb6c2('0xa'));_0xd87d5e(_0x4e1f39['result'][_0xb6c2('0xf')]);}})['catch'](function(_0x33b6a2){logger[_0xb6c2('0xe')](_0xb6c2('0x9'),_0x23a20b,_0x33b6a2);_0x5e95db(_0x33b6a2);});});}function respondWithResult(_0x3c3fa1,_0xbc5d14){_0xbc5d14=_0xbc5d14||0xc8;return function(_0x5bbe09){if(_0x5bbe09){return _0x3c3fa1[_0xb6c2('0x10')](_0xbc5d14)[_0xb6c2('0x11')](_0x5bbe09);}};}function respondWithFilteredResult(_0xb481ef,_0x500301){return function(_0x510764){if(_0x510764){var _0x1592d7=typeof _0x500301[_0xb6c2('0x12')]===_0xb6c2('0x13')&&typeof _0x500301[_0xb6c2('0x14')]===_0xb6c2('0x13');var _0x3e77ef=_0x510764[_0xb6c2('0x15')];var _0x7da100=_0x1592d7?0x0:_0x500301[_0xb6c2('0x12')];var _0x2b393a=_0x1592d7?_0x510764[_0xb6c2('0x15')]:_0x500301[_0xb6c2('0x12')]+_0x500301['limit'];var _0x6a1017;if(_0x2b393a>=_0x3e77ef){_0x2b393a=_0x3e77ef;_0x6a1017=0xc8;}else{_0x6a1017=0xce;}_0xb481ef['status'](_0x6a1017);return _0xb481ef['set'](_0xb6c2('0x16'),_0x7da100+'-'+_0x2b393a+'/'+_0x3e77ef)[_0xb6c2('0x11')](_0x510764);}return null;};}function saveUpdates(_0x4d3d33){return function(_0x8b54ea){if(_0x8b54ea){return _0x8b54ea[_0xb6c2('0x17')](_0x4d3d33)[_0xb6c2('0x7')](function(_0x37abc1){return _0x37abc1;});}return null;};}function removeEntity(_0x8876d0){return function(_0x312aab){if(_0x312aab){return _0x312aab['destroy']()['then'](function(){_0x8876d0['status'](0xcc)[_0xb6c2('0x18')]();});}};}function handleEntityNotFound(_0x3ca5eb){return function(_0x4f27ec){if(!_0x4f27ec){_0x3ca5eb[_0xb6c2('0x19')](0x194);}return _0x4f27ec;};}function handleError(_0x5bc709,_0x565961){_0x565961=_0x565961||0x1f4;return function(_0x43e94d){logger['error'](_0x43e94d[_0xb6c2('0x1a')]);if(_0x43e94d[_0xb6c2('0x1b')]){delete _0x43e94d[_0xb6c2('0x1b')];}_0x5bc709[_0xb6c2('0x10')](_0x565961)[_0xb6c2('0x1c')](_0x43e94d);};}exports['index']=function(_0x522190,_0x4c443d){var _0x29929d={},_0x1b85a1={},_0x36c81f={'count':0x0,'rows':[]};var _0x7cb774=_[_0xb6c2('0x1d')](db[_0xb6c2('0x1e')][_0xb6c2('0x1f')],function(_0x3b94ba){return{'name':_0x3b94ba[_0xb6c2('0x20')],'type':_0x3b94ba[_0xb6c2('0x21')]['key']};});_0x1b85a1[_0xb6c2('0x22')]=_[_0xb6c2('0x1d')](_0x7cb774,_0xb6c2('0x1b'));_0x1b85a1[_0xb6c2('0x23')]=_[_0xb6c2('0x24')](_0x522190[_0xb6c2('0x23')]);_0x1b85a1[_0xb6c2('0x25')]=_[_0xb6c2('0x26')](_0x1b85a1['model'],_0x1b85a1[_0xb6c2('0x23')]);_0x29929d[_0xb6c2('0x27')]=_['intersection'](_0x1b85a1['model'],qs[_0xb6c2('0x28')](_0x522190[_0xb6c2('0x23')]['fields']));_0x29929d[_0xb6c2('0x27')]=_0x29929d['attributes'][_0xb6c2('0x29')]?_0x29929d[_0xb6c2('0x27')]:_0x1b85a1['model'];if(!_0x522190['query'][_0xb6c2('0x2a')](_0xb6c2('0x2b'))){_0x29929d[_0xb6c2('0x14')]=qs[_0xb6c2('0x14')](_0x522190['query']['limit']);_0x29929d[_0xb6c2('0x12')]=qs[_0xb6c2('0x12')](_0x522190['query'][_0xb6c2('0x12')]);}_0x29929d[_0xb6c2('0x2c')]=qs[_0xb6c2('0x2d')](_0x522190['query'][_0xb6c2('0x2d')]);_0x29929d['where']=qs[_0xb6c2('0x25')](_['pick'](_0x522190['query'],_0x1b85a1[_0xb6c2('0x25')]),_0x7cb774);if(_0x522190[_0xb6c2('0x23')]['filter']){_0x29929d[_0xb6c2('0x2e')]=_[_0xb6c2('0x2f')](_0x29929d['where'],{'$or':_['map'](_0x7cb774,function(_0x577772){if(_0x577772[_0xb6c2('0x21')]!==_0xb6c2('0x30')){var _0x2052be={};_0x2052be[_0x577772[_0xb6c2('0x1b')]]={'$like':'%'+_0x522190['query'][_0xb6c2('0x31')]+'%'};return _0x2052be;}})});}_0x29929d=_[_0xb6c2('0x2f')]({},_0x29929d,_0x522190[_0xb6c2('0x32')]);var _0x5745db={'where':_0x29929d['where']};return db[_0xb6c2('0x1e')][_0xb6c2('0x15')](_0x5745db)[_0xb6c2('0x7')](function(_0xefa377){_0x36c81f[_0xb6c2('0x15')]=_0xefa377;if(_0x522190[_0xb6c2('0x23')][_0xb6c2('0x33')]){_0x29929d['include']=[{'all':!![]}];}return db['Network'][_0xb6c2('0x34')](_0x29929d);})[_0xb6c2('0x7')](function(_0x1314d7){_0x36c81f[_0xb6c2('0x35')]=_0x1314d7;return _0x36c81f;})[_0xb6c2('0x7')](respondWithFilteredResult(_0x4c443d,_0x29929d))[_0xb6c2('0x36')](handleError(_0x4c443d,null));};exports['show']=function(_0x1936ea,_0x3db571){var _0xdf653f={'raw':!![],'where':{'id':_0x1936ea[_0xb6c2('0x37')]['id']}},_0x4ee576={};_0x4ee576[_0xb6c2('0x22')]=_[_0xb6c2('0x24')](db[_0xb6c2('0x1e')]['rawAttributes']);_0x4ee576[_0xb6c2('0x23')]=_[_0xb6c2('0x24')](_0x1936ea[_0xb6c2('0x23')]);_0x4ee576[_0xb6c2('0x25')]=_[_0xb6c2('0x26')](_0x4ee576['model'],_0x4ee576['query']);_0xdf653f['attributes']=_[_0xb6c2('0x26')](_0x4ee576['model'],qs['fields'](_0x1936ea[_0xb6c2('0x23')][_0xb6c2('0x28')]));_0xdf653f[_0xb6c2('0x27')]=_0xdf653f[_0xb6c2('0x27')]['length']?_0xdf653f[_0xb6c2('0x27')]:_0x4ee576['model'];if(_0x1936ea[_0xb6c2('0x23')][_0xb6c2('0x33')]){_0xdf653f[_0xb6c2('0x38')]=[{'all':!![]}];}_0xdf653f=_[_0xb6c2('0x2f')]({},_0xdf653f,_0x1936ea[_0xb6c2('0x32')]);return db[_0xb6c2('0x1e')][_0xb6c2('0x39')](_0xdf653f)[_0xb6c2('0x7')](handleEntityNotFound(_0x3db571,null))['then'](respondWithResult(_0x3db571,null))[_0xb6c2('0x36')](handleError(_0x3db571,null));};exports['create']=function(_0x22e49a,_0x2ad2ed){var _0x4a63e3;return db[_0xb6c2('0x1e')][_0xb6c2('0x3a')](_0x22e49a[_0xb6c2('0x3b')],{'raw':!![]})[_0xb6c2('0x7')](function(_0x4b81ed){_0x4a63e3=_0x4b81ed;return db[_0xb6c2('0x1e')][_0xb6c2('0x34')]({'where':{'type':_0x22e49a[_0xb6c2('0x3b')][_0xb6c2('0x21')]},'raw':!![]});})[_0xb6c2('0x7')](function(_0x5f451f){if(_0x4a63e3[_0xb6c2('0x21')][_0xb6c2('0x3c')]()==_0xb6c2('0x3d')){var _0x2413b1=fs[_0xb6c2('0x3e')](path['join'](config['root'],_0xb6c2('0x3f')),_0xb6c2('0x40'));var _0x53d399=ejs[_0xb6c2('0x41')](_0x2413b1,{'networks':_0x5f451f||[]});fs[_0xb6c2('0x42')](_0xb6c2('0x43'),_0x53d399);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x3a'),{'module':_0xb6c2('0x45')});}else if(_0x4a63e3[_0xb6c2('0x21')]['toUpperCase']()==_0xb6c2('0x46')){var _0x2f458e=fs[_0xb6c2('0x3e')](path[_0xb6c2('0x47')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xb6c2('0x40'));var _0x5ace20=ejs[_0xb6c2('0x41')](_0x2f458e,{'networks':_0x5f451f||[]});fs['writeFileSync'](_0xb6c2('0x48'),_0x5ace20);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x3a'),{'module':'res_stun_monitor.so'});}else{var _0x40ca05=fs[_0xb6c2('0x3e')](path[_0xb6c2('0x47')](config[_0xb6c2('0x49')],'server/files/templates/network.ejs'),'utf8');var _0x42072b=ejs[_0xb6c2('0x41')](_0x40ca05,{'networks':_0x5f451f||[]});fs[_0xb6c2('0x42')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x22e49a[_0xb6c2('0x3b')][_0xb6c2('0x21')][_0xb6c2('0x4a')]()),_0x42072b);return respondWithRpcPromise('Reload',_0xb6c2('0x3a'),{'module':_0xb6c2('0x4b')});}})[_0xb6c2('0x7')](function(){return _0x4a63e3;})[_0xb6c2('0x7')](respondWithResult(_0x2ad2ed,0xc9))[_0xb6c2('0x36')](handleError(_0x2ad2ed,null));};exports['update']=function(_0x31da06,_0x315c6d){var _0x1fda14;return db[_0xb6c2('0x1e')][_0xb6c2('0x39')]({'where':{'id':_0x31da06['params']['id']}})[_0xb6c2('0x7')](handleEntityNotFound(_0x315c6d,null))['then'](saveUpdates(_0x31da06[_0xb6c2('0x3b')],null))[_0xb6c2('0x7')](function(_0x28ff9a){if(_0x28ff9a){_0x1fda14=_0x28ff9a;return db[_0xb6c2('0x1e')][_0xb6c2('0x34')]({'where':{'type':_0x1fda14[_0xb6c2('0x21')]},'raw':!![]});}return null;})[_0xb6c2('0x7')](function(_0x349e2b){if(_0x1fda14['type'][_0xb6c2('0x3c')]()==_0xb6c2('0x3d')){var _0x14ebb5=fs[_0xb6c2('0x3e')](path[_0xb6c2('0x47')](config[_0xb6c2('0x49')],_0xb6c2('0x3f')),_0xb6c2('0x40'));var _0xb4f3f6=ejs[_0xb6c2('0x41')](_0x14ebb5,{'networks':_0x349e2b||[]});fs['writeFileSync'](_0xb6c2('0x43'),_0xb4f3f6);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x17'),{'module':'res_stun_monitor.so'});}else if(_0x1fda14[_0xb6c2('0x21')]['toUpperCase']()==_0xb6c2('0x46')){var _0x2ffb88=fs['readFileSync'](path['join'](config[_0xb6c2('0x49')],_0xb6c2('0x4c')),_0xb6c2('0x40'));var _0x5ce543=ejs[_0xb6c2('0x41')](_0x2ffb88,{'networks':_0x349e2b||[]});fs['writeFileSync'](_0xb6c2('0x48'),_0x5ce543);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x17'),{'module':_0xb6c2('0x45')});}else{var _0x36f856=fs[_0xb6c2('0x3e')](path['join'](config[_0xb6c2('0x49')],'server/files/templates/network.ejs'),_0xb6c2('0x40'));var _0x92ee28=ejs[_0xb6c2('0x41')](_0x36f856,{'networks':_0x349e2b||[]});fs['writeFileSync'](util['format'](_0xb6c2('0x4d'),_0x31da06[_0xb6c2('0x3b')][_0xb6c2('0x21')][_0xb6c2('0x4a')]()),_0x92ee28);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x17'),{'module':_0xb6c2('0x4b')});}})[_0xb6c2('0x7')](function(_0x32d5a0){if(_0x32d5a0){return _0x1fda14;}return null;})['then'](respondWithResult(_0x315c6d,null))['catch'](handleError(_0x315c6d,null));};exports['destroy']=function(_0xd63445,_0x52c1a8){var _0x59e1d5;return db[_0xb6c2('0x1e')][_0xb6c2('0x39')]({'where':{'id':_0xd63445[_0xb6c2('0x37')]['id']}})[_0xb6c2('0x7')](function(_0xfdd859){_0x59e1d5=_0xfdd859;return _0xfdd859;})['then'](handleEntityNotFound(_0x52c1a8,null))[_0xb6c2('0x7')](removeEntity(_0x52c1a8,null))[_0xb6c2('0x7')](function(){if(_0x59e1d5){return db[_0xb6c2('0x1e')]['findAll']({'where':{'type':_0x59e1d5[_0xb6c2('0x21')]},'raw':!![]});}})['then'](function(_0x4e71a0){if(_0x59e1d5[_0xb6c2('0x21')][_0xb6c2('0x3c')]()==_0xb6c2('0x3d')){var _0x5e39a3=fs['readFileSync'](path[_0xb6c2('0x47')](config[_0xb6c2('0x49')],_0xb6c2('0x3f')),_0xb6c2('0x40'));var _0x2d4b2d=ejs[_0xb6c2('0x41')](_0x5e39a3,{'networks':_0x4e71a0||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2d4b2d);return respondWithRpcPromise('Reload',_0xb6c2('0x4e'),{'module':_0xb6c2('0x45')});}else if(_0x59e1d5['type'][_0xb6c2('0x3c')]()==_0xb6c2('0x46')){var _0x3c374e=fs[_0xb6c2('0x3e')](path[_0xb6c2('0x47')](config[_0xb6c2('0x49')],_0xb6c2('0x4c')),_0xb6c2('0x40'));var _0x3d2fa0=ejs['render'](_0x3c374e,{'networks':_0x4e71a0||[]});fs[_0xb6c2('0x42')]('/etc/asterisk/turn_xcally.conf',_0x3d2fa0);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x4e'),{'module':_0xb6c2('0x45')});}else{var _0x2bb850=fs[_0xb6c2('0x3e')](path[_0xb6c2('0x47')](config[_0xb6c2('0x49')],_0xb6c2('0x4f')),_0xb6c2('0x40'));var _0x2ad38a=ejs[_0xb6c2('0x41')](_0x2bb850,{'networks':_0x4e71a0||[]});fs[_0xb6c2('0x42')](util[_0xb6c2('0x50')](_0xb6c2('0x4d'),_0x59e1d5[_0xb6c2('0x21')][_0xb6c2('0x4a')]()),_0x2ad38a);return respondWithRpcPromise(_0xb6c2('0x44'),_0xb6c2('0x4e'),{'module':_0xb6c2('0x4b')});}})[_0xb6c2('0x36')](handleError(_0x52c1a8,null));}; \ No newline at end of file +var _0x81f6=['then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','Network','rawAttributes','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','show','params','intersection','find','create','body','findAll','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/stun_xcally.conf','path','ejs','lodash','../../config/logger','../../config/environment','http','request'];(function(_0x75a1f,_0x39d58c){var _0x43add9=function(_0x594a1c){while(--_0x594a1c){_0x75a1f['push'](_0x75a1f['shift']());}};_0x43add9(++_0x39d58c);}(_0x81f6,0x14d));var _0x681f=function(_0x291d2e,_0x5d43e3){_0x291d2e=_0x291d2e-0x0;var _0x53a151=_0x81f6[_0x291d2e];return _0x53a151;};'use strict';var util=require('util');var path=require(_0x681f('0x0'));var ejs=require(_0x681f('0x1'));var fs=require('fs');var _=require(_0x681f('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x681f('0x3'))('api');var config=require(_0x681f('0x4'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x681f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x92e6af,_0x22c092,_0xe9f202,_0x4899c3){return new Promise(function(_0x2c0344,_0x27613b){var _0x51450b=_0x4899c3||client;return _0x51450b[_0x681f('0x6')](_0x92e6af,_0xe9f202)[_0x681f('0x7')](function(_0x46b096){logger[_0x681f('0x8')]('Network,\x20%s,\x20%s',_0x22c092,_0x681f('0x9'));logger[_0x681f('0xa')](_0x681f('0xb'),_0x22c092,_0x681f('0x9'),JSON[_0x681f('0xc')](_0x46b096));if(_0x46b096[_0x681f('0xd')]){if(_0x46b096['error'][_0x681f('0xe')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x22c092,_0x46b096[_0x681f('0xd')][_0x681f('0xf')]);return _0x27613b(_0x46b096['error'][_0x681f('0xf')]);}logger[_0x681f('0xd')]('Network,\x20%s,\x20%s',_0x22c092,_0x46b096['error'][_0x681f('0xf')]);return _0x2c0344(_0x46b096[_0x681f('0xd')][_0x681f('0xf')]);}else{logger[_0x681f('0x8')](_0x681f('0x10'),_0x22c092,'request\x20sent');_0x2c0344(_0x46b096[_0x681f('0x11')][_0x681f('0xf')]);}})[_0x681f('0x12')](function(_0x6254b5){logger[_0x681f('0xd')](_0x681f('0x10'),_0x22c092,_0x6254b5);_0x27613b(_0x6254b5);});});}function respondWithResult(_0x1082dd,_0x18e347){_0x18e347=_0x18e347||0xc8;return function(_0x2f3339){if(_0x2f3339){return _0x1082dd[_0x681f('0x13')](_0x18e347)[_0x681f('0x14')](_0x2f3339);}};}function respondWithFilteredResult(_0x3101e0,_0x225564){return function(_0x1f0604){if(_0x1f0604){var _0x4133ca=typeof _0x225564['offset']===_0x681f('0x15')&&typeof _0x225564[_0x681f('0x16')]===_0x681f('0x15');var _0x5cfd5c=_0x1f0604[_0x681f('0x17')];var _0x493d72=_0x4133ca?0x0:_0x225564[_0x681f('0x18')];var _0x372519=_0x4133ca?_0x1f0604['count']:_0x225564[_0x681f('0x18')]+_0x225564[_0x681f('0x16')];var _0x21e9af;if(_0x372519>=_0x5cfd5c){_0x372519=_0x5cfd5c;_0x21e9af=0xc8;}else{_0x21e9af=0xce;}_0x3101e0['status'](_0x21e9af);return _0x3101e0[_0x681f('0x19')](_0x681f('0x1a'),_0x493d72+'-'+_0x372519+'/'+_0x5cfd5c)[_0x681f('0x14')](_0x1f0604);}return null;};}function saveUpdates(_0x4331b0){return function(_0x6a7771){if(_0x6a7771){return _0x6a7771[_0x681f('0x1b')](_0x4331b0)[_0x681f('0x7')](function(_0x1b3140){return _0x1b3140;});}return null;};}function removeEntity(_0x1dc512){return function(_0x5c4d8c){if(_0x5c4d8c){return _0x5c4d8c[_0x681f('0x1c')]()[_0x681f('0x7')](function(){_0x1dc512[_0x681f('0x13')](0xcc)[_0x681f('0x1d')]();});}};}function handleEntityNotFound(_0x477957){return function(_0x9e87f9){if(!_0x9e87f9){_0x477957[_0x681f('0x1e')](0x194);}return _0x9e87f9;};}function handleError(_0x2f7508,_0x57ad27){_0x57ad27=_0x57ad27||0x1f4;return function(_0x1089c1){logger[_0x681f('0xd')](_0x1089c1[_0x681f('0x1f')]);if(_0x1089c1[_0x681f('0x20')]){delete _0x1089c1['name'];}_0x2f7508[_0x681f('0x13')](_0x57ad27)['send'](_0x1089c1);};}exports[_0x681f('0x21')]=function(_0x466a0f,_0x1118f9){var _0x478d7b={},_0x44e9eb={},_0x2ed9bc={'count':0x0,'rows':[]};var _0x4f620b=_['map'](db[_0x681f('0x22')][_0x681f('0x23')],function(_0x28ddcb){return{'name':_0x28ddcb['fieldName'],'type':_0x28ddcb[_0x681f('0x24')][_0x681f('0x25')]};});_0x44e9eb[_0x681f('0x26')]=_['map'](_0x4f620b,'name');_0x44e9eb['query']=_[_0x681f('0x27')](_0x466a0f[_0x681f('0x28')]);_0x44e9eb['filters']=_['intersection'](_0x44e9eb['model'],_0x44e9eb[_0x681f('0x28')]);_0x478d7b[_0x681f('0x29')]=_['intersection'](_0x44e9eb[_0x681f('0x26')],qs[_0x681f('0x2a')](_0x466a0f[_0x681f('0x28')]['fields']));_0x478d7b[_0x681f('0x29')]=_0x478d7b[_0x681f('0x29')][_0x681f('0x2b')]?_0x478d7b[_0x681f('0x29')]:_0x44e9eb['model'];if(!_0x466a0f[_0x681f('0x28')][_0x681f('0x2c')](_0x681f('0x2d'))){_0x478d7b[_0x681f('0x16')]=qs['limit'](_0x466a0f[_0x681f('0x28')][_0x681f('0x16')]);_0x478d7b[_0x681f('0x18')]=qs[_0x681f('0x18')](_0x466a0f['query'][_0x681f('0x18')]);}_0x478d7b[_0x681f('0x2e')]=qs[_0x681f('0x2f')](_0x466a0f[_0x681f('0x28')][_0x681f('0x2f')]);_0x478d7b['where']=qs[_0x681f('0x30')](_[_0x681f('0x31')](_0x466a0f[_0x681f('0x28')],_0x44e9eb[_0x681f('0x30')]),_0x4f620b);if(_0x466a0f[_0x681f('0x28')][_0x681f('0x32')]){_0x478d7b[_0x681f('0x33')]=_[_0x681f('0x34')](_0x478d7b[_0x681f('0x33')],{'$or':_[_0x681f('0x35')](_0x4f620b,function(_0x505438){if(_0x505438[_0x681f('0x24')]!==_0x681f('0x36')){var _0x17e697={};_0x17e697[_0x505438['name']]={'$like':'%'+_0x466a0f[_0x681f('0x28')][_0x681f('0x32')]+'%'};return _0x17e697;}})});}_0x478d7b=_[_0x681f('0x34')]({},_0x478d7b,_0x466a0f[_0x681f('0x37')]);var _0x12c028={'where':_0x478d7b[_0x681f('0x33')]};return db[_0x681f('0x22')][_0x681f('0x17')](_0x12c028)['then'](function(_0x5a6afc){_0x2ed9bc[_0x681f('0x17')]=_0x5a6afc;if(_0x466a0f[_0x681f('0x28')][_0x681f('0x38')]){_0x478d7b[_0x681f('0x39')]=[{'all':!![]}];}return db[_0x681f('0x22')]['findAll'](_0x478d7b);})[_0x681f('0x7')](function(_0x37fd24){_0x2ed9bc['rows']=_0x37fd24;return _0x2ed9bc;})[_0x681f('0x7')](respondWithFilteredResult(_0x1118f9,_0x478d7b))[_0x681f('0x12')](handleError(_0x1118f9,null));};exports[_0x681f('0x3a')]=function(_0x2a7450,_0x4e3724){var _0x303332={'raw':!![],'where':{'id':_0x2a7450[_0x681f('0x3b')]['id']}},_0x52e5d0={};_0x52e5d0[_0x681f('0x26')]=_[_0x681f('0x27')](db[_0x681f('0x22')][_0x681f('0x23')]);_0x52e5d0[_0x681f('0x28')]=_[_0x681f('0x27')](_0x2a7450['query']);_0x52e5d0[_0x681f('0x30')]=_['intersection'](_0x52e5d0['model'],_0x52e5d0[_0x681f('0x28')]);_0x303332['attributes']=_[_0x681f('0x3c')](_0x52e5d0[_0x681f('0x26')],qs[_0x681f('0x2a')](_0x2a7450['query'][_0x681f('0x2a')]));_0x303332[_0x681f('0x29')]=_0x303332[_0x681f('0x29')][_0x681f('0x2b')]?_0x303332['attributes']:_0x52e5d0[_0x681f('0x26')];if(_0x2a7450['query'][_0x681f('0x38')]){_0x303332[_0x681f('0x39')]=[{'all':!![]}];}_0x303332=_[_0x681f('0x34')]({},_0x303332,_0x2a7450['options']);return db[_0x681f('0x22')][_0x681f('0x3d')](_0x303332)[_0x681f('0x7')](handleEntityNotFound(_0x4e3724,null))[_0x681f('0x7')](respondWithResult(_0x4e3724,null))[_0x681f('0x12')](handleError(_0x4e3724,null));};exports[_0x681f('0x3e')]=function(_0x562511,_0x4d918e){var _0x672c12;return db['Network'][_0x681f('0x3e')](_0x562511[_0x681f('0x3f')],{'raw':!![]})[_0x681f('0x7')](function(_0x289ef4){_0x672c12=_0x289ef4;return db['Network'][_0x681f('0x40')]({'where':{'type':_0x562511[_0x681f('0x3f')][_0x681f('0x24')]},'raw':!![]});})[_0x681f('0x7')](function(_0x5b5430){if(_0x672c12[_0x681f('0x24')]['toUpperCase']()==_0x681f('0x41')){var _0x4c1537=fs[_0x681f('0x42')](path['join'](config[_0x681f('0x43')],_0x681f('0x44')),_0x681f('0x45'));var _0x1941e0=ejs[_0x681f('0x46')](_0x4c1537,{'networks':_0x5b5430||[]});fs[_0x681f('0x47')]('/etc/asterisk/stun_xcally.conf',_0x1941e0);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x3e'),{'module':_0x681f('0x49')});}else if(_0x672c12['type'][_0x681f('0x4a')]()==_0x681f('0x4b')){var _0x1c25e6=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config['root'],_0x681f('0x4d')),_0x681f('0x45'));var _0x169707=ejs[_0x681f('0x46')](_0x1c25e6,{'networks':_0x5b5430||[]});fs[_0x681f('0x47')](_0x681f('0x4e'),_0x169707);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x3e'),{'module':_0x681f('0x49')});}else{var _0x2c07ae=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],_0x681f('0x4f')),'utf8');var _0x4cc326=ejs[_0x681f('0x46')](_0x2c07ae,{'networks':_0x5b5430||[]});fs[_0x681f('0x47')](util[_0x681f('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x562511['body'][_0x681f('0x24')][_0x681f('0x51')]()),_0x4cc326);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x3e'),{'module':_0x681f('0x52')});}})[_0x681f('0x7')](function(){return _0x672c12;})[_0x681f('0x7')](respondWithResult(_0x4d918e,0xc9))[_0x681f('0x12')](handleError(_0x4d918e,null));};exports[_0x681f('0x1b')]=function(_0x23c2a4,_0x437627){var _0x3c777b;return db['Network'][_0x681f('0x3d')]({'where':{'id':_0x23c2a4[_0x681f('0x3b')]['id']}})[_0x681f('0x7')](handleEntityNotFound(_0x437627,null))[_0x681f('0x7')](saveUpdates(_0x23c2a4[_0x681f('0x3f')],null))['then'](function(_0x1e15de){if(_0x1e15de){_0x3c777b=_0x1e15de;return db['Network'][_0x681f('0x40')]({'where':{'type':_0x3c777b[_0x681f('0x24')]},'raw':!![]});}return null;})[_0x681f('0x7')](function(_0x1be4b5){if(_0x3c777b[_0x681f('0x24')][_0x681f('0x4a')]()==_0x681f('0x41')){var _0x2582e4=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],_0x681f('0x44')),_0x681f('0x45'));var _0x48ebda=ejs[_0x681f('0x46')](_0x2582e4,{'networks':_0x1be4b5||[]});fs[_0x681f('0x47')]('/etc/asterisk/stun_xcally.conf',_0x48ebda);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x1b'),{'module':_0x681f('0x49')});}else if(_0x3c777b[_0x681f('0x24')]['toUpperCase']()==_0x681f('0x4b')){var _0x110abb=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],'server/files/templates/turn_multiple.ejs'),_0x681f('0x45'));var _0x3ae735=ejs[_0x681f('0x46')](_0x110abb,{'networks':_0x1be4b5||[]});fs[_0x681f('0x47')]('/etc/asterisk/turn_xcally.conf',_0x3ae735);return respondWithRpcPromise(_0x681f('0x48'),'update',{'module':_0x681f('0x49')});}else{var _0x493c72=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],'server/files/templates/network.ejs'),_0x681f('0x45'));var _0x4d4dc2=ejs['render'](_0x493c72,{'networks':_0x1be4b5||[]});fs['writeFileSync'](util[_0x681f('0x50')](_0x681f('0x53'),_0x23c2a4[_0x681f('0x3f')]['type'][_0x681f('0x51')]()),_0x4d4dc2);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x1b'),{'module':_0x681f('0x52')});}})[_0x681f('0x7')](function(_0x398d9b){if(_0x398d9b){return _0x3c777b;}return null;})[_0x681f('0x7')](respondWithResult(_0x437627,null))[_0x681f('0x12')](handleError(_0x437627,null));};exports['destroy']=function(_0xf5b7f6,_0x1c3088){var _0x48e37e;return db['Network']['find']({'where':{'id':_0xf5b7f6[_0x681f('0x3b')]['id']}})[_0x681f('0x7')](function(_0x42d5ec){_0x48e37e=_0x42d5ec;return _0x42d5ec;})[_0x681f('0x7')](handleEntityNotFound(_0x1c3088,null))[_0x681f('0x7')](removeEntity(_0x1c3088,null))[_0x681f('0x7')](function(){if(_0x48e37e){return db[_0x681f('0x22')][_0x681f('0x40')]({'where':{'type':_0x48e37e['type']},'raw':!![]});}})[_0x681f('0x7')](function(_0x1c0d0d){if(_0x48e37e[_0x681f('0x24')]['toUpperCase']()==_0x681f('0x41')){var _0x173085=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],_0x681f('0x44')),_0x681f('0x45'));var _0x22f0f=ejs['render'](_0x173085,{'networks':_0x1c0d0d||[]});fs[_0x681f('0x47')](_0x681f('0x54'),_0x22f0f);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x48e37e['type'][_0x681f('0x4a')]()==_0x681f('0x4b')){var _0x1976ff=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config[_0x681f('0x43')],'server/files/templates/turn_multiple.ejs'),_0x681f('0x45'));var _0x41e193=ejs['render'](_0x1976ff,{'networks':_0x1c0d0d||[]});fs['writeFileSync'](_0x681f('0x4e'),_0x41e193);return respondWithRpcPromise('Reload',_0x681f('0x1c'),{'module':_0x681f('0x49')});}else{var _0x54a29a=fs[_0x681f('0x42')](path[_0x681f('0x4c')](config['root'],_0x681f('0x4f')),_0x681f('0x45'));var _0x1b3247=ejs[_0x681f('0x46')](_0x54a29a,{'networks':_0x1c0d0d||[]});fs[_0x681f('0x47')](util[_0x681f('0x50')](_0x681f('0x53'),_0x48e37e[_0x681f('0x24')][_0x681f('0x51')]()),_0x1b3247);return respondWithRpcPromise(_0x681f('0x48'),_0x681f('0x1c'),{'module':'chan_sip.so'});}})[_0x681f('0x12')](handleError(_0x1c3088,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6eaca4b..13fb285 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 _0xa74f=['network','../../config/logger','bluebird','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x39c223,_0x17a712){var _0xac729f=function(_0x4932dd){while(--_0x4932dd){_0x39c223['push'](_0x39c223['shift']());}};_0xac729f(++_0x17a712);}(_0xa74f,0x9a));var _0xfa74=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa74f[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eaa=['./network.attributes','exports','network','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x2df317,_0x5f36d0){_0x2df317=_0x2df317-0x0;var _0x41db2b=_0x0eaa[_0x2df317];return _0x41db2b;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0ea('0x4'));var rimraf=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var attributes=require(_0xa0ea('0x7'));module[_0xa0ea('0x8')]=function(_0x5636ed,_0x3c6586){return _0x5636ed['define']('Network',attributes,{'tableName':_0xa0ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 32e94b9..e47ce4e 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x39fabd,_0x4323a1){var _0x5a40f2=function(_0x5d8aac){while(--_0x5d8aac){_0x39fabd['push'](_0x39fabd['shift']());}};_0x5a40f2(++_0x4323a1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e7f9e,_0xf2c9c4){var _0x1fc335=function(_0x170bd9){while(--_0x170bd9){_0x3e7f9e['push'](_0x3e7f9e['shift']());}};_0x1fc335(++_0xf2c9c4);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7527f25..486e527 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 _0xd117=['getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/users'];(function(_0x14f458,_0x5dd219){var _0x4ff2da=function(_0x473b86){while(--_0x473b86){_0x14f458['push'](_0x14f458['shift']());}};_0x4ff2da(++_0x5dd219);}(_0xd117,0x182));var _0x7d11=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xd117[_0x193e28];return _0x20ef59;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0xb')]('/:id/interactions',auth[_0x7d11('0xc')](),controller[_0x7d11('0x16')]);router['get'](_0x7d11('0x17'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x18')]);router[_0x7d11('0x19')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0x1a')]);router[_0x7d11('0x19')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x19')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1d')]);router['post'](_0x7d11('0x1e'),controller[_0x7d11('0x1f')]);router['post']('/:id/applications',auth[_0x7d11('0xc')](),controller['addApplications']);router[_0x7d11('0x19')]('/:id/users',auth[_0x7d11('0xc')](),controller[_0x7d11('0x20')]);router[_0x7d11('0x19')](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x22')]);router[_0x7d11('0x23')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x25')]);router[_0x7d11('0x26')](_0x7d11('0x12'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x27')]);router[_0x7d11('0x26')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller['removeAnswers']);router[_0x7d11('0x26')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x7d11('0x28')]=router; \ No newline at end of file +var _0x065e=['isAuthenticated','index','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','/:id/applications','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller'];(function(_0x370ae0,_0x5ac643){var _0x528df6=function(_0x481c8d){while(--_0x481c8d){_0x370ae0['push'](_0x370ae0['shift']());}};_0x528df6(++_0x5ac643);}(_0x065e,0x1a7));var _0xe065=function(_0x329ea0,_0x107160){_0x329ea0=_0x329ea0-0x0;var _0x58fdf8=_0x065e[_0x329ea0];return _0x58fdf8;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));var controller=require(_0xe065('0x5'));router['get']('/',auth[_0xe065('0x6')](),controller[_0xe065('0x7')]);router[_0xe065('0x8')]('/describe',auth[_0xe065('0x6')](),controller['describe']);router[_0xe065('0x8')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0xa')]);router[_0xe065('0x8')]('/:id/dispositions',auth[_0xe065('0x6')](),controller[_0xe065('0xb')]);router[_0xe065('0x8')](_0xe065('0xc'),auth[_0xe065('0x6')](),controller[_0xe065('0xd')]);router['get']('/:id/applications',auth[_0xe065('0x6')](),controller[_0xe065('0xe')]);router[_0xe065('0x8')]('/:id/interactions',auth[_0xe065('0x6')](),controller[_0xe065('0xf')]);router[_0xe065('0x8')](_0xe065('0x10'),auth[_0xe065('0x6')](),controller['getAgents']);router[_0xe065('0x11')]('/',auth[_0xe065('0x6')](),controller[_0xe065('0x12')]);router[_0xe065('0x11')](_0xe065('0x13'),auth[_0xe065('0x6')](),controller[_0xe065('0x14')]);router['post'](_0xe065('0xc'),auth[_0xe065('0x6')](),controller['addAnswer']);router[_0xe065('0x11')](_0xe065('0x15'),controller[_0xe065('0x16')]);router[_0xe065('0x11')](_0xe065('0x17'),auth[_0xe065('0x6')](),controller[_0xe065('0x18')]);router['post'](_0xe065('0x10'),auth['isAuthenticated'](),controller[_0xe065('0x19')]);router[_0xe065('0x11')]('/:id/send',auth[_0xe065('0x6')](),controller['send']);router[_0xe065('0x1a')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0x1b')]);router[_0xe065('0x1c')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0x1d')]);router[_0xe065('0x1c')]('/:id/dispositions',auth[_0xe065('0x6')](),controller[_0xe065('0x1e')]);router[_0xe065('0x1c')](_0xe065('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe065('0x1c')]('/:id/users',auth[_0xe065('0x6')](),controller[_0xe065('0x1f')]);module[_0xe065('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0944593..e4417b7 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 _0x4c85=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5bbf8e,_0x5971f5){var _0x13ece4=function(_0x2a0897){while(--_0x2a0897){_0x5bbf8e['push'](_0x5bbf8e['shift']());}};_0x13ece4(++_0x5971f5);}(_0x4c85,0x161));var _0x54c8=function(_0x2ff4e5,_0x4437f3){_0x2ff4e5=_0x2ff4e5-0x0;var _0x59fd59=_0x4c85[_0x2ff4e5];return _0x59fd59;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x54c8('0x0'));module[_0x54c8('0x1')]={'name':{'type':Sequelize[_0x54c8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x54c8('0x2')],'defaultValue':function(){return rs[_0x54c8('0x3')]();}},'replyUri':{'type':Sequelize[_0x54c8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x54c8('0x4')],'defaultValue':function(){return _0x54c8('0x5');}},'notificationSound':{'type':Sequelize[_0x54c8('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x54c8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x54c8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x54c8('0x2')]},'queueTransfer':{'type':Sequelize[_0x54c8('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x54c8('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x54c8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x54c8('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x54c8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x54c8('0x6')],'defaultValue':![],'comment':_0x54c8('0x9'),'set':function(_0x36d5cb){if(!_0x36d5cb)this[_0x54c8('0xa')]('mandatoryDispositionPauseId',null);this[_0x54c8('0xa')](_0x54c8('0xb'),_0x36d5cb);}}}; \ No newline at end of file +var _0x2176=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4c82af,_0x5ca362){var _0x260354=function(_0x31749a){while(--_0x31749a){_0x4c82af['push'](_0x4c82af['shift']());}};_0x260354(++_0x5ca362);}(_0x2176,0xac));var _0x6217=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2176[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6217('0x0'));var rs=require(_0x6217('0x1'));module[_0x6217('0x2')]={'name':{'type':Sequelize[_0x6217('0x3')],'unique':_0x6217('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x6217('0x3')]},'token':{'type':Sequelize[_0x6217('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6217('0x5')],'defaultValue':function(){return _0x6217('0x6');}},'notificationSound':{'type':Sequelize[_0x6217('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6217('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6217('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x6217('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6217('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6217('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6217('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6217('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x6217('0x7')],'defaultValue':![],'comment':_0x6217('0xa'),'set':function(_0x451a64){if(!_0x451a64)this[_0x6217('0xb')](_0x6217('0xc'),null);this[_0x6217('0xb')]('mandatoryDisposition',_0x451a64);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f22e62e..a4896c4 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 _0xcc05=['status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','OpenchannelAccount','includeAll','include','rows','show','params','options','find','create','body','user','UserProfileSection','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','findAll','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xcc05,0x95));var _0x5cc0=function(_0x4dd071,_0x2f978b){_0x4dd071=_0x4dd071-0x0;var _0x2a67d9=_0xcc05[_0x4dd071];return _0x2a67d9;};'use strict';var emlformat=require(_0x5cc0('0x0'));var rimraf=require(_0x5cc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cc0('0x2'));var rp=require(_0x5cc0('0x3'));var moment=require(_0x5cc0('0x4'));var BPromise=require(_0x5cc0('0x5'));var Mustache=require(_0x5cc0('0x6'));var util=require(_0x5cc0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5cc0('0x8'));var ejs=require(_0x5cc0('0x9'));var fs=require('fs');var fs_extra=require(_0x5cc0('0xa'));var _=require('lodash');var squel=require(_0x5cc0('0xb'));var crypto=require(_0x5cc0('0xc'));var jsforce=require(_0x5cc0('0xd'));var deskjs=require(_0x5cc0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5cc0('0xf'));var Papa=require(_0x5cc0('0x10'));var Redis=require(_0x5cc0('0x11'));var authService=require(_0x5cc0('0x12'));var qs=require(_0x5cc0('0x13'));var as=require(_0x5cc0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5cc0('0x15'));var config=require(_0x5cc0('0x16'));var licenseUtil=require(_0x5cc0('0x17'));var db=require(_0x5cc0('0x18'))['db'];config['redis']=_[_0x5cc0('0x19')](config[_0x5cc0('0x1a')],{'host':_0x5cc0('0x1b'),'port':0x18eb});var socket=require(_0x5cc0('0x1c'))(new Redis(config[_0x5cc0('0x1a')]));require(_0x5cc0('0x1d'))[_0x5cc0('0x1e')](socket);var jayson=require(_0x5cc0('0x1f'));var client=jayson['client'][_0x5cc0('0x20')]({'port':0x232c});var client9002=jayson[_0x5cc0('0x21')][_0x5cc0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x245173,_0x3efaaa,_0x3bdd17,_0x2b9921){return new BPromise(function(_0x43d5d6,_0x47b812){var _0x21ab34=_0x2b9921||client;return _0x21ab34['request'](_0x245173,_0x3bdd17)[_0x5cc0('0x22')](function(_0x274777){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3efaaa,_0x5cc0('0x23'));logger['debug'](_0x5cc0('0x24'),_0x3efaaa,'request\x20sent',JSON[_0x5cc0('0x25')](_0x274777));if(_0x274777['error']){if(_0x274777[_0x5cc0('0x26')][_0x5cc0('0x27')]===0x1f4){logger[_0x5cc0('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3efaaa,_0x274777[_0x5cc0('0x26')][_0x5cc0('0x28')]);return _0x47b812(_0x274777[_0x5cc0('0x26')][_0x5cc0('0x28')]);}logger['error'](_0x5cc0('0x29'),_0x3efaaa,_0x274777[_0x5cc0('0x26')][_0x5cc0('0x28')]);return _0x43d5d6(_0x274777[_0x5cc0('0x26')]['message']);}else{logger[_0x5cc0('0x2a')](_0x5cc0('0x29'),_0x3efaaa,_0x5cc0('0x23'));_0x43d5d6(_0x274777[_0x5cc0('0x2b')][_0x5cc0('0x28')]);}})[_0x5cc0('0x2c')](function(_0x4a2ae6){logger[_0x5cc0('0x26')](_0x5cc0('0x29'),_0x3efaaa,_0x4a2ae6);_0x47b812(_0x4a2ae6);});});}function respondWithStatusCode(_0x2b4791,_0x1a8a1e){_0x1a8a1e=_0x1a8a1e||0xcc;return function(_0x47c2fa){if(_0x47c2fa){return _0x2b4791['sendStatus'](_0x1a8a1e);}return _0x2b4791[_0x5cc0('0x2d')](_0x1a8a1e)['end']();};}function respondWithResult(_0x312ed8,_0x4fcb4c){_0x4fcb4c=_0x4fcb4c||0xc8;return function(_0x58241b){if(_0x58241b){return _0x312ed8[_0x5cc0('0x2d')](_0x4fcb4c)[_0x5cc0('0x2e')](_0x58241b);}};}function respondWithFilteredResult(_0xb7b984,_0x375bd7){return function(_0x43eb6e){if(_0x43eb6e){var _0x1ea63b=typeof _0x375bd7[_0x5cc0('0x2f')]===_0x5cc0('0x30')&&typeof _0x375bd7[_0x5cc0('0x31')]===_0x5cc0('0x30');var _0x4f71e2=_0x43eb6e['count'];var _0x127492=_0x1ea63b?0x0:_0x375bd7['offset'];var _0x3802cc=_0x1ea63b?_0x43eb6e[_0x5cc0('0x32')]:_0x375bd7[_0x5cc0('0x2f')]+_0x375bd7[_0x5cc0('0x31')];var _0x3a148d;if(_0x3802cc>=_0x4f71e2){_0x3802cc=_0x4f71e2;_0x3a148d=0xc8;}else{_0x3a148d=0xce;}_0xb7b984[_0x5cc0('0x2d')](_0x3a148d);return _0xb7b984[_0x5cc0('0x33')]('Content-Range',_0x127492+'-'+_0x3802cc+'/'+_0x4f71e2)[_0x5cc0('0x2e')](_0x43eb6e);}return null;};}function patchUpdates(_0x4ad2a8){return function(_0x1d9ba4){try{jsonpatch[_0x5cc0('0x34')](_0x1d9ba4,_0x4ad2a8,!![]);}catch(_0x4b218e){return BPromise['reject'](_0x4b218e);}return _0x1d9ba4[_0x5cc0('0x35')]();};}function saveUpdates(_0x141e66,_0x2e9de2){return function(_0x22f2ac){if(_0x22f2ac){return _0x22f2ac[_0x5cc0('0x36')](_0x141e66)[_0x5cc0('0x22')](function(_0x18a9d2){return _0x18a9d2;});}return null;};}function removeEntity(_0x213069,_0x235ef3){return function(_0x216061){if(_0x216061){return _0x216061[_0x5cc0('0x37')]()['then'](function(){var _0x4e150e=_0x216061[_0x5cc0('0x38')]({'plain':!![]});var _0x54394a=_0x5cc0('0x39');return db[_0x5cc0('0x3a')][_0x5cc0('0x37')]({'where':{'type':_0x54394a,'resourceId':_0x4e150e['id']}})[_0x5cc0('0x22')](function(){return _0x216061;});})[_0x5cc0('0x22')](function(){_0x213069[_0x5cc0('0x2d')](0xcc)[_0x5cc0('0x3b')]();});}};}function handleEntityNotFound(_0x30e5dc,_0x1008f3){return function(_0x932f18){if(!_0x932f18){_0x30e5dc[_0x5cc0('0x3c')](0x194);}return _0x932f18;};}function handleError(_0x585b2e,_0x499f87){_0x499f87=_0x499f87||0x1f4;return function(_0x294f56){logger[_0x5cc0('0x26')](_0x294f56[_0x5cc0('0x3d')]);if(_0x294f56[_0x5cc0('0x3e')]){delete _0x294f56[_0x5cc0('0x3e')];}_0x585b2e[_0x5cc0('0x2d')](_0x499f87)[_0x5cc0('0x3f')](_0x294f56);};}exports[_0x5cc0('0x40')]=function(_0x5b8c71,_0xe46171){var _0x4a1f8b={'include':[{'model':db[_0x5cc0('0x41')],'as':_0x5cc0('0x42')}]},_0x2b3ef8={},_0x301713={'count':0x0,'rows':[]};var _0x5dbc0d=_[_0x5cc0('0x43')](db['OpenchannelAccount']['rawAttributes'],function(_0x1a5bfc){return{'name':_0x1a5bfc['fieldName'],'type':_0x1a5bfc[_0x5cc0('0x44')][_0x5cc0('0x45')]};});_0x2b3ef8[_0x5cc0('0x46')]=_[_0x5cc0('0x43')](_0x5dbc0d,_0x5cc0('0x3e'));_0x2b3ef8[_0x5cc0('0x47')]=_[_0x5cc0('0x48')](_0x5b8c71[_0x5cc0('0x47')]);_0x2b3ef8[_0x5cc0('0x49')]=_[_0x5cc0('0x4a')](_0x2b3ef8['model'],_0x2b3ef8[_0x5cc0('0x47')]);_0x4a1f8b[_0x5cc0('0x4b')]=_[_0x5cc0('0x4a')](_0x2b3ef8[_0x5cc0('0x46')],qs[_0x5cc0('0x4c')](_0x5b8c71[_0x5cc0('0x47')]['fields']));_0x4a1f8b['attributes']=_0x4a1f8b[_0x5cc0('0x4b')][_0x5cc0('0x4d')]?_0x4a1f8b[_0x5cc0('0x4b')]:_0x2b3ef8[_0x5cc0('0x46')];if(!_0x5b8c71['query'][_0x5cc0('0x4e')](_0x5cc0('0x4f'))){_0x4a1f8b[_0x5cc0('0x31')]=qs[_0x5cc0('0x31')](_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x31')]);_0x4a1f8b[_0x5cc0('0x2f')]=qs['offset'](_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x2f')]);}_0x4a1f8b[_0x5cc0('0x50')]=qs[_0x5cc0('0x51')](_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x51')]);_0x4a1f8b['where']=qs[_0x5cc0('0x49')](_[_0x5cc0('0x52')](_0x5b8c71[_0x5cc0('0x47')],_0x2b3ef8[_0x5cc0('0x49')]),_0x5dbc0d);if(_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x53')]){_0x4a1f8b[_0x5cc0('0x54')]=_['merge'](_0x4a1f8b[_0x5cc0('0x54')],{'$or':_[_0x5cc0('0x43')](_0x5dbc0d,function(_0x4aa030){if(_0x4aa030[_0x5cc0('0x44')]!==_0x5cc0('0x55')){var _0x2d1bf9={};_0x2d1bf9[_0x4aa030[_0x5cc0('0x3e')]]={'$like':'%'+_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x53')]+'%'};return _0x2d1bf9;}})});}_0x4a1f8b=_[_0x5cc0('0x56')]({},_0x4a1f8b,_0x5b8c71['options']);var _0xa2007={'where':_0x4a1f8b[_0x5cc0('0x54')]};return db[_0x5cc0('0x57')]['count'](_0xa2007)['then'](function(_0x7672db){_0x301713[_0x5cc0('0x32')]=_0x7672db;if(_0x5b8c71[_0x5cc0('0x47')][_0x5cc0('0x58')]){_0x4a1f8b[_0x5cc0('0x59')]=[{'all':!![]}];}return db[_0x5cc0('0x57')]['findAll'](_0x4a1f8b);})[_0x5cc0('0x22')](function(_0x1ee931){_0x301713[_0x5cc0('0x5a')]=_0x1ee931;return _0x301713;})[_0x5cc0('0x22')](respondWithFilteredResult(_0xe46171,_0x4a1f8b))[_0x5cc0('0x2c')](handleError(_0xe46171,null));};exports[_0x5cc0('0x5b')]=function(_0x2377cb,_0x3ad21f){var _0x9cdf3d={'raw':![],'where':{'id':_0x2377cb[_0x5cc0('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x5cc0('0x42')}]},_0x314f44={};_0x314f44[_0x5cc0('0x46')]=_[_0x5cc0('0x48')](db[_0x5cc0('0x57')]['rawAttributes']);_0x314f44[_0x5cc0('0x47')]=_[_0x5cc0('0x48')](_0x2377cb['query']);_0x314f44[_0x5cc0('0x49')]=_[_0x5cc0('0x4a')](_0x314f44[_0x5cc0('0x46')],_0x314f44[_0x5cc0('0x47')]);_0x9cdf3d[_0x5cc0('0x4b')]=_['intersection'](_0x314f44['model'],qs[_0x5cc0('0x4c')](_0x2377cb[_0x5cc0('0x47')]['fields']));_0x9cdf3d[_0x5cc0('0x4b')]=_0x9cdf3d[_0x5cc0('0x4b')]['length']?_0x9cdf3d['attributes']:_0x314f44['model'];if(_0x2377cb[_0x5cc0('0x47')][_0x5cc0('0x58')]){_0x9cdf3d[_0x5cc0('0x59')]=[{'all':!![]}];}_0x9cdf3d=_['merge']({},_0x9cdf3d,_0x2377cb[_0x5cc0('0x5d')]);return db[_0x5cc0('0x57')][_0x5cc0('0x5e')](_0x9cdf3d)[_0x5cc0('0x22')](handleEntityNotFound(_0x3ad21f,null))[_0x5cc0('0x22')](respondWithResult(_0x3ad21f,null))[_0x5cc0('0x2c')](handleError(_0x3ad21f,null));};exports[_0x5cc0('0x5f')]=function(_0x239b5b,_0x5b2238){return db[_0x5cc0('0x57')][_0x5cc0('0x5f')](_0x239b5b[_0x5cc0('0x60')],{})['then'](function(_0x1b9dc3){var _0x935148=_0x239b5b['user'][_0x5cc0('0x38')]({'plain':!![]});if(!_0x935148)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x935148['role']===_0x5cc0('0x61')){var _0x36a163=_0x1b9dc3[_0x5cc0('0x38')]({'plain':!![]});var _0x23e496=_0x5cc0('0x39');return db[_0x5cc0('0x62')][_0x5cc0('0x5e')]({'where':{'name':_0x23e496,'userProfileId':_0x935148['userProfileId']},'raw':!![]})['then'](function(_0xc32cfe){if(_0xc32cfe&&_0xc32cfe[_0x5cc0('0x63')]===0x0){return db['UserProfileResource'][_0x5cc0('0x5f')]({'name':_0x36a163[_0x5cc0('0x3e')],'resourceId':_0x36a163['id'],'type':_0xc32cfe[_0x5cc0('0x3e')],'sectionId':_0xc32cfe['id']},{})['then'](function(){return _0x1b9dc3;});}else{return _0x1b9dc3;}})['catch'](function(_0x311a3d){logger[_0x5cc0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x311a3d);throw _0x311a3d;});}return _0x1b9dc3;})[_0x5cc0('0x22')](respondWithResult(_0x5b2238,0xc9))[_0x5cc0('0x2c')](handleError(_0x5b2238,null));};exports[_0x5cc0('0x36')]=function(_0x3585f1,_0x378777){if(_0x3585f1['body']['id']){delete _0x3585f1[_0x5cc0('0x60')]['id'];}return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x3585f1['params']['id']},'include':[{'model':db[_0x5cc0('0x41')],'as':_0x5cc0('0x42')}]})[_0x5cc0('0x22')](handleEntityNotFound(_0x378777,null))['then'](saveUpdates(_0x3585f1[_0x5cc0('0x60')],null))[_0x5cc0('0x22')](respondWithResult(_0x378777,null))[_0x5cc0('0x2c')](handleError(_0x378777,null));};exports['destroy']=function(_0x239a14,_0x49709f){return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x239a14['params']['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x49709f,null))[_0x5cc0('0x22')](removeEntity(_0x49709f,null))[_0x5cc0('0x2c')](handleError(_0x49709f,null));};exports['describe']=function(_0x36b4f9,_0x822863){return db[_0x5cc0('0x57')][_0x5cc0('0x64')]()['then'](respondWithResult(_0x822863,null))[_0x5cc0('0x2c')](handleError(_0x822863,null));};exports[_0x5cc0('0x65')]=function(_0x346211,_0x42c4d7,_0x39a458){if(_0x346211[_0x5cc0('0x60')]['id']){delete _0x346211['body']['id'];}return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x346211['params']['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x42c4d7,null))[_0x5cc0('0x22')](function(_0x1f9c9e){if(_0x1f9c9e){_0x346211['body'][_0x5cc0('0x66')]=_0x1f9c9e['id'];return db['Disposition']['create'](_0x346211['body']);}})['then'](respondWithResult(_0x42c4d7,null))[_0x5cc0('0x2c')](handleError(_0x42c4d7,null));};exports[_0x5cc0('0x67')]=function(_0x20e190,_0x5475d8,_0x1015a1){var _0x18c3e6={'raw':![],'where':{}};var _0x3bc918={};var _0x42673b={'count':0x0,'rows':[]};return db[_0x5cc0('0x57')][_0x5cc0('0x68')]({'where':{'id':_0x20e190['params']['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x5475d8,null))[_0x5cc0('0x22')](function(_0x3183d6){if(_0x3183d6){_0x3bc918[_0x5cc0('0x46')]=_[_0x5cc0('0x48')](db[_0x5cc0('0x69')]['rawAttributes']);_0x3bc918[_0x5cc0('0x47')]=_[_0x5cc0('0x48')](_0x20e190[_0x5cc0('0x47')]);_0x3bc918[_0x5cc0('0x49')]=_[_0x5cc0('0x4a')](_0x3bc918[_0x5cc0('0x46')],_0x3bc918[_0x5cc0('0x47')]);_0x18c3e6[_0x5cc0('0x4b')]=_[_0x5cc0('0x4a')](_0x3bc918[_0x5cc0('0x46')],qs[_0x5cc0('0x4c')](_0x20e190[_0x5cc0('0x47')]['fields']));_0x18c3e6[_0x5cc0('0x4b')]=_0x18c3e6[_0x5cc0('0x4b')]['length']?_0x18c3e6[_0x5cc0('0x4b')]:_0x3bc918[_0x5cc0('0x46')];if(!_0x20e190[_0x5cc0('0x47')]['hasOwnProperty']('nolimit')){_0x18c3e6[_0x5cc0('0x31')]=qs[_0x5cc0('0x31')](_0x20e190['query'][_0x5cc0('0x31')]);_0x18c3e6[_0x5cc0('0x2f')]=qs[_0x5cc0('0x2f')](_0x20e190[_0x5cc0('0x47')][_0x5cc0('0x2f')]);}_0x18c3e6[_0x5cc0('0x50')]=qs[_0x5cc0('0x51')](_0x20e190[_0x5cc0('0x47')][_0x5cc0('0x51')]);_0x18c3e6['where']=qs[_0x5cc0('0x49')](_[_0x5cc0('0x52')](_0x20e190[_0x5cc0('0x47')],_0x3bc918['filters']));_0x18c3e6[_0x5cc0('0x54')][_0x5cc0('0x66')]=_0x3183d6['id'];if(_0x20e190[_0x5cc0('0x47')][_0x5cc0('0x53')]){_0x18c3e6[_0x5cc0('0x54')]=_['merge'](_0x18c3e6[_0x5cc0('0x54')],{'$or':_[_0x5cc0('0x43')](_0x18c3e6[_0x5cc0('0x4b')],function(_0x537b6a){var _0x18a35c={};_0x18a35c[_0x537b6a]={'$like':'%'+_0x20e190[_0x5cc0('0x47')]['filter']+'%'};return _0x18a35c;})});}_0x18c3e6=_[_0x5cc0('0x56')]({},_0x18c3e6,_0x20e190[_0x5cc0('0x5d')]);return db['Disposition'][_0x5cc0('0x32')]({'where':_0x18c3e6[_0x5cc0('0x54')]})['then'](function(_0x246360){_0x42673b['count']=_0x246360;if(_0x20e190[_0x5cc0('0x47')][_0x5cc0('0x58')]){_0x18c3e6[_0x5cc0('0x59')]=[{'all':!![]}];}return db[_0x5cc0('0x69')]['findAll'](_0x18c3e6);})[_0x5cc0('0x22')](function(_0xa72782){_0x42673b[_0x5cc0('0x5a')]=_0xa72782;return _0x42673b;});}})[_0x5cc0('0x22')](respondWithFilteredResult(_0x5475d8,_0x18c3e6))[_0x5cc0('0x2c')](handleError(_0x5475d8,null));};exports[_0x5cc0('0x6a')]=function(_0x34912a,_0x36619a,_0x1bd080){return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x34912a[_0x5cc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x36619a,null))[_0x5cc0('0x22')](function(_0x5ee2bd){if(_0x5ee2bd){return _0x5ee2bd[_0x5cc0('0x6a')](_0x34912a[_0x5cc0('0x47')]['ids']);}})[_0x5cc0('0x22')](respondWithStatusCode(_0x36619a,null))[_0x5cc0('0x2c')](handleError(_0x36619a,null));};exports[_0x5cc0('0x6b')]=function(_0x5894b6,_0x34a37e,_0x5cbe6c){if(_0x5894b6[_0x5cc0('0x60')]['id']){delete _0x5894b6[_0x5cc0('0x60')]['id'];}return db['OpenchannelAccount'][_0x5cc0('0x5e')]({'where':{'id':_0x5894b6[_0x5cc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34a37e,null))[_0x5cc0('0x22')](function(_0x1edb58){if(_0x1edb58){_0x5894b6[_0x5cc0('0x60')][_0x5cc0('0x66')]=_0x1edb58['id'];return db[_0x5cc0('0x6c')][_0x5cc0('0x5f')](_0x5894b6[_0x5cc0('0x60')]);}})['then'](respondWithResult(_0x34a37e,null))[_0x5cc0('0x2c')](handleError(_0x34a37e,null));};exports[_0x5cc0('0x6d')]=function(_0x32b554,_0x109998,_0x4a30c5){var _0x42ffec={'raw':![],'where':{}};var _0x396eff={};var _0x1c0688={'count':0x0,'rows':[]};return db[_0x5cc0('0x57')][_0x5cc0('0x68')]({'where':{'id':_0x32b554[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x109998,null))[_0x5cc0('0x22')](function(_0x4bda0d){if(_0x4bda0d){_0x396eff['model']=_[_0x5cc0('0x48')](db['CannedAnswer'][_0x5cc0('0x6e')]);_0x396eff[_0x5cc0('0x47')]=_['keys'](_0x32b554['query']);_0x396eff[_0x5cc0('0x49')]=_[_0x5cc0('0x4a')](_0x396eff['model'],_0x396eff[_0x5cc0('0x47')]);_0x42ffec[_0x5cc0('0x4b')]=_[_0x5cc0('0x4a')](_0x396eff[_0x5cc0('0x46')],qs['fields'](_0x32b554[_0x5cc0('0x47')][_0x5cc0('0x4c')]));_0x42ffec[_0x5cc0('0x4b')]=_0x42ffec[_0x5cc0('0x4b')]['length']?_0x42ffec['attributes']:_0x396eff[_0x5cc0('0x46')];if(!_0x32b554[_0x5cc0('0x47')]['hasOwnProperty']('nolimit')){_0x42ffec[_0x5cc0('0x31')]=qs[_0x5cc0('0x31')](_0x32b554['query'][_0x5cc0('0x31')]);_0x42ffec['offset']=qs[_0x5cc0('0x2f')](_0x32b554[_0x5cc0('0x47')][_0x5cc0('0x2f')]);}_0x42ffec[_0x5cc0('0x50')]=qs[_0x5cc0('0x51')](_0x32b554[_0x5cc0('0x47')][_0x5cc0('0x51')]);_0x42ffec[_0x5cc0('0x54')]=qs[_0x5cc0('0x49')](_['pick'](_0x32b554[_0x5cc0('0x47')],_0x396eff[_0x5cc0('0x49')]));_0x42ffec['where'][_0x5cc0('0x66')]=_0x4bda0d['id'];if(_0x32b554[_0x5cc0('0x47')]['filter']){_0x42ffec['where']=_[_0x5cc0('0x56')](_0x42ffec[_0x5cc0('0x54')],{'$or':_['map'](_0x42ffec[_0x5cc0('0x4b')],function(_0x5700cf){var _0x5a57ae={};_0x5a57ae[_0x5700cf]={'$like':'%'+_0x32b554[_0x5cc0('0x47')][_0x5cc0('0x53')]+'%'};return _0x5a57ae;})});}_0x42ffec=_[_0x5cc0('0x56')]({},_0x42ffec,_0x32b554[_0x5cc0('0x5d')]);return db[_0x5cc0('0x6c')][_0x5cc0('0x32')]({'where':_0x42ffec[_0x5cc0('0x54')]})['then'](function(_0x1ea95e){_0x1c0688[_0x5cc0('0x32')]=_0x1ea95e;if(_0x32b554[_0x5cc0('0x47')][_0x5cc0('0x58')]){_0x42ffec[_0x5cc0('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x42ffec);})[_0x5cc0('0x22')](function(_0x29adf6){_0x1c0688[_0x5cc0('0x5a')]=_0x29adf6;return _0x1c0688;});}})[_0x5cc0('0x22')](respondWithFilteredResult(_0x109998,_0x42ffec))[_0x5cc0('0x2c')](handleError(_0x109998,null));};exports[_0x5cc0('0x6f')]=function(_0x181b6e,_0x4807ba,_0xe2f6a5){return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x181b6e[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x4807ba,null))[_0x5cc0('0x22')](function(_0x2a9fce){if(_0x2a9fce){return _0x2a9fce['removeAnswers'](_0x181b6e['query'][_0x5cc0('0x70')]);}})['then'](respondWithStatusCode(_0x4807ba,null))['catch'](handleError(_0x4807ba,null));};exports[_0x5cc0('0x71')]=function(_0xa78f36,_0x3b258d,_0x3f1a9f){var _0x5922f7={'body':_0xa78f36[_0x5cc0('0x60')],'channel':'openchannel'};var _0x286266=[];var _0x7f2e69=[];var _0xb15f99={};var _0x3a8a1a=![];return db[_0x5cc0('0x72')]['describe']()[_0x5cc0('0x22')](function(_0x458269){if(!_0x458269){throw new db[(_0x5cc0('0x73'))][(_0x5cc0('0x74'))]('no\x20available\x20attributes');}_0x286266=_[_0x5cc0('0x75')](_[_0x5cc0('0x48')](_0x458269),[_0x5cc0('0x76'),_0x5cc0('0x77')]);_0x7f2e69=_[_0x5cc0('0x75')](_[_0x5cc0('0x48')](_0x458269),[_0x5cc0('0x76'),_0x5cc0('0x77'),_0x5cc0('0x78'),_0x5cc0('0x79')]);if(_0xa78f36[_0x5cc0('0x60')]['id']){delete _0xa78f36[_0x5cc0('0x60')]['id'];}if(_[_0x5cc0('0x7a')](_0xa78f36[_0x5cc0('0x60')]['from'])){throw new db[(_0x5cc0('0x73'))][(_0x5cc0('0x74'))]('from\x20is\x20mandatory');}if(_[_0x5cc0('0x7a')](_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x60')])||_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x60')]===''){throw new db[(_0x5cc0('0x73'))][(_0x5cc0('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5cc0('0x7a')](_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x7b')])){throw new db[(_0x5cc0('0x73'))][(_0x5cc0('0x74'))](_0x5cc0('0x7c')+_0x7f2e69);}if(!_[_0x5cc0('0x7d')](_0x7f2e69,_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x7b')])){throw new db['Sequelize'][(_0x5cc0('0x74'))](_0x5cc0('0x7e')+_0x7f2e69);}_0xb15f99[_0xa78f36[_0x5cc0('0x60')]['mapKey']]=_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x7f')];})[_0x5cc0('0x22')](function(){return db[_0x5cc0('0x57')]['find']({'where':{'id':_0xa78f36[_0x5cc0('0x5c')]['id']},'include':[{'model':db[_0x5cc0('0x80')],'as':_0x5cc0('0x81'),'include':[{'model':db[_0x5cc0('0x72')],'as':_0x5cc0('0x82'),'where':_0xb15f99,'limit':0x1,'order':[[_0x5cc0('0x77'),_0x5cc0('0x83')]]}]},{'model':db[_0x5cc0('0x84')],'as':_0x5cc0('0x85')}]});})[_0x5cc0('0x22')](handleEntityNotFound(_0x3b258d,null))['then'](function(_0x538022){if(_0x538022&&_0x538022[_0x5cc0('0x81')]){_0x5922f7[_0x5cc0('0x86')]=_0x538022;_0x5922f7[_0x5cc0('0x87')]=_0x538022[_0x5cc0('0x85')];_0x5922f7[_0x5cc0('0x88')]=_0x538022[_0x5cc0('0x81')];_0x5922f7[_0x5cc0('0x87')]=_['orderBy'](_0x5922f7[_0x5cc0('0x87')],[_0x5cc0('0x89')],['asc']);if(_0x5922f7[_0x5cc0('0x86')][_0x5cc0('0x85')]){delete _0x5922f7[_0x5cc0('0x86')][_0x5cc0('0x85')];}if(_0x5922f7[_0x5cc0('0x86')]['List']&&_0x5922f7['account'][_0x5cc0('0x81')]['Contacts'][_0x5cc0('0x4d')]){return _0x5922f7[_0x5cc0('0x86')][_0x5cc0('0x81')][_0x5cc0('0x82')][0x0];}var _0x2a5c14=_['defaults'](_0xa78f36[_0x5cc0('0x60')],{'firstName':_0xa78f36[_0x5cc0('0x60')]['from'],'ListId':_0x538022['ListId']});_0x2a5c14[_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x7b')]]=_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x7f')];return db['CmContact'][_0x5cc0('0x5f')](_0x2a5c14,{'fields':_0x286266,'raw':!![]});}})[_0x5cc0('0x22')](handleEntityNotFound(_0x3b258d,null))['then'](function(_0x2a9645){_0x5922f7[_0x5cc0('0x8a')]=_0x2a9645;if(_0x2a9645){var _0x2e5a3d={'ContactId':_0x2a9645['id'],'OpenchannelAccountId':_0xa78f36[_0x5cc0('0x5c')]['id'],'from':(_0x2a9645[_0x5cc0('0x8b')]||'')+'\x20'+(_0x2a9645[_0x5cc0('0x8c')]||'')};var _0x24d7e8={'OpenchannelAccountId':_0xa78f36[_0x5cc0('0x5c')]['id'],'closed':![]};if(_0xa78f36['body']['threadId']){_0x24d7e8[_0x5cc0('0x8d')]=_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x8d')];return db[_0x5cc0('0x8e')][_0x5cc0('0x5e')]({'where':_0x24d7e8})[_0x5cc0('0x22')](function(_0x53d5e6){if(_0x53d5e6){return[_0x53d5e6,![]];}_0x2e5a3d[_0x5cc0('0x8d')]=_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x8d')];_0x2e5a3d['externalUrl']=_0xa78f36['body'][_0x5cc0('0x8f')];return db['OpenchannelInteraction']['create'](_0x2e5a3d)[_0x5cc0('0x22')](function(_0x100c65){return[_0x100c65,!![]];});});}else{_0x24d7e8['threadId']=null;}_0x24d7e8[_0x5cc0('0x90')]=_0x2a9645['id'];return db[_0x5cc0('0x8e')]['find']({'where':_0x24d7e8})['then'](function(_0x2057cf){if(_0x2057cf){return[_0x2057cf,![]];}return db[_0x5cc0('0x8e')][_0x5cc0('0x5f')](_0x2e5a3d)['then'](function(_0x372f77){return[_0x372f77,!![]];});});}})['spread'](function(_0x180642,_0x8041b2){if(_0x180642){_0x3a8a1a=_0x8041b2;if(!_0x8041b2){var _0x2971b7={'from':(_0x5922f7['contact'][_0x5cc0('0x8b')]||'')+'\x20'+(_0x5922f7[_0x5cc0('0x8a')][_0x5cc0('0x8c')]||'')};if(_0xa78f36['body']['threadId']&&_0xa78f36['body'][_0x5cc0('0x91')]&&_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x8d')]!=_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x91')]){_0x2971b7['threadId']=_0xa78f36['body']['messageId'];}return _0x180642[_0x5cc0('0x36')](_0x2971b7);}else{return _0x180642;}}})[_0x5cc0('0x22')](function(_0xfc29e){_0x5922f7[_0x5cc0('0x92')]=_0xfc29e[_0x5cc0('0x38')]({'plain':!![]});_0x5922f7[_0x5cc0('0x92')][_0x5cc0('0x93')]=_0x3a8a1a;if(_0x5922f7[_0x5cc0('0x92')][_0x5cc0('0x93')]){if(_0x5922f7[_0x5cc0('0x86')][_0x5cc0('0x94')]){_0x5922f7[_0x5cc0('0x87')][_0x5cc0('0x95')]({'id':0x0,'priority':_0x5922f7[_0x5cc0('0x87')][_0x5cc0('0x4d')]+0x1,'app':_0x5cc0('0x96'),'appdata':'unmanaged','interval':_0x5cc0('0x97')});}}return db['OpenchannelMessage']['create']({'body':_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x60')],'OpenchannelAccountId':_0xa78f36['params']['id'],'OpenchannelInteractionId':_0xfc29e['id'],'direction':'in','ContactId':_0x5922f7['contact']['id'],'AttachmentId':_0xa78f36[_0x5cc0('0x60')][_0x5cc0('0x98')]});})[_0x5cc0('0x22')](function(_0x13671a){_0x5922f7['message']=_0x13671a;if(!_0x5922f7[_0x5cc0('0x92')][_0x5cc0('0x99')])return;return db[_0x5cc0('0x9a')][_0x5cc0('0x5e')]({'attributes':['id',_0x5cc0('0x3e')],'where':{'id':_0x5922f7['interaction']['UserId']}});})[_0x5cc0('0x22')](function(_0x2009fe){if(_0x2009fe){_0x5922f7[_0x5cc0('0x87')][_0x5cc0('0x9b')]({'id':0x0,'priority':0x0,'app':_0x5cc0('0x9c'),'appdata':_0x2009fe['name']+','+(_0x5922f7[_0x5cc0('0x86')][_0x5cc0('0x9d')]||0xa),'interval':_0x5cc0('0x97')});}if(!_0x5922f7[_0x5cc0('0x92')][_0x5cc0('0x9e')])return;return db[_0x5cc0('0x9f')][_0x5cc0('0x5e')]({'attributes':['id',_0x5cc0('0x3e')],'where':{'id':_0x5922f7['interaction']['queueId']}});})[_0x5cc0('0x22')](function(_0x1bbdfe){if(_0x1bbdfe){_0x5922f7[_0x5cc0('0x87')][_0x5cc0('0x9b')]({'id':0x0,'priority':0x1,'app':_0x5cc0('0xa0'),'appdata':_0x1bbdfe['name']+','+(_0x5922f7[_0x5cc0('0x86')][_0x5cc0('0xa1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5cc0('0xa2'),_0x5cc0('0xa3'),_0x5922f7);})[_0x5cc0('0x22')](function(_0x4b2731){respondWithRpcPromise(_0x5cc0('0xa4'),_0x5cc0('0xa4'),{'event':_0x5cc0('0x71'),'message':_0x4b2731},client9002);return _0x4b2731;})['then'](respondWithResult(_0x3b258d,null))[_0x5cc0('0x2c')](handleError(_0x3b258d,null));};exports[_0x5cc0('0xa5')]=function(_0x45d729,_0x2e12da){var _0x1410e4=_0x45d729[_0x5cc0('0x5c')]['id'];var _0x4f6417=_0x45d729[_0x5cc0('0x60')];var _0x4dc012=0xc8;var _0x1e87d1=null;return db['sequelize'][_0x5cc0('0xa6')]({'isolationLevel':db['sequelize']['Transaction'][_0x5cc0('0xa7')][_0x5cc0('0xa8')]},function(_0x23544a){return db[_0x5cc0('0x57')][_0x5cc0('0x68')]({'where':{'id':_0x1410e4},'transaction':_0x23544a})['then'](function(_0x58637e){if(_0x58637e){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1410e4},'transaction':_0x23544a})[_0x5cc0('0x22')](function(){var _0x6dc971=_[_0x5cc0('0x43')](_0x4f6417,function(_0x1436b9){_0x1436b9['OpenchannelAccountId']=_0x1410e4;return _0x1436b9;});return db[_0x5cc0('0x84')][_0x5cc0('0xa9')](_0x6dc971,{'transaction':_0x23544a});});}else{_0x4dc012=0x194;_0x1e87d1=[];}});})[_0x5cc0('0x22')](function(){if(_0x4dc012!==0x194){return db[_0x5cc0('0x84')][_0x5cc0('0xaa')]({'where':{'OpenchannelAccountId':_0x1410e4},'order':_0x5cc0('0x89')})['then'](function(_0x541480){_0x1e87d1=_0x541480;});}})[_0x5cc0('0x2c')](function(_0x4b262e){_0x4dc012=0x1f4;logger[_0x5cc0('0x26')](_0x4b262e[_0x5cc0('0x3d')]);if(_0x4b262e[_0x5cc0('0x3e')]){delete _0x4b262e[_0x5cc0('0x3e')];}_0x1e87d1=_0x4b262e;})['finally'](function(){if(_0x1e87d1===null){_0x2e12da[_0x5cc0('0x3c')](_0x4dc012);}else{if(_0x4dc012===0x1f4){_0x2e12da[_0x5cc0('0x2d')](_0x4dc012)[_0x5cc0('0x3f')](_0x1e87d1);}else{_0x2e12da[_0x5cc0('0x2d')](_0x4dc012)[_0x5cc0('0x2e')](_0x1e87d1);}}});};exports['getApplications']=function(_0x3fb73c,_0x4cadce,_0x1ba593){var _0xae714e={};var _0x36c548={};var _0x256e9f;var _0x406c16;return db[_0x5cc0('0x57')][_0x5cc0('0x68')]({'where':{'id':_0x3fb73c[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x4cadce,null))[_0x5cc0('0x22')](function(_0x51f224){if(_0x51f224){_0x256e9f=_0x51f224;_0x36c548[_0x5cc0('0x46')]=_['keys'](db[_0x5cc0('0x84')][_0x5cc0('0x6e')]);_0x36c548[_0x5cc0('0x47')]=_[_0x5cc0('0x48')](_0x3fb73c['query']);_0x36c548[_0x5cc0('0x49')]=_['intersection'](_0x36c548[_0x5cc0('0x46')],_0x36c548['query']);_0xae714e[_0x5cc0('0x4b')]=_[_0x5cc0('0x4a')](_0x36c548[_0x5cc0('0x46')],qs[_0x5cc0('0x4c')](_0x3fb73c['query'][_0x5cc0('0x4c')]));_0xae714e[_0x5cc0('0x4b')]=_0xae714e[_0x5cc0('0x4b')][_0x5cc0('0x4d')]?_0xae714e['attributes']:_0x36c548[_0x5cc0('0x46')];_0xae714e[_0x5cc0('0x50')]=qs['sort'](_0x3fb73c['query'][_0x5cc0('0x51')]);_0xae714e[_0x5cc0('0x54')]=qs[_0x5cc0('0x49')](_['pick'](_0x3fb73c[_0x5cc0('0x47')],_0x36c548[_0x5cc0('0x49')]));if(_0x3fb73c['query']['filter']){_0xae714e['where']=_[_0x5cc0('0x56')](_0xae714e['where'],{'$or':_[_0x5cc0('0x43')](_0xae714e[_0x5cc0('0x4b')],function(_0x5e0a4d){var _0x3efe97={};_0x3efe97[_0x5e0a4d]={'$like':'%'+_0x3fb73c['query'][_0x5cc0('0x53')]+'%'};return _0x3efe97;})});}_0xae714e=_[_0x5cc0('0x56')]({},_0xae714e,_0x3fb73c['options']);return _0x256e9f[_0x5cc0('0xab')](_0xae714e);}})[_0x5cc0('0x22')](function(_0x4f30f6){if(_0x4f30f6){_0x406c16=_0x4f30f6[_0x5cc0('0x4d')];if(!_0x3fb73c[_0x5cc0('0x47')]['hasOwnProperty'](_0x5cc0('0x4f'))){_0xae714e['limit']=qs['limit'](_0x3fb73c['query']['limit']);_0xae714e[_0x5cc0('0x2f')]=qs[_0x5cc0('0x2f')](_0x3fb73c[_0x5cc0('0x47')][_0x5cc0('0x2f')]);}return _0x256e9f[_0x5cc0('0xab')](_0xae714e);}})[_0x5cc0('0x22')](function(_0x3b8856){if(_0x3b8856){return _0x3b8856?{'count':_0x406c16,'rows':_0x3b8856}:null;}})[_0x5cc0('0x22')](respondWithResult(_0x4cadce,null))[_0x5cc0('0x2c')](handleError(_0x4cadce,null));};exports[_0x5cc0('0xac')]=function(_0x202bc3,_0x964342,_0x2233f8){var _0x43fe4b={'raw':![],'where':{}};var _0x197980={};var _0x32ebac={'count':0x0,'rows':[]};return db[_0x5cc0('0x57')]['findOne']({'where':{'id':_0x202bc3[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x964342,null))[_0x5cc0('0x22')](function(_0x564f5b){if(_0x564f5b){_0x197980[_0x5cc0('0x46')]=_[_0x5cc0('0x48')](db[_0x5cc0('0x8e')][_0x5cc0('0x6e')]);_0x197980[_0x5cc0('0x47')]=_['keys'](_0x202bc3['query']);_0x197980[_0x5cc0('0x49')]=_[_0x5cc0('0x4a')](_0x197980[_0x5cc0('0x46')],_0x197980[_0x5cc0('0x47')]);_0x43fe4b[_0x5cc0('0x4b')]=_[_0x5cc0('0x4a')](_0x197980[_0x5cc0('0x46')],qs[_0x5cc0('0x4c')](_0x202bc3[_0x5cc0('0x47')][_0x5cc0('0x4c')]));_0x43fe4b['attributes']=_0x43fe4b[_0x5cc0('0x4b')]['length']?_0x43fe4b['attributes']:_0x197980[_0x5cc0('0x46')];if(!_0x202bc3[_0x5cc0('0x47')]['hasOwnProperty'](_0x5cc0('0x4f'))){_0x43fe4b[_0x5cc0('0x31')]=qs[_0x5cc0('0x31')](_0x202bc3[_0x5cc0('0x47')][_0x5cc0('0x31')]);_0x43fe4b[_0x5cc0('0x2f')]=qs[_0x5cc0('0x2f')](_0x202bc3[_0x5cc0('0x47')]['offset']);}_0x43fe4b[_0x5cc0('0x50')]=qs['sort'](_0x202bc3[_0x5cc0('0x47')][_0x5cc0('0x51')]);_0x43fe4b[_0x5cc0('0x54')]=qs[_0x5cc0('0x49')](_[_0x5cc0('0x52')](_0x202bc3[_0x5cc0('0x47')],_0x197980['filters']));_0x43fe4b[_0x5cc0('0x54')][_0x5cc0('0x66')]=_0x564f5b['id'];if(_0x202bc3[_0x5cc0('0x47')]['filter']){_0x43fe4b['where']=_[_0x5cc0('0x56')](_0x43fe4b['where'],{'$or':_['map'](_0x43fe4b[_0x5cc0('0x4b')],function(_0x509b1e){var _0xc2e0e4={};_0xc2e0e4[_0x509b1e]={'$like':'%'+_0x202bc3[_0x5cc0('0x47')][_0x5cc0('0x53')]+'%'};return _0xc2e0e4;})});}_0x43fe4b=_[_0x5cc0('0x56')]({},_0x43fe4b,_0x202bc3['options']);return db['OpenchannelInteraction']['count']({'where':_0x43fe4b[_0x5cc0('0x54')]})['then'](function(_0x3031ee){_0x32ebac[_0x5cc0('0x32')]=_0x3031ee;if(_0x202bc3[_0x5cc0('0x47')]['includeAll']){_0x43fe4b[_0x5cc0('0x59')]=[{'model':db[_0x5cc0('0x72')],'as':_0x5cc0('0xad'),'required':![]},{'model':db[_0x5cc0('0x9a')],'as':_0x5cc0('0xae'),'attributes':[_0x5cc0('0x3e'),_0x5cc0('0xaf'),_0x5cc0('0xb0')],'required':![]},{'model':db[_0x5cc0('0xb1')],'as':_0x5cc0('0xb2'),'attributes':['id',_0x5cc0('0x3e'),_0x5cc0('0xb3')],'where':_0x202bc3[_0x5cc0('0x47')]['tag']?{'id':_0x202bc3['query'][_0x5cc0('0xb4')]}:undefined,'required':_0x202bc3[_0x5cc0('0x47')][_0x5cc0('0xb4')]?!![]:![]}];}return db[_0x5cc0('0x8e')][_0x5cc0('0xb5')](_0x43fe4b);})[_0x5cc0('0x22')](function(_0x592c38){_0x32ebac[_0x5cc0('0x5a')]=_0x592c38;return _0x32ebac;});}})[_0x5cc0('0x22')](respondWithFilteredResult(_0x964342,_0x43fe4b))[_0x5cc0('0x2c')](handleError(_0x964342,null));};exports['addAgents']=function(_0x50dbc7,_0x5b86df,_0x8653bc){return db[_0x5cc0('0x57')][_0x5cc0('0x5e')]({'where':{'id':_0x50dbc7[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x5b86df,null))[_0x5cc0('0x22')](function(_0x207f9b){if(_0x207f9b){return _0x207f9b[_0x5cc0('0xb6')](_0x50dbc7[_0x5cc0('0x60')][_0x5cc0('0x70')],_[_0x5cc0('0xb7')](_0x50dbc7[_0x5cc0('0x60')],[_0x5cc0('0x70'),'id'])||{})['spread'](function(_0x565799){for(var _0x279c2f=0x0;_0x279c2f<_0x50dbc7[_0x5cc0('0x60')][_0x5cc0('0x70')][_0x5cc0('0x4d')];_0x279c2f+=0x1){socket[_0x5cc0('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x50dbc7['body'][_0x5cc0('0x70')][_0x279c2f]),'OpenchannelAccountId':Number(_0x50dbc7[_0x5cc0('0x5c')]['id'])});}return _0x565799;});}})[_0x5cc0('0x22')](respondWithResult(_0x5b86df,null))[_0x5cc0('0x2c')](handleError(_0x5b86df,null));};exports[_0x5cc0('0xb9')]=function(_0x3a65b5,_0x11f483,_0x555a32){return db['OpenchannelAccount']['find']({'where':{'id':_0x3a65b5[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x11f483,null))[_0x5cc0('0x22')](function(_0x585120){if(_0x585120){return _0x585120[_0x5cc0('0xb9')](_0x3a65b5['query'][_0x5cc0('0x70')])[_0x5cc0('0x22')](function(){if(_[_0x5cc0('0xba')](_0x3a65b5[_0x5cc0('0x47')][_0x5cc0('0x70')])){for(var _0x5ea25f=0x0;_0x5ea25f<_0x3a65b5[_0x5cc0('0x47')][_0x5cc0('0x70')][_0x5cc0('0x4d')];_0x5ea25f+=0x1){socket['emit'](_0x5cc0('0xbb'),{'UserId':Number(_0x3a65b5[_0x5cc0('0x47')]['ids'][_0x5ea25f]),'OpenchannelAccountId':Number(_0x3a65b5[_0x5cc0('0x5c')]['id'])});}}else{socket[_0x5cc0('0xb8')](_0x5cc0('0xbb'),{'UserId':Number(_0x3a65b5[_0x5cc0('0x47')][_0x5cc0('0x70')]),'OpenchannelAccountId':Number(_0x3a65b5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x11f483,null))[_0x5cc0('0x2c')](handleError(_0x11f483,null));};exports['getAgents']=function(_0x5bf8c1,_0x59cd50,_0x56016d){var _0x11910d={};var _0x154e6c={};var _0x83159;var _0x15b71a;return db['OpenchannelAccount'][_0x5cc0('0x68')]({'where':{'id':_0x5bf8c1[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x59cd50,null))[_0x5cc0('0x22')](function(_0x90a414){if(_0x90a414){_0x83159=_0x90a414;_0x154e6c[_0x5cc0('0x46')]=_[_0x5cc0('0x48')](db['User'][_0x5cc0('0x6e')]);_0x154e6c[_0x5cc0('0x47')]=_[_0x5cc0('0x48')](_0x5bf8c1[_0x5cc0('0x47')]);_0x154e6c['filters']=_[_0x5cc0('0x4a')](_0x154e6c[_0x5cc0('0x46')],_0x154e6c[_0x5cc0('0x47')]);_0x11910d['attributes']=_[_0x5cc0('0x4a')](_0x154e6c[_0x5cc0('0x46')],qs[_0x5cc0('0x4c')](_0x5bf8c1[_0x5cc0('0x47')][_0x5cc0('0x4c')]));_0x11910d[_0x5cc0('0x4b')]=_0x11910d[_0x5cc0('0x4b')][_0x5cc0('0x4d')]?_0x11910d[_0x5cc0('0x4b')]:_0x154e6c[_0x5cc0('0x46')];_0x11910d['order']=qs[_0x5cc0('0x51')](_0x5bf8c1['query']['sort']);_0x11910d['where']=qs[_0x5cc0('0x49')](_[_0x5cc0('0x52')](_0x5bf8c1[_0x5cc0('0x47')],_0x154e6c[_0x5cc0('0x49')]));if(_0x5bf8c1[_0x5cc0('0x47')][_0x5cc0('0x53')]){_0x11910d['where']=_[_0x5cc0('0x56')](_0x11910d['where'],{'$or':_['map'](_0x11910d['attributes'],function(_0x32cd6f){var _0x866bb4={};_0x866bb4[_0x32cd6f]={'$like':'%'+_0x5bf8c1[_0x5cc0('0x47')][_0x5cc0('0x53')]+'%'};return _0x866bb4;})});}_0x11910d=_['merge']({},_0x11910d,_0x5bf8c1[_0x5cc0('0x5d')]);return _0x83159[_0x5cc0('0xbc')](_0x11910d);}})[_0x5cc0('0x22')](function(_0x32ab43){if(_0x32ab43){_0x15b71a=_0x32ab43[_0x5cc0('0x4d')];if(!_0x5bf8c1['query']['hasOwnProperty'](_0x5cc0('0x4f'))){_0x11910d[_0x5cc0('0x31')]=qs[_0x5cc0('0x31')](_0x5bf8c1[_0x5cc0('0x47')][_0x5cc0('0x31')]);_0x11910d[_0x5cc0('0x2f')]=qs[_0x5cc0('0x2f')](_0x5bf8c1[_0x5cc0('0x47')][_0x5cc0('0x2f')]);}return _0x83159[_0x5cc0('0xbc')](_0x11910d);}})[_0x5cc0('0x22')](function(_0x54e3df){if(_0x54e3df){return _0x54e3df?{'count':_0x15b71a,'rows':_0x54e3df}:null;}})[_0x5cc0('0x22')](respondWithResult(_0x59cd50,null))[_0x5cc0('0x2c')](handleError(_0x59cd50,null));};exports['send']=function(_0xb3fa49,_0x77aaf0,_0x5730cd){var _0x459315,_0xc5d9f,_0x24e903;if(_[_0x5cc0('0x7a')](_0xb3fa49[_0x5cc0('0x60')][_0x5cc0('0x60')])||_0xb3fa49[_0x5cc0('0x60')][_0x5cc0('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x5cc0('0xbd'));}if(_[_0x5cc0('0x7a')](_0xb3fa49[_0x5cc0('0x60')]['to'])){}_0x459315=_0xb3fa49[_0x5cc0('0x60')]['to'];return db[_0x5cc0('0x57')][_0x5cc0('0x68')]({'where':{'id':_0xb3fa49[_0x5cc0('0x5c')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x77aaf0,null))[_0x5cc0('0x22')](function(_0x484bcd){if(_0x484bcd){return db[_0x5cc0('0x57')]['find']({'where':{'id':_0x484bcd['id']},'include':[{'model':db[_0x5cc0('0x80')],'as':_0x5cc0('0x81'),'include':[{'model':db[_0x5cc0('0x72')],'as':_0x5cc0('0x82'),'where':{[_0x484bcd[_0x5cc0('0x7b')]]:_0x459315},'limit':0x1,'order':[[_0x5cc0('0x77'),_0x5cc0('0x83')]]}]}]})[_0x5cc0('0x22')](handleEntityNotFound(_0x77aaf0,null))[_0x5cc0('0x22')](function(_0x2af00d){if(_0x2af00d&&_0x2af00d['List']){_0xc5d9f=_0x2af00d[_0x5cc0('0x38')]({'plain':!![]});if(_0xc5d9f[_0x5cc0('0x81')]&&_0xc5d9f[_0x5cc0('0x81')][_0x5cc0('0x82')]['length']){return _0xc5d9f['List']['Contacts'][0x0];}return db[_0x5cc0('0x72')][_0x5cc0('0x5f')](_[_0x5cc0('0x19')](_0xb3fa49[_0x5cc0('0x60')],{'firstName':_0x459315,[_0x2af00d['mapKey']]:_0x459315,'phone':_0x459315,'ListId':_0xc5d9f[_0x5cc0('0x79')]}));}})['then'](handleEntityNotFound(_0x77aaf0,null))[_0x5cc0('0x22')](function(_0xb38c7d){if(_0xb38c7d){_0x24e903=_0xb38c7d;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x24e903['id'],'closed':![],'OpenchannelAccountId':_0xc5d9f['id']}})[_0x5cc0('0x22')](function(_0x3f99fe){if(_0x3f99fe){return[_0x3f99fe,![]];}return db['OpenchannelInteraction'][_0x5cc0('0x5f')]({'UserId':_0xb3fa49[_0x5cc0('0x61')]['id'],'ContactId':_0x24e903['id'],'OpenchannelAccountId':_0xc5d9f['id'],'lastMsgDirection':'out','firstMsgDirection':_0x5cc0('0xbe'),'Messages':[_[_0x5cc0('0x56')](_0xb3fa49['body'],{'read':![],'body':_0xb3fa49[_0x5cc0('0x60')]['body'],'OpenchannelAccountId':_0xc5d9f['id'],'UserId':_0xb3fa49['user']['id'],'ContactId':_0x24e903['id']})]},{'include':[{'model':db[_0x5cc0('0xbf')],'as':_0x5cc0('0xc0')}]})['then'](function(_0x7c9ab7){return[_0x7c9ab7,!![]];});});}})['spread'](function(_0x49d1fe,_0x26a5d0){if(_0x26a5d0){return _0x49d1fe;}return db[_0x5cc0('0xbf')][_0x5cc0('0x5f')](_[_0x5cc0('0x56')](_0xb3fa49[_0x5cc0('0x60')],{'read':![],'body':_0xb3fa49[_0x5cc0('0x60')][_0x5cc0('0x60')],'OpenchannelAccountId':_0xc5d9f['id'],'OpenchannelInteractionId':_0x49d1fe['id'],'UserId':_0xb3fa49[_0x5cc0('0x61')]['id'],'ContactId':_0x24e903['id']}))[_0x5cc0('0x22')](function(_0x4d5b59){_0x49d1fe[_0x5cc0('0xc1')]['Messages']=[];_0x49d1fe['dataValues'][_0x5cc0('0xc0')][_0x5cc0('0x95')](_0x4d5b59[_0x5cc0('0xc1')]);return _0x49d1fe;});});}})[_0x5cc0('0x22')](respondWithResult(_0x77aaf0,null))[_0x5cc0('0x2c')](handleError(_0x77aaf0,null));}; \ No newline at end of file +var _0x3f3c=['notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','send','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','index','mandatoryDispositionPause','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','params','Pause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids'];(function(_0x22c800,_0x58dbcb){var _0x2fbc88=function(_0x320dd2){while(--_0x320dd2){_0x22c800['push'](_0x22c800['shift']());}};_0x2fbc88(++_0x58dbcb);}(_0x3f3c,0x1e0));var _0xc3f3=function(_0x5aaaed,_0xf3a5b6){_0x5aaaed=_0x5aaaed-0x0;var _0x2b3d99=_0x3f3c[_0x5aaaed];return _0x2b3d99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3f3('0x0'));var zipdir=require(_0xc3f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3f3('0x2'));var moment=require(_0xc3f3('0x3'));var BPromise=require(_0xc3f3('0x4'));var Mustache=require(_0xc3f3('0x5'));var util=require(_0xc3f3('0x6'));var path=require('path');var sox=require(_0xc3f3('0x7'));var csv=require(_0xc3f3('0x8'));var ejs=require(_0xc3f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc3f3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc3f3('0xb'));var toCsv=require(_0xc3f3('0x8'));var querystring=require(_0xc3f3('0xc'));var Papa=require('papaparse');var Redis=require(_0xc3f3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc3f3('0xe'));var as=require(_0xc3f3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3f3('0x10'))('api');var utils=require(_0xc3f3('0x11'));var config=require(_0xc3f3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3f3('0x13'))['db'];config[_0xc3f3('0x14')]=_['defaults'](config['redis'],{'host':_0xc3f3('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3f3('0x14')]));require(_0xc3f3('0x16'))['register'](socket);var jayson=require(_0xc3f3('0x17'));var client=jayson[_0xc3f3('0x18')][_0xc3f3('0x19')]({'port':0x232c});var client9002=jayson[_0xc3f3('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebe82,_0x18a625,_0x1b4b6e,_0x51ee00){return new BPromise(function(_0x2497b0,_0x207862){var _0x195b2c=_0x51ee00||client;return _0x195b2c['request'](_0x4ebe82,_0x1b4b6e)[_0xc3f3('0x1a')](function(_0x289b4e){logger[_0xc3f3('0x1b')]('OpenchannelAccount,\x20%s,\x20%s',_0x18a625,_0xc3f3('0x1c'));logger[_0xc3f3('0x1d')](_0xc3f3('0x1e'),_0x18a625,_0xc3f3('0x1c'),JSON[_0xc3f3('0x1f')](_0x289b4e));if(_0x289b4e['error']){if(_0x289b4e[_0xc3f3('0x20')]['code']===0x1f4){logger[_0xc3f3('0x20')](_0xc3f3('0x21'),_0x18a625,_0x289b4e[_0xc3f3('0x20')][_0xc3f3('0x22')]);return _0x207862(_0x289b4e[_0xc3f3('0x20')]['message']);}logger[_0xc3f3('0x20')](_0xc3f3('0x21'),_0x18a625,_0x289b4e['error'][_0xc3f3('0x22')]);return _0x2497b0(_0x289b4e[_0xc3f3('0x20')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x18a625,'request\x20sent');_0x2497b0(_0x289b4e[_0xc3f3('0x23')]['message']);}})['catch'](function(_0x5b64b3){logger[_0xc3f3('0x20')](_0xc3f3('0x21'),_0x18a625,_0x5b64b3);_0x207862(_0x5b64b3);});});}function respondWithStatusCode(_0x2d81f5,_0xb8652f){_0xb8652f=_0xb8652f||0xcc;return function(_0x119835){if(_0x119835){return _0x2d81f5[_0xc3f3('0x24')](_0xb8652f);}return _0x2d81f5[_0xc3f3('0x25')](_0xb8652f)[_0xc3f3('0x26')]();};}function respondWithResult(_0x12cdbd,_0x9d5411){_0x9d5411=_0x9d5411||0xc8;return function(_0xed0e2e){if(_0xed0e2e){return _0x12cdbd[_0xc3f3('0x25')](_0x9d5411)[_0xc3f3('0x27')](_0xed0e2e);}};}function respondWithFilteredResult(_0x5b8717,_0x1c354f){return function(_0x5eb293){if(_0x5eb293){var _0x6970b4=typeof _0x1c354f[_0xc3f3('0x28')]==='undefined'&&typeof _0x1c354f[_0xc3f3('0x29')]===_0xc3f3('0x2a');var _0x1d8bee=_0x5eb293[_0xc3f3('0x2b')];var _0x179836=_0x6970b4?0x0:_0x1c354f[_0xc3f3('0x28')];var _0xa2bbf6=_0x6970b4?_0x5eb293[_0xc3f3('0x2b')]:_0x1c354f[_0xc3f3('0x28')]+_0x1c354f[_0xc3f3('0x29')];var _0x5c516d;if(_0xa2bbf6>=_0x1d8bee){_0xa2bbf6=_0x1d8bee;_0x5c516d=0xc8;}else{_0x5c516d=0xce;}_0x5b8717[_0xc3f3('0x25')](_0x5c516d);return _0x5b8717[_0xc3f3('0x2c')](_0xc3f3('0x2d'),_0x179836+'-'+_0xa2bbf6+'/'+_0x1d8bee)['json'](_0x5eb293);}return null;};}function patchUpdates(_0xba726){return function(_0x336775){try{jsonpatch[_0xc3f3('0x2e')](_0x336775,_0xba726,!![]);}catch(_0x56a503){return BPromise[_0xc3f3('0x2f')](_0x56a503);}return _0x336775[_0xc3f3('0x30')]();};}function saveUpdates(_0x3aec72,_0x59e415){return function(_0x3d4e07){if(_0x3d4e07){return _0x3d4e07[_0xc3f3('0x31')](_0x3aec72)['then'](function(_0x59c2cd){return _0x59c2cd;});}return null;};}function removeEntity(_0x71ca5a,_0x2afd87){return function(_0x3f90cd){if(_0x3f90cd){return _0x3f90cd[_0xc3f3('0x32')]()[_0xc3f3('0x1a')](function(){var _0x16133f=_0x3f90cd[_0xc3f3('0x33')]({'plain':!![]});var _0x2fffe5=_0xc3f3('0x34');return db[_0xc3f3('0x35')][_0xc3f3('0x32')]({'where':{'type':_0x2fffe5,'resourceId':_0x16133f['id']}})[_0xc3f3('0x1a')](function(){return _0x3f90cd;});})['then'](function(){_0x71ca5a[_0xc3f3('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a91f8,_0x47d9b9){return function(_0x296995){if(!_0x296995){_0x2a91f8[_0xc3f3('0x24')](0x194);}return _0x296995;};}function handleError(_0x3479b0,_0x22494a){_0x22494a=_0x22494a||0x1f4;return function(_0x29901f){logger[_0xc3f3('0x20')](_0x29901f['stack']);if(_0x29901f['name']){delete _0x29901f[_0xc3f3('0x36')];}_0x3479b0[_0xc3f3('0x25')](_0x22494a)['send'](_0x29901f);};}exports[_0xc3f3('0x37')]=function(_0x1e5132,_0x17f906){var _0x593878={'include':[{'model':db['Pause'],'as':_0xc3f3('0x38')}]},_0x258310={},_0x4e8db8={'count':0x0,'rows':[]};var _0x1812a7=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x3ef365){return{'name':_0x3ef365[_0xc3f3('0x39')],'type':_0x3ef365[_0xc3f3('0x3a')]['key']};});_0x258310[_0xc3f3('0x3b')]=_[_0xc3f3('0x3c')](_0x1812a7,_0xc3f3('0x36'));_0x258310[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x1e5132[_0xc3f3('0x3d')]);_0x258310[_0xc3f3('0x3f')]=_[_0xc3f3('0x40')](_0x258310[_0xc3f3('0x3b')],_0x258310['query']);_0x593878[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x258310[_0xc3f3('0x3b')],qs[_0xc3f3('0x42')](_0x1e5132[_0xc3f3('0x3d')][_0xc3f3('0x42')]));_0x593878[_0xc3f3('0x41')]=_0x593878[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x593878[_0xc3f3('0x41')]:_0x258310[_0xc3f3('0x3b')];if(!_0x1e5132['query'][_0xc3f3('0x44')](_0xc3f3('0x45'))){_0x593878[_0xc3f3('0x29')]=qs[_0xc3f3('0x29')](_0x1e5132[_0xc3f3('0x3d')][_0xc3f3('0x29')]);_0x593878[_0xc3f3('0x28')]=qs[_0xc3f3('0x28')](_0x1e5132['query'][_0xc3f3('0x28')]);}_0x593878[_0xc3f3('0x46')]=qs[_0xc3f3('0x47')](_0x1e5132[_0xc3f3('0x3d')]['sort']);_0x593878[_0xc3f3('0x48')]=qs['filters'](_[_0xc3f3('0x49')](_0x1e5132[_0xc3f3('0x3d')],_0x258310[_0xc3f3('0x3f')]),_0x1812a7);if(_0x1e5132['query'][_0xc3f3('0x4a')]){_0x593878['where']=_[_0xc3f3('0x4b')](_0x593878[_0xc3f3('0x48')],{'$or':_[_0xc3f3('0x3c')](_0x1812a7,function(_0x502832){if(_0x502832['type']!==_0xc3f3('0x4c')){var _0x513861={};_0x513861[_0x502832[_0xc3f3('0x36')]]={'$like':'%'+_0x1e5132[_0xc3f3('0x3d')][_0xc3f3('0x4a')]+'%'};return _0x513861;}})});}_0x593878=_[_0xc3f3('0x4b')]({},_0x593878,_0x1e5132[_0xc3f3('0x4d')]);var _0x29d709={'where':_0x593878[_0xc3f3('0x48')]};return db[_0xc3f3('0x4e')][_0xc3f3('0x2b')](_0x29d709)[_0xc3f3('0x1a')](function(_0x56747f){_0x4e8db8['count']=_0x56747f;if(_0x1e5132[_0xc3f3('0x3d')][_0xc3f3('0x4f')]){_0x593878[_0xc3f3('0x50')]=[{'all':!![]}];}return db[_0xc3f3('0x4e')][_0xc3f3('0x51')](_0x593878);})[_0xc3f3('0x1a')](function(_0x599f5f){_0x4e8db8[_0xc3f3('0x52')]=_0x599f5f;return _0x4e8db8;})[_0xc3f3('0x1a')](respondWithFilteredResult(_0x17f906,_0x593878))[_0xc3f3('0x53')](handleError(_0x17f906,null));};exports[_0xc3f3('0x54')]=function(_0x59e3f7,_0x131c45){var _0xce904b={'raw':![],'where':{'id':_0x59e3f7[_0xc3f3('0x55')]['id']},'include':[{'model':db[_0xc3f3('0x56')],'as':_0xc3f3('0x38')}]},_0x55a874={};_0x55a874['model']=_[_0xc3f3('0x3e')](db[_0xc3f3('0x4e')][_0xc3f3('0x57')]);_0x55a874[_0xc3f3('0x3d')]=_['keys'](_0x59e3f7[_0xc3f3('0x3d')]);_0x55a874['filters']=_[_0xc3f3('0x40')](_0x55a874[_0xc3f3('0x3b')],_0x55a874[_0xc3f3('0x3d')]);_0xce904b[_0xc3f3('0x41')]=_['intersection'](_0x55a874['model'],qs[_0xc3f3('0x42')](_0x59e3f7['query'][_0xc3f3('0x42')]));_0xce904b[_0xc3f3('0x41')]=_0xce904b[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0xce904b['attributes']:_0x55a874[_0xc3f3('0x3b')];if(_0x59e3f7[_0xc3f3('0x3d')][_0xc3f3('0x4f')]){_0xce904b[_0xc3f3('0x50')]=[{'all':!![]}];}_0xce904b=_[_0xc3f3('0x4b')]({},_0xce904b,_0x59e3f7[_0xc3f3('0x4d')]);return db[_0xc3f3('0x4e')][_0xc3f3('0x58')](_0xce904b)['then'](handleEntityNotFound(_0x131c45,null))[_0xc3f3('0x1a')](respondWithResult(_0x131c45,null))[_0xc3f3('0x53')](handleError(_0x131c45,null));};exports['create']=function(_0x8ee99b,_0x5b7646){return db[_0xc3f3('0x4e')][_0xc3f3('0x59')](_0x8ee99b[_0xc3f3('0x5a')],{})['then'](function(_0x5098f6){var _0x593080=_0x8ee99b[_0xc3f3('0x5b')][_0xc3f3('0x33')]({'plain':!![]});if(!_0x593080)throw new Error(_0xc3f3('0x5c'));if(_0x593080[_0xc3f3('0x5d')]==='user'){var _0xe137a2=_0x5098f6[_0xc3f3('0x33')]({'plain':!![]});var _0x34874e=_0xc3f3('0x34');return db[_0xc3f3('0x5e')][_0xc3f3('0x58')]({'where':{'name':_0x34874e,'userProfileId':_0x593080[_0xc3f3('0x5f')]},'raw':!![]})[_0xc3f3('0x1a')](function(_0x196c2b){if(_0x196c2b&&_0x196c2b[_0xc3f3('0x60')]===0x0){return db[_0xc3f3('0x35')]['create']({'name':_0xe137a2[_0xc3f3('0x36')],'resourceId':_0xe137a2['id'],'type':_0x196c2b[_0xc3f3('0x36')],'sectionId':_0x196c2b['id']},{})['then'](function(){return _0x5098f6;});}else{return _0x5098f6;}})[_0xc3f3('0x53')](function(_0x4cdcc7){logger[_0xc3f3('0x20')](_0xc3f3('0x61'),_0x4cdcc7);throw _0x4cdcc7;});}return _0x5098f6;})[_0xc3f3('0x1a')](respondWithResult(_0x5b7646,0xc9))[_0xc3f3('0x53')](handleError(_0x5b7646,null));};exports[_0xc3f3('0x31')]=function(_0x3261c2,_0x222efe){if(_0x3261c2[_0xc3f3('0x5a')]['id']){delete _0x3261c2[_0xc3f3('0x5a')]['id'];}return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x3261c2[_0xc3f3('0x55')]['id']},'include':[{'model':db[_0xc3f3('0x56')],'as':_0xc3f3('0x38')}]})[_0xc3f3('0x1a')](handleEntityNotFound(_0x222efe,null))[_0xc3f3('0x1a')](saveUpdates(_0x3261c2[_0xc3f3('0x5a')],null))[_0xc3f3('0x1a')](respondWithResult(_0x222efe,null))['catch'](handleError(_0x222efe,null));};exports[_0xc3f3('0x32')]=function(_0x4b925c,_0x15bdfb){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x4b925c['params']['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x15bdfb,null))[_0xc3f3('0x1a')](removeEntity(_0x15bdfb,null))[_0xc3f3('0x53')](handleError(_0x15bdfb,null));};exports['describe']=function(_0x254761,_0x533f62){return db[_0xc3f3('0x4e')][_0xc3f3('0x62')]()[_0xc3f3('0x1a')](respondWithResult(_0x533f62,null))[_0xc3f3('0x53')](handleError(_0x533f62,null));};exports[_0xc3f3('0x63')]=function(_0x19bf11,_0x5acf67,_0x1711b1){if(_0x19bf11['body']['id']){delete _0x19bf11[_0xc3f3('0x5a')]['id'];}return db[_0xc3f3('0x4e')]['find']({'where':{'id':_0x19bf11[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x5acf67,null))['then'](function(_0x528215){if(_0x528215){_0x19bf11[_0xc3f3('0x5a')][_0xc3f3('0x64')]=_0x528215['id'];return db[_0xc3f3('0x65')]['create'](_0x19bf11['body']);}})[_0xc3f3('0x1a')](respondWithResult(_0x5acf67,null))[_0xc3f3('0x53')](handleError(_0x5acf67,null));};exports['getDispositions']=function(_0x2c3699,_0x5bb0fe,_0x61c2e4){var _0x3e9543={'raw':![],'where':{}};var _0x106e10={};var _0x484585={'count':0x0,'rows':[]};return db[_0xc3f3('0x4e')][_0xc3f3('0x66')]({'where':{'id':_0x2c3699[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x5bb0fe,null))['then'](function(_0x48f5a5){if(_0x48f5a5){_0x106e10[_0xc3f3('0x3b')]=_[_0xc3f3('0x3e')](db['Disposition'][_0xc3f3('0x57')]);_0x106e10[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x2c3699['query']);_0x106e10[_0xc3f3('0x3f')]=_[_0xc3f3('0x40')](_0x106e10[_0xc3f3('0x3b')],_0x106e10[_0xc3f3('0x3d')]);_0x3e9543[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x106e10[_0xc3f3('0x3b')],qs[_0xc3f3('0x42')](_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x42')]));_0x3e9543[_0xc3f3('0x41')]=_0x3e9543[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x3e9543[_0xc3f3('0x41')]:_0x106e10[_0xc3f3('0x3b')];if(!_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x44')]('nolimit')){_0x3e9543['limit']=qs[_0xc3f3('0x29')](_0x2c3699['query'][_0xc3f3('0x29')]);_0x3e9543[_0xc3f3('0x28')]=qs[_0xc3f3('0x28')](_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x28')]);}_0x3e9543['order']=qs[_0xc3f3('0x47')](_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x47')]);_0x3e9543['where']=qs[_0xc3f3('0x3f')](_[_0xc3f3('0x49')](_0x2c3699[_0xc3f3('0x3d')],_0x106e10[_0xc3f3('0x3f')]));_0x3e9543[_0xc3f3('0x48')][_0xc3f3('0x64')]=_0x48f5a5['id'];if(_0x2c3699['query']['filter']){_0x3e9543[_0xc3f3('0x48')]=_[_0xc3f3('0x4b')](_0x3e9543[_0xc3f3('0x48')],{'$or':_['map'](_0x3e9543[_0xc3f3('0x41')],function(_0x4fc0bc){var _0x12647d={};_0x12647d[_0x4fc0bc]={'$like':'%'+_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x4a')]+'%'};return _0x12647d;})});}_0x3e9543=_['merge']({},_0x3e9543,_0x2c3699['options']);return db[_0xc3f3('0x65')][_0xc3f3('0x2b')]({'where':_0x3e9543[_0xc3f3('0x48')]})[_0xc3f3('0x1a')](function(_0x89b49c){_0x484585['count']=_0x89b49c;if(_0x2c3699[_0xc3f3('0x3d')][_0xc3f3('0x4f')]){_0x3e9543['include']=[{'all':!![]}];}return db[_0xc3f3('0x65')][_0xc3f3('0x51')](_0x3e9543);})[_0xc3f3('0x1a')](function(_0x46659a){_0x484585['rows']=_0x46659a;return _0x484585;});}})[_0xc3f3('0x1a')](respondWithFilteredResult(_0x5bb0fe,_0x3e9543))[_0xc3f3('0x53')](handleError(_0x5bb0fe,null));};exports[_0xc3f3('0x67')]=function(_0x264ad4,_0xb78e5d,_0x2a1548){return db[_0xc3f3('0x4e')]['find']({'where':{'id':_0x264ad4[_0xc3f3('0x55')]['id']}})['then'](handleEntityNotFound(_0xb78e5d,null))[_0xc3f3('0x1a')](function(_0x35f546){if(_0x35f546){return _0x35f546[_0xc3f3('0x67')](_0x264ad4[_0xc3f3('0x3d')]['ids']);}})[_0xc3f3('0x1a')](respondWithStatusCode(_0xb78e5d,null))['catch'](handleError(_0xb78e5d,null));};exports[_0xc3f3('0x68')]=function(_0x37d753,_0x29e50e,_0xd228e8){if(_0x37d753[_0xc3f3('0x5a')]['id']){delete _0x37d753['body']['id'];}return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x37d753[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x29e50e,null))[_0xc3f3('0x1a')](function(_0x5845e2){if(_0x5845e2){_0x37d753[_0xc3f3('0x5a')][_0xc3f3('0x64')]=_0x5845e2['id'];return db[_0xc3f3('0x69')][_0xc3f3('0x59')](_0x37d753[_0xc3f3('0x5a')]);}})[_0xc3f3('0x1a')](respondWithResult(_0x29e50e,null))['catch'](handleError(_0x29e50e,null));};exports['getAnswers']=function(_0x537135,_0x1aab5c,_0x4b9e5e){var _0x4b65d3={'raw':![],'where':{}};var _0x1538b1={};var _0x126b39={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc3f3('0x66')]({'where':{'id':_0x537135[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x1aab5c,null))[_0xc3f3('0x1a')](function(_0x15756f){if(_0x15756f){_0x1538b1[_0xc3f3('0x3b')]=_[_0xc3f3('0x3e')](db[_0xc3f3('0x69')][_0xc3f3('0x57')]);_0x1538b1[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x537135[_0xc3f3('0x3d')]);_0x1538b1['filters']=_['intersection'](_0x1538b1['model'],_0x1538b1['query']);_0x4b65d3[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x1538b1[_0xc3f3('0x3b')],qs[_0xc3f3('0x42')](_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x42')]));_0x4b65d3[_0xc3f3('0x41')]=_0x4b65d3[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x4b65d3['attributes']:_0x1538b1[_0xc3f3('0x3b')];if(!_0x537135['query'][_0xc3f3('0x44')](_0xc3f3('0x45'))){_0x4b65d3[_0xc3f3('0x29')]=qs[_0xc3f3('0x29')](_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x29')]);_0x4b65d3['offset']=qs[_0xc3f3('0x28')](_0x537135['query']['offset']);}_0x4b65d3[_0xc3f3('0x46')]=qs[_0xc3f3('0x47')](_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x47')]);_0x4b65d3[_0xc3f3('0x48')]=qs[_0xc3f3('0x3f')](_[_0xc3f3('0x49')](_0x537135[_0xc3f3('0x3d')],_0x1538b1['filters']));_0x4b65d3[_0xc3f3('0x48')][_0xc3f3('0x64')]=_0x15756f['id'];if(_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x4a')]){_0x4b65d3[_0xc3f3('0x48')]=_['merge'](_0x4b65d3['where'],{'$or':_['map'](_0x4b65d3[_0xc3f3('0x41')],function(_0x1b3b19){var _0x5682d={};_0x5682d[_0x1b3b19]={'$like':'%'+_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x4a')]+'%'};return _0x5682d;})});}_0x4b65d3=_['merge']({},_0x4b65d3,_0x537135[_0xc3f3('0x4d')]);return db[_0xc3f3('0x69')][_0xc3f3('0x2b')]({'where':_0x4b65d3[_0xc3f3('0x48')]})['then'](function(_0x178fd9){_0x126b39[_0xc3f3('0x2b')]=_0x178fd9;if(_0x537135[_0xc3f3('0x3d')][_0xc3f3('0x4f')]){_0x4b65d3['include']=[{'all':!![]}];}return db[_0xc3f3('0x69')][_0xc3f3('0x51')](_0x4b65d3);})[_0xc3f3('0x1a')](function(_0x454e0c){_0x126b39['rows']=_0x454e0c;return _0x126b39;});}})[_0xc3f3('0x1a')](respondWithFilteredResult(_0x1aab5c,_0x4b65d3))['catch'](handleError(_0x1aab5c,null));};exports[_0xc3f3('0x6a')]=function(_0x5452ab,_0x9021c,_0x1e0692){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x5452ab[_0xc3f3('0x55')]['id']}})['then'](handleEntityNotFound(_0x9021c,null))[_0xc3f3('0x1a')](function(_0xa68108){if(_0xa68108){return _0xa68108['removeAnswers'](_0x5452ab[_0xc3f3('0x3d')][_0xc3f3('0x6b')]);}})[_0xc3f3('0x1a')](respondWithStatusCode(_0x9021c,null))[_0xc3f3('0x53')](handleError(_0x9021c,null));};exports[_0xc3f3('0x6c')]=function(_0x5c7227,_0x2daeaa,_0x55d7ec){var _0x54c70f={'body':_0x5c7227[_0xc3f3('0x5a')],'channel':'openchannel'};var _0x46dbe0=[];var _0xa11286=[];var _0x31a5f4={};var _0x494259=![];return db[_0xc3f3('0x6d')][_0xc3f3('0x62')]()[_0xc3f3('0x1a')](function(_0x3b1953){if(!_0x3b1953){throw new db['Sequelize'][(_0xc3f3('0x6e'))](_0xc3f3('0x6f'));}_0x46dbe0=_[_0xc3f3('0x70')](_[_0xc3f3('0x3e')](_0x3b1953),[_0xc3f3('0x71'),_0xc3f3('0x72')]);_0xa11286=_[_0xc3f3('0x70')](_['keys'](_0x3b1953),[_0xc3f3('0x71'),_0xc3f3('0x72'),_0xc3f3('0x73'),_0xc3f3('0x74')]);if(_0x5c7227['body']['id']){delete _0x5c7227['body']['id'];}if(_[_0xc3f3('0x75')](_0x5c7227['body'][_0xc3f3('0x76')])){throw new db[(_0xc3f3('0x77'))][(_0xc3f3('0x6e'))](_0xc3f3('0x78'));}if(_['isNil'](_0x5c7227[_0xc3f3('0x5a')]['body'])||_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x5a')]===''){throw new db[(_0xc3f3('0x77'))]['ValidationError'](_0xc3f3('0x79'));}if(_[_0xc3f3('0x75')](_0x5c7227[_0xc3f3('0x5a')]['mapKey'])){throw new db[(_0xc3f3('0x77'))][(_0xc3f3('0x6e'))](_0xc3f3('0x7a')+_0xa11286);}if(!_[_0xc3f3('0x7b')](_0xa11286,_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x7c')])){throw new db[(_0xc3f3('0x77'))]['ValidationError'](_0xc3f3('0x7d')+_0xa11286);}_0x31a5f4[_0x5c7227[_0xc3f3('0x5a')]['mapKey']]=_0x5c7227['body'][_0xc3f3('0x76')];})['then'](function(){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x5c7227[_0xc3f3('0x55')]['id']},'include':[{'model':db[_0xc3f3('0x7e')],'as':_0xc3f3('0x7f'),'include':[{'model':db[_0xc3f3('0x6d')],'as':_0xc3f3('0x80'),'where':_0x31a5f4,'limit':0x1,'order':[[_0xc3f3('0x72'),'DESC']]}]},{'model':db[_0xc3f3('0x81')],'as':_0xc3f3('0x82')}]});})[_0xc3f3('0x1a')](handleEntityNotFound(_0x2daeaa,null))[_0xc3f3('0x1a')](function(_0x32ae4b){if(_0x32ae4b&&_0x32ae4b['List']){_0x54c70f[_0xc3f3('0x83')]=_0x32ae4b;_0x54c70f[_0xc3f3('0x84')]=_0x32ae4b[_0xc3f3('0x82')];_0x54c70f[_0xc3f3('0x85')]=_0x32ae4b[_0xc3f3('0x7f')];_0x54c70f['applications']=_[_0xc3f3('0x86')](_0x54c70f[_0xc3f3('0x84')],[_0xc3f3('0x87')],[_0xc3f3('0x88')]);if(_0x54c70f[_0xc3f3('0x83')]['Applications']){delete _0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x82')];}if(_0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x7f')]&&_0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x7f')][_0xc3f3('0x80')][_0xc3f3('0x43')]){return _0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x7f')][_0xc3f3('0x80')][0x0];}var _0x35b4ae=_[_0xc3f3('0x89')](_0x5c7227[_0xc3f3('0x5a')],{'firstName':_0x5c7227['body'][_0xc3f3('0x76')],'ListId':_0x32ae4b[_0xc3f3('0x74')]});_0x35b4ae[_0x5c7227['body'][_0xc3f3('0x7c')]]=_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x76')];return db[_0xc3f3('0x6d')][_0xc3f3('0x59')](_0x35b4ae,{'fields':_0x46dbe0,'raw':!![]});}})['then'](handleEntityNotFound(_0x2daeaa,null))[_0xc3f3('0x1a')](function(_0x1847c0){_0x54c70f[_0xc3f3('0x8a')]=_0x1847c0;if(_0x1847c0){var _0x234368={'ContactId':_0x1847c0['id'],'OpenchannelAccountId':_0x5c7227['params']['id'],'from':(_0x1847c0[_0xc3f3('0x8b')]||'')+'\x20'+(_0x1847c0[_0xc3f3('0x8c')]||'')};var _0x57c278={'OpenchannelAccountId':_0x5c7227[_0xc3f3('0x55')]['id'],'closed':![]};if(_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x8d')]){_0x57c278['threadId']=_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x8d')];return db['OpenchannelInteraction'][_0xc3f3('0x58')]({'where':_0x57c278})['then'](function(_0x3cad7f){if(_0x3cad7f){return[_0x3cad7f,![]];}_0x234368['threadId']=_0x5c7227[_0xc3f3('0x5a')]['threadId'];_0x234368[_0xc3f3('0x8e')]=_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x8e')];return db[_0xc3f3('0x8f')][_0xc3f3('0x59')](_0x234368)[_0xc3f3('0x1a')](function(_0x10d7ff){return[_0x10d7ff,!![]];});});}else{_0x57c278['threadId']=null;}_0x57c278[_0xc3f3('0x90')]=_0x1847c0['id'];return db[_0xc3f3('0x8f')][_0xc3f3('0x58')]({'where':_0x57c278})[_0xc3f3('0x1a')](function(_0x248262){if(_0x248262){return[_0x248262,![]];}return db[_0xc3f3('0x8f')][_0xc3f3('0x59')](_0x234368)[_0xc3f3('0x1a')](function(_0x59b915){return[_0x59b915,!![]];});});}})[_0xc3f3('0x91')](function(_0x7d7c2e,_0x3a4f23){if(_0x7d7c2e){_0x494259=_0x3a4f23;if(!_0x3a4f23){var _0x9eb1f1={'from':(_0x54c70f['contact'][_0xc3f3('0x8b')]||'')+'\x20'+(_0x54c70f['contact'][_0xc3f3('0x8c')]||'')};if(_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x8d')]&&_0x5c7227[_0xc3f3('0x5a')]['messageId']&&_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x8d')]!=_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x92')]){_0x9eb1f1[_0xc3f3('0x8d')]=_0x5c7227['body'][_0xc3f3('0x92')];}return _0x7d7c2e[_0xc3f3('0x31')](_0x9eb1f1);}else{return _0x7d7c2e;}}})['then'](function(_0x34622b){_0x54c70f[_0xc3f3('0x93')]=_0x34622b['get']({'plain':!![]});_0x54c70f[_0xc3f3('0x93')]['created']=_0x494259;if(_0x54c70f[_0xc3f3('0x93')][_0xc3f3('0x94')]){if(_0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x95')]){_0x54c70f['applications'][_0xc3f3('0x96')]({'id':0x0,'priority':_0x54c70f['applications'][_0xc3f3('0x43')]+0x1,'app':_0xc3f3('0x97'),'appdata':_0xc3f3('0x98'),'interval':'*,*,*,*'});}}return db[_0xc3f3('0x99')][_0xc3f3('0x59')]({'body':_0x5c7227[_0xc3f3('0x5a')][_0xc3f3('0x5a')],'OpenchannelAccountId':_0x5c7227[_0xc3f3('0x55')]['id'],'OpenchannelInteractionId':_0x34622b['id'],'direction':'in','ContactId':_0x54c70f['contact']['id'],'AttachmentId':_0x5c7227['body'][_0xc3f3('0x9a')]});})[_0xc3f3('0x1a')](function(_0x2ce1ca){_0x54c70f[_0xc3f3('0x22')]=_0x2ce1ca;if(!_0x54c70f[_0xc3f3('0x93')][_0xc3f3('0x9b')])return;return db[_0xc3f3('0x9c')][_0xc3f3('0x58')]({'attributes':['id',_0xc3f3('0x36')],'where':{'id':_0x54c70f[_0xc3f3('0x93')][_0xc3f3('0x9b')]}});})[_0xc3f3('0x1a')](function(_0x4deaa8){if(_0x4deaa8){_0x54c70f['applications'][_0xc3f3('0x9d')]({'id':0x0,'priority':0x0,'app':_0xc3f3('0x9e'),'appdata':_0x4deaa8[_0xc3f3('0x36')]+','+(_0x54c70f[_0xc3f3('0x83')][_0xc3f3('0x9f')]||0xa),'interval':_0xc3f3('0xa0')});}if(!_0x54c70f[_0xc3f3('0x93')][_0xc3f3('0xa1')])return;return db[_0xc3f3('0xa2')][_0xc3f3('0x58')]({'attributes':['id',_0xc3f3('0x36')],'where':{'id':_0x54c70f[_0xc3f3('0x93')][_0xc3f3('0xa1')]}});})['then'](function(_0xa1af5f){if(_0xa1af5f){_0x54c70f[_0xc3f3('0x84')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xa1af5f[_0xc3f3('0x36')]+','+(_0x54c70f[_0xc3f3('0x83')][_0xc3f3('0xa3')]||0x12c),'interval':_0xc3f3('0xa0')});}return respondWithRpcPromise(_0xc3f3('0xa4'),_0xc3f3('0xa5'),_0x54c70f);})['then'](function(_0x9d08bf){respondWithRpcPromise(_0xc3f3('0xa6'),'EventManager',{'event':_0xc3f3('0x6c'),'message':_0x9d08bf},client9002);return _0x9d08bf;})[_0xc3f3('0x1a')](respondWithResult(_0x2daeaa,null))[_0xc3f3('0x53')](handleError(_0x2daeaa,null));};exports[_0xc3f3('0xa7')]=function(_0xeb55a3,_0x3e0b7b){var _0x2e13e5=_0xeb55a3[_0xc3f3('0x55')]['id'];var _0x5559c4=_0xeb55a3[_0xc3f3('0x5a')];var _0x235de7=0xc8;var _0x303cb4=null;return db[_0xc3f3('0xa8')][_0xc3f3('0xa9')]({'isolationLevel':db[_0xc3f3('0xa8')][_0xc3f3('0xaa')][_0xc3f3('0xab')][_0xc3f3('0xac')]},function(_0x4c2812){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2e13e5},'transaction':_0x4c2812})[_0xc3f3('0x1a')](function(_0x38bbd){if(_0x38bbd){return db[_0xc3f3('0x81')][_0xc3f3('0x32')]({'where':{'OpenchannelAccountId':_0x2e13e5},'transaction':_0x4c2812})[_0xc3f3('0x1a')](function(){var _0x109c28=_[_0xc3f3('0x3c')](_0x5559c4,function(_0x1bd187){_0x1bd187[_0xc3f3('0x64')]=_0x2e13e5;return _0x1bd187;});return db[_0xc3f3('0x81')]['bulkCreate'](_0x109c28,{'transaction':_0x4c2812});});}else{_0x235de7=0x194;_0x303cb4=[];}});})[_0xc3f3('0x1a')](function(){if(_0x235de7!==0x194){return db[_0xc3f3('0x81')][_0xc3f3('0xad')]({'where':{'OpenchannelAccountId':_0x2e13e5},'order':_0xc3f3('0x87')})[_0xc3f3('0x1a')](function(_0x5efc77){_0x303cb4=_0x5efc77;});}})[_0xc3f3('0x53')](function(_0x52c421){_0x235de7=0x1f4;logger['error'](_0x52c421[_0xc3f3('0xae')]);if(_0x52c421['name']){delete _0x52c421['name'];}_0x303cb4=_0x52c421;})[_0xc3f3('0xaf')](function(){if(_0x303cb4===null){_0x3e0b7b[_0xc3f3('0x24')](_0x235de7);}else{if(_0x235de7===0x1f4){_0x3e0b7b[_0xc3f3('0x25')](_0x235de7)[_0xc3f3('0xb0')](_0x303cb4);}else{_0x3e0b7b['status'](_0x235de7)[_0xc3f3('0x27')](_0x303cb4);}}});};exports[_0xc3f3('0xb1')]=function(_0x2a9b8b,_0x569a06,_0x573d73){var _0x28964e={};var _0x10e1e0={};var _0x3fa6cb;var _0x274f65;return db[_0xc3f3('0x4e')][_0xc3f3('0x66')]({'where':{'id':_0x2a9b8b[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x569a06,null))['then'](function(_0x1986a0){if(_0x1986a0){_0x3fa6cb=_0x1986a0;_0x10e1e0[_0xc3f3('0x3b')]=_[_0xc3f3('0x3e')](db[_0xc3f3('0x81')][_0xc3f3('0x57')]);_0x10e1e0[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x2a9b8b[_0xc3f3('0x3d')]);_0x10e1e0[_0xc3f3('0x3f')]=_[_0xc3f3('0x40')](_0x10e1e0[_0xc3f3('0x3b')],_0x10e1e0['query']);_0x28964e[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x10e1e0[_0xc3f3('0x3b')],qs['fields'](_0x2a9b8b['query']['fields']));_0x28964e[_0xc3f3('0x41')]=_0x28964e[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x28964e[_0xc3f3('0x41')]:_0x10e1e0[_0xc3f3('0x3b')];_0x28964e[_0xc3f3('0x46')]=qs[_0xc3f3('0x47')](_0x2a9b8b[_0xc3f3('0x3d')]['sort']);_0x28964e[_0xc3f3('0x48')]=qs[_0xc3f3('0x3f')](_['pick'](_0x2a9b8b[_0xc3f3('0x3d')],_0x10e1e0[_0xc3f3('0x3f')]));if(_0x2a9b8b[_0xc3f3('0x3d')]['filter']){_0x28964e[_0xc3f3('0x48')]=_[_0xc3f3('0x4b')](_0x28964e[_0xc3f3('0x48')],{'$or':_[_0xc3f3('0x3c')](_0x28964e[_0xc3f3('0x41')],function(_0x1affe1){var _0x5ccbbf={};_0x5ccbbf[_0x1affe1]={'$like':'%'+_0x2a9b8b[_0xc3f3('0x3d')]['filter']+'%'};return _0x5ccbbf;})});}_0x28964e=_[_0xc3f3('0x4b')]({},_0x28964e,_0x2a9b8b[_0xc3f3('0x4d')]);return _0x3fa6cb[_0xc3f3('0xb1')](_0x28964e);}})[_0xc3f3('0x1a')](function(_0x3b4f74){if(_0x3b4f74){_0x274f65=_0x3b4f74[_0xc3f3('0x43')];if(!_0x2a9b8b[_0xc3f3('0x3d')][_0xc3f3('0x44')](_0xc3f3('0x45'))){_0x28964e[_0xc3f3('0x29')]=qs[_0xc3f3('0x29')](_0x2a9b8b[_0xc3f3('0x3d')][_0xc3f3('0x29')]);_0x28964e[_0xc3f3('0x28')]=qs[_0xc3f3('0x28')](_0x2a9b8b['query'][_0xc3f3('0x28')]);}return _0x3fa6cb['getApplications'](_0x28964e);}})[_0xc3f3('0x1a')](function(_0x1d32d9){if(_0x1d32d9){return _0x1d32d9?{'count':_0x274f65,'rows':_0x1d32d9}:null;}})['then'](respondWithResult(_0x569a06,null))[_0xc3f3('0x53')](handleError(_0x569a06,null));};exports['getInteractions']=function(_0x532eaf,_0x76299,_0x94eac6){var _0x327615={'raw':![],'where':{}};var _0x59eead={};var _0x3cf0b1={'count':0x0,'rows':[]};return db[_0xc3f3('0x4e')][_0xc3f3('0x66')]({'where':{'id':_0x532eaf['params']['id']}})['then'](handleEntityNotFound(_0x76299,null))['then'](function(_0x40a945){if(_0x40a945){_0x59eead[_0xc3f3('0x3b')]=_[_0xc3f3('0x3e')](db['OpenchannelInteraction'][_0xc3f3('0x57')]);_0x59eead[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x532eaf[_0xc3f3('0x3d')]);_0x59eead[_0xc3f3('0x3f')]=_[_0xc3f3('0x40')](_0x59eead['model'],_0x59eead[_0xc3f3('0x3d')]);_0x327615[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x59eead[_0xc3f3('0x3b')],qs[_0xc3f3('0x42')](_0x532eaf['query'][_0xc3f3('0x42')]));_0x327615[_0xc3f3('0x41')]=_0x327615[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x327615[_0xc3f3('0x41')]:_0x59eead[_0xc3f3('0x3b')];if(!_0x532eaf[_0xc3f3('0x3d')][_0xc3f3('0x44')](_0xc3f3('0x45'))){_0x327615[_0xc3f3('0x29')]=qs[_0xc3f3('0x29')](_0x532eaf[_0xc3f3('0x3d')][_0xc3f3('0x29')]);_0x327615[_0xc3f3('0x28')]=qs['offset'](_0x532eaf[_0xc3f3('0x3d')][_0xc3f3('0x28')]);}_0x327615[_0xc3f3('0x46')]=qs[_0xc3f3('0x47')](_0x532eaf[_0xc3f3('0x3d')][_0xc3f3('0x47')]);_0x327615[_0xc3f3('0x48')]=qs[_0xc3f3('0x3f')](_['pick'](_0x532eaf[_0xc3f3('0x3d')],_0x59eead['filters']));_0x327615[_0xc3f3('0x48')][_0xc3f3('0x64')]=_0x40a945['id'];if(_0x532eaf['query']['filter']){_0x327615[_0xc3f3('0x48')]=_[_0xc3f3('0x4b')](_0x327615['where'],{'$or':_[_0xc3f3('0x3c')](_0x327615['attributes'],function(_0x491dae){var _0x6d1dcb={};_0x6d1dcb[_0x491dae]={'$like':'%'+_0x532eaf['query']['filter']+'%'};return _0x6d1dcb;})});}_0x327615=_[_0xc3f3('0x4b')]({},_0x327615,_0x532eaf[_0xc3f3('0x4d')]);return db['OpenchannelInteraction'][_0xc3f3('0x2b')]({'where':_0x327615[_0xc3f3('0x48')]})[_0xc3f3('0x1a')](function(_0x11409c){_0x3cf0b1[_0xc3f3('0x2b')]=_0x11409c;if(_0x532eaf[_0xc3f3('0x3d')]['includeAll']){_0x327615[_0xc3f3('0x50')]=[{'model':db['CmContact'],'as':_0xc3f3('0xb2'),'required':![]},{'model':db['User'],'as':_0xc3f3('0xb3'),'attributes':[_0xc3f3('0x36'),_0xc3f3('0xb4'),'internal'],'required':![]},{'model':db[_0xc3f3('0xb5')],'as':_0xc3f3('0xb6'),'attributes':['id',_0xc3f3('0x36'),_0xc3f3('0xb7')],'where':_0x532eaf['query'][_0xc3f3('0xb8')]?{'id':_0x532eaf[_0xc3f3('0x3d')][_0xc3f3('0xb8')]}:undefined,'required':_0x532eaf['query'][_0xc3f3('0xb8')]?!![]:![]}];}return db[_0xc3f3('0x8f')][_0xc3f3('0x51')](_0x327615);})['then'](function(_0xa967d){_0x3cf0b1[_0xc3f3('0x52')]=_0xa967d;return _0x3cf0b1;});}})[_0xc3f3('0x1a')](respondWithFilteredResult(_0x76299,_0x327615))[_0xc3f3('0x53')](handleError(_0x76299,null));};exports[_0xc3f3('0xb9')]=function(_0x918239,_0x381711,_0x28e44c){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x918239[_0xc3f3('0x55')]['id']}})['then'](handleEntityNotFound(_0x381711,null))['then'](function(_0x5698a9){if(_0x5698a9){return _0x5698a9['addAgents'](_0x918239[_0xc3f3('0x5a')][_0xc3f3('0x6b')],_[_0xc3f3('0xba')](_0x918239[_0xc3f3('0x5a')],[_0xc3f3('0x6b'),'id'])||{})[_0xc3f3('0x91')](function(_0x1a1e10){for(var _0x33fd75=0x0;_0x33fd75<_0x918239[_0xc3f3('0x5a')][_0xc3f3('0x6b')][_0xc3f3('0x43')];_0x33fd75+=0x1){socket['emit'](_0xc3f3('0xbb'),{'UserId':Number(_0x918239[_0xc3f3('0x5a')][_0xc3f3('0x6b')][_0x33fd75]),'OpenchannelAccountId':Number(_0x918239[_0xc3f3('0x55')]['id'])});}return _0x1a1e10;});}})[_0xc3f3('0x1a')](respondWithResult(_0x381711,null))[_0xc3f3('0x53')](handleError(_0x381711,null));};exports[_0xc3f3('0xbc')]=function(_0x4e0b25,_0x1dda0f,_0xc58122){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x4e0b25[_0xc3f3('0x55')]['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x1dda0f,null))[_0xc3f3('0x1a')](function(_0x5f0301){if(_0x5f0301){return _0x5f0301[_0xc3f3('0xbc')](_0x4e0b25[_0xc3f3('0x3d')]['ids'])[_0xc3f3('0x1a')](function(){if(_[_0xc3f3('0xbd')](_0x4e0b25[_0xc3f3('0x3d')]['ids'])){for(var _0xaf8ba9=0x0;_0xaf8ba9<_0x4e0b25[_0xc3f3('0x3d')]['ids'][_0xc3f3('0x43')];_0xaf8ba9+=0x1){socket[_0xc3f3('0xbe')](_0xc3f3('0xbf'),{'UserId':Number(_0x4e0b25[_0xc3f3('0x3d')][_0xc3f3('0x6b')][_0xaf8ba9]),'OpenchannelAccountId':Number(_0x4e0b25[_0xc3f3('0x55')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4e0b25[_0xc3f3('0x3d')]['ids']),'OpenchannelAccountId':Number(_0x4e0b25[_0xc3f3('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dda0f,null))[_0xc3f3('0x53')](handleError(_0x1dda0f,null));};exports[_0xc3f3('0xc0')]=function(_0x1fc4ff,_0x5cd36d,_0x5a54a2){var _0x3e3465={};var _0x206290={};var _0x58a5c9;var _0x1ba64b;return db[_0xc3f3('0x4e')]['findOne']({'where':{'id':_0x1fc4ff['params']['id']}})[_0xc3f3('0x1a')](handleEntityNotFound(_0x5cd36d,null))[_0xc3f3('0x1a')](function(_0x5b3282){if(_0x5b3282){_0x58a5c9=_0x5b3282;_0x206290[_0xc3f3('0x3b')]=_[_0xc3f3('0x3e')](db[_0xc3f3('0x9c')][_0xc3f3('0x57')]);_0x206290[_0xc3f3('0x3d')]=_[_0xc3f3('0x3e')](_0x1fc4ff[_0xc3f3('0x3d')]);_0x206290[_0xc3f3('0x3f')]=_[_0xc3f3('0x40')](_0x206290[_0xc3f3('0x3b')],_0x206290[_0xc3f3('0x3d')]);_0x3e3465[_0xc3f3('0x41')]=_[_0xc3f3('0x40')](_0x206290['model'],qs[_0xc3f3('0x42')](_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x42')]));_0x3e3465[_0xc3f3('0x41')]=_0x3e3465[_0xc3f3('0x41')][_0xc3f3('0x43')]?_0x3e3465[_0xc3f3('0x41')]:_0x206290[_0xc3f3('0x3b')];_0x3e3465['order']=qs[_0xc3f3('0x47')](_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x47')]);_0x3e3465['where']=qs[_0xc3f3('0x3f')](_[_0xc3f3('0x49')](_0x1fc4ff[_0xc3f3('0x3d')],_0x206290[_0xc3f3('0x3f')]));if(_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x4a')]){_0x3e3465['where']=_[_0xc3f3('0x4b')](_0x3e3465[_0xc3f3('0x48')],{'$or':_[_0xc3f3('0x3c')](_0x3e3465[_0xc3f3('0x41')],function(_0x2fce57){var _0x1e7382={};_0x1e7382[_0x2fce57]={'$like':'%'+_0x1fc4ff['query'][_0xc3f3('0x4a')]+'%'};return _0x1e7382;})});}_0x3e3465=_[_0xc3f3('0x4b')]({},_0x3e3465,_0x1fc4ff[_0xc3f3('0x4d')]);return _0x58a5c9[_0xc3f3('0xc0')](_0x3e3465);}})[_0xc3f3('0x1a')](function(_0x2bb4a3){if(_0x2bb4a3){_0x1ba64b=_0x2bb4a3['length'];if(!_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x44')](_0xc3f3('0x45'))){_0x3e3465[_0xc3f3('0x29')]=qs[_0xc3f3('0x29')](_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x29')]);_0x3e3465[_0xc3f3('0x28')]=qs[_0xc3f3('0x28')](_0x1fc4ff[_0xc3f3('0x3d')][_0xc3f3('0x28')]);}return _0x58a5c9[_0xc3f3('0xc0')](_0x3e3465);}})[_0xc3f3('0x1a')](function(_0x40ba96){if(_0x40ba96){return _0x40ba96?{'count':_0x1ba64b,'rows':_0x40ba96}:null;}})[_0xc3f3('0x1a')](respondWithResult(_0x5cd36d,null))[_0xc3f3('0x53')](handleError(_0x5cd36d,null));};exports[_0xc3f3('0xb0')]=function(_0x18167f,_0x4ce767,_0x77619c){var _0x271f80,_0x2f93ce,_0x112cba;if(_['isNil'](_0x18167f[_0xc3f3('0x5a')][_0xc3f3('0x5a')])||_0x18167f[_0xc3f3('0x5a')]['body']===''){throw new db[(_0xc3f3('0x77'))][(_0xc3f3('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x18167f['body']['to'])){}_0x271f80=_0x18167f[_0xc3f3('0x5a')]['to'];return db[_0xc3f3('0x4e')][_0xc3f3('0x66')]({'where':{'id':_0x18167f[_0xc3f3('0x55')]['id']}})['then'](handleEntityNotFound(_0x4ce767,null))[_0xc3f3('0x1a')](function(_0x51df26){if(_0x51df26){return db[_0xc3f3('0x4e')][_0xc3f3('0x58')]({'where':{'id':_0x51df26['id']},'include':[{'model':db['CmList'],'as':_0xc3f3('0x7f'),'include':[{'model':db['CmContact'],'as':_0xc3f3('0x80'),'where':{[_0x51df26[_0xc3f3('0x7c')]]:_0x271f80},'limit':0x1,'order':[[_0xc3f3('0x72'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4ce767,null))['then'](function(_0x515a15){if(_0x515a15&&_0x515a15[_0xc3f3('0x7f')]){_0x2f93ce=_0x515a15[_0xc3f3('0x33')]({'plain':!![]});if(_0x2f93ce[_0xc3f3('0x7f')]&&_0x2f93ce[_0xc3f3('0x7f')]['Contacts'][_0xc3f3('0x43')]){return _0x2f93ce[_0xc3f3('0x7f')][_0xc3f3('0x80')][0x0];}return db[_0xc3f3('0x6d')][_0xc3f3('0x59')](_[_0xc3f3('0x89')](_0x18167f['body'],{'firstName':_0x271f80,[_0x515a15['mapKey']]:_0x271f80,'phone':_0x271f80,'ListId':_0x2f93ce[_0xc3f3('0x74')]}));}})['then'](handleEntityNotFound(_0x4ce767,null))[_0xc3f3('0x1a')](function(_0x52876f){if(_0x52876f){_0x112cba=_0x52876f;return db[_0xc3f3('0x8f')]['find']({'where':{'ContactId':_0x112cba['id'],'closed':![],'OpenchannelAccountId':_0x2f93ce['id']}})['then'](function(_0x41f5b3){if(_0x41f5b3){return[_0x41f5b3,![]];}return db[_0xc3f3('0x8f')][_0xc3f3('0x59')]({'UserId':_0x18167f[_0xc3f3('0x5b')]['id'],'ContactId':_0x112cba['id'],'OpenchannelAccountId':_0x2f93ce['id'],'lastMsgDirection':_0xc3f3('0xc1'),'firstMsgDirection':_0xc3f3('0xc1'),'Messages':[_[_0xc3f3('0x4b')](_0x18167f[_0xc3f3('0x5a')],{'read':![],'body':_0x18167f[_0xc3f3('0x5a')]['body'],'OpenchannelAccountId':_0x2f93ce['id'],'UserId':_0x18167f[_0xc3f3('0x5b')]['id'],'ContactId':_0x112cba['id']})]},{'include':[{'model':db[_0xc3f3('0x99')],'as':_0xc3f3('0xc2')}]})[_0xc3f3('0x1a')](function(_0x19923c){return[_0x19923c,!![]];});});}})[_0xc3f3('0x91')](function(_0x9e03cf,_0x55fe66){if(_0x55fe66){return _0x9e03cf;}return db[_0xc3f3('0x99')][_0xc3f3('0x59')](_[_0xc3f3('0x4b')](_0x18167f[_0xc3f3('0x5a')],{'read':![],'body':_0x18167f[_0xc3f3('0x5a')]['body'],'OpenchannelAccountId':_0x2f93ce['id'],'OpenchannelInteractionId':_0x9e03cf['id'],'UserId':_0x18167f[_0xc3f3('0x5b')]['id'],'ContactId':_0x112cba['id']}))[_0xc3f3('0x1a')](function(_0x469691){_0x9e03cf[_0xc3f3('0xc3')][_0xc3f3('0xc2')]=[];_0x9e03cf[_0xc3f3('0xc3')][_0xc3f3('0xc2')][_0xc3f3('0x96')](_0x469691[_0xc3f3('0xc3')]);return _0x9e03cf;});});}})['then'](respondWithResult(_0x4ce767,null))[_0xc3f3('0x53')](handleError(_0x4ce767,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 395b920..80394ba 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x15f8df,_0x57e122){var _0x12980d=function(_0x3c8116){while(--_0x3c8116){_0x15f8df['push'](_0x15f8df['shift']());}};_0x12980d(++_0x57e122);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var OpenchannelAccount=require(_0x0d8b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){OpenchannelAccountEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);OpenchannelAccountEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0x2547,0x1cd));var _0x7254=function(_0x3f8105,_0x5da3a0){_0x3f8105=_0x3f8105-0x0;var _0x5e5e0d=_0x2547[_0x3f8105];return _0x5e5e0d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 758f631..01db177 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(_0x3cd2b0,_0x556a34){var _0x145449=function(_0x4c7d5f){while(--_0x4c7d5f){_0x3cd2b0['push'](_0x3cd2b0['shift']());}};_0x145449(++_0x556a34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x57fdf5,_0x457a58){var _0x1882b9=function(_0x3d5f35){while(--_0x3d5f35){_0x57fdf5['push'](_0x57fdf5['shift']());}};_0x1882b9(++_0x457a58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 99ba8d9..cdae5f3 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 _0xf4eb=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','stringify','error','code','message','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xf4eb,0xec));var _0xbf4e=function(_0x25bba6,_0xc2a3c4){_0x25bba6=_0x25bba6-0x0;var _0x43361c=_0xf4eb[_0x25bba6];return _0x43361c;};'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});config[_0xbf4e('0x8')]=_['defaults'](config[_0xbf4e('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf4e('0x8')]));require(_0xbf4e('0x9'))[_0xbf4e('0xa')](socket);function respondWithRpcPromise(_0xc86f04,_0x5da823,_0x22668b){return new BPromise(function(_0x177342,_0x580a26){return client['request'](_0xc86f04,_0x22668b)[_0xbf4e('0xb')](function(_0x5a8397){logger[_0xbf4e('0xc')](_0xbf4e('0xd'),_0x5da823,'request\x20sent');logger[_0xbf4e('0xe')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5da823,'request\x20sent',JSON[_0xbf4e('0xf')](_0x5a8397));if(_0x5a8397[_0xbf4e('0x10')]){if(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x11')]===0x1f4){logger[_0xbf4e('0x10')](_0xbf4e('0xd'),_0x5da823,_0x5a8397['error']['message']);return _0x580a26(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);}logger[_0xbf4e('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x5da823,_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);return _0x177342(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);}else{logger['info'](_0xbf4e('0xd'),_0x5da823,'request\x20sent');_0x177342(_0x5a8397['result']['message']);}})['catch'](function(_0x35992b){logger[_0xbf4e('0x10')](_0xbf4e('0xd'),_0x5da823,_0x35992b);_0x580a26(_0x35992b);});});} \ No newline at end of file +var _0x4fad=['request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x5a1892,_0x1675c0){var _0x36def6=function(_0x54fec5){while(--_0x54fec5){_0x5a1892['push'](_0x5a1892['shift']());}};_0x36def6(++_0x1675c0);}(_0x4fad,0xcb));var _0xd4fa=function(_0x4b2326,_0x2a92fb){_0x4b2326=_0x4b2326-0x0;var _0x1d675c=_0x4fad[_0x4b2326];return _0x1d675c;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});config['redis']=_[_0xd4fa('0xc')](config[_0xd4fa('0xd')],{'host':_0xd4fa('0xe'),'port':0x18eb});var socket=require(_0xd4fa('0xf'))(new Redis(config[_0xd4fa('0xd')]));require('./openchannelAccount.socket')[_0xd4fa('0x10')](socket);function respondWithRpcPromise(_0x417404,_0x4623ba,_0x5b5443){return new BPromise(function(_0x2df3c5,_0x612e9d){return client[_0xd4fa('0x11')](_0x417404,_0x5b5443)[_0xd4fa('0x12')](function(_0x5e6a10){logger[_0xd4fa('0x13')](_0xd4fa('0x14'),_0x4623ba,_0xd4fa('0x15'));logger['debug'](_0xd4fa('0x16'),_0x4623ba,_0xd4fa('0x15'),JSON[_0xd4fa('0x17')](_0x5e6a10));if(_0x5e6a10[_0xd4fa('0x18')]){if(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x19')]===0x1f4){logger['error'](_0xd4fa('0x14'),_0x4623ba,_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);return _0x612e9d(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);}logger[_0xd4fa('0x18')](_0xd4fa('0x14'),_0x4623ba,_0x5e6a10['error'][_0xd4fa('0x1a')]);return _0x2df3c5(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4623ba,_0xd4fa('0x15'));_0x2df3c5(_0x5e6a10['result']['message']);}})[_0xd4fa('0x1b')](function(_0x628bc7){logger[_0xd4fa('0x18')](_0xd4fa('0x14'),_0x4623ba,_0x628bc7);_0x612e9d(_0x628bc7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7be0b41..cfaf6de 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 _0x3cfb=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x3ea287,_0x54c538){_0x3ea287=_0x3ea287-0x0;var _0xd5a406=_0x3cfb[_0x3ea287];return _0xd5a406;};'use strict';var OpenchannelAccountEvents=require(_0xb3cf('0x0'));var events=[_0xb3cf('0x1'),_0xb3cf('0x2'),_0xb3cf('0x3')];function createListener(_0xa3584d,_0x147066){return function(_0x3112c1){_0x147066[_0xb3cf('0x4')](_0xa3584d,_0x3112c1);};}function removeListener(_0x51cf89,_0x4740b9){return function(){OpenchannelAccountEvents[_0xb3cf('0x5')](_0x51cf89,_0x4740b9);};}exports[_0xb3cf('0x6')]=function(_0x59c604){for(var _0x2e5c00=0x0,_0x1b7131=events[_0xb3cf('0x7')];_0x2e5c00<_0x1b7131;_0x2e5c00++){var _0x53be8c=events[_0x2e5c00];var _0x19ed7d=createListener('openchannelAccount:'+_0x53be8c,_0x59c604);OpenchannelAccountEvents['on'](_0x53be8c,_0x19ed7d);}}; \ No newline at end of file +var _0x2621=['register','length','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x43d5cd,_0x3d0a0d){var _0x531e87=function(_0x27cdeb){while(--_0x27cdeb){_0x43d5cd['push'](_0x43d5cd['shift']());}};_0x531e87(++_0x3d0a0d);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x1262('0x0'));var events=[_0x1262('0x1'),_0x1262('0x2'),_0x1262('0x3')];function createListener(_0x1e5b47,_0x44878a){return function(_0x2dfe65){_0x44878a[_0x1262('0x4')](_0x1e5b47,_0x2dfe65);};}function removeListener(_0x192339,_0x3a6d7f){return function(){OpenchannelAccountEvents[_0x1262('0x5')](_0x192339,_0x3a6d7f);};}exports[_0x1262('0x6')]=function(_0x421716){for(var _0x16075c=0x0,_0x4d4535=events[_0x1262('0x7')];_0x16075c<_0x4d4535;_0x16075c++){var _0x52af34=events[_0x16075c];var _0xaa3c86=createListener('openchannelAccount:'+_0x52af34,_0x421716);OpenchannelAccountEvents['on'](_0x52af34,_0xaa3c86);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1ea12e5..a3eb587 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 _0xb755=['../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra'];(function(_0x4d3899,_0x19e6a1){var _0x1582bb=function(_0x53b77){while(--_0x53b77){_0x4d3899['push'](_0x4d3899['shift']());}};_0x1582bb(++_0x19e6a1);}(_0xb755,0x94));var _0x5b75=function(_0x463410,_0x33e01a){_0x463410=_0x463410-0x0;var _0x353a0b=_0xb755[_0x463410];return _0x353a0b;};'use strict';var multer=require(_0x5b75('0x0'));var util=require('util');var path=require(_0x5b75('0x1'));var timeout=require(_0x5b75('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5b75('0x3'));var auth=require(_0x5b75('0x4'));var interaction=require(_0x5b75('0x5'));var config=require('../../config/environment');var controller=require(_0x5b75('0x6'));router[_0x5b75('0x7')]('/',auth[_0x5b75('0x8')](),controller[_0x5b75('0x9')]);router[_0x5b75('0x7')](_0x5b75('0xa'),auth['isAuthenticated'](),controller[_0x5b75('0xb')]);router[_0x5b75('0xc')]('/',auth[_0x5b75('0x8')](),controller[_0x5b75('0xd')]);router[_0x5b75('0xe')](_0x5b75('0xa'),auth[_0x5b75('0x8')](),controller[_0x5b75('0xf')]);router[_0x5b75('0x10')](_0x5b75('0xa'),auth[_0x5b75('0x8')](),controller[_0x5b75('0x11')]);module[_0x5b75('0x12')]=router; \ No newline at end of file +var _0x33b4=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x33b4,0xe4));var _0x433b=function(_0x5e1c12,_0x412ba1){_0x5e1c12=_0x5e1c12-0x0;var _0x7bc364=_0x33b4[_0x5e1c12];return _0x7bc364;};'use strict';var multer=require(_0x433b('0x0'));var util=require(_0x433b('0x1'));var path=require(_0x433b('0x2'));var timeout=require('connect-timeout');var express=require(_0x433b('0x3'));var router=express['Router']();var fs_extra=require(_0x433b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x433b('0x5'));var config=require(_0x433b('0x6'));var controller=require(_0x433b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x433b('0x8')]);router[_0x433b('0x9')](_0x433b('0xa'),auth[_0x433b('0xb')](),controller[_0x433b('0xc')]);router[_0x433b('0xd')]('/',auth['isAuthenticated'](),controller[_0x433b('0xe')]);router[_0x433b('0xf')](_0x433b('0xa'),auth[_0x433b('0xb')](),controller[_0x433b('0x10')]);router[_0x433b('0x11')](_0x433b('0xa'),auth[_0x433b('0xb')](),controller[_0x433b('0x12')]);module[_0x433b('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index bc65c59..3944b9c 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 _0x4da5=['INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x3652da,_0x335713){var _0x5ef1c1=function(_0x7cf7aa){while(--_0x7cf7aa){_0x3652da['push'](_0x3652da['shift']());}};_0x5ef1c1(++_0x335713);}(_0x4da5,0x77));var _0x54da=function(_0x3abdaa,_0xb4b2aa){_0x3abdaa=_0x3abdaa-0x0;var _0xea627f=_0x4da5[_0x3abdaa];return _0xea627f;};'use strict';var Sequelize=require(_0x54da('0x0'));module['exports']={'priority':{'type':Sequelize[_0x54da('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54da('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x54da('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x54da('0x4')}}; \ No newline at end of file +var _0xc5a5=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x493ab4,_0x45d1e7){var _0x4c3e95=function(_0x576a22){while(--_0x576a22){_0x493ab4['push'](_0x493ab4['shift']());}};_0x4c3e95(++_0x45d1e7);}(_0xc5a5,0x107));var _0x5c5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5a5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5c5a('0x0'));module[_0x5c5a('0x1')]={'priority':{'type':Sequelize[_0x5c5a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5c5a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5c5a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5c5a('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1826f8a..13c89ad 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 _0xf1b5=['../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','update','destroy','then','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','keys','filters','catch','create','body','find','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xeb8b00,_0x538be0){var _0x104cc1=function(_0x5803c9){while(--_0x5803c9){_0xeb8b00['push'](_0xeb8b00['shift']());}};_0x104cc1(++_0x538be0);}(_0xf1b5,0xb5));var _0x5f1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1b5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f1b('0x0'));var jsonpatch=require(_0x5f1b('0x1'));var rp=require(_0x5f1b('0x2'));var moment=require(_0x5f1b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5f1b('0x4'));var sox=require(_0x5f1b('0x5'));var csv=require('to-csv');var ejs=require(_0x5f1b('0x6'));var fs=require('fs');var fs_extra=require(_0x5f1b('0x7'));var _=require('lodash');var squel=require(_0x5f1b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f1b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x5f1b('0xa'));var Papa=require(_0x5f1b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f1b('0xc'));var as=require(_0x5f1b('0xd'));var hardwareService=require(_0x5f1b('0xe'));var logger=require(_0x5f1b('0xf'))(_0x5f1b('0x10'));var utils=require(_0x5f1b('0x11'));var config=require(_0x5f1b('0x12'));var licenseUtil=require(_0x5f1b('0x13'));var db=require(_0x5f1b('0x14'))['db'];function respondWithStatusCode(_0x143252,_0x5b24a7){_0x5b24a7=_0x5b24a7||0xcc;return function(_0x35cf5a){if(_0x35cf5a){return _0x143252[_0x5f1b('0x15')](_0x5b24a7);}return _0x143252[_0x5f1b('0x16')](_0x5b24a7)[_0x5f1b('0x17')]();};}function respondWithResult(_0x4d45fb,_0xde14b7){_0xde14b7=_0xde14b7||0xc8;return function(_0x1ee9b5){if(_0x1ee9b5){return _0x4d45fb[_0x5f1b('0x16')](_0xde14b7)[_0x5f1b('0x18')](_0x1ee9b5);}};}function respondWithFilteredResult(_0x37197d,_0x4e8726){return function(_0x5eb0a1){if(_0x5eb0a1){var _0x4b84d3=typeof _0x4e8726[_0x5f1b('0x19')]==='undefined'&&typeof _0x4e8726[_0x5f1b('0x1a')]==='undefined';var _0x3f37a3=_0x5eb0a1[_0x5f1b('0x1b')];var _0xb6e6fd=_0x4b84d3?0x0:_0x4e8726['offset'];var _0x25647e=_0x4b84d3?_0x5eb0a1[_0x5f1b('0x1b')]:_0x4e8726['offset']+_0x4e8726[_0x5f1b('0x1a')];var _0x3c60bf;if(_0x25647e>=_0x3f37a3){_0x25647e=_0x3f37a3;_0x3c60bf=0xc8;}else{_0x3c60bf=0xce;}_0x37197d[_0x5f1b('0x16')](_0x3c60bf);return _0x37197d[_0x5f1b('0x1c')]('Content-Range',_0xb6e6fd+'-'+_0x25647e+'/'+_0x3f37a3)[_0x5f1b('0x18')](_0x5eb0a1);}return null;};}function patchUpdates(_0x4f0b1a){return function(_0x2b621b){try{jsonpatch['apply'](_0x2b621b,_0x4f0b1a,!![]);}catch(_0xec5af0){return BPromise[_0x5f1b('0x1d')](_0xec5af0);}return _0x2b621b['save']();};}function saveUpdates(_0x5b99b6,_0x2978a6){return function(_0x37d40f){if(_0x37d40f){return _0x37d40f[_0x5f1b('0x1e')](_0x5b99b6)['then'](function(_0x34e34d){return _0x34e34d;});}return null;};}function removeEntity(_0x2dc576,_0x104c55){return function(_0x96900a){if(_0x96900a){return _0x96900a[_0x5f1b('0x1f')]()[_0x5f1b('0x20')](function(){_0x2dc576['status'](0xcc)[_0x5f1b('0x17')]();});}};}function handleEntityNotFound(_0x3e98f0,_0x206b46){return function(_0x4638a1){if(!_0x4638a1){_0x3e98f0['sendStatus'](0x194);}return _0x4638a1;};}function handleError(_0x2ce4d8,_0x1a7c7b){_0x1a7c7b=_0x1a7c7b||0x1f4;return function(_0x1260f2){logger[_0x5f1b('0x21')](_0x1260f2['stack']);if(_0x1260f2[_0x5f1b('0x22')]){delete _0x1260f2[_0x5f1b('0x22')];}_0x2ce4d8[_0x5f1b('0x16')](_0x1a7c7b)['send'](_0x1260f2);};}exports[_0x5f1b('0x23')]=function(_0x515a81,_0x5d3a48){var _0x4b4422={},_0x502177={},_0x341b4c={'count':0x0,'rows':[]};var _0x4f042b=_[_0x5f1b('0x24')](db[_0x5f1b('0x25')][_0x5f1b('0x26')],function(_0x125fba){return{'name':_0x125fba[_0x5f1b('0x27')],'type':_0x125fba[_0x5f1b('0x28')][_0x5f1b('0x29')]};});_0x502177[_0x5f1b('0x2a')]=_[_0x5f1b('0x24')](_0x4f042b,'name');_0x502177[_0x5f1b('0x2b')]=_['keys'](_0x515a81[_0x5f1b('0x2b')]);_0x502177['filters']=_[_0x5f1b('0x2c')](_0x502177[_0x5f1b('0x2a')],_0x502177['query']);_0x4b4422[_0x5f1b('0x2d')]=_[_0x5f1b('0x2c')](_0x502177[_0x5f1b('0x2a')],qs[_0x5f1b('0x2e')](_0x515a81[_0x5f1b('0x2b')]['fields']));_0x4b4422[_0x5f1b('0x2d')]=_0x4b4422[_0x5f1b('0x2d')][_0x5f1b('0x2f')]?_0x4b4422[_0x5f1b('0x2d')]:_0x502177['model'];if(!_0x515a81[_0x5f1b('0x2b')]['hasOwnProperty'](_0x5f1b('0x30'))){_0x4b4422['limit']=qs[_0x5f1b('0x1a')](_0x515a81[_0x5f1b('0x2b')][_0x5f1b('0x1a')]);_0x4b4422[_0x5f1b('0x19')]=qs[_0x5f1b('0x19')](_0x515a81[_0x5f1b('0x2b')][_0x5f1b('0x19')]);}_0x4b4422[_0x5f1b('0x31')]=qs[_0x5f1b('0x32')](_0x515a81[_0x5f1b('0x2b')][_0x5f1b('0x32')]);_0x4b4422[_0x5f1b('0x33')]=qs['filters'](_[_0x5f1b('0x34')](_0x515a81['query'],_0x502177['filters']),_0x4f042b);if(_0x515a81['query'][_0x5f1b('0x35')]){_0x4b4422[_0x5f1b('0x33')]=_['merge'](_0x4b4422[_0x5f1b('0x33')],{'$or':_[_0x5f1b('0x24')](_0x4f042b,function(_0x57dee9){if(_0x57dee9['type']!==_0x5f1b('0x36')){var _0x5ca583={};_0x5ca583[_0x57dee9[_0x5f1b('0x22')]]={'$like':'%'+_0x515a81[_0x5f1b('0x2b')][_0x5f1b('0x35')]+'%'};return _0x5ca583;}})});}_0x4b4422=_[_0x5f1b('0x37')]({},_0x4b4422,_0x515a81[_0x5f1b('0x38')]);var _0x39cc9a={'where':_0x4b4422[_0x5f1b('0x33')]};return db['OpenchannelApplication'][_0x5f1b('0x1b')](_0x39cc9a)[_0x5f1b('0x20')](function(_0x14d8b6){_0x341b4c['count']=_0x14d8b6;if(_0x515a81['query'][_0x5f1b('0x39')]){_0x4b4422[_0x5f1b('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x4b4422);})['then'](function(_0x5c72b9){_0x341b4c['rows']=_0x5c72b9;return _0x341b4c;})['then'](respondWithFilteredResult(_0x5d3a48,_0x4b4422))['catch'](handleError(_0x5d3a48,null));};exports[_0x5f1b('0x3b')]=function(_0x59a8e6,_0x32a7a5){var _0x34905a={'raw':!![],'where':{'id':_0x59a8e6[_0x5f1b('0x3c')]['id']}},_0x2118ac={};_0x2118ac[_0x5f1b('0x2a')]=_['keys'](db[_0x5f1b('0x25')]['rawAttributes']);_0x2118ac[_0x5f1b('0x2b')]=_[_0x5f1b('0x3d')](_0x59a8e6['query']);_0x2118ac[_0x5f1b('0x3e')]=_['intersection'](_0x2118ac[_0x5f1b('0x2a')],_0x2118ac[_0x5f1b('0x2b')]);_0x34905a[_0x5f1b('0x2d')]=_[_0x5f1b('0x2c')](_0x2118ac['model'],qs[_0x5f1b('0x2e')](_0x59a8e6['query'][_0x5f1b('0x2e')]));_0x34905a[_0x5f1b('0x2d')]=_0x34905a[_0x5f1b('0x2d')][_0x5f1b('0x2f')]?_0x34905a[_0x5f1b('0x2d')]:_0x2118ac[_0x5f1b('0x2a')];if(_0x59a8e6[_0x5f1b('0x2b')][_0x5f1b('0x39')]){_0x34905a[_0x5f1b('0x3a')]=[{'all':!![]}];}_0x34905a=_[_0x5f1b('0x37')]({},_0x34905a,_0x59a8e6['options']);return db[_0x5f1b('0x25')]['find'](_0x34905a)[_0x5f1b('0x20')](handleEntityNotFound(_0x32a7a5,null))[_0x5f1b('0x20')](respondWithResult(_0x32a7a5,null))[_0x5f1b('0x3f')](handleError(_0x32a7a5,null));};exports[_0x5f1b('0x40')]=function(_0x393e73,_0x28086a){return db['OpenchannelApplication'][_0x5f1b('0x40')](_0x393e73[_0x5f1b('0x41')],{})[_0x5f1b('0x20')](respondWithResult(_0x28086a,0xc9))[_0x5f1b('0x3f')](handleError(_0x28086a,null));};exports['update']=function(_0xd2a4f1,_0x996374){if(_0xd2a4f1['body']['id']){delete _0xd2a4f1[_0x5f1b('0x41')]['id'];}return db[_0x5f1b('0x25')][_0x5f1b('0x42')]({'where':{'id':_0xd2a4f1[_0x5f1b('0x3c')]['id']}})[_0x5f1b('0x20')](handleEntityNotFound(_0x996374,null))[_0x5f1b('0x20')](saveUpdates(_0xd2a4f1[_0x5f1b('0x41')],null))[_0x5f1b('0x20')](respondWithResult(_0x996374,null))[_0x5f1b('0x3f')](handleError(_0x996374,null));};exports['destroy']=function(_0x21c940,_0x3f2b42){return db[_0x5f1b('0x25')][_0x5f1b('0x42')]({'where':{'id':_0x21c940[_0x5f1b('0x3c')]['id']}})[_0x5f1b('0x20')](handleEntityNotFound(_0x3f2b42,null))[_0x5f1b('0x20')](removeEntity(_0x3f2b42,null))[_0x5f1b('0x3f')](handleError(_0x3f2b42,null));}; \ No newline at end of file +var _0x8feb=['where','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','send','index','map','OpenchannelApplication','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick'];(function(_0x44fe12,_0x1a7f47){var _0x3eeb75=function(_0x39dbe7){while(--_0x39dbe7){_0x44fe12['push'](_0x44fe12['shift']());}};_0x3eeb75(++_0x1a7f47);}(_0x8feb,0x135));var _0xb8fe=function(_0x20c7a2,_0x1175f8){_0x20c7a2=_0x20c7a2-0x0;var _0x26d85e=_0x8feb[_0x20c7a2];return _0x26d85e;};'use strict';var emlformat=require(_0xb8fe('0x0'));var rimraf=require(_0xb8fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8fe('0x2'));var rp=require('request-promise');var moment=require(_0xb8fe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb8fe('0x4'));var util=require(_0xb8fe('0x5'));var path=require(_0xb8fe('0x6'));var sox=require(_0xb8fe('0x7'));var csv=require(_0xb8fe('0x8'));var ejs=require(_0xb8fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8fe('0xa'));var squel=require(_0xb8fe('0xb'));var crypto=require(_0xb8fe('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8fe('0xd'));var Redis=require(_0xb8fe('0xe'));var authService=require(_0xb8fe('0xf'));var qs=require(_0xb8fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8fe('0x11'));var logger=require(_0xb8fe('0x12'))(_0xb8fe('0x13'));var utils=require('../../config/utils');var config=require(_0xb8fe('0x14'));var licenseUtil=require(_0xb8fe('0x15'));var db=require(_0xb8fe('0x16'))['db'];function respondWithStatusCode(_0xe294c8,_0x4bfa74){_0x4bfa74=_0x4bfa74||0xcc;return function(_0x32a763){if(_0x32a763){return _0xe294c8[_0xb8fe('0x17')](_0x4bfa74);}return _0xe294c8[_0xb8fe('0x18')](_0x4bfa74)[_0xb8fe('0x19')]();};}function respondWithResult(_0xb63b19,_0x6fa81d){_0x6fa81d=_0x6fa81d||0xc8;return function(_0x3a38d8){if(_0x3a38d8){return _0xb63b19[_0xb8fe('0x18')](_0x6fa81d)[_0xb8fe('0x1a')](_0x3a38d8);}};}function respondWithFilteredResult(_0x2c08ae,_0x47d959){return function(_0x678551){if(_0x678551){var _0xd0e006=typeof _0x47d959[_0xb8fe('0x1b')]===_0xb8fe('0x1c')&&typeof _0x47d959['limit']===_0xb8fe('0x1c');var _0x895d67=_0x678551['count'];var _0x4b73cd=_0xd0e006?0x0:_0x47d959[_0xb8fe('0x1b')];var _0x57d328=_0xd0e006?_0x678551['count']:_0x47d959[_0xb8fe('0x1b')]+_0x47d959[_0xb8fe('0x1d')];var _0x56a8a9;if(_0x57d328>=_0x895d67){_0x57d328=_0x895d67;_0x56a8a9=0xc8;}else{_0x56a8a9=0xce;}_0x2c08ae[_0xb8fe('0x18')](_0x56a8a9);return _0x2c08ae[_0xb8fe('0x1e')]('Content-Range',_0x4b73cd+'-'+_0x57d328+'/'+_0x895d67)[_0xb8fe('0x1a')](_0x678551);}return null;};}function patchUpdates(_0x21ae74){return function(_0x10ce88){try{jsonpatch[_0xb8fe('0x1f')](_0x10ce88,_0x21ae74,!![]);}catch(_0x5d1099){return BPromise[_0xb8fe('0x20')](_0x5d1099);}return _0x10ce88[_0xb8fe('0x21')]();};}function saveUpdates(_0x46524a,_0x5f31b8){return function(_0xacfc0b){if(_0xacfc0b){return _0xacfc0b[_0xb8fe('0x22')](_0x46524a)[_0xb8fe('0x23')](function(_0x28bd13){return _0x28bd13;});}return null;};}function removeEntity(_0x5eba96,_0x1eee7e){return function(_0x4d9e35){if(_0x4d9e35){return _0x4d9e35['destroy']()['then'](function(){_0x5eba96[_0xb8fe('0x18')](0xcc)[_0xb8fe('0x19')]();});}};}function handleEntityNotFound(_0x378b66,_0x41059d){return function(_0xbe395b){if(!_0xbe395b){_0x378b66[_0xb8fe('0x17')](0x194);}return _0xbe395b;};}function handleError(_0x273e16,_0xd408b9){_0xd408b9=_0xd408b9||0x1f4;return function(_0x11a042){logger[_0xb8fe('0x24')](_0x11a042['stack']);if(_0x11a042[_0xb8fe('0x25')]){delete _0x11a042['name'];}_0x273e16[_0xb8fe('0x18')](_0xd408b9)[_0xb8fe('0x26')](_0x11a042);};}exports[_0xb8fe('0x27')]=function(_0x7d07e0,_0x351203){var _0x52c931={},_0x1ef680={},_0x4ec1bc={'count':0x0,'rows':[]};var _0x5cfe7e=_[_0xb8fe('0x28')](db[_0xb8fe('0x29')]['rawAttributes'],function(_0x31042d){return{'name':_0x31042d[_0xb8fe('0x2a')],'type':_0x31042d[_0xb8fe('0x2b')]['key']};});_0x1ef680['model']=_[_0xb8fe('0x28')](_0x5cfe7e,_0xb8fe('0x25'));_0x1ef680[_0xb8fe('0x2c')]=_[_0xb8fe('0x2d')](_0x7d07e0[_0xb8fe('0x2c')]);_0x1ef680[_0xb8fe('0x2e')]=_[_0xb8fe('0x2f')](_0x1ef680[_0xb8fe('0x30')],_0x1ef680['query']);_0x52c931['attributes']=_[_0xb8fe('0x2f')](_0x1ef680[_0xb8fe('0x30')],qs[_0xb8fe('0x31')](_0x7d07e0[_0xb8fe('0x2c')][_0xb8fe('0x31')]));_0x52c931['attributes']=_0x52c931[_0xb8fe('0x32')][_0xb8fe('0x33')]?_0x52c931['attributes']:_0x1ef680[_0xb8fe('0x30')];if(!_0x7d07e0['query'][_0xb8fe('0x34')]('nolimit')){_0x52c931[_0xb8fe('0x1d')]=qs[_0xb8fe('0x1d')](_0x7d07e0[_0xb8fe('0x2c')][_0xb8fe('0x1d')]);_0x52c931[_0xb8fe('0x1b')]=qs[_0xb8fe('0x1b')](_0x7d07e0[_0xb8fe('0x2c')][_0xb8fe('0x1b')]);}_0x52c931[_0xb8fe('0x35')]=qs[_0xb8fe('0x36')](_0x7d07e0['query']['sort']);_0x52c931['where']=qs['filters'](_[_0xb8fe('0x37')](_0x7d07e0['query'],_0x1ef680['filters']),_0x5cfe7e);if(_0x7d07e0[_0xb8fe('0x2c')]['filter']){_0x52c931[_0xb8fe('0x38')]=_[_0xb8fe('0x39')](_0x52c931[_0xb8fe('0x38')],{'$or':_['map'](_0x5cfe7e,function(_0x23d0b0){if(_0x23d0b0[_0xb8fe('0x2b')]!==_0xb8fe('0x3a')){var _0xf4c4b7={};_0xf4c4b7[_0x23d0b0[_0xb8fe('0x25')]]={'$like':'%'+_0x7d07e0[_0xb8fe('0x2c')][_0xb8fe('0x3b')]+'%'};return _0xf4c4b7;}})});}_0x52c931=_[_0xb8fe('0x39')]({},_0x52c931,_0x7d07e0[_0xb8fe('0x3c')]);var _0x424f95={'where':_0x52c931[_0xb8fe('0x38')]};return db[_0xb8fe('0x29')][_0xb8fe('0x3d')](_0x424f95)[_0xb8fe('0x23')](function(_0x5571d8){_0x4ec1bc[_0xb8fe('0x3d')]=_0x5571d8;if(_0x7d07e0[_0xb8fe('0x2c')][_0xb8fe('0x3e')]){_0x52c931['include']=[{'all':!![]}];}return db[_0xb8fe('0x29')][_0xb8fe('0x3f')](_0x52c931);})[_0xb8fe('0x23')](function(_0x3e5816){_0x4ec1bc['rows']=_0x3e5816;return _0x4ec1bc;})[_0xb8fe('0x23')](respondWithFilteredResult(_0x351203,_0x52c931))[_0xb8fe('0x40')](handleError(_0x351203,null));};exports[_0xb8fe('0x41')]=function(_0x288b06,_0x28a5c1){var _0x589d77={'raw':!![],'where':{'id':_0x288b06[_0xb8fe('0x42')]['id']}},_0x4df45e={};_0x4df45e[_0xb8fe('0x30')]=_['keys'](db[_0xb8fe('0x29')][_0xb8fe('0x43')]);_0x4df45e[_0xb8fe('0x2c')]=_[_0xb8fe('0x2d')](_0x288b06[_0xb8fe('0x2c')]);_0x4df45e[_0xb8fe('0x2e')]=_[_0xb8fe('0x2f')](_0x4df45e[_0xb8fe('0x30')],_0x4df45e[_0xb8fe('0x2c')]);_0x589d77['attributes']=_[_0xb8fe('0x2f')](_0x4df45e[_0xb8fe('0x30')],qs['fields'](_0x288b06[_0xb8fe('0x2c')][_0xb8fe('0x31')]));_0x589d77[_0xb8fe('0x32')]=_0x589d77[_0xb8fe('0x32')][_0xb8fe('0x33')]?_0x589d77[_0xb8fe('0x32')]:_0x4df45e[_0xb8fe('0x30')];if(_0x288b06[_0xb8fe('0x2c')]['includeAll']){_0x589d77[_0xb8fe('0x44')]=[{'all':!![]}];}_0x589d77=_[_0xb8fe('0x39')]({},_0x589d77,_0x288b06['options']);return db[_0xb8fe('0x29')]['find'](_0x589d77)[_0xb8fe('0x23')](handleEntityNotFound(_0x28a5c1,null))[_0xb8fe('0x23')](respondWithResult(_0x28a5c1,null))[_0xb8fe('0x40')](handleError(_0x28a5c1,null));};exports[_0xb8fe('0x45')]=function(_0x3c403d,_0x4832ca){return db['OpenchannelApplication']['create'](_0x3c403d[_0xb8fe('0x46')],{})[_0xb8fe('0x23')](respondWithResult(_0x4832ca,0xc9))[_0xb8fe('0x40')](handleError(_0x4832ca,null));};exports[_0xb8fe('0x22')]=function(_0x5b854e,_0xa32f70){if(_0x5b854e[_0xb8fe('0x46')]['id']){delete _0x5b854e[_0xb8fe('0x46')]['id'];}return db[_0xb8fe('0x29')][_0xb8fe('0x47')]({'where':{'id':_0x5b854e[_0xb8fe('0x42')]['id']}})['then'](handleEntityNotFound(_0xa32f70,null))[_0xb8fe('0x23')](saveUpdates(_0x5b854e[_0xb8fe('0x46')],null))[_0xb8fe('0x23')](respondWithResult(_0xa32f70,null))[_0xb8fe('0x40')](handleError(_0xa32f70,null));};exports[_0xb8fe('0x48')]=function(_0x1decdf,_0x1ac398){return db[_0xb8fe('0x29')]['find']({'where':{'id':_0x1decdf[_0xb8fe('0x42')]['id']}})[_0xb8fe('0x23')](handleEntityNotFound(_0x1ac398,null))[_0xb8fe('0x23')](removeEntity(_0x1ac398,null))[_0xb8fe('0x40')](handleError(_0x1ac398,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 56e4727..19b23e8 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 _0x580c=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x32b1f3,_0x149f0a){var _0x2a1599=function(_0x24e30d){while(--_0x24e30d){_0x32b1f3['push'](_0x32b1f3['shift']());}};_0x2a1599(++_0x149f0a);}(_0x580c,0xd0));var _0xc580=function(_0x245d07,_0x22652c){_0x245d07=_0x245d07-0x0;var _0x1ffa28=_0x580c[_0x245d07];return _0x1ffa28;};'use strict';var _=require(_0xc580('0x0'));var util=require(_0xc580('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc580('0x2'));var BPromise=require(_0xc580('0x3'));var rp=require(_0xc580('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc580('0x5'));var config=require(_0xc580('0x6'));var attributes=require(_0xc580('0x7'));module[_0xc580('0x8')]=function(_0x15e936,_0x3ccf39){return _0x15e936[_0xc580('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xc580('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc580('0xb'),'collate':_0xc580('0xc')});}; \ No newline at end of file +var _0x33c4=['./openchannelApplication.attributes','exports','openchannel_applications','lodash','api','moment','bluebird','path','rimraf'];(function(_0x4f6fd0,_0xe5914e){var _0x3d1d92=function(_0x511937){while(--_0x511937){_0x4f6fd0['push'](_0x4f6fd0['shift']());}};_0x3d1d92(++_0xe5914e);}(_0x33c4,0xb7));var _0x433c=function(_0x21d451,_0x1a6aec){_0x21d451=_0x21d451-0x0;var _0x523736=_0x33c4[_0x21d451];return _0x523736;};'use strict';var _=require(_0x433c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x433c('0x1'));var moment=require(_0x433c('0x2'));var BPromise=require(_0x433c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x433c('0x4'));var rimraf=require(_0x433c('0x5'));var config=require('../../config/environment');var attributes=require(_0x433c('0x6'));module[_0x433c('0x7')]=function(_0x399981,_0x130705){return _0x399981['define']('OpenchannelApplication',attributes,{'tableName':_0x433c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b57fcf0..0eb7f69 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 _0x5946=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','OpenchannelApplication,\x20%s,\x20%s','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','stringify','lodash','util','moment'];(function(_0x49621a,_0x13481a){var _0x10a75f=function(_0x219862){while(--_0x219862){_0x49621a['push'](_0x49621a['shift']());}};_0x10a75f(++_0x13481a);}(_0x5946,0x147));var _0x6594=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x5946[_0x146a97];return _0x259d5c;};'use strict';var _=require(_0x6594('0x0'));var util=require(_0x6594('0x1'));var moment=require(_0x6594('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6594('0x3'));var db=require(_0x6594('0x4'))['db'];var utils=require(_0x6594('0x5'));var logger=require(_0x6594('0x6'))(_0x6594('0x7'));var config=require(_0x6594('0x8'));var jayson=require(_0x6594('0x9'));var client=jayson[_0x6594('0xa')][_0x6594('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d959,_0x58c7c4,_0x5b28bb){return new BPromise(function(_0x54b967,_0x2fdad7){return client[_0x6594('0xc')](_0x36d959,_0x5b28bb)[_0x6594('0xd')](function(_0x202e9f){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x58c7c4,'request\x20sent');logger['debug'](_0x6594('0xe'),_0x58c7c4,_0x6594('0xf'),JSON['stringify'](_0x202e9f));if(_0x202e9f['error']){if(_0x202e9f[_0x6594('0x10')][_0x6594('0x11')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x58c7c4,_0x202e9f['error'][_0x6594('0x12')]);return _0x2fdad7(_0x202e9f[_0x6594('0x10')][_0x6594('0x12')]);}logger[_0x6594('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x58c7c4,_0x202e9f[_0x6594('0x10')][_0x6594('0x12')]);return _0x54b967(_0x202e9f[_0x6594('0x10')][_0x6594('0x12')]);}else{logger[_0x6594('0x13')](_0x6594('0x14'),_0x58c7c4,'request\x20sent');_0x54b967(_0x202e9f[_0x6594('0x15')][_0x6594('0x12')]);}})[_0x6594('0x16')](function(_0x3efcfd){logger[_0x6594('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x58c7c4,_0x3efcfd);_0x2fdad7(_0x3efcfd);});});}exports['UpdateOpenchannelApplication']=function(_0x5c8fcf){var _0x8a6e48=this;return new Promise(function(_0x3c4128,_0x1e0b25){return db[_0x6594('0x17')][_0x6594('0x18')](_0x5c8fcf[_0x6594('0x19')],{'raw':_0x5c8fcf['options']?_0x5c8fcf[_0x6594('0x1a')][_0x6594('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c8fcf['options']?_0x5c8fcf[_0x6594('0x1a')][_0x6594('0x1c')]||null:null,'attributes':_0x5c8fcf['options']?_0x5c8fcf['options'][_0x6594('0x1d')]||null:null,'limit':_0x5c8fcf['options']?_0x5c8fcf['options'][_0x6594('0x1e')]||null:null})[_0x6594('0xd')](function(_0x2cbbb2){logger[_0x6594('0x13')](_0x6594('0x1f'),_0x5c8fcf);logger['debug']('UpdateOpenchannelApplication',_0x5c8fcf,JSON[_0x6594('0x20')](_0x2cbbb2));_0x3c4128(_0x2cbbb2);})['catch'](function(_0x177716){logger[_0x6594('0x10')]('UpdateOpenchannelApplication',_0x177716[_0x6594('0x12')],_0x5c8fcf);_0x1e0b25(_0x8a6e48[_0x6594('0x10')](0x1f4,_0x177716[_0x6594('0x12')]));});});}; \ No newline at end of file +var _0xce48=['then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request'];(function(_0x48bfcb,_0x2d66f9){var _0x7c97e1=function(_0x48957e){while(--_0x48957e){_0x48bfcb['push'](_0x48bfcb['shift']());}};_0x7c97e1(++_0x2d66f9);}(_0xce48,0x83));var _0x8ce4=function(_0x31e4c6,_0x27d39c){_0x31e4c6=_0x31e4c6-0x0;var _0x56c225=_0xce48[_0x31e4c6];return _0x56c225;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ce4('0x0'));var BPromise=require(_0x8ce4('0x1'));var rs=require(_0x8ce4('0x2'));var fs=require('fs');var Redis=require(_0x8ce4('0x3'));var db=require(_0x8ce4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ce4('0x5'));var config=require(_0x8ce4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ce4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6fb358,_0x338df6,_0xcc62ac){return new BPromise(function(_0x1a55fb,_0x298c2f){return client[_0x8ce4('0x8')](_0x6fb358,_0xcc62ac)[_0x8ce4('0x9')](function(_0x5bf1a7){logger['info'](_0x8ce4('0xa'),_0x338df6,_0x8ce4('0xb'));logger['debug'](_0x8ce4('0xc'),_0x338df6,_0x8ce4('0xb'),JSON['stringify'](_0x5bf1a7));if(_0x5bf1a7[_0x8ce4('0xd')]){if(_0x5bf1a7['error'][_0x8ce4('0xe')]===0x1f4){logger[_0x8ce4('0xd')](_0x8ce4('0xa'),_0x338df6,_0x5bf1a7[_0x8ce4('0xd')][_0x8ce4('0xf')]);return _0x298c2f(_0x5bf1a7['error'][_0x8ce4('0xf')]);}logger['error'](_0x8ce4('0xa'),_0x338df6,_0x5bf1a7[_0x8ce4('0xd')][_0x8ce4('0xf')]);return _0x1a55fb(_0x5bf1a7[_0x8ce4('0xd')][_0x8ce4('0xf')]);}else{logger[_0x8ce4('0x10')](_0x8ce4('0xa'),_0x338df6,'request\x20sent');_0x1a55fb(_0x5bf1a7['result'][_0x8ce4('0xf')]);}})[_0x8ce4('0x11')](function(_0x2b412b){logger[_0x8ce4('0xd')](_0x8ce4('0xa'),_0x338df6,_0x2b412b);_0x298c2f(_0x2b412b);});});}exports[_0x8ce4('0x12')]=function(_0x14eedb){var _0x37c609=this;return new Promise(function(_0x5b8676,_0x1f98e9){return db[_0x8ce4('0x13')][_0x8ce4('0x14')](_0x14eedb[_0x8ce4('0x15')],{'raw':_0x14eedb[_0x8ce4('0x16')]?_0x14eedb['options'][_0x8ce4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14eedb[_0x8ce4('0x16')]?_0x14eedb['options'][_0x8ce4('0x18')]||null:null,'attributes':_0x14eedb[_0x8ce4('0x16')]?_0x14eedb[_0x8ce4('0x16')]['attributes']||null:null,'limit':_0x14eedb[_0x8ce4('0x16')]?_0x14eedb[_0x8ce4('0x16')][_0x8ce4('0x19')]||null:null})[_0x8ce4('0x9')](function(_0x23e691){logger[_0x8ce4('0x10')](_0x8ce4('0x12'),_0x14eedb);logger[_0x8ce4('0x1a')](_0x8ce4('0x12'),_0x14eedb,JSON[_0x8ce4('0x1b')](_0x23e691));_0x5b8676(_0x23e691);})[_0x8ce4('0x11')](function(_0x21238a){logger[_0x8ce4('0xd')](_0x8ce4('0x12'),_0x21238a['message'],_0x14eedb);_0x1f98e9(_0x37c609[_0x8ce4('0xd')](0x1f4,_0x21238a[_0x8ce4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1db990e..18f8ac0 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 _0xa297=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x1e3799,_0x271097){var _0x266372=function(_0x3515c1){while(--_0x3515c1){_0x1e3799['push'](_0x1e3799['shift']());}};_0x266372(++_0x271097);}(_0xa297,0x159));var _0x7a29=function(_0x4a31db,_0x48db8c){_0x4a31db=_0x4a31db-0x0;var _0x182669=_0xa297[_0x4a31db];return _0x182669;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a29('0x0'));var timeout=require(_0x7a29('0x1'));var express=require(_0x7a29('0x2'));var router=express[_0x7a29('0x3')]();var fs_extra=require(_0x7a29('0x4'));var auth=require(_0x7a29('0x5'));var interaction=require(_0x7a29('0x6'));var config=require(_0x7a29('0x7'));var controller=require(_0x7a29('0x8'));router[_0x7a29('0x9')]('/',auth[_0x7a29('0xa')](),controller[_0x7a29('0xb')]);router[_0x7a29('0x9')](_0x7a29('0xc'),auth[_0x7a29('0xa')](),controller[_0x7a29('0xd')]);router[_0x7a29('0x9')](_0x7a29('0xe'),auth[_0x7a29('0xa')](),controller[_0x7a29('0xf')]);router['get'](_0x7a29('0x10'),auth[_0x7a29('0xa')](),controller[_0x7a29('0x11')]);router[_0x7a29('0x9')](_0x7a29('0x12'),auth[_0x7a29('0xa')](),controller[_0x7a29('0x13')]);router[_0x7a29('0x14')]('/',auth[_0x7a29('0xa')](),controller[_0x7a29('0x15')]);router[_0x7a29('0x14')]('/:id/messages',auth[_0x7a29('0xa')](),controller[_0x7a29('0x16')]);router['post'](_0x7a29('0x17'),auth[_0x7a29('0xa')](),interaction[_0x7a29('0x18')](_0x7a29('0x19'),_0x7a29('0x1a')),controller[_0x7a29('0x1b')]);router[_0x7a29('0x1c')](_0x7a29('0xe'),auth['isAuthenticated'](),interaction[_0x7a29('0x18')](_0x7a29('0x19'),_0x7a29('0x1d')),controller[_0x7a29('0x1e')]);router['delete'](_0x7a29('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x7a29('0x19'),_0x7a29('0x1f')),controller['destroy']);router[_0x7a29('0x20')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7a29('0x21')]);module[_0x7a29('0x22')]=router; \ No newline at end of file +var _0xb72a=['path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0x1286d5,_0x5c2870){var _0x1e06b0=function(_0x337496){while(--_0x337496){_0x1286d5['push'](_0x1286d5['shift']());}};_0x1e06b0(++_0x5c2870);}(_0xb72a,0xde));var _0xab72=function(_0x28c317,_0x56fe9d){_0x28c317=_0x28c317-0x0;var _0x2877e0=_0xb72a[_0x28c317];return _0x2877e0;};'use strict';var multer=require(_0xab72('0x0'));var util=require(_0xab72('0x1'));var path=require(_0xab72('0x2'));var timeout=require('connect-timeout');var express=require(_0xab72('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab72('0x4'));var config=require(_0xab72('0x5'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xab72('0x6')](),controller[_0xab72('0x7')]);router['get'](_0xab72('0x8'),auth[_0xab72('0x6')](),controller[_0xab72('0x9')]);router[_0xab72('0xa')](_0xab72('0xb'),auth[_0xab72('0x6')](),controller[_0xab72('0xc')]);router[_0xab72('0xa')](_0xab72('0xd'),auth['isAuthenticated'](),controller[_0xab72('0xe')]);router['get'](_0xab72('0xf'),auth[_0xab72('0x6')](),controller[_0xab72('0x10')]);router['post']('/',auth[_0xab72('0x6')](),controller[_0xab72('0x11')]);router[_0xab72('0x12')](_0xab72('0xd'),auth[_0xab72('0x6')](),controller['addMessage']);router[_0xab72('0x12')](_0xab72('0x13'),auth[_0xab72('0x6')](),interaction[_0xab72('0x14')](_0xab72('0x15'),_0xab72('0x16')),controller[_0xab72('0x17')]);router[_0xab72('0x18')](_0xab72('0xb'),auth['isAuthenticated'](),interaction[_0xab72('0x14')](_0xab72('0x15'),_0xab72('0x19')),controller[_0xab72('0x1a')]);router[_0xab72('0x1b')]('/:id',auth[_0xab72('0x6')](),interaction[_0xab72('0x14')](_0xab72('0x15'),_0xab72('0x1c')),controller[_0xab72('0x1d')]);router[_0xab72('0x1b')](_0xab72('0x13'),auth[_0xab72('0x6')](),controller[_0xab72('0x1e')]);module[_0xab72('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 2ba5f41..50c98eb 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 _0xcabe=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x28be2c,_0x2c43bd){var _0x34db77=function(_0xa12d9a){while(--_0xa12d9a){_0x28be2c['push'](_0x28be2c['shift']());}};_0x34db77(++_0x2c43bd);}(_0xcabe,0x1ef));var _0xecab=function(_0x2f56c,_0x82ff1){_0x2f56c=_0x2f56c-0x0;var _0x149bff=_0xcabe[_0x2f56c];return _0x149bff;};'use strict';var Sequelize=require(_0xecab('0x0'));module['exports']={'closed':{'type':Sequelize[_0xecab('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xecab('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xecab('0x3')]},'thirdDisposition':{'type':Sequelize[_0xecab('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xecab('0x2')]},'threadId':{'type':Sequelize[_0xecab('0x3')]},'externalUrl':{'type':Sequelize[_0xecab('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xecab('0x4')]('in',_0xecab('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xecab('0x4')]('in',_0xecab('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xecab('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xecab('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xecab('0x6')]}}; \ No newline at end of file +var _0x6b1e=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b1e,0xd3));var _0xe6b1=function(_0x393c29,_0x2a94ab){_0x393c29=_0x393c29-0x0;var _0x1eb139=_0x6b1e[_0x393c29];return _0x1eb139;};'use strict';var Sequelize=require(_0xe6b1('0x0'));module[_0xe6b1('0x1')]={'closed':{'type':Sequelize[_0xe6b1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe6b1('0x3')]},'disposition':{'type':Sequelize[_0xe6b1('0x4')]},'secondDisposition':{'type':Sequelize[_0xe6b1('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe6b1('0x4')]},'note':{'type':Sequelize[_0xe6b1('0x4')]},'read1stAt':{'type':Sequelize[_0xe6b1('0x3')]},'threadId':{'type':Sequelize[_0xe6b1('0x4')]},'externalUrl':{'type':Sequelize[_0xe6b1('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe6b1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe6b1('0x5')]('in',_0xe6b1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe6b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe6b1('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe6b1('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe6b1('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ce75c6e..e848b6b 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 _0xa1ca=['status','json','offset','undefined','limit','set','Content-Range','destroy','then','end','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','user','show','query','from','params','model','keys','filters','intersection','fields','attributes','length','merge','options','find','catch','create','body','update','addMessage','ids','omit','findOne','hasOwnProperty','order','sort','pick','where','OpenchannelInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','count','includeAll','include','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','read','OpenchannelAccount','Account','Owner','fullname','mkdirSync','Openchannel','closed','disposition','threadId','Public','basename','existsSync','createReadStream','direction','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0xa1ca,0x178));var _0xaa1c=function(_0x30c48d,_0x25e828){_0x30c48d=_0x30c48d-0x0;var _0x2c64aa=_0xa1ca[_0x30c48d];return _0x2c64aa;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var util=require(_0xaa1c('0x0'));var path=require(_0xaa1c('0x1'));var ejs=require(_0xaa1c('0x2'));var fs=require('fs');var _=require(_0xaa1c('0x3'));var Redis=require(_0xaa1c('0x4'));var interaction=require(_0xaa1c('0x5'));var qs=require(_0xaa1c('0x6'));var pdf=require(_0xaa1c('0x7'));var logger=require('../../config/logger')(_0xaa1c('0x8'));var config=require(_0xaa1c('0x9'));var db=require(_0xaa1c('0xa'))['db'];config[_0xaa1c('0xb')]=_[_0xaa1c('0xc')](config[_0xaa1c('0xb')],{'host':_0xaa1c('0xd'),'port':0x18eb});var socket=require(_0xaa1c('0xe'))(new Redis(config[_0xaa1c('0xb')]));require(_0xaa1c('0xf'))['register'](socket);function respondWithStatusCode(_0x4451d4,_0x53d98f){_0x53d98f=_0x53d98f||0xcc;return function(_0x388819){if(_0x388819){return _0x4451d4[_0xaa1c('0x10')](_0x53d98f);}return _0x4451d4[_0xaa1c('0x11')](_0x53d98f)['end']();};}function respondWithResult(_0x48fea3,_0x5bb56a){_0x5bb56a=_0x5bb56a||0xc8;return function(_0x2cb5f2){if(_0x2cb5f2){return _0x48fea3[_0xaa1c('0x11')](_0x5bb56a)[_0xaa1c('0x12')](_0x2cb5f2);}};}function respondWithFilteredResult(_0x2636b1,_0x330672){return function(_0x9050b5){if(_0x9050b5){var _0x54e5d5=typeof _0x330672[_0xaa1c('0x13')]===_0xaa1c('0x14')&&typeof _0x330672['limit']===_0xaa1c('0x14');var _0x56bbde=_0x9050b5['count'];var _0x3d1a73=_0x54e5d5?0x0:_0x330672['offset'];var _0x59482d=_0x54e5d5?_0x9050b5['count']:_0x330672[_0xaa1c('0x13')]+_0x330672[_0xaa1c('0x15')];var _0xe04e87;if(_0x59482d>=_0x56bbde){_0x59482d=_0x56bbde;_0xe04e87=0xc8;}else{_0xe04e87=0xce;}_0x2636b1['status'](_0xe04e87);return _0x2636b1[_0xaa1c('0x16')](_0xaa1c('0x17'),_0x3d1a73+'-'+_0x59482d+'/'+_0x56bbde)[_0xaa1c('0x12')](_0x9050b5);}return null;};}function saveUpdates(_0x57caf3){return function(_0x3d13e9){if(_0x3d13e9){return _0x3d13e9['update'](_0x57caf3)['then'](function(_0x28ffa4){return _0x28ffa4;});}return null;};}function removeEntity(_0x30cea5){return function(_0x4d950a){if(_0x4d950a){return _0x4d950a[_0xaa1c('0x18')]()[_0xaa1c('0x19')](function(){_0x30cea5[_0xaa1c('0x11')](0xcc)[_0xaa1c('0x1a')]();});}};}function handleEntityNotFound(_0x4876c0){return function(_0xd6fbe7){if(!_0xd6fbe7){_0x4876c0[_0xaa1c('0x10')](0x194);}return _0xd6fbe7;};}function handleError(_0x102b82,_0x5aeb48){_0x5aeb48=_0x5aeb48||0x1f4;return function(_0x2cfad0){logger[_0xaa1c('0x1b')](_0x2cfad0[_0xaa1c('0x1c')]);if(_0x2cfad0[_0xaa1c('0x1d')]){delete _0x2cfad0['name'];}_0x102b82[_0xaa1c('0x11')](_0x5aeb48)[_0xaa1c('0x1e')](_0x2cfad0);};}exports[_0xaa1c('0x1f')]=function(_0x243b8f,_0x2f59e8){var _0xef2e18={};var _0x5575c9=_['map'](db[_0xaa1c('0x20')][_0xaa1c('0x21')],function(_0x3ddf4a){return{'name':_0x3ddf4a[_0xaa1c('0x22')],'type':_0x3ddf4a[_0xaa1c('0x23')][_0xaa1c('0x24')]};});_0xef2e18=qs[_0xaa1c('0x25')](_0x5575c9,_0x243b8f);return interaction[_0xaa1c('0x26')](_0xaa1c('0x27'),_0x243b8f['query'],_0x243b8f[_0xaa1c('0x28')],_0xef2e18,_0x5575c9)['then'](respondWithFilteredResult(_0x2f59e8,_0xef2e18))['catch'](handleError(_0x2f59e8,null));};exports[_0xaa1c('0x29')]=function(_0x32fcd3,_0x396d0b){var _0x4ea415={};if(_0x32fcd3[_0xaa1c('0x2a')][_0xaa1c('0x23')]&&_0x32fcd3[_0xaa1c('0x2a')]['type']===_0xaa1c('0x2b')){_0x4ea415['from']=_0x32fcd3[_0xaa1c('0x2c')]['id'];}else{_0x4ea415['id']=_0x32fcd3[_0xaa1c('0x2c')]['id'];}var _0x3b9c10={'raw':![],'where':_0x4ea415},_0x263a66={};_0x263a66[_0xaa1c('0x2d')]=_[_0xaa1c('0x2e')](db[_0xaa1c('0x20')][_0xaa1c('0x21')]);_0x263a66[_0xaa1c('0x2a')]=_['keys'](_0x32fcd3[_0xaa1c('0x2a')]);_0x263a66[_0xaa1c('0x2f')]=_[_0xaa1c('0x30')](_0x263a66['model'],_0x263a66['query']);_0x3b9c10['attributes']=_['intersection'](_0x263a66[_0xaa1c('0x2d')],qs[_0xaa1c('0x31')](_0x32fcd3[_0xaa1c('0x2a')][_0xaa1c('0x31')]));_0x3b9c10[_0xaa1c('0x32')]=_0x3b9c10[_0xaa1c('0x32')][_0xaa1c('0x33')]?_0x3b9c10['attributes']:_0x263a66[_0xaa1c('0x2d')];if(_0x32fcd3[_0xaa1c('0x2a')]['includeAll']){_0x3b9c10['include']=[{'all':!![]}];}_0x3b9c10=_[_0xaa1c('0x34')]({},_0x3b9c10,_0x32fcd3[_0xaa1c('0x35')]);return db['OpenchannelInteraction'][_0xaa1c('0x36')](_0x3b9c10)[_0xaa1c('0x19')](handleEntityNotFound(_0x396d0b,null))[_0xaa1c('0x19')](respondWithResult(_0x396d0b,null))[_0xaa1c('0x37')](handleError(_0x396d0b,null));};exports[_0xaa1c('0x38')]=function(_0x1b3c2a,_0x508769){return db[_0xaa1c('0x20')][_0xaa1c('0x38')](_0x1b3c2a[_0xaa1c('0x39')],{})['then'](respondWithResult(_0x508769,0xc9))[_0xaa1c('0x37')](handleError(_0x508769,null));};exports[_0xaa1c('0x3a')]=function(_0xe7f4f2,_0x42627c){if(_0xe7f4f2[_0xaa1c('0x39')]['id']){delete _0xe7f4f2['body']['id'];}return db['OpenchannelInteraction'][_0xaa1c('0x36')]({'where':{'id':_0xe7f4f2[_0xaa1c('0x2c')]['id']}})[_0xaa1c('0x19')](handleEntityNotFound(_0x42627c,null))[_0xaa1c('0x19')](saveUpdates(_0xe7f4f2[_0xaa1c('0x39')],null))[_0xaa1c('0x19')](respondWithResult(_0x42627c,null))['catch'](handleError(_0x42627c,null));};exports[_0xaa1c('0x18')]=function(_0x4b6d42,_0x18df47){return db[_0xaa1c('0x20')]['find']({'where':{'id':_0x4b6d42[_0xaa1c('0x2c')]['id']}})[_0xaa1c('0x19')](handleEntityNotFound(_0x18df47,null))[_0xaa1c('0x19')](removeEntity(_0x18df47,null))[_0xaa1c('0x37')](handleError(_0x18df47,null));};exports['describe']=function(_0x4050cf,_0x2a76e6){return db[_0xaa1c('0x20')]['describe']()[_0xaa1c('0x19')](respondWithResult(_0x2a76e6,null))[_0xaa1c('0x37')](handleError(_0x2a76e6,null));};exports[_0xaa1c('0x3b')]=function(_0x5c667e,_0x1558e6){return db['OpenchannelMessage']['find']({'where':{'id':_0x5c667e['params']['id']}})[_0xaa1c('0x19')](handleEntityNotFound(_0x1558e6,null))[_0xaa1c('0x19')](function(_0x11c53e){if(_0x11c53e){return _0x11c53e[_0xaa1c('0x3b')](_0x5c667e[_0xaa1c('0x39')][_0xaa1c('0x3c')],_[_0xaa1c('0x3d')](_0x5c667e[_0xaa1c('0x39')],[_0xaa1c('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x1558e6,null))[_0xaa1c('0x37')](handleError(_0x1558e6,null));};exports['getMessages']=function(_0x3e77ea,_0x1bad88){var _0x22c30d={'raw':![],'where':{}};var _0x21462b={};var _0x612696={'count':0x0,'rows':[]};return db[_0xaa1c('0x20')][_0xaa1c('0x3e')]({'where':{'id':_0x3e77ea[_0xaa1c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1bad88,null))[_0xaa1c('0x19')](function(_0x2b772b){if(_0x2b772b){_0x21462b['model']=_[_0xaa1c('0x2e')](db['OpenchannelMessage'][_0xaa1c('0x21')]);_0x21462b['query']=_[_0xaa1c('0x2e')](_0x3e77ea['query']);_0x21462b[_0xaa1c('0x2f')]=_['intersection'](_0x21462b['model'],_0x21462b[_0xaa1c('0x2a')]);_0x22c30d[_0xaa1c('0x32')]=_[_0xaa1c('0x30')](_0x21462b['model'],qs[_0xaa1c('0x31')](_0x3e77ea[_0xaa1c('0x2a')][_0xaa1c('0x31')]));_0x22c30d[_0xaa1c('0x32')]=_0x22c30d[_0xaa1c('0x32')][_0xaa1c('0x33')]?_0x22c30d['attributes']:_0x21462b['model'];if(!_0x3e77ea['query'][_0xaa1c('0x3f')]('nolimit')){_0x22c30d[_0xaa1c('0x15')]=qs[_0xaa1c('0x15')](_0x3e77ea[_0xaa1c('0x2a')]['limit']);_0x22c30d['offset']=qs[_0xaa1c('0x13')](_0x3e77ea[_0xaa1c('0x2a')][_0xaa1c('0x13')]);}_0x22c30d[_0xaa1c('0x40')]=qs[_0xaa1c('0x41')](_0x3e77ea[_0xaa1c('0x2a')]['sort']);_0x22c30d['where']=qs[_0xaa1c('0x2f')](_[_0xaa1c('0x42')](_0x3e77ea[_0xaa1c('0x2a')],_0x21462b[_0xaa1c('0x2f')]));_0x22c30d[_0xaa1c('0x43')][_0xaa1c('0x44')]=_0x2b772b['id'];if(_0x3e77ea[_0xaa1c('0x2a')][_0xaa1c('0x45')]){_0x22c30d[_0xaa1c('0x43')]=_[_0xaa1c('0x34')](_0x22c30d[_0xaa1c('0x43')],{'$or':_[_0xaa1c('0x46')](_0x22c30d[_0xaa1c('0x32')],function(_0x427083){var _0x3ec2b7={};_0x3ec2b7[_0x427083]={'$like':'%'+_0x3e77ea['query'][_0xaa1c('0x45')]+'%'};return _0x3ec2b7;})});}if(_0x3e77ea[_0xaa1c('0x2a')]['$gte']){var _0x1e5787=_0x3e77ea[_0xaa1c('0x2a')][_0xaa1c('0x47')][_0xaa1c('0x48')](',');var _0xf10abc={};_0xf10abc[_0x1e5787[0x0]]={'$gte':moment(_0x1e5787[0x1])[_0xaa1c('0x49')](_0xaa1c('0x4a'))};_0x22c30d[_0xaa1c('0x43')]=_['merge'](_0x22c30d[_0xaa1c('0x43')],_0xf10abc);}_0x22c30d=_[_0xaa1c('0x34')]({},_0x22c30d,_0x3e77ea['options']);return db[_0xaa1c('0x4b')]['count']({'where':_0x22c30d[_0xaa1c('0x43')]})[_0xaa1c('0x19')](function(_0x1c67a5){_0x612696[_0xaa1c('0x4c')]=_0x1c67a5;if(_0x3e77ea['query'][_0xaa1c('0x4d')]){_0x22c30d[_0xaa1c('0x4e')]=[{'all':!![]}];}return db[_0xaa1c('0x4b')][_0xaa1c('0x26')](_0x22c30d);})[_0xaa1c('0x19')](function(_0x336d0c){_0x612696[_0xaa1c('0x4f')]=_0x336d0c;return _0x612696;});}})['then'](respondWithFilteredResult(_0x1bad88,_0x22c30d))[_0xaa1c('0x37')](handleError(_0x1bad88,null));};exports[_0xaa1c('0x50')]=function(_0x139137,_0x130d16){return db[_0xaa1c('0x20')]['find']({'where':{'id':_0x139137[_0xaa1c('0x2c')]['id']}})[_0xaa1c('0x19')](handleEntityNotFound(_0x130d16,null))[_0xaa1c('0x19')](function(_0x35a76b){if(_0x35a76b){return _0x35a76b[_0xaa1c('0x51')](_0x139137[_0xaa1c('0x39')][_0xaa1c('0x3c')],_[_0xaa1c('0x3d')](_0x139137[_0xaa1c('0x39')],['ids','id'])||{})['spread'](function(){return db[_0xaa1c('0x52')][_0xaa1c('0x26')]({'attributes':['id',_0xaa1c('0x1d'),_0xaa1c('0x53')],'where':{'id':_0x139137[_0xaa1c('0x39')][_0xaa1c('0x3c')]}});})[_0xaa1c('0x19')](function(_0x1264c5){socket[_0xaa1c('0x54')]('openchannelInteractionTags:save',{'id':Number(_0x139137[_0xaa1c('0x2c')]['id']),'tags':_0x1264c5||[]});return{'id':Number(_0x139137['params']['id']),'tags':_0x1264c5||[]};});}})[_0xaa1c('0x19')](respondWithResult(_0x130d16,null))[_0xaa1c('0x37')](handleError(_0x130d16,null));};exports[_0xaa1c('0x55')]=function(_0x317455,_0x4f1be8){return db[_0xaa1c('0x20')][_0xaa1c('0x36')]({'where':{'id':_0x317455['params']['id']}})[_0xaa1c('0x19')](handleEntityNotFound(_0x4f1be8,null))[_0xaa1c('0x19')](function(_0x1e5d4e){if(_0x1e5d4e){return _0x1e5d4e[_0xaa1c('0x55')](_0x317455[_0xaa1c('0x2a')][_0xaa1c('0x3c')]);}})[_0xaa1c('0x19')](respondWithStatusCode(_0x4f1be8,null))[_0xaa1c('0x37')](handleError(_0x4f1be8,null));};exports[_0xaa1c('0x56')]=function(_0x5d9007,_0x398788){var _0x21e732=moment()[_0xaa1c('0x57')]()[_0xaa1c('0x58')]();var _0x25a2b1=path['join'](config[_0xaa1c('0x59')],_0xaa1c('0x5a'),_0xaa1c('0x5b'),_0xaa1c('0x5c'));var _0x51cd31=path[_0xaa1c('0x5d')](config[_0xaa1c('0x59')],_0xaa1c('0x5a'),_0xaa1c('0x5b'),_0xaa1c('0x5e'));var _0x4f69af=path[_0xaa1c('0x5d')](_0x25a2b1,_0x21e732);var _0x221cde=util[_0xaa1c('0x49')](_0xaa1c('0x5f'),_0x5d9007[_0xaa1c('0x2c')]['id'],_0x21e732);var _0x104c57=path[_0xaa1c('0x5d')](_0x25a2b1,_0x221cde);var _0x2877d5=[];_0x2877d5[_0xaa1c('0x60')]({'model':db['User'],'as':_0xaa1c('0x61'),'attributes':['id','fullname'],'raw':!![]});_0x2877d5[_0xaa1c('0x60')]({'model':db[_0xaa1c('0x62')],'as':_0xaa1c('0x63'),'attributes':['id',_0xaa1c('0x64'),_0xaa1c('0x65')],'raw':!![]});if(_0x5d9007[_0xaa1c('0x2a')]['attachments']){_0x2877d5[_0xaa1c('0x60')]({'model':db['Attachment'],'as':_0xaa1c('0x66'),'raw':!![]});}var _0x5f2036=[{'model':db[_0xaa1c('0x4b')],'as':_0xaa1c('0x67'),'attributes':['id','body',_0xaa1c('0x68'),'direction','secret',_0xaa1c('0x69')],'include':_0x2877d5}];_0x5f2036[_0xaa1c('0x60')]({'model':db[_0xaa1c('0x6a')],'as':_0xaa1c('0x6b'),'attributes':['id',_0xaa1c('0x1d')]});_0x5f2036[_0xaa1c('0x60')]({'model':db['User'],'as':_0xaa1c('0x6c'),'attributes':['id',_0xaa1c('0x6d')]});return db[_0xaa1c('0x20')][_0xaa1c('0x36')]({'where':{'id':_0x5d9007[_0xaa1c('0x2c')]['id']},'include':_0x5f2036})['then'](handleEntityNotFound(_0x398788,null))[_0xaa1c('0x19')](function(_0x19f9a4){if(_0x19f9a4){var _0x395cc5=_0x19f9a4['get']({'plain':!![]});fs[_0xaa1c('0x6e')](_0x4f69af);var _0x30b1fe={'channel':_0xaa1c('0x6f'),'account':_0x395cc5[_0xaa1c('0x6b')][_0xaa1c('0x1d')],'agent':_0x395cc5['Owner']?_0x395cc5[_0xaa1c('0x6c')][_0xaa1c('0x6d')]:'N.A.','createdAt':moment(_0x395cc5[_0xaa1c('0x68')])[_0xaa1c('0x49')](_0xaa1c('0x4a'))['toString'](),'closedAt':_0x395cc5[_0xaa1c('0x70')]?moment(_0x395cc5['closedAt'])[_0xaa1c('0x49')](_0xaa1c('0x4a'))[_0xaa1c('0x58')]():'','disposition':_0x395cc5[_0xaa1c('0x71')],'visibility':_0x395cc5[_0xaa1c('0x72')]?_0xaa1c('0x73'):'Private','messages':_(_0x395cc5[_0xaa1c('0x67')])['filter']({'secret':![]})[_0xaa1c('0x46')](function(_0x3e25f6){if(_0x3e25f6[_0xaa1c('0x66')]){var _0x1078a5=path['join'](_0x51cd31,_0x3e25f6[_0xaa1c('0x66')][_0xaa1c('0x74')]);if(fs[_0xaa1c('0x75')](_0x1078a5)){fs[_0xaa1c('0x76')](_0x1078a5)['pipe'](fs['createWriteStream'](path['join'](_0x4f69af,_0x3e25f6[_0xaa1c('0x66')][_0xaa1c('0x74')])));}}return{'date':moment(_0x3e25f6[_0xaa1c('0x68')])[_0xaa1c('0x49')](_0xaa1c('0x4a'))[_0xaa1c('0x58')](),'sender':_0x3e25f6[_0xaa1c('0x77')]===_0xaa1c('0x78')?_0x3e25f6[_0xaa1c('0x61')]?_0x3e25f6[_0xaa1c('0x61')][_0xaa1c('0x6d')]:_0xaa1c('0x79'):_0x3e25f6[_0xaa1c('0x63')][_0xaa1c('0x64')]+(_0x3e25f6[_0xaa1c('0x63')][_0xaa1c('0x65')]?'\x20'+_0x3e25f6[_0xaa1c('0x63')][_0xaa1c('0x65')]:''),'body':_0x3e25f6[_0xaa1c('0x66')]?_0x3e25f6[_0xaa1c('0x66')][_0xaa1c('0x74')]:_0x3e25f6[_0xaa1c('0x39')],'direction':_0x3e25f6[_0xaa1c('0x77')]==='out'?'A':'C','secret':_0x3e25f6['secret'],'read':_0x3e25f6[_0xaa1c('0x69')],'attachment':_0x3e25f6[_0xaa1c('0x66')]};})[_0xaa1c('0x7a')]()};return ejs[_0xaa1c('0x7b')](path[_0xaa1c('0x5d')](config[_0xaa1c('0x59')],'server',_0xaa1c('0x7c'),_0xaa1c('0x7d')),{'interaction':_0x30b1fe})[_0xaa1c('0x19')](function(_0x503298){var _0x2b2633=path[_0xaa1c('0x5d')](_0x4f69af,_0xaa1c('0x7e')+_0x395cc5['id']+'-'+_0x21e732+_0xaa1c('0x7f'));var _0x461df4={'path':_0x2b2633,'channel':_0xaa1c('0x6f'),'interactionId':_0x395cc5['id']};return pdf[_0xaa1c('0x80')](_0x503298,_0x461df4);})['then'](function(){return new Promise(function(_0x4609c9,_0x3be4ec){zipdir(_0x4f69af,{'saveTo':_0x104c57},function(_0x4347d2,_0x1088af){if(_0x4347d2)return _0x3be4ec(_0x4347d2);return _0x4609c9(_0x1088af);});})[_0xaa1c('0x19')](function(){return new Promise(function(_0x5599c8,_0xab1f1a){rimraf(_0x4f69af,function(_0x41c2e8){if(_0x41c2e8)_0xab1f1a(_0x41c2e8);return _0x5599c8();});});})[_0xaa1c('0x19')](function(){return _0x398788[_0xaa1c('0x56')](_0x104c57,_0x221cde,function(_0x52848d){if(_0x52848d){logger[_0xaa1c('0x1b')](_0xaa1c('0x81'),_0x52848d);}else{fs[_0xaa1c('0x82')](_0x104c57);}});});});}else{return _0x398788[_0xaa1c('0x10')](0xc8);}})['catch'](handleError(_0x398788,null));}; \ No newline at end of file +var _0x7673=['includeAll','addTags','setTags','omit','spread','color','emit','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','createdAt','toString','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','Contact','read','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','catch','show','query','from','params','model','keys','filters','intersection','fields','attributes','length','include','merge','find','create','update','body','describe','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1e08d2,_0x329b6f){var _0x1a223b=function(_0x15203e){while(--_0x15203e){_0x1e08d2['push'](_0x1e08d2['shift']());}};_0x1a223b(++_0x329b6f);}(_0x7673,0xb9));var _0x3767=function(_0x143620,_0x2738da){_0x143620=_0x143620-0x0;var _0x24fcec=_0x7673[_0x143620];return _0x24fcec;};'use strict';var rimraf=require(_0x3767('0x0'));var zipdir=require(_0x3767('0x1'));var moment=require(_0x3767('0x2'));var util=require(_0x3767('0x3'));var path=require(_0x3767('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3767('0x5'));var Redis=require(_0x3767('0x6'));var interaction=require(_0x3767('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x3767('0x8'))('api');var config=require(_0x3767('0x9'));var db=require(_0x3767('0xa'))['db'];config[_0x3767('0xb')]=_[_0x3767('0xc')](config[_0x3767('0xb')],{'host':_0x3767('0xd'),'port':0x18eb});var socket=require(_0x3767('0xe'))(new Redis(config['redis']));require(_0x3767('0xf'))[_0x3767('0x10')](socket);function respondWithStatusCode(_0x10c656,_0x5e5a91){_0x5e5a91=_0x5e5a91||0xcc;return function(_0x5681bc){if(_0x5681bc){return _0x10c656['sendStatus'](_0x5e5a91);}return _0x10c656[_0x3767('0x11')](_0x5e5a91)[_0x3767('0x12')]();};}function respondWithResult(_0x49e737,_0x1a9c5f){_0x1a9c5f=_0x1a9c5f||0xc8;return function(_0x34002f){if(_0x34002f){return _0x49e737[_0x3767('0x11')](_0x1a9c5f)[_0x3767('0x13')](_0x34002f);}};}function respondWithFilteredResult(_0x5c24a6,_0x498d71){return function(_0xd3a9dc){if(_0xd3a9dc){var _0x2c928a=typeof _0x498d71[_0x3767('0x14')]===_0x3767('0x15')&&typeof _0x498d71[_0x3767('0x16')]===_0x3767('0x15');var _0xa50b9c=_0xd3a9dc[_0x3767('0x17')];var _0x194b56=_0x2c928a?0x0:_0x498d71['offset'];var _0x3c3fe1=_0x2c928a?_0xd3a9dc[_0x3767('0x17')]:_0x498d71[_0x3767('0x14')]+_0x498d71['limit'];var _0x8579a5;if(_0x3c3fe1>=_0xa50b9c){_0x3c3fe1=_0xa50b9c;_0x8579a5=0xc8;}else{_0x8579a5=0xce;}_0x5c24a6['status'](_0x8579a5);return _0x5c24a6[_0x3767('0x18')](_0x3767('0x19'),_0x194b56+'-'+_0x3c3fe1+'/'+_0xa50b9c)[_0x3767('0x13')](_0xd3a9dc);}return null;};}function saveUpdates(_0xc677ee){return function(_0x5ac418){if(_0x5ac418){return _0x5ac418['update'](_0xc677ee)[_0x3767('0x1a')](function(_0x2437f0){return _0x2437f0;});}return null;};}function removeEntity(_0x303d40){return function(_0x3b93c2){if(_0x3b93c2){return _0x3b93c2[_0x3767('0x1b')]()['then'](function(){_0x303d40[_0x3767('0x11')](0xcc)[_0x3767('0x12')]();});}};}function handleEntityNotFound(_0x46e242){return function(_0x40303b){if(!_0x40303b){_0x46e242[_0x3767('0x1c')](0x194);}return _0x40303b;};}function handleError(_0x584ad4,_0x5699a9){_0x5699a9=_0x5699a9||0x1f4;return function(_0xb426b2){logger[_0x3767('0x1d')](_0xb426b2[_0x3767('0x1e')]);if(_0xb426b2[_0x3767('0x1f')]){delete _0xb426b2['name'];}_0x584ad4['status'](_0x5699a9)[_0x3767('0x20')](_0xb426b2);};}exports['index']=function(_0x3a8ba2,_0x115068){var _0xbbd738={};var _0x351b67=_['map'](db[_0x3767('0x21')][_0x3767('0x22')],function(_0x1a6f5d){return{'name':_0x1a6f5d[_0x3767('0x23')],'type':_0x1a6f5d[_0x3767('0x24')][_0x3767('0x25')]};});_0xbbd738=qs['getOptions'](_0x351b67,_0x3a8ba2);return interaction[_0x3767('0x26')](_0x3767('0x27'),_0x3a8ba2['query'],_0x3a8ba2['user'],_0xbbd738,_0x351b67)['then'](respondWithFilteredResult(_0x115068,_0xbbd738))[_0x3767('0x28')](handleError(_0x115068,null));};exports[_0x3767('0x29')]=function(_0x72bd67,_0x8e8204){var _0x370e2b={};if(_0x72bd67[_0x3767('0x2a')][_0x3767('0x24')]&&_0x72bd67[_0x3767('0x2a')][_0x3767('0x24')]===_0x3767('0x2b')){_0x370e2b[_0x3767('0x2b')]=_0x72bd67[_0x3767('0x2c')]['id'];}else{_0x370e2b['id']=_0x72bd67[_0x3767('0x2c')]['id'];}var _0x164aab={'raw':![],'where':_0x370e2b},_0x2d5cfc={};_0x2d5cfc[_0x3767('0x2d')]=_[_0x3767('0x2e')](db[_0x3767('0x21')]['rawAttributes']);_0x2d5cfc[_0x3767('0x2a')]=_[_0x3767('0x2e')](_0x72bd67['query']);_0x2d5cfc[_0x3767('0x2f')]=_[_0x3767('0x30')](_0x2d5cfc[_0x3767('0x2d')],_0x2d5cfc[_0x3767('0x2a')]);_0x164aab['attributes']=_[_0x3767('0x30')](_0x2d5cfc['model'],qs['fields'](_0x72bd67[_0x3767('0x2a')][_0x3767('0x31')]));_0x164aab[_0x3767('0x32')]=_0x164aab[_0x3767('0x32')][_0x3767('0x33')]?_0x164aab[_0x3767('0x32')]:_0x2d5cfc[_0x3767('0x2d')];if(_0x72bd67[_0x3767('0x2a')]['includeAll']){_0x164aab[_0x3767('0x34')]=[{'all':!![]}];}_0x164aab=_[_0x3767('0x35')]({},_0x164aab,_0x72bd67['options']);return db[_0x3767('0x21')][_0x3767('0x36')](_0x164aab)['then'](handleEntityNotFound(_0x8e8204,null))[_0x3767('0x1a')](respondWithResult(_0x8e8204,null))['catch'](handleError(_0x8e8204,null));};exports[_0x3767('0x37')]=function(_0xe3862c,_0x4d3c16){return db[_0x3767('0x21')][_0x3767('0x37')](_0xe3862c['body'],{})[_0x3767('0x1a')](respondWithResult(_0x4d3c16,0xc9))[_0x3767('0x28')](handleError(_0x4d3c16,null));};exports[_0x3767('0x38')]=function(_0x155848,_0x24a747){if(_0x155848[_0x3767('0x39')]['id']){delete _0x155848['body']['id'];}return db[_0x3767('0x21')][_0x3767('0x36')]({'where':{'id':_0x155848['params']['id']}})[_0x3767('0x1a')](handleEntityNotFound(_0x24a747,null))[_0x3767('0x1a')](saveUpdates(_0x155848[_0x3767('0x39')],null))[_0x3767('0x1a')](respondWithResult(_0x24a747,null))['catch'](handleError(_0x24a747,null));};exports[_0x3767('0x1b')]=function(_0xc50cc4,_0x137d9c){return db[_0x3767('0x21')][_0x3767('0x36')]({'where':{'id':_0xc50cc4[_0x3767('0x2c')]['id']}})[_0x3767('0x1a')](handleEntityNotFound(_0x137d9c,null))[_0x3767('0x1a')](removeEntity(_0x137d9c,null))[_0x3767('0x28')](handleError(_0x137d9c,null));};exports[_0x3767('0x3a')]=function(_0x802147,_0x5654bf){return db[_0x3767('0x21')][_0x3767('0x3a')]()['then'](respondWithResult(_0x5654bf,null))[_0x3767('0x28')](handleError(_0x5654bf,null));};exports[_0x3767('0x3b')]=function(_0x259a71,_0x3efe93){return db[_0x3767('0x3c')][_0x3767('0x36')]({'where':{'id':_0x259a71[_0x3767('0x2c')]['id']}})[_0x3767('0x1a')](handleEntityNotFound(_0x3efe93,null))[_0x3767('0x1a')](function(_0x540c96){if(_0x540c96){return _0x540c96[_0x3767('0x3b')](_0x259a71['body'][_0x3767('0x3d')],_['omit'](_0x259a71[_0x3767('0x39')],[_0x3767('0x3d'),'id'])||{});}})[_0x3767('0x1a')](respondWithResult(_0x3efe93,null))[_0x3767('0x28')](handleError(_0x3efe93,null));};exports['getMessages']=function(_0x4eadee,_0x3f7c5d){var _0x244161={'raw':![],'where':{}};var _0x2ee6fc={};var _0x1769f3={'count':0x0,'rows':[]};return db[_0x3767('0x21')][_0x3767('0x3e')]({'where':{'id':_0x4eadee[_0x3767('0x2c')]['id']}})[_0x3767('0x1a')](handleEntityNotFound(_0x3f7c5d,null))[_0x3767('0x1a')](function(_0x151659){if(_0x151659){_0x2ee6fc[_0x3767('0x2d')]=_[_0x3767('0x2e')](db[_0x3767('0x3c')]['rawAttributes']);_0x2ee6fc[_0x3767('0x2a')]=_['keys'](_0x4eadee['query']);_0x2ee6fc[_0x3767('0x2f')]=_[_0x3767('0x30')](_0x2ee6fc[_0x3767('0x2d')],_0x2ee6fc[_0x3767('0x2a')]);_0x244161[_0x3767('0x32')]=_[_0x3767('0x30')](_0x2ee6fc[_0x3767('0x2d')],qs['fields'](_0x4eadee['query'][_0x3767('0x31')]));_0x244161[_0x3767('0x32')]=_0x244161[_0x3767('0x32')][_0x3767('0x33')]?_0x244161[_0x3767('0x32')]:_0x2ee6fc['model'];if(!_0x4eadee[_0x3767('0x2a')][_0x3767('0x3f')](_0x3767('0x40'))){_0x244161['limit']=qs['limit'](_0x4eadee[_0x3767('0x2a')][_0x3767('0x16')]);_0x244161[_0x3767('0x14')]=qs[_0x3767('0x14')](_0x4eadee[_0x3767('0x2a')][_0x3767('0x14')]);}_0x244161[_0x3767('0x41')]=qs[_0x3767('0x42')](_0x4eadee[_0x3767('0x2a')][_0x3767('0x42')]);_0x244161['where']=qs['filters'](_['pick'](_0x4eadee[_0x3767('0x2a')],_0x2ee6fc[_0x3767('0x2f')]));_0x244161[_0x3767('0x43')][_0x3767('0x44')]=_0x151659['id'];if(_0x4eadee[_0x3767('0x2a')][_0x3767('0x45')]){_0x244161['where']=_[_0x3767('0x35')](_0x244161[_0x3767('0x43')],{'$or':_[_0x3767('0x46')](_0x244161[_0x3767('0x32')],function(_0x5d9f73){var _0x505ea9={};_0x505ea9[_0x5d9f73]={'$like':'%'+_0x4eadee['query'][_0x3767('0x45')]+'%'};return _0x505ea9;})});}if(_0x4eadee[_0x3767('0x2a')][_0x3767('0x47')]){var _0x596b0e=_0x4eadee['query']['$gte'][_0x3767('0x48')](',');var _0x61ff8b={};_0x61ff8b[_0x596b0e[0x0]]={'$gte':moment(_0x596b0e[0x1])[_0x3767('0x49')](_0x3767('0x4a'))};_0x244161[_0x3767('0x43')]=_['merge'](_0x244161[_0x3767('0x43')],_0x61ff8b);}_0x244161=_['merge']({},_0x244161,_0x4eadee['options']);return db[_0x3767('0x3c')][_0x3767('0x17')]({'where':_0x244161[_0x3767('0x43')]})[_0x3767('0x1a')](function(_0x39b892){_0x1769f3[_0x3767('0x17')]=_0x39b892;if(_0x4eadee['query'][_0x3767('0x4b')]){_0x244161[_0x3767('0x34')]=[{'all':!![]}];}return db[_0x3767('0x3c')][_0x3767('0x26')](_0x244161);})[_0x3767('0x1a')](function(_0x1360fb){_0x1769f3['rows']=_0x1360fb;return _0x1769f3;});}})[_0x3767('0x1a')](respondWithFilteredResult(_0x3f7c5d,_0x244161))[_0x3767('0x28')](handleError(_0x3f7c5d,null));};exports[_0x3767('0x4c')]=function(_0xd6f46b,_0x486e3c){return db[_0x3767('0x21')][_0x3767('0x36')]({'where':{'id':_0xd6f46b[_0x3767('0x2c')]['id']}})['then'](handleEntityNotFound(_0x486e3c,null))['then'](function(_0x2b5094){if(_0x2b5094){return _0x2b5094[_0x3767('0x4d')](_0xd6f46b[_0x3767('0x39')][_0x3767('0x3d')],_[_0x3767('0x4e')](_0xd6f46b[_0x3767('0x39')],[_0x3767('0x3d'),'id'])||{})[_0x3767('0x4f')](function(){return db['Tag'][_0x3767('0x26')]({'attributes':['id','name',_0x3767('0x50')],'where':{'id':_0xd6f46b[_0x3767('0x39')][_0x3767('0x3d')]}});})['then'](function(_0xbf27f3){socket[_0x3767('0x51')]('openchannelInteractionTags:save',{'id':Number(_0xd6f46b[_0x3767('0x2c')]['id']),'tags':_0xbf27f3||[]});return{'id':Number(_0xd6f46b[_0x3767('0x2c')]['id']),'tags':_0xbf27f3||[]};});}})['then'](respondWithResult(_0x486e3c,null))[_0x3767('0x28')](handleError(_0x486e3c,null));};exports[_0x3767('0x52')]=function(_0x4fff2a,_0x196905){return db[_0x3767('0x21')][_0x3767('0x36')]({'where':{'id':_0x4fff2a['params']['id']}})[_0x3767('0x1a')](handleEntityNotFound(_0x196905,null))[_0x3767('0x1a')](function(_0x380dad){if(_0x380dad){return _0x380dad[_0x3767('0x52')](_0x4fff2a[_0x3767('0x2a')]['ids']);}})[_0x3767('0x1a')](respondWithStatusCode(_0x196905,null))['catch'](handleError(_0x196905,null));};exports[_0x3767('0x53')]=function(_0x76a444,_0xcf6fff){var _0x1758aa=moment()[_0x3767('0x54')]()['toString']();var _0x318676=path['join'](config[_0x3767('0x55')],_0x3767('0x56'),_0x3767('0x57'),'tmp');var _0x418ae5=path[_0x3767('0x58')](config['root'],_0x3767('0x56'),_0x3767('0x57'),_0x3767('0x59'));var _0x14b21d=path['join'](_0x318676,_0x1758aa);var _0x1fc921=util[_0x3767('0x49')](_0x3767('0x5a'),_0x76a444[_0x3767('0x2c')]['id'],_0x1758aa);var _0x10121b=path[_0x3767('0x58')](_0x318676,_0x1fc921);var _0x20c651=[];_0x20c651[_0x3767('0x5b')]({'model':db['User'],'as':_0x3767('0x5c'),'attributes':['id',_0x3767('0x5d')],'raw':!![]});_0x20c651['push']({'model':db[_0x3767('0x5e')],'as':'Contact','attributes':['id',_0x3767('0x5f'),_0x3767('0x60')],'raw':!![]});if(_0x76a444[_0x3767('0x2a')][_0x3767('0x59')]){_0x20c651[_0x3767('0x5b')]({'model':db[_0x3767('0x61')],'as':_0x3767('0x61'),'raw':!![]});}var _0x1a0ba7=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x3767('0x62'),_0x3767('0x63'),'read'],'include':_0x20c651}];_0x1a0ba7[_0x3767('0x5b')]({'model':db[_0x3767('0x64')],'as':'Account','attributes':['id','name']});_0x1a0ba7[_0x3767('0x5b')]({'model':db[_0x3767('0x5c')],'as':_0x3767('0x65'),'attributes':['id',_0x3767('0x5d')]});return db[_0x3767('0x21')]['find']({'where':{'id':_0x76a444[_0x3767('0x2c')]['id']},'include':_0x1a0ba7})['then'](handleEntityNotFound(_0xcf6fff,null))[_0x3767('0x1a')](function(_0x155d7f){if(_0x155d7f){var _0xcfb6a9=_0x155d7f[_0x3767('0x66')]({'plain':!![]});fs[_0x3767('0x67')](_0x14b21d);var _0x169e82={'channel':_0x3767('0x68'),'account':_0xcfb6a9[_0x3767('0x69')][_0x3767('0x1f')],'agent':_0xcfb6a9[_0x3767('0x65')]?_0xcfb6a9[_0x3767('0x65')]['fullname']:'N.A.','createdAt':moment(_0xcfb6a9[_0x3767('0x6a')])[_0x3767('0x49')](_0x3767('0x4a'))[_0x3767('0x6b')](),'closedAt':_0xcfb6a9[_0x3767('0x6c')]?moment(_0xcfb6a9[_0x3767('0x6d')])['format'](_0x3767('0x4a'))[_0x3767('0x6b')]():'','disposition':_0xcfb6a9[_0x3767('0x6e')],'visibility':_0xcfb6a9[_0x3767('0x6f')]?_0x3767('0x70'):_0x3767('0x71'),'messages':_(_0xcfb6a9['Messages'])[_0x3767('0x45')]({'secret':![]})[_0x3767('0x46')](function(_0x2c6713){if(_0x2c6713[_0x3767('0x61')]){var _0x3406a0=path[_0x3767('0x58')](_0x418ae5,_0x2c6713[_0x3767('0x61')][_0x3767('0x72')]);if(fs[_0x3767('0x73')](_0x3406a0)){fs['createReadStream'](_0x3406a0)[_0x3767('0x74')](fs[_0x3767('0x75')](path[_0x3767('0x58')](_0x14b21d,_0x2c6713[_0x3767('0x61')][_0x3767('0x72')])));}}return{'date':moment(_0x2c6713[_0x3767('0x6a')])[_0x3767('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3767('0x6b')](),'sender':_0x2c6713[_0x3767('0x62')]===_0x3767('0x76')?_0x2c6713[_0x3767('0x5c')]?_0x2c6713[_0x3767('0x5c')][_0x3767('0x5d')]:_0x3767('0x77'):_0x2c6713['Contact']['firstName']+(_0x2c6713[_0x3767('0x78')]['lastName']?'\x20'+_0x2c6713[_0x3767('0x78')][_0x3767('0x60')]:''),'body':_0x2c6713['Attachment']?_0x2c6713['Attachment'][_0x3767('0x72')]:_0x2c6713[_0x3767('0x39')],'direction':_0x2c6713[_0x3767('0x62')]===_0x3767('0x76')?'A':'C','secret':_0x2c6713[_0x3767('0x63')],'read':_0x2c6713[_0x3767('0x79')],'attachment':_0x2c6713[_0x3767('0x61')]};})[_0x3767('0x7a')]()};return ejs[_0x3767('0x7b')](path[_0x3767('0x58')](config[_0x3767('0x55')],_0x3767('0x56'),'views',_0x3767('0x7c')),{'interaction':_0x169e82})[_0x3767('0x1a')](function(_0x2eef69){var _0x38cba1=path[_0x3767('0x58')](_0x14b21d,_0x3767('0x7d')+_0xcfb6a9['id']+'-'+_0x1758aa+_0x3767('0x7e'));var _0x514106={'path':_0x38cba1,'channel':_0x3767('0x68'),'interactionId':_0xcfb6a9['id']};return pdf[_0x3767('0x7f')](_0x2eef69,_0x514106);})[_0x3767('0x1a')](function(){return new Promise(function(_0x23c4bd,_0xa0b3df){zipdir(_0x14b21d,{'saveTo':_0x10121b},function(_0x31e719,_0x127566){if(_0x31e719)return _0xa0b3df(_0x31e719);return _0x23c4bd(_0x127566);});})[_0x3767('0x1a')](function(){return new Promise(function(_0x43e06f,_0x340b66){rimraf(_0x14b21d,function(_0x32c637){if(_0x32c637)_0x340b66(_0x32c637);return _0x43e06f();});});})[_0x3767('0x1a')](function(){return _0xcf6fff[_0x3767('0x53')](_0x10121b,_0x1fc921,function(_0x28d134){if(_0x28d134){logger[_0x3767('0x1d')](_0x3767('0x80'),_0x28d134);}else{fs[_0x3767('0x81')](_0x10121b);}});});});}else{return _0xcf6fff[_0x3767('0x1c')](0xc8);}})[_0x3767('0x28')](handleError(_0xcf6fff,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 636899a..841af73 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 _0x1c89=['../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','getUsers','then','Users','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x132fb6,_0x7a257b){var _0x2ca9d5=function(_0x490d53){while(--_0x490d53){_0x132fb6['push'](_0x132fb6['shift']());}};_0x2ca9d5(++_0x7a257b);}(_0x1c89,0x16c));var _0x91c8=function(_0x5c3c90,_0x5ba31e){_0x5c3c90=_0x5c3c90-0x0;var _0x1dff8b=_0x1c89[_0x5c3c90];return _0x1dff8b;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x91c8('0x0'))['db'][_0x91c8('0x1')];var OpenchannelMessage=require(_0x91c8('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x91c8('0x2')](0x0);var events={'afterCreate':_0x91c8('0x3'),'afterUpdate':_0x91c8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c3e15){return function(_0x37bffe,_0x517fad,_0x20a56c){_0x37bffe[_0x91c8('0x5')]({'attributes':['id'],'raw':!![]})[_0x91c8('0x6')](function(_0xeec72b){_0x37bffe['setDataValue'](_0x91c8('0x7'),_0xeec72b['map'](function(_0x4c4ed9){return{'id':_0x4c4ed9['id']};}));return OpenchannelMessage[_0x91c8('0x8')]({'where':{'OpenchannelInteractionId':_0x37bffe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x91c8('0x6')](function(_0x510f3c){_0x37bffe['setDataValue'](_0x91c8('0x9'),_0x510f3c['length']);OpenchannelInteractionEvents[_0x91c8('0xa')](_0x5c3e15+':'+_0x37bffe['id'],_0x37bffe);OpenchannelInteractionEvents[_0x91c8('0xa')](_0x5c3e15,_0x37bffe);_0x20a56c(null);})[_0x91c8('0xb')](_0x20a56c(null));};}for(var e in events){if(events[_0x91c8('0xc')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1510=['then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1510,0x192));var _0x0151=function(_0x140ed1,_0x22a7d6){_0x140ed1=_0x140ed1-0x0;var _0x417c81=_0x1510[_0x140ed1];return _0x417c81;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x0151('0x0'))['db'][_0x0151('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x0151('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0151('0x3')](0x0);var events={'afterCreate':_0x0151('0x4'),'afterUpdate':_0x0151('0x5'),'afterDestroy':'remove'};function emitEvent(_0xe18b5e){return function(_0x310bbc,_0x16ff08,_0xcbf569){_0x310bbc['getUsers']({'attributes':['id'],'raw':!![]})[_0x0151('0x6')](function(_0x19c5cd){_0x310bbc['setDataValue'](_0x0151('0x7'),_0x19c5cd['map'](function(_0x101f98){return{'id':_0x101f98['id']};}));return OpenchannelMessage[_0x0151('0x8')]({'where':{'OpenchannelInteractionId':_0x310bbc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0151('0x6')](function(_0x16b007){_0x310bbc[_0x0151('0x9')](_0x0151('0xa'),_0x16b007[_0x0151('0xb')]);OpenchannelInteractionEvents['emit'](_0xe18b5e+':'+_0x310bbc['id'],_0x310bbc);OpenchannelInteractionEvents[_0x0151('0xc')](_0xe18b5e,_0x310bbc);_0xcbf569(null);})[_0x0151('0xd')](_0xcbf569(null));};}for(var e in events){if(events[_0x0151('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0151('0xf')](e,emitEvent(event));}}module[_0x0151('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0f47bfc..fe058d8 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 _0x8af2=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird'];(function(_0x1ac6a5,_0x5940e1){var _0x48e4fe=function(_0x323289){while(--_0x323289){_0x1ac6a5['push'](_0x1ac6a5['shift']());}};_0x48e4fe(++_0x5940e1);}(_0x8af2,0xb6));var _0x28af=function(_0x2fb0d9,_0x9e3430){_0x2fb0d9=_0x2fb0d9-0x0;var _0x14cc38=_0x8af2[_0x2fb0d9];return _0x14cc38;};'use strict';var _=require(_0x28af('0x0'));var util=require(_0x28af('0x1'));var logger=require('../../config/logger')(_0x28af('0x2'));var moment=require(_0x28af('0x3'));var BPromise=require(_0x28af('0x4'));var rp=require(_0x28af('0x5'));var fs=require('fs');var path=require(_0x28af('0x6'));var rimraf=require(_0x28af('0x7'));var config=require(_0x28af('0x8'));var attributes=require(_0x28af('0x9'));module['exports']=function(_0x20f577,_0x2c90ab){return _0x20f577[_0x28af('0xa')](_0x28af('0xb'),attributes,{'tableName':_0x28af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28af('0xd'),'collate':_0x28af('0xe'),'hooks':{'beforeUpdate':function(_0x9ab4a3,_0x390105,_0x238f41){if(_0x9ab4a3['changed']('closed')){_0x9ab4a3['closedAt']=moment()[_0x28af('0xf')](_0x28af('0x10'));}_0x238f41(null,_0x9ab4a3);}}});}; \ No newline at end of file +var _0x3d11=['moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x2b61f3,_0x4a5998){var _0x24f0c1=function(_0x3b21ea){while(--_0x3b21ea){_0x2b61f3['push'](_0x2b61f3['shift']());}};_0x24f0c1(++_0x4a5998);}(_0x3d11,0x18d));var _0x13d1=function(_0x12e6dc,_0x56c555){_0x12e6dc=_0x12e6dc-0x0;var _0x1743c0=_0x3d11[_0x12e6dc];return _0x1743c0;};'use strict';var _=require('lodash');var util=require(_0x13d1('0x0'));var logger=require(_0x13d1('0x1'))(_0x13d1('0x2'));var moment=require(_0x13d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x13d1('0x4'));var fs=require('fs');var path=require(_0x13d1('0x5'));var rimraf=require(_0x13d1('0x6'));var config=require(_0x13d1('0x7'));var attributes=require(_0x13d1('0x8'));module['exports']=function(_0x4ea8b1,_0x4efba0){return _0x4ea8b1[_0x13d1('0x9')](_0x13d1('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13d1('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x43a98c,_0x6d5cd8,_0x5fafe3){if(_0x43a98c[_0x13d1('0xc')](_0x13d1('0xd'))){_0x43a98c['closedAt']=moment()[_0x13d1('0xe')](_0x13d1('0xf'));}_0x5fafe3(null,_0x43a98c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 626b53c..44e6686 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 _0x7e0d=['jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','update','options','where','attributes','UpdateOpenchannelInteraction','catch','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5cae4d,_0xd8fcdb){var _0x521a4b=function(_0x3df63c){while(--_0x3df63c){_0x5cae4d['push'](_0x5cae4d['shift']());}};_0x521a4b(++_0xd8fcdb);}(_0x7e0d,0x191));var _0xd7e0=function(_0x4ca0c2,_0x102b71){_0x4ca0c2=_0x4ca0c2-0x0;var _0x11613e=_0x7e0d[_0x4ca0c2];return _0x11613e;};'use strict';var _=require(_0xd7e0('0x0'));var util=require(_0xd7e0('0x1'));var moment=require('moment');var BPromise=require(_0xd7e0('0x2'));var rs=require(_0xd7e0('0x3'));var fs=require('fs');var Redis=require(_0xd7e0('0x4'));var db=require(_0xd7e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7e0('0x6'))(_0xd7e0('0x7'));var config=require(_0xd7e0('0x8'));var jayson=require(_0xd7e0('0x9'));var client=jayson[_0xd7e0('0xa')][_0xd7e0('0xb')]({'port':0x232a});config[_0xd7e0('0xc')]=_[_0xd7e0('0xd')](config[_0xd7e0('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7e0('0xc')]));require(_0xd7e0('0xe'))[_0xd7e0('0xf')](socket);function respondWithRpcPromise(_0x11a729,_0x5daeb7,_0x38b19c){return new BPromise(function(_0x3870a5,_0x25ee79){return client[_0xd7e0('0x10')](_0x11a729,_0x38b19c)[_0xd7e0('0x11')](function(_0x22c394){logger[_0xd7e0('0x12')](_0xd7e0('0x13'),_0x5daeb7,_0xd7e0('0x14'));logger[_0xd7e0('0x15')](_0xd7e0('0x16'),_0x5daeb7,_0xd7e0('0x14'),JSON[_0xd7e0('0x17')](_0x22c394));if(_0x22c394[_0xd7e0('0x18')]){if(_0x22c394[_0xd7e0('0x18')][_0xd7e0('0x19')]===0x1f4){logger[_0xd7e0('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5daeb7,_0x22c394['error'][_0xd7e0('0x1a')]);return _0x25ee79(_0x22c394['error'][_0xd7e0('0x1a')]);}logger[_0xd7e0('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5daeb7,_0x22c394['error'][_0xd7e0('0x1a')]);return _0x3870a5(_0x22c394[_0xd7e0('0x18')][_0xd7e0('0x1a')]);}else{logger[_0xd7e0('0x12')](_0xd7e0('0x13'),_0x5daeb7,_0xd7e0('0x14'));_0x3870a5(_0x22c394[_0xd7e0('0x1b')][_0xd7e0('0x1a')]);}})['catch'](function(_0x515640){logger[_0xd7e0('0x18')](_0xd7e0('0x13'),_0x5daeb7,_0x515640);_0x25ee79(_0x515640);});});}exports['UpdateOpenchannelInteraction']=function(_0x24520b){var _0x4f1c93=this;return new Promise(function(_0x5d3b92,_0x5c167b){return db[_0xd7e0('0x1c')][_0xd7e0('0x1d')](_0x24520b['body'],{'raw':_0x24520b[_0xd7e0('0x1e')]?_0x24520b[_0xd7e0('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24520b[_0xd7e0('0x1e')]?_0x24520b['options'][_0xd7e0('0x1f')]||null:null,'attributes':_0x24520b['options']?_0x24520b[_0xd7e0('0x1e')][_0xd7e0('0x20')]||null:null,'limit':_0x24520b[_0xd7e0('0x1e')]?_0x24520b['options']['limit']||null:null})['then'](function(_0x52dc27){logger[_0xd7e0('0x12')](_0xd7e0('0x21'),_0x24520b);logger['debug'](_0xd7e0('0x21'),_0x24520b,JSON[_0xd7e0('0x17')](_0x52dc27));_0x5d3b92(_0x52dc27);})[_0xd7e0('0x22')](function(_0x2a7c8a){logger[_0xd7e0('0x18')](_0xd7e0('0x21'),_0x2a7c8a['message'],_0x24520b);_0x5c167b(_0x4f1c93[_0xd7e0('0x18')](0x1f4,_0x2a7c8a[_0xd7e0('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x592e06){return new Promise(function(_0x1a0ea4,_0x5c12e5){return db[_0xd7e0('0x1c')]['find']({'where':_0x592e06[_0xd7e0('0x1e')]?_0x592e06['options'][_0xd7e0('0x1f')]||null:null})[_0xd7e0('0x11')](function(_0x5eb0fb){if(_0x5eb0fb){return _0x5eb0fb[_0xd7e0('0x23')](_0x592e06[_0xd7e0('0x24')][_0xd7e0('0x25')],_[_0xd7e0('0x26')](_0x592e06['body'],[_0xd7e0('0x25'),'id'])||{});}})[_0xd7e0('0x27')](function(_0x2fef93){logger[_0xd7e0('0x12')](_0xd7e0('0x28'),_0x592e06);logger[_0xd7e0('0x15')](_0xd7e0('0x28'),_0x592e06,JSON[_0xd7e0('0x17')](_0x2fef93));_0x1a0ea4(_0x2fef93);})[_0xd7e0('0x22')](function(_0x2a6140){logger[_0xd7e0('0x18')](_0xd7e0('0x28'),_0x2a6140[_0xd7e0('0x1a')],_0x592e06);_0x5c12e5(_this['error'](0x1f4,_0x2a6140['message']));});});}; \ No newline at end of file +var _0x4770=['then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','request'];(function(_0x9dc27f,_0x2e358a){var _0x165751=function(_0x1f550e){while(--_0x1f550e){_0x9dc27f['push'](_0x9dc27f['shift']());}};_0x165751(++_0x2e358a);}(_0x4770,0x92));var _0x0477=function(_0x2f5142,_0x30cdca){_0x2f5142=_0x2f5142-0x0;var _0x2fa5db=_0x4770[_0x2f5142];return _0x2fa5db;};'use strict';var _=require(_0x0477('0x0'));var util=require(_0x0477('0x1'));var moment=require(_0x0477('0x2'));var BPromise=require(_0x0477('0x3'));var rs=require(_0x0477('0x4'));var fs=require('fs');var Redis=require(_0x0477('0x5'));var db=require(_0x0477('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0477('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0477('0x8'));var client=jayson[_0x0477('0x9')]['http']({'port':0x232a});config[_0x0477('0xa')]=_[_0x0477('0xb')](config[_0x0477('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0477('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x54155a,_0x307184,_0x233c1c){return new BPromise(function(_0x362078,_0x22bb2b){return client[_0x0477('0xd')](_0x54155a,_0x233c1c)[_0x0477('0xe')](function(_0x59cfee){logger[_0x0477('0xf')](_0x0477('0x10'),_0x307184,_0x0477('0x11'));logger[_0x0477('0x12')](_0x0477('0x13'),_0x307184,_0x0477('0x11'),JSON[_0x0477('0x14')](_0x59cfee));if(_0x59cfee['error']){if(_0x59cfee[_0x0477('0x15')]['code']===0x1f4){logger['error'](_0x0477('0x10'),_0x307184,_0x59cfee['error'][_0x0477('0x16')]);return _0x22bb2b(_0x59cfee[_0x0477('0x15')][_0x0477('0x16')]);}logger[_0x0477('0x15')](_0x0477('0x10'),_0x307184,_0x59cfee[_0x0477('0x15')][_0x0477('0x16')]);return _0x362078(_0x59cfee['error'][_0x0477('0x16')]);}else{logger[_0x0477('0xf')](_0x0477('0x10'),_0x307184,_0x0477('0x11'));_0x362078(_0x59cfee[_0x0477('0x17')]['message']);}})[_0x0477('0x18')](function(_0x273d8d){logger[_0x0477('0x15')](_0x0477('0x10'),_0x307184,_0x273d8d);_0x22bb2b(_0x273d8d);});});}exports[_0x0477('0x19')]=function(_0x118bef){var _0x1f0807=this;return new Promise(function(_0x1618cb,_0xe27fa6){return db[_0x0477('0x1a')][_0x0477('0x1b')](_0x118bef[_0x0477('0x1c')],{'raw':_0x118bef[_0x0477('0x1d')]?_0x118bef['options'][_0x0477('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118bef[_0x0477('0x1d')]?_0x118bef[_0x0477('0x1d')][_0x0477('0x1f')]||null:null,'attributes':_0x118bef['options']?_0x118bef[_0x0477('0x1d')][_0x0477('0x20')]||null:null,'limit':_0x118bef[_0x0477('0x1d')]?_0x118bef[_0x0477('0x1d')][_0x0477('0x21')]||null:null})[_0x0477('0xe')](function(_0x32ffb0){logger[_0x0477('0xf')]('UpdateOpenchannelInteraction',_0x118bef);logger[_0x0477('0x12')](_0x0477('0x19'),_0x118bef,JSON[_0x0477('0x14')](_0x32ffb0));_0x1618cb(_0x32ffb0);})['catch'](function(_0x3d2c31){logger[_0x0477('0x15')]('UpdateOpenchannelInteraction',_0x3d2c31[_0x0477('0x16')],_0x118bef);_0xe27fa6(_0x1f0807[_0x0477('0x15')](0x1f4,_0x3d2c31[_0x0477('0x16')]));});});};exports[_0x0477('0x22')]=function(_0x1ce286){return new Promise(function(_0x206920,_0x4f2a9b){return db['OpenchannelInteraction'][_0x0477('0x23')]({'where':_0x1ce286[_0x0477('0x1d')]?_0x1ce286['options'][_0x0477('0x1f')]||null:null})[_0x0477('0xe')](function(_0x24b019){if(_0x24b019){return _0x24b019[_0x0477('0x24')](_0x1ce286['body'][_0x0477('0x25')],_['omit'](_0x1ce286[_0x0477('0x1c')],['ids','id'])||{});}})[_0x0477('0x26')](function(_0x406442){logger[_0x0477('0xf')](_0x0477('0x27'),_0x1ce286);logger[_0x0477('0x12')]('AddTags',_0x1ce286,JSON[_0x0477('0x14')](_0x406442));_0x206920(_0x406442);})['catch'](function(_0x2ac987){logger[_0x0477('0x15')](_0x0477('0x27'),_0x2ac987[_0x0477('0x16')],_0x1ce286);_0x4f2a9b(_this[_0x0477('0x15')](0x1f4,_0x2ac987[_0x0477('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b60b92c..cc9b568 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 _0x034d=['openchannelInteraction:','save','remove','update','emit','register','length'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x034d,0x112));var _0xd034=function(_0x1dcd44,_0x24ef34){_0x1dcd44=_0x1dcd44-0x0;var _0x2f47c1=_0x034d[_0x1dcd44];return _0x2f47c1;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xd034('0x0'),_0xd034('0x1'),_0xd034('0x2')];function createListener(_0x13cbc8,_0x466ada){return function(_0x4bf031){_0x466ada[_0xd034('0x3')](_0x13cbc8,_0x4bf031);};}function removeListener(_0x4058e3,_0x5ad600){return function(){OpenchannelInteractionEvents['removeListener'](_0x4058e3,_0x5ad600);};}exports[_0xd034('0x4')]=function(_0x305c8c){for(var _0x2afd3a=0x0,_0x172497=events[_0xd034('0x5')];_0x2afd3a<_0x172497;_0x2afd3a++){var _0x27d06a=events[_0x2afd3a];var _0x28503f=createListener(_0xd034('0x6')+_0x27d06a,_0x305c8c);OpenchannelInteractionEvents['on'](_0x27d06a,_0x28503f);}}; \ No newline at end of file +var _0xd651=['save','remove','update','emit','removeListener','register','openchannelInteraction:'];(function(_0x52bae3,_0x6d1281){var _0x58faad=function(_0x5a58ff){while(--_0x5a58ff){_0x52bae3['push'](_0x52bae3['shift']());}};_0x58faad(++_0x6d1281);}(_0xd651,0xe0));var _0x1d65=function(_0x3a49cc,_0x337db0){_0x3a49cc=_0x3a49cc-0x0;var _0x182926=_0xd651[_0x3a49cc];return _0x182926;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x1d65('0x0'),_0x1d65('0x1'),_0x1d65('0x2')];function createListener(_0xe4d344,_0x50fcb6){return function(_0x4acfee){_0x50fcb6[_0x1d65('0x3')](_0xe4d344,_0x4acfee);};}function removeListener(_0x4e3565,_0x128153){return function(){OpenchannelInteractionEvents[_0x1d65('0x4')](_0x4e3565,_0x128153);};}exports[_0x1d65('0x5')]=function(_0x5e17e6){for(var _0x40a757=0x0,_0x113acf=events['length'];_0x40a757<_0x113acf;_0x40a757++){var _0x2f316e=events[_0x40a757];var _0x3db2af=createListener(_0x1d65('0x6')+_0x2f316e,_0x5e17e6);OpenchannelInteractionEvents['on'](_0x2f316e,_0x3db2af);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d4bca80..74c8399 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x56c899,_0x5ae65e){_0x56c899=_0x56c899-0x0;var _0x29aa40=_0x70e0[_0x56c899];return _0x29aa40;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +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(_0x241e7f,_0x39073c){var _0x4accfd=function(_0x2e8e67){while(--_0x2e8e67){_0x241e7f['push'](_0x241e7f['shift']());}};_0x4accfd(++_0x39073c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e3169f7..9b5a0ea 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 _0x0901=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0901,0x134));var _0x1090=function(_0x55ae3d,_0x534232){_0x55ae3d=_0x55ae3d-0x0;var _0xbd8750=_0x0901[_0x55ae3d];return _0xbd8750;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'body':{'type':Sequelize[_0x1090('0x2')](_0x1090('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1090('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1090('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x1090('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1090('0x6')]},'providerName':{'type':Sequelize[_0x1090('0x7')]},'providerResponse':{'type':Sequelize[_0x1090('0x2')]}}; \ No newline at end of file +var _0x97c1=['exports','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0x42ea0f,_0x4a0aaf){var _0x5efa89=function(_0x13d4bc){while(--_0x13d4bc){_0x42ea0f['push'](_0x42ea0f['shift']());}};_0x5efa89(++_0x4a0aaf);}(_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')]={'body':{'type':Sequelize['TEXT'](_0x197c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x197c('0x3')]('in',_0x197c('0x4')),'defaultValue':_0x197c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x197c('0x5')]},'providerName':{'type':Sequelize[_0x197c('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d4aacc1..3d5a246 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 _0xa660=['then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','show','params','create','body','find','describe','accept','openchannel','reject','user','agent','UserId','get','OpenchannelInteraction','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','interface','format','SIP/%s','channel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','client','http','request'];(function(_0x2539a9,_0x2697b7){var _0x103a7b=function(_0x43f666){while(--_0x43f666){_0x2539a9['push'](_0x2539a9['shift']());}};_0x103a7b(++_0x2697b7);}(_0xa660,0xb3));var _0x0a66=function(_0x4d7276,_0x1d38e2){_0x4d7276=_0x4d7276-0x0;var _0x3ffc0e=_0xa660[_0x4d7276];return _0x3ffc0e;};'use strict';var util=require(_0x0a66('0x0'));var _=require(_0x0a66('0x1'));var Redis=require(_0x0a66('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x0a66('0x3'));var logger=require(_0x0a66('0x4'))('api');var config=require('../../config/environment');var db=require(_0x0a66('0x5'))['db'];config['redis']=_[_0x0a66('0x6')](config[_0x0a66('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a66('0x8'))(new Redis(config['redis']));require(_0x0a66('0x9'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a66('0xa')][_0x0a66('0xb')]({'port':0x232c});var client9002=jayson['client'][_0x0a66('0xb')]({'port':0x232a});var interaction_log=require(_0x0a66('0x4'))('openchannel-interactions');function respondWithRpcPromise(_0x30b48e,_0x4e6d1e,_0x36b24,_0x37dbfc){return new Promise(function(_0x39ca67,_0xc9eba7){var _0x38ba7f=_0x37dbfc||client;return _0x38ba7f[_0x0a66('0xc')](_0x30b48e,_0x36b24)[_0x0a66('0xd')](function(_0x431f40){logger[_0x0a66('0xe')](_0x0a66('0xf'),_0x4e6d1e,'request\x20sent');logger['debug'](_0x0a66('0x10'),_0x4e6d1e,_0x0a66('0x11'),JSON[_0x0a66('0x12')](_0x431f40));if(_0x431f40[_0x0a66('0x13')]){if(_0x431f40['error']['code']===0x1f4){logger[_0x0a66('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e6d1e,_0x431f40[_0x0a66('0x13')][_0x0a66('0x14')]);return _0xc9eba7(_0x431f40[_0x0a66('0x13')]['message']);}logger[_0x0a66('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e6d1e,_0x431f40[_0x0a66('0x13')][_0x0a66('0x14')]);return _0x39ca67(_0x431f40[_0x0a66('0x13')][_0x0a66('0x14')]);}else{logger[_0x0a66('0xe')](_0x0a66('0xf'),_0x4e6d1e,_0x0a66('0x11'));_0x39ca67(_0x431f40[_0x0a66('0x15')][_0x0a66('0x14')]);}})[_0x0a66('0x16')](function(_0xf4e3cb){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4e6d1e,_0xf4e3cb);_0xc9eba7(_0xf4e3cb);});});}function respondWithResult(_0x44d8dc,_0x5818cb){_0x5818cb=_0x5818cb||0xc8;return function(_0x6b1202){if(_0x6b1202){return _0x44d8dc[_0x0a66('0x17')](_0x5818cb)[_0x0a66('0x18')](_0x6b1202);}};}function respondWithFilteredResult(_0xcd9f9d,_0x587b09){return function(_0x5f029f){if(_0x5f029f){var _0x3cd896=typeof _0x587b09[_0x0a66('0x19')]==='undefined'&&typeof _0x587b09[_0x0a66('0x1a')]===_0x0a66('0x1b');var _0x1afb75=_0x5f029f['count'];var _0x25dca3=_0x3cd896?0x0:_0x587b09[_0x0a66('0x19')];var _0x3cd184=_0x3cd896?_0x5f029f[_0x0a66('0x1c')]:_0x587b09[_0x0a66('0x19')]+_0x587b09[_0x0a66('0x1a')];var _0x4418cb;if(_0x3cd184>=_0x1afb75){_0x3cd184=_0x1afb75;_0x4418cb=0xc8;}else{_0x4418cb=0xce;}_0xcd9f9d[_0x0a66('0x17')](_0x4418cb);return _0xcd9f9d[_0x0a66('0x1d')](_0x0a66('0x1e'),_0x25dca3+'-'+_0x3cd184+'/'+_0x1afb75)[_0x0a66('0x18')](_0x5f029f);}return null;};}function saveUpdates(_0x50bd69){return function(_0x3df12e){if(_0x3df12e){return _0x3df12e[_0x0a66('0x1f')](_0x50bd69)[_0x0a66('0xd')](function(_0x42e31d){return _0x42e31d;});}return null;};}function removeEntity(_0x420356){return function(_0x5c78ac){if(_0x5c78ac){return _0x5c78ac[_0x0a66('0x20')]()[_0x0a66('0xd')](function(){_0x420356[_0x0a66('0x17')](0xcc)[_0x0a66('0x21')]();});}};}function handleEntityNotFound(_0x51534a){return function(_0x29f30d){if(!_0x29f30d){_0x51534a[_0x0a66('0x22')](0x194);}return _0x29f30d;};}function handleError(_0xa37138,_0x5ef9fc){_0x5ef9fc=_0x5ef9fc||0x1f4;return function(_0x5ef91a){logger[_0x0a66('0x13')](_0x5ef91a[_0x0a66('0x23')]);if(_0x5ef91a[_0x0a66('0x24')]){delete _0x5ef91a[_0x0a66('0x24')];}_0xa37138['status'](_0x5ef9fc)[_0x0a66('0x25')](_0x5ef91a);};}exports['index']=function(_0x3aaaf0,_0xcd4069){var _0x4bcf85={},_0x3f07d5={},_0x1f1891={'count':0x0,'rows':[]};var _0x3c2240=_[_0x0a66('0x26')](db[_0x0a66('0x27')][_0x0a66('0x28')],function(_0x5b19ca){return{'name':_0x5b19ca[_0x0a66('0x29')],'type':_0x5b19ca[_0x0a66('0x2a')][_0x0a66('0x2b')]};});_0x3f07d5[_0x0a66('0x2c')]=_[_0x0a66('0x26')](_0x3c2240,_0x0a66('0x24'));_0x3f07d5['query']=_[_0x0a66('0x2d')](_0x3aaaf0[_0x0a66('0x2e')]);_0x3f07d5['filters']=_[_0x0a66('0x2f')](_0x3f07d5[_0x0a66('0x2c')],_0x3f07d5[_0x0a66('0x2e')]);_0x4bcf85[_0x0a66('0x30')]=_[_0x0a66('0x2f')](_0x3f07d5[_0x0a66('0x2c')],qs[_0x0a66('0x31')](_0x3aaaf0[_0x0a66('0x2e')]['fields']));_0x4bcf85['attributes']=_0x4bcf85[_0x0a66('0x30')][_0x0a66('0x32')]?_0x4bcf85[_0x0a66('0x30')]:_0x3f07d5[_0x0a66('0x2c')];if(!_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x33')](_0x0a66('0x34'))){_0x4bcf85[_0x0a66('0x1a')]=qs[_0x0a66('0x1a')](_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x1a')]);_0x4bcf85['offset']=qs[_0x0a66('0x19')](_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x19')]);}_0x4bcf85[_0x0a66('0x35')]=qs[_0x0a66('0x36')](_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x36')]);_0x4bcf85[_0x0a66('0x37')]=qs[_0x0a66('0x38')](_['pick'](_0x3aaaf0[_0x0a66('0x2e')],_0x3f07d5[_0x0a66('0x38')]),_0x3c2240);if(_0x3aaaf0[_0x0a66('0x2e')]['filter']){_0x4bcf85[_0x0a66('0x37')]=_[_0x0a66('0x39')](_0x4bcf85[_0x0a66('0x37')],{'$or':_[_0x0a66('0x26')](_0x3c2240,function(_0x4a69e1){if(_0x4a69e1['type']!==_0x0a66('0x3a')){var _0x277b41={};_0x277b41[_0x4a69e1[_0x0a66('0x24')]]={'$like':'%'+_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x3b')]+'%'};return _0x277b41;}})});}_0x4bcf85=_['merge']({},_0x4bcf85,_0x3aaaf0[_0x0a66('0x3c')]);var _0x4f6ea6={'where':_0x4bcf85[_0x0a66('0x37')]};return db[_0x0a66('0x27')]['count'](_0x4f6ea6)[_0x0a66('0xd')](function(_0x44ed5d){_0x1f1891['count']=_0x44ed5d;if(_0x3aaaf0[_0x0a66('0x2e')][_0x0a66('0x3d')]){_0x4bcf85[_0x0a66('0x3e')]=[{'all':!![]}];}return db[_0x0a66('0x27')]['findAll'](_0x4bcf85);})[_0x0a66('0xd')](function(_0x66d178){_0x1f1891['rows']=_0x66d178;return _0x1f1891;})['then'](respondWithFilteredResult(_0xcd4069,_0x4bcf85))[_0x0a66('0x16')](handleError(_0xcd4069,null));};exports[_0x0a66('0x3f')]=function(_0x11075f,_0xe5af69){var _0x91e274={'raw':!![],'where':{'id':_0x11075f[_0x0a66('0x40')]['id']}},_0x36dae7={};_0x36dae7['model']=_['keys'](db[_0x0a66('0x27')][_0x0a66('0x28')]);_0x36dae7['query']=_[_0x0a66('0x2d')](_0x11075f[_0x0a66('0x2e')]);_0x36dae7['filters']=_[_0x0a66('0x2f')](_0x36dae7['model'],_0x36dae7[_0x0a66('0x2e')]);_0x91e274[_0x0a66('0x30')]=_[_0x0a66('0x2f')](_0x36dae7[_0x0a66('0x2c')],qs[_0x0a66('0x31')](_0x11075f[_0x0a66('0x2e')][_0x0a66('0x31')]));_0x91e274[_0x0a66('0x30')]=_0x91e274[_0x0a66('0x30')]['length']?_0x91e274[_0x0a66('0x30')]:_0x36dae7[_0x0a66('0x2c')];if(_0x11075f[_0x0a66('0x2e')]['includeAll']){_0x91e274['include']=[{'all':!![]}];}_0x91e274=_['merge']({},_0x91e274,_0x11075f[_0x0a66('0x3c')]);return db[_0x0a66('0x27')]['find'](_0x91e274)[_0x0a66('0xd')](handleEntityNotFound(_0xe5af69,null))['then'](respondWithResult(_0xe5af69,null))[_0x0a66('0x16')](handleError(_0xe5af69,null));};exports['create']=function(_0x347b7e,_0x4eb70b){return db[_0x0a66('0x27')][_0x0a66('0x41')](_0x347b7e[_0x0a66('0x42')],{})['then'](respondWithResult(_0x4eb70b,0xc9))[_0x0a66('0x16')](handleError(_0x4eb70b,null));};exports[_0x0a66('0x1f')]=function(_0x40a6f3,_0x60fe2c){if(_0x40a6f3[_0x0a66('0x42')]['id']){delete _0x40a6f3[_0x0a66('0x42')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x40a6f3[_0x0a66('0x40')]['id']}})[_0x0a66('0xd')](handleEntityNotFound(_0x60fe2c,null))[_0x0a66('0xd')](saveUpdates(_0x40a6f3['body'],null))[_0x0a66('0xd')](respondWithResult(_0x60fe2c,null))['catch'](handleError(_0x60fe2c,null));};exports[_0x0a66('0x20')]=function(_0x15ca8f,_0x315919){return db[_0x0a66('0x27')][_0x0a66('0x43')]({'where':{'id':_0x15ca8f[_0x0a66('0x40')]['id']}})[_0x0a66('0xd')](handleEntityNotFound(_0x315919,null))[_0x0a66('0xd')](removeEntity(_0x315919,null))[_0x0a66('0x16')](handleError(_0x315919,null));};exports['describe']=function(_0x252aae,_0x1f7bba){return db[_0x0a66('0x27')][_0x0a66('0x44')]()[_0x0a66('0xd')](respondWithResult(_0x1f7bba,null))[_0x0a66('0x16')](handleError(_0x1f7bba,null));};exports[_0x0a66('0x45')]=function(_0x446e45,_0x1b8579){var _0x21b435=_0x0a66('0x46');return interactionService['acceptMessage'](_0x446e45,_0x21b435)[_0x0a66('0xd')](respondWithResult(_0x1b8579,null))[_0x0a66('0x16')](handleError(_0x1b8579,null));};exports[_0x0a66('0x47')]=function(_0x5d5c57,_0x248940){var _0x39305a={'agent':{},'channel':_0x0a66('0x46')};if(_0x5d5c57[_0x0a66('0x42')]['id']){delete _0x5d5c57[_0x0a66('0x42')]['id'];}_0x5d5c57[_0x0a66('0x42')]['UserId']=_0x5d5c57[_0x0a66('0x42')]['UserId']||_0x5d5c57[_0x0a66('0x48')]['id'];_0x39305a[_0x0a66('0x49')]['id']=_0x5d5c57[_0x0a66('0x42')][_0x0a66('0x4a')];return db[_0x0a66('0x27')]['find']({'where':{'id':_0x5d5c57[_0x0a66('0x40')]['id'],'UserId':null}})[_0x0a66('0xd')](handleEntityNotFound(_0x248940,null))[_0x0a66('0xd')](function(_0x497054){if(_0x497054){_0x39305a[_0x0a66('0x14')]=_0x497054[_0x0a66('0x4b')]({'plain':!![]});return db[_0x0a66('0x4c')][_0x0a66('0x43')]({'where':{'id':_0x497054['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x248940,null))[_0x0a66('0xd')](function(_0x535592){if(_0x535592){_0x39305a[_0x0a66('0x4d')]=_0x535592[_0x0a66('0x4b')]({'plain':!![]});interaction_log[_0x0a66('0xe')](_0x0a66('0x4e'),_0x5d5c57[_0x0a66('0x48')]['id'],_0x5d5c57[_0x0a66('0x48')][_0x0a66('0x24')],_0x5d5c57[_0x0a66('0x48')][_0x0a66('0x4f')],_0x39305a[_0x0a66('0x4d')]['id'],_0x5d5c57[_0x0a66('0x42')]?JSON['stringify'](_0x5d5c57[_0x0a66('0x42')]):'null');return respondWithRpcPromise(_0x0a66('0x50'),'rejectMessage',_0x39305a);}return null;})['then'](function(_0x2403eb){var _0x1dce28='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2403eb['message'][_0x0a66('0x51')];return db[_0x0a66('0x52')][_0x0a66('0x2e')](_0x1dce28,{'type':db[_0x0a66('0x53')][_0x0a66('0x54')][_0x0a66('0x55')],'raw':!![]})[_0x0a66('0xd')](function(_0x316b5f){return _0x316b5f;});})[_0x0a66('0xd')](function(_0x56b374){if(_0x56b374){_0x39305a[_0x0a66('0x14')][_0x0a66('0x56')]=_0x56b374[0x0];if(!_0x5d5c57[_0x0a66('0x42')][_0x0a66('0x4a')])return;return db[_0x0a66('0x57')][_0x0a66('0x43')]({'where':{'id':_0x5d5c57[_0x0a66('0x42')][_0x0a66('0x4a')],'role':_0x0a66('0x49')},'attributes':['id',_0x0a66('0x24'),'fullname','email',_0x0a66('0x58')],'raw':!![]});}return null;})['then'](function(_0x3419e2){if(!_0x3419e2)return null;_0x39305a[_0x0a66('0x14')][_0x0a66('0x49')]=_0x3419e2;return _0x39305a;})[_0x0a66('0xd')](function(_0x121b78){if(_0x121b78){_0x121b78[_0x0a66('0x14')][_0x0a66('0x59')]=util[_0x0a66('0x5a')](_0x0a66('0x5b'),_0x5d5c57[_0x0a66('0x48')][_0x0a66('0x24')]);_0x121b78[_0x0a66('0x14')]['channel']=_0x39305a[_0x0a66('0x5c')];_0x121b78['message']['motionChannel']=_0x39305a[_0x0a66('0x5c')];_0x121b78['message'][_0x0a66('0x5d')]='reject';respondWithRpcPromise(_0x0a66('0x5e'),_0x0a66('0x5e'),{'event':_0x0a66('0x5f'),'message':_0x121b78[_0x0a66('0x14')]},client9002);return _0x39305a;}return null;})[_0x0a66('0xd')](respondWithResult(_0x248940,null))[_0x0a66('0x16')](handleError(_0x248940,null));}; \ No newline at end of file +var _0x8dc5=['attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','find','create','body','describe','accept','openchannel','acceptMessage','reject','UserId','agent','get','OpenchannelInteraction','interaction','user','stringify','null','rejectMessage','ContactId','Sequelize','QueryTypes','SELECT','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','util','lodash','../../components/interaction/service','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','openchannel-interactions','request','info','OpenchannelMessage,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','status','json','offset','count','limit','set','update','then','destroy','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x3ff99a,_0x2a5667){var _0x2d3557=function(_0x39db2b){while(--_0x39db2b){_0x3ff99a['push'](_0x3ff99a['shift']());}};_0x2d3557(++_0x2a5667);}(_0x8dc5,0x147));var _0x58dc=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0x8dc5[_0x1cd65a];return _0xf93849;};'use strict';var util=require(_0x58dc('0x0'));var _=require(_0x58dc('0x1'));var Redis=require('ioredis');var interactionService=require(_0x58dc('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x58dc('0x3'))('api');var config=require('../../config/environment');var db=require(_0x58dc('0x4'))['db'];config[_0x58dc('0x5')]=_[_0x58dc('0x6')](config[_0x58dc('0x5')],{'host':_0x58dc('0x7'),'port':0x18eb});var socket=require(_0x58dc('0x8'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x58dc('0x9')](socket);var jayson=require('jayson/promise');var client=jayson[_0x58dc('0xa')][_0x58dc('0xb')]({'port':0x232c});var client9002=jayson[_0x58dc('0xa')][_0x58dc('0xb')]({'port':0x232a});var interaction_log=require(_0x58dc('0x3'))(_0x58dc('0xc'));function respondWithRpcPromise(_0x681763,_0x520b85,_0x2bee08,_0x1107c4){return new Promise(function(_0x32a5c6,_0x13ecc8){var _0x1bb9a4=_0x1107c4||client;return _0x1bb9a4[_0x58dc('0xd')](_0x681763,_0x2bee08)['then'](function(_0x21770e){logger[_0x58dc('0xe')](_0x58dc('0xf'),_0x520b85,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x520b85,'request\x20sent',JSON['stringify'](_0x21770e));if(_0x21770e['error']){if(_0x21770e['error'][_0x58dc('0x10')]===0x1f4){logger[_0x58dc('0x11')](_0x58dc('0xf'),_0x520b85,_0x21770e[_0x58dc('0x11')][_0x58dc('0x12')]);return _0x13ecc8(_0x21770e['error']['message']);}logger[_0x58dc('0x11')](_0x58dc('0xf'),_0x520b85,_0x21770e[_0x58dc('0x11')][_0x58dc('0x12')]);return _0x32a5c6(_0x21770e[_0x58dc('0x11')]['message']);}else{logger['info'](_0x58dc('0xf'),_0x520b85,_0x58dc('0x13'));_0x32a5c6(_0x21770e[_0x58dc('0x14')][_0x58dc('0x12')]);}})[_0x58dc('0x15')](function(_0x1e90b7){logger[_0x58dc('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x520b85,_0x1e90b7);_0x13ecc8(_0x1e90b7);});});}function respondWithResult(_0x144267,_0x180d79){_0x180d79=_0x180d79||0xc8;return function(_0x2df31f){if(_0x2df31f){return _0x144267[_0x58dc('0x16')](_0x180d79)[_0x58dc('0x17')](_0x2df31f);}};}function respondWithFilteredResult(_0x1e2022,_0x27e130){return function(_0x488220){if(_0x488220){var _0x4d7318=typeof _0x27e130[_0x58dc('0x18')]==='undefined'&&typeof _0x27e130['limit']==='undefined';var _0x2250e4=_0x488220[_0x58dc('0x19')];var _0x515fb5=_0x4d7318?0x0:_0x27e130[_0x58dc('0x18')];var _0x5b580f=_0x4d7318?_0x488220[_0x58dc('0x19')]:_0x27e130[_0x58dc('0x18')]+_0x27e130[_0x58dc('0x1a')];var _0x37f6ec;if(_0x5b580f>=_0x2250e4){_0x5b580f=_0x2250e4;_0x37f6ec=0xc8;}else{_0x37f6ec=0xce;}_0x1e2022[_0x58dc('0x16')](_0x37f6ec);return _0x1e2022[_0x58dc('0x1b')]('Content-Range',_0x515fb5+'-'+_0x5b580f+'/'+_0x2250e4)[_0x58dc('0x17')](_0x488220);}return null;};}function saveUpdates(_0x11b83d){return function(_0x59b854){if(_0x59b854){return _0x59b854[_0x58dc('0x1c')](_0x11b83d)[_0x58dc('0x1d')](function(_0x5e3917){return _0x5e3917;});}return null;};}function removeEntity(_0x5e9edc){return function(_0x45a35c){if(_0x45a35c){return _0x45a35c[_0x58dc('0x1e')]()['then'](function(){_0x5e9edc[_0x58dc('0x16')](0xcc)[_0x58dc('0x1f')]();});}};}function handleEntityNotFound(_0x597713){return function(_0x33a67c){if(!_0x33a67c){_0x597713[_0x58dc('0x20')](0x194);}return _0x33a67c;};}function handleError(_0x40bd33,_0x6dff83){_0x6dff83=_0x6dff83||0x1f4;return function(_0x5b7a7f){logger['error'](_0x5b7a7f[_0x58dc('0x21')]);if(_0x5b7a7f['name']){delete _0x5b7a7f[_0x58dc('0x22')];}_0x40bd33[_0x58dc('0x16')](_0x6dff83)[_0x58dc('0x23')](_0x5b7a7f);};}exports[_0x58dc('0x24')]=function(_0x132f99,_0x51da08){var _0x110545={},_0x1cddc5={},_0x2ba57f={'count':0x0,'rows':[]};var _0x4ffff5=_[_0x58dc('0x25')](db[_0x58dc('0x26')][_0x58dc('0x27')],function(_0xee7e38){return{'name':_0xee7e38[_0x58dc('0x28')],'type':_0xee7e38[_0x58dc('0x29')][_0x58dc('0x2a')]};});_0x1cddc5[_0x58dc('0x2b')]=_[_0x58dc('0x25')](_0x4ffff5,_0x58dc('0x22'));_0x1cddc5[_0x58dc('0x2c')]=_[_0x58dc('0x2d')](_0x132f99[_0x58dc('0x2c')]);_0x1cddc5[_0x58dc('0x2e')]=_[_0x58dc('0x2f')](_0x1cddc5[_0x58dc('0x2b')],_0x1cddc5['query']);_0x110545['attributes']=_[_0x58dc('0x2f')](_0x1cddc5[_0x58dc('0x2b')],qs[_0x58dc('0x30')](_0x132f99['query']['fields']));_0x110545['attributes']=_0x110545[_0x58dc('0x31')][_0x58dc('0x32')]?_0x110545[_0x58dc('0x31')]:_0x1cddc5['model'];if(!_0x132f99[_0x58dc('0x2c')]['hasOwnProperty'](_0x58dc('0x33'))){_0x110545[_0x58dc('0x1a')]=qs[_0x58dc('0x1a')](_0x132f99[_0x58dc('0x2c')][_0x58dc('0x1a')]);_0x110545[_0x58dc('0x18')]=qs[_0x58dc('0x18')](_0x132f99[_0x58dc('0x2c')][_0x58dc('0x18')]);}_0x110545['order']=qs[_0x58dc('0x34')](_0x132f99['query'][_0x58dc('0x34')]);_0x110545[_0x58dc('0x35')]=qs[_0x58dc('0x2e')](_[_0x58dc('0x36')](_0x132f99[_0x58dc('0x2c')],_0x1cddc5['filters']),_0x4ffff5);if(_0x132f99['query'][_0x58dc('0x37')]){_0x110545[_0x58dc('0x35')]=_['merge'](_0x110545[_0x58dc('0x35')],{'$or':_[_0x58dc('0x25')](_0x4ffff5,function(_0x161e41){if(_0x161e41[_0x58dc('0x29')]!==_0x58dc('0x38')){var _0x307fc2={};_0x307fc2[_0x161e41[_0x58dc('0x22')]]={'$like':'%'+_0x132f99[_0x58dc('0x2c')][_0x58dc('0x37')]+'%'};return _0x307fc2;}})});}_0x110545=_[_0x58dc('0x39')]({},_0x110545,_0x132f99[_0x58dc('0x3a')]);var _0x426b42={'where':_0x110545[_0x58dc('0x35')]};return db[_0x58dc('0x26')][_0x58dc('0x19')](_0x426b42)['then'](function(_0x4f0609){_0x2ba57f['count']=_0x4f0609;if(_0x132f99['query'][_0x58dc('0x3b')]){_0x110545[_0x58dc('0x3c')]=[{'all':!![]}];}return db[_0x58dc('0x26')]['findAll'](_0x110545);})['then'](function(_0x4f5ead){_0x2ba57f['rows']=_0x4f5ead;return _0x2ba57f;})[_0x58dc('0x1d')](respondWithFilteredResult(_0x51da08,_0x110545))[_0x58dc('0x15')](handleError(_0x51da08,null));};exports[_0x58dc('0x3d')]=function(_0x50c769,_0x5deffd){var _0x1a3838={'raw':!![],'where':{'id':_0x50c769[_0x58dc('0x3e')]['id']}},_0x2c11b8={};_0x2c11b8[_0x58dc('0x2b')]=_['keys'](db[_0x58dc('0x26')][_0x58dc('0x27')]);_0x2c11b8[_0x58dc('0x2c')]=_['keys'](_0x50c769[_0x58dc('0x2c')]);_0x2c11b8[_0x58dc('0x2e')]=_['intersection'](_0x2c11b8[_0x58dc('0x2b')],_0x2c11b8['query']);_0x1a3838[_0x58dc('0x31')]=_[_0x58dc('0x2f')](_0x2c11b8[_0x58dc('0x2b')],qs['fields'](_0x50c769[_0x58dc('0x2c')][_0x58dc('0x30')]));_0x1a3838[_0x58dc('0x31')]=_0x1a3838[_0x58dc('0x31')][_0x58dc('0x32')]?_0x1a3838['attributes']:_0x2c11b8[_0x58dc('0x2b')];if(_0x50c769[_0x58dc('0x2c')][_0x58dc('0x3b')]){_0x1a3838[_0x58dc('0x3c')]=[{'all':!![]}];}_0x1a3838=_['merge']({},_0x1a3838,_0x50c769[_0x58dc('0x3a')]);return db[_0x58dc('0x26')][_0x58dc('0x3f')](_0x1a3838)[_0x58dc('0x1d')](handleEntityNotFound(_0x5deffd,null))['then'](respondWithResult(_0x5deffd,null))['catch'](handleError(_0x5deffd,null));};exports[_0x58dc('0x40')]=function(_0x2c372b,_0x125daa){return db[_0x58dc('0x26')][_0x58dc('0x40')](_0x2c372b[_0x58dc('0x41')],{})[_0x58dc('0x1d')](respondWithResult(_0x125daa,0xc9))[_0x58dc('0x15')](handleError(_0x125daa,null));};exports[_0x58dc('0x1c')]=function(_0x1fa056,_0x3a86fb){if(_0x1fa056[_0x58dc('0x41')]['id']){delete _0x1fa056[_0x58dc('0x41')]['id'];}return db['OpenchannelMessage'][_0x58dc('0x3f')]({'where':{'id':_0x1fa056[_0x58dc('0x3e')]['id']}})[_0x58dc('0x1d')](handleEntityNotFound(_0x3a86fb,null))['then'](saveUpdates(_0x1fa056['body'],null))[_0x58dc('0x1d')](respondWithResult(_0x3a86fb,null))[_0x58dc('0x15')](handleError(_0x3a86fb,null));};exports[_0x58dc('0x1e')]=function(_0x10dc2a,_0x36543c){return db[_0x58dc('0x26')]['find']({'where':{'id':_0x10dc2a[_0x58dc('0x3e')]['id']}})[_0x58dc('0x1d')](handleEntityNotFound(_0x36543c,null))[_0x58dc('0x1d')](removeEntity(_0x36543c,null))['catch'](handleError(_0x36543c,null));};exports[_0x58dc('0x42')]=function(_0x2a31d8,_0x442a9a){return db[_0x58dc('0x26')][_0x58dc('0x42')]()[_0x58dc('0x1d')](respondWithResult(_0x442a9a,null))[_0x58dc('0x15')](handleError(_0x442a9a,null));};exports[_0x58dc('0x43')]=function(_0x9e1efb,_0x54a903){var _0x5ef657=_0x58dc('0x44');return interactionService[_0x58dc('0x45')](_0x9e1efb,_0x5ef657)[_0x58dc('0x1d')](respondWithResult(_0x54a903,null))[_0x58dc('0x15')](handleError(_0x54a903,null));};exports[_0x58dc('0x46')]=function(_0x3ca264,_0x51c9a3){var _0x7e51ba={'agent':{},'channel':'openchannel'};if(_0x3ca264['body']['id']){delete _0x3ca264[_0x58dc('0x41')]['id'];}_0x3ca264[_0x58dc('0x41')][_0x58dc('0x47')]=_0x3ca264[_0x58dc('0x41')][_0x58dc('0x47')]||_0x3ca264['user']['id'];_0x7e51ba[_0x58dc('0x48')]['id']=_0x3ca264[_0x58dc('0x41')][_0x58dc('0x47')];return db[_0x58dc('0x26')]['find']({'where':{'id':_0x3ca264[_0x58dc('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51c9a3,null))['then'](function(_0x5355b4){if(_0x5355b4){_0x7e51ba[_0x58dc('0x12')]=_0x5355b4[_0x58dc('0x49')]({'plain':!![]});return db[_0x58dc('0x4a')]['find']({'where':{'id':_0x5355b4['OpenchannelInteractionId']}});}return null;})[_0x58dc('0x1d')](handleEntityNotFound(_0x51c9a3,null))['then'](function(_0x5bf1f1){if(_0x5bf1f1){_0x7e51ba[_0x58dc('0x4b')]=_0x5bf1f1[_0x58dc('0x49')]({'plain':!![]});interaction_log[_0x58dc('0xe')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ca264[_0x58dc('0x4c')]['id'],_0x3ca264[_0x58dc('0x4c')][_0x58dc('0x22')],_0x3ca264['user']['role'],_0x7e51ba[_0x58dc('0x4b')]['id'],_0x3ca264[_0x58dc('0x41')]?JSON[_0x58dc('0x4d')](_0x3ca264[_0x58dc('0x41')]):_0x58dc('0x4e'));return respondWithRpcPromise('RejectMessage',_0x58dc('0x4f'),_0x7e51ba);}return null;})[_0x58dc('0x1d')](function(_0x54af69){var _0x599b34='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54af69[_0x58dc('0x12')][_0x58dc('0x50')];return db['sequelize'][_0x58dc('0x2c')](_0x599b34,{'type':db[_0x58dc('0x51')][_0x58dc('0x52')][_0x58dc('0x53')],'raw':!![]})[_0x58dc('0x1d')](function(_0x3a2ef2){return _0x3a2ef2;});})['then'](function(_0x52a55b){if(_0x52a55b){_0x7e51ba['message']['contact']=_0x52a55b[0x0];if(!_0x3ca264['body'][_0x58dc('0x47')])return;return db['User']['find']({'where':{'id':_0x3ca264[_0x58dc('0x41')][_0x58dc('0x47')],'role':'agent'},'attributes':['id','name',_0x58dc('0x54'),_0x58dc('0x55'),_0x58dc('0x56')],'raw':!![]});}return null;})['then'](function(_0x15ee53){if(!_0x15ee53)return null;_0x7e51ba[_0x58dc('0x12')][_0x58dc('0x48')]=_0x15ee53;return _0x7e51ba;})[_0x58dc('0x1d')](function(_0x77ee42){if(_0x77ee42){_0x77ee42[_0x58dc('0x12')][_0x58dc('0x57')]=util[_0x58dc('0x58')](_0x58dc('0x59'),_0x3ca264['user'][_0x58dc('0x22')]);_0x77ee42[_0x58dc('0x12')][_0x58dc('0x5a')]=_0x7e51ba[_0x58dc('0x5a')];_0x77ee42[_0x58dc('0x12')][_0x58dc('0x5b')]=_0x7e51ba[_0x58dc('0x5a')];_0x77ee42[_0x58dc('0x12')][_0x58dc('0x5c')]='reject';respondWithRpcPromise(_0x58dc('0x5d'),'EventManager',{'event':'rejectmessage','message':_0x77ee42[_0x58dc('0x12')]},client9002);return _0x7e51ba;}return null;})[_0x58dc('0x1d')](respondWithResult(_0x51c9a3,null))['catch'](handleError(_0x51c9a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b035ab1..89cf0d9 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 _0x6579=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x118ecd,_0x32f365){var _0x223be2=function(_0x2905b1){while(--_0x2905b1){_0x118ecd['push'](_0x118ecd['shift']());}};_0x223be2(++_0x32f365);}(_0x6579,0x141));var _0x9657=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6579[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9657('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x9657('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9657('0x2')](0x0);var events={'afterCreate':_0x9657('0x3'),'afterUpdate':_0x9657('0x4'),'afterDestroy':_0x9657('0x5')};function emitEvent(_0x5a79a0){return function(_0x20405d,_0x217e07,_0x5c3c02){OpenchannelMessageEvents[_0x9657('0x6')](_0x5a79a0+':'+_0x20405d['id'],_0x20405d);OpenchannelMessageEvents[_0x9657('0x6')](_0x5a79a0,_0x20405d);_0x5c3c02(null);};}for(var e in events){if(events[_0x9657('0x7')](e)){var event=events[e];OpenchannelMessage[_0x9657('0x8')](e,emitEvent(event));}}module[_0x9657('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0418=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x0418,0x107));var _0x8041=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0418[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x8041('0x0'));var OpenchannelMessage=require(_0x8041('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8041('0x2')](0x0);var events={'afterCreate':_0x8041('0x3'),'afterUpdate':_0x8041('0x4'),'afterDestroy':_0x8041('0x5')};function emitEvent(_0x3ddd29){return function(_0x193618,_0x40b0dd,_0x2ffc3f){OpenchannelMessageEvents['emit'](_0x3ddd29+':'+_0x193618['id'],_0x193618);OpenchannelMessageEvents[_0x8041('0x6')](_0x3ddd29,_0x193618);_0x2ffc3f(null);};}for(var e in events){if(events[_0x8041('0x7')](e)){var event=events[e];OpenchannelMessage[_0x8041('0x8')](e,emitEvent(event));}}module[_0x8041('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 501619f..0dd635d 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 _0xcd74=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','body','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','catch','out','secret','describe','OpenchannelAccount','Interactions','Contact','replyUri','info','format','length','Interaction','omit','POST','method','GET','afterCreate','threadId','update','inspect'];(function(_0x120506,_0x6dfe51){var _0x447d55=function(_0x36ebea){while(--_0x36ebea){_0x120506['push'](_0x120506['shift']());}};_0x447d55(++_0x6dfe51);}(_0xcd74,0xad));var _0x4cd7=function(_0x5b51c5,_0x2ae38c){_0x5b51c5=_0x5b51c5-0x0;var _0x544068=_0xcd74[_0x5b51c5];return _0x544068;};'use strict';var _=require(_0x4cd7('0x0'));var util=require('util');var logger=require(_0x4cd7('0x1'))(_0x4cd7('0x2'));var moment=require(_0x4cd7('0x3'));var BPromise=require(_0x4cd7('0x4'));var rp=require(_0x4cd7('0x5'));var fs=require('fs');var path=require(_0x4cd7('0x6'));var rimraf=require(_0x4cd7('0x7'));var config=require(_0x4cd7('0x8'));var attributes=require(_0x4cd7('0x9'));module[_0x4cd7('0xa')]=function(_0x27a27e,_0x14f194){return _0x27a27e[_0x4cd7('0xb')](_0x4cd7('0xc'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x4cd7('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11f2d2,_0x300579,_0xdd0867){var _0x446de6=_0x27a27e['models'];var _0x1c4ca4=_0x11f2d2[_0x4cd7('0xe')]({'plain':!![]});if(_0x1c4ca4[_0x4cd7('0xf')][_0x4cd7('0x10')]()==='in'||_0x1c4ca4[_0x4cd7('0xf')][_0x4cd7('0x10')]()==='out'&&!_0x1c4ca4['secret']&&!_[_0x4cd7('0x11')](_0x1c4ca4[_0x4cd7('0x12')])){_0x446de6[_0x4cd7('0x13')]['findOne']({'where':{'id':_0x1c4ca4[_0x4cd7('0x14')]}})[_0x4cd7('0x15')](function(_0x5c1d79){if(_0x5c1d79){_0x5c1d79['update']({'lastMsgAt':_0x1c4ca4['createdAt'],'lastMsgDirection':_0x1c4ca4[_0x4cd7('0xf')]['toLowerCase']()});}})[_0x4cd7('0x16')](function(_0x5049ee){console['error'](_0x5049ee);});}if(_0x1c4ca4['direction']===_0x4cd7('0x17')&&!_0x1c4ca4[_0x4cd7('0x18')]){var _0x2219e8;_0x446de6['CmContact'][_0x4cd7('0x19')]()[_0x4cd7('0x15')](function(_0x9f58a3){return _0x446de6[_0x4cd7('0x1a')]['find']({'where':{'id':_0x1c4ca4['OpenchannelAccountId']},'include':[{'model':_0x446de6[_0x4cd7('0x13')],'as':_0x4cd7('0x1b'),'where':{'id':_0x1c4ca4[_0x4cd7('0x14')]},'limit':0x1,'include':[{'model':_0x446de6['CmContact'],'as':_0x4cd7('0x1c'),'attributes':_['keys'](_0x9f58a3)}]}]});})[_0x4cd7('0x15')](function(_0x1e9aa0){_0x2219e8=_0x1e9aa0[_0x4cd7('0xe')]({'plain':!![]});if(_0x2219e8&&_0x2219e8[_0x4cd7('0x1d')]){logger[_0x4cd7('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x4cd7('0x1f')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x1c4ca4['id'],_0x2219e8[_0x4cd7('0x1d')]));if(_0x2219e8[_0x4cd7('0x1b')]&&_0x2219e8['Interactions'][_0x4cd7('0x20')]){_0x1c4ca4[_0x4cd7('0x21')]=_[_0x4cd7('0x22')](_0x2219e8[_0x4cd7('0x1b')][0x0],_0x4cd7('0x1c'));_0x1c4ca4[_0x4cd7('0x1c')]=_0x2219e8[_0x4cd7('0x1b')][0x0]['Contact'];}var _0x300579={'method':_0x4cd7('0x23'),'uri':encodeURI(_0x2219e8[_0x4cd7('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x300579[_0x4cd7('0x24')]){case _0x4cd7('0x25'):_0x300579['qs']=_0x1c4ca4;break;case _0x4cd7('0x23'):_0x300579[_0x4cd7('0xd')]=_0x1c4ca4;break;}return rp(_0x300579)[_0x4cd7('0x15')](function(_0x3fede6){logger[_0x4cd7('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4cd7('0x26'),util[_0x4cd7('0x1f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1c4ca4['id'],_0x2219e8[_0x4cd7('0x1d')]));if(_0x3fede6[_0x4cd7('0xd')][_0x4cd7('0x27')]&&_0x3fede6[_0x4cd7('0xd')][_0x4cd7('0x27')]!=_0x1c4ca4[_0x4cd7('0x21')][_0x4cd7('0x27')]){return _0x446de6[_0x4cd7('0x13')][_0x4cd7('0x28')]({'threadId':_0x3fede6[_0x4cd7('0xd')]['threadId']},{'where':{'id':_0x1c4ca4['Interaction']['id']}});}else{return;}})[_0x4cd7('0x15')](function(){return _0x11f2d2[_0x4cd7('0x28')]({'read':!![]});})['catch'](function(_0x5dcdff){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4cd7('0x26'),util[_0x4cd7('0x29')](_0x5dcdff,{'showHidden':![],'depth':null}));_0xdd0867();});}else{_0xdd0867();}})['finally'](function(){_0xdd0867();});}else{_0xdd0867();}}},'charset':'utf8mb4','collate':_0x4cd7('0x2a')});}; \ No newline at end of file +var _0xd374=['Interaction','Contact','GET','POST','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','update','createdAt','catch','error','secret','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length'];(function(_0x2647a7,_0x215bd7){var _0x273569=function(_0x5d0877){while(--_0x5d0877){_0x2647a7['push'](_0x2647a7['shift']());}};_0x273569(++_0x215bd7);}(_0xd374,0x1a3));var _0x4d37=function(_0x1356ba,_0x3a145a){_0x1356ba=_0x1356ba-0x0;var _0x4517f5=_0xd374[_0x1356ba];return _0x4517f5;};'use strict';var _=require(_0x4d37('0x0'));var util=require(_0x4d37('0x1'));var logger=require(_0x4d37('0x2'))('api');var moment=require(_0x4d37('0x3'));var BPromise=require(_0x4d37('0x4'));var rp=require(_0x4d37('0x5'));var fs=require('fs');var path=require(_0x4d37('0x6'));var rimraf=require(_0x4d37('0x7'));var config=require(_0x4d37('0x8'));var attributes=require(_0x4d37('0x9'));module['exports']=function(_0x3dd003,_0x5a5f8e){return _0x3dd003[_0x4d37('0xa')](_0x4d37('0xb'),attributes,{'tableName':_0x4d37('0xc'),'paranoid':![],'indexes':[{'name':_0x4d37('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b5e4a,_0x3fc5e4,_0x7fe4b1){var _0x26c8a8=_0x3dd003[_0x4d37('0xe')];var _0x442bd2=_0x3b5e4a[_0x4d37('0xf')]({'plain':!![]});if(_0x442bd2[_0x4d37('0x10')][_0x4d37('0x11')]()==='in'||_0x442bd2['direction']['toLowerCase']()===_0x4d37('0x12')&&!_0x442bd2['secret']&&!_[_0x4d37('0x13')](_0x442bd2[_0x4d37('0x14')])){_0x26c8a8[_0x4d37('0x15')]['findOne']({'where':{'id':_0x442bd2['OpenchannelInteractionId']}})['then'](function(_0x238952){if(_0x238952){_0x238952[_0x4d37('0x16')]({'lastMsgAt':_0x442bd2[_0x4d37('0x17')],'lastMsgDirection':_0x442bd2['direction'][_0x4d37('0x11')]()});}})[_0x4d37('0x18')](function(_0x57dd8d){console[_0x4d37('0x19')](_0x57dd8d);});}if(_0x442bd2[_0x4d37('0x10')]==='out'&&!_0x442bd2[_0x4d37('0x1a')]){var _0x31cf16;_0x26c8a8[_0x4d37('0x1b')]['describe']()[_0x4d37('0x1c')](function(_0x3c1985){return _0x26c8a8[_0x4d37('0x1d')][_0x4d37('0x1e')]({'where':{'id':_0x442bd2[_0x4d37('0x1f')]},'include':[{'model':_0x26c8a8[_0x4d37('0x15')],'as':_0x4d37('0x20'),'where':{'id':_0x442bd2[_0x4d37('0x21')]},'limit':0x1,'include':[{'model':_0x26c8a8[_0x4d37('0x1b')],'as':'Contact','attributes':_['keys'](_0x3c1985)}]}]});})[_0x4d37('0x1c')](function(_0x32cfbc){_0x31cf16=_0x32cfbc[_0x4d37('0xf')]({'plain':!![]});if(_0x31cf16&&_0x31cf16[_0x4d37('0x22')]){logger['info'](_0x4d37('0x23'),_0x4d37('0x24'),util[_0x4d37('0x25')](_0x4d37('0x26'),_0x442bd2['id'],_0x31cf16[_0x4d37('0x22')]));if(_0x31cf16[_0x4d37('0x20')]&&_0x31cf16[_0x4d37('0x20')][_0x4d37('0x27')]){_0x442bd2[_0x4d37('0x28')]=_['omit'](_0x31cf16['Interactions'][0x0],_0x4d37('0x29'));_0x442bd2['Contact']=_0x31cf16[_0x4d37('0x20')][0x0][_0x4d37('0x29')];}var _0x3fc5e4={'method':'POST','uri':encodeURI(_0x31cf16[_0x4d37('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3fc5e4['method']){case _0x4d37('0x2a'):_0x3fc5e4['qs']=_0x442bd2;break;case _0x4d37('0x2b'):_0x3fc5e4[_0x4d37('0x2c')]=_0x442bd2;break;}return rp(_0x3fc5e4)['then'](function(_0x264a0f){logger[_0x4d37('0x2d')](_0x4d37('0x23'),'afterCreate',util[_0x4d37('0x25')](_0x4d37('0x2e'),_0x442bd2['id'],_0x31cf16[_0x4d37('0x22')]));if(_0x264a0f[_0x4d37('0x2c')][_0x4d37('0x2f')]&&_0x264a0f[_0x4d37('0x2c')]['threadId']!=_0x442bd2[_0x4d37('0x28')]['threadId']){return _0x26c8a8[_0x4d37('0x15')]['update']({'threadId':_0x264a0f['body'][_0x4d37('0x2f')]},{'where':{'id':_0x442bd2['Interaction']['id']}});}else{return;}})[_0x4d37('0x1c')](function(){return _0x3b5e4a['update']({'read':!![]});})[_0x4d37('0x18')](function(_0x1de2a2){logger[_0x4d37('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d37('0x24'),util[_0x4d37('0x30')](_0x1de2a2,{'showHidden':![],'depth':null}));_0x7fe4b1();});}else{_0x7fe4b1();}})['finally'](function(){_0x7fe4b1();});}else{_0x7fe4b1();}}},'charset':_0x4d37('0x31'),'collate':_0x4d37('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a00d9d8..e1f3478 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x5d9885,_0x2c15a7){var _0x5ad323=function(_0xdfd56f){while(--_0xdfd56f){_0x5d9885['push'](_0x5d9885['shift']());}};_0x5ad323(++_0x2c15a7);}(_0x2ef3,0xba));var _0x32ef=function(_0x54c817,_0x5d05c0){_0x54c817=_0x54c817-0x0;var _0x552ab3=_0x2ef3[_0x54c817];return _0x552ab3;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x2c0c82,_0xf25088){var _0x30846b=function(_0x453582){while(--_0x453582){_0x2c0c82['push'](_0x2c0c82['shift']());}};_0x30846b(++_0xf25088);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x0b0e[_0x4c2f17];return _0x20919e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3c08835..848d408 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 _0x214e=['save','update','emit','removeListener'];(function(_0x27fefa,_0x5b995a){var _0x9652a5=function(_0x4c50ec){while(--_0x4c50ec){_0x27fefa['push'](_0x27fefa['shift']());}};_0x9652a5(++_0x5b995a);}(_0x214e,0x148));var _0xe214=function(_0x35e50c,_0x37657a){_0x35e50c=_0x35e50c-0x0;var _0x425b22=_0x214e[_0x35e50c];return _0x425b22;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe214('0x0'),'remove',_0xe214('0x1')];function createListener(_0x556db2,_0x1d1aa6){return function(_0x4bad3d){_0x1d1aa6[_0xe214('0x2')](_0x556db2,_0x4bad3d);};}function removeListener(_0x531f72,_0x28d16d){return function(){OpenchannelMessageEvents[_0xe214('0x3')](_0x531f72,_0x28d16d);};}exports['register']=function(_0x5e5b6b){for(var _0x2b1244=0x0,_0x2a879b=events['length'];_0x2b1244<_0x2a879b;_0x2b1244++){var _0x5ea08f=events[_0x2b1244];var _0xc73140=createListener('openchannelMessage:'+_0x5ea08f,_0x5e5b6b);OpenchannelMessageEvents['on'](_0x5ea08f,_0xc73140);}}; \ No newline at end of file +var _0x49f5=['./openchannelMessage.events','remove','update','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49f5,0xf0));var _0x549f=function(_0x50890a,_0x3f4250){_0x50890a=_0x50890a-0x0;var _0x4579b6=_0x49f5[_0x50890a];return _0x4579b6;};'use strict';var OpenchannelMessageEvents=require(_0x549f('0x0'));var events=['save',_0x549f('0x1'),_0x549f('0x2')];function createListener(_0x135ca0,_0x20b5bb){return function(_0x5eb4bb){_0x20b5bb['emit'](_0x135ca0,_0x5eb4bb);};}function removeListener(_0x499797,_0x82262c){return function(){OpenchannelMessageEvents[_0x549f('0x3')](_0x499797,_0x82262c);};}exports['register']=function(_0x2facb9){for(var _0x31f3cc=0x0,_0x29a981=events['length'];_0x31f3cc<_0x29a981;_0x31f3cc++){var _0x14500e=events[_0x31f3cc];var _0x3e6705=createListener('openchannelMessage:'+_0x14500e,_0x2facb9);OpenchannelMessageEvents['on'](_0x14500e,_0x3e6705);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e575d39..dee1ee6 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 _0x16de=['create','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x187a6a,_0x41681f){var _0x400d83=function(_0x1a12a4){while(--_0x1a12a4){_0x187a6a['push'](_0x187a6a['shift']());}};_0x400d83(++_0x41681f);}(_0x16de,0x7b));var _0xe16d=function(_0x5e19fa,_0x2346d1){_0x5e19fa=_0x5e19fa-0x0;var _0x4477bf=_0x16de[_0x5e19fa];return _0x4477bf;};'use strict';var multer=require('multer');var util=require(_0xe16d('0x0'));var path=require('path');var timeout=require(_0xe16d('0x1'));var express=require('express');var router=express[_0xe16d('0x2')]();var fs_extra=require(_0xe16d('0x3'));var auth=require(_0xe16d('0x4'));var interaction=require(_0xe16d('0x5'));var config=require(_0xe16d('0x6'));var controller=require('./openchannelQueue.controller');router[_0xe16d('0x7')]('/',auth['isAuthenticated'](),controller[_0xe16d('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xe16d('0x9')](),controller['show']);router[_0xe16d('0x7')](_0xe16d('0xa'),auth[_0xe16d('0x9')](),controller[_0xe16d('0xb')]);router[_0xe16d('0x7')](_0xe16d('0xc'),auth[_0xe16d('0x9')](),controller[_0xe16d('0xd')]);router['get'](_0xe16d('0xe'),auth[_0xe16d('0x9')](),controller[_0xe16d('0xf')]);router[_0xe16d('0x10')]('/',auth[_0xe16d('0x9')](),controller[_0xe16d('0x11')]);router[_0xe16d('0x10')]('/:id/teams',auth[_0xe16d('0x9')](),controller[_0xe16d('0x12')]);router['post']('/:id/users',auth[_0xe16d('0x9')](),controller[_0xe16d('0x13')]);router[_0xe16d('0x14')]('/:id',auth[_0xe16d('0x9')](),controller[_0xe16d('0x15')]);router[_0xe16d('0x16')](_0xe16d('0x17'),auth[_0xe16d('0x9')](),controller[_0xe16d('0x18')]);router['delete'](_0xe16d('0xc'),auth[_0xe16d('0x9')](),controller[_0xe16d('0x19')]);router[_0xe16d('0x16')](_0xe16d('0xe'),auth[_0xe16d('0x9')](),controller[_0xe16d('0x1a')]);module[_0xe16d('0x1b')]=router; \ No newline at end of file +var _0xa080=['show','/:id/members','getMembers','getTeams','post','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x4a3de9,_0x452db5){var _0x4830dd=function(_0x49e111){while(--_0x49e111){_0x4a3de9['push'](_0x4a3de9['shift']());}};_0x4830dd(++_0x452db5);}(_0xa080,0x153));var _0x0a08=function(_0x2d0fe4,_0x150bb7){_0x2d0fe4=_0x2d0fe4-0x0;var _0x1221ed=_0xa080[_0x2d0fe4];return _0x1221ed;};'use strict';var multer=require(_0x0a08('0x0'));var util=require(_0x0a08('0x1'));var path=require('path');var timeout=require(_0x0a08('0x2'));var express=require(_0x0a08('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a08('0x4'));var interaction=require(_0x0a08('0x5'));var config=require(_0x0a08('0x6'));var controller=require(_0x0a08('0x7'));router[_0x0a08('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a08('0x9')]);router['get'](_0x0a08('0xa'),auth[_0x0a08('0xb')](),controller['describe']);router[_0x0a08('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a08('0xc')]);router[_0x0a08('0x8')](_0x0a08('0xd'),auth[_0x0a08('0xb')](),controller[_0x0a08('0xe')]);router[_0x0a08('0x8')]('/:id/teams',auth[_0x0a08('0xb')](),controller[_0x0a08('0xf')]);router[_0x0a08('0x8')]('/:id/users',auth[_0x0a08('0xb')](),controller['getAgents']);router[_0x0a08('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a08('0x10')](_0x0a08('0x11'),auth[_0x0a08('0xb')](),controller[_0x0a08('0x12')]);router['post'](_0x0a08('0x13'),auth['isAuthenticated'](),controller[_0x0a08('0x14')]);router[_0x0a08('0x15')](_0x0a08('0x16'),auth[_0x0a08('0xb')](),controller[_0x0a08('0x17')]);router[_0x0a08('0x18')](_0x0a08('0x16'),auth['isAuthenticated'](),controller[_0x0a08('0x19')]);router[_0x0a08('0x18')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x0a08('0xb')](),controller[_0x0a08('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ba6410f..a3952a3 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 _0x6b3a=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x46fa24,_0x2abf65){var _0x35869b=function(_0x41a744){while(--_0x41a744){_0x46fa24['push'](_0x46fa24['shift']());}};_0x35869b(++_0x2abf65);}(_0x6b3a,0xc7));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6b3('0x0'));module[_0xa6b3('0x1')]={'name':{'type':Sequelize[_0xa6b3('0x2')],'unique':_0xa6b3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa6b3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6b3('0x5')](_0xa6b3('0x6'),_0xa6b3('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x7978=['sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x595df6,_0x122bf5){var _0x1f0b0c=function(_0x2352e8){while(--_0x2352e8){_0x595df6['push'](_0x595df6['shift']());}};_0x1f0b0c(++_0x122bf5);}(_0x7978,0x11a));var _0x8797=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7978[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x8797('0x0'));module['exports']={'name':{'type':Sequelize[_0x8797('0x1')],'unique':_0x8797('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8797('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8797('0x3')](_0x8797('0x4'),_0x8797('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7000ad7..b741c95 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 _0xcc4c=['describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','all','union','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','json','update','then','get','UserProfileResource','destroy','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xcc4c,0x192));var _0xccc4=function(_0x46610e,_0x5d741f){_0x46610e=_0x46610e-0x0;var _0x3b91ef=_0xcc4c[_0x46610e];return _0x3b91ef;};'use strict';var BPromise=require(_0xccc4('0x0'));var util=require(_0xccc4('0x1'));var _=require(_0xccc4('0x2'));var squel=require('squel');var Redis=require(_0xccc4('0x3'));var qs=require(_0xccc4('0x4'));var logger=require('../../config/logger')(_0xccc4('0x5'));var config=require(_0xccc4('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xccc4('0x7')](config[_0xccc4('0x8')],{'host':_0xccc4('0x9'),'port':0x18eb});var socket=require(_0xccc4('0xa'))(new Redis(config['redis']));require(_0xccc4('0xb'))[_0xccc4('0xc')](socket);function respondWithStatusCode(_0x3d5410,_0x2fca6e){_0x2fca6e=_0x2fca6e||0xcc;return function(_0x4ff082){if(_0x4ff082){return _0x3d5410['sendStatus'](_0x2fca6e);}return _0x3d5410[_0xccc4('0xd')](_0x2fca6e)[_0xccc4('0xe')]();};}function respondWithResult(_0xba84cc,_0x4d94bf){_0x4d94bf=_0x4d94bf||0xc8;return function(_0x5d371f){if(_0x5d371f){return _0xba84cc['status'](_0x4d94bf)['json'](_0x5d371f);}};}function respondWithFilteredResult(_0x7ef910,_0x5d36a5){return function(_0x1f33c5){if(_0x1f33c5){var _0x757751=typeof _0x5d36a5[_0xccc4('0xf')]===_0xccc4('0x10')&&typeof _0x5d36a5[_0xccc4('0x11')]===_0xccc4('0x10');var _0x3614f9=_0x1f33c5['count'];var _0x23e537=_0x757751?0x0:_0x5d36a5[_0xccc4('0xf')];var _0x3dd3b6=_0x757751?_0x1f33c5[_0xccc4('0x12')]:_0x5d36a5[_0xccc4('0xf')]+_0x5d36a5[_0xccc4('0x11')];var _0xc253d8;if(_0x3dd3b6>=_0x3614f9){_0x3dd3b6=_0x3614f9;_0xc253d8=0xc8;}else{_0xc253d8=0xce;}_0x7ef910['status'](_0xc253d8);return _0x7ef910[_0xccc4('0x13')]('Content-Range',_0x23e537+'-'+_0x3dd3b6+'/'+_0x3614f9)[_0xccc4('0x14')](_0x1f33c5);}return null;};}function saveUpdates(_0xc34fc7){return function(_0x21710b){if(_0x21710b){return _0x21710b[_0xccc4('0x15')](_0xc34fc7)[_0xccc4('0x16')](function(_0x481f21){return _0x481f21;});}return null;};}function removeEntity(_0x353528){return function(_0x1b43ca){if(_0x1b43ca){return _0x1b43ca['destroy']()[_0xccc4('0x16')](function(){var _0x1ae484=_0x1b43ca[_0xccc4('0x17')]({'plain':!![]});var _0x1bc5eb='OpenchannelQueues';return db[_0xccc4('0x18')][_0xccc4('0x19')]({'where':{'type':_0x1bc5eb,'resourceId':_0x1ae484['id']}})[_0xccc4('0x16')](function(){return _0x1b43ca;});})[_0xccc4('0x16')](function(){_0x353528[_0xccc4('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7608b8){return function(_0x268266){if(!_0x268266){_0x7608b8['sendStatus'](0x194);}return _0x268266;};}function handleError(_0x2b1cb5,_0x27cb1a){_0x27cb1a=_0x27cb1a||0x1f4;return function(_0x24d243){logger['error'](_0x24d243[_0xccc4('0x1a')]);if(_0x24d243[_0xccc4('0x1b')]){delete _0x24d243[_0xccc4('0x1b')];}_0x2b1cb5[_0xccc4('0xd')](_0x27cb1a)[_0xccc4('0x1c')](_0x24d243);};}exports[_0xccc4('0x1d')]=function(_0x273b54,_0x153f9c){var _0x4a5f7b={};var _0x52c7da={'count':0x0,'rows':[]};var _0x4013c4=_['map'](db[_0xccc4('0x1e')][_0xccc4('0x1f')],function(_0x11e34f){return{'name':_0x11e34f[_0xccc4('0x20')],'type':_0x11e34f['type'][_0xccc4('0x21')]};});_0x4a5f7b=qs[_0xccc4('0x22')](_0x4013c4,_0x273b54);var _0x424c8f={'where':_0x4a5f7b['where']};return db[_0xccc4('0x1e')][_0xccc4('0x12')](_0x424c8f)[_0xccc4('0x16')](function(_0x11c624){_0x52c7da['count']=_0x11c624;_0x4a5f7b['include']=qs[_0xccc4('0x23')](_0x273b54[_0xccc4('0x24')]);return db[_0xccc4('0x1e')][_0xccc4('0x25')](_0x4a5f7b);})[_0xccc4('0x16')](function(_0x4b6c55){_0x52c7da[_0xccc4('0x26')]=_0x4b6c55;return _0x52c7da;})['then'](respondWithFilteredResult(_0x153f9c,_0x4a5f7b))[_0xccc4('0x27')](handleError(_0x153f9c,null));};exports['show']=function(_0x48b30b,_0x577f76){var _0x1bdbc4={'raw':!![],'where':{'id':_0x48b30b[_0xccc4('0x28')]['id']}},_0x723e7a={};_0x723e7a[_0xccc4('0x29')]=_[_0xccc4('0x2a')](db[_0xccc4('0x1e')][_0xccc4('0x1f')]);_0x723e7a[_0xccc4('0x24')]=_['keys'](_0x48b30b[_0xccc4('0x24')]);_0x723e7a[_0xccc4('0x2b')]=_[_0xccc4('0x2c')](_0x723e7a[_0xccc4('0x29')],_0x723e7a[_0xccc4('0x24')]);_0x1bdbc4[_0xccc4('0x2d')]=_[_0xccc4('0x2c')](_0x723e7a[_0xccc4('0x29')],qs[_0xccc4('0x2e')](_0x48b30b[_0xccc4('0x24')][_0xccc4('0x2e')]));_0x1bdbc4[_0xccc4('0x2d')]=_0x1bdbc4[_0xccc4('0x2d')]['length']?_0x1bdbc4['attributes']:_0x723e7a[_0xccc4('0x29')];if(_0x48b30b[_0xccc4('0x24')][_0xccc4('0x2f')]){_0x1bdbc4[_0xccc4('0x23')]=[{'all':!![]}];}_0x1bdbc4=_['merge']({},_0x1bdbc4,_0x48b30b[_0xccc4('0x30')]);return db[_0xccc4('0x1e')]['find'](_0x1bdbc4)[_0xccc4('0x16')](handleEntityNotFound(_0x577f76,null))[_0xccc4('0x16')](respondWithResult(_0x577f76,null))[_0xccc4('0x27')](handleError(_0x577f76,null));};exports[_0xccc4('0x31')]=function(_0x52969b,_0x3d308a){return db[_0xccc4('0x1e')][_0xccc4('0x31')](_0x52969b[_0xccc4('0x32')],{})['then'](function(_0x3f15fd){var _0x46a619=_0x52969b[_0xccc4('0x33')]['get']({'plain':!![]});if(!_0x46a619)throw new Error(_0xccc4('0x34'));if(_0x46a619[_0xccc4('0x35')]===_0xccc4('0x33')){var _0x2e60e9=_0x3f15fd['get']({'plain':!![]});var _0x12e65='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x12e65,'userProfileId':_0x46a619[_0xccc4('0x36')]},'raw':!![]})[_0xccc4('0x16')](function(_0x40e2f3){if(_0x40e2f3&&_0x40e2f3['autoAssociation']===0x0){return db['UserProfileResource'][_0xccc4('0x31')]({'name':_0x2e60e9['name'],'resourceId':_0x2e60e9['id'],'type':_0x40e2f3[_0xccc4('0x1b')],'sectionId':_0x40e2f3['id']},{})[_0xccc4('0x16')](function(){return _0x3f15fd;});}else{return _0x3f15fd;}})[_0xccc4('0x27')](function(_0x17cfe0){logger[_0xccc4('0x37')](_0xccc4('0x38'),_0x17cfe0);throw _0x17cfe0;});}return _0x3f15fd;})[_0xccc4('0x16')](respondWithResult(_0x3d308a,0xc9))[_0xccc4('0x27')](handleError(_0x3d308a,null));};exports[_0xccc4('0x15')]=function(_0x410de3,_0x91653c){if(_0x410de3[_0xccc4('0x32')]['id']){delete _0x410de3[_0xccc4('0x32')]['id'];}return db[_0xccc4('0x1e')]['find']({'where':{'id':_0x410de3[_0xccc4('0x28')]['id']}})[_0xccc4('0x16')](handleEntityNotFound(_0x91653c,null))[_0xccc4('0x16')](saveUpdates(_0x410de3[_0xccc4('0x32')],null))[_0xccc4('0x16')](respondWithResult(_0x91653c,null))[_0xccc4('0x27')](handleError(_0x91653c,null));};exports[_0xccc4('0x19')]=function(_0x5718e3,_0x3bc997){return db[_0xccc4('0x1e')][_0xccc4('0x39')]({'where':{'id':_0x5718e3[_0xccc4('0x28')]['id']}})[_0xccc4('0x16')](handleEntityNotFound(_0x3bc997,null))['then'](removeEntity(_0x3bc997,null))[_0xccc4('0x27')](handleError(_0x3bc997,null));};exports[_0xccc4('0x3a')]=function(_0x254eb6,_0xf9c70c){return db[_0xccc4('0x1e')][_0xccc4('0x3a')]()[_0xccc4('0x16')](respondWithResult(_0xf9c70c,null))['catch'](handleError(_0xf9c70c,null));};exports[_0xccc4('0x3b')]=function(_0x2569b6,_0x263972){var _0x254cba={'raw':!![],'where':{}},_0x1a23f2={},_0x2b615f;return db['OpenchannelQueue'][_0xccc4('0x3c')]({'where':{'id':_0x2569b6[_0xccc4('0x28')]['id']}})['then'](handleEntityNotFound(_0x263972,null))[_0xccc4('0x16')](function(_0x438608){if(_0x438608){_0x2b615f=_0x438608['get']({'plain':!![]});_0x1a23f2['model']=_[_0xccc4('0x2a')](db['UserOpenchannelQueue'][_0xccc4('0x1f')]);_0x1a23f2[_0xccc4('0x24')]=_[_0xccc4('0x2a')](_0x2569b6['query']);_0x1a23f2[_0xccc4('0x2b')]=_[_0xccc4('0x2c')](_0x1a23f2[_0xccc4('0x29')],_0x1a23f2[_0xccc4('0x24')]);_0x254cba['attributes']=_[_0xccc4('0x2c')](_0x1a23f2[_0xccc4('0x29')],qs[_0xccc4('0x2e')](_0x2569b6[_0xccc4('0x24')][_0xccc4('0x2e')]));_0x254cba[_0xccc4('0x2d')]=_0x254cba[_0xccc4('0x2d')][_0xccc4('0x3d')]?_0x254cba[_0xccc4('0x2d')]:_0x1a23f2[_0xccc4('0x29')];if(!_0x2569b6[_0xccc4('0x24')][_0xccc4('0x3e')](_0xccc4('0x3f'))){_0x254cba[_0xccc4('0x11')]=qs['limit'](_0x2569b6[_0xccc4('0x24')][_0xccc4('0x11')]);_0x254cba[_0xccc4('0xf')]=qs[_0xccc4('0xf')](_0x2569b6[_0xccc4('0x24')][_0xccc4('0xf')]);}_0x254cba[_0xccc4('0x40')]=qs[_0xccc4('0x41')](_0x2569b6[_0xccc4('0x24')]['sort']);_0x254cba['where']=qs[_0xccc4('0x2b')](_[_0xccc4('0x42')](_0x2569b6[_0xccc4('0x24')],_0x1a23f2[_0xccc4('0x2b')]));_0x254cba['where']['OpenchannelQueueId']=_0x438608['id'];if(_0x2569b6[_0xccc4('0x24')][_0xccc4('0x43')]){_0x254cba[_0xccc4('0x44')]=_[_0xccc4('0x45')](_0x254cba[_0xccc4('0x44')],{'$or':_[_0xccc4('0x46')](_0x254cba['attributes'],function(_0x4d67ab){var _0x4b0692={};_0x4b0692[_0x4d67ab]={'$like':'%'+_0x2569b6[_0xccc4('0x24')][_0xccc4('0x43')]+'%'};return _0x4b0692;})});}_0x254cba=_[_0xccc4('0x45')]({},_0x254cba,_0x2569b6[_0xccc4('0x30')]);return db['UserOpenchannelQueue'][_0xccc4('0x25')](_0x254cba);}})[_0xccc4('0x16')](function(_0x2d5abb){if(_0x2d5abb){return db[_0xccc4('0x47')][_0xccc4('0x48')]({'where':{'id':_[_0xccc4('0x46')](_0x2d5abb,_0xccc4('0x49')),'role':_0xccc4('0x4a')},'attributes':['id',_0xccc4('0x1b'),_0xccc4('0x4b'),_0xccc4('0x4c'),_0xccc4('0x4d')]});}})[_0xccc4('0x16')](function(_0x5734a6){if(_0x5734a6){return{'count':_0x5734a6[_0xccc4('0x12')],'rows':_[_0xccc4('0x46')](_0x5734a6['rows'],function(_0x2ee4fe){return{'membername':_0x2ee4fe[_0xccc4('0x1b')],'UserId':_0x2ee4fe['id'],'queue_name':_0x2b615f[_0xccc4('0x1b')],'OpenchannelQueueId':_0x2b615f['id'],'interface':util['format']('%s/%s',_0xccc4('0x4e'),_0x2ee4fe[_0xccc4('0x1b')]),'penalty':0x0,'paused':_0x2ee4fe[_0xccc4('0x4b')],'createdAt':_0x2ee4fe['createdAt'],'updatedAt':_0x2ee4fe[_0xccc4('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xccc4('0x16')](respondWithFilteredResult(_0x263972,_0x254cba))['catch'](handleError(_0x263972,null));};exports['getTeams']=function(_0x255fa5,_0x547ee1){var _0x1f16a4={};var _0x34ecd1={};var _0x22342e;var _0x1b7a29;return db[_0xccc4('0x1e')][_0xccc4('0x3c')]({'where':{'id':_0x255fa5[_0xccc4('0x28')]['id']}})[_0xccc4('0x16')](handleEntityNotFound(_0x547ee1,null))[_0xccc4('0x16')](function(_0x361215){if(_0x361215){_0x22342e=_0x361215;_0x34ecd1[_0xccc4('0x29')]=_[_0xccc4('0x2a')](db[_0xccc4('0x4f')][_0xccc4('0x1f')]);_0x34ecd1[_0xccc4('0x24')]=_[_0xccc4('0x2a')](_0x255fa5[_0xccc4('0x24')]);_0x34ecd1['filters']=_['intersection'](_0x34ecd1[_0xccc4('0x29')],_0x34ecd1[_0xccc4('0x24')]);_0x1f16a4[_0xccc4('0x2d')]=_[_0xccc4('0x2c')](_0x34ecd1[_0xccc4('0x29')],qs[_0xccc4('0x2e')](_0x255fa5[_0xccc4('0x24')][_0xccc4('0x2e')]));_0x1f16a4['attributes']=_0x1f16a4[_0xccc4('0x2d')]['length']?_0x1f16a4[_0xccc4('0x2d')]:_0x34ecd1[_0xccc4('0x29')];_0x1f16a4['order']=qs['sort'](_0x255fa5[_0xccc4('0x24')][_0xccc4('0x41')]);_0x1f16a4[_0xccc4('0x44')]=qs[_0xccc4('0x2b')](_[_0xccc4('0x42')](_0x255fa5[_0xccc4('0x24')],_0x34ecd1['filters']));if(_0x255fa5['query'][_0xccc4('0x43')]){_0x1f16a4[_0xccc4('0x44')]=_[_0xccc4('0x45')](_0x1f16a4[_0xccc4('0x44')],{'$or':_[_0xccc4('0x46')](_0x1f16a4[_0xccc4('0x2d')],function(_0x253b7e){var _0x771638={};_0x771638[_0x253b7e]={'$like':'%'+_0x255fa5[_0xccc4('0x24')]['filter']+'%'};return _0x771638;})});}_0x1f16a4=_[_0xccc4('0x45')]({},_0x1f16a4,_0x255fa5[_0xccc4('0x30')]);return _0x22342e[_0xccc4('0x50')](_0x1f16a4);}})[_0xccc4('0x16')](function(_0x158fc6){if(_0x158fc6){_0x1b7a29=_0x158fc6[_0xccc4('0x3d')];if(!_0x255fa5[_0xccc4('0x24')][_0xccc4('0x3e')](_0xccc4('0x3f'))){_0x1f16a4[_0xccc4('0x11')]=qs['limit'](_0x255fa5[_0xccc4('0x24')][_0xccc4('0x11')]);_0x1f16a4[_0xccc4('0xf')]=qs[_0xccc4('0xf')](_0x255fa5[_0xccc4('0x24')]['offset']);}return _0x22342e[_0xccc4('0x50')](_0x1f16a4);}})[_0xccc4('0x16')](function(_0x32b375){if(_0x32b375){return _0x32b375?{'count':_0x1b7a29,'rows':_0x32b375}:null;}})['then'](respondWithResult(_0x547ee1,null))[_0xccc4('0x27')](handleError(_0x547ee1,null));};exports[_0xccc4('0x51')]=function(_0x5bc324,_0x2a0192){var _0x33e698=_0x5bc324[_0xccc4('0x32')][_0xccc4('0x52')];return db[_0xccc4('0x4f')][_0xccc4('0x25')]({'where':{'id':_0x33e698},'attributes':['id'],'include':[{'model':db[_0xccc4('0x47')],'as':_0xccc4('0x53'),'attributes':['id',_0xccc4('0x1b'),'online',_0xccc4('0x54'),_0xccc4('0x55')],'raw':!![]}]})[_0xccc4('0x16')](function(_0x4b9214){if(_0x4b9214){var _0x21f424=_['flatMap'](_0x4b9214,function(_0x1e1560){var _0x133f6c=_0x1e1560[_0xccc4('0x17')]({'plain':!![]});return _0x133f6c['Agents'];});return db[_0xccc4('0x1e')][_0xccc4('0x39')]({'where':{'id':_0x5bc324[_0xccc4('0x28')]['id']}})[_0xccc4('0x16')](function(_0x3e3459){return db[_0xccc4('0x56')][_0xccc4('0x57')](function(_0x193a6c){return _0x3e3459[_0xccc4('0x51')](_0x33e698,{'transaction':_0x193a6c})[_0xccc4('0x16')](function(){return BPromise[_0xccc4('0x58')](_0x21f424,function(_0x13626b){return db['UserOpenchannelQueue'][_0xccc4('0x59')]({'where':{'UserId':_0x13626b['id'],'OpenchannelQueueId':_0x5bc324['params']['id']},'transaction':_0x193a6c});});})[_0xccc4('0x16')](function(){_0x21f424[_0xccc4('0x5a')](function(_0xc893cd){socket[_0xccc4('0x5b')](_0xccc4('0x5c'),{'UserId':_0xc893cd['id'],'OpenchannelQueueId':_0x3e3459['id']});});});});});}})[_0xccc4('0x16')](respondWithStatusCode(_0x2a0192,null))['catch'](handleError(_0x2a0192,null));};exports[_0xccc4('0x5d')]=function(_0x466946,_0x43baa0){return db[_0xccc4('0x4f')][_0xccc4('0x25')]({'where':{'id':_0x466946[_0xccc4('0x24')][_0xccc4('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xccc4('0x53'),'attributes':['id'],'raw':!![]}]})[_0xccc4('0x16')](handleEntityNotFound(_0x43baa0,null))[_0xccc4('0x16')](function(_0x13b5fa){var _0x42c4fb=_[_0xccc4('0x46')](_0x13b5fa,'id');var _0x193e91=[];var _0x2957bb=[];var _0x53b4ff=squel[_0xccc4('0x5e')]();_0x53b4ff[_0xccc4('0x5f')](_0xccc4('0x60'))[_0xccc4('0x61')](_0xccc4('0x62'),'tq')[_0xccc4('0x63')](_0xccc4('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xccc4('0x65'),_0x466946[_0xccc4('0x28')]['id']);for(var _0x32d852=0x0;_0x32d852<_0x13b5fa[_0xccc4('0x3d')];_0x32d852+=0x1){let _0x4e6d1d=_0x13b5fa[_0x32d852];for(var _0x28d094=0x0;_0x28d094<_0x4e6d1d['Agents']['length'];_0x28d094+=0x1){let _0x1c09df=_0x4e6d1d[_0xccc4('0x53')][_0x28d094];var _0x442f39=_0x53b4ff['clone']();_0x442f39[_0xccc4('0x44')](_0xccc4('0x66'),_0x1c09df['id']);_0x2957bb[_0xccc4('0x67')](db['sequelize'][_0xccc4('0x24')](_0x442f39['toString'](),{'type':db[_0xccc4('0x56')][_0xccc4('0x68')][_0xccc4('0x69')]})[_0xccc4('0x16')](function(_0x3177f9){if(_0x3177f9[_0xccc4('0x3d')]===0x1){return _0x1c09df['id'];}else{var _0x5b6d08=_['every'](_[_0xccc4('0x46')](_0x3177f9,'TeamId'),function(_0x1f4c6b){return _['includes'](_0x42c4fb,_0x1f4c6b);});if(_0x5b6d08){return _0x1c09df['id'];}}}));}}return BPromise[_0xccc4('0x6a')](_0x2957bb)['then'](function(_0x39ebef){_0x193e91=_(_0x193e91)[_0xccc4('0x6b')](_0x39ebef)[_0xccc4('0x6c')]()['value']();return db[_0xccc4('0x1e')][_0xccc4('0x39')]({'where':{'id':_0x466946[_0xccc4('0x28')]['id']}})[_0xccc4('0x16')](function(_0x5a97e3){return db[_0xccc4('0x56')][_0xccc4('0x57')](function(_0x2d3ab3){return _0x5a97e3[_0xccc4('0x5d')](_0x466946[_0xccc4('0x24')][_0xccc4('0x52')],{'transaction':_0x2d3ab3})[_0xccc4('0x16')](function(){if(!_[_0xccc4('0x6d')](_0x193e91)){return _0x5a97e3[_0xccc4('0x6e')](_0x193e91,{'transaction':_0x2d3ab3});}})[_0xccc4('0x16')](function(){_0x193e91[_0xccc4('0x5a')](function(_0x48d0bc){socket[_0xccc4('0x5b')](_0xccc4('0x6f'),{'UserId':_0x48d0bc,'OpenchannelQueueId':_0x5a97e3['id']});});});});});});})['then'](respondWithStatusCode(_0x43baa0,null))['catch'](handleError(_0x43baa0,null));};exports[_0xccc4('0x70')]=function(_0x22e59e,_0x3314b8){return db[_0xccc4('0x1e')]['find']({'where':{'id':_0x22e59e['params']['id']}})['then'](handleEntityNotFound(_0x3314b8,null))[_0xccc4('0x16')](function(_0x4f5050){if(_0x4f5050){return _0x4f5050[_0xccc4('0x70')](_0x22e59e[_0xccc4('0x32')][_0xccc4('0x52')],_[_0xccc4('0x71')](_0x22e59e['body'],['ids','id'])||{})['spread'](function(_0x1cdf86){for(var _0x1dd0f6=0x0;_0x1dd0f6<_0x22e59e[_0xccc4('0x32')][_0xccc4('0x52')][_0xccc4('0x3d')];_0x1dd0f6+=0x1){socket[_0xccc4('0x5b')](_0xccc4('0x5c'),{'UserId':Number(_0x22e59e[_0xccc4('0x32')]['ids'][_0x1dd0f6]),'OpenchannelQueueId':Number(_0x22e59e['params']['id'])});}return _0x1cdf86;});}})[_0xccc4('0x16')](respondWithResult(_0x3314b8,null))['catch'](handleError(_0x3314b8,null));};exports[_0xccc4('0x6e')]=function(_0x36e6a9,_0xf54c00){return db[_0xccc4('0x1e')]['find']({'where':{'id':_0x36e6a9['params']['id']}})[_0xccc4('0x16')](handleEntityNotFound(_0xf54c00,null))[_0xccc4('0x16')](function(_0x4a102c){if(_0x4a102c){return _0x4a102c[_0xccc4('0x6e')](_0x36e6a9[_0xccc4('0x24')][_0xccc4('0x52')])[_0xccc4('0x16')](function(){if(_['isArray'](_0x36e6a9[_0xccc4('0x24')][_0xccc4('0x52')])){for(var _0x4de3e5=0x0;_0x4de3e5<_0x36e6a9[_0xccc4('0x24')][_0xccc4('0x52')][_0xccc4('0x3d')];_0x4de3e5+=0x1){socket[_0xccc4('0x5b')](_0xccc4('0x6f'),{'UserId':Number(_0x36e6a9[_0xccc4('0x24')][_0xccc4('0x52')][_0x4de3e5]),'OpenchannelQueueId':Number(_0x36e6a9['params']['id'])});}}else{socket[_0xccc4('0x5b')](_0xccc4('0x6f'),{'UserId':Number(_0x36e6a9[_0xccc4('0x24')][_0xccc4('0x52')]),'OpenchannelQueueId':Number(_0x36e6a9[_0xccc4('0x28')]['id'])});}});}})[_0xccc4('0x16')](respondWithStatusCode(_0xf54c00,null))['catch'](handleError(_0xf54c00,null));};exports[_0xccc4('0x72')]=function(_0x988d06,_0x195896){var _0x3b1393={};var _0x45a675={};var _0x10882a;var _0x56f32a;return db[_0xccc4('0x1e')][_0xccc4('0x3c')]({'where':{'id':_0x988d06['params']['id']}})['then'](handleEntityNotFound(_0x195896,null))[_0xccc4('0x16')](function(_0x1ab9a0){if(_0x1ab9a0){_0x10882a=_0x1ab9a0;_0x45a675[_0xccc4('0x29')]=_[_0xccc4('0x2a')](db['User'][_0xccc4('0x1f')]);_0x45a675['query']=_[_0xccc4('0x2a')](_0x988d06[_0xccc4('0x24')]);_0x45a675[_0xccc4('0x2b')]=_['intersection'](_0x45a675[_0xccc4('0x29')],_0x45a675['query']);_0x3b1393['attributes']=_[_0xccc4('0x2c')](_0x45a675[_0xccc4('0x29')],qs[_0xccc4('0x2e')](_0x988d06[_0xccc4('0x24')]['fields']));_0x3b1393[_0xccc4('0x2d')]=_0x3b1393[_0xccc4('0x2d')][_0xccc4('0x3d')]?_0x3b1393[_0xccc4('0x2d')]:_0x45a675[_0xccc4('0x29')];_0x3b1393['order']=qs[_0xccc4('0x41')](_0x988d06['query'][_0xccc4('0x41')]);_0x3b1393[_0xccc4('0x44')]=qs['filters'](_[_0xccc4('0x42')](_0x988d06[_0xccc4('0x24')],_0x45a675[_0xccc4('0x2b')]));if(_0x988d06[_0xccc4('0x24')][_0xccc4('0x43')]){_0x3b1393[_0xccc4('0x44')]=_[_0xccc4('0x45')](_0x3b1393[_0xccc4('0x44')],{'$or':_['map'](_0x3b1393[_0xccc4('0x2d')],function(_0x1e838d){var _0x71906f={};_0x71906f[_0x1e838d]={'$like':'%'+_0x988d06['query']['filter']+'%'};return _0x71906f;})});}_0x3b1393=_['merge']({},_0x3b1393,_0x988d06[_0xccc4('0x30')]);return _0x10882a[_0xccc4('0x72')](_0x3b1393);}})[_0xccc4('0x16')](function(_0x41e2b2){if(_0x41e2b2){_0x56f32a=_0x41e2b2['length'];if(!_0x988d06[_0xccc4('0x24')][_0xccc4('0x3e')](_0xccc4('0x3f'))){_0x3b1393[_0xccc4('0x11')]=qs[_0xccc4('0x11')](_0x988d06[_0xccc4('0x24')][_0xccc4('0x11')]);_0x3b1393[_0xccc4('0xf')]=qs['offset'](_0x988d06['query'][_0xccc4('0xf')]);}return _0x10882a[_0xccc4('0x72')](_0x3b1393);}})['then'](function(_0x1772c2){if(_0x1772c2){return _0x1772c2?{'count':_0x56f32a,'rows':_0x1772c2}:null;}})[_0xccc4('0x16')](respondWithResult(_0x195896,null))[_0xccc4('0x27')](handleError(_0x195896,null));}; \ No newline at end of file +var _0xa692=['sort','pick','options','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','filter','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','order','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','keys','filters','intersection','model','fields','attributes','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','body','params','describe','UserOpenchannelQueue','length','hasOwnProperty','nolimit'];(function(_0x5acc9c,_0x473a9c){var _0x1e9a3a=function(_0x355327){while(--_0x355327){_0x5acc9c['push'](_0x5acc9c['shift']());}};_0x1e9a3a(++_0x473a9c);}(_0xa692,0x130));var _0x2a69=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xa692[_0x221ba2];return _0x47d08e;};'use strict';var BPromise=require('bluebird');var util=require(_0x2a69('0x0'));var _=require(_0x2a69('0x1'));var squel=require(_0x2a69('0x2'));var Redis=require(_0x2a69('0x3'));var qs=require(_0x2a69('0x4'));var logger=require(_0x2a69('0x5'))(_0x2a69('0x6'));var config=require(_0x2a69('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2a69('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a69('0x9'))(new Redis(config[_0x2a69('0x8')]));require(_0x2a69('0xa'))[_0x2a69('0xb')](socket);function respondWithStatusCode(_0x522486,_0x5b601c){_0x5b601c=_0x5b601c||0xcc;return function(_0x5333ee){if(_0x5333ee){return _0x522486[_0x2a69('0xc')](_0x5b601c);}return _0x522486[_0x2a69('0xd')](_0x5b601c)[_0x2a69('0xe')]();};}function respondWithResult(_0x1144d4,_0x4dfa48){_0x4dfa48=_0x4dfa48||0xc8;return function(_0xeed3bf){if(_0xeed3bf){return _0x1144d4[_0x2a69('0xd')](_0x4dfa48)[_0x2a69('0xf')](_0xeed3bf);}};}function respondWithFilteredResult(_0x50dd5a,_0x228265){return function(_0x4e1715){if(_0x4e1715){var _0xf3bb3c=typeof _0x228265['offset']===_0x2a69('0x10')&&typeof _0x228265[_0x2a69('0x11')]==='undefined';var _0x262c38=_0x4e1715[_0x2a69('0x12')];var _0x1ce131=_0xf3bb3c?0x0:_0x228265[_0x2a69('0x13')];var _0x43161c=_0xf3bb3c?_0x4e1715[_0x2a69('0x12')]:_0x228265[_0x2a69('0x13')]+_0x228265['limit'];var _0x23addb;if(_0x43161c>=_0x262c38){_0x43161c=_0x262c38;_0x23addb=0xc8;}else{_0x23addb=0xce;}_0x50dd5a[_0x2a69('0xd')](_0x23addb);return _0x50dd5a[_0x2a69('0x14')](_0x2a69('0x15'),_0x1ce131+'-'+_0x43161c+'/'+_0x262c38)[_0x2a69('0xf')](_0x4e1715);}return null;};}function saveUpdates(_0x18ca50){return function(_0x2fc52b){if(_0x2fc52b){return _0x2fc52b[_0x2a69('0x16')](_0x18ca50)[_0x2a69('0x17')](function(_0x88e42){return _0x88e42;});}return null;};}function removeEntity(_0x2a4892){return function(_0x1249db){if(_0x1249db){return _0x1249db[_0x2a69('0x18')]()[_0x2a69('0x17')](function(){var _0x5e12dd=_0x1249db[_0x2a69('0x19')]({'plain':!![]});var _0x564b73=_0x2a69('0x1a');return db[_0x2a69('0x1b')]['destroy']({'where':{'type':_0x564b73,'resourceId':_0x5e12dd['id']}})[_0x2a69('0x17')](function(){return _0x1249db;});})[_0x2a69('0x17')](function(){_0x2a4892[_0x2a69('0xd')](0xcc)[_0x2a69('0xe')]();});}};}function handleEntityNotFound(_0x1d613a){return function(_0x46259f){if(!_0x46259f){_0x1d613a[_0x2a69('0xc')](0x194);}return _0x46259f;};}function handleError(_0x46131a,_0x559267){_0x559267=_0x559267||0x1f4;return function(_0x2c854e){logger[_0x2a69('0x1c')](_0x2c854e[_0x2a69('0x1d')]);if(_0x2c854e[_0x2a69('0x1e')]){delete _0x2c854e['name'];}_0x46131a[_0x2a69('0xd')](_0x559267)['send'](_0x2c854e);};}exports[_0x2a69('0x1f')]=function(_0x18861d,_0x629960){var _0x139625={};var _0x2d1b72={'count':0x0,'rows':[]};var _0x271169=_[_0x2a69('0x20')](db[_0x2a69('0x21')][_0x2a69('0x22')],function(_0x4bff3e){return{'name':_0x4bff3e[_0x2a69('0x23')],'type':_0x4bff3e['type'][_0x2a69('0x24')]};});_0x139625=qs[_0x2a69('0x25')](_0x271169,_0x18861d);var _0x29546e={'where':_0x139625[_0x2a69('0x26')]};return db[_0x2a69('0x21')][_0x2a69('0x12')](_0x29546e)['then'](function(_0x2340bb){_0x2d1b72[_0x2a69('0x12')]=_0x2340bb;_0x139625['include']=qs[_0x2a69('0x27')](_0x18861d[_0x2a69('0x28')]);return db[_0x2a69('0x21')][_0x2a69('0x29')](_0x139625);})[_0x2a69('0x17')](function(_0x3e32b6){_0x2d1b72['rows']=_0x3e32b6;return _0x2d1b72;})[_0x2a69('0x17')](respondWithFilteredResult(_0x629960,_0x139625))[_0x2a69('0x2a')](handleError(_0x629960,null));};exports[_0x2a69('0x2b')]=function(_0x3dd2ba,_0x21c69d){var _0x4dc167={'raw':!![],'where':{'id':_0x3dd2ba['params']['id']}},_0x2ba457={};_0x2ba457['model']=_[_0x2a69('0x2c')](db['OpenchannelQueue'][_0x2a69('0x22')]);_0x2ba457[_0x2a69('0x28')]=_[_0x2a69('0x2c')](_0x3dd2ba['query']);_0x2ba457[_0x2a69('0x2d')]=_[_0x2a69('0x2e')](_0x2ba457['model'],_0x2ba457['query']);_0x4dc167['attributes']=_[_0x2a69('0x2e')](_0x2ba457[_0x2a69('0x2f')],qs[_0x2a69('0x30')](_0x3dd2ba[_0x2a69('0x28')][_0x2a69('0x30')]));_0x4dc167[_0x2a69('0x31')]=_0x4dc167['attributes']['length']?_0x4dc167[_0x2a69('0x31')]:_0x2ba457[_0x2a69('0x2f')];if(_0x3dd2ba[_0x2a69('0x28')][_0x2a69('0x32')]){_0x4dc167[_0x2a69('0x27')]=[{'all':!![]}];}_0x4dc167=_[_0x2a69('0x33')]({},_0x4dc167,_0x3dd2ba['options']);return db[_0x2a69('0x21')]['find'](_0x4dc167)[_0x2a69('0x17')](handleEntityNotFound(_0x21c69d,null))['then'](respondWithResult(_0x21c69d,null))[_0x2a69('0x2a')](handleError(_0x21c69d,null));};exports[_0x2a69('0x34')]=function(_0x53b028,_0xe1c1d8){return db[_0x2a69('0x21')][_0x2a69('0x34')](_0x53b028['body'],{})[_0x2a69('0x17')](function(_0x4f1eb9){var _0x17ba14=_0x53b028[_0x2a69('0x35')][_0x2a69('0x19')]({'plain':!![]});if(!_0x17ba14)throw new Error(_0x2a69('0x36'));if(_0x17ba14['role']===_0x2a69('0x35')){var _0x2ae8eb=_0x4f1eb9[_0x2a69('0x19')]({'plain':!![]});var _0x323268=_0x2a69('0x1a');return db['UserProfileSection'][_0x2a69('0x37')]({'where':{'name':_0x323268,'userProfileId':_0x17ba14[_0x2a69('0x38')]},'raw':!![]})[_0x2a69('0x17')](function(_0x390d9e){if(_0x390d9e&&_0x390d9e[_0x2a69('0x39')]===0x0){return db[_0x2a69('0x1b')][_0x2a69('0x34')]({'name':_0x2ae8eb[_0x2a69('0x1e')],'resourceId':_0x2ae8eb['id'],'type':_0x390d9e['name'],'sectionId':_0x390d9e['id']},{})[_0x2a69('0x17')](function(){return _0x4f1eb9;});}else{return _0x4f1eb9;}})[_0x2a69('0x2a')](function(_0x6b5df){logger[_0x2a69('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6b5df);throw _0x6b5df;});}return _0x4f1eb9;})[_0x2a69('0x17')](respondWithResult(_0xe1c1d8,0xc9))[_0x2a69('0x2a')](handleError(_0xe1c1d8,null));};exports[_0x2a69('0x16')]=function(_0xe482fd,_0x57628a){if(_0xe482fd[_0x2a69('0x3a')]['id']){delete _0xe482fd[_0x2a69('0x3a')]['id'];}return db[_0x2a69('0x21')]['find']({'where':{'id':_0xe482fd['params']['id']}})['then'](handleEntityNotFound(_0x57628a,null))['then'](saveUpdates(_0xe482fd[_0x2a69('0x3a')],null))[_0x2a69('0x17')](respondWithResult(_0x57628a,null))[_0x2a69('0x2a')](handleError(_0x57628a,null));};exports[_0x2a69('0x18')]=function(_0x5d24a4,_0x1c2739){return db[_0x2a69('0x21')][_0x2a69('0x37')]({'where':{'id':_0x5d24a4[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x1c2739,null))['then'](removeEntity(_0x1c2739,null))[_0x2a69('0x2a')](handleError(_0x1c2739,null));};exports[_0x2a69('0x3c')]=function(_0x1309eb,_0x3dd778){return db[_0x2a69('0x21')][_0x2a69('0x3c')]()[_0x2a69('0x17')](respondWithResult(_0x3dd778,null))[_0x2a69('0x2a')](handleError(_0x3dd778,null));};exports['getMembers']=function(_0x1fc92f,_0x49259d){var _0x480a50={'raw':!![],'where':{}},_0x4e53e6={},_0x5ea28e;return db[_0x2a69('0x21')]['findOne']({'where':{'id':_0x1fc92f[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x49259d,null))[_0x2a69('0x17')](function(_0x2184c4){if(_0x2184c4){_0x5ea28e=_0x2184c4[_0x2a69('0x19')]({'plain':!![]});_0x4e53e6[_0x2a69('0x2f')]=_[_0x2a69('0x2c')](db[_0x2a69('0x3d')][_0x2a69('0x22')]);_0x4e53e6['query']=_[_0x2a69('0x2c')](_0x1fc92f[_0x2a69('0x28')]);_0x4e53e6[_0x2a69('0x2d')]=_['intersection'](_0x4e53e6[_0x2a69('0x2f')],_0x4e53e6[_0x2a69('0x28')]);_0x480a50[_0x2a69('0x31')]=_[_0x2a69('0x2e')](_0x4e53e6[_0x2a69('0x2f')],qs[_0x2a69('0x30')](_0x1fc92f['query'][_0x2a69('0x30')]));_0x480a50[_0x2a69('0x31')]=_0x480a50[_0x2a69('0x31')][_0x2a69('0x3e')]?_0x480a50[_0x2a69('0x31')]:_0x4e53e6[_0x2a69('0x2f')];if(!_0x1fc92f[_0x2a69('0x28')][_0x2a69('0x3f')](_0x2a69('0x40'))){_0x480a50[_0x2a69('0x11')]=qs[_0x2a69('0x11')](_0x1fc92f[_0x2a69('0x28')][_0x2a69('0x11')]);_0x480a50[_0x2a69('0x13')]=qs['offset'](_0x1fc92f[_0x2a69('0x28')]['offset']);}_0x480a50['order']=qs[_0x2a69('0x41')](_0x1fc92f['query'][_0x2a69('0x41')]);_0x480a50[_0x2a69('0x26')]=qs[_0x2a69('0x2d')](_[_0x2a69('0x42')](_0x1fc92f[_0x2a69('0x28')],_0x4e53e6[_0x2a69('0x2d')]));_0x480a50[_0x2a69('0x26')]['OpenchannelQueueId']=_0x2184c4['id'];if(_0x1fc92f[_0x2a69('0x28')]['filter']){_0x480a50[_0x2a69('0x26')]=_[_0x2a69('0x33')](_0x480a50[_0x2a69('0x26')],{'$or':_[_0x2a69('0x20')](_0x480a50[_0x2a69('0x31')],function(_0x1bc9a7){var _0x881237={};_0x881237[_0x1bc9a7]={'$like':'%'+_0x1fc92f[_0x2a69('0x28')]['filter']+'%'};return _0x881237;})});}_0x480a50=_[_0x2a69('0x33')]({},_0x480a50,_0x1fc92f[_0x2a69('0x43')]);return db[_0x2a69('0x3d')][_0x2a69('0x29')](_0x480a50);}})['then'](function(_0x20d93b){if(_0x20d93b){return db[_0x2a69('0x44')][_0x2a69('0x45')]({'where':{'id':_[_0x2a69('0x20')](_0x20d93b,_0x2a69('0x46')),'role':_0x2a69('0x47')},'attributes':['id',_0x2a69('0x1e'),_0x2a69('0x48'),_0x2a69('0x49'),'createdAt']});}})[_0x2a69('0x17')](function(_0x7ded87){if(_0x7ded87){return{'count':_0x7ded87[_0x2a69('0x12')],'rows':_[_0x2a69('0x20')](_0x7ded87[_0x2a69('0x4a')],function(_0x38f894){return{'membername':_0x38f894['name'],'UserId':_0x38f894['id'],'queue_name':_0x5ea28e[_0x2a69('0x1e')],'OpenchannelQueueId':_0x5ea28e['id'],'interface':util[_0x2a69('0x4b')](_0x2a69('0x4c'),_0x2a69('0x4d'),_0x38f894['name']),'penalty':0x0,'paused':_0x38f894[_0x2a69('0x48')],'createdAt':_0x38f894['createdAt'],'updatedAt':_0x38f894[_0x2a69('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2a69('0x17')](respondWithFilteredResult(_0x49259d,_0x480a50))[_0x2a69('0x2a')](handleError(_0x49259d,null));};exports[_0x2a69('0x4e')]=function(_0x5003e5,_0x2dc945){var _0x299ef1={};var _0x171715={};var _0x1e170d;var _0x58f3bb;return db['OpenchannelQueue'][_0x2a69('0x4f')]({'where':{'id':_0x5003e5['params']['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x2dc945,null))[_0x2a69('0x17')](function(_0x363692){if(_0x363692){_0x1e170d=_0x363692;_0x171715[_0x2a69('0x2f')]=_[_0x2a69('0x2c')](db[_0x2a69('0x50')]['rawAttributes']);_0x171715['query']=_[_0x2a69('0x2c')](_0x5003e5[_0x2a69('0x28')]);_0x171715[_0x2a69('0x2d')]=_['intersection'](_0x171715['model'],_0x171715['query']);_0x299ef1[_0x2a69('0x31')]=_[_0x2a69('0x2e')](_0x171715[_0x2a69('0x2f')],qs[_0x2a69('0x30')](_0x5003e5['query'][_0x2a69('0x30')]));_0x299ef1['attributes']=_0x299ef1[_0x2a69('0x31')][_0x2a69('0x3e')]?_0x299ef1[_0x2a69('0x31')]:_0x171715[_0x2a69('0x2f')];_0x299ef1['order']=qs[_0x2a69('0x41')](_0x5003e5['query'][_0x2a69('0x41')]);_0x299ef1[_0x2a69('0x26')]=qs['filters'](_[_0x2a69('0x42')](_0x5003e5[_0x2a69('0x28')],_0x171715[_0x2a69('0x2d')]));if(_0x5003e5[_0x2a69('0x28')]['filter']){_0x299ef1[_0x2a69('0x26')]=_[_0x2a69('0x33')](_0x299ef1['where'],{'$or':_[_0x2a69('0x20')](_0x299ef1[_0x2a69('0x31')],function(_0x47a659){var _0x1451ef={};_0x1451ef[_0x47a659]={'$like':'%'+_0x5003e5[_0x2a69('0x28')][_0x2a69('0x51')]+'%'};return _0x1451ef;})});}_0x299ef1=_[_0x2a69('0x33')]({},_0x299ef1,_0x5003e5['options']);return _0x1e170d[_0x2a69('0x4e')](_0x299ef1);}})[_0x2a69('0x17')](function(_0x3cdfb8){if(_0x3cdfb8){_0x58f3bb=_0x3cdfb8['length'];if(!_0x5003e5[_0x2a69('0x28')]['hasOwnProperty']('nolimit')){_0x299ef1[_0x2a69('0x11')]=qs['limit'](_0x5003e5['query']['limit']);_0x299ef1['offset']=qs['offset'](_0x5003e5[_0x2a69('0x28')]['offset']);}return _0x1e170d[_0x2a69('0x4e')](_0x299ef1);}})[_0x2a69('0x17')](function(_0x9e3da0){if(_0x9e3da0){return _0x9e3da0?{'count':_0x58f3bb,'rows':_0x9e3da0}:null;}})[_0x2a69('0x17')](respondWithResult(_0x2dc945,null))['catch'](handleError(_0x2dc945,null));};exports[_0x2a69('0x52')]=function(_0x4d0475,_0x2cdd47){var _0x34f6ef=_0x4d0475[_0x2a69('0x3a')]['ids'];return db[_0x2a69('0x50')][_0x2a69('0x29')]({'where':{'id':_0x34f6ef},'attributes':['id'],'include':[{'model':db[_0x2a69('0x44')],'as':_0x2a69('0x53'),'attributes':['id','name',_0x2a69('0x54'),_0x2a69('0x55'),'interface'],'raw':!![]}]})[_0x2a69('0x17')](function(_0x219f07){if(_0x219f07){var _0x3d47f0=_[_0x2a69('0x56')](_0x219f07,function(_0x1797fb){var _0x55841e=_0x1797fb[_0x2a69('0x19')]({'plain':!![]});return _0x55841e[_0x2a69('0x53')];});return db[_0x2a69('0x21')][_0x2a69('0x37')]({'where':{'id':_0x4d0475[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](function(_0x3cb2d6){return db[_0x2a69('0x57')][_0x2a69('0x58')](function(_0x37a1e1){return _0x3cb2d6[_0x2a69('0x52')](_0x34f6ef,{'transaction':_0x37a1e1})[_0x2a69('0x17')](function(){return BPromise[_0x2a69('0x59')](_0x3d47f0,function(_0xb3238b){return db[_0x2a69('0x3d')][_0x2a69('0x5a')]({'where':{'UserId':_0xb3238b['id'],'OpenchannelQueueId':_0x4d0475[_0x2a69('0x3b')]['id']},'transaction':_0x37a1e1});});})[_0x2a69('0x17')](function(){_0x3d47f0[_0x2a69('0x5b')](function(_0x40a05b){socket[_0x2a69('0x5c')](_0x2a69('0x5d'),{'UserId':_0x40a05b['id'],'OpenchannelQueueId':_0x3cb2d6['id']});});});});});}})[_0x2a69('0x17')](respondWithStatusCode(_0x2cdd47,null))['catch'](handleError(_0x2cdd47,null));};exports[_0x2a69('0x5e')]=function(_0x2edf41,_0xb3768){return db[_0x2a69('0x50')]['findAll']({'where':{'id':_0x2edf41[_0x2a69('0x28')][_0x2a69('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a69('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xb3768,null))[_0x2a69('0x17')](function(_0x139417){var _0x15d8e1=_[_0x2a69('0x20')](_0x139417,'id');var _0x283edb=[];var _0x42dea0=[];var _0x4f7d28=squel[_0x2a69('0x60')]();_0x4f7d28['field']('tq.TeamId')[_0x2a69('0x61')](_0x2a69('0x62'),'tq')[_0x2a69('0x63')](_0x2a69('0x64'),'ut',_0x2a69('0x65'))['where'](_0x2a69('0x66'),_0x2edf41['params']['id']);for(var _0x3d3d9e=0x0;_0x3d3d9e<_0x139417[_0x2a69('0x3e')];_0x3d3d9e+=0x1){let _0x221d6f=_0x139417[_0x3d3d9e];for(var _0xfb3989=0x0;_0xfb3989<_0x221d6f[_0x2a69('0x53')][_0x2a69('0x3e')];_0xfb3989+=0x1){let _0x4e7b38=_0x221d6f[_0x2a69('0x53')][_0xfb3989];var _0x496164=_0x4f7d28[_0x2a69('0x67')]();_0x496164[_0x2a69('0x26')](_0x2a69('0x68'),_0x4e7b38['id']);_0x42dea0[_0x2a69('0x69')](db['sequelize'][_0x2a69('0x28')](_0x496164['toString'](),{'type':db[_0x2a69('0x57')][_0x2a69('0x6a')][_0x2a69('0x6b')]})[_0x2a69('0x17')](function(_0x16b367){if(_0x16b367[_0x2a69('0x3e')]===0x1){return _0x4e7b38['id'];}else{var _0x1c4231=_[_0x2a69('0x6c')](_['map'](_0x16b367,_0x2a69('0x6d')),function(_0x3c75d0){return _[_0x2a69('0x6e')](_0x15d8e1,_0x3c75d0);});if(_0x1c4231){return _0x4e7b38['id'];}}}));}}return BPromise[_0x2a69('0x6f')](_0x42dea0)[_0x2a69('0x17')](function(_0x3a16d2){_0x283edb=_(_0x283edb)[_0x2a69('0x70')](_0x3a16d2)[_0x2a69('0x71')]()[_0x2a69('0x72')]();return db[_0x2a69('0x21')]['find']({'where':{'id':_0x2edf41[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](function(_0x152108){return db['sequelize'][_0x2a69('0x58')](function(_0x4caa48){return _0x152108[_0x2a69('0x5e')](_0x2edf41[_0x2a69('0x28')][_0x2a69('0x5f')],{'transaction':_0x4caa48})[_0x2a69('0x17')](function(){if(!_[_0x2a69('0x73')](_0x283edb)){return _0x152108[_0x2a69('0x74')](_0x283edb,{'transaction':_0x4caa48});}})[_0x2a69('0x17')](function(){_0x283edb[_0x2a69('0x5b')](function(_0xc77a03){socket[_0x2a69('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0xc77a03,'OpenchannelQueueId':_0x152108['id']});});});});});});})['then'](respondWithStatusCode(_0xb3768,null))[_0x2a69('0x2a')](handleError(_0xb3768,null));};exports[_0x2a69('0x75')]=function(_0x42f97b,_0x1d7154){return db[_0x2a69('0x21')][_0x2a69('0x37')]({'where':{'id':_0x42f97b[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x1d7154,null))[_0x2a69('0x17')](function(_0x424e47){if(_0x424e47){return _0x424e47['addAgents'](_0x42f97b[_0x2a69('0x3a')]['ids'],_[_0x2a69('0x76')](_0x42f97b[_0x2a69('0x3a')],[_0x2a69('0x5f'),'id'])||{})['spread'](function(_0x15834b){for(var _0x3843f2=0x0;_0x3843f2<_0x42f97b[_0x2a69('0x3a')][_0x2a69('0x5f')][_0x2a69('0x3e')];_0x3843f2+=0x1){socket[_0x2a69('0x5c')](_0x2a69('0x5d'),{'UserId':Number(_0x42f97b['body']['ids'][_0x3843f2]),'OpenchannelQueueId':Number(_0x42f97b[_0x2a69('0x3b')]['id'])});}return _0x15834b;});}})[_0x2a69('0x17')](respondWithResult(_0x1d7154,null))[_0x2a69('0x2a')](handleError(_0x1d7154,null));};exports[_0x2a69('0x74')]=function(_0x4dd6a9,_0x53d510){return db[_0x2a69('0x21')][_0x2a69('0x37')]({'where':{'id':_0x4dd6a9['params']['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x53d510,null))[_0x2a69('0x17')](function(_0x2567de){if(_0x2567de){return _0x2567de[_0x2a69('0x74')](_0x4dd6a9[_0x2a69('0x28')]['ids'])[_0x2a69('0x17')](function(){if(_[_0x2a69('0x77')](_0x4dd6a9[_0x2a69('0x28')]['ids'])){for(var _0x1010ae=0x0;_0x1010ae<_0x4dd6a9[_0x2a69('0x28')][_0x2a69('0x5f')][_0x2a69('0x3e')];_0x1010ae+=0x1){socket[_0x2a69('0x5c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4dd6a9[_0x2a69('0x28')]['ids'][_0x1010ae]),'OpenchannelQueueId':Number(_0x4dd6a9['params']['id'])});}}else{socket['emit'](_0x2a69('0x78'),{'UserId':Number(_0x4dd6a9['query'][_0x2a69('0x5f')]),'OpenchannelQueueId':Number(_0x4dd6a9['params']['id'])});}});}})[_0x2a69('0x17')](respondWithStatusCode(_0x53d510,null))[_0x2a69('0x2a')](handleError(_0x53d510,null));};exports['getAgents']=function(_0x592399,_0x5e40e8){var _0x11a904={};var _0x4cfc9c={};var _0x4dda4e;var _0xd27cf6;return db['OpenchannelQueue'][_0x2a69('0x4f')]({'where':{'id':_0x592399[_0x2a69('0x3b')]['id']}})[_0x2a69('0x17')](handleEntityNotFound(_0x5e40e8,null))[_0x2a69('0x17')](function(_0x5bddd5){if(_0x5bddd5){_0x4dda4e=_0x5bddd5;_0x4cfc9c[_0x2a69('0x2f')]=_[_0x2a69('0x2c')](db[_0x2a69('0x44')]['rawAttributes']);_0x4cfc9c['query']=_[_0x2a69('0x2c')](_0x592399[_0x2a69('0x28')]);_0x4cfc9c[_0x2a69('0x2d')]=_['intersection'](_0x4cfc9c[_0x2a69('0x2f')],_0x4cfc9c[_0x2a69('0x28')]);_0x11a904[_0x2a69('0x31')]=_[_0x2a69('0x2e')](_0x4cfc9c[_0x2a69('0x2f')],qs['fields'](_0x592399[_0x2a69('0x28')][_0x2a69('0x30')]));_0x11a904[_0x2a69('0x31')]=_0x11a904[_0x2a69('0x31')][_0x2a69('0x3e')]?_0x11a904['attributes']:_0x4cfc9c[_0x2a69('0x2f')];_0x11a904[_0x2a69('0x79')]=qs[_0x2a69('0x41')](_0x592399['query']['sort']);_0x11a904['where']=qs[_0x2a69('0x2d')](_[_0x2a69('0x42')](_0x592399[_0x2a69('0x28')],_0x4cfc9c[_0x2a69('0x2d')]));if(_0x592399['query'][_0x2a69('0x51')]){_0x11a904[_0x2a69('0x26')]=_[_0x2a69('0x33')](_0x11a904['where'],{'$or':_[_0x2a69('0x20')](_0x11a904['attributes'],function(_0x31bf8e){var _0x3013ac={};_0x3013ac[_0x31bf8e]={'$like':'%'+_0x592399[_0x2a69('0x28')][_0x2a69('0x51')]+'%'};return _0x3013ac;})});}_0x11a904=_[_0x2a69('0x33')]({},_0x11a904,_0x592399[_0x2a69('0x43')]);return _0x4dda4e[_0x2a69('0x7a')](_0x11a904);}})['then'](function(_0x14c214){if(_0x14c214){_0xd27cf6=_0x14c214[_0x2a69('0x3e')];if(!_0x592399['query'][_0x2a69('0x3f')]('nolimit')){_0x11a904[_0x2a69('0x11')]=qs[_0x2a69('0x11')](_0x592399['query']['limit']);_0x11a904[_0x2a69('0x13')]=qs[_0x2a69('0x13')](_0x592399['query'][_0x2a69('0x13')]);}return _0x4dda4e[_0x2a69('0x7a')](_0x11a904);}})['then'](function(_0x49c021){if(_0x49c021){return _0x49c021?{'count':_0xd27cf6,'rows':_0x49c021}:null;}})['then'](respondWithResult(_0x5e40e8,null))[_0x2a69('0x2a')](handleError(_0x5e40e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 174702b..aec4807 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 _0xee02=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0xee02,0x14a));var _0x2ee0=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xee02[_0x31a938];return _0x1bf341;};'use strict';var EventEmitter=require(_0x2ee0('0x0'));var OpenchannelQueue=require(_0x2ee0('0x1'))['db'][_0x2ee0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2ee0('0x3')](0x0);var events={'afterCreate':_0x2ee0('0x4'),'afterUpdate':_0x2ee0('0x5'),'afterDestroy':_0x2ee0('0x6')};function emitEvent(_0xd991ba){return function(_0x373537,_0xb266be,_0x3573a2){OpenchannelQueueEvents[_0x2ee0('0x7')](_0xd991ba+':'+_0x373537['id'],_0x373537);OpenchannelQueueEvents[_0x2ee0('0x7')](_0xd991ba,_0x373537);_0x3573a2(null);};}for(var e in events){if(events[_0x2ee0('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2ee0('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xecc4=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xecc4,0x181));var _0x4ecc=function(_0x5c151d,_0x5c603b){_0x5c151d=_0x5c151d-0x0;var _0x53e0fc=_0xecc4[_0x5c151d];return _0x53e0fc;};'use strict';var EventEmitter=require(_0x4ecc('0x0'));var OpenchannelQueue=require(_0x4ecc('0x1'))['db'][_0x4ecc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4ecc('0x3')](0x0);var events={'afterCreate':_0x4ecc('0x4'),'afterUpdate':_0x4ecc('0x5'),'afterDestroy':_0x4ecc('0x6')};function emitEvent(_0x522c52){return function(_0x45c2e9,_0x19dfd9,_0x23548c){OpenchannelQueueEvents[_0x4ecc('0x7')](_0x522c52+':'+_0x45c2e9['id'],_0x45c2e9);OpenchannelQueueEvents[_0x4ecc('0x7')](_0x522c52,_0x45c2e9);_0x23548c(null);};}for(var e in events){if(events[_0x4ecc('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x4ecc('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 4696250..8a040ca 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 _0x7aa5=['bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x36fdc9,_0x4c5630){var _0x4c6209=function(_0xbfdccf){while(--_0xbfdccf){_0x36fdc9['push'](_0x36fdc9['shift']());}};_0x4c6209(++_0x4c5630);}(_0x7aa5,0x70));var _0x57aa=function(_0xa58031,_0x2276a3){_0xa58031=_0xa58031-0x0;var _0x48ced=_0x7aa5[_0xa58031];return _0x48ced;};'use strict';var _=require(_0x57aa('0x0'));var util=require(_0x57aa('0x1'));var logger=require(_0x57aa('0x2'))(_0x57aa('0x3'));var moment=require(_0x57aa('0x4'));var BPromise=require(_0x57aa('0x5'));var rp=require(_0x57aa('0x6'));var fs=require('fs');var path=require(_0x57aa('0x7'));var rimraf=require('rimraf');var config=require(_0x57aa('0x8'));var attributes=require(_0x57aa('0x9'));module['exports']=function(_0x77b73a,_0x2d1f04){return _0x77b73a[_0x57aa('0xa')](_0x57aa('0xb'),attributes,{'tableName':_0x57aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4958=['api','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util'];(function(_0x389691,_0x240dc9){var _0x4c84c5=function(_0x58a43a){while(--_0x58a43a){_0x389691['push'](_0x389691['shift']());}};_0x4c84c5(++_0x240dc9);}(_0x4958,0x1ca));var _0x8495=function(_0x315838,_0x538bea){_0x315838=_0x315838-0x0;var _0x8e969e=_0x4958[_0x315838];return _0x8e969e;};'use strict';var _=require(_0x8495('0x0'));var util=require(_0x8495('0x1'));var logger=require('../../config/logger')(_0x8495('0x2'));var moment=require('moment');var BPromise=require(_0x8495('0x3'));var rp=require(_0x8495('0x4'));var fs=require('fs');var path=require(_0x8495('0x5'));var rimraf=require(_0x8495('0x6'));var config=require('../../config/environment');var attributes=require(_0x8495('0x7'));module['exports']=function(_0x8e2ebb,_0x585b45){return _0x8e2ebb[_0x8495('0x8')](_0x8495('0x9'),attributes,{'tableName':'openchannel_queues','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 ef40eae..5a30775 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 _0x397a=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelQueue','options','where','attributes','limit','include','model','map','then','GetOpenchannelQueue','ShowOpenchannelQueue','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x397a,0x19e));var _0xa397=function(_0x1bc929,_0xc9a46a){_0x1bc929=_0x1bc929-0x0;var _0x2cec33=_0x397a[_0x1bc929];return _0x2cec33;};'use strict';var _=require('lodash');var util=require(_0xa397('0x0'));var moment=require(_0xa397('0x1'));var BPromise=require(_0xa397('0x2'));var rs=require(_0xa397('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa397('0x4'))['db'];var utils=require(_0xa397('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa397('0x6'));var jayson=require(_0xa397('0x7'));var client=jayson[_0xa397('0x8')]['http']({'port':0x232a});config[_0xa397('0x9')]=_[_0xa397('0xa')](config['redis'],{'host':_0xa397('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa397('0xc'))[_0xa397('0xd')](socket);function respondWithRpcPromise(_0x48f6c2,_0x2b9b0d,_0x4b174f){return new BPromise(function(_0x4500d3,_0x8908c5){return client['request'](_0x48f6c2,_0x4b174f)['then'](function(_0x4642a0){logger[_0xa397('0xe')](_0xa397('0xf'),_0x2b9b0d,_0xa397('0x10'));logger[_0xa397('0x11')](_0xa397('0x12'),_0x2b9b0d,_0xa397('0x10'),JSON[_0xa397('0x13')](_0x4642a0));if(_0x4642a0['error']){if(_0x4642a0[_0xa397('0x14')][_0xa397('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2b9b0d,_0x4642a0[_0xa397('0x14')][_0xa397('0x16')]);return _0x8908c5(_0x4642a0['error'][_0xa397('0x16')]);}logger['error'](_0xa397('0xf'),_0x2b9b0d,_0x4642a0['error'][_0xa397('0x16')]);return _0x4500d3(_0x4642a0[_0xa397('0x14')][_0xa397('0x16')]);}else{logger[_0xa397('0xe')](_0xa397('0xf'),_0x2b9b0d,_0xa397('0x10'));_0x4500d3(_0x4642a0['result'][_0xa397('0x16')]);}})[_0xa397('0x17')](function(_0x5c4e7a){logger['error'](_0xa397('0xf'),_0x2b9b0d,_0x5c4e7a);_0x8908c5(_0x5c4e7a);});});}exports['GetOpenchannelQueue']=function(_0x2632af){var _0x2499e4=this;return new Promise(function(_0x431b7c,_0x136a16){return db[_0xa397('0x18')]['findAll']({'raw':_0x2632af[_0xa397('0x19')]?_0x2632af['options']['raw']===undefined?!![]:![]:!![],'where':_0x2632af[_0xa397('0x19')]?_0x2632af[_0xa397('0x19')][_0xa397('0x1a')]||null:null,'attributes':_0x2632af[_0xa397('0x19')]?_0x2632af['options'][_0xa397('0x1b')]||null:null,'limit':_0x2632af['options']?_0x2632af['options'][_0xa397('0x1c')]||null:null,'include':_0x2632af[_0xa397('0x19')]?_0x2632af['options'][_0xa397('0x1d')]?_['map'](_0x2632af[_0xa397('0x19')][_0xa397('0x1d')],function(_0x2d90d4){return{'model':db[_0x2d90d4[_0xa397('0x1e')]],'as':_0x2d90d4['as'],'attributes':_0x2d90d4['attributes'],'include':_0x2d90d4[_0xa397('0x1d')]?_[_0xa397('0x1f')](_0x2d90d4['include'],function(_0x3f8c8f){return{'model':db[_0x3f8c8f[_0xa397('0x1e')]],'as':_0x3f8c8f['as'],'attributes':_0x3f8c8f[_0xa397('0x1b')],'include':_0x3f8c8f[_0xa397('0x1d')]?_['map'](_0x3f8c8f[_0xa397('0x1d')],function(_0x4c55a8){return{'model':db[_0x4c55a8[_0xa397('0x1e')]],'as':_0x4c55a8['as'],'attributes':_0x4c55a8['attributes']};}):[]};}):[]};}):[]:[]})[_0xa397('0x20')](function(_0x3a2951){logger[_0xa397('0xe')](_0xa397('0x21'),_0x2632af);logger['debug'](_0xa397('0x21'),_0x2632af,JSON['stringify'](_0x3a2951));_0x431b7c(_0x3a2951);})[_0xa397('0x17')](function(_0x30542c){logger[_0xa397('0x14')](_0xa397('0x21'),_0x30542c['message'],_0x2632af);_0x136a16(_0x2499e4['error'](0x1f4,_0x30542c[_0xa397('0x16')]));});});};exports[_0xa397('0x22')]=function(_0x31e701){var _0x56d38e=this;return new Promise(function(_0x1861eb,_0x39dcec){return db[_0xa397('0x18')]['find']({'raw':_0x31e701[_0xa397('0x19')]?_0x31e701[_0xa397('0x19')][_0xa397('0x23')]===undefined?!![]:![]:!![],'where':_0x31e701['options']?_0x31e701[_0xa397('0x19')]['where']||null:null,'attributes':_0x31e701[_0xa397('0x19')]?_0x31e701[_0xa397('0x19')][_0xa397('0x1b')]||null:null,'include':_0x31e701[_0xa397('0x19')]?_0x31e701[_0xa397('0x19')]['include']?_[_0xa397('0x1f')](_0x31e701[_0xa397('0x19')][_0xa397('0x1d')],function(_0x5bbe40){return{'model':db[_0x5bbe40[_0xa397('0x1e')]],'as':_0x5bbe40['as'],'attributes':_0x5bbe40[_0xa397('0x1b')],'include':_0x5bbe40['include']?_[_0xa397('0x1f')](_0x5bbe40[_0xa397('0x1d')],function(_0x5ef50c){return{'model':db[_0x5ef50c[_0xa397('0x1e')]],'as':_0x5ef50c['as'],'attributes':_0x5ef50c[_0xa397('0x1b')],'include':_0x5ef50c['include']?_[_0xa397('0x1f')](_0x5ef50c[_0xa397('0x1d')],function(_0xdda6e2){return{'model':db[_0xdda6e2['model']],'as':_0xdda6e2['as'],'attributes':_0xdda6e2[_0xa397('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa397('0x20')](function(_0x532364){logger[_0xa397('0xe')](_0xa397('0x22'),_0x31e701);logger[_0xa397('0x11')](_0xa397('0x22'),_0x31e701,JSON['stringify'](_0x532364));_0x1861eb(_0x532364);})[_0xa397('0x17')](function(_0x1f8a5b){logger[_0xa397('0x14')](_0xa397('0x22'),_0x1f8a5b['message'],_0x31e701);_0x39dcec(_0x56d38e[_0xa397('0x14')](0x1f4,_0x1f8a5b[_0xa397('0x16')]));});});}; \ No newline at end of file +var _0x6ac9=['localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','model','include','debug','ShowOpenchannelQueue','find','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2bda97,_0x5011a1){var _0x15bb2b=function(_0x170ee1){while(--_0x170ee1){_0x2bda97['push'](_0x2bda97['shift']());}};_0x15bb2b(++_0x5011a1);}(_0x6ac9,0x1a2));var _0x96ac=function(_0x3c0b0f,_0x14f847){_0x3c0b0f=_0x3c0b0f-0x0;var _0x4bf6a0=_0x6ac9[_0x3c0b0f];return _0x4bf6a0;};'use strict';var _=require('lodash');var util=require(_0x96ac('0x0'));var moment=require(_0x96ac('0x1'));var BPromise=require(_0x96ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96ac('0x4'));var config=require(_0x96ac('0x5'));var jayson=require(_0x96ac('0x6'));var client=jayson[_0x96ac('0x7')][_0x96ac('0x8')]({'port':0x232a});config[_0x96ac('0x9')]=_[_0x96ac('0xa')](config[_0x96ac('0x9')],{'host':_0x96ac('0xb'),'port':0x18eb});var socket=require(_0x96ac('0xc'))(new Redis(config[_0x96ac('0x9')]));require(_0x96ac('0xd'))[_0x96ac('0xe')](socket);function respondWithRpcPromise(_0x3739df,_0x2a21ac,_0x3156c0){return new BPromise(function(_0x4c22ee,_0x260910){return client['request'](_0x3739df,_0x3156c0)[_0x96ac('0xf')](function(_0x1dc07b){logger[_0x96ac('0x10')](_0x96ac('0x11'),_0x2a21ac,'request\x20sent');logger['debug'](_0x96ac('0x12'),_0x2a21ac,_0x96ac('0x13'),JSON[_0x96ac('0x14')](_0x1dc07b));if(_0x1dc07b[_0x96ac('0x15')]){if(_0x1dc07b[_0x96ac('0x15')][_0x96ac('0x16')]===0x1f4){logger[_0x96ac('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x2a21ac,_0x1dc07b[_0x96ac('0x15')][_0x96ac('0x17')]);return _0x260910(_0x1dc07b[_0x96ac('0x15')][_0x96ac('0x17')]);}logger['error'](_0x96ac('0x11'),_0x2a21ac,_0x1dc07b[_0x96ac('0x15')][_0x96ac('0x17')]);return _0x4c22ee(_0x1dc07b[_0x96ac('0x15')][_0x96ac('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2a21ac,_0x96ac('0x13'));_0x4c22ee(_0x1dc07b[_0x96ac('0x18')][_0x96ac('0x17')]);}})[_0x96ac('0x19')](function(_0x10c7c9){logger[_0x96ac('0x15')](_0x96ac('0x11'),_0x2a21ac,_0x10c7c9);_0x260910(_0x10c7c9);});});}exports[_0x96ac('0x1a')]=function(_0x4088b4){var _0x219e0f=this;return new Promise(function(_0x5ab255,_0x27877b){return db[_0x96ac('0x1b')][_0x96ac('0x1c')]({'raw':_0x4088b4[_0x96ac('0x1d')]?_0x4088b4[_0x96ac('0x1d')][_0x96ac('0x1e')]===undefined?!![]:![]:!![],'where':_0x4088b4[_0x96ac('0x1d')]?_0x4088b4[_0x96ac('0x1d')][_0x96ac('0x1f')]||null:null,'attributes':_0x4088b4[_0x96ac('0x1d')]?_0x4088b4[_0x96ac('0x1d')][_0x96ac('0x20')]||null:null,'limit':_0x4088b4[_0x96ac('0x1d')]?_0x4088b4[_0x96ac('0x1d')]['limit']||null:null,'include':_0x4088b4[_0x96ac('0x1d')]?_0x4088b4[_0x96ac('0x1d')]['include']?_[_0x96ac('0x21')](_0x4088b4[_0x96ac('0x1d')]['include'],function(_0x4565be){return{'model':db[_0x4565be[_0x96ac('0x22')]],'as':_0x4565be['as'],'attributes':_0x4565be[_0x96ac('0x20')],'include':_0x4565be['include']?_['map'](_0x4565be[_0x96ac('0x23')],function(_0xa4fccc){return{'model':db[_0xa4fccc['model']],'as':_0xa4fccc['as'],'attributes':_0xa4fccc[_0x96ac('0x20')],'include':_0xa4fccc['include']?_[_0x96ac('0x21')](_0xa4fccc[_0x96ac('0x23')],function(_0x388827){return{'model':db[_0x388827['model']],'as':_0x388827['as'],'attributes':_0x388827[_0x96ac('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96ac('0xf')](function(_0x2bd265){logger[_0x96ac('0x10')](_0x96ac('0x1a'),_0x4088b4);logger[_0x96ac('0x24')]('GetOpenchannelQueue',_0x4088b4,JSON[_0x96ac('0x14')](_0x2bd265));_0x5ab255(_0x2bd265);})['catch'](function(_0x155d98){logger['error'](_0x96ac('0x1a'),_0x155d98[_0x96ac('0x17')],_0x4088b4);_0x27877b(_0x219e0f[_0x96ac('0x15')](0x1f4,_0x155d98[_0x96ac('0x17')]));});});};exports[_0x96ac('0x25')]=function(_0x33e421){var _0x34daf0=this;return new Promise(function(_0x2ae0a8,_0x5e522f){return db['OpenchannelQueue'][_0x96ac('0x26')]({'raw':_0x33e421['options']?_0x33e421['options'][_0x96ac('0x1e')]===undefined?!![]:![]:!![],'where':_0x33e421[_0x96ac('0x1d')]?_0x33e421['options'][_0x96ac('0x1f')]||null:null,'attributes':_0x33e421[_0x96ac('0x1d')]?_0x33e421[_0x96ac('0x1d')]['attributes']||null:null,'include':_0x33e421[_0x96ac('0x1d')]?_0x33e421[_0x96ac('0x1d')][_0x96ac('0x23')]?_[_0x96ac('0x21')](_0x33e421['options'][_0x96ac('0x23')],function(_0x25b3e4){return{'model':db[_0x25b3e4[_0x96ac('0x22')]],'as':_0x25b3e4['as'],'attributes':_0x25b3e4[_0x96ac('0x20')],'include':_0x25b3e4['include']?_[_0x96ac('0x21')](_0x25b3e4[_0x96ac('0x23')],function(_0x43f427){return{'model':db[_0x43f427[_0x96ac('0x22')]],'as':_0x43f427['as'],'attributes':_0x43f427[_0x96ac('0x20')],'include':_0x43f427['include']?_['map'](_0x43f427['include'],function(_0x299a64){return{'model':db[_0x299a64[_0x96ac('0x22')]],'as':_0x299a64['as'],'attributes':_0x299a64[_0x96ac('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96ac('0xf')](function(_0x51eaf4){logger['info'](_0x96ac('0x25'),_0x33e421);logger[_0x96ac('0x24')](_0x96ac('0x25'),_0x33e421,JSON[_0x96ac('0x14')](_0x51eaf4));_0x2ae0a8(_0x51eaf4);})[_0x96ac('0x19')](function(_0x308e64){logger[_0x96ac('0x15')]('ShowOpenchannelQueue',_0x308e64['message'],_0x33e421);_0x5e522f(_0x34daf0[_0x96ac('0x15')](0x1f4,_0x308e64['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 19080d8..18b0c1c 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 _0x1b13=['update','emit','removeListener','length','./openchannelQueue.events','save','remove'];(function(_0x28daad,_0x4f1b3d){var _0x23ed1f=function(_0x2da970){while(--_0x2da970){_0x28daad['push'](_0x28daad['shift']());}};_0x23ed1f(++_0x4f1b3d);}(_0x1b13,0xb3));var _0x31b1=function(_0x3350a7,_0x5b3f49){_0x3350a7=_0x3350a7-0x0;var _0x2b98ff=_0x1b13[_0x3350a7];return _0x2b98ff;};'use strict';var OpenchannelQueueEvents=require(_0x31b1('0x0'));var events=[_0x31b1('0x1'),_0x31b1('0x2'),_0x31b1('0x3')];function createListener(_0x3b0743,_0x2646f9){return function(_0x3ab3ac){_0x2646f9[_0x31b1('0x4')](_0x3b0743,_0x3ab3ac);};}function removeListener(_0x17da3e,_0x4e6186){return function(){OpenchannelQueueEvents[_0x31b1('0x5')](_0x17da3e,_0x4e6186);};}exports['register']=function(_0xbcd3c5){for(var _0x3eaa97=0x0,_0x190c20=events[_0x31b1('0x6')];_0x3eaa97<_0x190c20;_0x3eaa97++){var _0x3d886a=events[_0x3eaa97];var _0x53ed87=createListener('openchannelQueue:'+_0x3d886a,_0xbcd3c5);OpenchannelQueueEvents['on'](_0x3d886a,_0x53ed87);}}; \ No newline at end of file +var _0xc774=['remove','removeListener','save'];(function(_0x4b9e80,_0x2b3179){var _0xc73b33=function(_0x256723){while(--_0x256723){_0x4b9e80['push'](_0x4b9e80['shift']());}};_0xc73b33(++_0x2b3179);}(_0xc774,0xda));var _0x4c77=function(_0x4dbe62,_0x17f33b){_0x4dbe62=_0x4dbe62-0x0;var _0x2d74b3=_0xc774[_0x4dbe62];return _0x2d74b3;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x4c77('0x0'),_0x4c77('0x1'),'update'];function createListener(_0x13ed83,_0x4bd89d){return function(_0x30dae1){_0x4bd89d['emit'](_0x13ed83,_0x30dae1);};}function removeListener(_0x47538c,_0x3fb089){return function(){OpenchannelQueueEvents[_0x4c77('0x2')](_0x47538c,_0x3fb089);};}exports['register']=function(_0x4e4ceb){for(var _0x220026=0x0,_0x582f54=events['length'];_0x220026<_0x582f54;_0x220026++){var _0x4e26f7=events[_0x220026];var _0x381f20=createListener('openchannelQueue:'+_0x4e26f7,_0x4e4ceb);OpenchannelQueueEvents['on'](_0x4e26f7,_0x381f20);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b52f8ba..d460357 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 _0xa101=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xf9d6c7,_0x1c7434){var _0x27859a=function(_0x28ef2b){while(--_0x28ef2b){_0xf9d6c7['push'](_0xf9d6c7['shift']());}};_0x27859a(++_0x1c7434);}(_0xa101,0xea));var _0x1a10=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xa101[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require(_0x1a10('0x0'));var util=require(_0x1a10('0x1'));var path=require(_0x1a10('0x2'));var timeout=require(_0x1a10('0x3'));var express=require('express');var router=express[_0x1a10('0x4')]();var fs_extra=require(_0x1a10('0x5'));var auth=require(_0x1a10('0x6'));var interaction=require(_0x1a10('0x7'));var config=require(_0x1a10('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x1a10('0x9')]('/',auth[_0x1a10('0xa')](),controller[_0x1a10('0xb')]);router[_0x1a10('0x9')]('/describe',auth[_0x1a10('0xa')](),controller['describe']);router[_0x1a10('0x9')](_0x1a10('0xc'),auth['isAuthenticated'](),controller[_0x1a10('0xd')]);router[_0x1a10('0xe')]('/',auth['isAuthenticated'](),controller[_0x1a10('0xf')]);router[_0x1a10('0x10')](_0x1a10('0xc'),auth[_0x1a10('0xa')](),controller['update']);router[_0x1a10('0x11')](_0x1a10('0xc'),auth[_0x1a10('0xa')](),controller[_0x1a10('0x12')]);module[_0x1a10('0x13')]=router; \ No newline at end of file +var _0x3f6b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','show','post','create','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x198c51,_0x6f96a8){var _0x1b0ead=function(_0x120fc9){while(--_0x120fc9){_0x198c51['push'](_0x198c51['shift']());}};_0x1b0ead(++_0x6f96a8);}(_0x3f6b,0x1f2));var _0xb3f6=function(_0x4dab10,_0x4b3811){_0x4dab10=_0x4dab10-0x0;var _0x155bca=_0x3f6b[_0x4dab10];return _0x155bca;};'use strict';var multer=require(_0xb3f6('0x0'));var util=require(_0xb3f6('0x1'));var path=require(_0xb3f6('0x2'));var timeout=require(_0xb3f6('0x3'));var express=require(_0xb3f6('0x4'));var router=express[_0xb3f6('0x5')]();var fs_extra=require(_0xb3f6('0x6'));var auth=require(_0xb3f6('0x7'));var interaction=require(_0xb3f6('0x8'));var config=require(_0xb3f6('0x9'));var controller=require(_0xb3f6('0xa'));router[_0xb3f6('0xb')]('/',auth[_0xb3f6('0xc')](),controller['index']);router['get']('/describe',auth[_0xb3f6('0xc')](),controller[_0xb3f6('0xd')]);router[_0xb3f6('0xb')]('/:id',auth[_0xb3f6('0xc')](),controller[_0xb3f6('0xe')]);router[_0xb3f6('0xf')]('/',auth['isAuthenticated'](),controller[_0xb3f6('0x10')]);router[_0xb3f6('0x11')]('/:id',auth[_0xb3f6('0xc')](),controller['update']);router[_0xb3f6('0x12')](_0xb3f6('0x13'),auth[_0xb3f6('0xc')](),controller['destroy']);module[_0xb3f6('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 84f7fe8..8b752b4 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 _0x54da=['STRING','moment','exports','DATE'];(function(_0xbc88bc,_0x10ea66){var _0x548858=function(_0x178473){while(--_0x178473){_0xbc88bc['push'](_0xbc88bc['shift']());}};_0x548858(++_0x10ea66);}(_0x54da,0x9d));var _0xa54d=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x54da[_0x57b236];return _0x4feb29;};'use strict';var moment=require(_0xa54d('0x0'));var Sequelize=require('sequelize');module[_0xa54d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa54d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa54d('0x2')]},'exitAt':{'type':Sequelize[_0xa54d('0x2')]},'reason':{'type':Sequelize[_0xa54d('0x3')]}}; \ No newline at end of file +var _0x1259=['sequelize','exports','STRING','DATE','moment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1259,0x1f3));var _0x9125=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x1259[_0x54b2b0];return _0x1a0d6b;};'use strict';var moment=require(_0x9125('0x0'));var Sequelize=require(_0x9125('0x1'));module[_0x9125('0x2')]={'uniqueid':{'type':Sequelize[_0x9125('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9125('0x3')]},'joinAt':{'type':Sequelize[_0x9125('0x4')]},'leaveAt':{'type':Sequelize[_0x9125('0x4')]},'acceptAt':{'type':Sequelize[_0x9125('0x4')]},'exitAt':{'type':Sequelize[_0x9125('0x4')]},'reason':{'type':Sequelize[_0x9125('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index dd9f909..5323f94 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 _0x03ff=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir'];(function(_0x46e837,_0x27db96){var _0x30d6e8=function(_0x2b5926){while(--_0x2b5926){_0x46e837['push'](_0x46e837['shift']());}};_0x30d6e8(++_0x27db96);}(_0x03ff,0x9d));var _0xf03f=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x03ff[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xf03f('0x0'));var rimraf=require(_0xf03f('0x1'));var zipdir=require(_0xf03f('0x2'));var jsonpatch=require(_0xf03f('0x3'));var rp=require(_0xf03f('0x4'));var moment=require(_0xf03f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf03f('0x6'));var util=require(_0xf03f('0x7'));var path=require(_0xf03f('0x8'));var sox=require('sox');var csv=require(_0xf03f('0x9'));var ejs=require(_0xf03f('0xa'));var fs=require('fs');var fs_extra=require(_0xf03f('0xb'));var _=require(_0xf03f('0xc'));var squel=require(_0xf03f('0xd'));var crypto=require(_0xf03f('0xe'));var jsforce=require(_0xf03f('0xf'));var deskjs=require(_0xf03f('0x10'));var toCsv=require(_0xf03f('0x9'));var querystring=require('querystring');var Papa=require(_0xf03f('0x11'));var Redis=require('ioredis');var authService=require(_0xf03f('0x12'));var qs=require(_0xf03f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf03f('0x14'));var logger=require('../../config/logger')(_0xf03f('0x15'));var utils=require(_0xf03f('0x16'));var config=require(_0xf03f('0x17'));var licenseUtil=require(_0xf03f('0x18'));var db=require(_0xf03f('0x19'))['db'];function respondWithStatusCode(_0x390f45,_0x23931e){_0x23931e=_0x23931e||0xcc;return function(_0x543ffc){if(_0x543ffc){return _0x390f45[_0xf03f('0x1a')](_0x23931e);}return _0x390f45[_0xf03f('0x1b')](_0x23931e)['end']();};}function respondWithResult(_0x43e873,_0x4ff907){_0x4ff907=_0x4ff907||0xc8;return function(_0x2988d3){if(_0x2988d3){return _0x43e873[_0xf03f('0x1b')](_0x4ff907)[_0xf03f('0x1c')](_0x2988d3);}};}function respondWithFilteredResult(_0x2a758c,_0x307786){return function(_0x100bf8){if(_0x100bf8){var _0x3be2fd=typeof _0x307786[_0xf03f('0x1d')]===_0xf03f('0x1e')&&typeof _0x307786['limit']===_0xf03f('0x1e');var _0x2ca380=_0x100bf8[_0xf03f('0x1f')];var _0x5f209e=_0x3be2fd?0x0:_0x307786[_0xf03f('0x1d')];var _0x4a8ea5=_0x3be2fd?_0x100bf8[_0xf03f('0x1f')]:_0x307786['offset']+_0x307786['limit'];var _0x4f6df4;if(_0x4a8ea5>=_0x2ca380){_0x4a8ea5=_0x2ca380;_0x4f6df4=0xc8;}else{_0x4f6df4=0xce;}_0x2a758c['status'](_0x4f6df4);return _0x2a758c[_0xf03f('0x20')](_0xf03f('0x21'),_0x5f209e+'-'+_0x4a8ea5+'/'+_0x2ca380)[_0xf03f('0x1c')](_0x100bf8);}return null;};}function patchUpdates(_0x144638){return function(_0x26dcca){try{jsonpatch[_0xf03f('0x22')](_0x26dcca,_0x144638,!![]);}catch(_0x4a5ccf){return BPromise[_0xf03f('0x23')](_0x4a5ccf);}return _0x26dcca[_0xf03f('0x24')]();};}function saveUpdates(_0x2de040,_0x2d657f){return function(_0x21c1bf){if(_0x21c1bf){return _0x21c1bf[_0xf03f('0x25')](_0x2de040)[_0xf03f('0x26')](function(_0x484086){return _0x484086;});}return null;};}function removeEntity(_0x135d30,_0x336924){return function(_0x158d6b){if(_0x158d6b){return _0x158d6b[_0xf03f('0x27')]()[_0xf03f('0x26')](function(){_0x135d30[_0xf03f('0x1b')](0xcc)[_0xf03f('0x28')]();});}};}function handleEntityNotFound(_0x21b73f,_0x16c208){return function(_0x39d6d6){if(!_0x39d6d6){_0x21b73f[_0xf03f('0x1a')](0x194);}return _0x39d6d6;};}function handleError(_0x3b9ea0,_0x24db91){_0x24db91=_0x24db91||0x1f4;return function(_0x2d3cd6){logger[_0xf03f('0x29')](_0x2d3cd6[_0xf03f('0x2a')]);if(_0x2d3cd6[_0xf03f('0x2b')]){delete _0x2d3cd6[_0xf03f('0x2b')];}_0x3b9ea0[_0xf03f('0x1b')](_0x24db91)[_0xf03f('0x2c')](_0x2d3cd6);};}exports[_0xf03f('0x2d')]=function(_0x15d840,_0x8ab9){var _0xf2d1c4={},_0x435c57={},_0x152958={'count':0x0,'rows':[]};var _0x3d20b5=_[_0xf03f('0x2e')](db[_0xf03f('0x2f')][_0xf03f('0x30')],function(_0xd1c18a){return{'name':_0xd1c18a[_0xf03f('0x31')],'type':_0xd1c18a[_0xf03f('0x32')][_0xf03f('0x33')]};});_0x435c57[_0xf03f('0x34')]=_['map'](_0x3d20b5,'name');_0x435c57['query']=_[_0xf03f('0x35')](_0x15d840[_0xf03f('0x36')]);_0x435c57[_0xf03f('0x37')]=_[_0xf03f('0x38')](_0x435c57['model'],_0x435c57[_0xf03f('0x36')]);_0xf2d1c4[_0xf03f('0x39')]=_[_0xf03f('0x38')](_0x435c57['model'],qs['fields'](_0x15d840[_0xf03f('0x36')][_0xf03f('0x3a')]));_0xf2d1c4[_0xf03f('0x39')]=_0xf2d1c4[_0xf03f('0x39')][_0xf03f('0x3b')]?_0xf2d1c4[_0xf03f('0x39')]:_0x435c57[_0xf03f('0x34')];if(!_0x15d840[_0xf03f('0x36')][_0xf03f('0x3c')](_0xf03f('0x3d'))){_0xf2d1c4[_0xf03f('0x3e')]=qs[_0xf03f('0x3e')](_0x15d840[_0xf03f('0x36')][_0xf03f('0x3e')]);_0xf2d1c4[_0xf03f('0x1d')]=qs[_0xf03f('0x1d')](_0x15d840[_0xf03f('0x36')][_0xf03f('0x1d')]);}_0xf2d1c4[_0xf03f('0x3f')]=qs[_0xf03f('0x40')](_0x15d840[_0xf03f('0x36')][_0xf03f('0x40')]);_0xf2d1c4[_0xf03f('0x41')]=qs[_0xf03f('0x37')](_['pick'](_0x15d840[_0xf03f('0x36')],_0x435c57[_0xf03f('0x37')]),_0x3d20b5);if(_0x15d840['query']['filter']){_0xf2d1c4[_0xf03f('0x41')]=_[_0xf03f('0x42')](_0xf2d1c4[_0xf03f('0x41')],{'$or':_['map'](_0x3d20b5,function(_0x65f0d){if(_0x65f0d[_0xf03f('0x32')]!=='VIRTUAL'){var _0xbf3c3a={};_0xbf3c3a[_0x65f0d[_0xf03f('0x2b')]]={'$like':'%'+_0x15d840[_0xf03f('0x36')][_0xf03f('0x43')]+'%'};return _0xbf3c3a;}})});}_0xf2d1c4=_[_0xf03f('0x42')]({},_0xf2d1c4,_0x15d840[_0xf03f('0x44')]);var _0x4bc025={'where':_0xf2d1c4[_0xf03f('0x41')]};return db[_0xf03f('0x2f')][_0xf03f('0x1f')](_0x4bc025)[_0xf03f('0x26')](function(_0x237323){_0x152958[_0xf03f('0x1f')]=_0x237323;if(_0x15d840[_0xf03f('0x36')][_0xf03f('0x45')]){_0xf2d1c4[_0xf03f('0x46')]=[{'all':!![]}];}return db[_0xf03f('0x2f')][_0xf03f('0x47')](_0xf2d1c4);})['then'](function(_0x5765c0){_0x152958[_0xf03f('0x48')]=_0x5765c0;return _0x152958;})[_0xf03f('0x26')](respondWithFilteredResult(_0x8ab9,_0xf2d1c4))[_0xf03f('0x49')](handleError(_0x8ab9,null));};exports[_0xf03f('0x4a')]=function(_0x1d4bb3,_0x22e51b){var _0x46487d={'raw':!![],'where':{'id':_0x1d4bb3['params']['id']}},_0x193052={};_0x193052[_0xf03f('0x34')]=_[_0xf03f('0x35')](db[_0xf03f('0x2f')]['rawAttributes']);_0x193052[_0xf03f('0x36')]=_[_0xf03f('0x35')](_0x1d4bb3[_0xf03f('0x36')]);_0x193052[_0xf03f('0x37')]=_['intersection'](_0x193052[_0xf03f('0x34')],_0x193052[_0xf03f('0x36')]);_0x46487d[_0xf03f('0x39')]=_[_0xf03f('0x38')](_0x193052['model'],qs['fields'](_0x1d4bb3[_0xf03f('0x36')][_0xf03f('0x3a')]));_0x46487d['attributes']=_0x46487d[_0xf03f('0x39')][_0xf03f('0x3b')]?_0x46487d[_0xf03f('0x39')]:_0x193052[_0xf03f('0x34')];if(_0x1d4bb3[_0xf03f('0x36')][_0xf03f('0x45')]){_0x46487d['include']=[{'all':!![]}];}_0x46487d=_[_0xf03f('0x42')]({},_0x46487d,_0x1d4bb3[_0xf03f('0x44')]);return db[_0xf03f('0x2f')][_0xf03f('0x4b')](_0x46487d)['then'](handleEntityNotFound(_0x22e51b,null))[_0xf03f('0x26')](respondWithResult(_0x22e51b,null))[_0xf03f('0x49')](handleError(_0x22e51b,null));};exports[_0xf03f('0x4c')]=function(_0x4e1f53,_0x684ad4){return db[_0xf03f('0x2f')]['create'](_0x4e1f53['body'],{})[_0xf03f('0x26')](respondWithResult(_0x684ad4,0xc9))['catch'](handleError(_0x684ad4,null));};exports[_0xf03f('0x25')]=function(_0x4cc42e,_0x2b2fc5){if(_0x4cc42e[_0xf03f('0x4d')]['id']){delete _0x4cc42e['body']['id'];}return db['OpenchannelQueueReport'][_0xf03f('0x4b')]({'where':{'id':_0x4cc42e[_0xf03f('0x4e')]['id']}})[_0xf03f('0x26')](handleEntityNotFound(_0x2b2fc5,null))[_0xf03f('0x26')](saveUpdates(_0x4cc42e[_0xf03f('0x4d')],null))[_0xf03f('0x26')](respondWithResult(_0x2b2fc5,null))['catch'](handleError(_0x2b2fc5,null));};exports[_0xf03f('0x27')]=function(_0x5501b5,_0x366f78){return db[_0xf03f('0x2f')][_0xf03f('0x4b')]({'where':{'id':_0x5501b5[_0xf03f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x366f78,null))[_0xf03f('0x26')](removeEntity(_0x366f78,null))[_0xf03f('0x49')](handleError(_0x366f78,null));};exports[_0xf03f('0x4f')]=function(_0xe0a901,_0x45a09e){return db[_0xf03f('0x2f')][_0xf03f('0x4f')]()[_0xf03f('0x26')](respondWithResult(_0x45a09e,null))[_0xf03f('0x49')](handleError(_0x45a09e,null));}; \ No newline at end of file +var _0x56e4=['../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','count','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c401b,_0x20d97f){var _0x477b86=function(_0x103aee){while(--_0x103aee){_0x1c401b['push'](_0x1c401b['shift']());}};_0x477b86(++_0x20d97f);}(_0x56e4,0x19d));var _0x456e=function(_0x67dfc2,_0x25201e){_0x67dfc2=_0x67dfc2-0x0;var _0x2fb3b9=_0x56e4[_0x67dfc2];return _0x2fb3b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x456e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x456e('0x1'));var rp=require(_0x456e('0x2'));var moment=require(_0x456e('0x3'));var BPromise=require(_0x456e('0x4'));var Mustache=require(_0x456e('0x5'));var util=require(_0x456e('0x6'));var path=require('path');var sox=require(_0x456e('0x7'));var csv=require(_0x456e('0x8'));var ejs=require(_0x456e('0x9'));var fs=require('fs');var fs_extra=require(_0x456e('0xa'));var _=require(_0x456e('0xb'));var squel=require(_0x456e('0xc'));var crypto=require(_0x456e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x456e('0xe'));var toCsv=require(_0x456e('0x8'));var querystring=require(_0x456e('0xf'));var Papa=require(_0x456e('0x10'));var Redis=require(_0x456e('0x11'));var authService=require(_0x456e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x456e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x456e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x100210,_0x5b92ad){_0x5b92ad=_0x5b92ad||0xcc;return function(_0x41cc67){if(_0x41cc67){return _0x100210[_0x456e('0x15')](_0x5b92ad);}return _0x100210[_0x456e('0x16')](_0x5b92ad)[_0x456e('0x17')]();};}function respondWithResult(_0x37f0ae,_0x5d6120){_0x5d6120=_0x5d6120||0xc8;return function(_0x1d7d8e){if(_0x1d7d8e){return _0x37f0ae['status'](_0x5d6120)[_0x456e('0x18')](_0x1d7d8e);}};}function respondWithFilteredResult(_0x3841c7,_0x5f56c0){return function(_0x10f8f7){if(_0x10f8f7){var _0x65b8f5=typeof _0x5f56c0['offset']===_0x456e('0x19')&&typeof _0x5f56c0[_0x456e('0x1a')]==='undefined';var _0x565edb=_0x10f8f7['count'];var _0x5bd302=_0x65b8f5?0x0:_0x5f56c0[_0x456e('0x1b')];var _0x29d6fa=_0x65b8f5?_0x10f8f7['count']:_0x5f56c0[_0x456e('0x1b')]+_0x5f56c0[_0x456e('0x1a')];var _0x298061;if(_0x29d6fa>=_0x565edb){_0x29d6fa=_0x565edb;_0x298061=0xc8;}else{_0x298061=0xce;}_0x3841c7[_0x456e('0x16')](_0x298061);return _0x3841c7[_0x456e('0x1c')](_0x456e('0x1d'),_0x5bd302+'-'+_0x29d6fa+'/'+_0x565edb)[_0x456e('0x18')](_0x10f8f7);}return null;};}function patchUpdates(_0x3bb415){return function(_0x5656c3){try{jsonpatch[_0x456e('0x1e')](_0x5656c3,_0x3bb415,!![]);}catch(_0x3f3e1c){return BPromise[_0x456e('0x1f')](_0x3f3e1c);}return _0x5656c3['save']();};}function saveUpdates(_0x50864b,_0x68dc1a){return function(_0x520ebc){if(_0x520ebc){return _0x520ebc[_0x456e('0x20')](_0x50864b)[_0x456e('0x21')](function(_0x13fe97){return _0x13fe97;});}return null;};}function removeEntity(_0x592fcd,_0x488835){return function(_0x40dd12){if(_0x40dd12){return _0x40dd12['destroy']()[_0x456e('0x21')](function(){_0x592fcd[_0x456e('0x16')](0xcc)[_0x456e('0x17')]();});}};}function handleEntityNotFound(_0x2860b0,_0x21e1dc){return function(_0x2c3755){if(!_0x2c3755){_0x2860b0[_0x456e('0x15')](0x194);}return _0x2c3755;};}function handleError(_0x367ac5,_0xc2820f){_0xc2820f=_0xc2820f||0x1f4;return function(_0x474b5a){logger[_0x456e('0x22')](_0x474b5a[_0x456e('0x23')]);if(_0x474b5a['name']){delete _0x474b5a[_0x456e('0x24')];}_0x367ac5[_0x456e('0x16')](_0xc2820f)[_0x456e('0x25')](_0x474b5a);};}exports[_0x456e('0x26')]=function(_0xce89f4,_0x1d41a8){var _0x3f70bd={},_0x40ee24={},_0x4fd0d3={'count':0x0,'rows':[]};var _0x4842e4=_[_0x456e('0x27')](db[_0x456e('0x28')][_0x456e('0x29')],function(_0x2c0986){return{'name':_0x2c0986[_0x456e('0x2a')],'type':_0x2c0986[_0x456e('0x2b')][_0x456e('0x2c')]};});_0x40ee24['model']=_[_0x456e('0x27')](_0x4842e4,_0x456e('0x24'));_0x40ee24[_0x456e('0x2d')]=_['keys'](_0xce89f4[_0x456e('0x2d')]);_0x40ee24[_0x456e('0x2e')]=_[_0x456e('0x2f')](_0x40ee24[_0x456e('0x30')],_0x40ee24[_0x456e('0x2d')]);_0x3f70bd['attributes']=_[_0x456e('0x2f')](_0x40ee24[_0x456e('0x30')],qs[_0x456e('0x31')](_0xce89f4[_0x456e('0x2d')][_0x456e('0x31')]));_0x3f70bd[_0x456e('0x32')]=_0x3f70bd[_0x456e('0x32')]['length']?_0x3f70bd['attributes']:_0x40ee24['model'];if(!_0xce89f4['query'][_0x456e('0x33')](_0x456e('0x34'))){_0x3f70bd[_0x456e('0x1a')]=qs[_0x456e('0x1a')](_0xce89f4['query'][_0x456e('0x1a')]);_0x3f70bd[_0x456e('0x1b')]=qs[_0x456e('0x1b')](_0xce89f4['query'][_0x456e('0x1b')]);}_0x3f70bd[_0x456e('0x35')]=qs[_0x456e('0x36')](_0xce89f4[_0x456e('0x2d')]['sort']);_0x3f70bd['where']=qs[_0x456e('0x2e')](_[_0x456e('0x37')](_0xce89f4[_0x456e('0x2d')],_0x40ee24[_0x456e('0x2e')]),_0x4842e4);if(_0xce89f4[_0x456e('0x2d')]['filter']){_0x3f70bd[_0x456e('0x38')]=_[_0x456e('0x39')](_0x3f70bd['where'],{'$or':_[_0x456e('0x27')](_0x4842e4,function(_0x160822){if(_0x160822[_0x456e('0x2b')]!=='VIRTUAL'){var _0x25f4e2={};_0x25f4e2[_0x160822[_0x456e('0x24')]]={'$like':'%'+_0xce89f4[_0x456e('0x2d')][_0x456e('0x3a')]+'%'};return _0x25f4e2;}})});}_0x3f70bd=_[_0x456e('0x39')]({},_0x3f70bd,_0xce89f4['options']);var _0x5481bf={'where':_0x3f70bd[_0x456e('0x38')]};return db[_0x456e('0x28')][_0x456e('0x3b')](_0x5481bf)[_0x456e('0x21')](function(_0x5efc72){_0x4fd0d3['count']=_0x5efc72;if(_0xce89f4[_0x456e('0x2d')][_0x456e('0x3c')]){_0x3f70bd[_0x456e('0x3d')]=[{'all':!![]}];}return db[_0x456e('0x28')][_0x456e('0x3e')](_0x3f70bd);})[_0x456e('0x21')](function(_0x220943){_0x4fd0d3[_0x456e('0x3f')]=_0x220943;return _0x4fd0d3;})['then'](respondWithFilteredResult(_0x1d41a8,_0x3f70bd))['catch'](handleError(_0x1d41a8,null));};exports['show']=function(_0x4e45ee,_0x434304){var _0x5d956c={'raw':!![],'where':{'id':_0x4e45ee[_0x456e('0x40')]['id']}},_0x365480={};_0x365480[_0x456e('0x30')]=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x365480['query']=_[_0x456e('0x41')](_0x4e45ee[_0x456e('0x2d')]);_0x365480['filters']=_[_0x456e('0x2f')](_0x365480[_0x456e('0x30')],_0x365480['query']);_0x5d956c[_0x456e('0x32')]=_['intersection'](_0x365480[_0x456e('0x30')],qs[_0x456e('0x31')](_0x4e45ee[_0x456e('0x2d')][_0x456e('0x31')]));_0x5d956c[_0x456e('0x32')]=_0x5d956c[_0x456e('0x32')]['length']?_0x5d956c[_0x456e('0x32')]:_0x365480[_0x456e('0x30')];if(_0x4e45ee[_0x456e('0x2d')][_0x456e('0x3c')]){_0x5d956c[_0x456e('0x3d')]=[{'all':!![]}];}_0x5d956c=_[_0x456e('0x39')]({},_0x5d956c,_0x4e45ee[_0x456e('0x42')]);return db[_0x456e('0x28')][_0x456e('0x43')](_0x5d956c)['then'](handleEntityNotFound(_0x434304,null))[_0x456e('0x21')](respondWithResult(_0x434304,null))[_0x456e('0x44')](handleError(_0x434304,null));};exports[_0x456e('0x45')]=function(_0x2fb193,_0x1bd00c){return db[_0x456e('0x28')]['create'](_0x2fb193[_0x456e('0x46')],{})[_0x456e('0x21')](respondWithResult(_0x1bd00c,0xc9))[_0x456e('0x44')](handleError(_0x1bd00c,null));};exports['update']=function(_0x46d808,_0x154ce8){if(_0x46d808[_0x456e('0x46')]['id']){delete _0x46d808[_0x456e('0x46')]['id'];}return db[_0x456e('0x28')][_0x456e('0x43')]({'where':{'id':_0x46d808[_0x456e('0x40')]['id']}})[_0x456e('0x21')](handleEntityNotFound(_0x154ce8,null))[_0x456e('0x21')](saveUpdates(_0x46d808[_0x456e('0x46')],null))[_0x456e('0x21')](respondWithResult(_0x154ce8,null))[_0x456e('0x44')](handleError(_0x154ce8,null));};exports['destroy']=function(_0x29bda8,_0x20c738){return db['OpenchannelQueueReport'][_0x456e('0x43')]({'where':{'id':_0x29bda8[_0x456e('0x40')]['id']}})[_0x456e('0x21')](handleEntityNotFound(_0x20c738,null))['then'](removeEntity(_0x20c738,null))[_0x456e('0x44')](handleError(_0x20c738,null));};exports['describe']=function(_0x128603,_0x147c83){return db[_0x456e('0x28')][_0x456e('0x47')]()[_0x456e('0x21')](respondWithResult(_0x147c83,null))[_0x456e('0x44')](handleError(_0x147c83,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 30f548d..f1789f5 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x814b,0x1a2));var _0xb814=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x814b[_0x5ad220];return _0xdec77d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2f96c1,_0x3b2c53){var _0x2ef660=function(_0x577f1b){while(--_0x577f1b){_0x2f96c1['push'](_0x2f96c1['shift']());}};_0x2ef660(++_0x3b2c53);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x5fc3[_0x4d7116];return _0x4593dc;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 856dfb6..7c589d7 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 _0x4af8=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4af8,0x1ad));var _0x84af=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4af8[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});}exports[_0x84af('0x14')]=function(_0xd8120b){var _0x38a120=this;return new Promise(function(_0x4cf5b4,_0x4d0cf0){return db[_0x84af('0x15')][_0x84af('0x16')](_0xd8120b[_0x84af('0x17')],{'raw':_0xd8120b[_0x84af('0x18')]?_0xd8120b[_0x84af('0x18')][_0x84af('0x19')]===undefined?!![]:![]:!![]})[_0x84af('0x9')](function(_0x334875){logger[_0x84af('0xa')]('CreateOpenchannelQueueReport',_0xd8120b);logger[_0x84af('0xc')](_0x84af('0x14'),_0xd8120b,JSON[_0x84af('0x1a')](_0x334875));_0x4cf5b4(_0x334875);})['catch'](function(_0x2f40d6){logger[_0x84af('0xe')](_0x84af('0x14'),_0x2f40d6['message'],_0xd8120b);_0x4d0cf0(_0x38a120['error'](0x1f4,_0x2f40d6[_0x84af('0x10')]));});});};exports[_0x84af('0x1b')]=function(_0xf72093){var _0x24aa07=this;return new Promise(function(_0x21823e,_0x1b23fb){return db[_0x84af('0x15')][_0x84af('0x1c')](_0xf72093[_0x84af('0x17')],{'raw':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1d')]||null:null,'attributes':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1e')]||null:null,'limit':_0xf72093[_0x84af('0x18')]?_0xf72093['options'][_0x84af('0x1f')]||null:null})[_0x84af('0x9')](function(_0x59417e){logger[_0x84af('0xa')](_0x84af('0x1b'),_0xf72093);logger[_0x84af('0xc')](_0x84af('0x1b'),_0xf72093,JSON['stringify'](_0x59417e));_0x21823e(_0x59417e);})['catch'](function(_0x3f37a0){logger[_0x84af('0xe')](_0x84af('0x1b'),_0x3f37a0[_0x84af('0x10')],_0xf72093);_0x1b23fb(_0x24aa07[_0x84af('0xe')](0x1f4,_0x3f37a0[_0x84af('0x10')]));});});}; \ No newline at end of file +var _0x9158=['where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','update'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x9158,0x16e));var _0x8915=function(_0x21485b,_0x17e77d){_0x21485b=_0x21485b-0x0;var _0x42c2c9=_0x9158[_0x21485b];return _0x42c2c9;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var moment=require(_0x8915('0x2'));var BPromise=require('bluebird');var rs=require(_0x8915('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8915('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8915('0x5'));var config=require(_0x8915('0x6'));var jayson=require(_0x8915('0x7'));var client=jayson[_0x8915('0x8')][_0x8915('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ff3d,_0x33abdd,_0x100d72){return new BPromise(function(_0x50d1f8,_0x41be04){return client[_0x8915('0xa')](_0x20ff3d,_0x100d72)[_0x8915('0xb')](function(_0x1a5403){logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x33abdd,_0x8915('0xe'),JSON[_0x8915('0xf')](_0x1a5403));if(_0x1a5403[_0x8915('0x10')]){if(_0x1a5403[_0x8915('0x10')][_0x8915('0x11')]===0x1f4){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);return _0x41be04(_0x1a5403['error'][_0x8915('0x12')]);}logger['error'](_0x8915('0xd'),_0x33abdd,_0x1a5403['error'][_0x8915('0x12')]);return _0x50d1f8(_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);}else{logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));_0x50d1f8(_0x1a5403[_0x8915('0x13')][_0x8915('0x12')]);}})[_0x8915('0x14')](function(_0x3f541c){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x3f541c);_0x41be04(_0x3f541c);});});}exports[_0x8915('0x15')]=function(_0x913dc){var _0x5ccd36=this;return new Promise(function(_0x5987d4,_0x17bb6c){return db[_0x8915('0x16')][_0x8915('0x17')](_0x913dc[_0x8915('0x18')],{'raw':_0x913dc[_0x8915('0x19')]?_0x913dc[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![]})[_0x8915('0xb')](function(_0x511dcd){logger['info'](_0x8915('0x15'),_0x913dc);logger[_0x8915('0x1b')](_0x8915('0x15'),_0x913dc,JSON[_0x8915('0xf')](_0x511dcd));_0x5987d4(_0x511dcd);})['catch'](function(_0x2eebe1){logger[_0x8915('0x10')](_0x8915('0x15'),_0x2eebe1[_0x8915('0x12')],_0x913dc);_0x17bb6c(_0x5ccd36[_0x8915('0x10')](0x1f4,_0x2eebe1[_0x8915('0x12')]));});});};exports[_0x8915('0x1c')]=function(_0x2568d8){var _0x5c061d=this;return new Promise(function(_0x4159c9,_0x4e5973){return db[_0x8915('0x16')][_0x8915('0x1d')](_0x2568d8['body'],{'raw':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1e')]||null:null,'attributes':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x1f')]||null:null,'limit':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x20')]||null:null})['then'](function(_0x3b133c){logger['info'](_0x8915('0x1c'),_0x2568d8);logger[_0x8915('0x1b')]('UpdateOpenchannelQueueReport',_0x2568d8,JSON[_0x8915('0xf')](_0x3b133c));_0x4159c9(_0x3b133c);})[_0x8915('0x14')](function(_0x18296c){logger[_0x8915('0x10')](_0x8915('0x1c'),_0x18296c['message'],_0x2568d8);_0x4e5973(_0x5c061d[_0x8915('0x10')](0x1f4,_0x18296c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f36a04c..65641b1 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 _0x08f1=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x3a60fb,_0x4003cd){var _0x37c1fb=function(_0x17fdf2){while(--_0x17fdf2){_0x3a60fb['push'](_0x3a60fb['shift']());}};_0x37c1fb(++_0x4003cd);}(_0x08f1,0xab));var _0x108f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x08f1[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x108f('0x0'));var path=require(_0x108f('0x1'));var timeout=require(_0x108f('0x2'));var express=require(_0x108f('0x3'));var router=express[_0x108f('0x4')]();var fs_extra=require(_0x108f('0x5'));var auth=require(_0x108f('0x6'));var interaction=require(_0x108f('0x7'));var config=require('../../config/environment');var controller=require(_0x108f('0x8'));router[_0x108f('0x9')]('/',auth[_0x108f('0xa')](),controller[_0x108f('0xb')]);router[_0x108f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x108f('0xc')]);router[_0x108f('0x9')](_0x108f('0xd'),auth['isAuthenticated'](),controller[_0x108f('0xe')]);router[_0x108f('0xf')]('/',auth['isAuthenticated'](),controller[_0x108f('0x10')]);router[_0x108f('0x11')](_0x108f('0xd'),auth[_0x108f('0xa')](),controller[_0x108f('0x12')]);router[_0x108f('0x13')](_0x108f('0xd'),auth[_0x108f('0xa')](),controller[_0x108f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x19f5=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xae9769,_0x49b579){var _0x378777=function(_0x76dd06){while(--_0x76dd06){_0xae9769['push'](_0xae9769['shift']());}};_0x378777(++_0x49b579);}(_0x19f5,0x1c4));var _0x519f=function(_0x5b4777,_0x318666){_0x5b4777=_0x5b4777-0x0;var _0x1f7e9f=_0x19f5[_0x5b4777];return _0x1f7e9f;};'use strict';var multer=require(_0x519f('0x0'));var util=require(_0x519f('0x1'));var path=require(_0x519f('0x2'));var timeout=require(_0x519f('0x3'));var express=require(_0x519f('0x4'));var router=express['Router']();var fs_extra=require(_0x519f('0x5'));var auth=require(_0x519f('0x6'));var interaction=require(_0x519f('0x7'));var config=require(_0x519f('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x519f('0x9')]('/',auth[_0x519f('0xa')](),controller[_0x519f('0xb')]);router['get'](_0x519f('0xc'),auth[_0x519f('0xa')](),controller[_0x519f('0xd')]);router[_0x519f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x519f('0xe')]);router[_0x519f('0xf')]('/',auth['isAuthenticated'](),controller[_0x519f('0x10')]);router[_0x519f('0x11')](_0x519f('0x12'),auth[_0x519f('0xa')](),controller[_0x519f('0x13')]);router['delete']('/:id',auth[_0x519f('0xa')](),controller[_0x519f('0x14')]);module[_0x519f('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d8d9c30..4cd77b8 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xd5160a,_0x572c4b){var _0x576cf9=function(_0xa95da6){while(--_0xa95da6){_0xd5160a['push'](_0xd5160a['shift']());}};_0x576cf9(++_0x572c4b);}(_0x008c,0x188));var _0xc008=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x008c[_0x338338];return _0x3cf852;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1ec7aa,_0x2506df){var _0x4bafb7=function(_0x5ec3bc){while(--_0x5ec3bc){_0x1ec7aa['push'](_0x1ec7aa['shift']());}};_0x4bafb7(++_0x2506df);}(_0x008c,0x188));var _0xc008=function(_0x3b06f1,_0x2c2f9a){_0x3b06f1=_0x3b06f1-0x0;var _0x1ab7fd=_0x008c[_0x3b06f1];return _0x1ab7fd;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 128b241..43a9b05 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 _0x1b60=['json','reject','save','update','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','length','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set'];(function(_0x44efe8,_0x467b83){var _0x29659d=function(_0x15dd7d){while(--_0x15dd7d){_0x44efe8['push'](_0x44efe8['shift']());}};_0x29659d(++_0x467b83);}(_0x1b60,0x1a1));var _0x01b6=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x1b60[_0x25bca6];return _0x3f8d02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b6('0x0'));var zipdir=require(_0x01b6('0x1'));var jsonpatch=require(_0x01b6('0x2'));var rp=require(_0x01b6('0x3'));var moment=require(_0x01b6('0x4'));var BPromise=require(_0x01b6('0x5'));var Mustache=require(_0x01b6('0x6'));var util=require(_0x01b6('0x7'));var path=require('path');var sox=require(_0x01b6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01b6('0x9'));var squel=require(_0x01b6('0xa'));var crypto=require(_0x01b6('0xb'));var jsforce=require(_0x01b6('0xc'));var deskjs=require(_0x01b6('0xd'));var toCsv=require(_0x01b6('0xe'));var querystring=require(_0x01b6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01b6('0x10'));var qs=require(_0x01b6('0x11'));var as=require(_0x01b6('0x12'));var hardwareService=require(_0x01b6('0x13'));var logger=require(_0x01b6('0x14'))('api');var utils=require(_0x01b6('0x15'));var config=require(_0x01b6('0x16'));var licenseUtil=require(_0x01b6('0x17'));var db=require(_0x01b6('0x18'))['db'];function respondWithStatusCode(_0x19ac6c,_0x3945cb){_0x3945cb=_0x3945cb||0xcc;return function(_0x1c6e12){if(_0x1c6e12){return _0x19ac6c[_0x01b6('0x19')](_0x3945cb);}return _0x19ac6c[_0x01b6('0x1a')](_0x3945cb)[_0x01b6('0x1b')]();};}function respondWithResult(_0x1e2259,_0x2bb815){_0x2bb815=_0x2bb815||0xc8;return function(_0x4e8c23){if(_0x4e8c23){return _0x1e2259['status'](_0x2bb815)['json'](_0x4e8c23);}};}function respondWithFilteredResult(_0x4290ba,_0x1f883d){return function(_0x30cdc9){if(_0x30cdc9){var _0x2850d4=typeof _0x1f883d[_0x01b6('0x1c')]==='undefined'&&typeof _0x1f883d[_0x01b6('0x1d')]===_0x01b6('0x1e');var _0x331597=_0x30cdc9[_0x01b6('0x1f')];var _0x28e0ba=_0x2850d4?0x0:_0x1f883d['offset'];var _0x1c0ba4=_0x2850d4?_0x30cdc9['count']:_0x1f883d[_0x01b6('0x1c')]+_0x1f883d[_0x01b6('0x1d')];var _0x45c08c;if(_0x1c0ba4>=_0x331597){_0x1c0ba4=_0x331597;_0x45c08c=0xc8;}else{_0x45c08c=0xce;}_0x4290ba[_0x01b6('0x1a')](_0x45c08c);return _0x4290ba[_0x01b6('0x20')]('Content-Range',_0x28e0ba+'-'+_0x1c0ba4+'/'+_0x331597)[_0x01b6('0x21')](_0x30cdc9);}return null;};}function patchUpdates(_0xb1c325){return function(_0x2f374b){try{jsonpatch['apply'](_0x2f374b,_0xb1c325,!![]);}catch(_0x1c0944){return BPromise[_0x01b6('0x22')](_0x1c0944);}return _0x2f374b[_0x01b6('0x23')]();};}function saveUpdates(_0x4e253c,_0x509876){return function(_0x1530c1){if(_0x1530c1){return _0x1530c1[_0x01b6('0x24')](_0x4e253c)[_0x01b6('0x25')](function(_0x5c5d5e){return _0x5c5d5e;});}return null;};}function removeEntity(_0x58dca6,_0xd78ccd){return function(_0x57348b){if(_0x57348b){return _0x57348b['destroy']()[_0x01b6('0x25')](function(){_0x58dca6['status'](0xcc)[_0x01b6('0x1b')]();});}};}function handleEntityNotFound(_0x160522,_0x28fa8f){return function(_0x1334c1){if(!_0x1334c1){_0x160522[_0x01b6('0x19')](0x194);}return _0x1334c1;};}function handleError(_0x53fa1e,_0x57b510){_0x57b510=_0x57b510||0x1f4;return function(_0x5f6b3){logger[_0x01b6('0x26')](_0x5f6b3[_0x01b6('0x27')]);if(_0x5f6b3[_0x01b6('0x28')]){delete _0x5f6b3['name'];}_0x53fa1e['status'](_0x57b510)[_0x01b6('0x29')](_0x5f6b3);};}exports[_0x01b6('0x2a')]=function(_0x58c2af,_0x29f25c){var _0x39980f={},_0x429f5={},_0x3f81e1={'count':0x0,'rows':[]};var _0x1da8ac=_['map'](db[_0x01b6('0x2b')][_0x01b6('0x2c')],function(_0x1267e0){return{'name':_0x1267e0['fieldName'],'type':_0x1267e0[_0x01b6('0x2d')][_0x01b6('0x2e')]};});_0x429f5['model']=_[_0x01b6('0x2f')](_0x1da8ac,_0x01b6('0x28'));_0x429f5[_0x01b6('0x30')]=_[_0x01b6('0x31')](_0x58c2af[_0x01b6('0x30')]);_0x429f5['filters']=_[_0x01b6('0x32')](_0x429f5[_0x01b6('0x33')],_0x429f5[_0x01b6('0x30')]);_0x39980f['attributes']=_[_0x01b6('0x32')](_0x429f5[_0x01b6('0x33')],qs['fields'](_0x58c2af[_0x01b6('0x30')][_0x01b6('0x34')]));_0x39980f['attributes']=_0x39980f[_0x01b6('0x35')]['length']?_0x39980f[_0x01b6('0x35')]:_0x429f5[_0x01b6('0x33')];if(!_0x58c2af['query'][_0x01b6('0x36')](_0x01b6('0x37'))){_0x39980f[_0x01b6('0x1d')]=qs[_0x01b6('0x1d')](_0x58c2af[_0x01b6('0x30')]['limit']);_0x39980f[_0x01b6('0x1c')]=qs[_0x01b6('0x1c')](_0x58c2af[_0x01b6('0x30')][_0x01b6('0x1c')]);}_0x39980f['order']=qs[_0x01b6('0x38')](_0x58c2af[_0x01b6('0x30')][_0x01b6('0x38')]);_0x39980f[_0x01b6('0x39')]=qs[_0x01b6('0x3a')](_[_0x01b6('0x3b')](_0x58c2af[_0x01b6('0x30')],_0x429f5['filters']),_0x1da8ac);if(_0x58c2af[_0x01b6('0x30')][_0x01b6('0x3c')]){_0x39980f[_0x01b6('0x39')]=_[_0x01b6('0x3d')](_0x39980f[_0x01b6('0x39')],{'$or':_[_0x01b6('0x2f')](_0x1da8ac,function(_0x99646){if(_0x99646[_0x01b6('0x2d')]!==_0x01b6('0x3e')){var _0x36e9a2={};_0x36e9a2[_0x99646[_0x01b6('0x28')]]={'$like':'%'+_0x58c2af[_0x01b6('0x30')][_0x01b6('0x3c')]+'%'};return _0x36e9a2;}})});}_0x39980f=_[_0x01b6('0x3d')]({},_0x39980f,_0x58c2af['options']);var _0x17b7e1={'where':_0x39980f['where']};return db['OpenchannelTransferReport']['count'](_0x17b7e1)[_0x01b6('0x25')](function(_0x32efb1){_0x3f81e1[_0x01b6('0x1f')]=_0x32efb1;if(_0x58c2af[_0x01b6('0x30')][_0x01b6('0x3f')]){_0x39980f['include']=[{'all':!![]}];}return db[_0x01b6('0x2b')]['findAll'](_0x39980f);})['then'](function(_0x523cfe){_0x3f81e1[_0x01b6('0x40')]=_0x523cfe;return _0x3f81e1;})[_0x01b6('0x25')](respondWithFilteredResult(_0x29f25c,_0x39980f))[_0x01b6('0x41')](handleError(_0x29f25c,null));};exports[_0x01b6('0x42')]=function(_0x479629,_0x47a4eb){var _0x2e472c={'raw':!![],'where':{'id':_0x479629[_0x01b6('0x43')]['id']}},_0x464227={};_0x464227['model']=_['keys'](db[_0x01b6('0x2b')][_0x01b6('0x2c')]);_0x464227[_0x01b6('0x30')]=_['keys'](_0x479629[_0x01b6('0x30')]);_0x464227[_0x01b6('0x3a')]=_[_0x01b6('0x32')](_0x464227[_0x01b6('0x33')],_0x464227[_0x01b6('0x30')]);_0x2e472c[_0x01b6('0x35')]=_[_0x01b6('0x32')](_0x464227[_0x01b6('0x33')],qs['fields'](_0x479629[_0x01b6('0x30')][_0x01b6('0x34')]));_0x2e472c[_0x01b6('0x35')]=_0x2e472c[_0x01b6('0x35')][_0x01b6('0x44')]?_0x2e472c[_0x01b6('0x35')]:_0x464227['model'];if(_0x479629[_0x01b6('0x30')]['includeAll']){_0x2e472c[_0x01b6('0x45')]=[{'all':!![]}];}_0x2e472c=_[_0x01b6('0x3d')]({},_0x2e472c,_0x479629[_0x01b6('0x46')]);return db[_0x01b6('0x2b')][_0x01b6('0x47')](_0x2e472c)[_0x01b6('0x25')](handleEntityNotFound(_0x47a4eb,null))[_0x01b6('0x25')](respondWithResult(_0x47a4eb,null))['catch'](handleError(_0x47a4eb,null));};exports['create']=function(_0x41af13,_0x27b418){return db[_0x01b6('0x2b')][_0x01b6('0x48')](_0x41af13[_0x01b6('0x49')],{})['then'](respondWithResult(_0x27b418,0xc9))['catch'](handleError(_0x27b418,null));};exports[_0x01b6('0x24')]=function(_0x49cf1a,_0x2af8d3){if(_0x49cf1a['body']['id']){delete _0x49cf1a['body']['id'];}return db[_0x01b6('0x2b')]['find']({'where':{'id':_0x49cf1a[_0x01b6('0x43')]['id']}})['then'](handleEntityNotFound(_0x2af8d3,null))[_0x01b6('0x25')](saveUpdates(_0x49cf1a[_0x01b6('0x49')],null))[_0x01b6('0x25')](respondWithResult(_0x2af8d3,null))[_0x01b6('0x41')](handleError(_0x2af8d3,null));};exports['destroy']=function(_0x476292,_0xac2ecd){return db['OpenchannelTransferReport'][_0x01b6('0x47')]({'where':{'id':_0x476292[_0x01b6('0x43')]['id']}})[_0x01b6('0x25')](handleEntityNotFound(_0xac2ecd,null))[_0x01b6('0x25')](removeEntity(_0xac2ecd,null))[_0x01b6('0x41')](handleError(_0xac2ecd,null));};exports['describe']=function(_0x465b86,_0x412483){return db[_0x01b6('0x2b')][_0x01b6('0x4a')]()[_0x01b6('0x25')](respondWithResult(_0x412483,null))['catch'](handleError(_0x412483,null));}; \ No newline at end of file +var _0x198c=['body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','length','options','find'];(function(_0x21eb53,_0x53849f){var _0x7f69d3=function(_0x3b9c40){while(--_0x3b9c40){_0x21eb53['push'](_0x21eb53['shift']());}};_0x7f69d3(++_0x53849f);}(_0x198c,0x16a));var _0xc198=function(_0x2e1c79,_0x5e51dd){_0x2e1c79=_0x2e1c79-0x0;var _0x355e50=_0x198c[_0x2e1c79];return _0x355e50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc198('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc198('0x1'));var rp=require(_0xc198('0x2'));var moment=require(_0xc198('0x3'));var BPromise=require(_0xc198('0x4'));var Mustache=require(_0xc198('0x5'));var util=require(_0xc198('0x6'));var path=require(_0xc198('0x7'));var sox=require('sox');var csv=require(_0xc198('0x8'));var ejs=require(_0xc198('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc198('0xa'));var squel=require(_0xc198('0xb'));var crypto=require(_0xc198('0xc'));var jsforce=require(_0xc198('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc198('0x8'));var querystring=require('querystring');var Papa=require(_0xc198('0xe'));var Redis=require(_0xc198('0xf'));var authService=require(_0xc198('0x10'));var qs=require(_0xc198('0x11'));var as=require(_0xc198('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc198('0x13'))('api');var utils=require(_0xc198('0x14'));var config=require(_0xc198('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc198('0x16'))['db'];function respondWithStatusCode(_0x50e444,_0x1c0938){_0x1c0938=_0x1c0938||0xcc;return function(_0x226f24){if(_0x226f24){return _0x50e444[_0xc198('0x17')](_0x1c0938);}return _0x50e444[_0xc198('0x18')](_0x1c0938)[_0xc198('0x19')]();};}function respondWithResult(_0x4358aa,_0x4fdaf5){_0x4fdaf5=_0x4fdaf5||0xc8;return function(_0x412817){if(_0x412817){return _0x4358aa[_0xc198('0x18')](_0x4fdaf5)[_0xc198('0x1a')](_0x412817);}};}function respondWithFilteredResult(_0x471eea,_0x422995){return function(_0x3a42b5){if(_0x3a42b5){var _0x475882=typeof _0x422995['offset']===_0xc198('0x1b')&&typeof _0x422995['limit']==='undefined';var _0x5a93f2=_0x3a42b5[_0xc198('0x1c')];var _0x3e0f24=_0x475882?0x0:_0x422995[_0xc198('0x1d')];var _0x11a395=_0x475882?_0x3a42b5[_0xc198('0x1c')]:_0x422995[_0xc198('0x1d')]+_0x422995[_0xc198('0x1e')];var _0x446cd6;if(_0x11a395>=_0x5a93f2){_0x11a395=_0x5a93f2;_0x446cd6=0xc8;}else{_0x446cd6=0xce;}_0x471eea[_0xc198('0x18')](_0x446cd6);return _0x471eea['set']('Content-Range',_0x3e0f24+'-'+_0x11a395+'/'+_0x5a93f2)[_0xc198('0x1a')](_0x3a42b5);}return null;};}function patchUpdates(_0x5dbfbe){return function(_0x59c070){try{jsonpatch[_0xc198('0x1f')](_0x59c070,_0x5dbfbe,!![]);}catch(_0x38c98a){return BPromise[_0xc198('0x20')](_0x38c98a);}return _0x59c070[_0xc198('0x21')]();};}function saveUpdates(_0x5c7043,_0x105b53){return function(_0x4de58a){if(_0x4de58a){return _0x4de58a[_0xc198('0x22')](_0x5c7043)[_0xc198('0x23')](function(_0x25c549){return _0x25c549;});}return null;};}function removeEntity(_0x5c152a,_0x5b667c){return function(_0x36dd8c){if(_0x36dd8c){return _0x36dd8c[_0xc198('0x24')]()[_0xc198('0x23')](function(){_0x5c152a[_0xc198('0x18')](0xcc)[_0xc198('0x19')]();});}};}function handleEntityNotFound(_0x360f4f,_0x403cde){return function(_0x177815){if(!_0x177815){_0x360f4f['sendStatus'](0x194);}return _0x177815;};}function handleError(_0x183a8f,_0x5af501){_0x5af501=_0x5af501||0x1f4;return function(_0x3fc7be){logger['error'](_0x3fc7be[_0xc198('0x25')]);if(_0x3fc7be[_0xc198('0x26')]){delete _0x3fc7be[_0xc198('0x26')];}_0x183a8f['status'](_0x5af501)[_0xc198('0x27')](_0x3fc7be);};}exports[_0xc198('0x28')]=function(_0x21ed19,_0x110bbc){var _0xa199ab={},_0x16aae1={},_0x1417b0={'count':0x0,'rows':[]};var _0x4536b7=_[_0xc198('0x29')](db[_0xc198('0x2a')][_0xc198('0x2b')],function(_0x54caf6){return{'name':_0x54caf6[_0xc198('0x2c')],'type':_0x54caf6[_0xc198('0x2d')][_0xc198('0x2e')]};});_0x16aae1['model']=_[_0xc198('0x29')](_0x4536b7,_0xc198('0x26'));_0x16aae1[_0xc198('0x2f')]=_[_0xc198('0x30')](_0x21ed19[_0xc198('0x2f')]);_0x16aae1[_0xc198('0x31')]=_[_0xc198('0x32')](_0x16aae1[_0xc198('0x33')],_0x16aae1[_0xc198('0x2f')]);_0xa199ab[_0xc198('0x34')]=_[_0xc198('0x32')](_0x16aae1[_0xc198('0x33')],qs['fields'](_0x21ed19[_0xc198('0x2f')][_0xc198('0x35')]));_0xa199ab[_0xc198('0x34')]=_0xa199ab['attributes']['length']?_0xa199ab['attributes']:_0x16aae1[_0xc198('0x33')];if(!_0x21ed19[_0xc198('0x2f')][_0xc198('0x36')](_0xc198('0x37'))){_0xa199ab[_0xc198('0x1e')]=qs[_0xc198('0x1e')](_0x21ed19[_0xc198('0x2f')][_0xc198('0x1e')]);_0xa199ab['offset']=qs[_0xc198('0x1d')](_0x21ed19['query']['offset']);}_0xa199ab['order']=qs['sort'](_0x21ed19['query'][_0xc198('0x38')]);_0xa199ab[_0xc198('0x39')]=qs[_0xc198('0x31')](_['pick'](_0x21ed19[_0xc198('0x2f')],_0x16aae1[_0xc198('0x31')]),_0x4536b7);if(_0x21ed19[_0xc198('0x2f')][_0xc198('0x3a')]){_0xa199ab['where']=_['merge'](_0xa199ab[_0xc198('0x39')],{'$or':_[_0xc198('0x29')](_0x4536b7,function(_0x372c3f){if(_0x372c3f[_0xc198('0x2d')]!==_0xc198('0x3b')){var _0x57dac9={};_0x57dac9[_0x372c3f[_0xc198('0x26')]]={'$like':'%'+_0x21ed19[_0xc198('0x2f')][_0xc198('0x3a')]+'%'};return _0x57dac9;}})});}_0xa199ab=_[_0xc198('0x3c')]({},_0xa199ab,_0x21ed19['options']);var _0x41aeca={'where':_0xa199ab[_0xc198('0x39')]};return db['OpenchannelTransferReport'][_0xc198('0x1c')](_0x41aeca)['then'](function(_0x55ab5b){_0x1417b0['count']=_0x55ab5b;if(_0x21ed19[_0xc198('0x2f')][_0xc198('0x3d')]){_0xa199ab[_0xc198('0x3e')]=[{'all':!![]}];}return db[_0xc198('0x2a')][_0xc198('0x3f')](_0xa199ab);})[_0xc198('0x23')](function(_0x5446c8){_0x1417b0[_0xc198('0x40')]=_0x5446c8;return _0x1417b0;})[_0xc198('0x23')](respondWithFilteredResult(_0x110bbc,_0xa199ab))[_0xc198('0x41')](handleError(_0x110bbc,null));};exports['show']=function(_0x221e1f,_0x56d834){var _0x43950d={'raw':!![],'where':{'id':_0x221e1f[_0xc198('0x42')]['id']}},_0x477abb={};_0x477abb[_0xc198('0x33')]=_[_0xc198('0x30')](db[_0xc198('0x2a')][_0xc198('0x2b')]);_0x477abb['query']=_[_0xc198('0x30')](_0x221e1f[_0xc198('0x2f')]);_0x477abb['filters']=_[_0xc198('0x32')](_0x477abb['model'],_0x477abb[_0xc198('0x2f')]);_0x43950d['attributes']=_[_0xc198('0x32')](_0x477abb[_0xc198('0x33')],qs['fields'](_0x221e1f['query'][_0xc198('0x35')]));_0x43950d[_0xc198('0x34')]=_0x43950d[_0xc198('0x34')][_0xc198('0x43')]?_0x43950d[_0xc198('0x34')]:_0x477abb[_0xc198('0x33')];if(_0x221e1f['query'][_0xc198('0x3d')]){_0x43950d['include']=[{'all':!![]}];}_0x43950d=_[_0xc198('0x3c')]({},_0x43950d,_0x221e1f[_0xc198('0x44')]);return db[_0xc198('0x2a')][_0xc198('0x45')](_0x43950d)[_0xc198('0x23')](handleEntityNotFound(_0x56d834,null))[_0xc198('0x23')](respondWithResult(_0x56d834,null))['catch'](handleError(_0x56d834,null));};exports['create']=function(_0x3d017f,_0x43cf7a){return db['OpenchannelTransferReport']['create'](_0x3d017f['body'],{})[_0xc198('0x23')](respondWithResult(_0x43cf7a,0xc9))[_0xc198('0x41')](handleError(_0x43cf7a,null));};exports[_0xc198('0x22')]=function(_0x1eccfe,_0x2388f1){if(_0x1eccfe[_0xc198('0x46')]['id']){delete _0x1eccfe[_0xc198('0x46')]['id'];}return db[_0xc198('0x2a')][_0xc198('0x45')]({'where':{'id':_0x1eccfe[_0xc198('0x42')]['id']}})[_0xc198('0x23')](handleEntityNotFound(_0x2388f1,null))[_0xc198('0x23')](saveUpdates(_0x1eccfe['body'],null))[_0xc198('0x23')](respondWithResult(_0x2388f1,null))[_0xc198('0x41')](handleError(_0x2388f1,null));};exports[_0xc198('0x24')]=function(_0x81f56f,_0x511cff){return db[_0xc198('0x2a')]['find']({'where':{'id':_0x81f56f[_0xc198('0x42')]['id']}})['then'](handleEntityNotFound(_0x511cff,null))['then'](removeEntity(_0x511cff,null))[_0xc198('0x41')](handleError(_0x511cff,null));};exports[_0xc198('0x47')]=function(_0x3e11aa,_0x35be4f){return db[_0xc198('0x2a')]['describe']()[_0xc198('0x23')](respondWithResult(_0x35be4f,null))[_0xc198('0x41')](handleError(_0x35be4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e40d4d5..4bd0f9e 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 _0x31ca=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4a0387,_0x17f9e5){var _0xb3c940=function(_0xf0e49b){while(--_0xf0e49b){_0x4a0387['push'](_0x4a0387['shift']());}};_0xb3c940(++_0x17f9e5);}(_0x31ca,0xff));var _0xa31c=function(_0x59054b,_0x435fc7){_0x59054b=_0x59054b-0x0;var _0x51995c=_0x31ca[_0x59054b];return _0x51995c;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var logger=require(_0xa31c('0x2'))(_0xa31c('0x3'));var moment=require('moment');var BPromise=require(_0xa31c('0x4'));var rp=require(_0xa31c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa31c('0x6'));var config=require(_0xa31c('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xa31c('0x8')]=function(_0xe86c6a,_0x545b32){return _0xe86c6a['define']('OpenchannelTransferReport',attributes,{'tableName':_0xa31c('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa31c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb171=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3b17ce,_0x349e8a){var _0x9f6a7c=function(_0x292c21){while(--_0x292c21){_0x3b17ce['push'](_0x3b17ce['shift']());}};_0x9f6a7c(++_0x349e8a);}(_0xb171,0xcb));var _0x1b17=function(_0x58939f,_0x171fc1){_0x58939f=_0x58939f-0x0;var _0x3b0653=_0xb171[_0x58939f];return _0x3b0653;};'use strict';var _=require(_0x1b17('0x0'));var util=require(_0x1b17('0x1'));var logger=require(_0x1b17('0x2'))('api');var moment=require(_0x1b17('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b17('0x4'));var fs=require('fs');var path=require(_0x1b17('0x5'));var rimraf=require(_0x1b17('0x6'));var config=require(_0x1b17('0x7'));var attributes=require(_0x1b17('0x8'));module[_0x1b17('0x9')]=function(_0x39ff96,_0x3895c8){return _0x39ff96[_0x1b17('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x1b17('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1b17('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index bcaf06b..0b9fcfe 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 _0x7f42=['message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21343f,_0x360b84){var _0x191d29=function(_0x299852){while(--_0x299852){_0x21343f['push'](_0x21343f['shift']());}};_0x191d29(++_0x360b84);}(_0x7f42,0x1dd));var _0x27f4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f42[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var moment=require(_0x27f4('0x1'));var BPromise=require(_0x27f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27f4('0x4'));var logger=require('../../config/logger')(_0x27f4('0x5'));var config=require('../../config/environment');var jayson=require(_0x27f4('0x6'));var client=jayson['client'][_0x27f4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a85f2,_0xd283e2,_0x3010e3){return new BPromise(function(_0x2a4b6f,_0x9bc56e){return client[_0x27f4('0x8')](_0x1a85f2,_0x3010e3)[_0x27f4('0x9')](function(_0xe67021){logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));logger[_0x27f4('0xd')](_0x27f4('0xe'),_0xd283e2,_0x27f4('0xc'),JSON[_0x27f4('0xf')](_0xe67021));if(_0xe67021[_0x27f4('0x10')]){if(_0xe67021[_0x27f4('0x10')]['code']===0x1f4){logger['error'](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);return _0x9bc56e(_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);}logger[_0x27f4('0x10')](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')]['message']);return _0x2a4b6f(_0xe67021['error'][_0x27f4('0x11')]);}else{logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));_0x2a4b6f(_0xe67021['result'][_0x27f4('0x11')]);}})[_0x27f4('0x12')](function(_0x321821){logger['error'](_0x27f4('0xb'),_0xd283e2,_0x321821);_0x9bc56e(_0x321821);});});} \ No newline at end of file +var _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x425093,_0x49fda0){var _0x393f8c=function(_0x5a0a34){while(--_0x5a0a34){_0x425093['push'](_0x425093['shift']());}};_0x393f8c(++_0x49fda0);}(_0xf006,0x146));var _0x6f00=function(_0x10ee3a,_0x2b63d3){_0x10ee3a=_0x10ee3a-0x0;var _0xe09eb=_0xf006[_0x10ee3a];return _0xe09eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index dfe007a..a9c911c 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 _0x7f97=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','/:id','show','post','create','put','update','exports','util'];(function(_0x9bbba1,_0x226ad9){var _0x66fbf4=function(_0x184e4c){while(--_0x184e4c){_0x9bbba1['push'](_0x9bbba1['shift']());}};_0x66fbf4(++_0x226ad9);}(_0x7f97,0x11f));var _0x77f9=function(_0x5e9bd3,_0x17b7c9){_0x5e9bd3=_0x5e9bd3-0x0;var _0x24acc1=_0x7f97[_0x5e9bd3];return _0x24acc1;};'use strict';var multer=require('multer');var util=require(_0x77f9('0x0'));var path=require('path');var timeout=require(_0x77f9('0x1'));var express=require(_0x77f9('0x2'));var router=express[_0x77f9('0x3')]();var fs_extra=require(_0x77f9('0x4'));var auth=require(_0x77f9('0x5'));var interaction=require(_0x77f9('0x6'));var config=require(_0x77f9('0x7'));var controller=require(_0x77f9('0x8'));router['get']('/',auth[_0x77f9('0x9')](),controller['index']);router[_0x77f9('0xa')](_0x77f9('0xb'),auth['isAuthenticated'](),controller[_0x77f9('0xc')]);router[_0x77f9('0xd')]('/',auth[_0x77f9('0x9')](),controller[_0x77f9('0xe')]);router[_0x77f9('0xf')](_0x77f9('0xb'),auth[_0x77f9('0x9')](),controller[_0x77f9('0x10')]);router['delete'](_0x77f9('0xb'),auth[_0x77f9('0x9')](),controller['destroy']);module[_0x77f9('0x11')]=router; \ No newline at end of file +var _0xe0fd=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xe0fd,0x1bb));var _0xde0f=function(_0x1c576e,_0x4fb85e){_0x1c576e=_0x1c576e-0x0;var _0x1171e4=_0xe0fd[_0x1c576e];return _0x1171e4;};'use strict';var multer=require(_0xde0f('0x0'));var util=require(_0xde0f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde0f('0x2'));var router=express[_0xde0f('0x3')]();var fs_extra=require(_0xde0f('0x4'));var auth=require(_0xde0f('0x5'));var interaction=require(_0xde0f('0x6'));var config=require(_0xde0f('0x7'));var controller=require(_0xde0f('0x8'));router[_0xde0f('0x9')]('/',auth[_0xde0f('0xa')](),controller[_0xde0f('0xb')]);router[_0xde0f('0x9')](_0xde0f('0xc'),auth['isAuthenticated'](),controller[_0xde0f('0xd')]);router[_0xde0f('0xe')]('/',auth[_0xde0f('0xa')](),controller['create']);router[_0xde0f('0xf')](_0xde0f('0xc'),auth[_0xde0f('0xa')](),controller['update']);router['delete'](_0xde0f('0xc'),auth[_0xde0f('0xa')](),controller[_0xde0f('0x10')]);module[_0xde0f('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 12ffb56..58d5861 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 _0xdb57=['name','exports','STRING'];(function(_0x2921e6,_0x5e5262){var _0x383c48=function(_0x497caa){while(--_0x497caa){_0x2921e6['push'](_0x2921e6['shift']());}};_0x383c48(++_0x5e5262);}(_0xdb57,0x1a5));var _0x7db5=function(_0x5eba98,_0x48365f){_0x5eba98=_0x5eba98-0x0;var _0x5e3a5b=_0xdb57[_0x5eba98];return _0x5e3a5b;};'use strict';var Sequelize=require('sequelize');module[_0x7db5('0x0')]={'name':{'type':Sequelize[_0x7db5('0x1')],'unique':_0x7db5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7db5('0x1')]}}; \ No newline at end of file +var _0xbd70=['name','exports','STRING'];(function(_0x4bce7d,_0x21ed36){var _0x24bc4d=function(_0x313d27){while(--_0x313d27){_0x4bce7d['push'](_0x4bce7d['shift']());}};_0x24bc4d(++_0x21ed36);}(_0xbd70,0x100));var _0x0bd7=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xbd70[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module[_0x0bd7('0x0')]={'name':{'type':Sequelize[_0x0bd7('0x1')],'unique':_0x0bd7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0bd7('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1472103..ef46349 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 _0x29ab=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','rawAttributes','fields','includeAll','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Pauses','UserProfileResource','destroy','name','map','Pause','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x2e1af5,_0x580163){var _0xcfe62c=function(_0x280cdc){while(--_0x280cdc){_0x2e1af5['push'](_0x2e1af5['shift']());}};_0xcfe62c(++_0x580163);}(_0x29ab,0xb6));var _0xb29a=function(_0x15a0f2,_0x26b4d4){_0x15a0f2=_0x15a0f2-0x0;var _0x5f1a32=_0x29ab[_0x15a0f2];return _0x5f1a32;};'use strict';var emlformat=require(_0xb29a('0x0'));var rimraf=require(_0xb29a('0x1'));var zipdir=require(_0xb29a('0x2'));var jsonpatch=require(_0xb29a('0x3'));var rp=require(_0xb29a('0x4'));var moment=require(_0xb29a('0x5'));var BPromise=require(_0xb29a('0x6'));var Mustache=require(_0xb29a('0x7'));var util=require(_0xb29a('0x8'));var path=require(_0xb29a('0x9'));var sox=require(_0xb29a('0xa'));var csv=require(_0xb29a('0xb'));var ejs=require(_0xb29a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb29a('0xd'));var squel=require(_0xb29a('0xe'));var crypto=require(_0xb29a('0xf'));var jsforce=require(_0xb29a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb29a('0xb'));var querystring=require('querystring');var Papa=require(_0xb29a('0x11'));var Redis=require('ioredis');var authService=require(_0xb29a('0x12'));var qs=require(_0xb29a('0x13'));var as=require(_0xb29a('0x14'));var hardwareService=require(_0xb29a('0x15'));var logger=require(_0xb29a('0x16'))(_0xb29a('0x17'));var utils=require(_0xb29a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce4df,_0x247185){_0x247185=_0x247185||0xcc;return function(_0x47300d){if(_0x47300d){return _0x5ce4df['sendStatus'](_0x247185);}return _0x5ce4df[_0xb29a('0x19')](_0x247185)[_0xb29a('0x1a')]();};}function respondWithResult(_0x119114,_0x4a85a0){_0x4a85a0=_0x4a85a0||0xc8;return function(_0x474a7f){if(_0x474a7f){return _0x119114[_0xb29a('0x19')](_0x4a85a0)[_0xb29a('0x1b')](_0x474a7f);}};}function respondWithFilteredResult(_0x10057f,_0x1498ff){return function(_0x4e3e33){if(_0x4e3e33){var _0x252f4f=typeof _0x1498ff[_0xb29a('0x1c')]===_0xb29a('0x1d')&&typeof _0x1498ff[_0xb29a('0x1e')]===_0xb29a('0x1d');var _0x4175e9=_0x4e3e33[_0xb29a('0x1f')];var _0x1a426c=_0x252f4f?0x0:_0x1498ff['offset'];var _0x1a66af=_0x252f4f?_0x4e3e33['count']:_0x1498ff['offset']+_0x1498ff[_0xb29a('0x1e')];var _0x937226;if(_0x1a66af>=_0x4175e9){_0x1a66af=_0x4175e9;_0x937226=0xc8;}else{_0x937226=0xce;}_0x10057f['status'](_0x937226);return _0x10057f['set'](_0xb29a('0x20'),_0x1a426c+'-'+_0x1a66af+'/'+_0x4175e9)[_0xb29a('0x1b')](_0x4e3e33);}return null;};}function patchUpdates(_0x1c7285){return function(_0x2aaef8){try{jsonpatch[_0xb29a('0x21')](_0x2aaef8,_0x1c7285,!![]);}catch(_0x52d8ef){return BPromise[_0xb29a('0x22')](_0x52d8ef);}return _0x2aaef8[_0xb29a('0x23')]();};}function saveUpdates(_0x1e3c03,_0x5e51e0){return function(_0x94e1fc){if(_0x94e1fc){return _0x94e1fc['update'](_0x1e3c03)[_0xb29a('0x24')](function(_0x4a7199){return _0x4a7199;});}return null;};}function removeEntity(_0x5d7be7,_0x481f34){return function(_0xe6b2e9){if(_0xe6b2e9){return _0xe6b2e9['destroy']()[_0xb29a('0x24')](function(){var _0x53d642=_0xe6b2e9[_0xb29a('0x25')]({'plain':!![]});var _0xe6ed83=_0xb29a('0x26');return db[_0xb29a('0x27')][_0xb29a('0x28')]({'where':{'type':_0xe6ed83,'resourceId':_0x53d642['id']}})[_0xb29a('0x24')](function(){return _0xe6b2e9;});})[_0xb29a('0x24')](function(){_0x5d7be7['status'](0xcc)[_0xb29a('0x1a')]();});}};}function handleEntityNotFound(_0x48c472,_0x4d28fe){return function(_0x111c81){if(!_0x111c81){_0x48c472['sendStatus'](0x194);}return _0x111c81;};}function handleError(_0x11adba,_0x2e496a){_0x2e496a=_0x2e496a||0x1f4;return function(_0x2117bf){logger['error'](_0x2117bf['stack']);if(_0x2117bf['name']){delete _0x2117bf[_0xb29a('0x29')];}_0x11adba[_0xb29a('0x19')](_0x2e496a)['send'](_0x2117bf);};}exports['index']=function(_0x241cd2,_0x3942d9){var _0x73f6d9={},_0x5627a5={},_0x2769ca={'count':0x0,'rows':[]};var _0x5c6350=_[_0xb29a('0x2a')](db[_0xb29a('0x2b')]['rawAttributes'],function(_0x21c549){return{'name':_0x21c549[_0xb29a('0x2c')],'type':_0x21c549[_0xb29a('0x2d')]['key']};});_0x5627a5[_0xb29a('0x2e')]=_['map'](_0x5c6350,'name');_0x5627a5['query']=_[_0xb29a('0x2f')](_0x241cd2[_0xb29a('0x30')]);_0x5627a5[_0xb29a('0x31')]=_[_0xb29a('0x32')](_0x5627a5[_0xb29a('0x2e')],_0x5627a5[_0xb29a('0x30')]);_0x73f6d9[_0xb29a('0x33')]=_[_0xb29a('0x32')](_0x5627a5[_0xb29a('0x2e')],qs['fields'](_0x241cd2[_0xb29a('0x30')]['fields']));_0x73f6d9[_0xb29a('0x33')]=_0x73f6d9[_0xb29a('0x33')]['length']?_0x73f6d9['attributes']:_0x5627a5[_0xb29a('0x2e')];if(!_0x241cd2['query'][_0xb29a('0x34')](_0xb29a('0x35'))){_0x73f6d9[_0xb29a('0x1e')]=qs[_0xb29a('0x1e')](_0x241cd2['query']['limit']);_0x73f6d9[_0xb29a('0x1c')]=qs['offset'](_0x241cd2[_0xb29a('0x30')][_0xb29a('0x1c')]);}_0x73f6d9[_0xb29a('0x36')]=qs['sort'](_0x241cd2[_0xb29a('0x30')][_0xb29a('0x37')]);_0x73f6d9[_0xb29a('0x38')]=qs[_0xb29a('0x31')](_[_0xb29a('0x39')](_0x241cd2[_0xb29a('0x30')],_0x5627a5['filters']),_0x5c6350);if(_0x241cd2[_0xb29a('0x30')][_0xb29a('0x3a')]){_0x73f6d9[_0xb29a('0x38')]=_[_0xb29a('0x3b')](_0x73f6d9[_0xb29a('0x38')],{'$or':_[_0xb29a('0x2a')](_0x5c6350,function(_0x10f2b4){if(_0x10f2b4['type']!=='VIRTUAL'){var _0x5e57e1={};_0x5e57e1[_0x10f2b4[_0xb29a('0x29')]]={'$like':'%'+_0x241cd2[_0xb29a('0x30')][_0xb29a('0x3a')]+'%'};return _0x5e57e1;}})});}_0x73f6d9=_['merge']({},_0x73f6d9,_0x241cd2[_0xb29a('0x3c')]);var _0xb46765={'where':_0x73f6d9[_0xb29a('0x38')]};return db['Pause'][_0xb29a('0x1f')](_0xb46765)[_0xb29a('0x24')](function(_0x465ef3){_0x2769ca['count']=_0x465ef3;if(_0x241cd2[_0xb29a('0x30')]['includeAll']){_0x73f6d9['include']=[{'all':!![]}];}return db[_0xb29a('0x2b')][_0xb29a('0x3d')](_0x73f6d9);})[_0xb29a('0x24')](function(_0x28207e){_0x2769ca['rows']=_0x28207e;return _0x2769ca;})[_0xb29a('0x24')](respondWithFilteredResult(_0x3942d9,_0x73f6d9))[_0xb29a('0x3e')](handleError(_0x3942d9,null));};exports[_0xb29a('0x3f')]=function(_0x52f3b2,_0x5a25db){var _0x5c65a5={'raw':!![],'where':{'id':_0x52f3b2[_0xb29a('0x40')]['id']}},_0x5d8292={};_0x5d8292[_0xb29a('0x2e')]=_[_0xb29a('0x2f')](db[_0xb29a('0x2b')][_0xb29a('0x41')]);_0x5d8292[_0xb29a('0x30')]=_[_0xb29a('0x2f')](_0x52f3b2['query']);_0x5d8292[_0xb29a('0x31')]=_['intersection'](_0x5d8292[_0xb29a('0x2e')],_0x5d8292[_0xb29a('0x30')]);_0x5c65a5['attributes']=_[_0xb29a('0x32')](_0x5d8292[_0xb29a('0x2e')],qs[_0xb29a('0x42')](_0x52f3b2['query'][_0xb29a('0x42')]));_0x5c65a5[_0xb29a('0x33')]=_0x5c65a5[_0xb29a('0x33')]['length']?_0x5c65a5[_0xb29a('0x33')]:_0x5d8292[_0xb29a('0x2e')];if(_0x52f3b2[_0xb29a('0x30')][_0xb29a('0x43')]){_0x5c65a5[_0xb29a('0x44')]=[{'all':!![]}];}_0x5c65a5=_[_0xb29a('0x3b')]({},_0x5c65a5,_0x52f3b2['options']);return db[_0xb29a('0x2b')]['find'](_0x5c65a5)[_0xb29a('0x24')](handleEntityNotFound(_0x5a25db,null))[_0xb29a('0x24')](respondWithResult(_0x5a25db,null))[_0xb29a('0x3e')](handleError(_0x5a25db,null));};exports[_0xb29a('0x45')]=function(_0x35450e,_0x41594c){return db['Pause'][_0xb29a('0x45')](_0x35450e[_0xb29a('0x46')],{})['then'](function(_0x3a71e7){var _0x2331c6=_0x35450e[_0xb29a('0x47')][_0xb29a('0x25')]({'plain':!![]});if(!_0x2331c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2331c6[_0xb29a('0x48')]===_0xb29a('0x47')){var _0x51fc44=_0x3a71e7[_0xb29a('0x25')]({'plain':!![]});var _0x53cd35=_0xb29a('0x26');return db[_0xb29a('0x49')][_0xb29a('0x4a')]({'where':{'name':_0x53cd35,'userProfileId':_0x2331c6[_0xb29a('0x4b')]},'raw':!![]})[_0xb29a('0x24')](function(_0xa9dad2){if(_0xa9dad2&&_0xa9dad2[_0xb29a('0x4c')]===0x0){return db[_0xb29a('0x27')]['create']({'name':_0x51fc44[_0xb29a('0x29')],'resourceId':_0x51fc44['id'],'type':_0xa9dad2[_0xb29a('0x29')],'sectionId':_0xa9dad2['id']},{})['then'](function(){return _0x3a71e7;});}else{return _0x3a71e7;}})[_0xb29a('0x3e')](function(_0x231c91){logger[_0xb29a('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x231c91);throw _0x231c91;});}return _0x3a71e7;})[_0xb29a('0x24')](respondWithResult(_0x41594c,0xc9))[_0xb29a('0x3e')](handleError(_0x41594c,null));};exports['update']=function(_0x5c0c44,_0x4fb925){if(_0x5c0c44['body']['id']){delete _0x5c0c44[_0xb29a('0x46')]['id'];}return db[_0xb29a('0x2b')][_0xb29a('0x4a')]({'where':{'id':_0x5c0c44['params']['id']}})['then'](handleEntityNotFound(_0x4fb925,null))[_0xb29a('0x24')](saveUpdates(_0x5c0c44[_0xb29a('0x46')],null))[_0xb29a('0x24')](respondWithResult(_0x4fb925,null))[_0xb29a('0x3e')](handleError(_0x4fb925,null));};exports[_0xb29a('0x28')]=function(_0x21afc5,_0x38d0c6){return db[_0xb29a('0x2b')][_0xb29a('0x4a')]({'where':{'id':_0x21afc5[_0xb29a('0x40')]['id']}})[_0xb29a('0x24')](handleEntityNotFound(_0x38d0c6,null))[_0xb29a('0x24')](removeEntity(_0x38d0c6,null))[_0xb29a('0x3e')](handleError(_0x38d0c6,null));}; \ No newline at end of file +var _0xf1a6=['params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','Pauses','UserProfileResource','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','includeAll','findAll','rows','catch','show'];(function(_0x1ffa2b,_0x1b4358){var _0x4604cd=function(_0x5def5c){while(--_0x5def5c){_0x1ffa2b['push'](_0x1ffa2b['shift']());}};_0x4604cd(++_0x1b4358);}(_0xf1a6,0xbd));var _0x6f1a=function(_0x33da76,_0xeeb5f7){_0x33da76=_0x33da76-0x0;var _0x279877=_0xf1a6[_0x33da76];return _0x279877;};'use strict';var emlformat=require(_0x6f1a('0x0'));var rimraf=require(_0x6f1a('0x1'));var zipdir=require(_0x6f1a('0x2'));var jsonpatch=require(_0x6f1a('0x3'));var rp=require(_0x6f1a('0x4'));var moment=require(_0x6f1a('0x5'));var BPromise=require(_0x6f1a('0x6'));var Mustache=require(_0x6f1a('0x7'));var util=require(_0x6f1a('0x8'));var path=require(_0x6f1a('0x9'));var sox=require(_0x6f1a('0xa'));var csv=require(_0x6f1a('0xb'));var ejs=require(_0x6f1a('0xc'));var fs=require('fs');var fs_extra=require(_0x6f1a('0xd'));var _=require(_0x6f1a('0xe'));var squel=require(_0x6f1a('0xf'));var crypto=require(_0x6f1a('0x10'));var jsforce=require(_0x6f1a('0x11'));var deskjs=require(_0x6f1a('0x12'));var toCsv=require(_0x6f1a('0xb'));var querystring=require(_0x6f1a('0x13'));var Papa=require(_0x6f1a('0x14'));var Redis=require('ioredis');var authService=require(_0x6f1a('0x15'));var qs=require(_0x6f1a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1a('0x17'));var logger=require(_0x6f1a('0x18'))(_0x6f1a('0x19'));var utils=require(_0x6f1a('0x1a'));var config=require(_0x6f1a('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f1a('0x1c'))['db'];function respondWithStatusCode(_0x5aba07,_0x597c25){_0x597c25=_0x597c25||0xcc;return function(_0x149f3e){if(_0x149f3e){return _0x5aba07['sendStatus'](_0x597c25);}return _0x5aba07[_0x6f1a('0x1d')](_0x597c25)[_0x6f1a('0x1e')]();};}function respondWithResult(_0x291ac5,_0xa1dfcb){_0xa1dfcb=_0xa1dfcb||0xc8;return function(_0x13684a){if(_0x13684a){return _0x291ac5['status'](_0xa1dfcb)['json'](_0x13684a);}};}function respondWithFilteredResult(_0x5548d9,_0x4e9b43){return function(_0x4f65dc){if(_0x4f65dc){var _0x549cf0=typeof _0x4e9b43[_0x6f1a('0x1f')]===_0x6f1a('0x20')&&typeof _0x4e9b43[_0x6f1a('0x21')]===_0x6f1a('0x20');var _0x2390c8=_0x4f65dc['count'];var _0x1ad8ae=_0x549cf0?0x0:_0x4e9b43[_0x6f1a('0x1f')];var _0x1ef5a5=_0x549cf0?_0x4f65dc[_0x6f1a('0x22')]:_0x4e9b43['offset']+_0x4e9b43['limit'];var _0x56ec17;if(_0x1ef5a5>=_0x2390c8){_0x1ef5a5=_0x2390c8;_0x56ec17=0xc8;}else{_0x56ec17=0xce;}_0x5548d9[_0x6f1a('0x1d')](_0x56ec17);return _0x5548d9[_0x6f1a('0x23')](_0x6f1a('0x24'),_0x1ad8ae+'-'+_0x1ef5a5+'/'+_0x2390c8)[_0x6f1a('0x25')](_0x4f65dc);}return null;};}function patchUpdates(_0x10cc1d){return function(_0x47cd54){try{jsonpatch[_0x6f1a('0x26')](_0x47cd54,_0x10cc1d,!![]);}catch(_0x553583){return BPromise[_0x6f1a('0x27')](_0x553583);}return _0x47cd54[_0x6f1a('0x28')]();};}function saveUpdates(_0x524e61,_0x50f6d0){return function(_0x22e520){if(_0x22e520){return _0x22e520['update'](_0x524e61)[_0x6f1a('0x29')](function(_0x34fea1){return _0x34fea1;});}return null;};}function removeEntity(_0x32ae83,_0xb6633){return function(_0x3ea0de){if(_0x3ea0de){return _0x3ea0de['destroy']()[_0x6f1a('0x29')](function(){var _0x986ec=_0x3ea0de[_0x6f1a('0x2a')]({'plain':!![]});var _0xb25b13=_0x6f1a('0x2b');return db[_0x6f1a('0x2c')]['destroy']({'where':{'type':_0xb25b13,'resourceId':_0x986ec['id']}})[_0x6f1a('0x29')](function(){return _0x3ea0de;});})['then'](function(){_0x32ae83[_0x6f1a('0x1d')](0xcc)[_0x6f1a('0x1e')]();});}};}function handleEntityNotFound(_0x2356dd,_0xd08f5a){return function(_0x177585){if(!_0x177585){_0x2356dd[_0x6f1a('0x2d')](0x194);}return _0x177585;};}function handleError(_0x4e8790,_0xba4624){_0xba4624=_0xba4624||0x1f4;return function(_0x29c0b6){logger[_0x6f1a('0x2e')](_0x29c0b6['stack']);if(_0x29c0b6[_0x6f1a('0x2f')]){delete _0x29c0b6[_0x6f1a('0x2f')];}_0x4e8790['status'](_0xba4624)[_0x6f1a('0x30')](_0x29c0b6);};}exports[_0x6f1a('0x31')]=function(_0x5abe3f,_0x23aced){var _0x4320c6={},_0x61e346={},_0x1e8df3={'count':0x0,'rows':[]};var _0x574ace=_[_0x6f1a('0x32')](db[_0x6f1a('0x33')][_0x6f1a('0x34')],function(_0x548d95){return{'name':_0x548d95[_0x6f1a('0x35')],'type':_0x548d95[_0x6f1a('0x36')][_0x6f1a('0x37')]};});_0x61e346[_0x6f1a('0x38')]=_[_0x6f1a('0x32')](_0x574ace,_0x6f1a('0x2f'));_0x61e346[_0x6f1a('0x39')]=_[_0x6f1a('0x3a')](_0x5abe3f['query']);_0x61e346[_0x6f1a('0x3b')]=_[_0x6f1a('0x3c')](_0x61e346[_0x6f1a('0x38')],_0x61e346['query']);_0x4320c6[_0x6f1a('0x3d')]=_['intersection'](_0x61e346[_0x6f1a('0x38')],qs[_0x6f1a('0x3e')](_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x3e')]));_0x4320c6[_0x6f1a('0x3d')]=_0x4320c6[_0x6f1a('0x3d')][_0x6f1a('0x3f')]?_0x4320c6[_0x6f1a('0x3d')]:_0x61e346[_0x6f1a('0x38')];if(!_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x40')]('nolimit')){_0x4320c6[_0x6f1a('0x21')]=qs[_0x6f1a('0x21')](_0x5abe3f[_0x6f1a('0x39')]['limit']);_0x4320c6[_0x6f1a('0x1f')]=qs['offset'](_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x1f')]);}_0x4320c6[_0x6f1a('0x41')]=qs['sort'](_0x5abe3f['query']['sort']);_0x4320c6['where']=qs['filters'](_[_0x6f1a('0x42')](_0x5abe3f['query'],_0x61e346['filters']),_0x574ace);if(_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x43')]){_0x4320c6[_0x6f1a('0x44')]=_['merge'](_0x4320c6[_0x6f1a('0x44')],{'$or':_['map'](_0x574ace,function(_0x5ab3e2){if(_0x5ab3e2[_0x6f1a('0x36')]!=='VIRTUAL'){var _0x576ab7={};_0x576ab7[_0x5ab3e2[_0x6f1a('0x2f')]]={'$like':'%'+_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x43')]+'%'};return _0x576ab7;}})});}_0x4320c6=_[_0x6f1a('0x45')]({},_0x4320c6,_0x5abe3f['options']);var _0x572c6c={'where':_0x4320c6[_0x6f1a('0x44')]};return db[_0x6f1a('0x33')]['count'](_0x572c6c)[_0x6f1a('0x29')](function(_0x357f07){_0x1e8df3[_0x6f1a('0x22')]=_0x357f07;if(_0x5abe3f[_0x6f1a('0x39')][_0x6f1a('0x46')]){_0x4320c6['include']=[{'all':!![]}];}return db['Pause'][_0x6f1a('0x47')](_0x4320c6);})[_0x6f1a('0x29')](function(_0x4b0337){_0x1e8df3[_0x6f1a('0x48')]=_0x4b0337;return _0x1e8df3;})['then'](respondWithFilteredResult(_0x23aced,_0x4320c6))[_0x6f1a('0x49')](handleError(_0x23aced,null));};exports[_0x6f1a('0x4a')]=function(_0xee5da5,_0x3995f6){var _0x4cb9f0={'raw':!![],'where':{'id':_0xee5da5[_0x6f1a('0x4b')]['id']}},_0x214538={};_0x214538[_0x6f1a('0x38')]=_[_0x6f1a('0x3a')](db[_0x6f1a('0x33')][_0x6f1a('0x34')]);_0x214538[_0x6f1a('0x39')]=_[_0x6f1a('0x3a')](_0xee5da5[_0x6f1a('0x39')]);_0x214538[_0x6f1a('0x3b')]=_[_0x6f1a('0x3c')](_0x214538[_0x6f1a('0x38')],_0x214538[_0x6f1a('0x39')]);_0x4cb9f0[_0x6f1a('0x3d')]=_['intersection'](_0x214538[_0x6f1a('0x38')],qs[_0x6f1a('0x3e')](_0xee5da5['query'][_0x6f1a('0x3e')]));_0x4cb9f0[_0x6f1a('0x3d')]=_0x4cb9f0[_0x6f1a('0x3d')][_0x6f1a('0x3f')]?_0x4cb9f0[_0x6f1a('0x3d')]:_0x214538[_0x6f1a('0x38')];if(_0xee5da5[_0x6f1a('0x39')]['includeAll']){_0x4cb9f0[_0x6f1a('0x4c')]=[{'all':!![]}];}_0x4cb9f0=_[_0x6f1a('0x45')]({},_0x4cb9f0,_0xee5da5[_0x6f1a('0x4d')]);return db[_0x6f1a('0x33')][_0x6f1a('0x4e')](_0x4cb9f0)[_0x6f1a('0x29')](handleEntityNotFound(_0x3995f6,null))[_0x6f1a('0x29')](respondWithResult(_0x3995f6,null))['catch'](handleError(_0x3995f6,null));};exports[_0x6f1a('0x4f')]=function(_0x384865,_0x32c287){return db['Pause'][_0x6f1a('0x4f')](_0x384865['body'],{})[_0x6f1a('0x29')](function(_0x3af15b){var _0x1088e7=_0x384865[_0x6f1a('0x50')][_0x6f1a('0x2a')]({'plain':!![]});if(!_0x1088e7)throw new Error(_0x6f1a('0x51'));if(_0x1088e7['role']===_0x6f1a('0x50')){var _0x1040b9=_0x3af15b['get']({'plain':!![]});var _0x1fd608=_0x6f1a('0x2b');return db[_0x6f1a('0x52')]['find']({'where':{'name':_0x1fd608,'userProfileId':_0x1088e7[_0x6f1a('0x53')]},'raw':!![]})[_0x6f1a('0x29')](function(_0x4d8354){if(_0x4d8354&&_0x4d8354['autoAssociation']===0x0){return db[_0x6f1a('0x2c')]['create']({'name':_0x1040b9[_0x6f1a('0x2f')],'resourceId':_0x1040b9['id'],'type':_0x4d8354['name'],'sectionId':_0x4d8354['id']},{})[_0x6f1a('0x29')](function(){return _0x3af15b;});}else{return _0x3af15b;}})['catch'](function(_0x3c94aa){logger['error'](_0x6f1a('0x54'),_0x3c94aa);throw _0x3c94aa;});}return _0x3af15b;})['then'](respondWithResult(_0x32c287,0xc9))['catch'](handleError(_0x32c287,null));};exports[_0x6f1a('0x55')]=function(_0x3ead7a,_0x564098){if(_0x3ead7a[_0x6f1a('0x56')]['id']){delete _0x3ead7a[_0x6f1a('0x56')]['id'];}return db[_0x6f1a('0x33')][_0x6f1a('0x4e')]({'where':{'id':_0x3ead7a[_0x6f1a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x564098,null))[_0x6f1a('0x29')](saveUpdates(_0x3ead7a[_0x6f1a('0x56')],null))[_0x6f1a('0x29')](respondWithResult(_0x564098,null))[_0x6f1a('0x49')](handleError(_0x564098,null));};exports[_0x6f1a('0x57')]=function(_0x318104,_0x1c7d8b){return db['Pause'][_0x6f1a('0x4e')]({'where':{'id':_0x318104[_0x6f1a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c7d8b,null))['then'](removeEntity(_0x1c7d8b,null))['catch'](handleError(_0x1c7d8b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 483fdb9..75ff76d 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x4bd95f,_0x62d3b6){var _0x11e471=function(_0x4bafe9){while(--_0x4bafe9){_0x4bd95f['push'](_0x4bd95f['shift']());}};_0x11e471(++_0x62d3b6);}(_0xabce,0x103));var _0xeabc=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xabce[_0x521929];return _0x632436;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x2ef519,_0x585c36){var _0x2d41a1=function(_0xbd9b84){while(--_0xbd9b84){_0x2ef519['push'](_0x2ef519['shift']());}};_0x2d41a1(++_0x585c36);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1d8928,_0x35faa0){_0x1d8928=_0x1d8928-0x0;var _0x4740ff=_0x8ef6[_0x1d8928];return _0x4740ff;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index ebb669b..4bd0e82 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(_0x4fa3c3,_0x386cca){var _0x41ce79=function(_0x1f023b){while(--_0x1f023b){_0x4fa3c3['push'](_0x4fa3c3['shift']());}};_0x41ce79(++_0x386cca);}(_0x7a54,0x106));var _0x47a5=function(_0x2c4618,_0x5e051b){_0x2c4618=_0x2c4618-0x0;var _0x566107=_0x7a54[_0x2c4618];return _0x566107;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x51a58a,_0x2d642f){var _0x3c7793=function(_0x10e42b){while(--_0x10e42b){_0x51a58a['push'](_0x51a58a['shift']());}};_0x3c7793(++_0x2d642f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e8d09,_0x290b78){_0x1e8d09=_0x1e8d09-0x0;var _0x145fcd=_0xb10b[_0x1e8d09];return _0x145fcd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 07d2eca..6277632 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 _0x7bae=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','upload','update','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5dc927,_0x49f4a1){var _0x416440=function(_0x752837){while(--_0x752837){_0x5dc927['push'](_0x5dc927['shift']());}};_0x416440(++_0x49f4a1);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7bae[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['get'](_0xe7ba('0xe'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xf')]);var upload=multer({'storage':multer[_0xe7ba('0x10')]({'destination':function(_0x15083a,_0x1672f0,_0x99a86f){_0x99a86f(null,path[_0xe7ba('0x11')](config[_0xe7ba('0x12')],'server/files/plugins'));},'filename':function(_0xf4fcb0,_0x588c8b,_0x602b1){_0x588c8b[_0xe7ba('0x13')]=_0x588c8b[_0xe7ba('0x13')][_0xe7ba('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x602b1(null,util[_0xe7ba('0x15')](_0xe7ba('0x16'),path['basename'](_0x588c8b['originalname'],path[_0xe7ba('0x17')](_0x588c8b[_0xe7ba('0x13')])),Date[_0xe7ba('0x18')](),path['extname'](_0x588c8b[_0xe7ba('0x13')])));}})});router['post']('/',upload['single']('file'),controller[_0xe7ba('0x19')]);router['post'](_0xe7ba('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x1a')]);router[_0xe7ba('0x1b')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['delete']);module[_0xe7ba('0x1c')]=router; \ No newline at end of file +var _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x159dc2,_0x4946c9){var _0x3cfd01=function(_0x5673c0){while(--_0x5673c0){_0x159dc2['push'](_0x159dc2['shift']());}};_0x3cfd01(++_0x4946c9);}(_0x9bde,0xe1));var _0xe9bd=function(_0xa140e3,_0x592f18){_0xa140e3=_0xa140e3-0x0;var _0x4733bf=_0x9bde[_0xa140e3];return _0x4733bf;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4300d66..052b36e 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 _0x91ef=['ENUM','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x91ef,0xfa));var _0xf91e=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x91ef[_0x35007a];return _0x574f68;};'use strict';var Sequelize=require(_0xf91e('0x0'));module['exports']={'name':{'type':Sequelize[_0xf91e('0x1')]},'type':{'type':Sequelize[_0xf91e('0x2')]('html','script')},'description':{'type':Sequelize[_0xf91e('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf91e('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf91e('0x4')},'sidebar':{'type':Sequelize['ENUM'](_0xf91e('0x5'),_0xf91e('0x6'),_0xf91e('0x7'),'never'),'defaultValue':'always','comment':_0xf91e('0x8')},'icon':{'type':Sequelize[_0xf91e('0x1')]},'adminUrl':{'type':Sequelize[_0xf91e('0x1')]},'agentUrl':{'type':Sequelize[_0xf91e('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf91e('0x1')]}}; \ No newline at end of file +var _0xae13=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','always'];(function(_0x457ea8,_0x3f5347){var _0x3a1abd=function(_0x1c908e){while(--_0x1c908e){_0x457ea8['push'](_0x457ea8['shift']());}};_0x3a1abd(++_0x3f5347);}(_0xae13,0x1ae));var _0x3ae1=function(_0xcfc7d2,_0x53ad68){_0xcfc7d2=_0xcfc7d2-0x0;var _0xd3c198=_0xae13[_0xcfc7d2];return _0xd3c198;};'use strict';var Sequelize=require(_0x3ae1('0x0'));module['exports']={'name':{'type':Sequelize[_0x3ae1('0x1')]},'type':{'type':Sequelize['ENUM'](_0x3ae1('0x2'),_0x3ae1('0x3'))},'description':{'type':Sequelize[_0x3ae1('0x4')]},'version':{'type':Sequelize[_0x3ae1('0x4')]},'path':{'type':Sequelize[_0x3ae1('0x1')],'comment':_0x3ae1('0x5')},'active':{'type':Sequelize[_0x3ae1('0x6')],'defaultValue':0x0,'comment':_0x3ae1('0x7')},'sidebar':{'type':Sequelize[_0x3ae1('0x8')]('adminOnly','agentOnly','always','never'),'defaultValue':_0x3ae1('0x9'),'comment':_0x3ae1('0xa')},'icon':{'type':Sequelize[_0x3ae1('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3ae1('0x1')]},'scriptName':{'type':Sequelize[_0x3ae1('0x1')]},'scriptPath':{'type':Sequelize[_0x3ae1('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a438682..e4d681c 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 _0x18f0=['agent','scriptName','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','extract-zip','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','Plugins','UserProfileResource','sendStatus','stack','name','send','map','Plugin','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified'];(function(_0x3ce64e,_0xc28f93){var _0x3698b1=function(_0x42f75d){while(--_0x42f75d){_0x3ce64e['push'](_0x3ce64e['shift']());}};_0x3698b1(++_0xc28f93);}(_0x18f0,0xc4));var _0x018f=function(_0x1b3ed9,_0x23c04){_0x1b3ed9=_0x1b3ed9-0x0;var _0x5a8e35=_0x18f0[_0x1b3ed9];return _0x5a8e35;};'use strict';var emlformat=require(_0x018f('0x0'));var rimraf=require(_0x018f('0x1'));var zipdir=require(_0x018f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x018f('0x3'));var moment=require(_0x018f('0x4'));var BPromise=require(_0x018f('0x5'));var Mustache=require(_0x018f('0x6'));var util=require('util');var path=require(_0x018f('0x7'));var sox=require('sox');var csv=require(_0x018f('0x8'));var ejs=require(_0x018f('0x9'));var fs=require('fs');var fs_extra=require(_0x018f('0xa'));var _=require(_0x018f('0xb'));var squel=require(_0x018f('0xc'));var crypto=require(_0x018f('0xd'));var jsforce=require(_0x018f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x018f('0x8'));var querystring=require(_0x018f('0xf'));var Papa=require('papaparse');var extract=require(_0x018f('0x10'));var rimraf=require(_0x018f('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x018f('0x11'));var qs=require(_0x018f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x018f('0x13'));var utils=require(_0x018f('0x14'));var config=require(_0x018f('0x15'));var licenseUtil=require(_0x018f('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x018f('0x17')](config[_0x018f('0x18')],{'host':_0x018f('0x19'),'port':0x18eb});var socket=require(_0x018f('0x1a'))(new Redis(config[_0x018f('0x18')]));require(_0x018f('0x1b'))[_0x018f('0x1c')](socket);function respondWithStatusCode(_0x2aa872,_0x3e7c14){_0x3e7c14=_0x3e7c14||0xcc;return function(_0x74bf9e){if(_0x74bf9e){return _0x2aa872['sendStatus'](_0x3e7c14);}return _0x2aa872[_0x018f('0x1d')](_0x3e7c14)[_0x018f('0x1e')]();};}function respondWithResult(_0x52a55e,_0x1eeeff){_0x1eeeff=_0x1eeeff||0xc8;return function(_0x1395c1){if(_0x1395c1){return _0x52a55e['status'](_0x1eeeff)[_0x018f('0x1f')](_0x1395c1);}};}function respondWithFilteredResult(_0x14b9ac,_0x41807f){return function(_0x45aad6){if(_0x45aad6){var _0x35e43d=typeof _0x41807f[_0x018f('0x20')]===_0x018f('0x21')&&typeof _0x41807f[_0x018f('0x22')]===_0x018f('0x21');var _0x3e7250=_0x45aad6[_0x018f('0x23')];var _0x5773c6=_0x35e43d?0x0:_0x41807f[_0x018f('0x20')];var _0x334cde=_0x35e43d?_0x45aad6['count']:_0x41807f[_0x018f('0x20')]+_0x41807f[_0x018f('0x22')];var _0x3bf329;if(_0x334cde>=_0x3e7250){_0x334cde=_0x3e7250;_0x3bf329=0xc8;}else{_0x3bf329=0xce;}_0x14b9ac[_0x018f('0x1d')](_0x3bf329);return _0x14b9ac[_0x018f('0x24')](_0x018f('0x25'),_0x5773c6+'-'+_0x334cde+'/'+_0x3e7250)[_0x018f('0x1f')](_0x45aad6);}return null;};}function patchUpdates(_0x2aab4c){return function(_0x21db3c){try{jsonpatch[_0x018f('0x26')](_0x21db3c,_0x2aab4c,!![]);}catch(_0x438bb7){return BPromise['reject'](_0x438bb7);}return _0x21db3c[_0x018f('0x27')]();};}function saveUpdates(_0x13bfcd,_0x747429){return function(_0x37d5fd){if(_0x37d5fd){return _0x37d5fd['update'](_0x13bfcd)['then'](function(_0x1e3da6){return _0x1e3da6;});}return null;};}function removeEntity(_0x54145f,_0x41aefa){return function(_0x2cf4d7){if(_0x2cf4d7){return _0x2cf4d7[_0x018f('0x28')]()[_0x018f('0x29')](function(){var _0x2ab947=_0x2cf4d7[_0x018f('0x2a')]({'plain':!![]});var _0x425309=_0x018f('0x2b');return db[_0x018f('0x2c')][_0x018f('0x28')]({'where':{'type':_0x425309,'resourceId':_0x2ab947['id']}})[_0x018f('0x29')](function(){return _0x2cf4d7;});})[_0x018f('0x29')](function(){_0x54145f[_0x018f('0x1d')](0xcc)[_0x018f('0x1e')]();});}};}function handleEntityNotFound(_0x24aa27,_0x450f3d){return function(_0x56a330){if(!_0x56a330){_0x24aa27[_0x018f('0x2d')](0x194);}return _0x56a330;};}function handleError(_0x88ccad,_0x19af77){_0x19af77=_0x19af77||0x1f4;return function(_0x22e6fb){logger['error'](_0x22e6fb[_0x018f('0x2e')]);if(_0x22e6fb[_0x018f('0x2f')]){delete _0x22e6fb[_0x018f('0x2f')];}_0x88ccad[_0x018f('0x1d')](_0x19af77)[_0x018f('0x30')](_0x22e6fb);};}exports['index']=function(_0x31c8ef,_0x4197d2){var _0x4f2ed0={},_0x2263cf={},_0x215429={'count':0x0,'rows':[]};var _0x2d8def=_[_0x018f('0x31')](db[_0x018f('0x32')]['rawAttributes'],function(_0x52af91){return{'name':_0x52af91['fieldName'],'type':_0x52af91[_0x018f('0x33')]['key']};});_0x2263cf[_0x018f('0x34')]=_[_0x018f('0x31')](_0x2d8def,_0x018f('0x2f'));_0x2263cf[_0x018f('0x35')]=_['keys'](_0x31c8ef[_0x018f('0x35')]);_0x2263cf[_0x018f('0x36')]=_['intersection'](_0x2263cf['model'],_0x2263cf[_0x018f('0x35')]);_0x4f2ed0[_0x018f('0x37')]=_[_0x018f('0x38')](_0x2263cf['model'],qs[_0x018f('0x39')](_0x31c8ef[_0x018f('0x35')][_0x018f('0x39')]));_0x4f2ed0['attributes']=_0x4f2ed0['attributes'][_0x018f('0x3a')]?_0x4f2ed0['attributes']:_0x2263cf[_0x018f('0x34')];if(!_0x31c8ef[_0x018f('0x35')][_0x018f('0x3b')](_0x018f('0x3c'))){_0x4f2ed0[_0x018f('0x22')]=qs[_0x018f('0x22')](_0x31c8ef['query'][_0x018f('0x22')]);_0x4f2ed0[_0x018f('0x20')]=qs['offset'](_0x31c8ef[_0x018f('0x35')]['offset']);}_0x4f2ed0[_0x018f('0x3d')]=qs[_0x018f('0x3e')](_0x31c8ef[_0x018f('0x35')][_0x018f('0x3e')]);_0x4f2ed0['where']=qs[_0x018f('0x36')](_[_0x018f('0x3f')](_0x31c8ef['query'],_0x2263cf['filters']),_0x2d8def);if(_0x31c8ef[_0x018f('0x35')][_0x018f('0x40')]){_0x4f2ed0[_0x018f('0x41')]=_[_0x018f('0x42')](_0x4f2ed0[_0x018f('0x41')],{'$or':_[_0x018f('0x31')](_0x2d8def,function(_0x24401f){if(_0x24401f[_0x018f('0x33')]!==_0x018f('0x43')){var _0x20a958={};_0x20a958[_0x24401f['name']]={'$like':'%'+_0x31c8ef[_0x018f('0x35')][_0x018f('0x40')]+'%'};return _0x20a958;}})});}_0x4f2ed0=_[_0x018f('0x42')]({},_0x4f2ed0,_0x31c8ef[_0x018f('0x44')]);var _0x3b1464={'where':_0x4f2ed0[_0x018f('0x41')]};return db['Plugin'][_0x018f('0x23')](_0x3b1464)[_0x018f('0x29')](function(_0x41682f){_0x215429[_0x018f('0x23')]=_0x41682f;if(_0x31c8ef[_0x018f('0x35')][_0x018f('0x45')]){_0x4f2ed0[_0x018f('0x46')]=[{'all':!![]}];}return db['Plugin'][_0x018f('0x47')](_0x4f2ed0);})[_0x018f('0x29')](function(_0x5d0606){_0x215429[_0x018f('0x48')]=_0x5d0606;return _0x215429;})[_0x018f('0x29')](respondWithFilteredResult(_0x4197d2,_0x4f2ed0))['catch'](handleError(_0x4197d2,null));};exports[_0x018f('0x49')]=function(_0x28c7a2,_0x3b4c32){var _0x5e7add={'raw':!![],'where':{'id':_0x28c7a2[_0x018f('0x4a')]['id']}},_0x3eae8f={};_0x3eae8f[_0x018f('0x34')]=_[_0x018f('0x4b')](db[_0x018f('0x32')][_0x018f('0x4c')]);_0x3eae8f[_0x018f('0x35')]=_['keys'](_0x28c7a2[_0x018f('0x35')]);_0x3eae8f[_0x018f('0x36')]=_[_0x018f('0x38')](_0x3eae8f[_0x018f('0x34')],_0x3eae8f[_0x018f('0x35')]);_0x5e7add[_0x018f('0x37')]=_[_0x018f('0x38')](_0x3eae8f[_0x018f('0x34')],qs[_0x018f('0x39')](_0x28c7a2[_0x018f('0x35')]['fields']));_0x5e7add[_0x018f('0x37')]=_0x5e7add[_0x018f('0x37')][_0x018f('0x3a')]?_0x5e7add[_0x018f('0x37')]:_0x3eae8f[_0x018f('0x34')];if(_0x28c7a2['query'][_0x018f('0x45')]){_0x5e7add[_0x018f('0x46')]=[{'all':!![]}];}_0x5e7add=_[_0x018f('0x42')]({},_0x5e7add,_0x28c7a2[_0x018f('0x44')]);return db[_0x018f('0x32')][_0x018f('0x4d')](_0x5e7add)[_0x018f('0x29')](handleEntityNotFound(_0x3b4c32,null))[_0x018f('0x29')](respondWithResult(_0x3b4c32,null))[_0x018f('0x4e')](handleError(_0x3b4c32,null));};exports[_0x018f('0x4f')]=function(_0xe1db6,_0x538bf1,_0x4234a9){return db['Plugin'][_0x018f('0x4d')]({'where':{'id':_0xe1db6[_0x018f('0x4a')]['id']},'attributes':[_0x018f('0x2f'),_0x018f('0x7')],'raw':!![]})[_0x018f('0x29')](handleEntityNotFound(_0x538bf1,null))['then'](function(_0x45b7b3){if(_0x45b7b3){var _0x3b42aa=path[_0x018f('0x50')](config[_0x018f('0x51')],_0x018f('0x52'),util[_0x018f('0x53')](_0x018f('0x54'),path[_0x018f('0x55')](_0x45b7b3[_0x018f('0x7')])));var _0x46fe5c=fs['createWriteStream'](_0x3b42aa);var _0xca44ac=archiver(_0x018f('0x56'),{'zlib':{'level':0x9}});_0xca44ac['on'](_0x018f('0x57'),function(_0x14b39e){if(_0x14b39e[_0x018f('0x58')]===_0x018f('0x59')){logger[_0x018f('0x5a')](_0x14b39e);}else{throw new db[(_0x018f('0x5b'))][(_0x018f('0x5c'))](_0x018f('0x5d'));}});_0xca44ac['on']('error',function(_0x2902d6){throw new db['Sequelize'][(_0x018f('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xca44ac[_0x018f('0x5e')](_0x46fe5c);_0xca44ac['glob'](_0x018f('0x5f'),{'cwd':path[_0x018f('0x50')](config[_0x018f('0x51')],_0x018f('0x52'),path[_0x018f('0x60')](_0x45b7b3[_0x018f('0x7')])),'ignore':[path[_0x018f('0x50')](path['basename'](_0x45b7b3[_0x018f('0x7')]),_0x018f('0x61')),path['join'](path[_0x018f('0x55')](_0x45b7b3['path']),_0x018f('0x62'))],'nodir':!![]})[_0x018f('0x63')]();_0x46fe5c['on'](_0x018f('0x64'),function(){if(!fs[_0x018f('0x65')](_0x3b42aa)){throw new db[(_0x018f('0x5b'))][(_0x018f('0x5c'))](_0x018f('0x66'));}return _0x538bf1[_0x018f('0x4f')](_0x3b42aa,util['format'](_0x018f('0x54'),path[_0x018f('0x55')](_0x45b7b3[_0x018f('0x7')])),function(_0x2ede23){if(_0x2ede23){throw new db[(_0x018f('0x5b'))][(_0x018f('0x5c'))](_0x018f('0x67'));}fs[_0x018f('0x68')](_0x3b42aa);logger['info']('Download\x20completed');logger[_0x018f('0x69')](_0x018f('0x6a'));});});}return null;})[_0x018f('0x4e')](handleError(_0x538bf1,null));};exports[_0x018f('0x6b')]=function(_0x2f15fb,_0x3c3a49,_0xf2795a){var _0x27fda2=path['basename'](_0x2f15fb[_0x018f('0x6c')][_0x018f('0x6d')],path[_0x018f('0x6e')](_0x2f15fb[_0x018f('0x6c')]['filename']));var _0xfd6c6e=path['join'](config[_0x018f('0x51')],_0x018f('0x52'),_0x2f15fb[_0x018f('0x6c')]['filename']);var _0x1de3c3=path['join'](config['root'],_0x018f('0x52'),_0x27fda2);logger[_0x018f('0x69')](_0x018f('0x6f'),_0xfd6c6e);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x1de3c3);try{fs['chmodSync'](_0xfd6c6e,parseInt(_0x018f('0x70'),0x8));extract(_0xfd6c6e,{'dir':_0x1de3c3},function(_0x347d47){if(_0x347d47){logger[_0x018f('0x5a')](_0x347d47);handleError(_0x347d47,!![]);};var _0x565261=fs[_0x018f('0x71')](_0x1de3c3);if(_0x565261[_0x018f('0x3a')]>0x1){removeReferences(_0xfd6c6e,_0x1de3c3);logger[_0x018f('0x5a')](_0x018f('0x72'));return _0xf2795a(new Error('Invalid\x20plugin\x20structure'));}var _0x1b4f47=fs[_0x018f('0x73')](path['join'](_0x1de3c3,_0x565261[0x0]));if(_0x1b4f47[_0x018f('0x74')]()){removeReferences(_0xfd6c6e,_0x1de3c3);logger[_0x018f('0x5a')](_0x018f('0x72'));return _0xf2795a(new Error('Invalid\x20plugin\x20structure'));}if(_0x1b4f47[_0x018f('0x75')]()){var _0x5b9ecf=fs[_0x018f('0x71')](path[_0x018f('0x50')](_0x1de3c3,_0x565261[0x0]));if(_0x5b9ecf[_0x018f('0x3a')]===0x0){removeReferences(_0xfd6c6e,_0x1de3c3);logger['error'](_0x018f('0x72'));return _0xf2795a(new Error('Invalid\x20plugin\x20structure'));}var _0x1f3387=_0x5b9ecf['some'](function(_0x3f90cc){return _0x3f90cc===_0x018f('0x76');});if(!_0x1f3387){return _0xf2795a(new Error(_0x018f('0x77')));}var _0x2dc740=fs[_0x018f('0x78')](path[_0x018f('0x50')](_0x1de3c3,_0x565261[0x0],'manifest.json'));var _0x3818e8=JSON[_0x018f('0x79')](_0x2dc740);if(_0x018f('0x21')==typeof _0x3818e8[_0x018f('0x2f')]){return _0xf2795a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x3818e8[_0x018f('0x33')]){return _0xf2795a(new Error(_0x018f('0x7a')));}if('undefined'==typeof _0x3818e8[_0x018f('0x7b')]){return _0xf2795a(new Error(_0x018f('0x7c')));}if('undefined'==typeof _0x3818e8[_0x018f('0x7d')]){return _0xf2795a(new Error(_0x018f('0x7e')));}if(_0x3818e8['type']==='html'){if(_0x018f('0x21')==typeof _0x3818e8['parameters'][_0x018f('0x7f')]){return _0xf2795a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x018f('0x21')==typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')][_0x018f('0x80')]&&_0x018f('0x21')==typeof _0x3818e8['parameters'][_0x018f('0x7f')]['agent']){return _0xf2795a(new Error(_0x018f('0x81')));}}else if(_0x3818e8['type']==='script'){if('undefined'==typeof _0x3818e8['parameters']['scriptName']){return _0xf2795a(new Error(_0x018f('0x82')));}if('undefined'==typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x83')]){return _0xf2795a(new Error(_0x018f('0x84')));}}else{return _0xf2795a(new Error(_0x018f('0x85')));}var _0x23af6a=_0x3818e8[_0x018f('0x2f')];var _0x413147=_0x3818e8[_0x018f('0x86')];var _0x23cf9f=_0x3818e8[_0x018f('0x33')];var _0x5d1597=_0x3818e8[_0x018f('0x87')]?_0x3818e8[_0x018f('0x87')]:'always';var _0x59ae10=_0x3818e8[_0x018f('0x88')]?_0x3818e8[_0x018f('0x88')]:_0x018f('0x89');var _0x3879b1='';var _0x437fb1='';var _0x48d460='';var _0x54e2b1='';var _0x1ab32f=_0x3818e8['version'];if(_0x23cf9f===_0x018f('0x8a')){if(_0x018f('0x21')!=typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')][_0x018f('0x80')]){var _0x33382e=_0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')][_0x018f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x018f('0x8b')](_0x33382e)){_0x3879b1=path[_0x018f('0x50')](_0x018f('0x8c'),_0x27fda2,_0x565261[0x0],_0x33382e);}else{_0x3879b1=_0x33382e;}}else{logger[_0x018f('0x69')](_0x018f('0x8d'));}if(_0x018f('0x21')!=typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')]['agent']){var _0xf5826c=_0x3818e8[_0x018f('0x7d')]['views'][_0x018f('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x018f('0x8b')](_0xf5826c)){_0x437fb1=path['join'](_0x018f('0x8c'),_0x27fda2,_0x565261[0x0],_0xf5826c);}else{_0x437fb1=_0xf5826c;}}else{logger[_0x018f('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x23cf9f==='script'){_0x48d460=_0x3818e8['parameters'][_0x018f('0x8f')];_0x54e2b1=_0x3818e8[_0x018f('0x7d')]['scriptPath'];if(_0x018f('0x21')!=typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')]){if(_0x018f('0x21')!=typeof _0x3818e8[_0x018f('0x7d')]['views'][_0x018f('0x80')]){var _0x33382e=_0x3818e8[_0x018f('0x7d')]['views'][_0x018f('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x33382e)){_0x3879b1=path['join'](_0x018f('0x8c'),_0x27fda2,_0x565261[0x0],_0x33382e);}else{_0x3879b1=_0x33382e;}}if(_0x018f('0x21')!=typeof _0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')][_0x018f('0x8e')]){var _0xf5826c=_0x3818e8[_0x018f('0x7d')][_0x018f('0x7f')][_0x018f('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x018f('0x8b')](_0xf5826c)){_0x437fb1=path[_0x018f('0x50')](_0x018f('0x8c'),_0x27fda2,_0x565261[0x0],_0xf5826c);}else{_0x437fb1=_0xf5826c;}}}}var _0x524cb1={'name':_0x23af6a,'description':_0x413147,'path':path[_0x018f('0x50')](_0x27fda2,_0x565261[0x0]),'type':_0x23cf9f,'sidebar':_0x5d1597,'icon':_0x59ae10,'adminUrl':_0x3879b1,'agentUrl':_0x437fb1,'scriptName':_0x48d460,'scriptPath':_0x54e2b1,'version':_0x1ab32f};removeReferences(_0xfd6c6e,null);return db['Plugin'][_0x018f('0x90')](_0x524cb1)['then'](function(_0x1c5e18){var _0x16f61f={'role':_0x2f15fb[_0x018f('0x91')][_0x018f('0x92')],'userProfileId':_0x2f15fb['body']['userProfileId']};if(!_0x16f61f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f61f[_0x018f('0x92')]===_0x018f('0x93')){var _0x195c64=_0x1c5e18['get']({'plain':!![]});return db[_0x018f('0x94')][_0x018f('0x4d')]({'where':{'name':_0x018f('0x2b'),'userProfileId':_0x16f61f['userProfileId']},'raw':!![]})['then'](function(_0x24e41b){if(_0x24e41b&&_0x24e41b[_0x018f('0x95')]===0x0){return db[_0x018f('0x2c')][_0x018f('0x90')]({'name':_0x195c64['name'],'resourceId':_0x195c64['id'],'type':_0x24e41b[_0x018f('0x2f')],'sectionId':_0x24e41b['id']},{})[_0x018f('0x29')](function(){return _0x1c5e18;});}else{return _0x1c5e18;}})[_0x018f('0x4e')](function(_0x4a84ff){logger[_0x018f('0x5a')](_0x018f('0x96'),_0x4a84ff);throw _0x4a84ff;});}return _0x1c5e18;})[_0x018f('0x29')](respondWithResult(_0x3c3a49,null))['catch'](handleError(_0x3c3a49,null));}});}catch(_0x533db5){_0x3c3a49[_0x018f('0x1d')](0x1f4)[_0x018f('0x30')](_0x533db5);}};function removeReferences(_0x100cce,_0x191444){try{if(_0x100cce){fs['unlinkSync'](_0x100cce);logger[_0x018f('0x69')](_0x018f('0x97'));}if(_0x191444){rimraf(_0x191444,function(){});logger[_0x018f('0x69')](_0x018f('0x98'));}}catch(_0x504724){logger['error'](_0x504724);}}exports['update']=function(_0x595fb6,_0x36386e,_0x26586e){return db['Plugin']['find']({'where':{'id':_0x595fb6[_0x018f('0x4a')]['id']}})[_0x018f('0x29')](handleEntityNotFound(_0x36386e,null))[_0x018f('0x29')](saveUpdates(_0x595fb6['body'],null))[_0x018f('0x29')](respondWithResult(_0x36386e,null))[_0x018f('0x4e')](handleError(_0x36386e,null));};exports[_0x018f('0x99')]=function(_0xa651dc,_0x1ee2f7,_0x278d27){return db[_0x018f('0x32')][_0x018f('0x4d')]({'where':{'id':_0xa651dc[_0x018f('0x4a')]['id']}})['then'](function(_0x12e58a){if(_0x12e58a){return _0x12e58a[_0x018f('0x28')]();}})[_0x018f('0x29')](function(_0x2ac4df){rimraf(path[_0x018f('0x50')](config[_0x018f('0x51')],'server/files/plugins',path[_0x018f('0x60')](_0x2ac4df[_0x018f('0x7')])),function(){});return _0x2ac4df;})[_0x018f('0x29')](handleEntityNotFound(_0x1ee2f7,null))[_0x018f('0x29')](respondWithStatusCode(_0x1ee2f7,null))[_0x018f('0x4e')](handleError(_0x1ee2f7,null));};exports['webhookGet']=function(_0x265a3d,_0x4a4b16,_0x2e785e){return BPromise['resolve']()[_0x018f('0x29')](function(){if(!_0x265a3d[_0x018f('0x35')][_0x018f('0x7')]){throw new Error(_0x018f('0x9a'));}if(!_0x265a3d[_0x018f('0x35')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xd29198=_0x265a3d[_0x018f('0x35')][_0x018f('0x9b')]?_0x265a3d[_0x018f('0x35')][_0x018f('0x9b')]+':'+_0x265a3d[_0x018f('0x35')][_0x018f('0x9c')]:_0x018f('0x9d')+_0x265a3d[_0x018f('0x35')][_0x018f('0x9c')];var _0x5b5577=_0x265a3d['query'][_0x018f('0x1f')]?_0x265a3d['query'][_0x018f('0x1f')]:!![];var _0x36de28=_0x265a3d[_0x018f('0x35')][_0x018f('0x9e')]?_0x265a3d[_0x018f('0x35')][_0x018f('0x9e')]:null;var _0x350787={'method':_0x265a3d['method'],'uri':util['format'](_0x018f('0x9f'),_0xd29198,_0x265a3d[_0x018f('0x35')][_0x018f('0x7')]),'json':_0x5b5577,'resolveWithFullResponse':!![],'encoding':_0x36de28,'qs':_0x265a3d[_0x018f('0x35')]};if(_0x265a3d['headers']){_0x350787[_0x018f('0xa0')]=_0x265a3d['headers'];if(_0x350787['headers'][_0x018f('0xa1')]){delete _0x350787[_0x018f('0xa0')][_0x018f('0xa1')];}}if(_0x350787[_0x018f('0xa0')]['content-type']){delete _0x350787[_0x018f('0xa0')][_0x018f('0xa2')];}return rp(_0x350787);})[_0x018f('0x29')](function(_0x45b3f1){if(_0x45b3f1){_0x4a4b16[_0x018f('0x24')](_0x45b3f1[_0x018f('0xa0')]);logger[_0x018f('0x69')](_0x45b3f1[_0x018f('0x91')]);if(_[_0x018f('0xa3')](_0x265a3d[_0x018f('0x35')][_0x018f('0x7')],_0x018f('0x4f'))&&_0x45b3f1[_0x018f('0xa4')]==0x1f4){return _0x4a4b16[_0x018f('0x2d')](_0x45b3f1[_0x018f('0xa4')]);}else{return _0x4a4b16[_0x018f('0x1d')](_0x45b3f1[_0x018f('0xa4')])[_0x018f('0x30')](_0x45b3f1['body']);}}else{return _0x4a4b16[_0x018f('0x2d')](0xc8);}})['catch'](handleError(_0x4a4b16,null));};exports[_0x018f('0xa5')]=function(_0x23eb8e,_0x372553,_0x355089){return BPromise[_0x018f('0xa6')]()[_0x018f('0x29')](function(){if(!_0x23eb8e[_0x018f('0x35')][_0x018f('0x7')]){throw new Error(_0x018f('0x9a'));}if(!_0x23eb8e['query']['port']){throw new Error(_0x018f('0xa7'));}var _0x229b3b=_0x23eb8e['query'][_0x018f('0x9b')]?_0x23eb8e[_0x018f('0x35')][_0x018f('0x9b')]+':'+_0x23eb8e['query'][_0x018f('0x9c')]:_0x018f('0x9d')+_0x23eb8e['query'][_0x018f('0x9c')];var _0x299fcb=_0x23eb8e[_0x018f('0x35')][_0x018f('0x1f')]?_0x23eb8e[_0x018f('0x35')]['json']:!![];var _0x5794f8=_0x23eb8e[_0x018f('0x35')]['encoding']?_0x23eb8e[_0x018f('0x35')][_0x018f('0x9e')]:null;var _0x134659={'method':_0x23eb8e[_0x018f('0xa8')],'uri':util[_0x018f('0x53')](_0x018f('0x9f'),_0x229b3b,_0x23eb8e[_0x018f('0x35')][_0x018f('0x7')]),'json':_0x299fcb,'resolveWithFullResponse':!![],'encoding':_0x5794f8,'body':_0x23eb8e[_0x018f('0x91')]};if(_0x23eb8e[_0x018f('0xa0')]){_0x134659[_0x018f('0xa0')]=_0x23eb8e['headers'];if(_0x134659[_0x018f('0xa0')][_0x018f('0xa1')]){delete _0x134659['headers'][_0x018f('0xa1')];}}if(_0x134659[_0x018f('0xa0')][_0x018f('0xa2')]){delete _0x134659[_0x018f('0xa0')][_0x018f('0xa2')];}return rp(_0x134659);})['then'](function(_0x58722d){if(_0x58722d){_0x372553[_0x018f('0x24')](_0x58722d[_0x018f('0xa0')]);logger['info'](_0x58722d[_0x018f('0x91')]);return _0x372553[_0x018f('0x1d')](_0x58722d[_0x018f('0xa4')])[_0x018f('0x30')](_0x58722d[_0x018f('0x91')]);}else{return _0x372553[_0x018f('0x2d')](0xc8);}})[_0x018f('0x4e')](handleError(_0x372553,null));}; \ No newline at end of file +var _0x39ac=['html','parameters','views','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','create','body','userProfileId','role','user','UserProfileSection','Plugins','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','resolve','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','extract-zip','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','set','json','apply','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','Plugin','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','params','keys','rawAttributes','intersection','options','find','path','format','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','join','basename','node_modules/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version'];(function(_0x52f497,_0x132ec4){var _0x280215=function(_0x5b83f9){while(--_0x5b83f9){_0x52f497['push'](_0x52f497['shift']());}};_0x280215(++_0x132ec4);}(_0x39ac,0x16f));var _0xc39a=function(_0x41e722,_0x35f5b4){_0x41e722=_0x41e722-0x0;var _0x2b3647=_0x39ac[_0x41e722];return _0x2b3647;};'use strict';var emlformat=require(_0xc39a('0x0'));var rimraf=require(_0xc39a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc39a('0x2'));var rp=require(_0xc39a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc39a('0x4'));var path=require('path');var sox=require(_0xc39a('0x5'));var csv=require(_0xc39a('0x6'));var ejs=require(_0xc39a('0x7'));var fs=require('fs');var fs_extra=require(_0xc39a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc39a('0x9'));var jsforce=require(_0xc39a('0xa'));var deskjs=require(_0xc39a('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xc39a('0xc'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xc39a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc39a('0xe'));var as=require(_0xc39a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc39a('0x10'));var utils=require('../../config/utils');var config=require(_0xc39a('0x11'));var licenseUtil=require(_0xc39a('0x12'));var db=require(_0xc39a('0x13'))['db'];config[_0xc39a('0x14')]=_['defaults'](config[_0xc39a('0x14')],{'host':_0xc39a('0x15'),'port':0x18eb});var socket=require(_0xc39a('0x16'))(new Redis(config['redis']));require('./plugin.socket')[_0xc39a('0x17')](socket);function respondWithStatusCode(_0x3f272e,_0x3c00ee){_0x3c00ee=_0x3c00ee||0xcc;return function(_0x2fca40){if(_0x2fca40){return _0x3f272e['sendStatus'](_0x3c00ee);}return _0x3f272e[_0xc39a('0x18')](_0x3c00ee)[_0xc39a('0x19')]();};}function respondWithResult(_0x4cb638,_0x25ed73){_0x25ed73=_0x25ed73||0xc8;return function(_0x3ab6f2){if(_0x3ab6f2){return _0x4cb638[_0xc39a('0x18')](_0x25ed73)['json'](_0x3ab6f2);}};}function respondWithFilteredResult(_0x275d01,_0x337996){return function(_0x136129){if(_0x136129){var _0x27b18a=typeof _0x337996[_0xc39a('0x1a')]===_0xc39a('0x1b')&&typeof _0x337996['limit']===_0xc39a('0x1b');var _0x23e8d7=_0x136129[_0xc39a('0x1c')];var _0x56c157=_0x27b18a?0x0:_0x337996[_0xc39a('0x1a')];var _0x3ae0b9=_0x27b18a?_0x136129[_0xc39a('0x1c')]:_0x337996['offset']+_0x337996[_0xc39a('0x1d')];var _0xe76287;if(_0x3ae0b9>=_0x23e8d7){_0x3ae0b9=_0x23e8d7;_0xe76287=0xc8;}else{_0xe76287=0xce;}_0x275d01[_0xc39a('0x18')](_0xe76287);return _0x275d01[_0xc39a('0x1e')]('Content-Range',_0x56c157+'-'+_0x3ae0b9+'/'+_0x23e8d7)[_0xc39a('0x1f')](_0x136129);}return null;};}function patchUpdates(_0xa5f289){return function(_0x281b76){try{jsonpatch[_0xc39a('0x20')](_0x281b76,_0xa5f289,!![]);}catch(_0x402470){return BPromise['reject'](_0x402470);}return _0x281b76['save']();};}function saveUpdates(_0x14954c,_0x5f2cfc){return function(_0x4d700){if(_0x4d700){return _0x4d700['update'](_0x14954c)[_0xc39a('0x21')](function(_0x16d0ad){return _0x16d0ad;});}return null;};}function removeEntity(_0x34490b,_0x65c6ea){return function(_0x312ea7){if(_0x312ea7){return _0x312ea7['destroy']()[_0xc39a('0x21')](function(){var _0x70f3ff=_0x312ea7[_0xc39a('0x22')]({'plain':!![]});var _0x52dd53='Plugins';return db[_0xc39a('0x23')][_0xc39a('0x24')]({'where':{'type':_0x52dd53,'resourceId':_0x70f3ff['id']}})[_0xc39a('0x21')](function(){return _0x312ea7;});})[_0xc39a('0x21')](function(){_0x34490b[_0xc39a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319c18,_0x3aa08a){return function(_0x44c530){if(!_0x44c530){_0x319c18[_0xc39a('0x25')](0x194);}return _0x44c530;};}function handleError(_0x4508b0,_0x2b3bdd){_0x2b3bdd=_0x2b3bdd||0x1f4;return function(_0x9ad171){logger[_0xc39a('0x26')](_0x9ad171[_0xc39a('0x27')]);if(_0x9ad171[_0xc39a('0x28')]){delete _0x9ad171[_0xc39a('0x28')];}_0x4508b0[_0xc39a('0x18')](_0x2b3bdd)['send'](_0x9ad171);};}exports[_0xc39a('0x29')]=function(_0x5f1b60,_0xc110be){var _0x27a60d={},_0xdcdf37={},_0x5295e5={'count':0x0,'rows':[]};var _0x2391fb=_['map'](db[_0xc39a('0x2a')]['rawAttributes'],function(_0x41588e){return{'name':_0x41588e[_0xc39a('0x2b')],'type':_0x41588e[_0xc39a('0x2c')][_0xc39a('0x2d')]};});_0xdcdf37[_0xc39a('0x2e')]=_['map'](_0x2391fb,_0xc39a('0x28'));_0xdcdf37[_0xc39a('0x2f')]=_['keys'](_0x5f1b60['query']);_0xdcdf37[_0xc39a('0x30')]=_['intersection'](_0xdcdf37[_0xc39a('0x2e')],_0xdcdf37[_0xc39a('0x2f')]);_0x27a60d['attributes']=_['intersection'](_0xdcdf37['model'],qs[_0xc39a('0x31')](_0x5f1b60['query']['fields']));_0x27a60d['attributes']=_0x27a60d['attributes']['length']?_0x27a60d[_0xc39a('0x32')]:_0xdcdf37[_0xc39a('0x2e')];if(!_0x5f1b60[_0xc39a('0x2f')][_0xc39a('0x33')]('nolimit')){_0x27a60d[_0xc39a('0x1d')]=qs['limit'](_0x5f1b60['query'][_0xc39a('0x1d')]);_0x27a60d['offset']=qs[_0xc39a('0x1a')](_0x5f1b60[_0xc39a('0x2f')]['offset']);}_0x27a60d[_0xc39a('0x34')]=qs[_0xc39a('0x35')](_0x5f1b60[_0xc39a('0x2f')][_0xc39a('0x35')]);_0x27a60d[_0xc39a('0x36')]=qs['filters'](_[_0xc39a('0x37')](_0x5f1b60[_0xc39a('0x2f')],_0xdcdf37['filters']),_0x2391fb);if(_0x5f1b60[_0xc39a('0x2f')][_0xc39a('0x38')]){_0x27a60d[_0xc39a('0x36')]=_[_0xc39a('0x39')](_0x27a60d['where'],{'$or':_[_0xc39a('0x3a')](_0x2391fb,function(_0x5e74c1){if(_0x5e74c1[_0xc39a('0x2c')]!==_0xc39a('0x3b')){var _0xf56151={};_0xf56151[_0x5e74c1['name']]={'$like':'%'+_0x5f1b60[_0xc39a('0x2f')][_0xc39a('0x38')]+'%'};return _0xf56151;}})});}_0x27a60d=_[_0xc39a('0x39')]({},_0x27a60d,_0x5f1b60['options']);var _0x4440ca={'where':_0x27a60d[_0xc39a('0x36')]};return db['Plugin'][_0xc39a('0x1c')](_0x4440ca)[_0xc39a('0x21')](function(_0x2e66d1){_0x5295e5[_0xc39a('0x1c')]=_0x2e66d1;if(_0x5f1b60[_0xc39a('0x2f')]['includeAll']){_0x27a60d[_0xc39a('0x3c')]=[{'all':!![]}];}return db[_0xc39a('0x2a')][_0xc39a('0x3d')](_0x27a60d);})[_0xc39a('0x21')](function(_0x3fed5c){_0x5295e5[_0xc39a('0x3e')]=_0x3fed5c;return _0x5295e5;})[_0xc39a('0x21')](respondWithFilteredResult(_0xc110be,_0x27a60d))[_0xc39a('0x3f')](handleError(_0xc110be,null));};exports['show']=function(_0x1e22b6,_0xe307d3){var _0x384282={'raw':!![],'where':{'id':_0x1e22b6[_0xc39a('0x40')]['id']}},_0x1ac62e={};_0x1ac62e[_0xc39a('0x2e')]=_[_0xc39a('0x41')](db[_0xc39a('0x2a')][_0xc39a('0x42')]);_0x1ac62e[_0xc39a('0x2f')]=_[_0xc39a('0x41')](_0x1e22b6[_0xc39a('0x2f')]);_0x1ac62e[_0xc39a('0x30')]=_[_0xc39a('0x43')](_0x1ac62e[_0xc39a('0x2e')],_0x1ac62e['query']);_0x384282[_0xc39a('0x32')]=_['intersection'](_0x1ac62e[_0xc39a('0x2e')],qs[_0xc39a('0x31')](_0x1e22b6[_0xc39a('0x2f')][_0xc39a('0x31')]));_0x384282[_0xc39a('0x32')]=_0x384282[_0xc39a('0x32')]['length']?_0x384282[_0xc39a('0x32')]:_0x1ac62e['model'];if(_0x1e22b6['query']['includeAll']){_0x384282[_0xc39a('0x3c')]=[{'all':!![]}];}_0x384282=_[_0xc39a('0x39')]({},_0x384282,_0x1e22b6[_0xc39a('0x44')]);return db['Plugin'][_0xc39a('0x45')](_0x384282)[_0xc39a('0x21')](handleEntityNotFound(_0xe307d3,null))[_0xc39a('0x21')](respondWithResult(_0xe307d3,null))[_0xc39a('0x3f')](handleError(_0xe307d3,null));};exports['download']=function(_0x280a56,_0x390cb0,_0x200f56){return db[_0xc39a('0x2a')][_0xc39a('0x45')]({'where':{'id':_0x280a56['params']['id']},'attributes':[_0xc39a('0x28'),_0xc39a('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x390cb0,null))[_0xc39a('0x21')](function(_0x2ed405){if(_0x2ed405){var _0xf3e5d2=path['join'](config['root'],'server/files/plugins',util[_0xc39a('0x47')](_0xc39a('0x48'),path['basename'](_0x2ed405[_0xc39a('0x46')])));var _0x5f0af5=fs[_0xc39a('0x49')](_0xf3e5d2);var _0x20cc5b=archiver('zip',{'zlib':{'level':0x9}});_0x20cc5b['on'](_0xc39a('0x4a'),function(_0x5176f6){if(_0x5176f6[_0xc39a('0x4b')]===_0xc39a('0x4c')){logger[_0xc39a('0x26')](_0x5176f6);}else{throw new db[(_0xc39a('0x4d'))][(_0xc39a('0x4e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x20cc5b['on'](_0xc39a('0x26'),function(_0x1ebd35){throw new db[(_0xc39a('0x4d'))][(_0xc39a('0x4e'))](_0xc39a('0x4f'));});_0x20cc5b[_0xc39a('0x50')](_0x5f0af5);_0x20cc5b[_0xc39a('0x51')](_0xc39a('0x52'),{'cwd':path['join'](config[_0xc39a('0x53')],'server/files/plugins',path[_0xc39a('0x54')](_0x2ed405[_0xc39a('0x46')])),'ignore':[path[_0xc39a('0x55')](path[_0xc39a('0x56')](_0x2ed405[_0xc39a('0x46')]),_0xc39a('0x57')),path[_0xc39a('0x55')](path[_0xc39a('0x56')](_0x2ed405[_0xc39a('0x46')]),'attachments/**/*')],'nodir':!![]})[_0xc39a('0x58')]();_0x5f0af5['on']('close',function(){if(!fs[_0xc39a('0x59')](_0xf3e5d2)){throw new db[(_0xc39a('0x4d'))][(_0xc39a('0x4e'))]('Plugin\x20not\x20found');}return _0x390cb0['download'](_0xf3e5d2,util[_0xc39a('0x47')]('%s.zip',path['basename'](_0x2ed405[_0xc39a('0x46')])),function(_0x2019e1){if(_0x2019e1){throw new db[(_0xc39a('0x4d'))]['Error'](_0xc39a('0x5a'));}fs[_0xc39a('0x5b')](_0xf3e5d2);logger['info'](_0xc39a('0x5c'));logger['info'](_0xc39a('0x5d'));});});}return null;})['catch'](handleError(_0x390cb0,null));};exports[_0xc39a('0x5e')]=function(_0x40b0fe,_0x5b9468,_0x21f8e6){var _0x236918=path[_0xc39a('0x56')](_0x40b0fe[_0xc39a('0x5f')][_0xc39a('0x60')],path[_0xc39a('0x61')](_0x40b0fe[_0xc39a('0x5f')][_0xc39a('0x60')]));var _0x31d684=path[_0xc39a('0x55')](config['root'],_0xc39a('0x62'),_0x40b0fe[_0xc39a('0x5f')]['filename']);var _0x187c5c=path[_0xc39a('0x55')](config[_0xc39a('0x53')],'server/files/plugins',_0x236918);logger['info'](_0xc39a('0x63'),_0x31d684);logger[_0xc39a('0x64')](_0xc39a('0x65'),_0x187c5c);try{fs[_0xc39a('0x66')](_0x31d684,parseInt(_0xc39a('0x67'),0x8));extract(_0x31d684,{'dir':_0x187c5c},function(_0x195aa1){if(_0x195aa1){logger['error'](_0x195aa1);handleError(_0x195aa1,!![]);};var _0x28ade1=fs[_0xc39a('0x68')](_0x187c5c);if(_0x28ade1[_0xc39a('0x69')]>0x1){removeReferences(_0x31d684,_0x187c5c);logger['error']('Invalid\x20plugin\x20structure');return _0x21f8e6(new Error(_0xc39a('0x6a')));}var _0x26c3ed=fs[_0xc39a('0x6b')](path['join'](_0x187c5c,_0x28ade1[0x0]));if(_0x26c3ed['isFile']()){removeReferences(_0x31d684,_0x187c5c);logger[_0xc39a('0x26')](_0xc39a('0x6a'));return _0x21f8e6(new Error(_0xc39a('0x6a')));}if(_0x26c3ed[_0xc39a('0x6c')]()){var _0x242058=fs['readdirSync'](path[_0xc39a('0x55')](_0x187c5c,_0x28ade1[0x0]));if(_0x242058[_0xc39a('0x69')]===0x0){removeReferences(_0x31d684,_0x187c5c);logger[_0xc39a('0x26')]('Invalid\x20plugin\x20structure');return _0x21f8e6(new Error(_0xc39a('0x6a')));}var _0x9db1d0=_0x242058[_0xc39a('0x6d')](function(_0x24de46){return _0x24de46==='manifest.json';});if(!_0x9db1d0){return _0x21f8e6(new Error(_0xc39a('0x6e')));}var _0x31309a=fs[_0xc39a('0x6f')](path[_0xc39a('0x55')](_0x187c5c,_0x28ade1[0x0],_0xc39a('0x70')));var _0x45719f=JSON[_0xc39a('0x71')](_0x31309a);if(_0xc39a('0x1b')==typeof _0x45719f[_0xc39a('0x28')]){return _0x21f8e6(new Error(_0xc39a('0x72')));}if(_0xc39a('0x1b')==typeof _0x45719f['type']){return _0x21f8e6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc39a('0x1b')==typeof _0x45719f[_0xc39a('0x73')]){return _0x21f8e6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x45719f['parameters']){return _0x21f8e6(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x45719f[_0xc39a('0x2c')]===_0xc39a('0x74')){if('undefined'==typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')]){return _0x21f8e6(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xc39a('0x1b')==typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')]['admin']&&'undefined'==typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')]['agent']){return _0x21f8e6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45719f['type']===_0xc39a('0x77')){if(_0xc39a('0x1b')==typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x78')]){return _0x21f8e6(new Error(_0xc39a('0x79')));}if(_0xc39a('0x1b')==typeof _0x45719f[_0xc39a('0x75')]['scriptPath']){return _0x21f8e6(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x21f8e6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xc6076a=_0x45719f[_0xc39a('0x28')];var _0x5094ef=_0x45719f['description'];var _0xe9b69f=_0x45719f[_0xc39a('0x2c')];var _0x60849c=_0x45719f[_0xc39a('0x7a')]?_0x45719f['sidebar']:_0xc39a('0x7b');var _0x4d68c1=_0x45719f[_0xc39a('0x7c')]?_0x45719f['icon']:_0xc39a('0x7d');var _0x2c4723='';var _0x5b7eb8='';var _0x5dabca='';var _0x25d8eb='';var _0x393e9f=_0x45719f[_0xc39a('0x73')];if(_0xe9b69f===_0xc39a('0x74')){if(_0xc39a('0x1b')!=typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')][_0xc39a('0x7e')]){var _0x374fa7=_0x45719f[_0xc39a('0x75')]['views'][_0xc39a('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc39a('0x7f')](_0x374fa7)){_0x2c4723=path[_0xc39a('0x55')](_0xc39a('0x80'),_0x236918,_0x28ade1[0x0],_0x374fa7);}else{_0x2c4723=_0x374fa7;}}else{logger[_0xc39a('0x64')](_0xc39a('0x81'));}if(_0xc39a('0x1b')!=typeof _0x45719f[_0xc39a('0x75')]['views']['agent']){var _0xed2ae1=_0x45719f[_0xc39a('0x75')][_0xc39a('0x76')][_0xc39a('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xc39a('0x7f')](_0xed2ae1)){_0x5b7eb8=path['join'](_0xc39a('0x80'),_0x236918,_0x28ade1[0x0],_0xed2ae1);}else{_0x5b7eb8=_0xed2ae1;}}else{logger[_0xc39a('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xe9b69f===_0xc39a('0x77')){_0x5dabca=_0x45719f[_0xc39a('0x75')]['scriptName'];_0x25d8eb=_0x45719f['parameters'][_0xc39a('0x83')];if(_0xc39a('0x1b')!=typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')]){if(_0xc39a('0x1b')!=typeof _0x45719f[_0xc39a('0x75')][_0xc39a('0x76')][_0xc39a('0x7e')]){var _0x374fa7=_0x45719f[_0xc39a('0x75')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc39a('0x7f')](_0x374fa7)){_0x2c4723=path[_0xc39a('0x55')](_0xc39a('0x80'),_0x236918,_0x28ade1[0x0],_0x374fa7);}else{_0x2c4723=_0x374fa7;}}if(_0xc39a('0x1b')!=typeof _0x45719f[_0xc39a('0x75')]['views'][_0xc39a('0x82')]){var _0xed2ae1=_0x45719f[_0xc39a('0x75')]['views'][_0xc39a('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0xed2ae1)){_0x5b7eb8=path[_0xc39a('0x55')](_0xc39a('0x80'),_0x236918,_0x28ade1[0x0],_0xed2ae1);}else{_0x5b7eb8=_0xed2ae1;}}}}var _0x4a0d30={'name':_0xc6076a,'description':_0x5094ef,'path':path[_0xc39a('0x55')](_0x236918,_0x28ade1[0x0]),'type':_0xe9b69f,'sidebar':_0x60849c,'icon':_0x4d68c1,'adminUrl':_0x2c4723,'agentUrl':_0x5b7eb8,'scriptName':_0x5dabca,'scriptPath':_0x25d8eb,'version':_0x393e9f};removeReferences(_0x31d684,null);return db[_0xc39a('0x2a')][_0xc39a('0x84')](_0x4a0d30)['then'](function(_0x2b5583){var _0x4518dc={'role':_0x40b0fe[_0xc39a('0x85')]['role'],'userProfileId':_0x40b0fe[_0xc39a('0x85')][_0xc39a('0x86')]};if(!_0x4518dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4518dc[_0xc39a('0x87')]===_0xc39a('0x88')){var _0x12e028=_0x2b5583['get']({'plain':!![]});return db[_0xc39a('0x89')][_0xc39a('0x45')]({'where':{'name':_0xc39a('0x8a'),'userProfileId':_0x4518dc[_0xc39a('0x86')]},'raw':!![]})[_0xc39a('0x21')](function(_0x4d6650){if(_0x4d6650&&_0x4d6650[_0xc39a('0x8b')]===0x0){return db[_0xc39a('0x23')][_0xc39a('0x84')]({'name':_0x12e028[_0xc39a('0x28')],'resourceId':_0x12e028['id'],'type':_0x4d6650[_0xc39a('0x28')],'sectionId':_0x4d6650['id']},{})[_0xc39a('0x21')](function(){return _0x2b5583;});}else{return _0x2b5583;}})[_0xc39a('0x3f')](function(_0x339997){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x339997);throw _0x339997;});}return _0x2b5583;})[_0xc39a('0x21')](respondWithResult(_0x5b9468,null))[_0xc39a('0x3f')](handleError(_0x5b9468,null));}});}catch(_0x5ad6fd){_0x5b9468[_0xc39a('0x18')](0x1f4)[_0xc39a('0x8c')](_0x5ad6fd);}};function removeReferences(_0x5369ab,_0x34b607){try{if(_0x5369ab){fs[_0xc39a('0x5b')](_0x5369ab);logger[_0xc39a('0x64')](_0xc39a('0x8d'));}if(_0x34b607){rimraf(_0x34b607,function(){});logger[_0xc39a('0x64')](_0xc39a('0x8e'));}}catch(_0x299344){logger[_0xc39a('0x26')](_0x299344);}}exports[_0xc39a('0x8f')]=function(_0x3f620c,_0x6d3699,_0x2ca4a2){return db[_0xc39a('0x2a')]['find']({'where':{'id':_0x3f620c[_0xc39a('0x40')]['id']}})[_0xc39a('0x21')](handleEntityNotFound(_0x6d3699,null))[_0xc39a('0x21')](saveUpdates(_0x3f620c[_0xc39a('0x85')],null))[_0xc39a('0x21')](respondWithResult(_0x6d3699,null))[_0xc39a('0x3f')](handleError(_0x6d3699,null));};exports[_0xc39a('0x90')]=function(_0x59aa8a,_0x44946f,_0x133189){return db[_0xc39a('0x2a')][_0xc39a('0x45')]({'where':{'id':_0x59aa8a[_0xc39a('0x40')]['id']}})['then'](function(_0xaa3639){if(_0xaa3639){return _0xaa3639[_0xc39a('0x24')]();}})[_0xc39a('0x21')](function(_0x28c61b){rimraf(path[_0xc39a('0x55')](config[_0xc39a('0x53')],_0xc39a('0x62'),path[_0xc39a('0x54')](_0x28c61b['path'])),function(){});return _0x28c61b;})['then'](handleEntityNotFound(_0x44946f,null))[_0xc39a('0x21')](respondWithStatusCode(_0x44946f,null))[_0xc39a('0x3f')](handleError(_0x44946f,null));};exports[_0xc39a('0x91')]=function(_0x352d3d,_0x32c520,_0x2c4617){return BPromise['resolve']()[_0xc39a('0x21')](function(){if(!_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x46')]){throw new Error(_0xc39a('0x92'));}if(!_0x352d3d['query']['port']){throw new Error(_0xc39a('0x93'));}var _0x4b395e=_0x352d3d['query'][_0xc39a('0x94')]?_0x352d3d['query'][_0xc39a('0x94')]+':'+_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x95')]:_0xc39a('0x96')+_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x95')];var _0x4d5dd5=_0x352d3d['query'][_0xc39a('0x1f')]?_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x1f')]:!![];var _0x129d23=_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x97')]?_0x352d3d['query']['encoding']:null;var _0xa65c79={'method':_0x352d3d[_0xc39a('0x98')],'uri':util[_0xc39a('0x47')](_0xc39a('0x99'),_0x4b395e,_0x352d3d[_0xc39a('0x2f')]['path']),'json':_0x4d5dd5,'resolveWithFullResponse':!![],'encoding':_0x129d23,'qs':_0x352d3d[_0xc39a('0x2f')]};if(_0x352d3d[_0xc39a('0x9a')]){_0xa65c79[_0xc39a('0x9a')]=_0x352d3d[_0xc39a('0x9a')];if(_0xa65c79[_0xc39a('0x9a')]['content-length']){delete _0xa65c79['headers'][_0xc39a('0x9b')];}}if(_0xa65c79[_0xc39a('0x9a')][_0xc39a('0x9c')]){delete _0xa65c79['headers'][_0xc39a('0x9c')];}return rp(_0xa65c79);})[_0xc39a('0x21')](function(_0x220db0){if(_0x220db0){_0x32c520[_0xc39a('0x1e')](_0x220db0['headers']);logger[_0xc39a('0x64')](_0x220db0[_0xc39a('0x85')]);if(_[_0xc39a('0x9d')](_0x352d3d[_0xc39a('0x2f')][_0xc39a('0x46')],_0xc39a('0x9e'))&&_0x220db0[_0xc39a('0x9f')]==0x1f4){return _0x32c520[_0xc39a('0x25')](_0x220db0[_0xc39a('0x9f')]);}else{return _0x32c520[_0xc39a('0x18')](_0x220db0[_0xc39a('0x9f')])['send'](_0x220db0[_0xc39a('0x85')]);}}else{return _0x32c520['sendStatus'](0xc8);}})[_0xc39a('0x3f')](handleError(_0x32c520,null));};exports['webhookPost']=function(_0xa10d70,_0x1769fb,_0x270f3e){return BPromise[_0xc39a('0xa0')]()[_0xc39a('0x21')](function(){if(!_0xa10d70['query'][_0xc39a('0x46')]){throw new Error(_0xc39a('0x92'));}if(!_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x95')]){throw new Error(_0xc39a('0x93'));}var _0x113fc6=_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x94')]?_0xa10d70[_0xc39a('0x2f')]['hostname']+':'+_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x95')]:_0xc39a('0x96')+_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x95')];var _0x48cd5e=_0xa10d70['query'][_0xc39a('0x1f')]?_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x1f')]:!![];var _0x18cfc8=_0xa10d70['query'][_0xc39a('0x97')]?_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x97')]:null;var _0x5b4eb9={'method':_0xa10d70[_0xc39a('0x98')],'uri':util['format'](_0xc39a('0x99'),_0x113fc6,_0xa10d70[_0xc39a('0x2f')][_0xc39a('0x46')]),'json':_0x48cd5e,'resolveWithFullResponse':!![],'encoding':_0x18cfc8,'body':_0xa10d70[_0xc39a('0x85')]};if(_0xa10d70[_0xc39a('0x9a')]){_0x5b4eb9[_0xc39a('0x9a')]=_0xa10d70['headers'];if(_0x5b4eb9[_0xc39a('0x9a')]['content-length']){delete _0x5b4eb9['headers']['content-length'];}}if(_0x5b4eb9[_0xc39a('0x9a')]['content-type']){delete _0x5b4eb9[_0xc39a('0x9a')][_0xc39a('0x9c')];}return rp(_0x5b4eb9);})[_0xc39a('0x21')](function(_0xb29322){if(_0xb29322){_0x1769fb['set'](_0xb29322['headers']);logger[_0xc39a('0x64')](_0xb29322['body']);return _0x1769fb[_0xc39a('0x18')](_0xb29322['statusCode'])[_0xc39a('0x8c')](_0xb29322[_0xc39a('0x85')]);}else{return _0x1769fb[_0xc39a('0x25')](0xc8);}})['catch'](handleError(_0x1769fb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d1a4844..2d3d062 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 _0x7278=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit'];(function(_0x3183e6,_0x2c0b14){var _0x17bcbb=function(_0x149b9d){while(--_0x149b9d){_0x3183e6['push'](_0x3183e6['shift']());}};_0x17bcbb(++_0x2c0b14);}(_0x7278,0x161));var _0x8727=function(_0x220b9d,_0x41d4cb){_0x220b9d=_0x220b9d-0x0;var _0x55893d=_0x7278[_0x220b9d];return _0x55893d;};'use strict';var EventEmitter=require(_0x8727('0x0'));var Plugin=require(_0x8727('0x1'))['db'][_0x8727('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8727('0x3')](0x0);var events={'afterCreate':_0x8727('0x4'),'afterUpdate':'update','afterDestroy':_0x8727('0x5')};function emitEvent(_0x19c8ac){return function(_0x6007de,_0x221021,_0x2df052){PluginEvents[_0x8727('0x6')](_0x19c8ac+':'+_0x6007de['id'],_0x6007de);PluginEvents[_0x8727('0x6')](_0x19c8ac,_0x6007de);_0x2df052(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8727('0x7')](e,emitEvent(event));}}module[_0x8727('0x8')]=PluginEvents; \ No newline at end of file +var _0xbe3b=['save','emit','hasOwnProperty','exports','../../mysqldb','Plugin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0xbe3b[_0x5d6270];return _0x168f26;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xbbe3('0x0'))['db'][_0xbbe3('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbbe3('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd0bba){return function(_0x497180,_0x5d74ec,_0x2688b2){PluginEvents[_0xbbe3('0x3')](_0xd0bba+':'+_0x497180['id'],_0x497180);PluginEvents[_0xbbe3('0x3')](_0xd0bba,_0x497180);_0x2688b2(null);};}for(var e in events){if(events[_0xbbe3('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xbbe3('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 7d70750..f0693cd 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 _0x354c=['plugins','lodash','api','moment','bluebird','request-promise','path','rimraf','define','Plugin'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0x354c,0x12d));var _0xc354=function(_0x131391,_0x1c520b){_0x131391=_0x131391-0x0;var _0x16d5ff=_0x354c[_0x131391];return _0x16d5ff;};'use strict';var _=require(_0xc354('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc354('0x1'));var moment=require(_0xc354('0x2'));var BPromise=require(_0xc354('0x3'));var rp=require(_0xc354('0x4'));var fs=require('fs');var path=require(_0xc354('0x5'));var rimraf=require(_0xc354('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x50288e,_0x1af7c1){return _0x50288e[_0xc354('0x7')](_0xc354('0x8'),attributes,{'tableName':_0xc354('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6cd=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x39b3bb,_0x13132b){var _0x20a2d3=function(_0x11fd24){while(--_0x11fd24){_0x39b3bb['push'](_0x39b3bb['shift']());}};_0x20a2d3(++_0x13132b);}(_0xf6cd,0x109));var _0xdf6c=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0xf6cd[_0x1dc01f];return _0x298041;};'use strict';var _=require(_0xdf6c('0x0'));var util=require(_0xdf6c('0x1'));var logger=require('../../config/logger')(_0xdf6c('0x2'));var moment=require(_0xdf6c('0x3'));var BPromise=require(_0xdf6c('0x4'));var rp=require(_0xdf6c('0x5'));var fs=require('fs');var path=require(_0xdf6c('0x6'));var rimraf=require(_0xdf6c('0x7'));var config=require(_0xdf6c('0x8'));var attributes=require(_0xdf6c('0x9'));module[_0xdf6c('0xa')]=function(_0x377c07,_0x46b008){return _0x377c07[_0xdf6c('0xb')](_0xdf6c('0xc'),attributes,{'tableName':_0xdf6c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index b8d9e7f..46c549b 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 _0x808d=['error','code','message','catch','Plugin','create','body','options','raw','CreatePlugin','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x808d,0x175));var _0xd808=function(_0x546f5a,_0x33b5f4){_0x546f5a=_0x546f5a-0x0;var _0xe37d84=_0x808d[_0x546f5a];return _0xe37d84;};'use strict';var _=require('lodash');var util=require(_0xd808('0x0'));var moment=require('moment');var BPromise=require(_0xd808('0x1'));var rs=require(_0xd808('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd808('0x3'));var logger=require(_0xd808('0x4'))(_0xd808('0x5'));var config=require(_0xd808('0x6'));var jayson=require(_0xd808('0x7'));var client=jayson[_0xd808('0x8')][_0xd808('0x9')]({'port':0x232a});config['redis']=_[_0xd808('0xa')](config[_0xd808('0xb')],{'host':_0xd808('0xc'),'port':0x18eb});var socket=require(_0xd808('0xd'))(new Redis(config[_0xd808('0xb')]));require(_0xd808('0xe'))['register'](socket);function respondWithRpcPromise(_0x24d73e,_0x421161,_0x38ac78){return new BPromise(function(_0xf4c75c,_0x1f19d8){return client[_0xd808('0xf')](_0x24d73e,_0x38ac78)[_0xd808('0x10')](function(_0x4a1582){logger[_0xd808('0x11')](_0xd808('0x12'),_0x421161,_0xd808('0x13'));logger[_0xd808('0x14')](_0xd808('0x15'),_0x421161,_0xd808('0x13'),JSON[_0xd808('0x16')](_0x4a1582));if(_0x4a1582[_0xd808('0x17')]){if(_0x4a1582[_0xd808('0x17')][_0xd808('0x18')]===0x1f4){logger[_0xd808('0x17')]('Plugin,\x20%s,\x20%s',_0x421161,_0x4a1582[_0xd808('0x17')][_0xd808('0x19')]);return _0x1f19d8(_0x4a1582[_0xd808('0x17')][_0xd808('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x421161,_0x4a1582[_0xd808('0x17')][_0xd808('0x19')]);return _0xf4c75c(_0x4a1582[_0xd808('0x17')][_0xd808('0x19')]);}else{logger[_0xd808('0x11')](_0xd808('0x12'),_0x421161,'request\x20sent');_0xf4c75c(_0x4a1582['result'][_0xd808('0x19')]);}})[_0xd808('0x1a')](function(_0x5d65b1){logger['error'](_0xd808('0x12'),_0x421161,_0x5d65b1);_0x1f19d8(_0x5d65b1);});});}exports['CreatePlugin']=function(_0x340db9){var _0x6fd045=this;return new Promise(function(_0x2ae07b,_0x2f80dc){return db[_0xd808('0x1b')][_0xd808('0x1c')](_0x340db9[_0xd808('0x1d')],{'raw':_0x340db9[_0xd808('0x1e')]?_0x340db9[_0xd808('0x1e')][_0xd808('0x1f')]===undefined?!![]:![]:!![]})[_0xd808('0x10')](function(_0x1142b3){logger[_0xd808('0x11')](_0xd808('0x20'),_0x340db9);logger[_0xd808('0x14')](_0xd808('0x20'),_0x340db9,JSON[_0xd808('0x16')](_0x1142b3));_0x2ae07b(_0x1142b3);})[_0xd808('0x1a')](function(_0x476343){logger[_0xd808('0x17')](_0xd808('0x20'),_0x476343[_0xd808('0x19')],_0x340db9);_0x2f80dc(_0x6fd045['error'](0x1f4,_0x476343[_0xd808('0x19')]));});});}; \ No newline at end of file +var _0xca41=['client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Plugin,\x20%s,\x20%s','result','Plugin','body','options','raw','CreatePlugin','debug','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4d10d9,_0x15a012){var _0x425024=function(_0x5f071c){while(--_0x5f071c){_0x4d10d9['push'](_0x4d10d9['shift']());}};_0x425024(++_0x15a012);}(_0xca41,0x129));var _0x1ca4=function(_0x1e986f,_0x5dd4f8){_0x1e986f=_0x1e986f-0x0;var _0x4b9b4b=_0xca41[_0x1e986f];return _0x4b9b4b;};'use strict';var _=require(_0x1ca4('0x0'));var util=require('util');var moment=require(_0x1ca4('0x1'));var BPromise=require(_0x1ca4('0x2'));var rs=require(_0x1ca4('0x3'));var fs=require('fs');var Redis=require(_0x1ca4('0x4'));var db=require(_0x1ca4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca4('0x6'))('rpc');var config=require(_0x1ca4('0x7'));var jayson=require(_0x1ca4('0x8'));var client=jayson[_0x1ca4('0x9')]['http']({'port':0x232a});config[_0x1ca4('0xa')]=_[_0x1ca4('0xb')](config[_0x1ca4('0xa')],{'host':_0x1ca4('0xc'),'port':0x18eb});var socket=require(_0x1ca4('0xd'))(new Redis(config[_0x1ca4('0xa')]));require(_0x1ca4('0xe'))[_0x1ca4('0xf')](socket);function respondWithRpcPromise(_0x46dc69,_0x39e5f0,_0x12e0e8){return new BPromise(function(_0x3ae3e1,_0x24dd52){return client[_0x1ca4('0x10')](_0x46dc69,_0x12e0e8)[_0x1ca4('0x11')](function(_0xdbb4cf){logger[_0x1ca4('0x12')]('Plugin,\x20%s,\x20%s',_0x39e5f0,'request\x20sent');logger['debug'](_0x1ca4('0x13'),_0x39e5f0,_0x1ca4('0x14'),JSON['stringify'](_0xdbb4cf));if(_0xdbb4cf['error']){if(_0xdbb4cf[_0x1ca4('0x15')][_0x1ca4('0x16')]===0x1f4){logger[_0x1ca4('0x15')]('Plugin,\x20%s,\x20%s',_0x39e5f0,_0xdbb4cf[_0x1ca4('0x15')][_0x1ca4('0x17')]);return _0x24dd52(_0xdbb4cf[_0x1ca4('0x15')]['message']);}logger['error'](_0x1ca4('0x18'),_0x39e5f0,_0xdbb4cf[_0x1ca4('0x15')][_0x1ca4('0x17')]);return _0x3ae3e1(_0xdbb4cf['error'][_0x1ca4('0x17')]);}else{logger[_0x1ca4('0x12')](_0x1ca4('0x18'),_0x39e5f0,_0x1ca4('0x14'));_0x3ae3e1(_0xdbb4cf[_0x1ca4('0x19')][_0x1ca4('0x17')]);}})['catch'](function(_0x3cd012){logger[_0x1ca4('0x15')](_0x1ca4('0x18'),_0x39e5f0,_0x3cd012);_0x24dd52(_0x3cd012);});});}exports['CreatePlugin']=function(_0x51ac2c){var _0x529e09=this;return new Promise(function(_0x4a51cd,_0x1cde50){return db[_0x1ca4('0x1a')]['create'](_0x51ac2c[_0x1ca4('0x1b')],{'raw':_0x51ac2c['options']?_0x51ac2c[_0x1ca4('0x1c')][_0x1ca4('0x1d')]===undefined?!![]:![]:!![]})[_0x1ca4('0x11')](function(_0xa56acf){logger['info'](_0x1ca4('0x1e'),_0x51ac2c);logger[_0x1ca4('0x1f')](_0x1ca4('0x1e'),_0x51ac2c,JSON[_0x1ca4('0x20')](_0xa56acf));_0x4a51cd(_0xa56acf);})[_0x1ca4('0x21')](function(_0x4385bf){logger[_0x1ca4('0x15')](_0x1ca4('0x1e'),_0x4385bf[_0x1ca4('0x17')],_0x51ac2c);_0x1cde50(_0x529e09['error'](0x1f4,_0x4385bf[_0x1ca4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3da7007..2e5d705 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 _0x675c=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x675c,0x1c6));var _0xc675=function(_0x524971,_0x287733){_0x524971=_0x524971-0x0;var _0x2110e2=_0x675c[_0x524971];return _0x2110e2;};'use strict';var PluginEvents=require(_0xc675('0x0'));var events=[_0xc675('0x1'),_0xc675('0x2'),_0xc675('0x3')];function createListener(_0x83ec82,_0x138b65){return function(_0x3f3029){_0x138b65[_0xc675('0x4')](_0x83ec82,_0x3f3029);};}function removeListener(_0x1536c4,_0x2ffeeb){return function(){PluginEvents[_0xc675('0x5')](_0x1536c4,_0x2ffeeb);};}exports[_0xc675('0x6')]=function(_0x111d27){for(var _0x3b0b73=0x0,_0x3b32e8=events[_0xc675('0x7')];_0x3b0b73<_0x3b32e8;_0x3b0b73++){var _0x208b36=events[_0x3b0b73];var _0x21483f=createListener(_0xc675('0x8')+_0x208b36,_0x111d27);PluginEvents['on'](_0x208b36,_0x21483f);}}; \ No newline at end of file +var _0x68a1=['emit','removeListener','register','length','plugin:','save','remove'];(function(_0x5ccaea,_0xbb3452){var _0x555120=function(_0x4849f7){while(--_0x4849f7){_0x5ccaea['push'](_0x5ccaea['shift']());}};_0x555120(++_0xbb3452);}(_0x68a1,0x155));var _0x168a=function(_0x400d15,_0x364b03){_0x400d15=_0x400d15-0x0;var _0x293f60=_0x68a1[_0x400d15];return _0x293f60;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x168a('0x0'),_0x168a('0x1'),'update'];function createListener(_0x468e9c,_0x562d76){return function(_0xae76fd){_0x562d76[_0x168a('0x2')](_0x468e9c,_0xae76fd);};}function removeListener(_0x1a43f3,_0x365b19){return function(){PluginEvents[_0x168a('0x3')](_0x1a43f3,_0x365b19);};}exports[_0x168a('0x4')]=function(_0x21c1e7){for(var _0x7c3177=0x0,_0x2164a3=events[_0x168a('0x5')];_0x7c3177<_0x2164a3;_0x7c3177++){var _0x5af924=events[_0x7c3177];var _0x4c4ddb=createListener(_0x168a('0x6')+_0x5af924,_0x21c1e7);PluginEvents['on'](_0x5af924,_0x4c4ddb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 68a52f2..4fb9be1 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(_0x52a804,_0x393234){var _0x72b338=function(_0x56b53d){while(--_0x56b53d){_0x52a804['push'](_0x52a804['shift']());}};_0x72b338(++_0x393234);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x1cc9c7,_0x541990){var _0xba966a=function(_0x150cf0){while(--_0x150cf0){_0x1cc9c7['push'](_0x1cc9c7['shift']());}};_0xba966a(++_0x541990);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 913a883..975e1d2 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 _0x76dc=['catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','json','stack','name','status','npm\x20install','info','error','index','list','then','reject','express','motion2','describe','params'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x76dc,0x1f2));var _0xc76d=function(_0x37dee0,_0x2739bf){_0x37dee0=_0x37dee0-0x0;var _0x466bc5=_0x76dc[_0x37dee0];return _0x466bc5;};'use strict';var _=require(_0xc76d('0x0'));var pm2=require(_0xc76d('0x1'));var logger=require(_0xc76d('0x2'))(_0xc76d('0x3'));var path=require('path');var exec=require(_0xc76d('0x4'))[_0xc76d('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x300f11,_0x50ed3a){return function(_0x507ea7){if(!_0x507ea7){_0x300f11[_0xc76d('0x6')](0x194);;}return _0x507ea7;};}function respondWithResult(_0x29ab70,_0x1c86fc){_0x1c86fc=_0x1c86fc||0xc8;return function(_0x4832bd){if(_0x4832bd){return _0x29ab70['status'](_0x1c86fc)[_0xc76d('0x7')](_0x4832bd);}return null;};}function handleError(_0x114572,_0x18574f){_0x18574f=_0x18574f||0x1f4;return function(_0x532d6a){logger['error'](_0x532d6a[_0xc76d('0x8')]);if(_0x532d6a[_0xc76d('0x9')]){delete _0x532d6a['name'];}_0x114572[_0xc76d('0xa')](_0x18574f)['send'](_0x532d6a);};}function execChildProcess(){return new BPromise(function(_0xd5c042,_0x2e1807){exec(_0xc76d('0xb'),function(_0x95e06b,_0x3f59ea,_0x193c4a){logger[_0xc76d('0xc')](_0x3f59ea);logger[_0xc76d('0xc')](_0x193c4a);if(_0x95e06b){logger[_0xc76d('0xd')](_0x95e06b);return _0x2e1807(_0x95e06b);}return _0xd5c042(_0x3f59ea);});});}exports[_0xc76d('0xe')]=function(_0x1a7b47,_0x24e88e){return pm2[_0xc76d('0xf')]()[_0xc76d('0x10')](function(_0x5cda20){if(_0x5cda20){var _0x8696db=_[_0xc76d('0x11')](_0x5cda20,function(_0x5bbed9){return _0x5bbed9[_0xc76d('0x9')]===_0xc76d('0x12')||_0x5bbed9[_0xc76d('0x9')]===_0xc76d('0x13');});return{'rows':_0x8696db,'count':_0x8696db['length']};}return null;})[_0xc76d('0x10')](respondWithResult(_0x24e88e,null))['catch'](handleError(_0x24e88e,null));};exports['show']=function(_0x45a83e,_0x31b032){return pm2[_0xc76d('0x14')](_0x45a83e[_0xc76d('0x15')]['id'])[_0xc76d('0x10')](respondWithResult(_0x31b032,null))['then'](handleEntityNotFound(_0x31b032,null))[_0xc76d('0x16')](handleError(_0x31b032,null));};exports[_0xc76d('0x17')]=function(_0xa0c5b6,_0x1c6d5b){if(_0xa0c5b6[_0xc76d('0x18')]['name']&&_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x19')]){var _0x5dffde=path[_0xc76d('0x1a')](__dirname,_0xc76d('0x1b'),_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x19')]);var _0x18f546=process[_0xc76d('0x1c')]();process[_0xc76d('0x1d')](path[_0xc76d('0x1e')](_0x5dffde));return execChildProcess()[_0xc76d('0x10')](function(_0x20e09c){process[_0xc76d('0x1d')](_0x18f546);return pm2['start']({'name':_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x9')],'script':_0x5dffde});})['then'](function(_0x637d68){pm2[_0xc76d('0x1f')]();return _0x637d68[0x0];})['then'](respondWithResult(_0x1c6d5b,0xc9))[_0xc76d('0x16')](handleError(_0x1c6d5b,null));}else{return _0x1c6d5b[_0xc76d('0xa')](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x21')});}};exports[_0xc76d('0x22')]=function(_0x1949c4,_0x89ee5){if(_0x1949c4['body']['id']){delete _0x1949c4['body']['id'];}var _0x285430={'online':_0xc76d('0x23'),'stopped':'stop'};if(_0x285430[_0xc76d('0x24')](_0x1949c4[_0xc76d('0x18')][_0xc76d('0xa')])){return pm2[_0x285430[_0x1949c4['body'][_0xc76d('0xa')]]](_0x1949c4['params']['id'])[_0xc76d('0x10')](respondWithResult(_0x89ee5,0xc8))[_0xc76d('0x16')](handleError(_0x89ee5,null));}else{return _0x89ee5['status'](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x25')});}};exports[_0xc76d('0x26')]=function(_0x2cf501,_0x4feeda){if(_0x2cf501[_0xc76d('0x18')]['id']){delete _0x2cf501['body']['id'];}if(_0x2cf501[_0xc76d('0x15')]['id']){return pm2['delete'](_0x2cf501[_0xc76d('0x15')]['id'])[_0xc76d('0x10')](function(_0x5dc369){pm2['dump']();return _0x5dc369[0x0];})['then'](respondWithResult(_0x4feeda,null))['catch'](handleError(_0x4feeda,null));}else{return _0x4feeda[_0xc76d('0xa')](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x27')});}}; \ No newline at end of file +var _0xbf6e=['start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname'];(function(_0x132d90,_0x5521a8){var _0x5be24a=function(_0x40fa6c){while(--_0x40fa6c){_0x132d90['push'](_0x132d90['shift']());}};_0x5be24a(++_0x5521a8);}(_0xbf6e,0x149));var _0xebf6=function(_0x2a6b3a,_0x460cc6){_0x2a6b3a=_0x2a6b3a-0x0;var _0x2fdc65=_0xbf6e[_0x2a6b3a];return _0x2fdc65;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));var path=require(_0xebf6('0x2'));var exec=require(_0xebf6('0x3'))[_0xebf6('0x4')];var BPromise=require(_0xebf6('0x5'));function handleEntityNotFound(_0x5c2323,_0x49de28){return function(_0x2b0c61){if(!_0x2b0c61){_0x5c2323[_0xebf6('0x6')](0x194);;}return _0x2b0c61;};}function respondWithResult(_0x3b2bb6,_0x1e15cf){_0x1e15cf=_0x1e15cf||0xc8;return function(_0x143344){if(_0x143344){return _0x3b2bb6[_0xebf6('0x7')](_0x1e15cf)[_0xebf6('0x8')](_0x143344);}return null;};}function handleError(_0x548e9e,_0x1d8035){_0x1d8035=_0x1d8035||0x1f4;return function(_0x40b28a){logger[_0xebf6('0x9')](_0x40b28a['stack']);if(_0x40b28a[_0xebf6('0xa')]){delete _0x40b28a[_0xebf6('0xa')];}_0x548e9e['status'](_0x1d8035)[_0xebf6('0xb')](_0x40b28a);};}function execChildProcess(){return new BPromise(function(_0x231d6b,_0x474dbe){exec(_0xebf6('0xc'),function(_0x1bd481,_0x36f588,_0x47ee12){logger[_0xebf6('0xd')](_0x36f588);logger[_0xebf6('0xd')](_0x47ee12);if(_0x1bd481){logger['error'](_0x1bd481);return _0x474dbe(_0x1bd481);}return _0x231d6b(_0x36f588);});});}exports[_0xebf6('0xe')]=function(_0x101a6c,_0x20c9ce){return pm2[_0xebf6('0xf')]()[_0xebf6('0x10')](function(_0x4dbf51){if(_0x4dbf51){var _0x4c01f4=_['reject'](_0x4dbf51,function(_0x4cecbc){return _0x4cecbc[_0xebf6('0xa')]==='express'||_0x4cecbc[_0xebf6('0xa')]===_0xebf6('0x11');});return{'rows':_0x4c01f4,'count':_0x4c01f4[_0xebf6('0x12')]};}return null;})[_0xebf6('0x10')](respondWithResult(_0x20c9ce,null))[_0xebf6('0x13')](handleError(_0x20c9ce,null));};exports[_0xebf6('0x14')]=function(_0x219621,_0x2dc96f){return pm2[_0xebf6('0x15')](_0x219621[_0xebf6('0x16')]['id'])['then'](respondWithResult(_0x2dc96f,null))['then'](handleEntityNotFound(_0x2dc96f,null))[_0xebf6('0x13')](handleError(_0x2dc96f,null));};exports[_0xebf6('0x17')]=function(_0x10051e,_0x410f06){if(_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')]&&_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]){var _0x4fb497=path[_0xebf6('0x1a')](__dirname,_0xebf6('0x1b'),_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]);var _0x6303ac=process[_0xebf6('0x1c')]();process[_0xebf6('0x1d')](path[_0xebf6('0x1e')](_0x4fb497));return execChildProcess()[_0xebf6('0x10')](function(_0x2e32c6){process[_0xebf6('0x1d')](_0x6303ac);return pm2[_0xebf6('0x1f')]({'name':_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')],'script':_0x4fb497});})[_0xebf6('0x10')](function(_0x1d0078){pm2[_0xebf6('0x20')]();return _0x1d0078[0x0];})[_0xebf6('0x10')](respondWithResult(_0x410f06,0xc9))[_0xebf6('0x13')](handleError(_0x410f06,null));}else{return _0x410f06['status'](0x1f4)['send']({'message':_0xebf6('0x21')});}};exports['update']=function(_0x230d84,_0x430eb7){if(_0x230d84['body']['id']){delete _0x230d84['body']['id'];}var _0x37950c={'online':_0xebf6('0x22'),'stopped':_0xebf6('0x23')};if(_0x37950c[_0xebf6('0x24')](_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')])){return pm2[_0x37950c[_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')]]](_0x230d84['params']['id'])[_0xebf6('0x10')](respondWithResult(_0x430eb7,0xc8))[_0xebf6('0x13')](handleError(_0x430eb7,null));}else{return _0x430eb7['status'](0x1f4)[_0xebf6('0xb')]({'message':_0xebf6('0x25')});}};exports['destroy']=function(_0x2901fc,_0x1fa407){if(_0x2901fc[_0xebf6('0x18')]['id']){delete _0x2901fc[_0xebf6('0x18')]['id'];}if(_0x2901fc[_0xebf6('0x16')]['id']){return pm2[_0xebf6('0x26')](_0x2901fc['params']['id'])[_0xebf6('0x10')](function(_0x34cc38){pm2['dump']();return _0x34cc38[0x0];})['then'](respondWithResult(_0x1fa407,null))[_0xebf6('0x13')](handleError(_0x1fa407,null));}else{return _0x1fa407[_0xebf6('0x7')](0x1f4)['send']({'message':_0xebf6('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 39590dd..1f253eb 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 _0x2a5e=['get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x2b1046,_0x4033e5){var _0x2bb298=function(_0x255987){while(--_0x255987){_0x2b1046['push'](_0x2b1046['shift']());}};_0x2bb298(++_0x4033e5);}(_0x2a5e,0x93));var _0xe2a5=function(_0x3bb53b,_0x1fe88a){_0x3bb53b=_0x3bb53b-0x0;var _0x4d4058=_0x2a5e[_0x3bb53b];return _0x4d4058;};'use strict';var express=require(_0xe2a5('0x0'));var router=express[_0xe2a5('0x1')]();var auth=require(_0xe2a5('0x2'));var controller=require('./realtime.controller');router[_0xe2a5('0x3')](_0xe2a5('0x4'),auth[_0xe2a5('0x5')](),controller[_0xe2a5('0x6')]);router['get'](_0xe2a5('0x7'),auth['isAuthenticated'](),controller[_0xe2a5('0x8')]);module[_0xe2a5('0x9')]=router; \ No newline at end of file +var _0x6bfb=['Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express'];(function(_0xd7e288,_0x3875de){var _0x1f243a=function(_0x54301a){while(--_0x54301a){_0xd7e288['push'](_0xd7e288['shift']());}};_0x1f243a(++_0x3875de);}(_0x6bfb,0x13f));var _0xb6bf=function(_0x316775,_0x8ba50a){_0x316775=_0x316775-0x0;var _0x2e39be=_0x6bfb[_0x316775];return _0x2e39be;};'use strict';var express=require(_0xb6bf('0x0'));var router=express[_0xb6bf('0x1')]();var auth=require(_0xb6bf('0x2'));var controller=require('./realtime.controller');router[_0xb6bf('0x3')](_0xb6bf('0x4'),auth[_0xb6bf('0x5')](),controller[_0xb6bf('0x6')]);router[_0xb6bf('0x3')](_0xb6bf('0x7'),auth[_0xb6bf('0x5')](),controller[_0xb6bf('0x8')]);module[_0xb6bf('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 25479f1..b3a45ec 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 _0x0f15=['globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getAgentIdsByStatus','length','map','fieldName','type','key','role','agent','getOptions','raw','push','sequelize','FIELD(id,','forEach','Pause','where','merge','user','Agents','online','extraQueryConditions','assign','omit','getResources','User','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','rows','pick','getQueues','resolve','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','rawAttributes','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns','name','filter','UserProfile','findAndCountAll','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/agents','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','isValidChannel','channel','toLowerCase','sort','includes'];(function(_0x69e3d2,_0x36ce0d){var _0x1371a9=function(_0x1b7b2d){while(--_0x1b7b2d){_0x69e3d2['push'](_0x69e3d2['shift']());}};_0x1371a9(++_0x36ce0d);}(_0x0f15,0x1a1));var _0x50f1=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x0f15[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0x50f1('0x0'));var rta=require(_0x50f1('0x1'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x50f1('0x2'));var db=require(_0x50f1('0x3'))['db'];var APIBadRequestError=require('../../errors/api')[_0x50f1('0x4')];var APIHandleError=require(_0x50f1('0x5'))[_0x50f1('0x6')];function respondWithFilteredResult(_0x1e0f45,_0x5f3282){return function(_0x3bcb00){if(_0x3bcb00){var _0x5d94fe=typeof _0x5f3282[_0x50f1('0x7')]===_0x50f1('0x8')&&typeof _0x5f3282['limit']===_0x50f1('0x8');var _0x537e81=_0x3bcb00[_0x50f1('0x9')];var _0x3364b8=_0x5d94fe?0x0:_0x5f3282[_0x50f1('0x7')];var _0xa0322=_0x5d94fe?_0x3bcb00[_0x50f1('0x9')]:_0x5f3282['offset']+_0x5f3282[_0x50f1('0xa')];var _0x38e2a4;if(_0xa0322>=_0x537e81){_0xa0322=_0x537e81;_0x38e2a4=0xc8;}else{_0x38e2a4=0xce;}_0x1e0f45[_0x50f1('0xb')](_0x38e2a4);return _0x1e0f45[_0x50f1('0xc')](_0x50f1('0xd'),_0x3364b8+'-'+_0xa0322+'/'+_0x537e81)[_0x50f1('0xe')](_0x3bcb00);}return null;};}exports[_0x50f1('0xf')]=function(_0x35513f,_0xcb213f){var _0x194184={'count':0x0,'rows':[]};var _0xe78987={};var _0x2c5056;var _0x15a56b=utils[_0x50f1('0x10')]();var _0x3098e6;var _0x384f3c;var _0x5a460f=_0x35513f[_0x50f1('0x11')][_0x50f1('0x12')];var _0x27f2e6=_0x35513f[_0x50f1('0x11')][_0x50f1('0x13')];var _0x4ef5e0=_0x35513f[_0x50f1('0x11')][_0x50f1('0x14')];var _0x1ac273=_0x27f2e6===_0x50f1('0x15')||_0x27f2e6===_0x50f1('0x16')?!![]:![];var _0x1e5fc9=[];var _0xa9c056;var _0x14838f;Promise['resolve']()['then'](function(){if(_0x35513f[_0x50f1('0x11')]['channel']){if(!utils[_0x50f1('0x17')](_0x35513f[_0x50f1('0x11')][_0x50f1('0x18')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x35513f['query'][_0x50f1('0x18')]));}_0x2c5056=_0x35513f[_0x50f1('0x11')][_0x50f1('0x18')][_0x50f1('0x19')]();}if(!_0x35513f[_0x50f1('0x11')][_0x50f1('0x1a')]||!_0x35513f[_0x50f1('0x11')][_0x50f1('0x1a')][_0x50f1('0x1b')](_0x50f1('0x1c'))){_0x35513f[_0x50f1('0x11')][_0x50f1('0x1a')]=rta[_0x50f1('0x1d')](_0x35513f['query'][_0x50f1('0x1a')]);return;}var _0x5b778e=rta[_0x50f1('0x1e')](_0x35513f['query']['sort']);_0x35513f[_0x50f1('0x11')][_0x50f1('0x1a')]=_0x5b778e[_0x50f1('0x1f')][_0x50f1('0x20')](',');_0xa9c056=_0x5b778e[_0x50f1('0x21')];})[_0x50f1('0x22')](function(){if(!_0x5a460f){return[];}return rta[_0x50f1('0x23')](_0x5a460f,_0x2c5056);})['then'](function(_0x18d481){_0x1e5fc9=_0x18d481;return rta['getRealtimeAgents']();})['then'](function(_0xfb16d){_0x384f3c=_0xfb16d['rows'];if((!_0x27f2e6||_0x1ac273)&&!_0xa9c056){return _0x1e5fc9;}if(_0xa9c056&&!_0x27f2e6){return rta['getSortedAgentsIdsByStatus'](_0x384f3c,_0x1e5fc9,_0xa9c056);}else{return rta[_0x50f1('0x24')](_0x384f3c,_0x1e5fc9,_0x27f2e6);}})['then'](function(_0x18bdaf){_0x1e5fc9=_0x18bdaf;var _0xf6866c=![];if(_0x1e5fc9[_0x50f1('0x25')]===0x0){if(_0x5a460f||_0x27f2e6){_0xf6866c=!![];}if(_0x1ac273){_0xf6866c=![];}}if(_0xf6866c){return _0x194184;}var _0x588d39=_[_0x50f1('0x26')](db['User']['rawAttributes'],function(_0x200e93){return{'name':_0x200e93[_0x50f1('0x27')],'type':_0x200e93[_0x50f1('0x28')][_0x50f1('0x29')]};});_0x35513f[_0x50f1('0x11')][_0x50f1('0x2a')]=_0x50f1('0x2b');_0xe78987=qs[_0x50f1('0x2c')](_0x588d39,_0x35513f);_0xe78987[_0x50f1('0x2d')]=!![];var _0x104737=[];if(_0x1e5fc9[_0x50f1('0x25')]>0x0){_0x104737[_0x50f1('0x2e')]({'id':{'$in':_0x1e5fc9}});if(_0xa9c056&&!_0x27f2e6){_0x14838f=[db[_0x50f1('0x2f')]['literal'](_0x50f1('0x30')+_0x1e5fc9+')')];_0xe78987[_0x50f1('0x21')]=_0x14838f;}}if(_0x1ac273){_0x15a56b[_0x50f1('0x31')](function(_0x1edc1e){var _0x15ae33=!![];if(_0x27f2e6===_0x50f1('0x16')&&_0x2c5056!==_0x1edc1e){_0x15ae33=![];}_0x104737[_0x50f1('0x2e')]({[_0x1edc1e+_0x50f1('0x32')]:_0x15ae33});});if(_0x4ef5e0){_0x104737[_0x50f1('0x2e')]({'pauseType':_0x4ef5e0});}}else if(_0x27f2e6){_0x15a56b[_0x50f1('0x31')](function(_0x1adfd9){_0x104737[_0x50f1('0x2e')]({[_0x1adfd9+_0x50f1('0x32')]:![]});});}_0xe78987[_0x50f1('0x33')]=_[_0x50f1('0x34')](_0xe78987['where'],{'$and':_0x104737});if(_0x35513f['user']['role']===_0x50f1('0x35')){var _0x403c75={'params':{'id':_0x35513f[_0x50f1('0x35')]['userProfileId']},'query':{'section':_0x50f1('0x36'),'role':'agent','raw':!![],'ids':_0x1e5fc9,'customSorting':_0x14838f}};if(_0x35513f[_0x50f1('0x11')][_0x50f1('0x37')]){_0x403c75[_0x50f1('0x11')][_0x50f1('0x37')]=!![];}if(_0x1ac273){_0x403c75[_0x50f1('0x11')][_0x50f1('0x38')]=_0x104737;}_0x403c75[_0x50f1('0x11')]=Object[_0x50f1('0x39')](_0x403c75[_0x50f1('0x11')],_[_0x50f1('0x3a')](_0x35513f[_0x50f1('0x11')],'id'));return db['UserProfile'][_0x50f1('0x3b')](_0x403c75);}return db[_0x50f1('0x3c')]['findAndCountAll'](_0xe78987);})[_0x50f1('0x22')](function(_0x2e1c3f){_0x194184[_0x50f1('0x9')]=_0x2e1c3f['count'];_0x3098e6=_0x2e1c3f['rows'];return _0x3098e6['map'](function(_0x2c7fac){var _0x3129e3=_[_0x50f1('0x3d')](_0x384f3c,['id',_0x2c7fac['id']]);if(_0x3129e3){var _0x59fe9f=rta[_0x50f1('0x3e')](_0x3129e3);_['merge'](_0x2c7fac,_0x59fe9f);}_0x2c7fac['globalStatus']=rta[_0x50f1('0x3f')](_0x2c7fac);if(_0x2c7fac[_0x50f1('0x1c')][_0x50f1('0x1b')](_0x50f1('0x15'))){_0x15a56b[_0x50f1('0x31')](function(_0x48c0cf){if(_0x2c7fac[_0x48c0cf+_0x50f1('0x32')]){if(_0x48c0cf===_0x50f1('0x40')){if(_0x2c7fac[_0x50f1('0x41')]!=='talking'){_0x2c7fac['voiceStatus']=_0x50f1('0x15');}}else{_0x2c7fac[_0x48c0cf+_0x50f1('0x42')]=_0x50f1('0x15');}}});}return _0x2c7fac;});})[_0x50f1('0x22')](function(_0x6d36d4){if(!_0xa9c056||_0x14838f){return _0x6d36d4;}return rta[_0x50f1('0x43')](_0x6d36d4,_0xa9c056);})[_0x50f1('0x22')](function(_0x309780){var _0x395d8d=rta[_0x50f1('0x44')]();_0x194184[_0x50f1('0x45')]=_0x309780[_0x50f1('0x26')](function(_0x61b9fa){return _[_0x50f1('0x46')](_0x61b9fa,_0x395d8d);});return _0x194184;})[_0x50f1('0x22')](respondWithFilteredResult(_0xcb213f,_0xe78987))['catch'](APIHandleError(_0xcb213f));};exports[_0x50f1('0x47')]=function(_0x3aa14d,_0x250742){var _0x7a3325={'count':0x0,'rows':[]};var _0x6736f6={};var _0x3d4a1c;var _0x278f4b;var _0x362099;Promise[_0x50f1('0x48')]()[_0x50f1('0x22')](function(){if(_0x3aa14d[_0x50f1('0x11')]['channel']){if(!utils['isValidChannel'](_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x18')])){throw new APIBadRequestError(util['format'](_0x50f1('0x49'),_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x18')]));}_0x3d4a1c=_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x18')][_0x50f1('0x19')]();}var _0x2facf6=_[_0x50f1('0x4a')](_0x3d4a1c)+_0x50f1('0x4b');var _0x23f1b3=_['map'](db[_0x2facf6][_0x50f1('0x4c')],function(_0x2db53b){return{'name':_0x2db53b[_0x50f1('0x27')],'type':_0x2db53b[_0x50f1('0x28')][_0x50f1('0x29')]};});if(!_0x3aa14d[_0x50f1('0x11')]['fields']){var _0x112c41=['id','name'];if(_0x3d4a1c===_0x50f1('0x40')){_0x112c41[_0x50f1('0x2e')]('type');if(_0x3aa14d[_0x50f1('0x11')]['type']===_0x50f1('0x4d')){_0x112c41[_0x50f1('0x2e')]([_0x50f1('0x4e'),_0x50f1('0x4f')]);}}_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x1f')]=_0x112c41[_0x50f1('0x20')](',');}_0x6736f6=qs[_0x50f1('0x2c')](_0x23f1b3,_0x3aa14d);if(_0x3aa14d[_0x50f1('0x35')][_0x50f1('0x2a')]===_0x50f1('0x35')){var _0x575d89={'params':{'id':_0x3aa14d[_0x50f1('0x35')][_0x50f1('0x50')]},'query':{'section':_0x3d4a1c===_0x50f1('0x40')&&_0x3aa14d['query'][_0x50f1('0x28')]===_0x50f1('0x4d')?_0x50f1('0x51'):_[_0x50f1('0x4a')](_0x3d4a1c)+'Queues','type':_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x28')],'nolimit':!![],'sort':_0x50f1('0x52'),'filter':_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x53')]}};_0x575d89[_0x50f1('0x11')]=Object[_0x50f1('0x39')](_0x575d89[_0x50f1('0x11')],_0x3aa14d[_0x50f1('0x11')]);delete _0x575d89[_0x50f1('0x11')]['id'];return db[_0x50f1('0x54')][_0x50f1('0x3b')](_0x575d89);}return db[_0x2facf6][_0x50f1('0x55')](_0x6736f6);})[_0x50f1('0x22')](function(_0x315afe){_0x7a3325['count']=_0x315afe[_0x50f1('0x9')];_0x278f4b=_0x315afe[_0x50f1('0x45')];return rtq[_0x50f1('0x56')](_0x3aa14d,_0x3d4a1c);})[_0x50f1('0x22')](function(_0x3dce8a){_0x362099=_0x3dce8a[_0x50f1('0x45')];return rtq[_0x50f1('0x57')](_0x278f4b,_0x362099,_0x3d4a1c,_0x3aa14d[_0x50f1('0x11')][_0x50f1('0x28')]);})['then'](function(_0x191b07){_0x7a3325[_0x50f1('0x45')]=_0x191b07;return _0x7a3325;})[_0x50f1('0x22')](respondWithFilteredResult(_0x250742,_0x6736f6))[_0x50f1('0x58')](APIHandleError(_0x250742));}; \ No newline at end of file +var _0x20c0=['filter','UserProfile','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','order','getAgentIdsByQueues','then','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','raw','push','sequelize','literal','FIELD(id,','*pause','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','omit','findAndCountAll','rows','map','find','filterAgentAttributes','getAgentStatus','pause','forEach','voiceStatus','sortAgentsByStatus','pick','getQueues','startCase','Queue','fields','name','voice','outbound','dialMethod','join','getOptions','Queues'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x20c0,0x165));var _0x020c=function(_0x5ea4f4,_0x23908f){_0x5ea4f4=_0x5ea4f4-0x0;var _0x1c2530=_0x20c0[_0x5ea4f4];return _0x1c2530;};'use strict';var _=require('lodash');var util=require(_0x020c('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x020c('0x1'));var qs=require(_0x020c('0x2'));var utils=require(_0x020c('0x3'));var db=require(_0x020c('0x4'))['db'];var APIBadRequestError=require(_0x020c('0x5'))[_0x020c('0x6')];var APIHandleError=require(_0x020c('0x5'))[_0x020c('0x7')];function respondWithFilteredResult(_0x5bdd80,_0x452b41){return function(_0x3260c8){if(_0x3260c8){var _0x4f1828=typeof _0x452b41[_0x020c('0x8')]==='undefined'&&typeof _0x452b41[_0x020c('0x9')]===_0x020c('0xa');var _0x1972cc=_0x3260c8[_0x020c('0xb')];var _0x917366=_0x4f1828?0x0:_0x452b41[_0x020c('0x8')];var _0x54a503=_0x4f1828?_0x3260c8[_0x020c('0xb')]:_0x452b41['offset']+_0x452b41[_0x020c('0x9')];var _0x13ee22;if(_0x54a503>=_0x1972cc){_0x54a503=_0x1972cc;_0x13ee22=0xc8;}else{_0x13ee22=0xce;}_0x5bdd80[_0x020c('0xc')](_0x13ee22);return _0x5bdd80[_0x020c('0xd')]('Content-Range',_0x917366+'-'+_0x54a503+'/'+_0x1972cc)[_0x020c('0xe')](_0x3260c8);}return null;};}exports[_0x020c('0xf')]=function(_0x5c7b2f,_0x58e105){var _0x236b30={'count':0x0,'rows':[]};var _0x1ccff6={};var _0x10f34a;var _0x55c1aa=utils[_0x020c('0x10')]();var _0x47962e;var _0x277547;var _0x14345f=_0x5c7b2f[_0x020c('0x11')]['globalQueueFilter'];var _0x3723e1=_0x5c7b2f[_0x020c('0x11')][_0x020c('0x12')];var _0x3d9d0f=_0x5c7b2f[_0x020c('0x11')][_0x020c('0x13')];var _0x434a03=_0x3723e1==='pause'||_0x3723e1==='*pause'?!![]:![];var _0x5b8e3b=[];var _0x3c0d58;var _0x4d29e2;Promise[_0x020c('0x14')]()['then'](function(){if(_0x5c7b2f[_0x020c('0x11')][_0x020c('0x15')]){if(!utils[_0x020c('0x16')](_0x5c7b2f['query'][_0x020c('0x15')])){throw new APIBadRequestError(util[_0x020c('0x17')](_0x020c('0x18'),_0x5c7b2f[_0x020c('0x11')][_0x020c('0x15')]));}_0x10f34a=_0x5c7b2f[_0x020c('0x11')][_0x020c('0x15')][_0x020c('0x19')]();}if(!_0x5c7b2f['query']['sort']||!_0x5c7b2f[_0x020c('0x11')][_0x020c('0x1a')][_0x020c('0x1b')](_0x020c('0x1c'))){_0x5c7b2f[_0x020c('0x11')][_0x020c('0x1a')]=rta[_0x020c('0x1d')](_0x5c7b2f[_0x020c('0x11')][_0x020c('0x1a')]);return;}var _0x7df83a=rta[_0x020c('0x1e')](_0x5c7b2f['query'][_0x020c('0x1a')]);_0x5c7b2f['query'][_0x020c('0x1a')]=_0x7df83a['fields']['join'](',');_0x3c0d58=_0x7df83a[_0x020c('0x1f')];})['then'](function(){if(!_0x14345f){return[];}return rta[_0x020c('0x20')](_0x14345f,_0x10f34a);})[_0x020c('0x21')](function(_0x1d4510){_0x5b8e3b=_0x1d4510;return rta[_0x020c('0x22')]();})[_0x020c('0x21')](function(_0x4e9417){_0x277547=_0x4e9417['rows'];if((!_0x3723e1||_0x434a03)&&!_0x3c0d58){return _0x5b8e3b;}if(_0x3c0d58&&!_0x3723e1){return rta[_0x020c('0x23')](_0x277547,_0x5b8e3b,_0x3c0d58);}else{return rta[_0x020c('0x24')](_0x277547,_0x5b8e3b,_0x3723e1);}})[_0x020c('0x21')](function(_0x29131c){_0x5b8e3b=_0x29131c;var _0x510506=![];if(_0x5b8e3b[_0x020c('0x25')]===0x0){if(_0x14345f||_0x3723e1){_0x510506=!![];}if(_0x434a03){_0x510506=![];}}if(_0x510506){return _0x236b30;}var _0x21017d=_['map'](db[_0x020c('0x26')][_0x020c('0x27')],function(_0x131eab){return{'name':_0x131eab[_0x020c('0x28')],'type':_0x131eab[_0x020c('0x29')][_0x020c('0x2a')]};});_0x5c7b2f[_0x020c('0x11')][_0x020c('0x2b')]=_0x020c('0x2c');_0x1ccff6=qs['getOptions'](_0x21017d,_0x5c7b2f);_0x1ccff6[_0x020c('0x2d')]=!![];var _0x3fd577=[];if(_0x5b8e3b[_0x020c('0x25')]>0x0){_0x3fd577[_0x020c('0x2e')]({'id':{'$in':_0x5b8e3b}});if(_0x3c0d58&&!_0x3723e1){_0x4d29e2=[db[_0x020c('0x2f')][_0x020c('0x30')](_0x020c('0x31')+_0x5b8e3b+')')];_0x1ccff6[_0x020c('0x1f')]=_0x4d29e2;}}if(_0x434a03){_0x55c1aa['forEach'](function(_0x494768){var _0x3419f7=!![];if(_0x3723e1===_0x020c('0x32')&&_0x10f34a!==_0x494768){_0x3419f7=![];}_0x3fd577[_0x020c('0x2e')]({[_0x494768+'Pause']:_0x3419f7});});if(_0x3d9d0f){_0x3fd577['push']({'pauseType':_0x3d9d0f});}}else if(_0x3723e1){_0x55c1aa['forEach'](function(_0x945b13){_0x3fd577[_0x020c('0x2e')]({[_0x945b13+_0x020c('0x33')]:![]});});}_0x1ccff6[_0x020c('0x34')]=_[_0x020c('0x35')](_0x1ccff6['where'],{'$and':_0x3fd577});if(_0x5c7b2f[_0x020c('0x36')][_0x020c('0x2b')]===_0x020c('0x36')){var _0x48d9f6={'params':{'id':_0x5c7b2f[_0x020c('0x36')][_0x020c('0x37')]},'query':{'section':_0x020c('0x38'),'role':_0x020c('0x2c'),'raw':!![],'ids':_0x5b8e3b,'customSorting':_0x4d29e2}};if(_0x5c7b2f[_0x020c('0x11')][_0x020c('0x39')]){_0x48d9f6[_0x020c('0x11')][_0x020c('0x39')]=!![];}if(_0x434a03){_0x48d9f6[_0x020c('0x11')][_0x020c('0x3a')]=_0x3fd577;}_0x48d9f6['query']=Object[_0x020c('0x3b')](_0x48d9f6[_0x020c('0x11')],_[_0x020c('0x3c')](_0x5c7b2f[_0x020c('0x11')],'id'));return db['UserProfile']['getResources'](_0x48d9f6);}return db[_0x020c('0x26')][_0x020c('0x3d')](_0x1ccff6);})[_0x020c('0x21')](function(_0x436001){_0x236b30['count']=_0x436001['count'];_0x47962e=_0x436001[_0x020c('0x3e')];return _0x47962e[_0x020c('0x3f')](function(_0x13216d){var _0x2b9d61=_[_0x020c('0x40')](_0x277547,['id',_0x13216d['id']]);if(_0x2b9d61){var _0x3b565c=rta[_0x020c('0x41')](_0x2b9d61);_[_0x020c('0x35')](_0x13216d,_0x3b565c);}_0x13216d[_0x020c('0x1c')]=rta[_0x020c('0x42')](_0x13216d);if(_0x13216d[_0x020c('0x1c')][_0x020c('0x1b')](_0x020c('0x43'))){_0x55c1aa[_0x020c('0x44')](function(_0x5f2d8a){if(_0x13216d[_0x5f2d8a+_0x020c('0x33')]){if(_0x5f2d8a==='voice'){if(_0x13216d['voiceStatus']!=='talking'){_0x13216d[_0x020c('0x45')]=_0x020c('0x43');}}else{_0x13216d[_0x5f2d8a+'Status']=_0x020c('0x43');}}});}return _0x13216d;});})[_0x020c('0x21')](function(_0xb3f97c){if(!_0x3c0d58||_0x4d29e2){return _0xb3f97c;}return rta[_0x020c('0x46')](_0xb3f97c,_0x3c0d58);})[_0x020c('0x21')](function(_0x36ed25){var _0x22ea3b=rta['getRealtimeAgentsQueryFields']();_0x236b30[_0x020c('0x3e')]=_0x36ed25[_0x020c('0x3f')](function(_0x1fe64a){return _[_0x020c('0x47')](_0x1fe64a,_0x22ea3b);});return _0x236b30;})[_0x020c('0x21')](respondWithFilteredResult(_0x58e105,_0x1ccff6))['catch'](APIHandleError(_0x58e105));};exports[_0x020c('0x48')]=function(_0x2a924e,_0x2b8ac8){var _0x53eafa={'count':0x0,'rows':[]};var _0x225318={};var _0x2fec82;var _0x20c656;var _0x473d8a;Promise[_0x020c('0x14')]()[_0x020c('0x21')](function(){if(_0x2a924e[_0x020c('0x11')][_0x020c('0x15')]){if(!utils[_0x020c('0x16')](_0x2a924e[_0x020c('0x11')]['channel'])){throw new APIBadRequestError(util[_0x020c('0x17')](_0x020c('0x18'),_0x2a924e[_0x020c('0x11')][_0x020c('0x15')]));}_0x2fec82=_0x2a924e[_0x020c('0x11')][_0x020c('0x15')][_0x020c('0x19')]();}var _0x2cf1b2=_[_0x020c('0x49')](_0x2fec82)+_0x020c('0x4a');var _0x5c2ca3=_['map'](db[_0x2cf1b2][_0x020c('0x27')],function(_0x5cff96){return{'name':_0x5cff96['fieldName'],'type':_0x5cff96[_0x020c('0x29')][_0x020c('0x2a')]};});if(!_0x2a924e[_0x020c('0x11')][_0x020c('0x4b')]){var _0xf2d7ee=['id',_0x020c('0x4c')];if(_0x2fec82===_0x020c('0x4d')){_0xf2d7ee['push'](_0x020c('0x29'));if(_0x2a924e[_0x020c('0x11')][_0x020c('0x29')]===_0x020c('0x4e')){_0xf2d7ee[_0x020c('0x2e')](['dialActive',_0x020c('0x4f')]);}}_0x2a924e[_0x020c('0x11')][_0x020c('0x4b')]=_0xf2d7ee[_0x020c('0x50')](',');}_0x225318=qs[_0x020c('0x51')](_0x5c2ca3,_0x2a924e);if(_0x2a924e['user'][_0x020c('0x2b')]==='user'){var _0x40507e={'params':{'id':_0x2a924e[_0x020c('0x36')][_0x020c('0x37')]},'query':{'section':_0x2fec82===_0x020c('0x4d')&&_0x2a924e[_0x020c('0x11')]['type']===_0x020c('0x4e')?'QueueCampaigns':_[_0x020c('0x49')](_0x2fec82)+_0x020c('0x52'),'type':_0x2a924e[_0x020c('0x11')][_0x020c('0x29')],'nolimit':!![],'sort':_0x020c('0x4c'),'filter':_0x2a924e[_0x020c('0x11')][_0x020c('0x53')]}};_0x40507e[_0x020c('0x11')]=Object[_0x020c('0x3b')](_0x40507e['query'],_0x2a924e[_0x020c('0x11')]);delete _0x40507e[_0x020c('0x11')]['id'];return db[_0x020c('0x54')]['getResources'](_0x40507e);}return db[_0x2cf1b2][_0x020c('0x3d')](_0x225318);})[_0x020c('0x21')](function(_0x21578c){_0x53eafa[_0x020c('0xb')]=_0x21578c['count'];_0x20c656=_0x21578c[_0x020c('0x3e')];return rtq[_0x020c('0x55')](_0x2a924e,_0x2fec82);})[_0x020c('0x21')](function(_0xb273a9){_0x473d8a=_0xb273a9[_0x020c('0x3e')];return rtq[_0x020c('0x56')](_0x20c656,_0x473d8a,_0x2fec82,_0x2a924e[_0x020c('0x11')][_0x020c('0x29')]);})[_0x020c('0x21')](function(_0x2ac0aa){_0x53eafa[_0x020c('0x3e')]=_0x2ac0aa;return _0x53eafa;})['then'](respondWithFilteredResult(_0x2b8ac8,_0x225318))[_0x020c('0x57')](APIHandleError(_0x2b8ac8));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c6ea773..74673df 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x137978,_0x33137b){var _0xf030b5=function(_0x193800){while(--_0x193800){_0x137978['push'](_0x137978['shift']());}};_0xf030b5(++_0x33137b);}(_0xe706,0xa3));var _0x6e70=function(_0xf01579,_0x914885){_0xf01579=_0xf01579-0x0;var _0x146774=_0xe706[_0xf01579];return _0x146774;};'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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x44e79f,_0x425cb8){var _0x2ddb9d=function(_0x17f0c0){while(--_0x17f0c0){_0x44e79f['push'](_0x44e79f['shift']());}};_0x2ddb9d(++_0x425cb8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xcb91[_0xd816e2];return _0x1f5924;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9506db2..645c5ec 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 _0x6c99=['INTEGER','STRING','sequelize'];(function(_0x3adc2c,_0x93824f){var _0x505f1f=function(_0x4f2642){while(--_0x4f2642){_0x3adc2c['push'](_0x3adc2c['shift']());}};_0x505f1f(++_0x93824f);}(_0x6c99,0x9b));var _0x96c9=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x6c99[_0x4aa838];return _0x3abff0;};'use strict';var Sequelize=require(_0x96c9('0x0'));module['exports']={'state':{'type':Sequelize[_0x96c9('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x96c9('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x96c9('0x2')]},'campaigntype':{'type':Sequelize[_0x96c9('0x2')]},'membername':{'type':Sequelize[_0x96c9('0x2')]}}; \ No newline at end of file +var _0x4813=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x2f6c38,_0x4b067a){var _0x66279f=function(_0x13c4b5){while(--_0x13c4b5){_0x2f6c38['push'](_0x2f6c38['shift']());}};_0x66279f(++_0x4b067a);}(_0x4813,0x14e));var _0x3481=function(_0x449278,_0x553f12){_0x449278=_0x449278-0x0;var _0x511969=_0x4813[_0x449278];return _0x511969;};'use strict';var Sequelize=require(_0x3481('0x0'));module[_0x3481('0x1')]={'state':{'type':Sequelize[_0x3481('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3481('0x3')]},'scheduledat':{'type':Sequelize[_0x3481('0x4')]},'uniqueid':{'type':Sequelize[_0x3481('0x3')]},'starttime':{'type':Sequelize[_0x3481('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3481('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3481('0x3')]},'campaigntype':{'type':Sequelize[_0x3481('0x3')]},'membername':{'type':Sequelize[_0x3481('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0b3b1de..5536215 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 _0xf24b=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf24b,0x7e));var _0xbf24=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0xf24b[_0x3ab353];return _0x1e2285;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var logger=require(_0xbf24('0x2'))('api');var moment=require(_0xbf24('0x3'));var BPromise=require(_0xbf24('0x4'));var rp=require(_0xbf24('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf24('0x6'));module[_0xbf24('0x7')]=function(_0x370c1d,_0x1dfc5d){return _0x370c1d[_0xbf24('0x8')](_0xbf24('0x9'),attributes,{'tableName':_0xbf24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa84b=['exports','ReportAgentPreview','lodash','util','api','moment','bluebird','path','rimraf','./reportAgentPreview.attributes'];(function(_0x4c10be,_0x36f290){var _0x16678e=function(_0x412879){while(--_0x412879){_0x4c10be['push'](_0x4c10be['shift']());}};_0x16678e(++_0x36f290);}(_0xa84b,0xa2));var _0xba84=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0xa84b[_0xb29bef];return _0x878163;};'use strict';var _=require(_0xba84('0x0'));var util=require(_0xba84('0x1'));var logger=require('../../config/logger')(_0xba84('0x2'));var moment=require(_0xba84('0x3'));var BPromise=require(_0xba84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba84('0x5'));var rimraf=require(_0xba84('0x6'));var config=require('../../config/environment');var attributes=require(_0xba84('0x7'));module[_0xba84('0x8')]=function(_0x3d688c,_0x37a0eb){return _0x3d688c['define'](_0xba84('0x9'),attributes,{'tableName':'report_agent_preview','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 5a0296d..d70a1a8 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 _0xb9a2=['then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb9a2,0xe8));var _0x2b9a=function(_0x9d6f52,_0x5126fe){_0x9d6f52=_0x9d6f52-0x0;var _0x4a6370=_0xb9a2[_0x9d6f52];return _0x4a6370;};'use strict';var _=require(_0x2b9a('0x0'));var util=require('util');var moment=require(_0x2b9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b9a('0x2'));var fs=require('fs');var Redis=require(_0x2b9a('0x3'));var db=require(_0x2b9a('0x4'))['db'];var utils=require(_0x2b9a('0x5'));var logger=require(_0x2b9a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2b9a('0x7'));var client=jayson[_0x2b9a('0x8')][_0x2b9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xea64b9,_0x89499f,_0x13ee99){return new BPromise(function(_0x458a38,_0x1c58c3){return client[_0x2b9a('0xa')](_0xea64b9,_0x13ee99)[_0x2b9a('0xb')](function(_0x22eeb3){logger[_0x2b9a('0xc')](_0x2b9a('0xd'),_0x89499f,'request\x20sent');logger[_0x2b9a('0xe')](_0x2b9a('0xf'),_0x89499f,_0x2b9a('0x10'),JSON[_0x2b9a('0x11')](_0x22eeb3));if(_0x22eeb3['error']){if(_0x22eeb3[_0x2b9a('0x12')]['code']===0x1f4){logger[_0x2b9a('0x12')](_0x2b9a('0xd'),_0x89499f,_0x22eeb3[_0x2b9a('0x12')][_0x2b9a('0x13')]);return _0x1c58c3(_0x22eeb3[_0x2b9a('0x12')][_0x2b9a('0x13')]);}logger['error'](_0x2b9a('0xd'),_0x89499f,_0x22eeb3[_0x2b9a('0x12')]['message']);return _0x458a38(_0x22eeb3['error'][_0x2b9a('0x13')]);}else{logger[_0x2b9a('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x89499f,'request\x20sent');_0x458a38(_0x22eeb3[_0x2b9a('0x14')][_0x2b9a('0x13')]);}})[_0x2b9a('0x15')](function(_0x5b86a3){logger[_0x2b9a('0x12')](_0x2b9a('0xd'),_0x89499f,_0x5b86a3);_0x1c58c3(_0x5b86a3);});});}exports[_0x2b9a('0x16')]=function(_0x4e566b){var _0xb256fe=this;return new Promise(function(_0x6023d0,_0x2bf63a){return db[_0x2b9a('0x17')][_0x2b9a('0x18')](_0x4e566b['body'],{'raw':_0x4e566b[_0x2b9a('0x19')]?_0x4e566b[_0x2b9a('0x19')][_0x2b9a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a608e){logger[_0x2b9a('0xc')](_0x2b9a('0x16'),_0x4e566b);logger[_0x2b9a('0xe')](_0x2b9a('0x16'),_0x4e566b,JSON[_0x2b9a('0x11')](_0x4a608e));_0x6023d0(_0x4a608e);})['catch'](function(_0x5679f5){logger[_0x2b9a('0x12')](_0x2b9a('0x16'),_0x5679f5['message'],_0x4e566b);_0x2bf63a(_0xb256fe[_0x2b9a('0x12')](0x1f4,_0x5679f5['message']));});});}; \ No newline at end of file +var _0x6a7d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','body','options','raw','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40ba23,_0x4d3222){var _0x4a3f1d=function(_0x19cc2f){while(--_0x19cc2f){_0x40ba23['push'](_0x40ba23['shift']());}};_0x4a3f1d(++_0x4d3222);}(_0x6a7d,0xa2));var _0xd6a7=function(_0x3a8ec5,_0x378f44){_0x3a8ec5=_0x3a8ec5-0x0;var _0x483caf=_0x6a7d[_0x3a8ec5];return _0x483caf;};'use strict';var _=require('lodash');var util=require(_0xd6a7('0x0'));var moment=require(_0xd6a7('0x1'));var BPromise=require(_0xd6a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6a7('0x3'))['db'];var utils=require(_0xd6a7('0x4'));var logger=require(_0xd6a7('0x5'))(_0xd6a7('0x6'));var config=require(_0xd6a7('0x7'));var jayson=require(_0xd6a7('0x8'));var client=jayson[_0xd6a7('0x9')][_0xd6a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0d86,_0x583705,_0xd6afdd){return new BPromise(function(_0x530429,_0x10c248){return client[_0xd6a7('0xb')](_0x2d0d86,_0xd6afdd)[_0xd6a7('0xc')](function(_0x17e55d){logger[_0xd6a7('0xd')](_0xd6a7('0xe'),_0x583705,_0xd6a7('0xf'));logger[_0xd6a7('0x10')](_0xd6a7('0x11'),_0x583705,_0xd6a7('0xf'),JSON['stringify'](_0x17e55d));if(_0x17e55d[_0xd6a7('0x12')]){if(_0x17e55d['error'][_0xd6a7('0x13')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x583705,_0x17e55d[_0xd6a7('0x12')]['message']);return _0x10c248(_0x17e55d[_0xd6a7('0x12')][_0xd6a7('0x14')]);}logger[_0xd6a7('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x583705,_0x17e55d[_0xd6a7('0x12')]['message']);return _0x530429(_0x17e55d[_0xd6a7('0x12')][_0xd6a7('0x14')]);}else{logger['info'](_0xd6a7('0xe'),_0x583705,_0xd6a7('0xf'));_0x530429(_0x17e55d[_0xd6a7('0x15')][_0xd6a7('0x14')]);}})[_0xd6a7('0x16')](function(_0x4d6736){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x583705,_0x4d6736);_0x10c248(_0x4d6736);});});}exports[_0xd6a7('0x17')]=function(_0x346e11){var _0x2a4cb6=this;return new Promise(function(_0x17a3a4,_0x549975){return db['ReportAgentPreview']['create'](_0x346e11[_0xd6a7('0x18')],{'raw':_0x346e11[_0xd6a7('0x19')]?_0x346e11[_0xd6a7('0x19')][_0xd6a7('0x1a')]===undefined?!![]:![]:!![]})[_0xd6a7('0xc')](function(_0x24f874){logger['info'](_0xd6a7('0x17'),_0x346e11);logger[_0xd6a7('0x10')]('CreateReportAgentPreview',_0x346e11,JSON[_0xd6a7('0x1b')](_0x24f874));_0x17a3a4(_0x24f874);})[_0xd6a7('0x16')](function(_0x226c44){logger[_0xd6a7('0x12')](_0xd6a7('0x17'),_0x226c44[_0xd6a7('0x14')],_0x346e11);_0x549975(_0x2a4cb6[_0xd6a7('0x12')](0x1f4,_0x226c44[_0xd6a7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f715a94..678fc58 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 _0x5ac1=['mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','outboundChannels','/agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','fax','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0x5ac1,0xe7));var _0x15ac=function(_0x480151,_0x4d8045){_0x480151=_0x480151-0x0;var _0x2007ca=_0x5ac1[_0x480151];return _0x2007ca;};'use strict';var multer=require(_0x15ac('0x0'));var util=require(_0x15ac('0x1'));var path=require(_0x15ac('0x2'));var express=require(_0x15ac('0x3'));var router=express[_0x15ac('0x4')]();var auth=require(_0x15ac('0x5'));var controller=require('./rpc.controller');router[_0x15ac('0x6')](_0x15ac('0x7'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x9')]);router[_0x15ac('0x6')](_0x15ac('0xa'),auth['isAuthenticated'](),controller[_0x15ac('0xb')]);router['get'](_0x15ac('0xc'),auth[_0x15ac('0x8')](),controller[_0x15ac('0xd')]);router[_0x15ac('0x6')](_0x15ac('0xe'),auth[_0x15ac('0x8')](),controller[_0x15ac('0xf')]);router['get'](_0x15ac('0x10'),auth['isAuthenticated'](),controller[_0x15ac('0x11')]);router[_0x15ac('0x6')](_0x15ac('0x12'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x13')]);router[_0x15ac('0x6')](_0x15ac('0x14'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x15')]);router['get']('/openchannel/queues',auth[_0x15ac('0x8')](),controller[_0x15ac('0x16')]);router[_0x15ac('0x6')](_0x15ac('0x17'),auth['isAuthenticated'](),controller[_0x15ac('0x18')]);router['get'](_0x15ac('0x19'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x1a')]);router[_0x15ac('0x6')](_0x15ac('0x1b'),auth['isAuthenticated'](),controller[_0x15ac('0x1c')]);router[_0x15ac('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x15ac('0x1d')]);router[_0x15ac('0x6')](_0x15ac('0x1e'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x1f')]);router[_0x15ac('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x15ac('0x8')](),controller[_0x15ac('0x20')]);router[_0x15ac('0x6')](_0x15ac('0x21'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x15ac('0x6')](_0x15ac('0x22'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x23')]);router[_0x15ac('0x6')](_0x15ac('0x24'),auth['isAuthenticated'](),controller[_0x15ac('0x25')]);router[_0x15ac('0x26')](_0x15ac('0x24'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x27')]);router['get']('/outbound',auth[_0x15ac('0x8')](),controller[_0x15ac('0x28')]);router[_0x15ac('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x15ac('0x29')]);router['get'](_0x15ac('0x2a'),auth[_0x15ac('0x8')](),controller['agents']);router[_0x15ac('0x26')](_0x15ac('0x2b'),auth[_0x15ac('0x8')](),controller['agentCapacity']);router[_0x15ac('0x6')](_0x15ac('0x2c'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x2d')]);router[_0x15ac('0x6')](_0x15ac('0x2e'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x2f')]);router[_0x15ac('0x6')](_0x15ac('0x30'),auth['isAuthenticated'](),controller[_0x15ac('0x31')]);router[_0x15ac('0x6')](_0x15ac('0x32'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x33')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x15ac('0x34')]);router['get'](_0x15ac('0x35'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x36')]);router[_0x15ac('0x6')](_0x15ac('0x37'),auth['isAuthenticated'](),controller[_0x15ac('0x38')]);router[_0x15ac('0x6')](_0x15ac('0x39'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x3a')]);router[_0x15ac('0x6')](_0x15ac('0x3b'),auth['isAuthenticated'](),controller[_0x15ac('0x3c')]);router[_0x15ac('0x6')](_0x15ac('0x3d'),auth['isAuthenticated'](),controller[_0x15ac('0x3e')]);router['get'](_0x15ac('0x3f'),auth['isAuthenticated'](),controller[_0x15ac('0x40')]);router[_0x15ac('0x41')]('/mail/queues/:id/notify',auth[_0x15ac('0x8')](),controller['queueNotify'](_0x15ac('0x42')));router[_0x15ac('0x6')](_0x15ac('0x43'),auth[_0x15ac('0x8')](),controller['showMailQueues']);router[_0x15ac('0x41')](_0x15ac('0x44'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x45')](_0x15ac('0x46')));router[_0x15ac('0x6')]('/chat/queues/:id',auth[_0x15ac('0x8')](),controller['showChatQueues']);router[_0x15ac('0x41')]('/fax/queues/:id/notify',auth[_0x15ac('0x8')](),controller['queueNotify'](_0x15ac('0x47')));router[_0x15ac('0x6')]('/fax/queues/:id',auth[_0x15ac('0x8')](),controller[_0x15ac('0x48')]);router[_0x15ac('0x41')]('/openchannel/queues/:id/notify',auth[_0x15ac('0x8')](),controller[_0x15ac('0x45')]('openchannel'));router[_0x15ac('0x6')](_0x15ac('0x49'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x4a')]);router[_0x15ac('0x41')](_0x15ac('0x4b'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x45')]('sms'));router['post'](_0x15ac('0x4c'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x45')](_0x15ac('0x4d')));router['get'](_0x15ac('0x4e'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x4f')]);router[_0x15ac('0x6')](_0x15ac('0x50'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x51')]);router[_0x15ac('0x41')](_0x15ac('0x52'),auth[_0x15ac('0x8')](),controller[_0x15ac('0x53')]);module['exports']=router; \ No newline at end of file +var _0xbc0d=['/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xbc0d,0x13b));var _0xdbc0=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xbc0d[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var path=require(_0xdbc0('0x2'));var express=require(_0xdbc0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xdbc0('0x4'));router[_0xdbc0('0x5')](_0xdbc0('0x6'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x8')]);router[_0xdbc0('0x5')](_0xdbc0('0x9'),auth['isAuthenticated'](),controller[_0xdbc0('0xa')]);router[_0xdbc0('0x5')](_0xdbc0('0xb'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xdbc0('0x5')](_0xdbc0('0xc'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0xd')]);router[_0xdbc0('0x5')](_0xdbc0('0xe'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0xf')]);router[_0xdbc0('0x5')](_0xdbc0('0x10'),auth[_0xdbc0('0x7')](),controller['mailQueues']);router[_0xdbc0('0x5')](_0xdbc0('0x11'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x12')]);router['get'](_0xdbc0('0x13'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x14')]);router['get'](_0xdbc0('0x15'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x16')]);router['get'](_0xdbc0('0x17'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x18')]);router['get'](_0xdbc0('0x19'),auth['isAuthenticated'](),controller[_0xdbc0('0x1a')]);router[_0xdbc0('0x5')](_0xdbc0('0x1b'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x1c')]);router['get']('/voice/queues/channels',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x1d')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x1e')]);router[_0xdbc0('0x5')](_0xdbc0('0x1f'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x20')]);router[_0xdbc0('0x5')](_0xdbc0('0x21'),auth[_0xdbc0('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xdbc0('0x22'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x23')]);router[_0xdbc0('0x24')](_0xdbc0('0x22'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x25')]);router[_0xdbc0('0x5')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0xdbc0('0x5')](_0xdbc0('0x26'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x27')]);router[_0xdbc0('0x5')]('/agents',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x28')]);router['put'](_0xdbc0('0x29'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x2a')]);router[_0xdbc0('0x5')](_0xdbc0('0x2b'),auth[_0xdbc0('0x7')](),controller['telephones']);router['get'](_0xdbc0('0x2c'),auth['isAuthenticated'](),controller[_0xdbc0('0x2d')]);router[_0xdbc0('0x5')](_0xdbc0('0x2e'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x2f')]);router[_0xdbc0('0x5')](_0xdbc0('0x30'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x31')]);router['get'](_0xdbc0('0x32'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x33')]);router['get'](_0xdbc0('0x34'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x35')]);router['get'](_0xdbc0('0x36'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x37')]);router[_0xdbc0('0x5')](_0xdbc0('0x38'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x39')]);router[_0xdbc0('0x5')]('/sms/queues/waitinginteractions',auth[_0xdbc0('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xdbc0('0x5')](_0xdbc0('0x3a'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x3b')]);router[_0xdbc0('0x5')](_0xdbc0('0x3c'),auth['isAuthenticated'](),controller[_0xdbc0('0x3d')]);router[_0xdbc0('0x3e')](_0xdbc0('0x3f'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x40')](_0xdbc0('0x41')));router['get']('/mail/queues/:id',auth[_0xdbc0('0x7')](),controller['showMailQueues']);router['post'](_0xdbc0('0x42'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x40')](_0xdbc0('0x43')));router[_0xdbc0('0x5')](_0xdbc0('0x44'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x45')]);router[_0xdbc0('0x3e')](_0xdbc0('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0xdbc0('0x47')));router[_0xdbc0('0x5')]('/fax/queues/:id',auth[_0xdbc0('0x7')](),controller['showFaxQueues']);router[_0xdbc0('0x3e')]('/openchannel/queues/:id/notify',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x40')]('openchannel'));router[_0xdbc0('0x5')](_0xdbc0('0x48'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x49')]);router['post'](_0xdbc0('0x4a'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x40')](_0xdbc0('0x4b')));router['post']('/whatsapp/queues/:id/notify',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x40')](_0xdbc0('0x4c')));router['get'](_0xdbc0('0x4d'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x4e')]);router[_0xdbc0('0x5')]('/whatsapp/queues/:id',auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x4f')]);router['post'](_0xdbc0('0x50'),auth[_0xdbc0('0x7')](),controller[_0xdbc0('0x51')]);module[_0xdbc0('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9bb4c2b..40d6823 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x3ba84d,_0x3f016b){var _0x4be29e=function(_0x4a6287){while(--_0x4a6287){_0x3ba84d['push'](_0x3ba84d['shift']());}};_0x4be29e(++_0x3f016b);}(_0xe706,0xa3));var _0x6e70=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0xe706[_0x2f421];return _0x27b4af;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x1b76f4,_0x4d3d8e){var _0x60ae20=function(_0x14866c){while(--_0x14866c){_0x1b76f4['push'](_0x1b76f4['shift']());}};_0x60ae20(++_0x4d3d8e);}(_0xe706,0xa3));var _0x6e70=function(_0x3e0c6b,_0x52636f){_0x3e0c6b=_0x3e0c6b-0x0;var _0x4bf365=_0xe706[_0x3e0c6b];return _0x4bf365;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c30fc79..f8bfa2a 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 _0x25a4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','util','path'];(function(_0x33fcfd,_0x42a468){var _0x79ce82=function(_0x2e028e){while(--_0x2e028e){_0x33fcfd['push'](_0x33fcfd['shift']());}};_0x79ce82(++_0x42a468);}(_0x25a4,0x10f));var _0x425a=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x25a4[_0x50cd41];return _0x399475;};'use strict';var multer=require('multer');var util=require(_0x425a('0x0'));var path=require(_0x425a('0x1'));var timeout=require(_0x425a('0x2'));var express=require(_0x425a('0x3'));var router=express[_0x425a('0x4')]();var fs_extra=require(_0x425a('0x5'));var auth=require(_0x425a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x425a('0x7'));router[_0x425a('0x8')]('/',auth[_0x425a('0x9')](),controller[_0x425a('0xa')]);router[_0x425a('0x8')](_0x425a('0xb'),auth[_0x425a('0x9')](),controller[_0x425a('0xc')]);router['get'](_0x425a('0xd'),auth[_0x425a('0x9')](),controller[_0x425a('0xe')]);router['post']('/',auth[_0x425a('0x9')](),controller[_0x425a('0xf')]);router[_0x425a('0x10')](_0x425a('0xb'),auth[_0x425a('0x9')](),controller[_0x425a('0x11')]);router[_0x425a('0x12')](_0x425a('0xb'),auth[_0x425a('0x9')](),controller[_0x425a('0x13')]);module[_0x425a('0x14')]=router; \ No newline at end of file +var _0x2aad=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','update','delete','destroy'];(function(_0x182c33,_0x18639b){var _0x1b9981=function(_0x70401e){while(--_0x70401e){_0x182c33['push'](_0x182c33['shift']());}};_0x1b9981(++_0x18639b);}(_0x2aad,0x109));var _0xd2aa=function(_0x1efd45,_0x1e1d5e){_0x1efd45=_0x1efd45-0x0;var _0x4e79a5=_0x2aad[_0x1efd45];return _0x4e79a5;};'use strict';var multer=require('multer');var util=require(_0xd2aa('0x0'));var path=require(_0xd2aa('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2aa('0x2'));var router=express['Router']();var fs_extra=require(_0xd2aa('0x3'));var auth=require(_0xd2aa('0x4'));var interaction=require(_0xd2aa('0x5'));var config=require(_0xd2aa('0x6'));var controller=require(_0xd2aa('0x7'));router[_0xd2aa('0x8')]('/',auth[_0xd2aa('0x9')](),controller[_0xd2aa('0xa')]);router[_0xd2aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd2aa('0xb')]);router[_0xd2aa('0x8')](_0xd2aa('0xc'),auth[_0xd2aa('0x9')](),controller[_0xd2aa('0xd')]);router[_0xd2aa('0xe')]('/',auth[_0xd2aa('0x9')](),controller[_0xd2aa('0xf')]);router[_0xd2aa('0x10')](_0xd2aa('0x11'),auth['isAuthenticated'](),controller[_0xd2aa('0x12')]);router[_0xd2aa('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd2aa('0x14')]);module[_0xd2aa('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b69c00d..c3fa064 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 _0x1140=['years','quarters','weeks','days','hours','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM'];(function(_0x383950,_0x32973b){var _0x161ac3=function(_0x180a51){while(--_0x180a51){_0x383950['push'](_0x383950['shift']());}};_0x161ac3(++_0x32973b);}(_0x1140,0x161));var _0x0114=function(_0x151ef4,_0x2e6f4b){_0x151ef4=_0x151ef4-0x0;var _0x2d4c2f=_0x1140[_0x151ef4];return _0x2d4c2f;};'use strict';var Sequelize=require(_0x0114('0x0'));module[_0x0114('0x1')]={'name':{'type':Sequelize[_0x0114('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0114('0x2')]},'active':{'type':Sequelize[_0x0114('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0114('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0114('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0114('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0114('0x6')](_0x0114('0x7'),_0x0114('0x8'),'months',_0x0114('0x9'),_0x0114('0xa'),_0x0114('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x0114('0xa')},'output':{'type':Sequelize[_0x0114('0x6')]('csv',_0x0114('0xc'),_0x0114('0xd')),'allowNull':![],'defaultValue':_0x0114('0xe')},'type':{'type':Sequelize[_0x0114('0x6')](_0x0114('0xf'),_0x0114('0x10')),'allowNull':![],'defaultValue':_0x0114('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0114('0x2')]},'cc':{'type':Sequelize[_0x0114('0x11')]},'bcc':{'type':Sequelize[_0x0114('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x0114('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x52fa=['custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx'];(function(_0x3a3f73,_0x7150f9){var _0x1c1c7a=function(_0x44c53f){while(--_0x44c53f){_0x3a3f73['push'](_0x3a3f73['shift']());}};_0x1c1c7a(++_0x7150f9);}(_0x52fa,0x133));var _0xa52f=function(_0x51c7b5,_0x9a35fb){_0x51c7b5=_0x51c7b5-0x0;var _0x954e22=_0x52fa[_0x51c7b5];return _0x954e22;};'use strict';var Sequelize=require('sequelize');module[_0xa52f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa52f('0x1')]},'active':{'type':Sequelize[_0xa52f('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa52f('0x1')],'allowNull':![],'defaultValue':_0xa52f('0x3')},'startAt':{'type':Sequelize[_0xa52f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa52f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa52f('0x5')](_0xa52f('0x6'),_0xa52f('0x7'),_0xa52f('0x8'),_0xa52f('0x9'),'days',_0xa52f('0xa'),_0xa52f('0xb')),'allowNull':![],'defaultValue':_0xa52f('0xc')},'output':{'type':Sequelize['ENUM'](_0xa52f('0xd'),_0xa52f('0xe'),_0xa52f('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa52f('0x5')](_0xa52f('0x10'),_0xa52f('0x11')),'allowNull':![],'defaultValue':_0xa52f('0x10')},'sendMail':{'type':Sequelize[_0xa52f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa52f('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa52f('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xa52f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index e77057f..35302cd 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 _0xf2e8=['userProfileId','error','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','name','Schedule','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x48ef7e,_0x5d765c){var _0x3bdacc=function(_0x4af5e5){while(--_0x4af5e5){_0x48ef7e['push'](_0x48ef7e['shift']());}};_0x3bdacc(++_0x5d765c);}(_0xf2e8,0xaf));var _0x8f2e=function(_0x25f53f,_0x3214de){_0x25f53f=_0x25f53f-0x0;var _0x449dd8=_0xf2e8[_0x25f53f];return _0x449dd8;};'use strict';var emlformat=require(_0x8f2e('0x0'));var rimraf=require(_0x8f2e('0x1'));var zipdir=require(_0x8f2e('0x2'));var jsonpatch=require(_0x8f2e('0x3'));var rp=require(_0x8f2e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f2e('0x5'));var path=require(_0x8f2e('0x6'));var sox=require(_0x8f2e('0x7'));var csv=require(_0x8f2e('0x8'));var ejs=require(_0x8f2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f2e('0xa'));var squel=require(_0x8f2e('0xb'));var crypto=require(_0x8f2e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f2e('0xd'));var toCsv=require(_0x8f2e('0x8'));var querystring=require(_0x8f2e('0xe'));var Papa=require(_0x8f2e('0xf'));var Redis=require(_0x8f2e('0x10'));var authService=require(_0x8f2e('0x11'));var qs=require(_0x8f2e('0x12'));var as=require(_0x8f2e('0x13'));var hardwareService=require(_0x8f2e('0x14'));var logger=require(_0x8f2e('0x15'))(_0x8f2e('0x16'));var utils=require(_0x8f2e('0x17'));var config=require(_0x8f2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f2e('0x19'))['db'];function respondWithStatusCode(_0x4adf4e,_0x38c744){_0x38c744=_0x38c744||0xcc;return function(_0x15ecf8){if(_0x15ecf8){return _0x4adf4e[_0x8f2e('0x1a')](_0x38c744);}return _0x4adf4e[_0x8f2e('0x1b')](_0x38c744)[_0x8f2e('0x1c')]();};}function respondWithResult(_0x4feb0a,_0x1824fd){_0x1824fd=_0x1824fd||0xc8;return function(_0x4d7d66){if(_0x4d7d66){return _0x4feb0a[_0x8f2e('0x1b')](_0x1824fd)[_0x8f2e('0x1d')](_0x4d7d66);}};}function respondWithFilteredResult(_0x1cb308,_0x49fa43){return function(_0x1a7564){if(_0x1a7564){var _0x349ba6=typeof _0x49fa43[_0x8f2e('0x1e')]==='undefined'&&typeof _0x49fa43['limit']===_0x8f2e('0x1f');var _0x58ecc9=_0x1a7564[_0x8f2e('0x20')];var _0xc51a1a=_0x349ba6?0x0:_0x49fa43[_0x8f2e('0x1e')];var _0xe64401=_0x349ba6?_0x1a7564[_0x8f2e('0x20')]:_0x49fa43[_0x8f2e('0x1e')]+_0x49fa43[_0x8f2e('0x21')];var _0x4a0511;if(_0xe64401>=_0x58ecc9){_0xe64401=_0x58ecc9;_0x4a0511=0xc8;}else{_0x4a0511=0xce;}_0x1cb308[_0x8f2e('0x1b')](_0x4a0511);return _0x1cb308[_0x8f2e('0x22')](_0x8f2e('0x23'),_0xc51a1a+'-'+_0xe64401+'/'+_0x58ecc9)[_0x8f2e('0x1d')](_0x1a7564);}return null;};}function patchUpdates(_0x5261ea){return function(_0x4d6999){try{jsonpatch[_0x8f2e('0x24')](_0x4d6999,_0x5261ea,!![]);}catch(_0x1c59eb){return BPromise[_0x8f2e('0x25')](_0x1c59eb);}return _0x4d6999[_0x8f2e('0x26')]();};}function saveUpdates(_0x3efdbf,_0x24cf3f){return function(_0xbe7bdd){if(_0xbe7bdd){return _0xbe7bdd[_0x8f2e('0x27')](_0x3efdbf)[_0x8f2e('0x28')](function(_0x2747bd){return _0x2747bd;});}return null;};}function removeEntity(_0x563f1a,_0x3ce440){return function(_0x45115b){if(_0x45115b){return _0x45115b[_0x8f2e('0x29')]()[_0x8f2e('0x28')](function(){var _0x32590f=_0x45115b['get']({'plain':!![]});var _0x118b75=_0x8f2e('0x2a');return db[_0x8f2e('0x2b')]['destroy']({'where':{'type':_0x118b75,'resourceId':_0x32590f['id']}})[_0x8f2e('0x28')](function(){return _0x45115b;});})[_0x8f2e('0x28')](function(){_0x563f1a[_0x8f2e('0x1b')](0xcc)[_0x8f2e('0x1c')]();});}};}function handleEntityNotFound(_0x3646dc,_0x5d007f){return function(_0x42c433){if(!_0x42c433){_0x3646dc[_0x8f2e('0x1a')](0x194);}return _0x42c433;};}function handleError(_0x3c996b,_0x49e892){_0x49e892=_0x49e892||0x1f4;return function(_0x529907){logger['error'](_0x529907['stack']);if(_0x529907[_0x8f2e('0x2c')]){delete _0x529907[_0x8f2e('0x2c')];}_0x3c996b[_0x8f2e('0x1b')](_0x49e892)['send'](_0x529907);};}exports['index']=function(_0x5896c9,_0x8ca136){var _0x4326e3={},_0x1d0848={},_0x5b96d3={'count':0x0,'rows':[]};var _0x84eea9=_['map'](db[_0x8f2e('0x2d')][_0x8f2e('0x2e')],function(_0x405d35){return{'name':_0x405d35[_0x8f2e('0x2f')],'type':_0x405d35[_0x8f2e('0x30')][_0x8f2e('0x31')]};});_0x1d0848['model']=_[_0x8f2e('0x32')](_0x84eea9,_0x8f2e('0x2c'));_0x1d0848[_0x8f2e('0x33')]=_[_0x8f2e('0x34')](_0x5896c9[_0x8f2e('0x33')]);_0x1d0848[_0x8f2e('0x35')]=_[_0x8f2e('0x36')](_0x1d0848[_0x8f2e('0x37')],_0x1d0848[_0x8f2e('0x33')]);_0x4326e3['attributes']=_['intersection'](_0x1d0848['model'],qs[_0x8f2e('0x38')](_0x5896c9['query']['fields']));_0x4326e3[_0x8f2e('0x39')]=_0x4326e3[_0x8f2e('0x39')]['length']?_0x4326e3[_0x8f2e('0x39')]:_0x1d0848[_0x8f2e('0x37')];if(!_0x5896c9[_0x8f2e('0x33')][_0x8f2e('0x3a')](_0x8f2e('0x3b'))){_0x4326e3[_0x8f2e('0x21')]=qs[_0x8f2e('0x21')](_0x5896c9[_0x8f2e('0x33')]['limit']);_0x4326e3[_0x8f2e('0x1e')]=qs['offset'](_0x5896c9[_0x8f2e('0x33')]['offset']);}_0x4326e3[_0x8f2e('0x3c')]=qs[_0x8f2e('0x3d')](_0x5896c9[_0x8f2e('0x33')][_0x8f2e('0x3d')]);_0x4326e3['where']=qs['filters'](_[_0x8f2e('0x3e')](_0x5896c9[_0x8f2e('0x33')],_0x1d0848['filters']),_0x84eea9);if(_0x5896c9['query'][_0x8f2e('0x3f')]){_0x4326e3['where']=_[_0x8f2e('0x40')](_0x4326e3[_0x8f2e('0x41')],{'$or':_[_0x8f2e('0x32')](_0x84eea9,function(_0x5d3e23){if(_0x5d3e23[_0x8f2e('0x30')]!==_0x8f2e('0x42')){var _0xaef7de={};_0xaef7de[_0x5d3e23[_0x8f2e('0x2c')]]={'$like':'%'+_0x5896c9['query'][_0x8f2e('0x3f')]+'%'};return _0xaef7de;}})});}_0x4326e3=_['merge']({},_0x4326e3,_0x5896c9['options']);var _0x1e392c={'where':_0x4326e3[_0x8f2e('0x41')]};return db[_0x8f2e('0x2d')]['count'](_0x1e392c)[_0x8f2e('0x28')](function(_0x38873f){_0x5b96d3[_0x8f2e('0x20')]=_0x38873f;if(_0x5896c9[_0x8f2e('0x33')][_0x8f2e('0x43')]){_0x4326e3[_0x8f2e('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x8f2e('0x45')](_0x4326e3);})['then'](function(_0x5eba30){_0x5b96d3[_0x8f2e('0x46')]=_0x5eba30;return _0x5b96d3;})[_0x8f2e('0x28')](respondWithFilteredResult(_0x8ca136,_0x4326e3))[_0x8f2e('0x47')](handleError(_0x8ca136,null));};exports[_0x8f2e('0x48')]=function(_0x30b7aa,_0x19a975){var _0x132003={'raw':![],'where':{'id':_0x30b7aa[_0x8f2e('0x49')]['id']}},_0x19399d={};_0x19399d[_0x8f2e('0x37')]=_[_0x8f2e('0x34')](db[_0x8f2e('0x2d')][_0x8f2e('0x2e')]);_0x19399d[_0x8f2e('0x33')]=_['keys'](_0x30b7aa[_0x8f2e('0x33')]);_0x19399d[_0x8f2e('0x35')]=_[_0x8f2e('0x36')](_0x19399d['model'],_0x19399d['query']);_0x132003[_0x8f2e('0x39')]=_['intersection'](_0x19399d[_0x8f2e('0x37')],qs[_0x8f2e('0x38')](_0x30b7aa[_0x8f2e('0x33')]['fields']));_0x132003[_0x8f2e('0x39')]=_0x132003['attributes'][_0x8f2e('0x4a')]?_0x132003[_0x8f2e('0x39')]:_0x19399d[_0x8f2e('0x37')];if(_0x30b7aa['query'][_0x8f2e('0x43')]){_0x132003[_0x8f2e('0x44')]=[{'all':!![]}];}_0x132003=_['merge']({},_0x132003,_0x30b7aa['options']);return db['Schedule']['find'](_0x132003)[_0x8f2e('0x28')](handleEntityNotFound(_0x19a975,null))['then'](respondWithResult(_0x19a975,null))['catch'](handleError(_0x19a975,null));};exports[_0x8f2e('0x4b')]=function(_0x1ca832,_0x293165){return db[_0x8f2e('0x2d')][_0x8f2e('0x4b')](_0x1ca832[_0x8f2e('0x4c')],{})[_0x8f2e('0x28')](function(_0x1d5f45){var _0x406e3d=_0x1ca832[_0x8f2e('0x4d')][_0x8f2e('0x4e')]({'plain':!![]});if(!_0x406e3d)throw new Error(_0x8f2e('0x4f'));if(_0x406e3d[_0x8f2e('0x50')]===_0x8f2e('0x4d')){var _0x29f597=_0x1d5f45['get']({'plain':!![]});var _0x508d85=_0x8f2e('0x2a');return db[_0x8f2e('0x51')][_0x8f2e('0x52')]({'where':{'name':_0x508d85,'userProfileId':_0x406e3d[_0x8f2e('0x53')]},'raw':!![]})[_0x8f2e('0x28')](function(_0x3e5359){if(_0x3e5359&&_0x3e5359['autoAssociation']===0x0){return db[_0x8f2e('0x2b')]['create']({'name':_0x29f597[_0x8f2e('0x2c')],'resourceId':_0x29f597['id'],'type':_0x3e5359[_0x8f2e('0x2c')],'sectionId':_0x3e5359['id']},{})[_0x8f2e('0x28')](function(){return _0x1d5f45;});}else{return _0x1d5f45;}})[_0x8f2e('0x47')](function(_0x3f7aa8){logger[_0x8f2e('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7aa8);throw _0x3f7aa8;});}return _0x1d5f45;})[_0x8f2e('0x28')](respondWithResult(_0x293165,0xc9))[_0x8f2e('0x47')](handleError(_0x293165,null));};exports[_0x8f2e('0x27')]=function(_0xc99378,_0x35e6c4){if(_0xc99378[_0x8f2e('0x4c')]['id']){delete _0xc99378[_0x8f2e('0x4c')]['id'];}return db[_0x8f2e('0x2d')][_0x8f2e('0x52')]({'where':{'id':_0xc99378['params']['id']}})[_0x8f2e('0x28')](handleEntityNotFound(_0x35e6c4,null))[_0x8f2e('0x28')](saveUpdates(_0xc99378[_0x8f2e('0x4c')],null))[_0x8f2e('0x28')](respondWithResult(_0x35e6c4,null))[_0x8f2e('0x47')](handleError(_0x35e6c4,null));};exports[_0x8f2e('0x29')]=function(_0x5b0437,_0x3a5ae8){return db['Schedule'][_0x8f2e('0x52')]({'where':{'id':_0x5b0437[_0x8f2e('0x49')]['id']}})[_0x8f2e('0x28')](handleEntityNotFound(_0x3a5ae8,null))[_0x8f2e('0x28')](removeEntity(_0x3a5ae8,null))['catch'](handleError(_0x3a5ae8,null));};exports[_0x8f2e('0x55')]=function(_0x17ca39,_0x3ec9a0,_0x4c4a6e){var _0x41153c=require('../../config/schedule');return db[_0x8f2e('0x2d')]['find']({'where':{'id':_0x17ca39[_0x8f2e('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3ec9a0,null))['then'](function(){_0x41153c[_0x8f2e('0x55')](_0x17ca39['params']['id']);})[_0x8f2e('0x28')](respondWithStatusCode(_0x3ec9a0,null))[_0x8f2e('0x47')](handleError(_0x3ec9a0,null));}; \ No newline at end of file +var _0x1d93=['run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','desk.js','querystring','../../components/auth/service','../../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','reject','save','update','destroy','then','UserProfileResource','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x2a2abf,_0x4b5ef2){var _0x20077a=function(_0x574905){while(--_0x574905){_0x2a2abf['push'](_0x2a2abf['shift']());}};_0x20077a(++_0x4b5ef2);}(_0x1d93,0xa2));var _0x31d9=function(_0x451429,_0x5540dc){_0x451429=_0x451429-0x0;var _0x688119=_0x1d93[_0x451429];return _0x688119;};'use strict';var emlformat=require(_0x31d9('0x0'));var rimraf=require(_0x31d9('0x1'));var zipdir=require(_0x31d9('0x2'));var jsonpatch=require(_0x31d9('0x3'));var rp=require('request-promise');var moment=require(_0x31d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31d9('0x5'));var util=require(_0x31d9('0x6'));var path=require('path');var sox=require(_0x31d9('0x7'));var csv=require(_0x31d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x31d9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31d9('0xa'));var toCsv=require(_0x31d9('0x8'));var querystring=require(_0x31d9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31d9('0xc'));var qs=require(_0x31d9('0xd'));var as=require(_0x31d9('0xe'));var hardwareService=require(_0x31d9('0xf'));var logger=require(_0x31d9('0x10'))('api');var utils=require(_0x31d9('0x11'));var config=require(_0x31d9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x31d9('0x13'))['db'];function respondWithStatusCode(_0x15a5bb,_0xe10ca3){_0xe10ca3=_0xe10ca3||0xcc;return function(_0x2e525c){if(_0x2e525c){return _0x15a5bb[_0x31d9('0x14')](_0xe10ca3);}return _0x15a5bb[_0x31d9('0x15')](_0xe10ca3)[_0x31d9('0x16')]();};}function respondWithResult(_0x2b8e9c,_0x3f0bdf){_0x3f0bdf=_0x3f0bdf||0xc8;return function(_0x9ab033){if(_0x9ab033){return _0x2b8e9c[_0x31d9('0x15')](_0x3f0bdf)[_0x31d9('0x17')](_0x9ab033);}};}function respondWithFilteredResult(_0x26332c,_0x54fe64){return function(_0x195780){if(_0x195780){var _0x563505=typeof _0x54fe64[_0x31d9('0x18')]===_0x31d9('0x19')&&typeof _0x54fe64[_0x31d9('0x1a')]===_0x31d9('0x19');var _0x597879=_0x195780['count'];var _0x2840c3=_0x563505?0x0:_0x54fe64[_0x31d9('0x18')];var _0x44e33e=_0x563505?_0x195780[_0x31d9('0x1b')]:_0x54fe64[_0x31d9('0x18')]+_0x54fe64[_0x31d9('0x1a')];var _0x3effec;if(_0x44e33e>=_0x597879){_0x44e33e=_0x597879;_0x3effec=0xc8;}else{_0x3effec=0xce;}_0x26332c[_0x31d9('0x15')](_0x3effec);return _0x26332c[_0x31d9('0x1c')]('Content-Range',_0x2840c3+'-'+_0x44e33e+'/'+_0x597879)[_0x31d9('0x17')](_0x195780);}return null;};}function patchUpdates(_0x26723d){return function(_0x1456b3){try{jsonpatch['apply'](_0x1456b3,_0x26723d,!![]);}catch(_0x1e22fb){return BPromise[_0x31d9('0x1d')](_0x1e22fb);}return _0x1456b3[_0x31d9('0x1e')]();};}function saveUpdates(_0xaa70f2,_0x203310){return function(_0x333e6f){if(_0x333e6f){return _0x333e6f[_0x31d9('0x1f')](_0xaa70f2)['then'](function(_0x2ed45e){return _0x2ed45e;});}return null;};}function removeEntity(_0xb6f67,_0x4736a4){return function(_0x5825b4){if(_0x5825b4){return _0x5825b4[_0x31d9('0x20')]()[_0x31d9('0x21')](function(){var _0x4712b2=_0x5825b4['get']({'plain':!![]});var _0x193f3e='Scheduler';return db[_0x31d9('0x22')][_0x31d9('0x20')]({'where':{'type':_0x193f3e,'resourceId':_0x4712b2['id']}})[_0x31d9('0x21')](function(){return _0x5825b4;});})['then'](function(){_0xb6f67[_0x31d9('0x15')](0xcc)[_0x31d9('0x16')]();});}};}function handleEntityNotFound(_0x4479ef,_0x18e1ea){return function(_0x32c4ef){if(!_0x32c4ef){_0x4479ef[_0x31d9('0x14')](0x194);}return _0x32c4ef;};}function handleError(_0x65ab6f,_0x1e1d6e){_0x1e1d6e=_0x1e1d6e||0x1f4;return function(_0x5eb3d4){logger['error'](_0x5eb3d4['stack']);if(_0x5eb3d4[_0x31d9('0x23')]){delete _0x5eb3d4['name'];}_0x65ab6f[_0x31d9('0x15')](_0x1e1d6e)[_0x31d9('0x24')](_0x5eb3d4);};}exports[_0x31d9('0x25')]=function(_0x19f1c6,_0x5cdf98){var _0x4cec67={},_0x147a34={},_0xf9a40e={'count':0x0,'rows':[]};var _0xbfd264=_[_0x31d9('0x26')](db[_0x31d9('0x27')][_0x31d9('0x28')],function(_0x37a28b){return{'name':_0x37a28b[_0x31d9('0x29')],'type':_0x37a28b[_0x31d9('0x2a')][_0x31d9('0x2b')]};});_0x147a34['model']=_['map'](_0xbfd264,_0x31d9('0x23'));_0x147a34[_0x31d9('0x2c')]=_[_0x31d9('0x2d')](_0x19f1c6[_0x31d9('0x2c')]);_0x147a34[_0x31d9('0x2e')]=_[_0x31d9('0x2f')](_0x147a34[_0x31d9('0x30')],_0x147a34['query']);_0x4cec67[_0x31d9('0x31')]=_[_0x31d9('0x2f')](_0x147a34[_0x31d9('0x30')],qs['fields'](_0x19f1c6['query']['fields']));_0x4cec67[_0x31d9('0x31')]=_0x4cec67[_0x31d9('0x31')][_0x31d9('0x32')]?_0x4cec67[_0x31d9('0x31')]:_0x147a34[_0x31d9('0x30')];if(!_0x19f1c6[_0x31d9('0x2c')][_0x31d9('0x33')](_0x31d9('0x34'))){_0x4cec67[_0x31d9('0x1a')]=qs[_0x31d9('0x1a')](_0x19f1c6[_0x31d9('0x2c')][_0x31d9('0x1a')]);_0x4cec67[_0x31d9('0x18')]=qs['offset'](_0x19f1c6[_0x31d9('0x2c')]['offset']);}_0x4cec67[_0x31d9('0x35')]=qs[_0x31d9('0x36')](_0x19f1c6[_0x31d9('0x2c')]['sort']);_0x4cec67[_0x31d9('0x37')]=qs['filters'](_[_0x31d9('0x38')](_0x19f1c6[_0x31d9('0x2c')],_0x147a34[_0x31d9('0x2e')]),_0xbfd264);if(_0x19f1c6['query'][_0x31d9('0x39')]){_0x4cec67['where']=_['merge'](_0x4cec67[_0x31d9('0x37')],{'$or':_[_0x31d9('0x26')](_0xbfd264,function(_0x1dde71){if(_0x1dde71[_0x31d9('0x2a')]!=='VIRTUAL'){var _0x4db1c9={};_0x4db1c9[_0x1dde71[_0x31d9('0x23')]]={'$like':'%'+_0x19f1c6[_0x31d9('0x2c')][_0x31d9('0x39')]+'%'};return _0x4db1c9;}})});}_0x4cec67=_[_0x31d9('0x3a')]({},_0x4cec67,_0x19f1c6[_0x31d9('0x3b')]);var _0x234fdc={'where':_0x4cec67[_0x31d9('0x37')]};return db[_0x31d9('0x27')]['count'](_0x234fdc)['then'](function(_0x139083){_0xf9a40e[_0x31d9('0x1b')]=_0x139083;if(_0x19f1c6['query']['includeAll']){_0x4cec67[_0x31d9('0x3c')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4cec67);})['then'](function(_0x9b30de){_0xf9a40e[_0x31d9('0x3d')]=_0x9b30de;return _0xf9a40e;})[_0x31d9('0x21')](respondWithFilteredResult(_0x5cdf98,_0x4cec67))[_0x31d9('0x3e')](handleError(_0x5cdf98,null));};exports[_0x31d9('0x3f')]=function(_0x1bfb1a,_0x7f5371){var _0x123ca8={'raw':![],'where':{'id':_0x1bfb1a[_0x31d9('0x40')]['id']}},_0x27636d={};_0x27636d[_0x31d9('0x30')]=_[_0x31d9('0x2d')](db[_0x31d9('0x27')][_0x31d9('0x28')]);_0x27636d[_0x31d9('0x2c')]=_[_0x31d9('0x2d')](_0x1bfb1a[_0x31d9('0x2c')]);_0x27636d[_0x31d9('0x2e')]=_['intersection'](_0x27636d[_0x31d9('0x30')],_0x27636d[_0x31d9('0x2c')]);_0x123ca8[_0x31d9('0x31')]=_[_0x31d9('0x2f')](_0x27636d[_0x31d9('0x30')],qs[_0x31d9('0x41')](_0x1bfb1a[_0x31d9('0x2c')][_0x31d9('0x41')]));_0x123ca8[_0x31d9('0x31')]=_0x123ca8[_0x31d9('0x31')]['length']?_0x123ca8['attributes']:_0x27636d['model'];if(_0x1bfb1a[_0x31d9('0x2c')]['includeAll']){_0x123ca8[_0x31d9('0x3c')]=[{'all':!![]}];}_0x123ca8=_['merge']({},_0x123ca8,_0x1bfb1a[_0x31d9('0x3b')]);return db[_0x31d9('0x27')][_0x31d9('0x42')](_0x123ca8)[_0x31d9('0x21')](handleEntityNotFound(_0x7f5371,null))[_0x31d9('0x21')](respondWithResult(_0x7f5371,null))[_0x31d9('0x3e')](handleError(_0x7f5371,null));};exports[_0x31d9('0x43')]=function(_0x3935bd,_0x20cd5d){return db[_0x31d9('0x27')][_0x31d9('0x43')](_0x3935bd['body'],{})[_0x31d9('0x21')](function(_0x336823){var _0x4134b7=_0x3935bd[_0x31d9('0x44')][_0x31d9('0x45')]({'plain':!![]});if(!_0x4134b7)throw new Error(_0x31d9('0x46'));if(_0x4134b7[_0x31d9('0x47')]===_0x31d9('0x44')){var _0x5442f8=_0x336823[_0x31d9('0x45')]({'plain':!![]});var _0x2ded53='Scheduler';return db[_0x31d9('0x48')][_0x31d9('0x42')]({'where':{'name':_0x2ded53,'userProfileId':_0x4134b7[_0x31d9('0x49')]},'raw':!![]})['then'](function(_0x4381b5){if(_0x4381b5&&_0x4381b5[_0x31d9('0x4a')]===0x0){return db['UserProfileResource'][_0x31d9('0x43')]({'name':_0x5442f8[_0x31d9('0x23')],'resourceId':_0x5442f8['id'],'type':_0x4381b5[_0x31d9('0x23')],'sectionId':_0x4381b5['id']},{})[_0x31d9('0x21')](function(){return _0x336823;});}else{return _0x336823;}})['catch'](function(_0x26bce9){logger[_0x31d9('0x4b')](_0x31d9('0x4c'),_0x26bce9);throw _0x26bce9;});}return _0x336823;})[_0x31d9('0x21')](respondWithResult(_0x20cd5d,0xc9))[_0x31d9('0x3e')](handleError(_0x20cd5d,null));};exports['update']=function(_0x2fb975,_0xa9dbe9){if(_0x2fb975[_0x31d9('0x4d')]['id']){delete _0x2fb975[_0x31d9('0x4d')]['id'];}return db[_0x31d9('0x27')][_0x31d9('0x42')]({'where':{'id':_0x2fb975['params']['id']}})[_0x31d9('0x21')](handleEntityNotFound(_0xa9dbe9,null))[_0x31d9('0x21')](saveUpdates(_0x2fb975[_0x31d9('0x4d')],null))['then'](respondWithResult(_0xa9dbe9,null))[_0x31d9('0x3e')](handleError(_0xa9dbe9,null));};exports[_0x31d9('0x20')]=function(_0x3f1d8f,_0x58f103){return db['Schedule']['find']({'where':{'id':_0x3f1d8f[_0x31d9('0x40')]['id']}})[_0x31d9('0x21')](handleEntityNotFound(_0x58f103,null))[_0x31d9('0x21')](removeEntity(_0x58f103,null))['catch'](handleError(_0x58f103,null));};exports[_0x31d9('0x4e')]=function(_0x138df1,_0x7cc13b,_0xd58f60){var _0x96cb09=require(_0x31d9('0x4f'));return db[_0x31d9('0x27')][_0x31d9('0x42')]({'where':{'id':_0x138df1[_0x31d9('0x40')]['id']},'raw':!![]})[_0x31d9('0x21')](handleEntityNotFound(_0x7cc13b,null))[_0x31d9('0x21')](function(){_0x96cb09[_0x31d9('0x4e')](_0x138df1[_0x31d9('0x40')]['id']);})[_0x31d9('0x21')](respondWithStatusCode(_0x7cc13b,null))[_0x31d9('0x3e')](handleError(_0x7cc13b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b0fc10f..8f0ca07 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 _0xeee5=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x50042b,_0x397fc3){var _0x5415eb=function(_0x262d07){while(--_0x262d07){_0x50042b['push'](_0x50042b['shift']());}};_0x5415eb(++_0x397fc3);}(_0xeee5,0x155));var _0x5eee=function(_0x38176e,_0x536a40){_0x38176e=_0x38176e-0x0;var _0x37f34d=_0xeee5[_0x38176e];return _0x37f34d;};'use strict';var _=require(_0x5eee('0x0'));var util=require(_0x5eee('0x1'));var logger=require(_0x5eee('0x2'))(_0x5eee('0x3'));var moment=require(_0x5eee('0x4'));var BPromise=require(_0x5eee('0x5'));var rp=require(_0x5eee('0x6'));var fs=require('fs');var path=require(_0x5eee('0x7'));var rimraf=require(_0x5eee('0x8'));var config=require('../../config/environment');var attributes=require(_0x5eee('0x9'));module[_0x5eee('0xa')]=function(_0x2833a0,_0x3c5510){return _0x2833a0[_0x5eee('0xb')](_0x5eee('0xc'),attributes,{'tableName':_0x5eee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa528=['exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x64e2ec,_0x14692d){var _0x28f791=function(_0x3aff1c){while(--_0x3aff1c){_0x64e2ec['push'](_0x64e2ec['shift']());}};_0x28f791(++_0x14692d);}(_0xa528,0x155));var _0x8a52=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xa528[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x8a52('0x0'));var util=require(_0x8a52('0x1'));var logger=require(_0x8a52('0x2'))(_0x8a52('0x3'));var moment=require(_0x8a52('0x4'));var BPromise=require(_0x8a52('0x5'));var rp=require(_0x8a52('0x6'));var fs=require('fs');var path=require(_0x8a52('0x7'));var rimraf=require(_0x8a52('0x8'));var config=require(_0x8a52('0x9'));var attributes=require('./schedule.attributes');module[_0x8a52('0xa')]=function(_0x10e4da,_0x2c83e3){return _0x10e4da[_0x8a52('0xb')](_0x8a52('0xc'),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 fa325fd..5ba325b 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 _0xd19f=['message','result','util','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s'];(function(_0x3a734c,_0x1304ec){var _0x27c2d2=function(_0x59bcc5){while(--_0x59bcc5){_0x3a734c['push'](_0x3a734c['shift']());}};_0x27c2d2(++_0x1304ec);}(_0xd19f,0x1bc));var _0xfd19=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xd19f[_0x18cac4];return _0x2227c6;};'use strict';var _=require('lodash');var util=require(_0xfd19('0x0'));var moment=require('moment');var BPromise=require(_0xfd19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd19('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd19('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd19('0x4'));var client=jayson[_0xfd19('0x5')][_0xfd19('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2866ba,_0x4fb376,_0x296ce8){return new BPromise(function(_0x22ccfa,_0x56da63){return client[_0xfd19('0x7')](_0x2866ba,_0x296ce8)['then'](function(_0x50c211){logger[_0xfd19('0x8')]('Schedule,\x20%s,\x20%s',_0x4fb376,_0xfd19('0x9'));logger[_0xfd19('0xa')](_0xfd19('0xb'),_0x4fb376,_0xfd19('0x9'),JSON['stringify'](_0x50c211));if(_0x50c211[_0xfd19('0xc')]){if(_0x50c211[_0xfd19('0xc')][_0xfd19('0xd')]===0x1f4){logger[_0xfd19('0xc')](_0xfd19('0xe'),_0x4fb376,_0x50c211[_0xfd19('0xc')][_0xfd19('0xf')]);return _0x56da63(_0x50c211[_0xfd19('0xc')]['message']);}logger[_0xfd19('0xc')](_0xfd19('0xe'),_0x4fb376,_0x50c211[_0xfd19('0xc')]['message']);return _0x22ccfa(_0x50c211['error'][_0xfd19('0xf')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x4fb376,_0xfd19('0x9'));_0x22ccfa(_0x50c211[_0xfd19('0x10')][_0xfd19('0xf')]);}})['catch'](function(_0xd33e){logger[_0xfd19('0xc')](_0xfd19('0xe'),_0x4fb376,_0xd33e);_0x56da63(_0xd33e);});});} \ No newline at end of file +var _0x1629=['rpc','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c6860,_0x2bec46){var _0x1c0962=function(_0x5088b8){while(--_0x5088b8){_0x1c6860['push'](_0x1c6860['shift']());}};_0x1c0962(++_0x2bec46);}(_0x1629,0xd1));var _0x9162=function(_0x28c0d3,_0x5ec6c7){_0x28c0d3=_0x28c0d3-0x0;var _0x572cf4=_0x1629[_0x28c0d3];return _0x572cf4;};'use strict';var _=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var moment=require(_0x9162('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9162('0x3'));var db=require(_0x9162('0x4'))['db'];var utils=require(_0x9162('0x5'));var logger=require(_0x9162('0x6'))(_0x9162('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa56410,_0x23ab19,_0x3a7ec8){return new BPromise(function(_0x53b571,_0x34fab4){return client[_0x9162('0x8')](_0xa56410,_0x3a7ec8)['then'](function(_0x24b7fb){logger['info'](_0x9162('0x9'),_0x23ab19,'request\x20sent');logger[_0x9162('0xa')](_0x9162('0xb'),_0x23ab19,_0x9162('0xc'),JSON['stringify'](_0x24b7fb));if(_0x24b7fb[_0x9162('0xd')]){if(_0x24b7fb[_0x9162('0xd')][_0x9162('0xe')]===0x1f4){logger[_0x9162('0xd')](_0x9162('0x9'),_0x23ab19,_0x24b7fb[_0x9162('0xd')][_0x9162('0xf')]);return _0x34fab4(_0x24b7fb[_0x9162('0xd')]['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x23ab19,_0x24b7fb[_0x9162('0xd')][_0x9162('0xf')]);return _0x53b571(_0x24b7fb[_0x9162('0xd')][_0x9162('0xf')]);}else{logger['info'](_0x9162('0x9'),_0x23ab19,_0x9162('0xc'));_0x53b571(_0x24b7fb[_0x9162('0x10')][_0x9162('0xf')]);}})[_0x9162('0x11')](function(_0x1b3cf6){logger[_0x9162('0xd')](_0x9162('0x9'),_0x23ab19,_0x1b3cf6);_0x34fab4(_0x1b3cf6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fcce3b7..ae64ef5 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 _0x13e1=['isAuthenticated','/describe','describe','/:id','show','download','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x13e1,0x171));var _0x113e=function(_0x48552f,_0x182890){_0x48552f=_0x48552f-0x0;var _0x5525e3=_0x13e1[_0x48552f];return _0x5525e3;};'use strict';var multer=require(_0x113e('0x0'));var util=require(_0x113e('0x1'));var path=require(_0x113e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x113e('0x3')]();var fs_extra=require(_0x113e('0x4'));var auth=require(_0x113e('0x5'));var interaction=require(_0x113e('0x6'));var config=require('../../config/environment');var controller=require(_0x113e('0x7'));router[_0x113e('0x8')]('/',auth[_0x113e('0x9')](),controller['index']);router[_0x113e('0x8')](_0x113e('0xa'),auth['isAuthenticated'](),controller[_0x113e('0xb')]);router[_0x113e('0x8')](_0x113e('0xc'),auth[_0x113e('0x9')](),controller[_0x113e('0xd')]);router[_0x113e('0x8')]('/:id/download',auth[_0x113e('0x9')](),controller[_0x113e('0xe')]);router[_0x113e('0xf')]('/',auth[_0x113e('0x9')](),controller[_0x113e('0x10')]);router[_0x113e('0x11')]('/:id',auth[_0x113e('0x9')](),controller[_0x113e('0x12')]);router[_0x113e('0x13')](_0x113e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x113e('0x14')]=router; \ No newline at end of file +var _0x670b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','create','put','destroy','exports','multer','util','path'];(function(_0x284c2d,_0x28d2c1){var _0x3cbc53=function(_0x301340){while(--_0x301340){_0x284c2d['push'](_0x284c2d['shift']());}};_0x3cbc53(++_0x28d2c1);}(_0x670b,0x6b));var _0xb670=function(_0x305044,_0x4f9159){_0x305044=_0x305044-0x0;var _0x3693fe=_0x670b[_0x305044];return _0x3693fe;};'use strict';var multer=require(_0xb670('0x0'));var util=require(_0xb670('0x1'));var path=require(_0xb670('0x2'));var timeout=require(_0xb670('0x3'));var express=require('express');var router=express[_0xb670('0x4')]();var fs_extra=require(_0xb670('0x5'));var auth=require(_0xb670('0x6'));var interaction=require(_0xb670('0x7'));var config=require(_0xb670('0x8'));var controller=require(_0xb670('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb670('0xa')](_0xb670('0xb'),auth['isAuthenticated'](),controller[_0xb670('0xc')]);router[_0xb670('0xa')](_0xb670('0xd'),auth[_0xb670('0xe')](),controller[_0xb670('0xf')]);router[_0xb670('0xa')](_0xb670('0x10'),auth[_0xb670('0xe')](),controller[_0xb670('0x11')]);router['post']('/',auth[_0xb670('0xe')](),controller[_0xb670('0x12')]);router[_0xb670('0x13')]('/:id',auth[_0xb670('0xe')](),controller['update']);router['delete'](_0xb670('0xd'),auth[_0xb670('0xe')](),controller[_0xb670('0x14')]);module[_0xb670('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 83cba35..ec143e0 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 _0x881e=['createdAt','toString','updatedAt','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt'];(function(_0x1e99d1,_0x38250c){var _0x3ae329=function(_0x2db617){while(--_0x2db617){_0x1e99d1['push'](_0x1e99d1['shift']());}};_0x3ae329(++_0x38250c);}(_0x881e,0x146));var _0xe881=function(_0x5121d8,_0x39d482){_0x5121d8=_0x5121d8-0x0;var _0x1c8885=_0x881e[_0x5121d8];return _0x1c8885;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe881('0x0'));var config=require(_0xe881('0x1'));module['exports']={'format':{'type':Sequelize[_0xe881('0x2')],'get':function(){return this['getDataValue'](_0xe881('0x3'))?path[_0xe881('0x4')](this[_0xe881('0x5')](_0xe881('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe881('0x6')]},'value':{'type':Sequelize[_0xe881('0x6')],'set':function(_0x561c1c){var _0x3f6894=_0x561c1c[_0xe881('0x7')](/\\/g,'/');this[_0xe881('0x8')]('value',_0x3f6894);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe881('0x9')],'set':function(_0x26e29e){this[_0xe881('0x8')](_0xe881('0xa'),moment()['subtract'](_0x26e29e,'ms'));this[_0xe881('0x8')]('closedAt',moment());this[_0xe881('0x8')](_0xe881('0xb'),_0x26e29e);}},'startedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0xa')))[_0xe881('0xd')](_0xe881('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0xf')))['format'](_0xe881('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0x10')))[_0xe881('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xe881('0x11')]();}},'updatedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0x12')))['format'](_0xe881('0xe'))[_0xe881('0x11')]();}}}; \ No newline at end of file +var _0x186d=['../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x186d,0x1ca));var _0xd186=function(_0x3b80d6,_0x18a56a){_0x3b80d6=_0x3b80d6-0x0;var _0x4e08f1=_0x186d[_0x3b80d6];return _0x4e08f1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var config=require(_0xd186('0x2'));module[_0xd186('0x3')]={'format':{'type':Sequelize[_0xd186('0x4')],'get':function(){return this[_0xd186('0x5')]('value')?path[_0xd186('0x6')](this[_0xd186('0x5')](_0xd186('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xd186('0x8')],'set':function(_0x60fc96){var _0x2ecccd=_0x60fc96['replace'](/\\/g,'/');this[_0xd186('0x9')](_0xd186('0x7'),_0x2ecccd);}},'rating':{'type':Sequelize[_0xd186('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1ef64a){this[_0xd186('0x9')](_0xd186('0xb'),moment()[_0xd186('0xc')](_0x1ef64a,'ms'));this[_0xd186('0x9')](_0xd186('0xd'),moment());this['setDataValue']('duration',_0x1ef64a);}},'startedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0xb')))[_0xd186('0xf')](_0xd186('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0xd')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}},'createdAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this[_0xd186('0x5')](_0xd186('0x12')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}},'updatedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0x13')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9ea5aec..f291e22 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 _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae24,0x182));var _0x4ae2=function(_0xb61502,_0x36ceed){_0xb61502=_0xb61502-0x0;var _0x21fea3=_0xae24[_0xb61502];return _0x21fea3;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file +var _0xb138=['format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','findAll','rows','catch','params','keys','includeAll','include','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model'];(function(_0x42e034,_0x5ecdef){var _0x1d3d70=function(_0x800c3c){while(--_0x800c3c){_0x42e034['push'](_0x42e034['shift']());}};_0x1d3d70(++_0x5ecdef);}(_0xb138,0x1dd));var _0x8b13=function(_0x40e41e,_0x3d30e7){_0x40e41e=_0x40e41e-0x0;var _0x18b70c=_0xb138[_0x40e41e];return _0x18b70c;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['differenceBy'](_[_0x8b13('0x2e')](_0x35fdca,_0x8b13('0x2b')),[_0x8b13('0x35')]);_0x2bb51d[_0x8b13('0x36')]=_['keys'](_0x3475d8['query']);_0x2bb51d[_0x8b13('0x37')]=_['intersection'](_0x2bb51d['model'],_0x2bb51d[_0x8b13('0x36')]);_0x114b01['attributes']=_[_0x8b13('0x38')](_0x2bb51d[_0x8b13('0x34')],qs[_0x8b13('0x39')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x39')]));_0x114b01[_0x8b13('0x3a')]=_0x114b01[_0x8b13('0x3a')][_0x8b13('0x3b')]?_0x114b01[_0x8b13('0x3a')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8['query'][_0x8b13('0x3c')](_0x8b13('0x3d'))){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8['query'][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3e')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x3e')]);_0x114b01[_0x8b13('0x3f')]=qs[_0x8b13('0x37')](_[_0x8b13('0x40')](_0x3475d8['query'],_0x2bb51d['filters']),_0x35fdca);if(_0x3475d8[_0x8b13('0x36')]['filter']){_0x114b01[_0x8b13('0x3f')]=_['merge'](_0x114b01[_0x8b13('0x3f')],{'$or':_[_0x8b13('0x2e')](_0x35fdca,function(_0x29a359){if(_0x29a359[_0x8b13('0x32')]!==_0x8b13('0x41')){var _0x4e16e7={};_0x4e16e7[_0x29a359['name']]={'$like':'%'+_0x3475d8[_0x8b13('0x36')]['filter']+'%'};return _0x4e16e7;}})});}_0x114b01=_[_0x8b13('0x42')]({},_0x114b01,_0x3475d8[_0x8b13('0x43')]);var _0x4dc268={'where':_0x114b01[_0x8b13('0x3f')]};return db[_0x8b13('0x2f')][_0x8b13('0x20')](_0x4dc268)[_0x8b13('0x26')](function(_0x2f4e7f){_0x5ab161[_0x8b13('0x20')]=_0x2f4e7f;if(_0x3475d8[_0x8b13('0x36')]['includeAll']){_0x114b01['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x8b13('0x44')](_0x114b01);})[_0x8b13('0x26')](function(_0x27cfe5){_0x5ab161[_0x8b13('0x45')]=_0x27cfe5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x46')](handleError(_0x1511bf,null));};exports['show']=function(_0x4342db,_0x50e535){var _0x13d0ef={'raw':![],'where':{'id':_0x4342db[_0x8b13('0x47')]['id']}},_0x5ce9c8={};_0x5ce9c8[_0x8b13('0x34')]=_[_0x8b13('0x48')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x5ce9c8[_0x8b13('0x36')]=_[_0x8b13('0x48')](_0x4342db['query']);_0x5ce9c8['filters']=_['intersection'](_0x5ce9c8[_0x8b13('0x34')],_0x5ce9c8[_0x8b13('0x36')]);_0x13d0ef[_0x8b13('0x3a')]=_[_0x8b13('0x38')](_0x5ce9c8['model'],qs['fields'](_0x4342db[_0x8b13('0x36')]['fields']));_0x13d0ef[_0x8b13('0x3a')]=_0x13d0ef[_0x8b13('0x3a')][_0x8b13('0x3b')]?_0x13d0ef[_0x8b13('0x3a')]:_0x5ce9c8[_0x8b13('0x34')];if(_0x4342db['query'][_0x8b13('0x49')]){_0x13d0ef[_0x8b13('0x4a')]=[{'all':!![]}];}_0x13d0ef=_[_0x8b13('0x42')]({},_0x13d0ef,_0x4342db[_0x8b13('0x43')]);return db[_0x8b13('0x2f')][_0x8b13('0x4b')](_0x13d0ef)[_0x8b13('0x26')](handleEntityNotFound(_0x50e535,null))[_0x8b13('0x26')](respondWithResult(_0x50e535,null))[_0x8b13('0x46')](handleError(_0x50e535,null));};exports['create']=function(_0x46d096,_0x59d863){return db[_0x8b13('0x2f')][_0x8b13('0x4c')](_0x46d096[_0x8b13('0x4d')],{})['then'](respondWithResult(_0x59d863,0xc9))[_0x8b13('0x46')](handleError(_0x59d863,null));};exports[_0x8b13('0x25')]=function(_0x257107,_0x4129c0){if(_0x257107[_0x8b13('0x4d')]['id']){delete _0x257107[_0x8b13('0x4d')]['id'];}delete _0x257107[_0x8b13('0x4d')]['duration'];delete _0x257107[_0x8b13('0x4d')]['createdAt'];delete _0x257107[_0x8b13('0x4d')][_0x8b13('0x4e')];delete _0x257107[_0x8b13('0x4d')][_0x8b13('0x4f')];return db[_0x8b13('0x2f')][_0x8b13('0x4b')]({'where':{'id':_0x257107[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x4129c0,null))[_0x8b13('0x26')](saveUpdates(_0x257107[_0x8b13('0x4d')],null))[_0x8b13('0x26')](respondWithResult(_0x4129c0,null))[_0x8b13('0x46')](handleError(_0x4129c0,null));};exports[_0x8b13('0x50')]=function(_0x2bdfae,_0x42c29d){return db[_0x8b13('0x2f')][_0x8b13('0x50')]()['then'](respondWithResult(_0x42c29d,null))[_0x8b13('0x46')](handleError(_0x42c29d,null));};exports[_0x8b13('0x51')]=function(_0x4c19f6,_0x342fff,_0x328373){var _0x2fc00c=require(_0x8b13('0x52'));var _0x25cb45=![];var _0x12549b={};if(_0x4c19f6[_0x8b13('0x36')][_0x8b13('0x32')]&&_0x4c19f6[_0x8b13('0x36')][_0x8b13('0x32')]===_0x8b13('0x53')){_0x12549b[_0x8b13('0x53')]=_0x4c19f6[_0x8b13('0x47')]['id'];}else{_0x12549b['id']=_0x4c19f6[_0x8b13('0x47')]['id'];}return db[_0x8b13('0x2f')]['find']({'where':_0x12549b,'attributes':['id',_0x8b13('0x4f')],'raw':!![]})[_0x8b13('0x26')](handleEntityNotFound(_0x342fff,null))['then'](function(_0x11e8af){if(_0x11e8af){var _0x73aba5=path[_0x8b13('0x54')](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x11e8af['value']);var _0x1fd105=util[_0x8b13('0x35')](_0x8b13('0x57'),_0x73aba5);if(fs['existsSync'](_0x1fd105)){_0x25cb45=!![];return _0x2fc00c[_0x8b13('0x58')](_0x1fd105,_0x73aba5,config[_0x8b13('0x59')]['recording'])[_0x8b13('0x26')](function(){return _0x11e8af;});}return _0x11e8af;}})[_0x8b13('0x26')](function(_0x475c8d){if(_0x475c8d){var _0xd29067=path['join'](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x475c8d['value']);if(!fs[_0x8b13('0x5a')](_0xd29067)){throw new db[(_0x8b13('0x5b'))][(_0x8b13('0x5c'))](_0x8b13('0x5d'));}if(_0x475c8d['filename']){return _0x342fff[_0x8b13('0x51')](_0xd29067,_0x475c8d[_0x8b13('0x5e')]+path[_0x8b13('0x5f')](_0xd29067),function(){if(_0x25cb45){fs[_0x8b13('0x60')](_0xd29067);}});}else{return _0x342fff[_0x8b13('0x51')](_0xd29067,function(_0x2fff4e){if(_0x25cb45){fs['unlink'](_0xd29067);}});}}})[_0x8b13('0x46')](function(_0x1082d9){if(_0x1082d9[_0x8b13('0x61')]==='ScreenRecording\x20not\x20found'){_0x342fff[_0x8b13('0x1a')](0x194)[_0x8b13('0x2c')](_0x8b13('0x62'));}else{return handleError(_0x342fff,null);}});};exports[_0x8b13('0x27')]=function(_0x4d8f23,_0x59a6b3){return db['ScreenRecording']['find']({'where':{'id':_0x4d8f23['params']['id']}})[_0x8b13('0x26')](function(_0x1bc936){if(_['isNil'](_0x1bc936)){throw new ReferenceError(_0x8b13('0x63'));}return _0x1bc936;})['then'](function(_0x274bad){var _0x2d2fa3=path[_0x8b13('0x54')](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x274bad[_0x8b13('0x4f')]);logger[_0x8b13('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d2fa3);if(!_[_0x8b13('0x65')](_0x274bad['value'])&&fs[_0x8b13('0x5a')](_0x2d2fa3)){logger[_0x8b13('0x64')](_0x8b13('0x66')+_0x2d2fa3+_0x8b13('0x67'));fs[_0x8b13('0x68')](_0x2d2fa3);}_0x2d2fa3=_0x2d2fa3+_0x8b13('0x69');if(!_[_0x8b13('0x65')](_0x274bad['value'])&&fs[_0x8b13('0x5a')](_0x2d2fa3)){logger['info'](_0x8b13('0x66')+_0x2d2fa3+_0x8b13('0x67'));fs[_0x8b13('0x68')](_0x2d2fa3);}return _0x274bad;})[_0x8b13('0x26')](function(_0x177a64){if(!_0x177a64)throw new InternalError();return _0x177a64['destroy']();})['then'](function(){_0x59a6b3[_0x8b13('0x1a')](0xcc)[_0x8b13('0x1b')]();})['catch'](handleError(_0x59a6b3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 19405cf..4f37e47 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 _0x93d3=['screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording'];(function(_0x2a777a,_0x4cdf4e){var _0x34144c=function(_0x29f899){while(--_0x29f899){_0x2a777a['push'](_0x2a777a['shift']());}};_0x34144c(++_0x4cdf4e);}(_0x93d3,0x9e));var _0x393d=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x93d3[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x393d('0x0'));var util=require(_0x393d('0x1'));var logger=require(_0x393d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x393d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x393d('0x4'));var rimraf=require(_0x393d('0x5'));var config=require(_0x393d('0x6'));var attributes=require(_0x393d('0x7'));module[_0x393d('0x8')]=function(_0x25c4ec,_0x118ba2){return _0x25c4ec['define'](_0x393d('0x9'),attributes,{'tableName':_0x393d('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x393d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70b9=['./screenRecording.attributes','exports','define','ScreenRecording','interactionid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x70b9,0x1d9));var _0x970b=function(_0x2a2657,_0x409a0a){_0x2a2657=_0x2a2657-0x0;var _0x4bad72=_0x70b9[_0x2a2657];return _0x4bad72;};'use strict';var _=require('lodash');var util=require(_0x970b('0x0'));var logger=require(_0x970b('0x1'))(_0x970b('0x2'));var moment=require('moment');var BPromise=require(_0x970b('0x3'));var rp=require(_0x970b('0x4'));var fs=require('fs');var path=require(_0x970b('0x5'));var rimraf=require(_0x970b('0x6'));var config=require('../../config/environment');var attributes=require(_0x970b('0x7'));module[_0x970b('0x8')]=function(_0x46b6a3,_0x3bc473){return _0x46b6a3[_0x970b('0x9')](_0x970b('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x970b('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 97371d3..9ad5027 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 _0xcc5a=['then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc5a,0x1c1));var _0xacc5=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xcc5a[_0x52b7b9];return _0x5b5d30;};'use strict';var _=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var moment=require(_0xacc5('0x2'));var BPromise=require(_0xacc5('0x3'));var rs=require(_0xacc5('0x4'));var fs=require('fs');var Redis=require(_0xacc5('0x5'));var db=require(_0xacc5('0x6'))['db'];var utils=require(_0xacc5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xacc5('0x8'));var jayson=require(_0xacc5('0x9'));var client=jayson[_0xacc5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a75b,_0xbb8b05,_0x2c0892){return new BPromise(function(_0xa35e58,_0x5b0ff6){return client['request'](_0x26a75b,_0x2c0892)[_0xacc5('0xb')](function(_0x292bb2){logger[_0xacc5('0xc')](_0xacc5('0xd'),_0xbb8b05,_0xacc5('0xe'));logger[_0xacc5('0xf')](_0xacc5('0x10'),_0xbb8b05,'request\x20sent',JSON[_0xacc5('0x11')](_0x292bb2));if(_0x292bb2[_0xacc5('0x12')]){if(_0x292bb2[_0xacc5('0x12')][_0xacc5('0x13')]===0x1f4){logger['error'](_0xacc5('0xd'),_0xbb8b05,_0x292bb2[_0xacc5('0x12')][_0xacc5('0x14')]);return _0x5b0ff6(_0x292bb2[_0xacc5('0x12')]['message']);}logger[_0xacc5('0x12')](_0xacc5('0xd'),_0xbb8b05,_0x292bb2[_0xacc5('0x12')][_0xacc5('0x14')]);return _0xa35e58(_0x292bb2['error'][_0xacc5('0x14')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0xbb8b05,_0xacc5('0xe'));_0xa35e58(_0x292bb2[_0xacc5('0x15')][_0xacc5('0x14')]);}})[_0xacc5('0x16')](function(_0x373372){logger[_0xacc5('0x12')](_0xacc5('0xd'),_0xbb8b05,_0x373372);_0x5b0ff6(_0x373372);});});} \ No newline at end of file +var _0xfd7f=['lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch'];(function(_0x3c7e8f,_0x52d9f3){var _0x4360b1=function(_0x5d180d){while(--_0x5d180d){_0x3c7e8f['push'](_0x3c7e8f['shift']());}};_0x4360b1(++_0x52d9f3);}(_0xfd7f,0x18f));var _0xffd7=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0xfd7f[_0x28278f];return _0x3d9f74;};'use strict';var _=require(_0xffd7('0x0'));var util=require(_0xffd7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffd7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xffd7('0x3'));var logger=require(_0xffd7('0x4'))('rpc');var config=require(_0xffd7('0x5'));var jayson=require(_0xffd7('0x6'));var client=jayson[_0xffd7('0x7')][_0xffd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2feb77,_0x406a4f,_0x1375ab){return new BPromise(function(_0x5732c3,_0x36f40b){return client[_0xffd7('0x9')](_0x2feb77,_0x1375ab)[_0xffd7('0xa')](function(_0x47c0f8){logger[_0xffd7('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x406a4f,_0xffd7('0xc'));logger[_0xffd7('0xd')](_0xffd7('0xe'),_0x406a4f,_0xffd7('0xc'),JSON[_0xffd7('0xf')](_0x47c0f8));if(_0x47c0f8[_0xffd7('0x10')]){if(_0x47c0f8[_0xffd7('0x10')]['code']===0x1f4){logger[_0xffd7('0x10')](_0xffd7('0x11'),_0x406a4f,_0x47c0f8[_0xffd7('0x10')]['message']);return _0x36f40b(_0x47c0f8[_0xffd7('0x10')]['message']);}logger[_0xffd7('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x406a4f,_0x47c0f8[_0xffd7('0x10')][_0xffd7('0x12')]);return _0x5732c3(_0x47c0f8['error']['message']);}else{logger[_0xffd7('0xb')](_0xffd7('0x11'),_0x406a4f,_0xffd7('0xc'));_0x5732c3(_0x47c0f8[_0xffd7('0x13')]['message']);}})[_0xffd7('0x14')](function(_0x1a5710){logger[_0xffd7('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x406a4f,_0x1a5710);_0x36f40b(_0x1a5710);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2561261..5e457d8 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 _0x2c24=['addPreferred','favicon','/:id/favicon','addFavicon','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','/:id/logo_login','addLogoLogin','preferred'];(function(_0x5a9017,_0x4312fc){var _0x596e52=function(_0x35843d){while(--_0x35843d){_0x5a9017['push'](_0x5a9017['shift']());}};_0x596e52(++_0x4312fc);}(_0x2c24,0xfb));var _0x42c2=function(_0x355c13,_0x1ff6bd){_0x355c13=_0x355c13-0x0;var _0x3a9237=_0x2c24[_0x355c13];return _0x3a9237;};'use strict';var multer=require('multer');var util=require(_0x42c2('0x0'));var path=require(_0x42c2('0x1'));var timeout=require(_0x42c2('0x2'));var express=require(_0x42c2('0x3'));var router=express[_0x42c2('0x4')]();var fs_extra=require(_0x42c2('0x5'));var auth=require(_0x42c2('0x6'));var interaction=require(_0x42c2('0x7'));var config=require(_0x42c2('0x8'));var controller=require('./setting.controller');router[_0x42c2('0x9')]('/',auth[_0x42c2('0xa')](),controller[_0x42c2('0xb')]);router[_0x42c2('0x9')](_0x42c2('0xc'),controller[_0x42c2('0xd')]);router[_0x42c2('0x9')](_0x42c2('0xe'),controller['show']);router['get'](_0x42c2('0xf'),controller[_0x42c2('0x10')]);router[_0x42c2('0x9')]('/:id/logo_login',controller[_0x42c2('0x11')]);router[_0x42c2('0x9')]('/:id/gdpr',controller[_0x42c2('0x12')]);router[_0x42c2('0x9')](_0x42c2('0x13'),controller['getPreferred']);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x42c2('0x14')]({'destination':function(_0x1645c6,_0x59284a,_0xbff7a4){_0xbff7a4(null,path[_0x42c2('0x15')](config[_0x42c2('0x16')],_0x42c2('0x17')));},'filename':function(_0x55d3ba,_0x2880b3,_0x5674ee){_0x5674ee(null,util[_0x42c2('0x18')](_0x42c2('0x19'),'logo',path[_0x42c2('0x1a')](_0x2880b3[_0x42c2('0x1b')])));}})});router[_0x42c2('0x1c')](_0x42c2('0xf'),upload[_0x42c2('0x1d')](_0x42c2('0x1e')),controller[_0x42c2('0x1f')]);var upload=multer({'storage':multer[_0x42c2('0x14')]({'destination':function(_0x5c67c2,_0x579fe6,_0x2e0621){_0x2e0621(null,path[_0x42c2('0x15')](config[_0x42c2('0x16')],'server/files/images/logos/'));},'filename':function(_0x20b9ce,_0x1bf5a5,_0x198346){_0x198346(null,util['format'](_0x42c2('0x19'),_0x42c2('0x20'),path[_0x42c2('0x1a')](_0x1bf5a5[_0x42c2('0x1b')])));}})});router[_0x42c2('0x1c')](_0x42c2('0x21'),upload['single'](_0x42c2('0x1e')),controller[_0x42c2('0x22')]);var upload=multer({'storage':multer[_0x42c2('0x14')]({'destination':function(_0x3e9c4b,_0x208328,_0x1cdac2){_0x1cdac2(null,path[_0x42c2('0x15')](config[_0x42c2('0x16')],_0x42c2('0x17')));},'filename':function(_0x10b3c7,_0x1ff712,_0x113f6a){_0x113f6a(null,util[_0x42c2('0x18')](_0x42c2('0x19'),_0x42c2('0x23'),path[_0x42c2('0x1a')](_0x1ff712[_0x42c2('0x1b')])));}})});router[_0x42c2('0x1c')](_0x42c2('0x13'),upload['single'](_0x42c2('0x1e')),controller[_0x42c2('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bf665,_0xb0e27c,_0x1f0a67){_0x1f0a67(null,path['join'](config[_0x42c2('0x16')],_0x42c2('0x17')));},'filename':function(_0x326657,_0x239bb3,_0x57a582){_0x57a582(null,util[_0x42c2('0x18')](_0x42c2('0x19'),_0x42c2('0x25'),path['extname'](_0x239bb3[_0x42c2('0x1b')])));}})});router[_0x42c2('0x1c')](_0x42c2('0x26'),upload[_0x42c2('0x1d')]('file'),controller[_0x42c2('0x27')]);router['put'](_0x42c2('0xe'),auth[_0x42c2('0xa')](),controller['update']);module[_0x42c2('0x28')]=router; \ No newline at end of file +var _0x17d0=['/:id/logo','single','file','join','addLogoLogin','addFavicon','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post'];(function(_0x3fe4be,_0x2c0d2f){var _0x366a46=function(_0x1d1da8){while(--_0x1d1da8){_0x3fe4be['push'](_0x3fe4be['shift']());}};_0x366a46(++_0x2c0d2f);}(_0x17d0,0xd0));var _0x017d=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x17d0[_0x35a140];return _0x30ab82;};'use strict';var multer=require(_0x017d('0x0'));var util=require(_0x017d('0x1'));var path=require('path');var timeout=require(_0x017d('0x2'));var express=require(_0x017d('0x3'));var router=express[_0x017d('0x4')]();var fs_extra=require(_0x017d('0x5'));var auth=require(_0x017d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x017d('0x7'));var controller=require(_0x017d('0x8'));router[_0x017d('0x9')]('/',auth[_0x017d('0xa')](),controller['index']);router[_0x017d('0x9')](_0x017d('0xb'),controller[_0x017d('0xc')]);router['get'](_0x017d('0xd'),controller[_0x017d('0xe')]);router[_0x017d('0x9')]('/:id/logo',controller[_0x017d('0xf')]);router[_0x017d('0x9')](_0x017d('0x10'),controller[_0x017d('0x11')]);router[_0x017d('0x9')](_0x017d('0x12'),controller[_0x017d('0x13')]);router[_0x017d('0x9')](_0x017d('0x14'),controller[_0x017d('0x15')]);router[_0x017d('0x9')](_0x017d('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x017d('0x17')]({'destination':function(_0x4fc4d9,_0x5c6750,_0x3347cd){_0x3347cd(null,path['join'](config[_0x017d('0x18')],_0x017d('0x19')));},'filename':function(_0x310392,_0xd02128,_0x12cd41){_0x12cd41(null,util[_0x017d('0x1a')](_0x017d('0x1b'),_0x017d('0x1c'),path[_0x017d('0x1d')](_0xd02128[_0x017d('0x1e')])));}})});router[_0x017d('0x1f')](_0x017d('0x20'),upload[_0x017d('0x21')](_0x017d('0x22')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x457a75,_0x1faa13,_0x26e5e7){_0x26e5e7(null,path[_0x017d('0x23')](config[_0x017d('0x18')],_0x017d('0x19')));},'filename':function(_0x4116a5,_0x372df4,_0x49e0e7){_0x49e0e7(null,util[_0x017d('0x1a')](_0x017d('0x1b'),'logologin',path[_0x017d('0x1d')](_0x372df4[_0x017d('0x1e')])));}})});router[_0x017d('0x1f')]('/:id/logo_login',upload['single']('file'),controller[_0x017d('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f889f,_0x34db42,_0x28ce85){_0x28ce85(null,path[_0x017d('0x23')](config[_0x017d('0x18')],'server/files/images/logos/'));},'filename':function(_0x36ca94,_0x482704,_0x8de29d){_0x8de29d(null,util[_0x017d('0x1a')](_0x017d('0x1b'),'preferred',path[_0x017d('0x1d')](_0x482704['originalname'])));}})});router['post'](_0x017d('0x14'),upload[_0x017d('0x21')](_0x017d('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0x017d('0x17')]({'destination':function(_0x516dda,_0x25fd64,_0x3df185){_0x3df185(null,path[_0x017d('0x23')](config[_0x017d('0x18')],'server/files/images/logos/'));},'filename':function(_0x2cd767,_0x4635cf,_0x1349cd){_0x1349cd(null,util['format']('%s%s','favicon',path[_0x017d('0x1d')](_0x4635cf[_0x017d('0x1e')])));}})});router[_0x017d('0x1f')](_0x017d('0x16'),upload[_0x017d('0x21')](_0x017d('0x22')),controller[_0x017d('0x25')]);router[_0x017d('0x26')](_0x017d('0xd'),auth[_0x017d('0xa')](),controller[_0x017d('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 56be204..cc5d2ef 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 _0x10a4=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10a4,0x154));var _0x410a=function(_0x1f448a,_0x477d9d){_0x1f448a=_0x1f448a-0x0;var _0x24c6ac=_0x10a4[_0x1f448a];return _0x24c6ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x410a('0x0')](0xb),'unique':_0x410a('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x410a('0x0')](0xb),'unique':_0x410a('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x410a('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x410a('0x3')],'defaultValue':_0x410a('0x4')},'logo':{'type':Sequelize[_0x410a('0x3')]},'defaultLogo':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x410a('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x410a('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x410a('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x410a('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x410a('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x410a('0x6')},'enableEmailPreview':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x410a('0x3')],'defaultValue':_0x410a('0x7')},'chatTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x410a('0x3')]},'defaultPreferred':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x410a('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x410a('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x410a('0x0')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x410a('0x0')]},'sentimentRegion':{'type':Sequelize[_0x410a('0x3')]},'language':{'type':Sequelize[_0x410a('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x410a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x410a('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x410a('0x0')](0x2)[_0x410a('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x410a('0x0')](0x2)[_0x410a('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x410a('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x410a('0x0')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x410a('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xf467=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3630b5,_0x307e8e){var _0x3defbe=function(_0x50b8eb){while(--_0x50b8eb){_0x3630b5['push'](_0x3630b5['shift']());}};_0x3defbe(++_0x307e8e);}(_0xf467,0x93));var _0x7f46=function(_0xab9285,_0x10f1b0){_0xab9285=_0xab9285-0x0;var _0xb752eb=_0xf467[_0xab9285];return _0xb752eb;};'use strict';var Sequelize=require(_0x7f46('0x0'));module[_0x7f46('0x1')]={'min_internal':{'type':Sequelize[_0x7f46('0x2')](0xb),'unique':_0x7f46('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7f46('0x2')](0xb),'unique':_0x7f46('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7f46('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7f46('0x5')],'defaultValue':_0x7f46('0x6')},'logo':{'type':Sequelize[_0x7f46('0x5')]},'defaultLogo':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7f46('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7f46('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7f46('0x5')]},'turnusername':{'type':Sequelize[_0x7f46('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x7f46('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7f46('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x7f46('0x8')},'enableEmailPreview':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7f46('0x9')},'chatTimeout':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7f46('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7f46('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7f46('0x5')]},'defaultFavicon':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7f46('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7f46('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7f46('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7f46('0x2')](0x2)[_0x7f46('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7f46('0x2')](0x2)[_0x7f46('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7f46('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7f46('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7f46('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x7f46('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3f2d49a..de36c61 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 _0x1f63=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','status','end','name','Setting','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','body','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','getLogoLogin','preferred','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','default','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','download','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','send'];(function(_0x354bb3,_0x2be4b7){var _0x2da828=function(_0x2f3c8e){while(--_0x2f3c8e){_0x354bb3['push'](_0x354bb3['shift']());}};_0x2da828(++_0x2be4b7);}(_0x1f63,0x7a));var _0x31f6=function(_0x492af0,_0x90f298){_0x492af0=_0x492af0-0x0;var _0x3231ce=_0x1f63[_0x492af0];return _0x3231ce;};'use strict';var emlformat=require(_0x31f6('0x0'));var rimraf=require(_0x31f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31f6('0x2'));var rp=require(_0x31f6('0x3'));var moment=require(_0x31f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31f6('0x5'));var util=require(_0x31f6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31f6('0x7'));var ejs=require(_0x31f6('0x8'));var fs=require('fs');var fs_extra=require(_0x31f6('0x9'));var _=require('lodash');var squel=require(_0x31f6('0xa'));var crypto=require(_0x31f6('0xb'));var jsforce=require(_0x31f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x31f6('0xd'));var Papa=require('papaparse');var Redis=require(_0x31f6('0xe'));var authService=require(_0x31f6('0xf'));var qs=require(_0x31f6('0x10'));var as=require(_0x31f6('0x11'));var hardwareService=require(_0x31f6('0x12'));var logger=require(_0x31f6('0x13'))(_0x31f6('0x14'));var utils=require(_0x31f6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x31f6('0x16'));var db=require(_0x31f6('0x17'))['db'];var jayson=require(_0x31f6('0x18'));var client=jayson[_0x31f6('0x19')][_0x31f6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x31c1cb,_0x469081,_0x2f1755,_0x2a1550){return new BPromise(function(_0x535bca,_0x29f437){var _0x5a8b7f=_0x2a1550||client;return _0x5a8b7f[_0x31f6('0x1b')](_0x31c1cb,_0x2f1755)['then'](function(_0x3642ef){logger[_0x31f6('0x1c')](_0x31f6('0x1d'),_0x469081,_0x31f6('0x1e'));logger[_0x31f6('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x469081,_0x31f6('0x1e'),JSON[_0x31f6('0x20')](_0x3642ef));if(_0x3642ef['error']){if(_0x3642ef[_0x31f6('0x21')][_0x31f6('0x22')]===0x1f4){logger[_0x31f6('0x21')](_0x31f6('0x1d'),_0x469081,_0x3642ef[_0x31f6('0x21')]['message']);return _0x29f437(_0x3642ef[_0x31f6('0x21')][_0x31f6('0x23')]);}logger[_0x31f6('0x21')]('Setting,\x20%s,\x20%s',_0x469081,_0x3642ef[_0x31f6('0x21')]['message']);return _0x535bca(_0x3642ef[_0x31f6('0x21')][_0x31f6('0x23')]);}else{logger[_0x31f6('0x1c')](_0x31f6('0x1d'),_0x469081,_0x31f6('0x1e'));_0x535bca(_0x3642ef[_0x31f6('0x24')]['message']);}})[_0x31f6('0x25')](function(_0x12f518){logger['error'](_0x31f6('0x1d'),_0x469081,_0x12f518);_0x29f437(_0x12f518);});});}function respondWithStatusCode(_0x12232e,_0x4806d8){_0x4806d8=_0x4806d8||0xcc;return function(_0xb47f15){if(_0xb47f15){return _0x12232e[_0x31f6('0x26')](_0x4806d8);}return _0x12232e['status'](_0x4806d8)['end']();};}function respondWithResult(_0x4c8794,_0x4e9719){_0x4e9719=_0x4e9719||0xc8;return function(_0x5b8e1b){if(_0x5b8e1b){return _0x4c8794['status'](_0x4e9719)[_0x31f6('0x27')](_0x5b8e1b);}};}function respondWithFilteredResult(_0x53c1dd,_0xf2b7cb){return function(_0x90125a){if(_0x90125a){var _0x514ce4=typeof _0xf2b7cb[_0x31f6('0x28')]===_0x31f6('0x29')&&typeof _0xf2b7cb[_0x31f6('0x2a')]===_0x31f6('0x29');var _0xf3a033=_0x90125a[_0x31f6('0x2b')];var _0x549903=_0x514ce4?0x0:_0xf2b7cb[_0x31f6('0x28')];var _0x30a2f2=_0x514ce4?_0x90125a[_0x31f6('0x2b')]:_0xf2b7cb[_0x31f6('0x28')]+_0xf2b7cb[_0x31f6('0x2a')];var _0x2127d4;if(_0x30a2f2>=_0xf3a033){_0x30a2f2=_0xf3a033;_0x2127d4=0xc8;}else{_0x2127d4=0xce;}_0x53c1dd['status'](_0x2127d4);return _0x53c1dd[_0x31f6('0x2c')](_0x31f6('0x2d'),_0x549903+'-'+_0x30a2f2+'/'+_0xf3a033)[_0x31f6('0x27')](_0x90125a);}return null;};}function patchUpdates(_0x310f65){return function(_0x497f43){try{jsonpatch['apply'](_0x497f43,_0x310f65,!![]);}catch(_0x19123f){return BPromise[_0x31f6('0x2e')](_0x19123f);}return _0x497f43['save']();};}function saveUpdates(_0x9d77cd,_0x254512){return function(_0x5d150e){if(_0x5d150e){return _0x5d150e[_0x31f6('0x2f')](_0x9d77cd)[_0x31f6('0x30')](function(_0x263bdc){return _0x263bdc;});}return null;};}function removeEntity(_0x414589,_0x32ca04){return function(_0x4b742c){if(_0x4b742c){return _0x4b742c[_0x31f6('0x31')]()[_0x31f6('0x30')](function(){_0x414589[_0x31f6('0x32')](0xcc)[_0x31f6('0x33')]();});}};}function handleEntityNotFound(_0x298dc8,_0x2370ab){return function(_0x410bed){if(!_0x410bed){_0x298dc8[_0x31f6('0x26')](0x194);}return _0x410bed;};}function handleError(_0x219d2c,_0x4215a9){_0x4215a9=_0x4215a9||0x1f4;return function(_0x597da8){logger[_0x31f6('0x21')](_0x597da8['stack']);if(_0x597da8[_0x31f6('0x34')]){delete _0x597da8['name'];}_0x219d2c[_0x31f6('0x32')](_0x4215a9)['send'](_0x597da8);};}exports['index']=function(_0x4d01c0,_0x58c4c5){var _0x1278de={},_0x887e7a={},_0x552c5e={'count':0x0,'rows':[]};var _0x6ed788=_['map'](db[_0x31f6('0x35')][_0x31f6('0x36')],function(_0x4ec6b7){return{'name':_0x4ec6b7['fieldName'],'type':_0x4ec6b7[_0x31f6('0x37')][_0x31f6('0x38')]};});_0x887e7a[_0x31f6('0x39')]=_[_0x31f6('0x3a')](_0x6ed788,_0x31f6('0x34'));_0x887e7a[_0x31f6('0x3b')]=_[_0x31f6('0x3c')](_0x4d01c0[_0x31f6('0x3b')]);_0x887e7a['filters']=_[_0x31f6('0x3d')](_0x887e7a['model'],_0x887e7a[_0x31f6('0x3b')]);_0x1278de[_0x31f6('0x3e')]=_[_0x31f6('0x3d')](_0x887e7a[_0x31f6('0x39')],qs['fields'](_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x3f')]));_0x1278de[_0x31f6('0x3e')]=_0x1278de[_0x31f6('0x3e')]['length']?_0x1278de[_0x31f6('0x3e')]:_0x887e7a[_0x31f6('0x39')];if(!_0x4d01c0['query']['hasOwnProperty'](_0x31f6('0x40'))){_0x1278de[_0x31f6('0x2a')]=qs[_0x31f6('0x2a')](_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x2a')]);_0x1278de[_0x31f6('0x28')]=qs['offset'](_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x28')]);}_0x1278de[_0x31f6('0x41')]=qs[_0x31f6('0x42')](_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x42')]);_0x1278de[_0x31f6('0x43')]=qs[_0x31f6('0x44')](_[_0x31f6('0x45')](_0x4d01c0[_0x31f6('0x3b')],_0x887e7a[_0x31f6('0x44')]),_0x6ed788);if(_0x4d01c0['query'][_0x31f6('0x46')]){_0x1278de[_0x31f6('0x43')]=_[_0x31f6('0x47')](_0x1278de[_0x31f6('0x43')],{'$or':_['map'](_0x6ed788,function(_0x3fc5fb){if(_0x3fc5fb[_0x31f6('0x37')]!==_0x31f6('0x48')){var _0x365e6f={};_0x365e6f[_0x3fc5fb[_0x31f6('0x34')]]={'$like':'%'+_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x46')]+'%'};return _0x365e6f;}})});}_0x1278de=_[_0x31f6('0x47')]({},_0x1278de,_0x4d01c0[_0x31f6('0x49')]);var _0x2c68e6={'where':_0x1278de[_0x31f6('0x43')]};return db[_0x31f6('0x35')][_0x31f6('0x2b')](_0x2c68e6)[_0x31f6('0x30')](function(_0x1ec451){_0x552c5e[_0x31f6('0x2b')]=_0x1ec451;if(_0x4d01c0[_0x31f6('0x3b')][_0x31f6('0x4a')]){_0x1278de[_0x31f6('0x4b')]=[{'all':!![]}];}return db[_0x31f6('0x35')][_0x31f6('0x4c')](_0x1278de);})['then'](function(_0xefe6c9){_0x552c5e[_0x31f6('0x4d')]=_0xefe6c9;return _0x552c5e;})[_0x31f6('0x30')](respondWithFilteredResult(_0x58c4c5,_0x1278de))[_0x31f6('0x25')](handleError(_0x58c4c5,null));};exports[_0x31f6('0x4e')]=function(_0x26f98a,_0x10c586){var _0x466be1={'raw':![],'where':{'id':_0x26f98a[_0x31f6('0x4f')]['id']}},_0x5ebcd4={};_0x5ebcd4[_0x31f6('0x39')]=_['keys'](db[_0x31f6('0x35')]['rawAttributes']);_0x5ebcd4[_0x31f6('0x3b')]=_[_0x31f6('0x3c')](_0x26f98a['query']);_0x5ebcd4[_0x31f6('0x44')]=_[_0x31f6('0x3d')](_0x5ebcd4[_0x31f6('0x39')],_0x5ebcd4[_0x31f6('0x3b')]);_0x466be1['attributes']=_[_0x31f6('0x3d')](_0x5ebcd4[_0x31f6('0x39')],qs[_0x31f6('0x3f')](_0x26f98a['query'][_0x31f6('0x3f')]));_0x466be1[_0x31f6('0x3e')]=_0x466be1['attributes'][_0x31f6('0x50')]?_0x466be1[_0x31f6('0x3e')]:_0x5ebcd4[_0x31f6('0x39')];if(_0x26f98a[_0x31f6('0x3b')][_0x31f6('0x4a')]){_0x466be1[_0x31f6('0x4b')]=[{'all':!![]}];}_0x466be1=_[_0x31f6('0x47')]({},_0x466be1,_0x26f98a[_0x31f6('0x49')]);return db[_0x31f6('0x35')][_0x31f6('0x51')](_0x466be1)[_0x31f6('0x30')](handleEntityNotFound(_0x10c586,null))[_0x31f6('0x30')](respondWithResult(_0x10c586,null))['catch'](handleError(_0x10c586,null));};exports['update']=function(_0x187d7d,_0x5e4c81){if(_0x187d7d[_0x31f6('0x52')]['id']){delete _0x187d7d[_0x31f6('0x52')]['id'];}return db[_0x31f6('0x35')]['find']({'where':{'id':_0x187d7d['params']['id']}})[_0x31f6('0x30')](handleEntityNotFound(_0x5e4c81,null))[_0x31f6('0x30')](saveUpdates(_0x187d7d[_0x31f6('0x52')],null))['then'](respondWithResult(_0x5e4c81,null))[_0x31f6('0x25')](handleError(_0x5e4c81,null));};exports['addLogo']=function(_0x3e0154,_0x10bf63,_0x113bae){if(_0x3e0154[_0x31f6('0x53')]&&_0x3e0154[_0x31f6('0x53')]['filename']){_0x3e0154['body'][_0x31f6('0x54')]=_0x3e0154['file'][_0x31f6('0x55')];}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x3e0154[_0x31f6('0x4f')]['id']}})[_0x31f6('0x30')](handleEntityNotFound(_0x10bf63,null))[_0x31f6('0x30')](saveUpdates(_0x3e0154[_0x31f6('0x52')],null))['then'](respondWithResult(_0x10bf63,null))['catch'](handleError(_0x10bf63,null));};exports[_0x31f6('0x56')]=function(_0x315035,_0xf98989,_0x323f69){if(_0x315035[_0x31f6('0x53')]&&_0x315035[_0x31f6('0x53')]['filename']){_0x315035[_0x31f6('0x52')]['loginLogo']=_0x315035['file'][_0x31f6('0x55')];}return db['Setting'][_0x31f6('0x51')]({'where':{'id':_0x315035[_0x31f6('0x4f')]['id']}})[_0x31f6('0x30')](handleEntityNotFound(_0xf98989,null))[_0x31f6('0x30')](saveUpdates(_0x315035[_0x31f6('0x52')],null))[_0x31f6('0x30')](respondWithResult(_0xf98989,null))['catch'](handleError(_0xf98989,null));};var utilLicense=require('../../config/license/util');exports[_0x31f6('0x57')]=function(_0x4d3dbb,_0x59adf5,_0x28ac49){var _0x20a07e=_0x31f6('0x58');var _0x2b2d61={'custom':![]};return utilLicense[_0x31f6('0x59')]()[_0x31f6('0x30')](function(_0x1eabb5){if(_0x1eabb5){_0x2b2d61=_0x1eabb5;}return db['Setting'][_0x31f6('0x51')]({'where':{'id':_0x4d3dbb[_0x31f6('0x4f')]['id']},'attributes':[_0x31f6('0x54'),_0x31f6('0x5a'),'preferred',_0x31f6('0x5b'),_0x31f6('0x5c'),'defaultLoginLogo','defaultPreferred',_0x31f6('0x5d')],'raw':!![]});})[_0x31f6('0x30')](handleEntityNotFound(_0x59adf5,null))['then'](function(_0x26d768){if(_0x26d768){var _0xc3a434=_0x26d768[_0x31f6('0x54')]&&fs[_0x31f6('0x5e')](path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x20a07e,_['toLower'](_0x26d768[_0x31f6('0x54')])))?path[_0x31f6('0x5f')](config['root'],_0x20a07e,_['toLower'](_0x26d768[_0x31f6('0x54')])):path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x20a07e,_[_0x31f6('0x61')]('default_logo.svg'));var _0x109d2d='default'+_[_0x31f6('0x62')]('logo');if(_0x26d768[_0x109d2d]||!_0x2b2d61[_0x31f6('0x63')]){_0xc3a434=path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x20a07e,_[_0x31f6('0x61')](_0x31f6('0x64')));}if(!fs[_0x31f6('0x5e')](_0xc3a434)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x31f6('0x54'))+'\x20not\x20found');}return _0x59adf5['download'](_0xc3a434);}})['catch'](handleError(_0x59adf5,null));};var utilLicense=require(_0x31f6('0x16'));exports[_0x31f6('0x65')]=function(_0x1c1b24,_0xd631b3,_0x4f86e0){var _0x3620f9=_0x31f6('0x58');var _0x4dc367={'custom':![]};return utilLicense[_0x31f6('0x59')]()[_0x31f6('0x30')](function(_0x169033){if(_0x169033){_0x4dc367=_0x169033;}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x1c1b24[_0x31f6('0x4f')]['id']},'attributes':[_0x31f6('0x54'),_0x31f6('0x5a'),_0x31f6('0x66'),'favicon','defaultLogo',_0x31f6('0x67'),_0x31f6('0x68'),'defaultFavicon'],'raw':!![]});})[_0x31f6('0x30')](handleEntityNotFound(_0xd631b3,null))['then'](function(_0x1bb4a3){if(_0x1bb4a3){var _0x24363f=_0x1bb4a3[_0x31f6('0x5a')]&&fs[_0x31f6('0x5e')](path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x3620f9,_[_0x31f6('0x61')](_0x1bb4a3[_0x31f6('0x5a')])))?path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x3620f9,_[_0x31f6('0x61')](_0x1bb4a3['loginLogo'])):path['join'](config[_0x31f6('0x60')],_0x3620f9,_[_0x31f6('0x61')](_0x31f6('0x69')));var _0x26a3aa=_0x31f6('0x6a')+_[_0x31f6('0x62')](_0x31f6('0x5a'));if(_0x1bb4a3[_0x26a3aa]||!_0x4dc367[_0x31f6('0x63')]){_0x24363f=path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x3620f9,_['toLower'](_0x31f6('0x69')));}if(!fs[_0x31f6('0x5e')](_0x24363f)){throw new db[(_0x31f6('0x6b'))][(_0x31f6('0x6c'))](_[_0x31f6('0x62')](_0x31f6('0x5a'))+'\x20not\x20found');}return _0xd631b3['download'](_0x24363f);}})[_0x31f6('0x25')](handleError(_0xd631b3,null));};exports[_0x31f6('0x6d')]=function(_0x4330bb,_0x45c94d){return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x4330bb[_0x31f6('0x4f')]['id']},'attributes':[_0x31f6('0x6e')]})[_0x31f6('0x30')](respondWithResult(_0x45c94d,null))['catch'](handleError(_0x45c94d,null));};exports[_0x31f6('0x6f')]=function(_0x39a6cf,_0x5a5ff5,_0x328712){if(_0x39a6cf[_0x31f6('0x53')]&&_0x39a6cf[_0x31f6('0x53')][_0x31f6('0x55')]){_0x39a6cf[_0x31f6('0x52')][_0x31f6('0x66')]=_0x39a6cf[_0x31f6('0x53')][_0x31f6('0x55')];}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x39a6cf['params']['id']}})['then'](handleEntityNotFound(_0x5a5ff5,null))[_0x31f6('0x30')](saveUpdates(_0x39a6cf['body'],null))[_0x31f6('0x30')](respondWithResult(_0x5a5ff5,null))[_0x31f6('0x25')](handleError(_0x5a5ff5,null));};var utilLicense=require(_0x31f6('0x16'));exports[_0x31f6('0x70')]=function(_0x3325f4,_0x870fbf,_0x4fd4cb){var _0x21d93c=_0x31f6('0x58');var _0x3c3b67={'custom':![]};return utilLicense[_0x31f6('0x59')]()[_0x31f6('0x30')](function(_0x1ca07c){if(_0x1ca07c){_0x3c3b67=_0x1ca07c;}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x3325f4['params']['id']},'attributes':['logo','loginLogo',_0x31f6('0x66'),'favicon',_0x31f6('0x5c'),_0x31f6('0x67'),_0x31f6('0x68'),_0x31f6('0x5d')],'raw':!![]});})[_0x31f6('0x30')](handleEntityNotFound(_0x870fbf,null))[_0x31f6('0x30')](function(_0x1461a3){if(_0x1461a3){var _0x1c61d9=_0x1461a3[_0x31f6('0x66')]&&fs['existsSync'](path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x21d93c,_['toLower'](_0x1461a3[_0x31f6('0x66')])))?path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x21d93c,_['toLower'](_0x1461a3[_0x31f6('0x66')])):path['join'](config[_0x31f6('0x60')],_0x21d93c,_[_0x31f6('0x61')](_0x31f6('0x71')));var _0x39dc70='default'+_['upperFirst']('preferred');if(_0x1461a3[_0x39dc70]||!_0x3c3b67[_0x31f6('0x63')]||!_0x3c3b67[_0x31f6('0x66')]){_0x1c61d9=path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x21d93c,_[_0x31f6('0x61')](_0x31f6('0x71')));}if(!fs[_0x31f6('0x5e')](_0x1c61d9)){throw new db['Sequelize'][(_0x31f6('0x6c'))](_[_0x31f6('0x62')](_0x31f6('0x66'))+_0x31f6('0x72'));}return _0x870fbf[_0x31f6('0x73')](_0x1c61d9);}})[_0x31f6('0x25')](handleError(_0x870fbf,null));};exports[_0x31f6('0x74')]=function(_0x4273ae,_0x3e96ce,_0x4d3a45){if(_0x4273ae[_0x31f6('0x53')]&&_0x4273ae[_0x31f6('0x53')][_0x31f6('0x55')]){_0x4273ae['body'][_0x31f6('0x5b')]=_0x4273ae[_0x31f6('0x53')][_0x31f6('0x55')];}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0x4273ae[_0x31f6('0x4f')]['id']}})[_0x31f6('0x30')](handleEntityNotFound(_0x3e96ce,null))['then'](saveUpdates(_0x4273ae[_0x31f6('0x52')],null))['then'](respondWithResult(_0x3e96ce,null))['catch'](handleError(_0x3e96ce,null));};var utilLicense=require(_0x31f6('0x16'));exports[_0x31f6('0x75')]=function(_0xdc0e6a,_0x4f7800,_0x56da55){var _0x28e3eb=_0x31f6('0x58');var _0x1bb841={'custom':![]};return utilLicense[_0x31f6('0x59')]()[_0x31f6('0x30')](function(_0x264b4a){if(_0x264b4a){_0x1bb841=_0x264b4a;}return db[_0x31f6('0x35')][_0x31f6('0x51')]({'where':{'id':_0xdc0e6a[_0x31f6('0x4f')]['id']},'attributes':[_0x31f6('0x54'),'loginLogo',_0x31f6('0x66'),_0x31f6('0x5b'),_0x31f6('0x5c'),'defaultLoginLogo','defaultPreferred',_0x31f6('0x5d')],'raw':!![]});})[_0x31f6('0x30')](handleEntityNotFound(_0x4f7800,null))[_0x31f6('0x30')](function(_0x160392){if(_0x160392){var _0x11d4c6=_0x160392[_0x31f6('0x5b')]&&fs[_0x31f6('0x5e')](path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x28e3eb,_['toLower'](_0x160392[_0x31f6('0x5b')])))?path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x28e3eb,_[_0x31f6('0x61')](_0x160392[_0x31f6('0x5b')])):path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x28e3eb,_[_0x31f6('0x61')](_0x31f6('0x76')));var _0x49da40=_0x31f6('0x6a')+_[_0x31f6('0x62')](_0x31f6('0x5b'));if(_0x160392[_0x49da40]||!_0x1bb841['custom']){_0x11d4c6=path[_0x31f6('0x5f')](config[_0x31f6('0x60')],_0x28e3eb,_[_0x31f6('0x61')](_0x31f6('0x76')));}if(!fs[_0x31f6('0x5e')](_0x11d4c6)){throw new db[(_0x31f6('0x6b'))]['ValidationError'](_['upperFirst'](_0x31f6('0x5b'))+_0x31f6('0x72'));}return _0x4f7800[_0x31f6('0x73')](_0x11d4c6);}})[_0x31f6('0x25')](handleError(_0x4f7800,null));};exports['getDate']=function(_0x534f2f,_0x591e81){var _0xc8a7bd={'offset':moment()[_0x31f6('0x77')]()};_0xc8a7bd['now']=moment()[_0x31f6('0x77')](_0xc8a7bd['offset'])[_0x31f6('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x591e81[_0x31f6('0x32')](0xc8)[_0x31f6('0x79')](_0xc8a7bd);}; \ No newline at end of file +var _0xe8f7=['send','index','map','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','Setting','include','rows','show','params','rawAttributes','length','includeAll','find','body','file','filename','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','custom','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','end','stack','name'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7e8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8f('0x1'));var jsonpatch=require(_0x7e8f('0x2'));var rp=require(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var Mustache=require(_0x7e8f('0x6'));var util=require(_0x7e8f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7e8f('0x8'));var ejs=require(_0x7e8f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e8f('0xa'));var squel=require(_0x7e8f('0xb'));var crypto=require(_0x7e8f('0xc'));var jsforce=require(_0x7e8f('0xd'));var deskjs=require(_0x7e8f('0xe'));var toCsv=require(_0x7e8f('0x8'));var querystring=require(_0x7e8f('0xf'));var Papa=require('papaparse');var Redis=require(_0x7e8f('0x10'));var authService=require(_0x7e8f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e8f('0x12'));var hardwareService=require(_0x7e8f('0x13'));var logger=require(_0x7e8f('0x14'))(_0x7e8f('0x15'));var utils=require('../../config/utils');var config=require(_0x7e8f('0x16'));var licenseUtil=require(_0x7e8f('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7e8f('0x18'));var client=jayson[_0x7e8f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddd4d,_0x72bf8f,_0x27287f,_0x34ff25){return new BPromise(function(_0x1225f8,_0x336a9d){var _0x31bb2a=_0x34ff25||client;return _0x31bb2a[_0x7e8f('0x1a')](_0x4ddd4d,_0x27287f)[_0x7e8f('0x1b')](function(_0x40f43d){logger[_0x7e8f('0x1c')](_0x7e8f('0x1d'),_0x72bf8f,_0x7e8f('0x1e'));logger[_0x7e8f('0x1f')](_0x7e8f('0x20'),_0x72bf8f,_0x7e8f('0x1e'),JSON[_0x7e8f('0x21')](_0x40f43d));if(_0x40f43d['error']){if(_0x40f43d[_0x7e8f('0x22')][_0x7e8f('0x23')]===0x1f4){logger[_0x7e8f('0x22')]('Setting,\x20%s,\x20%s',_0x72bf8f,_0x40f43d[_0x7e8f('0x22')][_0x7e8f('0x24')]);return _0x336a9d(_0x40f43d[_0x7e8f('0x22')][_0x7e8f('0x24')]);}logger[_0x7e8f('0x22')](_0x7e8f('0x1d'),_0x72bf8f,_0x40f43d[_0x7e8f('0x22')][_0x7e8f('0x24')]);return _0x1225f8(_0x40f43d['error'][_0x7e8f('0x24')]);}else{logger['info'](_0x7e8f('0x1d'),_0x72bf8f,_0x7e8f('0x1e'));_0x1225f8(_0x40f43d[_0x7e8f('0x25')]['message']);}})[_0x7e8f('0x26')](function(_0x4195a9){logger['error'](_0x7e8f('0x1d'),_0x72bf8f,_0x4195a9);_0x336a9d(_0x4195a9);});});}function respondWithStatusCode(_0x2ba552,_0x54f661){_0x54f661=_0x54f661||0xcc;return function(_0x248f2c){if(_0x248f2c){return _0x2ba552[_0x7e8f('0x27')](_0x54f661);}return _0x2ba552[_0x7e8f('0x28')](_0x54f661)['end']();};}function respondWithResult(_0x600aaa,_0x4d9211){_0x4d9211=_0x4d9211||0xc8;return function(_0x28a96e){if(_0x28a96e){return _0x600aaa[_0x7e8f('0x28')](_0x4d9211)['json'](_0x28a96e);}};}function respondWithFilteredResult(_0xa82475,_0x307eb3){return function(_0x1ef016){if(_0x1ef016){var _0x583d54=typeof _0x307eb3['offset']===_0x7e8f('0x29')&&typeof _0x307eb3['limit']===_0x7e8f('0x29');var _0x58639d=_0x1ef016[_0x7e8f('0x2a')];var _0x82b6f8=_0x583d54?0x0:_0x307eb3['offset'];var _0x15dba0=_0x583d54?_0x1ef016[_0x7e8f('0x2a')]:_0x307eb3[_0x7e8f('0x2b')]+_0x307eb3[_0x7e8f('0x2c')];var _0x64505e;if(_0x15dba0>=_0x58639d){_0x15dba0=_0x58639d;_0x64505e=0xc8;}else{_0x64505e=0xce;}_0xa82475[_0x7e8f('0x28')](_0x64505e);return _0xa82475[_0x7e8f('0x2d')](_0x7e8f('0x2e'),_0x82b6f8+'-'+_0x15dba0+'/'+_0x58639d)[_0x7e8f('0x2f')](_0x1ef016);}return null;};}function patchUpdates(_0x2f0f99){return function(_0x5bc5e0){try{jsonpatch[_0x7e8f('0x30')](_0x5bc5e0,_0x2f0f99,!![]);}catch(_0x2979b6){return BPromise['reject'](_0x2979b6);}return _0x5bc5e0[_0x7e8f('0x31')]();};}function saveUpdates(_0x3305b1,_0x6aca19){return function(_0x5241f9){if(_0x5241f9){return _0x5241f9[_0x7e8f('0x32')](_0x3305b1)[_0x7e8f('0x1b')](function(_0x286ab0){return _0x286ab0;});}return null;};}function removeEntity(_0x50c91d,_0x76cfc){return function(_0x2eac70){if(_0x2eac70){return _0x2eac70[_0x7e8f('0x33')]()[_0x7e8f('0x1b')](function(){_0x50c91d[_0x7e8f('0x28')](0xcc)[_0x7e8f('0x34')]();});}};}function handleEntityNotFound(_0x1b988e,_0x2b2a2c){return function(_0x5806fa){if(!_0x5806fa){_0x1b988e[_0x7e8f('0x27')](0x194);}return _0x5806fa;};}function handleError(_0x1a8a9d,_0x2d28f4){_0x2d28f4=_0x2d28f4||0x1f4;return function(_0x1bdd15){logger[_0x7e8f('0x22')](_0x1bdd15[_0x7e8f('0x35')]);if(_0x1bdd15[_0x7e8f('0x36')]){delete _0x1bdd15[_0x7e8f('0x36')];}_0x1a8a9d['status'](_0x2d28f4)[_0x7e8f('0x37')](_0x1bdd15);};}exports[_0x7e8f('0x38')]=function(_0x201d17,_0x2dffaf){var _0x54af48={},_0x16cbf0={},_0x244a8e={'count':0x0,'rows':[]};var _0x45c437=_[_0x7e8f('0x39')](db['Setting']['rawAttributes'],function(_0x2f6a54){return{'name':_0x2f6a54[_0x7e8f('0x3a')],'type':_0x2f6a54['type'][_0x7e8f('0x3b')]};});_0x16cbf0[_0x7e8f('0x3c')]=_[_0x7e8f('0x39')](_0x45c437,_0x7e8f('0x36'));_0x16cbf0['query']=_[_0x7e8f('0x3d')](_0x201d17[_0x7e8f('0x3e')]);_0x16cbf0['filters']=_[_0x7e8f('0x3f')](_0x16cbf0[_0x7e8f('0x3c')],_0x16cbf0[_0x7e8f('0x3e')]);_0x54af48[_0x7e8f('0x40')]=_[_0x7e8f('0x3f')](_0x16cbf0[_0x7e8f('0x3c')],qs[_0x7e8f('0x41')](_0x201d17['query']['fields']));_0x54af48[_0x7e8f('0x40')]=_0x54af48['attributes']['length']?_0x54af48[_0x7e8f('0x40')]:_0x16cbf0[_0x7e8f('0x3c')];if(!_0x201d17['query'][_0x7e8f('0x42')](_0x7e8f('0x43'))){_0x54af48[_0x7e8f('0x2c')]=qs[_0x7e8f('0x2c')](_0x201d17[_0x7e8f('0x3e')]['limit']);_0x54af48[_0x7e8f('0x2b')]=qs['offset'](_0x201d17[_0x7e8f('0x3e')][_0x7e8f('0x2b')]);}_0x54af48['order']=qs[_0x7e8f('0x44')](_0x201d17['query'][_0x7e8f('0x44')]);_0x54af48['where']=qs[_0x7e8f('0x45')](_[_0x7e8f('0x46')](_0x201d17[_0x7e8f('0x3e')],_0x16cbf0['filters']),_0x45c437);if(_0x201d17[_0x7e8f('0x3e')][_0x7e8f('0x47')]){_0x54af48[_0x7e8f('0x48')]=_[_0x7e8f('0x49')](_0x54af48['where'],{'$or':_[_0x7e8f('0x39')](_0x45c437,function(_0x38717d){if(_0x38717d['type']!==_0x7e8f('0x4a')){var _0x6a3730={};_0x6a3730[_0x38717d[_0x7e8f('0x36')]]={'$like':'%'+_0x201d17['query'][_0x7e8f('0x47')]+'%'};return _0x6a3730;}})});}_0x54af48=_['merge']({},_0x54af48,_0x201d17[_0x7e8f('0x4b')]);var _0x1a2d83={'where':_0x54af48[_0x7e8f('0x48')]};return db[_0x7e8f('0x4c')][_0x7e8f('0x2a')](_0x1a2d83)[_0x7e8f('0x1b')](function(_0x29e41d){_0x244a8e['count']=_0x29e41d;if(_0x201d17[_0x7e8f('0x3e')]['includeAll']){_0x54af48[_0x7e8f('0x4d')]=[{'all':!![]}];}return db[_0x7e8f('0x4c')]['findAll'](_0x54af48);})[_0x7e8f('0x1b')](function(_0x3cd715){_0x244a8e[_0x7e8f('0x4e')]=_0x3cd715;return _0x244a8e;})[_0x7e8f('0x1b')](respondWithFilteredResult(_0x2dffaf,_0x54af48))[_0x7e8f('0x26')](handleError(_0x2dffaf,null));};exports[_0x7e8f('0x4f')]=function(_0x53610f,_0x174ab1){var _0x1f5dca={'raw':![],'where':{'id':_0x53610f[_0x7e8f('0x50')]['id']}},_0x2df95a={};_0x2df95a['model']=_[_0x7e8f('0x3d')](db[_0x7e8f('0x4c')][_0x7e8f('0x51')]);_0x2df95a[_0x7e8f('0x3e')]=_[_0x7e8f('0x3d')](_0x53610f[_0x7e8f('0x3e')]);_0x2df95a[_0x7e8f('0x45')]=_['intersection'](_0x2df95a[_0x7e8f('0x3c')],_0x2df95a[_0x7e8f('0x3e')]);_0x1f5dca['attributes']=_[_0x7e8f('0x3f')](_0x2df95a[_0x7e8f('0x3c')],qs[_0x7e8f('0x41')](_0x53610f[_0x7e8f('0x3e')]['fields']));_0x1f5dca[_0x7e8f('0x40')]=_0x1f5dca[_0x7e8f('0x40')][_0x7e8f('0x52')]?_0x1f5dca[_0x7e8f('0x40')]:_0x2df95a['model'];if(_0x53610f[_0x7e8f('0x3e')][_0x7e8f('0x53')]){_0x1f5dca[_0x7e8f('0x4d')]=[{'all':!![]}];}_0x1f5dca=_['merge']({},_0x1f5dca,_0x53610f[_0x7e8f('0x4b')]);return db[_0x7e8f('0x4c')][_0x7e8f('0x54')](_0x1f5dca)[_0x7e8f('0x1b')](handleEntityNotFound(_0x174ab1,null))[_0x7e8f('0x1b')](respondWithResult(_0x174ab1,null))[_0x7e8f('0x26')](handleError(_0x174ab1,null));};exports[_0x7e8f('0x32')]=function(_0x218aa1,_0x50524e){if(_0x218aa1[_0x7e8f('0x55')]['id']){delete _0x218aa1[_0x7e8f('0x55')]['id'];}return db[_0x7e8f('0x4c')]['find']({'where':{'id':_0x218aa1['params']['id']}})[_0x7e8f('0x1b')](handleEntityNotFound(_0x50524e,null))[_0x7e8f('0x1b')](saveUpdates(_0x218aa1['body'],null))[_0x7e8f('0x1b')](respondWithResult(_0x50524e,null))[_0x7e8f('0x26')](handleError(_0x50524e,null));};exports['addLogo']=function(_0x3f8fe6,_0x1c9db3,_0x40639c){if(_0x3f8fe6['file']&&_0x3f8fe6[_0x7e8f('0x56')][_0x7e8f('0x57')]){_0x3f8fe6[_0x7e8f('0x55')]['logo']=_0x3f8fe6[_0x7e8f('0x56')][_0x7e8f('0x57')];}return db['Setting']['find']({'where':{'id':_0x3f8fe6['params']['id']}})[_0x7e8f('0x1b')](handleEntityNotFound(_0x1c9db3,null))[_0x7e8f('0x1b')](saveUpdates(_0x3f8fe6['body'],null))[_0x7e8f('0x1b')](respondWithResult(_0x1c9db3,null))['catch'](handleError(_0x1c9db3,null));};exports['addLogoLogin']=function(_0x3a9359,_0x278a84,_0x4f99ea){if(_0x3a9359[_0x7e8f('0x56')]&&_0x3a9359[_0x7e8f('0x56')][_0x7e8f('0x57')]){_0x3a9359[_0x7e8f('0x55')][_0x7e8f('0x58')]=_0x3a9359['file'][_0x7e8f('0x57')];}return db[_0x7e8f('0x4c')][_0x7e8f('0x54')]({'where':{'id':_0x3a9359['params']['id']}})[_0x7e8f('0x1b')](handleEntityNotFound(_0x278a84,null))[_0x7e8f('0x1b')](saveUpdates(_0x3a9359['body'],null))['then'](respondWithResult(_0x278a84,null))['catch'](handleError(_0x278a84,null));};var utilLicense=require(_0x7e8f('0x17'));exports[_0x7e8f('0x59')]=function(_0x5af6aa,_0x201ac3,_0xf004f5){var _0x10bf4d='server/files/images/logos';var _0x46d6ed={'custom':![]};return utilLicense[_0x7e8f('0x5a')]()[_0x7e8f('0x1b')](function(_0x15d8d5){if(_0x15d8d5){_0x46d6ed=_0x15d8d5;}return db['Setting']['find']({'where':{'id':_0x5af6aa[_0x7e8f('0x50')]['id']},'attributes':[_0x7e8f('0x5b'),_0x7e8f('0x58'),_0x7e8f('0x5c'),_0x7e8f('0x5d'),_0x7e8f('0x5e'),_0x7e8f('0x5f'),_0x7e8f('0x60'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x201ac3,null))[_0x7e8f('0x1b')](function(_0x252055){if(_0x252055){var _0x54e029=_0x252055[_0x7e8f('0x5b')]&&fs[_0x7e8f('0x61')](path['join'](config[_0x7e8f('0x62')],_0x10bf4d,_[_0x7e8f('0x63')](_0x252055[_0x7e8f('0x5b')])))?path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x10bf4d,_['toLower'](_0x252055[_0x7e8f('0x5b')])):path['join'](config[_0x7e8f('0x62')],_0x10bf4d,_[_0x7e8f('0x63')](_0x7e8f('0x65')));var _0x2285fa=_0x7e8f('0x66')+_[_0x7e8f('0x67')](_0x7e8f('0x5b'));if(_0x252055[_0x2285fa]||!_0x46d6ed['custom']){_0x54e029=path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x10bf4d,_[_0x7e8f('0x63')]('default_logo.svg'));}if(!fs[_0x7e8f('0x61')](_0x54e029)){throw new db['Sequelize'][(_0x7e8f('0x68'))](_[_0x7e8f('0x67')](_0x7e8f('0x5b'))+_0x7e8f('0x69'));}return _0x201ac3[_0x7e8f('0x6a')](_0x54e029);}})[_0x7e8f('0x26')](handleError(_0x201ac3,null));};var utilLicense=require(_0x7e8f('0x17'));exports[_0x7e8f('0x6b')]=function(_0x18d7bc,_0x3908f5,_0x2cbe75){var _0x5d457f=_0x7e8f('0x6c');var _0x471ee6={'custom':![]};return utilLicense[_0x7e8f('0x5a')]()[_0x7e8f('0x1b')](function(_0x1210be){if(_0x1210be){_0x471ee6=_0x1210be;}return db['Setting'][_0x7e8f('0x54')]({'where':{'id':_0x18d7bc[_0x7e8f('0x50')]['id']},'attributes':['logo',_0x7e8f('0x58'),_0x7e8f('0x5c'),_0x7e8f('0x5d'),_0x7e8f('0x5e'),_0x7e8f('0x5f'),_0x7e8f('0x60'),_0x7e8f('0x6d')],'raw':!![]});})[_0x7e8f('0x1b')](handleEntityNotFound(_0x3908f5,null))['then'](function(_0x323210){if(_0x323210){var _0x473d8b=_0x323210['loginLogo']&&fs[_0x7e8f('0x61')](path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x5d457f,_[_0x7e8f('0x63')](_0x323210[_0x7e8f('0x58')])))?path[_0x7e8f('0x64')](config['root'],_0x5d457f,_['toLower'](_0x323210[_0x7e8f('0x58')])):path['join'](config[_0x7e8f('0x62')],_0x5d457f,_[_0x7e8f('0x63')]('default_loginLogo.svg'));var _0x3416b5=_0x7e8f('0x66')+_[_0x7e8f('0x67')]('loginLogo');if(_0x323210[_0x3416b5]||!_0x471ee6[_0x7e8f('0x6e')]){_0x473d8b=path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x5d457f,_[_0x7e8f('0x63')](_0x7e8f('0x6f')));}if(!fs['existsSync'](_0x473d8b)){throw new db[(_0x7e8f('0x70'))][(_0x7e8f('0x68'))](_[_0x7e8f('0x67')]('loginLogo')+'\x20not\x20found');}return _0x3908f5['download'](_0x473d8b);}})['catch'](handleError(_0x3908f5,null));};exports[_0x7e8f('0x71')]=function(_0x2e892c,_0x1f728){return db[_0x7e8f('0x4c')][_0x7e8f('0x54')]({'where':{'id':_0x2e892c[_0x7e8f('0x50')]['id']},'attributes':[_0x7e8f('0x72')]})[_0x7e8f('0x1b')](respondWithResult(_0x1f728,null))[_0x7e8f('0x26')](handleError(_0x1f728,null));};exports[_0x7e8f('0x73')]=function(_0xe3971d,_0x33caaf,_0x6cd0fb){if(_0xe3971d[_0x7e8f('0x56')]&&_0xe3971d['file'][_0x7e8f('0x57')]){_0xe3971d[_0x7e8f('0x55')][_0x7e8f('0x5c')]=_0xe3971d[_0x7e8f('0x56')][_0x7e8f('0x57')];}return db[_0x7e8f('0x4c')][_0x7e8f('0x54')]({'where':{'id':_0xe3971d['params']['id']}})[_0x7e8f('0x1b')](handleEntityNotFound(_0x33caaf,null))['then'](saveUpdates(_0xe3971d['body'],null))[_0x7e8f('0x1b')](respondWithResult(_0x33caaf,null))[_0x7e8f('0x26')](handleError(_0x33caaf,null));};var utilLicense=require('../../config/license/util');exports[_0x7e8f('0x74')]=function(_0x154434,_0x47f5a8,_0x1ba7d8){var _0x46fa7=_0x7e8f('0x6c');var _0xab6573={'custom':![]};return utilLicense[_0x7e8f('0x5a')]()['then'](function(_0x32ce60){if(_0x32ce60){_0xab6573=_0x32ce60;}return db['Setting'][_0x7e8f('0x54')]({'where':{'id':_0x154434[_0x7e8f('0x50')]['id']},'attributes':['logo',_0x7e8f('0x58'),_0x7e8f('0x5c'),_0x7e8f('0x5d'),_0x7e8f('0x5e'),'defaultLoginLogo',_0x7e8f('0x60'),_0x7e8f('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x47f5a8,null))['then'](function(_0x2808f6){if(_0x2808f6){var _0x3efd6f=_0x2808f6[_0x7e8f('0x5c')]&&fs[_0x7e8f('0x61')](path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x46fa7,_['toLower'](_0x2808f6[_0x7e8f('0x5c')])))?path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x46fa7,_[_0x7e8f('0x63')](_0x2808f6[_0x7e8f('0x5c')])):path['join'](config[_0x7e8f('0x62')],_0x46fa7,_[_0x7e8f('0x63')](_0x7e8f('0x75')));var _0x364085='default'+_[_0x7e8f('0x67')](_0x7e8f('0x5c'));if(_0x2808f6[_0x364085]||!_0xab6573[_0x7e8f('0x6e')]||!_0xab6573[_0x7e8f('0x5c')]){_0x3efd6f=path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x46fa7,_[_0x7e8f('0x63')](_0x7e8f('0x75')));}if(!fs[_0x7e8f('0x61')](_0x3efd6f)){throw new db[(_0x7e8f('0x70'))]['ValidationError'](_[_0x7e8f('0x67')]('preferred')+_0x7e8f('0x69'));}return _0x47f5a8['download'](_0x3efd6f);}})[_0x7e8f('0x26')](handleError(_0x47f5a8,null));};exports['addFavicon']=function(_0x17a7dd,_0x2707ec,_0x26ab0a){if(_0x17a7dd['file']&&_0x17a7dd['file'][_0x7e8f('0x57')]){_0x17a7dd[_0x7e8f('0x55')][_0x7e8f('0x5d')]=_0x17a7dd['file'][_0x7e8f('0x57')];}return db[_0x7e8f('0x4c')][_0x7e8f('0x54')]({'where':{'id':_0x17a7dd[_0x7e8f('0x50')]['id']}})[_0x7e8f('0x1b')](handleEntityNotFound(_0x2707ec,null))[_0x7e8f('0x1b')](saveUpdates(_0x17a7dd[_0x7e8f('0x55')],null))[_0x7e8f('0x1b')](respondWithResult(_0x2707ec,null))[_0x7e8f('0x26')](handleError(_0x2707ec,null));};var utilLicense=require(_0x7e8f('0x17'));exports[_0x7e8f('0x76')]=function(_0x107278,_0x3c859e,_0x44b889){var _0x4ba7c8=_0x7e8f('0x6c');var _0x2acd4c={'custom':![]};return utilLicense[_0x7e8f('0x5a')]()['then'](function(_0x207752){if(_0x207752){_0x2acd4c=_0x207752;}return db[_0x7e8f('0x4c')][_0x7e8f('0x54')]({'where':{'id':_0x107278[_0x7e8f('0x50')]['id']},'attributes':[_0x7e8f('0x5b'),_0x7e8f('0x58'),_0x7e8f('0x5c'),_0x7e8f('0x5d'),_0x7e8f('0x5e'),_0x7e8f('0x5f'),_0x7e8f('0x60'),_0x7e8f('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x3c859e,null))['then'](function(_0xbf5b01){if(_0xbf5b01){var _0x40ef73=_0xbf5b01[_0x7e8f('0x5d')]&&fs[_0x7e8f('0x61')](path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x4ba7c8,_[_0x7e8f('0x63')](_0xbf5b01[_0x7e8f('0x5d')])))?path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x4ba7c8,_[_0x7e8f('0x63')](_0xbf5b01[_0x7e8f('0x5d')])):path[_0x7e8f('0x64')](config[_0x7e8f('0x62')],_0x4ba7c8,_['toLower'](_0x7e8f('0x77')));var _0x15c7e7=_0x7e8f('0x66')+_[_0x7e8f('0x67')]('favicon');if(_0xbf5b01[_0x15c7e7]||!_0x2acd4c[_0x7e8f('0x6e')]){_0x40ef73=path['join'](config[_0x7e8f('0x62')],_0x4ba7c8,_[_0x7e8f('0x63')]('default_favicon.ico'));}if(!fs['existsSync'](_0x40ef73)){throw new db[(_0x7e8f('0x70'))][(_0x7e8f('0x68'))](_['upperFirst']('favicon')+_0x7e8f('0x69'));}return _0x3c859e[_0x7e8f('0x6a')](_0x40ef73);}})[_0x7e8f('0x26')](handleError(_0x3c859e,null));};exports['getDate']=function(_0x2d1fe4,_0x11ccb9){var _0x5f35f9={'offset':moment()[_0x7e8f('0x78')]()};_0x5f35f9['now']=moment()[_0x7e8f('0x78')](_0x5f35f9[_0x7e8f('0x2b')])['format'](_0x7e8f('0x79'));return _0x11ccb9[_0x7e8f('0x28')](0xc8)[_0x7e8f('0x37')](_0x5f35f9);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fa5b9b6..bf340e3 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x3b5ce8,_0x2daf54){var _0x4d36f4=function(_0x115c3d){while(--_0x115c3d){_0x3b5ce8['push'](_0x3b5ce8['shift']());}};_0x4d36f4(++_0x2daf54);}(_0xedd9,0xfc));var _0x9edd=function(_0xc00af1,_0x1c5ed4){_0xc00af1=_0xc00af1-0x0;var _0x269546=_0xedd9[_0xc00af1];return _0x269546;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f205e90..485e872 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 _0x8d61=['Setting','find','options','raw','where','attributes','include','map','model','then','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSetting'];(function(_0x4c96a4,_0x55ed6c){var _0x3cd6b1=function(_0x5d2273){while(--_0x5d2273){_0x4c96a4['push'](_0x4c96a4['shift']());}};_0x3cd6b1(++_0x55ed6c);}(_0x8d61,0x10a));var _0x18d6=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x8d61[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x18d6('0x0'));var util=require('util');var moment=require(_0x18d6('0x1'));var BPromise=require('bluebird');var rs=require(_0x18d6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18d6('0x3'))['db'];var utils=require(_0x18d6('0x4'));var logger=require(_0x18d6('0x5'))(_0x18d6('0x6'));var config=require(_0x18d6('0x7'));var jayson=require(_0x18d6('0x8'));var client=jayson[_0x18d6('0x9')][_0x18d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45028e,_0x32716e,_0x3783c7){return new BPromise(function(_0x4e6a5c,_0x28c931){return client[_0x18d6('0xb')](_0x45028e,_0x3783c7)['then'](function(_0x51418b){logger[_0x18d6('0xc')](_0x18d6('0xd'),_0x32716e,_0x18d6('0xe'));logger[_0x18d6('0xf')](_0x18d6('0x10'),_0x32716e,_0x18d6('0xe'),JSON[_0x18d6('0x11')](_0x51418b));if(_0x51418b[_0x18d6('0x12')]){if(_0x51418b[_0x18d6('0x12')]['code']===0x1f4){logger['error'](_0x18d6('0xd'),_0x32716e,_0x51418b['error'][_0x18d6('0x13')]);return _0x28c931(_0x51418b[_0x18d6('0x12')][_0x18d6('0x13')]);}logger[_0x18d6('0x12')](_0x18d6('0xd'),_0x32716e,_0x51418b['error'][_0x18d6('0x13')]);return _0x4e6a5c(_0x51418b['error'][_0x18d6('0x13')]);}else{logger[_0x18d6('0xc')](_0x18d6('0xd'),_0x32716e,'request\x20sent');_0x4e6a5c(_0x51418b[_0x18d6('0x14')]['message']);}})['catch'](function(_0x24b92a){logger['error'](_0x18d6('0xd'),_0x32716e,_0x24b92a);_0x28c931(_0x24b92a);});});}exports[_0x18d6('0x15')]=function(_0x5e8728){var _0x276287=this;return new Promise(function(_0x544c1d,_0x3909af){return db[_0x18d6('0x16')][_0x18d6('0x17')]({'raw':_0x5e8728['options']?_0x5e8728[_0x18d6('0x18')][_0x18d6('0x19')]===undefined?!![]:![]:!![],'where':_0x5e8728[_0x18d6('0x18')]?_0x5e8728[_0x18d6('0x18')][_0x18d6('0x1a')]||null:null,'attributes':_0x5e8728['options']?_0x5e8728[_0x18d6('0x18')][_0x18d6('0x1b')]||null:null,'include':_0x5e8728[_0x18d6('0x18')]?_0x5e8728['options'][_0x18d6('0x1c')]?_[_0x18d6('0x1d')](_0x5e8728[_0x18d6('0x18')][_0x18d6('0x1c')],function(_0x474e01){return{'model':db[_0x474e01[_0x18d6('0x1e')]],'as':_0x474e01['as'],'attributes':_0x474e01[_0x18d6('0x1b')],'include':_0x474e01[_0x18d6('0x1c')]?_[_0x18d6('0x1d')](_0x474e01[_0x18d6('0x1c')],function(_0x54dc84){return{'model':db[_0x54dc84[_0x18d6('0x1e')]],'as':_0x54dc84['as'],'attributes':_0x54dc84[_0x18d6('0x1b')],'include':_0x54dc84[_0x18d6('0x1c')]?_[_0x18d6('0x1d')](_0x54dc84[_0x18d6('0x1c')],function(_0x444566){return{'model':db[_0x444566['model']],'as':_0x444566['as'],'attributes':_0x444566[_0x18d6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x18d6('0x1f')](function(_0x2083a4){logger['info'](_0x18d6('0x15'),_0x5e8728);logger[_0x18d6('0xf')](_0x18d6('0x15'),_0x5e8728,JSON[_0x18d6('0x11')](_0x2083a4));_0x544c1d(_0x2083a4);})['catch'](function(_0x55a3f8){logger[_0x18d6('0x12')](_0x18d6('0x15'),_0x55a3f8[_0x18d6('0x13')],_0x5e8728);_0x3909af(_0x276287[_0x18d6('0x12')](0x1f4,_0x55a3f8['message']));});});}; \ No newline at end of file +var _0x7b2c=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','map','include','model','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4b3d85,_0x198c44){var _0xec37e9=function(_0x5ab190){while(--_0x5ab190){_0x4b3d85['push'](_0x4b3d85['shift']());}};_0xec37e9(++_0x198c44);}(_0x7b2c,0xb9));var _0xc7b2=function(_0x208218,_0x3fc62e){_0x208218=_0x208218-0x0;var _0x4ecec8=_0x7b2c[_0x208218];return _0x4ecec8;};'use strict';var _=require(_0xc7b2('0x0'));var util=require(_0xc7b2('0x1'));var moment=require(_0xc7b2('0x2'));var BPromise=require(_0xc7b2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7b2('0x4'));var db=require(_0xc7b2('0x5'))['db'];var utils=require(_0xc7b2('0x6'));var logger=require(_0xc7b2('0x7'))(_0xc7b2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7b2('0x9'));var client=jayson[_0xc7b2('0xa')][_0xc7b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4007e7,_0x49a898,_0x5b65e9){return new BPromise(function(_0x1c1dd5,_0x3a1861){return client[_0xc7b2('0xc')](_0x4007e7,_0x5b65e9)[_0xc7b2('0xd')](function(_0xc4668e){logger[_0xc7b2('0xe')](_0xc7b2('0xf'),_0x49a898,_0xc7b2('0x10'));logger[_0xc7b2('0x11')](_0xc7b2('0x12'),_0x49a898,'request\x20sent',JSON['stringify'](_0xc4668e));if(_0xc4668e[_0xc7b2('0x13')]){if(_0xc4668e[_0xc7b2('0x13')]['code']===0x1f4){logger['error'](_0xc7b2('0xf'),_0x49a898,_0xc4668e[_0xc7b2('0x13')]['message']);return _0x3a1861(_0xc4668e[_0xc7b2('0x13')]['message']);}logger[_0xc7b2('0x13')]('Setting,\x20%s,\x20%s',_0x49a898,_0xc4668e[_0xc7b2('0x13')][_0xc7b2('0x14')]);return _0x1c1dd5(_0xc4668e[_0xc7b2('0x13')][_0xc7b2('0x14')]);}else{logger[_0xc7b2('0xe')](_0xc7b2('0xf'),_0x49a898,_0xc7b2('0x10'));_0x1c1dd5(_0xc4668e[_0xc7b2('0x15')][_0xc7b2('0x14')]);}})[_0xc7b2('0x16')](function(_0x164a5d){logger[_0xc7b2('0x13')](_0xc7b2('0xf'),_0x49a898,_0x164a5d);_0x3a1861(_0x164a5d);});});}exports[_0xc7b2('0x17')]=function(_0x428105){var _0x43d31c=this;return new Promise(function(_0x333038,_0x39a864){return db[_0xc7b2('0x18')][_0xc7b2('0x19')]({'raw':_0x428105[_0xc7b2('0x1a')]?_0x428105[_0xc7b2('0x1a')][_0xc7b2('0x1b')]===undefined?!![]:![]:!![],'where':_0x428105['options']?_0x428105[_0xc7b2('0x1a')]['where']||null:null,'attributes':_0x428105[_0xc7b2('0x1a')]?_0x428105[_0xc7b2('0x1a')][_0xc7b2('0x1c')]||null:null,'include':_0x428105[_0xc7b2('0x1a')]?_0x428105[_0xc7b2('0x1a')]['include']?_[_0xc7b2('0x1d')](_0x428105[_0xc7b2('0x1a')][_0xc7b2('0x1e')],function(_0x3ae8ee){return{'model':db[_0x3ae8ee[_0xc7b2('0x1f')]],'as':_0x3ae8ee['as'],'attributes':_0x3ae8ee['attributes'],'include':_0x3ae8ee['include']?_[_0xc7b2('0x1d')](_0x3ae8ee[_0xc7b2('0x1e')],function(_0xbae578){return{'model':db[_0xbae578[_0xc7b2('0x1f')]],'as':_0xbae578['as'],'attributes':_0xbae578[_0xc7b2('0x1c')],'include':_0xbae578[_0xc7b2('0x1e')]?_['map'](_0xbae578[_0xc7b2('0x1e')],function(_0x554522){return{'model':db[_0x554522[_0xc7b2('0x1f')]],'as':_0x554522['as'],'attributes':_0x554522[_0xc7b2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x166403){logger['info'](_0xc7b2('0x17'),_0x428105);logger[_0xc7b2('0x11')](_0xc7b2('0x17'),_0x428105,JSON[_0xc7b2('0x20')](_0x166403));_0x333038(_0x166403);})[_0xc7b2('0x16')](function(_0x3c17ce){logger['error'](_0xc7b2('0x17'),_0x3c17ce['message'],_0x428105);_0x39a864(_0x43d31c[_0xc7b2('0x13')](0x1f4,_0x3c17ce[_0xc7b2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7d29008..98ce934 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x13e721,_0x4c72ac){var _0x1d5617=function(_0x3aaf51){while(--_0x3aaf51){_0x13e721['push'](_0x13e721['shift']());}};_0x1d5617(++_0x4c72ac);}(_0x7a54,0x106));var _0x47a5=function(_0x567098,_0x40e512){_0x567098=_0x567098-0x0;var _0x591642=_0x7a54[_0x567098];return _0x591642;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x507e77,_0x4dadc5){var _0xb8287c=function(_0x16d760){while(--_0x16d760){_0x507e77['push'](_0x507e77['shift']());}};_0xb8287c(++_0x4dadc5);}(_0x7a54,0x106));var _0x47a5=function(_0x56888e,_0x2afe26){_0x56888e=_0x56888e-0x0;var _0x352bd6=_0x7a54[_0x56888e];return _0x352bd6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 89ef6ce..af41fa7 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 _0xd060=['ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate'];(function(_0x2e99b1,_0x42a801){var _0x17a37f=function(_0x42b52c){while(--_0x42b52c){_0x2e99b1['push'](_0x2e99b1['shift']());}};_0x17a37f(++_0x42a801);}(_0xd060,0x181));var _0x0d06=function(_0x3ea19c,_0x2c6f34){_0x3ea19c=_0x3ea19c-0x0;var _0x482a38=_0xd060[_0x3ea19c];return _0x482a38;};'use strict';var Sequelize=require(_0x0d06('0x0'));var rs=require(_0x0d06('0x1'));module[_0x0d06('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d06('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0d06('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x0d06('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0d06('0x5')]();}},'phone':{'type':Sequelize[_0x0d06('0x4')]},'type':{'type':Sequelize[_0x0d06('0x6')]('twilio',_0x0d06('0x7'),_0x0d06('0x8'),_0x0d06('0x9'),_0x0d06('0xa'),_0x0d06('0xb'),_0x0d06('0xc'),_0x0d06('0xd'),_0x0d06('0xe'),_0x0d06('0xf'))},'accountSid':{'type':Sequelize[_0x0d06('0x4')]},'authId':{'type':Sequelize[_0x0d06('0x4')]},'authToken':{'type':Sequelize[_0x0d06('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0d06('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0d06('0x4')]},'applicationId':{'type':Sequelize[_0x0d06('0x4')]},'accountId':{'type':Sequelize[_0x0d06('0x4')]},'senderString':{'type':Sequelize[_0x0d06('0x4')]},'deliveryReport':{'type':Sequelize[_0x0d06('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x0d06('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x0d06('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d06('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0d06('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0d06('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0d06('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d06('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d06('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0d06('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d06('0x11')],'comment':_0x0d06('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0d06('0x13'),'set':function(_0xab3339){if(!_0xab3339)this[_0x0d06('0x14')](_0x0d06('0x15'),null);this[_0x0d06('0x14')](_0x0d06('0x16'),_0xab3339);}}}; \ No newline at end of file +var _0x51a1=['exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x51a1,0x6c));var _0x151a=function(_0x43be6c,_0x7f5e1d){_0x43be6c=_0x43be6c-0x0;var _0x3ad4e2=_0x51a1[_0x43be6c];return _0x3ad4e2;};'use strict';var Sequelize=require(_0x151a('0x0'));var rs=require(_0x151a('0x1'));module[_0x151a('0x2')]={'name':{'type':Sequelize[_0x151a('0x3')],'unique':_0x151a('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x151a('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x151a('0x3')],'defaultValue':function(){return rs[_0x151a('0x5')]();}},'phone':{'type':Sequelize[_0x151a('0x3')]},'type':{'type':Sequelize[_0x151a('0x6')](_0x151a('0x7'),'skebby',_0x151a('0x8'),_0x151a('0x9'),_0x151a('0xa'),_0x151a('0xb'),'bandwidth',_0x151a('0xc'),_0x151a('0xd'),_0x151a('0xe'))},'accountSid':{'type':Sequelize[_0x151a('0x3')]},'authId':{'type':Sequelize[_0x151a('0x3')]},'authToken':{'type':Sequelize[_0x151a('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x151a('0x3')]},'apiKey':{'type':Sequelize[_0x151a('0x3')]},'applicationId':{'type':Sequelize[_0x151a('0x3')]},'accountId':{'type':Sequelize[_0x151a('0x3')]},'senderString':{'type':Sequelize[_0x151a('0x3')]},'deliveryReport':{'type':Sequelize[_0x151a('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x151a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x151a('0x10')],'defaultValue':function(){return _0x151a('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x151a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x151a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x151a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x151a('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x151a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x151a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x151a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x151a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x151a('0x12')],'comment':_0x151a('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2111e3){if(!_0x2111e3)this[_0x151a('0x14')](_0x151a('0x15'),null);this['setDataValue']('mandatoryDisposition',_0x2111e3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 339f728..eaedf16 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 _0x79fc=['sms','SmsApplication','Applications','applications','orderBy','asc','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','unshift','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','Contact','Owner','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','requestid','status_code','groupName','DELIVERED','redif','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','get','end','stack','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','SmsAccountId','Disposition','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x79fc,0x73));var _0xc79f=function(_0x3a03ef,_0x458404){_0x3a03ef=_0x3a03ef-0x0;var _0x540c15=_0x79fc[_0x3a03ef];return _0x540c15;};'use strict';var emlformat=require(_0xc79f('0x0'));var rimraf=require(_0xc79f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc79f('0x2'));var Mustache=require('mustache');var util=require(_0xc79f('0x3'));var path=require('path');var sox=require(_0xc79f('0x4'));var csv=require(_0xc79f('0x5'));var ejs=require(_0xc79f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc79f('0x7'));var squel=require(_0xc79f('0x8'));var crypto=require(_0xc79f('0x9'));var jsforce=require(_0xc79f('0xa'));var deskjs=require(_0xc79f('0xb'));var toCsv=require(_0xc79f('0x5'));var querystring=require('querystring');var Papa=require(_0xc79f('0xc'));var Redis=require(_0xc79f('0xd'));var authService=require(_0xc79f('0xe'));var qs=require(_0xc79f('0xf'));var as=require(_0xc79f('0x10'));var hardwareService=require(_0xc79f('0x11'));var logger=require('../../config/logger')(_0xc79f('0x12'));var utils=require(_0xc79f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc79f('0x14'))['db'];config[_0xc79f('0x15')]=_[_0xc79f('0x16')](config[_0xc79f('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc79f('0x17'))(new Redis(config[_0xc79f('0x15')]));require(_0xc79f('0x18'))[_0xc79f('0x19')](socket);var jayson=require(_0xc79f('0x1a'));var client=jayson['client'][_0xc79f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x3ca3ac,_0x1bd8f8,_0x51a1ab,_0x566910){return new BPromise(function(_0x180f0c,_0x459e53){var _0x5b0d42=_0x566910||client;return _0x5b0d42['request'](_0x3ca3ac,_0x51a1ab)['then'](function(_0x51db9d){logger[_0xc79f('0x1c')](_0xc79f('0x1d'),_0x1bd8f8,_0xc79f('0x1e'));logger[_0xc79f('0x1f')](_0xc79f('0x20'),_0x1bd8f8,_0xc79f('0x1e'),JSON[_0xc79f('0x21')](_0x51db9d));if(_0x51db9d[_0xc79f('0x22')]){if(_0x51db9d['error'][_0xc79f('0x23')]===0x1f4){logger[_0xc79f('0x22')](_0xc79f('0x1d'),_0x1bd8f8,_0x51db9d['error'][_0xc79f('0x24')]);return _0x459e53(_0x51db9d['error'][_0xc79f('0x24')]);}logger[_0xc79f('0x22')]('SmsAccount,\x20%s,\x20%s',_0x1bd8f8,_0x51db9d[_0xc79f('0x22')][_0xc79f('0x24')]);return _0x180f0c(_0x51db9d[_0xc79f('0x22')][_0xc79f('0x24')]);}else{logger['info'](_0xc79f('0x1d'),_0x1bd8f8,'request\x20sent');_0x180f0c(_0x51db9d['result']['message']);}})['catch'](function(_0x3e658d){logger[_0xc79f('0x22')](_0xc79f('0x1d'),_0x1bd8f8,_0x3e658d);_0x459e53(_0x3e658d);});});}function respondWithStatusCode(_0xaff26e,_0x170b22){_0x170b22=_0x170b22||0xcc;return function(_0x1f9068){if(_0x1f9068){return _0xaff26e[_0xc79f('0x25')](_0x170b22);}return _0xaff26e[_0xc79f('0x26')](_0x170b22)['end']();};}function respondWithResult(_0x269ebf,_0x54e077){_0x54e077=_0x54e077||0xc8;return function(_0x63c3f1){if(_0x63c3f1){return _0x269ebf[_0xc79f('0x26')](_0x54e077)[_0xc79f('0x27')](_0x63c3f1);}};}function respondWithFilteredResult(_0x10d32f,_0x5d1d3d){return function(_0x82704b){if(_0x82704b){var _0x2e418c=typeof _0x5d1d3d[_0xc79f('0x28')]===_0xc79f('0x29')&&typeof _0x5d1d3d[_0xc79f('0x2a')]==='undefined';var _0x3e33a3=_0x82704b[_0xc79f('0x2b')];var _0x1303b3=_0x2e418c?0x0:_0x5d1d3d[_0xc79f('0x28')];var _0x4cdae2=_0x2e418c?_0x82704b[_0xc79f('0x2b')]:_0x5d1d3d['offset']+_0x5d1d3d[_0xc79f('0x2a')];var _0x2cbf8d;if(_0x4cdae2>=_0x3e33a3){_0x4cdae2=_0x3e33a3;_0x2cbf8d=0xc8;}else{_0x2cbf8d=0xce;}_0x10d32f[_0xc79f('0x26')](_0x2cbf8d);return _0x10d32f[_0xc79f('0x2c')](_0xc79f('0x2d'),_0x1303b3+'-'+_0x4cdae2+'/'+_0x3e33a3)[_0xc79f('0x27')](_0x82704b);}return null;};}function patchUpdates(_0x56f5a9){return function(_0x1e398f){try{jsonpatch['apply'](_0x1e398f,_0x56f5a9,!![]);}catch(_0x5294ff){return BPromise[_0xc79f('0x2e')](_0x5294ff);}return _0x1e398f[_0xc79f('0x2f')]();};}function saveUpdates(_0x207f47,_0x27f892){return function(_0x1042f6){if(_0x1042f6){return _0x1042f6['update'](_0x207f47)['then'](function(_0x3d3f6e){return _0x3d3f6e;});}return null;};}function removeEntity(_0x3d7f26,_0x21fe70){return function(_0x4ec50c){if(_0x4ec50c){return _0x4ec50c[_0xc79f('0x30')]()[_0xc79f('0x31')](function(){var _0x125124=_0x4ec50c[_0xc79f('0x32')]({'plain':!![]});var _0x521d53='SmsAccounts';return db['UserProfileResource'][_0xc79f('0x30')]({'where':{'type':_0x521d53,'resourceId':_0x125124['id']}})[_0xc79f('0x31')](function(){return _0x4ec50c;});})[_0xc79f('0x31')](function(){_0x3d7f26[_0xc79f('0x26')](0xcc)[_0xc79f('0x33')]();});}};}function handleEntityNotFound(_0x51d4a3,_0x17655d){return function(_0x30df75){if(!_0x30df75){_0x51d4a3[_0xc79f('0x25')](0x194);}return _0x30df75;};}function handleError(_0x3f0787,_0x3d5887){_0x3d5887=_0x3d5887||0x1f4;return function(_0x2b88e7){logger['error'](_0x2b88e7[_0xc79f('0x34')]);if(_0x2b88e7['name']){delete _0x2b88e7['name'];}_0x3f0787['status'](_0x3d5887)[_0xc79f('0x35')](_0x2b88e7);};}exports['index']=function(_0x1c87d6,_0x1270f7){var _0x3b17d6={'include':[{'model':db['Pause'],'as':_0xc79f('0x36')}]},_0x4cc600={},_0x19ece1={'count':0x0,'rows':[]};var _0xe92f36=_[_0xc79f('0x37')](db[_0xc79f('0x38')][_0xc79f('0x39')],function(_0x881945){return{'name':_0x881945[_0xc79f('0x3a')],'type':_0x881945[_0xc79f('0x3b')][_0xc79f('0x3c')]};});_0x4cc600[_0xc79f('0x3d')]=_[_0xc79f('0x37')](_0xe92f36,'name');_0x4cc600[_0xc79f('0x3e')]=_[_0xc79f('0x3f')](_0x1c87d6['query']);_0x4cc600[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x4cc600['model'],_0x4cc600[_0xc79f('0x3e')]);_0x3b17d6[_0xc79f('0x42')]=_[_0xc79f('0x41')](_0x4cc600[_0xc79f('0x3d')],qs[_0xc79f('0x43')](_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x43')]));_0x3b17d6[_0xc79f('0x42')]=_0x3b17d6[_0xc79f('0x42')][_0xc79f('0x44')]?_0x3b17d6[_0xc79f('0x42')]:_0x4cc600[_0xc79f('0x3d')];if(!_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x45')]('nolimit')){_0x3b17d6[_0xc79f('0x2a')]=qs[_0xc79f('0x2a')](_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x2a')]);_0x3b17d6['offset']=qs[_0xc79f('0x28')](_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x28')]);}_0x3b17d6[_0xc79f('0x46')]=qs[_0xc79f('0x47')](_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x3b17d6[_0xc79f('0x48')]=qs['filters'](_[_0xc79f('0x49')](_0x1c87d6[_0xc79f('0x3e')],_0x4cc600[_0xc79f('0x40')]),_0xe92f36);if(_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x4a')]){_0x3b17d6[_0xc79f('0x48')]=_[_0xc79f('0x4b')](_0x3b17d6[_0xc79f('0x48')],{'$or':_[_0xc79f('0x37')](_0xe92f36,function(_0xcd5c6b){if(_0xcd5c6b[_0xc79f('0x3b')]!==_0xc79f('0x4c')){var _0x3a3ff6={};_0x3a3ff6[_0xcd5c6b[_0xc79f('0x4d')]]={'$like':'%'+_0x1c87d6['query'][_0xc79f('0x4a')]+'%'};return _0x3a3ff6;}})});}_0x3b17d6=_['merge']({},_0x3b17d6,_0x1c87d6[_0xc79f('0x4e')]);var _0x1f0564={'where':_0x3b17d6[_0xc79f('0x48')]};return db[_0xc79f('0x38')][_0xc79f('0x2b')](_0x1f0564)['then'](function(_0x4bb3a5){_0x19ece1[_0xc79f('0x2b')]=_0x4bb3a5;if(_0x1c87d6[_0xc79f('0x3e')][_0xc79f('0x4f')]){_0x3b17d6[_0xc79f('0x50')]=[{'all':!![]}];}return db[_0xc79f('0x38')][_0xc79f('0x51')](_0x3b17d6);})[_0xc79f('0x31')](function(_0x38dd9c){_0x19ece1[_0xc79f('0x52')]=_0x38dd9c;return _0x19ece1;})[_0xc79f('0x31')](respondWithFilteredResult(_0x1270f7,_0x3b17d6))[_0xc79f('0x53')](handleError(_0x1270f7,null));};exports[_0xc79f('0x54')]=function(_0x5a052e,_0x530d71){var _0x2d71bc={'raw':![],'where':{'id':_0x5a052e[_0xc79f('0x55')]['id']},'include':[{'model':db[_0xc79f('0x56')],'as':_0xc79f('0x36')}]},_0x461aea={};_0x461aea[_0xc79f('0x3d')]=_[_0xc79f('0x3f')](db['SmsAccount']['rawAttributes']);_0x461aea[_0xc79f('0x3e')]=_['keys'](_0x5a052e[_0xc79f('0x3e')]);_0x461aea[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x461aea[_0xc79f('0x3d')],_0x461aea[_0xc79f('0x3e')]);_0x2d71bc[_0xc79f('0x42')]=_[_0xc79f('0x41')](_0x461aea[_0xc79f('0x3d')],qs[_0xc79f('0x43')](_0x5a052e[_0xc79f('0x3e')][_0xc79f('0x43')]));_0x2d71bc[_0xc79f('0x42')]=_0x2d71bc[_0xc79f('0x42')][_0xc79f('0x44')]?_0x2d71bc[_0xc79f('0x42')]:_0x461aea[_0xc79f('0x3d')];if(_0x5a052e[_0xc79f('0x3e')][_0xc79f('0x4f')]){_0x2d71bc[_0xc79f('0x50')]=[{'all':!![]}];}_0x2d71bc=_['merge']({},_0x2d71bc,_0x5a052e[_0xc79f('0x4e')]);return db[_0xc79f('0x38')][_0xc79f('0x57')](_0x2d71bc)[_0xc79f('0x31')](handleEntityNotFound(_0x530d71,null))[_0xc79f('0x31')](respondWithResult(_0x530d71,null))[_0xc79f('0x53')](handleError(_0x530d71,null));};exports[_0xc79f('0x58')]=function(_0x324e0f,_0x1e3d2b){return db[_0xc79f('0x38')][_0xc79f('0x58')](_0x324e0f['body'],{})[_0xc79f('0x31')](function(_0x32df20){var _0x3e6b79=_0x324e0f[_0xc79f('0x59')]['get']({'plain':!![]});if(!_0x3e6b79)throw new Error(_0xc79f('0x5a'));if(_0x3e6b79['role']===_0xc79f('0x59')){var _0x349aba=_0x32df20[_0xc79f('0x32')]({'plain':!![]});var _0x37b466='SmsAccounts';return db[_0xc79f('0x5b')]['find']({'where':{'name':_0x37b466,'userProfileId':_0x3e6b79[_0xc79f('0x5c')]},'raw':!![]})[_0xc79f('0x31')](function(_0x4fe0a0){if(_0x4fe0a0&&_0x4fe0a0['autoAssociation']===0x0){return db[_0xc79f('0x5d')][_0xc79f('0x58')]({'name':_0x349aba[_0xc79f('0x4d')],'resourceId':_0x349aba['id'],'type':_0x4fe0a0[_0xc79f('0x4d')],'sectionId':_0x4fe0a0['id']},{})[_0xc79f('0x31')](function(){return _0x32df20;});}else{return _0x32df20;}})['catch'](function(_0x4f9433){logger['error'](_0xc79f('0x5e'),_0x4f9433);throw _0x4f9433;});}return _0x32df20;})['then'](respondWithResult(_0x1e3d2b,0xc9))[_0xc79f('0x53')](handleError(_0x1e3d2b,null));};exports[_0xc79f('0x5f')]=function(_0x233a26,_0x6e97a){if(_0x233a26[_0xc79f('0x60')]['id']){delete _0x233a26['body']['id'];}return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x233a26[_0xc79f('0x55')]['id']},'include':[{'model':db[_0xc79f('0x56')],'as':_0xc79f('0x36')}]})[_0xc79f('0x31')](handleEntityNotFound(_0x6e97a,null))[_0xc79f('0x31')](saveUpdates(_0x233a26[_0xc79f('0x60')],null))[_0xc79f('0x31')](respondWithResult(_0x6e97a,null))['catch'](handleError(_0x6e97a,null));};exports[_0xc79f('0x30')]=function(_0x334a87,_0x34bfc8){return db[_0xc79f('0x38')]['find']({'where':{'id':_0x334a87['params']['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x34bfc8,null))[_0xc79f('0x31')](removeEntity(_0x34bfc8,null))[_0xc79f('0x53')](handleError(_0x34bfc8,null));};exports[_0xc79f('0x61')]=function(_0x43211a,_0x49768e){return db['SmsAccount']['describe']()[_0xc79f('0x31')](respondWithResult(_0x49768e,null))[_0xc79f('0x53')](handleError(_0x49768e,null));};exports['addDisposition']=function(_0x398bad,_0x305be1,_0x63ecf6){if(_0x398bad['body']['id']){delete _0x398bad['body']['id'];}return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x398bad[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x305be1,null))['then'](function(_0x4f9ff1){if(_0x4f9ff1){_0x398bad[_0xc79f('0x60')][_0xc79f('0x62')]=_0x4f9ff1['id'];return db['Disposition'][_0xc79f('0x58')](_0x398bad[_0xc79f('0x60')]);}})[_0xc79f('0x31')](respondWithResult(_0x305be1,null))[_0xc79f('0x53')](handleError(_0x305be1,null));};exports['getDispositions']=function(_0x197557,_0x128957,_0x1fc9b3){var _0x140b22={'raw':![],'where':{}};var _0x200d3a={};var _0x135237={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x197557['params']['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x128957,null))[_0xc79f('0x31')](function(_0x3caabf){if(_0x3caabf){_0x200d3a['model']=_[_0xc79f('0x3f')](db[_0xc79f('0x63')][_0xc79f('0x39')]);_0x200d3a[_0xc79f('0x3e')]=_[_0xc79f('0x3f')](_0x197557['query']);_0x200d3a[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x200d3a[_0xc79f('0x3d')],_0x200d3a[_0xc79f('0x3e')]);_0x140b22[_0xc79f('0x42')]=_['intersection'](_0x200d3a[_0xc79f('0x3d')],qs[_0xc79f('0x43')](_0x197557['query'][_0xc79f('0x43')]));_0x140b22['attributes']=_0x140b22[_0xc79f('0x42')]['length']?_0x140b22[_0xc79f('0x42')]:_0x200d3a[_0xc79f('0x3d')];if(!_0x197557['query']['hasOwnProperty'](_0xc79f('0x64'))){_0x140b22[_0xc79f('0x2a')]=qs[_0xc79f('0x2a')](_0x197557[_0xc79f('0x3e')]['limit']);_0x140b22[_0xc79f('0x28')]=qs['offset'](_0x197557[_0xc79f('0x3e')][_0xc79f('0x28')]);}_0x140b22[_0xc79f('0x46')]=qs[_0xc79f('0x47')](_0x197557[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x140b22[_0xc79f('0x48')]=qs[_0xc79f('0x40')](_[_0xc79f('0x49')](_0x197557[_0xc79f('0x3e')],_0x200d3a[_0xc79f('0x40')]));_0x140b22[_0xc79f('0x48')][_0xc79f('0x62')]=_0x3caabf['id'];if(_0x197557[_0xc79f('0x3e')][_0xc79f('0x4a')]){_0x140b22[_0xc79f('0x48')]=_[_0xc79f('0x4b')](_0x140b22[_0xc79f('0x48')],{'$or':_[_0xc79f('0x37')](_0x140b22[_0xc79f('0x42')],function(_0x292d10){var _0x5c9e58={};_0x5c9e58[_0x292d10]={'$like':'%'+_0x197557[_0xc79f('0x3e')]['filter']+'%'};return _0x5c9e58;})});}_0x140b22=_[_0xc79f('0x4b')]({},_0x140b22,_0x197557[_0xc79f('0x4e')]);return db['Disposition'][_0xc79f('0x2b')]({'where':_0x140b22[_0xc79f('0x48')]})['then'](function(_0x5a29a1){_0x135237[_0xc79f('0x2b')]=_0x5a29a1;if(_0x197557[_0xc79f('0x3e')][_0xc79f('0x4f')]){_0x140b22[_0xc79f('0x50')]=[{'all':!![]}];}return db[_0xc79f('0x63')][_0xc79f('0x51')](_0x140b22);})['then'](function(_0x1b374b){_0x135237['rows']=_0x1b374b;return _0x135237;});}})[_0xc79f('0x31')](respondWithFilteredResult(_0x128957,_0x140b22))[_0xc79f('0x53')](handleError(_0x128957,null));};exports[_0xc79f('0x65')]=function(_0x546625,_0x413bd4,_0x33fa76){return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x546625[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x413bd4,null))[_0xc79f('0x31')](function(_0xeb184b){if(_0xeb184b){return _0xeb184b['removeDispositions'](_0x546625[_0xc79f('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x413bd4,null))['catch'](handleError(_0x413bd4,null));};exports[_0xc79f('0x66')]=function(_0x27f71a,_0x44f3a6,_0x368baa){if(_0x27f71a['body']['id']){delete _0x27f71a[_0xc79f('0x60')]['id'];}return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x27f71a[_0xc79f('0x55')]['id']}})['then'](handleEntityNotFound(_0x44f3a6,null))[_0xc79f('0x31')](function(_0x4d1ea0){if(_0x4d1ea0){_0x27f71a[_0xc79f('0x60')][_0xc79f('0x62')]=_0x4d1ea0['id'];return db[_0xc79f('0x67')][_0xc79f('0x58')](_0x27f71a[_0xc79f('0x60')]);}})[_0xc79f('0x31')](respondWithResult(_0x44f3a6,null))['catch'](handleError(_0x44f3a6,null));};exports[_0xc79f('0x68')]=function(_0x4a7395,_0x3ab5a9,_0x5c980b){var _0x223ee9={'raw':![],'where':{}};var _0x465d2c={};var _0x142489={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc79f('0x69')]({'where':{'id':_0x4a7395[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x3ab5a9,null))['then'](function(_0x4cd7af){if(_0x4cd7af){_0x465d2c[_0xc79f('0x3d')]=_['keys'](db[_0xc79f('0x67')][_0xc79f('0x39')]);_0x465d2c['query']=_[_0xc79f('0x3f')](_0x4a7395['query']);_0x465d2c['filters']=_[_0xc79f('0x41')](_0x465d2c[_0xc79f('0x3d')],_0x465d2c[_0xc79f('0x3e')]);_0x223ee9[_0xc79f('0x42')]=_['intersection'](_0x465d2c['model'],qs[_0xc79f('0x43')](_0x4a7395[_0xc79f('0x3e')][_0xc79f('0x43')]));_0x223ee9[_0xc79f('0x42')]=_0x223ee9[_0xc79f('0x42')]['length']?_0x223ee9['attributes']:_0x465d2c[_0xc79f('0x3d')];if(!_0x4a7395[_0xc79f('0x3e')]['hasOwnProperty'](_0xc79f('0x64'))){_0x223ee9['limit']=qs[_0xc79f('0x2a')](_0x4a7395[_0xc79f('0x3e')][_0xc79f('0x2a')]);_0x223ee9[_0xc79f('0x28')]=qs[_0xc79f('0x28')](_0x4a7395[_0xc79f('0x3e')][_0xc79f('0x28')]);}_0x223ee9[_0xc79f('0x46')]=qs['sort'](_0x4a7395[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x223ee9[_0xc79f('0x48')]=qs['filters'](_['pick'](_0x4a7395[_0xc79f('0x3e')],_0x465d2c[_0xc79f('0x40')]));_0x223ee9['where'][_0xc79f('0x62')]=_0x4cd7af['id'];if(_0x4a7395['query'][_0xc79f('0x4a')]){_0x223ee9['where']=_[_0xc79f('0x4b')](_0x223ee9['where'],{'$or':_[_0xc79f('0x37')](_0x223ee9[_0xc79f('0x42')],function(_0x2cfcb9){var _0x3099ea={};_0x3099ea[_0x2cfcb9]={'$like':'%'+_0x4a7395['query'][_0xc79f('0x4a')]+'%'};return _0x3099ea;})});}_0x223ee9=_[_0xc79f('0x4b')]({},_0x223ee9,_0x4a7395[_0xc79f('0x4e')]);return db[_0xc79f('0x67')][_0xc79f('0x2b')]({'where':_0x223ee9['where']})[_0xc79f('0x31')](function(_0x173dc8){_0x142489[_0xc79f('0x2b')]=_0x173dc8;if(_0x4a7395[_0xc79f('0x3e')][_0xc79f('0x4f')]){_0x223ee9[_0xc79f('0x50')]=[{'all':!![]}];}return db[_0xc79f('0x67')]['findAll'](_0x223ee9);})['then'](function(_0x3eb489){_0x142489['rows']=_0x3eb489;return _0x142489;});}})[_0xc79f('0x31')](respondWithFilteredResult(_0x3ab5a9,_0x223ee9))[_0xc79f('0x53')](handleError(_0x3ab5a9,null));};exports[_0xc79f('0x6a')]=function(_0x4595b0,_0x173a8b,_0x5c9279){return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x4595b0[_0xc79f('0x55')]['id']}})['then'](handleEntityNotFound(_0x173a8b,null))[_0xc79f('0x31')](function(_0x2403c7){if(_0x2403c7){return _0x2403c7[_0xc79f('0x6a')](_0x4595b0[_0xc79f('0x3e')][_0xc79f('0x6b')]);}})[_0xc79f('0x31')](respondWithStatusCode(_0x173a8b,null))[_0xc79f('0x53')](handleError(_0x173a8b,null));};exports[_0xc79f('0x6c')]=function(_0xe6112a,_0x1e6649,_0x2bd915){var _0x34d53e={'channel':_0xc79f('0x6d')};var _0x31faf4=[];var _0x106a1e=[];var _0x2f79b6={};return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0xe6112a[_0xc79f('0x55')]['id']},'include':[{'model':db[_0xc79f('0x6e')],'as':_0xc79f('0x6f')}]})[_0xc79f('0x31')](handleEntityNotFound(_0x1e6649,null))[_0xc79f('0x31')](function(_0x2548ec){_0x34d53e['account']=_0x2548ec;_0x34d53e[_0xc79f('0x70')]=_[_0xc79f('0x71')](_0x2548ec[_0xc79f('0x6f')],['priority'],[_0xc79f('0x72')]);if(_0x34d53e[_0xc79f('0x73')][_0xc79f('0x6f')]){delete _0x34d53e[_0xc79f('0x73')][_0xc79f('0x6f')];}return db[_0xc79f('0x74')]['describe']();})[_0xc79f('0x31')](function(_0x42cf41){if(!_0x42cf41){throw new db['Sequelize']['ValidationError'](_0xc79f('0x75'));}_0x31faf4=_[_0xc79f('0x76')](_[_0xc79f('0x3f')](_0x42cf41),[_0xc79f('0x77'),_0xc79f('0x78')]);_0x106a1e=_[_0xc79f('0x76')](_[_0xc79f('0x3f')](_0x42cf41),[_0xc79f('0x77'),_0xc79f('0x78'),_0xc79f('0x79'),_0xc79f('0x7a')]);_0x34d53e[_0xc79f('0x60')]={'mapKey':_0xc79f('0x7b')};if(_0x34d53e[_0xc79f('0x73')][_0xc79f('0x3b')]){switch(_0x34d53e[_0xc79f('0x73')][_0xc79f('0x3b')]){case _0xc79f('0x7c'):_0x34d53e['body'][_0xc79f('0x7d')]=_0xe6112a['body']['From'];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x7e')];_0x34d53e[_0xc79f('0x60')]['messageId']=_0xe6112a['body'][_0xc79f('0x7f')];break;case _0xc79f('0x80'):_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]='+'+_0xe6112a[_0xc79f('0x60')][_0xc79f('0x81')];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x82')];break;case _0xc79f('0x83'):_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]=_0xe6112a[_0xc79f('0x60')]['from'];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')]=_0xe6112a['body'][_0xc79f('0x24')];break;case _0xc79f('0x84'):_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]=_0xe6112a[_0xc79f('0x60')]['from'];_0x34d53e[_0xc79f('0x60')]['body']=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x60')];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x85')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x86')];break;case'plivo':_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x87')];_0x34d53e[_0xc79f('0x60')]['body']=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x88')];_0x34d53e[_0xc79f('0x60')]['messageId']=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x89')];break;case _0xc79f('0x8a'):_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]='+'+_0xe6112a[_0xc79f('0x60')][_0xc79f('0x8b')][0x0][_0xc79f('0x7d')];_0x34d53e['body'][_0xc79f('0x60')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x8b')][0x0][_0xc79f('0x82')];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x85')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x8b')][0x0]['messageId'];break;case _0xc79f('0x8c'):_0x34d53e['body'][_0xc79f('0x7d')]=_0xe6112a['body'][_0xc79f('0x8d')];_0x34d53e['body']['body']=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x8e')][_0xc79f('0x24')];break;case _0xc79f('0x8f'):_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x90')];_0x34d53e['body'][_0xc79f('0x60')]=_0xe6112a[_0xc79f('0x60')][_0xc79f('0x82')];_0x34d53e['body'][_0xc79f('0x85')]=_0xe6112a['body'][_0xc79f('0x91')];break;case _0xc79f('0x92'):_0x34d53e[_0xc79f('0x60')]['messageId']=_0xe6112a[_0xc79f('0x60')][0x0][_0xc79f('0x24')]['id'];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')]=_0xe6112a[_0xc79f('0x60')][0x0]['message'][_0xc79f('0x7d')];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')]=_0xe6112a[_0xc79f('0x60')][0x0]['message']['text'];break;case _0xc79f('0x93'):_0x34d53e['body'][_0xc79f('0x7d')]=_0xe6112a['body'][_0xc79f('0x7d')];_0x34d53e['body'][_0xc79f('0x60')]=_0xe6112a['body']['message'];_0x34d53e[_0xc79f('0x60')][_0xc79f('0x85')]=_0xe6112a['body'][_0xc79f('0x94')];break;}}if(_0x34d53e[_0xc79f('0x60')]['id']){delete _0x34d53e[_0xc79f('0x60')]['id'];}if(_[_0xc79f('0x95')](_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')])){throw new db[(_0xc79f('0x96'))]['ValidationError'](_0xc79f('0x97'));}if(_[_0xc79f('0x95')](_0x34d53e['body'][_0xc79f('0x60')])||_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')]===''){throw new db[(_0xc79f('0x96'))][(_0xc79f('0x98'))](_0xc79f('0x99'));}if(_[_0xc79f('0x95')](_0x34d53e[_0xc79f('0x60')][_0xc79f('0x9a')])){throw new db['Sequelize'][(_0xc79f('0x98'))](_0xc79f('0x9b')+_0x106a1e);}if(!_[_0xc79f('0x9c')](_0x106a1e,_0x34d53e['body'][_0xc79f('0x9a')])){throw new db[(_0xc79f('0x96'))]['ValidationError'](_0xc79f('0x9d')+_0x106a1e);}_0x2f79b6[_0x34d53e[_0xc79f('0x60')][_0xc79f('0x9a')]]=_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')];return db[_0xc79f('0x9e')][_0xc79f('0x57')]({'where':{'id':_0x34d53e[_0xc79f('0x73')][_0xc79f('0x7a')]},'include':[{'model':db['CmContact'],'as':_0xc79f('0x9f'),'where':_0x2f79b6,'limit':0x1,'order':[[_0xc79f('0x78'),_0xc79f('0xa0')]]}]});})[_0xc79f('0x31')](handleEntityNotFound(_0x1e6649,null))[_0xc79f('0x31')](function(_0xc4255b){if(_0xc4255b){_0x34d53e['list']=_['omit'](_0xc4255b,['Contacts']);if(_0xc4255b[_0xc79f('0x9f')]['length']){return _0xc4255b['Contacts'][0x0];}var _0x10987b=_[_0xc79f('0x16')](_0x34d53e[_0xc79f('0x60')],{'firstName':_0x34d53e['body'][_0xc79f('0x7d')],'ListId':_0xc4255b['id']});_0x10987b[_0x34d53e[_0xc79f('0x60')]['mapKey']]=_0x34d53e[_0xc79f('0x60')]['from'];return db[_0xc79f('0x74')][_0xc79f('0x58')](_0x10987b,{'fields':_0x31faf4,'raw':!![]});}})[_0xc79f('0x31')](handleEntityNotFound(_0x1e6649,null))[_0xc79f('0x31')](function(_0x3c1488){if(_0x3c1488){_0x34d53e['contact']=_0x3c1488;var _0x483dca={'ContactId':_0x3c1488['id'],'phone':_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')],'SmsAccountId':_0xe6112a[_0xc79f('0x55')]['id']};var _0x4109ff={'ContactId':_0x3c1488['id'],'SmsAccountId':_0xe6112a['params']['id'],'closed':![]};return db[_0xc79f('0xa1')]['find']({'where':_0x4109ff})[_0xc79f('0x31')](function(_0xbb3a0b){if(_0xbb3a0b){return[_0xbb3a0b,![]];}return db[_0xc79f('0xa1')]['create'](_0x483dca)[_0xc79f('0x31')](function(_0x12c627){return[_0x12c627,!![]];});});}})[_0xc79f('0xa2')](function(_0x3d2dbb,_0x29d905){_0x34d53e[_0xc79f('0xa3')]=_0x3d2dbb[_0xc79f('0x32')]({'plain':!![]});_0x34d53e[_0xc79f('0xa3')]['created']=![];if(_0x29d905){if(_0x34d53e[_0xc79f('0x73')][_0xc79f('0xa4')]){_0x34d53e[_0xc79f('0x70')][_0xc79f('0xa5')]({'id':0x0,'priority':_0x34d53e[_0xc79f('0x70')][_0xc79f('0x44')]+0x1,'app':_0xc79f('0xa6'),'appdata':_0xc79f('0xa7'),'interval':_0xc79f('0xa8')});}_0x34d53e[_0xc79f('0xa3')]['created']=!![];}return db[_0xc79f('0xa9')][_0xc79f('0x58')]({'phone':_0x34d53e[_0xc79f('0x60')][_0xc79f('0x7d')],'messageId':_0x34d53e[_0xc79f('0x60')][_0xc79f('0x85')],'body':_0x34d53e[_0xc79f('0x60')][_0xc79f('0x60')],'SmsAccountId':_0xe6112a[_0xc79f('0x55')]['id'],'SmsInteractionId':_0x3d2dbb['id'],'direction':'in','ContactId':_0x3d2dbb[_0xc79f('0xaa')],'AttachmentId':_0x34d53e[_0xc79f('0x60')][_0xc79f('0xab')]});})[_0xc79f('0x31')](function(_0x48a002){_0x34d53e[_0xc79f('0x24')]=_0x48a002;if(!_0x34d53e[_0xc79f('0xa3')][_0xc79f('0xac')])return;return db[_0xc79f('0xad')][_0xc79f('0x57')]({'attributes':['id',_0xc79f('0x4d')],'where':{'id':_0x34d53e[_0xc79f('0xa3')]['UserId']}});})[_0xc79f('0x31')](function(_0x3c65c3){if(_0x3c65c3){_0x34d53e['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc79f('0xae'),'appdata':_0x3c65c3['name']+','+(_0x34d53e[_0xc79f('0x73')][_0xc79f('0xaf')]||0xa),'interval':_0xc79f('0xa8')});}if(!_0x34d53e['interaction']['queueId'])return;return db['SmsQueue']['find']({'attributes':['id',_0xc79f('0x4d')],'where':{'id':_0x34d53e[_0xc79f('0xa3')]['queueId']}});})[_0xc79f('0x31')](function(_0xda3f22){if(_0xda3f22){_0x34d53e[_0xc79f('0x70')][_0xc79f('0xb0')]({'id':0x0,'priority':0x1,'app':_0xc79f('0xb1'),'appdata':_0xda3f22[_0xc79f('0x4d')]+','+(_0x34d53e[_0xc79f('0x73')][_0xc79f('0xb2')]||0x12c),'interval':_0xc79f('0xa8')});}return respondWithRpcPromise('Start','startRouting',_0x34d53e);})['then'](function(_0x208782){if(_0x208782){var _0x45cbb4=0xc8;var _0x2283d1=_0xc79f('0xb3');logger[_0xc79f('0x1c')](_0xc79f('0x20'),_0x2283d1,_0x45cbb4,_0xc79f('0xb4'));logger[_0xc79f('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2283d1,_0x45cbb4,'entity\x20found',JSON['stringify'](_0x208782));if(_0x34d53e[_0xc79f('0x73')][_0xc79f('0x3b')]===_0xc79f('0x7c')){return _0x1e6649[_0xc79f('0x26')](_0x45cbb4)[_0xc79f('0x2c')](_0xc79f('0xb5'),_0xc79f('0xb6'))[_0xc79f('0x35')](_0xc79f('0xb7'));}else{return _0x1e6649[_0xc79f('0x26')](_0x45cbb4)[_0xc79f('0x27')](_0x208782);}}})[_0xc79f('0x53')](handleError(_0x1e6649,null));};exports[_0xc79f('0xb8')]=function(_0x49491b,_0x3cc6ad){var _0x41e1f1=_0x49491b['params']['id'];var _0x29c01b=_0x49491b[_0xc79f('0x60')];var _0x31cf68=0xc8;var _0x11c2cd=null;return db[_0xc79f('0xb9')]['transaction']({'isolationLevel':db[_0xc79f('0xb9')]['Transaction'][_0xc79f('0xba')][_0xc79f('0xbb')]},function(_0xa7eec){return db[_0xc79f('0x38')][_0xc79f('0x69')]({'where':{'id':_0x41e1f1},'transaction':_0xa7eec})[_0xc79f('0x31')](function(_0x4323e1){if(_0x4323e1){return db[_0xc79f('0x6e')][_0xc79f('0x30')]({'where':{'SmsAccountId':_0x41e1f1},'transaction':_0xa7eec})[_0xc79f('0x31')](function(){var _0x2d155c=_[_0xc79f('0x37')](_0x29c01b,function(_0x4a176d){_0x4a176d[_0xc79f('0x62')]=_0x41e1f1;return _0x4a176d;});return db[_0xc79f('0x6e')]['bulkCreate'](_0x2d155c,{'transaction':_0xa7eec});});}else{_0x31cf68=0x194;_0x11c2cd=[];}});})[_0xc79f('0x31')](function(){if(_0x31cf68!==0x194){return db[_0xc79f('0x6e')][_0xc79f('0xbc')]({'where':{'SmsAccountId':_0x41e1f1},'order':_0xc79f('0xbd')})[_0xc79f('0x31')](function(_0x5739e8){_0x11c2cd=_0x5739e8;});}})[_0xc79f('0x53')](function(_0xe2a0ec){_0x31cf68=0x1f4;logger[_0xc79f('0x22')](_0xe2a0ec[_0xc79f('0x34')]);if(_0xe2a0ec[_0xc79f('0x4d')]){delete _0xe2a0ec[_0xc79f('0x4d')];}_0x11c2cd=_0xe2a0ec;})[_0xc79f('0xbe')](function(){if(_0x11c2cd===null){_0x3cc6ad[_0xc79f('0x25')](_0x31cf68);}else{if(_0x31cf68===0x1f4){_0x3cc6ad[_0xc79f('0x26')](_0x31cf68)['send'](_0x11c2cd);}else{_0x3cc6ad[_0xc79f('0x26')](_0x31cf68)['json'](_0x11c2cd);}}});};exports[_0xc79f('0xbf')]=function(_0x4efa4a,_0x51cf03,_0x1c8e58){var _0x38bd93={};var _0x16832e={};var _0x35bcf2;var _0xff73c1;return db[_0xc79f('0x38')]['findOne']({'where':{'id':_0x4efa4a[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x51cf03,null))[_0xc79f('0x31')](function(_0x4d666f){if(_0x4d666f){_0x35bcf2=_0x4d666f;_0x16832e[_0xc79f('0x3d')]=_['keys'](db[_0xc79f('0x6e')][_0xc79f('0x39')]);_0x16832e[_0xc79f('0x3e')]=_[_0xc79f('0x3f')](_0x4efa4a['query']);_0x16832e[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x16832e['model'],_0x16832e[_0xc79f('0x3e')]);_0x38bd93[_0xc79f('0x42')]=_[_0xc79f('0x41')](_0x16832e['model'],qs[_0xc79f('0x43')](_0x4efa4a['query'][_0xc79f('0x43')]));_0x38bd93[_0xc79f('0x42')]=_0x38bd93[_0xc79f('0x42')]['length']?_0x38bd93[_0xc79f('0x42')]:_0x16832e['model'];_0x38bd93[_0xc79f('0x46')]=qs[_0xc79f('0x47')](_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x38bd93[_0xc79f('0x48')]=qs[_0xc79f('0x40')](_[_0xc79f('0x49')](_0x4efa4a[_0xc79f('0x3e')],_0x16832e[_0xc79f('0x40')]));if(_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x4a')]){_0x38bd93[_0xc79f('0x48')]=_['merge'](_0x38bd93['where'],{'$or':_[_0xc79f('0x37')](_0x38bd93['attributes'],function(_0x1893d9){var _0x371897={};_0x371897[_0x1893d9]={'$like':'%'+_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x4a')]+'%'};return _0x371897;})});}_0x38bd93=_[_0xc79f('0x4b')]({},_0x38bd93,_0x4efa4a[_0xc79f('0x4e')]);return _0x35bcf2[_0xc79f('0xbf')](_0x38bd93);}})[_0xc79f('0x31')](function(_0x55df45){if(_0x55df45){_0xff73c1=_0x55df45[_0xc79f('0x44')];if(!_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x45')](_0xc79f('0x64'))){_0x38bd93[_0xc79f('0x2a')]=qs['limit'](_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x2a')]);_0x38bd93[_0xc79f('0x28')]=qs[_0xc79f('0x28')](_0x4efa4a[_0xc79f('0x3e')][_0xc79f('0x28')]);}return _0x35bcf2[_0xc79f('0xbf')](_0x38bd93);}})['then'](function(_0xb8cc61){if(_0xb8cc61){return _0xb8cc61?{'count':_0xff73c1,'rows':_0xb8cc61}:null;}})['then'](respondWithResult(_0x51cf03,null))[_0xc79f('0x53')](handleError(_0x51cf03,null));};exports['getInteractions']=function(_0x16d68b,_0xa8b39,_0x3b0698){var _0x427737={'raw':![],'where':{}};var _0x326bcc={};var _0x4b08d2={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc79f('0x69')]({'where':{'id':_0x16d68b['params']['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0xa8b39,null))[_0xc79f('0x31')](function(_0x4ec04f){if(_0x4ec04f){_0x326bcc[_0xc79f('0x3d')]=_[_0xc79f('0x3f')](db[_0xc79f('0xa1')][_0xc79f('0x39')]);_0x326bcc[_0xc79f('0x3e')]=_[_0xc79f('0x3f')](_0x16d68b['query']);_0x326bcc[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x326bcc[_0xc79f('0x3d')],_0x326bcc[_0xc79f('0x3e')]);_0x427737['attributes']=_[_0xc79f('0x41')](_0x326bcc[_0xc79f('0x3d')],qs[_0xc79f('0x43')](_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x43')]));_0x427737[_0xc79f('0x42')]=_0x427737[_0xc79f('0x42')][_0xc79f('0x44')]?_0x427737[_0xc79f('0x42')]:_0x326bcc['model'];if(!_0x16d68b['query'][_0xc79f('0x45')](_0xc79f('0x64'))){_0x427737['limit']=qs[_0xc79f('0x2a')](_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x2a')]);_0x427737[_0xc79f('0x28')]=qs['offset'](_0x16d68b['query']['offset']);}_0x427737['order']=qs['sort'](_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x427737['where']=qs[_0xc79f('0x40')](_[_0xc79f('0x49')](_0x16d68b[_0xc79f('0x3e')],_0x326bcc['filters']));_0x427737[_0xc79f('0x48')][_0xc79f('0x62')]=_0x4ec04f['id'];if(_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x4a')]){_0x427737[_0xc79f('0x48')]=_[_0xc79f('0x4b')](_0x427737[_0xc79f('0x48')],{'$or':_['map'](_0x427737[_0xc79f('0x42')],function(_0x4fafad){var _0x4ef756={};_0x4ef756[_0x4fafad]={'$like':'%'+_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x4a')]+'%'};return _0x4ef756;})});}_0x427737=_[_0xc79f('0x4b')]({},_0x427737,_0x16d68b['options']);return db[_0xc79f('0xa1')][_0xc79f('0x2b')]({'where':_0x427737[_0xc79f('0x48')]})[_0xc79f('0x31')](function(_0x504eac){_0x4b08d2[_0xc79f('0x2b')]=_0x504eac;if(_0x16d68b[_0xc79f('0x3e')][_0xc79f('0x4f')]){_0x427737[_0xc79f('0x50')]=[{'model':db[_0xc79f('0x74')],'as':_0xc79f('0xc0'),'required':![]},{'model':db[_0xc79f('0xad')],'as':_0xc79f('0xc1'),'attributes':[_0xc79f('0x4d'),'fullname',_0xc79f('0xc2')],'required':![]},{'model':db['Tag'],'as':_0xc79f('0xc3'),'attributes':['id',_0xc79f('0x4d'),_0xc79f('0xc4')],'where':_0x16d68b[_0xc79f('0x3e')][_0xc79f('0xc5')]?{'id':_0x16d68b[_0xc79f('0x3e')][_0xc79f('0xc5')]}:undefined,'required':_0x16d68b[_0xc79f('0x3e')][_0xc79f('0xc5')]?!![]:![]}];}return db['SmsInteraction'][_0xc79f('0x51')](_0x427737);})[_0xc79f('0x31')](function(_0x347e07){_0x4b08d2['rows']=_0x347e07;return _0x4b08d2;});}})[_0xc79f('0x31')](respondWithFilteredResult(_0xa8b39,_0x427737))[_0xc79f('0x53')](handleError(_0xa8b39,null));};exports[_0xc79f('0x35')]=function(_0x6a451b,_0x15302,_0x3ecd41){var _0x19efe0,_0x1ec599,_0x1535f1;if(_[_0xc79f('0x95')](_0x6a451b[_0xc79f('0x60')][_0xc79f('0x60')])||_0x6a451b['body'][_0xc79f('0x60')]===''){throw new db[(_0xc79f('0x96'))][(_0xc79f('0x98'))](_0xc79f('0x99'));}if(_[_0xc79f('0x95')](_0x6a451b[_0xc79f('0x60')]['to'])){throw new db[(_0xc79f('0x96'))][(_0xc79f('0x98'))](_0xc79f('0xc6'));}_0x19efe0=_0x6a451b[_0xc79f('0x60')]['to'];return db['SmsAccount'][_0xc79f('0x57')]({'where':{'id':_0x6a451b[_0xc79f('0x55')]['id']},'include':[{'model':db[_0xc79f('0x9e')],'as':_0xc79f('0xc7'),'include':[{'model':db[_0xc79f('0x74')],'as':_0xc79f('0x9f'),'where':{'mobile':_0x19efe0},'limit':0x1,'order':[[_0xc79f('0x78'),_0xc79f('0xa0')]]}]}]})[_0xc79f('0x31')](handleEntityNotFound(_0x15302,null))[_0xc79f('0x31')](function(_0x2a2fca){if(_0x2a2fca&&_0x2a2fca['List']){_0x1ec599=_0x2a2fca['get']({'plain':!![]});if(_0x1ec599[_0xc79f('0xc7')]&&_0x1ec599['List'][_0xc79f('0x9f')][_0xc79f('0x44')]){return _0x1ec599['List'][_0xc79f('0x9f')][0x0];}return db[_0xc79f('0x74')][_0xc79f('0x58')](_[_0xc79f('0x16')](_0x6a451b['body'],{'firstName':_0x19efe0,'mobile':_0x19efe0,'phone':_0x19efe0,'ListId':_0x1ec599[_0xc79f('0x7a')]}));}})[_0xc79f('0x31')](handleEntityNotFound(_0x15302,null))[_0xc79f('0x31')](function(_0x17124b){if(_0x17124b){_0x1535f1=_0x17124b;return db[_0xc79f('0xa1')][_0xc79f('0x57')]({'where':{'ContactId':_0x1535f1['id'],'closed':![],'SmsAccountId':_0x1ec599['id']}})['then'](function(_0x18e7c8){if(_0x18e7c8){return[_0x18e7c8,![]];}return db[_0xc79f('0xa1')][_0xc79f('0x58')]({'UserId':_0x6a451b[_0xc79f('0x59')]['id'],'ContactId':_0x1535f1['id'],'SmsAccountId':_0x1ec599['id'],'phone':_0x19efe0,'firstMsgDirection':_0xc79f('0xc8'),'Messages':[_['merge'](_0x6a451b[_0xc79f('0x60')],{'read':![],'body':_0x6a451b['body'][_0xc79f('0x60')],'phone':_0x19efe0,'SmsAccountId':_0x1ec599['id'],'UserId':_0x6a451b[_0xc79f('0x59')]['id'],'ContactId':_0x1535f1['id']})]},{'include':[{'model':db[_0xc79f('0xa9')],'as':_0xc79f('0xc9')}]})[_0xc79f('0x31')](function(_0xa5acb){return[_0xa5acb,!![]];});});}})[_0xc79f('0xa2')](function(_0x1e21d5,_0x2fdfc7){if(_0x2fdfc7){return _0x1e21d5;}return db['SmsMessage']['create'](_[_0xc79f('0x4b')](_0x6a451b['body'],{'read':![],'body':_0x6a451b[_0xc79f('0x60')][_0xc79f('0x60')],'phone':_0x19efe0,'SmsAccountId':_0x1ec599['id'],'SmsInteractionId':_0x1e21d5['id'],'UserId':_0x6a451b[_0xc79f('0x59')]['id'],'ContactId':_0x1535f1['id']}))[_0xc79f('0x31')](function(_0x28ad45){_0x1e21d5['dataValues'][_0xc79f('0xc9')]=[];_0x1e21d5['dataValues'][_0xc79f('0xc9')][_0xc79f('0xa5')](_0x28ad45[_0xc79f('0xca')]);return _0x1e21d5;});})[_0xc79f('0x31')](respondWithResult(_0x15302,null))[_0xc79f('0x53')](handleError(_0x15302,null));};exports[_0xc79f('0x26')]=function(_0x35dfb5,_0x1a8cc1,_0x128e7c){if(_0x35dfb5[_0xc79f('0x60')]['id']){delete _0x35dfb5[_0xc79f('0x60')]['id'];}var _0x17270b,_0x31f02c,_0x1291c3;return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x35dfb5[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x1a8cc1,null))[_0xc79f('0x31')](function(_0x402834){if(_0x402834){_0x1291c3=_0x402834;logger[_0xc79f('0x1f')](_0xc79f('0x20'),'status','received\x20delivery\x20report\x20from',_0x402834[_0xc79f('0x3b')],util['inspect'](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));switch(_0x402834['type']){case _0xc79f('0x80'):if(_0x35dfb5['body']['skebby_dispatch_id']&&_0x35dfb5['body']['status']){_0x31f02c=_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x26')];return db[_0xc79f('0xa9')]['find']({'where':{'messageId':_0x35dfb5[_0xc79f('0x60')]['skebby_dispatch_id']}});}break;case _0xc79f('0x83'):if(_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcb')]&&_0x35dfb5[_0xc79f('0x60')]['statusInt']){_0x31f02c=_0x35dfb5[_0xc79f('0x60')]['statusInt'];return db[_0xc79f('0xa9')][_0xc79f('0x57')]({'where':{'messageId':_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcb')]}});}break;case _0xc79f('0x84'):if(_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x86')]&&_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcc')]){_0x31f02c=_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcc')];return db[_0xc79f('0xa9')][_0xc79f('0x57')]({'where':{'messageId':_0x35dfb5['body'][_0xc79f('0x86')]}});}break;case _0xc79f('0x8a'):var _0x180434=_0x35dfb5['body'][_0xc79f('0x8b')][0x0];if(_0x180434['messageId']&&_0x180434[_0xc79f('0x26')][_0xc79f('0xcd')]===_0xc79f('0xce')){_0x31f02c=_0x180434[_0xc79f('0x26')][_0xc79f('0xcd')];return db[_0xc79f('0xa9')]['find']({'where':{'messageId':_0x180434[_0xc79f('0x85')]}});}break;case _0xc79f('0x8f'):if(_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x85')]&&_0x35dfb5['body'][_0xc79f('0x26')]){_0x31f02c=_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x26')];return db[_0xc79f('0xa9')][_0xc79f('0x57')]({'where':{'messageId':_0x35dfb5[_0xc79f('0x60')]['messageId']}});}break;case _0xc79f('0x92'):if(_0x35dfb5[_0xc79f('0x60')][0x0][_0xc79f('0x24')]['id']){_0x31f02c=_0x35dfb5['body'][0x0][_0xc79f('0x3b')];return db[_0xc79f('0xa9')][_0xc79f('0x57')]({'where':{'messageId':_0x35dfb5[_0xc79f('0x60')][0x0][_0xc79f('0x24')]['id']}});}break;case _0xc79f('0x93'):if(_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcf')]&&_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x26')]){_0x31f02c=_0x35dfb5[_0xc79f('0x60')][_0xc79f('0x26')];return db[_0xc79f('0xa9')][_0xc79f('0x57')]({'where':{'messageId':_0x35dfb5[_0xc79f('0x60')][_0xc79f('0xcf')]}});}break;}}})[_0xc79f('0x31')](handleEntityNotFound(_0x1a8cc1,null))[_0xc79f('0x31')](function(_0x5e8bc7){if(_0x5e8bc7){_0x17270b=_0x5e8bc7;switch(_0x1291c3[_0xc79f('0x3b')]){case _0xc79f('0x80'):if(_0x31f02c===_0xc79f('0xce')){return _0x17270b[_0xc79f('0x5f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc79f('0x26'),'skebby',util['inspect'](_0x35dfb5['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x31f02c==='1'){return _0x17270b[_0xc79f('0x5f')]({'read':!![]});}else{logger[_0xc79f('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc79f('0x80'),util[_0xc79f('0xd0')](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc79f('0x84'):if(!_0x35dfb5['body']['error_code']&&_0x31f02c>=0xc8&&_0x31f02c<=0xce){return _0x17270b[_0xc79f('0x5f')]({'read':!![]});}else{logger['error'](_0xc79f('0x20'),_0xc79f('0x26'),'clicksend',util[_0xc79f('0xd0')](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc79f('0x8a'):var _0x499578=_0x35dfb5[_0xc79f('0x60')]['results'][0x0];if(_0x499578[_0xc79f('0x26')]['groupName']===_0xc79f('0xce')){return _0x17270b['update']({'read':!![]});}else{logger[_0xc79f('0x22')](_0xc79f('0x20'),_0xc79f('0x26'),_0xc79f('0x8a'),util[_0xc79f('0xd0')](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc79f('0x8f'):if(_0x31f02c==_0xc79f('0xd1')||_0x31f02c==_0xc79f('0xd2')){return _0x17270b[_0xc79f('0x5f')]({'read':!![]});}else{logger[_0xc79f('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc79f('0x26'),_0xc79f('0x8f'),util[_0xc79f('0xd0')](_0x35dfb5['body'],{'showHidden':![],'depth':null}));}break;case _0xc79f('0x92'):if(_0x31f02c=='message-delivered'){return _0x17270b['update']({'read':!![]});}else{logger['error'](_0xc79f('0x20'),_0xc79f('0x26'),_0xc79f('0x92'),util[_0xc79f('0xd0')](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc79f('0x93'):if(_0x31f02c===_0xc79f('0xd3')||_0x31f02c===_0xc79f('0xd4')){return _0x17270b['update']({'read':!![]});}else{logger['error'](_0xc79f('0x20'),_0xc79f('0x26'),_0xc79f('0x93'),util['inspect'](_0x35dfb5[_0xc79f('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x17270b;}})[_0xc79f('0x31')](respondWithResult(_0x1a8cc1,null))[_0xc79f('0x53')](handleError(_0x1a8cc1,null));};exports[_0xc79f('0xd5')]=function(_0x29874d,_0x31b6f3,_0x420ec0){var _0x2b6e5d,_0x1fc8d3,_0x3fd241;return db['SmsAccount'][_0xc79f('0x57')]({'where':{'id':_0x29874d[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x31b6f3,null))[_0xc79f('0x31')](function(_0x3d8158){if(_0x3d8158){_0x3fd241=_0x3d8158;logger['debug'](_0xc79f('0x20'),_0xc79f('0x26'),_0xc79f('0xd6'),_0x3d8158[_0xc79f('0x3b')],util[_0xc79f('0xd0')](_0x29874d['query'],{'showHidden':![],'depth':null}));switch(_0x3d8158[_0xc79f('0x3b')]){case'csc':if(_0x29874d['query'][_0xc79f('0xd7')]&&_0x29874d['query'][_0xc79f('0xd8')]){_0x1fc8d3=_0x29874d[_0xc79f('0x3e')][_0xc79f('0xd8')];return db[_0xc79f('0xa9')]['find']({'where':{'messageId':_0x29874d[_0xc79f('0x3e')][_0xc79f('0xd7')]}});}break;}}})[_0xc79f('0x31')](handleEntityNotFound(_0x31b6f3,null))[_0xc79f('0x31')](function(_0x687094){if(_0x687094){_0x2b6e5d=_0x687094;switch(_0x3fd241['type']){case _0xc79f('0x8c'):if(_0x1fc8d3==='2'||_0x1fc8d3==='6'){return _0x2b6e5d[_0xc79f('0x5f')]({'read':!![]});}else{logger[_0xc79f('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc79f('0x8c'),util[_0xc79f('0xd0')](_0x29874d[_0xc79f('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x2b6e5d;}})[_0xc79f('0x31')](respondWithResult(_0x31b6f3,null))[_0xc79f('0x53')](handleError(_0x31b6f3,null));};exports[_0xc79f('0xd9')]=function(_0x14cd08,_0x37a27a,_0x39f02e){return db[_0xc79f('0x38')][_0xc79f('0x57')]({'where':{'id':_0x14cd08[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x37a27a,null))[_0xc79f('0x31')](function(_0x367cbd){if(_0x367cbd){return _0x367cbd[_0xc79f('0xd9')](_0x14cd08[_0xc79f('0x60')][_0xc79f('0x6b')],_[_0xc79f('0xda')](_0x14cd08[_0xc79f('0x60')],['ids','id'])||{})[_0xc79f('0xa2')](function(_0xa3657f){for(var _0x3733fe=0x0;_0x3733fe<_0x14cd08[_0xc79f('0x60')][_0xc79f('0x6b')][_0xc79f('0x44')];_0x3733fe+=0x1){socket['emit'](_0xc79f('0xdb'),{'UserId':Number(_0x14cd08['body'][_0xc79f('0x6b')][_0x3733fe]),'SmsAccountId':Number(_0x14cd08[_0xc79f('0x55')]['id'])});}return _0xa3657f;});}})[_0xc79f('0x31')](respondWithResult(_0x37a27a,null))['catch'](handleError(_0x37a27a,null));};exports[_0xc79f('0xdc')]=function(_0x37ec06,_0x1dc58f,_0x17d8e0){return db['SmsAccount'][_0xc79f('0x57')]({'where':{'id':_0x37ec06[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x1dc58f,null))[_0xc79f('0x31')](function(_0x30177b){if(_0x30177b){return _0x30177b['removeAgents'](_0x37ec06[_0xc79f('0x3e')][_0xc79f('0x6b')])[_0xc79f('0x31')](function(){if(_['isArray'](_0x37ec06['query'][_0xc79f('0x6b')])){for(var _0x1e82d2=0x0;_0x1e82d2<_0x37ec06[_0xc79f('0x3e')]['ids'][_0xc79f('0x44')];_0x1e82d2+=0x1){socket[_0xc79f('0xdd')](_0xc79f('0xde'),{'UserId':Number(_0x37ec06[_0xc79f('0x3e')]['ids'][_0x1e82d2]),'SmsAccountId':Number(_0x37ec06['params']['id'])});}}else{socket[_0xc79f('0xdd')](_0xc79f('0xde'),{'UserId':Number(_0x37ec06[_0xc79f('0x3e')][_0xc79f('0x6b')]),'SmsAccountId':Number(_0x37ec06[_0xc79f('0x55')]['id'])});}});}})[_0xc79f('0x31')](respondWithStatusCode(_0x1dc58f,null))[_0xc79f('0x53')](handleError(_0x1dc58f,null));};exports['getAgents']=function(_0x48dae5,_0x5f24e3,_0x5d4de0){var _0x9cf771={};var _0x1e3768={};var _0x3c2453;var _0x3b2135;return db['SmsAccount'][_0xc79f('0x69')]({'where':{'id':_0x48dae5[_0xc79f('0x55')]['id']}})[_0xc79f('0x31')](handleEntityNotFound(_0x5f24e3,null))[_0xc79f('0x31')](function(_0x3ad519){if(_0x3ad519){_0x3c2453=_0x3ad519;_0x1e3768[_0xc79f('0x3d')]=_['keys'](db[_0xc79f('0xad')]['rawAttributes']);_0x1e3768[_0xc79f('0x3e')]=_['keys'](_0x48dae5['query']);_0x1e3768[_0xc79f('0x40')]=_[_0xc79f('0x41')](_0x1e3768[_0xc79f('0x3d')],_0x1e3768[_0xc79f('0x3e')]);_0x9cf771['attributes']=_['intersection'](_0x1e3768[_0xc79f('0x3d')],qs[_0xc79f('0x43')](_0x48dae5[_0xc79f('0x3e')]['fields']));_0x9cf771[_0xc79f('0x42')]=_0x9cf771['attributes'][_0xc79f('0x44')]?_0x9cf771['attributes']:_0x1e3768['model'];_0x9cf771['order']=qs['sort'](_0x48dae5[_0xc79f('0x3e')][_0xc79f('0x47')]);_0x9cf771[_0xc79f('0x48')]=qs['filters'](_[_0xc79f('0x49')](_0x48dae5[_0xc79f('0x3e')],_0x1e3768['filters']));if(_0x48dae5[_0xc79f('0x3e')][_0xc79f('0x4a')]){_0x9cf771[_0xc79f('0x48')]=_[_0xc79f('0x4b')](_0x9cf771['where'],{'$or':_['map'](_0x9cf771[_0xc79f('0x42')],function(_0x3d70dc){var _0x550a14={};_0x550a14[_0x3d70dc]={'$like':'%'+_0x48dae5[_0xc79f('0x3e')][_0xc79f('0x4a')]+'%'};return _0x550a14;})});}_0x9cf771=_['merge']({},_0x9cf771,_0x48dae5[_0xc79f('0x4e')]);return _0x3c2453[_0xc79f('0xdf')](_0x9cf771);}})[_0xc79f('0x31')](function(_0x137c29){if(_0x137c29){_0x3b2135=_0x137c29['length'];if(!_0x48dae5[_0xc79f('0x3e')][_0xc79f('0x45')]('nolimit')){_0x9cf771[_0xc79f('0x2a')]=qs[_0xc79f('0x2a')](_0x48dae5['query'][_0xc79f('0x2a')]);_0x9cf771[_0xc79f('0x28')]=qs[_0xc79f('0x28')](_0x48dae5[_0xc79f('0x3e')][_0xc79f('0x28')]);}return _0x3c2453[_0xc79f('0xdf')](_0x9cf771);}})[_0xc79f('0x31')](function(_0x2ca870){if(_0x2ca870){return _0x2ca870?{'count':_0x3b2135,'rows':_0x2ca870}:null;}})[_0xc79f('0x31')](respondWithResult(_0x5f24e3,null))[_0xc79f('0x53')](handleError(_0x5f24e3,null));}; \ No newline at end of file +var _0xf262=['include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','omit','Contacts','contact','SmsInteraction','spread','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','interaction','UserId','User','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','nolimit','getInteractions','Owner','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','options','includeAll'];(function(_0x5cc4bc,_0x38e8d5){var _0x1632eb=function(_0x4cb73a){while(--_0x4cb73a){_0x5cc4bc['push'](_0x5cc4bc['shift']());}};_0x1632eb(++_0x38e8d5);}(_0xf262,0x94));var _0x2f26=function(_0x3b083c,_0x3b7bc3){_0x3b083c=_0x3b083c-0x0;var _0xa438a5=_0xf262[_0x3b083c];return _0xa438a5;};'use strict';var emlformat=require(_0x2f26('0x0'));var rimraf=require(_0x2f26('0x1'));var zipdir=require(_0x2f26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f26('0x3'));var moment=require(_0x2f26('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2f26('0x5'));var util=require('util');var path=require(_0x2f26('0x6'));var sox=require(_0x2f26('0x7'));var csv=require(_0x2f26('0x8'));var ejs=require(_0x2f26('0x9'));var fs=require('fs');var fs_extra=require(_0x2f26('0xa'));var _=require(_0x2f26('0xb'));var squel=require(_0x2f26('0xc'));var crypto=require(_0x2f26('0xd'));var jsforce=require(_0x2f26('0xe'));var deskjs=require(_0x2f26('0xf'));var toCsv=require(_0x2f26('0x8'));var querystring=require(_0x2f26('0x10'));var Papa=require(_0x2f26('0x11'));var Redis=require(_0x2f26('0x12'));var authService=require(_0x2f26('0x13'));var qs=require(_0x2f26('0x14'));var as=require(_0x2f26('0x15'));var hardwareService=require(_0x2f26('0x16'));var logger=require(_0x2f26('0x17'))(_0x2f26('0x18'));var utils=require(_0x2f26('0x19'));var config=require(_0x2f26('0x1a'));var licenseUtil=require(_0x2f26('0x1b'));var db=require(_0x2f26('0x1c'))['db'];config[_0x2f26('0x1d')]=_[_0x2f26('0x1e')](config['redis'],{'host':_0x2f26('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x2f26('0x20')](socket);var jayson=require(_0x2f26('0x21'));var client=jayson[_0x2f26('0x22')][_0x2f26('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x5f3940,_0x36e276,_0x294ead,_0xc3625e){return new BPromise(function(_0x4f2672,_0x290877){var _0x5a9347=_0xc3625e||client;return _0x5a9347['request'](_0x5f3940,_0x294ead)[_0x2f26('0x24')](function(_0x2a428b){logger[_0x2f26('0x25')](_0x2f26('0x26'),_0x36e276,_0x2f26('0x27'));logger[_0x2f26('0x28')](_0x2f26('0x29'),_0x36e276,_0x2f26('0x27'),JSON[_0x2f26('0x2a')](_0x2a428b));if(_0x2a428b[_0x2f26('0x2b')]){if(_0x2a428b[_0x2f26('0x2b')][_0x2f26('0x2c')]===0x1f4){logger[_0x2f26('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x36e276,_0x2a428b[_0x2f26('0x2b')]['message']);return _0x290877(_0x2a428b[_0x2f26('0x2b')][_0x2f26('0x2d')]);}logger[_0x2f26('0x2b')](_0x2f26('0x26'),_0x36e276,_0x2a428b[_0x2f26('0x2b')][_0x2f26('0x2d')]);return _0x4f2672(_0x2a428b[_0x2f26('0x2b')][_0x2f26('0x2d')]);}else{logger[_0x2f26('0x25')](_0x2f26('0x26'),_0x36e276,_0x2f26('0x27'));_0x4f2672(_0x2a428b[_0x2f26('0x2e')][_0x2f26('0x2d')]);}})[_0x2f26('0x2f')](function(_0x4058f3){logger[_0x2f26('0x2b')](_0x2f26('0x26'),_0x36e276,_0x4058f3);_0x290877(_0x4058f3);});});}function respondWithStatusCode(_0x23bf65,_0x211ef6){_0x211ef6=_0x211ef6||0xcc;return function(_0x5c1a0d){if(_0x5c1a0d){return _0x23bf65['sendStatus'](_0x211ef6);}return _0x23bf65[_0x2f26('0x30')](_0x211ef6)[_0x2f26('0x31')]();};}function respondWithResult(_0x58b880,_0x4f5439){_0x4f5439=_0x4f5439||0xc8;return function(_0x416ea1){if(_0x416ea1){return _0x58b880[_0x2f26('0x30')](_0x4f5439)[_0x2f26('0x32')](_0x416ea1);}};}function respondWithFilteredResult(_0x27ce71,_0xee2f4e){return function(_0x41b32c){if(_0x41b32c){var _0x460758=typeof _0xee2f4e[_0x2f26('0x33')]==='undefined'&&typeof _0xee2f4e['limit']===_0x2f26('0x34');var _0x4d49f1=_0x41b32c[_0x2f26('0x35')];var _0x9b63c4=_0x460758?0x0:_0xee2f4e[_0x2f26('0x33')];var _0x1af24f=_0x460758?_0x41b32c[_0x2f26('0x35')]:_0xee2f4e['offset']+_0xee2f4e[_0x2f26('0x36')];var _0x58e112;if(_0x1af24f>=_0x4d49f1){_0x1af24f=_0x4d49f1;_0x58e112=0xc8;}else{_0x58e112=0xce;}_0x27ce71['status'](_0x58e112);return _0x27ce71[_0x2f26('0x37')](_0x2f26('0x38'),_0x9b63c4+'-'+_0x1af24f+'/'+_0x4d49f1)[_0x2f26('0x32')](_0x41b32c);}return null;};}function patchUpdates(_0x36ddfa){return function(_0x257ebf){try{jsonpatch['apply'](_0x257ebf,_0x36ddfa,!![]);}catch(_0x446075){return BPromise[_0x2f26('0x39')](_0x446075);}return _0x257ebf[_0x2f26('0x3a')]();};}function saveUpdates(_0x51637b,_0x1c0bdb){return function(_0x248f48){if(_0x248f48){return _0x248f48[_0x2f26('0x3b')](_0x51637b)[_0x2f26('0x24')](function(_0x56d7f9){return _0x56d7f9;});}return null;};}function removeEntity(_0x2f7c1e,_0x2fcd39){return function(_0x5ddffe){if(_0x5ddffe){return _0x5ddffe[_0x2f26('0x3c')]()[_0x2f26('0x24')](function(){var _0x382018=_0x5ddffe[_0x2f26('0x3d')]({'plain':!![]});var _0x4c4b82=_0x2f26('0x3e');return db[_0x2f26('0x3f')]['destroy']({'where':{'type':_0x4c4b82,'resourceId':_0x382018['id']}})[_0x2f26('0x24')](function(){return _0x5ddffe;});})[_0x2f26('0x24')](function(){_0x2f7c1e[_0x2f26('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d9c1,_0x198f60){return function(_0x1d78e2){if(!_0x1d78e2){_0x28d9c1[_0x2f26('0x40')](0x194);}return _0x1d78e2;};}function handleError(_0x47509f,_0x33072c){_0x33072c=_0x33072c||0x1f4;return function(_0x5d1d45){logger[_0x2f26('0x2b')](_0x5d1d45[_0x2f26('0x41')]);if(_0x5d1d45[_0x2f26('0x42')]){delete _0x5d1d45[_0x2f26('0x42')];}_0x47509f[_0x2f26('0x30')](_0x33072c)[_0x2f26('0x43')](_0x5d1d45);};}exports[_0x2f26('0x44')]=function(_0x17d5b5,_0x3b8e06){var _0x2789d7={'include':[{'model':db[_0x2f26('0x45')],'as':_0x2f26('0x46')}]},_0x5a5101={},_0x218eb9={'count':0x0,'rows':[]};var _0x2547d6=_[_0x2f26('0x47')](db[_0x2f26('0x48')][_0x2f26('0x49')],function(_0x598f4e){return{'name':_0x598f4e['fieldName'],'type':_0x598f4e['type'][_0x2f26('0x4a')]};});_0x5a5101['model']=_[_0x2f26('0x47')](_0x2547d6,'name');_0x5a5101['query']=_[_0x2f26('0x4b')](_0x17d5b5[_0x2f26('0x4c')]);_0x5a5101[_0x2f26('0x4d')]=_['intersection'](_0x5a5101['model'],_0x5a5101[_0x2f26('0x4c')]);_0x2789d7[_0x2f26('0x4e')]=_[_0x2f26('0x4f')](_0x5a5101[_0x2f26('0x50')],qs[_0x2f26('0x51')](_0x17d5b5[_0x2f26('0x4c')][_0x2f26('0x51')]));_0x2789d7['attributes']=_0x2789d7[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x2789d7[_0x2f26('0x4e')]:_0x5a5101[_0x2f26('0x50')];if(!_0x17d5b5[_0x2f26('0x4c')][_0x2f26('0x53')]('nolimit')){_0x2789d7[_0x2f26('0x36')]=qs[_0x2f26('0x36')](_0x17d5b5['query'][_0x2f26('0x36')]);_0x2789d7['offset']=qs[_0x2f26('0x33')](_0x17d5b5[_0x2f26('0x4c')][_0x2f26('0x33')]);}_0x2789d7[_0x2f26('0x54')]=qs[_0x2f26('0x55')](_0x17d5b5[_0x2f26('0x4c')][_0x2f26('0x55')]);_0x2789d7[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x17d5b5[_0x2f26('0x4c')],_0x5a5101[_0x2f26('0x4d')]),_0x2547d6);if(_0x17d5b5['query']['filter']){_0x2789d7[_0x2f26('0x56')]=_[_0x2f26('0x58')](_0x2789d7[_0x2f26('0x56')],{'$or':_[_0x2f26('0x47')](_0x2547d6,function(_0x4e93fe){if(_0x4e93fe[_0x2f26('0x59')]!=='VIRTUAL'){var _0x82c234={};_0x82c234[_0x4e93fe[_0x2f26('0x42')]]={'$like':'%'+_0x17d5b5['query']['filter']+'%'};return _0x82c234;}})});}_0x2789d7=_['merge']({},_0x2789d7,_0x17d5b5[_0x2f26('0x5a')]);var _0x14762b={'where':_0x2789d7[_0x2f26('0x56')]};return db['SmsAccount'][_0x2f26('0x35')](_0x14762b)[_0x2f26('0x24')](function(_0xc79ac4){_0x218eb9[_0x2f26('0x35')]=_0xc79ac4;if(_0x17d5b5[_0x2f26('0x4c')][_0x2f26('0x5b')]){_0x2789d7[_0x2f26('0x5c')]=[{'all':!![]}];}return db[_0x2f26('0x48')][_0x2f26('0x5d')](_0x2789d7);})[_0x2f26('0x24')](function(_0x5f448b){_0x218eb9[_0x2f26('0x5e')]=_0x5f448b;return _0x218eb9;})[_0x2f26('0x24')](respondWithFilteredResult(_0x3b8e06,_0x2789d7))[_0x2f26('0x2f')](handleError(_0x3b8e06,null));};exports['show']=function(_0x7ebcad,_0xeeefe6){var _0x55137f={'raw':![],'where':{'id':_0x7ebcad[_0x2f26('0x5f')]['id']},'include':[{'model':db[_0x2f26('0x45')],'as':'mandatoryDispositionPause'}]},_0x16af77={};_0x16af77[_0x2f26('0x50')]=_['keys'](db[_0x2f26('0x48')][_0x2f26('0x49')]);_0x16af77[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x7ebcad[_0x2f26('0x4c')]);_0x16af77['filters']=_['intersection'](_0x16af77[_0x2f26('0x50')],_0x16af77[_0x2f26('0x4c')]);_0x55137f['attributes']=_[_0x2f26('0x4f')](_0x16af77[_0x2f26('0x50')],qs[_0x2f26('0x51')](_0x7ebcad[_0x2f26('0x4c')][_0x2f26('0x51')]));_0x55137f['attributes']=_0x55137f['attributes']['length']?_0x55137f[_0x2f26('0x4e')]:_0x16af77[_0x2f26('0x50')];if(_0x7ebcad['query']['includeAll']){_0x55137f[_0x2f26('0x5c')]=[{'all':!![]}];}_0x55137f=_[_0x2f26('0x58')]({},_0x55137f,_0x7ebcad[_0x2f26('0x5a')]);return db['SmsAccount'][_0x2f26('0x60')](_0x55137f)['then'](handleEntityNotFound(_0xeeefe6,null))['then'](respondWithResult(_0xeeefe6,null))[_0x2f26('0x2f')](handleError(_0xeeefe6,null));};exports[_0x2f26('0x61')]=function(_0x5e5e03,_0x5688ae){return db[_0x2f26('0x48')][_0x2f26('0x61')](_0x5e5e03[_0x2f26('0x62')],{})[_0x2f26('0x24')](function(_0xc974){var _0x23110f=_0x5e5e03[_0x2f26('0x63')][_0x2f26('0x3d')]({'plain':!![]});if(!_0x23110f)throw new Error(_0x2f26('0x64'));if(_0x23110f[_0x2f26('0x65')]===_0x2f26('0x63')){var _0x28d53d=_0xc974[_0x2f26('0x3d')]({'plain':!![]});var _0x3e714f='SmsAccounts';return db[_0x2f26('0x66')][_0x2f26('0x60')]({'where':{'name':_0x3e714f,'userProfileId':_0x23110f[_0x2f26('0x67')]},'raw':!![]})[_0x2f26('0x24')](function(_0x5715ca){if(_0x5715ca&&_0x5715ca[_0x2f26('0x68')]===0x0){return db[_0x2f26('0x3f')][_0x2f26('0x61')]({'name':_0x28d53d['name'],'resourceId':_0x28d53d['id'],'type':_0x5715ca[_0x2f26('0x42')],'sectionId':_0x5715ca['id']},{})[_0x2f26('0x24')](function(){return _0xc974;});}else{return _0xc974;}})[_0x2f26('0x2f')](function(_0x3b692b){logger[_0x2f26('0x2b')](_0x2f26('0x69'),_0x3b692b);throw _0x3b692b;});}return _0xc974;})[_0x2f26('0x24')](respondWithResult(_0x5688ae,0xc9))[_0x2f26('0x2f')](handleError(_0x5688ae,null));};exports[_0x2f26('0x3b')]=function(_0xd4bcf1,_0x337272){if(_0xd4bcf1[_0x2f26('0x62')]['id']){delete _0xd4bcf1[_0x2f26('0x62')]['id'];}return db[_0x2f26('0x48')]['find']({'where':{'id':_0xd4bcf1['params']['id']},'include':[{'model':db[_0x2f26('0x45')],'as':_0x2f26('0x46')}]})[_0x2f26('0x24')](handleEntityNotFound(_0x337272,null))['then'](saveUpdates(_0xd4bcf1[_0x2f26('0x62')],null))[_0x2f26('0x24')](respondWithResult(_0x337272,null))[_0x2f26('0x2f')](handleError(_0x337272,null));};exports[_0x2f26('0x3c')]=function(_0x5a8422,_0x1316f3){return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x5a8422[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x1316f3,null))[_0x2f26('0x24')](removeEntity(_0x1316f3,null))['catch'](handleError(_0x1316f3,null));};exports[_0x2f26('0x6a')]=function(_0x5cb77a,_0x9cb867){return db[_0x2f26('0x48')][_0x2f26('0x6a')]()[_0x2f26('0x24')](respondWithResult(_0x9cb867,null))[_0x2f26('0x2f')](handleError(_0x9cb867,null));};exports[_0x2f26('0x6b')]=function(_0x1a5203,_0x27828c,_0x193c7d){if(_0x1a5203[_0x2f26('0x62')]['id']){delete _0x1a5203[_0x2f26('0x62')]['id'];}return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x1a5203[_0x2f26('0x5f')]['id']}})['then'](handleEntityNotFound(_0x27828c,null))[_0x2f26('0x24')](function(_0x2fa048){if(_0x2fa048){_0x1a5203[_0x2f26('0x62')][_0x2f26('0x6c')]=_0x2fa048['id'];return db[_0x2f26('0x6d')][_0x2f26('0x61')](_0x1a5203[_0x2f26('0x62')]);}})[_0x2f26('0x24')](respondWithResult(_0x27828c,null))[_0x2f26('0x2f')](handleError(_0x27828c,null));};exports[_0x2f26('0x6e')]=function(_0x57c11c,_0x552f9f,_0xe9ce3f){var _0x2b0c0f={'raw':![],'where':{}};var _0x580ea0={};var _0x134840={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2f26('0x6f')]({'where':{'id':_0x57c11c[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x552f9f,null))['then'](function(_0x316035){if(_0x316035){_0x580ea0[_0x2f26('0x50')]=_[_0x2f26('0x4b')](db[_0x2f26('0x6d')]['rawAttributes']);_0x580ea0[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x57c11c[_0x2f26('0x4c')]);_0x580ea0[_0x2f26('0x4d')]=_['intersection'](_0x580ea0[_0x2f26('0x50')],_0x580ea0['query']);_0x2b0c0f[_0x2f26('0x4e')]=_[_0x2f26('0x4f')](_0x580ea0[_0x2f26('0x50')],qs['fields'](_0x57c11c[_0x2f26('0x4c')][_0x2f26('0x51')]));_0x2b0c0f[_0x2f26('0x4e')]=_0x2b0c0f[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x2b0c0f[_0x2f26('0x4e')]:_0x580ea0[_0x2f26('0x50')];if(!_0x57c11c[_0x2f26('0x4c')][_0x2f26('0x53')]('nolimit')){_0x2b0c0f[_0x2f26('0x36')]=qs[_0x2f26('0x36')](_0x57c11c['query'][_0x2f26('0x36')]);_0x2b0c0f[_0x2f26('0x33')]=qs[_0x2f26('0x33')](_0x57c11c[_0x2f26('0x4c')]['offset']);}_0x2b0c0f['order']=qs[_0x2f26('0x55')](_0x57c11c[_0x2f26('0x4c')][_0x2f26('0x55')]);_0x2b0c0f[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x57c11c[_0x2f26('0x4c')],_0x580ea0[_0x2f26('0x4d')]));_0x2b0c0f[_0x2f26('0x56')][_0x2f26('0x6c')]=_0x316035['id'];if(_0x57c11c[_0x2f26('0x4c')][_0x2f26('0x70')]){_0x2b0c0f['where']=_[_0x2f26('0x58')](_0x2b0c0f[_0x2f26('0x56')],{'$or':_[_0x2f26('0x47')](_0x2b0c0f[_0x2f26('0x4e')],function(_0x470ab6){var _0x1fa636={};_0x1fa636[_0x470ab6]={'$like':'%'+_0x57c11c[_0x2f26('0x4c')][_0x2f26('0x70')]+'%'};return _0x1fa636;})});}_0x2b0c0f=_['merge']({},_0x2b0c0f,_0x57c11c[_0x2f26('0x5a')]);return db['Disposition'][_0x2f26('0x35')]({'where':_0x2b0c0f[_0x2f26('0x56')]})[_0x2f26('0x24')](function(_0x1de65f){_0x134840[_0x2f26('0x35')]=_0x1de65f;if(_0x57c11c['query']['includeAll']){_0x2b0c0f['include']=[{'all':!![]}];}return db['Disposition'][_0x2f26('0x5d')](_0x2b0c0f);})[_0x2f26('0x24')](function(_0x362494){_0x134840[_0x2f26('0x5e')]=_0x362494;return _0x134840;});}})[_0x2f26('0x24')](respondWithFilteredResult(_0x552f9f,_0x2b0c0f))[_0x2f26('0x2f')](handleError(_0x552f9f,null));};exports['removeDispositions']=function(_0x100eba,_0x33e23a,_0x473ea5){return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x100eba[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x33e23a,null))[_0x2f26('0x24')](function(_0x3a284e){if(_0x3a284e){return _0x3a284e[_0x2f26('0x71')](_0x100eba[_0x2f26('0x4c')][_0x2f26('0x72')]);}})[_0x2f26('0x24')](respondWithStatusCode(_0x33e23a,null))[_0x2f26('0x2f')](handleError(_0x33e23a,null));};exports[_0x2f26('0x73')]=function(_0x324034,_0xddd938,_0x3bae82){if(_0x324034[_0x2f26('0x62')]['id']){delete _0x324034[_0x2f26('0x62')]['id'];}return db[_0x2f26('0x48')]['find']({'where':{'id':_0x324034[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0xddd938,null))[_0x2f26('0x24')](function(_0x33362c){if(_0x33362c){_0x324034[_0x2f26('0x62')][_0x2f26('0x6c')]=_0x33362c['id'];return db[_0x2f26('0x74')][_0x2f26('0x61')](_0x324034['body']);}})[_0x2f26('0x24')](respondWithResult(_0xddd938,null))[_0x2f26('0x2f')](handleError(_0xddd938,null));};exports[_0x2f26('0x75')]=function(_0x12bf9a,_0x659f68,_0x2f847c){var _0x629412={'raw':![],'where':{}};var _0x5a9fa4={};var _0x180cef={'count':0x0,'rows':[]};return db[_0x2f26('0x48')][_0x2f26('0x6f')]({'where':{'id':_0x12bf9a[_0x2f26('0x5f')]['id']}})['then'](handleEntityNotFound(_0x659f68,null))[_0x2f26('0x24')](function(_0x49ff54){if(_0x49ff54){_0x5a9fa4[_0x2f26('0x50')]=_[_0x2f26('0x4b')](db['CannedAnswer']['rawAttributes']);_0x5a9fa4[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x12bf9a[_0x2f26('0x4c')]);_0x5a9fa4[_0x2f26('0x4d')]=_[_0x2f26('0x4f')](_0x5a9fa4[_0x2f26('0x50')],_0x5a9fa4[_0x2f26('0x4c')]);_0x629412[_0x2f26('0x4e')]=_['intersection'](_0x5a9fa4['model'],qs[_0x2f26('0x51')](_0x12bf9a[_0x2f26('0x4c')]['fields']));_0x629412[_0x2f26('0x4e')]=_0x629412[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x629412['attributes']:_0x5a9fa4[_0x2f26('0x50')];if(!_0x12bf9a['query'][_0x2f26('0x53')]('nolimit')){_0x629412[_0x2f26('0x36')]=qs[_0x2f26('0x36')](_0x12bf9a[_0x2f26('0x4c')][_0x2f26('0x36')]);_0x629412[_0x2f26('0x33')]=qs[_0x2f26('0x33')](_0x12bf9a['query'][_0x2f26('0x33')]);}_0x629412[_0x2f26('0x54')]=qs[_0x2f26('0x55')](_0x12bf9a[_0x2f26('0x4c')][_0x2f26('0x55')]);_0x629412[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x12bf9a[_0x2f26('0x4c')],_0x5a9fa4[_0x2f26('0x4d')]));_0x629412[_0x2f26('0x56')][_0x2f26('0x6c')]=_0x49ff54['id'];if(_0x12bf9a['query'][_0x2f26('0x70')]){_0x629412[_0x2f26('0x56')]=_[_0x2f26('0x58')](_0x629412[_0x2f26('0x56')],{'$or':_['map'](_0x629412[_0x2f26('0x4e')],function(_0x10d2f9){var _0x3c7ae0={};_0x3c7ae0[_0x10d2f9]={'$like':'%'+_0x12bf9a[_0x2f26('0x4c')]['filter']+'%'};return _0x3c7ae0;})});}_0x629412=_[_0x2f26('0x58')]({},_0x629412,_0x12bf9a[_0x2f26('0x5a')]);return db[_0x2f26('0x74')]['count']({'where':_0x629412[_0x2f26('0x56')]})[_0x2f26('0x24')](function(_0x2b3035){_0x180cef[_0x2f26('0x35')]=_0x2b3035;if(_0x12bf9a[_0x2f26('0x4c')][_0x2f26('0x5b')]){_0x629412[_0x2f26('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2f26('0x5d')](_0x629412);})[_0x2f26('0x24')](function(_0x4b7e05){_0x180cef[_0x2f26('0x5e')]=_0x4b7e05;return _0x180cef;});}})[_0x2f26('0x24')](respondWithFilteredResult(_0x659f68,_0x629412))[_0x2f26('0x2f')](handleError(_0x659f68,null));};exports['removeAnswers']=function(_0x1775f4,_0x1c35e0,_0x403431){return db['SmsAccount']['find']({'where':{'id':_0x1775f4[_0x2f26('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1c35e0,null))[_0x2f26('0x24')](function(_0x86aadb){if(_0x86aadb){return _0x86aadb[_0x2f26('0x76')](_0x1775f4[_0x2f26('0x4c')][_0x2f26('0x72')]);}})['then'](respondWithStatusCode(_0x1c35e0,null))['catch'](handleError(_0x1c35e0,null));};exports[_0x2f26('0x77')]=function(_0x8368c9,_0x4e3bf6,_0x536ada){var _0x17e728={'channel':_0x2f26('0x78')};var _0x726b5c=[];var _0x28ddf9=[];var _0x505ac7={};return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x8368c9[_0x2f26('0x5f')]['id']},'include':[{'model':db[_0x2f26('0x79')],'as':_0x2f26('0x7a')}]})[_0x2f26('0x24')](handleEntityNotFound(_0x4e3bf6,null))[_0x2f26('0x24')](function(_0x4bc10b){_0x17e728[_0x2f26('0x7b')]=_0x4bc10b;_0x17e728[_0x2f26('0x7c')]=_[_0x2f26('0x7d')](_0x4bc10b[_0x2f26('0x7a')],[_0x2f26('0x7e')],[_0x2f26('0x7f')]);if(_0x17e728['account'][_0x2f26('0x7a')]){delete _0x17e728['account'][_0x2f26('0x7a')];}return db[_0x2f26('0x80')]['describe']();})[_0x2f26('0x24')](function(_0x485542){if(!_0x485542){throw new db[(_0x2f26('0x81'))][(_0x2f26('0x82'))]('no\x20available\x20attributes');}_0x726b5c=_[_0x2f26('0x83')](_[_0x2f26('0x4b')](_0x485542),[_0x2f26('0x84'),_0x2f26('0x85')]);_0x28ddf9=_[_0x2f26('0x83')](_[_0x2f26('0x4b')](_0x485542),[_0x2f26('0x84'),_0x2f26('0x85'),_0x2f26('0x86'),_0x2f26('0x87')]);_0x17e728['body']={'mapKey':_0x2f26('0x88')};if(_0x17e728[_0x2f26('0x7b')][_0x2f26('0x59')]){switch(_0x17e728[_0x2f26('0x7b')][_0x2f26('0x59')]){case'twilio':_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9['body'][_0x2f26('0x8a')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x8b')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x8c')]=_0x8368c9[_0x2f26('0x62')]['MessageSid'];break;case'skebby':_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]='+'+_0x8368c9[_0x2f26('0x62')][_0x2f26('0x8d')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x8e')];break;case _0x2f26('0x8f'):_0x17e728['body'][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x89')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x2d')];break;case _0x2f26('0x90'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')]['from'];_0x17e728[_0x2f26('0x62')]['body']=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x62')];_0x17e728['body'][_0x2f26('0x8c')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x91')];break;case'plivo':_0x17e728['body'][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')]['From'];_0x17e728[_0x2f26('0x62')]['body']=_0x8368c9['body'][_0x2f26('0x92')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x8c')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x93')];break;case _0x2f26('0x94'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]='+'+_0x8368c9[_0x2f26('0x62')]['results'][0x0][_0x2f26('0x89')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')]['results'][0x0]['text'];_0x17e728['body'][_0x2f26('0x8c')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x95')][0x0][_0x2f26('0x8c')];break;case _0x2f26('0x96'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x97')];_0x17e728[_0x2f26('0x62')]['body']=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x98')][_0x2f26('0x2d')];break;case _0x2f26('0x99'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9['body']['fromNumber'];_0x17e728['body'][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')]['text'];_0x17e728[_0x2f26('0x62')][_0x2f26('0x8c')]=_0x8368c9['body']['replyMessageId'];break;case _0x2f26('0x9a'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x8c')]=_0x8368c9[_0x2f26('0x62')][0x0][_0x2f26('0x2d')]['id'];_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')][0x0][_0x2f26('0x2d')][_0x2f26('0x89')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')][0x0][_0x2f26('0x2d')][_0x2f26('0x8e')];break;case _0x2f26('0x9b'):_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x89')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]=_0x8368c9[_0x2f26('0x62')][_0x2f26('0x2d')];_0x17e728[_0x2f26('0x62')][_0x2f26('0x8c')]=_0x8368c9['body']['refid'];break;}}if(_0x17e728[_0x2f26('0x62')]['id']){delete _0x17e728[_0x2f26('0x62')]['id'];}if(_[_0x2f26('0x9c')](_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')])){throw new db[(_0x2f26('0x81'))]['ValidationError'](_0x2f26('0x9d'));}if(_['isNil'](_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')])||_0x17e728[_0x2f26('0x62')][_0x2f26('0x62')]===''){throw new db[(_0x2f26('0x81'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f26('0x9c')](_0x17e728['body']['mapKey'])){throw new db[(_0x2f26('0x81'))]['ValidationError'](_0x2f26('0x9e')+_0x28ddf9);}if(!_[_0x2f26('0x9f')](_0x28ddf9,_0x17e728[_0x2f26('0x62')][_0x2f26('0xa0')])){throw new db[(_0x2f26('0x81'))]['ValidationError'](_0x2f26('0xa1')+_0x28ddf9);}_0x505ac7[_0x17e728[_0x2f26('0x62')][_0x2f26('0xa0')]]=_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')];return db[_0x2f26('0xa2')][_0x2f26('0x60')]({'where':{'id':_0x17e728[_0x2f26('0x7b')][_0x2f26('0x87')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x505ac7,'limit':0x1,'order':[[_0x2f26('0x85'),_0x2f26('0xa3')]]}]});})[_0x2f26('0x24')](handleEntityNotFound(_0x4e3bf6,null))['then'](function(_0x33bfa3){if(_0x33bfa3){_0x17e728['list']=_[_0x2f26('0xa4')](_0x33bfa3,['Contacts']);if(_0x33bfa3[_0x2f26('0xa5')][_0x2f26('0x52')]){return _0x33bfa3[_0x2f26('0xa5')][0x0];}var _0x522476=_[_0x2f26('0x1e')](_0x17e728['body'],{'firstName':_0x17e728[_0x2f26('0x62')]['from'],'ListId':_0x33bfa3['id']});_0x522476[_0x17e728[_0x2f26('0x62')][_0x2f26('0xa0')]]=_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')];return db['CmContact']['create'](_0x522476,{'fields':_0x726b5c,'raw':!![]});}})[_0x2f26('0x24')](handleEntityNotFound(_0x4e3bf6,null))[_0x2f26('0x24')](function(_0x3c9aa4){if(_0x3c9aa4){_0x17e728[_0x2f26('0xa6')]=_0x3c9aa4;var _0x3e46cd={'ContactId':_0x3c9aa4['id'],'phone':_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')],'SmsAccountId':_0x8368c9['params']['id']};var _0x4d14ec={'ContactId':_0x3c9aa4['id'],'SmsAccountId':_0x8368c9['params']['id'],'closed':![]};return db[_0x2f26('0xa7')][_0x2f26('0x60')]({'where':_0x4d14ec})[_0x2f26('0x24')](function(_0x9a5fd2){if(_0x9a5fd2){return[_0x9a5fd2,![]];}return db[_0x2f26('0xa7')][_0x2f26('0x61')](_0x3e46cd)['then'](function(_0x40d594){return[_0x40d594,!![]];});});}})[_0x2f26('0xa8')](function(_0x29d0d4,_0x293156){_0x17e728['interaction']=_0x29d0d4[_0x2f26('0x3d')]({'plain':!![]});_0x17e728['interaction'][_0x2f26('0xa9')]=![];if(_0x293156){if(_0x17e728[_0x2f26('0x7b')]['autoclose']){_0x17e728['applications'][_0x2f26('0xaa')]({'id':0x0,'priority':_0x17e728[_0x2f26('0x7c')][_0x2f26('0x52')]+0x1,'app':_0x2f26('0xab'),'appdata':_0x2f26('0xac'),'interval':_0x2f26('0xad')});}_0x17e728['interaction'][_0x2f26('0xa9')]=!![];}return db['SmsMessage'][_0x2f26('0x61')]({'phone':_0x17e728[_0x2f26('0x62')][_0x2f26('0x89')],'messageId':_0x17e728[_0x2f26('0x62')]['messageId'],'body':_0x17e728['body']['body'],'SmsAccountId':_0x8368c9[_0x2f26('0x5f')]['id'],'SmsInteractionId':_0x29d0d4['id'],'direction':'in','ContactId':_0x29d0d4[_0x2f26('0xae')],'AttachmentId':_0x17e728[_0x2f26('0x62')][_0x2f26('0xaf')]});})[_0x2f26('0x24')](function(_0xd2f45a){_0x17e728[_0x2f26('0x2d')]=_0xd2f45a;if(!_0x17e728[_0x2f26('0xb0')][_0x2f26('0xb1')])return;return db[_0x2f26('0xb2')][_0x2f26('0x60')]({'attributes':['id',_0x2f26('0x42')],'where':{'id':_0x17e728[_0x2f26('0xb0')][_0x2f26('0xb1')]}});})[_0x2f26('0x24')](function(_0xd73302){if(_0xd73302){_0x17e728['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2f26('0xb3'),'appdata':_0xd73302['name']+','+(_0x17e728[_0x2f26('0x7b')][_0x2f26('0xb4')]||0xa),'interval':_0x2f26('0xad')});}if(!_0x17e728[_0x2f26('0xb0')][_0x2f26('0xb5')])return;return db['SmsQueue']['find']({'attributes':['id',_0x2f26('0x42')],'where':{'id':_0x17e728['interaction']['queueId']}});})['then'](function(_0x1fd899){if(_0x1fd899){_0x17e728[_0x2f26('0x7c')][_0x2f26('0xb6')]({'id':0x0,'priority':0x1,'app':_0x2f26('0xb7'),'appdata':_0x1fd899[_0x2f26('0x42')]+','+(_0x17e728[_0x2f26('0x7b')][_0x2f26('0xb8')]||0x12c),'interval':_0x2f26('0xad')});}return respondWithRpcPromise(_0x2f26('0xb9'),_0x2f26('0xba'),_0x17e728);})[_0x2f26('0x24')](function(_0x3cf474){if(_0x3cf474){var _0x332926=0xc8;var _0x3ebab5=_0x2f26('0xbb');logger[_0x2f26('0x25')](_0x2f26('0x29'),_0x3ebab5,_0x332926,'entity\x20found');logger[_0x2f26('0x28')](_0x2f26('0xbc'),_0x3ebab5,_0x332926,_0x2f26('0xbd'),JSON['stringify'](_0x3cf474));if(_0x17e728[_0x2f26('0x7b')][_0x2f26('0x59')]===_0x2f26('0xbe')){return _0x4e3bf6[_0x2f26('0x30')](_0x332926)[_0x2f26('0x37')](_0x2f26('0xbf'),_0x2f26('0xc0'))[_0x2f26('0x43')](_0x2f26('0xc1'));}else{return _0x4e3bf6['status'](_0x332926)['json'](_0x3cf474);}}})[_0x2f26('0x2f')](handleError(_0x4e3bf6,null));};exports[_0x2f26('0xc2')]=function(_0x50a6b8,_0x1dddab){var _0x18a79b=_0x50a6b8[_0x2f26('0x5f')]['id'];var _0x3ad29c=_0x50a6b8['body'];var _0x432171=0xc8;var _0x525764=null;return db['sequelize'][_0x2f26('0xc3')]({'isolationLevel':db[_0x2f26('0xc4')][_0x2f26('0xc5')][_0x2f26('0xc6')]['READ_COMMITTED']},function(_0x3a6b01){return db[_0x2f26('0x48')][_0x2f26('0x6f')]({'where':{'id':_0x18a79b},'transaction':_0x3a6b01})[_0x2f26('0x24')](function(_0x52106a){if(_0x52106a){return db['SmsApplication'][_0x2f26('0x3c')]({'where':{'SmsAccountId':_0x18a79b},'transaction':_0x3a6b01})[_0x2f26('0x24')](function(){var _0x36062a=_['map'](_0x3ad29c,function(_0x2fdbc4){_0x2fdbc4[_0x2f26('0x6c')]=_0x18a79b;return _0x2fdbc4;});return db[_0x2f26('0x79')][_0x2f26('0xc7')](_0x36062a,{'transaction':_0x3a6b01});});}else{_0x432171=0x194;_0x525764=[];}});})[_0x2f26('0x24')](function(){if(_0x432171!==0x194){return db[_0x2f26('0x79')][_0x2f26('0xc8')]({'where':{'SmsAccountId':_0x18a79b},'order':_0x2f26('0x7e')})[_0x2f26('0x24')](function(_0x4fabac){_0x525764=_0x4fabac;});}})[_0x2f26('0x2f')](function(_0x146e4c){_0x432171=0x1f4;logger[_0x2f26('0x2b')](_0x146e4c['stack']);if(_0x146e4c['name']){delete _0x146e4c['name'];}_0x525764=_0x146e4c;})[_0x2f26('0xc9')](function(){if(_0x525764===null){_0x1dddab['sendStatus'](_0x432171);}else{if(_0x432171===0x1f4){_0x1dddab[_0x2f26('0x30')](_0x432171)[_0x2f26('0x43')](_0x525764);}else{_0x1dddab[_0x2f26('0x30')](_0x432171)[_0x2f26('0x32')](_0x525764);}}});};exports[_0x2f26('0xca')]=function(_0x2f00e0,_0x1277d1,_0x5933eb){var _0x177ffa={};var _0x45f38b={};var _0x4d2786;var _0x1a2b77;return db['SmsAccount'][_0x2f26('0x6f')]({'where':{'id':_0x2f00e0[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x1277d1,null))[_0x2f26('0x24')](function(_0x9fd2e6){if(_0x9fd2e6){_0x4d2786=_0x9fd2e6;_0x45f38b[_0x2f26('0x50')]=_[_0x2f26('0x4b')](db[_0x2f26('0x79')][_0x2f26('0x49')]);_0x45f38b[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x2f00e0[_0x2f26('0x4c')]);_0x45f38b[_0x2f26('0x4d')]=_[_0x2f26('0x4f')](_0x45f38b['model'],_0x45f38b['query']);_0x177ffa['attributes']=_['intersection'](_0x45f38b[_0x2f26('0x50')],qs[_0x2f26('0x51')](_0x2f00e0['query'][_0x2f26('0x51')]));_0x177ffa['attributes']=_0x177ffa[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x177ffa['attributes']:_0x45f38b['model'];_0x177ffa['order']=qs['sort'](_0x2f00e0['query'][_0x2f26('0x55')]);_0x177ffa[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x2f00e0[_0x2f26('0x4c')],_0x45f38b[_0x2f26('0x4d')]));if(_0x2f00e0[_0x2f26('0x4c')][_0x2f26('0x70')]){_0x177ffa['where']=_['merge'](_0x177ffa[_0x2f26('0x56')],{'$or':_[_0x2f26('0x47')](_0x177ffa['attributes'],function(_0xb60435){var _0x4688b0={};_0x4688b0[_0xb60435]={'$like':'%'+_0x2f00e0[_0x2f26('0x4c')][_0x2f26('0x70')]+'%'};return _0x4688b0;})});}_0x177ffa=_[_0x2f26('0x58')]({},_0x177ffa,_0x2f00e0[_0x2f26('0x5a')]);return _0x4d2786[_0x2f26('0xca')](_0x177ffa);}})[_0x2f26('0x24')](function(_0x590721){if(_0x590721){_0x1a2b77=_0x590721[_0x2f26('0x52')];if(!_0x2f00e0[_0x2f26('0x4c')][_0x2f26('0x53')](_0x2f26('0xcb'))){_0x177ffa[_0x2f26('0x36')]=qs[_0x2f26('0x36')](_0x2f00e0['query'][_0x2f26('0x36')]);_0x177ffa[_0x2f26('0x33')]=qs['offset'](_0x2f00e0[_0x2f26('0x4c')][_0x2f26('0x33')]);}return _0x4d2786[_0x2f26('0xca')](_0x177ffa);}})['then'](function(_0x33fb2e){if(_0x33fb2e){return _0x33fb2e?{'count':_0x1a2b77,'rows':_0x33fb2e}:null;}})[_0x2f26('0x24')](respondWithResult(_0x1277d1,null))['catch'](handleError(_0x1277d1,null));};exports[_0x2f26('0xcc')]=function(_0x166d83,_0x7f9e9b,_0x14456e){var _0x40c1c7={'raw':![],'where':{}};var _0x57786f={};var _0xd87abe={'count':0x0,'rows':[]};return db[_0x2f26('0x48')]['findOne']({'where':{'id':_0x166d83[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x7f9e9b,null))[_0x2f26('0x24')](function(_0x247b93){if(_0x247b93){_0x57786f['model']=_[_0x2f26('0x4b')](db[_0x2f26('0xa7')][_0x2f26('0x49')]);_0x57786f[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x166d83['query']);_0x57786f['filters']=_['intersection'](_0x57786f[_0x2f26('0x50')],_0x57786f[_0x2f26('0x4c')]);_0x40c1c7[_0x2f26('0x4e')]=_[_0x2f26('0x4f')](_0x57786f[_0x2f26('0x50')],qs[_0x2f26('0x51')](_0x166d83[_0x2f26('0x4c')]['fields']));_0x40c1c7['attributes']=_0x40c1c7[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x40c1c7[_0x2f26('0x4e')]:_0x57786f[_0x2f26('0x50')];if(!_0x166d83[_0x2f26('0x4c')][_0x2f26('0x53')](_0x2f26('0xcb'))){_0x40c1c7[_0x2f26('0x36')]=qs['limit'](_0x166d83[_0x2f26('0x4c')][_0x2f26('0x36')]);_0x40c1c7['offset']=qs['offset'](_0x166d83[_0x2f26('0x4c')][_0x2f26('0x33')]);}_0x40c1c7[_0x2f26('0x54')]=qs[_0x2f26('0x55')](_0x166d83[_0x2f26('0x4c')][_0x2f26('0x55')]);_0x40c1c7[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x166d83[_0x2f26('0x4c')],_0x57786f['filters']));_0x40c1c7['where'][_0x2f26('0x6c')]=_0x247b93['id'];if(_0x166d83['query']['filter']){_0x40c1c7[_0x2f26('0x56')]=_[_0x2f26('0x58')](_0x40c1c7[_0x2f26('0x56')],{'$or':_[_0x2f26('0x47')](_0x40c1c7[_0x2f26('0x4e')],function(_0x172915){var _0x228e67={};_0x228e67[_0x172915]={'$like':'%'+_0x166d83['query']['filter']+'%'};return _0x228e67;})});}_0x40c1c7=_[_0x2f26('0x58')]({},_0x40c1c7,_0x166d83['options']);return db[_0x2f26('0xa7')][_0x2f26('0x35')]({'where':_0x40c1c7[_0x2f26('0x56')]})[_0x2f26('0x24')](function(_0x4b5c03){_0xd87abe['count']=_0x4b5c03;if(_0x166d83['query'][_0x2f26('0x5b')]){_0x40c1c7[_0x2f26('0x5c')]=[{'model':db[_0x2f26('0x80')],'as':'Contact','required':![]},{'model':db[_0x2f26('0xb2')],'as':_0x2f26('0xcd'),'attributes':[_0x2f26('0x42'),'fullname',_0x2f26('0xce')],'required':![]},{'model':db[_0x2f26('0xcf')],'as':_0x2f26('0xd0'),'attributes':['id','name','color'],'where':_0x166d83['query']['tag']?{'id':_0x166d83['query'][_0x2f26('0xd1')]}:undefined,'required':_0x166d83[_0x2f26('0x4c')][_0x2f26('0xd1')]?!![]:![]}];}return db[_0x2f26('0xa7')]['findAll'](_0x40c1c7);})[_0x2f26('0x24')](function(_0x3ff53e){_0xd87abe[_0x2f26('0x5e')]=_0x3ff53e;return _0xd87abe;});}})[_0x2f26('0x24')](respondWithFilteredResult(_0x7f9e9b,_0x40c1c7))[_0x2f26('0x2f')](handleError(_0x7f9e9b,null));};exports[_0x2f26('0x43')]=function(_0x3a4187,_0x384906,_0x446112){var _0x1ca4d4,_0x24b2c1,_0x401c71;if(_['isNil'](_0x3a4187[_0x2f26('0x62')][_0x2f26('0x62')])||_0x3a4187[_0x2f26('0x62')]['body']===''){throw new db[(_0x2f26('0x81'))]['ValidationError'](_0x2f26('0xd2'));}if(_[_0x2f26('0x9c')](_0x3a4187[_0x2f26('0x62')]['to'])){throw new db[(_0x2f26('0x81'))]['ValidationError'](_0x2f26('0xd3'));}_0x1ca4d4=_0x3a4187['body']['to'];return db[_0x2f26('0x48')]['find']({'where':{'id':_0x3a4187[_0x2f26('0x5f')]['id']},'include':[{'model':db[_0x2f26('0xa2')],'as':_0x2f26('0xd4'),'include':[{'model':db[_0x2f26('0x80')],'as':_0x2f26('0xa5'),'where':{'mobile':_0x1ca4d4},'limit':0x1,'order':[[_0x2f26('0x85'),'DESC']]}]}]})[_0x2f26('0x24')](handleEntityNotFound(_0x384906,null))[_0x2f26('0x24')](function(_0x11beb6){if(_0x11beb6&&_0x11beb6[_0x2f26('0xd4')]){_0x24b2c1=_0x11beb6[_0x2f26('0x3d')]({'plain':!![]});if(_0x24b2c1[_0x2f26('0xd4')]&&_0x24b2c1['List']['Contacts'][_0x2f26('0x52')]){return _0x24b2c1[_0x2f26('0xd4')][_0x2f26('0xa5')][0x0];}return db[_0x2f26('0x80')][_0x2f26('0x61')](_[_0x2f26('0x1e')](_0x3a4187['body'],{'firstName':_0x1ca4d4,'mobile':_0x1ca4d4,'phone':_0x1ca4d4,'ListId':_0x24b2c1[_0x2f26('0x87')]}));}})[_0x2f26('0x24')](handleEntityNotFound(_0x384906,null))[_0x2f26('0x24')](function(_0x39ff11){if(_0x39ff11){_0x401c71=_0x39ff11;return db[_0x2f26('0xa7')][_0x2f26('0x60')]({'where':{'ContactId':_0x401c71['id'],'closed':![],'SmsAccountId':_0x24b2c1['id']}})[_0x2f26('0x24')](function(_0x48a48a){if(_0x48a48a){return[_0x48a48a,![]];}return db[_0x2f26('0xa7')][_0x2f26('0x61')]({'UserId':_0x3a4187[_0x2f26('0x63')]['id'],'ContactId':_0x401c71['id'],'SmsAccountId':_0x24b2c1['id'],'phone':_0x1ca4d4,'firstMsgDirection':_0x2f26('0xd5'),'Messages':[_[_0x2f26('0x58')](_0x3a4187['body'],{'read':![],'body':_0x3a4187['body'][_0x2f26('0x62')],'phone':_0x1ca4d4,'SmsAccountId':_0x24b2c1['id'],'UserId':_0x3a4187[_0x2f26('0x63')]['id'],'ContactId':_0x401c71['id']})]},{'include':[{'model':db[_0x2f26('0xd6')],'as':_0x2f26('0xd7')}]})[_0x2f26('0x24')](function(_0xdb9e7b){return[_0xdb9e7b,!![]];});});}})[_0x2f26('0xa8')](function(_0x5261bb,_0x1e445b){if(_0x1e445b){return _0x5261bb;}return db[_0x2f26('0xd6')][_0x2f26('0x61')](_[_0x2f26('0x58')](_0x3a4187['body'],{'read':![],'body':_0x3a4187[_0x2f26('0x62')][_0x2f26('0x62')],'phone':_0x1ca4d4,'SmsAccountId':_0x24b2c1['id'],'SmsInteractionId':_0x5261bb['id'],'UserId':_0x3a4187[_0x2f26('0x63')]['id'],'ContactId':_0x401c71['id']}))[_0x2f26('0x24')](function(_0x2e8ef9){_0x5261bb['dataValues'][_0x2f26('0xd7')]=[];_0x5261bb['dataValues']['Messages'][_0x2f26('0xaa')](_0x2e8ef9['dataValues']);return _0x5261bb;});})['then'](respondWithResult(_0x384906,null))['catch'](handleError(_0x384906,null));};exports['status']=function(_0x1bf97c,_0x531505,_0x28c9b7){if(_0x1bf97c[_0x2f26('0x62')]['id']){delete _0x1bf97c[_0x2f26('0x62')]['id'];}var _0x5f2471,_0x14a81b,_0x477d2c;return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x1bf97c['params']['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x531505,null))[_0x2f26('0x24')](function(_0x36e422){if(_0x36e422){_0x477d2c=_0x36e422;logger[_0x2f26('0x28')](_0x2f26('0x29'),_0x2f26('0x30'),_0x2f26('0xd8'),_0x36e422['type'],util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));switch(_0x36e422[_0x2f26('0x59')]){case _0x2f26('0xda'):if(_0x1bf97c[_0x2f26('0x62')][_0x2f26('0xdb')]&&_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x30')]){_0x14a81b=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x30')];return db[_0x2f26('0xd6')][_0x2f26('0x60')]({'where':{'messageId':_0x1bf97c['body'][_0x2f26('0xdb')]}});}break;case _0x2f26('0x8f'):if(_0x1bf97c[_0x2f26('0x62')][_0x2f26('0xdc')]&&_0x1bf97c['body'][_0x2f26('0xdd')]){_0x14a81b=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0xdd')];return db['SmsMessage']['find']({'where':{'messageId':_0x1bf97c['body'][_0x2f26('0xdc')]}});}break;case _0x2f26('0x90'):if(_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x91')]&&_0x1bf97c['body'][_0x2f26('0xde')]){_0x14a81b=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0xde')];return db[_0x2f26('0xd6')]['find']({'where':{'messageId':_0x1bf97c['body']['message_id']}});}break;case _0x2f26('0x94'):var _0x127e14=_0x1bf97c['body'][_0x2f26('0x95')][0x0];if(_0x127e14[_0x2f26('0x8c')]&&_0x127e14[_0x2f26('0x30')][_0x2f26('0xdf')]===_0x2f26('0xe0')){_0x14a81b=_0x127e14[_0x2f26('0x30')][_0x2f26('0xdf')];return db['SmsMessage'][_0x2f26('0x60')]({'where':{'messageId':_0x127e14['messageId']}});}break;case _0x2f26('0x99'):if(_0x1bf97c[_0x2f26('0x62')]['messageId']&&_0x1bf97c[_0x2f26('0x62')]['status']){_0x14a81b=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x30')];return db['SmsMessage'][_0x2f26('0x60')]({'where':{'messageId':_0x1bf97c['body'][_0x2f26('0x8c')]}});}break;case _0x2f26('0x9a'):if(_0x1bf97c[_0x2f26('0x62')][0x0][_0x2f26('0x2d')]['id']){_0x14a81b=_0x1bf97c['body'][0x0][_0x2f26('0x59')];return db[_0x2f26('0xd6')][_0x2f26('0x60')]({'where':{'messageId':_0x1bf97c[_0x2f26('0x62')][0x0][_0x2f26('0x2d')]['id']}});}break;case _0x2f26('0x9b'):if(_0x1bf97c['body'][_0x2f26('0xe1')]&&_0x1bf97c['body'][_0x2f26('0x30')]){_0x14a81b=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x30')];return db[_0x2f26('0xd6')][_0x2f26('0x60')]({'where':{'messageId':_0x1bf97c[_0x2f26('0x62')][_0x2f26('0xe1')]}});}break;}}})[_0x2f26('0x24')](handleEntityNotFound(_0x531505,null))['then'](function(_0x57913c){if(_0x57913c){_0x5f2471=_0x57913c;switch(_0x477d2c[_0x2f26('0x59')]){case _0x2f26('0xda'):if(_0x14a81b===_0x2f26('0xe0')){return _0x5f2471['update']({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),_0x2f26('0x30'),_0x2f26('0xda'),util[_0x2f26('0xd9')](_0x1bf97c['body'],{'showHidden':![],'depth':null}));}break;case _0x2f26('0x8f'):if(_0x14a81b==='1'){return _0x5f2471[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),'status',_0x2f26('0xda'),util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2f26('0x90'):if(!_0x1bf97c['body'][_0x2f26('0xe2')]&&_0x14a81b>=0xc8&&_0x14a81b<=0xce){return _0x5f2471[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),_0x2f26('0x30'),_0x2f26('0x90'),util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2b783d=_0x1bf97c[_0x2f26('0x62')][_0x2f26('0x95')][0x0];if(_0x2b783d[_0x2f26('0x30')][_0x2f26('0xdf')]===_0x2f26('0xe0')){return _0x5f2471[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),_0x2f26('0x30'),_0x2f26('0x94'),util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x14a81b=='DELIVERED_TO_GATEWAY'||_0x14a81b==_0x2f26('0xe3')){return _0x5f2471[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2f26('0x99'),util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x14a81b==_0x2f26('0xe4')){return _0x5f2471['update']({'read':!![]});}else{logger[_0x2f26('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2f26('0x30'),'bandwidth',util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x14a81b===_0x2f26('0xe5')||_0x14a81b==='ACCEPTD'){return _0x5f2471[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),_0x2f26('0x30'),'intelepeer',util[_0x2f26('0xd9')](_0x1bf97c[_0x2f26('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x5f2471;}})[_0x2f26('0x24')](respondWithResult(_0x531505,null))[_0x2f26('0x2f')](handleError(_0x531505,null));};exports[_0x2f26('0xe6')]=function(_0x322017,_0xed00d6,_0x1a00ea){var _0x1bca8f,_0x4c1ecd,_0x1c9217;return db[_0x2f26('0x48')]['find']({'where':{'id':_0x322017[_0x2f26('0x5f')]['id']}})['then'](handleEntityNotFound(_0xed00d6,null))[_0x2f26('0x24')](function(_0x18cc28){if(_0x18cc28){_0x1c9217=_0x18cc28;logger[_0x2f26('0x28')](_0x2f26('0x29'),_0x2f26('0x30'),_0x2f26('0xd8'),_0x18cc28[_0x2f26('0x59')],util['inspect'](_0x322017[_0x2f26('0x4c')],{'showHidden':![],'depth':null}));switch(_0x18cc28[_0x2f26('0x59')]){case _0x2f26('0x96'):if(_0x322017['query'][_0x2f26('0xe7')]&&_0x322017[_0x2f26('0x4c')][_0x2f26('0xe8')]){_0x4c1ecd=_0x322017[_0x2f26('0x4c')][_0x2f26('0xe8')];return db['SmsMessage'][_0x2f26('0x60')]({'where':{'messageId':_0x322017['query'][_0x2f26('0xe7')]}});}break;}}})[_0x2f26('0x24')](handleEntityNotFound(_0xed00d6,null))[_0x2f26('0x24')](function(_0x40744b){if(_0x40744b){_0x1bca8f=_0x40744b;switch(_0x1c9217['type']){case _0x2f26('0x96'):if(_0x4c1ecd==='2'||_0x4c1ecd==='6'){return _0x1bca8f[_0x2f26('0x3b')]({'read':!![]});}else{logger[_0x2f26('0x2b')](_0x2f26('0x29'),'status',_0x2f26('0x96'),util[_0x2f26('0xd9')](_0x322017['query'],{'showHidden':![],'depth':null}));};break;}return _0x1bca8f;}})[_0x2f26('0x24')](respondWithResult(_0xed00d6,null))[_0x2f26('0x2f')](handleError(_0xed00d6,null));};exports['addAgents']=function(_0x384252,_0x20cb31,_0x35615e){return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x384252[_0x2f26('0x5f')]['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x20cb31,null))[_0x2f26('0x24')](function(_0x57768a){if(_0x57768a){return _0x57768a[_0x2f26('0xe9')](_0x384252[_0x2f26('0x62')][_0x2f26('0x72')],_[_0x2f26('0xa4')](_0x384252[_0x2f26('0x62')],[_0x2f26('0x72'),'id'])||{})[_0x2f26('0xa8')](function(_0x4e407f){for(var _0x21f5cb=0x0;_0x21f5cb<_0x384252[_0x2f26('0x62')][_0x2f26('0x72')]['length'];_0x21f5cb+=0x1){socket['emit'](_0x2f26('0xea'),{'UserId':Number(_0x384252[_0x2f26('0x62')][_0x2f26('0x72')][_0x21f5cb]),'SmsAccountId':Number(_0x384252[_0x2f26('0x5f')]['id'])});}return _0x4e407f;});}})[_0x2f26('0x24')](respondWithResult(_0x20cb31,null))['catch'](handleError(_0x20cb31,null));};exports[_0x2f26('0xeb')]=function(_0x47ef80,_0x37323c,_0x2067a7){return db[_0x2f26('0x48')][_0x2f26('0x60')]({'where':{'id':_0x47ef80['params']['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x37323c,null))['then'](function(_0x29982a){if(_0x29982a){return _0x29982a[_0x2f26('0xeb')](_0x47ef80['query'][_0x2f26('0x72')])[_0x2f26('0x24')](function(){if(_[_0x2f26('0xec')](_0x47ef80[_0x2f26('0x4c')][_0x2f26('0x72')])){for(var _0x10a0ac=0x0;_0x10a0ac<_0x47ef80[_0x2f26('0x4c')][_0x2f26('0x72')]['length'];_0x10a0ac+=0x1){socket[_0x2f26('0xed')](_0x2f26('0xee'),{'UserId':Number(_0x47ef80[_0x2f26('0x4c')][_0x2f26('0x72')][_0x10a0ac]),'SmsAccountId':Number(_0x47ef80[_0x2f26('0x5f')]['id'])});}}else{socket[_0x2f26('0xed')](_0x2f26('0xee'),{'UserId':Number(_0x47ef80[_0x2f26('0x4c')]['ids']),'SmsAccountId':Number(_0x47ef80[_0x2f26('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x37323c,null))[_0x2f26('0x2f')](handleError(_0x37323c,null));};exports[_0x2f26('0xef')]=function(_0x3d67ce,_0x253791,_0x545c6f){var _0x109d4a={};var _0x45c965={};var _0x293e5d;var _0x10959d;return db[_0x2f26('0x48')][_0x2f26('0x6f')]({'where':{'id':_0x3d67ce['params']['id']}})[_0x2f26('0x24')](handleEntityNotFound(_0x253791,null))[_0x2f26('0x24')](function(_0x2e1206){if(_0x2e1206){_0x293e5d=_0x2e1206;_0x45c965[_0x2f26('0x50')]=_[_0x2f26('0x4b')](db[_0x2f26('0xb2')]['rawAttributes']);_0x45c965[_0x2f26('0x4c')]=_[_0x2f26('0x4b')](_0x3d67ce[_0x2f26('0x4c')]);_0x45c965[_0x2f26('0x4d')]=_[_0x2f26('0x4f')](_0x45c965['model'],_0x45c965[_0x2f26('0x4c')]);_0x109d4a[_0x2f26('0x4e')]=_[_0x2f26('0x4f')](_0x45c965[_0x2f26('0x50')],qs[_0x2f26('0x51')](_0x3d67ce[_0x2f26('0x4c')][_0x2f26('0x51')]));_0x109d4a[_0x2f26('0x4e')]=_0x109d4a[_0x2f26('0x4e')][_0x2f26('0x52')]?_0x109d4a[_0x2f26('0x4e')]:_0x45c965[_0x2f26('0x50')];_0x109d4a[_0x2f26('0x54')]=qs[_0x2f26('0x55')](_0x3d67ce[_0x2f26('0x4c')]['sort']);_0x109d4a[_0x2f26('0x56')]=qs[_0x2f26('0x4d')](_[_0x2f26('0x57')](_0x3d67ce['query'],_0x45c965['filters']));if(_0x3d67ce['query'][_0x2f26('0x70')]){_0x109d4a[_0x2f26('0x56')]=_[_0x2f26('0x58')](_0x109d4a[_0x2f26('0x56')],{'$or':_[_0x2f26('0x47')](_0x109d4a[_0x2f26('0x4e')],function(_0x2368d3){var _0x1c19c3={};_0x1c19c3[_0x2368d3]={'$like':'%'+_0x3d67ce[_0x2f26('0x4c')]['filter']+'%'};return _0x1c19c3;})});}_0x109d4a=_[_0x2f26('0x58')]({},_0x109d4a,_0x3d67ce[_0x2f26('0x5a')]);return _0x293e5d[_0x2f26('0xef')](_0x109d4a);}})[_0x2f26('0x24')](function(_0x2e2f7d){if(_0x2e2f7d){_0x10959d=_0x2e2f7d['length'];if(!_0x3d67ce[_0x2f26('0x4c')][_0x2f26('0x53')](_0x2f26('0xcb'))){_0x109d4a[_0x2f26('0x36')]=qs[_0x2f26('0x36')](_0x3d67ce['query'][_0x2f26('0x36')]);_0x109d4a[_0x2f26('0x33')]=qs[_0x2f26('0x33')](_0x3d67ce['query'][_0x2f26('0x33')]);}return _0x293e5d[_0x2f26('0xef')](_0x109d4a);}})[_0x2f26('0x24')](function(_0x2922d9){if(_0x2922d9){return _0x2922d9?{'count':_0x10959d,'rows':_0x2922d9}:null;}})[_0x2f26('0x24')](respondWithResult(_0x253791,null))[_0x2f26('0x2f')](handleError(_0x253791,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c728501..1c18232 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 _0xacc1=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount'];(function(_0x109cdc,_0x19bdcb){var _0x9269e8=function(_0x4e7b5f){while(--_0x4e7b5f){_0x109cdc['push'](_0x109cdc['shift']());}};_0x9269e8(++_0x19bdcb);}(_0xacc1,0x1e8));var _0x1acc=function(_0x15d1e0,_0x1439bd){_0x15d1e0=_0x15d1e0-0x0;var _0x3a34ff=_0xacc1[_0x15d1e0];return _0x3a34ff;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x1acc('0x0'))['db'][_0x1acc('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1acc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1acc('0x3')};function emitEvent(_0x5e3e9){return function(_0x103363,_0x30e061,_0x3815eb){SmsAccountEvents['emit'](_0x5e3e9+':'+_0x103363['id'],_0x103363);SmsAccountEvents[_0x1acc('0x4')](_0x5e3e9,_0x103363);_0x3815eb(null);};}for(var e in events){if(events[_0x1acc('0x5')](e)){var event=events[e];SmsAccount[_0x1acc('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xa23a=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x187b8b,_0x4ce423){var _0x3a5489=function(_0x8d18f5){while(--_0x8d18f5){_0x187b8b['push'](_0x187b8b['shift']());}};_0x3a5489(++_0x4ce423);}(_0xa23a,0x115));var _0xaa23=function(_0x20d9f0,_0x453415){_0x20d9f0=_0x20d9f0-0x0;var _0x195dda=_0xa23a[_0x20d9f0];return _0x195dda;};'use strict';var EventEmitter=require(_0xaa23('0x0'));var SmsAccount=require(_0xaa23('0x1'))['db'][_0xaa23('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xaa23('0x3')](0x0);var events={'afterCreate':_0xaa23('0x4'),'afterUpdate':_0xaa23('0x5'),'afterDestroy':_0xaa23('0x6')};function emitEvent(_0x52d69c){return function(_0x51269f,_0x48049d,_0x47be0c){SmsAccountEvents[_0xaa23('0x7')](_0x52d69c+':'+_0x51269f['id'],_0x51269f);SmsAccountEvents[_0xaa23('0x7')](_0x52d69c,_0x51269f);_0x47be0c(null);};}for(var e in events){if(events[_0xaa23('0x8')](e)){var event=events[e];SmsAccount[_0xaa23('0x9')](e,emitEvent(event));}}module[_0xaa23('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 418246e..62198bc 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 _0x25cf=['rimraf','./smsAccount.attributes','exports','SmsAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2d2165,_0xd91861){var _0x3d9c7d=function(_0x552f7a){while(--_0x552f7a){_0x2d2165['push'](_0x2d2165['shift']());}};_0x3d9c7d(++_0xd91861);}(_0x25cf,0x117));var _0xf25c=function(_0x1fa290,_0x2ff3e4){_0x1fa290=_0x1fa290-0x0;var _0x3cdd42=_0x25cf[_0x1fa290];return _0x3cdd42;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var logger=require(_0xf25c('0x2'))('api');var moment=require(_0xf25c('0x3'));var BPromise=require(_0xf25c('0x4'));var rp=require(_0xf25c('0x5'));var fs=require('fs');var path=require(_0xf25c('0x6'));var rimraf=require(_0xf25c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf25c('0x8'));module[_0xf25c('0x9')]=function(_0x25cbd6,_0x26557d){return _0x25cbd6['define'](_0xf25c('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c39=['lodash','util','../../config/logger','request-promise','path','rimraf','define','SmsAccount'];(function(_0x4848cd,_0x3386d2){var _0x3bae2b=function(_0x457b16){while(--_0x457b16){_0x4848cd['push'](_0x4848cd['shift']());}};_0x3bae2b(++_0x3386d2);}(_0x7c39,0x98));var _0x97c3=function(_0x89ab5c,_0x2102c7){_0x89ab5c=_0x89ab5c-0x0;var _0x27cc27=_0x7c39[_0x89ab5c];return _0x27cc27;};'use strict';var _=require(_0x97c3('0x0'));var util=require(_0x97c3('0x1'));var logger=require(_0x97c3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x97c3('0x3'));var fs=require('fs');var path=require(_0x97c3('0x4'));var rimraf=require(_0x97c3('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x259814,_0x4f325b){return _0x259814[_0x97c3('0x6')](_0x97c3('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index af38877..30897ec 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 _0x5b59=['redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3bfd43,_0x265e5d){var _0x17bdee=function(_0x6cc747){while(--_0x6cc747){_0x3bfd43['push'](_0x3bfd43['shift']());}};_0x17bdee(++_0x265e5d);}(_0x5b59,0xa9));var _0x95b5=function(_0x44491c,_0x745ec3){_0x44491c=_0x44491c-0x0;var _0x26eb9c=_0x5b59[_0x44491c];return _0x26eb9c;};'use strict';var _=require(_0x95b5('0x0'));var util=require(_0x95b5('0x1'));var moment=require(_0x95b5('0x2'));var BPromise=require(_0x95b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x95b5('0x5'));var logger=require('../../config/logger')(_0x95b5('0x6'));var config=require(_0x95b5('0x7'));var jayson=require(_0x95b5('0x8'));var client=jayson[_0x95b5('0x9')][_0x95b5('0xa')]({'port':0x232a});config[_0x95b5('0xb')]=_['defaults'](config[_0x95b5('0xb')],{'host':_0x95b5('0xc'),'port':0x18eb});var socket=require(_0x95b5('0xd'))(new Redis(config[_0x95b5('0xb')]));require(_0x95b5('0xe'))[_0x95b5('0xf')](socket);function respondWithRpcPromise(_0x571345,_0x2a52b3,_0x417e6d){return new BPromise(function(_0x417c60,_0x4ef271){return client[_0x95b5('0x10')](_0x571345,_0x417e6d)[_0x95b5('0x11')](function(_0x13226d){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2a52b3,_0x95b5('0x12'));logger['debug'](_0x95b5('0x13'),_0x2a52b3,_0x95b5('0x12'),JSON['stringify'](_0x13226d));if(_0x13226d['error']){if(_0x13226d[_0x95b5('0x14')]['code']===0x1f4){logger[_0x95b5('0x14')](_0x95b5('0x15'),_0x2a52b3,_0x13226d[_0x95b5('0x14')][_0x95b5('0x16')]);return _0x4ef271(_0x13226d[_0x95b5('0x14')][_0x95b5('0x16')]);}logger[_0x95b5('0x14')](_0x95b5('0x15'),_0x2a52b3,_0x13226d[_0x95b5('0x14')][_0x95b5('0x16')]);return _0x417c60(_0x13226d['error'][_0x95b5('0x16')]);}else{logger[_0x95b5('0x17')](_0x95b5('0x15'),_0x2a52b3,_0x95b5('0x12'));_0x417c60(_0x13226d[_0x95b5('0x18')][_0x95b5('0x16')]);}})[_0x95b5('0x19')](function(_0x27fec3){logger[_0x95b5('0x14')](_0x95b5('0x15'),_0x2a52b3,_0x27fec3);_0x4ef271(_0x27fec3);});});}exports[_0x95b5('0x1a')]=function(_0x48e07c){var _0x34800e=this;return new Promise(function(_0x430be8,_0x5a8662){return db['SmsAccount'][_0x95b5('0x1b')]({'raw':_0x48e07c[_0x95b5('0x1c')]?_0x48e07c[_0x95b5('0x1c')][_0x95b5('0x1d')]===undefined?!![]:![]:!![],'where':_0x48e07c['options']?_0x48e07c[_0x95b5('0x1c')][_0x95b5('0x1e')]||null:null,'attributes':_0x48e07c['options']?_0x48e07c[_0x95b5('0x1c')][_0x95b5('0x1f')]||null:null,'include':_0x48e07c[_0x95b5('0x1c')]?_0x48e07c[_0x95b5('0x1c')][_0x95b5('0x20')]?_['map'](_0x48e07c[_0x95b5('0x1c')]['include'],function(_0x4d9139){return{'model':db[_0x4d9139[_0x95b5('0x21')]],'as':_0x4d9139['as'],'attributes':_0x4d9139[_0x95b5('0x1f')],'include':_0x4d9139['include']?_[_0x95b5('0x22')](_0x4d9139['include'],function(_0x256988){return{'model':db[_0x256988[_0x95b5('0x21')]],'as':_0x256988['as'],'attributes':_0x256988[_0x95b5('0x1f')],'include':_0x256988[_0x95b5('0x20')]?_[_0x95b5('0x22')](_0x256988[_0x95b5('0x20')],function(_0x195be1){return{'model':db[_0x195be1[_0x95b5('0x21')]],'as':_0x195be1['as'],'attributes':_0x195be1[_0x95b5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x95b5('0x11')](function(_0x2afbe0){logger[_0x95b5('0x17')]('ShowSmsAccount',_0x48e07c);logger['debug']('ShowSmsAccount',_0x48e07c,JSON[_0x95b5('0x23')](_0x2afbe0));_0x430be8(_0x2afbe0);})[_0x95b5('0x19')](function(_0x449ca9){logger[_0x95b5('0x14')](_0x95b5('0x1a'),_0x449ca9['message'],_0x48e07c);_0x5a8662(_0x34800e['error'](0x1f4,_0x449ca9['message']));});});}; \ No newline at end of file +var _0xd07f=['attributes','include','map','model','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where'];(function(_0x1b8524,_0x1bb669){var _0x81418d=function(_0x5f5795){while(--_0x5f5795){_0x1b8524['push'](_0x1b8524['shift']());}};_0x81418d(++_0x1bb669);}(_0xd07f,0xbd));var _0xfd07=function(_0x309124,_0x53c447){_0x309124=_0x309124-0x0;var _0x3e2f73=_0xd07f[_0x309124];return _0x3e2f73;};'use strict';var _=require(_0xfd07('0x0'));var util=require('util');var moment=require(_0xfd07('0x1'));var BPromise=require(_0xfd07('0x2'));var rs=require(_0xfd07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd07('0x4'))(_0xfd07('0x5'));var config=require(_0xfd07('0x6'));var jayson=require(_0xfd07('0x7'));var client=jayson[_0xfd07('0x8')][_0xfd07('0x9')]({'port':0x232a});config[_0xfd07('0xa')]=_[_0xfd07('0xb')](config[_0xfd07('0xa')],{'host':_0xfd07('0xc'),'port':0x18eb});var socket=require(_0xfd07('0xd'))(new Redis(config['redis']));require(_0xfd07('0xe'))[_0xfd07('0xf')](socket);function respondWithRpcPromise(_0x37a5a0,_0x2f72be,_0x2a12ed){return new BPromise(function(_0x4787c4,_0xc0086a){return client['request'](_0x37a5a0,_0x2a12ed)[_0xfd07('0x10')](function(_0x360aae){logger[_0xfd07('0x11')](_0xfd07('0x12'),_0x2f72be,_0xfd07('0x13'));logger[_0xfd07('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2f72be,_0xfd07('0x13'),JSON[_0xfd07('0x15')](_0x360aae));if(_0x360aae[_0xfd07('0x16')]){if(_0x360aae['error'][_0xfd07('0x17')]===0x1f4){logger[_0xfd07('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2f72be,_0x360aae[_0xfd07('0x16')][_0xfd07('0x18')]);return _0xc0086a(_0x360aae[_0xfd07('0x16')]['message']);}logger[_0xfd07('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2f72be,_0x360aae[_0xfd07('0x16')][_0xfd07('0x18')]);return _0x4787c4(_0x360aae['error'][_0xfd07('0x18')]);}else{logger[_0xfd07('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2f72be,'request\x20sent');_0x4787c4(_0x360aae[_0xfd07('0x19')][_0xfd07('0x18')]);}})[_0xfd07('0x1a')](function(_0x297fbb){logger['error'](_0xfd07('0x12'),_0x2f72be,_0x297fbb);_0xc0086a(_0x297fbb);});});}exports[_0xfd07('0x1b')]=function(_0x4302fd){var _0x1776b1=this;return new Promise(function(_0x2a2ca9,_0x324beb){return db[_0xfd07('0x1c')][_0xfd07('0x1d')]({'raw':_0x4302fd[_0xfd07('0x1e')]?_0x4302fd['options'][_0xfd07('0x1f')]===undefined?!![]:![]:!![],'where':_0x4302fd['options']?_0x4302fd[_0xfd07('0x1e')][_0xfd07('0x20')]||null:null,'attributes':_0x4302fd[_0xfd07('0x1e')]?_0x4302fd[_0xfd07('0x1e')][_0xfd07('0x21')]||null:null,'include':_0x4302fd['options']?_0x4302fd[_0xfd07('0x1e')][_0xfd07('0x22')]?_['map'](_0x4302fd[_0xfd07('0x1e')][_0xfd07('0x22')],function(_0x3ac06e){return{'model':db[_0x3ac06e['model']],'as':_0x3ac06e['as'],'attributes':_0x3ac06e[_0xfd07('0x21')],'include':_0x3ac06e[_0xfd07('0x22')]?_[_0xfd07('0x23')](_0x3ac06e[_0xfd07('0x22')],function(_0x3d42c6){return{'model':db[_0x3d42c6['model']],'as':_0x3d42c6['as'],'attributes':_0x3d42c6[_0xfd07('0x21')],'include':_0x3d42c6[_0xfd07('0x22')]?_[_0xfd07('0x23')](_0x3d42c6['include'],function(_0x14bf1d){return{'model':db[_0x14bf1d[_0xfd07('0x24')]],'as':_0x14bf1d['as'],'attributes':_0x14bf1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd07('0x10')](function(_0x4cfe6a){logger[_0xfd07('0x11')](_0xfd07('0x1b'),_0x4302fd);logger[_0xfd07('0x14')](_0xfd07('0x1b'),_0x4302fd,JSON[_0xfd07('0x15')](_0x4cfe6a));_0x2a2ca9(_0x4cfe6a);})[_0xfd07('0x1a')](function(_0x4dc795){logger[_0xfd07('0x16')](_0xfd07('0x1b'),_0x4dc795[_0xfd07('0x18')],_0x4302fd);_0x324beb(_0x1776b1[_0xfd07('0x16')](0x1f4,_0x4dc795[_0xfd07('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7a14775..5e5f57d 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 4aeebb3..5ca3917 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5dd778,_0x5045e8){var _0x359c75=function(_0x283c84){while(--_0x283c84){_0x5dd778['push'](_0x5dd778['shift']());}};_0x359c75(++_0x5045e8);}(_0x3e74,0x175));var _0x43e7=function(_0x47dc94,_0xa05412){_0x47dc94=_0x47dc94-0x0;var _0x5ad40d=_0x3e74[_0x47dc94];return _0x5ad40d;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3a5d7aa..259c824 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 _0x0620=['sequelize','INTEGER','noop','STRING','*,*,*,*'];(function(_0x21a1a6,_0x1474bf){var _0x5cec0e=function(_0x13abb9){while(--_0x13abb9){_0x21a1a6['push'](_0x21a1a6['shift']());}};_0x5cec0e(++_0x1474bf);}(_0x0620,0xb4));var _0x0062=function(_0x45ee97,_0x52fb2e){_0x45ee97=_0x45ee97-0x0;var _0x415082=_0x0620[_0x45ee97];return _0x415082;};'use strict';var Sequelize=require(_0x0062('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0062('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0062('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0062('0x3')]},'interval':{'type':Sequelize[_0x0062('0x3')],'defaultValue':_0x0062('0x4')}}; \ No newline at end of file +var _0xe2df=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x236cc4,_0x17daa2){var _0x3228fd=function(_0x796a50){while(--_0x796a50){_0x236cc4['push'](_0x236cc4['shift']());}};_0x3228fd(++_0x17daa2);}(_0xe2df,0xd8));var _0xfe2d=function(_0x14f238,_0x215765){_0x14f238=_0x14f238-0x0;var _0x3a61ae=_0xe2df[_0x14f238];return _0x3a61ae;};'use strict';var Sequelize=require(_0xfe2d('0x0'));module[_0xfe2d('0x1')]={'priority':{'type':Sequelize[_0xfe2d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfe2d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfe2d('0x4')]},'interval':{'type':Sequelize[_0xfe2d('0x4')],'defaultValue':_0xfe2d('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b0586a6..e37a7ec 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 _0xb994=['limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','SmsApplication','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','count'];(function(_0x23f132,_0x5d919e){var _0x2b10bf=function(_0x396c0d){while(--_0x396c0d){_0x23f132['push'](_0x23f132['shift']());}};_0x2b10bf(++_0x5d919e);}(_0xb994,0x199));var _0x4b99=function(_0x3e492a,_0x43ba9b){_0x3e492a=_0x3e492a-0x0;var _0x34e763=_0xb994[_0x3e492a];return _0x34e763;};'use strict';var emlformat=require(_0x4b99('0x0'));var rimraf=require(_0x4b99('0x1'));var zipdir=require(_0x4b99('0x2'));var jsonpatch=require(_0x4b99('0x3'));var rp=require('request-promise');var moment=require(_0x4b99('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b99('0x5'));var util=require('util');var path=require(_0x4b99('0x6'));var sox=require(_0x4b99('0x7'));var csv=require('to-csv');var ejs=require(_0x4b99('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b99('0x9'));var squel=require(_0x4b99('0xa'));var crypto=require(_0x4b99('0xb'));var jsforce=require(_0x4b99('0xc'));var deskjs=require(_0x4b99('0xd'));var toCsv=require(_0x4b99('0xe'));var querystring=require(_0x4b99('0xf'));var Papa=require(_0x4b99('0x10'));var Redis=require('ioredis');var authService=require(_0x4b99('0x11'));var qs=require(_0x4b99('0x12'));var as=require(_0x4b99('0x13'));var hardwareService=require(_0x4b99('0x14'));var logger=require('../../config/logger')(_0x4b99('0x15'));var utils=require(_0x4b99('0x16'));var config=require(_0x4b99('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c16a,_0x1c0812){_0x1c0812=_0x1c0812||0xcc;return function(_0x1d3e1a){if(_0x1d3e1a){return _0x36c16a[_0x4b99('0x18')](_0x1c0812);}return _0x36c16a['status'](_0x1c0812)[_0x4b99('0x19')]();};}function respondWithResult(_0x3b6d5b,_0x2d9dbc){_0x2d9dbc=_0x2d9dbc||0xc8;return function(_0x17e95e){if(_0x17e95e){return _0x3b6d5b[_0x4b99('0x1a')](_0x2d9dbc)['json'](_0x17e95e);}};}function respondWithFilteredResult(_0x245242,_0x1f8b12){return function(_0x43af63){if(_0x43af63){var _0xa38ce1=typeof _0x1f8b12['offset']==='undefined'&&typeof _0x1f8b12['limit']==='undefined';var _0x3dd4ed=_0x43af63['count'];var _0x13283d=_0xa38ce1?0x0:_0x1f8b12[_0x4b99('0x1b')];var _0x2648b1=_0xa38ce1?_0x43af63[_0x4b99('0x1c')]:_0x1f8b12['offset']+_0x1f8b12[_0x4b99('0x1d')];var _0x2bf11b;if(_0x2648b1>=_0x3dd4ed){_0x2648b1=_0x3dd4ed;_0x2bf11b=0xc8;}else{_0x2bf11b=0xce;}_0x245242[_0x4b99('0x1a')](_0x2bf11b);return _0x245242[_0x4b99('0x1e')]('Content-Range',_0x13283d+'-'+_0x2648b1+'/'+_0x3dd4ed)['json'](_0x43af63);}return null;};}function patchUpdates(_0x3277fa){return function(_0x531da6){try{jsonpatch['apply'](_0x531da6,_0x3277fa,!![]);}catch(_0x16c49d){return BPromise[_0x4b99('0x1f')](_0x16c49d);}return _0x531da6[_0x4b99('0x20')]();};}function saveUpdates(_0x139d2c,_0x1fad6a){return function(_0x577516){if(_0x577516){return _0x577516[_0x4b99('0x21')](_0x139d2c)[_0x4b99('0x22')](function(_0x34fcbd){return _0x34fcbd;});}return null;};}function removeEntity(_0x4f50f1,_0x1e994b){return function(_0x378f20){if(_0x378f20){return _0x378f20[_0x4b99('0x23')]()['then'](function(){_0x4f50f1[_0x4b99('0x1a')](0xcc)[_0x4b99('0x19')]();});}};}function handleEntityNotFound(_0x37fe25,_0x2399e0){return function(_0x48da6b){if(!_0x48da6b){_0x37fe25[_0x4b99('0x18')](0x194);}return _0x48da6b;};}function handleError(_0x42b23a,_0x3ac0a4){_0x3ac0a4=_0x3ac0a4||0x1f4;return function(_0x22eb9e){logger[_0x4b99('0x24')](_0x22eb9e[_0x4b99('0x25')]);if(_0x22eb9e['name']){delete _0x22eb9e[_0x4b99('0x26')];}_0x42b23a[_0x4b99('0x1a')](_0x3ac0a4)[_0x4b99('0x27')](_0x22eb9e);};}exports[_0x4b99('0x28')]=function(_0x2feb6b,_0x52c0cb){var _0x863b9c={},_0x434ea1={},_0x1ec41d={'count':0x0,'rows':[]};var _0x259330=_[_0x4b99('0x29')](db['SmsApplication'][_0x4b99('0x2a')],function(_0x58ad5e){return{'name':_0x58ad5e['fieldName'],'type':_0x58ad5e[_0x4b99('0x2b')][_0x4b99('0x2c')]};});_0x434ea1[_0x4b99('0x2d')]=_[_0x4b99('0x29')](_0x259330,_0x4b99('0x26'));_0x434ea1[_0x4b99('0x2e')]=_[_0x4b99('0x2f')](_0x2feb6b[_0x4b99('0x2e')]);_0x434ea1[_0x4b99('0x30')]=_[_0x4b99('0x31')](_0x434ea1['model'],_0x434ea1[_0x4b99('0x2e')]);_0x863b9c[_0x4b99('0x32')]=_[_0x4b99('0x31')](_0x434ea1[_0x4b99('0x2d')],qs['fields'](_0x2feb6b['query'][_0x4b99('0x33')]));_0x863b9c[_0x4b99('0x32')]=_0x863b9c[_0x4b99('0x32')][_0x4b99('0x34')]?_0x863b9c['attributes']:_0x434ea1[_0x4b99('0x2d')];if(!_0x2feb6b['query'][_0x4b99('0x35')](_0x4b99('0x36'))){_0x863b9c[_0x4b99('0x1d')]=qs[_0x4b99('0x1d')](_0x2feb6b[_0x4b99('0x2e')][_0x4b99('0x1d')]);_0x863b9c[_0x4b99('0x1b')]=qs['offset'](_0x2feb6b['query'][_0x4b99('0x1b')]);}_0x863b9c[_0x4b99('0x37')]=qs[_0x4b99('0x38')](_0x2feb6b['query']['sort']);_0x863b9c[_0x4b99('0x39')]=qs[_0x4b99('0x30')](_[_0x4b99('0x3a')](_0x2feb6b[_0x4b99('0x2e')],_0x434ea1['filters']),_0x259330);if(_0x2feb6b[_0x4b99('0x2e')][_0x4b99('0x3b')]){_0x863b9c['where']=_[_0x4b99('0x3c')](_0x863b9c[_0x4b99('0x39')],{'$or':_[_0x4b99('0x29')](_0x259330,function(_0x1537d9){if(_0x1537d9['type']!==_0x4b99('0x3d')){var _0x24b612={};_0x24b612[_0x1537d9['name']]={'$like':'%'+_0x2feb6b[_0x4b99('0x2e')][_0x4b99('0x3b')]+'%'};return _0x24b612;}})});}_0x863b9c=_[_0x4b99('0x3c')]({},_0x863b9c,_0x2feb6b[_0x4b99('0x3e')]);var _0xe33cbe={'where':_0x863b9c['where']};return db['SmsApplication'][_0x4b99('0x1c')](_0xe33cbe)['then'](function(_0x3301ee){_0x1ec41d['count']=_0x3301ee;if(_0x2feb6b['query'][_0x4b99('0x3f')]){_0x863b9c['include']=[{'all':!![]}];}return db[_0x4b99('0x40')]['findAll'](_0x863b9c);})['then'](function(_0x55167a){_0x1ec41d[_0x4b99('0x41')]=_0x55167a;return _0x1ec41d;})[_0x4b99('0x22')](respondWithFilteredResult(_0x52c0cb,_0x863b9c))[_0x4b99('0x42')](handleError(_0x52c0cb,null));};exports[_0x4b99('0x43')]=function(_0x57330d,_0xc927a5){var _0x354039={'raw':!![],'where':{'id':_0x57330d['params']['id']}},_0x5a632e={};_0x5a632e[_0x4b99('0x2d')]=_['keys'](db[_0x4b99('0x40')][_0x4b99('0x2a')]);_0x5a632e[_0x4b99('0x2e')]=_['keys'](_0x57330d['query']);_0x5a632e['filters']=_[_0x4b99('0x31')](_0x5a632e[_0x4b99('0x2d')],_0x5a632e[_0x4b99('0x2e')]);_0x354039[_0x4b99('0x32')]=_[_0x4b99('0x31')](_0x5a632e['model'],qs[_0x4b99('0x33')](_0x57330d[_0x4b99('0x2e')]['fields']));_0x354039[_0x4b99('0x32')]=_0x354039[_0x4b99('0x32')][_0x4b99('0x34')]?_0x354039['attributes']:_0x5a632e[_0x4b99('0x2d')];if(_0x57330d[_0x4b99('0x2e')]['includeAll']){_0x354039[_0x4b99('0x44')]=[{'all':!![]}];}_0x354039=_[_0x4b99('0x3c')]({},_0x354039,_0x57330d[_0x4b99('0x3e')]);return db[_0x4b99('0x40')][_0x4b99('0x45')](_0x354039)[_0x4b99('0x22')](handleEntityNotFound(_0xc927a5,null))[_0x4b99('0x22')](respondWithResult(_0xc927a5,null))['catch'](handleError(_0xc927a5,null));};exports[_0x4b99('0x46')]=function(_0x3d0585,_0x2e603c){return db[_0x4b99('0x40')][_0x4b99('0x46')](_0x3d0585['body'],{})[_0x4b99('0x22')](respondWithResult(_0x2e603c,0xc9))[_0x4b99('0x42')](handleError(_0x2e603c,null));};exports[_0x4b99('0x21')]=function(_0x5853e9,_0x19dd99){if(_0x5853e9[_0x4b99('0x47')]['id']){delete _0x5853e9[_0x4b99('0x47')]['id'];}return db[_0x4b99('0x40')][_0x4b99('0x45')]({'where':{'id':_0x5853e9[_0x4b99('0x48')]['id']}})[_0x4b99('0x22')](handleEntityNotFound(_0x19dd99,null))[_0x4b99('0x22')](saveUpdates(_0x5853e9[_0x4b99('0x47')],null))[_0x4b99('0x22')](respondWithResult(_0x19dd99,null))[_0x4b99('0x42')](handleError(_0x19dd99,null));};exports['destroy']=function(_0x312cdc,_0x2068bb){return db[_0x4b99('0x40')][_0x4b99('0x45')]({'where':{'id':_0x312cdc[_0x4b99('0x48')]['id']}})[_0x4b99('0x22')](handleEntityNotFound(_0x2068bb,null))[_0x4b99('0x22')](removeEntity(_0x2068bb,null))[_0x4b99('0x42')](handleError(_0x2068bb,null));}; \ No newline at end of file +var _0xe1e8=['create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','SmsApplication','include','catch','show','params','includeAll'];(function(_0x8f4554,_0x97e1f8){var _0x2b7465=function(_0x5d8390){while(--_0x5d8390){_0x8f4554['push'](_0x8f4554['shift']());}};_0x2b7465(++_0x97e1f8);}(_0xe1e8,0x15c));var _0x8e1e=function(_0x7de806,_0x5f8e6e){_0x7de806=_0x7de806-0x0;var _0x2c09f0=_0xe1e8[_0x7de806];return _0x2c09f0;};'use strict';var emlformat=require(_0x8e1e('0x0'));var rimraf=require(_0x8e1e('0x1'));var zipdir=require(_0x8e1e('0x2'));var jsonpatch=require(_0x8e1e('0x3'));var rp=require(_0x8e1e('0x4'));var moment=require(_0x8e1e('0x5'));var BPromise=require(_0x8e1e('0x6'));var Mustache=require(_0x8e1e('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8e1e('0x8'));var ejs=require(_0x8e1e('0x9'));var fs=require('fs');var fs_extra=require(_0x8e1e('0xa'));var _=require(_0x8e1e('0xb'));var squel=require('squel');var crypto=require(_0x8e1e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e1e('0x8'));var querystring=require(_0x8e1e('0xd'));var Papa=require(_0x8e1e('0xe'));var Redis=require(_0x8e1e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8e1e('0x10'));var as=require(_0x8e1e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e1e('0x12'));var utils=require(_0x8e1e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8e1e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498027,_0x2b3afe){_0x2b3afe=_0x2b3afe||0xcc;return function(_0x49a6e2){if(_0x49a6e2){return _0x498027[_0x8e1e('0x15')](_0x2b3afe);}return _0x498027[_0x8e1e('0x16')](_0x2b3afe)[_0x8e1e('0x17')]();};}function respondWithResult(_0x927035,_0x46632f){_0x46632f=_0x46632f||0xc8;return function(_0x3fd73c){if(_0x3fd73c){return _0x927035[_0x8e1e('0x16')](_0x46632f)[_0x8e1e('0x18')](_0x3fd73c);}};}function respondWithFilteredResult(_0x400ca7,_0x2980cc){return function(_0x2206a1){if(_0x2206a1){var _0x458eb4=typeof _0x2980cc['offset']===_0x8e1e('0x19')&&typeof _0x2980cc[_0x8e1e('0x1a')]===_0x8e1e('0x19');var _0x15aa14=_0x2206a1[_0x8e1e('0x1b')];var _0x2d2b03=_0x458eb4?0x0:_0x2980cc['offset'];var _0x4d920f=_0x458eb4?_0x2206a1[_0x8e1e('0x1b')]:_0x2980cc[_0x8e1e('0x1c')]+_0x2980cc['limit'];var _0x425d61;if(_0x4d920f>=_0x15aa14){_0x4d920f=_0x15aa14;_0x425d61=0xc8;}else{_0x425d61=0xce;}_0x400ca7[_0x8e1e('0x16')](_0x425d61);return _0x400ca7[_0x8e1e('0x1d')](_0x8e1e('0x1e'),_0x2d2b03+'-'+_0x4d920f+'/'+_0x15aa14)[_0x8e1e('0x18')](_0x2206a1);}return null;};}function patchUpdates(_0x16f0d4){return function(_0x168a93){try{jsonpatch[_0x8e1e('0x1f')](_0x168a93,_0x16f0d4,!![]);}catch(_0x412e07){return BPromise[_0x8e1e('0x20')](_0x412e07);}return _0x168a93[_0x8e1e('0x21')]();};}function saveUpdates(_0x5beac9,_0x55b479){return function(_0x41fe30){if(_0x41fe30){return _0x41fe30[_0x8e1e('0x22')](_0x5beac9)[_0x8e1e('0x23')](function(_0x7dd2cf){return _0x7dd2cf;});}return null;};}function removeEntity(_0x563510,_0x24cee8){return function(_0x3cfb3d){if(_0x3cfb3d){return _0x3cfb3d[_0x8e1e('0x24')]()[_0x8e1e('0x23')](function(){_0x563510[_0x8e1e('0x16')](0xcc)[_0x8e1e('0x17')]();});}};}function handleEntityNotFound(_0x5c99a8,_0x5c4d79){return function(_0x3d1d68){if(!_0x3d1d68){_0x5c99a8[_0x8e1e('0x15')](0x194);}return _0x3d1d68;};}function handleError(_0x7c875e,_0x1606c7){_0x1606c7=_0x1606c7||0x1f4;return function(_0x5dcfe7){logger['error'](_0x5dcfe7[_0x8e1e('0x25')]);if(_0x5dcfe7[_0x8e1e('0x26')]){delete _0x5dcfe7[_0x8e1e('0x26')];}_0x7c875e[_0x8e1e('0x16')](_0x1606c7)['send'](_0x5dcfe7);};}exports[_0x8e1e('0x27')]=function(_0xf419be,_0x2d2424){var _0x21d69c={},_0x2b825d={},_0xdc6b43={'count':0x0,'rows':[]};var _0x30b907=_[_0x8e1e('0x28')](db['SmsApplication'][_0x8e1e('0x29')],function(_0x492700){return{'name':_0x492700['fieldName'],'type':_0x492700[_0x8e1e('0x2a')]['key']};});_0x2b825d[_0x8e1e('0x2b')]=_['map'](_0x30b907,_0x8e1e('0x26'));_0x2b825d[_0x8e1e('0x2c')]=_[_0x8e1e('0x2d')](_0xf419be['query']);_0x2b825d[_0x8e1e('0x2e')]=_[_0x8e1e('0x2f')](_0x2b825d[_0x8e1e('0x2b')],_0x2b825d[_0x8e1e('0x2c')]);_0x21d69c[_0x8e1e('0x30')]=_[_0x8e1e('0x2f')](_0x2b825d[_0x8e1e('0x2b')],qs[_0x8e1e('0x31')](_0xf419be[_0x8e1e('0x2c')]['fields']));_0x21d69c[_0x8e1e('0x30')]=_0x21d69c['attributes'][_0x8e1e('0x32')]?_0x21d69c['attributes']:_0x2b825d['model'];if(!_0xf419be['query'][_0x8e1e('0x33')](_0x8e1e('0x34'))){_0x21d69c['limit']=qs[_0x8e1e('0x1a')](_0xf419be['query']['limit']);_0x21d69c['offset']=qs['offset'](_0xf419be[_0x8e1e('0x2c')]['offset']);}_0x21d69c[_0x8e1e('0x35')]=qs[_0x8e1e('0x36')](_0xf419be[_0x8e1e('0x2c')]['sort']);_0x21d69c['where']=qs['filters'](_[_0x8e1e('0x37')](_0xf419be['query'],_0x2b825d[_0x8e1e('0x2e')]),_0x30b907);if(_0xf419be['query'][_0x8e1e('0x38')]){_0x21d69c[_0x8e1e('0x39')]=_['merge'](_0x21d69c[_0x8e1e('0x39')],{'$or':_[_0x8e1e('0x28')](_0x30b907,function(_0x1cfc1d){if(_0x1cfc1d[_0x8e1e('0x2a')]!=='VIRTUAL'){var _0x37ba39={};_0x37ba39[_0x1cfc1d['name']]={'$like':'%'+_0xf419be[_0x8e1e('0x2c')]['filter']+'%'};return _0x37ba39;}})});}_0x21d69c=_[_0x8e1e('0x3a')]({},_0x21d69c,_0xf419be[_0x8e1e('0x3b')]);var _0x5efa8d={'where':_0x21d69c[_0x8e1e('0x39')]};return db[_0x8e1e('0x3c')][_0x8e1e('0x1b')](_0x5efa8d)[_0x8e1e('0x23')](function(_0x498480){_0xdc6b43[_0x8e1e('0x1b')]=_0x498480;if(_0xf419be['query']['includeAll']){_0x21d69c[_0x8e1e('0x3d')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x21d69c);})[_0x8e1e('0x23')](function(_0x3facd3){_0xdc6b43['rows']=_0x3facd3;return _0xdc6b43;})['then'](respondWithFilteredResult(_0x2d2424,_0x21d69c))[_0x8e1e('0x3e')](handleError(_0x2d2424,null));};exports[_0x8e1e('0x3f')]=function(_0x4a140f,_0x14d28d){var _0x47f1b0={'raw':!![],'where':{'id':_0x4a140f[_0x8e1e('0x40')]['id']}},_0x199b32={};_0x199b32['model']=_[_0x8e1e('0x2d')](db[_0x8e1e('0x3c')][_0x8e1e('0x29')]);_0x199b32[_0x8e1e('0x2c')]=_[_0x8e1e('0x2d')](_0x4a140f[_0x8e1e('0x2c')]);_0x199b32[_0x8e1e('0x2e')]=_['intersection'](_0x199b32[_0x8e1e('0x2b')],_0x199b32[_0x8e1e('0x2c')]);_0x47f1b0[_0x8e1e('0x30')]=_[_0x8e1e('0x2f')](_0x199b32[_0x8e1e('0x2b')],qs[_0x8e1e('0x31')](_0x4a140f['query']['fields']));_0x47f1b0[_0x8e1e('0x30')]=_0x47f1b0['attributes'][_0x8e1e('0x32')]?_0x47f1b0['attributes']:_0x199b32[_0x8e1e('0x2b')];if(_0x4a140f[_0x8e1e('0x2c')][_0x8e1e('0x41')]){_0x47f1b0[_0x8e1e('0x3d')]=[{'all':!![]}];}_0x47f1b0=_['merge']({},_0x47f1b0,_0x4a140f[_0x8e1e('0x3b')]);return db[_0x8e1e('0x3c')]['find'](_0x47f1b0)[_0x8e1e('0x23')](handleEntityNotFound(_0x14d28d,null))[_0x8e1e('0x23')](respondWithResult(_0x14d28d,null))[_0x8e1e('0x3e')](handleError(_0x14d28d,null));};exports[_0x8e1e('0x42')]=function(_0x498a46,_0x1df6a8){return db[_0x8e1e('0x3c')][_0x8e1e('0x42')](_0x498a46[_0x8e1e('0x43')],{})[_0x8e1e('0x23')](respondWithResult(_0x1df6a8,0xc9))[_0x8e1e('0x3e')](handleError(_0x1df6a8,null));};exports[_0x8e1e('0x22')]=function(_0x4a2280,_0x429353){if(_0x4a2280[_0x8e1e('0x43')]['id']){delete _0x4a2280['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x4a2280[_0x8e1e('0x40')]['id']}})[_0x8e1e('0x23')](handleEntityNotFound(_0x429353,null))[_0x8e1e('0x23')](saveUpdates(_0x4a2280[_0x8e1e('0x43')],null))[_0x8e1e('0x23')](respondWithResult(_0x429353,null))[_0x8e1e('0x3e')](handleError(_0x429353,null));};exports[_0x8e1e('0x24')]=function(_0x3bed6e,_0x54e602){return db['SmsApplication'][_0x8e1e('0x44')]({'where':{'id':_0x3bed6e[_0x8e1e('0x40')]['id']}})[_0x8e1e('0x23')](handleEntityNotFound(_0x54e602,null))[_0x8e1e('0x23')](removeEntity(_0x54e602,null))[_0x8e1e('0x3e')](handleError(_0x54e602,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index aac7d3d..c6e6389 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 _0xb55c=['rimraf','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path'];(function(_0x45b1ad,_0x215b03){var _0x3d5696=function(_0x4d9e73){while(--_0x4d9e73){_0x45b1ad['push'](_0x45b1ad['shift']());}};_0x3d5696(++_0x215b03);}(_0xb55c,0x187));var _0xcb55=function(_0x17ba67,_0x199ba6){_0x17ba67=_0x17ba67-0x0;var _0x496bd7=_0xb55c[_0x17ba67];return _0x496bd7;};'use strict';var _=require(_0xcb55('0x0'));var util=require(_0xcb55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcb55('0x2'));var BPromise=require(_0xcb55('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb55('0x4'));var rimraf=require(_0xcb55('0x5'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x31dfec,_0x16777a){return _0x31dfec['define'](_0xcb55('0x6'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb55('0x7'),'collate':_0xcb55('0x8')});}; \ No newline at end of file +var _0xbc82=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','path','./smsApplication.attributes'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0xbc82,0x13e));var _0x2bc8=function(_0x45598f,_0x1649ec){_0x45598f=_0x45598f-0x0;var _0x517e2b=_0xbc82[_0x45598f];return _0x517e2b;};'use strict';var _=require(_0x2bc8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2bc8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bc8('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2bc8('0x3'));module['exports']=function(_0x54d303,_0x3d12fc){return _0x54d303['define']('SmsApplication',attributes,{'tableName':_0x2bc8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bc8('0x5'),'collate':_0x2bc8('0x6')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f1f5d0f..732c3f4 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 _0x794b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x524274,_0x9f68c0){var _0x39cf7b=function(_0x13c6f9){while(--_0x13c6f9){_0x524274['push'](_0x524274['shift']());}};_0x39cf7b(++_0x9f68c0);}(_0x794b,0x1c2));var _0xb794=function(_0x3dbf33,_0x4a5364){_0x3dbf33=_0x3dbf33-0x0;var _0x51381f=_0x794b[_0x3dbf33];return _0x51381f;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e4d4,_0x231206,_0x340863){return new BPromise(function(_0x5d099b,_0x30f03f){return client[_0xb794('0x9')](_0x20e4d4,_0x340863)[_0xb794('0xa')](function(_0xc3dde7){logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,_0xb794('0xd'));logger[_0xb794('0xe')](_0xb794('0xf'),_0x231206,_0xb794('0xd'),JSON[_0xb794('0x10')](_0xc3dde7));if(_0xc3dde7[_0xb794('0x11')]){if(_0xc3dde7[_0xb794('0x11')][_0xb794('0x12')]===0x1f4){logger[_0xb794('0x11')](_0xb794('0xc'),_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x30f03f(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x5d099b(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}else{logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,'request\x20sent');_0x5d099b(_0xc3dde7[_0xb794('0x14')][_0xb794('0x13')]);}})['catch'](function(_0x408766){logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0x408766);_0x30f03f(_0x408766);});});} \ No newline at end of file +var _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x54709e,_0x202950){var _0xb61608=function(_0x24ecb3){while(--_0x24ecb3){_0x54709e['push'](_0x54709e['shift']());}};_0xb61608(++_0x202950);}(_0x4888,0x198));var _0x8488=function(_0x48317f,_0x12895a){_0x48317f=_0x48317f-0x0;var _0x4d1cce=_0x4888[_0x48317f];return _0x4d1cce;};'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});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1dd5abf..a852a78 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','addTags','put','tracked','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','express'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x19fefc,_0x232851){_0x19fefc=_0x19fefc-0x0;var _0x373165=_0xdd4f[_0x19fefc];return _0x373165;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./smsInteraction.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x11')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addMessage']);router[_0xfdd4('0x11')](_0xfdd4('0x13'),auth[_0xfdd4('0x7')](),interaction['tracked'](_0xfdd4('0x14'),'smsinteraction:addtags'),controller[_0xfdd4('0x15')]);router[_0xfdd4('0x16')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')]('sms','smsinteraction:update'),controller['update']);router[_0xfdd4('0x18')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')](_0xfdd4('0x14'),_0xfdd4('0x19')),controller[_0xfdd4('0x1a')]);router[_0xfdd4('0x18')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x1b')]);module[_0xfdd4('0x1c')]=router; \ No newline at end of file +var _0xf7b4=['/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0x469944,_0x35dfc7){var _0x421af7=function(_0x5deaa3){while(--_0x5deaa3){_0x469944['push'](_0x469944['shift']());}};_0x421af7(++_0x35dfc7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2539e6,_0x595d36){_0x2539e6=_0x2539e6-0x0;var _0xe83570=_0xf7b4[_0x2539e6];return _0xe83570;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/messages',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0x7')](_0x4f7b('0xf'),auth[_0x4f7b('0x8')](),controller['download']);router[_0x4f7b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f7b('0x10')](_0x4f7b('0x11'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['post'](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x16')),controller[_0x4f7b('0x17')]);router[_0x4f7b('0x18')](_0x4f7b('0xc'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x19')),controller['update']);router[_0x4f7b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),'smsinteraction:destroy'),controller[_0x4f7b('0x1b')]);router[_0x4f7b('0x1a')](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),controller['removeTags']);module[_0x4f7b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2411267..a575b63 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 _0x1d63=['out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x42c85a,_0x8b0591){var _0x16fddf=function(_0x260375){while(--_0x260375){_0x42c85a['push'](_0x42c85a['shift']());}};_0x16fddf(++_0x8b0591);}(_0x1d63,0xa4));var _0x31d6=function(_0x1c7f4d,_0x25a70c){_0x1c7f4d=_0x1c7f4d-0x0;var _0x2de02b=_0x1d63[_0x1c7f4d];return _0x2de02b;};'use strict';var Sequelize=require(_0x31d6('0x0'));var moment=require(_0x31d6('0x1'));module[_0x31d6('0x2')]={'closed':{'type':Sequelize[_0x31d6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x31d6('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x31d6('0x5')]},'thirdDisposition':{'type':Sequelize[_0x31d6('0x5')]},'note':{'type':Sequelize[_0x31d6('0x5')]},'phone':{'type':Sequelize[_0x31d6('0x5')]},'read1stAt':{'type':Sequelize[_0x31d6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x31d6('0x6')]('in',_0x31d6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x31d6('0x6')]('in',_0x31d6('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x31d6('0x8')]}}; \ No newline at end of file +var _0x5ae9=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x32b9e6,_0x365f17){var _0x1c2044=function(_0x11b1f6){while(--_0x11b1f6){_0x32b9e6['push'](_0x32b9e6['shift']());}};_0x1c2044(++_0x365f17);}(_0x5ae9,0x19b));var _0x95ae=function(_0x1aecdc,_0x522a27){_0x1aecdc=_0x1aecdc-0x0;var _0xef638b=_0x5ae9[_0x1aecdc];return _0xef638b;};'use strict';var Sequelize=require(_0x95ae('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x95ae('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x95ae('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x95ae('0x3')]},'thirdDisposition':{'type':Sequelize[_0x95ae('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x95ae('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x95ae('0x4')]('in',_0x95ae('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x95ae('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x95ae('0x4')]('in',_0x95ae('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b5010ca..4319d9e 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 _0xe7ce=['order','sort','where','pick','filter','$gte','format','options','rows','addTags','setTags','omit','spread','Tag','color','smsInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','System','out','read','value','renderFile','views','transcript-','createPdfFromHTML','log','err','zip-dir','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','name','send','index','map','rawAttributes','fieldName','key','findAll','sms','user','catch','show','params','filters','intersection','model','query','attributes','fields','length','includeAll','merge','SmsInteraction','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','keys','nolimit'];(function(_0x139e6a,_0x443ab7){var _0x19c2ba=function(_0x5be05b){while(--_0x5be05b){_0x139e6a['push'](_0x139e6a['shift']());}};_0x19c2ba(++_0x443ab7);}(_0xe7ce,0x18c));var _0xee7c=function(_0x503940,_0x88f90){_0x503940=_0x503940-0x0;var _0x5a10c2=_0xe7ce[_0x503940];return _0x5a10c2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xee7c('0x0'));var moment=require('moment');var BPromise=require(_0xee7c('0x1'));var util=require(_0xee7c('0x2'));var path=require('path');var ejs=require(_0xee7c('0x3'));var fs=require('fs');var _=require(_0xee7c('0x4'));var Redis=require(_0xee7c('0x5'));var interaction=require(_0xee7c('0x6'));var qs=require(_0xee7c('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0xee7c('0x8'));var db=require('../../mysqldb')['db'];config[_0xee7c('0x9')]=_[_0xee7c('0xa')](config[_0xee7c('0x9')],{'host':_0xee7c('0xb'),'port':0x18eb});var socket=require(_0xee7c('0xc'))(new Redis(config[_0xee7c('0x9')]));require(_0xee7c('0xd'))[_0xee7c('0xe')](socket);function respondWithStatusCode(_0x468723,_0x17dbc3){_0x17dbc3=_0x17dbc3||0xcc;return function(_0x39a0df){if(_0x39a0df){return _0x468723[_0xee7c('0xf')](_0x17dbc3);}return _0x468723[_0xee7c('0x10')](_0x17dbc3)[_0xee7c('0x11')]();};}function respondWithResult(_0x2eede3,_0x1db940){_0x1db940=_0x1db940||0xc8;return function(_0xaf64dc){if(_0xaf64dc){return _0x2eede3[_0xee7c('0x10')](_0x1db940)[_0xee7c('0x12')](_0xaf64dc);}};}function respondWithFilteredResult(_0x564d3f,_0x3a75ae){return function(_0x2730d2){if(_0x2730d2){var _0x156d9b=typeof _0x3a75ae[_0xee7c('0x13')]===_0xee7c('0x14')&&typeof _0x3a75ae[_0xee7c('0x15')]===_0xee7c('0x14');var _0x315b86=_0x2730d2[_0xee7c('0x16')];var _0x805a6d=_0x156d9b?0x0:_0x3a75ae[_0xee7c('0x13')];var _0xf66678=_0x156d9b?_0x2730d2[_0xee7c('0x16')]:_0x3a75ae[_0xee7c('0x13')]+_0x3a75ae['limit'];var _0x59af55;if(_0xf66678>=_0x315b86){_0xf66678=_0x315b86;_0x59af55=0xc8;}else{_0x59af55=0xce;}_0x564d3f['status'](_0x59af55);return _0x564d3f[_0xee7c('0x17')](_0xee7c('0x18'),_0x805a6d+'-'+_0xf66678+'/'+_0x315b86)[_0xee7c('0x12')](_0x2730d2);}return null;};}function saveUpdates(_0x50d4f0){return function(_0x80d001){if(_0x80d001){return _0x80d001[_0xee7c('0x19')](_0x50d4f0)[_0xee7c('0x1a')](function(_0x451d54){return _0x451d54;});}return null;};}function removeEntity(_0x4a55cc){return function(_0x3875eb){if(_0x3875eb){return _0x3875eb['destroy']()[_0xee7c('0x1a')](function(){_0x4a55cc[_0xee7c('0x10')](0xcc)[_0xee7c('0x11')]();});}};}function handleEntityNotFound(_0x231c47){return function(_0x2cf64d){if(!_0x2cf64d){_0x231c47[_0xee7c('0xf')](0x194);}return _0x2cf64d;};}function handleError(_0x542a99,_0x1a0cf8){_0x1a0cf8=_0x1a0cf8||0x1f4;return function(_0x1fa212){logger['error'](_0x1fa212['stack']);if(_0x1fa212[_0xee7c('0x1b')]){delete _0x1fa212[_0xee7c('0x1b')];}_0x542a99[_0xee7c('0x10')](_0x1a0cf8)[_0xee7c('0x1c')](_0x1fa212);};}exports[_0xee7c('0x1d')]=function(_0x3e90a0,_0x3fbfd7){var _0x1f1f18={};var _0xa5e3e=_[_0xee7c('0x1e')](db['SmsInteraction'][_0xee7c('0x1f')],function(_0x5f362c){return{'name':_0x5f362c[_0xee7c('0x20')],'type':_0x5f362c['type'][_0xee7c('0x21')]};});_0x1f1f18=qs['getOptions'](_0xa5e3e,_0x3e90a0);return interaction[_0xee7c('0x22')](_0xee7c('0x23'),_0x3e90a0['query'],_0x3e90a0[_0xee7c('0x24')],_0x1f1f18,_0xa5e3e)['then'](respondWithFilteredResult(_0x3fbfd7,_0x1f1f18))[_0xee7c('0x25')](handleError(_0x3fbfd7,null));};exports[_0xee7c('0x26')]=function(_0x311501,_0xa98947){var _0x26454a={'raw':![],'where':{'id':_0x311501[_0xee7c('0x27')]['id']}},_0xbb6f75={};_0xbb6f75['model']=_['keys'](db['SmsInteraction'][_0xee7c('0x1f')]);_0xbb6f75['query']=_['keys'](_0x311501['query']);_0xbb6f75[_0xee7c('0x28')]=_[_0xee7c('0x29')](_0xbb6f75[_0xee7c('0x2a')],_0xbb6f75[_0xee7c('0x2b')]);_0x26454a[_0xee7c('0x2c')]=_[_0xee7c('0x29')](_0xbb6f75[_0xee7c('0x2a')],qs['fields'](_0x311501[_0xee7c('0x2b')][_0xee7c('0x2d')]));_0x26454a['attributes']=_0x26454a[_0xee7c('0x2c')][_0xee7c('0x2e')]?_0x26454a[_0xee7c('0x2c')]:_0xbb6f75[_0xee7c('0x2a')];if(_0x311501['query'][_0xee7c('0x2f')]){_0x26454a['include']=[{'all':!![]}];}_0x26454a=_[_0xee7c('0x30')]({},_0x26454a,_0x311501['options']);return db[_0xee7c('0x31')][_0xee7c('0x32')](_0x26454a)[_0xee7c('0x1a')](handleEntityNotFound(_0xa98947,null))[_0xee7c('0x1a')](respondWithResult(_0xa98947,null))[_0xee7c('0x25')](handleError(_0xa98947,null));};exports[_0xee7c('0x33')]=function(_0x2d6b1a,_0x45686f){return db[_0xee7c('0x31')][_0xee7c('0x33')](_0x2d6b1a['body'],{})[_0xee7c('0x1a')](respondWithResult(_0x45686f,0xc9))['catch'](handleError(_0x45686f,null));};exports[_0xee7c('0x19')]=function(_0x4ca12b,_0x29e498){if(_0x4ca12b[_0xee7c('0x34')]['id']){delete _0x4ca12b[_0xee7c('0x34')]['id'];}return db[_0xee7c('0x31')]['find']({'where':{'id':_0x4ca12b['params']['id']}})['then'](handleEntityNotFound(_0x29e498,null))['then'](saveUpdates(_0x4ca12b[_0xee7c('0x34')],null))[_0xee7c('0x1a')](respondWithResult(_0x29e498,null))[_0xee7c('0x25')](handleError(_0x29e498,null));};exports['destroy']=function(_0x36cd92,_0x3ec310){return db[_0xee7c('0x31')]['find']({'where':{'id':_0x36cd92[_0xee7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x3ec310,null))[_0xee7c('0x1a')](removeEntity(_0x3ec310,null))[_0xee7c('0x25')](handleError(_0x3ec310,null));};exports[_0xee7c('0x35')]=function(_0x4da843,_0x11945f){return db[_0xee7c('0x31')][_0xee7c('0x35')]()[_0xee7c('0x1a')](respondWithResult(_0x11945f,null))[_0xee7c('0x25')](handleError(_0x11945f,null));};exports[_0xee7c('0x36')]=function(_0x128502,_0x1c92ea){return db[_0xee7c('0x37')][_0xee7c('0x32')]({'where':{'id':_0x128502[_0xee7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x1c92ea,null))[_0xee7c('0x1a')](function(_0x873359){if(_0x873359){return _0x873359[_0xee7c('0x36')](_0x128502[_0xee7c('0x34')][_0xee7c('0x38')],_['omit'](_0x128502['body'],['ids','id'])||{});}})[_0xee7c('0x1a')](respondWithResult(_0x1c92ea,null))[_0xee7c('0x25')](handleError(_0x1c92ea,null));};exports[_0xee7c('0x39')]=function(_0x19cd40,_0x19ed43){var _0x3d2587={'raw':![],'where':{}};var _0x6e76da={};var _0x30cba2={'count':0x0,'rows':[]};return db[_0xee7c('0x31')]['findOne']({'where':{'id':_0x19cd40[_0xee7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x19ed43,null))[_0xee7c('0x1a')](function(_0x4b09eb){if(_0x4b09eb){_0x6e76da[_0xee7c('0x2a')]=_[_0xee7c('0x3a')](db[_0xee7c('0x37')][_0xee7c('0x1f')]);_0x6e76da[_0xee7c('0x2b')]=_[_0xee7c('0x3a')](_0x19cd40[_0xee7c('0x2b')]);_0x6e76da[_0xee7c('0x28')]=_[_0xee7c('0x29')](_0x6e76da['model'],_0x6e76da[_0xee7c('0x2b')]);_0x3d2587['attributes']=_[_0xee7c('0x29')](_0x6e76da[_0xee7c('0x2a')],qs[_0xee7c('0x2d')](_0x19cd40['query'][_0xee7c('0x2d')]));_0x3d2587[_0xee7c('0x2c')]=_0x3d2587[_0xee7c('0x2c')][_0xee7c('0x2e')]?_0x3d2587[_0xee7c('0x2c')]:_0x6e76da[_0xee7c('0x2a')];if(!_0x19cd40['query']['hasOwnProperty'](_0xee7c('0x3b'))){_0x3d2587['limit']=qs[_0xee7c('0x15')](_0x19cd40[_0xee7c('0x2b')]['limit']);_0x3d2587['offset']=qs[_0xee7c('0x13')](_0x19cd40['query'][_0xee7c('0x13')]);}_0x3d2587[_0xee7c('0x3c')]=qs[_0xee7c('0x3d')](_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x3d')]);_0x3d2587[_0xee7c('0x3e')]=qs[_0xee7c('0x28')](_[_0xee7c('0x3f')](_0x19cd40[_0xee7c('0x2b')],_0x6e76da[_0xee7c('0x28')]));_0x3d2587['where']['SmsInteractionId']=_0x4b09eb['id'];if(_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x40')]){_0x3d2587[_0xee7c('0x3e')]=_[_0xee7c('0x30')](_0x3d2587[_0xee7c('0x3e')],{'$or':_['map'](_0x3d2587[_0xee7c('0x2c')],function(_0x1ec42b){var _0x51af12={};_0x51af12[_0x1ec42b]={'$like':'%'+_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x40')]+'%'};return _0x51af12;})});}if(_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x41')]){var _0x85ff15=_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x41')]['split'](',');var _0x2989af={};_0x2989af[_0x85ff15[0x0]]={'$gte':moment(_0x85ff15[0x1])[_0xee7c('0x42')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3d2587['where']=_[_0xee7c('0x30')](_0x3d2587[_0xee7c('0x3e')],_0x2989af);}_0x3d2587=_[_0xee7c('0x30')]({},_0x3d2587,_0x19cd40[_0xee7c('0x43')]);return db[_0xee7c('0x37')]['count']({'where':_0x3d2587[_0xee7c('0x3e')]})[_0xee7c('0x1a')](function(_0x26496a){_0x30cba2[_0xee7c('0x16')]=_0x26496a;if(_0x19cd40[_0xee7c('0x2b')][_0xee7c('0x2f')]){_0x3d2587['include']=[{'all':!![]}];}return db['SmsMessage'][_0xee7c('0x22')](_0x3d2587);})[_0xee7c('0x1a')](function(_0x216b85){_0x30cba2[_0xee7c('0x44')]=_0x216b85;return _0x30cba2;});}})['then'](respondWithFilteredResult(_0x19ed43,_0x3d2587))[_0xee7c('0x25')](handleError(_0x19ed43,null));};exports[_0xee7c('0x45')]=function(_0x5bf8df,_0x13a746){return db[_0xee7c('0x31')][_0xee7c('0x32')]({'where':{'id':_0x5bf8df[_0xee7c('0x27')]['id']}})[_0xee7c('0x1a')](handleEntityNotFound(_0x13a746,null))[_0xee7c('0x1a')](function(_0x1551be){if(_0x1551be){return _0x1551be[_0xee7c('0x46')](_0x5bf8df[_0xee7c('0x34')][_0xee7c('0x38')],_[_0xee7c('0x47')](_0x5bf8df[_0xee7c('0x34')],[_0xee7c('0x38'),'id'])||{})[_0xee7c('0x48')](function(){return db[_0xee7c('0x49')][_0xee7c('0x22')]({'attributes':['id',_0xee7c('0x1b'),_0xee7c('0x4a')],'where':{'id':_0x5bf8df['body'][_0xee7c('0x38')]}});})[_0xee7c('0x1a')](function(_0x328387){socket['emit'](_0xee7c('0x4b'),{'id':Number(_0x5bf8df['params']['id']),'tags':_0x328387||[]});return{'id':Number(_0x5bf8df[_0xee7c('0x27')]['id']),'tags':_0x328387||[]};});}})[_0xee7c('0x1a')](respondWithResult(_0x13a746,null))[_0xee7c('0x25')](handleError(_0x13a746,null));};exports[_0xee7c('0x4c')]=function(_0x531b0a,_0x1c8454){return db[_0xee7c('0x31')][_0xee7c('0x32')]({'where':{'id':_0x531b0a[_0xee7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x1c8454,null))['then'](function(_0x332030){if(_0x332030){return _0x332030['removeTags'](_0x531b0a[_0xee7c('0x2b')][_0xee7c('0x38')]);}})[_0xee7c('0x1a')](respondWithStatusCode(_0x1c8454,null))[_0xee7c('0x25')](handleError(_0x1c8454,null));};exports[_0xee7c('0x4d')]=function(_0x3330cc,_0x103f04){var _0x4fd55e=moment()['unix']()[_0xee7c('0x4e')]();var _0x4c0ba=path[_0xee7c('0x4f')](config[_0xee7c('0x50')],_0xee7c('0x51'),_0xee7c('0x52'),_0xee7c('0x53'));var _0x1467f4=path[_0xee7c('0x4f')](_0x4c0ba,_0x4fd55e);var _0x3b56f2=util[_0xee7c('0x42')](_0xee7c('0x54'),_0x3330cc['params']['id'],_0x4fd55e);var _0x4a76ee=path[_0xee7c('0x4f')](_0x4c0ba,_0x3b56f2);var _0x56829c=[];_0x56829c[_0xee7c('0x55')]({'model':db[_0xee7c('0x56')],'as':_0xee7c('0x56'),'attributes':['id',_0xee7c('0x57')],'raw':!![]});_0x56829c[_0xee7c('0x55')]({'model':db[_0xee7c('0x58')],'as':_0xee7c('0x59'),'attributes':['id',_0xee7c('0x5a'),_0xee7c('0x5b')],'raw':!![]});var _0x24ee0f=[{'model':db[_0xee7c('0x37')],'as':_0xee7c('0x5c'),'attributes':['id',_0xee7c('0x34'),_0xee7c('0x5d'),_0xee7c('0x5e'),_0xee7c('0x5f'),'read'],'include':_0x56829c}];_0x24ee0f[_0xee7c('0x55')]({'model':db[_0xee7c('0x60')],'as':_0xee7c('0x61'),'attributes':['id',_0xee7c('0x1b')]});_0x24ee0f[_0xee7c('0x55')]({'model':db['User'],'as':_0xee7c('0x62'),'attributes':['id',_0xee7c('0x57')]});return db['SmsInteraction'][_0xee7c('0x32')]({'where':{'id':_0x3330cc[_0xee7c('0x27')]['id']},'include':_0x24ee0f})['then'](handleEntityNotFound(_0x103f04,null))[_0xee7c('0x1a')](function(_0xbf150){if(_0xbf150){var _0x26a2c3=_0xbf150['get']({'plain':!![]});fs['mkdirSync'](_0x1467f4);var _0x4cddd3={'channel':_0xee7c('0x63'),'account':_0x26a2c3['Account'][_0xee7c('0x1b')],'agent':_0x26a2c3['Owner']?_0x26a2c3[_0xee7c('0x62')][_0xee7c('0x57')]:_0xee7c('0x64'),'createdAt':moment(_0x26a2c3[_0xee7c('0x5d')])[_0xee7c('0x42')](_0xee7c('0x65'))[_0xee7c('0x4e')](),'closedAt':_0x26a2c3[_0xee7c('0x66')]?moment(_0x26a2c3['closedAt'])[_0xee7c('0x42')](_0xee7c('0x65'))['toString']():'','disposition':_0x26a2c3[_0xee7c('0x67')],'messages':_(_0x26a2c3[_0xee7c('0x5c')])[_0xee7c('0x40')]({'secret':![]})[_0xee7c('0x1e')](function(_0x3c1e88){return{'date':moment(_0x3c1e88[_0xee7c('0x5d')])[_0xee7c('0x42')](_0xee7c('0x65'))['toString'](),'sender':_0x3c1e88['direction']==='out'?_0x3c1e88[_0xee7c('0x56')]?_0x3c1e88['User'][_0xee7c('0x57')]:_0xee7c('0x68'):_0x3c1e88[_0xee7c('0x59')][_0xee7c('0x5a')]+(_0x3c1e88[_0xee7c('0x59')][_0xee7c('0x5b')]?'\x20'+_0x3c1e88[_0xee7c('0x59')]['lastName']:''),'body':_0x3c1e88['body'],'direction':_0x3c1e88[_0xee7c('0x5e')]===_0xee7c('0x69')?'A':'C','secret':_0x3c1e88[_0xee7c('0x5f')],'read':_0x3c1e88[_0xee7c('0x6a')]};})[_0xee7c('0x6b')]()};return ejs[_0xee7c('0x6c')](path[_0xee7c('0x4f')](config[_0xee7c('0x50')],_0xee7c('0x51'),_0xee7c('0x6d'),'downloadInteraction.ejs'),{'interaction':_0x4cddd3})[_0xee7c('0x1a')](function(_0x1ad42c){var _0x21c51e=path[_0xee7c('0x4f')](_0x1467f4,_0xee7c('0x6e')+_0x26a2c3['id']+'-'+_0x4fd55e+'.pdf');var _0x4ecedf={'path':_0x21c51e,'channel':_0xee7c('0x63'),'interactionId':_0x26a2c3['id']};return pdf[_0xee7c('0x6f')](_0x1ad42c,_0x4ecedf);})[_0xee7c('0x1a')](function(){return new BPromise(function(_0x3fb660,_0x3af56c){zipdir(_0x1467f4,{'saveTo':_0x4a76ee},function(_0x3ed267,_0x363989){if(_0x3ed267)return _0x3af56c(_0x3ed267);return _0x3fb660(_0x363989);});})[_0xee7c('0x1a')](function(){return new BPromise(function(_0x5896ff,_0x55e96b){rimraf(_0x1467f4,function(_0x36c32a){if(_0x36c32a)_0x55e96b(_0x36c32a);return _0x5896ff();});});})['then'](function(){return _0x103f04['download'](_0x4a76ee,_0x3b56f2,function(_0x533e72){if(_0x533e72){console[_0xee7c('0x70')](_0xee7c('0x71'),_0x533e72);}else{fs['unlinkSync'](_0x4a76ee);}});});});}else{return _0x103f04[_0xee7c('0xf')](0xc8);}})[_0xee7c('0x25')](handleError(_0x103f04,null));}; \ No newline at end of file +var _0xa192=['filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','Tag','color','smsInteractionTags:save','removeTags','download','toString','files','tmp','join','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','Sms','closed','System','value','renderFile','root','transcript-','.pdf','err','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','localhost','./smsInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','rawAttributes','type','key','getOptions','findAll','sms','query','params','model','keys','intersection','attributes','fields','includeAll','include','options','SmsInteraction','find','catch','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','map'];(function(_0x9e905b,_0x331dc8){var _0x5736a7=function(_0x388ce2){while(--_0x388ce2){_0x9e905b['push'](_0x9e905b['shift']());}};_0x5736a7(++_0x331dc8);}(_0xa192,0x16f));var _0x2a19=function(_0x31d9d0,_0x298e58){_0x31d9d0=_0x31d9d0-0x0;var _0x14ed5c=_0xa192[_0x31d9d0];return _0x14ed5c;};'use strict';var rimraf=require(_0x2a19('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2a19('0x1'));var BPromise=require(_0x2a19('0x2'));var util=require('util');var path=require(_0x2a19('0x3'));var ejs=require(_0x2a19('0x4'));var fs=require('fs');var _=require(_0x2a19('0x5'));var Redis=require(_0x2a19('0x6'));var interaction=require(_0x2a19('0x7'));var qs=require(_0x2a19('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x2a19('0x9'))(_0x2a19('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2a19('0xb')]=_['defaults'](config[_0x2a19('0xb')],{'host':_0x2a19('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a19('0xb')]));require(_0x2a19('0xd'))[_0x2a19('0xe')](socket);function respondWithStatusCode(_0x4a5446,_0x4154b2){_0x4154b2=_0x4154b2||0xcc;return function(_0x174c37){if(_0x174c37){return _0x4a5446[_0x2a19('0xf')](_0x4154b2);}return _0x4a5446['status'](_0x4154b2)[_0x2a19('0x10')]();};}function respondWithResult(_0x330523,_0x16e783){_0x16e783=_0x16e783||0xc8;return function(_0x17318f){if(_0x17318f){return _0x330523[_0x2a19('0x11')](_0x16e783)['json'](_0x17318f);}};}function respondWithFilteredResult(_0x2d0c59,_0xe6a0ab){return function(_0x33aeb2){if(_0x33aeb2){var _0x5bb4f8=typeof _0xe6a0ab[_0x2a19('0x12')]===_0x2a19('0x13')&&typeof _0xe6a0ab[_0x2a19('0x14')]==='undefined';var _0x4bb97c=_0x33aeb2[_0x2a19('0x15')];var _0x399740=_0x5bb4f8?0x0:_0xe6a0ab[_0x2a19('0x12')];var _0x54af04=_0x5bb4f8?_0x33aeb2[_0x2a19('0x15')]:_0xe6a0ab['offset']+_0xe6a0ab['limit'];var _0x2b7ede;if(_0x54af04>=_0x4bb97c){_0x54af04=_0x4bb97c;_0x2b7ede=0xc8;}else{_0x2b7ede=0xce;}_0x2d0c59[_0x2a19('0x11')](_0x2b7ede);return _0x2d0c59[_0x2a19('0x16')]('Content-Range',_0x399740+'-'+_0x54af04+'/'+_0x4bb97c)[_0x2a19('0x17')](_0x33aeb2);}return null;};}function saveUpdates(_0x12ce52){return function(_0x16ed2e){if(_0x16ed2e){return _0x16ed2e[_0x2a19('0x18')](_0x12ce52)[_0x2a19('0x19')](function(_0x57e14e){return _0x57e14e;});}return null;};}function removeEntity(_0x378da9){return function(_0x3db08a){if(_0x3db08a){return _0x3db08a[_0x2a19('0x1a')]()[_0x2a19('0x19')](function(){_0x378da9[_0x2a19('0x11')](0xcc)[_0x2a19('0x10')]();});}};}function handleEntityNotFound(_0x3f3549){return function(_0x12b547){if(!_0x12b547){_0x3f3549['sendStatus'](0x194);}return _0x12b547;};}function handleError(_0x2dcf97,_0x131c1f){_0x131c1f=_0x131c1f||0x1f4;return function(_0x267b3a){logger[_0x2a19('0x1b')](_0x267b3a[_0x2a19('0x1c')]);if(_0x267b3a[_0x2a19('0x1d')]){delete _0x267b3a[_0x2a19('0x1d')];}_0x2dcf97[_0x2a19('0x11')](_0x131c1f)['send'](_0x267b3a);};}exports['index']=function(_0x347594,_0x4ac674){var _0x3a5272={};var _0x38ce77=_['map'](db['SmsInteraction'][_0x2a19('0x1e')],function(_0x289402){return{'name':_0x289402['fieldName'],'type':_0x289402[_0x2a19('0x1f')][_0x2a19('0x20')]};});_0x3a5272=qs[_0x2a19('0x21')](_0x38ce77,_0x347594);return interaction[_0x2a19('0x22')](_0x2a19('0x23'),_0x347594[_0x2a19('0x24')],_0x347594['user'],_0x3a5272,_0x38ce77)[_0x2a19('0x19')](respondWithFilteredResult(_0x4ac674,_0x3a5272))['catch'](handleError(_0x4ac674,null));};exports['show']=function(_0x3d3f72,_0x2f1634){var _0x4bc59f={'raw':![],'where':{'id':_0x3d3f72[_0x2a19('0x25')]['id']}},_0x4572aa={};_0x4572aa[_0x2a19('0x26')]=_[_0x2a19('0x27')](db['SmsInteraction'][_0x2a19('0x1e')]);_0x4572aa[_0x2a19('0x24')]=_[_0x2a19('0x27')](_0x3d3f72[_0x2a19('0x24')]);_0x4572aa['filters']=_[_0x2a19('0x28')](_0x4572aa[_0x2a19('0x26')],_0x4572aa[_0x2a19('0x24')]);_0x4bc59f[_0x2a19('0x29')]=_['intersection'](_0x4572aa['model'],qs[_0x2a19('0x2a')](_0x3d3f72['query'][_0x2a19('0x2a')]));_0x4bc59f[_0x2a19('0x29')]=_0x4bc59f[_0x2a19('0x29')]['length']?_0x4bc59f[_0x2a19('0x29')]:_0x4572aa[_0x2a19('0x26')];if(_0x3d3f72[_0x2a19('0x24')][_0x2a19('0x2b')]){_0x4bc59f[_0x2a19('0x2c')]=[{'all':!![]}];}_0x4bc59f=_['merge']({},_0x4bc59f,_0x3d3f72[_0x2a19('0x2d')]);return db[_0x2a19('0x2e')][_0x2a19('0x2f')](_0x4bc59f)[_0x2a19('0x19')](handleEntityNotFound(_0x2f1634,null))['then'](respondWithResult(_0x2f1634,null))[_0x2a19('0x30')](handleError(_0x2f1634,null));};exports['create']=function(_0x2d7cbb,_0x3b9a96){return db[_0x2a19('0x2e')][_0x2a19('0x31')](_0x2d7cbb[_0x2a19('0x32')],{})[_0x2a19('0x19')](respondWithResult(_0x3b9a96,0xc9))['catch'](handleError(_0x3b9a96,null));};exports[_0x2a19('0x18')]=function(_0x575ae3,_0x2a8f5a){if(_0x575ae3[_0x2a19('0x32')]['id']){delete _0x575ae3[_0x2a19('0x32')]['id'];}return db[_0x2a19('0x2e')][_0x2a19('0x2f')]({'where':{'id':_0x575ae3[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0x2a8f5a,null))[_0x2a19('0x19')](saveUpdates(_0x575ae3[_0x2a19('0x32')],null))[_0x2a19('0x19')](respondWithResult(_0x2a8f5a,null))[_0x2a19('0x30')](handleError(_0x2a8f5a,null));};exports[_0x2a19('0x1a')]=function(_0x188c5a,_0xe8676c){return db[_0x2a19('0x2e')][_0x2a19('0x2f')]({'where':{'id':_0x188c5a[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0xe8676c,null))['then'](removeEntity(_0xe8676c,null))['catch'](handleError(_0xe8676c,null));};exports[_0x2a19('0x33')]=function(_0xd98fd,_0x5a1808){return db['SmsInteraction'][_0x2a19('0x33')]()[_0x2a19('0x19')](respondWithResult(_0x5a1808,null))[_0x2a19('0x30')](handleError(_0x5a1808,null));};exports[_0x2a19('0x34')]=function(_0x22d009,_0x52d770){return db[_0x2a19('0x35')][_0x2a19('0x2f')]({'where':{'id':_0x22d009[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0x52d770,null))[_0x2a19('0x19')](function(_0x58a6f1){if(_0x58a6f1){return _0x58a6f1['addMessage'](_0x22d009[_0x2a19('0x32')]['ids'],_[_0x2a19('0x36')](_0x22d009['body'],[_0x2a19('0x37'),'id'])||{});}})[_0x2a19('0x19')](respondWithResult(_0x52d770,null))[_0x2a19('0x30')](handleError(_0x52d770,null));};exports[_0x2a19('0x38')]=function(_0x42cf18,_0x3e42bb){var _0x2bc7de={'raw':![],'where':{}};var _0x974a2e={};var _0x2e98c0={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x2a19('0x39')]({'where':{'id':_0x42cf18[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0x3e42bb,null))[_0x2a19('0x19')](function(_0x138276){if(_0x138276){_0x974a2e[_0x2a19('0x26')]=_['keys'](db[_0x2a19('0x35')][_0x2a19('0x1e')]);_0x974a2e[_0x2a19('0x24')]=_[_0x2a19('0x27')](_0x42cf18['query']);_0x974a2e[_0x2a19('0x3a')]=_[_0x2a19('0x28')](_0x974a2e['model'],_0x974a2e[_0x2a19('0x24')]);_0x2bc7de[_0x2a19('0x29')]=_[_0x2a19('0x28')](_0x974a2e[_0x2a19('0x26')],qs[_0x2a19('0x2a')](_0x42cf18[_0x2a19('0x24')]['fields']));_0x2bc7de['attributes']=_0x2bc7de['attributes'][_0x2a19('0x3b')]?_0x2bc7de[_0x2a19('0x29')]:_0x974a2e['model'];if(!_0x42cf18[_0x2a19('0x24')][_0x2a19('0x3c')](_0x2a19('0x3d'))){_0x2bc7de[_0x2a19('0x14')]=qs[_0x2a19('0x14')](_0x42cf18[_0x2a19('0x24')][_0x2a19('0x14')]);_0x2bc7de[_0x2a19('0x12')]=qs[_0x2a19('0x12')](_0x42cf18[_0x2a19('0x24')][_0x2a19('0x12')]);}_0x2bc7de[_0x2a19('0x3e')]=qs[_0x2a19('0x3f')](_0x42cf18[_0x2a19('0x24')][_0x2a19('0x3f')]);_0x2bc7de[_0x2a19('0x40')]=qs[_0x2a19('0x3a')](_[_0x2a19('0x41')](_0x42cf18[_0x2a19('0x24')],_0x974a2e[_0x2a19('0x3a')]));_0x2bc7de['where'][_0x2a19('0x42')]=_0x138276['id'];if(_0x42cf18[_0x2a19('0x24')]['filter']){_0x2bc7de[_0x2a19('0x40')]=_[_0x2a19('0x43')](_0x2bc7de[_0x2a19('0x40')],{'$or':_[_0x2a19('0x44')](_0x2bc7de[_0x2a19('0x29')],function(_0x5068cf){var _0x428828={};_0x428828[_0x5068cf]={'$like':'%'+_0x42cf18[_0x2a19('0x24')][_0x2a19('0x45')]+'%'};return _0x428828;})});}if(_0x42cf18[_0x2a19('0x24')][_0x2a19('0x46')]){var _0x23c96b=_0x42cf18[_0x2a19('0x24')][_0x2a19('0x46')]['split'](',');var _0x505485={};_0x505485[_0x23c96b[0x0]]={'$gte':moment(_0x23c96b[0x1])[_0x2a19('0x47')](_0x2a19('0x48'))};_0x2bc7de[_0x2a19('0x40')]=_[_0x2a19('0x43')](_0x2bc7de[_0x2a19('0x40')],_0x505485);}_0x2bc7de=_['merge']({},_0x2bc7de,_0x42cf18['options']);return db[_0x2a19('0x35')]['count']({'where':_0x2bc7de[_0x2a19('0x40')]})['then'](function(_0x5c5510){_0x2e98c0[_0x2a19('0x15')]=_0x5c5510;if(_0x42cf18[_0x2a19('0x24')][_0x2a19('0x2b')]){_0x2bc7de[_0x2a19('0x2c')]=[{'all':!![]}];}return db[_0x2a19('0x35')][_0x2a19('0x22')](_0x2bc7de);})[_0x2a19('0x19')](function(_0xc26b64){_0x2e98c0[_0x2a19('0x49')]=_0xc26b64;return _0x2e98c0;});}})['then'](respondWithFilteredResult(_0x3e42bb,_0x2bc7de))['catch'](handleError(_0x3e42bb,null));};exports[_0x2a19('0x4a')]=function(_0x58cdb1,_0x4b9205){return db[_0x2a19('0x2e')][_0x2a19('0x2f')]({'where':{'id':_0x58cdb1[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0x4b9205,null))[_0x2a19('0x19')](function(_0x2da6a2){if(_0x2da6a2){return _0x2da6a2['setTags'](_0x58cdb1[_0x2a19('0x32')][_0x2a19('0x37')],_[_0x2a19('0x36')](_0x58cdb1['body'],['ids','id'])||{})['spread'](function(){return db[_0x2a19('0x4b')][_0x2a19('0x22')]({'attributes':['id','name',_0x2a19('0x4c')],'where':{'id':_0x58cdb1[_0x2a19('0x32')][_0x2a19('0x37')]}});})[_0x2a19('0x19')](function(_0x21aede){socket['emit'](_0x2a19('0x4d'),{'id':Number(_0x58cdb1['params']['id']),'tags':_0x21aede||[]});return{'id':Number(_0x58cdb1[_0x2a19('0x25')]['id']),'tags':_0x21aede||[]};});}})[_0x2a19('0x19')](respondWithResult(_0x4b9205,null))[_0x2a19('0x30')](handleError(_0x4b9205,null));};exports[_0x2a19('0x4e')]=function(_0x4a4997,_0x2f0a1e){return db[_0x2a19('0x2e')][_0x2a19('0x2f')]({'where':{'id':_0x4a4997[_0x2a19('0x25')]['id']}})[_0x2a19('0x19')](handleEntityNotFound(_0x2f0a1e,null))[_0x2a19('0x19')](function(_0x40f275){if(_0x40f275){return _0x40f275[_0x2a19('0x4e')](_0x4a4997[_0x2a19('0x24')][_0x2a19('0x37')]);}})[_0x2a19('0x19')](respondWithStatusCode(_0x2f0a1e,null))[_0x2a19('0x30')](handleError(_0x2f0a1e,null));};exports[_0x2a19('0x4f')]=function(_0x43da11,_0x533176){var _0x40da80=moment()['unix']()[_0x2a19('0x50')]();var _0x3ae559=path['join'](config['root'],'server',_0x2a19('0x51'),_0x2a19('0x52'));var _0x1eec0e=path[_0x2a19('0x53')](_0x3ae559,_0x40da80);var _0x126d55=util[_0x2a19('0x47')]('transcript-%d-%s.zip',_0x43da11[_0x2a19('0x25')]['id'],_0x40da80);var _0x5981d8=path[_0x2a19('0x53')](_0x3ae559,_0x126d55);var _0x86de08=[];_0x86de08[_0x2a19('0x54')]({'model':db[_0x2a19('0x55')],'as':_0x2a19('0x55'),'attributes':['id',_0x2a19('0x56')],'raw':!![]});_0x86de08[_0x2a19('0x54')]({'model':db['CmContact'],'as':_0x2a19('0x57'),'attributes':['id',_0x2a19('0x58'),_0x2a19('0x59')],'raw':!![]});var _0x28641f=[{'model':db[_0x2a19('0x35')],'as':_0x2a19('0x5a'),'attributes':['id','body',_0x2a19('0x5b'),_0x2a19('0x5c'),_0x2a19('0x5d'),_0x2a19('0x5e')],'include':_0x86de08}];_0x28641f['push']({'model':db[_0x2a19('0x5f')],'as':_0x2a19('0x60'),'attributes':['id','name']});_0x28641f['push']({'model':db[_0x2a19('0x55')],'as':_0x2a19('0x61'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x2a19('0x2f')]({'where':{'id':_0x43da11['params']['id']},'include':_0x28641f})[_0x2a19('0x19')](handleEntityNotFound(_0x533176,null))['then'](function(_0x445809){if(_0x445809){var _0x6f0f75=_0x445809[_0x2a19('0x62')]({'plain':!![]});fs['mkdirSync'](_0x1eec0e);var _0x6e2b5c={'channel':_0x2a19('0x63'),'account':_0x6f0f75[_0x2a19('0x60')][_0x2a19('0x1d')],'agent':_0x6f0f75['Owner']?_0x6f0f75['Owner']['fullname']:'N.A.','createdAt':moment(_0x6f0f75[_0x2a19('0x5b')])[_0x2a19('0x47')](_0x2a19('0x48'))['toString'](),'closedAt':_0x6f0f75[_0x2a19('0x64')]?moment(_0x6f0f75['closedAt'])[_0x2a19('0x47')](_0x2a19('0x48'))[_0x2a19('0x50')]():'','disposition':_0x6f0f75['disposition'],'messages':_(_0x6f0f75['Messages'])[_0x2a19('0x45')]({'secret':![]})[_0x2a19('0x44')](function(_0xf7b145){return{'date':moment(_0xf7b145[_0x2a19('0x5b')])[_0x2a19('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2a19('0x50')](),'sender':_0xf7b145[_0x2a19('0x5c')]==='out'?_0xf7b145[_0x2a19('0x55')]?_0xf7b145['User'][_0x2a19('0x56')]:_0x2a19('0x65'):_0xf7b145[_0x2a19('0x57')]['firstName']+(_0xf7b145[_0x2a19('0x57')][_0x2a19('0x59')]?'\x20'+_0xf7b145['Contact']['lastName']:''),'body':_0xf7b145[_0x2a19('0x32')],'direction':_0xf7b145['direction']==='out'?'A':'C','secret':_0xf7b145[_0x2a19('0x5d')],'read':_0xf7b145['read']};})[_0x2a19('0x66')]()};return ejs[_0x2a19('0x67')](path[_0x2a19('0x53')](config[_0x2a19('0x68')],'server','views','downloadInteraction.ejs'),{'interaction':_0x6e2b5c})[_0x2a19('0x19')](function(_0x232239){var _0x3810a1=path[_0x2a19('0x53')](_0x1eec0e,_0x2a19('0x69')+_0x6f0f75['id']+'-'+_0x40da80+_0x2a19('0x6a'));var _0x32afb5={'path':_0x3810a1,'channel':_0x2a19('0x63'),'interactionId':_0x6f0f75['id']};return pdf['createPdfFromHTML'](_0x232239,_0x32afb5);})[_0x2a19('0x19')](function(){return new BPromise(function(_0x5a80ce,_0x50ae20){zipdir(_0x1eec0e,{'saveTo':_0x5981d8},function(_0x5d4cdf,_0x40b007){if(_0x5d4cdf)return _0x50ae20(_0x5d4cdf);return _0x5a80ce(_0x40b007);});})[_0x2a19('0x19')](function(){return new BPromise(function(_0x2d1dc2,_0x5d856d){rimraf(_0x1eec0e,function(_0x3a5b18){if(_0x3a5b18)_0x5d856d(_0x3a5b18);return _0x2d1dc2();});});})[_0x2a19('0x19')](function(){return _0x533176[_0x2a19('0x4f')](_0x5981d8,_0x126d55,function(_0x3959fe){if(_0x3959fe){console['log'](_0x2a19('0x6b'),_0x3959fe);}else{fs[_0x2a19('0x6c')](_0x5981d8);}});});});}else{return _0x533176[_0x2a19('0xf')](0xc8);}})[_0x2a19('0x30')](handleError(_0x533176,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9958465..71d3f48 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 _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x388aed,_0x14fc12){_0x388aed=_0x388aed-0x0;var _0x22ba33=_0xcf2f[_0x388aed];return _0x22ba33;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xa30a=['update','remove','then','setDataValue','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x51ca4c,_0x490f8b){var _0x24979c=function(_0x464406){while(--_0x464406){_0x51ca4c['push'](_0x51ca4c['shift']());}};_0x24979c(++_0x490f8b);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xaa30('0x0'));var SmsInteraction=require(_0xaa30('0x1'))['db'][_0xaa30('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xaa30('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xaa30('0x4')](0x0);var events={'afterCreate':_0xaa30('0x5'),'afterUpdate':_0xaa30('0x6'),'afterDestroy':_0xaa30('0x7')};function emitEvent(_0x271425){return function(_0x102ad7,_0x555947,_0x347cd5){_0x102ad7['getUsers']({'attributes':['id'],'raw':!![]})[_0xaa30('0x8')](function(_0x14fe09){_0x102ad7[_0xaa30('0x9')]('Users',_0x14fe09[_0xaa30('0xa')](function(_0x40dbda){return{'id':_0x40dbda['id']};}));return SmsMessage[_0xaa30('0xb')]({'where':{'SmsInteractionId':_0x102ad7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa30('0x8')](function(_0x14a6a6){_0x102ad7[_0xaa30('0x9')]('unreadMessages',_0x14a6a6['length']);SmsInteractionEvents[_0xaa30('0xc')](_0x271425+':'+_0x102ad7['id'],_0x102ad7);SmsInteractionEvents['emit'](_0x271425,_0x102ad7);_0x347cd5(null);})[_0xaa30('0xd')](_0x347cd5(null));};}for(var e in events){if(events[_0xaa30('0xe')](e)){var event=events[e];SmsInteraction[_0xaa30('0xf')](e,emitEvent(event));}}module[_0xaa30('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 62aabac..4c7eed9 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 _0x9beb=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','changed','closedAt'];(function(_0x55bc8e,_0xd3094b){var _0x35ed1c=function(_0x44a1c9){while(--_0x44a1c9){_0x55bc8e['push'](_0x55bc8e['shift']());}};_0x35ed1c(++_0xd3094b);}(_0x9beb,0x9c));var _0xb9be=function(_0x2bbba3,_0x573b69){_0x2bbba3=_0x2bbba3-0x0;var _0x1f9587=_0x9beb[_0x2bbba3];return _0x1f9587;};'use strict';var _=require(_0xb9be('0x0'));var util=require(_0xb9be('0x1'));var logger=require('../../config/logger')(_0xb9be('0x2'));var moment=require(_0xb9be('0x3'));var BPromise=require(_0xb9be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9be('0x5'));var rimraf=require(_0xb9be('0x6'));var config=require('../../config/environment');var attributes=require(_0xb9be('0x7'));module[_0xb9be('0x8')]=function(_0x356467,_0xf182fd){return _0x356467['define'](_0xb9be('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5147ca,_0x290d4f,_0x2d3fdd){if(_0x5147ca[_0xb9be('0xa')]('closed')){_0x5147ca[_0xb9be('0xb')]=moment()[_0xb9be('0xc')](_0xb9be('0xd'));}_0x2d3fdd(null,_0x5147ca);}}});}; \ No newline at end of file +var _0xc39f=['exports','define','SmsInteraction','sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x25e7bc,_0x6c04a4){var _0x42ecf6=function(_0x5c47df){while(--_0x5c47df){_0x25e7bc['push'](_0x25e7bc['shift']());}};_0x42ecf6(++_0x6c04a4);}(_0xc39f,0x14c));var _0xfc39=function(_0x3c2e9e,_0x32ae4c){_0x3c2e9e=_0x3c2e9e-0x0;var _0x2147a0=_0xc39f[_0x3c2e9e];return _0x2147a0;};'use strict';var _=require(_0xfc39('0x0'));var util=require(_0xfc39('0x1'));var logger=require(_0xfc39('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfc39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc39('0x4'));var config=require(_0xfc39('0x5'));var attributes=require('./smsInteraction.attributes');module[_0xfc39('0x6')]=function(_0x6adadc,_0x1f83e8){return _0x6adadc[_0xfc39('0x7')](_0xfc39('0x8'),attributes,{'tableName':_0xfc39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x202bbd,_0x23c6b2,_0x9d5450){if(_0x202bbd['changed'](_0xfc39('0xa'))){_0x202bbd[_0xfc39('0xb')]=moment()['format'](_0xfc39('0xc'));}_0x9d5450(null,_0x202bbd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1bf22b8..c9780b0 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 _0xeebe=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsInteraction','body','options','attributes','UpdateSmsInteraction','find','omit','ids','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc3c099,_0x4d0c07){var _0x4247bc=function(_0x19d1ae){while(--_0x19d1ae){_0xc3c099['push'](_0xc3c099['shift']());}};_0x4247bc(++_0x4d0c07);}(_0xeebe,0xc5));var _0xeeeb=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xeebe[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xeeeb('0x0'));var util=require('util');var moment=require(_0xeeeb('0x1'));var BPromise=require(_0xeeeb('0x2'));var rs=require(_0xeeeb('0x3'));var fs=require('fs');var Redis=require(_0xeeeb('0x4'));var db=require(_0xeeeb('0x5'))['db'];var utils=require(_0xeeeb('0x6'));var logger=require(_0xeeeb('0x7'))(_0xeeeb('0x8'));var config=require(_0xeeeb('0x9'));var jayson=require(_0xeeeb('0xa'));var client=jayson[_0xeeeb('0xb')][_0xeeeb('0xc')]({'port':0x232a});config[_0xeeeb('0xd')]=_['defaults'](config['redis'],{'host':_0xeeeb('0xe'),'port':0x18eb});var socket=require(_0xeeeb('0xf'))(new Redis(config[_0xeeeb('0xd')]));require(_0xeeeb('0x10'))[_0xeeeb('0x11')](socket);function respondWithRpcPromise(_0x26f034,_0x245d7a,_0x4cdd91){return new BPromise(function(_0x55f358,_0x3c75fc){return client[_0xeeeb('0x12')](_0x26f034,_0x4cdd91)[_0xeeeb('0x13')](function(_0x4790e7){logger[_0xeeeb('0x14')](_0xeeeb('0x15'),_0x245d7a,_0xeeeb('0x16'));logger[_0xeeeb('0x17')](_0xeeeb('0x18'),_0x245d7a,_0xeeeb('0x16'),JSON[_0xeeeb('0x19')](_0x4790e7));if(_0x4790e7[_0xeeeb('0x1a')]){if(_0x4790e7[_0xeeeb('0x1a')][_0xeeeb('0x1b')]===0x1f4){logger['error'](_0xeeeb('0x15'),_0x245d7a,_0x4790e7[_0xeeeb('0x1a')][_0xeeeb('0x1c')]);return _0x3c75fc(_0x4790e7[_0xeeeb('0x1a')]['message']);}logger[_0xeeeb('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x245d7a,_0x4790e7[_0xeeeb('0x1a')][_0xeeeb('0x1c')]);return _0x55f358(_0x4790e7['error'][_0xeeeb('0x1c')]);}else{logger['info'](_0xeeeb('0x15'),_0x245d7a,_0xeeeb('0x16'));_0x55f358(_0x4790e7[_0xeeeb('0x1d')]['message']);}})['catch'](function(_0x37e541){logger[_0xeeeb('0x1a')](_0xeeeb('0x15'),_0x245d7a,_0x37e541);_0x3c75fc(_0x37e541);});});}exports['UpdateSmsInteraction']=function(_0x4301cf){var _0x3c5f5b=this;return new Promise(function(_0x5bd53f,_0x844471){return db[_0xeeeb('0x1e')]['update'](_0x4301cf[_0xeeeb('0x1f')],{'raw':_0x4301cf[_0xeeeb('0x20')]?_0x4301cf[_0xeeeb('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4301cf[_0xeeeb('0x20')]?_0x4301cf[_0xeeeb('0x20')]['where']||null:null,'attributes':_0x4301cf['options']?_0x4301cf[_0xeeeb('0x20')][_0xeeeb('0x21')]||null:null,'limit':_0x4301cf[_0xeeeb('0x20')]?_0x4301cf[_0xeeeb('0x20')]['limit']||null:null})['then'](function(_0x272d33){logger['info'](_0xeeeb('0x22'),_0x4301cf);logger[_0xeeeb('0x17')]('UpdateSmsInteraction',_0x4301cf,JSON[_0xeeeb('0x19')](_0x272d33));_0x5bd53f(_0x272d33);})['catch'](function(_0xc2b578){logger[_0xeeeb('0x1a')](_0xeeeb('0x22'),_0xc2b578[_0xeeeb('0x1c')],_0x4301cf);_0x844471(_0x3c5f5b[_0xeeeb('0x1a')](0x1f4,_0xc2b578[_0xeeeb('0x1c')]));});});};exports['AddTagsToSmsInteraction']=function(_0x5a4676){return new Promise(function(_0x274103,_0x18518d){return db[_0xeeeb('0x1e')][_0xeeeb('0x23')]({'where':_0x5a4676[_0xeeeb('0x20')]?_0x5a4676['options']['where']||null:null})['then'](function(_0x4e5e74){if(_0x4e5e74){return _0x4e5e74['addTags'](_0x5a4676[_0xeeeb('0x1f')]['ids'],_[_0xeeeb('0x24')](_0x5a4676[_0xeeeb('0x1f')],[_0xeeeb('0x25'),'id'])||{});}})[_0xeeeb('0x26')](function(_0xf0478e){logger[_0xeeeb('0x14')](_0xeeeb('0x27'),_0x5a4676);logger['debug']('AddTags',_0x5a4676,JSON[_0xeeeb('0x19')](_0xf0478e));_0x274103(_0xf0478e);})[_0xeeeb('0x28')](function(_0x4a33be){logger[_0xeeeb('0x1a')]('AddTags',_0x4a33be[_0xeeeb('0x1c')],_0x5a4676);_0x18518d(_this[_0xeeeb('0x1a')](0x1f4,_0x4a33be[_0xeeeb('0x1c')]));});});}; \ No newline at end of file +var _0x003d=['./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','SmsInteraction','body','options','raw','attributes','limit','UpdateSmsInteraction','find','where','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x4582e8,_0x45f260){var _0x41d8df=function(_0x3f154){while(--_0x3f154){_0x4582e8['push'](_0x4582e8['shift']());}};_0x41d8df(++_0x45f260);}(_0x003d,0x1ed));var _0xd003=function(_0x41296f,_0x2a9e8c){_0x41296f=_0x41296f-0x0;var _0x188144=_0x003d[_0x41296f];return _0x188144;};'use strict';var _=require('lodash');var util=require(_0xd003('0x0'));var moment=require(_0xd003('0x1'));var BPromise=require(_0xd003('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd003('0x3'));var db=require(_0xd003('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd003('0x5'));var config=require('../../config/environment');var jayson=require(_0xd003('0x6'));var client=jayson[_0xd003('0x7')][_0xd003('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd003('0x9')],{'host':_0xd003('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd003('0xb'))[_0xd003('0xc')](socket);function respondWithRpcPromise(_0x4cafb5,_0x38aa6b,_0x506b1e){return new BPromise(function(_0x18b404,_0x14ee60){return client[_0xd003('0xd')](_0x4cafb5,_0x506b1e)[_0xd003('0xe')](function(_0x60ee5b){logger[_0xd003('0xf')](_0xd003('0x10'),_0x38aa6b,'request\x20sent');logger[_0xd003('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x38aa6b,_0xd003('0x12'),JSON[_0xd003('0x13')](_0x60ee5b));if(_0x60ee5b[_0xd003('0x14')]){if(_0x60ee5b[_0xd003('0x14')]['code']===0x1f4){logger[_0xd003('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x38aa6b,_0x60ee5b['error'][_0xd003('0x15')]);return _0x14ee60(_0x60ee5b['error'][_0xd003('0x15')]);}logger[_0xd003('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x38aa6b,_0x60ee5b[_0xd003('0x14')][_0xd003('0x15')]);return _0x18b404(_0x60ee5b['error'][_0xd003('0x15')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x38aa6b,_0xd003('0x12'));_0x18b404(_0x60ee5b['result'][_0xd003('0x15')]);}})[_0xd003('0x16')](function(_0x273f12){logger[_0xd003('0x14')](_0xd003('0x10'),_0x38aa6b,_0x273f12);_0x14ee60(_0x273f12);});});}exports['UpdateSmsInteraction']=function(_0xbd7e54){var _0x2ea01d=this;return new Promise(function(_0x586782,_0x27a097){return db[_0xd003('0x17')]['update'](_0xbd7e54[_0xd003('0x18')],{'raw':_0xbd7e54[_0xd003('0x19')]?_0xbd7e54[_0xd003('0x19')][_0xd003('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbd7e54[_0xd003('0x19')]?_0xbd7e54[_0xd003('0x19')]['where']||null:null,'attributes':_0xbd7e54[_0xd003('0x19')]?_0xbd7e54['options'][_0xd003('0x1b')]||null:null,'limit':_0xbd7e54[_0xd003('0x19')]?_0xbd7e54[_0xd003('0x19')][_0xd003('0x1c')]||null:null})[_0xd003('0xe')](function(_0x30a9bb){logger[_0xd003('0xf')]('UpdateSmsInteraction',_0xbd7e54);logger[_0xd003('0x11')]('UpdateSmsInteraction',_0xbd7e54,JSON[_0xd003('0x13')](_0x30a9bb));_0x586782(_0x30a9bb);})[_0xd003('0x16')](function(_0x232025){logger[_0xd003('0x14')](_0xd003('0x1d'),_0x232025[_0xd003('0x15')],_0xbd7e54);_0x27a097(_0x2ea01d[_0xd003('0x14')](0x1f4,_0x232025[_0xd003('0x15')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2bd347){return new Promise(function(_0x59f602,_0x3e277b){return db[_0xd003('0x17')][_0xd003('0x1e')]({'where':_0x2bd347[_0xd003('0x19')]?_0x2bd347[_0xd003('0x19')][_0xd003('0x1f')]||null:null})['then'](function(_0x2c9625){if(_0x2c9625){return _0x2c9625[_0xd003('0x20')](_0x2bd347['body'][_0xd003('0x21')],_['omit'](_0x2bd347[_0xd003('0x18')],[_0xd003('0x21'),'id'])||{});}})[_0xd003('0x22')](function(_0x502434){logger['info'](_0xd003('0x23'),_0x2bd347);logger[_0xd003('0x11')](_0xd003('0x23'),_0x2bd347,JSON[_0xd003('0x13')](_0x502434));_0x59f602(_0x502434);})['catch'](function(_0x3bb294){logger[_0xd003('0x14')](_0xd003('0x23'),_0x3bb294[_0xd003('0x15')],_0x2bd347);_0x3e277b(_this[_0xd003('0x14')](0x1f4,_0x3bb294[_0xd003('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 61b2be8..4a9e133 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 _0xbe3f=['smsInteraction:','./smsInteraction.events','update','emit','length'];(function(_0x193f6f,_0x5945ff){var _0x25f1dd=function(_0x1ea884){while(--_0x1ea884){_0x193f6f['push'](_0x193f6f['shift']());}};_0x25f1dd(++_0x5945ff);}(_0xbe3f,0x196));var _0xfbe3=function(_0x48724a,_0x5511da){_0x48724a=_0x48724a-0x0;var _0x1eb741=_0xbe3f[_0x48724a];return _0x1eb741;};'use strict';var SmsInteractionEvents=require(_0xfbe3('0x0'));var events=['save','remove',_0xfbe3('0x1')];function createListener(_0x2a8dcb,_0x47b7e7){return function(_0x52cd2a){_0x47b7e7[_0xfbe3('0x2')](_0x2a8dcb,_0x52cd2a);};}function removeListener(_0x5657e2,_0x481f94){return function(){SmsInteractionEvents['removeListener'](_0x5657e2,_0x481f94);};}exports['register']=function(_0x687f4b){for(var _0x3e6e48=0x0,_0x134d4e=events[_0xfbe3('0x3')];_0x3e6e48<_0x134d4e;_0x3e6e48++){var _0x1685cb=events[_0x3e6e48];var _0x271144=createListener(_0xfbe3('0x4')+_0x1685cb,_0x687f4b);SmsInteractionEvents['on'](_0x1685cb,_0x271144);}}; \ No newline at end of file +var _0xd9fa=['remove','update','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9fa,0x1a6));var _0xad9f=function(_0x130818,_0x2c1b26){_0x130818=_0x130818-0x0;var _0x4f5dad=_0xd9fa[_0x130818];return _0x4f5dad;};'use strict';var SmsInteractionEvents=require(_0xad9f('0x0'));var events=[_0xad9f('0x1'),_0xad9f('0x2'),_0xad9f('0x3')];function createListener(_0xabe14,_0x4cc137){return function(_0x51474f){_0x4cc137[_0xad9f('0x4')](_0xabe14,_0x51474f);};}function removeListener(_0x2f37b2,_0x3f89e3){return function(){SmsInteractionEvents['removeListener'](_0x2f37b2,_0x3f89e3);};}exports[_0xad9f('0x5')]=function(_0x48db84){for(var _0x33c5b3=0x0,_0x21987f=events[_0xad9f('0x6')];_0x33c5b3<_0x21987f;_0x33c5b3++){var _0x17657b=events[_0x33c5b3];var _0x547f17=createListener(_0xad9f('0x7')+_0x17657b,_0x48db84);SmsInteractionEvents['on'](_0x17657b,_0x547f17);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4108156..50cd6bf 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 _0xf274=['get','isAuthenticated','/describe','describe','/:id','tracked','smsmessage:create','create','post','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0xc4f531,_0x333eac){var _0x519cf1=function(_0x111e89){while(--_0x111e89){_0xc4f531['push'](_0xc4f531['shift']());}};_0x519cf1(++_0x333eac);}(_0xf274,0x99));var _0x4f27=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xf274[_0x576170];return _0x397c70;};'use strict';var multer=require('multer');var util=require(_0x4f27('0x0'));var path=require(_0x4f27('0x1'));var timeout=require(_0x4f27('0x2'));var express=require(_0x4f27('0x3'));var router=express[_0x4f27('0x4')]();var fs_extra=require(_0x4f27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4f27('0x6'));var config=require(_0x4f27('0x7'));var controller=require(_0x4f27('0x8'));router[_0x4f27('0x9')]('/',auth[_0x4f27('0xa')](),controller['index']);router[_0x4f27('0x9')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller[_0x4f27('0xc')]);router[_0x4f27('0x9')](_0x4f27('0xd'),auth[_0x4f27('0xa')](),controller['show']);router['post']('/',auth[_0x4f27('0xa')](),interaction[_0x4f27('0xe')]('sms',_0x4f27('0xf')),controller[_0x4f27('0x10')]);router[_0x4f27('0x11')](_0x4f27('0x12'),controller['status']);router[_0x4f27('0x13')](_0x4f27('0xd'),auth[_0x4f27('0xa')](),controller['update']);router[_0x4f27('0x13')](_0x4f27('0x14'),auth[_0x4f27('0xa')](),controller[_0x4f27('0x15')]);router[_0x4f27('0x13')](_0x4f27('0x16'),auth[_0x4f27('0xa')](),controller[_0x4f27('0x17')]);router[_0x4f27('0x18')](_0x4f27('0xd'),auth[_0x4f27('0xa')](),controller[_0x4f27('0x19')]);module[_0x4f27('0x1a')]=router; \ No newline at end of file +var _0xc263=['accept','/:id/reject','reject','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','/:id/accept'];(function(_0x5b5912,_0x433a4c){var _0x5769dc=function(_0x2d60b6){while(--_0x2d60b6){_0x5b5912['push'](_0x5b5912['shift']());}};_0x5769dc(++_0x433a4c);}(_0xc263,0x171));var _0x3c26=function(_0x32ff17,_0xa84cc0){_0x32ff17=_0x32ff17-0x0;var _0x25d9bd=_0xc263[_0x32ff17];return _0x25d9bd;};'use strict';var multer=require(_0x3c26('0x0'));var util=require('util');var path=require(_0x3c26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c26('0x2'));var router=express[_0x3c26('0x3')]();var fs_extra=require(_0x3c26('0x4'));var auth=require(_0x3c26('0x5'));var interaction=require(_0x3c26('0x6'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0x3c26('0x7')](),controller[_0x3c26('0x8')]);router[_0x3c26('0x9')](_0x3c26('0xa'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xb')]);router[_0x3c26('0x9')]('/:id',auth[_0x3c26('0x7')](),controller[_0x3c26('0xc')]);router[_0x3c26('0xd')]('/',auth[_0x3c26('0x7')](),interaction[_0x3c26('0xe')](_0x3c26('0xf'),_0x3c26('0x10')),controller['create']);router['post'](_0x3c26('0x11'),controller[_0x3c26('0x12')]);router[_0x3c26('0x13')](_0x3c26('0x14'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x15')]);router[_0x3c26('0x13')](_0x3c26('0x16'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x17')]);router[_0x3c26('0x13')](_0x3c26('0x18'),auth['isAuthenticated'](),controller[_0x3c26('0x19')]);router[_0x3c26('0x1a')]('/:id',auth[_0x3c26('0x7')](),controller['destroy']);module[_0x3c26('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4a08885..bdae36b 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 _0xa39b=['TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize','exports'];(function(_0x58d8e3,_0x3abbbb){var _0x53daa5=function(_0x49f456){while(--_0x49f456){_0x58d8e3['push'](_0x58d8e3['shift']());}};_0x53daa5(++_0x3abbbb);}(_0xa39b,0xee));var _0xba39=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa39b[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xba39('0x0'));module[_0xba39('0x1')]={'body':{'type':Sequelize[_0xba39('0x2')](_0xba39('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xba39('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xba39('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xba39('0x6')](0xbe)},'phone':{'type':Sequelize[_0xba39('0x6')]},'readAt':{'type':Sequelize[_0xba39('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xba39('0x6')]},'providerResponse':{'type':Sequelize[_0xba39('0x2')]}}; \ No newline at end of file +var _0x6f0d=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x6f0d,0x1e5));var _0xd6f0=function(_0x201837,_0x32209c){_0x201837=_0x201837-0x0;var _0x123476=_0x6f0d[_0x201837];return _0x123476;};'use strict';var Sequelize=require(_0xd6f0('0x0'));module['exports']={'body':{'type':Sequelize[_0xd6f0('0x1')](_0xd6f0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd6f0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6f0('0x4')]('in',_0xd6f0('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd6f0('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd6f0('0x6')]},'readAt':{'type':Sequelize[_0xd6f0('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index dea55d9..80d0eaa 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 _0xf369=['SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','sent','delivered','Status','plivio','infobip','results','groupName','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','stack','name','send','index','map','SmsMessage','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','describe','accept','sms','acceptMessage','UserId','user','agent','find','get','SmsInteraction','SmsInteractionId','interaction','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','fullname','email','internal','interface','format'];(function(_0x5ed0f8,_0x5207c4){var _0x4aef1a=function(_0x341db7){while(--_0x341db7){_0x5ed0f8['push'](_0x5ed0f8['shift']());}};_0x4aef1a(++_0x5207c4);}(_0xf369,0x104));var _0x9f36=function(_0x944768,_0x4fae3a){_0x944768=_0x944768-0x0;var _0x488ed6=_0xf369[_0x944768];return _0x488ed6;};'use strict';var util=require(_0x9f36('0x0'));var _=require(_0x9f36('0x1'));var Redis=require(_0x9f36('0x2'));var interactionService=require(_0x9f36('0x3'));var qs=require(_0x9f36('0x4'));var logger=require(_0x9f36('0x5'))(_0x9f36('0x6'));var config=require(_0x9f36('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9f36('0x8')](config[_0x9f36('0x9')],{'host':_0x9f36('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f36('0x9')]));require(_0x9f36('0xb'))[_0x9f36('0xc')](socket);var jayson=require(_0x9f36('0xd'));var client=jayson[_0x9f36('0xe')][_0x9f36('0xf')]({'port':0x232c});var client9002=jayson[_0x9f36('0xe')][_0x9f36('0xf')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x9f36('0x10'));function respondWithRpcPromise(_0x285837,_0xbfcc87,_0xce6cea,_0x403003){return new Promise(function(_0x16512a,_0x3d6c85){var _0x4a6978=_0x403003||client;return _0x4a6978[_0x9f36('0x11')](_0x285837,_0xce6cea)[_0x9f36('0x12')](function(_0x29b490){logger[_0x9f36('0x13')](_0x9f36('0x14'),_0xbfcc87,_0x9f36('0x15'));logger['debug'](_0x9f36('0x16'),_0xbfcc87,_0x9f36('0x15'),JSON[_0x9f36('0x17')](_0x29b490));if(_0x29b490[_0x9f36('0x18')]){if(_0x29b490['error']['code']===0x1f4){logger[_0x9f36('0x18')](_0x9f36('0x14'),_0xbfcc87,_0x29b490['error'][_0x9f36('0x19')]);return _0x3d6c85(_0x29b490[_0x9f36('0x18')][_0x9f36('0x19')]);}logger[_0x9f36('0x18')]('SmsMessage,\x20%s,\x20%s',_0xbfcc87,_0x29b490['error'][_0x9f36('0x19')]);return _0x16512a(_0x29b490[_0x9f36('0x18')]['message']);}else{logger[_0x9f36('0x13')](_0x9f36('0x14'),_0xbfcc87,_0x9f36('0x15'));_0x16512a(_0x29b490['result'][_0x9f36('0x19')]);}})[_0x9f36('0x1a')](function(_0x1ee009){logger[_0x9f36('0x18')]('SmsMessage,\x20%s,\x20%s',_0xbfcc87,_0x1ee009);_0x3d6c85(_0x1ee009);});});}function respondWithResult(_0x1d03e1,_0x293b50){_0x293b50=_0x293b50||0xc8;return function(_0x5e9652){if(_0x5e9652){return _0x1d03e1[_0x9f36('0x1b')](_0x293b50)[_0x9f36('0x1c')](_0x5e9652);}};}function respondWithFilteredResult(_0x51effc,_0x1f7d8e){return function(_0x2a9cfd){if(_0x2a9cfd){var _0x141523=typeof _0x1f7d8e['offset']===_0x9f36('0x1d')&&typeof _0x1f7d8e[_0x9f36('0x1e')]===_0x9f36('0x1d');var _0xb81548=_0x2a9cfd[_0x9f36('0x1f')];var _0x3c9053=_0x141523?0x0:_0x1f7d8e[_0x9f36('0x20')];var _0xd1413b=_0x141523?_0x2a9cfd[_0x9f36('0x1f')]:_0x1f7d8e[_0x9f36('0x20')]+_0x1f7d8e[_0x9f36('0x1e')];var _0x177a5c;if(_0xd1413b>=_0xb81548){_0xd1413b=_0xb81548;_0x177a5c=0xc8;}else{_0x177a5c=0xce;}_0x51effc[_0x9f36('0x1b')](_0x177a5c);return _0x51effc[_0x9f36('0x21')](_0x9f36('0x22'),_0x3c9053+'-'+_0xd1413b+'/'+_0xb81548)[_0x9f36('0x1c')](_0x2a9cfd);}return null;};}function saveUpdates(_0x26f00a){return function(_0xbe319c){if(_0xbe319c){return _0xbe319c[_0x9f36('0x23')](_0x26f00a)[_0x9f36('0x12')](function(_0x52dfa9){return _0x52dfa9;});}return null;};}function removeEntity(_0x3b22a5){return function(_0x5215ab){if(_0x5215ab){return _0x5215ab[_0x9f36('0x24')]()['then'](function(){_0x3b22a5['status'](0xcc)[_0x9f36('0x25')]();});}};}function handleEntityNotFound(_0x285a41){return function(_0x590a7e){if(!_0x590a7e){_0x285a41['sendStatus'](0x194);}return _0x590a7e;};}function handleError(_0x313252,_0x22f9af){_0x22f9af=_0x22f9af||0x1f4;return function(_0x40809c){logger[_0x9f36('0x18')](_0x40809c[_0x9f36('0x26')]);if(_0x40809c[_0x9f36('0x27')]){delete _0x40809c['name'];}_0x313252[_0x9f36('0x1b')](_0x22f9af)[_0x9f36('0x28')](_0x40809c);};}exports[_0x9f36('0x29')]=function(_0x60b156,_0x5f3ee0){var _0x2be6c9={},_0x396af2={},_0x5e4048={'count':0x0,'rows':[]};var _0x255a85=_[_0x9f36('0x2a')](db[_0x9f36('0x2b')]['rawAttributes'],function(_0x395afb){return{'name':_0x395afb['fieldName'],'type':_0x395afb['type'][_0x9f36('0x2c')]};});_0x396af2[_0x9f36('0x2d')]=_[_0x9f36('0x2a')](_0x255a85,_0x9f36('0x27'));_0x396af2['query']=_[_0x9f36('0x2e')](_0x60b156[_0x9f36('0x2f')]);_0x396af2['filters']=_[_0x9f36('0x30')](_0x396af2[_0x9f36('0x2d')],_0x396af2[_0x9f36('0x2f')]);_0x2be6c9[_0x9f36('0x31')]=_[_0x9f36('0x30')](_0x396af2['model'],qs[_0x9f36('0x32')](_0x60b156['query'][_0x9f36('0x32')]));_0x2be6c9['attributes']=_0x2be6c9['attributes'][_0x9f36('0x33')]?_0x2be6c9['attributes']:_0x396af2[_0x9f36('0x2d')];if(!_0x60b156[_0x9f36('0x2f')][_0x9f36('0x34')](_0x9f36('0x35'))){_0x2be6c9['limit']=qs[_0x9f36('0x1e')](_0x60b156[_0x9f36('0x2f')][_0x9f36('0x1e')]);_0x2be6c9[_0x9f36('0x20')]=qs[_0x9f36('0x20')](_0x60b156[_0x9f36('0x2f')][_0x9f36('0x20')]);}_0x2be6c9[_0x9f36('0x36')]=qs[_0x9f36('0x37')](_0x60b156[_0x9f36('0x2f')][_0x9f36('0x37')]);_0x2be6c9[_0x9f36('0x38')]=qs[_0x9f36('0x39')](_[_0x9f36('0x3a')](_0x60b156[_0x9f36('0x2f')],_0x396af2[_0x9f36('0x39')]),_0x255a85);if(_0x60b156['query']['filter']){_0x2be6c9[_0x9f36('0x38')]=_[_0x9f36('0x3b')](_0x2be6c9[_0x9f36('0x38')],{'$or':_[_0x9f36('0x2a')](_0x255a85,function(_0x52d19f){if(_0x52d19f[_0x9f36('0x3c')]!==_0x9f36('0x3d')){var _0xc4a43c={};_0xc4a43c[_0x52d19f['name']]={'$like':'%'+_0x60b156['query'][_0x9f36('0x3e')]+'%'};return _0xc4a43c;}})});}_0x2be6c9=_['merge']({},_0x2be6c9,_0x60b156[_0x9f36('0x3f')]);var _0x5e4c54={'where':_0x2be6c9[_0x9f36('0x38')]};return db[_0x9f36('0x2b')][_0x9f36('0x1f')](_0x5e4c54)[_0x9f36('0x12')](function(_0x25f68d){_0x5e4048[_0x9f36('0x1f')]=_0x25f68d;if(_0x60b156['query'][_0x9f36('0x40')]){_0x2be6c9[_0x9f36('0x41')]=[{'all':!![]}];}return db[_0x9f36('0x2b')][_0x9f36('0x42')](_0x2be6c9);})[_0x9f36('0x12')](function(_0x3dfb27){_0x5e4048[_0x9f36('0x43')]=_0x3dfb27;return _0x5e4048;})['then'](respondWithFilteredResult(_0x5f3ee0,_0x2be6c9))[_0x9f36('0x1a')](handleError(_0x5f3ee0,null));};exports[_0x9f36('0x44')]=function(_0x2be5fe,_0x8e80e4){var _0x5b98ab={'raw':!![],'where':{'id':_0x2be5fe[_0x9f36('0x45')]['id']}},_0x3aea17={};_0x3aea17[_0x9f36('0x2d')]=_[_0x9f36('0x2e')](db[_0x9f36('0x2b')][_0x9f36('0x46')]);_0x3aea17[_0x9f36('0x2f')]=_[_0x9f36('0x2e')](_0x2be5fe[_0x9f36('0x2f')]);_0x3aea17['filters']=_[_0x9f36('0x30')](_0x3aea17['model'],_0x3aea17[_0x9f36('0x2f')]);_0x5b98ab['attributes']=_['intersection'](_0x3aea17[_0x9f36('0x2d')],qs[_0x9f36('0x32')](_0x2be5fe[_0x9f36('0x2f')][_0x9f36('0x32')]));_0x5b98ab['attributes']=_0x5b98ab['attributes'][_0x9f36('0x33')]?_0x5b98ab[_0x9f36('0x31')]:_0x3aea17[_0x9f36('0x2d')];if(_0x2be5fe[_0x9f36('0x2f')][_0x9f36('0x40')]){_0x5b98ab[_0x9f36('0x41')]=[{'all':!![]}];}_0x5b98ab=_['merge']({},_0x5b98ab,_0x2be5fe[_0x9f36('0x3f')]);return db[_0x9f36('0x2b')]['find'](_0x5b98ab)[_0x9f36('0x12')](handleEntityNotFound(_0x8e80e4,null))[_0x9f36('0x12')](respondWithResult(_0x8e80e4,null))[_0x9f36('0x1a')](handleError(_0x8e80e4,null));};exports[_0x9f36('0x47')]=function(_0x275342,_0x2efe62){return db[_0x9f36('0x2b')][_0x9f36('0x47')](_0x275342['body'],{})[_0x9f36('0x12')](respondWithResult(_0x2efe62,0xc9))[_0x9f36('0x1a')](handleError(_0x2efe62,null));};exports['update']=function(_0x2b721f,_0x323987){if(_0x2b721f[_0x9f36('0x48')]['id']){delete _0x2b721f[_0x9f36('0x48')]['id'];}return db[_0x9f36('0x2b')]['find']({'where':{'id':_0x2b721f[_0x9f36('0x45')]['id']}})[_0x9f36('0x12')](handleEntityNotFound(_0x323987,null))['then'](saveUpdates(_0x2b721f['body'],null))[_0x9f36('0x12')](respondWithResult(_0x323987,null))[_0x9f36('0x1a')](handleError(_0x323987,null));};exports[_0x9f36('0x24')]=function(_0x222624,_0x44e472){return db[_0x9f36('0x2b')]['find']({'where':{'id':_0x222624['params']['id']}})[_0x9f36('0x12')](handleEntityNotFound(_0x44e472,null))[_0x9f36('0x12')](removeEntity(_0x44e472,null))[_0x9f36('0x1a')](handleError(_0x44e472,null));};exports['describe']=function(_0x4158f1,_0x5a2428){return db[_0x9f36('0x2b')][_0x9f36('0x49')]()['then'](respondWithResult(_0x5a2428,null))[_0x9f36('0x1a')](handleError(_0x5a2428,null));};exports[_0x9f36('0x4a')]=function(_0x327af9,_0x2d902d){var _0x31c57=_0x9f36('0x4b');return interactionService[_0x9f36('0x4c')](_0x327af9,_0x31c57)[_0x9f36('0x12')](respondWithResult(_0x2d902d,null))[_0x9f36('0x1a')](handleError(_0x2d902d,null));};exports['reject']=function(_0x2b7fc2,_0x5b751b){var _0x31a31c={'agent':{},'channel':'sms'};if(_0x2b7fc2['body']['id']){delete _0x2b7fc2[_0x9f36('0x48')]['id'];}_0x2b7fc2['body'][_0x9f36('0x4d')]=_0x2b7fc2[_0x9f36('0x48')][_0x9f36('0x4d')]||_0x2b7fc2[_0x9f36('0x4e')]['id'];_0x31a31c[_0x9f36('0x4f')]['id']=_0x2b7fc2['body']['UserId'];return db['SmsMessage'][_0x9f36('0x50')]({'where':{'id':_0x2b7fc2[_0x9f36('0x45')]['id'],'UserId':null}})[_0x9f36('0x12')](handleEntityNotFound(_0x5b751b,null))[_0x9f36('0x12')](function(_0x234dbd){if(_0x234dbd){_0x31a31c[_0x9f36('0x19')]=_0x234dbd[_0x9f36('0x51')]({'plain':!![]});return db[_0x9f36('0x52')][_0x9f36('0x50')]({'where':{'id':_0x234dbd[_0x9f36('0x53')]}});}return null;})[_0x9f36('0x12')](handleEntityNotFound(_0x5b751b,null))['then'](function(_0x364f65){if(_0x364f65){_0x31a31c[_0x9f36('0x54')]=_0x364f65[_0x9f36('0x51')]({'plain':!![]});interaction_log[_0x9f36('0x13')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b7fc2['user']['id'],_0x2b7fc2[_0x9f36('0x4e')][_0x9f36('0x27')],_0x2b7fc2['user'][_0x9f36('0x55')],_0x31a31c[_0x9f36('0x54')]['id'],_0x2b7fc2[_0x9f36('0x48')]?JSON['stringify'](_0x2b7fc2[_0x9f36('0x48')]):'null');return respondWithRpcPromise(_0x9f36('0x56'),_0x9f36('0x57'),_0x31a31c);}return null;})['then'](function(_0x1679be){var _0x5cd8d2=_0x9f36('0x58')+_0x1679be[_0x9f36('0x19')][_0x9f36('0x59')];return db[_0x9f36('0x5a')][_0x9f36('0x2f')](_0x5cd8d2,{'type':db['Sequelize']['QueryTypes'][_0x9f36('0x5b')],'raw':!![]})[_0x9f36('0x12')](function(_0x4d1a9d){return _0x4d1a9d;});})['then'](function(_0x525ab5){if(_0x525ab5){_0x31a31c['message']['contact']=_0x525ab5[0x0];if(!_0x2b7fc2[_0x9f36('0x48')][_0x9f36('0x4d')])return;return db['User']['find']({'where':{'id':_0x2b7fc2[_0x9f36('0x48')]['UserId'],'role':_0x9f36('0x4f')},'attributes':['id',_0x9f36('0x27'),_0x9f36('0x5c'),_0x9f36('0x5d'),_0x9f36('0x5e')],'raw':!![]});}return null;})['then'](function(_0x40601a){if(!_0x40601a)return null;_0x31a31c[_0x9f36('0x19')][_0x9f36('0x4f')]=_0x40601a;return _0x31a31c;})[_0x9f36('0x12')](function(_0x49300d){if(_0x49300d){_0x49300d['message'][_0x9f36('0x5f')]=util[_0x9f36('0x60')](_0x9f36('0x61'),_0x2b7fc2[_0x9f36('0x4e')]['name']);_0x49300d[_0x9f36('0x19')]['channel']=_0x31a31c[_0x9f36('0x62')];_0x49300d[_0x9f36('0x19')][_0x9f36('0x63')]=_0x31a31c['channel'];_0x49300d[_0x9f36('0x19')]['event']=_0x9f36('0x64');respondWithRpcPromise('EventManager',_0x9f36('0x65'),{'event':_0x9f36('0x66'),'message':_0x49300d['message']},client9002);return _0x31a31c;}return null;})[_0x9f36('0x12')](respondWithResult(_0x5b751b,null))[_0x9f36('0x1a')](handleError(_0x5b751b,null));};exports['status']=function(_0x48518c,_0x11717){if(_0x48518c['body']['id']){delete _0x48518c['body']['id'];}var _0x4d414f;return db[_0x9f36('0x2b')][_0x9f36('0x50')]({'where':{'id':_0x48518c[_0x9f36('0x45')]['id']}})[_0x9f36('0x12')](handleEntityNotFound(_0x11717,null))[_0x9f36('0x12')](function(_0x2141d6){if(_0x2141d6){_0x4d414f=_0x2141d6;return db[_0x9f36('0x67')][_0x9f36('0x50')]({'where':{'id':_0x2141d6[_0x9f36('0x68')]}});}})[_0x9f36('0x12')](handleEntityNotFound(_0x11717,null))['then'](function(_0x37292c){if(_0x37292c){logger[_0x9f36('0x69')](_0x9f36('0x16'),'status',_0x9f36('0x6a'),_0x37292c['type'],util['inspect'](_0x48518c['body'],{'showHidden':![],'depth':null}));switch(_0x37292c[_0x9f36('0x3c')]){case'twilio':if(_0x48518c[_0x9f36('0x48')][_0x9f36('0x6b')]&&_0x48518c['body']['MessageSid']===_0x4d414f[_0x9f36('0x6c')]){return _0x4d414f[_0x9f36('0x23')]({'read':!![]});}else{logger['error'](_0x9f36('0x6d'),_0x9f36('0x1b'),'twilio',util[_0x9f36('0x6e')](_0x48518c[_0x9f36('0x48')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x48518c[_0x9f36('0x48')][_0x9f36('0x6f')]&&_0x48518c[_0x9f36('0x48')][_0x9f36('0x6f')]===_0x4d414f[_0x9f36('0x6c')]&&_['indexOf']([_0x9f36('0x70'),_0x9f36('0x71')],_0x48518c[_0x9f36('0x48')][_0x9f36('0x72')])>=0x0){return _0x4d414f[_0x9f36('0x23')]({'read':!![]});}else{logger[_0x9f36('0x18')](_0x9f36('0x6d'),_0x9f36('0x1b'),_0x9f36('0x73'),util[_0x9f36('0x6e')](_0x48518c[_0x9f36('0x48')],{'showHidden':![],'depth':null}));}break;case _0x9f36('0x74'):var _0x5c2ef8=_0x48518c[_0x9f36('0x48')][_0x9f36('0x75')][0x0];if(_0x5c2ef8[_0x9f36('0x1b')][_0x9f36('0x76')]==='DELIVERED'){return _0x4d414f[_0x9f36('0x23')]({'read':!![]});}else{logger[_0x9f36('0x18')](_0x9f36('0x6d'),_0x9f36('0x1b'),_0x9f36('0x74'),util['inspect'](_0x48518c[_0x9f36('0x48')],{'showHidden':![],'depth':null}));}break;}return _0x4d414f;}})[_0x9f36('0x12')](respondWithResult(_0x11717,null))[_0x9f36('0x1a')](handleError(_0x11717,null));}; \ No newline at end of file +var _0x08a2=['debug','request\x20sent','error','code','message','json','offset','undefined','limit','count','status','Content-Range','update','destroy','end','sendStatus','stack','name','map','SmsMessage','fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','rawAttributes','body','catch','find','describe','sms','reject','UserId','user','get','SmsInteraction','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','interface','format','motionChannel','channel','event','EventManager','params','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x1d11e1,_0x403e51){var _0x52350d=function(_0x4885d5){while(--_0x4885d5){_0x1d11e1['push'](_0x1d11e1['shift']());}};_0x52350d(++_0x403e51);}(_0x08a2,0xd2));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x208a('0x0'));var interactionService=require(_0x208a('0x1'));var qs=require(_0x208a('0x2'));var logger=require(_0x208a('0x3'))(_0x208a('0x4'));var config=require(_0x208a('0x5'));var db=require('../../mysqldb')['db'];config[_0x208a('0x6')]=_[_0x208a('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x208a('0x8'))(new Redis(config[_0x208a('0x6')]));require('./smsMessage.socket')[_0x208a('0x9')](socket);var jayson=require(_0x208a('0xa'));var client=jayson[_0x208a('0xb')][_0x208a('0xc')]({'port':0x232c});var client9002=jayson[_0x208a('0xb')][_0x208a('0xc')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x410fe8,_0x2b281d,_0x161e63,_0x4c5c10){return new Promise(function(_0x4543f7,_0x58a0df){var _0x376dbf=_0x4c5c10||client;return _0x376dbf['request'](_0x410fe8,_0x161e63)[_0x208a('0xd')](function(_0x4767eb){logger[_0x208a('0xe')](_0x208a('0xf'),_0x2b281d,'request\x20sent');logger[_0x208a('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2b281d,_0x208a('0x11'),JSON['stringify'](_0x4767eb));if(_0x4767eb[_0x208a('0x12')]){if(_0x4767eb[_0x208a('0x12')][_0x208a('0x13')]===0x1f4){logger[_0x208a('0x12')]('SmsMessage,\x20%s,\x20%s',_0x2b281d,_0x4767eb[_0x208a('0x12')][_0x208a('0x14')]);return _0x58a0df(_0x4767eb[_0x208a('0x12')][_0x208a('0x14')]);}logger[_0x208a('0x12')](_0x208a('0xf'),_0x2b281d,_0x4767eb[_0x208a('0x12')][_0x208a('0x14')]);return _0x4543f7(_0x4767eb[_0x208a('0x12')][_0x208a('0x14')]);}else{logger[_0x208a('0xe')](_0x208a('0xf'),_0x2b281d,'request\x20sent');_0x4543f7(_0x4767eb['result'][_0x208a('0x14')]);}})['catch'](function(_0x352dc0){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2b281d,_0x352dc0);_0x58a0df(_0x352dc0);});});}function respondWithResult(_0x2db08a,_0x487d20){_0x487d20=_0x487d20||0xc8;return function(_0x27c875){if(_0x27c875){return _0x2db08a['status'](_0x487d20)[_0x208a('0x15')](_0x27c875);}};}function respondWithFilteredResult(_0x5e8457,_0x160f04){return function(_0xca3277){if(_0xca3277){var _0x4d86cb=typeof _0x160f04[_0x208a('0x16')]===_0x208a('0x17')&&typeof _0x160f04[_0x208a('0x18')]===_0x208a('0x17');var _0x174357=_0xca3277[_0x208a('0x19')];var _0x157843=_0x4d86cb?0x0:_0x160f04['offset'];var _0x39cf94=_0x4d86cb?_0xca3277['count']:_0x160f04[_0x208a('0x16')]+_0x160f04[_0x208a('0x18')];var _0x1e18ec;if(_0x39cf94>=_0x174357){_0x39cf94=_0x174357;_0x1e18ec=0xc8;}else{_0x1e18ec=0xce;}_0x5e8457[_0x208a('0x1a')](_0x1e18ec);return _0x5e8457['set'](_0x208a('0x1b'),_0x157843+'-'+_0x39cf94+'/'+_0x174357)[_0x208a('0x15')](_0xca3277);}return null;};}function saveUpdates(_0x23a0b1){return function(_0x37b7a2){if(_0x37b7a2){return _0x37b7a2[_0x208a('0x1c')](_0x23a0b1)[_0x208a('0xd')](function(_0x4d0059){return _0x4d0059;});}return null;};}function removeEntity(_0x4aa757){return function(_0x3c9c26){if(_0x3c9c26){return _0x3c9c26[_0x208a('0x1d')]()[_0x208a('0xd')](function(){_0x4aa757[_0x208a('0x1a')](0xcc)[_0x208a('0x1e')]();});}};}function handleEntityNotFound(_0x1eeec4){return function(_0x143aa8){if(!_0x143aa8){_0x1eeec4[_0x208a('0x1f')](0x194);}return _0x143aa8;};}function handleError(_0x2a477b,_0x591895){_0x591895=_0x591895||0x1f4;return function(_0xbdccf8){logger[_0x208a('0x12')](_0xbdccf8[_0x208a('0x20')]);if(_0xbdccf8[_0x208a('0x21')]){delete _0xbdccf8[_0x208a('0x21')];}_0x2a477b[_0x208a('0x1a')](_0x591895)['send'](_0xbdccf8);};}exports['index']=function(_0x339a4b,_0x41d2c6){var _0x1eae26={},_0x27a7b3={},_0x3f2a89={'count':0x0,'rows':[]};var _0x5c16d6=_[_0x208a('0x22')](db[_0x208a('0x23')]['rawAttributes'],function(_0x6b609a){return{'name':_0x6b609a[_0x208a('0x24')],'type':_0x6b609a['type'][_0x208a('0x25')]};});_0x27a7b3['model']=_[_0x208a('0x22')](_0x5c16d6,_0x208a('0x21'));_0x27a7b3['query']=_[_0x208a('0x26')](_0x339a4b[_0x208a('0x27')]);_0x27a7b3['filters']=_[_0x208a('0x28')](_0x27a7b3[_0x208a('0x29')],_0x27a7b3[_0x208a('0x27')]);_0x1eae26['attributes']=_[_0x208a('0x28')](_0x27a7b3[_0x208a('0x29')],qs[_0x208a('0x2a')](_0x339a4b[_0x208a('0x27')][_0x208a('0x2a')]));_0x1eae26[_0x208a('0x2b')]=_0x1eae26['attributes'][_0x208a('0x2c')]?_0x1eae26[_0x208a('0x2b')]:_0x27a7b3[_0x208a('0x29')];if(!_0x339a4b[_0x208a('0x27')][_0x208a('0x2d')](_0x208a('0x2e'))){_0x1eae26['limit']=qs['limit'](_0x339a4b['query'][_0x208a('0x18')]);_0x1eae26[_0x208a('0x16')]=qs[_0x208a('0x16')](_0x339a4b[_0x208a('0x27')][_0x208a('0x16')]);}_0x1eae26[_0x208a('0x2f')]=qs[_0x208a('0x30')](_0x339a4b[_0x208a('0x27')]['sort']);_0x1eae26[_0x208a('0x31')]=qs['filters'](_[_0x208a('0x32')](_0x339a4b[_0x208a('0x27')],_0x27a7b3[_0x208a('0x33')]),_0x5c16d6);if(_0x339a4b[_0x208a('0x27')]['filter']){_0x1eae26[_0x208a('0x31')]=_[_0x208a('0x34')](_0x1eae26['where'],{'$or':_['map'](_0x5c16d6,function(_0x42bbfa){if(_0x42bbfa[_0x208a('0x35')]!==_0x208a('0x36')){var _0x1a8f45={};_0x1a8f45[_0x42bbfa[_0x208a('0x21')]]={'$like':'%'+_0x339a4b['query'][_0x208a('0x37')]+'%'};return _0x1a8f45;}})});}_0x1eae26=_['merge']({},_0x1eae26,_0x339a4b[_0x208a('0x38')]);var _0x29fb78={'where':_0x1eae26[_0x208a('0x31')]};return db[_0x208a('0x23')][_0x208a('0x19')](_0x29fb78)[_0x208a('0xd')](function(_0xe7762){_0x3f2a89[_0x208a('0x19')]=_0xe7762;if(_0x339a4b['query'][_0x208a('0x39')]){_0x1eae26[_0x208a('0x3a')]=[{'all':!![]}];}return db[_0x208a('0x23')][_0x208a('0x3b')](_0x1eae26);})['then'](function(_0x277627){_0x3f2a89[_0x208a('0x3c')]=_0x277627;return _0x3f2a89;})[_0x208a('0xd')](respondWithFilteredResult(_0x41d2c6,_0x1eae26))['catch'](handleError(_0x41d2c6,null));};exports[_0x208a('0x3d')]=function(_0x13d003,_0x53c5f8){var _0x5ac972={'raw':!![],'where':{'id':_0x13d003['params']['id']}},_0x1955a3={};_0x1955a3[_0x208a('0x29')]=_['keys'](db['SmsMessage'][_0x208a('0x3e')]);_0x1955a3[_0x208a('0x27')]=_[_0x208a('0x26')](_0x13d003[_0x208a('0x27')]);_0x1955a3['filters']=_['intersection'](_0x1955a3[_0x208a('0x29')],_0x1955a3[_0x208a('0x27')]);_0x5ac972[_0x208a('0x2b')]=_['intersection'](_0x1955a3['model'],qs[_0x208a('0x2a')](_0x13d003['query'][_0x208a('0x2a')]));_0x5ac972['attributes']=_0x5ac972[_0x208a('0x2b')][_0x208a('0x2c')]?_0x5ac972['attributes']:_0x1955a3['model'];if(_0x13d003[_0x208a('0x27')][_0x208a('0x39')]){_0x5ac972[_0x208a('0x3a')]=[{'all':!![]}];}_0x5ac972=_[_0x208a('0x34')]({},_0x5ac972,_0x13d003[_0x208a('0x38')]);return db[_0x208a('0x23')]['find'](_0x5ac972)[_0x208a('0xd')](handleEntityNotFound(_0x53c5f8,null))[_0x208a('0xd')](respondWithResult(_0x53c5f8,null))['catch'](handleError(_0x53c5f8,null));};exports['create']=function(_0x5dc4d3,_0x1c03f0){return db[_0x208a('0x23')]['create'](_0x5dc4d3[_0x208a('0x3f')],{})[_0x208a('0xd')](respondWithResult(_0x1c03f0,0xc9))[_0x208a('0x40')](handleError(_0x1c03f0,null));};exports[_0x208a('0x1c')]=function(_0xa6dfd4,_0x2241e4){if(_0xa6dfd4['body']['id']){delete _0xa6dfd4['body']['id'];}return db[_0x208a('0x23')][_0x208a('0x41')]({'where':{'id':_0xa6dfd4['params']['id']}})[_0x208a('0xd')](handleEntityNotFound(_0x2241e4,null))['then'](saveUpdates(_0xa6dfd4['body'],null))['then'](respondWithResult(_0x2241e4,null))[_0x208a('0x40')](handleError(_0x2241e4,null));};exports[_0x208a('0x1d')]=function(_0x397ffa,_0x147abf){return db[_0x208a('0x23')][_0x208a('0x41')]({'where':{'id':_0x397ffa['params']['id']}})[_0x208a('0xd')](handleEntityNotFound(_0x147abf,null))['then'](removeEntity(_0x147abf,null))[_0x208a('0x40')](handleError(_0x147abf,null));};exports[_0x208a('0x42')]=function(_0xf57255,_0x6838b7){return db['SmsMessage'][_0x208a('0x42')]()[_0x208a('0xd')](respondWithResult(_0x6838b7,null))['catch'](handleError(_0x6838b7,null));};exports['accept']=function(_0x1d4e8b,_0x1e88f7){var _0x1d15aa=_0x208a('0x43');return interactionService['acceptMessage'](_0x1d4e8b,_0x1d15aa)[_0x208a('0xd')](respondWithResult(_0x1e88f7,null))[_0x208a('0x40')](handleError(_0x1e88f7,null));};exports[_0x208a('0x44')]=function(_0x5bcd93,_0x20b7a9){var _0x51849f={'agent':{},'channel':_0x208a('0x43')};if(_0x5bcd93[_0x208a('0x3f')]['id']){delete _0x5bcd93[_0x208a('0x3f')]['id'];}_0x5bcd93['body'][_0x208a('0x45')]=_0x5bcd93[_0x208a('0x3f')][_0x208a('0x45')]||_0x5bcd93[_0x208a('0x46')]['id'];_0x51849f['agent']['id']=_0x5bcd93[_0x208a('0x3f')][_0x208a('0x45')];return db[_0x208a('0x23')][_0x208a('0x41')]({'where':{'id':_0x5bcd93['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x20b7a9,null))['then'](function(_0x5b94ae){if(_0x5b94ae){_0x51849f[_0x208a('0x14')]=_0x5b94ae[_0x208a('0x47')]({'plain':!![]});return db[_0x208a('0x48')][_0x208a('0x41')]({'where':{'id':_0x5b94ae['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x20b7a9,null))['then'](function(_0x4d89b5){if(_0x4d89b5){_0x51849f[_0x208a('0x49')]=_0x4d89b5[_0x208a('0x47')]({'plain':!![]});interaction_log['info'](_0x208a('0x4a'),_0x5bcd93['user']['id'],_0x5bcd93['user'][_0x208a('0x21')],_0x5bcd93[_0x208a('0x46')][_0x208a('0x4b')],_0x51849f[_0x208a('0x49')]['id'],_0x5bcd93[_0x208a('0x3f')]?JSON[_0x208a('0x4c')](_0x5bcd93[_0x208a('0x3f')]):_0x208a('0x4d'));return respondWithRpcPromise(_0x208a('0x4e'),_0x208a('0x4f'),_0x51849f);}return null;})[_0x208a('0xd')](function(_0x5355f6){var _0x5774a3=_0x208a('0x50')+_0x5355f6[_0x208a('0x14')][_0x208a('0x51')];return db[_0x208a('0x52')][_0x208a('0x27')](_0x5774a3,{'type':db[_0x208a('0x53')][_0x208a('0x54')]['SELECT'],'raw':!![]})['then'](function(_0x4cc6c9){return _0x4cc6c9;});})[_0x208a('0xd')](function(_0x2175fe){if(_0x2175fe){_0x51849f[_0x208a('0x14')][_0x208a('0x55')]=_0x2175fe[0x0];if(!_0x5bcd93[_0x208a('0x3f')][_0x208a('0x45')])return;return db[_0x208a('0x56')][_0x208a('0x41')]({'where':{'id':_0x5bcd93[_0x208a('0x3f')][_0x208a('0x45')],'role':_0x208a('0x57')},'attributes':['id',_0x208a('0x21'),_0x208a('0x58'),_0x208a('0x59'),_0x208a('0x5a')],'raw':!![]});}return null;})[_0x208a('0xd')](function(_0xfdccf4){if(!_0xfdccf4)return null;_0x51849f[_0x208a('0x14')][_0x208a('0x57')]=_0xfdccf4;return _0x51849f;})[_0x208a('0xd')](function(_0x17718f){if(_0x17718f){_0x17718f[_0x208a('0x14')][_0x208a('0x5b')]=util[_0x208a('0x5c')]('SIP/%s',_0x5bcd93['user'][_0x208a('0x21')]);_0x17718f[_0x208a('0x14')]['channel']=_0x51849f['channel'];_0x17718f[_0x208a('0x14')][_0x208a('0x5d')]=_0x51849f[_0x208a('0x5e')];_0x17718f[_0x208a('0x14')][_0x208a('0x5f')]=_0x208a('0x44');respondWithRpcPromise(_0x208a('0x60'),_0x208a('0x60'),{'event':'rejectmessage','message':_0x17718f[_0x208a('0x14')]},client9002);return _0x51849f;}return null;})[_0x208a('0xd')](respondWithResult(_0x20b7a9,null))[_0x208a('0x40')](handleError(_0x20b7a9,null));};exports[_0x208a('0x1a')]=function(_0x21a884,_0xe4598f){if(_0x21a884[_0x208a('0x3f')]['id']){delete _0x21a884[_0x208a('0x3f')]['id'];}var _0x3efccb;return db['SmsMessage'][_0x208a('0x41')]({'where':{'id':_0x21a884[_0x208a('0x61')]['id']}})[_0x208a('0xd')](handleEntityNotFound(_0xe4598f,null))[_0x208a('0xd')](function(_0x13792d){if(_0x13792d){_0x3efccb=_0x13792d;return db[_0x208a('0x62')][_0x208a('0x41')]({'where':{'id':_0x13792d['SmsAccountId']}});}})[_0x208a('0xd')](handleEntityNotFound(_0xe4598f,null))['then'](function(_0x27e846){if(_0x27e846){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x208a('0x63'),_0x27e846[_0x208a('0x35')],util[_0x208a('0x64')](_0x21a884[_0x208a('0x3f')],{'showHidden':![],'depth':null}));switch(_0x27e846['type']){case'twilio':if(_0x21a884['body'][_0x208a('0x65')]&&_0x21a884[_0x208a('0x3f')][_0x208a('0x65')]===_0x3efccb[_0x208a('0x66')]){return _0x3efccb['update']({'read':!![]});}else{logger[_0x208a('0x12')](_0x208a('0x67'),_0x208a('0x1a'),_0x208a('0x68'),util[_0x208a('0x64')](_0x21a884[_0x208a('0x3f')],{'showHidden':![],'depth':null}));}break;case _0x208a('0x69'):if(_0x21a884['body']['MessageUUID']&&_0x21a884['body'][_0x208a('0x6a')]===_0x3efccb[_0x208a('0x66')]&&_[_0x208a('0x6b')]([_0x208a('0x6c'),_0x208a('0x6d')],_0x21a884[_0x208a('0x3f')]['Status'])>=0x0){return _0x3efccb[_0x208a('0x1c')]({'read':!![]});}else{logger[_0x208a('0x12')](_0x208a('0x67'),_0x208a('0x1a'),_0x208a('0x6e'),util[_0x208a('0x64')](_0x21a884[_0x208a('0x3f')],{'showHidden':![],'depth':null}));}break;case _0x208a('0x6f'):var _0x367265=_0x21a884[_0x208a('0x3f')][_0x208a('0x70')][0x0];if(_0x367265[_0x208a('0x1a')]['groupName']==='DELIVERED'){return _0x3efccb['update']({'read':!![]});}else{logger[_0x208a('0x12')](_0x208a('0x67'),_0x208a('0x1a'),_0x208a('0x6f'),util[_0x208a('0x64')](_0x21a884[_0x208a('0x3f')],{'showHidden':![],'depth':null}));}break;}return _0x3efccb;}})[_0x208a('0xd')](respondWithResult(_0xe4598f,null))[_0x208a('0x40')](handleError(_0xe4598f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 96ee6b6..7dd3999 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 _0x9f71=['emit','hasOwnProperty','hook','SmsMessage','save','update','remove'];(function(_0x49cbf5,_0x5e3d95){var _0x512fd7=function(_0x43306b){while(--_0x43306b){_0x49cbf5['push'](_0x49cbf5['shift']());}};_0x512fd7(++_0x5e3d95);}(_0x9f71,0x96));var _0x19f7=function(_0x284622,_0x1e419f){_0x284622=_0x284622-0x0;var _0x4d48d6=_0x9f71[_0x284622];return _0x4d48d6;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x19f7('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x19f7('0x1'),'afterUpdate':_0x19f7('0x2'),'afterDestroy':_0x19f7('0x3')};function emitEvent(_0x53ce39){return function(_0x3fac7a,_0x3f2d76,_0x47fe8b){SmsMessageEvents[_0x19f7('0x4')](_0x53ce39+':'+_0x3fac7a['id'],_0x3fac7a);SmsMessageEvents[_0x19f7('0x4')](_0x53ce39,_0x3fac7a);_0x47fe8b(null);};}for(var e in events){if(events[_0x19f7('0x5')](e)){var event=events[e];SmsMessage[_0x19f7('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x415c=['save','update','emit','hasOwnProperty','hook','../../mysqldb','SmsMessage'];(function(_0x3e92b0,_0x1e4d0b){var _0x13fbf7=function(_0x12fa12){while(--_0x12fa12){_0x3e92b0['push'](_0x3e92b0['shift']());}};_0x13fbf7(++_0x1e4d0b);}(_0x415c,0x11d));var _0xc415=function(_0x1dcd6d,_0x36b5c3){_0x1dcd6d=_0x1dcd6d-0x0;var _0x103d3f=_0x415c[_0x1dcd6d];return _0x103d3f;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xc415('0x0'))['db'][_0xc415('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc415('0x2'),'afterUpdate':_0xc415('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4bfffc){return function(_0x229147,_0x2ff089,_0x32806c){SmsMessageEvents[_0xc415('0x4')](_0x4bfffc+':'+_0x229147['id'],_0x229147);SmsMessageEvents[_0xc415('0x4')](_0x4bfffc,_0x229147);_0x32806c(null);};}for(var e in events){if(events[_0xc415('0x5')](e)){var event=events[e];SmsMessage[_0xc415('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 a1a3bc0..868124b 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 _0x0d71=['SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','senderString','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','base64','http_code','data','queued_count','read','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','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','keys','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','toString','bandwidth','intelepeer','application/json','message','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define'];(function(_0xd363ae,_0x5d3c6e){var _0x116c0b=function(_0x31606d){while(--_0x31606d){_0xd363ae['push'](_0xd363ae['shift']());}};_0x116c0b(++_0x5d3c6e);}(_0x0d71,0xf6));var _0x10d7=function(_0x2350ef,_0xa0e163){_0x2350ef=_0x2350ef-0x0;var _0x6d3e64=_0x0d71[_0x2350ef];return _0x6d3e64;};'use strict';var _=require(_0x10d7('0x0'));var util=require('util');var logger=require(_0x10d7('0x1'))(_0x10d7('0x2'));var moment=require(_0x10d7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10d7('0x4'));var rimraf=require(_0x10d7('0x5'));var config=require(_0x10d7('0x6'));var attributes=require(_0x10d7('0x7'));module[_0x10d7('0x8')]=function(_0xaa61e7,_0x4d5139){return _0xaa61e7[_0x10d7('0x9')](_0x10d7('0xa'),attributes,{'tableName':_0x10d7('0xb'),'paranoid':![],'indexes':[{'name':_0x10d7('0xc'),'fields':[_0x10d7('0xc')]},{'name':_0x10d7('0xd'),'fields':['body'],'type':_0x10d7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e8c59,_0x2d7d8f,_0x2474e7){var _0x1b21d1=_0xaa61e7[_0x10d7('0xf')];var _0x4864f1=_0x4e8c59[_0x10d7('0x10')]({'plain':!![]});if(_0x4864f1[_0x10d7('0x11')]['toLowerCase']()==='in'||_0x4864f1[_0x10d7('0x11')][_0x10d7('0x12')]()===_0x10d7('0x13')&&!_0x4864f1['secret']&&!_[_0x10d7('0x14')](_0x4864f1[_0x10d7('0x15')])&&!_[_0x10d7('0x14')](_0x4864f1['SmsInteractionId'])){_0x1b21d1[_0x10d7('0x16')][_0x10d7('0x17')]({'where':{'id':_0x4864f1[_0x10d7('0x18')]}})[_0x10d7('0x19')](function(_0xa9e26e){if(_0xa9e26e){_0xa9e26e[_0x10d7('0x1a')]({'lastMsgAt':_0x4864f1[_0x10d7('0x1b')],'lastMsgDirection':_0x4864f1[_0x10d7('0x11')]['toLowerCase']()});}})[_0x10d7('0x1c')](function(_0x3c1d1c){console['error'](_0x3c1d1c);});}if(_0x4864f1[_0x10d7('0x11')]===_0x10d7('0x13')&&!_0x4864f1[_0x10d7('0x1d')]){var _0x2c3c36;_0x1b21d1[_0x10d7('0x1e')][_0x10d7('0x1f')]({'where':{'id':_0x4864f1[_0x10d7('0x20')]},'raw':!![]})[_0x10d7('0x19')](function(_0x235c36){_0x2c3c36=_0x235c36;if(_0x2c3c36&&_0x2c3c36[_0x10d7('0x21')]){switch(_0x2c3c36[_0x10d7('0x21')]){case _0x10d7('0x22'):var _0xf44552=require('twilio');if(_0x2c3c36['accountSid']&&_0x2c3c36[_0x10d7('0x23')]&&_0x2c3c36[_0x10d7('0x24')]){var _0x3f8235=new _0xf44552(_0x2c3c36[_0x10d7('0x25')],_0x2c3c36[_0x10d7('0x23')]);_0x3f8235[_0x10d7('0x26')][_0x10d7('0x27')]({'body':_0x4864f1[_0x10d7('0x28')],'to':_0x4864f1[_0x10d7('0x24')],'from':_0x2c3c36[_0x10d7('0x24')],'statusCallback':_0x2c3c36[_0x10d7('0x29')]+_0x10d7('0x2a')+_0x4864f1['id']+_0x10d7('0x2b')+_0x2c3c36[_0x10d7('0x2c')]})['then'](function(_0x15f0a6){if(_0x15f0a6[_0x10d7('0x2d')]){return _0x4e8c59[_0x10d7('0x1a')]({'messageId':_0x15f0a6[_0x10d7('0x2d')]});}})[_0x10d7('0x1c')](function(_0x31eb9f){logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'twilio',util[_0x10d7('0x31')](_0x31eb9f,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x22'),_0x10d7('0x32'));}break;case'skebby':var _0x82f23a=_0x10d7('0x33');if(_0x2c3c36[_0x10d7('0x34')]&&_0x2c3c36['password']){var _0x47fc18={'recipient':[_0x4864f1[_0x10d7('0x24')]],'message':_0x4864f1[_0x10d7('0x28')],'message_type':_0x2c3c36[_0x10d7('0x35')]};if(_0x2c3c36['smsMethod']&&_0x2c3c36['smsMethod']!=='SI'){_0x47fc18[_0x10d7('0x36')]=_0x2c3c36[_0x10d7('0x24')];}var _0x553719={'url':_0x82f23a+_0x10d7('0x37')+_0x2c3c36['username']+_0x10d7('0x38')+_0x2c3c36[_0x10d7('0x39')],'method':_0x10d7('0x3a')};rp(_0x553719)[_0x10d7('0x19')](function(_0x48d7c8){var _0x5d28d4=_0x48d7c8['split'](';');var _0x3091c7={'user_key':_0x5d28d4[0x0],'session_key':_0x5d28d4[0x1]};_0x553719={'url':_0x82f23a+_0x10d7('0x3b'),'method':_0x10d7('0x3c'),'headers':{'user_key':_0x3091c7[_0x10d7('0x3d')],'Session_key':_0x3091c7[_0x10d7('0x3e')]},'json':!![],'body':_0x47fc18};return rp(_0x553719);})['then'](function(_0x11fa29){if(_0x11fa29[_0x10d7('0x3f')]>=0x1){var _0x348ed2={'messageId':_0x11fa29[_0x10d7('0x40')]};if(_0x2c3c36[_0x10d7('0x35')]!=='GP'||!_0x2c3c36[_0x10d7('0x41')]){_0x348ed2['read']=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0x348ed2);}else{return logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x10d7('0x42'),util[_0x10d7('0x31')](_0x11fa29,{'showHidden':![],'depth':null}));}})[_0x10d7('0x1c')](function(_0x254973){return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x42'),util[_0x10d7('0x31')](_0x254973,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x42'),_0x10d7('0x43'));}break;case'connectel':if(_0x2c3c36[_0x10d7('0x23')]){var _0x702300={'recipient':_0x4864f1[_0x10d7('0x24')],'message':_0x4864f1[_0x10d7('0x28')],'sender':_0x2c3c36[_0x10d7('0x44')]||_0x2c3c36[_0x10d7('0x24')],'authorization':_0x2c3c36[_0x10d7('0x23')]};var _0x2d7d8f={'method':_0x10d7('0x3c'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x702300,'json':!![]};rp(_0x2d7d8f)[_0x10d7('0x19')](function(_0x3e59d2){var _0x7806c3={'messageId':_0x3e59d2[_0x10d7('0x45')]};if(!_0x2c3c36[_0x10d7('0x41')]){_0x7806c3['read']=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0x7806c3);})[_0x10d7('0x1c')](function(_0x30c1ed){logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'connectel',util[_0x10d7('0x31')](_0x30c1ed,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x46'),_0x10d7('0x47'));}break;case _0x10d7('0x48'):if(_0x2c3c36['username']&&_0x2c3c36['password']){var _0x702300={'messages':[{'source':_0x10d7('0x49'),'to':_0x4864f1['phone'],'body':_0x4864f1[_0x10d7('0x28')],'from':_0x2c3c36[_0x10d7('0x44')]||_0x2c3c36[_0x10d7('0x24')]}]};var _0xc874a=util[_0x10d7('0x4a')](_0x10d7('0x4b'),_0x2c3c36['username'],_0x2c3c36['password']);var _0x2d7d8f={'method':_0x10d7('0x3c'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x702300,'headers':{'Authorization':util[_0x10d7('0x4a')]('Basic\x20%s',new Buffer(_0xc874a)['toString'](_0x10d7('0x4c')))},'json':!![]};rp(_0x2d7d8f)['then'](function(_0x417f5e){if(_0x417f5e[_0x10d7('0x4d')]>=0xc8&&_0x417f5e[_0x10d7('0x4d')]<=0xce){if(_0x417f5e[_0x10d7('0x4e')]&&_0x417f5e[_0x10d7('0x4e')][_0x10d7('0x4f')]>0x0){var _0x374945=_['head'](_0x417f5e[_0x10d7('0x4e')][_0x10d7('0x26')]);var _0x224cec={'messageId':_0x374945['message_id']};if(!_0x2c3c36[_0x10d7('0x41')]){_0x224cec[_0x10d7('0x50')]=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0x224cec);}else{logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x51'),util['inspect'](_0x417f5e,{'showHidden':![],'depth':null}));}}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'clickSend',util['inspect'](_0x417f5e,{'showHidden':![],'depth':null}));}})[_0x10d7('0x1c')](function(_0x1afdbf){logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x51'),util[_0x10d7('0x31')](_0x1afdbf,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),'clickSend',_0x10d7('0x43'));}break;case'plivo':if(_0x2c3c36[_0x10d7('0x52')]&&_0x2c3c36[_0x10d7('0x23')]){var _0x702300={'dst':_0x4864f1['phone'],'text':_0x4864f1[_0x10d7('0x28')],'src':_0x2c3c36[_0x10d7('0x44')]||_0x2c3c36[_0x10d7('0x24')],'url':_0x2c3c36['remote']+'/api/sms/messages/'+_0x4864f1['id']+_0x10d7('0x2b')+_0x2c3c36[_0x10d7('0x2c')]};var _0xc874a=util[_0x10d7('0x4a')](_0x10d7('0x4b'),_0x2c3c36[_0x10d7('0x52')],_0x2c3c36['authToken']);var _0x2d7d8f={'method':'POST','uri':util['format'](_0x10d7('0x53'),_0x2c3c36[_0x10d7('0x52')]),'body':_0x702300,'headers':{'Authorization':util[_0x10d7('0x4a')](_0x10d7('0x54'),new Buffer(_0xc874a)['toString']('base64'))},'json':!![]};rp(_0x2d7d8f)[_0x10d7('0x19')](function(_0x555ddb){var _0x27d38d={'messageId':_0x555ddb[_0x10d7('0x55')][0x0]};return _0x4e8c59['update'](_0x27d38d);})['catch'](function(_0x440ccc){logger[_0x10d7('0x2e')](_0x10d7('0x2f'),'afterCreate',_0x10d7('0x56'),util[_0x10d7('0x31')](_0x440ccc,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x56'),_0x10d7('0x57'));}break;case _0x10d7('0x58'):if(_0x2c3c36['username']&&_0x2c3c36[_0x10d7('0x39')]){if(_0x2c3c36[_0x10d7('0x59')]){var _0x2e910c={'method':_0x10d7('0x3c'),'uri':_0x2c3c36[_0x10d7('0x59')]+_0x10d7('0x5a'),'body':{'username':_0x2c3c36['username'],'password':_0x2c3c36[_0x10d7('0x39')]},'json':!![]};return rp(_0x2e910c)[_0x10d7('0x19')](function(_0x4b9013){var _0x26010a={'method':_0x10d7('0x3c'),'uri':_0x2c3c36[_0x10d7('0x59')]+_0x10d7('0x5b'),'body':{'messages':[{'from':_0x2c3c36['phone'],'destinations':[{'to':_0x4864f1[_0x10d7('0x24')]}],'text':_0x4864f1[_0x10d7('0x28')],'notifyUrl':_0x2c3c36[_0x10d7('0x29')]+'/api/sms/messages/'+_0x4864f1['id']+_0x10d7('0x2b')+_0x2c3c36['token'],'notifyContentType':'application/json','callbackData':_0x2c3c36[_0x10d7('0x24')]+';'+_0x4864f1['body']}]},'headers':{'Authorization':_0x10d7('0x5c')+_0x4b9013['token']},'json':!![]};return rp(_0x26010a)[_0x10d7('0x19')](function(_0x288b1e){if(_0x288b1e[_0x10d7('0x26')]){var _0x1f2121={'messageId':_0x288b1e[_0x10d7('0x26')][0x0]['messageId']};if(!_0x2c3c36['deliveryReport']){_0x1f2121['read']=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0x1f2121);}else{return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x58'),util[_0x10d7('0x31')](_0x288b1e,{'showHidden':![],'depth':null}));}});})[_0x10d7('0x1c')](function(_0x3125ae){return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'infobip',util[_0x10d7('0x31')](_0x3125ae,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x58'),_0x10d7('0x5d'));}}else{logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x58'),_0x10d7('0x43'));}break;case'csc':var _0x1f8049=require(_0x10d7('0x5e'));if(_0x2c3c36[_0x10d7('0x5f')]){var _0x1b7c87={};_0x1b7c87[_0x10d7('0x60')]=_0x2c3c36['username'];_0x1b7c87[_0x10d7('0x24')]=_0x4864f1['phone'];_0x1b7c87['sender']=_0x2c3c36[_0x10d7('0x24')];_0x1b7c87['text']=_0x4864f1[_0x10d7('0x28')];_0x1b7c87[_0x10d7('0x61')]=+new Date();var _0x27ae7c='';var _0x3b6f33='';var _0x9fee52=Object['keys'](_0x1b7c87);_0x9fee52[_0x10d7('0x62')]();for(var _0x2d53ae=0x0;_0x2d53ae<_0x9fee52[_0x10d7('0x63')];_0x2d53ae++){if(_0x27ae7c!=''){_0x27ae7c+='&';}_0x27ae7c+=_0x9fee52[_0x2d53ae]+'='+encodeURIComponent(_0x1b7c87[_0x9fee52[_0x2d53ae]]);_0x3b6f33+=_0x1b7c87[_0x9fee52[_0x2d53ae]];}_0x3b6f33+=_0x2c3c36[_0x10d7('0x5f')];_0x3b6f33=_0x1f8049[_0x10d7('0x64')](_0x10d7('0x65'))[_0x10d7('0x1a')](_0x3b6f33)['digest'](_0x10d7('0x66'));if(_0x27ae7c!==''){_0x27ae7c+='&';}_0x27ae7c+=_0x10d7('0x67')+_0x3b6f33;var _0x553719={'method':_0x10d7('0x3a'),'uri':_0x2c3c36[_0x10d7('0x59')]+_0x10d7('0x68')+_0x27ae7c,'json':!![]};return rp(_0x553719)['then'](function(_0x2445eb){var _0x113007=Object[_0x10d7('0x69')](_0x2445eb);if(_0x2445eb[_0x113007[0x0]][_0x10d7('0x2e')]&&parseInt(_0x2445eb[_0x113007[0x0]][_0x10d7('0x2e')])===0x0){var _0xd29af0={'messageId':_0x2445eb[_0x113007[0x0]]['id_sms']};if(!_0x2c3c36['deliveryReport']){_0xd29af0[_0x10d7('0x50')]=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0xd29af0);}else{return logger['error'](_0x10d7('0x2f'),'afterCreate',_0x10d7('0x6a'),util[_0x10d7('0x31')](_0x2445eb[_0x10d7('0x2e')],{'showHidden':![],'depth':null}));}})[_0x10d7('0x1c')](function(_0x565547){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x6a'),util[_0x10d7('0x31')](_0x565547,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x10d7('0x6a'),_0x10d7('0x6b'));}break;case _0x10d7('0x6c'):if(_0x2c3c36[_0x10d7('0x5f')]){var _0x13e09f={'method':_0x10d7('0x3c'),'uri':_0x10d7('0x6d'),'headers':{'Authorization':_0x2c3c36[_0x10d7('0x5f')]},'body':{'content':_0x4864f1[_0x10d7('0x28')],'to':[_0x4864f1[_0x10d7('0x24')]],'from':_0x2c3c36[_0x10d7('0x24')],'binary':![],'clientMessageId':_0x10d7('0x6e'),'charset':_0x10d7('0x6f')},'json':!![]};rp(_0x13e09f)[_0x10d7('0x19')](function(_0x3a554b){if(!_0x3a554b[_0x10d7('0x2e')]){var _0x5baeae={'messageId':_0x3a554b[_0x10d7('0x26')][0x0][_0x10d7('0x70')]};if(!_0x2c3c36['deliveryReport']){_0x5baeae['read']=!![];}return _0x4e8c59[_0x10d7('0x1a')](_0x5baeae);}else{return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),'afterCreate','clickatell',util['inspect'](_0x3a554b[_0x10d7('0x2e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d308d){return logger[_0x10d7('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),_0x10d7('0x6c'),util[_0x10d7('0x31')](_0x1d308d,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x2c3c36['username']&&_0x2c3c36[_0x10d7('0x39')]){var _0xc874a=util[_0x10d7('0x4a')](_0x10d7('0x4b'),_0x2c3c36['username'],_0x2c3c36['password']);var _0x2d7d8f={'method':_0x10d7('0x3c'),'uri':_0x10d7('0x71')+_0x2c3c36['accountId']+_0x10d7('0x72'),'body':{'to':[_0x4864f1[_0x10d7('0x24')]],'text':_0x4864f1['body'],'from':_0x2c3c36[_0x10d7('0x24')],'applicationId':_0x2c3c36[_0x10d7('0x73')]},'headers':{'Authorization':util['format'](_0x10d7('0x54'),new Buffer(_0xc874a)[_0x10d7('0x74')]('base64'))},'json':!![]};rp(_0x2d7d8f)['then'](function(_0x804654){if(_0x804654['id']){var _0x4ac4b5={'messageId':_0x804654['id']};return _0x4e8c59['update'](_0x4ac4b5);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d7('0x30'),'bandwidth',util[_0x10d7('0x31')](_0x804654,{'showHidden':![],'depth':null}));}})[_0x10d7('0x1c')](function(_0x4a9ba9){logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x75'),util[_0x10d7('0x31')](_0x4a9ba9,{'showHidden':![],'depth':null}));});}else{logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x75'),_0x10d7('0x43'));}break;case _0x10d7('0x76'):if(_0x2c3c36[_0x10d7('0x5f')]){var _0x608612={};var _0x553719={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2c3c36[_0x10d7('0x5f')],'Content-Type':_0x10d7('0x77')},'body':{'from':_0x2c3c36[_0x10d7('0x24')],'to':_0x4864f1[_0x10d7('0x24')],'text':_0x4864f1['body']},'json':!![]};return rp(_0x553719)[_0x10d7('0x19')](function(_0x3017d0){if(_0x3017d0['code']==0xca){_0x608612[_0x10d7('0x78')]=_0x3017d0;var _0xaa5973={'method':_0x10d7('0x3c'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x10d7('0x79')+_0x2c3c36['apiKey'],'Content-Type':_0x10d7('0x77')},'body':{'refid':_0x608612[_0x10d7('0x78')][_0x10d7('0x7a')]},'json':!![]};return rp(_0xaa5973)[_0x10d7('0x19')](function(_0x2c26d6){_0x608612[_0x10d7('0x7b')]=_0x2c26d6;var _0x4c509a={'messageId':_0x608612[_0x10d7('0x78')][_0x10d7('0x7a')],'read':!![]};return _0x4e8c59['update'](_0x4c509a);});}else{return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),'intelepeer',util['inspect'](_0x3017d0,{'showHidden':![],'depth':null}));}})[_0x10d7('0x1c')](function(_0x2a9a0f){return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),_0x10d7('0x30'),_0x10d7('0x76'),util[_0x10d7('0x31')](_0x2a9a0f,{'showHidden':![],'depth':null}));});}else{return logger[_0x10d7('0x2e')](_0x10d7('0x2f'),'afterCreate',_0x10d7('0x76'),_0x10d7('0x7c'));}break;}}})[_0x10d7('0x7d')](function(){_0x2474e7();});}else{_0x2474e7();}}},'charset':_0x10d7('0x7e'),'collate':_0x10d7('0x7f')});}; \ No newline at end of file +var _0x83f0=['afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','&password=','password','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','read','clickSend','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','toLowerCase','direction','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid'];(function(_0x22a11d,_0x440cd7){var _0x1a6791=function(_0x2447e1){while(--_0x2447e1){_0x22a11d['push'](_0x22a11d['shift']());}};_0x1a6791(++_0x440cd7);}(_0x83f0,0xcc));var _0x083f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x83f0[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x083f('0x0'));var logger=require(_0x083f('0x1'))(_0x083f('0x2'));var moment=require(_0x083f('0x3'));var BPromise=require(_0x083f('0x4'));var rp=require(_0x083f('0x5'));var fs=require('fs');var path=require(_0x083f('0x6'));var rimraf=require(_0x083f('0x7'));var config=require(_0x083f('0x8'));var attributes=require(_0x083f('0x9'));module[_0x083f('0xa')]=function(_0x457668,_0x5ca6f8){return _0x457668['define'](_0x083f('0xb'),attributes,{'tableName':_0x083f('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x083f('0xd')]},{'name':_0x083f('0xe'),'fields':[_0x083f('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x64ec8d,_0x23df14,_0x5c06ea){var _0x1ee9c1=_0x457668['models'];var _0x27f6f2=_0x64ec8d[_0x083f('0x10')]({'plain':!![]});if(_0x27f6f2['direction'][_0x083f('0x11')]()==='in'||_0x27f6f2[_0x083f('0x12')]['toLowerCase']()===_0x083f('0x13')&&!_0x27f6f2['secret']&&!_[_0x083f('0x14')](_0x27f6f2[_0x083f('0x15')])&&!_['isNil'](_0x27f6f2[_0x083f('0x16')])){_0x1ee9c1[_0x083f('0x17')][_0x083f('0x18')]({'where':{'id':_0x27f6f2[_0x083f('0x16')]}})[_0x083f('0x19')](function(_0x2048e1){if(_0x2048e1){_0x2048e1[_0x083f('0x1a')]({'lastMsgAt':_0x27f6f2['createdAt'],'lastMsgDirection':_0x27f6f2['direction'][_0x083f('0x11')]()});}})[_0x083f('0x1b')](function(_0x23d134){console[_0x083f('0x1c')](_0x23d134);});}if(_0x27f6f2['direction']===_0x083f('0x13')&&!_0x27f6f2['secret']){var _0x2ffb40;_0x1ee9c1['SmsAccount'][_0x083f('0x1d')]({'where':{'id':_0x27f6f2[_0x083f('0x1e')]},'raw':!![]})[_0x083f('0x19')](function(_0x4dbbb5){_0x2ffb40=_0x4dbbb5;if(_0x2ffb40&&_0x2ffb40[_0x083f('0x1f')]){switch(_0x2ffb40[_0x083f('0x1f')]){case _0x083f('0x20'):var _0x223f02=require('twilio');if(_0x2ffb40[_0x083f('0x21')]&&_0x2ffb40[_0x083f('0x22')]&&_0x2ffb40[_0x083f('0x23')]){var _0x1995f2=new _0x223f02(_0x2ffb40[_0x083f('0x21')],_0x2ffb40['authToken']);_0x1995f2[_0x083f('0x24')][_0x083f('0x25')]({'body':_0x27f6f2[_0x083f('0xf')],'to':_0x27f6f2[_0x083f('0x23')],'from':_0x2ffb40[_0x083f('0x23')],'statusCallback':_0x2ffb40[_0x083f('0x26')]+_0x083f('0x27')+_0x27f6f2['id']+'/status?token='+_0x2ffb40[_0x083f('0x28')]})['then'](function(_0x177b8d){if(_0x177b8d[_0x083f('0x29')]){return _0x64ec8d[_0x083f('0x1a')]({'messageId':_0x177b8d['sid']});}})['catch'](function(_0x16ff63){logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x20'),util['inspect'](_0x16ff63,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'twilio',_0x083f('0x2c'));}break;case _0x083f('0x2d'):var _0x3b9f22='https://api.skebby.it/API/v1.0/REST/';if(_0x2ffb40[_0x083f('0x2e')]&&_0x2ffb40['password']){var _0x53cb15={'recipient':[_0x27f6f2[_0x083f('0x23')]],'message':_0x27f6f2['body'],'message_type':_0x2ffb40[_0x083f('0x2f')]};if(_0x2ffb40[_0x083f('0x2f')]&&_0x2ffb40['smsMethod']!=='SI'){_0x53cb15[_0x083f('0x30')]=_0x2ffb40[_0x083f('0x23')];}var _0x1aa2a9={'url':_0x3b9f22+'login?username='+_0x2ffb40[_0x083f('0x2e')]+_0x083f('0x31')+_0x2ffb40[_0x083f('0x32')],'method':_0x083f('0x33')};rp(_0x1aa2a9)[_0x083f('0x19')](function(_0x98de24){var _0xfc8846=_0x98de24[_0x083f('0x34')](';');var _0x59e9de={'user_key':_0xfc8846[0x0],'session_key':_0xfc8846[0x1]};_0x1aa2a9={'url':_0x3b9f22+_0x083f('0x35'),'method':_0x083f('0x36'),'headers':{'user_key':_0x59e9de[_0x083f('0x37')],'Session_key':_0x59e9de[_0x083f('0x38')]},'json':!![],'body':_0x53cb15};return rp(_0x1aa2a9);})['then'](function(_0x269e49){if(_0x269e49['total_sent']>=0x1){var _0x5a0dfa={'messageId':_0x269e49[_0x083f('0x39')]};if(_0x2ffb40[_0x083f('0x2f')]!=='GP'||!_0x2ffb40[_0x083f('0x3a')]){_0x5a0dfa['read']=!![];}return _0x64ec8d['update'](_0x5a0dfa);}else{return logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x2d'),util[_0x083f('0x3b')](_0x269e49,{'showHidden':![],'depth':null}));}})['catch'](function(_0x916a80){return logger['error'](_0x083f('0x2b'),_0x083f('0x2a'),'skebby',util[_0x083f('0x3b')](_0x916a80,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'skebby',_0x083f('0x3c'));}break;case'connectel':if(_0x2ffb40[_0x083f('0x22')]){var _0x203fbd={'recipient':_0x27f6f2[_0x083f('0x23')],'message':_0x27f6f2['body'],'sender':_0x2ffb40[_0x083f('0x3d')]||_0x2ffb40[_0x083f('0x23')],'authorization':_0x2ffb40[_0x083f('0x22')]};var _0x23df14={'method':_0x083f('0x36'),'uri':_0x083f('0x3e'),'body':_0x203fbd,'json':!![]};rp(_0x23df14)['then'](function(_0x24fe8d){var _0x41f87e={'messageId':_0x24fe8d['requestid']};if(!_0x2ffb40[_0x083f('0x3a')]){_0x41f87e['read']=!![];}return _0x64ec8d['update'](_0x41f87e);})[_0x083f('0x1b')](function(_0x2b104e){logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x3f'),util[_0x083f('0x3b')](_0x2b104e,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'connectel',_0x083f('0x40'));}break;case _0x083f('0x41'):if(_0x2ffb40[_0x083f('0x2e')]&&_0x2ffb40[_0x083f('0x32')]){var _0x203fbd={'messages':[{'source':_0x083f('0x42'),'to':_0x27f6f2[_0x083f('0x23')],'body':_0x27f6f2[_0x083f('0xf')],'from':_0x2ffb40[_0x083f('0x3d')]||_0x2ffb40['phone']}]};var _0x1a3067=util[_0x083f('0x43')]('%s:%s',_0x2ffb40[_0x083f('0x2e')],_0x2ffb40['password']);var _0x23df14={'method':'POST','uri':_0x083f('0x44'),'body':_0x203fbd,'headers':{'Authorization':util[_0x083f('0x43')](_0x083f('0x45'),new Buffer(_0x1a3067)[_0x083f('0x46')](_0x083f('0x47')))},'json':!![]};rp(_0x23df14)[_0x083f('0x19')](function(_0x4bbcd6){if(_0x4bbcd6[_0x083f('0x48')]>=0xc8&&_0x4bbcd6[_0x083f('0x48')]<=0xce){if(_0x4bbcd6[_0x083f('0x49')]&&_0x4bbcd6[_0x083f('0x49')][_0x083f('0x4a')]>0x0){var _0x1dbe7e=_[_0x083f('0x4b')](_0x4bbcd6[_0x083f('0x49')]['messages']);var _0xd85ac7={'messageId':_0x1dbe7e[_0x083f('0x4c')]};if(!_0x2ffb40['deliveryReport']){_0xd85ac7[_0x083f('0x4d')]=!![];}return _0x64ec8d[_0x083f('0x1a')](_0xd85ac7);}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x4e'),util[_0x083f('0x3b')](_0x4bbcd6,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x4e'),util[_0x083f('0x3b')](_0x4bbcd6,{'showHidden':![],'depth':null}));}})[_0x083f('0x1b')](function(_0x3e4049){logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x4e'),util[_0x083f('0x3b')](_0x3e4049,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x4e'),_0x083f('0x3c'));}break;case'plivo':if(_0x2ffb40[_0x083f('0x4f')]&&_0x2ffb40[_0x083f('0x22')]){var _0x203fbd={'dst':_0x27f6f2['phone'],'text':_0x27f6f2[_0x083f('0xf')],'src':_0x2ffb40[_0x083f('0x3d')]||_0x2ffb40[_0x083f('0x23')],'url':_0x2ffb40[_0x083f('0x26')]+'/api/sms/messages/'+_0x27f6f2['id']+'/status?token='+_0x2ffb40[_0x083f('0x28')]};var _0x1a3067=util[_0x083f('0x43')](_0x083f('0x50'),_0x2ffb40['authId'],_0x2ffb40[_0x083f('0x22')]);var _0x23df14={'method':_0x083f('0x36'),'uri':util['format'](_0x083f('0x51'),_0x2ffb40['authId']),'body':_0x203fbd,'headers':{'Authorization':util[_0x083f('0x43')]('Basic\x20%s',new Buffer(_0x1a3067)[_0x083f('0x46')](_0x083f('0x47')))},'json':!![]};rp(_0x23df14)[_0x083f('0x19')](function(_0x31d855){var _0x478cb6={'messageId':_0x31d855['message_uuid'][0x0]};return _0x64ec8d[_0x083f('0x1a')](_0x478cb6);})['catch'](function(_0x19bc84){logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'plivo',util[_0x083f('0x3b')](_0x19bc84,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x52'),_0x083f('0x53'));}break;case _0x083f('0x54'):if(_0x2ffb40[_0x083f('0x2e')]&&_0x2ffb40[_0x083f('0x32')]){if(_0x2ffb40['baseUrl']){var _0x569ad6={'method':_0x083f('0x36'),'uri':_0x2ffb40[_0x083f('0x55')]+_0x083f('0x56'),'body':{'username':_0x2ffb40[_0x083f('0x2e')],'password':_0x2ffb40[_0x083f('0x32')]},'json':!![]};return rp(_0x569ad6)[_0x083f('0x19')](function(_0x495077){var _0x10a414={'method':_0x083f('0x36'),'uri':_0x2ffb40['baseUrl']+_0x083f('0x57'),'body':{'messages':[{'from':_0x2ffb40['phone'],'destinations':[{'to':_0x27f6f2['phone']}],'text':_0x27f6f2[_0x083f('0xf')],'notifyUrl':_0x2ffb40[_0x083f('0x26')]+'/api/sms/messages/'+_0x27f6f2['id']+_0x083f('0x58')+_0x2ffb40['token'],'notifyContentType':_0x083f('0x59'),'callbackData':_0x2ffb40[_0x083f('0x23')]+';'+_0x27f6f2[_0x083f('0xf')]}]},'headers':{'Authorization':_0x083f('0x5a')+_0x495077[_0x083f('0x28')]},'json':!![]};return rp(_0x10a414)[_0x083f('0x19')](function(_0x4d7acb){if(_0x4d7acb[_0x083f('0x24')]){var _0x1c3cca={'messageId':_0x4d7acb[_0x083f('0x24')][0x0]['messageId']};if(!_0x2ffb40[_0x083f('0x3a')]){_0x1c3cca['read']=!![];}return _0x64ec8d[_0x083f('0x1a')](_0x1c3cca);}else{return logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x083f('0x54'),util['inspect'](_0x4d7acb,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x390f0a){return logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x54'),util[_0x083f('0x3b')](_0x390f0a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x54'),_0x083f('0x5b'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x083f('0x54'),_0x083f('0x3c'));}break;case _0x083f('0x5c'):var _0x56f31a=require(_0x083f('0x5d'));if(_0x2ffb40[_0x083f('0x5e')]){var _0xa9169a={};_0xa9169a[_0x083f('0x5f')]=_0x2ffb40['username'];_0xa9169a[_0x083f('0x23')]=_0x27f6f2[_0x083f('0x23')];_0xa9169a[_0x083f('0x30')]=_0x2ffb40[_0x083f('0x23')];_0xa9169a[_0x083f('0x60')]=_0x27f6f2['body'];_0xa9169a['timestamp']=+new Date();var _0x2878e0='';var _0x41469d='';var _0x2cb280=Object[_0x083f('0x61')](_0xa9169a);_0x2cb280[_0x083f('0x62')]();for(var _0xdd8e21=0x0;_0xdd8e21<_0x2cb280[_0x083f('0x63')];_0xdd8e21++){if(_0x2878e0!=''){_0x2878e0+='&';}_0x2878e0+=_0x2cb280[_0xdd8e21]+'='+encodeURIComponent(_0xa9169a[_0x2cb280[_0xdd8e21]]);_0x41469d+=_0xa9169a[_0x2cb280[_0xdd8e21]];}_0x41469d+=_0x2ffb40[_0x083f('0x5e')];_0x41469d=_0x56f31a['createHash']('md5')['update'](_0x41469d)['digest'](_0x083f('0x64'));if(_0x2878e0!==''){_0x2878e0+='&';}_0x2878e0+='signature='+_0x41469d;var _0x1aa2a9={'method':_0x083f('0x33'),'uri':_0x2ffb40[_0x083f('0x55')]+_0x083f('0x65')+_0x2878e0,'json':!![]};return rp(_0x1aa2a9)[_0x083f('0x19')](function(_0x16c085){var _0x470475=Object[_0x083f('0x61')](_0x16c085);if(_0x16c085[_0x470475[0x0]][_0x083f('0x1c')]&&parseInt(_0x16c085[_0x470475[0x0]][_0x083f('0x1c')])===0x0){var _0x32601e={'messageId':_0x16c085[_0x470475[0x0]][_0x083f('0x66')]};if(!_0x2ffb40[_0x083f('0x3a')]){_0x32601e[_0x083f('0x4d')]=!![];}return _0x64ec8d[_0x083f('0x1a')](_0x32601e);}else{return logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x5c'),util[_0x083f('0x3b')](_0x16c085[_0x083f('0x1c')],{'showHidden':![],'depth':null}));}})[_0x083f('0x1b')](function(_0x5e0366){return logger['error'](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x5c'),util[_0x083f('0x3b')](_0x5e0366,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'csc',_0x083f('0x67'));}break;case _0x083f('0x68'):if(_0x2ffb40['apiKey']){var _0xebecd3={'method':_0x083f('0x36'),'uri':_0x083f('0x69'),'headers':{'Authorization':_0x2ffb40[_0x083f('0x5e')]},'body':{'content':_0x27f6f2[_0x083f('0xf')],'to':[_0x27f6f2['phone']],'from':_0x2ffb40['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x083f('0x6a')},'json':!![]};rp(_0xebecd3)[_0x083f('0x19')](function(_0x5de912){if(!_0x5de912[_0x083f('0x1c')]){var _0x47f1ca={'messageId':_0x5de912['messages'][0x0][_0x083f('0x6b')]};if(!_0x2ffb40[_0x083f('0x3a')]){_0x47f1ca[_0x083f('0x4d')]=!![];}return _0x64ec8d['update'](_0x47f1ca);}else{return logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),_0x083f('0x68'),util[_0x083f('0x3b')](_0x5de912[_0x083f('0x1c')],{'showHidden':![],'depth':null}));}})[_0x083f('0x1b')](function(_0x3197ff){return logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'clickatell',util[_0x083f('0x3b')](_0x3197ff,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x083f('0x2a'),'clickatell',_0x083f('0x67'));}break;case _0x083f('0x6c'):if(_0x2ffb40[_0x083f('0x2e')]&&_0x2ffb40[_0x083f('0x32')]){var _0x1a3067=util['format']('%s:%s',_0x2ffb40[_0x083f('0x2e')],_0x2ffb40[_0x083f('0x32')]);var _0x23df14={'method':_0x083f('0x36'),'uri':_0x083f('0x6d')+_0x2ffb40['accountId']+_0x083f('0x6e'),'body':{'to':[_0x27f6f2[_0x083f('0x23')]],'text':_0x27f6f2[_0x083f('0xf')],'from':_0x2ffb40[_0x083f('0x23')],'applicationId':_0x2ffb40[_0x083f('0x6f')]},'headers':{'Authorization':util[_0x083f('0x43')](_0x083f('0x45'),new Buffer(_0x1a3067)[_0x083f('0x46')]('base64'))},'json':!![]};rp(_0x23df14)[_0x083f('0x19')](function(_0x3609c6){if(_0x3609c6['id']){var _0x34af2a={'messageId':_0x3609c6['id']};return _0x64ec8d[_0x083f('0x1a')](_0x34af2a);}else{logger['error'](_0x083f('0x2b'),'afterCreate','bandwidth',util[_0x083f('0x3b')](_0x3609c6,{'showHidden':![],'depth':null}));}})[_0x083f('0x1b')](function(_0x49f349){logger['error'](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x6c'),util['inspect'](_0x49f349,{'showHidden':![],'depth':null}));});}else{logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x6c'),_0x083f('0x3c'));}break;case _0x083f('0x70'):if(_0x2ffb40['apiKey']){var _0x561565={};var _0x1aa2a9={'method':_0x083f('0x36'),'uri':_0x083f('0x71'),'headers':{'Authorization':_0x083f('0x72')+_0x2ffb40[_0x083f('0x5e')],'Content-Type':_0x083f('0x59')},'body':{'from':_0x2ffb40[_0x083f('0x23')],'to':_0x27f6f2[_0x083f('0x23')],'text':_0x27f6f2['body']},'json':!![]};return rp(_0x1aa2a9)[_0x083f('0x19')](function(_0xe30349){if(_0xe30349['code']==0xca){_0x561565[_0x083f('0x73')]=_0xe30349;var _0x304be6={'method':_0x083f('0x36'),'uri':_0x083f('0x74'),'headers':{'Authorization':_0x083f('0x72')+_0x2ffb40[_0x083f('0x5e')],'Content-Type':_0x083f('0x59')},'body':{'refid':_0x561565[_0x083f('0x73')][_0x083f('0x75')]},'json':!![]};return rp(_0x304be6)[_0x083f('0x19')](function(_0x49e4ea){_0x561565[_0x083f('0x76')]=_0x49e4ea;var _0x22b222={'messageId':_0x561565[_0x083f('0x73')]['refid'],'read':!![]};return _0x64ec8d[_0x083f('0x1a')](_0x22b222);});}else{return logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),_0x083f('0x70'),util[_0x083f('0x3b')](_0xe30349,{'showHidden':![],'depth':null}));}})[_0x083f('0x1b')](function(_0x2aa4cb){return logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'intelepeer',util[_0x083f('0x3b')](_0x2aa4cb,{'showHidden':![],'depth':null}));});}else{return logger[_0x083f('0x1c')](_0x083f('0x2b'),_0x083f('0x2a'),'intelepeer',_0x083f('0x77'));}break;}}})[_0x083f('0x78')](function(){_0x5c06ea();});}else{_0x5c06ea();}}},'charset':_0x083f('0x79'),'collate':_0x083f('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 45c054c..88bb7e7 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 _0x75e6=['CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','info','result','catch'];(function(_0x46d3a2,_0x2c4ff2){var _0x5908b1=function(_0xec7e38){while(--_0xec7e38){_0x46d3a2['push'](_0x46d3a2['shift']());}};_0x5908b1(++_0x2c4ff2);}(_0x75e6,0xab));var _0x675e=function(_0x1f2037,_0x3b0ce4){_0x1f2037=_0x1f2037-0x0;var _0x38868f=_0x75e6[_0x1f2037];return _0x38868f;};'use strict';var _=require(_0x675e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x675e('0x1'));var rs=require(_0x675e('0x2'));var fs=require('fs');var Redis=require(_0x675e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x675e('0x4'));var logger=require(_0x675e('0x5'))('rpc');var config=require(_0x675e('0x6'));var jayson=require(_0x675e('0x7'));var client=jayson[_0x675e('0x8')][_0x675e('0x9')]({'port':0x232a});config[_0x675e('0xa')]=_[_0x675e('0xb')](config['redis'],{'host':_0x675e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x675e('0xd'))[_0x675e('0xe')](socket);function respondWithRpcPromise(_0x313afd,_0x50dadb,_0x1898e4){return new BPromise(function(_0x1c430b,_0x12fa8e){return client['request'](_0x313afd,_0x1898e4)[_0x675e('0xf')](function(_0x1a7a4b){logger['info']('SmsMessage,\x20%s,\x20%s',_0x50dadb,_0x675e('0x10'));logger[_0x675e('0x11')](_0x675e('0x12'),_0x50dadb,'request\x20sent',JSON[_0x675e('0x13')](_0x1a7a4b));if(_0x1a7a4b[_0x675e('0x14')]){if(_0x1a7a4b['error'][_0x675e('0x15')]===0x1f4){logger[_0x675e('0x14')]('SmsMessage,\x20%s,\x20%s',_0x50dadb,_0x1a7a4b[_0x675e('0x14')][_0x675e('0x16')]);return _0x12fa8e(_0x1a7a4b[_0x675e('0x14')]['message']);}logger[_0x675e('0x14')](_0x675e('0x17'),_0x50dadb,_0x1a7a4b[_0x675e('0x14')][_0x675e('0x16')]);return _0x1c430b(_0x1a7a4b['error']['message']);}else{logger[_0x675e('0x18')]('SmsMessage,\x20%s,\x20%s',_0x50dadb,_0x675e('0x10'));_0x1c430b(_0x1a7a4b[_0x675e('0x19')]['message']);}})[_0x675e('0x1a')](function(_0x386039){logger[_0x675e('0x14')](_0x675e('0x17'),_0x50dadb,_0x386039);_0x12fa8e(_0x386039);});});}exports[_0x675e('0x1b')]=function(_0x4da721){var _0x117942=this;return new Promise(function(_0x30c321,_0x1dd632){return db[_0x675e('0x1c')][_0x675e('0x1d')](_0x4da721[_0x675e('0x1e')],{'raw':_0x4da721[_0x675e('0x1f')]?_0x4da721[_0x675e('0x1f')][_0x675e('0x20')]===undefined?!![]:![]:!![]})[_0x675e('0xf')](function(_0x3e24fc){logger['info'](_0x675e('0x1b'),_0x4da721);logger[_0x675e('0x11')](_0x675e('0x1b'),_0x4da721,JSON[_0x675e('0x13')](_0x3e24fc));_0x30c321(_0x3e24fc);})[_0x675e('0x1a')](function(_0xc51c5b){logger['error'](_0x675e('0x1b'),_0xc51c5b[_0x675e('0x16')],_0x4da721);_0x1dd632(_0x117942[_0x675e('0x14')](0x1f4,_0xc51c5b[_0x675e('0x16')]));});});}; \ No newline at end of file +var _0x13e7=['message','catch','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a6e01,_0x17aeda){var _0x535748=function(_0x2549e4){while(--_0x2549e4){_0x5a6e01['push'](_0x5a6e01['shift']());}};_0x535748(++_0x17aeda);}(_0x13e7,0xa2));var _0x713e=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x13e7[_0x221b8c];return _0x3fab9f;};'use strict';var _=require(_0x713e('0x0'));var util=require(_0x713e('0x1'));var moment=require(_0x713e('0x2'));var BPromise=require(_0x713e('0x3'));var rs=require(_0x713e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x713e('0x5'));var logger=require('../../config/logger')(_0x713e('0x6'));var config=require('../../config/environment');var jayson=require(_0x713e('0x7'));var client=jayson[_0x713e('0x8')]['http']({'port':0x232a});config[_0x713e('0x9')]=_[_0x713e('0xa')](config[_0x713e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x713e('0xb'))(new Redis(config[_0x713e('0x9')]));require(_0x713e('0xc'))[_0x713e('0xd')](socket);function respondWithRpcPromise(_0x4fb71d,_0x5c7f4e,_0x5e7fca){return new BPromise(function(_0x4ea739,_0xdf89d4){return client[_0x713e('0xe')](_0x4fb71d,_0x5e7fca)[_0x713e('0xf')](function(_0x54f47a){logger[_0x713e('0x10')](_0x713e('0x11'),_0x5c7f4e,_0x713e('0x12'));logger[_0x713e('0x13')](_0x713e('0x14'),_0x5c7f4e,'request\x20sent',JSON[_0x713e('0x15')](_0x54f47a));if(_0x54f47a['error']){if(_0x54f47a[_0x713e('0x16')][_0x713e('0x17')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5c7f4e,_0x54f47a[_0x713e('0x16')][_0x713e('0x18')]);return _0xdf89d4(_0x54f47a[_0x713e('0x16')][_0x713e('0x18')]);}logger['error'](_0x713e('0x11'),_0x5c7f4e,_0x54f47a[_0x713e('0x16')][_0x713e('0x18')]);return _0x4ea739(_0x54f47a[_0x713e('0x16')]['message']);}else{logger['info'](_0x713e('0x11'),_0x5c7f4e,_0x713e('0x12'));_0x4ea739(_0x54f47a['result'][_0x713e('0x18')]);}})[_0x713e('0x19')](function(_0x52be2a){logger['error'](_0x713e('0x11'),_0x5c7f4e,_0x52be2a);_0xdf89d4(_0x52be2a);});});}exports['CreateSmsMessage']=function(_0x146ac6){var _0x5a650e=this;return new Promise(function(_0x53b396,_0x5119b6){return db['SmsMessage'][_0x713e('0x1a')](_0x146ac6[_0x713e('0x1b')],{'raw':_0x146ac6[_0x713e('0x1c')]?_0x146ac6[_0x713e('0x1c')][_0x713e('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x43307c){logger[_0x713e('0x10')](_0x713e('0x1e'),_0x146ac6);logger[_0x713e('0x13')](_0x713e('0x1e'),_0x146ac6,JSON[_0x713e('0x15')](_0x43307c));_0x53b396(_0x43307c);})[_0x713e('0x19')](function(_0x551732){logger[_0x713e('0x16')](_0x713e('0x1e'),_0x551732[_0x713e('0x18')],_0x146ac6);_0x5119b6(_0x5a650e['error'](0x1f4,_0x551732[_0x713e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1516337..e236f1e 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 _0x5390=['update','emit','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x4ec23f,_0x47e469){var _0x5a6c57=function(_0x1dad0d){while(--_0x1dad0d){_0x4ec23f['push'](_0x4ec23f['shift']());}};_0x5a6c57(++_0x47e469);}(_0x5390,0x115));var _0x0539=function(_0xa50a5b,_0x28ad1d){_0xa50a5b=_0xa50a5b-0x0;var _0x139861=_0x5390[_0xa50a5b];return _0x139861;};'use strict';var SmsMessageEvents=require(_0x0539('0x0'));var events=[_0x0539('0x1'),_0x0539('0x2'),_0x0539('0x3')];function createListener(_0xb7c169,_0x4d73ae){return function(_0x8134e5){_0x4d73ae[_0x0539('0x4')](_0xb7c169,_0x8134e5);};}function removeListener(_0x9f235f,_0x2a6c65){return function(){SmsMessageEvents['removeListener'](_0x9f235f,_0x2a6c65);};}exports[_0x0539('0x5')]=function(_0x4bad74){for(var _0x1250fb=0x0,_0x107799=events[_0x0539('0x6')];_0x1250fb<_0x107799;_0x1250fb++){var _0x540b09=events[_0x1250fb];var _0x3e626b=createListener(_0x0539('0x7')+_0x540b09,_0x4bad74);SmsMessageEvents['on'](_0x540b09,_0x3e626b);}}; \ No newline at end of file +var _0x8630=['length','smsMessage:','./smsMessage.events','save','update','emit','register'];(function(_0x577240,_0x271d56){var _0x4e9a56=function(_0x168346){while(--_0x168346){_0x577240['push'](_0x577240['shift']());}};_0x4e9a56(++_0x271d56);}(_0x8630,0x87));var _0x0863=function(_0x34dc8b,_0x102dc5){_0x34dc8b=_0x34dc8b-0x0;var _0x50719e=_0x8630[_0x34dc8b];return _0x50719e;};'use strict';var SmsMessageEvents=require(_0x0863('0x0'));var events=[_0x0863('0x1'),'remove',_0x0863('0x2')];function createListener(_0x2989e8,_0x1cd991){return function(_0x26dce3){_0x1cd991[_0x0863('0x3')](_0x2989e8,_0x26dce3);};}function removeListener(_0x504a82,_0x57b158){return function(){SmsMessageEvents['removeListener'](_0x504a82,_0x57b158);};}exports[_0x0863('0x4')]=function(_0x5bd05c){for(var _0x401bf7=0x0,_0x58d182=events[_0x0863('0x5')];_0x401bf7<_0x58d182;_0x401bf7++){var _0x588401=events[_0x401bf7];var _0x413d42=createListener(_0x0863('0x6')+_0x588401,_0x5bd05c);SmsMessageEvents['on'](_0x588401,_0x413d42);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0086636..fc70d86 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 _0x4fc1=['removeAgents','util','path','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4fc1,0x15d));var _0x14fc=function(_0x10cb8b,_0x19cdd4){_0x10cb8b=_0x10cb8b-0x0;var _0x35a5df=_0x4fc1[_0x10cb8b];return _0x35a5df;};'use strict';var multer=require('multer');var util=require(_0x14fc('0x0'));var path=require(_0x14fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x14fc('0x2'));var router=express[_0x14fc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x14fc('0x4'));var config=require('../../config/environment');var controller=require(_0x14fc('0x5'));router[_0x14fc('0x6')]('/',auth[_0x14fc('0x7')](),controller[_0x14fc('0x8')]);router[_0x14fc('0x6')](_0x14fc('0x9'),auth[_0x14fc('0x7')](),controller[_0x14fc('0xa')]);router[_0x14fc('0x6')](_0x14fc('0xb'),auth['isAuthenticated'](),controller[_0x14fc('0xc')]);router['get'](_0x14fc('0xd'),auth['isAuthenticated'](),controller[_0x14fc('0xe')]);router[_0x14fc('0x6')](_0x14fc('0xf'),auth[_0x14fc('0x7')](),controller[_0x14fc('0x10')]);router[_0x14fc('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x14fc('0x11')]);router[_0x14fc('0x12')]('/',auth[_0x14fc('0x7')](),controller[_0x14fc('0x13')]);router[_0x14fc('0x12')](_0x14fc('0xf'),auth[_0x14fc('0x7')](),controller[_0x14fc('0x14')]);router[_0x14fc('0x12')](_0x14fc('0x15'),auth[_0x14fc('0x7')](),controller[_0x14fc('0x16')]);router[_0x14fc('0x17')]('/:id',auth[_0x14fc('0x7')](),controller[_0x14fc('0x18')]);router[_0x14fc('0x19')]('/:id',auth[_0x14fc('0x7')](),controller[_0x14fc('0x1a')]);router[_0x14fc('0x19')](_0x14fc('0xf'),auth['isAuthenticated'](),controller[_0x14fc('0x1b')]);router[_0x14fc('0x19')](_0x14fc('0x15'),auth[_0x14fc('0x7')](),controller[_0x14fc('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8d25=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','exports','multer','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8d25,0x174));var _0x58d2=function(_0x2272c2,_0x354eb4){_0x2272c2=_0x2272c2-0x0;var _0x2910a3=_0x8d25[_0x2272c2];return _0x2910a3;};'use strict';var multer=require(_0x58d2('0x0'));var util=require('util');var path=require(_0x58d2('0x1'));var timeout=require(_0x58d2('0x2'));var express=require(_0x58d2('0x3'));var router=express['Router']();var fs_extra=require(_0x58d2('0x4'));var auth=require(_0x58d2('0x5'));var interaction=require(_0x58d2('0x6'));var config=require(_0x58d2('0x7'));var controller=require('./smsQueue.controller');router[_0x58d2('0x8')]('/',auth[_0x58d2('0x9')](),controller['index']);router[_0x58d2('0x8')](_0x58d2('0xa'),auth[_0x58d2('0x9')](),controller['describe']);router['get'](_0x58d2('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x58d2('0x9')](),controller['getMembers']);router[_0x58d2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x58d2('0xc'),auth[_0x58d2('0x9')](),controller[_0x58d2('0xd')]);router[_0x58d2('0xe')]('/',auth[_0x58d2('0x9')](),controller[_0x58d2('0xf')]);router['post'](_0x58d2('0x10'),auth['isAuthenticated'](),controller[_0x58d2('0x11')]);router['post'](_0x58d2('0xc'),auth[_0x58d2('0x9')](),controller[_0x58d2('0x12')]);router['put'](_0x58d2('0xb'),auth[_0x58d2('0x9')](),controller[_0x58d2('0x13')]);router[_0x58d2('0x14')](_0x58d2('0xb'),auth[_0x58d2('0x9')](),controller['destroy']);router[_0x58d2('0x14')](_0x58d2('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x58d2('0xc'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x58d2('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 998d1f3..f93fc42 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 _0x587e=['ENUM','rrmemory','roundrobin','exports','STRING','name'];(function(_0x47a4c1,_0x40080d){var _0x201f98=function(_0x3dfa7b){while(--_0x3dfa7b){_0x47a4c1['push'](_0x47a4c1['shift']());}};_0x201f98(++_0x40080d);}(_0x587e,0x1e3));var _0xe587=function(_0x1e1398,_0x426833){_0x1e1398=_0x1e1398-0x0;var _0x1c61ad=_0x587e[_0x1e1398];return _0x1c61ad;};'use strict';var Sequelize=require('sequelize');module[_0xe587('0x0')]={'name':{'type':Sequelize[_0xe587('0x1')],'unique':_0xe587('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe587('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe587('0x3')](_0xe587('0x4'),'beepall',_0xe587('0x5'))}}; \ No newline at end of file +var _0x3d56=['INTEGER','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0x3d56,0x73));var _0x63d5=function(_0xf238ea,_0x1d723b){_0xf238ea=_0xf238ea-0x0;var _0xcd7625=_0x3d56[_0xf238ea];return _0xcd7625;};'use strict';var Sequelize=require(_0x63d5('0x0'));module[_0x63d5('0x1')]={'name':{'type':Sequelize[_0x63d5('0x2')],'unique':_0x63d5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x63d5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x63d5('0x5'),_0x63d5('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3ba8e76..9a98497 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x440192,_0x2144c1){var _0x46e319=function(_0x1f9a6b){while(--_0x1f9a6b){_0x440192['push'](_0x440192['shift']());}};_0x46e319(++_0x2144c1);}(_0x7a54,0x106));var _0x47a5=function(_0xd6518a,_0x1ff1dd){_0xd6518a=_0xd6518a-0x0;var _0x2fd569=_0x7a54[_0xd6518a];return _0x2fd569;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x2bacef,_0x4a3219){var _0x242daf=function(_0x88a069){while(--_0x88a069){_0x2bacef['push'](_0x2bacef['shift']());}};_0x242daf(++_0x4a3219);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35f211,_0x42aeb2){_0x35f211=_0x35f211-0x0;var _0xee876e=_0x5f2f[_0x35f211];return _0xee876e;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 017b734..25d40ac 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 _0xda91=['hasOwnProperty','hook','events','SmsQueue','setMaxListeners','save','update','emit'];(function(_0xbfc431,_0xb79d29){var _0x3b99c0=function(_0x2d014d){while(--_0x2d014d){_0xbfc431['push'](_0xbfc431['shift']());}};_0x3b99c0(++_0xb79d29);}(_0xda91,0x72));var _0x1da9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xda91[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x1da9('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1da9('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1da9('0x2')](0x0);var events={'afterCreate':_0x1da9('0x3'),'afterUpdate':_0x1da9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x572685){return function(_0x23a4dd,_0x782414,_0x2ad3f8){SmsQueueEvents[_0x1da9('0x5')](_0x572685+':'+_0x23a4dd['id'],_0x23a4dd);SmsQueueEvents[_0x1da9('0x5')](_0x572685,_0x23a4dd);_0x2ad3f8(null);};}for(var e in events){if(events[_0x1da9('0x6')](e)){var event=events[e];SmsQueue[_0x1da9('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe890=['emit','hook','exports','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x572c30,_0x15594f){var _0x430d0e=function(_0x29af32){while(--_0x29af32){_0x572c30['push'](_0x572c30['shift']());}};_0x430d0e(++_0x15594f);}(_0xe890,0x1e3));var _0x0e89=function(_0x4345b5,_0x248c24){_0x4345b5=_0x4345b5-0x0;var _0xd38e1c=_0xe890[_0x4345b5];return _0xd38e1c;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x0e89('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0e89('0x1')](0x0);var events={'afterCreate':_0x0e89('0x2'),'afterUpdate':_0x0e89('0x3'),'afterDestroy':_0x0e89('0x4')};function emitEvent(_0x2b710e){return function(_0x22654f,_0x29d869,_0x39351f){SmsQueueEvents[_0x0e89('0x5')](_0x2b710e+':'+_0x22654f['id'],_0x22654f);SmsQueueEvents[_0x0e89('0x5')](_0x2b710e,_0x22654f);_0x39351f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x0e89('0x6')](e,emitEvent(event));}}module[_0x0e89('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d923ffc..032a91f 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 _0x9820=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9820,0x1b3));var _0x0982=function(_0x2900d0,_0x256fcf){_0x2900d0=_0x2900d0-0x0;var _0x3a4241=_0x9820[_0x2900d0];return _0x3a4241;};'use strict';var _=require(_0x0982('0x0'));var util=require('util');var logger=require(_0x0982('0x1'))('api');var moment=require(_0x0982('0x2'));var BPromise=require(_0x0982('0x3'));var rp=require(_0x0982('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0982('0x5'));var attributes=require(_0x0982('0x6'));module[_0x0982('0x7')]=function(_0x489775,_0x53c656){return _0x489775[_0x0982('0x8')](_0x0982('0x9'),attributes,{'tableName':_0x0982('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf60b=['request-promise','path','rimraf','../../config/environment','exports','define','sms_queues','lodash','../../config/logger','bluebird'];(function(_0x58a43e,_0x456f99){var _0x48d39c=function(_0x26f72f){while(--_0x26f72f){_0x58a43e['push'](_0x58a43e['shift']());}};_0x48d39c(++_0x456f99);}(_0xf60b,0xe3));var _0xbf60=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xf60b[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0xbf60('0x0'));var util=require('util');var logger=require(_0xbf60('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbf60('0x2'));var rp=require(_0xbf60('0x3'));var fs=require('fs');var path=require(_0xbf60('0x4'));var rimraf=require(_0xbf60('0x5'));var config=require(_0xbf60('0x6'));var attributes=require('./smsQueue.attributes');module[_0xbf60('0x7')]=function(_0x167e78,_0x498ba9){return _0x167e78[_0xbf60('0x8')]('SmsQueue',attributes,{'tableName':_0xbf60('0x9'),'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 63048eb..36ca3fd 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 _0x228a=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','findAll','options','raw','where','limit','map','model','attributes','include','then','GetSmsQueue','ShowSmsQueue','SmsQueue','lodash'];(function(_0x388578,_0x1df11e){var _0x95e762=function(_0x518964){while(--_0x518964){_0x388578['push'](_0x388578['shift']());}};_0x95e762(++_0x1df11e);}(_0x228a,0xef));var _0xa228=function(_0x4f4446,_0x3e530d){_0x4f4446=_0x4f4446-0x0;var _0x265646=_0x228a[_0x4f4446];return _0x265646;};'use strict';var _=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var moment=require(_0xa228('0x2'));var BPromise=require(_0xa228('0x3'));var rs=require(_0xa228('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa228('0x5'))['db'];var utils=require(_0xa228('0x6'));var logger=require('../../config/logger')(_0xa228('0x7'));var config=require(_0xa228('0x8'));var jayson=require(_0xa228('0x9'));var client=jayson[_0xa228('0xa')][_0xa228('0xb')]({'port':0x232a});config[_0xa228('0xc')]=_[_0xa228('0xd')](config[_0xa228('0xc')],{'host':_0xa228('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa228('0xc')]));require(_0xa228('0xf'))['register'](socket);function respondWithRpcPromise(_0x30bc93,_0x472c23,_0x5a3c9b){return new BPromise(function(_0x1e2018,_0x45fe47){return client[_0xa228('0x10')](_0x30bc93,_0x5a3c9b)['then'](function(_0x403dc1){logger[_0xa228('0x11')](_0xa228('0x12'),_0x472c23,'request\x20sent');logger[_0xa228('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x472c23,'request\x20sent',JSON[_0xa228('0x14')](_0x403dc1));if(_0x403dc1[_0xa228('0x15')]){if(_0x403dc1[_0xa228('0x15')][_0xa228('0x16')]===0x1f4){logger['error'](_0xa228('0x12'),_0x472c23,_0x403dc1['error'][_0xa228('0x17')]);return _0x45fe47(_0x403dc1[_0xa228('0x15')][_0xa228('0x17')]);}logger['error'](_0xa228('0x12'),_0x472c23,_0x403dc1['error']['message']);return _0x1e2018(_0x403dc1['error'][_0xa228('0x17')]);}else{logger['info'](_0xa228('0x12'),_0x472c23,_0xa228('0x18'));_0x1e2018(_0x403dc1[_0xa228('0x19')][_0xa228('0x17')]);}})[_0xa228('0x1a')](function(_0x54860c){logger['error'](_0xa228('0x12'),_0x472c23,_0x54860c);_0x45fe47(_0x54860c);});});}exports['GetSmsQueue']=function(_0xfb40fb){var _0x314bbf=this;return new Promise(function(_0x3cecee,_0x2844ed){return db['SmsQueue'][_0xa228('0x1b')]({'raw':_0xfb40fb['options']?_0xfb40fb[_0xa228('0x1c')][_0xa228('0x1d')]===undefined?!![]:![]:!![],'where':_0xfb40fb['options']?_0xfb40fb[_0xa228('0x1c')][_0xa228('0x1e')]||null:null,'attributes':_0xfb40fb[_0xa228('0x1c')]?_0xfb40fb[_0xa228('0x1c')]['attributes']||null:null,'limit':_0xfb40fb[_0xa228('0x1c')]?_0xfb40fb[_0xa228('0x1c')][_0xa228('0x1f')]||null:null,'include':_0xfb40fb['options']?_0xfb40fb[_0xa228('0x1c')]['include']?_[_0xa228('0x20')](_0xfb40fb[_0xa228('0x1c')]['include'],function(_0x43382e){return{'model':db[_0x43382e[_0xa228('0x21')]],'as':_0x43382e['as'],'attributes':_0x43382e[_0xa228('0x22')],'include':_0x43382e[_0xa228('0x23')]?_[_0xa228('0x20')](_0x43382e[_0xa228('0x23')],function(_0x58e895){return{'model':db[_0x58e895['model']],'as':_0x58e895['as'],'attributes':_0x58e895[_0xa228('0x22')],'include':_0x58e895[_0xa228('0x23')]?_['map'](_0x58e895[_0xa228('0x23')],function(_0x362342){return{'model':db[_0x362342[_0xa228('0x21')]],'as':_0x362342['as'],'attributes':_0x362342['attributes']};}):[]};}):[]};}):[]:[]})[_0xa228('0x24')](function(_0xb209ec){logger['info'](_0xa228('0x25'),_0xfb40fb);logger[_0xa228('0x13')](_0xa228('0x25'),_0xfb40fb,JSON[_0xa228('0x14')](_0xb209ec));_0x3cecee(_0xb209ec);})[_0xa228('0x1a')](function(_0x394d07){logger[_0xa228('0x15')](_0xa228('0x25'),_0x394d07[_0xa228('0x17')],_0xfb40fb);_0x2844ed(_0x314bbf['error'](0x1f4,_0x394d07[_0xa228('0x17')]));});});};exports[_0xa228('0x26')]=function(_0x36e813){var _0x1e8e25=this;return new Promise(function(_0x2bf11,_0x324d48){return db[_0xa228('0x27')]['find']({'raw':_0x36e813['options']?_0x36e813[_0xa228('0x1c')][_0xa228('0x1d')]===undefined?!![]:![]:!![],'where':_0x36e813['options']?_0x36e813[_0xa228('0x1c')][_0xa228('0x1e')]||null:null,'attributes':_0x36e813['options']?_0x36e813[_0xa228('0x1c')][_0xa228('0x22')]||null:null,'include':_0x36e813[_0xa228('0x1c')]?_0x36e813[_0xa228('0x1c')][_0xa228('0x23')]?_[_0xa228('0x20')](_0x36e813[_0xa228('0x1c')][_0xa228('0x23')],function(_0x22d6cf){return{'model':db[_0x22d6cf[_0xa228('0x21')]],'as':_0x22d6cf['as'],'attributes':_0x22d6cf[_0xa228('0x22')],'include':_0x22d6cf[_0xa228('0x23')]?_[_0xa228('0x20')](_0x22d6cf[_0xa228('0x23')],function(_0x5d2568){return{'model':db[_0x5d2568[_0xa228('0x21')]],'as':_0x5d2568['as'],'attributes':_0x5d2568['attributes'],'include':_0x5d2568[_0xa228('0x23')]?_['map'](_0x5d2568['include'],function(_0x31cfa2){return{'model':db[_0x31cfa2[_0xa228('0x21')]],'as':_0x31cfa2['as'],'attributes':_0x31cfa2[_0xa228('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa228('0x24')](function(_0xe0126a){logger[_0xa228('0x11')](_0xa228('0x26'),_0x36e813);logger[_0xa228('0x13')](_0xa228('0x26'),_0x36e813,JSON[_0xa228('0x14')](_0xe0126a));_0x2bf11(_0xe0126a);})[_0xa228('0x1a')](function(_0xa6a185){logger[_0xa228('0x15')](_0xa228('0x26'),_0xa6a185[_0xa228('0x17')],_0x36e813);_0x324d48(_0x1e8e25['error'](0x1f4,_0xa6a185[_0xa228('0x17')]));});});}; \ No newline at end of file +var _0xcc3c=['request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','info'];(function(_0x42629e,_0x8d4f04){var _0x47f1c5=function(_0x1134d2){while(--_0x1134d2){_0x42629e['push'](_0x42629e['shift']());}};_0x47f1c5(++_0x8d4f04);}(_0xcc3c,0x1eb));var _0xccc3=function(_0xeaffed,_0x2406f8){_0xeaffed=_0xeaffed-0x0;var _0x540580=_0xcc3c[_0xeaffed];return _0x540580;};'use strict';var _=require(_0xccc3('0x0'));var util=require(_0xccc3('0x1'));var moment=require(_0xccc3('0x2'));var BPromise=require(_0xccc3('0x3'));var rs=require(_0xccc3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccc3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xccc3('0x6'));var config=require(_0xccc3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xccc3('0x8')]['http']({'port':0x232a});config[_0xccc3('0x9')]=_[_0xccc3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xccc3('0xb'))(new Redis(config[_0xccc3('0x9')]));require(_0xccc3('0xc'))[_0xccc3('0xd')](socket);function respondWithRpcPromise(_0xa15db2,_0x2e892f,_0x2ab296){return new BPromise(function(_0x525188,_0x4e1b57){return client[_0xccc3('0xe')](_0xa15db2,_0x2ab296)['then'](function(_0x25fcef){logger[_0xccc3('0xf')]('SmsQueue,\x20%s,\x20%s',_0x2e892f,_0xccc3('0x10'));logger[_0xccc3('0x11')](_0xccc3('0x12'),_0x2e892f,_0xccc3('0x10'),JSON['stringify'](_0x25fcef));if(_0x25fcef[_0xccc3('0x13')]){if(_0x25fcef[_0xccc3('0x13')][_0xccc3('0x14')]===0x1f4){logger[_0xccc3('0x13')](_0xccc3('0x15'),_0x2e892f,_0x25fcef['error'][_0xccc3('0x16')]);return _0x4e1b57(_0x25fcef[_0xccc3('0x13')][_0xccc3('0x16')]);}logger['error'](_0xccc3('0x15'),_0x2e892f,_0x25fcef['error'][_0xccc3('0x16')]);return _0x525188(_0x25fcef[_0xccc3('0x13')]['message']);}else{logger['info'](_0xccc3('0x15'),_0x2e892f,_0xccc3('0x10'));_0x525188(_0x25fcef[_0xccc3('0x17')]['message']);}})['catch'](function(_0x5d8ba2){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2e892f,_0x5d8ba2);_0x4e1b57(_0x5d8ba2);});});}exports[_0xccc3('0x18')]=function(_0x20d82f){var _0x1c04d9=this;return new Promise(function(_0x3b1e92,_0x3730ad){return db[_0xccc3('0x19')]['findAll']({'raw':_0x20d82f[_0xccc3('0x1a')]?_0x20d82f[_0xccc3('0x1a')][_0xccc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x20d82f['options']?_0x20d82f[_0xccc3('0x1a')][_0xccc3('0x1c')]||null:null,'attributes':_0x20d82f[_0xccc3('0x1a')]?_0x20d82f['options'][_0xccc3('0x1d')]||null:null,'limit':_0x20d82f[_0xccc3('0x1a')]?_0x20d82f[_0xccc3('0x1a')][_0xccc3('0x1e')]||null:null,'include':_0x20d82f['options']?_0x20d82f[_0xccc3('0x1a')][_0xccc3('0x1f')]?_[_0xccc3('0x20')](_0x20d82f['options'][_0xccc3('0x1f')],function(_0x1c22bd){return{'model':db[_0x1c22bd[_0xccc3('0x21')]],'as':_0x1c22bd['as'],'attributes':_0x1c22bd[_0xccc3('0x1d')],'include':_0x1c22bd['include']?_['map'](_0x1c22bd[_0xccc3('0x1f')],function(_0x145fb2){return{'model':db[_0x145fb2[_0xccc3('0x21')]],'as':_0x145fb2['as'],'attributes':_0x145fb2[_0xccc3('0x1d')],'include':_0x145fb2[_0xccc3('0x1f')]?_['map'](_0x145fb2[_0xccc3('0x1f')],function(_0x5a3506){return{'model':db[_0x5a3506[_0xccc3('0x21')]],'as':_0x5a3506['as'],'attributes':_0x5a3506[_0xccc3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x313bfb){logger[_0xccc3('0xf')](_0xccc3('0x18'),_0x20d82f);logger[_0xccc3('0x11')](_0xccc3('0x18'),_0x20d82f,JSON['stringify'](_0x313bfb));_0x3b1e92(_0x313bfb);})[_0xccc3('0x22')](function(_0x59b53d){logger['error'](_0xccc3('0x18'),_0x59b53d[_0xccc3('0x16')],_0x20d82f);_0x3730ad(_0x1c04d9['error'](0x1f4,_0x59b53d['message']));});});};exports[_0xccc3('0x23')]=function(_0x7cf24b){var _0x2ea81c=this;return new Promise(function(_0x368074,_0xc63391){return db[_0xccc3('0x19')][_0xccc3('0x24')]({'raw':_0x7cf24b[_0xccc3('0x1a')]?_0x7cf24b[_0xccc3('0x1a')][_0xccc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x7cf24b[_0xccc3('0x1a')]?_0x7cf24b[_0xccc3('0x1a')][_0xccc3('0x1c')]||null:null,'attributes':_0x7cf24b[_0xccc3('0x1a')]?_0x7cf24b[_0xccc3('0x1a')][_0xccc3('0x1d')]||null:null,'include':_0x7cf24b[_0xccc3('0x1a')]?_0x7cf24b[_0xccc3('0x1a')][_0xccc3('0x1f')]?_['map'](_0x7cf24b['options'][_0xccc3('0x1f')],function(_0x54ad81){return{'model':db[_0x54ad81[_0xccc3('0x21')]],'as':_0x54ad81['as'],'attributes':_0x54ad81[_0xccc3('0x1d')],'include':_0x54ad81['include']?_[_0xccc3('0x20')](_0x54ad81[_0xccc3('0x1f')],function(_0x1331e4){return{'model':db[_0x1331e4[_0xccc3('0x21')]],'as':_0x1331e4['as'],'attributes':_0x1331e4['attributes'],'include':_0x1331e4[_0xccc3('0x1f')]?_['map'](_0x1331e4[_0xccc3('0x1f')],function(_0xea8f15){return{'model':db[_0xea8f15[_0xccc3('0x21')]],'as':_0xea8f15['as'],'attributes':_0xea8f15[_0xccc3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xccc3('0x25')](function(_0x35304f){logger[_0xccc3('0xf')]('ShowSmsQueue',_0x7cf24b);logger[_0xccc3('0x11')](_0xccc3('0x23'),_0x7cf24b,JSON[_0xccc3('0x26')](_0x35304f));_0x368074(_0x35304f);})['catch'](function(_0x2e80f9){logger[_0xccc3('0x13')](_0xccc3('0x23'),_0x2e80f9[_0xccc3('0x16')],_0x7cf24b);_0xc63391(_0x2ea81c[_0xccc3('0x13')](0x1f4,_0x2e80f9[_0xccc3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8b6ee3c..35a9f37 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 _0x8b64=['length','./smsQueue.events','save','remove','update','removeListener','register'];(function(_0x43e2df,_0x2cc0d1){var _0x47f3bf=function(_0x2e735b){while(--_0x2e735b){_0x43e2df['push'](_0x43e2df['shift']());}};_0x47f3bf(++_0x2cc0d1);}(_0x8b64,0xe1));var _0x48b6=function(_0x5bb2e6,_0x5323a8){_0x5bb2e6=_0x5bb2e6-0x0;var _0x8d4149=_0x8b64[_0x5bb2e6];return _0x8d4149;};'use strict';var SmsQueueEvents=require(_0x48b6('0x0'));var events=[_0x48b6('0x1'),_0x48b6('0x2'),_0x48b6('0x3')];function createListener(_0x364ad4,_0x31c74a){return function(_0x37b130){_0x31c74a['emit'](_0x364ad4,_0x37b130);};}function removeListener(_0x1b493d,_0x1582bd){return function(){SmsQueueEvents[_0x48b6('0x4')](_0x1b493d,_0x1582bd);};}exports[_0x48b6('0x5')]=function(_0x560737){for(var _0x5d8034=0x0,_0x49703a=events[_0x48b6('0x6')];_0x5d8034<_0x49703a;_0x5d8034++){var _0x3eafff=events[_0x5d8034];var _0x47d561=createListener('smsQueue:'+_0x3eafff,_0x560737);SmsQueueEvents['on'](_0x3eafff,_0x47d561);}}; \ No newline at end of file +var _0x4228=['save','remove','update','emit','register','./smsQueue.events'];(function(_0x338f03,_0x28941b){var _0x514d7e=function(_0x417fba){while(--_0x417fba){_0x338f03['push'](_0x338f03['shift']());}};_0x514d7e(++_0x28941b);}(_0x4228,0xb9));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x8422('0x0'));var events=[_0x8422('0x1'),_0x8422('0x2'),_0x8422('0x3')];function createListener(_0x59868a,_0x277514){return function(_0x10e2b4){_0x277514[_0x8422('0x4')](_0x59868a,_0x10e2b4);};}function removeListener(_0x28d021,_0x2f67a4){return function(){SmsQueueEvents['removeListener'](_0x28d021,_0x2f67a4);};}exports[_0x8422('0x5')]=function(_0x5f55f7){for(var _0x314158=0x0,_0x106d94=events['length'];_0x314158<_0x106d94;_0x314158++){var _0x507db2=events[_0x314158];var _0x566e60=createListener('smsQueue:'+_0x507db2,_0x5f55f7);SmsQueueEvents['on'](_0x507db2,_0x566e60);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index aa425df..9c6795f 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 _0x1caf=['create','put','delete','destroy','exports','multer','path','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','/:id','show'];(function(_0x480365,_0x5d6561){var _0x10147c=function(_0x3dc482){while(--_0x3dc482){_0x480365['push'](_0x480365['shift']());}};_0x10147c(++_0x5d6561);}(_0x1caf,0x1e1));var _0xf1ca=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1caf[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xf1ca('0x0'));var util=require('util');var path=require(_0xf1ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf1ca('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xf1ca('0x3'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xf1ca('0x4')](),controller['index']);router[_0xf1ca('0x5')](_0xf1ca('0x6'),auth[_0xf1ca('0x4')](),controller['describe']);router['get'](_0xf1ca('0x7'),auth[_0xf1ca('0x4')](),controller[_0xf1ca('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf1ca('0x9')]);router[_0xf1ca('0xa')](_0xf1ca('0x7'),auth[_0xf1ca('0x4')](),controller['update']);router[_0xf1ca('0xb')](_0xf1ca('0x7'),auth[_0xf1ca('0x4')](),controller[_0xf1ca('0xc')]);module[_0xf1ca('0xd')]=router; \ No newline at end of file +var _0x11a1=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','/describe','get'];(function(_0x136c87,_0x20df36){var _0x22cd23=function(_0x8e3fcb){while(--_0x8e3fcb){_0x136c87['push'](_0x136c87['shift']());}};_0x22cd23(++_0x20df36);}(_0x11a1,0xbd));var _0x111a=function(_0x14312a,_0x173007){_0x14312a=_0x14312a-0x0;var _0x396f02=_0x11a1[_0x14312a];return _0x396f02;};'use strict';var multer=require(_0x111a('0x0'));var util=require(_0x111a('0x1'));var path=require(_0x111a('0x2'));var timeout=require(_0x111a('0x3'));var express=require(_0x111a('0x4'));var router=express[_0x111a('0x5')]();var fs_extra=require(_0x111a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x111a('0x7'));var controller=require(_0x111a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x111a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x111a('0xa')](_0x111a('0xb'),auth[_0x111a('0xc')](),controller[_0x111a('0xd')]);router[_0x111a('0xe')]('/',auth[_0x111a('0xc')](),controller[_0x111a('0xf')]);router[_0x111a('0x10')](_0x111a('0xb'),auth[_0x111a('0xc')](),controller[_0x111a('0x11')]);router['delete'](_0x111a('0xb'),auth[_0x111a('0xc')](),controller[_0x111a('0x12')]);module[_0x111a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 29a1214..1d7c68f 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 _0x1833=['STRING','DATE','moment','sequelize','exports'];(function(_0x5d6b31,_0x4a1326){var _0x185b50=function(_0x63a9f6){while(--_0x63a9f6){_0x5d6b31['push'](_0x5d6b31['shift']());}};_0x185b50(++_0x4a1326);}(_0x1833,0xed));var _0x3183=function(_0x5b9989,_0x2cf715){_0x5b9989=_0x5b9989-0x0;var _0xe45bbe=_0x1833[_0x5b9989];return _0xe45bbe;};'use strict';var moment=require(_0x3183('0x0'));var Sequelize=require(_0x3183('0x1'));module[_0x3183('0x2')]={'uniqueid':{'type':Sequelize[_0x3183('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3183('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3183('0x4')]},'exitAt':{'type':Sequelize[_0x3183('0x4')]},'reason':{'type':Sequelize[_0x3183('0x3')]}}; \ No newline at end of file +var _0x188e=['STRING','DATE','moment','sequelize','exports'];(function(_0x5aa6ab,_0x2430b6){var _0x130274=function(_0x2fe3c8){while(--_0x2fe3c8){_0x5aa6ab['push'](_0x5aa6ab['shift']());}};_0x130274(++_0x2430b6);}(_0x188e,0x156));var _0xe188=function(_0xfc39ed,_0x3d970e){_0xfc39ed=_0xfc39ed-0x0;var _0x563f29=_0x188e[_0xfc39ed];return _0x563f29;};'use strict';var moment=require(_0xe188('0x0'));var Sequelize=require(_0xe188('0x1'));module[_0xe188('0x2')]={'uniqueid':{'type':Sequelize[_0xe188('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe188('0x4')]},'leaveAt':{'type':Sequelize[_0xe188('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe188('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e2bc8f2..45fedb4 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 _0xb4d0=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','SmsQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xb4d0,0x17b));var _0x0b4d=function(_0x2b5edd,_0x5bf41b){_0x2b5edd=_0x2b5edd-0x0;var _0x56b8f5=_0xb4d0[_0x2b5edd];return _0x56b8f5;};'use strict';var emlformat=require(_0x0b4d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b4d('0x1'));var BPromise=require(_0x0b4d('0x2'));var Mustache=require(_0x0b4d('0x3'));var util=require(_0x0b4d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x0b4d('0x5'));var ejs=require(_0x0b4d('0x6'));var fs=require('fs');var fs_extra=require(_0x0b4d('0x7'));var _=require(_0x0b4d('0x8'));var squel=require('squel');var crypto=require(_0x0b4d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b4d('0x5'));var querystring=require(_0x0b4d('0xa'));var Papa=require(_0x0b4d('0xb'));var Redis=require(_0x0b4d('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0b4d('0xd'));var as=require(_0x0b4d('0xe'));var hardwareService=require(_0x0b4d('0xf'));var logger=require(_0x0b4d('0x10'))(_0x0b4d('0x11'));var utils=require(_0x0b4d('0x12'));var config=require(_0x0b4d('0x13'));var licenseUtil=require(_0x0b4d('0x14'));var db=require(_0x0b4d('0x15'))['db'];function respondWithStatusCode(_0x321a84,_0x3081e5){_0x3081e5=_0x3081e5||0xcc;return function(_0x1fd26a){if(_0x1fd26a){return _0x321a84[_0x0b4d('0x16')](_0x3081e5);}return _0x321a84[_0x0b4d('0x17')](_0x3081e5)[_0x0b4d('0x18')]();};}function respondWithResult(_0x27eaab,_0x49d621){_0x49d621=_0x49d621||0xc8;return function(_0x5e731d){if(_0x5e731d){return _0x27eaab[_0x0b4d('0x17')](_0x49d621)[_0x0b4d('0x19')](_0x5e731d);}};}function respondWithFilteredResult(_0x186ce3,_0x2bc8b1){return function(_0x3c504f){if(_0x3c504f){var _0x3a8585=typeof _0x2bc8b1[_0x0b4d('0x1a')]===_0x0b4d('0x1b')&&typeof _0x2bc8b1[_0x0b4d('0x1c')]===_0x0b4d('0x1b');var _0x1fb7e6=_0x3c504f[_0x0b4d('0x1d')];var _0x267b8c=_0x3a8585?0x0:_0x2bc8b1[_0x0b4d('0x1a')];var _0x19194d=_0x3a8585?_0x3c504f[_0x0b4d('0x1d')]:_0x2bc8b1[_0x0b4d('0x1a')]+_0x2bc8b1[_0x0b4d('0x1c')];var _0x33646b;if(_0x19194d>=_0x1fb7e6){_0x19194d=_0x1fb7e6;_0x33646b=0xc8;}else{_0x33646b=0xce;}_0x186ce3[_0x0b4d('0x17')](_0x33646b);return _0x186ce3[_0x0b4d('0x1e')](_0x0b4d('0x1f'),_0x267b8c+'-'+_0x19194d+'/'+_0x1fb7e6)[_0x0b4d('0x19')](_0x3c504f);}return null;};}function patchUpdates(_0x47c300){return function(_0x32a5ef){try{jsonpatch['apply'](_0x32a5ef,_0x47c300,!![]);}catch(_0x2890ef){return BPromise[_0x0b4d('0x20')](_0x2890ef);}return _0x32a5ef[_0x0b4d('0x21')]();};}function saveUpdates(_0xcca66a,_0x236ab4){return function(_0x52fd10){if(_0x52fd10){return _0x52fd10[_0x0b4d('0x22')](_0xcca66a)[_0x0b4d('0x23')](function(_0x33389e){return _0x33389e;});}return null;};}function removeEntity(_0x9d64cc,_0x349764){return function(_0x516d9d){if(_0x516d9d){return _0x516d9d[_0x0b4d('0x24')]()[_0x0b4d('0x23')](function(){_0x9d64cc[_0x0b4d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525008,_0x43f8ee){return function(_0x4a430a){if(!_0x4a430a){_0x525008[_0x0b4d('0x16')](0x194);}return _0x4a430a;};}function handleError(_0x449ae7,_0x100c49){_0x100c49=_0x100c49||0x1f4;return function(_0x536aff){logger[_0x0b4d('0x25')](_0x536aff[_0x0b4d('0x26')]);if(_0x536aff[_0x0b4d('0x27')]){delete _0x536aff[_0x0b4d('0x27')];}_0x449ae7[_0x0b4d('0x17')](_0x100c49)['send'](_0x536aff);};}exports[_0x0b4d('0x28')]=function(_0x13b89d,_0x26dd44){var _0x11c40e={},_0x538e7e={},_0x6f1ac6={'count':0x0,'rows':[]};var _0x4c22f3=_[_0x0b4d('0x29')](db['SmsQueueReport'][_0x0b4d('0x2a')],function(_0x45177b){return{'name':_0x45177b[_0x0b4d('0x2b')],'type':_0x45177b['type'][_0x0b4d('0x2c')]};});_0x538e7e['model']=_[_0x0b4d('0x29')](_0x4c22f3,'name');_0x538e7e[_0x0b4d('0x2d')]=_[_0x0b4d('0x2e')](_0x13b89d[_0x0b4d('0x2d')]);_0x538e7e[_0x0b4d('0x2f')]=_['intersection'](_0x538e7e[_0x0b4d('0x30')],_0x538e7e[_0x0b4d('0x2d')]);_0x11c40e[_0x0b4d('0x31')]=_[_0x0b4d('0x32')](_0x538e7e[_0x0b4d('0x30')],qs[_0x0b4d('0x33')](_0x13b89d['query'][_0x0b4d('0x33')]));_0x11c40e[_0x0b4d('0x31')]=_0x11c40e['attributes'][_0x0b4d('0x34')]?_0x11c40e[_0x0b4d('0x31')]:_0x538e7e[_0x0b4d('0x30')];if(!_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x35')](_0x0b4d('0x36'))){_0x11c40e[_0x0b4d('0x1c')]=qs[_0x0b4d('0x1c')](_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x1c')]);_0x11c40e[_0x0b4d('0x1a')]=qs[_0x0b4d('0x1a')](_0x13b89d[_0x0b4d('0x2d')]['offset']);}_0x11c40e[_0x0b4d('0x37')]=qs[_0x0b4d('0x38')](_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x38')]);_0x11c40e['where']=qs[_0x0b4d('0x2f')](_[_0x0b4d('0x39')](_0x13b89d[_0x0b4d('0x2d')],_0x538e7e['filters']),_0x4c22f3);if(_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x3a')]){_0x11c40e[_0x0b4d('0x3b')]=_['merge'](_0x11c40e[_0x0b4d('0x3b')],{'$or':_[_0x0b4d('0x29')](_0x4c22f3,function(_0x3e27f4){if(_0x3e27f4[_0x0b4d('0x3c')]!==_0x0b4d('0x3d')){var _0x19bf17={};_0x19bf17[_0x3e27f4[_0x0b4d('0x27')]]={'$like':'%'+_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x3a')]+'%'};return _0x19bf17;}})});}_0x11c40e=_[_0x0b4d('0x3e')]({},_0x11c40e,_0x13b89d[_0x0b4d('0x3f')]);var _0x261b17={'where':_0x11c40e[_0x0b4d('0x3b')]};return db[_0x0b4d('0x40')]['count'](_0x261b17)['then'](function(_0x2d8965){_0x6f1ac6[_0x0b4d('0x1d')]=_0x2d8965;if(_0x13b89d[_0x0b4d('0x2d')][_0x0b4d('0x41')]){_0x11c40e[_0x0b4d('0x42')]=[{'all':!![]}];}return db[_0x0b4d('0x40')][_0x0b4d('0x43')](_0x11c40e);})[_0x0b4d('0x23')](function(_0x5294ef){_0x6f1ac6[_0x0b4d('0x44')]=_0x5294ef;return _0x6f1ac6;})[_0x0b4d('0x23')](respondWithFilteredResult(_0x26dd44,_0x11c40e))['catch'](handleError(_0x26dd44,null));};exports[_0x0b4d('0x45')]=function(_0x54eda7,_0x3cbf1e){var _0x2801cb={'raw':!![],'where':{'id':_0x54eda7[_0x0b4d('0x46')]['id']}},_0x32338a={};_0x32338a['model']=_['keys'](db[_0x0b4d('0x40')][_0x0b4d('0x2a')]);_0x32338a[_0x0b4d('0x2d')]=_[_0x0b4d('0x2e')](_0x54eda7[_0x0b4d('0x2d')]);_0x32338a[_0x0b4d('0x2f')]=_[_0x0b4d('0x32')](_0x32338a[_0x0b4d('0x30')],_0x32338a[_0x0b4d('0x2d')]);_0x2801cb['attributes']=_[_0x0b4d('0x32')](_0x32338a[_0x0b4d('0x30')],qs[_0x0b4d('0x33')](_0x54eda7['query'][_0x0b4d('0x33')]));_0x2801cb[_0x0b4d('0x31')]=_0x2801cb['attributes'][_0x0b4d('0x34')]?_0x2801cb[_0x0b4d('0x31')]:_0x32338a[_0x0b4d('0x30')];if(_0x54eda7[_0x0b4d('0x2d')][_0x0b4d('0x41')]){_0x2801cb[_0x0b4d('0x42')]=[{'all':!![]}];}_0x2801cb=_[_0x0b4d('0x3e')]({},_0x2801cb,_0x54eda7['options']);return db['SmsQueueReport'][_0x0b4d('0x47')](_0x2801cb)[_0x0b4d('0x23')](handleEntityNotFound(_0x3cbf1e,null))['then'](respondWithResult(_0x3cbf1e,null))[_0x0b4d('0x48')](handleError(_0x3cbf1e,null));};exports[_0x0b4d('0x49')]=function(_0x417d9f,_0x1f0798){return db[_0x0b4d('0x40')][_0x0b4d('0x49')](_0x417d9f['body'],{})[_0x0b4d('0x23')](respondWithResult(_0x1f0798,0xc9))[_0x0b4d('0x48')](handleError(_0x1f0798,null));};exports[_0x0b4d('0x22')]=function(_0x22911b,_0x1e8b30){if(_0x22911b[_0x0b4d('0x4a')]['id']){delete _0x22911b[_0x0b4d('0x4a')]['id'];}return db[_0x0b4d('0x40')][_0x0b4d('0x47')]({'where':{'id':_0x22911b['params']['id']}})[_0x0b4d('0x23')](handleEntityNotFound(_0x1e8b30,null))[_0x0b4d('0x23')](saveUpdates(_0x22911b['body'],null))['then'](respondWithResult(_0x1e8b30,null))[_0x0b4d('0x48')](handleError(_0x1e8b30,null));};exports[_0x0b4d('0x24')]=function(_0x21bf6e,_0x5084bf){return db[_0x0b4d('0x40')]['find']({'where':{'id':_0x21bf6e[_0x0b4d('0x46')]['id']}})[_0x0b4d('0x23')](handleEntityNotFound(_0x5084bf,null))[_0x0b4d('0x23')](removeEntity(_0x5084bf,null))[_0x0b4d('0x48')](handleError(_0x5084bf,null));};exports[_0x0b4d('0x4b')]=function(_0x2ddff3,_0x28aa25){return db['SmsQueueReport'][_0x0b4d('0x4b')]()[_0x0b4d('0x23')](respondWithResult(_0x28aa25,null))[_0x0b4d('0x48')](handleError(_0x28aa25,null));}; \ No newline at end of file +var _0xbddb=['pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','length','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','SmsQueueReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where'];(function(_0x4a027c,_0x355e49){var _0x5981ce=function(_0x36bf71){while(--_0x36bf71){_0x4a027c['push'](_0x4a027c['shift']());}};_0x5981ce(++_0x355e49);}(_0xbddb,0x1ce));var _0xbbdd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbddb[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xbbdd('0x0'));var rimraf=require(_0xbbdd('0x1'));var zipdir=require(_0xbbdd('0x2'));var jsonpatch=require(_0xbbdd('0x3'));var rp=require(_0xbbdd('0x4'));var moment=require(_0xbbdd('0x5'));var BPromise=require(_0xbbdd('0x6'));var Mustache=require(_0xbbdd('0x7'));var util=require(_0xbbdd('0x8'));var path=require(_0xbbdd('0x9'));var sox=require(_0xbbdd('0xa'));var csv=require(_0xbbdd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbdd('0xc'));var _=require(_0xbbdd('0xd'));var squel=require(_0xbbdd('0xe'));var crypto=require('crypto');var jsforce=require(_0xbbdd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbbdd('0xb'));var querystring=require(_0xbbdd('0x10'));var Papa=require(_0xbbdd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbbdd('0x12'));var as=require(_0xbbdd('0x13'));var hardwareService=require(_0xbbdd('0x14'));var logger=require(_0xbbdd('0x15'))(_0xbbdd('0x16'));var utils=require(_0xbbdd('0x17'));var config=require(_0xbbdd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbdd('0x19'))['db'];function respondWithStatusCode(_0x48f28f,_0x20c91d){_0x20c91d=_0x20c91d||0xcc;return function(_0x287f34){if(_0x287f34){return _0x48f28f['sendStatus'](_0x20c91d);}return _0x48f28f[_0xbbdd('0x1a')](_0x20c91d)[_0xbbdd('0x1b')]();};}function respondWithResult(_0x1dbf1a,_0x336fc0){_0x336fc0=_0x336fc0||0xc8;return function(_0x51957a){if(_0x51957a){return _0x1dbf1a[_0xbbdd('0x1a')](_0x336fc0)[_0xbbdd('0x1c')](_0x51957a);}};}function respondWithFilteredResult(_0x1455b5,_0x209ba1){return function(_0x181cc1){if(_0x181cc1){var _0x6b4018=typeof _0x209ba1[_0xbbdd('0x1d')]==='undefined'&&typeof _0x209ba1[_0xbbdd('0x1e')]===_0xbbdd('0x1f');var _0x440298=_0x181cc1[_0xbbdd('0x20')];var _0x1f9a2d=_0x6b4018?0x0:_0x209ba1[_0xbbdd('0x1d')];var _0x544fca=_0x6b4018?_0x181cc1[_0xbbdd('0x20')]:_0x209ba1[_0xbbdd('0x1d')]+_0x209ba1[_0xbbdd('0x1e')];var _0x1e0282;if(_0x544fca>=_0x440298){_0x544fca=_0x440298;_0x1e0282=0xc8;}else{_0x1e0282=0xce;}_0x1455b5[_0xbbdd('0x1a')](_0x1e0282);return _0x1455b5[_0xbbdd('0x21')](_0xbbdd('0x22'),_0x1f9a2d+'-'+_0x544fca+'/'+_0x440298)[_0xbbdd('0x1c')](_0x181cc1);}return null;};}function patchUpdates(_0xc9ad3b){return function(_0x3bbb43){try{jsonpatch[_0xbbdd('0x23')](_0x3bbb43,_0xc9ad3b,!![]);}catch(_0x40b982){return BPromise[_0xbbdd('0x24')](_0x40b982);}return _0x3bbb43[_0xbbdd('0x25')]();};}function saveUpdates(_0x4fdfe7,_0x276887){return function(_0x25c0b1){if(_0x25c0b1){return _0x25c0b1['update'](_0x4fdfe7)[_0xbbdd('0x26')](function(_0x5cc41a){return _0x5cc41a;});}return null;};}function removeEntity(_0x35b65d,_0x2af77f){return function(_0x34b4c6){if(_0x34b4c6){return _0x34b4c6['destroy']()[_0xbbdd('0x26')](function(){_0x35b65d[_0xbbdd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ae87,_0x1f22c6){return function(_0x98796b){if(!_0x98796b){_0x39ae87['sendStatus'](0x194);}return _0x98796b;};}function handleError(_0x101679,_0x1af0dc){_0x1af0dc=_0x1af0dc||0x1f4;return function(_0x2b46fd){logger[_0xbbdd('0x27')](_0x2b46fd[_0xbbdd('0x28')]);if(_0x2b46fd[_0xbbdd('0x29')]){delete _0x2b46fd[_0xbbdd('0x29')];}_0x101679[_0xbbdd('0x1a')](_0x1af0dc)[_0xbbdd('0x2a')](_0x2b46fd);};}exports['index']=function(_0x408bd1,_0xf0dae5){var _0x5ef03f={},_0x33e91b={},_0x147209={'count':0x0,'rows':[]};var _0x48982a=_['map'](db[_0xbbdd('0x2b')]['rawAttributes'],function(_0x252c2e){return{'name':_0x252c2e[_0xbbdd('0x2c')],'type':_0x252c2e[_0xbbdd('0x2d')]['key']};});_0x33e91b['model']=_['map'](_0x48982a,'name');_0x33e91b[_0xbbdd('0x2e')]=_[_0xbbdd('0x2f')](_0x408bd1[_0xbbdd('0x2e')]);_0x33e91b[_0xbbdd('0x30')]=_[_0xbbdd('0x31')](_0x33e91b[_0xbbdd('0x32')],_0x33e91b[_0xbbdd('0x2e')]);_0x5ef03f[_0xbbdd('0x33')]=_[_0xbbdd('0x31')](_0x33e91b[_0xbbdd('0x32')],qs[_0xbbdd('0x34')](_0x408bd1['query']['fields']));_0x5ef03f['attributes']=_0x5ef03f[_0xbbdd('0x33')]['length']?_0x5ef03f[_0xbbdd('0x33')]:_0x33e91b[_0xbbdd('0x32')];if(!_0x408bd1[_0xbbdd('0x2e')]['hasOwnProperty'](_0xbbdd('0x35'))){_0x5ef03f[_0xbbdd('0x1e')]=qs['limit'](_0x408bd1[_0xbbdd('0x2e')]['limit']);_0x5ef03f['offset']=qs[_0xbbdd('0x1d')](_0x408bd1[_0xbbdd('0x2e')]['offset']);}_0x5ef03f['order']=qs[_0xbbdd('0x36')](_0x408bd1['query'][_0xbbdd('0x36')]);_0x5ef03f[_0xbbdd('0x37')]=qs['filters'](_[_0xbbdd('0x38')](_0x408bd1[_0xbbdd('0x2e')],_0x33e91b[_0xbbdd('0x30')]),_0x48982a);if(_0x408bd1['query'][_0xbbdd('0x39')]){_0x5ef03f['where']=_[_0xbbdd('0x3a')](_0x5ef03f[_0xbbdd('0x37')],{'$or':_['map'](_0x48982a,function(_0x2fdb35){if(_0x2fdb35['type']!==_0xbbdd('0x3b')){var _0x25717d={};_0x25717d[_0x2fdb35['name']]={'$like':'%'+_0x408bd1[_0xbbdd('0x2e')][_0xbbdd('0x39')]+'%'};return _0x25717d;}})});}_0x5ef03f=_['merge']({},_0x5ef03f,_0x408bd1[_0xbbdd('0x3c')]);var _0x149d15={'where':_0x5ef03f[_0xbbdd('0x37')]};return db[_0xbbdd('0x2b')][_0xbbdd('0x20')](_0x149d15)[_0xbbdd('0x26')](function(_0x4e4efc){_0x147209['count']=_0x4e4efc;if(_0x408bd1[_0xbbdd('0x2e')][_0xbbdd('0x3d')]){_0x5ef03f[_0xbbdd('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x5ef03f);})['then'](function(_0xea7d6a){_0x147209[_0xbbdd('0x3f')]=_0xea7d6a;return _0x147209;})['then'](respondWithFilteredResult(_0xf0dae5,_0x5ef03f))[_0xbbdd('0x40')](handleError(_0xf0dae5,null));};exports['show']=function(_0x1da708,_0x591dbb){var _0x1a4dc8={'raw':!![],'where':{'id':_0x1da708[_0xbbdd('0x41')]['id']}},_0x2e69ee={};_0x2e69ee[_0xbbdd('0x32')]=_[_0xbbdd('0x2f')](db[_0xbbdd('0x2b')][_0xbbdd('0x42')]);_0x2e69ee[_0xbbdd('0x2e')]=_[_0xbbdd('0x2f')](_0x1da708['query']);_0x2e69ee[_0xbbdd('0x30')]=_[_0xbbdd('0x31')](_0x2e69ee[_0xbbdd('0x32')],_0x2e69ee['query']);_0x1a4dc8[_0xbbdd('0x33')]=_[_0xbbdd('0x31')](_0x2e69ee[_0xbbdd('0x32')],qs['fields'](_0x1da708[_0xbbdd('0x2e')][_0xbbdd('0x34')]));_0x1a4dc8['attributes']=_0x1a4dc8['attributes'][_0xbbdd('0x43')]?_0x1a4dc8[_0xbbdd('0x33')]:_0x2e69ee[_0xbbdd('0x32')];if(_0x1da708[_0xbbdd('0x2e')][_0xbbdd('0x3d')]){_0x1a4dc8[_0xbbdd('0x3e')]=[{'all':!![]}];}_0x1a4dc8=_[_0xbbdd('0x3a')]({},_0x1a4dc8,_0x1da708['options']);return db[_0xbbdd('0x2b')][_0xbbdd('0x44')](_0x1a4dc8)[_0xbbdd('0x26')](handleEntityNotFound(_0x591dbb,null))['then'](respondWithResult(_0x591dbb,null))['catch'](handleError(_0x591dbb,null));};exports['create']=function(_0x54a8b5,_0x40bed8){return db[_0xbbdd('0x2b')][_0xbbdd('0x45')](_0x54a8b5[_0xbbdd('0x46')],{})[_0xbbdd('0x26')](respondWithResult(_0x40bed8,0xc9))['catch'](handleError(_0x40bed8,null));};exports[_0xbbdd('0x47')]=function(_0x23330a,_0x327875){if(_0x23330a[_0xbbdd('0x46')]['id']){delete _0x23330a['body']['id'];}return db[_0xbbdd('0x2b')]['find']({'where':{'id':_0x23330a['params']['id']}})[_0xbbdd('0x26')](handleEntityNotFound(_0x327875,null))[_0xbbdd('0x26')](saveUpdates(_0x23330a[_0xbbdd('0x46')],null))[_0xbbdd('0x26')](respondWithResult(_0x327875,null))[_0xbbdd('0x40')](handleError(_0x327875,null));};exports[_0xbbdd('0x48')]=function(_0x4471ec,_0x496146){return db[_0xbbdd('0x2b')][_0xbbdd('0x44')]({'where':{'id':_0x4471ec[_0xbbdd('0x41')]['id']}})[_0xbbdd('0x26')](handleEntityNotFound(_0x496146,null))[_0xbbdd('0x26')](removeEntity(_0x496146,null))['catch'](handleError(_0x496146,null));};exports[_0xbbdd('0x49')]=function(_0x3c94a9,_0x4a6962){return db[_0xbbdd('0x2b')][_0xbbdd('0x49')]()['then'](respondWithResult(_0x4a6962,null))[_0xbbdd('0x40')](handleError(_0x4a6962,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7857e22..a3e8e8d 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x5dc34a,_0x55bb50){var _0x47f8ce=function(_0x59297e){while(--_0x59297e){_0x5dc34a['push'](_0x5dc34a['shift']());}};_0x47f8ce(++_0x55bb50);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29c4aa,_0x40deff){var _0x55de1b=function(_0x44ab2e){while(--_0x44ab2e){_0x29c4aa['push'](_0x29c4aa['shift']());}};_0x55de1b(++_0x40deff);}(_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 38c1ac5..4236bc7 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 _0xf050=['catch','UpdateSmsQueueReport','update','attributes','stringify','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf050,0x161));var _0x0f05=function(_0x414cbe,_0x16a463){_0x414cbe=_0x414cbe-0x0;var _0x2793fe=_0xf050[_0x414cbe];return _0x2793fe;};'use strict';var _=require('lodash');var util=require(_0x0f05('0x0'));var moment=require(_0x0f05('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f05('0x3'))['db'];var utils=require(_0x0f05('0x4'));var logger=require('../../config/logger')(_0x0f05('0x5'));var config=require(_0x0f05('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0f05('0x7')][_0x0f05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c5625,_0x811552,_0x5b68e2){return new BPromise(function(_0x463d1d,_0x1bca77){return client[_0x0f05('0x9')](_0x4c5625,_0x5b68e2)[_0x0f05('0xa')](function(_0x4a46b4){logger[_0x0f05('0xb')](_0x0f05('0xc'),_0x811552,_0x0f05('0xd'));logger[_0x0f05('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x811552,'request\x20sent',JSON['stringify'](_0x4a46b4));if(_0x4a46b4['error']){if(_0x4a46b4['error']['code']===0x1f4){logger[_0x0f05('0xf')](_0x0f05('0xc'),_0x811552,_0x4a46b4[_0x0f05('0xf')]['message']);return _0x1bca77(_0x4a46b4[_0x0f05('0xf')][_0x0f05('0x10')]);}logger[_0x0f05('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x811552,_0x4a46b4[_0x0f05('0xf')]['message']);return _0x463d1d(_0x4a46b4['error'][_0x0f05('0x10')]);}else{logger['info'](_0x0f05('0xc'),_0x811552,_0x0f05('0xd'));_0x463d1d(_0x4a46b4[_0x0f05('0x11')][_0x0f05('0x10')]);}})['catch'](function(_0x4637be){logger[_0x0f05('0xf')](_0x0f05('0xc'),_0x811552,_0x4637be);_0x1bca77(_0x4637be);});});}exports[_0x0f05('0x12')]=function(_0x2f1b47){var _0x3e6169=this;return new Promise(function(_0x4780b7,_0x32256d){return db[_0x0f05('0x13')][_0x0f05('0x14')](_0x2f1b47[_0x0f05('0x15')],{'raw':_0x2f1b47[_0x0f05('0x16')]?_0x2f1b47[_0x0f05('0x16')][_0x0f05('0x17')]===undefined?!![]:![]:!![]})[_0x0f05('0xa')](function(_0x5a89fd){logger[_0x0f05('0xb')]('CreateSmsQueueReport',_0x2f1b47);logger[_0x0f05('0xe')]('CreateSmsQueueReport',_0x2f1b47,JSON['stringify'](_0x5a89fd));_0x4780b7(_0x5a89fd);})[_0x0f05('0x18')](function(_0x5cfb2f){logger[_0x0f05('0xf')](_0x0f05('0x12'),_0x5cfb2f[_0x0f05('0x10')],_0x2f1b47);_0x32256d(_0x3e6169[_0x0f05('0xf')](0x1f4,_0x5cfb2f[_0x0f05('0x10')]));});});};exports[_0x0f05('0x19')]=function(_0x5e9e45){var _0x1e8b21=this;return new Promise(function(_0x16e688,_0x1c1721){return db['SmsQueueReport'][_0x0f05('0x1a')](_0x5e9e45[_0x0f05('0x15')],{'raw':_0x5e9e45['options']?_0x5e9e45[_0x0f05('0x16')][_0x0f05('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e9e45[_0x0f05('0x16')]?_0x5e9e45[_0x0f05('0x16')]['where']||null:null,'attributes':_0x5e9e45[_0x0f05('0x16')]?_0x5e9e45[_0x0f05('0x16')][_0x0f05('0x1b')]||null:null,'limit':_0x5e9e45[_0x0f05('0x16')]?_0x5e9e45[_0x0f05('0x16')]['limit']||null:null})[_0x0f05('0xa')](function(_0x3dc6c5){logger[_0x0f05('0xb')]('UpdateSmsQueueReport',_0x5e9e45);logger[_0x0f05('0xe')](_0x0f05('0x19'),_0x5e9e45,JSON[_0x0f05('0x1c')](_0x3dc6c5));_0x16e688(_0x3dc6c5);})[_0x0f05('0x18')](function(_0x47182a){logger[_0x0f05('0xf')](_0x0f05('0x19'),_0x47182a[_0x0f05('0x10')],_0x5e9e45);_0x1c1721(_0x1e8b21[_0x0f05('0xf')](0x1f4,_0x47182a[_0x0f05('0x10')]));});});}; \ No newline at end of file +var _0x1a17=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','debug','UpdateSmsQueueReport','update','raw','where','attributes','catch','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1a17,0x191));var _0x71a1=function(_0x45fe25,_0x2046a6){_0x45fe25=_0x45fe25-0x0;var _0x580b66=_0x1a17[_0x45fe25];return _0x580b66;};'use strict';var _=require(_0x71a1('0x0'));var util=require(_0x71a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71a1('0x2'));var fs=require('fs');var Redis=require(_0x71a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x71a1('0x4'));var logger=require(_0x71a1('0x5'))(_0x71a1('0x6'));var config=require('../../config/environment');var jayson=require(_0x71a1('0x7'));var client=jayson[_0x71a1('0x8')][_0x71a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa868d1,_0xa98d79,_0x448c6f){return new BPromise(function(_0x3fa8ad,_0x3cd8a1){return client['request'](_0xa868d1,_0x448c6f)[_0x71a1('0xa')](function(_0xe4d887){logger[_0x71a1('0xb')](_0x71a1('0xc'),_0xa98d79,_0x71a1('0xd'));logger['debug'](_0x71a1('0xe'),_0xa98d79,_0x71a1('0xd'),JSON[_0x71a1('0xf')](_0xe4d887));if(_0xe4d887[_0x71a1('0x10')]){if(_0xe4d887[_0x71a1('0x10')][_0x71a1('0x11')]===0x1f4){logger[_0x71a1('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xa98d79,_0xe4d887[_0x71a1('0x10')][_0x71a1('0x12')]);return _0x3cd8a1(_0xe4d887[_0x71a1('0x10')][_0x71a1('0x12')]);}logger[_0x71a1('0x10')](_0x71a1('0xc'),_0xa98d79,_0xe4d887[_0x71a1('0x10')]['message']);return _0x3fa8ad(_0xe4d887[_0x71a1('0x10')][_0x71a1('0x12')]);}else{logger[_0x71a1('0xb')](_0x71a1('0xc'),_0xa98d79,_0x71a1('0xd'));_0x3fa8ad(_0xe4d887['result'][_0x71a1('0x12')]);}})['catch'](function(_0x51b608){logger['error'](_0x71a1('0xc'),_0xa98d79,_0x51b608);_0x3cd8a1(_0x51b608);});});}exports[_0x71a1('0x13')]=function(_0x27c459){var _0x3e4bfc=this;return new Promise(function(_0x67449f,_0x8b84b){return db[_0x71a1('0x14')][_0x71a1('0x15')](_0x27c459[_0x71a1('0x16')],{'raw':_0x27c459[_0x71a1('0x17')]?_0x27c459[_0x71a1('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x71a1('0xa')](function(_0x4d7618){logger[_0x71a1('0xb')](_0x71a1('0x13'),_0x27c459);logger[_0x71a1('0x18')](_0x71a1('0x13'),_0x27c459,JSON[_0x71a1('0xf')](_0x4d7618));_0x67449f(_0x4d7618);})['catch'](function(_0x51e7f5){logger[_0x71a1('0x10')](_0x71a1('0x13'),_0x51e7f5['message'],_0x27c459);_0x8b84b(_0x3e4bfc['error'](0x1f4,_0x51e7f5[_0x71a1('0x12')]));});});};exports[_0x71a1('0x19')]=function(_0x4db71e){var _0x51f0fc=this;return new Promise(function(_0x371b7f,_0x7d39a1){return db[_0x71a1('0x14')][_0x71a1('0x1a')](_0x4db71e['body'],{'raw':_0x4db71e[_0x71a1('0x17')]?_0x4db71e[_0x71a1('0x17')][_0x71a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db71e[_0x71a1('0x17')]?_0x4db71e[_0x71a1('0x17')][_0x71a1('0x1c')]||null:null,'attributes':_0x4db71e['options']?_0x4db71e['options'][_0x71a1('0x1d')]||null:null,'limit':_0x4db71e[_0x71a1('0x17')]?_0x4db71e['options']['limit']||null:null})['then'](function(_0x1e31cc){logger['info'](_0x71a1('0x19'),_0x4db71e);logger[_0x71a1('0x18')](_0x71a1('0x19'),_0x4db71e,JSON[_0x71a1('0xf')](_0x1e31cc));_0x371b7f(_0x1e31cc);})[_0x71a1('0x1e')](function(_0x58d8ca){logger['error']('UpdateSmsQueueReport',_0x58d8ca[_0x71a1('0x12')],_0x4db71e);_0x7d39a1(_0x51f0fc[_0x71a1('0x10')](0x1f4,_0x58d8ca[_0x71a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1008ab3..6da9be4 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 _0x1db9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','post','create','/:id','multer'];(function(_0x2c4d00,_0x443e86){var _0x46daac=function(_0x3fda6b){while(--_0x3fda6b){_0x2c4d00['push'](_0x2c4d00['shift']());}};_0x46daac(++_0x443e86);}(_0x1db9,0x176));var _0x91db=function(_0x2248ac,_0xa73276){_0x2248ac=_0x2248ac-0x0;var _0x2f140e=_0x1db9[_0x2248ac];return _0x2f140e;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0xc')]('/',auth[_0x91db('0xa')](),controller[_0x91db('0xd')]);router['put'](_0x91db('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x91db('0xe'),auth[_0x91db('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6c32=['get','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller'];(function(_0x26d751,_0x2b22a4){var _0x74e59c=function(_0x281294){while(--_0x281294){_0x26d751['push'](_0x26d751['shift']());}};_0x74e59c(++_0x2b22a4);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var fs_extra=require(_0x26c3('0x6'));var auth=require(_0x26c3('0x7'));var interaction=require(_0x26c3('0x8'));var config=require('../../config/environment');var controller=require(_0x26c3('0x9'));router[_0x26c3('0xa')]('/',auth[_0x26c3('0xb')](),controller['index']);router[_0x26c3('0xa')]('/describe',auth[_0x26c3('0xb')](),controller[_0x26c3('0xc')]);router[_0x26c3('0xa')](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0xe')]);router[_0x26c3('0xf')]('/',auth[_0x26c3('0xb')](),controller[_0x26c3('0x10')]);router[_0x26c3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0x12')]);module[_0x26c3('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d25f480..290e065 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x474376,_0x385824){var _0x9141b=function(_0x229a9f){while(--_0x229a9f){_0x474376['push'](_0x474376['shift']());}};_0x9141b(++_0x385824);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x240341,_0x3ad07e){var _0x1852d4=function(_0x4decd9){while(--_0x4decd9){_0x240341['push'](_0x240341['shift']());}};_0x1852d4(++_0x3ad07e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b4493,_0x106e71){_0x3b4493=_0x3b4493-0x0;var _0x28fc72=_0xf3cd[_0x3b4493];return _0x28fc72;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9634e79..73a64fb 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 _0xce84=['destroy','then','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xce84,0x112));var _0x4ce8=function(_0x6f81a0,_0x416c2d){_0x6f81a0=_0x6f81a0-0x0;var _0x2a5404=_0xce84[_0x6f81a0];return _0x2a5404;};'use strict';var emlformat=require(_0x4ce8('0x0'));var rimraf=require(_0x4ce8('0x1'));var zipdir=require(_0x4ce8('0x2'));var jsonpatch=require(_0x4ce8('0x3'));var rp=require('request-promise');var moment=require(_0x4ce8('0x4'));var BPromise=require(_0x4ce8('0x5'));var Mustache=require(_0x4ce8('0x6'));var util=require(_0x4ce8('0x7'));var path=require(_0x4ce8('0x8'));var sox=require(_0x4ce8('0x9'));var csv=require(_0x4ce8('0xa'));var ejs=require(_0x4ce8('0xb'));var fs=require('fs');var fs_extra=require(_0x4ce8('0xc'));var _=require('lodash');var squel=require(_0x4ce8('0xd'));var crypto=require('crypto');var jsforce=require(_0x4ce8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ce8('0xf'));var Redis=require(_0x4ce8('0x10'));var authService=require(_0x4ce8('0x11'));var qs=require(_0x4ce8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ce8('0x13'));var logger=require(_0x4ce8('0x14'))(_0x4ce8('0x15'));var utils=require(_0x4ce8('0x16'));var config=require(_0x4ce8('0x17'));var licenseUtil=require(_0x4ce8('0x18'));var db=require(_0x4ce8('0x19'))['db'];function respondWithStatusCode(_0x34894b,_0x325340){_0x325340=_0x325340||0xcc;return function(_0xb04236){if(_0xb04236){return _0x34894b[_0x4ce8('0x1a')](_0x325340);}return _0x34894b[_0x4ce8('0x1b')](_0x325340)[_0x4ce8('0x1c')]();};}function respondWithResult(_0x4be9cb,_0x2dd322){_0x2dd322=_0x2dd322||0xc8;return function(_0x43d172){if(_0x43d172){return _0x4be9cb[_0x4ce8('0x1b')](_0x2dd322)[_0x4ce8('0x1d')](_0x43d172);}};}function respondWithFilteredResult(_0x58ca90,_0x556b35){return function(_0xcc003f){if(_0xcc003f){var _0x127125=typeof _0x556b35[_0x4ce8('0x1e')]===_0x4ce8('0x1f')&&typeof _0x556b35['limit']==='undefined';var _0x4919a3=_0xcc003f[_0x4ce8('0x20')];var _0x186f49=_0x127125?0x0:_0x556b35['offset'];var _0xd4fd90=_0x127125?_0xcc003f[_0x4ce8('0x20')]:_0x556b35[_0x4ce8('0x1e')]+_0x556b35[_0x4ce8('0x21')];var _0xa5baaf;if(_0xd4fd90>=_0x4919a3){_0xd4fd90=_0x4919a3;_0xa5baaf=0xc8;}else{_0xa5baaf=0xce;}_0x58ca90[_0x4ce8('0x1b')](_0xa5baaf);return _0x58ca90['set'](_0x4ce8('0x22'),_0x186f49+'-'+_0xd4fd90+'/'+_0x4919a3)['json'](_0xcc003f);}return null;};}function patchUpdates(_0x5d7352){return function(_0x1642a3){try{jsonpatch['apply'](_0x1642a3,_0x5d7352,!![]);}catch(_0x41f484){return BPromise[_0x4ce8('0x23')](_0x41f484);}return _0x1642a3[_0x4ce8('0x24')]();};}function saveUpdates(_0x4719c5,_0x12b6d6){return function(_0x250c79){if(_0x250c79){return _0x250c79[_0x4ce8('0x25')](_0x4719c5)['then'](function(_0x4fdc38){return _0x4fdc38;});}return null;};}function removeEntity(_0x327489,_0x4efad8){return function(_0x58009e){if(_0x58009e){return _0x58009e[_0x4ce8('0x26')]()[_0x4ce8('0x27')](function(){_0x327489['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e296,_0x5a5031){return function(_0x16d622){if(!_0x16d622){_0x30e296[_0x4ce8('0x1a')](0x194);}return _0x16d622;};}function handleError(_0x9d7fa,_0x10d77b){_0x10d77b=_0x10d77b||0x1f4;return function(_0x4aee09){logger[_0x4ce8('0x28')](_0x4aee09[_0x4ce8('0x29')]);if(_0x4aee09[_0x4ce8('0x2a')]){delete _0x4aee09[_0x4ce8('0x2a')];}_0x9d7fa[_0x4ce8('0x1b')](_0x10d77b)[_0x4ce8('0x2b')](_0x4aee09);};}exports[_0x4ce8('0x2c')]=function(_0xb92a6a,_0x3c1d3b){var _0x27e1cb={},_0x5e3d4e={},_0x23c8da={'count':0x0,'rows':[]};var _0x469810=_[_0x4ce8('0x2d')](db[_0x4ce8('0x2e')]['rawAttributes'],function(_0x1ce51d){return{'name':_0x1ce51d[_0x4ce8('0x2f')],'type':_0x1ce51d[_0x4ce8('0x30')][_0x4ce8('0x31')]};});_0x5e3d4e[_0x4ce8('0x32')]=_[_0x4ce8('0x2d')](_0x469810,_0x4ce8('0x2a'));_0x5e3d4e['query']=_[_0x4ce8('0x33')](_0xb92a6a['query']);_0x5e3d4e[_0x4ce8('0x34')]=_['intersection'](_0x5e3d4e[_0x4ce8('0x32')],_0x5e3d4e[_0x4ce8('0x35')]);_0x27e1cb[_0x4ce8('0x36')]=_['intersection'](_0x5e3d4e[_0x4ce8('0x32')],qs[_0x4ce8('0x37')](_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x37')]));_0x27e1cb[_0x4ce8('0x36')]=_0x27e1cb[_0x4ce8('0x36')][_0x4ce8('0x38')]?_0x27e1cb[_0x4ce8('0x36')]:_0x5e3d4e[_0x4ce8('0x32')];if(!_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x39')]('nolimit')){_0x27e1cb[_0x4ce8('0x21')]=qs['limit'](_0xb92a6a[_0x4ce8('0x35')]['limit']);_0x27e1cb[_0x4ce8('0x1e')]=qs[_0x4ce8('0x1e')](_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x1e')]);}_0x27e1cb[_0x4ce8('0x3a')]=qs[_0x4ce8('0x3b')](_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x3b')]);_0x27e1cb[_0x4ce8('0x3c')]=qs['filters'](_[_0x4ce8('0x3d')](_0xb92a6a[_0x4ce8('0x35')],_0x5e3d4e[_0x4ce8('0x34')]),_0x469810);if(_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x3e')]){_0x27e1cb[_0x4ce8('0x3c')]=_[_0x4ce8('0x3f')](_0x27e1cb[_0x4ce8('0x3c')],{'$or':_[_0x4ce8('0x2d')](_0x469810,function(_0x1cef1f){if(_0x1cef1f['type']!==_0x4ce8('0x40')){var _0x3150c7={};_0x3150c7[_0x1cef1f['name']]={'$like':'%'+_0xb92a6a[_0x4ce8('0x35')]['filter']+'%'};return _0x3150c7;}})});}_0x27e1cb=_['merge']({},_0x27e1cb,_0xb92a6a[_0x4ce8('0x41')]);var _0x270a95={'where':_0x27e1cb['where']};return db[_0x4ce8('0x2e')][_0x4ce8('0x20')](_0x270a95)['then'](function(_0xe2b095){_0x23c8da[_0x4ce8('0x20')]=_0xe2b095;if(_0xb92a6a[_0x4ce8('0x35')][_0x4ce8('0x42')]){_0x27e1cb[_0x4ce8('0x43')]=[{'all':!![]}];}return db[_0x4ce8('0x2e')]['findAll'](_0x27e1cb);})[_0x4ce8('0x27')](function(_0x55bfbb){_0x23c8da[_0x4ce8('0x44')]=_0x55bfbb;return _0x23c8da;})[_0x4ce8('0x27')](respondWithFilteredResult(_0x3c1d3b,_0x27e1cb))[_0x4ce8('0x45')](handleError(_0x3c1d3b,null));};exports[_0x4ce8('0x46')]=function(_0x6ec614,_0x3f3b46){var _0xa746e8={'raw':!![],'where':{'id':_0x6ec614[_0x4ce8('0x47')]['id']}},_0x3c7199={};_0x3c7199['model']=_[_0x4ce8('0x33')](db['SmsTransferReport'][_0x4ce8('0x48')]);_0x3c7199[_0x4ce8('0x35')]=_['keys'](_0x6ec614[_0x4ce8('0x35')]);_0x3c7199[_0x4ce8('0x34')]=_[_0x4ce8('0x49')](_0x3c7199[_0x4ce8('0x32')],_0x3c7199[_0x4ce8('0x35')]);_0xa746e8[_0x4ce8('0x36')]=_[_0x4ce8('0x49')](_0x3c7199['model'],qs[_0x4ce8('0x37')](_0x6ec614['query'][_0x4ce8('0x37')]));_0xa746e8[_0x4ce8('0x36')]=_0xa746e8[_0x4ce8('0x36')]['length']?_0xa746e8[_0x4ce8('0x36')]:_0x3c7199[_0x4ce8('0x32')];if(_0x6ec614['query'][_0x4ce8('0x42')]){_0xa746e8[_0x4ce8('0x43')]=[{'all':!![]}];}_0xa746e8=_[_0x4ce8('0x3f')]({},_0xa746e8,_0x6ec614[_0x4ce8('0x41')]);return db[_0x4ce8('0x2e')][_0x4ce8('0x4a')](_0xa746e8)[_0x4ce8('0x27')](handleEntityNotFound(_0x3f3b46,null))[_0x4ce8('0x27')](respondWithResult(_0x3f3b46,null))['catch'](handleError(_0x3f3b46,null));};exports['create']=function(_0x57f81d,_0x2c352d){return db[_0x4ce8('0x2e')][_0x4ce8('0x4b')](_0x57f81d[_0x4ce8('0x4c')],{})[_0x4ce8('0x27')](respondWithResult(_0x2c352d,0xc9))[_0x4ce8('0x45')](handleError(_0x2c352d,null));};exports[_0x4ce8('0x25')]=function(_0x249730,_0x2c6932){if(_0x249730[_0x4ce8('0x4c')]['id']){delete _0x249730[_0x4ce8('0x4c')]['id'];}return db[_0x4ce8('0x2e')][_0x4ce8('0x4a')]({'where':{'id':_0x249730['params']['id']}})[_0x4ce8('0x27')](handleEntityNotFound(_0x2c6932,null))[_0x4ce8('0x27')](saveUpdates(_0x249730['body'],null))[_0x4ce8('0x27')](respondWithResult(_0x2c6932,null))[_0x4ce8('0x45')](handleError(_0x2c6932,null));};exports[_0x4ce8('0x26')]=function(_0x532c7c,_0x397ec0){return db[_0x4ce8('0x2e')]['find']({'where':{'id':_0x532c7c[_0x4ce8('0x47')]['id']}})[_0x4ce8('0x27')](handleEntityNotFound(_0x397ec0,null))[_0x4ce8('0x27')](removeEntity(_0x397ec0,null))[_0x4ce8('0x45')](handleError(_0x397ec0,null));};exports[_0x4ce8('0x4d')]=function(_0x2d7112,_0x58cd2e){return db[_0x4ce8('0x2e')][_0x4ce8('0x4d')]()[_0x4ce8('0x27')](respondWithResult(_0x58cd2e,null))[_0x4ce8('0x45')](handleError(_0x58cd2e,null));}; \ No newline at end of file +var _0x6634=['../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','attributes','fields','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','rows','params','keys','intersection','length','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3ae886,_0x3c8ba3){var _0xc7db76=function(_0x400c00){while(--_0x400c00){_0x3ae886['push'](_0x3ae886['shift']());}};_0xc7db76(++_0x3c8ba3);}(_0x6634,0xcd));var _0x4663=function(_0x32e9e9,_0x3df5aa){_0x32e9e9=_0x32e9e9-0x0;var _0x400b63=_0x6634[_0x32e9e9];return _0x400b63;};'use strict';var emlformat=require(_0x4663('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4663('0x1'));var jsonpatch=require(_0x4663('0x2'));var rp=require(_0x4663('0x3'));var moment=require('moment');var BPromise=require(_0x4663('0x4'));var Mustache=require(_0x4663('0x5'));var util=require('util');var path=require(_0x4663('0x6'));var sox=require(_0x4663('0x7'));var csv=require(_0x4663('0x8'));var ejs=require(_0x4663('0x9'));var fs=require('fs');var fs_extra=require(_0x4663('0xa'));var _=require(_0x4663('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4663('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4663('0x8'));var querystring=require(_0x4663('0xd'));var Papa=require(_0x4663('0xe'));var Redis=require(_0x4663('0xf'));var authService=require(_0x4663('0x10'));var qs=require(_0x4663('0x11'));var as=require(_0x4663('0x12'));var hardwareService=require(_0x4663('0x13'));var logger=require(_0x4663('0x14'))(_0x4663('0x15'));var utils=require('../../config/utils');var config=require(_0x4663('0x16'));var licenseUtil=require(_0x4663('0x17'));var db=require(_0x4663('0x18'))['db'];function respondWithStatusCode(_0x3c70b9,_0x58004f){_0x58004f=_0x58004f||0xcc;return function(_0x41f60d){if(_0x41f60d){return _0x3c70b9['sendStatus'](_0x58004f);}return _0x3c70b9['status'](_0x58004f)[_0x4663('0x19')]();};}function respondWithResult(_0x462bd9,_0x5f3725){_0x5f3725=_0x5f3725||0xc8;return function(_0x2aa4c2){if(_0x2aa4c2){return _0x462bd9[_0x4663('0x1a')](_0x5f3725)[_0x4663('0x1b')](_0x2aa4c2);}};}function respondWithFilteredResult(_0x382875,_0x492b41){return function(_0x6883bb){if(_0x6883bb){var _0x186183=typeof _0x492b41[_0x4663('0x1c')]==='undefined'&&typeof _0x492b41[_0x4663('0x1d')]==='undefined';var _0x161027=_0x6883bb[_0x4663('0x1e')];var _0x2195ac=_0x186183?0x0:_0x492b41[_0x4663('0x1c')];var _0x4288fc=_0x186183?_0x6883bb[_0x4663('0x1e')]:_0x492b41[_0x4663('0x1c')]+_0x492b41[_0x4663('0x1d')];var _0x383352;if(_0x4288fc>=_0x161027){_0x4288fc=_0x161027;_0x383352=0xc8;}else{_0x383352=0xce;}_0x382875[_0x4663('0x1a')](_0x383352);return _0x382875[_0x4663('0x1f')](_0x4663('0x20'),_0x2195ac+'-'+_0x4288fc+'/'+_0x161027)[_0x4663('0x1b')](_0x6883bb);}return null;};}function patchUpdates(_0x4fcfff){return function(_0x19a1ed){try{jsonpatch[_0x4663('0x21')](_0x19a1ed,_0x4fcfff,!![]);}catch(_0x33675b){return BPromise[_0x4663('0x22')](_0x33675b);}return _0x19a1ed[_0x4663('0x23')]();};}function saveUpdates(_0x379ccb,_0x13520a){return function(_0x3951fb){if(_0x3951fb){return _0x3951fb[_0x4663('0x24')](_0x379ccb)[_0x4663('0x25')](function(_0x2edaff){return _0x2edaff;});}return null;};}function removeEntity(_0x5144c0,_0x2821ed){return function(_0x4df71c){if(_0x4df71c){return _0x4df71c[_0x4663('0x26')]()['then'](function(){_0x5144c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x469e26,_0x4d5749){return function(_0x4a064b){if(!_0x4a064b){_0x469e26[_0x4663('0x27')](0x194);}return _0x4a064b;};}function handleError(_0x3b580f,_0x19dfbb){_0x19dfbb=_0x19dfbb||0x1f4;return function(_0x4f9401){logger['error'](_0x4f9401[_0x4663('0x28')]);if(_0x4f9401[_0x4663('0x29')]){delete _0x4f9401['name'];}_0x3b580f[_0x4663('0x1a')](_0x19dfbb)[_0x4663('0x2a')](_0x4f9401);};}exports[_0x4663('0x2b')]=function(_0x2b3ead,_0x5bfb3c){var _0x4ffedd={},_0x31b54f={},_0x2c3365={'count':0x0,'rows':[]};var _0x575722=_[_0x4663('0x2c')](db[_0x4663('0x2d')][_0x4663('0x2e')],function(_0x22adaf){return{'name':_0x22adaf[_0x4663('0x2f')],'type':_0x22adaf['type'][_0x4663('0x30')]};});_0x31b54f[_0x4663('0x31')]=_[_0x4663('0x2c')](_0x575722,'name');_0x31b54f[_0x4663('0x32')]=_['keys'](_0x2b3ead[_0x4663('0x32')]);_0x31b54f['filters']=_['intersection'](_0x31b54f['model'],_0x31b54f['query']);_0x4ffedd[_0x4663('0x33')]=_['intersection'](_0x31b54f[_0x4663('0x31')],qs[_0x4663('0x34')](_0x2b3ead[_0x4663('0x32')][_0x4663('0x34')]));_0x4ffedd[_0x4663('0x33')]=_0x4ffedd[_0x4663('0x33')]['length']?_0x4ffedd[_0x4663('0x33')]:_0x31b54f[_0x4663('0x31')];if(!_0x2b3ead[_0x4663('0x32')]['hasOwnProperty'](_0x4663('0x35'))){_0x4ffedd[_0x4663('0x1d')]=qs[_0x4663('0x1d')](_0x2b3ead['query'][_0x4663('0x1d')]);_0x4ffedd[_0x4663('0x1c')]=qs[_0x4663('0x1c')](_0x2b3ead[_0x4663('0x32')][_0x4663('0x1c')]);}_0x4ffedd[_0x4663('0x36')]=qs[_0x4663('0x37')](_0x2b3ead[_0x4663('0x32')]['sort']);_0x4ffedd[_0x4663('0x38')]=qs[_0x4663('0x39')](_[_0x4663('0x3a')](_0x2b3ead[_0x4663('0x32')],_0x31b54f[_0x4663('0x39')]),_0x575722);if(_0x2b3ead['query']['filter']){_0x4ffedd[_0x4663('0x38')]=_[_0x4663('0x3b')](_0x4ffedd[_0x4663('0x38')],{'$or':_['map'](_0x575722,function(_0xbae2f3){if(_0xbae2f3[_0x4663('0x3c')]!=='VIRTUAL'){var _0x13ba6c={};_0x13ba6c[_0xbae2f3[_0x4663('0x29')]]={'$like':'%'+_0x2b3ead['query'][_0x4663('0x3d')]+'%'};return _0x13ba6c;}})});}_0x4ffedd=_['merge']({},_0x4ffedd,_0x2b3ead[_0x4663('0x3e')]);var _0x57d956={'where':_0x4ffedd[_0x4663('0x38')]};return db[_0x4663('0x2d')][_0x4663('0x1e')](_0x57d956)[_0x4663('0x25')](function(_0x59895c){_0x2c3365[_0x4663('0x1e')]=_0x59895c;if(_0x2b3ead['query'][_0x4663('0x3f')]){_0x4ffedd[_0x4663('0x40')]=[{'all':!![]}];}return db[_0x4663('0x2d')][_0x4663('0x41')](_0x4ffedd);})[_0x4663('0x25')](function(_0x5e2acc){_0x2c3365[_0x4663('0x42')]=_0x5e2acc;return _0x2c3365;})[_0x4663('0x25')](respondWithFilteredResult(_0x5bfb3c,_0x4ffedd))['catch'](handleError(_0x5bfb3c,null));};exports['show']=function(_0x43fa9c,_0x16a424){var _0x490c63={'raw':!![],'where':{'id':_0x43fa9c[_0x4663('0x43')]['id']}},_0x3770bd={};_0x3770bd['model']=_[_0x4663('0x44')](db[_0x4663('0x2d')][_0x4663('0x2e')]);_0x3770bd['query']=_['keys'](_0x43fa9c[_0x4663('0x32')]);_0x3770bd['filters']=_[_0x4663('0x45')](_0x3770bd[_0x4663('0x31')],_0x3770bd[_0x4663('0x32')]);_0x490c63[_0x4663('0x33')]=_[_0x4663('0x45')](_0x3770bd[_0x4663('0x31')],qs[_0x4663('0x34')](_0x43fa9c[_0x4663('0x32')][_0x4663('0x34')]));_0x490c63[_0x4663('0x33')]=_0x490c63['attributes'][_0x4663('0x46')]?_0x490c63['attributes']:_0x3770bd[_0x4663('0x31')];if(_0x43fa9c[_0x4663('0x32')]['includeAll']){_0x490c63[_0x4663('0x40')]=[{'all':!![]}];}_0x490c63=_[_0x4663('0x3b')]({},_0x490c63,_0x43fa9c[_0x4663('0x3e')]);return db['SmsTransferReport'][_0x4663('0x47')](_0x490c63)[_0x4663('0x25')](handleEntityNotFound(_0x16a424,null))[_0x4663('0x25')](respondWithResult(_0x16a424,null))[_0x4663('0x48')](handleError(_0x16a424,null));};exports['create']=function(_0x548617,_0x46df85){return db[_0x4663('0x2d')][_0x4663('0x49')](_0x548617[_0x4663('0x4a')],{})[_0x4663('0x25')](respondWithResult(_0x46df85,0xc9))[_0x4663('0x48')](handleError(_0x46df85,null));};exports['update']=function(_0x4c9127,_0x19f253){if(_0x4c9127[_0x4663('0x4a')]['id']){delete _0x4c9127[_0x4663('0x4a')]['id'];}return db[_0x4663('0x2d')][_0x4663('0x47')]({'where':{'id':_0x4c9127[_0x4663('0x43')]['id']}})[_0x4663('0x25')](handleEntityNotFound(_0x19f253,null))[_0x4663('0x25')](saveUpdates(_0x4c9127[_0x4663('0x4a')],null))['then'](respondWithResult(_0x19f253,null))[_0x4663('0x48')](handleError(_0x19f253,null));};exports[_0x4663('0x26')]=function(_0x18468e,_0xd97fc5){return db[_0x4663('0x2d')]['find']({'where':{'id':_0x18468e[_0x4663('0x43')]['id']}})['then'](handleEntityNotFound(_0xd97fc5,null))[_0x4663('0x25')](removeEntity(_0xd97fc5,null))[_0x4663('0x48')](handleError(_0xd97fc5,null));};exports[_0x4663('0x4b')]=function(_0x424258,_0x14fca6){return db['SmsTransferReport'][_0x4663('0x4b')]()[_0x4663('0x25')](respondWithResult(_0x14fca6,null))[_0x4663('0x48')](handleError(_0x14fca6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8af6d3f..e8cc43f 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 _0x48d0=['path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48d0,0xd3));var _0x048d=function(_0x12e063,_0x703151){_0x12e063=_0x12e063-0x0;var _0x3bd10c=_0x48d0[_0x12e063];return _0x3bd10c;};'use strict';var _=require(_0x048d('0x0'));var util=require(_0x048d('0x1'));var logger=require('../../config/logger')(_0x048d('0x2'));var moment=require(_0x048d('0x3'));var BPromise=require(_0x048d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x048d('0x5'));var rimraf=require(_0x048d('0x6'));var config=require('../../config/environment');var attributes=require(_0x048d('0x7'));module[_0x048d('0x8')]=function(_0x14b983,_0x49c342){return _0x14b983[_0x048d('0x9')](_0x048d('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x048d('0xb'),'fields':[_0x048d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bdc=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x255c49,_0x1aa0c9){var _0x1aa798=function(_0x23dadc){while(--_0x23dadc){_0x255c49['push'](_0x255c49['shift']());}};_0x1aa798(++_0x1aa0c9);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x234b9e,_0x32e048){_0x234b9e=_0x234b9e-0x0;var _0x25d736=_0x6bdc[_0x234b9e];return _0x25d736;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc6bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4ed5553..b45faf2 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 _0x59c3=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x359fd3,_0x278add){var _0x257acd=function(_0x33c5a6){while(--_0x33c5a6){_0x359fd3['push'](_0x359fd3['shift']());}};_0x257acd(++_0x278add);}(_0x59c3,0x133));var _0x359c=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x59c3[_0x934425];return _0x31d596;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var moment=require(_0x359c('0x2'));var BPromise=require(_0x359c('0x3'));var rs=require(_0x359c('0x4'));var fs=require('fs');var Redis=require(_0x359c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x359c('0x6'));var logger=require(_0x359c('0x7'))(_0x359c('0x8'));var config=require(_0x359c('0x9'));var jayson=require(_0x359c('0xa'));var client=jayson[_0x359c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9c107b,_0x58b390,_0x3a7d8e){return new BPromise(function(_0x335963,_0x44ae3a){return client[_0x359c('0xc')](_0x9c107b,_0x3a7d8e)['then'](function(_0x1fb4c8){logger['info'](_0x359c('0xd'),_0x58b390,_0x359c('0xe'));logger[_0x359c('0xf')](_0x359c('0x10'),_0x58b390,_0x359c('0xe'),JSON[_0x359c('0x11')](_0x1fb4c8));if(_0x1fb4c8['error']){if(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x13')]===0x1f4){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x44ae3a(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);}logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x335963(_0x1fb4c8['error'][_0x359c('0x14')]);}else{logger[_0x359c('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x58b390,_0x359c('0xe'));_0x335963(_0x1fb4c8[_0x359c('0x16')][_0x359c('0x14')]);}})[_0x359c('0x17')](function(_0x421bab){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x421bab);_0x44ae3a(_0x421bab);});});} \ No newline at end of file +var _0xd8ee=['../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x27152d,_0x3b1f17){_0x27152d=_0x27152d-0x0;var _0x27b081=_0xd8ee[_0x27152d];return _0x27b081;};'use strict';var _=require(_0xed8e('0x0'));var util=require('util');var moment=require(_0xed8e('0x1'));var BPromise=require(_0xed8e('0x2'));var rs=require(_0xed8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed8e('0x4'))['db'];var utils=require(_0xed8e('0x5'));var logger=require(_0xed8e('0x6'))(_0xed8e('0x7'));var config=require(_0xed8e('0x8'));var jayson=require(_0xed8e('0x9'));var client=jayson['client'][_0xed8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc229f,_0x1bd206,_0x171acf){return new BPromise(function(_0x6c72c8,_0x438603){return client[_0xed8e('0xb')](_0xbc229f,_0x171acf)['then'](function(_0x535a11){logger[_0xed8e('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x1bd206,'request\x20sent');logger[_0xed8e('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1bd206,_0xed8e('0xe'),JSON[_0xed8e('0xf')](_0x535a11));if(_0x535a11['error']){if(_0x535a11[_0xed8e('0x10')][_0xed8e('0x11')]===0x1f4){logger['error'](_0xed8e('0x12'),_0x1bd206,_0x535a11['error'][_0xed8e('0x13')]);return _0x438603(_0x535a11[_0xed8e('0x10')][_0xed8e('0x13')]);}logger[_0xed8e('0x10')](_0xed8e('0x12'),_0x1bd206,_0x535a11[_0xed8e('0x10')][_0xed8e('0x13')]);return _0x6c72c8(_0x535a11[_0xed8e('0x10')][_0xed8e('0x13')]);}else{logger[_0xed8e('0xc')](_0xed8e('0x12'),_0x1bd206,_0xed8e('0xe'));_0x6c72c8(_0x535a11[_0xed8e('0x14')]['message']);}})[_0xed8e('0x15')](function(_0x51a804){logger[_0xed8e('0x10')](_0xed8e('0x12'),_0x1bd206,_0x51a804);_0x438603(_0x51a804);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e246e5c..14773c7 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 _0xe407=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single'];(function(_0x549303,_0x17fe7b){var _0x6a7a3a=function(_0x2b8767){while(--_0x2b8767){_0x549303['push'](_0x549303['shift']());}};_0x6a7a3a(++_0x17fe7b);}(_0xe407,0x143));var _0x7e40=function(_0x64163c,_0x3604b5){_0x64163c=_0x64163c-0x0;var _0x103c91=_0xe407[_0x64163c];return _0x103c91;};'use strict';var multer=require(_0x7e40('0x0'));var util=require(_0x7e40('0x1'));var path=require(_0x7e40('0x2'));var timeout=require(_0x7e40('0x3'));var express=require(_0x7e40('0x4'));var router=express[_0x7e40('0x5')]();var fs_extra=require(_0x7e40('0x6'));var auth=require(_0x7e40('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0x7e40('0x8')](),controller[_0x7e40('0x9')]);router[_0x7e40('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7e40('0xb')]);router[_0x7e40('0xa')](_0x7e40('0xc'),auth['isAuthenticated'](),controller[_0x7e40('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507077,_0x2d00a8,_0x5bd07d){_0x5bd07d(null,path[_0x7e40('0xe')](config[_0x7e40('0xf')],_0x7e40('0x10')));},'filename':function(_0x2632cc,_0x508bb6,_0x33142c){_0x508bb6[_0x7e40('0x11')]=_0x508bb6['originalname'][_0x7e40('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33142c(null,util[_0x7e40('0x13')](_0x7e40('0x14'),path[_0x7e40('0x15')](_0x508bb6[_0x7e40('0x11')],path[_0x7e40('0x16')](_0x508bb6['originalname'])),Date[_0x7e40('0x17')](),path[_0x7e40('0x16')](_0x508bb6['originalname'])));}})});router['post']('/',upload[_0x7e40('0x18')]('file'),controller['create']);router['put'](_0x7e40('0x19'),auth[_0x7e40('0x8')](),controller[_0x7e40('0x1a')]);router[_0x7e40('0x1b')](_0x7e40('0x19'),auth[_0x7e40('0x8')](),controller[_0x7e40('0x1b')]);module[_0x7e40('0x1c')]=router; \ No newline at end of file +var _0x1ded=['basename','extname','now','post','file','create','put','/:id','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x493256,_0x33666e){var _0x44db81=function(_0x27b012){while(--_0x27b012){_0x493256['push'](_0x493256['shift']());}};_0x44db81(++_0x33666e);}(_0x1ded,0x10e));var _0xd1de=function(_0x30fad3,_0xd6f2a){_0x30fad3=_0x30fad3-0x0;var _0xbcd51c=_0x1ded[_0x30fad3];return _0xbcd51c;};'use strict';var multer=require('multer');var util=require(_0xd1de('0x0'));var path=require(_0xd1de('0x1'));var timeout=require(_0xd1de('0x2'));var express=require(_0xd1de('0x3'));var router=express[_0xd1de('0x4')]();var fs_extra=require(_0xd1de('0x5'));var auth=require(_0xd1de('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xd1de('0x7')](),controller[_0xd1de('0x8')]);router[_0xd1de('0x9')]('/:id',auth[_0xd1de('0x7')](),controller['show']);router[_0xd1de('0x9')](_0xd1de('0xa'),auth['isAuthenticated'](),controller[_0xd1de('0xb')]);var upload=multer({'storage':multer[_0xd1de('0xc')]({'destination':function(_0x4e30a6,_0x3cf37d,_0x3508b5){_0x3508b5(null,path[_0xd1de('0xd')](config[_0xd1de('0xe')],_0xd1de('0xf')));},'filename':function(_0x526581,_0x1fbd6a,_0x2d56ff){_0x1fbd6a[_0xd1de('0x10')]=_0x1fbd6a['originalname'][_0xd1de('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d56ff(null,util[_0xd1de('0x12')](_0xd1de('0x13'),path[_0xd1de('0x14')](_0x1fbd6a[_0xd1de('0x10')],path[_0xd1de('0x15')](_0x1fbd6a[_0xd1de('0x10')])),Date[_0xd1de('0x16')](),path[_0xd1de('0x15')](_0x1fbd6a[_0xd1de('0x10')])));}})});router[_0xd1de('0x17')]('/',upload['single'](_0xd1de('0x18')),controller[_0xd1de('0x19')]);router[_0xd1de('0x1a')](_0xd1de('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0xd1de('0x1c')](_0xd1de('0x1b'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e947361..c0d678b 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 _0x2d90=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x4e310c,_0x161a51){var _0x247cf7=function(_0x2e9ad7){while(--_0x2e9ad7){_0x4e310c['push'](_0x4e310c['shift']());}};_0x247cf7(++_0x161a51);}(_0x2d90,0x1c2));var _0x02d9=function(_0x5b20e4,_0x2ae22a){_0x5b20e4=_0x5b20e4-0x0;var _0x495427=_0x2d90[_0x5b20e4];return _0x495427;};'use strict';var Sequelize=require(_0x02d9('0x0'));module[_0x02d9('0x1')]={'name':{'type':Sequelize[_0x02d9('0x2')],'unique':_0x02d9('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x02d9('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x02d9('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x02d9('0x4')]},'original_sampleCount':{'type':Sequelize[_0x02d9('0x5')]},'original_channelCount':{'type':Sequelize[_0x02d9('0x6')]},'original_bitRate':{'type':Sequelize[_0x02d9('0x5')]},'original_sampleRate':{'type':Sequelize[_0x02d9('0x6')]},'converted_format':{'type':Sequelize[_0x02d9('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x02d9('0x5')]},'converted_channelCount':{'type':Sequelize[_0x02d9('0x6')]},'converted_bitRate':{'type':Sequelize[_0x02d9('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0f53=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x0f53,0x127));var _0x30f5=function(_0x233f8e,_0x14ffa5){_0x233f8e=_0x233f8e-0x0;var _0x339bac=_0x0f53[_0x233f8e];return _0x339bac;};'use strict';var Sequelize=require(_0x30f5('0x0'));module[_0x30f5('0x1')]={'name':{'type':Sequelize[_0x30f5('0x2')],'unique':_0x30f5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x30f5('0x2')]},'display_name':{'type':Sequelize[_0x30f5('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x30f5('0x2')]},'original_duration':{'type':Sequelize[_0x30f5('0x4')]},'original_sampleCount':{'type':Sequelize[_0x30f5('0x5')]},'original_channelCount':{'type':Sequelize[_0x30f5('0x6')]},'original_bitRate':{'type':Sequelize[_0x30f5('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x30f5('0x2')]},'converted_duration':{'type':Sequelize[_0x30f5('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x30f5('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x30f5('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9ebb262..ce079ea 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 _0x9c3e=['rows','catch','show','params','includeAll','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','end','stack','name','send','index','Sound','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','type','VIRTUAL','filter','options','include','findAll'];(function(_0x1c2560,_0x1d9304){var _0x2be4de=function(_0x3d6984){while(--_0x3d6984){_0x1c2560['push'](_0x1c2560['shift']());}};_0x2be4de(++_0x1d9304);}(_0x9c3e,0xc2));var _0xe9c3=function(_0x59be2e,_0x191313){_0x59be2e=_0x59be2e-0x0;var _0x57727b=_0x9c3e[_0x59be2e];return _0x57727b;};'use strict';var emlformat=require(_0xe9c3('0x0'));var rimraf=require(_0xe9c3('0x1'));var zipdir=require(_0xe9c3('0x2'));var jsonpatch=require(_0xe9c3('0x3'));var rp=require(_0xe9c3('0x4'));var moment=require(_0xe9c3('0x5'));var BPromise=require(_0xe9c3('0x6'));var Mustache=require(_0xe9c3('0x7'));var util=require(_0xe9c3('0x8'));var path=require(_0xe9c3('0x9'));var sox=require('sox');var csv=require(_0xe9c3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9c3('0xb'));var _=require(_0xe9c3('0xc'));var squel=require(_0xe9c3('0xd'));var crypto=require(_0xe9c3('0xe'));var jsforce=require(_0xe9c3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe9c3('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9c3('0x11'));var authService=require(_0xe9c3('0x12'));var qs=require(_0xe9c3('0x13'));var as=require(_0xe9c3('0x14'));var hardwareService=require(_0xe9c3('0x15'));var logger=require(_0xe9c3('0x16'))('api');var utils=require(_0xe9c3('0x17'));var config=require(_0xe9c3('0x18'));var licenseUtil=require(_0xe9c3('0x19'));var db=require(_0xe9c3('0x1a'))['db'];function respondWithStatusCode(_0x29e634,_0xa9d0ce){_0xa9d0ce=_0xa9d0ce||0xcc;return function(_0xa31193){if(_0xa31193){return _0x29e634['sendStatus'](_0xa9d0ce);}return _0x29e634['status'](_0xa9d0ce)['end']();};}function respondWithResult(_0x4fffe9,_0x31fff8){_0x31fff8=_0x31fff8||0xc8;return function(_0x555f57){if(_0x555f57){return _0x4fffe9[_0xe9c3('0x1b')](_0x31fff8)[_0xe9c3('0x1c')](_0x555f57);}};}function respondWithFilteredResult(_0x140f46,_0x352be9){return function(_0x2f3aca){if(_0x2f3aca){var _0x19e7e0=typeof _0x352be9[_0xe9c3('0x1d')]===_0xe9c3('0x1e')&&typeof _0x352be9[_0xe9c3('0x1f')]==='undefined';var _0x2794c9=_0x2f3aca['count'];var _0x41074f=_0x19e7e0?0x0:_0x352be9[_0xe9c3('0x1d')];var _0x4eae0e=_0x19e7e0?_0x2f3aca[_0xe9c3('0x20')]:_0x352be9[_0xe9c3('0x1d')]+_0x352be9[_0xe9c3('0x1f')];var _0x2af70d;if(_0x4eae0e>=_0x2794c9){_0x4eae0e=_0x2794c9;_0x2af70d=0xc8;}else{_0x2af70d=0xce;}_0x140f46['status'](_0x2af70d);return _0x140f46[_0xe9c3('0x21')](_0xe9c3('0x22'),_0x41074f+'-'+_0x4eae0e+'/'+_0x2794c9)[_0xe9c3('0x1c')](_0x2f3aca);}return null;};}function patchUpdates(_0xa55fa8){return function(_0x4e4ce0){try{jsonpatch[_0xe9c3('0x23')](_0x4e4ce0,_0xa55fa8,!![]);}catch(_0xfb09d1){return BPromise[_0xe9c3('0x24')](_0xfb09d1);}return _0x4e4ce0['save']();};}function saveUpdates(_0x55c805,_0x34c347){return function(_0x538f67){if(_0x538f67){return _0x538f67[_0xe9c3('0x25')](_0x55c805)['then'](function(_0x2884e5){return _0x2884e5;});}return null;};}function removeEntity(_0x2a75d9,_0x5e9486){return function(_0x2b53e6){if(_0x2b53e6){return _0x2b53e6[_0xe9c3('0x26')]()[_0xe9c3('0x27')](function(){var _0x50a075=_0x2b53e6[_0xe9c3('0x28')]({'plain':!![]});var _0x28a541='Sounds';return db[_0xe9c3('0x29')][_0xe9c3('0x26')]({'where':{'type':_0x28a541,'resourceId':_0x50a075['id']}})[_0xe9c3('0x27')](function(){return _0x2b53e6;});})[_0xe9c3('0x27')](function(){_0x2a75d9[_0xe9c3('0x1b')](0xcc)[_0xe9c3('0x2a')]();});}};}function handleEntityNotFound(_0x444da4,_0x1da0ba){return function(_0x5b7d25){if(!_0x5b7d25){_0x444da4['sendStatus'](0x194);}return _0x5b7d25;};}function handleError(_0x17fbd7,_0x6075b9){_0x6075b9=_0x6075b9||0x1f4;return function(_0xef7746){logger['error'](_0xef7746[_0xe9c3('0x2b')]);if(_0xef7746['name']){delete _0xef7746[_0xe9c3('0x2c')];}_0x17fbd7['status'](_0x6075b9)[_0xe9c3('0x2d')](_0xef7746);};}exports[_0xe9c3('0x2e')]=function(_0x3df58f,_0x15cf86){var _0x605489={},_0x1c96d5={},_0x4715cd={'count':0x0,'rows':[]};var _0x3a67e2=_['map'](db[_0xe9c3('0x2f')][_0xe9c3('0x30')],function(_0x189189){return{'name':_0x189189[_0xe9c3('0x31')],'type':_0x189189['type'][_0xe9c3('0x32')]};});_0x1c96d5[_0xe9c3('0x33')]=_[_0xe9c3('0x34')](_0x3a67e2,_0xe9c3('0x2c'));_0x1c96d5[_0xe9c3('0x35')]=_[_0xe9c3('0x36')](_0x3df58f[_0xe9c3('0x35')]);_0x1c96d5[_0xe9c3('0x37')]=_[_0xe9c3('0x38')](_0x1c96d5[_0xe9c3('0x33')],_0x1c96d5['query']);_0x605489[_0xe9c3('0x39')]=_[_0xe9c3('0x38')](_0x1c96d5[_0xe9c3('0x33')],qs[_0xe9c3('0x3a')](_0x3df58f[_0xe9c3('0x35')][_0xe9c3('0x3a')]));_0x605489[_0xe9c3('0x39')]=_0x605489[_0xe9c3('0x39')][_0xe9c3('0x3b')]?_0x605489[_0xe9c3('0x39')]:_0x1c96d5['model'];if(!_0x3df58f[_0xe9c3('0x35')]['hasOwnProperty'](_0xe9c3('0x3c'))){_0x605489[_0xe9c3('0x1f')]=qs['limit'](_0x3df58f['query'][_0xe9c3('0x1f')]);_0x605489[_0xe9c3('0x1d')]=qs[_0xe9c3('0x1d')](_0x3df58f[_0xe9c3('0x35')][_0xe9c3('0x1d')]);}_0x605489['order']=qs[_0xe9c3('0x3d')](_0x3df58f[_0xe9c3('0x35')]['sort']);_0x605489[_0xe9c3('0x3e')]=qs['filters'](_['pick'](_0x3df58f[_0xe9c3('0x35')],_0x1c96d5[_0xe9c3('0x37')]),_0x3a67e2);if(_0x3df58f[_0xe9c3('0x35')]['filter']){_0x605489['where']=_[_0xe9c3('0x3f')](_0x605489[_0xe9c3('0x3e')],{'$or':_[_0xe9c3('0x34')](_0x3a67e2,function(_0x2dbafe){if(_0x2dbafe[_0xe9c3('0x40')]!==_0xe9c3('0x41')){var _0x302d83={};_0x302d83[_0x2dbafe[_0xe9c3('0x2c')]]={'$like':'%'+_0x3df58f[_0xe9c3('0x35')][_0xe9c3('0x42')]+'%'};return _0x302d83;}})});}_0x605489=_['merge']({},_0x605489,_0x3df58f[_0xe9c3('0x43')]);var _0x3e08ce={'where':_0x605489['where']};return db[_0xe9c3('0x2f')][_0xe9c3('0x20')](_0x3e08ce)[_0xe9c3('0x27')](function(_0xf90091){_0x4715cd[_0xe9c3('0x20')]=_0xf90091;if(_0x3df58f[_0xe9c3('0x35')]['includeAll']){_0x605489[_0xe9c3('0x44')]=[{'all':!![]}];}return db[_0xe9c3('0x2f')][_0xe9c3('0x45')](_0x605489);})['then'](function(_0x3e535c){_0x4715cd[_0xe9c3('0x46')]=_0x3e535c;return _0x4715cd;})[_0xe9c3('0x27')](respondWithFilteredResult(_0x15cf86,_0x605489))[_0xe9c3('0x47')](handleError(_0x15cf86,null));};exports[_0xe9c3('0x48')]=function(_0xa5180c,_0xdc180c){var _0xfb75fd={'raw':!![],'where':{'id':_0xa5180c[_0xe9c3('0x49')]['id']}},_0x4f5d9b={};_0x4f5d9b['model']=_[_0xe9c3('0x36')](db['Sound'][_0xe9c3('0x30')]);_0x4f5d9b[_0xe9c3('0x35')]=_[_0xe9c3('0x36')](_0xa5180c['query']);_0x4f5d9b['filters']=_[_0xe9c3('0x38')](_0x4f5d9b[_0xe9c3('0x33')],_0x4f5d9b[_0xe9c3('0x35')]);_0xfb75fd[_0xe9c3('0x39')]=_['intersection'](_0x4f5d9b['model'],qs[_0xe9c3('0x3a')](_0xa5180c[_0xe9c3('0x35')][_0xe9c3('0x3a')]));_0xfb75fd[_0xe9c3('0x39')]=_0xfb75fd[_0xe9c3('0x39')][_0xe9c3('0x3b')]?_0xfb75fd['attributes']:_0x4f5d9b[_0xe9c3('0x33')];if(_0xa5180c[_0xe9c3('0x35')][_0xe9c3('0x4a')]){_0xfb75fd[_0xe9c3('0x44')]=[{'all':!![]}];}_0xfb75fd=_[_0xe9c3('0x3f')]({},_0xfb75fd,_0xa5180c['options']);return db['Sound'][_0xe9c3('0x4b')](_0xfb75fd)[_0xe9c3('0x27')](handleEntityNotFound(_0xdc180c,null))[_0xe9c3('0x27')](respondWithResult(_0xdc180c,null))['catch'](handleError(_0xdc180c,null));};exports['download']=function(_0x2c6a23,_0x5bfabf,_0x1a707b){return db[_0xe9c3('0x2f')][_0xe9c3('0x4b')]({'where':{'id':_0x2c6a23[_0xe9c3('0x49')]['id']},'attributes':['name',_0xe9c3('0x4c'),_0xe9c3('0x4d')],'raw':!![]})[_0xe9c3('0x27')](handleEntityNotFound(_0x5bfabf,null))[_0xe9c3('0x27')](function(_0x543066){if(_0x543066){if(!fs[_0xe9c3('0x4e')](path[_0xe9c3('0x4f')](config[_0xe9c3('0x50')],_0xe9c3('0x51'),_0x543066['save_name']+'.'+_0x543066['converted_format']))){throw new db[(_0xe9c3('0x52'))]['ValidationError'](_0xe9c3('0x53'));}return _0x5bfabf[_0xe9c3('0x54')](path[_0xe9c3('0x4f')](config[_0xe9c3('0x50')],_0xe9c3('0x51'),util[_0xe9c3('0x55')](_0xe9c3('0x56'),_0x543066[_0xe9c3('0x4c')],_0x543066['converted_format'])),util[_0xe9c3('0x55')](_0xe9c3('0x56'),_0x543066['name'],_0x543066[_0xe9c3('0x4d')]));}return null;})[_0xe9c3('0x47')](handleError(_0x5bfabf,null));};exports[_0xe9c3('0x57')]=function(_0x1261da,_0x4895dd,_0x2c8df0){var _0x1a7fff={'name':path[_0xe9c3('0x58')](_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5a')],path[_0xe9c3('0x5b')](_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5a')])),'save_name':path[_0xe9c3('0x58')](_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5c')],path[_0xe9c3('0x5b')](_0x1261da['file'][_0xe9c3('0x5c')])),'original_format':path[_0xe9c3('0x5b')](_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5a')])[_0xe9c3('0x5d')](0x1),'converted_format':_0xe9c3('0x5e')};var _0x47d443=path[_0xe9c3('0x4f')](config[_0xe9c3('0x50')],_0xe9c3('0x5f'),_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5c')]);var _0x12f495=path['join'](config['root'],_0xe9c3('0x51'),util['format'](_0xe9c3('0x56'),path['basename'](_0x1261da[_0xe9c3('0x59')]['filename'],path['extname'](_0x1261da[_0xe9c3('0x59')][_0xe9c3('0x5c')])),_0x1a7fff[_0xe9c3('0x4d')]));logger[_0xe9c3('0x60')](_0xe9c3('0x61'),_0x47d443);logger[_0xe9c3('0x60')](_0xe9c3('0x62'),_0x12f495);try{fs[_0xe9c3('0x63')](_0x47d443,parseInt(_0xe9c3('0x64'),0x8));var _0x4ffe0b=sox['transcode'](_0x47d443,_0x12f495,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ffe0b['on'](_0xe9c3('0x65'),function(_0x41bb7a){fs['unlinkSync'](_0x47d443);_0x4895dd[_0xe9c3('0x1b')](0x1f4)['send'](_0x41bb7a);});_0x4ffe0b['on'](_0xe9c3('0x66'),function(_0x4505a1){_0x1a7fff[_0xe9c3('0x67')]=isNaN(_0x4505a1[_0xe9c3('0x68')])?null:_0x4505a1['duration']*0x3e8;_0x1a7fff[_0xe9c3('0x69')]=isNaN(_0x4505a1['sampleCount'])?null:_0x4505a1[_0xe9c3('0x6a')];_0x1a7fff[_0xe9c3('0x6b')]=isNaN(_0x4505a1['channelCount'])?null:_0x4505a1['channelCount'];_0x1a7fff[_0xe9c3('0x6c')]=isNaN(_0x4505a1[_0xe9c3('0x6d')])?null:_0x4505a1[_0xe9c3('0x6d')];_0x1a7fff[_0xe9c3('0x6e')]=isNaN(_0x4505a1['sampleRate'])?null:_0x4505a1[_0xe9c3('0x6f')];});_0x4ffe0b['on'](_0xe9c3('0x70'),function(_0x4acaa3){_0x1a7fff[_0xe9c3('0x71')]=isNaN(_0x4acaa3['duration'])?null:_0x4acaa3[_0xe9c3('0x68')]*0x3e8;_0x1a7fff[_0xe9c3('0x72')]=isNaN(_0x4acaa3[_0xe9c3('0x6a')])?null:_0x4acaa3['sampleCount'];_0x1a7fff[_0xe9c3('0x73')]=isNaN(_0x4acaa3[_0xe9c3('0x74')])?null:_0x4acaa3[_0xe9c3('0x74')];_0x1a7fff[_0xe9c3('0x75')]=isNaN(_0x4acaa3[_0xe9c3('0x6d')])?null:_0x4acaa3[_0xe9c3('0x6d')];_0x1a7fff[_0xe9c3('0x76')]=isNaN(_0x4acaa3[_0xe9c3('0x6f')])?null:_0x4acaa3[_0xe9c3('0x6f')];});_0x4ffe0b['on'](_0xe9c3('0x2a'),function(){fs[_0xe9c3('0x63')](_0x12f495,parseInt('0777',0x8));return db[_0xe9c3('0x2f')]['create'](_0x1a7fff)[_0xe9c3('0x27')](function(_0x5899dc){var _0x2b12e5={'role':_0x1261da[_0xe9c3('0x77')][_0xe9c3('0x78')],'userProfileId':_0x1261da[_0xe9c3('0x77')][_0xe9c3('0x79')]};if(!_0x2b12e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b12e5[_0xe9c3('0x78')]===_0xe9c3('0x7a')){var _0x253995=_0x5899dc[_0xe9c3('0x28')]({'plain':!![]});return db[_0xe9c3('0x7b')]['find']({'where':{'name':_0xe9c3('0x7c'),'userProfileId':_0x2b12e5[_0xe9c3('0x79')]},'raw':!![]})[_0xe9c3('0x27')](function(_0x329c0c){if(_0x329c0c&&_0x329c0c[_0xe9c3('0x7d')]===0x0){return db[_0xe9c3('0x29')][_0xe9c3('0x57')]({'name':_0x253995['name'],'resourceId':_0x253995['id'],'type':_0x329c0c[_0xe9c3('0x2c')],'sectionId':_0x329c0c['id']},{})[_0xe9c3('0x27')](function(){return _0x5899dc;});}else{return _0x5899dc;}})['catch'](function(_0x4c6fa9){logger[_0xe9c3('0x65')](_0xe9c3('0x7e'),_0x4c6fa9);throw _0x4c6fa9;});}return _0x5899dc;})[_0xe9c3('0x27')](respondWithResult(_0x4895dd,null))[_0xe9c3('0x47')](handleError(_0x4895dd,null));});_0x4ffe0b[_0xe9c3('0x7f')]();}catch(_0x39ca5e){_0x4895dd[_0xe9c3('0x1b')](0x1f4)[_0xe9c3('0x2d')](_0x39ca5e);}};exports[_0xe9c3('0x25')]=function(_0xb6d00b,_0x56e4b0,_0x3f4ea3){return db['Sound'][_0xe9c3('0x4b')]({'where':{'id':_0xb6d00b[_0xe9c3('0x49')]['id']}})[_0xe9c3('0x27')](handleEntityNotFound(_0x56e4b0,null))['then'](saveUpdates(_[_0xe9c3('0x80')](_0xb6d00b[_0xe9c3('0x77')],[_0xe9c3('0x2c'),'description']),null))[_0xe9c3('0x27')](respondWithResult(_0x56e4b0,null))[_0xe9c3('0x47')](handleError(_0x56e4b0,null));};exports[_0xe9c3('0x81')]=function(_0x1c7fed,_0x2034bd,_0x48ae21){return db[_0xe9c3('0x2f')][_0xe9c3('0x4b')]({'where':{'id':_0x1c7fed[_0xe9c3('0x49')]['id']}})[_0xe9c3('0x27')](function(_0x319ee3){if(_0x319ee3){return _0x319ee3[_0xe9c3('0x26')]();}})[_0xe9c3('0x27')](function(_0x73e42c){var _0x341a8d=path[_0xe9c3('0x4f')](config[_0xe9c3('0x50')],_0xe9c3('0x5f'),util[_0xe9c3('0x55')]('%s.%s',_0x73e42c[_0xe9c3('0x4c')],_0x73e42c[_0xe9c3('0x82')]));var _0x48d2cf=path[_0xe9c3('0x4f')](config[_0xe9c3('0x50')],_0xe9c3('0x51'),util[_0xe9c3('0x55')](_0xe9c3('0x56'),_0x73e42c[_0xe9c3('0x4c')],_0x73e42c[_0xe9c3('0x4d')]));fs[_0xe9c3('0x83')](_0x341a8d);fs['unlinkSync'](_0x48d2cf);return _0x73e42c;})[_0xe9c3('0x27')](function(_0x238362){if(_0x238362){return _0x2034bd[_0xe9c3('0x1b')](0xcc)[_0xe9c3('0x2a')]();}})[_0xe9c3('0x27')](handleEntityNotFound(_0x2034bd,null))['catch'](handleError(_0x2034bd,null));}; \ No newline at end of file +var _0x54a4=['converted_sampleRate','end','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','save_name','original_format','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','error','stack','name','index','Sound','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','find','download','converted_format','root','server/files/sounds/converted','Sequelize','join','%s.%s','basename','file','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate'];(function(_0x57b335,_0x141fee){var _0x283495=function(_0x1a9d10){while(--_0x1a9d10){_0x57b335['push'](_0x57b335['shift']());}};_0x283495(++_0x141fee);}(_0x54a4,0x1f2));var _0x454a=function(_0x5ad8de,_0x50b0f7){_0x5ad8de=_0x5ad8de-0x0;var _0x1f9e44=_0x54a4[_0x5ad8de];return _0x1f9e44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x454a('0x0'));var zipdir=require(_0x454a('0x1'));var jsonpatch=require(_0x454a('0x2'));var rp=require(_0x454a('0x3'));var moment=require(_0x454a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x454a('0x5'));var util=require(_0x454a('0x6'));var path=require(_0x454a('0x7'));var sox=require('sox');var csv=require(_0x454a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x454a('0x9'));var _=require('lodash');var squel=require(_0x454a('0xa'));var crypto=require(_0x454a('0xb'));var jsforce=require(_0x454a('0xc'));var deskjs=require(_0x454a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x454a('0xe'));var Papa=require(_0x454a('0xf'));var Redis=require(_0x454a('0x10'));var authService=require(_0x454a('0x11'));var qs=require(_0x454a('0x12'));var as=require(_0x454a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x454a('0x14'))('api');var utils=require(_0x454a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c982b,_0x1f3322){_0x1f3322=_0x1f3322||0xcc;return function(_0x140fa7){if(_0x140fa7){return _0x4c982b[_0x454a('0x16')](_0x1f3322);}return _0x4c982b[_0x454a('0x17')](_0x1f3322)['end']();};}function respondWithResult(_0xc77ac,_0x1af183){_0x1af183=_0x1af183||0xc8;return function(_0x49f26e){if(_0x49f26e){return _0xc77ac[_0x454a('0x17')](_0x1af183)[_0x454a('0x18')](_0x49f26e);}};}function respondWithFilteredResult(_0x2c0593,_0x445c6d){return function(_0x2636ca){if(_0x2636ca){var _0x1ab201=typeof _0x445c6d[_0x454a('0x19')]==='undefined'&&typeof _0x445c6d[_0x454a('0x1a')]==='undefined';var _0x61d51c=_0x2636ca[_0x454a('0x1b')];var _0x26b43e=_0x1ab201?0x0:_0x445c6d[_0x454a('0x19')];var _0x41606b=_0x1ab201?_0x2636ca[_0x454a('0x1b')]:_0x445c6d[_0x454a('0x19')]+_0x445c6d[_0x454a('0x1a')];var _0x5590f3;if(_0x41606b>=_0x61d51c){_0x41606b=_0x61d51c;_0x5590f3=0xc8;}else{_0x5590f3=0xce;}_0x2c0593[_0x454a('0x17')](_0x5590f3);return _0x2c0593[_0x454a('0x1c')](_0x454a('0x1d'),_0x26b43e+'-'+_0x41606b+'/'+_0x61d51c)['json'](_0x2636ca);}return null;};}function patchUpdates(_0x518477){return function(_0x1f477a){try{jsonpatch[_0x454a('0x1e')](_0x1f477a,_0x518477,!![]);}catch(_0x47f129){return BPromise[_0x454a('0x1f')](_0x47f129);}return _0x1f477a[_0x454a('0x20')]();};}function saveUpdates(_0x3da705,_0x3ad729){return function(_0x218e38){if(_0x218e38){return _0x218e38['update'](_0x3da705)[_0x454a('0x21')](function(_0x208ba5){return _0x208ba5;});}return null;};}function removeEntity(_0x1185a1,_0x3bccdf){return function(_0x5d1d2c){if(_0x5d1d2c){return _0x5d1d2c[_0x454a('0x22')]()['then'](function(){var _0x5eecb3=_0x5d1d2c['get']({'plain':!![]});var _0x12c5cd=_0x454a('0x23');return db[_0x454a('0x24')][_0x454a('0x22')]({'where':{'type':_0x12c5cd,'resourceId':_0x5eecb3['id']}})['then'](function(){return _0x5d1d2c;});})[_0x454a('0x21')](function(){_0x1185a1[_0x454a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7a77,_0x5d3b56){return function(_0x563d8c){if(!_0x563d8c){_0x5e7a77['sendStatus'](0x194);}return _0x563d8c;};}function handleError(_0x464332,_0x16c170){_0x16c170=_0x16c170||0x1f4;return function(_0x384c8d){logger[_0x454a('0x25')](_0x384c8d[_0x454a('0x26')]);if(_0x384c8d[_0x454a('0x27')]){delete _0x384c8d['name'];}_0x464332['status'](_0x16c170)['send'](_0x384c8d);};}exports[_0x454a('0x28')]=function(_0xb3476f,_0x1a3cb1){var _0x5efa61={},_0x14a2d6={},_0x577e0c={'count':0x0,'rows':[]};var _0x43ed65=_['map'](db[_0x454a('0x29')]['rawAttributes'],function(_0x389708){return{'name':_0x389708['fieldName'],'type':_0x389708[_0x454a('0x2a')][_0x454a('0x2b')]};});_0x14a2d6['model']=_['map'](_0x43ed65,_0x454a('0x27'));_0x14a2d6[_0x454a('0x2c')]=_[_0x454a('0x2d')](_0xb3476f[_0x454a('0x2c')]);_0x14a2d6[_0x454a('0x2e')]=_[_0x454a('0x2f')](_0x14a2d6[_0x454a('0x30')],_0x14a2d6[_0x454a('0x2c')]);_0x5efa61['attributes']=_[_0x454a('0x2f')](_0x14a2d6[_0x454a('0x30')],qs[_0x454a('0x31')](_0xb3476f['query']['fields']));_0x5efa61[_0x454a('0x32')]=_0x5efa61[_0x454a('0x32')][_0x454a('0x33')]?_0x5efa61['attributes']:_0x14a2d6[_0x454a('0x30')];if(!_0xb3476f['query'][_0x454a('0x34')](_0x454a('0x35'))){_0x5efa61[_0x454a('0x1a')]=qs[_0x454a('0x1a')](_0xb3476f[_0x454a('0x2c')][_0x454a('0x1a')]);_0x5efa61['offset']=qs['offset'](_0xb3476f[_0x454a('0x2c')][_0x454a('0x19')]);}_0x5efa61[_0x454a('0x36')]=qs[_0x454a('0x37')](_0xb3476f[_0x454a('0x2c')][_0x454a('0x37')]);_0x5efa61[_0x454a('0x38')]=qs[_0x454a('0x2e')](_[_0x454a('0x39')](_0xb3476f[_0x454a('0x2c')],_0x14a2d6[_0x454a('0x2e')]),_0x43ed65);if(_0xb3476f[_0x454a('0x2c')][_0x454a('0x3a')]){_0x5efa61['where']=_[_0x454a('0x3b')](_0x5efa61[_0x454a('0x38')],{'$or':_['map'](_0x43ed65,function(_0x327949){if(_0x327949[_0x454a('0x2a')]!==_0x454a('0x3c')){var _0x5cdc6d={};_0x5cdc6d[_0x327949['name']]={'$like':'%'+_0xb3476f[_0x454a('0x2c')][_0x454a('0x3a')]+'%'};return _0x5cdc6d;}})});}_0x5efa61=_[_0x454a('0x3b')]({},_0x5efa61,_0xb3476f[_0x454a('0x3d')]);var _0x629b89={'where':_0x5efa61[_0x454a('0x38')]};return db[_0x454a('0x29')][_0x454a('0x1b')](_0x629b89)[_0x454a('0x21')](function(_0x263e9f){_0x577e0c[_0x454a('0x1b')]=_0x263e9f;if(_0xb3476f[_0x454a('0x2c')][_0x454a('0x3e')]){_0x5efa61['include']=[{'all':!![]}];}return db['Sound'][_0x454a('0x3f')](_0x5efa61);})[_0x454a('0x21')](function(_0x414a89){_0x577e0c[_0x454a('0x40')]=_0x414a89;return _0x577e0c;})[_0x454a('0x21')](respondWithFilteredResult(_0x1a3cb1,_0x5efa61))[_0x454a('0x41')](handleError(_0x1a3cb1,null));};exports['show']=function(_0x3337a5,_0x56ad84){var _0x191942={'raw':!![],'where':{'id':_0x3337a5[_0x454a('0x42')]['id']}},_0xfab5cf={};_0xfab5cf[_0x454a('0x30')]=_[_0x454a('0x2d')](db['Sound'][_0x454a('0x43')]);_0xfab5cf[_0x454a('0x2c')]=_[_0x454a('0x2d')](_0x3337a5[_0x454a('0x2c')]);_0xfab5cf[_0x454a('0x2e')]=_['intersection'](_0xfab5cf['model'],_0xfab5cf[_0x454a('0x2c')]);_0x191942[_0x454a('0x32')]=_[_0x454a('0x2f')](_0xfab5cf[_0x454a('0x30')],qs['fields'](_0x3337a5[_0x454a('0x2c')][_0x454a('0x31')]));_0x191942['attributes']=_0x191942[_0x454a('0x32')]['length']?_0x191942[_0x454a('0x32')]:_0xfab5cf[_0x454a('0x30')];if(_0x3337a5['query']['includeAll']){_0x191942['include']=[{'all':!![]}];}_0x191942=_[_0x454a('0x3b')]({},_0x191942,_0x3337a5[_0x454a('0x3d')]);return db['Sound'][_0x454a('0x44')](_0x191942)[_0x454a('0x21')](handleEntityNotFound(_0x56ad84,null))['then'](respondWithResult(_0x56ad84,null))[_0x454a('0x41')](handleError(_0x56ad84,null));};exports[_0x454a('0x45')]=function(_0x3f2bf1,_0x2ee0d0,_0x49ddda){return db[_0x454a('0x29')][_0x454a('0x44')]({'where':{'id':_0x3f2bf1[_0x454a('0x42')]['id']},'attributes':[_0x454a('0x27'),'save_name',_0x454a('0x46')],'raw':!![]})[_0x454a('0x21')](handleEntityNotFound(_0x2ee0d0,null))['then'](function(_0x35aac5){if(_0x35aac5){if(!fs['existsSync'](path['join'](config[_0x454a('0x47')],_0x454a('0x48'),_0x35aac5['save_name']+'.'+_0x35aac5[_0x454a('0x46')]))){throw new db[(_0x454a('0x49'))]['ValidationError']('Sound\x20not\x20found');}return _0x2ee0d0['download'](path[_0x454a('0x4a')](config[_0x454a('0x47')],'server/files/sounds/converted',util['format']('%s.%s',_0x35aac5['save_name'],_0x35aac5['converted_format'])),util['format'](_0x454a('0x4b'),_0x35aac5[_0x454a('0x27')],_0x35aac5['converted_format']));}return null;})['catch'](handleError(_0x2ee0d0,null));};exports['create']=function(_0x565e19,_0x10f641,_0x559b46){var _0x342a01={'name':path[_0x454a('0x4c')](_0x565e19[_0x454a('0x4d')]['originalname'],path['extname'](_0x565e19[_0x454a('0x4d')][_0x454a('0x4e')])),'save_name':path[_0x454a('0x4c')](_0x565e19['file']['filename'],path['extname'](_0x565e19[_0x454a('0x4d')][_0x454a('0x4f')])),'original_format':path['extname'](_0x565e19['file'][_0x454a('0x4e')])[_0x454a('0x50')](0x1),'converted_format':_0x454a('0x51')};var _0x15570b=path[_0x454a('0x4a')](config[_0x454a('0x47')],_0x454a('0x52'),_0x565e19[_0x454a('0x4d')][_0x454a('0x4f')]);var _0x3c04fa=path['join'](config[_0x454a('0x47')],'server/files/sounds/converted',util['format'](_0x454a('0x4b'),path[_0x454a('0x4c')](_0x565e19['file']['filename'],path['extname'](_0x565e19[_0x454a('0x4d')][_0x454a('0x4f')])),_0x342a01[_0x454a('0x46')]));logger[_0x454a('0x53')](_0x454a('0x54'),_0x15570b);logger[_0x454a('0x53')](_0x454a('0x55'),_0x3c04fa);try{fs[_0x454a('0x56')](_0x15570b,parseInt('0777',0x8));var _0x30fb7a=sox['transcode'](_0x15570b,_0x3c04fa,{'sampleRate':0x1f40,'format':_0x454a('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x30fb7a['on']('error',function(_0x400030){fs[_0x454a('0x57')](_0x15570b);_0x10f641[_0x454a('0x17')](0x1f4)[_0x454a('0x58')](_0x400030);});_0x30fb7a['on'](_0x454a('0x59'),function(_0x58a2d9){_0x342a01['original_duration']=isNaN(_0x58a2d9['duration'])?null:_0x58a2d9[_0x454a('0x5a')]*0x3e8;_0x342a01[_0x454a('0x5b')]=isNaN(_0x58a2d9[_0x454a('0x5c')])?null:_0x58a2d9['sampleCount'];_0x342a01[_0x454a('0x5d')]=isNaN(_0x58a2d9[_0x454a('0x5e')])?null:_0x58a2d9[_0x454a('0x5e')];_0x342a01['original_bitRate']=isNaN(_0x58a2d9[_0x454a('0x5f')])?null:_0x58a2d9['bitRate'];_0x342a01['original_sampleRate']=isNaN(_0x58a2d9[_0x454a('0x60')])?null:_0x58a2d9[_0x454a('0x60')];});_0x30fb7a['on'](_0x454a('0x61'),function(_0x181530){_0x342a01[_0x454a('0x62')]=isNaN(_0x181530[_0x454a('0x5a')])?null:_0x181530['duration']*0x3e8;_0x342a01[_0x454a('0x63')]=isNaN(_0x181530[_0x454a('0x5c')])?null:_0x181530['sampleCount'];_0x342a01[_0x454a('0x64')]=isNaN(_0x181530['channelCount'])?null:_0x181530[_0x454a('0x5e')];_0x342a01[_0x454a('0x65')]=isNaN(_0x181530[_0x454a('0x5f')])?null:_0x181530[_0x454a('0x5f')];_0x342a01[_0x454a('0x66')]=isNaN(_0x181530['sampleRate'])?null:_0x181530[_0x454a('0x60')];});_0x30fb7a['on'](_0x454a('0x67'),function(){fs[_0x454a('0x56')](_0x3c04fa,parseInt(_0x454a('0x68'),0x8));return db[_0x454a('0x29')]['create'](_0x342a01)[_0x454a('0x21')](function(_0x536e11){var _0x23a6ae={'role':_0x565e19[_0x454a('0x69')][_0x454a('0x6a')],'userProfileId':_0x565e19[_0x454a('0x69')][_0x454a('0x6b')]};if(!_0x23a6ae)throw new Error(_0x454a('0x6c'));if(_0x23a6ae['role']===_0x454a('0x6d')){var _0x40a905=_0x536e11[_0x454a('0x6e')]({'plain':!![]});return db[_0x454a('0x6f')][_0x454a('0x44')]({'where':{'name':_0x454a('0x23'),'userProfileId':_0x23a6ae[_0x454a('0x6b')]},'raw':!![]})[_0x454a('0x21')](function(_0x426c39){if(_0x426c39&&_0x426c39[_0x454a('0x70')]===0x0){return db[_0x454a('0x24')][_0x454a('0x71')]({'name':_0x40a905['name'],'resourceId':_0x40a905['id'],'type':_0x426c39[_0x454a('0x27')],'sectionId':_0x426c39['id']},{})[_0x454a('0x21')](function(){return _0x536e11;});}else{return _0x536e11;}})[_0x454a('0x41')](function(_0x2717ca){logger[_0x454a('0x25')](_0x454a('0x72'),_0x2717ca);throw _0x2717ca;});}return _0x536e11;})[_0x454a('0x21')](respondWithResult(_0x10f641,null))['catch'](handleError(_0x10f641,null));});_0x30fb7a[_0x454a('0x73')]();}catch(_0x2a5405){_0x10f641[_0x454a('0x17')](0x1f4)[_0x454a('0x58')](_0x2a5405);}};exports[_0x454a('0x74')]=function(_0x40e50f,_0x69d364,_0x14fa04){return db[_0x454a('0x29')][_0x454a('0x44')]({'where':{'id':_0x40e50f[_0x454a('0x42')]['id']}})[_0x454a('0x21')](handleEntityNotFound(_0x69d364,null))[_0x454a('0x21')](saveUpdates(_[_0x454a('0x39')](_0x40e50f['body'],['name','description']),null))[_0x454a('0x21')](respondWithResult(_0x69d364,null))[_0x454a('0x41')](handleError(_0x69d364,null));};exports['delete']=function(_0xcf7e81,_0x5f01a8,_0x46323e){return db[_0x454a('0x29')][_0x454a('0x44')]({'where':{'id':_0xcf7e81[_0x454a('0x42')]['id']}})[_0x454a('0x21')](function(_0x551384){if(_0x551384){return _0x551384[_0x454a('0x22')]();}})[_0x454a('0x21')](function(_0x171588){var _0x424ba0=path[_0x454a('0x4a')](config[_0x454a('0x47')],_0x454a('0x52'),util['format'](_0x454a('0x4b'),_0x171588[_0x454a('0x75')],_0x171588[_0x454a('0x76')]));var _0x452947=path[_0x454a('0x4a')](config[_0x454a('0x47')],_0x454a('0x48'),util[_0x454a('0x77')](_0x454a('0x4b'),_0x171588['save_name'],_0x171588[_0x454a('0x46')]));fs['unlinkSync'](_0x424ba0);fs['unlinkSync'](_0x452947);return _0x171588;})[_0x454a('0x21')](function(_0x3b2d89){if(_0x3b2d89){return _0x5f01a8[_0x454a('0x17')](0xcc)[_0x454a('0x67')]();}})['then'](handleEntityNotFound(_0x5f01a8,null))[_0x454a('0x41')](handleError(_0x5f01a8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 19eae7f..346136f 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 _0x20c4=['../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5c96dd,_0x3017af){var _0x20416f=function(_0x30a54e){while(--_0x30a54e){_0x5c96dd['push'](_0x5c96dd['shift']());}};_0x20416f(++_0x3017af);}(_0x20c4,0x14e));var _0x420c=function(_0x286d32,_0x2b1a60){_0x286d32=_0x286d32-0x0;var _0x2549f1=_0x20c4[_0x286d32];return _0x2549f1;};'use strict';var _=require(_0x420c('0x0'));var util=require(_0x420c('0x1'));var logger=require(_0x420c('0x2'))(_0x420c('0x3'));var moment=require(_0x420c('0x4'));var BPromise=require('bluebird');var rp=require(_0x420c('0x5'));var fs=require('fs');var path=require(_0x420c('0x6'));var rimraf=require('rimraf');var config=require(_0x420c('0x7'));var attributes=require(_0x420c('0x8'));module[_0x420c('0x9')]=function(_0x4a1366,_0x20c7bb){return _0x4a1366['define']('Sound',attributes,{'tableName':_0x420c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f7a=['rimraf','../../config/environment','./sound.attributes','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0x2f7a,0xc8));var _0xa2f7=function(_0x1209bb,_0x293a34){_0x1209bb=_0x1209bb-0x0;var _0x480a25=_0x2f7a[_0x1209bb];return _0x480a25;};'use strict';var _=require(_0xa2f7('0x0'));var util=require(_0xa2f7('0x1'));var logger=require(_0xa2f7('0x2'))(_0xa2f7('0x3'));var moment=require(_0xa2f7('0x4'));var BPromise=require(_0xa2f7('0x5'));var rp=require(_0xa2f7('0x6'));var fs=require('fs');var path=require(_0xa2f7('0x7'));var rimraf=require(_0xa2f7('0x8'));var config=require(_0xa2f7('0x9'));var attributes=require(_0xa2f7('0xa'));module['exports']=function(_0x27a886,_0x399d47){return _0x27a886[_0xa2f7('0xb')]('Sound',attributes,{'tableName':_0xa2f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 2255708..fae00d9 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 _0x9c33=['ShowSound','Sound','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1bd158,_0x54142c){var _0x58719b=function(_0x53a0e7){while(--_0x53a0e7){_0x1bd158['push'](_0x1bd158['shift']());}};_0x58719b(++_0x54142c);}(_0x9c33,0x171));var _0x39c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9c33[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x39c3('0x0'));var util=require(_0x39c3('0x1'));var moment=require(_0x39c3('0x2'));var BPromise=require(_0x39c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39c3('0x4'));var logger=require(_0x39c3('0x5'))('rpc');var config=require(_0x39c3('0x6'));var jayson=require(_0x39c3('0x7'));var client=jayson[_0x39c3('0x8')][_0x39c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x516e91,_0x3354e3,_0x5c58e6){return new BPromise(function(_0x52d8ae,_0x10ef87){return client[_0x39c3('0xa')](_0x516e91,_0x5c58e6)[_0x39c3('0xb')](function(_0x3b5c9d){logger[_0x39c3('0xc')](_0x39c3('0xd'),_0x3354e3,_0x39c3('0xe'));logger[_0x39c3('0xf')](_0x39c3('0x10'),_0x3354e3,_0x39c3('0xe'),JSON[_0x39c3('0x11')](_0x3b5c9d));if(_0x3b5c9d['error']){if(_0x3b5c9d['error'][_0x39c3('0x12')]===0x1f4){logger[_0x39c3('0x13')](_0x39c3('0xd'),_0x3354e3,_0x3b5c9d[_0x39c3('0x13')][_0x39c3('0x14')]);return _0x10ef87(_0x3b5c9d[_0x39c3('0x13')][_0x39c3('0x14')]);}logger[_0x39c3('0x13')](_0x39c3('0xd'),_0x3354e3,_0x3b5c9d[_0x39c3('0x13')][_0x39c3('0x14')]);return _0x52d8ae(_0x3b5c9d[_0x39c3('0x13')][_0x39c3('0x14')]);}else{logger[_0x39c3('0xc')]('Sound,\x20%s,\x20%s',_0x3354e3,_0x39c3('0xe'));_0x52d8ae(_0x3b5c9d['result'][_0x39c3('0x14')]);}})['catch'](function(_0x28a966){logger[_0x39c3('0x13')](_0x39c3('0xd'),_0x3354e3,_0x28a966);_0x10ef87(_0x28a966);});});}exports[_0x39c3('0x15')]=function(_0xc71dc){var _0x50f25c=this;return new Promise(function(_0x33142d,_0x34a35c){return db[_0x39c3('0x16')]['find']({'raw':_0xc71dc[_0x39c3('0x17')]?_0xc71dc[_0x39c3('0x17')][_0x39c3('0x18')]===undefined?!![]:![]:!![],'where':_0xc71dc[_0x39c3('0x17')]?_0xc71dc['options'][_0x39c3('0x19')]||null:null,'attributes':_0xc71dc['options']?_0xc71dc[_0x39c3('0x17')]['attributes']||null:null,'include':_0xc71dc[_0x39c3('0x17')]?_0xc71dc['options'][_0x39c3('0x1a')]?_[_0x39c3('0x1b')](_0xc71dc[_0x39c3('0x17')]['include'],function(_0x37b882){return{'model':db[_0x37b882[_0x39c3('0x1c')]],'as':_0x37b882['as'],'attributes':_0x37b882[_0x39c3('0x1d')],'include':_0x37b882[_0x39c3('0x1a')]?_[_0x39c3('0x1b')](_0x37b882['include'],function(_0x1c7c34){return{'model':db[_0x1c7c34[_0x39c3('0x1c')]],'as':_0x1c7c34['as'],'attributes':_0x1c7c34[_0x39c3('0x1d')],'include':_0x1c7c34[_0x39c3('0x1a')]?_[_0x39c3('0x1b')](_0x1c7c34[_0x39c3('0x1a')],function(_0x242fe6){return{'model':db[_0x242fe6[_0x39c3('0x1c')]],'as':_0x242fe6['as'],'attributes':_0x242fe6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44fd4c){logger[_0x39c3('0xc')](_0x39c3('0x15'),_0xc71dc);logger[_0x39c3('0xf')](_0x39c3('0x15'),_0xc71dc,JSON[_0x39c3('0x11')](_0x44fd4c));_0x33142d(_0x44fd4c);})['catch'](function(_0x57e59d){logger[_0x39c3('0x13')](_0x39c3('0x15'),_0x57e59d[_0x39c3('0x14')],_0xc71dc);_0x34a35c(_0x50f25c[_0x39c3('0x13')](0x1f4,_0x57e59d['message']));});});}; \ No newline at end of file +var _0x5c9b=['request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Sound','find','options','where','include','model','attributes','map','ShowSound','debug','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0xb49cb8,_0x39474b){var _0x879ead=function(_0x596639){while(--_0x596639){_0xb49cb8['push'](_0xb49cb8['shift']());}};_0x879ead(++_0x39474b);}(_0x5c9b,0x186));var _0xb5c9=function(_0x27019f,_0x1002af){_0x27019f=_0x27019f-0x0;var _0x4d6232=_0x5c9b[_0x27019f];return _0x4d6232;};'use strict';var _=require(_0xb5c9('0x0'));var util=require(_0xb5c9('0x1'));var moment=require('moment');var BPromise=require(_0xb5c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5c9('0x3'));var db=require(_0xb5c9('0x4'))['db'];var utils=require(_0xb5c9('0x5'));var logger=require(_0xb5c9('0x6'))(_0xb5c9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb5c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x160d84,_0x2c422f,_0x1ea903){return new BPromise(function(_0x1145b5,_0x37856e){return client[_0xb5c9('0x9')](_0x160d84,_0x1ea903)[_0xb5c9('0xa')](function(_0x3a2f34){logger[_0xb5c9('0xb')](_0xb5c9('0xc'),_0x2c422f,_0xb5c9('0xd'));logger['debug'](_0xb5c9('0xe'),_0x2c422f,_0xb5c9('0xd'),JSON['stringify'](_0x3a2f34));if(_0x3a2f34['error']){if(_0x3a2f34[_0xb5c9('0xf')][_0xb5c9('0x10')]===0x1f4){logger[_0xb5c9('0xf')](_0xb5c9('0xc'),_0x2c422f,_0x3a2f34[_0xb5c9('0xf')][_0xb5c9('0x11')]);return _0x37856e(_0x3a2f34['error'][_0xb5c9('0x11')]);}logger[_0xb5c9('0xf')]('Sound,\x20%s,\x20%s',_0x2c422f,_0x3a2f34['error'][_0xb5c9('0x11')]);return _0x1145b5(_0x3a2f34['error'][_0xb5c9('0x11')]);}else{logger[_0xb5c9('0xb')](_0xb5c9('0xc'),_0x2c422f,_0xb5c9('0xd'));_0x1145b5(_0x3a2f34[_0xb5c9('0x12')]['message']);}})[_0xb5c9('0x13')](function(_0xf1a1b8){logger['error'](_0xb5c9('0xc'),_0x2c422f,_0xf1a1b8);_0x37856e(_0xf1a1b8);});});}exports['ShowSound']=function(_0x3792bf){var _0x25d5df=this;return new Promise(function(_0x454d58,_0x4a3cd5){return db[_0xb5c9('0x14')][_0xb5c9('0x15')]({'raw':_0x3792bf[_0xb5c9('0x16')]?_0x3792bf[_0xb5c9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3792bf[_0xb5c9('0x16')]?_0x3792bf[_0xb5c9('0x16')][_0xb5c9('0x17')]||null:null,'attributes':_0x3792bf[_0xb5c9('0x16')]?_0x3792bf[_0xb5c9('0x16')]['attributes']||null:null,'include':_0x3792bf[_0xb5c9('0x16')]?_0x3792bf[_0xb5c9('0x16')]['include']?_['map'](_0x3792bf['options'][_0xb5c9('0x18')],function(_0x5dd004){return{'model':db[_0x5dd004[_0xb5c9('0x19')]],'as':_0x5dd004['as'],'attributes':_0x5dd004[_0xb5c9('0x1a')],'include':_0x5dd004['include']?_[_0xb5c9('0x1b')](_0x5dd004['include'],function(_0x1d031a){return{'model':db[_0x1d031a[_0xb5c9('0x19')]],'as':_0x1d031a['as'],'attributes':_0x1d031a[_0xb5c9('0x1a')],'include':_0x1d031a[_0xb5c9('0x18')]?_['map'](_0x1d031a[_0xb5c9('0x18')],function(_0x28fd33){return{'model':db[_0x28fd33['model']],'as':_0x28fd33['as'],'attributes':_0x28fd33[_0xb5c9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ea81e){logger[_0xb5c9('0xb')](_0xb5c9('0x1c'),_0x3792bf);logger[_0xb5c9('0x1d')](_0xb5c9('0x1c'),_0x3792bf,JSON[_0xb5c9('0x1e')](_0x1ea81e));_0x454d58(_0x1ea81e);})[_0xb5c9('0x13')](function(_0x1d95ca){logger[_0xb5c9('0xf')]('ShowSound',_0x1d95ca[_0xb5c9('0x11')],_0x3792bf);_0x4a3cd5(_0x25d5df[_0xb5c9('0xf')](0x1f4,_0x1d95ca[_0xb5c9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c4a0423..da3ad1c 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x20ee5e,_0x556a17){var _0x2aff44=function(_0x2c668e){while(--_0x2c668e){_0x20ee5e['push'](_0x20ee5e['shift']());}};_0x2aff44(++_0x556a17);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x12ed54,_0x51842c){var _0x409738=function(_0x412214){while(--_0x412214){_0x12ed54['push'](_0x12ed54['shift']());}};_0x409738(++_0x51842c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7dc56e7..fcbc833 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 _0xa46c=['TEXT','medium','ENUM','out','STRING','exports'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xa46c,0x13d));var _0xca46=function(_0x4f8416,_0x20f405){_0x4f8416=_0x4f8416-0x0;var _0x2864dd=_0xa46c[_0x4f8416];return _0x2864dd;};'use strict';var Sequelize=require('sequelize');module[_0xca46('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xca46('0x1')](_0xca46('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xca46('0x3')]('in',_0xca46('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xca46('0x5')]},'providerResponse':{'type':Sequelize[_0xca46('0x1')]}}; \ No newline at end of file +var _0xd81c=['STRING','TEXT','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd81c,0x1e9));var _0xcd81=function(_0x2880a4,_0x168e9e){_0x2880a4=_0x2880a4-0x0;var _0x4614df=_0xd81c[_0x2880a4];return _0x4614df;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcd81('0x0')]},'body':{'type':Sequelize[_0xcd81('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcd81('0x2')),'defaultValue':_0xcd81('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0xcd81('0x0')]},'providerResponse':{'type':Sequelize[_0xcd81('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 57626b3..a2e7f3c 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 _0xcb10=['api','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','json','apply','save','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','catch','params','length','includeAll','include','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger'];(function(_0x47a833,_0x57d0ab){var _0x2d98bb=function(_0x2ecaf5){while(--_0x2ecaf5){_0x47a833['push'](_0x47a833['shift']());}};_0x2d98bb(++_0x57d0ab);}(_0xcb10,0x104));var _0x0cb1=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xcb10[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x0cb1('0x0'));var rimraf=require(_0x0cb1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cb1('0x2'));var rp=require(_0x0cb1('0x3'));var moment=require('moment');var BPromise=require(_0x0cb1('0x4'));var Mustache=require('mustache');var util=require(_0x0cb1('0x5'));var path=require(_0x0cb1('0x6'));var sox=require(_0x0cb1('0x7'));var csv=require(_0x0cb1('0x8'));var ejs=require(_0x0cb1('0x9'));var fs=require('fs');var fs_extra=require(_0x0cb1('0xa'));var _=require(_0x0cb1('0xb'));var squel=require(_0x0cb1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cb1('0xd'));var deskjs=require(_0x0cb1('0xe'));var toCsv=require(_0x0cb1('0x8'));var querystring=require(_0x0cb1('0xf'));var Papa=require(_0x0cb1('0x10'));var Redis=require(_0x0cb1('0x11'));var authService=require(_0x0cb1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cb1('0x13'))(_0x0cb1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cb1('0x15'))['db'];function respondWithStatusCode(_0x5ab983,_0x6b6477){_0x6b6477=_0x6b6477||0xcc;return function(_0x1c5680){if(_0x1c5680){return _0x5ab983[_0x0cb1('0x16')](_0x6b6477);}return _0x5ab983[_0x0cb1('0x17')](_0x6b6477)[_0x0cb1('0x18')]();};}function respondWithResult(_0x29ff45,_0x5144a8){_0x5144a8=_0x5144a8||0xc8;return function(_0x1a8d98){if(_0x1a8d98){return _0x29ff45[_0x0cb1('0x17')](_0x5144a8)['json'](_0x1a8d98);}};}function respondWithFilteredResult(_0x1053f6,_0x4eb8bc){return function(_0x3e6e6b){if(_0x3e6e6b){var _0x145cd4=typeof _0x4eb8bc['offset']===_0x0cb1('0x19')&&typeof _0x4eb8bc[_0x0cb1('0x1a')]===_0x0cb1('0x19');var _0x1f3434=_0x3e6e6b['count'];var _0x2cda93=_0x145cd4?0x0:_0x4eb8bc[_0x0cb1('0x1b')];var _0xe0488d=_0x145cd4?_0x3e6e6b['count']:_0x4eb8bc['offset']+_0x4eb8bc[_0x0cb1('0x1a')];var _0x109db9;if(_0xe0488d>=_0x1f3434){_0xe0488d=_0x1f3434;_0x109db9=0xc8;}else{_0x109db9=0xce;}_0x1053f6['status'](_0x109db9);return _0x1053f6[_0x0cb1('0x1c')]('Content-Range',_0x2cda93+'-'+_0xe0488d+'/'+_0x1f3434)[_0x0cb1('0x1d')](_0x3e6e6b);}return null;};}function patchUpdates(_0x5d77c2){return function(_0x29a2dc){try{jsonpatch[_0x0cb1('0x1e')](_0x29a2dc,_0x5d77c2,!![]);}catch(_0x39c2bb){return BPromise['reject'](_0x39c2bb);}return _0x29a2dc[_0x0cb1('0x1f')]();};}function saveUpdates(_0x1f4702,_0x95f9a){return function(_0x25598e){if(_0x25598e){return _0x25598e['update'](_0x1f4702)[_0x0cb1('0x20')](function(_0x5215d7){return _0x5215d7;});}return null;};}function removeEntity(_0xc177bf,_0x4eeccb){return function(_0x40b6a2){if(_0x40b6a2){return _0x40b6a2[_0x0cb1('0x21')]()[_0x0cb1('0x20')](function(){_0xc177bf[_0x0cb1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb9ac,_0x34289b){return function(_0x2cde9c){if(!_0x2cde9c){_0x2bb9ac[_0x0cb1('0x16')](0x194);}return _0x2cde9c;};}function handleError(_0x3db759,_0x421183){_0x421183=_0x421183||0x1f4;return function(_0x4a45b5){logger[_0x0cb1('0x22')](_0x4a45b5[_0x0cb1('0x23')]);if(_0x4a45b5[_0x0cb1('0x24')]){delete _0x4a45b5['name'];}_0x3db759[_0x0cb1('0x17')](_0x421183)['send'](_0x4a45b5);};}exports[_0x0cb1('0x25')]=function(_0x2fe61a,_0x2eea1a){var _0x46e244={},_0x3c6d11={},_0x4c61dd={'count':0x0,'rows':[]};var _0x38b859=_[_0x0cb1('0x26')](db[_0x0cb1('0x27')][_0x0cb1('0x28')],function(_0x569058){return{'name':_0x569058['fieldName'],'type':_0x569058[_0x0cb1('0x29')][_0x0cb1('0x2a')]};});_0x3c6d11[_0x0cb1('0x2b')]=_[_0x0cb1('0x26')](_0x38b859,_0x0cb1('0x24'));_0x3c6d11[_0x0cb1('0x2c')]=_[_0x0cb1('0x2d')](_0x2fe61a[_0x0cb1('0x2c')]);_0x3c6d11[_0x0cb1('0x2e')]=_[_0x0cb1('0x2f')](_0x3c6d11['model'],_0x3c6d11[_0x0cb1('0x2c')]);_0x46e244['attributes']=_['intersection'](_0x3c6d11[_0x0cb1('0x2b')],qs[_0x0cb1('0x30')](_0x2fe61a[_0x0cb1('0x2c')][_0x0cb1('0x30')]));_0x46e244[_0x0cb1('0x31')]=_0x46e244[_0x0cb1('0x31')]['length']?_0x46e244[_0x0cb1('0x31')]:_0x3c6d11[_0x0cb1('0x2b')];if(!_0x2fe61a[_0x0cb1('0x2c')]['hasOwnProperty'](_0x0cb1('0x32'))){_0x46e244[_0x0cb1('0x1a')]=qs[_0x0cb1('0x1a')](_0x2fe61a[_0x0cb1('0x2c')][_0x0cb1('0x1a')]);_0x46e244['offset']=qs[_0x0cb1('0x1b')](_0x2fe61a[_0x0cb1('0x2c')]['offset']);}_0x46e244['order']=qs[_0x0cb1('0x33')](_0x2fe61a[_0x0cb1('0x2c')]['sort']);_0x46e244['where']=qs['filters'](_[_0x0cb1('0x34')](_0x2fe61a[_0x0cb1('0x2c')],_0x3c6d11[_0x0cb1('0x2e')]),_0x38b859);if(_0x2fe61a[_0x0cb1('0x2c')][_0x0cb1('0x35')]){_0x46e244[_0x0cb1('0x36')]=_[_0x0cb1('0x37')](_0x46e244[_0x0cb1('0x36')],{'$or':_['map'](_0x38b859,function(_0x54f152){if(_0x54f152['type']!==_0x0cb1('0x38')){var _0x5230e2={};_0x5230e2[_0x54f152[_0x0cb1('0x24')]]={'$like':'%'+_0x2fe61a[_0x0cb1('0x2c')][_0x0cb1('0x35')]+'%'};return _0x5230e2;}})});}_0x46e244=_[_0x0cb1('0x37')]({},_0x46e244,_0x2fe61a[_0x0cb1('0x39')]);var _0x3f4f25={'where':_0x46e244['where']};return db['SquareMessage'][_0x0cb1('0x3a')](_0x3f4f25)[_0x0cb1('0x20')](function(_0x166582){_0x4c61dd[_0x0cb1('0x3a')]=_0x166582;if(_0x2fe61a[_0x0cb1('0x2c')]['includeAll']){_0x46e244['include']=[{'all':!![]}];}return db[_0x0cb1('0x27')][_0x0cb1('0x3b')](_0x46e244);})['then'](function(_0x1516df){_0x4c61dd[_0x0cb1('0x3c')]=_0x1516df;return _0x4c61dd;})[_0x0cb1('0x20')](respondWithFilteredResult(_0x2eea1a,_0x46e244))[_0x0cb1('0x3d')](handleError(_0x2eea1a,null));};exports['show']=function(_0x5e49b7,_0x2839ef){var _0x12abbb={'raw':!![],'where':{'id':_0x5e49b7[_0x0cb1('0x3e')]['id']}},_0x14e9e3={};_0x14e9e3[_0x0cb1('0x2b')]=_[_0x0cb1('0x2d')](db[_0x0cb1('0x27')][_0x0cb1('0x28')]);_0x14e9e3[_0x0cb1('0x2c')]=_[_0x0cb1('0x2d')](_0x5e49b7['query']);_0x14e9e3['filters']=_['intersection'](_0x14e9e3[_0x0cb1('0x2b')],_0x14e9e3[_0x0cb1('0x2c')]);_0x12abbb[_0x0cb1('0x31')]=_['intersection'](_0x14e9e3['model'],qs[_0x0cb1('0x30')](_0x5e49b7[_0x0cb1('0x2c')][_0x0cb1('0x30')]));_0x12abbb[_0x0cb1('0x31')]=_0x12abbb[_0x0cb1('0x31')][_0x0cb1('0x3f')]?_0x12abbb[_0x0cb1('0x31')]:_0x14e9e3[_0x0cb1('0x2b')];if(_0x5e49b7['query'][_0x0cb1('0x40')]){_0x12abbb[_0x0cb1('0x41')]=[{'all':!![]}];}_0x12abbb=_[_0x0cb1('0x37')]({},_0x12abbb,_0x5e49b7[_0x0cb1('0x39')]);return db[_0x0cb1('0x27')][_0x0cb1('0x42')](_0x12abbb)[_0x0cb1('0x20')](handleEntityNotFound(_0x2839ef,null))[_0x0cb1('0x20')](respondWithResult(_0x2839ef,null))[_0x0cb1('0x3d')](handleError(_0x2839ef,null));};exports['create']=function(_0x11f8e5,_0x344bfd){return db[_0x0cb1('0x27')][_0x0cb1('0x43')](_0x11f8e5['body'],{})[_0x0cb1('0x20')](respondWithResult(_0x344bfd,0xc9))['catch'](handleError(_0x344bfd,null));};exports[_0x0cb1('0x44')]=function(_0x541fc0,_0x33acf7){if(_0x541fc0['body']['id']){delete _0x541fc0[_0x0cb1('0x45')]['id'];}return db['SquareMessage'][_0x0cb1('0x42')]({'where':{'id':_0x541fc0[_0x0cb1('0x3e')]['id']}})[_0x0cb1('0x20')](handleEntityNotFound(_0x33acf7,null))[_0x0cb1('0x20')](saveUpdates(_0x541fc0[_0x0cb1('0x45')],null))[_0x0cb1('0x20')](respondWithResult(_0x33acf7,null))[_0x0cb1('0x3d')](handleError(_0x33acf7,null));};exports['destroy']=function(_0x4dc3bc,_0x339d87){return db[_0x0cb1('0x27')][_0x0cb1('0x42')]({'where':{'id':_0x4dc3bc[_0x0cb1('0x3e')]['id']}})[_0x0cb1('0x20')](handleEntityNotFound(_0x339d87,null))[_0x0cb1('0x20')](removeEntity(_0x339d87,null))[_0x0cb1('0x3d')](handleError(_0x339d87,null));}; \ No newline at end of file +var _0xeae4=['catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','update','destroy','then','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5afb7f,_0x35bea1){var _0x186c34=function(_0x1d88df){while(--_0x1d88df){_0x5afb7f['push'](_0x5afb7f['shift']());}};_0x186c34(++_0x35bea1);}(_0xeae4,0xe8));var _0x4eae=function(_0x4aff59,_0x133f7f){_0x4aff59=_0x4aff59-0x0;var _0xc848e3=_0xeae4[_0x4aff59];return _0xc848e3;};'use strict';var emlformat=require(_0x4eae('0x0'));var rimraf=require(_0x4eae('0x1'));var zipdir=require(_0x4eae('0x2'));var jsonpatch=require(_0x4eae('0x3'));var rp=require(_0x4eae('0x4'));var moment=require(_0x4eae('0x5'));var BPromise=require(_0x4eae('0x6'));var Mustache=require(_0x4eae('0x7'));var util=require(_0x4eae('0x8'));var path=require(_0x4eae('0x9'));var sox=require('sox');var csv=require(_0x4eae('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4eae('0xb'));var _=require(_0x4eae('0xc'));var squel=require(_0x4eae('0xd'));var crypto=require(_0x4eae('0xe'));var jsforce=require(_0x4eae('0xf'));var deskjs=require(_0x4eae('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4eae('0x11'));var Papa=require(_0x4eae('0x12'));var Redis=require('ioredis');var authService=require(_0x4eae('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4eae('0x14'));var hardwareService=require(_0x4eae('0x15'));var logger=require(_0x4eae('0x16'))(_0x4eae('0x17'));var utils=require(_0x4eae('0x18'));var config=require(_0x4eae('0x19'));var licenseUtil=require(_0x4eae('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47d076,_0x51f1f4){_0x51f1f4=_0x51f1f4||0xcc;return function(_0x53986f){if(_0x53986f){return _0x47d076[_0x4eae('0x1b')](_0x51f1f4);}return _0x47d076['status'](_0x51f1f4)[_0x4eae('0x1c')]();};}function respondWithResult(_0x28d18e,_0x177140){_0x177140=_0x177140||0xc8;return function(_0x20558e){if(_0x20558e){return _0x28d18e[_0x4eae('0x1d')](_0x177140)[_0x4eae('0x1e')](_0x20558e);}};}function respondWithFilteredResult(_0x3b0652,_0x3e6362){return function(_0x1ea442){if(_0x1ea442){var _0x50789a=typeof _0x3e6362['offset']===_0x4eae('0x1f')&&typeof _0x3e6362['limit']==='undefined';var _0x26e149=_0x1ea442['count'];var _0x83fa03=_0x50789a?0x0:_0x3e6362[_0x4eae('0x20')];var _0x47533a=_0x50789a?_0x1ea442[_0x4eae('0x21')]:_0x3e6362['offset']+_0x3e6362[_0x4eae('0x22')];var _0x13c2fb;if(_0x47533a>=_0x26e149){_0x47533a=_0x26e149;_0x13c2fb=0xc8;}else{_0x13c2fb=0xce;}_0x3b0652['status'](_0x13c2fb);return _0x3b0652[_0x4eae('0x23')]('Content-Range',_0x83fa03+'-'+_0x47533a+'/'+_0x26e149)[_0x4eae('0x1e')](_0x1ea442);}return null;};}function patchUpdates(_0x3b69d3){return function(_0x516f4d){try{jsonpatch[_0x4eae('0x24')](_0x516f4d,_0x3b69d3,!![]);}catch(_0x28e8c0){return BPromise[_0x4eae('0x25')](_0x28e8c0);}return _0x516f4d['save']();};}function saveUpdates(_0x229266,_0x524c51){return function(_0x290c38){if(_0x290c38){return _0x290c38[_0x4eae('0x26')](_0x229266)['then'](function(_0x3c37fa){return _0x3c37fa;});}return null;};}function removeEntity(_0x3623dd,_0x4f7669){return function(_0x536563){if(_0x536563){return _0x536563[_0x4eae('0x27')]()[_0x4eae('0x28')](function(){_0x3623dd[_0x4eae('0x1d')](0xcc)[_0x4eae('0x1c')]();});}};}function handleEntityNotFound(_0x433857,_0x3086cf){return function(_0xcd14cf){if(!_0xcd14cf){_0x433857[_0x4eae('0x1b')](0x194);}return _0xcd14cf;};}function handleError(_0x4cda44,_0x1987de){_0x1987de=_0x1987de||0x1f4;return function(_0x5ca5cb){logger[_0x4eae('0x29')](_0x5ca5cb['stack']);if(_0x5ca5cb[_0x4eae('0x2a')]){delete _0x5ca5cb['name'];}_0x4cda44[_0x4eae('0x1d')](_0x1987de)['send'](_0x5ca5cb);};}exports[_0x4eae('0x2b')]=function(_0x2af418,_0x352956){var _0xf834e9={},_0x1b6413={},_0x20ad77={'count':0x0,'rows':[]};var _0x33c143=_[_0x4eae('0x2c')](db[_0x4eae('0x2d')][_0x4eae('0x2e')],function(_0x15c6d4){return{'name':_0x15c6d4[_0x4eae('0x2f')],'type':_0x15c6d4[_0x4eae('0x30')]['key']};});_0x1b6413[_0x4eae('0x31')]=_[_0x4eae('0x2c')](_0x33c143,'name');_0x1b6413[_0x4eae('0x32')]=_[_0x4eae('0x33')](_0x2af418['query']);_0x1b6413[_0x4eae('0x34')]=_[_0x4eae('0x35')](_0x1b6413[_0x4eae('0x31')],_0x1b6413['query']);_0xf834e9[_0x4eae('0x36')]=_['intersection'](_0x1b6413[_0x4eae('0x31')],qs[_0x4eae('0x37')](_0x2af418[_0x4eae('0x32')]['fields']));_0xf834e9[_0x4eae('0x36')]=_0xf834e9[_0x4eae('0x36')][_0x4eae('0x38')]?_0xf834e9[_0x4eae('0x36')]:_0x1b6413['model'];if(!_0x2af418['query']['hasOwnProperty']('nolimit')){_0xf834e9['limit']=qs[_0x4eae('0x22')](_0x2af418[_0x4eae('0x32')][_0x4eae('0x22')]);_0xf834e9[_0x4eae('0x20')]=qs[_0x4eae('0x20')](_0x2af418[_0x4eae('0x32')][_0x4eae('0x20')]);}_0xf834e9[_0x4eae('0x39')]=qs[_0x4eae('0x3a')](_0x2af418[_0x4eae('0x32')]['sort']);_0xf834e9[_0x4eae('0x3b')]=qs[_0x4eae('0x34')](_[_0x4eae('0x3c')](_0x2af418[_0x4eae('0x32')],_0x1b6413['filters']),_0x33c143);if(_0x2af418[_0x4eae('0x32')][_0x4eae('0x3d')]){_0xf834e9[_0x4eae('0x3b')]=_[_0x4eae('0x3e')](_0xf834e9['where'],{'$or':_[_0x4eae('0x2c')](_0x33c143,function(_0x1ff345){if(_0x1ff345[_0x4eae('0x30')]!==_0x4eae('0x3f')){var _0x10d9c0={};_0x10d9c0[_0x1ff345[_0x4eae('0x2a')]]={'$like':'%'+_0x2af418[_0x4eae('0x32')][_0x4eae('0x3d')]+'%'};return _0x10d9c0;}})});}_0xf834e9=_[_0x4eae('0x3e')]({},_0xf834e9,_0x2af418[_0x4eae('0x40')]);var _0x580427={'where':_0xf834e9['where']};return db[_0x4eae('0x2d')]['count'](_0x580427)['then'](function(_0x304589){_0x20ad77[_0x4eae('0x21')]=_0x304589;if(_0x2af418[_0x4eae('0x32')][_0x4eae('0x41')]){_0xf834e9['include']=[{'all':!![]}];}return db[_0x4eae('0x2d')][_0x4eae('0x42')](_0xf834e9);})[_0x4eae('0x28')](function(_0x2bcb72){_0x20ad77[_0x4eae('0x43')]=_0x2bcb72;return _0x20ad77;})[_0x4eae('0x28')](respondWithFilteredResult(_0x352956,_0xf834e9))[_0x4eae('0x44')](handleError(_0x352956,null));};exports[_0x4eae('0x45')]=function(_0x3c317f,_0xf065c0){var _0x476e3f={'raw':!![],'where':{'id':_0x3c317f[_0x4eae('0x46')]['id']}},_0x5a47ff={};_0x5a47ff['model']=_[_0x4eae('0x33')](db['SquareMessage'][_0x4eae('0x2e')]);_0x5a47ff[_0x4eae('0x32')]=_[_0x4eae('0x33')](_0x3c317f['query']);_0x5a47ff[_0x4eae('0x34')]=_['intersection'](_0x5a47ff['model'],_0x5a47ff['query']);_0x476e3f[_0x4eae('0x36')]=_[_0x4eae('0x35')](_0x5a47ff[_0x4eae('0x31')],qs['fields'](_0x3c317f[_0x4eae('0x32')][_0x4eae('0x37')]));_0x476e3f[_0x4eae('0x36')]=_0x476e3f[_0x4eae('0x36')][_0x4eae('0x38')]?_0x476e3f[_0x4eae('0x36')]:_0x5a47ff[_0x4eae('0x31')];if(_0x3c317f[_0x4eae('0x32')][_0x4eae('0x41')]){_0x476e3f[_0x4eae('0x47')]=[{'all':!![]}];}_0x476e3f=_['merge']({},_0x476e3f,_0x3c317f['options']);return db[_0x4eae('0x2d')]['find'](_0x476e3f)[_0x4eae('0x28')](handleEntityNotFound(_0xf065c0,null))[_0x4eae('0x28')](respondWithResult(_0xf065c0,null))['catch'](handleError(_0xf065c0,null));};exports[_0x4eae('0x48')]=function(_0x162125,_0x3b298c){return db[_0x4eae('0x2d')][_0x4eae('0x48')](_0x162125[_0x4eae('0x49')],{})[_0x4eae('0x28')](respondWithResult(_0x3b298c,0xc9))[_0x4eae('0x44')](handleError(_0x3b298c,null));};exports[_0x4eae('0x26')]=function(_0x3c725e,_0x2e225c){if(_0x3c725e[_0x4eae('0x49')]['id']){delete _0x3c725e['body']['id'];}return db[_0x4eae('0x2d')][_0x4eae('0x4a')]({'where':{'id':_0x3c725e[_0x4eae('0x46')]['id']}})[_0x4eae('0x28')](handleEntityNotFound(_0x2e225c,null))[_0x4eae('0x28')](saveUpdates(_0x3c725e['body'],null))[_0x4eae('0x28')](respondWithResult(_0x2e225c,null))[_0x4eae('0x44')](handleError(_0x2e225c,null));};exports[_0x4eae('0x27')]=function(_0x2aa446,_0x319da1){return db[_0x4eae('0x2d')][_0x4eae('0x4a')]({'where':{'id':_0x2aa446[_0x4eae('0x46')]['id']}})['then'](handleEntityNotFound(_0x319da1,null))['then'](removeEntity(_0x319da1,null))[_0x4eae('0x44')](handleError(_0x319da1,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index df55ae2..52f12b7 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 _0x0c15=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0c15,0xbf));var _0x50c1=function(_0x38d90b,_0x13c787){_0x38d90b=_0x38d90b-0x0;var _0x1dd83c=_0x0c15[_0x38d90b];return _0x1dd83c;};'use strict';var _=require(_0x50c1('0x0'));var util=require(_0x50c1('0x1'));var logger=require(_0x50c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x50c1('0x3'));var rp=require(_0x50c1('0x4'));var fs=require('fs');var path=require(_0x50c1('0x5'));var rimraf=require(_0x50c1('0x6'));var config=require(_0x50c1('0x7'));var attributes=require(_0x50c1('0x8'));module[_0x50c1('0x9')]=function(_0x1edfc0,_0x28603d){return _0x1edfc0[_0x50c1('0xa')](_0x50c1('0xb'),attributes,{'tableName':_0x50c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c82=['request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','moment','bluebird'];(function(_0x4052f0,_0x3fefee){var _0x4469ea=function(_0x3a7742){while(--_0x3a7742){_0x4052f0['push'](_0x4052f0['shift']());}};_0x4469ea(++_0x3fefee);}(_0x4c82,0x151));var _0x24c8=function(_0x150cea,_0x4581ed){_0x150cea=_0x150cea-0x0;var _0xceda08=_0x4c82[_0x150cea];return _0xceda08;};'use strict';var _=require(_0x24c8('0x0'));var util=require(_0x24c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x24c8('0x2'));var BPromise=require(_0x24c8('0x3'));var rp=require(_0x24c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x24c8('0x5'));var attributes=require(_0x24c8('0x6'));module[_0x24c8('0x7')]=function(_0x4cbfaf,_0x5603b0){return _0x4cbfaf[_0x24c8('0x8')](_0x24c8('0x9'),attributes,{'tableName':_0x24c8('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 dbb37f5..d312e45 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 _0x3153=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareMessage','SquareMessage','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x3153,0x1ca));var _0x3315=function(_0x2a6eaa,_0x1ad30d){_0x2a6eaa=_0x2a6eaa-0x0;var _0x5dda80=_0x3153[_0x2a6eaa];return _0x5dda80;};'use strict';var _=require(_0x3315('0x0'));var util=require(_0x3315('0x1'));var moment=require(_0x3315('0x2'));var BPromise=require(_0x3315('0x3'));var rs=require(_0x3315('0x4'));var fs=require('fs');var Redis=require(_0x3315('0x5'));var db=require(_0x3315('0x6'))['db'];var utils=require(_0x3315('0x7'));var logger=require(_0x3315('0x8'))(_0x3315('0x9'));var config=require(_0x3315('0xa'));var jayson=require(_0x3315('0xb'));var client=jayson[_0x3315('0xc')][_0x3315('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x36bcdd,_0x19a11c,_0x119cc9){return new BPromise(function(_0x40ed10,_0x253c73){return client[_0x3315('0xe')](_0x36bcdd,_0x119cc9)[_0x3315('0xf')](function(_0xf1cffb){logger[_0x3315('0x10')](_0x3315('0x11'),_0x19a11c,_0x3315('0x12'));logger[_0x3315('0x13')](_0x3315('0x14'),_0x19a11c,_0x3315('0x12'),JSON[_0x3315('0x15')](_0xf1cffb));if(_0xf1cffb[_0x3315('0x16')]){if(_0xf1cffb['error'][_0x3315('0x17')]===0x1f4){logger[_0x3315('0x16')]('SquareMessage,\x20%s,\x20%s',_0x19a11c,_0xf1cffb['error'][_0x3315('0x18')]);return _0x253c73(_0xf1cffb[_0x3315('0x16')][_0x3315('0x18')]);}logger['error'](_0x3315('0x11'),_0x19a11c,_0xf1cffb['error'][_0x3315('0x18')]);return _0x40ed10(_0xf1cffb[_0x3315('0x16')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x19a11c,_0x3315('0x12'));_0x40ed10(_0xf1cffb['result'][_0x3315('0x18')]);}})['catch'](function(_0x3a49c9){logger[_0x3315('0x16')](_0x3315('0x11'),_0x19a11c,_0x3a49c9);_0x253c73(_0x3a49c9);});});}exports[_0x3315('0x19')]=function(_0x16e147){var _0x184f52=this;return new Promise(function(_0x1cd539,_0x8c90cb){return db[_0x3315('0x1a')]['create'](_0x16e147[_0x3315('0x1b')],{'raw':_0x16e147[_0x3315('0x1c')]?_0x16e147[_0x3315('0x1c')][_0x3315('0x1d')]===undefined?!![]:![]:!![]})[_0x3315('0xf')](function(_0xfaa723){logger[_0x3315('0x10')](_0x3315('0x19'),_0x16e147);logger['debug'](_0x3315('0x19'),_0x16e147,JSON[_0x3315('0x15')](_0xfaa723));_0x1cd539(_0xfaa723);})[_0x3315('0x1e')](function(_0x9c15b1){logger[_0x3315('0x16')](_0x3315('0x19'),_0x9c15b1['message'],_0x16e147);_0x8c90cb(_0x184f52[_0x3315('0x16')](0x1f4,_0x9c15b1[_0x3315('0x18')]));});});}; \ No newline at end of file +var _0x2a76=['result','catch','CreateSquareMessage','SquareMessage','create','options','raw','then','info','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x2a76,0x180));var _0x62a7=function(_0x4ba81b,_0x14b578){_0x4ba81b=_0x4ba81b-0x0;var _0x20efdc=_0x2a76[_0x4ba81b];return _0x20efdc;};'use strict';var _=require('lodash');var util=require(_0x62a7('0x0'));var moment=require(_0x62a7('0x1'));var BPromise=require(_0x62a7('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(_0x62a7('0x3'))(_0x62a7('0x4'));var config=require(_0x62a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62a7('0x6')][_0x62a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17cf27,_0x5e1b65,_0x3c62fc){return new BPromise(function(_0x604102,_0x146794){return client[_0x62a7('0x8')](_0x17cf27,_0x3c62fc)['then'](function(_0x1ff340){logger['info'](_0x62a7('0x9'),_0x5e1b65,_0x62a7('0xa'));logger[_0x62a7('0xb')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5e1b65,'request\x20sent',JSON[_0x62a7('0xc')](_0x1ff340));if(_0x1ff340['error']){if(_0x1ff340[_0x62a7('0xd')][_0x62a7('0xe')]===0x1f4){logger[_0x62a7('0xd')]('SquareMessage,\x20%s,\x20%s',_0x5e1b65,_0x1ff340[_0x62a7('0xd')][_0x62a7('0xf')]);return _0x146794(_0x1ff340[_0x62a7('0xd')][_0x62a7('0xf')]);}logger[_0x62a7('0xd')]('SquareMessage,\x20%s,\x20%s',_0x5e1b65,_0x1ff340[_0x62a7('0xd')][_0x62a7('0xf')]);return _0x604102(_0x1ff340[_0x62a7('0xd')][_0x62a7('0xf')]);}else{logger['info'](_0x62a7('0x9'),_0x5e1b65,_0x62a7('0xa'));_0x604102(_0x1ff340[_0x62a7('0x10')][_0x62a7('0xf')]);}})[_0x62a7('0x11')](function(_0x6a8d39){logger[_0x62a7('0xd')](_0x62a7('0x9'),_0x5e1b65,_0x6a8d39);_0x146794(_0x6a8d39);});});}exports[_0x62a7('0x12')]=function(_0x18262b){var _0x1167e6=this;return new Promise(function(_0x224264,_0x2b34c5){return db[_0x62a7('0x13')][_0x62a7('0x14')](_0x18262b['body'],{'raw':_0x18262b[_0x62a7('0x15')]?_0x18262b['options'][_0x62a7('0x16')]===undefined?!![]:![]:!![]})[_0x62a7('0x17')](function(_0x15ffcf){logger[_0x62a7('0x18')](_0x62a7('0x12'),_0x18262b);logger[_0x62a7('0xb')](_0x62a7('0x12'),_0x18262b,JSON[_0x62a7('0xc')](_0x15ffcf));_0x224264(_0x15ffcf);})[_0x62a7('0x11')](function(_0x71830e){logger[_0x62a7('0xd')](_0x62a7('0x12'),_0x71830e[_0x62a7('0xf')],_0x18262b);_0x2b34c5(_0x1167e6['error'](0x1f4,_0x71830e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f86dd33..f6c321b 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 _0x264d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','15s','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x264d,0xc1));var _0xd264=function(_0x3a43d0,_0x171cdd){_0x3a43d0=_0x3a43d0-0x0;var _0x5d2664=_0x264d[_0x3a43d0];return _0x5d2664;};'use strict';var multer=require(_0xd264('0x0'));var util=require(_0xd264('0x1'));var path=require('path');var timeout=require(_0xd264('0x2'));var express=require(_0xd264('0x3'));var router=express[_0xd264('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd264('0x5'));var config=require(_0xd264('0x6'));var controller=require('./squareOdbc.controller');router[_0xd264('0x7')]('/',auth[_0xd264('0x8')](),controller[_0xd264('0x9')]);router['get'](_0xd264('0xa'),auth[_0xd264('0x8')](),controller['show']);router['get']('/:id/test',auth[_0xd264('0x8')](),timeout(_0xd264('0xb')),controller['test']);router[_0xd264('0xc')]('/',auth[_0xd264('0x8')](),controller[_0xd264('0xd')]);router[_0xd264('0xe')]('/:id',auth[_0xd264('0x8')](),controller[_0xd264('0xf')]);router[_0xd264('0x10')](_0xd264('0xa'),auth[_0xd264('0x8')](),controller[_0xd264('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2e5c=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','test','post','create','put','/:id'];(function(_0xb34f7c,_0xa66336){var _0x2527b6=function(_0x2012a2){while(--_0x2012a2){_0xb34f7c['push'](_0xb34f7c['shift']());}};_0x2527b6(++_0xa66336);}(_0x2e5c,0x190));var _0xc2e5=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x2e5c[_0x32b542];return _0x554d54;};'use strict';var multer=require('multer');var util=require(_0xc2e5('0x0'));var path=require(_0xc2e5('0x1'));var timeout=require(_0xc2e5('0x2'));var express=require('express');var router=express[_0xc2e5('0x3')]();var fs_extra=require(_0xc2e5('0x4'));var auth=require(_0xc2e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc2e5('0x6'));var controller=require(_0xc2e5('0x7'));router[_0xc2e5('0x8')]('/',auth[_0xc2e5('0x9')](),controller[_0xc2e5('0xa')]);router[_0xc2e5('0x8')]('/:id',auth[_0xc2e5('0x9')](),controller[_0xc2e5('0xb')]);router['get'](_0xc2e5('0xc'),auth[_0xc2e5('0x9')](),timeout('15s'),controller[_0xc2e5('0xd')]);router[_0xc2e5('0xe')]('/',auth[_0xc2e5('0x9')](),controller[_0xc2e5('0xf')]);router[_0xc2e5('0x10')](_0xc2e5('0x11'),auth[_0xc2e5('0x9')](),controller[_0xc2e5('0x12')]);router[_0xc2e5('0x13')]('/:id',auth[_0xc2e5('0x9')](),controller[_0xc2e5('0x14')]);module[_0xc2e5('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 01e7d5c..fef0499 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 _0x5f18=['sequelize','exports','STRING','name'];(function(_0x4070fd,_0x556e9d){var _0x36432e=function(_0x44c9f4){while(--_0x44c9f4){_0x4070fd['push'](_0x4070fd['shift']());}};_0x36432e(++_0x556e9d);}(_0x5f18,0x188));var _0x85f1=function(_0x26492a,_0x3bbfee){_0x26492a=_0x26492a-0x0;var _0x322e3b=_0x5f18[_0x26492a];return _0x322e3b;};'use strict';var Sequelize=require(_0x85f1('0x0'));module[_0x85f1('0x1')]={'name':{'type':Sequelize[_0x85f1('0x2')],'unique':_0x85f1('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x85f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0b1b=['sequelize','STRING','name'];(function(_0x544d6c,_0x2581ae){var _0x49614c=function(_0x144379){while(--_0x144379){_0x544d6c['push'](_0x544d6c['shift']());}};_0x49614c(++_0x2581ae);}(_0x0b1b,0x165));var _0xb0b1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b1b[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xb0b1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0b1('0x1')],'unique':_0xb0b1('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0b1('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3046aff..dbdf666 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 _0x4616=['length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0x31eed5,_0x38e6f6){var _0x373598=function(_0x31bae5){while(--_0x31bae5){_0x31eed5['push'](_0x31eed5['shift']());}};_0x373598(++_0x38e6f6);}(_0x4616,0x6f));var _0x6461=function(_0x507862,_0x30f75d){_0x507862=_0x507862-0x0;var _0x4f7e59=_0x4616[_0x507862];return _0x4f7e59;};'use strict';var emlformat=require(_0x6461('0x0'));var rimraf=require(_0x6461('0x1'));var zipdir=require(_0x6461('0x2'));var jsonpatch=require(_0x6461('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6461('0x4'));var Mustache=require(_0x6461('0x5'));var util=require(_0x6461('0x6'));var path=require('path');var sox=require(_0x6461('0x7'));var csv=require(_0x6461('0x8'));var ejs=require(_0x6461('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6461('0xa'));var squel=require(_0x6461('0xb'));var crypto=require(_0x6461('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6461('0x8'));var querystring=require(_0x6461('0xd'));var Papa=require(_0x6461('0xe'));var Redis=require(_0x6461('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6461('0x10'));var hardwareService=require(_0x6461('0x11'));var logger=require(_0x6461('0x12'))('api');var utils=require(_0x6461('0x13'));var config=require(_0x6461('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x286cb3,_0x3f431d){_0x3f431d=_0x3f431d||0xcc;return function(_0x500c9c){if(_0x500c9c){return _0x286cb3['sendStatus'](_0x3f431d);}return _0x286cb3[_0x6461('0x15')](_0x3f431d)[_0x6461('0x16')]();};}function respondWithResult(_0x38f8d5,_0x3d3428){_0x3d3428=_0x3d3428||0xc8;return function(_0x4486a2){if(_0x4486a2){return _0x38f8d5[_0x6461('0x15')](_0x3d3428)[_0x6461('0x17')](_0x4486a2);}};}function respondWithFilteredResult(_0x113f35,_0x24d0d6){return function(_0x28053f){if(_0x28053f){var _0x286321=typeof _0x24d0d6[_0x6461('0x18')]===_0x6461('0x19')&&typeof _0x24d0d6[_0x6461('0x1a')]===_0x6461('0x19');var _0x49262d=_0x28053f[_0x6461('0x1b')];var _0x2f1336=_0x286321?0x0:_0x24d0d6[_0x6461('0x18')];var _0x43a65e=_0x286321?_0x28053f[_0x6461('0x1b')]:_0x24d0d6[_0x6461('0x18')]+_0x24d0d6['limit'];var _0x400ec3;if(_0x43a65e>=_0x49262d){_0x43a65e=_0x49262d;_0x400ec3=0xc8;}else{_0x400ec3=0xce;}_0x113f35[_0x6461('0x15')](_0x400ec3);return _0x113f35[_0x6461('0x1c')](_0x6461('0x1d'),_0x2f1336+'-'+_0x43a65e+'/'+_0x49262d)['json'](_0x28053f);}return null;};}function patchUpdates(_0x28a6b6){return function(_0x3811b4){try{jsonpatch[_0x6461('0x1e')](_0x3811b4,_0x28a6b6,!![]);}catch(_0x4306ed){return BPromise[_0x6461('0x1f')](_0x4306ed);}return _0x3811b4[_0x6461('0x20')]();};}function saveUpdates(_0x16126b,_0x2dc8fa){return function(_0x14f65d){if(_0x14f65d){return _0x14f65d[_0x6461('0x21')](_0x16126b)[_0x6461('0x22')](function(_0x5a70f8){return _0x5a70f8;});}return null;};}function removeEntity(_0x69b242,_0x3d7474){return function(_0x1a6399){if(_0x1a6399){return _0x1a6399[_0x6461('0x23')]()[_0x6461('0x22')](function(){var _0x5ee379=_0x1a6399[_0x6461('0x24')]({'plain':!![]});var _0x4ea7c2='ODBC';return db[_0x6461('0x25')][_0x6461('0x23')]({'where':{'type':_0x4ea7c2,'resourceId':_0x5ee379['id']}})[_0x6461('0x22')](function(){return _0x1a6399;});})[_0x6461('0x22')](function(){_0x69b242[_0x6461('0x15')](0xcc)[_0x6461('0x16')]();});}};}function handleEntityNotFound(_0x3add77,_0x292db8){return function(_0x1c2cf2){if(!_0x1c2cf2){_0x3add77['sendStatus'](0x194);}return _0x1c2cf2;};}function handleError(_0x373564,_0x38d3ea){_0x38d3ea=_0x38d3ea||0x1f4;return function(_0x5c8d5c){logger[_0x6461('0x26')](_0x5c8d5c[_0x6461('0x27')]);if(_0x5c8d5c[_0x6461('0x28')]){delete _0x5c8d5c[_0x6461('0x28')];}_0x373564['status'](_0x38d3ea)['send'](_0x5c8d5c);};}exports[_0x6461('0x29')]=function(_0x21118c,_0x567202){var _0x12d3ca={},_0x58907e={},_0x19e8e7={'count':0x0,'rows':[]};var _0x383918=_[_0x6461('0x2a')](db[_0x6461('0x2b')][_0x6461('0x2c')],function(_0x1fec57){return{'name':_0x1fec57[_0x6461('0x2d')],'type':_0x1fec57['type']['key']};});_0x58907e[_0x6461('0x2e')]=_['map'](_0x383918,_0x6461('0x28'));_0x58907e[_0x6461('0x2f')]=_[_0x6461('0x30')](_0x21118c[_0x6461('0x2f')]);_0x58907e[_0x6461('0x31')]=_[_0x6461('0x32')](_0x58907e[_0x6461('0x2e')],_0x58907e['query']);_0x12d3ca[_0x6461('0x33')]=_[_0x6461('0x32')](_0x58907e['model'],qs[_0x6461('0x34')](_0x21118c[_0x6461('0x2f')][_0x6461('0x34')]));_0x12d3ca['attributes']=_0x12d3ca[_0x6461('0x33')][_0x6461('0x35')]?_0x12d3ca[_0x6461('0x33')]:_0x58907e[_0x6461('0x2e')];if(!_0x21118c[_0x6461('0x2f')]['hasOwnProperty'](_0x6461('0x36'))){_0x12d3ca[_0x6461('0x1a')]=qs[_0x6461('0x1a')](_0x21118c['query'][_0x6461('0x1a')]);_0x12d3ca[_0x6461('0x18')]=qs[_0x6461('0x18')](_0x21118c[_0x6461('0x2f')][_0x6461('0x18')]);}_0x12d3ca[_0x6461('0x37')]=qs[_0x6461('0x38')](_0x21118c[_0x6461('0x2f')][_0x6461('0x38')]);_0x12d3ca['where']=qs[_0x6461('0x31')](_[_0x6461('0x39')](_0x21118c['query'],_0x58907e[_0x6461('0x31')]),_0x383918);if(_0x21118c[_0x6461('0x2f')][_0x6461('0x3a')]){_0x12d3ca[_0x6461('0x3b')]=_[_0x6461('0x3c')](_0x12d3ca['where'],{'$or':_[_0x6461('0x2a')](_0x383918,function(_0x3b5fc6){if(_0x3b5fc6[_0x6461('0x3d')]!==_0x6461('0x3e')){var _0x41ade9={};_0x41ade9[_0x3b5fc6[_0x6461('0x28')]]={'$like':'%'+_0x21118c[_0x6461('0x2f')][_0x6461('0x3a')]+'%'};return _0x41ade9;}})});}_0x12d3ca=_[_0x6461('0x3c')]({},_0x12d3ca,_0x21118c['options']);var _0x52007e={'where':_0x12d3ca['where']};return db['SquareOdbc'][_0x6461('0x1b')](_0x52007e)['then'](function(_0x31bfd1){_0x19e8e7[_0x6461('0x1b')]=_0x31bfd1;if(_0x21118c[_0x6461('0x2f')][_0x6461('0x3f')]){_0x12d3ca[_0x6461('0x40')]=[{'all':!![]}];}return db[_0x6461('0x2b')]['findAll'](_0x12d3ca);})[_0x6461('0x22')](function(_0x2f3f95){_0x19e8e7['rows']=_0x2f3f95;return _0x19e8e7;})['then'](respondWithFilteredResult(_0x567202,_0x12d3ca))['catch'](handleError(_0x567202,null));};exports[_0x6461('0x41')]=function(_0x5d4001,_0x24428d){var _0x49462a={'raw':!![],'where':{'id':_0x5d4001['params']['id']}},_0x17123a={};_0x17123a[_0x6461('0x2e')]=_[_0x6461('0x30')](db[_0x6461('0x2b')][_0x6461('0x2c')]);_0x17123a[_0x6461('0x2f')]=_[_0x6461('0x30')](_0x5d4001[_0x6461('0x2f')]);_0x17123a[_0x6461('0x31')]=_[_0x6461('0x32')](_0x17123a['model'],_0x17123a[_0x6461('0x2f')]);_0x49462a['attributes']=_[_0x6461('0x32')](_0x17123a[_0x6461('0x2e')],qs[_0x6461('0x34')](_0x5d4001['query'][_0x6461('0x34')]));_0x49462a['attributes']=_0x49462a[_0x6461('0x33')][_0x6461('0x35')]?_0x49462a['attributes']:_0x17123a['model'];if(_0x5d4001[_0x6461('0x2f')][_0x6461('0x3f')]){_0x49462a[_0x6461('0x40')]=[{'all':!![]}];}_0x49462a=_['merge']({},_0x49462a,_0x5d4001['options']);return db[_0x6461('0x2b')][_0x6461('0x42')](_0x49462a)[_0x6461('0x22')](handleEntityNotFound(_0x24428d,null))[_0x6461('0x22')](respondWithResult(_0x24428d,null))[_0x6461('0x43')](handleError(_0x24428d,null));};exports[_0x6461('0x44')]=function(_0xcb8ccc,_0x40e539){return db[_0x6461('0x2b')][_0x6461('0x44')](_0xcb8ccc[_0x6461('0x45')],{})[_0x6461('0x22')](function(_0x40e5f8){var _0x52bd63=_0xcb8ccc['user']['get']({'plain':!![]});if(!_0x52bd63)throw new Error(_0x6461('0x46'));if(_0x52bd63['role']===_0x6461('0x47')){var _0x3e4ebe=_0x40e5f8[_0x6461('0x24')]({'plain':!![]});var _0x106ca4=_0x6461('0x48');return db[_0x6461('0x49')]['find']({'where':{'name':_0x106ca4,'userProfileId':_0x52bd63[_0x6461('0x4a')]},'raw':!![]})[_0x6461('0x22')](function(_0xa55bee){if(_0xa55bee&&_0xa55bee[_0x6461('0x4b')]===0x0){return db[_0x6461('0x25')]['create']({'name':_0x3e4ebe[_0x6461('0x28')],'resourceId':_0x3e4ebe['id'],'type':_0xa55bee[_0x6461('0x28')],'sectionId':_0xa55bee['id']},{})[_0x6461('0x22')](function(){return _0x40e5f8;});}else{return _0x40e5f8;}})[_0x6461('0x43')](function(_0x43cf1f){logger[_0x6461('0x26')](_0x6461('0x4c'),_0x43cf1f);throw _0x43cf1f;});}return _0x40e5f8;})[_0x6461('0x22')](respondWithResult(_0x40e539,0xc9))[_0x6461('0x43')](handleError(_0x40e539,null));};exports[_0x6461('0x21')]=function(_0x291126,_0x69e159){if(_0x291126[_0x6461('0x45')]['id']){delete _0x291126[_0x6461('0x45')]['id'];}return db['SquareOdbc'][_0x6461('0x42')]({'where':{'id':_0x291126['params']['id']}})[_0x6461('0x22')](handleEntityNotFound(_0x69e159,null))[_0x6461('0x22')](saveUpdates(_0x291126['body'],null))[_0x6461('0x22')](respondWithResult(_0x69e159,null))[_0x6461('0x43')](handleError(_0x69e159,null));};exports['destroy']=function(_0x67043e,_0x9c1a6){return db[_0x6461('0x2b')][_0x6461('0x42')]({'where':{'id':_0x67043e[_0x6461('0x4d')]['id']}})['then'](handleEntityNotFound(_0x9c1a6,null))['then'](removeEntity(_0x9c1a6,null))[_0x6461('0x43')](handleError(_0x9c1a6,null));};exports['test']=function(_0x3bb6df,_0x1a709f,_0x598749){var _0x3b4aaa;return db[_0x6461('0x2b')][_0x6461('0x42')]({'where':{'id':_0x3bb6df[_0x6461('0x4d')]['id']},'attributes':['id',_0x6461('0x4e')]})[_0x6461('0x22')](handleEntityNotFound(_0x1a709f,null))[_0x6461('0x22')](function(_0x3ebed1){if(_0x3ebed1){var _0x13ded8=require(_0x6461('0x4f'))();_0x13ded8[_0x6461('0x50')](_0x3ebed1[_0x6461('0x4e')]);_0x13ded8[_0x6461('0x51')]();return _0x3ebed1;}})[_0x6461('0x22')](respondWithResult(_0x1a709f,null))[_0x6461('0x43')](handleError(_0x1a709f,null));}; \ No newline at end of file +var _0x0e53=['fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','get','ODBC','UserProfileResource','end','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e53,0x1ed));var _0x30e5=function(_0x54e826,_0x343cde){_0x54e826=_0x54e826-0x0;var _0x429a6d=_0x0e53[_0x54e826];return _0x429a6d;};'use strict';var emlformat=require(_0x30e5('0x0'));var rimraf=require(_0x30e5('0x1'));var zipdir=require(_0x30e5('0x2'));var jsonpatch=require(_0x30e5('0x3'));var rp=require(_0x30e5('0x4'));var moment=require(_0x30e5('0x5'));var BPromise=require(_0x30e5('0x6'));var Mustache=require(_0x30e5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x30e5('0x8'));var csv=require(_0x30e5('0x9'));var ejs=require(_0x30e5('0xa'));var fs=require('fs');var fs_extra=require(_0x30e5('0xb'));var _=require('lodash');var squel=require(_0x30e5('0xc'));var crypto=require('crypto');var jsforce=require(_0x30e5('0xd'));var deskjs=require(_0x30e5('0xe'));var toCsv=require(_0x30e5('0x9'));var querystring=require(_0x30e5('0xf'));var Papa=require('papaparse');var Redis=require(_0x30e5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30e5('0x11'));var logger=require(_0x30e5('0x12'))(_0x30e5('0x13'));var utils=require(_0x30e5('0x14'));var config=require(_0x30e5('0x15'));var licenseUtil=require(_0x30e5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345b8e,_0x45fdcc){_0x45fdcc=_0x45fdcc||0xcc;return function(_0x460431){if(_0x460431){return _0x345b8e[_0x30e5('0x17')](_0x45fdcc);}return _0x345b8e['status'](_0x45fdcc)['end']();};}function respondWithResult(_0x2eb0f5,_0x5abac4){_0x5abac4=_0x5abac4||0xc8;return function(_0x1106bd){if(_0x1106bd){return _0x2eb0f5[_0x30e5('0x18')](_0x5abac4)['json'](_0x1106bd);}};}function respondWithFilteredResult(_0x16cd64,_0x11a8cc){return function(_0x40b654){if(_0x40b654){var _0x216d7a=typeof _0x11a8cc[_0x30e5('0x19')]===_0x30e5('0x1a')&&typeof _0x11a8cc[_0x30e5('0x1b')]===_0x30e5('0x1a');var _0xb99b1f=_0x40b654[_0x30e5('0x1c')];var _0x41d6cd=_0x216d7a?0x0:_0x11a8cc[_0x30e5('0x19')];var _0x55e86a=_0x216d7a?_0x40b654[_0x30e5('0x1c')]:_0x11a8cc[_0x30e5('0x19')]+_0x11a8cc[_0x30e5('0x1b')];var _0x4e36e8;if(_0x55e86a>=_0xb99b1f){_0x55e86a=_0xb99b1f;_0x4e36e8=0xc8;}else{_0x4e36e8=0xce;}_0x16cd64[_0x30e5('0x18')](_0x4e36e8);return _0x16cd64[_0x30e5('0x1d')](_0x30e5('0x1e'),_0x41d6cd+'-'+_0x55e86a+'/'+_0xb99b1f)[_0x30e5('0x1f')](_0x40b654);}return null;};}function patchUpdates(_0x503845){return function(_0x29c4b2){try{jsonpatch['apply'](_0x29c4b2,_0x503845,!![]);}catch(_0x5b0f8a){return BPromise['reject'](_0x5b0f8a);}return _0x29c4b2['save']();};}function saveUpdates(_0x3d1e38,_0x547f1e){return function(_0x3c8f5e){if(_0x3c8f5e){return _0x3c8f5e[_0x30e5('0x20')](_0x3d1e38)['then'](function(_0x2318cd){return _0x2318cd;});}return null;};}function removeEntity(_0x368e8f,_0x492cea){return function(_0x451c86){if(_0x451c86){return _0x451c86[_0x30e5('0x21')]()[_0x30e5('0x22')](function(){var _0x1c796a=_0x451c86[_0x30e5('0x23')]({'plain':!![]});var _0x520959=_0x30e5('0x24');return db[_0x30e5('0x25')][_0x30e5('0x21')]({'where':{'type':_0x520959,'resourceId':_0x1c796a['id']}})[_0x30e5('0x22')](function(){return _0x451c86;});})[_0x30e5('0x22')](function(){_0x368e8f[_0x30e5('0x18')](0xcc)[_0x30e5('0x26')]();});}};}function handleEntityNotFound(_0x18de55,_0x57814a){return function(_0x2c3189){if(!_0x2c3189){_0x18de55[_0x30e5('0x17')](0x194);}return _0x2c3189;};}function handleError(_0x2ac76e,_0x296b90){_0x296b90=_0x296b90||0x1f4;return function(_0x84867b){logger['error'](_0x84867b[_0x30e5('0x27')]);if(_0x84867b['name']){delete _0x84867b['name'];}_0x2ac76e[_0x30e5('0x18')](_0x296b90)[_0x30e5('0x28')](_0x84867b);};}exports[_0x30e5('0x29')]=function(_0x3354d3,_0x23130e){var _0x746273={},_0x5b4197={},_0xb8ffcc={'count':0x0,'rows':[]};var _0x327c7c=_[_0x30e5('0x2a')](db[_0x30e5('0x2b')][_0x30e5('0x2c')],function(_0x1c8231){return{'name':_0x1c8231[_0x30e5('0x2d')],'type':_0x1c8231[_0x30e5('0x2e')][_0x30e5('0x2f')]};});_0x5b4197[_0x30e5('0x30')]=_[_0x30e5('0x2a')](_0x327c7c,_0x30e5('0x31'));_0x5b4197[_0x30e5('0x32')]=_[_0x30e5('0x33')](_0x3354d3[_0x30e5('0x32')]);_0x5b4197['filters']=_[_0x30e5('0x34')](_0x5b4197[_0x30e5('0x30')],_0x5b4197['query']);_0x746273[_0x30e5('0x35')]=_[_0x30e5('0x34')](_0x5b4197[_0x30e5('0x30')],qs[_0x30e5('0x36')](_0x3354d3['query'][_0x30e5('0x36')]));_0x746273[_0x30e5('0x35')]=_0x746273[_0x30e5('0x35')][_0x30e5('0x37')]?_0x746273[_0x30e5('0x35')]:_0x5b4197[_0x30e5('0x30')];if(!_0x3354d3[_0x30e5('0x32')]['hasOwnProperty']('nolimit')){_0x746273[_0x30e5('0x1b')]=qs['limit'](_0x3354d3[_0x30e5('0x32')][_0x30e5('0x1b')]);_0x746273[_0x30e5('0x19')]=qs[_0x30e5('0x19')](_0x3354d3['query'][_0x30e5('0x19')]);}_0x746273[_0x30e5('0x38')]=qs['sort'](_0x3354d3[_0x30e5('0x32')]['sort']);_0x746273[_0x30e5('0x39')]=qs[_0x30e5('0x3a')](_[_0x30e5('0x3b')](_0x3354d3[_0x30e5('0x32')],_0x5b4197[_0x30e5('0x3a')]),_0x327c7c);if(_0x3354d3[_0x30e5('0x32')][_0x30e5('0x3c')]){_0x746273['where']=_[_0x30e5('0x3d')](_0x746273[_0x30e5('0x39')],{'$or':_[_0x30e5('0x2a')](_0x327c7c,function(_0x598a3f){if(_0x598a3f['type']!=='VIRTUAL'){var _0x71dfac={};_0x71dfac[_0x598a3f[_0x30e5('0x31')]]={'$like':'%'+_0x3354d3[_0x30e5('0x32')][_0x30e5('0x3c')]+'%'};return _0x71dfac;}})});}_0x746273=_[_0x30e5('0x3d')]({},_0x746273,_0x3354d3[_0x30e5('0x3e')]);var _0x36c363={'where':_0x746273['where']};return db[_0x30e5('0x2b')][_0x30e5('0x1c')](_0x36c363)[_0x30e5('0x22')](function(_0xb8d3f1){_0xb8ffcc['count']=_0xb8d3f1;if(_0x3354d3[_0x30e5('0x32')][_0x30e5('0x3f')]){_0x746273[_0x30e5('0x40')]=[{'all':!![]}];}return db[_0x30e5('0x2b')][_0x30e5('0x41')](_0x746273);})[_0x30e5('0x22')](function(_0x532deb){_0xb8ffcc[_0x30e5('0x42')]=_0x532deb;return _0xb8ffcc;})[_0x30e5('0x22')](respondWithFilteredResult(_0x23130e,_0x746273))[_0x30e5('0x43')](handleError(_0x23130e,null));};exports[_0x30e5('0x44')]=function(_0x4ce180,_0x17521d){var _0x13095d={'raw':!![],'where':{'id':_0x4ce180[_0x30e5('0x45')]['id']}},_0x128339={};_0x128339[_0x30e5('0x30')]=_[_0x30e5('0x33')](db['SquareOdbc'][_0x30e5('0x2c')]);_0x128339[_0x30e5('0x32')]=_[_0x30e5('0x33')](_0x4ce180[_0x30e5('0x32')]);_0x128339[_0x30e5('0x3a')]=_[_0x30e5('0x34')](_0x128339[_0x30e5('0x30')],_0x128339[_0x30e5('0x32')]);_0x13095d[_0x30e5('0x35')]=_[_0x30e5('0x34')](_0x128339['model'],qs['fields'](_0x4ce180['query'][_0x30e5('0x36')]));_0x13095d[_0x30e5('0x35')]=_0x13095d[_0x30e5('0x35')]['length']?_0x13095d[_0x30e5('0x35')]:_0x128339[_0x30e5('0x30')];if(_0x4ce180['query'][_0x30e5('0x3f')]){_0x13095d['include']=[{'all':!![]}];}_0x13095d=_[_0x30e5('0x3d')]({},_0x13095d,_0x4ce180[_0x30e5('0x3e')]);return db[_0x30e5('0x2b')][_0x30e5('0x46')](_0x13095d)[_0x30e5('0x22')](handleEntityNotFound(_0x17521d,null))[_0x30e5('0x22')](respondWithResult(_0x17521d,null))[_0x30e5('0x43')](handleError(_0x17521d,null));};exports['create']=function(_0x1b3b4e,_0x271fe4){return db[_0x30e5('0x2b')][_0x30e5('0x47')](_0x1b3b4e[_0x30e5('0x48')],{})[_0x30e5('0x22')](function(_0x212795){var _0x11c85a=_0x1b3b4e['user'][_0x30e5('0x23')]({'plain':!![]});if(!_0x11c85a)throw new Error(_0x30e5('0x49'));if(_0x11c85a[_0x30e5('0x4a')]===_0x30e5('0x4b')){var _0x29a81f=_0x212795[_0x30e5('0x23')]({'plain':!![]});var _0xb5b198=_0x30e5('0x24');return db[_0x30e5('0x4c')][_0x30e5('0x46')]({'where':{'name':_0xb5b198,'userProfileId':_0x11c85a[_0x30e5('0x4d')]},'raw':!![]})['then'](function(_0x395f99){if(_0x395f99&&_0x395f99[_0x30e5('0x4e')]===0x0){return db[_0x30e5('0x25')][_0x30e5('0x47')]({'name':_0x29a81f[_0x30e5('0x31')],'resourceId':_0x29a81f['id'],'type':_0x395f99['name'],'sectionId':_0x395f99['id']},{})[_0x30e5('0x22')](function(){return _0x212795;});}else{return _0x212795;}})[_0x30e5('0x43')](function(_0x40cda1){logger[_0x30e5('0x4f')](_0x30e5('0x50'),_0x40cda1);throw _0x40cda1;});}return _0x212795;})[_0x30e5('0x22')](respondWithResult(_0x271fe4,0xc9))[_0x30e5('0x43')](handleError(_0x271fe4,null));};exports[_0x30e5('0x20')]=function(_0x34b1d7,_0x1f4c98){if(_0x34b1d7[_0x30e5('0x48')]['id']){delete _0x34b1d7[_0x30e5('0x48')]['id'];}return db[_0x30e5('0x2b')][_0x30e5('0x46')]({'where':{'id':_0x34b1d7[_0x30e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f4c98,null))[_0x30e5('0x22')](saveUpdates(_0x34b1d7[_0x30e5('0x48')],null))[_0x30e5('0x22')](respondWithResult(_0x1f4c98,null))[_0x30e5('0x43')](handleError(_0x1f4c98,null));};exports[_0x30e5('0x21')]=function(_0x3b68d0,_0x37e24b){return db[_0x30e5('0x2b')][_0x30e5('0x46')]({'where':{'id':_0x3b68d0[_0x30e5('0x45')]['id']}})[_0x30e5('0x22')](handleEntityNotFound(_0x37e24b,null))[_0x30e5('0x22')](removeEntity(_0x37e24b,null))[_0x30e5('0x43')](handleError(_0x37e24b,null));};exports['test']=function(_0x43f67f,_0x1202ec,_0x48bcec){var _0x391726;return db[_0x30e5('0x2b')][_0x30e5('0x46')]({'where':{'id':_0x43f67f[_0x30e5('0x45')]['id']},'attributes':['id',_0x30e5('0x51')]})[_0x30e5('0x22')](handleEntityNotFound(_0x1202ec,null))['then'](function(_0x3b0e0f){if(_0x3b0e0f){var _0x45bf8f=require(_0x30e5('0x52'))();_0x45bf8f['openSync'](_0x3b0e0f[_0x30e5('0x51')]);_0x45bf8f[_0x30e5('0x53')]();return _0x3b0e0f;}})[_0x30e5('0x22')](respondWithResult(_0x1202ec,null))[_0x30e5('0x43')](handleError(_0x1202ec,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 03cb5ec..1966c22 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 _0x6fd0=['path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','lodash','util','api'];(function(_0x1438d7,_0x2ab5ce){var _0x40112e=function(_0x361af2){while(--_0x361af2){_0x1438d7['push'](_0x1438d7['shift']());}};_0x40112e(++_0x2ab5ce);}(_0x6fd0,0x11d));var _0x06fd=function(_0x5e8610,_0x3797){_0x5e8610=_0x5e8610-0x0;var _0x436fb5=_0x6fd0[_0x5e8610];return _0x436fb5;};'use strict';var _=require(_0x06fd('0x0'));var util=require(_0x06fd('0x1'));var logger=require('../../config/logger')(_0x06fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x06fd('0x3'));var rimraf=require(_0x06fd('0x4'));var config=require(_0x06fd('0x5'));var attributes=require(_0x06fd('0x6'));module['exports']=function(_0x784695,_0x55e82f){return _0x784695[_0x06fd('0x7')](_0x06fd('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc018=['api','moment','bluebird','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xc018,0x1c5));var _0x8c01=function(_0x5527dd,_0x2389f6){_0x5527dd=_0x5527dd-0x0;var _0x2ffd1b=_0xc018[_0x5527dd];return _0x2ffd1b;};'use strict';var _=require(_0x8c01('0x0'));var util=require(_0x8c01('0x1'));var logger=require(_0x8c01('0x2'))(_0x8c01('0x3'));var moment=require(_0x8c01('0x4'));var BPromise=require(_0x8c01('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c01('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c01('0x7'));module[_0x8c01('0x8')]=function(_0x53a9d,_0x506b29){return _0x53a9d[_0x8c01('0x9')](_0x8c01('0xa'),attributes,{'tableName':_0x8c01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 19c4c32..b07bf4a 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 _0x1a2b=['find','options','where','attributes','include','map','model','then','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x1a2b,0xcf));var _0xb1a2=function(_0x205e83,_0x2df5a4){_0x205e83=_0x205e83-0x0;var _0x10bb19=_0x1a2b[_0x205e83];return _0x10bb19;};'use strict';var _=require('lodash');var util=require(_0xb1a2('0x0'));var moment=require(_0xb1a2('0x1'));var BPromise=require(_0xb1a2('0x2'));var rs=require(_0xb1a2('0x3'));var fs=require('fs');var Redis=require(_0xb1a2('0x4'));var db=require(_0xb1a2('0x5'))['db'];var utils=require(_0xb1a2('0x6'));var logger=require(_0xb1a2('0x7'))(_0xb1a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1a2('0x9'));var client=jayson[_0xb1a2('0xa')][_0xb1a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x531cf3,_0x3ebe60,_0x575511){return new BPromise(function(_0x5104d5,_0x35ba0c){return client[_0xb1a2('0xc')](_0x531cf3,_0x575511)['then'](function(_0x4a1326){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3ebe60,_0xb1a2('0xd'));logger[_0xb1a2('0xe')](_0xb1a2('0xf'),_0x3ebe60,_0xb1a2('0xd'),JSON[_0xb1a2('0x10')](_0x4a1326));if(_0x4a1326[_0xb1a2('0x11')]){if(_0x4a1326[_0xb1a2('0x11')][_0xb1a2('0x12')]===0x1f4){logger[_0xb1a2('0x11')](_0xb1a2('0x13'),_0x3ebe60,_0x4a1326[_0xb1a2('0x11')][_0xb1a2('0x14')]);return _0x35ba0c(_0x4a1326[_0xb1a2('0x11')]['message']);}logger[_0xb1a2('0x11')](_0xb1a2('0x13'),_0x3ebe60,_0x4a1326[_0xb1a2('0x11')][_0xb1a2('0x14')]);return _0x5104d5(_0x4a1326[_0xb1a2('0x11')][_0xb1a2('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3ebe60,'request\x20sent');_0x5104d5(_0x4a1326[_0xb1a2('0x15')]['message']);}})[_0xb1a2('0x16')](function(_0x2692db){logger[_0xb1a2('0x11')](_0xb1a2('0x13'),_0x3ebe60,_0x2692db);_0x35ba0c(_0x2692db);});});}exports[_0xb1a2('0x17')]=function(_0x4634ac){var _0x2779a0=this;return new Promise(function(_0x41cdad,_0x12af04){return db['SquareOdbc'][_0xb1a2('0x18')]({'raw':_0x4634ac[_0xb1a2('0x19')]?_0x4634ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x4634ac[_0xb1a2('0x19')]?_0x4634ac[_0xb1a2('0x19')][_0xb1a2('0x1a')]||null:null,'attributes':_0x4634ac['options']?_0x4634ac[_0xb1a2('0x19')][_0xb1a2('0x1b')]||null:null,'include':_0x4634ac[_0xb1a2('0x19')]?_0x4634ac[_0xb1a2('0x19')][_0xb1a2('0x1c')]?_[_0xb1a2('0x1d')](_0x4634ac[_0xb1a2('0x19')]['include'],function(_0x144f8d){return{'model':db[_0x144f8d['model']],'as':_0x144f8d['as'],'attributes':_0x144f8d[_0xb1a2('0x1b')],'include':_0x144f8d['include']?_[_0xb1a2('0x1d')](_0x144f8d[_0xb1a2('0x1c')],function(_0x1d617e){return{'model':db[_0x1d617e[_0xb1a2('0x1e')]],'as':_0x1d617e['as'],'attributes':_0x1d617e['attributes'],'include':_0x1d617e[_0xb1a2('0x1c')]?_['map'](_0x1d617e['include'],function(_0x1a5193){return{'model':db[_0x1a5193[_0xb1a2('0x1e')]],'as':_0x1a5193['as'],'attributes':_0x1a5193[_0xb1a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb1a2('0x1f')](function(_0x253746){logger[_0xb1a2('0x20')](_0xb1a2('0x17'),_0x4634ac);logger[_0xb1a2('0xe')](_0xb1a2('0x17'),_0x4634ac,JSON[_0xb1a2('0x10')](_0x253746));_0x41cdad(_0x253746);})[_0xb1a2('0x16')](function(_0x34faa0){logger[_0xb1a2('0x11')](_0xb1a2('0x17'),_0x34faa0[_0xb1a2('0x14')],_0x4634ac);_0x12af04(_0x2779a0[_0xb1a2('0x11')](0x1f4,_0x34faa0[_0xb1a2('0x14')]));});});}; \ No newline at end of file +var _0xbda9=['where','attributes','include','model','map','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0xb3c0a3,_0x3b8d54){var _0x32bbbe=function(_0x464021){while(--_0x464021){_0xb3c0a3['push'](_0xb3c0a3['shift']());}};_0x32bbbe(++_0x3b8d54);}(_0xbda9,0x1e6));var _0x9bda=function(_0xbeaec9,_0x35bfa6){_0xbeaec9=_0xbeaec9-0x0;var _0xe88581=_0xbda9[_0xbeaec9];return _0xe88581;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require('moment');var BPromise=require(_0x9bda('0x2'));var rs=require(_0x9bda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bda('0x4'))['db'];var utils=require(_0x9bda('0x5'));var logger=require('../../config/logger')(_0x9bda('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bda('0x7')][_0x9bda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2af339,_0x3bf470,_0x140ace){return new BPromise(function(_0x481ef9,_0x558e80){return client[_0x9bda('0x9')](_0x2af339,_0x140ace)[_0x9bda('0xa')](function(_0xac9baf){logger['info'](_0x9bda('0xb'),_0x3bf470,_0x9bda('0xc'));logger[_0x9bda('0xd')](_0x9bda('0xe'),_0x3bf470,_0x9bda('0xc'),JSON['stringify'](_0xac9baf));if(_0xac9baf[_0x9bda('0xf')]){if(_0xac9baf[_0x9bda('0xf')][_0x9bda('0x10')]===0x1f4){logger['error'](_0x9bda('0xb'),_0x3bf470,_0xac9baf[_0x9bda('0xf')]['message']);return _0x558e80(_0xac9baf[_0x9bda('0xf')][_0x9bda('0x11')]);}logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x3bf470,_0xac9baf[_0x9bda('0xf')]['message']);return _0x481ef9(_0xac9baf[_0x9bda('0xf')][_0x9bda('0x11')]);}else{logger[_0x9bda('0x12')](_0x9bda('0xb'),_0x3bf470,_0x9bda('0xc'));_0x481ef9(_0xac9baf['result'][_0x9bda('0x11')]);}})[_0x9bda('0x13')](function(_0x2d6eb3){logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x3bf470,_0x2d6eb3);_0x558e80(_0x2d6eb3);});});}exports[_0x9bda('0x14')]=function(_0xd6ec19){var _0xeb3cac=this;return new Promise(function(_0x34b103,_0x88f688){return db[_0x9bda('0x15')][_0x9bda('0x16')]({'raw':_0xd6ec19[_0x9bda('0x17')]?_0xd6ec19[_0x9bda('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd6ec19[_0x9bda('0x17')]?_0xd6ec19[_0x9bda('0x17')][_0x9bda('0x18')]||null:null,'attributes':_0xd6ec19[_0x9bda('0x17')]?_0xd6ec19[_0x9bda('0x17')][_0x9bda('0x19')]||null:null,'include':_0xd6ec19[_0x9bda('0x17')]?_0xd6ec19[_0x9bda('0x17')][_0x9bda('0x1a')]?_['map'](_0xd6ec19[_0x9bda('0x17')][_0x9bda('0x1a')],function(_0x1c29aa){return{'model':db[_0x1c29aa[_0x9bda('0x1b')]],'as':_0x1c29aa['as'],'attributes':_0x1c29aa['attributes'],'include':_0x1c29aa['include']?_[_0x9bda('0x1c')](_0x1c29aa['include'],function(_0x4fb806){return{'model':db[_0x4fb806[_0x9bda('0x1b')]],'as':_0x4fb806['as'],'attributes':_0x4fb806[_0x9bda('0x19')],'include':_0x4fb806['include']?_[_0x9bda('0x1c')](_0x4fb806[_0x9bda('0x1a')],function(_0xe3c0c7){return{'model':db[_0xe3c0c7[_0x9bda('0x1b')]],'as':_0xe3c0c7['as'],'attributes':_0xe3c0c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x9bda('0xa')](function(_0x39f13c){logger[_0x9bda('0x12')](_0x9bda('0x14'),_0xd6ec19);logger[_0x9bda('0xd')](_0x9bda('0x14'),_0xd6ec19,JSON[_0x9bda('0x1d')](_0x39f13c));_0x34b103(_0x39f13c);})['catch'](function(_0x307d01){logger[_0x9bda('0xf')](_0x9bda('0x14'),_0x307d01[_0x9bda('0x11')],_0xd6ec19);_0x88f688(_0xeb3cac[_0x9bda('0xf')](0x1f4,_0x307d01[_0x9bda('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5bc67fc..bea7280 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 _0xa3cc=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','update','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x3cea7a,_0x426337){var _0x30d461=function(_0x26ca95){while(--_0x26ca95){_0x3cea7a['push'](_0x3cea7a['shift']());}};_0x30d461(++_0x426337);}(_0xa3cc,0x10b));var _0xca3c=function(_0x127496,_0x4012ef){_0x127496=_0x127496-0x0;var _0x4334f3=_0xa3cc[_0x127496];return _0x4334f3;};'use strict';var multer=require(_0xca3c('0x0'));var util=require('util');var path=require(_0xca3c('0x1'));var timeout=require(_0xca3c('0x2'));var express=require('express');var router=express[_0xca3c('0x3')]();var fs_extra=require(_0xca3c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xca3c('0x5'));var config=require(_0xca3c('0x6'));var controller=require(_0xca3c('0x7'));router[_0xca3c('0x8')]('/',auth[_0xca3c('0x9')](),controller[_0xca3c('0xa')]);router['get'](_0xca3c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xca3c('0xc')]('/',auth['isAuthenticated'](),controller[_0xca3c('0xd')]);router[_0xca3c('0xe')](_0xca3c('0xb'),auth[_0xca3c('0x9')](),controller[_0xca3c('0xf')]);router['delete']('/:id',auth[_0xca3c('0x9')](),controller['destroy']);module[_0xca3c('0x10')]=router; \ No newline at end of file +var _0xef83=['destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','delete'];(function(_0x1a7dae,_0x254ac7){var _0x3068c0=function(_0x4e1800){while(--_0x4e1800){_0x1a7dae['push'](_0x1a7dae['shift']());}};_0x3068c0(++_0x254ac7);}(_0xef83,0xb1));var _0x3ef8=function(_0x1d98da,_0x532964){_0x1d98da=_0x1d98da-0x0;var _0x2a56f2=_0xef83[_0x1d98da];return _0x2a56f2;};'use strict';var multer=require('multer');var util=require(_0x3ef8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ef8('0x1'));var router=express[_0x3ef8('0x2')]();var fs_extra=require(_0x3ef8('0x3'));var auth=require(_0x3ef8('0x4'));var interaction=require(_0x3ef8('0x5'));var config=require(_0x3ef8('0x6'));var controller=require(_0x3ef8('0x7'));router['get']('/',auth[_0x3ef8('0x8')](),controller[_0x3ef8('0x9')]);router[_0x3ef8('0xa')](_0x3ef8('0xb'),auth[_0x3ef8('0x8')](),controller[_0x3ef8('0xc')]);router[_0x3ef8('0xd')]('/',auth[_0x3ef8('0x8')](),controller['create']);router['put'](_0x3ef8('0xb'),auth[_0x3ef8('0x8')](),controller['update']);router[_0x3ef8('0xe')](_0x3ef8('0xb'),auth[_0x3ef8('0x8')](),controller[_0x3ef8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 950cd36..2a5518e 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 _0x6083=['long','production','DATE','sequelize','exports','name','STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x5e6bfa,_0x105b38){var _0x5c94d9=function(_0x140d8b){while(--_0x140d8b){_0x5e6bfa['push'](_0x5e6bfa['shift']());}};_0x5c94d9(++_0x105b38);}(_0x6083,0x9f));var _0x3608=function(_0x29e764,_0x2ab3b5){_0x29e764=_0x29e764-0x0;var _0x343a01=_0x6083[_0x29e764];return _0x343a01;};'use strict';var Sequelize=require(_0x3608('0x0'));module[_0x3608('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3608('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3608('0x3')]},'notes':{'type':Sequelize[_0x3608('0x4')]},'preproduction':{'type':Sequelize[_0x3608('0x5')]('long'),'get':function(){if(this[_0x3608('0x6')](_0x3608('0x7'))){return this[_0x3608('0x6')](_0x3608('0x7'))[_0x3608('0x8')](_0x3608('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x3608('0xa')),'get':function(){if(this[_0x3608('0x6')](_0x3608('0xb'))){return this[_0x3608('0x6')]('production')[_0x3608('0x8')](_0x3608('0x9'));}}},'savedAt':{'type':Sequelize[_0x3608('0xc')]},'publishedAt':{'type':Sequelize[_0x3608('0xc')]}}; \ No newline at end of file +var _0xb2f9=['toString','DATE','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','utf8','long','production'];(function(_0x5a2c0c,_0x2a5a5a){var _0x58fd96=function(_0x19e740){while(--_0x19e740){_0x5a2c0c['push'](_0x5a2c0c['shift']());}};_0x58fd96(++_0x2a5a5a);}(_0xb2f9,0xb6));var _0x9b2f=function(_0x3eb8af,_0x3b2ad5){_0x3eb8af=_0x3eb8af-0x0;var _0x1da593=_0xb2f9[_0x3eb8af];return _0x1da593;};'use strict';var Sequelize=require('sequelize');module[_0x9b2f('0x0')]={'name':{'type':Sequelize[_0x9b2f('0x1')],'unique':_0x9b2f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9b2f('0x1')]},'notes':{'type':Sequelize[_0x9b2f('0x3')]},'preproduction':{'type':Sequelize[_0x9b2f('0x4')]('long'),'get':function(){if(this[_0x9b2f('0x5')](_0x9b2f('0x6'))){return this[_0x9b2f('0x5')]('preproduction')['toString'](_0x9b2f('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x9b2f('0x8')),'get':function(){if(this[_0x9b2f('0x5')]('production')){return this[_0x9b2f('0x5')](_0x9b2f('0x9'))[_0x9b2f('0xa')](_0x9b2f('0x7'));}}},'savedAt':{'type':Sequelize[_0x9b2f('0xb')]},'publishedAt':{'type':Sequelize[_0x9b2f('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1de5d3b..5583c08 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 _0xc129=['publish','agi','end','sendStatus','error','stack','name','send','map','SquareProject','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','findAll','catch','show','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','SquareProjects'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc129,0x12b));var _0x9c12=function(_0x528d4f,_0x19b4f9){_0x528d4f=_0x528d4f-0x0;var _0x3df605=_0xc129[_0x528d4f];return _0x3df605;};'use strict';var _=require('lodash');var Redis=require(_0x9c12('0x0'));var qs=require(_0x9c12('0x1'));var logger=require(_0x9c12('0x2'))(_0x9c12('0x3'));var config=require(_0x9c12('0x4'));var db=require('../../mysqldb')['db'];config[_0x9c12('0x5')]=_[_0x9c12('0x6')](config['redis'],{'host':_0x9c12('0x7'),'port':0x18eb});var socket=require(_0x9c12('0x8'))(new Redis(config[_0x9c12('0x5')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x9ebc16,_0x22eb49){_0x22eb49=_0x22eb49||0xc8;return function(_0x21627e){if(_0x21627e){return _0x9ebc16[_0x9c12('0x9')](_0x22eb49)[_0x9c12('0xa')](_0x21627e);}};}function respondWithFilteredResult(_0x52abce,_0x58b789){return function(_0x129555){if(_0x129555){var _0x3c317f=typeof _0x58b789['offset']===_0x9c12('0xb')&&typeof _0x58b789[_0x9c12('0xc')]===_0x9c12('0xb');var _0x323ec0=_0x129555[_0x9c12('0xd')];var _0x4a31c0=_0x3c317f?0x0:_0x58b789[_0x9c12('0xe')];var _0x4d3f12=_0x3c317f?_0x129555[_0x9c12('0xd')]:_0x58b789[_0x9c12('0xe')]+_0x58b789[_0x9c12('0xc')];var _0x4d7be8;if(_0x4d3f12>=_0x323ec0){_0x4d3f12=_0x323ec0;_0x4d7be8=0xc8;}else{_0x4d7be8=0xce;}_0x52abce[_0x9c12('0x9')](_0x4d7be8);return _0x52abce['set'](_0x9c12('0xf'),_0x4a31c0+'-'+_0x4d3f12+'/'+_0x323ec0)[_0x9c12('0xa')](_0x129555);}return null;};}function saveUpdates(_0x4a1b56){return function(_0x5b6dea){if(_0x5b6dea){return _0x5b6dea[_0x9c12('0x10')](_0x4a1b56)[_0x9c12('0x11')](function(_0x15cc87){return _0x15cc87;});}return null;};}function removeEntity(_0x57e3d1){return function(_0x139c74){if(_0x139c74){return _0x139c74[_0x9c12('0x12')]()[_0x9c12('0x11')](function(){var _0xef9256=_0x139c74[_0x9c12('0x13')]({'plain':!![]});var _0x405b37=_0x9c12('0x14');return db['UserProfileResource'][_0x9c12('0x12')]({'where':{'type':_0x405b37,'resourceId':_0xef9256['id']}})[_0x9c12('0x11')](function(){return _0x139c74;});})[_0x9c12('0x11')](function(){var _0x5e5c59=new Redis(config['redis']);_0x5e5c59[_0x9c12('0x15')](_0x9c12('0x16'),JSON['stringify']({'id':_0x139c74['id'],'deleted':!![]}));})[_0x9c12('0x11')](function(){_0x57e3d1['status'](0xcc)[_0x9c12('0x17')]();});}};}function handleEntityNotFound(_0x1f5874){return function(_0x179598){if(!_0x179598){_0x1f5874[_0x9c12('0x18')](0x194);}return _0x179598;};}function handleError(_0x300f9f,_0x4881d1){_0x4881d1=_0x4881d1||0x1f4;return function(_0x422c3f){logger[_0x9c12('0x19')](_0x422c3f[_0x9c12('0x1a')]);if(_0x422c3f['name']){delete _0x422c3f[_0x9c12('0x1b')];}_0x300f9f[_0x9c12('0x9')](_0x4881d1)[_0x9c12('0x1c')](_0x422c3f);};}exports['index']=function(_0x3f3c49,_0x52dad7){var _0x125fa3={},_0x6063f={},_0x59df2f={'count':0x0,'rows':[]};var _0x30ec01=_[_0x9c12('0x1d')](db[_0x9c12('0x1e')]['rawAttributes'],function(_0x5dd829){return{'name':_0x5dd829[_0x9c12('0x1f')],'type':_0x5dd829[_0x9c12('0x20')][_0x9c12('0x21')]};});_0x6063f[_0x9c12('0x22')]=_[_0x9c12('0x1d')](_0x30ec01,'name');_0x6063f['query']=_[_0x9c12('0x23')](_0x3f3c49[_0x9c12('0x24')]);_0x6063f[_0x9c12('0x25')]=_[_0x9c12('0x26')](_0x6063f[_0x9c12('0x22')],_0x6063f[_0x9c12('0x24')]);_0x125fa3[_0x9c12('0x27')]=_[_0x9c12('0x26')](_0x6063f['model'],qs[_0x9c12('0x28')](_0x3f3c49['query'][_0x9c12('0x28')]));_0x125fa3[_0x9c12('0x27')]=_0x125fa3['attributes'][_0x9c12('0x29')]?_0x125fa3[_0x9c12('0x27')]:_0x6063f[_0x9c12('0x22')];if(!_0x3f3c49[_0x9c12('0x24')][_0x9c12('0x2a')]('nolimit')){_0x125fa3[_0x9c12('0xc')]=qs[_0x9c12('0xc')](_0x3f3c49[_0x9c12('0x24')][_0x9c12('0xc')]);_0x125fa3[_0x9c12('0xe')]=qs[_0x9c12('0xe')](_0x3f3c49[_0x9c12('0x24')][_0x9c12('0xe')]);}_0x125fa3[_0x9c12('0x2b')]=qs[_0x9c12('0x2c')](_0x3f3c49[_0x9c12('0x24')][_0x9c12('0x2c')]);_0x125fa3['where']=qs['filters'](_[_0x9c12('0x2d')](_0x3f3c49[_0x9c12('0x24')],_0x6063f[_0x9c12('0x25')]),_0x30ec01);if(_0x3f3c49[_0x9c12('0x24')]['filter']){_0x125fa3[_0x9c12('0x2e')]=_[_0x9c12('0x2f')](_0x125fa3[_0x9c12('0x2e')],{'$or':_['map'](_0x30ec01,function(_0x56b836){if(_0x56b836[_0x9c12('0x20')]!==_0x9c12('0x30')){var _0x45201f={};_0x45201f[_0x56b836[_0x9c12('0x1b')]]={'$like':'%'+_0x3f3c49[_0x9c12('0x24')][_0x9c12('0x31')]+'%'};return _0x45201f;}})});}_0x125fa3=_[_0x9c12('0x2f')]({},_0x125fa3,_0x3f3c49['options']);var _0x2e7e32={'where':_0x125fa3['where']};return db[_0x9c12('0x1e')][_0x9c12('0xd')](_0x2e7e32)[_0x9c12('0x11')](function(_0x4adddf){_0x59df2f[_0x9c12('0xd')]=_0x4adddf;if(_0x3f3c49[_0x9c12('0x24')]['includeAll']){_0x125fa3['include']=[{'all':!![]}];}return db[_0x9c12('0x1e')][_0x9c12('0x32')](_0x125fa3);})[_0x9c12('0x11')](function(_0xdbd5ec){_0x59df2f['rows']=_0xdbd5ec;return _0x59df2f;})[_0x9c12('0x11')](respondWithFilteredResult(_0x52dad7,_0x125fa3))[_0x9c12('0x33')](handleError(_0x52dad7,null));};exports[_0x9c12('0x34')]=function(_0x1afa89,_0x1d072b){var _0x5add74={'raw':![],'where':{'id':_0x1afa89['params']['id']}},_0x4d487c={};_0x4d487c['model']=_[_0x9c12('0x23')](db[_0x9c12('0x1e')]['rawAttributes']);_0x4d487c[_0x9c12('0x24')]=_['keys'](_0x1afa89[_0x9c12('0x24')]);_0x4d487c[_0x9c12('0x25')]=_['intersection'](_0x4d487c[_0x9c12('0x22')],_0x4d487c[_0x9c12('0x24')]);_0x5add74['attributes']=_[_0x9c12('0x26')](_0x4d487c['model'],qs[_0x9c12('0x28')](_0x1afa89[_0x9c12('0x24')][_0x9c12('0x28')]));_0x5add74['attributes']=_0x5add74[_0x9c12('0x27')][_0x9c12('0x29')]?_0x5add74[_0x9c12('0x27')]:_0x4d487c[_0x9c12('0x22')];if(_0x1afa89[_0x9c12('0x24')]['includeAll']){_0x5add74['include']=[{'all':!![]}];}_0x5add74=_[_0x9c12('0x2f')]({},_0x5add74,_0x1afa89[_0x9c12('0x35')]);return db[_0x9c12('0x1e')][_0x9c12('0x36')](_0x5add74)[_0x9c12('0x11')](handleEntityNotFound(_0x1d072b,null))[_0x9c12('0x11')](respondWithResult(_0x1d072b,null))[_0x9c12('0x33')](handleError(_0x1d072b,null));};exports[_0x9c12('0x37')]=function(_0x49aeea,_0x2ab569){return db[_0x9c12('0x1e')][_0x9c12('0x37')](_0x49aeea[_0x9c12('0x38')],{})['then'](function(_0x1a9ce6){var _0x5c0ee6=_0x49aeea[_0x9c12('0x39')]['get']({'plain':!![]});if(!_0x5c0ee6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c0ee6['role']===_0x9c12('0x39')){var _0x99c7a7=_0x1a9ce6[_0x9c12('0x13')]({'plain':!![]});var _0xf6b96a=_0x9c12('0x14');return db[_0x9c12('0x3a')][_0x9c12('0x36')]({'where':{'name':_0xf6b96a,'userProfileId':_0x5c0ee6[_0x9c12('0x3b')]},'raw':!![]})[_0x9c12('0x11')](function(_0x4c7794){if(_0x4c7794&&_0x4c7794[_0x9c12('0x3c')]===0x0){return db[_0x9c12('0x3d')][_0x9c12('0x37')]({'name':_0x99c7a7[_0x9c12('0x1b')],'resourceId':_0x99c7a7['id'],'type':_0x4c7794[_0x9c12('0x1b')],'sectionId':_0x4c7794['id']},{})[_0x9c12('0x11')](function(){return _0x1a9ce6;});}else{return _0x1a9ce6;}})[_0x9c12('0x33')](function(_0x3624cf){logger[_0x9c12('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3624cf);throw _0x3624cf;});}return _0x1a9ce6;})['then'](respondWithResult(_0x2ab569,0xc9))[_0x9c12('0x33')](handleError(_0x2ab569,null));};exports[_0x9c12('0x10')]=function(_0x30da79,_0x4de1c6){if(_0x30da79[_0x9c12('0x38')]['id']){delete _0x30da79[_0x9c12('0x38')]['id'];}return db[_0x9c12('0x1e')][_0x9c12('0x36')]({'where':{'id':_0x30da79[_0x9c12('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4de1c6,null))['then'](saveUpdates(_0x30da79['body'],null))[_0x9c12('0x11')](function(_0x507402){if(!_0x507402)return;var _0x5279cd=_0x507402[_0x9c12('0x13')]({'plain':!![]});return _0x5279cd;})[_0x9c12('0x11')](function(_0x26aa38){var _0x52070f=new Redis(config['redis']);_0x52070f[_0x9c12('0x15')]('agi',JSON['stringify'](_[_0x9c12('0x2d')](_0x26aa38,['id',_0x9c12('0x1b'),_0x9c12('0x3f')])));return _0x26aa38;})[_0x9c12('0x11')](respondWithResult(_0x4de1c6,null))['catch'](handleError(_0x4de1c6,null));};exports['destroy']=function(_0x1abce2,_0xf73342){return db[_0x9c12('0x1e')]['find']({'where':{'id':_0x1abce2['params']['id']}})[_0x9c12('0x11')](handleEntityNotFound(_0xf73342,null))[_0x9c12('0x11')](removeEntity(_0xf73342,null))['catch'](handleError(_0xf73342,null));}; \ No newline at end of file +var _0x8765=['name','send','index','map','SquareProject','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','stringify','production','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','offset','limit','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','end','error'];(function(_0x513dab,_0x1ee018){var _0x3e92d3=function(_0x3cc4ac){while(--_0x3cc4ac){_0x513dab['push'](_0x513dab['shift']());}};_0x3e92d3(++_0x1ee018);}(_0x8765,0x6e));var _0x5876=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x8765[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var Redis=require(_0x5876('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x5876('0x1'))(_0x5876('0x2'));var config=require(_0x5876('0x3'));var db=require(_0x5876('0x4'))['db'];config['redis']=_[_0x5876('0x5')](config[_0x5876('0x6')],{'host':_0x5876('0x7'),'port':0x18eb});var socket=require(_0x5876('0x8'))(new Redis(config[_0x5876('0x6')]));require(_0x5876('0x9'))[_0x5876('0xa')](socket);function respondWithResult(_0x4ae19d,_0x25a447){_0x25a447=_0x25a447||0xc8;return function(_0x5b1382){if(_0x5b1382){return _0x4ae19d[_0x5876('0xb')](_0x25a447)[_0x5876('0xc')](_0x5b1382);}};}function respondWithFilteredResult(_0x48259d,_0x1d3356){return function(_0x9be94){if(_0x9be94){var _0x1dfe1d=typeof _0x1d3356['offset']===_0x5876('0xd')&&typeof _0x1d3356['limit']==='undefined';var _0x205dd6=_0x9be94['count'];var _0x3375af=_0x1dfe1d?0x0:_0x1d3356[_0x5876('0xe')];var _0x3c3bbe=_0x1dfe1d?_0x9be94['count']:_0x1d3356[_0x5876('0xe')]+_0x1d3356[_0x5876('0xf')];var _0x4d0582;if(_0x3c3bbe>=_0x205dd6){_0x3c3bbe=_0x205dd6;_0x4d0582=0xc8;}else{_0x4d0582=0xce;}_0x48259d[_0x5876('0xb')](_0x4d0582);return _0x48259d[_0x5876('0x10')](_0x5876('0x11'),_0x3375af+'-'+_0x3c3bbe+'/'+_0x205dd6)['json'](_0x9be94);}return null;};}function saveUpdates(_0x3ea69f){return function(_0x1add76){if(_0x1add76){return _0x1add76[_0x5876('0x12')](_0x3ea69f)[_0x5876('0x13')](function(_0x24b7c8){return _0x24b7c8;});}return null;};}function removeEntity(_0x4edbca){return function(_0x22bb3){if(_0x22bb3){return _0x22bb3[_0x5876('0x14')]()[_0x5876('0x13')](function(){var _0x534e7b=_0x22bb3[_0x5876('0x15')]({'plain':!![]});var _0x8be921=_0x5876('0x16');return db[_0x5876('0x17')][_0x5876('0x14')]({'where':{'type':_0x8be921,'resourceId':_0x534e7b['id']}})[_0x5876('0x13')](function(){return _0x22bb3;});})['then'](function(){var _0x237dd2=new Redis(config['redis']);_0x237dd2[_0x5876('0x18')](_0x5876('0x19'),JSON['stringify']({'id':_0x22bb3['id'],'deleted':!![]}));})[_0x5876('0x13')](function(){_0x4edbca[_0x5876('0xb')](0xcc)[_0x5876('0x1a')]();});}};}function handleEntityNotFound(_0xdcf6ef){return function(_0x2b9343){if(!_0x2b9343){_0xdcf6ef['sendStatus'](0x194);}return _0x2b9343;};}function handleError(_0x50e9aa,_0x1c5984){_0x1c5984=_0x1c5984||0x1f4;return function(_0x37d283){logger[_0x5876('0x1b')](_0x37d283['stack']);if(_0x37d283['name']){delete _0x37d283[_0x5876('0x1c')];}_0x50e9aa['status'](_0x1c5984)[_0x5876('0x1d')](_0x37d283);};}exports[_0x5876('0x1e')]=function(_0x155d1c,_0x2a0b43){var _0x218cfa={},_0x565a20={},_0x1a9117={'count':0x0,'rows':[]};var _0x480b00=_[_0x5876('0x1f')](db[_0x5876('0x20')]['rawAttributes'],function(_0x2da9b3){return{'name':_0x2da9b3['fieldName'],'type':_0x2da9b3[_0x5876('0x21')]['key']};});_0x565a20[_0x5876('0x22')]=_[_0x5876('0x1f')](_0x480b00,_0x5876('0x1c'));_0x565a20[_0x5876('0x23')]=_[_0x5876('0x24')](_0x155d1c[_0x5876('0x23')]);_0x565a20['filters']=_[_0x5876('0x25')](_0x565a20[_0x5876('0x22')],_0x565a20['query']);_0x218cfa[_0x5876('0x26')]=_[_0x5876('0x25')](_0x565a20[_0x5876('0x22')],qs['fields'](_0x155d1c[_0x5876('0x23')][_0x5876('0x27')]));_0x218cfa['attributes']=_0x218cfa[_0x5876('0x26')]['length']?_0x218cfa[_0x5876('0x26')]:_0x565a20['model'];if(!_0x155d1c[_0x5876('0x23')][_0x5876('0x28')](_0x5876('0x29'))){_0x218cfa[_0x5876('0xf')]=qs[_0x5876('0xf')](_0x155d1c['query'][_0x5876('0xf')]);_0x218cfa[_0x5876('0xe')]=qs['offset'](_0x155d1c[_0x5876('0x23')][_0x5876('0xe')]);}_0x218cfa[_0x5876('0x2a')]=qs[_0x5876('0x2b')](_0x155d1c[_0x5876('0x23')][_0x5876('0x2b')]);_0x218cfa[_0x5876('0x2c')]=qs[_0x5876('0x2d')](_[_0x5876('0x2e')](_0x155d1c['query'],_0x565a20['filters']),_0x480b00);if(_0x155d1c[_0x5876('0x23')]['filter']){_0x218cfa[_0x5876('0x2c')]=_[_0x5876('0x2f')](_0x218cfa['where'],{'$or':_[_0x5876('0x1f')](_0x480b00,function(_0x4fe9c2){if(_0x4fe9c2[_0x5876('0x21')]!==_0x5876('0x30')){var _0x49287b={};_0x49287b[_0x4fe9c2[_0x5876('0x1c')]]={'$like':'%'+_0x155d1c['query']['filter']+'%'};return _0x49287b;}})});}_0x218cfa=_[_0x5876('0x2f')]({},_0x218cfa,_0x155d1c[_0x5876('0x31')]);var _0x476490={'where':_0x218cfa['where']};return db[_0x5876('0x20')][_0x5876('0x32')](_0x476490)[_0x5876('0x13')](function(_0x142240){_0x1a9117[_0x5876('0x32')]=_0x142240;if(_0x155d1c[_0x5876('0x23')][_0x5876('0x33')]){_0x218cfa[_0x5876('0x34')]=[{'all':!![]}];}return db[_0x5876('0x20')][_0x5876('0x35')](_0x218cfa);})[_0x5876('0x13')](function(_0x53bba5){_0x1a9117[_0x5876('0x36')]=_0x53bba5;return _0x1a9117;})[_0x5876('0x13')](respondWithFilteredResult(_0x2a0b43,_0x218cfa))['catch'](handleError(_0x2a0b43,null));};exports['show']=function(_0x477d3e,_0x4fdd1e){var _0x24a3a2={'raw':![],'where':{'id':_0x477d3e[_0x5876('0x37')]['id']}},_0x21ab5={};_0x21ab5[_0x5876('0x22')]=_[_0x5876('0x24')](db[_0x5876('0x20')][_0x5876('0x38')]);_0x21ab5[_0x5876('0x23')]=_[_0x5876('0x24')](_0x477d3e['query']);_0x21ab5[_0x5876('0x2d')]=_['intersection'](_0x21ab5[_0x5876('0x22')],_0x21ab5[_0x5876('0x23')]);_0x24a3a2[_0x5876('0x26')]=_[_0x5876('0x25')](_0x21ab5[_0x5876('0x22')],qs[_0x5876('0x27')](_0x477d3e[_0x5876('0x23')][_0x5876('0x27')]));_0x24a3a2[_0x5876('0x26')]=_0x24a3a2[_0x5876('0x26')][_0x5876('0x39')]?_0x24a3a2[_0x5876('0x26')]:_0x21ab5[_0x5876('0x22')];if(_0x477d3e[_0x5876('0x23')][_0x5876('0x33')]){_0x24a3a2[_0x5876('0x34')]=[{'all':!![]}];}_0x24a3a2=_[_0x5876('0x2f')]({},_0x24a3a2,_0x477d3e[_0x5876('0x31')]);return db[_0x5876('0x20')][_0x5876('0x3a')](_0x24a3a2)['then'](handleEntityNotFound(_0x4fdd1e,null))[_0x5876('0x13')](respondWithResult(_0x4fdd1e,null))['catch'](handleError(_0x4fdd1e,null));};exports[_0x5876('0x3b')]=function(_0x576cdd,_0x21afa6){return db[_0x5876('0x20')][_0x5876('0x3b')](_0x576cdd[_0x5876('0x3c')],{})[_0x5876('0x13')](function(_0x5a683c){var _0x561af7=_0x576cdd[_0x5876('0x3d')]['get']({'plain':!![]});if(!_0x561af7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x561af7['role']==='user'){var _0x56068=_0x5a683c[_0x5876('0x15')]({'plain':!![]});var _0x33808b='SquareProjects';return db[_0x5876('0x3e')][_0x5876('0x3a')]({'where':{'name':_0x33808b,'userProfileId':_0x561af7[_0x5876('0x3f')]},'raw':!![]})['then'](function(_0x15087f){if(_0x15087f&&_0x15087f[_0x5876('0x40')]===0x0){return db[_0x5876('0x17')][_0x5876('0x3b')]({'name':_0x56068[_0x5876('0x1c')],'resourceId':_0x56068['id'],'type':_0x15087f['name'],'sectionId':_0x15087f['id']},{})[_0x5876('0x13')](function(){return _0x5a683c;});}else{return _0x5a683c;}})['catch'](function(_0x1043b1){logger[_0x5876('0x1b')](_0x5876('0x41'),_0x1043b1);throw _0x1043b1;});}return _0x5a683c;})['then'](respondWithResult(_0x21afa6,0xc9))[_0x5876('0x42')](handleError(_0x21afa6,null));};exports['update']=function(_0x568b4a,_0x5d2a5b){if(_0x568b4a[_0x5876('0x3c')]['id']){delete _0x568b4a[_0x5876('0x3c')]['id'];}return db['SquareProject'][_0x5876('0x3a')]({'where':{'id':_0x568b4a['params']['id']}})[_0x5876('0x13')](handleEntityNotFound(_0x5d2a5b,null))[_0x5876('0x13')](saveUpdates(_0x568b4a[_0x5876('0x3c')],null))[_0x5876('0x13')](function(_0x3c700b){if(!_0x3c700b)return;var _0x18f7ff=_0x3c700b['get']({'plain':!![]});return _0x18f7ff;})[_0x5876('0x13')](function(_0x28111d){var _0x31e70e=new Redis(config[_0x5876('0x6')]);_0x31e70e[_0x5876('0x18')](_0x5876('0x19'),JSON[_0x5876('0x43')](_[_0x5876('0x2e')](_0x28111d,['id',_0x5876('0x1c'),_0x5876('0x44')])));return _0x28111d;})['then'](respondWithResult(_0x5d2a5b,null))[_0x5876('0x42')](handleError(_0x5d2a5b,null));};exports[_0x5876('0x14')]=function(_0x2ec72b,_0x299502){return db[_0x5876('0x20')][_0x5876('0x3a')]({'where':{'id':_0x2ec72b[_0x5876('0x37')]['id']}})[_0x5876('0x13')](handleEntityNotFound(_0x299502,null))['then'](removeEntity(_0x299502,null))['catch'](handleError(_0x299502,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a4b8744..8439986 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 _0x81b1=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x81b1,0x1cf));var _0x181b=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0x81b1[_0x1f530d];return _0x22103f;};'use strict';var EventEmitter=require(_0x181b('0x0'));var SquareProject=require(_0x181b('0x1'))['db'][_0x181b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x181b('0x3'),'afterUpdate':_0x181b('0x4'),'afterDestroy':_0x181b('0x5')};function emitEvent(_0x257056){return function(_0x2b8150,_0x59fa5c,_0x100eea){SquareProjectEvents['emit'](_0x257056+':'+_0x2b8150['id'],_0x2b8150);SquareProjectEvents[_0x181b('0x6')](_0x257056,_0x2b8150);_0x100eea(null);};}for(var e in events){if(events[_0x181b('0x7')](e)){var event=events[e];SquareProject[_0x181b('0x8')](e,emitEvent(event));}}module[_0x181b('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xaa7d=['exports','../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4e5f5d,_0x44412c){var _0x391424=function(_0x55c26d){while(--_0x55c26d){_0x4e5f5d['push'](_0x4e5f5d['shift']());}};_0x391424(++_0x44412c);}(_0xaa7d,0x133));var _0xdaa7=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xaa7d[_0x5cb1af];return _0x8d7940;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xdaa7('0x0'))['db'][_0xdaa7('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdaa7('0x2'),'afterUpdate':_0xdaa7('0x3'),'afterDestroy':_0xdaa7('0x4')};function emitEvent(_0x400801){return function(_0x873934,_0x186724,_0x4be6da){SquareProjectEvents[_0xdaa7('0x5')](_0x400801+':'+_0x873934['id'],_0x873934);SquareProjectEvents['emit'](_0x400801,_0x873934);_0x4be6da(null);};}for(var e in events){if(events[_0xdaa7('0x6')](e)){var event=events[e];SquareProject[_0xdaa7('0x7')](e,emitEvent(event));}}module[_0xdaa7('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 a485907..355897d 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 _0x2509=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2509,0x19c));var _0x9250=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0x2509[_0x37d718];return _0x1b650a;};'use strict';var _=require(_0x9250('0x0'));var util=require(_0x9250('0x1'));var logger=require(_0x9250('0x2'))(_0x9250('0x3'));var moment=require(_0x9250('0x4'));var BPromise=require(_0x9250('0x5'));var rp=require(_0x9250('0x6'));var fs=require('fs');var path=require(_0x9250('0x7'));var rimraf=require(_0x9250('0x8'));var config=require(_0x9250('0x9'));var attributes=require(_0x9250('0xa'));module[_0x9250('0xb')]=function(_0x2b3a95,_0x44880e){return _0x2b3a95[_0x9250('0xc')](_0x9250('0xd'),attributes,{'tableName':_0x9250('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x572fac,_0x4f6ea6,_0x22dcea){if(_0x572fac[_0x9250('0xf')](_0x9250('0x10'))){_0x572fac[_0x9250('0x11')]=moment()['format'](_0x9250('0x12'));}if(_0x572fac[_0x9250('0xf')]('production')){_0x572fac['publishedAt']=moment()[_0x9250('0x13')](_0x9250('0x12'));}_0x22dcea(null,_0x572fac);}}});}; \ No newline at end of file +var _0xaed8=['format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaed8,0x7b));var _0x8aed=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0xaed8[_0x57d370];return _0x550fd2;};'use strict';var _=require(_0x8aed('0x0'));var util=require(_0x8aed('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8aed('0x2'));var fs=require('fs');var path=require(_0x8aed('0x3'));var rimraf=require(_0x8aed('0x4'));var config=require(_0x8aed('0x5'));var attributes=require(_0x8aed('0x6'));module[_0x8aed('0x7')]=function(_0x3b2cbf,_0x5671c4){return _0x3b2cbf['define'](_0x8aed('0x8'),attributes,{'tableName':_0x8aed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b4b87,_0xd996be,_0x85d6be){if(_0x2b4b87[_0x8aed('0xa')]('preproduction')){_0x2b4b87[_0x8aed('0xb')]=moment()[_0x8aed('0xc')](_0x8aed('0xd'));}if(_0x2b4b87[_0x8aed('0xa')]('production')){_0x2b4b87[_0x8aed('0xe')]=moment()[_0x8aed('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x85d6be(null,_0x2b4b87);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 94f4b0a..3731385 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 _0xbc51=['findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','find','raw','ShowSquareProject','ioredis','../../config/logger','../../config/environment','defaults','redis','./squareProject.socket','GetSquareProjects','SquareProject'];(function(_0x45baf7,_0x46ce25){var _0x2a4a93=function(_0x4ba470){while(--_0x4ba470){_0x45baf7['push'](_0x45baf7['shift']());}};_0x2a4a93(++_0x46ce25);}(_0xbc51,0x1e6));var _0x1bc5=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xbc51[_0x291d3f];return _0x242080;};'use strict';var _=require('lodash');var Redis=require(_0x1bc5('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x1bc5('0x1'))('rpc');var config=require(_0x1bc5('0x2'));config['redis']=_[_0x1bc5('0x3')](config[_0x1bc5('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bc5('0x4')]));require(_0x1bc5('0x5'))['register'](socket);exports[_0x1bc5('0x6')]=function(_0xa7dfaa){var _0x59cb07=this;return new Promise(function(_0x5028b9,_0x4cd07f){return db[_0x1bc5('0x7')][_0x1bc5('0x8')]({'raw':_0xa7dfaa[_0x1bc5('0x9')]?_0xa7dfaa['options']['raw']===undefined?!![]:![]:!![],'where':_0xa7dfaa[_0x1bc5('0x9')]?_0xa7dfaa['options'][_0x1bc5('0xa')]||null:null,'attributes':_0xa7dfaa[_0x1bc5('0x9')]?_0xa7dfaa['options'][_0x1bc5('0xb')]||null:null,'limit':_0xa7dfaa[_0x1bc5('0x9')]?_0xa7dfaa[_0x1bc5('0x9')][_0x1bc5('0xc')]||null:null,'include':_0xa7dfaa[_0x1bc5('0x9')]?_0xa7dfaa[_0x1bc5('0x9')][_0x1bc5('0xd')]?_[_0x1bc5('0xe')](_0xa7dfaa[_0x1bc5('0x9')][_0x1bc5('0xd')],function(_0xb11c7e){return{'model':db[_0xb11c7e[_0x1bc5('0xf')]],'as':_0xb11c7e['as'],'attributes':_0xb11c7e[_0x1bc5('0xb')],'include':_0xb11c7e[_0x1bc5('0xd')]?_[_0x1bc5('0xe')](_0xb11c7e['include'],function(_0x166e31){return{'model':db[_0x166e31['model']],'as':_0x166e31['as'],'attributes':_0x166e31[_0x1bc5('0xb')],'include':_0x166e31[_0x1bc5('0xd')]?_['map'](_0x166e31[_0x1bc5('0xd')],function(_0x30e48b){return{'model':db[_0x30e48b[_0x1bc5('0xf')]],'as':_0x30e48b['as'],'attributes':_0x30e48b[_0x1bc5('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1bc5('0x10')](function(_0x1a88e9){logger[_0x1bc5('0x11')](_0x1bc5('0x6'),_0xa7dfaa);logger[_0x1bc5('0x12')](_0x1bc5('0x6'),_0xa7dfaa,JSON[_0x1bc5('0x13')](_0x1a88e9));_0x5028b9(_0x1a88e9);})[_0x1bc5('0x14')](function(_0x540a6e){logger[_0x1bc5('0x15')](_0x1bc5('0x6'),_0x540a6e[_0x1bc5('0x16')],_0xa7dfaa);_0x4cd07f(_0x59cb07[_0x1bc5('0x15')](0x1f4,_0x540a6e[_0x1bc5('0x16')]));});});};exports['ShowSquareProject']=function(_0x490e2a){var _0x11ef7d=this;return new Promise(function(_0x3163c9,_0x165b4f){return db[_0x1bc5('0x7')][_0x1bc5('0x17')]({'raw':_0x490e2a['options']?_0x490e2a[_0x1bc5('0x9')][_0x1bc5('0x18')]===undefined?!![]:![]:!![],'where':_0x490e2a[_0x1bc5('0x9')]?_0x490e2a[_0x1bc5('0x9')][_0x1bc5('0xa')]||null:null,'attributes':_0x490e2a[_0x1bc5('0x9')]?_0x490e2a['options']['attributes']||null:null,'include':_0x490e2a[_0x1bc5('0x9')]?_0x490e2a[_0x1bc5('0x9')]['include']?_[_0x1bc5('0xe')](_0x490e2a[_0x1bc5('0x9')][_0x1bc5('0xd')],function(_0x3ed350){return{'model':db[_0x3ed350[_0x1bc5('0xf')]],'as':_0x3ed350['as'],'attributes':_0x3ed350['attributes'],'include':_0x3ed350[_0x1bc5('0xd')]?_['map'](_0x3ed350[_0x1bc5('0xd')],function(_0x3818d0){return{'model':db[_0x3818d0[_0x1bc5('0xf')]],'as':_0x3818d0['as'],'attributes':_0x3818d0[_0x1bc5('0xb')],'include':_0x3818d0[_0x1bc5('0xd')]?_['map'](_0x3818d0[_0x1bc5('0xd')],function(_0x46dc7b){return{'model':db[_0x46dc7b[_0x1bc5('0xf')]],'as':_0x46dc7b['as'],'attributes':_0x46dc7b[_0x1bc5('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1bc5('0x10')](function(_0x342791){logger[_0x1bc5('0x11')](_0x1bc5('0x19'),_0x490e2a);logger['debug']('ShowSquareProject',_0x490e2a,JSON[_0x1bc5('0x13')](_0x342791));_0x3163c9(_0x342791);})[_0x1bc5('0x14')](function(_0x5d060f){logger[_0x1bc5('0x15')]('ShowSquareProject',_0x5d060f[_0x1bc5('0x16')],_0x490e2a);_0x165b4f(_0x11ef7d[_0x1bc5('0x15')](0x1f4,_0x5d060f[_0x1bc5('0x16')]));});});}; \ No newline at end of file +var _0xdc72=['lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','socket.io-emitter','./squareProject.socket','SquareProject','findAll','options','raw','attributes','limit','include','map','model','then','debug','GetSquareProjects','stringify','catch','error','message','ShowSquareProject','find','info'];(function(_0x4f134a,_0x8e90c){var _0x3c3ead=function(_0x57cdff){while(--_0x57cdff){_0x4f134a['push'](_0x4f134a['shift']());}};_0x3c3ead(++_0x8e90c);}(_0xdc72,0xd8));var _0x2dc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc7('0x0'));var Redis=require(_0x2dc7('0x1'));var db=require(_0x2dc7('0x2'))['db'];var logger=require(_0x2dc7('0x3'))(_0x2dc7('0x4'));var config=require('../../config/environment');config[_0x2dc7('0x5')]=_['defaults'](config[_0x2dc7('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dc7('0x6'))(new Redis(config[_0x2dc7('0x5')]));require(_0x2dc7('0x7'))['register'](socket);exports['GetSquareProjects']=function(_0x47cacf){var _0x547daf=this;return new Promise(function(_0x2a8fd1,_0x4e7db5){return db[_0x2dc7('0x8')][_0x2dc7('0x9')]({'raw':_0x47cacf[_0x2dc7('0xa')]?_0x47cacf[_0x2dc7('0xa')][_0x2dc7('0xb')]===undefined?!![]:![]:!![],'where':_0x47cacf[_0x2dc7('0xa')]?_0x47cacf[_0x2dc7('0xa')]['where']||null:null,'attributes':_0x47cacf['options']?_0x47cacf[_0x2dc7('0xa')][_0x2dc7('0xc')]||null:null,'limit':_0x47cacf[_0x2dc7('0xa')]?_0x47cacf[_0x2dc7('0xa')][_0x2dc7('0xd')]||null:null,'include':_0x47cacf[_0x2dc7('0xa')]?_0x47cacf[_0x2dc7('0xa')][_0x2dc7('0xe')]?_[_0x2dc7('0xf')](_0x47cacf['options'][_0x2dc7('0xe')],function(_0x42bba3){return{'model':db[_0x42bba3['model']],'as':_0x42bba3['as'],'attributes':_0x42bba3[_0x2dc7('0xc')],'include':_0x42bba3['include']?_[_0x2dc7('0xf')](_0x42bba3[_0x2dc7('0xe')],function(_0x29d578){return{'model':db[_0x29d578['model']],'as':_0x29d578['as'],'attributes':_0x29d578['attributes'],'include':_0x29d578[_0x2dc7('0xe')]?_[_0x2dc7('0xf')](_0x29d578[_0x2dc7('0xe')],function(_0x1d3cda){return{'model':db[_0x1d3cda[_0x2dc7('0x10')]],'as':_0x1d3cda['as'],'attributes':_0x1d3cda[_0x2dc7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x2dc7('0x11')](function(_0x10329f){logger['info']('GetSquareProjects',_0x47cacf);logger[_0x2dc7('0x12')](_0x2dc7('0x13'),_0x47cacf,JSON[_0x2dc7('0x14')](_0x10329f));_0x2a8fd1(_0x10329f);})[_0x2dc7('0x15')](function(_0x678196){logger[_0x2dc7('0x16')](_0x2dc7('0x13'),_0x678196[_0x2dc7('0x17')],_0x47cacf);_0x4e7db5(_0x547daf[_0x2dc7('0x16')](0x1f4,_0x678196[_0x2dc7('0x17')]));});});};exports[_0x2dc7('0x18')]=function(_0x2fd76a){var _0x57193b=this;return new Promise(function(_0x2f92b7,_0x1b7a5d){return db['SquareProject'][_0x2dc7('0x19')]({'raw':_0x2fd76a[_0x2dc7('0xa')]?_0x2fd76a[_0x2dc7('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x2fd76a[_0x2dc7('0xa')]?_0x2fd76a['options']['where']||null:null,'attributes':_0x2fd76a[_0x2dc7('0xa')]?_0x2fd76a[_0x2dc7('0xa')][_0x2dc7('0xc')]||null:null,'include':_0x2fd76a[_0x2dc7('0xa')]?_0x2fd76a['options']['include']?_[_0x2dc7('0xf')](_0x2fd76a[_0x2dc7('0xa')][_0x2dc7('0xe')],function(_0x5eb251){return{'model':db[_0x5eb251[_0x2dc7('0x10')]],'as':_0x5eb251['as'],'attributes':_0x5eb251[_0x2dc7('0xc')],'include':_0x5eb251[_0x2dc7('0xe')]?_[_0x2dc7('0xf')](_0x5eb251[_0x2dc7('0xe')],function(_0x3dc439){return{'model':db[_0x3dc439[_0x2dc7('0x10')]],'as':_0x3dc439['as'],'attributes':_0x3dc439[_0x2dc7('0xc')],'include':_0x3dc439['include']?_[_0x2dc7('0xf')](_0x3dc439[_0x2dc7('0xe')],function(_0x542223){return{'model':db[_0x542223[_0x2dc7('0x10')]],'as':_0x542223['as'],'attributes':_0x542223['attributes']};}):[]};}):[]};}):[]:[]})[_0x2dc7('0x11')](function(_0x71ade){logger[_0x2dc7('0x1a')](_0x2dc7('0x18'),_0x2fd76a);logger[_0x2dc7('0x12')](_0x2dc7('0x18'),_0x2fd76a,JSON[_0x2dc7('0x14')](_0x71ade));_0x2f92b7(_0x71ade);})[_0x2dc7('0x15')](function(_0x190f9f){logger['error']('ShowSquareProject',_0x190f9f['message'],_0x2fd76a);_0x1b7a5d(_0x57193b['error'](0x1f4,_0x190f9f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9d553c1..165ddbc 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 _0xda7d=['register','length','squareProject:','remove','update','emit','removeListener'];(function(_0x40cb69,_0x37f2ba){var _0x55e036=function(_0x2f6d54){while(--_0x2f6d54){_0x40cb69['push'](_0x40cb69['shift']());}};_0x55e036(++_0x37f2ba);}(_0xda7d,0xff));var _0xdda7=function(_0x336595,_0x413e3d){_0x336595=_0x336595-0x0;var _0x600f95=_0xda7d[_0x336595];return _0x600f95;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xdda7('0x0'),_0xdda7('0x1')];function createListener(_0x731525,_0x564b79){return function(_0x5a74ec){_0x564b79[_0xdda7('0x2')](_0x731525,_0x5a74ec);};}function removeListener(_0x3b287c,_0x42feb5){return function(){SquareProjectEvents[_0xdda7('0x3')](_0x3b287c,_0x42feb5);};}exports[_0xdda7('0x4')]=function(_0x5e16cb){for(var _0x12ec5d=0x0,_0x4ca291=events[_0xdda7('0x5')];_0x12ec5d<_0x4ca291;_0x12ec5d++){var _0x4add25=events[_0x12ec5d];var _0x324c0a=createListener(_0xdda7('0x6')+_0x4add25,_0x5e16cb);SquareProjectEvents['on'](_0x4add25,_0x324c0a);}}; \ No newline at end of file +var _0x9257=['save','remove','update','emit','removeListener','length','./squareProject.events'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x9257,0x1aa));var _0x7925=function(_0xf1081a,_0xfe4f04){_0xf1081a=_0xf1081a-0x0;var _0x311841=_0x9257[_0xf1081a];return _0x311841;};'use strict';var SquareProjectEvents=require(_0x7925('0x0'));var events=[_0x7925('0x1'),_0x7925('0x2'),_0x7925('0x3')];function createListener(_0x184c4c,_0x5a5459){return function(_0x39dc67){_0x5a5459[_0x7925('0x4')](_0x184c4c,_0x39dc67);};}function removeListener(_0x2e4c1f,_0x4f014f){return function(){SquareProjectEvents[_0x7925('0x5')](_0x2e4c1f,_0x4f014f);};}exports['register']=function(_0x1b14bf){for(var _0x31cde8=0x0,_0x4db302=events[_0x7925('0x6')];_0x31cde8<_0x4db302;_0x31cde8++){var _0x555b07=events[_0x31cde8];var _0x92dc55=createListener('squareProject:'+_0x555b07,_0x1b14bf);SquareProjectEvents['on'](_0x555b07,_0x92dc55);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9765ced..0038de4 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x3e1f6f,_0x3f347e){var _0x283caf=function(_0x26e7f9){while(--_0x26e7f9){_0x3e1f6f['push'](_0x3e1f6f['shift']());}};_0x283caf(++_0x3f347e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x306961,_0x3b701f){_0x306961=_0x306961-0x0;var _0x438cea=_0x1cb9[_0x306961];return _0x438cea;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35b25e,_0x563981){var _0x20a88b=function(_0x2361ec){while(--_0x2361ec){_0x35b25e['push'](_0x35b25e['shift']());}};_0x20a88b(++_0x563981);}(_0xf494,0x1c6));var _0x4f49=function(_0x26d1ac,_0x1a959c){_0x26d1ac=_0x26d1ac-0x0;var _0x89f135=_0xf494[_0x26d1ac];return _0x89f135;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9a9b416..950b6b0 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 _0xdc97=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0xdc97,0x13b));var _0x7dc9=function(_0x10d2f4,_0xfd6f97){_0x10d2f4=_0x10d2f4-0x0;var _0x555213=_0xdc97[_0x10d2f4];return _0x555213;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dc9('0x2')]},'priority':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7dc9('0x2')]},'projectName':{'type':Sequelize[_0x7dc9('0x2')]},'saveName':{'type':Sequelize[_0x7dc9('0x2')]},'filename':{'type':Sequelize[_0x7dc9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7dc9('0x3')],'get':function(){var _0x4f91c7='';var _0x4b3229=this[_0x7dc9('0x4')](_0x7dc9('0x5'));if(_0x4b3229){_0x4f91c7=_0x4b3229[_0x7dc9('0x6')](_0x4b3229[_0x7dc9('0x7')]('.'));}return _0x4f91c7;}}}; \ No newline at end of file +var _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x1b14c3,_0x5342da){var _0x23cea3=function(_0x11f48b){while(--_0x11f48b){_0x1b14c3['push'](_0x1b14c3['shift']());}};_0x23cea3(++_0x5342da);}(_0xd8fb,0x99));var _0xbd8f=function(_0x16af73,_0x5c4e55){_0x16af73=_0x16af73-0x0;var _0x21a051=_0xd8fb[_0x16af73];return _0x21a051;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a813292..e51920a 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 _0x9235=['show','params','includeAll','options','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','json','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareRecording','count','include','findAll','rows'];(function(_0x2582af,_0x3409f7){var _0x38c9c6=function(_0x2695e4){while(--_0x2695e4){_0x2582af['push'](_0x2582af['shift']());}};_0x38c9c6(++_0x3409f7);}(_0x9235,0xe2));var _0x5923=function(_0x33a009,_0x111070){_0x33a009=_0x33a009-0x0;var _0x701ee2=_0x9235[_0x33a009];return _0x701ee2;};'use strict';var emlformat=require(_0x5923('0x0'));var rimraf=require(_0x5923('0x1'));var zipdir=require(_0x5923('0x2'));var jsonpatch=require(_0x5923('0x3'));var rp=require(_0x5923('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5923('0x5'));var util=require(_0x5923('0x6'));var path=require(_0x5923('0x7'));var sox=require(_0x5923('0x8'));var csv=require(_0x5923('0x9'));var ejs=require(_0x5923('0xa'));var fs=require('fs');var fs_extra=require(_0x5923('0xb'));var _=require(_0x5923('0xc'));var squel=require('squel');var crypto=require(_0x5923('0xd'));var jsforce=require(_0x5923('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5923('0x9'));var querystring=require(_0x5923('0xf'));var Papa=require(_0x5923('0x10'));var Redis=require('ioredis');var authService=require(_0x5923('0x11'));var qs=require(_0x5923('0x12'));var as=require(_0x5923('0x13'));var hardwareService=require(_0x5923('0x14'));var logger=require(_0x5923('0x15'))('api');var utils=require(_0x5923('0x16'));var config=require(_0x5923('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5923('0x18'))['db'];function respondWithStatusCode(_0x258253,_0x97e741){_0x97e741=_0x97e741||0xcc;return function(_0x1ec731){if(_0x1ec731){return _0x258253[_0x5923('0x19')](_0x97e741);}return _0x258253['status'](_0x97e741)['end']();};}function respondWithResult(_0xeafb3d,_0x3c68e2){_0x3c68e2=_0x3c68e2||0xc8;return function(_0x4cd11c){if(_0x4cd11c){return _0xeafb3d[_0x5923('0x1a')](_0x3c68e2)['json'](_0x4cd11c);}};}function respondWithFilteredResult(_0x349c24,_0x14eed7){return function(_0xcb79c4){if(_0xcb79c4){var _0x127ffa=typeof _0x14eed7[_0x5923('0x1b')]===_0x5923('0x1c')&&typeof _0x14eed7[_0x5923('0x1d')]==='undefined';var _0x2d23c7=_0xcb79c4['count'];var _0x2a1b38=_0x127ffa?0x0:_0x14eed7[_0x5923('0x1b')];var _0x57e779=_0x127ffa?_0xcb79c4['count']:_0x14eed7[_0x5923('0x1b')]+_0x14eed7[_0x5923('0x1d')];var _0x2bbb5b;if(_0x57e779>=_0x2d23c7){_0x57e779=_0x2d23c7;_0x2bbb5b=0xc8;}else{_0x2bbb5b=0xce;}_0x349c24[_0x5923('0x1a')](_0x2bbb5b);return _0x349c24['set']('Content-Range',_0x2a1b38+'-'+_0x57e779+'/'+_0x2d23c7)[_0x5923('0x1e')](_0xcb79c4);}return null;};}function patchUpdates(_0x4d0ace){return function(_0xced461){try{jsonpatch[_0x5923('0x1f')](_0xced461,_0x4d0ace,!![]);}catch(_0x20baeb){return BPromise[_0x5923('0x20')](_0x20baeb);}return _0xced461[_0x5923('0x21')]();};}function saveUpdates(_0x370cd4,_0x266438){return function(_0x17490a){if(_0x17490a){return _0x17490a[_0x5923('0x22')](_0x370cd4)[_0x5923('0x23')](function(_0x383478){return _0x383478;});}return null;};}function removeEntity(_0x134ec5,_0x348cf5){return function(_0xe68fd2){if(_0xe68fd2){return _0xe68fd2[_0x5923('0x24')]()['then'](function(){_0x134ec5[_0x5923('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a98d,_0x307809){return function(_0x236615){if(!_0x236615){_0x23a98d['sendStatus'](0x194);}return _0x236615;};}function handleError(_0x1316f9,_0x5ec8ee){_0x5ec8ee=_0x5ec8ee||0x1f4;return function(_0xfd3e72){logger[_0x5923('0x25')](_0xfd3e72['stack']);if(_0xfd3e72[_0x5923('0x26')]){delete _0xfd3e72[_0x5923('0x26')];}_0x1316f9[_0x5923('0x1a')](_0x5ec8ee)[_0x5923('0x27')](_0xfd3e72);};}exports[_0x5923('0x28')]=function(_0x34c8f8,_0x48bae9){var _0x21924b={},_0x2c519d={},_0x5de66a={'count':0x0,'rows':[]};var _0xaeb371=_['map'](db['SquareRecording'][_0x5923('0x29')],function(_0x49f27f){return{'name':_0x49f27f[_0x5923('0x2a')],'type':_0x49f27f[_0x5923('0x2b')][_0x5923('0x2c')]};});_0x2c519d[_0x5923('0x2d')]=_['map'](_0xaeb371,_0x5923('0x26'));_0x2c519d[_0x5923('0x2e')]=_[_0x5923('0x2f')](_0x34c8f8[_0x5923('0x2e')]);_0x2c519d['filters']=_[_0x5923('0x30')](_0x2c519d[_0x5923('0x2d')],_0x2c519d[_0x5923('0x2e')]);_0x21924b[_0x5923('0x31')]=_[_0x5923('0x30')](_0x2c519d['model'],qs[_0x5923('0x32')](_0x34c8f8[_0x5923('0x2e')]['fields']));_0x21924b[_0x5923('0x31')]=_0x21924b[_0x5923('0x31')][_0x5923('0x33')]?_0x21924b['attributes']:_0x2c519d[_0x5923('0x2d')];if(!_0x34c8f8['query']['hasOwnProperty'](_0x5923('0x34'))){_0x21924b['limit']=qs[_0x5923('0x1d')](_0x34c8f8[_0x5923('0x2e')]['limit']);_0x21924b[_0x5923('0x1b')]=qs['offset'](_0x34c8f8[_0x5923('0x2e')]['offset']);}_0x21924b[_0x5923('0x35')]=qs[_0x5923('0x36')](_0x34c8f8[_0x5923('0x2e')][_0x5923('0x36')]);_0x21924b['where']=qs['filters'](_[_0x5923('0x37')](_0x34c8f8['query'],_0x2c519d['filters']),_0xaeb371);if(_0x34c8f8[_0x5923('0x2e')][_0x5923('0x38')]){_0x21924b[_0x5923('0x39')]=_[_0x5923('0x3a')](_0x21924b[_0x5923('0x39')],{'$or':_['map'](_0xaeb371,function(_0x3a50d1){if(_0x3a50d1[_0x5923('0x2b')]!==_0x5923('0x3b')){var _0x4c302a={};_0x4c302a[_0x3a50d1[_0x5923('0x26')]]={'$like':'%'+_0x34c8f8[_0x5923('0x2e')][_0x5923('0x38')]+'%'};return _0x4c302a;}})});}_0x21924b=_['merge']({},_0x21924b,_0x34c8f8['options']);var _0x5cddb2={'where':_0x21924b[_0x5923('0x39')]};return db[_0x5923('0x3c')][_0x5923('0x3d')](_0x5cddb2)['then'](function(_0x48d05b){_0x5de66a[_0x5923('0x3d')]=_0x48d05b;if(_0x34c8f8[_0x5923('0x2e')]['includeAll']){_0x21924b[_0x5923('0x3e')]=[{'all':!![]}];}return db[_0x5923('0x3c')][_0x5923('0x3f')](_0x21924b);})[_0x5923('0x23')](function(_0x2c4fff){_0x5de66a[_0x5923('0x40')]=_0x2c4fff;return _0x5de66a;})[_0x5923('0x23')](respondWithFilteredResult(_0x48bae9,_0x21924b))['catch'](handleError(_0x48bae9,null));};exports[_0x5923('0x41')]=function(_0x84942c,_0x93190b){var _0x907e5={'raw':!![],'where':{'id':_0x84942c[_0x5923('0x42')]['id']}},_0x1e2a9a={};_0x1e2a9a[_0x5923('0x2d')]=_['keys'](db[_0x5923('0x3c')][_0x5923('0x29')]);_0x1e2a9a[_0x5923('0x2e')]=_[_0x5923('0x2f')](_0x84942c[_0x5923('0x2e')]);_0x1e2a9a['filters']=_['intersection'](_0x1e2a9a[_0x5923('0x2d')],_0x1e2a9a[_0x5923('0x2e')]);_0x907e5[_0x5923('0x31')]=_['intersection'](_0x1e2a9a['model'],qs[_0x5923('0x32')](_0x84942c[_0x5923('0x2e')][_0x5923('0x32')]));_0x907e5[_0x5923('0x31')]=_0x907e5[_0x5923('0x31')][_0x5923('0x33')]?_0x907e5[_0x5923('0x31')]:_0x1e2a9a['model'];if(_0x84942c[_0x5923('0x2e')][_0x5923('0x43')]){_0x907e5['include']=[{'all':!![]}];}_0x907e5=_[_0x5923('0x3a')]({},_0x907e5,_0x84942c[_0x5923('0x44')]);return db[_0x5923('0x3c')][_0x5923('0x45')](_0x907e5)[_0x5923('0x23')](handleEntityNotFound(_0x93190b,null))[_0x5923('0x23')](respondWithResult(_0x93190b,null))[_0x5923('0x46')](handleError(_0x93190b,null));};exports[_0x5923('0x47')]=function(_0x145066,_0x5eb350){return db[_0x5923('0x3c')]['create'](_0x145066[_0x5923('0x48')],{})['then'](respondWithResult(_0x5eb350,0xc9))[_0x5923('0x46')](handleError(_0x5eb350,null));};exports[_0x5923('0x22')]=function(_0x4bc225,_0x57c7cd){if(_0x4bc225[_0x5923('0x48')]['id']){delete _0x4bc225['body']['id'];}return db['SquareRecording'][_0x5923('0x45')]({'where':{'id':_0x4bc225[_0x5923('0x42')]['id']}})[_0x5923('0x23')](handleEntityNotFound(_0x57c7cd,null))['then'](saveUpdates(_0x4bc225[_0x5923('0x48')],null))[_0x5923('0x23')](respondWithResult(_0x57c7cd,null))['catch'](handleError(_0x57c7cd,null));};exports[_0x5923('0x49')]=function(_0x4f5d92,_0x5dbe7f,_0x531dfa){var _0x52a037=require(_0x5923('0x4a'));var _0x5369ca=![];var _0x2b2528={};if(_0x4f5d92[_0x5923('0x2e')][_0x5923('0x2b')]&&_0x4f5d92['query'][_0x5923('0x2b')]===_0x5923('0x4b')){_0x2b2528[_0x5923('0x4b')]=_0x4f5d92['params']['id'];}else{_0x2b2528['id']=_0x4f5d92[_0x5923('0x42')]['id'];}return db['SquareRecording'][_0x5923('0x45')]({'where':_0x2b2528,'attributes':['id',_0x5923('0x4c'),_0x5923('0x4d')],'raw':!![]})[_0x5923('0x23')](handleEntityNotFound(_0x5dbe7f,null))[_0x5923('0x23')](function(_0x583d9f){if(_0x583d9f){var _0x221610=_0x583d9f[_0x5923('0x4c')];var _0x39321c=util[_0x5923('0x4e')]('%s.cypher',_0x221610);if(fs[_0x5923('0x4f')](_0x39321c)){_0x5369ca=!![];return _0x52a037['decryptFile'](_0x39321c,_0x221610,config[_0x5923('0x50')][_0x5923('0x51')])[_0x5923('0x23')](function(){return _0x583d9f;});}return _0x583d9f;}})[_0x5923('0x23')](function(_0x363f69){if(_0x363f69){var _0x46e0b1=_0x363f69['savePath'];if(!fs[_0x5923('0x4f')](_0x46e0b1)){throw new db[(_0x5923('0x52'))][(_0x5923('0x53'))](_0x5923('0x54'));}if(_0x363f69[_0x5923('0x4d')]){return _0x5dbe7f[_0x5923('0x49')](_0x46e0b1,_0x363f69['filename']+path[_0x5923('0x55')](_0x46e0b1),function(){if(_0x5369ca){fs[_0x5923('0x56')](_0x46e0b1);}});}else{return _0x5dbe7f[_0x5923('0x49')](_0x46e0b1,function(_0x3902f1){if(_0x5369ca){fs['unlink'](_0x46e0b1);}});}}})[_0x5923('0x46')](function(_0x19fff6){if(_0x19fff6[_0x5923('0x57')]===_0x5923('0x54')){_0x5dbe7f['status'](0x194)[_0x5923('0x27')](_0x5923('0x58'));}else{return handleError(_0x5dbe7f,null);}});};exports[_0x5923('0x24')]=function(_0x3753ed,_0x37d7a4){return db[_0x5923('0x3c')]['find']({'where':{'id':_0x3753ed[_0x5923('0x42')]['id']}})[_0x5923('0x23')](function(_0x499d75){if(_['isNil'](_0x499d75)){throw new ReferenceError(_0x5923('0x59'));}return _0x499d75;})[_0x5923('0x23')](function(_0x5884c8){var _0x2ff15a=_0x5884c8[_0x5923('0x4c')];logger[_0x5923('0x5a')](_0x5923('0x5b'),_0x2ff15a);if(!_['isNil'](_0x5884c8[_0x5923('0x4c')])&&fs[_0x5923('0x4f')](_0x2ff15a)){logger[_0x5923('0x5a')](_0x5923('0x5c')+_0x2ff15a+_0x5923('0x5d'));fs[_0x5923('0x5e')](_0x2ff15a);}_0x2ff15a=_0x2ff15a+'.cypher';if(!_[_0x5923('0x5f')](_0x5884c8[_0x5923('0x4c')])&&fs[_0x5923('0x4f')](_0x2ff15a)){logger[_0x5923('0x5a')](_0x5923('0x5c')+_0x2ff15a+_0x5923('0x5d'));fs[_0x5923('0x5e')](_0x2ff15a);}return _0x5884c8;})['then'](function(_0x7b1ef4){if(!_0x7b1ef4)throw new InternalError();return _0x7b1ef4[_0x5923('0x24')]();})[_0x5923('0x23')](function(){_0x37d7a4[_0x5923('0x1a')](0xcc)[_0x5923('0x60')]();})[_0x5923('0x46')](handleError(_0x37d7a4,null));}; \ No newline at end of file +var _0x35fe=['filename','format','%s.cypher','existsSync','decryptFile','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','SquareRecording','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','rows','params','catch','create','body','find','../../components/encryptor','uniqueid'];(function(_0x449dc4,_0x59f028){var _0x503bcc=function(_0x3ae9fb){while(--_0x3ae9fb){_0x449dc4['push'](_0x449dc4['shift']());}};_0x503bcc(++_0x59f028);}(_0x35fe,0xd7));var _0xe35f=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x35fe[_0xcd0918];return _0x250704;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe35f('0x0'));var zipdir=require(_0xe35f('0x1'));var jsonpatch=require(_0xe35f('0x2'));var rp=require(_0xe35f('0x3'));var moment=require('moment');var BPromise=require(_0xe35f('0x4'));var Mustache=require(_0xe35f('0x5'));var util=require(_0xe35f('0x6'));var path=require(_0xe35f('0x7'));var sox=require(_0xe35f('0x8'));var csv=require(_0xe35f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe35f('0xa'));var _=require(_0xe35f('0xb'));var squel=require(_0xe35f('0xc'));var crypto=require(_0xe35f('0xd'));var jsforce=require(_0xe35f('0xe'));var deskjs=require(_0xe35f('0xf'));var toCsv=require(_0xe35f('0x9'));var querystring=require(_0xe35f('0x10'));var Papa=require(_0xe35f('0x11'));var Redis=require('ioredis');var authService=require(_0xe35f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe35f('0x13'));var hardwareService=require(_0xe35f('0x14'));var logger=require(_0xe35f('0x15'))(_0xe35f('0x16'));var utils=require(_0xe35f('0x17'));var config=require(_0xe35f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe35f('0x19'))['db'];function respondWithStatusCode(_0x43583c,_0x1a303f){_0x1a303f=_0x1a303f||0xcc;return function(_0x2f493d){if(_0x2f493d){return _0x43583c[_0xe35f('0x1a')](_0x1a303f);}return _0x43583c[_0xe35f('0x1b')](_0x1a303f)['end']();};}function respondWithResult(_0x14372d,_0x2bd89d){_0x2bd89d=_0x2bd89d||0xc8;return function(_0x43195e){if(_0x43195e){return _0x14372d['status'](_0x2bd89d)[_0xe35f('0x1c')](_0x43195e);}};}function respondWithFilteredResult(_0x234843,_0x5210a6){return function(_0x4f87fc){if(_0x4f87fc){var _0x5dae27=typeof _0x5210a6[_0xe35f('0x1d')]===_0xe35f('0x1e')&&typeof _0x5210a6[_0xe35f('0x1f')]===_0xe35f('0x1e');var _0x2f3d46=_0x4f87fc[_0xe35f('0x20')];var _0x491674=_0x5dae27?0x0:_0x5210a6[_0xe35f('0x1d')];var _0x3ef822=_0x5dae27?_0x4f87fc['count']:_0x5210a6[_0xe35f('0x1d')]+_0x5210a6[_0xe35f('0x1f')];var _0x2e99c4;if(_0x3ef822>=_0x2f3d46){_0x3ef822=_0x2f3d46;_0x2e99c4=0xc8;}else{_0x2e99c4=0xce;}_0x234843['status'](_0x2e99c4);return _0x234843[_0xe35f('0x21')]('Content-Range',_0x491674+'-'+_0x3ef822+'/'+_0x2f3d46)[_0xe35f('0x1c')](_0x4f87fc);}return null;};}function patchUpdates(_0x118433){return function(_0x3b2b6e){try{jsonpatch[_0xe35f('0x22')](_0x3b2b6e,_0x118433,!![]);}catch(_0x2e7153){return BPromise[_0xe35f('0x23')](_0x2e7153);}return _0x3b2b6e[_0xe35f('0x24')]();};}function saveUpdates(_0x131d77,_0x330cae){return function(_0x5e60cb){if(_0x5e60cb){return _0x5e60cb[_0xe35f('0x25')](_0x131d77)[_0xe35f('0x26')](function(_0x10db91){return _0x10db91;});}return null;};}function removeEntity(_0x4d8ab3,_0x561609){return function(_0x286fc2){if(_0x286fc2){return _0x286fc2['destroy']()[_0xe35f('0x26')](function(){_0x4d8ab3[_0xe35f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b751,_0x5d360d){return function(_0x584cd2){if(!_0x584cd2){_0x39b751[_0xe35f('0x1a')](0x194);}return _0x584cd2;};}function handleError(_0xfa5928,_0x1c2b5b){_0x1c2b5b=_0x1c2b5b||0x1f4;return function(_0x557850){logger[_0xe35f('0x27')](_0x557850[_0xe35f('0x28')]);if(_0x557850[_0xe35f('0x29')]){delete _0x557850[_0xe35f('0x29')];}_0xfa5928[_0xe35f('0x1b')](_0x1c2b5b)[_0xe35f('0x2a')](_0x557850);};}exports['index']=function(_0x279033,_0xa23aba){var _0x25588d={},_0x6a42fc={},_0x2fa363={'count':0x0,'rows':[]};var _0x3c0457=_['map'](db[_0xe35f('0x2b')][_0xe35f('0x2c')],function(_0x51b3d3){return{'name':_0x51b3d3['fieldName'],'type':_0x51b3d3['type'][_0xe35f('0x2d')]};});_0x6a42fc[_0xe35f('0x2e')]=_['map'](_0x3c0457,'name');_0x6a42fc[_0xe35f('0x2f')]=_[_0xe35f('0x30')](_0x279033[_0xe35f('0x2f')]);_0x6a42fc[_0xe35f('0x31')]=_[_0xe35f('0x32')](_0x6a42fc[_0xe35f('0x2e')],_0x6a42fc[_0xe35f('0x2f')]);_0x25588d[_0xe35f('0x33')]=_['intersection'](_0x6a42fc[_0xe35f('0x2e')],qs['fields'](_0x279033[_0xe35f('0x2f')][_0xe35f('0x34')]));_0x25588d[_0xe35f('0x33')]=_0x25588d[_0xe35f('0x33')][_0xe35f('0x35')]?_0x25588d['attributes']:_0x6a42fc[_0xe35f('0x2e')];if(!_0x279033[_0xe35f('0x2f')]['hasOwnProperty'](_0xe35f('0x36'))){_0x25588d[_0xe35f('0x1f')]=qs[_0xe35f('0x1f')](_0x279033[_0xe35f('0x2f')]['limit']);_0x25588d[_0xe35f('0x1d')]=qs['offset'](_0x279033[_0xe35f('0x2f')]['offset']);}_0x25588d['order']=qs[_0xe35f('0x37')](_0x279033[_0xe35f('0x2f')][_0xe35f('0x37')]);_0x25588d['where']=qs[_0xe35f('0x31')](_['pick'](_0x279033[_0xe35f('0x2f')],_0x6a42fc[_0xe35f('0x31')]),_0x3c0457);if(_0x279033[_0xe35f('0x2f')][_0xe35f('0x38')]){_0x25588d['where']=_['merge'](_0x25588d[_0xe35f('0x39')],{'$or':_[_0xe35f('0x3a')](_0x3c0457,function(_0x108e22){if(_0x108e22[_0xe35f('0x3b')]!==_0xe35f('0x3c')){var _0x274426={};_0x274426[_0x108e22['name']]={'$like':'%'+_0x279033[_0xe35f('0x2f')][_0xe35f('0x38')]+'%'};return _0x274426;}})});}_0x25588d=_[_0xe35f('0x3d')]({},_0x25588d,_0x279033[_0xe35f('0x3e')]);var _0x2ba108={'where':_0x25588d[_0xe35f('0x39')]};return db[_0xe35f('0x2b')][_0xe35f('0x20')](_0x2ba108)[_0xe35f('0x26')](function(_0x376757){_0x2fa363['count']=_0x376757;if(_0x279033[_0xe35f('0x2f')][_0xe35f('0x3f')]){_0x25588d[_0xe35f('0x40')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x25588d);})[_0xe35f('0x26')](function(_0x2e19da){_0x2fa363[_0xe35f('0x41')]=_0x2e19da;return _0x2fa363;})['then'](respondWithFilteredResult(_0xa23aba,_0x25588d))['catch'](handleError(_0xa23aba,null));};exports['show']=function(_0x479d73,_0x4ce963){var _0x5c222f={'raw':!![],'where':{'id':_0x479d73[_0xe35f('0x42')]['id']}},_0x4691b1={};_0x4691b1['model']=_['keys'](db[_0xe35f('0x2b')]['rawAttributes']);_0x4691b1[_0xe35f('0x2f')]=_[_0xe35f('0x30')](_0x479d73[_0xe35f('0x2f')]);_0x4691b1[_0xe35f('0x31')]=_[_0xe35f('0x32')](_0x4691b1[_0xe35f('0x2e')],_0x4691b1[_0xe35f('0x2f')]);_0x5c222f[_0xe35f('0x33')]=_[_0xe35f('0x32')](_0x4691b1[_0xe35f('0x2e')],qs[_0xe35f('0x34')](_0x479d73[_0xe35f('0x2f')][_0xe35f('0x34')]));_0x5c222f[_0xe35f('0x33')]=_0x5c222f['attributes'][_0xe35f('0x35')]?_0x5c222f['attributes']:_0x4691b1[_0xe35f('0x2e')];if(_0x479d73[_0xe35f('0x2f')][_0xe35f('0x3f')]){_0x5c222f[_0xe35f('0x40')]=[{'all':!![]}];}_0x5c222f=_[_0xe35f('0x3d')]({},_0x5c222f,_0x479d73[_0xe35f('0x3e')]);return db[_0xe35f('0x2b')]['find'](_0x5c222f)[_0xe35f('0x26')](handleEntityNotFound(_0x4ce963,null))['then'](respondWithResult(_0x4ce963,null))[_0xe35f('0x43')](handleError(_0x4ce963,null));};exports['create']=function(_0x1829a3,_0x51878a){return db[_0xe35f('0x2b')][_0xe35f('0x44')](_0x1829a3[_0xe35f('0x45')],{})[_0xe35f('0x26')](respondWithResult(_0x51878a,0xc9))['catch'](handleError(_0x51878a,null));};exports[_0xe35f('0x25')]=function(_0x2a5f78,_0x2b3db3){if(_0x2a5f78['body']['id']){delete _0x2a5f78['body']['id'];}return db['SquareRecording'][_0xe35f('0x46')]({'where':{'id':_0x2a5f78[_0xe35f('0x42')]['id']}})[_0xe35f('0x26')](handleEntityNotFound(_0x2b3db3,null))[_0xe35f('0x26')](saveUpdates(_0x2a5f78[_0xe35f('0x45')],null))['then'](respondWithResult(_0x2b3db3,null))[_0xe35f('0x43')](handleError(_0x2b3db3,null));};exports['download']=function(_0x4bb37f,_0x555a0b,_0x4adf61){var _0x5b32fd=require(_0xe35f('0x47'));var _0x220cfe=![];var _0x4898bd={};if(_0x4bb37f[_0xe35f('0x2f')][_0xe35f('0x3b')]&&_0x4bb37f[_0xe35f('0x2f')][_0xe35f('0x3b')]===_0xe35f('0x48')){_0x4898bd['uniqueid']=_0x4bb37f[_0xe35f('0x42')]['id'];}else{_0x4898bd['id']=_0x4bb37f[_0xe35f('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x4898bd,'attributes':['id','savePath',_0xe35f('0x49')],'raw':!![]})[_0xe35f('0x26')](handleEntityNotFound(_0x555a0b,null))[_0xe35f('0x26')](function(_0x255549){if(_0x255549){var _0x3d928b=_0x255549['savePath'];var _0x4c8fbe=util[_0xe35f('0x4a')](_0xe35f('0x4b'),_0x3d928b);if(fs[_0xe35f('0x4c')](_0x4c8fbe)){_0x220cfe=!![];return _0x5b32fd[_0xe35f('0x4d')](_0x4c8fbe,_0x3d928b,config['secrets'][_0xe35f('0x4e')])[_0xe35f('0x26')](function(){return _0x255549;});}return _0x255549;}})['then'](function(_0x1d52e0){if(_0x1d52e0){var _0x104267=_0x1d52e0[_0xe35f('0x4f')];if(!fs[_0xe35f('0x4c')](_0x104267)){throw new db[(_0xe35f('0x50'))][(_0xe35f('0x51'))](_0xe35f('0x52'));}if(_0x1d52e0[_0xe35f('0x49')]){return _0x555a0b[_0xe35f('0x53')](_0x104267,_0x1d52e0[_0xe35f('0x49')]+path[_0xe35f('0x54')](_0x104267),function(){if(_0x220cfe){fs[_0xe35f('0x55')](_0x104267);}});}else{return _0x555a0b['download'](_0x104267,function(_0x563ae0){if(_0x220cfe){fs[_0xe35f('0x55')](_0x104267);}});}}})['catch'](function(_0x3800fe){if(_0x3800fe[_0xe35f('0x56')]===_0xe35f('0x52')){_0x555a0b[_0xe35f('0x1b')](0x194)['send'](_0xe35f('0x57'));}else{return handleError(_0x555a0b,null);}});};exports[_0xe35f('0x58')]=function(_0x25a490,_0x5bb3c8){return db[_0xe35f('0x2b')][_0xe35f('0x46')]({'where':{'id':_0x25a490[_0xe35f('0x42')]['id']}})[_0xe35f('0x26')](function(_0x280bbf){if(_[_0xe35f('0x59')](_0x280bbf)){throw new ReferenceError('Entity\x20not\x20found');}return _0x280bbf;})[_0xe35f('0x26')](function(_0x5b63a9){var _0x4a0f29=_0x5b63a9[_0xe35f('0x4f')];logger[_0xe35f('0x5a')](_0xe35f('0x5b'),_0x4a0f29);if(!_[_0xe35f('0x59')](_0x5b63a9[_0xe35f('0x4f')])&&fs[_0xe35f('0x4c')](_0x4a0f29)){logger[_0xe35f('0x5a')](_0xe35f('0x5c')+_0x4a0f29+_0xe35f('0x5d'));fs[_0xe35f('0x5e')](_0x4a0f29);}_0x4a0f29=_0x4a0f29+'.cypher';if(!_[_0xe35f('0x59')](_0x5b63a9[_0xe35f('0x4f')])&&fs[_0xe35f('0x4c')](_0x4a0f29)){logger['info'](_0xe35f('0x5c')+_0x4a0f29+_0xe35f('0x5d'));fs[_0xe35f('0x5e')](_0x4a0f29);}return _0x5b63a9;})[_0xe35f('0x26')](function(_0x10ba5e){if(!_0x10ba5e)throw new InternalError();return _0x10ba5e[_0xe35f('0x58')]();})[_0xe35f('0x26')](function(){_0x5bb3c8[_0xe35f('0x1b')](0xcc)[_0xe35f('0x5f')]();})['catch'](handleError(_0x5bb3c8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fedd412..c1a188f 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 _0xb89c=['SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','define'];(function(_0x25dd2,_0x20852a){var _0x4ab6e2=function(_0x531403){while(--_0x531403){_0x25dd2['push'](_0x25dd2['shift']());}};_0x4ab6e2(++_0x20852a);}(_0xb89c,0x198));var _0xcb89=function(_0x547c5d,_0x4b2b41){_0x547c5d=_0x547c5d-0x0;var _0x29230e=_0xb89c[_0x547c5d];return _0x29230e;};'use strict';var _=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var logger=require(_0xcb89('0x2'))(_0xcb89('0x3'));var moment=require('moment');var BPromise=require(_0xcb89('0x4'));var rp=require(_0xcb89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb89('0x6'));var config=require(_0xcb89('0x7'));var attributes=require(_0xcb89('0x8'));module['exports']=function(_0x503a2b,_0xd820d7){return _0x503a2b[_0xcb89('0x9')](_0xcb89('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1410=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./squareRecording.attributes'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x1410,0x130));var _0x0141=function(_0x5d9ca5,_0x41a09b){_0x5d9ca5=_0x5d9ca5-0x0;var _0x4174f3=_0x1410[_0x5d9ca5];return _0x4174f3;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var logger=require(_0x0141('0x2'))(_0x0141('0x3'));var moment=require('moment');var BPromise=require(_0x0141('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0141('0x5'));var rimraf=require('rimraf');var config=require(_0x0141('0x6'));var attributes=require(_0x0141('0x7'));module[_0x0141('0x8')]=function(_0x2aa85f,_0x17e0c6){return _0x2aa85f[_0x0141('0x9')](_0x0141('0xa'),attributes,{'tableName':_0x0141('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 eed7fac..719e2ce 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 _0xa9b8=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0xe7d561,_0x146cef){var _0x4c27f0=function(_0x287ac7){while(--_0x287ac7){_0xe7d561['push'](_0xe7d561['shift']());}};_0x4c27f0(++_0x146cef);}(_0xa9b8,0x9c));var _0x8a9b=function(_0xbea040,_0x578c89){_0xbea040=_0xbea040-0x0;var _0x3c623a=_0xa9b8[_0xbea040];return _0x3c623a;};'use strict';var _=require(_0x8a9b('0x0'));var util=require(_0x8a9b('0x1'));var moment=require(_0x8a9b('0x2'));var BPromise=require(_0x8a9b('0x3'));var rs=require(_0x8a9b('0x4'));var fs=require('fs');var Redis=require(_0x8a9b('0x5'));var db=require(_0x8a9b('0x6'))['db'];var utils=require(_0x8a9b('0x7'));var logger=require(_0x8a9b('0x8'))(_0x8a9b('0x9'));var config=require(_0x8a9b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8a9b('0xb')][_0x8a9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47e1a4,_0x3780d2,_0x41fec1){return new BPromise(function(_0x2b5038,_0x5c82fc){return client[_0x8a9b('0xd')](_0x47e1a4,_0x41fec1)['then'](function(_0x42b34b){logger[_0x8a9b('0xe')](_0x8a9b('0xf'),_0x3780d2,_0x8a9b('0x10'));logger[_0x8a9b('0x11')](_0x8a9b('0x12'),_0x3780d2,'request\x20sent',JSON[_0x8a9b('0x13')](_0x42b34b));if(_0x42b34b['error']){if(_0x42b34b[_0x8a9b('0x14')][_0x8a9b('0x15')]===0x1f4){logger['error'](_0x8a9b('0xf'),_0x3780d2,_0x42b34b[_0x8a9b('0x14')][_0x8a9b('0x16')]);return _0x5c82fc(_0x42b34b['error']['message']);}logger[_0x8a9b('0x14')](_0x8a9b('0xf'),_0x3780d2,_0x42b34b[_0x8a9b('0x14')][_0x8a9b('0x16')]);return _0x2b5038(_0x42b34b['error']['message']);}else{logger[_0x8a9b('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3780d2,_0x8a9b('0x10'));_0x2b5038(_0x42b34b[_0x8a9b('0x17')]['message']);}})[_0x8a9b('0x18')](function(_0x2ba91c){logger[_0x8a9b('0x14')](_0x8a9b('0xf'),_0x3780d2,_0x2ba91c);_0x5c82fc(_0x2ba91c);});});}exports[_0x8a9b('0x19')]=function(_0x1b4f7f){var _0x69abc4=this;return new Promise(function(_0x2ff1a1,_0x403bd5){return db[_0x8a9b('0x1a')][_0x8a9b('0x1b')](_0x1b4f7f[_0x8a9b('0x1c')],{'raw':_0x1b4f7f[_0x8a9b('0x1d')]?_0x1b4f7f[_0x8a9b('0x1d')][_0x8a9b('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1fac56){logger[_0x8a9b('0xe')]('CreateSquareRecording',_0x1b4f7f);logger[_0x8a9b('0x11')](_0x8a9b('0x19'),_0x1b4f7f,JSON[_0x8a9b('0x13')](_0x1fac56));_0x2ff1a1(_0x1fac56);})[_0x8a9b('0x18')](function(_0x20d161){logger['error'](_0x8a9b('0x19'),_0x20d161[_0x8a9b('0x16')],_0x1b4f7f);_0x403bd5(_0x69abc4[_0x8a9b('0x14')](0x1f4,_0x20d161[_0x8a9b('0x16')]));});});}; \ No newline at end of file +var _0x4a02=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','options','debug','lodash'];(function(_0x27157c,_0x5f106a){var _0x18e24f=function(_0x1440c1){while(--_0x1440c1){_0x27157c['push'](_0x27157c['shift']());}};_0x18e24f(++_0x5f106a);}(_0x4a02,0x11f));var _0x24a0=function(_0x345ebb,_0x3df78b){_0x345ebb=_0x345ebb-0x0;var _0x2b6c18=_0x4a02[_0x345ebb];return _0x2b6c18;};'use strict';var _=require(_0x24a0('0x0'));var util=require(_0x24a0('0x1'));var moment=require(_0x24a0('0x2'));var BPromise=require(_0x24a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24a0('0x4'));var db=require(_0x24a0('0x5'))['db'];var utils=require(_0x24a0('0x6'));var logger=require(_0x24a0('0x7'))(_0x24a0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24a0('0x9')][_0x24a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467bc5,_0x18f208,_0x4163f0){return new BPromise(function(_0x21bfca,_0x3b485b){return client['request'](_0x467bc5,_0x4163f0)[_0x24a0('0xb')](function(_0x13a3bd){logger['info'](_0x24a0('0xc'),_0x18f208,_0x24a0('0xd'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x18f208,_0x24a0('0xd'),JSON[_0x24a0('0xe')](_0x13a3bd));if(_0x13a3bd['error']){if(_0x13a3bd[_0x24a0('0xf')][_0x24a0('0x10')]===0x1f4){logger[_0x24a0('0xf')]('SquareRecording,\x20%s,\x20%s',_0x18f208,_0x13a3bd[_0x24a0('0xf')][_0x24a0('0x11')]);return _0x3b485b(_0x13a3bd['error'][_0x24a0('0x11')]);}logger[_0x24a0('0xf')](_0x24a0('0xc'),_0x18f208,_0x13a3bd[_0x24a0('0xf')]['message']);return _0x21bfca(_0x13a3bd['error'][_0x24a0('0x11')]);}else{logger[_0x24a0('0x12')](_0x24a0('0xc'),_0x18f208,_0x24a0('0xd'));_0x21bfca(_0x13a3bd[_0x24a0('0x13')][_0x24a0('0x11')]);}})[_0x24a0('0x14')](function(_0xc923d4){logger[_0x24a0('0xf')](_0x24a0('0xc'),_0x18f208,_0xc923d4);_0x3b485b(_0xc923d4);});});}exports[_0x24a0('0x15')]=function(_0x20d198){var _0x72772e=this;return new Promise(function(_0x3c2cd7,_0x453ace){return db['SquareRecording']['create'](_0x20d198['body'],{'raw':_0x20d198[_0x24a0('0x16')]?_0x20d198[_0x24a0('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43115e){logger[_0x24a0('0x12')](_0x24a0('0x15'),_0x20d198);logger[_0x24a0('0x17')](_0x24a0('0x15'),_0x20d198,JSON['stringify'](_0x43115e));_0x3c2cd7(_0x43115e);})[_0x24a0('0x14')](function(_0xf4bf51){logger['error']('CreateSquareRecording',_0xf4bf51['message'],_0x20d198);_0x453ace(_0x72772e[_0x24a0('0xf')](0x1f4,_0xf4bf51[_0x24a0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 53d728b..91a26fa 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 66571b6..c1c9932 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 _0x2e9a=['DATE','exports','STRING'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2e9a,0x151));var _0xa2e9=function(_0x3ed0c5,_0x16957f){_0x3ed0c5=_0x3ed0c5-0x0;var _0x231ff2=_0x2e9a[_0x3ed0c5];return _0x231ff2;};'use strict';var Sequelize=require('sequelize');module[_0xa2e9('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xa2e9('0x1')]},'request':{'type':Sequelize[_0xa2e9('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa2e9('0x1')]},'type':{'type':Sequelize[_0xa2e9('0x1')]},'uniqueid':{'type':Sequelize[_0xa2e9('0x1')]},'version':{'type':Sequelize[_0xa2e9('0x1')]},'callerid':{'type':Sequelize[_0xa2e9('0x1')]},'calleridname':{'type':Sequelize[_0xa2e9('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xa2e9('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa2e9('0x1')]},'dnid':{'type':Sequelize[_0xa2e9('0x1')]},'rdnis':{'type':Sequelize[_0xa2e9('0x1')]},'context':{'type':Sequelize[_0xa2e9('0x1')]},'extension':{'type':Sequelize[_0xa2e9('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa2e9('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa2e9('0x2')]},'leaveAt':{'type':Sequelize[_0xa2e9('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfbd6=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xfbd6,0x179));var _0x6fbd=function(_0x4fd451,_0x515fb3){_0x4fd451=_0x4fd451-0x0;var _0x4e7486=_0xfbd6[_0x4fd451];return _0x4e7486;};'use strict';var Sequelize=require(_0x6fbd('0x0'));module[_0x6fbd('0x1')]={'network':{'type':Sequelize[_0x6fbd('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6fbd('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6fbd('0x2')]},'uniqueid':{'type':Sequelize[_0x6fbd('0x2')]},'version':{'type':Sequelize[_0x6fbd('0x2')]},'callerid':{'type':Sequelize[_0x6fbd('0x2')]},'calleridname':{'type':Sequelize[_0x6fbd('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x6fbd('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x6fbd('0x2')]},'context':{'type':Sequelize[_0x6fbd('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6fbd('0x2')]},'enhanced':{'type':Sequelize[_0x6fbd('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x6fbd('0x2')]},'joinAt':{'type':Sequelize[_0x6fbd('0x3')]},'leaveAt':{'type':Sequelize[_0x6fbd('0x3')]},'bot':{'type':Sequelize[_0x6fbd('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f503be8..73ddee5 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 _0x7d37=['moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','intersection','fields','options','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise'];(function(_0x1e7817,_0x1565d8){var _0x185948=function(_0x5c0502){while(--_0x5c0502){_0x1e7817['push'](_0x1e7817['shift']());}};_0x185948(++_0x1565d8);}(_0x7d37,0x16f));var _0x77d3=function(_0x13ae93,_0x41a9cc){_0x13ae93=_0x13ae93-0x0;var _0x1fa90f=_0x7d37[_0x13ae93];return _0x1fa90f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x77d3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77d3('0x1'));var rp=require(_0x77d3('0x2'));var moment=require(_0x77d3('0x3'));var BPromise=require(_0x77d3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x77d3('0x5'));var sox=require(_0x77d3('0x6'));var csv=require(_0x77d3('0x7'));var ejs=require(_0x77d3('0x8'));var fs=require('fs');var fs_extra=require(_0x77d3('0x9'));var _=require(_0x77d3('0xa'));var squel=require(_0x77d3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x77d3('0xc'));var toCsv=require(_0x77d3('0x7'));var querystring=require(_0x77d3('0xd'));var Papa=require(_0x77d3('0xe'));var Redis=require(_0x77d3('0xf'));var authService=require(_0x77d3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x77d3('0x11'));var hardwareService=require(_0x77d3('0x12'));var logger=require(_0x77d3('0x13'))(_0x77d3('0x14'));var utils=require(_0x77d3('0x15'));var config=require(_0x77d3('0x16'));var licenseUtil=require(_0x77d3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab9c9,_0x4fd4aa){_0x4fd4aa=_0x4fd4aa||0xcc;return function(_0x1d40f4){if(_0x1d40f4){return _0x4ab9c9[_0x77d3('0x18')](_0x4fd4aa);}return _0x4ab9c9['status'](_0x4fd4aa)[_0x77d3('0x19')]();};}function respondWithResult(_0x5940a5,_0x3c29d5){_0x3c29d5=_0x3c29d5||0xc8;return function(_0x19fda0){if(_0x19fda0){return _0x5940a5['status'](_0x3c29d5)[_0x77d3('0x1a')](_0x19fda0);}};}function respondWithFilteredResult(_0x3d4f01,_0x4fd42c){return function(_0x2250f9){if(_0x2250f9){var _0x447870=typeof _0x4fd42c[_0x77d3('0x1b')]===_0x77d3('0x1c')&&typeof _0x4fd42c[_0x77d3('0x1d')]===_0x77d3('0x1c');var _0x4a348a=_0x2250f9['count'];var _0x349502=_0x447870?0x0:_0x4fd42c[_0x77d3('0x1b')];var _0x16f4e8=_0x447870?_0x2250f9[_0x77d3('0x1e')]:_0x4fd42c[_0x77d3('0x1b')]+_0x4fd42c[_0x77d3('0x1d')];var _0x27008b;if(_0x16f4e8>=_0x4a348a){_0x16f4e8=_0x4a348a;_0x27008b=0xc8;}else{_0x27008b=0xce;}_0x3d4f01[_0x77d3('0x1f')](_0x27008b);return _0x3d4f01[_0x77d3('0x20')](_0x77d3('0x21'),_0x349502+'-'+_0x16f4e8+'/'+_0x4a348a)[_0x77d3('0x1a')](_0x2250f9);}return null;};}function patchUpdates(_0x2a8a17){return function(_0x5353b4){try{jsonpatch['apply'](_0x5353b4,_0x2a8a17,!![]);}catch(_0x4161ec){return BPromise['reject'](_0x4161ec);}return _0x5353b4[_0x77d3('0x22')]();};}function saveUpdates(_0x5e47db,_0x3d8065){return function(_0x34f762){if(_0x34f762){return _0x34f762[_0x77d3('0x23')](_0x5e47db)[_0x77d3('0x24')](function(_0x4955e8){return _0x4955e8;});}return null;};}function removeEntity(_0x59a463,_0x2c9871){return function(_0x459454){if(_0x459454){return _0x459454[_0x77d3('0x25')]()[_0x77d3('0x24')](function(){_0x59a463[_0x77d3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26836c,_0x3fde2e){return function(_0x449da3){if(!_0x449da3){_0x26836c[_0x77d3('0x18')](0x194);}return _0x449da3;};}function handleError(_0x57abf4,_0x482c40){_0x482c40=_0x482c40||0x1f4;return function(_0x243011){logger[_0x77d3('0x26')](_0x243011[_0x77d3('0x27')]);if(_0x243011[_0x77d3('0x28')]){delete _0x243011['name'];}_0x57abf4['status'](_0x482c40)[_0x77d3('0x29')](_0x243011);};}exports[_0x77d3('0x2a')]=function(_0x4e900f,_0xdc078d){var _0x542ab8={},_0x468a70={},_0x310f23={'count':0x0,'rows':[]};var _0xae9d8f=_[_0x77d3('0x2b')](db[_0x77d3('0x2c')][_0x77d3('0x2d')],function(_0x55d688){return{'name':_0x55d688['fieldName'],'type':_0x55d688[_0x77d3('0x2e')][_0x77d3('0x2f')]};});_0x468a70[_0x77d3('0x30')]=_[_0x77d3('0x2b')](_0xae9d8f,_0x77d3('0x28'));_0x468a70[_0x77d3('0x31')]=_[_0x77d3('0x32')](_0x4e900f[_0x77d3('0x31')]);_0x468a70[_0x77d3('0x33')]=_['intersection'](_0x468a70[_0x77d3('0x30')],_0x468a70[_0x77d3('0x31')]);_0x542ab8[_0x77d3('0x34')]=_['intersection'](_0x468a70['model'],qs['fields'](_0x4e900f[_0x77d3('0x31')]['fields']));_0x542ab8[_0x77d3('0x34')]=_0x542ab8['attributes'][_0x77d3('0x35')]?_0x542ab8[_0x77d3('0x34')]:_0x468a70['model'];if(!_0x4e900f[_0x77d3('0x31')]['hasOwnProperty'](_0x77d3('0x36'))){_0x542ab8[_0x77d3('0x1d')]=qs[_0x77d3('0x1d')](_0x4e900f[_0x77d3('0x31')][_0x77d3('0x1d')]);_0x542ab8[_0x77d3('0x1b')]=qs['offset'](_0x4e900f[_0x77d3('0x31')][_0x77d3('0x1b')]);}_0x542ab8[_0x77d3('0x37')]=qs[_0x77d3('0x38')](_0x4e900f[_0x77d3('0x31')][_0x77d3('0x38')]);_0x542ab8['where']=qs[_0x77d3('0x33')](_['pick'](_0x4e900f[_0x77d3('0x31')],_0x468a70[_0x77d3('0x33')]),_0xae9d8f);if(_0x4e900f['query']['filter']){_0x542ab8[_0x77d3('0x39')]=_[_0x77d3('0x3a')](_0x542ab8[_0x77d3('0x39')],{'$or':_[_0x77d3('0x2b')](_0xae9d8f,function(_0x1098c9){if(_0x1098c9['type']!==_0x77d3('0x3b')){var _0x1b4f69={};_0x1b4f69[_0x1098c9[_0x77d3('0x28')]]={'$like':'%'+_0x4e900f[_0x77d3('0x31')][_0x77d3('0x3c')]+'%'};return _0x1b4f69;}})});}_0x542ab8=_[_0x77d3('0x3a')]({},_0x542ab8,_0x4e900f['options']);var _0x3019c9={'where':_0x542ab8['where']};return db['SquareReport'][_0x77d3('0x1e')](_0x3019c9)[_0x77d3('0x24')](function(_0x396d0d){_0x310f23[_0x77d3('0x1e')]=_0x396d0d;if(_0x4e900f[_0x77d3('0x31')][_0x77d3('0x3d')]){_0x542ab8[_0x77d3('0x3e')]=[{'all':!![]}];}return db[_0x77d3('0x2c')][_0x77d3('0x3f')](_0x542ab8);})['then'](function(_0x3ded67){_0x310f23[_0x77d3('0x40')]=_0x3ded67;return _0x310f23;})[_0x77d3('0x24')](respondWithFilteredResult(_0xdc078d,_0x542ab8))['catch'](handleError(_0xdc078d,null));};exports['show']=function(_0x285813,_0x16782b){var _0x458904={'raw':!![],'where':{'id':_0x285813[_0x77d3('0x41')]['id']}},_0x22eff3={};_0x22eff3[_0x77d3('0x30')]=_[_0x77d3('0x32')](db[_0x77d3('0x2c')][_0x77d3('0x2d')]);_0x22eff3[_0x77d3('0x31')]=_['keys'](_0x285813['query']);_0x22eff3[_0x77d3('0x33')]=_[_0x77d3('0x42')](_0x22eff3['model'],_0x22eff3[_0x77d3('0x31')]);_0x458904[_0x77d3('0x34')]=_['intersection'](_0x22eff3[_0x77d3('0x30')],qs['fields'](_0x285813[_0x77d3('0x31')][_0x77d3('0x43')]));_0x458904[_0x77d3('0x34')]=_0x458904[_0x77d3('0x34')][_0x77d3('0x35')]?_0x458904[_0x77d3('0x34')]:_0x22eff3[_0x77d3('0x30')];if(_0x285813[_0x77d3('0x31')][_0x77d3('0x3d')]){_0x458904[_0x77d3('0x3e')]=[{'all':!![]}];}_0x458904=_[_0x77d3('0x3a')]({},_0x458904,_0x285813[_0x77d3('0x44')]);return db[_0x77d3('0x2c')][_0x77d3('0x45')](_0x458904)[_0x77d3('0x24')](handleEntityNotFound(_0x16782b,null))[_0x77d3('0x24')](respondWithResult(_0x16782b,null))[_0x77d3('0x46')](handleError(_0x16782b,null));};exports[_0x77d3('0x47')]=function(_0x3b0d67,_0x4d07a0){return db[_0x77d3('0x2c')][_0x77d3('0x47')](_0x3b0d67[_0x77d3('0x48')],{})[_0x77d3('0x24')](respondWithResult(_0x4d07a0,0xc9))['catch'](handleError(_0x4d07a0,null));};exports[_0x77d3('0x23')]=function(_0x51f7fd,_0x491503){if(_0x51f7fd['body']['id']){delete _0x51f7fd[_0x77d3('0x48')]['id'];}return db['SquareReport'][_0x77d3('0x45')]({'where':{'id':_0x51f7fd[_0x77d3('0x41')]['id']}})[_0x77d3('0x24')](handleEntityNotFound(_0x491503,null))[_0x77d3('0x24')](saveUpdates(_0x51f7fd[_0x77d3('0x48')],null))[_0x77d3('0x24')](respondWithResult(_0x491503,null))[_0x77d3('0x46')](handleError(_0x491503,null));};exports[_0x77d3('0x25')]=function(_0xc0c02c,_0x450980){return db[_0x77d3('0x2c')][_0x77d3('0x45')]({'where':{'id':_0xc0c02c[_0x77d3('0x41')]['id']}})[_0x77d3('0x24')](handleEntityNotFound(_0x450980,null))[_0x77d3('0x24')](removeEntity(_0x450980,null))[_0x77d3('0x46')](handleError(_0x450980,null));};exports[_0x77d3('0x49')]=function(_0x2ad755,_0x15c1b5){return db['SquareReport'][_0x77d3('0x49')]()[_0x77d3('0x24')](respondWithResult(_0x15c1b5,null))['catch'](handleError(_0x15c1b5,null));}; \ No newline at end of file +var _0x5a34=['zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareReport','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf'];(function(_0x475c44,_0x22f324){var _0x66edde=function(_0x53756b){while(--_0x53756b){_0x475c44['push'](_0x475c44['shift']());}};_0x66edde(++_0x22f324);}(_0x5a34,0xe5));var _0x45a3=function(_0x568e05,_0x4881b6){_0x568e05=_0x568e05-0x0;var _0x36e5d0=_0x5a34[_0x568e05];return _0x36e5d0;};'use strict';var emlformat=require(_0x45a3('0x0'));var rimraf=require(_0x45a3('0x1'));var zipdir=require(_0x45a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45a3('0x3'));var moment=require(_0x45a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45a3('0x5'));var util=require(_0x45a3('0x6'));var path=require(_0x45a3('0x7'));var sox=require(_0x45a3('0x8'));var csv=require(_0x45a3('0x9'));var ejs=require(_0x45a3('0xa'));var fs=require('fs');var fs_extra=require(_0x45a3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45a3('0xc'));var deskjs=require(_0x45a3('0xd'));var toCsv=require(_0x45a3('0x9'));var querystring=require(_0x45a3('0xe'));var Papa=require('papaparse');var Redis=require(_0x45a3('0xf'));var authService=require(_0x45a3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x45a3('0x11'));var hardwareService=require(_0x45a3('0x12'));var logger=require(_0x45a3('0x13'))(_0x45a3('0x14'));var utils=require(_0x45a3('0x15'));var config=require(_0x45a3('0x16'));var licenseUtil=require(_0x45a3('0x17'));var db=require(_0x45a3('0x18'))['db'];function respondWithStatusCode(_0x5918a9,_0x3ec360){_0x3ec360=_0x3ec360||0xcc;return function(_0xe550dc){if(_0xe550dc){return _0x5918a9[_0x45a3('0x19')](_0x3ec360);}return _0x5918a9[_0x45a3('0x1a')](_0x3ec360)[_0x45a3('0x1b')]();};}function respondWithResult(_0x2a66e3,_0x5b5e7b){_0x5b5e7b=_0x5b5e7b||0xc8;return function(_0x3871c3){if(_0x3871c3){return _0x2a66e3[_0x45a3('0x1a')](_0x5b5e7b)[_0x45a3('0x1c')](_0x3871c3);}};}function respondWithFilteredResult(_0x31f887,_0x4078df){return function(_0x4da9c2){if(_0x4da9c2){var _0x11efc1=typeof _0x4078df[_0x45a3('0x1d')]===_0x45a3('0x1e')&&typeof _0x4078df['limit']===_0x45a3('0x1e');var _0x18c3bf=_0x4da9c2[_0x45a3('0x1f')];var _0xa5825f=_0x11efc1?0x0:_0x4078df[_0x45a3('0x1d')];var _0x336d0b=_0x11efc1?_0x4da9c2[_0x45a3('0x1f')]:_0x4078df[_0x45a3('0x1d')]+_0x4078df[_0x45a3('0x20')];var _0x25180e;if(_0x336d0b>=_0x18c3bf){_0x336d0b=_0x18c3bf;_0x25180e=0xc8;}else{_0x25180e=0xce;}_0x31f887[_0x45a3('0x1a')](_0x25180e);return _0x31f887[_0x45a3('0x21')](_0x45a3('0x22'),_0xa5825f+'-'+_0x336d0b+'/'+_0x18c3bf)['json'](_0x4da9c2);}return null;};}function patchUpdates(_0x3de8e7){return function(_0x2bace4){try{jsonpatch[_0x45a3('0x23')](_0x2bace4,_0x3de8e7,!![]);}catch(_0x40d4b9){return BPromise[_0x45a3('0x24')](_0x40d4b9);}return _0x2bace4[_0x45a3('0x25')]();};}function saveUpdates(_0x55bd0e,_0xea54a3){return function(_0x436143){if(_0x436143){return _0x436143[_0x45a3('0x26')](_0x55bd0e)['then'](function(_0xd9b445){return _0xd9b445;});}return null;};}function removeEntity(_0xbb6ef3,_0x4f55fb){return function(_0x5cfe94){if(_0x5cfe94){return _0x5cfe94[_0x45a3('0x27')]()[_0x45a3('0x28')](function(){_0xbb6ef3[_0x45a3('0x1a')](0xcc)[_0x45a3('0x1b')]();});}};}function handleEntityNotFound(_0x32d271,_0x3db411){return function(_0x1e400b){if(!_0x1e400b){_0x32d271[_0x45a3('0x19')](0x194);}return _0x1e400b;};}function handleError(_0x31cef3,_0x299c1b){_0x299c1b=_0x299c1b||0x1f4;return function(_0xd29bae){logger['error'](_0xd29bae[_0x45a3('0x29')]);if(_0xd29bae[_0x45a3('0x2a')]){delete _0xd29bae[_0x45a3('0x2a')];}_0x31cef3[_0x45a3('0x1a')](_0x299c1b)[_0x45a3('0x2b')](_0xd29bae);};}exports['index']=function(_0x4bd3de,_0x332613){var _0x47ebad={},_0x365552={},_0xaa1a48={'count':0x0,'rows':[]};var _0x4a4aa1=_[_0x45a3('0x2c')](db['SquareReport'][_0x45a3('0x2d')],function(_0x51a048){return{'name':_0x51a048[_0x45a3('0x2e')],'type':_0x51a048[_0x45a3('0x2f')][_0x45a3('0x30')]};});_0x365552[_0x45a3('0x31')]=_['map'](_0x4a4aa1,'name');_0x365552[_0x45a3('0x32')]=_[_0x45a3('0x33')](_0x4bd3de[_0x45a3('0x32')]);_0x365552[_0x45a3('0x34')]=_['intersection'](_0x365552[_0x45a3('0x31')],_0x365552[_0x45a3('0x32')]);_0x47ebad[_0x45a3('0x35')]=_[_0x45a3('0x36')](_0x365552['model'],qs[_0x45a3('0x37')](_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x37')]));_0x47ebad[_0x45a3('0x35')]=_0x47ebad[_0x45a3('0x35')][_0x45a3('0x38')]?_0x47ebad[_0x45a3('0x35')]:_0x365552['model'];if(!_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x39')](_0x45a3('0x3a'))){_0x47ebad['limit']=qs[_0x45a3('0x20')](_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x20')]);_0x47ebad[_0x45a3('0x1d')]=qs['offset'](_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x1d')]);}_0x47ebad[_0x45a3('0x3b')]=qs[_0x45a3('0x3c')](_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x3c')]);_0x47ebad[_0x45a3('0x3d')]=qs[_0x45a3('0x34')](_[_0x45a3('0x3e')](_0x4bd3de['query'],_0x365552[_0x45a3('0x34')]),_0x4a4aa1);if(_0x4bd3de[_0x45a3('0x32')]['filter']){_0x47ebad[_0x45a3('0x3d')]=_[_0x45a3('0x3f')](_0x47ebad['where'],{'$or':_[_0x45a3('0x2c')](_0x4a4aa1,function(_0x4c55d1){if(_0x4c55d1[_0x45a3('0x2f')]!==_0x45a3('0x40')){var _0x293648={};_0x293648[_0x4c55d1[_0x45a3('0x2a')]]={'$like':'%'+_0x4bd3de[_0x45a3('0x32')][_0x45a3('0x41')]+'%'};return _0x293648;}})});}_0x47ebad=_[_0x45a3('0x3f')]({},_0x47ebad,_0x4bd3de[_0x45a3('0x42')]);var _0x1e134f={'where':_0x47ebad[_0x45a3('0x3d')]};return db[_0x45a3('0x43')][_0x45a3('0x1f')](_0x1e134f)[_0x45a3('0x28')](function(_0xa1022f){_0xaa1a48[_0x45a3('0x1f')]=_0xa1022f;if(_0x4bd3de[_0x45a3('0x32')]['includeAll']){_0x47ebad[_0x45a3('0x44')]=[{'all':!![]}];}return db[_0x45a3('0x43')]['findAll'](_0x47ebad);})['then'](function(_0x10f078){_0xaa1a48['rows']=_0x10f078;return _0xaa1a48;})[_0x45a3('0x28')](respondWithFilteredResult(_0x332613,_0x47ebad))[_0x45a3('0x45')](handleError(_0x332613,null));};exports[_0x45a3('0x46')]=function(_0x8eda0d,_0x51b9a3){var _0x1ef52a={'raw':!![],'where':{'id':_0x8eda0d[_0x45a3('0x47')]['id']}},_0x3f8d78={};_0x3f8d78[_0x45a3('0x31')]=_['keys'](db[_0x45a3('0x43')][_0x45a3('0x2d')]);_0x3f8d78[_0x45a3('0x32')]=_[_0x45a3('0x33')](_0x8eda0d['query']);_0x3f8d78[_0x45a3('0x34')]=_[_0x45a3('0x36')](_0x3f8d78[_0x45a3('0x31')],_0x3f8d78[_0x45a3('0x32')]);_0x1ef52a[_0x45a3('0x35')]=_[_0x45a3('0x36')](_0x3f8d78[_0x45a3('0x31')],qs[_0x45a3('0x37')](_0x8eda0d[_0x45a3('0x32')][_0x45a3('0x37')]));_0x1ef52a[_0x45a3('0x35')]=_0x1ef52a[_0x45a3('0x35')][_0x45a3('0x38')]?_0x1ef52a[_0x45a3('0x35')]:_0x3f8d78[_0x45a3('0x31')];if(_0x8eda0d[_0x45a3('0x32')][_0x45a3('0x48')]){_0x1ef52a[_0x45a3('0x44')]=[{'all':!![]}];}_0x1ef52a=_[_0x45a3('0x3f')]({},_0x1ef52a,_0x8eda0d[_0x45a3('0x42')]);return db[_0x45a3('0x43')][_0x45a3('0x49')](_0x1ef52a)[_0x45a3('0x28')](handleEntityNotFound(_0x51b9a3,null))[_0x45a3('0x28')](respondWithResult(_0x51b9a3,null))['catch'](handleError(_0x51b9a3,null));};exports[_0x45a3('0x4a')]=function(_0x161c68,_0x27a072){return db[_0x45a3('0x43')][_0x45a3('0x4a')](_0x161c68['body'],{})['then'](respondWithResult(_0x27a072,0xc9))[_0x45a3('0x45')](handleError(_0x27a072,null));};exports[_0x45a3('0x26')]=function(_0x13f005,_0x388026){if(_0x13f005[_0x45a3('0x4b')]['id']){delete _0x13f005[_0x45a3('0x4b')]['id'];}return db[_0x45a3('0x43')][_0x45a3('0x49')]({'where':{'id':_0x13f005['params']['id']}})['then'](handleEntityNotFound(_0x388026,null))[_0x45a3('0x28')](saveUpdates(_0x13f005[_0x45a3('0x4b')],null))[_0x45a3('0x28')](respondWithResult(_0x388026,null))[_0x45a3('0x45')](handleError(_0x388026,null));};exports['destroy']=function(_0x82a4b6,_0x22d647){return db[_0x45a3('0x43')][_0x45a3('0x49')]({'where':{'id':_0x82a4b6[_0x45a3('0x47')]['id']}})[_0x45a3('0x28')](handleEntityNotFound(_0x22d647,null))[_0x45a3('0x28')](removeEntity(_0x22d647,null))[_0x45a3('0x45')](handleError(_0x22d647,null));};exports['describe']=function(_0x2d0540,_0x3ee80a){return db['SquareReport'][_0x45a3('0x4c')]()[_0x45a3('0x28')](respondWithResult(_0x3ee80a,null))[_0x45a3('0x45')](handleError(_0x3ee80a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b5e4629..21d071f 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 _0x81db=['bluebird','request-promise','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','leaveAt','lodash','util','../../config/logger','moment'];(function(_0x3ec373,_0x5cf045){var _0x4c8738=function(_0x3c0498){while(--_0x3c0498){_0x3ec373['push'](_0x3ec373['shift']());}};_0x4c8738(++_0x5cf045);}(_0x81db,0x194));var _0xb81d=function(_0x162f4b,_0x31b569){_0x162f4b=_0x162f4b-0x0;var _0x57b00b=_0x81db[_0x162f4b];return _0x57b00b;};'use strict';var _=require(_0xb81d('0x0'));var util=require(_0xb81d('0x1'));var logger=require(_0xb81d('0x2'))('api');var moment=require(_0xb81d('0x3'));var BPromise=require(_0xb81d('0x4'));var rp=require(_0xb81d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb81d('0x6'));var attributes=require(_0xb81d('0x7'));module['exports']=function(_0x40dc71,_0x56d463){return _0x40dc71[_0xb81d('0x8')]('SquareReport',attributes,{'tableName':_0xb81d('0x9'),'paranoid':![],'indexes':[{'name':_0xb81d('0xa'),'fields':['uniqueid','project_name']},{'name':_0xb81d('0xb'),'fields':[_0xb81d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cdf=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2560bc,_0x2e4185){var _0x128381=function(_0x37beab){while(--_0x37beab){_0x2560bc['push'](_0x2560bc['shift']());}};_0x128381(++_0x2e4185);}(_0x4cdf,0x81));var _0xf4cd=function(_0x41def8,_0x446ae9){_0x41def8=_0x41def8-0x0;var _0x374a00=_0x4cdf[_0x41def8];return _0x374a00;};'use strict';var _=require('lodash');var util=require(_0xf4cd('0x0'));var logger=require('../../config/logger')(_0xf4cd('0x1'));var moment=require('moment');var BPromise=require(_0xf4cd('0x2'));var rp=require(_0xf4cd('0x3'));var fs=require('fs');var path=require(_0xf4cd('0x4'));var rimraf=require(_0xf4cd('0x5'));var config=require(_0xf4cd('0x6'));var attributes=require(_0xf4cd('0x7'));module[_0xf4cd('0x8')]=function(_0x6ce84b,_0x442ad7){return _0x6ce84b[_0xf4cd('0x9')]('SquareReport',attributes,{'tableName':_0xf4cd('0xa'),'paranoid':![],'indexes':[{'name':_0xf4cd('0xb'),'fields':[_0xf4cd('0xc'),_0xf4cd('0xd')]},{'name':'leaveAt','fields':[_0xf4cd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9cc2ffd..19ee94a 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 _0xab29=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','attributes','limit','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x1d950d,_0x40524e){var _0xf637d8=function(_0x11779e){while(--_0x11779e){_0x1d950d['push'](_0x1d950d['shift']());}};_0xf637d8(++_0x40524e);}(_0xab29,0x103));var _0x9ab2=function(_0x2f6ac2,_0x3b0e69){_0x2f6ac2=_0x2f6ac2-0x0;var _0x3f06d7=_0xab29[_0x2f6ac2];return _0x3f06d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ab2('0x0'));var BPromise=require(_0x9ab2('0x1'));var rs=require(_0x9ab2('0x2'));var fs=require('fs');var Redis=require(_0x9ab2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab2('0x4'));var logger=require(_0x9ab2('0x5'))(_0x9ab2('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ab2('0x7'));var client=jayson['client'][_0x9ab2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26626d,_0x40f614,_0x1bee42){return new BPromise(function(_0x50dfed,_0x445e1e){return client[_0x9ab2('0x9')](_0x26626d,_0x1bee42)[_0x9ab2('0xa')](function(_0x1aa753){logger[_0x9ab2('0xb')](_0x9ab2('0xc'),_0x40f614,_0x9ab2('0xd'));logger[_0x9ab2('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x40f614,_0x9ab2('0xd'),JSON[_0x9ab2('0xf')](_0x1aa753));if(_0x1aa753['error']){if(_0x1aa753['error'][_0x9ab2('0x10')]===0x1f4){logger[_0x9ab2('0x11')](_0x9ab2('0xc'),_0x40f614,_0x1aa753['error'][_0x9ab2('0x12')]);return _0x445e1e(_0x1aa753[_0x9ab2('0x11')]['message']);}logger[_0x9ab2('0x11')](_0x9ab2('0xc'),_0x40f614,_0x1aa753[_0x9ab2('0x11')][_0x9ab2('0x12')]);return _0x50dfed(_0x1aa753[_0x9ab2('0x11')][_0x9ab2('0x12')]);}else{logger['info'](_0x9ab2('0xc'),_0x40f614,'request\x20sent');_0x50dfed(_0x1aa753[_0x9ab2('0x13')]['message']);}})['catch'](function(_0x53f7e0){logger[_0x9ab2('0x11')](_0x9ab2('0xc'),_0x40f614,_0x53f7e0);_0x445e1e(_0x53f7e0);});});}exports[_0x9ab2('0x14')]=function(_0x27fa09){var _0x189b22=this;return new Promise(function(_0xb93bf1,_0x33f346){return db[_0x9ab2('0x15')][_0x9ab2('0x16')](_0x27fa09[_0x9ab2('0x17')],{'raw':_0x27fa09[_0x9ab2('0x18')]?_0x27fa09[_0x9ab2('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53c079){logger[_0x9ab2('0xb')]('CreateSquareReport',_0x27fa09);logger['debug'](_0x9ab2('0x14'),_0x27fa09,JSON[_0x9ab2('0xf')](_0x53c079));_0xb93bf1(_0x53c079);})['catch'](function(_0x3b4d86){logger[_0x9ab2('0x11')](_0x9ab2('0x14'),_0x3b4d86[_0x9ab2('0x12')],_0x27fa09);_0x33f346(_0x189b22['error'](0x1f4,_0x3b4d86[_0x9ab2('0x12')]));});});};exports[_0x9ab2('0x19')]=function(_0x5b672f){var _0x4477c7=this;return new Promise(function(_0x1f6332,_0x2a5ce7){return db[_0x9ab2('0x15')][_0x9ab2('0x1a')](_0x5b672f[_0x9ab2('0x17')],{'raw':_0x5b672f[_0x9ab2('0x18')]?_0x5b672f['options'][_0x9ab2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b672f['options']?_0x5b672f[_0x9ab2('0x18')]['where']||null:null,'attributes':_0x5b672f[_0x9ab2('0x18')]?_0x5b672f['options'][_0x9ab2('0x1c')]||null:null,'limit':_0x5b672f[_0x9ab2('0x18')]?_0x5b672f[_0x9ab2('0x18')][_0x9ab2('0x1d')]||null:null})[_0x9ab2('0xa')](function(_0x5d5d97){logger['info']('UpdateSquareReport',_0x5b672f);logger[_0x9ab2('0xe')](_0x9ab2('0x19'),_0x5b672f,JSON['stringify'](_0x5d5d97));_0x1f6332(_0x5d5d97);})['catch'](function(_0x18e776){logger[_0x9ab2('0x11')](_0x9ab2('0x19'),_0x18e776['message'],_0x5b672f);_0x2a5ce7(_0x4477c7[_0x9ab2('0x11')](0x1f4,_0x18e776[_0x9ab2('0x12')]));});});}; \ No newline at end of file +var _0x5f65=['where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update'];(function(_0x162f7d,_0x3dba7a){var _0x5a65af=function(_0x3708cd){while(--_0x3708cd){_0x162f7d['push'](_0x162f7d['shift']());}};_0x5a65af(++_0x3dba7a);}(_0x5f65,0x1f3));var _0x55f6=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x5f65[_0x1c34e7];return _0x378cb1;};'use strict';var _=require('lodash');var util=require(_0x55f6('0x0'));var moment=require(_0x55f6('0x1'));var BPromise=require('bluebird');var rs=require(_0x55f6('0x2'));var fs=require('fs');var Redis=require(_0x55f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x55f6('0x4'));var logger=require(_0x55f6('0x5'))('rpc');var config=require(_0x55f6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5aab4d,_0x5c2a56,_0x24187e){return new BPromise(function(_0x38df4f,_0x476116){return client[_0x55f6('0x8')](_0x5aab4d,_0x24187e)['then'](function(_0x1b9767){logger[_0x55f6('0x9')]('SquareReport,\x20%s,\x20%s',_0x5c2a56,_0x55f6('0xa'));logger[_0x55f6('0xb')](_0x55f6('0xc'),_0x5c2a56,_0x55f6('0xa'),JSON[_0x55f6('0xd')](_0x1b9767));if(_0x1b9767[_0x55f6('0xe')]){if(_0x1b9767[_0x55f6('0xe')][_0x55f6('0xf')]===0x1f4){logger['error'](_0x55f6('0x10'),_0x5c2a56,_0x1b9767[_0x55f6('0xe')][_0x55f6('0x11')]);return _0x476116(_0x1b9767['error']['message']);}logger[_0x55f6('0xe')](_0x55f6('0x10'),_0x5c2a56,_0x1b9767[_0x55f6('0xe')][_0x55f6('0x11')]);return _0x38df4f(_0x1b9767['error'][_0x55f6('0x11')]);}else{logger[_0x55f6('0x9')]('SquareReport,\x20%s,\x20%s',_0x5c2a56,_0x55f6('0xa'));_0x38df4f(_0x1b9767[_0x55f6('0x12')]['message']);}})[_0x55f6('0x13')](function(_0x5aedb2){logger['error'](_0x55f6('0x10'),_0x5c2a56,_0x5aedb2);_0x476116(_0x5aedb2);});});}exports[_0x55f6('0x14')]=function(_0x583ca0){var _0x15a1ef=this;return new Promise(function(_0x3e0ff4,_0x33779b){return db[_0x55f6('0x15')][_0x55f6('0x16')](_0x583ca0[_0x55f6('0x17')],{'raw':_0x583ca0[_0x55f6('0x18')]?_0x583ca0[_0x55f6('0x18')][_0x55f6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1fd50e){logger[_0x55f6('0x9')]('CreateSquareReport',_0x583ca0);logger[_0x55f6('0xb')](_0x55f6('0x14'),_0x583ca0,JSON[_0x55f6('0xd')](_0x1fd50e));_0x3e0ff4(_0x1fd50e);})[_0x55f6('0x13')](function(_0x4e6474){logger[_0x55f6('0xe')](_0x55f6('0x14'),_0x4e6474[_0x55f6('0x11')],_0x583ca0);_0x33779b(_0x15a1ef[_0x55f6('0xe')](0x1f4,_0x4e6474[_0x55f6('0x11')]));});});};exports[_0x55f6('0x1a')]=function(_0x3d0228){var _0x57f363=this;return new Promise(function(_0x55cd7e,_0x56782f){return db[_0x55f6('0x15')][_0x55f6('0x1b')](_0x3d0228[_0x55f6('0x17')],{'raw':_0x3d0228['options']?_0x3d0228[_0x55f6('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0228['options']?_0x3d0228[_0x55f6('0x18')][_0x55f6('0x1c')]||null:null,'attributes':_0x3d0228['options']?_0x3d0228['options'][_0x55f6('0x1d')]||null:null,'limit':_0x3d0228[_0x55f6('0x18')]?_0x3d0228['options'][_0x55f6('0x1e')]||null:null})['then'](function(_0x46a0bb){logger[_0x55f6('0x9')](_0x55f6('0x1a'),_0x3d0228);logger[_0x55f6('0xb')](_0x55f6('0x1a'),_0x3d0228,JSON[_0x55f6('0xd')](_0x46a0bb));_0x55cd7e(_0x46a0bb);})['catch'](function(_0x557508){logger[_0x55f6('0xe')](_0x55f6('0x1a'),_0x557508['message'],_0x3d0228);_0x56782f(_0x57f363[_0x55f6('0xe')](0x1f4,_0x557508['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 42ba5da..25c9ac2 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 _0x2058=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x293cdc,_0x417fee){var _0x3904f0=function(_0x167f59){while(--_0x167f59){_0x293cdc['push'](_0x293cdc['shift']());}};_0x3904f0(++_0x417fee);}(_0x2058,0x8a));var _0x8205=function(_0x32c443,_0x58feaa){_0x32c443=_0x32c443-0x0;var _0x172bd3=_0x2058[_0x32c443];return _0x172bd3;};'use strict';var multer=require(_0x8205('0x0'));var util=require('util');var path=require(_0x8205('0x1'));var timeout=require(_0x8205('0x2'));var express=require(_0x8205('0x3'));var router=express[_0x8205('0x4')]();var fs_extra=require(_0x8205('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8205('0x6'));var config=require(_0x8205('0x7'));var controller=require(_0x8205('0x8'));router[_0x8205('0x9')]('/',auth[_0x8205('0xa')](),controller['index']);router[_0x8205('0x9')]('/describe',auth[_0x8205('0xa')](),controller[_0x8205('0xb')]);router[_0x8205('0x9')](_0x8205('0xc'),auth['isAuthenticated'](),controller[_0x8205('0xd')]);router[_0x8205('0xe')]('/',auth[_0x8205('0xa')](),controller['create']);router[_0x8205('0xf')](_0x8205('0xc'),auth[_0x8205('0xa')](),controller[_0x8205('0x10')]);router[_0x8205('0x11')](_0x8205('0xc'),auth['isAuthenticated'](),controller[_0x8205('0x12')]);module[_0x8205('0x13')]=router; \ No newline at end of file +var _0x907d=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','/describe','create','put','update','delete','exports','multer'];(function(_0x4ee9b1,_0x46328c){var _0x3f3cec=function(_0x3f25a6){while(--_0x3f25a6){_0x4ee9b1['push'](_0x4ee9b1['shift']());}};_0x3f3cec(++_0x46328c);}(_0x907d,0x87));var _0xd907=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x907d[_0x2962b4];return _0x411b7d;};'use strict';var multer=require(_0xd907('0x0'));var util=require(_0xd907('0x1'));var path=require('path');var timeout=require(_0xd907('0x2'));var express=require(_0xd907('0x3'));var router=express[_0xd907('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd907('0x5'));var interaction=require(_0xd907('0x6'));var config=require(_0xd907('0x7'));var controller=require(_0xd907('0x8'));router['get']('/',auth[_0xd907('0x9')](),controller['index']);router[_0xd907('0xa')](_0xd907('0xb'),auth[_0xd907('0x9')](),controller['describe']);router[_0xd907('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd907('0x9')](),controller[_0xd907('0xc')]);router[_0xd907('0xd')]('/:id',auth[_0xd907('0x9')](),controller[_0xd907('0xe')]);router[_0xd907('0xf')]('/:id',auth[_0xd907('0x9')](),controller['destroy']);module[_0xd907('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 71353ec..1a4dcf9 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 _0x48a6=['TEXT','exports','STRING'];(function(_0x2e3533,_0x5f2dff){var _0x558b82=function(_0x5bc354){while(--_0x5bc354){_0x2e3533['push'](_0x2e3533['shift']());}};_0x558b82(++_0x5f2dff);}(_0x48a6,0x17b));var _0x648a=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0x48a6[_0x3789b9];return _0x4d020d;};'use strict';var Sequelize=require('sequelize');module[_0x648a('0x0')]={'uniqueid':{'type':Sequelize[_0x648a('0x1')]},'node':{'type':Sequelize[_0x648a('0x1')]},'application':{'type':Sequelize[_0x648a('0x1')]},'data':{'type':Sequelize[_0x648a('0x2')]},'project_name':{'type':Sequelize[_0x648a('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0b0=['exports','STRING','sequelize'];(function(_0x3d43cb,_0x405dc5){var _0x9feba6=function(_0x22d24f){while(--_0x22d24f){_0x3d43cb['push'](_0x3d43cb['shift']());}};_0x9feba6(++_0x405dc5);}(_0xe0b0,0x164));var _0x0e0b=function(_0xd53bb7,_0xe8416b){_0xd53bb7=_0xd53bb7-0x0;var _0x326d9b=_0xe0b0[_0xd53bb7];return _0x326d9b;};'use strict';var Sequelize=require(_0x0e0b('0x0'));module[_0x0e0b('0x1')]={'uniqueid':{'type':Sequelize[_0x0e0b('0x2')]},'node':{'type':Sequelize[_0x0e0b('0x2')]},'application':{'type':Sequelize[_0x0e0b('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0e0b('0x2')]},'callerid':{'type':Sequelize[_0x0e0b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d1cf5d3..6b984a7 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 _0x8bfb=['undefined','count','limit','Content-Range','save','update','then','destroy','end','name','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset'];(function(_0x4dd45c,_0x31eb72){var _0x5979d7=function(_0x4c1c9a){while(--_0x4c1c9a){_0x4dd45c['push'](_0x4dd45c['shift']());}};_0x5979d7(++_0x31eb72);}(_0x8bfb,0x17f));var _0xb8bf=function(_0x53d9c8,_0x1d1bc2){_0x53d9c8=_0x53d9c8-0x0;var _0x4a12a5=_0x8bfb[_0x53d9c8];return _0x4a12a5;};'use strict';var emlformat=require(_0xb8bf('0x0'));var rimraf=require(_0xb8bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8bf('0x2'));var rp=require(_0xb8bf('0x3'));var moment=require(_0xb8bf('0x4'));var BPromise=require(_0xb8bf('0x5'));var Mustache=require(_0xb8bf('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb8bf('0x7'));var ejs=require(_0xb8bf('0x8'));var fs=require('fs');var fs_extra=require(_0xb8bf('0x9'));var _=require(_0xb8bf('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb8bf('0xb'));var deskjs=require(_0xb8bf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8bf('0xd'));var Redis=require(_0xb8bf('0xe'));var authService=require(_0xb8bf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8bf('0x10'));var logger=require(_0xb8bf('0x11'))(_0xb8bf('0x12'));var utils=require(_0xb8bf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb8bf('0x14'))['db'];function respondWithStatusCode(_0x55ea6d,_0x3a8aa9){_0x3a8aa9=_0x3a8aa9||0xcc;return function(_0x520856){if(_0x520856){return _0x55ea6d[_0xb8bf('0x15')](_0x3a8aa9);}return _0x55ea6d[_0xb8bf('0x16')](_0x3a8aa9)['end']();};}function respondWithResult(_0x21bbf9,_0x3de644){_0x3de644=_0x3de644||0xc8;return function(_0x41fbed){if(_0x41fbed){return _0x21bbf9[_0xb8bf('0x16')](_0x3de644)[_0xb8bf('0x17')](_0x41fbed);}};}function respondWithFilteredResult(_0x90f7f5,_0x274409){return function(_0xdbefb8){if(_0xdbefb8){var _0x117fd4=typeof _0x274409[_0xb8bf('0x18')]===_0xb8bf('0x19')&&typeof _0x274409['limit']===_0xb8bf('0x19');var _0x51216e=_0xdbefb8[_0xb8bf('0x1a')];var _0x327256=_0x117fd4?0x0:_0x274409[_0xb8bf('0x18')];var _0x234ede=_0x117fd4?_0xdbefb8[_0xb8bf('0x1a')]:_0x274409[_0xb8bf('0x18')]+_0x274409[_0xb8bf('0x1b')];var _0x286b0e;if(_0x234ede>=_0x51216e){_0x234ede=_0x51216e;_0x286b0e=0xc8;}else{_0x286b0e=0xce;}_0x90f7f5[_0xb8bf('0x16')](_0x286b0e);return _0x90f7f5['set'](_0xb8bf('0x1c'),_0x327256+'-'+_0x234ede+'/'+_0x51216e)[_0xb8bf('0x17')](_0xdbefb8);}return null;};}function patchUpdates(_0x29bf85){return function(_0x4057cc){try{jsonpatch['apply'](_0x4057cc,_0x29bf85,!![]);}catch(_0x21fda0){return BPromise['reject'](_0x21fda0);}return _0x4057cc[_0xb8bf('0x1d')]();};}function saveUpdates(_0x3639c7,_0x4689d1){return function(_0x1f4551){if(_0x1f4551){return _0x1f4551[_0xb8bf('0x1e')](_0x3639c7)[_0xb8bf('0x1f')](function(_0x266bca){return _0x266bca;});}return null;};}function removeEntity(_0x3c353e,_0x3ed390){return function(_0x3c1b70){if(_0x3c1b70){return _0x3c1b70[_0xb8bf('0x20')]()[_0xb8bf('0x1f')](function(){_0x3c353e[_0xb8bf('0x16')](0xcc)[_0xb8bf('0x21')]();});}};}function handleEntityNotFound(_0x28adba,_0x3a42a0){return function(_0x1601c){if(!_0x1601c){_0x28adba[_0xb8bf('0x15')](0x194);}return _0x1601c;};}function handleError(_0x4137da,_0x13e697){_0x13e697=_0x13e697||0x1f4;return function(_0x40fe3d){logger['error'](_0x40fe3d['stack']);if(_0x40fe3d[_0xb8bf('0x22')]){delete _0x40fe3d['name'];}_0x4137da['status'](_0x13e697)['send'](_0x40fe3d);};}exports[_0xb8bf('0x23')]=function(_0xec317d,_0x5386d9){var _0x23d307={},_0x32f36e={},_0x45ad74={'count':0x0,'rows':[]};var _0x54b77d=_[_0xb8bf('0x24')](db['SquareDetailsReport'][_0xb8bf('0x25')],function(_0x248366){return{'name':_0x248366[_0xb8bf('0x26')],'type':_0x248366[_0xb8bf('0x27')]['key']};});_0x32f36e['model']=_[_0xb8bf('0x24')](_0x54b77d,'name');_0x32f36e['query']=_[_0xb8bf('0x28')](_0xec317d[_0xb8bf('0x29')]);_0x32f36e['filters']=_[_0xb8bf('0x2a')](_0x32f36e[_0xb8bf('0x2b')],_0x32f36e[_0xb8bf('0x29')]);_0x23d307[_0xb8bf('0x2c')]=_[_0xb8bf('0x2a')](_0x32f36e[_0xb8bf('0x2b')],qs[_0xb8bf('0x2d')](_0xec317d[_0xb8bf('0x29')][_0xb8bf('0x2d')]));_0x23d307[_0xb8bf('0x2c')]=_0x23d307[_0xb8bf('0x2c')][_0xb8bf('0x2e')]?_0x23d307[_0xb8bf('0x2c')]:_0x32f36e[_0xb8bf('0x2b')];if(!_0xec317d[_0xb8bf('0x29')][_0xb8bf('0x2f')]('nolimit')){_0x23d307[_0xb8bf('0x1b')]=qs[_0xb8bf('0x1b')](_0xec317d[_0xb8bf('0x29')][_0xb8bf('0x1b')]);_0x23d307[_0xb8bf('0x18')]=qs[_0xb8bf('0x18')](_0xec317d[_0xb8bf('0x29')]['offset']);}_0x23d307[_0xb8bf('0x30')]=qs['sort'](_0xec317d[_0xb8bf('0x29')][_0xb8bf('0x31')]);_0x23d307[_0xb8bf('0x32')]=qs[_0xb8bf('0x33')](_[_0xb8bf('0x34')](_0xec317d[_0xb8bf('0x29')],_0x32f36e[_0xb8bf('0x33')]),_0x54b77d);if(_0xec317d[_0xb8bf('0x29')]['filter']){_0x23d307[_0xb8bf('0x32')]=_[_0xb8bf('0x35')](_0x23d307[_0xb8bf('0x32')],{'$or':_[_0xb8bf('0x24')](_0x54b77d,function(_0x6bca26){if(_0x6bca26[_0xb8bf('0x27')]!==_0xb8bf('0x36')){var _0x212faf={};_0x212faf[_0x6bca26['name']]={'$like':'%'+_0xec317d[_0xb8bf('0x29')]['filter']+'%'};return _0x212faf;}})});}_0x23d307=_[_0xb8bf('0x35')]({},_0x23d307,_0xec317d['options']);var _0x3377b3={'where':_0x23d307[_0xb8bf('0x32')]};return db[_0xb8bf('0x37')][_0xb8bf('0x1a')](_0x3377b3)[_0xb8bf('0x1f')](function(_0x6e4d5c){_0x45ad74[_0xb8bf('0x1a')]=_0x6e4d5c;if(_0xec317d[_0xb8bf('0x29')][_0xb8bf('0x38')]){_0x23d307[_0xb8bf('0x39')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xb8bf('0x3a')](_0x23d307);})[_0xb8bf('0x1f')](function(_0x4f7636){_0x45ad74[_0xb8bf('0x3b')]=_0x4f7636;return _0x45ad74;})[_0xb8bf('0x1f')](respondWithFilteredResult(_0x5386d9,_0x23d307))['catch'](handleError(_0x5386d9,null));};exports[_0xb8bf('0x3c')]=function(_0x44b591,_0x377e4f){var _0x5924da={'raw':!![],'where':{'id':_0x44b591[_0xb8bf('0x3d')]['id']}},_0x338b7d={};_0x338b7d[_0xb8bf('0x2b')]=_[_0xb8bf('0x28')](db[_0xb8bf('0x37')][_0xb8bf('0x25')]);_0x338b7d[_0xb8bf('0x29')]=_['keys'](_0x44b591[_0xb8bf('0x29')]);_0x338b7d[_0xb8bf('0x33')]=_[_0xb8bf('0x2a')](_0x338b7d[_0xb8bf('0x2b')],_0x338b7d['query']);_0x5924da[_0xb8bf('0x2c')]=_['intersection'](_0x338b7d[_0xb8bf('0x2b')],qs[_0xb8bf('0x2d')](_0x44b591['query']['fields']));_0x5924da[_0xb8bf('0x2c')]=_0x5924da[_0xb8bf('0x2c')]['length']?_0x5924da[_0xb8bf('0x2c')]:_0x338b7d[_0xb8bf('0x2b')];if(_0x44b591[_0xb8bf('0x29')][_0xb8bf('0x38')]){_0x5924da[_0xb8bf('0x39')]=[{'all':!![]}];}_0x5924da=_['merge']({},_0x5924da,_0x44b591[_0xb8bf('0x3e')]);return db['SquareDetailsReport'][_0xb8bf('0x3f')](_0x5924da)[_0xb8bf('0x1f')](handleEntityNotFound(_0x377e4f,null))['then'](respondWithResult(_0x377e4f,null))[_0xb8bf('0x40')](handleError(_0x377e4f,null));};exports[_0xb8bf('0x41')]=function(_0x141f8f,_0x1d494f){return db[_0xb8bf('0x37')][_0xb8bf('0x41')](_0x141f8f[_0xb8bf('0x42')],{})[_0xb8bf('0x1f')](respondWithResult(_0x1d494f,0xc9))['catch'](handleError(_0x1d494f,null));};exports[_0xb8bf('0x1e')]=function(_0x2a51f2,_0x207482){if(_0x2a51f2[_0xb8bf('0x42')]['id']){delete _0x2a51f2[_0xb8bf('0x42')]['id'];}return db[_0xb8bf('0x37')][_0xb8bf('0x3f')]({'where':{'id':_0x2a51f2[_0xb8bf('0x3d')]['id']}})[_0xb8bf('0x1f')](handleEntityNotFound(_0x207482,null))[_0xb8bf('0x1f')](saveUpdates(_0x2a51f2[_0xb8bf('0x42')],null))[_0xb8bf('0x1f')](respondWithResult(_0x207482,null))[_0xb8bf('0x40')](handleError(_0x207482,null));};exports[_0xb8bf('0x20')]=function(_0x3207c5,_0x3ecb57){return db[_0xb8bf('0x37')][_0xb8bf('0x3f')]({'where':{'id':_0x3207c5[_0xb8bf('0x3d')]['id']}})[_0xb8bf('0x1f')](handleEntityNotFound(_0x3ecb57,null))[_0xb8bf('0x1f')](removeEntity(_0x3ecb57,null))['catch'](handleError(_0x3ecb57,null));};exports[_0xb8bf('0x43')]=function(_0x1a6a04,_0xe1e893){return db[_0xb8bf('0x37')][_0xb8bf('0x43')]()[_0xb8bf('0x1f')](respondWithResult(_0xe1e893,null))[_0xb8bf('0x40')](handleError(_0xe1e893,null));}; \ No newline at end of file +var _0xcf84=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcf84,0x1c7));var _0x4cf8=function(_0x4ac928,_0x333e91){_0x4ac928=_0x4ac928-0x0;var _0xef1f70=_0xcf84[_0x4ac928];return _0xef1f70;};'use strict';var emlformat=require(_0x4cf8('0x0'));var rimraf=require(_0x4cf8('0x1'));var zipdir=require(_0x4cf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4cf8('0x3'));var moment=require('moment');var BPromise=require(_0x4cf8('0x4'));var Mustache=require(_0x4cf8('0x5'));var util=require(_0x4cf8('0x6'));var path=require(_0x4cf8('0x7'));var sox=require(_0x4cf8('0x8'));var csv=require(_0x4cf8('0x9'));var ejs=require(_0x4cf8('0xa'));var fs=require('fs');var fs_extra=require(_0x4cf8('0xb'));var _=require(_0x4cf8('0xc'));var squel=require('squel');var crypto=require(_0x4cf8('0xd'));var jsforce=require(_0x4cf8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4cf8('0x9'));var querystring=require(_0x4cf8('0xf'));var Papa=require(_0x4cf8('0x10'));var Redis=require(_0x4cf8('0x11'));var authService=require(_0x4cf8('0x12'));var qs=require(_0x4cf8('0x13'));var as=require(_0x4cf8('0x14'));var hardwareService=require(_0x4cf8('0x15'));var logger=require(_0x4cf8('0x16'))(_0x4cf8('0x17'));var utils=require(_0x4cf8('0x18'));var config=require(_0x4cf8('0x19'));var licenseUtil=require(_0x4cf8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d98ba,_0xb5fbd6){_0xb5fbd6=_0xb5fbd6||0xcc;return function(_0x269546){if(_0x269546){return _0x4d98ba[_0x4cf8('0x1b')](_0xb5fbd6);}return _0x4d98ba['status'](_0xb5fbd6)[_0x4cf8('0x1c')]();};}function respondWithResult(_0x158ad5,_0x448b16){_0x448b16=_0x448b16||0xc8;return function(_0x276fc2){if(_0x276fc2){return _0x158ad5[_0x4cf8('0x1d')](_0x448b16)[_0x4cf8('0x1e')](_0x276fc2);}};}function respondWithFilteredResult(_0x36ccad,_0x4792c8){return function(_0x3ede08){if(_0x3ede08){var _0x4a3c32=typeof _0x4792c8[_0x4cf8('0x1f')]==='undefined'&&typeof _0x4792c8[_0x4cf8('0x20')]===_0x4cf8('0x21');var _0x3a02c7=_0x3ede08[_0x4cf8('0x22')];var _0x258c62=_0x4a3c32?0x0:_0x4792c8[_0x4cf8('0x1f')];var _0x464b3e=_0x4a3c32?_0x3ede08['count']:_0x4792c8[_0x4cf8('0x1f')]+_0x4792c8[_0x4cf8('0x20')];var _0x419501;if(_0x464b3e>=_0x3a02c7){_0x464b3e=_0x3a02c7;_0x419501=0xc8;}else{_0x419501=0xce;}_0x36ccad[_0x4cf8('0x1d')](_0x419501);return _0x36ccad[_0x4cf8('0x23')](_0x4cf8('0x24'),_0x258c62+'-'+_0x464b3e+'/'+_0x3a02c7)[_0x4cf8('0x1e')](_0x3ede08);}return null;};}function patchUpdates(_0x1f16a2){return function(_0x5be197){try{jsonpatch[_0x4cf8('0x25')](_0x5be197,_0x1f16a2,!![]);}catch(_0x160edc){return BPromise[_0x4cf8('0x26')](_0x160edc);}return _0x5be197[_0x4cf8('0x27')]();};}function saveUpdates(_0x26a1cb,_0x477648){return function(_0x4fc0fb){if(_0x4fc0fb){return _0x4fc0fb[_0x4cf8('0x28')](_0x26a1cb)[_0x4cf8('0x29')](function(_0xad2dcf){return _0xad2dcf;});}return null;};}function removeEntity(_0x419bde,_0x25d12d){return function(_0x485452){if(_0x485452){return _0x485452['destroy']()['then'](function(){_0x419bde[_0x4cf8('0x1d')](0xcc)[_0x4cf8('0x1c')]();});}};}function handleEntityNotFound(_0x4102b7,_0x55c3cf){return function(_0x5eb35f){if(!_0x5eb35f){_0x4102b7['sendStatus'](0x194);}return _0x5eb35f;};}function handleError(_0x16592e,_0x2c8e8a){_0x2c8e8a=_0x2c8e8a||0x1f4;return function(_0x400ce8){logger[_0x4cf8('0x2a')](_0x400ce8[_0x4cf8('0x2b')]);if(_0x400ce8[_0x4cf8('0x2c')]){delete _0x400ce8[_0x4cf8('0x2c')];}_0x16592e['status'](_0x2c8e8a)[_0x4cf8('0x2d')](_0x400ce8);};}exports['index']=function(_0x1b45e4,_0x392c0a){var _0x49b70b={},_0x4f8e39={},_0x11bd9d={'count':0x0,'rows':[]};var _0x5536cb=_[_0x4cf8('0x2e')](db[_0x4cf8('0x2f')][_0x4cf8('0x30')],function(_0x3d73b9){return{'name':_0x3d73b9[_0x4cf8('0x31')],'type':_0x3d73b9[_0x4cf8('0x32')][_0x4cf8('0x33')]};});_0x4f8e39['model']=_['map'](_0x5536cb,_0x4cf8('0x2c'));_0x4f8e39[_0x4cf8('0x34')]=_['keys'](_0x1b45e4['query']);_0x4f8e39['filters']=_[_0x4cf8('0x35')](_0x4f8e39['model'],_0x4f8e39[_0x4cf8('0x34')]);_0x49b70b[_0x4cf8('0x36')]=_[_0x4cf8('0x35')](_0x4f8e39[_0x4cf8('0x37')],qs['fields'](_0x1b45e4[_0x4cf8('0x34')][_0x4cf8('0x38')]));_0x49b70b['attributes']=_0x49b70b[_0x4cf8('0x36')][_0x4cf8('0x39')]?_0x49b70b[_0x4cf8('0x36')]:_0x4f8e39[_0x4cf8('0x37')];if(!_0x1b45e4['query']['hasOwnProperty'](_0x4cf8('0x3a'))){_0x49b70b[_0x4cf8('0x20')]=qs[_0x4cf8('0x20')](_0x1b45e4[_0x4cf8('0x34')][_0x4cf8('0x20')]);_0x49b70b[_0x4cf8('0x1f')]=qs['offset'](_0x1b45e4['query'][_0x4cf8('0x1f')]);}_0x49b70b[_0x4cf8('0x3b')]=qs[_0x4cf8('0x3c')](_0x1b45e4[_0x4cf8('0x34')][_0x4cf8('0x3c')]);_0x49b70b[_0x4cf8('0x3d')]=qs[_0x4cf8('0x3e')](_[_0x4cf8('0x3f')](_0x1b45e4[_0x4cf8('0x34')],_0x4f8e39[_0x4cf8('0x3e')]),_0x5536cb);if(_0x1b45e4[_0x4cf8('0x34')][_0x4cf8('0x40')]){_0x49b70b['where']=_['merge'](_0x49b70b[_0x4cf8('0x3d')],{'$or':_['map'](_0x5536cb,function(_0x540806){if(_0x540806[_0x4cf8('0x32')]!==_0x4cf8('0x41')){var _0x2d4ad6={};_0x2d4ad6[_0x540806[_0x4cf8('0x2c')]]={'$like':'%'+_0x1b45e4[_0x4cf8('0x34')]['filter']+'%'};return _0x2d4ad6;}})});}_0x49b70b=_[_0x4cf8('0x42')]({},_0x49b70b,_0x1b45e4[_0x4cf8('0x43')]);var _0x19905b={'where':_0x49b70b[_0x4cf8('0x3d')]};return db[_0x4cf8('0x2f')][_0x4cf8('0x22')](_0x19905b)[_0x4cf8('0x29')](function(_0x353cbc){_0x11bd9d[_0x4cf8('0x22')]=_0x353cbc;if(_0x1b45e4[_0x4cf8('0x34')][_0x4cf8('0x44')]){_0x49b70b[_0x4cf8('0x45')]=[{'all':!![]}];}return db[_0x4cf8('0x2f')]['findAll'](_0x49b70b);})[_0x4cf8('0x29')](function(_0x4699e6){_0x11bd9d['rows']=_0x4699e6;return _0x11bd9d;})[_0x4cf8('0x29')](respondWithFilteredResult(_0x392c0a,_0x49b70b))[_0x4cf8('0x46')](handleError(_0x392c0a,null));};exports[_0x4cf8('0x47')]=function(_0x13afbe,_0xa5ca18){var _0x4f5ee9={'raw':!![],'where':{'id':_0x13afbe['params']['id']}},_0x19f228={};_0x19f228[_0x4cf8('0x37')]=_[_0x4cf8('0x48')](db['SquareDetailsReport'][_0x4cf8('0x30')]);_0x19f228['query']=_['keys'](_0x13afbe[_0x4cf8('0x34')]);_0x19f228['filters']=_['intersection'](_0x19f228[_0x4cf8('0x37')],_0x19f228[_0x4cf8('0x34')]);_0x4f5ee9[_0x4cf8('0x36')]=_['intersection'](_0x19f228[_0x4cf8('0x37')],qs[_0x4cf8('0x38')](_0x13afbe[_0x4cf8('0x34')][_0x4cf8('0x38')]));_0x4f5ee9[_0x4cf8('0x36')]=_0x4f5ee9[_0x4cf8('0x36')][_0x4cf8('0x39')]?_0x4f5ee9[_0x4cf8('0x36')]:_0x19f228['model'];if(_0x13afbe[_0x4cf8('0x34')][_0x4cf8('0x44')]){_0x4f5ee9[_0x4cf8('0x45')]=[{'all':!![]}];}_0x4f5ee9=_[_0x4cf8('0x42')]({},_0x4f5ee9,_0x13afbe[_0x4cf8('0x43')]);return db[_0x4cf8('0x2f')][_0x4cf8('0x49')](_0x4f5ee9)[_0x4cf8('0x29')](handleEntityNotFound(_0xa5ca18,null))[_0x4cf8('0x29')](respondWithResult(_0xa5ca18,null))['catch'](handleError(_0xa5ca18,null));};exports['create']=function(_0x35d053,_0x7051e0){return db[_0x4cf8('0x2f')][_0x4cf8('0x4a')](_0x35d053[_0x4cf8('0x4b')],{})['then'](respondWithResult(_0x7051e0,0xc9))['catch'](handleError(_0x7051e0,null));};exports[_0x4cf8('0x28')]=function(_0x1d4907,_0x15c033){if(_0x1d4907['body']['id']){delete _0x1d4907[_0x4cf8('0x4b')]['id'];}return db[_0x4cf8('0x2f')][_0x4cf8('0x49')]({'where':{'id':_0x1d4907[_0x4cf8('0x4c')]['id']}})[_0x4cf8('0x29')](handleEntityNotFound(_0x15c033,null))[_0x4cf8('0x29')](saveUpdates(_0x1d4907[_0x4cf8('0x4b')],null))[_0x4cf8('0x29')](respondWithResult(_0x15c033,null))[_0x4cf8('0x46')](handleError(_0x15c033,null));};exports[_0x4cf8('0x4d')]=function(_0x118f14,_0x7dc2ae){return db[_0x4cf8('0x2f')]['find']({'where':{'id':_0x118f14[_0x4cf8('0x4c')]['id']}})[_0x4cf8('0x29')](handleEntityNotFound(_0x7dc2ae,null))[_0x4cf8('0x29')](removeEntity(_0x7dc2ae,null))[_0x4cf8('0x46')](handleError(_0x7dc2ae,null));};exports[_0x4cf8('0x4e')]=function(_0x4054d1,_0x3d6f0c){return db[_0x4cf8('0x2f')]['describe']()[_0x4cf8('0x29')](respondWithResult(_0x3d6f0c,null))['catch'](handleError(_0x3d6f0c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 61db654..14a44bc 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 _0x912c=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x16a42b,_0x2d9468){var _0x1feccb=function(_0x3c2241){while(--_0x3c2241){_0x16a42b['push'](_0x16a42b['shift']());}};_0x1feccb(++_0x2d9468);}(_0x912c,0xe5));var _0xc912=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x912c[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0xc912('0x0'));var util=require(_0xc912('0x1'));var logger=require(_0xc912('0x2'))(_0xc912('0x3'));var moment=require(_0xc912('0x4'));var BPromise=require(_0xc912('0x5'));var rp=require(_0xc912('0x6'));var fs=require('fs');var path=require(_0xc912('0x7'));var rimraf=require(_0xc912('0x8'));var config=require('../../config/environment');var attributes=require(_0xc912('0x9'));module['exports']=function(_0x142fa0,_0x321124){return _0x142fa0[_0xc912('0xa')](_0xc912('0xb'),attributes,{'tableName':_0xc912('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06bc=['report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x3d3d96,_0x28998e){var _0x2e479a=function(_0x1349ba){while(--_0x1349ba){_0x3d3d96['push'](_0x3d3d96['shift']());}};_0x2e479a(++_0x28998e);}(_0x06bc,0x135));var _0xc06b=function(_0x1b292e,_0xb02066){_0x1b292e=_0x1b292e-0x0;var _0x2f7ecf=_0x06bc[_0x1b292e];return _0x2f7ecf;};'use strict';var _=require('lodash');var util=require(_0xc06b('0x0'));var logger=require(_0xc06b('0x1'))(_0xc06b('0x2'));var moment=require(_0xc06b('0x3'));var BPromise=require(_0xc06b('0x4'));var rp=require(_0xc06b('0x5'));var fs=require('fs');var path=require(_0xc06b('0x6'));var rimraf=require(_0xc06b('0x7'));var config=require(_0xc06b('0x8'));var attributes=require(_0xc06b('0x9'));module[_0xc06b('0xa')]=function(_0x52a339,_0x3d8edb){return _0x52a339[_0xc06b('0xb')](_0xc06b('0xc'),attributes,{'tableName':_0xc06b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f4aa4f2..5997ec8 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 _0x42f4=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','moment','bluebird'];(function(_0x43d94e,_0x586a51){var _0x43f712=function(_0x264593){while(--_0x264593){_0x43d94e['push'](_0x43d94e['shift']());}};_0x43f712(++_0x586a51);}(_0x42f4,0x19d));var _0x442f=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x42f4[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b450,_0x23c5ba,_0x37dfe7){return new BPromise(function(_0x6c0b4b,_0x476480){return client['request'](_0x11b450,_0x37dfe7)[_0x442f('0x9')](function(_0x4e32af){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x23c5ba,_0x442f('0xa'));logger[_0x442f('0xb')](_0x442f('0xc'),_0x23c5ba,_0x442f('0xa'),JSON[_0x442f('0xd')](_0x4e32af));if(_0x4e32af[_0x442f('0xe')]){if(_0x4e32af[_0x442f('0xe')][_0x442f('0xf')]===0x1f4){logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af['error'][_0x442f('0x11')]);return _0x476480(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);return _0x6c0b4b(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}else{logger[_0x442f('0x12')](_0x442f('0x10'),_0x23c5ba,_0x442f('0xa'));_0x6c0b4b(_0x4e32af[_0x442f('0x13')][_0x442f('0x11')]);}})[_0x442f('0x14')](function(_0x3ff2b1){logger['error'](_0x442f('0x10'),_0x23c5ba,_0x3ff2b1);_0x476480(_0x3ff2b1);});});}exports['CreateSquareDetailsReport']=function(_0x54c48a){var _0x5668e0=this;return new Promise(function(_0x5e3dda,_0x1b18fd){return db[_0x442f('0x15')][_0x442f('0x16')](_0x54c48a[_0x442f('0x17')],{'raw':_0x54c48a[_0x442f('0x18')]?_0x54c48a[_0x442f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x442f('0x9')](function(_0x552f81){logger[_0x442f('0x12')](_0x442f('0x19'),_0x54c48a);logger[_0x442f('0xb')]('CreateSquareDetailsReport',_0x54c48a,JSON[_0x442f('0xd')](_0x552f81));_0x5e3dda(_0x552f81);})[_0x442f('0x14')](function(_0x5dd019){logger['error'](_0x442f('0x19'),_0x5dd019[_0x442f('0x11')],_0x54c48a);_0x1b18fd(_0x5668e0[_0x442f('0xe')](0x1f4,_0x5dd019[_0x442f('0x11')]));});});}; \ No newline at end of file +var _0x42f4=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','moment','bluebird'];(function(_0x17bd25,_0x2aec35){var _0x70138e=function(_0x5d5912){while(--_0x5d5912){_0x17bd25['push'](_0x17bd25['shift']());}};_0x70138e(++_0x2aec35);}(_0x42f4,0x19d));var _0x442f=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0x42f4[_0x211087];return _0x2a581f;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b450,_0x23c5ba,_0x37dfe7){return new BPromise(function(_0x6c0b4b,_0x476480){return client['request'](_0x11b450,_0x37dfe7)[_0x442f('0x9')](function(_0x4e32af){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x23c5ba,_0x442f('0xa'));logger[_0x442f('0xb')](_0x442f('0xc'),_0x23c5ba,_0x442f('0xa'),JSON[_0x442f('0xd')](_0x4e32af));if(_0x4e32af[_0x442f('0xe')]){if(_0x4e32af[_0x442f('0xe')][_0x442f('0xf')]===0x1f4){logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af['error'][_0x442f('0x11')]);return _0x476480(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);return _0x6c0b4b(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}else{logger[_0x442f('0x12')](_0x442f('0x10'),_0x23c5ba,_0x442f('0xa'));_0x6c0b4b(_0x4e32af[_0x442f('0x13')][_0x442f('0x11')]);}})[_0x442f('0x14')](function(_0x3ff2b1){logger['error'](_0x442f('0x10'),_0x23c5ba,_0x3ff2b1);_0x476480(_0x3ff2b1);});});}exports['CreateSquareDetailsReport']=function(_0x54c48a){var _0x5668e0=this;return new Promise(function(_0x5e3dda,_0x1b18fd){return db[_0x442f('0x15')][_0x442f('0x16')](_0x54c48a[_0x442f('0x17')],{'raw':_0x54c48a[_0x442f('0x18')]?_0x54c48a[_0x442f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x442f('0x9')](function(_0x552f81){logger[_0x442f('0x12')](_0x442f('0x19'),_0x54c48a);logger[_0x442f('0xb')]('CreateSquareDetailsReport',_0x54c48a,JSON[_0x442f('0xd')](_0x552f81));_0x5e3dda(_0x552f81);})[_0x442f('0x14')](function(_0x5dd019){logger['error'](_0x442f('0x19'),_0x5dd019[_0x442f('0x11')],_0x54c48a);_0x1b18fd(_0x5668e0[_0x442f('0xe')](0x1f4,_0x5dd019[_0x442f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c6cf621..65208fd 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 _0x79ab=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x4ff23f,_0x328ee1){var _0x42e84b=function(_0x564a01){while(--_0x564a01){_0x4ff23f['push'](_0x4ff23f['shift']());}};_0x42e84b(++_0x328ee1);}(_0x79ab,0x147));var _0xb79a=function(_0x45319d,_0x5a0653){_0x45319d=_0x45319d-0x0;var _0x20f076=_0x79ab[_0x45319d];return _0x20f076;};'use strict';var express=require(_0xb79a('0x0'));var router=express[_0xb79a('0x1')]();var auth=require(_0xb79a('0x2'));var controller=require(_0xb79a('0x3'));router[_0xb79a('0x4')]('/',auth[_0xb79a('0x5')](),controller['index']);router[_0xb79a('0x4')](_0xb79a('0x6'),auth[_0xb79a('0x5')](),controller[_0xb79a('0x7')]);module[_0xb79a('0x8')]=router; \ No newline at end of file +var _0xd5c4=['/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x3703c6,_0x5c5880){var _0x159865=function(_0x54d92a){while(--_0x54d92a){_0x3703c6['push'](_0x3703c6['shift']());}};_0x159865(++_0x5c5880);}(_0xd5c4,0x151));var _0x4d5c=function(_0x5c8b2a,_0x226b17){_0x5c8b2a=_0x5c8b2a-0x0;var _0x552f8d=_0xd5c4[_0x5c8b2a];return _0x552f8d;};'use strict';var express=require(_0x4d5c('0x0'));var router=express[_0x4d5c('0x1')]();var auth=require(_0x4d5c('0x2'));var controller=require(_0x4d5c('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4d5c('0x4')](_0x4d5c('0x5'),auth[_0x4d5c('0x6')](),controller[_0x4d5c('0x7')]);module[_0x4d5c('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 66ed973..54c4e36 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 _0x3776=['killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','params','SIGINT','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json'];(function(_0x6ac198,_0x1d55e4){var _0x5ef8ca=function(_0x217ae4){while(--_0x217ae4){_0x6ac198['push'](_0x6ac198['shift']());}};_0x5ef8ca(++_0x1d55e4);}(_0x3776,0x184));var _0x6377=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0x3776[_0xca04ff];return _0x6b547;};'use strict';var info=require('systeminformation');var exec=require(_0x6377('0x0'))[_0x6377('0x1')];var logger=require(_0x6377('0x2'))(_0x6377('0x3'));var util=require(_0x6377('0x4'));var BPromise=require(_0x6377('0x5'));var _=require(_0x6377('0x6'));function handleError(_0x197492,_0x5e16af,_0x4f6dbb){_0x5e16af=_0x5e16af||0x1f4;return function(_0xf81dc){logger[_0x6377('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4f6dbb,_0x5e16af,util[_0x6377('0x8')](_0xf81dc,{'showHidden':![],'depth':null}));delete _0xf81dc[_0x6377('0x9')];_0x197492[_0x6377('0xa')](_0x5e16af)[_0x6377('0xb')](_0xf81dc);};}exports[_0x6377('0xc')]=function(_0x236d30,_0x36c1fc){return info[_0x6377('0xd')]()[_0x6377('0xe')](function(_0x35e7c3){return _0x36c1fc['status'](0xc8)['json'](_0x35e7c3);})[_0x6377('0xf')](function(_0x3cb121){return _0x36c1fc[_0x6377('0xa')](0x1f4)[_0x6377('0x10')](_0x3cb121);});};exports[_0x6377('0x11')]=function(_0x3130c9,_0x56a69c){var _0x2d51a0=[_0x6377('0x12')];return new BPromise(function(_0x357e87,_0x256b52){return exec(util[_0x6377('0x13')](_0x6377('0x14'),_0x3130c9['params'][_0x6377('0x15')]),function(_0x456851,_0x5bcbe7,_0x2b6437){if(_0x456851){return _0x256b52(_0x456851);}return _0x357e87(_0x5bcbe7);});})[_0x6377('0xe')](function(_0x57f7d0){var _0x21b882=![];var _0x27c1f2=_0x57f7d0[_0x6377('0x16')](/\n/);for(var _0x1b4eef=0x0,_0x520151=_0x2d51a0[_0x6377('0x17')];_0x1b4eef<_0x520151,_0x21b882===![];_0x1b4eef+=0x1){if(_0x57f7d0[_0x6377('0x18')](_0x2d51a0[_0x1b4eef])>=0x0){_0x21b882=!![];}}if(!_0x21b882){throw new Error(util[_0x6377('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3130c9['params'][_0x6377('0x15')]));}process['kill'](_0x3130c9[_0x6377('0x19')][_0x6377('0x15')],_0x6377('0x1a'));return _0x56a69c['status'](0xc8)['json']({'message':util[_0x6377('0x13')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x3130c9[_0x6377('0x19')][_0x6377('0x15')])});})['catch'](handleError(_0x56a69c,null,'killProcess'));}; \ No newline at end of file +var _0x7dfe=['status','send','index','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error'];(function(_0x13edd5,_0x27dc12){var _0x515c4c=function(_0x155052){while(--_0x155052){_0x13edd5['push'](_0x13edd5['shift']());}};_0x515c4c(++_0x27dc12);}(_0x7dfe,0x115));var _0xe7df=function(_0x24e0bd,_0x97f71c){_0x24e0bd=_0x24e0bd-0x0;var _0x4a9621=_0x7dfe[_0x24e0bd];return _0x4a9621;};'use strict';var info=require(_0xe7df('0x0'));var exec=require(_0xe7df('0x1'))[_0xe7df('0x2')];var logger=require(_0xe7df('0x3'))(_0xe7df('0x4'));var util=require(_0xe7df('0x5'));var BPromise=require(_0xe7df('0x6'));var _=require(_0xe7df('0x7'));function handleError(_0x5df6ba,_0x2fb749,_0x4c46d3){_0x2fb749=_0x2fb749||0x1f4;return function(_0xd085a3){logger[_0xe7df('0x8')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4c46d3,_0x2fb749,util['inspect'](_0xd085a3,{'showHidden':![],'depth':null}));delete _0xd085a3['name'];_0x5df6ba[_0xe7df('0x9')](_0x2fb749)[_0xe7df('0xa')](_0xd085a3);};}exports[_0xe7df('0xb')]=function(_0x44028d,_0x31c20e){return info[_0xe7df('0xc')]()[_0xe7df('0xd')](function(_0x5abbe1){return _0x31c20e[_0xe7df('0x9')](0xc8)[_0xe7df('0xe')](_0x5abbe1);})[_0xe7df('0xf')](function(_0x22f33d){return _0x31c20e['status'](0x1f4)[_0xe7df('0xe')](_0x22f33d);});};exports[_0xe7df('0x10')]=function(_0x361525,_0x43108c){var _0x48a81d=['components/import/cm'];return new BPromise(function(_0x2656d4,_0x146f54){return exec(util[_0xe7df('0x11')](_0xe7df('0x12'),_0x361525[_0xe7df('0x13')][_0xe7df('0x14')]),function(_0x1126e7,_0x43c0e0,_0x257fe1){if(_0x1126e7){return _0x146f54(_0x1126e7);}return _0x2656d4(_0x43c0e0);});})['then'](function(_0x37787c){var _0x56466c=![];var _0x846b88=_0x37787c[_0xe7df('0x15')](/\n/);for(var _0x1ded57=0x0,_0xb1801=_0x48a81d[_0xe7df('0x16')];_0x1ded57<_0xb1801,_0x56466c===![];_0x1ded57+=0x1){if(_0x37787c['indexOf'](_0x48a81d[_0x1ded57])>=0x0){_0x56466c=!![];}}if(!_0x56466c){throw new Error(util['format'](_0xe7df('0x17'),_0x361525[_0xe7df('0x13')][_0xe7df('0x14')]));}process[_0xe7df('0x18')](_0x361525[_0xe7df('0x13')][_0xe7df('0x14')],_0xe7df('0x19'));return _0x43108c['status'](0xc8)[_0xe7df('0xe')]({'message':util[_0xe7df('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x361525[_0xe7df('0x13')][_0xe7df('0x14')])});})[_0xe7df('0xf')](handleError(_0x43108c,null,_0xe7df('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ec7f6e5..634cc18 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 _0x4c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0xce6907,_0x244781){var _0xf51c07=function(_0x490103){while(--_0x490103){_0xce6907['push'](_0xce6907['shift']());}};_0xf51c07(++_0x244781);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4e9e8c,_0xf98c8){_0x4e9e8c=_0x4e9e8c-0x0;var _0x571c05=_0x4c4e[_0x4e9e8c];return _0x571c05;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4c4('0xe')]('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);router[_0xe4c4('0x10')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['update']);router[_0xe4c4('0x11')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x382af1,_0x44e6d1){var _0x31d1ca=function(_0x453d93){while(--_0x453d93){_0x382af1['push'](_0x382af1['shift']());}};_0x31d1ca(++_0x44e6d1);}(_0xa8a8,0xec));var _0x8a8a=function(_0x48937a,_0x44c45b){_0x48937a=_0x48937a-0x0;var _0x5a2e3c=_0xa8a8[_0x48937a];return _0x5a2e3c;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a3c7bbd..f69b059 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 _0x28f2=['exports','STRING','name','sequelize'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x28f2,0x193));var _0x228f=function(_0x9b3a23,_0x13aa98){_0x9b3a23=_0x9b3a23-0x0;var _0x3b003f=_0x28f2[_0x9b3a23];return _0x3b003f;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x228f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x228f('0x2')]}}; \ No newline at end of file +var _0xb10d=['STRING','name','#0091EA','sequelize'];(function(_0x3f1839,_0x18fc04){var _0x38c62d=function(_0x3e73e7){while(--_0x3e73e7){_0x3f1839['push'](_0x3f1839['shift']());}};_0x38c62d(++_0x18fc04);}(_0xb10d,0x17f));var _0xdb10=function(_0x522077,_0x1583b1){_0x522077=_0x522077-0x0;var _0x55675d=_0xb10d[_0x522077];return _0x55675d;};'use strict';var Sequelize=require(_0xdb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb10('0x1')],'unique':_0xdb10('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdb10('0x1')],'defaultValue':_0xdb10('0x3')},'description':{'type':Sequelize[_0xdb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1942808..9573835 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 _0x397b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','status','error','stack','name','send','index','map','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Tag','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x23b25c,_0xdd6221){var _0xe89a23=function(_0x31aefa){while(--_0x31aefa){_0x23b25c['push'](_0x23b25c['shift']());}};_0xe89a23(++_0xdd6221);}(_0x397b,0x15b));var _0xb397=function(_0x2260d8,_0x39485d){_0x2260d8=_0x2260d8-0x0;var _0x258953=_0x397b[_0x2260d8];return _0x258953;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb397('0x0'));var zipdir=require(_0xb397('0x1'));var jsonpatch=require(_0xb397('0x2'));var rp=require(_0xb397('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb397('0x4'));var util=require(_0xb397('0x5'));var path=require(_0xb397('0x6'));var sox=require(_0xb397('0x7'));var csv=require(_0xb397('0x8'));var ejs=require(_0xb397('0x9'));var fs=require('fs');var fs_extra=require(_0xb397('0xa'));var _=require(_0xb397('0xb'));var squel=require(_0xb397('0xc'));var crypto=require('crypto');var jsforce=require(_0xb397('0xd'));var deskjs=require(_0xb397('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb397('0xf'));var Papa=require(_0xb397('0x10'));var Redis=require(_0xb397('0x11'));var authService=require(_0xb397('0x12'));var qs=require(_0xb397('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb397('0x14'));var logger=require('../../config/logger')(_0xb397('0x15'));var utils=require(_0xb397('0x16'));var config=require(_0xb397('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb397('0x18'))['db'];function respondWithStatusCode(_0x1b239a,_0x7e857f){_0x7e857f=_0x7e857f||0xcc;return function(_0x59df89){if(_0x59df89){return _0x1b239a[_0xb397('0x19')](_0x7e857f);}return _0x1b239a['status'](_0x7e857f)[_0xb397('0x1a')]();};}function respondWithResult(_0x3b56b6,_0x193618){_0x193618=_0x193618||0xc8;return function(_0x5c4e1c){if(_0x5c4e1c){return _0x3b56b6['status'](_0x193618)[_0xb397('0x1b')](_0x5c4e1c);}};}function respondWithFilteredResult(_0x252ce3,_0x566911){return function(_0x505408){if(_0x505408){var _0xa900ef=typeof _0x566911[_0xb397('0x1c')]===_0xb397('0x1d')&&typeof _0x566911[_0xb397('0x1e')]===_0xb397('0x1d');var _0x48bbb9=_0x505408[_0xb397('0x1f')];var _0x4678bc=_0xa900ef?0x0:_0x566911[_0xb397('0x1c')];var _0x2cded3=_0xa900ef?_0x505408['count']:_0x566911['offset']+_0x566911['limit'];var _0xeaadfb;if(_0x2cded3>=_0x48bbb9){_0x2cded3=_0x48bbb9;_0xeaadfb=0xc8;}else{_0xeaadfb=0xce;}_0x252ce3['status'](_0xeaadfb);return _0x252ce3['set'](_0xb397('0x20'),_0x4678bc+'-'+_0x2cded3+'/'+_0x48bbb9)[_0xb397('0x1b')](_0x505408);}return null;};}function patchUpdates(_0xc0f50a){return function(_0x2d4f9e){try{jsonpatch[_0xb397('0x21')](_0x2d4f9e,_0xc0f50a,!![]);}catch(_0x52a681){return BPromise[_0xb397('0x22')](_0x52a681);}return _0x2d4f9e[_0xb397('0x23')]();};}function saveUpdates(_0x3bff2e,_0x3e9ad1){return function(_0x5ae009){if(_0x5ae009){return _0x5ae009[_0xb397('0x24')](_0x3bff2e)[_0xb397('0x25')](function(_0x242651){return _0x242651;});}return null;};}function removeEntity(_0x28182a,_0x36eb16){return function(_0x1375ad){if(_0x1375ad){return _0x1375ad[_0xb397('0x26')]()[_0xb397('0x25')](function(){var _0x29e066=_0x1375ad['get']({'plain':!![]});var _0x5778a1=_0xb397('0x27');return db[_0xb397('0x28')]['destroy']({'where':{'type':_0x5778a1,'resourceId':_0x29e066['id']}})['then'](function(){return _0x1375ad;});})['then'](function(){_0x28182a[_0xb397('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a253,_0xbf4160){return function(_0x4f05b2){if(!_0x4f05b2){_0x58a253[_0xb397('0x19')](0x194);}return _0x4f05b2;};}function handleError(_0x48fe10,_0x203432){_0x203432=_0x203432||0x1f4;return function(_0x319c4e){logger[_0xb397('0x2a')](_0x319c4e[_0xb397('0x2b')]);if(_0x319c4e[_0xb397('0x2c')]){delete _0x319c4e[_0xb397('0x2c')];}_0x48fe10['status'](_0x203432)[_0xb397('0x2d')](_0x319c4e);};}exports[_0xb397('0x2e')]=function(_0x23b896,_0x11a103){var _0x3c56ad={},_0x5697dd={},_0xbcf279={'count':0x0,'rows':[]};var _0x23b984=_[_0xb397('0x2f')](db['Tag']['rawAttributes'],function(_0x7108ff){return{'name':_0x7108ff[_0xb397('0x30')],'type':_0x7108ff[_0xb397('0x31')]['key']};});_0x5697dd[_0xb397('0x32')]=_[_0xb397('0x2f')](_0x23b984,_0xb397('0x2c'));_0x5697dd[_0xb397('0x33')]=_['keys'](_0x23b896[_0xb397('0x33')]);_0x5697dd[_0xb397('0x34')]=_['intersection'](_0x5697dd[_0xb397('0x32')],_0x5697dd[_0xb397('0x33')]);_0x3c56ad[_0xb397('0x35')]=_['intersection'](_0x5697dd[_0xb397('0x32')],qs[_0xb397('0x36')](_0x23b896[_0xb397('0x33')][_0xb397('0x36')]));_0x3c56ad[_0xb397('0x35')]=_0x3c56ad['attributes'][_0xb397('0x37')]?_0x3c56ad[_0xb397('0x35')]:_0x5697dd[_0xb397('0x32')];if(!_0x23b896[_0xb397('0x33')][_0xb397('0x38')](_0xb397('0x39'))){_0x3c56ad[_0xb397('0x1e')]=qs[_0xb397('0x1e')](_0x23b896[_0xb397('0x33')][_0xb397('0x1e')]);_0x3c56ad[_0xb397('0x1c')]=qs[_0xb397('0x1c')](_0x23b896[_0xb397('0x33')][_0xb397('0x1c')]);}_0x3c56ad[_0xb397('0x3a')]=qs[_0xb397('0x3b')](_0x23b896[_0xb397('0x33')][_0xb397('0x3b')]);_0x3c56ad[_0xb397('0x3c')]=qs[_0xb397('0x34')](_[_0xb397('0x3d')](_0x23b896[_0xb397('0x33')],_0x5697dd['filters']),_0x23b984);if(_0x23b896[_0xb397('0x33')]['filter']){_0x3c56ad['where']=_[_0xb397('0x3e')](_0x3c56ad[_0xb397('0x3c')],{'$or':_[_0xb397('0x2f')](_0x23b984,function(_0x56f750){if(_0x56f750[_0xb397('0x31')]!==_0xb397('0x3f')){var _0x47a3bf={};_0x47a3bf[_0x56f750['name']]={'$like':'%'+_0x23b896[_0xb397('0x33')][_0xb397('0x40')]+'%'};return _0x47a3bf;}})});}_0x3c56ad=_[_0xb397('0x3e')]({},_0x3c56ad,_0x23b896[_0xb397('0x41')]);var _0x584c56={'where':_0x3c56ad[_0xb397('0x3c')]};return db[_0xb397('0x42')][_0xb397('0x1f')](_0x584c56)[_0xb397('0x25')](function(_0x1ff8c6){_0xbcf279[_0xb397('0x1f')]=_0x1ff8c6;if(_0x23b896[_0xb397('0x33')][_0xb397('0x43')]){_0x3c56ad[_0xb397('0x44')]=[{'all':!![]}];}return db[_0xb397('0x42')][_0xb397('0x45')](_0x3c56ad);})[_0xb397('0x25')](function(_0xe2ce5c){_0xbcf279[_0xb397('0x46')]=_0xe2ce5c;return _0xbcf279;})['then'](respondWithFilteredResult(_0x11a103,_0x3c56ad))[_0xb397('0x47')](handleError(_0x11a103,null));};exports[_0xb397('0x48')]=function(_0x3cff9e,_0x417a9f){var _0x53548f={'raw':!![],'where':{'id':_0x3cff9e[_0xb397('0x49')]['id']}},_0x28bcaa={};_0x28bcaa[_0xb397('0x32')]=_[_0xb397('0x4a')](db['Tag'][_0xb397('0x4b')]);_0x28bcaa[_0xb397('0x33')]=_['keys'](_0x3cff9e[_0xb397('0x33')]);_0x28bcaa[_0xb397('0x34')]=_[_0xb397('0x4c')](_0x28bcaa[_0xb397('0x32')],_0x28bcaa[_0xb397('0x33')]);_0x53548f[_0xb397('0x35')]=_[_0xb397('0x4c')](_0x28bcaa[_0xb397('0x32')],qs[_0xb397('0x36')](_0x3cff9e[_0xb397('0x33')][_0xb397('0x36')]));_0x53548f['attributes']=_0x53548f[_0xb397('0x35')][_0xb397('0x37')]?_0x53548f[_0xb397('0x35')]:_0x28bcaa[_0xb397('0x32')];if(_0x3cff9e[_0xb397('0x33')]['includeAll']){_0x53548f[_0xb397('0x44')]=[{'all':!![]}];}_0x53548f=_[_0xb397('0x3e')]({},_0x53548f,_0x3cff9e[_0xb397('0x41')]);return db[_0xb397('0x42')][_0xb397('0x4d')](_0x53548f)[_0xb397('0x25')](handleEntityNotFound(_0x417a9f,null))[_0xb397('0x25')](respondWithResult(_0x417a9f,null))[_0xb397('0x47')](handleError(_0x417a9f,null));};exports[_0xb397('0x4e')]=function(_0x2a7ed6,_0x583e91){return db['Tag'][_0xb397('0x4e')](_0x2a7ed6['body'],{})[_0xb397('0x25')](function(_0x368cee){var _0x3d57a3=_0x2a7ed6[_0xb397('0x4f')]['get']({'plain':!![]});if(!_0x3d57a3)throw new Error(_0xb397('0x50'));if(_0x3d57a3[_0xb397('0x51')]===_0xb397('0x4f')){var _0x55787f=_0x368cee['get']({'plain':!![]});var _0x10e426=_0xb397('0x27');return db[_0xb397('0x52')]['find']({'where':{'name':_0x10e426,'userProfileId':_0x3d57a3[_0xb397('0x53')]},'raw':!![]})[_0xb397('0x25')](function(_0x3393bf){if(_0x3393bf&&_0x3393bf[_0xb397('0x54')]===0x0){return db[_0xb397('0x28')][_0xb397('0x4e')]({'name':_0x55787f[_0xb397('0x2c')],'resourceId':_0x55787f['id'],'type':_0x3393bf[_0xb397('0x2c')],'sectionId':_0x3393bf['id']},{})[_0xb397('0x25')](function(){return _0x368cee;});}else{return _0x368cee;}})[_0xb397('0x47')](function(_0x46f7c1){logger[_0xb397('0x2a')](_0xb397('0x55'),_0x46f7c1);throw _0x46f7c1;});}return _0x368cee;})['then'](respondWithResult(_0x583e91,0xc9))[_0xb397('0x47')](handleError(_0x583e91,null));};exports['update']=function(_0x169b0e,_0x9fb0f4){if(_0x169b0e[_0xb397('0x56')]['id']){delete _0x169b0e[_0xb397('0x56')]['id'];}return db['Tag'][_0xb397('0x4d')]({'where':{'id':_0x169b0e['params']['id']}})[_0xb397('0x25')](handleEntityNotFound(_0x9fb0f4,null))[_0xb397('0x25')](saveUpdates(_0x169b0e['body'],null))[_0xb397('0x25')](respondWithResult(_0x9fb0f4,null))[_0xb397('0x47')](handleError(_0x9fb0f4,null));};exports[_0xb397('0x26')]=function(_0x59e971,_0x2b354f){return db[_0xb397('0x42')][_0xb397('0x4d')]({'where':{'id':_0x59e971['params']['id']}})['then'](handleEntityNotFound(_0x2b354f,null))[_0xb397('0x25')](removeEntity(_0x2b354f,null))[_0xb397('0x47')](handleError(_0x2b354f,null));};exports[_0xb397('0x57')]=function(_0x13bffd,_0x59e19e){return db[_0xb397('0x42')]['describe']()['then'](respondWithResult(_0x59e19e,null))['catch'](handleError(_0x59e19e,null));}; \ No newline at end of file +var _0x9d5c=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','get','Tags','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','where','pick','filter','merge','options','include','Tag','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0xe3bb30,_0x149c53){var _0x486aa3=function(_0x36a241){while(--_0x36a241){_0xe3bb30['push'](_0xe3bb30['shift']());}};_0x486aa3(++_0x149c53);}(_0x9d5c,0x98));var _0xc9d5=function(_0x2f0fd1,_0x3dbbbf){_0x2f0fd1=_0x2f0fd1-0x0;var _0x1f67bd=_0x9d5c[_0x2f0fd1];return _0x1f67bd;};'use strict';var emlformat=require(_0xc9d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9d5('0x1'));var jsonpatch=require(_0xc9d5('0x2'));var rp=require('request-promise');var moment=require(_0xc9d5('0x3'));var BPromise=require(_0xc9d5('0x4'));var Mustache=require(_0xc9d5('0x5'));var util=require('util');var path=require(_0xc9d5('0x6'));var sox=require(_0xc9d5('0x7'));var csv=require('to-csv');var ejs=require(_0xc9d5('0x8'));var fs=require('fs');var fs_extra=require(_0xc9d5('0x9'));var _=require(_0xc9d5('0xa'));var squel=require(_0xc9d5('0xb'));var crypto=require(_0xc9d5('0xc'));var jsforce=require(_0xc9d5('0xd'));var deskjs=require(_0xc9d5('0xe'));var toCsv=require(_0xc9d5('0xf'));var querystring=require(_0xc9d5('0x10'));var Papa=require(_0xc9d5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc9d5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9d5('0x13'));var logger=require(_0xc9d5('0x14'))(_0xc9d5('0x15'));var utils=require(_0xc9d5('0x16'));var config=require(_0xc9d5('0x17'));var licenseUtil=require(_0xc9d5('0x18'));var db=require(_0xc9d5('0x19'))['db'];function respondWithStatusCode(_0x4c85f5,_0x50125c){_0x50125c=_0x50125c||0xcc;return function(_0x5b6cf3){if(_0x5b6cf3){return _0x4c85f5[_0xc9d5('0x1a')](_0x50125c);}return _0x4c85f5[_0xc9d5('0x1b')](_0x50125c)[_0xc9d5('0x1c')]();};}function respondWithResult(_0x3ee40e,_0x538a4b){_0x538a4b=_0x538a4b||0xc8;return function(_0x10d259){if(_0x10d259){return _0x3ee40e[_0xc9d5('0x1b')](_0x538a4b)['json'](_0x10d259);}};}function respondWithFilteredResult(_0x46799c,_0x658fd9){return function(_0x59034a){if(_0x59034a){var _0x57a42f=typeof _0x658fd9[_0xc9d5('0x1d')]===_0xc9d5('0x1e')&&typeof _0x658fd9[_0xc9d5('0x1f')]==='undefined';var _0x395bad=_0x59034a['count'];var _0x3c8441=_0x57a42f?0x0:_0x658fd9[_0xc9d5('0x1d')];var _0x3105d2=_0x57a42f?_0x59034a[_0xc9d5('0x20')]:_0x658fd9['offset']+_0x658fd9[_0xc9d5('0x1f')];var _0x516b45;if(_0x3105d2>=_0x395bad){_0x3105d2=_0x395bad;_0x516b45=0xc8;}else{_0x516b45=0xce;}_0x46799c[_0xc9d5('0x1b')](_0x516b45);return _0x46799c[_0xc9d5('0x21')](_0xc9d5('0x22'),_0x3c8441+'-'+_0x3105d2+'/'+_0x395bad)[_0xc9d5('0x23')](_0x59034a);}return null;};}function patchUpdates(_0x4c0139){return function(_0x32b782){try{jsonpatch['apply'](_0x32b782,_0x4c0139,!![]);}catch(_0x565242){return BPromise[_0xc9d5('0x24')](_0x565242);}return _0x32b782[_0xc9d5('0x25')]();};}function saveUpdates(_0x2f2e4d,_0x7ce117){return function(_0x1447c9){if(_0x1447c9){return _0x1447c9['update'](_0x2f2e4d)['then'](function(_0x373563){return _0x373563;});}return null;};}function removeEntity(_0x11227e,_0x41cd76){return function(_0x1424c9){if(_0x1424c9){return _0x1424c9[_0xc9d5('0x26')]()[_0xc9d5('0x27')](function(){var _0x237ae7=_0x1424c9[_0xc9d5('0x28')]({'plain':!![]});var _0x1f2fbb=_0xc9d5('0x29');return db['UserProfileResource'][_0xc9d5('0x26')]({'where':{'type':_0x1f2fbb,'resourceId':_0x237ae7['id']}})[_0xc9d5('0x27')](function(){return _0x1424c9;});})[_0xc9d5('0x27')](function(){_0x11227e[_0xc9d5('0x1b')](0xcc)[_0xc9d5('0x1c')]();});}};}function handleEntityNotFound(_0x4287ea,_0x41a5d7){return function(_0x5b411d){if(!_0x5b411d){_0x4287ea[_0xc9d5('0x1a')](0x194);}return _0x5b411d;};}function handleError(_0x28fb0e,_0x5e06f2){_0x5e06f2=_0x5e06f2||0x1f4;return function(_0x42ec08){logger[_0xc9d5('0x2a')](_0x42ec08[_0xc9d5('0x2b')]);if(_0x42ec08[_0xc9d5('0x2c')]){delete _0x42ec08[_0xc9d5('0x2c')];}_0x28fb0e[_0xc9d5('0x1b')](_0x5e06f2)[_0xc9d5('0x2d')](_0x42ec08);};}exports[_0xc9d5('0x2e')]=function(_0x343c48,_0x566fd3){var _0x1a2417={},_0x41d217={},_0x2f038e={'count':0x0,'rows':[]};var _0x57fb6c=_['map'](db['Tag']['rawAttributes'],function(_0x323f77){return{'name':_0x323f77[_0xc9d5('0x2f')],'type':_0x323f77[_0xc9d5('0x30')][_0xc9d5('0x31')]};});_0x41d217[_0xc9d5('0x32')]=_[_0xc9d5('0x33')](_0x57fb6c,'name');_0x41d217[_0xc9d5('0x34')]=_[_0xc9d5('0x35')](_0x343c48[_0xc9d5('0x34')]);_0x41d217[_0xc9d5('0x36')]=_['intersection'](_0x41d217[_0xc9d5('0x32')],_0x41d217[_0xc9d5('0x34')]);_0x1a2417[_0xc9d5('0x37')]=_[_0xc9d5('0x38')](_0x41d217['model'],qs[_0xc9d5('0x39')](_0x343c48['query'][_0xc9d5('0x39')]));_0x1a2417[_0xc9d5('0x37')]=_0x1a2417[_0xc9d5('0x37')]['length']?_0x1a2417[_0xc9d5('0x37')]:_0x41d217[_0xc9d5('0x32')];if(!_0x343c48[_0xc9d5('0x34')]['hasOwnProperty'](_0xc9d5('0x3a'))){_0x1a2417[_0xc9d5('0x1f')]=qs['limit'](_0x343c48[_0xc9d5('0x34')][_0xc9d5('0x1f')]);_0x1a2417[_0xc9d5('0x1d')]=qs[_0xc9d5('0x1d')](_0x343c48[_0xc9d5('0x34')][_0xc9d5('0x1d')]);}_0x1a2417['order']=qs['sort'](_0x343c48[_0xc9d5('0x34')]['sort']);_0x1a2417[_0xc9d5('0x3b')]=qs[_0xc9d5('0x36')](_[_0xc9d5('0x3c')](_0x343c48[_0xc9d5('0x34')],_0x41d217[_0xc9d5('0x36')]),_0x57fb6c);if(_0x343c48[_0xc9d5('0x34')][_0xc9d5('0x3d')]){_0x1a2417['where']=_[_0xc9d5('0x3e')](_0x1a2417[_0xc9d5('0x3b')],{'$or':_[_0xc9d5('0x33')](_0x57fb6c,function(_0x5df6bf){if(_0x5df6bf[_0xc9d5('0x30')]!=='VIRTUAL'){var _0x3488f5={};_0x3488f5[_0x5df6bf[_0xc9d5('0x2c')]]={'$like':'%'+_0x343c48['query'][_0xc9d5('0x3d')]+'%'};return _0x3488f5;}})});}_0x1a2417=_[_0xc9d5('0x3e')]({},_0x1a2417,_0x343c48[_0xc9d5('0x3f')]);var _0x11e0db={'where':_0x1a2417[_0xc9d5('0x3b')]};return db['Tag'][_0xc9d5('0x20')](_0x11e0db)[_0xc9d5('0x27')](function(_0x45df52){_0x2f038e['count']=_0x45df52;if(_0x343c48['query']['includeAll']){_0x1a2417[_0xc9d5('0x40')]=[{'all':!![]}];}return db[_0xc9d5('0x41')][_0xc9d5('0x42')](_0x1a2417);})['then'](function(_0x34943f){_0x2f038e[_0xc9d5('0x43')]=_0x34943f;return _0x2f038e;})['then'](respondWithFilteredResult(_0x566fd3,_0x1a2417))[_0xc9d5('0x44')](handleError(_0x566fd3,null));};exports[_0xc9d5('0x45')]=function(_0x399095,_0x1d4555){var _0x27f968={'raw':!![],'where':{'id':_0x399095['params']['id']}},_0xba4bef={};_0xba4bef[_0xc9d5('0x32')]=_['keys'](db[_0xc9d5('0x41')][_0xc9d5('0x46')]);_0xba4bef[_0xc9d5('0x34')]=_[_0xc9d5('0x35')](_0x399095[_0xc9d5('0x34')]);_0xba4bef[_0xc9d5('0x36')]=_[_0xc9d5('0x38')](_0xba4bef[_0xc9d5('0x32')],_0xba4bef[_0xc9d5('0x34')]);_0x27f968[_0xc9d5('0x37')]=_[_0xc9d5('0x38')](_0xba4bef[_0xc9d5('0x32')],qs[_0xc9d5('0x39')](_0x399095[_0xc9d5('0x34')][_0xc9d5('0x39')]));_0x27f968[_0xc9d5('0x37')]=_0x27f968[_0xc9d5('0x37')][_0xc9d5('0x47')]?_0x27f968[_0xc9d5('0x37')]:_0xba4bef[_0xc9d5('0x32')];if(_0x399095['query'][_0xc9d5('0x48')]){_0x27f968[_0xc9d5('0x40')]=[{'all':!![]}];}_0x27f968=_['merge']({},_0x27f968,_0x399095[_0xc9d5('0x3f')]);return db[_0xc9d5('0x41')][_0xc9d5('0x49')](_0x27f968)[_0xc9d5('0x27')](handleEntityNotFound(_0x1d4555,null))[_0xc9d5('0x27')](respondWithResult(_0x1d4555,null))['catch'](handleError(_0x1d4555,null));};exports[_0xc9d5('0x4a')]=function(_0x5d82bc,_0x19ff03){return db[_0xc9d5('0x41')]['create'](_0x5d82bc[_0xc9d5('0x4b')],{})['then'](function(_0x239e82){var _0x40be48=_0x5d82bc[_0xc9d5('0x4c')][_0xc9d5('0x28')]({'plain':!![]});if(!_0x40be48)throw new Error(_0xc9d5('0x4d'));if(_0x40be48[_0xc9d5('0x4e')]===_0xc9d5('0x4c')){var _0x5a3a03=_0x239e82[_0xc9d5('0x28')]({'plain':!![]});var _0x8ad4ac='Tags';return db[_0xc9d5('0x4f')][_0xc9d5('0x49')]({'where':{'name':_0x8ad4ac,'userProfileId':_0x40be48[_0xc9d5('0x50')]},'raw':!![]})['then'](function(_0x4778d2){if(_0x4778d2&&_0x4778d2[_0xc9d5('0x51')]===0x0){return db[_0xc9d5('0x52')][_0xc9d5('0x4a')]({'name':_0x5a3a03[_0xc9d5('0x2c')],'resourceId':_0x5a3a03['id'],'type':_0x4778d2[_0xc9d5('0x2c')],'sectionId':_0x4778d2['id']},{})[_0xc9d5('0x27')](function(){return _0x239e82;});}else{return _0x239e82;}})['catch'](function(_0x41623d){logger[_0xc9d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41623d);throw _0x41623d;});}return _0x239e82;})['then'](respondWithResult(_0x19ff03,0xc9))[_0xc9d5('0x44')](handleError(_0x19ff03,null));};exports[_0xc9d5('0x53')]=function(_0x378589,_0x63939a){if(_0x378589['body']['id']){delete _0x378589[_0xc9d5('0x4b')]['id'];}return db[_0xc9d5('0x41')][_0xc9d5('0x49')]({'where':{'id':_0x378589[_0xc9d5('0x54')]['id']}})[_0xc9d5('0x27')](handleEntityNotFound(_0x63939a,null))[_0xc9d5('0x27')](saveUpdates(_0x378589['body'],null))[_0xc9d5('0x27')](respondWithResult(_0x63939a,null))[_0xc9d5('0x44')](handleError(_0x63939a,null));};exports[_0xc9d5('0x26')]=function(_0x3e3939,_0x4e560e){return db[_0xc9d5('0x41')][_0xc9d5('0x49')]({'where':{'id':_0x3e3939[_0xc9d5('0x54')]['id']}})[_0xc9d5('0x27')](handleEntityNotFound(_0x4e560e,null))['then'](removeEntity(_0x4e560e,null))[_0xc9d5('0x44')](handleError(_0x4e560e,null));};exports[_0xc9d5('0x55')]=function(_0x4fa7ac,_0x11f745){return db[_0xc9d5('0x41')][_0xc9d5('0x55')]()[_0xc9d5('0x27')](respondWithResult(_0x11f745,null))[_0xc9d5('0x44')](handleError(_0x11f745,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ad0ae64..65918e8 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 _0x30ab=['moment','bluebird','request-promise','../../config/environment','define','Tag','lodash','util','api'];(function(_0x3c3fe6,_0x3cf531){var _0x219ddd=function(_0x1dcfd5){while(--_0x1dcfd5){_0x3c3fe6['push'](_0x3c3fe6['shift']());}};_0x219ddd(++_0x3cf531);}(_0x30ab,0x11d));var _0xb30a=function(_0x13f1c6,_0x45a4e8){_0x13f1c6=_0x13f1c6-0x0;var _0x4d40d5=_0x30ab[_0x13f1c6];return _0x4d40d5;};'use strict';var _=require(_0xb30a('0x0'));var util=require(_0xb30a('0x1'));var logger=require('../../config/logger')(_0xb30a('0x2'));var moment=require(_0xb30a('0x3'));var BPromise=require(_0xb30a('0x4'));var rp=require(_0xb30a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb30a('0x6'));var attributes=require('./tag.attributes');module['exports']=function(_0xc780bc,_0x447108){return _0xc780bc[_0xb30a('0x7')](_0xb30a('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd23b=['util','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash'];(function(_0x581928,_0x16fee8){var _0x13df5c=function(_0x242752){while(--_0x242752){_0x581928['push'](_0x581928['shift']());}};_0x13df5c(++_0x16fee8);}(_0xd23b,0x199));var _0xbd23=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xd23b[_0x290694];return _0x5a0f2e;};'use strict';var _=require(_0xbd23('0x0'));var util=require(_0xbd23('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbd23('0x2'));var rp=require(_0xbd23('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd23('0x4'));var config=require(_0xbd23('0x5'));var attributes=require(_0xbd23('0x6'));module[_0xbd23('0x7')]=function(_0x2ef9a1,_0x5aa9e2){return _0x2ef9a1['define'](_0xbd23('0x8'),attributes,{'tableName':_0xbd23('0x9'),'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 39cd9cb..9d0f955 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x43c20d,_0x1c28d6){var _0x494fa3=function(_0x54dee6){while(--_0x54dee6){_0x43c20d['push'](_0x43c20d['shift']());}};_0x494fa3(++_0x1c28d6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7e29cc,_0xbd28c8){_0x7e29cc=_0x7e29cc-0x0;var _0x4df886=_0xb43b[_0x7e29cc];return _0x4df886;};'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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Tag,\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 +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0xb4e6[_0x2f6f50];return _0x2cf365;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5cbfcd8..8301e38 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 c881a5b..b418bcc 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x15df32,_0x5a46d4){var _0x207af6=function(_0x3a599f){while(--_0x3a599f){_0x15df32['push'](_0x15df32['shift']());}};_0x207af6(++_0x5a46d4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x3a4c3d,_0x2cca41){var _0x3d7710=function(_0x172952){while(--_0x172952){_0x3a4c3d['push'](_0x3a4c3d['shift']());}};_0x3d7710(++_0x2cca41);}(_0x757a,0xde));var _0xa757=function(_0x3abba4,_0x405639){_0x3abba4=_0x3abba4-0x0;var _0x26b4f5=_0x757a[_0x3abba4];return _0x26b4f5;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 59dc4fc..44f9363 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 _0xae73=['key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','ValidationError','add','Queues','ids','remove','addAgents','isArray','Voice','Chat','Sms','Openchannel','Whatsapp','penalty','QueueId','defaults','TeamVoiceQueue','User','emit','findAll','online','UserVoiceQueueRt','upsert','interface','SIP/%s','all','spread','removeAgents','Mail','Fax','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','redis','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','Team','rawAttributes','fieldName','type'];(function(_0x5b4881,_0x38dc50){var _0x221ed6=function(_0x396b84){while(--_0x396b84){_0x5b4881['push'](_0x5b4881['shift']());}};_0x221ed6(++_0x38dc50);}(_0xae73,0x1a0));var _0x3ae7=function(_0x1408b4,_0x22e866){_0x1408b4=_0x1408b4-0x0;var _0x39276b=_0xae73[_0x1408b4];return _0x39276b;};'use strict';var emlformat=require(_0x3ae7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ae7('0x1'));var jsonpatch=require(_0x3ae7('0x2'));var rp=require(_0x3ae7('0x3'));var moment=require(_0x3ae7('0x4'));var BPromise=require(_0x3ae7('0x5'));var Mustache=require(_0x3ae7('0x6'));var util=require(_0x3ae7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3ae7('0x8'));var ejs=require(_0x3ae7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ae7('0xa'));var squel=require(_0x3ae7('0xb'));var crypto=require(_0x3ae7('0xc'));var jsforce=require(_0x3ae7('0xd'));var deskjs=require(_0x3ae7('0xe'));var toCsv=require(_0x3ae7('0x8'));var querystring=require(_0x3ae7('0xf'));var Papa=require(_0x3ae7('0x10'));var Redis=require(_0x3ae7('0x11'));var authService=require(_0x3ae7('0x12'));var qs=require(_0x3ae7('0x13'));var as=require(_0x3ae7('0x14'));var hardwareService=require(_0x3ae7('0x15'));var logger=require(_0x3ae7('0x16'))(_0x3ae7('0x17'));var utils=require(_0x3ae7('0x18'));var config=require(_0x3ae7('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3ae7('0x1a'),'port':0x18eb});var socket=require(_0x3ae7('0x1b'))(new Redis(config[_0x3ae7('0x1c')]));require('./team.socket')[_0x3ae7('0x1d')](socket);function respondWithStatusCode(_0x297df7,_0x537b2c){_0x537b2c=_0x537b2c||0xcc;return function(_0x36b45a){if(_0x36b45a){return _0x297df7[_0x3ae7('0x1e')](_0x537b2c);}return _0x297df7['status'](_0x537b2c)['end']();};}function respondWithResult(_0x592eee,_0xf8195d){_0xf8195d=_0xf8195d||0xc8;return function(_0x4798a7){if(_0x4798a7){return _0x592eee[_0x3ae7('0x1f')](_0xf8195d)[_0x3ae7('0x20')](_0x4798a7);}};}function respondWithFilteredResult(_0x1f87c0,_0x39f5c1){return function(_0x3d0ba2){if(_0x3d0ba2){var _0x4ed1a9=typeof _0x39f5c1[_0x3ae7('0x21')]===_0x3ae7('0x22')&&typeof _0x39f5c1[_0x3ae7('0x23')]===_0x3ae7('0x22');var _0x1a75c0=_0x3d0ba2[_0x3ae7('0x24')];var _0x54e8c5=_0x4ed1a9?0x0:_0x39f5c1[_0x3ae7('0x21')];var _0x208811=_0x4ed1a9?_0x3d0ba2[_0x3ae7('0x24')]:_0x39f5c1[_0x3ae7('0x21')]+_0x39f5c1[_0x3ae7('0x23')];var _0xfebc2f;if(_0x208811>=_0x1a75c0){_0x208811=_0x1a75c0;_0xfebc2f=0xc8;}else{_0xfebc2f=0xce;}_0x1f87c0[_0x3ae7('0x1f')](_0xfebc2f);return _0x1f87c0[_0x3ae7('0x25')](_0x3ae7('0x26'),_0x54e8c5+'-'+_0x208811+'/'+_0x1a75c0)['json'](_0x3d0ba2);}return null;};}function patchUpdates(_0x145956){return function(_0x57aed5){try{jsonpatch[_0x3ae7('0x27')](_0x57aed5,_0x145956,!![]);}catch(_0x43351e){return BPromise[_0x3ae7('0x28')](_0x43351e);}return _0x57aed5[_0x3ae7('0x29')]();};}function saveUpdates(_0x2b25bd,_0x1311bf){return function(_0x59a2e4){if(_0x59a2e4){return _0x59a2e4['update'](_0x2b25bd)[_0x3ae7('0x2a')](function(_0x49218d){return _0x49218d;});}return null;};}function handleEntityNotFound(_0x2eccba,_0x308141){return function(_0x17d47a){if(!_0x17d47a){_0x2eccba[_0x3ae7('0x1e')](0x194);}return _0x17d47a;};}function handleError(_0x4818cc,_0x2397c9){_0x2397c9=_0x2397c9||0x1f4;return function(_0x770ed1){logger[_0x3ae7('0x2b')](_0x770ed1['stack']);if(_0x770ed1[_0x3ae7('0x2c')]){delete _0x770ed1['name'];}_0x4818cc['status'](_0x2397c9)[_0x3ae7('0x2d')](_0x770ed1);};}exports[_0x3ae7('0x2e')]=function(_0x5640d5,_0x4d7ad7){var _0x8a6c1d={},_0x96249f={},_0x29fc45={'count':0x0,'rows':[]};var _0x308959=_[_0x3ae7('0x2f')](db[_0x3ae7('0x30')][_0x3ae7('0x31')],function(_0x5d7561){return{'name':_0x5d7561[_0x3ae7('0x32')],'type':_0x5d7561[_0x3ae7('0x33')][_0x3ae7('0x34')]};});_0x96249f[_0x3ae7('0x35')]=_['map'](_0x308959,'name');_0x96249f[_0x3ae7('0x36')]=_['keys'](_0x5640d5['query']);_0x96249f[_0x3ae7('0x37')]=_[_0x3ae7('0x38')](_0x96249f[_0x3ae7('0x35')],_0x96249f['query']);_0x8a6c1d[_0x3ae7('0x39')]=_[_0x3ae7('0x38')](_0x96249f[_0x3ae7('0x35')],qs[_0x3ae7('0x3a')](_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x3a')]));_0x8a6c1d[_0x3ae7('0x39')]=_0x8a6c1d['attributes']['length']?_0x8a6c1d[_0x3ae7('0x39')]:_0x96249f['model'];if(!_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x3b')](_0x3ae7('0x3c'))){_0x8a6c1d[_0x3ae7('0x23')]=qs['limit'](_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x23')]);_0x8a6c1d[_0x3ae7('0x21')]=qs['offset'](_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x21')]);}_0x8a6c1d[_0x3ae7('0x3d')]=qs['sort'](_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x3e')]);_0x8a6c1d[_0x3ae7('0x3f')]=qs[_0x3ae7('0x37')](_[_0x3ae7('0x40')](_0x5640d5[_0x3ae7('0x36')],_0x96249f['filters']),_0x308959);if(_0x5640d5[_0x3ae7('0x36')][_0x3ae7('0x41')]){_0x8a6c1d['where']=_[_0x3ae7('0x42')](_0x8a6c1d['where'],{'$or':_[_0x3ae7('0x2f')](_0x308959,function(_0x533b89){if(_0x533b89[_0x3ae7('0x33')]!==_0x3ae7('0x43')){var _0x21731a={};_0x21731a[_0x533b89[_0x3ae7('0x2c')]]={'$like':'%'+_0x5640d5[_0x3ae7('0x36')]['filter']+'%'};return _0x21731a;}})});}_0x8a6c1d=_[_0x3ae7('0x42')]({},_0x8a6c1d,_0x5640d5[_0x3ae7('0x44')]);var _0x16bae8={'where':_0x8a6c1d[_0x3ae7('0x3f')]};return db[_0x3ae7('0x30')][_0x3ae7('0x24')](_0x16bae8)[_0x3ae7('0x2a')](function(_0x38036b){_0x29fc45['count']=_0x38036b;if(_0x5640d5['query'][_0x3ae7('0x45')]){_0x8a6c1d[_0x3ae7('0x46')]=[{'all':!![]}];}return db[_0x3ae7('0x30')]['findAll'](_0x8a6c1d);})[_0x3ae7('0x2a')](function(_0x210c1d){_0x29fc45[_0x3ae7('0x47')]=_0x210c1d;return _0x29fc45;})[_0x3ae7('0x2a')](respondWithFilteredResult(_0x4d7ad7,_0x8a6c1d))['catch'](handleError(_0x4d7ad7,null));};exports[_0x3ae7('0x48')]=function(_0x19b27e,_0x5f2f6b){var _0x1ad218={'raw':![],'where':{'id':_0x19b27e[_0x3ae7('0x49')]['id']}},_0x26112c={};_0x26112c['model']=_[_0x3ae7('0x4a')](db[_0x3ae7('0x30')][_0x3ae7('0x31')]);_0x26112c[_0x3ae7('0x36')]=_['keys'](_0x19b27e[_0x3ae7('0x36')]);_0x26112c[_0x3ae7('0x37')]=_['intersection'](_0x26112c['model'],_0x26112c[_0x3ae7('0x36')]);_0x1ad218['attributes']=_['intersection'](_0x26112c['model'],qs['fields'](_0x19b27e[_0x3ae7('0x36')][_0x3ae7('0x3a')]));_0x1ad218['attributes']=_0x1ad218[_0x3ae7('0x39')][_0x3ae7('0x4b')]?_0x1ad218[_0x3ae7('0x39')]:_0x26112c[_0x3ae7('0x35')];if(_0x19b27e['query'][_0x3ae7('0x45')]){_0x1ad218[_0x3ae7('0x46')]=[{'all':!![]}];}_0x1ad218=_[_0x3ae7('0x42')]({},_0x1ad218,_0x19b27e['options']);return db[_0x3ae7('0x30')][_0x3ae7('0x4c')](_0x1ad218)[_0x3ae7('0x2a')](handleEntityNotFound(_0x5f2f6b,null))['then'](respondWithResult(_0x5f2f6b,null))['catch'](handleError(_0x5f2f6b,null));};exports[_0x3ae7('0x4d')]=function(_0x2c72d7,_0x1fc811){return db[_0x3ae7('0x30')]['create'](_0x2c72d7[_0x3ae7('0x4e')],{})[_0x3ae7('0x2a')](function(_0x10c67f){var _0x3cf134=_0x2c72d7[_0x3ae7('0x4f')][_0x3ae7('0x50')]({'plain':!![]});if(!_0x3cf134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cf134[_0x3ae7('0x51')]===_0x3ae7('0x4f')){var _0x471f79=_0x10c67f['get']({'plain':!![]});var _0x309a17=_0x3ae7('0x52');return db[_0x3ae7('0x53')][_0x3ae7('0x4c')]({'where':{'name':_0x309a17,'userProfileId':_0x3cf134[_0x3ae7('0x54')]},'raw':!![]})[_0x3ae7('0x2a')](function(_0x42005a){if(_0x42005a&&_0x42005a[_0x3ae7('0x55')]===0x0){return db[_0x3ae7('0x56')][_0x3ae7('0x4d')]({'name':_0x471f79['name'],'resourceId':_0x471f79['id'],'type':_0x42005a[_0x3ae7('0x2c')],'sectionId':_0x42005a['id']},{})[_0x3ae7('0x2a')](function(){return _0x10c67f;});}else{return _0x10c67f;}})[_0x3ae7('0x57')](function(_0x18cf9d){logger['error'](_0x3ae7('0x58'),_0x18cf9d);throw _0x18cf9d;});}return _0x10c67f;})[_0x3ae7('0x2a')](respondWithResult(_0x1fc811,0xc9))['catch'](handleError(_0x1fc811,null));};exports[_0x3ae7('0x59')]=function(_0xc19998,_0x2274a5){if(_0xc19998[_0x3ae7('0x4e')]['id']){delete _0xc19998[_0x3ae7('0x4e')]['id'];}return db[_0x3ae7('0x30')][_0x3ae7('0x4c')]({'where':{'id':_0xc19998[_0x3ae7('0x49')]['id']}})[_0x3ae7('0x2a')](handleEntityNotFound(_0x2274a5,null))['then'](saveUpdates(_0xc19998['body'],null))[_0x3ae7('0x2a')](respondWithResult(_0x2274a5,null))[_0x3ae7('0x57')](handleError(_0x2274a5,null));};exports[_0x3ae7('0x5a')]=function(_0x25a0f7,_0x33ea63){var _0x5c9151=_0x25a0f7['params']['id'];var _0xaf255c=[];return db[_0x3ae7('0x5b')][_0x3ae7('0x5c')](function(_0x44bfc2){var _0x1f0115='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5c9151;return db['sequelize']['query'](_0x1f0115,{'type':db[_0x3ae7('0x5d')][_0x3ae7('0x5e')][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2})[_0x3ae7('0x2a')](function(_0xb349da){_0xaf255c=_[_0x3ae7('0x2f')](_0xb349da,function(_0x2c2ae2){return Number(_0x2c2ae2[_0x3ae7('0x60')]);});})[_0x3ae7('0x2a')](function(){var _0x3d9bac=_0x3ae7('0x61')+_0x5c9151;return db[_0x3ae7('0x5b')]['query'](_0x3d9bac,{'type':db[_0x3ae7('0x5d')]['QueryTypes'][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x326b0d){var _0x31f2c1=_['map'](_0x326b0d,function(_0x48da9e){return Number(_0x48da9e[_0x3ae7('0x62')]);});return db[_0x3ae7('0x63')][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'VoiceQueueId':{'$in':_0x31f2c1}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0x2eeb1a=_0x3ae7('0x64')+_0x5c9151;return db['sequelize'][_0x3ae7('0x36')](_0x2eeb1a,{'type':db[_0x3ae7('0x5d')]['QueryTypes'][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x1fa691){var _0x53dc09=_[_0x3ae7('0x2f')](_0x1fa691,function(_0x52e539){return Number(_0x52e539[_0x3ae7('0x65')]);});return db[_0x3ae7('0x66')]['destroy']({'where':{'UserId':{'$in':_0xaf255c},'MailQueueId':{'$in':_0x53dc09}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0xd5730d=_0x3ae7('0x67')+_0x5c9151;return db[_0x3ae7('0x5b')][_0x3ae7('0x36')](_0xd5730d,{'type':db[_0x3ae7('0x5d')][_0x3ae7('0x5e')][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x2babc2){var _0x19ce1e=_['map'](_0x2babc2,function(_0x2f4e39){return Number(_0x2f4e39[_0x3ae7('0x68')]);});return db[_0x3ae7('0x69')][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'SmsQueueId':{'$in':_0x19ce1e}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0x2b30cd='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5c9151;return db[_0x3ae7('0x5b')][_0x3ae7('0x36')](_0x2b30cd,{'type':db[_0x3ae7('0x5d')]['QueryTypes'][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x2cdb62){var _0x460dbd=_[_0x3ae7('0x2f')](_0x2cdb62,function(_0x19d1e0){return Number(_0x19d1e0[_0x3ae7('0x6a')]);});return db['UserChatQueue'][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'ChatQueueId':{'$in':_0x460dbd}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0x505c3f=_0x3ae7('0x6b')+_0x5c9151;return db[_0x3ae7('0x5b')][_0x3ae7('0x36')](_0x505c3f,{'type':db['Sequelize']['QueryTypes'][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})['then'](function(_0xcfd06c){var _0x297f69=_[_0x3ae7('0x2f')](_0xcfd06c,function(_0x7f3c30){return Number(_0x7f3c30[_0x3ae7('0x6c')]);});return db[_0x3ae7('0x6d')][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'FaxQueueId':{'$in':_0x297f69}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0x484021='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5c9151;return db[_0x3ae7('0x5b')][_0x3ae7('0x36')](_0x484021,{'type':db['Sequelize'][_0x3ae7('0x5e')][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})['then'](function(_0xa913b8){var _0x515ff8=_[_0x3ae7('0x2f')](_0xa913b8,function(_0x35b6e4){return Number(_0x35b6e4[_0x3ae7('0x6e')]);});return db['UserOpenchannelQueue'][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'OpenchannelQueueId':{'$in':_0x515ff8}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){var _0x12f913=_0x3ae7('0x6f')+_0x5c9151;return db[_0x3ae7('0x5b')][_0x3ae7('0x36')](_0x12f913,{'type':db[_0x3ae7('0x5d')][_0x3ae7('0x5e')][_0x3ae7('0x5f')],'raw':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x59011d){var _0x34e41a=_[_0x3ae7('0x2f')](_0x59011d,function(_0x2f7029){return Number(_0x2f7029[_0x3ae7('0x70')]);});return db['UserWhatsappQueue'][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'WhatsappQueueId':{'$in':_0x34e41a}},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){return db[_0x3ae7('0x71')][_0x3ae7('0x4c')]({'where':{'TeamId':_0x5c9151}});})[_0x3ae7('0x2a')](function(_0x375f0b){if(_0x375f0b===null){return;}return db[_0x3ae7('0x72')][_0x3ae7('0x5a')]({'where':{'UserId':{'$in':_0xaf255c},'VoicePrefixId':_0x375f0b[_0x3ae7('0x73')]},'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(){return db[_0x3ae7('0x30')]['destroy']({'where':{'id':_0x5c9151},'cascade':!![],'transaction':_0x44bfc2});})[_0x3ae7('0x2a')](function(_0x57227f){if(_0x57227f===0x0){_0x33ea63[_0x3ae7('0x1e')](0x194);}else{return db['UserProfileResource'][_0x3ae7('0x5a')]({'where':{'type':_0x3ae7('0x52'),'resourceId':_0x5c9151},'cascade':!![],'transaction':_0x44bfc2})[_0x3ae7('0x2a')](function(){_0x33ea63[_0x3ae7('0x1f')](0xcc)['end']();});}})['catch'](function(_0x2ff7cc){_0x33ea63['status'](0x1f4)['send'](_0x2ff7cc);});});};exports[_0x3ae7('0x74')]=function(_0x4ba8f2,_0x422452,_0x43eae9){return db['Team'][_0x3ae7('0x75')]({'where':{'id':_0x4ba8f2[_0x3ae7('0x49')]['id']}})[_0x3ae7('0x2a')](handleEntityNotFound(_0x422452,null))[_0x3ae7('0x2a')](function(_0xd40227){if(!_0x4ba8f2['query'][_0x3ae7('0x76')]||!utils['isValidChannel'](_0x4ba8f2['query']['channel'])){throw new db[(_0x3ae7('0x5d'))]['ValidationError'](_0x3ae7('0x77'));}var _0x488174={};var _0x1777f8={};_0x1777f8[_0x3ae7('0x35')]=_[_0x3ae7('0x4a')](db[_[_0x3ae7('0x78')](_0x4ba8f2[_0x3ae7('0x36')][_0x3ae7('0x76')][_0x3ae7('0x79')]())+_0x3ae7('0x7a')][_0x3ae7('0x31')]);_0x1777f8[_0x3ae7('0x36')]=_['keys'](_0x4ba8f2[_0x3ae7('0x36')]);_0x1777f8['filters']=_[_0x3ae7('0x38')](_0x1777f8[_0x3ae7('0x35')],_0x1777f8[_0x3ae7('0x36')]);_0x488174['attributes']=_[_0x3ae7('0x38')](_0x1777f8[_0x3ae7('0x35')],qs[_0x3ae7('0x3a')](_0x4ba8f2[_0x3ae7('0x36')][_0x3ae7('0x3a')]));_0x488174[_0x3ae7('0x39')]=_0x488174[_0x3ae7('0x39')][_0x3ae7('0x4b')]?_0x488174[_0x3ae7('0x39')]:_0x1777f8[_0x3ae7('0x35')];_0x488174[_0x3ae7('0x23')]=qs['limit'](_0x4ba8f2[_0x3ae7('0x36')]['limit']);_0x488174['offset']=qs[_0x3ae7('0x21')](_0x4ba8f2[_0x3ae7('0x36')][_0x3ae7('0x21')]);_0x488174[_0x3ae7('0x3d')]=qs['sort'](_0x4ba8f2[_0x3ae7('0x36')][_0x3ae7('0x3e')]);_0x488174[_0x3ae7('0x3f')]=qs[_0x3ae7('0x37')](_[_0x3ae7('0x40')](_0x4ba8f2[_0x3ae7('0x36')],_0x1777f8[_0x3ae7('0x37')]));_0x488174=_[_0x3ae7('0x42')]({},_0x488174,_0x4ba8f2[_0x3ae7('0x44')]);return _0xd40227[_0x3ae7('0x50')+_[_0x3ae7('0x78')](_0x4ba8f2['query'][_0x3ae7('0x76')][_0x3ae7('0x79')]())+'Queues'](_0x488174);})[_0x3ae7('0x2a')](respondWithResult(_0x422452,null))[_0x3ae7('0x57')](handleError(_0x422452,null));};exports[_0x3ae7('0x7b')]=function(_0x2f9498,_0x1266fe,_0x436cf3){return db[_0x3ae7('0x30')][_0x3ae7('0x75')]({'where':{'id':_0x2f9498['params']['id']}})[_0x3ae7('0x2a')](function(_0x15bb8e){if(_0x15bb8e){if(!_0x2f9498[_0x3ae7('0x4e')]['channel']||!utils[_0x3ae7('0x7c')](_0x2f9498[_0x3ae7('0x4e')][_0x3ae7('0x76')])){throw new db[(_0x3ae7('0x5d'))][(_0x3ae7('0x7d'))]('Unknown\x20channel');}return _0x15bb8e[_0x3ae7('0x7e')+_[_0x3ae7('0x78')](_0x2f9498[_0x3ae7('0x4e')][_0x3ae7('0x76')][_0x3ae7('0x79')]())+_0x3ae7('0x7f')](_0x2f9498['body'][_0x3ae7('0x80')]);}return null;})['then'](handleEntityNotFound(_0x1266fe,null))[_0x3ae7('0x2a')](respondWithStatusCode(_0x1266fe,null))['catch'](handleError(_0x1266fe,null));};exports['removeQueues']=function(_0x2471d7,_0x149e75,_0x56ab2c){return db[_0x3ae7('0x30')][_0x3ae7('0x75')]({'where':{'id':_0x2471d7[_0x3ae7('0x49')]['id']}})[_0x3ae7('0x2a')](function(_0x5b2cba){if(_0x5b2cba){if(!_0x2471d7['query'][_0x3ae7('0x76')]||!utils['isValidChannel'](_0x2471d7['query'][_0x3ae7('0x76')])){throw new db[(_0x3ae7('0x5d'))][(_0x3ae7('0x7d'))](_0x3ae7('0x77'));}return _0x5b2cba[_0x3ae7('0x81')+_[_0x3ae7('0x78')](_0x2471d7[_0x3ae7('0x36')][_0x3ae7('0x76')][_0x3ae7('0x79')]())+_0x3ae7('0x7f')](_0x2471d7['query']['ids']);}return null;})[_0x3ae7('0x2a')](handleEntityNotFound(_0x149e75,null))[_0x3ae7('0x2a')](respondWithStatusCode(_0x149e75,null))[_0x3ae7('0x57')](handleError(_0x149e75,null));};exports[_0x3ae7('0x82')]=function(_0x53810c,_0x52eeed){var _0x243df3=_[_0x3ae7('0x83')](_0x53810c[_0x3ae7('0x4e')][_0x3ae7('0x80')])?_0x53810c[_0x3ae7('0x4e')][_0x3ae7('0x80')]:[_0x53810c['body'][_0x3ae7('0x80')]];var _0x5e4111=_0x53810c[_0x3ae7('0x49')]['id'];return db[_0x3ae7('0x30')][_0x3ae7('0x4c')]({'where':{'id':_0x5e4111}})[_0x3ae7('0x2a')](handleEntityNotFound(_0x52eeed,null))[_0x3ae7('0x2a')](function(_0x16799a){if(_0x16799a){var _0x49193a=[_0x3ae7('0x84'),_0x3ae7('0x85'),'Mail',_0x3ae7('0x86'),'Fax',_0x3ae7('0x87'),_0x3ae7('0x88')];return db[_0x3ae7('0x5b')]['transaction'](function(_0x72a70f){var _0x23a539=_[_0x3ae7('0x2f')](_0x49193a,function(_0x5ad4ed){var _0x2e5887={'attributes':['id',_0x3ae7('0x2c')]};if(_0x5ad4ed==='Voice'){_0x2e5887['through']={'attributes':[_0x3ae7('0x89')]};}return _0x16799a[_0x3ae7('0x50')+_0x5ad4ed+_0x3ae7('0x7f')](_0x2e5887)[_0x3ae7('0x2a')](function(_0x3a5899){var _0x4af47e=_['map'](_0x3a5899,function(_0x230b2b){var _0x10f9bb=_[_0x3ae7('0x2f')](_0x243df3,function(_0x58f197){var _0x48bff8={'where':{'UserId':_0x58f197,[_0x5ad4ed+_0x3ae7('0x8a')]:_0x230b2b['id']},'transaction':_0x72a70f};if(_0x5ad4ed===_0x3ae7('0x84')){_0x48bff8[_0x3ae7('0x8b')]={'penalty':_0x230b2b[_0x3ae7('0x8c')][_0x3ae7('0x89')]};}return db[_0x3ae7('0x8d')+_0x5ad4ed+_0x3ae7('0x7a')]['findOrCreate'](_0x48bff8)['then'](function(){socket[_0x3ae7('0x8e')](_0x3ae7('0x4f')+_0x5ad4ed+'Queue:save',{'UserId':_0x58f197,[_0x5ad4ed+_0x3ae7('0x8a')]:_0x230b2b['id']});if(_0x5ad4ed!=='Voice'){return;}return db[_0x3ae7('0x8d')][_0x3ae7('0x8f')]({'where':{'id':_0x243df3,'online':0x1},'attributes':['id',_0x3ae7('0x2c'),_0x3ae7('0x90'),'voicePause','interface'],'raw':!![]})[_0x3ae7('0x2a')](function(_0x5f4a32){var _0x2716ba=_[_0x3ae7('0x2f')](_0x5f4a32,function(_0x3f8c69){return db[_0x3ae7('0x91')][_0x3ae7('0x92')]({'membername':_0x3f8c69[_0x3ae7('0x2c')],'UserId':_0x3f8c69['id'],'queue_name':_0x230b2b[_0x3ae7('0x2c')],'VoiceQueueId':_0x230b2b['id'],'interface':_['isNil'](_0x3f8c69[_0x3ae7('0x93')])?util['format'](_0x3ae7('0x94'),_0x3f8c69[_0x3ae7('0x2c')]):_0x3f8c69[_0x3ae7('0x93')],'paused':_0x3f8c69['voicePause']||![],'penalty':_0x230b2b[_0x3ae7('0x8c')][_0x3ae7('0x89')]},{'transaction':_0x72a70f});});return Promise[_0x3ae7('0x95')](_0x2716ba);});});});return Promise['all'](_0x10f9bb);});return Promise[_0x3ae7('0x95')](_0x4af47e);})['then'](function(){return db['TeamVoicePrefix'][_0x3ae7('0x75')]({'where':{'teamId':_0x5e4111}})[_0x3ae7('0x2a')](function(_0x568bef){if(_0x568bef){var _0x5153f0=_['map'](_0x243df3,function(_0x206fd3){db[_0x3ae7('0x72')][_0x3ae7('0x92')]({'UserId':_0x206fd3,'VoicePrefixId':_0x568bef[_0x3ae7('0x73')]});});return Promise[_0x3ae7('0x95')](_0x5153f0);}});});});return Promise[_0x3ae7('0x95')](_0x23a539)[_0x3ae7('0x2a')](function(){return _0x16799a[_0x3ae7('0x82')](_0x243df3,{'transaction':_0x72a70f})[_0x3ae7('0x96')](function(_0x177260){return _0x177260;});});});}})[_0x3ae7('0x2a')](respondWithResult(_0x52eeed,null))[_0x3ae7('0x57')](handleError(_0x52eeed,null));};exports[_0x3ae7('0x97')]=function(_0x4f2fdc,_0x12222e){var _0xebb183=_['isArray'](_0x4f2fdc[_0x3ae7('0x36')][_0x3ae7('0x80')])?_0x4f2fdc[_0x3ae7('0x36')][_0x3ae7('0x80')]:[_0x4f2fdc['query'][_0x3ae7('0x80')]];var _0x546351=_0x4f2fdc[_0x3ae7('0x49')]['id'];return db['Team']['find']({'where':{'id':_0x546351}})[_0x3ae7('0x2a')](handleEntityNotFound(_0x12222e,null))[_0x3ae7('0x2a')](function(_0x2c57bc){if(_0x2c57bc){var _0x51ca1f=[_0x3ae7('0x84'),_0x3ae7('0x85'),_0x3ae7('0x98'),_0x3ae7('0x86'),_0x3ae7('0x99'),_0x3ae7('0x87'),_0x3ae7('0x88')];return db[_0x3ae7('0x5b')][_0x3ae7('0x5c')](function(_0x46f521){var _0xee5b98=_[_0x3ae7('0x2f')](_0x51ca1f,function(_0xaf4384){var _0x3daea1={'attributes':['id',_0x3ae7('0x2c')]};return _0x2c57bc[_0x3ae7('0x50')+_0xaf4384+_0x3ae7('0x7f')](_0x3daea1)['then'](function(_0x523eb2){var _0xe4438a=_[_0x3ae7('0x2f')](_0x523eb2,function(_0x108151){return _0x108151[_0x3ae7('0x97')](_0xebb183,{'transaction':_0x46f521})[_0x3ae7('0x2a')](function(){var _0x1f1ee2=_[_0x3ae7('0x2f')](_0xebb183,function(_0x287ec0){socket['emit'](_0x3ae7('0x4f')+_0xaf4384+_0x3ae7('0x9a'),{'UserId':Number(_0x287ec0),[_0xaf4384+'QueueId']:_0x108151['id']});if(_0xaf4384!==_0x3ae7('0x84')){return;}return db[_0x3ae7('0x91')]['destroy']({'where':{'VoiceQueueId':_0x108151['id'],'UserId':_0x287ec0},'transaction':_0x46f521});});return Promise[_0x3ae7('0x95')](_0x1f1ee2);});});return Promise[_0x3ae7('0x95')](_0xe4438a);});});return Promise[_0x3ae7('0x95')](_0xee5b98)[_0x3ae7('0x2a')](function(){return _0x2c57bc[_0x3ae7('0x97')](_0xebb183,{'transaction':_0x46f521});})[_0x3ae7('0x2a')](function(){return db['TeamVoicePrefix'][_0x3ae7('0x75')]({'where':{'teamId':_0x546351}})[_0x3ae7('0x2a')](function(_0x466f9b){if(_0x466f9b){var _0x49679d=_[_0x3ae7('0x2f')](_0xebb183,function(_0x506fd4){db[_0x3ae7('0x72')][_0x3ae7('0x5a')]({'where':{'UserId':_0x506fd4,'VoicePrefixId':_0x466f9b[_0x3ae7('0x73')]}});});return Promise[_0x3ae7('0x95')](_0x49679d);}});});});}})[_0x3ae7('0x2a')](respondWithStatusCode(_0x12222e,null))['catch'](handleError(_0x12222e,null));};exports[_0x3ae7('0x9b')]=function(_0x276ee9,_0x48e09c,_0x47bd07){var _0x534674={};var _0x1d82aa={};var _0x10ede2;var _0x105cd1;return db[_0x3ae7('0x30')]['findOne']({'where':{'id':_0x276ee9[_0x3ae7('0x49')]['id']}})['then'](handleEntityNotFound(_0x48e09c,null))['then'](function(_0x573560){if(_0x573560){_0x10ede2=_0x573560;_0x1d82aa[_0x3ae7('0x35')]=_['keys'](db[_0x3ae7('0x8d')][_0x3ae7('0x31')]);_0x1d82aa['query']=_['keys'](_0x276ee9['query']);_0x1d82aa[_0x3ae7('0x37')]=_[_0x3ae7('0x38')](_0x1d82aa['model'],_0x1d82aa[_0x3ae7('0x36')]);_0x534674[_0x3ae7('0x39')]=_[_0x3ae7('0x38')](_0x1d82aa[_0x3ae7('0x35')],qs[_0x3ae7('0x3a')](_0x276ee9[_0x3ae7('0x36')][_0x3ae7('0x3a')]));_0x534674['attributes']=_0x534674['attributes'][_0x3ae7('0x4b')]?_0x534674['attributes']:_0x1d82aa[_0x3ae7('0x35')];_0x534674['order']=qs[_0x3ae7('0x3e')](_0x276ee9[_0x3ae7('0x36')][_0x3ae7('0x3e')]);_0x534674[_0x3ae7('0x3f')]=qs['filters'](_[_0x3ae7('0x40')](_0x276ee9['query'],_0x1d82aa[_0x3ae7('0x37')]));if(_0x276ee9[_0x3ae7('0x36')]['filter']){_0x534674['where']=_[_0x3ae7('0x42')](_0x534674[_0x3ae7('0x3f')],{'$or':_[_0x3ae7('0x2f')](_0x534674[_0x3ae7('0x39')],function(_0x4ccb48){var _0x341a35={};_0x341a35[_0x4ccb48]={'$like':'%'+_0x276ee9[_0x3ae7('0x36')][_0x3ae7('0x41')]+'%'};return _0x341a35;})});}_0x534674=_[_0x3ae7('0x42')]({},_0x534674,_0x276ee9[_0x3ae7('0x44')]);return _0x10ede2[_0x3ae7('0x9b')](_0x534674);}})[_0x3ae7('0x2a')](function(_0x31b094){if(_0x31b094){_0x105cd1=_0x31b094[_0x3ae7('0x4b')];if(!_0x276ee9['query'][_0x3ae7('0x3b')](_0x3ae7('0x3c'))){_0x534674[_0x3ae7('0x23')]=qs[_0x3ae7('0x23')](_0x276ee9[_0x3ae7('0x36')][_0x3ae7('0x23')]);_0x534674[_0x3ae7('0x21')]=qs[_0x3ae7('0x21')](_0x276ee9[_0x3ae7('0x36')][_0x3ae7('0x21')]);}return _0x10ede2[_0x3ae7('0x9b')](_0x534674);}})['then'](function(_0x427050){if(_0x427050){return _0x427050?{'count':_0x105cd1,'rows':_0x427050}:null;}})[_0x3ae7('0x2a')](respondWithResult(_0x48e09c,null))['catch'](handleError(_0x48e09c,null));}; \ No newline at end of file +var _0xeac5=['Sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','isValidChannel','ValidationError','options','capitalize','toLowerCase','Queues','findOne','Unknown\x20channel','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','findAll','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','all','VoicePrefixId','removeAgents','getAgents','hasOwnProperty','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','Team','type','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x1bf525,_0x2d926f){var _0x5ea7de=function(_0x30c6cf){while(--_0x30c6cf){_0x1bf525['push'](_0x1bf525['shift']());}};_0x5ea7de(++_0x2d926f);}(_0xeac5,0xcb));var _0x5eac=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0xeac5[_0x2ee790];return _0x5a54a5;};'use strict';var emlformat=require(_0x5eac('0x0'));var rimraf=require(_0x5eac('0x1'));var zipdir=require(_0x5eac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eac('0x3'));var moment=require(_0x5eac('0x4'));var BPromise=require(_0x5eac('0x5'));var Mustache=require(_0x5eac('0x6'));var util=require(_0x5eac('0x7'));var path=require(_0x5eac('0x8'));var sox=require(_0x5eac('0x9'));var csv=require(_0x5eac('0xa'));var ejs=require(_0x5eac('0xb'));var fs=require('fs');var fs_extra=require(_0x5eac('0xc'));var _=require(_0x5eac('0xd'));var squel=require(_0x5eac('0xe'));var crypto=require(_0x5eac('0xf'));var jsforce=require(_0x5eac('0x10'));var deskjs=require(_0x5eac('0x11'));var toCsv=require(_0x5eac('0xa'));var querystring=require(_0x5eac('0x12'));var Papa=require(_0x5eac('0x13'));var Redis=require('ioredis');var authService=require(_0x5eac('0x14'));var qs=require(_0x5eac('0x15'));var as=require(_0x5eac('0x16'));var hardwareService=require(_0x5eac('0x17'));var logger=require(_0x5eac('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x5eac('0x19'));var licenseUtil=require(_0x5eac('0x1a'));var db=require(_0x5eac('0x1b'))['db'];config[_0x5eac('0x1c')]=_[_0x5eac('0x1d')](config[_0x5eac('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5eac('0x1e'))(new Redis(config['redis']));require('./team.socket')[_0x5eac('0x1f')](socket);function respondWithStatusCode(_0x5f08df,_0x13fa29){_0x13fa29=_0x13fa29||0xcc;return function(_0x2620ce){if(_0x2620ce){return _0x5f08df['sendStatus'](_0x13fa29);}return _0x5f08df[_0x5eac('0x20')](_0x13fa29)['end']();};}function respondWithResult(_0x2e13b3,_0x5d7a73){_0x5d7a73=_0x5d7a73||0xc8;return function(_0x56b76f){if(_0x56b76f){return _0x2e13b3[_0x5eac('0x20')](_0x5d7a73)[_0x5eac('0x21')](_0x56b76f);}};}function respondWithFilteredResult(_0x246614,_0x1d8dbc){return function(_0xbcc355){if(_0xbcc355){var _0x57abf0=typeof _0x1d8dbc[_0x5eac('0x22')]==='undefined'&&typeof _0x1d8dbc[_0x5eac('0x23')]==='undefined';var _0x4b78b2=_0xbcc355['count'];var _0x45c3ba=_0x57abf0?0x0:_0x1d8dbc['offset'];var _0x495182=_0x57abf0?_0xbcc355[_0x5eac('0x24')]:_0x1d8dbc['offset']+_0x1d8dbc[_0x5eac('0x23')];var _0x73db98;if(_0x495182>=_0x4b78b2){_0x495182=_0x4b78b2;_0x73db98=0xc8;}else{_0x73db98=0xce;}_0x246614['status'](_0x73db98);return _0x246614[_0x5eac('0x25')](_0x5eac('0x26'),_0x45c3ba+'-'+_0x495182+'/'+_0x4b78b2)[_0x5eac('0x21')](_0xbcc355);}return null;};}function patchUpdates(_0x297f05){return function(_0x35dd08){try{jsonpatch['apply'](_0x35dd08,_0x297f05,!![]);}catch(_0x20e5ce){return BPromise[_0x5eac('0x27')](_0x20e5ce);}return _0x35dd08[_0x5eac('0x28')]();};}function saveUpdates(_0x6ccaeb,_0x5875fd){return function(_0x3f22ea){if(_0x3f22ea){return _0x3f22ea[_0x5eac('0x29')](_0x6ccaeb)[_0x5eac('0x2a')](function(_0x56c496){return _0x56c496;});}return null;};}function handleEntityNotFound(_0x408f62,_0x1e69c5){return function(_0x296fbd){if(!_0x296fbd){_0x408f62[_0x5eac('0x2b')](0x194);}return _0x296fbd;};}function handleError(_0x1c20d6,_0x50840f){_0x50840f=_0x50840f||0x1f4;return function(_0x498930){logger[_0x5eac('0x2c')](_0x498930[_0x5eac('0x2d')]);if(_0x498930[_0x5eac('0x2e')]){delete _0x498930['name'];}_0x1c20d6[_0x5eac('0x20')](_0x50840f)[_0x5eac('0x2f')](_0x498930);};}exports['index']=function(_0x3ec4a0,_0x429e90){var _0xfc3e4d={},_0xb2c590={},_0x4a5f42={'count':0x0,'rows':[]};var _0x1a1280=_['map'](db[_0x5eac('0x30')]['rawAttributes'],function(_0x3a0616){return{'name':_0x3a0616['fieldName'],'type':_0x3a0616[_0x5eac('0x31')]['key']};});_0xb2c590['model']=_[_0x5eac('0x32')](_0x1a1280,_0x5eac('0x2e'));_0xb2c590[_0x5eac('0x33')]=_['keys'](_0x3ec4a0['query']);_0xb2c590[_0x5eac('0x34')]=_[_0x5eac('0x35')](_0xb2c590[_0x5eac('0x36')],_0xb2c590[_0x5eac('0x33')]);_0xfc3e4d[_0x5eac('0x37')]=_['intersection'](_0xb2c590[_0x5eac('0x36')],qs[_0x5eac('0x38')](_0x3ec4a0['query'][_0x5eac('0x38')]));_0xfc3e4d['attributes']=_0xfc3e4d[_0x5eac('0x37')][_0x5eac('0x39')]?_0xfc3e4d['attributes']:_0xb2c590[_0x5eac('0x36')];if(!_0x3ec4a0[_0x5eac('0x33')]['hasOwnProperty'](_0x5eac('0x3a'))){_0xfc3e4d['limit']=qs[_0x5eac('0x23')](_0x3ec4a0[_0x5eac('0x33')][_0x5eac('0x23')]);_0xfc3e4d['offset']=qs[_0x5eac('0x22')](_0x3ec4a0['query'][_0x5eac('0x22')]);}_0xfc3e4d[_0x5eac('0x3b')]=qs[_0x5eac('0x3c')](_0x3ec4a0[_0x5eac('0x33')]['sort']);_0xfc3e4d[_0x5eac('0x3d')]=qs[_0x5eac('0x34')](_[_0x5eac('0x3e')](_0x3ec4a0[_0x5eac('0x33')],_0xb2c590['filters']),_0x1a1280);if(_0x3ec4a0['query'][_0x5eac('0x3f')]){_0xfc3e4d[_0x5eac('0x3d')]=_[_0x5eac('0x40')](_0xfc3e4d['where'],{'$or':_[_0x5eac('0x32')](_0x1a1280,function(_0x5dff2c){if(_0x5dff2c[_0x5eac('0x31')]!=='VIRTUAL'){var _0x58fdce={};_0x58fdce[_0x5dff2c['name']]={'$like':'%'+_0x3ec4a0[_0x5eac('0x33')][_0x5eac('0x3f')]+'%'};return _0x58fdce;}})});}_0xfc3e4d=_['merge']({},_0xfc3e4d,_0x3ec4a0['options']);var _0x1770e2={'where':_0xfc3e4d[_0x5eac('0x3d')]};return db[_0x5eac('0x30')]['count'](_0x1770e2)[_0x5eac('0x2a')](function(_0x58a838){_0x4a5f42[_0x5eac('0x24')]=_0x58a838;if(_0x3ec4a0['query'][_0x5eac('0x41')]){_0xfc3e4d[_0x5eac('0x42')]=[{'all':!![]}];}return db[_0x5eac('0x30')]['findAll'](_0xfc3e4d);})[_0x5eac('0x2a')](function(_0x34fe34){_0x4a5f42[_0x5eac('0x43')]=_0x34fe34;return _0x4a5f42;})['then'](respondWithFilteredResult(_0x429e90,_0xfc3e4d))[_0x5eac('0x44')](handleError(_0x429e90,null));};exports['show']=function(_0x1ed965,_0x2fb98d){var _0x2cbf0a={'raw':![],'where':{'id':_0x1ed965[_0x5eac('0x45')]['id']}},_0x3851ce={};_0x3851ce[_0x5eac('0x36')]=_[_0x5eac('0x46')](db['Team']['rawAttributes']);_0x3851ce[_0x5eac('0x33')]=_[_0x5eac('0x46')](_0x1ed965['query']);_0x3851ce[_0x5eac('0x34')]=_[_0x5eac('0x35')](_0x3851ce['model'],_0x3851ce[_0x5eac('0x33')]);_0x2cbf0a[_0x5eac('0x37')]=_[_0x5eac('0x35')](_0x3851ce[_0x5eac('0x36')],qs[_0x5eac('0x38')](_0x1ed965[_0x5eac('0x33')]['fields']));_0x2cbf0a['attributes']=_0x2cbf0a[_0x5eac('0x37')]['length']?_0x2cbf0a[_0x5eac('0x37')]:_0x3851ce[_0x5eac('0x36')];if(_0x1ed965['query']['includeAll']){_0x2cbf0a[_0x5eac('0x42')]=[{'all':!![]}];}_0x2cbf0a=_['merge']({},_0x2cbf0a,_0x1ed965['options']);return db[_0x5eac('0x30')][_0x5eac('0x47')](_0x2cbf0a)[_0x5eac('0x2a')](handleEntityNotFound(_0x2fb98d,null))[_0x5eac('0x2a')](respondWithResult(_0x2fb98d,null))[_0x5eac('0x44')](handleError(_0x2fb98d,null));};exports[_0x5eac('0x48')]=function(_0x289bbc,_0xe166a){return db['Team'][_0x5eac('0x48')](_0x289bbc['body'],{})[_0x5eac('0x2a')](function(_0x4ef183){var _0x277a08=_0x289bbc[_0x5eac('0x49')][_0x5eac('0x4a')]({'plain':!![]});if(!_0x277a08)throw new Error(_0x5eac('0x4b'));if(_0x277a08[_0x5eac('0x4c')]===_0x5eac('0x49')){var _0x291545=_0x4ef183[_0x5eac('0x4a')]({'plain':!![]});var _0x22dc0b=_0x5eac('0x4d');return db['UserProfileSection'][_0x5eac('0x47')]({'where':{'name':_0x22dc0b,'userProfileId':_0x277a08['userProfileId']},'raw':!![]})[_0x5eac('0x2a')](function(_0x141e6d){if(_0x141e6d&&_0x141e6d['autoAssociation']===0x0){return db[_0x5eac('0x4e')]['create']({'name':_0x291545['name'],'resourceId':_0x291545['id'],'type':_0x141e6d[_0x5eac('0x2e')],'sectionId':_0x141e6d['id']},{})[_0x5eac('0x2a')](function(){return _0x4ef183;});}else{return _0x4ef183;}})['catch'](function(_0x2bada8){logger['error'](_0x5eac('0x4f'),_0x2bada8);throw _0x2bada8;});}return _0x4ef183;})['then'](respondWithResult(_0xe166a,0xc9))[_0x5eac('0x44')](handleError(_0xe166a,null));};exports[_0x5eac('0x29')]=function(_0x578dfd,_0x44802c){if(_0x578dfd[_0x5eac('0x50')]['id']){delete _0x578dfd[_0x5eac('0x50')]['id'];}return db[_0x5eac('0x30')][_0x5eac('0x47')]({'where':{'id':_0x578dfd[_0x5eac('0x45')]['id']}})[_0x5eac('0x2a')](handleEntityNotFound(_0x44802c,null))[_0x5eac('0x2a')](saveUpdates(_0x578dfd[_0x5eac('0x50')],null))[_0x5eac('0x2a')](respondWithResult(_0x44802c,null))[_0x5eac('0x44')](handleError(_0x44802c,null));};exports[_0x5eac('0x51')]=function(_0x5bec98,_0x3f0bcd){var _0xd76eac=_0x5bec98[_0x5eac('0x45')]['id'];var _0x32f2df=[];return db[_0x5eac('0x52')]['transaction'](function(_0x28150a){var _0x2d09b0='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0xd76eac;return db['sequelize']['query'](_0x2d09b0,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x28150a})[_0x5eac('0x2a')](function(_0x20e61e){_0x32f2df=_[_0x5eac('0x32')](_0x20e61e,function(_0x352719){return Number(_0x352719[_0x5eac('0x53')]);});})[_0x5eac('0x2a')](function(){var _0x20e2a8=_0x5eac('0x54')+_0xd76eac;return db['sequelize'][_0x5eac('0x33')](_0x20e2a8,{'type':db[_0x5eac('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x28150a});})[_0x5eac('0x2a')](function(_0x120a56){var _0x411a1b=_[_0x5eac('0x32')](_0x120a56,function(_0x4759ab){return Number(_0x4759ab[_0x5eac('0x56')]);});return db[_0x5eac('0x57')]['destroy']({'where':{'UserId':{'$in':_0x32f2df},'VoiceQueueId':{'$in':_0x411a1b}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x4e216f='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd76eac;return db['sequelize']['query'](_0x4e216f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x28150a});})['then'](function(_0x1e4375){var _0x2c34ec=_[_0x5eac('0x32')](_0x1e4375,function(_0x246814){return Number(_0x246814['MailQueueId']);});return db['UserMailQueue'][_0x5eac('0x51')]({'where':{'UserId':{'$in':_0x32f2df},'MailQueueId':{'$in':_0x2c34ec}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x453f1e=_0x5eac('0x58')+_0xd76eac;return db[_0x5eac('0x52')][_0x5eac('0x33')](_0x453f1e,{'type':db[_0x5eac('0x55')][_0x5eac('0x59')][_0x5eac('0x5a')],'raw':!![],'transaction':_0x28150a});})['then'](function(_0x2ff103){var _0x404616=_[_0x5eac('0x32')](_0x2ff103,function(_0x17ce76){return Number(_0x17ce76[_0x5eac('0x5b')]);});return db[_0x5eac('0x5c')][_0x5eac('0x51')]({'where':{'UserId':{'$in':_0x32f2df},'SmsQueueId':{'$in':_0x404616}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x1e60c6=_0x5eac('0x5d')+_0xd76eac;return db[_0x5eac('0x52')][_0x5eac('0x33')](_0x1e60c6,{'type':db[_0x5eac('0x55')][_0x5eac('0x59')][_0x5eac('0x5a')],'raw':!![],'transaction':_0x28150a});})[_0x5eac('0x2a')](function(_0x29fa09){var _0x6a4dd=_[_0x5eac('0x32')](_0x29fa09,function(_0x2a630d){return Number(_0x2a630d[_0x5eac('0x5e')]);});return db[_0x5eac('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x32f2df},'ChatQueueId':{'$in':_0x6a4dd}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x2ed27b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd76eac;return db[_0x5eac('0x52')][_0x5eac('0x33')](_0x2ed27b,{'type':db['Sequelize']['QueryTypes'][_0x5eac('0x5a')],'raw':!![],'transaction':_0x28150a});})['then'](function(_0x5d01cd){var _0x301157=_[_0x5eac('0x32')](_0x5d01cd,function(_0x3ed3f0){return Number(_0x3ed3f0[_0x5eac('0x60')]);});return db[_0x5eac('0x61')][_0x5eac('0x51')]({'where':{'UserId':{'$in':_0x32f2df},'FaxQueueId':{'$in':_0x301157}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x145d8e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd76eac;return db[_0x5eac('0x52')][_0x5eac('0x33')](_0x145d8e,{'type':db[_0x5eac('0x55')][_0x5eac('0x59')][_0x5eac('0x5a')],'raw':!![],'transaction':_0x28150a});})['then'](function(_0xcdcf87){var _0xb537dc=_[_0x5eac('0x32')](_0xcdcf87,function(_0x2ae956){return Number(_0x2ae956[_0x5eac('0x62')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x32f2df},'OpenchannelQueueId':{'$in':_0xb537dc}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){var _0x2b6f91='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd76eac;return db[_0x5eac('0x52')][_0x5eac('0x33')](_0x2b6f91,{'type':db['Sequelize'][_0x5eac('0x59')][_0x5eac('0x5a')],'raw':!![],'transaction':_0x28150a});})[_0x5eac('0x2a')](function(_0x54d6aa){var _0x1922fa=_[_0x5eac('0x32')](_0x54d6aa,function(_0x2b7ec1){return Number(_0x2b7ec1[_0x5eac('0x63')]);});return db[_0x5eac('0x64')][_0x5eac('0x51')]({'where':{'UserId':{'$in':_0x32f2df},'WhatsappQueueId':{'$in':_0x1922fa}},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){return db[_0x5eac('0x65')]['find']({'where':{'TeamId':_0xd76eac}});})[_0x5eac('0x2a')](function(_0x3156ec){if(_0x3156ec===null){return;}return db[_0x5eac('0x66')][_0x5eac('0x51')]({'where':{'UserId':{'$in':_0x32f2df},'VoicePrefixId':_0x3156ec['VoicePrefixId']},'transaction':_0x28150a});})[_0x5eac('0x2a')](function(){return db['Team'][_0x5eac('0x51')]({'where':{'id':_0xd76eac},'cascade':!![],'transaction':_0x28150a});})['then'](function(_0x3b3174){if(_0x3b3174===0x0){_0x3f0bcd[_0x5eac('0x2b')](0x194);}else{return db['UserProfileResource'][_0x5eac('0x51')]({'where':{'type':_0x5eac('0x4d'),'resourceId':_0xd76eac},'cascade':!![],'transaction':_0x28150a})[_0x5eac('0x2a')](function(){_0x3f0bcd[_0x5eac('0x20')](0xcc)['end']();});}})[_0x5eac('0x44')](function(_0x52600c){_0x3f0bcd[_0x5eac('0x20')](0x1f4)[_0x5eac('0x2f')](_0x52600c);});});};exports[_0x5eac('0x67')]=function(_0x5220e3,_0x28dc61,_0x507e83){return db[_0x5eac('0x30')]['findOne']({'where':{'id':_0x5220e3[_0x5eac('0x45')]['id']}})[_0x5eac('0x2a')](handleEntityNotFound(_0x28dc61,null))[_0x5eac('0x2a')](function(_0x43afa1){if(!_0x5220e3[_0x5eac('0x33')][_0x5eac('0x68')]||!utils[_0x5eac('0x69')](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x68')])){throw new db['Sequelize'][(_0x5eac('0x6a'))]('Unknown\x20channel');}var _0x17e3fb={};var _0x20b0ad={};_0x20b0ad[_0x5eac('0x36')]=_[_0x5eac('0x46')](db[_['capitalize'](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x68')]['toLowerCase']())+'Queue']['rawAttributes']);_0x20b0ad[_0x5eac('0x33')]=_[_0x5eac('0x46')](_0x5220e3[_0x5eac('0x33')]);_0x20b0ad[_0x5eac('0x34')]=_['intersection'](_0x20b0ad['model'],_0x20b0ad[_0x5eac('0x33')]);_0x17e3fb[_0x5eac('0x37')]=_[_0x5eac('0x35')](_0x20b0ad[_0x5eac('0x36')],qs['fields'](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x38')]));_0x17e3fb['attributes']=_0x17e3fb['attributes'][_0x5eac('0x39')]?_0x17e3fb[_0x5eac('0x37')]:_0x20b0ad[_0x5eac('0x36')];_0x17e3fb['limit']=qs['limit'](_0x5220e3[_0x5eac('0x33')]['limit']);_0x17e3fb[_0x5eac('0x22')]=qs[_0x5eac('0x22')](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x22')]);_0x17e3fb[_0x5eac('0x3b')]=qs['sort'](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x3c')]);_0x17e3fb['where']=qs[_0x5eac('0x34')](_[_0x5eac('0x3e')](_0x5220e3[_0x5eac('0x33')],_0x20b0ad[_0x5eac('0x34')]));_0x17e3fb=_['merge']({},_0x17e3fb,_0x5220e3[_0x5eac('0x6b')]);return _0x43afa1[_0x5eac('0x4a')+_[_0x5eac('0x6c')](_0x5220e3[_0x5eac('0x33')][_0x5eac('0x68')][_0x5eac('0x6d')]())+_0x5eac('0x6e')](_0x17e3fb);})[_0x5eac('0x2a')](respondWithResult(_0x28dc61,null))[_0x5eac('0x44')](handleError(_0x28dc61,null));};exports['addQueues']=function(_0x515afd,_0x4a39ee,_0x59932b){return db['Team'][_0x5eac('0x6f')]({'where':{'id':_0x515afd[_0x5eac('0x45')]['id']}})[_0x5eac('0x2a')](function(_0x3fd19b){if(_0x3fd19b){if(!_0x515afd[_0x5eac('0x50')][_0x5eac('0x68')]||!utils[_0x5eac('0x69')](_0x515afd[_0x5eac('0x50')]['channel'])){throw new db[(_0x5eac('0x55'))][(_0x5eac('0x6a'))](_0x5eac('0x70'));}return _0x3fd19b[_0x5eac('0x71')+_[_0x5eac('0x6c')](_0x515afd[_0x5eac('0x50')]['channel'][_0x5eac('0x6d')]())+'Queues'](_0x515afd[_0x5eac('0x50')][_0x5eac('0x72')]);}return null;})[_0x5eac('0x2a')](handleEntityNotFound(_0x4a39ee,null))[_0x5eac('0x2a')](respondWithStatusCode(_0x4a39ee,null))[_0x5eac('0x44')](handleError(_0x4a39ee,null));};exports[_0x5eac('0x73')]=function(_0x3daf07,_0x5213c1,_0x545a26){return db[_0x5eac('0x30')][_0x5eac('0x6f')]({'where':{'id':_0x3daf07['params']['id']}})['then'](function(_0x345fab){if(_0x345fab){if(!_0x3daf07['query'][_0x5eac('0x68')]||!utils[_0x5eac('0x69')](_0x3daf07[_0x5eac('0x33')][_0x5eac('0x68')])){throw new db[(_0x5eac('0x55'))][(_0x5eac('0x6a'))](_0x5eac('0x70'));}return _0x345fab['remove'+_[_0x5eac('0x6c')](_0x3daf07['query'][_0x5eac('0x68')]['toLowerCase']())+_0x5eac('0x6e')](_0x3daf07[_0x5eac('0x33')][_0x5eac('0x72')]);}return null;})['then'](handleEntityNotFound(_0x5213c1,null))[_0x5eac('0x2a')](respondWithStatusCode(_0x5213c1,null))['catch'](handleError(_0x5213c1,null));};exports[_0x5eac('0x74')]=function(_0x5cd00e,_0x5edcb4){var _0x26fe19=_[_0x5eac('0x75')](_0x5cd00e[_0x5eac('0x50')][_0x5eac('0x72')])?_0x5cd00e['body'][_0x5eac('0x72')]:[_0x5cd00e[_0x5eac('0x50')][_0x5eac('0x72')]];var _0x4c284f=_0x5cd00e[_0x5eac('0x45')]['id'];return db['Team'][_0x5eac('0x47')]({'where':{'id':_0x4c284f}})[_0x5eac('0x2a')](handleEntityNotFound(_0x5edcb4,null))[_0x5eac('0x2a')](function(_0x241e02){if(_0x241e02){var _0x3512e7=[_0x5eac('0x76'),_0x5eac('0x77'),_0x5eac('0x78'),_0x5eac('0x79'),_0x5eac('0x7a'),'Openchannel',_0x5eac('0x7b')];return db[_0x5eac('0x52')][_0x5eac('0x7c')](function(_0x1e4e19){var _0x3e8b9e=_['map'](_0x3512e7,function(_0x18881f){var _0xa0d26a={'attributes':['id',_0x5eac('0x2e')]};if(_0x18881f==='Voice'){_0xa0d26a['through']={'attributes':[_0x5eac('0x7d')]};}return _0x241e02[_0x5eac('0x4a')+_0x18881f+_0x5eac('0x6e')](_0xa0d26a)['then'](function(_0x2e4ec4){var _0x47ae1e=_[_0x5eac('0x32')](_0x2e4ec4,function(_0x100eae){var _0x3d64d2=_[_0x5eac('0x32')](_0x26fe19,function(_0x3bc1b8){var _0x2ae83e={'where':{'UserId':_0x3bc1b8,[_0x18881f+_0x5eac('0x7e')]:_0x100eae['id']},'transaction':_0x1e4e19};if(_0x18881f===_0x5eac('0x76')){_0x2ae83e['defaults']={'penalty':_0x100eae[_0x5eac('0x7f')]['penalty']};}return db[_0x5eac('0x80')+_0x18881f+_0x5eac('0x81')][_0x5eac('0x82')](_0x2ae83e)[_0x5eac('0x2a')](function(){socket[_0x5eac('0x83')](_0x5eac('0x49')+_0x18881f+_0x5eac('0x84'),{'UserId':_0x3bc1b8,[_0x18881f+_0x5eac('0x7e')]:_0x100eae['id']});if(_0x18881f!==_0x5eac('0x76')){return;}return db[_0x5eac('0x80')][_0x5eac('0x85')]({'where':{'id':_0x26fe19,'online':0x1},'attributes':['id',_0x5eac('0x2e'),'online','voicePause','interface'],'raw':!![]})[_0x5eac('0x2a')](function(_0x2ba1e4){var _0x5abf03=_['map'](_0x2ba1e4,function(_0x321f0c){return db[_0x5eac('0x86')][_0x5eac('0x87')]({'membername':_0x321f0c[_0x5eac('0x2e')],'UserId':_0x321f0c['id'],'queue_name':_0x100eae[_0x5eac('0x2e')],'VoiceQueueId':_0x100eae['id'],'interface':_[_0x5eac('0x88')](_0x321f0c['interface'])?util['format'](_0x5eac('0x89'),_0x321f0c[_0x5eac('0x2e')]):_0x321f0c[_0x5eac('0x8a')],'paused':_0x321f0c['voicePause']||![],'penalty':_0x100eae[_0x5eac('0x7f')]['penalty']},{'transaction':_0x1e4e19});});return Promise[_0x5eac('0x8b')](_0x5abf03);});});});return Promise['all'](_0x3d64d2);});return Promise[_0x5eac('0x8b')](_0x47ae1e);})[_0x5eac('0x2a')](function(){return db['TeamVoicePrefix'][_0x5eac('0x6f')]({'where':{'teamId':_0x4c284f}})[_0x5eac('0x2a')](function(_0x41a16d){if(_0x41a16d){var _0x3834a7=_['map'](_0x26fe19,function(_0x1c576e){db['UserVoicePrefix'][_0x5eac('0x87')]({'UserId':_0x1c576e,'VoicePrefixId':_0x41a16d[_0x5eac('0x8c')]});});return Promise[_0x5eac('0x8b')](_0x3834a7);}});});});return Promise[_0x5eac('0x8b')](_0x3e8b9e)['then'](function(){return _0x241e02[_0x5eac('0x74')](_0x26fe19,{'transaction':_0x1e4e19})['spread'](function(_0x47a1cd){return _0x47a1cd;});});});}})[_0x5eac('0x2a')](respondWithResult(_0x5edcb4,null))[_0x5eac('0x44')](handleError(_0x5edcb4,null));};exports[_0x5eac('0x8d')]=function(_0x39826b,_0x291dd4){var _0x91189c=_[_0x5eac('0x75')](_0x39826b[_0x5eac('0x33')]['ids'])?_0x39826b['query'][_0x5eac('0x72')]:[_0x39826b[_0x5eac('0x33')]['ids']];var _0x55dab5=_0x39826b['params']['id'];return db[_0x5eac('0x30')][_0x5eac('0x47')]({'where':{'id':_0x55dab5}})[_0x5eac('0x2a')](handleEntityNotFound(_0x291dd4,null))[_0x5eac('0x2a')](function(_0x157f29){if(_0x157f29){var _0x44695d=[_0x5eac('0x76'),_0x5eac('0x77'),_0x5eac('0x78'),_0x5eac('0x79'),_0x5eac('0x7a'),'Openchannel',_0x5eac('0x7b')];return db['sequelize'][_0x5eac('0x7c')](function(_0x8fd69b){var _0x394913=_[_0x5eac('0x32')](_0x44695d,function(_0x3440fa){var _0x79c680={'attributes':['id','name']};return _0x157f29[_0x5eac('0x4a')+_0x3440fa+_0x5eac('0x6e')](_0x79c680)[_0x5eac('0x2a')](function(_0x2f0f97){var _0x5414b6=_[_0x5eac('0x32')](_0x2f0f97,function(_0x42e2b1){return _0x42e2b1[_0x5eac('0x8d')](_0x91189c,{'transaction':_0x8fd69b})[_0x5eac('0x2a')](function(){var _0x569a7f=_[_0x5eac('0x32')](_0x91189c,function(_0x17a247){socket[_0x5eac('0x83')](_0x5eac('0x49')+_0x3440fa+'Queue:remove',{'UserId':Number(_0x17a247),[_0x3440fa+_0x5eac('0x7e')]:_0x42e2b1['id']});if(_0x3440fa!=='Voice'){return;}return db[_0x5eac('0x86')][_0x5eac('0x51')]({'where':{'VoiceQueueId':_0x42e2b1['id'],'UserId':_0x17a247},'transaction':_0x8fd69b});});return Promise[_0x5eac('0x8b')](_0x569a7f);});});return Promise['all'](_0x5414b6);});});return Promise[_0x5eac('0x8b')](_0x394913)[_0x5eac('0x2a')](function(){return _0x157f29[_0x5eac('0x8d')](_0x91189c,{'transaction':_0x8fd69b});})[_0x5eac('0x2a')](function(){return db['TeamVoicePrefix'][_0x5eac('0x6f')]({'where':{'teamId':_0x55dab5}})[_0x5eac('0x2a')](function(_0x6a1bff){if(_0x6a1bff){var _0xa63b7e=_['map'](_0x91189c,function(_0x4dee45){db[_0x5eac('0x66')][_0x5eac('0x51')]({'where':{'UserId':_0x4dee45,'VoicePrefixId':_0x6a1bff[_0x5eac('0x8c')]}});});return Promise[_0x5eac('0x8b')](_0xa63b7e);}});});});}})['then'](respondWithStatusCode(_0x291dd4,null))[_0x5eac('0x44')](handleError(_0x291dd4,null));};exports['getAgents']=function(_0x713e9d,_0x2d563e,_0x58d578){var _0x255e9a={};var _0x3a7d30={};var _0x215aa1;var _0x3ecbda;return db[_0x5eac('0x30')][_0x5eac('0x6f')]({'where':{'id':_0x713e9d[_0x5eac('0x45')]['id']}})[_0x5eac('0x2a')](handleEntityNotFound(_0x2d563e,null))[_0x5eac('0x2a')](function(_0x157a58){if(_0x157a58){_0x215aa1=_0x157a58;_0x3a7d30[_0x5eac('0x36')]=_['keys'](db[_0x5eac('0x80')]['rawAttributes']);_0x3a7d30[_0x5eac('0x33')]=_[_0x5eac('0x46')](_0x713e9d[_0x5eac('0x33')]);_0x3a7d30['filters']=_['intersection'](_0x3a7d30[_0x5eac('0x36')],_0x3a7d30[_0x5eac('0x33')]);_0x255e9a[_0x5eac('0x37')]=_[_0x5eac('0x35')](_0x3a7d30['model'],qs[_0x5eac('0x38')](_0x713e9d['query']['fields']));_0x255e9a[_0x5eac('0x37')]=_0x255e9a['attributes'][_0x5eac('0x39')]?_0x255e9a[_0x5eac('0x37')]:_0x3a7d30[_0x5eac('0x36')];_0x255e9a[_0x5eac('0x3b')]=qs[_0x5eac('0x3c')](_0x713e9d['query'][_0x5eac('0x3c')]);_0x255e9a[_0x5eac('0x3d')]=qs[_0x5eac('0x34')](_[_0x5eac('0x3e')](_0x713e9d[_0x5eac('0x33')],_0x3a7d30[_0x5eac('0x34')]));if(_0x713e9d[_0x5eac('0x33')][_0x5eac('0x3f')]){_0x255e9a['where']=_[_0x5eac('0x40')](_0x255e9a[_0x5eac('0x3d')],{'$or':_[_0x5eac('0x32')](_0x255e9a[_0x5eac('0x37')],function(_0x170f08){var _0x580b01={};_0x580b01[_0x170f08]={'$like':'%'+_0x713e9d[_0x5eac('0x33')]['filter']+'%'};return _0x580b01;})});}_0x255e9a=_[_0x5eac('0x40')]({},_0x255e9a,_0x713e9d[_0x5eac('0x6b')]);return _0x215aa1[_0x5eac('0x8e')](_0x255e9a);}})[_0x5eac('0x2a')](function(_0x553d84){if(_0x553d84){_0x3ecbda=_0x553d84[_0x5eac('0x39')];if(!_0x713e9d[_0x5eac('0x33')][_0x5eac('0x8f')](_0x5eac('0x3a'))){_0x255e9a[_0x5eac('0x23')]=qs[_0x5eac('0x23')](_0x713e9d['query']['limit']);_0x255e9a[_0x5eac('0x22')]=qs['offset'](_0x713e9d[_0x5eac('0x33')][_0x5eac('0x22')]);}return _0x215aa1[_0x5eac('0x8e')](_0x255e9a);}})[_0x5eac('0x2a')](function(_0x34cf94){if(_0x34cf94){return _0x34cf94?{'count':_0x3ecbda,'rows':_0x34cf94}:null;}})['then'](respondWithResult(_0x2d563e,null))[_0x5eac('0x44')](handleError(_0x2d563e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 5e2b942..eeadd69 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 _0xe015=['../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x557af1,_0x964d4f){var _0x2c453e=function(_0x330ad1){while(--_0x330ad1){_0x557af1['push'](_0x557af1['shift']());}};_0x2c453e(++_0x964d4f);}(_0xe015,0x74));var _0x5e01=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe015[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x5e01('0x0'));var Team=require(_0x5e01('0x1'))['db'][_0x5e01('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5e01('0x3')](0x0);var events={'afterCreate':_0x5e01('0x4'),'afterUpdate':_0x5e01('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1e8b75){return function(_0x5ecfda,_0x3f4158,_0x574429){TeamEvents['emit'](_0x1e8b75+':'+_0x5ecfda['id'],_0x5ecfda);TeamEvents[_0x5e01('0x6')](_0x1e8b75,_0x5ecfda);_0x574429(null);};}for(var e in events){if(events[_0x5e01('0x7')](e)){var event=events[e];Team[_0x5e01('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xe5b5=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x40de6f,_0x3d5f9c){var _0x44a887=function(_0x2d6564){while(--_0x2d6564){_0x40de6f['push'](_0x40de6f['shift']());}};_0x44a887(++_0x3d5f9c);}(_0xe5b5,0x73));var _0x5e5b=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0xe5b5[_0x47604d];return _0x388e4c;};'use strict';var EventEmitter=require('events');var Team=require(_0x5e5b('0x0'))['db'][_0x5e5b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5e5b('0x2')](0x0);var events={'afterCreate':_0x5e5b('0x3'),'afterUpdate':_0x5e5b('0x4'),'afterDestroy':_0x5e5b('0x5')};function emitEvent(_0xc39c57){return function(_0x466655,_0x3d08f2,_0x40dded){TeamEvents[_0x5e5b('0x6')](_0xc39c57+':'+_0x466655['id'],_0x466655);TeamEvents['emit'](_0xc39c57,_0x466655);_0x40dded(null);};}for(var e in events){if(events[_0x5e5b('0x7')](e)){var event=events[e];Team[_0x5e5b('0x8')](e,emitEvent(event));}}module[_0x5e5b('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5d6ac2d..44f8b68 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 _0xbff3=['exports','define','Team','Chat','Openchannel','Sms','Voice','Whatsapp','all','./team.attributes','get','Queues','then','map','setDataValue','channel','catch'];(function(_0x39c267,_0x3e8663){var _0x6d8f04=function(_0x49ebb4){while(--_0x49ebb4){_0x39c267['push'](_0x39c267['shift']());}};_0x6d8f04(++_0x3e8663);}(_0xbff3,0xa2));var _0x3bff=function(_0x37f0e7,_0x3677c0){_0x37f0e7=_0x37f0e7-0x0;var _0xe28db=_0xbff3[_0x37f0e7];return _0xe28db;};'use strict';var _=require('lodash');var attributes=require(_0x3bff('0x0'));function getQueuesByChannel(_0x31e39e,_0x49b50e){var _0x16331d=_0x3bff('0x1')+_0x49b50e+_0x3bff('0x2');return _0x31e39e[_0x16331d]()[_0x3bff('0x3')](function(_0x50991e){return _[_0x3bff('0x4')](_0x50991e,function(_0x1612c6){_0x1612c6[_0x3bff('0x5')](_0x3bff('0x6'),_0x49b50e);return _0x1612c6;});})[_0x3bff('0x7')](function(_0x56b986){throw _0x56b986;});}module[_0x3bff('0x8')]=function(_0x4c0db9){return _0x4c0db9[_0x3bff('0x9')](_0x3bff('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x21057f=this;var _0xdfedd8=[_0x3bff('0xb'),'Fax','Mail',_0x3bff('0xc'),_0x3bff('0xd'),_0x3bff('0xe'),_0x3bff('0xf')];return Promise['resolve']()['then'](function(){var _0x588474=_['map'](_0xdfedd8,function(_0x153391){return getQueuesByChannel(_0x21057f,_0x153391);});return Promise[_0x3bff('0x10')](_0x588474);})[_0x3bff('0x7')](function(_0x3b5822){throw _0x3b5822;});}}});}; \ No newline at end of file +var _0x87ec=['Team','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','get','Queues','then','map','channel','catch','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x87ec,0xb5));var _0xc87e=function(_0x5cd163,_0x7f4a03){_0x5cd163=_0x5cd163-0x0;var _0x1aa966=_0x87ec[_0x5cd163];return _0x1aa966;};'use strict';var _=require(_0xc87e('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x313cae,_0x360320){var _0x207323=_0xc87e('0x1')+_0x360320+_0xc87e('0x2');return _0x313cae[_0x207323]()[_0xc87e('0x3')](function(_0x451d4f){return _[_0xc87e('0x4')](_0x451d4f,function(_0x5653eb){_0x5653eb['setDataValue'](_0xc87e('0x5'),_0x360320);return _0x5653eb;});})[_0xc87e('0x6')](function(_0x29fdf8){throw _0x29fdf8;});}module[_0xc87e('0x7')]=function(_0x2cc628){return _0x2cc628[_0xc87e('0x8')](_0xc87e('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xfa6071=this;var _0x49a843=[_0xc87e('0xa'),_0xc87e('0xb'),_0xc87e('0xc'),_0xc87e('0xd'),_0xc87e('0xe'),_0xc87e('0xf'),_0xc87e('0x10')];return Promise[_0xc87e('0x11')]()[_0xc87e('0x3')](function(){var _0x3e07c3=_[_0xc87e('0x4')](_0x49a843,function(_0x3aadca){return getQueuesByChannel(_0xfa6071,_0x3aadca);});return Promise[_0xc87e('0x12')](_0x3e07c3);})[_0xc87e('0x6')](function(_0x50abb1){throw _0x50abb1;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1aa869c..15bc0d4 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 _0xad3d=['client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad3d,0xb7));var _0xdad3=function(_0x44517a,_0x155215){_0x44517a=_0x44517a-0x0;var _0x5d021a=_0xad3d[_0x44517a];return _0x5d021a;};'use strict';var _=require(_0xdad3('0x0'));var util=require(_0xdad3('0x1'));var moment=require(_0xdad3('0x2'));var BPromise=require(_0xdad3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdad3('0x4'))['db'];var utils=require(_0xdad3('0x5'));var logger=require('../../config/logger')(_0xdad3('0x6'));var config=require(_0xdad3('0x7'));var jayson=require(_0xdad3('0x8'));var client=jayson[_0xdad3('0x9')][_0xdad3('0xa')]({'port':0x232a});config[_0xdad3('0xb')]=_[_0xdad3('0xc')](config[_0xdad3('0xb')],{'host':_0xdad3('0xd'),'port':0x18eb});var socket=require(_0xdad3('0xe'))(new Redis(config[_0xdad3('0xb')]));require(_0xdad3('0xf'))['register'](socket);function respondWithRpcPromise(_0x90e155,_0x465719,_0x10df3d){return new BPromise(function(_0x2c63a8,_0x5dd85d){return client['request'](_0x90e155,_0x10df3d)['then'](function(_0x266dec){logger[_0xdad3('0x10')](_0xdad3('0x11'),_0x465719,_0xdad3('0x12'));logger[_0xdad3('0x13')](_0xdad3('0x14'),_0x465719,'request\x20sent',JSON['stringify'](_0x266dec));if(_0x266dec[_0xdad3('0x15')]){if(_0x266dec[_0xdad3('0x15')][_0xdad3('0x16')]===0x1f4){logger['error'](_0xdad3('0x11'),_0x465719,_0x266dec[_0xdad3('0x15')][_0xdad3('0x17')]);return _0x5dd85d(_0x266dec['error'][_0xdad3('0x17')]);}logger['error'](_0xdad3('0x11'),_0x465719,_0x266dec[_0xdad3('0x15')][_0xdad3('0x17')]);return _0x2c63a8(_0x266dec[_0xdad3('0x15')][_0xdad3('0x17')]);}else{logger[_0xdad3('0x10')]('Team,\x20%s,\x20%s',_0x465719,_0xdad3('0x12'));_0x2c63a8(_0x266dec['result'][_0xdad3('0x17')]);}})['catch'](function(_0x224920){logger[_0xdad3('0x15')]('Team,\x20%s,\x20%s',_0x465719,_0x224920);_0x5dd85d(_0x224920);});});} \ No newline at end of file +var _0x2a9c=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x5c5533,_0x21aed8){var _0x41156e=function(_0x4d7670){while(--_0x4d7670){_0x5c5533['push'](_0x5c5533['shift']());}};_0x41156e(++_0x21aed8);}(_0x2a9c,0xb6));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2a9('0x0'));var util=require(_0xc2a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2a9('0x3'))['db'];var utils=require(_0xc2a9('0x4'));var logger=require(_0xc2a9('0x5'))(_0xc2a9('0x6'));var config=require(_0xc2a9('0x7'));var jayson=require(_0xc2a9('0x8'));var client=jayson[_0xc2a9('0x9')][_0xc2a9('0xa')]({'port':0x232a});config['redis']=_[_0xc2a9('0xb')](config[_0xc2a9('0xc')],{'host':_0xc2a9('0xd'),'port':0x18eb});var socket=require(_0xc2a9('0xe'))(new Redis(config[_0xc2a9('0xc')]));require(_0xc2a9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2015d9,_0x1a4fe1,_0x46e581){return new BPromise(function(_0x2e3edd,_0x28025b){return client[_0xc2a9('0x10')](_0x2015d9,_0x46e581)[_0xc2a9('0x11')](function(_0x2fd861){logger[_0xc2a9('0x12')](_0xc2a9('0x13'),_0x1a4fe1,_0xc2a9('0x14'));logger['debug'](_0xc2a9('0x15'),_0x1a4fe1,'request\x20sent',JSON['stringify'](_0x2fd861));if(_0x2fd861['error']){if(_0x2fd861['error']['code']===0x1f4){logger[_0xc2a9('0x16')](_0xc2a9('0x13'),_0x1a4fe1,_0x2fd861[_0xc2a9('0x16')][_0xc2a9('0x17')]);return _0x28025b(_0x2fd861[_0xc2a9('0x16')][_0xc2a9('0x17')]);}logger[_0xc2a9('0x16')]('Team,\x20%s,\x20%s',_0x1a4fe1,_0x2fd861[_0xc2a9('0x16')][_0xc2a9('0x17')]);return _0x2e3edd(_0x2fd861['error'][_0xc2a9('0x17')]);}else{logger[_0xc2a9('0x12')](_0xc2a9('0x13'),_0x1a4fe1,'request\x20sent');_0x2e3edd(_0x2fd861[_0xc2a9('0x18')][_0xc2a9('0x17')]);}})[_0xc2a9('0x19')](function(_0x358e04){logger[_0xc2a9('0x16')](_0xc2a9('0x13'),_0x1a4fe1,_0x358e04);_0x28025b(_0x358e04);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 284c63d..5462dd3 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 _0x4b5f=['register','length','./team.events','save','remove','update','emit'];(function(_0x158f3b,_0x4cb1f5){var _0x1cd8c1=function(_0x26b197){while(--_0x26b197){_0x158f3b['push'](_0x158f3b['shift']());}};_0x1cd8c1(++_0x4cb1f5);}(_0x4b5f,0x198));var _0xf4b5=function(_0x1d47c3,_0x856818){_0x1d47c3=_0x1d47c3-0x0;var _0x220130=_0x4b5f[_0x1d47c3];return _0x220130;};'use strict';var TeamEvents=require(_0xf4b5('0x0'));var events=[_0xf4b5('0x1'),_0xf4b5('0x2'),_0xf4b5('0x3')];function createListener(_0x4d8a5c,_0x3ac6a6){return function(_0x3a1524){_0x3ac6a6[_0xf4b5('0x4')](_0x4d8a5c,_0x3a1524);};}function removeListener(_0x44aaa2,_0x18e2b1){return function(){TeamEvents['removeListener'](_0x44aaa2,_0x18e2b1);};}exports[_0xf4b5('0x5')]=function(_0x397082){for(var _0x5d30ff=0x0,_0x38b86a=events[_0xf4b5('0x6')];_0x5d30ff<_0x38b86a;_0x5d30ff++){var _0x20981f=events[_0x5d30ff];var _0x1ce752=createListener('team:'+_0x20981f,_0x397082);TeamEvents['on'](_0x20981f,_0x1ce752);}}; \ No newline at end of file +var _0x77f4=['update','emit','register','team:','./team.events','save','remove'];(function(_0x2106fa,_0x1542b6){var _0x769012=function(_0x475494){while(--_0x475494){_0x2106fa['push'](_0x2106fa['shift']());}};_0x769012(++_0x1542b6);}(_0x77f4,0x1a1));var _0x477f=function(_0x214a8f,_0x4d8711){_0x214a8f=_0x214a8f-0x0;var _0x30d1fd=_0x77f4[_0x214a8f];return _0x30d1fd;};'use strict';var TeamEvents=require(_0x477f('0x0'));var events=[_0x477f('0x1'),_0x477f('0x2'),_0x477f('0x3')];function createListener(_0x3d074d,_0x3facd1){return function(_0x166ce9){_0x3facd1[_0x477f('0x4')](_0x3d074d,_0x166ce9);};}function removeListener(_0x4db7b3,_0xcef6ee){return function(){TeamEvents['removeListener'](_0x4db7b3,_0xcef6ee);};}exports[_0x477f('0x5')]=function(_0x5da219){for(var _0x4ebb39=0x0,_0x16eb7d=events['length'];_0x4ebb39<_0x16eb7d;_0x4ebb39++){var _0x16fa8d=events[_0x4ebb39];var _0x462569=createListener(_0x477f('0x6')+_0x16fa8d,_0x5da219);TeamEvents['on'](_0x16fa8d,_0x462569);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 55217f0..cba79d3 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 _0x31ff=['INTEGER','sequelize','exports'];(function(_0x16c6d6,_0x237525){var _0x1cf47c=function(_0x7444a6){while(--_0x7444a6){_0x16c6d6['push'](_0x16c6d6['shift']());}};_0x1cf47c(++_0x237525);}(_0x31ff,0xd3));var _0xf31f=function(_0x241fc2,_0xe233db){_0x241fc2=_0x241fc2-0x0;var _0x3b15d9=_0x31ff[_0x241fc2];return _0x3b15d9;};'use strict';var Sequelize=require(_0xf31f('0x0'));module[_0xf31f('0x1')]={'TeamId':{'type':Sequelize[_0xf31f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf31f('0x2')]}}; \ No newline at end of file +var _0xd110=['exports','INTEGER','sequelize'];(function(_0x497284,_0x680c45){var _0x5b34ee=function(_0x41d68b){while(--_0x41d68b){_0x497284['push'](_0x497284['shift']());}};_0x5b34ee(++_0x680c45);}(_0xd110,0x1e8));var _0x0d11=function(_0x54b795,_0x1b3a95){_0x54b795=_0x54b795-0x0;var _0x2bdfb0=_0xd110[_0x54b795];return _0x2bdfb0;};'use strict';var Sequelize=require(_0x0d11('0x0'));module[_0x0d11('0x1')]={'TeamId':{'type':Sequelize[_0x0d11('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 1de01af..263f6b6 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 _0x1678=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x2aa5dd,_0x59f6d4){var _0x32878c=function(_0x3a6937){while(--_0x3a6937){_0x2aa5dd['push'](_0x2aa5dd['shift']());}};_0x32878c(++_0x59f6d4);}(_0x1678,0x17b));var _0x8167=function(_0x342bf5,_0x4aaf82){_0x342bf5=_0x342bf5-0x0;var _0x5eac57=_0x1678[_0x342bf5];return _0x5eac57;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))(_0x8167('0x3'));var moment=require(_0x8167('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x5'));var rimraf=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var attributes=require(_0x8167('0x8'));module[_0x8167('0x9')]=function(_0xa9fd75,_0x30f248){return _0xa9fd75['define'](_0x8167('0xa'),attributes,{'tableName':_0x8167('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0825=['../../config/environment','./teamVoicePrefix.attributes','exports','team_has_voice_prefixes','lodash','util','moment','bluebird','path','rimraf'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x0825,0x1e4));var _0x5082=function(_0x21fb2f,_0x405fe2){_0x21fb2f=_0x21fb2f-0x0;var _0x5746e7=_0x0825[_0x21fb2f];return _0x5746e7;};'use strict';var _=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5082('0x2'));var BPromise=require(_0x5082('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5082('0x4'));var rimraf=require(_0x5082('0x5'));var config=require(_0x5082('0x6'));var attributes=require(_0x5082('0x7'));module[_0x5082('0x8')]=function(_0x297cda,_0x5a119b){return _0x297cda['define']('TeamVoicePrefix',attributes,{'tableName':_0x5082('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 47345dc..6b1717c 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x553a72,_0x120470){var _0x410e05=function(_0x40fed8){while(--_0x40fed8){_0x553a72['push'](_0x553a72['shift']());}};_0x410e05(++_0x120470);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5e45ab,_0x126848){var _0x343f25=function(_0x5a8407){while(--_0x5a8407){_0x5e45ab['push'](_0x5e45ab['shift']());}};_0x343f25(++_0x126848);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 55be578..c4734c3 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 _0x4573=['sequelize'];(function(_0x24f271,_0x1073e8){var _0x4ab4b1=function(_0x3ab443){while(--_0x3ab443){_0x24f271['push'](_0x24f271['shift']());}};_0x4ab4b1(++_0x1073e8);}(_0x4573,0x12a));var _0x3457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4573[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3457('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd2c2=['INTEGER','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd2c2,0xf1));var _0x2d2c=function(_0x5b6554,_0x14a62d){_0x5b6554=_0x5b6554-0x0;var _0x2204de=_0xd2c2[_0x5b6554];return _0x2204de;};'use strict';var Sequelize=require(_0x2d2c('0x0'));module[_0x2d2c('0x1')]={'penalty':{'type':Sequelize[_0x2d2c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a9137ec..d8c8055 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 _0x28aa=['team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x3f2aa1,_0x2abbb3){var _0x59c274=function(_0x2a7f90){while(--_0x2a7f90){_0x3f2aa1['push'](_0x3f2aa1['shift']());}};_0x59c274(++_0x2abbb3);}(_0x28aa,0xf8));var _0xa28a=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x28aa[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xa28a('0x0'));var logger=require(_0xa28a('0x1'))(_0xa28a('0x2'));var moment=require(_0xa28a('0x3'));var BPromise=require(_0xa28a('0x4'));var rp=require(_0xa28a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa28a('0x6'));var config=require(_0xa28a('0x7'));var attributes=require(_0xa28a('0x8'));module[_0xa28a('0x9')]=function(_0x526dec,_0x1fbde2){return _0x526dec[_0xa28a('0xa')](_0xa28a('0xb'),attributes,{'tableName':_0xa28a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['./teamVoiceQueue.attributes','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53b5b9,_0x82cb8f){var _0x11c240=function(_0x4f7859){while(--_0x4f7859){_0x53b5b9['push'](_0x53b5b9['shift']());}};_0x11c240(++_0x82cb8f);}(_0xf2cf,0xf5));var _0xff2c=function(_0x5e3b3f,_0x5c2af1){_0x5e3b3f=_0x5e3b3f-0x0;var _0x52e8bf=_0xf2cf[_0x5e3b3f];return _0x52e8bf;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index d3ce6c0..c9bf020 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 _0xab0a=['jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1a2520,_0x59e097){var _0x264e37=function(_0x4f5a49){while(--_0x4f5a49){_0x1a2520['push'](_0x1a2520['shift']());}};_0x264e37(++_0x59e097);}(_0xab0a,0x1f0));var _0xaab0=function(_0x3febed,_0x39d679){_0x3febed=_0x3febed-0x0;var _0x3c8607=_0xab0a[_0x3febed];return _0x3c8607;};'use strict';var _=require(_0xaab0('0x0'));var util=require(_0xaab0('0x1'));var moment=require(_0xaab0('0x2'));var BPromise=require(_0xaab0('0x3'));var rs=require(_0xaab0('0x4'));var fs=require('fs');var Redis=require(_0xaab0('0x5'));var db=require(_0xaab0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaab0('0x7'))(_0xaab0('0x8'));var config=require(_0xaab0('0x9'));var jayson=require(_0xaab0('0xa'));var client=jayson[_0xaab0('0xb')][_0xaab0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14a9ca,_0xe0956e,_0x369b57){return new BPromise(function(_0x20936b,_0x141237){return client[_0xaab0('0xd')](_0x14a9ca,_0x369b57)[_0xaab0('0xe')](function(_0x5ac9f1){logger[_0xaab0('0xf')](_0xaab0('0x10'),_0xe0956e,_0xaab0('0x11'));logger[_0xaab0('0x12')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0xe0956e,_0xaab0('0x11'),JSON['stringify'](_0x5ac9f1));if(_0x5ac9f1[_0xaab0('0x13')]){if(_0x5ac9f1['error']['code']===0x1f4){logger[_0xaab0('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xe0956e,_0x5ac9f1[_0xaab0('0x13')][_0xaab0('0x14')]);return _0x141237(_0x5ac9f1[_0xaab0('0x13')]['message']);}logger['error'](_0xaab0('0x10'),_0xe0956e,_0x5ac9f1[_0xaab0('0x13')][_0xaab0('0x14')]);return _0x20936b(_0x5ac9f1[_0xaab0('0x13')]['message']);}else{logger[_0xaab0('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0xe0956e,_0xaab0('0x11'));_0x20936b(_0x5ac9f1[_0xaab0('0x15')]['message']);}})[_0xaab0('0x16')](function(_0x550c06){logger['error'](_0xaab0('0x10'),_0xe0956e,_0x550c06);_0x141237(_0x550c06);});});} \ No newline at end of file +var _0x151a=['code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4deef7,_0x122003){var _0x1c6f02=function(_0xf13006){while(--_0xf13006){_0x4deef7['push'](_0x4deef7['shift']());}};_0x1c6f02(++_0x122003);}(_0x151a,0x12f));var _0xa151=function(_0x1d90cd,_0x1d2745){_0x1d90cd=_0x1d90cd-0x0;var _0x81bbac=_0x151a[_0x1d90cd];return _0x81bbac;};'use strict';var _=require(_0xa151('0x0'));var util=require(_0xa151('0x1'));var moment=require(_0xa151('0x2'));var BPromise=require(_0xa151('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa151('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa151('0x5'));var logger=require('../../config/logger')(_0xa151('0x6'));var config=require(_0xa151('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa151('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47040f,_0x331be1,_0x2e5ae3){return new BPromise(function(_0x1eed07,_0x242531){return client['request'](_0x47040f,_0x2e5ae3)[_0xa151('0x9')](function(_0x2f8c69){logger[_0xa151('0xa')](_0xa151('0xb'),_0x331be1,_0xa151('0xc'));logger[_0xa151('0xd')](_0xa151('0xe'),_0x331be1,_0xa151('0xc'),JSON[_0xa151('0xf')](_0x2f8c69));if(_0x2f8c69[_0xa151('0x10')]){if(_0x2f8c69['error'][_0xa151('0x11')]===0x1f4){logger[_0xa151('0x10')](_0xa151('0xb'),_0x331be1,_0x2f8c69['error'][_0xa151('0x12')]);return _0x242531(_0x2f8c69['error'][_0xa151('0x12')]);}logger[_0xa151('0x10')](_0xa151('0xb'),_0x331be1,_0x2f8c69[_0xa151('0x10')][_0xa151('0x12')]);return _0x1eed07(_0x2f8c69[_0xa151('0x10')][_0xa151('0x12')]);}else{logger['info'](_0xa151('0xb'),_0x331be1,'request\x20sent');_0x1eed07(_0x2f8c69[_0xa151('0x13')][_0xa151('0x12')]);}})['catch'](function(_0xf297e0){logger[_0xa151('0x10')](_0xa151('0xb'),_0x331be1,_0xf297e0);_0x242531(_0xf297e0);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d62d135..6a1dc7e 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 _0x5942=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','post','put','update','delete'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0x5942,0x16a));var _0x2594=function(_0x5f0be5,_0x5e9ee8){_0x5f0be5=_0x5f0be5-0x0;var _0x24f10a=_0x5942[_0x5f0be5];return _0x24f10a;};'use strict';var multer=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var path=require(_0x2594('0x2'));var timeout=require(_0x2594('0x3'));var express=require(_0x2594('0x4'));var router=express[_0x2594('0x5')]();var fs_extra=require(_0x2594('0x6'));var auth=require(_0x2594('0x7'));var interaction=require(_0x2594('0x8'));var config=require(_0x2594('0x9'));var controller=require(_0x2594('0xa'));router[_0x2594('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2594('0xb')](_0x2594('0xc'),auth[_0x2594('0xd')](),controller['show']);router[_0x2594('0xe')]('/',auth[_0x2594('0xd')](),controller['create']);router[_0x2594('0xf')]('/:id',auth[_0x2594('0xd')](),controller[_0x2594('0x10')]);router[_0x2594('0x11')]('/:id',auth[_0x2594('0xd')](),controller[_0x2594('0x12')]);module[_0x2594('0x13')]=router; \ No newline at end of file +var _0x761c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x761c,0x18a));var _0xc761=function(_0x1ade08,_0x357612){_0x1ade08=_0x1ade08-0x0;var _0x517cea=_0x761c[_0x1ade08];return _0x517cea;};'use strict';var multer=require(_0xc761('0x0'));var util=require('util');var path=require(_0xc761('0x1'));var timeout=require(_0xc761('0x2'));var express=require('express');var router=express[_0xc761('0x3')]();var fs_extra=require(_0xc761('0x4'));var auth=require(_0xc761('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc761('0x6'));var controller=require('./template.controller');router[_0xc761('0x7')]('/',auth[_0xc761('0x8')](),controller[_0xc761('0x9')]);router[_0xc761('0x7')](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0xb')]);router['post']('/',auth[_0xc761('0x8')](),controller[_0xc761('0xc')]);router[_0xc761('0xd')](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0xe')]);router[_0xc761('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc761('0x10')]);module[_0xc761('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b54d117..fd847b7 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 _0xe2dd=['TEXT','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2dd,0x121));var _0xde2d=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xe2dd[_0x1dd532];return _0x3732aa;};'use strict';var Sequelize=require(_0xde2d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde2d('0x1')]},'html':{'type':Sequelize[_0xde2d('0x2')]}}; \ No newline at end of file +var _0x2780=['TEXT','exports','STRING'];(function(_0x49cd1a,_0x3665ab){var _0x332d87=function(_0x1b8a41){while(--_0x1b8a41){_0x49cd1a['push'](_0x49cd1a['shift']());}};_0x332d87(++_0x3665ab);}(_0x2780,0x13c));var _0x0278=function(_0x4df9cb,_0x4a83e9){_0x4df9cb=_0x4df9cb-0x0;var _0x2e88e6=_0x2780[_0x4df9cb];return _0x2e88e6;};'use strict';var Sequelize=require('sequelize');module[_0x0278('0x0')]={'name':{'type':Sequelize[_0x0278('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x0278('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 731f4df..47092bd 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 _0x1b40=['reject','save','then','get','Templates','destroy','error','name','send','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','Template','includeAll','include','findAll','catch','options','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','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','limit','undefined','offset','count','Content-Range'];(function(_0xd1afbb,_0x50dac0){var _0x22502a=function(_0x416ad6){while(--_0x416ad6){_0xd1afbb['push'](_0xd1afbb['shift']());}};_0x22502a(++_0x50dac0);}(_0x1b40,0xbf));var _0x01b4=function(_0x44a573,_0x1e6efc){_0x44a573=_0x44a573-0x0;var _0x4babc6=_0x1b40[_0x44a573];return _0x4babc6;};'use strict';var emlformat=require(_0x01b4('0x0'));var rimraf=require(_0x01b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01b4('0x2'));var rp=require(_0x01b4('0x3'));var moment=require(_0x01b4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01b4('0x5'));var util=require(_0x01b4('0x6'));var path=require('path');var sox=require(_0x01b4('0x7'));var csv=require(_0x01b4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01b4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x01b4('0xa'));var jsforce=require(_0x01b4('0xb'));var deskjs=require(_0x01b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x01b4('0xd'));var Papa=require(_0x01b4('0xe'));var Redis=require(_0x01b4('0xf'));var authService=require(_0x01b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x01b4('0x11'));var hardwareService=require(_0x01b4('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x01b4('0x13'));var config=require(_0x01b4('0x14'));var licenseUtil=require(_0x01b4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c5e93,_0x13b5b8){_0x13b5b8=_0x13b5b8||0xcc;return function(_0x2dafaf){if(_0x2dafaf){return _0x1c5e93[_0x01b4('0x16')](_0x13b5b8);}return _0x1c5e93[_0x01b4('0x17')](_0x13b5b8)[_0x01b4('0x18')]();};}function respondWithResult(_0x21ebb8,_0x38f129){_0x38f129=_0x38f129||0xc8;return function(_0x29aa54){if(_0x29aa54){return _0x21ebb8[_0x01b4('0x17')](_0x38f129)[_0x01b4('0x19')](_0x29aa54);}};}function respondWithFilteredResult(_0x2d7d06,_0x23f359){return function(_0x1a88fa){if(_0x1a88fa){var _0x48a815=typeof _0x23f359['offset']==='undefined'&&typeof _0x23f359[_0x01b4('0x1a')]===_0x01b4('0x1b');var _0x1dd70e=_0x1a88fa['count'];var _0x2a16f8=_0x48a815?0x0:_0x23f359[_0x01b4('0x1c')];var _0x31966b=_0x48a815?_0x1a88fa[_0x01b4('0x1d')]:_0x23f359[_0x01b4('0x1c')]+_0x23f359[_0x01b4('0x1a')];var _0x1d4cd3;if(_0x31966b>=_0x1dd70e){_0x31966b=_0x1dd70e;_0x1d4cd3=0xc8;}else{_0x1d4cd3=0xce;}_0x2d7d06[_0x01b4('0x17')](_0x1d4cd3);return _0x2d7d06['set'](_0x01b4('0x1e'),_0x2a16f8+'-'+_0x31966b+'/'+_0x1dd70e)[_0x01b4('0x19')](_0x1a88fa);}return null;};}function patchUpdates(_0x3b1ff0){return function(_0x4c26d0){try{jsonpatch['apply'](_0x4c26d0,_0x3b1ff0,!![]);}catch(_0x6ac0f5){return BPromise[_0x01b4('0x1f')](_0x6ac0f5);}return _0x4c26d0[_0x01b4('0x20')]();};}function saveUpdates(_0x2bb674,_0x16c41d){return function(_0x182645){if(_0x182645){return _0x182645['update'](_0x2bb674)[_0x01b4('0x21')](function(_0x10008d){return _0x10008d;});}return null;};}function removeEntity(_0x232e39,_0x4cf813){return function(_0xf76291){if(_0xf76291){return _0xf76291['destroy']()['then'](function(){var _0x3832b8=_0xf76291[_0x01b4('0x22')]({'plain':!![]});var _0x20f069=_0x01b4('0x23');return db['UserProfileResource'][_0x01b4('0x24')]({'where':{'type':_0x20f069,'resourceId':_0x3832b8['id']}})['then'](function(){return _0xf76291;});})['then'](function(){_0x232e39['status'](0xcc)[_0x01b4('0x18')]();});}};}function handleEntityNotFound(_0x5cfccb,_0x590c01){return function(_0x5e5bf9){if(!_0x5e5bf9){_0x5cfccb['sendStatus'](0x194);}return _0x5e5bf9;};}function handleError(_0x96cba2,_0x5505e0){_0x5505e0=_0x5505e0||0x1f4;return function(_0x16afcf){logger[_0x01b4('0x25')](_0x16afcf['stack']);if(_0x16afcf[_0x01b4('0x26')]){delete _0x16afcf[_0x01b4('0x26')];}_0x96cba2[_0x01b4('0x17')](_0x5505e0)[_0x01b4('0x27')](_0x16afcf);};}exports['index']=function(_0x2b85e4,_0x3201d9){var _0x435ac3={},_0x154488={},_0x712bc3={'count':0x0,'rows':[]};var _0x1be8d1=_[_0x01b4('0x28')](db['Template']['rawAttributes'],function(_0xe8cf7c){return{'name':_0xe8cf7c[_0x01b4('0x29')],'type':_0xe8cf7c[_0x01b4('0x2a')][_0x01b4('0x2b')]};});_0x154488[_0x01b4('0x2c')]=_[_0x01b4('0x28')](_0x1be8d1,'name');_0x154488['query']=_[_0x01b4('0x2d')](_0x2b85e4[_0x01b4('0x2e')]);_0x154488['filters']=_[_0x01b4('0x2f')](_0x154488[_0x01b4('0x2c')],_0x154488[_0x01b4('0x2e')]);_0x435ac3[_0x01b4('0x30')]=_[_0x01b4('0x2f')](_0x154488[_0x01b4('0x2c')],qs[_0x01b4('0x31')](_0x2b85e4[_0x01b4('0x2e')]['fields']));_0x435ac3['attributes']=_0x435ac3['attributes']['length']?_0x435ac3[_0x01b4('0x30')]:_0x154488['model'];if(!_0x2b85e4[_0x01b4('0x2e')][_0x01b4('0x32')](_0x01b4('0x33'))){_0x435ac3[_0x01b4('0x1a')]=qs['limit'](_0x2b85e4[_0x01b4('0x2e')]['limit']);_0x435ac3['offset']=qs[_0x01b4('0x1c')](_0x2b85e4[_0x01b4('0x2e')][_0x01b4('0x1c')]);}_0x435ac3[_0x01b4('0x34')]=qs[_0x01b4('0x35')](_0x2b85e4[_0x01b4('0x2e')][_0x01b4('0x35')]);_0x435ac3[_0x01b4('0x36')]=qs[_0x01b4('0x37')](_[_0x01b4('0x38')](_0x2b85e4[_0x01b4('0x2e')],_0x154488[_0x01b4('0x37')]),_0x1be8d1);if(_0x2b85e4[_0x01b4('0x2e')][_0x01b4('0x39')]){_0x435ac3[_0x01b4('0x36')]=_[_0x01b4('0x3a')](_0x435ac3[_0x01b4('0x36')],{'$or':_[_0x01b4('0x28')](_0x1be8d1,function(_0x19f064){if(_0x19f064['type']!=='VIRTUAL'){var _0x345ec0={};_0x345ec0[_0x19f064['name']]={'$like':'%'+_0x2b85e4[_0x01b4('0x2e')]['filter']+'%'};return _0x345ec0;}})});}_0x435ac3=_[_0x01b4('0x3a')]({},_0x435ac3,_0x2b85e4['options']);var _0x489681={'where':_0x435ac3['where']};return db[_0x01b4('0x3b')][_0x01b4('0x1d')](_0x489681)[_0x01b4('0x21')](function(_0x287752){_0x712bc3[_0x01b4('0x1d')]=_0x287752;if(_0x2b85e4[_0x01b4('0x2e')][_0x01b4('0x3c')]){_0x435ac3[_0x01b4('0x3d')]=[{'all':!![]}];}return db[_0x01b4('0x3b')][_0x01b4('0x3e')](_0x435ac3);})[_0x01b4('0x21')](function(_0x1a75bd){_0x712bc3['rows']=_0x1a75bd;return _0x712bc3;})[_0x01b4('0x21')](respondWithFilteredResult(_0x3201d9,_0x435ac3))[_0x01b4('0x3f')](handleError(_0x3201d9,null));};exports['show']=function(_0x16932b,_0x560ded){var _0x3ffe11={'raw':!![],'where':{'id':_0x16932b['params']['id']}},_0x10d5fa={};_0x10d5fa['model']=_[_0x01b4('0x2d')](db['Template']['rawAttributes']);_0x10d5fa[_0x01b4('0x2e')]=_[_0x01b4('0x2d')](_0x16932b[_0x01b4('0x2e')]);_0x10d5fa[_0x01b4('0x37')]=_[_0x01b4('0x2f')](_0x10d5fa[_0x01b4('0x2c')],_0x10d5fa[_0x01b4('0x2e')]);_0x3ffe11[_0x01b4('0x30')]=_[_0x01b4('0x2f')](_0x10d5fa[_0x01b4('0x2c')],qs['fields'](_0x16932b[_0x01b4('0x2e')][_0x01b4('0x31')]));_0x3ffe11[_0x01b4('0x30')]=_0x3ffe11[_0x01b4('0x30')]['length']?_0x3ffe11['attributes']:_0x10d5fa[_0x01b4('0x2c')];if(_0x16932b['query']['includeAll']){_0x3ffe11[_0x01b4('0x3d')]=[{'all':!![]}];}_0x3ffe11=_['merge']({},_0x3ffe11,_0x16932b[_0x01b4('0x40')]);return db[_0x01b4('0x3b')][_0x01b4('0x41')](_0x3ffe11)[_0x01b4('0x21')](handleEntityNotFound(_0x560ded,null))[_0x01b4('0x21')](respondWithResult(_0x560ded,null))[_0x01b4('0x3f')](handleError(_0x560ded,null));};exports[_0x01b4('0x42')]=function(_0x1bf9cd,_0x4b5cec){return db['Template'][_0x01b4('0x42')](_0x1bf9cd[_0x01b4('0x43')],{})['then'](function(_0x39f20a){var _0x518e83=_0x1bf9cd[_0x01b4('0x44')]['get']({'plain':!![]});if(!_0x518e83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x518e83['role']===_0x01b4('0x44')){var _0x331824=_0x39f20a[_0x01b4('0x22')]({'plain':!![]});var _0x3906f0=_0x01b4('0x23');return db['UserProfileSection'][_0x01b4('0x41')]({'where':{'name':_0x3906f0,'userProfileId':_0x518e83[_0x01b4('0x45')]},'raw':!![]})[_0x01b4('0x21')](function(_0x399dd7){if(_0x399dd7&&_0x399dd7[_0x01b4('0x46')]===0x0){return db[_0x01b4('0x47')][_0x01b4('0x42')]({'name':_0x331824[_0x01b4('0x26')],'resourceId':_0x331824['id'],'type':_0x399dd7[_0x01b4('0x26')],'sectionId':_0x399dd7['id']},{})['then'](function(){return _0x39f20a;});}else{return _0x39f20a;}})[_0x01b4('0x3f')](function(_0x211efc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211efc);throw _0x211efc;});}return _0x39f20a;})[_0x01b4('0x21')](respondWithResult(_0x4b5cec,0xc9))[_0x01b4('0x3f')](handleError(_0x4b5cec,null));};exports[_0x01b4('0x48')]=function(_0x57dcd9,_0x4d5daf){if(_0x57dcd9['body']['id']){delete _0x57dcd9['body']['id'];}return db[_0x01b4('0x3b')][_0x01b4('0x41')]({'where':{'id':_0x57dcd9['params']['id']}})['then'](handleEntityNotFound(_0x4d5daf,null))[_0x01b4('0x21')](saveUpdates(_0x57dcd9[_0x01b4('0x43')],null))[_0x01b4('0x21')](respondWithResult(_0x4d5daf,null))[_0x01b4('0x3f')](handleError(_0x4d5daf,null));};exports[_0x01b4('0x24')]=function(_0x45fb92,_0x26774b){return db['Template'][_0x01b4('0x41')]({'where':{'id':_0x45fb92[_0x01b4('0x49')]['id']}})[_0x01b4('0x21')](handleEntityNotFound(_0x26774b,null))[_0x01b4('0x21')](removeEntity(_0x26774b,null))[_0x01b4('0x3f')](handleError(_0x26774b,null));}; \ No newline at end of file +var _0x947b=['UserProfileResource','end','sendStatus','error','stack','name','index','Template','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','zip-dir','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Templates'];(function(_0xeb729a,_0x5d09df){var _0x2b71e9=function(_0x3580b4){while(--_0x3580b4){_0xeb729a['push'](_0xeb729a['shift']());}};_0x2b71e9(++_0x5d09df);}(_0x947b,0x11c));var _0xb947=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x947b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb947('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb947('0x1'));var moment=require(_0xb947('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb947('0x3'));var util=require('util');var path=require('path');var sox=require(_0xb947('0x4'));var csv=require(_0xb947('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb947('0x6'));var _=require(_0xb947('0x7'));var squel=require(_0xb947('0x8'));var crypto=require(_0xb947('0x9'));var jsforce=require(_0xb947('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb947('0x5'));var querystring=require(_0xb947('0xb'));var Papa=require(_0xb947('0xc'));var Redis=require(_0xb947('0xd'));var authService=require(_0xb947('0xe'));var qs=require(_0xb947('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb947('0x10'));var logger=require(_0xb947('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb947('0x12'));var licenseUtil=require(_0xb947('0x13'));var db=require(_0xb947('0x14'))['db'];function respondWithStatusCode(_0x4c841f,_0x3c1013){_0x3c1013=_0x3c1013||0xcc;return function(_0x3e91ed){if(_0x3e91ed){return _0x4c841f['sendStatus'](_0x3c1013);}return _0x4c841f[_0xb947('0x15')](_0x3c1013)['end']();};}function respondWithResult(_0x5edf11,_0x2f9855){_0x2f9855=_0x2f9855||0xc8;return function(_0x2f6021){if(_0x2f6021){return _0x5edf11[_0xb947('0x15')](_0x2f9855)[_0xb947('0x16')](_0x2f6021);}};}function respondWithFilteredResult(_0x35e99a,_0x57d724){return function(_0x28d615){if(_0x28d615){var _0x243350=typeof _0x57d724[_0xb947('0x17')]==='undefined'&&typeof _0x57d724[_0xb947('0x18')]===_0xb947('0x19');var _0x78f5df=_0x28d615['count'];var _0x250726=_0x243350?0x0:_0x57d724[_0xb947('0x17')];var _0x38aae3=_0x243350?_0x28d615[_0xb947('0x1a')]:_0x57d724[_0xb947('0x17')]+_0x57d724[_0xb947('0x18')];var _0x349f66;if(_0x38aae3>=_0x78f5df){_0x38aae3=_0x78f5df;_0x349f66=0xc8;}else{_0x349f66=0xce;}_0x35e99a['status'](_0x349f66);return _0x35e99a[_0xb947('0x1b')](_0xb947('0x1c'),_0x250726+'-'+_0x38aae3+'/'+_0x78f5df)[_0xb947('0x16')](_0x28d615);}return null;};}function patchUpdates(_0x537ca0){return function(_0x47125e){try{jsonpatch[_0xb947('0x1d')](_0x47125e,_0x537ca0,!![]);}catch(_0x2b0016){return BPromise[_0xb947('0x1e')](_0x2b0016);}return _0x47125e[_0xb947('0x1f')]();};}function saveUpdates(_0x46ed25,_0x101ffe){return function(_0x358de8){if(_0x358de8){return _0x358de8[_0xb947('0x20')](_0x46ed25)[_0xb947('0x21')](function(_0x597014){return _0x597014;});}return null;};}function removeEntity(_0x18474d,_0x1c6d29){return function(_0x4005e3){if(_0x4005e3){return _0x4005e3[_0xb947('0x22')]()[_0xb947('0x21')](function(){var _0x338211=_0x4005e3['get']({'plain':!![]});var _0x40d671=_0xb947('0x23');return db[_0xb947('0x24')][_0xb947('0x22')]({'where':{'type':_0x40d671,'resourceId':_0x338211['id']}})[_0xb947('0x21')](function(){return _0x4005e3;});})[_0xb947('0x21')](function(){_0x18474d['status'](0xcc)[_0xb947('0x25')]();});}};}function handleEntityNotFound(_0x37c941,_0x480e6f){return function(_0x1cc857){if(!_0x1cc857){_0x37c941[_0xb947('0x26')](0x194);}return _0x1cc857;};}function handleError(_0x4383cb,_0x2f413e){_0x2f413e=_0x2f413e||0x1f4;return function(_0xf5e068){logger[_0xb947('0x27')](_0xf5e068[_0xb947('0x28')]);if(_0xf5e068[_0xb947('0x29')]){delete _0xf5e068[_0xb947('0x29')];}_0x4383cb['status'](_0x2f413e)['send'](_0xf5e068);};}exports[_0xb947('0x2a')]=function(_0x5c70db,_0x251fe7){var _0x578953={},_0x341daf={},_0x5ec413={'count':0x0,'rows':[]};var _0x4e442a=_['map'](db[_0xb947('0x2b')]['rawAttributes'],function(_0x503f14){return{'name':_0x503f14[_0xb947('0x2c')],'type':_0x503f14[_0xb947('0x2d')]['key']};});_0x341daf['model']=_[_0xb947('0x2e')](_0x4e442a,_0xb947('0x29'));_0x341daf[_0xb947('0x2f')]=_[_0xb947('0x30')](_0x5c70db[_0xb947('0x2f')]);_0x341daf[_0xb947('0x31')]=_[_0xb947('0x32')](_0x341daf[_0xb947('0x33')],_0x341daf['query']);_0x578953[_0xb947('0x34')]=_[_0xb947('0x32')](_0x341daf[_0xb947('0x33')],qs[_0xb947('0x35')](_0x5c70db[_0xb947('0x2f')]['fields']));_0x578953[_0xb947('0x34')]=_0x578953[_0xb947('0x34')][_0xb947('0x36')]?_0x578953[_0xb947('0x34')]:_0x341daf[_0xb947('0x33')];if(!_0x5c70db[_0xb947('0x2f')][_0xb947('0x37')](_0xb947('0x38'))){_0x578953[_0xb947('0x18')]=qs[_0xb947('0x18')](_0x5c70db[_0xb947('0x2f')][_0xb947('0x18')]);_0x578953['offset']=qs[_0xb947('0x17')](_0x5c70db[_0xb947('0x2f')]['offset']);}_0x578953[_0xb947('0x39')]=qs[_0xb947('0x3a')](_0x5c70db[_0xb947('0x2f')][_0xb947('0x3a')]);_0x578953['where']=qs[_0xb947('0x31')](_[_0xb947('0x3b')](_0x5c70db[_0xb947('0x2f')],_0x341daf[_0xb947('0x31')]),_0x4e442a);if(_0x5c70db['query'][_0xb947('0x3c')]){_0x578953[_0xb947('0x3d')]=_[_0xb947('0x3e')](_0x578953[_0xb947('0x3d')],{'$or':_[_0xb947('0x2e')](_0x4e442a,function(_0x4220ac){if(_0x4220ac[_0xb947('0x2d')]!=='VIRTUAL'){var _0x23d85f={};_0x23d85f[_0x4220ac['name']]={'$like':'%'+_0x5c70db['query']['filter']+'%'};return _0x23d85f;}})});}_0x578953=_['merge']({},_0x578953,_0x5c70db[_0xb947('0x3f')]);var _0x17e7dd={'where':_0x578953[_0xb947('0x3d')]};return db['Template'][_0xb947('0x1a')](_0x17e7dd)['then'](function(_0x183404){_0x5ec413[_0xb947('0x1a')]=_0x183404;if(_0x5c70db[_0xb947('0x2f')][_0xb947('0x40')]){_0x578953[_0xb947('0x41')]=[{'all':!![]}];}return db[_0xb947('0x2b')]['findAll'](_0x578953);})['then'](function(_0x5d732e){_0x5ec413['rows']=_0x5d732e;return _0x5ec413;})[_0xb947('0x21')](respondWithFilteredResult(_0x251fe7,_0x578953))[_0xb947('0x42')](handleError(_0x251fe7,null));};exports[_0xb947('0x43')]=function(_0x5b7265,_0x18b42c){var _0x272d84={'raw':!![],'where':{'id':_0x5b7265['params']['id']}},_0xc8654f={};_0xc8654f[_0xb947('0x33')]=_[_0xb947('0x30')](db[_0xb947('0x2b')][_0xb947('0x44')]);_0xc8654f[_0xb947('0x2f')]=_['keys'](_0x5b7265[_0xb947('0x2f')]);_0xc8654f[_0xb947('0x31')]=_[_0xb947('0x32')](_0xc8654f[_0xb947('0x33')],_0xc8654f[_0xb947('0x2f')]);_0x272d84[_0xb947('0x34')]=_[_0xb947('0x32')](_0xc8654f['model'],qs[_0xb947('0x35')](_0x5b7265[_0xb947('0x2f')][_0xb947('0x35')]));_0x272d84[_0xb947('0x34')]=_0x272d84[_0xb947('0x34')][_0xb947('0x36')]?_0x272d84['attributes']:_0xc8654f[_0xb947('0x33')];if(_0x5b7265['query'][_0xb947('0x40')]){_0x272d84[_0xb947('0x41')]=[{'all':!![]}];}_0x272d84=_[_0xb947('0x3e')]({},_0x272d84,_0x5b7265[_0xb947('0x3f')]);return db[_0xb947('0x2b')][_0xb947('0x45')](_0x272d84)['then'](handleEntityNotFound(_0x18b42c,null))[_0xb947('0x21')](respondWithResult(_0x18b42c,null))[_0xb947('0x42')](handleError(_0x18b42c,null));};exports['create']=function(_0x2dd6c0,_0x4bcb64){return db[_0xb947('0x2b')][_0xb947('0x46')](_0x2dd6c0[_0xb947('0x47')],{})[_0xb947('0x21')](function(_0x5c4f2d){var _0x4a13c1=_0x2dd6c0[_0xb947('0x48')][_0xb947('0x49')]({'plain':!![]});if(!_0x4a13c1)throw new Error(_0xb947('0x4a'));if(_0x4a13c1[_0xb947('0x4b')]===_0xb947('0x48')){var _0x402f0c=_0x5c4f2d[_0xb947('0x49')]({'plain':!![]});var _0x445966=_0xb947('0x23');return db[_0xb947('0x4c')][_0xb947('0x45')]({'where':{'name':_0x445966,'userProfileId':_0x4a13c1[_0xb947('0x4d')]},'raw':!![]})[_0xb947('0x21')](function(_0x3ad4a1){if(_0x3ad4a1&&_0x3ad4a1[_0xb947('0x4e')]===0x0){return db[_0xb947('0x24')][_0xb947('0x46')]({'name':_0x402f0c[_0xb947('0x29')],'resourceId':_0x402f0c['id'],'type':_0x3ad4a1[_0xb947('0x29')],'sectionId':_0x3ad4a1['id']},{})[_0xb947('0x21')](function(){return _0x5c4f2d;});}else{return _0x5c4f2d;}})[_0xb947('0x42')](function(_0xbb8ae0){logger[_0xb947('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbb8ae0);throw _0xbb8ae0;});}return _0x5c4f2d;})[_0xb947('0x21')](respondWithResult(_0x4bcb64,0xc9))[_0xb947('0x42')](handleError(_0x4bcb64,null));};exports[_0xb947('0x20')]=function(_0x43a71f,_0x4cac76){if(_0x43a71f['body']['id']){delete _0x43a71f[_0xb947('0x47')]['id'];}return db[_0xb947('0x2b')]['find']({'where':{'id':_0x43a71f['params']['id']}})['then'](handleEntityNotFound(_0x4cac76,null))['then'](saveUpdates(_0x43a71f[_0xb947('0x47')],null))['then'](respondWithResult(_0x4cac76,null))['catch'](handleError(_0x4cac76,null));};exports[_0xb947('0x22')]=function(_0x1fde2b,_0x2e7d24){return db[_0xb947('0x2b')]['find']({'where':{'id':_0x1fde2b[_0xb947('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2e7d24,null))[_0xb947('0x21')](removeEntity(_0x2e7d24,null))[_0xb947('0x42')](handleError(_0x2e7d24,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1a395d7..1f4ec3b 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 _0x372f=['./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x372f,0xba));var _0xf372=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x372f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf372('0x0'));var util=require(_0xf372('0x1'));var logger=require(_0xf372('0x2'))(_0xf372('0x3'));var moment=require(_0xf372('0x4'));var BPromise=require('bluebird');var rp=require(_0xf372('0x5'));var fs=require('fs');var path=require(_0xf372('0x6'));var rimraf=require(_0xf372('0x7'));var config=require(_0xf372('0x8'));var attributes=require(_0xf372('0x9'));module[_0xf372('0xa')]=function(_0x294b8b,_0x6f4c8b){return _0x294b8b[_0xf372('0xb')]('Template',attributes,{'tableName':_0xf372('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe70=['tools_templates','lodash','util','bluebird','path','../../config/environment','./template.attributes','define'];(function(_0x29e7d5,_0x125466){var _0x5a3e66=function(_0x47755b){while(--_0x47755b){_0x29e7d5['push'](_0x29e7d5['shift']());}};_0x5a3e66(++_0x125466);}(_0xbe70,0x129));var _0x0be7=function(_0x3d86f4,_0x2edcb6){_0x3d86f4=_0x3d86f4-0x0;var _0x372f3a=_0xbe70[_0x3d86f4];return _0x372f3a;};'use strict';var _=require(_0x0be7('0x0'));var util=require(_0x0be7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0be7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0be7('0x3'));var rimraf=require('rimraf');var config=require(_0x0be7('0x4'));var attributes=require(_0x0be7('0x5'));module['exports']=function(_0x178c8a,_0x3100ed){return _0x178c8a[_0x0be7('0x6')]('Template',attributes,{'tableName':_0x0be7('0x7'),'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 61b0086..45e212d 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 _0xf619=['include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf619,0x7f));var _0x9f61=function(_0x9e1ddb,_0x59886d){_0x9e1ddb=_0x9e1ddb-0x0;var _0x528252=_0xf619[_0x9e1ddb];return _0x528252;};'use strict';var _=require('lodash');var util=require(_0x9f61('0x0'));var moment=require(_0x9f61('0x1'));var BPromise=require(_0x9f61('0x2'));var rs=require(_0x9f61('0x3'));var fs=require('fs');var Redis=require(_0x9f61('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f61('0x5'));var jayson=require(_0x9f61('0x6'));var client=jayson[_0x9f61('0x7')][_0x9f61('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e5a74,_0x508293,_0x303421){return new BPromise(function(_0x5e2bd0,_0x368f61){return client[_0x9f61('0x9')](_0x3e5a74,_0x303421)[_0x9f61('0xa')](function(_0xf05c3a){logger[_0x9f61('0xb')]('Template,\x20%s,\x20%s',_0x508293,_0x9f61('0xc'));logger[_0x9f61('0xd')](_0x9f61('0xe'),_0x508293,_0x9f61('0xc'),JSON[_0x9f61('0xf')](_0xf05c3a));if(_0xf05c3a[_0x9f61('0x10')]){if(_0xf05c3a[_0x9f61('0x10')][_0x9f61('0x11')]===0x1f4){logger[_0x9f61('0x10')]('Template,\x20%s,\x20%s',_0x508293,_0xf05c3a[_0x9f61('0x10')][_0x9f61('0x12')]);return _0x368f61(_0xf05c3a['error'][_0x9f61('0x12')]);}logger['error'](_0x9f61('0x13'),_0x508293,_0xf05c3a[_0x9f61('0x10')][_0x9f61('0x12')]);return _0x5e2bd0(_0xf05c3a[_0x9f61('0x10')][_0x9f61('0x12')]);}else{logger[_0x9f61('0xb')](_0x9f61('0x13'),_0x508293,_0x9f61('0xc'));_0x5e2bd0(_0xf05c3a['result'][_0x9f61('0x12')]);}})['catch'](function(_0x37b9c0){logger['error'](_0x9f61('0x13'),_0x508293,_0x37b9c0);_0x368f61(_0x37b9c0);});});}exports[_0x9f61('0x14')]=function(_0x2d43a4){var _0x3bfda8=this;return new Promise(function(_0x43136c,_0x4e3b28){return db[_0x9f61('0x15')][_0x9f61('0x16')]({'raw':_0x2d43a4['options']?_0x2d43a4[_0x9f61('0x17')][_0x9f61('0x18')]===undefined?!![]:![]:!![],'where':_0x2d43a4[_0x9f61('0x17')]?_0x2d43a4['options'][_0x9f61('0x19')]||null:null,'attributes':_0x2d43a4[_0x9f61('0x17')]?_0x2d43a4[_0x9f61('0x17')][_0x9f61('0x1a')]||null:null,'limit':_0x2d43a4[_0x9f61('0x17')]?_0x2d43a4[_0x9f61('0x17')][_0x9f61('0x1b')]||null:null,'include':_0x2d43a4[_0x9f61('0x17')]?_0x2d43a4[_0x9f61('0x17')][_0x9f61('0x1c')]?_[_0x9f61('0x1d')](_0x2d43a4[_0x9f61('0x17')][_0x9f61('0x1c')],function(_0x1c9bd7){return{'model':db[_0x1c9bd7['model']],'as':_0x1c9bd7['as'],'attributes':_0x1c9bd7[_0x9f61('0x1a')],'include':_0x1c9bd7[_0x9f61('0x1c')]?_[_0x9f61('0x1d')](_0x1c9bd7[_0x9f61('0x1c')],function(_0x42a709){return{'model':db[_0x42a709['model']],'as':_0x42a709['as'],'attributes':_0x42a709[_0x9f61('0x1a')],'include':_0x42a709[_0x9f61('0x1c')]?_['map'](_0x42a709['include'],function(_0x4308ad){return{'model':db[_0x4308ad[_0x9f61('0x1e')]],'as':_0x4308ad['as'],'attributes':_0x4308ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f61('0xa')](function(_0x310e48){logger[_0x9f61('0xb')](_0x9f61('0x14'),_0x2d43a4);logger[_0x9f61('0xd')](_0x9f61('0x14'),_0x2d43a4,JSON['stringify'](_0x310e48));_0x43136c(_0x310e48);})['catch'](function(_0x538be3){logger['error'](_0x9f61('0x14'),_0x538be3[_0x9f61('0x12')],_0x2d43a4);_0x4e3b28(_0x3bfda8[_0x9f61('0x10')](0x1f4,_0x538be3[_0x9f61('0x12')]));});});}; \ No newline at end of file +var _0xf5fd=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','lodash','util','moment','bluebird'];(function(_0x5c3f69,_0x31fb75){var _0x4c8b01=function(_0x5cdfef){while(--_0x5cdfef){_0x5c3f69['push'](_0x5c3f69['shift']());}};_0x4c8b01(++_0x31fb75);}(_0xf5fd,0xc8));var _0xdf5f=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xf5fd[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var moment=require(_0xdf5f('0x2'));var BPromise=require(_0xdf5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf5f('0x4'));var logger=require(_0xdf5f('0x5'))(_0xdf5f('0x6'));var config=require(_0xdf5f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf5f('0x8')][_0xdf5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b9e5f,_0x509e65,_0xe78298){return new BPromise(function(_0x31074c,_0x84c4cb){return client[_0xdf5f('0xa')](_0x5b9e5f,_0xe78298)[_0xdf5f('0xb')](function(_0x4864b7){logger['info'](_0xdf5f('0xc'),_0x509e65,_0xdf5f('0xd'));logger[_0xdf5f('0xe')](_0xdf5f('0xf'),_0x509e65,_0xdf5f('0xd'),JSON['stringify'](_0x4864b7));if(_0x4864b7[_0xdf5f('0x10')]){if(_0x4864b7[_0xdf5f('0x10')][_0xdf5f('0x11')]===0x1f4){logger[_0xdf5f('0x10')](_0xdf5f('0xc'),_0x509e65,_0x4864b7[_0xdf5f('0x10')][_0xdf5f('0x12')]);return _0x84c4cb(_0x4864b7[_0xdf5f('0x10')][_0xdf5f('0x12')]);}logger[_0xdf5f('0x10')](_0xdf5f('0xc'),_0x509e65,_0x4864b7['error'][_0xdf5f('0x12')]);return _0x31074c(_0x4864b7[_0xdf5f('0x10')][_0xdf5f('0x12')]);}else{logger[_0xdf5f('0x13')](_0xdf5f('0xc'),_0x509e65,_0xdf5f('0xd'));_0x31074c(_0x4864b7[_0xdf5f('0x14')][_0xdf5f('0x12')]);}})['catch'](function(_0x2874fb){logger[_0xdf5f('0x10')](_0xdf5f('0xc'),_0x509e65,_0x2874fb);_0x84c4cb(_0x2874fb);});});}exports[_0xdf5f('0x15')]=function(_0x3085db){var _0x3b40b3=this;return new Promise(function(_0x169149,_0x19615c){return db[_0xdf5f('0x16')][_0xdf5f('0x17')]({'raw':_0x3085db[_0xdf5f('0x18')]?_0x3085db[_0xdf5f('0x18')][_0xdf5f('0x19')]===undefined?!![]:![]:!![],'where':_0x3085db[_0xdf5f('0x18')]?_0x3085db[_0xdf5f('0x18')][_0xdf5f('0x1a')]||null:null,'attributes':_0x3085db['options']?_0x3085db[_0xdf5f('0x18')][_0xdf5f('0x1b')]||null:null,'limit':_0x3085db[_0xdf5f('0x18')]?_0x3085db['options'][_0xdf5f('0x1c')]||null:null,'include':_0x3085db['options']?_0x3085db['options']['include']?_[_0xdf5f('0x1d')](_0x3085db[_0xdf5f('0x18')][_0xdf5f('0x1e')],function(_0x19290d){return{'model':db[_0x19290d[_0xdf5f('0x1f')]],'as':_0x19290d['as'],'attributes':_0x19290d[_0xdf5f('0x1b')],'include':_0x19290d['include']?_[_0xdf5f('0x1d')](_0x19290d[_0xdf5f('0x1e')],function(_0x172084){return{'model':db[_0x172084[_0xdf5f('0x1f')]],'as':_0x172084['as'],'attributes':_0x172084[_0xdf5f('0x1b')],'include':_0x172084['include']?_[_0xdf5f('0x1d')](_0x172084['include'],function(_0x64e99f){return{'model':db[_0x64e99f['model']],'as':_0x64e99f['as'],'attributes':_0x64e99f[_0xdf5f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdf5f('0xb')](function(_0x262d17){logger[_0xdf5f('0x13')](_0xdf5f('0x15'),_0x3085db);logger['debug'](_0xdf5f('0x15'),_0x3085db,JSON[_0xdf5f('0x20')](_0x262d17));_0x169149(_0x262d17);})[_0xdf5f('0x21')](function(_0x48ce10){logger[_0xdf5f('0x10')](_0xdf5f('0x15'),_0x48ce10[_0xdf5f('0x12')],_0x3085db);_0x19615c(_0x3b40b3[_0xdf5f('0x10')](0x1f4,_0x48ce10[_0xdf5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1d67dbe..6a93118 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 _0x9672=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show'];(function(_0x2431b4,_0x4b8a2b){var _0x322d1c=function(_0xc60e7e){while(--_0xc60e7e){_0x2431b4['push'](_0x2431b4['shift']());}};_0x322d1c(++_0x4b8a2b);}(_0x9672,0xee));var _0x2967=function(_0x35f275,_0x5b78ab){_0x35f275=_0x35f275-0x0;var _0x5a4e2b=_0x9672[_0x35f275];return _0x5a4e2b;};'use strict';var multer=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var path=require('path');var timeout=require(_0x2967('0x2'));var express=require(_0x2967('0x3'));var router=express[_0x2967('0x4')]();var fs_extra=require(_0x2967('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var controller=require(_0x2967('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2967('0x9')]);router[_0x2967('0xa')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0xd')]);router[_0x2967('0xa')](_0x2967('0xe'),auth[_0x2967('0xc')](),controller['getAllConditions']);router[_0x2967('0xa')](_0x2967('0xf'),auth[_0x2967('0xc')](),controller[_0x2967('0x10')]);router[_0x2967('0xa')](_0x2967('0x11'),auth['isAuthenticated'](),controller[_0x2967('0x12')]);router['post']('/',auth[_0x2967('0xc')](),controller['create']);router[_0x2967('0x13')](_0x2967('0xe'),auth['isAuthenticated'](),controller[_0x2967('0x14')]);router['post'](_0x2967('0xf'),auth[_0x2967('0xc')](),controller[_0x2967('0x15')]);router['post']('/:id/actions',auth[_0x2967('0xc')](),controller[_0x2967('0x16')]);router[_0x2967('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2967('0x18')]);router[_0x2967('0x19')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0x1a')]);module[_0x2967('0x1b')]=router; \ No newline at end of file +var _0x19cb=['getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19cb,0x1cc));var _0xb19c=function(_0x4e3740,_0x5a6187){_0x4e3740=_0x4e3740-0x0;var _0x17e6d7=_0x19cb[_0x4e3740];return _0x17e6d7;};'use strict';var multer=require(_0xb19c('0x0'));var util=require(_0xb19c('0x1'));var path=require(_0xb19c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb19c('0x3'));var router=express[_0xb19c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb19c('0x5'));var interaction=require(_0xb19c('0x6'));var config=require(_0xb19c('0x7'));var controller=require('./trigger.controller');router[_0xb19c('0x8')]('/',auth[_0xb19c('0x9')](),controller[_0xb19c('0xa')]);router[_0xb19c('0x8')](_0xb19c('0xb'),auth['isAuthenticated'](),controller[_0xb19c('0xc')]);router[_0xb19c('0x8')](_0xb19c('0xd'),auth[_0xb19c('0x9')](),controller[_0xb19c('0xe')]);router[_0xb19c('0x8')](_0xb19c('0xf'),auth['isAuthenticated'](),controller[_0xb19c('0x10')]);router[_0xb19c('0x8')](_0xb19c('0x11'),auth[_0xb19c('0x9')](),controller[_0xb19c('0x12')]);router[_0xb19c('0x13')]('/',auth[_0xb19c('0x9')](),controller[_0xb19c('0x14')]);router['post'](_0xb19c('0xd'),auth[_0xb19c('0x9')](),controller[_0xb19c('0x15')]);router[_0xb19c('0x13')](_0xb19c('0xf'),auth['isAuthenticated'](),controller[_0xb19c('0x16')]);router[_0xb19c('0x13')](_0xb19c('0x11'),auth[_0xb19c('0x9')](),controller[_0xb19c('0x17')]);router[_0xb19c('0x18')]('/:id',auth[_0xb19c('0x9')](),controller[_0xb19c('0x19')]);router['delete'](_0xb19c('0xb'),auth[_0xb19c('0x9')](),controller[_0xb19c('0x1a')]);module[_0xb19c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 75dbead..b9696be 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 _0xa410=['BOOLEAN','sequelize','STRING'];(function(_0x1361ce,_0x296aaf){var _0x4da25b=function(_0x298009){while(--_0x298009){_0x1361ce['push'](_0x1361ce['shift']());}};_0x4da25b(++_0x296aaf);}(_0xa410,0xa9));var _0x0a41=function(_0x1fbbda,_0xace203){_0x1fbbda=_0x1fbbda-0x0;var _0x2a5b75=_0xa410[_0x1fbbda];return _0x2a5b75;};'use strict';var Sequelize=require(_0x0a41('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a41('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0a41('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xddab=['BOOLEAN','sequelize','exports','STRING'];(function(_0x92d580,_0x4928fb){var _0x4ee344=function(_0x55aa0c){while(--_0x55aa0c){_0x92d580['push'](_0x92d580['shift']());}};_0x4ee344(++_0x4928fb);}(_0xddab,0x1e5));var _0xbdda=function(_0x5ebf,_0x56e440){_0x5ebf=_0x5ebf-0x0;var _0x46818c=_0xddab[_0x5ebf];return _0x46818c;};'use strict';var Sequelize=require(_0xbdda('0x0'));module[_0xbdda('0x1')]={'name':{'type':Sequelize[_0xbdda('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbdda('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 3ee2a99..91b11cf 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 _0x7edc=['show','params','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','nolimit','getAnyConditions','rawAttributes','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','Trigger','includeAll','include','rows','catch'];(function(_0x5eaa16,_0x28ebad){var _0x352569=function(_0x4a8013){while(--_0x4a8013){_0x5eaa16['push'](_0x5eaa16['shift']());}};_0x352569(++_0x28ebad);}(_0x7edc,0xd6));var _0xc7ed=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x7edc[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0xc7ed('0x0'));var rimraf=require(_0xc7ed('0x1'));var zipdir=require(_0xc7ed('0x2'));var jsonpatch=require(_0xc7ed('0x3'));var rp=require(_0xc7ed('0x4'));var moment=require('moment');var BPromise=require(_0xc7ed('0x5'));var Mustache=require(_0xc7ed('0x6'));var util=require(_0xc7ed('0x7'));var path=require(_0xc7ed('0x8'));var sox=require(_0xc7ed('0x9'));var csv=require(_0xc7ed('0xa'));var ejs=require(_0xc7ed('0xb'));var fs=require('fs');var fs_extra=require(_0xc7ed('0xc'));var _=require(_0xc7ed('0xd'));var squel=require(_0xc7ed('0xe'));var crypto=require('crypto');var jsforce=require(_0xc7ed('0xf'));var deskjs=require(_0xc7ed('0x10'));var toCsv=require(_0xc7ed('0xa'));var querystring=require(_0xc7ed('0x11'));var Papa=require(_0xc7ed('0x12'));var Redis=require(_0xc7ed('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc7ed('0x14'));var as=require(_0xc7ed('0x15'));var hardwareService=require(_0xc7ed('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc7ed('0x17'));var config=require(_0xc7ed('0x18'));var licenseUtil=require(_0xc7ed('0x19'));var db=require(_0xc7ed('0x1a'))['db'];function respondWithStatusCode(_0x745b56,_0x5475fc){_0x5475fc=_0x5475fc||0xcc;return function(_0x44bc3a){if(_0x44bc3a){return _0x745b56[_0xc7ed('0x1b')](_0x5475fc);}return _0x745b56[_0xc7ed('0x1c')](_0x5475fc)[_0xc7ed('0x1d')]();};}function respondWithResult(_0x2852c3,_0x5f27a4){_0x5f27a4=_0x5f27a4||0xc8;return function(_0x3597e3){if(_0x3597e3){return _0x2852c3[_0xc7ed('0x1c')](_0x5f27a4)['json'](_0x3597e3);}};}function respondWithFilteredResult(_0x5724a2,_0x5d75cf){return function(_0x553638){if(_0x553638){var _0x382afb=typeof _0x5d75cf[_0xc7ed('0x1e')]===_0xc7ed('0x1f')&&typeof _0x5d75cf['limit']===_0xc7ed('0x1f');var _0x3ac652=_0x553638[_0xc7ed('0x20')];var _0x310ed2=_0x382afb?0x0:_0x5d75cf[_0xc7ed('0x1e')];var _0x4af385=_0x382afb?_0x553638[_0xc7ed('0x20')]:_0x5d75cf['offset']+_0x5d75cf['limit'];var _0x4e92b8;if(_0x4af385>=_0x3ac652){_0x4af385=_0x3ac652;_0x4e92b8=0xc8;}else{_0x4e92b8=0xce;}_0x5724a2[_0xc7ed('0x1c')](_0x4e92b8);return _0x5724a2[_0xc7ed('0x21')]('Content-Range',_0x310ed2+'-'+_0x4af385+'/'+_0x3ac652)[_0xc7ed('0x22')](_0x553638);}return null;};}function patchUpdates(_0x4cb47c){return function(_0x40919b){try{jsonpatch[_0xc7ed('0x23')](_0x40919b,_0x4cb47c,!![]);}catch(_0x1df1ae){return BPromise[_0xc7ed('0x24')](_0x1df1ae);}return _0x40919b[_0xc7ed('0x25')]();};}function saveUpdates(_0x378bf0,_0x2c7ad5){return function(_0x3037d7){if(_0x3037d7){return _0x3037d7['update'](_0x378bf0)[_0xc7ed('0x26')](function(_0x2bb0e1){return _0x2bb0e1;});}return null;};}function removeEntity(_0x41591a,_0x587a16){return function(_0x3c21ed){if(_0x3c21ed){return _0x3c21ed[_0xc7ed('0x27')]()[_0xc7ed('0x26')](function(){var _0x1fb8a6=_0x3c21ed[_0xc7ed('0x28')]({'plain':!![]});var _0x190079='Triggers';return db[_0xc7ed('0x29')]['destroy']({'where':{'type':_0x190079,'resourceId':_0x1fb8a6['id']}})[_0xc7ed('0x26')](function(){return _0x3c21ed;});})['then'](function(){_0x41591a[_0xc7ed('0x1c')](0xcc)[_0xc7ed('0x1d')]();});}};}function handleEntityNotFound(_0xc0cb82,_0x32b6b9){return function(_0x2ecec2){if(!_0x2ecec2){_0xc0cb82['sendStatus'](0x194);}return _0x2ecec2;};}function handleError(_0x2fb9d6,_0x35b377){_0x35b377=_0x35b377||0x1f4;return function(_0x433113){logger[_0xc7ed('0x2a')](_0x433113[_0xc7ed('0x2b')]);if(_0x433113[_0xc7ed('0x2c')]){delete _0x433113[_0xc7ed('0x2c')];}_0x2fb9d6[_0xc7ed('0x1c')](_0x35b377)[_0xc7ed('0x2d')](_0x433113);};}exports[_0xc7ed('0x2e')]=function(_0x4d15ae,_0x156c0c){var _0x1b31b4={},_0x268be3={},_0x24008f={'count':0x0,'rows':[]};var _0xdd3f62=_[_0xc7ed('0x2f')](db['Trigger']['rawAttributes'],function(_0x3d2f39){return{'name':_0x3d2f39[_0xc7ed('0x30')],'type':_0x3d2f39[_0xc7ed('0x31')]['key']};});_0x268be3[_0xc7ed('0x32')]=_['map'](_0xdd3f62,_0xc7ed('0x2c'));_0x268be3[_0xc7ed('0x33')]=_[_0xc7ed('0x34')](_0x4d15ae['query']);_0x268be3[_0xc7ed('0x35')]=_[_0xc7ed('0x36')](_0x268be3[_0xc7ed('0x32')],_0x268be3[_0xc7ed('0x33')]);_0x1b31b4['attributes']=_[_0xc7ed('0x36')](_0x268be3[_0xc7ed('0x32')],qs[_0xc7ed('0x37')](_0x4d15ae[_0xc7ed('0x33')][_0xc7ed('0x37')]));_0x1b31b4[_0xc7ed('0x38')]=_0x1b31b4['attributes'][_0xc7ed('0x39')]?_0x1b31b4[_0xc7ed('0x38')]:_0x268be3[_0xc7ed('0x32')];if(!_0x4d15ae[_0xc7ed('0x33')][_0xc7ed('0x3a')]('nolimit')){_0x1b31b4['limit']=qs[_0xc7ed('0x3b')](_0x4d15ae[_0xc7ed('0x33')]['limit']);_0x1b31b4['offset']=qs[_0xc7ed('0x1e')](_0x4d15ae[_0xc7ed('0x33')][_0xc7ed('0x1e')]);}_0x1b31b4[_0xc7ed('0x3c')]=qs['sort'](_0x4d15ae[_0xc7ed('0x33')][_0xc7ed('0x3d')]);_0x1b31b4[_0xc7ed('0x3e')]=qs['filters'](_[_0xc7ed('0x3f')](_0x4d15ae[_0xc7ed('0x33')],_0x268be3[_0xc7ed('0x35')]),_0xdd3f62);if(_0x4d15ae['query'][_0xc7ed('0x40')]){_0x1b31b4[_0xc7ed('0x3e')]=_['merge'](_0x1b31b4['where'],{'$or':_[_0xc7ed('0x2f')](_0xdd3f62,function(_0x17e8fb){if(_0x17e8fb[_0xc7ed('0x31')]!==_0xc7ed('0x41')){var _0x49fa48={};_0x49fa48[_0x17e8fb[_0xc7ed('0x2c')]]={'$like':'%'+_0x4d15ae[_0xc7ed('0x33')][_0xc7ed('0x40')]+'%'};return _0x49fa48;}})});}_0x1b31b4=_['merge']({},_0x1b31b4,_0x4d15ae['options']);var _0x2c8e42={'where':_0x1b31b4[_0xc7ed('0x3e')]};return db[_0xc7ed('0x42')]['count'](_0x2c8e42)[_0xc7ed('0x26')](function(_0x32c7ff){_0x24008f['count']=_0x32c7ff;if(_0x4d15ae['query'][_0xc7ed('0x43')]){_0x1b31b4[_0xc7ed('0x44')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x1b31b4);})[_0xc7ed('0x26')](function(_0x552f65){_0x24008f[_0xc7ed('0x45')]=_0x552f65;return _0x24008f;})[_0xc7ed('0x26')](respondWithFilteredResult(_0x156c0c,_0x1b31b4))[_0xc7ed('0x46')](handleError(_0x156c0c,null));};exports[_0xc7ed('0x47')]=function(_0x4a6aa0,_0x27be9f){var _0x5e0254={'raw':![],'where':{'id':_0x4a6aa0[_0xc7ed('0x48')]['id']}},_0x375bc2={};_0x375bc2[_0xc7ed('0x32')]=_[_0xc7ed('0x34')](db[_0xc7ed('0x42')]['rawAttributes']);_0x375bc2['query']=_[_0xc7ed('0x34')](_0x4a6aa0['query']);_0x375bc2['filters']=_[_0xc7ed('0x36')](_0x375bc2[_0xc7ed('0x32')],_0x375bc2[_0xc7ed('0x33')]);_0x5e0254[_0xc7ed('0x38')]=_[_0xc7ed('0x36')](_0x375bc2[_0xc7ed('0x32')],qs[_0xc7ed('0x37')](_0x4a6aa0['query'][_0xc7ed('0x37')]));_0x5e0254[_0xc7ed('0x38')]=_0x5e0254[_0xc7ed('0x38')][_0xc7ed('0x39')]?_0x5e0254[_0xc7ed('0x38')]:_0x375bc2['model'];if(_0x4a6aa0['query'][_0xc7ed('0x43')]){_0x5e0254[_0xc7ed('0x44')]=[{'all':!![]}];}_0x5e0254=_[_0xc7ed('0x49')]({},_0x5e0254,_0x4a6aa0[_0xc7ed('0x4a')]);return db['Trigger'][_0xc7ed('0x4b')](_0x5e0254)[_0xc7ed('0x26')](handleEntityNotFound(_0x27be9f,null))['then'](respondWithResult(_0x27be9f,null))[_0xc7ed('0x46')](handleError(_0x27be9f,null));};exports[_0xc7ed('0x4c')]=function(_0x3a3dae,_0x334370){return db[_0xc7ed('0x42')][_0xc7ed('0x4c')](_0x3a3dae[_0xc7ed('0x4d')],{})[_0xc7ed('0x26')](function(_0x339a7f){var _0x2e6941=_0x3a3dae[_0xc7ed('0x4e')][_0xc7ed('0x28')]({'plain':!![]});if(!_0x2e6941)throw new Error(_0xc7ed('0x4f'));if(_0x2e6941[_0xc7ed('0x50')]==='user'){var _0x355304=_0x339a7f[_0xc7ed('0x28')]({'plain':!![]});var _0x2be8db=_0xc7ed('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x2be8db,'userProfileId':_0x2e6941[_0xc7ed('0x52')]},'raw':!![]})[_0xc7ed('0x26')](function(_0x540b11){if(_0x540b11&&_0x540b11[_0xc7ed('0x53')]===0x0){return db[_0xc7ed('0x29')][_0xc7ed('0x4c')]({'name':_0x355304[_0xc7ed('0x2c')],'resourceId':_0x355304['id'],'type':_0x540b11[_0xc7ed('0x2c')],'sectionId':_0x540b11['id']},{})['then'](function(){return _0x339a7f;});}else{return _0x339a7f;}})['catch'](function(_0x4f9ef3){logger[_0xc7ed('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f9ef3);throw _0x4f9ef3;});}return _0x339a7f;})[_0xc7ed('0x26')](respondWithResult(_0x334370,0xc9))[_0xc7ed('0x46')](handleError(_0x334370,null));};exports['update']=function(_0x3f6b44,_0x1fc835){if(_0x3f6b44[_0xc7ed('0x4d')]['id']){delete _0x3f6b44['body']['id'];}return db[_0xc7ed('0x42')][_0xc7ed('0x4b')]({'where':{'id':_0x3f6b44[_0xc7ed('0x48')]['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x1fc835,null))['then'](saveUpdates(_0x3f6b44[_0xc7ed('0x4d')],null))[_0xc7ed('0x26')](respondWithResult(_0x1fc835,null))['catch'](handleError(_0x1fc835,null));};exports[_0xc7ed('0x27')]=function(_0x36e127,_0x23a193){return db[_0xc7ed('0x42')]['find']({'where':{'id':_0x36e127[_0xc7ed('0x48')]['id']}})['then'](handleEntityNotFound(_0x23a193,null))[_0xc7ed('0x26')](removeEntity(_0x23a193,null))['catch'](handleError(_0x23a193,null));};exports[_0xc7ed('0x54')]=function(_0xb783e0,_0x12e3b9,_0x5ed4ff){if(_0xb783e0[_0xc7ed('0x4d')]['id']){delete _0xb783e0[_0xc7ed('0x4d')]['id'];}return db[_0xc7ed('0x42')][_0xc7ed('0x4b')]({'where':{'id':_0xb783e0[_0xc7ed('0x48')]['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x12e3b9,null))['then'](function(_0x3f1522){if(_0x3f1522){_0xb783e0[_0xc7ed('0x4d')]['TriggerAllId']=_0x3f1522['id'];return db['Condition'][_0xc7ed('0x4c')](_0xb783e0[_0xc7ed('0x4d')]);}})[_0xc7ed('0x26')](respondWithResult(_0x12e3b9,null))[_0xc7ed('0x46')](handleError(_0x12e3b9,null));};exports[_0xc7ed('0x55')]=function(_0x2aaaba,_0x37beee,_0x4f4325){if(_0x2aaaba[_0xc7ed('0x4d')]['id']){delete _0x2aaaba['body']['id'];}return db[_0xc7ed('0x42')][_0xc7ed('0x4b')]({'where':{'id':_0x2aaaba[_0xc7ed('0x48')]['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x37beee,null))[_0xc7ed('0x26')](function(_0x32064e){if(_0x32064e){_0x2aaaba['body']['TriggerAnyId']=_0x32064e['id'];return db[_0xc7ed('0x56')][_0xc7ed('0x4c')](_0x2aaaba[_0xc7ed('0x4d')]);}})['then'](respondWithResult(_0x37beee,null))[_0xc7ed('0x46')](handleError(_0x37beee,null));};exports[_0xc7ed('0x57')]=function(_0x342ad8,_0x98dd48,_0x2763b8){var _0x10d0d1={};var _0xcdcdd8={};var _0x151c64;var _0x32dc7a;return db[_0xc7ed('0x42')][_0xc7ed('0x58')]({'where':{'id':_0x342ad8[_0xc7ed('0x48')]['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x98dd48,null))[_0xc7ed('0x26')](function(_0x2ddd6f){if(_0x2ddd6f){_0x151c64=_0x2ddd6f;_0xcdcdd8[_0xc7ed('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0xcdcdd8[_0xc7ed('0x33')]=_['keys'](_0x342ad8[_0xc7ed('0x33')]);_0xcdcdd8[_0xc7ed('0x35')]=_[_0xc7ed('0x36')](_0xcdcdd8['model'],_0xcdcdd8['query']);_0x10d0d1[_0xc7ed('0x38')]=_[_0xc7ed('0x36')](_0xcdcdd8[_0xc7ed('0x32')],qs[_0xc7ed('0x37')](_0x342ad8[_0xc7ed('0x33')][_0xc7ed('0x37')]));_0x10d0d1['attributes']=_0x10d0d1['attributes'][_0xc7ed('0x39')]?_0x10d0d1[_0xc7ed('0x38')]:_0xcdcdd8[_0xc7ed('0x32')];_0x10d0d1[_0xc7ed('0x3c')]=qs['sort'](_0x342ad8[_0xc7ed('0x33')]['sort']);_0x10d0d1[_0xc7ed('0x3e')]=qs['filters'](_['pick'](_0x342ad8[_0xc7ed('0x33')],_0xcdcdd8[_0xc7ed('0x35')]));if(_0x342ad8['query']['filter']){_0x10d0d1[_0xc7ed('0x3e')]=_[_0xc7ed('0x49')](_0x10d0d1[_0xc7ed('0x3e')],{'$or':_[_0xc7ed('0x2f')](_0x10d0d1[_0xc7ed('0x38')],function(_0x425036){var _0x1575ec={};_0x1575ec[_0x425036]={'$like':'%'+_0x342ad8[_0xc7ed('0x33')][_0xc7ed('0x40')]+'%'};return _0x1575ec;})});}_0x10d0d1=_[_0xc7ed('0x49')]({},_0x10d0d1,_0x342ad8[_0xc7ed('0x4a')]);return _0x151c64[_0xc7ed('0x57')](_0x10d0d1);}})[_0xc7ed('0x26')](function(_0x340674){if(_0x340674){_0x32dc7a=_0x340674['length'];if(!_0x342ad8[_0xc7ed('0x33')]['hasOwnProperty'](_0xc7ed('0x59'))){_0x10d0d1[_0xc7ed('0x3b')]=qs[_0xc7ed('0x3b')](_0x342ad8['query'][_0xc7ed('0x3b')]);_0x10d0d1['offset']=qs['offset'](_0x342ad8['query'][_0xc7ed('0x1e')]);}return _0x151c64[_0xc7ed('0x57')](_0x10d0d1);}})[_0xc7ed('0x26')](function(_0x2e637c){if(_0x2e637c){return _0x2e637c?{'count':_0x32dc7a,'rows':_0x2e637c}:null;}})['then'](respondWithResult(_0x98dd48,null))['catch'](handleError(_0x98dd48,null));};exports[_0xc7ed('0x5a')]=function(_0x5db36c,_0x30e7ad,_0x5d2ec9){var _0x501bdd={};var _0x24b353={};var _0x2a523d;var _0x37806a;return db['Trigger'][_0xc7ed('0x58')]({'where':{'id':_0x5db36c[_0xc7ed('0x48')]['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x30e7ad,null))['then'](function(_0xb9677b){if(_0xb9677b){_0x2a523d=_0xb9677b;_0x24b353[_0xc7ed('0x32')]=_[_0xc7ed('0x34')](db[_0xc7ed('0x56')][_0xc7ed('0x5b')]);_0x24b353[_0xc7ed('0x33')]=_[_0xc7ed('0x34')](_0x5db36c[_0xc7ed('0x33')]);_0x24b353[_0xc7ed('0x35')]=_['intersection'](_0x24b353[_0xc7ed('0x32')],_0x24b353['query']);_0x501bdd[_0xc7ed('0x38')]=_[_0xc7ed('0x36')](_0x24b353['model'],qs['fields'](_0x5db36c[_0xc7ed('0x33')][_0xc7ed('0x37')]));_0x501bdd[_0xc7ed('0x38')]=_0x501bdd['attributes']['length']?_0x501bdd[_0xc7ed('0x38')]:_0x24b353[_0xc7ed('0x32')];_0x501bdd[_0xc7ed('0x3c')]=qs[_0xc7ed('0x3d')](_0x5db36c['query'][_0xc7ed('0x3d')]);_0x501bdd[_0xc7ed('0x3e')]=qs[_0xc7ed('0x35')](_['pick'](_0x5db36c[_0xc7ed('0x33')],_0x24b353[_0xc7ed('0x35')]));if(_0x5db36c[_0xc7ed('0x33')]['filter']){_0x501bdd[_0xc7ed('0x3e')]=_[_0xc7ed('0x49')](_0x501bdd[_0xc7ed('0x3e')],{'$or':_[_0xc7ed('0x2f')](_0x501bdd[_0xc7ed('0x38')],function(_0x3003cc){var _0x4771b1={};_0x4771b1[_0x3003cc]={'$like':'%'+_0x5db36c[_0xc7ed('0x33')][_0xc7ed('0x40')]+'%'};return _0x4771b1;})});}_0x501bdd=_['merge']({},_0x501bdd,_0x5db36c[_0xc7ed('0x4a')]);return _0x2a523d[_0xc7ed('0x5a')](_0x501bdd);}})[_0xc7ed('0x26')](function(_0xd54575){if(_0xd54575){_0x37806a=_0xd54575[_0xc7ed('0x39')];if(!_0x5db36c[_0xc7ed('0x33')]['hasOwnProperty'](_0xc7ed('0x59'))){_0x501bdd[_0xc7ed('0x3b')]=qs[_0xc7ed('0x3b')](_0x5db36c[_0xc7ed('0x33')][_0xc7ed('0x3b')]);_0x501bdd[_0xc7ed('0x1e')]=qs[_0xc7ed('0x1e')](_0x5db36c[_0xc7ed('0x33')][_0xc7ed('0x1e')]);}return _0x2a523d[_0xc7ed('0x5a')](_0x501bdd);}})[_0xc7ed('0x26')](function(_0x2f7fa1){if(_0x2f7fa1){return _0x2f7fa1?{'count':_0x37806a,'rows':_0x2f7fa1}:null;}})[_0xc7ed('0x26')](respondWithResult(_0x30e7ad,null))['catch'](handleError(_0x30e7ad,null));};exports[_0xc7ed('0x5c')]=function(_0x4381a1,_0x3c7dac,_0x181e20){if(_0x4381a1[_0xc7ed('0x4d')]['id']){delete _0x4381a1[_0xc7ed('0x4d')]['id'];}return db[_0xc7ed('0x42')]['find']({'where':{'id':_0x4381a1['params']['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x3c7dac,null))['then'](function(_0xb7fdad){if(_0xb7fdad){_0x4381a1['body']['TriggerId']=_0xb7fdad['id'];return db[_0xc7ed('0x5d')][_0xc7ed('0x4c')](_0x4381a1[_0xc7ed('0x4d')]);}})[_0xc7ed('0x26')](respondWithResult(_0x3c7dac,null))[_0xc7ed('0x46')](handleError(_0x3c7dac,null));};exports[_0xc7ed('0x5e')]=function(_0x4890f4,_0x5c57b7,_0x3637b3){var _0x3f23={};var _0x1b63a4={};var _0x13c848;var _0x4ed93d;return db[_0xc7ed('0x42')][_0xc7ed('0x58')]({'where':{'id':_0x4890f4['params']['id']}})[_0xc7ed('0x26')](handleEntityNotFound(_0x5c57b7,null))[_0xc7ed('0x26')](function(_0x50b44d){if(_0x50b44d){_0x13c848=_0x50b44d;_0x1b63a4[_0xc7ed('0x32')]=_['keys'](db['Action'][_0xc7ed('0x5b')]);_0x1b63a4[_0xc7ed('0x33')]=_[_0xc7ed('0x34')](_0x4890f4[_0xc7ed('0x33')]);_0x1b63a4[_0xc7ed('0x35')]=_[_0xc7ed('0x36')](_0x1b63a4['model'],_0x1b63a4[_0xc7ed('0x33')]);_0x3f23[_0xc7ed('0x38')]=_[_0xc7ed('0x36')](_0x1b63a4['model'],qs[_0xc7ed('0x37')](_0x4890f4[_0xc7ed('0x33')][_0xc7ed('0x37')]));_0x3f23['attributes']=_0x3f23['attributes'][_0xc7ed('0x39')]?_0x3f23[_0xc7ed('0x38')]:_0x1b63a4[_0xc7ed('0x32')];_0x3f23[_0xc7ed('0x3c')]=qs['sort'](_0x4890f4[_0xc7ed('0x33')][_0xc7ed('0x3d')]);_0x3f23[_0xc7ed('0x3e')]=qs['filters'](_[_0xc7ed('0x3f')](_0x4890f4[_0xc7ed('0x33')],_0x1b63a4[_0xc7ed('0x35')]));if(_0x4890f4[_0xc7ed('0x33')][_0xc7ed('0x40')]){_0x3f23[_0xc7ed('0x3e')]=_[_0xc7ed('0x49')](_0x3f23['where'],{'$or':_[_0xc7ed('0x2f')](_0x3f23['attributes'],function(_0x4e8dda){var _0x3227d7={};_0x3227d7[_0x4e8dda]={'$like':'%'+_0x4890f4[_0xc7ed('0x33')][_0xc7ed('0x40')]+'%'};return _0x3227d7;})});}_0x3f23=_['merge']({},_0x3f23,_0x4890f4[_0xc7ed('0x4a')]);return _0x13c848[_0xc7ed('0x5e')](_0x3f23);}})[_0xc7ed('0x26')](function(_0x383abf){if(_0x383abf){_0x4ed93d=_0x383abf['length'];if(!_0x4890f4['query'][_0xc7ed('0x3a')](_0xc7ed('0x59'))){_0x3f23[_0xc7ed('0x3b')]=qs['limit'](_0x4890f4[_0xc7ed('0x33')]['limit']);_0x3f23['offset']=qs[_0xc7ed('0x1e')](_0x4890f4[_0xc7ed('0x33')]['offset']);}return _0x13c848[_0xc7ed('0x5e')](_0x3f23);}})[_0xc7ed('0x26')](function(_0x1c477c){if(_0x1c477c){return _0x1c477c?{'count':_0x4ed93d,'rows':_0x1c477c}:null;}})[_0xc7ed('0x26')](respondWithResult(_0x5c57b7,null))['catch'](handleError(_0x5c57b7,null));}; \ No newline at end of file +var _0x0475=['../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','Triggers','name','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','getAnyConditions','pick','addAction','Action','getActions','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0475,0xf6));var _0x5047=function(_0x525284,_0x525c3e){_0x525284=_0x525284-0x0;var _0x1fbcd6=_0x0475[_0x525284];return _0x1fbcd6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5047('0x1'));var rp=require(_0x5047('0x2'));var moment=require('moment');var BPromise=require(_0x5047('0x3'));var Mustache=require('mustache');var util=require(_0x5047('0x4'));var path=require(_0x5047('0x5'));var sox=require('sox');var csv=require(_0x5047('0x6'));var ejs=require(_0x5047('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5047('0x8'));var squel=require('squel');var crypto=require(_0x5047('0x9'));var jsforce=require(_0x5047('0xa'));var deskjs=require(_0x5047('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5047('0xc'));var Papa=require(_0x5047('0xd'));var Redis=require('ioredis');var authService=require(_0x5047('0xe'));var qs=require(_0x5047('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5047('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5047('0x11'));var licenseUtil=require(_0x5047('0x12'));var db=require(_0x5047('0x13'))['db'];function respondWithStatusCode(_0x530e98,_0x186514){_0x186514=_0x186514||0xcc;return function(_0x2bda06){if(_0x2bda06){return _0x530e98[_0x5047('0x14')](_0x186514);}return _0x530e98[_0x5047('0x15')](_0x186514)[_0x5047('0x16')]();};}function respondWithResult(_0x7b6fad,_0x3e083a){_0x3e083a=_0x3e083a||0xc8;return function(_0x10a1ae){if(_0x10a1ae){return _0x7b6fad['status'](_0x3e083a)['json'](_0x10a1ae);}};}function respondWithFilteredResult(_0x5f50d0,_0x50b830){return function(_0x3298e9){if(_0x3298e9){var _0x3df5a0=typeof _0x50b830[_0x5047('0x17')]==='undefined'&&typeof _0x50b830[_0x5047('0x18')]===_0x5047('0x19');var _0x4e52d2=_0x3298e9['count'];var _0x4d042c=_0x3df5a0?0x0:_0x50b830['offset'];var _0x3c80d0=_0x3df5a0?_0x3298e9[_0x5047('0x1a')]:_0x50b830[_0x5047('0x17')]+_0x50b830['limit'];var _0x1bd9a6;if(_0x3c80d0>=_0x4e52d2){_0x3c80d0=_0x4e52d2;_0x1bd9a6=0xc8;}else{_0x1bd9a6=0xce;}_0x5f50d0[_0x5047('0x15')](_0x1bd9a6);return _0x5f50d0[_0x5047('0x1b')]('Content-Range',_0x4d042c+'-'+_0x3c80d0+'/'+_0x4e52d2)['json'](_0x3298e9);}return null;};}function patchUpdates(_0xb27ebc){return function(_0x19d4c0){try{jsonpatch['apply'](_0x19d4c0,_0xb27ebc,!![]);}catch(_0x1dfd1f){return BPromise[_0x5047('0x1c')](_0x1dfd1f);}return _0x19d4c0[_0x5047('0x1d')]();};}function saveUpdates(_0x43c0c4,_0x266f20){return function(_0x4a8cfa){if(_0x4a8cfa){return _0x4a8cfa[_0x5047('0x1e')](_0x43c0c4)[_0x5047('0x1f')](function(_0x534da7){return _0x534da7;});}return null;};}function removeEntity(_0x1f1fbc,_0x4cc8aa){return function(_0x25f0d6){if(_0x25f0d6){return _0x25f0d6[_0x5047('0x20')]()[_0x5047('0x1f')](function(){var _0x2565ea=_0x25f0d6[_0x5047('0x21')]({'plain':!![]});var _0x38a80f=_0x5047('0x22');return db['UserProfileResource'][_0x5047('0x20')]({'where':{'type':_0x38a80f,'resourceId':_0x2565ea['id']}})[_0x5047('0x1f')](function(){return _0x25f0d6;});})[_0x5047('0x1f')](function(){_0x1f1fbc[_0x5047('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ebee,_0x59a627){return function(_0x44494e){if(!_0x44494e){_0x36ebee[_0x5047('0x14')](0x194);}return _0x44494e;};}function handleError(_0x210ff8,_0x22bad6){_0x22bad6=_0x22bad6||0x1f4;return function(_0x335e8f){logger['error'](_0x335e8f['stack']);if(_0x335e8f[_0x5047('0x23')]){delete _0x335e8f[_0x5047('0x23')];}_0x210ff8[_0x5047('0x15')](_0x22bad6)['send'](_0x335e8f);};}exports[_0x5047('0x24')]=function(_0x52785c,_0x418d94){var _0x1f1552={},_0x3ea58e={},_0x53cd31={'count':0x0,'rows':[]};var _0x4d3ca1=_[_0x5047('0x25')](db[_0x5047('0x26')]['rawAttributes'],function(_0x3b1a66){return{'name':_0x3b1a66[_0x5047('0x27')],'type':_0x3b1a66[_0x5047('0x28')][_0x5047('0x29')]};});_0x3ea58e[_0x5047('0x2a')]=_[_0x5047('0x25')](_0x4d3ca1,'name');_0x3ea58e[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x52785c['query']);_0x3ea58e['filters']=_[_0x5047('0x2d')](_0x3ea58e[_0x5047('0x2a')],_0x3ea58e[_0x5047('0x2b')]);_0x1f1552['attributes']=_[_0x5047('0x2d')](_0x3ea58e[_0x5047('0x2a')],qs['fields'](_0x52785c['query']['fields']));_0x1f1552[_0x5047('0x2e')]=_0x1f1552[_0x5047('0x2e')]['length']?_0x1f1552[_0x5047('0x2e')]:_0x3ea58e[_0x5047('0x2a')];if(!_0x52785c[_0x5047('0x2b')][_0x5047('0x2f')](_0x5047('0x30'))){_0x1f1552[_0x5047('0x18')]=qs['limit'](_0x52785c[_0x5047('0x2b')][_0x5047('0x18')]);_0x1f1552['offset']=qs[_0x5047('0x17')](_0x52785c[_0x5047('0x2b')][_0x5047('0x17')]);}_0x1f1552[_0x5047('0x31')]=qs[_0x5047('0x32')](_0x52785c[_0x5047('0x2b')]['sort']);_0x1f1552['where']=qs['filters'](_['pick'](_0x52785c[_0x5047('0x2b')],_0x3ea58e[_0x5047('0x33')]),_0x4d3ca1);if(_0x52785c[_0x5047('0x2b')][_0x5047('0x34')]){_0x1f1552['where']=_['merge'](_0x1f1552[_0x5047('0x35')],{'$or':_[_0x5047('0x25')](_0x4d3ca1,function(_0x4fccdf){if(_0x4fccdf[_0x5047('0x28')]!==_0x5047('0x36')){var _0x4c5e86={};_0x4c5e86[_0x4fccdf[_0x5047('0x23')]]={'$like':'%'+_0x52785c['query'][_0x5047('0x34')]+'%'};return _0x4c5e86;}})});}_0x1f1552=_[_0x5047('0x37')]({},_0x1f1552,_0x52785c[_0x5047('0x38')]);var _0x62c55d={'where':_0x1f1552[_0x5047('0x35')]};return db[_0x5047('0x26')][_0x5047('0x1a')](_0x62c55d)[_0x5047('0x1f')](function(_0x32128d){_0x53cd31[_0x5047('0x1a')]=_0x32128d;if(_0x52785c[_0x5047('0x2b')][_0x5047('0x39')]){_0x1f1552[_0x5047('0x3a')]=[{'all':!![]}];}return db[_0x5047('0x26')][_0x5047('0x3b')](_0x1f1552);})['then'](function(_0x53d12d){_0x53cd31['rows']=_0x53d12d;return _0x53cd31;})[_0x5047('0x1f')](respondWithFilteredResult(_0x418d94,_0x1f1552))[_0x5047('0x3c')](handleError(_0x418d94,null));};exports[_0x5047('0x3d')]=function(_0x4909f4,_0x3a652f){var _0x4504df={'raw':![],'where':{'id':_0x4909f4[_0x5047('0x3e')]['id']}},_0x238d6e={};_0x238d6e['model']=_[_0x5047('0x2c')](db[_0x5047('0x26')][_0x5047('0x3f')]);_0x238d6e[_0x5047('0x2b')]=_['keys'](_0x4909f4[_0x5047('0x2b')]);_0x238d6e[_0x5047('0x33')]=_['intersection'](_0x238d6e[_0x5047('0x2a')],_0x238d6e[_0x5047('0x2b')]);_0x4504df['attributes']=_[_0x5047('0x2d')](_0x238d6e[_0x5047('0x2a')],qs[_0x5047('0x40')](_0x4909f4[_0x5047('0x2b')][_0x5047('0x40')]));_0x4504df[_0x5047('0x2e')]=_0x4504df[_0x5047('0x2e')]['length']?_0x4504df['attributes']:_0x238d6e['model'];if(_0x4909f4[_0x5047('0x2b')][_0x5047('0x39')]){_0x4504df['include']=[{'all':!![]}];}_0x4504df=_['merge']({},_0x4504df,_0x4909f4[_0x5047('0x38')]);return db[_0x5047('0x26')]['find'](_0x4504df)[_0x5047('0x1f')](handleEntityNotFound(_0x3a652f,null))[_0x5047('0x1f')](respondWithResult(_0x3a652f,null))['catch'](handleError(_0x3a652f,null));};exports[_0x5047('0x41')]=function(_0x18b98c,_0x5dd8f5){return db[_0x5047('0x26')]['create'](_0x18b98c[_0x5047('0x42')],{})[_0x5047('0x1f')](function(_0x25a72e){var _0xcaf9e8=_0x18b98c[_0x5047('0x43')][_0x5047('0x21')]({'plain':!![]});if(!_0xcaf9e8)throw new Error(_0x5047('0x44'));if(_0xcaf9e8['role']==='user'){var _0x8904ae=_0x25a72e['get']({'plain':!![]});var _0x323e1b=_0x5047('0x22');return db[_0x5047('0x45')][_0x5047('0x46')]({'where':{'name':_0x323e1b,'userProfileId':_0xcaf9e8[_0x5047('0x47')]},'raw':!![]})[_0x5047('0x1f')](function(_0x294420){if(_0x294420&&_0x294420[_0x5047('0x48')]===0x0){return db[_0x5047('0x49')][_0x5047('0x41')]({'name':_0x8904ae[_0x5047('0x23')],'resourceId':_0x8904ae['id'],'type':_0x294420['name'],'sectionId':_0x294420['id']},{})[_0x5047('0x1f')](function(){return _0x25a72e;});}else{return _0x25a72e;}})[_0x5047('0x3c')](function(_0x595449){logger['error'](_0x5047('0x4a'),_0x595449);throw _0x595449;});}return _0x25a72e;})[_0x5047('0x1f')](respondWithResult(_0x5dd8f5,0xc9))[_0x5047('0x3c')](handleError(_0x5dd8f5,null));};exports[_0x5047('0x1e')]=function(_0xb7c7c0,_0x232249){if(_0xb7c7c0[_0x5047('0x42')]['id']){delete _0xb7c7c0[_0x5047('0x42')]['id'];}return db[_0x5047('0x26')]['find']({'where':{'id':_0xb7c7c0[_0x5047('0x3e')]['id']}})[_0x5047('0x1f')](handleEntityNotFound(_0x232249,null))[_0x5047('0x1f')](saveUpdates(_0xb7c7c0[_0x5047('0x42')],null))[_0x5047('0x1f')](respondWithResult(_0x232249,null))[_0x5047('0x3c')](handleError(_0x232249,null));};exports[_0x5047('0x20')]=function(_0x56cf74,_0x16eb2c){return db['Trigger'][_0x5047('0x46')]({'where':{'id':_0x56cf74[_0x5047('0x3e')]['id']}})['then'](handleEntityNotFound(_0x16eb2c,null))[_0x5047('0x1f')](removeEntity(_0x16eb2c,null))['catch'](handleError(_0x16eb2c,null));};exports[_0x5047('0x4b')]=function(_0x125717,_0x41d6ce,_0x3b20ec){if(_0x125717['body']['id']){delete _0x125717['body']['id'];}return db[_0x5047('0x26')][_0x5047('0x46')]({'where':{'id':_0x125717[_0x5047('0x3e')]['id']}})[_0x5047('0x1f')](handleEntityNotFound(_0x41d6ce,null))[_0x5047('0x1f')](function(_0x492d43){if(_0x492d43){_0x125717[_0x5047('0x42')]['TriggerAllId']=_0x492d43['id'];return db[_0x5047('0x4c')][_0x5047('0x41')](_0x125717[_0x5047('0x42')]);}})[_0x5047('0x1f')](respondWithResult(_0x41d6ce,null))['catch'](handleError(_0x41d6ce,null));};exports[_0x5047('0x4d')]=function(_0x4add8c,_0xe5a7e,_0x4df2d4){if(_0x4add8c[_0x5047('0x42')]['id']){delete _0x4add8c[_0x5047('0x42')]['id'];}return db[_0x5047('0x26')][_0x5047('0x46')]({'where':{'id':_0x4add8c['params']['id']}})[_0x5047('0x1f')](handleEntityNotFound(_0xe5a7e,null))[_0x5047('0x1f')](function(_0x557e47){if(_0x557e47){_0x4add8c[_0x5047('0x42')][_0x5047('0x4e')]=_0x557e47['id'];return db[_0x5047('0x4c')]['create'](_0x4add8c[_0x5047('0x42')]);}})[_0x5047('0x1f')](respondWithResult(_0xe5a7e,null))[_0x5047('0x3c')](handleError(_0xe5a7e,null));};exports[_0x5047('0x4f')]=function(_0x382b73,_0x339671,_0x1ba36e){var _0x13f595={};var _0x278361={};var _0x28710e;var _0x23d6df;return db['Trigger'][_0x5047('0x50')]({'where':{'id':_0x382b73[_0x5047('0x3e')]['id']}})['then'](handleEntityNotFound(_0x339671,null))[_0x5047('0x1f')](function(_0x32b7b2){if(_0x32b7b2){_0x28710e=_0x32b7b2;_0x278361[_0x5047('0x2a')]=_['keys'](db[_0x5047('0x4c')][_0x5047('0x3f')]);_0x278361['query']=_[_0x5047('0x2c')](_0x382b73[_0x5047('0x2b')]);_0x278361[_0x5047('0x33')]=_[_0x5047('0x2d')](_0x278361[_0x5047('0x2a')],_0x278361[_0x5047('0x2b')]);_0x13f595[_0x5047('0x2e')]=_[_0x5047('0x2d')](_0x278361[_0x5047('0x2a')],qs[_0x5047('0x40')](_0x382b73[_0x5047('0x2b')]['fields']));_0x13f595[_0x5047('0x2e')]=_0x13f595[_0x5047('0x2e')][_0x5047('0x51')]?_0x13f595[_0x5047('0x2e')]:_0x278361['model'];_0x13f595[_0x5047('0x31')]=qs[_0x5047('0x32')](_0x382b73['query'][_0x5047('0x32')]);_0x13f595[_0x5047('0x35')]=qs[_0x5047('0x33')](_['pick'](_0x382b73[_0x5047('0x2b')],_0x278361[_0x5047('0x33')]));if(_0x382b73[_0x5047('0x2b')][_0x5047('0x34')]){_0x13f595[_0x5047('0x35')]=_[_0x5047('0x37')](_0x13f595[_0x5047('0x35')],{'$or':_[_0x5047('0x25')](_0x13f595[_0x5047('0x2e')],function(_0x5a2eff){var _0x5c6957={};_0x5c6957[_0x5a2eff]={'$like':'%'+_0x382b73[_0x5047('0x2b')]['filter']+'%'};return _0x5c6957;})});}_0x13f595=_[_0x5047('0x37')]({},_0x13f595,_0x382b73[_0x5047('0x38')]);return _0x28710e[_0x5047('0x4f')](_0x13f595);}})[_0x5047('0x1f')](function(_0x19c4be){if(_0x19c4be){_0x23d6df=_0x19c4be[_0x5047('0x51')];if(!_0x382b73['query'][_0x5047('0x2f')]('nolimit')){_0x13f595[_0x5047('0x18')]=qs[_0x5047('0x18')](_0x382b73[_0x5047('0x2b')]['limit']);_0x13f595[_0x5047('0x17')]=qs['offset'](_0x382b73['query'][_0x5047('0x17')]);}return _0x28710e[_0x5047('0x4f')](_0x13f595);}})[_0x5047('0x1f')](function(_0x276121){if(_0x276121){return _0x276121?{'count':_0x23d6df,'rows':_0x276121}:null;}})[_0x5047('0x1f')](respondWithResult(_0x339671,null))[_0x5047('0x3c')](handleError(_0x339671,null));};exports[_0x5047('0x52')]=function(_0x53732b,_0xd342a2,_0x2a17e6){var _0x525101={};var _0x1b6f1e={};var _0x59da0e;var _0x1d751c;return db['Trigger']['findOne']({'where':{'id':_0x53732b[_0x5047('0x3e')]['id']}})[_0x5047('0x1f')](handleEntityNotFound(_0xd342a2,null))[_0x5047('0x1f')](function(_0x22cdbf){if(_0x22cdbf){_0x59da0e=_0x22cdbf;_0x1b6f1e[_0x5047('0x2a')]=_[_0x5047('0x2c')](db['Condition'][_0x5047('0x3f')]);_0x1b6f1e[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x53732b[_0x5047('0x2b')]);_0x1b6f1e[_0x5047('0x33')]=_[_0x5047('0x2d')](_0x1b6f1e[_0x5047('0x2a')],_0x1b6f1e[_0x5047('0x2b')]);_0x525101[_0x5047('0x2e')]=_[_0x5047('0x2d')](_0x1b6f1e['model'],qs[_0x5047('0x40')](_0x53732b[_0x5047('0x2b')]['fields']));_0x525101['attributes']=_0x525101['attributes']['length']?_0x525101[_0x5047('0x2e')]:_0x1b6f1e[_0x5047('0x2a')];_0x525101[_0x5047('0x31')]=qs[_0x5047('0x32')](_0x53732b['query'][_0x5047('0x32')]);_0x525101[_0x5047('0x35')]=qs[_0x5047('0x33')](_[_0x5047('0x53')](_0x53732b['query'],_0x1b6f1e[_0x5047('0x33')]));if(_0x53732b[_0x5047('0x2b')][_0x5047('0x34')]){_0x525101[_0x5047('0x35')]=_[_0x5047('0x37')](_0x525101[_0x5047('0x35')],{'$or':_['map'](_0x525101['attributes'],function(_0x3521e9){var _0x367166={};_0x367166[_0x3521e9]={'$like':'%'+_0x53732b[_0x5047('0x2b')][_0x5047('0x34')]+'%'};return _0x367166;})});}_0x525101=_['merge']({},_0x525101,_0x53732b[_0x5047('0x38')]);return _0x59da0e['getAnyConditions'](_0x525101);}})[_0x5047('0x1f')](function(_0x368838){if(_0x368838){_0x1d751c=_0x368838[_0x5047('0x51')];if(!_0x53732b[_0x5047('0x2b')]['hasOwnProperty']('nolimit')){_0x525101[_0x5047('0x18')]=qs['limit'](_0x53732b[_0x5047('0x2b')][_0x5047('0x18')]);_0x525101['offset']=qs[_0x5047('0x17')](_0x53732b['query'][_0x5047('0x17')]);}return _0x59da0e[_0x5047('0x52')](_0x525101);}})[_0x5047('0x1f')](function(_0x575250){if(_0x575250){return _0x575250?{'count':_0x1d751c,'rows':_0x575250}:null;}})[_0x5047('0x1f')](respondWithResult(_0xd342a2,null))['catch'](handleError(_0xd342a2,null));};exports[_0x5047('0x54')]=function(_0x1bdac3,_0x1138f9,_0x4b2b70){if(_0x1bdac3['body']['id']){delete _0x1bdac3[_0x5047('0x42')]['id'];}return db[_0x5047('0x26')]['find']({'where':{'id':_0x1bdac3[_0x5047('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1138f9,null))['then'](function(_0x43de57){if(_0x43de57){_0x1bdac3['body']['TriggerId']=_0x43de57['id'];return db[_0x5047('0x55')]['create'](_0x1bdac3[_0x5047('0x42')]);}})[_0x5047('0x1f')](respondWithResult(_0x1138f9,null))['catch'](handleError(_0x1138f9,null));};exports[_0x5047('0x56')]=function(_0x51688e,_0xe5f949,_0x101a58){var _0x4968b5={};var _0x24b86={};var _0x529ded;var _0x38618f;return db[_0x5047('0x26')][_0x5047('0x50')]({'where':{'id':_0x51688e[_0x5047('0x3e')]['id']}})['then'](handleEntityNotFound(_0xe5f949,null))[_0x5047('0x1f')](function(_0x4b98c9){if(_0x4b98c9){_0x529ded=_0x4b98c9;_0x24b86['model']=_[_0x5047('0x2c')](db[_0x5047('0x55')][_0x5047('0x3f')]);_0x24b86[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x51688e[_0x5047('0x2b')]);_0x24b86[_0x5047('0x33')]=_['intersection'](_0x24b86[_0x5047('0x2a')],_0x24b86[_0x5047('0x2b')]);_0x4968b5[_0x5047('0x2e')]=_[_0x5047('0x2d')](_0x24b86[_0x5047('0x2a')],qs['fields'](_0x51688e['query'][_0x5047('0x40')]));_0x4968b5[_0x5047('0x2e')]=_0x4968b5[_0x5047('0x2e')][_0x5047('0x51')]?_0x4968b5[_0x5047('0x2e')]:_0x24b86[_0x5047('0x2a')];_0x4968b5[_0x5047('0x31')]=qs[_0x5047('0x32')](_0x51688e[_0x5047('0x2b')][_0x5047('0x32')]);_0x4968b5[_0x5047('0x35')]=qs[_0x5047('0x33')](_[_0x5047('0x53')](_0x51688e[_0x5047('0x2b')],_0x24b86[_0x5047('0x33')]));if(_0x51688e['query'][_0x5047('0x34')]){_0x4968b5[_0x5047('0x35')]=_[_0x5047('0x37')](_0x4968b5[_0x5047('0x35')],{'$or':_[_0x5047('0x25')](_0x4968b5[_0x5047('0x2e')],function(_0x2dcd2e){var _0x5e8cfe={};_0x5e8cfe[_0x2dcd2e]={'$like':'%'+_0x51688e[_0x5047('0x2b')][_0x5047('0x34')]+'%'};return _0x5e8cfe;})});}_0x4968b5=_[_0x5047('0x37')]({},_0x4968b5,_0x51688e['options']);return _0x529ded[_0x5047('0x56')](_0x4968b5);}})[_0x5047('0x1f')](function(_0xf2f84b){if(_0xf2f84b){_0x38618f=_0xf2f84b[_0x5047('0x51')];if(!_0x51688e[_0x5047('0x2b')][_0x5047('0x2f')](_0x5047('0x30'))){_0x4968b5[_0x5047('0x18')]=qs['limit'](_0x51688e[_0x5047('0x2b')]['limit']);_0x4968b5[_0x5047('0x17')]=qs[_0x5047('0x17')](_0x51688e[_0x5047('0x2b')][_0x5047('0x17')]);}return _0x529ded[_0x5047('0x56')](_0x4968b5);}})['then'](function(_0x1985f5){if(_0x1985f5){return _0x1985f5?{'count':_0x38618f,'rows':_0x1985f5}:null;}})[_0x5047('0x1f')](respondWithResult(_0xe5f949,null))[_0x5047('0x3c')](handleError(_0xe5f949,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8909e16..0d3467e 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 _0xfd28=['rimraf','./trigger.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x489bf8,_0x1d3e63){var _0xca855b=function(_0x10b648){while(--_0x10b648){_0x489bf8['push'](_0x489bf8['shift']());}};_0xca855b(++_0x1d3e63);}(_0xfd28,0x148));var _0x8fd2=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0xfd28[_0x52c4e9];return _0x252a03;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf842=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x4f1708,_0x30a095){var _0x5ea27c=function(_0x425c08){while(--_0x425c08){_0x4f1708['push'](_0x4f1708['shift']());}};_0x5ea27c(++_0x30a095);}(_0xf842,0x172));var _0x2f84=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xf842[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var logger=require(_0x2f84('0x2'))(_0x2f84('0x3'));var moment=require('moment');var BPromise=require(_0x2f84('0x4'));var rp=require(_0x2f84('0x5'));var fs=require('fs');var path=require(_0x2f84('0x6'));var rimraf=require(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var attributes=require('./trigger.attributes');module[_0x2f84('0x9')]=function(_0x20e773,_0x88a4cb){return _0x20e773['define'](_0x2f84('0xa'),attributes,{'tableName':_0x2f84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 359035c..2d5aab0 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 _0x3be2=['info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','debug','ShowTrigger','find','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2fc0f9,_0x3b5bd6){var _0x286547=function(_0x510711){while(--_0x510711){_0x2fc0f9['push'](_0x2fc0f9['shift']());}};_0x286547(++_0x3b5bd6);}(_0x3be2,0x18d));var _0x23be=function(_0x1c422b,_0x5ba42e){_0x1c422b=_0x1c422b-0x0;var _0x40f82b=_0x3be2[_0x1c422b];return _0x40f82b;};'use strict';var _=require(_0x23be('0x0'));var util=require('util');var moment=require(_0x23be('0x1'));var BPromise=require(_0x23be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23be('0x3'));var db=require(_0x23be('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23be('0x5'));var config=require(_0x23be('0x6'));var jayson=require(_0x23be('0x7'));var client=jayson['client'][_0x23be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42a8b4,_0x20e70f,_0x4572c2){return new BPromise(function(_0x2a7347,_0x3163de){return client[_0x23be('0x9')](_0x42a8b4,_0x4572c2)[_0x23be('0xa')](function(_0x5cc3b0){logger[_0x23be('0xb')](_0x23be('0xc'),_0x20e70f,'request\x20sent');logger['debug'](_0x23be('0xd'),_0x20e70f,_0x23be('0xe'),JSON[_0x23be('0xf')](_0x5cc3b0));if(_0x5cc3b0[_0x23be('0x10')]){if(_0x5cc3b0[_0x23be('0x10')][_0x23be('0x11')]===0x1f4){logger[_0x23be('0x10')](_0x23be('0xc'),_0x20e70f,_0x5cc3b0[_0x23be('0x10')][_0x23be('0x12')]);return _0x3163de(_0x5cc3b0[_0x23be('0x10')][_0x23be('0x12')]);}logger[_0x23be('0x10')](_0x23be('0xc'),_0x20e70f,_0x5cc3b0[_0x23be('0x10')][_0x23be('0x12')]);return _0x2a7347(_0x5cc3b0[_0x23be('0x10')][_0x23be('0x12')]);}else{logger[_0x23be('0xb')](_0x23be('0xc'),_0x20e70f,'request\x20sent');_0x2a7347(_0x5cc3b0[_0x23be('0x13')][_0x23be('0x12')]);}})['catch'](function(_0x475c68){logger[_0x23be('0x10')](_0x23be('0xc'),_0x20e70f,_0x475c68);_0x3163de(_0x475c68);});});}exports[_0x23be('0x14')]=function(_0x1a0e2b){var _0x2dafea=this;return new Promise(function(_0x2ec2cd,_0x3260e4){return db[_0x23be('0x15')][_0x23be('0x16')]({'raw':_0x1a0e2b[_0x23be('0x17')]?_0x1a0e2b[_0x23be('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0e2b[_0x23be('0x17')]?_0x1a0e2b[_0x23be('0x17')][_0x23be('0x18')]||null:null,'attributes':_0x1a0e2b[_0x23be('0x17')]?_0x1a0e2b[_0x23be('0x17')][_0x23be('0x19')]||null:null,'limit':_0x1a0e2b['options']?_0x1a0e2b['options'][_0x23be('0x1a')]||null:null,'include':_0x1a0e2b[_0x23be('0x17')]?_0x1a0e2b[_0x23be('0x17')][_0x23be('0x1b')]?_[_0x23be('0x1c')](_0x1a0e2b[_0x23be('0x17')][_0x23be('0x1b')],function(_0x2fd7c7){return{'model':db[_0x2fd7c7[_0x23be('0x1d')]],'as':_0x2fd7c7['as'],'attributes':_0x2fd7c7['attributes'],'include':_0x2fd7c7['include']?_[_0x23be('0x1c')](_0x2fd7c7[_0x23be('0x1b')],function(_0x391c7b){return{'model':db[_0x391c7b[_0x23be('0x1d')]],'as':_0x391c7b['as'],'attributes':_0x391c7b[_0x23be('0x19')],'include':_0x391c7b[_0x23be('0x1b')]?_[_0x23be('0x1c')](_0x391c7b[_0x23be('0x1b')],function(_0x51acdf){return{'model':db[_0x51acdf[_0x23be('0x1d')]],'as':_0x51acdf['as'],'attributes':_0x51acdf[_0x23be('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23be('0xa')](function(_0x4d9d7b){logger[_0x23be('0xb')](_0x23be('0x14'),_0x1a0e2b);logger[_0x23be('0x1e')](_0x23be('0x14'),_0x1a0e2b,JSON['stringify'](_0x4d9d7b));_0x2ec2cd(_0x4d9d7b);})['catch'](function(_0x41a15f){logger[_0x23be('0x10')]('GetTrigger',_0x41a15f['message'],_0x1a0e2b);_0x3260e4(_0x2dafea[_0x23be('0x10')](0x1f4,_0x41a15f[_0x23be('0x12')]));});});};exports[_0x23be('0x1f')]=function(_0x4cb760){var _0xf4a80c=this;return new Promise(function(_0x20a483,_0x13fac4){return db['Trigger'][_0x23be('0x20')]({'raw':_0x4cb760[_0x23be('0x17')]?_0x4cb760[_0x23be('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4cb760[_0x23be('0x17')]?_0x4cb760[_0x23be('0x17')][_0x23be('0x18')]||null:null,'attributes':_0x4cb760[_0x23be('0x17')]?_0x4cb760[_0x23be('0x17')]['attributes']||null:null,'include':_0x4cb760[_0x23be('0x17')]?_0x4cb760[_0x23be('0x17')][_0x23be('0x1b')]?_['map'](_0x4cb760['options'][_0x23be('0x1b')],function(_0x430851){return{'model':db[_0x430851[_0x23be('0x1d')]],'as':_0x430851['as'],'attributes':_0x430851[_0x23be('0x19')],'include':_0x430851[_0x23be('0x1b')]?_[_0x23be('0x1c')](_0x430851[_0x23be('0x1b')],function(_0x39a936){return{'model':db[_0x39a936['model']],'as':_0x39a936['as'],'attributes':_0x39a936['attributes'],'include':_0x39a936['include']?_[_0x23be('0x1c')](_0x39a936['include'],function(_0x3760c8){return{'model':db[_0x3760c8[_0x23be('0x1d')]],'as':_0x3760c8['as'],'attributes':_0x3760c8[_0x23be('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23be('0xa')](function(_0x325082){logger['info'](_0x23be('0x1f'),_0x4cb760);logger[_0x23be('0x1e')]('ShowTrigger',_0x4cb760,JSON[_0x23be('0xf')](_0x325082));_0x20a483(_0x325082);})[_0x23be('0x21')](function(_0x24f949){logger[_0x23be('0x10')](_0x23be('0x1f'),_0x24f949['message'],_0x4cb760);_0x13fac4(_0xf4a80c[_0x23be('0x10')](0x1f4,_0x24f949['message']));});});}; \ No newline at end of file +var _0xe5eb=['info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','include','map','model','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3d035e,_0x104579){var _0x1dce02=function(_0x3f070f){while(--_0x3f070f){_0x3d035e['push'](_0x3d035e['shift']());}};_0x1dce02(++_0x104579);}(_0xe5eb,0xdf));var _0xbe5e=function(_0x588394,_0x18ac5b){_0x588394=_0x588394-0x0;var _0x3a9e01=_0xe5eb[_0x588394];return _0x3a9e01;};'use strict';var _=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var moment=require(_0xbe5e('0x2'));var BPromise=require(_0xbe5e('0x3'));var rs=require(_0xbe5e('0x4'));var fs=require('fs');var Redis=require(_0xbe5e('0x5'));var db=require(_0xbe5e('0x6'))['db'];var utils=require(_0xbe5e('0x7'));var logger=require(_0xbe5e('0x8'))('rpc');var config=require(_0xbe5e('0x9'));var jayson=require(_0xbe5e('0xa'));var client=jayson[_0xbe5e('0xb')][_0xbe5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4aab72,_0x42aa34,_0x4726ba){return new BPromise(function(_0x4a3045,_0x49c9bd){return client[_0xbe5e('0xd')](_0x4aab72,_0x4726ba)[_0xbe5e('0xe')](function(_0x579b95){logger[_0xbe5e('0xf')](_0xbe5e('0x10'),_0x42aa34,'request\x20sent');logger[_0xbe5e('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x42aa34,_0xbe5e('0x12'),JSON[_0xbe5e('0x13')](_0x579b95));if(_0x579b95[_0xbe5e('0x14')]){if(_0x579b95[_0xbe5e('0x14')]['code']===0x1f4){logger[_0xbe5e('0x14')](_0xbe5e('0x10'),_0x42aa34,_0x579b95[_0xbe5e('0x14')]['message']);return _0x49c9bd(_0x579b95[_0xbe5e('0x14')][_0xbe5e('0x15')]);}logger['error'](_0xbe5e('0x10'),_0x42aa34,_0x579b95[_0xbe5e('0x14')]['message']);return _0x4a3045(_0x579b95[_0xbe5e('0x14')]['message']);}else{logger[_0xbe5e('0xf')](_0xbe5e('0x10'),_0x42aa34,_0xbe5e('0x12'));_0x4a3045(_0x579b95[_0xbe5e('0x16')][_0xbe5e('0x15')]);}})[_0xbe5e('0x17')](function(_0x4f016b){logger[_0xbe5e('0x14')](_0xbe5e('0x10'),_0x42aa34,_0x4f016b);_0x49c9bd(_0x4f016b);});});}exports[_0xbe5e('0x18')]=function(_0xa32e2b){var _0x35a40d=this;return new Promise(function(_0x72b87e,_0xd1f310){return db['Trigger'][_0xbe5e('0x19')]({'raw':_0xa32e2b[_0xbe5e('0x1a')]?_0xa32e2b[_0xbe5e('0x1a')][_0xbe5e('0x1b')]===undefined?!![]:![]:!![],'where':_0xa32e2b[_0xbe5e('0x1a')]?_0xa32e2b[_0xbe5e('0x1a')][_0xbe5e('0x1c')]||null:null,'attributes':_0xa32e2b['options']?_0xa32e2b['options'][_0xbe5e('0x1d')]||null:null,'limit':_0xa32e2b[_0xbe5e('0x1a')]?_0xa32e2b['options']['limit']||null:null,'include':_0xa32e2b[_0xbe5e('0x1a')]?_0xa32e2b['options'][_0xbe5e('0x1e')]?_[_0xbe5e('0x1f')](_0xa32e2b[_0xbe5e('0x1a')][_0xbe5e('0x1e')],function(_0x4df1ce){return{'model':db[_0x4df1ce[_0xbe5e('0x20')]],'as':_0x4df1ce['as'],'attributes':_0x4df1ce['attributes'],'include':_0x4df1ce[_0xbe5e('0x1e')]?_['map'](_0x4df1ce[_0xbe5e('0x1e')],function(_0x2a3739){return{'model':db[_0x2a3739['model']],'as':_0x2a3739['as'],'attributes':_0x2a3739[_0xbe5e('0x1d')],'include':_0x2a3739[_0xbe5e('0x1e')]?_[_0xbe5e('0x1f')](_0x2a3739['include'],function(_0x3093c9){return{'model':db[_0x3093c9[_0xbe5e('0x20')]],'as':_0x3093c9['as'],'attributes':_0x3093c9[_0xbe5e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbe5e('0xe')](function(_0x5d0ce1){logger['info'](_0xbe5e('0x18'),_0xa32e2b);logger[_0xbe5e('0x11')](_0xbe5e('0x18'),_0xa32e2b,JSON[_0xbe5e('0x13')](_0x5d0ce1));_0x72b87e(_0x5d0ce1);})[_0xbe5e('0x17')](function(_0x184833){logger['error'](_0xbe5e('0x18'),_0x184833[_0xbe5e('0x15')],_0xa32e2b);_0xd1f310(_0x35a40d['error'](0x1f4,_0x184833[_0xbe5e('0x15')]));});});};exports[_0xbe5e('0x21')]=function(_0x52bbef){var _0x21f026=this;return new Promise(function(_0x3870cf,_0x2a0927){return db['Trigger']['find']({'raw':_0x52bbef[_0xbe5e('0x1a')]?_0x52bbef['options'][_0xbe5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x52bbef[_0xbe5e('0x1a')]?_0x52bbef[_0xbe5e('0x1a')][_0xbe5e('0x1c')]||null:null,'attributes':_0x52bbef[_0xbe5e('0x1a')]?_0x52bbef['options'][_0xbe5e('0x1d')]||null:null,'include':_0x52bbef[_0xbe5e('0x1a')]?_0x52bbef[_0xbe5e('0x1a')]['include']?_[_0xbe5e('0x1f')](_0x52bbef['options'][_0xbe5e('0x1e')],function(_0x377899){return{'model':db[_0x377899['model']],'as':_0x377899['as'],'attributes':_0x377899[_0xbe5e('0x1d')],'include':_0x377899['include']?_[_0xbe5e('0x1f')](_0x377899[_0xbe5e('0x1e')],function(_0x2a2a59){return{'model':db[_0x2a2a59[_0xbe5e('0x20')]],'as':_0x2a2a59['as'],'attributes':_0x2a2a59[_0xbe5e('0x1d')],'include':_0x2a2a59['include']?_['map'](_0x2a2a59[_0xbe5e('0x1e')],function(_0x50bdce){return{'model':db[_0x50bdce['model']],'as':_0x50bdce['as'],'attributes':_0x50bdce[_0xbe5e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbe5e('0xe')](function(_0x25658b){logger[_0xbe5e('0xf')](_0xbe5e('0x21'),_0x52bbef);logger[_0xbe5e('0x11')](_0xbe5e('0x21'),_0x52bbef,JSON['stringify'](_0x25658b));_0x3870cf(_0x25658b);})[_0xbe5e('0x17')](function(_0x3a54db){logger[_0xbe5e('0x14')]('ShowTrigger',_0x3a54db[_0xbe5e('0x15')],_0x52bbef);_0x2a0927(_0x21f026[_0xbe5e('0x14')](0x1f4,_0x3a54db[_0xbe5e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8f4fc8c..d49ca27 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 _0x56f0=['get','/:id','show','post','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x4836f2,_0x11690b){var _0x239df2=function(_0x209a3f){while(--_0x209a3f){_0x4836f2['push'](_0x4836f2['shift']());}};_0x239df2(++_0x11690b);}(_0x56f0,0xb2));var _0x056f=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x56f0[_0x183b97];return _0x629cf7;};'use strict';var multer=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var path=require(_0x056f('0x2'));var timeout=require('connect-timeout');var express=require(_0x056f('0x3'));var router=express[_0x056f('0x4')]();var fs_extra=require(_0x056f('0x5'));var auth=require(_0x056f('0x6'));var interaction=require(_0x056f('0x7'));var config=require(_0x056f('0x8'));var controller=require('./trunk.controller');router['get']('/',auth[_0x056f('0x9')](),controller[_0x056f('0xa')]);router[_0x056f('0xb')](_0x056f('0xc'),auth[_0x056f('0x9')](),controller[_0x056f('0xd')]);router[_0x056f('0xe')](_0x056f('0xf'),auth['isAuthenticated'](),controller[_0x056f('0x10')]);router[_0x056f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x056f('0x11')](_0x056f('0xc'),auth[_0x056f('0x9')](),controller['update']);router[_0x056f('0x12')](_0x056f('0xc'),auth[_0x056f('0x9')](),controller[_0x056f('0x13')]);module[_0x056f('0x14')]=router; \ No newline at end of file +var _0x45b9=['update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','show','/:id/clone','isAuthenticated','post','create','put','/:id'];(function(_0x3c3a21,_0x14b9b0){var _0x3fc757=function(_0x481f19){while(--_0x481f19){_0x3c3a21['push'](_0x3c3a21['shift']());}};_0x3fc757(++_0x14b9b0);}(_0x45b9,0x1a5));var _0x945b=function(_0x19c0ea,_0x19f687){_0x19c0ea=_0x19c0ea-0x0;var _0x3db00e=_0x45b9[_0x19c0ea];return _0x3db00e;};'use strict';var multer=require('multer');var util=require(_0x945b('0x0'));var path=require(_0x945b('0x1'));var timeout=require(_0x945b('0x2'));var express=require('express');var router=express[_0x945b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x945b('0x4'));var interaction=require(_0x945b('0x5'));var config=require(_0x945b('0x6'));var controller=require(_0x945b('0x7'));router[_0x945b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x945b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x945b('0x9')]);router['post'](_0x945b('0xa'),auth[_0x945b('0xb')](),controller['clone']);router[_0x945b('0xc')]('/',auth['isAuthenticated'](),controller[_0x945b('0xd')]);router[_0x945b('0xe')](_0x945b('0xf'),auth[_0x945b('0xb')](),controller[_0x945b('0x10')]);router['delete'](_0x945b('0xf'),auth[_0x945b('0xb')](),controller[_0x945b('0x11')]);module[_0x945b('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ea7c33c..c80c611 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 _0x8171=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow'];(function(_0x32ab87,_0x5803d0){var _0x5ae2b0=function(_0x3af5d3){while(--_0x3af5d3){_0x32ab87['push'](_0x32ab87['shift']());}};_0x5ae2b0(++_0x5803d0);}(_0x8171,0x152));var _0x1817=function(_0x31178e,_0x21647c){_0x31178e=_0x31178e-0x0;var _0x18b6b0=_0x8171[_0x31178e];return _0x18b6b0;};'use strict';var Sequelize=require(_0x1817('0x0'));module[_0x1817('0x1')]={'name':{'type':Sequelize[_0x1817('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x4'),'user',_0x1817('0x5')),'allowNull':![],'defaultValue':_0x1817('0x4')},'context':{'type':Sequelize[_0x1817('0x2')],'allowNull':![],'defaultValue':_0x1817('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x1817('0x7'),_0x1817('0x8'),'ALLOWED_FAILED_SCREEN',_0x1817('0x9'),_0x1817('0xa'),_0x1817('0xb'),_0x1817('0xc'),_0x1817('0xd'))},'deny':{'type':Sequelize[_0x1817('0x2')]},'permit':{'type':Sequelize[_0x1817('0x2')]},'secret':{'type':Sequelize[_0x1817('0x2')]},'md5secret':{'type':Sequelize[_0x1817('0x2')]},'remotesecret':{'type':Sequelize[_0x1817('0x2')]},'transport':{'type':Sequelize[_0x1817('0x2')],'defaultValue':'udp','set':function(_0x5b61bb){this[_0x1817('0xe')](_0x1817('0xf'),_0x5b61bb?_0x5b61bb[_0x1817('0x10')](','):null);},'get':function(){return this[_0x1817('0x11')](_0x1817('0xf'))?this[_0x1817('0x11')](_0x1817('0xf'))[_0x1817('0x12')](','):null;},'comment':_0x1817('0x13')},'dtmfmode':{'type':Sequelize[_0x1817('0x3')]('rfc2833',_0x1817('0x14'),'shortinfo','inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no',_0x1817('0x16'),_0x1817('0x17'),_0x1817('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1817('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x1817('0x2')],'defaultValue':_0x1817('0x19'),'set':function(_0x8db4eb){this[_0x1817('0xe')]('nat',_0x8db4eb?_0x8db4eb['join'](','):null);},'get':function(){return this['getDataValue'](_0x1817('0x1a'))?this[_0x1817('0x11')](_0x1817('0x1a'))[_0x1817('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1817('0x2')]},'namedcallgroup':{'type':Sequelize[_0x1817('0x2')]},'pickupgroup':{'type':Sequelize[_0x1817('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1817('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1817('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x1817('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1817('0x1c'),'set':function(_0x4c4a11){this['setDataValue']('allow',_0x4c4a11?_0x4c4a11[_0x1817('0x10')](';'):_0x1817('0x1c'));},'get':function(){return this['getDataValue'](_0x1817('0x1d'))?this[_0x1817('0x11')]('allow')['split'](';'):null;},'comment':_0x1817('0x1e')},'autoframing':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x476ca9){this[_0x1817('0xe')](_0x1817('0x1f'),_0x476ca9?_0x476ca9[_0x1817('0x10')](','):null);},'get':function(){return this[_0x1817('0x11')](_0x1817('0x1f'))?this[_0x1817('0x11')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no',_0x1817('0x20'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1817('0x15'),'no')},'accountcode':{'type':Sequelize[_0x1817('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1817('0x2')],'defaultValue':_0x1817('0x22')},'amaflags':{'type':Sequelize[_0x1817('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x1817('0x15'),'no'),'defaultValue':_0x1817('0x15')},'busylevel':{'type':Sequelize[_0x1817('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x1817('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1817('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x1817('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x1817('0x15'),'no',_0x1817('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1817('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'mailbox':{'type':Sequelize[_0x1817('0x2')]},'session_timers':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x24'),_0x1817('0x25'),'originate')},'session_expires':{'type':Sequelize[_0x1817('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x1817('0x21')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x1817('0x26'),_0x1817('0x27')),'defaultValue':_0x1817('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x1817('0x2')]},'regexten':{'type':Sequelize[_0x1817('0x2')]},'fromdomain':{'type':Sequelize[_0x1817('0x2')]},'fromuser':{'type':Sequelize[_0x1817('0x2')]},'port':{'type':Sequelize[_0x1817('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1817('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1817('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x1817('0x2')]},'defaultuser':{'type':Sequelize[_0x1817('0x2')]},'rtptimeout':{'type':Sequelize[_0x1817('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1817('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1817('0x2')]},'callbackextension':{'type':Sequelize[_0x1817('0x2')]},'timert1':{'type':Sequelize[_0x1817('0x21')](0xb)},'timerb':{'type':Sequelize[_0x1817('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1817('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x1817('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x1817('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'force_avp':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'icesupport':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no',_0x1817('0x28'),_0x1817('0x29'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x1817('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x1817('0x2')]},'dtlscipher':{'type':Sequelize[_0x1817('0x2')]},'dtlscafile':{'type':Sequelize[_0x1817('0x2')]},'dtlscapath':{'type':Sequelize[_0x1817('0x2')]},'dtlssetup':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x2a'),_0x1817('0x2b'),_0x1817('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1817('0x2')]},'usereqphone':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1817('0x2')]},'recordofffeature':{'type':Sequelize[_0x1817('0x2')]},'call_limit':{'type':Sequelize[_0x1817('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x1817('0x3')](_0x1817('0x15'),'no')},'vmexten':{'type':Sequelize[_0x1817('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1817('0x2')]},'parkinglot':{'type':Sequelize[_0x1817('0x2')]},'description':{'type':Sequelize[_0x1817('0x2')]},'host':{'type':Sequelize[_0x1817('0x2')],'defaultValue':_0x1817('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x1817('0x15'),'no',_0x1817('0x16'),_0x1817('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1817('0x2')]},'otherFields':{'type':Sequelize[_0x1817('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x7c28=['\x22\x22\x20<>','INTEGER','uac','uas','fingerprint','certificate','active','passive','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0x7c28,0x1d6));var _0x87c2=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7c28[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x87c2('0x0'));module[_0x87c2('0x1')]={'name':{'type':Sequelize[_0x87c2('0x2')],'allowNull':![],'unique':_0x87c2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x5'),'user',_0x87c2('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x87c2('0x2')],'allowNull':![],'defaultValue':_0x87c2('0x7')},'callingpres':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x8'),_0x87c2('0x9'),_0x87c2('0xa'),'ALLOWED','PROHIB_NOT_SCREENED',_0x87c2('0xb'),'PROHIB_FAILED_SCREEN',_0x87c2('0xc'))},'deny':{'type':Sequelize[_0x87c2('0x2')]},'permit':{'type':Sequelize[_0x87c2('0x2')]},'secret':{'type':Sequelize[_0x87c2('0x2')]},'md5secret':{'type':Sequelize[_0x87c2('0x2')]},'remotesecret':{'type':Sequelize[_0x87c2('0x2')]},'transport':{'type':Sequelize[_0x87c2('0x2')],'defaultValue':_0x87c2('0xd'),'set':function(_0x42c558){this[_0x87c2('0xe')](_0x87c2('0xf'),_0x42c558?_0x42c558[_0x87c2('0x10')](','):null);},'get':function(){return this[_0x87c2('0x11')](_0x87c2('0xf'))?this[_0x87c2('0x11')](_0x87c2('0xf'))['split'](','):null;},'comment':_0x87c2('0x12')},'dtmfmode':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x13'),'info','shortinfo',_0x87c2('0x14'),_0x87c2('0x15')),'defaultValue':_0x87c2('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no',_0x87c2('0x17'),_0x87c2('0x18'),_0x87c2('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x87c2('0x2')]},'nat':{'type':Sequelize[_0x87c2('0x2')],'defaultValue':_0x87c2('0x1a'),'set':function(_0x14501e){this[_0x87c2('0xe')](_0x87c2('0x1b'),_0x14501e?_0x14501e['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0x87c2('0x1b'))[_0x87c2('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x87c2('0x2')]},'namedcallgroup':{'type':Sequelize[_0x87c2('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x87c2('0x2')]},'language':{'type':Sequelize[_0x87c2('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x87c2('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x87c2('0x2')],'defaultValue':_0x87c2('0x1d')},'allow':{'type':Sequelize[_0x87c2('0x2')],'allowNull':![],'defaultValue':_0x87c2('0x1e'),'set':function(_0x9163e){this[_0x87c2('0xe')](_0x87c2('0x1f'),_0x9163e?_0x9163e[_0x87c2('0x10')](';'):_0x87c2('0x1e'));},'get':function(){return this[_0x87c2('0x11')](_0x87c2('0x1f'))?this[_0x87c2('0x11')](_0x87c2('0x1f'))[_0x87c2('0x1c')](';'):null;},'comment':_0x87c2('0x20')},'autoframing':{'type':Sequelize[_0x87c2('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x87c2('0x21'),'set':function(_0x1dc3ba){this[_0x87c2('0xe')]('insecure',_0x1dc3ba?_0x1dc3ba[_0x87c2('0x10')](','):null);},'get':function(){return this[_0x87c2('0x11')](_0x87c2('0x22'))?this['getDataValue'](_0x87c2('0x22'))[_0x87c2('0x1c')](','):null;},'comment':_0x87c2('0x23')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x87c2('0x24')},'amaflags':{'type':Sequelize[_0x87c2('0x2')]},'callcounter':{'type':Sequelize[_0x87c2('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x87c2('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x87c2('0x2')]},'template':{'type':Sequelize[_0x87c2('0x2')]},'videosupport':{'type':Sequelize[_0x87c2('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no')},'mailbox':{'type':Sequelize[_0x87c2('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x87c2('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x87c2('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x26'),_0x87c2('0x27')),'defaultValue':_0x87c2('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x87c2('0x2')]},'regexten':{'type':Sequelize[_0x87c2('0x2')]},'fromdomain':{'type':Sequelize[_0x87c2('0x2')]},'fromuser':{'type':Sequelize[_0x87c2('0x2')]},'port':{'type':Sequelize[_0x87c2('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x87c2('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x87c2('0x2')]},'defaultuser':{'type':Sequelize[_0x87c2('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x87c2('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x87c2('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x87c2('0x2')]},'callbackextension':{'type':Sequelize[_0x87c2('0x2')]},'timert1':{'type':Sequelize[_0x87c2('0x25')](0xb)},'timerb':{'type':Sequelize[_0x87c2('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x87c2('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x87c2('0x2')]},'use_q850_reason':{'type':Sequelize[_0x87c2('0x2')]},'maxforwards':{'type':Sequelize[_0x87c2('0x25')](0xb)},'encryption':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x87c2('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x87c2('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x87c2('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x87c2('0x4')]('yes','no',_0x87c2('0x28'),_0x87c2('0x29'))},'dtlsrekey':{'type':Sequelize[_0x87c2('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x87c2('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x87c2('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x87c2('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x2a'),_0x87c2('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x87c2('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x87c2('0x16'),'no')},'vmexten':{'type':Sequelize[_0x87c2('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x87c2('0x2')]},'parkinglot':{'type':Sequelize[_0x87c2('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x87c2('0x2c')},'canreinvite':{'type':Sequelize[_0x87c2('0x4')](_0x87c2('0x16'),'no',_0x87c2('0x17'),_0x87c2('0x18'),_0x87c2('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x87c2('0x2')]},'otherFields':{'type':Sequelize[_0x87c2('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x87c2('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 7da6960..6e885a3 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x514c7a,_0x1ff642){var _0x343814=function(_0x437f1e){while(--_0x437f1e){_0x514c7a['push'](_0x514c7a['shift']());}};_0x343814(++_0x1ff642);}(_0x24ca,0x1bc));var _0xa24c=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x24ca[_0xa79977];return _0x109f10;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1eca06,_0x2eebe7){_0x1eca06=_0x1eca06-0x0;var _0x2b95d6=_0xe5b3[_0x1eca06];return _0x2b95d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5cd1a88..e5ce4b7 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 _0xd144=['bluebird','request-promise','path','rimraf','./trunk.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0xd144,0xf9));var _0x4d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd144[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d14('0x0'));var util=require(_0x4d14('0x1'));var logger=require(_0x4d14('0x2'))(_0x4d14('0x3'));var moment=require('moment');var BPromise=require(_0x4d14('0x4'));var rp=require(_0x4d14('0x5'));var fs=require('fs');var path=require(_0x4d14('0x6'));var rimraf=require(_0x4d14('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d14('0x8'));module[_0x4d14('0x9')]=function(_0x1136ed,_0x5cde3c){return _0x1136ed[_0x4d14('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeed=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api','request-promise'];(function(_0x23f064,_0x3279b8){var _0xba28ba=function(_0x154ace){while(--_0x154ace){_0x23f064['push'](_0x23f064['shift']());}};_0xba28ba(++_0x3279b8);}(_0xaeed,0x7d));var _0xdaee=function(_0x1326be,_0x38a92b){_0x1326be=_0x1326be-0x0;var _0x2bba0e=_0xaeed[_0x1326be];return _0x2bba0e;};'use strict';var _=require(_0xdaee('0x0'));var util=require(_0xdaee('0x1'));var logger=require(_0xdaee('0x2'))(_0xdaee('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdaee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdaee('0x5'));var attributes=require(_0xdaee('0x6'));module[_0xdaee('0x7')]=function(_0x31c929,_0x46b542){return _0x31c929[_0xdaee('0x8')]('Trunk',attributes,{'tableName':_0xdaee('0x9'),'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 2c8f3f5..fd3a460 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 _0xbe95=['util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','Trunk','options','raw','attributes','limit','map','include','model','then','GetTrunk','debug','ShowTrunk','where','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe95,0x10d));var _0x5be9=function(_0x438a35,_0x973546){_0x438a35=_0x438a35-0x0;var _0x28ebd8=_0xbe95[_0x438a35];return _0x28ebd8;};'use strict';var _=require(_0x5be9('0x0'));var util=require(_0x5be9('0x1'));var moment=require(_0x5be9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5be9('0x3'));var fs=require('fs');var Redis=require(_0x5be9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5be9('0x5'));var config=require(_0x5be9('0x6'));var jayson=require(_0x5be9('0x7'));var client=jayson['client'][_0x5be9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ed990,_0x4ff3fb,_0x2db54c){return new BPromise(function(_0x499bf8,_0x303990){return client['request'](_0x1ed990,_0x2db54c)['then'](function(_0xbddb22){logger['info']('Trunk,\x20%s,\x20%s',_0x4ff3fb,_0x5be9('0x9'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x4ff3fb,_0x5be9('0x9'),JSON[_0x5be9('0xa')](_0xbddb22));if(_0xbddb22[_0x5be9('0xb')]){if(_0xbddb22[_0x5be9('0xb')][_0x5be9('0xc')]===0x1f4){logger['error'](_0x5be9('0xd'),_0x4ff3fb,_0xbddb22[_0x5be9('0xb')][_0x5be9('0xe')]);return _0x303990(_0xbddb22[_0x5be9('0xb')][_0x5be9('0xe')]);}logger['error'](_0x5be9('0xd'),_0x4ff3fb,_0xbddb22[_0x5be9('0xb')][_0x5be9('0xe')]);return _0x499bf8(_0xbddb22[_0x5be9('0xb')][_0x5be9('0xe')]);}else{logger[_0x5be9('0xf')](_0x5be9('0xd'),_0x4ff3fb,'request\x20sent');_0x499bf8(_0xbddb22['result'][_0x5be9('0xe')]);}})['catch'](function(_0x2d69ff){logger[_0x5be9('0xb')](_0x5be9('0xd'),_0x4ff3fb,_0x2d69ff);_0x303990(_0x2d69ff);});});}exports['GetTrunk']=function(_0x16d548){var _0x281dd4=this;return new Promise(function(_0x1cf486,_0x12d888){return db[_0x5be9('0x10')]['findAll']({'raw':_0x16d548[_0x5be9('0x11')]?_0x16d548[_0x5be9('0x11')][_0x5be9('0x12')]===undefined?!![]:![]:!![],'where':_0x16d548[_0x5be9('0x11')]?_0x16d548[_0x5be9('0x11')]['where']||null:null,'attributes':_0x16d548[_0x5be9('0x11')]?_0x16d548[_0x5be9('0x11')][_0x5be9('0x13')]||null:null,'limit':_0x16d548[_0x5be9('0x11')]?_0x16d548['options'][_0x5be9('0x14')]||null:null,'include':_0x16d548[_0x5be9('0x11')]?_0x16d548[_0x5be9('0x11')]['include']?_[_0x5be9('0x15')](_0x16d548[_0x5be9('0x11')]['include'],function(_0x3be7c5){return{'model':db[_0x3be7c5['model']],'as':_0x3be7c5['as'],'attributes':_0x3be7c5[_0x5be9('0x13')],'include':_0x3be7c5[_0x5be9('0x16')]?_[_0x5be9('0x15')](_0x3be7c5['include'],function(_0x573e50){return{'model':db[_0x573e50[_0x5be9('0x17')]],'as':_0x573e50['as'],'attributes':_0x573e50[_0x5be9('0x13')],'include':_0x573e50[_0x5be9('0x16')]?_[_0x5be9('0x15')](_0x573e50[_0x5be9('0x16')],function(_0x4e8b6b){return{'model':db[_0x4e8b6b['model']],'as':_0x4e8b6b['as'],'attributes':_0x4e8b6b[_0x5be9('0x13')]};}):[]};}):[]};}):[]:[]})[_0x5be9('0x18')](function(_0x4c03b9){logger[_0x5be9('0xf')](_0x5be9('0x19'),_0x16d548);logger[_0x5be9('0x1a')](_0x5be9('0x19'),_0x16d548,JSON[_0x5be9('0xa')](_0x4c03b9));_0x1cf486(_0x4c03b9);})['catch'](function(_0x4376e8){logger['error'](_0x5be9('0x19'),_0x4376e8[_0x5be9('0xe')],_0x16d548);_0x12d888(_0x281dd4[_0x5be9('0xb')](0x1f4,_0x4376e8['message']));});});};exports[_0x5be9('0x1b')]=function(_0x33893f){var _0x3aa0bb=this;return new Promise(function(_0x2a8673,_0x2f27b7){return db[_0x5be9('0x10')]['find']({'raw':_0x33893f['options']?_0x33893f['options'][_0x5be9('0x12')]===undefined?!![]:![]:!![],'where':_0x33893f['options']?_0x33893f[_0x5be9('0x11')][_0x5be9('0x1c')]||null:null,'attributes':_0x33893f[_0x5be9('0x11')]?_0x33893f[_0x5be9('0x11')][_0x5be9('0x13')]||null:null,'include':_0x33893f[_0x5be9('0x11')]?_0x33893f[_0x5be9('0x11')]['include']?_[_0x5be9('0x15')](_0x33893f[_0x5be9('0x11')][_0x5be9('0x16')],function(_0x3516c3){return{'model':db[_0x3516c3[_0x5be9('0x17')]],'as':_0x3516c3['as'],'attributes':_0x3516c3[_0x5be9('0x13')],'include':_0x3516c3[_0x5be9('0x16')]?_['map'](_0x3516c3[_0x5be9('0x16')],function(_0x15a166){return{'model':db[_0x15a166[_0x5be9('0x17')]],'as':_0x15a166['as'],'attributes':_0x15a166[_0x5be9('0x13')],'include':_0x15a166[_0x5be9('0x16')]?_['map'](_0x15a166[_0x5be9('0x16')],function(_0x3431dc){return{'model':db[_0x3431dc[_0x5be9('0x17')]],'as':_0x3431dc['as'],'attributes':_0x3431dc[_0x5be9('0x13')]};}):[]};}):[]};}):[]:[]})[_0x5be9('0x18')](function(_0x367e91){logger['info'](_0x5be9('0x1b'),_0x33893f);logger[_0x5be9('0x1a')](_0x5be9('0x1b'),_0x33893f,JSON[_0x5be9('0xa')](_0x367e91));_0x2a8673(_0x367e91);})[_0x5be9('0x1d')](function(_0x9ffe5f){logger[_0x5be9('0xb')](_0x5be9('0x1b'),_0x9ffe5f[_0x5be9('0xe')],_0x33893f);_0x2f27b7(_0x3aa0bb[_0x5be9('0xb')](0x1f4,_0x9ffe5f[_0x5be9('0xe')]));});});}; \ No newline at end of file +var _0x593b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','info','result','catch','Trunk','options','raw','where','attributes','include','model','map','GetTrunk','ShowTrunk','find','then'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0x593b,0x1ea));var _0xb593=function(_0x2782b8,_0x5b08d8){_0x2782b8=_0x2782b8-0x0;var _0x52dde9=_0x593b[_0x2782b8];return _0x52dde9;};'use strict';var _=require(_0xb593('0x0'));var util=require(_0xb593('0x1'));var moment=require('moment');var BPromise=require(_0xb593('0x2'));var rs=require(_0xb593('0x3'));var fs=require('fs');var Redis=require(_0xb593('0x4'));var db=require(_0xb593('0x5'))['db'];var utils=require(_0xb593('0x6'));var logger=require(_0xb593('0x7'))(_0xb593('0x8'));var config=require(_0xb593('0x9'));var jayson=require(_0xb593('0xa'));var client=jayson['client'][_0xb593('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324eff,_0x314185,_0x5d8357){return new BPromise(function(_0x8c5d,_0xf9f6da){return client[_0xb593('0xc')](_0x324eff,_0x5d8357)['then'](function(_0x58f1a2){logger['info']('Trunk,\x20%s,\x20%s',_0x314185,'request\x20sent');logger[_0xb593('0xd')](_0xb593('0xe'),_0x314185,_0xb593('0xf'),JSON[_0xb593('0x10')](_0x58f1a2));if(_0x58f1a2['error']){if(_0x58f1a2[_0xb593('0x11')]['code']===0x1f4){logger[_0xb593('0x11')](_0xb593('0x12'),_0x314185,_0x58f1a2[_0xb593('0x11')][_0xb593('0x13')]);return _0xf9f6da(_0x58f1a2[_0xb593('0x11')][_0xb593('0x13')]);}logger[_0xb593('0x11')](_0xb593('0x12'),_0x314185,_0x58f1a2[_0xb593('0x11')]['message']);return _0x8c5d(_0x58f1a2[_0xb593('0x11')]['message']);}else{logger[_0xb593('0x14')](_0xb593('0x12'),_0x314185,_0xb593('0xf'));_0x8c5d(_0x58f1a2[_0xb593('0x15')][_0xb593('0x13')]);}})[_0xb593('0x16')](function(_0x5e3534){logger[_0xb593('0x11')](_0xb593('0x12'),_0x314185,_0x5e3534);_0xf9f6da(_0x5e3534);});});}exports['GetTrunk']=function(_0x424b73){var _0x5d9d04=this;return new Promise(function(_0x1c3006,_0x2b6790){return db[_0xb593('0x17')]['findAll']({'raw':_0x424b73[_0xb593('0x18')]?_0x424b73[_0xb593('0x18')][_0xb593('0x19')]===undefined?!![]:![]:!![],'where':_0x424b73[_0xb593('0x18')]?_0x424b73['options'][_0xb593('0x1a')]||null:null,'attributes':_0x424b73[_0xb593('0x18')]?_0x424b73[_0xb593('0x18')][_0xb593('0x1b')]||null:null,'limit':_0x424b73[_0xb593('0x18')]?_0x424b73[_0xb593('0x18')]['limit']||null:null,'include':_0x424b73[_0xb593('0x18')]?_0x424b73[_0xb593('0x18')]['include']?_['map'](_0x424b73[_0xb593('0x18')][_0xb593('0x1c')],function(_0x250191){return{'model':db[_0x250191[_0xb593('0x1d')]],'as':_0x250191['as'],'attributes':_0x250191[_0xb593('0x1b')],'include':_0x250191[_0xb593('0x1c')]?_[_0xb593('0x1e')](_0x250191[_0xb593('0x1c')],function(_0x178107){return{'model':db[_0x178107[_0xb593('0x1d')]],'as':_0x178107['as'],'attributes':_0x178107[_0xb593('0x1b')],'include':_0x178107[_0xb593('0x1c')]?_[_0xb593('0x1e')](_0x178107[_0xb593('0x1c')],function(_0x1b3e44){return{'model':db[_0x1b3e44[_0xb593('0x1d')]],'as':_0x1b3e44['as'],'attributes':_0x1b3e44[_0xb593('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d4a42){logger[_0xb593('0x14')](_0xb593('0x1f'),_0x424b73);logger[_0xb593('0xd')]('GetTrunk',_0x424b73,JSON[_0xb593('0x10')](_0x3d4a42));_0x1c3006(_0x3d4a42);})['catch'](function(_0x47c631){logger[_0xb593('0x11')]('GetTrunk',_0x47c631[_0xb593('0x13')],_0x424b73);_0x2b6790(_0x5d9d04['error'](0x1f4,_0x47c631[_0xb593('0x13')]));});});};exports[_0xb593('0x20')]=function(_0x2b229d){var _0x54b4f5=this;return new Promise(function(_0x12741f,_0x39269d){return db[_0xb593('0x17')][_0xb593('0x21')]({'raw':_0x2b229d[_0xb593('0x18')]?_0x2b229d[_0xb593('0x18')][_0xb593('0x19')]===undefined?!![]:![]:!![],'where':_0x2b229d[_0xb593('0x18')]?_0x2b229d[_0xb593('0x18')][_0xb593('0x1a')]||null:null,'attributes':_0x2b229d['options']?_0x2b229d['options'][_0xb593('0x1b')]||null:null,'include':_0x2b229d[_0xb593('0x18')]?_0x2b229d[_0xb593('0x18')]['include']?_[_0xb593('0x1e')](_0x2b229d[_0xb593('0x18')]['include'],function(_0x238cd9){return{'model':db[_0x238cd9[_0xb593('0x1d')]],'as':_0x238cd9['as'],'attributes':_0x238cd9[_0xb593('0x1b')],'include':_0x238cd9[_0xb593('0x1c')]?_[_0xb593('0x1e')](_0x238cd9[_0xb593('0x1c')],function(_0x33aec0){return{'model':db[_0x33aec0[_0xb593('0x1d')]],'as':_0x33aec0['as'],'attributes':_0x33aec0[_0xb593('0x1b')],'include':_0x33aec0[_0xb593('0x1c')]?_[_0xb593('0x1e')](_0x33aec0[_0xb593('0x1c')],function(_0x2c983b){return{'model':db[_0x2c983b[_0xb593('0x1d')]],'as':_0x2c983b['as'],'attributes':_0x2c983b[_0xb593('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb593('0x22')](function(_0x30a323){logger['info'](_0xb593('0x20'),_0x2b229d);logger[_0xb593('0xd')]('ShowTrunk',_0x2b229d,JSON[_0xb593('0x10')](_0x30a323));_0x12741f(_0x30a323);})[_0xb593('0x16')](function(_0x2d7255){logger[_0xb593('0x11')](_0xb593('0x20'),_0x2d7255['message'],_0x2b229d);_0x39269d(_0x54b4f5[_0xb593('0x11')](0x1f4,_0x2d7255[_0xb593('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 670b6ee..166dd49 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 _0xb78c=['/:id','isAuthenticated','update','express','../../components/auth/service','put'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xb78c,0xf3));var _0xcb78=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xb78c[_0x4314d7];return _0x5c599b;};'use strict';var express=require(_0xcb78('0x0'));var router=express['Router']();var auth=require(_0xcb78('0x1'));var controller=require('./user-setting.controller');router[_0xcb78('0x2')](_0xcb78('0x3'),auth[_0xcb78('0x4')](),controller[_0xcb78('0x5')]);module['exports']=router; \ No newline at end of file +var _0xc13e=['exports','express','Router','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc13e,0xb1));var _0xec13=function(_0x50ec75,_0x114225){_0x50ec75=_0x50ec75-0x0;var _0xb387c9=_0xc13e[_0x50ec75];return _0xb387c9;};'use strict';var express=require(_0xec13('0x0'));var router=express[_0xec13('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xec13('0x2'));router[_0xec13('0x3')](_0xec13('0x4'),auth[_0xec13('0x5')](),controller[_0xec13('0x6')]);module[_0xec13('0x7')]=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 b8dea47..cb51032 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 _0x61d6=['exports','ENUM','BOOLEAN','TEXT','DATE','UserId','error','warning','info','debug'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x61d6,0xb0));var _0x661d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x61d6[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x661d('0x0'),_0x661d('0x1'),_0x661d('0x2'),_0x661d('0x3')];module[_0x661d('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x661d('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x661d('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x661d('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x661d('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x661d('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x661d('0x9')}}; \ No newline at end of file +var _0xf270=['warning','info','debug','exports','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x2c1dca,_0x499bf2){var _0x47191c=function(_0x31aafb){while(--_0x31aafb){_0x2c1dca['push'](_0x2c1dca['shift']());}};_0x47191c(++_0x499bf2);}(_0xf270,0x148));var _0x0f27=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0xf270[_0xd93b26];return _0x25f668;};'use strict';var Sequelize=require(_0x0f27('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0f27('0x1'),_0x0f27('0x2'),_0x0f27('0x3'),_0x0f27('0x4')];module[_0x0f27('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0f27('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x0f27('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0f27('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0f27('0x9')],'unique':_0x0f27('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 56c9a5e..10f5c8c 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 _0x1da1=['find','params','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','register','defaults','localhost','status','then','sendStatus','error','name','send','update','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id'];(function(_0x1f7a82,_0x3ffb61){var _0x5493a8=function(_0x3c6903){while(--_0x3c6903){_0x1f7a82['push'](_0x1f7a82['shift']());}};_0x5493a8(++_0x3ffb61);}(_0x1da1,0x1a4));var _0x11da=function(_0x1447da,_0x50df1e){_0x1447da=_0x1447da-0x0;var _0x4d74b2=_0x1da1[_0x1447da];return _0x4d74b2;};'use strict';var _=require(_0x11da('0x0'));var Redis=require(_0x11da('0x1'));var logger=require(_0x11da('0x2'))(_0x11da('0x3'));var config=require(_0x11da('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x11da('0x5')]));require(_0x11da('0x6'))[_0x11da('0x7')](socket);config['redis']=_[_0x11da('0x8')](config[_0x11da('0x5')],{'host':_0x11da('0x9'),'port':0x18eb});function respondWithResult(_0x5ecc27,_0x5e7d63){_0x5e7d63=_0x5e7d63||0xc8;return function(_0x287653){if(_0x287653){return _0x5ecc27[_0x11da('0xa')](_0x5e7d63)['json'](_0x287653);}};}function saveUpdates(_0x45d92b){return function(_0x319fdc){if(_0x319fdc){return _0x319fdc['update'](_0x45d92b)[_0x11da('0xb')](function(_0xd8df99){return _0xd8df99;});}return null;};}function handleEntityNotFound(_0x3768d7){return function(_0x2848d3){if(!_0x2848d3){_0x3768d7[_0x11da('0xc')](0x194);}return _0x2848d3;};}function handleError(_0x37e537,_0x247c60){_0x247c60=_0x247c60||0x1f4;return function(_0x392c37){logger[_0x11da('0xd')](_0x392c37['stack']);if(_0x392c37[_0x11da('0xe')]){delete _0x392c37[_0x11da('0xe')];}_0x37e537[_0x11da('0xa')](_0x247c60)[_0x11da('0xf')](_0x392c37);};}exports[_0x11da('0x10')]=function(_0x51875e,_0x12311c){if(_0x51875e[_0x11da('0x11')][_0x11da('0x12')]!==_0x11da('0x13'))throw new Error(_0x11da('0x14'));if(isNaN(Number(_0x51875e['params']['id'])))throw new Error(_0x11da('0x15'));return db['UserSetting'][_0x11da('0x16')]({'where':{'id':_0x51875e[_0x11da('0x17')]['id']}})[_0x11da('0xb')](handleEntityNotFound(_0x12311c,null))[_0x11da('0xb')](saveUpdates(_0x51875e[_0x11da('0x18')],null))[_0x11da('0xb')](respondWithResult(_0x12311c,null))[_0x11da('0x19')](handleError(_0x12311c,null));}; \ No newline at end of file +var _0x8743=['../../config/environment','../../mysqldb','./user-setting.socket','register','redis','localhost','status','json','then','error','stack','name','send','update','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8743,0x7a));var _0x3874=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x8743[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x3874('0x0'));var Redis=require(_0x3874('0x1'));var logger=require(_0x3874('0x2'))('api');var config=require(_0x3874('0x3'));var db=require(_0x3874('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3874('0x5'))[_0x3874('0x6')](socket);config[_0x3874('0x7')]=_['defaults'](config['redis'],{'host':_0x3874('0x8'),'port':0x18eb});function respondWithResult(_0x8f890a,_0x5977b8){_0x5977b8=_0x5977b8||0xc8;return function(_0x2dee29){if(_0x2dee29){return _0x8f890a[_0x3874('0x9')](_0x5977b8)[_0x3874('0xa')](_0x2dee29);}};}function saveUpdates(_0x565165){return function(_0x515e8c){if(_0x515e8c){return _0x515e8c['update'](_0x565165)[_0x3874('0xb')](function(_0x5294db){return _0x5294db;});}return null;};}function handleEntityNotFound(_0x429e57){return function(_0x1ae2e1){if(!_0x1ae2e1){_0x429e57['sendStatus'](0x194);}return _0x1ae2e1;};}function handleError(_0x5017c2,_0xe3c437){_0xe3c437=_0xe3c437||0x1f4;return function(_0x10c935){logger[_0x3874('0xc')](_0x10c935[_0x3874('0xd')]);if(_0x10c935[_0x3874('0xe')]){delete _0x10c935[_0x3874('0xe')];}_0x5017c2['status'](_0xe3c437)[_0x3874('0xf')](_0x10c935);};}exports[_0x3874('0x10')]=function(_0x34e2b1,_0x260f1e){if(_0x34e2b1[_0x3874('0x11')][_0x3874('0x12')]!=='admin')throw new Error(_0x3874('0x13'));if(isNaN(Number(_0x34e2b1[_0x3874('0x14')]['id'])))throw new Error(_0x3874('0x15'));return db[_0x3874('0x16')][_0x3874('0x17')]({'where':{'id':_0x34e2b1['params']['id']}})[_0x3874('0xb')](handleEntityNotFound(_0x260f1e,null))[_0x3874('0xb')](saveUpdates(_0x34e2b1['body'],null))[_0x3874('0xb')](respondWithResult(_0x260f1e,null))[_0x3874('0x18')](handleError(_0x260f1e,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 73d7237..9575186 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 _0x210b=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0xe9023c,_0x29aaac){var _0x2b2a85=function(_0x439f8c){while(--_0x439f8c){_0xe9023c['push'](_0xe9023c['shift']());}};_0x2b2a85(++_0x29aaac);}(_0x210b,0x16f));var _0xb210=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x210b[_0xfcbcb8];return _0x1b1f97;};'use strict';var EventEmitter=require(_0xb210('0x0'));var UserSetting=require(_0xb210('0x1'))['db'][_0xb210('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb210('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb210('0x4'),'afterDestroy':_0xb210('0x5')};function emitEvent(_0x400b64){return function(_0xb8e08a,_0x446150,_0x1ab3af){UserSettingEvents[_0xb210('0x6')](_0x400b64+':'+_0xb8e08a['id'],_0xb8e08a);UserSettingEvents['emit'](_0x400b64,_0xb8e08a);_0x1ab3af(null);};}for(var e in events){if(events[_0xb210('0x7')](e)){var event=events[e];UserSetting[_0xb210('0x8')](e,emitEvent(event));}}module[_0xb210('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xb3eb=['setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xb3eb,0xbd));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbb3e('0x0'));var UserSetting=require(_0xbb3e('0x1'))['db'][_0xbb3e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbb3e('0x3')](0x0);var events={'afterCreate':_0xbb3e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x187422){return function(_0x1e11de,_0x1e1fdd,_0x4086b0){UserSettingEvents[_0xbb3e('0x5')](_0x187422+':'+_0x1e11de['id'],_0x1e11de);UserSettingEvents[_0xbb3e('0x5')](_0x187422,_0x1e11de);_0x4086b0(null);};}for(var e in events){if(events[_0xbb3e('0x6')](e)){var event=events[e];UserSetting[_0xbb3e('0x7')](e,emitEvent(event));}}module['exports']=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 039e160..e1889af 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 _0x9d02=['./user-setting.attributes','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d02,0x118));var _0x29d0=function(_0x277393,_0x6a2ded){_0x277393=_0x277393-0x0;var _0x278d50=_0x9d02[_0x277393];return _0x278d50;};'use strict';var attributes=require(_0x29d0('0x0'));module['exports']=function(_0x38b711){return _0x38b711['define'](_0x29d0('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10d9e4){if(!_0x10d9e4[_0x29d0('0x2')])_0x10d9e4['clientSideLoggingEnabledSince']=null;else if(_0x10d9e4[_0x29d0('0x3')]===null)_0x10d9e4[_0x29d0('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x063c=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x063c,0xba));var _0xc063=function(_0x267a39,_0x21a87d){_0x267a39=_0x267a39-0x0;var _0x2ee1d9=_0x063c[_0x267a39];return _0x2ee1d9;};'use strict';var attributes=require('./user-setting.attributes');module[_0xc063('0x0')]=function(_0x3e8b5f){return _0x3e8b5f[_0xc063('0x1')](_0xc063('0x2'),attributes,{'tableName':_0xc063('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33d075){if(!_0x33d075['clientSideLoggingEnabled'])_0x33d075[_0xc063('0x4')]=null;else if(_0x33d075['clientSideLoggingEnabledSince']===null)_0x33d075['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index dbca5f1..222bc78 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 _0x6e8d=['update','emit','user-setting:update','UserId','register','length','./user-setting.events','remove'];(function(_0x53f91c,_0x1a1c0f){var _0x2ff093=function(_0x407014){while(--_0x407014){_0x53f91c['push'](_0x53f91c['shift']());}};_0x2ff093(++_0x1a1c0f);}(_0x6e8d,0x19e));var _0xd6e8=function(_0x3c0388,_0x4c3569){_0x3c0388=_0x3c0388-0x0;var _0x388fac=_0x6e8d[_0x3c0388];return _0x388fac;};'use strict';var UserSettingEvents=require(_0xd6e8('0x0'));var events=['save',_0xd6e8('0x1'),_0xd6e8('0x2')];function createListener(_0x529fb1,_0x8b4fa0){return function(_0x1fe6d9){_0x8b4fa0[_0xd6e8('0x3')](_0x529fb1,_0x1fe6d9);if(_0x529fb1===_0xd6e8('0x4')){_0x8b4fa0[_0xd6e8('0x3')]('user-setting:update:user-'+_0x1fe6d9[_0xd6e8('0x5')],_0x1fe6d9);}};}exports[_0xd6e8('0x6')]=function(_0xf810e3){for(var _0x28d1de=0x0,_0x2af113=events[_0xd6e8('0x7')];_0x28d1de<_0x2af113;_0x28d1de++){var _0x46bf28=events[_0x28d1de];var _0x1cc32d=createListener('user-setting:'+_0x46bf28,_0xf810e3);UserSettingEvents['on'](_0x46bf28,_0x1cc32d);}}; \ No newline at end of file +var _0xbeb5=['UserId','register','length','user-setting:','save','remove','update','user-setting:update:user-'];(function(_0x2537e0,_0x3777d9){var _0x33ecdb=function(_0xbf5126){while(--_0xbf5126){_0x2537e0['push'](_0x2537e0['shift']());}};_0x33ecdb(++_0x3777d9);}(_0xbeb5,0x14c));var _0x5beb=function(_0x1cbba0,_0x280bdb){_0x1cbba0=_0x1cbba0-0x0;var _0x1a68e5=_0xbeb5[_0x1cbba0];return _0x1a68e5;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5beb('0x0'),_0x5beb('0x1'),_0x5beb('0x2')];function createListener(_0x1ef31b,_0xfaa995){return function(_0x5874f0){_0xfaa995['emit'](_0x1ef31b,_0x5874f0);if(_0x1ef31b==='user-setting:update'){_0xfaa995['emit'](_0x5beb('0x3')+_0x5874f0[_0x5beb('0x4')],_0x5874f0);}};}exports[_0x5beb('0x5')]=function(_0x4ec2a8){for(var _0x46385a=0x0,_0x465085=events[_0x5beb('0x6')];_0x46385a<_0x465085;_0x46385a++){var _0x4acacf=events[_0x46385a];var _0x3cb79f=createListener(_0x5beb('0x7')+_0x4acacf,_0x4ec2a8);UserSettingEvents['on'](_0x4acacf,_0x3cb79f);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7901b76..d5faa1b 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 _0x37de=['removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts'];(function(_0x346f68,_0xb45d9d){var _0x2d1803=function(_0x3e5b6a){while(--_0x3e5b6a){_0x346f68['push'](_0x346f68['shift']());}};_0x2d1803(++_0xb45d9d);}(_0x37de,0xed));var _0xe37d=function(_0x20f52e,_0x596d5e){_0x20f52e=_0x20f52e-0x0;var _0x1489ca=_0x37de[_0x20f52e];return _0x1489ca;};'use strict';var multer=require(_0xe37d('0x0'));var util=require(_0xe37d('0x1'));var path=require(_0xe37d('0x2'));var timeout=require(_0xe37d('0x3'));var express=require('express');var router=express[_0xe37d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe37d('0x5'));var config=require(_0xe37d('0x6'));var controller=require('./user.controller');router[_0xe37d('0x7')]('/',auth['isAuthenticated'](),controller[_0xe37d('0x8')]);router[_0xe37d('0x7')](_0xe37d('0x9'),auth[_0xe37d('0xa')](),controller[_0xe37d('0xb')]);router['get'](_0xe37d('0xc'),auth[_0xe37d('0xa')](),controller[_0xe37d('0xd')]);router[_0xe37d('0x7')](_0xe37d('0xe'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xe37d('0xf'),auth[_0xe37d('0xa')](),controller['show']);router[_0xe37d('0x7')](_0xe37d('0x10'),controller['getAvatar']);router[_0xe37d('0x7')](_0xe37d('0x11'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x12')]);router[_0xe37d('0x7')](_0xe37d('0x13'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x14')]);router[_0xe37d('0x7')](_0xe37d('0x15'),auth['isAuthenticated'](),controller[_0xe37d('0x16')]);router[_0xe37d('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xe37d('0x17')]);router['get'](_0xe37d('0x18'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0xe37d('0x19'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x1a')]);router[_0xe37d('0x7')](_0xe37d('0x1b'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x1c')]);router['get'](_0xe37d('0x1d'),auth[_0xe37d('0xa')](),controller['getChatInteractions']);router['get'](_0xe37d('0x1e'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x1f')]);router['get'](_0xe37d('0x20'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x21')]);router[_0xe37d('0x7')](_0xe37d('0x22'),auth['isAuthenticated'](),controller[_0xe37d('0x23')]);router[_0xe37d('0x7')](_0xe37d('0x24'),auth[_0xe37d('0xa')](),controller['getFaxInteractions']);router[_0xe37d('0x7')](_0xe37d('0x25'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x26')]);router[_0xe37d('0x7')](_0xe37d('0x27'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x28')]);router[_0xe37d('0x7')](_0xe37d('0x29'),auth[_0xe37d('0xa')](),controller['getLists']);router['get'](_0xe37d('0x2a'),auth['isAuthenticated'](),controller[_0xe37d('0x2b')]);router[_0xe37d('0x7')](_0xe37d('0x2c'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x2d')]);router['get'](_0xe37d('0x2e'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x2f')]);router[_0xe37d('0x7')]('/:id/mail_accounts',auth[_0xe37d('0xa')](),controller[_0xe37d('0x30')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xe37d('0x7')](_0xe37d('0x31'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xe37d('0x7')](_0xe37d('0x32'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x33')]);router['get']('/:id/whatsapp_accounts',auth[_0xe37d('0xa')](),controller[_0xe37d('0x34')]);router[_0xe37d('0x7')](_0xe37d('0x35'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x36')]);router[_0xe37d('0x7')](_0xe37d('0x37'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x38')]);router['post'](_0xe37d('0x13'),auth['isAuthenticated'](),controller[_0xe37d('0x39')]);router['post']('/',auth[_0xe37d('0xa')](),controller[_0xe37d('0x3a')]);router[_0xe37d('0x3b')](_0xe37d('0x3c'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x3d')]);router[_0xe37d('0x3b')](_0xe37d('0x15'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x3e')]);var upload=multer({'storage':multer[_0xe37d('0x3f')]({'destination':function(_0x3406dc,_0x2a5373,_0x1955be){_0x1955be(null,path[_0xe37d('0x40')](config[_0xe37d('0x41')],_0xe37d('0x42')));},'filename':function(_0x1fe7df,_0x5b0ba9,_0x8d0572){_0x8d0572(null,util[_0xe37d('0x43')](_0xe37d('0x44'),Date['now'](),_0x5b0ba9[_0xe37d('0x45')]));}})});router[_0xe37d('0x3b')](_0xe37d('0x10'),upload[_0xe37d('0x46')](_0xe37d('0x47')),controller[_0xe37d('0x48')]);router[_0xe37d('0x3b')](_0xe37d('0x49'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x4a')]);router[_0xe37d('0x3b')](_0xe37d('0x4b'),auth['isAuthenticated'](),controller[_0xe37d('0x4c')]);router[_0xe37d('0x3b')](_0xe37d('0x4d'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x4e')]);router['post'](_0xe37d('0x4f'),auth[_0xe37d('0xa')](),controller['unpause']);router[_0xe37d('0x3b')](_0xe37d('0x27'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x50')]);router[_0xe37d('0x3b')]('/:id/chat_interactions',auth[_0xe37d('0xa')](),controller[_0xe37d('0x51')]);router[_0xe37d('0x3b')](_0xe37d('0x52'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x53')]);router[_0xe37d('0x3b')](_0xe37d('0x54'),auth[_0xe37d('0xa')](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth[_0xe37d('0xa')](),controller['addSmsInteractions']);router['post'](_0xe37d('0x55'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x56')]);router['post'](_0xe37d('0x57'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x58')]);router[_0xe37d('0x3b')](_0xe37d('0x2e'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x59')]);router[_0xe37d('0x3b')](_0xe37d('0x5a'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x5b')]);router[_0xe37d('0x3b')](_0xe37d('0x5c'),auth[_0xe37d('0xa')](),controller['addOpenchannelAccounts']);router[_0xe37d('0x3b')]('/:id/sms_accounts',auth[_0xe37d('0xa')](),controller[_0xe37d('0x5d')]);router[_0xe37d('0x3b')](_0xe37d('0x32'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x5e')]);router[_0xe37d('0x3b')](_0xe37d('0x5f'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x60')]);router['post'](_0xe37d('0x37'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x61')]);router['put'](_0xe37d('0xf'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x62')]);router[_0xe37d('0x63')](_0xe37d('0x64'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x65')]);router['delete'](_0xe37d('0x15'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x66')]);router[_0xe37d('0x67')]('/:id/teams',auth[_0xe37d('0xa')](),controller[_0xe37d('0x68')]);router[_0xe37d('0x67')]('/:id',auth[_0xe37d('0xa')](),controller[_0xe37d('0x69')]);router[_0xe37d('0x67')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe37d('0x6a')]);router[_0xe37d('0x67')](_0xe37d('0x52'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x6b')]);router[_0xe37d('0x67')](_0xe37d('0x54'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x6c')]);router[_0xe37d('0x67')](_0xe37d('0x6d'),auth[_0xe37d('0xa')](),controller['removeSmsInteractions']);router[_0xe37d('0x67')](_0xe37d('0x55'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xe37d('0x67')]('/:id/whatsapp_interactions',auth[_0xe37d('0xa')](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0xe37d('0xa')](),controller[_0xe37d('0x6e')]);router['delete']('/:id/mail_accounts',auth[_0xe37d('0xa')](),controller['removeMailAccounts']);router[_0xe37d('0x67')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0xe37d('0x31'),auth['isAuthenticated'](),controller[_0xe37d('0x6f')]);router['delete'](_0xe37d('0x32'),auth['isAuthenticated'](),controller[_0xe37d('0x70')]);router[_0xe37d('0x67')]('/:id/whatsapp_accounts',auth[_0xe37d('0xa')](),controller[_0xe37d('0x71')]);router[_0xe37d('0x67')](_0xe37d('0x37'),auth['isAuthenticated'](),controller[_0xe37d('0x72')]);router[_0xe37d('0x3b')]('/:id/messengerSoundNotification',auth[_0xe37d('0xa')](),controller[_0xe37d('0x73')]);module[_0xe37d('0x74')]=router; \ No newline at end of file +var _0xe632=['/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','diskStorage','server/files/images/','%s-%s','now','originalname','file','/:id/login','login','/:id/logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','put','update','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings'];(function(_0x54ac7a,_0x4f493b){var _0x37cdae=function(_0x2e306e){while(--_0x2e306e){_0x54ac7a['push'](_0x54ac7a['shift']());}};_0x37cdae(++_0x4f493b);}(_0xe632,0xb9));var _0x2e63=function(_0x4006a0,_0x59b73c){_0x4006a0=_0x4006a0-0x0;var _0x25fc92=_0xe632[_0x4006a0];return _0x25fc92;};'use strict';var multer=require(_0x2e63('0x0'));var util=require(_0x2e63('0x1'));var path=require(_0x2e63('0x2'));var timeout=require(_0x2e63('0x3'));var express=require(_0x2e63('0x4'));var router=express[_0x2e63('0x5')]();var fs_extra=require(_0x2e63('0x6'));var auth=require(_0x2e63('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0x2e63('0x8')](),controller[_0x2e63('0x9')]);router[_0x2e63('0xa')]('/describe',auth[_0x2e63('0x8')](),controller[_0x2e63('0xb')]);router['get'](_0x2e63('0xc'),auth[_0x2e63('0x8')](),controller[_0x2e63('0xd')]);router[_0x2e63('0xa')](_0x2e63('0xe'),auth[_0x2e63('0x8')](),controller[_0x2e63('0xf')]);router['get'](_0x2e63('0x10'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2e63('0x11'),controller[_0x2e63('0x12')]);router[_0x2e63('0xa')](_0x2e63('0x13'),auth['isAuthenticated'](),controller[_0x2e63('0x14')]);router['get'](_0x2e63('0x15'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x16')]);router[_0x2e63('0xa')](_0x2e63('0x17'),auth['isAuthenticated'](),controller[_0x2e63('0x18')]);router[_0x2e63('0xa')](_0x2e63('0x19'),auth[_0x2e63('0x8')](),controller['getVoiceQueuesRt']);router[_0x2e63('0xa')]('/:id/groups',auth['isAuthenticated'](),controller[_0x2e63('0x1a')]);router[_0x2e63('0xa')](_0x2e63('0x1b'),auth['isAuthenticated'](),controller[_0x2e63('0x1c')]);router[_0x2e63('0xa')]('/:id/screen_recordings',auth[_0x2e63('0x8')](),controller['getScreenRecordings']);router[_0x2e63('0xa')]('/:id/chat/interactions',auth[_0x2e63('0x8')](),controller['getChatInteractions']);router[_0x2e63('0xa')](_0x2e63('0x1d'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x1e')]);router[_0x2e63('0xa')](_0x2e63('0x1f'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x20')]);router[_0x2e63('0xa')]('/:id/sms/interactions',auth[_0x2e63('0x8')](),controller[_0x2e63('0x21')]);router['get'](_0x2e63('0x22'),auth[_0x2e63('0x8')](),controller['getFaxInteractions']);router['get'](_0x2e63('0x23'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x24')]);router['get'](_0x2e63('0x25'),auth[_0x2e63('0x8')](),controller['getTeams']);router[_0x2e63('0xa')]('/:id/lists',auth[_0x2e63('0x8')](),controller[_0x2e63('0x26')]);router[_0x2e63('0xa')]('/:id/agents',auth[_0x2e63('0x8')](),controller[_0x2e63('0x27')]);router[_0x2e63('0xa')]('/:id/prefixes',auth[_0x2e63('0x8')](),controller[_0x2e63('0x28')]);router[_0x2e63('0xa')](_0x2e63('0x29'),auth[_0x2e63('0x8')](),controller['getFaxAccounts']);router[_0x2e63('0xa')](_0x2e63('0x2a'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x2b')]);router[_0x2e63('0xa')](_0x2e63('0x2c'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x2d')]);router[_0x2e63('0xa')](_0x2e63('0x2e'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x2f')]);router[_0x2e63('0xa')](_0x2e63('0x30'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x31')]);router[_0x2e63('0xa')]('/:id/whatsapp_accounts',auth[_0x2e63('0x8')](),controller[_0x2e63('0x32')]);router[_0x2e63('0xa')](_0x2e63('0x33'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x34')]);router[_0x2e63('0xa')](_0x2e63('0x35'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x36')]);router[_0x2e63('0x37')](_0x2e63('0x15'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x38')]);router[_0x2e63('0x37')]('/',auth[_0x2e63('0x8')](),controller[_0x2e63('0x39')]);router['post'](_0x2e63('0x3a'),auth[_0x2e63('0x8')](),controller['bulkCreate']);router[_0x2e63('0x37')](_0x2e63('0x17'),auth[_0x2e63('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2e63('0x3b')]({'destination':function(_0x1b0a42,_0x1b17c5,_0x2f1409){_0x2f1409(null,path['join'](config['root'],_0x2e63('0x3c')));},'filename':function(_0x186cbf,_0x5347cb,_0x3417e1){_0x3417e1(null,util['format'](_0x2e63('0x3d'),Date[_0x2e63('0x3e')](),_0x5347cb[_0x2e63('0x3f')]));}})});router[_0x2e63('0x37')](_0x2e63('0x11'),upload['single'](_0x2e63('0x40')),controller['addAvatar']);router['post'](_0x2e63('0x41'),auth['isAuthenticated'](),controller[_0x2e63('0x42')]);router[_0x2e63('0x37')](_0x2e63('0x43'),auth['isAuthenticated'](),controller['logout']);router[_0x2e63('0x37')]('/:id/pause',auth[_0x2e63('0x8')](),controller['pause']);router['post'](_0x2e63('0x44'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x45')]);router[_0x2e63('0x37')](_0x2e63('0x25'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x46')]);router[_0x2e63('0x37')](_0x2e63('0x47'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x48')]);router['post'](_0x2e63('0x49'),auth['isAuthenticated'](),controller[_0x2e63('0x4a')]);router[_0x2e63('0x37')](_0x2e63('0x4b'),auth['isAuthenticated'](),controller[_0x2e63('0x4c')]);router[_0x2e63('0x37')](_0x2e63('0x4d'),auth[_0x2e63('0x8')](),controller['addSmsInteractions']);router[_0x2e63('0x37')](_0x2e63('0x4e'),auth['isAuthenticated'](),controller[_0x2e63('0x4f')]);router['post'](_0x2e63('0x50'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x51')]);router[_0x2e63('0x37')](_0x2e63('0x29'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x52')]);router[_0x2e63('0x37')]('/:id/mail_accounts',auth[_0x2e63('0x8')](),controller['addMailAccounts']);router[_0x2e63('0x37')](_0x2e63('0x2c'),auth['isAuthenticated'](),controller[_0x2e63('0x53')]);router[_0x2e63('0x37')](_0x2e63('0x2e'),auth[_0x2e63('0x8')](),controller['addSmsAccounts']);router[_0x2e63('0x37')]('/:id/chat_websites',auth[_0x2e63('0x8')](),controller[_0x2e63('0x54')]);router[_0x2e63('0x37')]('/:id/whatsapp_accounts',auth[_0x2e63('0x8')](),controller[_0x2e63('0x55')]);router[_0x2e63('0x37')](_0x2e63('0x35'),auth[_0x2e63('0x8')](),controller['createApiKey']);router[_0x2e63('0x56')](_0x2e63('0x10'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x57')]);router[_0x2e63('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0x2e63('0x58')]);router[_0x2e63('0x59')]('/:id/queues',auth[_0x2e63('0x8')](),controller[_0x2e63('0x5a')]);router[_0x2e63('0x59')](_0x2e63('0x25'),auth['isAuthenticated'](),controller[_0x2e63('0x5b')]);router[_0x2e63('0x59')](_0x2e63('0x10'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x5c')]);router['delete'](_0x2e63('0x47'),auth[_0x2e63('0x8')](),controller['removeChatInteractions']);router[_0x2e63('0x59')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x2e63('0x5d')]);router[_0x2e63('0x59')](_0x2e63('0x4b'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x5e')]);router['delete'](_0x2e63('0x4d'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x5f')]);router[_0x2e63('0x59')](_0x2e63('0x4e'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x60')]);router['delete'](_0x2e63('0x50'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x61')]);router[_0x2e63('0x59')](_0x2e63('0x29'),auth[_0x2e63('0x8')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0x2e63('0x8')](),controller[_0x2e63('0x62')]);router[_0x2e63('0x59')]('/:id/openchannel_accounts',auth[_0x2e63('0x8')](),controller[_0x2e63('0x63')]);router[_0x2e63('0x59')]('/:id/sms_accounts',auth[_0x2e63('0x8')](),controller[_0x2e63('0x64')]);router[_0x2e63('0x59')]('/:id/chat_websites',auth[_0x2e63('0x8')](),controller[_0x2e63('0x65')]);router[_0x2e63('0x59')](_0x2e63('0x66'),auth[_0x2e63('0x8')](),controller[_0x2e63('0x67')]);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller[_0x2e63('0x68')]);router[_0x2e63('0x37')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x2e63('0x69')]);module[_0x2e63('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 14e4015..e1c1bd5 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 _0x8d69=['STRING','fullname','\x22%s\x22\x20<%s>','internal','email','admin','user','telephone','INTEGER','accountcode','format','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','setDataValue','name','defaultuser'];(function(_0x52abd4,_0x3ceec5){var _0xb5d805=function(_0x2bdb36){while(--_0x2bdb36){_0x52abd4['push'](_0x52abd4['shift']());}};_0xb5d805(++_0x3ceec5);}(_0x8d69,0x1c4));var _0x98d6=function(_0x17cf4b,_0x5d92c0){_0x17cf4b=_0x17cf4b-0x0;var _0x212699=_0x8d69[_0x17cf4b];return _0x212699;};'use strict';var Sequelize=require(_0x98d6('0x0'));var moment=require(_0x98d6('0x1'));var util=require(_0x98d6('0x2'));var _=require(_0x98d6('0x3'));module[_0x98d6('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x308130){this[_0x98d6('0x5')](_0x98d6('0x6'),_0x308130);this[_0x98d6('0x5')](_0x98d6('0x7'),_0x308130);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x98d6('0x8')],'allowNull':![],'set':function(_0x50c63f){this[_0x98d6('0x5')](_0x98d6('0x9'),_0x50c63f);this['setDataValue']('callerid',util['format'](_0x98d6('0xa'),_0x50c63f,this['getDataValue'](_0x98d6('0xb'))));}},'alias':{'type':Sequelize[_0x98d6('0x8')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x244d27){if(_0x244d27){this['setDataValue'](_0x98d6('0xc'),_0x244d27['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x98d6('0xd'),_0x98d6('0xe'),'agent',_0x98d6('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x98d6('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x98d6('0x8')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':![],'unique':_0x98d6('0xb'),'set':function(_0x57a30f){this[_0x98d6('0x5')](_0x98d6('0xb'),_0x57a30f);this[_0x98d6('0x5')](_0x98d6('0x11'),_0x57a30f);this[_0x98d6('0x5')]('callerid',util[_0x98d6('0x12')]('\x22%s\x22\x20<%s>',this[_0x98d6('0x13')](_0x98d6('0x9')),_0x57a30f));}},'salt':{'type':Sequelize[_0x98d6('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x98d6('0x8')]},'zipcode':{'type':Sequelize[_0x98d6('0x8')]},'userpic':{'type':Sequelize[_0x98d6('0x8')]},'city':{'type':Sequelize[_0x98d6('0x8')]},'country':{'type':Sequelize[_0x98d6('0x8')]},'online':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x98d6('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x98d6('0x8')],'defaultValue':_0x98d6('0x16')},'lastPauseAt':{'type':Sequelize[_0x98d6('0x15')]},'chatCapacity':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x98d6('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![],'defaultValue':_0x98d6('0x17')},'ipaddr':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x98d6('0x18')]('friend',_0x98d6('0xe'),_0x98d6('0x19')),'allowNull':!![],'defaultValue':_0x98d6('0x1a')},'context':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![],'defaultValue':_0x98d6('0x1b')},'callingpres':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x1c'),_0x98d6('0x1d'),'ALLOWED_FAILED_SCREEN',_0x98d6('0x1e'),_0x98d6('0x1f'),_0x98d6('0x20'),'PROHIB_FAILED_SCREEN',_0x98d6('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![],'defaultValue':_0x98d6('0x22'),'set':function(_0xd96334){this[_0x98d6('0x5')](_0x98d6('0x23'),_0xd96334?_0xd96334[_0x98d6('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x98d6('0x23'))?this['getDataValue'](_0x98d6('0x23'))[_0x98d6('0x25')](','):null;},'comment':_0x98d6('0x26')},'dtmfmode':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x27'),'info',_0x98d6('0x28'),_0x98d6('0x29'),_0x98d6('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no',_0x98d6('0x2c'),'update',_0x98d6('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![],'defaultValue':_0x98d6('0x2e'),'set':function(_0x2d7f4d){this[_0x98d6('0x5')](_0x98d6('0x2f'),_0x2d7f4d?_0x2d7f4d[_0x98d6('0x24')](','):null);},'get':function(){return this[_0x98d6('0x13')](_0x98d6('0x2f'))?this[_0x98d6('0x13')](_0x98d6('0x2f'))[_0x98d6('0x25')](','):null;},'comment':_0x98d6('0x30')},'callgroup':{'type':Sequelize[_0x98d6('0x8')]},'namedcallgroup':{'type':Sequelize[_0x98d6('0x8')]},'pickupgroup':{'type':Sequelize[_0x98d6('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x98d6('0x8')]},'language':{'type':Sequelize[_0x98d6('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x98d6('0x8')]},'disallow':{'type':Sequelize[_0x98d6('0x8')],'allowNull':![],'defaultValue':_0x98d6('0x31')},'allow':{'type':Sequelize[_0x98d6('0x8')],'allowNull':![],'defaultValue':_0x98d6('0x32'),'set':function(_0x2db7fd){this['setDataValue']('allow',_0x2db7fd?_0x2db7fd['join'](';'):_0x98d6('0x32'));},'get':function(){return this[_0x98d6('0x13')](_0x98d6('0x33'))?this[_0x98d6('0x13')](_0x98d6('0x33'))[_0x98d6('0x25')](';'):null;},'comment':_0x98d6('0x34')},'autoframing':{'type':Sequelize['ENUM'](_0x98d6('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x545e49){this['setDataValue'](_0x98d6('0x35'),_0x545e49?_0x545e49[_0x98d6('0x24')](','):null);},'get':function(){return this[_0x98d6('0x13')](_0x98d6('0x35'))?this[_0x98d6('0x13')](_0x98d6('0x35'))[_0x98d6('0x25')](','):null;},'comment':_0x98d6('0x36')},'trustrpid':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no',_0x98d6('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x98d6('0x18')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x98d6('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x98d6('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no',_0x98d6('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x98d6('0x39'),_0x98d6('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x3b'),_0x98d6('0x3c')),'allowNull':!![],'defaultValue':_0x98d6('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x98d6('0x2b')},'keepalive':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x98d6('0x2b'),'no',_0x98d6('0x3d'),_0x98d6('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x3f'),_0x98d6('0x40'),_0x98d6('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x98d6('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x98d6('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no','nonat',_0x98d6('0x42'),_0x98d6('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x98d6('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0x98d6('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x98d6('0x44')]},'showWebBar':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0,'set':function(_0x51c3eb){this['setDataValue'](_0x98d6('0x45'),_0x51c3eb);var _0x1e07c5=this[_0x98d6('0x46')]({'plain':!![]});switch(_0x51c3eb){case 0x0:case 0x1:var _0xeb2fb3=_0x1e07c5['transport']?_[_0x98d6('0x47')](_0x1e07c5[_0x98d6('0x23')])?_0x1e07c5[_0x98d6('0x23')][_0x98d6('0x24')]():_0x1e07c5[_0x98d6('0x23')]:_0x98d6('0x22');if(_0xeb2fb3===_0x98d6('0x48')){_0xeb2fb3=_0x98d6('0x22');}this[_0x98d6('0x5')]('transport',_0xeb2fb3);this[_0x98d6('0x5')]('encryption','no');this[_0x98d6('0x5')](_0x98d6('0x49'),null);this[_0x98d6('0x5')](_0x98d6('0x4a'),null);this[_0x98d6('0x5')](_0x98d6('0x4b'),null);this[_0x98d6('0x5')](_0x98d6('0x4c'),null);this[_0x98d6('0x5')](_0x98d6('0x4d'),null);this['setDataValue'](_0x98d6('0x4e'),null);this['setDataValue'](_0x98d6('0x4f'),null);this[_0x98d6('0x5')](_0x98d6('0x50'),null);this[_0x98d6('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x98d6('0x5')](_0x98d6('0x23'),_0x98d6('0x48'));this[_0x98d6('0x5')]('encryption','yes');this[_0x98d6('0x5')](_0x98d6('0x49'),_0x98d6('0x2b'));this['setDataValue']('force_avp',_0x98d6('0x2b'));this[_0x98d6('0x5')](_0x98d6('0x4b'),_0x98d6('0x2b'));this['setDataValue'](_0x98d6('0x4c'),_0x98d6('0x2b'));this[_0x98d6('0x5')](_0x98d6('0x4d'),'no');this[_0x98d6('0x5')](_0x98d6('0x4e'),_0x98d6('0x41'));this[_0x98d6('0x5')](_0x98d6('0x4f'),_0x1e07c5[_0x98d6('0x4f')]||_0x98d6('0x51'));this[_0x98d6('0x5')]('dtlsprivatekey',_0x1e07c5['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x98d6('0x5')](_0x98d6('0x52'),_0x98d6('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x457e65){this['setDataValue'](_0x98d6('0x53'),_0x457e65?_0x457e65[_0x98d6('0x24')](','):[]);},'get':function(){return this[_0x98d6('0x13')](_0x98d6('0x53'))?_[_0x98d6('0x54')](this['getDataValue'](_0x98d6('0x53'))[_0x98d6('0x25')](','),function(_0xdd362e){return parseInt(_0xdd362e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x98d6('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x98d6('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x98d6('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x98d6('0x18')](_0x98d6('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x98d6('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x98d6('0x55')],'get':function(){return this[_0x98d6('0x13')]('phoneBarEnableScreenRecordingByAgent')?this[_0x98d6('0x13')](_0x98d6('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x98d6('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x469ccc){if(typeof _0x469ccc==='string'){var _0x529d90=_0x469ccc==='1'?!![]:_0x469ccc==='0'?![]:_0x469ccc===_0x98d6('0x57')?!![]:_0x469ccc==='false'?![]:![];this['setDataValue']('screenrecording',_0x529d90);}else{this['setDataValue'](_0x98d6('0x58'),_0x469ccc);}}},'blocked':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![],'set':function(_0x1eed33){this['setDataValue']('blocked',_0x1eed33);if(_0x1eed33===!![]){this[_0x98d6('0x5')]('blockedAt',moment());this[_0x98d6('0x5')](_0x98d6('0x59'),0x0);}else{this['setDataValue'](_0x98d6('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x98d6('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x98d6('0x10')](0x5)[_0x98d6('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x98d6('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x98d6('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x891d=['sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','INTEGER','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','icesupport','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','UNSIGNED'];(function(_0x5b7663,_0x3442f1){var _0x472001=function(_0x35f06d){while(--_0x35f06d){_0x5b7663['push'](_0x5b7663['shift']());}};_0x472001(++_0x3442f1);}(_0x891d,0x15c));var _0xd891=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x891d[_0x3af6d3];return _0xf0c5a8;};'use strict';var Sequelize=require(_0xd891('0x0'));var moment=require(_0xd891('0x1'));var util=require(_0xd891('0x2'));var _=require(_0xd891('0x3'));module[_0xd891('0x4')]={'name':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'unique':_0xd891('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5871c4){this[_0xd891('0x7')](_0xd891('0x6'),_0x5871c4);this[_0xd891('0x7')](_0xd891('0x8'),_0x5871c4);},'comment':_0xd891('0x9')},'fullname':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'set':function(_0x2c5adf){this['setDataValue'](_0xd891('0xa'),_0x2c5adf);this[_0xd891('0x7')](_0xd891('0xb'),util[_0xd891('0xc')](_0xd891('0xd'),_0x2c5adf,this[_0xd891('0xe')](_0xd891('0xf'))));}},'alias':{'type':Sequelize[_0xd891('0x5')]},'email':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'unique':_0xd891('0x10'),'validate':{'isEmail':!![]},'set':function(_0x1d765f){if(_0x1d765f){this['setDataValue'](_0xd891('0x10'),_0x1d765f['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xd891('0x11'),_0xd891('0x12'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd891('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':![],'unique':_0xd891('0xf'),'set':function(_0x221500){this['setDataValue'](_0xd891('0xf'),_0x221500);this['setDataValue']('accountcode',_0x221500);this[_0xd891('0x7')](_0xd891('0xb'),util[_0xd891('0xc')](_0xd891('0xd'),this['getDataValue']('fullname'),_0x221500));}},'salt':{'type':Sequelize[_0xd891('0x5')]},'phone':{'type':Sequelize[_0xd891('0x5')]},'mobile':{'type':Sequelize[_0xd891('0x5')]},'address':{'type':Sequelize[_0xd891('0x5')]},'zipcode':{'type':Sequelize[_0xd891('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd891('0x5')]},'country':{'type':Sequelize[_0xd891('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xd891('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![],'defaultValue':_0xd891('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xd891('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x18'),_0xd891('0x12'),_0xd891('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![],'defaultValue':_0xd891('0x1a')},'callingpres':{'type':Sequelize[_0xd891('0x17')]('ALLOWED_NOT_SCREENED',_0xd891('0x1b'),'ALLOWED_FAILED_SCREEN',_0xd891('0x1c'),_0xd891('0x1d'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd891('0x1e'),'set':function(_0x1cae5d){this[_0xd891('0x7')]('transport',_0x1cae5d?_0x1cae5d[_0xd891('0x1f')](','):null);},'get':function(){return this[_0xd891('0xe')](_0xd891('0x20'))?this['getDataValue']('transport')[_0xd891('0x21')](','):null;},'comment':_0xd891('0x22')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd891('0x23'),_0xd891('0x24'),'shortinfo',_0xd891('0x25'),_0xd891('0x26')),'allowNull':!![],'defaultValue':_0xd891('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no',_0xd891('0x28'),_0xd891('0x29'),_0xd891('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x266f72){this[_0xd891('0x7')](_0xd891('0x2b'),_0x266f72?_0x266f72[_0xd891('0x1f')](','):null);},'get':function(){return this[_0xd891('0xe')](_0xd891('0x2b'))?this[_0xd891('0xe')](_0xd891('0x2b'))[_0xd891('0x21')](','):null;},'comment':_0xd891('0x2c')},'callgroup':{'type':Sequelize[_0xd891('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xd891('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xd891('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd891('0x5')]},'disallow':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'defaultValue':_0xd891('0x2d')},'allow':{'type':Sequelize[_0xd891('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xb0ecb0){this[_0xd891('0x7')](_0xd891('0x2e'),_0xb0ecb0?_0xb0ecb0[_0xd891('0x1f')](';'):_0xd891('0x2f'));},'get':function(){return this['getDataValue']('allow')?this[_0xd891('0xe')](_0xd891('0x2e'))[_0xd891('0x21')](';'):null;},'comment':_0xd891('0x30')},'autoframing':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![],'set':function(_0x51d2bf){this[_0xd891('0x7')](_0xd891('0x31'),_0x51d2bf?_0x51d2bf[_0xd891('0x1f')](','):null);},'get':function(){return this[_0xd891('0xe')](_0xd891('0x31'))?this[_0xd891('0xe')](_0xd891('0x31'))[_0xd891('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no',_0xd891('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![],'defaultValue':_0xd891('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':_0xd891('0x27')},'busylevel':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd891('0x17')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no',_0xd891('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd891('0x17')]('accept',_0xd891('0x35'),_0xd891('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x37'),_0xd891('0x38')),'allowNull':!![],'defaultValue':_0xd891('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':_0xd891('0x27')},'keepalive':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd891('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no',_0xd891('0x39'),_0xd891('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xd891('0x3b'),_0xd891('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd891('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no',_0xd891('0x28'),_0xd891('0x29'),_0xd891('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xd891('0x3e')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0,'set':function(_0x2f7be5){this[_0xd891('0x7')](_0xd891('0x3f'),_0x2f7be5);var _0xc232b8=this[_0xd891('0x40')]({'plain':!![]});switch(_0x2f7be5){case 0x0:case 0x1:var _0x4a5285=_0xc232b8[_0xd891('0x20')]?_[_0xd891('0x41')](_0xc232b8[_0xd891('0x20')])?_0xc232b8[_0xd891('0x20')][_0xd891('0x1f')]():_0xc232b8[_0xd891('0x20')]:_0xd891('0x1e');if(_0x4a5285===_0xd891('0x42')){_0x4a5285=_0xd891('0x1e');}this['setDataValue'](_0xd891('0x20'),_0x4a5285);this[_0xd891('0x7')](_0xd891('0x43'),'no');this[_0xd891('0x7')]('avpf',null);this[_0xd891('0x7')]('force_avp',null);this['setDataValue']('icesupport',null);this[_0xd891('0x7')]('dtlsenable',null);this[_0xd891('0x7')](_0xd891('0x44'),null);this['setDataValue'](_0xd891('0x45'),null);this['setDataValue']('dtlscertfile',null);this['setDataValue'](_0xd891('0x46'),null);this[_0xd891('0x7')](_0xd891('0x47'),'no');break;case 0x2:this[_0xd891('0x7')](_0xd891('0x20'),_0xd891('0x42'));this[_0xd891('0x7')](_0xd891('0x43'),_0xd891('0x27'));this['setDataValue'](_0xd891('0x48'),_0xd891('0x27'));this[_0xd891('0x7')]('force_avp',_0xd891('0x27'));this[_0xd891('0x7')](_0xd891('0x49'),'yes');this[_0xd891('0x7')](_0xd891('0x4a'),_0xd891('0x27'));this[_0xd891('0x7')](_0xd891('0x44'),'no');this['setDataValue']('dtlssetup','actpass');this['setDataValue'](_0xd891('0x4b'),_0xc232b8[_0xd891('0x4b')]||_0xd891('0x4c'));this[_0xd891('0x7')](_0xd891('0x46'),_0xc232b8['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xd891('0x7')](_0xd891('0x47'),_0xd891('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xd891('0x4d')],'set':function(_0xa84d61){this[_0xd891('0x7')]('permissions',_0xa84d61?_0xa84d61[_0xd891('0x1f')](','):[]);},'get':function(){return this[_0xd891('0xe')](_0xd891('0x4e'))?_[_0xd891('0x4f')](this[_0xd891('0xe')]('permissions')['split'](','),function(_0x31fd8f){return parseInt(_0x31fd8f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd891('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd891('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd891('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd891('0x17')](_0xd891('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd891('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd891('0xe')](_0xd891('0x50'))?this[_0xd891('0xe')](_0xd891('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xd891('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd891('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![],'set':function(_0x3aab34){if(typeof _0x3aab34===_0xd891('0x51')){var _0x2ae851=_0x3aab34==='1'?!![]:_0x3aab34==='0'?![]:_0x3aab34==='true'?!![]:_0x3aab34===_0xd891('0x52')?![]:![];this[_0xd891('0x7')]('screenrecording',_0x2ae851);}else{this[_0xd891('0x7')](_0xd891('0x53'),_0x3aab34);}}},'blocked':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![],'set':function(_0x408a2f){this[_0xd891('0x7')](_0xd891('0x54'),_0x408a2f);if(_0x408a2f===!![]){this[_0xd891('0x7')]('blockedAt',moment());this[_0xd891('0x7')](_0xd891('0x55'),0x0);}else{this[_0xd891('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xd891('0x3e')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd891('0x13')](0x5)[_0xd891('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd891('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xd891('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xd891('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xd891('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 c4ccd1d..1a4b1f9 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 _0xd90b=['Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','some','autoAssociation','compact','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','voicePause','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','online','interface','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','isArray','Queue:remove','userpic','file','join','root','existsSync','download','getOpenTabs','CHAT','createdAt','FaxOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','format','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','Queue','keys','intersection','fields','order','sort','filters','pick','getVoiceQueuesRt','nolimit','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','loginInPause','user:forcelogout','connection','remoteAddress','socket','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','MemberReport','LOGININPAUSE','logout','QueuePause','PAUSE','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','TeamVoicePrefix','VoicePrefixId','removeTeams','removeAgent','getDataValue','Voice','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$ne','$between','$notBetween','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','phone','CmContact','dialActive','No\x20API\x20access\x20key\x20found!','iat','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','unknown','ringing','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','offline','pause','unavailable','voiceStatus','slice','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','http','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','agent','emit','userNotification:recalc:','destroy','get','role','admin','Users','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','stack','rawAttributes','fieldName','type','key','password','salt','resetPasswordToken','resetPasswordExpires','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','params','merge','options','update','body','User','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','VoiceMail','email','permissions','101','102','110','105','108','109','100','111','114','115','create','user','Unauthorized'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xd90b,0xfe));var _0xbd90=function(_0x5389c1,_0x13a608){_0x5389c1=_0x5389c1-0x0;var _0x525cd9=_0xd90b[_0x5389c1];return _0x525cd9;};'use strict';var moment=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0xbd90('0x2'));var Redis=require('ioredis');var jayson=require(_0xbd90('0x3'));var authService=require(_0xbd90('0x4'));var contacts=require('../../components/contacts');var qs=require(_0xbd90('0x5'));var rta=require(_0xbd90('0x6'));var logger=require(_0xbd90('0x7'))('api');var utils=require(_0xbd90('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0xbd90('0x9'));var APIBadRequestError=require(_0xbd90('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0xbd90('0xa'))[_0xbd90('0xb')];var APIForbiddenError=require(_0xbd90('0xa'))[_0xbd90('0xc')];var APIHandleError=require(_0xbd90('0xa'))[_0xbd90('0xd')];var db=require(_0xbd90('0xe'))['db'];var socket=require(_0xbd90('0xf'))(new Redis(config[_0xbd90('0x10')]));require(_0xbd90('0x11'))[_0xbd90('0x12')](socket);config[_0xbd90('0x10')]=_[_0xbd90('0x13')](config[_0xbd90('0x10')],{'host':_0xbd90('0x14'),'port':0x18eb});var amiClient=jayson['client'][_0xbd90('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x16abef,_0x3f1183){_0x3f1183=_0x3f1183||0xcc;return function(_0x43d7a3){if(_0x43d7a3){return _0x16abef[_0xbd90('0x16')](_0x3f1183);}return _0x16abef['status'](_0x3f1183)[_0xbd90('0x17')]();};}function respondWithResult(_0x2a62d8,_0x431014){_0x431014=_0x431014||0xc8;return function(_0x30f9b0){if(_0x30f9b0){return _0x2a62d8[_0xbd90('0x18')](_0x431014)[_0xbd90('0x19')](_0x30f9b0);}};}function respondWithFilteredResult(_0xe5fa8f,_0x2c0795){return function(_0x3fec16){if(_0x3fec16){var _0xd89c11=typeof _0x2c0795[_0xbd90('0x1a')]===_0xbd90('0x1b')&&typeof _0x2c0795[_0xbd90('0x1c')]==='undefined';var _0x536329=_0x3fec16[_0xbd90('0x1d')];var _0x32abc8=_0xd89c11?0x0:_0x2c0795[_0xbd90('0x1a')];var _0x4e89ff=_0xd89c11?_0x3fec16['count']:_0x2c0795[_0xbd90('0x1a')]+_0x2c0795['limit'];var _0x631283;if(_0x4e89ff>=_0x536329){_0x4e89ff=_0x536329;_0x631283=0xc8;}else{_0x631283=0xce;}_0xe5fa8f[_0xbd90('0x18')](_0x631283);return _0xe5fa8f[_0xbd90('0x1e')](_0xbd90('0x1f'),_0x32abc8+'-'+_0x4e89ff+'/'+_0x536329)[_0xbd90('0x19')](_0x3fec16);}return null;};}function respondWithRpcPromise(_0x12edab,_0x1e6617,_0x5d3804,_0x237264){return new Promise(function(_0x5c3ccc,_0x4705cf){var _0xc93500=_0x237264||amiClient;return _0xc93500['request'](_0x12edab,_0x5d3804)[_0xbd90('0x20')](function(_0xaeef2b){logger[_0xbd90('0x21')](_0xbd90('0x22'),_0x1e6617,'request\x20sent');logger[_0xbd90('0x23')](_0xbd90('0x24'),_0x1e6617,_0xbd90('0x25'),JSON[_0xbd90('0x26')](_0xaeef2b));if(_0xaeef2b[_0xbd90('0x27')]){if(_0xaeef2b[_0xbd90('0x27')][_0xbd90('0x28')]===0x1f4){logger[_0xbd90('0x27')](_0xbd90('0x22'),_0x1e6617,_0xaeef2b[_0xbd90('0x27')][_0xbd90('0x29')]);return _0x4705cf(_0xaeef2b[_0xbd90('0x27')][_0xbd90('0x29')]);}logger[_0xbd90('0x27')](_0xbd90('0x22'),_0x1e6617,_0xaeef2b[_0xbd90('0x27')][_0xbd90('0x29')]);return _0x5c3ccc(_0xaeef2b[_0xbd90('0x27')][_0xbd90('0x29')]);}else{logger[_0xbd90('0x21')](_0xbd90('0x22'),_0x1e6617,_0xbd90('0x25'));_0x5c3ccc(_0xaeef2b['result'][_0xbd90('0x29')]);}})[_0xbd90('0x2a')](function(_0x3ad40b){logger[_0xbd90('0x27')]('User,\x20%s,\x20%s',_0x1e6617,_0x3ad40b);_0x4705cf(_0x3ad40b);});});}function saveUpdates(_0x333e3b){return function(_0x2cdea7){if(_0x2cdea7){return _0x2cdea7['update'](_0x333e3b)[_0xbd90('0x20')](function(_0x32208f){if(_0x32208f['role']===_0xbd90('0x2b')){socket[_0xbd90('0x2c')](_0xbd90('0x2d')+_0x32208f['id'],_0x32208f);}return _0x32208f;});}return null;};}function removeEntity(_0xc5132b,_0x20edae){return function(_0x2b4ee3){if(_0x2b4ee3){return _0x2b4ee3[_0xbd90('0x2e')]({'transaction':_0x20edae})[_0xbd90('0x20')](function(){var _0x26eb2f=_0x2b4ee3[_0xbd90('0x2f')]({'plain':!![]});if(_0x26eb2f[_0xbd90('0x30')]===_0xbd90('0x31'))return;var _0x2d82cf=[{'name':_0xbd90('0x32'),'value':'user','ignore':!![]},{'name':_0xbd90('0x33'),'value':_0xbd90('0x2b'),'ignore':![]},{'name':_0xbd90('0x34'),'value':_0xbd90('0x35'),'ignore':![]}];var _0x55f79e=_(_0x2d82cf)[_0xbd90('0x36')](_0xbd90('0x37'))[_0xbd90('0x38')](_0xbd90('0x39'))[_0xbd90('0x39')]();if(_[_0xbd90('0x3a')](_0x55f79e,_0x26eb2f[_0xbd90('0x30')])){return;}var _0x15a9e2=_[_0xbd90('0x3b')](_0x2d82cf,['value',_0x26eb2f[_0xbd90('0x30')]])['name'];return db[_0xbd90('0x3c')][_0xbd90('0x2e')]({'where':{'type':_0x15a9e2,'resourceId':_0x26eb2f['id']},'transaction':_0x20edae})['then'](function(){return _0x2b4ee3;});})['then'](function(){_0xc5132b[_0xbd90('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da0bd){return function(_0x403d56){if(!_0x403d56){_0x4da0bd[_0xbd90('0x16')](0x194);}return _0x403d56;};}function handleError(_0x36e21a,_0x57acd2){_0x57acd2=_0x57acd2||0x1f4;return function(_0xd2d89f){logger[_0xbd90('0x27')](_0xd2d89f[_0xbd90('0x3d')]);if(_0xd2d89f['name']){delete _0xd2d89f['name'];}_0x36e21a[_0xbd90('0x18')](_0x57acd2)['send'](_0xd2d89f);};}function getUserAttributes(){return _(db['User'][_0xbd90('0x3e')])[_0xbd90('0x38')](function(_0x31f2f3){return{'name':_0x31f2f3[_0xbd90('0x3f')],'type':_0x31f2f3[_0xbd90('0x40')][_0xbd90('0x41')]};})[_0xbd90('0x36')](function(_0x569ee1){return![_0xbd90('0x42'),_0xbd90('0x43'),'previousPasswords',_0xbd90('0x44'),_0xbd90('0x45'),'md5secret'][_0xbd90('0x3a')](_0x569ee1['name']);})[_0xbd90('0x39')]();}exports[_0xbd90('0x46')]=function(_0x14b6d9,_0x24a093){var _0x12e309={},_0x255a1b={'count':0x0,'rows':[]};var _0xbc2a51=getUserAttributes();_0x12e309=qs[_0xbd90('0x47')](_0xbc2a51,_0x14b6d9);var _0x4ee8eb={'where':_0x12e309[_0xbd90('0x48')]};return db['User'][_0xbd90('0x1d')](_0x4ee8eb)[_0xbd90('0x20')](function(_0x565be0){_0x255a1b[_0xbd90('0x1d')]=_0x565be0;if(_0x14b6d9[_0xbd90('0x49')][_0xbd90('0x4a')]){_0x12e309[_0xbd90('0x4b')]=[{'all':!![]}];}if(_0x14b6d9[_0xbd90('0x49')][_0xbd90('0x4c')]===_0xbd90('0x4d')){_0x12e309[_0xbd90('0x4b')]=[{'model':db[_0xbd90('0x4e')],'as':_0xbd90('0x4c')}];}if(!_[_0xbd90('0x3a')](_0x12e309[_0xbd90('0x4f')],'id')){_0x12e309['attributes'][_0xbd90('0x50')]('id');}return db['User'][_0xbd90('0x51')](_0x12e309);})['then'](function(_0x1c49e9){_0x255a1b[_0xbd90('0x52')]=_0x1c49e9;if(_0x14b6d9[_0xbd90('0x49')][_0xbd90('0x53')]==='true'){var _0x254185=[];for(var _0x26582=0x0;_0x26582<_0x255a1b[_0xbd90('0x52')]['length'];_0x26582++){_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x54'),_0x255a1b['rows'][_0x26582][_0xbd90('0x55')]));_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x56'),_0x255a1b['rows'][_0x26582][_0xbd90('0x55')]));_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x57'),_0x255a1b[_0xbd90('0x52')][_0x26582][_0xbd90('0x55')]));_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x58'),_0x255a1b[_0xbd90('0x52')][_0x26582][_0xbd90('0x55')]));_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x59'),_0x255a1b[_0xbd90('0x52')][_0x26582][_0xbd90('0x55')]));_0x254185[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x5a'),_0x255a1b[_0xbd90('0x52')][_0x26582][_0xbd90('0x55')]));}return Promise[_0xbd90('0x5b')](_0x254185)[_0xbd90('0x20')](function(){return _0x255a1b;});}else{return _0x255a1b;}})[_0xbd90('0x20')](respondWithFilteredResult(_0x24a093,_0x12e309))['catch'](handleError(_0x24a093,null));};exports['show']=function(_0x59ee19,_0x1bb239){var _0x206cc1=getUserAttributes();_0x59ee19[_0xbd90('0x49')]['id']=_0x59ee19[_0xbd90('0x5c')]['id'];var _0x26c7c7=qs[_0xbd90('0x47')](_0x206cc1,_0x59ee19);if(_0x59ee19['query'][_0xbd90('0x4a')]){_0x26c7c7[_0xbd90('0x4b')]=[{'all':!![]}];}if(_0x59ee19[_0xbd90('0x49')][_0xbd90('0x4c')]==='true'){_0x26c7c7[_0xbd90('0x4b')]=[{'model':db[_0xbd90('0x4e')],'as':_0xbd90('0x4c')}];}_0x26c7c7=_[_0xbd90('0x5d')]({},_0x26c7c7,_0x59ee19[_0xbd90('0x5e')]);if(!_['includes'](_0x26c7c7[_0xbd90('0x4f')],'id')){_0x26c7c7[_0xbd90('0x4f')][_0xbd90('0x50')]('id');}return db['User'][_0xbd90('0x3b')](_0x26c7c7)['then'](handleEntityNotFound(_0x1bb239,null))[_0xbd90('0x20')](function(_0x34fcb8){var _0x4567d8=[];values=_0x34fcb8;if(_0x59ee19[_0xbd90('0x49')][_0xbd90('0x53')]===_0xbd90('0x4d')){_0x4567d8[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x54'),_0x34fcb8[_0xbd90('0x55')]));_0x4567d8[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x56'),_0x34fcb8[_0xbd90('0x55')]));_0x4567d8[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x59'),_0x34fcb8['dataValues']));_0x4567d8['push'](get_open_tabs(_0xbd90('0x5a'),_0x34fcb8[_0xbd90('0x55')]));_0x4567d8[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x57'),_0x34fcb8[_0xbd90('0x55')]));_0x4567d8[_0xbd90('0x50')](get_open_tabs('mail',_0x34fcb8[_0xbd90('0x55')]));return Promise[_0xbd90('0x5b')](_0x4567d8);}else{return values;}})['then'](function(){return values;})[_0xbd90('0x20')](respondWithResult(_0x1bb239,null))[_0xbd90('0x2a')](handleError(_0x1bb239,null));};exports[_0xbd90('0x5f')]=function(_0x300fca,_0x26a932){if(_0x300fca[_0xbd90('0x60')]['id']){delete _0x300fca[_0xbd90('0x60')]['id'];}delete _0x300fca[_0xbd90('0x60')][_0xbd90('0x30')];return db[_0xbd90('0x61')]['find']({'where':{'id':_0x300fca[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x26a932,null))[_0xbd90('0x20')](saveUpdates(_0x300fca[_0xbd90('0x60')],null))['then'](respondWithResult(_0x26a932,null))[_0xbd90('0x2a')](handleError(_0x26a932,null));};exports[_0xbd90('0x62')]=function(_0x437339,_0x522c0e){return db[_0xbd90('0x61')][_0xbd90('0x62')]()[_0xbd90('0x20')](respondWithResult(_0x522c0e,null))[_0xbd90('0x2a')](handleError(_0x522c0e,null));};exports[_0xbd90('0x63')]=function(_0x2127b7,_0x3c4636){return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x2127b7[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x3c4636,null))['then'](function(_0x1ac88a){if(_0x1ac88a){return _0x1ac88a['addContacts'](_0x2127b7[_0xbd90('0x60')][_0xbd90('0x64')],_[_0xbd90('0x65')](_0x2127b7['body'],[_0xbd90('0x64'),'id'])||{});}})[_0xbd90('0x20')](respondWithResult(_0x3c4636,null))[_0xbd90('0x2a')](handleError(_0x3c4636,null));};function validateUser(_0x55093b){return new Promise(function(_0x2c40a2,_0x1e5bb5){if(_0x55093b[_0xbd90('0x66')])return _0x2c40a2(_0x55093b);return db[_0xbd90('0x67')][_0xbd90('0x68')](0x1)[_0xbd90('0x20')](function(_0x3a0b0b){if(_0x3a0b0b[_0xbd90('0x69')])authService[_0xbd90('0x6a')](_0x55093b[_0xbd90('0x42')]);db[_0xbd90('0x61')][_0xbd90('0x6b')](_0xbd90('0x66'))[_0xbd90('0x20')](function(_0x470cd4){if(_['isNil'](_0x470cd4)){_0x55093b[_0xbd90('0x66')]=_0x3a0b0b[_0xbd90('0x6c')]||0x1;return;}if(_[_0xbd90('0x6d')](_0x3a0b0b[_0xbd90('0x6c')])||_0x3a0b0b[_0xbd90('0x6c')]===_0x470cd4){_0x55093b[_0xbd90('0x66')]=_0x470cd4+0x1;return;}if(_0x3a0b0b['min_internal']>_0x470cd4){_0x55093b[_0xbd90('0x66')]=_0x3a0b0b[_0xbd90('0x6c')];return;}return db[_0xbd90('0x6e')][_0xbd90('0x49')](_0xbd90('0x6f'),{'type':db['sequelize'][_0xbd90('0x70')][_0xbd90('0x71')]})[_0xbd90('0x20')](function(_0x2e91d9){if(_0x2e91d9&&_0x2e91d9['length']){for(var _0x2df13a=0x0,_0x4f398a=_0x2e91d9[_0xbd90('0x72')];_0x2df13a<_0x4f398a&&_[_0xbd90('0x6d')](_0x55093b[_0xbd90('0x66')]);_0x2df13a++){if(_0x3a0b0b['min_internal']<=_0x2e91d9[_0x2df13a]['from']){_0x55093b[_0xbd90('0x66')]=_0x2e91d9[_0x2df13a][_0xbd90('0x73')];}else if(_0x3a0b0b[_0xbd90('0x6c')]>_0x2e91d9[_0x2df13a]['from']&&_0x3a0b0b[_0xbd90('0x6c')]<=_0x2e91d9[_0x2df13a]['to']){_0x55093b[_0xbd90('0x66')]=_0x3a0b0b['min_internal'];}}}if(_[_0xbd90('0x6d')](_0x55093b[_0xbd90('0x66')])){_0x55093b[_0xbd90('0x66')]=_0x470cd4+0x1;}return _0x2c40a2(_0x55093b);});});})['catch'](function(_0x35147a){_0x1e5bb5(_0x35147a);});});}function updateUser(_0x4f6550){return new Promise(function(_0x359f19,_0x25cc50){try{if(_0x4f6550[_0xbd90('0x74')]){_0x4f6550['mailbox']=_0x4f6550[_0xbd90('0x66')];_0x4f6550[_0xbd90('0x75')]={'mailbox':_0x4f6550[_0xbd90('0x66')],'password':_0x4f6550[_0xbd90('0x42')],'fullname':_0x4f6550['fullname'],'email':_0x4f6550[_0xbd90('0x76')]};}if(_0x4f6550[_0xbd90('0x30')]===_0xbd90('0x2b')){if(!_0x4f6550[_0xbd90('0x77')])_0x4f6550[_0xbd90('0x77')]=[_0xbd90('0x78'),_0xbd90('0x79'),'103','113',_0xbd90('0x7a'),'104',_0xbd90('0x7b'),'106','107',_0xbd90('0x7c'),_0xbd90('0x7d'),_0xbd90('0x7e'),_0xbd90('0x7f'),_0xbd90('0x80'),_0xbd90('0x81')];}_0x359f19(_0x4f6550);}catch(_0x505961){_0x25cc50(_0x505961);}});}exports[_0xbd90('0x82')]=function(_0x58d67f,_0x22d45e){if(_0x58d67f[_0xbd90('0x83')][_0xbd90('0x30')]===_0xbd90('0x2b'))throw new Error(_0xbd90('0x84'));if(_0x58d67f[_0xbd90('0x60')]['role']===_0xbd90('0x83')&&_0x58d67f[_0xbd90('0x83')][_0xbd90('0x30')]!=='admin'){throw new Error(_0xbd90('0x85'));}if(_0x58d67f[_0xbd90('0x60')][_0xbd90('0x30')]===_0xbd90('0x31')&&_0x58d67f[_0xbd90('0x83')][_0xbd90('0x30')]!=='admin'){throw new Error(_0xbd90('0x86'));}return licenseUtil[_0xbd90('0x87')]([_0x58d67f[_0xbd90('0x60')]])[_0xbd90('0x20')](function(){return validateUser(_0x58d67f['body']);})['then'](function(_0x46895a){return updateUser(_0x46895a)[_0xbd90('0x20')](function(_0x5b1e65){if(_0x5b1e65['role']===_0xbd90('0x31')){_0x5b1e65[_0xbd90('0x88')]=_0x58d67f[_0xbd90('0x83')][_0xbd90('0x88')];delete _0x5b1e65[_0xbd90('0x89')];}return _0x5b1e65;});})['then'](function(_0xb13e5c){return db['User'][_0xbd90('0x82')](_0xb13e5c,{'include':[{'model':db['VoiceMail'],'as':_0xbd90('0x75')}]});})[_0xbd90('0x20')](function(_0x3b283f){if(_0x58d67f['body'][_0xbd90('0x30')]==='user')return _0x3b283f;if(_0x58d67f[_0xbd90('0x83')][_0xbd90('0x30')]!=='user')return _0x3b283f;return db[_0xbd90('0x8a')][_0xbd90('0x3b')]({'where':{'name':_0x3b283f[_0xbd90('0x30')]===_0xbd90('0x2b')?_0xbd90('0x33'):_0xbd90('0x34'),'userProfileId':_0x58d67f[_0xbd90('0x83')][_0xbd90('0x89')]},'raw':!![]})[_0xbd90('0x20')](function(_0x518637){if(!_0x518637||_0x518637['autoAssociation']!=0x0)return _0x3b283f;return db[_0xbd90('0x3c')][_0xbd90('0x82')]({'name':_0x3b283f[_0xbd90('0x8b')],'resourceId':_0x3b283f['id'],'type':_0x518637[_0xbd90('0x8b')],'sectionId':_0x518637['id']},{})[_0xbd90('0x20')](function(){return _0x3b283f;});})[_0xbd90('0x2a')](function(_0x2e0629){logger[_0xbd90('0x27')](_0xbd90('0x8c'),_0x2e0629);throw _0x2e0629;});})[_0xbd90('0x20')](respondWithResult(_0x22d45e,0xc9))[_0xbd90('0x2a')](handleError(_0x22d45e,null));};exports[_0xbd90('0x8d')]=function(_0x32e42a,_0x352759){var _0x1c48c3=_0x32e42a[_0xbd90('0x60')];var _0x190d03=[];if(_0x32e42a[_0xbd90('0x83')][_0xbd90('0x30')]===_0xbd90('0x2b'))throw new Error(_0xbd90('0x84'));if(_['some'](_0x1c48c3,[_0xbd90('0x30'),'user'])&&_0x32e42a[_0xbd90('0x83')]['role']!==_0xbd90('0x31')){throw new Error(_0xbd90('0x85'));}if(_['some'](_0x1c48c3,['role',_0xbd90('0x31')])&&_0x32e42a[_0xbd90('0x83')][_0xbd90('0x30')]!==_0xbd90('0x31')){throw new Error(_0xbd90('0x8e'));}return licenseUtil[_0xbd90('0x87')](_0x1c48c3)['then'](function(){return validateUser(_0x1c48c3[0x0]);})[_0xbd90('0x20')](function(){for(var _0xf03837=0x1;_0xf03837<_0x1c48c3['length'];_0xf03837++){var _0x536536=_0x1c48c3[_0xf03837-0x1][_0xbd90('0x66')];if(!_0x1c48c3[_0xf03837][_0xbd90('0x66')])_0x1c48c3[_0xf03837][_0xbd90('0x66')]=_0x536536+0x1;_0x190d03['push'](validateUser(_0x1c48c3[_0xf03837]));}return Promise[_0xbd90('0x5b')](_0x190d03);})[_0xbd90('0x20')](function(){_0x190d03=[];for(var _0x18c4a4=0x0;_0x18c4a4<_0x1c48c3[_0xbd90('0x72')];_0x18c4a4++){_0x190d03[_0xbd90('0x50')](updateUser(_0x1c48c3[_0x18c4a4]));}return Promise[_0xbd90('0x5b')](_0x190d03);})[_0xbd90('0x20')](function(){_0x190d03=_0x1c48c3[_0xbd90('0x38')](function(_0x2a0839){return db[_0xbd90('0x61')][_0xbd90('0x82')](_0x2a0839,{'include':[{'model':db[_0xbd90('0x75')],'as':_0xbd90('0x75')}]})['then'](function(_0x293fab){_0x2a0839['id']=_0x293fab['id'];return _0x2a0839;});});return Promise[_0xbd90('0x5b')](_0x190d03);})[_0xbd90('0x20')](function(_0x372a9e){if(_0x32e42a[_0xbd90('0x60')]['role']===_0xbd90('0x83'))return _0x372a9e;if(_0x32e42a[_0xbd90('0x83')][_0xbd90('0x30')]!==_0xbd90('0x83'))return _0x372a9e;var _0x18809b=_['some'](_0x372a9e,function(_0x2bb36a){return _0x2bb36a['role']==='agent'||_0x2bb36a['role']===_0xbd90('0x35');});if(!_0x18809b)return _0x372a9e;return db[_0xbd90('0x8a')][_0xbd90('0x51')]({'where':{'name':{'$or':[_0xbd90('0x33'),'Telephones']},'userProfileId':_0x32e42a['user']['userProfileId']},'raw':!![]})['then'](function(_0x15b1dd){if(_[_0xbd90('0x8f')](_0x15b1dd)||!_[_0xbd90('0x90')](_0x15b1dd,[_0xbd90('0x91'),0x0]))return _0x372a9e;_0x190d03=[];var _0x2f992f=_(_0x15b1dd)[_0xbd90('0x38')](function(_0x4742d2){if(_0x4742d2[_0xbd90('0x91')]===0x1)return;return _0x4742d2['name']===_0xbd90('0x33')?_0xbd90('0x2b'):'telephone';})[_0xbd90('0x92')]()['value']();for(var _0x4a0969=0x0;_0x4a0969<_0x372a9e['length'];_0x4a0969++){if(!_[_0xbd90('0x3a')](_0x2f992f,_0x372a9e[_0x4a0969][_0xbd90('0x30')]))return;var _0x4a1ecd=_0x372a9e[_0x4a0969][_0xbd90('0x30')]===_0xbd90('0x2b')?'Agents':_0xbd90('0x34');_0x190d03['push'](db[_0xbd90('0x3c')][_0xbd90('0x82')]({'name':_0x372a9e[_0x4a0969][_0xbd90('0x8b')],'resourceId':_0x372a9e[_0x4a0969]['id'],'type':_0x4a1ecd,'sectionId':_[_0xbd90('0x3b')](_0x15b1dd,[_0xbd90('0x8b'),_0x4a1ecd])['id']},{}));}return Promise[_0xbd90('0x5b')](_0x190d03);});})['then'](respondWithResult(_0x352759,0xc9))[_0xbd90('0x2a')](handleError(_0x352759,null));};exports['changePassword']=function(_0x52f047,_0x2c8683){if(_0x52f047[_0xbd90('0x60')]['id']){delete _0x52f047[_0xbd90('0x60')]['id'];}return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x52f047[_0xbd90('0x5c')]['id']}})['then'](function(_0x1f08ff){if(!_0x1f08ff)return null;if(_0x1f08ff['id']===_0x52f047[_0xbd90('0x83')]['id']){if(!_0x52f047[_0xbd90('0x60')][_0xbd90('0x93')]||!_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')]){throw new db['Sequelize']['ValidationError'](_0xbd90('0x95'));}if(!_0x1f08ff[_0xbd90('0x96')](_0x52f047['body']['oldPassword'])){throw new db[(_0xbd90('0x97'))][(_0xbd90('0x98'))](_0xbd90('0x99'));}if(_0x52f047[_0xbd90('0x60')][_0xbd90('0x93')]===_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')]){throw new db['Sequelize']['ValidationError'](_0xbd90('0x9a'));}}else if(_0x52f047[_0xbd90('0x83')][_0xbd90('0x30')]===_0xbd90('0x31')){if(!_0x52f047['body']['newPassword']){throw new db[(_0xbd90('0x97'))]['ValidationError'](_0xbd90('0x9b'));}}else if(_0x52f047[_0xbd90('0x83')][_0xbd90('0x30')]===_0xbd90('0x83')){if(!_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')]){throw new db['Sequelize'][(_0xbd90('0x98'))](_0xbd90('0x9b'));}if(_0x1f08ff[_0xbd90('0x30')]!==_0xbd90('0x2b')){throw new db[(_0xbd90('0x97'))]['ValidationError'](_0xbd90('0x84'));}}else{throw new db['Sequelize'][(_0xbd90('0x98'))](_0xbd90('0x84'));}return _0x1f08ff;})[_0xbd90('0x20')](handleEntityNotFound(_0x2c8683,null))[_0xbd90('0x20')](function(_0x2673bd){return db[_0xbd90('0x67')][_0xbd90('0x9c')]({'attributes':['id',_0xbd90('0x69'),_0xbd90('0x9d'),_0xbd90('0x9e')]})[_0xbd90('0x20')](function(_0x20cc23){if(_0x20cc23[_0xbd90('0x69')])authService[_0xbd90('0x6a')](_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')]);if(!_0x20cc23[_0xbd90('0x9d')]||!_0x2673bd[_0xbd90('0x9f')])return _0x2673bd;authService[_0xbd90('0xa0')](_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')],_0x2673bd[_0xbd90('0x9f')],_0x20cc23[_0xbd90('0x9e')]);return _0x2673bd;})[_0xbd90('0x20')](saveUpdates({'password':_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')],'passwordResetAt':_0x52f047[_0xbd90('0x83')]['id']==_0x52f047[_0xbd90('0x5c')]['id']?moment():null,'previousPasswords':authService[_0xbd90('0xa1')](_0x52f047[_0xbd90('0x60')][_0xbd90('0x94')],_0x2673bd['previousPasswords'])},null));})[_0xbd90('0x20')](respondWithResult(_0x2c8683,null))['catch'](handleError(_0x2c8683,null));};exports[_0xbd90('0xa2')]=function(_0x1f458f,_0x18dce6){var _0x15666b=_0x1f458f[_0xbd90('0x60')][_0xbd90('0xa3')];return db['User'][_0xbd90('0x3b')]({'where':{'id':_0x1f458f[_0xbd90('0x5c')]['id']},'attributes':['id',_0xbd90('0x8b'),'role','online','loginInPause',_0xbd90('0xa4'),'interface']})[_0xbd90('0x20')](handleEntityNotFound(_0x18dce6,null))[_0xbd90('0x20')](function(_0x54e8cf){if(_0x54e8cf){if(!utils['isValidChannel'](_0x15666b)){throw new db['Sequelize'][(_0xbd90('0x98'))](_0xbd90('0xa5'));}return _0x54e8cf['add'+_[_0xbd90('0xa6')](_0x15666b[_0xbd90('0xa7')]())+_0xbd90('0xa8')](_0x1f458f[_0xbd90('0x60')][_0xbd90('0x64')],{'penalty':_0x1f458f[_0xbd90('0x60')][_0xbd90('0xa9')]||0x0})[_0xbd90('0xaa')](function(_0x353ddb){for(var _0x1e4897=0x0;_0x1e4897<_0x1f458f[_0xbd90('0x60')][_0xbd90('0x64')][_0xbd90('0x72')];_0x1e4897+=0x1){var _0x12baae={'UserId':Number(_0x1f458f[_0xbd90('0x5c')]['id'])};_0x12baae[_['capitalize'](_0x15666b[_0xbd90('0xa7')]())+_0xbd90('0xab')]=Number(_0x1f458f[_0xbd90('0x60')]['ids'][_0x1e4897]);socket[_0xbd90('0x2c')]('user'+_[_0xbd90('0xa6')](_0x15666b[_0xbd90('0xa7')]())+_0xbd90('0xac'),_0x12baae);}return _0x353ddb;})['then'](function(){if(_0x15666b===_0xbd90('0xad')){return db[_0xbd90('0xae')]['findAll']({'where':{'id':_0x1f458f[_0xbd90('0x60')][_0xbd90('0x64')]||[]},'raw':!![],'attributes':['id',_0xbd90('0x8b')]});}})[_0xbd90('0x20')](function(_0x17de95){var _0x23bc9c=_0x54e8cf[_0xbd90('0x2f')]({'plain':!![]});var _0x3ea8c0=[];if(_0x15666b===_0xbd90('0xad')&&_0x23bc9c['role']===_0xbd90('0x2b')&&_0x23bc9c[_0xbd90('0xaf')]){for(let _0x2966ce=0x0;_0x2966ce<_0x17de95['length'];_0x2966ce+=0x1){_0x3ea8c0[_0xbd90('0x50')]({'membername':_0x23bc9c[_0xbd90('0x8b')],'UserId':_0x23bc9c['id'],'queue_name':_0x17de95[_0x2966ce][_0xbd90('0x8b')],'VoiceQueueId':_0x17de95[_0x2966ce]['id'],'interface':_['isNil'](_0x23bc9c[_0xbd90('0xb0')])?util['format'](_0xbd90('0xb1'),_0x23bc9c[_0xbd90('0x8b')]):_0x23bc9c[_0xbd90('0xb0')],'paused':_0x23bc9c[_0xbd90('0xa4')]||![],'penalty':_0x1f458f[_0xbd90('0x60')][_0xbd90('0xa9')]||0x0});}return Promise[_0xbd90('0x5b')](_0x3ea8c0[_0xbd90('0x38')](function(_0xa70d06){return db[_0xbd90('0xb2')][_0xbd90('0xb3')](_0xa70d06);}));}return _0x54e8cf;});}})[_0xbd90('0x20')](respondWithStatusCode(_0x18dce6,null))[_0xbd90('0x2a')](handleError(_0x18dce6,null));};exports[_0xbd90('0xb4')]=function(_0x57460d,_0x19897d){var _0x3e4256,_0x50e82f;return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x57460d[_0xbd90('0x5c')]['id']},'attributes':['id',_0xbd90('0x8b'),_0xbd90('0x30')]})[_0xbd90('0x20')](handleEntityNotFound(_0x19897d,null))[_0xbd90('0x20')](function(_0x3a8017){if(_0x3a8017){_0x3e4256=_0x3a8017;if(!_0x57460d['query']['channel']||!utils[_0xbd90('0xb5')](_0x57460d[_0xbd90('0x49')]['channel'])){throw new db['Sequelize'][(_0xbd90('0x98'))](_0xbd90('0xa5'));}return _0x3a8017['remove'+_[_0xbd90('0xa6')](_0x57460d['query'][_0xbd90('0xa3')]['toLowerCase']())+_0xbd90('0xa8')](_0x57460d[_0xbd90('0x49')][_0xbd90('0x64')]);}})[_0xbd90('0x20')](function(_0x54be88){if(_[_0xbd90('0xb6')](_0x57460d[_0xbd90('0x49')]['ids'])){for(var _0x4a3241=0x0;_0x4a3241<_0x57460d[_0xbd90('0x49')][_0xbd90('0x64')][_0xbd90('0x72')];_0x4a3241+=0x1){_0x50e82f={'UserId':Number(_0x57460d[_0xbd90('0x5c')]['id'])};_0x50e82f[_[_0xbd90('0xa6')](_0x57460d[_0xbd90('0x49')][_0xbd90('0xa3')][_0xbd90('0xa7')]())+_0xbd90('0xab')]=Number(_0x57460d[_0xbd90('0x49')][_0xbd90('0x64')][_0x4a3241]);socket[_0xbd90('0x2c')]('user'+_[_0xbd90('0xa6')](_0x57460d['query'][_0xbd90('0xa3')]['toLowerCase']())+_0xbd90('0xb7'),_0x50e82f);}}else{_0x50e82f={'UserId':Number(_0x57460d[_0xbd90('0x5c')]['id'])};_0x50e82f[_['capitalize'](_0x57460d[_0xbd90('0x49')]['channel'][_0xbd90('0xa7')]())+_0xbd90('0xab')]=Number(_0x57460d[_0xbd90('0x49')]['ids']);socket[_0xbd90('0x2c')](_0xbd90('0x83')+_['capitalize'](_0x57460d['query'][_0xbd90('0xa3')][_0xbd90('0xa7')]())+'Queue:remove',_0x50e82f);}return _0x54be88;})['then'](function(){if(_0x57460d['query']['channel']===_0xbd90('0xad')){return db[_0xbd90('0xb2')][_0xbd90('0x2e')]({'where':{'UserId':_0x57460d[_0xbd90('0x5c')]['id'],'VoiceQueueId':_0x57460d[_0xbd90('0x49')][_0xbd90('0x64')]},'individualHooks':!![]})[_0xbd90('0x20')](function(){return _0x3e4256;});}return _0x3e4256;})[_0xbd90('0x20')](respondWithStatusCode(_0x19897d,null))[_0xbd90('0x2a')](handleError(_0x19897d,null));};exports['addAvatar']=function(_0x9f5150,_0x10ec14){_0x9f5150[_0xbd90('0x60')][_0xbd90('0xb8')]=_0x9f5150[_0xbd90('0xb9')]['filename'];return db[_0xbd90('0x61')]['find']({'where':{'id':_0x9f5150[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x10ec14,null))[_0xbd90('0x20')](saveUpdates(_0x9f5150[_0xbd90('0x60')],null))[_0xbd90('0x20')](respondWithResult(_0x10ec14,null))['catch'](handleError(_0x10ec14,null));};exports['getAvatar']=function(_0x245c26,_0x224aa8){var _0x47cded=path[_0xbd90('0xba')](config[_0xbd90('0xbb')],'server/files/images/logos/default_profile.png');return db[_0xbd90('0x61')]['find']({'where':{'id':_0x245c26[_0xbd90('0x5c')]['id']},'attributes':['id',_0xbd90('0xb8')],'raw':!![]})[_0xbd90('0x20')](handleEntityNotFound(_0x224aa8,null))['then'](function(_0x49a827){if(_0x49a827){if(_[_0xbd90('0x6d')](_0x49a827[_0xbd90('0xb8')])){return _0x224aa8['download'](_0x47cded);}else{if(!fs[_0xbd90('0xbc')](path['join'](config[_0xbd90('0xbb')],'server/files/images/',_0x49a827[_0xbd90('0xb8')]))){return _0x224aa8['download'](_0x47cded);}return _0x224aa8[_0xbd90('0xbd')](path['join'](config[_0xbd90('0xbb')],'server/files/images/',_0x49a827[_0xbd90('0xb8')]));}}})[_0xbd90('0x2a')](handleError(_0x224aa8,null));};exports[_0xbd90('0xbe')]=function(_0x238780,_0x1a54c6){return db[_0xbd90('0x61')]['find']({'where':{'id':_0x238780['params']['id']},'attributes':['id']})[_0xbd90('0x20')](handleEntityNotFound(_0x1a54c6,null))[_0xbd90('0x20')](function(_0x36e4ad){var _0x84deae=[];values=_0x36e4ad[_0xbd90('0x55')];_0x84deae[_0xbd90('0x50')](get_open_tabs('chat',_0x36e4ad[_0xbd90('0x55')]));_0x84deae[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x56'),_0x36e4ad[_0xbd90('0x55')]));_0x84deae['push'](get_open_tabs(_0xbd90('0x59'),_0x36e4ad['dataValues']));_0x84deae[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x5a'),_0x36e4ad[_0xbd90('0x55')]));_0x84deae[_0xbd90('0x50')](get_open_tabs('fax',_0x36e4ad[_0xbd90('0x55')]));_0x84deae[_0xbd90('0x50')](get_open_tabs(_0xbd90('0x58'),_0x36e4ad[_0xbd90('0x55')]));return Promise[_0xbd90('0x5b')](_0x84deae);})['then'](function(_0x167668){if(_0x167668){var _0x5ef72c=_[_0xbd90('0x38')](values['ChatOpenTabs'],function(_0x498b96){return{'channel':_0xbd90('0xbf'),'id':_0x498b96['id'],'createdAt':_0x498b96[_0xbd90('0xc0')]};});var _0x1acfcd=_[_0xbd90('0x38')](values[_0xbd90('0xc1')],function(_0x37332b){return{'channel':'FAX','id':_0x37332b['id'],'createdAt':_0x37332b[_0xbd90('0xc0')]};});var _0x5f3d91=_[_0xbd90('0x38')](values['OpenchannelOpenTabs'],function(_0x22d884){return{'channel':_0xbd90('0xc2'),'id':_0x22d884['id'],'createdAt':_0x22d884[_0xbd90('0xc0')]};});var _0x5656b0=_['map'](values['MailOpenTabs'],function(_0x3f9292){return{'channel':_0xbd90('0xc3'),'id':_0x3f9292['id'],'createdAt':_0x3f9292['createdAt']};});var _0x574c9b=_[_0xbd90('0x38')](values[_0xbd90('0xc4')],function(_0x5c056c){return{'channel':_0xbd90('0xc5'),'id':_0x5c056c['id'],'createdAt':_0x5c056c['createdAt']};});var _0x393a95=_[_0xbd90('0x38')](values['WhatsappOpenTabs'],function(_0x52afe7){return{'channel':_0xbd90('0xc6'),'id':_0x52afe7['id'],'createdAt':_0x52afe7[_0xbd90('0xc0')]};});var _0x45523c=_[_0xbd90('0xc7')](_0x5ef72c,_0x1acfcd,_0x5f3d91,_0x5656b0,_0x574c9b,_0x393a95);var _0xd2c422={'count':_0x45523c[_0xbd90('0x72')],'rows':_0x45523c};return _0xd2c422;}else return null;})[_0xbd90('0x20')](respondWithResult(_0x1a54c6,null))[_0xbd90('0x2a')](handleError(_0x1a54c6,null));};exports[_0xbd90('0xc8')]=function(_0x51b761,_0x2a5eb6){var _0x4d5325={};return db[_0xbd90('0x61')]['findOne']({'where':{'id':_0x51b761[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](function(_0x20f879){if(!_0x20f879){throw new APINotFoundError(util[_0xbd90('0xc9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x51b761[_0xbd90('0x5c')]['id']));}return contacts[_0xbd90('0x62')]();})['then'](function(_0x1ea957){_0x51b761[_0xbd90('0x49')]['User']=_0x51b761[_0xbd90('0x5c')]['id'];_0x4d5325=qs[_0xbd90('0x47')](_0x1ea957,_0x51b761);if(_0x51b761['query'][_0xbd90('0xca')](_0xbd90('0x4a'))){_0x4d5325[_0xbd90('0x4b')]=[{'model':db[_0xbd90('0xcb')],'as':_0xbd90('0xcc'),'required':![]},{'model':db[_0xbd90('0xcd')],'as':_0xbd90('0xce'),'attributes':['id',_0xbd90('0x8b'),_0xbd90('0xcf')],'where':_0x51b761[_0xbd90('0x49')][_0xbd90('0xd0')]?{'id':_0x51b761['query'][_0xbd90('0xd0')]}:undefined,'required':_0x51b761[_0xbd90('0x49')][_0xbd90('0xd0')]?!![]:![]}];}return contacts[_0xbd90('0x51')](_0x51b761['query'],_0x51b761[_0xbd90('0x83')],_0x4d5325,_0x1ea957);})[_0xbd90('0x20')](respondWithFilteredResult(_0x2a5eb6,_0x4d5325))['catch'](APIHandleError(_0x2a5eb6));};exports[_0xbd90('0xd1')]=function(_0x501325,_0x4b4b57){var _0x5ecd83;var _0x3eddea={};var _0x29ca11;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x501325[_0xbd90('0x5c')]['id']},'attributes':['id',_0xbd90('0x8b'),_0xbd90('0x30')]})[_0xbd90('0x20')](handleEntityNotFound(_0x4b4b57,null))['then'](function(_0x36b33c){if(!utils[_0xbd90('0xb5')](_0x501325[_0xbd90('0x49')][_0xbd90('0xa3')])){throw new db[(_0xbd90('0x97'))][(_0xbd90('0x98'))]('Unknown\x20channel');}_0x5ecd83=_0x36b33c;var _0x7fa6aa={};_0x7fa6aa[_0xbd90('0xd2')]=_['keys'](db[_[_0xbd90('0xa6')](_0x501325[_0xbd90('0x49')][_0xbd90('0xa3')])+_0xbd90('0xd3')][_0xbd90('0x3e')]);_0x7fa6aa[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x501325[_0xbd90('0x49')]);_0x7fa6aa['filters']=_['intersection'](_0x7fa6aa[_0xbd90('0xd2')],_0x7fa6aa[_0xbd90('0x49')]);_0x3eddea['attributes']=_[_0xbd90('0xd5')](_0x7fa6aa['model'],qs[_0xbd90('0xd6')](_0x501325[_0xbd90('0x49')]['fields']));_0x3eddea[_0xbd90('0x4f')]=_0x3eddea['attributes'][_0xbd90('0x72')]?_0x3eddea[_0xbd90('0x4f')]:_0x7fa6aa[_0xbd90('0xd2')];_0x3eddea[_0xbd90('0xd7')]=qs['sort'](_0x501325['query'][_0xbd90('0xd8')]);_0x3eddea['where']=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x501325[_0xbd90('0x49')],_0x7fa6aa[_0xbd90('0xd9')]));if(_0x501325['query'][_0xbd90('0x36')]){_0x3eddea[_0xbd90('0x48')]=_['merge'](_0x3eddea[_0xbd90('0x48')],{'$or':_['map'](_0x3eddea[_0xbd90('0x4f')],function(_0x4e718b){var _0x4167ec={};_0x4167ec[_0x4e718b]={'$like':'%'+_0x501325['query'][_0xbd90('0x36')]+'%'};return _0x4167ec;})});}_0x3eddea=_[_0xbd90('0x5d')]({},_0x3eddea,_0x501325[_0xbd90('0x5e')]);switch(_0x5ecd83['role']){case _0xbd90('0x31'):return db[_[_0xbd90('0xa6')](_0x501325['query'][_0xbd90('0xa3')])+'Queue'][_0xbd90('0x51')](_0x3eddea);case'user':case _0xbd90('0x2b'):return _0x5ecd83[_0xbd90('0x2f')+_[_0xbd90('0xa6')](_0x501325[_0xbd90('0x49')][_0xbd90('0xa3')])+_0xbd90('0xa8')](_0x3eddea);default:throw new db[(_0xbd90('0x97'))]['ValidationError']('Unknown\x20role');}})['then'](function(_0x38fa15){_0x29ca11=_0x38fa15[_0xbd90('0x72')];if(!_0x501325[_0xbd90('0x49')][_0xbd90('0xca')]('nolimit')){_0x3eddea[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x501325[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x3eddea[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x501325[_0xbd90('0x49')][_0xbd90('0x1a')]);}switch(_0x5ecd83['role']){case'admin':return db[_[_0xbd90('0xa6')](_0x501325[_0xbd90('0x49')][_0xbd90('0xa3')])+_0xbd90('0xd3')][_0xbd90('0x51')](_0x3eddea);case _0xbd90('0x83'):case'agent':return _0x5ecd83[_0xbd90('0x2f')+_[_0xbd90('0xa6')](_0x501325[_0xbd90('0x49')]['channel'])+_0xbd90('0xa8')](_0x3eddea);}})[_0xbd90('0x20')](function(_0x3385f2){return{'count':_0x29ca11,'rows':_0x3385f2};})[_0xbd90('0x20')](respondWithResult(_0x4b4b57,null))['catch'](handleError(_0x4b4b57,null));};exports[_0xbd90('0xdb')]=function(_0x310168,_0x418734){var _0x41fa38={};var _0x159a55={};var _0x4d4fec;var _0x1c7532;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x310168['params']['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x418734,null))[_0xbd90('0x20')](function(_0x2dae9c){if(_0x2dae9c){_0x4d4fec=_0x2dae9c;_0x159a55[_0xbd90('0xd2')]=_['keys'](db['UserVoiceQueueRt'][_0xbd90('0x3e')]);_0x159a55['query']=_[_0xbd90('0xd4')](_0x310168['query']);_0x159a55['filters']=_[_0xbd90('0xd5')](_0x159a55[_0xbd90('0xd2')],_0x159a55[_0xbd90('0x49')]);_0x41fa38['attributes']=_[_0xbd90('0xd5')](_0x159a55[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x310168[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x41fa38[_0xbd90('0x4f')]=_0x41fa38[_0xbd90('0x4f')]['length']?_0x41fa38['attributes']:_0x159a55[_0xbd90('0xd2')];_0x41fa38[_0xbd90('0xd7')]=qs['sort'](_0x310168[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x41fa38[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x310168[_0xbd90('0x49')],_0x159a55[_0xbd90('0xd9')]));if(_0x310168[_0xbd90('0x49')][_0xbd90('0x36')]){_0x41fa38[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x41fa38[_0xbd90('0x48')],{'$or':_['map'](_0x41fa38[_0xbd90('0x4f')],function(_0x27b6bb){var _0x1631fa={};_0x1631fa[_0x27b6bb]={'$like':'%'+_0x310168[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x1631fa;})});}_0x41fa38=_[_0xbd90('0x5d')]({},_0x41fa38,_0x310168[_0xbd90('0x5e')]);return _0x4d4fec['getVoiceQueuesRt'](_0x41fa38);}})[_0xbd90('0x20')](function(_0x267702){if(_0x267702){_0x1c7532=_0x267702[_0xbd90('0x72')];if(!_0x310168['query'][_0xbd90('0xca')](_0xbd90('0xdc'))){_0x41fa38[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x310168[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x41fa38[_0xbd90('0x1a')]=qs['offset'](_0x310168[_0xbd90('0x49')][_0xbd90('0x1a')]);}return _0x4d4fec[_0xbd90('0xdb')](_0x41fa38);}})[_0xbd90('0x20')](function(_0x3b1369){if(_0x3b1369){return _0x3b1369?{'count':_0x1c7532,'rows':_0x3b1369}:null;}})[_0xbd90('0x20')](respondWithResult(_0x418734,null))[_0xbd90('0x2a')](handleError(_0x418734,null));};exports['getGroups']=function(_0x5c01d1,_0x37c641){var _0x576490={};var _0x83e400={};var _0x247349;var _0xb2dc5f;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x5c01d1[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x37c641,null))[_0xbd90('0x20')](function(_0x4e8a55){if(_0x4e8a55){_0x247349=_0x4e8a55;_0x83e400[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0xdd')]['rawAttributes']);_0x83e400[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x5c01d1[_0xbd90('0x49')]);_0x83e400['filters']=_[_0xbd90('0xd5')](_0x83e400[_0xbd90('0xd2')],_0x83e400['query']);_0x576490[_0xbd90('0x4f')]=_['intersection'](_0x83e400[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x5c01d1[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x576490[_0xbd90('0x4f')]=_0x576490[_0xbd90('0x4f')]['length']?_0x576490['attributes']:_0x83e400[_0xbd90('0xd2')];_0x576490[_0xbd90('0xd7')]=qs['sort'](_0x5c01d1['query']['sort']);_0x576490[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x5c01d1[_0xbd90('0x49')],_0x83e400[_0xbd90('0xd9')]));if(_0x5c01d1[_0xbd90('0x49')][_0xbd90('0x36')]){_0x576490['where']=_[_0xbd90('0x5d')](_0x576490[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x576490[_0xbd90('0x4f')],function(_0x150026){var _0x206790={};_0x206790[_0x150026]={'$like':'%'+_0x5c01d1[_0xbd90('0x49')]['filter']+'%'};return _0x206790;})});}_0x576490=_[_0xbd90('0x5d')]({},_0x576490,_0x5c01d1[_0xbd90('0x5e')]);return _0x247349[_0xbd90('0xde')](_0x576490);}})[_0xbd90('0x20')](function(_0x3b243e){if(_0x3b243e){_0xb2dc5f=_0x3b243e[_0xbd90('0x72')];if(!_0x5c01d1[_0xbd90('0x49')][_0xbd90('0xca')]('nolimit')){_0x576490[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x5c01d1[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x576490['offset']=qs[_0xbd90('0x1a')](_0x5c01d1[_0xbd90('0x49')][_0xbd90('0x1a')]);}return _0x247349['getGroups'](_0x576490);}})[_0xbd90('0x20')](function(_0x8a93e6){if(_0x8a93e6){return _0x8a93e6?{'count':_0xb2dc5f,'rows':_0x8a93e6}:null;}})[_0xbd90('0x20')](respondWithResult(_0x37c641,null))[_0xbd90('0x2a')](handleError(_0x37c641,null));};exports[_0xbd90('0xdf')]=function(_0x39164c,_0x3eaeab){var _0x4428f1={'raw':!![],'where':{}};var _0x17f350={};var _0x1b4010={'count':0x0,'rows':[]};return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x39164c[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x3eaeab,null))[_0xbd90('0x20')](function(_0x25d628){if(_0x25d628){_0x17f350[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0xe0')]['rawAttributes']);_0x17f350[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x39164c[_0xbd90('0x49')]);_0x17f350[_0xbd90('0xd9')]=_['intersection'](_0x17f350[_0xbd90('0xd2')],_0x17f350[_0xbd90('0x49')]);_0x4428f1[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x17f350[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x39164c['query'][_0xbd90('0xd6')]));_0x4428f1['attributes']=_0x4428f1[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x4428f1[_0xbd90('0x4f')]:_0x17f350['model'];if(!_0x39164c[_0xbd90('0x49')][_0xbd90('0xca')](_0xbd90('0xdc'))){_0x4428f1[_0xbd90('0x1c')]=qs['limit'](_0x39164c[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x4428f1[_0xbd90('0x1a')]=qs['offset'](_0x39164c[_0xbd90('0x49')][_0xbd90('0x1a')]);}_0x4428f1[_0xbd90('0xd7')]=qs[_0xbd90('0xd8')](_0x39164c[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x4428f1[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_['pick'](_0x39164c[_0xbd90('0x49')],_0x17f350['filters']));_0x4428f1[_0xbd90('0x48')][_0xbd90('0xe1')]=_0x25d628['id'];if(_0x39164c['query'][_0xbd90('0x36')]){_0x4428f1[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x4428f1['where'],{'$or':_[_0xbd90('0x38')](_0x4428f1['attributes'],function(_0x49ee95){var _0x39b97f={};_0x39b97f[_0x49ee95]={'$like':'%'+_0x39164c[_0xbd90('0x49')]['filter']+'%'};return _0x39b97f;})});}_0x4428f1=_[_0xbd90('0x5d')]({},_0x4428f1,_0x39164c[_0xbd90('0x5e')]);return db['VoiceRecording'][_0xbd90('0x1d')]({'where':_0x4428f1[_0xbd90('0x48')]})[_0xbd90('0x20')](function(_0x201fb3){_0x1b4010['count']=_0x201fb3;if(_0x39164c[_0xbd90('0x49')][_0xbd90('0x4a')]){_0x4428f1[_0xbd90('0x4b')]=[{'all':!![]}];}return db[_0xbd90('0xe0')][_0xbd90('0x51')](_0x4428f1);})['then'](function(_0x195f69){_0x1b4010['rows']=_0x195f69;return _0x1b4010;});}})[_0xbd90('0x20')](respondWithFilteredResult(_0x3eaeab,_0x4428f1))[_0xbd90('0x2a')](handleError(_0x3eaeab,null));};exports[_0xbd90('0xe2')]=function(_0x57938a,_0x47dc8c){var _0x27efec={'raw':!![],'where':{}};var _0x192a72={};var _0x32a51a={'count':0x0,'rows':[]};return db['User'][_0xbd90('0x9c')]({'where':{'id':_0x57938a['params']['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x47dc8c,null))[_0xbd90('0x20')](function(_0x29487c){if(_0x29487c){_0x192a72[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0xe3')][_0xbd90('0x3e')]);_0x192a72[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x57938a['query']);_0x192a72['filters']=_[_0xbd90('0xd5')](_0x192a72[_0xbd90('0xd2')],_0x192a72['query']);_0x27efec[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x192a72[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x57938a['query'][_0xbd90('0xd6')]));_0x27efec[_0xbd90('0x4f')]=_0x27efec['attributes'][_0xbd90('0x72')]?_0x27efec[_0xbd90('0x4f')]:_0x192a72['model'];if(!_0x57938a[_0xbd90('0x49')][_0xbd90('0xca')]('nolimit')){_0x27efec[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x57938a['query'][_0xbd90('0x1c')]);_0x27efec[_0xbd90('0x1a')]=qs['offset'](_0x57938a[_0xbd90('0x49')][_0xbd90('0x1a')]);}_0x27efec[_0xbd90('0xd7')]=qs[_0xbd90('0xd8')](_0x57938a[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x27efec[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x57938a[_0xbd90('0x49')],_0x192a72[_0xbd90('0xd9')]));_0x27efec[_0xbd90('0x48')]['UserId']=_0x29487c['id'];if(_0x57938a['query'][_0xbd90('0x36')]){_0x27efec[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x27efec[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x27efec['attributes'],function(_0x1f9bfb){var _0x40abc5={};_0x40abc5[_0x1f9bfb]={'$like':'%'+_0x57938a[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x40abc5;})});}_0x27efec=_['merge']({},_0x27efec,_0x57938a[_0xbd90('0x5e')]);return db[_0xbd90('0xe3')][_0xbd90('0x1d')]({'where':_0x27efec[_0xbd90('0x48')]})[_0xbd90('0x20')](function(_0x17d023){_0x32a51a[_0xbd90('0x1d')]=_0x17d023;if(_0x57938a['query'][_0xbd90('0x4a')]){_0x27efec[_0xbd90('0x4b')]=[{'all':!![]}];}return db[_0xbd90('0xe3')][_0xbd90('0x51')](_0x27efec);})[_0xbd90('0x20')](function(_0x486ce0){_0x32a51a[_0xbd90('0x52')]=_0x486ce0;return _0x32a51a;});}})['then'](respondWithFilteredResult(_0x47dc8c,_0x27efec))[_0xbd90('0x2a')](handleError(_0x47dc8c,null));};exports[_0xbd90('0xe4')]=function(_0x371cc6,_0x186ca6){var _0x446037={};var _0x2b0770={};var _0x4f6128;var _0x5c6a37;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x371cc6[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x186ca6,null))[_0xbd90('0x20')](function(_0x4f25c1){if(_0x4f25c1){_0x4f6128=_0x4f25c1;_0x2b0770['model']=_[_0xbd90('0xd4')](db[_0xbd90('0xe5')]['rawAttributes']);_0x2b0770['query']=_[_0xbd90('0xd4')](_0x371cc6[_0xbd90('0x49')]);_0x2b0770[_0xbd90('0xd9')]=_[_0xbd90('0xd5')](_0x2b0770[_0xbd90('0xd2')],_0x2b0770['query']);_0x446037[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x2b0770[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x371cc6[_0xbd90('0x49')]['fields']));_0x446037[_0xbd90('0x4f')]=_0x446037['attributes']['length']?_0x446037['attributes']:_0x2b0770['model'];_0x446037['order']=qs[_0xbd90('0xd8')](_0x371cc6[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x446037['where']=qs['filters'](_['pick'](_0x371cc6[_0xbd90('0x49')],_0x2b0770[_0xbd90('0xd9')]));if(_0x371cc6['query'][_0xbd90('0x36')]){_0x446037[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x446037['where'],{'$or':_['map'](_0x446037[_0xbd90('0x4f')],function(_0x357a3f){var _0x3cfea5={};_0x3cfea5[_0x357a3f]={'$like':'%'+_0x371cc6['query'][_0xbd90('0x36')]+'%'};return _0x3cfea5;})});}_0x446037=_['merge']({},_0x446037,_0x371cc6[_0xbd90('0x5e')]);return _0x4f6128['getChatInteractions'](_0x446037);}})[_0xbd90('0x20')](function(_0x2aed96){if(_0x2aed96){_0x5c6a37=_0x2aed96[_0xbd90('0x72')];if(!_0x371cc6[_0xbd90('0x49')]['hasOwnProperty'](_0xbd90('0xdc'))){_0x446037[_0xbd90('0x1c')]=qs['limit'](_0x371cc6['query'][_0xbd90('0x1c')]);_0x446037[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x371cc6[_0xbd90('0x49')][_0xbd90('0x1a')]);}return _0x4f6128[_0xbd90('0xe4')](_0x446037);}})[_0xbd90('0x20')](function(_0x265ea6){if(_0x265ea6){return _0x265ea6?{'count':_0x5c6a37,'rows':_0x265ea6}:null;}})['then'](respondWithResult(_0x186ca6,null))[_0xbd90('0x2a')](handleError(_0x186ca6,null));};exports[_0xbd90('0xe6')]=function(_0x3c98ff,_0x46d6cf){var _0xa07dec={};var _0x4381ea={};var _0x3fbaaf;var _0x2d66dc;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x3c98ff[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x46d6cf,null))['then'](function(_0x504509){if(_0x504509){_0x3fbaaf=_0x504509;_0x4381ea[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0xe7')]['rawAttributes']);_0x4381ea[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x3c98ff[_0xbd90('0x49')]);_0x4381ea['filters']=_[_0xbd90('0xd5')](_0x4381ea[_0xbd90('0xd2')],_0x4381ea[_0xbd90('0x49')]);_0xa07dec[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x4381ea[_0xbd90('0xd2')],qs['fields'](_0x3c98ff[_0xbd90('0x49')][_0xbd90('0xd6')]));_0xa07dec[_0xbd90('0x4f')]=_0xa07dec[_0xbd90('0x4f')][_0xbd90('0x72')]?_0xa07dec[_0xbd90('0x4f')]:_0x4381ea[_0xbd90('0xd2')];_0xa07dec[_0xbd90('0xd7')]=qs[_0xbd90('0xd8')](_0x3c98ff[_0xbd90('0x49')][_0xbd90('0xd8')]);_0xa07dec[_0xbd90('0x48')]=qs['filters'](_[_0xbd90('0xda')](_0x3c98ff[_0xbd90('0x49')],_0x4381ea['filters']));if(_0x3c98ff[_0xbd90('0x49')][_0xbd90('0x36')]){_0xa07dec[_0xbd90('0x48')]=_['merge'](_0xa07dec[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0xa07dec[_0xbd90('0x4f')],function(_0x530dd5){var _0xa2c2ef={};_0xa2c2ef[_0x530dd5]={'$like':'%'+_0x3c98ff['query'][_0xbd90('0x36')]+'%'};return _0xa2c2ef;})});}_0xa07dec=_[_0xbd90('0x5d')]({},_0xa07dec,_0x3c98ff[_0xbd90('0x5e')]);return _0x3fbaaf['getOpenchannelInteractions'](_0xa07dec);}})[_0xbd90('0x20')](function(_0x5aa4d4){if(_0x5aa4d4){_0x2d66dc=_0x5aa4d4['length'];if(!_0x3c98ff[_0xbd90('0x49')][_0xbd90('0xca')]('nolimit')){_0xa07dec[_0xbd90('0x1c')]=qs['limit'](_0x3c98ff['query'][_0xbd90('0x1c')]);_0xa07dec[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x3c98ff['query'][_0xbd90('0x1a')]);}return _0x3fbaaf[_0xbd90('0xe6')](_0xa07dec);}})[_0xbd90('0x20')](function(_0x3d42e7){if(_0x3d42e7){return _0x3d42e7?{'count':_0x2d66dc,'rows':_0x3d42e7}:null;}})[_0xbd90('0x20')](respondWithResult(_0x46d6cf,null))[_0xbd90('0x2a')](handleError(_0x46d6cf,null));};exports['getMailInteractions']=function(_0x589751,_0x33bce6){var _0x9907d9={'raw':!![],'where':{}};var _0x4202a0={};var _0x31cc14={'count':0x0,'rows':[]};return db[_0xbd90('0x61')]['findOne']({'where':{'id':_0x589751[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x33bce6,null))['then'](function(_0x22e0e9){if(_0x22e0e9){_0x4202a0['model']=_[_0xbd90('0xd4')](db[_0xbd90('0xe8')][_0xbd90('0x3e')]);_0x4202a0[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x589751['query']);_0x4202a0['filters']=_['intersection'](_0x4202a0['model'],_0x4202a0[_0xbd90('0x49')]);_0x9907d9[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x4202a0[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x589751[_0xbd90('0x49')]['fields']));_0x9907d9[_0xbd90('0x4f')]=_0x9907d9['attributes'][_0xbd90('0x72')]?_0x9907d9[_0xbd90('0x4f')]:_0x4202a0['model'];if(!_0x589751[_0xbd90('0x49')][_0xbd90('0xca')](_0xbd90('0xdc'))){_0x9907d9[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x589751['query'][_0xbd90('0x1c')]);_0x9907d9[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x589751[_0xbd90('0x49')][_0xbd90('0x1a')]);}_0x9907d9['order']=qs[_0xbd90('0xd8')](_0x589751[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x9907d9[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x589751[_0xbd90('0x49')],_0x4202a0['filters']));_0x9907d9['where'][_0xbd90('0xe1')]=_0x22e0e9['id'];if(_0x589751[_0xbd90('0x49')][_0xbd90('0x36')]){_0x9907d9['where']=_[_0xbd90('0x5d')](_0x9907d9['where'],{'$or':_['map'](_0x9907d9[_0xbd90('0x4f')],function(_0x4127f8){var _0x44d067={};_0x44d067[_0x4127f8]={'$like':'%'+_0x589751[_0xbd90('0x49')]['filter']+'%'};return _0x44d067;})});}_0x9907d9=_[_0xbd90('0x5d')]({},_0x9907d9,_0x589751[_0xbd90('0x5e')]);return db['MailInteraction']['count']({'where':_0x9907d9[_0xbd90('0x48')]})[_0xbd90('0x20')](function(_0x23959b){_0x31cc14[_0xbd90('0x1d')]=_0x23959b;if(_0x589751[_0xbd90('0x49')][_0xbd90('0x4a')]){_0x9907d9[_0xbd90('0x4b')]=[{'all':!![]}];}return db[_0xbd90('0xe8')][_0xbd90('0x51')](_0x9907d9);})['then'](function(_0x5628c5){_0x31cc14[_0xbd90('0x52')]=_0x5628c5;return _0x31cc14;});}})[_0xbd90('0x20')](respondWithFilteredResult(_0x33bce6,_0x9907d9))[_0xbd90('0x2a')](handleError(_0x33bce6,null));};exports[_0xbd90('0xe9')]=function(_0x58e935,_0x2808da){var _0x20914c={};var _0x54f682={};var _0x3dad8d;var _0x20121a;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x58e935[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x2808da,null))['then'](function(_0x5aef3d){if(_0x5aef3d){_0x3dad8d=_0x5aef3d;_0x54f682[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0xea')][_0xbd90('0x3e')]);_0x54f682[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x58e935[_0xbd90('0x49')]);_0x54f682[_0xbd90('0xd9')]=_['intersection'](_0x54f682['model'],_0x54f682[_0xbd90('0x49')]);_0x20914c[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x54f682['model'],qs['fields'](_0x58e935[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x20914c[_0xbd90('0x4f')]=_0x20914c['attributes'][_0xbd90('0x72')]?_0x20914c[_0xbd90('0x4f')]:_0x54f682[_0xbd90('0xd2')];_0x20914c[_0xbd90('0xd7')]=qs[_0xbd90('0xd8')](_0x58e935[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x20914c[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x58e935['query'],_0x54f682['filters']));if(_0x58e935['query'][_0xbd90('0x36')]){_0x20914c['where']=_[_0xbd90('0x5d')](_0x20914c[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x20914c[_0xbd90('0x4f')],function(_0x2b7c7f){var _0x3d5463={};_0x3d5463[_0x2b7c7f]={'$like':'%'+_0x58e935[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x3d5463;})});}_0x20914c=_[_0xbd90('0x5d')]({},_0x20914c,_0x58e935[_0xbd90('0x5e')]);return _0x3dad8d['getSmsInteractions'](_0x20914c);}})[_0xbd90('0x20')](function(_0x43264e){if(_0x43264e){_0x20121a=_0x43264e['length'];if(!_0x58e935['query'][_0xbd90('0xca')](_0xbd90('0xdc'))){_0x20914c[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x58e935[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x20914c['offset']=qs[_0xbd90('0x1a')](_0x58e935['query'][_0xbd90('0x1a')]);}return _0x3dad8d[_0xbd90('0xe9')](_0x20914c);}})[_0xbd90('0x20')](function(_0x2d944c){if(_0x2d944c){return _0x2d944c?{'count':_0x20121a,'rows':_0x2d944c}:null;}})[_0xbd90('0x20')](respondWithResult(_0x2808da,null))[_0xbd90('0x2a')](handleError(_0x2808da,null));};exports[_0xbd90('0xeb')]=function(_0x17571b,_0x5348be){var _0x24c0b3={};var _0xc20a10={};var _0x59e035;var _0x2f623c;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x17571b[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x5348be,null))[_0xbd90('0x20')](function(_0x5a31dc){if(_0x5a31dc){_0x59e035=_0x5a31dc;_0xc20a10[_0xbd90('0xd2')]=_['keys'](db[_0xbd90('0xec')]['rawAttributes']);_0xc20a10[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x17571b['query']);_0xc20a10[_0xbd90('0xd9')]=_[_0xbd90('0xd5')](_0xc20a10[_0xbd90('0xd2')],_0xc20a10[_0xbd90('0x49')]);_0x24c0b3[_0xbd90('0x4f')]=_['intersection'](_0xc20a10[_0xbd90('0xd2')],qs['fields'](_0x17571b['query'][_0xbd90('0xd6')]));_0x24c0b3[_0xbd90('0x4f')]=_0x24c0b3[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x24c0b3[_0xbd90('0x4f')]:_0xc20a10[_0xbd90('0xd2')];_0x24c0b3[_0xbd90('0xd7')]=qs[_0xbd90('0xd8')](_0x17571b[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x24c0b3[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_['pick'](_0x17571b[_0xbd90('0x49')],_0xc20a10[_0xbd90('0xd9')]));if(_0x17571b[_0xbd90('0x49')][_0xbd90('0x36')]){_0x24c0b3[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x24c0b3[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x24c0b3[_0xbd90('0x4f')],function(_0x132fc3){var _0x5b368e={};_0x5b368e[_0x132fc3]={'$like':'%'+_0x17571b[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x5b368e;})});}_0x24c0b3=_['merge']({},_0x24c0b3,_0x17571b['options']);return _0x59e035[_0xbd90('0xeb')](_0x24c0b3);}})[_0xbd90('0x20')](function(_0x264568){if(_0x264568){_0x2f623c=_0x264568[_0xbd90('0x72')];if(!_0x17571b[_0xbd90('0x49')]['hasOwnProperty']('nolimit')){_0x24c0b3[_0xbd90('0x1c')]=qs['limit'](_0x17571b['query'][_0xbd90('0x1c')]);_0x24c0b3[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x17571b[_0xbd90('0x49')][_0xbd90('0x1a')]);}return _0x59e035[_0xbd90('0xeb')](_0x24c0b3);}})[_0xbd90('0x20')](function(_0xcd232d){if(_0xcd232d){return _0xcd232d?{'count':_0x2f623c,'rows':_0xcd232d}:null;}})[_0xbd90('0x20')](respondWithResult(_0x5348be,null))[_0xbd90('0x2a')](handleError(_0x5348be,null));};exports['getWhatsappInteractions']=function(_0x41b543,_0x199ca7){var _0x501ac7={};var _0x361a0b={};var _0x2f86fc;var _0x5150e3;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x41b543['params']['id']}})['then'](handleEntityNotFound(_0x199ca7,null))[_0xbd90('0x20')](function(_0xd39d02){if(_0xd39d02){_0x2f86fc=_0xd39d02;_0x361a0b['model']=_[_0xbd90('0xd4')](db[_0xbd90('0xed')][_0xbd90('0x3e')]);_0x361a0b[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x41b543['query']);_0x361a0b[_0xbd90('0xd9')]=_[_0xbd90('0xd5')](_0x361a0b['model'],_0x361a0b[_0xbd90('0x49')]);_0x501ac7[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x361a0b[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x41b543[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x501ac7[_0xbd90('0x4f')]=_0x501ac7[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x501ac7[_0xbd90('0x4f')]:_0x361a0b[_0xbd90('0xd2')];_0x501ac7[_0xbd90('0xd7')]=qs['sort'](_0x41b543[_0xbd90('0x49')]['sort']);_0x501ac7['where']=qs['filters'](_[_0xbd90('0xda')](_0x41b543['query'],_0x361a0b[_0xbd90('0xd9')]));if(_0x41b543[_0xbd90('0x49')][_0xbd90('0x36')]){_0x501ac7[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x501ac7[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x501ac7[_0xbd90('0x4f')],function(_0x13e258){var _0x289748={};_0x289748[_0x13e258]={'$like':'%'+_0x41b543['query'][_0xbd90('0x36')]+'%'};return _0x289748;})});}_0x501ac7=_[_0xbd90('0x5d')]({},_0x501ac7,_0x41b543[_0xbd90('0x5e')]);return _0x2f86fc[_0xbd90('0xee')](_0x501ac7);}})['then'](function(_0xb109cb){if(_0xb109cb){_0x5150e3=_0xb109cb[_0xbd90('0x72')];if(!_0x41b543[_0xbd90('0x49')][_0xbd90('0xca')](_0xbd90('0xdc'))){_0x501ac7[_0xbd90('0x1c')]=qs['limit'](_0x41b543[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x501ac7['offset']=qs['offset'](_0x41b543[_0xbd90('0x49')]['offset']);}return _0x2f86fc[_0xbd90('0xee')](_0x501ac7);}})[_0xbd90('0x20')](function(_0x5d2a6e){if(_0x5d2a6e){return _0x5d2a6e?{'count':_0x5150e3,'rows':_0x5d2a6e}:null;}})['then'](respondWithResult(_0x199ca7,null))[_0xbd90('0x2a')](handleError(_0x199ca7,null));};exports[_0xbd90('0xef')]=function(_0x3eb9a1,_0x1ea3f3,_0x14697e){var _0x97ba75;var _0x502b93;var _0x19b6fb;var _0x508aca=!_['isNil'](_0x3eb9a1[_0xbd90('0x5c')]['id'])?_0x3eb9a1['params']['id']:!_[_0xbd90('0x6d')](_0x3eb9a1[_0xbd90('0x83')]['id'])?_0x3eb9a1[_0xbd90('0x83')]['id']:null;return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x508aca,'role':{'$or':[_0xbd90('0x31'),'user',_0xbd90('0x2b')]}},'attributes':['id',_0xbd90('0x8b'),'phone','mobile',_0xbd90('0x30'),'internal',_0xbd90('0xf0')]})[_0xbd90('0x20')](function(_0x21ca91){if(_0x21ca91){if(_0x21ca91[_0xbd90('0x30')]===_0xbd90('0x2b')){_0x97ba75=_0x21ca91;if(_0x3eb9a1[_0xbd90('0x60')][_0xbd90('0xb0')]){_0x19b6fb=util['format']('LOCAL/%s@from-sip/n',_0x97ba75[_0x3eb9a1[_0xbd90('0x60')][_0xbd90('0xb0')]]);}else if(_0x3eb9a1[_0xbd90('0x60')]['intrf']){_0x19b6fb=util[_0xbd90('0xc9')](_0xbd90('0xb1'),_0x3eb9a1[_0xbd90('0x60')]['intrf']);}else{_0x19b6fb=util['format'](_0xbd90('0xb1'),_0x97ba75[_0xbd90('0x8b')]);}socket['to'](util[_0xbd90('0xc9')]('user:%s',_0x97ba75[_0xbd90('0x8b')]))[_0xbd90('0x2c')](_0xbd90('0xf1'),{'user':{'id':_0x97ba75['id'],'name':_0x97ba75[_0xbd90('0x8b')]},'ip':_0x3eb9a1['headers']['x-forwarded-for']||_0x3eb9a1[_0xbd90('0xf2')][_0xbd90('0xf3')]||_0x3eb9a1[_0xbd90('0xf4')][_0xbd90('0xf3')]||_0x3eb9a1[_0xbd90('0xf2')][_0xbd90('0xf4')][_0xbd90('0xf3')]});return new Promise(function(_0x5b63aa,_0x34f0cc){db[_0xbd90('0x6e')][_0xbd90('0xf5')]()[_0xbd90('0x20')](_0x3597a6=>{db[_0xbd90('0xb2')][_0xbd90('0x2e')]({'where':{'membername':_0x97ba75[_0xbd90('0x8b')]},'individualHooks':!![]},{'transaction':_0x3597a6})[_0xbd90('0x20')](function(){return _0x3597a6[_0xbd90('0xf6')]();})[_0xbd90('0x20')](_0x5b63aa)[_0xbd90('0x2a')](_0x34f0cc);});});}}else{throw new db['Sequelize'][(_0xbd90('0x98'))](_0xbd90('0xf7'));}})[_0xbd90('0x20')](function(){if(_0x97ba75){return _0x97ba75[_0xbd90('0xf8')]({'raw':!![]});}})[_0xbd90('0x20')](function(_0x2fa808){if(_0x97ba75){if(_0x2fa808){_0x502b93=_0x2fa808;if(_0x502b93['length']){var _0x763dc9=_0x502b93[_0xbd90('0x38')](function(_0x559cf4){return{'membername':_0x97ba75[_0xbd90('0x8b')],'UserId':_0x97ba75['id'],'queue_name':_0x559cf4[_0xbd90('0x8b')],'VoiceQueueId':_0x559cf4['id'],'interface':_0x19b6fb,'paused':_0x97ba75[_0xbd90('0xf0')]||![],'penalty':_0x559cf4[_0xbd90('0xf9')]||0x0};});return db[_0xbd90('0xb2')][_0xbd90('0x8d')](_0x763dc9);}}}})[_0xbd90('0x20')](function(){if(_0x97ba75){return db['MemberReport']['findAll']({'where':{'membername':_0x97ba75[_0xbd90('0x8b')],'exitAt':null}});}})[_0xbd90('0x20')](function(_0xa3aa43){if(_0x97ba75){var _0x20d027=[];_0xa3aa43[_0xbd90('0xfa')](function(_0x44f1d4){_0x20d027['push'](_0x44f1d4[_0xbd90('0x5f')]({'exitAt':moment()['format'](_0xbd90('0xfb'))}));});return Promise[_0xbd90('0x5b')](_0x20d027);}})[_0xbd90('0x20')](function(){if(_0x97ba75){var _0x48ca8b=[];var _0x7c3902=[];var _0x53741f=utils[_0xbd90('0xfc')]();var _0xcd4ebd={'membername':_0x97ba75[_0xbd90('0x8b')],'interface':_0x19b6fb,'enterAt':moment()[_0xbd90('0xc9')](_0xbd90('0xfb')),'role':_0x97ba75['role'],'internal':_0x97ba75['internal']};_0x53741f[_0xbd90('0xfa')](function(_0xa68f9f){_0x48ca8b[_0xbd90('0x50')](_[_0xbd90('0x5d')]({'channel':_0xa68f9f,'type':_0xbd90('0xfd'),'data1':_0x3eb9a1['body'][_0xbd90('0xfe')],'data2':_0x19b6fb},_0xcd4ebd));if(_0x97ba75['loginInPause']){_0x7c3902[_0xbd90('0x50')](_['merge']({'channel':_0xa68f9f,'type':'PAUSE','data1':'LOGININPAUSE'},_0xcd4ebd));}});return db[_0xbd90('0xff')][_0xbd90('0x8d')](_0x48ca8b['concat'](_0x7c3902),{'individualHooks':!![]});}})['then'](function(){if(_0x97ba75){return _0x97ba75[_0xbd90('0x5f')]({'online':!![],'lastLoginAt':moment()['format'](_0xbd90('0xfb')),'voicePause':_0x97ba75[_0xbd90('0xf0')]||![],'mailPause':_0x97ba75[_0xbd90('0xf0')]||![],'chatPause':_0x97ba75[_0xbd90('0xf0')]||![],'faxPause':_0x97ba75[_0xbd90('0xf0')]||![],'smsPause':_0x97ba75[_0xbd90('0xf0')]||![],'openchannelPause':_0x97ba75[_0xbd90('0xf0')]||![],'whatsappPause':_0x97ba75['loginInPause']||![],'pauseType':_0x97ba75[_0xbd90('0xf0')]?_0xbd90('0x100'):null,'interface':_0x19b6fb,'lastPauseAt':moment()['format'](_0xbd90('0xfb'))});}})[_0xbd90('0x20')](function(_0x43220d){if(_0x3eb9a1['isMiddleware']){return _0x14697e();}else{return Promise['resolve'](_0x43220d)[_0xbd90('0x20')](respondWithResult(_0x1ea3f3,null));}})['catch'](handleError(_0x1ea3f3,null));};exports[_0xbd90('0x101')]=function(_0x4ab0eb,_0x34d2db){var _0x554590;return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x4ab0eb[_0xbd90('0x5c')]['id'],'role':'agent'},'attributes':['id',_0xbd90('0x8b'),_0xbd90('0x30')]})['then'](handleEntityNotFound(_0x34d2db,null))[_0xbd90('0x20')](function(_0x2264d9){if(_0x2264d9){_0x554590=_0x2264d9;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x554590[_0xbd90('0x8b')]},'individualHooks':!![]});}})[_0xbd90('0x20')](function(){return db[_0xbd90('0xff')][_0xbd90('0x51')]({'where':{'membername':_0x554590[_0xbd90('0x8b')],'exitAt':null}});})[_0xbd90('0x20')](function(_0x3120bf){var _0x13f868=[];_0x3120bf[_0xbd90('0xfa')](function(_0x25df24){_0x13f868[_0xbd90('0x50')](_0x25df24[_0xbd90('0x5f')]({'exitAt':moment()[_0xbd90('0xc9')](_0xbd90('0xfb'))}));});return Promise[_0xbd90('0x5b')](_0x13f868);})[_0xbd90('0x20')](function(){return _0x554590[_0xbd90('0x5f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbd90('0x20')](respondWithResult(_0x34d2db,null))[_0xbd90('0x2a')](handleError(_0x34d2db,null));};exports['pause']=function(_0x5119e2,_0x122221){var _0x16f249;return db['UserVoiceQueueRt'][_0xbd90('0x5f')]({'paused':0x1},{'where':{'UserId':_0x5119e2[_0xbd90('0x5c')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x5119e2[_0xbd90('0x5c')]['id'],'role':_0xbd90('0x2b')},'attributes':['id',_0xbd90('0x8b'),_0xbd90('0x30'),_0xbd90('0x66'),_0xbd90('0xb0'),_0xbd90('0xaf')]});})[_0xbd90('0x20')](handleEntityNotFound(_0x122221,null))[_0xbd90('0x20')](function(_0x5af3d8){if(_0x5af3d8){_0x16f249=_0x5af3d8;return respondWithRpcPromise(_0xbd90('0x102'),'pause',{'id':_0x16f249['id'],'name':_0x16f249[_0xbd90('0x8b')],'pause':!![]});}})[_0xbd90('0x20')](function(){if(_0x16f249){return db['MemberReport'][_0xbd90('0x51')]({'where':{'membername':_0x16f249[_0xbd90('0x8b')],'type':_0xbd90('0x103'),'exitAt':null}});}})[_0xbd90('0x20')](function(_0x3ebcbe){if(_0x3ebcbe[_0xbd90('0x72')]){var _0x92f356=moment()['format'](_0xbd90('0xfb'));for(var _0x7aa213=0x0,_0x3c6220=_0x3ebcbe['length'];_0x7aa213<_0x3c6220;_0x7aa213++){_0x3ebcbe[_0x7aa213]['updateAttributes']({'exitAt':_0x92f356});}}})[_0xbd90('0x20')](function(){var _0x162005=[];var _0x42d813=utils[_0xbd90('0xfc')]();_0x42d813[_0xbd90('0xfa')](function(_0x16c9fa){_0x162005[_0xbd90('0x50')]({'channel':_0x16c9fa,'membername':_0x16f249[_0xbd90('0x8b')],'interface':_[_0xbd90('0x6d')](_0x16f249['interface'])?util[_0xbd90('0xc9')](_0xbd90('0xb1'),_0x16f249['name']):_0x16f249[_0xbd90('0xb0')],'type':_0xbd90('0x103'),'enterAt':moment()[_0xbd90('0xc9')](_0xbd90('0xfb')),'data1':_0x5119e2['body']['type']||_0xbd90('0x104'),'role':_0x16f249[_0xbd90('0x30')],'internal':_0x16f249[_0xbd90('0x66')]});});return db[_0xbd90('0xff')][_0xbd90('0x8d')](_0x162005,{'individualHooks':!![]});})[_0xbd90('0x20')](function(){return _0x16f249['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5119e2[_0xbd90('0x60')][_0xbd90('0x40')]||_0xbd90('0x104'),'lastPauseAt':moment()[_0xbd90('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x122221,null))[_0xbd90('0x2a')](handleError(_0x122221,null));};exports[_0xbd90('0x105')]=function(_0x1f612c,_0x1a355c){if(_0x1f612c['body'][_0xbd90('0xa3')]&&!utils[_0xbd90('0xb5')](_0x1f612c[_0xbd90('0x60')]['channel'])){throw new APIBadRequestError(util[_0xbd90('0xc9')](_0xbd90('0x106'),_0x1f612c[_0xbd90('0x60')][_0xbd90('0xa3')]));}return db[_0xbd90('0x61')][_0xbd90('0x3b')]({'where':{'id':_0x1f612c[_0xbd90('0x5c')]['id']},'attributes':['id',_0xbd90('0x8b'),_0xbd90('0x30'),_0xbd90('0x66'),_0xbd90('0xb0'),_0xbd90('0xaf'),'voicePause',_0xbd90('0x107'),_0xbd90('0x108'),'faxPause',_0xbd90('0x109'),'smsPause',_0xbd90('0x10a'),_0xbd90('0x10b'),_0xbd90('0x10c')]})[_0xbd90('0x20')](function(_0x3ec98b){if(!_0x3ec98b){throw new APINotFoundError(util['format'](_0xbd90('0x10d'),_0x1f612c[_0xbd90('0x5c')]['id']));}return _0x3ec98b[_0xbd90('0x105')](_0x1f612c['body'][_0xbd90('0xa3')]);})[_0xbd90('0x20')](respondWithResult(_0x1a355c,null))[_0xbd90('0x2a')](APIHandleError(_0x1a355c));};exports['getTeams']=function(_0x20e5d1,_0x842789){var _0x3fea2d={};var _0x36695d={};var _0x461066;var _0x2b152d;return db[_0xbd90('0x61')]['findOne']({'where':{'id':_0x20e5d1[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x842789,null))['then'](function(_0x3d0dab){if(_0x3d0dab){_0x461066=_0x3d0dab;_0x36695d[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0x10e')][_0xbd90('0x3e')]);_0x36695d[_0xbd90('0x49')]=_['keys'](_0x20e5d1['query']);_0x36695d[_0xbd90('0xd9')]=_[_0xbd90('0xd5')](_0x36695d[_0xbd90('0xd2')],_0x36695d[_0xbd90('0x49')]);_0x3fea2d[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x36695d[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x20e5d1[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x3fea2d[_0xbd90('0x4f')]=_0x3fea2d[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x3fea2d[_0xbd90('0x4f')]:_0x36695d[_0xbd90('0xd2')];_0x3fea2d['order']=qs['sort'](_0x20e5d1[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x3fea2d['where']=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x20e5d1['query'],_0x36695d[_0xbd90('0xd9')]));if(_0x20e5d1['query']['filter']){_0x3fea2d[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x3fea2d[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x3fea2d[_0xbd90('0x4f')],function(_0xce793f){var _0x32c1bc={};_0x32c1bc[_0xce793f]={'$like':'%'+_0x20e5d1[_0xbd90('0x49')]['filter']+'%'};return _0x32c1bc;})});}_0x3fea2d=_['merge']({},_0x3fea2d,_0x20e5d1[_0xbd90('0x5e')]);return _0x461066[_0xbd90('0x10f')](_0x3fea2d);}})['then'](function(_0x5cf500){if(_0x5cf500){_0x2b152d=_0x5cf500[_0xbd90('0x72')];if(!_0x20e5d1['query']['hasOwnProperty'](_0xbd90('0xdc'))){_0x3fea2d[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x20e5d1[_0xbd90('0x49')]['limit']);_0x3fea2d[_0xbd90('0x1a')]=qs[_0xbd90('0x1a')](_0x20e5d1['query'][_0xbd90('0x1a')]);}return _0x461066[_0xbd90('0x10f')](_0x3fea2d);}})[_0xbd90('0x20')](function(_0xba1e7d){if(_0xba1e7d){return _0xba1e7d?{'count':_0x2b152d,'rows':_0xba1e7d}:null;}})['then'](respondWithResult(_0x842789,null))['catch'](handleError(_0x842789,null));};exports[_0xbd90('0x110')]=function(_0x445310,_0x50c14d){var _0x20782b=_0x445310[_0xbd90('0x5c')]['id'];var _0x5930ca=_0x445310[_0xbd90('0x60')]?_0x445310[_0xbd90('0x60')][_0xbd90('0x64')]:null;var _0x19adc7=[];return Promise[_0xbd90('0x111')]()['then'](function(){if(!_0x5930ca)throw new APIBadRequestError(_0xbd90('0x112'));})['then'](function(){return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x20782b}});})['then'](function(_0x5816b4){if(!_0x5816b4)throw new APINotFoundError(util[_0xbd90('0xc9')](_0xbd90('0x10d'),_0x445310[_0xbd90('0x5c')]['id']));return db[_0xbd90('0x6e')]['transaction'](function(_0x450090){return _0x5816b4[_0xbd90('0x110')](_0x5930ca,{'transaction':_0x450090})['then'](function(){return db[_0xbd90('0x10e')][_0xbd90('0x51')]({'where':{'id':{'$in':_0x5930ca}}});})['then'](function(_0x2c4511){var _0x5e9fdf=_[_0xbd90('0x38')](_0x2c4511,function(_0x4f6589){return _0x4f6589[_0xbd90('0x113')]();});return Promise[_0xbd90('0x5b')](_0x5e9fdf);})[_0xbd90('0x20')](function(_0x2125fb){_0x19adc7=_[_0xbd90('0x114')](_0x2125fb);var _0x544dfe=_['map'](_0x19adc7,function(_0x5c5716){return _0x5c5716['addAgent'](_0x5816b4['id'],{'transaction':_0x450090});});return Promise[_0xbd90('0x5b')](_0x544dfe);})[_0xbd90('0x20')](function(){if(!_0x5816b4[_0xbd90('0xaf')])return;var _0x4f31a6=_[_0xbd90('0x36')](_0x19adc7,function(_0x4a9690){return _0x4a9690['getDataValue'](_0xbd90('0xa3'))==='Voice';});var _0x95138a=_[_0xbd90('0x38')](_0x4f31a6,function(_0x47da11){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5816b4['name'],'UserId':_0x5816b4['id'],'queue_name':_0x47da11[_0xbd90('0x8b')],'VoiceQueueId':_0x47da11['id'],'interface':_[_0xbd90('0x6d')](_0x5816b4[_0xbd90('0xb0')])?util[_0xbd90('0xc9')]('SIP/%s',_0x5816b4[_0xbd90('0x8b')]):_0x5816b4[_0xbd90('0xb0')],'paused':_0x5816b4[_0xbd90('0xa4')]||![],'penalty':_0x5816b4[_0xbd90('0xa9')]},{'transaction':_0x450090});});return Promise[_0xbd90('0x5b')](_0x95138a);})['then'](function(){return db[_0xbd90('0x115')]['findAll']({'where':{'teamId':{'$in':_0x5930ca}}});})['then'](function(_0xe66c08){var _0x28f2b8=_[_0xbd90('0x38')](_0xe66c08,function(_0xce0412){return db['UserVoicePrefix'][_0xbd90('0x82')]({'UserId':_0x5816b4['id'],'VoicePrefixId':_0xce0412[_0xbd90('0x116')]},{'transaction':_0x450090});});return Promise[_0xbd90('0x5b')](_0x28f2b8);});});})[_0xbd90('0x20')](function(){for(var _0x25f662=0x0;_0x25f662<_0x19adc7[_0xbd90('0x72')];_0x25f662++){var _0x33bd9e=_0x19adc7[_0x25f662]['getDataValue'](_0xbd90('0xa3'));var _0x8139b7=_0x33bd9e+_0xbd90('0xab');socket[_0xbd90('0x2c')]('user'+_0x33bd9e+_0xbd90('0xac'),{'UserId':_0x20782b,['queueField']:_0x19adc7[_0x25f662]['id']});}})['then'](respondWithStatusCode(_0x50c14d,null))[_0xbd90('0x2a')](APIHandleError(_0x50c14d));};exports[_0xbd90('0x117')]=function(_0x279fb7,_0x241430){var _0x20c0e2=_0x279fb7[_0xbd90('0x5c')]['id'];var _0x3285f7=null;if(_0x279fb7[_0xbd90('0x49')][_0xbd90('0x64')]){_0x3285f7=_[_0xbd90('0xb6')](_0x279fb7[_0xbd90('0x49')][_0xbd90('0x64')])?_0x279fb7['query'][_0xbd90('0x64')]:[_0x279fb7[_0xbd90('0x49')][_0xbd90('0x64')]];}var _0x2e634e=[];return Promise[_0xbd90('0x111')]()[_0xbd90('0x20')](function(){if(!_0x3285f7)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xbd90('0x20')](function(){return db['User'][_0xbd90('0x9c')]({'where':{'id':_0x20c0e2}});})[_0xbd90('0x20')](function(_0x10e092){if(!_0x10e092)throw new APINotFoundError(util[_0xbd90('0xc9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x279fb7[_0xbd90('0x5c')]['id']));return db[_0xbd90('0x6e')][_0xbd90('0xf5')](function(_0x24e9f8){return _0x10e092['removeTeams'](_0x3285f7,{'transaction':_0x24e9f8})[_0xbd90('0x20')](function(){return db[_0xbd90('0x10e')][_0xbd90('0x51')]({'where':{'id':{'$in':_0x3285f7}}});})[_0xbd90('0x20')](function(_0x53eef7){var _0x5239ee=_[_0xbd90('0x38')](_0x53eef7,function(_0x5e0118){return _0x5e0118[_0xbd90('0x113')]();});return Promise[_0xbd90('0x5b')](_0x5239ee);})[_0xbd90('0x20')](function(_0x298749){_0x2e634e=_[_0xbd90('0x114')](_0x298749);var _0x279461=_[_0xbd90('0x38')](_0x2e634e,function(_0xdb2567){return _0xdb2567[_0xbd90('0x118')](_0x10e092['id'],{'transaction':_0x24e9f8});});return Promise[_0xbd90('0x5b')](_0x279461);})[_0xbd90('0x20')](function(){if(!_0x10e092[_0xbd90('0xaf')])return;var _0x5c5536=_[_0xbd90('0x36')](_0x2e634e,function(_0x271717){return _0x271717[_0xbd90('0x119')](_0xbd90('0xa3'))===_0xbd90('0x11a');});var _0x85b7ad=_[_0xbd90('0x38')](_0x5c5536,function(_0x239567){return db[_0xbd90('0xb2')][_0xbd90('0x2e')]({'where':{'VoiceQueueId':_0x239567['id'],'UserId':_0x10e092['id']},'transaction':_0x24e9f8});});return Promise[_0xbd90('0x5b')](_0x85b7ad);})[_0xbd90('0x20')](function(){return db[_0xbd90('0x115')][_0xbd90('0x51')]({'where':{'teamId':{'$in':_0x3285f7}}});})['then'](function(_0x506bb6){var _0x5b9356=_[_0xbd90('0x38')](_0x506bb6,function(_0x519861){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x10e092['id'],'VoicePrefixId':_0x519861['VoicePrefixId']}},{'transaction':_0x24e9f8});});return Promise[_0xbd90('0x5b')](_0x5b9356);});});})['then'](function(){for(var _0x4042ea=0x0;_0x4042ea<_0x2e634e[_0xbd90('0x72')];_0x4042ea++){var _0x1164cb=_0x2e634e[_0x4042ea][_0xbd90('0x119')](_0xbd90('0xa3'));var _0x1254b6=_0x1164cb+'QueueId';socket['emit'](_0xbd90('0x83')+_0x1164cb+'Queue:remove',{'UserId':_0x20c0e2,['queueField']:_0x2e634e[_0x4042ea]['id']});}})[_0xbd90('0x20')](respondWithStatusCode(_0x241430,null))['catch'](APIHandleError(_0x241430));};exports[_0xbd90('0x11b')]=function(_0x548cf4,_0x1099bc){var _0x103be4={};var _0x57cb68={};var _0x910da4;var _0x431f5b;return db['User'][_0xbd90('0x9c')]({'where':{'id':_0x548cf4['params']['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x1099bc,null))[_0xbd90('0x20')](function(_0x496221){if(_0x496221){_0x910da4=_0x496221;_0x57cb68[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db['CmList'][_0xbd90('0x3e')]);_0x57cb68[_0xbd90('0x49')]=_[_0xbd90('0xd4')](_0x548cf4['query']);_0x57cb68[_0xbd90('0xd9')]=_[_0xbd90('0xd5')](_0x57cb68['model'],_0x57cb68[_0xbd90('0x49')]);_0x103be4[_0xbd90('0x4f')]=_['intersection'](_0x57cb68[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x548cf4['query']['fields']));_0x103be4[_0xbd90('0x4f')]=_0x103be4[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x103be4[_0xbd90('0x4f')]:_0x57cb68[_0xbd90('0xd2')];_0x103be4['order']=qs[_0xbd90('0xd8')](_0x548cf4[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x103be4['where']=qs[_0xbd90('0xd9')](_[_0xbd90('0xda')](_0x548cf4[_0xbd90('0x49')],_0x57cb68[_0xbd90('0xd9')]));if(_0x548cf4[_0xbd90('0x49')][_0xbd90('0x36')]){_0x103be4['where']=_[_0xbd90('0x5d')](_0x103be4[_0xbd90('0x48')],{'$or':_[_0xbd90('0x38')](_0x103be4['attributes'],function(_0x2bf2e6){var _0x37fffc={};_0x37fffc[_0x2bf2e6]={'$like':'%'+_0x548cf4[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x37fffc;})});}_0x103be4=_[_0xbd90('0x5d')]({},_0x103be4,_0x548cf4[_0xbd90('0x5e')]);return _0x910da4[_0xbd90('0x11b')](_0x103be4);}})['then'](function(_0x104427){if(_0x104427){_0x431f5b=_0x104427[_0xbd90('0x72')];if(!_0x548cf4['query']['hasOwnProperty'](_0xbd90('0xdc'))){_0x103be4[_0xbd90('0x1c')]=qs[_0xbd90('0x1c')](_0x548cf4[_0xbd90('0x49')][_0xbd90('0x1c')]);_0x103be4[_0xbd90('0x1a')]=qs['offset'](_0x548cf4[_0xbd90('0x49')][_0xbd90('0x1a')]);}return _0x910da4[_0xbd90('0x11b')](_0x103be4);}})[_0xbd90('0x20')](function(_0x6347ac){if(_0x6347ac){return _0x6347ac?{'count':_0x431f5b,'rows':_0x6347ac}:null;}})[_0xbd90('0x20')](respondWithResult(_0x1099bc,null))['catch'](handleError(_0x1099bc,null));};exports[_0xbd90('0x11c')]=function(_0x45c08d,_0x399179){var _0x379532={};var _0x338c28={};var _0x2d5e25;return db[_0xbd90('0x61')][_0xbd90('0x9c')]({'where':{'id':_0x45c08d[_0xbd90('0x5c')]['id']}})[_0xbd90('0x20')](handleEntityNotFound(_0x399179,null))[_0xbd90('0x20')](function(_0x2011fd){if(_0x2011fd){_0x2d5e25=_0x2011fd;_0x338c28[_0xbd90('0xd2')]=_[_0xbd90('0xd4')](db[_0xbd90('0x61')][_0xbd90('0x3e')]);_0x338c28[_0xbd90('0x49')]=_['keys'](_0x45c08d[_0xbd90('0x49')]);_0x338c28['filters']=_[_0xbd90('0xd5')](_0x338c28[_0xbd90('0xd2')],_0x338c28['query']);_0x379532[_0xbd90('0x4f')]=_[_0xbd90('0xd5')](_0x338c28[_0xbd90('0xd2')],qs[_0xbd90('0xd6')](_0x45c08d[_0xbd90('0x49')][_0xbd90('0xd6')]));_0x379532['attributes']=_0x379532[_0xbd90('0x4f')][_0xbd90('0x72')]?_0x379532[_0xbd90('0x4f')]:_0x338c28['model'];_0x379532[_0xbd90('0xd7')]=qs['sort'](_0x45c08d[_0xbd90('0x49')][_0xbd90('0xd8')]);_0x379532[_0xbd90('0x48')]=qs[_0xbd90('0xd9')](_['pick'](_0x45c08d[_0xbd90('0x49')],_0x338c28['filters']));if(_0x45c08d[_0xbd90('0x49')]['filter']){_0x379532[_0xbd90('0x48')]=_[_0xbd90('0x5d')](_0x379532[_0xbd90('0x48')],{'$or':_['map'](_0x379532[_0xbd90('0x4f')],function(_0x1117cd){var _0x2c53cd={};_0x2c53cd[_0x1117cd]={'$like':'%'+_0x45c08d[_0xbd90('0x49')][_0xbd90('0x36')]+'%'};return _0x2c53cd;})});}_0x379532[_0xbd90('0xd2')]=db[_0xbd90('0x61')];_0x379532['as']=_0xbd90('0x33');_0x379532=_[_0xbd90('0x5d')]({},_0x379532,_0x45c08d[_0xbd90('0x5e')]);return _0x2d5e25[_0xbd90('0xf8')]({'include':[_0x379532]});}})[_0xbd90('0x20')](function(_0x10739d){if(_0x10739d){var _0x4ead45={},_0x1c15db=[];for(var _0x38835b=0x0;_0x38835b<_0x10739d[_0xbd90('0x72')];_0x38835b+=0x1){for(var _0x1c5db8=0x0,_0x730cea;_0x1c5db8<_0x10739d[_0x38835b][_0xbd90('0x33')]['length'];_0x1c5db8+=0x1){_0x730cea=_0x10739d[_0x38835b][_0xbd90('0x33')][_0x1c5db8]['get']({'plain':!![]});_0x4ead45[_0x730cea['id']]=_0x730cea;}}_0x4ead45=_[_0xbd90('0x11d')](_0x4ead45);for(var _0x36c80c=qs[_0xbd90('0x1a')](_0x45c08d[_0xbd90('0x49')][_0xbd90('0x1a')]);_0x36c80c<_0x4ead45[_0xbd90('0x72')]&&_0x1c15db['length']=_0x11d927){_0x391cb0=_0x11d927;_0x216924=0xc8;}else{_0x216924=0xce;}_0x522989['status'](_0x216924);return _0x522989[_0x846f('0x1c')](_0x846f('0x1d'),_0x172bcf+'-'+_0x391cb0+'/'+_0x11d927)[_0x846f('0x18')](_0x151806);}return null;};}function respondWithRpcPromise(_0x581eb7,_0xbce8d8,_0x2d33f0,_0x6c1f80){return new Promise(function(_0x3b869a,_0x26c8de){var _0x380261=_0x6c1f80||amiClient;return _0x380261[_0x846f('0x1e')](_0x581eb7,_0x2d33f0)[_0x846f('0x1f')](function(_0x2247a4){logger[_0x846f('0x20')](_0x846f('0x21'),_0xbce8d8,_0x846f('0x22'));logger['debug'](_0x846f('0x23'),_0xbce8d8,_0x846f('0x22'),JSON[_0x846f('0x24')](_0x2247a4));if(_0x2247a4[_0x846f('0x25')]){if(_0x2247a4['error'][_0x846f('0x26')]===0x1f4){logger[_0x846f('0x25')]('User,\x20%s,\x20%s',_0xbce8d8,_0x2247a4[_0x846f('0x25')][_0x846f('0x27')]);return _0x26c8de(_0x2247a4[_0x846f('0x25')]['message']);}logger['error'](_0x846f('0x21'),_0xbce8d8,_0x2247a4[_0x846f('0x25')][_0x846f('0x27')]);return _0x3b869a(_0x2247a4['error'][_0x846f('0x27')]);}else{logger[_0x846f('0x20')]('User,\x20%s,\x20%s',_0xbce8d8,_0x846f('0x22'));_0x3b869a(_0x2247a4[_0x846f('0x28')][_0x846f('0x27')]);}})[_0x846f('0x29')](function(_0x231e1a){logger[_0x846f('0x25')](_0x846f('0x21'),_0xbce8d8,_0x231e1a);_0x26c8de(_0x231e1a);});});}function saveUpdates(_0x59aa2a){return function(_0x5dddb5){if(_0x5dddb5){return _0x5dddb5[_0x846f('0x2a')](_0x59aa2a)[_0x846f('0x1f')](function(_0x5130da){if(_0x5130da[_0x846f('0x2b')]==='agent'){socket['emit'](_0x846f('0x2c')+_0x5130da['id'],_0x5130da);}return _0x5130da;});}return null;};}function removeEntity(_0x3848ce,_0x558299){return function(_0x4d946d){if(_0x4d946d){return _0x4d946d['destroy']({'transaction':_0x558299})[_0x846f('0x1f')](function(){var _0x13ff90=_0x4d946d[_0x846f('0x2d')]({'plain':!![]});if(_0x13ff90[_0x846f('0x2b')]===_0x846f('0x2e'))return;var _0x2f2426=[{'name':_0x846f('0x2f'),'value':_0x846f('0x30'),'ignore':!![]},{'name':_0x846f('0x31'),'value':'agent','ignore':![]},{'name':_0x846f('0x32'),'value':_0x846f('0x33'),'ignore':![]}];var _0x38e4a6=_(_0x2f2426)[_0x846f('0x34')](_0x846f('0x35'))[_0x846f('0x36')](_0x846f('0x37'))['value']();if(_['includes'](_0x38e4a6,_0x13ff90[_0x846f('0x2b')])){return;}var _0x5819b8=_[_0x846f('0x38')](_0x2f2426,[_0x846f('0x37'),_0x13ff90[_0x846f('0x2b')]])[_0x846f('0x39')];return db[_0x846f('0x3a')][_0x846f('0x3b')]({'where':{'type':_0x5819b8,'resourceId':_0x13ff90['id']},'transaction':_0x558299})[_0x846f('0x1f')](function(){return _0x4d946d;});})['then'](function(){_0x3848ce['status'](0xcc)[_0x846f('0x3c')]();});}};}function handleEntityNotFound(_0x7c7d2a){return function(_0x3a8447){if(!_0x3a8447){_0x7c7d2a['sendStatus'](0x194);}return _0x3a8447;};}function handleError(_0x495fda,_0x5d296f){_0x5d296f=_0x5d296f||0x1f4;return function(_0xf50bb6){logger['error'](_0xf50bb6['stack']);if(_0xf50bb6['name']){delete _0xf50bb6[_0x846f('0x39')];}_0x495fda[_0x846f('0x17')](_0x5d296f)[_0x846f('0x3d')](_0xf50bb6);};}function getUserAttributes(){return _(db['User'][_0x846f('0x3e')])['map'](function(_0x406c9b){return{'name':_0x406c9b['fieldName'],'type':_0x406c9b[_0x846f('0x3f')][_0x846f('0x40')]};})['filter'](function(_0x3ba32a){return!['password',_0x846f('0x41'),_0x846f('0x42'),'resetPasswordToken',_0x846f('0x43'),_0x846f('0x44')][_0x846f('0x45')](_0x3ba32a['name']);})[_0x846f('0x37')]();}exports[_0x846f('0x46')]=function(_0x570ec8,_0xa89df0){var _0x42b0ef={},_0x59166d={'count':0x0,'rows':[]};var _0x51a80c=getUserAttributes();_0x42b0ef=qs[_0x846f('0x47')](_0x51a80c,_0x570ec8);var _0x194e93={'where':_0x42b0ef[_0x846f('0x48')]};return db[_0x846f('0x49')]['count'](_0x194e93)[_0x846f('0x1f')](function(_0x24f48c){_0x59166d[_0x846f('0x4a')]=_0x24f48c;if(_0x570ec8['query'][_0x846f('0x4b')]){_0x42b0ef[_0x846f('0x4c')]=[{'all':!![]}];}if(_0x570ec8[_0x846f('0x4d')]['userSetting']==='true'){_0x42b0ef['include']=[{'model':db[_0x846f('0x4e')],'as':_0x846f('0x4f')}];}if(!_[_0x846f('0x45')](_0x42b0ef['attributes'],'id')){_0x42b0ef[_0x846f('0x50')][_0x846f('0x51')]('id');}return db[_0x846f('0x49')][_0x846f('0x52')](_0x42b0ef);})[_0x846f('0x1f')](function(_0x4e9014){_0x59166d[_0x846f('0x53')]=_0x4e9014;if(_0x570ec8[_0x846f('0x4d')][_0x846f('0x54')]===_0x846f('0x55')){var _0x30c935=[];for(var _0x439b85=0x0;_0x439b85<_0x59166d[_0x846f('0x53')][_0x846f('0x56')];_0x439b85++){_0x30c935[_0x846f('0x51')](get_open_tabs(_0x846f('0x57'),_0x59166d[_0x846f('0x53')][_0x439b85]['dataValues']));_0x30c935['push'](get_open_tabs(_0x846f('0x58'),_0x59166d['rows'][_0x439b85][_0x846f('0x59')]));_0x30c935[_0x846f('0x51')](get_open_tabs(_0x846f('0x5a'),_0x59166d[_0x846f('0x53')][_0x439b85][_0x846f('0x59')]));_0x30c935['push'](get_open_tabs(_0x846f('0x5b'),_0x59166d['rows'][_0x439b85][_0x846f('0x59')]));_0x30c935[_0x846f('0x51')](get_open_tabs(_0x846f('0x5c'),_0x59166d[_0x846f('0x53')][_0x439b85]['dataValues']));_0x30c935[_0x846f('0x51')](get_open_tabs(_0x846f('0x5d'),_0x59166d['rows'][_0x439b85][_0x846f('0x59')]));}return Promise[_0x846f('0x5e')](_0x30c935)[_0x846f('0x1f')](function(){return _0x59166d;});}else{return _0x59166d;}})[_0x846f('0x1f')](respondWithFilteredResult(_0xa89df0,_0x42b0ef))[_0x846f('0x29')](handleError(_0xa89df0,null));};exports['show']=function(_0x5b1b72,_0x2fcc67){var _0x5e2ca1=getUserAttributes();_0x5b1b72[_0x846f('0x4d')]['id']=_0x5b1b72[_0x846f('0x5f')]['id'];var _0x7fe46b=qs[_0x846f('0x47')](_0x5e2ca1,_0x5b1b72);if(_0x5b1b72['query']['includeAll']){_0x7fe46b['include']=[{'all':!![]}];}if(_0x5b1b72[_0x846f('0x4d')][_0x846f('0x4f')]==='true'){_0x7fe46b[_0x846f('0x4c')]=[{'model':db[_0x846f('0x4e')],'as':'userSetting'}];}_0x7fe46b=_[_0x846f('0x60')]({},_0x7fe46b,_0x5b1b72[_0x846f('0x61')]);if(!_[_0x846f('0x45')](_0x7fe46b[_0x846f('0x50')],'id')){_0x7fe46b['attributes'][_0x846f('0x51')]('id');}return db[_0x846f('0x49')][_0x846f('0x38')](_0x7fe46b)[_0x846f('0x1f')](handleEntityNotFound(_0x2fcc67,null))[_0x846f('0x1f')](function(_0x73d4e0){var _0x242eff=[];values=_0x73d4e0;if(_0x5b1b72[_0x846f('0x4d')][_0x846f('0x54')]===_0x846f('0x55')){_0x242eff['push'](get_open_tabs(_0x846f('0x57'),_0x73d4e0[_0x846f('0x59')]));_0x242eff['push'](get_open_tabs(_0x846f('0x58'),_0x73d4e0[_0x846f('0x59')]));_0x242eff[_0x846f('0x51')](get_open_tabs('openchannel',_0x73d4e0[_0x846f('0x59')]));_0x242eff[_0x846f('0x51')](get_open_tabs(_0x846f('0x5d'),_0x73d4e0[_0x846f('0x59')]));_0x242eff[_0x846f('0x51')](get_open_tabs(_0x846f('0x5a'),_0x73d4e0[_0x846f('0x59')]));_0x242eff['push'](get_open_tabs(_0x846f('0x5b'),_0x73d4e0[_0x846f('0x59')]));return Promise[_0x846f('0x5e')](_0x242eff);}else{return values;}})['then'](function(){return values;})[_0x846f('0x1f')](respondWithResult(_0x2fcc67,null))[_0x846f('0x29')](handleError(_0x2fcc67,null));};exports['update']=function(_0x290ec4,_0x22dbf4){if(_0x290ec4[_0x846f('0x62')]['id']){delete _0x290ec4[_0x846f('0x62')]['id'];}delete _0x290ec4[_0x846f('0x62')][_0x846f('0x2b')];return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x290ec4[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x22dbf4,null))[_0x846f('0x1f')](saveUpdates(_0x290ec4[_0x846f('0x62')],null))['then'](respondWithResult(_0x22dbf4,null))[_0x846f('0x29')](handleError(_0x22dbf4,null));};exports[_0x846f('0x63')]=function(_0x253aa7,_0x4fdc98){return db[_0x846f('0x49')][_0x846f('0x63')]()['then'](respondWithResult(_0x4fdc98,null))[_0x846f('0x29')](handleError(_0x4fdc98,null));};exports[_0x846f('0x64')]=function(_0x37e553,_0x2f4737){return db['User']['find']({'where':{'id':_0x37e553[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x2f4737,null))[_0x846f('0x1f')](function(_0x4a2d41){if(_0x4a2d41){return _0x4a2d41[_0x846f('0x64')](_0x37e553[_0x846f('0x62')][_0x846f('0x65')],_[_0x846f('0x66')](_0x37e553[_0x846f('0x62')],[_0x846f('0x65'),'id'])||{});}})['then'](respondWithResult(_0x2f4737,null))[_0x846f('0x29')](handleError(_0x2f4737,null));};function validateUser(_0x3505e0){return new Promise(function(_0x16a16e,_0x103b3c){if(_0x3505e0[_0x846f('0x67')])return _0x16a16e(_0x3505e0);return db[_0x846f('0x68')][_0x846f('0x69')](0x1)['then'](function(_0x374a44){if(_0x374a44['securePassword'])authService['validatePasswordPattern'](_0x3505e0[_0x846f('0x6a')]);db['User']['max']('internal')[_0x846f('0x1f')](function(_0x2cc0c7){if(_[_0x846f('0x6b')](_0x2cc0c7)){_0x3505e0[_0x846f('0x67')]=_0x374a44[_0x846f('0x6c')]||0x1;return;}if(_[_0x846f('0x6b')](_0x374a44[_0x846f('0x6c')])||_0x374a44['min_internal']===_0x2cc0c7){_0x3505e0['internal']=_0x2cc0c7+0x1;return;}if(_0x374a44['min_internal']>_0x2cc0c7){_0x3505e0[_0x846f('0x67')]=_0x374a44[_0x846f('0x6c')];return;}return db[_0x846f('0x6d')][_0x846f('0x4d')](_0x846f('0x6e'),{'type':db[_0x846f('0x6d')][_0x846f('0x6f')][_0x846f('0x70')]})['then'](function(_0x45766f){if(_0x45766f&&_0x45766f['length']){for(var _0x55d09c=0x0,_0x45681d=_0x45766f[_0x846f('0x56')];_0x55d09c<_0x45681d&&_[_0x846f('0x6b')](_0x3505e0[_0x846f('0x67')]);_0x55d09c++){if(_0x374a44[_0x846f('0x6c')]<=_0x45766f[_0x55d09c]['from']){_0x3505e0[_0x846f('0x67')]=_0x45766f[_0x55d09c]['from'];}else if(_0x374a44[_0x846f('0x6c')]>_0x45766f[_0x55d09c][_0x846f('0x71')]&&_0x374a44[_0x846f('0x6c')]<=_0x45766f[_0x55d09c]['to']){_0x3505e0['internal']=_0x374a44[_0x846f('0x6c')];}}}if(_[_0x846f('0x6b')](_0x3505e0['internal'])){_0x3505e0[_0x846f('0x67')]=_0x2cc0c7+0x1;}return _0x16a16e(_0x3505e0);});});})[_0x846f('0x29')](function(_0x496e30){_0x103b3c(_0x496e30);});});}function updateUser(_0x3d459f){return new Promise(function(_0x529c12,_0x216034){try{if(_0x3d459f[_0x846f('0x72')]){_0x3d459f[_0x846f('0x73')]=_0x3d459f[_0x846f('0x67')];_0x3d459f[_0x846f('0x74')]={'mailbox':_0x3d459f['internal'],'password':_0x3d459f[_0x846f('0x6a')],'fullname':_0x3d459f[_0x846f('0x75')],'email':_0x3d459f[_0x846f('0x76')]};}if(_0x3d459f['role']===_0x846f('0x77')){if(!_0x3d459f[_0x846f('0x78')])_0x3d459f[_0x846f('0x78')]=['101',_0x846f('0x79'),_0x846f('0x7a'),_0x846f('0x7b'),_0x846f('0x7c'),_0x846f('0x7d'),'105',_0x846f('0x7e'),_0x846f('0x7f'),'108','109','100',_0x846f('0x80'),_0x846f('0x81'),'115'];}_0x529c12(_0x3d459f);}catch(_0x35322d){_0x216034(_0x35322d);}});}exports[_0x846f('0x82')]=function(_0x219b77,_0x4a11f8){if(_0x219b77[_0x846f('0x30')][_0x846f('0x2b')]==='agent')throw new Error('Unauthorized');if(_0x219b77[_0x846f('0x62')][_0x846f('0x2b')]===_0x846f('0x30')&&_0x219b77[_0x846f('0x30')][_0x846f('0x2b')]!==_0x846f('0x2e')){throw new Error(_0x846f('0x83'));}if(_0x219b77['body'][_0x846f('0x2b')]===_0x846f('0x2e')&&_0x219b77[_0x846f('0x30')]['role']!=='admin'){throw new Error(_0x846f('0x84'));}return licenseUtil[_0x846f('0x85')]([_0x219b77['body']])[_0x846f('0x1f')](function(){return validateUser(_0x219b77['body']);})[_0x846f('0x1f')](function(_0x321e28){return updateUser(_0x321e28)['then'](function(_0x36c2d6){if(_0x36c2d6['role']===_0x846f('0x2e')){_0x36c2d6[_0x846f('0x86')]=_0x219b77[_0x846f('0x30')][_0x846f('0x86')];delete _0x36c2d6[_0x846f('0x87')];}return _0x36c2d6;});})[_0x846f('0x1f')](function(_0x462577){return db['User']['create'](_0x462577,{'include':[{'model':db[_0x846f('0x74')],'as':_0x846f('0x74')}]});})['then'](function(_0x536298){if(_0x219b77[_0x846f('0x62')][_0x846f('0x2b')]===_0x846f('0x30'))return _0x536298;if(_0x219b77['user'][_0x846f('0x2b')]!=='user')return _0x536298;return db[_0x846f('0x88')][_0x846f('0x38')]({'where':{'name':_0x536298[_0x846f('0x2b')]===_0x846f('0x77')?_0x846f('0x31'):'Telephones','userProfileId':_0x219b77[_0x846f('0x30')][_0x846f('0x87')]},'raw':!![]})[_0x846f('0x1f')](function(_0x8d1d6c){if(!_0x8d1d6c||_0x8d1d6c['autoAssociation']!=0x0)return _0x536298;return db['UserProfileResource']['create']({'name':_0x536298['name'],'resourceId':_0x536298['id'],'type':_0x8d1d6c[_0x846f('0x39')],'sectionId':_0x8d1d6c['id']},{})[_0x846f('0x1f')](function(){return _0x536298;});})[_0x846f('0x29')](function(_0x2a705c){logger[_0x846f('0x25')](_0x846f('0x89'),_0x2a705c);throw _0x2a705c;});})['then'](respondWithResult(_0x4a11f8,0xc9))['catch'](handleError(_0x4a11f8,null));};exports[_0x846f('0x8a')]=function(_0x4bf3bf,_0x495292){var _0xd34153=_0x4bf3bf[_0x846f('0x62')];var _0x1bbb16=[];if(_0x4bf3bf['user'][_0x846f('0x2b')]==='agent')throw new Error('Unauthorized');if(_['some'](_0xd34153,['role',_0x846f('0x30')])&&_0x4bf3bf['user']['role']!=='admin'){throw new Error(_0x846f('0x83'));}if(_[_0x846f('0x8b')](_0xd34153,[_0x846f('0x2b'),_0x846f('0x2e')])&&_0x4bf3bf[_0x846f('0x30')][_0x846f('0x2b')]!==_0x846f('0x2e')){throw new Error(_0x846f('0x8c'));}return licenseUtil[_0x846f('0x85')](_0xd34153)[_0x846f('0x1f')](function(){return validateUser(_0xd34153[0x0]);})['then'](function(){for(var _0x3b3e28=0x1;_0x3b3e28<_0xd34153[_0x846f('0x56')];_0x3b3e28++){var _0xe180b1=_0xd34153[_0x3b3e28-0x1][_0x846f('0x67')];if(!_0xd34153[_0x3b3e28][_0x846f('0x67')])_0xd34153[_0x3b3e28]['internal']=_0xe180b1+0x1;_0x1bbb16[_0x846f('0x51')](validateUser(_0xd34153[_0x3b3e28]));}return Promise[_0x846f('0x5e')](_0x1bbb16);})[_0x846f('0x1f')](function(){_0x1bbb16=[];for(var _0x3c8a47=0x0;_0x3c8a47<_0xd34153[_0x846f('0x56')];_0x3c8a47++){_0x1bbb16[_0x846f('0x51')](updateUser(_0xd34153[_0x3c8a47]));}return Promise['all'](_0x1bbb16);})[_0x846f('0x1f')](function(){_0x1bbb16=_0xd34153['map'](function(_0x56cf8d){return db['User'][_0x846f('0x82')](_0x56cf8d,{'include':[{'model':db['VoiceMail'],'as':_0x846f('0x74')}]})['then'](function(_0x5c4a9f){_0x56cf8d['id']=_0x5c4a9f['id'];return _0x56cf8d;});});return Promise[_0x846f('0x5e')](_0x1bbb16);})['then'](function(_0x1ab1a5){if(_0x4bf3bf[_0x846f('0x62')][_0x846f('0x2b')]==='user')return _0x1ab1a5;if(_0x4bf3bf[_0x846f('0x30')][_0x846f('0x2b')]!==_0x846f('0x30'))return _0x1ab1a5;var _0x473632=_[_0x846f('0x8b')](_0x1ab1a5,function(_0x4bf33a){return _0x4bf33a[_0x846f('0x2b')]==='agent'||_0x4bf33a[_0x846f('0x2b')]===_0x846f('0x33');});if(!_0x473632)return _0x1ab1a5;return db[_0x846f('0x88')][_0x846f('0x52')]({'where':{'name':{'$or':[_0x846f('0x31'),_0x846f('0x32')]},'userProfileId':_0x4bf3bf[_0x846f('0x30')][_0x846f('0x87')]},'raw':!![]})['then'](function(_0x1ffd6b){if(_[_0x846f('0x8d')](_0x1ffd6b)||!_[_0x846f('0x8b')](_0x1ffd6b,[_0x846f('0x8e'),0x0]))return _0x1ab1a5;_0x1bbb16=[];var _0x45e356=_(_0x1ffd6b)[_0x846f('0x36')](function(_0xc50470){if(_0xc50470[_0x846f('0x8e')]===0x1)return;return _0xc50470['name']===_0x846f('0x31')?_0x846f('0x77'):_0x846f('0x33');})['compact']()[_0x846f('0x37')]();for(var _0x57fcdc=0x0;_0x57fcdc<_0x1ab1a5[_0x846f('0x56')];_0x57fcdc++){if(!_[_0x846f('0x45')](_0x45e356,_0x1ab1a5[_0x57fcdc]['role']))return;var _0x1a0392=_0x1ab1a5[_0x57fcdc]['role']===_0x846f('0x77')?_0x846f('0x31'):_0x846f('0x32');_0x1bbb16[_0x846f('0x51')](db[_0x846f('0x3a')][_0x846f('0x82')]({'name':_0x1ab1a5[_0x57fcdc][_0x846f('0x39')],'resourceId':_0x1ab1a5[_0x57fcdc]['id'],'type':_0x1a0392,'sectionId':_[_0x846f('0x38')](_0x1ffd6b,[_0x846f('0x39'),_0x1a0392])['id']},{}));}return Promise['all'](_0x1bbb16);});})['then'](respondWithResult(_0x495292,0xc9))[_0x846f('0x29')](handleError(_0x495292,null));};exports[_0x846f('0x8f')]=function(_0x7a7d33,_0x2b188b){if(_0x7a7d33['body']['id']){delete _0x7a7d33[_0x846f('0x62')]['id'];}return db[_0x846f('0x49')]['find']({'where':{'id':_0x7a7d33[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](function(_0x556e2f){if(!_0x556e2f)return null;if(_0x556e2f['id']===_0x7a7d33[_0x846f('0x30')]['id']){if(!_0x7a7d33[_0x846f('0x62')][_0x846f('0x90')]||!_0x7a7d33[_0x846f('0x62')][_0x846f('0x91')]){throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))](_0x846f('0x94'));}if(!_0x556e2f[_0x846f('0x95')](_0x7a7d33[_0x846f('0x62')]['oldPassword'])){throw new db['Sequelize'][(_0x846f('0x93'))](_0x846f('0x96'));}if(_0x7a7d33[_0x846f('0x62')][_0x846f('0x90')]===_0x7a7d33['body']['newPassword']){throw new db['Sequelize'][(_0x846f('0x93'))](_0x846f('0x97'));}}else if(_0x7a7d33[_0x846f('0x30')][_0x846f('0x2b')]==='admin'){if(!_0x7a7d33[_0x846f('0x62')][_0x846f('0x91')]){throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x7a7d33[_0x846f('0x30')][_0x846f('0x2b')]===_0x846f('0x30')){if(!_0x7a7d33[_0x846f('0x62')]['newPassword']){throw new db[(_0x846f('0x92'))]['ValidationError'](_0x846f('0x98'));}if(_0x556e2f[_0x846f('0x2b')]!==_0x846f('0x77')){throw new db['Sequelize'][(_0x846f('0x93'))](_0x846f('0x99'));}}else{throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))](_0x846f('0x99'));}return _0x556e2f;})['then'](handleEntityNotFound(_0x2b188b,null))[_0x846f('0x1f')](function(_0x33c63f){return db[_0x846f('0x68')][_0x846f('0x9a')]({'attributes':['id',_0x846f('0x9b'),_0x846f('0x9c'),_0x846f('0x9d')]})[_0x846f('0x1f')](function(_0x3987e6){if(_0x3987e6['securePassword'])authService[_0x846f('0x9e')](_0x7a7d33[_0x846f('0x62')][_0x846f('0x91')]);if(!_0x3987e6[_0x846f('0x9c')]||!_0x33c63f[_0x846f('0x42')])return _0x33c63f;authService['validatePasswordHistory'](_0x7a7d33[_0x846f('0x62')]['newPassword'],_0x33c63f[_0x846f('0x42')],_0x3987e6[_0x846f('0x9d')]);return _0x33c63f;})[_0x846f('0x1f')](saveUpdates({'password':_0x7a7d33[_0x846f('0x62')]['newPassword'],'passwordResetAt':_0x7a7d33[_0x846f('0x30')]['id']==_0x7a7d33[_0x846f('0x5f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x7a7d33[_0x846f('0x62')][_0x846f('0x91')],_0x33c63f[_0x846f('0x42')])},null));})['then'](respondWithResult(_0x2b188b,null))['catch'](handleError(_0x2b188b,null));};exports[_0x846f('0x9f')]=function(_0x3411ce,_0x132f1a){var _0x4c9c68=_0x3411ce[_0x846f('0x62')][_0x846f('0xa0')];return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x3411ce[_0x846f('0x5f')]['id']},'attributes':['id',_0x846f('0x39'),_0x846f('0x2b'),_0x846f('0xa1'),_0x846f('0xa2'),'voicePause',_0x846f('0xa3')]})[_0x846f('0x1f')](handleEntityNotFound(_0x132f1a,null))[_0x846f('0x1f')](function(_0x36b196){if(_0x36b196){if(!utils['isValidChannel'](_0x4c9c68)){throw new db['Sequelize'][(_0x846f('0x93'))]('Unknown\x20channel');}return _0x36b196[_0x846f('0xa4')+_[_0x846f('0xa5')](_0x4c9c68['toLowerCase']())+_0x846f('0xa6')](_0x3411ce[_0x846f('0x62')][_0x846f('0x65')],{'penalty':_0x3411ce[_0x846f('0x62')][_0x846f('0xa7')]||0x0})['spread'](function(_0x4f1593){for(var _0x4bbf1f=0x0;_0x4bbf1f<_0x3411ce[_0x846f('0x62')][_0x846f('0x65')][_0x846f('0x56')];_0x4bbf1f+=0x1){var _0x8eb7a={'UserId':Number(_0x3411ce[_0x846f('0x5f')]['id'])};_0x8eb7a[_[_0x846f('0xa5')](_0x4c9c68['toLowerCase']())+'QueueId']=Number(_0x3411ce['body']['ids'][_0x4bbf1f]);socket[_0x846f('0xa8')](_0x846f('0x30')+_[_0x846f('0xa5')](_0x4c9c68['toLowerCase']())+_0x846f('0xa9'),_0x8eb7a);}return _0x4f1593;})[_0x846f('0x1f')](function(){if(_0x4c9c68===_0x846f('0xaa')){return db['VoiceQueue'][_0x846f('0x52')]({'where':{'id':_0x3411ce[_0x846f('0x62')][_0x846f('0x65')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x5c50ff){var _0x1ef08e=_0x36b196['get']({'plain':!![]});var _0x5a42cb=[];if(_0x4c9c68===_0x846f('0xaa')&&_0x1ef08e[_0x846f('0x2b')]==='agent'&&_0x1ef08e['online']){for(let _0x5c4ed1=0x0;_0x5c4ed1<_0x5c50ff['length'];_0x5c4ed1+=0x1){_0x5a42cb[_0x846f('0x51')]({'membername':_0x1ef08e[_0x846f('0x39')],'UserId':_0x1ef08e['id'],'queue_name':_0x5c50ff[_0x5c4ed1][_0x846f('0x39')],'VoiceQueueId':_0x5c50ff[_0x5c4ed1]['id'],'interface':_[_0x846f('0x6b')](_0x1ef08e[_0x846f('0xa3')])?util['format'](_0x846f('0xab'),_0x1ef08e[_0x846f('0x39')]):_0x1ef08e[_0x846f('0xa3')],'paused':_0x1ef08e[_0x846f('0xac')]||![],'penalty':_0x3411ce[_0x846f('0x62')][_0x846f('0xa7')]||0x0});}return Promise[_0x846f('0x5e')](_0x5a42cb[_0x846f('0x36')](function(_0x3675ed){return db[_0x846f('0xad')][_0x846f('0xae')](_0x3675ed);}));}return _0x36b196;});}})[_0x846f('0x1f')](respondWithStatusCode(_0x132f1a,null))['catch'](handleError(_0x132f1a,null));};exports[_0x846f('0xaf')]=function(_0xf5f215,_0x4e934c){var _0x3672a4,_0x367835;return db['User']['find']({'where':{'id':_0xf5f215[_0x846f('0x5f')]['id']},'attributes':['id',_0x846f('0x39'),'role']})[_0x846f('0x1f')](handleEntityNotFound(_0x4e934c,null))['then'](function(_0x2b7910){if(_0x2b7910){_0x3672a4=_0x2b7910;if(!_0xf5f215[_0x846f('0x4d')][_0x846f('0xa0')]||!utils[_0x846f('0xb0')](_0xf5f215[_0x846f('0x4d')]['channel'])){throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))]('Unknown\x20channel');}return _0x2b7910[_0x846f('0xb1')+_[_0x846f('0xa5')](_0xf5f215[_0x846f('0x4d')][_0x846f('0xa0')][_0x846f('0xb2')]())+_0x846f('0xa6')](_0xf5f215[_0x846f('0x4d')][_0x846f('0x65')]);}})[_0x846f('0x1f')](function(_0x5e5c09){if(_[_0x846f('0xb3')](_0xf5f215[_0x846f('0x4d')]['ids'])){for(var _0x589534=0x0;_0x589534<_0xf5f215[_0x846f('0x4d')][_0x846f('0x65')][_0x846f('0x56')];_0x589534+=0x1){_0x367835={'UserId':Number(_0xf5f215[_0x846f('0x5f')]['id'])};_0x367835[_[_0x846f('0xa5')](_0xf5f215['query']['channel'][_0x846f('0xb2')]())+_0x846f('0xb4')]=Number(_0xf5f215[_0x846f('0x4d')][_0x846f('0x65')][_0x589534]);socket['emit'](_0x846f('0x30')+_['capitalize'](_0xf5f215['query'][_0x846f('0xa0')][_0x846f('0xb2')]())+_0x846f('0xb5'),_0x367835);}}else{_0x367835={'UserId':Number(_0xf5f215[_0x846f('0x5f')]['id'])};_0x367835[_[_0x846f('0xa5')](_0xf5f215[_0x846f('0x4d')][_0x846f('0xa0')][_0x846f('0xb2')]())+_0x846f('0xb4')]=Number(_0xf5f215[_0x846f('0x4d')][_0x846f('0x65')]);socket[_0x846f('0xa8')]('user'+_[_0x846f('0xa5')](_0xf5f215[_0x846f('0x4d')][_0x846f('0xa0')][_0x846f('0xb2')]())+'Queue:remove',_0x367835);}return _0x5e5c09;})[_0x846f('0x1f')](function(){if(_0xf5f215['query'][_0x846f('0xa0')]===_0x846f('0xaa')){return db[_0x846f('0xad')][_0x846f('0x3b')]({'where':{'UserId':_0xf5f215[_0x846f('0x5f')]['id'],'VoiceQueueId':_0xf5f215[_0x846f('0x4d')]['ids']},'individualHooks':!![]})[_0x846f('0x1f')](function(){return _0x3672a4;});}return _0x3672a4;})[_0x846f('0x1f')](respondWithStatusCode(_0x4e934c,null))[_0x846f('0x29')](handleError(_0x4e934c,null));};exports['addAvatar']=function(_0x15fec5,_0xedae96){_0x15fec5['body'][_0x846f('0xb6')]=_0x15fec5[_0x846f('0xb7')][_0x846f('0xb8')];return db[_0x846f('0x49')]['find']({'where':{'id':_0x15fec5[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0xedae96,null))[_0x846f('0x1f')](saveUpdates(_0x15fec5[_0x846f('0x62')],null))[_0x846f('0x1f')](respondWithResult(_0xedae96,null))[_0x846f('0x29')](handleError(_0xedae96,null));};exports['getAvatar']=function(_0x122c06,_0x5708f6){var _0x1550a2=path[_0x846f('0xb9')](config[_0x846f('0xba')],_0x846f('0xbb'));return db['User'][_0x846f('0x38')]({'where':{'id':_0x122c06[_0x846f('0x5f')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x846f('0x1f')](handleEntityNotFound(_0x5708f6,null))[_0x846f('0x1f')](function(_0x565db7){if(_0x565db7){if(_['isNil'](_0x565db7[_0x846f('0xb6')])){return _0x5708f6[_0x846f('0xbc')](_0x1550a2);}else{if(!fs['existsSync'](path[_0x846f('0xb9')](config[_0x846f('0xba')],_0x846f('0xbd'),_0x565db7[_0x846f('0xb6')]))){return _0x5708f6[_0x846f('0xbc')](_0x1550a2);}return _0x5708f6['download'](path[_0x846f('0xb9')](config[_0x846f('0xba')],_0x846f('0xbd'),_0x565db7[_0x846f('0xb6')]));}}})[_0x846f('0x29')](handleError(_0x5708f6,null));};exports[_0x846f('0xbe')]=function(_0x3c751a,_0x2df2d3){return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x3c751a[_0x846f('0x5f')]['id']},'attributes':['id']})[_0x846f('0x1f')](handleEntityNotFound(_0x2df2d3,null))[_0x846f('0x1f')](function(_0x3ee433){var _0x2e7e0c=[];values=_0x3ee433['dataValues'];_0x2e7e0c['push'](get_open_tabs('chat',_0x3ee433['dataValues']));_0x2e7e0c[_0x846f('0x51')](get_open_tabs('sms',_0x3ee433['dataValues']));_0x2e7e0c[_0x846f('0x51')](get_open_tabs('openchannel',_0x3ee433[_0x846f('0x59')]));_0x2e7e0c[_0x846f('0x51')](get_open_tabs('whatsapp',_0x3ee433[_0x846f('0x59')]));_0x2e7e0c[_0x846f('0x51')](get_open_tabs(_0x846f('0x5a'),_0x3ee433[_0x846f('0x59')]));_0x2e7e0c['push'](get_open_tabs('mail',_0x3ee433[_0x846f('0x59')]));return Promise['all'](_0x2e7e0c);})[_0x846f('0x1f')](function(_0x22bb02){if(_0x22bb02){var _0x4bcf63=_[_0x846f('0x36')](values[_0x846f('0xbf')],function(_0x4d998b){return{'channel':_0x846f('0xc0'),'id':_0x4d998b['id'],'createdAt':_0x4d998b[_0x846f('0xc1')]};});var _0x1fabcf=_[_0x846f('0x36')](values[_0x846f('0xc2')],function(_0xc652f2){return{'channel':_0x846f('0xc3'),'id':_0xc652f2['id'],'createdAt':_0xc652f2[_0x846f('0xc1')]};});var _0x21076d=_[_0x846f('0x36')](values[_0x846f('0xc4')],function(_0x49c1a4){return{'channel':'OPENCHANNEL','id':_0x49c1a4['id'],'createdAt':_0x49c1a4[_0x846f('0xc1')]};});var _0x229305=_[_0x846f('0x36')](values[_0x846f('0xc5')],function(_0x4b6515){return{'channel':_0x846f('0xc6'),'id':_0x4b6515['id'],'createdAt':_0x4b6515[_0x846f('0xc1')]};});var _0x5e6ce5=_['map'](values[_0x846f('0xc7')],function(_0x5a91d2){return{'channel':_0x846f('0xc8'),'id':_0x5a91d2['id'],'createdAt':_0x5a91d2['createdAt']};});var _0x3f00a1=_['map'](values['WhatsappOpenTabs'],function(_0x4464bd){return{'channel':'WHATSAPP','id':_0x4464bd['id'],'createdAt':_0x4464bd[_0x846f('0xc1')]};});var _0xaad92=_[_0x846f('0xc9')](_0x4bcf63,_0x1fabcf,_0x21076d,_0x229305,_0x5e6ce5,_0x3f00a1);var _0x7ff2b9={'count':_0xaad92[_0x846f('0x56')],'rows':_0xaad92};return _0x7ff2b9;}else return null;})['then'](respondWithResult(_0x2df2d3,null))[_0x846f('0x29')](handleError(_0x2df2d3,null));};exports[_0x846f('0xca')]=function(_0x149f1f,_0x5b2919){var _0x7f9c05={};return db['User'][_0x846f('0x9a')]({'where':{'id':_0x149f1f[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](function(_0x2302f8){if(!_0x2302f8){throw new APINotFoundError(util[_0x846f('0xcb')](_0x846f('0xcc'),_0x149f1f[_0x846f('0x5f')]['id']));}return contacts['describe']();})[_0x846f('0x1f')](function(_0x1c90c5){_0x149f1f[_0x846f('0x4d')][_0x846f('0x49')]=_0x149f1f[_0x846f('0x5f')]['id'];_0x7f9c05=qs[_0x846f('0x47')](_0x1c90c5,_0x149f1f);if(_0x149f1f[_0x846f('0x4d')]['hasOwnProperty'](_0x846f('0x4b'))){_0x7f9c05[_0x846f('0x4c')]=[{'model':db[_0x846f('0xcd')],'as':_0x846f('0xce'),'required':![]},{'model':db['Tag'],'as':_0x846f('0xcf'),'attributes':['id',_0x846f('0x39'),'color'],'where':_0x149f1f['query'][_0x846f('0xd0')]?{'id':_0x149f1f[_0x846f('0x4d')][_0x846f('0xd0')]}:undefined,'required':_0x149f1f[_0x846f('0x4d')][_0x846f('0xd0')]?!![]:![]}];}return contacts[_0x846f('0x52')](_0x149f1f['query'],_0x149f1f[_0x846f('0x30')],_0x7f9c05,_0x1c90c5);})[_0x846f('0x1f')](respondWithFilteredResult(_0x5b2919,_0x7f9c05))[_0x846f('0x29')](APIHandleError(_0x5b2919));};exports['getQueues']=function(_0x24af0d,_0x5dc5eb){var _0x3ab857;var _0x457c8d={};var _0x1e5f84;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x24af0d[_0x846f('0x5f')]['id']},'attributes':['id',_0x846f('0x39'),'role']})[_0x846f('0x1f')](handleEntityNotFound(_0x5dc5eb,null))[_0x846f('0x1f')](function(_0x4e75a3){if(!utils[_0x846f('0xb0')](_0x24af0d[_0x846f('0x4d')][_0x846f('0xa0')])){throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))]('Unknown\x20channel');}_0x3ab857=_0x4e75a3;var _0x270f45={};_0x270f45[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_[_0x846f('0xa5')](_0x24af0d[_0x846f('0x4d')][_0x846f('0xa0')])+_0x846f('0xd3')]['rawAttributes']);_0x270f45[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x24af0d[_0x846f('0x4d')]);_0x270f45[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x270f45['model'],_0x270f45[_0x846f('0x4d')]);_0x457c8d[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x270f45[_0x846f('0xd1')],qs['fields'](_0x24af0d[_0x846f('0x4d')][_0x846f('0xd6')]));_0x457c8d['attributes']=_0x457c8d['attributes']['length']?_0x457c8d[_0x846f('0x50')]:_0x270f45[_0x846f('0xd1')];_0x457c8d[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x24af0d[_0x846f('0x4d')][_0x846f('0xd8')]);_0x457c8d['where']=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x24af0d['query'],_0x270f45[_0x846f('0xd4')]));if(_0x24af0d[_0x846f('0x4d')]['filter']){_0x457c8d['where']=_[_0x846f('0x60')](_0x457c8d[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x457c8d[_0x846f('0x50')],function(_0x57f92d){var _0x17fb13={};_0x17fb13[_0x57f92d]={'$like':'%'+_0x24af0d[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x17fb13;})});}_0x457c8d=_[_0x846f('0x60')]({},_0x457c8d,_0x24af0d['options']);switch(_0x3ab857[_0x846f('0x2b')]){case _0x846f('0x2e'):return db[_['capitalize'](_0x24af0d[_0x846f('0x4d')][_0x846f('0xa0')])+'Queue']['findAll'](_0x457c8d);case _0x846f('0x30'):case _0x846f('0x77'):return _0x3ab857['get'+_[_0x846f('0xa5')](_0x24af0d[_0x846f('0x4d')][_0x846f('0xa0')])+_0x846f('0xa6')](_0x457c8d);default:throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))](_0x846f('0xda'));}})[_0x846f('0x1f')](function(_0x548462){_0x1e5f84=_0x548462[_0x846f('0x56')];if(!_0x24af0d[_0x846f('0x4d')][_0x846f('0xdb')](_0x846f('0xdc'))){_0x457c8d[_0x846f('0x1a')]=qs['limit'](_0x24af0d[_0x846f('0x4d')][_0x846f('0x1a')]);_0x457c8d[_0x846f('0x19')]=qs['offset'](_0x24af0d['query'][_0x846f('0x19')]);}switch(_0x3ab857['role']){case _0x846f('0x2e'):return db[_[_0x846f('0xa5')](_0x24af0d['query'][_0x846f('0xa0')])+_0x846f('0xd3')]['findAll'](_0x457c8d);case'user':case _0x846f('0x77'):return _0x3ab857[_0x846f('0x2d')+_['capitalize'](_0x24af0d[_0x846f('0x4d')]['channel'])+'Queues'](_0x457c8d);}})['then'](function(_0x9bb6b5){return{'count':_0x1e5f84,'rows':_0x9bb6b5};})[_0x846f('0x1f')](respondWithResult(_0x5dc5eb,null))['catch'](handleError(_0x5dc5eb,null));};exports[_0x846f('0xdd')]=function(_0x46da71,_0x11ee2a){var _0xa61860={};var _0x26cd00={};var _0x50ea37;var _0x41e26e;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x46da71[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x11ee2a,null))[_0x846f('0x1f')](function(_0x3f1095){if(_0x3f1095){_0x50ea37=_0x3f1095;_0x26cd00[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xad')][_0x846f('0x3e')]);_0x26cd00[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x46da71[_0x846f('0x4d')]);_0x26cd00['filters']=_['intersection'](_0x26cd00['model'],_0x26cd00[_0x846f('0x4d')]);_0xa61860[_0x846f('0x50')]=_['intersection'](_0x26cd00['model'],qs[_0x846f('0xd6')](_0x46da71[_0x846f('0x4d')][_0x846f('0xd6')]));_0xa61860[_0x846f('0x50')]=_0xa61860[_0x846f('0x50')][_0x846f('0x56')]?_0xa61860[_0x846f('0x50')]:_0x26cd00['model'];_0xa61860[_0x846f('0xd7')]=qs['sort'](_0x46da71[_0x846f('0x4d')][_0x846f('0xd8')]);_0xa61860[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x46da71[_0x846f('0x4d')],_0x26cd00[_0x846f('0xd4')]));if(_0x46da71[_0x846f('0x4d')]['filter']){_0xa61860['where']=_[_0x846f('0x60')](_0xa61860[_0x846f('0x48')],{'$or':_['map'](_0xa61860[_0x846f('0x50')],function(_0x15f403){var _0x32b414={};_0x32b414[_0x15f403]={'$like':'%'+_0x46da71[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x32b414;})});}_0xa61860=_[_0x846f('0x60')]({},_0xa61860,_0x46da71[_0x846f('0x61')]);return _0x50ea37[_0x846f('0xdd')](_0xa61860);}})[_0x846f('0x1f')](function(_0x1e99e2){if(_0x1e99e2){_0x41e26e=_0x1e99e2[_0x846f('0x56')];if(!_0x46da71[_0x846f('0x4d')]['hasOwnProperty']('nolimit')){_0xa61860[_0x846f('0x1a')]=qs[_0x846f('0x1a')](_0x46da71[_0x846f('0x4d')][_0x846f('0x1a')]);_0xa61860[_0x846f('0x19')]=qs[_0x846f('0x19')](_0x46da71[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x50ea37[_0x846f('0xdd')](_0xa61860);}})[_0x846f('0x1f')](function(_0x4a977f){if(_0x4a977f){return _0x4a977f?{'count':_0x41e26e,'rows':_0x4a977f}:null;}})['then'](respondWithResult(_0x11ee2a,null))['catch'](handleError(_0x11ee2a,null));};exports[_0x846f('0xde')]=function(_0x537e30,_0x9f84c3){var _0x26f27a={};var _0x10bea0={};var _0x44b85d;var _0x1d1f61;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x537e30[_0x846f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x9f84c3,null))[_0x846f('0x1f')](function(_0x34e370){if(_0x34e370){_0x44b85d=_0x34e370;_0x10bea0['model']=_[_0x846f('0xd2')](db[_0x846f('0xdf')][_0x846f('0x3e')]);_0x10bea0[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x537e30['query']);_0x10bea0[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x10bea0[_0x846f('0xd1')],_0x10bea0['query']);_0x26f27a[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x10bea0[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x537e30['query'][_0x846f('0xd6')]));_0x26f27a[_0x846f('0x50')]=_0x26f27a[_0x846f('0x50')][_0x846f('0x56')]?_0x26f27a['attributes']:_0x10bea0[_0x846f('0xd1')];_0x26f27a[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x537e30[_0x846f('0x4d')]['sort']);_0x26f27a['where']=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x537e30['query'],_0x10bea0[_0x846f('0xd4')]));if(_0x537e30[_0x846f('0x4d')][_0x846f('0x34')]){_0x26f27a[_0x846f('0x48')]=_[_0x846f('0x60')](_0x26f27a[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x26f27a['attributes'],function(_0x41fa2d){var _0x2c89d7={};_0x2c89d7[_0x41fa2d]={'$like':'%'+_0x537e30[_0x846f('0x4d')]['filter']+'%'};return _0x2c89d7;})});}_0x26f27a=_[_0x846f('0x60')]({},_0x26f27a,_0x537e30[_0x846f('0x61')]);return _0x44b85d['getGroups'](_0x26f27a);}})[_0x846f('0x1f')](function(_0x3c5058){if(_0x3c5058){_0x1d1f61=_0x3c5058[_0x846f('0x56')];if(!_0x537e30[_0x846f('0x4d')][_0x846f('0xdb')]('nolimit')){_0x26f27a[_0x846f('0x1a')]=qs['limit'](_0x537e30['query'][_0x846f('0x1a')]);_0x26f27a['offset']=qs[_0x846f('0x19')](_0x537e30[_0x846f('0x4d')]['offset']);}return _0x44b85d[_0x846f('0xde')](_0x26f27a);}})['then'](function(_0x2bd081){if(_0x2bd081){return _0x2bd081?{'count':_0x1d1f61,'rows':_0x2bd081}:null;}})['then'](respondWithResult(_0x9f84c3,null))[_0x846f('0x29')](handleError(_0x9f84c3,null));};exports[_0x846f('0xe0')]=function(_0x25454f,_0x350a7a){var _0x279306={'raw':!![],'where':{}};var _0x1bbd08={};var _0x2f92b9={'count':0x0,'rows':[]};return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x25454f[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x350a7a,null))['then'](function(_0x12e9a3){if(_0x12e9a3){_0x1bbd08[_0x846f('0xd1')]=_[_0x846f('0xd2')](db['VoiceRecording'][_0x846f('0x3e')]);_0x1bbd08[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x25454f[_0x846f('0x4d')]);_0x1bbd08[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x1bbd08['model'],_0x1bbd08[_0x846f('0x4d')]);_0x279306[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x1bbd08[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x25454f[_0x846f('0x4d')][_0x846f('0xd6')]));_0x279306[_0x846f('0x50')]=_0x279306['attributes']['length']?_0x279306[_0x846f('0x50')]:_0x1bbd08[_0x846f('0xd1')];if(!_0x25454f[_0x846f('0x4d')][_0x846f('0xdb')]('nolimit')){_0x279306['limit']=qs[_0x846f('0x1a')](_0x25454f['query']['limit']);_0x279306[_0x846f('0x19')]=qs[_0x846f('0x19')](_0x25454f[_0x846f('0x4d')][_0x846f('0x19')]);}_0x279306[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x25454f[_0x846f('0x4d')]['sort']);_0x279306['where']=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x25454f[_0x846f('0x4d')],_0x1bbd08[_0x846f('0xd4')]));_0x279306[_0x846f('0x48')][_0x846f('0xe1')]=_0x12e9a3['id'];if(_0x25454f[_0x846f('0x4d')][_0x846f('0x34')]){_0x279306[_0x846f('0x48')]=_[_0x846f('0x60')](_0x279306['where'],{'$or':_[_0x846f('0x36')](_0x279306[_0x846f('0x50')],function(_0x8f8056){var _0x187a93={};_0x187a93[_0x8f8056]={'$like':'%'+_0x25454f[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x187a93;})});}_0x279306=_[_0x846f('0x60')]({},_0x279306,_0x25454f['options']);return db['VoiceRecording'][_0x846f('0x4a')]({'where':_0x279306[_0x846f('0x48')]})[_0x846f('0x1f')](function(_0x11eb07){_0x2f92b9[_0x846f('0x4a')]=_0x11eb07;if(_0x25454f[_0x846f('0x4d')][_0x846f('0x4b')]){_0x279306['include']=[{'all':!![]}];}return db[_0x846f('0xe2')][_0x846f('0x52')](_0x279306);})[_0x846f('0x1f')](function(_0x2ada10){_0x2f92b9[_0x846f('0x53')]=_0x2ada10;return _0x2f92b9;});}})[_0x846f('0x1f')](respondWithFilteredResult(_0x350a7a,_0x279306))[_0x846f('0x29')](handleError(_0x350a7a,null));};exports['getScreenRecordings']=function(_0x1ca05f,_0x41ab6b){var _0x1b095e={'raw':!![],'where':{}};var _0x1655da={};var _0x47905a={'count':0x0,'rows':[]};return db['User'][_0x846f('0x9a')]({'where':{'id':_0x1ca05f[_0x846f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x41ab6b,null))['then'](function(_0x51ce73){if(_0x51ce73){_0x1655da[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xe3')][_0x846f('0x3e')]);_0x1655da[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x1ca05f[_0x846f('0x4d')]);_0x1655da['filters']=_[_0x846f('0xd5')](_0x1655da[_0x846f('0xd1')],_0x1655da[_0x846f('0x4d')]);_0x1b095e[_0x846f('0x50')]=_['intersection'](_0x1655da[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x1ca05f[_0x846f('0x4d')][_0x846f('0xd6')]));_0x1b095e[_0x846f('0x50')]=_0x1b095e[_0x846f('0x50')][_0x846f('0x56')]?_0x1b095e[_0x846f('0x50')]:_0x1655da[_0x846f('0xd1')];if(!_0x1ca05f[_0x846f('0x4d')][_0x846f('0xdb')](_0x846f('0xdc'))){_0x1b095e[_0x846f('0x1a')]=qs[_0x846f('0x1a')](_0x1ca05f['query'][_0x846f('0x1a')]);_0x1b095e['offset']=qs[_0x846f('0x19')](_0x1ca05f['query'][_0x846f('0x19')]);}_0x1b095e[_0x846f('0xd7')]=qs['sort'](_0x1ca05f['query'][_0x846f('0xd8')]);_0x1b095e['where']=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x1ca05f[_0x846f('0x4d')],_0x1655da[_0x846f('0xd4')]));_0x1b095e[_0x846f('0x48')][_0x846f('0xe1')]=_0x51ce73['id'];if(_0x1ca05f[_0x846f('0x4d')]['filter']){_0x1b095e[_0x846f('0x48')]=_[_0x846f('0x60')](_0x1b095e[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x1b095e[_0x846f('0x50')],function(_0x345405){var _0x1a883f={};_0x1a883f[_0x345405]={'$like':'%'+_0x1ca05f['query'][_0x846f('0x34')]+'%'};return _0x1a883f;})});}_0x1b095e=_[_0x846f('0x60')]({},_0x1b095e,_0x1ca05f[_0x846f('0x61')]);return db[_0x846f('0xe3')]['count']({'where':_0x1b095e['where']})[_0x846f('0x1f')](function(_0x26ec64){_0x47905a[_0x846f('0x4a')]=_0x26ec64;if(_0x1ca05f[_0x846f('0x4d')][_0x846f('0x4b')]){_0x1b095e[_0x846f('0x4c')]=[{'all':!![]}];}return db[_0x846f('0xe3')]['findAll'](_0x1b095e);})[_0x846f('0x1f')](function(_0x5d9056){_0x47905a[_0x846f('0x53')]=_0x5d9056;return _0x47905a;});}})[_0x846f('0x1f')](respondWithFilteredResult(_0x41ab6b,_0x1b095e))[_0x846f('0x29')](handleError(_0x41ab6b,null));};exports[_0x846f('0xe4')]=function(_0x43b705,_0x538abf){var _0x373551={};var _0xfa47b7={};var _0x2ab118;var _0x57b54a;return db[_0x846f('0x49')]['findOne']({'where':{'id':_0x43b705[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x538abf,null))[_0x846f('0x1f')](function(_0x1a1c3f){if(_0x1a1c3f){_0x2ab118=_0x1a1c3f;_0xfa47b7[_0x846f('0xd1')]=_['keys'](db[_0x846f('0xe5')][_0x846f('0x3e')]);_0xfa47b7[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x43b705[_0x846f('0x4d')]);_0xfa47b7[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0xfa47b7[_0x846f('0xd1')],_0xfa47b7[_0x846f('0x4d')]);_0x373551[_0x846f('0x50')]=_[_0x846f('0xd5')](_0xfa47b7[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x43b705[_0x846f('0x4d')][_0x846f('0xd6')]));_0x373551['attributes']=_0x373551['attributes'][_0x846f('0x56')]?_0x373551['attributes']:_0xfa47b7[_0x846f('0xd1')];_0x373551[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x43b705[_0x846f('0x4d')][_0x846f('0xd8')]);_0x373551[_0x846f('0x48')]=qs[_0x846f('0xd4')](_['pick'](_0x43b705['query'],_0xfa47b7['filters']));if(_0x43b705[_0x846f('0x4d')][_0x846f('0x34')]){_0x373551[_0x846f('0x48')]=_['merge'](_0x373551['where'],{'$or':_[_0x846f('0x36')](_0x373551[_0x846f('0x50')],function(_0x3ca275){var _0x1b53ce={};_0x1b53ce[_0x3ca275]={'$like':'%'+_0x43b705[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x1b53ce;})});}_0x373551=_[_0x846f('0x60')]({},_0x373551,_0x43b705['options']);return _0x2ab118['getChatInteractions'](_0x373551);}})[_0x846f('0x1f')](function(_0x25888e){if(_0x25888e){_0x57b54a=_0x25888e[_0x846f('0x56')];if(!_0x43b705[_0x846f('0x4d')]['hasOwnProperty']('nolimit')){_0x373551[_0x846f('0x1a')]=qs[_0x846f('0x1a')](_0x43b705[_0x846f('0x4d')]['limit']);_0x373551[_0x846f('0x19')]=qs[_0x846f('0x19')](_0x43b705[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x2ab118['getChatInteractions'](_0x373551);}})['then'](function(_0x5d8231){if(_0x5d8231){return _0x5d8231?{'count':_0x57b54a,'rows':_0x5d8231}:null;}})['then'](respondWithResult(_0x538abf,null))[_0x846f('0x29')](handleError(_0x538abf,null));};exports[_0x846f('0xe6')]=function(_0x1262ff,_0x583f2d){var _0x41ad91={};var _0x18206f={};var _0x11f561;var _0x4b9f87;return db['User'][_0x846f('0x9a')]({'where':{'id':_0x1262ff['params']['id']}})['then'](handleEntityNotFound(_0x583f2d,null))[_0x846f('0x1f')](function(_0x19013e){if(_0x19013e){_0x11f561=_0x19013e;_0x18206f[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xe7')][_0x846f('0x3e')]);_0x18206f[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x1262ff[_0x846f('0x4d')]);_0x18206f[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x18206f['model'],_0x18206f[_0x846f('0x4d')]);_0x41ad91[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x18206f[_0x846f('0xd1')],qs['fields'](_0x1262ff[_0x846f('0x4d')][_0x846f('0xd6')]));_0x41ad91[_0x846f('0x50')]=_0x41ad91[_0x846f('0x50')]['length']?_0x41ad91[_0x846f('0x50')]:_0x18206f[_0x846f('0xd1')];_0x41ad91[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x1262ff[_0x846f('0x4d')]['sort']);_0x41ad91['where']=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x1262ff['query'],_0x18206f[_0x846f('0xd4')]));if(_0x1262ff[_0x846f('0x4d')][_0x846f('0x34')]){_0x41ad91[_0x846f('0x48')]=_[_0x846f('0x60')](_0x41ad91[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x41ad91[_0x846f('0x50')],function(_0x24ca2c){var _0x5d7ceb={};_0x5d7ceb[_0x24ca2c]={'$like':'%'+_0x1262ff[_0x846f('0x4d')]['filter']+'%'};return _0x5d7ceb;})});}_0x41ad91=_[_0x846f('0x60')]({},_0x41ad91,_0x1262ff[_0x846f('0x61')]);return _0x11f561[_0x846f('0xe6')](_0x41ad91);}})['then'](function(_0x97d65e){if(_0x97d65e){_0x4b9f87=_0x97d65e['length'];if(!_0x1262ff[_0x846f('0x4d')]['hasOwnProperty'](_0x846f('0xdc'))){_0x41ad91[_0x846f('0x1a')]=qs[_0x846f('0x1a')](_0x1262ff['query'][_0x846f('0x1a')]);_0x41ad91['offset']=qs['offset'](_0x1262ff[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x11f561[_0x846f('0xe6')](_0x41ad91);}})[_0x846f('0x1f')](function(_0x2f1849){if(_0x2f1849){return _0x2f1849?{'count':_0x4b9f87,'rows':_0x2f1849}:null;}})['then'](respondWithResult(_0x583f2d,null))[_0x846f('0x29')](handleError(_0x583f2d,null));};exports['getMailInteractions']=function(_0x487071,_0x1df758){var _0x1a404b={'raw':!![],'where':{}};var _0x323020={};var _0x398ed1={'count':0x0,'rows':[]};return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x487071[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x1df758,null))[_0x846f('0x1f')](function(_0x11cb89){if(_0x11cb89){_0x323020[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xe8')][_0x846f('0x3e')]);_0x323020[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x487071[_0x846f('0x4d')]);_0x323020['filters']=_[_0x846f('0xd5')](_0x323020[_0x846f('0xd1')],_0x323020[_0x846f('0x4d')]);_0x1a404b['attributes']=_[_0x846f('0xd5')](_0x323020[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x487071[_0x846f('0x4d')][_0x846f('0xd6')]));_0x1a404b['attributes']=_0x1a404b[_0x846f('0x50')][_0x846f('0x56')]?_0x1a404b[_0x846f('0x50')]:_0x323020[_0x846f('0xd1')];if(!_0x487071['query']['hasOwnProperty'](_0x846f('0xdc'))){_0x1a404b[_0x846f('0x1a')]=qs[_0x846f('0x1a')](_0x487071[_0x846f('0x4d')]['limit']);_0x1a404b[_0x846f('0x19')]=qs['offset'](_0x487071[_0x846f('0x4d')][_0x846f('0x19')]);}_0x1a404b['order']=qs[_0x846f('0xd8')](_0x487071[_0x846f('0x4d')]['sort']);_0x1a404b[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x487071['query'],_0x323020[_0x846f('0xd4')]));_0x1a404b[_0x846f('0x48')][_0x846f('0xe1')]=_0x11cb89['id'];if(_0x487071[_0x846f('0x4d')][_0x846f('0x34')]){_0x1a404b['where']=_[_0x846f('0x60')](_0x1a404b['where'],{'$or':_['map'](_0x1a404b[_0x846f('0x50')],function(_0x49a07e){var _0x5d88e4={};_0x5d88e4[_0x49a07e]={'$like':'%'+_0x487071[_0x846f('0x4d')]['filter']+'%'};return _0x5d88e4;})});}_0x1a404b=_[_0x846f('0x60')]({},_0x1a404b,_0x487071[_0x846f('0x61')]);return db[_0x846f('0xe8')]['count']({'where':_0x1a404b['where']})['then'](function(_0x544639){_0x398ed1[_0x846f('0x4a')]=_0x544639;if(_0x487071['query'][_0x846f('0x4b')]){_0x1a404b[_0x846f('0x4c')]=[{'all':!![]}];}return db[_0x846f('0xe8')][_0x846f('0x52')](_0x1a404b);})[_0x846f('0x1f')](function(_0x2f4c2b){_0x398ed1[_0x846f('0x53')]=_0x2f4c2b;return _0x398ed1;});}})[_0x846f('0x1f')](respondWithFilteredResult(_0x1df758,_0x1a404b))[_0x846f('0x29')](handleError(_0x1df758,null));};exports[_0x846f('0xe9')]=function(_0x711d6c,_0xe3fb5c){var _0xe4988c={};var _0x1c59db={};var _0x5bde88;var _0x1556fb;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x711d6c['params']['id']}})['then'](handleEntityNotFound(_0xe3fb5c,null))[_0x846f('0x1f')](function(_0x2f10d6){if(_0x2f10d6){_0x5bde88=_0x2f10d6;_0x1c59db[_0x846f('0xd1')]=_[_0x846f('0xd2')](db['SmsInteraction'][_0x846f('0x3e')]);_0x1c59db[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x711d6c['query']);_0x1c59db[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x1c59db[_0x846f('0xd1')],_0x1c59db[_0x846f('0x4d')]);_0xe4988c[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x1c59db['model'],qs[_0x846f('0xd6')](_0x711d6c[_0x846f('0x4d')]['fields']));_0xe4988c['attributes']=_0xe4988c[_0x846f('0x50')][_0x846f('0x56')]?_0xe4988c[_0x846f('0x50')]:_0x1c59db[_0x846f('0xd1')];_0xe4988c[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x711d6c[_0x846f('0x4d')][_0x846f('0xd8')]);_0xe4988c[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x711d6c[_0x846f('0x4d')],_0x1c59db['filters']));if(_0x711d6c[_0x846f('0x4d')]['filter']){_0xe4988c['where']=_['merge'](_0xe4988c[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0xe4988c['attributes'],function(_0x5b63f9){var _0x1277d8={};_0x1277d8[_0x5b63f9]={'$like':'%'+_0x711d6c[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x1277d8;})});}_0xe4988c=_[_0x846f('0x60')]({},_0xe4988c,_0x711d6c[_0x846f('0x61')]);return _0x5bde88['getSmsInteractions'](_0xe4988c);}})[_0x846f('0x1f')](function(_0x4f9f5f){if(_0x4f9f5f){_0x1556fb=_0x4f9f5f['length'];if(!_0x711d6c[_0x846f('0x4d')][_0x846f('0xdb')](_0x846f('0xdc'))){_0xe4988c['limit']=qs[_0x846f('0x1a')](_0x711d6c[_0x846f('0x4d')][_0x846f('0x1a')]);_0xe4988c[_0x846f('0x19')]=qs[_0x846f('0x19')](_0x711d6c[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x5bde88[_0x846f('0xe9')](_0xe4988c);}})[_0x846f('0x1f')](function(_0x1e964a){if(_0x1e964a){return _0x1e964a?{'count':_0x1556fb,'rows':_0x1e964a}:null;}})[_0x846f('0x1f')](respondWithResult(_0xe3fb5c,null))['catch'](handleError(_0xe3fb5c,null));};exports[_0x846f('0xea')]=function(_0x327d2f,_0x1f9372){var _0x557f8b={};var _0xf7bcc3={};var _0x25e9c0;var _0x3b8c9f;return db['User'][_0x846f('0x9a')]({'where':{'id':_0x327d2f[_0x846f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1f9372,null))[_0x846f('0x1f')](function(_0x2d2d4a){if(_0x2d2d4a){_0x25e9c0=_0x2d2d4a;_0xf7bcc3['model']=_[_0x846f('0xd2')](db[_0x846f('0xeb')][_0x846f('0x3e')]);_0xf7bcc3['query']=_['keys'](_0x327d2f['query']);_0xf7bcc3['filters']=_[_0x846f('0xd5')](_0xf7bcc3[_0x846f('0xd1')],_0xf7bcc3[_0x846f('0x4d')]);_0x557f8b[_0x846f('0x50')]=_[_0x846f('0xd5')](_0xf7bcc3['model'],qs[_0x846f('0xd6')](_0x327d2f[_0x846f('0x4d')][_0x846f('0xd6')]));_0x557f8b['attributes']=_0x557f8b[_0x846f('0x50')][_0x846f('0x56')]?_0x557f8b[_0x846f('0x50')]:_0xf7bcc3[_0x846f('0xd1')];_0x557f8b['order']=qs[_0x846f('0xd8')](_0x327d2f[_0x846f('0x4d')][_0x846f('0xd8')]);_0x557f8b[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x327d2f['query'],_0xf7bcc3['filters']));if(_0x327d2f[_0x846f('0x4d')][_0x846f('0x34')]){_0x557f8b[_0x846f('0x48')]=_[_0x846f('0x60')](_0x557f8b[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x557f8b[_0x846f('0x50')],function(_0xed96a7){var _0x1f3185={};_0x1f3185[_0xed96a7]={'$like':'%'+_0x327d2f['query'][_0x846f('0x34')]+'%'};return _0x1f3185;})});}_0x557f8b=_['merge']({},_0x557f8b,_0x327d2f['options']);return _0x25e9c0[_0x846f('0xea')](_0x557f8b);}})[_0x846f('0x1f')](function(_0xab85a0){if(_0xab85a0){_0x3b8c9f=_0xab85a0['length'];if(!_0x327d2f[_0x846f('0x4d')][_0x846f('0xdb')](_0x846f('0xdc'))){_0x557f8b['limit']=qs[_0x846f('0x1a')](_0x327d2f[_0x846f('0x4d')][_0x846f('0x1a')]);_0x557f8b[_0x846f('0x19')]=qs[_0x846f('0x19')](_0x327d2f[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x25e9c0['getFaxInteractions'](_0x557f8b);}})['then'](function(_0x474da4){if(_0x474da4){return _0x474da4?{'count':_0x3b8c9f,'rows':_0x474da4}:null;}})[_0x846f('0x1f')](respondWithResult(_0x1f9372,null))[_0x846f('0x29')](handleError(_0x1f9372,null));};exports[_0x846f('0xec')]=function(_0x142f17,_0x258f27){var _0x29e6d2={};var _0x41b1f5={};var _0x200f14;var _0x4f0f46;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x142f17[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x258f27,null))[_0x846f('0x1f')](function(_0x53c7c9){if(_0x53c7c9){_0x200f14=_0x53c7c9;_0x41b1f5[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xed')][_0x846f('0x3e')]);_0x41b1f5[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x142f17[_0x846f('0x4d')]);_0x41b1f5[_0x846f('0xd4')]=_['intersection'](_0x41b1f5['model'],_0x41b1f5['query']);_0x29e6d2[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x41b1f5[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x142f17['query'][_0x846f('0xd6')]));_0x29e6d2[_0x846f('0x50')]=_0x29e6d2[_0x846f('0x50')][_0x846f('0x56')]?_0x29e6d2[_0x846f('0x50')]:_0x41b1f5[_0x846f('0xd1')];_0x29e6d2[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x142f17[_0x846f('0x4d')][_0x846f('0xd8')]);_0x29e6d2[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x142f17[_0x846f('0x4d')],_0x41b1f5[_0x846f('0xd4')]));if(_0x142f17[_0x846f('0x4d')][_0x846f('0x34')]){_0x29e6d2['where']=_['merge'](_0x29e6d2['where'],{'$or':_['map'](_0x29e6d2[_0x846f('0x50')],function(_0x4d7a6b){var _0x41a5c1={};_0x41a5c1[_0x4d7a6b]={'$like':'%'+_0x142f17[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x41a5c1;})});}_0x29e6d2=_[_0x846f('0x60')]({},_0x29e6d2,_0x142f17['options']);return _0x200f14[_0x846f('0xec')](_0x29e6d2);}})[_0x846f('0x1f')](function(_0x20b8c8){if(_0x20b8c8){_0x4f0f46=_0x20b8c8[_0x846f('0x56')];if(!_0x142f17['query'][_0x846f('0xdb')](_0x846f('0xdc'))){_0x29e6d2['limit']=qs[_0x846f('0x1a')](_0x142f17[_0x846f('0x4d')]['limit']);_0x29e6d2['offset']=qs[_0x846f('0x19')](_0x142f17['query'][_0x846f('0x19')]);}return _0x200f14[_0x846f('0xec')](_0x29e6d2);}})['then'](function(_0x57653d){if(_0x57653d){return _0x57653d?{'count':_0x4f0f46,'rows':_0x57653d}:null;}})[_0x846f('0x1f')](respondWithResult(_0x258f27,null))[_0x846f('0x29')](handleError(_0x258f27,null));};exports[_0x846f('0xee')]=function(_0x2fb457,_0xcb2c2b,_0x54d1a4){var _0x4a966b;var _0x54d673;var _0x40ca40;var _0x4c96bf=!_[_0x846f('0x6b')](_0x2fb457[_0x846f('0x5f')]['id'])?_0x2fb457[_0x846f('0x5f')]['id']:!_['isNil'](_0x2fb457[_0x846f('0x30')]['id'])?_0x2fb457[_0x846f('0x30')]['id']:null;return db['User'][_0x846f('0x38')]({'where':{'id':_0x4c96bf,'role':{'$or':[_0x846f('0x2e'),_0x846f('0x30'),_0x846f('0x77')]}},'attributes':['id',_0x846f('0x39'),_0x846f('0xef'),_0x846f('0xf0'),_0x846f('0x2b'),_0x846f('0x67'),_0x846f('0xa2')]})[_0x846f('0x1f')](function(_0x456c2b){if(_0x456c2b){if(_0x456c2b[_0x846f('0x2b')]===_0x846f('0x77')){_0x4a966b=_0x456c2b;if(_0x2fb457['body'][_0x846f('0xa3')]){_0x40ca40=util['format']('LOCAL/%s@from-sip/n',_0x4a966b[_0x2fb457['body'][_0x846f('0xa3')]]);}else if(_0x2fb457[_0x846f('0x62')][_0x846f('0xf1')]){_0x40ca40=util[_0x846f('0xcb')](_0x846f('0xab'),_0x2fb457['body'][_0x846f('0xf1')]);}else{_0x40ca40=util['format'](_0x846f('0xab'),_0x4a966b[_0x846f('0x39')]);}socket['to'](util[_0x846f('0xcb')](_0x846f('0xf2'),_0x4a966b['name']))[_0x846f('0xa8')](_0x846f('0xf3'),{'user':{'id':_0x4a966b['id'],'name':_0x4a966b['name']},'ip':_0x2fb457[_0x846f('0xf4')][_0x846f('0xf5')]||_0x2fb457[_0x846f('0xf6')][_0x846f('0xf7')]||_0x2fb457[_0x846f('0xf8')]['remoteAddress']||_0x2fb457[_0x846f('0xf6')][_0x846f('0xf8')][_0x846f('0xf7')]});return new Promise(function(_0x476230,_0x30d2b7){db[_0x846f('0x6d')]['transaction']()[_0x846f('0x1f')](_0x501dbe=>{db[_0x846f('0xad')][_0x846f('0x3b')]({'where':{'membername':_0x4a966b[_0x846f('0x39')]},'individualHooks':!![]},{'transaction':_0x501dbe})[_0x846f('0x1f')](function(){return _0x501dbe[_0x846f('0xf9')]();})[_0x846f('0x1f')](_0x476230)[_0x846f('0x29')](_0x30d2b7);});});}}else{throw new db[(_0x846f('0x92'))][(_0x846f('0x93'))](_0x846f('0xfa'));}})[_0x846f('0x1f')](function(){if(_0x4a966b){return _0x4a966b[_0x846f('0xfb')]({'raw':!![]});}})[_0x846f('0x1f')](function(_0x74dd15){if(_0x4a966b){if(_0x74dd15){_0x54d673=_0x74dd15;if(_0x54d673[_0x846f('0x56')]){var _0xfb964d=_0x54d673[_0x846f('0x36')](function(_0x6f24d4){return{'membername':_0x4a966b['name'],'UserId':_0x4a966b['id'],'queue_name':_0x6f24d4[_0x846f('0x39')],'VoiceQueueId':_0x6f24d4['id'],'interface':_0x40ca40,'paused':_0x4a966b[_0x846f('0xa2')]||![],'penalty':_0x6f24d4[_0x846f('0xfc')]||0x0};});return db[_0x846f('0xad')][_0x846f('0x8a')](_0xfb964d);}}}})[_0x846f('0x1f')](function(){if(_0x4a966b){return db['MemberReport'][_0x846f('0x52')]({'where':{'membername':_0x4a966b[_0x846f('0x39')],'exitAt':null}});}})[_0x846f('0x1f')](function(_0x446bd5){if(_0x4a966b){var _0x4014c6=[];_0x446bd5['forEach'](function(_0x3945ac){_0x4014c6[_0x846f('0x51')](_0x3945ac[_0x846f('0x2a')]({'exitAt':moment()[_0x846f('0xcb')](_0x846f('0xfd'))}));});return Promise['all'](_0x4014c6);}})[_0x846f('0x1f')](function(){if(_0x4a966b){var _0x37dc43=[];var _0x204b96=[];var _0x5194d=utils['getChannels']();var _0x4402f5={'membername':_0x4a966b[_0x846f('0x39')],'interface':_0x40ca40,'enterAt':moment()[_0x846f('0xcb')](_0x846f('0xfd')),'role':_0x4a966b[_0x846f('0x2b')],'internal':_0x4a966b[_0x846f('0x67')]};_0x5194d['forEach'](function(_0x1a1ba8){_0x37dc43[_0x846f('0x51')](_[_0x846f('0x60')]({'channel':_0x1a1ba8,'type':_0x846f('0xfe'),'data1':_0x2fb457[_0x846f('0x62')][_0x846f('0xff')],'data2':_0x40ca40},_0x4402f5));if(_0x4a966b[_0x846f('0xa2')]){_0x204b96[_0x846f('0x51')](_['merge']({'channel':_0x1a1ba8,'type':_0x846f('0x100'),'data1':_0x846f('0x101')},_0x4402f5));}});return db['MemberReport']['bulkCreate'](_0x37dc43[_0x846f('0xc9')](_0x204b96),{'individualHooks':!![]});}})[_0x846f('0x1f')](function(){if(_0x4a966b){return _0x4a966b['update']({'online':!![],'lastLoginAt':moment()[_0x846f('0xcb')](_0x846f('0xfd')),'voicePause':_0x4a966b[_0x846f('0xa2')]||![],'mailPause':_0x4a966b[_0x846f('0xa2')]||![],'chatPause':_0x4a966b[_0x846f('0xa2')]||![],'faxPause':_0x4a966b[_0x846f('0xa2')]||![],'smsPause':_0x4a966b['loginInPause']||![],'openchannelPause':_0x4a966b['loginInPause']||![],'whatsappPause':_0x4a966b[_0x846f('0xa2')]||![],'pauseType':_0x4a966b['loginInPause']?'LOGININPAUSE':null,'interface':_0x40ca40,'lastPauseAt':moment()[_0x846f('0xcb')](_0x846f('0xfd'))});}})[_0x846f('0x1f')](function(_0x30d620){if(_0x2fb457[_0x846f('0x102')]){return _0x54d1a4();}else{return Promise['resolve'](_0x30d620)['then'](respondWithResult(_0xcb2c2b,null));}})['catch'](handleError(_0xcb2c2b,null));};exports[_0x846f('0x103')]=function(_0x44f878,_0x2c0dee){var _0x58e471;return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x44f878[_0x846f('0x5f')]['id'],'role':_0x846f('0x77')},'attributes':['id',_0x846f('0x39'),_0x846f('0x2b')]})[_0x846f('0x1f')](handleEntityNotFound(_0x2c0dee,null))[_0x846f('0x1f')](function(_0x10afbe){if(_0x10afbe){_0x58e471=_0x10afbe;return db['UserVoiceQueueRt'][_0x846f('0x3b')]({'where':{'membername':_0x58e471['name']},'individualHooks':!![]});}})[_0x846f('0x1f')](function(){return db[_0x846f('0x104')][_0x846f('0x52')]({'where':{'membername':_0x58e471['name'],'exitAt':null}});})[_0x846f('0x1f')](function(_0x343912){var _0x1f29e3=[];_0x343912[_0x846f('0x105')](function(_0x242ddf){_0x1f29e3[_0x846f('0x51')](_0x242ddf[_0x846f('0x2a')]({'exitAt':moment()['format'](_0x846f('0xfd'))}));});return Promise[_0x846f('0x5e')](_0x1f29e3);})['then'](function(){return _0x58e471[_0x846f('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x846f('0x1f')](respondWithResult(_0x2c0dee,null))[_0x846f('0x29')](handleError(_0x2c0dee,null));};exports[_0x846f('0x106')]=function(_0x2b5b24,_0x5968f2){var _0x22d487;return db[_0x846f('0xad')][_0x846f('0x2a')]({'paused':0x1},{'where':{'UserId':_0x2b5b24[_0x846f('0x5f')]['id']},'individualHooks':!![]})[_0x846f('0x1f')](function(){return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x2b5b24[_0x846f('0x5f')]['id'],'role':_0x846f('0x77')},'attributes':['id',_0x846f('0x39'),'role',_0x846f('0x67'),_0x846f('0xa3'),_0x846f('0xa1')]});})['then'](handleEntityNotFound(_0x5968f2,null))[_0x846f('0x1f')](function(_0xf258f2){if(_0xf258f2){_0x22d487=_0xf258f2;return respondWithRpcPromise('QueuePause',_0x846f('0x106'),{'id':_0x22d487['id'],'name':_0x22d487[_0x846f('0x39')],'pause':!![]});}})[_0x846f('0x1f')](function(){if(_0x22d487){return db['MemberReport']['findAll']({'where':{'membername':_0x22d487[_0x846f('0x39')],'type':'PAUSE','exitAt':null}});}})[_0x846f('0x1f')](function(_0x595565){if(_0x595565['length']){var _0x2dd7f2=moment()['format'](_0x846f('0xfd'));for(var _0x5f54f7=0x0,_0x5c4cf0=_0x595565[_0x846f('0x56')];_0x5f54f7<_0x5c4cf0;_0x5f54f7++){_0x595565[_0x5f54f7]['updateAttributes']({'exitAt':_0x2dd7f2});}}})[_0x846f('0x1f')](function(){var _0x156aa0=[];var _0x17d746=utils[_0x846f('0x107')]();_0x17d746[_0x846f('0x105')](function(_0x4b7384){_0x156aa0[_0x846f('0x51')]({'channel':_0x4b7384,'membername':_0x22d487[_0x846f('0x39')],'interface':_['isNil'](_0x22d487[_0x846f('0xa3')])?util[_0x846f('0xcb')](_0x846f('0xab'),_0x22d487[_0x846f('0x39')]):_0x22d487[_0x846f('0xa3')],'type':_0x846f('0x100'),'enterAt':moment()[_0x846f('0xcb')](_0x846f('0xfd')),'data1':_0x2b5b24['body'][_0x846f('0x3f')]||'DEFAULT\x20PAUSE','role':_0x22d487[_0x846f('0x2b')],'internal':_0x22d487[_0x846f('0x67')]});});return db[_0x846f('0x104')][_0x846f('0x8a')](_0x156aa0,{'individualHooks':!![]});})[_0x846f('0x1f')](function(){return _0x22d487[_0x846f('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b5b24[_0x846f('0x62')][_0x846f('0x3f')]||_0x846f('0x108'),'lastPauseAt':moment()[_0x846f('0xcb')](_0x846f('0xfd'))});})['then'](respondWithResult(_0x5968f2,null))[_0x846f('0x29')](handleError(_0x5968f2,null));};exports[_0x846f('0x109')]=function(_0x2c2821,_0x23af82){if(_0x2c2821['body'][_0x846f('0xa0')]&&!utils[_0x846f('0xb0')](_0x2c2821[_0x846f('0x62')][_0x846f('0xa0')])){throw new APIBadRequestError(util[_0x846f('0xcb')](_0x846f('0x10a'),_0x2c2821[_0x846f('0x62')][_0x846f('0xa0')]));}return db[_0x846f('0x49')][_0x846f('0x38')]({'where':{'id':_0x2c2821[_0x846f('0x5f')]['id']},'attributes':['id',_0x846f('0x39'),'role',_0x846f('0x67'),'interface','online',_0x846f('0xac'),_0x846f('0x10b'),_0x846f('0x10c'),_0x846f('0x10d'),_0x846f('0x10e'),_0x846f('0x10f'),_0x846f('0x110'),'pauseType',_0x846f('0x111')]})['then'](function(_0x4648ab){if(!_0x4648ab){throw new APINotFoundError(util[_0x846f('0xcb')](_0x846f('0xcc'),_0x2c2821[_0x846f('0x5f')]['id']));}return _0x4648ab['unpause'](_0x2c2821['body'][_0x846f('0xa0')]);})['then'](respondWithResult(_0x23af82,null))[_0x846f('0x29')](APIHandleError(_0x23af82));};exports['getTeams']=function(_0x8f241f,_0xb7394e){var _0x1e0aa7={};var _0x1b1f73={};var _0x1500fd;var _0x3a1bce;return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x8f241f[_0x846f('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb7394e,null))['then'](function(_0x3f0700){if(_0x3f0700){_0x1500fd=_0x3f0700;_0x1b1f73[_0x846f('0xd1')]=_['keys'](db[_0x846f('0x112')]['rawAttributes']);_0x1b1f73[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x8f241f['query']);_0x1b1f73['filters']=_[_0x846f('0xd5')](_0x1b1f73[_0x846f('0xd1')],_0x1b1f73[_0x846f('0x4d')]);_0x1e0aa7[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x1b1f73[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x8f241f['query'][_0x846f('0xd6')]));_0x1e0aa7[_0x846f('0x50')]=_0x1e0aa7[_0x846f('0x50')]['length']?_0x1e0aa7['attributes']:_0x1b1f73[_0x846f('0xd1')];_0x1e0aa7['order']=qs[_0x846f('0xd8')](_0x8f241f['query'][_0x846f('0xd8')]);_0x1e0aa7[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x8f241f['query'],_0x1b1f73[_0x846f('0xd4')]));if(_0x8f241f[_0x846f('0x4d')]['filter']){_0x1e0aa7['where']=_['merge'](_0x1e0aa7[_0x846f('0x48')],{'$or':_['map'](_0x1e0aa7[_0x846f('0x50')],function(_0x620c81){var _0x414a64={};_0x414a64[_0x620c81]={'$like':'%'+_0x8f241f['query']['filter']+'%'};return _0x414a64;})});}_0x1e0aa7=_[_0x846f('0x60')]({},_0x1e0aa7,_0x8f241f[_0x846f('0x61')]);return _0x1500fd[_0x846f('0x113')](_0x1e0aa7);}})[_0x846f('0x1f')](function(_0x16c837){if(_0x16c837){_0x3a1bce=_0x16c837[_0x846f('0x56')];if(!_0x8f241f[_0x846f('0x4d')][_0x846f('0xdb')](_0x846f('0xdc'))){_0x1e0aa7[_0x846f('0x1a')]=qs['limit'](_0x8f241f['query'][_0x846f('0x1a')]);_0x1e0aa7['offset']=qs[_0x846f('0x19')](_0x8f241f[_0x846f('0x4d')][_0x846f('0x19')]);}return _0x1500fd[_0x846f('0x113')](_0x1e0aa7);}})[_0x846f('0x1f')](function(_0x4bbd71){if(_0x4bbd71){return _0x4bbd71?{'count':_0x3a1bce,'rows':_0x4bbd71}:null;}})[_0x846f('0x1f')](respondWithResult(_0xb7394e,null))[_0x846f('0x29')](handleError(_0xb7394e,null));};exports[_0x846f('0x114')]=function(_0x17dc35,_0xf6fa0d){var _0x2271eb=_0x17dc35[_0x846f('0x5f')]['id'];var _0x8d9f7f=_0x17dc35[_0x846f('0x62')]?_0x17dc35[_0x846f('0x62')][_0x846f('0x65')]:null;var _0x148812=[];return Promise['resolve']()[_0x846f('0x1f')](function(){if(!_0x8d9f7f)throw new APIBadRequestError(_0x846f('0x115'));})[_0x846f('0x1f')](function(){return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x2271eb}});})[_0x846f('0x1f')](function(_0x114f6e){if(!_0x114f6e)throw new APINotFoundError(util[_0x846f('0xcb')](_0x846f('0xcc'),_0x17dc35['params']['id']));return db[_0x846f('0x6d')][_0x846f('0x116')](function(_0x287ae4){return _0x114f6e[_0x846f('0x114')](_0x8d9f7f,{'transaction':_0x287ae4})[_0x846f('0x1f')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x8d9f7f}}});})[_0x846f('0x1f')](function(_0x38cfb0){var _0x490bf2=_['map'](_0x38cfb0,function(_0x2c5a11){return _0x2c5a11[_0x846f('0x117')]();});return Promise[_0x846f('0x5e')](_0x490bf2);})['then'](function(_0x51962a){_0x148812=_[_0x846f('0x118')](_0x51962a);var _0xd4af88=_[_0x846f('0x36')](_0x148812,function(_0x4e3c61){return _0x4e3c61[_0x846f('0x119')](_0x114f6e['id'],{'transaction':_0x287ae4});});return Promise[_0x846f('0x5e')](_0xd4af88);})['then'](function(){if(!_0x114f6e[_0x846f('0xa1')])return;var _0x35399f=_[_0x846f('0x34')](_0x148812,function(_0x330145){return _0x330145[_0x846f('0x11a')](_0x846f('0xa0'))===_0x846f('0x11b');});var _0x4c17cf=_[_0x846f('0x36')](_0x35399f,function(_0x2a8ef3){return db[_0x846f('0xad')][_0x846f('0xae')]({'membername':_0x114f6e[_0x846f('0x39')],'UserId':_0x114f6e['id'],'queue_name':_0x2a8ef3[_0x846f('0x39')],'VoiceQueueId':_0x2a8ef3['id'],'interface':_['isNil'](_0x114f6e[_0x846f('0xa3')])?util['format'](_0x846f('0xab'),_0x114f6e[_0x846f('0x39')]):_0x114f6e[_0x846f('0xa3')],'paused':_0x114f6e[_0x846f('0xac')]||![],'penalty':_0x114f6e[_0x846f('0xa7')]},{'transaction':_0x287ae4});});return Promise[_0x846f('0x5e')](_0x4c17cf);})[_0x846f('0x1f')](function(){return db[_0x846f('0x11c')]['findAll']({'where':{'teamId':{'$in':_0x8d9f7f}}});})['then'](function(_0x34a3ee){var _0x315794=_[_0x846f('0x36')](_0x34a3ee,function(_0x1e9313){return db[_0x846f('0x11d')][_0x846f('0x82')]({'UserId':_0x114f6e['id'],'VoicePrefixId':_0x1e9313['VoicePrefixId']},{'transaction':_0x287ae4});});return Promise[_0x846f('0x5e')](_0x315794);});});})[_0x846f('0x1f')](function(){for(var _0x304a71=0x0;_0x304a71<_0x148812[_0x846f('0x56')];_0x304a71++){var _0x38084b=_0x148812[_0x304a71]['getDataValue'](_0x846f('0xa0'));var _0x1c250a=_0x38084b+_0x846f('0xb4');socket[_0x846f('0xa8')](_0x846f('0x30')+_0x38084b+_0x846f('0xa9'),{'UserId':_0x2271eb,['queueField']:_0x148812[_0x304a71]['id']});}})[_0x846f('0x1f')](respondWithStatusCode(_0xf6fa0d,null))[_0x846f('0x29')](APIHandleError(_0xf6fa0d));};exports[_0x846f('0x11e')]=function(_0x3782ac,_0x4ee342){var _0x4fd383=_0x3782ac[_0x846f('0x5f')]['id'];var _0x4bfa0f=null;if(_0x3782ac['query']['ids']){_0x4bfa0f=_['isArray'](_0x3782ac['query'][_0x846f('0x65')])?_0x3782ac[_0x846f('0x4d')][_0x846f('0x65')]:[_0x3782ac[_0x846f('0x4d')][_0x846f('0x65')]];}var _0x45b7f6=[];return Promise[_0x846f('0x11f')]()[_0x846f('0x1f')](function(){if(!_0x4bfa0f)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x846f('0x1f')](function(){return db[_0x846f('0x49')][_0x846f('0x9a')]({'where':{'id':_0x4fd383}});})[_0x846f('0x1f')](function(_0x9682d7){if(!_0x9682d7)throw new APINotFoundError(util[_0x846f('0xcb')](_0x846f('0xcc'),_0x3782ac[_0x846f('0x5f')]['id']));return db[_0x846f('0x6d')]['transaction'](function(_0x34294c){return _0x9682d7['removeTeams'](_0x4bfa0f,{'transaction':_0x34294c})[_0x846f('0x1f')](function(){return db[_0x846f('0x112')][_0x846f('0x52')]({'where':{'id':{'$in':_0x4bfa0f}}});})['then'](function(_0x32a6f2){var _0xcacf5=_[_0x846f('0x36')](_0x32a6f2,function(_0x1ce463){return _0x1ce463[_0x846f('0x117')]();});return Promise[_0x846f('0x5e')](_0xcacf5);})[_0x846f('0x1f')](function(_0x2970e3){_0x45b7f6=_[_0x846f('0x118')](_0x2970e3);var _0x49797f=_['map'](_0x45b7f6,function(_0x3ea86a){return _0x3ea86a[_0x846f('0x120')](_0x9682d7['id'],{'transaction':_0x34294c});});return Promise[_0x846f('0x5e')](_0x49797f);})[_0x846f('0x1f')](function(){if(!_0x9682d7[_0x846f('0xa1')])return;var _0x5d0f67=_[_0x846f('0x34')](_0x45b7f6,function(_0x361db0){return _0x361db0[_0x846f('0x11a')](_0x846f('0xa0'))==='Voice';});var _0x5e9031=_[_0x846f('0x36')](_0x5d0f67,function(_0xd2731d){return db[_0x846f('0xad')][_0x846f('0x3b')]({'where':{'VoiceQueueId':_0xd2731d['id'],'UserId':_0x9682d7['id']},'transaction':_0x34294c});});return Promise[_0x846f('0x5e')](_0x5e9031);})[_0x846f('0x1f')](function(){return db[_0x846f('0x11c')][_0x846f('0x52')]({'where':{'teamId':{'$in':_0x4bfa0f}}});})[_0x846f('0x1f')](function(_0x4375a2){var _0x259b18=_['map'](_0x4375a2,function(_0x92db31){return db['UserVoicePrefix'][_0x846f('0x3b')]({'where':{'UserId':_0x9682d7['id'],'VoicePrefixId':_0x92db31['VoicePrefixId']}},{'transaction':_0x34294c});});return Promise[_0x846f('0x5e')](_0x259b18);});});})[_0x846f('0x1f')](function(){for(var _0x3d9ce8=0x0;_0x3d9ce8<_0x45b7f6[_0x846f('0x56')];_0x3d9ce8++){var _0x523808=_0x45b7f6[_0x3d9ce8]['getDataValue'](_0x846f('0xa0'));var _0x3d1673=_0x523808+'QueueId';socket[_0x846f('0xa8')](_0x846f('0x30')+_0x523808+_0x846f('0xb5'),{'UserId':_0x4fd383,['queueField']:_0x45b7f6[_0x3d9ce8]['id']});}})[_0x846f('0x1f')](respondWithStatusCode(_0x4ee342,null))[_0x846f('0x29')](APIHandleError(_0x4ee342));};exports['getLists']=function(_0x514684,_0x365bce){var _0x410f27={};var _0x30ced6={};var _0x2b7a5c;var _0x3f4f40;return db['User'][_0x846f('0x9a')]({'where':{'id':_0x514684[_0x846f('0x5f')]['id']}})[_0x846f('0x1f')](handleEntityNotFound(_0x365bce,null))[_0x846f('0x1f')](function(_0x2bbd9a){if(_0x2bbd9a){_0x2b7a5c=_0x2bbd9a;_0x30ced6[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0xcd')]['rawAttributes']);_0x30ced6[_0x846f('0x4d')]=_[_0x846f('0xd2')](_0x514684[_0x846f('0x4d')]);_0x30ced6[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x30ced6[_0x846f('0xd1')],_0x30ced6[_0x846f('0x4d')]);_0x410f27[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x30ced6['model'],qs[_0x846f('0xd6')](_0x514684[_0x846f('0x4d')][_0x846f('0xd6')]));_0x410f27[_0x846f('0x50')]=_0x410f27[_0x846f('0x50')][_0x846f('0x56')]?_0x410f27[_0x846f('0x50')]:_0x30ced6[_0x846f('0xd1')];_0x410f27['order']=qs[_0x846f('0xd8')](_0x514684[_0x846f('0x4d')]['sort']);_0x410f27[_0x846f('0x48')]=qs[_0x846f('0xd4')](_[_0x846f('0xd9')](_0x514684['query'],_0x30ced6[_0x846f('0xd4')]));if(_0x514684[_0x846f('0x4d')]['filter']){_0x410f27[_0x846f('0x48')]=_['merge'](_0x410f27[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x410f27['attributes'],function(_0x5c4149){var _0x149d06={};_0x149d06[_0x5c4149]={'$like':'%'+_0x514684[_0x846f('0x4d')][_0x846f('0x34')]+'%'};return _0x149d06;})});}_0x410f27=_[_0x846f('0x60')]({},_0x410f27,_0x514684[_0x846f('0x61')]);return _0x2b7a5c['getLists'](_0x410f27);}})[_0x846f('0x1f')](function(_0x231031){if(_0x231031){_0x3f4f40=_0x231031[_0x846f('0x56')];if(!_0x514684['query'][_0x846f('0xdb')](_0x846f('0xdc'))){_0x410f27['limit']=qs[_0x846f('0x1a')](_0x514684[_0x846f('0x4d')][_0x846f('0x1a')]);_0x410f27[_0x846f('0x19')]=qs['offset'](_0x514684[_0x846f('0x4d')]['offset']);}return _0x2b7a5c[_0x846f('0x121')](_0x410f27);}})[_0x846f('0x1f')](function(_0x57bb37){if(_0x57bb37){return _0x57bb37?{'count':_0x3f4f40,'rows':_0x57bb37}:null;}})[_0x846f('0x1f')](respondWithResult(_0x365bce,null))[_0x846f('0x29')](handleError(_0x365bce,null));};exports[_0x846f('0x122')]=function(_0x4637be,_0x31aa48){var _0x3eb027={};var _0x361077={};var _0x59cd23;return db[_0x846f('0x49')]['findOne']({'where':{'id':_0x4637be['params']['id']}})['then'](handleEntityNotFound(_0x31aa48,null))[_0x846f('0x1f')](function(_0x1af255){if(_0x1af255){_0x59cd23=_0x1af255;_0x361077[_0x846f('0xd1')]=_[_0x846f('0xd2')](db[_0x846f('0x49')][_0x846f('0x3e')]);_0x361077[_0x846f('0x4d')]=_['keys'](_0x4637be[_0x846f('0x4d')]);_0x361077[_0x846f('0xd4')]=_[_0x846f('0xd5')](_0x361077[_0x846f('0xd1')],_0x361077[_0x846f('0x4d')]);_0x3eb027[_0x846f('0x50')]=_[_0x846f('0xd5')](_0x361077[_0x846f('0xd1')],qs[_0x846f('0xd6')](_0x4637be[_0x846f('0x4d')][_0x846f('0xd6')]));_0x3eb027[_0x846f('0x50')]=_0x3eb027['attributes'][_0x846f('0x56')]?_0x3eb027['attributes']:_0x361077['model'];_0x3eb027[_0x846f('0xd7')]=qs[_0x846f('0xd8')](_0x4637be[_0x846f('0x4d')][_0x846f('0xd8')]);_0x3eb027['where']=qs[_0x846f('0xd4')](_['pick'](_0x4637be['query'],_0x361077[_0x846f('0xd4')]));if(_0x4637be[_0x846f('0x4d')][_0x846f('0x34')]){_0x3eb027[_0x846f('0x48')]=_[_0x846f('0x60')](_0x3eb027[_0x846f('0x48')],{'$or':_[_0x846f('0x36')](_0x3eb027['attributes'],function(_0x3ff46c){var _0x3f0b9b={};_0x3f0b9b[_0x3ff46c]={'$like':'%'+_0x4637be['query'][_0x846f('0x34')]+'%'};return _0x3f0b9b;})});}_0x3eb027[_0x846f('0xd1')]=db[_0x846f('0x49')];_0x3eb027['as']=_0x846f('0x31');_0x3eb027=_[_0x846f('0x60')]({},_0x3eb027,_0x4637be[_0x846f('0x61')]);return _0x59cd23[_0x846f('0xfb')]({'include':[_0x3eb027]});}})[_0x846f('0x1f')](function(_0x230446){if(_0x230446){var _0x33c355={},_0x4a283f=[];for(var _0x42996a=0x0;_0x42996a<_0x230446[_0x846f('0x56')];_0x42996a+=0x1){for(var _0x597e05=0x0,_0xf00625;_0x597e05<_0x230446[_0x42996a]['Agents']['length'];_0x597e05+=0x1){_0xf00625=_0x230446[_0x42996a][_0x846f('0x31')][_0x597e05][_0x846f('0x2d')]({'plain':!![]});_0x33c355[_0xf00625['id']]=_0xf00625;}}_0x33c355=_[_0x846f('0x123')](_0x33c355);for(var _0x1f31b9=qs[_0x846f('0x19')](_0x4637be['query'][_0x846f('0x19')]);_0x1f31b9<_0x33c355['length']&&_0x4a283f[_0x846f('0x56')]=_0x3eaff9[_0x98db('0x50')]){throw new Error(_0x98db('0x51'));}})[_0x98db('0x2a')](function(){if(_0x14f6d9){return db['UserVoiceQueueRt'][_0x98db('0x47')]({'where':{'membername':_0x14f6d9['name']},'individualHooks':!![]});}})[_0x98db('0x2a')](function(){if(_0x14f6d9){return _0x14f6d9[_0x98db('0x52')]({'raw':!![]});}})[_0x98db('0x2a')](function(_0x4ea2ca){if(_0x14f6d9){if(_0x4ea2ca){var _0x3a581f=[];_0x1d37ce=_0x4ea2ca;if(_0x1d37ce[_0x98db('0x2d')]){for(var _0x4d9548=0x0;_0x4d9548<_0x1d37ce[_0x98db('0x2d')];_0x4d9548++){_0x3a581f[_0x98db('0x32')](db[_0x98db('0x28')]['upsert']({'membername':_0x14f6d9['name'],'UserId':_0x14f6d9['id'],'queue_name':_0x1d37ce[_0x4d9548][_0x98db('0x22')],'VoiceQueueId':_0x1d37ce[_0x4d9548]['id'],'interface':_0x2de00f,'paused':_0x14f6d9['loginInPause']||![],'penalty':_0x1d37ce[_0x4d9548][_0x98db('0x53')]||0x0}));}return BPromise[_0x98db('0x48')](_0x3a581f);}}}})[_0x98db('0x2a')](function(){if(_0x14f6d9){return db[_0x98db('0x2b')][_0x98db('0x10')]({'where':{'membername':_0x14f6d9[_0x98db('0x22')],'exitAt':null}});}})[_0x98db('0x2a')](function(_0x329ef7){if(_0x14f6d9){if(_0x329ef7&&_0x329ef7[_0x98db('0x2d')]){var _0x501333=[];_0x329ef7[_0x98db('0x31')](function(_0x2a13a9){_0x501333[_0x98db('0x32')](_0x2a13a9[_0x98db('0x29')]({'exitAt':moment()[_0x98db('0x26')](_0x98db('0x2e'))}));});return BPromise['all'](_0x501333);}}})[_0x98db('0x2a')](function(){if(_0x14f6d9){var _0x260e9c=[];var _0xc9068c=[];var _0xb93c2=utils[_0x98db('0x30')]();var _0x27240d={'membername':_0x14f6d9['name'],'interface':_0x2de00f,'enterAt':moment()[_0x98db('0x26')](_0x98db('0x2e')),'role':_0x14f6d9['role'],'internal':_0x14f6d9[_0x98db('0x24')]};_0xb93c2[_0x98db('0x31')](function(_0x1768fe){_0x260e9c[_0x98db('0x32')](_['merge']({'channel':_0x1768fe,'type':_0x98db('0x54'),'data1':_0x98db('0x55'),'data2':_0x2de00f},_0x27240d));if(_0x14f6d9[_0x98db('0x4b')]){_0xc9068c[_0x98db('0x32')](_['merge']({'channel':_0x1768fe,'type':_0x98db('0x2c'),'data1':'LOGININPAUSE'},_0x27240d));}});return db[_0x98db('0x2b')][_0x98db('0x39')](_0x260e9c[_0x98db('0x56')](_0xc9068c),{'individualHooks':!![]});}})['then'](function(){if(_0x14f6d9){return _0x14f6d9['update']({'online':!![],'lastLoginAt':moment()['format'](_0x98db('0x2e')),'voicePause':_0x14f6d9['loginInPause']||![],'mailPause':_0x14f6d9[_0x98db('0x4b')]||![],'chatPause':_0x14f6d9['loginInPause']||![],'faxPause':_0x14f6d9[_0x98db('0x4b')]||![],'smsPause':_0x14f6d9[_0x98db('0x4b')]||![],'openchannelPause':_0x14f6d9[_0x98db('0x4b')]||![],'pauseType':_0x14f6d9[_0x98db('0x4b')]?_0x98db('0x57'):null,'lastPauseAt':moment()[_0x98db('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2de00f});}})[_0x98db('0x2a')](function(_0xca993d){_0x314331(_0xca993d);})[_0x98db('0x1c')](function(_0x43de9c){_0x2c8ae9(_0x9f860d['error'](0x1f4,_0x43de9c[_0x98db('0x1e')]));});});}; \ No newline at end of file +var _0xa023=['ShowUser','find','PauseUser','name','role','internal','interface','format','params','UserVoiceQueueRt','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','catch','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','LogoutUser','destroy','forEach','update','all','LoginUser','mobile','count','../../config/license/util','agents','getVoiceQueues','loginInPause','merge','PAUSE','concat','LOGININPAUSE','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','User','findAll','options','raw','where','attributes','limit','map','model','include','then','info','GetUser','debug','stringify','error','message'];(function(_0x548306,_0xdb1082){var _0x519b4f=function(_0x268489){while(--_0x268489){_0x548306['push'](_0x548306['shift']());}};_0x519b4f(++_0xdb1082);}(_0xa023,0xd7));var _0x3a02=function(_0x1a4536,_0x2715d8){_0x1a4536=_0x1a4536-0x0;var _0x1ca43f=_0xa023[_0x1a4536];return _0x1ca43f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a02('0x0'));var BPromise=require('bluebird');var Redis=require(_0x3a02('0x1'));var db=require(_0x3a02('0x2'))['db'];var utils=require(_0x3a02('0x3'));var logger=require('../../config/logger')(_0x3a02('0x4'));var config=require(_0x3a02('0x5'));config[_0x3a02('0x6')]=_[_0x3a02('0x7')](config[_0x3a02('0x6')],{'host':_0x3a02('0x8'),'port':0x18eb});var socket=require(_0x3a02('0x9'))(new Redis(config[_0x3a02('0x6')]));require(_0x3a02('0xa'))['register'](socket);exports['GetUser']=function(_0x10cf23){var _0x5d1872=this;return new Promise(function(_0x122bb6,_0x212462){return db[_0x3a02('0xb')][_0x3a02('0xc')]({'raw':_0x10cf23['options']?_0x10cf23[_0x3a02('0xd')][_0x3a02('0xe')]===undefined?!![]:![]:!![],'where':_0x10cf23['options']?_0x10cf23['options'][_0x3a02('0xf')]||null:null,'attributes':_0x10cf23[_0x3a02('0xd')]?_0x10cf23['options'][_0x3a02('0x10')]||null:null,'limit':_0x10cf23[_0x3a02('0xd')]?_0x10cf23[_0x3a02('0xd')][_0x3a02('0x11')]||null:null,'include':_0x10cf23[_0x3a02('0xd')]?_0x10cf23[_0x3a02('0xd')]['include']?_[_0x3a02('0x12')](_0x10cf23[_0x3a02('0xd')]['include'],function(_0x5c0e6b){return{'model':db[_0x5c0e6b[_0x3a02('0x13')]],'as':_0x5c0e6b['as'],'attributes':_0x5c0e6b[_0x3a02('0x10')],'include':_0x5c0e6b[_0x3a02('0x14')]?_[_0x3a02('0x12')](_0x5c0e6b[_0x3a02('0x14')],function(_0x495c22){return{'model':db[_0x495c22[_0x3a02('0x13')]],'as':_0x495c22['as'],'attributes':_0x495c22[_0x3a02('0x10')],'include':_0x495c22[_0x3a02('0x14')]?_[_0x3a02('0x12')](_0x495c22['include'],function(_0x244c0b){return{'model':db[_0x244c0b[_0x3a02('0x13')]],'as':_0x244c0b['as'],'attributes':_0x244c0b[_0x3a02('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3a02('0x15')](function(_0x45e011){logger[_0x3a02('0x16')](_0x3a02('0x17'),_0x10cf23);logger[_0x3a02('0x18')]('GetUser',_0x10cf23,JSON[_0x3a02('0x19')](_0x45e011));_0x122bb6(_0x45e011);})['catch'](function(_0x13d1e2){logger[_0x3a02('0x1a')]('GetUser',_0x13d1e2[_0x3a02('0x1b')],_0x10cf23);_0x212462(_0x5d1872[_0x3a02('0x1a')](0x1f4,_0x13d1e2[_0x3a02('0x1b')]));});});};exports[_0x3a02('0x1c')]=function(_0x8f4fe5){var _0x12add2=this;return new Promise(function(_0x1e7e23,_0xf63c3f){return db[_0x3a02('0xb')][_0x3a02('0x1d')]({'raw':_0x8f4fe5[_0x3a02('0xd')]?_0x8f4fe5[_0x3a02('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x8f4fe5[_0x3a02('0xd')]?_0x8f4fe5['options'][_0x3a02('0xf')]||null:null,'attributes':_0x8f4fe5['options']?_0x8f4fe5[_0x3a02('0xd')][_0x3a02('0x10')]||null:null,'include':_0x8f4fe5[_0x3a02('0xd')]?_0x8f4fe5[_0x3a02('0xd')][_0x3a02('0x14')]?_[_0x3a02('0x12')](_0x8f4fe5[_0x3a02('0xd')][_0x3a02('0x14')],function(_0x15d042){return{'model':db[_0x15d042[_0x3a02('0x13')]],'as':_0x15d042['as'],'attributes':_0x15d042[_0x3a02('0x10')],'include':_0x15d042[_0x3a02('0x14')]?_['map'](_0x15d042[_0x3a02('0x14')],function(_0x50e028){return{'model':db[_0x50e028['model']],'as':_0x50e028['as'],'attributes':_0x50e028[_0x3a02('0x10')],'include':_0x50e028['include']?_['map'](_0x50e028[_0x3a02('0x14')],function(_0x4cee18){return{'model':db[_0x4cee18['model']],'as':_0x4cee18['as'],'attributes':_0x4cee18[_0x3a02('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3a02('0x15')](function(_0x32863a){logger['info'](_0x3a02('0x1c'),_0x8f4fe5);logger[_0x3a02('0x18')](_0x3a02('0x1c'),_0x8f4fe5,JSON[_0x3a02('0x19')](_0x32863a));_0x1e7e23(_0x32863a);})['catch'](function(_0x3a630f){logger[_0x3a02('0x1a')]('ShowUser',_0x3a630f[_0x3a02('0x1b')],_0x8f4fe5);_0xf63c3f(_0x12add2[_0x3a02('0x1a')](0x1f4,_0x3a630f[_0x3a02('0x1b')]));});});};exports[_0x3a02('0x1e')]=function(_0xca83be){var _0x35ec06;return db[_0x3a02('0xb')][_0x3a02('0x1d')]({'where':_0xca83be['options']['where']||{},'attributes':['id',_0x3a02('0x1f'),_0x3a02('0x20'),_0x3a02('0x21'),_0x3a02('0x22')]})[_0x3a02('0x15')](function(_0xd9ae9f){if(!_0xd9ae9f){throw new Error(util[_0x3a02('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0xca83be[_0x3a02('0x24')]['id']));}_0x35ec06=_0xd9ae9f;return db[_0x3a02('0x25')]['update']({'paused':0x1},{'where':{'UserId':_0x35ec06['id']},'individualHooks':!![]});})[_0x3a02('0x15')](function(){return db[_0x3a02('0x26')]['findAll']({'where':{'membername':_0x35ec06[_0x3a02('0x1f')],'type':'PAUSE','exitAt':null}});})[_0x3a02('0x15')](function(_0x3fd89c){if(_0x3fd89c&&_0x3fd89c[_0x3a02('0x27')]){var _0x3c3f04=moment()['format'](_0x3a02('0x28'));for(var _0x14db6e=0x0,_0x222c16=_0x3fd89c[_0x3a02('0x27')];_0x14db6e<_0x222c16;_0x14db6e++){_0x3fd89c[_0x14db6e][_0x3a02('0x29')]({'exitAt':_0x3c3f04});}}})[_0x3a02('0x15')](function(){var _0x6d4b04=[];var _0x14cb3c=utils[_0x3a02('0x2a')]();_0x14cb3c['forEach'](function(_0x1b3047){_0x6d4b04[_0x3a02('0x2b')]({'channel':_0x1b3047,'membername':_0x35ec06[_0x3a02('0x1f')],'interface':_[_0x3a02('0x2c')](_0x35ec06['interface'])?util['format'](_0x3a02('0x2d'),_0x35ec06['name']):_0x35ec06[_0x3a02('0x22')],'type':'PAUSE','enterAt':moment()[_0x3a02('0x23')](_0x3a02('0x28')),'data1':_0xca83be[_0x3a02('0x2e')][_0x3a02('0x2f')]||_0x3a02('0x30'),'role':_0x35ec06[_0x3a02('0x20')],'internal':_0x35ec06[_0x3a02('0x21')],'uniqueid':_0xca83be[_0x3a02('0x2e')][_0x3a02('0x31')]||null});});return db[_0x3a02('0x26')][_0x3a02('0x32')](_0x6d4b04,{'individualHooks':!![]});})[_0x3a02('0x15')](function(){return _0x35ec06['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xca83be[_0x3a02('0x2e')]['type']||_0x3a02('0x30'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x3a02('0x33')](function(_0x3e4793){throw _0x3e4793;});};exports['UnpauseUser']=function(_0x130ec7){return Promise[_0x3a02('0x34')]()[_0x3a02('0x15')](function(){if(_0x130ec7['body']['channel']&&!utils['isValidChannel'](_0x130ec7[_0x3a02('0x2e')][_0x3a02('0x35')])){throw new Error(util[_0x3a02('0x23')](_0x3a02('0x36'),_0x130ec7[_0x3a02('0x2e')][_0x3a02('0x35')]));}return db[_0x3a02('0xb')][_0x3a02('0x37')]({'where':_0x130ec7[_0x3a02('0xd')][_0x3a02('0xf')]||{},'attributes':['id','name',_0x3a02('0x20'),'internal',_0x3a02('0x22'),_0x3a02('0x38'),'voicePause',_0x3a02('0x39'),'chatPause',_0x3a02('0x3a'),_0x3a02('0x3b'),_0x3a02('0x3c'),'whatsappPause',_0x3a02('0x3d'),_0x3a02('0x3e')]});})['then'](function(_0x510070){if(!_0x510070){throw new Error(util[_0x3a02('0x23')](_0x3a02('0x3f'),_0x130ec7[_0x3a02('0x24')]['id']));}return _0x510070[_0x3a02('0x40')](_0x130ec7['body'][_0x3a02('0x35')],'system');})[_0x3a02('0x33')](function(_0x56c49a){throw _0x56c49a;});};exports[_0x3a02('0x41')]=function(_0x5edb11){var _0x3e0309=this;return new Promise(function(_0x57b943,_0x330fc6){var _0x5390ad;return db[_0x3a02('0xb')][_0x3a02('0x37')]({'where':_0x5edb11[_0x3a02('0xd')][_0x3a02('0xf')]||{},'attributes':['id',_0x3a02('0x1f')]})[_0x3a02('0x15')](function(_0x27153d){if(_0x27153d){_0x5390ad=_0x27153d;return db[_0x3a02('0x25')][_0x3a02('0x42')]({'where':{'membername':_0x5390ad[_0x3a02('0x1f')]},'individualHooks':!![]});}})[_0x3a02('0x15')](function(){if(_0x5390ad){return db[_0x3a02('0x26')][_0x3a02('0xc')]({'where':{'membername':_0x5390ad[_0x3a02('0x1f')],'exitAt':null}});}})[_0x3a02('0x15')](function(_0x4ca1c1){if(_0x5390ad){if(_0x4ca1c1&&_0x4ca1c1[_0x3a02('0x27')]){var _0x1fc747=[];_0x4ca1c1[_0x3a02('0x43')](function(_0x18e2d5){_0x1fc747[_0x3a02('0x2b')](_0x18e2d5[_0x3a02('0x44')]({'exitAt':moment()[_0x3a02('0x23')](_0x3a02('0x28'))}));});return BPromise[_0x3a02('0x45')](_0x1fc747);}}})[_0x3a02('0x15')](function(){if(_0x5390ad){return _0x5390ad[_0x3a02('0x44')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x3a02('0x15')](function(_0x42a087){_0x57b943(_0x42a087);})[_0x3a02('0x33')](function(_0x481879){_0x330fc6(_0x3e0309[_0x3a02('0x1a')](0x1f4,_0x481879['message']));});});};exports[_0x3a02('0x46')]=function(_0xcdc4cc){var _0x56d35d=this;return new Promise(function(_0x5b748b,_0x4eb2d9){var _0x191783;var _0x379ed4;var _0x2af00a;var _0x1e99cb;return db['User'][_0x3a02('0x37')]({'where':_0xcdc4cc[_0x3a02('0xd')][_0x3a02('0xf')]||{},'attributes':['id',_0x3a02('0x1f'),_0x3a02('0x20'),_0x3a02('0x47'),'phone',_0x3a02('0x21'),'loginInPause',_0x3a02('0x22')]})[_0x3a02('0x15')](function(_0x4a0ff3){if(_0x4a0ff3){_0x191783=_0x4a0ff3;_0x1e99cb=_0xcdc4cc[_0x3a02('0x2e')][_0x3a02('0x22')]?_0xcdc4cc[_0x3a02('0x2e')][_0x3a02('0x22')]:util[_0x3a02('0x23')](_0x3a02('0x2d'),_0x191783[_0x3a02('0x1f')]);return db[_0x3a02('0xb')][_0x3a02('0x48')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x191783['id']}}});}})['then'](function(_0x2675f9){if(_0x2675f9){_0x2af00a=_0x2675f9;return require(_0x3a02('0x49'))['getLicense']();}})[_0x3a02('0x15')](function(_0x2540a2){if(_0x2540a2&&_0x2540a2[_0x3a02('0x4a')]&&_0x2af00a>=_0x2540a2[_0x3a02('0x4a')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x3a02('0x15')](function(){if(_0x191783){return db['UserVoiceQueueRt'][_0x3a02('0x42')]({'where':{'membername':_0x191783[_0x3a02('0x1f')]},'individualHooks':!![]});}})[_0x3a02('0x15')](function(){if(_0x191783){return _0x191783[_0x3a02('0x4b')]({'raw':!![]});}})[_0x3a02('0x15')](function(_0x214f04){if(_0x191783){if(_0x214f04){var _0x216f4c=[];_0x379ed4=_0x214f04;if(_0x379ed4[_0x3a02('0x27')]){for(var _0x56431c=0x0;_0x56431c<_0x379ed4[_0x3a02('0x27')];_0x56431c++){_0x216f4c[_0x3a02('0x2b')](db[_0x3a02('0x25')]['upsert']({'membername':_0x191783[_0x3a02('0x1f')],'UserId':_0x191783['id'],'queue_name':_0x379ed4[_0x56431c][_0x3a02('0x1f')],'VoiceQueueId':_0x379ed4[_0x56431c]['id'],'interface':_0x1e99cb,'paused':_0x191783[_0x3a02('0x4c')]||![],'penalty':_0x379ed4[_0x56431c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x3a02('0x45')](_0x216f4c);}}}})[_0x3a02('0x15')](function(){if(_0x191783){return db[_0x3a02('0x26')][_0x3a02('0xc')]({'where':{'membername':_0x191783['name'],'exitAt':null}});}})[_0x3a02('0x15')](function(_0x17bd88){if(_0x191783){if(_0x17bd88&&_0x17bd88[_0x3a02('0x27')]){var _0x5f2a45=[];_0x17bd88[_0x3a02('0x43')](function(_0x184c98){_0x5f2a45[_0x3a02('0x2b')](_0x184c98['update']({'exitAt':moment()[_0x3a02('0x23')](_0x3a02('0x28'))}));});return BPromise[_0x3a02('0x45')](_0x5f2a45);}}})['then'](function(){if(_0x191783){var _0x519bc0=[];var _0x11643f=[];var _0x4f2029=utils[_0x3a02('0x2a')]();var _0x1beee0={'membername':_0x191783[_0x3a02('0x1f')],'interface':_0x1e99cb,'enterAt':moment()[_0x3a02('0x23')](_0x3a02('0x28')),'role':_0x191783[_0x3a02('0x20')],'internal':_0x191783[_0x3a02('0x21')]};_0x4f2029[_0x3a02('0x43')](function(_0x4eec78){_0x519bc0[_0x3a02('0x2b')](_['merge']({'channel':_0x4eec78,'type':'LOGIN','data1':'callysquare','data2':_0x1e99cb},_0x1beee0));if(_0x191783[_0x3a02('0x4c')]){_0x11643f['push'](_[_0x3a02('0x4d')]({'channel':_0x4eec78,'type':_0x3a02('0x4e'),'data1':'LOGININPAUSE'},_0x1beee0));}});return db[_0x3a02('0x26')][_0x3a02('0x32')](_0x519bc0[_0x3a02('0x4f')](_0x11643f),{'individualHooks':!![]});}})['then'](function(){if(_0x191783){return _0x191783[_0x3a02('0x44')]({'online':!![],'lastLoginAt':moment()[_0x3a02('0x23')](_0x3a02('0x28')),'voicePause':_0x191783[_0x3a02('0x4c')]||![],'mailPause':_0x191783[_0x3a02('0x4c')]||![],'chatPause':_0x191783[_0x3a02('0x4c')]||![],'faxPause':_0x191783[_0x3a02('0x4c')]||![],'smsPause':_0x191783[_0x3a02('0x4c')]||![],'openchannelPause':_0x191783[_0x3a02('0x4c')]||![],'pauseType':_0x191783[_0x3a02('0x4c')]?_0x3a02('0x50'):null,'lastPauseAt':moment()[_0x3a02('0x23')](_0x3a02('0x28')),'interface':_0x1e99cb});}})[_0x3a02('0x15')](function(_0x357117){_0x5b748b(_0x357117);})[_0x3a02('0x33')](function(_0x8f51f6){_0x4eb2d9(_0x56d35d[_0x3a02('0x1a')](0x1f4,_0x8f51f6[_0x3a02('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4eda616..8530a8b 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 _0xb6e3=['save','remove','update','emit','register','length','user:','./user.events'];(function(_0x1d26cd,_0x19ade0){var _0x2eeb3d=function(_0x401eae){while(--_0x401eae){_0x1d26cd['push'](_0x1d26cd['shift']());}};_0x2eeb3d(++_0x19ade0);}(_0xb6e3,0x107));var _0x3b6e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb6e3[_0x3ab51d];return _0x29a04e;};'use strict';var UserEvents=require(_0x3b6e('0x0'));var events=[_0x3b6e('0x1'),_0x3b6e('0x2'),_0x3b6e('0x3')];function createListener(_0x31ec9e,_0x2c6366){return function(_0x40efbf){_0x2c6366[_0x3b6e('0x4')](_0x31ec9e,_0x40efbf);};}function removeListener(_0x30ab0f,_0x5c07fc){return function(){UserEvents['removeListener'](_0x30ab0f,_0x5c07fc);};}exports[_0x3b6e('0x5')]=function(_0x4bc707){for(var _0x5cc997=0x0,_0x3d5800=events[_0x3b6e('0x6')];_0x5cc997<_0x3d5800;_0x5cc997++){var _0x2e5d58=events[_0x5cc997];var _0x2f72a0=createListener(_0x3b6e('0x7')+_0x2e5d58,_0x4bc707);UserEvents['on'](_0x2e5d58,_0x2f72a0);}}; \ No newline at end of file +var _0x4e4e=['length','./user.events','save','remove','update','emit','removeListener'];(function(_0x28cc06,_0x165bf4){var _0x311f57=function(_0x598111){while(--_0x598111){_0x28cc06['push'](_0x28cc06['shift']());}};_0x311f57(++_0x165bf4);}(_0x4e4e,0x1eb));var _0xe4e4=function(_0x31f88d,_0x17a396){_0x31f88d=_0x31f88d-0x0;var _0x3677c7=_0x4e4e[_0x31f88d];return _0x3677c7;};'use strict';var UserEvents=require(_0xe4e4('0x0'));var events=[_0xe4e4('0x1'),_0xe4e4('0x2'),_0xe4e4('0x3')];function createListener(_0x249a0f,_0x183b9f){return function(_0x2e32c6){_0x183b9f[_0xe4e4('0x4')](_0x249a0f,_0x2e32c6);};}function removeListener(_0xd876d7,_0x4a62fa){return function(){UserEvents[_0xe4e4('0x5')](_0xd876d7,_0x4a62fa);};}exports['register']=function(_0x56ff8f){for(var _0x2b23e8=0x0,_0x173ec6=events[_0xe4e4('0x6')];_0x2b23e8<_0x173ec6;_0x2b23e8++){var _0x1228a6=events[_0x2b23e8];var _0x5f3de4=createListener('user:'+_0x1228a6,_0x56ff8f);UserEvents['on'](_0x1228a6,_0x5f3de4);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a8500de..b0aa28d 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3edf77,_0x4a26eb){var _0x2f5532=function(_0x33e1e0){while(--_0x33e1e0){_0x3edf77['push'](_0x3edf77['shift']());}};_0x2f5532(++_0x4a26eb);}(_0x70e0,0x17b));var _0x070e=function(_0x23707a,_0x4c5296){_0x23707a=_0x23707a-0x0;var _0x3eeea8=_0x70e0[_0x23707a];return _0x3eeea8;};'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(_0x5997cc,_0x2431b9){var _0x30472c=function(_0x2806bd){while(--_0x2806bd){_0x5997cc['push'](_0x5997cc['shift']());}};_0x30472c(++_0x2431b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xcb91[_0x5e8d3e];return _0x1348c0;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a1a1869..5093f62 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 _0x4919=['exports','INTEGER','sequelize'];(function(_0x2c98dd,_0x53d2b){var _0x1d52bf=function(_0x3c9c89){while(--_0x3c9c89){_0x2c98dd['push'](_0x2c98dd['shift']());}};_0x1d52bf(++_0x53d2b);}(_0x4919,0xd7));var _0x9491=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4919[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x9491('0x0'));module[_0x9491('0x1')]={'penalty':{'type':Sequelize[_0x9491('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2ac=['sequelize'];(function(_0x12a2b6,_0xae8207){var _0x54d3c3=function(_0x536020){while(--_0x536020){_0x12a2b6['push'](_0x12a2b6['shift']());}};_0x54d3c3(++_0xae8207);}(_0xf2ac,0x91));var _0xcf2a=function(_0x405a49,_0x261f6e){_0x405a49=_0x405a49-0x0;var _0x2707cb=_0xf2ac[_0x405a49];return _0x2707cb;};'use strict';var Sequelize=require(_0xcf2a('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 d0d1247..b4dd08f 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 _0x345a=['../../config/logger','api','moment','bluebird','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x5a29d9,_0x4bf005){var _0x526d5c=function(_0x5b6eda){while(--_0x5b6eda){_0x5a29d9['push'](_0x5a29d9['shift']());}};_0x526d5c(++_0x4bf005);}(_0x345a,0x76));var _0xa345=function(_0x1ab7f1,_0x3a458b){_0x1ab7f1=_0x1ab7f1-0x0;var _0x20c53f=_0x345a[_0x1ab7f1];return _0x20c53f;};'use strict';var _=require(_0xa345('0x0'));var util=require(_0xa345('0x1'));var logger=require(_0xa345('0x2'))(_0xa345('0x3'));var moment=require(_0xa345('0x4'));var BPromise=require(_0xa345('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa345('0x6'));var config=require('../../config/environment');var attributes=require(_0xa345('0x7'));module[_0xa345('0x8')]=function(_0x24d38d,_0x36c887){return _0x24d38d[_0xa345('0x9')](_0xa345('0xa'),attributes,{'tableName':_0xa345('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f94=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues'];(function(_0x2be4fc,_0xe98a8){var _0x5a36d0=function(_0x3c4c20){while(--_0x3c4c20){_0x2be4fc['push'](_0x2be4fc['shift']());}};_0x5a36d0(++_0xe98a8);}(_0x6f94,0x68));var _0x46f9=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x6f94[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x46f9('0x0'));var util=require(_0x46f9('0x1'));var logger=require(_0x46f9('0x2'))(_0x46f9('0x3'));var moment=require(_0x46f9('0x4'));var BPromise=require(_0x46f9('0x5'));var rp=require(_0x46f9('0x6'));var fs=require('fs');var path=require(_0x46f9('0x7'));var rimraf=require('rimraf');var config=require(_0x46f9('0x8'));var attributes=require(_0x46f9('0x9'));module['exports']=function(_0x2629d2,_0x22af7e){return _0x2629d2[_0x46f9('0xa')](_0x46f9('0xb'),attributes,{'tableName':_0x46f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index cebafe6..19da6f1 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 _0x0a12=['randomstring','../../config/utils','rpc','client','then','info','debug','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x1e45ec,_0x2e11eb){var _0x42f22d=function(_0x35bd42){while(--_0x35bd42){_0x1e45ec['push'](_0x1e45ec['shift']());}};_0x42f22d(++_0x2e11eb);}(_0x0a12,0xb0));var _0x20a1=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0a12[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x20a1('0x0'));var util=require(_0x20a1('0x1'));var moment=require(_0x20a1('0x2'));var BPromise=require(_0x20a1('0x3'));var rs=require(_0x20a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20a1('0x5'));var logger=require('../../config/logger')(_0x20a1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20a1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52b15b,_0x27c767,_0x38a9bd){return new BPromise(function(_0x233bf4,_0xb5bbaf){return client['request'](_0x52b15b,_0x38a9bd)[_0x20a1('0x8')](function(_0x5c18ad){logger[_0x20a1('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x27c767,'request\x20sent');logger[_0x20a1('0xa')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x27c767,_0x20a1('0xb'),JSON[_0x20a1('0xc')](_0x5c18ad));if(_0x5c18ad[_0x20a1('0xd')]){if(_0x5c18ad['error'][_0x20a1('0xe')]===0x1f4){logger[_0x20a1('0xd')](_0x20a1('0xf'),_0x27c767,_0x5c18ad[_0x20a1('0xd')][_0x20a1('0x10')]);return _0xb5bbaf(_0x5c18ad[_0x20a1('0xd')][_0x20a1('0x10')]);}logger[_0x20a1('0xd')](_0x20a1('0xf'),_0x27c767,_0x5c18ad[_0x20a1('0xd')][_0x20a1('0x10')]);return _0x233bf4(_0x5c18ad[_0x20a1('0xd')]['message']);}else{logger[_0x20a1('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x27c767,_0x20a1('0xb'));_0x233bf4(_0x5c18ad[_0x20a1('0x11')][_0x20a1('0x10')]);}})['catch'](function(_0x253984){logger[_0x20a1('0xd')](_0x20a1('0xf'),_0x27c767,_0x253984);_0xb5bbaf(_0x253984);});});} \ No newline at end of file +var _0xf0db=['../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0xf0db,0xc3));var _0xbf0d=function(_0x1232e7,_0x3808cd){_0x1232e7=_0x1232e7-0x0;var _0x29a410=_0xf0db[_0x1232e7];return _0x29a410;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var moment=require('moment');var BPromise=require(_0xbf0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf0d('0x4'))('rpc');var config=require(_0xbf0d('0x5'));var jayson=require(_0xbf0d('0x6'));var client=jayson['client'][_0xbf0d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f1c03,_0x4a1391,_0x309958){return new BPromise(function(_0x1effe8,_0xd67c8f){return client[_0xbf0d('0x8')](_0x5f1c03,_0x309958)[_0xbf0d('0x9')](function(_0x4640ad){logger[_0xbf0d('0xa')](_0xbf0d('0xb'),_0x4a1391,_0xbf0d('0xc'));logger[_0xbf0d('0xd')](_0xbf0d('0xe'),_0x4a1391,_0xbf0d('0xc'),JSON[_0xbf0d('0xf')](_0x4640ad));if(_0x4640ad['error']){if(_0x4640ad['error']['code']===0x1f4){logger[_0xbf0d('0x10')](_0xbf0d('0xb'),_0x4a1391,_0x4640ad[_0xbf0d('0x10')][_0xbf0d('0x11')]);return _0xd67c8f(_0x4640ad[_0xbf0d('0x10')][_0xbf0d('0x11')]);}logger[_0xbf0d('0x10')](_0xbf0d('0xb'),_0x4a1391,_0x4640ad[_0xbf0d('0x10')][_0xbf0d('0x11')]);return _0x1effe8(_0x4640ad[_0xbf0d('0x10')][_0xbf0d('0x11')]);}else{logger[_0xbf0d('0xa')](_0xbf0d('0xb'),_0x4a1391,_0xbf0d('0xc'));_0x1effe8(_0x4640ad[_0xbf0d('0x12')]['message']);}})[_0xbf0d('0x13')](function(_0x126aab){logger['error'](_0xbf0d('0xb'),_0x4a1391,_0x126aab);_0xd67c8f(_0x126aab);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1ce8e18..36c0dea 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x40d92,_0x2cd4ad){var _0x647809=function(_0x5ce6cc){while(--_0x5ce6cc){_0x40d92['push'](_0x40d92['shift']());}};_0x647809(++_0x2cd4ad);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5831a3,_0x4463b7){var _0x198912=function(_0xa0d267){while(--_0xa0d267){_0x5831a3['push'](_0x5831a3['shift']());}};_0x198912(++_0x4463b7);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 05b4494..8beee15 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 _0x04ed=['STRING','sequelize','exports','INTEGER'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x04ed,0xf1));var _0xd04e=function(_0x335f64,_0x2d304b){_0x335f64=_0x335f64-0x0;var _0x3df65b=_0x04ed[_0x335f64];return _0x3df65b;};'use strict';var Sequelize=require(_0xd04e('0x0'));module[_0xd04e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd04e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd04e('0x3')]}}; \ No newline at end of file +var _0x69ca=['sequelize','exports','INTEGER','STRING'];(function(_0x193a0d,_0x376c7c){var _0x3c0dd6=function(_0xb4176c){while(--_0xb4176c){_0x193a0d['push'](_0x193a0d['shift']());}};_0x3c0dd6(++_0x376c7c);}(_0x69ca,0x100));var _0xa69c=function(_0x2d6141,_0x189922){_0x2d6141=_0x2d6141-0x0;var _0xbc02da=_0x69ca[_0x2d6141];return _0xbc02da;};'use strict';var Sequelize=require(_0xa69c('0x0'));module[_0xa69c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa69c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa69c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 18e987b..f2f4b7c 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 _0x2a3b=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x5f1875,_0x38329e){var _0x3b5144=function(_0x1e9041){while(--_0x1e9041){_0x5f1875['push'](_0x5f1875['shift']());}};_0x3b5144(++_0x38329e);}(_0x2a3b,0x196));var _0xb2a3=function(_0x385720,_0x5e0f46){_0x385720=_0x385720-0x0;var _0x40c877=_0x2a3b[_0x385720];return _0x40c877;};'use strict';var _=require(_0xb2a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb2a3('0x1'));var moment=require(_0xb2a3('0x2'));var BPromise=require(_0xb2a3('0x3'));var rp=require(_0xb2a3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2a3('0x5'));var config=require(_0xb2a3('0x6'));var attributes=require(_0xb2a3('0x7'));module['exports']=function(_0x425260,_0x31934c){return _0x425260[_0xb2a3('0x8')](_0xb2a3('0x9'),attributes,{'tableName':_0xb2a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b4c=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','path','../../config/environment','./userFaxQueue.attributes'];(function(_0x1ad576,_0x1c92e7){var _0x8501e4=function(_0x1a91eb){while(--_0x1a91eb){_0x1ad576['push'](_0x1ad576['shift']());}};_0x8501e4(++_0x1c92e7);}(_0x8b4c,0x126));var _0xc8b4=function(_0x391692,_0x32553b){_0x391692=_0x391692-0x0;var _0x1dcda3=_0x8b4c[_0x391692];return _0x1dcda3;};'use strict';var _=require(_0xc8b4('0x0'));var util=require(_0xc8b4('0x1'));var logger=require('../../config/logger')(_0xc8b4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8b4('0x3'));var rimraf=require('rimraf');var config=require(_0xc8b4('0x4'));var attributes=require(_0xc8b4('0x5'));module[_0xc8b4('0x6')]=function(_0x4c2521,_0x41f005){return _0x4c2521[_0xc8b4('0x7')](_0xc8b4('0x8'),attributes,{'tableName':_0xc8b4('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 e082633..03b81ae 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 _0x2aa2=['UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info'];(function(_0x341a5a,_0x4ae5ed){var _0x53f85b=function(_0x24899d){while(--_0x24899d){_0x341a5a['push'](_0x341a5a['shift']());}};_0x53f85b(++_0x4ae5ed);}(_0x2aa2,0x134));var _0x22aa=function(_0x4de323,_0x2ae631){_0x4de323=_0x4de323-0x0;var _0x3c54ab=_0x2aa2[_0x4de323];return _0x3c54ab;};'use strict';var _=require('lodash');var util=require(_0x22aa('0x0'));var moment=require(_0x22aa('0x1'));var BPromise=require(_0x22aa('0x2'));var rs=require(_0x22aa('0x3'));var fs=require('fs');var Redis=require(_0x22aa('0x4'));var db=require(_0x22aa('0x5'))['db'];var utils=require(_0x22aa('0x6'));var logger=require(_0x22aa('0x7'))(_0x22aa('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x22aa('0x9')][_0x22aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf22791,_0x385846,_0x5036c8){return new BPromise(function(_0x16fa71,_0x1c98a7){return client['request'](_0xf22791,_0x5036c8)['then'](function(_0x8a9772){logger[_0x22aa('0xb')](_0x22aa('0xc'),_0x385846,'request\x20sent');logger[_0x22aa('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x385846,_0x22aa('0xe'),JSON[_0x22aa('0xf')](_0x8a9772));if(_0x8a9772['error']){if(_0x8a9772[_0x22aa('0x10')][_0x22aa('0x11')]===0x1f4){logger[_0x22aa('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x385846,_0x8a9772[_0x22aa('0x10')]['message']);return _0x1c98a7(_0x8a9772[_0x22aa('0x10')][_0x22aa('0x12')]);}logger[_0x22aa('0x10')](_0x22aa('0xc'),_0x385846,_0x8a9772['error'][_0x22aa('0x12')]);return _0x16fa71(_0x8a9772['error'][_0x22aa('0x12')]);}else{logger[_0x22aa('0xb')](_0x22aa('0xc'),_0x385846,_0x22aa('0xe'));_0x16fa71(_0x8a9772[_0x22aa('0x13')]['message']);}})['catch'](function(_0x5e9a87){logger[_0x22aa('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x385846,_0x5e9a87);_0x1c98a7(_0x5e9a87);});});} \ No newline at end of file +var _0x5d6f=['UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1ed084,_0x3f4260){var _0x5ab7c0=function(_0x476aa3){while(--_0x476aa3){_0x1ed084['push'](_0x1ed084['shift']());}};_0x5ab7c0(++_0x3f4260);}(_0x5d6f,0x7f));var _0xf5d6=function(_0x217332,_0x3c4328){_0x217332=_0x217332-0x0;var _0x141ba3=_0x5d6f[_0x217332];return _0x141ba3;};'use strict';var _=require(_0xf5d6('0x0'));var util=require('util');var moment=require(_0xf5d6('0x1'));var BPromise=require(_0xf5d6('0x2'));var rs=require(_0xf5d6('0x3'));var fs=require('fs');var Redis=require(_0xf5d6('0x4'));var db=require(_0xf5d6('0x5'))['db'];var utils=require(_0xf5d6('0x6'));var logger=require('../../config/logger')(_0xf5d6('0x7'));var config=require(_0xf5d6('0x8'));var jayson=require(_0xf5d6('0x9'));var client=jayson[_0xf5d6('0xa')][_0xf5d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ad0aa,_0x2f7a49,_0x1a37fa){return new BPromise(function(_0x532470,_0x3eae2d){return client[_0xf5d6('0xc')](_0x1ad0aa,_0x1a37fa)['then'](function(_0x55d0d7){logger['info'](_0xf5d6('0xd'),_0x2f7a49,'request\x20sent');logger[_0xf5d6('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2f7a49,'request\x20sent',JSON[_0xf5d6('0xf')](_0x55d0d7));if(_0x55d0d7['error']){if(_0x55d0d7[_0xf5d6('0x10')]['code']===0x1f4){logger[_0xf5d6('0x10')](_0xf5d6('0xd'),_0x2f7a49,_0x55d0d7[_0xf5d6('0x10')][_0xf5d6('0x11')]);return _0x3eae2d(_0x55d0d7['error']['message']);}logger[_0xf5d6('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2f7a49,_0x55d0d7[_0xf5d6('0x10')][_0xf5d6('0x11')]);return _0x532470(_0x55d0d7[_0xf5d6('0x10')]['message']);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2f7a49,_0xf5d6('0x12'));_0x532470(_0x55d0d7[_0xf5d6('0x13')][_0xf5d6('0x11')]);}})['catch'](function(_0x4e25ec){logger[_0xf5d6('0x10')](_0xf5d6('0xd'),_0x2f7a49,_0x4e25ec);_0x3eae2d(_0x4e25ec);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 09da607..ce49e82 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3070ae,_0x1728ff){var _0x43f2c1=function(_0x3e0201){while(--_0x3e0201){_0x3070ae['push'](_0x3070ae['shift']());}};_0x43f2c1(++_0x1728ff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xcb91[_0x39106e];return _0x892aec;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x559a48,_0x2a1625){var _0x5a0ddb=function(_0x214781){while(--_0x214781){_0x559a48['push'](_0x559a48['shift']());}};_0x5a0ddb(++_0x2a1625);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 303da42..5afcd4f 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 _0xa992=['sequelize','exports','INTEGER'];(function(_0x5b52f4,_0x4f9008){var _0x2a40a8=function(_0x3a9757){while(--_0x3a9757){_0x5b52f4['push'](_0x5b52f4['shift']());}};_0x2a40a8(++_0x4f9008);}(_0xa992,0x18c));var _0x2a99=function(_0x57c901,_0xb97294){_0x57c901=_0x57c901-0x0;var _0x47ce71=_0xa992[_0x57c901];return _0x47ce71;};'use strict';var Sequelize=require(_0x2a99('0x0'));module[_0x2a99('0x1')]={'penalty':{'type':Sequelize[_0x2a99('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa4d3=['INTEGER','sequelize'];(function(_0x2014d0,_0x42bb9d){var _0xa02e35=function(_0x1d8dec){while(--_0x1d8dec){_0x2014d0['push'](_0x2014d0['shift']());}};_0xa02e35(++_0x42bb9d);}(_0xa4d3,0x17f));var _0x3a4d=function(_0x19024a,_0x305674){_0x19024a=_0x19024a-0x0;var _0x153c36=_0xa4d3[_0x19024a];return _0x153c36;};'use strict';var Sequelize=require(_0x3a4d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3a4d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3324721..ed3cb84 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 _0xf78d=['../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x35f375,_0x5e0366){var _0xf65981=function(_0x83228b){while(--_0x83228b){_0x35f375['push'](_0x35f375['shift']());}};_0xf65981(++_0x5e0366);}(_0xf78d,0x1bd));var _0xdf78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf78d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdf78('0x0'));var util=require('util');var logger=require(_0xdf78('0x1'))(_0xdf78('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdf78('0x3'));var fs=require('fs');var path=require(_0xdf78('0x4'));var rimraf=require(_0xdf78('0x5'));var config=require(_0xdf78('0x6'));var attributes=require(_0xdf78('0x7'));module[_0xdf78('0x8')]=function(_0x45d8df,_0x3c2b45){return _0x45d8df['define'](_0xdf78('0x9'),attributes,{'tableName':_0xdf78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea3d=['exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','./userMailQueue.attributes'];(function(_0x2a72de,_0x56885c){var _0x3ec373=function(_0x3f9e84){while(--_0x3f9e84){_0x2a72de['push'](_0x2a72de['shift']());}};_0x3ec373(++_0x56885c);}(_0xea3d,0x118));var _0xdea3=function(_0x253877,_0x317b35){_0x253877=_0x253877-0x0;var _0x3e2a68=_0xea3d[_0x253877];return _0x3e2a68;};'use strict';var _=require('lodash');var util=require(_0xdea3('0x0'));var logger=require(_0xdea3('0x1'))(_0xdea3('0x2'));var moment=require(_0xdea3('0x3'));var BPromise=require(_0xdea3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdea3('0x5'));var rimraf=require(_0xdea3('0x6'));var config=require('../../config/environment');var attributes=require(_0xdea3('0x7'));module[_0xdea3('0x8')]=function(_0x3c7215,_0x42e021){return _0x3c7215[_0xdea3('0x9')](_0xdea3('0xa'),attributes,{'tableName':_0xdea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 733dd4a..da434a0 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x379420,_0xb7d27b){var _0x24c7aa=function(_0x3535e2){while(--_0x3535e2){_0x379420['push'](_0x379420['shift']());}};_0x24c7aa(++_0xb7d27b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1be362,_0x14405d){_0x1be362=_0x1be362-0x0;var _0x46c7d6=_0x8ef6[_0x1be362];return _0x46c7d6;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x008c,0x188));var _0xc008=function(_0x57ff3d,_0x551fbd){_0x57ff3d=_0x57ff3d-0x0;var _0xf4ab01=_0x008c[_0x57ff3d];return _0xf4ab01;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4a9f6af..209525a 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 _0xc82d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','connect-timeout','express','Router'];(function(_0x3d90e4,_0x34eb0f){var _0x42ede9=function(_0x12b006){while(--_0x12b006){_0x3d90e4['push'](_0x3d90e4['shift']());}};_0x42ede9(++_0x34eb0f);}(_0xc82d,0xf8));var _0xdc82=function(_0x64c6e3,_0x3b5371){_0x64c6e3=_0x64c6e3-0x0;var _0x69c52f=_0xc82d[_0x64c6e3];return _0x69c52f;};'use strict';var multer=require(_0xdc82('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdc82('0x1'));var express=require(_0xdc82('0x2'));var router=express[_0xdc82('0x3')]();var fs_extra=require(_0xdc82('0x4'));var auth=require(_0xdc82('0x5'));var interaction=require(_0xdc82('0x6'));var config=require(_0xdc82('0x7'));var controller=require(_0xdc82('0x8'));router[_0xdc82('0x9')]('/',auth['isAuthenticated'](),controller[_0xdc82('0xa')]);module[_0xdc82('0xb')]=router; \ No newline at end of file +var _0x2876=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x536450,_0x340961){var _0x206d44=function(_0x5901e4){while(--_0x5901e4){_0x536450['push'](_0x536450['shift']());}};_0x206d44(++_0x340961);}(_0x2876,0x19e));var _0x6287=function(_0x3954f0,_0x38ff5f){_0x3954f0=_0x3954f0-0x0;var _0x41fc13=_0x2876[_0x3954f0];return _0x41fc13;};'use strict';var multer=require(_0x6287('0x0'));var util=require(_0x6287('0x1'));var path=require(_0x6287('0x2'));var timeout=require(_0x6287('0x3'));var express=require(_0x6287('0x4'));var router=express[_0x6287('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6287('0x6'));var interaction=require(_0x6287('0x7'));var config=require(_0x6287('0x8'));var controller=require(_0x6287('0x9'));router[_0x6287('0xa')]('/',auth[_0x6287('0xb')](),controller[_0x6287('0xc')]);module[_0x6287('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 964be3b..ff5da56 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 _0x50df=['STRING','BOOLEAN','exports'];(function(_0xa718fd,_0x525b46){var _0x51f380=function(_0x2639a5){while(--_0x2639a5){_0xa718fd['push'](_0xa718fd['shift']());}};_0x51f380(++_0x525b46);}(_0x50df,0xc2));var _0xf50d=function(_0x59914d,_0x220392){_0x59914d=_0x59914d-0x0;var _0x33479a=_0x50df[_0x59914d];return _0x33479a;};'use strict';var Sequelize=require('sequelize');module[_0xf50d('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xf50d('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xf50d('0x2')]}}; \ No newline at end of file +var _0x3d87=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1f8a18,_0x239cfa){var _0x4d3b16=function(_0x18fd42){while(--_0x18fd42){_0x1f8a18['push'](_0x1f8a18['shift']());}};_0x4d3b16(++_0x239cfa);}(_0x3d87,0x67));var _0x73d8=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3d87[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0x73d8('0x0'));module[_0x73d8('0x1')]={'body':{'type':Sequelize[_0x73d8('0x2')]},'senderName':{'type':Sequelize[_0x73d8('0x3')]},'recipientsId':{'type':Sequelize[_0x73d8('0x2')]},'recipientsDescription':{'type':Sequelize[_0x73d8('0x3')]},'beep':{'type':Sequelize[_0x73d8('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e17f593..6fece98 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 _0xe0c3=['./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','UserNotification','create','forEach','recipient','userNotification:send','catch','findOne','html','render','startCase','toLowerCase','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0xfc229e,_0x4038d3){var _0x37bd7d=function(_0x5f2f28){while(--_0x5f2f28){_0xfc229e['push'](_0xfc229e['shift']());}};_0x37bd7d(++_0x4038d3);}(_0xe0c3,0x1ce));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e0c('0x0'));var jsonpatch=require(_0x3e0c('0x1'));var rp=require('request-promise');var moment=require(_0x3e0c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3e0c('0x3'));var util=require(_0x3e0c('0x4'));var path=require(_0x3e0c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e0c('0x6'));var fs=require('fs');var fs_extra=require(_0x3e0c('0x7'));var _=require(_0x3e0c('0x8'));var squel=require(_0x3e0c('0x9'));var crypto=require(_0x3e0c('0xa'));var jsforce=require(_0x3e0c('0xb'));var deskjs=require(_0x3e0c('0xc'));var toCsv=require(_0x3e0c('0xd'));var querystring=require(_0x3e0c('0xe'));var Papa=require(_0x3e0c('0xf'));var Redis=require('ioredis');var authService=require(_0x3e0c('0x10'));var qs=require(_0x3e0c('0x11'));var as=require(_0x3e0c('0x12'));var hardwareService=require(_0x3e0c('0x13'));var logger=require(_0x3e0c('0x14'))(_0x3e0c('0x15'));var utils=require(_0x3e0c('0x16'));var config=require(_0x3e0c('0x17'));var licenseUtil=require(_0x3e0c('0x18'));var db=require('../../mysqldb')['db'];config[_0x3e0c('0x19')]=_[_0x3e0c('0x1a')](config[_0x3e0c('0x19')],{'host':_0x3e0c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e0c('0x19')]));require(_0x3e0c('0x1c'))[_0x3e0c('0x1d')](socket);function respondWithStatusCode(_0x3a9dba,_0x3a9410){_0x3a9410=_0x3a9410||0xcc;return function(_0xee02d5){if(_0xee02d5){return _0x3a9dba[_0x3e0c('0x1e')](_0x3a9410);}return _0x3a9dba[_0x3e0c('0x1f')](_0x3a9410)[_0x3e0c('0x20')]();};}function respondWithResult(_0x19e57e,_0x1fd7b6){_0x1fd7b6=_0x1fd7b6||0xc8;return function(_0x5889ac){if(_0x5889ac){return _0x19e57e['status'](_0x1fd7b6)[_0x3e0c('0x21')](_0x5889ac);}};}function respondWithFilteredResult(_0x310ad3,_0x5d0c5d){return function(_0x293cf9){if(_0x293cf9){var _0x3a056e=typeof _0x5d0c5d[_0x3e0c('0x22')]===_0x3e0c('0x23')&&typeof _0x5d0c5d[_0x3e0c('0x24')]===_0x3e0c('0x23');var _0x576618=_0x293cf9[_0x3e0c('0x25')];var _0x211674=_0x3a056e?0x0:_0x5d0c5d['offset'];var _0x4516e7=_0x3a056e?_0x293cf9[_0x3e0c('0x25')]:_0x5d0c5d['offset']+_0x5d0c5d[_0x3e0c('0x24')];var _0x544e75;if(_0x4516e7>=_0x576618){_0x4516e7=_0x576618;_0x544e75=0xc8;}else{_0x544e75=0xce;}_0x310ad3[_0x3e0c('0x1f')](_0x544e75);return _0x310ad3[_0x3e0c('0x26')](_0x3e0c('0x27'),_0x211674+'-'+_0x4516e7+'/'+_0x576618)['json'](_0x293cf9);}return null;};}function patchUpdates(_0x27f3a6){return function(_0x37641c){try{jsonpatch[_0x3e0c('0x28')](_0x37641c,_0x27f3a6,!![]);}catch(_0x398733){return BPromise[_0x3e0c('0x29')](_0x398733);}return _0x37641c[_0x3e0c('0x2a')]();};}function saveUpdates(_0x5ed50f,_0x35273c){return function(_0x1ce3c2){if(_0x1ce3c2){return _0x1ce3c2[_0x3e0c('0x2b')](_0x5ed50f)[_0x3e0c('0x2c')](function(_0x2dae5b){return _0x2dae5b;});}return null;};}function removeEntity(_0x2f38a7,_0x187b45){return function(_0x2b923d){if(_0x2b923d){return _0x2b923d[_0x3e0c('0x2d')]()[_0x3e0c('0x2c')](function(){_0x2f38a7[_0x3e0c('0x1f')](0xcc)[_0x3e0c('0x20')]();});}};}function handleEntityNotFound(_0x127102,_0x44a38b){return function(_0x5bc9e0){if(!_0x5bc9e0){_0x127102[_0x3e0c('0x1e')](0x194);}return _0x5bc9e0;};}function handleError(_0xad6b9d,_0x197111){_0x197111=_0x197111||0x1f4;return function(_0x296ed2){logger[_0x3e0c('0x2e')](_0x296ed2[_0x3e0c('0x2f')]);if(_0x296ed2[_0x3e0c('0x30')]){delete _0x296ed2[_0x3e0c('0x30')];}_0xad6b9d[_0x3e0c('0x1f')](_0x197111)['send'](_0x296ed2);};}exports[_0x3e0c('0x31')]=function(_0x3e24de,_0x2407d9,_0x1de6db){if(!_0x3e24de['body']['hasOwnProperty'](_0x3e0c('0x32'))&&!_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x34')](_0x3e0c('0x35'))){throw new db[(_0x3e0c('0x36'))][(_0x3e0c('0x37'))](_0x3e0c('0x38'));}else{if(_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x34')]('TemplateId')&&!_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x34')](_0x3e0c('0x39'))){throw new db[(_0x3e0c('0x36'))][(_0x3e0c('0x37'))](_0x3e0c('0x3a'));}if(!_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x34')](_0x3e0c('0x3b'))){throw new db[(_0x3e0c('0x36'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2354e7=JSON['parse'](_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x3b')]);}catch(_0x507468){logger[_0x3e0c('0x2e')](_0x507468);throw new db[(_0x3e0c('0x36'))][(_0x3e0c('0x37'))](_0x3e0c('0x3c'));}var _0x1f27f3=['chatqueue','faxqueue',_0x3e0c('0x3d'),'openchannelqueue',_0x3e0c('0x3e'),_0x3e0c('0x3f'),_0x3e0c('0x40'),_0x3e0c('0x41'),_0x3e0c('0x42')];if(_['some'](_0x2354e7,function(_0x9745ca){return!_[_0x3e0c('0x43')](_0x1f27f3,_0x9745ca[_0x3e0c('0x44')]['toLowerCase']());})){throw new db['Sequelize'][(_0x3e0c('0x37'))](_0x3e0c('0x45'));}}}var _0x476e1c={};_0x476e1c[_0x3e0c('0x46')]=_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x34')](_0x3e0c('0x46'))?_0x3e24de[_0x3e0c('0x33')][_0x3e0c('0x46')]:_0x3e24de[_0x3e0c('0x42')]['fullname'];_0x476e1c[_0x3e0c('0x47')]=_[_0x3e0c('0x48')](_0x3e24de['body'][_0x3e0c('0x47')])?null:_0x3e24de[_0x3e0c('0x33')]['recipientsDescription'];_0x476e1c[_0x3e0c('0x49')]=_0x3e24de['body'][_0x3e0c('0x49')]||![];_0x476e1c['SenderId']=_0x3e24de[_0x3e0c('0x42')]['id'];return getContent(_0x3e24de[_0x3e0c('0x33')])[_0x3e0c('0x2c')](function(_0x556867){_0x476e1c[_0x3e0c('0x33')]=_0x556867;return getRecipients(_0x2354e7);})[_0x3e0c('0x2c')](function(_0xe9665c){_0x476e1c['recipientsId']=_[_0x3e0c('0x4a')](_0xe9665c)[_0x3e0c('0x4b')](',');return db[_0x3e0c('0x4c')]['transaction'](function(_0x35e495){return db[_0x3e0c('0x4d')][_0x3e0c('0x4e')](_0x476e1c,{'raw':!![],'transaction':_0x35e495})['then'](function(_0x93009){var _0x76ced0={'sender':_0x476e1c[_0x3e0c('0x46')],'description':_0x476e1c[_0x3e0c('0x47')],'content':_0x476e1c[_0x3e0c('0x33')],'beep':_0x476e1c['beep']};_0xe9665c[_0x3e0c('0x4f')](function(_0x5e5722){_0x76ced0[_0x3e0c('0x50')]=_0x5e5722;socket['emit'](_0x3e0c('0x51'),_0x76ced0);});return _0x93009;});});})[_0x3e0c('0x2c')](respondWithResult(_0x2407d9,0xc9))[_0x3e0c('0x52')](handleError(_0x2407d9,null));};function getContent(_0x28ec9c){return new BPromise(function(_0x428fdc,_0x4feacd){if(_0x28ec9c[_0x3e0c('0x32')]){_0x428fdc(_0x28ec9c[_0x3e0c('0x32')]);return;}return db['Template'][_0x3e0c('0x53')]({'attributes':[_0x3e0c('0x54')],'where':{'id':_0x28ec9c[_0x3e0c('0x35')]},'raw':!![]})['then'](function(_0x480432){if(!_0x480432)throw new db[(_0x3e0c('0x36'))][(_0x3e0c('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4b438f=Mustache[_0x3e0c('0x55')](_0x480432[_0x3e0c('0x54')],_0x28ec9c[_0x3e0c('0x39')]);_0x428fdc(_0x4b438f);})[_0x3e0c('0x52')](function(_0x4bdb5b){_0x4feacd(_0x4bdb5b);});});}function getRecipients(_0x1154ae){return new BPromise(function(_0x5d55fa,_0x1c4064){var _0x25b490=[];var _0x5b5327=[];_0x1154ae[_0x3e0c('0x4f')](function(_0x10945e){var _0x3326a9=_[_0x3e0c('0x56')](_0x10945e[_0x3e0c('0x44')][_0x3e0c('0x57')]());if(_0x3326a9==='User'){_0x25b490=_[_0x3e0c('0x58')](_0x25b490,_0x10945e[_0x3e0c('0x59')]);}else{if(_[_0x3e0c('0x43')](_0x3326a9,_0x3e0c('0x5a')))_0x3326a9=_0x3326a9[_0x3e0c('0x5b')](_0x3e0c('0x5a'),_0x3e0c('0x5c'));_0x10945e['ids'][_0x3e0c('0x4f')](function(_0x40274b){_0x5b5327[_0x3e0c('0x5d')](getAgents(_0x3326a9,_0x40274b));});}});return BPromise[_0x3e0c('0x5e')](_0x5b5327)['then'](function(_0x50aadc){_0x25b490=_[_0x3e0c('0x58')](_0x25b490,_[_0x3e0c('0x5f')](_0x50aadc));_0x5d55fa(_0x25b490);})[_0x3e0c('0x52')](function(_0x302dbf){_0x1c4064(_0x302dbf);});});}function getAgents(_0x40a331,_0x57ffc5){return new BPromise(function(_0x1117a2,_0x4d7769){return db[_0x40a331][_0x3e0c('0x53')]({'where':{'id':_0x57ffc5}})['then'](function(_0x138f01){return _0x138f01[_0x3e0c('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4bb420){var _0x433834=_[_0x3e0c('0x61')](_0x4bb420,'id');_0x1117a2(_0x433834);});})[_0x3e0c('0x52')](function(_0x3003b7){_0x4d7769(_0x3003b7);});});} \ No newline at end of file +var _0x5f70=['Content-Range','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','Sequelize','ValidationError','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','model','union','ids','queue','replace','Queue','all','flatten','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x5c59a4,_0x476303){var _0x1cfdf2=function(_0x2f521d){while(--_0x2f521d){_0x5c59a4['push'](_0x5c59a4['shift']());}};_0x1cfdf2(++_0x476303);}(_0x5f70,0x111));var _0x05f7=function(_0x9e2c55,_0x4d94c8){_0x9e2c55=_0x9e2c55-0x0;var _0x5c62b6=_0x5f70[_0x9e2c55];return _0x5c62b6;};'use strict';var emlformat=require(_0x05f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x05f7('0x1'));var jsonpatch=require(_0x05f7('0x2'));var rp=require('request-promise');var moment=require(_0x05f7('0x3'));var BPromise=require(_0x05f7('0x4'));var Mustache=require(_0x05f7('0x5'));var util=require(_0x05f7('0x6'));var path=require(_0x05f7('0x7'));var sox=require(_0x05f7('0x8'));var csv=require('to-csv');var ejs=require(_0x05f7('0x9'));var fs=require('fs');var fs_extra=require(_0x05f7('0xa'));var _=require(_0x05f7('0xb'));var squel=require(_0x05f7('0xc'));var crypto=require(_0x05f7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x05f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05f7('0xf'));var Papa=require(_0x05f7('0x10'));var Redis=require(_0x05f7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05f7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05f7('0x13'))('api');var utils=require(_0x05f7('0x14'));var config=require(_0x05f7('0x15'));var licenseUtil=require(_0x05f7('0x16'));var db=require(_0x05f7('0x17'))['db'];config['redis']=_[_0x05f7('0x18')](config[_0x05f7('0x19')],{'host':_0x05f7('0x1a'),'port':0x18eb});var socket=require(_0x05f7('0x1b'))(new Redis(config[_0x05f7('0x19')]));require(_0x05f7('0x1c'))[_0x05f7('0x1d')](socket);function respondWithStatusCode(_0x8e9bf5,_0x1d63a1){_0x1d63a1=_0x1d63a1||0xcc;return function(_0x15acde){if(_0x15acde){return _0x8e9bf5[_0x05f7('0x1e')](_0x1d63a1);}return _0x8e9bf5[_0x05f7('0x1f')](_0x1d63a1)[_0x05f7('0x20')]();};}function respondWithResult(_0x102272,_0xceea88){_0xceea88=_0xceea88||0xc8;return function(_0xfd1455){if(_0xfd1455){return _0x102272[_0x05f7('0x1f')](_0xceea88)[_0x05f7('0x21')](_0xfd1455);}};}function respondWithFilteredResult(_0x11a9f6,_0xdcd7c6){return function(_0x50c847){if(_0x50c847){var _0x3d9bb0=typeof _0xdcd7c6['offset']===_0x05f7('0x22')&&typeof _0xdcd7c6['limit']===_0x05f7('0x22');var _0x2c48fd=_0x50c847[_0x05f7('0x23')];var _0x3d5caa=_0x3d9bb0?0x0:_0xdcd7c6[_0x05f7('0x24')];var _0x299e06=_0x3d9bb0?_0x50c847[_0x05f7('0x23')]:_0xdcd7c6[_0x05f7('0x24')]+_0xdcd7c6[_0x05f7('0x25')];var _0x19664b;if(_0x299e06>=_0x2c48fd){_0x299e06=_0x2c48fd;_0x19664b=0xc8;}else{_0x19664b=0xce;}_0x11a9f6['status'](_0x19664b);return _0x11a9f6[_0x05f7('0x26')](_0x05f7('0x27'),_0x3d5caa+'-'+_0x299e06+'/'+_0x2c48fd)['json'](_0x50c847);}return null;};}function patchUpdates(_0x428c92){return function(_0x519676){try{jsonpatch['apply'](_0x519676,_0x428c92,!![]);}catch(_0xed935f){return BPromise['reject'](_0xed935f);}return _0x519676[_0x05f7('0x28')]();};}function saveUpdates(_0xdf3987,_0x227373){return function(_0xf8f7b5){if(_0xf8f7b5){return _0xf8f7b5[_0x05f7('0x29')](_0xdf3987)[_0x05f7('0x2a')](function(_0x41ba7b){return _0x41ba7b;});}return null;};}function removeEntity(_0x19865d,_0x37dd55){return function(_0x44ce4a){if(_0x44ce4a){return _0x44ce4a[_0x05f7('0x2b')]()[_0x05f7('0x2a')](function(){_0x19865d[_0x05f7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b93,_0x27d23f){return function(_0x185243){if(!_0x185243){_0x208b93[_0x05f7('0x1e')](0x194);}return _0x185243;};}function handleError(_0x2dc8f0,_0x4c63bb){_0x4c63bb=_0x4c63bb||0x1f4;return function(_0x2c369d){logger[_0x05f7('0x2c')](_0x2c369d[_0x05f7('0x2d')]);if(_0x2c369d[_0x05f7('0x2e')]){delete _0x2c369d['name'];}_0x2dc8f0[_0x05f7('0x1f')](_0x4c63bb)[_0x05f7('0x2f')](_0x2c369d);};}exports[_0x05f7('0x30')]=function(_0x52440a,_0x1562c7,_0x135edc){if(!_0x52440a[_0x05f7('0x31')]['hasOwnProperty'](_0x05f7('0x32'))&&!_0x52440a[_0x05f7('0x31')][_0x05f7('0x33')]('TemplateId')){throw new db[(_0x05f7('0x34'))][(_0x05f7('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x52440a[_0x05f7('0x31')][_0x05f7('0x33')](_0x05f7('0x36'))&&!_0x52440a[_0x05f7('0x31')][_0x05f7('0x33')](_0x05f7('0x37'))){throw new db[(_0x05f7('0x34'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x52440a[_0x05f7('0x31')][_0x05f7('0x33')](_0x05f7('0x38'))){throw new db[(_0x05f7('0x34'))][(_0x05f7('0x35'))](_0x05f7('0x39'));}else{try{var _0x5b9e62=JSON[_0x05f7('0x3a')](_0x52440a[_0x05f7('0x31')][_0x05f7('0x38')]);}catch(_0x319459){logger[_0x05f7('0x2c')](_0x319459);throw new db[(_0x05f7('0x34'))][(_0x05f7('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5048cb=[_0x05f7('0x3b'),_0x05f7('0x3c'),_0x05f7('0x3d'),_0x05f7('0x3e'),_0x05f7('0x3f'),_0x05f7('0x40'),_0x05f7('0x41'),_0x05f7('0x42'),'user'];if(_[_0x05f7('0x43')](_0x5b9e62,function(_0x4ab0eb){return!_[_0x05f7('0x44')](_0x5048cb,_0x4ab0eb['model'][_0x05f7('0x45')]());})){throw new db['Sequelize'][(_0x05f7('0x35'))](_0x05f7('0x46'));}}}var _0x5e5514={};_0x5e5514[_0x05f7('0x47')]=_0x52440a[_0x05f7('0x31')][_0x05f7('0x33')](_0x05f7('0x47'))?_0x52440a[_0x05f7('0x31')][_0x05f7('0x47')]:_0x52440a[_0x05f7('0x48')][_0x05f7('0x49')];_0x5e5514[_0x05f7('0x4a')]=_[_0x05f7('0x4b')](_0x52440a[_0x05f7('0x31')]['recipientsDescription'])?null:_0x52440a[_0x05f7('0x31')]['recipientsDescription'];_0x5e5514[_0x05f7('0x4c')]=_0x52440a['body']['beep']||![];_0x5e5514[_0x05f7('0x4d')]=_0x52440a[_0x05f7('0x48')]['id'];return getContent(_0x52440a[_0x05f7('0x31')])['then'](function(_0x328e36){_0x5e5514[_0x05f7('0x31')]=_0x328e36;return getRecipients(_0x5b9e62);})[_0x05f7('0x2a')](function(_0x13a168){_0x5e5514[_0x05f7('0x4e')]=_[_0x05f7('0x4f')](_0x13a168)[_0x05f7('0x50')](',');return db[_0x05f7('0x51')][_0x05f7('0x52')](function(_0x276da4){return db[_0x05f7('0x53')][_0x05f7('0x54')](_0x5e5514,{'raw':!![],'transaction':_0x276da4})[_0x05f7('0x2a')](function(_0xfa58ab){var _0x291cb8={'sender':_0x5e5514['senderName'],'description':_0x5e5514['recipientsDescription'],'content':_0x5e5514['body'],'beep':_0x5e5514[_0x05f7('0x4c')]};_0x13a168[_0x05f7('0x55')](function(_0x4b7315){_0x291cb8[_0x05f7('0x56')]=_0x4b7315;socket[_0x05f7('0x57')](_0x05f7('0x58'),_0x291cb8);});return _0xfa58ab;});});})[_0x05f7('0x2a')](respondWithResult(_0x1562c7,0xc9))[_0x05f7('0x59')](handleError(_0x1562c7,null));};function getContent(_0x3bb7ab){return new BPromise(function(_0x2c9e01,_0x1c7377){if(_0x3bb7ab['text']){_0x2c9e01(_0x3bb7ab[_0x05f7('0x32')]);return;}return db[_0x05f7('0x5a')][_0x05f7('0x5b')]({'attributes':[_0x05f7('0x5c')],'where':{'id':_0x3bb7ab['TemplateId']},'raw':!![]})[_0x05f7('0x2a')](function(_0x4c973f){if(!_0x4c973f)throw new db[(_0x05f7('0x34'))][(_0x05f7('0x35'))](_0x05f7('0x5d'));var _0x4ad8d9=Mustache[_0x05f7('0x5e')](_0x4c973f[_0x05f7('0x5c')],_0x3bb7ab[_0x05f7('0x37')]);_0x2c9e01(_0x4ad8d9);})['catch'](function(_0x3fed2f){_0x1c7377(_0x3fed2f);});});}function getRecipients(_0x18a27c){return new BPromise(function(_0x395242,_0x184887){var _0x14d667=[];var _0x1dbe76=[];_0x18a27c['forEach'](function(_0xacf4e5){var _0x296e9f=_['startCase'](_0xacf4e5[_0x05f7('0x5f')][_0x05f7('0x45')]());if(_0x296e9f==='User'){_0x14d667=_[_0x05f7('0x60')](_0x14d667,_0xacf4e5[_0x05f7('0x61')]);}else{if(_[_0x05f7('0x44')](_0x296e9f,_0x05f7('0x62')))_0x296e9f=_0x296e9f[_0x05f7('0x63')](_0x05f7('0x62'),_0x05f7('0x64'));_0xacf4e5[_0x05f7('0x61')][_0x05f7('0x55')](function(_0x10334d){_0x1dbe76['push'](getAgents(_0x296e9f,_0x10334d));});}});return BPromise[_0x05f7('0x65')](_0x1dbe76)[_0x05f7('0x2a')](function(_0xf96b46){_0x14d667=_[_0x05f7('0x60')](_0x14d667,_[_0x05f7('0x66')](_0xf96b46));_0x395242(_0x14d667);})[_0x05f7('0x59')](function(_0x450cec){_0x184887(_0x450cec);});});}function getAgents(_0x2120cd,_0x4711b2){return new BPromise(function(_0x7ed84e,_0x3f56ba){return db[_0x2120cd][_0x05f7('0x5b')]({'where':{'id':_0x4711b2}})[_0x05f7('0x2a')](function(_0x342821){return _0x342821['getAgents']({'attributes':['id'],'raw':!![]})[_0x05f7('0x2a')](function(_0x38d725){var _0x2bd113=_[_0x05f7('0x67')](_0x38d725,'id');_0x7ed84e(_0x2bd113);});})[_0x05f7('0x59')](function(_0xd055c){_0x3f56ba(_0xd055c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ab06b24..f1d60a5 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 _0xc05e=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x3e1a2d,_0x3144f7){var _0x1e51e8=function(_0x1d3b9c){while(--_0x1d3b9c){_0x3e1a2d['push'](_0x3e1a2d['shift']());}};_0x1e51e8(++_0x3144f7);}(_0xc05e,0x92));var _0xec05=function(_0x17ed79,_0x21c1b5){_0x17ed79=_0x17ed79-0x0;var _0x32b643=_0xc05e[_0x17ed79];return _0x32b643;};'use strict';var EventEmitter=require(_0xec05('0x0'));var UserNotification=require(_0xec05('0x1'))['db'][_0xec05('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xec05('0x3')](0x0);var events={'afterCreate':_0xec05('0x4'),'afterUpdate':_0xec05('0x5'),'afterDestroy':_0xec05('0x6')};function emitEvent(_0x362907){return function(_0xbc46bf,_0xd7f10,_0x1baf20){UserNotificationEvents[_0xec05('0x7')](_0x362907+':'+_0xbc46bf['id'],_0xbc46bf);UserNotificationEvents[_0xec05('0x7')](_0x362907,_0xbc46bf);_0x1baf20(null);};}for(var e in events){if(events[_0xec05('0x8')](e)){var event=events[e];UserNotification[_0xec05('0x9')](e,emitEvent(event));}}module[_0xec05('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x3eec=['../../mysqldb','UserNotification','setMaxListeners','save','remove','hasOwnProperty','exports','events'];(function(_0x2e4f3e,_0xff140c){var _0x1a2f6d=function(_0x4eeabb){while(--_0x4eeabb){_0x2e4f3e['push'](_0x2e4f3e['shift']());}};_0x1a2f6d(++_0xff140c);}(_0x3eec,0x8f));var _0xc3ee=function(_0xf176d9,_0x5dc9be){_0xf176d9=_0xf176d9-0x0;var _0x537ad2=_0x3eec[_0xf176d9];return _0x537ad2;};'use strict';var EventEmitter=require(_0xc3ee('0x0'));var UserNotification=require(_0xc3ee('0x1'))['db'][_0xc3ee('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc3ee('0x3')](0x0);var events={'afterCreate':_0xc3ee('0x4'),'afterUpdate':'update','afterDestroy':_0xc3ee('0x5')};function emitEvent(_0x36dd6c){return function(_0x3845b6,_0x4739d0,_0x5cea5a){UserNotificationEvents['emit'](_0x36dd6c+':'+_0x3845b6['id'],_0x3845b6);UserNotificationEvents['emit'](_0x36dd6c,_0x3845b6);_0x5cea5a(null);};}for(var e in events){if(events[_0xc3ee('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xc3ee('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index aff88f9..428a1b2 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 _0xd720=['rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x5cbf5e,_0x2824dd){var _0x99dbb9=function(_0x596ada){while(--_0x596ada){_0x5cbf5e['push'](_0x5cbf5e['shift']());}};_0x99dbb9(++_0x2824dd);}(_0xd720,0xba));var _0x0d72=function(_0x458b8e,_0x1d6ab1){_0x458b8e=_0x458b8e-0x0;var _0x9c30b1=_0xd720[_0x458b8e];return _0x9c30b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d72('0x0'))('api');var moment=require(_0x0d72('0x1'));var BPromise=require(_0x0d72('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d72('0x3'));var config=require(_0x0d72('0x4'));var attributes=require(_0x0d72('0x5'));module[_0x0d72('0x6')]=function(_0x17eb3c,_0x5a1858){return _0x17eb3c['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d72('0x7'),'collate':_0x0d72('0x8')});}; \ No newline at end of file +var _0x19f6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x444a26,_0x1bf7a8){var _0x514cd0=function(_0x3fe697){while(--_0x3fe697){_0x444a26['push'](_0x444a26['shift']());}};_0x514cd0(++_0x1bf7a8);}(_0x19f6,0x1ce));var _0x619f=function(_0x2a6596,_0x8eb727){_0x2a6596=_0x2a6596-0x0;var _0x5778bb=_0x19f6[_0x2a6596];return _0x5778bb;};'use strict';var _=require(_0x619f('0x0'));var util=require(_0x619f('0x1'));var logger=require(_0x619f('0x2'))(_0x619f('0x3'));var moment=require(_0x619f('0x4'));var BPromise=require(_0x619f('0x5'));var rp=require(_0x619f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x619f('0x7'));var config=require(_0x619f('0x8'));var attributes=require('./userNotification.attributes');module[_0x619f('0x9')]=function(_0x59b1a6,_0x38b131){return _0x59b1a6[_0x619f('0xa')](_0x619f('0xb'),attributes,{'tableName':_0x619f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x619f('0xd'),'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 95458c5..3132108 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 _0xa071=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x1bbcc7,_0x3cf884){var _0x75c802=function(_0x13dc69){while(--_0x13dc69){_0x1bbcc7['push'](_0x1bbcc7['shift']());}};_0x75c802(++_0x3cf884);}(_0xa071,0xa4));var _0x1a07=function(_0x227bfa,_0x51bedc){_0x227bfa=_0x227bfa-0x0;var _0x331aba=_0xa071[_0x227bfa];return _0x331aba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a07('0x0'));var BPromise=require(_0x1a07('0x1'));var rs=require(_0x1a07('0x2'));var fs=require('fs');var Redis=require(_0x1a07('0x3'));var db=require(_0x1a07('0x4'))['db'];var utils=require(_0x1a07('0x5'));var logger=require(_0x1a07('0x6'))(_0x1a07('0x7'));var config=require(_0x1a07('0x8'));var jayson=require(_0x1a07('0x9'));var client=jayson[_0x1a07('0xa')][_0x1a07('0xb')]({'port':0x232a});config[_0x1a07('0xc')]=_[_0x1a07('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a07('0xe'))(new Redis(config[_0x1a07('0xc')]));require(_0x1a07('0xf'))[_0x1a07('0x10')](socket);function respondWithRpcPromise(_0x1ea1bd,_0x47ea9d,_0x358e9b){return new BPromise(function(_0x5b0f96,_0x2e4bfa){return client[_0x1a07('0x11')](_0x1ea1bd,_0x358e9b)[_0x1a07('0x12')](function(_0x3d6eec){logger[_0x1a07('0x13')](_0x1a07('0x14'),_0x47ea9d,_0x1a07('0x15'));logger['debug'](_0x1a07('0x16'),_0x47ea9d,_0x1a07('0x15'),JSON[_0x1a07('0x17')](_0x3d6eec));if(_0x3d6eec[_0x1a07('0x18')]){if(_0x3d6eec[_0x1a07('0x18')][_0x1a07('0x19')]===0x1f4){logger['error'](_0x1a07('0x14'),_0x47ea9d,_0x3d6eec['error']['message']);return _0x2e4bfa(_0x3d6eec[_0x1a07('0x18')][_0x1a07('0x1a')]);}logger[_0x1a07('0x18')](_0x1a07('0x14'),_0x47ea9d,_0x3d6eec[_0x1a07('0x18')][_0x1a07('0x1a')]);return _0x5b0f96(_0x3d6eec[_0x1a07('0x18')][_0x1a07('0x1a')]);}else{logger[_0x1a07('0x13')](_0x1a07('0x14'),_0x47ea9d,_0x1a07('0x15'));_0x5b0f96(_0x3d6eec[_0x1a07('0x1b')][_0x1a07('0x1a')]);}})['catch'](function(_0x3f6388){logger[_0x1a07('0x18')]('UserNotification,\x20%s,\x20%s',_0x47ea9d,_0x3f6388);_0x2e4bfa(_0x3f6388);});});} \ No newline at end of file +var _0x9211=['request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x33aceb,_0x426921){var _0x571c82=function(_0x5bd17){while(--_0x5bd17){_0x33aceb['push'](_0x33aceb['shift']());}};_0x571c82(++_0x426921);}(_0x9211,0xbb));var _0x1921=function(_0x97db75,_0x3abdb8){_0x97db75=_0x97db75-0x0;var _0x259a53=_0x9211[_0x97db75];return _0x259a53;};'use strict';var _=require(_0x1921('0x0'));var util=require(_0x1921('0x1'));var moment=require(_0x1921('0x2'));var BPromise=require(_0x1921('0x3'));var rs=require(_0x1921('0x4'));var fs=require('fs');var Redis=require(_0x1921('0x5'));var db=require(_0x1921('0x6'))['db'];var utils=require(_0x1921('0x7'));var logger=require('../../config/logger')(_0x1921('0x8'));var config=require(_0x1921('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1921('0xa')][_0x1921('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1921('0xc')],{'host':_0x1921('0xd'),'port':0x18eb});var socket=require(_0x1921('0xe'))(new Redis(config[_0x1921('0xc')]));require('./userNotification.socket')[_0x1921('0xf')](socket);function respondWithRpcPromise(_0x1f8c9d,_0x3e4700,_0x5ca10f){return new BPromise(function(_0x340a54,_0x130e34){return client[_0x1921('0x10')](_0x1f8c9d,_0x5ca10f)[_0x1921('0x11')](function(_0x11e673){logger[_0x1921('0x12')]('UserNotification,\x20%s,\x20%s',_0x3e4700,_0x1921('0x13'));logger[_0x1921('0x14')](_0x1921('0x15'),_0x3e4700,_0x1921('0x13'),JSON[_0x1921('0x16')](_0x11e673));if(_0x11e673[_0x1921('0x17')]){if(_0x11e673[_0x1921('0x17')][_0x1921('0x18')]===0x1f4){logger[_0x1921('0x17')](_0x1921('0x19'),_0x3e4700,_0x11e673[_0x1921('0x17')][_0x1921('0x1a')]);return _0x130e34(_0x11e673['error']['message']);}logger[_0x1921('0x17')](_0x1921('0x19'),_0x3e4700,_0x11e673[_0x1921('0x17')][_0x1921('0x1a')]);return _0x340a54(_0x11e673[_0x1921('0x17')][_0x1921('0x1a')]);}else{logger['info'](_0x1921('0x19'),_0x3e4700,'request\x20sent');_0x340a54(_0x11e673[_0x1921('0x1b')]['message']);}})[_0x1921('0x1c')](function(_0x3f89b3){logger[_0x1921('0x17')]('UserNotification,\x20%s,\x20%s',_0x3e4700,_0x3f89b3);_0x130e34(_0x3f89b3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 48f4de9..79f18b8 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 _0x920a=['removeListener','register','length','userNotification:','./userNotification.events','save','remove','emit'];(function(_0x38e072,_0x55b82e){var _0x3f1fb2=function(_0x16d290){while(--_0x16d290){_0x38e072['push'](_0x38e072['shift']());}};_0x3f1fb2(++_0x55b82e);}(_0x920a,0xd4));var _0xa920=function(_0x2684fa,_0x22bfa5){_0x2684fa=_0x2684fa-0x0;var _0xad9438=_0x920a[_0x2684fa];return _0xad9438;};'use strict';var UserNotificationEvents=require(_0xa920('0x0'));var events=[_0xa920('0x1'),_0xa920('0x2'),'update'];function createListener(_0x1e4614,_0x2a645b){return function(_0x3152f2){_0x2a645b[_0xa920('0x3')](_0x1e4614,_0x3152f2);};}function removeListener(_0x11eb58,_0x270cc4){return function(){UserNotificationEvents[_0xa920('0x4')](_0x11eb58,_0x270cc4);};}exports[_0xa920('0x5')]=function(_0x236f42){for(var _0x342568=0x0,_0x3458a5=events[_0xa920('0x6')];_0x342568<_0x3458a5;_0x342568++){var _0x862b44=events[_0x342568];var _0x1a1633=createListener(_0xa920('0x7')+_0x862b44,_0x236f42);UserNotificationEvents['on'](_0x862b44,_0x1a1633);}}; \ No newline at end of file +var _0x169d=['emit','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x1d5311,_0x467140){var _0x382f7e=function(_0x1eb01c){while(--_0x1eb01c){_0x1d5311['push'](_0x1d5311['shift']());}};_0x382f7e(++_0x467140);}(_0x169d,0x18c));var _0xd169=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x169d[_0x321bb2];return _0x9c12ed;};'use strict';var UserNotificationEvents=require(_0xd169('0x0'));var events=[_0xd169('0x1'),_0xd169('0x2'),'update'];function createListener(_0x31ae84,_0x2eb076){return function(_0x4253b4){_0x2eb076[_0xd169('0x3')](_0x31ae84,_0x4253b4);};}function removeListener(_0x4f997f,_0x356b85){return function(){UserNotificationEvents['removeListener'](_0x4f997f,_0x356b85);};}exports[_0xd169('0x4')]=function(_0x43e3ab){for(var _0x5d1d23=0x0,_0x33e8e0=events[_0xd169('0x5')];_0x5d1d23<_0x33e8e0;_0x5d1d23++){var _0xf5c0bc=events[_0x5d1d23];var _0x222d5f=createListener(_0xd169('0x6')+_0xf5c0bc,_0x43e3ab);UserNotificationEvents['on'](_0xf5c0bc,_0x222d5f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4afc7bb..f46a0e6 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd85a0d,_0x316fc3){var _0x40b4b5=function(_0x187968){while(--_0x187968){_0xd85a0d['push'](_0xd85a0d['shift']());}};_0x40b4b5(++_0x316fc3);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x49ebfa,_0x3c2d71){var _0x62df6=function(_0x15b64d){while(--_0x15b64d){_0x49ebfa['push'](_0x49ebfa['shift']());}};_0x62df6(++_0x3c2d71);}(_0x70e0,0x17b));var _0x070e=function(_0x2cff69,_0x39a6bb){_0x2cff69=_0x2cff69-0x0;var _0x34e0c3=_0x70e0[_0x2cff69];return _0x34e0c3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a3a8c3f..c37a27a 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 _0x41f2=['exports','sequelize'];(function(_0x3cd1b5,_0x297b16){var _0x6ff233=function(_0x5cb29b){while(--_0x5cb29b){_0x3cd1b5['push'](_0x3cd1b5['shift']());}};_0x6ff233(++_0x297b16);}(_0x41f2,0x14f));var _0x241f=function(_0x23684c,_0x66a2ca){_0x23684c=_0x23684c-0x0;var _0x3b15e1=_0x41f2[_0x23684c];return _0x3b15e1;};'use strict';var Sequelize=require(_0x241f('0x0'));module[_0x241f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x257b=['INTEGER'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x257b,0xf8));var _0xb257=function(_0x5400a2,_0x16e245){_0x5400a2=_0x5400a2-0x0;var _0x21b5e2=_0x257b[_0x5400a2];return _0x21b5e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xb257('0x0')],'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 3df46b4..7bde7a3 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 _0xe275=['api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x2c17d7,_0x5e68a0){var _0x4b7e09=function(_0x59d117){while(--_0x59d117){_0x2c17d7['push'](_0x2c17d7['shift']());}};_0x4b7e09(++_0x5e68a0);}(_0xe275,0xb1));var _0x5e27=function(_0x233163,_0x5b6b15){_0x233163=_0x233163-0x0;var _0x1139fe=_0xe275[_0x233163];return _0x1139fe;};'use strict';var _=require(_0x5e27('0x0'));var util=require(_0x5e27('0x1'));var logger=require(_0x5e27('0x2'))(_0x5e27('0x3'));var moment=require(_0x5e27('0x4'));var BPromise=require(_0x5e27('0x5'));var rp=require(_0x5e27('0x6'));var fs=require('fs');var path=require(_0x5e27('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5e27('0x8'));module[_0x5e27('0x9')]=function(_0x4d6860,_0x21c383){return _0x4d6860[_0x5e27('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x5e27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf08=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5d9207,_0x57d3ff){var _0x16d4df=function(_0x4dfa6e){while(--_0x4dfa6e){_0x5d9207['push'](_0x5d9207['shift']());}};_0x16d4df(++_0x57d3ff);}(_0xbf08,0x1a5));var _0x8bf0=function(_0x1b20ce,_0x40a3db){_0x1b20ce=_0x1b20ce-0x0;var _0x94dcbb=_0xbf08[_0x1b20ce];return _0x94dcbb;};'use strict';var _=require(_0x8bf0('0x0'));var util=require(_0x8bf0('0x1'));var logger=require(_0x8bf0('0x2'))(_0x8bf0('0x3'));var moment=require('moment');var BPromise=require(_0x8bf0('0x4'));var rp=require(_0x8bf0('0x5'));var fs=require('fs');var path=require(_0x8bf0('0x6'));var rimraf=require(_0x8bf0('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bf0('0x8'));module[_0x8bf0('0x9')]=function(_0x47e000,_0x2a60c4){return _0x47e000[_0x8bf0('0xa')](_0x8bf0('0xb'),attributes,{'tableName':_0x8bf0('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 6132dc9..e69dce1 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 _0x7961=['lodash','util','moment','../../config/logger','rpc','../../config/environment','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x5e7bf7,_0x44c6a8){var _0x56aea8=function(_0x55f825){while(--_0x55f825){_0x5e7bf7['push'](_0x5e7bf7['shift']());}};_0x56aea8(++_0x44c6a8);}(_0x7961,0xd2));var _0x1796=function(_0x40e85d,_0x6b29a9){_0x40e85d=_0x40e85d-0x0;var _0x47d858=_0x7961[_0x40e85d];return _0x47d858;};'use strict';var _=require(_0x1796('0x0'));var util=require(_0x1796('0x1'));var moment=require(_0x1796('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('../../config/utils');var logger=require(_0x1796('0x3'))(_0x1796('0x4'));var config=require(_0x1796('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1796('0x6')][_0x1796('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23dd02,_0x39e560,_0x19a903){return new BPromise(function(_0x32ed5e,_0x1696bc){return client[_0x1796('0x8')](_0x23dd02,_0x19a903)[_0x1796('0x9')](function(_0x130b52){logger['info'](_0x1796('0xa'),_0x39e560,_0x1796('0xb'));logger[_0x1796('0xc')](_0x1796('0xd'),_0x39e560,'request\x20sent',JSON[_0x1796('0xe')](_0x130b52));if(_0x130b52[_0x1796('0xf')]){if(_0x130b52['error'][_0x1796('0x10')]===0x1f4){logger[_0x1796('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x39e560,_0x130b52[_0x1796('0xf')][_0x1796('0x11')]);return _0x1696bc(_0x130b52[_0x1796('0xf')][_0x1796('0x11')]);}logger['error'](_0x1796('0xa'),_0x39e560,_0x130b52[_0x1796('0xf')][_0x1796('0x11')]);return _0x32ed5e(_0x130b52[_0x1796('0xf')][_0x1796('0x11')]);}else{logger[_0x1796('0x12')](_0x1796('0xa'),_0x39e560,'request\x20sent');_0x32ed5e(_0x130b52[_0x1796('0x13')][_0x1796('0x11')]);}})[_0x1796('0x14')](function(_0x5398e8){logger[_0x1796('0xf')](_0x1796('0xa'),_0x39e560,_0x5398e8);_0x1696bc(_0x5398e8);});});} \ No newline at end of file +var _0x396e=['stringify','error','message','UserOpenchannelQueue,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','debug'];(function(_0x163fd4,_0x116cb8){var _0x495056=function(_0x52dfb3){while(--_0x52dfb3){_0x163fd4['push'](_0x163fd4['shift']());}};_0x495056(++_0x116cb8);}(_0x396e,0xef));var _0xe396=function(_0x236a31,_0x49ebc2){_0x236a31=_0x236a31-0x0;var _0x369628=_0x396e[_0x236a31];return _0x369628;};'use strict';var _=require(_0xe396('0x0'));var util=require(_0xe396('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe396('0x2'));var fs=require('fs');var Redis=require(_0xe396('0x3'));var db=require(_0xe396('0x4'))['db'];var utils=require(_0xe396('0x5'));var logger=require(_0xe396('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe396('0x7')][_0xe396('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdd665f,_0x28e12d,_0x4a22ef){return new BPromise(function(_0x17c08a,_0x36cef4){return client[_0xe396('0x9')](_0xdd665f,_0x4a22ef)['then'](function(_0x46484c){logger[_0xe396('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28e12d,_0xe396('0xb'));logger[_0xe396('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x28e12d,_0xe396('0xb'),JSON[_0xe396('0xd')](_0x46484c));if(_0x46484c['error']){if(_0x46484c[_0xe396('0xe')]['code']===0x1f4){logger[_0xe396('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28e12d,_0x46484c['error'][_0xe396('0xf')]);return _0x36cef4(_0x46484c[_0xe396('0xe')]['message']);}logger[_0xe396('0xe')](_0xe396('0x10'),_0x28e12d,_0x46484c[_0xe396('0xe')][_0xe396('0xf')]);return _0x17c08a(_0x46484c[_0xe396('0xe')][_0xe396('0xf')]);}else{logger[_0xe396('0xa')](_0xe396('0x10'),_0x28e12d,_0xe396('0xb'));_0x17c08a(_0x46484c[_0xe396('0x11')]['message']);}})['catch'](function(_0x521162){logger[_0xe396('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28e12d,_0x521162);_0x36cef4(_0x521162);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 749ec0b..08055e9 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 _0x3a11=['isAuthenticated','describe','/:id','/:id/sections','getSections','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe'];(function(_0x365251,_0x30efc7){var _0x4c9e29=function(_0x61cc4f){while(--_0x61cc4f){_0x365251['push'](_0x365251['shift']());}};_0x4c9e29(++_0x30efc7);}(_0x3a11,0xfb));var _0x13a1=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x3a11[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0x13a1('0x0'));var util=require('util');var path=require(_0x13a1('0x1'));var timeout=require(_0x13a1('0x2'));var express=require(_0x13a1('0x3'));var router=express[_0x13a1('0x4')]();var fs_extra=require(_0x13a1('0x5'));var auth=require(_0x13a1('0x6'));var interaction=require(_0x13a1('0x7'));var config=require(_0x13a1('0x8'));var controller=require(_0x13a1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x13a1('0xa')]);router[_0x13a1('0xb')](_0x13a1('0xc'),auth[_0x13a1('0xd')](),controller[_0x13a1('0xe')]);router[_0x13a1('0xb')](_0x13a1('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x13a1('0x10'),auth[_0x13a1('0xd')](),controller[_0x13a1('0x11')]);router[_0x13a1('0xb')]('/:id/resources',auth['isAuthenticated'](),controller[_0x13a1('0x12')]);router['post']('/',auth[_0x13a1('0xd')](),controller[_0x13a1('0x13')]);router[_0x13a1('0x14')](_0x13a1('0x15'),auth[_0x13a1('0xd')](),controller[_0x13a1('0x16')]);router[_0x13a1('0x14')](_0x13a1('0x10'),auth[_0x13a1('0xd')](),controller[_0x13a1('0x17')]);router[_0x13a1('0x14')]('/:id/resources',auth['isAuthenticated'](),controller[_0x13a1('0x18')]);router[_0x13a1('0x19')]('/:id',auth[_0x13a1('0xd')](),controller[_0x13a1('0x1a')]);router[_0x13a1('0x1b')](_0x13a1('0xf'),auth['isAuthenticated'](),controller[_0x13a1('0x1c')]);router['delete'](_0x13a1('0x10'),auth[_0x13a1('0xd')](),controller[_0x13a1('0x1d')]);router[_0x13a1('0x1b')](_0x13a1('0x1e'),auth[_0x13a1('0xd')](),controller[_0x13a1('0x1f')]);module[_0x13a1('0x20')]=router; \ No newline at end of file +var _0x0d41=['post','create','/:id/clone','clone','addSections','addResources','update','delete','/:id','destroy','removeSections','removeResources','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/sections','getSections','/:id/resources','getResources'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x0d41,0x150));var _0x10d4=function(_0x2e0de6,_0x271e38){_0x2e0de6=_0x2e0de6-0x0;var _0x581427=_0x0d41[_0x2e0de6];return _0x581427;};'use strict';var multer=require(_0x10d4('0x0'));var util=require('util');var path=require(_0x10d4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10d4('0x2')]();var fs_extra=require(_0x10d4('0x3'));var auth=require(_0x10d4('0x4'));var interaction=require(_0x10d4('0x5'));var config=require(_0x10d4('0x6'));var controller=require('./userProfile.controller');router[_0x10d4('0x7')]('/',auth[_0x10d4('0x8')](),controller['index']);router[_0x10d4('0x7')](_0x10d4('0x9'),auth[_0x10d4('0x8')](),controller[_0x10d4('0xa')]);router[_0x10d4('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x10d4('0x7')](_0x10d4('0xb'),auth[_0x10d4('0x8')](),controller[_0x10d4('0xc')]);router[_0x10d4('0x7')](_0x10d4('0xd'),auth[_0x10d4('0x8')](),controller[_0x10d4('0xe')]);router[_0x10d4('0xf')]('/',auth[_0x10d4('0x8')](),controller[_0x10d4('0x10')]);router[_0x10d4('0xf')](_0x10d4('0x11'),auth['isAuthenticated'](),controller[_0x10d4('0x12')]);router[_0x10d4('0xf')](_0x10d4('0xb'),auth[_0x10d4('0x8')](),controller[_0x10d4('0x13')]);router[_0x10d4('0xf')](_0x10d4('0xd'),auth[_0x10d4('0x8')](),controller[_0x10d4('0x14')]);router['put']('/:id',auth[_0x10d4('0x8')](),controller[_0x10d4('0x15')]);router[_0x10d4('0x16')](_0x10d4('0x17'),auth[_0x10d4('0x8')](),controller[_0x10d4('0x18')]);router[_0x10d4('0x16')](_0x10d4('0xb'),auth['isAuthenticated'](),controller[_0x10d4('0x19')]);router[_0x10d4('0x16')](_0x10d4('0xd'),auth[_0x10d4('0x8')](),controller[_0x10d4('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4d2f8d5..1dfb5a9 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 _0x346b=['join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','crudPermissions'];(function(_0x142a2d,_0x343748){var _0x334053=function(_0x1a8951){while(--_0x1a8951){_0x142a2d['push'](_0x142a2d['shift']());}};_0x334053(++_0x343748);}(_0x346b,0x1ee));var _0xb346=function(_0x173515,_0x5ef02d){_0x173515=_0x173515-0x0;var _0x5447a6=_0x346b[_0x173515];return _0x5447a6;};'use strict';var Sequelize=require(_0xb346('0x0'));module[_0xb346('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb346('0x2')},'crudPermissions':{'type':Sequelize[_0xb346('0x3')],'set':function(_0x5ad92c){this[_0xb346('0x4')](_0xb346('0x5'),_0x5ad92c?_0x5ad92c[_0xb346('0x6')](''):[]);},'get':function(){return this[_0xb346('0x7')](_0xb346('0x5'))?this[_0xb346('0x7')](_0xb346('0x5'))[_0xb346('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb346('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb346('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb346('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb346('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb346('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb346('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb346('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2c85=['exports','STRING','name','setDataValue','crudPermissions','join','BOOLEAN','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c85,0x12f));var _0x52c8=function(_0x13f0ed,_0x338566){_0x13f0ed=_0x13f0ed-0x0;var _0x1c86d6=_0x2c85[_0x13f0ed];return _0x1c86d6;};'use strict';var Sequelize=require(_0x52c8('0x0'));module[_0x52c8('0x1')]={'name':{'type':Sequelize[_0x52c8('0x2')],'allowNull':![],'unique':_0x52c8('0x3')},'crudPermissions':{'type':Sequelize[_0x52c8('0x2')],'set':function(_0x3466ac){this[_0x52c8('0x4')](_0x52c8('0x5'),_0x3466ac?_0x3466ac[_0x52c8('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x52c8('0x5'))?this['getDataValue'](_0x52c8('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x52c8('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x52c8('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7e5586d..a65c84a 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 _0x994c=['forEach','resourceId','Plugin','addResources','userProfileId','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','offset','count','limit','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','each','autoAssociation','UserProfileResource','sectionId','Resources','UserProfileSection','describe','transaction','removeSections','ids','enabled','includes','subsections','concat','push','findOne','Dashboard'];(function(_0x46c7ae,_0x49af65){var _0x2ddae8=function(_0x159aab){while(--_0x159aab){_0x46c7ae['push'](_0x46c7ae['shift']());}};_0x2ddae8(++_0x49af65);}(_0x994c,0x7b));var _0xc994=function(_0x28b39b,_0x58f18a){_0x28b39b=_0x28b39b-0x0;var _0x253233=_0x994c[_0x28b39b];return _0x253233;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc994('0x0'));var zipdir=require(_0xc994('0x1'));var jsonpatch=require(_0xc994('0x2'));var rp=require(_0xc994('0x3'));var moment=require(_0xc994('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc994('0x5'));var util=require(_0xc994('0x6'));var path=require(_0xc994('0x7'));var sox=require(_0xc994('0x8'));var csv=require(_0xc994('0x9'));var ejs=require(_0xc994('0xa'));var fs=require('fs');var fs_extra=require(_0xc994('0xb'));var _=require(_0xc994('0xc'));var squel=require(_0xc994('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc994('0x9'));var querystring=require(_0xc994('0xe'));var Papa=require(_0xc994('0xf'));var Redis=require(_0xc994('0x10'));var authService=require(_0xc994('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc994('0x12'));var hardwareService=require(_0xc994('0x13'));var logger=require(_0xc994('0x14'))('api');var utils=require(_0xc994('0x15'));var config=require(_0xc994('0x16'));var licenseUtil=require(_0xc994('0x17'));var db=require(_0xc994('0x18'))['db'];config[_0xc994('0x19')]=_['defaults'](config[_0xc994('0x19')],{'host':_0xc994('0x1a'),'port':0x18eb});var socket=require(_0xc994('0x1b'))(new Redis(config[_0xc994('0x19')]));require('./userProfile.socket')[_0xc994('0x1c')](socket);function respondWithStatusCode(_0x576ca7,_0x51abc2){_0x51abc2=_0x51abc2||0xcc;return function(_0x37836f){if(_0x37836f){return _0x576ca7[_0xc994('0x1d')](_0x51abc2);}return _0x576ca7[_0xc994('0x1e')](_0x51abc2)[_0xc994('0x1f')]();};}function respondWithResult(_0x2f44be,_0x418a28){_0x418a28=_0x418a28||0xc8;return function(_0x11467d){if(_0x11467d){return _0x2f44be['status'](_0x418a28)['json'](_0x11467d);}};}function respondWithFilteredResult(_0x4c6634,_0x3280ff){return function(_0x1f9c5c){if(_0x1f9c5c){var _0x16a9b2=typeof _0x3280ff['offset']===_0xc994('0x20')&&typeof _0x3280ff['limit']===_0xc994('0x20');var _0x3b82fc=_0x1f9c5c['count'];var _0x311994=_0x16a9b2?0x0:_0x3280ff[_0xc994('0x21')];var _0x382a91=_0x16a9b2?_0x1f9c5c[_0xc994('0x22')]:_0x3280ff[_0xc994('0x21')]+_0x3280ff[_0xc994('0x23')];var _0x2af8f3;if(_0x382a91>=_0x3b82fc){_0x382a91=_0x3b82fc;_0x2af8f3=0xc8;}else{_0x2af8f3=0xce;}_0x4c6634[_0xc994('0x1e')](_0x2af8f3);return _0x4c6634['set'](_0xc994('0x24'),_0x311994+'-'+_0x382a91+'/'+_0x3b82fc)[_0xc994('0x25')](_0x1f9c5c);}return null;};}function patchUpdates(_0x49a8dd){return function(_0x5645d8){try{jsonpatch[_0xc994('0x26')](_0x5645d8,_0x49a8dd,!![]);}catch(_0x59d6a4){return BPromise['reject'](_0x59d6a4);}return _0x5645d8[_0xc994('0x27')]();};}function saveUpdates(_0x1c71ab,_0x342ed2){return function(_0x3caf3b){if(_0x3caf3b){return _0x3caf3b[_0xc994('0x28')](_0x1c71ab)['then'](function(_0x11967e){return _0x11967e;});}return null;};}function removeEntity(_0x2e8282,_0x3a67d3){return function(_0x366433){if(_0x366433){return _0x366433[_0xc994('0x29')]()[_0xc994('0x2a')](function(){_0x2e8282[_0xc994('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255f6e,_0x56659b){return function(_0x4cadf9){if(!_0x4cadf9){_0x255f6e[_0xc994('0x1d')](0x194);}return _0x4cadf9;};}function handleError(_0x3e8037,_0xd7ecd6){_0xd7ecd6=_0xd7ecd6||0x1f4;return function(_0x9a299c){logger[_0xc994('0x2b')](_0x9a299c[_0xc994('0x2c')]);if(_0x9a299c[_0xc994('0x2d')]){delete _0x9a299c['name'];}_0x3e8037[_0xc994('0x1e')](_0xd7ecd6)[_0xc994('0x2e')](_0x9a299c);};}exports['index']=function(_0x3fb03f,_0x4fae97){var _0x4ab8c0={},_0x25c3c4={},_0x4f7f40={'count':0x0,'rows':[]};var _0x386944=_[_0xc994('0x2f')](db[_0xc994('0x30')][_0xc994('0x31')],function(_0x37a23c){return{'name':_0x37a23c[_0xc994('0x32')],'type':_0x37a23c['type'][_0xc994('0x33')]};});_0x25c3c4[_0xc994('0x34')]=_[_0xc994('0x2f')](_0x386944,_0xc994('0x2d'));_0x25c3c4['query']=_[_0xc994('0x35')](_0x3fb03f[_0xc994('0x36')]);_0x25c3c4[_0xc994('0x37')]=_[_0xc994('0x38')](_0x25c3c4['model'],_0x25c3c4[_0xc994('0x36')]);_0x4ab8c0[_0xc994('0x39')]=_[_0xc994('0x38')](_0x25c3c4[_0xc994('0x34')],qs[_0xc994('0x3a')](_0x3fb03f[_0xc994('0x36')][_0xc994('0x3a')]));_0x4ab8c0[_0xc994('0x39')]=_0x4ab8c0[_0xc994('0x39')][_0xc994('0x3b')]?_0x4ab8c0[_0xc994('0x39')]:_0x25c3c4['model'];if(!_0x3fb03f[_0xc994('0x36')][_0xc994('0x3c')](_0xc994('0x3d'))){_0x4ab8c0[_0xc994('0x23')]=qs[_0xc994('0x23')](_0x3fb03f['query'][_0xc994('0x23')]);_0x4ab8c0['offset']=qs[_0xc994('0x21')](_0x3fb03f['query'][_0xc994('0x21')]);}_0x4ab8c0[_0xc994('0x3e')]=qs[_0xc994('0x3f')](_0x3fb03f[_0xc994('0x36')]['sort']);_0x4ab8c0[_0xc994('0x40')]=qs[_0xc994('0x37')](_[_0xc994('0x41')](_0x3fb03f[_0xc994('0x36')],_0x25c3c4[_0xc994('0x37')]),_0x386944);if(_0x3fb03f[_0xc994('0x36')][_0xc994('0x42')]){_0x4ab8c0[_0xc994('0x40')]=_['merge'](_0x4ab8c0['where'],{'$or':_[_0xc994('0x2f')](_0x386944,function(_0x14eb8b){if(_0x14eb8b['type']!=='VIRTUAL'){var _0x283fd9={};_0x283fd9[_0x14eb8b[_0xc994('0x2d')]]={'$like':'%'+_0x3fb03f[_0xc994('0x36')]['filter']+'%'};return _0x283fd9;}})});}_0x4ab8c0=_[_0xc994('0x43')]({},_0x4ab8c0,_0x3fb03f[_0xc994('0x44')]);var _0x41070f={'where':_0x4ab8c0[_0xc994('0x40')]};return db[_0xc994('0x30')][_0xc994('0x22')](_0x41070f)[_0xc994('0x2a')](function(_0x4ca044){_0x4f7f40[_0xc994('0x22')]=_0x4ca044;if(_0x3fb03f[_0xc994('0x36')]['includeAll']){_0x4ab8c0[_0xc994('0x45')]=[{'all':!![]}];}return db[_0xc994('0x30')][_0xc994('0x46')](_0x4ab8c0);})[_0xc994('0x2a')](function(_0x2244ce){_0x4f7f40[_0xc994('0x47')]=_0x2244ce;return _0x4f7f40;})[_0xc994('0x2a')](respondWithFilteredResult(_0x4fae97,_0x4ab8c0))[_0xc994('0x48')](handleError(_0x4fae97,null));};exports[_0xc994('0x49')]=function(_0x43f686,_0x245283){var _0x596588={'raw':![],'where':{'id':_0x43f686[_0xc994('0x4a')]['id']}},_0x101148={};_0x101148[_0xc994('0x34')]=_[_0xc994('0x35')](db[_0xc994('0x30')][_0xc994('0x31')]);_0x101148[_0xc994('0x36')]=_[_0xc994('0x35')](_0x43f686['query']);_0x101148[_0xc994('0x37')]=_[_0xc994('0x38')](_0x101148[_0xc994('0x34')],_0x101148[_0xc994('0x36')]);_0x596588[_0xc994('0x39')]=_[_0xc994('0x38')](_0x101148['model'],qs[_0xc994('0x3a')](_0x43f686['query'][_0xc994('0x3a')]));_0x596588['attributes']=_0x596588[_0xc994('0x39')][_0xc994('0x3b')]?_0x596588[_0xc994('0x39')]:_0x101148[_0xc994('0x34')];if(_0x43f686[_0xc994('0x36')][_0xc994('0x4b')]){_0x596588[_0xc994('0x45')]=[{'all':!![]}];}_0x596588=_['merge']({},_0x596588,_0x43f686[_0xc994('0x44')]);return db[_0xc994('0x30')]['find'](_0x596588)[_0xc994('0x2a')](handleEntityNotFound(_0x245283,null))['then'](respondWithResult(_0x245283,null))['catch'](handleError(_0x245283,null));};exports[_0xc994('0x4c')]=function(_0x3184b1,_0x444e7b){return db['UserProfile'][_0xc994('0x4c')](_0x3184b1[_0xc994('0x4d')],{})['then'](respondWithResult(_0x444e7b,0xc9))['catch'](handleError(_0x444e7b,null));};exports[_0xc994('0x4e')]=function(_0x2c048b,_0xd18e04){var _0x185fca={'where':{'id':_0x2c048b[_0xc994('0x4a')]['id']}},_0x68316a={};_0x68316a[_0xc994('0x34')]=_[_0xc994('0x35')](db[_0xc994('0x30')]['rawAttributes']);_0x185fca['attributes']=_[_0xc994('0x38')](_0x68316a['model'],qs[_0xc994('0x3a')](_0x2c048b[_0xc994('0x36')]['fields']));_0x185fca[_0xc994('0x39')]=_0x185fca['attributes'][_0xc994('0x3b')]?_0x185fca['attributes']:_0x68316a['model'];if(_0x2c048b[_0xc994('0x36')][_0xc994('0x4b')]){_0x185fca[_0xc994('0x45')]=[{'all':!![]}];}_0x185fca=_[_0xc994('0x43')]({},_0x185fca,_0x2c048b[_0xc994('0x44')]);return db[_0xc994('0x30')][_0xc994('0x4f')](_0x185fca)['then'](handleEntityNotFound(_0xd18e04,null))['then'](function(_0x47400c){if(_0x47400c){var _0xc58423=_0x47400c[_0xc994('0x50')]({'plain':!![]});_0xc58423=qs[_0xc994('0x51')](_0xc58423,['id',_0xc994('0x52'),_0xc994('0x53'),_0xc994('0x54')]);_0x2c048b[_0xc994('0x4d')]=_[_0xc994('0x51')](_0x2c048b['body'],['id','createdAt',_0xc994('0x53')]);return db[_0xc994('0x55')]['transaction'](function(_0x5ee5f1){return db[_0xc994('0x30')]['create'](_[_0xc994('0x43')](_0xc58423,_0x2c048b[_0xc994('0x4d')]),{'include':_0x2c048b[_0xc994('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5ee5f1})[_0xc994('0x2a')](function(_0x29c82e){var _0x8ac883=_0x29c82e[_0xc994('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xc994('0x46')]({'where':{'userProfileId':_0x2c048b[_0xc994('0x4a')]['id']},'raw':!![]})[_0xc994('0x2a')](function(_0x3bb843){if(_0x3bb843){return BPromise[_0xc994('0x56')](_0x3bb843,function(_0x1c8206){return new BPromise(function(_0x5f4872,_0xfde7f){if(_0x1c8206[_0xc994('0x57')]===null||_0x1c8206[_0xc994('0x57')]===0x1)_0x5f4872(null);return db[_0xc994('0x58')]['findAll']({'where':{'sectionId':_0x1c8206['id']},'raw':!![]})[_0xc994('0x2a')](function(_0x182e88){var _0x39ec1c=_[_0xc994('0x2f')](_0x182e88,function(_0x51dcbd){return qs[_0xc994('0x51')](_0x51dcbd,['id',_0xc994('0x52'),'updatedAt',_0xc994('0x59')]);});_0x5f4872(_0x39ec1c);})[_0xc994('0x48')](function(_0x33ccb5){_0xfde7f(_0x33ccb5);});})[_0xc994('0x2a')](function(_0x1b53c8){var _0x50d958=qs[_0xc994('0x51')](_0x1c8206,['id',_0xc994('0x52'),'updatedAt']);_0x50d958['userProfileId']=_0x8ac883['id'];if(_0x1b53c8)_0x50d958[_0xc994('0x5a')]=_0x1b53c8;return _0x50d958;})[_0xc994('0x2a')](function(_0x1e4f25){return db[_0xc994('0x5b')]['create'](_0x1e4f25,{'include':[{'model':db[_0xc994('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x5ee5f1});});})['then'](function(){return _0x8ac883;});}});});});}})[_0xc994('0x2a')](respondWithResult(_0xd18e04,0xc9))[_0xc994('0x48')](handleError(_0xd18e04,null));};exports[_0xc994('0x28')]=function(_0x7087ba,_0x372ae9){if(_0x7087ba[_0xc994('0x4d')]['id']){delete _0x7087ba[_0xc994('0x4d')]['id'];}return db[_0xc994('0x30')][_0xc994('0x4f')]({'where':{'id':_0x7087ba[_0xc994('0x4a')]['id']}})[_0xc994('0x2a')](handleEntityNotFound(_0x372ae9,null))[_0xc994('0x2a')](saveUpdates(_0x7087ba[_0xc994('0x4d')],null))['then'](respondWithResult(_0x372ae9,null))['catch'](handleError(_0x372ae9,null));};exports[_0xc994('0x29')]=function(_0x15e778,_0x5d5236){return db[_0xc994('0x30')][_0xc994('0x4f')]({'where':{'id':_0x15e778['params']['id']}})[_0xc994('0x2a')](handleEntityNotFound(_0x5d5236,null))[_0xc994('0x2a')](removeEntity(_0x5d5236,null))['catch'](handleError(_0x5d5236,null));};exports[_0xc994('0x5c')]=function(_0x298f8e,_0x1ed7f2){return db[_0xc994('0x30')][_0xc994('0x5c')]()[_0xc994('0x2a')](respondWithResult(_0x1ed7f2,null))[_0xc994('0x48')](handleError(_0x1ed7f2,null));};exports['addSections']=function(_0x1cfb51,_0x31f7db){var _0x1db16a=_0x1cfb51[_0xc994('0x4d')];return db[_0xc994('0x30')][_0xc994('0x4f')]({'where':{'id':_0x1cfb51[_0xc994('0x4a')]['id']}})[_0xc994('0x2a')](handleEntityNotFound(_0x31f7db,null))[_0xc994('0x2a')](function(_0x5ce586){if(_0x5ce586){return db[_0xc994('0x55')][_0xc994('0x5d')](function(_0x1b03e0){return db[_0xc994('0x5b')][_0xc994('0x29')]({'where':{'userProfileId':_0x1cfb51[_0xc994('0x4a')]['id'],'sectionId':_[_0xc994('0x2f')](_0x1db16a,function(_0x1e1508){return _0x1e1508[_0xc994('0x59')];})},'transaction':_0x1b03e0})[_0xc994('0x2a')](function(){var _0x2baa6a=_[_0xc994('0x2f')](_0x1db16a,function(_0x157645){_0x157645['userProfileId']=_0x1cfb51[_0xc994('0x4a')]['id'];return _0x157645;});var _0x1af3db=[];return BPromise[_0xc994('0x56')](_0x2baa6a,function(_0x3725bf){return db[_0xc994('0x5b')][_0xc994('0x4c')](_0x3725bf,{'include':[{'model':db['UserProfileResource'],'as':_0xc994('0x5a')}],'raw':!![],'transaction':_0x1b03e0})[_0xc994('0x2a')](function(_0x38e036){_0x1af3db['push'](_0x38e036['get']({'plain':!![]}));});})[_0xc994('0x2a')](function(){return _0x1af3db;});});});}})['then'](function(_0x445866){return _0x445866;})[_0xc994('0x2a')](respondWithResult(_0x31f7db,null))[_0xc994('0x48')](handleError(_0x31f7db,null));};exports[_0xc994('0x5e')]=function(_0x2ce3cf,_0x366a72){var _0x563eba;return db[_0xc994('0x30')][_0xc994('0x4f')]({'where':{'id':_0x2ce3cf[_0xc994('0x4a')]['id']},'attributes':['id',_0xc994('0x2d')]})['then'](handleEntityNotFound(_0x366a72,null))['then'](function(_0x2c791a){if(_0x2c791a){_0x563eba=_0x2c791a;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2ce3cf[_0xc994('0x4a')]['id'],'sectionId':_0x2ce3cf['query'][_0xc994('0x5f')]}});}})[_0xc994('0x2a')](function(){return _0x563eba;})['then'](respondWithStatusCode(_0x366a72,null))['catch'](handleError(_0x366a72,null));};exports['getSections']=function(_0x20ab90,_0x20eab6){var _0x3b9e48=[];var _0x2aed2e=[];return db[_0xc994('0x5b')][_0xc994('0x46')]({'where':{'userProfileId':_0x20ab90[_0xc994('0x4a')]['id']},'raw':!![]})[_0xc994('0x2a')](function(_0x5c8a0d){_0x3b9e48=_[_0xc994('0x42')](_0x5c8a0d,function(_0x5ba72b){return _0x5ba72b[_0xc994('0x60')]===0x1||_[_0xc994('0x61')]([0x3eb,0x709],_0x5ba72b[_0xc994('0x59')]);});if(!_['isEmpty'](_0x3b9e48)){return _[_0xc994('0x2f')](_0x3b9e48,function(_0x3c4d85){return _0x3c4d85['sectionId'];});}else{return;}})[_0xc994('0x2a')](function(_0x3bd138){if(_0x3bd138)_0x2aed2e=_0x3bd138;if(_[_0xc994('0x61')](_0x2aed2e,0x64)){var _0x2a0974=_[_0xc994('0x4f')](_0x3b9e48,{'sectionId':0x64});return hasDefaultDashboard(_0x2a0974)[_0xc994('0x2a')](function(_0xf3e641){return _[_0xc994('0x2f')](_0x3b9e48,function(_0x59838d){if(_0x59838d[_0xc994('0x59')]===0x64){_0x59838d['subsections']=_0xf3e641;}return _0x59838d;});});}else{return;}})[_0xc994('0x2a')](function(_0x47b28e){if(_0x47b28e)_0x3b9e48=_0x47b28e;if(_[_0xc994('0x61')](_0x2aed2e,0x3eb)){var _0x51dd6f=_[_0xc994('0x4f')](_0x3b9e48,{'sectionId':0x3eb});return getCustomDashboards(_0x51dd6f)['then'](function(_0x20ac55){return _[_0xc994('0x2f')](_0x3b9e48,function(_0x248f6e){if(_0x51dd6f['enabled']){if(_0x248f6e[_0xc994('0x59')]===0x3eb){_0x248f6e[_0xc994('0x62')]=_0x20ac55;}}else{if(_0x248f6e['sectionId']===0x64){if(!_0x248f6e['subsections']){_0x248f6e[_0xc994('0x62')]=[];}_0x248f6e[_0xc994('0x62')]=_0x248f6e[_0xc994('0x62')][_0xc994('0x63')](_0x20ac55);}}return _0x248f6e;});});}else{return;}})[_0xc994('0x2a')](function(_0x558684){if(_0x558684)_0x3b9e48=_0x558684;if(_[_0xc994('0x61')](_0x2aed2e,0x709)){var _0x26e23a=_['find'](_0x3b9e48,{'sectionId':0x709});return getPlugins(_0x26e23a)[_0xc994('0x2a')](function(_0x4dabbe){if(_0x26e23a[_0xc994('0x60')]){return _[_0xc994('0x2f')](_0x3b9e48,function(_0x3e38f4){if(_0x3e38f4[_0xc994('0x59')]===0x709){_0x3e38f4['subsections']=_0x4dabbe;}return _0x3e38f4;});}else{var _0x28f0e4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4dabbe};var _0x1e040a=_[_0xc994('0x2f')](_0x3b9e48);_0x1e040a[_0xc994('0x64')](_0x28f0e4);return _0x1e040a;}});}else{return;}})[_0xc994('0x2a')](function(_0x3ca5fe){if(_0x3ca5fe)_0x3b9e48=_0x3ca5fe;return _[_0xc994('0x42')](_0x3b9e48,[_0xc994('0x60'),0x1]);})[_0xc994('0x2a')](respondWithResult(_0x20eab6,null))[_0xc994('0x48')](handleError(_0x20eab6,null));};function hasDefaultDashboard(_0x578907){var _0x128db0=[0x65];return new BPromise(function(_0x52ce3a,_0xf4e83c){try{if(_0x578907[_0xc994('0x57')]){_0x52ce3a(_0x128db0);}else{return db[_0xc994('0x58')][_0xc994('0x65')]({'where':{'sectionId':_0x578907['id']},'raw':!![]})['then'](function(_0x3782c3){_0x3782c3?_0x52ce3a(_0x128db0):_0x52ce3a();});}}catch(_0x59fa2f){_0xf4e83c(_0x59fa2f);}});}function getCustomDashboards(_0x3a6da8){var _0x35cf08=[];return new BPromise(function(_0x373f7e,_0x4bb7a1){try{if(_0x3a6da8[_0xc994('0x57')]){return db[_0xc994('0x66')][_0xc994('0x46')]({'raw':!![]})[_0xc994('0x2a')](function(_0x25c640){_0x25c640['forEach'](function(_0x5192e1){_0x35cf08[_0xc994('0x64')](_0x5192e1['id']+0x1869f);});_0x373f7e(_0x35cf08);});}else{return db[_0xc994('0x58')][_0xc994('0x46')]({'where':{'sectionId':_0x3a6da8['id']},'raw':!![]})[_0xc994('0x2a')](function(_0x410986){_0x410986[_0xc994('0x67')](function(_0x20a28d){_0x35cf08[_0xc994('0x64')](_0x20a28d[_0xc994('0x68')]+0x1869f);});_0x373f7e(_0x35cf08);});}}catch(_0x5506cd){_0x4bb7a1(_0x5506cd);}});}function getPlugins(_0x27cb59){var _0x2b1b5d=[];return new BPromise(function(_0x28b518,_0x5138f2){try{if(_0x27cb59['autoAssociation']){return db[_0xc994('0x69')]['findAll']({'raw':!![]})[_0xc994('0x2a')](function(_0x355bac){_0x355bac[_0xc994('0x67')](function(_0x7e10c3){_0x2b1b5d[_0xc994('0x64')](_0x7e10c3['id']+0x15b38);});_0x28b518(_0x2b1b5d);});}else{return db[_0xc994('0x58')][_0xc994('0x46')]({'where':{'sectionId':_0x27cb59['id']},'raw':!![]})[_0xc994('0x2a')](function(_0x327c75){_0x327c75[_0xc994('0x67')](function(_0x2aa172){_0x2b1b5d[_0xc994('0x64')](_0x2aa172[_0xc994('0x68')]+0x15b38);});_0x28b518(_0x2b1b5d);});}}catch(_0x176e7c){_0x5138f2(_0x176e7c);}});}exports[_0xc994('0x6a')]=function(_0x1766fd,_0x256262){return db[_0xc994('0x30')]['find']({'where':{'id':_0x1766fd[_0xc994('0x4a')]['id']}})[_0xc994('0x2a')](handleEntityNotFound(_0x256262,null))['then'](function(_0x1e4598){if(_0x1e4598){return db[_0xc994('0x55')][_0xc994('0x5d')](function(_0x4fc80e){return db[_0xc994('0x5b')][_0xc994('0x46')]({'where':{'userProfileId':_0x1766fd['params']['id']},'attributes':['id'],'raw':!![]})[_0xc994('0x2a')](function(_0x5a23d9){if(_0x5a23d9){return db[_0xc994('0x5b')][_0xc994('0x29')]({'where':{'userProfileId':_0x1766fd['params']['id'],'id':_[_0xc994('0x2f')](_0x5a23d9,function(_0x1d273f){return _0x1d273f['id'];})},'transaction':_0x4fc80e});}})[_0xc994('0x2a')](function(_0x18da61){var _0x373c1c=_['map'](_0x1766fd['body'],function(_0x2e9807){_0x2e9807[_0xc994('0x6b')]=_0x1766fd[_0xc994('0x4a')]['id'];return _0x2e9807;});return db[_0xc994('0x5b')][_0xc994('0x6c')](_0x373c1c,{'raw':!![],'transaction':_0x4fc80e});})[_0xc994('0x2a')](function(_0x4cf8f0){var _0x73d18c=_[_0xc994('0x42')](_[_0xc994('0x2f')](_0x4cf8f0,function(_0x5da0e2){return _0x5da0e2[_0xc994('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x73d18c){return db[_0xc994('0x5b')][_0xc994('0x46')]({'where':{'userProfileId':_0x1766fd[_0xc994('0x4a')]['id'],'sectionId':_[_0xc994('0x2f')](_0x73d18c,function(_0x1f0922){return _0x1f0922['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc994('0x2a')](function(_0x11583c){var _0x33286f=_[_0xc994('0x2f')](_0x1766fd[_0xc994('0x4d')],function(_0x16ba8e){_0x16ba8e['userProfileId']=_0x1766fd['params']['id'];return _0x16ba8e;});return db[_0xc994('0x58')]['bulkCreate'](_0x33286f,{'raw':!![],'transaction':_0x4fc80e});});}})[_0xc994('0x48')](handleError(_0x256262,null));});}})['then'](function(_0x4d481b){var _0x1dfbe9=_[_0xc994('0x2f')](_0x4d481b,function(_0x1ef2b3){return _0x1ef2b3['get']({'plain':!![]});});})[_0xc994('0x2a')](respondWithResult(_0x256262,null))[_0xc994('0x48')](handleError(_0x256262,null));};exports[_0xc994('0x6d')]=function(_0x33534e,_0xb835b2,_0x409707){return db['UserProfile'][_0xc994('0x4f')]({'where':{'id':_0x33534e['params']['id']}})[_0xc994('0x2a')](handleEntityNotFound(_0xb835b2,null))['then'](function(_0x42d9fd){if(_0x42d9fd){return _0x42d9fd[_0xc994('0x6d')](_0x33534e[_0xc994('0x36')][_0xc994('0x5f')]);}})[_0xc994('0x2a')](respondWithStatusCode(_0xb835b2,null))[_0xc994('0x48')](handleError(_0xb835b2,null));};exports[_0xc994('0x6e')]=function(_0x5af176,_0x274ae7){var _0x734d80={};if(!_0x5af176['query'][_0xc994('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x5af176[_0xc994('0x36')][_0xc994('0x3c')](_0xc994('0x3d'))){_0x734d80['limit']=qs['limit'](_0x5af176['query'][_0xc994('0x23')]);_0x734d80[_0xc994('0x21')]=qs[_0xc994('0x21')](_0x5af176['query'][_0xc994('0x21')]);}return db[_0xc994('0x30')][_0xc994('0x4f')]({'where':{'id':_0x5af176[_0xc994('0x4a')]['id']}})[_0xc994('0x2a')](function(_0x1fef90){if(!_0x1fef90)throw new Error(_0xc994('0x70')+_0x5af176[_0xc994('0x4a')]['id']);return db[_0xc994('0x30')][_0xc994('0x6e')](_0x5af176);})[_0xc994('0x2a')](respondWithFilteredResult(_0x274ae7,_0x734d80))[_0xc994('0x48')](handleError(_0x274ae7,null));}; \ No newline at end of file +var _0x762d=['removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','resourceId','forEach','addResources','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','UserProfile','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','options','create','body','clone','params','rawAttributes','length','include','get','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','userProfileId','Resources','find','describe','addSections','sectionId','push'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x762d,0x16b));var _0xd762=function(_0x22c69e,_0x31da41){_0x22c69e=_0x22c69e-0x0;var _0x2760df=_0x762d[_0x22c69e];return _0x2760df;};'use strict';var emlformat=require(_0xd762('0x0'));var rimraf=require(_0xd762('0x1'));var zipdir=require(_0xd762('0x2'));var jsonpatch=require(_0xd762('0x3'));var rp=require(_0xd762('0x4'));var moment=require(_0xd762('0x5'));var BPromise=require(_0xd762('0x6'));var Mustache=require(_0xd762('0x7'));var util=require(_0xd762('0x8'));var path=require(_0xd762('0x9'));var sox=require(_0xd762('0xa'));var csv=require(_0xd762('0xb'));var ejs=require(_0xd762('0xc'));var fs=require('fs');var fs_extra=require(_0xd762('0xd'));var _=require(_0xd762('0xe'));var squel=require(_0xd762('0xf'));var crypto=require('crypto');var jsforce=require(_0xd762('0x10'));var deskjs=require(_0xd762('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd762('0x12'));var Redis=require(_0xd762('0x13'));var authService=require(_0xd762('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd762('0x15'));var hardwareService=require(_0xd762('0x16'));var logger=require(_0xd762('0x17'))('api');var utils=require(_0xd762('0x18'));var config=require(_0xd762('0x19'));var licenseUtil=require(_0xd762('0x1a'));var db=require(_0xd762('0x1b'))['db'];config[_0xd762('0x1c')]=_['defaults'](config[_0xd762('0x1c')],{'host':_0xd762('0x1d'),'port':0x18eb});var socket=require(_0xd762('0x1e'))(new Redis(config[_0xd762('0x1c')]));require(_0xd762('0x1f'))[_0xd762('0x20')](socket);function respondWithStatusCode(_0x58eff0,_0x33e2a6){_0x33e2a6=_0x33e2a6||0xcc;return function(_0x17ffb2){if(_0x17ffb2){return _0x58eff0[_0xd762('0x21')](_0x33e2a6);}return _0x58eff0[_0xd762('0x22')](_0x33e2a6)[_0xd762('0x23')]();};}function respondWithResult(_0x1724da,_0x2ba958){_0x2ba958=_0x2ba958||0xc8;return function(_0x32c6b1){if(_0x32c6b1){return _0x1724da['status'](_0x2ba958)[_0xd762('0x24')](_0x32c6b1);}};}function respondWithFilteredResult(_0x5985f2,_0x332d27){return function(_0x285f56){if(_0x285f56){var _0x48f925=typeof _0x332d27[_0xd762('0x25')]==='undefined'&&typeof _0x332d27['limit']===_0xd762('0x26');var _0x2d9bdc=_0x285f56[_0xd762('0x27')];var _0x25882e=_0x48f925?0x0:_0x332d27['offset'];var _0xb1582d=_0x48f925?_0x285f56[_0xd762('0x27')]:_0x332d27['offset']+_0x332d27[_0xd762('0x28')];var _0x93eec1;if(_0xb1582d>=_0x2d9bdc){_0xb1582d=_0x2d9bdc;_0x93eec1=0xc8;}else{_0x93eec1=0xce;}_0x5985f2[_0xd762('0x22')](_0x93eec1);return _0x5985f2[_0xd762('0x29')](_0xd762('0x2a'),_0x25882e+'-'+_0xb1582d+'/'+_0x2d9bdc)[_0xd762('0x24')](_0x285f56);}return null;};}function patchUpdates(_0x54dc70){return function(_0x4ea892){try{jsonpatch[_0xd762('0x2b')](_0x4ea892,_0x54dc70,!![]);}catch(_0xc7d350){return BPromise['reject'](_0xc7d350);}return _0x4ea892[_0xd762('0x2c')]();};}function saveUpdates(_0x572ffc,_0x429dfd){return function(_0x108313){if(_0x108313){return _0x108313[_0xd762('0x2d')](_0x572ffc)[_0xd762('0x2e')](function(_0x5f2be1){return _0x5f2be1;});}return null;};}function removeEntity(_0x24ae4f,_0x23df89){return function(_0x596275){if(_0x596275){return _0x596275[_0xd762('0x2f')]()[_0xd762('0x2e')](function(){_0x24ae4f[_0xd762('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x362e31,_0x2e26ed){return function(_0x4ce574){if(!_0x4ce574){_0x362e31[_0xd762('0x21')](0x194);}return _0x4ce574;};}function handleError(_0x1651e7,_0x4be207){_0x4be207=_0x4be207||0x1f4;return function(_0x205d9b){logger[_0xd762('0x30')](_0x205d9b[_0xd762('0x31')]);if(_0x205d9b[_0xd762('0x32')]){delete _0x205d9b[_0xd762('0x32')];}_0x1651e7[_0xd762('0x22')](_0x4be207)[_0xd762('0x33')](_0x205d9b);};}exports['index']=function(_0x2baf70,_0x19c574){var _0x2885bb={},_0x58838f={},_0x5c4a02={'count':0x0,'rows':[]};var _0x59c849=_['map'](db[_0xd762('0x34')]['rawAttributes'],function(_0x1c0e03){return{'name':_0x1c0e03['fieldName'],'type':_0x1c0e03[_0xd762('0x35')][_0xd762('0x36')]};});_0x58838f[_0xd762('0x37')]=_[_0xd762('0x38')](_0x59c849,_0xd762('0x32'));_0x58838f[_0xd762('0x39')]=_['keys'](_0x2baf70[_0xd762('0x39')]);_0x58838f[_0xd762('0x3a')]=_[_0xd762('0x3b')](_0x58838f[_0xd762('0x37')],_0x58838f['query']);_0x2885bb['attributes']=_[_0xd762('0x3b')](_0x58838f[_0xd762('0x37')],qs[_0xd762('0x3c')](_0x2baf70[_0xd762('0x39')]['fields']));_0x2885bb[_0xd762('0x3d')]=_0x2885bb[_0xd762('0x3d')]['length']?_0x2885bb['attributes']:_0x58838f['model'];if(!_0x2baf70[_0xd762('0x39')][_0xd762('0x3e')]('nolimit')){_0x2885bb[_0xd762('0x28')]=qs[_0xd762('0x28')](_0x2baf70[_0xd762('0x39')]['limit']);_0x2885bb[_0xd762('0x25')]=qs[_0xd762('0x25')](_0x2baf70[_0xd762('0x39')]['offset']);}_0x2885bb[_0xd762('0x3f')]=qs[_0xd762('0x40')](_0x2baf70[_0xd762('0x39')][_0xd762('0x40')]);_0x2885bb[_0xd762('0x41')]=qs[_0xd762('0x3a')](_[_0xd762('0x42')](_0x2baf70[_0xd762('0x39')],_0x58838f[_0xd762('0x3a')]),_0x59c849);if(_0x2baf70['query'][_0xd762('0x43')]){_0x2885bb[_0xd762('0x41')]=_[_0xd762('0x44')](_0x2885bb['where'],{'$or':_[_0xd762('0x38')](_0x59c849,function(_0x291a8d){if(_0x291a8d[_0xd762('0x35')]!==_0xd762('0x45')){var _0x4ad950={};_0x4ad950[_0x291a8d[_0xd762('0x32')]]={'$like':'%'+_0x2baf70[_0xd762('0x39')][_0xd762('0x43')]+'%'};return _0x4ad950;}})});}_0x2885bb=_[_0xd762('0x44')]({},_0x2885bb,_0x2baf70['options']);var _0x34a3c5={'where':_0x2885bb[_0xd762('0x41')]};return db['UserProfile'][_0xd762('0x27')](_0x34a3c5)[_0xd762('0x2e')](function(_0x10dbd1){_0x5c4a02['count']=_0x10dbd1;if(_0x2baf70[_0xd762('0x39')][_0xd762('0x46')]){_0x2885bb['include']=[{'all':!![]}];}return db[_0xd762('0x34')][_0xd762('0x47')](_0x2885bb);})[_0xd762('0x2e')](function(_0x436889){_0x5c4a02[_0xd762('0x48')]=_0x436889;return _0x5c4a02;})['then'](respondWithFilteredResult(_0x19c574,_0x2885bb))[_0xd762('0x49')](handleError(_0x19c574,null));};exports[_0xd762('0x4a')]=function(_0x6e3db1,_0x62b168){var _0x146918={'raw':![],'where':{'id':_0x6e3db1['params']['id']}},_0x542e9e={};_0x542e9e[_0xd762('0x37')]=_[_0xd762('0x4b')](db[_0xd762('0x34')]['rawAttributes']);_0x542e9e[_0xd762('0x39')]=_[_0xd762('0x4b')](_0x6e3db1[_0xd762('0x39')]);_0x542e9e[_0xd762('0x3a')]=_[_0xd762('0x3b')](_0x542e9e[_0xd762('0x37')],_0x542e9e[_0xd762('0x39')]);_0x146918[_0xd762('0x3d')]=_['intersection'](_0x542e9e[_0xd762('0x37')],qs[_0xd762('0x3c')](_0x6e3db1[_0xd762('0x39')][_0xd762('0x3c')]));_0x146918[_0xd762('0x3d')]=_0x146918[_0xd762('0x3d')]['length']?_0x146918[_0xd762('0x3d')]:_0x542e9e[_0xd762('0x37')];if(_0x6e3db1[_0xd762('0x39')][_0xd762('0x46')]){_0x146918['include']=[{'all':!![]}];}_0x146918=_[_0xd762('0x44')]({},_0x146918,_0x6e3db1[_0xd762('0x4c')]);return db[_0xd762('0x34')]['find'](_0x146918)[_0xd762('0x2e')](handleEntityNotFound(_0x62b168,null))[_0xd762('0x2e')](respondWithResult(_0x62b168,null))[_0xd762('0x49')](handleError(_0x62b168,null));};exports[_0xd762('0x4d')]=function(_0x4ee0de,_0x5cc4f3){return db[_0xd762('0x34')][_0xd762('0x4d')](_0x4ee0de[_0xd762('0x4e')],{})['then'](respondWithResult(_0x5cc4f3,0xc9))['catch'](handleError(_0x5cc4f3,null));};exports[_0xd762('0x4f')]=function(_0x594f93,_0x2d3cf5){var _0x3fc30c={'where':{'id':_0x594f93[_0xd762('0x50')]['id']}},_0x1c104f={};_0x1c104f[_0xd762('0x37')]=_[_0xd762('0x4b')](db[_0xd762('0x34')][_0xd762('0x51')]);_0x3fc30c['attributes']=_[_0xd762('0x3b')](_0x1c104f[_0xd762('0x37')],qs[_0xd762('0x3c')](_0x594f93[_0xd762('0x39')][_0xd762('0x3c')]));_0x3fc30c[_0xd762('0x3d')]=_0x3fc30c[_0xd762('0x3d')][_0xd762('0x52')]?_0x3fc30c[_0xd762('0x3d')]:_0x1c104f['model'];if(_0x594f93[_0xd762('0x39')]['includeAll']){_0x3fc30c[_0xd762('0x53')]=[{'all':!![]}];}_0x3fc30c=_[_0xd762('0x44')]({},_0x3fc30c,_0x594f93['options']);return db[_0xd762('0x34')]['find'](_0x3fc30c)[_0xd762('0x2e')](handleEntityNotFound(_0x2d3cf5,null))[_0xd762('0x2e')](function(_0x4976d2){if(_0x4976d2){var _0x5b792c=_0x4976d2[_0xd762('0x54')]({'plain':!![]});_0x5b792c=qs['omit'](_0x5b792c,['id',_0xd762('0x55'),_0xd762('0x56'),'crudPermissions']);_0x594f93[_0xd762('0x4e')]=_['omit'](_0x594f93['body'],['id',_0xd762('0x55'),'updatedAt']);return db[_0xd762('0x57')][_0xd762('0x58')](function(_0x547157){return db[_0xd762('0x34')]['create'](_['merge'](_0x5b792c,_0x594f93['body']),{'include':_0x594f93[_0xd762('0x39')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x547157})[_0xd762('0x2e')](function(_0x5491fd){var _0x150d63=_0x5491fd[_0xd762('0x54')]({'plain':!![]});return db[_0xd762('0x59')][_0xd762('0x47')]({'where':{'userProfileId':_0x594f93[_0xd762('0x50')]['id']},'raw':!![]})[_0xd762('0x2e')](function(_0x500a7c){if(_0x500a7c){return BPromise[_0xd762('0x5a')](_0x500a7c,function(_0xa01ac4){return new BPromise(function(_0x2c06cb,_0x501356){if(_0xa01ac4[_0xd762('0x5b')]===null||_0xa01ac4[_0xd762('0x5b')]===0x1)_0x2c06cb(null);return db[_0xd762('0x5c')][_0xd762('0x47')]({'where':{'sectionId':_0xa01ac4['id']},'raw':!![]})[_0xd762('0x2e')](function(_0x157c7e){var _0x17fe23=_[_0xd762('0x38')](_0x157c7e,function(_0x287ff5){return qs[_0xd762('0x5d')](_0x287ff5,['id',_0xd762('0x55'),'updatedAt','sectionId']);});_0x2c06cb(_0x17fe23);})[_0xd762('0x49')](function(_0x441bb6){_0x501356(_0x441bb6);});})[_0xd762('0x2e')](function(_0x5a4c4a){var _0xaf5e15=qs['omit'](_0xa01ac4,['id',_0xd762('0x55'),_0xd762('0x56')]);_0xaf5e15[_0xd762('0x5e')]=_0x150d63['id'];if(_0x5a4c4a)_0xaf5e15[_0xd762('0x5f')]=_0x5a4c4a;return _0xaf5e15;})[_0xd762('0x2e')](function(_0x443bf8){return db[_0xd762('0x59')][_0xd762('0x4d')](_0x443bf8,{'include':[{'model':db['UserProfileResource'],'as':_0xd762('0x5f')}],'raw':!![],'transaction':_0x547157});});})[_0xd762('0x2e')](function(){return _0x150d63;});}});});});}})[_0xd762('0x2e')](respondWithResult(_0x2d3cf5,0xc9))['catch'](handleError(_0x2d3cf5,null));};exports['update']=function(_0x22fe28,_0x2ed62f){if(_0x22fe28[_0xd762('0x4e')]['id']){delete _0x22fe28['body']['id'];}return db['UserProfile'][_0xd762('0x60')]({'where':{'id':_0x22fe28['params']['id']}})[_0xd762('0x2e')](handleEntityNotFound(_0x2ed62f,null))[_0xd762('0x2e')](saveUpdates(_0x22fe28[_0xd762('0x4e')],null))[_0xd762('0x2e')](respondWithResult(_0x2ed62f,null))['catch'](handleError(_0x2ed62f,null));};exports['destroy']=function(_0x280cbc,_0x1d2b79){return db[_0xd762('0x34')][_0xd762('0x60')]({'where':{'id':_0x280cbc[_0xd762('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d2b79,null))[_0xd762('0x2e')](removeEntity(_0x1d2b79,null))[_0xd762('0x49')](handleError(_0x1d2b79,null));};exports[_0xd762('0x61')]=function(_0xb0914a,_0xfb1f5f){return db[_0xd762('0x34')][_0xd762('0x61')]()['then'](respondWithResult(_0xfb1f5f,null))[_0xd762('0x49')](handleError(_0xfb1f5f,null));};exports[_0xd762('0x62')]=function(_0x4bbb32,_0xd8d686){var _0xb2f346=_0x4bbb32[_0xd762('0x4e')];return db['UserProfile'][_0xd762('0x60')]({'where':{'id':_0x4bbb32[_0xd762('0x50')]['id']}})[_0xd762('0x2e')](handleEntityNotFound(_0xd8d686,null))[_0xd762('0x2e')](function(_0x34b03a){if(_0x34b03a){return db[_0xd762('0x57')][_0xd762('0x58')](function(_0x389ac3){return db[_0xd762('0x59')][_0xd762('0x2f')]({'where':{'userProfileId':_0x4bbb32[_0xd762('0x50')]['id'],'sectionId':_[_0xd762('0x38')](_0xb2f346,function(_0x3fff9d){return _0x3fff9d[_0xd762('0x63')];})},'transaction':_0x389ac3})['then'](function(){var _0x575073=_[_0xd762('0x38')](_0xb2f346,function(_0x52dd55){_0x52dd55['userProfileId']=_0x4bbb32[_0xd762('0x50')]['id'];return _0x52dd55;});var _0x4fd7e8=[];return BPromise[_0xd762('0x5a')](_0x575073,function(_0x52d84c){return db['UserProfileSection'][_0xd762('0x4d')](_0x52d84c,{'include':[{'model':db['UserProfileResource'],'as':_0xd762('0x5f')}],'raw':!![],'transaction':_0x389ac3})['then'](function(_0x50e3c4){_0x4fd7e8[_0xd762('0x64')](_0x50e3c4[_0xd762('0x54')]({'plain':!![]}));});})['then'](function(){return _0x4fd7e8;});});});}})[_0xd762('0x2e')](function(_0x484a39){return _0x484a39;})[_0xd762('0x2e')](respondWithResult(_0xd8d686,null))[_0xd762('0x49')](handleError(_0xd8d686,null));};exports[_0xd762('0x65')]=function(_0x3dd3bd,_0x2a04a9){var _0x15d714;return db[_0xd762('0x34')][_0xd762('0x60')]({'where':{'id':_0x3dd3bd[_0xd762('0x50')]['id']},'attributes':['id',_0xd762('0x32')]})[_0xd762('0x2e')](handleEntityNotFound(_0x2a04a9,null))[_0xd762('0x2e')](function(_0x4ca949){if(_0x4ca949){_0x15d714=_0x4ca949;return db['UserProfileSection'][_0xd762('0x2f')]({'where':{'userProfileId':_0x3dd3bd['params']['id'],'sectionId':_0x3dd3bd[_0xd762('0x39')][_0xd762('0x66')]}});}})[_0xd762('0x2e')](function(){return _0x15d714;})[_0xd762('0x2e')](respondWithStatusCode(_0x2a04a9,null))[_0xd762('0x49')](handleError(_0x2a04a9,null));};exports[_0xd762('0x67')]=function(_0x1ce780,_0x27a4a9){var _0x51d461=[];var _0x59302e=[];return db[_0xd762('0x59')][_0xd762('0x47')]({'where':{'userProfileId':_0x1ce780[_0xd762('0x50')]['id']},'raw':!![]})[_0xd762('0x2e')](function(_0x5db9c3){_0x51d461=_['filter'](_0x5db9c3,function(_0x38b75c){return _0x38b75c[_0xd762('0x68')]===0x1||_['includes']([0x3eb,0x709],_0x38b75c[_0xd762('0x63')]);});if(!_[_0xd762('0x69')](_0x51d461)){return _[_0xd762('0x38')](_0x51d461,function(_0x3ff257){return _0x3ff257[_0xd762('0x63')];});}else{return;}})[_0xd762('0x2e')](function(_0x215c6e){if(_0x215c6e)_0x59302e=_0x215c6e;if(_[_0xd762('0x6a')](_0x59302e,0x64)){var _0x13ad2e=_[_0xd762('0x60')](_0x51d461,{'sectionId':0x64});return hasDefaultDashboard(_0x13ad2e)[_0xd762('0x2e')](function(_0x426677){return _[_0xd762('0x38')](_0x51d461,function(_0x11e010){if(_0x11e010['sectionId']===0x64){_0x11e010[_0xd762('0x6b')]=_0x426677;}return _0x11e010;});});}else{return;}})[_0xd762('0x2e')](function(_0x1bdde8){if(_0x1bdde8)_0x51d461=_0x1bdde8;if(_[_0xd762('0x6a')](_0x59302e,0x3eb)){var _0x1de79d=_['find'](_0x51d461,{'sectionId':0x3eb});return getCustomDashboards(_0x1de79d)[_0xd762('0x2e')](function(_0x41b0f0){return _['map'](_0x51d461,function(_0x465ea0){if(_0x1de79d[_0xd762('0x68')]){if(_0x465ea0[_0xd762('0x63')]===0x3eb){_0x465ea0[_0xd762('0x6b')]=_0x41b0f0;}}else{if(_0x465ea0[_0xd762('0x63')]===0x64){if(!_0x465ea0[_0xd762('0x6b')]){_0x465ea0[_0xd762('0x6b')]=[];}_0x465ea0['subsections']=_0x465ea0[_0xd762('0x6b')]['concat'](_0x41b0f0);}}return _0x465ea0;});});}else{return;}})[_0xd762('0x2e')](function(_0x4f683b){if(_0x4f683b)_0x51d461=_0x4f683b;if(_[_0xd762('0x6a')](_0x59302e,0x709)){var _0xc18a78=_[_0xd762('0x60')](_0x51d461,{'sectionId':0x709});return getPlugins(_0xc18a78)[_0xd762('0x2e')](function(_0x2d0812){if(_0xc18a78[_0xd762('0x68')]){return _[_0xd762('0x38')](_0x51d461,function(_0x59471e){if(_0x59471e[_0xd762('0x63')]===0x709){_0x59471e[_0xd762('0x6b')]=_0x2d0812;}return _0x59471e;});}else{var _0x12a4b8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d0812};var _0x2f8003=_[_0xd762('0x38')](_0x51d461);_0x2f8003[_0xd762('0x64')](_0x12a4b8);return _0x2f8003;}});}else{return;}})[_0xd762('0x2e')](function(_0x1258cb){if(_0x1258cb)_0x51d461=_0x1258cb;return _[_0xd762('0x43')](_0x51d461,[_0xd762('0x68'),0x1]);})[_0xd762('0x2e')](respondWithResult(_0x27a4a9,null))['catch'](handleError(_0x27a4a9,null));};function hasDefaultDashboard(_0x5b8c92){var _0x508a8d=[0x65];return new BPromise(function(_0x3ecddf,_0x38a5fb){try{if(_0x5b8c92[_0xd762('0x5b')]){_0x3ecddf(_0x508a8d);}else{return db[_0xd762('0x5c')][_0xd762('0x6c')]({'where':{'sectionId':_0x5b8c92['id']},'raw':!![]})['then'](function(_0x416fb7){_0x416fb7?_0x3ecddf(_0x508a8d):_0x3ecddf();});}}catch(_0xe669c9){_0x38a5fb(_0xe669c9);}});}function getCustomDashboards(_0x31978b){var _0x5c8452=[];return new BPromise(function(_0x4fa87c,_0x2d0656){try{if(_0x31978b[_0xd762('0x5b')]){return db['Dashboard'][_0xd762('0x47')]({'raw':!![]})['then'](function(_0x184691){_0x184691['forEach'](function(_0x213304){_0x5c8452[_0xd762('0x64')](_0x213304['id']+0x1869f);});_0x4fa87c(_0x5c8452);});}else{return db['UserProfileResource'][_0xd762('0x47')]({'where':{'sectionId':_0x31978b['id']},'raw':!![]})[_0xd762('0x2e')](function(_0x597904){_0x597904['forEach'](function(_0x32cc36){_0x5c8452['push'](_0x32cc36[_0xd762('0x6d')]+0x1869f);});_0x4fa87c(_0x5c8452);});}}catch(_0x33305a){_0x2d0656(_0x33305a);}});}function getPlugins(_0x38fae5){var _0x20e782=[];return new BPromise(function(_0x33179b,_0x25d911){try{if(_0x38fae5['autoAssociation']){return db['Plugin'][_0xd762('0x47')]({'raw':!![]})[_0xd762('0x2e')](function(_0x15b0e5){_0x15b0e5[_0xd762('0x6e')](function(_0x44f66b){_0x20e782[_0xd762('0x64')](_0x44f66b['id']+0x15b38);});_0x33179b(_0x20e782);});}else{return db[_0xd762('0x5c')][_0xd762('0x47')]({'where':{'sectionId':_0x38fae5['id']},'raw':!![]})[_0xd762('0x2e')](function(_0x4c1de7){_0x4c1de7['forEach'](function(_0x41621b){_0x20e782['push'](_0x41621b[_0xd762('0x6d')]+0x15b38);});_0x33179b(_0x20e782);});}}catch(_0x5143e8){_0x25d911(_0x5143e8);}});}exports[_0xd762('0x6f')]=function(_0x36681d,_0x4b45f2){return db[_0xd762('0x34')][_0xd762('0x60')]({'where':{'id':_0x36681d[_0xd762('0x50')]['id']}})[_0xd762('0x2e')](handleEntityNotFound(_0x4b45f2,null))[_0xd762('0x2e')](function(_0xdaeaca){if(_0xdaeaca){return db[_0xd762('0x57')][_0xd762('0x58')](function(_0x149139){return db[_0xd762('0x59')]['findAll']({'where':{'userProfileId':_0x36681d[_0xd762('0x50')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3de0fc){if(_0x3de0fc){return db['UserProfileSection'][_0xd762('0x2f')]({'where':{'userProfileId':_0x36681d['params']['id'],'id':_[_0xd762('0x38')](_0x3de0fc,function(_0x310339){return _0x310339['id'];})},'transaction':_0x149139});}})[_0xd762('0x2e')](function(_0x13c083){var _0x447c90=_['map'](_0x36681d['body'],function(_0x59bd0e){_0x59bd0e['userProfileId']=_0x36681d[_0xd762('0x50')]['id'];return _0x59bd0e;});return db[_0xd762('0x59')]['bulkCreate'](_0x447c90,{'raw':!![],'transaction':_0x149139});})['then'](function(_0x3db3b9){var _0x2d88dd=_['filter'](_['map'](_0x3db3b9,function(_0xaab650){return _0xaab650[_0xd762('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d88dd){return db['UserProfileSection'][_0xd762('0x47')]({'where':{'userProfileId':_0x36681d[_0xd762('0x50')]['id'],'sectionId':_['map'](_0x2d88dd,function(_0x37d02a){return _0x37d02a['sectionId'];})},'attributes':['id',_0xd762('0x63')],'raw':!![]})[_0xd762('0x2e')](function(_0x35ccaa){var _0x2c3607=_[_0xd762('0x38')](_0x36681d[_0xd762('0x4e')],function(_0x16f44d){_0x16f44d['userProfileId']=_0x36681d['params']['id'];return _0x16f44d;});return db[_0xd762('0x5c')]['bulkCreate'](_0x2c3607,{'raw':!![],'transaction':_0x149139});});}})['catch'](handleError(_0x4b45f2,null));});}})[_0xd762('0x2e')](function(_0x5dcf67){var _0x2315d4=_[_0xd762('0x38')](_0x5dcf67,function(_0x4b194f){return _0x4b194f[_0xd762('0x54')]({'plain':!![]});});})[_0xd762('0x2e')](respondWithResult(_0x4b45f2,null))[_0xd762('0x49')](handleError(_0x4b45f2,null));};exports[_0xd762('0x70')]=function(_0x3b39a7,_0x36fc27,_0x3f6d3b){return db[_0xd762('0x34')]['find']({'where':{'id':_0x3b39a7[_0xd762('0x50')]['id']}})['then'](handleEntityNotFound(_0x36fc27,null))['then'](function(_0x1212d1){if(_0x1212d1){return _0x1212d1[_0xd762('0x70')](_0x3b39a7[_0xd762('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x36fc27,null))[_0xd762('0x49')](handleError(_0x36fc27,null));};exports[_0xd762('0x71')]=function(_0x4fd943,_0x14ffc0){var _0x3c7ed8={};if(!_0x4fd943['query']['section'])throw new Error(_0xd762('0x72'));if(!_0x4fd943[_0xd762('0x39')][_0xd762('0x3e')]('nolimit')){_0x3c7ed8[_0xd762('0x28')]=qs[_0xd762('0x28')](_0x4fd943['query'][_0xd762('0x28')]);_0x3c7ed8[_0xd762('0x25')]=qs[_0xd762('0x25')](_0x4fd943[_0xd762('0x39')][_0xd762('0x25')]);}return db[_0xd762('0x34')][_0xd762('0x60')]({'where':{'id':_0x4fd943['params']['id']}})['then'](function(_0x1d6979){if(!_0x1d6979)throw new Error(_0xd762('0x73')+_0x4fd943[_0xd762('0x50')]['id']);return db[_0xd762('0x34')][_0xd762('0x71')](_0x4fd943);})[_0xd762('0x2e')](respondWithFilteredResult(_0x14ffc0,_0x3c7ed8))[_0xd762('0x49')](handleError(_0x14ffc0,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 19d873a..759fddc 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 _0x3c85=['remove','emit','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x3e4c29,_0x2053ff){var _0x16926a=function(_0x426f62){while(--_0x426f62){_0x3e4c29['push'](_0x3e4c29['shift']());}};_0x16926a(++_0x2053ff);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3499e6,_0x48f055){_0x3499e6=_0x3499e6-0x0;var _0x55170a=_0x3c85[_0x3499e6];return _0x55170a;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var UserProfile=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){UserProfileEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);UserProfileEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xa7db=['../../mysqldb','UserProfile','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d435b,_0x26cb80){var _0xad80ed=function(_0x2fc584){while(--_0x2fc584){_0x4d435b['push'](_0x4d435b['shift']());}};_0xad80ed(++_0x26cb80);}(_0xa7db,0xbf));var _0xba7d=function(_0xbf7863,_0x5d3591){_0xbf7863=_0xbf7863-0x0;var _0x29ae6b=_0xa7db[_0xbf7863];return _0x29ae6b;};'use strict';var EventEmitter=require(_0xba7d('0x0'));var UserProfile=require(_0xba7d('0x1'))['db'][_0xba7d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba7d('0x3')};function emitEvent(_0xcfd2a5){return function(_0x1af692,_0x385fd6,_0x10f8b6){UserProfileEvents['emit'](_0xcfd2a5+':'+_0x1af692['id'],_0x1af692);UserProfileEvents[_0xba7d('0x4')](_0xcfd2a5,_0x1af692);_0x10f8b6(null);};}for(var e in events){if(events[_0xba7d('0x5')](e)){var event=events[e];UserProfile[_0xba7d('0x6')](e,emitEvent(event));}}module[_0xba7d('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 95cae70..463db8f 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 _0xfc5e=['default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','UserProfileResource','type','resourceId','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','CmContact','parentSections','Lists','CmList','companies','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','name','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','Schedule','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','sequelize','query','toString','OpenTabs','UserProfile','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','pick','where','merge','key','VIRTUAL','foreignKey','includeAll','include','forEach','reportType'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xfc5e,0xd2));var _0xefc5=function(_0x13b38a,_0x5a0b37){_0x13b38a=_0x13b38a-0x0;var _0x4a640a=_0xfc5e[_0x13b38a];return _0x4a640a;};'use strict';var _=require(_0xefc5('0x0'));var attributes=require(_0xefc5('0x1'));var squel=require(_0xefc5('0x2'));module[_0xefc5('0x3')]=function(_0x279b02){var _0x114147=_0x279b02[_0xefc5('0x4')];function _0x4f098e(_0x2cb531,_0x4fbb30){return new Promise(function(_0x1555be,_0x669ef1){if(!_0x4fbb30)return _0x1555be(null);var _0x315d64=_0x4fbb30[_0xefc5('0x5')]?{[_0x4fbb30[_0xefc5('0x5')][_0xefc5('0x6')]]:_0x4fbb30['filter'][_0xefc5('0x7')]}:undefined;return _0x114147[_0x2cb531][_0xefc5('0x8')]({'where':_0x315d64,'raw':!![]})[_0xefc5('0x9')](function(_0x2570e6){_0x4fbb30[_0xefc5('0xa')]=_[_0xefc5('0xb')](_0x2570e6,'id');_0x1555be(_0x4fbb30);})[_0xefc5('0xc')](function(_0x1a8a3c){_0x669ef1(_0x1a8a3c);});});}function _0x292457(_0x14008e,_0x88e754){return new Promise(function(_0x5fa443,_0x3672e5){var _0x11327f=_0x14008e[_0xefc5('0x5')]?{[_0x14008e[_0xefc5('0x5')]['field']]:_0x14008e[_0xefc5('0x5')]['value']}:undefined;return _0x114147[_0x14008e[_0xefc5('0xd')]]['findAll']({'where':_0x11327f,'raw':!![]})[_0xefc5('0x9')](function(_0x82e88){_0x88e754[_0xefc5('0xa')]=_['map'](_0x82e88,function(_0x4e7ed6){return _0x4e7ed6['name'];});_0x5fa443(_0x88e754);})[_0xefc5('0xc')](function(_0x4e1744){_0x3672e5(_0x4e1744);});});}function _0x11c73d(_0x36291c,_0x31b416,_0x3518ec){if(!_0x31b416)return Promise['resolve'](null);return new Promise(function(_0x3cba82,_0x56cfa3){return _0x114147[_0xefc5('0xe')][_0xefc5('0x8')]({'where':{'sectionId':_0x31b416['id']},'raw':!![]})['then'](function(_0x274c91){if(_0x36291c[_0xefc5('0x6')]&&_0x36291c['field']!=='id'){_0x31b416[_0xefc5('0xa')]=_[_0xefc5('0xb')](_0x274c91,function(_0x431c8b){return _0x431c8b[_0x36291c['field']];});}else{if(_0x3518ec==='AnalyticExtractedReport'){_0x31b416[_0xefc5('0xa')]=_[_0xefc5('0xb')](_0x274c91,function(_0x3802a4){return{'id':_0x3802a4['resourceId'],'type':_0x3802a4[_0xefc5('0xf')]};});}else{_0x31b416[_0xefc5('0xa')]=_[_0xefc5('0xb')](_0x274c91,function(_0x5bc1f5){return _0x5bc1f5[_0xefc5('0x10')];});}}_0x3cba82(_0x31b416);})['catch'](function(_0x37a3b7){_0x56cfa3(_0x37a3b7);});});}function _0x2df962(_0xba177a,_0x228771){var _0x2220bd={'parentSections':[]};switch(_0xba177a['toLowerCase']()){case _0xefc5('0x11'):_0x2220bd[_0xefc5('0x12')]='SquareProject';break;case _0xefc5('0x13'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x14');break;case _0xefc5('0x15'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x16');_0x2220bd['parentSections']=[{'name':_0xefc5('0x17'),'field':'name','foreignKey':_0xefc5('0x18')}];break;case'projects':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x19');break;case _0xefc5('0x1a'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x1b');_0x2220bd[_0xefc5('0x1c')]=[{'name':_0xefc5('0x1d'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x1e');break;case _0xefc5('0x1f'):_0x2220bd[_0xefc5('0x12')]='CmCompany';break;case _0xefc5('0x20'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x21');break;case'chatqueues':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x22');break;case _0xefc5('0x23'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x24');break;case _0xefc5('0x25'):_0x2220bd[_0xefc5('0x12')]='FaxQueue';break;case _0xefc5('0x26'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x27');break;case _0xefc5('0x28'):case _0xefc5('0x29'):case'outboundroutes':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x2a');break;case'contexts':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x2b');break;case'voicemails':_0x2220bd['childModel']=_0xefc5('0x2c');break;case _0xefc5('0x2d'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x2e');_0x2220bd[_0xefc5('0x1c')]=[{'name':_0xefc5('0x2f'),'field':_0xefc5('0x30'),'foreignKey':'membername','model':_0xefc5('0x31'),'filter':{'field':_0xefc5('0x32'),'value':[_0xefc5('0x33')]}},{'name':_0xefc5('0x34'),'field':_0xefc5('0x30'),'foreignKey':'membername','model':'User','filter':{'field':_0xefc5('0x32'),'value':[_0xefc5('0x35')]}},{'name':_0xefc5('0x36'),'field':'name','foreignKey':_0xefc5('0x37'),'model':_0xefc5('0x38'),'filter':{'field':'type','value':[_0xefc5('0x39')]}},{'name':_0xefc5('0x3a'),'field':_0xefc5('0x30'),'foreignKey':_0xefc5('0x37'),'model':_0xefc5('0x38'),'filter':{'field':'type','value':[_0xefc5('0x3b')]}}];break;case _0xefc5('0x3c'):_0x2220bd[_0xefc5('0x12')]='VoiceMusicOnHold';break;case _0xefc5('0x3d'):_0x2220bd['childModel']=_0xefc5('0x3e');break;case _0xefc5('0x3f'):_0x2220bd[_0xefc5('0x12')]='VoicePrefix';break;case _0xefc5('0x40'):_0x2220bd['childModel']='Campaign';break;case'mailqueues':_0x2220bd[_0xefc5('0x12')]='MailQueue';break;case _0xefc5('0x41'):_0x2220bd['childModel']='MailAccount';break;case _0xefc5('0x42'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x43');break;case _0xefc5('0x44'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x45');break;case _0xefc5('0x46'):_0x2220bd['childModel']='OpenchannelAccount';break;case _0xefc5('0x47'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x48');break;case _0xefc5('0x49'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x4a');break;case _0xefc5('0x4b'):_0x2220bd[_0xefc5('0x12')]='WhatsappQueue';break;case _0xefc5('0x4c'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x4d');break;case _0xefc5('0x4e'):_0x2220bd[_0xefc5('0x12')]='Team';break;case'voicequeues':case _0xefc5('0x4f'):_0x2220bd[_0xefc5('0x12')]='VoiceQueue';if(_0x228771){_0x2220bd['parentSections']=[{'name':_0xefc5('0x36')},{'name':_0xefc5('0x3a')}];}break;case _0xefc5('0x50'):case'agents':case _0xefc5('0x51'):_0x2220bd[_0xefc5('0x12')]='User';if(_0x228771){_0x2220bd[_0xefc5('0x1c')]=[{'name':'Users','filter':{'field':_0xefc5('0x32'),'value':[_0xefc5('0x52'),_0xefc5('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xefc5('0x54'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x55');break;case'salesforceaccounts':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x56');break;case _0xefc5('0x57'):_0x2220bd[_0xefc5('0x12')]='FreshdeskAccount';break;case _0xefc5('0x58'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x59');break;case'deskaccounts':_0x2220bd['childModel']=_0xefc5('0x5a');break;case'zohoaccounts':_0x2220bd[_0xefc5('0x12')]='ZohoAccount';break;case _0xefc5('0x5b'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x31');break;case _0xefc5('0x5c'):_0x2220bd['childModel']=_0xefc5('0x5d');break;case _0xefc5('0x5e'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x5f');break;case _0xefc5('0x60'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x61');break;case _0xefc5('0x62'):_0x2220bd['childModel']=_0xefc5('0x63');break;case'pauses':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x64');break;case'scheduler':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x65');break;case'sounds':_0x2220bd['childModel']='Sound';break;case _0xefc5('0x66'):_0x2220bd['childModel']=_0xefc5('0x67');break;case _0xefc5('0x68'):_0x2220bd['childModel']=_0xefc5('0x69');break;case _0xefc5('0x6a'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x6b');break;case _0xefc5('0x6c'):_0x2220bd[_0xefc5('0x12')]='Trunk';break;case _0xefc5('0x6d'):_0x2220bd['childModel']=_0xefc5('0x6e');break;case _0xefc5('0x6f'):_0x2220bd['childModel']=_0xefc5('0x70');break;case _0xefc5('0x71'):_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x72');_0x2220bd[_0xefc5('0x1c')]=[{'name':_0xefc5('0x73'),'field':'id','foreignKey':_0xefc5('0x74')}];break;case'metrics':_0x2220bd[_0xefc5('0x12')]=_0xefc5('0x75');break;}return _0x2220bd;}function _0x326dcf(_0x1dcca3,_0x292806){var _0x1cb4ea=_0x1dcca3[_0xefc5('0x76')](0x0)[_0xefc5('0x77')]()+_0x1dcca3[_0xefc5('0x78')](0x1);var _0x4e0428={'type':_0x114147[_0xefc5('0x79')][_0xefc5('0x7a')][_0xefc5('0x7b')],'raw':!![]};return new Promise(function(_0x194e9a,_0x370ab3){var _0x4fefca=squel['select']()['field'](_0xefc5('0x7c')+_0x1cb4ea+_0xefc5('0x7d'),'id')[_0xefc5('0x6')](_0xefc5('0x7e'))[_0xefc5('0x7f')](_0xefc5('0x80')+_0x1dcca3+_0xefc5('0x81'),'ui')['where']('ui.UserId\x20=\x20?',_0x292806['id']);return _0x114147[_0xefc5('0x82')][_0xefc5('0x83')](_0x4fefca[_0xefc5('0x84')](),_0x4e0428)[_0xefc5('0x9')](function(_0x3f73bf){_0x292806[_0x1cb4ea+_0xefc5('0x85')]=_0x3f73bf;_0x194e9a(_0x3f73bf);})[_0xefc5('0xc')](function(_0x3f5b1f){_0x370ab3(_0x3f5b1f);});});}return _0x279b02['define'](_0xefc5('0x86'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5aa947){var _0x3c2336=require(_0xefc5('0x87'));var _0x2f4929={'raw':_0x5aa947['query'][_0xefc5('0x88')],'where':{}};var _0x53a78c={};var _0x133a48={'count':0x0,'rows':[]};var _0x296b51=_0x5aa947[_0xefc5('0x83')]['section'];var _0x1b4dff=_0x5aa947[_0xefc5('0x83')][_0xefc5('0x89')]||![];var _0x4c8baf=_0x2df962(_0x296b51,_0x1b4dff);if(!_0x4c8baf[_0xefc5('0x12')])throw new Error(_0xefc5('0x8a')+_0x296b51+'\x27');var _0x53672f=[{'name':_0x296b51}];if(!_[_0xefc5('0x8b')](_0x4c8baf[_0xefc5('0x1c')]))_0x53672f=_0x4c8baf[_0xefc5('0x1c')];var _0x40c600=[];for(var _0x4e3fbb=0x0;_0x4e3fbb<_0x53672f[_0xefc5('0x8c')];_0x4e3fbb++){_0x40c600[_0xefc5('0x8d')](_0x114147[_0xefc5('0x8e')][_0xefc5('0x8f')]({'where':{'userProfileId':_0x5aa947[_0xefc5('0x90')]['id'],'name':_0x53672f[_0x4e3fbb][_0xefc5('0x30')]},'raw':!![]}));}return Promise[_0xefc5('0x91')](_0x40c600)[_0xefc5('0x9')](function(_0x139e90){var _0x33b74d=_[_0xefc5('0x5')](_0x139e90,function(_0x5bb134){return _0x5bb134?_0x5bb134:undefined;});var _0x56595a=_[_0xefc5('0x5')](_0x53672f,[_0xefc5('0x92'),!![]]);var _0x1064e2=_[_0xefc5('0x8b')](_0x33b74d)&&_[_0xefc5('0x8b')](_0x56595a)?null:_[_0xefc5('0x93')](_0x56595a,_0x33b74d);if(!_0x1064e2)return null;var _0x52aff1=[];for(var _0x112165=0x0;_0x112165<_0x1064e2[_0xefc5('0x8c')];_0x112165++){var _0x2cc69e=_[_0xefc5('0x8f')](_0x53672f,function(_0x21c56b){return _0x1064e2[_0x112165]?_0x21c56b[_0xefc5('0x30')]===_0x1064e2[_0x112165][_0xefc5('0x30')]:null;});if(_0x2cc69e){if(_0x1064e2[_0x112165][_0xefc5('0x92')]){_0x52aff1[_0xefc5('0x8d')](_0x4f098e(_0x4c8baf[_0xefc5('0x12')],_0x1064e2[_0x112165]));}else{if(!_0x1064e2[_0x112165][_0xefc5('0x94')]){_0x52aff1[_0xefc5('0x8d')](_0x11c73d(_0x2cc69e,_0x1064e2[_0x112165],_0x4c8baf[_0xefc5('0x12')]));}else{if(_0x2cc69e[_0xefc5('0xd')]){_0x52aff1[_0xefc5('0x8d')](_0x292457(_0x2cc69e,_0x1064e2[_0x112165]));}}}}}return Promise['all'](_0x52aff1);})[_0xefc5('0x9')](function(_0x3d5ca2){var _0x1a8ee8=_0x3d5ca2;var _0x1f2ee4=null;if(_0x1a8ee8){_0x1f2ee4=_0x1a8ee8[_0xefc5('0x8c')]===0x1?_0x1a8ee8[0x0]:null;}if(!_0x1f2ee4&&!_0x1a8ee8)return _0x133a48;var _0x1b4573=_0x114147[_0x4c8baf[_0xefc5('0x12')]][_0xefc5('0x95')];_0x53a78c[_0xefc5('0xd')]=_[_0xefc5('0x96')](_0x1b4573);_0x53a78c[_0xefc5('0x83')]=_[_0xefc5('0x96')](_0x5aa947[_0xefc5('0x83')]);_0x53a78c[_0xefc5('0x97')]=_['intersection'](_0x53a78c[_0xefc5('0xd')],_0x53a78c[_0xefc5('0x83')]);_0x2f4929[_0xefc5('0x98')]=_[_0xefc5('0x99')](_0x53a78c['model'],_0x3c2336[_0xefc5('0x9a')](_0x5aa947['query'][_0xefc5('0x9a')]));_0x2f4929[_0xefc5('0x98')]=_0x2f4929['attributes'][_0xefc5('0x8c')]?_0x2f4929[_0xefc5('0x98')]:_0x53a78c['model'];if(!_0x5aa947[_0xefc5('0x83')][_0xefc5('0x9b')]('nolimit')){_0x2f4929[_0xefc5('0x9c')]=_0x3c2336[_0xefc5('0x9c')](_0x5aa947['query']['limit']);_0x2f4929[_0xefc5('0x9d')]=_0x3c2336[_0xefc5('0x9d')](_0x5aa947[_0xefc5('0x83')]['offset']);}_0x2f4929[_0xefc5('0x9e')]=_0x3c2336['sort'](_0x5aa947['query'][_0xefc5('0x9f')]);_0x2f4929['where']=_0x3c2336['filters'](_[_0xefc5('0xa0')](_0x5aa947[_0xefc5('0x83')],_0x53a78c['filters']));if(_0x5aa947[_0xefc5('0x83')]['filter']){_0x2f4929[_0xefc5('0xa1')]=_[_0xefc5('0xa2')](_0x2f4929['where'],{'$or':_[_0xefc5('0xb')](_0x1b4573,function(_0x41dc05){if(_0x41dc05[_0xefc5('0xf')][_0xefc5('0xa3')]!==_0xefc5('0xa4')){var _0x796d7a={};_0x796d7a[_0x41dc05[_0xefc5('0x6')]]={'$like':'%'+_0x5aa947[_0xefc5('0x83')][_0xefc5('0x5')]+'%'};return _0x796d7a;}})});}var _0x176d23=[];var _0x4d5fc5=null;var _0xca2734={};if(_0x1f2ee4){_0x4d5fc5=_[_0xefc5('0x8f')](_0x53672f,[_0xefc5('0x30'),_0x1f2ee4[_0xefc5('0x30')]]);if(_0x4d5fc5[_0xefc5('0x6')]){_0xca2734={};if(_0x4c8baf[_0xefc5('0x12')]==='AnalyticExtractedReport'){_0xca2734[_0x4d5fc5['foreignKey']]=_[_0xefc5('0xb')](_0x1f2ee4[_0xefc5('0xa')],'id');}else{_0xca2734[_0x4d5fc5[_0xefc5('0xa5')]]=_0x1f2ee4[_0xefc5('0xa')];}_0x176d23['push'](_0xca2734);}else{_0x2f4929[_0xefc5('0xa1')]['id']=_0x1f2ee4[_0xefc5('0xa')];}}else{for(var _0x658c24=0x0;_0x658c24<_0x1a8ee8[_0xefc5('0x8c')];_0x658c24++){_0x4d5fc5=_[_0xefc5('0x8f')](_0x53672f,[_0xefc5('0x30'),_0x1a8ee8[_0x658c24]['name']]);if(_0x4d5fc5[_0xefc5('0x6')]){_0xca2734={};_0xca2734[_0x4d5fc5['foreignKey']]=_0x1a8ee8[_0x658c24][_0xefc5('0xa')];_0x176d23[_0xefc5('0x8d')](_0xca2734);}else{if(!_0x2f4929[_0xefc5('0xa1')]['id'])_0x2f4929[_0xefc5('0xa1')]['id']=[];_0x1a8ee8[_0x658c24][_0xefc5('0xa')]['forEach'](function(_0x125d5b){_0x2f4929['where']['id']['push'](_0x125d5b);});}}}if(!_[_0xefc5('0x8b')](_0x176d23)){_0x2f4929[_0xefc5('0xa1')]=_['merge'](_0x2f4929[_0xefc5('0xa1')],{'$and':{'$or':_0x176d23}});}_0x2f4929=_[_0xefc5('0xa2')]({},_0x2f4929,_0x5aa947['options']);if(_0x1f2ee4&&!_0x1f2ee4[_0xefc5('0x94')]&&_0x4c8baf[_0xefc5('0x12')]==='AnalyticExtractedReport'){if(_0x5aa947[_0xefc5('0x83')][_0xefc5('0xa6')]){_0x2f4929[_0xefc5('0xa7')]=[{'all':!![]}];}return _0x114147[_0x4c8baf[_0xefc5('0x12')]][_0xefc5('0x8')](_0x2f4929)['then'](function(_0x49dc66){var _0x367ee2=[];_0x49dc66[_0xefc5('0xa8')](function(_0xc71a09){var _0x2897cc;switch(_0xc71a09[_0xefc5('0xa9')]){case _0xefc5('0xaa'):_0x2897cc=_['find'](_0x1f2ee4[_0xefc5('0xa')],function(_0x597003){return _0x597003['id']===_0xc71a09[_0xefc5('0x74')]&&_0x597003[_0xefc5('0xf')]===_0xefc5('0xab');});break;case _0xefc5('0xac'):_0x2897cc=_[_0xefc5('0x8f')](_0x1f2ee4['associatedResources'],function(_0x1d00c9){return _0x1d00c9['id']===_0xc71a09[_0xefc5('0x74')]&&_0x1d00c9[_0xefc5('0xf')]===_0xefc5('0xad');});break;}if(_0x2897cc)_0x367ee2[_0xefc5('0x8d')](_0xc71a09);});_0x133a48[_0xefc5('0xae')]=_0x367ee2[_0xefc5('0x8c')];_0x133a48[_0xefc5('0xaf')]=_0x367ee2;return _0x133a48;});}else{if(!_[_0xefc5('0x8b')](_0x5aa947['query']['ids'])){_0x2f4929[_0xefc5('0xa1')]['id']=_0x2f4929['where']['id']?_['intersection'](_0x2f4929[_0xefc5('0xa1')]['id'],_0x5aa947['query'][_0xefc5('0xb0')]):_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb0')];if(_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb1')]){_0x2f4929[_0xefc5('0x9e')]=_0x5aa947['query']['customSorting'];}}if(_0x5aa947[_0xefc5('0x83')]['extraQueryConditions']){_0x2f4929[_0xefc5('0xa1')]=_[_0xefc5('0xa2')](_0x2f4929['where'],{'$and':_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb2')]});}return _0x114147[_0x4c8baf[_0xefc5('0x12')]][_0xefc5('0xae')]({'where':_0x2f4929['where']})['then'](function(_0x5234fe){_0x133a48[_0xefc5('0xae')]=_0x5234fe;if(_0x5aa947['query'][_0xefc5('0xa6')]){if(_0x4c8baf[_0xefc5('0x12')]===_0xefc5('0x1b')){_0x2f4929['include']=[{'model':_0x114147[_0xefc5('0x67')],'as':_0xefc5('0xb3'),'attributes':['id',_0xefc5('0x30'),_0xefc5('0xb4')],'required':_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb5')]?!![]:![]},{'model':_0x114147['Tag'],'as':_0xefc5('0xb6'),'attributes':['id',_0xefc5('0x30'),_0xefc5('0xb4')],'through':_0x5aa947[_0xefc5('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb5')]||undefined}}:{},'required':_0x5aa947[_0xefc5('0x83')][_0xefc5('0xb5')]?!![]:![]}];}else{_0x2f4929['include']=[{'all':!![]}];}}return _0x114147[_0x4c8baf[_0xefc5('0x12')]][_0xefc5('0x8')](_0x2f4929);})[_0xefc5('0x9')](function(_0x5e12f1){_0x133a48[_0xefc5('0xaf')]=_0x5e12f1;if(_0x296b51===_0xefc5('0x2f')&&_0x5aa947[_0xefc5('0x83')]['openTabs']===_0xefc5('0xb7')){var _0x30b811=[];for(var _0x4a6de0=0x0;_0x4a6de0<_0x133a48[_0xefc5('0xaf')][_0xefc5('0x8c')];_0x4a6de0++){_0x30b811['push'](_0x326dcf(_0xefc5('0xb8'),_0x133a48[_0xefc5('0xaf')][_0x4a6de0][_0xefc5('0xb9')]));_0x30b811[_0xefc5('0x8d')](_0x326dcf('sms',_0x133a48[_0xefc5('0xaf')][_0x4a6de0][_0xefc5('0xb9')]));_0x30b811[_0xefc5('0x8d')](_0x326dcf(_0xefc5('0xba'),_0x133a48['rows'][_0x4a6de0][_0xefc5('0xb9')]));_0x30b811[_0xefc5('0x8d')](_0x326dcf(_0xefc5('0xbb'),_0x133a48[_0xefc5('0xaf')][_0x4a6de0][_0xefc5('0xb9')]));_0x30b811[_0xefc5('0x8d')](_0x326dcf(_0xefc5('0xbc'),_0x133a48[_0xefc5('0xaf')][_0x4a6de0][_0xefc5('0xb9')]));_0x30b811[_0xefc5('0x8d')](_0x326dcf(_0xefc5('0xbd'),_0x133a48[_0xefc5('0xaf')][_0x4a6de0][_0xefc5('0xb9')]));}return Promise[_0xefc5('0x91')](_0x30b811)[_0xefc5('0x9')](function(){return _0x133a48;});}return _0x133a48;});}});}}});}; \ No newline at end of file +var _0xc6d9=['nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','default','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','models','filter','field','value','findAll','then','map','catch','model','name','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','squarerecordings','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent','Telephones','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','length','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x3380a7,_0x1442e8){var _0x3bbb39=function(_0x122207){while(--_0x122207){_0x3380a7['push'](_0x3380a7['shift']());}};_0x3bbb39(++_0x1442e8);}(_0xc6d9,0xe4));var _0x9c6d=function(_0x439e06,_0xe6d21c){_0x439e06=_0x439e06-0x0;var _0xaa57c1=_0xc6d9[_0x439e06];return _0xaa57c1;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require('squel');module['exports']=function(_0x54a4ee){var _0x362740=_0x54a4ee[_0x9c6d('0x0')];function _0x5d07d7(_0x57d5e2,_0x7a9bfe){return new Promise(function(_0x8b4f86,_0x33666f){if(!_0x7a9bfe)return _0x8b4f86(null);var _0x48ea16=_0x7a9bfe['filter']?{[_0x7a9bfe[_0x9c6d('0x1')][_0x9c6d('0x2')]]:_0x7a9bfe['filter'][_0x9c6d('0x3')]}:undefined;return _0x362740[_0x57d5e2][_0x9c6d('0x4')]({'where':_0x48ea16,'raw':!![]})[_0x9c6d('0x5')](function(_0x43f8f7){_0x7a9bfe['associatedResources']=_[_0x9c6d('0x6')](_0x43f8f7,'id');_0x8b4f86(_0x7a9bfe);})[_0x9c6d('0x7')](function(_0x5190d0){_0x33666f(_0x5190d0);});});}function _0x2df401(_0x5a716b,_0x2f66ed){return new Promise(function(_0x2a0576,_0x5ca57c){var _0xdfba61=_0x5a716b['filter']?{[_0x5a716b[_0x9c6d('0x1')][_0x9c6d('0x2')]]:_0x5a716b[_0x9c6d('0x1')]['value']}:undefined;return _0x362740[_0x5a716b[_0x9c6d('0x8')]][_0x9c6d('0x4')]({'where':_0xdfba61,'raw':!![]})[_0x9c6d('0x5')](function(_0x535e2e){_0x2f66ed['associatedResources']=_['map'](_0x535e2e,function(_0x3b2259){return _0x3b2259[_0x9c6d('0x9')];});_0x2a0576(_0x2f66ed);})[_0x9c6d('0x7')](function(_0x1ef9ca){_0x5ca57c(_0x1ef9ca);});});}function _0x326e58(_0x637e35,_0xf61dad,_0x44d3df){if(!_0xf61dad)return Promise['resolve'](null);return new Promise(function(_0x2ed01c,_0x321f4c){return _0x362740['UserProfileResource'][_0x9c6d('0x4')]({'where':{'sectionId':_0xf61dad['id']},'raw':!![]})['then'](function(_0x37d89f){if(_0x637e35['field']&&_0x637e35[_0x9c6d('0x2')]!=='id'){_0xf61dad[_0x9c6d('0xa')]=_[_0x9c6d('0x6')](_0x37d89f,function(_0x828501){return _0x828501[_0x637e35[_0x9c6d('0x2')]];});}else{if(_0x44d3df===_0x9c6d('0xb')){_0xf61dad[_0x9c6d('0xa')]=_[_0x9c6d('0x6')](_0x37d89f,function(_0xb1fe75){return{'id':_0xb1fe75[_0x9c6d('0xc')],'type':_0xb1fe75[_0x9c6d('0xd')]};});}else{_0xf61dad[_0x9c6d('0xa')]=_[_0x9c6d('0x6')](_0x37d89f,function(_0x2ed48c){return _0x2ed48c[_0x9c6d('0xc')];});}}_0x2ed01c(_0xf61dad);})[_0x9c6d('0x7')](function(_0x6a2ac2){_0x321f4c(_0x6a2ac2);});});}function _0x34e270(_0x129505,_0x3525f1){var _0x125548={'parentSections':[]};switch(_0x129505[_0x9c6d('0xe')]()){case _0x9c6d('0xf'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x11');break;case'odbc':_0x125548[_0x9c6d('0x10')]='SquareOdbc';break;case _0x9c6d('0x12'):_0x125548[_0x9c6d('0x10')]='SquareRecording';_0x125548['parentSections']=[{'name':_0x9c6d('0x13'),'field':'name','foreignKey':'projectName'}];break;case _0x9c6d('0x14'):_0x125548['childModel']=_0x9c6d('0x15');break;case _0x9c6d('0x16'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x17');_0x125548['parentSections']=[{'name':_0x9c6d('0x18'),'field':'id','foreignKey':_0x9c6d('0x19')}];break;case _0x9c6d('0x1a'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x1b');break;case'companies':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x1c');break;case _0x9c6d('0x1d'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x1e');break;case _0x9c6d('0x1f'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x20');break;case _0x9c6d('0x21'):_0x125548['childModel']=_0x9c6d('0x22');break;case'faxqueues':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x23');break;case'faxaccounts':_0x125548['childModel']=_0x9c6d('0x24');break;case _0x9c6d('0x25'):case'internalroutes':case _0x9c6d('0x26'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x27');break;case _0x9c6d('0x28'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x29');break;case _0x9c6d('0x2a'):_0x125548['childModel']=_0x9c6d('0x2b');break;case _0x9c6d('0x2c'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x2d');_0x125548[_0x9c6d('0x2e')]=[{'name':_0x9c6d('0x2f'),'field':_0x9c6d('0x9'),'foreignKey':_0x9c6d('0x30'),'model':_0x9c6d('0x31'),'filter':{'field':_0x9c6d('0x32'),'value':[_0x9c6d('0x33')]}},{'name':_0x9c6d('0x34'),'field':_0x9c6d('0x9'),'foreignKey':_0x9c6d('0x30'),'model':_0x9c6d('0x31'),'filter':{'field':_0x9c6d('0x32'),'value':['telephone']}},{'name':_0x9c6d('0x35'),'field':'name','foreignKey':'queue','model':_0x9c6d('0x36'),'filter':{'field':_0x9c6d('0xd'),'value':[_0x9c6d('0x37')]}},{'name':_0x9c6d('0x38'),'field':'name','foreignKey':_0x9c6d('0x39'),'model':_0x9c6d('0x36'),'filter':{'field':_0x9c6d('0xd'),'value':[_0x9c6d('0x3a')]}}];break;case'musiconholds':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x3b');break;case _0x9c6d('0x3c'):_0x125548[_0x9c6d('0x10')]='VoiceChanSpy';break;case _0x9c6d('0x3d'):_0x125548['childModel']=_0x9c6d('0x3e');break;case'ivrcampaigns':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x3f');break;case'mailqueues':_0x125548['childModel']=_0x9c6d('0x40');break;case _0x9c6d('0x41'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x42');break;case _0x9c6d('0x43'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x44');break;case _0x9c6d('0x45'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x46');break;case _0x9c6d('0x47'):_0x125548[_0x9c6d('0x10')]='OpenchannelAccount';break;case _0x9c6d('0x48'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x49');break;case'smsaccounts':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x4a');break;case _0x9c6d('0x4b'):_0x125548['childModel']=_0x9c6d('0x4c');break;case _0x9c6d('0x4d'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x4e');break;case'teams':_0x125548['childModel']=_0x9c6d('0x4f');break;case'voicequeues':case _0x9c6d('0x50'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x36');if(_0x3525f1){_0x125548[_0x9c6d('0x2e')]=[{'name':_0x9c6d('0x35')},{'name':_0x9c6d('0x38')}];}break;case _0x9c6d('0x51'):case _0x9c6d('0x52'):case _0x9c6d('0x53'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x31');if(_0x3525f1){_0x125548['parentSections']=[{'name':_0x9c6d('0x54'),'filter':{'field':_0x9c6d('0x32'),'value':[_0x9c6d('0x55'),_0x9c6d('0x56')]},'ignore':!![]},{'name':_0x9c6d('0x2f')},{'name':'Telephones'}];}break;case _0x9c6d('0x57'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x58');break;case'salesforceaccounts':_0x125548['childModel']=_0x9c6d('0x59');break;case'freshdeskaccounts':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x5a');break;case _0x9c6d('0x5b'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x5c');break;case _0x9c6d('0x5d'):_0x125548[_0x9c6d('0x10')]='DeskAccount';break;case _0x9c6d('0x5e'):_0x125548['childModel']=_0x9c6d('0x5f');break;case _0x9c6d('0x60'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x31');break;case _0x9c6d('0x61'):_0x125548['childModel']=_0x9c6d('0x62');break;case _0x9c6d('0x63'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x64');break;case'customdashboards':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x65');break;case _0x9c6d('0x66'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x67');break;case _0x9c6d('0x68'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x69');break;case'scheduler':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x6a');break;case _0x9c6d('0x6b'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x6c');break;case _0x9c6d('0x6d'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x6e');break;case _0x9c6d('0x6f'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x70');break;case _0x9c6d('0x71'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x72');break;case _0x9c6d('0x73'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x74');break;case _0x9c6d('0x75'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x76');break;case _0x9c6d('0x77'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x78');break;case'extractedreports':_0x125548[_0x9c6d('0x10')]=_0x9c6d('0xb');_0x125548['parentSections']=[{'name':_0x9c6d('0x79'),'field':'id','foreignKey':_0x9c6d('0x7a')}];break;case _0x9c6d('0x7b'):_0x125548[_0x9c6d('0x10')]=_0x9c6d('0x7c');break;}return _0x125548;}function _0x4d0978(_0x4b615b,_0xa38405){var _0x2dd306=_0x4b615b[_0x9c6d('0x7d')](0x0)[_0x9c6d('0x7e')]()+_0x4b615b[_0x9c6d('0x7f')](0x1);var _0x20becc={'type':_0x362740[_0x9c6d('0x80')][_0x9c6d('0x81')][_0x9c6d('0x82')],'raw':!![]};return new Promise(function(_0x5e7dad,_0x4b9744){var _0x415f1f=squel[_0x9c6d('0x83')]()[_0x9c6d('0x2')](_0x9c6d('0x84')+_0x2dd306+_0x9c6d('0x85'),'id')[_0x9c6d('0x2')](_0x9c6d('0x86'))['from'](_0x9c6d('0x87')+_0x4b615b+_0x9c6d('0x88'),'ui')[_0x9c6d('0x89')](_0x9c6d('0x8a'),_0xa38405['id']);return _0x362740['sequelize'][_0x9c6d('0x8b')](_0x415f1f[_0x9c6d('0x8c')](),_0x20becc)[_0x9c6d('0x5')](function(_0x187f3f){_0xa38405[_0x2dd306+_0x9c6d('0x8d')]=_0x187f3f;_0x5e7dad(_0x187f3f);})[_0x9c6d('0x7')](function(_0x2db1b1){_0x4b9744(_0x2db1b1);});});}return _0x54a4ee['define'](_0x9c6d('0x8e'),attributes,{'tableName':_0x9c6d('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3c2f8e){var _0x4c5a77=require(_0x9c6d('0x90'));var _0x1371bc={'raw':_0x3c2f8e[_0x9c6d('0x8b')]['raw'],'where':{}};var _0xcfb375={};var _0xb1a6db={'count':0x0,'rows':[]};var _0x8b03ae=_0x3c2f8e['query'][_0x9c6d('0x91')];var _0x2e66be=_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0x92')]||![];var _0x5aef78=_0x34e270(_0x8b03ae,_0x2e66be);if(!_0x5aef78['childModel'])throw new Error(_0x9c6d('0x93')+_0x8b03ae+'\x27');var _0x30c8e5=[{'name':_0x8b03ae}];if(!_[_0x9c6d('0x94')](_0x5aef78[_0x9c6d('0x2e')]))_0x30c8e5=_0x5aef78[_0x9c6d('0x2e')];var _0x1c625f=[];for(var _0x1926e3=0x0;_0x1926e3<_0x30c8e5['length'];_0x1926e3++){_0x1c625f[_0x9c6d('0x95')](_0x362740[_0x9c6d('0x96')][_0x9c6d('0x97')]({'where':{'userProfileId':_0x3c2f8e[_0x9c6d('0x98')]['id'],'name':_0x30c8e5[_0x1926e3][_0x9c6d('0x9')]},'raw':!![]}));}return Promise[_0x9c6d('0x99')](_0x1c625f)[_0x9c6d('0x5')](function(_0x3e2bee){var _0x45b2de=_[_0x9c6d('0x1')](_0x3e2bee,function(_0x382738){return _0x382738?_0x382738:undefined;});var _0x502811=_[_0x9c6d('0x1')](_0x30c8e5,[_0x9c6d('0x9a'),!![]]);var _0x5a86c6=_[_0x9c6d('0x94')](_0x45b2de)&&_[_0x9c6d('0x94')](_0x502811)?null:_['union'](_0x502811,_0x45b2de);if(!_0x5a86c6)return null;var _0x4185d9=[];for(var _0x57a2f1=0x0;_0x57a2f1<_0x5a86c6[_0x9c6d('0x9b')];_0x57a2f1++){var _0x37168e=_[_0x9c6d('0x97')](_0x30c8e5,function(_0x587b0d){return _0x5a86c6[_0x57a2f1]?_0x587b0d['name']===_0x5a86c6[_0x57a2f1][_0x9c6d('0x9')]:null;});if(_0x37168e){if(_0x5a86c6[_0x57a2f1]['ignore']){_0x4185d9[_0x9c6d('0x95')](_0x5d07d7(_0x5aef78[_0x9c6d('0x10')],_0x5a86c6[_0x57a2f1]));}else{if(!_0x5a86c6[_0x57a2f1][_0x9c6d('0x9c')]){_0x4185d9[_0x9c6d('0x95')](_0x326e58(_0x37168e,_0x5a86c6[_0x57a2f1],_0x5aef78[_0x9c6d('0x10')]));}else{if(_0x37168e[_0x9c6d('0x8')]){_0x4185d9['push'](_0x2df401(_0x37168e,_0x5a86c6[_0x57a2f1]));}}}}}return Promise[_0x9c6d('0x99')](_0x4185d9);})[_0x9c6d('0x5')](function(_0x5c71a3){var _0x468402=_0x5c71a3;var _0xe1f6cc=null;if(_0x468402){_0xe1f6cc=_0x468402['length']===0x1?_0x468402[0x0]:null;}if(!_0xe1f6cc&&!_0x468402)return _0xb1a6db;var _0x4b11ad=_0x362740[_0x5aef78['childModel']][_0x9c6d('0x9d')];_0xcfb375[_0x9c6d('0x8')]=_[_0x9c6d('0x9e')](_0x4b11ad);_0xcfb375[_0x9c6d('0x8b')]=_['keys'](_0x3c2f8e['query']);_0xcfb375[_0x9c6d('0x9f')]=_[_0x9c6d('0xa0')](_0xcfb375[_0x9c6d('0x8')],_0xcfb375[_0x9c6d('0x8b')]);_0x1371bc['attributes']=_[_0x9c6d('0xa0')](_0xcfb375[_0x9c6d('0x8')],_0x4c5a77['fields'](_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xa1')]));_0x1371bc['attributes']=_0x1371bc[_0x9c6d('0xa2')][_0x9c6d('0x9b')]?_0x1371bc['attributes']:_0xcfb375[_0x9c6d('0x8')];if(!_0x3c2f8e['query'][_0x9c6d('0xa3')](_0x9c6d('0xa4'))){_0x1371bc[_0x9c6d('0xa5')]=_0x4c5a77[_0x9c6d('0xa5')](_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xa5')]);_0x1371bc[_0x9c6d('0xa6')]=_0x4c5a77['offset'](_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xa6')]);}_0x1371bc['order']=_0x4c5a77['sort'](_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xa7')]);_0x1371bc[_0x9c6d('0x89')]=_0x4c5a77[_0x9c6d('0x9f')](_[_0x9c6d('0xa8')](_0x3c2f8e[_0x9c6d('0x8b')],_0xcfb375[_0x9c6d('0x9f')]));if(_0x3c2f8e['query'][_0x9c6d('0x1')]){_0x1371bc[_0x9c6d('0x89')]=_[_0x9c6d('0xa9')](_0x1371bc[_0x9c6d('0x89')],{'$or':_['map'](_0x4b11ad,function(_0x48fc00){if(_0x48fc00[_0x9c6d('0xd')][_0x9c6d('0xaa')]!==_0x9c6d('0xab')){var _0xf0e44a={};_0xf0e44a[_0x48fc00[_0x9c6d('0x2')]]={'$like':'%'+_0x3c2f8e['query'][_0x9c6d('0x1')]+'%'};return _0xf0e44a;}})});}var _0x32a77d=[];var _0x5c138d=null;var _0x574ed6={};if(_0xe1f6cc){_0x5c138d=_[_0x9c6d('0x97')](_0x30c8e5,['name',_0xe1f6cc[_0x9c6d('0x9')]]);if(_0x5c138d['field']){_0x574ed6={};if(_0x5aef78[_0x9c6d('0x10')]===_0x9c6d('0xb')){_0x574ed6[_0x5c138d[_0x9c6d('0xac')]]=_['map'](_0xe1f6cc[_0x9c6d('0xa')],'id');}else{_0x574ed6[_0x5c138d['foreignKey']]=_0xe1f6cc['associatedResources'];}_0x32a77d[_0x9c6d('0x95')](_0x574ed6);}else{_0x1371bc[_0x9c6d('0x89')]['id']=_0xe1f6cc[_0x9c6d('0xa')];}}else{for(var _0x437ff1=0x0;_0x437ff1<_0x468402[_0x9c6d('0x9b')];_0x437ff1++){_0x5c138d=_[_0x9c6d('0x97')](_0x30c8e5,[_0x9c6d('0x9'),_0x468402[_0x437ff1][_0x9c6d('0x9')]]);if(_0x5c138d[_0x9c6d('0x2')]){_0x574ed6={};_0x574ed6[_0x5c138d['foreignKey']]=_0x468402[_0x437ff1][_0x9c6d('0xa')];_0x32a77d[_0x9c6d('0x95')](_0x574ed6);}else{if(!_0x1371bc[_0x9c6d('0x89')]['id'])_0x1371bc[_0x9c6d('0x89')]['id']=[];_0x468402[_0x437ff1][_0x9c6d('0xa')][_0x9c6d('0xad')](function(_0x34e798){_0x1371bc[_0x9c6d('0x89')]['id'][_0x9c6d('0x95')](_0x34e798);});}}}if(!_[_0x9c6d('0x94')](_0x32a77d)){_0x1371bc['where']=_[_0x9c6d('0xa9')](_0x1371bc[_0x9c6d('0x89')],{'$and':{'$or':_0x32a77d}});}_0x1371bc=_[_0x9c6d('0xa9')]({},_0x1371bc,_0x3c2f8e[_0x9c6d('0xae')]);if(_0xe1f6cc&&!_0xe1f6cc[_0x9c6d('0x9c')]&&_0x5aef78[_0x9c6d('0x10')]===_0x9c6d('0xb')){if(_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xaf')]){_0x1371bc['include']=[{'all':!![]}];}return _0x362740[_0x5aef78[_0x9c6d('0x10')]]['findAll'](_0x1371bc)['then'](function(_0x358531){var _0x26336b=[];_0x358531[_0x9c6d('0xad')](function(_0x4a5127){var _0x1a5723;switch(_0x4a5127['reportType']){case _0x9c6d('0xb0'):_0x1a5723=_[_0x9c6d('0x97')](_0xe1f6cc[_0x9c6d('0xa')],function(_0x1f1e5c){return _0x1f1e5c['id']===_0x4a5127['reportId']&&_0x1f1e5c[_0x9c6d('0xd')]==='DefaultReports';});break;case'custom':_0x1a5723=_[_0x9c6d('0x97')](_0xe1f6cc[_0x9c6d('0xa')],function(_0x5073fb){return _0x5073fb['id']===_0x4a5127[_0x9c6d('0x7a')]&&_0x5073fb[_0x9c6d('0xd')]===_0x9c6d('0xb1');});break;}if(_0x1a5723)_0x26336b[_0x9c6d('0x95')](_0x4a5127);});_0xb1a6db[_0x9c6d('0xb2')]=_0x26336b[_0x9c6d('0x9b')];_0xb1a6db[_0x9c6d('0xb3')]=_0x26336b;return _0xb1a6db;});}else{if(!_[_0x9c6d('0x94')](_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xb4')])){_0x1371bc[_0x9c6d('0x89')]['id']=_0x1371bc[_0x9c6d('0x89')]['id']?_['intersection'](_0x1371bc[_0x9c6d('0x89')]['id'],_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xb4')]):_0x3c2f8e[_0x9c6d('0x8b')]['ids'];if(_0x3c2f8e['query'][_0x9c6d('0xb5')]){_0x1371bc[_0x9c6d('0xb6')]=_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xb5')];}}if(_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xb7')]){_0x1371bc[_0x9c6d('0x89')]=_[_0x9c6d('0xa9')](_0x1371bc[_0x9c6d('0x89')],{'$and':_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xb7')]});}return _0x362740[_0x5aef78[_0x9c6d('0x10')]][_0x9c6d('0xb2')]({'where':_0x1371bc[_0x9c6d('0x89')]})[_0x9c6d('0x5')](function(_0x342715){_0xb1a6db[_0x9c6d('0xb2')]=_0x342715;if(_0x3c2f8e['query'][_0x9c6d('0xaf')]){if(_0x5aef78[_0x9c6d('0x10')]===_0x9c6d('0x17')){_0x1371bc[_0x9c6d('0xb8')]=[{'model':_0x362740['Tag'],'as':_0x9c6d('0xb9'),'attributes':['id',_0x9c6d('0x9'),_0x9c6d('0xba')],'required':_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xbb')]?!![]:![]},{'model':_0x362740[_0x9c6d('0x6e')],'as':_0x9c6d('0xbc'),'attributes':['id',_0x9c6d('0x9'),_0x9c6d('0xba')],'through':_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xbb')]?{'attributes':[],'where':{'TagId':_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xbb')]||undefined}}:{},'required':_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xbb')]?!![]:![]}];}else{_0x1371bc['include']=[{'all':!![]}];}}return _0x362740[_0x5aef78[_0x9c6d('0x10')]][_0x9c6d('0x4')](_0x1371bc);})[_0x9c6d('0x5')](function(_0x225c85){_0xb1a6db[_0x9c6d('0xb3')]=_0x225c85;if(_0x8b03ae==='Agents'&&_0x3c2f8e[_0x9c6d('0x8b')][_0x9c6d('0xbd')]===_0x9c6d('0xbe')){var _0x1d8859=[];for(var _0x57bc74=0x0;_0x57bc74<_0xb1a6db[_0x9c6d('0xb3')][_0x9c6d('0x9b')];_0x57bc74++){_0x1d8859[_0x9c6d('0x95')](_0x4d0978(_0x9c6d('0xbf'),_0xb1a6db['rows'][_0x57bc74]['dataValues']));_0x1d8859[_0x9c6d('0x95')](_0x4d0978('sms',_0xb1a6db[_0x9c6d('0xb3')][_0x57bc74][_0x9c6d('0xc0')]));_0x1d8859[_0x9c6d('0x95')](_0x4d0978('fax',_0xb1a6db[_0x9c6d('0xb3')][_0x57bc74][_0x9c6d('0xc0')]));_0x1d8859[_0x9c6d('0x95')](_0x4d0978(_0x9c6d('0xc1'),_0xb1a6db[_0x9c6d('0xb3')][_0x57bc74][_0x9c6d('0xc0')]));_0x1d8859[_0x9c6d('0x95')](_0x4d0978(_0x9c6d('0xc2'),_0xb1a6db['rows'][_0x57bc74][_0x9c6d('0xc0')]));_0x1d8859[_0x9c6d('0x95')](_0x4d0978(_0x9c6d('0xc3'),_0xb1a6db['rows'][_0x57bc74][_0x9c6d('0xc0')]));}return Promise[_0x9c6d('0x99')](_0x1d8859)[_0x9c6d('0x5')](function(){return _0xb1a6db;});}return _0xb1a6db;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index aca16af..b56aba2 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 _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x3dd3a7,_0x3caa1c){var _0x576101=function(_0x5af65f){while(--_0x5af65f){_0x3dd3a7['push'](_0x3dd3a7['shift']());}};_0x576101(++_0x3caa1c);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('UserProfile,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file +var _0xaf0d=['error','message','UserProfile,\x20%s,\x20%s','catch','util','moment','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x39e9c4,_0x1fcc4a){var _0x2c6ad1=function(_0x2c3b49){while(--_0x2c3b49){_0x39e9c4['push'](_0x39e9c4['shift']());}};_0x2c6ad1(++_0x1fcc4a);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x2b567b,_0x56385c){_0x2b567b=_0x2b567b-0x0;var _0x18003a=_0xaf0d[_0x2b567b];return _0x18003a;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var moment=require(_0xdaf0('0x1'));var BPromise=require('bluebird');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(_0xdaf0('0x2'))(_0xdaf0('0x3'));var config=require(_0xdaf0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xdaf0('0x5')][_0xdaf0('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdaf0('0x7')],{'host':_0xdaf0('0x8'),'port':0x18eb});var socket=require(_0xdaf0('0x9'))(new Redis(config[_0xdaf0('0x7')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x481ee3,_0x59b0b5,_0x137f8e){return new BPromise(function(_0x46af8d,_0x5d41e9){return client[_0xdaf0('0xa')](_0x481ee3,_0x137f8e)[_0xdaf0('0xb')](function(_0x682267){logger[_0xdaf0('0xc')]('UserProfile,\x20%s,\x20%s',_0x59b0b5,_0xdaf0('0xd'));logger[_0xdaf0('0xe')](_0xdaf0('0xf'),_0x59b0b5,'request\x20sent',JSON[_0xdaf0('0x10')](_0x682267));if(_0x682267[_0xdaf0('0x11')]){if(_0x682267['error']['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x59b0b5,_0x682267['error'][_0xdaf0('0x12')]);return _0x5d41e9(_0x682267['error'][_0xdaf0('0x12')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x59b0b5,_0x682267[_0xdaf0('0x11')][_0xdaf0('0x12')]);return _0x46af8d(_0x682267[_0xdaf0('0x11')]['message']);}else{logger[_0xdaf0('0xc')](_0xdaf0('0x13'),_0x59b0b5,_0xdaf0('0xd'));_0x46af8d(_0x682267['result']['message']);}})[_0xdaf0('0x14')](function(_0x2dc79f){logger[_0xdaf0('0x11')](_0xdaf0('0x13'),_0x59b0b5,_0x2dc79f);_0x5d41e9(_0x2dc79f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8fdefd1..439a600 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 _0x9ea6=['register','userProfile:','./userProfile.events','save','update'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x9ea6,0x165));var _0x69ea=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9ea6[_0x8c43de];return _0xa6591b;};'use strict';var UserProfileEvents=require(_0x69ea('0x0'));var events=[_0x69ea('0x1'),'remove',_0x69ea('0x2')];function createListener(_0x10ceca,_0x349032){return function(_0xce5c38){_0x349032['emit'](_0x10ceca,_0xce5c38);};}function removeListener(_0x307d12,_0x3c536d){return function(){UserProfileEvents['removeListener'](_0x307d12,_0x3c536d);};}exports[_0x69ea('0x3')]=function(_0x1c5e1d){for(var _0x4c81e8=0x0,_0x3063b9=events['length'];_0x4c81e8<_0x3063b9;_0x4c81e8++){var _0xaeb23a=events[_0x4c81e8];var _0x41341f=createListener(_0x69ea('0x4')+_0xaeb23a,_0x1c5e1d);UserProfileEvents['on'](_0xaeb23a,_0x41341f);}}; \ No newline at end of file +var _0xb4b4=['emit','removeListener','register','length','./userProfile.events','remove'];(function(_0x2b10ef,_0x465985){var _0x22670d=function(_0x27e05b){while(--_0x27e05b){_0x2b10ef['push'](_0x2b10ef['shift']());}};_0x22670d(++_0x465985);}(_0xb4b4,0xd0));var _0x4b4b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xb4b4[_0x15bc81];return _0x59440e;};'use strict';var UserProfileEvents=require(_0x4b4b('0x0'));var events=['save',_0x4b4b('0x1'),'update'];function createListener(_0x3fae94,_0x24bceb){return function(_0x1ce290){_0x24bceb[_0x4b4b('0x2')](_0x3fae94,_0x1ce290);};}function removeListener(_0x398e17,_0x2ed6ab){return function(){UserProfileEvents[_0x4b4b('0x3')](_0x398e17,_0x2ed6ab);};}exports[_0x4b4b('0x4')]=function(_0x53089c){for(var _0x1fa4d9=0x0,_0x32e16b=events[_0x4b4b('0x5')];_0x1fa4d9<_0x32e16b;_0x1fa4d9++){var _0x3fb951=events[_0x1fa4d9];var _0x58c68d=createListener('userProfile:'+_0x3fb951,_0x53089c);UserProfileEvents['on'](_0x3fb951,_0x58c68d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 01ff70f..6cc7762 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 _0xc1d8=['get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x35731c,_0x5ab1d1){var _0x2f2957=function(_0x2d6583){while(--_0x2d6583){_0x35731c['push'](_0x35731c['shift']());}};_0x2f2957(++_0x5ab1d1);}(_0xc1d8,0x14b));var _0x8c1d=function(_0x487372,_0x435849){_0x487372=_0x487372-0x0;var _0x27fe69=_0xc1d8[_0x487372];return _0x27fe69;};'use strict';var multer=require(_0x8c1d('0x0'));var util=require(_0x8c1d('0x1'));var path=require(_0x8c1d('0x2'));var timeout=require(_0x8c1d('0x3'));var express=require(_0x8c1d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8c1d('0x5'));var interaction=require(_0x8c1d('0x6'));var config=require(_0x8c1d('0x7'));var controller=require(_0x8c1d('0x8'));router[_0x8c1d('0x9')]('/',auth[_0x8c1d('0xa')](),controller['index']);router['get']('/describe',auth[_0x8c1d('0xa')](),controller[_0x8c1d('0xb')]);router[_0x8c1d('0x9')](_0x8c1d('0xc'),auth[_0x8c1d('0xa')](),controller[_0x8c1d('0xd')]);router[_0x8c1d('0xe')]('/',auth[_0x8c1d('0xa')](),controller[_0x8c1d('0xf')]);router[_0x8c1d('0x10')](_0x8c1d('0xc'),auth[_0x8c1d('0xa')](),controller[_0x8c1d('0x11')]);router[_0x8c1d('0x12')](_0x8c1d('0xc'),auth[_0x8c1d('0xa')](),controller['destroy']);module[_0x8c1d('0x13')]=router; \ No newline at end of file +var _0x8312=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0x4c50b3,_0x3c0d14){var _0xff949b=function(_0x2a847a){while(--_0x2a847a){_0x4c50b3['push'](_0x4c50b3['shift']());}};_0xff949b(++_0x3c0d14);}(_0x8312,0x1ba));var _0x2831=function(_0xa7c7f7,_0x58a8a5){_0xa7c7f7=_0xa7c7f7-0x0;var _0x207a4a=_0x8312[_0xa7c7f7];return _0x207a4a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2831('0x0'));var timeout=require(_0x2831('0x1'));var express=require(_0x2831('0x2'));var router=express[_0x2831('0x3')]();var fs_extra=require(_0x2831('0x4'));var auth=require(_0x2831('0x5'));var interaction=require(_0x2831('0x6'));var config=require('../../config/environment');var controller=require(_0x2831('0x7'));router['get']('/',auth[_0x2831('0x8')](),controller['index']);router[_0x2831('0x9')](_0x2831('0xa'),auth[_0x2831('0x8')](),controller[_0x2831('0xb')]);router[_0x2831('0x9')](_0x2831('0xc'),auth[_0x2831('0x8')](),controller[_0x2831('0xd')]);router[_0x2831('0xe')]('/',auth[_0x2831('0x8')](),controller[_0x2831('0xf')]);router[_0x2831('0x10')]('/:id',auth[_0x2831('0x8')](),controller[_0x2831('0x11')]);router['delete'](_0x2831('0xc'),auth[_0x2831('0x8')](),controller['destroy']);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 6f78a37..ee4a52c 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 _0x0333=['STRING','INTEGER','exports'];(function(_0x246e3b,_0x225d3c){var _0x2547d2=function(_0x58bf0e){while(--_0x58bf0e){_0x246e3b['push'](_0x246e3b['shift']());}};_0x2547d2(++_0x225d3c);}(_0x0333,0x179));var _0x3033=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x0333[_0x3817a9];return _0x443f30;};'use strict';var Sequelize=require('sequelize');module[_0x3033('0x0')]={'name':{'type':Sequelize[_0x3033('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3033('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7ebf=['exports','STRING'];(function(_0x3f1ab5,_0x543087){var _0x84160f=function(_0x47f15b){while(--_0x47f15b){_0x3f1ab5['push'](_0x3f1ab5['shift']());}};_0x84160f(++_0x543087);}(_0x7ebf,0xd6));var _0xf7eb=function(_0x4b4391,_0x10134a){_0x4b4391=_0x4b4391-0x0;var _0x50457b=_0x7ebf[_0x4b4391];return _0x50457b;};'use strict';var Sequelize=require('sequelize');module[_0xf7eb('0x0')]={'name':{'type':Sequelize[_0xf7eb('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xf7eb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b10268d..ec4924c 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x2822b8,_0x4f5fa5){var _0x57e882=function(_0x2ed8a2){while(--_0x2ed8a2){_0x2822b8['push'](_0x2822b8['shift']());}};_0x57e882(++_0x4f5fa5);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2882b3,_0x54657c){_0x2882b3=_0x2882b3-0x0;var _0x4414d2=_0xc2c7[_0x2882b3];return _0x4414d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['UserProfileResource'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['UserProfileResource'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x463a56,_0x2105dc){var _0x3377db=function(_0x19101e){while(--_0x19101e){_0x463a56['push'](_0x463a56['shift']());}};_0x3377db(++_0x2105dc);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 81e3f4e..aec2f45 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 _0x79d8=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./userProfileResource.attributes','exports','resourceId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79d8,0xb4));var _0x879d=function(_0x58eb78,_0x5d885b){_0x58eb78=_0x58eb78-0x0;var _0x188c36=_0x79d8[_0x58eb78];return _0x188c36;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var logger=require(_0x879d('0x2'))(_0x879d('0x3'));var moment=require(_0x879d('0x4'));var BPromise=require(_0x879d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x879d('0x6'));var attributes=require(_0x879d('0x7'));module[_0x879d('0x8')]=function(_0x53d525,_0x4fae51){return _0x53d525['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x879d('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa884=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa884,0x182));var _0x4a88=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0xa884[_0x57d370];return _0x550fd2;};'use strict';var _=require('lodash');var util=require(_0x4a88('0x0'));var logger=require(_0x4a88('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4a88('0x2'));var rp=require(_0x4a88('0x3'));var fs=require('fs');var path=require(_0x4a88('0x4'));var rimraf=require(_0x4a88('0x5'));var config=require(_0x4a88('0x6'));var attributes=require(_0x4a88('0x7'));module[_0x4a88('0x8')]=function(_0x50b698,_0x5e360e){return _0x50b698[_0x4a88('0x9')](_0x4a88('0xa'),attributes,{'tableName':_0x4a88('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x4a88('0xc'),_0x4a88('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8181090..4d61548 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 _0x7da4=['jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x540a74,_0xcf97bb){var _0x2800c2=function(_0xf30d32){while(--_0xf30d32){_0x540a74['push'](_0x540a74['shift']());}};_0x2800c2(++_0xcf97bb);}(_0x7da4,0x12b));var _0x47da=function(_0x5ca72a,_0x26c584){_0x5ca72a=_0x5ca72a-0x0;var _0x1aa1fb=_0x7da4[_0x5ca72a];return _0x1aa1fb;};'use strict';var _=require(_0x47da('0x0'));var util=require('util');var moment=require(_0x47da('0x1'));var BPromise=require(_0x47da('0x2'));var rs=require(_0x47da('0x3'));var fs=require('fs');var Redis=require(_0x47da('0x4'));var db=require(_0x47da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47da('0x6'))(_0x47da('0x7'));var config=require(_0x47da('0x8'));var jayson=require(_0x47da('0x9'));var client=jayson[_0x47da('0xa')][_0x47da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f034,_0x2d146d,_0x1d041f){return new BPromise(function(_0x103cae,_0x43efd3){return client[_0x47da('0xc')](_0x48f034,_0x1d041f)['then'](function(_0x58e501){logger[_0x47da('0xd')](_0x47da('0xe'),_0x2d146d,_0x47da('0xf'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2d146d,_0x47da('0xf'),JSON[_0x47da('0x10')](_0x58e501));if(_0x58e501['error']){if(_0x58e501[_0x47da('0x11')][_0x47da('0x12')]===0x1f4){logger['error'](_0x47da('0xe'),_0x2d146d,_0x58e501[_0x47da('0x11')]['message']);return _0x43efd3(_0x58e501['error'][_0x47da('0x13')]);}logger[_0x47da('0x11')](_0x47da('0xe'),_0x2d146d,_0x58e501[_0x47da('0x11')][_0x47da('0x13')]);return _0x103cae(_0x58e501['error'][_0x47da('0x13')]);}else{logger['info'](_0x47da('0xe'),_0x2d146d,_0x47da('0xf'));_0x103cae(_0x58e501[_0x47da('0x14')]['message']);}})[_0x47da('0x15')](function(_0x3633d9){logger[_0x47da('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x2d146d,_0x3633d9);_0x43efd3(_0x3633d9);});});} \ No newline at end of file +var _0x318d=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','then','request\x20sent'];(function(_0x2a3072,_0x33ec23){var _0x1c9e11=function(_0x1a31c5){while(--_0x1a31c5){_0x2a3072['push'](_0x2a3072['shift']());}};_0x1c9e11(++_0x33ec23);}(_0x318d,0xbb));var _0xd318=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x318d[_0x559a80];return _0x42f555;};'use strict';var _=require(_0xd318('0x0'));var util=require(_0xd318('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd318('0x2'));var db=require(_0xd318('0x3'))['db'];var utils=require(_0xd318('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd318('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ed7bd,_0x4332d2,_0x389b09){return new BPromise(function(_0x3f198f,_0x5d2a86){return client['request'](_0x1ed7bd,_0x389b09)[_0xd318('0x6')](function(_0x119453){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4332d2,_0xd318('0x7'));logger[_0xd318('0x8')](_0xd318('0x9'),_0x4332d2,_0xd318('0x7'),JSON['stringify'](_0x119453));if(_0x119453[_0xd318('0xa')]){if(_0x119453[_0xd318('0xa')]['code']===0x1f4){logger['error'](_0xd318('0xb'),_0x4332d2,_0x119453['error'][_0xd318('0xc')]);return _0x5d2a86(_0x119453['error'][_0xd318('0xc')]);}logger['error'](_0xd318('0xb'),_0x4332d2,_0x119453[_0xd318('0xa')][_0xd318('0xc')]);return _0x3f198f(_0x119453[_0xd318('0xa')][_0xd318('0xc')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4332d2,_0xd318('0x7'));_0x3f198f(_0x119453[_0xd318('0xd')]['message']);}})[_0xd318('0xe')](function(_0x558ffe){logger['error'](_0xd318('0xb'),_0x4332d2,_0x558ffe);_0x5d2a86(_0x558ffe);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 18ec443..11a0fd9 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 _0xbdf4=['get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x18d677,_0x5d7115){var _0x171e51=function(_0x307dc6){while(--_0x307dc6){_0x18d677['push'](_0x18d677['shift']());}};_0x171e51(++_0x5d7115);}(_0xbdf4,0x1d9));var _0x4bdf=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xbdf4[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x4bdf('0x0'));var util=require(_0x4bdf('0x1'));var path=require(_0x4bdf('0x2'));var timeout=require(_0x4bdf('0x3'));var express=require(_0x4bdf('0x4'));var router=express[_0x4bdf('0x5')]();var fs_extra=require(_0x4bdf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4bdf('0x7'));var config=require(_0x4bdf('0x8'));var controller=require(_0x4bdf('0x9'));router['get']('/',auth[_0x4bdf('0xa')](),controller['index']);router[_0x4bdf('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x4bdf('0xc')]);router[_0x4bdf('0xb')](_0x4bdf('0xd'),auth['isAuthenticated'](),controller[_0x4bdf('0xe')]);router[_0x4bdf('0xf')]('/',auth[_0x4bdf('0xa')](),controller[_0x4bdf('0x10')]);router[_0x4bdf('0x11')](_0x4bdf('0xd'),auth['isAuthenticated'](),controller[_0x4bdf('0x12')]);router[_0x4bdf('0x13')](_0x4bdf('0xd'),auth['isAuthenticated'](),controller[_0x4bdf('0x14')]);module[_0x4bdf('0x15')]=router; \ No newline at end of file +var _0xef0d=['./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1a6403,_0x1c9252){var _0x26447a=function(_0x9809d3){while(--_0x9809d3){_0x1a6403['push'](_0x1a6403['shift']());}};_0x26447a(++_0x1c9252);}(_0xef0d,0x19a));var _0xdef0=function(_0x1f7b91,_0x56fe5a){_0x1f7b91=_0x1f7b91-0x0;var _0x5f363d=_0xef0d[_0x1f7b91];return _0x5f363d;};'use strict';var multer=require(_0xdef0('0x0'));var util=require(_0xdef0('0x1'));var path=require(_0xdef0('0x2'));var timeout=require(_0xdef0('0x3'));var express=require(_0xdef0('0x4'));var router=express['Router']();var fs_extra=require(_0xdef0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdef0('0x6'));var config=require(_0xdef0('0x7'));var controller=require(_0xdef0('0x8'));router[_0xdef0('0x9')]('/',auth[_0xdef0('0xa')](),controller[_0xdef0('0xb')]);router['get'](_0xdef0('0xc'),auth[_0xdef0('0xa')](),controller[_0xdef0('0xd')]);router[_0xdef0('0x9')]('/:id',auth[_0xdef0('0xa')](),controller[_0xdef0('0xe')]);router[_0xdef0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdef0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdef0('0x11')]);router[_0xdef0('0x12')](_0xdef0('0x13'),auth[_0xdef0('0xa')](),controller[_0xdef0('0x14')]);module[_0xdef0('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0382aeb..af05341 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 _0x757a=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0x757a,0xde));var _0xa757=function(_0x558b03,_0x2da09e){_0x558b03=_0x558b03-0x0;var _0x2d22e9=_0x757a[_0x558b03];return _0x2d22e9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa757('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa757('0x1')],'set':function(_0x1c2932){this[_0xa757('0x3')](_0xa757('0x4'),_0x1c2932?_0x1c2932[_0xa757('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xa757('0x4'))?this[_0xa757('0x6')]('crudPermissions')[_0xa757('0x7')](''):[];}}}; \ No newline at end of file +var _0xa5fa=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x4151be,_0x576cdb){var _0x3e09b2=function(_0x49ec36){while(--_0x49ec36){_0x4151be['push'](_0x4151be['shift']());}};_0x3e09b2(++_0x576cdb);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0xa5fa[_0x200045];return _0x566a8d;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'name':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa5f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa5f('0x1')],'set':function(_0x4d1c8b){this[_0xaa5f('0x4')](_0xaa5f('0x5'),_0x4d1c8b?_0x4d1c8b[_0xaa5f('0x6')](''):[]);},'get':function(){return this[_0xaa5f('0x7')](_0xaa5f('0x5'))?this[_0xaa5f('0x7')](_0xaa5f('0x5'))[_0xaa5f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4cf969d..f9f41a4 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 _0x6f00=['where','pick','filter','type','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','sort'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x6f00,0x9a));var _0x06f0=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x6f00[_0x597484];return _0x218e64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06f0('0x0'));var zipdir=require(_0x06f0('0x1'));var jsonpatch=require(_0x06f0('0x2'));var rp=require(_0x06f0('0x3'));var moment=require(_0x06f0('0x4'));var BPromise=require(_0x06f0('0x5'));var Mustache=require(_0x06f0('0x6'));var util=require(_0x06f0('0x7'));var path=require(_0x06f0('0x8'));var sox=require(_0x06f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06f0('0xa'));var _=require(_0x06f0('0xb'));var squel=require('squel');var crypto=require(_0x06f0('0xc'));var jsforce=require(_0x06f0('0xd'));var deskjs=require(_0x06f0('0xe'));var toCsv=require(_0x06f0('0xf'));var querystring=require(_0x06f0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06f0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x06f0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06f0('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x06f0('0x14'));var db=require(_0x06f0('0x15'))['db'];function respondWithStatusCode(_0x5e56ab,_0x1187b4){_0x1187b4=_0x1187b4||0xcc;return function(_0x58642a){if(_0x58642a){return _0x5e56ab['sendStatus'](_0x1187b4);}return _0x5e56ab[_0x06f0('0x16')](_0x1187b4)[_0x06f0('0x17')]();};}function respondWithResult(_0x47b20e,_0x2857b7){_0x2857b7=_0x2857b7||0xc8;return function(_0x330a21){if(_0x330a21){return _0x47b20e[_0x06f0('0x16')](_0x2857b7)[_0x06f0('0x18')](_0x330a21);}};}function respondWithFilteredResult(_0x4e6694,_0x133306){return function(_0x1b7569){if(_0x1b7569){var _0x1218dc=typeof _0x133306[_0x06f0('0x19')]==='undefined'&&typeof _0x133306['limit']==='undefined';var _0x2c354c=_0x1b7569[_0x06f0('0x1a')];var _0x162bd0=_0x1218dc?0x0:_0x133306[_0x06f0('0x19')];var _0x2c4fac=_0x1218dc?_0x1b7569[_0x06f0('0x1a')]:_0x133306[_0x06f0('0x19')]+_0x133306[_0x06f0('0x1b')];var _0x2198be;if(_0x2c4fac>=_0x2c354c){_0x2c4fac=_0x2c354c;_0x2198be=0xc8;}else{_0x2198be=0xce;}_0x4e6694[_0x06f0('0x16')](_0x2198be);return _0x4e6694[_0x06f0('0x1c')](_0x06f0('0x1d'),_0x162bd0+'-'+_0x2c4fac+'/'+_0x2c354c)['json'](_0x1b7569);}return null;};}function patchUpdates(_0x14162e){return function(_0x1dea6f){try{jsonpatch[_0x06f0('0x1e')](_0x1dea6f,_0x14162e,!![]);}catch(_0x5adcd1){return BPromise[_0x06f0('0x1f')](_0x5adcd1);}return _0x1dea6f['save']();};}function saveUpdates(_0x27f7cc,_0x3ff2a7){return function(_0x4570ff){if(_0x4570ff){return _0x4570ff[_0x06f0('0x20')](_0x27f7cc)[_0x06f0('0x21')](function(_0x22d74c){return _0x22d74c;});}return null;};}function removeEntity(_0x2ce524,_0x3ce061){return function(_0x56c5c3){if(_0x56c5c3){return _0x56c5c3['destroy']()[_0x06f0('0x21')](function(){_0x2ce524[_0x06f0('0x16')](0xcc)[_0x06f0('0x17')]();});}};}function handleEntityNotFound(_0x422f56,_0x19e058){return function(_0x32416b){if(!_0x32416b){_0x422f56[_0x06f0('0x22')](0x194);}return _0x32416b;};}function handleError(_0x526969,_0x2a3367){_0x2a3367=_0x2a3367||0x1f4;return function(_0x3a1430){logger[_0x06f0('0x23')](_0x3a1430[_0x06f0('0x24')]);if(_0x3a1430['name']){delete _0x3a1430[_0x06f0('0x25')];}_0x526969['status'](_0x2a3367)[_0x06f0('0x26')](_0x3a1430);};}exports[_0x06f0('0x27')]=function(_0x1bd8a2,_0x1dbf85){var _0x33cea7={},_0x517a84={},_0x48b329={'count':0x0,'rows':[]};var _0x1fbd01=_[_0x06f0('0x28')](db[_0x06f0('0x29')][_0x06f0('0x2a')],function(_0x3f0bb8){return{'name':_0x3f0bb8['fieldName'],'type':_0x3f0bb8['type'][_0x06f0('0x2b')]};});_0x517a84[_0x06f0('0x2c')]=_[_0x06f0('0x28')](_0x1fbd01,'name');_0x517a84[_0x06f0('0x2d')]=_['keys'](_0x1bd8a2[_0x06f0('0x2d')]);_0x517a84[_0x06f0('0x2e')]=_[_0x06f0('0x2f')](_0x517a84[_0x06f0('0x2c')],_0x517a84[_0x06f0('0x2d')]);_0x33cea7[_0x06f0('0x30')]=_[_0x06f0('0x2f')](_0x517a84[_0x06f0('0x2c')],qs[_0x06f0('0x31')](_0x1bd8a2['query'][_0x06f0('0x31')]));_0x33cea7[_0x06f0('0x30')]=_0x33cea7[_0x06f0('0x30')][_0x06f0('0x32')]?_0x33cea7[_0x06f0('0x30')]:_0x517a84[_0x06f0('0x2c')];if(!_0x1bd8a2[_0x06f0('0x2d')]['hasOwnProperty']('nolimit')){_0x33cea7[_0x06f0('0x1b')]=qs[_0x06f0('0x1b')](_0x1bd8a2[_0x06f0('0x2d')]['limit']);_0x33cea7[_0x06f0('0x19')]=qs['offset'](_0x1bd8a2[_0x06f0('0x2d')][_0x06f0('0x19')]);}_0x33cea7[_0x06f0('0x33')]=qs['sort'](_0x1bd8a2['query'][_0x06f0('0x34')]);_0x33cea7[_0x06f0('0x35')]=qs[_0x06f0('0x2e')](_[_0x06f0('0x36')](_0x1bd8a2['query'],_0x517a84[_0x06f0('0x2e')]),_0x1fbd01);if(_0x1bd8a2['query'][_0x06f0('0x37')]){_0x33cea7[_0x06f0('0x35')]=_['merge'](_0x33cea7[_0x06f0('0x35')],{'$or':_[_0x06f0('0x28')](_0x1fbd01,function(_0x1442a3){if(_0x1442a3[_0x06f0('0x38')]!=='VIRTUAL'){var _0x4ddebb={};_0x4ddebb[_0x1442a3[_0x06f0('0x25')]]={'$like':'%'+_0x1bd8a2[_0x06f0('0x2d')][_0x06f0('0x37')]+'%'};return _0x4ddebb;}})});}_0x33cea7=_['merge']({},_0x33cea7,_0x1bd8a2['options']);var _0x1cce95={'where':_0x33cea7[_0x06f0('0x35')]};return db['UserProfileSection']['count'](_0x1cce95)[_0x06f0('0x21')](function(_0xcdf44c){_0x48b329['count']=_0xcdf44c;if(_0x1bd8a2[_0x06f0('0x2d')][_0x06f0('0x39')]){_0x33cea7['include']=[{'all':!![]}];}return db[_0x06f0('0x29')][_0x06f0('0x3a')](_0x33cea7);})[_0x06f0('0x21')](function(_0x5025e5){_0x48b329[_0x06f0('0x3b')]=_0x5025e5;return _0x48b329;})[_0x06f0('0x21')](respondWithFilteredResult(_0x1dbf85,_0x33cea7))[_0x06f0('0x3c')](handleError(_0x1dbf85,null));};exports[_0x06f0('0x3d')]=function(_0x3b6dfd,_0x107240){var _0x5f5ceb={'raw':![],'where':{'id':_0x3b6dfd[_0x06f0('0x3e')]['id']}},_0x57ec6b={};_0x57ec6b[_0x06f0('0x2c')]=_[_0x06f0('0x3f')](db[_0x06f0('0x29')][_0x06f0('0x2a')]);_0x57ec6b['query']=_[_0x06f0('0x3f')](_0x3b6dfd[_0x06f0('0x2d')]);_0x57ec6b[_0x06f0('0x2e')]=_[_0x06f0('0x2f')](_0x57ec6b['model'],_0x57ec6b['query']);_0x5f5ceb[_0x06f0('0x30')]=_['intersection'](_0x57ec6b['model'],qs[_0x06f0('0x31')](_0x3b6dfd[_0x06f0('0x2d')][_0x06f0('0x31')]));_0x5f5ceb[_0x06f0('0x30')]=_0x5f5ceb[_0x06f0('0x30')][_0x06f0('0x32')]?_0x5f5ceb[_0x06f0('0x30')]:_0x57ec6b[_0x06f0('0x2c')];if(_0x3b6dfd[_0x06f0('0x2d')][_0x06f0('0x39')]){_0x5f5ceb['include']=[{'all':!![]}];}_0x5f5ceb=_['merge']({},_0x5f5ceb,_0x3b6dfd[_0x06f0('0x40')]);return db[_0x06f0('0x29')][_0x06f0('0x41')](_0x5f5ceb)['then'](handleEntityNotFound(_0x107240,null))[_0x06f0('0x21')](respondWithResult(_0x107240,null))['catch'](handleError(_0x107240,null));};exports['create']=function(_0x3f91d9,_0x17695a){return db[_0x06f0('0x29')][_0x06f0('0x42')](_0x3f91d9[_0x06f0('0x43')],{})[_0x06f0('0x21')](respondWithResult(_0x17695a,0xc9))['catch'](handleError(_0x17695a,null));};exports['update']=function(_0x266b31,_0x423e5b){if(_0x266b31[_0x06f0('0x43')]['id']){delete _0x266b31[_0x06f0('0x43')]['id'];}return db[_0x06f0('0x29')]['find']({'where':{'id':_0x266b31[_0x06f0('0x3e')]['id']}})[_0x06f0('0x21')](handleEntityNotFound(_0x423e5b,null))['then'](saveUpdates(_0x266b31[_0x06f0('0x43')],null))['then'](respondWithResult(_0x423e5b,null))['catch'](handleError(_0x423e5b,null));};exports['destroy']=function(_0x3872f9,_0x54509c){return db['UserProfileSection']['find']({'where':{'id':_0x3872f9[_0x06f0('0x3e')]['id']}})[_0x06f0('0x21')](handleEntityNotFound(_0x54509c,null))[_0x06f0('0x21')](removeEntity(_0x54509c,null))['catch'](handleError(_0x54509c,null));};exports[_0x06f0('0x44')]=function(_0x31940c,_0xf497be){return db[_0x06f0('0x29')]['describe']()[_0x06f0('0x21')](respondWithResult(_0xf497be,null))[_0x06f0('0x3c')](handleError(_0xf497be,null));}; \ No newline at end of file +var _0x40c8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','sendStatus','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x37b0df,_0x140c0a){var _0x5e5f9e=function(_0x6ab7ff){while(--_0x6ab7ff){_0x37b0df['push'](_0x37b0df['shift']());}};_0x5e5f9e(++_0x140c0a);}(_0x40c8,0x120));var _0x840c=function(_0x13fb0c,_0x229549){_0x13fb0c=_0x13fb0c-0x0;var _0x169961=_0x40c8[_0x13fb0c];return _0x169961;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x840c('0x0'));var zipdir=require(_0x840c('0x1'));var jsonpatch=require(_0x840c('0x2'));var rp=require(_0x840c('0x3'));var moment=require(_0x840c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x840c('0x5'));var util=require(_0x840c('0x6'));var path=require('path');var sox=require(_0x840c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x840c('0x8'));var _=require('lodash');var squel=require(_0x840c('0x9'));var crypto=require(_0x840c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x840c('0xb'));var toCsv=require(_0x840c('0xc'));var querystring=require(_0x840c('0xd'));var Papa=require(_0x840c('0xe'));var Redis=require('ioredis');var authService=require(_0x840c('0xf'));var qs=require(_0x840c('0x10'));var as=require(_0x840c('0x11'));var hardwareService=require(_0x840c('0x12'));var logger=require(_0x840c('0x13'))(_0x840c('0x14'));var utils=require(_0x840c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x840c('0x16'));var db=require(_0x840c('0x17'))['db'];function respondWithStatusCode(_0x15f068,_0x506163){_0x506163=_0x506163||0xcc;return function(_0x15196c){if(_0x15196c){return _0x15f068['sendStatus'](_0x506163);}return _0x15f068[_0x840c('0x18')](_0x506163)[_0x840c('0x19')]();};}function respondWithResult(_0x573a8c,_0x6abab){_0x6abab=_0x6abab||0xc8;return function(_0x426fda){if(_0x426fda){return _0x573a8c[_0x840c('0x18')](_0x6abab)['json'](_0x426fda);}};}function respondWithFilteredResult(_0x12e0ed,_0x261312){return function(_0x168516){if(_0x168516){var _0x110fc3=typeof _0x261312[_0x840c('0x1a')]===_0x840c('0x1b')&&typeof _0x261312[_0x840c('0x1c')]===_0x840c('0x1b');var _0x3c4d83=_0x168516[_0x840c('0x1d')];var _0x5152f1=_0x110fc3?0x0:_0x261312[_0x840c('0x1a')];var _0x508345=_0x110fc3?_0x168516[_0x840c('0x1d')]:_0x261312[_0x840c('0x1a')]+_0x261312[_0x840c('0x1c')];var _0x16ba5c;if(_0x508345>=_0x3c4d83){_0x508345=_0x3c4d83;_0x16ba5c=0xc8;}else{_0x16ba5c=0xce;}_0x12e0ed[_0x840c('0x18')](_0x16ba5c);return _0x12e0ed[_0x840c('0x1e')](_0x840c('0x1f'),_0x5152f1+'-'+_0x508345+'/'+_0x3c4d83)[_0x840c('0x20')](_0x168516);}return null;};}function patchUpdates(_0x2fda23){return function(_0x3eb279){try{jsonpatch[_0x840c('0x21')](_0x3eb279,_0x2fda23,!![]);}catch(_0x501eb4){return BPromise['reject'](_0x501eb4);}return _0x3eb279['save']();};}function saveUpdates(_0x49b421,_0x2a237e){return function(_0x5c9cdf){if(_0x5c9cdf){return _0x5c9cdf['update'](_0x49b421)[_0x840c('0x22')](function(_0x8fa20a){return _0x8fa20a;});}return null;};}function removeEntity(_0x44b5e7,_0x108967){return function(_0x29f36f){if(_0x29f36f){return _0x29f36f[_0x840c('0x23')]()[_0x840c('0x22')](function(){_0x44b5e7[_0x840c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dca6e,_0x49a818){return function(_0xbf31cd){if(!_0xbf31cd){_0x2dca6e[_0x840c('0x24')](0x194);}return _0xbf31cd;};}function handleError(_0x4871e6,_0xc402c3){_0xc402c3=_0xc402c3||0x1f4;return function(_0x334639){logger[_0x840c('0x25')](_0x334639[_0x840c('0x26')]);if(_0x334639[_0x840c('0x27')]){delete _0x334639[_0x840c('0x27')];}_0x4871e6[_0x840c('0x18')](_0xc402c3)['send'](_0x334639);};}exports[_0x840c('0x28')]=function(_0x29f9e1,_0x417cb6){var _0x5d45ee={},_0x4a65b0={},_0x39cec5={'count':0x0,'rows':[]};var _0x383d24=_['map'](db[_0x840c('0x29')][_0x840c('0x2a')],function(_0x3bebed){return{'name':_0x3bebed[_0x840c('0x2b')],'type':_0x3bebed['type'][_0x840c('0x2c')]};});_0x4a65b0['model']=_['map'](_0x383d24,'name');_0x4a65b0[_0x840c('0x2d')]=_[_0x840c('0x2e')](_0x29f9e1[_0x840c('0x2d')]);_0x4a65b0[_0x840c('0x2f')]=_[_0x840c('0x30')](_0x4a65b0[_0x840c('0x31')],_0x4a65b0[_0x840c('0x2d')]);_0x5d45ee['attributes']=_[_0x840c('0x30')](_0x4a65b0[_0x840c('0x31')],qs['fields'](_0x29f9e1['query'][_0x840c('0x32')]));_0x5d45ee[_0x840c('0x33')]=_0x5d45ee[_0x840c('0x33')][_0x840c('0x34')]?_0x5d45ee[_0x840c('0x33')]:_0x4a65b0[_0x840c('0x31')];if(!_0x29f9e1['query'][_0x840c('0x35')]('nolimit')){_0x5d45ee['limit']=qs['limit'](_0x29f9e1[_0x840c('0x2d')][_0x840c('0x1c')]);_0x5d45ee[_0x840c('0x1a')]=qs[_0x840c('0x1a')](_0x29f9e1['query']['offset']);}_0x5d45ee[_0x840c('0x36')]=qs[_0x840c('0x37')](_0x29f9e1[_0x840c('0x2d')][_0x840c('0x37')]);_0x5d45ee['where']=qs[_0x840c('0x2f')](_[_0x840c('0x38')](_0x29f9e1[_0x840c('0x2d')],_0x4a65b0['filters']),_0x383d24);if(_0x29f9e1[_0x840c('0x2d')][_0x840c('0x39')]){_0x5d45ee[_0x840c('0x3a')]=_[_0x840c('0x3b')](_0x5d45ee[_0x840c('0x3a')],{'$or':_[_0x840c('0x3c')](_0x383d24,function(_0x1ac123){if(_0x1ac123[_0x840c('0x3d')]!==_0x840c('0x3e')){var _0x519f58={};_0x519f58[_0x1ac123['name']]={'$like':'%'+_0x29f9e1[_0x840c('0x2d')][_0x840c('0x39')]+'%'};return _0x519f58;}})});}_0x5d45ee=_['merge']({},_0x5d45ee,_0x29f9e1[_0x840c('0x3f')]);var _0x20c6f6={'where':_0x5d45ee['where']};return db[_0x840c('0x29')][_0x840c('0x1d')](_0x20c6f6)[_0x840c('0x22')](function(_0x2b539f){_0x39cec5[_0x840c('0x1d')]=_0x2b539f;if(_0x29f9e1['query']['includeAll']){_0x5d45ee[_0x840c('0x40')]=[{'all':!![]}];}return db[_0x840c('0x29')][_0x840c('0x41')](_0x5d45ee);})['then'](function(_0x383053){_0x39cec5[_0x840c('0x42')]=_0x383053;return _0x39cec5;})[_0x840c('0x22')](respondWithFilteredResult(_0x417cb6,_0x5d45ee))[_0x840c('0x43')](handleError(_0x417cb6,null));};exports[_0x840c('0x44')]=function(_0x1940a8,_0x315e2b){var _0x4ecc35={'raw':![],'where':{'id':_0x1940a8[_0x840c('0x45')]['id']}},_0x481a1c={};_0x481a1c[_0x840c('0x31')]=_[_0x840c('0x2e')](db[_0x840c('0x29')]['rawAttributes']);_0x481a1c['query']=_[_0x840c('0x2e')](_0x1940a8[_0x840c('0x2d')]);_0x481a1c['filters']=_[_0x840c('0x30')](_0x481a1c[_0x840c('0x31')],_0x481a1c['query']);_0x4ecc35[_0x840c('0x33')]=_[_0x840c('0x30')](_0x481a1c[_0x840c('0x31')],qs[_0x840c('0x32')](_0x1940a8[_0x840c('0x2d')][_0x840c('0x32')]));_0x4ecc35[_0x840c('0x33')]=_0x4ecc35[_0x840c('0x33')][_0x840c('0x34')]?_0x4ecc35['attributes']:_0x481a1c[_0x840c('0x31')];if(_0x1940a8[_0x840c('0x2d')][_0x840c('0x46')]){_0x4ecc35['include']=[{'all':!![]}];}_0x4ecc35=_[_0x840c('0x3b')]({},_0x4ecc35,_0x1940a8['options']);return db[_0x840c('0x29')][_0x840c('0x47')](_0x4ecc35)['then'](handleEntityNotFound(_0x315e2b,null))[_0x840c('0x22')](respondWithResult(_0x315e2b,null))['catch'](handleError(_0x315e2b,null));};exports[_0x840c('0x48')]=function(_0x2358cf,_0x22fab9){return db['UserProfileSection'][_0x840c('0x48')](_0x2358cf[_0x840c('0x49')],{})[_0x840c('0x22')](respondWithResult(_0x22fab9,0xc9))['catch'](handleError(_0x22fab9,null));};exports[_0x840c('0x4a')]=function(_0x246f4c,_0x4eb086){if(_0x246f4c['body']['id']){delete _0x246f4c[_0x840c('0x49')]['id'];}return db[_0x840c('0x29')][_0x840c('0x47')]({'where':{'id':_0x246f4c[_0x840c('0x45')]['id']}})[_0x840c('0x22')](handleEntityNotFound(_0x4eb086,null))[_0x840c('0x22')](saveUpdates(_0x246f4c[_0x840c('0x49')],null))[_0x840c('0x22')](respondWithResult(_0x4eb086,null))[_0x840c('0x43')](handleError(_0x4eb086,null));};exports['destroy']=function(_0x2c7127,_0x170254){return db[_0x840c('0x29')][_0x840c('0x47')]({'where':{'id':_0x2c7127[_0x840c('0x45')]['id']}})[_0x840c('0x22')](handleEntityNotFound(_0x170254,null))['then'](removeEntity(_0x170254,null))[_0x840c('0x43')](handleError(_0x170254,null));};exports['describe']=function(_0x58b1b7,_0x21c9e5){return db[_0x840c('0x29')][_0x840c('0x4b')]()[_0x840c('0x22')](respondWithResult(_0x21c9e5,null))[_0x840c('0x43')](handleError(_0x21c9e5,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fa29d3a..0adcc32 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 _0x2ea6=['./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf6bfb8,_0x2bf703){var _0x18b60e=function(_0x5a70ea){while(--_0x5a70ea){_0xf6bfb8['push'](_0xf6bfb8['shift']());}};_0x18b60e(++_0x2bf703);}(_0x2ea6,0x148));var _0x62ea=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x2ea6[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require(_0x62ea('0x0'));var util=require('util');var logger=require(_0x62ea('0x1'))(_0x62ea('0x2'));var moment=require(_0x62ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x62ea('0x4'));var fs=require('fs');var path=require(_0x62ea('0x5'));var rimraf=require(_0x62ea('0x6'));var config=require(_0x62ea('0x7'));var attributes=require(_0x62ea('0x8'));module['exports']=function(_0x30eaf8,_0x4d0360){return _0x30eaf8[_0x62ea('0x9')](_0x62ea('0xa'),attributes,{'tableName':_0x62ea('0xb'),'paranoid':![],'indexes':[{'name':_0x62ea('0xc'),'fields':[_0x62ea('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcab=['user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x51df37,_0x26b97d){var _0x25d3b6=function(_0x1ae22d){while(--_0x1ae22d){_0x51df37['push'](_0x51df37['shift']());}};_0x25d3b6(++_0x26b97d);}(_0xdcab,0x1e3));var _0xbdca=function(_0x5d6eac,_0x58f870){_0x5d6eac=_0x5d6eac-0x0;var _0x340bbe=_0xdcab[_0x5d6eac];return _0x340bbe;};'use strict';var _=require(_0xbdca('0x0'));var util=require('util');var logger=require(_0xbdca('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbdca('0x2'));var rp=require(_0xbdca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbdca('0x4'));var attributes=require(_0xbdca('0x5'));module[_0xbdca('0x6')]=function(_0x145cd7,_0x215a65){return _0x145cd7[_0xbdca('0x7')](_0xbdca('0x8'),attributes,{'tableName':_0xbdca('0x9'),'paranoid':![],'indexes':[{'name':_0xbdca('0xa'),'fields':[_0xbdca('0xb'),'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 7af227a..5a13639 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 _0x81a5=['info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x528940,_0x7060db){var _0x1f278e=function(_0xc498de){while(--_0xc498de){_0x528940['push'](_0x528940['shift']());}};_0x1f278e(++_0x7060db);}(_0x81a5,0x7b));var _0x581a=function(_0x4ca425,_0x593ea7){_0x4ca425=_0x4ca425-0x0;var _0x3bb307=_0x81a5[_0x4ca425];return _0x3bb307;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x581a('0x0'));var BPromise=require(_0x581a('0x1'));var rs=require(_0x581a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x581a('0x3'))['db'];var utils=require(_0x581a('0x4'));var logger=require('../../config/logger')(_0x581a('0x5'));var config=require(_0x581a('0x6'));var jayson=require(_0x581a('0x7'));var client=jayson['client'][_0x581a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dc2b3,_0x4a2888,_0x500b2d){return new BPromise(function(_0x57a748,_0x3c03bf){return client[_0x581a('0x9')](_0x2dc2b3,_0x500b2d)[_0x581a('0xa')](function(_0x36db87){logger['info'](_0x581a('0xb'),_0x4a2888,_0x581a('0xc'));logger['debug'](_0x581a('0xd'),_0x4a2888,_0x581a('0xc'),JSON['stringify'](_0x36db87));if(_0x36db87[_0x581a('0xe')]){if(_0x36db87['error'][_0x581a('0xf')]===0x1f4){logger[_0x581a('0xe')](_0x581a('0xb'),_0x4a2888,_0x36db87['error']['message']);return _0x3c03bf(_0x36db87[_0x581a('0xe')][_0x581a('0x10')]);}logger[_0x581a('0xe')](_0x581a('0xb'),_0x4a2888,_0x36db87[_0x581a('0xe')]['message']);return _0x57a748(_0x36db87[_0x581a('0xe')]['message']);}else{logger[_0x581a('0x11')](_0x581a('0xb'),_0x4a2888,_0x581a('0xc'));_0x57a748(_0x36db87[_0x581a('0x12')][_0x581a('0x10')]);}})[_0x581a('0x13')](function(_0x46a936){logger[_0x581a('0xe')](_0x581a('0xb'),_0x4a2888,_0x46a936);_0x3c03bf(_0x46a936);});});} \ No newline at end of file +var _0xa010=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserProfileSection,\x20%s,\x20%s','message','info'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa010,0xb2));var _0x0a01=function(_0x8b69e9,_0x1407f9){_0x8b69e9=_0x8b69e9-0x0;var _0x485d2d=_0xa010[_0x8b69e9];return _0x485d2d;};'use strict';var _=require(_0x0a01('0x0'));var util=require(_0x0a01('0x1'));var moment=require(_0x0a01('0x2'));var BPromise=require(_0x0a01('0x3'));var rs=require(_0x0a01('0x4'));var fs=require('fs');var Redis=require(_0x0a01('0x5'));var db=require(_0x0a01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a01('0x7'))(_0x0a01('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a01('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e5a4,_0x5c4850,_0x590eb0){return new BPromise(function(_0x261644,_0x347c08){return client[_0x0a01('0xa')](_0x33e5a4,_0x590eb0)[_0x0a01('0xb')](function(_0x5dbf1b){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x5c4850,'request\x20sent');logger[_0x0a01('0xc')](_0x0a01('0xd'),_0x5c4850,_0x0a01('0xe'),JSON[_0x0a01('0xf')](_0x5dbf1b));if(_0x5dbf1b[_0x0a01('0x10')]){if(_0x5dbf1b[_0x0a01('0x10')]['code']===0x1f4){logger['error'](_0x0a01('0x11'),_0x5c4850,_0x5dbf1b[_0x0a01('0x10')]['message']);return _0x347c08(_0x5dbf1b[_0x0a01('0x10')][_0x0a01('0x12')]);}logger[_0x0a01('0x10')](_0x0a01('0x11'),_0x5c4850,_0x5dbf1b['error'][_0x0a01('0x12')]);return _0x261644(_0x5dbf1b[_0x0a01('0x10')][_0x0a01('0x12')]);}else{logger[_0x0a01('0x13')](_0x0a01('0x11'),_0x5c4850,_0x0a01('0xe'));_0x261644(_0x5dbf1b[_0x0a01('0x14')][_0x0a01('0x12')]);}})[_0x0a01('0x15')](function(_0x4bec15){logger[_0x0a01('0x10')](_0x0a01('0x11'),_0x5c4850,_0x4bec15);_0x347c08(_0x4bec15);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e02cb9c..f52948c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15f0ae,_0x400f3a){var _0x400933=function(_0x11f045){while(--_0x11f045){_0x15f0ae['push'](_0x15f0ae['shift']());}};_0x400933(++_0x400f3a);}(_0xe706,0xa3));var _0x6e70=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0xe706[_0x2755fb];return _0x293f12;};'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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a652a,_0x244ef1){var _0x2b3795=function(_0x33e626){while(--_0x33e626){_0x4a652a['push'](_0x4a652a['shift']());}};_0x2b3795(++_0x244ef1);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e703bc5..a37164f 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 _0xe8c9=['exports','INTEGER','sequelize'];(function(_0x443cde,_0x47db15){var _0xa02426=function(_0x2df3a6){while(--_0x2df3a6){_0x443cde['push'](_0x443cde['shift']());}};_0xa02426(++_0x47db15);}(_0xe8c9,0x77));var _0x9e8c=function(_0x1d1239,_0x359a66){_0x1d1239=_0x1d1239-0x0;var _0x59119d=_0xe8c9[_0x1d1239];return _0x59119d;};'use strict';var Sequelize=require(_0x9e8c('0x0'));module[_0x9e8c('0x1')]={'penalty':{'type':Sequelize[_0x9e8c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2f6=['sequelize','INTEGER'];(function(_0x21388f,_0x11d9e9){var _0x58521b=function(_0x5e84fd){while(--_0x5e84fd){_0x21388f['push'](_0x21388f['shift']());}};_0x58521b(++_0x11d9e9);}(_0xf2f6,0x1f4));var _0x6f2f=function(_0x55863e,_0x51c07a){_0x55863e=_0x55863e-0x0;var _0x1844f1=_0xf2f6[_0x55863e];return _0x1844f1;};'use strict';var Sequelize=require(_0x6f2f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6f2f('0x1')],'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 8d881ea..f5e3fe8 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 _0xe5af=['exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2b2434,_0x5c6530){var _0x4e1dcb=function(_0x20549a){while(--_0x20549a){_0x2b2434['push'](_0x2b2434['shift']());}};_0x4e1dcb(++_0x5c6530);}(_0xe5af,0x9c));var _0xfe5a=function(_0x56eefb,_0x1a1c6d){_0x56eefb=_0x56eefb-0x0;var _0x13ed78=_0xe5af[_0x56eefb];return _0x13ed78;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues'];(function(_0x448267,_0x581a27){var _0x40d0ed=function(_0x3132a9){while(--_0x3132a9){_0x448267['push'](_0x448267['shift']());}};_0x40d0ed(++_0x581a27);}(_0x2d72,0xa8));var _0x22d7=function(_0x1c21cf,_0x22c968){_0x1c21cf=_0x1c21cf-0x0;var _0x4d55d8=_0x2d72[_0x1c21cf];return _0x4d55d8;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 6eb5823..132b5e0 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 _0x1ec4=['jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x392469,_0x1dc2f5){var _0x262a62=function(_0x569a64){while(--_0x569a64){_0x392469['push'](_0x392469['shift']());}};_0x262a62(++_0x1dc2f5);}(_0x1ec4,0x1e7));var _0x41ec=function(_0x1613c1,_0x2be1a4){_0x1613c1=_0x1613c1-0x0;var _0x31d6bc=_0x1ec4[_0x1613c1];return _0x31d6bc;};'use strict';var _=require('lodash');var util=require(_0x41ec('0x0'));var moment=require(_0x41ec('0x1'));var BPromise=require(_0x41ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x41ec('0x4'));var logger=require('../../config/logger')(_0x41ec('0x5'));var config=require(_0x41ec('0x6'));var jayson=require(_0x41ec('0x7'));var client=jayson[_0x41ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe15cc6,_0x237caf,_0x5465ac){return new BPromise(function(_0xe8e6c6,_0x2ac552){return client['request'](_0xe15cc6,_0x5465ac)[_0x41ec('0x9')](function(_0x2388e2){logger[_0x41ec('0xa')](_0x41ec('0xb'),_0x237caf,_0x41ec('0xc'));logger[_0x41ec('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x237caf,'request\x20sent',JSON[_0x41ec('0xe')](_0x2388e2));if(_0x2388e2['error']){if(_0x2388e2[_0x41ec('0xf')][_0x41ec('0x10')]===0x1f4){logger[_0x41ec('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x237caf,_0x2388e2[_0x41ec('0xf')][_0x41ec('0x11')]);return _0x2ac552(_0x2388e2['error'][_0x41ec('0x11')]);}logger['error'](_0x41ec('0xb'),_0x237caf,_0x2388e2[_0x41ec('0xf')][_0x41ec('0x11')]);return _0xe8e6c6(_0x2388e2[_0x41ec('0xf')][_0x41ec('0x11')]);}else{logger[_0x41ec('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x237caf,_0x41ec('0xc'));_0xe8e6c6(_0x2388e2['result'][_0x41ec('0x11')]);}})[_0x41ec('0x12')](function(_0x32b67b){logger[_0x41ec('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x237caf,_0x32b67b);_0x2ac552(_0x32b67b);});});} \ No newline at end of file +var _0xeaf9=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeaf9,0x1b5));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9eaf('0x0'));var util=require(_0x9eaf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9eaf('0x2'));var fs=require('fs');var Redis=require(_0x9eaf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9eaf('0x4'));var logger=require(_0x9eaf('0x5'))('rpc');var config=require(_0x9eaf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9eaf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3aec,_0x2ab0e6,_0x76ab94){return new BPromise(function(_0x3f3028,_0x314fc8){return client['request'](_0x2f3aec,_0x76ab94)[_0x9eaf('0x8')](function(_0x5e81a4){logger[_0x9eaf('0x9')](_0x9eaf('0xa'),_0x2ab0e6,'request\x20sent');logger['debug'](_0x9eaf('0xb'),_0x2ab0e6,_0x9eaf('0xc'),JSON['stringify'](_0x5e81a4));if(_0x5e81a4['error']){if(_0x5e81a4[_0x9eaf('0xd')][_0x9eaf('0xe')]===0x1f4){logger[_0x9eaf('0xd')](_0x9eaf('0xa'),_0x2ab0e6,_0x5e81a4[_0x9eaf('0xd')]['message']);return _0x314fc8(_0x5e81a4[_0x9eaf('0xd')][_0x9eaf('0xf')]);}logger[_0x9eaf('0xd')](_0x9eaf('0xa'),_0x2ab0e6,_0x5e81a4[_0x9eaf('0xd')][_0x9eaf('0xf')]);return _0x3f3028(_0x5e81a4[_0x9eaf('0xd')][_0x9eaf('0xf')]);}else{logger['info'](_0x9eaf('0xa'),_0x2ab0e6,_0x9eaf('0xc'));_0x3f3028(_0x5e81a4[_0x9eaf('0x10')]['message']);}})[_0x9eaf('0x11')](function(_0x413bd0){logger['error'](_0x9eaf('0xa'),_0x2ab0e6,_0x413bd0);_0x314fc8(_0x413bd0);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b60f261..497f8a3 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 _0xe613=['exports','INTEGER'];(function(_0x4d0f63,_0x2cc3a2){var _0x3e23f5=function(_0x34b87a){while(--_0x34b87a){_0x4d0f63['push'](_0x4d0f63['shift']());}};_0x3e23f5(++_0x2cc3a2);}(_0xe613,0xc6));var _0x3e61=function(_0x4fad53,_0x5f39bc){_0x4fad53=_0x4fad53-0x0;var _0x216df0=_0xe613[_0x4fad53];return _0x216df0;};'use strict';var Sequelize=require('sequelize');module[_0x3e61('0x0')]={'UserId':{'type':Sequelize[_0x3e61('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3e61('0x1')]}}; \ No newline at end of file +var _0x84c7=['sequelize','exports','INTEGER'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x84c7,0x6f));var _0x784c=function(_0x398137,_0x3ab42e){_0x398137=_0x398137-0x0;var _0x12076f=_0x84c7[_0x398137];return _0x12076f;};'use strict';var Sequelize=require(_0x784c('0x0'));module[_0x784c('0x1')]={'UserId':{'type':Sequelize[_0x784c('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 ff1e434..7885d0c 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(_0x28f41f,_0x4b1c42){var _0x3c61e8=function(_0x2965c7){while(--_0x2965c7){_0x28f41f['push'](_0x28f41f['shift']());}};_0x3c61e8(++_0x4b1c42);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x33ded7,_0x1e8455){var _0x148de2=function(_0x57ce45){while(--_0x57ce45){_0x33ded7['push'](_0x33ded7['shift']());}};_0x148de2(++_0x1e8455);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 6189297..e71b3ab 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x561a34,_0x3c02c6){var _0x29bd3f=function(_0x1eb9b2){while(--_0x1eb9b2){_0x561a34['push'](_0x561a34['shift']());}};_0x29bd3f(++_0x3c02c6);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x189726,_0x19630a){var _0x2c7370=function(_0x3c16e1){while(--_0x3c16e1){_0x189726['push'](_0x189726['shift']());}};_0x2c7370(++_0x19630a);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2c241c2..c4fd9d8 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe617=['exports','INTEGER','sequelize'];(function(_0x882d75,_0x17a2ca){var _0x4be671=function(_0x32dacd){while(--_0x32dacd){_0x882d75['push'](_0x882d75['shift']());}};_0x4be671(++_0x17a2ca);}(_0xe617,0x17c));var _0x7e61=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe617[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7e61('0x0'));module[_0x7e61('0x1')]={'penalty':{'type':Sequelize[_0x7e61('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd69e=['sequelize','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xd69e,0x1e4));var _0xed69=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xd69e[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xed69('0x0'));module[_0xed69('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 841e8ba..9fe2948 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 _0xf70c=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x55a777,_0x2c95f7){var _0x8ca6a1=function(_0x3cc973){while(--_0x3cc973){_0x55a777['push'](_0x55a777['shift']());}};_0x8ca6a1(++_0x2c95f7);}(_0xf70c,0x16d));var _0xcf70=function(_0x81fe3,_0x337865){_0x81fe3=_0x81fe3-0x0;var _0x529f91=_0xf70c[_0x81fe3];return _0x529f91;};'use strict';var _=require(_0xcf70('0x0'));var util=require(_0xcf70('0x1'));var logger=require(_0xcf70('0x2'))(_0xcf70('0x3'));var moment=require(_0xcf70('0x4'));var BPromise=require('bluebird');var rp=require(_0xcf70('0x5'));var fs=require('fs');var path=require(_0xcf70('0x6'));var rimraf=require(_0xcf70('0x7'));var config=require(_0xcf70('0x8'));var attributes=require(_0xcf70('0x9'));module[_0xcf70('0xa')]=function(_0x200bb9,_0x3e7a39){return _0x200bb9[_0xcf70('0xb')]('UserVoiceQueue',attributes,{'tableName':_0xcf70('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf611=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf611,0xcb));var _0x1f61=function(_0x19cc92,_0x4df512){_0x19cc92=_0x19cc92-0x0;var _0x4c88d4=_0xf611[_0x19cc92];return _0x4c88d4;};'use strict';var _=require(_0x1f61('0x0'));var util=require(_0x1f61('0x1'));var logger=require(_0x1f61('0x2'))(_0x1f61('0x3'));var moment=require(_0x1f61('0x4'));var BPromise=require(_0x1f61('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f61('0x6'));var rimraf=require(_0x1f61('0x7'));var config=require(_0x1f61('0x8'));var attributes=require(_0x1f61('0x9'));module[_0x1f61('0xa')]=function(_0x4a8a67,_0x630edd){return _0x4a8a67['define'](_0x1f61('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 46182c2..49a14b8 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 _0x4e33=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29b084,_0x5d8725){var _0x42edf8=function(_0x25a36a){while(--_0x25a36a){_0x29b084['push'](_0x29b084['shift']());}};_0x42edf8(++_0x5d8725);}(_0x4e33,0x171));var _0x34e3=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x4e33[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require('lodash');var util=require(_0x34e3('0x0'));var moment=require('moment');var BPromise=require(_0x34e3('0x1'));var rs=require(_0x34e3('0x2'));var fs=require('fs');var Redis=require(_0x34e3('0x3'));var db=require(_0x34e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34e3('0x5'))(_0x34e3('0x6'));var config=require(_0x34e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34e3('0x8')][_0x34e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357806,_0x7c0732,_0x5741ea){return new BPromise(function(_0x40fde0,_0xe60316){return client['request'](_0x357806,_0x5741ea)[_0x34e3('0xa')](function(_0x4ef71e){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x7c0732,_0x34e3('0xb'));logger[_0x34e3('0xc')](_0x34e3('0xd'),_0x7c0732,'request\x20sent',JSON[_0x34e3('0xe')](_0x4ef71e));if(_0x4ef71e[_0x34e3('0xf')]){if(_0x4ef71e[_0x34e3('0xf')][_0x34e3('0x10')]===0x1f4){logger[_0x34e3('0xf')](_0x34e3('0x11'),_0x7c0732,_0x4ef71e[_0x34e3('0xf')][_0x34e3('0x12')]);return _0xe60316(_0x4ef71e[_0x34e3('0xf')][_0x34e3('0x12')]);}logger[_0x34e3('0xf')](_0x34e3('0x11'),_0x7c0732,_0x4ef71e[_0x34e3('0xf')][_0x34e3('0x12')]);return _0x40fde0(_0x4ef71e['error']['message']);}else{logger[_0x34e3('0x13')](_0x34e3('0x11'),_0x7c0732,_0x34e3('0xb'));_0x40fde0(_0x4ef71e[_0x34e3('0x14')][_0x34e3('0x12')]);}})[_0x34e3('0x15')](function(_0x3b959e){logger[_0x34e3('0xf')](_0x34e3('0x11'),_0x7c0732,_0x3b959e);_0xe60316(_0x3b959e);});});} \ No newline at end of file +var _0x1c1b=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x137d2f,_0x3b714c){var _0x21664a=function(_0x2d9f76){while(--_0x2d9f76){_0x137d2f['push'](_0x137d2f['shift']());}};_0x21664a(++_0x3b714c);}(_0x1c1b,0xa5));var _0xb1c1=function(_0x26f28b,_0x5d0f30){_0x26f28b=_0x26f28b-0x0;var _0x188aea=_0x1c1b[_0x26f28b];return _0x188aea;};'use strict';var _=require(_0xb1c1('0x0'));var util=require(_0xb1c1('0x1'));var moment=require(_0xb1c1('0x2'));var BPromise=require(_0xb1c1('0x3'));var rs=require(_0xb1c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1c1('0x6'))(_0xb1c1('0x7'));var config=require(_0xb1c1('0x8'));var jayson=require(_0xb1c1('0x9'));var client=jayson[_0xb1c1('0xa')][_0xb1c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x391a9b,_0x528136,_0x41ee71){return new BPromise(function(_0x15482c,_0xb5e705){return client[_0xb1c1('0xc')](_0x391a9b,_0x41ee71)[_0xb1c1('0xd')](function(_0x47ba32){logger[_0xb1c1('0xe')](_0xb1c1('0xf'),_0x528136,'request\x20sent');logger['debug'](_0xb1c1('0x10'),_0x528136,_0xb1c1('0x11'),JSON['stringify'](_0x47ba32));if(_0x47ba32[_0xb1c1('0x12')]){if(_0x47ba32['error'][_0xb1c1('0x13')]===0x1f4){logger[_0xb1c1('0x12')](_0xb1c1('0xf'),_0x528136,_0x47ba32['error'][_0xb1c1('0x14')]);return _0xb5e705(_0x47ba32[_0xb1c1('0x12')]['message']);}logger[_0xb1c1('0x12')](_0xb1c1('0xf'),_0x528136,_0x47ba32[_0xb1c1('0x12')][_0xb1c1('0x14')]);return _0x15482c(_0x47ba32['error']['message']);}else{logger['info'](_0xb1c1('0xf'),_0x528136,_0xb1c1('0x11'));_0x15482c(_0x47ba32[_0xb1c1('0x15')][_0xb1c1('0x14')]);}})[_0xb1c1('0x16')](function(_0x4751ac){logger[_0xb1c1('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x528136,_0x4751ac);_0xb5e705(_0x4751ac);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6745cda..9f8692b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x232eff,_0x3dde93){var _0x1604c7=function(_0x3d497b){while(--_0x3d497b){_0x232eff['push'](_0x232eff['shift']());}};_0x1604c7(++_0x3dde93);}(_0xe706,0xa3));var _0x6e70=function(_0x14eb9e,_0x29fe9e){_0x14eb9e=_0x14eb9e-0x0;var _0x4c59c4=_0xe706[_0x14eb9e];return _0x4c59c4;};'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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xef4b7a,_0x4a4ada){var _0x226bd2=function(_0x3c598d){while(--_0x3c598d){_0xef4b7a['push'](_0xef4b7a['shift']());}};_0x226bd2(++_0x4a4ada);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xcb91[_0x236c89];return _0x3b2a15;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 61a3cf2..1cf7532 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 _0xc541=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5407d0,_0x137a1e){var _0x5cc3fd=function(_0x19aaa3){while(--_0x19aaa3){_0x5407d0['push'](_0x5407d0['shift']());}};_0x5cc3fd(++_0x137a1e);}(_0xc541,0x139));var _0x1c54=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0xc541[_0x547af];return _0x22f7f4;};'use strict';var Sequelize=require(_0x1c54('0x0'));module[_0x1c54('0x1')]={'uniqueid':{'type':Sequelize[_0x1c54('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1c54('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1c54('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1c54('0x4')],'allowNull':![],'unique':_0x1c54('0x5'),'comment':_0x1c54('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1c54('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1c54('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x1c54('0x3')},'penalty':{'type':Sequelize[_0x1c54('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x1c54('0x2')](0xb),'defaultValue':0x0,'comment':_0x1c54('0x3')}}; \ No newline at end of file +var _0x16dc=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x16dc,0x1ef));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc16d('0x0')]={'uniqueid':{'type':Sequelize[_0xc16d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc16d('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc16d('0x3')],'allowNull':![],'unique':_0xc16d('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xc16d('0x3')],'allowNull':![],'unique':_0xc16d('0x4'),'comment':_0xc16d('0x2')},'penalty':{'type':Sequelize[_0xc16d('0x1')](0xb),'defaultValue':0x0,'comment':_0xc16d('0x2')},'paused':{'type':Sequelize[_0xc16d('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f79cf88..feb8aee 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 _0xccbc=['remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0xf01579,_0x914885){var _0x146774=function(_0x57ebfc){while(--_0x57ebfc){_0xf01579['push'](_0xf01579['shift']());}};_0x146774(++_0x914885);}(_0xccbc,0x16c));var _0xcccb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xccbc[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xcccb('0x0'));var UserVoiceQueueRt=require(_0xcccb('0x1'))['db'][_0xcccb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcccb('0x3'),'afterUpdate':'update','afterDestroy':_0xcccb('0x4')};function emitEvent(_0x3e77e3){return function(_0x599150,_0x337641,_0x139d81){UserVoiceQueueRtEvents[_0xcccb('0x5')](_0x3e77e3+':'+_0x599150['id'],_0x599150);UserVoiceQueueRtEvents[_0xcccb('0x5')](_0x3e77e3,_0x599150);_0x139d81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xcccb('0x6')](e,emitEvent(event));}}module[_0xcccb('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7476=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7476,0xfd));var _0x6747=function(_0x38d92b,_0x1be181){_0x38d92b=_0x38d92b-0x0;var _0x56c746=_0x7476[_0x38d92b];return _0x56c746;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x6747('0x0'))['db'][_0x6747('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6747('0x2'),'afterDestroy':_0x6747('0x3')};function emitEvent(_0x186dc1){return function(_0x1e525f,_0xf8c2b2,_0x1e934e){UserVoiceQueueRtEvents[_0x6747('0x4')](_0x186dc1+':'+_0x1e525f['id'],_0x1e525f);UserVoiceQueueRtEvents['emit'](_0x186dc1,_0x1e525f);_0x1e934e(null);};}for(var e in events){if(events[_0x6747('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x6747('0x6')](e,emitEvent(event));}}module[_0x6747('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 043c93e..dae8ef4 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 _0xf14a=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4e188a,_0x292c7f){var _0x49e7fc=function(_0x1dee0d){while(--_0x1dee0d){_0x4e188a['push'](_0x4e188a['shift']());}};_0x49e7fc(++_0x292c7f);}(_0xf14a,0x164));var _0xaf14=function(_0x1bef9c,_0x22c97a){_0x1bef9c=_0x1bef9c-0x0;var _0x232028=_0xf14a[_0x1bef9c];return _0x232028;};'use strict';var _=require(_0xaf14('0x0'));var util=require('util');var logger=require(_0xaf14('0x1'))(_0xaf14('0x2'));var moment=require(_0xaf14('0x3'));var BPromise=require(_0xaf14('0x4'));var rp=require(_0xaf14('0x5'));var fs=require('fs');var path=require(_0xaf14('0x6'));var rimraf=require('rimraf');var config=require(_0xaf14('0x7'));var attributes=require(_0xaf14('0x8'));module[_0xaf14('0x9')]=function(_0x37cef3,_0xa4fe90){return _0x37cef3[_0xaf14('0xa')](_0xaf14('0xb'),attributes,{'tableName':_0xaf14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e2=['rimraf','../../config/environment','define','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x571840,_0x43897e){var _0x1915d7=function(_0x2dafd1){while(--_0x2dafd1){_0x571840['push'](_0x571840['shift']());}};_0x1915d7(++_0x43897e);}(_0x30e2,0x73));var _0x230e=function(_0x52ff44,_0xc827b2){_0x52ff44=_0x52ff44-0x0;var _0x25e5b7=_0x30e2[_0x52ff44];return _0x25e5b7;};'use strict';var _=require(_0x230e('0x0'));var util=require(_0x230e('0x1'));var logger=require(_0x230e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x230e('0x3'));var rp=require(_0x230e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x230e('0x5'));var config=require(_0x230e('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x11d8cb,_0x6166d8){return _0x11d8cb[_0x230e('0x7')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','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 9e3cca6..06625a4 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 _0x8de5=['request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetVoiceQueueRtPauses','findAll','options','sequelize','outboundQueuePauses','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register'];(function(_0x3e3614,_0x1ea1bc){var _0x5295c5=function(_0x50bb27){while(--_0x50bb27){_0x3e3614['push'](_0x3e3614['shift']());}};_0x5295c5(++_0x1ea1bc);}(_0x8de5,0x166));var _0x58de=function(_0x1a6b63,_0x5c6f26){_0x1a6b63=_0x1a6b63-0x0;var _0x3f3cd2=_0x8de5[_0x1a6b63];return _0x3f3cd2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58de('0x0'));var BPromise=require(_0x58de('0x1'));var rs=require(_0x58de('0x2'));var fs=require('fs');var Redis=require(_0x58de('0x3'));var db=require(_0x58de('0x4'))['db'];var utils=require(_0x58de('0x5'));var logger=require(_0x58de('0x6'))(_0x58de('0x7'));var config=require(_0x58de('0x8'));var jayson=require(_0x58de('0x9'));var client=jayson['client'][_0x58de('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x58de('0xb')],{'host':_0x58de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x58de('0xd')](socket);function respondWithRpcPromise(_0x40dffc,_0x475ead,_0x240e33){return new BPromise(function(_0x4cfb24,_0x2c6837){return client[_0x58de('0xe')](_0x40dffc,_0x240e33)[_0x58de('0xf')](function(_0x4fb4dc){logger[_0x58de('0x10')](_0x58de('0x11'),_0x475ead,_0x58de('0x12'));logger[_0x58de('0x13')](_0x58de('0x14'),_0x475ead,'request\x20sent',JSON[_0x58de('0x15')](_0x4fb4dc));if(_0x4fb4dc['error']){if(_0x4fb4dc['error'][_0x58de('0x16')]===0x1f4){logger[_0x58de('0x17')](_0x58de('0x11'),_0x475ead,_0x4fb4dc[_0x58de('0x17')][_0x58de('0x18')]);return _0x2c6837(_0x4fb4dc['error'][_0x58de('0x18')]);}logger[_0x58de('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x475ead,_0x4fb4dc[_0x58de('0x17')][_0x58de('0x18')]);return _0x4cfb24(_0x4fb4dc['error']['message']);}else{logger[_0x58de('0x10')](_0x58de('0x11'),_0x475ead,_0x58de('0x12'));_0x4cfb24(_0x4fb4dc['result'][_0x58de('0x18')]);}})['catch'](function(_0x3227ee){logger[_0x58de('0x17')](_0x58de('0x11'),_0x475ead,_0x3227ee);_0x2c6837(_0x3227ee);});});}exports[_0x58de('0x19')]=function(_0x5b5f17){var _0x5d1145=this;return new Promise(function(_0x5ebfa4,_0x27c7af){return db['UserVoiceQueueRt'][_0x58de('0x1a')]({'raw':_0x5b5f17[_0x58de('0x1b')]?_0x5b5f17['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b5f17[_0x58de('0x1b')]?_0x5b5f17[_0x58de('0x1b')]['where']||null:null,'attributes':[[db[_0x58de('0x1c')]['fn']('COUNT',db[_0x58de('0x1c')]['fn']('IF',db[_0x58de('0x1c')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x58de('0x1d')]]})[_0x58de('0xf')](function(_0x334006){logger['info'](_0x58de('0x19'),_0x5b5f17);logger['debug']('GetVoiceQueueRtPauses',_0x5b5f17,JSON[_0x58de('0x15')](_0x334006));_0x5ebfa4(_0x334006);})[_0x58de('0x1e')](function(_0x2b8f42){logger['error'](_0x58de('0x19'),_0x2b8f42[_0x58de('0x18')],_0x5b5f17);_0x27c7af(_0x5d1145[_0x58de('0x17')](0x1f4,_0x2b8f42['message']));});});}; \ No newline at end of file +var _0x9faa=['COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','raw','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9faa,0x15a));var _0xa9fa=function(_0x4c4d10,_0x385ce5){_0x4c4d10=_0x4c4d10-0x0;var _0x573457=_0x9faa[_0x4c4d10];return _0x573457;};'use strict';var _=require(_0xa9fa('0x0'));var util=require(_0xa9fa('0x1'));var moment=require(_0xa9fa('0x2'));var BPromise=require(_0xa9fa('0x3'));var rs=require(_0xa9fa('0x4'));var fs=require('fs');var Redis=require(_0xa9fa('0x5'));var db=require(_0xa9fa('0x6'))['db'];var utils=require(_0xa9fa('0x7'));var logger=require(_0xa9fa('0x8'))(_0xa9fa('0x9'));var config=require('../../config/environment');var jayson=require(_0xa9fa('0xa'));var client=jayson[_0xa9fa('0xb')][_0xa9fa('0xc')]({'port':0x232a});config[_0xa9fa('0xd')]=_[_0xa9fa('0xe')](config[_0xa9fa('0xd')],{'host':_0xa9fa('0xf'),'port':0x18eb});var socket=require(_0xa9fa('0x10'))(new Redis(config[_0xa9fa('0xd')]));require('./userVoiceQueueRt.socket')[_0xa9fa('0x11')](socket);function respondWithRpcPromise(_0x40e852,_0x3a7ff8,_0x3189af){return new BPromise(function(_0x371a97,_0x467bba){return client['request'](_0x40e852,_0x3189af)[_0xa9fa('0x12')](function(_0x3c3d47){logger[_0xa9fa('0x13')](_0xa9fa('0x14'),_0x3a7ff8,_0xa9fa('0x15'));logger[_0xa9fa('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3a7ff8,_0xa9fa('0x15'),JSON[_0xa9fa('0x17')](_0x3c3d47));if(_0x3c3d47[_0xa9fa('0x18')]){if(_0x3c3d47['error'][_0xa9fa('0x19')]===0x1f4){logger['error'](_0xa9fa('0x14'),_0x3a7ff8,_0x3c3d47[_0xa9fa('0x18')]['message']);return _0x467bba(_0x3c3d47['error'][_0xa9fa('0x1a')]);}logger[_0xa9fa('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3a7ff8,_0x3c3d47[_0xa9fa('0x18')][_0xa9fa('0x1a')]);return _0x371a97(_0x3c3d47[_0xa9fa('0x18')][_0xa9fa('0x1a')]);}else{logger['info'](_0xa9fa('0x14'),_0x3a7ff8,_0xa9fa('0x15'));_0x371a97(_0x3c3d47[_0xa9fa('0x1b')][_0xa9fa('0x1a')]);}})[_0xa9fa('0x1c')](function(_0x2b6159){logger[_0xa9fa('0x18')](_0xa9fa('0x14'),_0x3a7ff8,_0x2b6159);_0x467bba(_0x2b6159);});});}exports['GetVoiceQueueRtPauses']=function(_0x4b290e){var _0x9b8f9e=this;return new Promise(function(_0x4ca2b6,_0x485ada){return db[_0xa9fa('0x1d')][_0xa9fa('0x1e')]({'raw':_0x4b290e['options']?_0x4b290e['options'][_0xa9fa('0x1f')]===undefined?!![]:![]:!![],'where':_0x4b290e[_0xa9fa('0x20')]?_0x4b290e[_0xa9fa('0x20')][_0xa9fa('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0xa9fa('0x22'),db[_0xa9fa('0x23')]['fn']('IF',db['sequelize']['literal'](_0xa9fa('0x24')))),'outboundQueuePauses']]})['then'](function(_0x97acae){logger[_0xa9fa('0x13')]('GetVoiceQueueRtPauses',_0x4b290e);logger[_0xa9fa('0x16')](_0xa9fa('0x25'),_0x4b290e,JSON[_0xa9fa('0x17')](_0x97acae));_0x4ca2b6(_0x97acae);})['catch'](function(_0x15a5ff){logger['error']('GetVoiceQueueRtPauses',_0x15a5ff[_0xa9fa('0x1a')],_0x4b290e);_0x485ada(_0x9b8f9e['error'](0x1f4,_0x15a5ff[_0xa9fa('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ec45a71..ac4ad6c 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 _0x7958=['./userVoiceQueueRt.events','save','update','emit','removeListener','userVoiceQueueRt:'];(function(_0x524899,_0x2a175c){var _0x341147=function(_0x291973){while(--_0x291973){_0x524899['push'](_0x524899['shift']());}};_0x341147(++_0x2a175c);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var UserVoiceQueueRtEvents=require(_0x8795('0x0'));var events=[_0x8795('0x1'),'remove',_0x8795('0x2')];function createListener(_0x3e286f,_0x132a3d){return function(_0xe7546e){_0x132a3d[_0x8795('0x3')](_0x3e286f,_0xe7546e);};}function removeListener(_0x43aff1,_0x347089){return function(){UserVoiceQueueRtEvents[_0x8795('0x4')](_0x43aff1,_0x347089);};}exports['register']=function(_0xed1860){for(var _0x456403=0x0,_0x427ba5=events['length'];_0x456403<_0x427ba5;_0x456403++){var _0x12c15c=events[_0x456403];var _0x4ea71f=createListener(_0x8795('0x5')+_0x12c15c,_0xed1860);UserVoiceQueueRtEvents['on'](_0x12c15c,_0x4ea71f);}}; \ No newline at end of file +var _0x25fa=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x552951,_0x12de95){var _0x2209ba=function(_0x3a3224){while(--_0x3a3224){_0x552951['push'](_0x552951['shift']());}};_0x2209ba(++_0x12de95);}(_0x25fa,0x109));var _0xa25f=function(_0x570813,_0x199240){_0x570813=_0x570813-0x0;var _0x359701=_0x25fa[_0x570813];return _0x359701;};'use strict';var UserVoiceQueueRtEvents=require(_0xa25f('0x0'));var events=['save',_0xa25f('0x1'),_0xa25f('0x2')];function createListener(_0x57e272,_0x408155){return function(_0xb88bd8){_0x408155[_0xa25f('0x3')](_0x57e272,_0xb88bd8);};}function removeListener(_0x4d0b34,_0x4e444d){return function(){UserVoiceQueueRtEvents[_0xa25f('0x4')](_0x4d0b34,_0x4e444d);};}exports['register']=function(_0x2ea9ea){for(var _0x3ab530=0x0,_0x29666d=events[_0xa25f('0x5')];_0x3ab530<_0x29666d;_0x3ab530++){var _0x22982b=events[_0x3ab530];var _0x168907=createListener(_0xa25f('0x6')+_0x22982b,_0x2ea9ea);UserVoiceQueueRtEvents['on'](_0x22982b,_0x168907);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1821d6b..66d6b9b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x404992,_0x58aca1){var _0x384bae=function(_0x2dbc79){while(--_0x2dbc79){_0x404992['push'](_0x404992['shift']());}};_0x384bae(++_0x58aca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5a3d95,_0x16bee6){var _0x2928e9=function(_0x56ed85){while(--_0x56ed85){_0x5a3d95['push'](_0x5a3d95['shift']());}};_0x2928e9(++_0x16bee6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 c16bc0a..de570a5 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 _0xf984=['sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf984,0x193));var _0x4f98=function(_0x3bd961,_0x26f947){_0x3bd961=_0x3bd961-0x0;var _0xbeeb8e=_0xf984[_0x3bd961];return _0xbeeb8e;};'use strict';var Sequelize=require(_0x4f98('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1672=['INTEGER','sequelize','exports'];(function(_0x8102fd,_0x4c86b6){var _0x141024=function(_0x459e56){while(--_0x459e56){_0x8102fd['push'](_0x8102fd['shift']());}};_0x141024(++_0x4c86b6);}(_0x1672,0x121));var _0x2167=function(_0x32be8d,_0x175414){_0x32be8d=_0x32be8d-0x0;var _0x3859e9=_0x1672[_0x32be8d];return _0x3859e9;};'use strict';var Sequelize=require(_0x2167('0x0'));module[_0x2167('0x1')]={'penalty':{'type':Sequelize[_0x2167('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 33b92a7..a623b8c 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 _0x78f8=['user_has_whatsapp_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x42317a,_0x1bcf20){var _0x452d9a=function(_0x5ab918){while(--_0x5ab918){_0x42317a['push'](_0x42317a['shift']());}};_0x452d9a(++_0x1bcf20);}(_0x78f8,0xaa));var _0x878f=function(_0x1982f1,_0x4dcf65){_0x1982f1=_0x1982f1-0x0;var _0x18092f=_0x78f8[_0x1982f1];return _0x18092f;};'use strict';var _=require(_0x878f('0x0'));var util=require(_0x878f('0x1'));var logger=require('../../config/logger')(_0x878f('0x2'));var moment=require('moment');var BPromise=require(_0x878f('0x3'));var rp=require(_0x878f('0x4'));var fs=require('fs');var path=require(_0x878f('0x5'));var rimraf=require(_0x878f('0x6'));var config=require(_0x878f('0x7'));var attributes=require(_0x878f('0x8'));module[_0x878f('0x9')]=function(_0x45c7f5,_0x4c1b33){return _0x45c7f5[_0x878f('0xa')](_0x878f('0xb'),attributes,{'tableName':_0x878f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3de=['UserWhatsappQueue','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x4e9fed,_0x19f4f3){var _0x5c8cc0=function(_0x36116c){while(--_0x36116c){_0x4e9fed['push'](_0x4e9fed['shift']());}};_0x5c8cc0(++_0x19f4f3);}(_0xc3de,0x123));var _0xec3d=function(_0x516c81,_0x2d1b8a){_0x516c81=_0x516c81-0x0;var _0x4e1213=_0xc3de[_0x516c81];return _0x4e1213;};'use strict';var _=require(_0xec3d('0x0'));var util=require(_0xec3d('0x1'));var logger=require(_0xec3d('0x2'))('api');var moment=require(_0xec3d('0x3'));var BPromise=require(_0xec3d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec3d('0x5'));var rimraf=require(_0xec3d('0x6'));var config=require(_0xec3d('0x7'));var attributes=require(_0xec3d('0x8'));module['exports']=function(_0x29c24e,_0x32f2e1){return _0x29c24e['define'](_0xec3d('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 79de4a5..fbe941a 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 _0xcd0d=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xcd0d,0x86));var _0xdcd0=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcd0d[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xdcd0('0x0'));var util=require('util');var moment=require(_0xdcd0('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcd0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcd0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcd0('0x4'))(_0xdcd0('0x5'));var config=require(_0xdcd0('0x6'));var jayson=require(_0xdcd0('0x7'));var client=jayson[_0xdcd0('0x8')][_0xdcd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x858ae3,_0x3cced7,_0x5560f0){return new BPromise(function(_0x496091,_0x428240){return client[_0xdcd0('0xa')](_0x858ae3,_0x5560f0)[_0xdcd0('0xb')](function(_0x109b6c){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x3cced7,_0xdcd0('0xc'));logger[_0xdcd0('0xd')](_0xdcd0('0xe'),_0x3cced7,'request\x20sent',JSON[_0xdcd0('0xf')](_0x109b6c));if(_0x109b6c['error']){if(_0x109b6c[_0xdcd0('0x10')][_0xdcd0('0x11')]===0x1f4){logger[_0xdcd0('0x10')](_0xdcd0('0x12'),_0x3cced7,_0x109b6c[_0xdcd0('0x10')][_0xdcd0('0x13')]);return _0x428240(_0x109b6c[_0xdcd0('0x10')][_0xdcd0('0x13')]);}logger[_0xdcd0('0x10')](_0xdcd0('0x12'),_0x3cced7,_0x109b6c['error'][_0xdcd0('0x13')]);return _0x496091(_0x109b6c[_0xdcd0('0x10')][_0xdcd0('0x13')]);}else{logger['info'](_0xdcd0('0x12'),_0x3cced7,_0xdcd0('0xc'));_0x496091(_0x109b6c[_0xdcd0('0x14')][_0xdcd0('0x13')]);}})[_0xdcd0('0x15')](function(_0x421198){logger[_0xdcd0('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3cced7,_0x421198);_0x428240(_0x421198);});});} \ No newline at end of file +var _0x7262=['client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7262,0x1af));var _0x2726=function(_0x207f2f,_0x43b0f0){_0x207f2f=_0x207f2f-0x0;var _0x1053e8=_0x7262[_0x207f2f];return _0x1053e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2726('0x0'));var rs=require(_0x2726('0x1'));var fs=require('fs');var Redis=require(_0x2726('0x2'));var db=require(_0x2726('0x3'))['db'];var utils=require(_0x2726('0x4'));var logger=require(_0x2726('0x5'))(_0x2726('0x6'));var config=require(_0x2726('0x7'));var jayson=require(_0x2726('0x8'));var client=jayson[_0x2726('0x9')][_0x2726('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc41d32,_0x556717,_0x33220b){return new BPromise(function(_0x394d19,_0x4e8c0e){return client[_0x2726('0xb')](_0xc41d32,_0x33220b)['then'](function(_0x456b4d){logger['info'](_0x2726('0xc'),_0x556717,_0x2726('0xd'));logger[_0x2726('0xe')](_0x2726('0xf'),_0x556717,_0x2726('0xd'),JSON[_0x2726('0x10')](_0x456b4d));if(_0x456b4d[_0x2726('0x11')]){if(_0x456b4d[_0x2726('0x11')][_0x2726('0x12')]===0x1f4){logger[_0x2726('0x11')](_0x2726('0xc'),_0x556717,_0x456b4d[_0x2726('0x11')][_0x2726('0x13')]);return _0x4e8c0e(_0x456b4d['error'][_0x2726('0x13')]);}logger[_0x2726('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x556717,_0x456b4d[_0x2726('0x11')][_0x2726('0x13')]);return _0x394d19(_0x456b4d[_0x2726('0x11')]['message']);}else{logger[_0x2726('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x556717,_0x2726('0xd'));_0x394d19(_0x456b4d[_0x2726('0x15')][_0x2726('0x13')]);}})['catch'](function(_0x4b7be1){logger[_0x2726('0x11')](_0x2726('0xc'),_0x556717,_0x4b7be1);_0x4e8c0e(_0x4b7be1);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b11fe6d..f8489af 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 _0xe914=['get','index','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller'];(function(_0x19fcba,_0x15a33a){var _0x3b28e1=function(_0x477501){while(--_0x477501){_0x19fcba['push'](_0x19fcba['shift']());}};_0x3b28e1(++_0x15a33a);}(_0xe914,0x7f));var _0x4e91=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0xe914[_0x377217];return _0x26258d;};'use strict';var multer=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var path=require('path');var timeout=require(_0x4e91('0x2'));var express=require(_0x4e91('0x3'));var router=express[_0x4e91('0x4')]();var fs_extra=require(_0x4e91('0x5'));var auth=require(_0x4e91('0x6'));var interaction=require(_0x4e91('0x7'));var config=require('../../config/environment');var controller=require(_0x4e91('0x8'));router[_0x4e91('0x9')]('/',auth['isAuthenticated'](),controller[_0x4e91('0xa')]);router[_0x4e91('0x9')](_0x4e91('0xb'),auth[_0x4e91('0xc')](),controller['show']);router['post']('/',auth[_0x4e91('0xc')](),controller['create']);router['put'](_0x4e91('0xb'),auth[_0x4e91('0xc')](),controller[_0x4e91('0xd')]);router[_0x4e91('0xe')]('/:id',auth[_0x4e91('0xc')](),controller[_0x4e91('0xf')]);module[_0x4e91('0x10')]=router; \ No newline at end of file +var _0x13c0=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x2c718a,_0x3f7e23){var _0x32ab8f=function(_0x3149d7){while(--_0x3149d7){_0x2c718a['push'](_0x2c718a['shift']());}};_0x32ab8f(++_0x3f7e23);}(_0x13c0,0x79));var _0x013c=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x13c0[_0x1d30a3];return _0x32bba1;};'use strict';var multer=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var path=require(_0x013c('0x2'));var timeout=require(_0x013c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x013c('0x4'));var interaction=require(_0x013c('0x5'));var config=require(_0x013c('0x6'));var controller=require(_0x013c('0x7'));router[_0x013c('0x8')]('/',auth[_0x013c('0x9')](),controller[_0x013c('0xa')]);router[_0x013c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x013c('0xb')]('/',auth[_0x013c('0x9')](),controller['create']);router[_0x013c('0xc')](_0x013c('0xd'),auth[_0x013c('0x9')](),controller[_0x013c('0xe')]);router[_0x013c('0xf')](_0x013c('0xd'),auth[_0x013c('0x9')](),controller[_0x013c('0x10')]);module[_0x013c('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f60ba97..935aac9 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 _0x7314=['name','sequelize','exports'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x7314,0xc1));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4731('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b65=['name','sequelize','exports','STRING'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x5b65,0x179));var _0x55b6=function(_0x4bfe4e,_0x3bef14){_0x4bfe4e=_0x4bfe4e-0x0;var _0x28a4b4=_0x5b65[_0x4bfe4e];return _0x28a4b4;};'use strict';var Sequelize=require(_0x55b6('0x0'));module[_0x55b6('0x1')]={'name':{'type':Sequelize[_0x55b6('0x2')],'unique':_0x55b6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x55b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c6a07ef..a81cfb9 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 _0xce4e=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','crypto','jsforce','to-csv','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','Content-Range','apply','save','update','destroy','then','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce4e,0x114));var _0xece4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce4e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xece4('0x0'));var rimraf=require(_0xece4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xece4('0x2'));var rp=require(_0xece4('0x3'));var moment=require('moment');var BPromise=require(_0xece4('0x4'));var Mustache=require(_0xece4('0x5'));var util=require('util');var path=require(_0xece4('0x6'));var sox=require(_0xece4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xece4('0x8'));var squel=require('squel');var crypto=require(_0xece4('0x9'));var jsforce=require(_0xece4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xece4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xece4('0xc'));var authService=require(_0xece4('0xd'));var qs=require(_0xece4('0xe'));var as=require(_0xece4('0xf'));var hardwareService=require(_0xece4('0x10'));var logger=require(_0xece4('0x11'))('api');var utils=require(_0xece4('0x12'));var config=require(_0xece4('0x13'));var licenseUtil=require(_0xece4('0x14'));var db=require(_0xece4('0x15'))['db'];function respondWithStatusCode(_0x4979fd,_0x447bfb){_0x447bfb=_0x447bfb||0xcc;return function(_0x885f95){if(_0x885f95){return _0x4979fd['sendStatus'](_0x447bfb);}return _0x4979fd[_0xece4('0x16')](_0x447bfb)[_0xece4('0x17')]();};}function respondWithResult(_0x39023c,_0x573b01){_0x573b01=_0x573b01||0xc8;return function(_0x341a9c){if(_0x341a9c){return _0x39023c[_0xece4('0x16')](_0x573b01)[_0xece4('0x18')](_0x341a9c);}};}function respondWithFilteredResult(_0x39482b,_0x5e8ec7){return function(_0x1a8559){if(_0x1a8559){var _0x3e9120=typeof _0x5e8ec7[_0xece4('0x19')]===_0xece4('0x1a')&&typeof _0x5e8ec7['limit']===_0xece4('0x1a');var _0x59ebf3=_0x1a8559[_0xece4('0x1b')];var _0x27e775=_0x3e9120?0x0:_0x5e8ec7['offset'];var _0x130835=_0x3e9120?_0x1a8559[_0xece4('0x1b')]:_0x5e8ec7[_0xece4('0x19')]+_0x5e8ec7[_0xece4('0x1c')];var _0x5e4728;if(_0x130835>=_0x59ebf3){_0x130835=_0x59ebf3;_0x5e4728=0xc8;}else{_0x5e4728=0xce;}_0x39482b[_0xece4('0x16')](_0x5e4728);return _0x39482b['set'](_0xece4('0x1d'),_0x27e775+'-'+_0x130835+'/'+_0x59ebf3)[_0xece4('0x18')](_0x1a8559);}return null;};}function patchUpdates(_0x163490){return function(_0x8d6d68){try{jsonpatch[_0xece4('0x1e')](_0x8d6d68,_0x163490,!![]);}catch(_0x5011f3){return BPromise['reject'](_0x5011f3);}return _0x8d6d68[_0xece4('0x1f')]();};}function saveUpdates(_0x1818a5,_0x79db64){return function(_0x2594a7){if(_0x2594a7){return _0x2594a7[_0xece4('0x20')](_0x1818a5)['then'](function(_0x11acd6){return _0x11acd6;});}return null;};}function removeEntity(_0x18d26d,_0x1ae291){return function(_0x226c11){if(_0x226c11){return _0x226c11[_0xece4('0x21')]()[_0xece4('0x22')](function(){var _0x5dda2f=_0x226c11['get']({'plain':!![]});var _0x1e258b=_0xece4('0x23');return db[_0xece4('0x24')]['destroy']({'where':{'type':_0x1e258b,'resourceId':_0x5dda2f['id']}})[_0xece4('0x22')](function(){return _0x226c11;});})['then'](function(){_0x18d26d[_0xece4('0x16')](0xcc)[_0xece4('0x17')]();});}};}function handleEntityNotFound(_0x168e78,_0xbf6223){return function(_0x380b54){if(!_0x380b54){_0x168e78['sendStatus'](0x194);}return _0x380b54;};}function handleError(_0xb6dee9,_0x493b7b){_0x493b7b=_0x493b7b||0x1f4;return function(_0x458c6d){logger[_0xece4('0x25')](_0x458c6d[_0xece4('0x26')]);if(_0x458c6d[_0xece4('0x27')]){delete _0x458c6d[_0xece4('0x27')];}_0xb6dee9['status'](_0x493b7b)['send'](_0x458c6d);};}exports[_0xece4('0x28')]=function(_0x433e20,_0x2e2112){var _0x336cf6={},_0x3f1d1b={},_0x25b2fe={'count':0x0,'rows':[]};var _0x5b7fc0=_[_0xece4('0x29')](db[_0xece4('0x2a')][_0xece4('0x2b')],function(_0x1c2bd8){return{'name':_0x1c2bd8[_0xece4('0x2c')],'type':_0x1c2bd8[_0xece4('0x2d')][_0xece4('0x2e')]};});_0x3f1d1b[_0xece4('0x2f')]=_['map'](_0x5b7fc0,_0xece4('0x27'));_0x3f1d1b[_0xece4('0x30')]=_[_0xece4('0x31')](_0x433e20[_0xece4('0x30')]);_0x3f1d1b[_0xece4('0x32')]=_[_0xece4('0x33')](_0x3f1d1b['model'],_0x3f1d1b[_0xece4('0x30')]);_0x336cf6[_0xece4('0x34')]=_['intersection'](_0x3f1d1b[_0xece4('0x2f')],qs[_0xece4('0x35')](_0x433e20[_0xece4('0x30')]['fields']));_0x336cf6['attributes']=_0x336cf6[_0xece4('0x34')][_0xece4('0x36')]?_0x336cf6[_0xece4('0x34')]:_0x3f1d1b[_0xece4('0x2f')];if(!_0x433e20[_0xece4('0x30')][_0xece4('0x37')](_0xece4('0x38'))){_0x336cf6[_0xece4('0x1c')]=qs[_0xece4('0x1c')](_0x433e20[_0xece4('0x30')][_0xece4('0x1c')]);_0x336cf6['offset']=qs[_0xece4('0x19')](_0x433e20[_0xece4('0x30')]['offset']);}_0x336cf6[_0xece4('0x39')]=qs['sort'](_0x433e20[_0xece4('0x30')][_0xece4('0x3a')]);_0x336cf6[_0xece4('0x3b')]=qs[_0xece4('0x32')](_[_0xece4('0x3c')](_0x433e20[_0xece4('0x30')],_0x3f1d1b[_0xece4('0x32')]),_0x5b7fc0);if(_0x433e20[_0xece4('0x30')][_0xece4('0x3d')]){_0x336cf6[_0xece4('0x3b')]=_['merge'](_0x336cf6[_0xece4('0x3b')],{'$or':_[_0xece4('0x29')](_0x5b7fc0,function(_0x2411fe){if(_0x2411fe['type']!==_0xece4('0x3e')){var _0x136f53={};_0x136f53[_0x2411fe[_0xece4('0x27')]]={'$like':'%'+_0x433e20[_0xece4('0x30')][_0xece4('0x3d')]+'%'};return _0x136f53;}})});}_0x336cf6=_[_0xece4('0x3f')]({},_0x336cf6,_0x433e20[_0xece4('0x40')]);var _0x17a737={'where':_0x336cf6[_0xece4('0x3b')]};return db['Variable']['count'](_0x17a737)[_0xece4('0x22')](function(_0x297d5f){_0x25b2fe[_0xece4('0x1b')]=_0x297d5f;if(_0x433e20[_0xece4('0x30')][_0xece4('0x41')]){_0x336cf6[_0xece4('0x42')]=[{'all':!![]}];}return db['Variable'][_0xece4('0x43')](_0x336cf6);})['then'](function(_0x1b16a2){_0x25b2fe['rows']=_0x1b16a2;return _0x25b2fe;})[_0xece4('0x22')](respondWithFilteredResult(_0x2e2112,_0x336cf6))[_0xece4('0x44')](handleError(_0x2e2112,null));};exports[_0xece4('0x45')]=function(_0x29fdaf,_0x2d869c){var _0x5f5d8f={'raw':!![],'where':{'id':_0x29fdaf['params']['id']}},_0x3ea13e={};_0x3ea13e['model']=_[_0xece4('0x31')](db[_0xece4('0x2a')][_0xece4('0x2b')]);_0x3ea13e[_0xece4('0x30')]=_[_0xece4('0x31')](_0x29fdaf[_0xece4('0x30')]);_0x3ea13e[_0xece4('0x32')]=_[_0xece4('0x33')](_0x3ea13e['model'],_0x3ea13e[_0xece4('0x30')]);_0x5f5d8f[_0xece4('0x34')]=_[_0xece4('0x33')](_0x3ea13e['model'],qs[_0xece4('0x35')](_0x29fdaf['query']['fields']));_0x5f5d8f[_0xece4('0x34')]=_0x5f5d8f[_0xece4('0x34')][_0xece4('0x36')]?_0x5f5d8f[_0xece4('0x34')]:_0x3ea13e[_0xece4('0x2f')];if(_0x29fdaf[_0xece4('0x30')][_0xece4('0x41')]){_0x5f5d8f[_0xece4('0x42')]=[{'all':!![]}];}_0x5f5d8f=_[_0xece4('0x3f')]({},_0x5f5d8f,_0x29fdaf[_0xece4('0x40')]);return db[_0xece4('0x2a')][_0xece4('0x46')](_0x5f5d8f)['then'](handleEntityNotFound(_0x2d869c,null))[_0xece4('0x22')](respondWithResult(_0x2d869c,null))[_0xece4('0x44')](handleError(_0x2d869c,null));};exports['create']=function(_0x44ac37,_0x3f3611){return db[_0xece4('0x2a')][_0xece4('0x47')](_0x44ac37[_0xece4('0x48')],{})[_0xece4('0x22')](function(_0x3a0ba2){var _0x5cd013=_0x44ac37[_0xece4('0x49')][_0xece4('0x4a')]({'plain':!![]});if(!_0x5cd013)throw new Error(_0xece4('0x4b'));if(_0x5cd013[_0xece4('0x4c')]===_0xece4('0x49')){var _0x4934a0=_0x3a0ba2[_0xece4('0x4a')]({'plain':!![]});var _0x458ad8=_0xece4('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x458ad8,'userProfileId':_0x5cd013[_0xece4('0x4d')]},'raw':!![]})[_0xece4('0x22')](function(_0x48c0b1){if(_0x48c0b1&&_0x48c0b1[_0xece4('0x4e')]===0x0){return db[_0xece4('0x24')]['create']({'name':_0x4934a0[_0xece4('0x27')],'resourceId':_0x4934a0['id'],'type':_0x48c0b1[_0xece4('0x27')],'sectionId':_0x48c0b1['id']},{})['then'](function(){return _0x3a0ba2;});}else{return _0x3a0ba2;}})[_0xece4('0x44')](function(_0x2013e4){logger[_0xece4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2013e4);throw _0x2013e4;});}return _0x3a0ba2;})[_0xece4('0x22')](respondWithResult(_0x3f3611,0xc9))['catch'](handleError(_0x3f3611,null));};exports['update']=function(_0x5cc0ad,_0x2d9e0d){if(_0x5cc0ad['body']['id']){delete _0x5cc0ad['body']['id'];}return db[_0xece4('0x2a')]['find']({'where':{'id':_0x5cc0ad[_0xece4('0x4f')]['id']}})[_0xece4('0x22')](handleEntityNotFound(_0x2d9e0d,null))[_0xece4('0x22')](saveUpdates(_0x5cc0ad[_0xece4('0x48')],null))['then'](respondWithResult(_0x2d9e0d,null))['catch'](handleError(_0x2d9e0d,null));};exports[_0xece4('0x21')]=function(_0x4705ae,_0x372400){return db['Variable'][_0xece4('0x46')]({'where':{'id':_0x4705ae['params']['id']}})[_0xece4('0x22')](handleEntityNotFound(_0x372400,null))[_0xece4('0x22')](removeEntity(_0x372400,null))[_0xece4('0x44')](handleError(_0x372400,null));}; \ No newline at end of file +var _0x5718=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','end','error','name','send','Variable','rawAttributes','fieldName','key','model','query'];(function(_0x2b78c3,_0x1fffac){var _0x1285f2=function(_0xef0061){while(--_0xef0061){_0x2b78c3['push'](_0x2b78c3['shift']());}};_0x1285f2(++_0x1fffac);}(_0x5718,0x75));var _0x8571=function(_0x48192f,_0x1bbd36){_0x48192f=_0x48192f-0x0;var _0x1c5076=_0x5718[_0x48192f];return _0x1c5076;};'use strict';var emlformat=require(_0x8571('0x0'));var rimraf=require(_0x8571('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8571('0x2'));var rp=require(_0x8571('0x3'));var moment=require('moment');var BPromise=require(_0x8571('0x4'));var Mustache=require(_0x8571('0x5'));var util=require(_0x8571('0x6'));var path=require(_0x8571('0x7'));var sox=require(_0x8571('0x8'));var csv=require(_0x8571('0x9'));var ejs=require(_0x8571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8571('0xb'));var squel=require(_0x8571('0xc'));var crypto=require(_0x8571('0xd'));var jsforce=require(_0x8571('0xe'));var deskjs=require(_0x8571('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8571('0x10'));var Papa=require('papaparse');var Redis=require(_0x8571('0x11'));var authService=require(_0x8571('0x12'));var qs=require(_0x8571('0x13'));var as=require(_0x8571('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8571('0x15'));var utils=require(_0x8571('0x16'));var config=require(_0x8571('0x17'));var licenseUtil=require(_0x8571('0x18'));var db=require(_0x8571('0x19'))['db'];function respondWithStatusCode(_0x52b794,_0x7ebb03){_0x7ebb03=_0x7ebb03||0xcc;return function(_0x309471){if(_0x309471){return _0x52b794[_0x8571('0x1a')](_0x7ebb03);}return _0x52b794[_0x8571('0x1b')](_0x7ebb03)['end']();};}function respondWithResult(_0x5f4af8,_0x241139){_0x241139=_0x241139||0xc8;return function(_0x21a5ea){if(_0x21a5ea){return _0x5f4af8[_0x8571('0x1b')](_0x241139)[_0x8571('0x1c')](_0x21a5ea);}};}function respondWithFilteredResult(_0x16787b,_0x128ea2){return function(_0x388e78){if(_0x388e78){var _0x1aadf4=typeof _0x128ea2['offset']===_0x8571('0x1d')&&typeof _0x128ea2[_0x8571('0x1e')]===_0x8571('0x1d');var _0x3c10a6=_0x388e78['count'];var _0x232615=_0x1aadf4?0x0:_0x128ea2['offset'];var _0x4741f7=_0x1aadf4?_0x388e78[_0x8571('0x1f')]:_0x128ea2[_0x8571('0x20')]+_0x128ea2[_0x8571('0x1e')];var _0x460d06;if(_0x4741f7>=_0x3c10a6){_0x4741f7=_0x3c10a6;_0x460d06=0xc8;}else{_0x460d06=0xce;}_0x16787b[_0x8571('0x1b')](_0x460d06);return _0x16787b['set'](_0x8571('0x21'),_0x232615+'-'+_0x4741f7+'/'+_0x3c10a6)['json'](_0x388e78);}return null;};}function patchUpdates(_0x423ca0){return function(_0x2c8a5b){try{jsonpatch[_0x8571('0x22')](_0x2c8a5b,_0x423ca0,!![]);}catch(_0x14b560){return BPromise[_0x8571('0x23')](_0x14b560);}return _0x2c8a5b[_0x8571('0x24')]();};}function saveUpdates(_0xd91cb5,_0x5b9c02){return function(_0x37d6d4){if(_0x37d6d4){return _0x37d6d4[_0x8571('0x25')](_0xd91cb5)[_0x8571('0x26')](function(_0x4c6d9a){return _0x4c6d9a;});}return null;};}function removeEntity(_0x275a71,_0x2904ee){return function(_0x1ce23c){if(_0x1ce23c){return _0x1ce23c['destroy']()['then'](function(){var _0xa72074=_0x1ce23c[_0x8571('0x27')]({'plain':!![]});var _0x1911c4=_0x8571('0x28');return db[_0x8571('0x29')][_0x8571('0x2a')]({'where':{'type':_0x1911c4,'resourceId':_0xa72074['id']}})[_0x8571('0x26')](function(){return _0x1ce23c;});})[_0x8571('0x26')](function(){_0x275a71[_0x8571('0x1b')](0xcc)[_0x8571('0x2b')]();});}};}function handleEntityNotFound(_0x2a9314,_0x453ef4){return function(_0x24097e){if(!_0x24097e){_0x2a9314['sendStatus'](0x194);}return _0x24097e;};}function handleError(_0x130c39,_0x3524fd){_0x3524fd=_0x3524fd||0x1f4;return function(_0x1d804d){logger[_0x8571('0x2c')](_0x1d804d['stack']);if(_0x1d804d[_0x8571('0x2d')]){delete _0x1d804d[_0x8571('0x2d')];}_0x130c39[_0x8571('0x1b')](_0x3524fd)[_0x8571('0x2e')](_0x1d804d);};}exports['index']=function(_0x2a3557,_0x2b5039){var _0x3fb05c={},_0x4dda12={},_0x14280f={'count':0x0,'rows':[]};var _0x10c040=_['map'](db[_0x8571('0x2f')][_0x8571('0x30')],function(_0x1f8a97){return{'name':_0x1f8a97[_0x8571('0x31')],'type':_0x1f8a97['type'][_0x8571('0x32')]};});_0x4dda12[_0x8571('0x33')]=_['map'](_0x10c040,_0x8571('0x2d'));_0x4dda12[_0x8571('0x34')]=_[_0x8571('0x35')](_0x2a3557[_0x8571('0x34')]);_0x4dda12['filters']=_[_0x8571('0x36')](_0x4dda12[_0x8571('0x33')],_0x4dda12['query']);_0x3fb05c[_0x8571('0x37')]=_[_0x8571('0x36')](_0x4dda12[_0x8571('0x33')],qs[_0x8571('0x38')](_0x2a3557[_0x8571('0x34')][_0x8571('0x38')]));_0x3fb05c[_0x8571('0x37')]=_0x3fb05c[_0x8571('0x37')][_0x8571('0x39')]?_0x3fb05c[_0x8571('0x37')]:_0x4dda12[_0x8571('0x33')];if(!_0x2a3557[_0x8571('0x34')][_0x8571('0x3a')](_0x8571('0x3b'))){_0x3fb05c['limit']=qs[_0x8571('0x1e')](_0x2a3557['query'][_0x8571('0x1e')]);_0x3fb05c[_0x8571('0x20')]=qs[_0x8571('0x20')](_0x2a3557[_0x8571('0x34')]['offset']);}_0x3fb05c[_0x8571('0x3c')]=qs[_0x8571('0x3d')](_0x2a3557['query']['sort']);_0x3fb05c[_0x8571('0x3e')]=qs[_0x8571('0x3f')](_[_0x8571('0x40')](_0x2a3557[_0x8571('0x34')],_0x4dda12['filters']),_0x10c040);if(_0x2a3557[_0x8571('0x34')][_0x8571('0x41')]){_0x3fb05c['where']=_[_0x8571('0x42')](_0x3fb05c[_0x8571('0x3e')],{'$or':_['map'](_0x10c040,function(_0x516878){if(_0x516878['type']!==_0x8571('0x43')){var _0x18f493={};_0x18f493[_0x516878[_0x8571('0x2d')]]={'$like':'%'+_0x2a3557[_0x8571('0x34')]['filter']+'%'};return _0x18f493;}})});}_0x3fb05c=_['merge']({},_0x3fb05c,_0x2a3557[_0x8571('0x44')]);var _0x3b7682={'where':_0x3fb05c[_0x8571('0x3e')]};return db[_0x8571('0x2f')]['count'](_0x3b7682)['then'](function(_0x50af2a){_0x14280f[_0x8571('0x1f')]=_0x50af2a;if(_0x2a3557[_0x8571('0x34')]['includeAll']){_0x3fb05c[_0x8571('0x45')]=[{'all':!![]}];}return db[_0x8571('0x2f')][_0x8571('0x46')](_0x3fb05c);})[_0x8571('0x26')](function(_0xcb51df){_0x14280f[_0x8571('0x47')]=_0xcb51df;return _0x14280f;})[_0x8571('0x26')](respondWithFilteredResult(_0x2b5039,_0x3fb05c))[_0x8571('0x48')](handleError(_0x2b5039,null));};exports[_0x8571('0x49')]=function(_0x2f8f97,_0x4756dd){var _0x2f4897={'raw':!![],'where':{'id':_0x2f8f97[_0x8571('0x4a')]['id']}},_0x3aaeb8={};_0x3aaeb8[_0x8571('0x33')]=_[_0x8571('0x35')](db[_0x8571('0x2f')][_0x8571('0x30')]);_0x3aaeb8[_0x8571('0x34')]=_[_0x8571('0x35')](_0x2f8f97['query']);_0x3aaeb8[_0x8571('0x3f')]=_[_0x8571('0x36')](_0x3aaeb8[_0x8571('0x33')],_0x3aaeb8[_0x8571('0x34')]);_0x2f4897[_0x8571('0x37')]=_[_0x8571('0x36')](_0x3aaeb8[_0x8571('0x33')],qs[_0x8571('0x38')](_0x2f8f97[_0x8571('0x34')][_0x8571('0x38')]));_0x2f4897[_0x8571('0x37')]=_0x2f4897[_0x8571('0x37')]['length']?_0x2f4897[_0x8571('0x37')]:_0x3aaeb8[_0x8571('0x33')];if(_0x2f8f97[_0x8571('0x34')][_0x8571('0x4b')]){_0x2f4897[_0x8571('0x45')]=[{'all':!![]}];}_0x2f4897=_[_0x8571('0x42')]({},_0x2f4897,_0x2f8f97[_0x8571('0x44')]);return db['Variable'][_0x8571('0x4c')](_0x2f4897)[_0x8571('0x26')](handleEntityNotFound(_0x4756dd,null))[_0x8571('0x26')](respondWithResult(_0x4756dd,null))['catch'](handleError(_0x4756dd,null));};exports['create']=function(_0x4a9915,_0xfe69b7){return db[_0x8571('0x2f')][_0x8571('0x4d')](_0x4a9915['body'],{})['then'](function(_0x533a37){var _0x14279d=_0x4a9915[_0x8571('0x4e')][_0x8571('0x27')]({'plain':!![]});if(!_0x14279d)throw new Error(_0x8571('0x4f'));if(_0x14279d[_0x8571('0x50')]===_0x8571('0x4e')){var _0x1c9272=_0x533a37['get']({'plain':!![]});var _0x5ac882=_0x8571('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x5ac882,'userProfileId':_0x14279d[_0x8571('0x51')]},'raw':!![]})['then'](function(_0x14a25d){if(_0x14a25d&&_0x14a25d[_0x8571('0x52')]===0x0){return db['UserProfileResource'][_0x8571('0x4d')]({'name':_0x1c9272[_0x8571('0x2d')],'resourceId':_0x1c9272['id'],'type':_0x14a25d[_0x8571('0x2d')],'sectionId':_0x14a25d['id']},{})['then'](function(){return _0x533a37;});}else{return _0x533a37;}})[_0x8571('0x48')](function(_0x2efdd6){logger['error'](_0x8571('0x53'),_0x2efdd6);throw _0x2efdd6;});}return _0x533a37;})[_0x8571('0x26')](respondWithResult(_0xfe69b7,0xc9))[_0x8571('0x48')](handleError(_0xfe69b7,null));};exports['update']=function(_0x535726,_0x482dee){if(_0x535726[_0x8571('0x54')]['id']){delete _0x535726[_0x8571('0x54')]['id'];}return db['Variable']['find']({'where':{'id':_0x535726[_0x8571('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482dee,null))[_0x8571('0x26')](saveUpdates(_0x535726[_0x8571('0x54')],null))['then'](respondWithResult(_0x482dee,null))[_0x8571('0x48')](handleError(_0x482dee,null));};exports['destroy']=function(_0x5866a4,_0x2f3065){return db['Variable'][_0x8571('0x4c')]({'where':{'id':_0x5866a4['params']['id']}})[_0x8571('0x26')](handleEntityNotFound(_0x2f3065,null))[_0x8571('0x26')](removeEntity(_0x2f3065,null))[_0x8571('0x48')](handleError(_0x2f3065,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index adc3e7a..78faed9 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 _0xc993=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xc993,0xe4));var _0x3c99=function(_0x419057,_0x4ebec4){_0x419057=_0x419057-0x0;var _0x596f86=_0xc993[_0x419057];return _0x596f86;};'use strict';var _=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var logger=require(_0x3c99('0x2'))(_0x3c99('0x3'));var moment=require(_0x3c99('0x4'));var BPromise=require(_0x3c99('0x5'));var rp=require(_0x3c99('0x6'));var fs=require('fs');var path=require(_0x3c99('0x7'));var rimraf=require(_0x3c99('0x8'));var config=require(_0x3c99('0x9'));var attributes=require(_0x3c99('0xa'));module[_0x3c99('0xb')]=function(_0x5ddd0,_0xff9ee5){return _0x5ddd0[_0x3c99('0xc')](_0x3c99('0xd'),attributes,{'tableName':_0x3c99('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea1e=['./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xea1e,0x190));var _0xeea1=function(_0x4f13b9,_0x50cdb9){_0x4f13b9=_0x4f13b9-0x0;var _0x524c26=_0xea1e[_0x4f13b9];return _0x524c26;};'use strict';var _=require(_0xeea1('0x0'));var util=require('util');var logger=require(_0xeea1('0x1'))(_0xeea1('0x2'));var moment=require('moment');var BPromise=require(_0xeea1('0x3'));var rp=require(_0xeea1('0x4'));var fs=require('fs');var path=require(_0xeea1('0x5'));var rimraf=require('rimraf');var config=require(_0xeea1('0x6'));var attributes=require(_0xeea1('0x7'));module[_0xeea1('0x8')]=function(_0x28c062,_0x1bee60){return _0x28c062[_0xeea1('0x9')]('Variable',attributes,{'tableName':_0xeea1('0xa'),'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 d9d58d6..6a8e50d 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x326f,0xd1));var _0xf326=function(_0x4c3517,_0x48bc43){_0x4c3517=_0x4c3517-0x0;var _0x5afa47=_0x326f[_0x4c3517];return _0x5afa47;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x5fc3[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 866b234..6fee01a 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 _0xfda4=['get','index','/fetch','isAuthenticated','fetch','/reset','reset','/pull','canUpdate','pull','restart','migrations','exports'];(function(_0x277e4e,_0x26b4d4){var _0xc5064a=function(_0x1c0ccd){while(--_0x1c0ccd){_0x277e4e['push'](_0x277e4e['shift']());}};_0xc5064a(++_0x26b4d4);}(_0xfda4,0x82));var _0x4fda=function(_0x49a811,_0x190495){_0x49a811=_0x49a811-0x0;var _0xd8ff9d=_0xfda4[_0x49a811];return _0xd8ff9d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x4fda('0x0')]('/',controller[_0x4fda('0x1')]);router['get'](_0x4fda('0x2'),auth[_0x4fda('0x3')](),auth['canUpdate'](),controller[_0x4fda('0x4')]);router[_0x4fda('0x0')](_0x4fda('0x5'),auth[_0x4fda('0x3')](),auth['canUpdate'](),controller[_0x4fda('0x6')]);router[_0x4fda('0x0')](_0x4fda('0x7'),auth['isAuthenticated'](),auth[_0x4fda('0x8')](),controller[_0x4fda('0x9')]);router['get']('/restart',auth[_0x4fda('0x3')](),controller[_0x4fda('0xa')]);router[_0x4fda('0x0')]('/migrations',controller[_0x4fda('0xb')]);module[_0x4fda('0xc')]=router; \ No newline at end of file +var _0x172a=['reset','pull','/restart','/migrations','exports','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset'];(function(_0x212a6b,_0x26bf86){var _0x484c2d=function(_0x459c5a){while(--_0x459c5a){_0x212a6b['push'](_0x212a6b['shift']());}};_0x484c2d(++_0x26bf86);}(_0x172a,0x198));var _0xa172=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x172a[_0xe45118];return _0x15e15d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa172('0x0'));var controller=require(_0xa172('0x1'));router[_0xa172('0x2')]('/',controller[_0xa172('0x3')]);router[_0xa172('0x2')](_0xa172('0x4'),auth[_0xa172('0x5')](),auth[_0xa172('0x6')](),controller['fetch']);router[_0xa172('0x2')](_0xa172('0x7'),auth[_0xa172('0x5')](),auth['canUpdate'](),controller[_0xa172('0x8')]);router['get']('/pull',auth[_0xa172('0x5')](),auth[_0xa172('0x6')](),controller[_0xa172('0x9')]);router[_0xa172('0x2')](_0xa172('0xa'),auth['isAuthenticated'](),controller['restart']);router[_0xa172('0x2')](_0xa172('0xb'),controller['migrations']);module[_0xa172('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 4b7e27e..fab887d 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 _0x8d0e=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8d0e,0x127));var _0xe8d0=function(_0x2f7139,_0x3e33cf){_0x2f7139=_0x2f7139-0x0;var _0x2ce026=_0x8d0e[_0x2f7139];return _0x2ce026;};'use strict';var Umzug=require(_0xe8d0('0x0'));var path=require(_0xe8d0('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xe8d0('0x2'))(module,_0xe8d0('0x3'));var compareVersions=require(_0xe8d0('0x4'));var exec=require(_0xe8d0('0x5'))[_0xe8d0('0x6')];var db=require(_0xe8d0('0x7'))['db'];var config=require(_0xe8d0('0x8'));var pm2=require(_0xe8d0('0x9'));var logger=require(_0xe8d0('0xa'))(_0xe8d0('0xb'));var git=require(_0xe8d0('0xc'))(config[_0xe8d0('0xd')]);exports[_0xe8d0('0xe')]=function(_0x15c403,_0x5b08d3){var _0x54a9b9={'current':module[_0xe8d0('0xf')][_0xe8d0('0x3')],'phonebar':0x2};if(_0x15c403['query']&&_0x15c403[_0xe8d0('0x10')][_0xe8d0('0x11')]){return git['fetch']()[_0xe8d0('0x12')](function(_0x433ba6,_0x261456){_0x54a9b9[_0xe8d0('0x11')]=(_0x433ba6?module[_0xe8d0('0xf')]['version']:_0x261456[_0xe8d0('0x11')])||_0xe8d0('0x13');return _0x5b08d3[_0xe8d0('0x14')](0xc8)[_0xe8d0('0x15')](_0x54a9b9);});}else{return _0x5b08d3['status'](0xc8)[_0xe8d0('0x15')](_0x54a9b9);}};exports[_0xe8d0('0x16')]=function(_0x4ab1a5,_0x5dc021){return git[_0xe8d0('0x16')](['origin',_0xe8d0('0x17')],function(_0x1da690){if(_0x1da690){logger[_0xe8d0('0x18')](_0x1da690);return _0x5dc021[_0xe8d0('0x14')](0x1f4)[_0xe8d0('0x15')](_0x1da690);}logger['info'](_0xe8d0('0x19'));return _0x5dc021[_0xe8d0('0x14')](0xc8)[_0xe8d0('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xe8d0('0x1a')]=function(_0x3e04cb,_0x4f7703){return git[_0xe8d0('0x1a')]([_0xe8d0('0x1b'),_0xe8d0('0x1c')],function(_0x55ec11){if(_0x55ec11){logger[_0xe8d0('0x18')](_0x55ec11);return _0x4f7703[_0xe8d0('0x14')](0x1f4)[_0xe8d0('0x15')](_0x55ec11);}logger[_0xe8d0('0x1d')](_0xe8d0('0x1e'));return _0x4f7703['status'](0xc8)[_0xe8d0('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xe8d0('0x1f')]=function(_0x2289b7,_0x2a4d85){exec('npm\x20install\x20--production',function(_0x11c8fb,_0x273e99,_0x3d556e){logger['info'](_0x273e99);logger[_0xe8d0('0x1d')](_0x3d556e);if(_0x11c8fb){logger[_0xe8d0('0x18')](_0x11c8fb);return _0x2a4d85[_0xe8d0('0x14')](0x1f4)['json'](_0x11c8fb);}return _0x2a4d85[_0xe8d0('0x14')](0xc8)['json']({'output':_0x273e99});});};exports[_0xe8d0('0x20')]=function(_0x2a8476,_0x14007c){return pm2[_0xe8d0('0x20')](_0xe8d0('0x21'))[_0xe8d0('0x22')](function(_0x1d4e07){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1d4e07);return _0x14007c[_0xe8d0('0x14')](0xc8)['json']({'output':_0xe8d0('0x23')});})[_0xe8d0('0x24')](function(_0x3568f4){logger[_0xe8d0('0x18')](_0x3568f4);return _0x14007c[_0xe8d0('0x14')](0x1f4)[_0xe8d0('0x15')](_0x3568f4);});};exports[_0xe8d0('0x25')]=function(_0x2ae714,_0x352c2f){var _0xe07d53=fs[_0xe8d0('0x26')](path[_0xe8d0('0x27')](config[_0xe8d0('0xd')],'server',_0xe8d0('0x25')));var _0x28f3f7=[];for(var _0x1ae731=0x0;_0x1ae731<_0xe07d53[_0xe8d0('0x28')];_0x1ae731++){var _0x10276d=_0xe07d53[_0x1ae731][_0xe8d0('0x29')](_0xe8d0('0x2a'),'');if(compareVersions(module[_0xe8d0('0xf')][_0xe8d0('0x3')],_0x10276d)===-0x1){_0x28f3f7[_0xe8d0('0x2b')](_0x10276d);}}if(_0x28f3f7['length']){var _0x49bc91=_0x28f3f7[_0xe8d0('0x2c')](compareVersions);var _0x22b639=new Umzug({'storage':_0xe8d0('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xe8d0('0x2e'),'columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0xe8d0('0x2f'));}],'path':path[_0xe8d0('0x27')](config['root'],_0xe8d0('0x30'),'migrations'),'pattern':/\.js$/}});_0x22b639['up']({'migrations':_[_0xe8d0('0x31')](_0x49bc91,function(_0x2d210a){return _0x2d210a+_0xe8d0('0x2a');})})[_0xe8d0('0x22')](function(){return _0x352c2f[_0xe8d0('0x14')](0xc8)['json']({'output':_0xe8d0('0x32')+module[_0xe8d0('0xf')][_0xe8d0('0x3')]+_0xe8d0('0x33')+_[_0xe8d0('0x34')](_0x49bc91),'migrations':_[_0xe8d0('0x27')](_0x49bc91)});})[_0xe8d0('0x24')](function(_0x565c79){if(_0x565c79 instanceof db['sequelize'][_0xe8d0('0x35')]){return _0x352c2f['status'](0xc8)[_0xe8d0('0x15')]({'output':_0xe8d0('0x36')});}else{return _0x352c2f[_0xe8d0('0x14')](0x1f4)['json'](_0x565c79);}});}else{return _0x352c2f['status'](0xc8)['json']({'output':_0xe8d0('0x36')});}}; \ No newline at end of file +var _0xac6e=['restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','length','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xac6e,0x1e7));var _0xeac6=function(_0x121eb4,_0x279712){_0x121eb4=_0x121eb4-0x0;var _0x1052ef=_0xac6e[_0x121eb4];return _0x1052ef;};'use strict';var Umzug=require(_0xeac6('0x0'));var path=require(_0xeac6('0x1'));var fs=require('fs');var _=require(_0xeac6('0x2'));var pkginfo=require(_0xeac6('0x3'))(module,_0xeac6('0x4'));var compareVersions=require(_0xeac6('0x5'));var exec=require(_0xeac6('0x6'))[_0xeac6('0x7')];var db=require(_0xeac6('0x8'))['db'];var config=require(_0xeac6('0x9'));var pm2=require('../../config/pm2');var logger=require(_0xeac6('0xa'))('update');var git=require(_0xeac6('0xb'))(config[_0xeac6('0xc')]);exports[_0xeac6('0xd')]=function(_0x19f970,_0x3ab6e8){var _0x18ba2b={'current':module[_0xeac6('0xe')][_0xeac6('0x4')],'phonebar':0x2};if(_0x19f970['query']&&_0x19f970[_0xeac6('0xf')]['latest']){return git[_0xeac6('0x10')]()[_0xeac6('0x11')](function(_0x48b772,_0x2a5c28){_0x18ba2b[_0xeac6('0x12')]=(_0x48b772?module[_0xeac6('0xe')][_0xeac6('0x4')]:_0x2a5c28[_0xeac6('0x12')])||_0xeac6('0x13');return _0x3ab6e8[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')](_0x18ba2b);});}else{return _0x3ab6e8[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')](_0x18ba2b);}};exports[_0xeac6('0x10')]=function(_0x135a96,_0x387f21){return git['fetch']([_0xeac6('0x16'),_0xeac6('0x17')],function(_0xb87c48){if(_0xb87c48){logger[_0xeac6('0x18')](_0xb87c48);return _0x387f21[_0xeac6('0x14')](0x1f4)[_0xeac6('0x15')](_0xb87c48);}logger[_0xeac6('0x19')](_0xeac6('0x1a'));return _0x387f21[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')]({'output':_0xeac6('0x1b')});});};exports[_0xeac6('0x1c')]=function(_0x5ba857,_0x4ad45f){return git[_0xeac6('0x1c')]([_0xeac6('0x1d'),'FETCH_HEAD'],function(_0x2e48ee){if(_0x2e48ee){logger[_0xeac6('0x18')](_0x2e48ee);return _0x4ad45f[_0xeac6('0x14')](0x1f4)['json'](_0x2e48ee);}logger[_0xeac6('0x19')](_0xeac6('0x1e'));return _0x4ad45f[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')]({'output':_0xeac6('0x1f')});});};exports[_0xeac6('0x20')]=function(_0x411c68,_0x4b5319){exec('npm\x20install\x20--production',function(_0x5d24c3,_0x5cd39e,_0x5a84a4){logger[_0xeac6('0x19')](_0x5cd39e);logger[_0xeac6('0x19')](_0x5a84a4);if(_0x5d24c3){logger['error'](_0x5d24c3);return _0x4b5319['status'](0x1f4)[_0xeac6('0x15')](_0x5d24c3);}return _0x4b5319[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')]({'output':_0x5cd39e});});};exports['restart']=function(_0x258161,_0x1db890){return pm2[_0xeac6('0x21')]('motion2')[_0xeac6('0x22')](function(_0x5e9d6c){logger[_0xeac6('0x19')](_0xeac6('0x23'),_0x5e9d6c);return _0x1db890[_0xeac6('0x14')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xeac6('0x24')](function(_0x5ce0da){logger[_0xeac6('0x18')](_0x5ce0da);return _0x1db890[_0xeac6('0x14')](0x1f4)[_0xeac6('0x15')](_0x5ce0da);});};exports[_0xeac6('0x25')]=function(_0x34e404,_0x536738){var _0x115fb2=fs['readdirSync'](path[_0xeac6('0x26')](config['root'],'server','migrations'));var _0x381e6b=[];for(var _0x4dd8f0=0x0;_0x4dd8f0<_0x115fb2[_0xeac6('0x27')];_0x4dd8f0++){var _0x158236=_0x115fb2[_0x4dd8f0]['replace'](_0xeac6('0x28'),'');if(compareVersions(module[_0xeac6('0xe')][_0xeac6('0x4')],_0x158236)===-0x1){_0x381e6b[_0xeac6('0x29')](_0x158236);}}if(_0x381e6b[_0xeac6('0x27')]){var _0x3dd193=_0x381e6b['sort'](compareVersions);var _0x503531=new Umzug({'storage':_0xeac6('0x2a'),'storageOptions':{'model':db[_0xeac6('0x2b')],'modelName':_0xeac6('0x2b'),'columnName':_0xeac6('0x4')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xeac6('0x2a')][_0xeac6('0x2c')],function(){throw new Error(_0xeac6('0x2d'));}],'path':path[_0xeac6('0x26')](config[_0xeac6('0xc')],_0xeac6('0x2e'),_0xeac6('0x25')),'pattern':/\.js$/}});_0x503531['up']({'migrations':_['map'](_0x3dd193,function(_0x3b298a){return _0x3b298a+_0xeac6('0x28');})})['then'](function(){return _0x536738['status'](0xc8)['json']({'output':_0xeac6('0x2f')+module[_0xeac6('0xe')][_0xeac6('0x4')]+_0xeac6('0x30')+_[_0xeac6('0x31')](_0x3dd193),'migrations':_[_0xeac6('0x26')](_0x3dd193)});})[_0xeac6('0x24')](function(_0x2944a4){if(_0x2944a4 instanceof db[_0xeac6('0x2a')][_0xeac6('0x32')]){return _0x536738[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')]({'output':_0xeac6('0x33')});}else{return _0x536738['status'](0x1f4)[_0xeac6('0x15')](_0x2944a4);}});}else{return _0x536738[_0xeac6('0x14')](0xc8)[_0xeac6('0x15')]({'output':_0xeac6('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d16f6ec..ffdfaf4 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 _0xbc23=['index','/describe','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x43945d,_0x43d61c){var _0xfda9cb=function(_0x3898ed){while(--_0x3898ed){_0x43945d['push'](_0x43945d['shift']());}};_0xfda9cb(++_0x43d61c);}(_0xbc23,0x1b9));var _0x3bc2=function(_0x42323a,_0x432571){_0x42323a=_0x42323a-0x0;var _0x1d253c=_0xbc23[_0x42323a];return _0x1d253c;};'use strict';var multer=require(_0x3bc2('0x0'));var util=require(_0x3bc2('0x1'));var path=require('path');var timeout=require(_0x3bc2('0x2'));var express=require(_0x3bc2('0x3'));var router=express[_0x3bc2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3bc2('0x5'));var config=require(_0x3bc2('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x3bc2('0x7')]('/',auth[_0x3bc2('0x8')](),controller[_0x3bc2('0x9')]);router[_0x3bc2('0x7')](_0x3bc2('0xa'),auth[_0x3bc2('0x8')](),controller['describe']);router[_0x3bc2('0x7')](_0x3bc2('0xb'),auth['isAuthenticated'](),controller[_0x3bc2('0xc')]);router[_0x3bc2('0xd')]('/',auth[_0x3bc2('0x8')](),controller[_0x3bc2('0xe')]);router['put'](_0x3bc2('0xb'),auth[_0x3bc2('0x8')](),controller[_0x3bc2('0xf')]);router[_0x3bc2('0x10')](_0x3bc2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3bc2('0x11')]=router; \ No newline at end of file +var _0x1c52=['update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x1c52,0xeb));var _0x21c5=function(_0x5d8f3a,_0x3287cc){_0x5d8f3a=_0x5d8f3a-0x0;var _0x42e86e=_0x1c52[_0x5d8f3a];return _0x42e86e;};'use strict';var multer=require(_0x21c5('0x0'));var util=require('util');var path=require(_0x21c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x21c5('0x2'));var router=express[_0x21c5('0x3')]();var fs_extra=require(_0x21c5('0x4'));var auth=require(_0x21c5('0x5'));var interaction=require(_0x21c5('0x6'));var config=require(_0x21c5('0x7'));var controller=require(_0x21c5('0x8'));router[_0x21c5('0x9')]('/',auth[_0x21c5('0xa')](),controller[_0x21c5('0xb')]);router[_0x21c5('0x9')]('/describe',auth[_0x21c5('0xa')](),controller['describe']);router[_0x21c5('0x9')]('/:id',auth[_0x21c5('0xa')](),controller[_0x21c5('0xc')]);router[_0x21c5('0xd')]('/',auth[_0x21c5('0xa')](),controller[_0x21c5('0xe')]);router[_0x21c5('0xf')](_0x21c5('0x10'),auth[_0x21c5('0xa')](),controller[_0x21c5('0x11')]);router[_0x21c5('0x12')](_0x21c5('0x10'),auth[_0x21c5('0xa')](),controller[_0x21c5('0x13')]);module[_0x21c5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 31b5efb..e46d446 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 _0xdd4f=['INTEGER','BOOLEAN','sequelize','STRING','DATE'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x262bf3,_0x4212b7){_0x262bf3=_0x262bf3-0x0;var _0x5ad91c=_0xdd4f[_0x262bf3];return _0x5ad91c;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfdd4('0x1')]},'calleridname':{'type':Sequelize[_0xfdd4('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfdd4('0x1')]},'membername':{'type':Sequelize[_0xfdd4('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfdd4('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfdd4('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xfdd4('0x2')]},'agentdumpAt':{'type':Sequelize[_0xfdd4('0x2')]},'holdtime':{'type':Sequelize[_0xfdd4('0x3')]},'agentcomplete':{'type':Sequelize[_0xfdd4('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfdd4('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfdd4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfdd4('0x3')]},'reason':{'type':Sequelize[_0xfdd4('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfdd4('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfdd4('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfdd4('0x1')]},'connectedlinename':{'type':Sequelize[_0xfdd4('0x1')]},'language':{'type':Sequelize[_0xfdd4('0x1')]},'accountcode':{'type':Sequelize[_0xfdd4('0x1')]},'context':{'type':Sequelize[_0xfdd4('0x1')]},'exten':{'type':Sequelize[_0xfdd4('0x1')]},'priority':{'type':Sequelize[_0xfdd4('0x1')]},'destchannel':{'type':Sequelize[_0xfdd4('0x1')]},'destchannelstate':{'type':Sequelize[_0xfdd4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfdd4('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfdd4('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xfdd4('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfdd4('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xfdd4('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfdd4('0x1')]},'destpriority':{'type':Sequelize[_0xfdd4('0x1')]},'destuniqueid':{'type':Sequelize[_0xfdd4('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfdd4('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xfdd4('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xfdd4('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfdd4('0x1')]},'agententerreason':{'type':Sequelize[_0xfdd4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x93e9=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x747ef2,_0x554a89){var _0x3f1565=function(_0x226f64){while(--_0x226f64){_0x747ef2['push'](_0x747ef2['shift']());}};_0x3f1565(++_0x554a89);}(_0x93e9,0xcc));var _0x993e=function(_0x4d1c45,_0x6ff874){_0x4d1c45=_0x4d1c45-0x0;var _0x44775c=_0x93e9[_0x4d1c45];return _0x44775c;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'type':{'type':Sequelize[_0x993e('0x2')]},'uniqueid':{'type':Sequelize[_0x993e('0x2')]},'calleridnum':{'type':Sequelize[_0x993e('0x2')]},'calleridname':{'type':Sequelize[_0x993e('0x2')]},'queue':{'type':Sequelize[_0x993e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x993e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x993e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x993e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x993e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x993e('0x3')]},'holdtime':{'type':Sequelize[_0x993e('0x4')]},'agentcomplete':{'type':Sequelize[_0x993e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x993e('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x993e('0x4')]},'agentacw':{'type':Sequelize[_0x993e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x993e('0x4')]},'reason':{'type':Sequelize[_0x993e('0x2')]},'lastevent':{'type':Sequelize[_0x993e('0x2')]},'channel':{'type':Sequelize[_0x993e('0x2')]},'channelstate':{'type':Sequelize[_0x993e('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x993e('0x2')]},'connectedlinename':{'type':Sequelize[_0x993e('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x993e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x993e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x993e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x993e('0x2')]},'destcalleridname':{'type':Sequelize[_0x993e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x993e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x993e('0x2')]},'destlanguage':{'type':Sequelize[_0x993e('0x2')]},'destaccountcode':{'type':Sequelize[_0x993e('0x2')]},'destcontext':{'type':Sequelize[_0x993e('0x2')]},'destexten':{'type':Sequelize[_0x993e('0x2')]},'destpriority':{'type':Sequelize[_0x993e('0x2')]},'destuniqueid':{'type':Sequelize[_0x993e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x993e('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x993e('0x2')]},'transfer':{'type':Sequelize[_0x993e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x993e('0x2')],'comment':_0x993e('0x6')},'transferexten':{'type':Sequelize[_0x993e('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x993e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 40cf35b..c47b365 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(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 9f7d0b4..040a247 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 _0x7a59=['uniqueid','destuniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a59,0x16e));var _0x97a5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7a59[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require(_0x97a5('0x5'));var rimraf=require('rimraf');var config=require(_0x97a5('0x6'));var attributes=require(_0x97a5('0x7'));module[_0x97a5('0x8')]=function(_0x48201b,_0x438520){return _0x48201b[_0x97a5('0x9')](_0x97a5('0xa'),attributes,{'tableName':_0x97a5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x97a5('0xc'),_0x97a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x133f81,_0x550e62){var _0x2eef30=function(_0x48e9bf){while(--_0x48e9bf){_0x133f81['push'](_0x133f81['shift']());}};_0x2eef30(++_0x550e62);}(_0xee14,0x13a));var _0x4ee1=function(_0x22d1c9,_0x1164e2){_0x22d1c9=_0x22d1c9-0x0;var _0x345c78=_0xee14[_0x22d1c9];return _0x345c78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4ee1('0xc'),_0x4ee1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 62daa42..46acfae 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 _0x2117=['limit','UpdateVoiceAgentReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','update','raw','where'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2117,0xdb));var _0x7211=function(_0x311c79,_0x28b1c5){_0x311c79=_0x311c79-0x0;var _0xf7e057=_0x2117[_0x311c79];return _0xf7e057;};'use strict';var _=require(_0x7211('0x0'));var util=require(_0x7211('0x1'));var moment=require(_0x7211('0x2'));var BPromise=require(_0x7211('0x3'));var rs=require(_0x7211('0x4'));var fs=require('fs');var Redis=require(_0x7211('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7211('0x6'));var logger=require(_0x7211('0x7'))(_0x7211('0x8'));var config=require(_0x7211('0x9'));var jayson=require(_0x7211('0xa'));var client=jayson[_0x7211('0xb')][_0x7211('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x754acb,_0x2f3276,_0x5e8bc9){return new BPromise(function(_0x7db915,_0x20f01a){return client[_0x7211('0xd')](_0x754acb,_0x5e8bc9)[_0x7211('0xe')](function(_0x2c2887){logger[_0x7211('0xf')](_0x7211('0x10'),_0x2f3276,'request\x20sent');logger[_0x7211('0x11')](_0x7211('0x12'),_0x2f3276,_0x7211('0x13'),JSON['stringify'](_0x2c2887));if(_0x2c2887[_0x7211('0x14')]){if(_0x2c2887[_0x7211('0x14')][_0x7211('0x15')]===0x1f4){logger[_0x7211('0x14')](_0x7211('0x10'),_0x2f3276,_0x2c2887['error'][_0x7211('0x16')]);return _0x20f01a(_0x2c2887[_0x7211('0x14')][_0x7211('0x16')]);}logger[_0x7211('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x2f3276,_0x2c2887[_0x7211('0x14')][_0x7211('0x16')]);return _0x7db915(_0x2c2887[_0x7211('0x14')][_0x7211('0x16')]);}else{logger[_0x7211('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x2f3276,_0x7211('0x13'));_0x7db915(_0x2c2887[_0x7211('0x17')]['message']);}})['catch'](function(_0x25ea22){logger['error'](_0x7211('0x10'),_0x2f3276,_0x25ea22);_0x20f01a(_0x25ea22);});});}exports[_0x7211('0x18')]=function(_0x3d0a07){var _0x1a1596=this;return new Promise(function(_0x55895e,_0xfadd81){return db[_0x7211('0x19')][_0x7211('0x1a')](_0x3d0a07[_0x7211('0x1b')],{'raw':_0x3d0a07[_0x7211('0x1c')]?_0x3d0a07[_0x7211('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x7211('0xe')](function(_0x1ec24f){logger['info'](_0x7211('0x18'),_0x3d0a07);logger[_0x7211('0x11')](_0x7211('0x18'),_0x3d0a07,JSON[_0x7211('0x1d')](_0x1ec24f));_0x55895e(_0x1ec24f);})['catch'](function(_0x57deae){logger[_0x7211('0x14')]('CreateVoiceAgentReport',_0x57deae[_0x7211('0x16')],_0x3d0a07);_0xfadd81(_0x1a1596[_0x7211('0x14')](0x1f4,_0x57deae[_0x7211('0x16')]));});});};exports['UpdateVoiceAgentReport']=function(_0x22b01b){var _0xc47112=this;return new Promise(function(_0x4ae4cb,_0x3eb2ed){return db['VoiceAgentReport'][_0x7211('0x1e')](_0x22b01b[_0x7211('0x1b')],{'raw':_0x22b01b[_0x7211('0x1c')]?_0x22b01b[_0x7211('0x1c')][_0x7211('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b01b[_0x7211('0x1c')]?_0x22b01b[_0x7211('0x1c')][_0x7211('0x20')]||null:null,'attributes':_0x22b01b[_0x7211('0x1c')]?_0x22b01b[_0x7211('0x1c')]['attributes']||null:null,'limit':_0x22b01b['options']?_0x22b01b['options'][_0x7211('0x21')]||null:null})[_0x7211('0xe')](function(_0x3e5d18){logger['info'](_0x7211('0x22'),_0x22b01b);logger['debug']('UpdateVoiceAgentReport',_0x22b01b,JSON[_0x7211('0x1d')](_0x3e5d18));_0x4ae4cb(_0x3e5d18);})[_0x7211('0x23')](function(_0x408f24){logger[_0x7211('0x14')](_0x7211('0x22'),_0x408f24[_0x7211('0x16')],_0x22b01b);_0x3eb2ed(_0xc47112[_0x7211('0x14')](0x1f4,_0x408f24[_0x7211('0x16')]));});});}; \ No newline at end of file +var _0xfce8=['result','create','body','options','raw','then','CreateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x41c102,_0x25d83b){var _0x4efbeb=function(_0xa7c34a){while(--_0xa7c34a){_0x41c102['push'](_0x41c102['shift']());}};_0x4efbeb(++_0x25d83b);}(_0xfce8,0x1c7));var _0x8fce=function(_0x3434a8,_0x5571b1){_0x3434a8=_0x3434a8-0x0;var _0x555665=_0xfce8[_0x3434a8];return _0x555665;};'use strict';var _=require(_0x8fce('0x0'));var util=require(_0x8fce('0x1'));var moment=require(_0x8fce('0x2'));var BPromise=require(_0x8fce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fce('0x5'));var logger=require(_0x8fce('0x6'))(_0x8fce('0x7'));var config=require(_0x8fce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8fce('0x9')][_0x8fce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x91df5d,_0x5a8c29,_0x1e73d2){return new BPromise(function(_0x2edf4e,_0x4b3804){return client[_0x8fce('0xb')](_0x91df5d,_0x1e73d2)['then'](function(_0x2e342a){logger['info'](_0x8fce('0xc'),_0x5a8c29,_0x8fce('0xd'));logger[_0x8fce('0xe')](_0x8fce('0xf'),_0x5a8c29,_0x8fce('0xd'),JSON[_0x8fce('0x10')](_0x2e342a));if(_0x2e342a['error']){if(_0x2e342a[_0x8fce('0x11')][_0x8fce('0x12')]===0x1f4){logger[_0x8fce('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5a8c29,_0x2e342a[_0x8fce('0x11')]['message']);return _0x4b3804(_0x2e342a[_0x8fce('0x11')][_0x8fce('0x13')]);}logger['error'](_0x8fce('0xc'),_0x5a8c29,_0x2e342a['error']['message']);return _0x2edf4e(_0x2e342a[_0x8fce('0x11')][_0x8fce('0x13')]);}else{logger[_0x8fce('0x14')](_0x8fce('0xc'),_0x5a8c29,_0x8fce('0xd'));_0x2edf4e(_0x2e342a[_0x8fce('0x15')][_0x8fce('0x13')]);}})['catch'](function(_0x5ae2e1){logger[_0x8fce('0x11')](_0x8fce('0xc'),_0x5a8c29,_0x5ae2e1);_0x4b3804(_0x5ae2e1);});});}exports['CreateVoiceAgentReport']=function(_0x14e14c){var _0x3ccd0a=this;return new Promise(function(_0x167e61,_0x315bf4){return db['VoiceAgentReport'][_0x8fce('0x16')](_0x14e14c[_0x8fce('0x17')],{'raw':_0x14e14c['options']?_0x14e14c[_0x8fce('0x18')][_0x8fce('0x19')]===undefined?!![]:![]:!![]})[_0x8fce('0x1a')](function(_0x3cfaa4){logger['info'](_0x8fce('0x1b'),_0x14e14c);logger[_0x8fce('0xe')]('CreateVoiceAgentReport',_0x14e14c,JSON[_0x8fce('0x10')](_0x3cfaa4));_0x167e61(_0x3cfaa4);})['catch'](function(_0x37abec){logger[_0x8fce('0x11')](_0x8fce('0x1b'),_0x37abec[_0x8fce('0x13')],_0x14e14c);_0x315bf4(_0x3ccd0a[_0x8fce('0x11')](0x1f4,_0x37abec[_0x8fce('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4ae3ee){var _0x3de01e=this;return new Promise(function(_0x1efc34,_0x5b160e){return db[_0x8fce('0x1c')][_0x8fce('0x1d')](_0x4ae3ee['body'],{'raw':_0x4ae3ee[_0x8fce('0x18')]?_0x4ae3ee[_0x8fce('0x18')][_0x8fce('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ae3ee[_0x8fce('0x18')]?_0x4ae3ee[_0x8fce('0x18')][_0x8fce('0x1e')]||null:null,'attributes':_0x4ae3ee[_0x8fce('0x18')]?_0x4ae3ee[_0x8fce('0x18')][_0x8fce('0x1f')]||null:null,'limit':_0x4ae3ee['options']?_0x4ae3ee[_0x8fce('0x18')][_0x8fce('0x20')]||null:null})[_0x8fce('0x1a')](function(_0x11b433){logger['info'](_0x8fce('0x21'),_0x4ae3ee);logger['debug'](_0x8fce('0x21'),_0x4ae3ee,JSON[_0x8fce('0x10')](_0x11b433));_0x1efc34(_0x11b433);})['catch'](function(_0x484b1c){logger[_0x8fce('0x11')](_0x8fce('0x21'),_0x484b1c['message'],_0x4ae3ee);_0x5b160e(_0x3de01e[_0x8fce('0x11')](0x1f4,_0x484b1c[_0x8fce('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 937acee..19fdb66 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 _0xe2db=['express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','delete','exports'];(function(_0x526ce1,_0x2ca693){var _0x3c535f=function(_0x386138){while(--_0x386138){_0x526ce1['push'](_0x526ce1['shift']());}};_0x3c535f(++_0x2ca693);}(_0xe2db,0x187));var _0xbe2d=function(_0x5482ab,_0x157164){_0x5482ab=_0x5482ab-0x0;var _0x12e8a8=_0xe2db[_0x5482ab];return _0x12e8a8;};'use strict';var express=require(_0xbe2d('0x0'));var router=express['Router']();var auth=require(_0xbe2d('0x1'));var controller=require('./voiceCallReport.controller');router[_0xbe2d('0x2')]('/',auth[_0xbe2d('0x3')](),controller[_0xbe2d('0x4')]);router[_0xbe2d('0x2')](_0xbe2d('0x5'),auth[_0xbe2d('0x3')](),controller[_0xbe2d('0x6')]);router[_0xbe2d('0x2')](_0xbe2d('0x7'),auth[_0xbe2d('0x3')](),controller[_0xbe2d('0x8')]);router[_0xbe2d('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe2d('0xa')]);router[_0xbe2d('0xb')](_0xbe2d('0x7'),auth[_0xbe2d('0x3')](),controller[_0xbe2d('0xc')]);router[_0xbe2d('0xb')](_0xbe2d('0xd'),auth[_0xbe2d('0x3')](),controller[_0xbe2d('0xe')]);router[_0xbe2d('0xf')](_0xbe2d('0x7'),auth[_0xbe2d('0x3')](),controller['destroy']);module[_0xbe2d('0x10')]=router; \ No newline at end of file +var _0x26e5=['Router','../../components/auth/service','./voiceCallReport.controller','get','index','isAuthenticated','describe','show','post','create','/:id','update','put','/with-retry/:id','updateWithRetry','delete','express'];(function(_0x25a96a,_0x4430ce){var _0x4222bb=function(_0xc8892d){while(--_0xc8892d){_0x25a96a['push'](_0x25a96a['shift']());}};_0x4222bb(++_0x4430ce);}(_0x26e5,0x153));var _0x526e=function(_0x1f6e71,_0x19360b){_0x1f6e71=_0x1f6e71-0x0;var _0x2271aa=_0x26e5[_0x1f6e71];return _0x2271aa;};'use strict';var express=require(_0x526e('0x0'));var router=express[_0x526e('0x1')]();var auth=require(_0x526e('0x2'));var controller=require(_0x526e('0x3'));router[_0x526e('0x4')]('/',auth['isAuthenticated'](),controller[_0x526e('0x5')]);router[_0x526e('0x4')]('/describe',auth[_0x526e('0x6')](),controller[_0x526e('0x7')]);router['get']('/:id',auth[_0x526e('0x6')](),controller[_0x526e('0x8')]);router[_0x526e('0x9')]('/',auth[_0x526e('0x6')](),controller[_0x526e('0xa')]);router['put'](_0x526e('0xb'),auth['isAuthenticated'](),controller[_0x526e('0xc')]);router[_0x526e('0xd')](_0x526e('0xe'),auth['isAuthenticated'](),controller[_0x526e('0xf')]);router[_0x526e('0x10')](_0x526e('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 36cf594..6ec37ec 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 _0x2ffe=['internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x439218,_0x9114cc){_0x439218=_0x439218-0x0;var _0x42d834=_0x2ffe[_0x439218];return _0x42d834;};'use strict';var Sequelize=require('sequelize');module[_0xe2ff('0x0')]={'uniqueid':{'type':Sequelize[_0xe2ff('0x1')]},'type':{'type':Sequelize[_0xe2ff('0x2')](_0xe2ff('0x3'),_0xe2ff('0x4'),'outbound',_0xe2ff('0x5'),_0xe2ff('0x6'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe2ff('0x1')]},'source':{'type':Sequelize[_0xe2ff('0x1')]},'destination':{'type':Sequelize[_0xe2ff('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe2ff('0x1')]},'channel':{'type':Sequelize[_0xe2ff('0x1')]},'destinationchannel':{'type':Sequelize[_0xe2ff('0x1')]},'lastapplication':{'type':Sequelize[_0xe2ff('0x1')]},'lastdata':{'type':Sequelize[_0xe2ff('0x7')]},'starttime':{'type':Sequelize[_0xe2ff('0x8')]},'systemanswertime':{'type':Sequelize[_0xe2ff('0x8')]},'answertime':{'type':Sequelize[_0xe2ff('0x8')]},'endtime':{'type':Sequelize[_0xe2ff('0x8')]},'duration':{'type':Sequelize[_0xe2ff('0x9')]},'billableseconds':{'type':Sequelize[_0xe2ff('0x9')]},'mohtime':{'type':Sequelize[_0xe2ff('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe2ff('0x1')]},'amaflags':{'type':Sequelize[_0xe2ff('0x1')]},'userfield':{'type':Sequelize[_0xe2ff('0x1')]},'userDisposition':{'type':Sequelize[_0xe2ff('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xe2ff('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe2ff('0x1')]},'prefix':{'type':Sequelize[_0xe2ff('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xe2ff('0x1')]}}; \ No newline at end of file +var _0xd2b0=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','STRING','ENUM','inbound','internal'];(function(_0x141db1,_0x12a468){var _0x5a546c=function(_0x302346){while(--_0x302346){_0x141db1['push'](_0x141db1['shift']());}};_0x5a546c(++_0x12a468);}(_0xd2b0,0x13b));var _0x0d2b=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xd2b0[_0x349148];return _0x2f2b0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0d2b('0x0')]},'type':{'type':Sequelize[_0x0d2b('0x1')](_0x0d2b('0x2'),_0x0d2b('0x3'),_0x0d2b('0x4'),_0x0d2b('0x5'),_0x0d2b('0x6'),_0x0d2b('0x7'))},'tag':{'type':Sequelize[_0x0d2b('0x0')]},'accountcode':{'type':Sequelize[_0x0d2b('0x0')]},'source':{'type':Sequelize[_0x0d2b('0x0')]},'destination':{'type':Sequelize[_0x0d2b('0x0')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d2b('0x0')]},'channel':{'type':Sequelize[_0x0d2b('0x0')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0d2b('0x0')]},'lastdata':{'type':Sequelize[_0x0d2b('0x8')]},'starttime':{'type':Sequelize[_0x0d2b('0x9')]},'systemanswertime':{'type':Sequelize[_0x0d2b('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0d2b('0x9')]},'duration':{'type':Sequelize[_0x0d2b('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0d2b('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0d2b('0x0')]},'userfield':{'type':Sequelize[_0x0d2b('0x0')]},'userDisposition':{'type':Sequelize[_0x0d2b('0x0')]},'userSecondDisposition':{'type':Sequelize[_0x0d2b('0x0')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0d2b('0x0')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x0d2b('0xa')]},'sipcallid':{'type':Sequelize[_0x0d2b('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 00250ad..ff459c4 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 _0x964b=['end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','include','fullname','alias','User','rows','catch','params','includeAll','merge','find','create','body','describe','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','api','../../mysqldb','promise-retry','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','status'];(function(_0x5ab15f,_0x3d8f01){var _0xfee166=function(_0x24207d){while(--_0x24207d){_0x5ab15f['push'](_0x5ab15f['shift']());}};_0xfee166(++_0x3d8f01);}(_0x964b,0x112));var _0xb964=function(_0x39665d,_0x39ed41){_0x39665d=_0x39665d-0x0;var _0x551eae=_0x964b[_0x39665d];return _0x551eae;};'use strict';var _=require(_0xb964('0x0'));var qs=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var db=require(_0xb964('0x3'))['db'];const promiseRetry=require(_0xb964('0x4'));function respondWithResult(_0x5b460a,_0x5c4f01){_0x5c4f01=_0x5c4f01||0xc8;return function(_0x2c4686){if(_0x2c4686){return _0x5b460a['status'](_0x5c4f01)[_0xb964('0x5')](_0x2c4686);}};}function respondWithFilteredResult(_0x249313,_0xba9f19){return function(_0x11a0c1){if(_0x11a0c1){var _0x204c7d=typeof _0xba9f19[_0xb964('0x6')]===_0xb964('0x7')&&typeof _0xba9f19['limit']==='undefined';var _0x3a3006=_0x11a0c1['count'];var _0x55e697=_0x204c7d?0x0:_0xba9f19[_0xb964('0x6')];var _0x4df011=_0x204c7d?_0x11a0c1[_0xb964('0x8')]:_0xba9f19[_0xb964('0x6')]+_0xba9f19[_0xb964('0x9')];var _0x1c3339;if(_0x4df011>=_0x3a3006){_0x4df011=_0x3a3006;_0x1c3339=0xc8;}else{_0x1c3339=0xce;}_0x249313['status'](_0x1c3339);return _0x249313[_0xb964('0xa')](_0xb964('0xb'),_0x55e697+'-'+_0x4df011+'/'+_0x3a3006)[_0xb964('0x5')](_0x11a0c1);}return null;};}function saveUpdates(_0x30c217){return function(_0x4e7e0f){if(_0x4e7e0f){return _0x4e7e0f[_0xb964('0xc')](_0x30c217)['then'](function(_0x556533){return _0x556533;});}return null;};}function removeEntity(_0x3ce73e){return function(_0x256e02){if(_0x256e02){return _0x256e02[_0xb964('0xd')]()[_0xb964('0xe')](function(){_0x3ce73e[_0xb964('0xf')](0xcc)[_0xb964('0x10')]();});}};}function handleEntityNotFound(_0x3d5baa){return function(_0x59965c){if(!_0x59965c){_0x3d5baa[_0xb964('0x11')](0x194);}return _0x59965c;};}function handleError(_0x5a2ce4,_0x538d2e){_0x538d2e=_0x538d2e||0x1f4;return function(_0xd775d5){logger[_0xb964('0x12')](_0xd775d5[_0xb964('0x13')]);if(_0xd775d5[_0xb964('0x14')]){delete _0xd775d5[_0xb964('0x14')];}_0x5a2ce4[_0xb964('0xf')](_0x538d2e)[_0xb964('0x15')](_0xd775d5);};}exports[_0xb964('0x16')]=function(_0x2bd9d5,_0x57772a){var _0x54da04={},_0x49a066={},_0x2f5068={'count':0x0,'rows':[]};var _0x42e78e=_[_0xb964('0x17')](db[_0xb964('0x18')][_0xb964('0x19')],function(_0x5a49ac){return{'name':_0x5a49ac['fieldName'],'type':_0x5a49ac['type'][_0xb964('0x1a')]};});_0x49a066[_0xb964('0x1b')]=_[_0xb964('0x17')](_0x42e78e,'name');_0x49a066[_0xb964('0x1c')]=_[_0xb964('0x1d')](_0x2bd9d5[_0xb964('0x1c')]);_0x49a066['filters']=_['intersection'](_0x49a066[_0xb964('0x1b')],_0x49a066['query']);_0x54da04[_0xb964('0x1e')]=_[_0xb964('0x1f')](_0x49a066[_0xb964('0x1b')],qs[_0xb964('0x20')](_0x2bd9d5['query'][_0xb964('0x20')]));_0x54da04[_0xb964('0x1e')]=_0x54da04[_0xb964('0x1e')][_0xb964('0x21')]?_0x54da04[_0xb964('0x1e')]:_0x49a066[_0xb964('0x1b')];if(!_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x22')](_0xb964('0x23'))){_0x54da04['limit']=qs[_0xb964('0x9')](_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x9')]);_0x54da04[_0xb964('0x6')]=qs[_0xb964('0x6')](_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x6')]);}_0x54da04['order']=qs[_0xb964('0x24')](_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x24')]);_0x54da04['where']=qs[_0xb964('0x25')](_[_0xb964('0x26')](_0x2bd9d5[_0xb964('0x1c')],_0x49a066[_0xb964('0x25')]),_0x42e78e);if(_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x27')]){_0x54da04['where']=_['merge'](_0x54da04[_0xb964('0x28')],{'$or':_[_0xb964('0x17')](_0x42e78e,function(_0x28f0a9){if(_0x28f0a9[_0xb964('0x29')]!=='VIRTUAL'){var _0x29ec24={};_0x29ec24[_0x28f0a9['name']]={'$like':'%'+_0x2bd9d5[_0xb964('0x1c')][_0xb964('0x27')]+'%'};return _0x29ec24;}})});}_0x54da04=_['merge']({},_0x54da04,_0x2bd9d5['options']);var _0x33b787={'where':_0x54da04[_0xb964('0x28')]};return db[_0xb964('0x18')][_0xb964('0x8')](_0x33b787)[_0xb964('0xe')](function(_0x8bf3c8){_0x2f5068['count']=_0x8bf3c8;if(_0x2bd9d5['query']['includeAll']){_0x54da04[_0xb964('0x2a')]=[{'attributes':['id',_0xb964('0x14'),_0xb964('0x2b'),_0xb964('0x2c')],'model':db[_0xb964('0x2d')],'as':_0xb964('0x2d')}];}return db['VoiceCallReport']['findAll'](_0x54da04);})[_0xb964('0xe')](function(_0x3431fd){_0x2f5068[_0xb964('0x2e')]=_0x3431fd;return _0x2f5068;})[_0xb964('0xe')](respondWithFilteredResult(_0x57772a,_0x54da04))[_0xb964('0x2f')](handleError(_0x57772a,null));};exports['show']=function(_0xace4a5,_0x465197){var _0x8c8286={'raw':!![],'where':{'id':_0xace4a5[_0xb964('0x30')]['id']}},_0x5f3244={};_0x5f3244[_0xb964('0x1b')]=_[_0xb964('0x1d')](db['VoiceCallReport'][_0xb964('0x19')]);_0x5f3244['query']=_[_0xb964('0x1d')](_0xace4a5['query']);_0x5f3244[_0xb964('0x25')]=_[_0xb964('0x1f')](_0x5f3244['model'],_0x5f3244['query']);_0x8c8286[_0xb964('0x1e')]=_[_0xb964('0x1f')](_0x5f3244[_0xb964('0x1b')],qs[_0xb964('0x20')](_0xace4a5[_0xb964('0x1c')]['fields']));_0x8c8286[_0xb964('0x1e')]=_0x8c8286[_0xb964('0x1e')][_0xb964('0x21')]?_0x8c8286['attributes']:_0x5f3244[_0xb964('0x1b')];if(_0xace4a5[_0xb964('0x1c')][_0xb964('0x31')]){_0x8c8286[_0xb964('0x2a')]=[{'all':!![]}];}_0x8c8286=_[_0xb964('0x32')]({},_0x8c8286,_0xace4a5['options']);return db[_0xb964('0x18')][_0xb964('0x33')](_0x8c8286)['then'](handleEntityNotFound(_0x465197,null))[_0xb964('0xe')](respondWithResult(_0x465197,null))[_0xb964('0x2f')](handleError(_0x465197,null));};exports[_0xb964('0x34')]=function(_0x379b31,_0x4c49c7){return db['VoiceCallReport'][_0xb964('0x34')](_0x379b31[_0xb964('0x35')],{})[_0xb964('0xe')](respondWithResult(_0x4c49c7,0xc9))[_0xb964('0x2f')](handleError(_0x4c49c7,null));};exports[_0xb964('0xd')]=function(_0x176c92,_0x218562){return db[_0xb964('0x18')]['find']({'where':{'id':_0x176c92[_0xb964('0x30')]['id']}})['then'](handleEntityNotFound(_0x218562,null))[_0xb964('0xe')](removeEntity(_0x218562,null))[_0xb964('0x2f')](handleError(_0x218562,null));};exports[_0xb964('0x36')]=function(_0x493fdf,_0x335ccd){return db[_0xb964('0x18')][_0xb964('0x36')]()[_0xb964('0xe')](respondWithResult(_0x335ccd,null))[_0xb964('0x2f')](handleError(_0x335ccd,null));};function findForUpdate(_0x3d6df5){return db[_0xb964('0x18')][_0xb964('0x33')]({'where':{'uniqueid':_0x3d6df5[_0xb964('0x30')]['id'],'UserId':{'$or':[null,_0x3d6df5['user']['id']]}}});}exports['update']=function(_0x4cbdca,_0x12c58f){if(_0x4cbdca[_0xb964('0x35')]['uniqueid']){delete _0x4cbdca[_0xb964('0x35')][_0xb964('0x37')];}return findForUpdate(_0x4cbdca)['then'](handleEntityNotFound(_0x12c58f,null))['then'](saveUpdates(_0x4cbdca[_0xb964('0x35')],null))[_0xb964('0xe')](respondWithResult(_0x12c58f,null))[_0xb964('0x2f')](handleError(_0x12c58f,null));};exports[_0xb964('0x38')]=function(_0x4f1129,_0x3bacfc,_0x52fbe7){if(_0x4f1129[_0xb964('0x35')][_0xb964('0x37')]){delete _0x4f1129[_0xb964('0x35')][_0xb964('0x37')];}promiseRetry(function(_0x2d333c){return findForUpdate(_0x4f1129)[_0xb964('0xe')](function(_0x229049){if(_0x229049!==null){return _0x229049;}else{_0x2d333c(new Error(_0xb964('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x2d74b7){if(!_0x2d74b7){return new Promise(function(_0x2f6406){_0x2f6406(handleEntityNotFound(_0x3bacfc)());});}else{return _0x2d74b7[_0xb964('0xc')](_0x4f1129[_0xb964('0x35')])['then'](function(_0x386e1e){return respondWithResult(_0x3bacfc)(_0x386e1e);});}},function(){handleEntityNotFound(_0x3bacfc)();});}; \ No newline at end of file +var _0x1574=['find','catch','create','body','describe','user','updateWithRetry','uniqueid','lodash','../../components/parsers/qs','../../config/logger','api','promise-retry','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','fullname','alias','User','findAll','rows','show','params','include','options'];(function(_0x33d5d6,_0x2ad866){var _0x27032e=function(_0x216e5c){while(--_0x216e5c){_0x33d5d6['push'](_0x33d5d6['shift']());}};_0x27032e(++_0x2ad866);}(_0x1574,0x148));var _0x4157=function(_0x59bba8,_0x59428d){_0x59bba8=_0x59bba8-0x0;var _0x50c8d1=_0x1574[_0x59bba8];return _0x50c8d1;};'use strict';var _=require(_0x4157('0x0'));var qs=require(_0x4157('0x1'));var logger=require(_0x4157('0x2'))(_0x4157('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x4157('0x4'));function respondWithResult(_0x3bdabb,_0xab8757){_0xab8757=_0xab8757||0xc8;return function(_0x1759d6){if(_0x1759d6){return _0x3bdabb[_0x4157('0x5')](_0xab8757)[_0x4157('0x6')](_0x1759d6);}};}function respondWithFilteredResult(_0x220354,_0x43c6dc){return function(_0xbd0cf7){if(_0xbd0cf7){var _0x1ece73=typeof _0x43c6dc[_0x4157('0x7')]===_0x4157('0x8')&&typeof _0x43c6dc[_0x4157('0x9')]===_0x4157('0x8');var _0x388978=_0xbd0cf7['count'];var _0x449b71=_0x1ece73?0x0:_0x43c6dc['offset'];var _0x4ba25d=_0x1ece73?_0xbd0cf7['count']:_0x43c6dc[_0x4157('0x7')]+_0x43c6dc[_0x4157('0x9')];var _0x224c1b;if(_0x4ba25d>=_0x388978){_0x4ba25d=_0x388978;_0x224c1b=0xc8;}else{_0x224c1b=0xce;}_0x220354['status'](_0x224c1b);return _0x220354[_0x4157('0xa')](_0x4157('0xb'),_0x449b71+'-'+_0x4ba25d+'/'+_0x388978)[_0x4157('0x6')](_0xbd0cf7);}return null;};}function saveUpdates(_0x44de30){return function(_0x151434){if(_0x151434){return _0x151434[_0x4157('0xc')](_0x44de30)[_0x4157('0xd')](function(_0x3c2184){return _0x3c2184;});}return null;};}function removeEntity(_0x26a407){return function(_0x123e55){if(_0x123e55){return _0x123e55[_0x4157('0xe')]()[_0x4157('0xd')](function(){_0x26a407['status'](0xcc)[_0x4157('0xf')]();});}};}function handleEntityNotFound(_0x58a27f){return function(_0x6c497e){if(!_0x6c497e){_0x58a27f[_0x4157('0x10')](0x194);}return _0x6c497e;};}function handleError(_0x397f4e,_0x30598b){_0x30598b=_0x30598b||0x1f4;return function(_0x41351e){logger[_0x4157('0x11')](_0x41351e[_0x4157('0x12')]);if(_0x41351e[_0x4157('0x13')]){delete _0x41351e[_0x4157('0x13')];}_0x397f4e[_0x4157('0x5')](_0x30598b)[_0x4157('0x14')](_0x41351e);};}exports[_0x4157('0x15')]=function(_0x50ed87,_0x1f88b4){var _0x4f9de8={},_0x3c1c44={},_0x1a8444={'count':0x0,'rows':[]};var _0x4a60bf=_[_0x4157('0x16')](db[_0x4157('0x17')][_0x4157('0x18')],function(_0x3912b4){return{'name':_0x3912b4[_0x4157('0x19')],'type':_0x3912b4[_0x4157('0x1a')][_0x4157('0x1b')]};});_0x3c1c44[_0x4157('0x1c')]=_[_0x4157('0x16')](_0x4a60bf,'name');_0x3c1c44['query']=_[_0x4157('0x1d')](_0x50ed87[_0x4157('0x1e')]);_0x3c1c44[_0x4157('0x1f')]=_[_0x4157('0x20')](_0x3c1c44['model'],_0x3c1c44[_0x4157('0x1e')]);_0x4f9de8['attributes']=_[_0x4157('0x20')](_0x3c1c44[_0x4157('0x1c')],qs[_0x4157('0x21')](_0x50ed87[_0x4157('0x1e')][_0x4157('0x21')]));_0x4f9de8[_0x4157('0x22')]=_0x4f9de8[_0x4157('0x22')][_0x4157('0x23')]?_0x4f9de8[_0x4157('0x22')]:_0x3c1c44[_0x4157('0x1c')];if(!_0x50ed87[_0x4157('0x1e')][_0x4157('0x24')](_0x4157('0x25'))){_0x4f9de8[_0x4157('0x9')]=qs[_0x4157('0x9')](_0x50ed87['query'][_0x4157('0x9')]);_0x4f9de8['offset']=qs[_0x4157('0x7')](_0x50ed87[_0x4157('0x1e')][_0x4157('0x7')]);}_0x4f9de8[_0x4157('0x26')]=qs[_0x4157('0x27')](_0x50ed87[_0x4157('0x1e')][_0x4157('0x27')]);_0x4f9de8[_0x4157('0x28')]=qs[_0x4157('0x1f')](_[_0x4157('0x29')](_0x50ed87[_0x4157('0x1e')],_0x3c1c44['filters']),_0x4a60bf);if(_0x50ed87[_0x4157('0x1e')]['filter']){_0x4f9de8['where']=_['merge'](_0x4f9de8[_0x4157('0x28')],{'$or':_[_0x4157('0x16')](_0x4a60bf,function(_0x49a70f){if(_0x49a70f['type']!==_0x4157('0x2a')){var _0x5442e6={};_0x5442e6[_0x49a70f[_0x4157('0x13')]]={'$like':'%'+_0x50ed87[_0x4157('0x1e')][_0x4157('0x2b')]+'%'};return _0x5442e6;}})});}_0x4f9de8=_[_0x4157('0x2c')]({},_0x4f9de8,_0x50ed87['options']);var _0x55e883={'where':_0x4f9de8[_0x4157('0x28')]};return db[_0x4157('0x17')][_0x4157('0x2d')](_0x55e883)['then'](function(_0x3c03fe){_0x1a8444[_0x4157('0x2d')]=_0x3c03fe;if(_0x50ed87[_0x4157('0x1e')][_0x4157('0x2e')]){_0x4f9de8['include']=[{'attributes':['id','name',_0x4157('0x2f'),_0x4157('0x30')],'model':db[_0x4157('0x31')],'as':_0x4157('0x31')}];}return db[_0x4157('0x17')][_0x4157('0x32')](_0x4f9de8);})[_0x4157('0xd')](function(_0x1e0615){_0x1a8444[_0x4157('0x33')]=_0x1e0615;return _0x1a8444;})[_0x4157('0xd')](respondWithFilteredResult(_0x1f88b4,_0x4f9de8))['catch'](handleError(_0x1f88b4,null));};exports[_0x4157('0x34')]=function(_0x2d8494,_0x46d4cb){var _0x4262bc={'raw':!![],'where':{'id':_0x2d8494[_0x4157('0x35')]['id']}},_0x505862={};_0x505862[_0x4157('0x1c')]=_[_0x4157('0x1d')](db[_0x4157('0x17')]['rawAttributes']);_0x505862['query']=_[_0x4157('0x1d')](_0x2d8494[_0x4157('0x1e')]);_0x505862[_0x4157('0x1f')]=_[_0x4157('0x20')](_0x505862[_0x4157('0x1c')],_0x505862[_0x4157('0x1e')]);_0x4262bc['attributes']=_[_0x4157('0x20')](_0x505862[_0x4157('0x1c')],qs['fields'](_0x2d8494[_0x4157('0x1e')][_0x4157('0x21')]));_0x4262bc[_0x4157('0x22')]=_0x4262bc[_0x4157('0x22')]['length']?_0x4262bc[_0x4157('0x22')]:_0x505862[_0x4157('0x1c')];if(_0x2d8494[_0x4157('0x1e')]['includeAll']){_0x4262bc[_0x4157('0x36')]=[{'all':!![]}];}_0x4262bc=_[_0x4157('0x2c')]({},_0x4262bc,_0x2d8494[_0x4157('0x37')]);return db['VoiceCallReport'][_0x4157('0x38')](_0x4262bc)['then'](handleEntityNotFound(_0x46d4cb,null))[_0x4157('0xd')](respondWithResult(_0x46d4cb,null))[_0x4157('0x39')](handleError(_0x46d4cb,null));};exports[_0x4157('0x3a')]=function(_0x2b205b,_0x16d7cc){return db[_0x4157('0x17')]['create'](_0x2b205b[_0x4157('0x3b')],{})[_0x4157('0xd')](respondWithResult(_0x16d7cc,0xc9))[_0x4157('0x39')](handleError(_0x16d7cc,null));};exports[_0x4157('0xe')]=function(_0x4ea4ed,_0x266a27){return db['VoiceCallReport']['find']({'where':{'id':_0x4ea4ed['params']['id']}})[_0x4157('0xd')](handleEntityNotFound(_0x266a27,null))[_0x4157('0xd')](removeEntity(_0x266a27,null))[_0x4157('0x39')](handleError(_0x266a27,null));};exports['describe']=function(_0x2ed48a,_0x5a4637){return db[_0x4157('0x17')][_0x4157('0x3c')]()[_0x4157('0xd')](respondWithResult(_0x5a4637,null))['catch'](handleError(_0x5a4637,null));};function findForUpdate(_0x27416a){return db[_0x4157('0x17')][_0x4157('0x38')]({'where':{'uniqueid':_0x27416a['params']['id'],'UserId':{'$or':[null,_0x27416a[_0x4157('0x3d')]['id']]}}});}exports[_0x4157('0xc')]=function(_0x45827d,_0xc87417){if(_0x45827d[_0x4157('0x3b')]['uniqueid']){delete _0x45827d['body']['uniqueid'];}return findForUpdate(_0x45827d)[_0x4157('0xd')](handleEntityNotFound(_0xc87417,null))[_0x4157('0xd')](saveUpdates(_0x45827d[_0x4157('0x3b')],null))['then'](respondWithResult(_0xc87417,null))[_0x4157('0x39')](handleError(_0xc87417,null));};exports[_0x4157('0x3e')]=function(_0x19b132,_0x313629,_0x1c6a3b){if(_0x19b132[_0x4157('0x3b')]['uniqueid']){delete _0x19b132[_0x4157('0x3b')][_0x4157('0x3f')];}promiseRetry(function(_0x320979){return findForUpdate(_0x19b132)['then'](function(_0x5be379){if(_0x5be379!==null){return _0x5be379;}else{_0x320979(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x4157('0xd')](function(_0x1df7e3){if(!_0x1df7e3){return new Promise(function(_0x22da67){_0x22da67(handleEntityNotFound(_0x313629)());});}else{return _0x1df7e3[_0x4157('0xc')](_0x19b132[_0x4157('0x3b')])[_0x4157('0xd')](function(_0x45a879){return respondWithResult(_0x313629)(_0x45a879);});}},function(){handleEntityNotFound(_0x313629)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c10595b..350f5bd 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 _0x3ee5=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_call','uniqueid'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x3ee5,0x90));var _0x53ee=function(_0x23b57d,_0x347cfa){_0x23b57d=_0x23b57d-0x0;var _0x3be2d5=_0x3ee5[_0x23b57d];return _0x3be2d5;};'use strict';var _=require(_0x53ee('0x0'));var util=require(_0x53ee('0x1'));var logger=require('../../config/logger')(_0x53ee('0x2'));var moment=require(_0x53ee('0x3'));var BPromise=require(_0x53ee('0x4'));var rp=require(_0x53ee('0x5'));var fs=require('fs');var path=require(_0x53ee('0x6'));var rimraf=require(_0x53ee('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x53ee('0x8')]=function(_0x3e9081,_0x543367){return _0x3e9081[_0x53ee('0x9')]('VoiceCallReport',attributes,{'tableName':_0x53ee('0xa'),'paranoid':![],'indexes':[{'fields':[_0x53ee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d1d=['report_call','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3d1d,0x194));var _0xd3d1=function(_0x5e8cb3,_0x3b51e3){_0x5e8cb3=_0x5e8cb3-0x0;var _0x5bf2f2=_0x3d1d[_0x5e8cb3];return _0x5bf2f2;};'use strict';var _=require(_0xd3d1('0x0'));var util=require(_0xd3d1('0x1'));var logger=require('../../config/logger')(_0xd3d1('0x2'));var moment=require(_0xd3d1('0x3'));var BPromise=require(_0xd3d1('0x4'));var rp=require(_0xd3d1('0x5'));var fs=require('fs');var path=require(_0xd3d1('0x6'));var rimraf=require(_0xd3d1('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3d1('0x8'));module[_0xd3d1('0x9')]=function(_0x1e752d,_0xf69bba){return _0x1e752d[_0xd3d1('0xa')](_0xd3d1('0xb'),attributes,{'tableName':_0xd3d1('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 124495b..b1d4fe9 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 _0xd416=['jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceCallReport','catch','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1bdd2d,_0x308db2){var _0x3f723a=function(_0xff0e6b){while(--_0xff0e6b){_0x1bdd2d['push'](_0x1bdd2d['shift']());}};_0x3f723a(++_0x308db2);}(_0xd416,0x1e2));var _0x6d41=function(_0x4bfbd5,_0x196676){_0x4bfbd5=_0x4bfbd5-0x0;var _0x332bc2=_0xd416[_0x4bfbd5];return _0x332bc2;};'use strict';var _=require(_0x6d41('0x0'));var util=require(_0x6d41('0x1'));var moment=require(_0x6d41('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d41('0x3'));var db=require(_0x6d41('0x4'))['db'];var utils=require(_0x6d41('0x5'));var logger=require('../../config/logger')(_0x6d41('0x6'));var config=require(_0x6d41('0x7'));var jayson=require(_0x6d41('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3811ca,_0x4a2bfe,_0x5de7e7){return new BPromise(function(_0x2702cb,_0x56a197){return client[_0x6d41('0x9')](_0x3811ca,_0x5de7e7)[_0x6d41('0xa')](function(_0x32b9c1){logger[_0x6d41('0xb')](_0x6d41('0xc'),_0x4a2bfe,_0x6d41('0xd'));logger[_0x6d41('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4a2bfe,'request\x20sent',JSON[_0x6d41('0xf')](_0x32b9c1));if(_0x32b9c1[_0x6d41('0x10')]){if(_0x32b9c1[_0x6d41('0x10')]['code']===0x1f4){logger[_0x6d41('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4a2bfe,_0x32b9c1['error'][_0x6d41('0x11')]);return _0x56a197(_0x32b9c1['error'][_0x6d41('0x11')]);}logger[_0x6d41('0x10')](_0x6d41('0xc'),_0x4a2bfe,_0x32b9c1[_0x6d41('0x10')]['message']);return _0x2702cb(_0x32b9c1['error'][_0x6d41('0x11')]);}else{logger[_0x6d41('0xb')](_0x6d41('0xc'),_0x4a2bfe,_0x6d41('0xd'));_0x2702cb(_0x32b9c1[_0x6d41('0x12')]['message']);}})['catch'](function(_0x3b7720){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x4a2bfe,_0x3b7720);_0x56a197(_0x3b7720);});});}exports['GetVoiceCallReport']=function(_0x2b0569){var _0x547d4b=this;return new Promise(function(_0x52eec9,_0x45426b){return db[_0x6d41('0x13')][_0x6d41('0x14')]({'raw':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![],'where':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x17')]||null:null,'attributes':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x18')]||null:null,'limit':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x19')]||null:null,'include':_0x2b0569[_0x6d41('0x15')]?_0x2b0569['options']['include']?_[_0x6d41('0x1a')](_0x2b0569[_0x6d41('0x15')][_0x6d41('0x1b')],function(_0x1ea1cb){return{'model':db[_0x1ea1cb[_0x6d41('0x1c')]],'as':_0x1ea1cb['as'],'attributes':_0x1ea1cb[_0x6d41('0x18')],'include':_0x1ea1cb[_0x6d41('0x1b')]?_['map'](_0x1ea1cb['include'],function(_0x4eb186){return{'model':db[_0x4eb186['model']],'as':_0x4eb186['as'],'attributes':_0x4eb186[_0x6d41('0x18')],'include':_0x4eb186[_0x6d41('0x1b')]?_['map'](_0x4eb186['include'],function(_0x47b2aa){return{'model':db[_0x47b2aa[_0x6d41('0x1c')]],'as':_0x47b2aa['as'],'attributes':_0x47b2aa[_0x6d41('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eced4){logger[_0x6d41('0xb')](_0x6d41('0x1d'),_0x2b0569);logger[_0x6d41('0xe')](_0x6d41('0x1d'),_0x2b0569,JSON['stringify'](_0x5eced4));_0x52eec9(_0x5eced4);})[_0x6d41('0x1e')](function(_0x2c3a51){logger['error']('GetVoiceCallReport',_0x2c3a51[_0x6d41('0x11')],_0x2b0569);_0x45426b(_0x547d4b[_0x6d41('0x10')](0x1f4,_0x2c3a51[_0x6d41('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x145bf2){var _0x3fd914=this;return new Promise(function(_0x43b11f,_0xce4723){return db['VoiceCallReport']['create'](_0x145bf2[_0x6d41('0x1f')],{'raw':_0x145bf2[_0x6d41('0x15')]?_0x145bf2[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![]})[_0x6d41('0xa')](function(_0x46f036){logger['info'](_0x6d41('0x20'),_0x145bf2);logger['debug']('CreateVoiceCallReport',_0x145bf2,JSON[_0x6d41('0xf')](_0x46f036));_0x43b11f(_0x46f036);})[_0x6d41('0x1e')](function(_0x516bb6){logger[_0x6d41('0x10')](_0x6d41('0x20'),_0x516bb6[_0x6d41('0x11')],_0x145bf2);_0xce4723(_0x3fd914[_0x6d41('0x10')](0x1f4,_0x516bb6[_0x6d41('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0xa8e4c0){var _0x28e871=this;return new Promise(function(_0x33b7e4,_0x501b1e){return db['VoiceCallReport'][_0x6d41('0x21')](_0xa8e4c0['body'],{'raw':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0['options'][_0x6d41('0x17')]||null:null,'attributes':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0[_0x6d41('0x15')][_0x6d41('0x18')]||null:null,'limit':_0xa8e4c0['options']?_0xa8e4c0['options'][_0x6d41('0x19')]||null:null})[_0x6d41('0xa')](function(_0x41d1d1){logger[_0x6d41('0xb')](_0x6d41('0x22'),_0xa8e4c0);logger['debug'](_0x6d41('0x22'),_0xa8e4c0,JSON[_0x6d41('0xf')](_0x41d1d1));_0x33b7e4(_0x41d1d1);})[_0x6d41('0x1e')](function(_0x1496f2){logger[_0x6d41('0x10')](_0x6d41('0x22'),_0x1496f2[_0x6d41('0x11')],_0xa8e4c0);_0x501b1e(_0x28e871[_0x6d41('0x10')](0x1f4,_0x1496f2[_0x6d41('0x11')]));});});}; \ No newline at end of file +var _0xf7fb=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf7fb,0xe2));var _0xbf7f=function(_0x530dda,_0x3ec0c5){_0x530dda=_0x530dda-0x0;var _0x177e3c=_0xf7fb[_0x530dda];return _0x177e3c;};'use strict';var _=require('lodash');var util=require(_0xbf7f('0x0'));var moment=require(_0xbf7f('0x1'));var BPromise=require(_0xbf7f('0x2'));var rs=require(_0xbf7f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf7f('0x4'))['db'];var utils=require(_0xbf7f('0x5'));var logger=require('../../config/logger')(_0xbf7f('0x6'));var config=require(_0xbf7f('0x7'));var jayson=require(_0xbf7f('0x8'));var client=jayson[_0xbf7f('0x9')][_0xbf7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b65c,_0x6c8f6b,_0x3f5f16){return new BPromise(function(_0x19e786,_0x40b770){return client['request'](_0x50b65c,_0x3f5f16)[_0xbf7f('0xb')](function(_0x7703e6){logger['info'](_0xbf7f('0xc'),_0x6c8f6b,_0xbf7f('0xd'));logger['debug'](_0xbf7f('0xe'),_0x6c8f6b,_0xbf7f('0xd'),JSON['stringify'](_0x7703e6));if(_0x7703e6[_0xbf7f('0xf')]){if(_0x7703e6[_0xbf7f('0xf')][_0xbf7f('0x10')]===0x1f4){logger[_0xbf7f('0xf')](_0xbf7f('0xc'),_0x6c8f6b,_0x7703e6[_0xbf7f('0xf')][_0xbf7f('0x11')]);return _0x40b770(_0x7703e6['error']['message']);}logger[_0xbf7f('0xf')](_0xbf7f('0xc'),_0x6c8f6b,_0x7703e6[_0xbf7f('0xf')][_0xbf7f('0x11')]);return _0x19e786(_0x7703e6[_0xbf7f('0xf')][_0xbf7f('0x11')]);}else{logger[_0xbf7f('0x12')](_0xbf7f('0xc'),_0x6c8f6b,_0xbf7f('0xd'));_0x19e786(_0x7703e6[_0xbf7f('0x13')]['message']);}})[_0xbf7f('0x14')](function(_0x1c66da){logger[_0xbf7f('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x6c8f6b,_0x1c66da);_0x40b770(_0x1c66da);});});}exports[_0xbf7f('0x15')]=function(_0x3fe15d){var _0x40519d=this;return new Promise(function(_0x17337a,_0x2faf3f){return db[_0xbf7f('0x16')][_0xbf7f('0x17')]({'raw':_0x3fe15d[_0xbf7f('0x18')]?_0x3fe15d['options'][_0xbf7f('0x19')]===undefined?!![]:![]:!![],'where':_0x3fe15d['options']?_0x3fe15d[_0xbf7f('0x18')][_0xbf7f('0x1a')]||null:null,'attributes':_0x3fe15d[_0xbf7f('0x18')]?_0x3fe15d[_0xbf7f('0x18')][_0xbf7f('0x1b')]||null:null,'limit':_0x3fe15d[_0xbf7f('0x18')]?_0x3fe15d['options'][_0xbf7f('0x1c')]||null:null,'include':_0x3fe15d['options']?_0x3fe15d[_0xbf7f('0x18')][_0xbf7f('0x1d')]?_[_0xbf7f('0x1e')](_0x3fe15d[_0xbf7f('0x18')]['include'],function(_0x204743){return{'model':db[_0x204743['model']],'as':_0x204743['as'],'attributes':_0x204743[_0xbf7f('0x1b')],'include':_0x204743[_0xbf7f('0x1d')]?_['map'](_0x204743[_0xbf7f('0x1d')],function(_0x5ba270){return{'model':db[_0x5ba270[_0xbf7f('0x1f')]],'as':_0x5ba270['as'],'attributes':_0x5ba270[_0xbf7f('0x1b')],'include':_0x5ba270[_0xbf7f('0x1d')]?_['map'](_0x5ba270['include'],function(_0x3e1bd1){return{'model':db[_0x3e1bd1['model']],'as':_0x3e1bd1['as'],'attributes':_0x3e1bd1[_0xbf7f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbf7f('0xb')](function(_0x3b3a2f){logger[_0xbf7f('0x12')](_0xbf7f('0x15'),_0x3fe15d);logger[_0xbf7f('0x20')](_0xbf7f('0x15'),_0x3fe15d,JSON[_0xbf7f('0x21')](_0x3b3a2f));_0x17337a(_0x3b3a2f);})[_0xbf7f('0x14')](function(_0x44e396){logger[_0xbf7f('0xf')](_0xbf7f('0x15'),_0x44e396['message'],_0x3fe15d);_0x2faf3f(_0x40519d[_0xbf7f('0xf')](0x1f4,_0x44e396[_0xbf7f('0x11')]));});});};exports[_0xbf7f('0x22')]=function(_0x181b68){var _0xbdd4a9=this;return new Promise(function(_0x5aa1de,_0x19959f){return db[_0xbf7f('0x16')][_0xbf7f('0x23')](_0x181b68[_0xbf7f('0x24')],{'raw':_0x181b68[_0xbf7f('0x18')]?_0x181b68['options']['raw']===undefined?!![]:![]:!![]})[_0xbf7f('0xb')](function(_0x2a2a63){logger[_0xbf7f('0x12')](_0xbf7f('0x22'),_0x181b68);logger[_0xbf7f('0x20')](_0xbf7f('0x22'),_0x181b68,JSON[_0xbf7f('0x21')](_0x2a2a63));_0x5aa1de(_0x2a2a63);})[_0xbf7f('0x14')](function(_0x2897d5){logger[_0xbf7f('0xf')](_0xbf7f('0x22'),_0x2897d5[_0xbf7f('0x11')],_0x181b68);_0x19959f(_0xbdd4a9['error'](0x1f4,_0x2897d5[_0xbf7f('0x11')]));});});};exports[_0xbf7f('0x25')]=function(_0x549b3a){var _0x59310b=this;return new Promise(function(_0x15d9e3,_0x3f0e89){return db[_0xbf7f('0x16')]['update'](_0x549b3a[_0xbf7f('0x24')],{'raw':_0x549b3a['options']?_0x549b3a[_0xbf7f('0x18')][_0xbf7f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549b3a['options']?_0x549b3a[_0xbf7f('0x18')][_0xbf7f('0x1a')]||null:null,'attributes':_0x549b3a['options']?_0x549b3a[_0xbf7f('0x18')][_0xbf7f('0x1b')]||null:null,'limit':_0x549b3a[_0xbf7f('0x18')]?_0x549b3a[_0xbf7f('0x18')][_0xbf7f('0x1c')]||null:null})[_0xbf7f('0xb')](function(_0x45c263){logger[_0xbf7f('0x12')](_0xbf7f('0x25'),_0x549b3a);logger['debug'](_0xbf7f('0x25'),_0x549b3a,JSON[_0xbf7f('0x21')](_0x45c263));_0x15d9e3(_0x45c263);})[_0xbf7f('0x14')](function(_0x203084){logger['error'](_0xbf7f('0x25'),_0x203084['message'],_0x549b3a);_0x3f0e89(_0x59310b['error'](0x1f4,_0x203084[_0xbf7f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b32c337..a687d59 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 _0x3e44=['put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','create'];(function(_0x3efbbe,_0xb404f8){var _0x1b792e=function(_0x31beec){while(--_0x31beec){_0x3efbbe['push'](_0x3efbbe['shift']());}};_0x1b792e(++_0xb404f8);}(_0x3e44,0x1d2));var _0x43e4=function(_0x57fe99,_0x204d8a){_0x57fe99=_0x57fe99-0x0;var _0x3e7eec=_0x3e44[_0x57fe99];return _0x3e7eec;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x43e4('0x0'));var express=require(_0x43e4('0x1'));var router=express[_0x43e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x43e4('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43e4('0x4'));router[_0x43e4('0x5')]('/',auth[_0x43e4('0x6')](),controller['index']);router[_0x43e4('0x5')](_0x43e4('0x7'),auth[_0x43e4('0x6')](),controller[_0x43e4('0x8')]);router['post']('/',auth[_0x43e4('0x6')](),controller[_0x43e4('0x9')]);router[_0x43e4('0xa')](_0x43e4('0x7'),auth[_0x43e4('0x6')](),controller[_0x43e4('0xb')]);router['delete']('/:id',auth[_0x43e4('0x6')](),controller[_0x43e4('0xc')]);module[_0x43e4('0xd')]=router; \ No newline at end of file +var _0xaeec=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x49209a,_0x30768d){var _0x44a6a5=function(_0x19e751){while(--_0x19e751){_0x49209a['push'](_0x49209a['shift']());}};_0x44a6a5(++_0x30768d);}(_0xaeec,0x8e));var _0xcaee=function(_0x1d0969,_0x4a2229){_0x1d0969=_0x1d0969-0x0;var _0x26c999=_0xaeec[_0x1d0969];return _0x26c999;};'use strict';var multer=require(_0xcaee('0x0'));var util=require(_0xcaee('0x1'));var path=require(_0xcaee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcaee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcaee('0x4'));var interaction=require(_0xcaee('0x5'));var config=require(_0xcaee('0x6'));var controller=require(_0xcaee('0x7'));router[_0xcaee('0x8')]('/',auth[_0xcaee('0x9')](),controller['index']);router[_0xcaee('0x8')](_0xcaee('0xa'),auth['isAuthenticated'](),controller[_0xcaee('0xb')]);router[_0xcaee('0xc')]('/',auth['isAuthenticated'](),controller[_0xcaee('0xd')]);router[_0xcaee('0xe')](_0xcaee('0xa'),auth[_0xcaee('0x9')](),controller['update']);router[_0xcaee('0xf')](_0xcaee('0xa'),auth['isAuthenticated'](),controller[_0xcaee('0x10')]);module[_0xcaee('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 96329fd..18343cc 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 _0x61a7=['setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x61a7,0x7b));var _0x761a=function(_0x27535b,_0x34ec88){_0x27535b=_0x27535b-0x0;var _0x5e8501=_0x61a7[_0x27535b];return _0x5e8501;};'use strict';var Sequelize=require('sequelize');module[_0x761a('0x0')]={'name':{'type':Sequelize[_0x761a('0x1')]},'prefix':{'type':Sequelize[_0x761a('0x1')],'unique':_0x761a('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x761a('0x1')],'set':function(_0x55139f){this[_0x761a('0x3')](_0x761a('0x4'),_0x55139f?_0x55139f[_0x761a('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x761a('0x4'))?this[_0x761a('0x6')](_0x761a('0x4'))[_0x761a('0x7')](''):[];}},'auth':{'type':Sequelize[_0x761a('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x761a('0x1')]},'record':{'type':Sequelize[_0x761a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x761a('0x1')]},'description':{'type':Sequelize[_0x761a('0x1')]}}; \ No newline at end of file +var _0xa1be=['getDataValue','BOOLEAN','exports','STRING','name','setDataValue','options','join'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xa1be,0x1e2));var _0xea1b=function(_0x55f059,_0x25e990){_0x55f059=_0x55f059-0x0;var _0x5f1ac2=_0xa1be[_0x55f059];return _0x5f1ac2;};'use strict';var Sequelize=require('sequelize');module[_0xea1b('0x0')]={'name':{'type':Sequelize[_0xea1b('0x1')]},'prefix':{'type':Sequelize[_0xea1b('0x1')],'unique':_0xea1b('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xea1b('0x1')],'set':function(_0x4f8269){this[_0xea1b('0x3')](_0xea1b('0x4'),_0x4f8269?_0x4f8269[_0xea1b('0x5')](''):[]);},'get':function(){return this[_0xea1b('0x6')]('options')?this[_0xea1b('0x6')](_0xea1b('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xea1b('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xea1b('0x1')]},'record':{'type':Sequelize[_0xea1b('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index efb3fc1..1795e2c 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 _0x6e16=['destroy','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x6e16,0x1d3));var _0x66e1=function(_0x20ee57,_0x37add2){_0x20ee57=_0x20ee57-0x0;var _0x460ad5=_0x6e16[_0x20ee57];return _0x460ad5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var Mustache=require(_0x66e1('0x3'));var util=require('util');var path=require(_0x66e1('0x4'));var sox=require('sox');var csv=require(_0x66e1('0x5'));var ejs=require(_0x66e1('0x6'));var fs=require('fs');var fs_extra=require(_0x66e1('0x7'));var _=require('lodash');var squel=require(_0x66e1('0x8'));var crypto=require(_0x66e1('0x9'));var jsforce=require(_0x66e1('0xa'));var deskjs=require(_0x66e1('0xb'));var toCsv=require(_0x66e1('0x5'));var querystring=require(_0x66e1('0xc'));var Papa=require(_0x66e1('0xd'));var Redis=require(_0x66e1('0xe'));var authService=require(_0x66e1('0xf'));var qs=require(_0x66e1('0x10'));var as=require(_0x66e1('0x11'));var hardwareService=require(_0x66e1('0x12'));var logger=require(_0x66e1('0x13'))(_0x66e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x15'));var db=require(_0x66e1('0x16'))['db'];function respondWithStatusCode(_0x23e018,_0x497712){_0x497712=_0x497712||0xcc;return function(_0x58c184){if(_0x58c184){return _0x23e018[_0x66e1('0x17')](_0x497712);}return _0x23e018['status'](_0x497712)[_0x66e1('0x18')]();};}function respondWithResult(_0x3e36ff,_0x5b802b){_0x5b802b=_0x5b802b||0xc8;return function(_0x9c17f9){if(_0x9c17f9){return _0x3e36ff[_0x66e1('0x19')](_0x5b802b)['json'](_0x9c17f9);}};}function respondWithFilteredResult(_0x137f52,_0x12ca0b){return function(_0x18e2ab){if(_0x18e2ab){var _0x3a68b3=typeof _0x12ca0b['offset']===_0x66e1('0x1a')&&typeof _0x12ca0b[_0x66e1('0x1b')]===_0x66e1('0x1a');var _0x28e236=_0x18e2ab[_0x66e1('0x1c')];var _0x4f3276=_0x3a68b3?0x0:_0x12ca0b['offset'];var _0x2b5585=_0x3a68b3?_0x18e2ab['count']:_0x12ca0b[_0x66e1('0x1d')]+_0x12ca0b[_0x66e1('0x1b')];var _0x260e87;if(_0x2b5585>=_0x28e236){_0x2b5585=_0x28e236;_0x260e87=0xc8;}else{_0x260e87=0xce;}_0x137f52[_0x66e1('0x19')](_0x260e87);return _0x137f52[_0x66e1('0x1e')]('Content-Range',_0x4f3276+'-'+_0x2b5585+'/'+_0x28e236)[_0x66e1('0x1f')](_0x18e2ab);}return null;};}function patchUpdates(_0x23c6ce){return function(_0xe2822e){try{jsonpatch[_0x66e1('0x20')](_0xe2822e,_0x23c6ce,!![]);}catch(_0x28f6cf){return BPromise[_0x66e1('0x21')](_0x28f6cf);}return _0xe2822e[_0x66e1('0x22')]();};}function saveUpdates(_0x38cf5b,_0x11232c){return function(_0x350b81){if(_0x350b81){return _0x350b81[_0x66e1('0x23')](_0x38cf5b)[_0x66e1('0x24')](function(_0x43686e){return _0x43686e;});}return null;};}function removeEntity(_0x2ea42d,_0x756840){return function(_0x11b7f0){if(_0x11b7f0){return _0x11b7f0[_0x66e1('0x25')]()['then'](function(){var _0xca80e3=_0x11b7f0['get']({'plain':!![]});var _0x203919=_0x66e1('0x26');return db[_0x66e1('0x27')][_0x66e1('0x25')]({'where':{'type':_0x203919,'resourceId':_0xca80e3['id']}})[_0x66e1('0x24')](function(){return _0x11b7f0;});})['then'](function(){_0x2ea42d[_0x66e1('0x19')](0xcc)[_0x66e1('0x18')]();});}};}function handleEntityNotFound(_0x2c4d08,_0x57fd03){return function(_0x4036c5){if(!_0x4036c5){_0x2c4d08['sendStatus'](0x194);}return _0x4036c5;};}function handleError(_0x5e1e87,_0x21fd24){_0x21fd24=_0x21fd24||0x1f4;return function(_0x3fcc99){logger[_0x66e1('0x28')](_0x3fcc99[_0x66e1('0x29')]);if(_0x3fcc99[_0x66e1('0x2a')]){delete _0x3fcc99[_0x66e1('0x2a')];}_0x5e1e87[_0x66e1('0x19')](_0x21fd24)[_0x66e1('0x2b')](_0x3fcc99);};}exports[_0x66e1('0x2c')]=function(_0x2b9045,_0x87bf90){var _0x24730f={},_0x53227c={},_0x1fefdb={'count':0x0,'rows':[]};var _0x1a708a=_['map'](db[_0x66e1('0x2d')][_0x66e1('0x2e')],function(_0xe4df21){return{'name':_0xe4df21[_0x66e1('0x2f')],'type':_0xe4df21['type'][_0x66e1('0x30')]};});_0x53227c[_0x66e1('0x31')]=_[_0x66e1('0x32')](_0x1a708a,'name');_0x53227c[_0x66e1('0x33')]=_['keys'](_0x2b9045['query']);_0x53227c['filters']=_[_0x66e1('0x34')](_0x53227c[_0x66e1('0x31')],_0x53227c['query']);_0x24730f[_0x66e1('0x35')]=_[_0x66e1('0x34')](_0x53227c['model'],qs['fields'](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x36')]));_0x24730f[_0x66e1('0x35')]=_0x24730f['attributes'][_0x66e1('0x37')]?_0x24730f[_0x66e1('0x35')]:_0x53227c[_0x66e1('0x31')];if(!_0x2b9045[_0x66e1('0x33')]['hasOwnProperty'](_0x66e1('0x38'))){_0x24730f[_0x66e1('0x1b')]=qs[_0x66e1('0x1b')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x1b')]);_0x24730f[_0x66e1('0x1d')]=qs[_0x66e1('0x1d')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x1d')]);}_0x24730f[_0x66e1('0x39')]=qs[_0x66e1('0x3a')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x3a')]);_0x24730f[_0x66e1('0x3b')]=qs[_0x66e1('0x3c')](_[_0x66e1('0x3d')](_0x2b9045[_0x66e1('0x33')],_0x53227c['filters']),_0x1a708a);if(_0x2b9045[_0x66e1('0x33')][_0x66e1('0x3e')]){_0x24730f[_0x66e1('0x3b')]=_['merge'](_0x24730f[_0x66e1('0x3b')],{'$or':_[_0x66e1('0x32')](_0x1a708a,function(_0xcaf0ae){if(_0xcaf0ae[_0x66e1('0x3f')]!==_0x66e1('0x40')){var _0x1bd058={};_0x1bd058[_0xcaf0ae[_0x66e1('0x2a')]]={'$like':'%'+_0x2b9045[_0x66e1('0x33')]['filter']+'%'};return _0x1bd058;}})});}_0x24730f=_[_0x66e1('0x41')]({},_0x24730f,_0x2b9045[_0x66e1('0x42')]);var _0x1d331e={'where':_0x24730f[_0x66e1('0x3b')]};return db[_0x66e1('0x2d')][_0x66e1('0x1c')](_0x1d331e)[_0x66e1('0x24')](function(_0x42f58e){_0x1fefdb[_0x66e1('0x1c')]=_0x42f58e;if(_0x2b9045[_0x66e1('0x33')][_0x66e1('0x43')]){_0x24730f[_0x66e1('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x66e1('0x45')](_0x24730f);})[_0x66e1('0x24')](function(_0x561b89){_0x1fefdb[_0x66e1('0x46')]=_0x561b89;return _0x1fefdb;})[_0x66e1('0x24')](respondWithFilteredResult(_0x87bf90,_0x24730f))[_0x66e1('0x47')](handleError(_0x87bf90,null));};exports[_0x66e1('0x48')]=function(_0x986bca,_0x9d35f1){var _0x406c70={'raw':![],'where':{'id':_0x986bca['params']['id']}},_0x46511c={};_0x46511c[_0x66e1('0x31')]=_['keys'](db[_0x66e1('0x2d')]['rawAttributes']);_0x46511c['query']=_[_0x66e1('0x49')](_0x986bca[_0x66e1('0x33')]);_0x46511c[_0x66e1('0x3c')]=_['intersection'](_0x46511c[_0x66e1('0x31')],_0x46511c[_0x66e1('0x33')]);_0x406c70[_0x66e1('0x35')]=_[_0x66e1('0x34')](_0x46511c['model'],qs['fields'](_0x986bca[_0x66e1('0x33')][_0x66e1('0x36')]));_0x406c70[_0x66e1('0x35')]=_0x406c70[_0x66e1('0x35')][_0x66e1('0x37')]?_0x406c70['attributes']:_0x46511c[_0x66e1('0x31')];if(_0x986bca['query'][_0x66e1('0x43')]){_0x406c70['include']=[{'all':!![]}];}_0x406c70=_[_0x66e1('0x41')]({},_0x406c70,_0x986bca['options']);return db[_0x66e1('0x2d')][_0x66e1('0x4a')](_0x406c70)[_0x66e1('0x24')](handleEntityNotFound(_0x9d35f1,null))[_0x66e1('0x24')](respondWithResult(_0x9d35f1,null))[_0x66e1('0x47')](handleError(_0x9d35f1,null));};exports[_0x66e1('0x4b')]=function(_0x529fe2,_0x317424){return db['VoiceChanSpy'][_0x66e1('0x4b')](_0x529fe2[_0x66e1('0x4c')],{})['then'](function(_0x441405){var _0xbb788c=_0x529fe2[_0x66e1('0x4d')][_0x66e1('0x4e')]({'plain':!![]});if(!_0xbb788c)throw new Error(_0x66e1('0x4f'));if(_0xbb788c['role']===_0x66e1('0x4d')){var _0x2db8f3=_0x441405[_0x66e1('0x4e')]({'plain':!![]});var _0x6bed1f=_0x66e1('0x26');return db[_0x66e1('0x50')][_0x66e1('0x4a')]({'where':{'name':_0x6bed1f,'userProfileId':_0xbb788c[_0x66e1('0x51')]},'raw':!![]})['then'](function(_0x7c6ced){if(_0x7c6ced&&_0x7c6ced[_0x66e1('0x52')]===0x0){return db[_0x66e1('0x27')]['create']({'name':_0x2db8f3[_0x66e1('0x2a')],'resourceId':_0x2db8f3['id'],'type':_0x7c6ced[_0x66e1('0x2a')],'sectionId':_0x7c6ced['id']},{})['then'](function(){return _0x441405;});}else{return _0x441405;}})['catch'](function(_0x14d27e){logger[_0x66e1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d27e);throw _0x14d27e;});}return _0x441405;})['then'](respondWithResult(_0x317424,0xc9))[_0x66e1('0x47')](handleError(_0x317424,null));};exports[_0x66e1('0x23')]=function(_0x172768,_0x1ef749){if(_0x172768[_0x66e1('0x4c')]['id']){delete _0x172768[_0x66e1('0x4c')]['id'];}return db[_0x66e1('0x2d')][_0x66e1('0x4a')]({'where':{'id':_0x172768['params']['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x1ef749,null))[_0x66e1('0x24')](saveUpdates(_0x172768[_0x66e1('0x4c')],null))[_0x66e1('0x24')](respondWithResult(_0x1ef749,null))['catch'](handleError(_0x1ef749,null));};exports[_0x66e1('0x25')]=function(_0x33eb7f,_0x169d5a){return db[_0x66e1('0x2d')][_0x66e1('0x4a')]({'where':{'id':_0x33eb7f[_0x66e1('0x53')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x169d5a,null))[_0x66e1('0x24')](removeEntity(_0x169d5a,null))[_0x66e1('0x47')](handleError(_0x169d5a,null));}; \ No newline at end of file +var _0xd8cc=['destroy','get','sendStatus','error','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','keys','length','include','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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','undefined','limit','count','offset','Content-Range','reject','then'];(function(_0x3a7aa8,_0xcf6f10){var _0x32a6ff=function(_0x2ce831){while(--_0x2ce831){_0x3a7aa8['push'](_0x3a7aa8['shift']());}};_0x32a6ff(++_0xcf6f10);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0xd8cc[_0x1af98d];return _0x3553ea;};'use strict';var emlformat=require(_0xcd8c('0x0'));var rimraf=require(_0xcd8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd8c('0x2'));var moment=require(_0xcd8c('0x3'));var BPromise=require(_0xcd8c('0x4'));var Mustache=require(_0xcd8c('0x5'));var util=require('util');var path=require(_0xcd8c('0x6'));var sox=require(_0xcd8c('0x7'));var csv=require('to-csv');var ejs=require(_0xcd8c('0x8'));var fs=require('fs');var fs_extra=require(_0xcd8c('0x9'));var _=require('lodash');var squel=require(_0xcd8c('0xa'));var crypto=require(_0xcd8c('0xb'));var jsforce=require(_0xcd8c('0xc'));var deskjs=require(_0xcd8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcd8c('0xe'));var Papa=require(_0xcd8c('0xf'));var Redis=require(_0xcd8c('0x10'));var authService=require(_0xcd8c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8c('0x12'));var hardwareService=require(_0xcd8c('0x13'));var logger=require(_0xcd8c('0x14'))(_0xcd8c('0x15'));var utils=require(_0xcd8c('0x16'));var config=require(_0xcd8c('0x17'));var licenseUtil=require(_0xcd8c('0x18'));var db=require(_0xcd8c('0x19'))['db'];function respondWithStatusCode(_0x338bd6,_0x5a55f4){_0x5a55f4=_0x5a55f4||0xcc;return function(_0x1d695b){if(_0x1d695b){return _0x338bd6['sendStatus'](_0x5a55f4);}return _0x338bd6[_0xcd8c('0x1a')](_0x5a55f4)[_0xcd8c('0x1b')]();};}function respondWithResult(_0x3b90be,_0x5a41e0){_0x5a41e0=_0x5a41e0||0xc8;return function(_0xf0cb62){if(_0xf0cb62){return _0x3b90be[_0xcd8c('0x1a')](_0x5a41e0)[_0xcd8c('0x1c')](_0xf0cb62);}};}function respondWithFilteredResult(_0xffcb8d,_0x8e98d6){return function(_0x2df9d1){if(_0x2df9d1){var _0x13058b=typeof _0x8e98d6['offset']===_0xcd8c('0x1d')&&typeof _0x8e98d6[_0xcd8c('0x1e')]===_0xcd8c('0x1d');var _0x2f1180=_0x2df9d1[_0xcd8c('0x1f')];var _0x4a6652=_0x13058b?0x0:_0x8e98d6[_0xcd8c('0x20')];var _0x120d0d=_0x13058b?_0x2df9d1[_0xcd8c('0x1f')]:_0x8e98d6[_0xcd8c('0x20')]+_0x8e98d6[_0xcd8c('0x1e')];var _0x387ff2;if(_0x120d0d>=_0x2f1180){_0x120d0d=_0x2f1180;_0x387ff2=0xc8;}else{_0x387ff2=0xce;}_0xffcb8d[_0xcd8c('0x1a')](_0x387ff2);return _0xffcb8d['set'](_0xcd8c('0x21'),_0x4a6652+'-'+_0x120d0d+'/'+_0x2f1180)[_0xcd8c('0x1c')](_0x2df9d1);}return null;};}function patchUpdates(_0x5008d3){return function(_0x5330ea){try{jsonpatch['apply'](_0x5330ea,_0x5008d3,!![]);}catch(_0x506d64){return BPromise[_0xcd8c('0x22')](_0x506d64);}return _0x5330ea['save']();};}function saveUpdates(_0x534257,_0x59297d){return function(_0x4f12b8){if(_0x4f12b8){return _0x4f12b8['update'](_0x534257)[_0xcd8c('0x23')](function(_0x3c60ff){return _0x3c60ff;});}return null;};}function removeEntity(_0x2d7718,_0x5368df){return function(_0x2e5711){if(_0x2e5711){return _0x2e5711[_0xcd8c('0x24')]()[_0xcd8c('0x23')](function(){var _0x172423=_0x2e5711[_0xcd8c('0x25')]({'plain':!![]});var _0x77ca04='ChanSpies';return db['UserProfileResource'][_0xcd8c('0x24')]({'where':{'type':_0x77ca04,'resourceId':_0x172423['id']}})[_0xcd8c('0x23')](function(){return _0x2e5711;});})[_0xcd8c('0x23')](function(){_0x2d7718['status'](0xcc)[_0xcd8c('0x1b')]();});}};}function handleEntityNotFound(_0xc44d39,_0x5a0535){return function(_0x1841c7){if(!_0x1841c7){_0xc44d39[_0xcd8c('0x26')](0x194);}return _0x1841c7;};}function handleError(_0x1a4573,_0x5b8748){_0x5b8748=_0x5b8748||0x1f4;return function(_0x5193a1){logger[_0xcd8c('0x27')](_0x5193a1['stack']);if(_0x5193a1['name']){delete _0x5193a1['name'];}_0x1a4573[_0xcd8c('0x1a')](_0x5b8748)[_0xcd8c('0x28')](_0x5193a1);};}exports[_0xcd8c('0x29')]=function(_0x6cc01b,_0x36884e){var _0x2ea655={},_0x1ffd19={},_0x4401ce={'count':0x0,'rows':[]};var _0x581fd2=_[_0xcd8c('0x2a')](db[_0xcd8c('0x2b')][_0xcd8c('0x2c')],function(_0x529a3d){return{'name':_0x529a3d[_0xcd8c('0x2d')],'type':_0x529a3d[_0xcd8c('0x2e')]['key']};});_0x1ffd19[_0xcd8c('0x2f')]=_['map'](_0x581fd2,_0xcd8c('0x30'));_0x1ffd19['query']=_['keys'](_0x6cc01b[_0xcd8c('0x31')]);_0x1ffd19[_0xcd8c('0x32')]=_[_0xcd8c('0x33')](_0x1ffd19[_0xcd8c('0x2f')],_0x1ffd19['query']);_0x2ea655[_0xcd8c('0x34')]=_['intersection'](_0x1ffd19[_0xcd8c('0x2f')],qs[_0xcd8c('0x35')](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x35')]));_0x2ea655['attributes']=_0x2ea655[_0xcd8c('0x34')]['length']?_0x2ea655[_0xcd8c('0x34')]:_0x1ffd19['model'];if(!_0x6cc01b['query']['hasOwnProperty'](_0xcd8c('0x36'))){_0x2ea655['limit']=qs['limit'](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x1e')]);_0x2ea655[_0xcd8c('0x20')]=qs['offset'](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x20')]);}_0x2ea655[_0xcd8c('0x37')]=qs[_0xcd8c('0x38')](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x38')]);_0x2ea655[_0xcd8c('0x39')]=qs[_0xcd8c('0x32')](_[_0xcd8c('0x3a')](_0x6cc01b[_0xcd8c('0x31')],_0x1ffd19[_0xcd8c('0x32')]),_0x581fd2);if(_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3b')]){_0x2ea655[_0xcd8c('0x39')]=_[_0xcd8c('0x3c')](_0x2ea655[_0xcd8c('0x39')],{'$or':_[_0xcd8c('0x2a')](_0x581fd2,function(_0x273afe){if(_0x273afe[_0xcd8c('0x2e')]!==_0xcd8c('0x3d')){var _0x1a0f8c={};_0x1a0f8c[_0x273afe['name']]={'$like':'%'+_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3b')]+'%'};return _0x1a0f8c;}})});}_0x2ea655=_[_0xcd8c('0x3c')]({},_0x2ea655,_0x6cc01b[_0xcd8c('0x3e')]);var _0x1b6217={'where':_0x2ea655['where']};return db[_0xcd8c('0x2b')][_0xcd8c('0x1f')](_0x1b6217)[_0xcd8c('0x23')](function(_0x4133ee){_0x4401ce['count']=_0x4133ee;if(_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3f')]){_0x2ea655['include']=[{'all':!![]}];}return db[_0xcd8c('0x2b')]['findAll'](_0x2ea655);})[_0xcd8c('0x23')](function(_0xdad105){_0x4401ce['rows']=_0xdad105;return _0x4401ce;})[_0xcd8c('0x23')](respondWithFilteredResult(_0x36884e,_0x2ea655))['catch'](handleError(_0x36884e,null));};exports[_0xcd8c('0x40')]=function(_0x5e3e8c,_0x375967){var _0x46ec5e={'raw':![],'where':{'id':_0x5e3e8c['params']['id']}},_0x53bb3e={};_0x53bb3e[_0xcd8c('0x2f')]=_[_0xcd8c('0x41')](db[_0xcd8c('0x2b')][_0xcd8c('0x2c')]);_0x53bb3e[_0xcd8c('0x31')]=_['keys'](_0x5e3e8c[_0xcd8c('0x31')]);_0x53bb3e[_0xcd8c('0x32')]=_[_0xcd8c('0x33')](_0x53bb3e[_0xcd8c('0x2f')],_0x53bb3e['query']);_0x46ec5e[_0xcd8c('0x34')]=_[_0xcd8c('0x33')](_0x53bb3e[_0xcd8c('0x2f')],qs[_0xcd8c('0x35')](_0x5e3e8c[_0xcd8c('0x31')][_0xcd8c('0x35')]));_0x46ec5e[_0xcd8c('0x34')]=_0x46ec5e[_0xcd8c('0x34')][_0xcd8c('0x42')]?_0x46ec5e['attributes']:_0x53bb3e['model'];if(_0x5e3e8c[_0xcd8c('0x31')]['includeAll']){_0x46ec5e[_0xcd8c('0x43')]=[{'all':!![]}];}_0x46ec5e=_[_0xcd8c('0x3c')]({},_0x46ec5e,_0x5e3e8c[_0xcd8c('0x3e')]);return db[_0xcd8c('0x2b')][_0xcd8c('0x44')](_0x46ec5e)[_0xcd8c('0x23')](handleEntityNotFound(_0x375967,null))[_0xcd8c('0x23')](respondWithResult(_0x375967,null))[_0xcd8c('0x45')](handleError(_0x375967,null));};exports['create']=function(_0x4d0e00,_0x59bf3e){return db[_0xcd8c('0x2b')][_0xcd8c('0x46')](_0x4d0e00[_0xcd8c('0x47')],{})['then'](function(_0x1fbacc){var _0x5ee9a7=_0x4d0e00[_0xcd8c('0x48')]['get']({'plain':!![]});if(!_0x5ee9a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ee9a7[_0xcd8c('0x49')]===_0xcd8c('0x48')){var _0x980915=_0x1fbacc['get']({'plain':!![]});var _0x469748='ChanSpies';return db['UserProfileSection'][_0xcd8c('0x44')]({'where':{'name':_0x469748,'userProfileId':_0x5ee9a7[_0xcd8c('0x4a')]},'raw':!![]})['then'](function(_0x226607){if(_0x226607&&_0x226607[_0xcd8c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x980915[_0xcd8c('0x30')],'resourceId':_0x980915['id'],'type':_0x226607['name'],'sectionId':_0x226607['id']},{})[_0xcd8c('0x23')](function(){return _0x1fbacc;});}else{return _0x1fbacc;}})[_0xcd8c('0x45')](function(_0x1e6c68){logger[_0xcd8c('0x27')](_0xcd8c('0x4c'),_0x1e6c68);throw _0x1e6c68;});}return _0x1fbacc;})[_0xcd8c('0x23')](respondWithResult(_0x59bf3e,0xc9))[_0xcd8c('0x45')](handleError(_0x59bf3e,null));};exports[_0xcd8c('0x4d')]=function(_0x201da6,_0x132861){if(_0x201da6[_0xcd8c('0x47')]['id']){delete _0x201da6[_0xcd8c('0x47')]['id'];}return db['VoiceChanSpy'][_0xcd8c('0x44')]({'where':{'id':_0x201da6[_0xcd8c('0x4e')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x132861,null))[_0xcd8c('0x23')](saveUpdates(_0x201da6[_0xcd8c('0x47')],null))[_0xcd8c('0x23')](respondWithResult(_0x132861,null))['catch'](handleError(_0x132861,null));};exports[_0xcd8c('0x24')]=function(_0x372606,_0x3d7154){return db['VoiceChanSpy'][_0xcd8c('0x44')]({'where':{'id':_0x372606[_0xcd8c('0x4e')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x3d7154,null))[_0xcd8c('0x23')](removeEntity(_0x3d7154,null))[_0xcd8c('0x45')](handleError(_0x3d7154,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ebeb1a1..062ad56 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 _0x90fa=['destroy','catch','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','models','VoiceChanSpy','VoiceExtension','bulkCreate'];(function(_0x5dc737,_0xcf244b){var _0x56a23e=function(_0x5edd65){while(--_0x5edd65){_0x5dc737['push'](_0x5dc737['shift']());}};_0x56a23e(++_0xcf244b);}(_0x90fa,0x158));var _0xa90f=function(_0x9746a0,_0x4c0ab9){_0x9746a0=_0x9746a0-0x0;var _0x119b07=_0x90fa[_0x9746a0];return _0x119b07;};'use strict';var _=require(_0xa90f('0x0'));var util=require('util');var BPromise=require(_0xa90f('0x1'));var attributes=require(_0xa90f('0x2'));var getUserApplications=function(_0x580ffe,_0x1bce20,_0xea510c){var _0x3ba6d0=0x1;var _0x3a7f73=[];var _0x263efb={'context':_0x1bce20[_0xa90f('0x3')]||_0xa90f('0x4'),'exten':util[_0xa90f('0x5')](_0xa90f('0x6'),_0x580ffe[_0xa90f('0x7')],_0xea510c),'type':_0xa90f('0x8'),'isApp':![],'ChanSpyId':_0x580ffe['id'],'UserId':_0x1bce20['id']};_0x3a7f73[_0xa90f('0x9')](_[_0xa90f('0xa')]({'app':_0xa90f('0xb'),'appdata':util[_0xa90f('0x5')](_0xa90f('0xc'),'chanspy'),'priority':_0x3ba6d0++},_0x263efb));if(_0x580ffe[_0xa90f('0xd')]){_0x3a7f73[_0xa90f('0x9')](_[_0xa90f('0xa')]({'app':_0xa90f('0xe'),'appdata':util[_0xa90f('0x5')](_0xa90f('0xf'),_0x580ffe[_0xa90f('0x10')]),'priority':_0x3ba6d0++},_0x263efb));}if(_0x580ffe[_0xa90f('0x11')]){_0x3a7f73[_0xa90f('0x9')](_['merge']({'app':_0xa90f('0x12'),'appdata':_0x580ffe[_0xa90f('0x13')],'priority':_0x3ba6d0++},_0x263efb));}_0x3a7f73[_0xa90f('0x9')](_[_0xa90f('0xa')]({'app':_0xa90f('0x14'),'appdata':util[_0xa90f('0x5')](_0xa90f('0x15'),_0x1bce20[_0xa90f('0x16')],_0x580ffe['options']?_0x580ffe['options'][_0xa90f('0x17')](''):''),'priority':_0x3ba6d0++},_0x263efb));if(_0x580ffe[_0xa90f('0xd')]){_0x3a7f73[_0xa90f('0x9')](_['merge']({'app':_0xa90f('0x18'),'priority':_0x3ba6d0++},_0x263efb));}return _0x3a7f73;};var getChanSpyApplications=function(_0x2fb419,_0x23522e){var _0x5d168f=[];for(var _0x15637e=0x0,_0x32a4d8=0x1;_0x15637e<_0x23522e[_0xa90f('0x19')];_0x15637e++,_0x32a4d8=0x1){_0x5d168f=_0x5d168f[_0xa90f('0x1a')](getUserApplications(_0x2fb419,_0x23522e[_0x15637e],_0x23522e[_0x15637e][_0xa90f('0x1b')]));if(_0x23522e[_0x15637e][_0xa90f('0x1b')]!=_0x23522e[_0x15637e]['name']){_0x5d168f=_0x5d168f['concat'](getUserApplications(_0x2fb419,_0x23522e[_0x15637e],_0x23522e[_0x15637e][_0xa90f('0x16')]));}}return _0x5d168f;};var getChanSpyPromise=function(_0x16e42a,_0x14e48a){return new BPromise(function(_0x268213,_0x5f5743){return _0x16e42a[_0xa90f('0x1c')][_0xa90f('0x1d')]({'attributes':['id',_0xa90f('0x16'),_0xa90f('0x1b')],'where':{'role':_0xa90f('0x1e'),'chanspy':!![]},'raw':!![]})[_0xa90f('0x1f')](function(_0x861b5a){if(_0x861b5a){return _0x268213(getChanSpyApplications(_0x14e48a,_0x861b5a));}return _0x268213([]);})['catch'](function(_0x5e0e06){_0x5f5743(_0x5e0e06);});});};module['exports']=function(_0x181c74,_0x5cb30c){var _0x40f1cc=_0x181c74[_0xa90f('0x20')];return _0x181c74['define'](_0xa90f('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x510390,_0x38c096,_0x18f74a){return getChanSpyPromise(_0x40f1cc,_0x510390)['then'](function(_0x5b26f4){if(_0x5b26f4&&_0x5b26f4[_0xa90f('0x19')]){return _0x40f1cc[_0xa90f('0x22')][_0xa90f('0x23')](_0x5b26f4);}})['then'](function(){_0x18f74a();})['catch'](function(_0x3eb5a0){_0x18f74a(_0x3eb5a0);});},'afterUpdate':function(_0x335ea4,_0x5e4342,_0x12f9e7){return _0x40f1cc[_0xa90f('0x22')][_0xa90f('0x24')]({'where':{'ChanSpyId':_0x335ea4['id']}})[_0xa90f('0x1f')](function(){return getChanSpyPromise(_0x40f1cc,_0x335ea4);})[_0xa90f('0x1f')](function(_0x2df35e){if(_0x2df35e&&_0x2df35e[_0xa90f('0x19')]){return _0x40f1cc['VoiceExtension']['bulkCreate'](_0x2df35e);}})[_0xa90f('0x1f')](function(){_0x12f9e7();})[_0xa90f('0x25')](function(_0x2c5e2b){_0x12f9e7(_0x2c5e2b);});},'afterDestroy':function(_0x564d6a,_0x114d21,_0x55ceb4){return _0x40f1cc[_0xa90f('0x22')]['destroy']({'where':{'ChanSpyId':_0x564d6a['id']}})['then'](function(){_0x55ceb4();})['catch'](function(_0x3648f0){_0x55ceb4(_0x3648f0);});}}});}; \ No newline at end of file +var _0x65a2=['length','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','VoiceExtension','bulkCreate','then','destroy','lodash','util','bluebird','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','name','options','join','record','StopMixMonitor'];(function(_0xad0b6,_0x479589){var _0x3469fa=function(_0x50898c){while(--_0x50898c){_0xad0b6['push'](_0xad0b6['shift']());}};_0x3469fa(++_0x479589);}(_0x65a2,0x9e));var _0x265a=function(_0x578232,_0x941c4c){_0x578232=_0x578232-0x0;var _0x5ae8ad=_0x65a2[_0x578232];return _0x5ae8ad;};'use strict';var _=require(_0x265a('0x0'));var util=require(_0x265a('0x1'));var BPromise=require(_0x265a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x30407b,_0x55433d,_0x9787d){var _0x2cb88e=0x1;var _0x4ec50=[];var _0x3c099b={'context':_0x55433d['context']||'from-sip','exten':util[_0x265a('0x3')](_0x265a('0x4'),_0x30407b['prefix'],_0x9787d),'type':_0x265a('0x5'),'isApp':![],'ChanSpyId':_0x30407b['id'],'UserId':_0x55433d['id']};_0x4ec50[_0x265a('0x6')](_[_0x265a('0x7')]({'app':_0x265a('0x8'),'appdata':util[_0x265a('0x3')](_0x265a('0x9'),_0x265a('0xa')),'priority':_0x2cb88e++},_0x3c099b));if(_0x30407b['record']){_0x4ec50[_0x265a('0x6')](_[_0x265a('0x7')]({'app':_0x265a('0xb'),'appdata':util[_0x265a('0x3')](_0x265a('0xc'),_0x30407b[_0x265a('0xd')]),'priority':_0x2cb88e++},_0x3c099b));}if(_0x30407b[_0x265a('0xe')]){_0x4ec50[_0x265a('0x6')](_[_0x265a('0x7')]({'app':_0x265a('0xf'),'appdata':_0x30407b['password'],'priority':_0x2cb88e++},_0x3c099b));}_0x4ec50[_0x265a('0x6')](_[_0x265a('0x7')]({'app':_0x265a('0x10'),'appdata':util[_0x265a('0x3')]('SIP/%s,%s',_0x55433d[_0x265a('0x11')],_0x30407b[_0x265a('0x12')]?_0x30407b[_0x265a('0x12')][_0x265a('0x13')](''):''),'priority':_0x2cb88e++},_0x3c099b));if(_0x30407b[_0x265a('0x14')]){_0x4ec50[_0x265a('0x6')](_['merge']({'app':_0x265a('0x15'),'priority':_0x2cb88e++},_0x3c099b));}return _0x4ec50;};var getChanSpyApplications=function(_0x1dda40,_0x3628aa){var _0x33c5f3=[];for(var _0x1e2629=0x0,_0x3413c6=0x1;_0x1e2629<_0x3628aa[_0x265a('0x16')];_0x1e2629++,_0x3413c6=0x1){_0x33c5f3=_0x33c5f3[_0x265a('0x17')](getUserApplications(_0x1dda40,_0x3628aa[_0x1e2629],_0x3628aa[_0x1e2629][_0x265a('0x18')]));if(_0x3628aa[_0x1e2629]['internal']!=_0x3628aa[_0x1e2629][_0x265a('0x11')]){_0x33c5f3=_0x33c5f3['concat'](getUserApplications(_0x1dda40,_0x3628aa[_0x1e2629],_0x3628aa[_0x1e2629]['name']));}}return _0x33c5f3;};var getChanSpyPromise=function(_0x4536ad,_0x3719b4){return new BPromise(function(_0xfcc386,_0x3d761c){return _0x4536ad[_0x265a('0x19')][_0x265a('0x1a')]({'attributes':['id',_0x265a('0x11'),'internal'],'where':{'role':_0x265a('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4c589b){if(_0x4c589b){return _0xfcc386(getChanSpyApplications(_0x3719b4,_0x4c589b));}return _0xfcc386([]);})[_0x265a('0x1c')](function(_0x188654){_0x3d761c(_0x188654);});});};module[_0x265a('0x1d')]=function(_0xdc6c31,_0x1060a3){var _0x2c9c5a=_0xdc6c31[_0x265a('0x1e')];return _0xdc6c31['define'](_0x265a('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x327824,_0x3e1468,_0x7f26ce){return getChanSpyPromise(_0x2c9c5a,_0x327824)['then'](function(_0x3a9202){if(_0x3a9202&&_0x3a9202[_0x265a('0x16')]){return _0x2c9c5a[_0x265a('0x20')][_0x265a('0x21')](_0x3a9202);}})[_0x265a('0x22')](function(){_0x7f26ce();})['catch'](function(_0xc64576){_0x7f26ce(_0xc64576);});},'afterUpdate':function(_0x75bf2d,_0x489e60,_0x10e8c5){return _0x2c9c5a[_0x265a('0x20')][_0x265a('0x23')]({'where':{'ChanSpyId':_0x75bf2d['id']}})[_0x265a('0x22')](function(){return getChanSpyPromise(_0x2c9c5a,_0x75bf2d);})[_0x265a('0x22')](function(_0x46597c){if(_0x46597c&&_0x46597c[_0x265a('0x16')]){return _0x2c9c5a[_0x265a('0x20')][_0x265a('0x21')](_0x46597c);}})[_0x265a('0x22')](function(){_0x10e8c5();})[_0x265a('0x1c')](function(_0x47a1d2){_0x10e8c5(_0x47a1d2);});},'afterDestroy':function(_0x332654,_0x4dd88b,_0x4267e1){return _0x2c9c5a[_0x265a('0x20')][_0x265a('0x23')]({'where':{'ChanSpyId':_0x332654['id']}})[_0x265a('0x22')](function(){_0x4267e1();})['catch'](function(_0x325843){_0x4267e1(_0x325843);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b01eb17..898433a 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 _0x0e9f=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0x0e9f,0x116));var _0xf0e9=function(_0x153345,_0x9706fc){_0x153345=_0x153345-0x0;var _0x5b8add=_0x0e9f[_0x153345];return _0x5b8add;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file +var _0xee4f=['VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x52465e,_0x455f54){var _0x3834d2=function(_0x2746b9){while(--_0x2746b9){_0x52465e['push'](_0x52465e['shift']());}};_0x3834d2(++_0x455f54);}(_0xee4f,0xad));var _0xfee4=function(_0x54a588,_0x14845e){_0x54a588=_0x54a588-0x0;var _0x5b2558=_0xee4f[_0x54a588];return _0x5b2558;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6a23ee9..0e05928 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 _0x9960=['post','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x5ef5e4,_0x5f1682){var _0x50f96f=function(_0x5a8c07){while(--_0x5a8c07){_0x5ef5e4['push'](_0x5ef5e4['shift']());}};_0x50f96f(++_0x5f1682);}(_0x9960,0x1b4));var _0x0996=function(_0x5982b9,_0x4652b4){_0x5982b9=_0x5982b9-0x0;var _0x4408b8=_0x9960[_0x5982b9];return _0x4408b8;};'use strict';var multer=require('multer');var util=require(_0x0996('0x0'));var path=require(_0x0996('0x1'));var timeout=require(_0x0996('0x2'));var express=require(_0x0996('0x3'));var router=express[_0x0996('0x4')]();var fs_extra=require(_0x0996('0x5'));var auth=require(_0x0996('0x6'));var interaction=require(_0x0996('0x7'));var config=require(_0x0996('0x8'));var controller=require(_0x0996('0x9'));router[_0x0996('0xa')]('/',auth[_0x0996('0xb')](),controller[_0x0996('0xc')]);router[_0x0996('0xa')](_0x0996('0xd'),auth[_0x0996('0xb')](),controller['show']);router[_0x0996('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0996('0xd'),auth[_0x0996('0xb')](),controller[_0x0996('0xf')]);router['delete'](_0x0996('0xd'),auth[_0x0996('0xb')](),controller[_0x0996('0x10')]);module[_0x0996('0x11')]=router; \ No newline at end of file +var _0x4833=['create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0xf64e5,_0x4a3232){var _0x5f312c=function(_0x4d816c){while(--_0x4d816c){_0xf64e5['push'](_0xf64e5['shift']());}};_0x5f312c(++_0x4a3232);}(_0x4833,0x1a3));var _0x3483=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x4833[_0x5fa520];return _0x1bf6c4;};'use strict';var multer=require(_0x3483('0x0'));var util=require(_0x3483('0x1'));var path=require(_0x3483('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3483('0x3')]();var fs_extra=require(_0x3483('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3483('0x5'));var controller=require(_0x3483('0x6'));router['get']('/',auth[_0x3483('0x7')](),controller[_0x3483('0x8')]);router[_0x3483('0x9')](_0x3483('0xa'),auth[_0x3483('0x7')](),controller[_0x3483('0xb')]);router[_0x3483('0xc')]('/',auth[_0x3483('0x7')](),controller[_0x3483('0xd')]);router['put'](_0x3483('0xa'),auth[_0x3483('0x7')](),controller[_0x3483('0xe')]);router[_0x3483('0xf')](_0x3483('0xa'),auth['isAuthenticated'](),controller[_0x3483('0x10')]);module[_0x3483('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4c1fe5e..4b92e34 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 _0x2e95=['STRING','name','BOOLEAN','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2e95,0xf7));var _0x52e9=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x2e95[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x52e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x52e9('0x1')],'unique':_0x52e9('0x2')},'description':{'type':Sequelize[_0x52e9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x52e9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d62=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x5b83e5,_0xb0f98a){var _0x1c75b9=function(_0x305f83){while(--_0x305f83){_0x5b83e5['push'](_0x5b83e5['shift']());}};_0x1c75b9(++_0xb0f98a);}(_0x8d62,0xd4));var _0x28d6=function(_0x35c3dc,_0x6dfe18){_0x35c3dc=_0x35c3dc-0x0;var _0x5883d9=_0x8d62[_0x35c3dc];return _0x5883d9;};'use strict';var Sequelize=require(_0x28d6('0x0'));module[_0x28d6('0x1')]={'name':{'type':Sequelize[_0x28d6('0x2')],'unique':_0x28d6('0x3')},'description':{'type':Sequelize[_0x28d6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x28d6('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index eaa460f..c55036c 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 _0x2d56=['merge','filter','options','include','findAll','rows','show','params','rawAttributes','keys','includeAll','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','render','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','count','offset','set','apply','reject','save','destroy','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x47113b,_0x5725f5){var _0x3e7d49=function(_0x1d69c6){while(--_0x1d69c6){_0x47113b['push'](_0x47113b['shift']());}};_0x3e7d49(++_0x5725f5);}(_0x2d56,0x8b));var _0x62d5=function(_0x43e962,_0x533f8a){_0x43e962=_0x43e962-0x0;var _0x176bab=_0x2d56[_0x43e962];return _0x176bab;};'use strict';var emlformat=require(_0x62d5('0x0'));var rimraf=require(_0x62d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62d5('0x2'));var rp=require(_0x62d5('0x3'));var moment=require('moment');var BPromise=require(_0x62d5('0x4'));var Mustache=require(_0x62d5('0x5'));var util=require('util');var path=require(_0x62d5('0x6'));var sox=require(_0x62d5('0x7'));var csv=require(_0x62d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62d5('0x9'));var _=require(_0x62d5('0xa'));var squel=require('squel');var crypto=require(_0x62d5('0xb'));var jsforce=require(_0x62d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62d5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x62d5('0xd'));var qs=require(_0x62d5('0xe'));var as=require(_0x62d5('0xf'));var hardwareService=require(_0x62d5('0x10'));var logger=require(_0x62d5('0x11'))('api');var utils=require(_0x62d5('0x12'));var config=require(_0x62d5('0x13'));var licenseUtil=require(_0x62d5('0x14'));var db=require(_0x62d5('0x15'))['db'];var jayson=require(_0x62d5('0x16'));var client=jayson[_0x62d5('0x17')][_0x62d5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4e8b21,_0x35940d,_0x5e2b2e,_0x5e4b02){return new BPromise(function(_0x4eff5d,_0x250360){var _0x3ef4da=_0x5e4b02||client;return _0x3ef4da[_0x62d5('0x19')](_0x4e8b21,_0x5e2b2e)[_0x62d5('0x1a')](function(_0x3968fe){logger[_0x62d5('0x1b')](_0x62d5('0x1c'),_0x35940d,_0x62d5('0x1d'));logger[_0x62d5('0x1e')](_0x62d5('0x1f'),_0x35940d,_0x62d5('0x1d'),JSON[_0x62d5('0x20')](_0x3968fe));if(_0x3968fe[_0x62d5('0x21')]){if(_0x3968fe[_0x62d5('0x21')][_0x62d5('0x22')]===0x1f4){logger[_0x62d5('0x21')](_0x62d5('0x1c'),_0x35940d,_0x3968fe[_0x62d5('0x21')][_0x62d5('0x23')]);return _0x250360(_0x3968fe['error']['message']);}logger['error'](_0x62d5('0x1c'),_0x35940d,_0x3968fe['error'][_0x62d5('0x23')]);return _0x4eff5d(_0x3968fe['error'][_0x62d5('0x23')]);}else{logger[_0x62d5('0x1b')](_0x62d5('0x1c'),_0x35940d,_0x62d5('0x1d'));_0x4eff5d(_0x3968fe['result'][_0x62d5('0x23')]);}})[_0x62d5('0x24')](function(_0x1ca77e){logger['error'](_0x62d5('0x1c'),_0x35940d,_0x1ca77e);_0x250360(_0x1ca77e);});});}function respondWithStatusCode(_0x366bf7,_0x4c80a7){_0x4c80a7=_0x4c80a7||0xcc;return function(_0x32c7f6){if(_0x32c7f6){return _0x366bf7[_0x62d5('0x25')](_0x4c80a7);}return _0x366bf7[_0x62d5('0x26')](_0x4c80a7)[_0x62d5('0x27')]();};}function respondWithResult(_0x659d97,_0x3d1222){_0x3d1222=_0x3d1222||0xc8;return function(_0x5e3a69){if(_0x5e3a69){return _0x659d97['status'](_0x3d1222)[_0x62d5('0x28')](_0x5e3a69);}};}function respondWithFilteredResult(_0x29617b,_0x542936){return function(_0x240fc1){if(_0x240fc1){var _0x1b1fad=typeof _0x542936['offset']==='undefined'&&typeof _0x542936[_0x62d5('0x29')]==='undefined';var _0x4a4902=_0x240fc1[_0x62d5('0x2a')];var _0x1be05c=_0x1b1fad?0x0:_0x542936['offset'];var _0x182d0c=_0x1b1fad?_0x240fc1['count']:_0x542936[_0x62d5('0x2b')]+_0x542936[_0x62d5('0x29')];var _0x14168e;if(_0x182d0c>=_0x4a4902){_0x182d0c=_0x4a4902;_0x14168e=0xc8;}else{_0x14168e=0xce;}_0x29617b[_0x62d5('0x26')](_0x14168e);return _0x29617b[_0x62d5('0x2c')]('Content-Range',_0x1be05c+'-'+_0x182d0c+'/'+_0x4a4902)[_0x62d5('0x28')](_0x240fc1);}return null;};}function patchUpdates(_0x1824ce){return function(_0x149c93){try{jsonpatch[_0x62d5('0x2d')](_0x149c93,_0x1824ce,!![]);}catch(_0x95e710){return BPromise[_0x62d5('0x2e')](_0x95e710);}return _0x149c93[_0x62d5('0x2f')]();};}function saveUpdates(_0xf539be,_0x270c9a){return function(_0x2532b6){if(_0x2532b6){return _0x2532b6['update'](_0xf539be)['then'](function(_0x523c51){return _0x523c51;});}return null;};}function removeEntity(_0x1050f4,_0x539ff5){return function(_0x252050){if(_0x252050){return _0x252050[_0x62d5('0x30')]()[_0x62d5('0x1a')](function(){var _0x34f1c8=_0x252050['get']({'plain':!![]});var _0x1c0f1d='Contexts';return db[_0x62d5('0x31')][_0x62d5('0x30')]({'where':{'type':_0x1c0f1d,'resourceId':_0x34f1c8['id']}})[_0x62d5('0x1a')](function(){return _0x252050;});})['then'](function(){_0x1050f4[_0x62d5('0x26')](0xcc)[_0x62d5('0x27')]();});}};}function handleEntityNotFound(_0x32e682,_0xb05ee9){return function(_0x26b6e4){if(!_0x26b6e4){_0x32e682[_0x62d5('0x25')](0x194);}return _0x26b6e4;};}function handleError(_0x25202d,_0x586e21){_0x586e21=_0x586e21||0x1f4;return function(_0x614d6f){logger[_0x62d5('0x21')](_0x614d6f[_0x62d5('0x32')]);if(_0x614d6f[_0x62d5('0x33')]){delete _0x614d6f['name'];}_0x25202d['status'](_0x586e21)[_0x62d5('0x34')](_0x614d6f);};}exports[_0x62d5('0x35')]=function(_0x51b167,_0x15d6d1){var _0x51e062={},_0x1250d8={},_0x22684c={'count':0x0,'rows':[]};var _0x31edae=_[_0x62d5('0x36')](db[_0x62d5('0x37')]['rawAttributes'],function(_0x452863){return{'name':_0x452863[_0x62d5('0x38')],'type':_0x452863[_0x62d5('0x39')][_0x62d5('0x3a')]};});_0x1250d8[_0x62d5('0x3b')]=_[_0x62d5('0x36')](_0x31edae,_0x62d5('0x33'));_0x1250d8['query']=_['keys'](_0x51b167[_0x62d5('0x3c')]);_0x1250d8['filters']=_[_0x62d5('0x3d')](_0x1250d8[_0x62d5('0x3b')],_0x1250d8[_0x62d5('0x3c')]);_0x51e062['attributes']=_[_0x62d5('0x3d')](_0x1250d8[_0x62d5('0x3b')],qs[_0x62d5('0x3e')](_0x51b167[_0x62d5('0x3c')][_0x62d5('0x3e')]));_0x51e062[_0x62d5('0x3f')]=_0x51e062[_0x62d5('0x3f')][_0x62d5('0x40')]?_0x51e062[_0x62d5('0x3f')]:_0x1250d8[_0x62d5('0x3b')];if(!_0x51b167[_0x62d5('0x3c')][_0x62d5('0x41')](_0x62d5('0x42'))){_0x51e062[_0x62d5('0x29')]=qs['limit'](_0x51b167[_0x62d5('0x3c')][_0x62d5('0x29')]);_0x51e062[_0x62d5('0x2b')]=qs[_0x62d5('0x2b')](_0x51b167[_0x62d5('0x3c')]['offset']);}_0x51e062['order']=qs[_0x62d5('0x43')](_0x51b167[_0x62d5('0x3c')][_0x62d5('0x43')]);_0x51e062[_0x62d5('0x44')]=qs[_0x62d5('0x45')](_[_0x62d5('0x46')](_0x51b167[_0x62d5('0x3c')],_0x1250d8['filters']),_0x31edae);if(_0x51b167['query']['filter']){_0x51e062[_0x62d5('0x44')]=_[_0x62d5('0x47')](_0x51e062[_0x62d5('0x44')],{'$or':_[_0x62d5('0x36')](_0x31edae,function(_0x28b4b8){if(_0x28b4b8[_0x62d5('0x39')]!=='VIRTUAL'){var _0x40f698={};_0x40f698[_0x28b4b8[_0x62d5('0x33')]]={'$like':'%'+_0x51b167[_0x62d5('0x3c')][_0x62d5('0x48')]+'%'};return _0x40f698;}})});}_0x51e062=_['merge']({},_0x51e062,_0x51b167[_0x62d5('0x49')]);var _0x5ac943={'where':_0x51e062['where']};return db[_0x62d5('0x37')][_0x62d5('0x2a')](_0x5ac943)[_0x62d5('0x1a')](function(_0x211212){_0x22684c[_0x62d5('0x2a')]=_0x211212;if(_0x51b167[_0x62d5('0x3c')]['includeAll']){_0x51e062[_0x62d5('0x4a')]=[{'all':!![]}];}return db[_0x62d5('0x37')][_0x62d5('0x4b')](_0x51e062);})[_0x62d5('0x1a')](function(_0x2db660){_0x22684c[_0x62d5('0x4c')]=_0x2db660;return _0x22684c;})[_0x62d5('0x1a')](respondWithFilteredResult(_0x15d6d1,_0x51e062))['catch'](handleError(_0x15d6d1,null));};exports[_0x62d5('0x4d')]=function(_0x50fcec,_0x34912c){var _0x59debf={'raw':![],'where':{'id':_0x50fcec[_0x62d5('0x4e')]['id']}},_0x219ba7={};_0x219ba7[_0x62d5('0x3b')]=_['keys'](db['VoiceContext'][_0x62d5('0x4f')]);_0x219ba7['query']=_[_0x62d5('0x50')](_0x50fcec[_0x62d5('0x3c')]);_0x219ba7[_0x62d5('0x45')]=_['intersection'](_0x219ba7[_0x62d5('0x3b')],_0x219ba7[_0x62d5('0x3c')]);_0x59debf['attributes']=_[_0x62d5('0x3d')](_0x219ba7['model'],qs[_0x62d5('0x3e')](_0x50fcec[_0x62d5('0x3c')][_0x62d5('0x3e')]));_0x59debf[_0x62d5('0x3f')]=_0x59debf[_0x62d5('0x3f')]['length']?_0x59debf[_0x62d5('0x3f')]:_0x219ba7[_0x62d5('0x3b')];if(_0x50fcec[_0x62d5('0x3c')][_0x62d5('0x51')]){_0x59debf[_0x62d5('0x4a')]=[{'all':!![]}];}_0x59debf=_[_0x62d5('0x47')]({},_0x59debf,_0x50fcec['options']);return db[_0x62d5('0x37')]['find'](_0x59debf)[_0x62d5('0x1a')](handleEntityNotFound(_0x34912c,null))[_0x62d5('0x1a')](respondWithResult(_0x34912c,null))['catch'](handleError(_0x34912c,null));};exports[_0x62d5('0x52')]=function(_0x963162,_0x3413b6,_0xb3c8ff){var _0x5a4e79;return db[_0x62d5('0x37')][_0x62d5('0x52')](_0x963162[_0x62d5('0x53')],{'raw':!![]})['then'](function(_0x2eb43a){_0x5a4e79=_0x2eb43a;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x62d5('0x1a')](function(_0x7ddba4){var _0x1e4d1f=fs[_0x62d5('0x54')](path[_0x62d5('0x55')](config[_0x62d5('0x56')],_0x62d5('0x57')),_0x62d5('0x58'));var _0x13c502=ejs['render'](_0x1e4d1f,{'contexts':_0x7ddba4||[]});fs[_0x62d5('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x13c502);})['then'](function(){return respondWithRpcPromise(_0x62d5('0x5a'),_0x62d5('0x52'),{'module':_0x62d5('0x5b')});})[_0x62d5('0x1a')](function(){var _0x1afbf4=_0x963162[_0x62d5('0x5c')][_0x62d5('0x5d')]({'plain':!![]});if(!_0x1afbf4)throw new Error(_0x62d5('0x5e'));if(_0x1afbf4[_0x62d5('0x5f')]===_0x62d5('0x5c')){var _0x1489dc=_0x5a4e79[_0x62d5('0x5d')]({'plain':!![]});return db[_0x62d5('0x60')][_0x62d5('0x61')]({'where':{'name':_0x62d5('0x62'),'userProfileId':_0x1afbf4[_0x62d5('0x63')]},'raw':!![]})['then'](function(_0x485f76){if(_0x485f76&&_0x485f76[_0x62d5('0x64')]===0x0){return db['UserProfileResource'][_0x62d5('0x52')]({'name':_0x1489dc[_0x62d5('0x33')],'resourceId':_0x1489dc['id'],'type':_0x485f76[_0x62d5('0x33')],'sectionId':_0x485f76['id']},{})['then'](function(){return _0x5a4e79;});}else{return _0x5a4e79;}})[_0x62d5('0x24')](function(_0x2d9bb4){logger[_0x62d5('0x21')](_0x62d5('0x65'),_0x2d9bb4);throw _0x2d9bb4;});}return _0x5a4e79;})[_0x62d5('0x1a')](respondWithResult(_0x3413b6,0xc9))[_0x62d5('0x24')](handleError(_0x3413b6,null));};exports[_0x62d5('0x66')]=function(_0x462792,_0x42f170,_0x4bb557){var _0x50de0a;return db['VoiceContext']['find']({'where':{'id':_0x462792[_0x62d5('0x4e')]['id']}})[_0x62d5('0x1a')](handleEntityNotFound(_0x42f170,null))['then'](saveUpdates(_0x462792[_0x62d5('0x53')],null))[_0x62d5('0x1a')](function(_0x5c2750){if(_0x5c2750){_0x50de0a=_0x5c2750;return db[_0x62d5('0x37')][_0x62d5('0x4b')]({'raw':!![]});}})[_0x62d5('0x1a')](function(_0xa0f2ad){var _0x4db853=fs[_0x62d5('0x54')](path[_0x62d5('0x55')](config[_0x62d5('0x56')],_0x62d5('0x57')),_0x62d5('0x58'));var _0x5c5c1e=ejs[_0x62d5('0x67')](_0x4db853,{'contexts':_0xa0f2ad||[]});fs[_0x62d5('0x59')](_0x62d5('0x68'),_0x5c5c1e);})[_0x62d5('0x1a')](function(){return respondWithRpcPromise(_0x62d5('0x5a'),_0x62d5('0x66'),{'module':_0x62d5('0x5b')});})[_0x62d5('0x1a')](function(){return _0x50de0a;})[_0x62d5('0x1a')](respondWithResult(_0x42f170,null))['catch'](handleError(_0x42f170,null));};exports[_0x62d5('0x30')]=function(_0x46111d,_0x4b80db,_0x2f1758){var _0x4a9df1;return db['VoiceContext']['find']({'where':{'id':_0x46111d[_0x62d5('0x4e')]['id']}})[_0x62d5('0x1a')](handleEntityNotFound(_0x4b80db,null))['then'](removeEntity(_0x4b80db,null))[_0x62d5('0x1a')](function(){return db[_0x62d5('0x37')][_0x62d5('0x4b')]({'raw':!![]});})[_0x62d5('0x1a')](function(_0xea02b9){var _0x360c3c=fs[_0x62d5('0x54')](path[_0x62d5('0x55')](config[_0x62d5('0x56')],'server/files/templates/context.ejs'),'utf8');var _0x53904c=ejs[_0x62d5('0x67')](_0x360c3c,{'contexts':_0xea02b9});fs[_0x62d5('0x59')](_0x62d5('0x68'),_0x53904c);return respondWithRpcPromise(_0x62d5('0x5a'),'destroy',{'module':_0x62d5('0x5b')});})['catch'](handleError(_0x4b80db,null));}; \ No newline at end of file +var _0x3638=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','Contexts','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','show','params','length','includeAll','find','create','body','join','root','server/files/templates/context.ejs','render','user','UserProfileSection','UserProfileResource','update','findAll','readFileSync','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','utf8','rimraf','request-promise','moment','bluebird','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3638,0x181));var _0x8363=function(_0x1573eb,_0x15c42b){_0x1573eb=_0x1573eb-0x0;var _0x529b90=_0x3638[_0x1573eb];return _0x529b90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8363('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8363('0x1'));var moment=require(_0x8363('0x2'));var BPromise=require(_0x8363('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8363('0x4'));var sox=require(_0x8363('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8363('0x6'));var _=require(_0x8363('0x7'));var squel=require('squel');var crypto=require(_0x8363('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x8363('0x9'));var toCsv=require(_0x8363('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8363('0xb'));var authService=require(_0x8363('0xc'));var qs=require(_0x8363('0xd'));var as=require(_0x8363('0xe'));var hardwareService=require(_0x8363('0xf'));var logger=require(_0x8363('0x10'))(_0x8363('0x11'));var utils=require(_0x8363('0x12'));var config=require(_0x8363('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8363('0x14'))['db'];var jayson=require(_0x8363('0x15'));var client=jayson[_0x8363('0x16')][_0x8363('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x35d7ab,_0x1c07d3,_0x3dec06,_0x4c8e69){return new BPromise(function(_0x46ea5f,_0x3a8d9b){var _0x3fc5bc=_0x4c8e69||client;return _0x3fc5bc[_0x8363('0x18')](_0x35d7ab,_0x3dec06)[_0x8363('0x19')](function(_0x5841c){logger['info'](_0x8363('0x1a'),_0x1c07d3,_0x8363('0x1b'));logger[_0x8363('0x1c')](_0x8363('0x1d'),_0x1c07d3,'request\x20sent',JSON[_0x8363('0x1e')](_0x5841c));if(_0x5841c['error']){if(_0x5841c[_0x8363('0x1f')][_0x8363('0x20')]===0x1f4){logger[_0x8363('0x1f')](_0x8363('0x1a'),_0x1c07d3,_0x5841c[_0x8363('0x1f')]['message']);return _0x3a8d9b(_0x5841c['error'][_0x8363('0x21')]);}logger[_0x8363('0x1f')](_0x8363('0x1a'),_0x1c07d3,_0x5841c[_0x8363('0x1f')][_0x8363('0x21')]);return _0x46ea5f(_0x5841c[_0x8363('0x1f')][_0x8363('0x21')]);}else{logger[_0x8363('0x22')](_0x8363('0x1a'),_0x1c07d3,_0x8363('0x1b'));_0x46ea5f(_0x5841c[_0x8363('0x23')][_0x8363('0x21')]);}})[_0x8363('0x24')](function(_0x385c4c){logger[_0x8363('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x1c07d3,_0x385c4c);_0x3a8d9b(_0x385c4c);});});}function respondWithStatusCode(_0x3a01bc,_0x28b58e){_0x28b58e=_0x28b58e||0xcc;return function(_0x3d7db1){if(_0x3d7db1){return _0x3a01bc['sendStatus'](_0x28b58e);}return _0x3a01bc[_0x8363('0x25')](_0x28b58e)[_0x8363('0x26')]();};}function respondWithResult(_0x181792,_0x1719da){_0x1719da=_0x1719da||0xc8;return function(_0x3fefbd){if(_0x3fefbd){return _0x181792[_0x8363('0x25')](_0x1719da)[_0x8363('0x27')](_0x3fefbd);}};}function respondWithFilteredResult(_0x925398,_0x1f9f2b){return function(_0xc5aa3){if(_0xc5aa3){var _0x30ef01=typeof _0x1f9f2b[_0x8363('0x28')]===_0x8363('0x29')&&typeof _0x1f9f2b[_0x8363('0x2a')]===_0x8363('0x29');var _0x2c3cf8=_0xc5aa3[_0x8363('0x2b')];var _0x4f72a6=_0x30ef01?0x0:_0x1f9f2b[_0x8363('0x28')];var _0x4bf33f=_0x30ef01?_0xc5aa3[_0x8363('0x2b')]:_0x1f9f2b[_0x8363('0x28')]+_0x1f9f2b[_0x8363('0x2a')];var _0x1e0c3c;if(_0x4bf33f>=_0x2c3cf8){_0x4bf33f=_0x2c3cf8;_0x1e0c3c=0xc8;}else{_0x1e0c3c=0xce;}_0x925398[_0x8363('0x25')](_0x1e0c3c);return _0x925398[_0x8363('0x2c')]('Content-Range',_0x4f72a6+'-'+_0x4bf33f+'/'+_0x2c3cf8)['json'](_0xc5aa3);}return null;};}function patchUpdates(_0x2993d5){return function(_0x321733){try{jsonpatch[_0x8363('0x2d')](_0x321733,_0x2993d5,!![]);}catch(_0x1bfe09){return BPromise[_0x8363('0x2e')](_0x1bfe09);}return _0x321733[_0x8363('0x2f')]();};}function saveUpdates(_0x2acd40,_0x328038){return function(_0x297e55){if(_0x297e55){return _0x297e55['update'](_0x2acd40)[_0x8363('0x19')](function(_0x1c03b1){return _0x1c03b1;});}return null;};}function removeEntity(_0x2a6090,_0x4eb9a1){return function(_0x33047a){if(_0x33047a){return _0x33047a[_0x8363('0x30')]()[_0x8363('0x19')](function(){var _0x543394=_0x33047a[_0x8363('0x31')]({'plain':!![]});var _0x5c5342=_0x8363('0x32');return db['UserProfileResource'][_0x8363('0x30')]({'where':{'type':_0x5c5342,'resourceId':_0x543394['id']}})['then'](function(){return _0x33047a;});})[_0x8363('0x19')](function(){_0x2a6090[_0x8363('0x25')](0xcc)[_0x8363('0x26')]();});}};}function handleEntityNotFound(_0x2a0e42,_0x2e4674){return function(_0xad6184){if(!_0xad6184){_0x2a0e42[_0x8363('0x33')](0x194);}return _0xad6184;};}function handleError(_0x450ace,_0x5887a5){_0x5887a5=_0x5887a5||0x1f4;return function(_0x5cb211){logger[_0x8363('0x1f')](_0x5cb211[_0x8363('0x34')]);if(_0x5cb211[_0x8363('0x35')]){delete _0x5cb211[_0x8363('0x35')];}_0x450ace[_0x8363('0x25')](_0x5887a5)[_0x8363('0x36')](_0x5cb211);};}exports[_0x8363('0x37')]=function(_0x106464,_0x1682bd){var _0x2719b7={},_0xccd7a7={},_0x4ef662={'count':0x0,'rows':[]};var _0x310dfb=_[_0x8363('0x38')](db[_0x8363('0x39')][_0x8363('0x3a')],function(_0x1b1b47){return{'name':_0x1b1b47[_0x8363('0x3b')],'type':_0x1b1b47[_0x8363('0x3c')][_0x8363('0x3d')]};});_0xccd7a7[_0x8363('0x3e')]=_[_0x8363('0x38')](_0x310dfb,_0x8363('0x35'));_0xccd7a7[_0x8363('0x3f')]=_[_0x8363('0x40')](_0x106464[_0x8363('0x3f')]);_0xccd7a7[_0x8363('0x41')]=_['intersection'](_0xccd7a7[_0x8363('0x3e')],_0xccd7a7[_0x8363('0x3f')]);_0x2719b7[_0x8363('0x42')]=_[_0x8363('0x43')](_0xccd7a7[_0x8363('0x3e')],qs[_0x8363('0x44')](_0x106464[_0x8363('0x3f')][_0x8363('0x44')]));_0x2719b7['attributes']=_0x2719b7[_0x8363('0x42')]['length']?_0x2719b7[_0x8363('0x42')]:_0xccd7a7['model'];if(!_0x106464[_0x8363('0x3f')][_0x8363('0x45')](_0x8363('0x46'))){_0x2719b7[_0x8363('0x2a')]=qs['limit'](_0x106464[_0x8363('0x3f')][_0x8363('0x2a')]);_0x2719b7[_0x8363('0x28')]=qs[_0x8363('0x28')](_0x106464['query'][_0x8363('0x28')]);}_0x2719b7['order']=qs['sort'](_0x106464[_0x8363('0x3f')][_0x8363('0x47')]);_0x2719b7[_0x8363('0x48')]=qs['filters'](_[_0x8363('0x49')](_0x106464[_0x8363('0x3f')],_0xccd7a7[_0x8363('0x41')]),_0x310dfb);if(_0x106464[_0x8363('0x3f')]['filter']){_0x2719b7['where']=_[_0x8363('0x4a')](_0x2719b7['where'],{'$or':_[_0x8363('0x38')](_0x310dfb,function(_0x551b43){if(_0x551b43['type']!==_0x8363('0x4b')){var _0x116db7={};_0x116db7[_0x551b43[_0x8363('0x35')]]={'$like':'%'+_0x106464[_0x8363('0x3f')]['filter']+'%'};return _0x116db7;}})});}_0x2719b7=_['merge']({},_0x2719b7,_0x106464[_0x8363('0x4c')]);var _0x3e2c63={'where':_0x2719b7[_0x8363('0x48')]};return db[_0x8363('0x39')]['count'](_0x3e2c63)[_0x8363('0x19')](function(_0x257859){_0x4ef662[_0x8363('0x2b')]=_0x257859;if(_0x106464[_0x8363('0x3f')]['includeAll']){_0x2719b7[_0x8363('0x4d')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x2719b7);})[_0x8363('0x19')](function(_0x407491){_0x4ef662['rows']=_0x407491;return _0x4ef662;})[_0x8363('0x19')](respondWithFilteredResult(_0x1682bd,_0x2719b7))['catch'](handleError(_0x1682bd,null));};exports[_0x8363('0x4e')]=function(_0x197ffd,_0x18287f){var _0x42b5f4={'raw':![],'where':{'id':_0x197ffd[_0x8363('0x4f')]['id']}},_0x104008={};_0x104008[_0x8363('0x3e')]=_[_0x8363('0x40')](db[_0x8363('0x39')][_0x8363('0x3a')]);_0x104008[_0x8363('0x3f')]=_[_0x8363('0x40')](_0x197ffd[_0x8363('0x3f')]);_0x104008['filters']=_[_0x8363('0x43')](_0x104008[_0x8363('0x3e')],_0x104008['query']);_0x42b5f4['attributes']=_[_0x8363('0x43')](_0x104008[_0x8363('0x3e')],qs[_0x8363('0x44')](_0x197ffd[_0x8363('0x3f')][_0x8363('0x44')]));_0x42b5f4['attributes']=_0x42b5f4['attributes'][_0x8363('0x50')]?_0x42b5f4[_0x8363('0x42')]:_0x104008[_0x8363('0x3e')];if(_0x197ffd[_0x8363('0x3f')][_0x8363('0x51')]){_0x42b5f4['include']=[{'all':!![]}];}_0x42b5f4=_['merge']({},_0x42b5f4,_0x197ffd[_0x8363('0x4c')]);return db['VoiceContext'][_0x8363('0x52')](_0x42b5f4)[_0x8363('0x19')](handleEntityNotFound(_0x18287f,null))[_0x8363('0x19')](respondWithResult(_0x18287f,null))[_0x8363('0x24')](handleError(_0x18287f,null));};exports[_0x8363('0x53')]=function(_0xd515e6,_0x2d7c07,_0x820ea6){var _0x2190db;return db[_0x8363('0x39')][_0x8363('0x53')](_0xd515e6[_0x8363('0x54')],{'raw':!![]})['then'](function(_0x3b9e66){_0x2190db=_0x3b9e66;return db[_0x8363('0x39')]['findAll']({'raw':!![]});})[_0x8363('0x19')](function(_0x46f067){var _0x1d2ebd=fs['readFileSync'](path[_0x8363('0x55')](config[_0x8363('0x56')],_0x8363('0x57')),'utf8');var _0xc3debf=ejs[_0x8363('0x58')](_0x1d2ebd,{'contexts':_0x46f067||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0xc3debf);})[_0x8363('0x19')](function(){return respondWithRpcPromise('Reload',_0x8363('0x53'),{'module':'chan_sip.so'});})[_0x8363('0x19')](function(){var _0x3792cd=_0xd515e6[_0x8363('0x59')][_0x8363('0x31')]({'plain':!![]});if(!_0x3792cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3792cd['role']==='user'){var _0xbf7e89=_0x2190db[_0x8363('0x31')]({'plain':!![]});return db[_0x8363('0x5a')][_0x8363('0x52')]({'where':{'name':_0x8363('0x32'),'userProfileId':_0x3792cd['userProfileId']},'raw':!![]})[_0x8363('0x19')](function(_0x9e76f2){if(_0x9e76f2&&_0x9e76f2['autoAssociation']===0x0){return db[_0x8363('0x5b')][_0x8363('0x53')]({'name':_0xbf7e89[_0x8363('0x35')],'resourceId':_0xbf7e89['id'],'type':_0x9e76f2[_0x8363('0x35')],'sectionId':_0x9e76f2['id']},{})[_0x8363('0x19')](function(){return _0x2190db;});}else{return _0x2190db;}})[_0x8363('0x24')](function(_0x2c1cf2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c1cf2);throw _0x2c1cf2;});}return _0x2190db;})[_0x8363('0x19')](respondWithResult(_0x2d7c07,0xc9))[_0x8363('0x24')](handleError(_0x2d7c07,null));};exports[_0x8363('0x5c')]=function(_0x418ae0,_0x3f12a3,_0x58af4c){var _0x5f30df;return db[_0x8363('0x39')][_0x8363('0x52')]({'where':{'id':_0x418ae0['params']['id']}})[_0x8363('0x19')](handleEntityNotFound(_0x3f12a3,null))[_0x8363('0x19')](saveUpdates(_0x418ae0[_0x8363('0x54')],null))[_0x8363('0x19')](function(_0x4a2d99){if(_0x4a2d99){_0x5f30df=_0x4a2d99;return db[_0x8363('0x39')][_0x8363('0x5d')]({'raw':!![]});}})[_0x8363('0x19')](function(_0x12148f){var _0x1b1288=fs[_0x8363('0x5e')](path[_0x8363('0x55')](config[_0x8363('0x56')],_0x8363('0x57')),'utf8');var _0x54c639=ejs[_0x8363('0x58')](_0x1b1288,{'contexts':_0x12148f||[]});fs[_0x8363('0x5f')](_0x8363('0x60'),_0x54c639);})['then'](function(){return respondWithRpcPromise(_0x8363('0x61'),_0x8363('0x5c'),{'module':_0x8363('0x62')});})['then'](function(){return _0x5f30df;})['then'](respondWithResult(_0x3f12a3,null))[_0x8363('0x24')](handleError(_0x3f12a3,null));};exports['destroy']=function(_0x55db79,_0x28d629,_0x5c3162){var _0x149b6c;return db['VoiceContext']['find']({'where':{'id':_0x55db79[_0x8363('0x4f')]['id']}})[_0x8363('0x19')](handleEntityNotFound(_0x28d629,null))[_0x8363('0x19')](removeEntity(_0x28d629,null))[_0x8363('0x19')](function(){return db[_0x8363('0x39')][_0x8363('0x5d')]({'raw':!![]});})[_0x8363('0x19')](function(_0x1e6d29){var _0x2b3cbd=fs[_0x8363('0x5e')](path['join'](config[_0x8363('0x56')],_0x8363('0x57')),_0x8363('0x63'));var _0x382fe9=ejs[_0x8363('0x58')](_0x2b3cbd,{'contexts':_0x1e6d29});fs['writeFileSync'](_0x8363('0x60'),_0x382fe9);return respondWithRpcPromise(_0x8363('0x61'),_0x8363('0x30'),{'module':'chan_sip.so'});})[_0x8363('0x24')](handleError(_0x28d629,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 73a0df4..0b01109 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 _0xddc3=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','path','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xddc3,0x111));var _0x3ddc=function(_0x4ac79a,_0x46c40b){_0x4ac79a=_0x4ac79a-0x0;var _0x29aa11=_0xddc3[_0x4ac79a];return _0x29aa11;};'use strict';var _=require(_0x3ddc('0x0'));var util=require(_0x3ddc('0x1'));var logger=require(_0x3ddc('0x2'))(_0x3ddc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ddc('0x4'));var rimraf=require('rimraf');var config=require(_0x3ddc('0x5'));var attributes=require(_0x3ddc('0x6'));module['exports']=function(_0x2fe2fc,_0x18b4f9){return _0x2fe2fc['define'](_0x3ddc('0x7'),attributes,{'tableName':_0x3ddc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd112=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','voice_contexts','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd112,0x10a));var _0x2d11=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0xd112[_0x18b931];return _0x114958;};'use strict';var _=require('lodash');var util=require(_0x2d11('0x0'));var logger=require(_0x2d11('0x1'))(_0x2d11('0x2'));var moment=require(_0x2d11('0x3'));var BPromise=require(_0x2d11('0x4'));var rp=require(_0x2d11('0x5'));var fs=require('fs');var path=require(_0x2d11('0x6'));var rimraf=require(_0x2d11('0x7'));var config=require('../../config/environment');var attributes=require(_0x2d11('0x8'));module['exports']=function(_0xd76f75,_0x1088b7){return _0xd76f75['define']('VoiceContext',attributes,{'tableName':_0x2d11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 90a1dea..5ec341a 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 _0x32e3=['then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x139a91,_0x14f87f){var _0x135ddd=function(_0xa03932){while(--_0xa03932){_0x139a91['push'](_0x139a91['shift']());}};_0x135ddd(++_0x14f87f);}(_0x32e3,0x104));var _0x332e=function(_0x140b9c,_0x3eb10d){_0x140b9c=_0x140b9c-0x0;var _0x2220f9=_0x32e3[_0x140b9c];return _0x2220f9;};'use strict';var _=require('lodash');var util=require(_0x332e('0x0'));var moment=require(_0x332e('0x1'));var BPromise=require(_0x332e('0x2'));var rs=require(_0x332e('0x3'));var fs=require('fs');var Redis=require(_0x332e('0x4'));var db=require(_0x332e('0x5'))['db'];var utils=require(_0x332e('0x6'));var logger=require('../../config/logger')(_0x332e('0x7'));var config=require(_0x332e('0x8'));var jayson=require(_0x332e('0x9'));var client=jayson[_0x332e('0xa')][_0x332e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c1ee8,_0x2d4489,_0x575f38){return new BPromise(function(_0x25fa7d,_0x4a134a){return client[_0x332e('0xc')](_0x2c1ee8,_0x575f38)[_0x332e('0xd')](function(_0x33f3d9){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2d4489,_0x332e('0xe'));logger[_0x332e('0xf')](_0x332e('0x10'),_0x2d4489,_0x332e('0xe'),JSON[_0x332e('0x11')](_0x33f3d9));if(_0x33f3d9[_0x332e('0x12')]){if(_0x33f3d9[_0x332e('0x12')]['code']===0x1f4){logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x33f3d9['error']['message']);return _0x4a134a(_0x33f3d9['error'][_0x332e('0x14')]);}logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x33f3d9[_0x332e('0x12')][_0x332e('0x14')]);return _0x25fa7d(_0x33f3d9[_0x332e('0x12')][_0x332e('0x14')]);}else{logger['info'](_0x332e('0x13'),_0x2d4489,'request\x20sent');_0x25fa7d(_0x33f3d9['result']['message']);}})['catch'](function(_0x6108e7){logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x6108e7);_0x4a134a(_0x6108e7);});});} \ No newline at end of file +var _0x1b8e=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ec5d1,_0x1744a3){var _0x341694=function(_0xe48f9a){while(--_0xe48f9a){_0x1ec5d1['push'](_0x1ec5d1['shift']());}};_0x341694(++_0x1744a3);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x1e03f0,_0x366b61){_0x1e03f0=_0x1e03f0-0x0;var _0x37d7af=_0x1b8e[_0x1e03f0];return _0x37d7af;};'use strict';var _=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var moment=require(_0xe1b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1b8('0x3'));var fs=require('fs');var Redis=require(_0xe1b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1b8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe1b8('0x6'));var jayson=require(_0xe1b8('0x7'));var client=jayson[_0xe1b8('0x8')][_0xe1b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x226a84,_0x44e4f1,_0x3ad550){return new BPromise(function(_0x395abd,_0x619866){return client[_0xe1b8('0xa')](_0x226a84,_0x3ad550)[_0xe1b8('0xb')](function(_0xe54b16){logger[_0xe1b8('0xc')](_0xe1b8('0xd'),_0x44e4f1,_0xe1b8('0xe'));logger[_0xe1b8('0xf')](_0xe1b8('0x10'),_0x44e4f1,_0xe1b8('0xe'),JSON[_0xe1b8('0x11')](_0xe54b16));if(_0xe54b16[_0xe1b8('0x12')]){if(_0xe54b16[_0xe1b8('0x12')][_0xe1b8('0x13')]===0x1f4){logger[_0xe1b8('0x12')]('VoiceContext,\x20%s,\x20%s',_0x44e4f1,_0xe54b16[_0xe1b8('0x12')]['message']);return _0x619866(_0xe54b16[_0xe1b8('0x12')]['message']);}logger[_0xe1b8('0x12')]('VoiceContext,\x20%s,\x20%s',_0x44e4f1,_0xe54b16[_0xe1b8('0x12')][_0xe1b8('0x14')]);return _0x395abd(_0xe54b16['error']['message']);}else{logger['info'](_0xe1b8('0xd'),_0x44e4f1,_0xe1b8('0xe'));_0x395abd(_0xe54b16[_0xe1b8('0x15')][_0xe1b8('0x14')]);}})['catch'](function(_0xf97432){logger['error'](_0xe1b8('0xd'),_0x44e4f1,_0xf97432);_0x619866(_0xf97432);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b7e256d..74f50c3 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 _0x167e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x167e,0xa3));var _0xe167=function(_0x21f7bd,_0x310239){_0x21f7bd=_0x21f7bd-0x0;var _0x5a220f=_0x167e[_0x21f7bd];return _0x5a220f;};'use strict';var multer=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var path=require(_0xe167('0x2'));var timeout=require(_0xe167('0x3'));var express=require(_0xe167('0x4'));var router=express[_0xe167('0x5')]();var fs_extra=require(_0xe167('0x6'));var auth=require(_0xe167('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe167('0x8'));var controller=require('./voiceDialReport.controller');router[_0xe167('0x9')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0xb')]);router[_0xe167('0x9')](_0xe167('0xc'),auth['isAuthenticated'](),controller[_0xe167('0xd')]);router['get'](_0xe167('0xe'),auth[_0xe167('0xa')](),controller[_0xe167('0xf')]);router[_0xe167('0x10')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0x11')]);router[_0xe167('0x12')](_0xe167('0xe'),auth['isAuthenticated'](),controller[_0xe167('0x13')]);router[_0xe167('0x14')]('/:id',auth[_0xe167('0xa')](),controller[_0xe167('0x15')]);module[_0xe167('0x16')]=router; \ No newline at end of file +var _0x4c78=['/describe','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0xd0b55c,_0x518d87){var _0x18877d=function(_0x2f4f33){while(--_0x2f4f33){_0xd0b55c['push'](_0xd0b55c['shift']());}};_0x18877d(++_0x518d87);}(_0x4c78,0x117));var _0x84c7=function(_0x14820b,_0x320176){_0x14820b=_0x14820b-0x0;var _0x2345d3=_0x4c78[_0x14820b];return _0x2345d3;};'use strict';var multer=require(_0x84c7('0x0'));var util=require(_0x84c7('0x1'));var path=require(_0x84c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x84c7('0x3'));var router=express[_0x84c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x84c7('0x5'));var config=require(_0x84c7('0x6'));var controller=require(_0x84c7('0x7'));router[_0x84c7('0x8')]('/',auth[_0x84c7('0x9')](),controller['index']);router['get'](_0x84c7('0xa'),auth[_0x84c7('0x9')](),controller['describe']);router[_0x84c7('0x8')]('/:id',auth[_0x84c7('0x9')](),controller['show']);router['post']('/',auth[_0x84c7('0x9')](),controller['create']);router[_0x84c7('0xb')](_0x84c7('0xc'),auth['isAuthenticated'](),controller[_0x84c7('0xd')]);router[_0x84c7('0xe')](_0x84c7('0xc'),auth[_0x84c7('0x9')](),controller[_0x84c7('0xf')]);module[_0x84c7('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 79fa449..61efd6f 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(_0x3fb5f7,_0x17fe10){var _0x52d1ac=function(_0x3c821a){while(--_0x3c821a){_0x3fb5f7['push'](_0x3fb5f7['shift']());}};_0x52d1ac(++_0x17fe10);}(_0x98a8,0x12c));var _0x898a=function(_0x3d894c,_0x865ed4){_0x3d894c=_0x3d894c-0x0;var _0x188a1d=_0x98a8[_0x3d894c];return _0x188a1d;};'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(_0x5609d9,_0x1ddb0e){var _0x287b84=function(_0x39c3d4){while(--_0x39c3d4){_0x5609d9['push'](_0x5609d9['shift']());}};_0x287b84(++_0x1ddb0e);}(_0x81bd,0x7c));var _0xd81b=function(_0x3f2621,_0x569366){_0x3f2621=_0x3f2621-0x0;var _0x43018c=_0x81bd[_0x3f2621];return _0x43018c;};'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 f10d9c2..b419109 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 _0x1953=['map','query','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','reject','save','update','then','error','stack','name','send','index','VoiceDialReport','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1953,0x156));var _0x3195=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1953[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x3195('0x0'));var rimraf=require(_0x3195('0x1'));var zipdir=require(_0x3195('0x2'));var jsonpatch=require(_0x3195('0x3'));var rp=require(_0x3195('0x4'));var moment=require(_0x3195('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3195('0x6'));var util=require(_0x3195('0x7'));var path=require(_0x3195('0x8'));var sox=require(_0x3195('0x9'));var csv=require(_0x3195('0xa'));var ejs=require(_0x3195('0xb'));var fs=require('fs');var fs_extra=require(_0x3195('0xc'));var _=require(_0x3195('0xd'));var squel=require(_0x3195('0xe'));var crypto=require(_0x3195('0xf'));var jsforce=require(_0x3195('0x10'));var deskjs=require(_0x3195('0x11'));var toCsv=require(_0x3195('0xa'));var querystring=require('querystring');var Papa=require(_0x3195('0x12'));var Redis=require(_0x3195('0x13'));var authService=require(_0x3195('0x14'));var qs=require(_0x3195('0x15'));var as=require(_0x3195('0x16'));var hardwareService=require(_0x3195('0x17'));var logger=require(_0x3195('0x18'))(_0x3195('0x19'));var utils=require(_0x3195('0x1a'));var config=require(_0x3195('0x1b'));var licenseUtil=require(_0x3195('0x1c'));var db=require(_0x3195('0x1d'))['db'];function respondWithStatusCode(_0x1f50e9,_0x1ef524){_0x1ef524=_0x1ef524||0xcc;return function(_0x1e144b){if(_0x1e144b){return _0x1f50e9[_0x3195('0x1e')](_0x1ef524);}return _0x1f50e9['status'](_0x1ef524)[_0x3195('0x1f')]();};}function respondWithResult(_0x5d0637,_0x3c92ae){_0x3c92ae=_0x3c92ae||0xc8;return function(_0x2281d3){if(_0x2281d3){return _0x5d0637[_0x3195('0x20')](_0x3c92ae)[_0x3195('0x21')](_0x2281d3);}};}function respondWithFilteredResult(_0x2f2e9e,_0x4065d3){return function(_0x5b03f6){if(_0x5b03f6){var _0x581d0e=typeof _0x4065d3['offset']==='undefined'&&typeof _0x4065d3[_0x3195('0x22')]===_0x3195('0x23');var _0x50770e=_0x5b03f6[_0x3195('0x24')];var _0x3fa89b=_0x581d0e?0x0:_0x4065d3[_0x3195('0x25')];var _0x40d544=_0x581d0e?_0x5b03f6[_0x3195('0x24')]:_0x4065d3['offset']+_0x4065d3[_0x3195('0x22')];var _0x4849e7;if(_0x40d544>=_0x50770e){_0x40d544=_0x50770e;_0x4849e7=0xc8;}else{_0x4849e7=0xce;}_0x2f2e9e[_0x3195('0x20')](_0x4849e7);return _0x2f2e9e[_0x3195('0x26')]('Content-Range',_0x3fa89b+'-'+_0x40d544+'/'+_0x50770e)['json'](_0x5b03f6);}return null;};}function patchUpdates(_0x479105){return function(_0x77793d){try{jsonpatch['apply'](_0x77793d,_0x479105,!![]);}catch(_0x2df16a){return BPromise[_0x3195('0x27')](_0x2df16a);}return _0x77793d[_0x3195('0x28')]();};}function saveUpdates(_0x58dec5,_0x57a704){return function(_0x3dc4ff){if(_0x3dc4ff){return _0x3dc4ff[_0x3195('0x29')](_0x58dec5)[_0x3195('0x2a')](function(_0x3b80b4){return _0x3b80b4;});}return null;};}function removeEntity(_0x90db6a,_0xcebdd8){return function(_0x270bc6){if(_0x270bc6){return _0x270bc6['destroy']()['then'](function(){_0x90db6a[_0x3195('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1cbd8,_0x2955b5){return function(_0x411a57){if(!_0x411a57){_0xf1cbd8['sendStatus'](0x194);}return _0x411a57;};}function handleError(_0x591fbe,_0x30eef3){_0x30eef3=_0x30eef3||0x1f4;return function(_0x41591e){logger[_0x3195('0x2b')](_0x41591e[_0x3195('0x2c')]);if(_0x41591e['name']){delete _0x41591e[_0x3195('0x2d')];}_0x591fbe[_0x3195('0x20')](_0x30eef3)[_0x3195('0x2e')](_0x41591e);};}exports[_0x3195('0x2f')]=function(_0x503d78,_0x7dc469){var _0x38a742={},_0x362f4e={},_0x258cbf={'count':0x0,'rows':[]};var _0x475d60=_['map'](db[_0x3195('0x30')]['rawAttributes'],function(_0x10cdc9){return{'name':_0x10cdc9[_0x3195('0x31')],'type':_0x10cdc9[_0x3195('0x32')][_0x3195('0x33')]};});_0x362f4e[_0x3195('0x34')]=_[_0x3195('0x35')](_0x475d60,_0x3195('0x2d'));_0x362f4e[_0x3195('0x36')]=_['keys'](_0x503d78[_0x3195('0x36')]);_0x362f4e[_0x3195('0x37')]=_[_0x3195('0x38')](_0x362f4e[_0x3195('0x34')],_0x362f4e[_0x3195('0x36')]);_0x38a742[_0x3195('0x39')]=_[_0x3195('0x38')](_0x362f4e[_0x3195('0x34')],qs['fields'](_0x503d78[_0x3195('0x36')][_0x3195('0x3a')]));_0x38a742[_0x3195('0x39')]=_0x38a742['attributes'][_0x3195('0x3b')]?_0x38a742[_0x3195('0x39')]:_0x362f4e[_0x3195('0x34')];if(!_0x503d78[_0x3195('0x36')]['hasOwnProperty']('nolimit')){_0x38a742[_0x3195('0x22')]=qs[_0x3195('0x22')](_0x503d78[_0x3195('0x36')]['limit']);_0x38a742['offset']=qs[_0x3195('0x25')](_0x503d78[_0x3195('0x36')][_0x3195('0x25')]);}_0x38a742[_0x3195('0x3c')]=qs['sort'](_0x503d78[_0x3195('0x36')]['sort']);_0x38a742[_0x3195('0x3d')]=qs[_0x3195('0x37')](_[_0x3195('0x3e')](_0x503d78[_0x3195('0x36')],_0x362f4e[_0x3195('0x37')]),_0x475d60);if(_0x503d78[_0x3195('0x36')][_0x3195('0x3f')]){_0x38a742[_0x3195('0x3d')]=_[_0x3195('0x40')](_0x38a742[_0x3195('0x3d')],{'$or':_[_0x3195('0x35')](_0x475d60,function(_0x183e73){if(_0x183e73[_0x3195('0x32')]!==_0x3195('0x41')){var _0x308777={};_0x308777[_0x183e73[_0x3195('0x2d')]]={'$like':'%'+_0x503d78[_0x3195('0x36')]['filter']+'%'};return _0x308777;}})});}_0x38a742=_[_0x3195('0x40')]({},_0x38a742,_0x503d78['options']);var _0x53fbb9={'where':_0x38a742['where']};return db[_0x3195('0x30')][_0x3195('0x24')](_0x53fbb9)['then'](function(_0x386d5b){_0x258cbf['count']=_0x386d5b;if(_0x503d78['query'][_0x3195('0x42')]){_0x38a742[_0x3195('0x43')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x3195('0x44')](_0x38a742);})[_0x3195('0x2a')](function(_0x2d0965){_0x258cbf[_0x3195('0x45')]=_0x2d0965;return _0x258cbf;})[_0x3195('0x2a')](respondWithFilteredResult(_0x7dc469,_0x38a742))[_0x3195('0x46')](handleError(_0x7dc469,null));};exports[_0x3195('0x47')]=function(_0x502401,_0x24d3ff){var _0x4e47a4={'raw':!![],'where':{'id':_0x502401['params']['id']}},_0xad9910={};_0xad9910[_0x3195('0x34')]=_[_0x3195('0x48')](db['VoiceDialReport']['rawAttributes']);_0xad9910['query']=_[_0x3195('0x48')](_0x502401['query']);_0xad9910[_0x3195('0x37')]=_[_0x3195('0x38')](_0xad9910['model'],_0xad9910['query']);_0x4e47a4[_0x3195('0x39')]=_['intersection'](_0xad9910['model'],qs[_0x3195('0x3a')](_0x502401[_0x3195('0x36')][_0x3195('0x3a')]));_0x4e47a4[_0x3195('0x39')]=_0x4e47a4[_0x3195('0x39')]['length']?_0x4e47a4['attributes']:_0xad9910[_0x3195('0x34')];if(_0x502401[_0x3195('0x36')][_0x3195('0x42')]){_0x4e47a4[_0x3195('0x43')]=[{'all':!![]}];}_0x4e47a4=_[_0x3195('0x40')]({},_0x4e47a4,_0x502401[_0x3195('0x49')]);return db[_0x3195('0x30')][_0x3195('0x4a')](_0x4e47a4)['then'](handleEntityNotFound(_0x24d3ff,null))['then'](respondWithResult(_0x24d3ff,null))[_0x3195('0x46')](handleError(_0x24d3ff,null));};exports[_0x3195('0x4b')]=function(_0x570d69,_0x5bf1d8){return db[_0x3195('0x30')][_0x3195('0x4b')](_0x570d69[_0x3195('0x4c')],{})[_0x3195('0x2a')](respondWithResult(_0x5bf1d8,0xc9))[_0x3195('0x46')](handleError(_0x5bf1d8,null));};exports[_0x3195('0x29')]=function(_0x4de511,_0x42d8a7){if(_0x4de511[_0x3195('0x4c')]['id']){delete _0x4de511['body']['id'];}return db[_0x3195('0x30')][_0x3195('0x4a')]({'where':{'id':_0x4de511[_0x3195('0x4d')]['id']}})['then'](handleEntityNotFound(_0x42d8a7,null))[_0x3195('0x2a')](saveUpdates(_0x4de511['body'],null))[_0x3195('0x2a')](respondWithResult(_0x42d8a7,null))[_0x3195('0x46')](handleError(_0x42d8a7,null));};exports[_0x3195('0x4e')]=function(_0x5d6157,_0x4cc074){return db['VoiceDialReport'][_0x3195('0x4a')]({'where':{'id':_0x5d6157[_0x3195('0x4d')]['id']}})[_0x3195('0x2a')](handleEntityNotFound(_0x4cc074,null))[_0x3195('0x2a')](removeEntity(_0x4cc074,null))[_0x3195('0x46')](handleError(_0x4cc074,null));};exports['describe']=function(_0x2cddc1,_0x2d65b6){return db[_0x3195('0x30')]['describe']()[_0x3195('0x2a')](respondWithResult(_0x2d65b6,null))[_0x3195('0x46')](handleError(_0x2d65b6,null));}; \ No newline at end of file +var _0xd0a0=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','type','VIRTUAL','merge','options','includeAll','show','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce'];(function(_0x521ad1,_0xb2185a){var _0xda420d=function(_0x2e7937){while(--_0x2e7937){_0x521ad1['push'](_0x521ad1['shift']());}};_0xda420d(++_0xb2185a);}(_0xd0a0,0x1d6));var _0x0d0a=function(_0x31a00e,_0x7b6ecc){_0x31a00e=_0x31a00e-0x0;var _0x1dc267=_0xd0a0[_0x31a00e];return _0x1dc267;};'use strict';var emlformat=require(_0x0d0a('0x0'));var rimraf=require(_0x0d0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d0a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d0a('0x3'));var Mustache=require(_0x0d0a('0x4'));var util=require(_0x0d0a('0x5'));var path=require(_0x0d0a('0x6'));var sox=require(_0x0d0a('0x7'));var csv=require(_0x0d0a('0x8'));var ejs=require(_0x0d0a('0x9'));var fs=require('fs');var fs_extra=require(_0x0d0a('0xa'));var _=require('lodash');var squel=require(_0x0d0a('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d0a('0x8'));var querystring=require(_0x0d0a('0xd'));var Papa=require(_0x0d0a('0xe'));var Redis=require(_0x0d0a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0d0a('0x10'));var as=require(_0x0d0a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d0a('0x12'))(_0x0d0a('0x13'));var utils=require('../../config/utils');var config=require(_0x0d0a('0x14'));var licenseUtil=require(_0x0d0a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbe01,_0x3575d2){_0x3575d2=_0x3575d2||0xcc;return function(_0x1e8851){if(_0x1e8851){return _0x3bbe01[_0x0d0a('0x16')](_0x3575d2);}return _0x3bbe01[_0x0d0a('0x17')](_0x3575d2)[_0x0d0a('0x18')]();};}function respondWithResult(_0x4aaa6a,_0x371194){_0x371194=_0x371194||0xc8;return function(_0x44d480){if(_0x44d480){return _0x4aaa6a[_0x0d0a('0x17')](_0x371194)[_0x0d0a('0x19')](_0x44d480);}};}function respondWithFilteredResult(_0x1eab3a,_0xffce32){return function(_0x3bfdc5){if(_0x3bfdc5){var _0x3faf0d=typeof _0xffce32[_0x0d0a('0x1a')]===_0x0d0a('0x1b')&&typeof _0xffce32[_0x0d0a('0x1c')]==='undefined';var _0xfdca83=_0x3bfdc5[_0x0d0a('0x1d')];var _0x3eb275=_0x3faf0d?0x0:_0xffce32['offset'];var _0x3f2ca4=_0x3faf0d?_0x3bfdc5['count']:_0xffce32[_0x0d0a('0x1a')]+_0xffce32[_0x0d0a('0x1c')];var _0x4b096e;if(_0x3f2ca4>=_0xfdca83){_0x3f2ca4=_0xfdca83;_0x4b096e=0xc8;}else{_0x4b096e=0xce;}_0x1eab3a[_0x0d0a('0x17')](_0x4b096e);return _0x1eab3a['set'](_0x0d0a('0x1e'),_0x3eb275+'-'+_0x3f2ca4+'/'+_0xfdca83)['json'](_0x3bfdc5);}return null;};}function patchUpdates(_0x526bbb){return function(_0xdf20ff){try{jsonpatch[_0x0d0a('0x1f')](_0xdf20ff,_0x526bbb,!![]);}catch(_0x5ef927){return BPromise['reject'](_0x5ef927);}return _0xdf20ff['save']();};}function saveUpdates(_0x18b6de,_0x255c91){return function(_0x2d6803){if(_0x2d6803){return _0x2d6803[_0x0d0a('0x20')](_0x18b6de)[_0x0d0a('0x21')](function(_0x3f1191){return _0x3f1191;});}return null;};}function removeEntity(_0x2c3e83,_0x30fac2){return function(_0x5e0f85){if(_0x5e0f85){return _0x5e0f85[_0x0d0a('0x22')]()[_0x0d0a('0x21')](function(){_0x2c3e83[_0x0d0a('0x17')](0xcc)[_0x0d0a('0x18')]();});}};}function handleEntityNotFound(_0xae002b,_0x37f510){return function(_0x366b5f){if(!_0x366b5f){_0xae002b[_0x0d0a('0x16')](0x194);}return _0x366b5f;};}function handleError(_0x11d621,_0x1558bb){_0x1558bb=_0x1558bb||0x1f4;return function(_0x42caff){logger[_0x0d0a('0x23')](_0x42caff[_0x0d0a('0x24')]);if(_0x42caff[_0x0d0a('0x25')]){delete _0x42caff['name'];}_0x11d621['status'](_0x1558bb)[_0x0d0a('0x26')](_0x42caff);};}exports[_0x0d0a('0x27')]=function(_0x282302,_0x267185){var _0x5df7cf={},_0x4e720c={},_0x104a72={'count':0x0,'rows':[]};var _0x2c6d27=_[_0x0d0a('0x28')](db[_0x0d0a('0x29')][_0x0d0a('0x2a')],function(_0x170ee7){return{'name':_0x170ee7[_0x0d0a('0x2b')],'type':_0x170ee7['type']['key']};});_0x4e720c[_0x0d0a('0x2c')]=_[_0x0d0a('0x28')](_0x2c6d27,'name');_0x4e720c['query']=_[_0x0d0a('0x2d')](_0x282302[_0x0d0a('0x2e')]);_0x4e720c['filters']=_[_0x0d0a('0x2f')](_0x4e720c[_0x0d0a('0x2c')],_0x4e720c['query']);_0x5df7cf[_0x0d0a('0x30')]=_[_0x0d0a('0x2f')](_0x4e720c['model'],qs['fields'](_0x282302[_0x0d0a('0x2e')][_0x0d0a('0x31')]));_0x5df7cf[_0x0d0a('0x30')]=_0x5df7cf[_0x0d0a('0x30')][_0x0d0a('0x32')]?_0x5df7cf['attributes']:_0x4e720c[_0x0d0a('0x2c')];if(!_0x282302[_0x0d0a('0x2e')][_0x0d0a('0x33')](_0x0d0a('0x34'))){_0x5df7cf['limit']=qs['limit'](_0x282302[_0x0d0a('0x2e')][_0x0d0a('0x1c')]);_0x5df7cf[_0x0d0a('0x1a')]=qs[_0x0d0a('0x1a')](_0x282302['query']['offset']);}_0x5df7cf['order']=qs[_0x0d0a('0x35')](_0x282302[_0x0d0a('0x2e')]['sort']);_0x5df7cf['where']=qs[_0x0d0a('0x36')](_[_0x0d0a('0x37')](_0x282302[_0x0d0a('0x2e')],_0x4e720c[_0x0d0a('0x36')]),_0x2c6d27);if(_0x282302[_0x0d0a('0x2e')]['filter']){_0x5df7cf[_0x0d0a('0x38')]=_['merge'](_0x5df7cf[_0x0d0a('0x38')],{'$or':_['map'](_0x2c6d27,function(_0x450703){if(_0x450703[_0x0d0a('0x39')]!==_0x0d0a('0x3a')){var _0x3fa3e5={};_0x3fa3e5[_0x450703[_0x0d0a('0x25')]]={'$like':'%'+_0x282302[_0x0d0a('0x2e')]['filter']+'%'};return _0x3fa3e5;}})});}_0x5df7cf=_[_0x0d0a('0x3b')]({},_0x5df7cf,_0x282302[_0x0d0a('0x3c')]);var _0x47fce3={'where':_0x5df7cf[_0x0d0a('0x38')]};return db[_0x0d0a('0x29')]['count'](_0x47fce3)[_0x0d0a('0x21')](function(_0x5902b5){_0x104a72[_0x0d0a('0x1d')]=_0x5902b5;if(_0x282302['query'][_0x0d0a('0x3d')]){_0x5df7cf['include']=[{'all':!![]}];}return db[_0x0d0a('0x29')]['findAll'](_0x5df7cf);})[_0x0d0a('0x21')](function(_0x32daaf){_0x104a72['rows']=_0x32daaf;return _0x104a72;})[_0x0d0a('0x21')](respondWithFilteredResult(_0x267185,_0x5df7cf))['catch'](handleError(_0x267185,null));};exports[_0x0d0a('0x3e')]=function(_0x116f79,_0x19cba0){var _0x1db00b={'raw':!![],'where':{'id':_0x116f79[_0x0d0a('0x3f')]['id']}},_0x3885ba={};_0x3885ba[_0x0d0a('0x2c')]=_[_0x0d0a('0x2d')](db[_0x0d0a('0x29')][_0x0d0a('0x2a')]);_0x3885ba[_0x0d0a('0x2e')]=_[_0x0d0a('0x2d')](_0x116f79[_0x0d0a('0x2e')]);_0x3885ba['filters']=_[_0x0d0a('0x2f')](_0x3885ba[_0x0d0a('0x2c')],_0x3885ba[_0x0d0a('0x2e')]);_0x1db00b[_0x0d0a('0x30')]=_[_0x0d0a('0x2f')](_0x3885ba['model'],qs['fields'](_0x116f79[_0x0d0a('0x2e')][_0x0d0a('0x31')]));_0x1db00b[_0x0d0a('0x30')]=_0x1db00b[_0x0d0a('0x30')][_0x0d0a('0x32')]?_0x1db00b['attributes']:_0x3885ba[_0x0d0a('0x2c')];if(_0x116f79['query']['includeAll']){_0x1db00b['include']=[{'all':!![]}];}_0x1db00b=_['merge']({},_0x1db00b,_0x116f79['options']);return db[_0x0d0a('0x29')][_0x0d0a('0x40')](_0x1db00b)[_0x0d0a('0x21')](handleEntityNotFound(_0x19cba0,null))[_0x0d0a('0x21')](respondWithResult(_0x19cba0,null))[_0x0d0a('0x41')](handleError(_0x19cba0,null));};exports[_0x0d0a('0x42')]=function(_0x2cd2fe,_0x2f8c97){return db['VoiceDialReport'][_0x0d0a('0x42')](_0x2cd2fe[_0x0d0a('0x43')],{})[_0x0d0a('0x21')](respondWithResult(_0x2f8c97,0xc9))[_0x0d0a('0x41')](handleError(_0x2f8c97,null));};exports['update']=function(_0x1cb863,_0x1716ae){if(_0x1cb863['body']['id']){delete _0x1cb863[_0x0d0a('0x43')]['id'];}return db[_0x0d0a('0x29')][_0x0d0a('0x40')]({'where':{'id':_0x1cb863['params']['id']}})[_0x0d0a('0x21')](handleEntityNotFound(_0x1716ae,null))[_0x0d0a('0x21')](saveUpdates(_0x1cb863[_0x0d0a('0x43')],null))[_0x0d0a('0x21')](respondWithResult(_0x1716ae,null))[_0x0d0a('0x41')](handleError(_0x1716ae,null));};exports['destroy']=function(_0x3f9888,_0x3f952f){return db[_0x0d0a('0x29')][_0x0d0a('0x40')]({'where':{'id':_0x3f9888[_0x0d0a('0x3f')]['id']}})[_0x0d0a('0x21')](handleEntityNotFound(_0x3f952f,null))[_0x0d0a('0x21')](removeEntity(_0x3f952f,null))[_0x0d0a('0x41')](handleError(_0x3f952f,null));};exports[_0x0d0a('0x44')]=function(_0x84716d,_0x1d081c){return db[_0x0d0a('0x29')][_0x0d0a('0x44')]()[_0x0d0a('0x21')](respondWithResult(_0x1d081c,null))['catch'](handleError(_0x1d081c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ad64aa4..5db9467 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 _0x8ff5=['path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465fc9,_0x3ffef7){var _0x38f0f9=function(_0x5833df){while(--_0x5833df){_0x465fc9['push'](_0x465fc9['shift']());}};_0x38f0f9(++_0x3ffef7);}(_0x8ff5,0x78));var _0x58ff=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8ff5[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x58ff('0x0'));var util=require(_0x58ff('0x1'));var logger=require(_0x58ff('0x2'))(_0x58ff('0x3'));var moment=require(_0x58ff('0x4'));var BPromise=require(_0x58ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ff('0x6'));var rimraf=require(_0x58ff('0x7'));var config=require('../../config/environment');var attributes=require(_0x58ff('0x8'));module[_0x58ff('0x9')]=function(_0x52ff98,_0x425959){return _0x52ff98[_0x58ff('0xa')](_0x58ff('0xb'),attributes,{'tableName':_0x58ff('0xc'),'paranoid':![],'indexes':[{'fields':[_0x58ff('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b5c=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3b6bbb,_0x38c896){var _0x337141=function(_0x4fb939){while(--_0x4fb939){_0x3b6bbb['push'](_0x3b6bbb['shift']());}};_0x337141(++_0x38c896);}(_0x8b5c,0x6b));var _0xc8b5=function(_0xbbb6ba,_0x1cf634){_0xbbb6ba=_0xbbb6ba-0x0;var _0xe59df=_0x8b5c[_0xbbb6ba];return _0xe59df;};'use strict';var _=require(_0xc8b5('0x0'));var util=require(_0xc8b5('0x1'));var logger=require(_0xc8b5('0x2'))(_0xc8b5('0x3'));var moment=require(_0xc8b5('0x4'));var BPromise=require(_0xc8b5('0x5'));var rp=require(_0xc8b5('0x6'));var fs=require('fs');var path=require(_0xc8b5('0x7'));var rimraf=require(_0xc8b5('0x8'));var config=require(_0xc8b5('0x9'));var attributes=require(_0xc8b5('0xa'));module[_0xc8b5('0xb')]=function(_0x3bca72,_0x149180){return _0x3bca72[_0xc8b5('0xc')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xc8b5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 90fa202..42dfda9 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 _0xc8d2=['rpc','../../config/environment','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateVoiceDialReport','VoiceDialReport','body','options','raw','then','debug','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1dc254,_0x2ab043){var _0x549dc6=function(_0x550ddb){while(--_0x550ddb){_0x1dc254['push'](_0x1dc254['shift']());}};_0x549dc6(++_0x2ab043);}(_0xc8d2,0x1ef));var _0x2c8d=function(_0x5e3511,_0x4a9610){_0x5e3511=_0x5e3511-0x0;var _0x224685=_0xc8d2[_0x5e3511];return _0x224685;};'use strict';var _=require(_0x2c8d('0x0'));var util=require(_0x2c8d('0x1'));var moment=require(_0x2c8d('0x2'));var BPromise=require(_0x2c8d('0x3'));var rs=require(_0x2c8d('0x4'));var fs=require('fs');var Redis=require(_0x2c8d('0x5'));var db=require(_0x2c8d('0x6'))['db'];var utils=require(_0x2c8d('0x7'));var logger=require(_0x2c8d('0x8'))(_0x2c8d('0x9'));var config=require(_0x2c8d('0xa'));var jayson=require(_0x2c8d('0xb'));var client=jayson[_0x2c8d('0xc')][_0x2c8d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2944d1,_0x3765b3,_0x161390){return new BPromise(function(_0x481108,_0x16847f){return client[_0x2c8d('0xe')](_0x2944d1,_0x161390)['then'](function(_0x54757f){logger['info'](_0x2c8d('0xf'),_0x3765b3,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3765b3,_0x2c8d('0x10'),JSON[_0x2c8d('0x11')](_0x54757f));if(_0x54757f[_0x2c8d('0x12')]){if(_0x54757f[_0x2c8d('0x12')][_0x2c8d('0x13')]===0x1f4){logger['error'](_0x2c8d('0xf'),_0x3765b3,_0x54757f[_0x2c8d('0x12')]['message']);return _0x16847f(_0x54757f['error'][_0x2c8d('0x14')]);}logger['error'](_0x2c8d('0xf'),_0x3765b3,_0x54757f[_0x2c8d('0x12')]['message']);return _0x481108(_0x54757f[_0x2c8d('0x12')][_0x2c8d('0x14')]);}else{logger[_0x2c8d('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x3765b3,_0x2c8d('0x10'));_0x481108(_0x54757f[_0x2c8d('0x16')][_0x2c8d('0x14')]);}})['catch'](function(_0x31cbc6){logger[_0x2c8d('0x12')](_0x2c8d('0xf'),_0x3765b3,_0x31cbc6);_0x16847f(_0x31cbc6);});});}exports[_0x2c8d('0x17')]=function(_0xcc5113){var _0xd7b470=this;return new Promise(function(_0x2012f1,_0x296879){return db[_0x2c8d('0x18')]['create'](_0xcc5113[_0x2c8d('0x19')],{'raw':_0xcc5113[_0x2c8d('0x1a')]?_0xcc5113[_0x2c8d('0x1a')][_0x2c8d('0x1b')]===undefined?!![]:![]:!![]})[_0x2c8d('0x1c')](function(_0x5250db){logger['info']('CreateVoiceDialReport',_0xcc5113);logger[_0x2c8d('0x1d')](_0x2c8d('0x17'),_0xcc5113,JSON[_0x2c8d('0x11')](_0x5250db));_0x2012f1(_0x5250db);})[_0x2c8d('0x1e')](function(_0x4ba160){logger[_0x2c8d('0x12')](_0x2c8d('0x17'),_0x4ba160[_0x2c8d('0x14')],_0xcc5113);_0x296879(_0xd7b470['error'](0x1f4,_0x4ba160['message']));});});};exports[_0x2c8d('0x1f')]=function(_0x4f3aae){var _0x29eac4=this;return new Promise(function(_0x2c4144,_0x2dc49d){return db[_0x2c8d('0x18')][_0x2c8d('0x20')](_0x4f3aae[_0x2c8d('0x19')],{'raw':_0x4f3aae[_0x2c8d('0x1a')]?_0x4f3aae[_0x2c8d('0x1a')][_0x2c8d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3aae[_0x2c8d('0x1a')]?_0x4f3aae[_0x2c8d('0x1a')][_0x2c8d('0x21')]||null:null,'attributes':_0x4f3aae[_0x2c8d('0x1a')]?_0x4f3aae[_0x2c8d('0x1a')][_0x2c8d('0x22')]||null:null,'limit':_0x4f3aae['options']?_0x4f3aae[_0x2c8d('0x1a')][_0x2c8d('0x23')]||null:null})['then'](function(_0x1b147f){logger[_0x2c8d('0x15')](_0x2c8d('0x1f'),_0x4f3aae);logger[_0x2c8d('0x1d')]('UpdateVoiceDialReport',_0x4f3aae,JSON[_0x2c8d('0x11')](_0x1b147f));_0x2c4144(_0x1b147f);})['catch'](function(_0x2b5ebb){logger[_0x2c8d('0x12')](_0x2c8d('0x1f'),_0x2b5ebb[_0x2c8d('0x14')],_0x4f3aae);_0x2dc49d(_0x29eac4[_0x2c8d('0x12')](0x1f4,_0x2b5ebb[_0x2c8d('0x14')]));});});}; \ No newline at end of file +var _0xcbcd=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','catch','UpdateVoiceDialReport','update','where'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcbcd,0xb1));var _0xdcbc=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xcbcd[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0xdcbc('0x0'));var util=require(_0xdcbc('0x1'));var moment=require(_0xdcbc('0x2'));var BPromise=require(_0xdcbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcbc('0x4'));var db=require(_0xdcbc('0x5'))['db'];var utils=require(_0xdcbc('0x6'));var logger=require(_0xdcbc('0x7'))(_0xdcbc('0x8'));var config=require(_0xdcbc('0x9'));var jayson=require(_0xdcbc('0xa'));var client=jayson[_0xdcbc('0xb')][_0xdcbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f2d34,_0x40f860,_0x183d6c){return new BPromise(function(_0x365125,_0x4ffc39){return client[_0xdcbc('0xd')](_0x3f2d34,_0x183d6c)[_0xdcbc('0xe')](function(_0x57154c){logger[_0xdcbc('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x40f860,_0xdcbc('0x10'));logger[_0xdcbc('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x40f860,_0xdcbc('0x10'),JSON['stringify'](_0x57154c));if(_0x57154c[_0xdcbc('0x12')]){if(_0x57154c[_0xdcbc('0x12')]['code']===0x1f4){logger[_0xdcbc('0x12')](_0xdcbc('0x13'),_0x40f860,_0x57154c['error']['message']);return _0x4ffc39(_0x57154c[_0xdcbc('0x12')][_0xdcbc('0x14')]);}logger['error'](_0xdcbc('0x13'),_0x40f860,_0x57154c['error']['message']);return _0x365125(_0x57154c[_0xdcbc('0x12')][_0xdcbc('0x14')]);}else{logger['info'](_0xdcbc('0x13'),_0x40f860,_0xdcbc('0x10'));_0x365125(_0x57154c[_0xdcbc('0x15')]['message']);}})['catch'](function(_0x1eb0a4){logger[_0xdcbc('0x12')](_0xdcbc('0x13'),_0x40f860,_0x1eb0a4);_0x4ffc39(_0x1eb0a4);});});}exports[_0xdcbc('0x16')]=function(_0x5bb333){var _0x223abe=this;return new Promise(function(_0x181710,_0x10196d){return db[_0xdcbc('0x17')][_0xdcbc('0x18')](_0x5bb333[_0xdcbc('0x19')],{'raw':_0x5bb333[_0xdcbc('0x1a')]?_0x5bb333[_0xdcbc('0x1a')][_0xdcbc('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31769c){logger['info']('CreateVoiceDialReport',_0x5bb333);logger['debug']('CreateVoiceDialReport',_0x5bb333,JSON[_0xdcbc('0x1c')](_0x31769c));_0x181710(_0x31769c);})[_0xdcbc('0x1d')](function(_0x140259){logger[_0xdcbc('0x12')](_0xdcbc('0x16'),_0x140259[_0xdcbc('0x14')],_0x5bb333);_0x10196d(_0x223abe[_0xdcbc('0x12')](0x1f4,_0x140259[_0xdcbc('0x14')]));});});};exports[_0xdcbc('0x1e')]=function(_0x8f0365){var _0x58f5fa=this;return new Promise(function(_0x256cbf,_0x1b4cf3){return db[_0xdcbc('0x17')][_0xdcbc('0x1f')](_0x8f0365[_0xdcbc('0x19')],{'raw':_0x8f0365[_0xdcbc('0x1a')]?_0x8f0365[_0xdcbc('0x1a')][_0xdcbc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8f0365[_0xdcbc('0x1a')]?_0x8f0365[_0xdcbc('0x1a')][_0xdcbc('0x20')]||null:null,'attributes':_0x8f0365[_0xdcbc('0x1a')]?_0x8f0365[_0xdcbc('0x1a')][_0xdcbc('0x21')]||null:null,'limit':_0x8f0365[_0xdcbc('0x1a')]?_0x8f0365['options'][_0xdcbc('0x22')]||null:null})[_0xdcbc('0xe')](function(_0x5f41c8){logger[_0xdcbc('0xf')]('UpdateVoiceDialReport',_0x8f0365);logger['debug'](_0xdcbc('0x1e'),_0x8f0365,JSON[_0xdcbc('0x1c')](_0x5f41c8));_0x256cbf(_0x5f41c8);})[_0xdcbc('0x1d')](function(_0xa8d753){logger[_0xdcbc('0x12')](_0xdcbc('0x1e'),_0xa8d753[_0xdcbc('0x14')],_0x8f0365);_0x1b4cf3(_0x58f5fa[_0xdcbc('0x12')](0x1f4,_0xa8d753[_0xdcbc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index dc773b1..84d107e 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 _0x456f=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cf989,_0x168c67){var _0x41f465=function(_0x5a580b){while(--_0x5a580b){_0x1cf989['push'](_0x1cf989['shift']());}};_0x41f465(++_0x168c67);}(_0x456f,0x93));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf456('0x0'));var util=require(_0xf456('0x1'));var path=require('path');var timeout=require(_0xf456('0x2'));var express=require(_0xf456('0x3'));var router=express[_0xf456('0x4')]();var fs_extra=require(_0xf456('0x5'));var auth=require(_0xf456('0x6'));var interaction=require(_0xf456('0x7'));var config=require(_0xf456('0x8'));var controller=require(_0xf456('0x9'));router[_0xf456('0xa')]('/',auth[_0xf456('0xb')](),controller[_0xf456('0xc')]);router[_0xf456('0xa')](_0xf456('0xd'),auth[_0xf456('0xb')](),controller[_0xf456('0xe')]);router[_0xf456('0xf')]('/',auth[_0xf456('0xb')](),controller[_0xf456('0x10')]);router[_0xf456('0xf')](_0xf456('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf456('0x12')]('/:id',auth[_0xf456('0xb')](),controller[_0xf456('0x13')]);router[_0xf456('0x14')]('/:id',auth[_0xf456('0xb')](),controller[_0xf456('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4dc7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','put','update','delete','destroy','exports','connect-timeout','express','Router'];(function(_0x4dd557,_0x3c3e88){var _0x5040e4=function(_0x4784ca){while(--_0x4784ca){_0x4dd557['push'](_0x4dd557['shift']());}};_0x5040e4(++_0x3c3e88);}(_0x4dc7,0x151));var _0x74dc=function(_0x5772ef,_0x162c8b){_0x5772ef=_0x5772ef-0x0;var _0x1337d6=_0x4dc7[_0x5772ef];return _0x1337d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x74dc('0x0'));var express=require(_0x74dc('0x1'));var router=express[_0x74dc('0x2')]();var fs_extra=require(_0x74dc('0x3'));var auth=require(_0x74dc('0x4'));var interaction=require(_0x74dc('0x5'));var config=require(_0x74dc('0x6'));var controller=require(_0x74dc('0x7'));router[_0x74dc('0x8')]('/',auth[_0x74dc('0x9')](),controller[_0x74dc('0xa')]);router[_0x74dc('0x8')](_0x74dc('0xb'),auth[_0x74dc('0x9')](),controller['show']);router[_0x74dc('0xc')]('/',auth[_0x74dc('0x9')](),controller[_0x74dc('0xd')]);router['post'](_0x74dc('0xe'),auth[_0x74dc('0x9')](),controller['addApplications']);router[_0x74dc('0xf')](_0x74dc('0xb'),auth[_0x74dc('0x9')](),controller[_0x74dc('0x10')]);router[_0x74dc('0x11')](_0x74dc('0xb'),auth['isAuthenticated'](),controller[_0x74dc('0x12')]);module[_0x74dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d4a04d5..8dfafa4 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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x1975f8,_0x14cdb7){var _0x35a47f=function(_0x3bae70){while(--_0x3bae70){_0x1975f8['push'](_0x1975f8['shift']());}};_0x35a47f(++_0x14cdb7);}(_0xe706,0xa3));var _0x6e70=function(_0x2a6490,_0x1adf0f){_0x2a6490=_0x2a6490-0x0;var _0x1b31df=_0xe706[_0x2a6490];return _0x1b31df;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xcb91=['outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound'];(function(_0x3aa9ea,_0xc1d3af){var _0x2d926f=function(_0x42f1cd){while(--_0x42f1cd){_0x3aa9ea['push'](_0x3aa9ea['shift']());}};_0x2d926f(++_0xc1d3af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcb91[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x1cb9('0x1')},'tag':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x2')},'appdata':{'type':Sequelize[_0x1cb9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1cb9('0x3'),_0x1cb9('0x4'),'internal',_0x1cb9('0x5'),_0x1cb9('0x6'),'system',_0x1cb9('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x8')},'IntervalId':{'type':Sequelize[_0x1cb9('0x9')]},'isApp':{'type':Sequelize[_0x1cb9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1cb9('0x9')]},'recordingFormat':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':_0x1cb9('0xb')},'answer':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1cb9('0xc')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0394f93..8501fa7 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 _0x2ec1=['pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','options','params','body','startsWith','exten','concat','create','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','cutdigits','alias','context','addApplications','sequelize','Transaction','ISOLATION_LEVELS','VoiceExtensionId','isApp','createRouting','findAndCountAll','stack','lodash','ioredis','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','map','value','includes','type','find','destroy','error','name','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x2ec1,0x1e3));var _0x12ec=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x2ec1[_0x441eab];return _0xe6ff41;};'use strict';var _=require(_0x12ec('0x0'));var Redis=require(_0x12ec('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x12ec('0x2'))['db'];config['redis']=_[_0x12ec('0x3')](config['redis'],{'host':_0x12ec('0x4'),'port':0x18eb});var socket=require(_0x12ec('0x5'))(new Redis(config[_0x12ec('0x6')]));require('./voiceExtension.socket')[_0x12ec('0x7')](socket);function respondWithStatusCode(_0x520dc0,_0x487f0e){_0x487f0e=_0x487f0e||0xcc;return function(_0x36ff45){if(_0x36ff45){return _0x520dc0[_0x12ec('0x8')](_0x487f0e);}return _0x520dc0[_0x12ec('0x9')](_0x487f0e)[_0x12ec('0xa')]();};}function respondWithResult(_0x2b6495,_0x298aca){_0x298aca=_0x298aca||0xc8;return function(_0x5ad2c4){if(_0x5ad2c4){return _0x2b6495[_0x12ec('0x9')](_0x298aca)[_0x12ec('0xb')](_0x5ad2c4);}};}function respondWithFilteredResult(_0x7ee1eb,_0x14f434){return function(_0x2b2080){if(_0x2b2080){var _0x26852c=typeof _0x14f434[_0x12ec('0xc')]===_0x12ec('0xd')&&typeof _0x14f434[_0x12ec('0xe')]==='undefined';var _0x4a73e2=_0x2b2080[_0x12ec('0xf')];var _0xcd35fd=_0x26852c?0x0:_0x14f434['offset'];var _0x214ec8=_0x26852c?_0x2b2080[_0x12ec('0xf')]:_0x14f434[_0x12ec('0xc')]+_0x14f434[_0x12ec('0xe')];var _0x3e09e5;if(_0x214ec8>=_0x4a73e2){_0x214ec8=_0x4a73e2;_0x3e09e5=0xc8;}else{_0x3e09e5=0xce;}_0x7ee1eb[_0x12ec('0x9')](_0x3e09e5);return _0x7ee1eb[_0x12ec('0x10')](_0x12ec('0x11'),_0xcd35fd+'-'+_0x214ec8+'/'+_0x4a73e2)[_0x12ec('0xb')](_0x2b2080);}return null;};}function removeEntity(_0x26ca3e){return function(_0x31a592){if(_0x31a592){return _0x31a592['destroy']()[_0x12ec('0x12')](function(){var _0x57a2a0=_0x31a592[_0x12ec('0x13')]({'plain':!![]});var _0x2c8073=[{'name':_0x12ec('0x14'),'value':_0x12ec('0x15'),'ignore':![]},{'name':_0x12ec('0x16'),'value':_0x12ec('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x12ec('0x18'),'ignore':![]}];var _0x478fca=_(_0x2c8073)['filter'](_0x12ec('0x19'))[_0x12ec('0x1a')](_0x12ec('0x1b'))[_0x12ec('0x1b')]();if(_[_0x12ec('0x1c')](_0x478fca,_0x57a2a0[_0x12ec('0x1d')])){return;}var _0x234a93=_[_0x12ec('0x1e')](_0x2c8073,[_0x12ec('0x1b'),_0x57a2a0[_0x12ec('0x1d')]])['name'];return db['UserProfileResource'][_0x12ec('0x1f')]({'where':{'type':_0x234a93,'resourceId':_0x57a2a0['id']}})[_0x12ec('0x12')](function(){return _0x31a592;});})[_0x12ec('0x12')](function(){_0x26ca3e[_0x12ec('0x9')](0xcc)[_0x12ec('0xa')]();});}};}function handleEntityNotFound(_0xed5a4e){return function(_0x3b2291){if(!_0x3b2291){_0xed5a4e['sendStatus'](0x194);}return _0x3b2291;};}function handleError(_0x1daa88,_0x5d6a7c){_0x5d6a7c=_0x5d6a7c||0x1f4;return function(_0x4a9c55){logger[_0x12ec('0x20')](_0x4a9c55['stack']);if(_0x4a9c55['name']){delete _0x4a9c55[_0x12ec('0x21')];}_0x1daa88[_0x12ec('0x9')](_0x5d6a7c)[_0x12ec('0x22')](_0x4a9c55);};}exports[_0x12ec('0x23')]=function(_0x28a293,_0x4c4e9d){var _0x5c1edd={},_0xaf17b7={},_0x595bc0={'count':0x0,'rows':[]};var _0x42a34d=_[_0x12ec('0x1a')](db[_0x12ec('0x24')]['rawAttributes'],function(_0x1a847d){return{'name':_0x1a847d[_0x12ec('0x25')],'type':_0x1a847d[_0x12ec('0x1d')][_0x12ec('0x26')]};});_0xaf17b7[_0x12ec('0x27')]=_['map'](_0x42a34d,_0x12ec('0x21'));_0xaf17b7[_0x12ec('0x28')]=_[_0x12ec('0x29')](_0x28a293['query']);_0xaf17b7[_0x12ec('0x2a')]=_[_0x12ec('0x2b')](_0xaf17b7[_0x12ec('0x27')],_0xaf17b7[_0x12ec('0x28')]);_0x5c1edd[_0x12ec('0x2c')]=_['intersection'](_0xaf17b7['model'],qs[_0x12ec('0x2d')](_0x28a293[_0x12ec('0x28')][_0x12ec('0x2d')]));_0x5c1edd['attributes']=_0x5c1edd[_0x12ec('0x2c')][_0x12ec('0x2e')]?_0x5c1edd['attributes']:_0xaf17b7[_0x12ec('0x27')];if(!_0x28a293[_0x12ec('0x28')][_0x12ec('0x2f')](_0x12ec('0x30'))){_0x5c1edd[_0x12ec('0xe')]=qs[_0x12ec('0xe')](_0x28a293['query'][_0x12ec('0xe')]);_0x5c1edd[_0x12ec('0xc')]=qs['offset'](_0x28a293[_0x12ec('0x28')][_0x12ec('0xc')]);}_0x5c1edd['order']=qs['sort'](_0x28a293['query'][_0x12ec('0x31')]);_0x5c1edd[_0x12ec('0x32')]=qs[_0x12ec('0x2a')](_[_0x12ec('0x33')](_0x28a293[_0x12ec('0x28')],_0xaf17b7['filters']),_0x42a34d);if(_0x28a293[_0x12ec('0x28')][_0x12ec('0x34')]){_0x5c1edd['where']=_['merge'](_0x5c1edd[_0x12ec('0x32')],{'$or':_['map'](_0x42a34d,function(_0x11dacc){if(_0x11dacc[_0x12ec('0x1d')]!==_0x12ec('0x35')){var _0x218725={};_0x218725[_0x11dacc[_0x12ec('0x21')]]={'$like':'%'+_0x28a293[_0x12ec('0x28')][_0x12ec('0x34')]+'%'};return _0x218725;}})});}_0x5c1edd=_['merge']({},_0x5c1edd,_0x28a293['options']);var _0x43aad9={'where':_0x5c1edd[_0x12ec('0x32')]};return db[_0x12ec('0x24')][_0x12ec('0xf')](_0x43aad9)[_0x12ec('0x12')](function(_0x501154){_0x595bc0['count']=_0x501154;if(_0x28a293[_0x12ec('0x28')][_0x12ec('0x36')]){_0x5c1edd[_0x12ec('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x12ec('0x38')](_0x5c1edd);})[_0x12ec('0x12')](function(_0x40a309){_0x595bc0[_0x12ec('0x39')]=_0x40a309;return _0x595bc0;})['then'](respondWithFilteredResult(_0x4c4e9d,_0x5c1edd))[_0x12ec('0x3a')](handleError(_0x4c4e9d,null));};exports[_0x12ec('0x3b')]=function(_0x7422ae,_0x32aa06){var _0x43f0f1={'raw':![],'where':{'id':_0x7422ae['params']['id']}},_0x488287={};_0x488287[_0x12ec('0x27')]=_[_0x12ec('0x29')](db[_0x12ec('0x24')][_0x12ec('0x3c')]);_0x488287['query']=_[_0x12ec('0x29')](_0x7422ae['query']);_0x488287['filters']=_[_0x12ec('0x2b')](_0x488287[_0x12ec('0x27')],_0x488287['query']);_0x43f0f1[_0x12ec('0x2c')]=_[_0x12ec('0x2b')](_0x488287[_0x12ec('0x27')],qs[_0x12ec('0x2d')](_0x7422ae[_0x12ec('0x28')]['fields']));_0x43f0f1[_0x12ec('0x2c')]=_0x43f0f1[_0x12ec('0x2c')][_0x12ec('0x2e')]?_0x43f0f1['attributes']:_0x488287['model'];if(_0x7422ae[_0x12ec('0x28')][_0x12ec('0x36')]){_0x43f0f1['include']=[{'all':!![]}];}_0x43f0f1=_[_0x12ec('0x3d')]({},_0x43f0f1,_0x7422ae[_0x12ec('0x3e')]);return db['VoiceExtension']['find'](_0x43f0f1)[_0x12ec('0x12')](handleEntityNotFound(_0x32aa06,null))[_0x12ec('0x12')](respondWithResult(_0x32aa06,null))[_0x12ec('0x3a')](handleError(_0x32aa06,null));};exports['destroy']=function(_0x2081a8,_0xe15977){return db[_0x12ec('0x24')][_0x12ec('0x1e')]({'where':{'id':_0x2081a8[_0x12ec('0x3f')]['id']}})[_0x12ec('0x12')](handleEntityNotFound(_0xe15977,null))[_0x12ec('0x12')](removeEntity(_0xe15977,null))[_0x12ec('0x3a')](handleError(_0xe15977,null));};exports['create']=function(_0x148df2,_0x294a3a){if(_0x148df2[_0x12ec('0x40')]['type']==='outbound'&&!_[_0x12ec('0x41')](_0x148df2[_0x12ec('0x40')][_0x12ec('0x42')],'_')){_0x148df2[_0x12ec('0x40')]['exten']='_'[_0x12ec('0x43')](_0x148df2[_0x12ec('0x40')][_0x12ec('0x42')]);}return db[_0x12ec('0x24')][_0x12ec('0x44')](_0x148df2['body'],{'raw':![]})[_0x12ec('0x12')](function(_0x3afd07){var _0x2c46cb=_0x148df2['user'][_0x12ec('0x13')]({'plain':!![]});if(!_0x2c46cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c46cb[_0x12ec('0x45')]===_0x12ec('0x46')){var _0x2e4e85=_0x3afd07['get']({'plain':!![]});var _0x5a7bc7=[{'name':_0x12ec('0x14'),'value':_0x12ec('0x15')},{'name':_0x12ec('0x16'),'value':_0x12ec('0x17')},{'name':'InternalRoutes','value':'internal'}];var _0x4ce873=_[_0x12ec('0x1e')](_0x5a7bc7,[_0x12ec('0x1b'),_0x2e4e85['type']])[_0x12ec('0x21')];return db['UserProfileSection'][_0x12ec('0x1e')]({'where':{'name':_0x4ce873,'userProfileId':_0x2c46cb[_0x12ec('0x47')]},'raw':!![]})[_0x12ec('0x12')](function(_0x1969d2){if(_0x1969d2&&_0x1969d2[_0x12ec('0x48')]===0x0){return db[_0x12ec('0x49')][_0x12ec('0x44')]({'name':_0x2e4e85['name'],'resourceId':_0x2e4e85['id'],'type':_0x1969d2[_0x12ec('0x21')],'sectionId':_0x1969d2['id']},{})[_0x12ec('0x12')](function(){return _0x3afd07;});}else{return _0x3afd07;}})[_0x12ec('0x3a')](function(_0x6df3f6){logger['error'](_0x12ec('0x4a'),_0x6df3f6);throw _0x6df3f6;});}return _0x3afd07;})[_0x12ec('0x12')](respondWithResult(_0x294a3a,0xc9))[_0x12ec('0x3a')](handleError(_0x294a3a,null));};exports[_0x12ec('0x4b')]=function(_0x21c2d9,_0x3e4df9){if(_0x21c2d9['body']['id']){delete _0x21c2d9[_0x12ec('0x40')]['id'];}return db[_0x12ec('0x24')][_0x12ec('0x1e')]({'where':{'id':_0x21c2d9[_0x12ec('0x3f')]['id']}})[_0x12ec('0x12')](handleEntityNotFound(_0x3e4df9,null))[_0x12ec('0x12')](function(_0x501fae){if(_0x501fae){return db[_0x12ec('0x24')][_0x12ec('0x4b')](_[_0x12ec('0x33')](_0x21c2d9['body'],['exten','context',_0x12ec('0x4c'),'recordingFormat',_0x12ec('0x4d'),'mandatoryDisposition',_0x12ec('0x4e')]),{'where':{'context':_0x501fae[_0x12ec('0x4f')],'exten':_0x501fae[_0x12ec('0x42')]},'individualHooks':!![]})[_0x12ec('0x12')](function(_0x1a64e5){return _0x1a64e5;});}return null;})[_0x12ec('0x12')](respondWithStatusCode(_0x3e4df9,null))['catch'](handleError(_0x3e4df9,null));};exports[_0x12ec('0x50')]=function(_0x3b4d21,_0x466ebe){var _0x566319=_0x3b4d21[_0x12ec('0x3f')]['id'];var _0x13970f=_0x3b4d21[_0x12ec('0x40')];var _0x287328=0xc8;var _0x26c699=null;return db[_0x12ec('0x51')]['transaction']({'isolationLevel':db['sequelize'][_0x12ec('0x52')][_0x12ec('0x53')]['READ_COMMITTED']},function(_0x570db5){return db['VoiceExtension']['findOne']({'where':{'id':_0x566319},'transaction':_0x570db5})[_0x12ec('0x12')](function(_0x3ff5c0){if(_0x3ff5c0){return db[_0x12ec('0x24')][_0x12ec('0x1f')]({'where':{'VoiceExtensionId':_0x566319},'transaction':_0x570db5})['then'](function(){var _0x724d46=_['map'](_0x13970f,function(_0x5dab3b){_0x5dab3b[_0x12ec('0x54')]=_0x566319;_0x5dab3b[_0x12ec('0x55')]=!![];return _0x5dab3b;});return _0x3ff5c0[_0x12ec('0x56')](_0x724d46);})['then'](function(_0x548a92){return db[_0x12ec('0x24')]['bulkCreate'](_0x548a92,{'transaction':_0x570db5});});}else{_0x287328=0x194;_0x26c699=[];}});})[_0x12ec('0x12')](function(){if(_0x287328!==0x194){return db[_0x12ec('0x24')][_0x12ec('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x566319},'order':'cast(priority\x20as\x20unsigned)'})[_0x12ec('0x12')](function(_0x1e5150){_0x26c699=_0x1e5150;});}})[_0x12ec('0x3a')](function(_0x3d7aa1){_0x287328=0x1f4;logger[_0x12ec('0x20')](_0x3d7aa1[_0x12ec('0x58')]);if(_0x3d7aa1[_0x12ec('0x21')]){delete _0x3d7aa1[_0x12ec('0x21')];}_0x26c699=_0x3d7aa1;})['finally'](function(){if(_0x26c699===null){_0x466ebe['sendStatus'](_0x287328);}else{if(_0x287328===0x1f4){_0x466ebe[_0x12ec('0x9')](_0x287328)['send'](_0x26c699);}else{_0x466ebe['status'](_0x287328)['json'](_0x26c699);}}});}; \ No newline at end of file +var _0x48d8=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','VoiceExtension','includeAll','include','findAll','catch','show','params','merge','startsWith','body','exten','concat','create','user','OutboundRoutes','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','get','InboundRoutes','inbound','outbound','internal','ignore','map','value','includes','type','find','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters'];(function(_0xcaa920,_0x2b96fa){var _0x534de4=function(_0x41bce1){while(--_0x41bce1){_0xcaa920['push'](_0xcaa920['shift']());}};_0x534de4(++_0x2b96fa);}(_0x48d8,0x92));var _0x848d=function(_0x22f96e,_0x303b60){_0x22f96e=_0x22f96e-0x0;var _0x1f5ecd=_0x48d8[_0x22f96e];return _0x1f5ecd;};'use strict';var _=require(_0x848d('0x0'));var Redis=require(_0x848d('0x1'));var qs=require(_0x848d('0x2'));var logger=require(_0x848d('0x3'))(_0x848d('0x4'));var config=require('../../config/environment');var db=require(_0x848d('0x5'))['db'];config[_0x848d('0x6')]=_['defaults'](config[_0x848d('0x6')],{'host':_0x848d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x848d('0x6')]));require(_0x848d('0x8'))[_0x848d('0x9')](socket);function respondWithStatusCode(_0x4bddf1,_0x2d8d68){_0x2d8d68=_0x2d8d68||0xcc;return function(_0xa0eca9){if(_0xa0eca9){return _0x4bddf1[_0x848d('0xa')](_0x2d8d68);}return _0x4bddf1[_0x848d('0xb')](_0x2d8d68)[_0x848d('0xc')]();};}function respondWithResult(_0x41d58f,_0x3fa26a){_0x3fa26a=_0x3fa26a||0xc8;return function(_0x1f4d8f){if(_0x1f4d8f){return _0x41d58f['status'](_0x3fa26a)['json'](_0x1f4d8f);}};}function respondWithFilteredResult(_0x51ea3e,_0x174548){return function(_0x389006){if(_0x389006){var _0x38cb6c=typeof _0x174548[_0x848d('0xd')]===_0x848d('0xe')&&typeof _0x174548[_0x848d('0xf')]==='undefined';var _0x1dd9f1=_0x389006[_0x848d('0x10')];var _0xea4d7a=_0x38cb6c?0x0:_0x174548[_0x848d('0xd')];var _0xeef42c=_0x38cb6c?_0x389006['count']:_0x174548[_0x848d('0xd')]+_0x174548[_0x848d('0xf')];var _0x1251de;if(_0xeef42c>=_0x1dd9f1){_0xeef42c=_0x1dd9f1;_0x1251de=0xc8;}else{_0x1251de=0xce;}_0x51ea3e[_0x848d('0xb')](_0x1251de);return _0x51ea3e[_0x848d('0x11')](_0x848d('0x12'),_0xea4d7a+'-'+_0xeef42c+'/'+_0x1dd9f1)[_0x848d('0x13')](_0x389006);}return null;};}function removeEntity(_0x6a3fb8){return function(_0x42f424){if(_0x42f424){return _0x42f424['destroy']()[_0x848d('0x14')](function(){var _0x4b8e15=_0x42f424[_0x848d('0x15')]({'plain':!![]});var _0x11ed12=[{'name':_0x848d('0x16'),'value':_0x848d('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x848d('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0x848d('0x19'),'ignore':![]}];var _0x1efcf9=_(_0x11ed12)['filter'](_0x848d('0x1a'))[_0x848d('0x1b')](_0x848d('0x1c'))['value']();if(_[_0x848d('0x1d')](_0x1efcf9,_0x4b8e15[_0x848d('0x1e')])){return;}var _0x17c91a=_[_0x848d('0x1f')](_0x11ed12,['value',_0x4b8e15[_0x848d('0x1e')]])['name'];return db[_0x848d('0x20')][_0x848d('0x21')]({'where':{'type':_0x17c91a,'resourceId':_0x4b8e15['id']}})[_0x848d('0x14')](function(){return _0x42f424;});})[_0x848d('0x14')](function(){_0x6a3fb8['status'](0xcc)[_0x848d('0xc')]();});}};}function handleEntityNotFound(_0x54bc18){return function(_0x2a0984){if(!_0x2a0984){_0x54bc18[_0x848d('0xa')](0x194);}return _0x2a0984;};}function handleError(_0x29a004,_0x8d7d60){_0x8d7d60=_0x8d7d60||0x1f4;return function(_0x552445){logger[_0x848d('0x22')](_0x552445[_0x848d('0x23')]);if(_0x552445[_0x848d('0x24')]){delete _0x552445['name'];}_0x29a004[_0x848d('0xb')](_0x8d7d60)[_0x848d('0x25')](_0x552445);};}exports[_0x848d('0x26')]=function(_0x143ce8,_0xc3d41b){var _0x4181bd={},_0x17af4b={},_0x440376={'count':0x0,'rows':[]};var _0x3d7ed3=_[_0x848d('0x1b')](db['VoiceExtension'][_0x848d('0x27')],function(_0x188e0f){return{'name':_0x188e0f['fieldName'],'type':_0x188e0f[_0x848d('0x1e')]['key']};});_0x17af4b[_0x848d('0x28')]=_[_0x848d('0x1b')](_0x3d7ed3,_0x848d('0x24'));_0x17af4b['query']=_[_0x848d('0x29')](_0x143ce8[_0x848d('0x2a')]);_0x17af4b[_0x848d('0x2b')]=_[_0x848d('0x2c')](_0x17af4b[_0x848d('0x28')],_0x17af4b[_0x848d('0x2a')]);_0x4181bd[_0x848d('0x2d')]=_[_0x848d('0x2c')](_0x17af4b[_0x848d('0x28')],qs['fields'](_0x143ce8[_0x848d('0x2a')][_0x848d('0x2e')]));_0x4181bd[_0x848d('0x2d')]=_0x4181bd[_0x848d('0x2d')][_0x848d('0x2f')]?_0x4181bd['attributes']:_0x17af4b[_0x848d('0x28')];if(!_0x143ce8[_0x848d('0x2a')][_0x848d('0x30')](_0x848d('0x31'))){_0x4181bd['limit']=qs['limit'](_0x143ce8[_0x848d('0x2a')][_0x848d('0xf')]);_0x4181bd[_0x848d('0xd')]=qs[_0x848d('0xd')](_0x143ce8['query']['offset']);}_0x4181bd[_0x848d('0x32')]=qs[_0x848d('0x33')](_0x143ce8[_0x848d('0x2a')]['sort']);_0x4181bd['where']=qs[_0x848d('0x2b')](_[_0x848d('0x34')](_0x143ce8[_0x848d('0x2a')],_0x17af4b[_0x848d('0x2b')]),_0x3d7ed3);if(_0x143ce8[_0x848d('0x2a')]['filter']){_0x4181bd[_0x848d('0x35')]=_['merge'](_0x4181bd[_0x848d('0x35')],{'$or':_[_0x848d('0x1b')](_0x3d7ed3,function(_0xdb5ff7){if(_0xdb5ff7[_0x848d('0x1e')]!==_0x848d('0x36')){var _0x40d4cb={};_0x40d4cb[_0xdb5ff7[_0x848d('0x24')]]={'$like':'%'+_0x143ce8[_0x848d('0x2a')][_0x848d('0x37')]+'%'};return _0x40d4cb;}})});}_0x4181bd=_['merge']({},_0x4181bd,_0x143ce8[_0x848d('0x38')]);var _0x556b1d={'where':_0x4181bd[_0x848d('0x35')]};return db[_0x848d('0x39')][_0x848d('0x10')](_0x556b1d)[_0x848d('0x14')](function(_0x1ca80b){_0x440376[_0x848d('0x10')]=_0x1ca80b;if(_0x143ce8[_0x848d('0x2a')][_0x848d('0x3a')]){_0x4181bd[_0x848d('0x3b')]=[{'all':!![]}];}return db[_0x848d('0x39')][_0x848d('0x3c')](_0x4181bd);})[_0x848d('0x14')](function(_0x45d72e){_0x440376['rows']=_0x45d72e;return _0x440376;})['then'](respondWithFilteredResult(_0xc3d41b,_0x4181bd))[_0x848d('0x3d')](handleError(_0xc3d41b,null));};exports[_0x848d('0x3e')]=function(_0x46d992,_0x482833){var _0x2b21fe={'raw':![],'where':{'id':_0x46d992[_0x848d('0x3f')]['id']}},_0x18f71b={};_0x18f71b[_0x848d('0x28')]=_[_0x848d('0x29')](db[_0x848d('0x39')][_0x848d('0x27')]);_0x18f71b['query']=_[_0x848d('0x29')](_0x46d992[_0x848d('0x2a')]);_0x18f71b[_0x848d('0x2b')]=_['intersection'](_0x18f71b['model'],_0x18f71b['query']);_0x2b21fe[_0x848d('0x2d')]=_['intersection'](_0x18f71b[_0x848d('0x28')],qs[_0x848d('0x2e')](_0x46d992[_0x848d('0x2a')][_0x848d('0x2e')]));_0x2b21fe['attributes']=_0x2b21fe[_0x848d('0x2d')]['length']?_0x2b21fe[_0x848d('0x2d')]:_0x18f71b['model'];if(_0x46d992[_0x848d('0x2a')][_0x848d('0x3a')]){_0x2b21fe[_0x848d('0x3b')]=[{'all':!![]}];}_0x2b21fe=_[_0x848d('0x40')]({},_0x2b21fe,_0x46d992[_0x848d('0x38')]);return db[_0x848d('0x39')][_0x848d('0x1f')](_0x2b21fe)[_0x848d('0x14')](handleEntityNotFound(_0x482833,null))[_0x848d('0x14')](respondWithResult(_0x482833,null))[_0x848d('0x3d')](handleError(_0x482833,null));};exports[_0x848d('0x21')]=function(_0x3e4a10,_0x55fd97){return db[_0x848d('0x39')][_0x848d('0x1f')]({'where':{'id':_0x3e4a10[_0x848d('0x3f')]['id']}})[_0x848d('0x14')](handleEntityNotFound(_0x55fd97,null))['then'](removeEntity(_0x55fd97,null))[_0x848d('0x3d')](handleError(_0x55fd97,null));};exports['create']=function(_0x1d2eb1,_0x1aa361){if(_0x1d2eb1['body'][_0x848d('0x1e')]===_0x848d('0x18')&&!_[_0x848d('0x41')](_0x1d2eb1[_0x848d('0x42')][_0x848d('0x43')],'_')){_0x1d2eb1[_0x848d('0x42')][_0x848d('0x43')]='_'[_0x848d('0x44')](_0x1d2eb1['body'][_0x848d('0x43')]);}return db[_0x848d('0x39')][_0x848d('0x45')](_0x1d2eb1['body'],{'raw':![]})['then'](function(_0x2a29ec){var _0x5022fb=_0x1d2eb1[_0x848d('0x46')][_0x848d('0x15')]({'plain':!![]});if(!_0x5022fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5022fb['role']===_0x848d('0x46')){var _0x1f5895=_0x2a29ec[_0x848d('0x15')]({'plain':!![]});var _0x5aed82=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x848d('0x47'),'value':_0x848d('0x18')},{'name':_0x848d('0x48'),'value':_0x848d('0x19')}];var _0x44d20=_[_0x848d('0x1f')](_0x5aed82,['value',_0x1f5895[_0x848d('0x1e')]])[_0x848d('0x24')];return db[_0x848d('0x49')]['find']({'where':{'name':_0x44d20,'userProfileId':_0x5022fb['userProfileId']},'raw':!![]})['then'](function(_0x41092c){if(_0x41092c&&_0x41092c[_0x848d('0x4a')]===0x0){return db['UserProfileResource'][_0x848d('0x45')]({'name':_0x1f5895[_0x848d('0x24')],'resourceId':_0x1f5895['id'],'type':_0x41092c[_0x848d('0x24')],'sectionId':_0x41092c['id']},{})[_0x848d('0x14')](function(){return _0x2a29ec;});}else{return _0x2a29ec;}})['catch'](function(_0x402a99){logger[_0x848d('0x22')](_0x848d('0x4b'),_0x402a99);throw _0x402a99;});}return _0x2a29ec;})[_0x848d('0x14')](respondWithResult(_0x1aa361,0xc9))[_0x848d('0x3d')](handleError(_0x1aa361,null));};exports[_0x848d('0x4c')]=function(_0x196c1f,_0x3b4f7b){if(_0x196c1f['body']['id']){delete _0x196c1f[_0x848d('0x42')]['id'];}return db['VoiceExtension'][_0x848d('0x1f')]({'where':{'id':_0x196c1f[_0x848d('0x3f')]['id']}})[_0x848d('0x14')](handleEntityNotFound(_0x3b4f7b,null))[_0x848d('0x14')](function(_0x3eaf14){if(_0x3eaf14){return db['VoiceExtension']['update'](_[_0x848d('0x34')](_0x196c1f[_0x848d('0x42')],[_0x848d('0x43'),'context',_0x848d('0x4d'),_0x848d('0x4e'),_0x848d('0x4f'),'mandatoryDisposition',_0x848d('0x50')]),{'where':{'context':_0x3eaf14[_0x848d('0x51')],'exten':_0x3eaf14[_0x848d('0x43')]},'individualHooks':!![]})['then'](function(_0x3f90c0){return _0x3f90c0;});}return null;})[_0x848d('0x14')](respondWithStatusCode(_0x3b4f7b,null))[_0x848d('0x3d')](handleError(_0x3b4f7b,null));};exports[_0x848d('0x52')]=function(_0x3bcc2b,_0x3279a7){var _0x59e11d=_0x3bcc2b['params']['id'];var _0x1cd784=_0x3bcc2b[_0x848d('0x42')];var _0x48c844=0xc8;var _0x2a751b=null;return db[_0x848d('0x53')][_0x848d('0x54')]({'isolationLevel':db['sequelize'][_0x848d('0x55')][_0x848d('0x56')][_0x848d('0x57')]},function(_0x3a4025){return db[_0x848d('0x39')][_0x848d('0x58')]({'where':{'id':_0x59e11d},'transaction':_0x3a4025})[_0x848d('0x14')](function(_0x55bb40){if(_0x55bb40){return db['VoiceExtension'][_0x848d('0x21')]({'where':{'VoiceExtensionId':_0x59e11d},'transaction':_0x3a4025})['then'](function(){var _0x455c08=_['map'](_0x1cd784,function(_0x1a8dbc){_0x1a8dbc[_0x848d('0x59')]=_0x59e11d;_0x1a8dbc[_0x848d('0x5a')]=!![];return _0x1a8dbc;});return _0x55bb40[_0x848d('0x5b')](_0x455c08);})['then'](function(_0x58cb56){return db[_0x848d('0x39')]['bulkCreate'](_0x58cb56,{'transaction':_0x3a4025});});}else{_0x48c844=0x194;_0x2a751b=[];}});})[_0x848d('0x14')](function(){if(_0x48c844!==0x194){return db[_0x848d('0x39')][_0x848d('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x59e11d},'order':_0x848d('0x5d')})[_0x848d('0x14')](function(_0x1f9b4e){_0x2a751b=_0x1f9b4e;});}})[_0x848d('0x3d')](function(_0x2fb304){_0x48c844=0x1f4;logger['error'](_0x2fb304['stack']);if(_0x2fb304[_0x848d('0x24')]){delete _0x2fb304['name'];}_0x2a751b=_0x2fb304;})[_0x848d('0x5e')](function(){if(_0x2a751b===null){_0x3279a7[_0x848d('0xa')](_0x48c844);}else{if(_0x48c844===0x1f4){_0x3279a7[_0x848d('0xb')](_0x48c844)['send'](_0x2a751b);}else{_0x3279a7['status'](_0x48c844)[_0x848d('0x13')](_0x2a751b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3bd93b4..604487c 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 _0x485f=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x485f,0x1d3));var _0xf485=function(_0x15c713,_0x4b989a){_0x15c713=_0x15c713-0x0;var _0xac54af=_0x485f[_0x15c713];return _0xac54af;};'use strict';var EventEmitter=require(_0xf485('0x0'));var VoiceExtension=require(_0xf485('0x1'))['db'][_0xf485('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf485('0x3')](0x0);var events={'afterCreate':_0xf485('0x4'),'afterUpdate':_0xf485('0x5'),'afterDestroy':_0xf485('0x6')};function emitEvent(_0x445416){return function(_0x24655a,_0x36115f,_0x19b033){VoiceExtensionEvents[_0xf485('0x7')](_0x445416+':'+_0x24655a['id'],_0x24655a);VoiceExtensionEvents[_0xf485('0x7')](_0x445416,_0x24655a);_0x19b033(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xf485('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x689a=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit'];(function(_0x31d938,_0x22e507){var _0x508176=function(_0x2b83cb){while(--_0x2b83cb){_0x31d938['push'](_0x31d938['shift']());}};_0x508176(++_0x22e507);}(_0x689a,0x17f));var _0xa689=function(_0x3da282,_0x4b26e6){_0x3da282=_0x3da282-0x0;var _0x4e82a4=_0x689a[_0x3da282];return _0x4e82a4;};'use strict';var EventEmitter=require(_0xa689('0x0'));var VoiceExtension=require(_0xa689('0x1'))['db'][_0xa689('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa689('0x3')](0x0);var events={'afterCreate':_0xa689('0x4'),'afterUpdate':_0xa689('0x5'),'afterDestroy':'remove'};function emitEvent(_0x23bd05){return function(_0x59bcba,_0x5c694b,_0x3655b8){VoiceExtensionEvents[_0xa689('0x6')](_0x23bd05+':'+_0x59bcba['id'],_0x59bcba);VoiceExtensionEvents[_0xa689('0x6')](_0x23bd05,_0x59bcba);_0x3655b8(null);};}for(var e in events){if(events[_0xa689('0x7')](e)){var event=events[e];VoiceExtension[_0xa689('0x8')](e,emitEvent(event));}}module[_0xa689('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 1cb125a..aa1e924 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 _0x1147=['concat','catch','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','length','phone','split','prefix','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','then','*,*,*,*','intervals','IntervalId','toLowerCase','tag','CDR(tag)=','ExecIf','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','app','appType','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','last','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1147,0x12a));var _0x7114=function(_0x23c117,_0x190d4c){_0x23c117=_0x23c117-0x0;var _0x47b9cd=_0x1147[_0x23c117];return _0x47b9cd;};'use strict';var _=require('lodash');var attributes=require(_0x7114('0x0'));module[_0x7114('0x1')]=function(_0x2c3ed9){var _0x1747b4=_0x2c3ed9[_0x7114('0x2')];function _0x3737dc(_0x14e8a6){var _0x5d6f73=0x2;var _0x884b4e=[{'type':_0x14e8a6[_0x7114('0x3')],'app':_0x7114('0x4'),'appdata':_0x7114('0x5')+_0x14e8a6[_0x7114('0x3')],'context':_0x14e8a6[_0x7114('0x6')],'exten':_0x14e8a6[_0x7114('0x7')],'priority':_0x5d6f73++,'VoiceExtensionId':_0x14e8a6['id']}];if(_0x14e8a6[_0x7114('0x3')]==='inbound'){_0x884b4e[_0x7114('0x8')]({'type':_0x7114('0x9'),'app':_0x7114('0x4'),'appdata':_0x7114('0xa')+_0x14e8a6['id'],'context':_0x14e8a6['context'],'exten':_0x14e8a6[_0x7114('0x7')],'priority':_0x5d6f73++,'VoiceExtensionId':_0x14e8a6['id']});}_0x884b4e[_0x7114('0x8')]({'type':_0x14e8a6[_0x7114('0x3')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x14e8a6[_0x7114('0x6')],'exten':_0x14e8a6['exten'],'priority':_0x5d6f73++,'VoiceExtensionId':_0x14e8a6['id']},{'type':_0x14e8a6['type'],'app':'Set','appdata':_0x7114('0xb'),'context':_0x14e8a6['context'],'exten':_0x14e8a6[_0x7114('0x7')],'priority':_0x5d6f73++,'VoiceExtensionId':_0x14e8a6['id']},{'type':_0x14e8a6[_0x7114('0x3')],'app':_0x7114('0x4'),'appdata':_0x7114('0xc'),'context':_0x14e8a6[_0x7114('0x6')],'exten':_0x14e8a6[_0x7114('0x7')],'priority':_0x5d6f73++,'VoiceExtensionId':_0x14e8a6['id']});return _0x884b4e;}function _0x27f22b(_0x1fe25c){var _0x4d88fd=0x2;var _0x55150a=[{'type':'outbound','app':_0x7114('0x4'),'appdata':_0x7114('0xd'),'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':_0x7114('0xf')+(_0x1fe25c['cutdigits']?_0x7114('0x10')+_0x1fe25c[_0x7114('0x11')]+'}':_0x7114('0x12')),'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':_0x7114('0xa')+_0x1fe25c['id'],'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4d88fd+0x2)+_0x7114('0x13')+(_0x4d88fd+0x1)+')','context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':'outbound','app':_0x7114('0x4'),'appdata':_0x1fe25c[_0x7114('0x11')]?_0x7114('0x14')+_0x1fe25c[_0x7114('0x11')]+'}':_0x7114('0x15'),'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c['exten'],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':_0x7114('0x16'),'context':_0x1fe25c['context'],'exten':_0x1fe25c['exten'],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':_0x7114('0xb'),'context':_0x1fe25c['context'],'exten':_0x1fe25c['exten'],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':_0x7114('0xc'),'context':_0x1fe25c['context'],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':'outboundrouteid='+_0x1fe25c['id'],'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']}];if(_0x1fe25c[_0x7114('0x17')](_0x7114('0x18'))&&_0x1fe25c[_0x7114('0x18')]!==_0x7114('0x19')){_0x55150a[_0x7114('0x8')]({'type':'outbound','app':_0x7114('0x4'),'appdata':_0x7114('0x1a'),'context':_0x1fe25c[_0x7114('0x6')],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']},{'type':_0x7114('0xe'),'app':_0x7114('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1fe25c[_0x7114('0x18')]||'wav','context':_0x1fe25c['context'],'exten':_0x1fe25c[_0x7114('0x7')],'priority':_0x4d88fd++,'VoiceExtensionId':_0x1fe25c['id']});}return _0x55150a;}function _0x4e9404(_0x3e5527,_0x5d0e3d){var _0x19616b=[{'name':_0x7114('0x1b'),'param':0x0},{'name':_0x7114('0x1c'),'param':0x1},{'name':_0x7114('0x1d'),'param':0x2},{'name':_0x7114('0x1e'),'param':0x3}];var _0x4a16ce={};var _0x1a5940=_0x5d0e3d['split'](',');var _0x164d28=[];for(var _0x28f680=0x0;_0x28f680<_0x19616b[_0x7114('0x1f')];_0x28f680++){switch(_0x19616b[_0x28f680]['name']){case _0x7114('0x1b'):_0x4a16ce['trunk']=_0x1a5940[_0x19616b[_0x28f680]['param']]['split']('/')[0x1];_0x4a16ce[_0x7114('0x20')]=_0x1a5940[_0x19616b[_0x28f680]['param']][_0x7114('0x21')]('/')[0x2];_0x4a16ce[_0x7114('0x22')]=_0x4a16ce[_0x7114('0x20')]?_0x4a16ce[_0x7114('0x20')][_0x7114('0x21')]('$')[0x0]:undefined;_0x4a16ce[_0x7114('0x20')]=_0x3e5527[_0x7114('0x11')]?(_0x4a16ce[_0x7114('0x22')]||'')+_0x7114('0x10')+_0x3e5527[_0x7114('0x11')]+'}':(_0x4a16ce[_0x7114('0x22')]||'')+_0x7114('0x12');_0x164d28[_0x19616b[_0x28f680][_0x7114('0x23')]]=[_0x7114('0x24'),_0x4a16ce[_0x7114('0x1b')],_0x4a16ce[_0x7114('0x20')]][_0x7114('0x25')]('/');break;case'options':_0x4a16ce[_0x7114('0x1d')]=_0x1a5940[_0x19616b[_0x28f680][_0x7114('0x23')]];if(_0x3e5527['recordingFormat']!==_0x7114('0x19')){if(_0x4a16ce[_0x7114('0x1d')][_0x7114('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x4a16ce[_0x7114('0x1d')]+=_0x7114('0x27');}}else{_0x4a16ce['options']=_0x4a16ce[_0x7114('0x1d')]['replace']('U(xcally-mixmonitor-context)','');}_0x164d28[_0x19616b[_0x28f680]['param']]=_0x4a16ce[_0x7114('0x1d')];break;default:_0x164d28[_0x19616b[_0x28f680]['param']]=_0x1a5940[_0x19616b[_0x28f680][_0x7114('0x23')]];}}return _0x164d28['join'](',');}function _0x5e608c(_0x4e5cb8,_0x5b4d3b,_0x2682e4){return new Promise(function(_0x26d3cd,_0x602c94){var _0x2063b2=[];if(_[_0x7114('0x28')](_0x5b4d3b))return _0x26d3cd(_0x2063b2);_0x1747b4['Interval'][_0x7114('0x29')]({'attributes':['id',_0x7114('0x2a'),'IntervalId'],'raw':!![]})[_0x7114('0x2b')](function(_0x9cad14){for(var _0x4142b0=0x0,_0x107aac=0x0;_0x4142b0<_0x5b4d3b[_0x7114('0x1f')];_0x4142b0++,_0x107aac=0x0){var _0x3a9798=_0x5b4d3b[_0x4142b0];var _0x302f9e=[];var _0x15fe42=[];delete _0x3a9798['id'];if(_0x3a9798[_0x7114('0x2a')]!==_0x7114('0x2c')){_0x3a9798[_0x7114('0x2d')]=[_0x3a9798[_0x7114('0x2a')]];}else{_0x3a9798[_0x7114('0x2d')]=_0x3a9798[_0x7114('0x2e')]?_['map'](_['filter'](_0x9cad14,{'IntervalId':_0x3a9798[_0x7114('0x2e')]}),'interval'):[];}_0x3a9798[_0x7114('0x6')]=_0x4e5cb8[_0x7114('0x6')];_0x3a9798[_0x7114('0x7')]=_0x4e5cb8['exten'];if(_0x3a9798[_0x7114('0x3')])_0x3a9798['type']=_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')]();if(_0x4e5cb8[_0x7114('0x3')]===_0x7114('0xe')){if(_0x3a9798[_0x7114('0x17')](_0x7114('0x30'))&&_0x3a9798[_0x7114('0x30')]&&_0x3a9798[_0x7114('0x30')]!=='--'){_0x302f9e[_0x7114('0x8')]({'type':_0x3a9798['type']['toLowerCase'](),'app':_0x7114('0x4'),'appdata':_0x7114('0x31')+_0x3a9798[_0x7114('0x30')],'context':_0x4e5cb8['context'],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798['intervals'][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});}_0x302f9e['push']({'type':_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')](),'app':_0x7114('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3a9798['callerID']?_0x7114('0x33')+_0x3a9798[_0x7114('0x34')]+')':_0x7114('0x35')),'context':_0x4e5cb8['context'],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});}else{if(_0x3a9798[_0x7114('0x17')]('answer')){if(['queue',_0x7114('0x36')]['includes'](_0x3a9798[_0x7114('0x37')][_0x7114('0x2f')]())&&_0x3a9798[_0x7114('0x38')]!=='custom'){if(_0x3a9798[_0x7114('0x39')]){_0x302f9e['push']({'type':_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')](),'app':_0x7114('0x32'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4e5cb8[_0x7114('0x6')],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});_0x302f9e[_0x7114('0x8')]({'type':_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')](),'app':_0x7114('0x4'),'appdata':_0x7114('0x3a'),'context':_0x4e5cb8['context'],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798['intervals'][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});}else{_0x302f9e['push']({'type':_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')](),'app':_0x7114('0x32'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4e5cb8[_0x7114('0x6')],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});_0x302f9e[_0x7114('0x8')]({'type':_0x3a9798['type']['toLowerCase'](),'app':_0x7114('0x4'),'appdata':_0x7114('0x3b'),'context':_0x4e5cb8[_0x7114('0x6')],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});}}}}for(var _0x5ab9f4=0x0;_0x5ab9f4<_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')];_0x5ab9f4++){var _0xf14b40=_0x2682e4+_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')];var _0x35e8ab=_0x5ab9f4===_0x3a9798[_0x7114('0x2d')]['length']-0x1?_0x2682e4+_0x302f9e[_0x7114('0x1f')]+_0x15fe42[_0x7114('0x1f')]+0x2:_0x2682e4+_0x5ab9f4+0x1;_0x302f9e[_0x7114('0x3c')](_0x5ab9f4,0x0,{'type':_0x4e5cb8[_0x7114('0x3')],'app':'GotoIfTime','appdata':_0x3a9798[_0x7114('0x2d')][_0x5ab9f4]+'?'+_0x4e5cb8[_0x7114('0x6')]+_0x7114('0x3d')+_0xf14b40+':'+_0x4e5cb8['context']+',${EXTEN},'+_0x35e8ab,'exten':_0x4e5cb8[_0x7114('0x7')],'context':_0x4e5cb8[_0x7114('0x6')],'priority':_0x2682e4+_0x5ab9f4,'VoiceExtensionId':_0x4e5cb8['id']});}if(_0x3a9798[_0x7114('0x38')]===_0x7114('0x3e')){_0x3a9798['appdata']=_0x4e9404(_0x4e5cb8,_0x3a9798[_0x7114('0x3f')]);}if(_0x3a9798[_0x7114('0x38')]===_0x7114('0x40')){_0x302f9e['push']({'type':_0x3a9798[_0x7114('0x3')][_0x7114('0x2f')](),'app':_0x7114('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x4e5cb8['context'],'exten':_0x4e5cb8[_0x7114('0x7')],'priority':_0x3a9798[_0x7114('0x2d')][_0x7114('0x1f')]+_0x2682e4+_0x107aac++,'VoiceExtensionId':_0x4e5cb8['id']});}_0x3a9798['priority']=_0x302f9e['length']?_[_0x7114('0x41')](_0x302f9e)[_0x7114('0x42')]+0x1:_0x2682e4;_0x2063b2=_[_0x7114('0x43')](_0x2063b2,_0x302f9e,[_0x3a9798],_0x15fe42);_0x2682e4=_[_0x7114('0x41')](_0x2063b2)[_0x7114('0x42')]+0x1;}return _0x26d3cd(_0x2063b2);})[_0x7114('0x44')](function(_0x1111c4){_0x602c94(_0x1111c4);});});}return _0x2c3ed9['define'](_0x7114('0x45'),attributes,{'tableName':_0x7114('0x46'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3334de){var _0x1c1062=this[_0x7114('0x47')]({'plain':!![]});var _0x310d71=_0x1c1062[_0x7114('0x3')]===_0x7114('0xe')?_0x27f22b(_0x1c1062):_0x3737dc(_0x1c1062);return _0x5e608c(_0x1c1062,_0x3334de,_[_0x7114('0x41')](_0x310d71)['priority']+0x1)[_0x7114('0x2b')](function(_0x4ee5df){var _0x5ca200=_[_0x7114('0x43')](_0x310d71,_0x4ee5df);_0x5ca200['push']({'type':_0x1c1062[_0x7114('0x3')],'app':_0x7114('0x48'),'exten':_0x1c1062[_0x7114('0x7')],'context':_0x1c1062[_0x7114('0x6')],'priority':_[_0x7114('0x41')](_0x5ca200)[_0x7114('0x42')]+0x1,'VoiceExtensionId':_0x1c1062['id']});return _0x5ca200;});}}});}; \ No newline at end of file +var _0x4dfd=['intervals','map','filter','toLowerCase','hasOwnProperty','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','models','CDR(type)=','type','inbound','push','Set','CDR(routeid)=','context','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','join','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then'];(function(_0x50a79e,_0x1297a0){var _0x1db114=function(_0x2b58b7){while(--_0x2b58b7){_0x50a79e['push'](_0x50a79e['shift']());}};_0x1db114(++_0x1297a0);}(_0x4dfd,0x161));var _0xd4df=function(_0xcf91b0,_0x203cc3){_0xcf91b0=_0xcf91b0-0x0;var _0x129f8a=_0x4dfd[_0xcf91b0];return _0x129f8a;};'use strict';var _=require(_0xd4df('0x0'));var attributes=require(_0xd4df('0x1'));module['exports']=function(_0x3b8f64){var _0x5cb2ba=_0x3b8f64[_0xd4df('0x2')];function _0x20ca99(_0x2917c8){var _0x3f6bdc=0x2;var _0xfa9534=[{'type':_0x2917c8['type'],'app':'Set','appdata':_0xd4df('0x3')+_0x2917c8[_0xd4df('0x4')],'context':_0x2917c8['context'],'exten':_0x2917c8['exten'],'priority':_0x3f6bdc++,'VoiceExtensionId':_0x2917c8['id']}];if(_0x2917c8[_0xd4df('0x4')]===_0xd4df('0x5')){_0xfa9534[_0xd4df('0x6')]({'type':_0xd4df('0x5'),'app':_0xd4df('0x7'),'appdata':_0xd4df('0x8')+_0x2917c8['id'],'context':_0x2917c8[_0xd4df('0x9')],'exten':_0x2917c8[_0xd4df('0xa')],'priority':_0x3f6bdc++,'VoiceExtensionId':_0x2917c8['id']});}_0xfa9534['push']({'type':_0x2917c8[_0xd4df('0x4')],'app':_0xd4df('0x7'),'appdata':_0xd4df('0xb'),'context':_0x2917c8[_0xd4df('0x9')],'exten':_0x2917c8[_0xd4df('0xa')],'priority':_0x3f6bdc++,'VoiceExtensionId':_0x2917c8['id']},{'type':_0x2917c8['type'],'app':_0xd4df('0x7'),'appdata':_0xd4df('0xc'),'context':_0x2917c8[_0xd4df('0x9')],'exten':_0x2917c8[_0xd4df('0xa')],'priority':_0x3f6bdc++,'VoiceExtensionId':_0x2917c8['id']},{'type':_0x2917c8[_0xd4df('0x4')],'app':_0xd4df('0x7'),'appdata':_0xd4df('0xd'),'context':_0x2917c8[_0xd4df('0x9')],'exten':_0x2917c8['exten'],'priority':_0x3f6bdc++,'VoiceExtensionId':_0x2917c8['id']});return _0xfa9534;}function _0x12df27(_0xbff5be){var _0x415a7a=0x2;var _0x59f897=[{'type':_0xd4df('0xe'),'app':_0xd4df('0x7'),'appdata':_0xd4df('0xf'),'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':'Set','appdata':_0xd4df('0x10')+(_0xbff5be[_0xd4df('0x11')]?_0xd4df('0x12')+_0xbff5be[_0xd4df('0x11')]+'}':_0xd4df('0x13')),'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be['exten'],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':'outbound','app':_0xd4df('0x7'),'appdata':_0xd4df('0x8')+_0xbff5be['id'],'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':'ExecIf','appdata':_0xd4df('0x14')+(_0x415a7a+0x2)+_0xd4df('0x15')+(_0x415a7a+0x1)+')','context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':_0xd4df('0x7'),'appdata':_0xbff5be['cutdigits']?_0xd4df('0x16')+_0xbff5be[_0xd4df('0x11')]+'}':'CDR(prefix)=noprefix','context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be['exten'],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':_0xd4df('0x7'),'appdata':_0xd4df('0xb'),'context':_0xbff5be['context'],'exten':_0xbff5be['exten'],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':_0xd4df('0x7'),'appdata':_0xd4df('0xd'),'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be['exten'],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':'outbound','app':_0xd4df('0x7'),'appdata':_0xd4df('0x17')+_0xbff5be['id'],'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']}];if(_0xbff5be['hasOwnProperty'](_0xd4df('0x18'))&&_0xbff5be[_0xd4df('0x18')]!==_0xd4df('0x19')){_0x59f897[_0xd4df('0x6')]({'type':'outbound','app':_0xd4df('0x7'),'appdata':_0xd4df('0x1a'),'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']},{'type':_0xd4df('0xe'),'app':_0xd4df('0x7'),'appdata':_0xd4df('0x1b')+_0xbff5be[_0xd4df('0x18')]||_0xd4df('0x1c'),'context':_0xbff5be[_0xd4df('0x9')],'exten':_0xbff5be[_0xd4df('0xa')],'priority':_0x415a7a++,'VoiceExtensionId':_0xbff5be['id']});}return _0x59f897;}function _0xed64e2(_0x319283,_0x5ea39c){var _0x5ee5f0=[{'name':_0xd4df('0x1d'),'param':0x0},{'name':_0xd4df('0x1e'),'param':0x1},{'name':_0xd4df('0x1f'),'param':0x2},{'name':'url','param':0x3}];var _0x259973={};var _0xafa9ff=_0x5ea39c[_0xd4df('0x20')](',');var _0x4179b2=[];for(var _0x2a8d8a=0x0;_0x2a8d8a<_0x5ee5f0[_0xd4df('0x21')];_0x2a8d8a++){switch(_0x5ee5f0[_0x2a8d8a][_0xd4df('0x22')]){case _0xd4df('0x1d'):_0x259973[_0xd4df('0x1d')]=_0xafa9ff[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]][_0xd4df('0x20')]('/')[0x1];_0x259973[_0xd4df('0x24')]=_0xafa9ff[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]][_0xd4df('0x20')]('/')[0x2];_0x259973[_0xd4df('0x25')]=_0x259973[_0xd4df('0x24')]?_0x259973[_0xd4df('0x24')]['split']('$')[0x0]:undefined;_0x259973[_0xd4df('0x24')]=_0x319283['cutdigits']?(_0x259973[_0xd4df('0x25')]||'')+_0xd4df('0x12')+_0x319283['cutdigits']+'}':(_0x259973[_0xd4df('0x25')]||'')+_0xd4df('0x13');_0x4179b2[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]]=['SIP',_0x259973['trunk'],_0x259973['phone']][_0xd4df('0x26')]('/');break;case _0xd4df('0x1f'):_0x259973[_0xd4df('0x1f')]=_0xafa9ff[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]];if(_0x319283[_0xd4df('0x18')]!=='none'){if(_0x259973['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x259973[_0xd4df('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x259973[_0xd4df('0x1f')]=_0x259973[_0xd4df('0x1f')][_0xd4df('0x27')](_0xd4df('0x28'),'');}_0x4179b2[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]]=_0x259973[_0xd4df('0x1f')];break;default:_0x4179b2[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]]=_0xafa9ff[_0x5ee5f0[_0x2a8d8a][_0xd4df('0x23')]];}}return _0x4179b2['join'](',');}function _0x1d2fd6(_0x300f4d,_0x3351c0,_0x89c74){return new Promise(function(_0x55d850,_0x40170e){var _0x125d05=[];if(_[_0xd4df('0x29')](_0x3351c0))return _0x55d850(_0x125d05);_0x5cb2ba[_0xd4df('0x2a')][_0xd4df('0x2b')]({'attributes':['id',_0xd4df('0x2c'),_0xd4df('0x2d')],'raw':!![]})[_0xd4df('0x2e')](function(_0x4137bb){for(var _0x475309=0x0,_0x32fab5=0x0;_0x475309<_0x3351c0['length'];_0x475309++,_0x32fab5=0x0){var _0x93dab4=_0x3351c0[_0x475309];var _0x5792a7=[];var _0x4e8e0d=[];delete _0x93dab4['id'];if(_0x93dab4['interval']!=='*,*,*,*'){_0x93dab4[_0xd4df('0x2f')]=[_0x93dab4[_0xd4df('0x2c')]];}else{_0x93dab4['intervals']=_0x93dab4[_0xd4df('0x2d')]?_[_0xd4df('0x30')](_[_0xd4df('0x31')](_0x4137bb,{'IntervalId':_0x93dab4[_0xd4df('0x2d')]}),_0xd4df('0x2c')):[];}_0x93dab4['context']=_0x300f4d[_0xd4df('0x9')];_0x93dab4[_0xd4df('0xa')]=_0x300f4d[_0xd4df('0xa')];if(_0x93dab4[_0xd4df('0x4')])_0x93dab4[_0xd4df('0x4')]=_0x93dab4[_0xd4df('0x4')][_0xd4df('0x32')]();if(_0x300f4d[_0xd4df('0x4')]==='outbound'){if(_0x93dab4[_0xd4df('0x33')]('tag')&&_0x93dab4[_0xd4df('0x34')]&&_0x93dab4['tag']!=='--'){_0x5792a7['push']({'type':_0x93dab4[_0xd4df('0x4')][_0xd4df('0x32')](),'app':_0xd4df('0x7'),'appdata':'CDR(tag)='+_0x93dab4[_0xd4df('0x34')],'context':_0x300f4d['context'],'exten':_0x300f4d['exten'],'priority':_0x93dab4[_0xd4df('0x2f')]['length']+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});}_0x5792a7[_0xd4df('0x6')]({'type':_0x93dab4[_0xd4df('0x4')]['toLowerCase'](),'app':_0xd4df('0x35'),'appdata':_0xd4df('0x36')+(_0x93dab4['callerID']?_0xd4df('0x37')+_0x93dab4['callerID']+')':_0xd4df('0x38')),'context':_0x300f4d[_0xd4df('0x9')],'exten':_0x300f4d[_0xd4df('0xa')],'priority':_0x93dab4['intervals'][_0xd4df('0x21')]+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});}else{if(_0x93dab4[_0xd4df('0x33')]('answer')){if([_0xd4df('0x39'),_0xd4df('0x3a')][_0xd4df('0x3b')](_0x93dab4[_0xd4df('0x3c')][_0xd4df('0x32')]())&&_0x93dab4[_0xd4df('0x3d')]!==_0xd4df('0x3e')){if(_0x93dab4['answer']){_0x5792a7[_0xd4df('0x6')]({'type':_0x93dab4[_0xd4df('0x4')][_0xd4df('0x32')](),'app':_0xd4df('0x35'),'appdata':_0xd4df('0x3f'),'context':_0x300f4d[_0xd4df('0x9')],'exten':_0x300f4d[_0xd4df('0xa')],'priority':_0x93dab4['intervals'][_0xd4df('0x21')]+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});_0x5792a7[_0xd4df('0x6')]({'type':_0x93dab4[_0xd4df('0x4')]['toLowerCase'](),'app':_0xd4df('0x7'),'appdata':_0xd4df('0x40'),'context':_0x300f4d[_0xd4df('0x9')],'exten':_0x300f4d[_0xd4df('0xa')],'priority':_0x93dab4[_0xd4df('0x2f')]['length']+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});}else{_0x5792a7['push']({'type':_0x93dab4[_0xd4df('0x4')][_0xd4df('0x32')](),'app':'ExecIf','appdata':_0xd4df('0x41'),'context':_0x300f4d[_0xd4df('0x9')],'exten':_0x300f4d[_0xd4df('0xa')],'priority':_0x93dab4[_0xd4df('0x2f')][_0xd4df('0x21')]+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});_0x5792a7['push']({'type':_0x93dab4[_0xd4df('0x4')][_0xd4df('0x32')](),'app':_0xd4df('0x7'),'appdata':_0xd4df('0x42'),'context':_0x300f4d[_0xd4df('0x9')],'exten':_0x300f4d['exten'],'priority':_0x93dab4[_0xd4df('0x2f')][_0xd4df('0x21')]+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});}}}}for(var _0x192676=0x0;_0x192676<_0x93dab4[_0xd4df('0x2f')][_0xd4df('0x21')];_0x192676++){var _0x5debca=_0x89c74+_0x93dab4[_0xd4df('0x2f')][_0xd4df('0x21')];var _0x44ae4c=_0x192676===_0x93dab4[_0xd4df('0x2f')][_0xd4df('0x21')]-0x1?_0x89c74+_0x5792a7['length']+_0x4e8e0d[_0xd4df('0x21')]+0x2:_0x89c74+_0x192676+0x1;_0x5792a7[_0xd4df('0x43')](_0x192676,0x0,{'type':_0x300f4d[_0xd4df('0x4')],'app':_0xd4df('0x44'),'appdata':_0x93dab4[_0xd4df('0x2f')][_0x192676]+'?'+_0x300f4d[_0xd4df('0x9')]+_0xd4df('0x45')+_0x5debca+':'+_0x300f4d[_0xd4df('0x9')]+_0xd4df('0x45')+_0x44ae4c,'exten':_0x300f4d[_0xd4df('0xa')],'context':_0x300f4d[_0xd4df('0x9')],'priority':_0x89c74+_0x192676,'VoiceExtensionId':_0x300f4d['id']});}if(_0x93dab4[_0xd4df('0x3d')]==='outboundDial'){_0x93dab4[_0xd4df('0x46')]=_0xed64e2(_0x300f4d,_0x93dab4[_0xd4df('0x46')]);}if(_0x93dab4['appType']===_0xd4df('0x47')){_0x5792a7['push']({'type':_0x93dab4['type'][_0xd4df('0x32')](),'app':_0xd4df('0x7'),'appdata':_0xd4df('0x48'),'context':_0x300f4d['context'],'exten':_0x300f4d[_0xd4df('0xa')],'priority':_0x93dab4[_0xd4df('0x2f')]['length']+_0x89c74+_0x32fab5++,'VoiceExtensionId':_0x300f4d['id']});}_0x93dab4['priority']=_0x5792a7[_0xd4df('0x21')]?_[_0xd4df('0x49')](_0x5792a7)[_0xd4df('0x4a')]+0x1:_0x89c74;_0x125d05=_[_0xd4df('0x4b')](_0x125d05,_0x5792a7,[_0x93dab4],_0x4e8e0d);_0x89c74=_['last'](_0x125d05)[_0xd4df('0x4a')]+0x1;}return _0x55d850(_0x125d05);})['catch'](function(_0x17cda9){_0x40170e(_0x17cda9);});});}return _0x3b8f64[_0xd4df('0x4c')](_0xd4df('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41ca2e){var _0x355f4a=this[_0xd4df('0x4e')]({'plain':!![]});var _0x648be3=_0x355f4a[_0xd4df('0x4')]===_0xd4df('0xe')?_0x12df27(_0x355f4a):_0x20ca99(_0x355f4a);return _0x1d2fd6(_0x355f4a,_0x41ca2e,_[_0xd4df('0x49')](_0x648be3)[_0xd4df('0x4a')]+0x1)['then'](function(_0x5ae01e){var _0x285d81=_[_0xd4df('0x4b')](_0x648be3,_0x5ae01e);_0x285d81['push']({'type':_0x355f4a[_0xd4df('0x4')],'app':_0xd4df('0x4f'),'exten':_0x355f4a['exten'],'context':_0x355f4a[_0xd4df('0x9')],'priority':_[_0xd4df('0x49')](_0x285d81)[_0xd4df('0x4a')]+0x1,'VoiceExtensionId':_0x355f4a['id']});return _0x285d81;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2f85c55..0abba98 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 _0xecb2=['request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0xe9e1a,_0x3b0917){var _0x1f2005=function(_0x2281f8){while(--_0x2281f8){_0xe9e1a['push'](_0xe9e1a['shift']());}};_0x1f2005(++_0x3b0917);}(_0xecb2,0xf6));var _0x2ecb=function(_0x1b31c4,_0x2bd358){_0x1b31c4=_0x1b31c4-0x0;var _0x53c8a5=_0xecb2[_0x1b31c4];return _0x53c8a5;};'use strict';var _=require(_0x2ecb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ecb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ecb('0x2'))['db'];var utils=require(_0x2ecb('0x3'));var logger=require(_0x2ecb('0x4'))(_0x2ecb('0x5'));var config=require(_0x2ecb('0x6'));var jayson=require(_0x2ecb('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2ecb('0x8')](config[_0x2ecb('0x9')],{'host':_0x2ecb('0xa'),'port':0x18eb});var socket=require(_0x2ecb('0xb'))(new Redis(config[_0x2ecb('0x9')]));require('./voiceExtension.socket')[_0x2ecb('0xc')](socket);function respondWithRpcPromise(_0x46d2c7,_0x35755,_0x500735){return new BPromise(function(_0x1e213c,_0x442482){return client[_0x2ecb('0xd')](_0x46d2c7,_0x500735)[_0x2ecb('0xe')](function(_0x9f045a){logger['info'](_0x2ecb('0xf'),_0x35755,_0x2ecb('0x10'));logger[_0x2ecb('0x11')](_0x2ecb('0x12'),_0x35755,_0x2ecb('0x10'),JSON[_0x2ecb('0x13')](_0x9f045a));if(_0x9f045a[_0x2ecb('0x14')]){if(_0x9f045a['error'][_0x2ecb('0x15')]===0x1f4){logger[_0x2ecb('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x35755,_0x9f045a[_0x2ecb('0x14')][_0x2ecb('0x16')]);return _0x442482(_0x9f045a[_0x2ecb('0x14')][_0x2ecb('0x16')]);}logger[_0x2ecb('0x14')](_0x2ecb('0xf'),_0x35755,_0x9f045a[_0x2ecb('0x14')][_0x2ecb('0x16')]);return _0x1e213c(_0x9f045a[_0x2ecb('0x14')]['message']);}else{logger[_0x2ecb('0x17')](_0x2ecb('0xf'),_0x35755,'request\x20sent');_0x1e213c(_0x9f045a[_0x2ecb('0x18')]['message']);}})[_0x2ecb('0x19')](function(_0x3319ec){logger[_0x2ecb('0x14')](_0x2ecb('0xf'),_0x35755,_0x3319ec);_0x442482(_0x3319ec);});});}exports[_0x2ecb('0x1a')]=function(_0x46e471){var _0x15a1cb=this;return new Promise(function(_0x586728,_0x8ff004){return db[_0x2ecb('0x1b')][_0x2ecb('0x1c')]({'raw':_0x46e471['options']?_0x46e471[_0x2ecb('0x1d')][_0x2ecb('0x1e')]===undefined?!![]:![]:!![],'where':_0x46e471['options']?_0x46e471['options'][_0x2ecb('0x1f')]||null:null,'attributes':_0x46e471['options']?_0x46e471[_0x2ecb('0x1d')][_0x2ecb('0x20')]||null:null,'limit':_0x46e471[_0x2ecb('0x1d')]?_0x46e471[_0x2ecb('0x1d')][_0x2ecb('0x21')]||null:null,'include':_0x46e471['options']?_0x46e471['options'][_0x2ecb('0x22')]?_['map'](_0x46e471[_0x2ecb('0x1d')][_0x2ecb('0x22')],function(_0x45249b){return{'model':db[_0x45249b[_0x2ecb('0x23')]],'as':_0x45249b['as'],'attributes':_0x45249b[_0x2ecb('0x20')],'include':_0x45249b[_0x2ecb('0x22')]?_[_0x2ecb('0x24')](_0x45249b[_0x2ecb('0x22')],function(_0x28ee7a){return{'model':db[_0x28ee7a[_0x2ecb('0x23')]],'as':_0x28ee7a['as'],'attributes':_0x28ee7a[_0x2ecb('0x20')],'include':_0x28ee7a[_0x2ecb('0x22')]?_[_0x2ecb('0x24')](_0x28ee7a[_0x2ecb('0x22')],function(_0x75c8cb){return{'model':db[_0x75c8cb[_0x2ecb('0x23')]],'as':_0x75c8cb['as'],'attributes':_0x75c8cb[_0x2ecb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2ecb('0xe')](function(_0x294ff5){logger[_0x2ecb('0x17')](_0x2ecb('0x1a'),_0x46e471);logger[_0x2ecb('0x11')]('GetVoiceExtension',_0x46e471,JSON['stringify'](_0x294ff5));_0x586728(_0x294ff5);})[_0x2ecb('0x19')](function(_0x3c97d1){logger[_0x2ecb('0x14')](_0x2ecb('0x1a'),_0x3c97d1['message'],_0x46e471);_0x8ff004(_0x15a1cb[_0x2ecb('0x14')](0x1f4,_0x3c97d1[_0x2ecb('0x16')]));});});}; \ No newline at end of file +var _0xac4f=['findAll','options','raw','where','include','model','attributes','map','debug','GetVoiceExtension','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension'];(function(_0x8c8b26,_0x28390a){var _0x1ebf8f=function(_0x8420e1){while(--_0x8420e1){_0x8c8b26['push'](_0x8c8b26['shift']());}};_0x1ebf8f(++_0x28390a);}(_0xac4f,0x122));var _0xfac4=function(_0x5f0f2c,_0x9817bf){_0x5f0f2c=_0x5f0f2c-0x0;var _0x104e69=_0xac4f[_0x5f0f2c];return _0x104e69;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var moment=require(_0xfac4('0x1'));var BPromise=require('bluebird');var rs=require(_0xfac4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfac4('0x3'));var logger=require(_0xfac4('0x4'))('rpc');var config=require(_0xfac4('0x5'));var jayson=require(_0xfac4('0x6'));var client=jayson[_0xfac4('0x7')]['http']({'port':0x232a});config[_0xfac4('0x8')]=_[_0xfac4('0x9')](config[_0xfac4('0x8')],{'host':_0xfac4('0xa'),'port':0x18eb});var socket=require(_0xfac4('0xb'))(new Redis(config[_0xfac4('0x8')]));require('./voiceExtension.socket')[_0xfac4('0xc')](socket);function respondWithRpcPromise(_0x2e08f9,_0x25cc99,_0x419ada){return new BPromise(function(_0x599d3c,_0x1cbb48){return client[_0xfac4('0xd')](_0x2e08f9,_0x419ada)[_0xfac4('0xe')](function(_0x22bc66){logger[_0xfac4('0xf')](_0xfac4('0x10'),_0x25cc99,_0xfac4('0x11'));logger['debug'](_0xfac4('0x12'),_0x25cc99,'request\x20sent',JSON[_0xfac4('0x13')](_0x22bc66));if(_0x22bc66[_0xfac4('0x14')]){if(_0x22bc66[_0xfac4('0x14')][_0xfac4('0x15')]===0x1f4){logger[_0xfac4('0x14')](_0xfac4('0x10'),_0x25cc99,_0x22bc66[_0xfac4('0x14')][_0xfac4('0x16')]);return _0x1cbb48(_0x22bc66['error'][_0xfac4('0x16')]);}logger[_0xfac4('0x14')](_0xfac4('0x10'),_0x25cc99,_0x22bc66[_0xfac4('0x14')][_0xfac4('0x16')]);return _0x599d3c(_0x22bc66[_0xfac4('0x14')][_0xfac4('0x16')]);}else{logger[_0xfac4('0xf')](_0xfac4('0x10'),_0x25cc99,'request\x20sent');_0x599d3c(_0x22bc66['result']['message']);}})[_0xfac4('0x17')](function(_0x33e587){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x25cc99,_0x33e587);_0x1cbb48(_0x33e587);});});}exports['GetVoiceExtension']=function(_0x15fcc7){var _0x3ea783=this;return new Promise(function(_0x51da4d,_0x227f7e){return db[_0xfac4('0x18')][_0xfac4('0x19')]({'raw':_0x15fcc7[_0xfac4('0x1a')]?_0x15fcc7[_0xfac4('0x1a')][_0xfac4('0x1b')]===undefined?!![]:![]:!![],'where':_0x15fcc7[_0xfac4('0x1a')]?_0x15fcc7[_0xfac4('0x1a')][_0xfac4('0x1c')]||null:null,'attributes':_0x15fcc7[_0xfac4('0x1a')]?_0x15fcc7[_0xfac4('0x1a')]['attributes']||null:null,'limit':_0x15fcc7[_0xfac4('0x1a')]?_0x15fcc7[_0xfac4('0x1a')]['limit']||null:null,'include':_0x15fcc7[_0xfac4('0x1a')]?_0x15fcc7[_0xfac4('0x1a')][_0xfac4('0x1d')]?_['map'](_0x15fcc7[_0xfac4('0x1a')][_0xfac4('0x1d')],function(_0x58bb4b){return{'model':db[_0x58bb4b[_0xfac4('0x1e')]],'as':_0x58bb4b['as'],'attributes':_0x58bb4b[_0xfac4('0x1f')],'include':_0x58bb4b[_0xfac4('0x1d')]?_[_0xfac4('0x20')](_0x58bb4b[_0xfac4('0x1d')],function(_0x528844){return{'model':db[_0x528844[_0xfac4('0x1e')]],'as':_0x528844['as'],'attributes':_0x528844['attributes'],'include':_0x528844[_0xfac4('0x1d')]?_[_0xfac4('0x20')](_0x528844['include'],function(_0x10eb97){return{'model':db[_0x10eb97['model']],'as':_0x10eb97['as'],'attributes':_0x10eb97[_0xfac4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x598504){logger[_0xfac4('0xf')]('GetVoiceExtension',_0x15fcc7);logger[_0xfac4('0x21')](_0xfac4('0x22'),_0x15fcc7,JSON['stringify'](_0x598504));_0x51da4d(_0x598504);})['catch'](function(_0xec16da){logger['error'](_0xfac4('0x22'),_0xec16da[_0xfac4('0x16')],_0x15fcc7);_0x227f7e(_0x3ea783[_0xfac4('0x14')](0x1f4,_0xec16da[_0xfac4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2a142e0..4a292a7 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(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f36c9,_0x3459eb){_0x4f36c9=_0x4f36c9-0x0;var _0xe80405=_0x1cb9[_0x4f36c9];return _0xe80405;};'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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x2c0b69,_0x24ddac){var _0x191662=function(_0x2fe8cd){while(--_0x2fe8cd){_0x2c0b69['push'](_0x2c0b69['shift']());}};_0x191662(++_0x24ddac);}(_0xabce,0x103));var _0xeabc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xabce[_0x46aff0];return _0x9d78cf;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7b76546..8802289 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 _0x8aad=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','/:id/messages','post','create','put','/:id','update'];(function(_0x2573c8,_0xfe3359){var _0x46b566=function(_0x5156d9){while(--_0x5156d9){_0x2573c8['push'](_0x2573c8['shift']());}};_0x46b566(++_0xfe3359);}(_0x8aad,0x146));var _0xd8aa=function(_0x70d11a,_0x56e257){_0x70d11a=_0x70d11a-0x0;var _0x2a5d24=_0x8aad[_0x70d11a];return _0x2a5d24;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/:id',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0xd8aa('0xb')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0xd')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);module[_0xd8aa('0x12')]=router; \ No newline at end of file +var _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x1a73f7,_0x274c12){var _0x3570fa=function(_0xdb9fc0){while(--_0xdb9fc0){_0x1a73f7['push'](_0x1a73f7['shift']());}};_0x3570fa(++_0x274c12);}(_0x1883,0xab));var _0x3188=function(_0x2eefe8,_0x53901b){_0x2eefe8=_0x2eefe8-0x0;var _0x8eb8d3=_0x1883[_0x2eefe8];return _0x8eb8d3;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index fe3c3f9..3288816 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 _0xc1c6=['setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x397786,_0x20cc3b){var _0x73df93=function(_0x33ead2){while(--_0x33ead2){_0x397786['push'](_0x397786['shift']());}};_0x73df93(++_0x20cc3b);}(_0xc1c6,0x73));var _0x6c1c=function(_0x131afc,_0x2b390a){_0x131afc=_0x131afc-0x0;var _0x978dd7=_0xc1c6[_0x131afc];return _0x978dd7;};'use strict';var Sequelize=require(_0x6c1c('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x6c1c('0x1')]},'context':{'type':Sequelize[_0x6c1c('0x1')],'defaultValue':_0x6c1c('0x2'),'unique':_0x6c1c('0x3')},'mailbox':{'type':Sequelize[_0x6c1c('0x1')],'defaultValue':'','allowNull':![],'unique':_0x6c1c('0x3')},'password':{'type':Sequelize[_0x6c1c('0x1')]},'fullname':{'type':Sequelize[_0x6c1c('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x7ec039){this[_0x6c1c('0x4')]('email',typeof _0x7ec039==='string'&&_0x7ec039['trim']()?_0x7ec039[_0x6c1c('0x5')]():null);}},'pager':{'type':Sequelize[_0x6c1c('0x1')]},'tz':{'type':Sequelize[_0x6c1c('0x1')],'defaultValue':_0x6c1c('0x6')},'attach':{'type':Sequelize[_0x6c1c('0x7')]('yes','no'),'defaultValue':_0x6c1c('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6c1c('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x6c1c('0x1')]},'review':{'type':Sequelize[_0x6c1c('0x7')](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6c1c('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6c1c('0x7')](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6c1c('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6c1c('0x7')](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6c1c('0x7')](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6c1c('0x7')]('yes','no'),'defaultValue':_0x6c1c('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x6c1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x6c1c('0x8'),'allowNull':![]},'stamp':{'type':_0x6c1c('0xa')},'emailsubject':{'type':Sequelize[_0x6c1c('0x1')]},'emailbody':{'type':Sequelize[_0x6c1c('0x1')]},'maxsecs':{'type':Sequelize[_0x6c1c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6c1c('0xc')],'get':function(){return this[_0x6c1c('0xd')](_0x6c1c('0xe'))+_0x6c1c('0xf')+this[_0x6c1c('0xd')](_0x6c1c('0x10'));}}}; \ No newline at end of file +var _0x83f0=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','string','trim','central'];(function(_0x364092,_0x136676){var _0x16b404=function(_0x50226e){while(--_0x50226e){_0x364092['push'](_0x364092['shift']());}};_0x16b404(++_0x136676);}(_0x83f0,0x189));var _0x083f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x83f0[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x083f('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x083f('0x1')],'defaultValue':_0x083f('0x2'),'unique':_0x083f('0x3')},'mailbox':{'type':Sequelize[_0x083f('0x1')],'defaultValue':'','allowNull':![],'unique':_0x083f('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x083f('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3dd336){this['setDataValue']('email',typeof _0x3dd336===_0x083f('0x4')&&_0x3dd336[_0x083f('0x5')]()?_0x3dd336[_0x083f('0x5')]():null);}},'pager':{'type':Sequelize[_0x083f('0x1')]},'tz':{'type':Sequelize[_0x083f('0x1')],'defaultValue':_0x083f('0x6')},'attach':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':_0x083f('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':_0x083f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x083f('0x1')]},'callback':{'type':Sequelize[_0x083f('0x1')]},'review':{'type':Sequelize['ENUM'](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x083f('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x083f('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x083f('0x7')](_0x083f('0x8'),'no'),'defaultValue':_0x083f('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x083f('0x1')]},'maxsecs':{'type':Sequelize[_0x083f('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x083f('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x083f('0xb')],'get':function(){return this[_0x083f('0xc')](_0x083f('0xd'))+_0x083f('0xe')+this[_0x083f('0xc')](_0x083f('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0d10b82..97570fd 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 _0xb7e7=['sort','where','pick','filter','options','show','params','keys','rawAttributes','intersection','includeAll','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','index','VoiceMail','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3e0326,_0x137e73){var _0x12b5ac=function(_0x19aee7){while(--_0x19aee7){_0x3e0326['push'](_0x3e0326['shift']());}};_0x12b5ac(++_0x137e73);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Voicemails';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};var _0x33f9a1=_['map'](db[_0x7b7e('0x2d')]['rawAttributes'],function(_0x23a453){return{'name':_0x23a453[_0x7b7e('0x2e')],'type':_0x23a453[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x33f9a1,_0x7b7e('0x2a'));_0x35602a['query']=_['keys'](_0x5515ca[_0x7b7e('0x33')]);_0x35602a[_0x7b7e('0x34')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],_0x35602a[_0x7b7e('0x33')]);_0xe31336[_0x7b7e('0x35')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0xe31336[_0x7b7e('0x35')]=_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0xe31336[_0x7b7e('0x35')]:_0x35602a[_0x7b7e('0x31')];if(!_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1f')]);_0xe31336['offset']=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3b')]);_0xe31336[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x5515ca['query'],_0x35602a[_0x7b7e('0x34')]),_0x33f9a1);if(_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]){_0xe31336[_0x7b7e('0x3c')]=_['merge'](_0xe31336[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x32')](_0x33f9a1,function(_0x3d5280){if(_0x3d5280['type']!=='VIRTUAL'){var _0x22651e={};_0x22651e[_0x3d5280['name']]={'$like':'%'+_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x22651e;}})});}_0xe31336=_['merge']({},_0xe31336,_0x5515ca[_0x7b7e('0x3f')]);var _0x2074d1={'where':_0xe31336[_0x7b7e('0x3c')]};return db[_0x7b7e('0x2d')][_0x7b7e('0x20')](_0x2074d1)[_0x7b7e('0x26')](function(_0xc888e4){_0x326dd2[_0x7b7e('0x20')]=_0xc888e4;if(_0x5515ca[_0x7b7e('0x33')]['includeAll']){_0xe31336['include']=[{'all':!![]}];}return db[_0x7b7e('0x2d')]['findAll'](_0xe31336);})[_0x7b7e('0x26')](function(_0x5e8b5d){_0x326dd2['rows']=_0x5e8b5d;return _0x326dd2;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));};exports[_0x7b7e('0x40')]=function(_0x52051c,_0xa8521d){var _0x3e58be={'raw':!![],'where':{'id':_0x52051c[_0x7b7e('0x41')]['id']}},_0x7ea84c={};_0x7ea84c['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x2d')][_0x7b7e('0x43')]);_0x7ea84c[_0x7b7e('0x33')]=_[_0x7b7e('0x42')](_0x52051c[_0x7b7e('0x33')]);_0x7ea84c['filters']=_['intersection'](_0x7ea84c['model'],_0x7ea84c[_0x7b7e('0x33')]);_0x3e58be[_0x7b7e('0x35')]=_[_0x7b7e('0x44')](_0x7ea84c[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x52051c[_0x7b7e('0x33')]['fields']));_0x3e58be[_0x7b7e('0x35')]=_0x3e58be[_0x7b7e('0x35')]['length']?_0x3e58be['attributes']:_0x7ea84c[_0x7b7e('0x31')];if(_0x52051c[_0x7b7e('0x33')][_0x7b7e('0x45')]){_0x3e58be[_0x7b7e('0x46')]=[{'all':!![]}];}_0x3e58be=_[_0x7b7e('0x47')]({},_0x3e58be,_0x52051c[_0x7b7e('0x3f')]);return db['VoiceMail'][_0x7b7e('0x48')](_0x3e58be)['then'](handleEntityNotFound(_0xa8521d,null))[_0x7b7e('0x26')](respondWithResult(_0xa8521d,null))[_0x7b7e('0x49')](handleError(_0xa8521d,null));};exports[_0x7b7e('0x4a')]=function(_0x5874e2,_0x58e4e6){return db[_0x7b7e('0x2d')][_0x7b7e('0x4a')](_0x5874e2[_0x7b7e('0x4b')],{})[_0x7b7e('0x26')](function(_0x1f9d0f){var _0x5cce7c=_0x5874e2[_0x7b7e('0x4c')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x5cce7c)throw new Error(_0x7b7e('0x4d'));if(_0x5cce7c[_0x7b7e('0x4e')]===_0x7b7e('0x4c')){var _0x5a9697=_0x1f9d0f[_0x7b7e('0x27')]({'plain':!![]});var _0x29024e=_0x7b7e('0x4f');return db[_0x7b7e('0x50')][_0x7b7e('0x48')]({'where':{'name':_0x29024e,'userProfileId':_0x5cce7c[_0x7b7e('0x51')]},'raw':!![]})[_0x7b7e('0x26')](function(_0x4a7be0){if(_0x4a7be0&&_0x4a7be0[_0x7b7e('0x52')]===0x0){return db['UserProfileResource'][_0x7b7e('0x4a')]({'name':_0x5a9697[_0x7b7e('0x2a')],'resourceId':_0x5a9697['id'],'type':_0x4a7be0['name'],'sectionId':_0x4a7be0['id']},{})[_0x7b7e('0x26')](function(){return _0x1f9d0f;});}else{return _0x1f9d0f;}})[_0x7b7e('0x49')](function(_0x16c81d){logger[_0x7b7e('0x29')](_0x7b7e('0x53'),_0x16c81d);throw _0x16c81d;});}return _0x1f9d0f;})[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,0xc9))[_0x7b7e('0x49')](handleError(_0x58e4e6,null));};exports['update']=function(_0xbf044d,_0x3ff731){if(_0xbf044d[_0x7b7e('0x4b')]['id']){delete _0xbf044d[_0x7b7e('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0xbf044d['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3ff731,null))[_0x7b7e('0x26')](saveUpdates(_0xbf044d[_0x7b7e('0x4b')],null))['then'](respondWithResult(_0x3ff731,null))['catch'](handleError(_0x3ff731,null));};exports[_0x7b7e('0x28')]=function(_0x39efb5,_0x4fecf7){return db[_0x7b7e('0x2d')][_0x7b7e('0x48')]({'where':{'id':_0x39efb5[_0x7b7e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fecf7,null))[_0x7b7e('0x26')](removeEntity(_0x4fecf7,null))[_0x7b7e('0x49')](handleError(_0x4fecf7,null));};exports['getMessages']=function(_0x25c933,_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x2d')][_0x7b7e('0x54')]({'where':{'id':_0x25c933[_0x7b7e('0x41')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x26')](function(_0x45fff9){var _0x5509ad;var _0x29d0af={},_0x20108a={};_0x20108a['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x55')][_0x7b7e('0x43')]);_0x20108a['query']=_[_0x7b7e('0x42')](_0x25c933['query']);_0x20108a[_0x7b7e('0x34')]=_[_0x7b7e('0x44')](_0x20108a['model'],_0x20108a[_0x7b7e('0x33')]);_0x29d0af[_0x7b7e('0x35')]=_['intersection'](_0x20108a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0x29d0af['attributes']=_0x29d0af[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0x29d0af[_0x7b7e('0x35')]:_0x20108a[_0x7b7e('0x31')];if(!_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x29d0af[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x25c933[_0x7b7e('0x33')]['limit']);_0x29d0af[_0x7b7e('0x1d')]=qs['offset'](_0x25c933['query'][_0x7b7e('0x1d')]);}_0x29d0af[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x25c933[_0x7b7e('0x33')]['sort']);_0x29d0af[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x25c933[_0x7b7e('0x33')],_0x20108a[_0x7b7e('0x34')]));if(_0x25c933[_0x7b7e('0x33')]['filter']){_0x29d0af[_0x7b7e('0x3c')]=_['merge'](_0x29d0af['where'],{'$or':_[_0x7b7e('0x32')](_0x29d0af['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x4a2378;})});}_0x29d0af['where']=_[_0x7b7e('0x47')](_0x29d0af[_0x7b7e('0x3c')],{'mailboxuser':_0x45fff9['mailbox']});_0x29d0af=_[_0x7b7e('0x47')]({},_0x29d0af,_0x25c933[_0x7b7e('0x3f')]);return db[_0x7b7e('0x55')][_0x7b7e('0x56')](_0x29d0af)[_0x7b7e('0x26')](respondWithFilteredResult(_0x441c3c,_0x29d0af));})[_0x7b7e('0x49')](handleError(_0x441c3c,null));}; \ No newline at end of file +var _0x0abf=['Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','getMessages','findOne','VoiceMailMessage','hasOwnProperty','order','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','set'];(function(_0xdf9d3f,_0xbb045f){var _0x11ee82=function(_0x4e880c){while(--_0x4e880c){_0xdf9d3f['push'](_0xdf9d3f['shift']());}};_0x11ee82(++_0xbb045f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){var _0x4eee21=_0x43119f[_0xf0ab('0x26')]({'plain':!![]});var _0x4f0caf=_0xf0ab('0x27');return db[_0xf0ab('0x28')]['destroy']({'where':{'type':_0x4f0caf,'resourceId':_0x4eee21['id']}})[_0xf0ab('0x25')](function(){return _0x43119f;});})[_0xf0ab('0x25')](function(){_0x36ad01[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x7d4ff9,_0x502921){return function(_0x2d0da7){if(!_0x2d0da7){_0x7d4ff9['sendStatus'](0x194);}return _0x2d0da7;};}function handleError(_0x55d799,_0x1dcd2e){_0x1dcd2e=_0x1dcd2e||0x1f4;return function(_0x4306c6){logger[_0xf0ab('0x29')](_0x4306c6[_0xf0ab('0x2a')]);if(_0x4306c6[_0xf0ab('0x2b')]){delete _0x4306c6[_0xf0ab('0x2b')];}_0x55d799[_0xf0ab('0x18')](_0x1dcd2e)[_0xf0ab('0x2c')](_0x4306c6);};}exports[_0xf0ab('0x2d')]=function(_0x2f0fcd,_0x21e8ac){var _0x199753={},_0x58cbe1={},_0x1e1ffb={'count':0x0,'rows':[]};var _0x35973a=_['map'](db['VoiceMail'][_0xf0ab('0x2e')],function(_0x1dc84e){return{'name':_0x1dc84e[_0xf0ab('0x2f')],'type':_0x1dc84e['type']['key']};});_0x58cbe1[_0xf0ab('0x30')]=_['map'](_0x35973a,_0xf0ab('0x2b'));_0x58cbe1['query']=_[_0xf0ab('0x31')](_0x2f0fcd[_0xf0ab('0x32')]);_0x58cbe1['filters']=_['intersection'](_0x58cbe1[_0xf0ab('0x30')],_0x58cbe1[_0xf0ab('0x32')]);_0x199753[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x58cbe1[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x199753[_0xf0ab('0x33')]=_0x199753[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x199753[_0xf0ab('0x33')]:_0x58cbe1[_0xf0ab('0x30')];if(!_0x2f0fcd[_0xf0ab('0x32')]['hasOwnProperty'](_0xf0ab('0x37'))){_0x199753[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x2f0fcd['query'][_0xf0ab('0x1d')]);_0x199753[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x2f0fcd['query'][_0xf0ab('0x1b')]);}_0x199753['order']=qs[_0xf0ab('0x38')](_0x2f0fcd['query'][_0xf0ab('0x38')]);_0x199753[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x2f0fcd[_0xf0ab('0x32')],_0x58cbe1[_0xf0ab('0x3a')]),_0x35973a);if(_0x2f0fcd['query'][_0xf0ab('0x3c')]){_0x199753[_0xf0ab('0x39')]=_['merge'](_0x199753[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x35973a,function(_0x1d4eec){if(_0x1d4eec[_0xf0ab('0x3e')]!==_0xf0ab('0x3f')){var _0x11e3b7={};_0x11e3b7[_0x1d4eec[_0xf0ab('0x2b')]]={'$like':'%'+_0x2f0fcd['query'][_0xf0ab('0x3c')]+'%'};return _0x11e3b7;}})});}_0x199753=_[_0xf0ab('0x40')]({},_0x199753,_0x2f0fcd[_0xf0ab('0x41')]);var _0x4bd6d1={'where':_0x199753[_0xf0ab('0x39')]};return db[_0xf0ab('0x42')][_0xf0ab('0x1e')](_0x4bd6d1)[_0xf0ab('0x25')](function(_0x2b7ed5){_0x1e1ffb['count']=_0x2b7ed5;if(_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x43')]){_0x199753[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x42')][_0xf0ab('0x45')](_0x199753);})[_0xf0ab('0x25')](function(_0x45849c){_0x1e1ffb[_0xf0ab('0x46')]=_0x45849c;return _0x1e1ffb;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x21e8ac,_0x199753))[_0xf0ab('0x47')](handleError(_0x21e8ac,null));};exports[_0xf0ab('0x48')]=function(_0x32ec93,_0x22a265){var _0x5e6b6b={'raw':!![],'where':{'id':_0x32ec93[_0xf0ab('0x49')]['id']}},_0x4c4ab9={};_0x4c4ab9['model']=_[_0xf0ab('0x31')](db[_0xf0ab('0x42')]['rawAttributes']);_0x4c4ab9[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x32ec93['query']);_0x4c4ab9[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],_0x4c4ab9[_0xf0ab('0x32')]);_0x5e6b6b[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x32ec93[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x5e6b6b[_0xf0ab('0x33')]=_0x5e6b6b[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x5e6b6b[_0xf0ab('0x33')]:_0x4c4ab9['model'];if(_0x32ec93['query'][_0xf0ab('0x43')]){_0x5e6b6b['include']=[{'all':!![]}];}_0x5e6b6b=_['merge']({},_0x5e6b6b,_0x32ec93['options']);return db[_0xf0ab('0x42')][_0xf0ab('0x4a')](_0x5e6b6b)[_0xf0ab('0x25')](handleEntityNotFound(_0x22a265,null))[_0xf0ab('0x25')](respondWithResult(_0x22a265,null))[_0xf0ab('0x47')](handleError(_0x22a265,null));};exports[_0xf0ab('0x4b')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x42')][_0xf0ab('0x4b')](_0x472c1b[_0xf0ab('0x4c')],{})[_0xf0ab('0x25')](function(_0x4e6c9b){var _0x393c9a=_0x472c1b[_0xf0ab('0x4d')][_0xf0ab('0x26')]({'plain':!![]});if(!_0x393c9a)throw new Error(_0xf0ab('0x4e'));if(_0x393c9a[_0xf0ab('0x4f')]===_0xf0ab('0x4d')){var _0x430921=_0x4e6c9b[_0xf0ab('0x26')]({'plain':!![]});var _0x47f564='Voicemails';return db['UserProfileSection'][_0xf0ab('0x4a')]({'where':{'name':_0x47f564,'userProfileId':_0x393c9a[_0xf0ab('0x50')]},'raw':!![]})['then'](function(_0xa1a416){if(_0xa1a416&&_0xa1a416[_0xf0ab('0x51')]===0x0){return db['UserProfileResource'][_0xf0ab('0x4b')]({'name':_0x430921[_0xf0ab('0x2b')],'resourceId':_0x430921['id'],'type':_0xa1a416[_0xf0ab('0x2b')],'sectionId':_0xa1a416['id']},{})[_0xf0ab('0x25')](function(){return _0x4e6c9b;});}else{return _0x4e6c9b;}})[_0xf0ab('0x47')](function(_0x33112b){logger[_0xf0ab('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33112b);throw _0x33112b;});}return _0x4e6c9b;})[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,0xc9))['catch'](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x24')]=function(_0x4c9d2b,_0x1a402b){if(_0x4c9d2b['body']['id']){delete _0x4c9d2b['body']['id'];}return db[_0xf0ab('0x42')]['find']({'where':{'id':_0x4c9d2b[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a402b,null))[_0xf0ab('0x25')](saveUpdates(_0x4c9d2b['body'],null))[_0xf0ab('0x25')](respondWithResult(_0x1a402b,null))[_0xf0ab('0x47')](handleError(_0x1a402b,null));};exports[_0xf0ab('0x52')]=function(_0x57f9dd,_0x47f270){return db['VoiceMail'][_0xf0ab('0x4a')]({'where':{'id':_0x57f9dd[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f270,null))['then'](removeEntity(_0x47f270,null))[_0xf0ab('0x47')](handleError(_0x47f270,null));};exports[_0xf0ab('0x53')]=function(_0x8df75a,_0x4ead7d,_0x227597){return db[_0xf0ab('0x42')][_0xf0ab('0x54')]({'where':{'id':_0x8df75a[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x4ead7d,null))[_0xf0ab('0x25')](function(_0x1e6a4e){var _0x4d80a6;var _0x41ed17={},_0x5b24e3={};_0x5b24e3[_0xf0ab('0x30')]=_[_0xf0ab('0x31')](db[_0xf0ab('0x55')][_0xf0ab('0x2e')]);_0x5b24e3[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x8df75a[_0xf0ab('0x32')]);_0x5b24e3[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],_0x5b24e3['query']);_0x41ed17[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x41ed17[_0xf0ab('0x33')]=_0x41ed17[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x41ed17['attributes']:_0x5b24e3['model'];if(!_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x56')](_0xf0ab('0x37'))){_0x41ed17['limit']=qs[_0xf0ab('0x1d')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1d')]);_0x41ed17['offset']=qs[_0xf0ab('0x1b')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1b')]);}_0x41ed17[_0xf0ab('0x57')]=qs[_0xf0ab('0x38')](_0x8df75a['query'][_0xf0ab('0x38')]);_0x41ed17[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x8df75a[_0xf0ab('0x32')],_0x5b24e3[_0xf0ab('0x3a')]));if(_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]){_0x41ed17[_0xf0ab('0x39')]=_[_0xf0ab('0x40')](_0x41ed17[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x41ed17[_0xf0ab('0x33')],function(_0x513ed3){var _0x5c9c0e={};_0x5c9c0e[_0x513ed3]={'$like':'%'+_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]+'%'};return _0x5c9c0e;})});}_0x41ed17[_0xf0ab('0x39')]=_['merge'](_0x41ed17[_0xf0ab('0x39')],{'mailboxuser':_0x1e6a4e['mailbox']});_0x41ed17=_[_0xf0ab('0x40')]({},_0x41ed17,_0x8df75a[_0xf0ab('0x41')]);return db[_0xf0ab('0x55')]['findAndCountAll'](_0x41ed17)[_0xf0ab('0x25')](respondWithFilteredResult(_0x4ead7d,_0x41ed17));})['catch'](handleError(_0x4ead7d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index deef736..b82a78c 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 _0xee61=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define'];(function(_0x2ec9a2,_0x3b6362){var _0x12b2d3=function(_0x43af19){while(--_0x43af19){_0x2ec9a2['push'](_0x2ec9a2['shift']());}};_0x12b2d3(++_0x3b6362);}(_0xee61,0x145));var _0x1ee6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee61[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1ee6('0x0'));var util=require(_0x1ee6('0x1'));var logger=require('../../config/logger')(_0x1ee6('0x2'));var moment=require(_0x1ee6('0x3'));var BPromise=require(_0x1ee6('0x4'));var rp=require(_0x1ee6('0x5'));var fs=require('fs');var path=require(_0x1ee6('0x6'));var rimraf=require(_0x1ee6('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ee6('0x8'));module[_0x1ee6('0x9')]=function(_0x209762,_0x486d56){return _0x209762[_0x1ee6('0xa')](_0x1ee6('0xb'),attributes,{'tableName':_0x1ee6('0xc'),'paranoid':![],'indexes':[{'name':_0x1ee6('0xd'),'fields':[_0x1ee6('0xe'),_0x1ee6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8506=['../../config/logger','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x8506,0x191));var _0x6850=function(_0x455901,_0x114179){_0x455901=_0x455901-0x0;var _0x218419=_0x8506[_0x455901];return _0x218419;};'use strict';var _=require(_0x6850('0x0'));var util=require(_0x6850('0x1'));var logger=require(_0x6850('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require(_0x6850('0x6'));module[_0x6850('0x7')]=function(_0x1dec36,_0x44e9ff){return _0x1dec36[_0x6850('0x8')](_0x6850('0x9'),attributes,{'tableName':_0x6850('0xa'),'paranoid':![],'indexes':[{'name':_0x6850('0xb'),'fields':['mailbox',_0x6850('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8aaf56f..57b3521 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 _0x35d8=['error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x349d65,_0x35faf8){var _0xcb1aa7=function(_0x503aac){while(--_0x503aac){_0x349d65['push'](_0x349d65['shift']());}};_0xcb1aa7(++_0x35faf8);}(_0x35d8,0x1bb));var _0x835d=function(_0x230d38,_0x19436a){_0x230d38=_0x230d38-0x0;var _0x42e18=_0x35d8[_0x230d38];return _0x42e18;};'use strict';var _=require('lodash');var util=require(_0x835d('0x0'));var moment=require(_0x835d('0x1'));var BPromise=require(_0x835d('0x2'));var rs=require(_0x835d('0x3'));var fs=require('fs');var Redis=require(_0x835d('0x4'));var db=require(_0x835d('0x5'))['db'];var utils=require(_0x835d('0x6'));var logger=require('../../config/logger')(_0x835d('0x7'));var config=require(_0x835d('0x8'));var jayson=require(_0x835d('0x9'));var client=jayson[_0x835d('0xa')][_0x835d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0706,_0x164378,_0x10b0ff){return new BPromise(function(_0x1600bc,_0x312541){return client['request'](_0x1f0706,_0x10b0ff)[_0x835d('0xc')](function(_0x102e8d){logger[_0x835d('0xd')](_0x835d('0xe'),_0x164378,_0x835d('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x164378,_0x835d('0xf'),JSON[_0x835d('0x10')](_0x102e8d));if(_0x102e8d[_0x835d('0x11')]){if(_0x102e8d['error']['code']===0x1f4){logger[_0x835d('0x11')](_0x835d('0xe'),_0x164378,_0x102e8d[_0x835d('0x11')][_0x835d('0x12')]);return _0x312541(_0x102e8d[_0x835d('0x11')]['message']);}logger[_0x835d('0x11')](_0x835d('0xe'),_0x164378,_0x102e8d['error'][_0x835d('0x12')]);return _0x1600bc(_0x102e8d[_0x835d('0x11')][_0x835d('0x12')]);}else{logger[_0x835d('0xd')](_0x835d('0xe'),_0x164378,'request\x20sent');_0x1600bc(_0x102e8d[_0x835d('0x13')][_0x835d('0x12')]);}})['catch'](function(_0x4d7d5f){logger[_0x835d('0x11')](_0x835d('0xe'),_0x164378,_0x4d7d5f);_0x312541(_0x4d7d5f);});});} \ No newline at end of file +var _0xfe79=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfe79,0x1bd));var _0x9fe7=function(_0x155af3,_0x4b7f9a){_0x155af3=_0x155af3-0x0;var _0x15a675=_0xfe79[_0x155af3];return _0x15a675;};'use strict';var _=require(_0x9fe7('0x0'));var util=require(_0x9fe7('0x1'));var moment=require(_0x9fe7('0x2'));var BPromise=require(_0x9fe7('0x3'));var rs=require(_0x9fe7('0x4'));var fs=require('fs');var Redis=require(_0x9fe7('0x5'));var db=require(_0x9fe7('0x6'))['db'];var utils=require(_0x9fe7('0x7'));var logger=require('../../config/logger')(_0x9fe7('0x8'));var config=require(_0x9fe7('0x9'));var jayson=require(_0x9fe7('0xa'));var client=jayson[_0x9fe7('0xb')][_0x9fe7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3402b1,_0x1d6548,_0x271789){return new BPromise(function(_0x524caf,_0x4d7282){return client[_0x9fe7('0xd')](_0x3402b1,_0x271789)['then'](function(_0x4b11af){logger[_0x9fe7('0xe')](_0x9fe7('0xf'),_0x1d6548,_0x9fe7('0x10'));logger[_0x9fe7('0x11')](_0x9fe7('0x12'),_0x1d6548,_0x9fe7('0x10'),JSON[_0x9fe7('0x13')](_0x4b11af));if(_0x4b11af[_0x9fe7('0x14')]){if(_0x4b11af[_0x9fe7('0x14')][_0x9fe7('0x15')]===0x1f4){logger['error'](_0x9fe7('0xf'),_0x1d6548,_0x4b11af[_0x9fe7('0x14')][_0x9fe7('0x16')]);return _0x4d7282(_0x4b11af[_0x9fe7('0x14')]['message']);}logger[_0x9fe7('0x14')]('VoiceMail,\x20%s,\x20%s',_0x1d6548,_0x4b11af['error'][_0x9fe7('0x16')]);return _0x524caf(_0x4b11af[_0x9fe7('0x14')][_0x9fe7('0x16')]);}else{logger[_0x9fe7('0xe')](_0x9fe7('0xf'),_0x1d6548,_0x9fe7('0x10'));_0x524caf(_0x4b11af[_0x9fe7('0x17')]['message']);}})[_0x9fe7('0x18')](function(_0x569fc7){logger['error'](_0x9fe7('0xf'),_0x1d6548,_0x569fc7);_0x4d7282(_0x569fc7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 709ab58..fa787b0 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 _0x038e=['multer','util','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','destroy'];(function(_0x280f2c,_0x1f9a17){var _0xb868c=function(_0x44ae59){while(--_0x44ae59){_0x280f2c['push'](_0x280f2c['shift']());}};_0xb868c(++_0x1f9a17);}(_0x038e,0x143));var _0xe038=function(_0x4ec04e,_0x77043a){_0x4ec04e=_0x4ec04e-0x0;var _0x54b680=_0x038e[_0x4ec04e];return _0x54b680;};'use strict';var multer=require(_0xe038('0x0'));var util=require(_0xe038('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe038('0x2'));var router=express[_0xe038('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe038('0x4'));var config=require(_0xe038('0x5'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xe038('0x6')](),controller[_0xe038('0x7')]);router[_0xe038('0x8')](_0xe038('0x9'),auth[_0xe038('0x6')](),controller[_0xe038('0xa')]);router[_0xe038('0x8')](_0xe038('0xb'),auth['isAuthenticated'](),controller[_0xe038('0xc')]);router[_0xe038('0xd')]('/',auth['isAuthenticated'](),controller[_0xe038('0xe')]);router['put'](_0xe038('0x9'),auth[_0xe038('0x6')](),controller[_0xe038('0xf')]);router['delete'](_0xe038('0x9'),auth['isAuthenticated'](),controller[_0xe038('0x10')]);module['exports']=router; \ No newline at end of file +var _0x906b=['../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','show','download','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x906b,0xd6));var _0xb906=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x906b[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xb906('0x0'));var util=require(_0xb906('0x1'));var path=require(_0xb906('0x2'));var timeout=require(_0xb906('0x3'));var express=require(_0xb906('0x4'));var router=express['Router']();var fs_extra=require(_0xb906('0x5'));var auth=require(_0xb906('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb906('0x7'));var controller=require(_0xb906('0x8'));router['get']('/',auth[_0xb906('0x9')](),controller[_0xb906('0xa')]);router[_0xb906('0xb')]('/:id',auth[_0xb906('0x9')](),controller[_0xb906('0xc')]);router[_0xb906('0xb')]('/:id/download',auth[_0xb906('0x9')](),controller[_0xb906('0xd')]);router['post']('/',auth[_0xb906('0x9')](),controller[_0xb906('0xe')]);router[_0xb906('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb906('0x10')]);router[_0xb906('0x11')](_0xb906('0x12'),auth[_0xb906('0x9')](),controller['destroy']);module[_0xb906('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6c5b6a2..71a6537 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 _0xeb53=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','STRING','BLOB'];(function(_0x5d28d3,_0x1441b2){var _0x2244a9=function(_0xcd8291){while(--_0xcd8291){_0x5d28d3['push'](_0x5d28d3['shift']());}};_0x2244a9(++_0x1441b2);}(_0xeb53,0x143));var _0x3eb5=function(_0x42ad06,_0x4523f8){_0x42ad06=_0x42ad06-0x0;var _0xcec1bd=_0xeb53[_0x42ad06];return _0xcec1bd;};'use strict';var Sequelize=require(_0x3eb5('0x0'));module[_0x3eb5('0x1')]={'name':{'type':Sequelize[_0x3eb5('0x2')],'get':function(_0x22ea6d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3eb5('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3eb5('0x3')],'defaultValue':''},'stamp':{'type':_0x3eb5('0x5'),'defaultValue':Sequelize[_0x3eb5('0x6')](_0x3eb5('0x7'))}}; \ No newline at end of file +var _0xb5fc=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x382719,_0x91d5cb){var _0x48cff9=function(_0xf539c3){while(--_0xf539c3){_0x382719['push'](_0x382719['shift']());}};_0x48cff9(++_0x91d5cb);}(_0xb5fc,0x10a));var _0xcb5f=function(_0x287dd5,_0x3cdfbf){_0x287dd5=_0x287dd5-0x0;var _0x35043a=_0xb5fc[_0x287dd5];return _0x35043a;};'use strict';var Sequelize=require(_0xcb5f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb5f('0x1')],'get':function(_0xbda027){return this[_0xcb5f('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xcb5f('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xcb5f('0x5')](_0xcb5f('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xcb5f('0x4')],'defaultValue':''},'stamp':{'type':_0xcb5f('0x7'),'defaultValue':Sequelize[_0xcb5f('0x8')](_0xcb5f('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a86836e..f5685cb 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 _0x3161=['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','end','offset','undefined','limit','count','status','set','apply','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5d3cf8,_0x5864c6){var _0x3ae82e=function(_0x2405b6){while(--_0x2405b6){_0x5d3cf8['push'](_0x5d3cf8['shift']());}};_0x3ae82e(++_0x5864c6);}(_0x3161,0xa2));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1316('0x0'));var zipdir=require(_0x1316('0x1'));var jsonpatch=require(_0x1316('0x2'));var rp=require(_0x1316('0x3'));var moment=require(_0x1316('0x4'));var BPromise=require(_0x1316('0x5'));var Mustache=require(_0x1316('0x6'));var util=require(_0x1316('0x7'));var path=require(_0x1316('0x8'));var sox=require(_0x1316('0x9'));var csv=require(_0x1316('0xa'));var ejs=require(_0x1316('0xb'));var fs=require('fs');var fs_extra=require(_0x1316('0xc'));var _=require(_0x1316('0xd'));var squel=require(_0x1316('0xe'));var crypto=require(_0x1316('0xf'));var jsforce=require(_0x1316('0x10'));var deskjs=require(_0x1316('0x11'));var toCsv=require(_0x1316('0xa'));var querystring=require(_0x1316('0x12'));var Papa=require(_0x1316('0x13'));var Redis=require(_0x1316('0x14'));var authService=require(_0x1316('0x15'));var qs=require(_0x1316('0x16'));var as=require(_0x1316('0x17'));var hardwareService=require(_0x1316('0x18'));var logger=require(_0x1316('0x19'))('api');var utils=require(_0x1316('0x1a'));var config=require(_0x1316('0x1b'));var licenseUtil=require(_0x1316('0x1c'));var db=require(_0x1316('0x1d'))['db'];function respondWithStatusCode(_0x4306a3,_0x521754){_0x521754=_0x521754||0xcc;return function(_0x365c42){if(_0x365c42){return _0x4306a3['sendStatus'](_0x521754);}return _0x4306a3['status'](_0x521754)[_0x1316('0x1e')]();};}function respondWithResult(_0x123611,_0x2ac1b4){_0x2ac1b4=_0x2ac1b4||0xc8;return function(_0x7186f5){if(_0x7186f5){return _0x123611['status'](_0x2ac1b4)['json'](_0x7186f5);}};}function respondWithFilteredResult(_0x17f812,_0x19c442){return function(_0x413360){if(_0x413360){var _0x470ab2=typeof _0x19c442[_0x1316('0x1f')]===_0x1316('0x20')&&typeof _0x19c442[_0x1316('0x21')]===_0x1316('0x20');var _0x17fa3d=_0x413360[_0x1316('0x22')];var _0x2748c7=_0x470ab2?0x0:_0x19c442[_0x1316('0x1f')];var _0x2b6f50=_0x470ab2?_0x413360[_0x1316('0x22')]:_0x19c442[_0x1316('0x1f')]+_0x19c442[_0x1316('0x21')];var _0x5c4abb;if(_0x2b6f50>=_0x17fa3d){_0x2b6f50=_0x17fa3d;_0x5c4abb=0xc8;}else{_0x5c4abb=0xce;}_0x17f812[_0x1316('0x23')](_0x5c4abb);return _0x17f812[_0x1316('0x24')]('Content-Range',_0x2748c7+'-'+_0x2b6f50+'/'+_0x17fa3d)['json'](_0x413360);}return null;};}function patchUpdates(_0x533dd3){return function(_0xb07f2f){try{jsonpatch[_0x1316('0x25')](_0xb07f2f,_0x533dd3,!![]);}catch(_0x1d217e){return BPromise['reject'](_0x1d217e);}return _0xb07f2f['save']();};}function saveUpdates(_0x492591,_0x40417e){return function(_0x56cd6c){if(_0x56cd6c){return _0x56cd6c[_0x1316('0x26')](_0x492591)['then'](function(_0x4d952){return _0x4d952;});}return null;};}function removeEntity(_0x5b1f62,_0x404365){return function(_0x35e0e5){if(_0x35e0e5){return _0x35e0e5[_0x1316('0x27')]()[_0x1316('0x28')](function(){_0x5b1f62['status'](0xcc)[_0x1316('0x1e')]();});}};}function handleEntityNotFound(_0x49db73,_0x5e2bc9){return function(_0x2ac15f){if(!_0x2ac15f){_0x49db73[_0x1316('0x29')](0x194);}return _0x2ac15f;};}function handleError(_0x45fe23,_0x1109aa){_0x1109aa=_0x1109aa||0x1f4;return function(_0x1cd0bf){logger['error'](_0x1cd0bf[_0x1316('0x2a')]);if(_0x1cd0bf[_0x1316('0x2b')]){delete _0x1cd0bf[_0x1316('0x2b')];}_0x45fe23['status'](_0x1109aa)[_0x1316('0x2c')](_0x1cd0bf);};}exports[_0x1316('0x2d')]=function(_0x5affc6,_0x14bbd){var _0x4757a4={},_0x3a5743={},_0x2ee005={'count':0x0,'rows':[]};var _0x2e6cb8=_[_0x1316('0x2e')](db[_0x1316('0x2f')][_0x1316('0x30')],function(_0x110be7){return{'name':_0x110be7[_0x1316('0x31')],'type':_0x110be7[_0x1316('0x32')][_0x1316('0x33')]};});_0x3a5743[_0x1316('0x34')]=_[_0x1316('0x35')](_['map'](_0x2e6cb8,_0x1316('0x2b')),['name']);_0x3a5743[_0x1316('0x36')]=_[_0x1316('0x37')](_0x5affc6['query']);_0x3a5743[_0x1316('0x38')]=_[_0x1316('0x39')](_0x3a5743['model'],_0x3a5743[_0x1316('0x36')]);_0x4757a4['attributes']=_['intersection'](_0x3a5743[_0x1316('0x34')],qs['fields'](_0x5affc6[_0x1316('0x36')][_0x1316('0x3a')]));_0x4757a4[_0x1316('0x3b')]=_0x4757a4['attributes']['length']?_0x4757a4['attributes']:_0x3a5743[_0x1316('0x34')];if(!_0x5affc6[_0x1316('0x36')][_0x1316('0x3c')]('nolimit')){_0x4757a4['limit']=qs[_0x1316('0x21')](_0x5affc6['query'][_0x1316('0x21')]);_0x4757a4['offset']=qs[_0x1316('0x1f')](_0x5affc6[_0x1316('0x36')][_0x1316('0x1f')]);}_0x4757a4[_0x1316('0x3d')]=qs[_0x1316('0x3e')](_0x5affc6['query'][_0x1316('0x3e')]);_0x4757a4[_0x1316('0x3f')]=qs[_0x1316('0x38')](_['pick'](_0x5affc6[_0x1316('0x36')],_0x3a5743[_0x1316('0x38')]),_0x2e6cb8);if(_0x5affc6['query'][_0x1316('0x40')]){_0x4757a4[_0x1316('0x3f')]=_[_0x1316('0x41')](_0x4757a4[_0x1316('0x3f')],{'$or':_['map'](_0x2e6cb8,function(_0x8f67b6){if(_0x8f67b6[_0x1316('0x32')]!==_0x1316('0x42')){var _0x587f16={};_0x587f16[_0x8f67b6[_0x1316('0x2b')]]={'$like':'%'+_0x5affc6[_0x1316('0x36')][_0x1316('0x40')]+'%'};return _0x587f16;}})});}_0x4757a4=_[_0x1316('0x41')]({},_0x4757a4,_0x5affc6[_0x1316('0x43')]);var _0x11999f={'where':_0x4757a4['where']};return db[_0x1316('0x2f')][_0x1316('0x22')](_0x11999f)[_0x1316('0x28')](function(_0x1aeb2e){_0x2ee005[_0x1316('0x22')]=_0x1aeb2e;if(_0x5affc6[_0x1316('0x36')]['includeAll']){_0x4757a4[_0x1316('0x44')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x1316('0x45')](_0x4757a4);})[_0x1316('0x28')](function(_0x1b9098){_0x2ee005[_0x1316('0x46')]=_0x1b9098;return _0x2ee005;})[_0x1316('0x28')](respondWithFilteredResult(_0x14bbd,_0x4757a4))[_0x1316('0x47')](handleError(_0x14bbd,null));};exports[_0x1316('0x48')]=function(_0x597c6c,_0x6c3aad){var _0x342446={'raw':!![],'where':{'id':_0x597c6c['params']['id']}},_0x51f256={};_0x51f256[_0x1316('0x34')]=_['keys'](db[_0x1316('0x2f')][_0x1316('0x30')]);_0x51f256['query']=_['keys'](_0x597c6c[_0x1316('0x36')]);_0x51f256['filters']=_[_0x1316('0x39')](_0x51f256['model'],_0x51f256[_0x1316('0x36')]);_0x342446[_0x1316('0x3b')]=_[_0x1316('0x39')](_0x51f256[_0x1316('0x34')],qs[_0x1316('0x3a')](_0x597c6c[_0x1316('0x36')][_0x1316('0x3a')]));_0x342446[_0x1316('0x3b')]=_0x342446[_0x1316('0x3b')][_0x1316('0x49')]?_0x342446[_0x1316('0x3b')]:_0x51f256[_0x1316('0x34')];if(_0x597c6c[_0x1316('0x36')][_0x1316('0x4a')]){_0x342446[_0x1316('0x44')]=[{'all':!![]}];}_0x342446=_[_0x1316('0x41')]({},_0x342446,_0x597c6c[_0x1316('0x43')]);return db[_0x1316('0x2f')][_0x1316('0x4b')](_0x342446)[_0x1316('0x28')](handleEntityNotFound(_0x6c3aad,null))['then'](respondWithResult(_0x6c3aad,null))[_0x1316('0x47')](handleError(_0x6c3aad,null));};exports[_0x1316('0x4c')]=function(_0x3fae6b,_0x57d3b3){return db[_0x1316('0x2f')][_0x1316('0x4c')](_0x3fae6b[_0x1316('0x4d')],{})[_0x1316('0x28')](respondWithResult(_0x57d3b3,0xc9))[_0x1316('0x47')](handleError(_0x57d3b3,null));};exports[_0x1316('0x26')]=function(_0x220877,_0x2bdbf7){if(_0x220877[_0x1316('0x4d')]['id']){delete _0x220877[_0x1316('0x4d')]['id'];}return db['VoiceMailMessage'][_0x1316('0x4b')]({'where':{'id':_0x220877[_0x1316('0x4e')]['id']}})[_0x1316('0x28')](handleEntityNotFound(_0x2bdbf7,null))[_0x1316('0x28')](saveUpdates(_0x220877[_0x1316('0x4d')],null))[_0x1316('0x28')](respondWithResult(_0x2bdbf7,null))[_0x1316('0x47')](handleError(_0x2bdbf7,null));};exports[_0x1316('0x27')]=function(_0x2d5087,_0x501997){return db['VoiceMailMessage'][_0x1316('0x4b')]({'where':{'id':_0x2d5087[_0x1316('0x4e')]['id']}})[_0x1316('0x28')](handleEntityNotFound(_0x501997,null))[_0x1316('0x28')](removeEntity(_0x501997,null))[_0x1316('0x47')](handleError(_0x501997,null));};exports[_0x1316('0x4f')]=function(_0x409079,_0x579c28,_0x18ac0e){return db[_0x1316('0x2f')][_0x1316('0x4b')]({'where':{'id':_0x409079[_0x1316('0x4e')]['id']},'attributes':['id','recording',_0x1316('0x50')]})[_0x1316('0x28')](handleEntityNotFound(_0x579c28,null))['then'](function(_0x1ee974){if(_0x1ee974){if(!_0x1ee974[_0x1316('0x51')]){throw new db[(_0x1316('0x52'))][(_0x1316('0x53'))](_0x1316('0x54'));}var _0x1c48ea={'Content-Type':_0x1316('0x55'),'Content-Disposition':'attachment'};if(_0x1ee974[_0x1316('0x50')]){_0x1c48ea[_0x1316('0x56')]=_0x1316('0x57')+_0x1ee974[_0x1316('0x50')]+_0x1316('0x58');}_0x579c28[_0x1316('0x24')](_0x1c48ea);return _0x579c28[_0x1316('0x2c')](new Buffer(_0x1ee974[_0x1316('0x51')]));}})[_0x1316('0x47')](handleError(_0x579c28,null));}; \ No newline at end of file +var _0x3eee=['sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','index','map','VoiceMailMessage','fieldName','type','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3e5a3e,_0x292b17){var _0x3b5c30=function(_0x2b1cd8){while(--_0x2b1cd8){_0x3e5a3e['push'](_0x3e5a3e['shift']());}};_0x3b5c30(++_0x292b17);}(_0x3eee,0x16e));var _0xe3ee=function(_0x42e5f0,_0x282bd4){_0x42e5f0=_0x42e5f0-0x0;var _0x110f71=_0x3eee[_0x42e5f0];return _0x110f71;};'use strict';var emlformat=require(_0xe3ee('0x0'));var rimraf=require(_0xe3ee('0x1'));var zipdir=require(_0xe3ee('0x2'));var jsonpatch=require(_0xe3ee('0x3'));var rp=require(_0xe3ee('0x4'));var moment=require(_0xe3ee('0x5'));var BPromise=require(_0xe3ee('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe3ee('0x7'));var sox=require('sox');var csv=require(_0xe3ee('0x8'));var ejs=require(_0xe3ee('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ee('0xa'));var _=require(_0xe3ee('0xb'));var squel=require(_0xe3ee('0xc'));var crypto=require(_0xe3ee('0xd'));var jsforce=require(_0xe3ee('0xe'));var deskjs=require(_0xe3ee('0xf'));var toCsv=require(_0xe3ee('0x8'));var querystring=require(_0xe3ee('0x10'));var Papa=require('papaparse');var Redis=require(_0xe3ee('0x11'));var authService=require(_0xe3ee('0x12'));var qs=require(_0xe3ee('0x13'));var as=require(_0xe3ee('0x14'));var hardwareService=require(_0xe3ee('0x15'));var logger=require(_0xe3ee('0x16'))('api');var utils=require(_0xe3ee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ff49b,_0x1c5490){_0x1c5490=_0x1c5490||0xcc;return function(_0x10598e){if(_0x10598e){return _0x2ff49b[_0xe3ee('0x18')](_0x1c5490);}return _0x2ff49b[_0xe3ee('0x19')](_0x1c5490)[_0xe3ee('0x1a')]();};}function respondWithResult(_0x214927,_0x264f5f){_0x264f5f=_0x264f5f||0xc8;return function(_0x1c4e75){if(_0x1c4e75){return _0x214927[_0xe3ee('0x19')](_0x264f5f)['json'](_0x1c4e75);}};}function respondWithFilteredResult(_0x2b935e,_0x4ebfc3){return function(_0x4dfe58){if(_0x4dfe58){var _0x41632e=typeof _0x4ebfc3[_0xe3ee('0x1b')]===_0xe3ee('0x1c')&&typeof _0x4ebfc3['limit']===_0xe3ee('0x1c');var _0x35ac5d=_0x4dfe58[_0xe3ee('0x1d')];var _0x4df8cf=_0x41632e?0x0:_0x4ebfc3['offset'];var _0x1112ff=_0x41632e?_0x4dfe58[_0xe3ee('0x1d')]:_0x4ebfc3[_0xe3ee('0x1b')]+_0x4ebfc3[_0xe3ee('0x1e')];var _0x376de0;if(_0x1112ff>=_0x35ac5d){_0x1112ff=_0x35ac5d;_0x376de0=0xc8;}else{_0x376de0=0xce;}_0x2b935e['status'](_0x376de0);return _0x2b935e['set'](_0xe3ee('0x1f'),_0x4df8cf+'-'+_0x1112ff+'/'+_0x35ac5d)['json'](_0x4dfe58);}return null;};}function patchUpdates(_0xe32cdb){return function(_0x40fb0e){try{jsonpatch[_0xe3ee('0x20')](_0x40fb0e,_0xe32cdb,!![]);}catch(_0xa08e1a){return BPromise['reject'](_0xa08e1a);}return _0x40fb0e[_0xe3ee('0x21')]();};}function saveUpdates(_0x1e48c9,_0x58fb1e){return function(_0x417a57){if(_0x417a57){return _0x417a57[_0xe3ee('0x22')](_0x1e48c9)[_0xe3ee('0x23')](function(_0x1951b9){return _0x1951b9;});}return null;};}function removeEntity(_0x58617f,_0x5c8380){return function(_0x12cde5){if(_0x12cde5){return _0x12cde5[_0xe3ee('0x24')]()['then'](function(){_0x58617f[_0xe3ee('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511e8a,_0x39928d){return function(_0x18ac86){if(!_0x18ac86){_0x511e8a[_0xe3ee('0x18')](0x194);}return _0x18ac86;};}function handleError(_0x413b4c,_0x30c7f5){_0x30c7f5=_0x30c7f5||0x1f4;return function(_0x4fcbe3){logger['error'](_0x4fcbe3[_0xe3ee('0x25')]);if(_0x4fcbe3[_0xe3ee('0x26')]){delete _0x4fcbe3[_0xe3ee('0x26')];}_0x413b4c[_0xe3ee('0x19')](_0x30c7f5)['send'](_0x4fcbe3);};}exports[_0xe3ee('0x27')]=function(_0x2dc921,_0x45b7a8){var _0xc70379={},_0x14e23d={},_0x555784={'count':0x0,'rows':[]};var _0x3abf72=_[_0xe3ee('0x28')](db[_0xe3ee('0x29')]['rawAttributes'],function(_0x5df81b){return{'name':_0x5df81b[_0xe3ee('0x2a')],'type':_0x5df81b[_0xe3ee('0x2b')]['key']};});_0x14e23d['model']=_[_0xe3ee('0x2c')](_['map'](_0x3abf72,_0xe3ee('0x26')),[_0xe3ee('0x26')]);_0x14e23d[_0xe3ee('0x2d')]=_[_0xe3ee('0x2e')](_0x2dc921['query']);_0x14e23d[_0xe3ee('0x2f')]=_[_0xe3ee('0x30')](_0x14e23d['model'],_0x14e23d[_0xe3ee('0x2d')]);_0xc70379[_0xe3ee('0x31')]=_[_0xe3ee('0x30')](_0x14e23d[_0xe3ee('0x32')],qs[_0xe3ee('0x33')](_0x2dc921['query'][_0xe3ee('0x33')]));_0xc70379[_0xe3ee('0x31')]=_0xc70379[_0xe3ee('0x31')][_0xe3ee('0x34')]?_0xc70379[_0xe3ee('0x31')]:_0x14e23d[_0xe3ee('0x32')];if(!_0x2dc921[_0xe3ee('0x2d')]['hasOwnProperty']('nolimit')){_0xc70379[_0xe3ee('0x1e')]=qs['limit'](_0x2dc921[_0xe3ee('0x2d')][_0xe3ee('0x1e')]);_0xc70379[_0xe3ee('0x1b')]=qs['offset'](_0x2dc921[_0xe3ee('0x2d')][_0xe3ee('0x1b')]);}_0xc70379['order']=qs['sort'](_0x2dc921['query']['sort']);_0xc70379[_0xe3ee('0x35')]=qs[_0xe3ee('0x2f')](_[_0xe3ee('0x36')](_0x2dc921['query'],_0x14e23d[_0xe3ee('0x2f')]),_0x3abf72);if(_0x2dc921['query'][_0xe3ee('0x37')]){_0xc70379[_0xe3ee('0x35')]=_[_0xe3ee('0x38')](_0xc70379[_0xe3ee('0x35')],{'$or':_[_0xe3ee('0x28')](_0x3abf72,function(_0x4c7274){if(_0x4c7274['type']!==_0xe3ee('0x39')){var _0x3b0a5a={};_0x3b0a5a[_0x4c7274[_0xe3ee('0x26')]]={'$like':'%'+_0x2dc921[_0xe3ee('0x2d')][_0xe3ee('0x37')]+'%'};return _0x3b0a5a;}})});}_0xc70379=_['merge']({},_0xc70379,_0x2dc921[_0xe3ee('0x3a')]);var _0x217a5e={'where':_0xc70379[_0xe3ee('0x35')]};return db[_0xe3ee('0x29')][_0xe3ee('0x1d')](_0x217a5e)[_0xe3ee('0x23')](function(_0xb7025c){_0x555784[_0xe3ee('0x1d')]=_0xb7025c;if(_0x2dc921['query'][_0xe3ee('0x3b')]){_0xc70379['include']=[{'all':!![]}];}return db[_0xe3ee('0x29')]['findAll'](_0xc70379);})[_0xe3ee('0x23')](function(_0x3da4a1){_0x555784[_0xe3ee('0x3c')]=_0x3da4a1;return _0x555784;})[_0xe3ee('0x23')](respondWithFilteredResult(_0x45b7a8,_0xc70379))[_0xe3ee('0x3d')](handleError(_0x45b7a8,null));};exports[_0xe3ee('0x3e')]=function(_0x4ee35b,_0x169ec4){var _0x441805={'raw':!![],'where':{'id':_0x4ee35b[_0xe3ee('0x3f')]['id']}},_0x2e2ae4={};_0x2e2ae4[_0xe3ee('0x32')]=_[_0xe3ee('0x2e')](db[_0xe3ee('0x29')][_0xe3ee('0x40')]);_0x2e2ae4[_0xe3ee('0x2d')]=_[_0xe3ee('0x2e')](_0x4ee35b[_0xe3ee('0x2d')]);_0x2e2ae4['filters']=_[_0xe3ee('0x30')](_0x2e2ae4[_0xe3ee('0x32')],_0x2e2ae4[_0xe3ee('0x2d')]);_0x441805[_0xe3ee('0x31')]=_[_0xe3ee('0x30')](_0x2e2ae4[_0xe3ee('0x32')],qs[_0xe3ee('0x33')](_0x4ee35b['query'][_0xe3ee('0x33')]));_0x441805[_0xe3ee('0x31')]=_0x441805['attributes'][_0xe3ee('0x34')]?_0x441805[_0xe3ee('0x31')]:_0x2e2ae4['model'];if(_0x4ee35b[_0xe3ee('0x2d')][_0xe3ee('0x3b')]){_0x441805['include']=[{'all':!![]}];}_0x441805=_[_0xe3ee('0x38')]({},_0x441805,_0x4ee35b[_0xe3ee('0x3a')]);return db[_0xe3ee('0x29')][_0xe3ee('0x41')](_0x441805)[_0xe3ee('0x23')](handleEntityNotFound(_0x169ec4,null))[_0xe3ee('0x23')](respondWithResult(_0x169ec4,null))[_0xe3ee('0x3d')](handleError(_0x169ec4,null));};exports[_0xe3ee('0x42')]=function(_0x59ef6a,_0x337c39){return db['VoiceMailMessage']['create'](_0x59ef6a[_0xe3ee('0x43')],{})['then'](respondWithResult(_0x337c39,0xc9))[_0xe3ee('0x3d')](handleError(_0x337c39,null));};exports[_0xe3ee('0x22')]=function(_0x15cdd1,_0x554f0b){if(_0x15cdd1['body']['id']){delete _0x15cdd1[_0xe3ee('0x43')]['id'];}return db[_0xe3ee('0x29')][_0xe3ee('0x41')]({'where':{'id':_0x15cdd1[_0xe3ee('0x3f')]['id']}})['then'](handleEntityNotFound(_0x554f0b,null))[_0xe3ee('0x23')](saveUpdates(_0x15cdd1[_0xe3ee('0x43')],null))[_0xe3ee('0x23')](respondWithResult(_0x554f0b,null))['catch'](handleError(_0x554f0b,null));};exports[_0xe3ee('0x24')]=function(_0x4b64c1,_0x4221ee){return db['VoiceMailMessage'][_0xe3ee('0x41')]({'where':{'id':_0x4b64c1['params']['id']}})[_0xe3ee('0x23')](handleEntityNotFound(_0x4221ee,null))[_0xe3ee('0x23')](removeEntity(_0x4221ee,null))[_0xe3ee('0x3d')](handleError(_0x4221ee,null));};exports['download']=function(_0x3a0b08,_0x3746af,_0x5dd39a){return db['VoiceMailMessage'][_0xe3ee('0x41')]({'where':{'id':_0x3a0b08[_0xe3ee('0x3f')]['id']},'attributes':['id','recording',_0xe3ee('0x44')]})['then'](handleEntityNotFound(_0x3746af,null))[_0xe3ee('0x23')](function(_0x2c2859){if(_0x2c2859){if(!_0x2c2859[_0xe3ee('0x45')]){throw new db[(_0xe3ee('0x46'))][(_0xe3ee('0x47'))](_0xe3ee('0x48'));}var _0x31d08e={'Content-Type':_0xe3ee('0x49'),'Content-Disposition':'attachment'};if(_0x2c2859[_0xe3ee('0x44')]){_0x31d08e[_0xe3ee('0x4a')]='attachment;\x20filename=\x22'+_0x2c2859[_0xe3ee('0x44')]+_0xe3ee('0x4b');}_0x3746af[_0xe3ee('0x4c')](_0x31d08e);return _0x3746af[_0xe3ee('0x4d')](new Buffer(_0x2c2859[_0xe3ee('0x45')]));}})['catch'](handleError(_0x3746af,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index fb6378a..e958a8a 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 _0x9995=['../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9995,0x102));var _0x5999=function(_0x2872c5,_0x362506){_0x2872c5=_0x2872c5-0x0;var _0x5a3d07=_0x9995[_0x2872c5];return _0x5a3d07;};'use strict';var _=require(_0x5999('0x0'));var util=require(_0x5999('0x1'));var logger=require(_0x5999('0x2'))(_0x5999('0x3'));var moment=require(_0x5999('0x4'));var BPromise=require(_0x5999('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5999('0x6'));var attributes=require(_0x5999('0x7'));module['exports']=function(_0x489abc,_0x28dfc9){return _0x489abc[_0x5999('0x8')](_0x5999('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5999('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xd90e=['./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x31a461,_0x34f3d4){var _0x494f72=function(_0xd25ce1){while(--_0xd25ce1){_0x31a461['push'](_0x31a461['shift']());}};_0x494f72(++_0x34f3d4);}(_0xd90e,0x1f3));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed90('0x0'));var logger=require(_0xed90('0x1'))(_0xed90('0x2'));var moment=require(_0xed90('0x3'));var BPromise=require(_0xed90('0x4'));var rp=require(_0xed90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed90('0x6'));var config=require(_0xed90('0x7'));var attributes=require(_0xed90('0x8'));module['exports']=function(_0x415068,_0x2c8d7b){return _0x415068[_0xed90('0x9')](_0xed90('0xa'),attributes,{'tableName':_0xed90('0xb'),'paranoid':![],'indexes':[{'name':_0xed90('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index eac0917..84bcf64 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 _0x0d1a=['then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1809d2,_0x40a0be){var _0x3a3919=function(_0x2889cb){while(--_0x2889cb){_0x1809d2['push'](_0x1809d2['shift']());}};_0x3a3919(++_0x40a0be);}(_0x0d1a,0x163));var _0xa0d1=function(_0x2e3858,_0x4b35ad){_0x2e3858=_0x2e3858-0x0;var _0x98615b=_0x0d1a[_0x2e3858];return _0x98615b;};'use strict';var _=require(_0xa0d1('0x0'));var util=require(_0xa0d1('0x1'));var moment=require(_0xa0d1('0x2'));var BPromise=require(_0xa0d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0d1('0x4'));var db=require(_0xa0d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0d1('0x6'))(_0xa0d1('0x7'));var config=require(_0xa0d1('0x8'));var jayson=require(_0xa0d1('0x9'));var client=jayson[_0xa0d1('0xa')][_0xa0d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a0e3d,_0x31eb0c,_0x5a5c65){return new BPromise(function(_0xe1830b,_0x51790c){return client[_0xa0d1('0xc')](_0x5a0e3d,_0x5a5c65)[_0xa0d1('0xd')](function(_0x4578b1){logger['info'](_0xa0d1('0xe'),_0x31eb0c,_0xa0d1('0xf'));logger[_0xa0d1('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x31eb0c,'request\x20sent',JSON['stringify'](_0x4578b1));if(_0x4578b1[_0xa0d1('0x11')]){if(_0x4578b1['error'][_0xa0d1('0x12')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x31eb0c,_0x4578b1[_0xa0d1('0x11')][_0xa0d1('0x13')]);return _0x51790c(_0x4578b1[_0xa0d1('0x11')][_0xa0d1('0x13')]);}logger['error'](_0xa0d1('0xe'),_0x31eb0c,_0x4578b1[_0xa0d1('0x11')][_0xa0d1('0x13')]);return _0xe1830b(_0x4578b1[_0xa0d1('0x11')][_0xa0d1('0x13')]);}else{logger[_0xa0d1('0x14')](_0xa0d1('0xe'),_0x31eb0c,_0xa0d1('0xf'));_0xe1830b(_0x4578b1[_0xa0d1('0x15')][_0xa0d1('0x13')]);}})[_0xa0d1('0x16')](function(_0x1503ef){logger[_0xa0d1('0x11')](_0xa0d1('0xe'),_0x31eb0c,_0x1503ef);_0x51790c(_0x1503ef);});});} \ No newline at end of file +var _0x6324=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5325b2,_0x423ce1){var _0x2bcb52=function(_0x35de85){while(--_0x35de85){_0x5325b2['push'](_0x5325b2['shift']());}};_0x2bcb52(++_0x423ce1);}(_0x6324,0xd5));var _0x4632=function(_0x3ada0a,_0x5e94e9){_0x3ada0a=_0x3ada0a-0x0;var _0x41ffc0=_0x6324[_0x3ada0a];return _0x41ffc0;};'use strict';var _=require(_0x4632('0x0'));var util=require('util');var moment=require(_0x4632('0x1'));var BPromise=require(_0x4632('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x3'));var db=require(_0x4632('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4632('0x5'))(_0x4632('0x6'));var config=require(_0x4632('0x7'));var jayson=require(_0x4632('0x8'));var client=jayson[_0x4632('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2702a9,_0xde104f,_0x4b24dc){return new BPromise(function(_0xddd91f,_0x41dda9){return client[_0x4632('0xa')](_0x2702a9,_0x4b24dc)[_0x4632('0xb')](function(_0xfb8bba){logger[_0x4632('0xc')](_0x4632('0xd'),_0xde104f,_0x4632('0xe'));logger[_0x4632('0xf')](_0x4632('0x10'),_0xde104f,_0x4632('0xe'),JSON[_0x4632('0x11')](_0xfb8bba));if(_0xfb8bba[_0x4632('0x12')]){if(_0xfb8bba['error'][_0x4632('0x13')]===0x1f4){logger['error'](_0x4632('0xd'),_0xde104f,_0xfb8bba[_0x4632('0x12')][_0x4632('0x14')]);return _0x41dda9(_0xfb8bba[_0x4632('0x12')][_0x4632('0x14')]);}logger[_0x4632('0x12')](_0x4632('0xd'),_0xde104f,_0xfb8bba['error'][_0x4632('0x14')]);return _0xddd91f(_0xfb8bba[_0x4632('0x12')][_0x4632('0x14')]);}else{logger[_0x4632('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0xde104f,_0x4632('0xe'));_0xddd91f(_0xfb8bba[_0x4632('0x15')]['message']);}})[_0x4632('0x16')](function(_0x50e77e){logger[_0x4632('0x12')](_0x4632('0xd'),_0xde104f,_0x50e77e);_0x41dda9(_0x50e77e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 59c8530..7f7c9eb 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 _0x72f3=['/:id/sounds','getSounds','post','create','put','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','get'];(function(_0x217d12,_0x5348f0){var _0x489e89=function(_0x3f9436){while(--_0x3f9436){_0x217d12['push'](_0x217d12['shift']());}};_0x489e89(++_0x5348f0);}(_0x72f3,0x78));var _0x372f=function(_0x2e4032,_0x5e6c8c){_0x2e4032=_0x2e4032-0x0;var _0x5433f9=_0x72f3[_0x2e4032];return _0x5433f9;};'use strict';var multer=require(_0x372f('0x0'));var util=require(_0x372f('0x1'));var path=require(_0x372f('0x2'));var timeout=require(_0x372f('0x3'));var express=require(_0x372f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x372f('0x5'));var config=require(_0x372f('0x6'));var controller=require(_0x372f('0x7'));router['get']('/',auth[_0x372f('0x8')](),controller[_0x372f('0x9')]);router['get'](_0x372f('0xa'),auth[_0x372f('0x8')](),controller['show']);router[_0x372f('0xb')](_0x372f('0xc'),auth[_0x372f('0x8')](),controller[_0x372f('0xd')]);router[_0x372f('0xe')]('/',auth[_0x372f('0x8')](),controller[_0x372f('0xf')]);router[_0x372f('0xe')](_0x372f('0xc'),auth[_0x372f('0x8')](),controller['addSound']);router[_0x372f('0x10')]('/:id',auth[_0x372f('0x8')](),controller[_0x372f('0x11')]);router[_0x372f('0x12')](_0x372f('0xa'),auth[_0x372f('0x8')](),controller[_0x372f('0x13')]);router['delete']('/:id/sounds/:id2',auth[_0x372f('0x8')](),controller[_0x372f('0x14')]);module[_0x372f('0x15')]=router; \ No newline at end of file +var _0xe281=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe281,0x159));var _0x1e28=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe281[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x1e28('0x0'));var path=require(_0x1e28('0x1'));var timeout=require(_0x1e28('0x2'));var express=require(_0x1e28('0x3'));var router=express[_0x1e28('0x4')]();var fs_extra=require(_0x1e28('0x5'));var auth=require(_0x1e28('0x6'));var interaction=require(_0x1e28('0x7'));var config=require(_0x1e28('0x8'));var controller=require(_0x1e28('0x9'));router[_0x1e28('0xa')]('/',auth[_0x1e28('0xb')](),controller[_0x1e28('0xc')]);router['get'](_0x1e28('0xd'),auth[_0x1e28('0xb')](),controller[_0x1e28('0xe')]);router['get'](_0x1e28('0xf'),auth[_0x1e28('0xb')](),controller['getSounds']);router[_0x1e28('0x10')]('/',auth[_0x1e28('0xb')](),controller[_0x1e28('0x11')]);router[_0x1e28('0x10')](_0x1e28('0xf'),auth[_0x1e28('0xb')](),controller[_0x1e28('0x12')]);router[_0x1e28('0x13')]('/:id',auth[_0x1e28('0xb')](),controller[_0x1e28('0x14')]);router['delete'](_0x1e28('0xd'),auth['isAuthenticated'](),controller[_0x1e28('0x15')]);router[_0x1e28('0x16')](_0x1e28('0x17'),auth[_0x1e28('0xb')](),controller[_0x1e28('0x18')]);module[_0x1e28('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5ff5e2a..0a6012f 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 _0x146e=['ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x1d74c0,_0x8f2c0b){var _0x5c4da1=function(_0x82c03a){while(--_0x82c03a){_0x1d74c0['push'](_0x1d74c0['shift']());}};_0x5c4da1(++_0x8f2c0b);}(_0x146e,0x74));var _0xe146=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x146e[_0x5d6270];return _0x168f26;};'use strict';var Sequelize=require(_0xe146('0x0'));module[_0xe146('0x1')]={'name':{'type':Sequelize[_0xe146('0x2')],'allowNull':![],'unique':_0xe146('0x3')},'mode':{'type':Sequelize[_0xe146('0x4')]('custom',_0xe146('0x5'),_0xe146('0x6'),_0xe146('0x7'),'quietmp3',_0xe146('0x8')),'allowNull':!![],'defaultValue':_0xe146('0x5')},'directory':{'type':Sequelize[_0xe146('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe146('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe146('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe146('0x2')],'allowNull':!![],'defaultValue':_0xe146('0x9')},'format':{'type':Sequelize[_0xe146('0x2')],'allowNull':!![]},'stamp':{'type':_0xe146('0xa')},'defaultEntry':{'type':Sequelize[_0xe146('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc426=['files','mp3nb','quietmp3nb','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xc426,0xed));var _0x6c42=function(_0x18bc1c,_0x4b308c){_0x18bc1c=_0x18bc1c-0x0;var _0x2ae53f=_0xc426[_0x18bc1c];return _0x2ae53f;};'use strict';var Sequelize=require(_0x6c42('0x0'));module[_0x6c42('0x1')]={'name':{'type':Sequelize[_0x6c42('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6c42('0x3')](_0x6c42('0x4'),_0x6c42('0x5'),_0x6c42('0x6'),_0x6c42('0x7'),'quietmp3',_0x6c42('0x8')),'allowNull':!![],'defaultValue':_0x6c42('0x5')},'directory':{'type':Sequelize[_0x6c42('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6c42('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6c42('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6c42('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x6c42('0x9')},'defaultEntry':{'type':Sequelize[_0x6c42('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 5d60151..83f93da 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 _0x4523=['rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','mode','directory','join','root','server/files/moh','files','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','Sound','save_name','converted_format','createdAt','format','%s.%s','basename','symlinkSync','removeSound','id2','findOne','getSounds','eml-format','zip-dir','moment','bluebird','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/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','map','VoiceMusicOnHold'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4523,0x180));var _0x3452=function(_0x2e0ace,_0xa4442d){_0x2e0ace=_0x2e0ace-0x0;var _0x369cb2=_0x4523[_0x2e0ace];return _0x369cb2;};'use strict';var emlformat=require(_0x3452('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3452('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3452('0x2'));var BPromise=require(_0x3452('0x3'));var Mustache=require('mustache');var util=require(_0x3452('0x4'));var path=require(_0x3452('0x5'));var sox=require(_0x3452('0x6'));var csv=require(_0x3452('0x7'));var ejs=require(_0x3452('0x8'));var fs=require('fs');var fs_extra=require(_0x3452('0x9'));var _=require('lodash');var squel=require(_0x3452('0xa'));var crypto=require(_0x3452('0xb'));var jsforce=require(_0x3452('0xc'));var deskjs=require(_0x3452('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3452('0xe'));var Papa=require(_0x3452('0xf'));var Redis=require(_0x3452('0x10'));var authService=require(_0x3452('0x11'));var qs=require(_0x3452('0x12'));var as=require(_0x3452('0x13'));var hardwareService=require(_0x3452('0x14'));var logger=require('../../config/logger')(_0x3452('0x15'));var utils=require(_0x3452('0x16'));var config=require(_0x3452('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259a20,_0x802da8){_0x802da8=_0x802da8||0xcc;return function(_0x4c8879){if(_0x4c8879){return _0x259a20[_0x3452('0x18')](_0x802da8);}return _0x259a20['status'](_0x802da8)[_0x3452('0x19')]();};}function respondWithResult(_0x163429,_0x4217c2){_0x4217c2=_0x4217c2||0xc8;return function(_0x4c689b){if(_0x4c689b){return _0x163429[_0x3452('0x1a')](_0x4217c2)[_0x3452('0x1b')](_0x4c689b);}};}function respondWithFilteredResult(_0x586e57,_0x84ef4a){return function(_0x302778){if(_0x302778){var _0x1787cb=typeof _0x84ef4a[_0x3452('0x1c')]===_0x3452('0x1d')&&typeof _0x84ef4a[_0x3452('0x1e')]===_0x3452('0x1d');var _0x17e1e0=_0x302778[_0x3452('0x1f')];var _0x358652=_0x1787cb?0x0:_0x84ef4a[_0x3452('0x1c')];var _0x331fd8=_0x1787cb?_0x302778['count']:_0x84ef4a['offset']+_0x84ef4a[_0x3452('0x1e')];var _0x47f0b4;if(_0x331fd8>=_0x17e1e0){_0x331fd8=_0x17e1e0;_0x47f0b4=0xc8;}else{_0x47f0b4=0xce;}_0x586e57['status'](_0x47f0b4);return _0x586e57['set']('Content-Range',_0x358652+'-'+_0x331fd8+'/'+_0x17e1e0)[_0x3452('0x1b')](_0x302778);}return null;};}function patchUpdates(_0x276d43){return function(_0x4f3886){try{jsonpatch['apply'](_0x4f3886,_0x276d43,!![]);}catch(_0x229eb2){return BPromise['reject'](_0x229eb2);}return _0x4f3886[_0x3452('0x20')]();};}function saveUpdates(_0x3d5e63,_0x5e5c52){return function(_0x88ed4e){if(_0x88ed4e){return _0x88ed4e[_0x3452('0x21')](_0x3d5e63)[_0x3452('0x22')](function(_0x220441){return _0x220441;});}return null;};}function removeEntity(_0x59fe08,_0x4a04ce){return function(_0xde6d89){if(_0xde6d89){return _0xde6d89['destroy']()['then'](function(){var _0x19717b=_0xde6d89[_0x3452('0x23')]({'plain':!![]});var _0x4933a8=_0x3452('0x24');return db[_0x3452('0x25')][_0x3452('0x26')]({'where':{'type':_0x4933a8,'resourceId':_0x19717b['id']}})[_0x3452('0x22')](function(){return _0xde6d89;});})[_0x3452('0x22')](function(){_0x59fe08[_0x3452('0x1a')](0xcc)[_0x3452('0x19')]();});}};}function handleEntityNotFound(_0x2b0adb,_0x17f2db){return function(_0x206f35){if(!_0x206f35){_0x2b0adb[_0x3452('0x18')](0x194);}return _0x206f35;};}function handleError(_0x121e4c,_0x4994e2){_0x4994e2=_0x4994e2||0x1f4;return function(_0x57fda3){logger[_0x3452('0x27')](_0x57fda3['stack']);if(_0x57fda3[_0x3452('0x28')]){delete _0x57fda3[_0x3452('0x28')];}_0x121e4c[_0x3452('0x1a')](_0x4994e2)[_0x3452('0x29')](_0x57fda3);};}exports['index']=function(_0x4c2b50,_0x809476){var _0x355790={},_0x28b92d={},_0x1a7731={'count':0x0,'rows':[]};var _0x30b2a9=_[_0x3452('0x2a')](db[_0x3452('0x2b')][_0x3452('0x2c')],function(_0x3ca338){return{'name':_0x3ca338[_0x3452('0x2d')],'type':_0x3ca338['type'][_0x3452('0x2e')]};});_0x28b92d['model']=_[_0x3452('0x2a')](_0x30b2a9,_0x3452('0x28'));_0x28b92d[_0x3452('0x2f')]=_[_0x3452('0x30')](_0x4c2b50[_0x3452('0x2f')]);_0x28b92d[_0x3452('0x31')]=_[_0x3452('0x32')](_0x28b92d['model'],_0x28b92d[_0x3452('0x2f')]);_0x355790[_0x3452('0x33')]=_[_0x3452('0x32')](_0x28b92d[_0x3452('0x34')],qs['fields'](_0x4c2b50[_0x3452('0x2f')][_0x3452('0x35')]));_0x355790[_0x3452('0x33')]=_0x355790[_0x3452('0x33')][_0x3452('0x36')]?_0x355790['attributes']:_0x28b92d[_0x3452('0x34')];if(!_0x4c2b50['query'][_0x3452('0x37')](_0x3452('0x38'))){_0x355790['limit']=qs['limit'](_0x4c2b50[_0x3452('0x2f')]['limit']);_0x355790['offset']=qs['offset'](_0x4c2b50[_0x3452('0x2f')][_0x3452('0x1c')]);}_0x355790['order']=qs[_0x3452('0x39')](_0x4c2b50[_0x3452('0x2f')][_0x3452('0x39')]);delete _0x4c2b50[_0x3452('0x2f')][_0x3452('0x39')];_0x355790['where']=qs[_0x3452('0x31')](_[_0x3452('0x3a')](_0x4c2b50['query'],_0x28b92d[_0x3452('0x31')]),_0x30b2a9);if(_0x4c2b50[_0x3452('0x2f')][_0x3452('0x3b')]){_0x355790[_0x3452('0x3c')]=_[_0x3452('0x3d')](_0x355790['where'],{'$or':_[_0x3452('0x2a')](_0x30b2a9,function(_0x6058b0){if(_0x6058b0[_0x3452('0x3e')]!==_0x3452('0x3f')){var _0x48b9bd={};_0x48b9bd[_0x6058b0[_0x3452('0x28')]]={'$like':'%'+_0x4c2b50[_0x3452('0x2f')][_0x3452('0x3b')]+'%'};return _0x48b9bd;}})});}_0x355790=_['merge']({},_0x355790,_0x4c2b50[_0x3452('0x40')]);var _0x508e97={'where':_0x355790['where']};return db[_0x3452('0x2b')][_0x3452('0x1f')](_0x508e97)[_0x3452('0x22')](function(_0x4721f0){_0x1a7731[_0x3452('0x1f')]=_0x4721f0;if(_0x4c2b50['query'][_0x3452('0x41')]){_0x355790[_0x3452('0x42')]=[{'all':!![]}];}return db[_0x3452('0x2b')][_0x3452('0x43')](_0x355790);})[_0x3452('0x22')](function(_0x1632bc){_0x1a7731[_0x3452('0x44')]=_0x1632bc;return _0x1a7731;})[_0x3452('0x22')](respondWithFilteredResult(_0x809476,_0x355790))[_0x3452('0x45')](handleError(_0x809476,null));};exports[_0x3452('0x46')]=function(_0x1de162,_0x4666b1){var _0x12d099={'raw':![],'where':{'id':_0x1de162[_0x3452('0x47')]['id']}},_0x2c20c8={};_0x2c20c8[_0x3452('0x34')]=_[_0x3452('0x30')](db['VoiceMusicOnHold']['rawAttributes']);_0x2c20c8[_0x3452('0x2f')]=_[_0x3452('0x30')](_0x1de162[_0x3452('0x2f')]);_0x2c20c8[_0x3452('0x31')]=_[_0x3452('0x32')](_0x2c20c8[_0x3452('0x34')],_0x2c20c8[_0x3452('0x2f')]);_0x12d099[_0x3452('0x33')]=_[_0x3452('0x32')](_0x2c20c8[_0x3452('0x34')],qs[_0x3452('0x35')](_0x1de162[_0x3452('0x2f')][_0x3452('0x35')]));_0x12d099[_0x3452('0x33')]=_0x12d099[_0x3452('0x33')][_0x3452('0x36')]?_0x12d099[_0x3452('0x33')]:_0x2c20c8['model'];if(_0x1de162[_0x3452('0x2f')][_0x3452('0x41')]){_0x12d099['include']=[{'all':!![]}];}_0x12d099=_['merge']({},_0x12d099,_0x1de162[_0x3452('0x40')]);return db[_0x3452('0x2b')]['find'](_0x12d099)[_0x3452('0x22')](handleEntityNotFound(_0x4666b1,null))[_0x3452('0x22')](respondWithResult(_0x4666b1,null))[_0x3452('0x45')](handleError(_0x4666b1,null));};exports[_0x3452('0x21')]=function(_0x40b8bf,_0x2b0793){if(_0x40b8bf['body']['id']){delete _0x40b8bf[_0x3452('0x48')]['id'];}return db['VoiceMusicOnHold'][_0x3452('0x49')]({'where':{'id':_0x40b8bf[_0x3452('0x47')]['id']}})[_0x3452('0x22')](handleEntityNotFound(_0x2b0793,null))['then'](saveUpdates(_0x40b8bf[_0x3452('0x48')],null))[_0x3452('0x22')](respondWithResult(_0x2b0793,null))['catch'](handleError(_0x2b0793,null));};exports[_0x3452('0x4a')]=function(_0x13e800,_0x281ae2,_0x3a5621){return db['sequelize']['transaction'](function(_0x3f49c9){if(_0x13e800['body'][_0x3452('0x4b')]==='files'){_0x13e800['body'][_0x3452('0x4c')]=path[_0x3452('0x4d')](config[_0x3452('0x4e')],_0x3452('0x4f'),_0x13e800[_0x3452('0x48')][_0x3452('0x28')]);}return db[_0x3452('0x2b')][_0x3452('0x4a')](_0x13e800[_0x3452('0x48')],{'transaction':_0x3f49c9})[_0x3452('0x22')](function(_0x4e1289){if(_0x13e800[_0x3452('0x48')][_0x3452('0x4b')]===_0x3452('0x50')){fs[_0x3452('0x51')](_0x4e1289[_0x3452('0x4c')],parseInt('0777',0x8));}var _0x1af8d5=_0x13e800[_0x3452('0x52')][_0x3452('0x23')]({'plain':!![]});if(!_0x1af8d5)throw new Error(_0x3452('0x53'));if(_0x1af8d5[_0x3452('0x54')]===_0x3452('0x52')){var _0x1aab3e=_0x4e1289[_0x3452('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x3452('0x49')]({'where':{'name':_0x3452('0x24'),'userProfileId':_0x1af8d5['userProfileId']},'raw':!![]})['then'](function(_0xb9e6ad){if(_0xb9e6ad&&_0xb9e6ad['autoAssociation']===0x0){return db[_0x3452('0x25')][_0x3452('0x4a')]({'name':_0x1aab3e[_0x3452('0x28')],'resourceId':_0x1aab3e['id'],'type':_0xb9e6ad[_0x3452('0x28')],'sectionId':_0xb9e6ad['id']},{})['then'](function(){return _0x4e1289;});}else{return _0x4e1289;}})[_0x3452('0x45')](function(_0x58fa9e){logger[_0x3452('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58fa9e);});}return _0x4e1289;});})[_0x3452('0x22')](respondWithResult(_0x281ae2,0xc9))[_0x3452('0x45')](handleError(_0x281ae2,null));};exports['destroy']=function(_0xda32d4,_0x4f5134,_0x1c6698){var _0x5a89d7;return db[_0x3452('0x2b')][_0x3452('0x49')]({'where':{'id':_0xda32d4['params']['id']}})[_0x3452('0x22')](function(_0x3b06b5){if(_0x3b06b5){return db['sequelize'][_0x3452('0x55')](function(_0x2e8b25){return _0x3b06b5[_0x3452('0x26')]({'transaction':_0x2e8b25,'raw':!![]})[_0x3452('0x22')](function(_0x5414f0){if(_0x5414f0[_0x3452('0x4c')]){fs[_0x3452('0x56')](_0x5414f0[_0x3452('0x4c')])[_0x3452('0x57')](function(_0x1ba3fc){fs[_0x3452('0x58')](path[_0x3452('0x4d')](_0x5414f0['directory'],_0x1ba3fc));});fs[_0x3452('0x59')](_0x5414f0[_0x3452('0x4c')]);}return _0x5414f0;});})[_0x3452('0x45')](function(_0x13e5f2){throw new db[(_0x3452('0x5a'))][(_0x3452('0x5b'))](_0x13e5f2[_0x3452('0x5c')]);});}})[_0x3452('0x22')](handleEntityNotFound(_0x4f5134,null))[_0x3452('0x22')](removeEntity(_0x4f5134,null))[_0x3452('0x45')](handleError(_0x4f5134,null));};exports[_0x3452('0x5d')]=function(_0x992d76,_0x13657e,_0x337b45){return db[_0x3452('0x5e')][_0x3452('0x55')](function(_0x402c1f){var _0x40efc4;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x992d76[_0x3452('0x47')]['id']}})[_0x3452('0x22')](function(_0x307304){if(_0x307304){_0x40efc4=_0x307304;return _0x307304[_0x3452('0x5d')](_0x992d76['body']['id'],{'transaction':_0x402c1f});}})[_0x3452('0x22')](function(_0x38cabd){if(_0x38cabd){return db[_0x3452('0x5f')]['findOne']({'where':{'id':_0x992d76[_0x3452('0x48')]['id']},'attributes':['id','name',_0x3452('0x60'),_0x3452('0x61'),_0x3452('0x62')],'raw':!![]});}})[_0x3452('0x22')](function(_0x27189c){if(_0x27189c){var _0x15270a=path[_0x3452('0x4d')](config[_0x3452('0x4e')],'server/files/sounds/converted',util[_0x3452('0x63')](_0x3452('0x64'),path[_0x3452('0x65')](_0x27189c[_0x3452('0x60')],path['extname'](_0x27189c['save_name'])),_0x27189c[_0x3452('0x61')]));var _0x23937f=path[_0x3452('0x4d')](config[_0x3452('0x4e')],'server/files/moh',_0x40efc4[_0x3452('0x28')],util['format'](_0x3452('0x64'),_0x27189c[_0x3452('0x28')],_0x27189c['converted_format']));fs[_0x3452('0x66')](_0x15270a,_0x23937f);return _0x27189c;}})[_0x3452('0x45')](function(_0x2b61da){throw new db[(_0x3452('0x5a'))][(_0x3452('0x5b'))](_0x2b61da[_0x3452('0x5c')]);});})[_0x3452('0x22')](handleEntityNotFound(_0x13657e,null))[_0x3452('0x22')](respondWithResult(_0x13657e,0xc9))['catch'](handleError(_0x13657e,null));};exports[_0x3452('0x67')]=function(_0x35cc8c,_0x203a0d,_0x28acfd){return db[_0x3452('0x5e')][_0x3452('0x55')](function(_0x3e0994){var _0x5f4843;return db[_0x3452('0x2b')]['findOne']({'where':{'id':_0x35cc8c['params']['id']}})[_0x3452('0x22')](handleEntityNotFound(_0x203a0d,null))[_0x3452('0x22')](function(_0x2dbf50){if(_0x2dbf50){_0x5f4843=_0x2dbf50;return _0x2dbf50[_0x3452('0x67')](_0x35cc8c[_0x3452('0x47')][_0x3452('0x68')]);}})[_0x3452('0x22')](function(_0x505056){if(_0x505056){return db[_0x3452('0x5f')][_0x3452('0x69')]({'where':{'id':_0x35cc8c[_0x3452('0x47')][_0x3452('0x68')]},'attributes':['id','name',_0x3452('0x60'),_0x3452('0x61'),_0x3452('0x62')],'raw':!![]});}})[_0x3452('0x22')](function(_0x3461a9){if(_0x3461a9){fs['unlinkSync'](path[_0x3452('0x4d')](_0x5f4843[_0x3452('0x4c')],util[_0x3452('0x63')]('%s.%s',_0x3461a9[_0x3452('0x28')],_0x3461a9['converted_format'])));return _0x3461a9;}})[_0x3452('0x45')](function(_0x262f9a){throw new db[(_0x3452('0x5a'))]['ValidationError'](_0x262f9a[_0x3452('0x5c')]);});})[_0x3452('0x22')](handleEntityNotFound(_0x203a0d,null))[_0x3452('0x22')](respondWithStatusCode(_0x203a0d,0xcc))[_0x3452('0x45')](handleError(_0x203a0d,null));};exports[_0x3452('0x6a')]=function(_0x4dcd9d,_0x20dcf3,_0x2272bc){var _0x5118ae={};var _0x7cb8c4={};var _0x4f3544;var _0xb5178b;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4dcd9d[_0x3452('0x47')]['id']}})['then'](handleEntityNotFound(_0x20dcf3,null))[_0x3452('0x22')](function(_0xba22e2){if(_0xba22e2){_0x4f3544=_0xba22e2;_0x7cb8c4[_0x3452('0x34')]=_[_0x3452('0x30')](db[_0x3452('0x5f')][_0x3452('0x2c')]);_0x7cb8c4[_0x3452('0x2f')]=_[_0x3452('0x30')](_0x4dcd9d[_0x3452('0x2f')]);_0x7cb8c4['filters']=_[_0x3452('0x32')](_0x7cb8c4[_0x3452('0x34')],_0x7cb8c4[_0x3452('0x2f')]);_0x5118ae[_0x3452('0x33')]=_[_0x3452('0x32')](_0x7cb8c4[_0x3452('0x34')],qs[_0x3452('0x35')](_0x4dcd9d[_0x3452('0x2f')]['fields']));_0x5118ae[_0x3452('0x33')]=_0x5118ae[_0x3452('0x33')][_0x3452('0x36')]?_0x5118ae[_0x3452('0x33')]:_0x7cb8c4[_0x3452('0x34')];_0x5118ae['order']=qs['sort'](_0x4dcd9d[_0x3452('0x2f')]['sort']);_0x5118ae[_0x3452('0x3c')]=qs[_0x3452('0x31')](_[_0x3452('0x3a')](_0x4dcd9d[_0x3452('0x2f')],_0x7cb8c4[_0x3452('0x31')]));if(_0x4dcd9d['query'][_0x3452('0x3b')]){_0x5118ae[_0x3452('0x3c')]=_[_0x3452('0x3d')](_0x5118ae[_0x3452('0x3c')],{'$or':_[_0x3452('0x2a')](_0x5118ae[_0x3452('0x33')],function(_0x4d3d01){var _0x17b4db={};_0x17b4db[_0x4d3d01]={'$like':'%'+_0x4dcd9d[_0x3452('0x2f')]['filter']+'%'};return _0x17b4db;})});}_0x5118ae=_['merge']({},_0x5118ae,_0x4dcd9d[_0x3452('0x40')]);return _0x4f3544[_0x3452('0x6a')](_0x5118ae);}})['then'](function(_0x510c32){if(_0x510c32){_0xb5178b=_0x510c32[_0x3452('0x36')];if(!_0x4dcd9d[_0x3452('0x2f')][_0x3452('0x37')](_0x3452('0x38'))){_0x5118ae['limit']=qs[_0x3452('0x1e')](_0x4dcd9d[_0x3452('0x2f')][_0x3452('0x1e')]);_0x5118ae[_0x3452('0x1c')]=qs[_0x3452('0x1c')](_0x4dcd9d[_0x3452('0x2f')][_0x3452('0x1c')]);}return _0x4f3544[_0x3452('0x6a')](_0x5118ae);}})[_0x3452('0x22')](function(_0x30ba48){if(_0x30ba48){return _0x30ba48?{'count':_0xb5178b,'rows':_0x30ba48}:null;}})['then'](respondWithResult(_0x20dcf3,null))[_0x3452('0x45')](handleError(_0x20dcf3,null));}; \ No newline at end of file +var _0x94b4=['transaction','mode','root','server/files/moh','files','mkdirSync','0777','role','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','join','rmdirSync','Sequelize','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','ValidationError','message','removeSound','id2','unlinkSync','directory','order','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','create','sequelize'];(function(_0xf7eaf9,_0x3d383d){var _0x8e5c1b=function(_0x5bf433){while(--_0x5bf433){_0xf7eaf9['push'](_0xf7eaf9['shift']());}};_0x8e5c1b(++_0x3d383d);}(_0x94b4,0x185));var _0x494b=function(_0x203a37,_0x5533ba){_0x203a37=_0x203a37-0x0;var _0x37c974=_0x94b4[_0x203a37];return _0x37c974;};'use strict';var emlformat=require(_0x494b('0x0'));var rimraf=require(_0x494b('0x1'));var zipdir=require(_0x494b('0x2'));var jsonpatch=require(_0x494b('0x3'));var rp=require(_0x494b('0x4'));var moment=require(_0x494b('0x5'));var BPromise=require(_0x494b('0x6'));var Mustache=require(_0x494b('0x7'));var util=require(_0x494b('0x8'));var path=require('path');var sox=require(_0x494b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x494b('0xa'));var _=require(_0x494b('0xb'));var squel=require(_0x494b('0xc'));var crypto=require('crypto');var jsforce=require(_0x494b('0xd'));var deskjs=require(_0x494b('0xe'));var toCsv=require(_0x494b('0xf'));var querystring=require('querystring');var Papa=require(_0x494b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x494b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x494b('0x12'));var logger=require(_0x494b('0x13'))(_0x494b('0x14'));var utils=require(_0x494b('0x15'));var config=require(_0x494b('0x16'));var licenseUtil=require(_0x494b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102d9f,_0x574e95){_0x574e95=_0x574e95||0xcc;return function(_0xdb9cba){if(_0xdb9cba){return _0x102d9f[_0x494b('0x18')](_0x574e95);}return _0x102d9f[_0x494b('0x19')](_0x574e95)[_0x494b('0x1a')]();};}function respondWithResult(_0x214f15,_0x2f20f6){_0x2f20f6=_0x2f20f6||0xc8;return function(_0x5c5912){if(_0x5c5912){return _0x214f15[_0x494b('0x19')](_0x2f20f6)[_0x494b('0x1b')](_0x5c5912);}};}function respondWithFilteredResult(_0x3901ea,_0x88b493){return function(_0x23d9f9){if(_0x23d9f9){var _0x4ec112=typeof _0x88b493[_0x494b('0x1c')]===_0x494b('0x1d')&&typeof _0x88b493[_0x494b('0x1e')]===_0x494b('0x1d');var _0x24cf7e=_0x23d9f9[_0x494b('0x1f')];var _0x2697e6=_0x4ec112?0x0:_0x88b493['offset'];var _0x3b70cf=_0x4ec112?_0x23d9f9[_0x494b('0x1f')]:_0x88b493[_0x494b('0x1c')]+_0x88b493[_0x494b('0x1e')];var _0x386769;if(_0x3b70cf>=_0x24cf7e){_0x3b70cf=_0x24cf7e;_0x386769=0xc8;}else{_0x386769=0xce;}_0x3901ea[_0x494b('0x19')](_0x386769);return _0x3901ea['set'](_0x494b('0x20'),_0x2697e6+'-'+_0x3b70cf+'/'+_0x24cf7e)['json'](_0x23d9f9);}return null;};}function patchUpdates(_0x4594ef){return function(_0xcc4e67){try{jsonpatch[_0x494b('0x21')](_0xcc4e67,_0x4594ef,!![]);}catch(_0xf236ab){return BPromise[_0x494b('0x22')](_0xf236ab);}return _0xcc4e67[_0x494b('0x23')]();};}function saveUpdates(_0x1fb41d,_0x4f3056){return function(_0xb7e144){if(_0xb7e144){return _0xb7e144[_0x494b('0x24')](_0x1fb41d)['then'](function(_0x177d94){return _0x177d94;});}return null;};}function removeEntity(_0x4124d4,_0x5151d1){return function(_0x29188f){if(_0x29188f){return _0x29188f[_0x494b('0x25')]()['then'](function(){var _0x12a2be=_0x29188f[_0x494b('0x26')]({'plain':!![]});var _0x37917c='MusicOnHolds';return db[_0x494b('0x27')][_0x494b('0x25')]({'where':{'type':_0x37917c,'resourceId':_0x12a2be['id']}})[_0x494b('0x28')](function(){return _0x29188f;});})['then'](function(){_0x4124d4['status'](0xcc)[_0x494b('0x1a')]();});}};}function handleEntityNotFound(_0x16904e,_0xbdb113){return function(_0x512c89){if(!_0x512c89){_0x16904e[_0x494b('0x18')](0x194);}return _0x512c89;};}function handleError(_0x11a524,_0x583db6){_0x583db6=_0x583db6||0x1f4;return function(_0x15b242){logger[_0x494b('0x29')](_0x15b242[_0x494b('0x2a')]);if(_0x15b242[_0x494b('0x2b')]){delete _0x15b242[_0x494b('0x2b')];}_0x11a524[_0x494b('0x19')](_0x583db6)[_0x494b('0x2c')](_0x15b242);};}exports[_0x494b('0x2d')]=function(_0x1a76d2,_0x161bc4){var _0x47c8ef={},_0x55c5a9={},_0x44459e={'count':0x0,'rows':[]};var _0x1164bd=_[_0x494b('0x2e')](db[_0x494b('0x2f')][_0x494b('0x30')],function(_0xf9e724){return{'name':_0xf9e724['fieldName'],'type':_0xf9e724[_0x494b('0x31')][_0x494b('0x32')]};});_0x55c5a9['model']=_[_0x494b('0x2e')](_0x1164bd,'name');_0x55c5a9['query']=_[_0x494b('0x33')](_0x1a76d2[_0x494b('0x34')]);_0x55c5a9[_0x494b('0x35')]=_[_0x494b('0x36')](_0x55c5a9[_0x494b('0x37')],_0x55c5a9['query']);_0x47c8ef[_0x494b('0x38')]=_['intersection'](_0x55c5a9['model'],qs[_0x494b('0x39')](_0x1a76d2[_0x494b('0x34')][_0x494b('0x39')]));_0x47c8ef[_0x494b('0x38')]=_0x47c8ef[_0x494b('0x38')][_0x494b('0x3a')]?_0x47c8ef[_0x494b('0x38')]:_0x55c5a9[_0x494b('0x37')];if(!_0x1a76d2[_0x494b('0x34')][_0x494b('0x3b')](_0x494b('0x3c'))){_0x47c8ef[_0x494b('0x1e')]=qs[_0x494b('0x1e')](_0x1a76d2[_0x494b('0x34')][_0x494b('0x1e')]);_0x47c8ef[_0x494b('0x1c')]=qs[_0x494b('0x1c')](_0x1a76d2[_0x494b('0x34')][_0x494b('0x1c')]);}_0x47c8ef['order']=qs[_0x494b('0x3d')](_0x1a76d2[_0x494b('0x34')][_0x494b('0x3d')]);delete _0x1a76d2[_0x494b('0x34')][_0x494b('0x3d')];_0x47c8ef[_0x494b('0x3e')]=qs[_0x494b('0x35')](_[_0x494b('0x3f')](_0x1a76d2[_0x494b('0x34')],_0x55c5a9[_0x494b('0x35')]),_0x1164bd);if(_0x1a76d2[_0x494b('0x34')][_0x494b('0x40')]){_0x47c8ef['where']=_[_0x494b('0x41')](_0x47c8ef[_0x494b('0x3e')],{'$or':_[_0x494b('0x2e')](_0x1164bd,function(_0x2f8454){if(_0x2f8454[_0x494b('0x31')]!==_0x494b('0x42')){var _0x1dfcb1={};_0x1dfcb1[_0x2f8454['name']]={'$like':'%'+_0x1a76d2[_0x494b('0x34')]['filter']+'%'};return _0x1dfcb1;}})});}_0x47c8ef=_['merge']({},_0x47c8ef,_0x1a76d2[_0x494b('0x43')]);var _0x55732b={'where':_0x47c8ef['where']};return db['VoiceMusicOnHold']['count'](_0x55732b)[_0x494b('0x28')](function(_0x18ab28){_0x44459e['count']=_0x18ab28;if(_0x1a76d2['query']['includeAll']){_0x47c8ef[_0x494b('0x44')]=[{'all':!![]}];}return db[_0x494b('0x2f')][_0x494b('0x45')](_0x47c8ef);})[_0x494b('0x28')](function(_0x5a724a){_0x44459e[_0x494b('0x46')]=_0x5a724a;return _0x44459e;})['then'](respondWithFilteredResult(_0x161bc4,_0x47c8ef))[_0x494b('0x47')](handleError(_0x161bc4,null));};exports[_0x494b('0x48')]=function(_0xa7c760,_0x193e65){var _0x36e276={'raw':![],'where':{'id':_0xa7c760[_0x494b('0x49')]['id']}},_0x4dc3f7={};_0x4dc3f7['model']=_[_0x494b('0x33')](db['VoiceMusicOnHold'][_0x494b('0x30')]);_0x4dc3f7['query']=_[_0x494b('0x33')](_0xa7c760['query']);_0x4dc3f7['filters']=_[_0x494b('0x36')](_0x4dc3f7[_0x494b('0x37')],_0x4dc3f7[_0x494b('0x34')]);_0x36e276[_0x494b('0x38')]=_[_0x494b('0x36')](_0x4dc3f7[_0x494b('0x37')],qs[_0x494b('0x39')](_0xa7c760[_0x494b('0x34')][_0x494b('0x39')]));_0x36e276[_0x494b('0x38')]=_0x36e276['attributes'][_0x494b('0x3a')]?_0x36e276[_0x494b('0x38')]:_0x4dc3f7[_0x494b('0x37')];if(_0xa7c760[_0x494b('0x34')][_0x494b('0x4a')]){_0x36e276['include']=[{'all':!![]}];}_0x36e276=_[_0x494b('0x41')]({},_0x36e276,_0xa7c760[_0x494b('0x43')]);return db['VoiceMusicOnHold'][_0x494b('0x4b')](_0x36e276)['then'](handleEntityNotFound(_0x193e65,null))[_0x494b('0x28')](respondWithResult(_0x193e65,null))[_0x494b('0x47')](handleError(_0x193e65,null));};exports[_0x494b('0x24')]=function(_0x1c901e,_0xd99dae){if(_0x1c901e[_0x494b('0x4c')]['id']){delete _0x1c901e[_0x494b('0x4c')]['id'];}return db[_0x494b('0x2f')]['find']({'where':{'id':_0x1c901e['params']['id']}})[_0x494b('0x28')](handleEntityNotFound(_0xd99dae,null))[_0x494b('0x28')](saveUpdates(_0x1c901e['body'],null))['then'](respondWithResult(_0xd99dae,null))['catch'](handleError(_0xd99dae,null));};exports[_0x494b('0x4d')]=function(_0x142ad6,_0x553ccb,_0x3f7389){return db[_0x494b('0x4e')][_0x494b('0x4f')](function(_0x52a53d){if(_0x142ad6['body'][_0x494b('0x50')]==='files'){_0x142ad6[_0x494b('0x4c')]['directory']=path['join'](config[_0x494b('0x51')],_0x494b('0x52'),_0x142ad6['body'][_0x494b('0x2b')]);}return db[_0x494b('0x2f')][_0x494b('0x4d')](_0x142ad6['body'],{'transaction':_0x52a53d})[_0x494b('0x28')](function(_0x1ac999){if(_0x142ad6['body']['mode']===_0x494b('0x53')){fs[_0x494b('0x54')](_0x1ac999['directory'],parseInt(_0x494b('0x55'),0x8));}var _0x3ec17d=_0x142ad6['user']['get']({'plain':!![]});if(!_0x3ec17d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ec17d[_0x494b('0x56')]===_0x494b('0x57')){var _0x12fc15=_0x1ac999[_0x494b('0x26')]({'plain':!![]});return db[_0x494b('0x58')][_0x494b('0x4b')]({'where':{'name':_0x494b('0x59'),'userProfileId':_0x3ec17d[_0x494b('0x5a')]},'raw':!![]})[_0x494b('0x28')](function(_0x4db6d6){if(_0x4db6d6&&_0x4db6d6[_0x494b('0x5b')]===0x0){return db['UserProfileResource'][_0x494b('0x4d')]({'name':_0x12fc15[_0x494b('0x2b')],'resourceId':_0x12fc15['id'],'type':_0x4db6d6[_0x494b('0x2b')],'sectionId':_0x4db6d6['id']},{})[_0x494b('0x28')](function(){return _0x1ac999;});}else{return _0x1ac999;}})[_0x494b('0x47')](function(_0x3db8a8){logger[_0x494b('0x29')](_0x494b('0x5c'),_0x3db8a8);});}return _0x1ac999;});})[_0x494b('0x28')](respondWithResult(_0x553ccb,0xc9))[_0x494b('0x47')](handleError(_0x553ccb,null));};exports['destroy']=function(_0x2cf7c8,_0xaf09cd,_0x3c6ca7){var _0x5e8131;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2cf7c8[_0x494b('0x49')]['id']}})[_0x494b('0x28')](function(_0x51aed0){if(_0x51aed0){return db[_0x494b('0x4e')][_0x494b('0x4f')](function(_0x56aa34){return _0x51aed0[_0x494b('0x25')]({'transaction':_0x56aa34,'raw':!![]})[_0x494b('0x28')](function(_0x384749){if(_0x384749['directory']){fs[_0x494b('0x5d')](_0x384749['directory'])['forEach'](function(_0x1e347e){fs['unlinkSync'](path[_0x494b('0x5e')](_0x384749['directory'],_0x1e347e));});fs[_0x494b('0x5f')](_0x384749['directory']);}return _0x384749;});})[_0x494b('0x47')](function(_0x205d4e){throw new db[(_0x494b('0x60'))]['ValidationError'](_0x205d4e['message']);});}})[_0x494b('0x28')](handleEntityNotFound(_0xaf09cd,null))['then'](removeEntity(_0xaf09cd,null))[_0x494b('0x47')](handleError(_0xaf09cd,null));};exports['addSound']=function(_0x244544,_0x353a44,_0x1002ce){return db[_0x494b('0x4e')][_0x494b('0x4f')](function(_0x21c598){var _0x2d455c;return db[_0x494b('0x2f')]['find']({'where':{'id':_0x244544[_0x494b('0x49')]['id']}})[_0x494b('0x28')](function(_0x4c92e5){if(_0x4c92e5){_0x2d455c=_0x4c92e5;return _0x4c92e5[_0x494b('0x61')](_0x244544[_0x494b('0x4c')]['id'],{'transaction':_0x21c598});}})[_0x494b('0x28')](function(_0x16121d){if(_0x16121d){return db[_0x494b('0x62')][_0x494b('0x63')]({'where':{'id':_0x244544[_0x494b('0x4c')]['id']},'attributes':['id','name',_0x494b('0x64'),_0x494b('0x65'),_0x494b('0x66')],'raw':!![]});}})[_0x494b('0x28')](function(_0x3bf86d){if(_0x3bf86d){var _0x160eeb=path[_0x494b('0x5e')](config[_0x494b('0x51')],_0x494b('0x67'),util[_0x494b('0x68')](_0x494b('0x69'),path[_0x494b('0x6a')](_0x3bf86d['save_name'],path[_0x494b('0x6b')](_0x3bf86d['save_name'])),_0x3bf86d[_0x494b('0x65')]));var _0x3b234c=path['join'](config[_0x494b('0x51')],_0x494b('0x52'),_0x2d455c[_0x494b('0x2b')],util[_0x494b('0x68')](_0x494b('0x69'),_0x3bf86d[_0x494b('0x2b')],_0x3bf86d['converted_format']));fs[_0x494b('0x6c')](_0x160eeb,_0x3b234c);return _0x3bf86d;}})['catch'](function(_0x2eac06){throw new db['Sequelize'][(_0x494b('0x6d'))](_0x2eac06[_0x494b('0x6e')]);});})['then'](handleEntityNotFound(_0x353a44,null))[_0x494b('0x28')](respondWithResult(_0x353a44,0xc9))[_0x494b('0x47')](handleError(_0x353a44,null));};exports['removeSound']=function(_0x20a732,_0x37c1c6,_0x5d9122){return db[_0x494b('0x4e')][_0x494b('0x4f')](function(_0x17ad63){var _0x10c2f1;return db[_0x494b('0x2f')][_0x494b('0x63')]({'where':{'id':_0x20a732['params']['id']}})[_0x494b('0x28')](handleEntityNotFound(_0x37c1c6,null))[_0x494b('0x28')](function(_0x253c16){if(_0x253c16){_0x10c2f1=_0x253c16;return _0x253c16[_0x494b('0x6f')](_0x20a732[_0x494b('0x49')]['id2']);}})[_0x494b('0x28')](function(_0x5154b6){if(_0x5154b6){return db['Sound'][_0x494b('0x63')]({'where':{'id':_0x20a732[_0x494b('0x49')][_0x494b('0x70')]},'attributes':['id',_0x494b('0x2b'),_0x494b('0x64'),'converted_format',_0x494b('0x66')],'raw':!![]});}})[_0x494b('0x28')](function(_0x2c7ccf){if(_0x2c7ccf){fs[_0x494b('0x71')](path[_0x494b('0x5e')](_0x10c2f1[_0x494b('0x72')],util[_0x494b('0x68')](_0x494b('0x69'),_0x2c7ccf[_0x494b('0x2b')],_0x2c7ccf[_0x494b('0x65')])));return _0x2c7ccf;}})[_0x494b('0x47')](function(_0x34f537){throw new db[(_0x494b('0x60'))][(_0x494b('0x6d'))](_0x34f537['message']);});})[_0x494b('0x28')](handleEntityNotFound(_0x37c1c6,null))[_0x494b('0x28')](respondWithStatusCode(_0x37c1c6,0xcc))[_0x494b('0x47')](handleError(_0x37c1c6,null));};exports['getSounds']=function(_0x2be859,_0x2a51aa,_0x125bbb){var _0x2e7d1a={};var _0x5e6932={};var _0x399bcb;var _0x1fe887;return db[_0x494b('0x2f')][_0x494b('0x63')]({'where':{'id':_0x2be859[_0x494b('0x49')]['id']}})[_0x494b('0x28')](handleEntityNotFound(_0x2a51aa,null))[_0x494b('0x28')](function(_0x55962a){if(_0x55962a){_0x399bcb=_0x55962a;_0x5e6932[_0x494b('0x37')]=_[_0x494b('0x33')](db['Sound'][_0x494b('0x30')]);_0x5e6932['query']=_['keys'](_0x2be859[_0x494b('0x34')]);_0x5e6932[_0x494b('0x35')]=_[_0x494b('0x36')](_0x5e6932['model'],_0x5e6932[_0x494b('0x34')]);_0x2e7d1a['attributes']=_[_0x494b('0x36')](_0x5e6932[_0x494b('0x37')],qs[_0x494b('0x39')](_0x2be859[_0x494b('0x34')]['fields']));_0x2e7d1a[_0x494b('0x38')]=_0x2e7d1a['attributes'][_0x494b('0x3a')]?_0x2e7d1a['attributes']:_0x5e6932[_0x494b('0x37')];_0x2e7d1a[_0x494b('0x73')]=qs[_0x494b('0x3d')](_0x2be859[_0x494b('0x34')]['sort']);_0x2e7d1a[_0x494b('0x3e')]=qs[_0x494b('0x35')](_[_0x494b('0x3f')](_0x2be859[_0x494b('0x34')],_0x5e6932[_0x494b('0x35')]));if(_0x2be859[_0x494b('0x34')][_0x494b('0x40')]){_0x2e7d1a[_0x494b('0x3e')]=_[_0x494b('0x41')](_0x2e7d1a[_0x494b('0x3e')],{'$or':_[_0x494b('0x2e')](_0x2e7d1a['attributes'],function(_0x3113f4){var _0x35811c={};_0x35811c[_0x3113f4]={'$like':'%'+_0x2be859[_0x494b('0x34')][_0x494b('0x40')]+'%'};return _0x35811c;})});}_0x2e7d1a=_['merge']({},_0x2e7d1a,_0x2be859[_0x494b('0x43')]);return _0x399bcb[_0x494b('0x74')](_0x2e7d1a);}})['then'](function(_0x5a9941){if(_0x5a9941){_0x1fe887=_0x5a9941[_0x494b('0x3a')];if(!_0x2be859['query'][_0x494b('0x3b')](_0x494b('0x3c'))){_0x2e7d1a[_0x494b('0x1e')]=qs[_0x494b('0x1e')](_0x2be859[_0x494b('0x34')]['limit']);_0x2e7d1a[_0x494b('0x1c')]=qs[_0x494b('0x1c')](_0x2be859[_0x494b('0x34')][_0x494b('0x1c')]);}return _0x399bcb[_0x494b('0x74')](_0x2e7d1a);}})[_0x494b('0x28')](function(_0x471484){if(_0x471484){return _0x471484?{'count':_0x1fe887,'rows':_0x471484}:null;}})[_0x494b('0x28')](respondWithResult(_0x2a51aa,null))[_0x494b('0x47')](handleError(_0x2a51aa,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bd00c3f..fa91d0f 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 _0x4d2f=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','api','moment','bluebird','rimraf'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4d2f,0xd7));var _0xf4d2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d2f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf4d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf4d2('0x1'));var moment=require(_0xf4d2('0x2'));var BPromise=require(_0xf4d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf4d2('0x4'));var config=require(_0xf4d2('0x5'));var attributes=require(_0xf4d2('0x6'));module[_0xf4d2('0x7')]=function(_0x353175,_0x326674){return _0x353175[_0xf4d2('0x8')](_0xf4d2('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60bb=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x60bb,0x191));var _0xb60b=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0x60bb[_0x16b1a5];return _0x475e25;};'use strict';var _=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var logger=require(_0xb60b('0x2'))(_0xb60b('0x3'));var moment=require(_0xb60b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb60b('0x5'));var fs=require('fs');var path=require(_0xb60b('0x6'));var rimraf=require(_0xb60b('0x7'));var config=require(_0xb60b('0x8'));var attributes=require(_0xb60b('0x9'));module[_0xb60b('0xa')]=function(_0x1354ae,_0xf909e1){return _0x1354ae[_0xb60b('0xb')](_0xb60b('0xc'),attributes,{'tableName':_0xb60b('0xd'),'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 3e3be9b..ca4d389 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x479441,_0x4b642b){var _0x5ae65f=function(_0x4c3dc1){while(--_0x4c3dc1){_0x479441['push'](_0x479441['shift']());}};_0x5ae65f(++_0x4b642b);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x31e1d8,_0x2ecdeb){var _0x4ea4be=function(_0x5b535e){while(--_0x5b535e){_0x31e1d8['push'](_0x31e1d8['shift']());}};_0x4ea4be(++_0x2ecdeb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 740210c..3976dff 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 _0xab86=['put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','post','/:id/users','addTeams'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xab86,0x13e));var _0x6ab8=function(_0x41d7e3,_0x556db9){_0x41d7e3=_0x41d7e3-0x0;var _0x7d83ae=_0xab86[_0x41d7e3];return _0x7d83ae;};'use strict';var multer=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var path=require(_0x6ab8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ab8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ab8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab8('0x5'));var controller=require(_0x6ab8('0x6'));router[_0x6ab8('0x7')]('/',auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x9')]);router[_0x6ab8('0x7')](_0x6ab8('0xa'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0xb')]);router[_0x6ab8('0x7')](_0x6ab8('0xc'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0xd')]);router['get']('/:id/users',auth[_0x6ab8('0x8')](),controller['getAgents']);router[_0x6ab8('0x7')](_0x6ab8('0xe'),auth[_0x6ab8('0x8')](),controller['getTeams']);router[_0x6ab8('0xf')]('/',auth[_0x6ab8('0x8')](),controller['create']);router[_0x6ab8('0xf')](_0x6ab8('0x10'),auth[_0x6ab8('0x8')](),controller['addAgents']);router[_0x6ab8('0xf')](_0x6ab8('0xe'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x11')]);router[_0x6ab8('0x12')](_0x6ab8('0xc'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x13')]);router[_0x6ab8('0x14')]('/:id',auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x15')]);router[_0x6ab8('0x14')]('/:id/users',auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x16')]);router['delete']('/:id/teams',auth[_0x6ab8('0x8')](),controller['removeTeams']);module[_0x6ab8('0x17')]=router; \ No newline at end of file +var _0xb024=['express','Router','../../components/auth/service','../../config/environment','get','index','describe','isAuthenticated','show','/:id/users','getAgents','getTeams','create','post','addAgents','/:id/teams','put','/:id','update','destroy','removeAgents','delete','removeTeams','exports','util','path','connect-timeout'];(function(_0x44402d,_0x2e769d){var _0x13ec36=function(_0x28713e){while(--_0x28713e){_0x44402d['push'](_0x44402d['shift']());}};_0x13ec36(++_0x2e769d);}(_0xb024,0x1ad));var _0x4b02=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb024[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x4b02('0x0'));var path=require(_0x4b02('0x1'));var timeout=require(_0x4b02('0x2'));var express=require(_0x4b02('0x3'));var router=express[_0x4b02('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4b02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4b02('0x6'));var controller=require('./voicePrefix.controller');router[_0x4b02('0x7')]('/',auth['isAuthenticated'](),controller[_0x4b02('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4b02('0x9')]);router[_0x4b02('0x7')]('/:id',auth[_0x4b02('0xa')](),controller[_0x4b02('0xb')]);router[_0x4b02('0x7')](_0x4b02('0xc'),auth[_0x4b02('0xa')](),controller[_0x4b02('0xd')]);router['get']('/:id/teams',auth[_0x4b02('0xa')](),controller[_0x4b02('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b02('0xf')]);router[_0x4b02('0x10')]('/:id/users',auth[_0x4b02('0xa')](),controller[_0x4b02('0x11')]);router[_0x4b02('0x10')](_0x4b02('0x12'),auth[_0x4b02('0xa')](),controller['addTeams']);router[_0x4b02('0x13')](_0x4b02('0x14'),auth['isAuthenticated'](),controller[_0x4b02('0x15')]);router['delete'](_0x4b02('0x14'),auth[_0x4b02('0xa')](),controller[_0x4b02('0x16')]);router['delete'](_0x4b02('0xc'),auth[_0x4b02('0xa')](),controller[_0x4b02('0x17')]);router[_0x4b02('0x18')](_0x4b02('0x12'),auth[_0x4b02('0xa')](),controller[_0x4b02('0x19')]);module[_0x4b02('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index af3ff2e..282939a 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 _0xd16f=['STRING','name','VIRTUAL','system-','INTEGER','sequelize','exports'];(function(_0x87e51f,_0x2bc684){var _0x3da3eb=function(_0x10428a){while(--_0x10428a){_0x87e51f['push'](_0x87e51f['shift']());}};_0x3da3eb(++_0x2bc684);}(_0xd16f,0x178));var _0xfd16=function(_0x465a03,_0x44387d){_0x465a03=_0x465a03-0x0;var _0x27ead1=_0xd16f[_0x465a03];return _0x27ead1;};'use strict';var Sequelize=require(_0xfd16('0x0'));module[_0xfd16('0x1')]={'name':{'type':Sequelize[_0xfd16('0x2')],'allowNull':![],'unique':_0xfd16('0x3')},'prefix':{'type':Sequelize[_0xfd16('0x4')],'get':function(_0x44b473){return _0xfd16('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xfd16('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xfd16('0x6')]}}; \ No newline at end of file +var _0x6372=['STRING','name','system-','getDataValue','INTEGER','exports'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x6372,0x1df));var _0x2637=function(_0xd5cc5f,_0x32dc64){_0xd5cc5f=_0xd5cc5f-0x0;var _0x8a9a4b=_0x6372[_0xd5cc5f];return _0x8a9a4b;};'use strict';var Sequelize=require('sequelize');module[_0x2637('0x0')]={'name':{'type':Sequelize[_0x2637('0x1')],'allowNull':![],'unique':_0x2637('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x17e452){return _0x2637('0x3')+this[_0x2637('0x4')](_0x2637('0x2'))+'-';}},'description':{'type':Sequelize[_0x2637('0x1')]},'callerIdAll':{'type':Sequelize[_0x2637('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2637('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f46b2e4..c9db958 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 _0x955f=['online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','keys','find','catch','describe','sequelize','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents'];(function(_0x11afd7,_0x19b2e2){var _0x182a6f=function(_0x1dc87d){while(--_0x1dc87d){_0x11afd7['push'](_0x11afd7['shift']());}};_0x182a6f(++_0x19b2e2);}(_0x955f,0x1eb));var _0xf955=function(_0x442d94,_0x1b7607){_0x442d94=_0x442d94-0x0;var _0x273458=_0x955f[_0x442d94];return _0x273458;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];config['redis']=_[_0xf955('0x17')](config['redis'],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x1a')]));require(_0xf955('0x1b'))[_0xf955('0x1c')](socket);function respondWithStatusCode(_0x341b8c,_0x1c3235){_0x1c3235=_0x1c3235||0xcc;return function(_0x2783f2){if(_0x2783f2){return _0x341b8c[_0xf955('0x1d')](_0x1c3235);}return _0x341b8c[_0xf955('0x1e')](_0x1c3235)['end']();};}function respondWithResult(_0xc29b35,_0x54e60b){_0x54e60b=_0x54e60b||0xc8;return function(_0x3139d5){if(_0x3139d5){return _0xc29b35[_0xf955('0x1e')](_0x54e60b)[_0xf955('0x1f')](_0x3139d5);}};}function respondWithFilteredResult(_0x15c07c,_0x50930d){return function(_0x5ac6cb){if(_0x5ac6cb){var _0x1e20d1=typeof _0x50930d[_0xf955('0x20')]===_0xf955('0x21')&&typeof _0x50930d['limit']===_0xf955('0x21');var _0x3576fa=_0x5ac6cb[_0xf955('0x22')];var _0x3f960e=_0x1e20d1?0x0:_0x50930d[_0xf955('0x20')];var _0x5f4d9a=_0x1e20d1?_0x5ac6cb[_0xf955('0x22')]:_0x50930d[_0xf955('0x20')]+_0x50930d[_0xf955('0x23')];var _0x488d04;if(_0x5f4d9a>=_0x3576fa){_0x5f4d9a=_0x3576fa;_0x488d04=0xc8;}else{_0x488d04=0xce;}_0x15c07c[_0xf955('0x1e')](_0x488d04);return _0x15c07c['set'](_0xf955('0x24'),_0x3f960e+'-'+_0x5f4d9a+'/'+_0x3576fa)[_0xf955('0x1f')](_0x5ac6cb);}return null;};}function patchUpdates(_0x37143d){return function(_0xa4ebb4){try{jsonpatch[_0xf955('0x25')](_0xa4ebb4,_0x37143d,!![]);}catch(_0x565641){return BPromise[_0xf955('0x26')](_0x565641);}return _0xa4ebb4[_0xf955('0x27')]();};}function saveUpdates(_0x3585c7,_0x13a1a7){return function(_0x17dec2){if(_0x17dec2){return _0x17dec2[_0xf955('0x28')](_0x3585c7)[_0xf955('0x29')](function(_0x552cf3){return _0x552cf3;});}return null;};}function removeEntity(_0x18f435,_0x1acf33){return function(_0xba8a22){if(_0xba8a22){return _0xba8a22[_0xf955('0x2a')]()[_0xf955('0x29')](function(){var _0x13a86d=_0xba8a22[_0xf955('0x2b')]({'plain':!![]});var _0x51f3ab=_0xf955('0x2c');return db[_0xf955('0x2d')][_0xf955('0x2a')]({'where':{'type':_0x51f3ab,'resourceId':_0x13a86d['id']}})[_0xf955('0x29')](function(){return _0xba8a22;});})[_0xf955('0x29')](function(){_0x18f435[_0xf955('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2232a7,_0x1e5d37){return function(_0x4ec3e8){if(!_0x4ec3e8){_0x2232a7[_0xf955('0x1d')](0x194);}return _0x4ec3e8;};}function handleError(_0x2c8df1,_0xf3c870){_0xf3c870=_0xf3c870||0x1f4;return function(_0x1ef794){logger['error'](_0x1ef794[_0xf955('0x2e')]);if(_0x1ef794['name']){delete _0x1ef794[_0xf955('0x2f')];}_0x2c8df1[_0xf955('0x1e')](_0xf3c870)[_0xf955('0x30')](_0x1ef794);};}exports[_0xf955('0x31')]=function(_0x1e8024,_0x32121b){var _0xd5dfb0={},_0x366b6d={},_0x483a12={'count':0x0,'rows':[]};var _0x45e913=_[_0xf955('0x32')](db[_0xf955('0x33')][_0xf955('0x34')],function(_0x4fea0c){return{'name':_0x4fea0c[_0xf955('0x35')],'type':_0x4fea0c[_0xf955('0x36')][_0xf955('0x37')]};});_0x366b6d[_0xf955('0x38')]=_[_0xf955('0x32')](_0x45e913,'name');_0x366b6d['query']=_['keys'](_0x1e8024[_0xf955('0x39')]);_0x366b6d[_0xf955('0x3a')]=_[_0xf955('0x3b')](_0x366b6d[_0xf955('0x38')],_0x366b6d[_0xf955('0x39')]);_0xd5dfb0[_0xf955('0x3c')]=_['intersection'](_0x366b6d[_0xf955('0x38')],qs['fields'](_0x1e8024[_0xf955('0x39')][_0xf955('0x3d')]));_0xd5dfb0[_0xf955('0x3c')]=_0xd5dfb0['attributes'][_0xf955('0x3e')]?_0xd5dfb0['attributes']:_0x366b6d[_0xf955('0x38')];if(!_0x1e8024[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xd5dfb0['limit']=qs[_0xf955('0x23')](_0x1e8024[_0xf955('0x39')]['limit']);_0xd5dfb0[_0xf955('0x20')]=qs[_0xf955('0x20')](_0x1e8024[_0xf955('0x39')]['offset']);}_0xd5dfb0[_0xf955('0x41')]=qs[_0xf955('0x42')](_0x1e8024[_0xf955('0x39')]['sort']);_0xd5dfb0[_0xf955('0x43')]=qs[_0xf955('0x3a')](_[_0xf955('0x44')](_0x1e8024[_0xf955('0x39')],_0x366b6d[_0xf955('0x3a')]),_0x45e913);if(_0x1e8024[_0xf955('0x39')][_0xf955('0x45')]){_0xd5dfb0[_0xf955('0x43')]=_['merge'](_0xd5dfb0[_0xf955('0x43')],{'$or':_[_0xf955('0x32')](_0x45e913,function(_0x2aacdf){if(_0x2aacdf[_0xf955('0x36')]!==_0xf955('0x46')){var _0x13e57d={};_0x13e57d[_0x2aacdf[_0xf955('0x2f')]]={'$like':'%'+_0x1e8024[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x13e57d;}})});}_0xd5dfb0=_[_0xf955('0x47')]({},_0xd5dfb0,_0x1e8024[_0xf955('0x48')]);var _0x1c72b8={'where':_0xd5dfb0[_0xf955('0x43')]};return db[_0xf955('0x33')][_0xf955('0x22')](_0x1c72b8)[_0xf955('0x29')](function(_0x356ec2){_0x483a12[_0xf955('0x22')]=_0x356ec2;if(_0x1e8024[_0xf955('0x39')]['includeAll']){_0xd5dfb0[_0xf955('0x49')]=[{'all':!![]}];}return db[_0xf955('0x33')][_0xf955('0x4a')](_0xd5dfb0);})['then'](function(_0x16fc1a){_0x483a12['rows']=_0x16fc1a;return _0x483a12;})[_0xf955('0x29')](respondWithFilteredResult(_0x32121b,_0xd5dfb0))['catch'](handleError(_0x32121b,null));};exports[_0xf955('0x4b')]=function(_0x24cb74,_0x213136){var _0x21ddf0={'raw':![],'where':{'id':_0x24cb74[_0xf955('0x4c')]['id']}},_0x50b209={};_0x50b209[_0xf955('0x38')]=_[_0xf955('0x4d')](db['VoicePrefix']['rawAttributes']);_0x50b209[_0xf955('0x39')]=_[_0xf955('0x4d')](_0x24cb74[_0xf955('0x39')]);_0x50b209[_0xf955('0x3a')]=_['intersection'](_0x50b209[_0xf955('0x38')],_0x50b209[_0xf955('0x39')]);_0x21ddf0[_0xf955('0x3c')]=_['intersection'](_0x50b209[_0xf955('0x38')],qs['fields'](_0x24cb74[_0xf955('0x39')][_0xf955('0x3d')]));_0x21ddf0[_0xf955('0x3c')]=_0x21ddf0['attributes'][_0xf955('0x3e')]?_0x21ddf0[_0xf955('0x3c')]:_0x50b209[_0xf955('0x38')];if(_0x24cb74[_0xf955('0x39')]['includeAll']){_0x21ddf0[_0xf955('0x49')]=[{'all':!![]}];}_0x21ddf0=_[_0xf955('0x47')]({},_0x21ddf0,_0x24cb74[_0xf955('0x48')]);return db[_0xf955('0x33')][_0xf955('0x4e')](_0x21ddf0)['then'](handleEntityNotFound(_0x213136,null))[_0xf955('0x29')](respondWithResult(_0x213136,null))['catch'](handleError(_0x213136,null));};exports[_0xf955('0x2a')]=function(_0x5b5621,_0x38edc7){return db['VoicePrefix']['find']({'where':{'id':_0x5b5621[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](handleEntityNotFound(_0x38edc7,null))['then'](removeEntity(_0x38edc7,null))[_0xf955('0x4f')](handleError(_0x38edc7,null));};exports['describe']=function(_0x488fcd,_0x4c2977){return db['VoicePrefix'][_0xf955('0x50')]()[_0xf955('0x29')](respondWithResult(_0x4c2977,null))['catch'](handleError(_0x4c2977,null));};exports['create']=function(_0x171609,_0x17fc93){var _0x460052;return db[_0xf955('0x51')][_0xf955('0x52')](function(_0xa56483){return db[_0xf955('0x33')][_0xf955('0x53')](_0x171609[_0xf955('0x54')],{'transaction':_0xa56483})[_0xf955('0x29')](function(_0x1b7b73){_0x460052=_0x1b7b73[_0xf955('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0xf955('0x4e')]({'where':{'id':_0x460052[_0xf955('0x55')]},'raw':!![]})[_0xf955('0x29')](function(_0x24322a){return createVoicePrefixExtensions(_0x460052,_0x24322a,_0xa56483);});});})[_0xf955('0x29')](function(){var _0x4dc34b=_0x171609[_0xf955('0x56')][_0xf955('0x2b')]({'plain':!![]});if(!_0x4dc34b)throw new Error(_0xf955('0x57'));if(_0x4dc34b[_0xf955('0x58')]===_0xf955('0x56')){var _0x9057df=_0x460052;return db[_0xf955('0x59')][_0xf955('0x4e')]({'where':{'name':_0xf955('0x2c'),'userProfileId':_0x4dc34b[_0xf955('0x5a')]},'raw':!![]})['then'](function(_0x19a455){if(_0x19a455&&_0x19a455[_0xf955('0x5b')]===0x0){return db[_0xf955('0x2d')][_0xf955('0x53')]({'name':_0x9057df[_0xf955('0x2f')],'resourceId':_0x9057df['id'],'type':_0x19a455[_0xf955('0x2f')],'sectionId':_0x19a455['id']},{})[_0xf955('0x29')](function(){return _0x460052;});}else{return _0x460052;}})[_0xf955('0x4f')](function(_0x948963){logger[_0xf955('0x5c')](_0xf955('0x5d'),_0x948963);throw _0x948963;});}return _0x460052;})[_0xf955('0x29')](respondWithResult(_0x17fc93,null))['catch'](handleError(_0x17fc93,null));};function Extension(_0x1388a0,_0x452de9,_0x381cf0,_0x3eb727){this[_0xf955('0x5e')]=_0xf955('0x5f');this[_0xf955('0x60')]=_0x1388a0;this['app']=_0x381cf0;this['type']='system';this[_0xf955('0x61')]='Voice\x20Prefix\x20Extension';this['priority']=_0x452de9;this[_0xf955('0x62')]=_0x3eb727;}function createVoicePrefixExtensions(_0x533e0f,_0x10535d,_0x3fa5b5){return new BPromise(function(_0x158469,_0x30cb80){var _0x4c88ae=new Extension(formatPrefixName(_0x533e0f[_0xf955('0x63')]),0x1,_0xf955('0x64'),_0xf955('0x65'));_0x4c88ae[_0xf955('0x66')]=_0x533e0f['id'];return db[_0xf955('0x67')]['create'](_0x4c88ae,{'transaction':_0x3fa5b5})[_0xf955('0x29')](function(_0x5990d7){var _0x18905b=_0x5990d7[_0xf955('0x2b')]({'plain':!![]});var _0x3adee7=_['map'](addVoicePrefixExtensions(_0x533e0f,_0x10535d),function(_0x39aaed){_0x39aaed[_0xf955('0x55')]=_0x18905b['id'];_0x39aaed[_0xf955('0x66')]=_0x533e0f['id'];return _0x39aaed;});return db[_0xf955('0x67')][_0xf955('0x68')](_0x3adee7,{'transaction':_0x3fa5b5})[_0xf955('0x29')](function(_0x3761f2){if(!_0x3761f2){return _0x30cb80('Extensions\x20creation\x20failed');}else{return _0x158469(_0x3761f2);}})['catch'](function(_0x1bf4ac){return _0x30cb80(_0x1bf4ac);});});;});};function addVoicePrefixExtensions(_0x2d29a0,_0x3390f3){var _0x3f0873=[];var _0xab5eed=formatPrefixName(_0x2d29a0[_0xf955('0x63')]);_0x3f0873[_0xf955('0x69')](new Extension(_0xab5eed,0x2,_0xf955('0x6a'),_0xf955('0x6b')+_0x2d29a0[_0xf955('0x2f')]));if(_0x2d29a0[_0xf955('0x6c')]){_0x3f0873['push'](new Extension(_0xab5eed,0x3,_0xf955('0x6a'),'PREFIX-CALLERIDALL='+_0x2d29a0[_0xf955('0x6c')]));}else{_0x3f0873['push'](new Extension(_0xab5eed,0x3,'NoOp',_0xf955('0x6d')));}_0x3f0873[_0xf955('0x69')](new Extension(_0xab5eed,0x4,'goto',_0x3390f3[_0xf955('0x5e')]+','+_0xf955('0x6e')+(0x8+_0x2d29a0['name']['length'])+'}'+','+0x1));return _0x3f0873;}function formatPrefixName(_0x1e418){var _0xdf351a='_';for(var _0x46f0e2=0x0;_0x46f0e2<_0x1e418['length'];_0x46f0e2++){if(_0x1e418[_0xf955('0x6f')](_0x46f0e2)=='-'){_0xdf351a+=_0x1e418[_0xf955('0x6f')](_0x46f0e2);}else{_0xdf351a+='['+_0x1e418[_0xf955('0x6f')](_0x46f0e2)+']';}}_0xdf351a+='.';return _0xdf351a;}exports[_0xf955('0x28')]=function(_0x38461c,_0x2c2911,_0x260581){var _0xf1e40b=_0x38461c['body'];_0xf1e40b[_0xf955('0x63')]=_0xf955('0x70')+_0xf1e40b['name']+'-';return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x54dac){return db[_0xf955('0x33')]['update'](_0xf1e40b,{'where':{'id':_0xf1e40b['id']},'transaction':_0x54dac})[_0xf955('0x29')](function(){return db[_0xf955('0x67')]['destroy']({'where':{'VoicePrefixId':_0xf1e40b['id']},'transaction':_0x54dac})['then'](function(){return db[_0xf955('0x67')][_0xf955('0x4e')]({'where':{'id':_0xf1e40b[_0xf955('0x55')]},'raw':!![]})[_0xf955('0x29')](function(_0x4de03b){return createVoicePrefixExtensions(_0xf1e40b,_0x4de03b,_0x54dac);});});});})[_0xf955('0x29')](function(){return db[_0xf955('0x33')][_0xf955('0x71')](_0xf1e40b['id']);})[_0xf955('0x29')](respondWithResult(_0x2c2911,null))[_0xf955('0x4f')](handleError(_0x2c2911,null));};exports[_0xf955('0x72')]=function(_0x403876,_0x4635e6,_0x61b1ef){return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x403876[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](handleEntityNotFound(_0x4635e6,null))['then'](function(_0x1af54a){if(_0x1af54a){return _0x1af54a[_0xf955('0x72')](_0x403876[_0xf955('0x54')][_0xf955('0x73')],_['omit'](_0x403876[_0xf955('0x54')],[_0xf955('0x73'),'id'])||{})[_0xf955('0x74')](function(_0x8bdcf2){for(var _0x2b266d=0x0;_0x2b266d<_0x403876[_0xf955('0x54')][_0xf955('0x73')][_0xf955('0x3e')];_0x2b266d+=0x1){socket[_0xf955('0x75')](_0xf955('0x76'),{'UserId':Number(_0x403876[_0xf955('0x54')]['ids'][_0x2b266d]),'VoicePrefixId':Number(_0x403876[_0xf955('0x4c')]['id'])});}return _0x8bdcf2;});}})[_0xf955('0x29')](respondWithResult(_0x4635e6,null))[_0xf955('0x4f')](handleError(_0x4635e6,null));};exports[_0xf955('0x77')]=function(_0x33aa10,_0xaeaffb,_0x1cd55b){return db['VoicePrefix'][_0xf955('0x4e')]({'where':{'id':_0x33aa10['params']['id']}})[_0xf955('0x29')](handleEntityNotFound(_0xaeaffb,null))['then'](function(_0x1a61d9){if(_0x1a61d9){return _0x1a61d9[_0xf955('0x77')](_0x33aa10[_0xf955('0x39')][_0xf955('0x73')])[_0xf955('0x29')](function(){if(_[_0xf955('0x78')](_0x33aa10['query'][_0xf955('0x73')])){for(var _0x2b0c75=0x0;_0x2b0c75<_0x33aa10[_0xf955('0x39')]['ids']['length'];_0x2b0c75+=0x1){socket[_0xf955('0x75')](_0xf955('0x79'),{'UserId':Number(_0x33aa10[_0xf955('0x39')]['ids'][_0x2b0c75]),'VoicePrefixId':Number(_0x33aa10[_0xf955('0x4c')]['id'])});}}else{socket['emit'](_0xf955('0x79'),{'UserId':Number(_0x33aa10['query'][_0xf955('0x73')]),'VoicePrefixId':Number(_0x33aa10[_0xf955('0x4c')]['id'])});}});}})[_0xf955('0x29')](respondWithStatusCode(_0xaeaffb,null))['catch'](handleError(_0xaeaffb,null));};exports[_0xf955('0x7a')]=function(_0x397f7e,_0x2cd1bd,_0x521227){var _0xba62d0={};var _0x441a9c={};var _0x126cb5;var _0x3d796b;return db[_0xf955('0x33')][_0xf955('0x7b')]({'where':{'id':_0x397f7e[_0xf955('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2cd1bd,null))[_0xf955('0x29')](function(_0x1e0882){if(_0x1e0882){_0x126cb5=_0x1e0882;_0x441a9c[_0xf955('0x38')]=_[_0xf955('0x4d')](db[_0xf955('0x7c')]['rawAttributes']);_0x441a9c[_0xf955('0x39')]=_[_0xf955('0x4d')](_0x397f7e['query']);_0x441a9c['filters']=_[_0xf955('0x3b')](_0x441a9c[_0xf955('0x38')],_0x441a9c[_0xf955('0x39')]);_0xba62d0[_0xf955('0x3c')]=_['intersection'](_0x441a9c[_0xf955('0x38')],qs['fields'](_0x397f7e['query'][_0xf955('0x3d')]));_0xba62d0[_0xf955('0x3c')]=_0xba62d0['attributes']['length']?_0xba62d0[_0xf955('0x3c')]:_0x441a9c[_0xf955('0x38')];_0xba62d0[_0xf955('0x41')]=qs['sort'](_0x397f7e['query'][_0xf955('0x42')]);_0xba62d0[_0xf955('0x43')]=qs[_0xf955('0x3a')](_['pick'](_0x397f7e['query'],_0x441a9c['filters']));if(_0x397f7e['query'][_0xf955('0x45')]){_0xba62d0['where']=_[_0xf955('0x47')](_0xba62d0[_0xf955('0x43')],{'$or':_[_0xf955('0x32')](_0xba62d0[_0xf955('0x3c')],function(_0x325f2e){var _0x5e8f32={};_0x5e8f32[_0x325f2e]={'$like':'%'+_0x397f7e[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x5e8f32;})});}_0xba62d0=_[_0xf955('0x47')]({},_0xba62d0,_0x397f7e[_0xf955('0x48')]);return _0x126cb5['getAgents'](_0xba62d0);}})[_0xf955('0x29')](function(_0x2737c6){if(_0x2737c6){_0x3d796b=_0x2737c6['length'];if(!_0x397f7e[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xba62d0[_0xf955('0x23')]=qs[_0xf955('0x23')](_0x397f7e[_0xf955('0x39')]['limit']);_0xba62d0['offset']=qs[_0xf955('0x20')](_0x397f7e['query'][_0xf955('0x20')]);}return _0x126cb5[_0xf955('0x7a')](_0xba62d0);}})[_0xf955('0x29')](function(_0x95cc72){if(_0x95cc72){return _0x95cc72?{'count':_0x3d796b,'rows':_0x95cc72}:null;}})['then'](respondWithResult(_0x2cd1bd,null))['catch'](handleError(_0x2cd1bd,null));};exports[_0xf955('0x7d')]=function(_0x12b9f8,_0x20a220,_0x25319c){var _0xee52ad={};var _0x4b2c01={};var _0x21f45e;var _0x132c80;return db[_0xf955('0x33')][_0xf955('0x7b')]({'where':{'id':_0x12b9f8['params']['id']}})['then'](handleEntityNotFound(_0x20a220,null))[_0xf955('0x29')](function(_0x14123e){if(_0x14123e){_0x21f45e=_0x14123e;_0x4b2c01['model']=_[_0xf955('0x4d')](db[_0xf955('0x7e')][_0xf955('0x34')]);_0x4b2c01[_0xf955('0x39')]=_['keys'](_0x12b9f8[_0xf955('0x39')]);_0x4b2c01[_0xf955('0x3a')]=_[_0xf955('0x3b')](_0x4b2c01[_0xf955('0x38')],_0x4b2c01[_0xf955('0x39')]);_0xee52ad[_0xf955('0x3c')]=_[_0xf955('0x3b')](_0x4b2c01['model'],qs['fields'](_0x12b9f8['query'][_0xf955('0x3d')]));_0xee52ad[_0xf955('0x3c')]=_0xee52ad[_0xf955('0x3c')][_0xf955('0x3e')]?_0xee52ad[_0xf955('0x3c')]:_0x4b2c01[_0xf955('0x38')];_0xee52ad[_0xf955('0x41')]=qs['sort'](_0x12b9f8[_0xf955('0x39')][_0xf955('0x42')]);_0xee52ad['where']=qs[_0xf955('0x3a')](_[_0xf955('0x44')](_0x12b9f8[_0xf955('0x39')],_0x4b2c01[_0xf955('0x3a')]));if(_0x12b9f8[_0xf955('0x39')][_0xf955('0x45')]){_0xee52ad[_0xf955('0x43')]=_[_0xf955('0x47')](_0xee52ad['where'],{'$or':_['map'](_0xee52ad['attributes'],function(_0x1d3d27){var _0x3945f5={};_0x3945f5[_0x1d3d27]={'$like':'%'+_0x12b9f8[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x3945f5;})});}_0xee52ad=_[_0xf955('0x47')]({},_0xee52ad,_0x12b9f8['options']);return _0x21f45e[_0xf955('0x7d')](_0xee52ad);}})[_0xf955('0x29')](function(_0x1d2559){if(_0x1d2559){_0x132c80=_0x1d2559[_0xf955('0x3e')];if(!_0x12b9f8[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xee52ad[_0xf955('0x23')]=qs[_0xf955('0x23')](_0x12b9f8['query'][_0xf955('0x23')]);_0xee52ad['offset']=qs[_0xf955('0x20')](_0x12b9f8[_0xf955('0x39')][_0xf955('0x20')]);}return _0x21f45e[_0xf955('0x7d')](_0xee52ad);}})[_0xf955('0x29')](function(_0x187fb0){if(_0x187fb0){return _0x187fb0?{'count':_0x132c80,'rows':_0x187fb0}:null;}})[_0xf955('0x29')](respondWithResult(_0x20a220,null))['catch'](handleError(_0x20a220,null));};exports[_0xf955('0x7f')]=function(_0x4bb590,_0x222df2,_0x40d7c7){var _0x569eee=_0x4bb590[_0xf955('0x54')][_0xf955('0x73')];var _0x1d3aa1;return db[_0xf955('0x7e')][_0xf955('0x4a')]({'where':{'id':_0x569eee},'attributes':['id'],'include':[{'model':db[_0xf955('0x7c')],'as':_0xf955('0x80'),'attributes':['id','name',_0xf955('0x81'),_0xf955('0x82'),'interface'],'raw':!![]}]})[_0xf955('0x29')](function(_0x3fd8ed){if(_0x3fd8ed){_0x1d3aa1=_0x3fd8ed;var _0x4bbba6=_['flatMap'](_0x3fd8ed,function(_0x356eb0){var _0x314173=_0x356eb0[_0xf955('0x2b')]({'plain':!![]});return _0x314173['Agents'];});return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x4bb590[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](function(_0x399ffb){return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x8d0c5b){return _0x399ffb[_0xf955('0x7f')](_0x569eee,{'transaction':_0x8d0c5b})[_0xf955('0x29')](function(){return BPromise[_0xf955('0x83')](_0x1d3aa1,function(_0x41fde7){return db[_0xf955('0x84')][_0xf955('0x85')]({'TeamId':_0x41fde7['id'],'VoicePrefixId':_0x4bb590['params']['id']},{'transaction':_0x8d0c5b});});})['then'](function(){return BPromise[_0xf955('0x83')](_0x4bbba6,function(_0xc7cc7b){return db[_0xf955('0x86')][_0xf955('0x87')]({'where':{'UserId':_0xc7cc7b['id'],'VoicePrefixId':_0x4bb590[_0xf955('0x4c')]['id']},'transaction':_0x8d0c5b});});})['then'](function(){_0x4bbba6[_0xf955('0x88')](function(_0x3bab0d){socket['emit'](_0xf955('0x76'),{'UserId':_0x3bab0d['id'],'VoicePrefixId':_0x399ffb['id']});});});});});}})[_0xf955('0x29')](respondWithStatusCode(_0x222df2,null))[_0xf955('0x4f')](handleError(_0x222df2,null));};exports[_0xf955('0x89')]=function(_0x5a20d4,_0x3cc61c,_0x588a0f){return db[_0xf955('0x7e')][_0xf955('0x4a')]({'where':{'id':_0x5a20d4[_0xf955('0x39')][_0xf955('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf955('0x80'),'attributes':['id'],'raw':!![]}]})[_0xf955('0x29')](handleEntityNotFound(_0x3cc61c,null))[_0xf955('0x29')](function(_0x1c75cc){var _0x340089=_['map'](_0x1c75cc,'id');var _0x12e6aa=[];var _0x1f38db=[];var _0x395013=squel['select']();_0x395013[_0xf955('0x8a')](_0xf955('0x8b'))[_0xf955('0x8c')](_0xf955('0x8d'),'tq')[_0xf955('0x8e')](_0xf955('0x8f'),'ut',_0xf955('0x90'))['where']('VoicePrefixId\x20=\x20?',_0x5a20d4['params']['id']);for(var _0x345a7c=0x0;_0x345a7c<_0x1c75cc[_0xf955('0x3e')];_0x345a7c+=0x1){let _0x57fef3=_0x1c75cc[_0x345a7c];for(var _0x476e81=0x0;_0x476e81<_0x57fef3[_0xf955('0x80')][_0xf955('0x3e')];_0x476e81+=0x1){let _0x5397e4=_0x57fef3[_0xf955('0x80')][_0x476e81];var _0x31c26a=_0x395013['clone']();_0x31c26a['where'](_0xf955('0x91'),_0x5397e4['id']);_0x1f38db[_0xf955('0x69')](db[_0xf955('0x51')][_0xf955('0x39')](_0x31c26a[_0xf955('0x92')](),{'type':db['sequelize'][_0xf955('0x93')][_0xf955('0x94')]})[_0xf955('0x29')](function(_0x38935f){if(_0x38935f[_0xf955('0x3e')]===0x1){return _0x5397e4['id'];}else{var _0x480d95=_[_0xf955('0x95')](_[_0xf955('0x32')](_0x38935f,_0xf955('0x96')),function(_0x22cf11){return _['includes'](_0x340089,_0x22cf11);});if(_0x480d95){return _0x5397e4['id'];}}}));}}return BPromise[_0xf955('0x97')](_0x1f38db)[_0xf955('0x29')](function(_0x723d5e){_0x12e6aa=_(_0x12e6aa)[_0xf955('0x98')](_0x723d5e)[_0xf955('0x99')]()['value']();return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x5a20d4['params']['id']}})[_0xf955('0x29')](function(_0x38e078){return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x19df1c){return _0x38e078[_0xf955('0x89')](_0x5a20d4[_0xf955('0x39')][_0xf955('0x73')],{'transaction':_0x19df1c})[_0xf955('0x29')](function(){if(!_[_0xf955('0x9a')](_0x12e6aa)){return _0x38e078['removeAgents'](_0x12e6aa,{'transaction':_0x19df1c});}})['then'](function(){_0x12e6aa[_0xf955('0x88')](function(_0x161a62){socket[_0xf955('0x75')](_0xf955('0x79'),{'UserId':_0x161a62,'VoicePrefixId':_0x38e078['id']});});});});});});})['then'](respondWithStatusCode(_0x3cc61c,null))[_0xf955('0x4f')](handleError(_0x3cc61c,null));}; \ No newline at end of file +var _0xf4f4=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','User','order','findOne','Team','getTeams','addTeams','findAll','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','removeTeams','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','SELECT','includes','all','union','compact','value','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2a0fad,_0x70db4b){var _0x4fe03a=function(_0x202ac0){while(--_0x202ac0){_0x2a0fad['push'](_0x2a0fad['shift']());}};_0x4fe03a(++_0x70db4b);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5a66b7,_0x517636){_0x5a66b7=_0x5a66b7-0x0;var _0x5f56e3=_0xf4f4[_0x5a66b7];return _0x5f56e3;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];config[_0x4f4f('0x1b')]=_[_0x4f4f('0x1c')](config[_0x4f4f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4f('0x1d'))(new Redis(config['redis']));require(_0x4f4f('0x1e'))[_0x4f4f('0x1f')](socket);function respondWithStatusCode(_0x3e16e9,_0x38535d){_0x38535d=_0x38535d||0xcc;return function(_0x4c849f){if(_0x4c849f){return _0x3e16e9[_0x4f4f('0x20')](_0x38535d);}return _0x3e16e9['status'](_0x38535d)['end']();};}function respondWithResult(_0x58de77,_0x422894){_0x422894=_0x422894||0xc8;return function(_0x8d65a2){if(_0x8d65a2){return _0x58de77[_0x4f4f('0x21')](_0x422894)[_0x4f4f('0x22')](_0x8d65a2);}};}function respondWithFilteredResult(_0x2d5e5d,_0x1777eb){return function(_0x1245c4){if(_0x1245c4){var _0x60ce2=typeof _0x1777eb[_0x4f4f('0x23')]===_0x4f4f('0x24')&&typeof _0x1777eb[_0x4f4f('0x25')]===_0x4f4f('0x24');var _0x499277=_0x1245c4[_0x4f4f('0x26')];var _0x4622c2=_0x60ce2?0x0:_0x1777eb[_0x4f4f('0x23')];var _0x201c60=_0x60ce2?_0x1245c4[_0x4f4f('0x26')]:_0x1777eb[_0x4f4f('0x23')]+_0x1777eb[_0x4f4f('0x25')];var _0x3e33d5;if(_0x201c60>=_0x499277){_0x201c60=_0x499277;_0x3e33d5=0xc8;}else{_0x3e33d5=0xce;}_0x2d5e5d[_0x4f4f('0x21')](_0x3e33d5);return _0x2d5e5d[_0x4f4f('0x27')](_0x4f4f('0x28'),_0x4622c2+'-'+_0x201c60+'/'+_0x499277)[_0x4f4f('0x22')](_0x1245c4);}return null;};}function patchUpdates(_0x17984d){return function(_0xc78135){try{jsonpatch['apply'](_0xc78135,_0x17984d,!![]);}catch(_0x4f7261){return BPromise['reject'](_0x4f7261);}return _0xc78135[_0x4f4f('0x29')]();};}function saveUpdates(_0x43e661,_0x5186ac){return function(_0x3960ae){if(_0x3960ae){return _0x3960ae[_0x4f4f('0x2a')](_0x43e661)[_0x4f4f('0x2b')](function(_0x2ec92a){return _0x2ec92a;});}return null;};}function removeEntity(_0x113ff7,_0x31b30e){return function(_0xa6371b){if(_0xa6371b){return _0xa6371b['destroy']()[_0x4f4f('0x2b')](function(){var _0x237cf9=_0xa6371b[_0x4f4f('0x2c')]({'plain':!![]});var _0x15c79c=_0x4f4f('0x2d');return db['UserProfileResource'][_0x4f4f('0x2e')]({'where':{'type':_0x15c79c,'resourceId':_0x237cf9['id']}})[_0x4f4f('0x2b')](function(){return _0xa6371b;});})[_0x4f4f('0x2b')](function(){_0x113ff7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2490,_0x73b8bb){return function(_0x5b4f6a){if(!_0x5b4f6a){_0x4c2490[_0x4f4f('0x20')](0x194);}return _0x5b4f6a;};}function handleError(_0x39c1a8,_0x2e688a){_0x2e688a=_0x2e688a||0x1f4;return function(_0x5eb7c9){logger[_0x4f4f('0x2f')](_0x5eb7c9[_0x4f4f('0x30')]);if(_0x5eb7c9['name']){delete _0x5eb7c9[_0x4f4f('0x31')];}_0x39c1a8[_0x4f4f('0x21')](_0x2e688a)[_0x4f4f('0x32')](_0x5eb7c9);};}exports['index']=function(_0x6bdf15,_0x343c75){var _0x59bdb0={},_0x5517d7={},_0x465a36={'count':0x0,'rows':[]};var _0x305bf7=_[_0x4f4f('0x33')](db[_0x4f4f('0x34')][_0x4f4f('0x35')],function(_0x8d0f53){return{'name':_0x8d0f53[_0x4f4f('0x36')],'type':_0x8d0f53[_0x4f4f('0x37')][_0x4f4f('0x38')]};});_0x5517d7[_0x4f4f('0x39')]=_['map'](_0x305bf7,'name');_0x5517d7[_0x4f4f('0x3a')]=_['keys'](_0x6bdf15[_0x4f4f('0x3a')]);_0x5517d7[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],_0x5517d7[_0x4f4f('0x3a')]);_0x59bdb0[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x59bdb0[_0x4f4f('0x3d')]=_0x59bdb0['attributes'][_0x4f4f('0x3f')]?_0x59bdb0[_0x4f4f('0x3d')]:_0x5517d7[_0x4f4f('0x39')];if(!_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x59bdb0[_0x4f4f('0x25')]=qs[_0x4f4f('0x25')](_0x6bdf15[_0x4f4f('0x3a')]['limit']);_0x59bdb0[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x6bdf15[_0x4f4f('0x3a')]['offset']);}_0x59bdb0['order']=qs[_0x4f4f('0x42')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x59bdb0[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x6bdf15[_0x4f4f('0x3a')],_0x5517d7[_0x4f4f('0x3b')]),_0x305bf7);if(_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x45')]){_0x59bdb0[_0x4f4f('0x43')]=_[_0x4f4f('0x46')](_0x59bdb0['where'],{'$or':_[_0x4f4f('0x33')](_0x305bf7,function(_0x1b031e){if(_0x1b031e[_0x4f4f('0x37')]!==_0x4f4f('0x47')){var _0x18e805={};_0x18e805[_0x1b031e['name']]={'$like':'%'+_0x6bdf15['query'][_0x4f4f('0x45')]+'%'};return _0x18e805;}})});}_0x59bdb0=_[_0x4f4f('0x46')]({},_0x59bdb0,_0x6bdf15[_0x4f4f('0x48')]);var _0xa8f1a5={'where':_0x59bdb0['where']};return db[_0x4f4f('0x34')]['count'](_0xa8f1a5)[_0x4f4f('0x2b')](function(_0x5a7c94){_0x465a36['count']=_0x5a7c94;if(_0x6bdf15[_0x4f4f('0x3a')]['includeAll']){_0x59bdb0[_0x4f4f('0x49')]=[{'all':!![]}];}return db[_0x4f4f('0x34')]['findAll'](_0x59bdb0);})[_0x4f4f('0x2b')](function(_0x2d8ff6){_0x465a36['rows']=_0x2d8ff6;return _0x465a36;})[_0x4f4f('0x2b')](respondWithFilteredResult(_0x343c75,_0x59bdb0))[_0x4f4f('0x4a')](handleError(_0x343c75,null));};exports[_0x4f4f('0x4b')]=function(_0x3defd0,_0x162674){var _0x62b468={'raw':![],'where':{'id':_0x3defd0[_0x4f4f('0x4c')]['id']}},_0xb0d1b2={};_0xb0d1b2[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x34')][_0x4f4f('0x35')]);_0xb0d1b2[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x3defd0[_0x4f4f('0x3a')]);_0xb0d1b2['filters']=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],_0xb0d1b2['query']);_0x62b468[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],qs[_0x4f4f('0x3e')](_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x62b468[_0x4f4f('0x3d')]=_0x62b468[_0x4f4f('0x3d')]['length']?_0x62b468[_0x4f4f('0x3d')]:_0xb0d1b2[_0x4f4f('0x39')];if(_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x4e')]){_0x62b468[_0x4f4f('0x49')]=[{'all':!![]}];}_0x62b468=_[_0x4f4f('0x46')]({},_0x62b468,_0x3defd0[_0x4f4f('0x48')]);return db[_0x4f4f('0x34')][_0x4f4f('0x4f')](_0x62b468)['then'](handleEntityNotFound(_0x162674,null))[_0x4f4f('0x2b')](respondWithResult(_0x162674,null))[_0x4f4f('0x4a')](handleError(_0x162674,null));};exports['destroy']=function(_0x5ac4df,_0x5941ac){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x5ac4df[_0x4f4f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5941ac,null))[_0x4f4f('0x2b')](removeEntity(_0x5941ac,null))['catch'](handleError(_0x5941ac,null));};exports[_0x4f4f('0x50')]=function(_0x1c181e,_0x3c0d7b){return db[_0x4f4f('0x34')][_0x4f4f('0x50')]()[_0x4f4f('0x2b')](respondWithResult(_0x3c0d7b,null))[_0x4f4f('0x4a')](handleError(_0x3c0d7b,null));};exports[_0x4f4f('0x51')]=function(_0x17f6fb,_0x4dbce2){var _0x59e207;return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x4c04eb){return db['VoicePrefix'][_0x4f4f('0x51')](_0x17f6fb[_0x4f4f('0x54')],{'transaction':_0x4c04eb})[_0x4f4f('0x2b')](function(_0x55a5e4){_0x59e207=_0x55a5e4['get']({'plain':!![]});return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x59e207[_0x4f4f('0x56')]},'raw':!![]})[_0x4f4f('0x2b')](function(_0x37cf8e){return createVoicePrefixExtensions(_0x59e207,_0x37cf8e,_0x4c04eb);});});})[_0x4f4f('0x2b')](function(){var _0xe66fc=_0x17f6fb[_0x4f4f('0x57')][_0x4f4f('0x2c')]({'plain':!![]});if(!_0xe66fc)throw new Error(_0x4f4f('0x58'));if(_0xe66fc[_0x4f4f('0x59')]==='user'){var _0x585c06=_0x59e207;return db[_0x4f4f('0x5a')][_0x4f4f('0x4f')]({'where':{'name':_0x4f4f('0x2d'),'userProfileId':_0xe66fc[_0x4f4f('0x5b')]},'raw':!![]})['then'](function(_0x1bef77){if(_0x1bef77&&_0x1bef77['autoAssociation']===0x0){return db[_0x4f4f('0x5c')][_0x4f4f('0x51')]({'name':_0x585c06[_0x4f4f('0x31')],'resourceId':_0x585c06['id'],'type':_0x1bef77['name'],'sectionId':_0x1bef77['id']},{})[_0x4f4f('0x2b')](function(){return _0x59e207;});}else{return _0x59e207;}})[_0x4f4f('0x4a')](function(_0x23e9a9){logger['error'](_0x4f4f('0x5d'),_0x23e9a9);throw _0x23e9a9;});}return _0x59e207;})[_0x4f4f('0x2b')](respondWithResult(_0x4dbce2,null))[_0x4f4f('0x4a')](handleError(_0x4dbce2,null));};function Extension(_0x58a5dd,_0x2b01da,_0x16f162,_0x3fedae){this['context']=_0x4f4f('0x5e');this['exten']=_0x58a5dd;this[_0x4f4f('0x5f')]=_0x16f162;this[_0x4f4f('0x37')]=_0x4f4f('0x60');this[_0x4f4f('0x61')]=_0x4f4f('0x62');this[_0x4f4f('0x63')]=_0x2b01da;this[_0x4f4f('0x64')]=_0x3fedae;}function createVoicePrefixExtensions(_0xb2dfda,_0x40dffa,_0x36f369){return new BPromise(function(_0x269e0d,_0x5ba1e2){var _0x4794fe=new Extension(formatPrefixName(_0xb2dfda[_0x4f4f('0x65')]),0x1,_0x4f4f('0x66'),'Voice\x20Prefix');_0x4794fe[_0x4f4f('0x67')]=_0xb2dfda['id'];return db[_0x4f4f('0x55')][_0x4f4f('0x51')](_0x4794fe,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x561411){var _0x28f9e1=_0x561411[_0x4f4f('0x2c')]({'plain':!![]});var _0xc9a47a=_[_0x4f4f('0x33')](addVoicePrefixExtensions(_0xb2dfda,_0x40dffa),function(_0x157af6){_0x157af6['VoiceExtensionId']=_0x28f9e1['id'];_0x157af6[_0x4f4f('0x67')]=_0xb2dfda['id'];return _0x157af6;});return db['VoiceExtension'][_0x4f4f('0x68')](_0xc9a47a,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x2da4ea){if(!_0x2da4ea){return _0x5ba1e2(_0x4f4f('0x69'));}else{return _0x269e0d(_0x2da4ea);}})[_0x4f4f('0x4a')](function(_0x23366b){return _0x5ba1e2(_0x23366b);});});;});};function addVoicePrefixExtensions(_0x4bbbf6,_0x50590c){var _0x15c86f=[];var _0x4c42fd=formatPrefixName(_0x4bbbf6[_0x4f4f('0x65')]);_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x2,_0x4f4f('0x6b'),_0x4f4f('0x6c')+_0x4bbbf6[_0x4f4f('0x31')]));if(_0x4bbbf6[_0x4f4f('0x6d')]){_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,_0x4f4f('0x6b'),_0x4f4f('0x6e')+_0x4bbbf6[_0x4f4f('0x6d')]));}else{_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,'NoOp','No\x20callerid\x20available'));}_0x15c86f['push'](new Extension(_0x4c42fd,0x4,_0x4f4f('0x6f'),_0x50590c[_0x4f4f('0x70')]+','+'${EXTEN:'+(0x8+_0x4bbbf6[_0x4f4f('0x31')][_0x4f4f('0x3f')])+'}'+','+0x1));return _0x15c86f;}function formatPrefixName(_0x43d6c0){var _0x3007ff='_';for(var _0x12523f=0x0;_0x12523f<_0x43d6c0[_0x4f4f('0x3f')];_0x12523f++){if(_0x43d6c0['charAt'](_0x12523f)=='-'){_0x3007ff+=_0x43d6c0[_0x4f4f('0x71')](_0x12523f);}else{_0x3007ff+='['+_0x43d6c0[_0x4f4f('0x71')](_0x12523f)+']';}}_0x3007ff+='.';return _0x3007ff;}exports[_0x4f4f('0x2a')]=function(_0x24ed71,_0x33f4fd,_0x36299e){var _0x1d756b=_0x24ed71[_0x4f4f('0x54')];_0x1d756b['prefix']=_0x4f4f('0x72')+_0x1d756b[_0x4f4f('0x31')]+'-';return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x5f0efc){return db[_0x4f4f('0x34')]['update'](_0x1d756b,{'where':{'id':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x1d756b[_0x4f4f('0x56')]},'raw':!![]})['then'](function(_0x90813f){return createVoicePrefixExtensions(_0x1d756b,_0x90813f,_0x5f0efc);});});});})['then'](function(){return db[_0x4f4f('0x34')]['findById'](_0x1d756b['id']);})[_0x4f4f('0x2b')](respondWithResult(_0x33f4fd,null))[_0x4f4f('0x4a')](handleError(_0x33f4fd,null));};exports[_0x4f4f('0x73')]=function(_0x577fd9,_0x41c31c,_0x4b0ab5){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x577fd9[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x41c31c,null))[_0x4f4f('0x2b')](function(_0x4511c6){if(_0x4511c6){return _0x4511c6[_0x4f4f('0x73')](_0x577fd9[_0x4f4f('0x54')][_0x4f4f('0x74')],_['omit'](_0x577fd9[_0x4f4f('0x54')],[_0x4f4f('0x74'),'id'])||{})[_0x4f4f('0x75')](function(_0x14e4f3){for(var _0x42c638=0x0;_0x42c638<_0x577fd9[_0x4f4f('0x54')]['ids'][_0x4f4f('0x3f')];_0x42c638+=0x1){socket[_0x4f4f('0x76')](_0x4f4f('0x77'),{'UserId':Number(_0x577fd9[_0x4f4f('0x54')]['ids'][_0x42c638]),'VoicePrefixId':Number(_0x577fd9[_0x4f4f('0x4c')]['id'])});}return _0x14e4f3;});}})[_0x4f4f('0x2b')](respondWithResult(_0x41c31c,null))[_0x4f4f('0x4a')](handleError(_0x41c31c,null));};exports['removeAgents']=function(_0x838d05,_0x40bab8,_0x5ae1b6){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x838d05[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x40bab8,null))[_0x4f4f('0x2b')](function(_0x25cd1c){if(_0x25cd1c){return _0x25cd1c['removeAgents'](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])[_0x4f4f('0x2b')](function(){if(_[_0x4f4f('0x78')](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])){for(var _0x5b6633=0x0;_0x5b6633<_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x4f4f('0x3f')];_0x5b6633+=0x1){socket['emit'](_0x4f4f('0x79'),{'UserId':Number(_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x5b6633]),'VoicePrefixId':Number(_0x838d05[_0x4f4f('0x4c')]['id'])});}}else{socket[_0x4f4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x838d05[_0x4f4f('0x3a')]['ids']),'VoicePrefixId':Number(_0x838d05['params']['id'])});}});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x40bab8,null))[_0x4f4f('0x4a')](handleError(_0x40bab8,null));};exports[_0x4f4f('0x7a')]=function(_0x33c295,_0x762acd,_0x362c6d){var _0x1d1f5f={};var _0x19e743={};var _0x167c43;var _0x50058d;return db[_0x4f4f('0x34')]['findOne']({'where':{'id':_0x33c295[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x762acd,null))['then'](function(_0x3286b1){if(_0x3286b1){_0x167c43=_0x3286b1;_0x19e743[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7b')][_0x4f4f('0x35')]);_0x19e743[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x33c295[_0x4f4f('0x3a')]);_0x19e743['filters']=_[_0x4f4f('0x3c')](_0x19e743[_0x4f4f('0x39')],_0x19e743[_0x4f4f('0x3a')]);_0x1d1f5f['attributes']=_[_0x4f4f('0x3c')](_0x19e743['model'],qs['fields'](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x1d1f5f[_0x4f4f('0x3d')]=_0x1d1f5f[_0x4f4f('0x3d')]['length']?_0x1d1f5f[_0x4f4f('0x3d')]:_0x19e743['model'];_0x1d1f5f[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x1d1f5f[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x33c295[_0x4f4f('0x3a')],_0x19e743[_0x4f4f('0x3b')]));if(_0x33c295[_0x4f4f('0x3a')]['filter']){_0x1d1f5f['where']=_[_0x4f4f('0x46')](_0x1d1f5f[_0x4f4f('0x43')],{'$or':_[_0x4f4f('0x33')](_0x1d1f5f[_0x4f4f('0x3d')],function(_0x515d05){var _0x485129={};_0x485129[_0x515d05]={'$like':'%'+_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x45')]+'%'};return _0x485129;})});}_0x1d1f5f=_[_0x4f4f('0x46')]({},_0x1d1f5f,_0x33c295[_0x4f4f('0x48')]);return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})['then'](function(_0x10fa9e){if(_0x10fa9e){_0x50058d=_0x10fa9e[_0x4f4f('0x3f')];if(!_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x1d1f5f['limit']=qs[_0x4f4f('0x25')](_0x33c295['query']['limit']);_0x1d1f5f[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x33c295[_0x4f4f('0x3a')]['offset']);}return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})[_0x4f4f('0x2b')](function(_0x56015c){if(_0x56015c){return _0x56015c?{'count':_0x50058d,'rows':_0x56015c}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x762acd,null))[_0x4f4f('0x4a')](handleError(_0x762acd,null));};exports['getTeams']=function(_0xaa0e50,_0x23e8bd,_0x3b5214){var _0x38ea5d={};var _0x4632c0={};var _0x6ec076;var _0x56f2c5;return db[_0x4f4f('0x34')][_0x4f4f('0x7d')]({'where':{'id':_0xaa0e50[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x23e8bd,null))[_0x4f4f('0x2b')](function(_0x3d0e57){if(_0x3d0e57){_0x6ec076=_0x3d0e57;_0x4632c0[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7e')][_0x4f4f('0x35')]);_0x4632c0[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0xaa0e50[_0x4f4f('0x3a')]);_0x4632c0[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x4632c0['model'],_0x4632c0[_0x4f4f('0x3a')]);_0x38ea5d['attributes']=_[_0x4f4f('0x3c')](_0x4632c0[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0xaa0e50['query'][_0x4f4f('0x3e')]));_0x38ea5d[_0x4f4f('0x3d')]=_0x38ea5d[_0x4f4f('0x3d')][_0x4f4f('0x3f')]?_0x38ea5d[_0x4f4f('0x3d')]:_0x4632c0['model'];_0x38ea5d[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0xaa0e50[_0x4f4f('0x3a')]['sort']);_0x38ea5d[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0xaa0e50['query'],_0x4632c0[_0x4f4f('0x3b')]));if(_0xaa0e50['query'][_0x4f4f('0x45')]){_0x38ea5d['where']=_['merge'](_0x38ea5d['where'],{'$or':_['map'](_0x38ea5d['attributes'],function(_0x446cbd){var _0x2f2cb9={};_0x2f2cb9[_0x446cbd]={'$like':'%'+_0xaa0e50['query']['filter']+'%'};return _0x2f2cb9;})});}_0x38ea5d=_[_0x4f4f('0x46')]({},_0x38ea5d,_0xaa0e50[_0x4f4f('0x48')]);return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})['then'](function(_0x5ad9f6){if(_0x5ad9f6){_0x56f2c5=_0x5ad9f6['length'];if(!_0xaa0e50[_0x4f4f('0x3a')]['hasOwnProperty']('nolimit')){_0x38ea5d[_0x4f4f('0x25')]=qs['limit'](_0xaa0e50[_0x4f4f('0x3a')][_0x4f4f('0x25')]);_0x38ea5d['offset']=qs[_0x4f4f('0x23')](_0xaa0e50[_0x4f4f('0x3a')]['offset']);}return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})[_0x4f4f('0x2b')](function(_0x3be76f){if(_0x3be76f){return _0x3be76f?{'count':_0x56f2c5,'rows':_0x3be76f}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x23e8bd,null))['catch'](handleError(_0x23e8bd,null));};exports[_0x4f4f('0x80')]=function(_0x349e9c,_0x2fc478,_0x3a745a){var _0x53c962=_0x349e9c[_0x4f4f('0x54')][_0x4f4f('0x74')];var _0x27b573;return db[_0x4f4f('0x7e')][_0x4f4f('0x81')]({'where':{'id':_0x53c962},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id',_0x4f4f('0x31'),_0x4f4f('0x83'),_0x4f4f('0x84'),_0x4f4f('0x85')],'raw':!![]}]})[_0x4f4f('0x2b')](function(_0x3f87c8){if(_0x3f87c8){_0x27b573=_0x3f87c8;var _0x22e619=_['flatMap'](_0x3f87c8,function(_0x3bfc19){var _0x150474=_0x3bfc19[_0x4f4f('0x2c')]({'plain':!![]});return _0x150474[_0x4f4f('0x82')];});return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x349e9c['params']['id']}})[_0x4f4f('0x2b')](function(_0x5a4d26){return db[_0x4f4f('0x52')]['transaction'](function(_0x2d1cc1){return _0x5a4d26['addTeams'](_0x53c962,{'transaction':_0x2d1cc1})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x27b573,function(_0x2b6319){return db['TeamVoicePrefix'][_0x4f4f('0x87')]({'TeamId':_0x2b6319['id'],'VoicePrefixId':_0x349e9c[_0x4f4f('0x4c')]['id']},{'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x22e619,function(_0xbe8586){return db['UserVoicePrefix'][_0x4f4f('0x88')]({'where':{'UserId':_0xbe8586['id'],'VoicePrefixId':_0x349e9c['params']['id']},'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){_0x22e619[_0x4f4f('0x89')](function(_0x4bb547){socket['emit']('userVoicePrefix:save',{'UserId':_0x4bb547['id'],'VoicePrefixId':_0x5a4d26['id']});});});});});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2fc478,null))[_0x4f4f('0x4a')](handleError(_0x2fc478,null));};exports[_0x4f4f('0x8a')]=function(_0x4c178d,_0x2cf10a,_0x53a849){return db[_0x4f4f('0x7e')]['findAll']({'where':{'id':_0x4c178d[_0x4f4f('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id'],'raw':!![]}]})[_0x4f4f('0x2b')](handleEntityNotFound(_0x2cf10a,null))[_0x4f4f('0x2b')](function(_0x5063a6){var _0x1ce179=_[_0x4f4f('0x33')](_0x5063a6,'id');var _0x3f2b27=[];var _0x28049b=[];var _0x13418d=squel[_0x4f4f('0x8b')]();_0x13418d[_0x4f4f('0x8c')](_0x4f4f('0x8d'))[_0x4f4f('0x8e')](_0x4f4f('0x8f'),'tq')[_0x4f4f('0x90')]('user_has_teams','ut',_0x4f4f('0x91'))[_0x4f4f('0x43')](_0x4f4f('0x92'),_0x4c178d[_0x4f4f('0x4c')]['id']);for(var _0x223179=0x0;_0x223179<_0x5063a6['length'];_0x223179+=0x1){let _0x373ead=_0x5063a6[_0x223179];for(var _0x53dfb2=0x0;_0x53dfb2<_0x373ead[_0x4f4f('0x82')][_0x4f4f('0x3f')];_0x53dfb2+=0x1){let _0x3fcb64=_0x373ead[_0x4f4f('0x82')][_0x53dfb2];var _0x57405d=_0x13418d[_0x4f4f('0x93')]();_0x57405d['where'](_0x4f4f('0x94'),_0x3fcb64['id']);_0x28049b[_0x4f4f('0x6a')](db[_0x4f4f('0x52')][_0x4f4f('0x3a')](_0x57405d[_0x4f4f('0x95')](),{'type':db[_0x4f4f('0x52')][_0x4f4f('0x96')][_0x4f4f('0x97')]})[_0x4f4f('0x2b')](function(_0x3ce86c){if(_0x3ce86c['length']===0x1){return _0x3fcb64['id'];}else{var _0xe830ee=_['every'](_[_0x4f4f('0x33')](_0x3ce86c,'TeamId'),function(_0x277c96){return _[_0x4f4f('0x98')](_0x1ce179,_0x277c96);});if(_0xe830ee){return _0x3fcb64['id'];}}}));}}return BPromise[_0x4f4f('0x99')](_0x28049b)[_0x4f4f('0x2b')](function(_0x3a0382){_0x3f2b27=_(_0x3f2b27)[_0x4f4f('0x9a')](_0x3a0382)[_0x4f4f('0x9b')]()[_0x4f4f('0x9c')]();return db['VoicePrefix'][_0x4f4f('0x4f')]({'where':{'id':_0x4c178d[_0x4f4f('0x4c')]['id']}})['then'](function(_0x379a2e){return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x35e9e7){return _0x379a2e['removeTeams'](_0x4c178d[_0x4f4f('0x3a')]['ids'],{'transaction':_0x35e9e7})[_0x4f4f('0x2b')](function(){if(!_['isEmpty'](_0x3f2b27)){return _0x379a2e[_0x4f4f('0x9d')](_0x3f2b27,{'transaction':_0x35e9e7});}})['then'](function(){_0x3f2b27['forEach'](function(_0x3f2df9){socket[_0x4f4f('0x76')](_0x4f4f('0x79'),{'UserId':_0x3f2df9,'VoicePrefixId':_0x379a2e['id']});});});});});});})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2cf10a,null))['catch'](handleError(_0x2cf10a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f2db4b3..dd2a0d7 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 _0xd605=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3c152b,_0x2320dc){var _0xc863dc=function(_0x20a68c){while(--_0x20a68c){_0x3c152b['push'](_0x3c152b['shift']());}};_0xc863dc(++_0x2320dc);}(_0xd605,0x185));var _0x5d60=function(_0xe724f3,_0x471f98){_0xe724f3=_0xe724f3-0x0;var _0x101076=_0xd605[_0xe724f3];return _0x101076;};'use strict';var EventEmitter=require(_0x5d60('0x0'));var VoicePrefix=require(_0x5d60('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5d60('0x2')](0x0);var events={'afterCreate':_0x5d60('0x3'),'afterUpdate':'update','afterDestroy':_0x5d60('0x4')};function emitEvent(_0x2244ca){return function(_0x544850,_0x372f1f,_0x32334d){VoicePrefixEvents[_0x5d60('0x5')](_0x2244ca+':'+_0x544850['id'],_0x544850);VoicePrefixEvents[_0x5d60('0x5')](_0x2244ca,_0x544850);_0x32334d(null);};}for(var e in events){if(events[_0x5d60('0x6')](e)){var event=events[e];VoicePrefix[_0x5d60('0x7')](e,emitEvent(event));}}module[_0x5d60('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x4b7d=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x150314,_0x38776b){var _0x2a5cb0=function(_0x1c75dc){while(--_0x1c75dc){_0x150314['push'](_0x150314['shift']());}};_0x2a5cb0(++_0x38776b);}(_0x4b7d,0xe0));var _0xd4b7=function(_0x36b6ca,_0x47f6ff){_0x36b6ca=_0x36b6ca-0x0;var _0x15fdae=_0x4b7d[_0x36b6ca];return _0x15fdae;};'use strict';var EventEmitter=require(_0xd4b7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xd4b7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd4b7('0x2')](0x0);var events={'afterCreate':_0xd4b7('0x3'),'afterUpdate':_0xd4b7('0x4'),'afterDestroy':_0xd4b7('0x5')};function emitEvent(_0x3eb558){return function(_0x43b850,_0x4fd305,_0x3eafbe){VoicePrefixEvents[_0xd4b7('0x6')](_0x3eb558+':'+_0x43b850['id'],_0x43b850);VoicePrefixEvents[_0xd4b7('0x6')](_0x3eb558,_0x43b850);_0x3eafbe(null);};}for(var e in events){if(events[_0xd4b7('0x7')](e)){var event=events[e];VoicePrefix[_0xd4b7('0x8')](e,emitEvent(event));}}module[_0xd4b7('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 640d39a..b5acb0a 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 _0x90e2=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voicePrefix.attributes'];(function(_0x5cc296,_0xde475){var _0x1b783c=function(_0x2c6c6f){while(--_0x2c6c6f){_0x5cc296['push'](_0x5cc296['shift']());}};_0x1b783c(++_0xde475);}(_0x90e2,0x18f));var _0x290e=function(_0x5d1ddc,_0x49a427){_0x5d1ddc=_0x5d1ddc-0x0;var _0x58eadd=_0x90e2[_0x5d1ddc];return _0x58eadd;};'use strict';var _=require(_0x290e('0x0'));var util=require(_0x290e('0x1'));var logger=require(_0x290e('0x2'))('api');var moment=require(_0x290e('0x3'));var BPromise=require('bluebird');var rp=require(_0x290e('0x4'));var fs=require('fs');var path=require(_0x290e('0x5'));var rimraf=require('rimraf');var config=require(_0x290e('0x6'));var attributes=require(_0x290e('0x7'));module['exports']=function(_0x509781,_0x3bdb15){return _0x509781[_0x290e('0x8')](_0x290e('0x9'),attributes,{'tableName':_0x290e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb08e=['../../config/environment','exports','define','VoicePrefix','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x552320,_0x5902ae){var _0x3f1450=function(_0x302fb8){while(--_0x302fb8){_0x552320['push'](_0x552320['shift']());}};_0x3f1450(++_0x5902ae);}(_0xb08e,0x10c));var _0xeb08=function(_0x4e2b45,_0x2682ab){_0x4e2b45=_0x4e2b45-0x0;var _0x24c6ca=_0xb08e[_0x4e2b45];return _0x24c6ca;};'use strict';var _=require('lodash');var util=require(_0xeb08('0x0'));var logger=require(_0xeb08('0x1'))(_0xeb08('0x2'));var moment=require(_0xeb08('0x3'));var BPromise=require(_0xeb08('0x4'));var rp=require(_0xeb08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb08('0x6'));var config=require(_0xeb08('0x7'));var attributes=require('./voicePrefix.attributes');module[_0xeb08('0x8')]=function(_0x316100,_0x6c7672){return _0x316100[_0xeb08('0x9')](_0xeb08('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4a09df7..55a6c86 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 _0xa786=['stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bba5a,_0x484932){var _0x3d0ba8=function(_0x19df44){while(--_0x19df44){_0x2bba5a['push'](_0x2bba5a['shift']());}};_0x3d0ba8(++_0x484932);}(_0xa786,0x71));var _0x6a78=function(_0xa83356,_0xc1ba71){_0xa83356=_0xa83356-0x0;var _0x3e3ce5=_0xa786[_0xa83356];return _0x3e3ce5;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});config['redis']=_[_0x6a78('0xb')](config[_0x6a78('0xc')],{'host':_0x6a78('0xd'),'port':0x18eb});var socket=require(_0x6a78('0xe'))(new Redis(config[_0x6a78('0xc')]));require(_0x6a78('0xf'))[_0x6a78('0x10')](socket);function respondWithRpcPromise(_0x2364b5,_0x43e233,_0x5dd2d2){return new BPromise(function(_0x25b436,_0x1fca69){return client[_0x6a78('0x11')](_0x2364b5,_0x5dd2d2)['then'](function(_0x2a433a){logger[_0x6a78('0x12')](_0x6a78('0x13'),_0x43e233,_0x6a78('0x14'));logger[_0x6a78('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x43e233,_0x6a78('0x14'),JSON[_0x6a78('0x16')](_0x2a433a));if(_0x2a433a[_0x6a78('0x17')]){if(_0x2a433a['error'][_0x6a78('0x18')]===0x1f4){logger[_0x6a78('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);return _0x1fca69(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x2a433a['error'][_0x6a78('0x19')]);return _0x25b436(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}else{logger[_0x6a78('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,'request\x20sent');_0x25b436(_0x2a433a[_0x6a78('0x1a')]['message']);}})['catch'](function(_0x4efb20){logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x4efb20);_0x1fca69(_0x4efb20);});});} \ No newline at end of file +var _0xcd0e=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x18e9a3,_0x276495){var _0x214569=function(_0x16ba45){while(--_0x16ba45){_0x18e9a3['push'](_0x18e9a3['shift']());}};_0x214569(++_0x276495);}(_0xcd0e,0xe9));var _0xecd0=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xcd0e[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var moment=require(_0xecd0('0x2'));var BPromise=require(_0xecd0('0x3'));var rs=require(_0xecd0('0x4'));var fs=require('fs');var Redis=require(_0xecd0('0x5'));var db=require(_0xecd0('0x6'))['db'];var utils=require(_0xecd0('0x7'));var logger=require(_0xecd0('0x8'))(_0xecd0('0x9'));var config=require(_0xecd0('0xa'));var jayson=require(_0xecd0('0xb'));var client=jayson[_0xecd0('0xc')][_0xecd0('0xd')]({'port':0x232a});config[_0xecd0('0xe')]=_[_0xecd0('0xf')](config[_0xecd0('0xe')],{'host':_0xecd0('0x10'),'port':0x18eb});var socket=require(_0xecd0('0x11'))(new Redis(config['redis']));require(_0xecd0('0x12'))[_0xecd0('0x13')](socket);function respondWithRpcPromise(_0x3f4534,_0x375315,_0x2b0840){return new BPromise(function(_0x3bb95e,_0x1c047a){return client[_0xecd0('0x14')](_0x3f4534,_0x2b0840)[_0xecd0('0x15')](function(_0x5ae4b3){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x375315,_0xecd0('0x16'));logger[_0xecd0('0x17')](_0xecd0('0x18'),_0x375315,_0xecd0('0x16'),JSON[_0xecd0('0x19')](_0x5ae4b3));if(_0x5ae4b3[_0xecd0('0x1a')]){if(_0x5ae4b3['error']['code']===0x1f4){logger[_0xecd0('0x1a')](_0xecd0('0x1b'),_0x375315,_0x5ae4b3['error'][_0xecd0('0x1c')]);return _0x1c047a(_0x5ae4b3[_0xecd0('0x1a')]['message']);}logger['error'](_0xecd0('0x1b'),_0x375315,_0x5ae4b3['error'][_0xecd0('0x1c')]);return _0x3bb95e(_0x5ae4b3[_0xecd0('0x1a')]['message']);}else{logger[_0xecd0('0x1d')](_0xecd0('0x1b'),_0x375315,_0xecd0('0x16'));_0x3bb95e(_0x5ae4b3['result'][_0xecd0('0x1c')]);}})[_0xecd0('0x1e')](function(_0x13736a){logger['error'](_0xecd0('0x1b'),_0x375315,_0x13736a);_0x1c047a(_0x13736a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 912b846..8fe67c7 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 _0xd52d=['remove','emit','removeListener','register','voicePrefix:','save'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1b7977,_0x27d509){_0x1b7977=_0x1b7977-0x0;var _0x184337=_0xd52d[_0x1b7977];return _0x184337;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xdd52('0x0'),_0xdd52('0x1'),'update'];function createListener(_0x3bed6e,_0x52e3a8){return function(_0x593052){_0x52e3a8[_0xdd52('0x2')](_0x3bed6e,_0x593052);};}function removeListener(_0x211062,_0x30fb04){return function(){VoicePrefixEvents[_0xdd52('0x3')](_0x211062,_0x30fb04);};}exports[_0xdd52('0x4')]=function(_0x3b56e5){for(var _0x319c4a=0x0,_0x18d01d=events['length'];_0x319c4a<_0x18d01d;_0x319c4a++){var _0x1b8b74=events[_0x319c4a];var _0x6ab1e3=createListener(_0xdd52('0x5')+_0x1b8b74,_0x3b56e5);VoicePrefixEvents['on'](_0x1b8b74,_0x6ab1e3);}}; \ No newline at end of file +var _0x028d=['register','length','voicePrefix:','save','remove','emit'];(function(_0x7e3c03,_0x4b4866){var _0x41d368=function(_0x11547b){while(--_0x11547b){_0x7e3c03['push'](_0x7e3c03['shift']());}};_0x41d368(++_0x4b4866);}(_0x028d,0xff));var _0xd028=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0x028d[_0x52ca59];return _0x1ab7e5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd028('0x0'),_0xd028('0x1'),'update'];function createListener(_0x35e90f,_0x362847){return function(_0x157cf4){_0x362847[_0xd028('0x2')](_0x35e90f,_0x157cf4);};}function removeListener(_0x2dc43c,_0x67d150){return function(){VoicePrefixEvents['removeListener'](_0x2dc43c,_0x67d150);};}exports[_0xd028('0x3')]=function(_0x4592fd){for(var _0x20588f=0x0,_0x35b879=events[_0xd028('0x4')];_0x20588f<_0x35b879;_0x20588f++){var _0xb35f34=events[_0x20588f];var _0xab6e68=createListener(_0xd028('0x5')+_0xb35f34,_0x4592fd);VoicePrefixEvents['on'](_0xb35f34,_0xab6e68);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 67066aa..a560466 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1c816c,_0x2e0355){var _0x3ba6eb=function(_0x37f730){while(--_0x37f730){_0x1c816c['push'](_0x1c816c['shift']());}};_0x3ba6eb(++_0x2e0355);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4a39be,_0x4b1ed1){var _0x473d26=function(_0x566b49){while(--_0x566b49){_0x4a39be['push'](_0x4a39be['shift']());}};_0x473d26(++_0x4b1ed1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index aee0c71..3a05ac1 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 _0x7657=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','dialMethod','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence'];(function(_0x2159b8,_0x2621fa){var _0x342a67=function(_0x394be7){while(--_0x394be7){_0x2159b8['push'](_0x2159b8['shift']());}};_0x342a67(++_0x2621fa);}(_0x7657,0x15e));var _0x7765=function(_0x9cf8ea,_0x4b753b){_0x9cf8ea=_0x9cf8ea-0x0;var _0x41930f=_0x7657[_0x9cf8ea];return _0x41930f;};'use strict';var Sequelize=require(_0x7765('0x0'));module[_0x7765('0x1')]={'name':{'type':Sequelize[_0x7765('0x2')],'allowNull':![],'unique':_0x7765('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7765('0x4')]('inbound',_0x7765('0x5')),'allowNull':![],'defaultValue':_0x7765('0x6')},'musiconhold':{'type':Sequelize[_0x7765('0x2')],'defaultValue':_0x7765('0x7')},'announce':{'type':Sequelize[_0x7765('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7765('0x4')]('rr',_0x7765('0x8'),_0x7765('0x9'),_0x7765('0xa'),_0x7765('0xb'),'rrmemory',_0x7765('0xc'),_0x7765('0xd'),_0x7765('0xe')),'allowNull':![],'defaultValue':_0x7765('0x8'),'set':function(_0x54980d){this[_0x7765('0xf')](_0x7765('0x10'),_0x54980d?_0x54980d:_0x7765('0x11'));},'get':function(){var _0xf3c4ce=this[_0x7765('0x12')]('type');var _0x59409b=this[_0x7765('0x12')](_0x7765('0x13'));var _0x4e8767=this[_0x7765('0x12')](_0x7765('0x10'));if(_0xf3c4ce===_0x7765('0x5')){if(_0x59409b==='preview'){return null;}if(_0x59409b==='booked'&&![_0x7765('0x11'),'roundrobin'][_0x7765('0x14')](_0x4e8767)){this[_0x7765('0xf')]('strategy','rrmemory');}}return _0x4e8767;}},'servicelevel':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7765('0x15')](0xb)},'timeout':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7765('0x2')]},'weight':{'type':Sequelize[_0x7765('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no',_0x7765('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7765('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7765('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7765('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7765('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x7765('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no',_0x7765('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7765('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x7765('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7765('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7765('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7765('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7765('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7765('0x2')]},'queue_quantity1':{'type':Sequelize[_0x7765('0x2')]},'queue_quantity2':{'type':Sequelize[_0x7765('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7765('0x2')]},'queue_less_than':{'type':Sequelize[_0x7765('0x2')]},'periodic_announce':{'type':Sequelize[_0x7765('0x19')],'set':function(_0x2b8003){this[_0x7765('0xf')](_0x7765('0x1a'),_0x2b8003?_0x2b8003[_0x7765('0x1b')](','):[]);},'get':function(){return this[_0x7765('0x12')]('periodic_announce')?this[_0x7765('0x12')](_0x7765('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x7765('0x2')],'defaultValue':'yes','set':function(_0x5223cb){this[_0x7765('0xf')](_0x7765('0x1c'),_0x5223cb?_0x5223cb['join'](','):undefined);},'get':function(){return this[_0x7765('0x12')](_0x7765('0x1c'))?this[_0x7765('0x12')]('joinempty')[_0x7765('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7765('0x2')],'defaultValue':'no','set':function(_0x14c42d){this[_0x7765('0xf')]('leavewhenempty',_0x14c42d?_0x14c42d[_0x7765('0x1b')](','):undefined);},'get':function(){return this[_0x7765('0x12')](_0x7765('0x1e'))?this['getDataValue'](_0x7765('0x1e'))[_0x7765('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7765('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x7765('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7765('0x2')]},'description':{'type':Sequelize[_0x7765('0x2')]},'acw':{'type':Sequelize[_0x7765('0x1f')],'defaultValue':0x0,'set':function(_0x5170ae){this[_0x7765('0xf')](_0x7765('0x20'),_0x5170ae);if(_0x5170ae){if(this[_0x7765('0x12')](_0x7765('0x21'))<0x2){this['setDataValue'](_0x7765('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7765('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7765('0x1f')],'defaultValue':0x0,'comment':_0x7765('0x22')},'dialMethod':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x23'),_0x7765('0x24'),'power',_0x7765('0x25'),_0x7765('0x26')),'defaultValue':_0x7765('0x24'),'comment':_0x7765('0x27')},'dialLimitChannel':{'type':Sequelize[_0x7765('0x15')](0x4)[_0x7765('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7765('0x29')},'dialLimitQueue':{'type':Sequelize[_0x7765('0x15')](0x4)[_0x7765('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7765('0x2a')},'dialPowerLevel':{'type':Sequelize[_0x7765('0x2b')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x2c'),'dropRate'),'defaultValue':_0x7765('0x2d'),'comment':_0x7765('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7765('0x2b')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7765('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7765('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7765('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x30')},'dialQueueOptions':{'type':Sequelize[_0x7765('0x2')],'defaultValue':_0x7765('0x31'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x32')},'dialQueueProject':{'type':Sequelize[_0x7765('0x2')],'comment':_0x7765('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x3,'comment':_0x7765('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7765('0x37')},'dialTimezone':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7765('0x2')],'defaultValue':_0x7765('0x38')},'dialPrefix':{'type':Sequelize[_0x7765('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7765('0x4')]('always',_0x7765('0x39'),_0x7765('0x3a')),'defaultValue':_0x7765('0x3b')},'dialAMDActive':{'type':Sequelize[_0x7765('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7765('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7765('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x7765('0x15')](0x9)[_0x7765('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7765('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7765('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7765('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7765('0x15')](0x9)[_0x7765('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7765('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x7765('0x15')](0x9)[_0x7765('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7765('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7765('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7765('0x15')](0x9)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7765('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7765('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7765('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7765('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x7765('0x1f')],'defaultValue':0x0,'comment':_0x7765('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7765('0x4')](_0x7765('0x45'),_0x7765('0x46')),'defaultValue':_0x7765('0x45')},'dialQueueProject2':{'type':Sequelize[_0x7765('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7765('0x47')},'dialCutDigit':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7765('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)[_0x7765('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7765('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7765('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7765('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7765('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f800c){if(!_0x4f800c)this[_0x7765('0xf')]('mandatoryDispositionPauseId',null);this[_0x7765('0xf')](_0x7765('0x52'),_0x4f800c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7765('0x15')](0x3)[_0x7765('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7765('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x92a3=['type','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','outbound','inbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x92a3,0x9d));var _0x392a=function(_0x2befe7,_0x306e95){_0x2befe7=_0x2befe7-0x0;var _0x1aac6f=_0x92a3[_0x2befe7];return _0x1aac6f;};'use strict';var Sequelize=require(_0x392a('0x0'));module[_0x392a('0x1')]={'name':{'type':Sequelize[_0x392a('0x2')],'allowNull':![],'unique':_0x392a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x392a('0x4')),'allowNull':![],'defaultValue':_0x392a('0x5')},'musiconhold':{'type':Sequelize[_0x392a('0x2')],'defaultValue':_0x392a('0x6')},'announce':{'type':Sequelize[_0x392a('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x392a('0x7')]('rr',_0x392a('0x8'),_0x392a('0x9'),_0x392a('0xa'),_0x392a('0xb'),_0x392a('0xc'),_0x392a('0xd'),_0x392a('0xe'),'rrordered'),'allowNull':![],'defaultValue':_0x392a('0x8'),'set':function(_0x28f7ff){this[_0x392a('0xf')](_0x392a('0x10'),_0x28f7ff?_0x28f7ff:'rrmemory');},'get':function(){var _0x23a56d=this['getDataValue'](_0x392a('0x11'));var _0xc5f2a8=this[_0x392a('0x12')](_0x392a('0x13'));var _0x1ffbca=this['getDataValue'](_0x392a('0x10'));if(_0x23a56d==='outbound'){if(_0xc5f2a8===_0x392a('0x14')){return null;}if(_0xc5f2a8===_0x392a('0x15')&&![_0x392a('0xc'),_0x392a('0x16')][_0x392a('0x17')](_0x1ffbca)){this['setDataValue'](_0x392a('0x10'),_0x392a('0xc'));}}return _0x1ffbca;}},'servicelevel':{'type':Sequelize[_0x392a('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x392a('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x392a('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':_0x392a('0x19')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x392a('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x392a('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x392a('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x392a('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x392a('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':_0x392a('0x19')},'announce_holdtime':{'type':Sequelize[_0x392a('0x7')]('yes','no',_0x392a('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x392a('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x392a('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x392a('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x392a('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x392a('0x2')]},'queue_quantity1':{'type':Sequelize[_0x392a('0x2')]},'queue_quantity2':{'type':Sequelize[_0x392a('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x392a('0x2')]},'queue_less_than':{'type':Sequelize[_0x392a('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x855148){this[_0x392a('0xf')](_0x392a('0x1c'),_0x855148?_0x855148[_0x392a('0x1d')](','):[]);},'get':function(){return this[_0x392a('0x12')](_0x392a('0x1c'))?this[_0x392a('0x12')]('periodic_announce')[_0x392a('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x392a('0x19'),'set':function(_0x5887de){this[_0x392a('0xf')](_0x392a('0x1f'),_0x5887de?_0x5887de[_0x392a('0x1d')](','):undefined);},'get':function(){return this[_0x392a('0x12')](_0x392a('0x1f'))?this[_0x392a('0x12')](_0x392a('0x1f'))[_0x392a('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xbbb6c){this[_0x392a('0xf')]('leavewhenempty',_0xbbb6c?_0xbbb6c[_0x392a('0x1d')](','):undefined);},'get':function(){return this[_0x392a('0x12')](_0x392a('0x20'))?this[_0x392a('0x12')]('leavewhenempty')[_0x392a('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x392a('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x392a('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x392a('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x392a('0x2')]},'description':{'type':Sequelize[_0x392a('0x2')]},'acw':{'type':Sequelize[_0x392a('0x21')],'defaultValue':0x0,'set':function(_0x51fc2a){this[_0x392a('0xf')](_0x392a('0x22'),_0x51fc2a);if(_0x51fc2a){if(this[_0x392a('0x12')](_0x392a('0x23'))<0x2){this['setDataValue'](_0x392a('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x392a('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x392a('0x7')]('preview',_0x392a('0x24'),_0x392a('0x25'),_0x392a('0x26'),'booked'),'defaultValue':_0x392a('0x24'),'comment':_0x392a('0x27')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x392a('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x392a('0x29')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x392a('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x392a('0x2a')},'dialPowerLevel':{'type':Sequelize[_0x392a('0x2b')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x392a('0x2c')},'dialPredictiveOptimization':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x2d'),_0x392a('0x2e')),'defaultValue':_0x392a('0x2e'),'comment':_0x392a('0x2f')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x392a('0x2b')](0x2)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x392a('0x30')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x392a('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x392a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x392a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x392a('0x18')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x31')},'dialQueueOptions':{'type':Sequelize[_0x392a('0x2')],'defaultValue':_0x392a('0x32'),'comment':_0x392a('0x33')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x392a('0x2')],'comment':_0x392a('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x392a('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x36')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x37')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x392a('0x18')](0x5)[_0x392a('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x392a('0x3a')},'dialPrefix':{'type':Sequelize[_0x392a('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x392a('0x3b'),_0x392a('0x3c'),_0x392a('0x3d')),'defaultValue':_0x392a('0x3b')},'dialAMDActive':{'type':Sequelize[_0x392a('0x21')],'defaultValue':0x0,'comment':_0x392a('0x3e')},'dialAMDInitialSilence':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x392a('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x392a('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x392a('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x392a('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x392a('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x392a('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x392a('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x392a('0x18')](0x5)[_0x392a('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x392a('0x18')](0x9)[_0x392a('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x392a('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x392a('0x18')](0x5)[_0x392a('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x392a('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x392a('0x21')],'defaultValue':0x0,'comment':_0x392a('0x47')},'dialOrderByScheduledAt':{'type':Sequelize[_0x392a('0x7')](_0x392a('0x48'),_0x392a('0x49')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x392a('0x2')],'comment':_0x392a('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x392a('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x392a('0x4a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x392a('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x392a('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x392a('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x4e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x392a('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x392a('0x18')](0x5)[_0x392a('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x51')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x392a('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x392a('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x392a('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x392a('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x392a('0x18')],'allowNull':!![],'comment':_0x392a('0x54')},'mandatoryDisposition':{'type':Sequelize[_0x392a('0x21')],'defaultValue':![],'comment':_0x392a('0x55'),'set':function(_0xc8ed2a){if(!_0xc8ed2a)this[_0x392a('0xf')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x392a('0x56'),_0xc8ed2a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x392a('0x18')](0x3)[_0x392a('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x392a('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x392a('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index a4cdb5e..65e8092 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 _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x37f4ab,_0x7b2d12){var _0x28e2cc=function(_0x3eae3d){while(--_0x3eae3d){_0x37f4ab['push'](_0x37f4ab['shift']());}};_0x28e2cc(++_0x7b2d12);}(_0x55ca,0x126));var _0xa55c=function(_0x1fe8b9,_0xd87696){_0x1fe8b9=_0x1fe8b9-0x0;var _0x25d006=_0x55ca[_0x1fe8b9];return _0x25d006;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x1b17c2,_0x5c3103){var _0x25d8b4=function(_0x537dea){while(--_0x537dea){_0x1b17c2['push'](_0x1b17c2['shift']());}};_0x25d8b4(++_0x5c3103);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1875c55..bc5c1ad 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 _0x7e7e=['emit','hook','../../mysqldb','VoiceQueue','setMaxListeners','update','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7e7e,0x167));var _0xe7e7=function(_0x3f2ae7,_0x3f6e2f){_0x3f2ae7=_0x3f2ae7-0x0;var _0x4160ed=_0x7e7e[_0x3f2ae7];return _0x4160ed;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe7e7('0x0'))['db'][_0xe7e7('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe7e7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7e7('0x3'),'afterDestroy':_0xe7e7('0x4')};function emitEvent(_0x193fab){return function(_0x5a2320,_0x47a68b,_0x190d80){VoiceQueueEvents[_0xe7e7('0x5')](_0x193fab+':'+_0x5a2320['id'],_0x5a2320);VoiceQueueEvents[_0xe7e7('0x5')](_0x193fab,_0x5a2320);_0x190d80(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe7e7('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xdf87=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x4d6e78,_0x321bf3){var _0x137f67=function(_0x5e8b4d){while(--_0x5e8b4d){_0x4d6e78['push'](_0x4d6e78['shift']());}};_0x137f67(++_0x321bf3);}(_0xdf87,0x128));var _0x7df8=function(_0x219e67,_0xfd87){_0x219e67=_0x219e67-0x0;var _0x528645=_0xdf87[_0x219e67];return _0x528645;};'use strict';var EventEmitter=require(_0x7df8('0x0'));var VoiceQueue=require(_0x7df8('0x1'))['db'][_0x7df8('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7df8('0x3')](0x0);var events={'afterCreate':_0x7df8('0x4'),'afterUpdate':_0x7df8('0x5'),'afterDestroy':_0x7df8('0x6')};function emitEvent(_0x1ef05f){return function(_0x70c80b,_0x48efaa,_0x117bbb){VoiceQueueEvents['emit'](_0x1ef05f+':'+_0x70c80b['id'],_0x70c80b);VoiceQueueEvents[_0x7df8('0x7')](_0x1ef05f,_0x70c80b);_0x117bbb(null);};}for(var e in events){if(events[_0x7df8('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9ca681e..56a7db8 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x55ca,0x126));var _0xa55c=function(_0x1f91f1,_0xdbc1a1){_0x1f91f1=_0x1f91f1-0x0;var _0x1df196=_0x55ca[_0x1f91f1];return _0x1df196;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x14cd72,_0xb9042){var _0x1a2062=function(_0x2be2d2){while(--_0x2be2d2){_0x14cd72['push'](_0x14cd72['shift']());}};_0x1a2062(++_0xb9042);}(_0xedd9,0xfc));var _0x9edd=function(_0x475544,_0xe13fc2){_0x475544=_0x475544-0x0;var _0x414197=_0xedd9[_0x475544];return _0x414197;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bad60a3..4cbc5c0 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 _0x82ea=['map','model','catch','ShowVoiceQueue','find','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x82ea,0x1e6));var _0xa82e=function(_0x191ed6,_0x5684d9){_0x191ed6=_0x191ed6-0x0;var _0x33f412=_0x82ea[_0x191ed6];return _0x33f412;};'use strict';var _=require(_0xa82e('0x0'));var util=require(_0xa82e('0x1'));var moment=require('moment');var BPromise=require(_0xa82e('0x2'));var rs=require(_0xa82e('0x3'));var fs=require('fs');var Redis=require(_0xa82e('0x4'));var db=require(_0xa82e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa82e('0x6'))(_0xa82e('0x7'));var config=require(_0xa82e('0x8'));var jayson=require(_0xa82e('0x9'));var client=jayson[_0xa82e('0xa')][_0xa82e('0xb')]({'port':0x232a});config['redis']=_[_0xa82e('0xc')](config[_0xa82e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa82e('0xe'))(new Redis(config['redis']));require(_0xa82e('0xf'))[_0xa82e('0x10')](socket);function respondWithRpcPromise(_0x5da48b,_0x28db00,_0x5d9835){return new BPromise(function(_0x7405b2,_0x56ca35){return client['request'](_0x5da48b,_0x5d9835)[_0xa82e('0x11')](function(_0x137b3d){logger['info'](_0xa82e('0x12'),_0x28db00,_0xa82e('0x13'));logger[_0xa82e('0x14')](_0xa82e('0x15'),_0x28db00,'request\x20sent',JSON[_0xa82e('0x16')](_0x137b3d));if(_0x137b3d[_0xa82e('0x17')]){if(_0x137b3d[_0xa82e('0x17')]['code']===0x1f4){logger[_0xa82e('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x28db00,_0x137b3d['error'][_0xa82e('0x18')]);return _0x56ca35(_0x137b3d[_0xa82e('0x17')][_0xa82e('0x18')]);}logger['error'](_0xa82e('0x12'),_0x28db00,_0x137b3d[_0xa82e('0x17')][_0xa82e('0x18')]);return _0x7405b2(_0x137b3d['error'][_0xa82e('0x18')]);}else{logger['info'](_0xa82e('0x12'),_0x28db00,'request\x20sent');_0x7405b2(_0x137b3d[_0xa82e('0x19')][_0xa82e('0x18')]);}})['catch'](function(_0x5ef28b){logger[_0xa82e('0x17')](_0xa82e('0x12'),_0x28db00,_0x5ef28b);_0x56ca35(_0x5ef28b);});});}exports[_0xa82e('0x1a')]=function(_0x2747e0){var _0x103ed3=this;return new Promise(function(_0x2ca000,_0x5144be){return db[_0xa82e('0x1b')][_0xa82e('0x1c')]({'raw':_0x2747e0[_0xa82e('0x1d')]?_0x2747e0[_0xa82e('0x1d')][_0xa82e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2747e0[_0xa82e('0x1d')]?_0x2747e0[_0xa82e('0x1d')][_0xa82e('0x1f')]||null:null,'attributes':_0x2747e0['options']?_0x2747e0[_0xa82e('0x1d')][_0xa82e('0x20')]||null:null,'limit':_0x2747e0[_0xa82e('0x1d')]?_0x2747e0[_0xa82e('0x1d')]['limit']||null:null,'include':_0x2747e0[_0xa82e('0x1d')]?_0x2747e0[_0xa82e('0x1d')][_0xa82e('0x21')]?_[_0xa82e('0x22')](_0x2747e0['options'][_0xa82e('0x21')],function(_0x4d50e6){return{'model':db[_0x4d50e6[_0xa82e('0x23')]],'as':_0x4d50e6['as'],'attributes':_0x4d50e6[_0xa82e('0x20')],'include':_0x4d50e6[_0xa82e('0x21')]?_[_0xa82e('0x22')](_0x4d50e6['include'],function(_0x24c48a){return{'model':db[_0x24c48a[_0xa82e('0x23')]],'as':_0x24c48a['as'],'attributes':_0x24c48a[_0xa82e('0x20')],'include':_0x24c48a[_0xa82e('0x21')]?_[_0xa82e('0x22')](_0x24c48a[_0xa82e('0x21')],function(_0xf06f87){return{'model':db[_0xf06f87[_0xa82e('0x23')]],'as':_0xf06f87['as'],'attributes':_0xf06f87['attributes']};}):[]};}):[]};}):[]:[]})[_0xa82e('0x11')](function(_0x1bc1c9){logger['info'](_0xa82e('0x1a'),_0x2747e0);logger[_0xa82e('0x14')]('GetVoiceQueue',_0x2747e0,JSON[_0xa82e('0x16')](_0x1bc1c9));_0x2ca000(_0x1bc1c9);})[_0xa82e('0x24')](function(_0x2d2f70){logger[_0xa82e('0x17')](_0xa82e('0x1a'),_0x2d2f70[_0xa82e('0x18')],_0x2747e0);_0x5144be(_0x103ed3['error'](0x1f4,_0x2d2f70[_0xa82e('0x18')]));});});};exports[_0xa82e('0x25')]=function(_0x236ec5){var _0x1beddf=this;return new Promise(function(_0x2f89de,_0x376811){return db[_0xa82e('0x1b')][_0xa82e('0x26')]({'raw':_0x236ec5['options']?_0x236ec5[_0xa82e('0x1d')][_0xa82e('0x1e')]===undefined?!![]:![]:!![],'where':_0x236ec5[_0xa82e('0x1d')]?_0x236ec5[_0xa82e('0x1d')][_0xa82e('0x1f')]||null:null,'attributes':_0x236ec5['options']?_0x236ec5['options'][_0xa82e('0x20')]||null:null,'include':_0x236ec5[_0xa82e('0x1d')]?_0x236ec5[_0xa82e('0x1d')]['include']?_[_0xa82e('0x22')](_0x236ec5['options'][_0xa82e('0x21')],function(_0x5b5547){return{'model':db[_0x5b5547['model']],'as':_0x5b5547['as'],'attributes':_0x5b5547[_0xa82e('0x20')],'include':_0x5b5547[_0xa82e('0x21')]?_[_0xa82e('0x22')](_0x5b5547[_0xa82e('0x21')],function(_0x1f59fb){return{'model':db[_0x1f59fb[_0xa82e('0x23')]],'as':_0x1f59fb['as'],'attributes':_0x1f59fb['attributes'],'include':_0x1f59fb[_0xa82e('0x21')]?_[_0xa82e('0x22')](_0x1f59fb[_0xa82e('0x21')],function(_0x4865d6){return{'model':db[_0x4865d6[_0xa82e('0x23')]],'as':_0x4865d6['as'],'attributes':_0x4865d6[_0xa82e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa82e('0x11')](function(_0x425b88){logger[_0xa82e('0x27')](_0xa82e('0x25'),_0x236ec5);logger[_0xa82e('0x14')](_0xa82e('0x25'),_0x236ec5,JSON[_0xa82e('0x16')](_0x425b88));_0x2f89de(_0x425b88);})[_0xa82e('0x24')](function(_0x343c58){logger[_0xa82e('0x17')](_0xa82e('0x25'),_0x343c58[_0xa82e('0x18')],_0x236ec5);_0x376811(_0x1beddf[_0xa82e('0x17')](0x1f4,_0x343c58[_0xa82e('0x18')]));});});}; \ No newline at end of file +var _0x8acf=['info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','map','include','model','ShowVoiceQueue','find','where','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then'];(function(_0x14aa81,_0x1a81d4){var _0x1f887c=function(_0x1ac36b){while(--_0x1ac36b){_0x14aa81['push'](_0x14aa81['shift']());}};_0x1f887c(++_0x1a81d4);}(_0x8acf,0x136));var _0xf8ac=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x8acf[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0xf8ac('0x0'));var util=require(_0xf8ac('0x1'));var moment=require(_0xf8ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8ac('0x3'));var fs=require('fs');var Redis=require(_0xf8ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8ac('0x5'));var logger=require(_0xf8ac('0x6'))('rpc');var config=require(_0xf8ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf8ac('0x8')][_0xf8ac('0x9')]({'port':0x232a});config[_0xf8ac('0xa')]=_[_0xf8ac('0xb')](config[_0xf8ac('0xa')],{'host':_0xf8ac('0xc'),'port':0x18eb});var socket=require(_0xf8ac('0xd'))(new Redis(config[_0xf8ac('0xa')]));require(_0xf8ac('0xe'))[_0xf8ac('0xf')](socket);function respondWithRpcPromise(_0x247607,_0x54fab4,_0x366fdf){return new BPromise(function(_0x258d9c,_0x55121c){return client[_0xf8ac('0x10')](_0x247607,_0x366fdf)[_0xf8ac('0x11')](function(_0x5e04df){logger[_0xf8ac('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x54fab4,_0xf8ac('0x13'));logger[_0xf8ac('0x14')](_0xf8ac('0x15'),_0x54fab4,'request\x20sent',JSON['stringify'](_0x5e04df));if(_0x5e04df[_0xf8ac('0x16')]){if(_0x5e04df[_0xf8ac('0x16')][_0xf8ac('0x17')]===0x1f4){logger[_0xf8ac('0x16')](_0xf8ac('0x18'),_0x54fab4,_0x5e04df[_0xf8ac('0x16')]['message']);return _0x55121c(_0x5e04df[_0xf8ac('0x16')][_0xf8ac('0x19')]);}logger['error'](_0xf8ac('0x18'),_0x54fab4,_0x5e04df[_0xf8ac('0x16')]['message']);return _0x258d9c(_0x5e04df['error']['message']);}else{logger[_0xf8ac('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x54fab4,_0xf8ac('0x13'));_0x258d9c(_0x5e04df[_0xf8ac('0x1a')]['message']);}})[_0xf8ac('0x1b')](function(_0x15a235){logger[_0xf8ac('0x16')](_0xf8ac('0x18'),_0x54fab4,_0x15a235);_0x55121c(_0x15a235);});});}exports[_0xf8ac('0x1c')]=function(_0x3a2043){var _0x33c038=this;return new Promise(function(_0x3b981d,_0x5412d0){return db[_0xf8ac('0x1d')][_0xf8ac('0x1e')]({'raw':_0x3a2043[_0xf8ac('0x1f')]?_0x3a2043[_0xf8ac('0x1f')][_0xf8ac('0x20')]===undefined?!![]:![]:!![],'where':_0x3a2043['options']?_0x3a2043['options']['where']||null:null,'attributes':_0x3a2043['options']?_0x3a2043['options'][_0xf8ac('0x21')]||null:null,'limit':_0x3a2043[_0xf8ac('0x1f')]?_0x3a2043[_0xf8ac('0x1f')]['limit']||null:null,'include':_0x3a2043[_0xf8ac('0x1f')]?_0x3a2043[_0xf8ac('0x1f')]['include']?_[_0xf8ac('0x22')](_0x3a2043['options'][_0xf8ac('0x23')],function(_0x543105){return{'model':db[_0x543105[_0xf8ac('0x24')]],'as':_0x543105['as'],'attributes':_0x543105[_0xf8ac('0x21')],'include':_0x543105[_0xf8ac('0x23')]?_[_0xf8ac('0x22')](_0x543105[_0xf8ac('0x23')],function(_0x4dd6cc){return{'model':db[_0x4dd6cc['model']],'as':_0x4dd6cc['as'],'attributes':_0x4dd6cc['attributes'],'include':_0x4dd6cc[_0xf8ac('0x23')]?_[_0xf8ac('0x22')](_0x4dd6cc[_0xf8ac('0x23')],function(_0x5cf9aa){return{'model':db[_0x5cf9aa[_0xf8ac('0x24')]],'as':_0x5cf9aa['as'],'attributes':_0x5cf9aa[_0xf8ac('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf8ac('0x11')](function(_0x6f2a23){logger['info'](_0xf8ac('0x1c'),_0x3a2043);logger[_0xf8ac('0x14')](_0xf8ac('0x1c'),_0x3a2043,JSON['stringify'](_0x6f2a23));_0x3b981d(_0x6f2a23);})[_0xf8ac('0x1b')](function(_0x1baad2){logger[_0xf8ac('0x16')](_0xf8ac('0x1c'),_0x1baad2[_0xf8ac('0x19')],_0x3a2043);_0x5412d0(_0x33c038['error'](0x1f4,_0x1baad2[_0xf8ac('0x19')]));});});};exports[_0xf8ac('0x25')]=function(_0x1b5712){var _0xbfe0f6=this;return new Promise(function(_0x1ae813,_0x5e4cdc){return db[_0xf8ac('0x1d')][_0xf8ac('0x26')]({'raw':_0x1b5712[_0xf8ac('0x1f')]?_0x1b5712[_0xf8ac('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1b5712[_0xf8ac('0x1f')]?_0x1b5712['options'][_0xf8ac('0x27')]||null:null,'attributes':_0x1b5712['options']?_0x1b5712[_0xf8ac('0x1f')][_0xf8ac('0x21')]||null:null,'include':_0x1b5712[_0xf8ac('0x1f')]?_0x1b5712[_0xf8ac('0x1f')][_0xf8ac('0x23')]?_['map'](_0x1b5712['options']['include'],function(_0x345e4d){return{'model':db[_0x345e4d[_0xf8ac('0x24')]],'as':_0x345e4d['as'],'attributes':_0x345e4d[_0xf8ac('0x21')],'include':_0x345e4d[_0xf8ac('0x23')]?_['map'](_0x345e4d['include'],function(_0xddb0dd){return{'model':db[_0xddb0dd[_0xf8ac('0x24')]],'as':_0xddb0dd['as'],'attributes':_0xddb0dd[_0xf8ac('0x21')],'include':_0xddb0dd['include']?_[_0xf8ac('0x22')](_0xddb0dd['include'],function(_0x17c3b9){return{'model':db[_0x17c3b9[_0xf8ac('0x24')]],'as':_0x17c3b9['as'],'attributes':_0x17c3b9[_0xf8ac('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf8ac('0x11')](function(_0x480a52){logger['info'](_0xf8ac('0x25'),_0x1b5712);logger[_0xf8ac('0x14')](_0xf8ac('0x25'),_0x1b5712,JSON[_0xf8ac('0x28')](_0x480a52));_0x1ae813(_0x480a52);})[_0xf8ac('0x1b')](function(_0x48150d){logger[_0xf8ac('0x16')]('ShowVoiceQueue',_0x48150d[_0xf8ac('0x19')],_0x1b5712);_0x5e4cdc(_0xbfe0f6[_0xf8ac('0x16')](0x1f4,_0x48150d[_0xf8ac('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0fb39cd..9264623 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 _0x8889=['save','remove','update','emit','voiceQueue:','./voiceQueue.events'];(function(_0x3e74d4,_0xfeb53){var _0x38adee=function(_0x563c28){while(--_0x563c28){_0x3e74d4['push'](_0x3e74d4['shift']());}};_0x38adee(++_0xfeb53);}(_0x8889,0x197));var _0x9888=function(_0x4309d0,_0x36b3b9){_0x4309d0=_0x4309d0-0x0;var _0x574ae3=_0x8889[_0x4309d0];return _0x574ae3;};'use strict';var VoiceQueueEvents=require(_0x9888('0x0'));var events=[_0x9888('0x1'),_0x9888('0x2'),_0x9888('0x3')];function createListener(_0x48dbc5,_0x520e26){return function(_0x4b3247){_0x520e26[_0x9888('0x4')](_0x48dbc5,_0x4b3247);};}function removeListener(_0x414ad7,_0x494dc2){return function(){VoiceQueueEvents['removeListener'](_0x414ad7,_0x494dc2);};}exports['register']=function(_0x5a88c2){for(var _0x31d9e0=0x0,_0x1ee119=events['length'];_0x31d9e0<_0x1ee119;_0x31d9e0++){var _0x585e35=events[_0x31d9e0];var _0x4d1a33=createListener(_0x9888('0x5')+_0x585e35,_0x5a88c2);VoiceQueueEvents['on'](_0x585e35,_0x4d1a33);}}; \ No newline at end of file +var _0x3a43=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x4583d0,_0x24551f){var _0x7b3c5a=function(_0x14946a){while(--_0x14946a){_0x4583d0['push'](_0x4583d0['shift']());}};_0x7b3c5a(++_0x24551f);}(_0x3a43,0xd5));var _0x33a4=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x3a43[_0x1bb58c];return _0x277586;};'use strict';var VoiceQueueEvents=require(_0x33a4('0x0'));var events=[_0x33a4('0x1'),_0x33a4('0x2'),_0x33a4('0x3')];function createListener(_0x5446b4,_0x506147){return function(_0x3f6bb2){_0x506147[_0x33a4('0x4')](_0x5446b4,_0x3f6bb2);};}function removeListener(_0xd957c8,_0x44b795){return function(){VoiceQueueEvents['removeListener'](_0xd957c8,_0x44b795);};}exports[_0x33a4('0x5')]=function(_0x401907){for(var _0x4bbd16=0x0,_0x3ede71=events[_0x33a4('0x6')];_0x4bbd16<_0x3ede71;_0x4bbd16++){var _0x16afa4=events[_0x4bbd16];var _0x3ed44b=createListener(_0x33a4('0x7')+_0x16afa4,_0x401907);VoiceQueueEvents['on'](_0x16afa4,_0x3ed44b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 79d9567..4d9eec1 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 _0x7ac9=['get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x3098d0,_0x232330){var _0xeff0d=function(_0x2679da){while(--_0x2679da){_0x3098d0['push'](_0x3098d0['shift']());}};_0xeff0d(++_0x232330);}(_0x7ac9,0x188));var _0x97ac=function(_0x1ee697,_0x46847e){_0x1ee697=_0x1ee697-0x0;var _0x52a7af=_0x7ac9[_0x1ee697];return _0x52a7af;};'use strict';var multer=require(_0x97ac('0x0'));var util=require('util');var path=require(_0x97ac('0x1'));var timeout=require(_0x97ac('0x2'));var express=require('express');var router=express[_0x97ac('0x3')]();var fs_extra=require(_0x97ac('0x4'));var auth=require(_0x97ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x97ac('0x6'));var controller=require(_0x97ac('0x7'));router[_0x97ac('0x8')]('/',auth[_0x97ac('0x9')](),controller[_0x97ac('0xa')]);router['get']('/describe',auth[_0x97ac('0x9')](),controller[_0x97ac('0xb')]);router[_0x97ac('0x8')]('/index',auth[_0x97ac('0x9')](),controller[_0x97ac('0xc')]);router['get'](_0x97ac('0xd'),auth[_0x97ac('0x9')](),controller['show']);router[_0x97ac('0xe')]('/',auth[_0x97ac('0x9')](),controller[_0x97ac('0xf')]);router[_0x97ac('0x10')](_0x97ac('0xd'),auth[_0x97ac('0x9')](),controller[_0x97ac('0x11')]);router['delete'](_0x97ac('0xd'),auth[_0x97ac('0x9')](),controller[_0x97ac('0x12')]);module[_0x97ac('0x13')]=router; \ No newline at end of file +var _0x6640=['put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x5875ad,_0x3597b8){var _0x32a922=function(_0x2175fd){while(--_0x2175fd){_0x5875ad['push'](_0x5875ad['shift']());}};_0x32a922(++_0x3597b8);}(_0x6640,0x117));var _0x0664=function(_0xbf19d7,_0x58b2bf){_0xbf19d7=_0xbf19d7-0x0;var _0x376e11=_0x6640[_0xbf19d7];return _0x376e11;};'use strict';var multer=require(_0x0664('0x0'));var util=require(_0x0664('0x1'));var path=require(_0x0664('0x2'));var timeout=require(_0x0664('0x3'));var express=require(_0x0664('0x4'));var router=express[_0x0664('0x5')]();var fs_extra=require(_0x0664('0x6'));var auth=require(_0x0664('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0664('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x0664('0x9')]('/',auth[_0x0664('0xa')](),controller[_0x0664('0xb')]);router['get'](_0x0664('0xc'),auth[_0x0664('0xa')](),controller[_0x0664('0xd')]);router['get'](_0x0664('0xe'),auth[_0x0664('0xa')](),controller[_0x0664('0xf')]);router['get'](_0x0664('0x10'),auth[_0x0664('0xa')](),controller[_0x0664('0x11')]);router[_0x0664('0x12')]('/',auth[_0x0664('0xa')](),controller[_0x0664('0x13')]);router[_0x0664('0x14')](_0x0664('0x10'),auth[_0x0664('0xa')](),controller['update']);router[_0x0664('0x15')](_0x0664('0x10'),auth[_0x0664('0xa')](),controller['destroy']);module[_0x0664('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 7a27c65..16da18e 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 _0xd1a6=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x1614aa,_0x15f8c6){var _0x11e4bf=function(_0x2dab9f){while(--_0x2dab9f){_0x1614aa['push'](_0x1614aa['shift']());}};_0x11e4bf(++_0x15f8c6);}(_0xd1a6,0x1d0));var _0x6d1a=function(_0x1aefea,_0x39e5fa){_0x1aefea=_0x1aefea-0x0;var _0x33a7a1=_0xd1a6[_0x1aefea];return _0x33a7a1;};'use strict';var Sequelize=require(_0x6d1a('0x0'));var moment=require('moment');module[_0x6d1a('0x1')]={'type':{'type':Sequelize[_0x6d1a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6d1a('0x2')]},'calleridname':{'type':Sequelize[_0x6d1a('0x2')]},'queue':{'type':Sequelize[_0x6d1a('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x6d1a('0x3')],'set':function(_0x4f3e2d){var _0x39b540=moment(_0x4f3e2d);var _0x42bf25=moment(this[_0x6d1a('0x4')]('queuecallerjoinAt'))['format'](_0x6d1a('0x5'));var _0x1ad069=_0x39b540[_0x6d1a('0x6')](_0x42bf25,_0x6d1a('0x7'));this[_0x6d1a('0x8')](_0x6d1a('0x9'),_0x4f3e2d);this[_0x6d1a('0x8')](_0x6d1a('0xa'),_0x1ad069||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x6d1a('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x6d1a('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6d1a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6d1a('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6d1a('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x6d1a('0xd')},'originalposition':{'type':Sequelize[_0x6d1a('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6d1a('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d1a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d1a('0x2')]},'exten':{'type':Sequelize[_0x6d1a('0x2')]},'priority':{'type':Sequelize[_0x6d1a('0x2')]},'holdtime':{'type':Sequelize[_0x6d1a('0xb')]},'mohtime':{'type':Sequelize[_0x6d1a('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6d1a('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6d1a('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6d1a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6d1a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d1a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6d1a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6d1a('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf768=['sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5c5514,_0x43ac9f){var _0x5b0e11=function(_0x2ee8ef){while(--_0x2ee8ef){_0x5c5514['push'](_0x5c5514['shift']());}};_0x5b0e11(++_0x43ac9f);}(_0xf768,0x1c3));var _0x8f76=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf768[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x8f76('0x0'));var moment=require('moment');module[_0x8f76('0x1')]={'type':{'type':Sequelize[_0x8f76('0x2')]},'uniqueid':{'type':Sequelize[_0x8f76('0x2')]},'calleridnum':{'type':Sequelize[_0x8f76('0x2')]},'calleridname':{'type':Sequelize[_0x8f76('0x2')]},'queue':{'type':Sequelize[_0x8f76('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x8f76('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x30bb2f){var _0x151a39=moment(_0x30bb2f);var _0x4e1261=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x8f76('0x4'));var _0x5e4966=_0x151a39['diff'](_0x4e1261,_0x8f76('0x5'));this['setDataValue']('queuecallerleaveAt',_0x30bb2f);this[_0x8f76('0x6')]('holdtime',_0x5e4966||null);}},'position':{'type':Sequelize[_0x8f76('0x7')]},'count':{'type':Sequelize[_0x8f76('0x7')]},'queuecallerabandon':{'type':Sequelize[_0x8f76('0x8')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8f76('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8f76('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8f76('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8f76('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x8f76('0x9')},'originalposition':{'type':Sequelize[_0x8f76('0x7')]},'channel':{'type':Sequelize[_0x8f76('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8f76('0x2')]},'connectedlinename':{'type':Sequelize[_0x8f76('0x2')]},'accountcode':{'type':Sequelize[_0x8f76('0x2')]},'context':{'type':Sequelize[_0x8f76('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8f76('0x2')]},'holdtime':{'type':Sequelize[_0x8f76('0x7')]},'mohtime':{'type':Sequelize[_0x8f76('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8f76('0x2')]},'transfer':{'type':Sequelize[_0x8f76('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8f76('0x2')],'comment':_0x8f76('0xa')},'transferexten':{'type':Sequelize[_0x8f76('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8f76('0x2')]},'disposition':{'type':Sequelize[_0x8f76('0x2')]},'secondDisposition':{'type':Sequelize[_0x8f76('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x8f76('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8da4897..b9f8d34 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 _0x402f=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','find','create','body','catch','describe','nolimit','order','sort','filter','include','getVoiceQueuesReport','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key'];(function(_0x50152e,_0x59ca7c){var _0x861e9=function(_0x461457){while(--_0x461457){_0x50152e['push'](_0x50152e['shift']());}};_0x861e9(++_0x59ca7c);}(_0x402f,0x163));var _0xf402=function(_0x149c58,_0x303690){_0x149c58=_0x149c58-0x0;var _0x580181=_0x402f[_0x149c58];return _0x580181;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf402('0x0'));var rp=require(_0xf402('0x1'));var moment=require(_0xf402('0x2'));var BPromise=require(_0xf402('0x3'));var Mustache=require('mustache');var util=require(_0xf402('0x4'));var path=require(_0xf402('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf402('0x6'));var fs=require('fs');var fs_extra=require(_0xf402('0x7'));var _=require(_0xf402('0x8'));var squel=require(_0xf402('0x9'));var crypto=require(_0xf402('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf402('0xb'));var toCsv=require(_0xf402('0xc'));var querystring=require('querystring');var Papa=require(_0xf402('0xd'));var Redis=require(_0xf402('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf402('0xf'));var as=require(_0xf402('0x10'));var hardwareService=require(_0xf402('0x11'));var logger=require(_0xf402('0x12'))(_0xf402('0x13'));var utils=require(_0xf402('0x14'));var config=require(_0xf402('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf402('0x16')]=_[_0xf402('0x17')](config[_0xf402('0x16')],{'host':_0xf402('0x18'),'port':0x18eb});var socket=require(_0xf402('0x19'))(new Redis(config[_0xf402('0x16')]));require(_0xf402('0x1a'))[_0xf402('0x1b')](socket);function respondWithStatusCode(_0x55cf7e,_0x41d7a1){_0x41d7a1=_0x41d7a1||0xcc;return function(_0x4a442f){if(_0x4a442f){return _0x55cf7e[_0xf402('0x1c')](_0x41d7a1);}return _0x55cf7e[_0xf402('0x1d')](_0x41d7a1)[_0xf402('0x1e')]();};}function respondWithResult(_0x1e1e95,_0x8f9076){_0x8f9076=_0x8f9076||0xc8;return function(_0x4bdd11){if(_0x4bdd11){return _0x1e1e95['status'](_0x8f9076)[_0xf402('0x1f')](_0x4bdd11);}};}function respondWithFilteredResult(_0x35510a,_0x44b03b){return function(_0x24fc5d){if(_0x24fc5d){var _0x5f055e=typeof _0x44b03b[_0xf402('0x20')]==='undefined'&&typeof _0x44b03b[_0xf402('0x21')]===_0xf402('0x22');var _0xf935b1=_0x24fc5d['count'];var _0x80c0f8=_0x5f055e?0x0:_0x44b03b[_0xf402('0x20')];var _0x3665a3=_0x5f055e?_0x24fc5d['count']:_0x44b03b['offset']+_0x44b03b[_0xf402('0x21')];var _0xe4d513;if(_0x3665a3>=_0xf935b1){_0x3665a3=_0xf935b1;_0xe4d513=0xc8;}else{_0xe4d513=0xce;}_0x35510a[_0xf402('0x1d')](_0xe4d513);return _0x35510a[_0xf402('0x23')]('Content-Range',_0x80c0f8+'-'+_0x3665a3+'/'+_0xf935b1)[_0xf402('0x1f')](_0x24fc5d);}return null;};}function patchUpdates(_0xe1613d){return function(_0x44d1b){try{jsonpatch['apply'](_0x44d1b,_0xe1613d,!![]);}catch(_0x485754){return BPromise['reject'](_0x485754);}return _0x44d1b[_0xf402('0x24')]();};}function saveUpdates(_0x3bf2f9,_0xea3330){return function(_0x292486){if(_0x292486){return _0x292486[_0xf402('0x25')](_0x3bf2f9)['then'](function(_0xc95cd5){return _0xc95cd5;});}return null;};}function removeEntity(_0xa073de,_0x4616f4){return function(_0x566ed8){if(_0x566ed8){return _0x566ed8[_0xf402('0x26')]()[_0xf402('0x27')](function(){_0xa073de[_0xf402('0x1d')](0xcc)[_0xf402('0x1e')]();});}};}function handleEntityNotFound(_0x9cbbb5,_0x4b0eb5){return function(_0x20b344){if(!_0x20b344){_0x9cbbb5[_0xf402('0x1c')](0x194);}return _0x20b344;};}function handleError(_0x472a2a,_0x276b0e){_0x276b0e=_0x276b0e||0x1f4;return function(_0x206f15){logger[_0xf402('0x28')](_0x206f15[_0xf402('0x29')]);if(_0x206f15[_0xf402('0x2a')]){delete _0x206f15[_0xf402('0x2a')];}_0x472a2a[_0xf402('0x1d')](_0x276b0e)[_0xf402('0x2b')](_0x206f15);};}exports[_0xf402('0x2c')]=function(_0x3b18ed,_0x45ee14){var _0xd5193f={},_0x23c1c9={},_0x426d32={'count':0x0,'rows':[]};var _0x56498e=_[_0xf402('0x2d')](db[_0xf402('0x2e')]['rawAttributes'],function(_0x48ea24){return{'name':_0x48ea24[_0xf402('0x2f')],'type':_0x48ea24[_0xf402('0x30')][_0xf402('0x31')]};});_0x23c1c9[_0xf402('0x32')]=_[_0xf402('0x2d')](_0x56498e,'name');_0x23c1c9[_0xf402('0x33')]=_[_0xf402('0x34')](_0x3b18ed[_0xf402('0x33')]);_0x23c1c9[_0xf402('0x35')]=_[_0xf402('0x36')](_0x23c1c9[_0xf402('0x32')],_0x23c1c9[_0xf402('0x33')]);_0xd5193f[_0xf402('0x37')]=_[_0xf402('0x36')](_0x23c1c9[_0xf402('0x32')],qs[_0xf402('0x38')](_0x3b18ed[_0xf402('0x33')][_0xf402('0x38')]));_0xd5193f[_0xf402('0x37')]=_0xd5193f[_0xf402('0x37')][_0xf402('0x39')]?_0xd5193f['attributes']:_0x23c1c9[_0xf402('0x32')];if(!_0x3b18ed[_0xf402('0x33')][_0xf402('0x3a')]('nolimit')){_0xd5193f['limit']=qs['limit'](_0x3b18ed[_0xf402('0x33')][_0xf402('0x21')]);_0xd5193f[_0xf402('0x20')]=qs[_0xf402('0x20')](_0x3b18ed[_0xf402('0x33')]['offset']);}_0xd5193f['order']=qs['sort'](_0x3b18ed[_0xf402('0x33')]['sort']);_0xd5193f[_0xf402('0x3b')]=qs['filters'](_[_0xf402('0x3c')](_0x3b18ed[_0xf402('0x33')],_0x23c1c9[_0xf402('0x35')]),_0x56498e);if(_0x3b18ed[_0xf402('0x33')]['filter']){_0xd5193f['where']=_[_0xf402('0x3d')](_0xd5193f[_0xf402('0x3b')],{'$or':_[_0xf402('0x2d')](_0x56498e,function(_0x3b5ce8){if(_0x3b5ce8[_0xf402('0x30')]!==_0xf402('0x3e')){var _0x34a016={};_0x34a016[_0x3b5ce8[_0xf402('0x2a')]]={'$like':'%'+_0x3b18ed['query']['filter']+'%'};return _0x34a016;}})});}_0xd5193f=_[_0xf402('0x3d')]({},_0xd5193f,_0x3b18ed[_0xf402('0x3f')]);var _0x18e154={'where':_0xd5193f[_0xf402('0x3b')]};return db[_0xf402('0x2e')]['count'](_0x18e154)[_0xf402('0x27')](function(_0xc05e05){_0x426d32[_0xf402('0x40')]=_0xc05e05;if(_0x3b18ed[_0xf402('0x33')][_0xf402('0x41')]){_0xd5193f['include']=[{'all':!![]}];}return db[_0xf402('0x2e')][_0xf402('0x42')](_0xd5193f);})['then'](function(_0x377dc5){_0x426d32[_0xf402('0x43')]=_0x377dc5;return _0x426d32;})[_0xf402('0x27')](respondWithFilteredResult(_0x45ee14,_0xd5193f))['catch'](handleError(_0x45ee14,null));};exports[_0xf402('0x44')]=function(_0x9c72ec,_0x1f1f1b){var _0x2254cf={'raw':![],'where':{'id':_0x9c72ec[_0xf402('0x45')]['id']}},_0x240a02={};_0x240a02[_0xf402('0x32')]=_[_0xf402('0x34')](db['VoiceQueueReport']['rawAttributes']);_0x240a02[_0xf402('0x33')]=_[_0xf402('0x34')](_0x9c72ec[_0xf402('0x33')]);_0x240a02[_0xf402('0x35')]=_[_0xf402('0x36')](_0x240a02[_0xf402('0x32')],_0x240a02['query']);_0x2254cf[_0xf402('0x37')]=_['intersection'](_0x240a02[_0xf402('0x32')],qs[_0xf402('0x38')](_0x9c72ec[_0xf402('0x33')][_0xf402('0x38')]));_0x2254cf[_0xf402('0x37')]=_0x2254cf[_0xf402('0x37')][_0xf402('0x39')]?_0x2254cf[_0xf402('0x37')]:_0x240a02[_0xf402('0x32')];if(_0x9c72ec[_0xf402('0x33')][_0xf402('0x41')]){_0x2254cf['include']=[{'all':!![]}];}_0x2254cf=_[_0xf402('0x3d')]({},_0x2254cf,_0x9c72ec['options']);return db[_0xf402('0x2e')][_0xf402('0x46')](_0x2254cf)[_0xf402('0x27')](handleEntityNotFound(_0x1f1f1b,null))[_0xf402('0x27')](respondWithResult(_0x1f1f1b,null))['catch'](handleError(_0x1f1f1b,null));};exports[_0xf402('0x47')]=function(_0x5ae0b0,_0xc178d){return db[_0xf402('0x2e')][_0xf402('0x47')](_0x5ae0b0[_0xf402('0x48')],{})[_0xf402('0x27')](respondWithResult(_0xc178d,0xc9))[_0xf402('0x49')](handleError(_0xc178d,null));};exports[_0xf402('0x25')]=function(_0x49724e,_0x33b97b){if(_0x49724e[_0xf402('0x48')]['id']){delete _0x49724e[_0xf402('0x48')]['id'];}return db[_0xf402('0x2e')]['find']({'where':{'id':_0x49724e[_0xf402('0x45')]['id']}})[_0xf402('0x27')](handleEntityNotFound(_0x33b97b,null))[_0xf402('0x27')](saveUpdates(_0x49724e['body'],null))[_0xf402('0x27')](respondWithResult(_0x33b97b,null))[_0xf402('0x49')](handleError(_0x33b97b,null));};exports[_0xf402('0x26')]=function(_0x22f1a6,_0x37f2c6){return db['VoiceQueueReport']['find']({'where':{'id':_0x22f1a6[_0xf402('0x45')]['id']}})[_0xf402('0x27')](handleEntityNotFound(_0x37f2c6,null))[_0xf402('0x27')](removeEntity(_0x37f2c6,null))[_0xf402('0x49')](handleError(_0x37f2c6,null));};exports[_0xf402('0x4a')]=function(_0x44a2a2,_0x3c8b8d){return db[_0xf402('0x2e')][_0xf402('0x4a')]()[_0xf402('0x27')](respondWithResult(_0x3c8b8d,null))[_0xf402('0x49')](handleError(_0x3c8b8d,null));};exports['getVoiceQueuesReport']=function(_0x370871,_0x538842){var _0x46936c={},_0x48c696={},_0x520468={'count':0x0,'rows':[]};_0x48c696[_0xf402('0x32')]=_['keys'](db[_0xf402('0x2e')]['rawAttributes']);_0x48c696['query']=_['keys'](_0x370871[_0xf402('0x33')]);_0x48c696[_0xf402('0x35')]=_[_0xf402('0x36')](_0x48c696['model'],_0x48c696[_0xf402('0x33')]);_0x46936c[_0xf402('0x37')]=_[_0xf402('0x36')](_0x48c696[_0xf402('0x32')],qs['fields'](_0x370871[_0xf402('0x33')]['fields']));_0x46936c[_0xf402('0x37')]=_0x46936c[_0xf402('0x37')][_0xf402('0x39')]?_0x46936c['attributes']:_0x48c696['model'];if(!_0x370871[_0xf402('0x33')][_0xf402('0x3a')](_0xf402('0x4b'))){_0x46936c[_0xf402('0x21')]=qs['limit'](_0x370871[_0xf402('0x33')][_0xf402('0x21')]);_0x46936c[_0xf402('0x20')]=qs[_0xf402('0x20')](_0x370871[_0xf402('0x33')][_0xf402('0x20')]);}_0x46936c[_0xf402('0x4c')]=qs['sort'](_0x370871[_0xf402('0x33')][_0xf402('0x4d')]);_0x46936c[_0xf402('0x3b')]=qs[_0xf402('0x35')](_['pick'](_0x370871[_0xf402('0x33')],_0x48c696[_0xf402('0x35')]));if(_0x370871['query']['filter']){_0x46936c[_0xf402('0x3b')]=_[_0xf402('0x3d')](_0x46936c[_0xf402('0x3b')],{'$or':_[_0xf402('0x2d')](_0x46936c['attributes'],function(_0x8ce163){var _0xc312={};_0xc312[_0x8ce163]={'$like':'%'+_0x370871[_0xf402('0x33')][_0xf402('0x4e')]+'%'};return _0xc312;})});}_0x46936c=_[_0xf402('0x3d')]({},_0x46936c,_0x370871[_0xf402('0x3f')]);var _0x4bf0d8={'where':_0x46936c['where']};return db['VoiceQueueReport'][_0xf402('0x40')](_0x4bf0d8)[_0xf402('0x27')](function(_0x5578a7){_0x520468[_0xf402('0x40')]=_0x5578a7;if(_0x370871['query'][_0xf402('0x41')]){_0x46936c[_0xf402('0x4f')]=[{'all':!![]}];}return db[_0xf402('0x2e')]['findAll'](_0x46936c);})[_0xf402('0x27')](function(_0x3a1783){_0x520468[_0xf402('0x43')]=_0x3a1783;return _0x520468;})[_0xf402('0x27')](respondWithFilteredResult(_0x538842,_0x46936c,_0xf402('0x50')))[_0xf402('0x49')](handleError(_0x538842,null,_0xf402('0x50')));}; \ No newline at end of file +var _0xc607=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','filters','include','find','create','body','destroy','describe','getVoiceQueuesReport','rimraf','zip-dir','moment','mustache','util','path'];(function(_0xaf7c,_0x5a7953){var _0x3178a7=function(_0x4e592f){while(--_0x4e592f){_0xaf7c['push'](_0xaf7c['shift']());}};_0x3178a7(++_0x5a7953);}(_0xc607,0xea));var _0x7c60=function(_0x2ef969,_0x311125){_0x2ef969=_0x2ef969-0x0;var _0x318ac3=_0xc607[_0x2ef969];return _0x318ac3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c60('0x0'));var zipdir=require(_0x7c60('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c60('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7c60('0x3'));var util=require(_0x7c60('0x4'));var path=require(_0x7c60('0x5'));var sox=require(_0x7c60('0x6'));var csv=require(_0x7c60('0x7'));var ejs=require(_0x7c60('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c60('0x9'));var squel=require(_0x7c60('0xa'));var crypto=require(_0x7c60('0xb'));var jsforce=require(_0x7c60('0xc'));var deskjs=require(_0x7c60('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c60('0xe'));var Papa=require('papaparse');var Redis=require(_0x7c60('0xf'));var authService=require(_0x7c60('0x10'));var qs=require(_0x7c60('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c60('0x12'))('api');var utils=require(_0x7c60('0x13'));var config=require(_0x7c60('0x14'));var licenseUtil=require(_0x7c60('0x15'));var db=require(_0x7c60('0x16'))['db'];config[_0x7c60('0x17')]=_[_0x7c60('0x18')](config[_0x7c60('0x17')],{'host':_0x7c60('0x19'),'port':0x18eb});var socket=require(_0x7c60('0x1a'))(new Redis(config[_0x7c60('0x17')]));require(_0x7c60('0x1b'))[_0x7c60('0x1c')](socket);function respondWithStatusCode(_0x87deae,_0x59160d){_0x59160d=_0x59160d||0xcc;return function(_0x5d5eb4){if(_0x5d5eb4){return _0x87deae[_0x7c60('0x1d')](_0x59160d);}return _0x87deae[_0x7c60('0x1e')](_0x59160d)['end']();};}function respondWithResult(_0x34f91d,_0x429269){_0x429269=_0x429269||0xc8;return function(_0x287985){if(_0x287985){return _0x34f91d[_0x7c60('0x1e')](_0x429269)[_0x7c60('0x1f')](_0x287985);}};}function respondWithFilteredResult(_0x295b75,_0x54cac7){return function(_0x5196db){if(_0x5196db){var _0x1337b7=typeof _0x54cac7[_0x7c60('0x20')]===_0x7c60('0x21')&&typeof _0x54cac7[_0x7c60('0x22')]===_0x7c60('0x21');var _0x3d2a54=_0x5196db[_0x7c60('0x23')];var _0x54609e=_0x1337b7?0x0:_0x54cac7['offset'];var _0x563b26=_0x1337b7?_0x5196db[_0x7c60('0x23')]:_0x54cac7[_0x7c60('0x20')]+_0x54cac7[_0x7c60('0x22')];var _0x6abb12;if(_0x563b26>=_0x3d2a54){_0x563b26=_0x3d2a54;_0x6abb12=0xc8;}else{_0x6abb12=0xce;}_0x295b75['status'](_0x6abb12);return _0x295b75['set'](_0x7c60('0x24'),_0x54609e+'-'+_0x563b26+'/'+_0x3d2a54)[_0x7c60('0x1f')](_0x5196db);}return null;};}function patchUpdates(_0x3a3a7e){return function(_0x2ae798){try{jsonpatch[_0x7c60('0x25')](_0x2ae798,_0x3a3a7e,!![]);}catch(_0xae2a81){return BPromise[_0x7c60('0x26')](_0xae2a81);}return _0x2ae798['save']();};}function saveUpdates(_0x25d44c,_0x5f2324){return function(_0x1a30d9){if(_0x1a30d9){return _0x1a30d9[_0x7c60('0x27')](_0x25d44c)[_0x7c60('0x28')](function(_0xd66501){return _0xd66501;});}return null;};}function removeEntity(_0x42c2d2,_0x4ad1a3){return function(_0x2c5660){if(_0x2c5660){return _0x2c5660['destroy']()['then'](function(){_0x42c2d2[_0x7c60('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24604e,_0x3f3aab){return function(_0x4e3233){if(!_0x4e3233){_0x24604e[_0x7c60('0x1d')](0x194);}return _0x4e3233;};}function handleError(_0x269477,_0x5091df){_0x5091df=_0x5091df||0x1f4;return function(_0x579ac4){logger['error'](_0x579ac4[_0x7c60('0x29')]);if(_0x579ac4[_0x7c60('0x2a')]){delete _0x579ac4[_0x7c60('0x2a')];}_0x269477[_0x7c60('0x1e')](_0x5091df)[_0x7c60('0x2b')](_0x579ac4);};}exports[_0x7c60('0x2c')]=function(_0x2a8a09,_0x87a33d){var _0x30260f={},_0x4e9bd0={},_0x255f46={'count':0x0,'rows':[]};var _0x3e5cc6=_[_0x7c60('0x2d')](db[_0x7c60('0x2e')][_0x7c60('0x2f')],function(_0x8b0cc7){return{'name':_0x8b0cc7[_0x7c60('0x30')],'type':_0x8b0cc7[_0x7c60('0x31')][_0x7c60('0x32')]};});_0x4e9bd0[_0x7c60('0x33')]=_['map'](_0x3e5cc6,_0x7c60('0x2a'));_0x4e9bd0[_0x7c60('0x34')]=_[_0x7c60('0x35')](_0x2a8a09[_0x7c60('0x34')]);_0x4e9bd0['filters']=_[_0x7c60('0x36')](_0x4e9bd0[_0x7c60('0x33')],_0x4e9bd0['query']);_0x30260f[_0x7c60('0x37')]=_[_0x7c60('0x36')](_0x4e9bd0[_0x7c60('0x33')],qs[_0x7c60('0x38')](_0x2a8a09[_0x7c60('0x34')]['fields']));_0x30260f[_0x7c60('0x37')]=_0x30260f[_0x7c60('0x37')][_0x7c60('0x39')]?_0x30260f[_0x7c60('0x37')]:_0x4e9bd0['model'];if(!_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x3a')](_0x7c60('0x3b'))){_0x30260f[_0x7c60('0x22')]=qs[_0x7c60('0x22')](_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x22')]);_0x30260f[_0x7c60('0x20')]=qs['offset'](_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x20')]);}_0x30260f[_0x7c60('0x3c')]=qs[_0x7c60('0x3d')](_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x3d')]);_0x30260f['where']=qs['filters'](_[_0x7c60('0x3e')](_0x2a8a09[_0x7c60('0x34')],_0x4e9bd0['filters']),_0x3e5cc6);if(_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x3f')]){_0x30260f[_0x7c60('0x40')]=_['merge'](_0x30260f['where'],{'$or':_[_0x7c60('0x2d')](_0x3e5cc6,function(_0x2a7a01){if(_0x2a7a01[_0x7c60('0x31')]!=='VIRTUAL'){var _0x4c6425={};_0x4c6425[_0x2a7a01[_0x7c60('0x2a')]]={'$like':'%'+_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x3f')]+'%'};return _0x4c6425;}})});}_0x30260f=_[_0x7c60('0x41')]({},_0x30260f,_0x2a8a09[_0x7c60('0x42')]);var _0x29fd68={'where':_0x30260f[_0x7c60('0x40')]};return db[_0x7c60('0x2e')]['count'](_0x29fd68)[_0x7c60('0x28')](function(_0x22f4a6){_0x255f46[_0x7c60('0x23')]=_0x22f4a6;if(_0x2a8a09[_0x7c60('0x34')][_0x7c60('0x43')]){_0x30260f['include']=[{'all':!![]}];}return db[_0x7c60('0x2e')][_0x7c60('0x44')](_0x30260f);})[_0x7c60('0x28')](function(_0x2081d3){_0x255f46[_0x7c60('0x45')]=_0x2081d3;return _0x255f46;})['then'](respondWithFilteredResult(_0x87a33d,_0x30260f))[_0x7c60('0x46')](handleError(_0x87a33d,null));};exports[_0x7c60('0x47')]=function(_0x182295,_0x5304c8){var _0x53cef4={'raw':![],'where':{'id':_0x182295['params']['id']}},_0x3f6993={};_0x3f6993[_0x7c60('0x33')]=_['keys'](db[_0x7c60('0x2e')][_0x7c60('0x2f')]);_0x3f6993[_0x7c60('0x34')]=_[_0x7c60('0x35')](_0x182295[_0x7c60('0x34')]);_0x3f6993[_0x7c60('0x48')]=_[_0x7c60('0x36')](_0x3f6993['model'],_0x3f6993['query']);_0x53cef4[_0x7c60('0x37')]=_[_0x7c60('0x36')](_0x3f6993[_0x7c60('0x33')],qs[_0x7c60('0x38')](_0x182295[_0x7c60('0x34')][_0x7c60('0x38')]));_0x53cef4[_0x7c60('0x37')]=_0x53cef4['attributes']['length']?_0x53cef4[_0x7c60('0x37')]:_0x3f6993['model'];if(_0x182295[_0x7c60('0x34')][_0x7c60('0x43')]){_0x53cef4[_0x7c60('0x49')]=[{'all':!![]}];}_0x53cef4=_[_0x7c60('0x41')]({},_0x53cef4,_0x182295[_0x7c60('0x42')]);return db['VoiceQueueReport'][_0x7c60('0x4a')](_0x53cef4)[_0x7c60('0x28')](handleEntityNotFound(_0x5304c8,null))[_0x7c60('0x28')](respondWithResult(_0x5304c8,null))['catch'](handleError(_0x5304c8,null));};exports[_0x7c60('0x4b')]=function(_0x428ecb,_0x4cd0f6){return db[_0x7c60('0x2e')]['create'](_0x428ecb['body'],{})[_0x7c60('0x28')](respondWithResult(_0x4cd0f6,0xc9))[_0x7c60('0x46')](handleError(_0x4cd0f6,null));};exports[_0x7c60('0x27')]=function(_0x3a7c98,_0x18775e){if(_0x3a7c98[_0x7c60('0x4c')]['id']){delete _0x3a7c98[_0x7c60('0x4c')]['id'];}return db[_0x7c60('0x2e')][_0x7c60('0x4a')]({'where':{'id':_0x3a7c98['params']['id']}})[_0x7c60('0x28')](handleEntityNotFound(_0x18775e,null))['then'](saveUpdates(_0x3a7c98[_0x7c60('0x4c')],null))[_0x7c60('0x28')](respondWithResult(_0x18775e,null))[_0x7c60('0x46')](handleError(_0x18775e,null));};exports[_0x7c60('0x4d')]=function(_0x40c628,_0x374828){return db[_0x7c60('0x2e')]['find']({'where':{'id':_0x40c628['params']['id']}})['then'](handleEntityNotFound(_0x374828,null))[_0x7c60('0x28')](removeEntity(_0x374828,null))['catch'](handleError(_0x374828,null));};exports[_0x7c60('0x4e')]=function(_0x164e04,_0x53a6b1){return db[_0x7c60('0x2e')]['describe']()['then'](respondWithResult(_0x53a6b1,null))[_0x7c60('0x46')](handleError(_0x53a6b1,null));};exports[_0x7c60('0x4f')]=function(_0x178574,_0xd8144c){var _0x240bdd={},_0x24c0a0={},_0x5551d0={'count':0x0,'rows':[]};_0x24c0a0[_0x7c60('0x33')]=_[_0x7c60('0x35')](db['VoiceQueueReport'][_0x7c60('0x2f')]);_0x24c0a0['query']=_[_0x7c60('0x35')](_0x178574[_0x7c60('0x34')]);_0x24c0a0[_0x7c60('0x48')]=_[_0x7c60('0x36')](_0x24c0a0[_0x7c60('0x33')],_0x24c0a0['query']);_0x240bdd['attributes']=_[_0x7c60('0x36')](_0x24c0a0[_0x7c60('0x33')],qs['fields'](_0x178574['query']['fields']));_0x240bdd[_0x7c60('0x37')]=_0x240bdd[_0x7c60('0x37')][_0x7c60('0x39')]?_0x240bdd[_0x7c60('0x37')]:_0x24c0a0[_0x7c60('0x33')];if(!_0x178574[_0x7c60('0x34')][_0x7c60('0x3a')](_0x7c60('0x3b'))){_0x240bdd[_0x7c60('0x22')]=qs[_0x7c60('0x22')](_0x178574['query'][_0x7c60('0x22')]);_0x240bdd[_0x7c60('0x20')]=qs[_0x7c60('0x20')](_0x178574['query'][_0x7c60('0x20')]);}_0x240bdd[_0x7c60('0x3c')]=qs[_0x7c60('0x3d')](_0x178574['query'][_0x7c60('0x3d')]);_0x240bdd[_0x7c60('0x40')]=qs[_0x7c60('0x48')](_[_0x7c60('0x3e')](_0x178574['query'],_0x24c0a0[_0x7c60('0x48')]));if(_0x178574['query']['filter']){_0x240bdd['where']=_[_0x7c60('0x41')](_0x240bdd[_0x7c60('0x40')],{'$or':_[_0x7c60('0x2d')](_0x240bdd[_0x7c60('0x37')],function(_0x4b28fb){var _0x86eb36={};_0x86eb36[_0x4b28fb]={'$like':'%'+_0x178574['query'][_0x7c60('0x3f')]+'%'};return _0x86eb36;})});}_0x240bdd=_[_0x7c60('0x41')]({},_0x240bdd,_0x178574[_0x7c60('0x42')]);var _0x33f531={'where':_0x240bdd[_0x7c60('0x40')]};return db['VoiceQueueReport'][_0x7c60('0x23')](_0x33f531)['then'](function(_0x1809c3){_0x5551d0[_0x7c60('0x23')]=_0x1809c3;if(_0x178574[_0x7c60('0x34')][_0x7c60('0x43')]){_0x240bdd['include']=[{'all':!![]}];}return db[_0x7c60('0x2e')]['findAll'](_0x240bdd);})[_0x7c60('0x28')](function(_0x1398b5){_0x5551d0['rows']=_0x1398b5;return _0x5551d0;})['then'](respondWithFilteredResult(_0xd8144c,_0x240bdd,_0x7c60('0x4f')))[_0x7c60('0x46')](handleError(_0xd8144c,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 e8e6625..76bd853 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 _0xd0aa=['save','update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x3548c7,_0xea2f2e){var _0x283fab=function(_0x57f4e7){while(--_0x57f4e7){_0x3548c7['push'](_0x3548c7['shift']());}};_0x283fab(++_0xea2f2e);}(_0xd0aa,0x114));var _0xad0a=function(_0x19ef25,_0x4d6e30){_0x19ef25=_0x19ef25-0x0;var _0x3912e4=_0xd0aa[_0x19ef25];return _0x3912e4;};'use strict';var EventEmitter=require(_0xad0a('0x0'));var VoiceQueueReport=require(_0xad0a('0x1'))['db'][_0xad0a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xad0a('0x3')](0x0);var events={'afterCreate':_0xad0a('0x4'),'afterUpdate':_0xad0a('0x5'),'afterDestroy':_0xad0a('0x6')};function emitEvent(_0x1e18dd){return function(_0x655033,_0x40d1c0,_0x2d799f){VoiceQueueReportEvents[_0xad0a('0x7')](_0x1e18dd+':'+_0x655033['id'],_0x655033);VoiceQueueReportEvents[_0xad0a('0x7')](_0x1e18dd,_0x655033);_0x2d799f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xad0a('0x8')](e,emitEvent(event));}}module[_0xad0a('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x75a8=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x87e2b3,_0x5c99a5){var _0x4bdeee=function(_0x36dc61){while(--_0x36dc61){_0x87e2b3['push'](_0x87e2b3['shift']());}};_0x4bdeee(++_0x5c99a5);}(_0x75a8,0x14e));var _0x875a=function(_0xd7b481,_0x7e357){_0xd7b481=_0xd7b481-0x0;var _0x4eebaf=_0x75a8[_0xd7b481];return _0x4eebaf;};'use strict';var EventEmitter=require(_0x875a('0x0'));var VoiceQueueReport=require(_0x875a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x875a('0x2')](0x0);var events={'afterCreate':_0x875a('0x3'),'afterUpdate':_0x875a('0x4'),'afterDestroy':_0x875a('0x5')};function emitEvent(_0x18739e){return function(_0x1bf6a8,_0x2347ce,_0x170803){VoiceQueueReportEvents[_0x875a('0x6')](_0x18739e+':'+_0x1bf6a8['id'],_0x1bf6a8);VoiceQueueReportEvents[_0x875a('0x6')](_0x18739e,_0x1bf6a8);_0x170803(null);};}for(var e in events){if(events[_0x875a('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x875a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9098518..ef92d2d 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 _0x3364=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','uniqueid'];(function(_0x340d72,_0x14f789){var _0x5e8885=function(_0x242d17){while(--_0x242d17){_0x340d72['push'](_0x340d72['shift']());}};_0x5e8885(++_0x14f789);}(_0x3364,0xf0));var _0x4336=function(_0x5a9f74,_0x42e3d8){_0x5a9f74=_0x5a9f74-0x0;var _0x18eec8=_0x3364[_0x5a9f74];return _0x18eec8;};'use strict';var _=require(_0x4336('0x0'));var util=require('util');var logger=require(_0x4336('0x1'))('api');var moment=require(_0x4336('0x2'));var BPromise=require(_0x4336('0x3'));var rp=require(_0x4336('0x4'));var fs=require('fs');var path=require(_0x4336('0x5'));var rimraf=require('rimraf');var config=require(_0x4336('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x4336('0x7')]=function(_0x1db0dd,_0x32907d){return _0x1db0dd[_0x4336('0x8')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x4336('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcf0=['moment','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util','api'];(function(_0x2b399d,_0x13c015){var _0x5b3854=function(_0x1b36d2){while(--_0x1b36d2){_0x2b399d['push'](_0x2b399d['shift']());}};_0x5b3854(++_0x13c015);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x19e038,_0x264266){_0x19e038=_0x19e038-0x0;var _0x543fc2=_0xdcf0[_0x19e038];return _0x543fc2;};'use strict';var _=require(_0x0dcf('0x0'));var util=require(_0x0dcf('0x1'));var logger=require('../../config/logger')(_0x0dcf('0x2'));var moment=require(_0x0dcf('0x3'));var BPromise=require('bluebird');var rp=require(_0x0dcf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0dcf('0x5'));var attributes=require(_0x0dcf('0x6'));module[_0x0dcf('0x7')]=function(_0x2586c8,_0x1367df){return _0x2586c8['define'](_0x0dcf('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x0dcf('0x9')]},{'fields':[_0x0dcf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 22b6cbd..0eed678 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 _0xbd04=['raw','where','limit','include','map','model','attributes','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xbd04,0xb9));var _0x4bd0=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xbd04[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x4bd0('0x0'));var util=require(_0x4bd0('0x1'));var moment=require(_0x4bd0('0x2'));var BPromise=require(_0x4bd0('0x3'));var rs=require(_0x4bd0('0x4'));var fs=require('fs');var Redis=require(_0x4bd0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bd0('0x6'));var logger=require(_0x4bd0('0x7'))(_0x4bd0('0x8'));var config=require(_0x4bd0('0x9'));var jayson=require(_0x4bd0('0xa'));var client=jayson['client'][_0x4bd0('0xb')]({'port':0x232a});config[_0x4bd0('0xc')]=_[_0x4bd0('0xd')](config['redis'],{'host':_0x4bd0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x4ae150,_0x56c5b1,_0x5358f8){return new BPromise(function(_0x4f28c3,_0x48402b){return client[_0x4bd0('0xf')](_0x4ae150,_0x5358f8)[_0x4bd0('0x10')](function(_0x5e72d1){logger['info'](_0x4bd0('0x11'),_0x56c5b1,_0x4bd0('0x12'));logger['debug'](_0x4bd0('0x13'),_0x56c5b1,_0x4bd0('0x12'),JSON[_0x4bd0('0x14')](_0x5e72d1));if(_0x5e72d1[_0x4bd0('0x15')]){if(_0x5e72d1[_0x4bd0('0x15')][_0x4bd0('0x16')]===0x1f4){logger[_0x4bd0('0x15')](_0x4bd0('0x11'),_0x56c5b1,_0x5e72d1[_0x4bd0('0x15')][_0x4bd0('0x17')]);return _0x48402b(_0x5e72d1['error'][_0x4bd0('0x17')]);}logger[_0x4bd0('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x56c5b1,_0x5e72d1[_0x4bd0('0x15')][_0x4bd0('0x17')]);return _0x4f28c3(_0x5e72d1[_0x4bd0('0x15')][_0x4bd0('0x17')]);}else{logger[_0x4bd0('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x56c5b1,_0x4bd0('0x12'));_0x4f28c3(_0x5e72d1[_0x4bd0('0x19')][_0x4bd0('0x17')]);}})[_0x4bd0('0x1a')](function(_0xf3335a){logger[_0x4bd0('0x15')](_0x4bd0('0x11'),_0x56c5b1,_0xf3335a);_0x48402b(_0xf3335a);});});}exports[_0x4bd0('0x1b')]=function(_0x5d79ec){var _0x3c72c9=this;return new Promise(function(_0x29d14c,_0x4a2b3f){return db[_0x4bd0('0x1c')]['findAll']({'raw':_0x5d79ec[_0x4bd0('0x1d')]?_0x5d79ec[_0x4bd0('0x1d')][_0x4bd0('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d79ec[_0x4bd0('0x1d')]?_0x5d79ec[_0x4bd0('0x1d')][_0x4bd0('0x1f')]||null:null,'attributes':_0x5d79ec['options']?_0x5d79ec[_0x4bd0('0x1d')]['attributes']||null:null,'limit':_0x5d79ec[_0x4bd0('0x1d')]?_0x5d79ec['options'][_0x4bd0('0x20')]||null:null,'include':_0x5d79ec[_0x4bd0('0x1d')]?_0x5d79ec[_0x4bd0('0x1d')][_0x4bd0('0x21')]?_[_0x4bd0('0x22')](_0x5d79ec['options'][_0x4bd0('0x21')],function(_0x1d690a){return{'model':db[_0x1d690a['model']],'as':_0x1d690a['as'],'attributes':_0x1d690a['attributes'],'include':_0x1d690a[_0x4bd0('0x21')]?_[_0x4bd0('0x22')](_0x1d690a[_0x4bd0('0x21')],function(_0x1291fb){return{'model':db[_0x1291fb[_0x4bd0('0x23')]],'as':_0x1291fb['as'],'attributes':_0x1291fb[_0x4bd0('0x24')],'include':_0x1291fb[_0x4bd0('0x21')]?_[_0x4bd0('0x22')](_0x1291fb[_0x4bd0('0x21')],function(_0x46d760){return{'model':db[_0x46d760['model']],'as':_0x46d760['as'],'attributes':_0x46d760[_0x4bd0('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4bd0('0x10')](function(_0x542166){logger[_0x4bd0('0x18')](_0x4bd0('0x1b'),_0x5d79ec);logger[_0x4bd0('0x25')](_0x4bd0('0x1b'),_0x5d79ec,JSON[_0x4bd0('0x14')](_0x542166));_0x29d14c(_0x542166);})[_0x4bd0('0x1a')](function(_0x1fb01d){logger['error']('GetVoiceQueueReport',_0x1fb01d[_0x4bd0('0x17')],_0x5d79ec);_0x4a2b3f(_0x3c72c9[_0x4bd0('0x15')](0x1f4,_0x1fb01d[_0x4bd0('0x17')]));});});};exports[_0x4bd0('0x26')]=function(_0x426abc){var _0x424ab8=this;return new Promise(function(_0x55e921,_0x31374e){return db['VoiceQueueReport'][_0x4bd0('0x27')](_0x426abc[_0x4bd0('0x28')],{'raw':_0x426abc[_0x4bd0('0x1d')]?_0x426abc[_0x4bd0('0x1d')][_0x4bd0('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2c39eb){logger['info']('CreateVoiceQueueReport',_0x426abc);logger[_0x4bd0('0x25')](_0x4bd0('0x26'),_0x426abc,JSON[_0x4bd0('0x14')](_0x2c39eb));_0x55e921(_0x2c39eb);})[_0x4bd0('0x1a')](function(_0x5b7be3){logger['error'](_0x4bd0('0x26'),_0x5b7be3['message'],_0x426abc);_0x31374e(_0x424ab8['error'](0x1f4,_0x5b7be3[_0x4bd0('0x17')]));});});};exports[_0x4bd0('0x29')]=function(_0x52a62f){var _0x2bd527=this;return new Promise(function(_0x22f225,_0x1d8aae){return db[_0x4bd0('0x1c')][_0x4bd0('0x2a')](_0x52a62f['body'],{'raw':_0x52a62f[_0x4bd0('0x1d')]?_0x52a62f[_0x4bd0('0x1d')][_0x4bd0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52a62f[_0x4bd0('0x1d')]?_0x52a62f[_0x4bd0('0x1d')][_0x4bd0('0x1f')]||null:null,'attributes':_0x52a62f[_0x4bd0('0x1d')]?_0x52a62f['options']['attributes']||null:null,'limit':_0x52a62f['options']?_0x52a62f['options'][_0x4bd0('0x20')]||null:null})['then'](function(_0xa949a1){logger[_0x4bd0('0x18')](_0x4bd0('0x29'),_0x52a62f);logger[_0x4bd0('0x25')]('UpdateVoiceQueueReport',_0x52a62f,JSON[_0x4bd0('0x14')](_0xa949a1));_0x22f225(_0xa949a1);})['catch'](function(_0x598e8b){logger[_0x4bd0('0x15')](_0x4bd0('0x29'),_0x598e8b['message'],_0x52a62f);_0x1d8aae(_0x2bd527[_0x4bd0('0x15')](0x1f4,_0x598e8b[_0x4bd0('0x17')]));});});}; \ No newline at end of file +var _0xdf1d=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','raw','update','limit','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1b5a5e,_0x10b6c0){var _0x4b57ac=function(_0x326f9a){while(--_0x326f9a){_0x1b5a5e['push'](_0x1b5a5e['shift']());}};_0x4b57ac(++_0x10b6c0);}(_0xdf1d,0xc4));var _0xddf1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xdf1d[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xddf1('0x0'));var util=require(_0xddf1('0x1'));var moment=require(_0xddf1('0x2'));var BPromise=require('bluebird');var rs=require(_0xddf1('0x3'));var fs=require('fs');var Redis=require(_0xddf1('0x4'));var db=require(_0xddf1('0x5'))['db'];var utils=require(_0xddf1('0x6'));var logger=require(_0xddf1('0x7'))('rpc');var config=require(_0xddf1('0x8'));var jayson=require(_0xddf1('0x9'));var client=jayson[_0xddf1('0xa')]['http']({'port':0x232a});config[_0xddf1('0xb')]=_[_0xddf1('0xc')](config[_0xddf1('0xb')],{'host':_0xddf1('0xd'),'port':0x18eb});var socket=require(_0xddf1('0xe'))(new Redis(config['redis']));require(_0xddf1('0xf'))['register'](socket);function respondWithRpcPromise(_0x275636,_0x46e2ad,_0xc86874){return new BPromise(function(_0x43d195,_0x34af86){return client[_0xddf1('0x10')](_0x275636,_0xc86874)[_0xddf1('0x11')](function(_0x1c93b9){logger[_0xddf1('0x12')](_0xddf1('0x13'),_0x46e2ad,_0xddf1('0x14'));logger[_0xddf1('0x15')](_0xddf1('0x16'),_0x46e2ad,_0xddf1('0x14'),JSON[_0xddf1('0x17')](_0x1c93b9));if(_0x1c93b9[_0xddf1('0x18')]){if(_0x1c93b9['error'][_0xddf1('0x19')]===0x1f4){logger['error'](_0xddf1('0x13'),_0x46e2ad,_0x1c93b9[_0xddf1('0x18')][_0xddf1('0x1a')]);return _0x34af86(_0x1c93b9[_0xddf1('0x18')][_0xddf1('0x1a')]);}logger[_0xddf1('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x46e2ad,_0x1c93b9[_0xddf1('0x18')][_0xddf1('0x1a')]);return _0x43d195(_0x1c93b9[_0xddf1('0x18')][_0xddf1('0x1a')]);}else{logger[_0xddf1('0x12')](_0xddf1('0x13'),_0x46e2ad,_0xddf1('0x14'));_0x43d195(_0x1c93b9[_0xddf1('0x1b')][_0xddf1('0x1a')]);}})[_0xddf1('0x1c')](function(_0x3ecf9c){logger[_0xddf1('0x18')](_0xddf1('0x13'),_0x46e2ad,_0x3ecf9c);_0x34af86(_0x3ecf9c);});});}exports[_0xddf1('0x1d')]=function(_0x3c0c87){var _0x420b37=this;return new Promise(function(_0x287906,_0x40f5c6){return db[_0xddf1('0x1e')][_0xddf1('0x1f')]({'raw':_0x3c0c87['options']?_0x3c0c87[_0xddf1('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3c0c87[_0xddf1('0x20')]?_0x3c0c87['options'][_0xddf1('0x21')]||null:null,'attributes':_0x3c0c87['options']?_0x3c0c87['options'][_0xddf1('0x22')]||null:null,'limit':_0x3c0c87[_0xddf1('0x20')]?_0x3c0c87[_0xddf1('0x20')]['limit']||null:null,'include':_0x3c0c87[_0xddf1('0x20')]?_0x3c0c87[_0xddf1('0x20')][_0xddf1('0x23')]?_[_0xddf1('0x24')](_0x3c0c87[_0xddf1('0x20')][_0xddf1('0x23')],function(_0x3993bd){return{'model':db[_0x3993bd['model']],'as':_0x3993bd['as'],'attributes':_0x3993bd[_0xddf1('0x22')],'include':_0x3993bd[_0xddf1('0x23')]?_['map'](_0x3993bd[_0xddf1('0x23')],function(_0x10c30f){return{'model':db[_0x10c30f[_0xddf1('0x25')]],'as':_0x10c30f['as'],'attributes':_0x10c30f[_0xddf1('0x22')],'include':_0x10c30f[_0xddf1('0x23')]?_[_0xddf1('0x24')](_0x10c30f[_0xddf1('0x23')],function(_0x537594){return{'model':db[_0x537594[_0xddf1('0x25')]],'as':_0x537594['as'],'attributes':_0x537594['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x519831){logger[_0xddf1('0x12')](_0xddf1('0x1d'),_0x3c0c87);logger[_0xddf1('0x15')](_0xddf1('0x1d'),_0x3c0c87,JSON[_0xddf1('0x17')](_0x519831));_0x287906(_0x519831);})['catch'](function(_0x13ad84){logger[_0xddf1('0x18')](_0xddf1('0x1d'),_0x13ad84['message'],_0x3c0c87);_0x40f5c6(_0x420b37[_0xddf1('0x18')](0x1f4,_0x13ad84[_0xddf1('0x1a')]));});});};exports[_0xddf1('0x26')]=function(_0x3b57c0){var _0x2fc92f=this;return new Promise(function(_0x390849,_0x2fa50c){return db[_0xddf1('0x1e')][_0xddf1('0x27')](_0x3b57c0[_0xddf1('0x28')],{'raw':_0x3b57c0[_0xddf1('0x20')]?_0x3b57c0['options'][_0xddf1('0x29')]===undefined?!![]:![]:!![]})[_0xddf1('0x11')](function(_0x2a8eae){logger[_0xddf1('0x12')](_0xddf1('0x26'),_0x3b57c0);logger['debug']('CreateVoiceQueueReport',_0x3b57c0,JSON[_0xddf1('0x17')](_0x2a8eae));_0x390849(_0x2a8eae);})[_0xddf1('0x1c')](function(_0x4ef857){logger[_0xddf1('0x18')](_0xddf1('0x26'),_0x4ef857[_0xddf1('0x1a')],_0x3b57c0);_0x2fa50c(_0x2fc92f['error'](0x1f4,_0x4ef857['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x1ba87b){var _0x23584a=this;return new Promise(function(_0xe67d08,_0x43d531){return db[_0xddf1('0x1e')][_0xddf1('0x2a')](_0x1ba87b['body'],{'raw':_0x1ba87b[_0xddf1('0x20')]?_0x1ba87b['options'][_0xddf1('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ba87b[_0xddf1('0x20')]?_0x1ba87b['options'][_0xddf1('0x21')]||null:null,'attributes':_0x1ba87b['options']?_0x1ba87b[_0xddf1('0x20')][_0xddf1('0x22')]||null:null,'limit':_0x1ba87b['options']?_0x1ba87b[_0xddf1('0x20')][_0xddf1('0x2b')]||null:null})[_0xddf1('0x11')](function(_0xe744e5){logger[_0xddf1('0x12')]('UpdateVoiceQueueReport',_0x1ba87b);logger[_0xddf1('0x15')](_0xddf1('0x2c'),_0x1ba87b,JSON[_0xddf1('0x17')](_0xe744e5));_0xe67d08(_0xe744e5);})['catch'](function(_0x849285){logger[_0xddf1('0x18')]('UpdateVoiceQueueReport',_0x849285[_0xddf1('0x1a')],_0x1ba87b);_0x43d531(_0x23584a[_0xddf1('0x18')](0x1f4,_0x849285[_0xddf1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 537286f..db55530 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 _0xa1a9=['./voiceQueueReport.events','update','removeListener','length','voiceQueueReport:'];(function(_0x5edacd,_0xcfbcde){var _0x26e892=function(_0x128998){while(--_0x128998){_0x5edacd['push'](_0x5edacd['shift']());}};_0x26e892(++_0xcfbcde);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x1edaad,_0x130fd6){_0x1edaad=_0x1edaad-0x0;var _0x52c5a1=_0xa1a9[_0x1edaad];return _0x52c5a1;};'use strict';var VoiceQueueReportEvents=require(_0x9a1a('0x0'));var events=['save','remove',_0x9a1a('0x1')];function createListener(_0x5dbe14,_0x379cd4){return function(_0x2197b8){_0x379cd4['emit'](_0x5dbe14,_0x2197b8);};}function removeListener(_0x5cb71d,_0x54cc32){return function(){VoiceQueueReportEvents[_0x9a1a('0x2')](_0x5cb71d,_0x54cc32);};}exports['register']=function(_0x433b6e){for(var _0x412c30=0x0,_0x4d0302=events[_0x9a1a('0x3')];_0x412c30<_0x4d0302;_0x412c30++){var _0x4eb5e9=events[_0x412c30];var _0x553d08=createListener(_0x9a1a('0x4')+_0x4eb5e9,_0x433b6e);VoiceQueueReportEvents['on'](_0x4eb5e9,_0x553d08);}}; \ No newline at end of file +var _0x4d33=['emit','removeListener','register','length','save','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4d33,0x1cc));var _0x34d3=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x4d33[_0x377a6e];return _0x37f751;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x34d3('0x0'),'remove',_0x34d3('0x1')];function createListener(_0x58646b,_0x501397){return function(_0x2b8cc2){_0x501397[_0x34d3('0x2')](_0x58646b,_0x2b8cc2);};}function removeListener(_0x24443d,_0x1efb62){return function(){VoiceQueueReportEvents[_0x34d3('0x3')](_0x24443d,_0x1efb62);};}exports[_0x34d3('0x4')]=function(_0x1472ab){for(var _0x52ec52=0x0,_0x16ab27=events[_0x34d3('0x5')];_0x52ec52<_0x16ab27;_0x52ec52++){var _0x2ebd5a=events[_0x52ec52];var _0x3ffda3=createListener('voiceQueueReport:'+_0x2ebd5a,_0x1472ab);VoiceQueueReportEvents['on'](_0x2ebd5a,_0x3ffda3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e60fd0c..5ddde63 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 _0x707d=['exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','destroy'];(function(_0xdb7109,_0x98b9c5){var _0x230505=function(_0x74a939){while(--_0x74a939){_0xdb7109['push'](_0xdb7109['shift']());}};_0x230505(++_0x98b9c5);}(_0x707d,0x12d));var _0xd707=function(_0x2e49cf,_0x5dc764){_0x2e49cf=_0x2e49cf-0x0;var _0x40b074=_0x707d[_0x2e49cf];return _0x40b074;};'use strict';var multer=require('multer');var util=require(_0xd707('0x0'));var path=require(_0xd707('0x1'));var timeout=require(_0xd707('0x2'));var express=require(_0xd707('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd707('0x4'));var config=require(_0xd707('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xd707('0x6')]('/',auth[_0xd707('0x7')](),controller[_0xd707('0x8')]);router['get'](_0xd707('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd707('0xa')]('/',auth[_0xd707('0x7')](),controller['create']);router['put'](_0xd707('0x9'),auth[_0xd707('0x7')](),controller[_0xd707('0xb')]);router[_0xd707('0xc')](_0xd707('0x9'),auth[_0xd707('0x7')](),controller[_0xd707('0xd')]);module[_0xd707('0xe')]=router; \ No newline at end of file +var _0x3e5c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5059ec,_0x139bc2){var _0x393f99=function(_0x160333){while(--_0x160333){_0x5059ec['push'](_0x5059ec['shift']());}};_0x393f99(++_0x139bc2);}(_0x3e5c,0x9a));var _0xc3e5=function(_0xa9f97c,_0x4a3d1d){_0xa9f97c=_0xa9f97c-0x0;var _0x1d9bfa=_0x3e5c[_0xa9f97c];return _0x1d9bfa;};'use strict';var multer=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var path=require(_0xc3e5('0x2'));var timeout=require(_0xc3e5('0x3'));var express=require('express');var router=express[_0xc3e5('0x4')]();var fs_extra=require(_0xc3e5('0x5'));var auth=require(_0xc3e5('0x6'));var interaction=require(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var controller=require(_0xc3e5('0x9'));router['get']('/',auth[_0xc3e5('0xa')](),controller[_0xc3e5('0xb')]);router[_0xc3e5('0xc')](_0xc3e5('0xd'),auth[_0xc3e5('0xa')](),controller['show']);router[_0xc3e5('0xe')]('/',auth[_0xc3e5('0xa')](),controller[_0xc3e5('0xf')]);router[_0xc3e5('0x10')](_0xc3e5('0xd'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x11')]);router['delete'](_0xc3e5('0xd'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x12')]);module[_0xc3e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cfcc544..63223eb 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 _0xe788=['STRING','sequelize','exports'];(function(_0x251df5,_0xba1c68){var _0x228926=function(_0x1a63bd){while(--_0x1a63bd){_0x251df5['push'](_0x251df5['shift']());}};_0x228926(++_0xba1c68);}(_0xe788,0x154));var _0x8e78=function(_0x142a31,_0x471f17){_0x142a31=_0x142a31-0x0;var _0x3d46c1=_0xe788[_0x142a31];return _0x3d46c1;};'use strict';var Sequelize=require(_0x8e78('0x0'));var moment=require('moment');module[_0x8e78('0x1')]={'time':{'type':Sequelize[_0x8e78('0x2')]},'callid':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8e78('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x0198=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x38143a,_0x3e6926){var _0x1284ba=function(_0x57979b){while(--_0x57979b){_0x38143a['push'](_0x38143a['shift']());}};_0x1284ba(++_0x3e6926);}(_0x0198,0x17c));var _0x8019=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x0198[_0x2f37e0];return _0x43ccce;};'use strict';var Sequelize=require(_0x8019('0x0'));var moment=require(_0x8019('0x1'));module[_0x8019('0x2')]={'time':{'type':Sequelize[_0x8019('0x3')]},'callid':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8019('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8019('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x8019('0x5')](_0x8019('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6885cea..2d51fa3 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 _0x0a1b=['model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','catch','show','fields','includeAll','options','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','VoiceQueuesLog','rawAttributes','fieldName','type'];(function(_0x21c5df,_0x8085b8){var _0x164944=function(_0x155338){while(--_0x155338){_0x21c5df['push'](_0x21c5df['shift']());}};_0x164944(++_0x8085b8);}(_0x0a1b,0x1c5));var _0xb0a1=function(_0x1e71b7,_0x199ed3){_0x1e71b7=_0x1e71b7-0x0;var _0x4d0f44=_0x0a1b[_0x1e71b7];return _0x4d0f44;};'use strict';var emlformat=require(_0xb0a1('0x0'));var rimraf=require(_0xb0a1('0x1'));var zipdir=require(_0xb0a1('0x2'));var jsonpatch=require(_0xb0a1('0x3'));var rp=require(_0xb0a1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0a1('0x5'));var path=require(_0xb0a1('0x6'));var sox=require(_0xb0a1('0x7'));var csv=require(_0xb0a1('0x8'));var ejs=require(_0xb0a1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0a1('0xa'));var squel=require(_0xb0a1('0xb'));var crypto=require('crypto');var jsforce=require(_0xb0a1('0xc'));var deskjs=require(_0xb0a1('0xd'));var toCsv=require(_0xb0a1('0x8'));var querystring=require('querystring');var Papa=require(_0xb0a1('0xe'));var Redis=require('ioredis');var authService=require(_0xb0a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb0a1('0x10'));var hardwareService=require(_0xb0a1('0x11'));var logger=require(_0xb0a1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb0a1('0x13'));var licenseUtil=require(_0xb0a1('0x14'));var db=require(_0xb0a1('0x15'))['db'];function respondWithStatusCode(_0x44ec01,_0x3d0bed){_0x3d0bed=_0x3d0bed||0xcc;return function(_0x29ec39){if(_0x29ec39){return _0x44ec01[_0xb0a1('0x16')](_0x3d0bed);}return _0x44ec01[_0xb0a1('0x17')](_0x3d0bed)[_0xb0a1('0x18')]();};}function respondWithResult(_0xd6c9bd,_0x42ade6){_0x42ade6=_0x42ade6||0xc8;return function(_0x3b722f){if(_0x3b722f){return _0xd6c9bd[_0xb0a1('0x17')](_0x42ade6)[_0xb0a1('0x19')](_0x3b722f);}};}function respondWithFilteredResult(_0x2dc1c0,_0xe1bef5){return function(_0x2f0f4b){if(_0x2f0f4b){var _0x1619fd=typeof _0xe1bef5[_0xb0a1('0x1a')]==='undefined'&&typeof _0xe1bef5[_0xb0a1('0x1b')]===_0xb0a1('0x1c');var _0x597116=_0x2f0f4b[_0xb0a1('0x1d')];var _0xfdfbdf=_0x1619fd?0x0:_0xe1bef5['offset'];var _0x147753=_0x1619fd?_0x2f0f4b[_0xb0a1('0x1d')]:_0xe1bef5[_0xb0a1('0x1a')]+_0xe1bef5['limit'];var _0x53b19f;if(_0x147753>=_0x597116){_0x147753=_0x597116;_0x53b19f=0xc8;}else{_0x53b19f=0xce;}_0x2dc1c0['status'](_0x53b19f);return _0x2dc1c0[_0xb0a1('0x1e')](_0xb0a1('0x1f'),_0xfdfbdf+'-'+_0x147753+'/'+_0x597116)[_0xb0a1('0x19')](_0x2f0f4b);}return null;};}function patchUpdates(_0x24ce0b){return function(_0x264576){try{jsonpatch[_0xb0a1('0x20')](_0x264576,_0x24ce0b,!![]);}catch(_0x5af584){return BPromise[_0xb0a1('0x21')](_0x5af584);}return _0x264576[_0xb0a1('0x22')]();};}function saveUpdates(_0x1ff17f,_0x2a2460){return function(_0x297b49){if(_0x297b49){return _0x297b49['update'](_0x1ff17f)[_0xb0a1('0x23')](function(_0xcc709c){return _0xcc709c;});}return null;};}function removeEntity(_0x468532,_0x47bb0b){return function(_0xb72cdc){if(_0xb72cdc){return _0xb72cdc[_0xb0a1('0x24')]()['then'](function(){_0x468532[_0xb0a1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c9d6,_0x5bb42f){return function(_0x5acedf){if(!_0x5acedf){_0x58c9d6[_0xb0a1('0x16')](0x194);}return _0x5acedf;};}function handleError(_0x5c720c,_0x1612d6){_0x1612d6=_0x1612d6||0x1f4;return function(_0x30d2e1){logger[_0xb0a1('0x25')](_0x30d2e1['stack']);if(_0x30d2e1['name']){delete _0x30d2e1[_0xb0a1('0x26')];}_0x5c720c[_0xb0a1('0x17')](_0x1612d6)['send'](_0x30d2e1);};}exports[_0xb0a1('0x27')]=function(_0x7bbe1d,_0x195696){var _0x413bf2={},_0x513b85={},_0x5c77b8={'count':0x0,'rows':[]};var _0x1a42ff=_['map'](db[_0xb0a1('0x28')][_0xb0a1('0x29')],function(_0xe86452){return{'name':_0xe86452[_0xb0a1('0x2a')],'type':_0xe86452[_0xb0a1('0x2b')]['key']};});_0x513b85[_0xb0a1('0x2c')]=_[_0xb0a1('0x2d')](_0x1a42ff,_0xb0a1('0x26'));_0x513b85[_0xb0a1('0x2e')]=_[_0xb0a1('0x2f')](_0x7bbe1d[_0xb0a1('0x2e')]);_0x513b85[_0xb0a1('0x30')]=_[_0xb0a1('0x31')](_0x513b85[_0xb0a1('0x2c')],_0x513b85[_0xb0a1('0x2e')]);_0x413bf2[_0xb0a1('0x32')]=_[_0xb0a1('0x31')](_0x513b85['model'],qs['fields'](_0x7bbe1d[_0xb0a1('0x2e')]['fields']));_0x413bf2[_0xb0a1('0x32')]=_0x413bf2['attributes'][_0xb0a1('0x33')]?_0x413bf2[_0xb0a1('0x32')]:_0x513b85[_0xb0a1('0x2c')];if(!_0x7bbe1d[_0xb0a1('0x2e')][_0xb0a1('0x34')](_0xb0a1('0x35'))){_0x413bf2['limit']=qs[_0xb0a1('0x1b')](_0x7bbe1d[_0xb0a1('0x2e')]['limit']);_0x413bf2[_0xb0a1('0x1a')]=qs[_0xb0a1('0x1a')](_0x7bbe1d[_0xb0a1('0x2e')][_0xb0a1('0x1a')]);}_0x413bf2[_0xb0a1('0x36')]=qs[_0xb0a1('0x37')](_0x7bbe1d[_0xb0a1('0x2e')][_0xb0a1('0x37')]);_0x413bf2[_0xb0a1('0x38')]=qs[_0xb0a1('0x30')](_['pick'](_0x7bbe1d[_0xb0a1('0x2e')],_0x513b85[_0xb0a1('0x30')]),_0x1a42ff);if(_0x7bbe1d[_0xb0a1('0x2e')][_0xb0a1('0x39')]){_0x413bf2[_0xb0a1('0x38')]=_[_0xb0a1('0x3a')](_0x413bf2[_0xb0a1('0x38')],{'$or':_[_0xb0a1('0x2d')](_0x1a42ff,function(_0x4a4c94){if(_0x4a4c94[_0xb0a1('0x2b')]!==_0xb0a1('0x3b')){var _0x30c796={};_0x30c796[_0x4a4c94['name']]={'$like':'%'+_0x7bbe1d[_0xb0a1('0x2e')][_0xb0a1('0x39')]+'%'};return _0x30c796;}})});}_0x413bf2=_[_0xb0a1('0x3a')]({},_0x413bf2,_0x7bbe1d['options']);var _0x448ae3={'where':_0x413bf2[_0xb0a1('0x38')]};return db[_0xb0a1('0x28')][_0xb0a1('0x1d')](_0x448ae3)[_0xb0a1('0x23')](function(_0x4d66ea){_0x5c77b8[_0xb0a1('0x1d')]=_0x4d66ea;if(_0x7bbe1d['query']['includeAll']){_0x413bf2[_0xb0a1('0x3c')]=[{'all':!![]}];}return db[_0xb0a1('0x28')]['findAll'](_0x413bf2);})[_0xb0a1('0x23')](function(_0x28f128){_0x5c77b8['rows']=_0x28f128;return _0x5c77b8;})[_0xb0a1('0x23')](respondWithFilteredResult(_0x195696,_0x413bf2))[_0xb0a1('0x3d')](handleError(_0x195696,null));};exports[_0xb0a1('0x3e')]=function(_0x373843,_0x2f54c9){var _0x2a6034={'raw':!![],'where':{'id':_0x373843['params']['id']}},_0x490b97={};_0x490b97['model']=_[_0xb0a1('0x2f')](db[_0xb0a1('0x28')]['rawAttributes']);_0x490b97[_0xb0a1('0x2e')]=_['keys'](_0x373843[_0xb0a1('0x2e')]);_0x490b97['filters']=_[_0xb0a1('0x31')](_0x490b97[_0xb0a1('0x2c')],_0x490b97[_0xb0a1('0x2e')]);_0x2a6034['attributes']=_[_0xb0a1('0x31')](_0x490b97[_0xb0a1('0x2c')],qs[_0xb0a1('0x3f')](_0x373843['query']['fields']));_0x2a6034['attributes']=_0x2a6034[_0xb0a1('0x32')]['length']?_0x2a6034[_0xb0a1('0x32')]:_0x490b97['model'];if(_0x373843[_0xb0a1('0x2e')][_0xb0a1('0x40')]){_0x2a6034['include']=[{'all':!![]}];}_0x2a6034=_[_0xb0a1('0x3a')]({},_0x2a6034,_0x373843[_0xb0a1('0x41')]);return db[_0xb0a1('0x28')][_0xb0a1('0x42')](_0x2a6034)[_0xb0a1('0x23')](handleEntityNotFound(_0x2f54c9,null))[_0xb0a1('0x23')](respondWithResult(_0x2f54c9,null))[_0xb0a1('0x3d')](handleError(_0x2f54c9,null));};exports['create']=function(_0x5b7386,_0x45e263){return db['VoiceQueuesLog'][_0xb0a1('0x43')](_0x5b7386['body'],{})[_0xb0a1('0x23')](respondWithResult(_0x45e263,0xc9))[_0xb0a1('0x3d')](handleError(_0x45e263,null));};exports[_0xb0a1('0x44')]=function(_0x5a6067,_0x2a9e37){if(_0x5a6067[_0xb0a1('0x45')]['id']){delete _0x5a6067[_0xb0a1('0x45')]['id'];}return db[_0xb0a1('0x28')]['find']({'where':{'id':_0x5a6067['params']['id']}})['then'](handleEntityNotFound(_0x2a9e37,null))[_0xb0a1('0x23')](saveUpdates(_0x5a6067[_0xb0a1('0x45')],null))['then'](respondWithResult(_0x2a9e37,null))['catch'](handleError(_0x2a9e37,null));};exports[_0xb0a1('0x24')]=function(_0x3e7697,_0x332f17){return db['VoiceQueuesLog'][_0xb0a1('0x42')]({'where':{'id':_0x3e7697[_0xb0a1('0x46')]['id']}})[_0xb0a1('0x23')](handleEntityNotFound(_0x332f17,null))[_0xb0a1('0x23')](removeEntity(_0x332f17,null))[_0xb0a1('0x3d')](handleError(_0x332f17,null));}; \ No newline at end of file +var _0x000a=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x421b97,_0x95ce0c){var _0x2cc507=function(_0x36a9fd){while(--_0x36a9fd){_0x421b97['push'](_0x421b97['shift']());}};_0x2cc507(++_0x95ce0c);}(_0x000a,0x8e));var _0xa000=function(_0x103f21,_0x220a0e){_0x103f21=_0x103f21-0x0;var _0x1aadfa=_0x000a[_0x103f21];return _0x1aadfa;};'use strict';var emlformat=require(_0xa000('0x0'));var rimraf=require(_0xa000('0x1'));var zipdir=require(_0xa000('0x2'));var jsonpatch=require(_0xa000('0x3'));var rp=require(_0xa000('0x4'));var moment=require(_0xa000('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa000('0x6'));var util=require(_0xa000('0x7'));var path=require(_0xa000('0x8'));var sox=require(_0xa000('0x9'));var csv=require('to-csv');var ejs=require(_0xa000('0xa'));var fs=require('fs');var fs_extra=require(_0xa000('0xb'));var _=require(_0xa000('0xc'));var squel=require(_0xa000('0xd'));var crypto=require(_0xa000('0xe'));var jsforce=require(_0xa000('0xf'));var deskjs=require(_0xa000('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa000('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa000('0x12'));var qs=require(_0xa000('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa000('0x14'));var logger=require(_0xa000('0x15'))('api');var utils=require(_0xa000('0x16'));var config=require(_0xa000('0x17'));var licenseUtil=require(_0xa000('0x18'));var db=require(_0xa000('0x19'))['db'];function respondWithStatusCode(_0x24be78,_0x3959a7){_0x3959a7=_0x3959a7||0xcc;return function(_0x324998){if(_0x324998){return _0x24be78[_0xa000('0x1a')](_0x3959a7);}return _0x24be78[_0xa000('0x1b')](_0x3959a7)[_0xa000('0x1c')]();};}function respondWithResult(_0x2ec131,_0x4852a0){_0x4852a0=_0x4852a0||0xc8;return function(_0x9dd36b){if(_0x9dd36b){return _0x2ec131[_0xa000('0x1b')](_0x4852a0)['json'](_0x9dd36b);}};}function respondWithFilteredResult(_0x32b30f,_0x3ae4dc){return function(_0x120307){if(_0x120307){var _0x43de1f=typeof _0x3ae4dc[_0xa000('0x1d')]===_0xa000('0x1e')&&typeof _0x3ae4dc[_0xa000('0x1f')]===_0xa000('0x1e');var _0x58e02a=_0x120307['count'];var _0x44ef1c=_0x43de1f?0x0:_0x3ae4dc[_0xa000('0x1d')];var _0x2991f8=_0x43de1f?_0x120307[_0xa000('0x20')]:_0x3ae4dc[_0xa000('0x1d')]+_0x3ae4dc[_0xa000('0x1f')];var _0x13c99c;if(_0x2991f8>=_0x58e02a){_0x2991f8=_0x58e02a;_0x13c99c=0xc8;}else{_0x13c99c=0xce;}_0x32b30f[_0xa000('0x1b')](_0x13c99c);return _0x32b30f[_0xa000('0x21')](_0xa000('0x22'),_0x44ef1c+'-'+_0x2991f8+'/'+_0x58e02a)[_0xa000('0x23')](_0x120307);}return null;};}function patchUpdates(_0x1c89e9){return function(_0x1daaf9){try{jsonpatch[_0xa000('0x24')](_0x1daaf9,_0x1c89e9,!![]);}catch(_0xe5c057){return BPromise[_0xa000('0x25')](_0xe5c057);}return _0x1daaf9[_0xa000('0x26')]();};}function saveUpdates(_0x1729f5,_0x2b4638){return function(_0x101a23){if(_0x101a23){return _0x101a23['update'](_0x1729f5)[_0xa000('0x27')](function(_0x4cdabe){return _0x4cdabe;});}return null;};}function removeEntity(_0x598a2a,_0x5dcdcf){return function(_0x4d74f3){if(_0x4d74f3){return _0x4d74f3[_0xa000('0x28')]()[_0xa000('0x27')](function(){_0x598a2a[_0xa000('0x1b')](0xcc)[_0xa000('0x1c')]();});}};}function handleEntityNotFound(_0x196db0,_0xa18a8d){return function(_0x580af3){if(!_0x580af3){_0x196db0[_0xa000('0x1a')](0x194);}return _0x580af3;};}function handleError(_0x1b091a,_0x42a094){_0x42a094=_0x42a094||0x1f4;return function(_0x566cc0){logger[_0xa000('0x29')](_0x566cc0['stack']);if(_0x566cc0[_0xa000('0x2a')]){delete _0x566cc0[_0xa000('0x2a')];}_0x1b091a[_0xa000('0x1b')](_0x42a094)['send'](_0x566cc0);};}exports[_0xa000('0x2b')]=function(_0x13d32f,_0xe85bbc){var _0xbd8b02={},_0x2ab2d6={},_0x16bcc0={'count':0x0,'rows':[]};var _0x555a31=_[_0xa000('0x2c')](db[_0xa000('0x2d')][_0xa000('0x2e')],function(_0x7a4735){return{'name':_0x7a4735[_0xa000('0x2f')],'type':_0x7a4735[_0xa000('0x30')][_0xa000('0x31')]};});_0x2ab2d6[_0xa000('0x32')]=_[_0xa000('0x2c')](_0x555a31,'name');_0x2ab2d6[_0xa000('0x33')]=_[_0xa000('0x34')](_0x13d32f[_0xa000('0x33')]);_0x2ab2d6[_0xa000('0x35')]=_[_0xa000('0x36')](_0x2ab2d6[_0xa000('0x32')],_0x2ab2d6['query']);_0xbd8b02[_0xa000('0x37')]=_[_0xa000('0x36')](_0x2ab2d6[_0xa000('0x32')],qs[_0xa000('0x38')](_0x13d32f[_0xa000('0x33')][_0xa000('0x38')]));_0xbd8b02[_0xa000('0x37')]=_0xbd8b02['attributes'][_0xa000('0x39')]?_0xbd8b02[_0xa000('0x37')]:_0x2ab2d6[_0xa000('0x32')];if(!_0x13d32f[_0xa000('0x33')][_0xa000('0x3a')](_0xa000('0x3b'))){_0xbd8b02[_0xa000('0x1f')]=qs[_0xa000('0x1f')](_0x13d32f['query'][_0xa000('0x1f')]);_0xbd8b02[_0xa000('0x1d')]=qs[_0xa000('0x1d')](_0x13d32f[_0xa000('0x33')]['offset']);}_0xbd8b02[_0xa000('0x3c')]=qs[_0xa000('0x3d')](_0x13d32f[_0xa000('0x33')][_0xa000('0x3d')]);_0xbd8b02['where']=qs['filters'](_[_0xa000('0x3e')](_0x13d32f[_0xa000('0x33')],_0x2ab2d6[_0xa000('0x35')]),_0x555a31);if(_0x13d32f[_0xa000('0x33')][_0xa000('0x3f')]){_0xbd8b02[_0xa000('0x40')]=_[_0xa000('0x41')](_0xbd8b02[_0xa000('0x40')],{'$or':_[_0xa000('0x2c')](_0x555a31,function(_0x4bc043){if(_0x4bc043[_0xa000('0x30')]!==_0xa000('0x42')){var _0x4a5e01={};_0x4a5e01[_0x4bc043[_0xa000('0x2a')]]={'$like':'%'+_0x13d32f[_0xa000('0x33')][_0xa000('0x3f')]+'%'};return _0x4a5e01;}})});}_0xbd8b02=_[_0xa000('0x41')]({},_0xbd8b02,_0x13d32f[_0xa000('0x43')]);var _0x44a8c6={'where':_0xbd8b02[_0xa000('0x40')]};return db['VoiceQueuesLog'][_0xa000('0x20')](_0x44a8c6)[_0xa000('0x27')](function(_0x133822){_0x16bcc0['count']=_0x133822;if(_0x13d32f[_0xa000('0x33')]['includeAll']){_0xbd8b02[_0xa000('0x44')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0xbd8b02);})[_0xa000('0x27')](function(_0x3ec08c){_0x16bcc0[_0xa000('0x45')]=_0x3ec08c;return _0x16bcc0;})[_0xa000('0x27')](respondWithFilteredResult(_0xe85bbc,_0xbd8b02))['catch'](handleError(_0xe85bbc,null));};exports[_0xa000('0x46')]=function(_0x4a16a9,_0x399c63){var _0x1221a9={'raw':!![],'where':{'id':_0x4a16a9['params']['id']}},_0x4203f5={};_0x4203f5[_0xa000('0x32')]=_[_0xa000('0x34')](db['VoiceQueuesLog'][_0xa000('0x2e')]);_0x4203f5[_0xa000('0x33')]=_[_0xa000('0x34')](_0x4a16a9[_0xa000('0x33')]);_0x4203f5[_0xa000('0x35')]=_['intersection'](_0x4203f5['model'],_0x4203f5[_0xa000('0x33')]);_0x1221a9[_0xa000('0x37')]=_[_0xa000('0x36')](_0x4203f5[_0xa000('0x32')],qs[_0xa000('0x38')](_0x4a16a9[_0xa000('0x33')][_0xa000('0x38')]));_0x1221a9['attributes']=_0x1221a9[_0xa000('0x37')][_0xa000('0x39')]?_0x1221a9['attributes']:_0x4203f5['model'];if(_0x4a16a9[_0xa000('0x33')][_0xa000('0x47')]){_0x1221a9[_0xa000('0x44')]=[{'all':!![]}];}_0x1221a9=_[_0xa000('0x41')]({},_0x1221a9,_0x4a16a9[_0xa000('0x43')]);return db[_0xa000('0x2d')][_0xa000('0x48')](_0x1221a9)[_0xa000('0x27')](handleEntityNotFound(_0x399c63,null))[_0xa000('0x27')](respondWithResult(_0x399c63,null))[_0xa000('0x49')](handleError(_0x399c63,null));};exports[_0xa000('0x4a')]=function(_0x1b406e,_0x2d1cd7){return db[_0xa000('0x2d')][_0xa000('0x4a')](_0x1b406e[_0xa000('0x4b')],{})[_0xa000('0x27')](respondWithResult(_0x2d1cd7,0xc9))[_0xa000('0x49')](handleError(_0x2d1cd7,null));};exports[_0xa000('0x4c')]=function(_0xe7f2a0,_0x3b323c){if(_0xe7f2a0['body']['id']){delete _0xe7f2a0[_0xa000('0x4b')]['id'];}return db[_0xa000('0x2d')]['find']({'where':{'id':_0xe7f2a0['params']['id']}})[_0xa000('0x27')](handleEntityNotFound(_0x3b323c,null))[_0xa000('0x27')](saveUpdates(_0xe7f2a0[_0xa000('0x4b')],null))[_0xa000('0x27')](respondWithResult(_0x3b323c,null))['catch'](handleError(_0x3b323c,null));};exports[_0xa000('0x28')]=function(_0x22ab2a,_0x5a0ecc){return db['VoiceQueuesLog']['find']({'where':{'id':_0x22ab2a[_0xa000('0x4d')]['id']}})[_0xa000('0x27')](handleEntityNotFound(_0x5a0ecc,null))[_0xa000('0x27')](removeEntity(_0x5a0ecc,null))[_0xa000('0x49')](handleError(_0x5a0ecc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b31edb5..60ca537 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 _0x0c2b=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x568e6e,_0x528ae1){var _0x5268b0=function(_0x3fa8bb){while(--_0x3fa8bb){_0x568e6e['push'](_0x568e6e['shift']());}};_0x5268b0(++_0x528ae1);}(_0x0c2b,0x134));var _0xb0c2=function(_0x455d23,_0x234e94){_0x455d23=_0x455d23-0x0;var _0xb87905=_0x0c2b[_0x455d23];return _0xb87905;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb0c2('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0c2('0x3'));var fs=require('fs');var path=require(_0xb0c2('0x4'));var rimraf=require(_0xb0c2('0x5'));var config=require(_0xb0c2('0x6'));var attributes=require(_0xb0c2('0x7'));module['exports']=function(_0x514b10,_0x1f0b7e){return _0x514b10[_0xb0c2('0x8')](_0xb0c2('0x9'),attributes,{'tableName':_0xb0c2('0xa'),'paranoid':![],'indexes':[{'name':_0xb0c2('0xb'),'fields':[_0xb0c2('0xc'),_0xb0c2('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xacea=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event','dtm'];(function(_0x108439,_0x148cd7){var _0x9b635d=function(_0x1b44b0){while(--_0x1b44b0){_0x108439['push'](_0x108439['shift']());}};_0x9b635d(++_0x148cd7);}(_0xacea,0x138));var _0xaace=function(_0x53a246,_0x1d45e6){_0x53a246=_0x53a246-0x0;var _0x18407a=_0xacea[_0x53a246];return _0x18407a;};'use strict';var _=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var logger=require(_0xaace('0x2'))(_0xaace('0x3'));var moment=require('moment');var BPromise=require(_0xaace('0x4'));var rp=require(_0xaace('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaace('0x6'));var config=require(_0xaace('0x7'));var attributes=require(_0xaace('0x8'));module[_0xaace('0x9')]=function(_0x33aeb5,_0x538dcf){return _0x33aeb5['define']('VoiceQueuesLog',attributes,{'tableName':_0xaace('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xaace('0xb'),_0xaace('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 66ba872..b1e53f4 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 _0x6f33=['../../mysqldb','rpc','jayson/promise','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6f33,0x7a));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var util=require(_0x36f3('0x1'));var moment=require(_0x36f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f3('0x3'));var db=require(_0x36f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36f3('0x5'));var config=require('../../config/environment');var jayson=require(_0x36f3('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x257b9f,_0x491b61,_0x4129b0){return new BPromise(function(_0x2645e3,_0x6f1cbb){return client[_0x36f3('0x7')](_0x257b9f,_0x4129b0)['then'](function(_0x383f82){logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));logger[_0x36f3('0xb')](_0x36f3('0xc'),_0x491b61,_0x36f3('0xa'),JSON[_0x36f3('0xd')](_0x383f82));if(_0x383f82[_0x36f3('0xe')]){if(_0x383f82[_0x36f3('0xe')]['code']===0x1f4){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82['error'][_0x36f3('0xf')]);return _0x6f1cbb(_0x383f82['error'][_0x36f3('0xf')]);}logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82[_0x36f3('0xe')][_0x36f3('0xf')]);return _0x2645e3(_0x383f82['error'][_0x36f3('0xf')]);}else{logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));_0x2645e3(_0x383f82[_0x36f3('0x10')]['message']);}})[_0x36f3('0x11')](function(_0x411b0b){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x411b0b);_0x6f1cbb(_0x411b0b);});});} \ No newline at end of file +var _0x4ce5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird'];(function(_0x696c60,_0x4ff057){var _0x42411c=function(_0x4e84ab){while(--_0x4e84ab){_0x696c60['push'](_0x696c60['shift']());}};_0x42411c(++_0x4ff057);}(_0x4ce5,0x1b2));var _0x54ce=function(_0x3e660c,_0x470ec4){_0x3e660c=_0x3e660c-0x0;var _0x3f5a1f=_0x4ce5[_0x3e660c];return _0x3f5a1f;};'use strict';var _=require(_0x54ce('0x0'));var util=require('util');var moment=require(_0x54ce('0x1'));var BPromise=require(_0x54ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54ce('0x3'))['db'];var utils=require(_0x54ce('0x4'));var logger=require(_0x54ce('0x5'))(_0x54ce('0x6'));var config=require(_0x54ce('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x54ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33154e,_0xc1caec,_0x1f1ebb){return new BPromise(function(_0x5c65ed,_0x40c0e5){return client[_0x54ce('0x9')](_0x33154e,_0x1f1ebb)[_0x54ce('0xa')](function(_0x159741){logger[_0x54ce('0xb')](_0x54ce('0xc'),_0xc1caec,_0x54ce('0xd'));logger[_0x54ce('0xe')](_0x54ce('0xf'),_0xc1caec,'request\x20sent',JSON['stringify'](_0x159741));if(_0x159741[_0x54ce('0x10')]){if(_0x159741['error']['code']===0x1f4){logger[_0x54ce('0x10')](_0x54ce('0xc'),_0xc1caec,_0x159741[_0x54ce('0x10')]['message']);return _0x40c0e5(_0x159741[_0x54ce('0x10')]['message']);}logger['error'](_0x54ce('0xc'),_0xc1caec,_0x159741['error'][_0x54ce('0x11')]);return _0x5c65ed(_0x159741[_0x54ce('0x10')][_0x54ce('0x11')]);}else{logger['info'](_0x54ce('0xc'),_0xc1caec,_0x54ce('0xd'));_0x5c65ed(_0x159741['result'][_0x54ce('0x11')]);}})[_0x54ce('0x12')](function(_0x19c34c){logger['error'](_0x54ce('0xc'),_0xc1caec,_0x19c34c);_0x40c0e5(_0x19c34c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 57f5e02..80f7f87 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 _0x495c=['express','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','/describe','describe','show','/:id/download','downloads','/:id/transcribe','post','create','runTranscribe','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x495c,0x93));var _0xc495=function(_0x768e87,_0x5adbcd){_0x768e87=_0x768e87-0x0;var _0x24c52f=_0x495c[_0x768e87];return _0x24c52f;};'use strict';var multer=require(_0xc495('0x0'));var util=require(_0xc495('0x1'));var path=require(_0xc495('0x2'));var timeout=require('connect-timeout');var express=require(_0xc495('0x3'));var router=express[_0xc495('0x4')]();var fs_extra=require(_0xc495('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc495('0x6'));var config=require('../../config/environment');var controller=require(_0xc495('0x7'));router[_0xc495('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc495('0x8')](_0xc495('0x9'),auth['isAuthenticated'](),controller[_0xc495('0xa')]);router[_0xc495('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc495('0xb')]);router[_0xc495('0x8')](_0xc495('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xc495('0x8')]('/:id/downloads',controller[_0xc495('0xd')]);router[_0xc495('0x8')](_0xc495('0xe'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xc495('0xf')]('/',auth['isAuthenticated'](),controller[_0xc495('0x10')]);router[_0xc495('0xf')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xc495('0x11')]);router[_0xc495('0x12')](_0xc495('0x13'),auth[_0xc495('0x14')](),controller[_0xc495('0x15')]);router[_0xc495('0x16')](_0xc495('0x13'),auth['isAuthenticated'](),controller[_0xc495('0x17')]);module[_0xc495('0x18')]=router; \ No newline at end of file +var _0x90fa=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer'];(function(_0x37f03a,_0x27e64f){var _0x2fd144=function(_0x302e3f){while(--_0x302e3f){_0x37f03a['push'](_0x37f03a['shift']());}};_0x2fd144(++_0x27e64f);}(_0x90fa,0x19f));var _0xa90f=function(_0x28d957,_0x220f06){_0x28d957=_0x28d957-0x0;var _0x23e265=_0x90fa[_0x28d957];return _0x23e265;};'use strict';var multer=require(_0xa90f('0x0'));var util=require('util');var path=require(_0xa90f('0x1'));var timeout=require(_0xa90f('0x2'));var express=require('express');var router=express[_0xa90f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa90f('0x4'));var interaction=require(_0xa90f('0x5'));var config=require(_0xa90f('0x6'));var controller=require('./voiceRecording.controller');router[_0xa90f('0x7')]('/',auth['isAuthenticated'](),controller[_0xa90f('0x8')]);router[_0xa90f('0x7')]('/describe',auth[_0xa90f('0x9')](),controller['describe']);router['get']('/:id',auth[_0xa90f('0x9')](),controller[_0xa90f('0xa')]);router['get'](_0xa90f('0xb'),auth['isAuthenticated'](),controller[_0xa90f('0xc')]);router[_0xa90f('0x7')](_0xa90f('0xd'),controller[_0xa90f('0xe')]);router['get'](_0xa90f('0xf'),auth[_0xa90f('0x9')](),controller[_0xa90f('0x10')]);router[_0xa90f('0x11')]('/',auth[_0xa90f('0x9')](),controller[_0xa90f('0x12')]);router[_0xa90f('0x11')](_0xa90f('0xf'),auth[_0xa90f('0x9')](),controller[_0xa90f('0x13')]);router[_0xa90f('0x14')](_0xa90f('0x15'),auth[_0xa90f('0x9')](),controller[_0xa90f('0x16')]);router[_0xa90f('0x17')](_0xa90f('0x15'),auth[_0xa90f('0x9')](),controller[_0xa90f('0x18')]);module[_0xa90f('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 16edaa0..4d77b52 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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 677304a..8290c23 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 _0x698c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','show','params','rawAttributes','options','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','col','push','recording','Sequelize','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5f6e85,_0x11ca9c){var _0x22a42a=function(_0x42fd16){while(--_0x42fd16){_0x5f6e85['push'](_0x5f6e85['shift']());}};_0x22a42a(++_0x11ca9c);}(_0x698c,0x1b7));var _0xc698=function(_0x17244a,_0x3ffea7){_0x17244a=_0x17244a-0x0;var _0x1c74e5=_0x698c[_0x17244a];return _0x1c74e5;};'use strict';var emlformat=require(_0xc698('0x0'));var rimraf=require(_0xc698('0x1'));var zipdir=require(_0xc698('0x2'));var jsonpatch=require(_0xc698('0x3'));var rp=require(_0xc698('0x4'));var moment=require('moment');var BPromise=require(_0xc698('0x5'));var Mustache=require(_0xc698('0x6'));var util=require(_0xc698('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc698('0x8'));var ejs=require(_0xc698('0x9'));var fs=require('fs');var fs_extra=require(_0xc698('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc698('0xb'));var jsforce=require(_0xc698('0xc'));var deskjs=require(_0xc698('0xd'));var toCsv=require(_0xc698('0x8'));var querystring=require(_0xc698('0xe'));var Papa=require('papaparse');var AWS=require(_0xc698('0xf'));var uuidv4=require(_0xc698('0x10'));var Redis=require(_0xc698('0x11'));var authService=require(_0xc698('0x12'));var qs=require(_0xc698('0x13'));var as=require(_0xc698('0x14'));var hardwareService=require(_0xc698('0x15'));var logger=require(_0xc698('0x16'))(_0xc698('0x17'));var utils=require(_0xc698('0x18'));var config=require(_0xc698('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc698('0x1a'))['db'];function respondWithStatusCode(_0x2452b8,_0x22dc77){_0x22dc77=_0x22dc77||0xcc;return function(_0x449176){if(_0x449176){return _0x2452b8[_0xc698('0x1b')](_0x22dc77);}return _0x2452b8[_0xc698('0x1c')](_0x22dc77)[_0xc698('0x1d')]();};}function respondWithResult(_0x41cdc6,_0x2f32dd){_0x2f32dd=_0x2f32dd||0xc8;return function(_0x768258){if(_0x768258){return _0x41cdc6['status'](_0x2f32dd)[_0xc698('0x1e')](_0x768258);}};}function respondWithFilteredResult(_0x21da8f,_0x38e350){return function(_0xad2d4e){if(_0xad2d4e){var _0x10f3ff=typeof _0x38e350[_0xc698('0x1f')]===_0xc698('0x20')&&typeof _0x38e350[_0xc698('0x21')]==='undefined';var _0x3c8beb=_0xad2d4e[_0xc698('0x22')];var _0x4a0243=_0x10f3ff?0x0:_0x38e350[_0xc698('0x1f')];var _0x21c3f3=_0x10f3ff?_0xad2d4e[_0xc698('0x22')]:_0x38e350[_0xc698('0x1f')]+_0x38e350['limit'];var _0x2e04ef;if(_0x21c3f3>=_0x3c8beb){_0x21c3f3=_0x3c8beb;_0x2e04ef=0xc8;}else{_0x2e04ef=0xce;}_0x21da8f['status'](_0x2e04ef);return _0x21da8f[_0xc698('0x23')](_0xc698('0x24'),_0x4a0243+'-'+_0x21c3f3+'/'+_0x3c8beb)[_0xc698('0x1e')](_0xad2d4e);}return null;};}function patchUpdates(_0x5e6a66){return function(_0x3d0739){try{jsonpatch['apply'](_0x3d0739,_0x5e6a66,!![]);}catch(_0x6010de){return BPromise['reject'](_0x6010de);}return _0x3d0739[_0xc698('0x25')]();};}function saveUpdates(_0x1f6166,_0x1022d5){return function(_0x3a5d35){if(_0x3a5d35){return _0x3a5d35['update'](_0x1f6166)[_0xc698('0x26')](function(_0x41f529){return _0x41f529;});}return null;};}function removeEntity(_0x17054c,_0x156d3f){return function(_0x5e5f81){if(_0x5e5f81){return _0x5e5f81[_0xc698('0x27')]()[_0xc698('0x26')](function(){_0x17054c[_0xc698('0x1c')](0xcc)[_0xc698('0x1d')]();});}};}function handleEntityNotFound(_0x75c5e0,_0x1f73c1){return function(_0x49ca13){if(!_0x49ca13){_0x75c5e0['sendStatus'](0x194);}return _0x49ca13;};}function handleError(_0x351740,_0x3cbf81){_0x3cbf81=_0x3cbf81||0x1f4;return function(_0x5d7724){logger[_0xc698('0x28')](_0x5d7724[_0xc698('0x29')]);if(_0x5d7724[_0xc698('0x2a')]){delete _0x5d7724['name'];}_0x351740[_0xc698('0x1c')](_0x3cbf81)['send'](_0x5d7724);};}exports[_0xc698('0x2b')]=function(_0xe8fd50,_0x4ab07b){var _0x2bd151={},_0x1a11bd={},_0x3de039={'count':0x0,'rows':[]};var _0x210132=_[_0xc698('0x2c')](db[_0xc698('0x2d')]['rawAttributes'],function(_0x126cbb){return{'name':_0x126cbb[_0xc698('0x2e')],'type':_0x126cbb[_0xc698('0x2f')][_0xc698('0x30')]};});_0x1a11bd[_0xc698('0x31')]=_[_0xc698('0x32')](_[_0xc698('0x2c')](_0x210132,'name'),[_0xc698('0x33')]);_0x1a11bd[_0xc698('0x34')]=_[_0xc698('0x35')](_0xe8fd50[_0xc698('0x34')]);_0x1a11bd[_0xc698('0x36')]=_[_0xc698('0x37')](_0x1a11bd['model'],_0x1a11bd['query']);_0x2bd151['attributes']=_[_0xc698('0x37')](_0x1a11bd[_0xc698('0x31')],qs['fields'](_0xe8fd50[_0xc698('0x34')][_0xc698('0x38')]));_0x2bd151[_0xc698('0x39')]=_0x2bd151[_0xc698('0x39')]['length']?_0x2bd151[_0xc698('0x39')]:_0x1a11bd[_0xc698('0x31')];if(!_0xe8fd50[_0xc698('0x34')][_0xc698('0x3a')](_0xc698('0x3b'))){_0x2bd151['limit']=qs[_0xc698('0x21')](_0xe8fd50[_0xc698('0x34')][_0xc698('0x21')]);_0x2bd151[_0xc698('0x1f')]=qs[_0xc698('0x1f')](_0xe8fd50[_0xc698('0x34')]['offset']);}_0x2bd151[_0xc698('0x3c')]=qs[_0xc698('0x3d')](_0xe8fd50[_0xc698('0x34')]['sort']);_0x2bd151['where']=qs['filters'](_[_0xc698('0x3e')](_0xe8fd50[_0xc698('0x34')],_0x1a11bd[_0xc698('0x36')]),_0x210132);if(_0xe8fd50[_0xc698('0x34')][_0xc698('0x3f')]){_0x2bd151[_0xc698('0x40')]=_['merge'](_0x2bd151['where'],{'$or':_[_0xc698('0x2c')](_0x210132,function(_0x598c52){if(_0x598c52[_0xc698('0x2f')]!==_0xc698('0x41')){var _0x280e3f={};_0x280e3f[_0x598c52[_0xc698('0x2a')]]={'$like':'%'+_0xe8fd50[_0xc698('0x34')][_0xc698('0x3f')]+'%'};return _0x280e3f;}})});}_0x2bd151=_[_0xc698('0x42')]({},_0x2bd151,_0xe8fd50['options']);var _0x122394={'where':_0x2bd151[_0xc698('0x40')]};return db[_0xc698('0x2d')][_0xc698('0x22')](_0x122394)[_0xc698('0x26')](function(_0x1e9228){_0x3de039['count']=_0x1e9228;if(_0xe8fd50[_0xc698('0x34')][_0xc698('0x43')]){_0x2bd151[_0xc698('0x44')]=[{'all':!![]}];}return db[_0xc698('0x2d')][_0xc698('0x45')](_0x2bd151);})[_0xc698('0x26')](function(_0x18dd69){_0x3de039['rows']=_0x18dd69;return _0x3de039;})[_0xc698('0x26')](respondWithFilteredResult(_0x4ab07b,_0x2bd151))['catch'](handleError(_0x4ab07b,null));};exports[_0xc698('0x46')]=function(_0x2c7309,_0x39e374){var _0x3f7f51={'raw':![],'where':{'id':_0x2c7309[_0xc698('0x47')]['id']}},_0x2b0bc7={};_0x2b0bc7[_0xc698('0x31')]=_[_0xc698('0x35')](db[_0xc698('0x2d')][_0xc698('0x48')]);_0x2b0bc7[_0xc698('0x34')]=_['keys'](_0x2c7309[_0xc698('0x34')]);_0x2b0bc7[_0xc698('0x36')]=_[_0xc698('0x37')](_0x2b0bc7[_0xc698('0x31')],_0x2b0bc7[_0xc698('0x34')]);_0x3f7f51[_0xc698('0x39')]=_[_0xc698('0x37')](_0x2b0bc7[_0xc698('0x31')],qs['fields'](_0x2c7309[_0xc698('0x34')][_0xc698('0x38')]));_0x3f7f51[_0xc698('0x39')]=_0x3f7f51['attributes']['length']?_0x3f7f51[_0xc698('0x39')]:_0x2b0bc7[_0xc698('0x31')];if(_0x2c7309[_0xc698('0x34')][_0xc698('0x43')]){_0x3f7f51[_0xc698('0x44')]=[{'all':!![]}];}_0x3f7f51=_[_0xc698('0x42')]({},_0x3f7f51,_0x2c7309[_0xc698('0x49')]);return db['VoiceRecording'][_0xc698('0x4a')](_0x3f7f51)['then'](handleEntityNotFound(_0x39e374,null))['then'](respondWithResult(_0x39e374,null))[_0xc698('0x4b')](handleError(_0x39e374,null));};exports['create']=function(_0x542a59,_0x1ff10f){return db[_0xc698('0x2d')][_0xc698('0x4c')](_0x542a59['body'],{})['then'](respondWithResult(_0x1ff10f,0xc9))[_0xc698('0x4b')](handleError(_0x1ff10f,null));};exports['update']=function(_0x496966,_0x3c59af){if(_0x496966['body']['id']){delete _0x496966[_0xc698('0x4d')]['id'];}return db[_0xc698('0x2d')]['find']({'where':{'id':_0x496966[_0xc698('0x47')]['id']}})[_0xc698('0x26')](handleEntityNotFound(_0x3c59af,null))[_0xc698('0x26')](saveUpdates(_0x496966[_0xc698('0x4d')],null))['then'](respondWithResult(_0x3c59af,null))[_0xc698('0x4b')](handleError(_0x3c59af,null));};exports[_0xc698('0x4e')]=function(_0x1d5cec,_0x4fcdd4){return db['VoiceRecording'][_0xc698('0x4e')]()[_0xc698('0x26')](respondWithResult(_0x4fcdd4,null))[_0xc698('0x4b')](handleError(_0x4fcdd4,null));};exports[_0xc698('0x4f')]=function(_0xce2eb5,_0x2fbcbb,_0x3f8cd2){var _0x40a14d=require(_0xc698('0x50'));var _0x5f53ef=![];var _0x272866={};if(_0xce2eb5[_0xc698('0x34')][_0xc698('0x2f')]&&_0xce2eb5[_0xc698('0x34')]['type']==='uniqueid'){_0x272866[_0xc698('0x51')]=_0xce2eb5[_0xc698('0x47')]['id'];}else{_0x272866['id']=_0xce2eb5[_0xc698('0x47')]['id'];}return db['VoiceRecording']['find']({'where':_0x272866,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x2fbcbb,null))[_0xc698('0x26')](function(_0x32a91e){if(_0x32a91e){var _0x365497=_0x32a91e[_0xc698('0x52')];var _0x2f8090=util['format'](_0xc698('0x53'),_0x365497);if(fs[_0xc698('0x54')](_0x2f8090)){_0x5f53ef=!![];return _0x40a14d[_0xc698('0x55')](_0x2f8090,_0x365497,config['secrets']['recording'])[_0xc698('0x26')](function(){return _0x32a91e;});}return _0x32a91e;}})['then'](function(_0x37775e){if(_0x37775e){var _0x5f3afe=_0x37775e['value'];if(!fs['existsSync'](_0x5f3afe)){throw new db['Sequelize'][(_0xc698('0x56'))](_0xc698('0x57'));}if(_0x37775e[_0xc698('0x58')]){return _0x2fbcbb['download'](_0x5f3afe,_0x37775e[_0xc698('0x58')]+path[_0xc698('0x59')](_0x5f3afe),function(){if(_0x5f53ef){fs['unlink'](_0x5f3afe);}});}else{return _0x2fbcbb[_0xc698('0x4f')](_0x5f3afe,function(_0x554a26){if(_0x5f53ef){fs[_0xc698('0x5a')](_0x5f3afe);}});}}})[_0xc698('0x4b')](function(_0x874b72){if(_0x874b72[_0xc698('0x5b')]===_0xc698('0x57')){_0x2fbcbb['status'](0x194)[_0xc698('0x5c')](_0xc698('0x5d'));}else{return handleError(_0x2fbcbb,null);}});};exports[_0xc698('0x5e')]=function(_0x15a32a,_0x29f069,_0x34b32e){var _0x2bee3f=require('../../components/encryptor');var _0x54c713=![];var _0xe9c415={'$and':[db[_0xc698('0x5f')][_0xc698('0x40')](db[_0xc698('0x5f')]['fn']('MD5',db[_0xc698('0x5f')][_0xc698('0x60')](_0xc698('0x51'))),_0x15a32a[_0xc698('0x34')]['token'])]};if(_0x15a32a[_0xc698('0x34')][_0xc698('0x2f')]&&_0x15a32a['query'][_0xc698('0x2f')]==='uniqueid'){_0xe9c415['$and'][_0xc698('0x61')]({'uniqueid':_0x15a32a[_0xc698('0x47')]['id']});}else{_0xe9c415['$and'][_0xc698('0x61')]({'id':_0x15a32a['params']['id']});}return db[_0xc698('0x2d')][_0xc698('0x4a')]({'where':_0xe9c415,'attributes':['id','value'],'raw':!![]})[_0xc698('0x26')](handleEntityNotFound(_0x29f069,null))[_0xc698('0x26')](function(_0x17fdf2){if(_0x17fdf2){var _0x384b81=util['format'](_0xc698('0x53'),_0x17fdf2[_0xc698('0x52')]);if(fs[_0xc698('0x54')](_0x384b81)){_0x54c713=!![];return _0x2bee3f[_0xc698('0x55')](_0x384b81,_0x17fdf2['value'],config['secrets'][_0xc698('0x62')])[_0xc698('0x26')](function(){return _0x17fdf2;});}return _0x17fdf2;}})[_0xc698('0x26')](function(_0xe89553){if(_0xe89553){if(!fs['existsSync'](_0xe89553[_0xc698('0x52')])){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))](_0xc698('0x57'));}if(_0xe89553[_0xc698('0x58')]){return _0x29f069[_0xc698('0x4f')](_0xe89553[_0xc698('0x52')],_0xe89553[_0xc698('0x58')]+path[_0xc698('0x59')](_0xe89553[_0xc698('0x52')]),function(){if(_0x54c713){fs[_0xc698('0x5a')](_0xe89553[_0xc698('0x52')]);}});}else{return _0x29f069[_0xc698('0x4f')](_0xe89553[_0xc698('0x52')],function(_0x521d6a){if(_0x54c713){fs[_0xc698('0x5a')](_0xe89553[_0xc698('0x52')]);}});}}})[_0xc698('0x4b')](handleError(_0x29f069,null));};exports[_0xc698('0x27')]=function(_0x3264d4,_0x5b3b97){return db[_0xc698('0x2d')][_0xc698('0x4a')]({'where':{'id':_0x3264d4[_0xc698('0x47')]['id']}})[_0xc698('0x26')](function(_0x27dec0){if(_[_0xc698('0x64')](_0x27dec0)){throw new ReferenceError(_0xc698('0x65'));}return _0x27dec0;})[_0xc698('0x26')](function(_0x3f659e){var _0x4b2f67=_0x3f659e['value'];logger['info'](_0xc698('0x66'),_0x4b2f67);if(!_['isNil'](_0x3f659e[_0xc698('0x52')])&&fs['existsSync'](_0x4b2f67)){logger[_0xc698('0x67')](_0xc698('0x68')+_0x4b2f67+_0xc698('0x69'));fs[_0xc698('0x6a')](_0x4b2f67);}_0x4b2f67=_0x4b2f67+_0xc698('0x6b');if(!_[_0xc698('0x64')](_0x3f659e['value'])&&fs[_0xc698('0x54')](_0x4b2f67)){logger[_0xc698('0x67')]('File:\x20\x22'+_0x4b2f67+_0xc698('0x69'));fs[_0xc698('0x6a')](_0x4b2f67);}return _0x3f659e;})[_0xc698('0x26')](function(_0x47a008){if(!_0x47a008)throw new InternalError();return _0x47a008['destroy']();})[_0xc698('0x26')](function(){_0x5b3b97[_0xc698('0x1c')](0xcc)[_0xc698('0x1d')]();})[_0xc698('0x4b')](handleError(_0x5b3b97,null));};function getBucketslist(_0x5ea9dd,_0x4ed823,_0x31d637){return new Promise(function(_0x2a3f27,_0x530d78){var _0x402b6b=new AWS['S3']({'accessKeyId':_0x4ed823,'secretAccessKey':_0x5ea9dd,'region':_0x31d637});_0x402b6b[_0xc698('0x6c')]({},function(_0x5e9511,_0x265b54){if(_0x5e9511){return _0x530d78(_0x5e9511);}else{return _0x2a3f27(_0x265b54);}});});}function createBucket(_0x131a9f,_0xd9e429,_0x483f8f,_0x41eaad){return new Promise(function(_0x1124fd,_0x1acad8){var _0x140d59=new AWS['S3']({'accessKeyId':_0xd9e429,'secretAccessKey':_0x131a9f,'region':_0x483f8f});_0x140d59[_0xc698('0x6d')]({'Bucket':_0x41eaad},function(_0x5a98dc,_0x25bc39){if(_0x5a98dc){return _0x1acad8(_0x5a98dc);}else{return _0x1124fd(_0x25bc39);}});});}function uploadFile(_0x61832f,_0x3359fd,_0x444bf2,_0x2cb500,_0x2eea61,_0x2a42a){return new Promise(function(_0x2248d9,_0xccd83d){var _0x79e252=new AWS['S3']({'accessKeyId':_0x3359fd,'secretAccessKey':_0x61832f,'region':_0x444bf2});_0x79e252[_0xc698('0x6e')]({'Bucket':_0x2cb500,'Key':_0x2eea61,'Body':_0x2a42a},function(_0x5c7d62,_0x5c71a8){if(_0x5c7d62){return _0xccd83d(_0x5c7d62);}else{return _0x2248d9(_0x5c71a8);}});});}function startTranscribe(_0x142c73,_0x4fd6c2,_0x13b513,_0x2a8332,_0x4d5eac,_0x153f19){return new Promise(function(_0x1aecbc,_0x305337){var _0x27cd50=new AWS[(_0xc698('0x6f'))]({'accessKeyId':_0x4fd6c2,'secretAccessKey':_0x142c73,'region':_0x13b513});_0x27cd50['startTranscriptionJob']({'TranscriptionJobName':_0x2a8332,'LanguageCode':_0x4d5eac,'Media':{'MediaFileUri':_0x153f19}},function(_0xf288eb,_0x4beb92){if(_0xf288eb){return _0x305337(_0xf288eb);}else{return _0x1aecbc(_0x4beb92);}});});}function transcribe(_0x3a2194,_0x3ab8a7,_0x3ec942,_0x4f4a7b,_0x1b1552,_0x3d2a0c,_0x42a3a0){return new Promise(function(_0x235831,_0x2d07a1){var _0x3fb8f4={};logger[_0xc698('0x67')](util[_0xc698('0x33')](_0xc698('0x70'),_0x3a2194,_0x1b1552));return uploadFile(_0x3ab8a7,_0x3ec942,_0x4f4a7b,_0x1b1552,path[_0xc698('0x71')](_0x3d2a0c),fs[_0xc698('0x72')](_0x3d2a0c))[_0xc698('0x26')](function(_0x4f1359){logger['info'](util[_0xc698('0x33')](_0xc698('0x73'),_0x3a2194,_0x1b1552,_0x4f1359[_0xc698('0x74')]));_0x3fb8f4[_0xc698('0x75')]=_0x4f1359[_0xc698('0x76')];_0x3fb8f4[_0xc698('0x77')]=_0x4f1359['Location'];logger[_0xc698('0x67')](util[_0xc698('0x33')](_0xc698('0x78'),_0x3a2194));return startTranscribe(_0x3ab8a7,_0x3ec942,_0x4f4a7b,uuidv4(),_0x42a3a0,_0x4f1359[_0xc698('0x74')]);})[_0xc698('0x26')](function(_0xb7d2a2){logger[_0xc698('0x67')](util['format'](_0xc698('0x79'),_0x3a2194,_0xb7d2a2[_0xc698('0x7a')][_0xc698('0x7b')]));_0x3fb8f4[_0xc698('0x7c')]=_0xb7d2a2[_0xc698('0x7a')][_0xc698('0x7b')];_0x3fb8f4[_0xc698('0x7d')]=_0xb7d2a2[_0xc698('0x7a')]['TranscriptionJobStatus'];return _0x235831(_0x3fb8f4);})[_0xc698('0x4b')](function(_0x3aa1dd){return _0x2d07a1(_0x3aa1dd);});});}exports[_0xc698('0x7e')]=function(_0x5eb08b,_0x2a8986,_0x2b54ec){var _0x37e6cc;var _0x1431c2;var _0x53e4b3;var _0x150e15=require(_0xc698('0x50'));return db[_0xc698('0x2d')][_0xc698('0x7f')]({'where':{'id':_0x5eb08b[_0xc698('0x47')]['id']}})['then'](function(_0x533605){if(_0x533605){var _0x231fba=util[_0xc698('0x33')](_0xc698('0x53'),_0x533605[_0xc698('0x52')]);if(fs[_0xc698('0x54')](_0x231fba)){cypher=!![];return _0x150e15['decryptFile'](_0x231fba,_0x533605['value'],config['secrets'][_0xc698('0x62')])['then'](function(){return _0x533605;});}return _0x533605;}})[_0xc698('0x26')](function(_0x24e2f1){if(!_0x24e2f1){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))](_0xc698('0x80'));}_0x1431c2=_0x24e2f1;return db[_0xc698('0x81')]['findOne']({'where':{'id':0x1}});})[_0xc698('0x26')](handleEntityNotFound(_0x2a8986,null))[_0xc698('0x26')](function(_0x1336b0){if(_0x1336b0){_0x37e6cc=_0x1336b0;if(!_0x37e6cc[_0xc698('0x82')]||!_0x37e6cc[_0xc698('0x83')]||!_0x37e6cc[_0xc698('0x84')]||!_0x37e6cc[_0xc698('0x85')]||!_0x37e6cc[_0xc698('0x75')]){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))]('Transcribe\x20not\x20configured');}if(_0x5eb08b['body'][_0xc698('0x86')]&&(!_0x37e6cc[_0xc698('0x87')]||!_0x37e6cc[_0xc698('0x88')]||!_0x37e6cc['sentimentRegion']||!_0x37e6cc['language']||!_0x37e6cc[_0xc698('0x75')])){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))](_0xc698('0x89'));}return db['CloudProvider'][_0xc698('0x7f')]({'where':{'id':_0x37e6cc[_0xc698('0x83')]}});}})[_0xc698('0x26')](function(_0x310758){if(!_0x310758){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))](_0xc698('0x8a'));}if(!_0x310758[_0xc698('0x8b')]||!_0x310758[_0xc698('0x8c')]){throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))](_0xc698('0x8d'));}_0x53e4b3=_0x310758;return getBucketslist(_0x53e4b3[_0xc698('0x8b')],_0x53e4b3[_0xc698('0x8c')],_0x37e6cc[_0xc698('0x84')]);})[_0xc698('0x26')](function(_0x1a252b){if(_0x1a252b&&_0x1a252b['Buckets']){var _0x118ac6=_[_0xc698('0x4a')](_0x1a252b[_0xc698('0x8e')],function(_0x35edfa){return _0x35edfa[_0xc698('0x8f')]===_0x37e6cc[_0xc698('0x75')];});if(!_0x118ac6){logger[_0xc698('0x67')](util[_0xc698('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5eb08b[_0xc698('0x47')]['id'],_0x37e6cc[_0xc698('0x75')]));return createBucket(_0x53e4b3['data1'],_0x53e4b3[_0xc698('0x8c')],_0x37e6cc[_0xc698('0x84')],_0x37e6cc[_0xc698('0x75')]);}logger[_0xc698('0x67')](util['format'](_0xc698('0x90'),_0x5eb08b[_0xc698('0x47')]['id'],_0x37e6cc[_0xc698('0x75')]));return;}})[_0xc698('0x26')](function(_0x142819){if(_0x1431c2[_0xc698('0x7d')]===_0xc698('0x91')){return transcribe(_0x5eb08b[_0xc698('0x47')]['id'],_0x53e4b3[_0xc698('0x8b')],_0x53e4b3[_0xc698('0x8c')],_0x37e6cc[_0xc698('0x84')],_0x37e6cc[_0xc698('0x75')],_0x1431c2[_0xc698('0x52')],_0x37e6cc['language']);}else{logger[_0xc698('0x67')](util[_0xc698('0x33')](_0xc698('0x92'),_0x5eb08b[_0xc698('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xc698('0x26')](function(_0x1c887b){if(_0x1c887b){_0x1c887b[_0xc698('0x93')]=_0x5eb08b[_0xc698('0x4d')][_0xc698('0x86')];return _0x1431c2[_0xc698('0x94')](_0x1c887b);}})[_0xc698('0x26')](respondWithResult(_0x2a8986,null))[_0xc698('0x4b')](handleError(_0x2a8986,null));};function writeFile(_0x3afe00,_0x1fc54c){return new Promise(function(_0x41613c,_0x10435a){fs[_0xc698('0x95')](_0x1fc54c,_0x3afe00,function(_0x5c16b3,_0x19370d){if(_0x5c16b3){return _0x10435a(_0x5c16b3);}else{return _0x41613c(_0x19370d);}});});}exports['downloadTranscribe']=function(_0x3e4936,_0x39cbab,_0xf8e999){return db['VoiceRecording'][_0xc698('0x7f')]({'where':{'id':_0x3e4936['params']['id']}})[_0xc698('0x26')](handleEntityNotFound(_0x39cbab))['then'](function(_0x5fd233){if(_0x5fd233&&_0x5fd233[_0xc698('0x96')]){var _0x2f5977=_0x5fd233[_0xc698('0x96')];var _0x2884df=config['root']+_0xc698('0x97')+_0x5fd233['id']+_0xc698('0x98');if(fs['existsSync'](_0x2884df)){return _0x2884df;}return writeFile(_0x2f5977,_0x2884df)[_0xc698('0x26')](function(){return _0x2884df;});}else{throw new db[(_0xc698('0x63'))][(_0xc698('0x56'))]('Transcript\x20not\x20available');}})[_0xc698('0x26')](function(_0xf1ec38){return _0x39cbab['download'](_0xf1ec38);})[_0xc698('0x4b')](handleError(_0x39cbab));}; \ No newline at end of file +var _0xdd68=['query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','secrets','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','format','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','aws-sdk','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','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','keys'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xdd68,0x196));var _0x8dd6=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0xdd68[_0x5cc3d4];return _0x17ca31;};'use strict';var emlformat=require(_0x8dd6('0x0'));var rimraf=require(_0x8dd6('0x1'));var zipdir=require(_0x8dd6('0x2'));var jsonpatch=require(_0x8dd6('0x3'));var rp=require(_0x8dd6('0x4'));var moment=require(_0x8dd6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8dd6('0x6'));var path=require('path');var sox=require(_0x8dd6('0x7'));var csv=require(_0x8dd6('0x8'));var ejs=require(_0x8dd6('0x9'));var fs=require('fs');var fs_extra=require(_0x8dd6('0xa'));var _=require('lodash');var squel=require(_0x8dd6('0xb'));var crypto=require(_0x8dd6('0xc'));var jsforce=require(_0x8dd6('0xd'));var deskjs=require(_0x8dd6('0xe'));var toCsv=require(_0x8dd6('0x8'));var querystring=require(_0x8dd6('0xf'));var Papa=require('papaparse');var AWS=require(_0x8dd6('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x8dd6('0x11'));var authService=require(_0x8dd6('0x12'));var qs=require(_0x8dd6('0x13'));var as=require(_0x8dd6('0x14'));var hardwareService=require(_0x8dd6('0x15'));var logger=require(_0x8dd6('0x16'))(_0x8dd6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8dd6('0x18'));var db=require(_0x8dd6('0x19'))['db'];function respondWithStatusCode(_0x447c2f,_0x53d76a){_0x53d76a=_0x53d76a||0xcc;return function(_0x105e62){if(_0x105e62){return _0x447c2f[_0x8dd6('0x1a')](_0x53d76a);}return _0x447c2f[_0x8dd6('0x1b')](_0x53d76a)[_0x8dd6('0x1c')]();};}function respondWithResult(_0x418d58,_0x282830){_0x282830=_0x282830||0xc8;return function(_0x3a36f4){if(_0x3a36f4){return _0x418d58[_0x8dd6('0x1b')](_0x282830)[_0x8dd6('0x1d')](_0x3a36f4);}};}function respondWithFilteredResult(_0x5a60bf,_0x5bfb90){return function(_0x3441d){if(_0x3441d){var _0x3fc62d=typeof _0x5bfb90[_0x8dd6('0x1e')]==='undefined'&&typeof _0x5bfb90[_0x8dd6('0x1f')]===_0x8dd6('0x20');var _0x2b3f96=_0x3441d[_0x8dd6('0x21')];var _0x3edd96=_0x3fc62d?0x0:_0x5bfb90[_0x8dd6('0x1e')];var _0x1405b4=_0x3fc62d?_0x3441d[_0x8dd6('0x21')]:_0x5bfb90['offset']+_0x5bfb90[_0x8dd6('0x1f')];var _0x277360;if(_0x1405b4>=_0x2b3f96){_0x1405b4=_0x2b3f96;_0x277360=0xc8;}else{_0x277360=0xce;}_0x5a60bf['status'](_0x277360);return _0x5a60bf[_0x8dd6('0x22')](_0x8dd6('0x23'),_0x3edd96+'-'+_0x1405b4+'/'+_0x2b3f96)[_0x8dd6('0x1d')](_0x3441d);}return null;};}function patchUpdates(_0x5ee63f){return function(_0x4f9f3f){try{jsonpatch[_0x8dd6('0x24')](_0x4f9f3f,_0x5ee63f,!![]);}catch(_0x12a227){return BPromise['reject'](_0x12a227);}return _0x4f9f3f['save']();};}function saveUpdates(_0x5b13b6,_0x2411a2){return function(_0x878b31){if(_0x878b31){return _0x878b31[_0x8dd6('0x25')](_0x5b13b6)[_0x8dd6('0x26')](function(_0x1f50eb){return _0x1f50eb;});}return null;};}function removeEntity(_0x2e0a16,_0x1ba5f2){return function(_0x4e2abb){if(_0x4e2abb){return _0x4e2abb[_0x8dd6('0x27')]()[_0x8dd6('0x26')](function(){_0x2e0a16[_0x8dd6('0x1b')](0xcc)[_0x8dd6('0x1c')]();});}};}function handleEntityNotFound(_0x50b20e,_0x52954b){return function(_0x238739){if(!_0x238739){_0x50b20e['sendStatus'](0x194);}return _0x238739;};}function handleError(_0x122c4c,_0x5ac3e2){_0x5ac3e2=_0x5ac3e2||0x1f4;return function(_0x4fdde6){logger[_0x8dd6('0x28')](_0x4fdde6[_0x8dd6('0x29')]);if(_0x4fdde6[_0x8dd6('0x2a')]){delete _0x4fdde6[_0x8dd6('0x2a')];}_0x122c4c[_0x8dd6('0x1b')](_0x5ac3e2)[_0x8dd6('0x2b')](_0x4fdde6);};}exports['index']=function(_0x3ce827,_0xbb23){var _0x3ae586={},_0x3fd74f={},_0x57f49d={'count':0x0,'rows':[]};var _0x11a83e=_[_0x8dd6('0x2c')](db[_0x8dd6('0x2d')][_0x8dd6('0x2e')],function(_0x5d6843){return{'name':_0x5d6843[_0x8dd6('0x2f')],'type':_0x5d6843[_0x8dd6('0x30')]['key']};});_0x3fd74f['model']=_['differenceBy'](_[_0x8dd6('0x2c')](_0x11a83e,_0x8dd6('0x2a')),['format']);_0x3fd74f['query']=_[_0x8dd6('0x31')](_0x3ce827[_0x8dd6('0x32')]);_0x3fd74f['filters']=_[_0x8dd6('0x33')](_0x3fd74f[_0x8dd6('0x34')],_0x3fd74f[_0x8dd6('0x32')]);_0x3ae586[_0x8dd6('0x35')]=_[_0x8dd6('0x33')](_0x3fd74f[_0x8dd6('0x34')],qs[_0x8dd6('0x36')](_0x3ce827[_0x8dd6('0x32')][_0x8dd6('0x36')]));_0x3ae586['attributes']=_0x3ae586[_0x8dd6('0x35')][_0x8dd6('0x37')]?_0x3ae586[_0x8dd6('0x35')]:_0x3fd74f[_0x8dd6('0x34')];if(!_0x3ce827['query'][_0x8dd6('0x38')]('nolimit')){_0x3ae586[_0x8dd6('0x1f')]=qs[_0x8dd6('0x1f')](_0x3ce827[_0x8dd6('0x32')]['limit']);_0x3ae586[_0x8dd6('0x1e')]=qs[_0x8dd6('0x1e')](_0x3ce827['query'][_0x8dd6('0x1e')]);}_0x3ae586[_0x8dd6('0x39')]=qs[_0x8dd6('0x3a')](_0x3ce827['query'][_0x8dd6('0x3a')]);_0x3ae586[_0x8dd6('0x3b')]=qs[_0x8dd6('0x3c')](_[_0x8dd6('0x3d')](_0x3ce827[_0x8dd6('0x32')],_0x3fd74f[_0x8dd6('0x3c')]),_0x11a83e);if(_0x3ce827[_0x8dd6('0x32')][_0x8dd6('0x3e')]){_0x3ae586[_0x8dd6('0x3b')]=_['merge'](_0x3ae586[_0x8dd6('0x3b')],{'$or':_[_0x8dd6('0x2c')](_0x11a83e,function(_0x225563){if(_0x225563[_0x8dd6('0x30')]!=='VIRTUAL'){var _0x344aca={};_0x344aca[_0x225563[_0x8dd6('0x2a')]]={'$like':'%'+_0x3ce827[_0x8dd6('0x32')][_0x8dd6('0x3e')]+'%'};return _0x344aca;}})});}_0x3ae586=_[_0x8dd6('0x3f')]({},_0x3ae586,_0x3ce827[_0x8dd6('0x40')]);var _0x1aeaee={'where':_0x3ae586['where']};return db['VoiceRecording']['count'](_0x1aeaee)[_0x8dd6('0x26')](function(_0x3d2f40){_0x57f49d[_0x8dd6('0x21')]=_0x3d2f40;if(_0x3ce827[_0x8dd6('0x32')][_0x8dd6('0x41')]){_0x3ae586[_0x8dd6('0x42')]=[{'all':!![]}];}return db[_0x8dd6('0x2d')][_0x8dd6('0x43')](_0x3ae586);})[_0x8dd6('0x26')](function(_0x42120a){_0x57f49d[_0x8dd6('0x44')]=_0x42120a;return _0x57f49d;})['then'](respondWithFilteredResult(_0xbb23,_0x3ae586))[_0x8dd6('0x45')](handleError(_0xbb23,null));};exports['show']=function(_0x45d5c5,_0x1c74bf){var _0x361906={'raw':![],'where':{'id':_0x45d5c5[_0x8dd6('0x46')]['id']}},_0x36d385={};_0x36d385[_0x8dd6('0x34')]=_[_0x8dd6('0x31')](db[_0x8dd6('0x2d')]['rawAttributes']);_0x36d385[_0x8dd6('0x32')]=_[_0x8dd6('0x31')](_0x45d5c5[_0x8dd6('0x32')]);_0x36d385[_0x8dd6('0x3c')]=_[_0x8dd6('0x33')](_0x36d385['model'],_0x36d385[_0x8dd6('0x32')]);_0x361906[_0x8dd6('0x35')]=_[_0x8dd6('0x33')](_0x36d385[_0x8dd6('0x34')],qs['fields'](_0x45d5c5[_0x8dd6('0x32')]['fields']));_0x361906[_0x8dd6('0x35')]=_0x361906[_0x8dd6('0x35')][_0x8dd6('0x37')]?_0x361906[_0x8dd6('0x35')]:_0x36d385[_0x8dd6('0x34')];if(_0x45d5c5[_0x8dd6('0x32')][_0x8dd6('0x41')]){_0x361906[_0x8dd6('0x42')]=[{'all':!![]}];}_0x361906=_['merge']({},_0x361906,_0x45d5c5['options']);return db[_0x8dd6('0x2d')][_0x8dd6('0x47')](_0x361906)[_0x8dd6('0x26')](handleEntityNotFound(_0x1c74bf,null))[_0x8dd6('0x26')](respondWithResult(_0x1c74bf,null))[_0x8dd6('0x45')](handleError(_0x1c74bf,null));};exports[_0x8dd6('0x48')]=function(_0x56dc1c,_0x5f0e7e){return db['VoiceRecording'][_0x8dd6('0x48')](_0x56dc1c[_0x8dd6('0x49')],{})[_0x8dd6('0x26')](respondWithResult(_0x5f0e7e,0xc9))[_0x8dd6('0x45')](handleError(_0x5f0e7e,null));};exports[_0x8dd6('0x25')]=function(_0x400b9f,_0x35e2b5){if(_0x400b9f[_0x8dd6('0x49')]['id']){delete _0x400b9f[_0x8dd6('0x49')]['id'];}return db[_0x8dd6('0x2d')][_0x8dd6('0x47')]({'where':{'id':_0x400b9f[_0x8dd6('0x46')]['id']}})[_0x8dd6('0x26')](handleEntityNotFound(_0x35e2b5,null))[_0x8dd6('0x26')](saveUpdates(_0x400b9f[_0x8dd6('0x49')],null))[_0x8dd6('0x26')](respondWithResult(_0x35e2b5,null))[_0x8dd6('0x45')](handleError(_0x35e2b5,null));};exports['describe']=function(_0xa5d671,_0x54a427){return db[_0x8dd6('0x2d')]['describe']()[_0x8dd6('0x26')](respondWithResult(_0x54a427,null))[_0x8dd6('0x45')](handleError(_0x54a427,null));};exports['download']=function(_0x26d5be,_0x52f1c4,_0x48d0b9){var _0x407631=require(_0x8dd6('0x4a'));var _0x4bbfdc=![];var _0x4c80c8={};if(_0x26d5be[_0x8dd6('0x32')][_0x8dd6('0x30')]&&_0x26d5be[_0x8dd6('0x32')][_0x8dd6('0x30')]===_0x8dd6('0x4b')){_0x4c80c8[_0x8dd6('0x4b')]=_0x26d5be[_0x8dd6('0x46')]['id'];}else{_0x4c80c8['id']=_0x26d5be[_0x8dd6('0x46')]['id'];}return db['VoiceRecording'][_0x8dd6('0x47')]({'where':_0x4c80c8,'attributes':['id',_0x8dd6('0x4c')],'raw':!![]})[_0x8dd6('0x26')](handleEntityNotFound(_0x52f1c4,null))[_0x8dd6('0x26')](function(_0x733d0e){if(_0x733d0e){var _0x50a182=_0x733d0e[_0x8dd6('0x4c')];var _0x2c494b=util['format'](_0x8dd6('0x4d'),_0x50a182);if(fs[_0x8dd6('0x4e')](_0x2c494b)){_0x4bbfdc=!![];return _0x407631[_0x8dd6('0x4f')](_0x2c494b,_0x50a182,config['secrets'][_0x8dd6('0x50')])[_0x8dd6('0x26')](function(){return _0x733d0e;});}return _0x733d0e;}})[_0x8dd6('0x26')](function(_0x4bbf47){if(_0x4bbf47){var _0x234266=_0x4bbf47['value'];if(!fs[_0x8dd6('0x4e')](_0x234266)){throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))](_0x8dd6('0x53'));}if(_0x4bbf47[_0x8dd6('0x54')]){return _0x52f1c4[_0x8dd6('0x55')](_0x234266,_0x4bbf47[_0x8dd6('0x54')]+path['extname'](_0x234266),function(){if(_0x4bbfdc){fs[_0x8dd6('0x56')](_0x234266);}});}else{return _0x52f1c4['download'](_0x234266,function(_0x5d0bb2){if(_0x4bbfdc){fs[_0x8dd6('0x56')](_0x234266);}});}}})['catch'](function(_0x1f6fb3){if(_0x1f6fb3[_0x8dd6('0x57')]==='VoiceRecording\x20not\x20found'){_0x52f1c4[_0x8dd6('0x1b')](0x194)[_0x8dd6('0x2b')](_0x8dd6('0x58'));}else{return handleError(_0x52f1c4,null);}});};exports[_0x8dd6('0x59')]=function(_0x327d73,_0x16dfb9,_0xb94ba){var _0x3209f3=require(_0x8dd6('0x4a'));var _0x1773a6=![];var _0x123fb8={'$and':[db[_0x8dd6('0x5a')]['where'](db[_0x8dd6('0x5a')]['fn'](_0x8dd6('0x5b'),db[_0x8dd6('0x5a')]['col']('uniqueid')),_0x327d73[_0x8dd6('0x32')][_0x8dd6('0x5c')])]};if(_0x327d73[_0x8dd6('0x32')][_0x8dd6('0x30')]&&_0x327d73[_0x8dd6('0x32')][_0x8dd6('0x30')]===_0x8dd6('0x4b')){_0x123fb8[_0x8dd6('0x5d')][_0x8dd6('0x5e')]({'uniqueid':_0x327d73['params']['id']});}else{_0x123fb8[_0x8dd6('0x5d')][_0x8dd6('0x5e')]({'id':_0x327d73[_0x8dd6('0x46')]['id']});}return db['VoiceRecording'][_0x8dd6('0x47')]({'where':_0x123fb8,'attributes':['id',_0x8dd6('0x4c')],'raw':!![]})[_0x8dd6('0x26')](handleEntityNotFound(_0x16dfb9,null))['then'](function(_0x2246fa){if(_0x2246fa){var _0x1d23c9=util['format'](_0x8dd6('0x4d'),_0x2246fa[_0x8dd6('0x4c')]);if(fs[_0x8dd6('0x4e')](_0x1d23c9)){_0x1773a6=!![];return _0x3209f3['decryptFile'](_0x1d23c9,_0x2246fa[_0x8dd6('0x4c')],config[_0x8dd6('0x5f')]['recording'])[_0x8dd6('0x26')](function(){return _0x2246fa;});}return _0x2246fa;}})[_0x8dd6('0x26')](function(_0x52ebd1){if(_0x52ebd1){if(!fs[_0x8dd6('0x4e')](_0x52ebd1[_0x8dd6('0x4c')])){throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))](_0x8dd6('0x53'));}if(_0x52ebd1[_0x8dd6('0x54')]){return _0x16dfb9[_0x8dd6('0x55')](_0x52ebd1[_0x8dd6('0x4c')],_0x52ebd1[_0x8dd6('0x54')]+path[_0x8dd6('0x60')](_0x52ebd1['value']),function(){if(_0x1773a6){fs[_0x8dd6('0x56')](_0x52ebd1[_0x8dd6('0x4c')]);}});}else{return _0x16dfb9['download'](_0x52ebd1[_0x8dd6('0x4c')],function(_0x5d4e78){if(_0x1773a6){fs['unlink'](_0x52ebd1['value']);}});}}})[_0x8dd6('0x45')](handleError(_0x16dfb9,null));};exports[_0x8dd6('0x27')]=function(_0x27cc06,_0x19e0c6){return db[_0x8dd6('0x2d')][_0x8dd6('0x47')]({'where':{'id':_0x27cc06[_0x8dd6('0x46')]['id']}})[_0x8dd6('0x26')](function(_0x5f4f14){if(_['isNil'](_0x5f4f14)){throw new ReferenceError(_0x8dd6('0x61'));}return _0x5f4f14;})[_0x8dd6('0x26')](function(_0xd6744e){var _0x289c3c=_0xd6744e[_0x8dd6('0x4c')];logger[_0x8dd6('0x62')](_0x8dd6('0x63'),_0x289c3c);if(!_[_0x8dd6('0x64')](_0xd6744e['value'])&&fs[_0x8dd6('0x4e')](_0x289c3c)){logger[_0x8dd6('0x62')]('File:\x20\x22'+_0x289c3c+_0x8dd6('0x65'));fs[_0x8dd6('0x66')](_0x289c3c);}_0x289c3c=_0x289c3c+_0x8dd6('0x67');if(!_['isNil'](_0xd6744e[_0x8dd6('0x4c')])&&fs[_0x8dd6('0x4e')](_0x289c3c)){logger[_0x8dd6('0x62')](_0x8dd6('0x68')+_0x289c3c+_0x8dd6('0x65'));fs[_0x8dd6('0x66')](_0x289c3c);}return _0xd6744e;})[_0x8dd6('0x26')](function(_0x539cd6){if(!_0x539cd6)throw new InternalError();return _0x539cd6[_0x8dd6('0x27')]();})[_0x8dd6('0x26')](function(){_0x19e0c6['status'](0xcc)['end']();})[_0x8dd6('0x45')](handleError(_0x19e0c6,null));};function getBucketslist(_0x389392,_0xcbec32,_0x3a75b0){return new Promise(function(_0x21f621,_0x52ea2c){var _0x16a659=new AWS['S3']({'accessKeyId':_0xcbec32,'secretAccessKey':_0x389392,'region':_0x3a75b0});_0x16a659[_0x8dd6('0x69')]({},function(_0x19598f,_0x45bf8c){if(_0x19598f){return _0x52ea2c(_0x19598f);}else{return _0x21f621(_0x45bf8c);}});});}function createBucket(_0x237429,_0x17449c,_0x23f470,_0x578c81){return new Promise(function(_0x3eab41,_0x4e301b){var _0x24bd3a=new AWS['S3']({'accessKeyId':_0x17449c,'secretAccessKey':_0x237429,'region':_0x23f470});_0x24bd3a[_0x8dd6('0x6a')]({'Bucket':_0x578c81},function(_0x5e291a,_0x4e60c9){if(_0x5e291a){return _0x4e301b(_0x5e291a);}else{return _0x3eab41(_0x4e60c9);}});});}function uploadFile(_0xeed370,_0x1c3137,_0x407711,_0x247fc6,_0x59e6f4,_0x330b19){return new Promise(function(_0x63ce5b,_0x286e15){var _0x112542=new AWS['S3']({'accessKeyId':_0x1c3137,'secretAccessKey':_0xeed370,'region':_0x407711});_0x112542[_0x8dd6('0x6b')]({'Bucket':_0x247fc6,'Key':_0x59e6f4,'Body':_0x330b19},function(_0x19162d,_0x2a5444){if(_0x19162d){return _0x286e15(_0x19162d);}else{return _0x63ce5b(_0x2a5444);}});});}function startTranscribe(_0x269ad0,_0x3f7dbc,_0x498050,_0x33933b,_0x4572e5,_0x398bb4){return new Promise(function(_0x3b5f55,_0x31aff2){var _0x591841=new AWS[(_0x8dd6('0x6c'))]({'accessKeyId':_0x3f7dbc,'secretAccessKey':_0x269ad0,'region':_0x498050});_0x591841[_0x8dd6('0x6d')]({'TranscriptionJobName':_0x33933b,'LanguageCode':_0x4572e5,'Media':{'MediaFileUri':_0x398bb4}},function(_0x2cb187,_0x1587b4){if(_0x2cb187){return _0x31aff2(_0x2cb187);}else{return _0x3b5f55(_0x1587b4);}});});}function transcribe(_0x59009a,_0x43ed96,_0x2dd44f,_0x57ab1e,_0x335bc4,_0xa17aa8,_0x36b8ba){return new Promise(function(_0xb173fe,_0x4dba58){var _0x443a65={};logger['info'](util[_0x8dd6('0x6e')](_0x8dd6('0x6f'),_0x59009a,_0x335bc4));return uploadFile(_0x43ed96,_0x2dd44f,_0x57ab1e,_0x335bc4,path[_0x8dd6('0x70')](_0xa17aa8),fs[_0x8dd6('0x71')](_0xa17aa8))[_0x8dd6('0x26')](function(_0xbb3e3f){logger[_0x8dd6('0x62')](util[_0x8dd6('0x6e')](_0x8dd6('0x72'),_0x59009a,_0x335bc4,_0xbb3e3f[_0x8dd6('0x73')]));_0x443a65[_0x8dd6('0x74')]=_0xbb3e3f[_0x8dd6('0x75')];_0x443a65['location']=_0xbb3e3f[_0x8dd6('0x73')];logger[_0x8dd6('0x62')](util[_0x8dd6('0x6e')](_0x8dd6('0x76'),_0x59009a));return startTranscribe(_0x43ed96,_0x2dd44f,_0x57ab1e,uuidv4(),_0x36b8ba,_0xbb3e3f[_0x8dd6('0x73')]);})[_0x8dd6('0x26')](function(_0x57f681){logger[_0x8dd6('0x62')](util['format'](_0x8dd6('0x77'),_0x59009a,_0x57f681[_0x8dd6('0x78')][_0x8dd6('0x79')]));_0x443a65['transcribeName']=_0x57f681['TranscriptionJob'][_0x8dd6('0x79')];_0x443a65[_0x8dd6('0x7a')]=_0x57f681[_0x8dd6('0x78')][_0x8dd6('0x7b')];return _0xb173fe(_0x443a65);})[_0x8dd6('0x45')](function(_0x10c5aa){return _0x4dba58(_0x10c5aa);});});}exports[_0x8dd6('0x7c')]=function(_0x321275,_0x495c8a,_0x2dc9d9){var _0x3b3f5f;var _0x3b6d82;var _0x326eb0;var _0x32f776=require('../../components/encryptor');return db[_0x8dd6('0x2d')]['findOne']({'where':{'id':_0x321275[_0x8dd6('0x46')]['id']}})[_0x8dd6('0x26')](function(_0x14c331){if(_0x14c331){var _0x5b2ff3=util['format'](_0x8dd6('0x4d'),_0x14c331[_0x8dd6('0x4c')]);if(fs['existsSync'](_0x5b2ff3)){cypher=!![];return _0x32f776[_0x8dd6('0x4f')](_0x5b2ff3,_0x14c331[_0x8dd6('0x4c')],config[_0x8dd6('0x5f')][_0x8dd6('0x50')])[_0x8dd6('0x26')](function(){return _0x14c331;});}return _0x14c331;}})[_0x8dd6('0x26')](function(_0x4181fc){if(!_0x4181fc){throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))](_0x8dd6('0x7d'));}_0x3b6d82=_0x4181fc;return db['Setting'][_0x8dd6('0x7e')]({'where':{'id':0x1}});})[_0x8dd6('0x26')](handleEntityNotFound(_0x495c8a,null))[_0x8dd6('0x26')](function(_0x5a919f){if(_0x5a919f){_0x3b3f5f=_0x5a919f;if(!_0x3b3f5f[_0x8dd6('0x7f')]||!_0x3b3f5f[_0x8dd6('0x80')]||!_0x3b3f5f['transcribeRegion']||!_0x3b3f5f[_0x8dd6('0x81')]||!_0x3b3f5f[_0x8dd6('0x74')]){throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))]('Transcribe\x20not\x20configured');}if(_0x321275[_0x8dd6('0x49')][_0x8dd6('0x82')]&&(!_0x3b3f5f[_0x8dd6('0x83')]||!_0x3b3f5f[_0x8dd6('0x84')]||!_0x3b3f5f[_0x8dd6('0x85')]||!_0x3b3f5f[_0x8dd6('0x81')]||!_0x3b3f5f['bucket'])){throw new db['Sequelize'][(_0x8dd6('0x52'))](_0x8dd6('0x86'));}return db['CloudProvider']['findOne']({'where':{'id':_0x3b3f5f['transcribeAccountId']}});}})[_0x8dd6('0x26')](function(_0x198778){if(!_0x198778){throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))](_0x8dd6('0x87'));}if(!_0x198778['data1']||!_0x198778[_0x8dd6('0x88')]){throw new db['Sequelize'][(_0x8dd6('0x52'))](_0x8dd6('0x89'));}_0x326eb0=_0x198778;return getBucketslist(_0x326eb0[_0x8dd6('0x8a')],_0x326eb0[_0x8dd6('0x88')],_0x3b3f5f[_0x8dd6('0x8b')]);})[_0x8dd6('0x26')](function(_0x2055ba){if(_0x2055ba&&_0x2055ba[_0x8dd6('0x8c')]){var _0x67155d=_['find'](_0x2055ba[_0x8dd6('0x8c')],function(_0x18f3d2){return _0x18f3d2[_0x8dd6('0x8d')]===_0x3b3f5f[_0x8dd6('0x74')];});if(!_0x67155d){logger['info'](util[_0x8dd6('0x6e')](_0x8dd6('0x8e'),_0x321275['params']['id'],_0x3b3f5f[_0x8dd6('0x74')]));return createBucket(_0x326eb0[_0x8dd6('0x8a')],_0x326eb0[_0x8dd6('0x88')],_0x3b3f5f[_0x8dd6('0x8b')],_0x3b3f5f[_0x8dd6('0x74')]);}logger[_0x8dd6('0x62')](util[_0x8dd6('0x6e')](_0x8dd6('0x8f'),_0x321275[_0x8dd6('0x46')]['id'],_0x3b3f5f[_0x8dd6('0x74')]));return;}})[_0x8dd6('0x26')](function(_0x399077){if(_0x3b6d82[_0x8dd6('0x7a')]===_0x8dd6('0x90')){return transcribe(_0x321275['params']['id'],_0x326eb0['data1'],_0x326eb0[_0x8dd6('0x88')],_0x3b3f5f[_0x8dd6('0x8b')],_0x3b3f5f['bucket'],_0x3b6d82['value'],_0x3b3f5f[_0x8dd6('0x81')]);}else{logger[_0x8dd6('0x62')](util['format'](_0x8dd6('0x91'),_0x321275[_0x8dd6('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x8dd6('0x26')](function(_0x472eca){if(_0x472eca){_0x472eca[_0x8dd6('0x92')]=_0x321275[_0x8dd6('0x49')]['runSentiment'];return _0x3b6d82[_0x8dd6('0x93')](_0x472eca);}})[_0x8dd6('0x26')](respondWithResult(_0x495c8a,null))[_0x8dd6('0x45')](handleError(_0x495c8a,null));};function writeFile(_0x14027a,_0x30f054){return new Promise(function(_0x504b9d,_0x169d88){fs['writeFile'](_0x30f054,_0x14027a,function(_0x475713,_0x535515){if(_0x475713){return _0x169d88(_0x475713);}else{return _0x504b9d(_0x535515);}});});}exports[_0x8dd6('0x94')]=function(_0x1d8fef,_0x3338e3,_0x16d67d){return db['VoiceRecording'][_0x8dd6('0x7e')]({'where':{'id':_0x1d8fef[_0x8dd6('0x46')]['id']}})['then'](handleEntityNotFound(_0x3338e3))['then'](function(_0x39968d){if(_0x39968d&&_0x39968d['fileText']){var _0x2804bd=_0x39968d['fileText'];var _0x44b48=config['root']+_0x8dd6('0x95')+_0x39968d['id']+_0x8dd6('0x96');if(fs[_0x8dd6('0x4e')](_0x44b48)){return _0x44b48;}return writeFile(_0x2804bd,_0x44b48)[_0x8dd6('0x26')](function(){return _0x44b48;});}else{throw new db[(_0x8dd6('0x51'))][(_0x8dd6('0x52'))](_0x8dd6('0x97'));}})['then'](function(_0x1e3f3b){return _0x3338e3[_0x8dd6('0x55')](_0x1e3f3b);})[_0x8dd6('0x45')](handleError(_0x3338e3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index fc0e1c7..8902396 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 _0xc99a=['define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xc99a,0x7c));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xac99('0x0'));module[_0xac99('0x1')]=function(_0x29cba3,_0x2edf86){return _0x29cba3[_0xac99('0x2')](_0xac99('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xac99('0x4'),'fields':[_0xac99('0x4')]},{'name':_0xac99('0x5'),'fields':[_0xac99('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38c3=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x182dc8,_0xe38199){var _0x212151=function(_0x1e96b5){while(--_0x1e96b5){_0x182dc8['push'](_0x182dc8['shift']());}};_0x212151(++_0xe38199);}(_0x38c3,0x13d));var _0x338c=function(_0x21cc3f,_0x4ac3e5){_0x21cc3f=_0x21cc3f-0x0;var _0x1a311c=_0x38c3[_0x21cc3f];return _0x1a311c;};'use strict';var attributes=require(_0x338c('0x0'));module[_0x338c('0x1')]=function(_0x574849,_0x3e1bdf){return _0x574849[_0x338c('0x2')](_0x338c('0x3'),attributes,{'tableName':_0x338c('0x4'),'paranoid':![],'indexes':[{'name':_0x338c('0x5'),'fields':[_0x338c('0x5')]},{'name':'transcribeStatus','fields':[_0x338c('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c63c525..6df12df 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 _0xffd6=['catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','Setting','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x367d57,_0x2b458b){var _0xe60696=function(_0x14e811){while(--_0x14e811){_0x367d57['push'](_0x367d57['shift']());}};_0xe60696(++_0x2b458b);}(_0xffd6,0x97));var _0x6ffd=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xffd6[_0x4c2f30];return _0xb8854d;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['VoiceRecording'][_0x6ffd('0x17')](_0x889a4b[_0x6ffd('0x18')],{'raw':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x19')][_0x6ffd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x889a4b['options']?_0x889a4b['options'][_0x6ffd('0x1b')]||null:null,'attributes':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b['options'][_0x6ffd('0x1c')]||null:null,'limit':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b[_0x6ffd('0x19')]['limit']||null:null})[_0x6ffd('0xa')](function(_0x2efeb5){logger['info'](_0x6ffd('0x16'),_0x889a4b);logger[_0x6ffd('0xd')]('UpdateVoiceRecording',_0x889a4b,JSON[_0x6ffd('0xf')](_0x2efeb5));_0x11a609(_0x2efeb5);})[_0x6ffd('0x15')](function(_0xb504e5){logger['error'](_0x6ffd('0x16'),_0xb504e5[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0xb504e5['message']));});});};exports[_0x6ffd('0x1d')]=function(_0x5a55e2){var _0x41ab4a=this;return new Promise(function(_0x43269c,_0x56c6de){var _0x520258=require(_0x6ffd('0x1e'));var _0x2a0391;return db[_0x6ffd('0x1f')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6ffd('0xa')](function(_0x48feb4){_0x2a0391=_0x48feb4;return db[_0x6ffd('0x20')][_0x6ffd('0x21')](_0x5a55e2['body']);})[_0x6ffd('0xa')](function(_0xc790b2){if(_0x2a0391[_0x6ffd('0x22')]&&fs[_0x6ffd('0x23')](_0xc790b2[_0x6ffd('0x24')])){var _0x31c609=util[_0x6ffd('0x25')](_0x6ffd('0x26'),_0xc790b2[_0x6ffd('0x24')]);return _0x520258[_0x6ffd('0x27')](_0xc790b2[_0x6ffd('0x24')],_0x31c609,config[_0x6ffd('0x28')][_0x6ffd('0x29')])['then'](function(){fs['unlink'](_0xc790b2['value']);logger[_0x6ffd('0x13')](_0x6ffd('0x2a'));return _0xc790b2;});}return _0xc790b2;})[_0x6ffd('0xa')](function(_0x528a3f){logger[_0x6ffd('0x13')](_0x6ffd('0x1d'),_0x5a55e2);logger[_0x6ffd('0xd')](_0x6ffd('0x1d'),_0x5a55e2,JSON[_0x6ffd('0xf')](_0x528a3f));_0x43269c(_0x528a3f);})[_0x6ffd('0x15')](function(_0x26394c){logger[_0x6ffd('0x10')](_0x6ffd('0x1d'),_0x26394c['message'],_0x5a55e2);_0x56c6de(_0x41ab4a[_0x6ffd('0x10')](0x1f4,_0x26394c[_0x6ffd('0x12')]));});});}; \ No newline at end of file +var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x5ab249,_0x40b275){var _0x178968=function(_0x1e0b68){while(--_0x1e0b68){_0x5ab249['push'](_0x5ab249['shift']());}};_0x178968(++_0x40b275);}(_0x66fa,0x117));var _0xa66f=function(_0xd36797,_0x3034b9){_0xd36797=_0xd36797-0x0;var _0x4a583c=_0x66fa[_0xd36797];return _0x4a583c;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 378054e..111caf3 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 _0x445c=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x26c556,_0x4c36c3){var _0x25d3fb=function(_0x351c63){while(--_0x351c63){_0x26c556['push'](_0x26c556['shift']());}};_0x25d3fb(++_0x4c36c3);}(_0x445c,0x1b7));var _0xc445=function(_0xbffcf9,_0x3c8e7d){_0xbffcf9=_0xbffcf9-0x0;var _0x39d64c=_0x445c[_0xbffcf9];return _0x39d64c;};'use strict';var multer=require(_0xc445('0x0'));var util=require(_0xc445('0x1'));var path=require(_0xc445('0x2'));var timeout=require(_0xc445('0x3'));var express=require(_0xc445('0x4'));var router=express[_0xc445('0x5')]();var fs_extra=require(_0xc445('0x6'));var auth=require(_0xc445('0x7'));var interaction=require(_0xc445('0x8'));var config=require('../../config/environment');var controller=require(_0xc445('0x9'));router[_0xc445('0xa')]('/',auth[_0xc445('0xb')](),controller[_0xc445('0xc')]);router['get'](_0xc445('0xd'),auth['isAuthenticated'](),controller[_0xc445('0xe')]);router[_0xc445('0xa')](_0xc445('0xf'),auth[_0xc445('0xb')](),controller[_0xc445('0x10')]);router[_0xc445('0x11')]('/',auth['isAuthenticated'](),controller[_0xc445('0x12')]);router[_0xc445('0x13')](_0xc445('0xf'),auth['isAuthenticated'](),controller[_0xc445('0x14')]);router['delete'](_0xc445('0xf'),auth['isAuthenticated'](),controller[_0xc445('0x15')]);module[_0xc445('0x16')]=router; \ No newline at end of file +var _0x2405=['../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x2405,0x150));var _0x5240=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x2405[_0x368587];return _0x42d33c;};'use strict';var multer=require(_0x5240('0x0'));var util=require(_0x5240('0x1'));var path=require(_0x5240('0x2'));var timeout=require(_0x5240('0x3'));var express=require(_0x5240('0x4'));var router=express[_0x5240('0x5')]();var fs_extra=require(_0x5240('0x6'));var auth=require(_0x5240('0x7'));var interaction=require(_0x5240('0x8'));var config=require(_0x5240('0x9'));var controller=require(_0x5240('0xa'));router[_0x5240('0xb')]('/',auth['isAuthenticated'](),controller[_0x5240('0xc')]);router[_0x5240('0xb')]('/describe',auth[_0x5240('0xd')](),controller[_0x5240('0xe')]);router[_0x5240('0xb')]('/:id',auth[_0x5240('0xd')](),controller[_0x5240('0xf')]);router[_0x5240('0x10')]('/',auth['isAuthenticated'](),controller[_0x5240('0x11')]);router[_0x5240('0x12')](_0x5240('0x13'),auth[_0x5240('0xd')](),controller[_0x5240('0x14')]);router['delete']('/:id',auth[_0x5240('0xd')](),controller[_0x5240('0x15')]);module[_0x5240('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index dc8ac4a..c290be8 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 _0x88d5=['attended','STRING','ENUM','sequelize','moment','blind'];(function(_0x28edcf,_0xb3d0f){var _0x93d81d=function(_0x559a16){while(--_0x559a16){_0x28edcf['push'](_0x28edcf['shift']());}};_0x93d81d(++_0xb3d0f);}(_0x88d5,0x75));var _0x588d=function(_0x31a8d5,_0x4d5bd5){_0x31a8d5=_0x31a8d5-0x0;var _0x3285ea=_0x88d5[_0x31a8d5];return _0x3285ea;};'use strict';var Sequelize=require(_0x588d('0x0'));var moment=require(_0x588d('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x588d('0x2'),_0x588d('0x3'))},'result':{'type':Sequelize[_0x588d('0x4')]},'transfererchannel':{'type':Sequelize[_0x588d('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x588d('0x4')]},'transferercalleridname':{'type':Sequelize[_0x588d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x588d('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x588d('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x588d('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x588d('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x588d('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x588d('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x588d('0x4')]},'transfereecontext':{'type':Sequelize[_0x588d('0x4')]},'transfereeexten':{'type':Sequelize[_0x588d('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x588d('0x4')]},'isexternal':{'type':Sequelize[_0x588d('0x5')]('Yes','No')},'context':{'type':Sequelize[_0x588d('0x4')]},'extension':{'type':Sequelize[_0x588d('0x4')]}}; \ No newline at end of file +var _0xe250=['ENUM','STRING','sequelize','moment','exports'];(function(_0x277e18,_0x5f2c07){var _0x3be1cc=function(_0x42c5c9){while(--_0x42c5c9){_0x277e18['push'](_0x277e18['shift']());}};_0x3be1cc(++_0x5f2c07);}(_0xe250,0x110));var _0x0e25=function(_0x2ab015,_0x4c842a){_0x2ab015=_0x2ab015-0x0;var _0x297808=_0xe250[_0x2ab015];return _0x297808;};'use strict';var Sequelize=require(_0x0e25('0x0'));var moment=require(_0x0e25('0x1'));module[_0x0e25('0x2')]={'type':{'type':Sequelize[_0x0e25('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x0e25('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x0e25('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0e25('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x0e25('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x0e25('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x0e25('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0e25('0x4')]},'transfereechannel':{'type':Sequelize[_0x0e25('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0e25('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x0e25('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x0e25('0x4')]},'transfereeexten':{'type':Sequelize[_0x0e25('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x0e25('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x0e25('0x4')]},'extension':{'type':Sequelize[_0x0e25('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b74c9a6..497a203 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 _0x8a02=['includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','then','end','error','stack','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x53ad5f,_0x165793){var _0x61e1da=function(_0x5d51a1){while(--_0x5d51a1){_0x53ad5f['push'](_0x53ad5f['shift']());}};_0x61e1da(++_0x165793);}(_0x8a02,0x141));var _0x28a0=function(_0x29eb40,_0x4110d9){_0x29eb40=_0x29eb40-0x0;var _0x2b63a3=_0x8a02[_0x29eb40];return _0x2b63a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28a0('0x0'));var zipdir=require(_0x28a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28a0('0x2'));var moment=require(_0x28a0('0x3'));var BPromise=require(_0x28a0('0x4'));var Mustache=require(_0x28a0('0x5'));var util=require(_0x28a0('0x6'));var path=require(_0x28a0('0x7'));var sox=require(_0x28a0('0x8'));var csv=require(_0x28a0('0x9'));var ejs=require(_0x28a0('0xa'));var fs=require('fs');var fs_extra=require(_0x28a0('0xb'));var _=require(_0x28a0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28a0('0xd'));var deskjs=require(_0x28a0('0xe'));var toCsv=require(_0x28a0('0x9'));var querystring=require('querystring');var Papa=require(_0x28a0('0xf'));var Redis=require(_0x28a0('0x10'));var authService=require(_0x28a0('0x11'));var qs=require(_0x28a0('0x12'));var as=require(_0x28a0('0x13'));var hardwareService=require(_0x28a0('0x14'));var logger=require(_0x28a0('0x15'))(_0x28a0('0x16'));var utils=require(_0x28a0('0x17'));var config=require(_0x28a0('0x18'));var licenseUtil=require(_0x28a0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x255c2e,_0x36e850){_0x36e850=_0x36e850||0xcc;return function(_0x4060e0){if(_0x4060e0){return _0x255c2e[_0x28a0('0x1a')](_0x36e850);}return _0x255c2e['status'](_0x36e850)['end']();};}function respondWithResult(_0xb453dd,_0x33ad34){_0x33ad34=_0x33ad34||0xc8;return function(_0x13c20b){if(_0x13c20b){return _0xb453dd['status'](_0x33ad34)[_0x28a0('0x1b')](_0x13c20b);}};}function respondWithFilteredResult(_0xcdd00,_0x5070ee){return function(_0x56dac0){if(_0x56dac0){var _0x3876a3=typeof _0x5070ee[_0x28a0('0x1c')]==='undefined'&&typeof _0x5070ee[_0x28a0('0x1d')]===_0x28a0('0x1e');var _0x381322=_0x56dac0[_0x28a0('0x1f')];var _0x5e6361=_0x3876a3?0x0:_0x5070ee[_0x28a0('0x1c')];var _0x582ccf=_0x3876a3?_0x56dac0[_0x28a0('0x1f')]:_0x5070ee[_0x28a0('0x1c')]+_0x5070ee[_0x28a0('0x1d')];var _0x1e749c;if(_0x582ccf>=_0x381322){_0x582ccf=_0x381322;_0x1e749c=0xc8;}else{_0x1e749c=0xce;}_0xcdd00[_0x28a0('0x20')](_0x1e749c);return _0xcdd00['set'](_0x28a0('0x21'),_0x5e6361+'-'+_0x582ccf+'/'+_0x381322)[_0x28a0('0x1b')](_0x56dac0);}return null;};}function patchUpdates(_0x3b1e5d){return function(_0xcc1aa1){try{jsonpatch[_0x28a0('0x22')](_0xcc1aa1,_0x3b1e5d,!![]);}catch(_0x253057){return BPromise['reject'](_0x253057);}return _0xcc1aa1['save']();};}function saveUpdates(_0x35ba63,_0x3ed260){return function(_0x56fdc1){if(_0x56fdc1){return _0x56fdc1['update'](_0x35ba63)[_0x28a0('0x23')](function(_0x3acf66){return _0x3acf66;});}return null;};}function removeEntity(_0x387ac5,_0x168e53){return function(_0x3c87a1){if(_0x3c87a1){return _0x3c87a1['destroy']()[_0x28a0('0x23')](function(){_0x387ac5[_0x28a0('0x20')](0xcc)[_0x28a0('0x24')]();});}};}function handleEntityNotFound(_0x20dae0,_0x352497){return function(_0x597482){if(!_0x597482){_0x20dae0[_0x28a0('0x1a')](0x194);}return _0x597482;};}function handleError(_0x79a6e9,_0x1b0b21){_0x1b0b21=_0x1b0b21||0x1f4;return function(_0x51b376){logger[_0x28a0('0x25')](_0x51b376[_0x28a0('0x26')]);if(_0x51b376['name']){delete _0x51b376['name'];}_0x79a6e9['status'](_0x1b0b21)[_0x28a0('0x27')](_0x51b376);};}exports[_0x28a0('0x28')]=function(_0x56f5aa,_0x5a6853){var _0x2a420f={},_0x3f6c13={},_0x1a0484={'count':0x0,'rows':[]};var _0x3a2796=_[_0x28a0('0x29')](db[_0x28a0('0x2a')][_0x28a0('0x2b')],function(_0x468e1f){return{'name':_0x468e1f[_0x28a0('0x2c')],'type':_0x468e1f[_0x28a0('0x2d')][_0x28a0('0x2e')]};});_0x3f6c13[_0x28a0('0x2f')]=_[_0x28a0('0x29')](_0x3a2796,_0x28a0('0x30'));_0x3f6c13['query']=_[_0x28a0('0x31')](_0x56f5aa[_0x28a0('0x32')]);_0x3f6c13['filters']=_[_0x28a0('0x33')](_0x3f6c13['model'],_0x3f6c13[_0x28a0('0x32')]);_0x2a420f[_0x28a0('0x34')]=_[_0x28a0('0x33')](_0x3f6c13[_0x28a0('0x2f')],qs[_0x28a0('0x35')](_0x56f5aa[_0x28a0('0x32')][_0x28a0('0x35')]));_0x2a420f[_0x28a0('0x34')]=_0x2a420f[_0x28a0('0x34')][_0x28a0('0x36')]?_0x2a420f['attributes']:_0x3f6c13[_0x28a0('0x2f')];if(!_0x56f5aa[_0x28a0('0x32')]['hasOwnProperty'](_0x28a0('0x37'))){_0x2a420f[_0x28a0('0x1d')]=qs['limit'](_0x56f5aa[_0x28a0('0x32')]['limit']);_0x2a420f[_0x28a0('0x1c')]=qs[_0x28a0('0x1c')](_0x56f5aa[_0x28a0('0x32')][_0x28a0('0x1c')]);}_0x2a420f[_0x28a0('0x38')]=qs[_0x28a0('0x39')](_0x56f5aa[_0x28a0('0x32')][_0x28a0('0x39')]);_0x2a420f[_0x28a0('0x3a')]=qs[_0x28a0('0x3b')](_[_0x28a0('0x3c')](_0x56f5aa[_0x28a0('0x32')],_0x3f6c13['filters']),_0x3a2796);if(_0x56f5aa[_0x28a0('0x32')][_0x28a0('0x3d')]){_0x2a420f[_0x28a0('0x3a')]=_[_0x28a0('0x3e')](_0x2a420f[_0x28a0('0x3a')],{'$or':_[_0x28a0('0x29')](_0x3a2796,function(_0x6c001c){if(_0x6c001c['type']!=='VIRTUAL'){var _0x33c3de={};_0x33c3de[_0x6c001c[_0x28a0('0x30')]]={'$like':'%'+_0x56f5aa['query'][_0x28a0('0x3d')]+'%'};return _0x33c3de;}})});}_0x2a420f=_[_0x28a0('0x3e')]({},_0x2a420f,_0x56f5aa[_0x28a0('0x3f')]);var _0x3a446b={'where':_0x2a420f[_0x28a0('0x3a')]};return db[_0x28a0('0x2a')][_0x28a0('0x1f')](_0x3a446b)['then'](function(_0xbe445a){_0x1a0484[_0x28a0('0x1f')]=_0xbe445a;if(_0x56f5aa[_0x28a0('0x32')][_0x28a0('0x40')]){_0x2a420f[_0x28a0('0x41')]=[{'all':!![]}];}return db[_0x28a0('0x2a')][_0x28a0('0x42')](_0x2a420f);})['then'](function(_0x2055c7){_0x1a0484[_0x28a0('0x43')]=_0x2055c7;return _0x1a0484;})[_0x28a0('0x23')](respondWithFilteredResult(_0x5a6853,_0x2a420f))[_0x28a0('0x44')](handleError(_0x5a6853,null));};exports[_0x28a0('0x45')]=function(_0x3f2211,_0x52ee26){var _0x13f3df={'raw':!![],'where':{'id':_0x3f2211[_0x28a0('0x46')]['id']}},_0x44deff={};_0x44deff[_0x28a0('0x2f')]=_[_0x28a0('0x31')](db[_0x28a0('0x2a')]['rawAttributes']);_0x44deff['query']=_['keys'](_0x3f2211[_0x28a0('0x32')]);_0x44deff[_0x28a0('0x3b')]=_[_0x28a0('0x33')](_0x44deff['model'],_0x44deff[_0x28a0('0x32')]);_0x13f3df[_0x28a0('0x34')]=_[_0x28a0('0x33')](_0x44deff['model'],qs[_0x28a0('0x35')](_0x3f2211['query'][_0x28a0('0x35')]));_0x13f3df['attributes']=_0x13f3df['attributes'][_0x28a0('0x36')]?_0x13f3df[_0x28a0('0x34')]:_0x44deff['model'];if(_0x3f2211[_0x28a0('0x32')][_0x28a0('0x40')]){_0x13f3df[_0x28a0('0x41')]=[{'all':!![]}];}_0x13f3df=_[_0x28a0('0x3e')]({},_0x13f3df,_0x3f2211[_0x28a0('0x3f')]);return db[_0x28a0('0x2a')][_0x28a0('0x47')](_0x13f3df)[_0x28a0('0x23')](handleEntityNotFound(_0x52ee26,null))[_0x28a0('0x23')](respondWithResult(_0x52ee26,null))[_0x28a0('0x44')](handleError(_0x52ee26,null));};exports['create']=function(_0x244a06,_0x33b419){return db[_0x28a0('0x2a')][_0x28a0('0x48')](_0x244a06[_0x28a0('0x49')],{})['then'](respondWithResult(_0x33b419,0xc9))[_0x28a0('0x44')](handleError(_0x33b419,null));};exports[_0x28a0('0x4a')]=function(_0x375af4,_0x449437){if(_0x375af4[_0x28a0('0x49')]['id']){delete _0x375af4['body']['id'];}return db[_0x28a0('0x2a')][_0x28a0('0x47')]({'where':{'id':_0x375af4['params']['id']}})[_0x28a0('0x23')](handleEntityNotFound(_0x449437,null))[_0x28a0('0x23')](saveUpdates(_0x375af4[_0x28a0('0x49')],null))[_0x28a0('0x23')](respondWithResult(_0x449437,null))[_0x28a0('0x44')](handleError(_0x449437,null));};exports[_0x28a0('0x4b')]=function(_0x4440ce,_0x106da6){return db[_0x28a0('0x2a')]['find']({'where':{'id':_0x4440ce[_0x28a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x106da6,null))[_0x28a0('0x23')](removeEntity(_0x106da6,null))[_0x28a0('0x44')](handleError(_0x106da6,null));};exports[_0x28a0('0x4c')]=function(_0x14fe2c,_0x2ec6c5){return db[_0x28a0('0x2a')]['describe']()[_0x28a0('0x23')](respondWithResult(_0x2ec6c5,null))[_0x28a0('0x44')](handleError(_0x2ec6c5,null));}; \ No newline at end of file +var _0x5483=['sendStatus','end','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','catch','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5483,0xb9));var _0x3548=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x5483[_0x490be3];return _0x3f5140;};'use strict';var emlformat=require(_0x3548('0x0'));var rimraf=require(_0x3548('0x1'));var zipdir=require(_0x3548('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3548('0x3'));var moment=require('moment');var BPromise=require(_0x3548('0x4'));var Mustache=require(_0x3548('0x5'));var util=require('util');var path=require(_0x3548('0x6'));var sox=require(_0x3548('0x7'));var csv=require(_0x3548('0x8'));var ejs=require(_0x3548('0x9'));var fs=require('fs');var fs_extra=require(_0x3548('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3548('0xb'));var jsforce=require(_0x3548('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3548('0x8'));var querystring=require(_0x3548('0xd'));var Papa=require(_0x3548('0xe'));var Redis=require('ioredis');var authService=require(_0x3548('0xf'));var qs=require(_0x3548('0x10'));var as=require(_0x3548('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3548('0x12'))(_0x3548('0x13'));var utils=require('../../config/utils');var config=require(_0x3548('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3548('0x15'))['db'];function respondWithStatusCode(_0x5417ae,_0x3a46c6){_0x3a46c6=_0x3a46c6||0xcc;return function(_0x318a55){if(_0x318a55){return _0x5417ae[_0x3548('0x16')](_0x3a46c6);}return _0x5417ae['status'](_0x3a46c6)[_0x3548('0x17')]();};}function respondWithResult(_0x322600,_0x987951){_0x987951=_0x987951||0xc8;return function(_0x56e2b2){if(_0x56e2b2){return _0x322600[_0x3548('0x18')](_0x987951)['json'](_0x56e2b2);}};}function respondWithFilteredResult(_0x5ce144,_0x4057d3){return function(_0x3cbca8){if(_0x3cbca8){var _0x5201b4=typeof _0x4057d3['offset']===_0x3548('0x19')&&typeof _0x4057d3[_0x3548('0x1a')]===_0x3548('0x19');var _0x7fc56f=_0x3cbca8[_0x3548('0x1b')];var _0x2ef4ec=_0x5201b4?0x0:_0x4057d3[_0x3548('0x1c')];var _0xded7f6=_0x5201b4?_0x3cbca8['count']:_0x4057d3[_0x3548('0x1c')]+_0x4057d3[_0x3548('0x1a')];var _0x1f6607;if(_0xded7f6>=_0x7fc56f){_0xded7f6=_0x7fc56f;_0x1f6607=0xc8;}else{_0x1f6607=0xce;}_0x5ce144['status'](_0x1f6607);return _0x5ce144[_0x3548('0x1d')]('Content-Range',_0x2ef4ec+'-'+_0xded7f6+'/'+_0x7fc56f)[_0x3548('0x1e')](_0x3cbca8);}return null;};}function patchUpdates(_0x2ff330){return function(_0x111bc8){try{jsonpatch[_0x3548('0x1f')](_0x111bc8,_0x2ff330,!![]);}catch(_0x2e6899){return BPromise['reject'](_0x2e6899);}return _0x111bc8['save']();};}function saveUpdates(_0xdaa897,_0x1db1a9){return function(_0x1eede6){if(_0x1eede6){return _0x1eede6[_0x3548('0x20')](_0xdaa897)[_0x3548('0x21')](function(_0x49b33d){return _0x49b33d;});}return null;};}function removeEntity(_0x2dfd77,_0x2e374b){return function(_0x3253ff){if(_0x3253ff){return _0x3253ff[_0x3548('0x22')]()[_0x3548('0x21')](function(){_0x2dfd77[_0x3548('0x18')](0xcc)[_0x3548('0x17')]();});}};}function handleEntityNotFound(_0x15553a,_0x1bd710){return function(_0x2e695b){if(!_0x2e695b){_0x15553a['sendStatus'](0x194);}return _0x2e695b;};}function handleError(_0x281ffa,_0x3d7cf6){_0x3d7cf6=_0x3d7cf6||0x1f4;return function(_0x1bed6e){logger[_0x3548('0x23')](_0x1bed6e[_0x3548('0x24')]);if(_0x1bed6e[_0x3548('0x25')]){delete _0x1bed6e[_0x3548('0x25')];}_0x281ffa[_0x3548('0x18')](_0x3d7cf6)[_0x3548('0x26')](_0x1bed6e);};}exports['index']=function(_0x519ff1,_0x403159){var _0x179c6b={},_0x5abfe3={},_0x17475a={'count':0x0,'rows':[]};var _0x181d39=_[_0x3548('0x27')](db[_0x3548('0x28')][_0x3548('0x29')],function(_0x5261f7){return{'name':_0x5261f7[_0x3548('0x2a')],'type':_0x5261f7[_0x3548('0x2b')][_0x3548('0x2c')]};});_0x5abfe3['model']=_[_0x3548('0x27')](_0x181d39,'name');_0x5abfe3[_0x3548('0x2d')]=_[_0x3548('0x2e')](_0x519ff1[_0x3548('0x2d')]);_0x5abfe3[_0x3548('0x2f')]=_[_0x3548('0x30')](_0x5abfe3[_0x3548('0x31')],_0x5abfe3[_0x3548('0x2d')]);_0x179c6b[_0x3548('0x32')]=_[_0x3548('0x30')](_0x5abfe3[_0x3548('0x31')],qs[_0x3548('0x33')](_0x519ff1['query'][_0x3548('0x33')]));_0x179c6b[_0x3548('0x32')]=_0x179c6b['attributes'][_0x3548('0x34')]?_0x179c6b[_0x3548('0x32')]:_0x5abfe3[_0x3548('0x31')];if(!_0x519ff1['query'][_0x3548('0x35')](_0x3548('0x36'))){_0x179c6b['limit']=qs[_0x3548('0x1a')](_0x519ff1[_0x3548('0x2d')]['limit']);_0x179c6b['offset']=qs[_0x3548('0x1c')](_0x519ff1['query'][_0x3548('0x1c')]);}_0x179c6b[_0x3548('0x37')]=qs[_0x3548('0x38')](_0x519ff1[_0x3548('0x2d')][_0x3548('0x38')]);_0x179c6b[_0x3548('0x39')]=qs[_0x3548('0x2f')](_[_0x3548('0x3a')](_0x519ff1['query'],_0x5abfe3[_0x3548('0x2f')]),_0x181d39);if(_0x519ff1[_0x3548('0x2d')][_0x3548('0x3b')]){_0x179c6b['where']=_[_0x3548('0x3c')](_0x179c6b[_0x3548('0x39')],{'$or':_[_0x3548('0x27')](_0x181d39,function(_0xaf8c1e){if(_0xaf8c1e[_0x3548('0x2b')]!=='VIRTUAL'){var _0x230e48={};_0x230e48[_0xaf8c1e[_0x3548('0x25')]]={'$like':'%'+_0x519ff1['query'][_0x3548('0x3b')]+'%'};return _0x230e48;}})});}_0x179c6b=_[_0x3548('0x3c')]({},_0x179c6b,_0x519ff1['options']);var _0x45ed21={'where':_0x179c6b['where']};return db[_0x3548('0x28')][_0x3548('0x1b')](_0x45ed21)['then'](function(_0x190568){_0x17475a[_0x3548('0x1b')]=_0x190568;if(_0x519ff1['query'][_0x3548('0x3d')]){_0x179c6b['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x179c6b);})[_0x3548('0x21')](function(_0x461c8f){_0x17475a['rows']=_0x461c8f;return _0x17475a;})[_0x3548('0x21')](respondWithFilteredResult(_0x403159,_0x179c6b))[_0x3548('0x3e')](handleError(_0x403159,null));};exports['show']=function(_0x3b920c,_0x51dc84){var _0x3b17ad={'raw':!![],'where':{'id':_0x3b920c['params']['id']}},_0x20f007={};_0x20f007[_0x3548('0x31')]=_['keys'](db[_0x3548('0x28')]['rawAttributes']);_0x20f007[_0x3548('0x2d')]=_['keys'](_0x3b920c[_0x3548('0x2d')]);_0x20f007[_0x3548('0x2f')]=_[_0x3548('0x30')](_0x20f007['model'],_0x20f007[_0x3548('0x2d')]);_0x3b17ad[_0x3548('0x32')]=_[_0x3548('0x30')](_0x20f007[_0x3548('0x31')],qs[_0x3548('0x33')](_0x3b920c['query'][_0x3548('0x33')]));_0x3b17ad['attributes']=_0x3b17ad[_0x3548('0x32')][_0x3548('0x34')]?_0x3b17ad[_0x3548('0x32')]:_0x20f007[_0x3548('0x31')];if(_0x3b920c[_0x3548('0x2d')][_0x3548('0x3d')]){_0x3b17ad['include']=[{'all':!![]}];}_0x3b17ad=_[_0x3548('0x3c')]({},_0x3b17ad,_0x3b920c[_0x3548('0x3f')]);return db[_0x3548('0x28')]['find'](_0x3b17ad)[_0x3548('0x21')](handleEntityNotFound(_0x51dc84,null))['then'](respondWithResult(_0x51dc84,null))[_0x3548('0x3e')](handleError(_0x51dc84,null));};exports[_0x3548('0x40')]=function(_0xe6e4dd,_0x5283ed){return db[_0x3548('0x28')][_0x3548('0x40')](_0xe6e4dd[_0x3548('0x41')],{})[_0x3548('0x21')](respondWithResult(_0x5283ed,0xc9))[_0x3548('0x3e')](handleError(_0x5283ed,null));};exports[_0x3548('0x20')]=function(_0x1c3c1c,_0x4f5b17){if(_0x1c3c1c['body']['id']){delete _0x1c3c1c['body']['id'];}return db[_0x3548('0x28')][_0x3548('0x42')]({'where':{'id':_0x1c3c1c['params']['id']}})[_0x3548('0x21')](handleEntityNotFound(_0x4f5b17,null))[_0x3548('0x21')](saveUpdates(_0x1c3c1c[_0x3548('0x41')],null))[_0x3548('0x21')](respondWithResult(_0x4f5b17,null))[_0x3548('0x3e')](handleError(_0x4f5b17,null));};exports[_0x3548('0x22')]=function(_0x5937a4,_0x404e1d){return db[_0x3548('0x28')]['find']({'where':{'id':_0x5937a4[_0x3548('0x43')]['id']}})[_0x3548('0x21')](handleEntityNotFound(_0x404e1d,null))['then'](removeEntity(_0x404e1d,null))[_0x3548('0x3e')](handleError(_0x404e1d,null));};exports[_0x3548('0x44')]=function(_0x127eb0,_0x26444c){return db[_0x3548('0x28')]['describe']()[_0x3548('0x21')](respondWithResult(_0x26444c,null))[_0x3548('0x3e')](handleError(_0x26444c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 152bbb0..a6d5aba 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 _0x9275=['define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x56085e,_0x5c69e9){var _0x4de130=function(_0x120b34){while(--_0x120b34){_0x56085e['push'](_0x56085e['shift']());}};_0x4de130(++_0x5c69e9);}(_0x9275,0x148));var _0x5927=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x9275[_0x44dba1];return _0x2fbd3f;};'use strict';var _=require(_0x5927('0x0'));var util=require(_0x5927('0x1'));var logger=require(_0x5927('0x2'))(_0x5927('0x3'));var moment=require(_0x5927('0x4'));var BPromise=require(_0x5927('0x5'));var rp=require(_0x5927('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5927('0x7'));var attributes=require(_0x5927('0x8'));module[_0x5927('0x9')]=function(_0x4a994b,_0x43c8d5){return _0x4a994b[_0x5927('0xa')](_0x5927('0xb'),attributes,{'tableName':_0x5927('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8154=['../../config/environment','./voiceTransferReport.attributes','define','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x8154,0x1eb));var _0x4815=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8154[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4815('0x0'))('api');var moment=require(_0x4815('0x1'));var BPromise=require('bluebird');var rp=require(_0x4815('0x2'));var fs=require('fs');var path=require(_0x4815('0x3'));var rimraf=require(_0x4815('0x4'));var config=require(_0x4815('0x5'));var attributes=require(_0x4815('0x6'));module['exports']=function(_0x458c1f,_0x510a20){return _0x458c1f[_0x4815('0x7')]('VoiceTransferReport',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 31e01fe..98948b5 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 _0xe7f0=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x5bf46c,_0x1fe508){var _0x5a37c4=function(_0x2cf2c3){while(--_0x2cf2c3){_0x5bf46c['push'](_0x5bf46c['shift']());}};_0x5a37c4(++_0x1fe508);}(_0xe7f0,0x147));var _0x0e7f=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xe7f0[_0x466af7];return _0x348c96;};'use strict';var _=require(_0x0e7f('0x0'));var util=require(_0x0e7f('0x1'));var moment=require(_0x0e7f('0x2'));var BPromise=require(_0x0e7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e7f('0x4'));var db=require(_0x0e7f('0x5'))['db'];var utils=require(_0x0e7f('0x6'));var logger=require(_0x0e7f('0x7'))(_0x0e7f('0x8'));var config=require(_0x0e7f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0e7f('0xa')][_0x0e7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eeea6,_0x119c4b,_0x3ef4cf){return new BPromise(function(_0x116005,_0x12ed96){return client[_0x0e7f('0xc')](_0x4eeea6,_0x3ef4cf)['then'](function(_0x5e2117){logger[_0x0e7f('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x119c4b,_0x0e7f('0xe'));logger[_0x0e7f('0xf')](_0x0e7f('0x10'),_0x119c4b,'request\x20sent',JSON['stringify'](_0x5e2117));if(_0x5e2117[_0x0e7f('0x11')]){if(_0x5e2117[_0x0e7f('0x11')][_0x0e7f('0x12')]===0x1f4){logger[_0x0e7f('0x11')](_0x0e7f('0x13'),_0x119c4b,_0x5e2117['error'][_0x0e7f('0x14')]);return _0x12ed96(_0x5e2117[_0x0e7f('0x11')]['message']);}logger[_0x0e7f('0x11')](_0x0e7f('0x13'),_0x119c4b,_0x5e2117[_0x0e7f('0x11')]['message']);return _0x116005(_0x5e2117[_0x0e7f('0x11')][_0x0e7f('0x14')]);}else{logger[_0x0e7f('0xd')](_0x0e7f('0x13'),_0x119c4b,_0x0e7f('0xe'));_0x116005(_0x5e2117[_0x0e7f('0x15')][_0x0e7f('0x14')]);}})[_0x0e7f('0x16')](function(_0x33d424){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x119c4b,_0x33d424);_0x12ed96(_0x33d424);});});}exports[_0x0e7f('0x17')]=function(_0x3f70e8){var _0x3103d2=this;return new Promise(function(_0x4e15dd,_0x1ae644){return db[_0x0e7f('0x18')][_0x0e7f('0x19')](_0x3f70e8[_0x0e7f('0x1a')],{'raw':_0x3f70e8['options']?_0x3f70e8[_0x0e7f('0x1b')][_0x0e7f('0x1c')]===undefined?!![]:![]:!![]})[_0x0e7f('0x1d')](function(_0x5d78dd){logger[_0x0e7f('0xd')]('CreateVoiceTransferReport',_0x3f70e8);logger['debug'](_0x0e7f('0x17'),_0x3f70e8,JSON[_0x0e7f('0x1e')](_0x5d78dd));_0x4e15dd(_0x5d78dd);})[_0x0e7f('0x16')](function(_0x3f97ae){logger[_0x0e7f('0x11')](_0x0e7f('0x17'),_0x3f97ae['message'],_0x3f70e8);_0x1ae644(_0x3103d2[_0x0e7f('0x11')](0x1f4,_0x3f97ae[_0x0e7f('0x14')]));});});}; \ No newline at end of file +var _0xde56=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','raw','CreateVoiceTransferReport','lodash'];(function(_0x1645b,_0x587e63){var _0x561fff=function(_0x3f2a42){while(--_0x3f2a42){_0x1645b['push'](_0x1645b['shift']());}};_0x561fff(++_0x587e63);}(_0xde56,0x144));var _0x6de5=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xde56[_0x596c43];return _0x4e1315;};'use strict';var _=require(_0x6de5('0x0'));var util=require('util');var moment=require(_0x6de5('0x1'));var BPromise=require(_0x6de5('0x2'));var rs=require(_0x6de5('0x3'));var fs=require('fs');var Redis=require(_0x6de5('0x4'));var db=require(_0x6de5('0x5'))['db'];var utils=require(_0x6de5('0x6'));var logger=require(_0x6de5('0x7'))(_0x6de5('0x8'));var config=require(_0x6de5('0x9'));var jayson=require(_0x6de5('0xa'));var client=jayson['client'][_0x6de5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141d65,_0x27dcfe,_0x1f8236){return new BPromise(function(_0x1cd11e,_0x3f1400){return client['request'](_0x141d65,_0x1f8236)['then'](function(_0x1769af){logger[_0x6de5('0xc')](_0x6de5('0xd'),_0x27dcfe,_0x6de5('0xe'));logger['debug'](_0x6de5('0xf'),_0x27dcfe,_0x6de5('0xe'),JSON[_0x6de5('0x10')](_0x1769af));if(_0x1769af[_0x6de5('0x11')]){if(_0x1769af['error'][_0x6de5('0x12')]===0x1f4){logger[_0x6de5('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x27dcfe,_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);return _0x3f1400(_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);}logger['error'](_0x6de5('0xd'),_0x27dcfe,_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);return _0x1cd11e(_0x1769af[_0x6de5('0x11')]['message']);}else{logger[_0x6de5('0xc')](_0x6de5('0xd'),_0x27dcfe,_0x6de5('0xe'));_0x1cd11e(_0x1769af[_0x6de5('0x14')]['message']);}})[_0x6de5('0x15')](function(_0x2316a6){logger[_0x6de5('0x11')](_0x6de5('0xd'),_0x27dcfe,_0x2316a6);_0x3f1400(_0x2316a6);});});}exports['CreateVoiceTransferReport']=function(_0x1752f5){var _0x7b934e=this;return new Promise(function(_0x385ade,_0x344bbb){return db['VoiceTransferReport']['create'](_0x1752f5[_0x6de5('0x16')],{'raw':_0x1752f5['options']?_0x1752f5['options'][_0x6de5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x37a64d){logger[_0x6de5('0xc')](_0x6de5('0x18'),_0x1752f5);logger['debug'](_0x6de5('0x18'),_0x1752f5,JSON['stringify'](_0x37a64d));_0x385ade(_0x37a64d);})['catch'](function(_0x4c9621){logger['error'](_0x6de5('0x18'),_0x4c9621[_0x6de5('0x13')],_0x1752f5);_0x344bbb(_0x7b934e[_0x6de5('0x11')](0x1f4,_0x4c9621[_0x6de5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ad02f1f..b3c361e 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x59f0ff,_0x2b9d67){var _0x28e782=function(_0x437e09){while(--_0x437e09){_0x59f0ff['push'](_0x59f0ff['shift']());}};_0x28e782(++_0x2b9d67);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router; \ No newline at end of file +var _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x2abb8d,_0xfd1769){var _0x3f8dea=function(_0x25b6fc){while(--_0x25b6fc){_0x2abb8d['push'](_0x2abb8d['shift']());}};_0x3f8dea(++_0xfd1769);}(_0x0bb5,0x148));var _0x50bb=function(_0x5d1ce2,_0x2fba4f){_0x5d1ce2=_0x5d1ce2-0x0;var _0x3b8f1e=_0x0bb5[_0x5d1ce2];return _0x3b8f1e;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2629ad6..db87d4b 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 _0x3dbb=['rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','webbar:originate','catch','hangup\x20fired:','format','hangup\x20executed!','entityFound:','user:%s','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','UserId','conference\x20fired:','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','send','status','NotFound','then','code','message','User','findOne','agent','VoiceChannels','all','filter'];(function(_0x4c1d77,_0x9d5b64){var _0x5300f6=function(_0x3bf535){while(--_0x3bf535){_0x4c1d77['push'](_0x4c1d77['shift']());}};_0x5300f6(++_0x9d5b64);}(_0x3dbb,0x67));var _0xb3db=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x3dbb[_0x55d911];return _0x3104c2;};'use strict';var path=require(_0xb3db('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xb3db('0x1'));var util=require(_0xb3db('0x2'));var BPromise=require('bluebird');var jayson=require(_0xb3db('0x3'));var amiClient=jayson[_0xb3db('0x4')][_0xb3db('0x5')]({'port':0x232a});var logger=require(_0xb3db('0x6'))('webbarapi');var Redis=require(_0xb3db('0x7'));config['redis']=_['defaults'](config[_0xb3db('0x8')],{'host':_0xb3db('0x9'),'port':0x18eb});var io=require(_0xb3db('0xa'))(new Redis(config['redis']));var Schema=require(_0xb3db('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb3db('0xc')]},'callNumber':{'type':_0xb3db('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xb3db('0xd')},'callbackUrl':{'type':_0xb3db('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb3db('0xd'),'required':[!![],_0xb3db('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb3db('0xc')]}});function emit(_0x140063,_0x20b31f,_0x3cb72c){logger[_0xb3db('0x10')](_0x140063,_0x20b31f,JSON[_0xb3db('0x11')](_0x3cb72c));io['to'](_0x140063)['emit'](_0x20b31f,_0x3cb72c);}function handleError(_0x415157){return function(_0x40939f){console[_0xb3db('0x12')](_0xb3db('0x13'),_0x40939f,_0x40939f instanceof RangeError);logger[_0xb3db('0x14')](_0x40939f[_0xb3db('0x15')]);if(_0x40939f instanceof RangeError){if(_0x40939f[_0xb3db('0x16')]){delete _0x40939f[_0xb3db('0x16')];}_0x415157['status'](0x194)[_0xb3db('0x17')](_0x40939f);}else{if(_0x40939f[_0xb3db('0x16')]){delete _0x40939f[_0xb3db('0x16')];}_0x415157[_0xb3db('0x18')](0x1f4)['send'](_0x40939f);}};}function checkError(){return function(_0x458f9f){if(!_0x458f9f){throw new RangeError(_0xb3db('0x19'));}return _0x458f9f;};}function respondWithRpcPromise(_0x33e33a,_0x7fc1a7){return new BPromise(function(_0x80f75e,_0x52d719){var _0x29c9f6=amiClient;return _0x29c9f6['request'](_0x33e33a,_0x7fc1a7)[_0xb3db('0x1a')](function(_0x3a8d67){if(_0x3a8d67[_0xb3db('0x14')]){if(_0x3a8d67['error'][_0xb3db('0x1b')]===0x1f4){return _0x52d719(_0x3a8d67[_0xb3db('0x14')][_0xb3db('0x1c')]);}return _0x80f75e(_0x3a8d67[_0xb3db('0x14')][_0xb3db('0x1c')]);}else{_0x80f75e(_0x3a8d67['result']);}})['catch'](function(_0x3db9a5){_0x52d719(_0x3db9a5);});});}function getAgent(_0x40e400){return db[_0xb3db('0x1d')][_0xb3db('0x1e')]({'where':{'id':_0x40e400,'role':_0xb3db('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x34bbb5,_0x102434){return new BPromise(function(_0x3c7533,_0x13697d){var _0x3045fc=respondWithRpcPromise(_0xb3db('0x20'));var _0x10e761=getAgent(_0x34bbb5);Promise[_0xb3db('0x21')]([_0x3045fc,_0x10e761])[_0xb3db('0x1a')](function(_0x287774){var _0x43596c=_0x287774[0x0];var _0x1844ec=_0x287774[0x1];var _0x417083=_[_0xb3db('0x22')](_0x43596c[_0xb3db('0x23')],function(_0x2baf84){return _0x2baf84['UserId']==_0x1844ec['id']&&_0x2baf84[_0xb3db('0x24')]==_0x102434;});if(_0x417083[_0xb3db('0x25')]==0x1){_0x3c7533(_0x1844ec);}else{_0x13697d(new RangeError(_0xb3db('0x26')+_0x102434+_0xb3db('0x27')));}});});}exports[_0xb3db('0x28')]=function(_0x5a8ce6,_0x5dfb8b){logger[_0xb3db('0x10')](_0xb3db('0x29'),_0x5a8ce6[_0xb3db('0x2a')]);var _0x19405c=originateValidation[_0xb3db('0xb')](_0x5a8ce6[_0xb3db('0x2a')]);if(_0x19405c['length']>0x0){return _0x5dfb8b[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x19405c);}var _0x3b9ceb=_0x5a8ce6['body'][_0xb3db('0x2c')];var _0x253033=_0x5a8ce6[_0xb3db('0x2a')][_0xb3db('0x2d')];var _0x480c89=_0x5a8ce6['body'][_0xb3db('0x2e')];var _0x5a9a66=_0x5a8ce6[_0xb3db('0x2a')][_0xb3db('0x2f')];return getAgent(_0x3b9ceb)['then'](function(_0x4d69b5){logger[_0xb3db('0x10')]('entityFound:',_0x4d69b5[_0xb3db('0x16')]);emit(util['format']('user:%s',_0x4d69b5[_0xb3db('0x16')]),_0xb3db('0x30'),{'callNumber':_0x253033,'callerId':_0x480c89,'callbackUrl':_0x5a9a66});return _0x5dfb8b['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0xb3db('0x31')](handleError(_0x5dfb8b));};exports['hangup']=function(_0x3c83b7,_0x1b9343){logger['info'](_0xb3db('0x32'),_0x3c83b7[_0xb3db('0x2a')]);var _0xfb8425=hangupValidation[_0xb3db('0xb')](_0x3c83b7[_0xb3db('0x2a')]);if(_0xfb8425['length']>0x0){return _0x1b9343[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0xfb8425);}var _0x403099=_0x3c83b7[_0xb3db('0x2a')]['userId'];var _0x43355e=_0x3c83b7[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x403099)[_0xb3db('0x1a')](function(_0xfa15f8){logger['info']('entityFound:',_0xfa15f8[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')]('user:%s',_0xfa15f8['name']),'webbar:hangup',{'sessionId':_0x43355e});return _0x1b9343['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x34')});})[_0xb3db('0x31')](handleError(_0x1b9343));};exports['answer']=function(_0x42898c,_0x47654a){logger[_0xb3db('0x10')]('answer\x20fired:',_0x42898c['body']);var _0x27ffc0=answerValidation['validate'](_0x42898c[_0xb3db('0x2a')]);if(_0x27ffc0[_0xb3db('0x25')]>0x0){return _0x47654a[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x27ffc0);}var _0xc65a28=_0x42898c['body'][_0xb3db('0x2c')];var _0x84b216=_0x42898c[_0xb3db('0x2a')][_0xb3db('0x24')];return getAgent(_0xc65a28)['then'](function(_0xb146bd){logger[_0xb3db('0x10')](_0xb3db('0x35'),_0xb146bd[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0xb146bd[_0xb3db('0x16')]),'webbar:answer',{'sessionId':_0x84b216});return _0x47654a['status'](0xc8)['json']({'error':![],'message':_0xb3db('0x37')});})['catch'](handleError(_0x47654a));};exports[_0xb3db('0x38')]=function(_0x352658,_0x317dc6){logger[_0xb3db('0x10')](_0xb3db('0x39'),_0x352658['body']);var _0xb092df=holdValidation[_0xb3db('0xb')](_0x352658[_0xb3db('0x2a')]);if(_0xb092df[_0xb3db('0x25')]>0x0){return _0x317dc6[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0xb092df);}var _0x442151=_0x352658[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x78097=_0x352658[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x442151)[_0xb3db('0x1a')](function(_0x141886){logger[_0xb3db('0x10')](_0xb3db('0x35'),_0x141886[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0x141886[_0xb3db('0x16')]),_0xb3db('0x3a'),{'sessionId':_0x78097});return _0x317dc6[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x3b')});})['catch'](handleError(_0x317dc6));};exports['unhold']=function(_0x39c2d8,_0x3165c9){logger[_0xb3db('0x10')](_0xb3db('0x3c'),_0x39c2d8[_0xb3db('0x2a')]);var _0x33e8e3=unholdValidation[_0xb3db('0xb')](_0x39c2d8[_0xb3db('0x2a')]);if(_0x33e8e3['length']>0x0){return _0x3165c9['status'](0x190)[_0xb3db('0x2b')](_0x33e8e3);}var _0x2120ae=_0x39c2d8['body'][_0xb3db('0x2c')];var _0x1b5bca=_0x39c2d8[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x2120ae)[_0xb3db('0x1a')](function(_0x2353e2){logger['info'](_0xb3db('0x35'),_0x2353e2[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0x2353e2[_0xb3db('0x16')]),'webbar:unhold',{'sessionId':_0x1b5bca});return _0x3165c9['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x3d')});})[_0xb3db('0x31')](handleError(_0x3165c9));};exports['calls']=function(_0xd1a45,_0x4cf00c){logger[_0xb3db('0x10')](_0xb3db('0x3e'),_0x4cf00c[_0xb3db('0x2a')]);var _0x392ad0=callsValidation['validate'](_0xd1a45[_0xb3db('0x2a')]);if(_0x392ad0[_0xb3db('0x25')]>0x0){return _0x4cf00c['status'](0x190)[_0xb3db('0x2b')](_0x392ad0);}var _0x363b68=_0xd1a45[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x21ab77=respondWithRpcPromise(_0xb3db('0x20'));var _0x584709=getAgent(_0x363b68);return Promise[_0xb3db('0x21')]([_0x21ab77,_0x584709])[_0xb3db('0x1a')](function(_0x3c83b5){var _0x50f56f=_0x3c83b5[0x0];var _0xde281=_0x3c83b5[0x1];var _0x46025b=_[_0xb3db('0x22')](_0x50f56f[_0xb3db('0x23')],function(_0x4864bc){return _0x4864bc[_0xb3db('0x3f')]==_0xde281['id'];});return _0x4cf00c[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'count':_0x46025b[_0xb3db('0x25')],'rows':_0x46025b});})[_0xb3db('0x31')](handleError(_0x4cf00c));};exports['conference']=function(_0x24756d,_0x13409a){logger[_0xb3db('0x10')](_0xb3db('0x40'),_0x24756d['body']);var _0x5e87e6=conferenceValidation['validate'](_0x24756d[_0xb3db('0x2a')]);if(_0x5e87e6[_0xb3db('0x25')]>0x0){return _0x13409a[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x5e87e6);}var _0x74b31d=_0x24756d[_0xb3db('0x2a')][_0xb3db('0x2c')];return getAgent(_0x74b31d)[_0xb3db('0x1a')](function(_0x50c574){logger['info'](_0xb3db('0x35'),_0x50c574[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')]('user:%s',_0x50c574['name']),'webbar:conference');return _0x13409a[_0xb3db('0x18')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xb3db('0x31')](handleError(_0x13409a));};exports[_0xb3db('0x41')]=function(_0x125fe1,_0x2cd4c9){logger[_0xb3db('0x10')]('transfer\x20fired:',_0x125fe1[_0xb3db('0x2a')]);var _0x31b0bc=transferValidation[_0xb3db('0xb')](_0x125fe1[_0xb3db('0x2a')]);if(_0x31b0bc[_0xb3db('0x25')]>0x0){return _0x2cd4c9[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x31b0bc);}var _0x5c7c8a=_0x125fe1[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x3b9228=_0x125fe1['body'][_0xb3db('0x24')];var _0x49ef4a=_0x125fe1[_0xb3db('0x2a')][_0xb3db('0x42')];return getAgent(_0x5c7c8a)[_0xb3db('0x1a')](function(_0x33f9eb){logger['info'](_0xb3db('0x35'),_0x33f9eb['name']);emit(util[_0xb3db('0x33')]('user:%s',_0x33f9eb[_0xb3db('0x16')]),_0xb3db('0x43'),{'sessionId':_0x3b9228,'transferNumber':_0x49ef4a});return _0x2cd4c9[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x44')});})[_0xb3db('0x31')](handleError(_0x2cd4c9));}; \ No newline at end of file +var _0x3685=['error','name','status','send','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','user:%s','webbar:hangup','hangup\x20executed!','entityFound:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','util','jayson/promise','client','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','handleError:'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x3685,0x1aa));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x5368('0x0'));var fs=require('fs');var _=require(_0x5368('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x5368('0x2'));var BPromise=require('bluebird');var jayson=require(_0x5368('0x3'));var amiClient=jayson[_0x5368('0x4')]['http']({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x5368('0x5'));config[_0x5368('0x6')]=_[_0x5368('0x7')](config[_0x5368('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5368('0x8'))(new Redis(config['redis']));var Schema=require(_0x5368('0x9'));var originateValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],_0x5368('0xb')]},'callNumber':{'type':_0x5368('0xc'),'required':[!![],_0x5368('0xd')]},'callerId':{'type':_0x5368('0xc')},'callbackUrl':{'type':_0x5368('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5368('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5368('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],_0x5368('0xb')]},'sessionId':{'type':'string','required':[!![],_0x5368('0xe')]},'transferNumber':{'type':'string','required':[!![],_0x5368('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],_0x5368('0xb')]},'sessionId':{'type':_0x5368('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],_0x5368('0xb')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5368('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5368('0xa'),'required':[!![],_0x5368('0xb')]}});function emit(_0x3648a2,_0x2c5c35,_0x2196b3){logger[_0x5368('0x10')](_0x3648a2,_0x2c5c35,JSON['stringify'](_0x2196b3));io['to'](_0x3648a2)['emit'](_0x2c5c35,_0x2196b3);}function handleError(_0x3973ee){return function(_0x5bb682){console['log'](_0x5368('0x11'),_0x5bb682,_0x5bb682 instanceof RangeError);logger[_0x5368('0x12')](_0x5bb682['stack']);if(_0x5bb682 instanceof RangeError){if(_0x5bb682['name']){delete _0x5bb682[_0x5368('0x13')];}_0x3973ee[_0x5368('0x14')](0x194)[_0x5368('0x15')](_0x5bb682);}else{if(_0x5bb682[_0x5368('0x13')]){delete _0x5bb682[_0x5368('0x13')];}_0x3973ee[_0x5368('0x14')](0x1f4)[_0x5368('0x15')](_0x5bb682);}};}function checkError(){return function(_0x3909e3){if(!_0x3909e3){throw new RangeError(_0x5368('0x16'));}return _0x3909e3;};}function respondWithRpcPromise(_0x475ac4,_0x2fd1dc){return new BPromise(function(_0xf9efff,_0x7212b2){var _0x337e3c=amiClient;return _0x337e3c['request'](_0x475ac4,_0x2fd1dc)[_0x5368('0x17')](function(_0x1855de){if(_0x1855de[_0x5368('0x12')]){if(_0x1855de['error'][_0x5368('0x18')]===0x1f4){return _0x7212b2(_0x1855de[_0x5368('0x12')]['message']);}return _0xf9efff(_0x1855de[_0x5368('0x12')][_0x5368('0x19')]);}else{_0xf9efff(_0x1855de[_0x5368('0x1a')]);}})[_0x5368('0x1b')](function(_0x251154){_0x7212b2(_0x251154);});});}function getAgent(_0x112445){return db[_0x5368('0x1c')][_0x5368('0x1d')]({'where':{'id':_0x112445,'role':_0x5368('0x1e')}})[_0x5368('0x17')](checkError());}function getAgentCheckSession(_0x4eda2d,_0x4a3717){return new BPromise(function(_0x292493,_0x4ca928){var _0x280fb7=respondWithRpcPromise(_0x5368('0x1f'));var _0x2e0f14=getAgent(_0x4eda2d);Promise[_0x5368('0x20')]([_0x280fb7,_0x2e0f14])[_0x5368('0x17')](function(_0x16996d){var _0x2adacd=_0x16996d[0x0];var _0x1457ca=_0x16996d[0x1];var _0x21632d=_[_0x5368('0x21')](_0x2adacd[_0x5368('0x22')],function(_0x3f6bbd){return _0x3f6bbd[_0x5368('0x23')]==_0x1457ca['id']&&_0x3f6bbd['sessionId']==_0x4a3717;});if(_0x21632d[_0x5368('0x24')]==0x1){_0x292493(_0x1457ca);}else{_0x4ca928(new RangeError(_0x5368('0x25')+_0x4a3717+_0x5368('0x26')));}});});}exports[_0x5368('0x27')]=function(_0x387aee,_0x4d8169){logger[_0x5368('0x10')](_0x5368('0x28'),_0x387aee[_0x5368('0x29')]);var _0x204856=originateValidation['validate'](_0x387aee[_0x5368('0x29')]);if(_0x204856[_0x5368('0x24')]>0x0){return _0x4d8169['status'](0x190)[_0x5368('0x2a')](_0x204856);}var _0x32709a=_0x387aee['body'][_0x5368('0x2b')];var _0x1e38a6=_0x387aee[_0x5368('0x29')][_0x5368('0x2c')];var _0x30f39b=_0x387aee[_0x5368('0x29')]['callerId'];var _0x22cc3f=_0x387aee[_0x5368('0x29')][_0x5368('0x2d')];return getAgent(_0x32709a)['then'](function(_0x381fef){logger[_0x5368('0x10')]('entityFound:',_0x381fef[_0x5368('0x13')]);emit(util[_0x5368('0x2e')]('user:%s',_0x381fef[_0x5368('0x13')]),_0x5368('0x2f'),{'callNumber':_0x1e38a6,'callerId':_0x30f39b,'callbackUrl':_0x22cc3f});return _0x4d8169[_0x5368('0x14')](0xc8)['json']({'error':![],'message':_0x5368('0x30')});})[_0x5368('0x1b')](handleError(_0x4d8169));};exports[_0x5368('0x31')]=function(_0x3006d9,_0x5d47b2){logger[_0x5368('0x10')](_0x5368('0x32'),_0x3006d9[_0x5368('0x29')]);var _0x42fe5a=hangupValidation['validate'](_0x3006d9[_0x5368('0x29')]);if(_0x42fe5a[_0x5368('0x24')]>0x0){return _0x5d47b2[_0x5368('0x14')](0x190)[_0x5368('0x2a')](_0x42fe5a);}var _0x4ebc38=_0x3006d9['body'][_0x5368('0x2b')];var _0x2653ed=_0x3006d9[_0x5368('0x29')][_0x5368('0x33')];return getAgent(_0x4ebc38)[_0x5368('0x17')](function(_0x4d76b9){logger[_0x5368('0x10')]('entityFound:',_0x4d76b9[_0x5368('0x13')]);emit(util[_0x5368('0x2e')](_0x5368('0x34'),_0x4d76b9['name']),_0x5368('0x35'),{'sessionId':_0x2653ed});return _0x5d47b2['status'](0xc8)[_0x5368('0x2a')]({'error':![],'message':_0x5368('0x36')});})[_0x5368('0x1b')](handleError(_0x5d47b2));};exports['answer']=function(_0x147768,_0x1a125){logger['info']('answer\x20fired:',_0x147768[_0x5368('0x29')]);var _0x5cc03c=answerValidation['validate'](_0x147768['body']);if(_0x5cc03c[_0x5368('0x24')]>0x0){return _0x1a125[_0x5368('0x14')](0x190)[_0x5368('0x2a')](_0x5cc03c);}var _0x285dd9=_0x147768[_0x5368('0x29')][_0x5368('0x2b')];var _0x481a8d=_0x147768[_0x5368('0x29')]['sessionId'];return getAgent(_0x285dd9)['then'](function(_0x3410bd){logger[_0x5368('0x10')](_0x5368('0x37'),_0x3410bd['name']);emit(util[_0x5368('0x2e')](_0x5368('0x34'),_0x3410bd['name']),_0x5368('0x38'),{'sessionId':_0x481a8d});return _0x1a125[_0x5368('0x14')](0xc8)['json']({'error':![],'message':_0x5368('0x39')});})[_0x5368('0x1b')](handleError(_0x1a125));};exports[_0x5368('0x3a')]=function(_0x2804bc,_0x42da35){logger['info']('hold\x20fired:',_0x2804bc[_0x5368('0x29')]);var _0x412532=holdValidation[_0x5368('0x9')](_0x2804bc['body']);if(_0x412532['length']>0x0){return _0x42da35[_0x5368('0x14')](0x190)[_0x5368('0x2a')](_0x412532);}var _0x20eb2b=_0x2804bc['body'][_0x5368('0x2b')];var _0x54d2ba=_0x2804bc['body']['sessionId'];return getAgent(_0x20eb2b)[_0x5368('0x17')](function(_0x298f89){logger[_0x5368('0x10')]('entityFound:',_0x298f89[_0x5368('0x13')]);emit(util[_0x5368('0x2e')]('user:%s',_0x298f89['name']),_0x5368('0x3b'),{'sessionId':_0x54d2ba});return _0x42da35[_0x5368('0x14')](0xc8)['json']({'error':![],'message':_0x5368('0x3c')});})[_0x5368('0x1b')](handleError(_0x42da35));};exports[_0x5368('0x3d')]=function(_0x3f72e0,_0x779395){logger[_0x5368('0x10')]('unhold\x20fired:',_0x3f72e0['body']);var _0x4b266e=unholdValidation[_0x5368('0x9')](_0x3f72e0[_0x5368('0x29')]);if(_0x4b266e['length']>0x0){return _0x779395['status'](0x190)['json'](_0x4b266e);}var _0x3696a2=_0x3f72e0['body'][_0x5368('0x2b')];var _0x5bfe51=_0x3f72e0['body'][_0x5368('0x33')];return getAgent(_0x3696a2)['then'](function(_0x10ba5c){logger[_0x5368('0x10')](_0x5368('0x37'),_0x10ba5c['name']);emit(util[_0x5368('0x2e')](_0x5368('0x34'),_0x10ba5c['name']),_0x5368('0x3e'),{'sessionId':_0x5bfe51});return _0x779395[_0x5368('0x14')](0xc8)[_0x5368('0x2a')]({'error':![],'message':_0x5368('0x3f')});})[_0x5368('0x1b')](handleError(_0x779395));};exports[_0x5368('0x40')]=function(_0x3fc171,_0x3f779c){logger['info'](_0x5368('0x41'),_0x3f779c[_0x5368('0x29')]);var _0x2a77a2=callsValidation[_0x5368('0x9')](_0x3fc171[_0x5368('0x29')]);if(_0x2a77a2[_0x5368('0x24')]>0x0){return _0x3f779c[_0x5368('0x14')](0x190)[_0x5368('0x2a')](_0x2a77a2);}var _0x19c4e5=_0x3fc171[_0x5368('0x29')][_0x5368('0x2b')];var _0x1629d6=respondWithRpcPromise(_0x5368('0x1f'));var _0x4017e9=getAgent(_0x19c4e5);return Promise[_0x5368('0x20')]([_0x1629d6,_0x4017e9])[_0x5368('0x17')](function(_0x5d3e92){var _0x358e31=_0x5d3e92[0x0];var _0x22606f=_0x5d3e92[0x1];var _0x1b8eb9=_['filter'](_0x358e31[_0x5368('0x22')],function(_0x19fceb){return _0x19fceb[_0x5368('0x23')]==_0x22606f['id'];});return _0x3f779c[_0x5368('0x14')](0xc8)[_0x5368('0x2a')]({'count':_0x1b8eb9[_0x5368('0x24')],'rows':_0x1b8eb9});})['catch'](handleError(_0x3f779c));};exports[_0x5368('0x42')]=function(_0x23d101,_0x9d6ca2){logger[_0x5368('0x10')](_0x5368('0x43'),_0x23d101[_0x5368('0x29')]);var _0x28fb18=conferenceValidation['validate'](_0x23d101[_0x5368('0x29')]);if(_0x28fb18[_0x5368('0x24')]>0x0){return _0x9d6ca2[_0x5368('0x14')](0x190)['json'](_0x28fb18);}var _0x480379=_0x23d101[_0x5368('0x29')]['userId'];return getAgent(_0x480379)[_0x5368('0x17')](function(_0x2065d0){logger[_0x5368('0x10')](_0x5368('0x37'),_0x2065d0[_0x5368('0x13')]);emit(util[_0x5368('0x2e')]('user:%s',_0x2065d0[_0x5368('0x13')]),_0x5368('0x44'));return _0x9d6ca2[_0x5368('0x14')](0xc8)[_0x5368('0x2a')]({'error':![],'message':_0x5368('0x45')});})[_0x5368('0x1b')](handleError(_0x9d6ca2));};exports['transfer']=function(_0x5a91b8,_0x30b3d4){logger[_0x5368('0x10')](_0x5368('0x46'),_0x5a91b8[_0x5368('0x29')]);var _0x2be418=transferValidation[_0x5368('0x9')](_0x5a91b8[_0x5368('0x29')]);if(_0x2be418[_0x5368('0x24')]>0x0){return _0x30b3d4[_0x5368('0x14')](0x190)['json'](_0x2be418);}var _0x542115=_0x5a91b8[_0x5368('0x29')][_0x5368('0x2b')];var _0x47a3eb=_0x5a91b8[_0x5368('0x29')]['sessionId'];var _0x1cadca=_0x5a91b8['body'][_0x5368('0x47')];return getAgent(_0x542115)[_0x5368('0x17')](function(_0x26f67e){logger['info'](_0x5368('0x37'),_0x26f67e[_0x5368('0x13')]);emit(util[_0x5368('0x2e')](_0x5368('0x34'),_0x26f67e[_0x5368('0x13')]),_0x5368('0x48'),{'sessionId':_0x47a3eb,'transferNumber':_0x1cadca});return _0x30b3d4[_0x5368('0x14')](0xc8)['json']({'error':![],'message':_0x5368('0x49')});})[_0x5368('0x1b')](handleError(_0x30b3d4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 226ca2d..22b4562 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 _0xc925=['removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','destroy','delete','removeAnswers'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xc925,0xf7));var _0x5c92=function(_0x15ca75,_0x335828){_0x15ca75=_0x15ca75-0x0;var _0x2af8a6=_0xc925[_0x15ca75];return _0x2af8a6;};'use strict';var multer=require('multer');var util=require(_0x5c92('0x0'));var path=require(_0x5c92('0x1'));var timeout=require(_0x5c92('0x2'));var express=require(_0x5c92('0x3'));var router=express['Router']();var fs_extra=require(_0x5c92('0x4'));var auth=require(_0x5c92('0x5'));var interaction=require(_0x5c92('0x6'));var config=require('../../config/environment');var controller=require(_0x5c92('0x7'));router[_0x5c92('0x8')]('/',auth['isAuthenticated'](),controller[_0x5c92('0x9')]);router[_0x5c92('0x8')](_0x5c92('0xa'),auth[_0x5c92('0xb')](),controller[_0x5c92('0xc')]);router[_0x5c92('0x8')](_0x5c92('0xd'),auth['isAuthenticated'](),controller[_0x5c92('0xe')]);router['get'](_0x5c92('0xf'),auth[_0x5c92('0xb')](),controller[_0x5c92('0x10')]);router['get']('/:id/canned_answers',auth[_0x5c92('0xb')](),controller[_0x5c92('0x11')]);router[_0x5c92('0x8')](_0x5c92('0x12'),auth[_0x5c92('0xb')](),controller['getAgents']);router[_0x5c92('0x8')](_0x5c92('0x13'),auth[_0x5c92('0xb')](),controller[_0x5c92('0x14')]);router[_0x5c92('0x15')]('/',auth['isAuthenticated'](),controller[_0x5c92('0x16')]);router[_0x5c92('0x15')](_0x5c92('0xf'),auth['isAuthenticated'](),controller[_0x5c92('0x17')]);router[_0x5c92('0x15')]('/:id/canned_answers',auth[_0x5c92('0xb')](),controller[_0x5c92('0x18')]);router[_0x5c92('0x15')]('/:id/users',auth[_0x5c92('0xb')](),controller['addAgents']);router[_0x5c92('0x15')]('/:id/applications',auth[_0x5c92('0xb')](),controller[_0x5c92('0x19')]);router[_0x5c92('0x15')](_0x5c92('0x1a'),controller[_0x5c92('0x1b')]);router[_0x5c92('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0x5c92('0x1c')]);router[_0x5c92('0x1d')](_0x5c92('0xd'),auth[_0x5c92('0xb')](),controller['update']);router['delete'](_0x5c92('0xd'),auth[_0x5c92('0xb')](),controller[_0x5c92('0x1e')]);router[_0x5c92('0x1f')](_0x5c92('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5c92('0x1f')]('/:id/canned_answers',auth[_0x5c92('0xb')](),controller[_0x5c92('0x20')]);router[_0x5c92('0x1f')]('/:id/users',auth[_0x5c92('0xb')](),controller[_0x5c92('0x21')]);module[_0x5c92('0x22')]=router; \ No newline at end of file +var _0xa03a=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x2ebe9e,_0x5e3747){var _0x44b434=function(_0x499856){while(--_0x499856){_0x2ebe9e['push'](_0x2ebe9e['shift']());}};_0x44b434(++_0x5e3747);}(_0xa03a,0xb5));var _0xaa03=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xa03a[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xaa03('0x0'));var util=require(_0xaa03('0x1'));var path=require(_0xaa03('0x2'));var timeout=require(_0xaa03('0x3'));var express=require('express');var router=express[_0xaa03('0x4')]();var fs_extra=require(_0xaa03('0x5'));var auth=require(_0xaa03('0x6'));var interaction=require(_0xaa03('0x7'));var config=require(_0xaa03('0x8'));var controller=require('./whatsappAccount.controller');router[_0xaa03('0x9')]('/',auth[_0xaa03('0xa')](),controller[_0xaa03('0xb')]);router[_0xaa03('0x9')](_0xaa03('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xaa03('0x9')](_0xaa03('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xaa03('0x9')](_0xaa03('0xe'),auth[_0xaa03('0xa')](),controller[_0xaa03('0xf')]);router[_0xaa03('0x9')](_0xaa03('0x10'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x11')]);router[_0xaa03('0x9')](_0xaa03('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xaa03('0x13'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x14')]);router[_0xaa03('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa03('0x15')](_0xaa03('0xe'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x16')]);router[_0xaa03('0x15')](_0xaa03('0x10'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x17')]);router[_0xaa03('0x15')](_0xaa03('0x12'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x18')]);router[_0xaa03('0x15')](_0xaa03('0x13'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x19')]);router['post']('/:id/notify',controller[_0xaa03('0x1a')]);router['post'](_0xaa03('0x1b'),auth['isAuthenticated'](),controller[_0xaa03('0x1c')]);router[_0xaa03('0x1d')](_0xaa03('0xd'),auth[_0xaa03('0xa')](),controller['update']);router[_0xaa03('0x1e')]('/:id',auth[_0xaa03('0xa')](),controller[_0xaa03('0x1f')]);router[_0xaa03('0x1e')](_0xaa03('0xe'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x20')]);router['delete'](_0xaa03('0x10'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x21')]);router[_0xaa03('0x1e')](_0xaa03('0x12'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x22')]);module[_0xaa03('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 72188f7..1505dd7 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 _0xd32e=['STRING','ENUM','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','mandatoryDispositionPauseId','sequelize','randomstring','exports','name'];(function(_0x4b775b,_0x2aadc6){var _0xf84d39=function(_0x55ac96){while(--_0x55ac96){_0x4b775b['push'](_0x4b775b['shift']());}};_0xf84d39(++_0x2aadc6);}(_0xd32e,0x106));var _0xed32=function(_0xaaa784,_0x38deb9){_0xaaa784=_0xaaa784-0x0;var _0xff87f8=_0xd32e[_0xaaa784];return _0xff87f8;};'use strict';var Sequelize=require(_0xed32('0x0'));var rs=require(_0xed32('0x1'));module[_0xed32('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xed32('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xed32('0x4')]},'type':{'type':Sequelize[_0xed32('0x5')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xed32('0x4')]},'baseUrl':{'type':Sequelize[_0xed32('0x4')]},'authToken':{'type':Sequelize[_0xed32('0x4')]},'notificationTemplate':{'type':Sequelize[_0xed32('0x6')],'defaultValue':function(){return _0xed32('0x7');}},'notificationSound':{'type':Sequelize[_0xed32('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xed32('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed32('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed32('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed32('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed32('0x9')],'comment':_0xed32('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xed32('0xb'),'set':function(_0x58714c){if(!_0x58714c){this[_0xed32('0xc')](_0xed32('0xd'),null);}this[_0xed32('0xc')]('mandatoryDisposition',_0x58714c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d1e=['twilio','sinch','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','randomstring','exports','STRING','generate','ENUM'];(function(_0x30c744,_0x4df88e){var _0x19fe57=function(_0x49c957){while(--_0x49c957){_0x30c744['push'](_0x30c744['shift']());}};_0x19fe57(++_0x4df88e);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x1d1e[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe1d1('0x0'));module[_0xe1d1('0x1')]={'name':{'type':Sequelize[_0xe1d1('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe1d1('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe1d1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe1d1('0x2')],'defaultValue':function(){return rs[_0xe1d1('0x3')]();}},'phone':{'type':Sequelize[_0xe1d1('0x2')]},'type':{'type':Sequelize[_0xe1d1('0x4')](_0xe1d1('0x5'),_0xe1d1('0x6'))},'accountSid':{'type':Sequelize[_0xe1d1('0x2')]},'baseUrl':{'type':Sequelize[_0xe1d1('0x2')]},'authToken':{'type':Sequelize[_0xe1d1('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe1d1('0x7')],'defaultValue':function(){return _0xe1d1('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe1d1('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe1d1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe1d1('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe1d1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe1d1('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe1d1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe1d1('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xe1d1('0x9')],'defaultValue':![],'comment':_0xe1d1('0xc'),'set':function(_0x188117){if(!_0x188117){this[_0xe1d1('0xd')]('mandatoryDispositionPauseId',null);}this[_0xe1d1('0xd')]('mandatoryDisposition',_0x188117);}},'description':{'type':Sequelize[_0xe1d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c45cfa9..5700c08 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 _0x7fb3=['Body','messageId','MessageSid','from','notifications','ValidationError','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','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','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','get','WhatsappAccounts','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','WhatsappAccount','includeAll','include','findAll','rows','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','rawAttributes','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','twilio','From','replace','whatsapp:'];(function(_0x1a4dda,_0x3295e0){var _0x2f14b3=function(_0x512b8b){while(--_0x512b8b){_0x1a4dda['push'](_0x1a4dda['shift']());}};_0x2f14b3(++_0x3295e0);}(_0x7fb3,0xf9));var _0x37fb=function(_0x1591f7,_0x5aedd6){_0x1591f7=_0x1591f7-0x0;var _0x4e1517=_0x7fb3[_0x1591f7];return _0x4e1517;};'use strict';var emlformat=require(_0x37fb('0x0'));var rimraf=require(_0x37fb('0x1'));var zipdir=require(_0x37fb('0x2'));var jsonpatch=require(_0x37fb('0x3'));var rp=require('request-promise');var moment=require(_0x37fb('0x4'));var BPromise=require(_0x37fb('0x5'));var Mustache=require(_0x37fb('0x6'));var util=require(_0x37fb('0x7'));var path=require('path');var sox=require(_0x37fb('0x8'));var csv=require(_0x37fb('0x9'));var ejs=require(_0x37fb('0xa'));var fs=require('fs');var fs_extra=require(_0x37fb('0xb'));var _=require(_0x37fb('0xc'));var squel=require(_0x37fb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x37fb('0x9'));var querystring=require(_0x37fb('0xe'));var Papa=require(_0x37fb('0xf'));var Redis=require(_0x37fb('0x10'));var authService=require(_0x37fb('0x11'));var qs=require(_0x37fb('0x12'));var as=require(_0x37fb('0x13'));var hardwareService=require(_0x37fb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x37fb('0x15'));var config=require(_0x37fb('0x16'));var licenseUtil=require(_0x37fb('0x17'));var db=require(_0x37fb('0x18'))['db'];config[_0x37fb('0x19')]=_[_0x37fb('0x1a')](config[_0x37fb('0x19')],{'host':_0x37fb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x37fb('0x1c'))[_0x37fb('0x1d')](socket);var jayson=require(_0x37fb('0x1e'));var client=jayson[_0x37fb('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1d27d6,_0x4e9456,_0x2efec0,_0x3d507f){return new BPromise(function(_0x232d42,_0xae35e){var _0x42b5ce=_0x3d507f||client;return _0x42b5ce[_0x37fb('0x20')](_0x1d27d6,_0x2efec0)[_0x37fb('0x21')](function(_0xbccbfb){logger[_0x37fb('0x22')](_0x37fb('0x23'),_0x4e9456,_0x37fb('0x24'));logger[_0x37fb('0x25')](_0x37fb('0x26'),_0x4e9456,_0x37fb('0x24'),JSON[_0x37fb('0x27')](_0xbccbfb));if(_0xbccbfb[_0x37fb('0x28')]){if(_0xbccbfb[_0x37fb('0x28')][_0x37fb('0x29')]===0x1f4){logger[_0x37fb('0x28')](_0x37fb('0x23'),_0x4e9456,_0xbccbfb[_0x37fb('0x28')]['message']);return _0xae35e(_0xbccbfb[_0x37fb('0x28')]['message']);}logger[_0x37fb('0x28')](_0x37fb('0x23'),_0x4e9456,_0xbccbfb[_0x37fb('0x28')][_0x37fb('0x2a')]);return _0x232d42(_0xbccbfb[_0x37fb('0x28')][_0x37fb('0x2a')]);}else{logger[_0x37fb('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4e9456,_0x37fb('0x24'));_0x232d42(_0xbccbfb['result']['message']);}})[_0x37fb('0x2b')](function(_0x5e1cef){logger[_0x37fb('0x28')](_0x37fb('0x23'),_0x4e9456,_0x5e1cef);_0xae35e(_0x5e1cef);});});}function respondWithStatusCode(_0x3db7e9,_0x267051){_0x267051=_0x267051||0xcc;return function(_0x408024){if(_0x408024){return _0x3db7e9[_0x37fb('0x2c')](_0x267051);}return _0x3db7e9[_0x37fb('0x2d')](_0x267051)[_0x37fb('0x2e')]();};}function respondWithResult(_0x37036e,_0x5b441b){_0x5b441b=_0x5b441b||0xc8;return function(_0x20b834){if(_0x20b834){return _0x37036e[_0x37fb('0x2d')](_0x5b441b)['json'](_0x20b834);}};}function respondWithFilteredResult(_0x5f189a,_0x3ac248){return function(_0x17c587){if(_0x17c587){var _0xfe4421=typeof _0x3ac248[_0x37fb('0x2f')]===_0x37fb('0x30')&&typeof _0x3ac248[_0x37fb('0x31')]==='undefined';var _0x915b0d=_0x17c587[_0x37fb('0x32')];var _0x472f49=_0xfe4421?0x0:_0x3ac248['offset'];var _0x435614=_0xfe4421?_0x17c587[_0x37fb('0x32')]:_0x3ac248[_0x37fb('0x2f')]+_0x3ac248[_0x37fb('0x31')];var _0x3abd59;if(_0x435614>=_0x915b0d){_0x435614=_0x915b0d;_0x3abd59=0xc8;}else{_0x3abd59=0xce;}_0x5f189a[_0x37fb('0x2d')](_0x3abd59);return _0x5f189a[_0x37fb('0x33')](_0x37fb('0x34'),_0x472f49+'-'+_0x435614+'/'+_0x915b0d)[_0x37fb('0x35')](_0x17c587);}return null;};}function patchUpdates(_0xafe001){return function(_0x38b0f4){try{jsonpatch['apply'](_0x38b0f4,_0xafe001,!![]);}catch(_0x2ca432){return BPromise[_0x37fb('0x36')](_0x2ca432);}return _0x38b0f4[_0x37fb('0x37')]();};}function saveUpdates(_0x5b93bc,_0x1ad9b3){return function(_0x37d071){if(_0x37d071){return _0x37d071['update'](_0x5b93bc)[_0x37fb('0x21')](function(_0x44aeb9){return _0x44aeb9;});}return null;};}function removeEntity(_0x3eddd7,_0x128637){return function(_0x208708){if(_0x208708){return _0x208708['destroy']()[_0x37fb('0x21')](function(){var _0x2b879a=_0x208708[_0x37fb('0x38')]({'plain':!![]});var _0x49d5b0=_0x37fb('0x39');return db['UserProfileResource'][_0x37fb('0x3a')]({'where':{'type':_0x49d5b0,'resourceId':_0x2b879a['id']}})['then'](function(){return _0x208708;});})[_0x37fb('0x21')](function(){_0x3eddd7['status'](0xcc)[_0x37fb('0x2e')]();});}};}function handleEntityNotFound(_0x2ad8ae,_0x57612e){return function(_0x49aae0){if(!_0x49aae0){_0x2ad8ae[_0x37fb('0x2c')](0x194);}return _0x49aae0;};}function handleError(_0x481ce6,_0x5a755){_0x5a755=_0x5a755||0x1f4;return function(_0x13b622){logger[_0x37fb('0x28')](_0x13b622[_0x37fb('0x3b')]);if(_0x13b622[_0x37fb('0x3c')]){delete _0x13b622[_0x37fb('0x3c')];}_0x481ce6[_0x37fb('0x2d')](_0x5a755)['send'](_0x13b622);};}exports[_0x37fb('0x3d')]=function(_0x1463be,_0x3c64a5){var _0x4afeca={'include':[{'model':db[_0x37fb('0x3e')],'as':_0x37fb('0x3f')}]},_0x417d58={},_0x5992f6={'count':0x0,'rows':[]};var _0x63e1d3=_[_0x37fb('0x40')](db['WhatsappAccount']['rawAttributes'],function(_0x4a0d40){return{'name':_0x4a0d40[_0x37fb('0x41')],'type':_0x4a0d40[_0x37fb('0x42')][_0x37fb('0x43')]};});_0x417d58[_0x37fb('0x44')]=_[_0x37fb('0x40')](_0x63e1d3,_0x37fb('0x3c'));_0x417d58[_0x37fb('0x45')]=_[_0x37fb('0x46')](_0x1463be[_0x37fb('0x45')]);_0x417d58['filters']=_[_0x37fb('0x47')](_0x417d58[_0x37fb('0x44')],_0x417d58['query']);_0x4afeca[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x417d58[_0x37fb('0x44')],qs[_0x37fb('0x49')](_0x1463be['query'][_0x37fb('0x49')]));_0x4afeca['attributes']=_0x4afeca[_0x37fb('0x48')][_0x37fb('0x4a')]?_0x4afeca[_0x37fb('0x48')]:_0x417d58[_0x37fb('0x44')];if(!_0x1463be[_0x37fb('0x45')]['hasOwnProperty'](_0x37fb('0x4b'))){_0x4afeca[_0x37fb('0x31')]=qs['limit'](_0x1463be[_0x37fb('0x45')][_0x37fb('0x31')]);_0x4afeca[_0x37fb('0x2f')]=qs[_0x37fb('0x2f')](_0x1463be[_0x37fb('0x45')][_0x37fb('0x2f')]);}_0x4afeca[_0x37fb('0x4c')]=qs['sort'](_0x1463be[_0x37fb('0x45')][_0x37fb('0x4d')]);_0x4afeca['where']=qs[_0x37fb('0x4e')](_[_0x37fb('0x4f')](_0x1463be[_0x37fb('0x45')],_0x417d58[_0x37fb('0x4e')]),_0x63e1d3);if(_0x1463be['query'][_0x37fb('0x50')]){_0x4afeca[_0x37fb('0x51')]=_['merge'](_0x4afeca[_0x37fb('0x51')],{'$or':_[_0x37fb('0x40')](_0x63e1d3,function(_0x5b3c08){if(_0x5b3c08[_0x37fb('0x42')]!==_0x37fb('0x52')){var _0x4c63e5={};_0x4c63e5[_0x5b3c08['name']]={'$like':'%'+_0x1463be[_0x37fb('0x45')][_0x37fb('0x50')]+'%'};return _0x4c63e5;}})});}_0x4afeca=_[_0x37fb('0x53')]({},_0x4afeca,_0x1463be['options']);var _0x379397={'where':_0x4afeca['where']};return db[_0x37fb('0x54')][_0x37fb('0x32')](_0x379397)[_0x37fb('0x21')](function(_0x2360f9){_0x5992f6['count']=_0x2360f9;if(_0x1463be[_0x37fb('0x45')][_0x37fb('0x55')]){_0x4afeca[_0x37fb('0x56')]=[{'all':!![]}];}return db[_0x37fb('0x54')][_0x37fb('0x57')](_0x4afeca);})[_0x37fb('0x21')](function(_0x2f871d){_0x5992f6[_0x37fb('0x58')]=_0x2f871d;return _0x5992f6;})[_0x37fb('0x21')](respondWithFilteredResult(_0x3c64a5,_0x4afeca))[_0x37fb('0x2b')](handleError(_0x3c64a5,null));};exports['show']=function(_0x52a9c,_0x5e1672){var _0x44ff06={'raw':![],'where':{'id':_0x52a9c[_0x37fb('0x59')]['id']},'include':[{'model':db[_0x37fb('0x3e')],'as':_0x37fb('0x3f')}]},_0x37bc1a={};_0x37bc1a['model']=_['keys'](db[_0x37fb('0x54')]['rawAttributes']);_0x37bc1a[_0x37fb('0x45')]=_['keys'](_0x52a9c['query']);_0x37bc1a['filters']=_[_0x37fb('0x47')](_0x37bc1a[_0x37fb('0x44')],_0x37bc1a[_0x37fb('0x45')]);_0x44ff06[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x37bc1a[_0x37fb('0x44')],qs[_0x37fb('0x49')](_0x52a9c[_0x37fb('0x45')][_0x37fb('0x49')]));_0x44ff06['attributes']=_0x44ff06[_0x37fb('0x48')][_0x37fb('0x4a')]?_0x44ff06[_0x37fb('0x48')]:_0x37bc1a['model'];if(_0x52a9c[_0x37fb('0x45')][_0x37fb('0x55')]){_0x44ff06[_0x37fb('0x56')]=[{'all':!![]}];}_0x44ff06=_[_0x37fb('0x53')]({},_0x44ff06,_0x52a9c[_0x37fb('0x5a')]);return db[_0x37fb('0x54')][_0x37fb('0x5b')](_0x44ff06)['then'](handleEntityNotFound(_0x5e1672,null))[_0x37fb('0x21')](respondWithResult(_0x5e1672,null))[_0x37fb('0x2b')](handleError(_0x5e1672,null));};exports['create']=function(_0x91999a,_0x3e6950){return db[_0x37fb('0x54')][_0x37fb('0x5c')](_0x91999a[_0x37fb('0x5d')],{})[_0x37fb('0x21')](function(_0x516a59){var _0x4d6420=_0x91999a[_0x37fb('0x5e')][_0x37fb('0x38')]({'plain':!![]});if(!_0x4d6420)throw new Error(_0x37fb('0x5f'));if(_0x4d6420['role']==='user'){var _0x14b3e0=_0x516a59[_0x37fb('0x38')]({'plain':!![]});var _0x278bd5=_0x37fb('0x39');return db[_0x37fb('0x60')][_0x37fb('0x5b')]({'where':{'name':_0x278bd5,'userProfileId':_0x4d6420[_0x37fb('0x61')]},'raw':!![]})['then'](function(_0x4f00a3){if(_0x4f00a3&&_0x4f00a3['autoAssociation']===0x0){return db[_0x37fb('0x62')][_0x37fb('0x5c')]({'name':_0x14b3e0[_0x37fb('0x3c')],'resourceId':_0x14b3e0['id'],'type':_0x4f00a3[_0x37fb('0x3c')],'sectionId':_0x4f00a3['id']},{})[_0x37fb('0x21')](function(){return _0x516a59;});}else{return _0x516a59;}})[_0x37fb('0x2b')](function(_0x299c80){logger['error'](_0x37fb('0x63'),_0x299c80);throw _0x299c80;});}return _0x516a59;})[_0x37fb('0x21')](respondWithResult(_0x3e6950,0xc9))['catch'](handleError(_0x3e6950,null));};exports['update']=function(_0x5dcb0a,_0x3417b2){if(_0x5dcb0a[_0x37fb('0x5d')]['id']){delete _0x5dcb0a[_0x37fb('0x5d')]['id'];}return db['WhatsappAccount'][_0x37fb('0x5b')]({'where':{'id':_0x5dcb0a[_0x37fb('0x59')]['id']},'include':[{'model':db[_0x37fb('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x37fb('0x21')](handleEntityNotFound(_0x3417b2,null))['then'](saveUpdates(_0x5dcb0a['body'],null))[_0x37fb('0x21')](respondWithResult(_0x3417b2,null))[_0x37fb('0x2b')](handleError(_0x3417b2,null));};exports[_0x37fb('0x3a')]=function(_0x55cbef,_0x5ea353){return db[_0x37fb('0x54')][_0x37fb('0x5b')]({'where':{'id':_0x55cbef[_0x37fb('0x59')]['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x5ea353,null))['then'](removeEntity(_0x5ea353,null))[_0x37fb('0x2b')](handleError(_0x5ea353,null));};exports[_0x37fb('0x64')]=function(_0x5465c1,_0xd6967f){return db['WhatsappAccount'][_0x37fb('0x64')]()[_0x37fb('0x21')](respondWithResult(_0xd6967f,null))['catch'](handleError(_0xd6967f,null));};exports[_0x37fb('0x65')]=function(_0x22cb67,_0x5ef70e,_0x4d8c07){if(_0x22cb67[_0x37fb('0x5d')]['id']){delete _0x22cb67[_0x37fb('0x5d')]['id'];}return db['WhatsappAccount'][_0x37fb('0x5b')]({'where':{'id':_0x22cb67[_0x37fb('0x59')]['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x5ef70e,null))[_0x37fb('0x21')](function(_0x249bb9){if(_0x249bb9){_0x22cb67['body'][_0x37fb('0x66')]=_0x249bb9['id'];return db[_0x37fb('0x67')][_0x37fb('0x5c')](_0x22cb67[_0x37fb('0x5d')]);}})['then'](respondWithResult(_0x5ef70e,null))[_0x37fb('0x2b')](handleError(_0x5ef70e,null));};exports[_0x37fb('0x68')]=function(_0xc78276,_0x2395d1,_0x259525){var _0x35df02={'raw':![],'where':{}};var _0x2fcd53={};var _0x38ec89={'count':0x0,'rows':[]};return db[_0x37fb('0x54')]['findOne']({'where':{'id':_0xc78276[_0x37fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x2395d1,null))[_0x37fb('0x21')](function(_0x3e3104){if(_0x3e3104){_0x2fcd53[_0x37fb('0x44')]=_[_0x37fb('0x46')](db['Disposition'][_0x37fb('0x69')]);_0x2fcd53[_0x37fb('0x45')]=_[_0x37fb('0x46')](_0xc78276[_0x37fb('0x45')]);_0x2fcd53[_0x37fb('0x4e')]=_[_0x37fb('0x47')](_0x2fcd53[_0x37fb('0x44')],_0x2fcd53[_0x37fb('0x45')]);_0x35df02[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x2fcd53[_0x37fb('0x44')],qs[_0x37fb('0x49')](_0xc78276[_0x37fb('0x45')][_0x37fb('0x49')]));_0x35df02[_0x37fb('0x48')]=_0x35df02[_0x37fb('0x48')][_0x37fb('0x4a')]?_0x35df02[_0x37fb('0x48')]:_0x2fcd53[_0x37fb('0x44')];if(!_0xc78276[_0x37fb('0x45')][_0x37fb('0x6a')](_0x37fb('0x4b'))){_0x35df02[_0x37fb('0x31')]=qs[_0x37fb('0x31')](_0xc78276[_0x37fb('0x45')][_0x37fb('0x31')]);_0x35df02[_0x37fb('0x2f')]=qs['offset'](_0xc78276['query'][_0x37fb('0x2f')]);}_0x35df02['order']=qs[_0x37fb('0x4d')](_0xc78276[_0x37fb('0x45')][_0x37fb('0x4d')]);_0x35df02[_0x37fb('0x51')]=qs[_0x37fb('0x4e')](_['pick'](_0xc78276['query'],_0x2fcd53[_0x37fb('0x4e')]));_0x35df02[_0x37fb('0x51')]['WhatsappAccountId']=_0x3e3104['id'];if(_0xc78276[_0x37fb('0x45')][_0x37fb('0x50')]){_0x35df02[_0x37fb('0x51')]=_[_0x37fb('0x53')](_0x35df02[_0x37fb('0x51')],{'$or':_['map'](_0x35df02['attributes'],function(_0x40c554){var _0x549bb4={};_0x549bb4[_0x40c554]={'$like':'%'+_0xc78276['query'][_0x37fb('0x50')]+'%'};return _0x549bb4;})});}_0x35df02=_['merge']({},_0x35df02,_0xc78276[_0x37fb('0x5a')]);return db['Disposition'][_0x37fb('0x32')]({'where':_0x35df02['where']})[_0x37fb('0x21')](function(_0x340702){_0x38ec89['count']=_0x340702;if(_0xc78276['query'][_0x37fb('0x55')]){_0x35df02[_0x37fb('0x56')]=[{'all':!![]}];}return db[_0x37fb('0x67')][_0x37fb('0x57')](_0x35df02);})[_0x37fb('0x21')](function(_0x100480){_0x38ec89[_0x37fb('0x58')]=_0x100480;return _0x38ec89;});}})[_0x37fb('0x21')](respondWithFilteredResult(_0x2395d1,_0x35df02))[_0x37fb('0x2b')](handleError(_0x2395d1,null));};exports[_0x37fb('0x6b')]=function(_0x290448,_0x5164f6,_0x8a4968){return db['WhatsappAccount']['find']({'where':{'id':_0x290448['params']['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x5164f6,null))[_0x37fb('0x21')](function(_0x5d6eb7){if(_0x5d6eb7){return _0x5d6eb7[_0x37fb('0x6b')](_0x290448[_0x37fb('0x45')][_0x37fb('0x6c')]);}})[_0x37fb('0x21')](respondWithStatusCode(_0x5164f6,null))['catch'](handleError(_0x5164f6,null));};exports[_0x37fb('0x6d')]=function(_0x59bc03,_0x52ce1c,_0x1f7a9a){if(_0x59bc03[_0x37fb('0x5d')]['id']){delete _0x59bc03[_0x37fb('0x5d')]['id'];}return db[_0x37fb('0x54')][_0x37fb('0x5b')]({'where':{'id':_0x59bc03[_0x37fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x52ce1c,null))[_0x37fb('0x21')](function(_0x5effca){if(_0x5effca){_0x59bc03[_0x37fb('0x5d')][_0x37fb('0x66')]=_0x5effca['id'];return db[_0x37fb('0x6e')][_0x37fb('0x5c')](_0x59bc03[_0x37fb('0x5d')]);}})[_0x37fb('0x21')](respondWithResult(_0x52ce1c,null))[_0x37fb('0x2b')](handleError(_0x52ce1c,null));};exports[_0x37fb('0x6f')]=function(_0x59ca21,_0x3ceb27,_0x42be10){var _0x5db25e={'raw':![],'where':{}};var _0x554b41={};var _0xe5a97e={'count':0x0,'rows':[]};return db[_0x37fb('0x54')][_0x37fb('0x70')]({'where':{'id':_0x59ca21['params']['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x3ceb27,null))[_0x37fb('0x21')](function(_0x15244c){if(_0x15244c){_0x554b41[_0x37fb('0x44')]=_[_0x37fb('0x46')](db[_0x37fb('0x6e')][_0x37fb('0x69')]);_0x554b41[_0x37fb('0x45')]=_[_0x37fb('0x46')](_0x59ca21[_0x37fb('0x45')]);_0x554b41['filters']=_['intersection'](_0x554b41[_0x37fb('0x44')],_0x554b41[_0x37fb('0x45')]);_0x5db25e[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x554b41[_0x37fb('0x44')],qs['fields'](_0x59ca21[_0x37fb('0x45')][_0x37fb('0x49')]));_0x5db25e[_0x37fb('0x48')]=_0x5db25e[_0x37fb('0x48')][_0x37fb('0x4a')]?_0x5db25e[_0x37fb('0x48')]:_0x554b41[_0x37fb('0x44')];if(!_0x59ca21[_0x37fb('0x45')][_0x37fb('0x6a')](_0x37fb('0x4b'))){_0x5db25e[_0x37fb('0x31')]=qs[_0x37fb('0x31')](_0x59ca21[_0x37fb('0x45')][_0x37fb('0x31')]);_0x5db25e['offset']=qs['offset'](_0x59ca21[_0x37fb('0x45')][_0x37fb('0x2f')]);}_0x5db25e[_0x37fb('0x4c')]=qs['sort'](_0x59ca21[_0x37fb('0x45')]['sort']);_0x5db25e[_0x37fb('0x51')]=qs['filters'](_['pick'](_0x59ca21[_0x37fb('0x45')],_0x554b41[_0x37fb('0x4e')]));_0x5db25e[_0x37fb('0x51')][_0x37fb('0x66')]=_0x15244c['id'];if(_0x59ca21[_0x37fb('0x45')][_0x37fb('0x50')]){_0x5db25e[_0x37fb('0x51')]=_[_0x37fb('0x53')](_0x5db25e[_0x37fb('0x51')],{'$or':_['map'](_0x5db25e['attributes'],function(_0x31bffa){var _0xbb836={};_0xbb836[_0x31bffa]={'$like':'%'+_0x59ca21[_0x37fb('0x45')][_0x37fb('0x50')]+'%'};return _0xbb836;})});}_0x5db25e=_['merge']({},_0x5db25e,_0x59ca21['options']);return db[_0x37fb('0x6e')][_0x37fb('0x32')]({'where':_0x5db25e[_0x37fb('0x51')]})['then'](function(_0x4a17d9){_0xe5a97e[_0x37fb('0x32')]=_0x4a17d9;if(_0x59ca21[_0x37fb('0x45')]['includeAll']){_0x5db25e[_0x37fb('0x56')]=[{'all':!![]}];}return db[_0x37fb('0x6e')][_0x37fb('0x57')](_0x5db25e);})['then'](function(_0x2c3657){_0xe5a97e['rows']=_0x2c3657;return _0xe5a97e;});}})[_0x37fb('0x21')](respondWithFilteredResult(_0x3ceb27,_0x5db25e))[_0x37fb('0x2b')](handleError(_0x3ceb27,null));};exports['removeAnswers']=function(_0x25abb0,_0x49e3ea,_0xb4b36){return db[_0x37fb('0x54')][_0x37fb('0x5b')]({'where':{'id':_0x25abb0['params']['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x49e3ea,null))['then'](function(_0x1daeff){if(_0x1daeff){return _0x1daeff[_0x37fb('0x71')](_0x25abb0[_0x37fb('0x45')][_0x37fb('0x6c')]);}})[_0x37fb('0x21')](respondWithStatusCode(_0x49e3ea,null))[_0x37fb('0x2b')](handleError(_0x49e3ea,null));};exports[_0x37fb('0x72')]=function(_0x361d9b,_0x50fe08,_0x434fc1){return db[_0x37fb('0x54')][_0x37fb('0x5b')]({'where':{'id':_0x361d9b['params']['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x50fe08,null))[_0x37fb('0x21')](function(_0xf00714){if(_0xf00714){return _0xf00714['addAgents'](_0x361d9b['body'][_0x37fb('0x6c')],_['omit'](_0x361d9b[_0x37fb('0x5d')],['ids','id'])||{})[_0x37fb('0x73')](function(_0x1b0f48){for(var _0x2558ca=0x0;_0x2558ca<_0x361d9b[_0x37fb('0x5d')][_0x37fb('0x6c')][_0x37fb('0x4a')];_0x2558ca+=0x1){socket[_0x37fb('0x74')](_0x37fb('0x75'),{'UserId':Number(_0x361d9b[_0x37fb('0x5d')]['ids'][_0x2558ca]),'WhatsappAccountId':Number(_0x361d9b[_0x37fb('0x59')]['id'])});}return _0x1b0f48;});}})[_0x37fb('0x21')](respondWithResult(_0x50fe08,null))[_0x37fb('0x2b')](handleError(_0x50fe08,null));};exports[_0x37fb('0x76')]=function(_0x3751dc,_0x40791e,_0x2cfcba){return db['WhatsappAccount']['find']({'where':{'id':_0x3751dc['params']['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x40791e,null))[_0x37fb('0x21')](function(_0x3ae06d){if(_0x3ae06d){return _0x3ae06d[_0x37fb('0x76')](_0x3751dc[_0x37fb('0x45')][_0x37fb('0x6c')])[_0x37fb('0x21')](function(){if(_[_0x37fb('0x77')](_0x3751dc[_0x37fb('0x45')][_0x37fb('0x6c')])){for(var _0x4ac51d=0x0;_0x4ac51d<_0x3751dc[_0x37fb('0x45')][_0x37fb('0x6c')][_0x37fb('0x4a')];_0x4ac51d+=0x1){socket[_0x37fb('0x74')](_0x37fb('0x78'),{'UserId':Number(_0x3751dc[_0x37fb('0x45')][_0x37fb('0x6c')][_0x4ac51d]),'WhatsappAccountId':Number(_0x3751dc[_0x37fb('0x59')]['id'])});}}else{socket[_0x37fb('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x3751dc[_0x37fb('0x45')][_0x37fb('0x6c')]),'WhatsappAccountId':Number(_0x3751dc[_0x37fb('0x59')]['id'])});}});}})[_0x37fb('0x21')](respondWithStatusCode(_0x40791e,null))[_0x37fb('0x2b')](handleError(_0x40791e,null));};exports['getAgents']=function(_0x2165c4,_0x425c88,_0x641a5c){var _0x18820f={};var _0x5f2ee5={};var _0x44c3c1;var _0xb85177;return db['WhatsappAccount'][_0x37fb('0x70')]({'where':{'id':_0x2165c4[_0x37fb('0x59')]['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x425c88,null))[_0x37fb('0x21')](function(_0x12561a){if(_0x12561a){_0x44c3c1=_0x12561a;_0x5f2ee5['model']=_[_0x37fb('0x46')](db[_0x37fb('0x79')][_0x37fb('0x69')]);_0x5f2ee5[_0x37fb('0x45')]=_[_0x37fb('0x46')](_0x2165c4[_0x37fb('0x45')]);_0x5f2ee5[_0x37fb('0x4e')]=_['intersection'](_0x5f2ee5['model'],_0x5f2ee5[_0x37fb('0x45')]);_0x18820f[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x5f2ee5[_0x37fb('0x44')],qs[_0x37fb('0x49')](_0x2165c4[_0x37fb('0x45')][_0x37fb('0x49')]));_0x18820f['attributes']=_0x18820f[_0x37fb('0x48')][_0x37fb('0x4a')]?_0x18820f[_0x37fb('0x48')]:_0x5f2ee5[_0x37fb('0x44')];_0x18820f[_0x37fb('0x4c')]=qs[_0x37fb('0x4d')](_0x2165c4[_0x37fb('0x45')]['sort']);_0x18820f[_0x37fb('0x51')]=qs[_0x37fb('0x4e')](_['pick'](_0x2165c4[_0x37fb('0x45')],_0x5f2ee5[_0x37fb('0x4e')]));if(_0x2165c4[_0x37fb('0x45')][_0x37fb('0x50')]){_0x18820f[_0x37fb('0x51')]=_['merge'](_0x18820f[_0x37fb('0x51')],{'$or':_[_0x37fb('0x40')](_0x18820f[_0x37fb('0x48')],function(_0x463a39){var _0x25e9e1={};_0x25e9e1[_0x463a39]={'$like':'%'+_0x2165c4['query'][_0x37fb('0x50')]+'%'};return _0x25e9e1;})});}_0x18820f=_[_0x37fb('0x53')]({},_0x18820f,_0x2165c4['options']);return _0x44c3c1['getAgents'](_0x18820f);}})[_0x37fb('0x21')](function(_0x8b19f9){if(_0x8b19f9){_0xb85177=_0x8b19f9[_0x37fb('0x4a')];if(!_0x2165c4[_0x37fb('0x45')][_0x37fb('0x6a')](_0x37fb('0x4b'))){_0x18820f['limit']=qs[_0x37fb('0x31')](_0x2165c4[_0x37fb('0x45')][_0x37fb('0x31')]);_0x18820f[_0x37fb('0x2f')]=qs['offset'](_0x2165c4[_0x37fb('0x45')]['offset']);}return _0x44c3c1['getAgents'](_0x18820f);}})[_0x37fb('0x21')](function(_0x53948a){if(_0x53948a){return _0x53948a?{'count':_0xb85177,'rows':_0x53948a}:null;}})['then'](respondWithResult(_0x425c88,null))[_0x37fb('0x2b')](handleError(_0x425c88,null));};exports[_0x37fb('0x7a')]=function(_0x22e50f,_0x2a0d55){var _0x3a4afc=_0x22e50f[_0x37fb('0x59')]['id'];var _0x4cb4f1=_0x22e50f[_0x37fb('0x5d')];var _0x3fa43c=0xc8;var _0x5172c1=null;return db[_0x37fb('0x7b')]['transaction']({'isolationLevel':db[_0x37fb('0x7b')][_0x37fb('0x7c')][_0x37fb('0x7d')][_0x37fb('0x7e')]},function(_0x3f5bad){return db[_0x37fb('0x54')][_0x37fb('0x70')]({'where':{'id':_0x3a4afc},'transaction':_0x3f5bad})[_0x37fb('0x21')](function(_0x169ed7){if(_0x169ed7){return db[_0x37fb('0x7f')][_0x37fb('0x3a')]({'where':{'WhatsappAccountId':_0x3a4afc},'transaction':_0x3f5bad})[_0x37fb('0x21')](function(){var _0x155c3d=_['map'](_0x4cb4f1,function(_0x388ab5){_0x388ab5['WhatsappAccountId']=_0x3a4afc;return _0x388ab5;});return db['WhatsappApplication'][_0x37fb('0x80')](_0x155c3d,{'transaction':_0x3f5bad});});}else{_0x3fa43c=0x194;_0x5172c1=[];}});})[_0x37fb('0x21')](function(){if(_0x3fa43c!==0x194){return db['WhatsappApplication'][_0x37fb('0x81')]({'where':{'WhatsappAccountId':_0x3a4afc},'order':_0x37fb('0x82')})[_0x37fb('0x21')](function(_0x396630){_0x5172c1=_0x396630;});}})[_0x37fb('0x2b')](function(_0xdd55bb){_0x3fa43c=0x1f4;logger['error'](_0xdd55bb[_0x37fb('0x3b')]);if(_0xdd55bb[_0x37fb('0x3c')]){delete _0xdd55bb[_0x37fb('0x3c')];}_0x5172c1=_0xdd55bb;})[_0x37fb('0x83')](function(){if(_0x5172c1===null){_0x2a0d55[_0x37fb('0x2c')](_0x3fa43c);}else{if(_0x3fa43c===0x1f4){_0x2a0d55['status'](_0x3fa43c)[_0x37fb('0x84')](_0x5172c1);}else{_0x2a0d55[_0x37fb('0x2d')](_0x3fa43c)[_0x37fb('0x35')](_0x5172c1);}}});};exports[_0x37fb('0x85')]=function(_0x4825ff,_0x44a0d9,_0x2ca11e){var _0x80c086={};var _0x401251={};var _0x41b817;var _0x33fce8;return db[_0x37fb('0x54')][_0x37fb('0x70')]({'where':{'id':_0x4825ff[_0x37fb('0x59')]['id']}})[_0x37fb('0x21')](handleEntityNotFound(_0x44a0d9,null))['then'](function(_0x44c2c2){if(_0x44c2c2){_0x41b817=_0x44c2c2;_0x401251['model']=_[_0x37fb('0x46')](db[_0x37fb('0x7f')][_0x37fb('0x69')]);_0x401251['query']=_[_0x37fb('0x46')](_0x4825ff['query']);_0x401251[_0x37fb('0x4e')]=_[_0x37fb('0x47')](_0x401251[_0x37fb('0x44')],_0x401251[_0x37fb('0x45')]);_0x80c086[_0x37fb('0x48')]=_[_0x37fb('0x47')](_0x401251[_0x37fb('0x44')],qs[_0x37fb('0x49')](_0x4825ff['query']['fields']));_0x80c086[_0x37fb('0x48')]=_0x80c086['attributes']['length']?_0x80c086[_0x37fb('0x48')]:_0x401251[_0x37fb('0x44')];_0x80c086[_0x37fb('0x4c')]=qs[_0x37fb('0x4d')](_0x4825ff[_0x37fb('0x45')][_0x37fb('0x4d')]);_0x80c086[_0x37fb('0x51')]=qs[_0x37fb('0x4e')](_[_0x37fb('0x4f')](_0x4825ff[_0x37fb('0x45')],_0x401251[_0x37fb('0x4e')]));if(_0x4825ff[_0x37fb('0x45')]['filter']){_0x80c086[_0x37fb('0x51')]=_[_0x37fb('0x53')](_0x80c086[_0x37fb('0x51')],{'$or':_['map'](_0x80c086[_0x37fb('0x48')],function(_0x291e75){var _0x1fbafb={};_0x1fbafb[_0x291e75]={'$like':'%'+_0x4825ff[_0x37fb('0x45')][_0x37fb('0x50')]+'%'};return _0x1fbafb;})});}_0x80c086=_[_0x37fb('0x53')]({},_0x80c086,_0x4825ff['options']);return _0x41b817[_0x37fb('0x85')](_0x80c086);}})['then'](function(_0x123118){if(_0x123118){_0x33fce8=_0x123118[_0x37fb('0x4a')];if(!_0x4825ff[_0x37fb('0x45')]['hasOwnProperty'](_0x37fb('0x4b'))){_0x80c086['limit']=qs[_0x37fb('0x31')](_0x4825ff[_0x37fb('0x45')]['limit']);_0x80c086[_0x37fb('0x2f')]=qs['offset'](_0x4825ff[_0x37fb('0x45')]['offset']);}return _0x41b817[_0x37fb('0x85')](_0x80c086);}})[_0x37fb('0x21')](function(_0x594948){if(_0x594948){return _0x594948?{'count':_0x33fce8,'rows':_0x594948}:null;}})['then'](respondWithResult(_0x44a0d9,null))[_0x37fb('0x2b')](handleError(_0x44a0d9,null));};exports[_0x37fb('0x86')]=function(_0x15c5c9,_0x5d1e90,_0x4f338b){var _0x2d4b9a={'channel':'whatsapp'};var _0x23a6cc=[];var _0x5cbb59=[];var _0x3fc73a={};return db['WhatsappAccount'][_0x37fb('0x5b')]({'where':{'id':_0x15c5c9[_0x37fb('0x59')]['id']},'include':[{'model':db[_0x37fb('0x7f')],'as':_0x37fb('0x87')}]})[_0x37fb('0x21')](handleEntityNotFound(_0x5d1e90,null))[_0x37fb('0x21')](function(_0x187882){_0x2d4b9a[_0x37fb('0x88')]=_0x187882;if(_0x2d4b9a[_0x37fb('0x88')]&&_0x2d4b9a['account'][_0x37fb('0x42')]===_0x37fb('0x89')&&_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0x8a')]){if(_0x15c5c9['body']['statuses'][_0x37fb('0x4a')]===0x0)return;if(_0x15c5c9['body'][_0x37fb('0x8a')][0x0][_0x37fb('0x8b')]!==_0x37fb('0x8c'))return;return db[_0x37fb('0x8d')]['update']({'read':!![],'readAt':_0x15c5c9['body'][_0x37fb('0x8a')][0x0][_0x37fb('0x8e')]},{'where':{'messageId':_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0x8a')][0x0][_0x37fb('0x8f')]},'individualHooks':!![]})[_0x37fb('0x21')](function(_0x5b372f){return _0x5d1e90['status'](0xc8)[_0x37fb('0x35')](_0x5b372f);});}_0x2d4b9a[_0x37fb('0x90')]=_[_0x37fb('0x91')](_0x187882[_0x37fb('0x87')],[_0x37fb('0x82')],[_0x37fb('0x92')]);if(_0x2d4b9a[_0x37fb('0x88')][_0x37fb('0x87')]){delete _0x2d4b9a['account'][_0x37fb('0x87')];}return db[_0x37fb('0x93')][_0x37fb('0x64')]()[_0x37fb('0x21')](function(_0x2919d3){if(!_0x2919d3){throw new db[(_0x37fb('0x94'))]['ValidationError']('no\x20available\x20attributes');}_0x23a6cc=_[_0x37fb('0x95')](_[_0x37fb('0x46')](_0x2919d3),[_0x37fb('0x96'),'updatedAt']);_0x5cbb59=_[_0x37fb('0x95')](_[_0x37fb('0x46')](_0x2919d3),[_0x37fb('0x96'),_0x37fb('0x97'),'CompanyId',_0x37fb('0x98')]);_0x2d4b9a[_0x37fb('0x5d')]={'mapKey':'mobile'};if(_0x2d4b9a['account']&&_0x2d4b9a[_0x37fb('0x88')][_0x37fb('0x42')]===_0x37fb('0x99')){_0x2d4b9a[_0x37fb('0x5d')]['from']=_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0x9a')][_0x37fb('0x9b')](_0x37fb('0x9c'),'');_0x2d4b9a['body'][_0x37fb('0x5d')]=_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0x9d')];_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x9e')]=_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0x9f')];}if(_0x2d4b9a[_0x37fb('0x88')]&&_0x2d4b9a['account']['type']==='sinch'){_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa0')]=_0x15c5c9['body'][_0x37fb('0xa1')][0x0][_0x37fb('0xa0')];_0x2d4b9a['body'][_0x37fb('0x5d')]=_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0xa1')][0x0][_0x37fb('0x2a')][_0x37fb('0x5d')];_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x9e')]=_0x15c5c9[_0x37fb('0x5d')][_0x37fb('0xa1')][0x0]['message_id'];}if(_0x2d4b9a[_0x37fb('0x5d')]['id']){delete _0x2d4b9a[_0x37fb('0x5d')]['id'];}if(_['isNil'](_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa0')])){throw new db['Sequelize'][(_0x37fb('0xa2'))]('from\x20is\x20mandatory');}if(_[_0x37fb('0xa3')](_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x5d')])||_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x5d')]===''){throw new db[(_0x37fb('0x94'))][(_0x37fb('0xa2'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x37fb('0xa3')](_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa4')])){throw new db['Sequelize'][(_0x37fb('0xa2'))](_0x37fb('0xa5')+_0x5cbb59);}if(!_[_0x37fb('0xa6')](_0x5cbb59,_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa4')])){throw new db[(_0x37fb('0x94'))][(_0x37fb('0xa2'))](_0x37fb('0xa7')+_0x5cbb59);}_0x3fc73a[_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa4')]]=_0x2d4b9a['body'][_0x37fb('0xa0')];return db['CmList'][_0x37fb('0x5b')]({'where':{'id':_0x2d4b9a[_0x37fb('0x88')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x37fb('0xa8'),'where':_0x3fc73a,'limit':0x1,'order':[[_0x37fb('0x97'),_0x37fb('0xa9')]]}]});})[_0x37fb('0x21')](handleEntityNotFound(_0x5d1e90,null))[_0x37fb('0x21')](function(_0x40d799){if(_0x40d799){_0x2d4b9a[_0x37fb('0xaa')]=_[_0x37fb('0xab')](_0x40d799,[_0x37fb('0xa8')]);if(_0x40d799[_0x37fb('0xa8')][_0x37fb('0x4a')]){return _0x40d799['Contacts'][0x0];}var _0xd22f40=_['defaults'](_0x2d4b9a[_0x37fb('0x5d')],{'firstName':_0x2d4b9a['body'][_0x37fb('0xa0')],'ListId':_0x40d799['id']});_0xd22f40[_0x2d4b9a[_0x37fb('0x5d')]['mapKey']]=_0x2d4b9a['body'][_0x37fb('0xa0')];return db[_0x37fb('0x93')][_0x37fb('0x5c')](_0xd22f40,{'fields':_0x23a6cc,'raw':!![]});}})[_0x37fb('0x21')](handleEntityNotFound(_0x5d1e90,null))[_0x37fb('0x21')](function(_0x770840){if(_0x770840){_0x2d4b9a[_0x37fb('0xac')]=_0x770840;var _0x322d2a={'ContactId':_0x770840['id'],'phone':_0x2d4b9a['body'][_0x37fb('0xa0')],'WhatsappAccountId':_0x15c5c9[_0x37fb('0x59')]['id']};var _0xb86a41={'ContactId':_0x770840['id'],'WhatsappAccountId':_0x15c5c9[_0x37fb('0x59')]['id'],'closed':![]};return db[_0x37fb('0xad')][_0x37fb('0x5b')]({'where':_0xb86a41})[_0x37fb('0x21')](function(_0x4a0ea0){if(_0x4a0ea0){return[_0x4a0ea0,![]];}return db[_0x37fb('0xad')][_0x37fb('0x5c')](_0x322d2a)[_0x37fb('0x21')](function(_0x278e0c){return[_0x278e0c,!![]];});});}})[_0x37fb('0x73')](function(_0x57c7b4,_0x34036b){_0x2d4b9a[_0x37fb('0xae')]=_0x57c7b4[_0x37fb('0x38')]({'plain':!![]});_0x2d4b9a[_0x37fb('0xae')][_0x37fb('0xaf')]=![];if(_0x34036b){if(_0x2d4b9a[_0x37fb('0x88')][_0x37fb('0xb0')]){_0x2d4b9a['applications'][_0x37fb('0xb1')]({'id':0x0,'priority':_0x2d4b9a[_0x37fb('0x90')][_0x37fb('0x4a')]+0x1,'app':_0x37fb('0xb2'),'appdata':_0x37fb('0xb3'),'interval':_0x37fb('0xb4')});}_0x2d4b9a['interaction']['created']=!![];}return db['WhatsappMessage'][_0x37fb('0x5c')]({'phone':_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0xa0')],'messageId':_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x9e')],'body':_0x2d4b9a[_0x37fb('0x5d')][_0x37fb('0x5d')],'WhatsappAccountId':_0x15c5c9['params']['id'],'WhatsappInteractionId':_0x57c7b4['id'],'direction':'in','ContactId':_0x57c7b4[_0x37fb('0xb5')],'AttachmentId':_0x2d4b9a['body'][_0x37fb('0xb6')]});})['then'](function(_0x1bce08){_0x2d4b9a[_0x37fb('0x2a')]=_0x1bce08;if(!_0x2d4b9a[_0x37fb('0xae')]['UserId'])return;return db['User'][_0x37fb('0x5b')]({'attributes':['id',_0x37fb('0x3c')],'where':{'id':_0x2d4b9a[_0x37fb('0xae')][_0x37fb('0xb7')]}});})[_0x37fb('0x21')](function(_0x10f8a7){if(_0x10f8a7){_0x2d4b9a['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f8a7[_0x37fb('0x3c')]+','+(_0x2d4b9a[_0x37fb('0x88')][_0x37fb('0xb8')]||0xa),'interval':_0x37fb('0xb4')});}if(!_0x2d4b9a[_0x37fb('0xae')][_0x37fb('0xb9')])return;return db[_0x37fb('0xba')][_0x37fb('0x5b')]({'attributes':['id','name'],'where':{'id':_0x2d4b9a[_0x37fb('0xae')][_0x37fb('0xb9')]}});})[_0x37fb('0x21')](function(_0x359e33){if(_0x359e33){_0x2d4b9a[_0x37fb('0x90')][_0x37fb('0xbb')]({'id':0x0,'priority':0x1,'app':_0x37fb('0xbc'),'appdata':_0x359e33['name']+','+(_0x2d4b9a['account'][_0x37fb('0xbd')]||0x12c),'interval':_0x37fb('0xb4')});}return respondWithRpcPromise(_0x37fb('0xbe'),_0x37fb('0xbf'),_0x2d4b9a);})['then'](function(_0x4f491f){if(_0x4f491f){var _0x1a427a=0xc8;var _0x20f14e=_0x37fb('0xc0');logger[_0x37fb('0x22')](_0x37fb('0x26'),_0x20f14e,_0x1a427a,_0x37fb('0xc1'));logger[_0x37fb('0x25')](_0x37fb('0xc2'),_0x20f14e,_0x1a427a,_0x37fb('0xc1'),JSON[_0x37fb('0x27')](_0x4f491f));if(_0x2d4b9a[_0x37fb('0x88')]['type']===_0x37fb('0x99')){return _0x5d1e90[_0x37fb('0x2d')](_0x1a427a)[_0x37fb('0x33')]('Content-Type','text/xml')[_0x37fb('0x84')](_0x37fb('0xc3'));}else{return _0x5d1e90[_0x37fb('0x2d')](_0x1a427a)[_0x37fb('0x35')](_0x4f491f);}}});})[_0x37fb('0x2b')](handleError(_0x5d1e90,null));};exports[_0x37fb('0x84')]=function(_0xa1b586,_0x590bcf,_0x53e8ff){var _0x33798e,_0x5ebbd4,_0x5eaa0c;if(_[_0x37fb('0xa3')](_0xa1b586[_0x37fb('0x5d')][_0x37fb('0x5d')])||_0xa1b586[_0x37fb('0x5d')][_0x37fb('0x5d')]===''){throw new db[(_0x37fb('0x94'))][(_0x37fb('0xa2'))](_0x37fb('0xc4'));}if(_[_0x37fb('0xa3')](_0xa1b586['body']['to'])){throw new db['Sequelize'][(_0x37fb('0xa2'))](_0x37fb('0xc5'));}_0x33798e=_0xa1b586[_0x37fb('0x5d')]['to'];return db[_0x37fb('0x54')][_0x37fb('0x5b')]({'where':{'id':_0xa1b586[_0x37fb('0x59')]['id']},'include':[{'model':db[_0x37fb('0xc6')],'as':_0x37fb('0xc7'),'include':[{'model':db[_0x37fb('0x93')],'as':_0x37fb('0xa8'),'where':{'mobile':_0x33798e},'limit':0x1,'order':[[_0x37fb('0x97'),_0x37fb('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x590bcf,null))['then'](function(_0x227a21){if(_0x227a21&&_0x227a21['List']){_0x5ebbd4=_0x227a21['get']({'plain':!![]});if(_0x5ebbd4[_0x37fb('0xc7')]&&_0x5ebbd4[_0x37fb('0xc7')][_0x37fb('0xa8')][_0x37fb('0x4a')]){return _0x5ebbd4[_0x37fb('0xc7')][_0x37fb('0xa8')][0x0];}return db[_0x37fb('0x93')][_0x37fb('0x5c')](_['defaults'](_0xa1b586[_0x37fb('0x5d')],{'firstName':_0x33798e,'mobile':_0x33798e,'phone':_0x33798e,'ListId':_0x5ebbd4[_0x37fb('0x98')]}));}})[_0x37fb('0x21')](handleEntityNotFound(_0x590bcf,null))[_0x37fb('0x21')](function(_0x236c63){if(_0x236c63){_0x5eaa0c=_0x236c63;return db[_0x37fb('0xad')][_0x37fb('0x5b')]({'where':{'ContactId':_0x5eaa0c['id'],'closed':![],'WhatsappAccountId':_0x5ebbd4['id']}})[_0x37fb('0x21')](function(_0x4b4dcd){if(_0x4b4dcd){return[_0x4b4dcd,![]];}return db[_0x37fb('0xad')]['create']({'UserId':_0xa1b586[_0x37fb('0x5e')]['id'],'ContactId':_0x5eaa0c['id'],'WhatsappAccountId':_0x5ebbd4['id'],'phone':_0x33798e,'firstMsgDirection':_0x37fb('0xc8'),'Messages':[_[_0x37fb('0x53')](_0xa1b586[_0x37fb('0x5d')],{'read':![],'body':_0xa1b586[_0x37fb('0x5d')]['body'],'phone':_0x33798e,'WhatsappAccountId':_0x5ebbd4['id'],'UserId':_0xa1b586[_0x37fb('0x5e')]['id'],'ContactId':_0x5eaa0c['id']})]},{'include':[{'model':db[_0x37fb('0x8d')],'as':_0x37fb('0xc9')}]})['then'](function(_0x2bf06f){return[_0x2bf06f,!![]];});});}})[_0x37fb('0x73')](function(_0x5133d4,_0x3be832){if(_0x3be832){return _0x5133d4;}return db[_0x37fb('0x8d')][_0x37fb('0x5c')](_[_0x37fb('0x53')](_0xa1b586[_0x37fb('0x5d')],{'read':![],'body':_0xa1b586[_0x37fb('0x5d')][_0x37fb('0x5d')],'phone':_0x33798e,'WhatsappAccountId':_0x5ebbd4['id'],'WhatsappInteractionId':_0x5133d4['id'],'UserId':_0xa1b586[_0x37fb('0x5e')]['id'],'ContactId':_0x5eaa0c['id']}))[_0x37fb('0x21')](function(_0x432ac3){_0x5133d4['dataValues'][_0x37fb('0xc9')]=[];_0x5133d4['dataValues'][_0x37fb('0xc9')][_0x37fb('0xb1')](_0x432ac3[_0x37fb('0xca')]);return _0x5133d4;});})[_0x37fb('0x21')](respondWithResult(_0x590bcf,null))[_0x37fb('0x2b')](handleError(_0x590bcf,null));}; \ No newline at end of file +var _0x23a3=['create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','findOne','nolimit','removeAnswers','addAgents','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','account','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','whatsapp:','Body','messageId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','text/xml','\x0a','isNil','to\x20is\x20mandatory','List','out','Messages','dataValues','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','client','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','Pause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','mandatoryDispositionPause','length','includeAll','find'];(function(_0x143fd9,_0x36d5d6){var _0x18f011=function(_0x6417c0){while(--_0x6417c0){_0x143fd9['push'](_0x143fd9['shift']());}};_0x18f011(++_0x36d5d6);}(_0x23a3,0x131));var _0x323a=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x23a3[_0x39cd3c];return _0x47a0ae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x323a('0x0'));var rp=require('request-promise');var moment=require(_0x323a('0x1'));var BPromise=require(_0x323a('0x2'));var Mustache=require(_0x323a('0x3'));var util=require(_0x323a('0x4'));var path=require(_0x323a('0x5'));var sox=require(_0x323a('0x6'));var csv=require(_0x323a('0x7'));var ejs=require(_0x323a('0x8'));var fs=require('fs');var fs_extra=require(_0x323a('0x9'));var _=require('lodash');var squel=require(_0x323a('0xa'));var crypto=require(_0x323a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x323a('0xc'));var toCsv=require(_0x323a('0x7'));var querystring=require(_0x323a('0xd'));var Papa=require('papaparse');var Redis=require(_0x323a('0xe'));var authService=require(_0x323a('0xf'));var qs=require(_0x323a('0x10'));var as=require(_0x323a('0x11'));var hardwareService=require(_0x323a('0x12'));var logger=require(_0x323a('0x13'))(_0x323a('0x14'));var utils=require(_0x323a('0x15'));var config=require(_0x323a('0x16'));var licenseUtil=require(_0x323a('0x17'));var db=require(_0x323a('0x18'))['db'];config[_0x323a('0x19')]=_[_0x323a('0x1a')](config[_0x323a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x323a('0x1b'))(new Redis(config['redis']));require(_0x323a('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x323a('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x46c247,_0x582631,_0x1cc64d,_0x64003){return new BPromise(function(_0x54cda9,_0x271b85){var _0x32674f=_0x64003||client;return _0x32674f['request'](_0x46c247,_0x1cc64d)['then'](function(_0x3e3bb0){logger[_0x323a('0x1e')](_0x323a('0x1f'),_0x582631,_0x323a('0x20'));logger[_0x323a('0x21')](_0x323a('0x22'),_0x582631,'request\x20sent',JSON['stringify'](_0x3e3bb0));if(_0x3e3bb0['error']){if(_0x3e3bb0['error'][_0x323a('0x23')]===0x1f4){logger['error'](_0x323a('0x1f'),_0x582631,_0x3e3bb0[_0x323a('0x24')][_0x323a('0x25')]);return _0x271b85(_0x3e3bb0[_0x323a('0x24')]['message']);}logger[_0x323a('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x582631,_0x3e3bb0[_0x323a('0x24')][_0x323a('0x25')]);return _0x54cda9(_0x3e3bb0[_0x323a('0x24')]['message']);}else{logger[_0x323a('0x1e')](_0x323a('0x1f'),_0x582631,_0x323a('0x20'));_0x54cda9(_0x3e3bb0[_0x323a('0x26')][_0x323a('0x25')]);}})[_0x323a('0x27')](function(_0x5ba015){logger[_0x323a('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x582631,_0x5ba015);_0x271b85(_0x5ba015);});});}function respondWithStatusCode(_0xc0c527,_0x2e05fd){_0x2e05fd=_0x2e05fd||0xcc;return function(_0x27c7de){if(_0x27c7de){return _0xc0c527[_0x323a('0x28')](_0x2e05fd);}return _0xc0c527[_0x323a('0x29')](_0x2e05fd)['end']();};}function respondWithResult(_0x3d866a,_0x384c93){_0x384c93=_0x384c93||0xc8;return function(_0x30dbe6){if(_0x30dbe6){return _0x3d866a[_0x323a('0x29')](_0x384c93)[_0x323a('0x2a')](_0x30dbe6);}};}function respondWithFilteredResult(_0x4ba792,_0x23a989){return function(_0x571264){if(_0x571264){var _0x24747b=typeof _0x23a989[_0x323a('0x2b')]===_0x323a('0x2c')&&typeof _0x23a989[_0x323a('0x2d')]===_0x323a('0x2c');var _0x3b4216=_0x571264['count'];var _0x2a1a85=_0x24747b?0x0:_0x23a989[_0x323a('0x2b')];var _0x580c2b=_0x24747b?_0x571264[_0x323a('0x2e')]:_0x23a989['offset']+_0x23a989['limit'];var _0x4bb7ca;if(_0x580c2b>=_0x3b4216){_0x580c2b=_0x3b4216;_0x4bb7ca=0xc8;}else{_0x4bb7ca=0xce;}_0x4ba792[_0x323a('0x29')](_0x4bb7ca);return _0x4ba792['set'](_0x323a('0x2f'),_0x2a1a85+'-'+_0x580c2b+'/'+_0x3b4216)[_0x323a('0x2a')](_0x571264);}return null;};}function patchUpdates(_0x3344eb){return function(_0x4324fc){try{jsonpatch[_0x323a('0x30')](_0x4324fc,_0x3344eb,!![]);}catch(_0x4d5ed4){return BPromise[_0x323a('0x31')](_0x4d5ed4);}return _0x4324fc['save']();};}function saveUpdates(_0x45748f,_0x57c120){return function(_0x2c55cc){if(_0x2c55cc){return _0x2c55cc[_0x323a('0x32')](_0x45748f)['then'](function(_0x41e4aa){return _0x41e4aa;});}return null;};}function removeEntity(_0x3a1edd,_0x3947d1){return function(_0x4248f5){if(_0x4248f5){return _0x4248f5[_0x323a('0x33')]()[_0x323a('0x34')](function(){var _0x43fc4f=_0x4248f5[_0x323a('0x35')]({'plain':!![]});var _0x491242=_0x323a('0x36');return db[_0x323a('0x37')][_0x323a('0x33')]({'where':{'type':_0x491242,'resourceId':_0x43fc4f['id']}})[_0x323a('0x34')](function(){return _0x4248f5;});})[_0x323a('0x34')](function(){_0x3a1edd[_0x323a('0x29')](0xcc)[_0x323a('0x38')]();});}};}function handleEntityNotFound(_0x5473f0,_0x4fd3db){return function(_0x38f059){if(!_0x38f059){_0x5473f0[_0x323a('0x28')](0x194);}return _0x38f059;};}function handleError(_0x278a56,_0x49471b){_0x49471b=_0x49471b||0x1f4;return function(_0x3abc29){logger[_0x323a('0x24')](_0x3abc29[_0x323a('0x39')]);if(_0x3abc29[_0x323a('0x3a')]){delete _0x3abc29['name'];}_0x278a56[_0x323a('0x29')](_0x49471b)[_0x323a('0x3b')](_0x3abc29);};}exports['index']=function(_0x5cbb1a,_0x2a468a){var _0x47f99b={'include':[{'model':db[_0x323a('0x3c')],'as':'mandatoryDispositionPause'}]},_0x397893={},_0x2b19ac={'count':0x0,'rows':[]};var _0x426f4c=_['map'](db[_0x323a('0x3d')][_0x323a('0x3e')],function(_0x2d6c6f){return{'name':_0x2d6c6f[_0x323a('0x3f')],'type':_0x2d6c6f[_0x323a('0x40')][_0x323a('0x41')]};});_0x397893['model']=_[_0x323a('0x42')](_0x426f4c,_0x323a('0x3a'));_0x397893[_0x323a('0x43')]=_[_0x323a('0x44')](_0x5cbb1a[_0x323a('0x43')]);_0x397893['filters']=_[_0x323a('0x45')](_0x397893[_0x323a('0x46')],_0x397893['query']);_0x47f99b[_0x323a('0x47')]=_[_0x323a('0x45')](_0x397893[_0x323a('0x46')],qs[_0x323a('0x48')](_0x5cbb1a[_0x323a('0x43')]['fields']));_0x47f99b[_0x323a('0x47')]=_0x47f99b['attributes']['length']?_0x47f99b[_0x323a('0x47')]:_0x397893[_0x323a('0x46')];if(!_0x5cbb1a[_0x323a('0x43')][_0x323a('0x49')]('nolimit')){_0x47f99b[_0x323a('0x2d')]=qs[_0x323a('0x2d')](_0x5cbb1a[_0x323a('0x43')][_0x323a('0x2d')]);_0x47f99b[_0x323a('0x2b')]=qs['offset'](_0x5cbb1a[_0x323a('0x43')][_0x323a('0x2b')]);}_0x47f99b['order']=qs['sort'](_0x5cbb1a[_0x323a('0x43')][_0x323a('0x4a')]);_0x47f99b[_0x323a('0x4b')]=qs['filters'](_[_0x323a('0x4c')](_0x5cbb1a[_0x323a('0x43')],_0x397893[_0x323a('0x4d')]),_0x426f4c);if(_0x5cbb1a['query'][_0x323a('0x4e')]){_0x47f99b[_0x323a('0x4b')]=_[_0x323a('0x4f')](_0x47f99b[_0x323a('0x4b')],{'$or':_[_0x323a('0x42')](_0x426f4c,function(_0x446349){if(_0x446349[_0x323a('0x40')]!==_0x323a('0x50')){var _0x34afa4={};_0x34afa4[_0x446349[_0x323a('0x3a')]]={'$like':'%'+_0x5cbb1a[_0x323a('0x43')][_0x323a('0x4e')]+'%'};return _0x34afa4;}})});}_0x47f99b=_['merge']({},_0x47f99b,_0x5cbb1a[_0x323a('0x51')]);var _0x3bae04={'where':_0x47f99b[_0x323a('0x4b')]};return db['WhatsappAccount']['count'](_0x3bae04)[_0x323a('0x34')](function(_0x5f79a8){_0x2b19ac[_0x323a('0x2e')]=_0x5f79a8;if(_0x5cbb1a[_0x323a('0x43')]['includeAll']){_0x47f99b[_0x323a('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x323a('0x53')](_0x47f99b);})[_0x323a('0x34')](function(_0x431b9b){_0x2b19ac[_0x323a('0x54')]=_0x431b9b;return _0x2b19ac;})[_0x323a('0x34')](respondWithFilteredResult(_0x2a468a,_0x47f99b))['catch'](handleError(_0x2a468a,null));};exports[_0x323a('0x55')]=function(_0x2fc22f,_0x28685b){var _0xdb1411={'raw':![],'where':{'id':_0x2fc22f[_0x323a('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x323a('0x57')}]},_0x5071a9={};_0x5071a9[_0x323a('0x46')]=_[_0x323a('0x44')](db[_0x323a('0x3d')][_0x323a('0x3e')]);_0x5071a9[_0x323a('0x43')]=_[_0x323a('0x44')](_0x2fc22f[_0x323a('0x43')]);_0x5071a9[_0x323a('0x4d')]=_[_0x323a('0x45')](_0x5071a9['model'],_0x5071a9['query']);_0xdb1411[_0x323a('0x47')]=_[_0x323a('0x45')](_0x5071a9[_0x323a('0x46')],qs[_0x323a('0x48')](_0x2fc22f[_0x323a('0x43')][_0x323a('0x48')]));_0xdb1411['attributes']=_0xdb1411[_0x323a('0x47')][_0x323a('0x58')]?_0xdb1411[_0x323a('0x47')]:_0x5071a9['model'];if(_0x2fc22f[_0x323a('0x43')][_0x323a('0x59')]){_0xdb1411['include']=[{'all':!![]}];}_0xdb1411=_[_0x323a('0x4f')]({},_0xdb1411,_0x2fc22f['options']);return db[_0x323a('0x3d')][_0x323a('0x5a')](_0xdb1411)[_0x323a('0x34')](handleEntityNotFound(_0x28685b,null))[_0x323a('0x34')](respondWithResult(_0x28685b,null))['catch'](handleError(_0x28685b,null));};exports[_0x323a('0x5b')]=function(_0x5bbe5a,_0x30374f){return db['WhatsappAccount'][_0x323a('0x5b')](_0x5bbe5a[_0x323a('0x5c')],{})['then'](function(_0x196612){var _0x566aad=_0x5bbe5a[_0x323a('0x5d')][_0x323a('0x35')]({'plain':!![]});if(!_0x566aad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x566aad[_0x323a('0x5e')]===_0x323a('0x5d')){var _0x185ac7=_0x196612['get']({'plain':!![]});var _0x2e7093=_0x323a('0x36');return db[_0x323a('0x5f')][_0x323a('0x5a')]({'where':{'name':_0x2e7093,'userProfileId':_0x566aad[_0x323a('0x60')]},'raw':!![]})[_0x323a('0x34')](function(_0x854658){if(_0x854658&&_0x854658[_0x323a('0x61')]===0x0){return db[_0x323a('0x37')][_0x323a('0x5b')]({'name':_0x185ac7[_0x323a('0x3a')],'resourceId':_0x185ac7['id'],'type':_0x854658[_0x323a('0x3a')],'sectionId':_0x854658['id']},{})[_0x323a('0x34')](function(){return _0x196612;});}else{return _0x196612;}})[_0x323a('0x27')](function(_0x31aba6){logger[_0x323a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31aba6);throw _0x31aba6;});}return _0x196612;})[_0x323a('0x34')](respondWithResult(_0x30374f,0xc9))[_0x323a('0x27')](handleError(_0x30374f,null));};exports[_0x323a('0x32')]=function(_0x40df26,_0x4dae2e){if(_0x40df26['body']['id']){delete _0x40df26['body']['id'];}return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x40df26[_0x323a('0x56')]['id']},'include':[{'model':db[_0x323a('0x3c')],'as':_0x323a('0x57')}]})[_0x323a('0x34')](handleEntityNotFound(_0x4dae2e,null))[_0x323a('0x34')](saveUpdates(_0x40df26[_0x323a('0x5c')],null))[_0x323a('0x34')](respondWithResult(_0x4dae2e,null))[_0x323a('0x27')](handleError(_0x4dae2e,null));};exports[_0x323a('0x33')]=function(_0x1d5933,_0x58beee){return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x1d5933[_0x323a('0x56')]['id']}})['then'](handleEntityNotFound(_0x58beee,null))[_0x323a('0x34')](removeEntity(_0x58beee,null))[_0x323a('0x27')](handleError(_0x58beee,null));};exports[_0x323a('0x62')]=function(_0x57f9a9,_0x507cbd){return db['WhatsappAccount'][_0x323a('0x62')]()[_0x323a('0x34')](respondWithResult(_0x507cbd,null))[_0x323a('0x27')](handleError(_0x507cbd,null));};exports[_0x323a('0x63')]=function(_0x3bc461,_0x98b8e3,_0x205d9f){if(_0x3bc461['body']['id']){delete _0x3bc461['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3bc461['params']['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x98b8e3,null))[_0x323a('0x34')](function(_0x106ae8){if(_0x106ae8){_0x3bc461[_0x323a('0x5c')][_0x323a('0x64')]=_0x106ae8['id'];return db[_0x323a('0x65')][_0x323a('0x5b')](_0x3bc461['body']);}})[_0x323a('0x34')](respondWithResult(_0x98b8e3,null))['catch'](handleError(_0x98b8e3,null));};exports[_0x323a('0x66')]=function(_0x4ee6b0,_0x5e7e00,_0x5e7ebd){var _0x4916e0={'raw':![],'where':{}};var _0x59b1b6={};var _0x5bab5e={'count':0x0,'rows':[]};return db[_0x323a('0x3d')]['findOne']({'where':{'id':_0x4ee6b0[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x5e7e00,null))[_0x323a('0x34')](function(_0x4bef04){if(_0x4bef04){_0x59b1b6['model']=_[_0x323a('0x44')](db[_0x323a('0x65')][_0x323a('0x3e')]);_0x59b1b6[_0x323a('0x43')]=_['keys'](_0x4ee6b0[_0x323a('0x43')]);_0x59b1b6[_0x323a('0x4d')]=_[_0x323a('0x45')](_0x59b1b6[_0x323a('0x46')],_0x59b1b6[_0x323a('0x43')]);_0x4916e0['attributes']=_[_0x323a('0x45')](_0x59b1b6[_0x323a('0x46')],qs[_0x323a('0x48')](_0x4ee6b0[_0x323a('0x43')][_0x323a('0x48')]));_0x4916e0[_0x323a('0x47')]=_0x4916e0[_0x323a('0x47')]['length']?_0x4916e0['attributes']:_0x59b1b6[_0x323a('0x46')];if(!_0x4ee6b0['query'][_0x323a('0x49')]('nolimit')){_0x4916e0[_0x323a('0x2d')]=qs[_0x323a('0x2d')](_0x4ee6b0['query'][_0x323a('0x2d')]);_0x4916e0[_0x323a('0x2b')]=qs[_0x323a('0x2b')](_0x4ee6b0[_0x323a('0x43')]['offset']);}_0x4916e0[_0x323a('0x67')]=qs[_0x323a('0x4a')](_0x4ee6b0['query']['sort']);_0x4916e0[_0x323a('0x4b')]=qs['filters'](_['pick'](_0x4ee6b0[_0x323a('0x43')],_0x59b1b6[_0x323a('0x4d')]));_0x4916e0[_0x323a('0x4b')][_0x323a('0x64')]=_0x4bef04['id'];if(_0x4ee6b0[_0x323a('0x43')][_0x323a('0x4e')]){_0x4916e0[_0x323a('0x4b')]=_[_0x323a('0x4f')](_0x4916e0['where'],{'$or':_[_0x323a('0x42')](_0x4916e0['attributes'],function(_0x41f586){var _0x50ad8f={};_0x50ad8f[_0x41f586]={'$like':'%'+_0x4ee6b0['query'][_0x323a('0x4e')]+'%'};return _0x50ad8f;})});}_0x4916e0=_[_0x323a('0x4f')]({},_0x4916e0,_0x4ee6b0[_0x323a('0x51')]);return db[_0x323a('0x65')][_0x323a('0x2e')]({'where':_0x4916e0[_0x323a('0x4b')]})[_0x323a('0x34')](function(_0xac7a0a){_0x5bab5e['count']=_0xac7a0a;if(_0x4ee6b0[_0x323a('0x43')][_0x323a('0x59')]){_0x4916e0[_0x323a('0x52')]=[{'all':!![]}];}return db[_0x323a('0x65')][_0x323a('0x53')](_0x4916e0);})[_0x323a('0x34')](function(_0x10dced){_0x5bab5e[_0x323a('0x54')]=_0x10dced;return _0x5bab5e;});}})['then'](respondWithFilteredResult(_0x5e7e00,_0x4916e0))[_0x323a('0x27')](handleError(_0x5e7e00,null));};exports[_0x323a('0x68')]=function(_0x100666,_0x26d0a1,_0xc2785a){return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x100666['params']['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x26d0a1,null))['then'](function(_0x55e819){if(_0x55e819){return _0x55e819[_0x323a('0x68')](_0x100666[_0x323a('0x43')][_0x323a('0x69')]);}})[_0x323a('0x34')](respondWithStatusCode(_0x26d0a1,null))[_0x323a('0x27')](handleError(_0x26d0a1,null));};exports[_0x323a('0x6a')]=function(_0x53cfa5,_0x9f0bc,_0x1a93a2){if(_0x53cfa5[_0x323a('0x5c')]['id']){delete _0x53cfa5['body']['id'];}return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x53cfa5[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x9f0bc,null))['then'](function(_0x4c05b5){if(_0x4c05b5){_0x53cfa5[_0x323a('0x5c')][_0x323a('0x64')]=_0x4c05b5['id'];return db[_0x323a('0x6b')][_0x323a('0x5b')](_0x53cfa5[_0x323a('0x5c')]);}})[_0x323a('0x34')](respondWithResult(_0x9f0bc,null))[_0x323a('0x27')](handleError(_0x9f0bc,null));};exports['getAnswers']=function(_0x2223d3,_0xefd515,_0x140b83){var _0x5bf590={'raw':![],'where':{}};var _0x16f8e4={};var _0x3b4cde={'count':0x0,'rows':[]};return db[_0x323a('0x3d')][_0x323a('0x6c')]({'where':{'id':_0x2223d3[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0xefd515,null))[_0x323a('0x34')](function(_0x30e0b7){if(_0x30e0b7){_0x16f8e4[_0x323a('0x46')]=_[_0x323a('0x44')](db[_0x323a('0x6b')][_0x323a('0x3e')]);_0x16f8e4[_0x323a('0x43')]=_['keys'](_0x2223d3['query']);_0x16f8e4[_0x323a('0x4d')]=_['intersection'](_0x16f8e4[_0x323a('0x46')],_0x16f8e4['query']);_0x5bf590[_0x323a('0x47')]=_['intersection'](_0x16f8e4[_0x323a('0x46')],qs['fields'](_0x2223d3[_0x323a('0x43')][_0x323a('0x48')]));_0x5bf590[_0x323a('0x47')]=_0x5bf590[_0x323a('0x47')][_0x323a('0x58')]?_0x5bf590['attributes']:_0x16f8e4[_0x323a('0x46')];if(!_0x2223d3[_0x323a('0x43')]['hasOwnProperty'](_0x323a('0x6d'))){_0x5bf590[_0x323a('0x2d')]=qs[_0x323a('0x2d')](_0x2223d3[_0x323a('0x43')][_0x323a('0x2d')]);_0x5bf590[_0x323a('0x2b')]=qs[_0x323a('0x2b')](_0x2223d3[_0x323a('0x43')][_0x323a('0x2b')]);}_0x5bf590[_0x323a('0x67')]=qs[_0x323a('0x4a')](_0x2223d3[_0x323a('0x43')][_0x323a('0x4a')]);_0x5bf590[_0x323a('0x4b')]=qs[_0x323a('0x4d')](_['pick'](_0x2223d3[_0x323a('0x43')],_0x16f8e4['filters']));_0x5bf590[_0x323a('0x4b')][_0x323a('0x64')]=_0x30e0b7['id'];if(_0x2223d3['query'][_0x323a('0x4e')]){_0x5bf590['where']=_['merge'](_0x5bf590[_0x323a('0x4b')],{'$or':_['map'](_0x5bf590[_0x323a('0x47')],function(_0xbecdc2){var _0x3b1e42={};_0x3b1e42[_0xbecdc2]={'$like':'%'+_0x2223d3[_0x323a('0x43')][_0x323a('0x4e')]+'%'};return _0x3b1e42;})});}_0x5bf590=_[_0x323a('0x4f')]({},_0x5bf590,_0x2223d3[_0x323a('0x51')]);return db[_0x323a('0x6b')]['count']({'where':_0x5bf590['where']})[_0x323a('0x34')](function(_0x18efb5){_0x3b4cde[_0x323a('0x2e')]=_0x18efb5;if(_0x2223d3[_0x323a('0x43')][_0x323a('0x59')]){_0x5bf590['include']=[{'all':!![]}];}return db[_0x323a('0x6b')][_0x323a('0x53')](_0x5bf590);})[_0x323a('0x34')](function(_0x286f7d){_0x3b4cde['rows']=_0x286f7d;return _0x3b4cde;});}})[_0x323a('0x34')](respondWithFilteredResult(_0xefd515,_0x5bf590))[_0x323a('0x27')](handleError(_0xefd515,null));};exports['removeAnswers']=function(_0x1c4afd,_0x499724,_0x110715){return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x1c4afd[_0x323a('0x56')]['id']}})['then'](handleEntityNotFound(_0x499724,null))[_0x323a('0x34')](function(_0x3b26dc){if(_0x3b26dc){return _0x3b26dc[_0x323a('0x6e')](_0x1c4afd['query']['ids']);}})[_0x323a('0x34')](respondWithStatusCode(_0x499724,null))[_0x323a('0x27')](handleError(_0x499724,null));};exports[_0x323a('0x6f')]=function(_0x543e08,_0x43457f,_0xd9e118){return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x543e08[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x43457f,null))[_0x323a('0x34')](function(_0x61ca84){if(_0x61ca84){return _0x61ca84[_0x323a('0x6f')](_0x543e08['body'][_0x323a('0x69')],_['omit'](_0x543e08['body'],['ids','id'])||{})['spread'](function(_0x29d978){for(var _0x250923=0x0;_0x250923<_0x543e08[_0x323a('0x5c')][_0x323a('0x69')][_0x323a('0x58')];_0x250923+=0x1){socket['emit'](_0x323a('0x70'),{'UserId':Number(_0x543e08[_0x323a('0x5c')][_0x323a('0x69')][_0x250923]),'WhatsappAccountId':Number(_0x543e08[_0x323a('0x56')]['id'])});}return _0x29d978;});}})[_0x323a('0x34')](respondWithResult(_0x43457f,null))[_0x323a('0x27')](handleError(_0x43457f,null));};exports[_0x323a('0x71')]=function(_0x37a110,_0x521ddb,_0x38d0ce){return db['WhatsappAccount'][_0x323a('0x5a')]({'where':{'id':_0x37a110[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x521ddb,null))[_0x323a('0x34')](function(_0x2ab0b7){if(_0x2ab0b7){return _0x2ab0b7[_0x323a('0x71')](_0x37a110[_0x323a('0x43')][_0x323a('0x69')])['then'](function(){if(_[_0x323a('0x72')](_0x37a110['query'][_0x323a('0x69')])){for(var _0x102805=0x0;_0x102805<_0x37a110[_0x323a('0x43')]['ids'][_0x323a('0x58')];_0x102805+=0x1){socket['emit'](_0x323a('0x73'),{'UserId':Number(_0x37a110[_0x323a('0x43')][_0x323a('0x69')][_0x102805]),'WhatsappAccountId':Number(_0x37a110[_0x323a('0x56')]['id'])});}}else{socket[_0x323a('0x74')](_0x323a('0x73'),{'UserId':Number(_0x37a110['query'][_0x323a('0x69')]),'WhatsappAccountId':Number(_0x37a110[_0x323a('0x56')]['id'])});}});}})[_0x323a('0x34')](respondWithStatusCode(_0x521ddb,null))[_0x323a('0x27')](handleError(_0x521ddb,null));};exports[_0x323a('0x75')]=function(_0x93b5f2,_0x4f2133,_0x34c9f0){var _0x46061d={};var _0x47e5da={};var _0x101882;var _0x5b150b;return db[_0x323a('0x3d')][_0x323a('0x6c')]({'where':{'id':_0x93b5f2['params']['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x4f2133,null))[_0x323a('0x34')](function(_0x2b37a9){if(_0x2b37a9){_0x101882=_0x2b37a9;_0x47e5da[_0x323a('0x46')]=_[_0x323a('0x44')](db[_0x323a('0x76')]['rawAttributes']);_0x47e5da['query']=_[_0x323a('0x44')](_0x93b5f2[_0x323a('0x43')]);_0x47e5da[_0x323a('0x4d')]=_['intersection'](_0x47e5da[_0x323a('0x46')],_0x47e5da[_0x323a('0x43')]);_0x46061d['attributes']=_['intersection'](_0x47e5da['model'],qs['fields'](_0x93b5f2[_0x323a('0x43')][_0x323a('0x48')]));_0x46061d[_0x323a('0x47')]=_0x46061d[_0x323a('0x47')][_0x323a('0x58')]?_0x46061d[_0x323a('0x47')]:_0x47e5da[_0x323a('0x46')];_0x46061d[_0x323a('0x67')]=qs[_0x323a('0x4a')](_0x93b5f2['query']['sort']);_0x46061d[_0x323a('0x4b')]=qs['filters'](_[_0x323a('0x4c')](_0x93b5f2[_0x323a('0x43')],_0x47e5da['filters']));if(_0x93b5f2[_0x323a('0x43')]['filter']){_0x46061d[_0x323a('0x4b')]=_[_0x323a('0x4f')](_0x46061d['where'],{'$or':_['map'](_0x46061d['attributes'],function(_0x749c60){var _0x3a12c2={};_0x3a12c2[_0x749c60]={'$like':'%'+_0x93b5f2[_0x323a('0x43')]['filter']+'%'};return _0x3a12c2;})});}_0x46061d=_['merge']({},_0x46061d,_0x93b5f2[_0x323a('0x51')]);return _0x101882[_0x323a('0x75')](_0x46061d);}})['then'](function(_0x12ca9e){if(_0x12ca9e){_0x5b150b=_0x12ca9e[_0x323a('0x58')];if(!_0x93b5f2[_0x323a('0x43')][_0x323a('0x49')](_0x323a('0x6d'))){_0x46061d[_0x323a('0x2d')]=qs[_0x323a('0x2d')](_0x93b5f2['query'][_0x323a('0x2d')]);_0x46061d[_0x323a('0x2b')]=qs[_0x323a('0x2b')](_0x93b5f2[_0x323a('0x43')]['offset']);}return _0x101882[_0x323a('0x75')](_0x46061d);}})['then'](function(_0x5e4009){if(_0x5e4009){return _0x5e4009?{'count':_0x5b150b,'rows':_0x5e4009}:null;}})['then'](respondWithResult(_0x4f2133,null))[_0x323a('0x27')](handleError(_0x4f2133,null));};exports[_0x323a('0x77')]=function(_0x4ae25f,_0x3d09c8){var _0x35c1d5=_0x4ae25f[_0x323a('0x56')]['id'];var _0x41edc6=_0x4ae25f['body'];var _0x593e5a=0xc8;var _0x46d6fb=null;return db[_0x323a('0x78')][_0x323a('0x79')]({'isolationLevel':db[_0x323a('0x78')]['Transaction'][_0x323a('0x7a')]['READ_COMMITTED']},function(_0x4d986e){return db[_0x323a('0x3d')][_0x323a('0x6c')]({'where':{'id':_0x35c1d5},'transaction':_0x4d986e})[_0x323a('0x34')](function(_0x3c2f4d){if(_0x3c2f4d){return db[_0x323a('0x7b')][_0x323a('0x33')]({'where':{'WhatsappAccountId':_0x35c1d5},'transaction':_0x4d986e})[_0x323a('0x34')](function(){var _0x2b72c2=_[_0x323a('0x42')](_0x41edc6,function(_0x384594){_0x384594[_0x323a('0x64')]=_0x35c1d5;return _0x384594;});return db[_0x323a('0x7b')][_0x323a('0x7c')](_0x2b72c2,{'transaction':_0x4d986e});});}else{_0x593e5a=0x194;_0x46d6fb=[];}});})[_0x323a('0x34')](function(){if(_0x593e5a!==0x194){return db[_0x323a('0x7b')][_0x323a('0x7d')]({'where':{'WhatsappAccountId':_0x35c1d5},'order':'priority'})[_0x323a('0x34')](function(_0x5210b9){_0x46d6fb=_0x5210b9;});}})['catch'](function(_0x28ef67){_0x593e5a=0x1f4;logger[_0x323a('0x24')](_0x28ef67[_0x323a('0x39')]);if(_0x28ef67[_0x323a('0x3a')]){delete _0x28ef67['name'];}_0x46d6fb=_0x28ef67;})[_0x323a('0x7e')](function(){if(_0x46d6fb===null){_0x3d09c8[_0x323a('0x28')](_0x593e5a);}else{if(_0x593e5a===0x1f4){_0x3d09c8[_0x323a('0x29')](_0x593e5a)[_0x323a('0x3b')](_0x46d6fb);}else{_0x3d09c8[_0x323a('0x29')](_0x593e5a)[_0x323a('0x2a')](_0x46d6fb);}}});};exports['getApplications']=function(_0x2d5eff,_0x46e2c5,_0x47199d){var _0x19703b={};var _0x512262={};var _0x487a86;var _0x1a9eed;return db['WhatsappAccount']['findOne']({'where':{'id':_0x2d5eff[_0x323a('0x56')]['id']}})[_0x323a('0x34')](handleEntityNotFound(_0x46e2c5,null))[_0x323a('0x34')](function(_0x16929e){if(_0x16929e){_0x487a86=_0x16929e;_0x512262[_0x323a('0x46')]=_[_0x323a('0x44')](db[_0x323a('0x7b')]['rawAttributes']);_0x512262[_0x323a('0x43')]=_[_0x323a('0x44')](_0x2d5eff[_0x323a('0x43')]);_0x512262[_0x323a('0x4d')]=_[_0x323a('0x45')](_0x512262[_0x323a('0x46')],_0x512262[_0x323a('0x43')]);_0x19703b['attributes']=_[_0x323a('0x45')](_0x512262[_0x323a('0x46')],qs[_0x323a('0x48')](_0x2d5eff[_0x323a('0x43')][_0x323a('0x48')]));_0x19703b[_0x323a('0x47')]=_0x19703b['attributes']['length']?_0x19703b[_0x323a('0x47')]:_0x512262[_0x323a('0x46')];_0x19703b[_0x323a('0x67')]=qs[_0x323a('0x4a')](_0x2d5eff[_0x323a('0x43')][_0x323a('0x4a')]);_0x19703b[_0x323a('0x4b')]=qs[_0x323a('0x4d')](_['pick'](_0x2d5eff[_0x323a('0x43')],_0x512262[_0x323a('0x4d')]));if(_0x2d5eff[_0x323a('0x43')]['filter']){_0x19703b[_0x323a('0x4b')]=_[_0x323a('0x4f')](_0x19703b['where'],{'$or':_[_0x323a('0x42')](_0x19703b[_0x323a('0x47')],function(_0x3cb392){var _0x55cd17={};_0x55cd17[_0x3cb392]={'$like':'%'+_0x2d5eff[_0x323a('0x43')]['filter']+'%'};return _0x55cd17;})});}_0x19703b=_[_0x323a('0x4f')]({},_0x19703b,_0x2d5eff[_0x323a('0x51')]);return _0x487a86[_0x323a('0x7f')](_0x19703b);}})[_0x323a('0x34')](function(_0x142231){if(_0x142231){_0x1a9eed=_0x142231[_0x323a('0x58')];if(!_0x2d5eff[_0x323a('0x43')][_0x323a('0x49')]('nolimit')){_0x19703b[_0x323a('0x2d')]=qs[_0x323a('0x2d')](_0x2d5eff[_0x323a('0x43')][_0x323a('0x2d')]);_0x19703b[_0x323a('0x2b')]=qs['offset'](_0x2d5eff[_0x323a('0x43')]['offset']);}return _0x487a86['getApplications'](_0x19703b);}})[_0x323a('0x34')](function(_0x48eccd){if(_0x48eccd){return _0x48eccd?{'count':_0x1a9eed,'rows':_0x48eccd}:null;}})[_0x323a('0x34')](respondWithResult(_0x46e2c5,null))[_0x323a('0x27')](handleError(_0x46e2c5,null));};exports[_0x323a('0x80')]=function(_0x2de15f,_0x53178b,_0x413e43){var _0x28e519={'channel':_0x323a('0x81')};var _0x297809=[];var _0x2eb15a=[];var _0x253ef0={};return db[_0x323a('0x3d')][_0x323a('0x5a')]({'where':{'id':_0x2de15f[_0x323a('0x56')]['id']},'include':[{'model':db[_0x323a('0x7b')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x53178b,null))[_0x323a('0x34')](function(_0x2d83a7){_0x28e519[_0x323a('0x82')]=_0x2d83a7;if(_0x28e519[_0x323a('0x82')]&&_0x28e519[_0x323a('0x82')][_0x323a('0x40')]==='sinch'&&_0x2de15f['body']['statuses']){if(_0x2de15f[_0x323a('0x5c')][_0x323a('0x83')][_0x323a('0x58')]===0x0)return;if(_0x2de15f['body'][_0x323a('0x83')][0x0][_0x323a('0x84')]!=='read')return;return db[_0x323a('0x85')]['update']({'read':!![],'readAt':_0x2de15f[_0x323a('0x5c')][_0x323a('0x83')][0x0][_0x323a('0x86')]},{'where':{'messageId':_0x2de15f['body'][_0x323a('0x83')][0x0][_0x323a('0x87')]},'individualHooks':!![]})['then'](function(_0x4feb44){return _0x53178b['status'](0xc8)[_0x323a('0x2a')](_0x4feb44);});}_0x28e519[_0x323a('0x88')]=_[_0x323a('0x89')](_0x2d83a7[_0x323a('0x8a')],[_0x323a('0x8b')],[_0x323a('0x8c')]);if(_0x28e519['account']['Applications']){delete _0x28e519[_0x323a('0x82')]['Applications'];}return db[_0x323a('0x8d')][_0x323a('0x62')]()[_0x323a('0x34')](function(_0x3c7822){if(!_0x3c7822){throw new db[(_0x323a('0x8e'))][(_0x323a('0x8f'))](_0x323a('0x90'));}_0x297809=_[_0x323a('0x91')](_[_0x323a('0x44')](_0x3c7822),[_0x323a('0x92'),'updatedAt']);_0x2eb15a=_[_0x323a('0x91')](_[_0x323a('0x44')](_0x3c7822),['createdAt',_0x323a('0x93'),_0x323a('0x94'),_0x323a('0x95')]);_0x28e519[_0x323a('0x5c')]={'mapKey':_0x323a('0x96')};if(_0x28e519[_0x323a('0x82')]&&_0x28e519[_0x323a('0x82')][_0x323a('0x40')]===_0x323a('0x97')){_0x28e519[_0x323a('0x5c')]['from']=_0x2de15f[_0x323a('0x5c')][_0x323a('0x98')]['replace'](_0x323a('0x99'),'');_0x28e519[_0x323a('0x5c')]['body']=_0x2de15f[_0x323a('0x5c')][_0x323a('0x9a')];_0x28e519['body'][_0x323a('0x9b')]=_0x2de15f[_0x323a('0x5c')]['MessageSid'];}if(_0x28e519[_0x323a('0x82')]&&_0x28e519['account']['type']==='sinch'){_0x28e519['body']['from']=_0x2de15f['body']['notifications'][0x0][_0x323a('0x9c')];_0x28e519[_0x323a('0x5c')][_0x323a('0x5c')]=_0x2de15f['body']['notifications'][0x0][_0x323a('0x25')]['body'];_0x28e519[_0x323a('0x5c')][_0x323a('0x9b')]=_0x2de15f[_0x323a('0x5c')]['notifications'][0x0][_0x323a('0x87')];}if(_0x28e519[_0x323a('0x5c')]['id']){delete _0x28e519['body']['id'];}if(_['isNil'](_0x28e519[_0x323a('0x5c')][_0x323a('0x9c')])){throw new db[(_0x323a('0x8e'))][(_0x323a('0x8f'))](_0x323a('0x9d'));}if(_['isNil'](_0x28e519['body'][_0x323a('0x5c')])||_0x28e519[_0x323a('0x5c')][_0x323a('0x5c')]===''){throw new db[(_0x323a('0x8e'))][(_0x323a('0x8f'))](_0x323a('0x9e'));}if(_['isNil'](_0x28e519[_0x323a('0x5c')][_0x323a('0x9f')])){throw new db['Sequelize'][(_0x323a('0x8f'))](_0x323a('0xa0')+_0x2eb15a);}if(!_[_0x323a('0xa1')](_0x2eb15a,_0x28e519[_0x323a('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x323a('0x8f'))](_0x323a('0xa2')+_0x2eb15a);}_0x253ef0[_0x28e519[_0x323a('0x5c')]['mapKey']]=_0x28e519['body']['from'];return db[_0x323a('0xa3')][_0x323a('0x5a')]({'where':{'id':_0x28e519['account'][_0x323a('0x95')]},'include':[{'model':db['CmContact'],'as':_0x323a('0xa4'),'where':_0x253ef0,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x53178b,null))[_0x323a('0x34')](function(_0x2f27d6){if(_0x2f27d6){_0x28e519[_0x323a('0xa5')]=_[_0x323a('0xa6')](_0x2f27d6,[_0x323a('0xa4')]);if(_0x2f27d6[_0x323a('0xa4')][_0x323a('0x58')]){return _0x2f27d6['Contacts'][0x0];}var _0x17d8f8=_['defaults'](_0x28e519['body'],{'firstName':_0x28e519[_0x323a('0x5c')][_0x323a('0x9c')],'ListId':_0x2f27d6['id']});_0x17d8f8[_0x28e519[_0x323a('0x5c')][_0x323a('0x9f')]]=_0x28e519[_0x323a('0x5c')][_0x323a('0x9c')];return db[_0x323a('0x8d')][_0x323a('0x5b')](_0x17d8f8,{'fields':_0x297809,'raw':!![]});}})['then'](handleEntityNotFound(_0x53178b,null))[_0x323a('0x34')](function(_0x3351fb){if(_0x3351fb){_0x28e519[_0x323a('0xa7')]=_0x3351fb;var _0x27f231={'ContactId':_0x3351fb['id'],'phone':_0x28e519[_0x323a('0x5c')][_0x323a('0x9c')],'WhatsappAccountId':_0x2de15f['params']['id']};var _0x5aeef6={'ContactId':_0x3351fb['id'],'WhatsappAccountId':_0x2de15f[_0x323a('0x56')]['id'],'closed':![]};return db[_0x323a('0xa8')][_0x323a('0x5a')]({'where':_0x5aeef6})[_0x323a('0x34')](function(_0x270672){if(_0x270672){return[_0x270672,![]];}return db[_0x323a('0xa8')][_0x323a('0x5b')](_0x27f231)[_0x323a('0x34')](function(_0x5bf9dc){return[_0x5bf9dc,!![]];});});}})['spread'](function(_0x12fbf3,_0x10ff82){_0x28e519[_0x323a('0xa9')]=_0x12fbf3['get']({'plain':!![]});_0x28e519[_0x323a('0xa9')]['created']=![];if(_0x10ff82){if(_0x28e519[_0x323a('0x82')][_0x323a('0xaa')]){_0x28e519['applications'][_0x323a('0xab')]({'id':0x0,'priority':_0x28e519[_0x323a('0x88')]['length']+0x1,'app':_0x323a('0xac'),'appdata':_0x323a('0xad'),'interval':'*,*,*,*'});}_0x28e519['interaction'][_0x323a('0xae')]=!![];}return db[_0x323a('0x85')][_0x323a('0x5b')]({'phone':_0x28e519['body']['from'],'messageId':_0x28e519[_0x323a('0x5c')]['messageId'],'body':_0x28e519[_0x323a('0x5c')][_0x323a('0x5c')],'WhatsappAccountId':_0x2de15f['params']['id'],'WhatsappInteractionId':_0x12fbf3['id'],'direction':'in','ContactId':_0x12fbf3[_0x323a('0xaf')],'AttachmentId':_0x28e519[_0x323a('0x5c')][_0x323a('0xb0')]});})[_0x323a('0x34')](function(_0x478f2a){_0x28e519[_0x323a('0x25')]=_0x478f2a;if(!_0x28e519[_0x323a('0xa9')][_0x323a('0xb1')])return;return db[_0x323a('0x76')][_0x323a('0x5a')]({'attributes':['id',_0x323a('0x3a')],'where':{'id':_0x28e519[_0x323a('0xa9')][_0x323a('0xb1')]}});})[_0x323a('0x34')](function(_0x4deeb9){if(_0x4deeb9){_0x28e519[_0x323a('0x88')][_0x323a('0xb2')]({'id':0x0,'priority':0x0,'app':_0x323a('0xb3'),'appdata':_0x4deeb9[_0x323a('0x3a')]+','+(_0x28e519[_0x323a('0x82')][_0x323a('0xb4')]||0xa),'interval':'*,*,*,*'});}if(!_0x28e519['interaction'][_0x323a('0xb5')])return;return db[_0x323a('0xb6')][_0x323a('0x5a')]({'attributes':['id','name'],'where':{'id':_0x28e519[_0x323a('0xa9')][_0x323a('0xb5')]}});})[_0x323a('0x34')](function(_0x2830d5){if(_0x2830d5){_0x28e519[_0x323a('0x88')][_0x323a('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2830d5['name']+','+(_0x28e519[_0x323a('0x82')][_0x323a('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x323a('0xb8'),_0x323a('0xb9'),_0x28e519);})['then'](function(_0x59d1b6){if(_0x59d1b6){var _0x350906=0xc8;var _0x3abeef=_0x323a('0xba');logger['info'](_0x323a('0x22'),_0x3abeef,_0x350906,'entity\x20found');logger[_0x323a('0x21')](_0x323a('0xbb'),_0x3abeef,_0x350906,'entity\x20found',JSON[_0x323a('0xbc')](_0x59d1b6));if(_0x28e519[_0x323a('0x82')][_0x323a('0x40')]==='twilio'){return _0x53178b[_0x323a('0x29')](_0x350906)[_0x323a('0xbd')]('Content-Type',_0x323a('0xbe'))['send'](_0x323a('0xbf'));}else{return _0x53178b[_0x323a('0x29')](_0x350906)[_0x323a('0x2a')](_0x59d1b6);}}});})['catch'](handleError(_0x53178b,null));};exports['send']=function(_0x4e6389,_0x2a6f7e,_0x41aee7){var _0x2ad176,_0x255980,_0x5813be;if(_[_0x323a('0xc0')](_0x4e6389['body'][_0x323a('0x5c')])||_0x4e6389[_0x323a('0x5c')][_0x323a('0x5c')]===''){throw new db['Sequelize'][(_0x323a('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x323a('0xc0')](_0x4e6389['body']['to'])){throw new db[(_0x323a('0x8e'))][(_0x323a('0x8f'))](_0x323a('0xc1'));}_0x2ad176=_0x4e6389[_0x323a('0x5c')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x4e6389[_0x323a('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x323a('0x8d')],'as':_0x323a('0xa4'),'where':{'mobile':_0x2ad176},'limit':0x1,'order':[[_0x323a('0x93'),'DESC']]}]}]})[_0x323a('0x34')](handleEntityNotFound(_0x2a6f7e,null))[_0x323a('0x34')](function(_0x113e4b){if(_0x113e4b&&_0x113e4b['List']){_0x255980=_0x113e4b['get']({'plain':!![]});if(_0x255980[_0x323a('0xc2')]&&_0x255980[_0x323a('0xc2')][_0x323a('0xa4')][_0x323a('0x58')]){return _0x255980[_0x323a('0xc2')][_0x323a('0xa4')][0x0];}return db[_0x323a('0x8d')][_0x323a('0x5b')](_[_0x323a('0x1a')](_0x4e6389[_0x323a('0x5c')],{'firstName':_0x2ad176,'mobile':_0x2ad176,'phone':_0x2ad176,'ListId':_0x255980[_0x323a('0x95')]}));}})['then'](handleEntityNotFound(_0x2a6f7e,null))['then'](function(_0x181aa8){if(_0x181aa8){_0x5813be=_0x181aa8;return db[_0x323a('0xa8')]['find']({'where':{'ContactId':_0x5813be['id'],'closed':![],'WhatsappAccountId':_0x255980['id']}})['then'](function(_0x1e4c42){if(_0x1e4c42){return[_0x1e4c42,![]];}return db[_0x323a('0xa8')]['create']({'UserId':_0x4e6389['user']['id'],'ContactId':_0x5813be['id'],'WhatsappAccountId':_0x255980['id'],'phone':_0x2ad176,'firstMsgDirection':_0x323a('0xc3'),'Messages':[_[_0x323a('0x4f')](_0x4e6389[_0x323a('0x5c')],{'read':![],'body':_0x4e6389['body'][_0x323a('0x5c')],'phone':_0x2ad176,'WhatsappAccountId':_0x255980['id'],'UserId':_0x4e6389[_0x323a('0x5d')]['id'],'ContactId':_0x5813be['id']})]},{'include':[{'model':db[_0x323a('0x85')],'as':_0x323a('0xc4')}]})[_0x323a('0x34')](function(_0x4680df){return[_0x4680df,!![]];});});}})['spread'](function(_0x2c1374,_0x4d0b82){if(_0x4d0b82){return _0x2c1374;}return db[_0x323a('0x85')][_0x323a('0x5b')](_[_0x323a('0x4f')](_0x4e6389['body'],{'read':![],'body':_0x4e6389[_0x323a('0x5c')][_0x323a('0x5c')],'phone':_0x2ad176,'WhatsappAccountId':_0x255980['id'],'WhatsappInteractionId':_0x2c1374['id'],'UserId':_0x4e6389[_0x323a('0x5d')]['id'],'ContactId':_0x5813be['id']}))[_0x323a('0x34')](function(_0x2f6c7a){_0x2c1374[_0x323a('0xc5')][_0x323a('0xc4')]=[];_0x2c1374[_0x323a('0xc5')]['Messages'][_0x323a('0xab')](_0x2f6c7a[_0x323a('0xc5')]);return _0x2c1374;});})[_0x323a('0x34')](respondWithResult(_0x2a6f7e,null))[_0x323a('0x27')](handleError(_0x2a6f7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 78314ea..d55e84c 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 _0x9b97=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappAccount','save','update'];(function(_0x268e19,_0x49b4ad){var _0x87ac2b=function(_0x244836){while(--_0x244836){_0x268e19['push'](_0x268e19['shift']());}};_0x87ac2b(++_0x49b4ad);}(_0x9b97,0x154));var _0x79b9=function(_0x274ad0,_0x739484){_0x274ad0=_0x274ad0-0x0;var _0x688a57=_0x9b97[_0x274ad0];return _0x688a57;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x79b9('0x0'))['db'][_0x79b9('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79b9('0x2'),'afterUpdate':_0x79b9('0x3'),'afterDestroy':_0x79b9('0x4')};function emitEvent(_0x3e4af1){return function(_0x259e3c,_0x3bed33,_0x3393b8){WhatsappAccountEvents[_0x79b9('0x5')](_0x3e4af1+':'+_0x259e3c['id'],_0x259e3c);WhatsappAccountEvents[_0x79b9('0x5')](_0x3e4af1,_0x259e3c);_0x3393b8(null);};}for(var e in events){if(events[_0x79b9('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x79b9('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa279=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x4f103e,_0x284aaf){var _0x474b4d=function(_0x1448ae){while(--_0x1448ae){_0x4f103e['push'](_0x4f103e['shift']());}};_0x474b4d(++_0x284aaf);}(_0xa279,0x91));var _0x9a27=function(_0x13e4b8,_0x16e401){_0x13e4b8=_0x13e4b8-0x0;var _0x525273=_0xa279[_0x13e4b8];return _0x525273;};'use strict';var EventEmitter=require(_0x9a27('0x0'));var WhatsappAccount=require(_0x9a27('0x1'))['db'][_0x9a27('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9a27('0x3')](0x0);var events={'afterCreate':_0x9a27('0x4'),'afterUpdate':'update','afterDestroy':_0x9a27('0x5')};function emitEvent(_0x4edc97){return function(_0x131e03,_0x425e04,_0x940a62){WhatsappAccountEvents[_0x9a27('0x6')](_0x4edc97+':'+_0x131e03['id'],_0x131e03);WhatsappAccountEvents[_0x9a27('0x6')](_0x4edc97,_0x131e03);_0x940a62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9a27('0x7')](e,emitEvent(event));}}module[_0x9a27('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 02dbe68..c8556be 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 _0x3863=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x993728,_0x45de3a){var _0xf4947e=function(_0x4457c4){while(--_0x4457c4){_0x993728['push'](_0x993728['shift']());}};_0xf4947e(++_0x45de3a);}(_0x3863,0x87));var _0x3386=function(_0x51d8d3,_0x224e00){_0x51d8d3=_0x51d8d3-0x0;var _0x2acced=_0x3863[_0x51d8d3];return _0x2acced;};'use strict';var _=require(_0x3386('0x0'));var util=require(_0x3386('0x1'));var logger=require(_0x3386('0x2'))(_0x3386('0x3'));var moment=require('moment');var BPromise=require(_0x3386('0x4'));var rp=require(_0x3386('0x5'));var fs=require('fs');var path=require(_0x3386('0x6'));var rimraf=require(_0x3386('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x3386('0x8')]=function(_0x404de1,_0x1f3dbb){return _0x404de1[_0x3386('0x9')](_0x3386('0xa'),attributes,{'tableName':_0x3386('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab0=['request-promise','path','rimraf','define','whatsapp_accounts','lodash','util','../../config/logger','moment'];(function(_0x5f4f34,_0x45345b){var _0x30311b=function(_0x1c08c0){while(--_0x1c08c0){_0x5f4f34['push'](_0x5f4f34['shift']());}};_0x30311b(++_0x45345b);}(_0x1ab0,0x1eb));var _0x01ab=function(_0x1b76cf,_0x526b7b){_0x1b76cf=_0x1b76cf-0x0;var _0x1b448b=_0x1ab0[_0x1b76cf];return _0x1b448b;};'use strict';var _=require(_0x01ab('0x0'));var util=require(_0x01ab('0x1'));var logger=require(_0x01ab('0x2'))('api');var moment=require(_0x01ab('0x3'));var BPromise=require('bluebird');var rp=require(_0x01ab('0x4'));var fs=require('fs');var path=require(_0x01ab('0x5'));var rimraf=require(_0x01ab('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x18220e,_0x77bb40){return _0x18220e[_0x01ab('0x7')]('WhatsappAccount',attributes,{'tableName':_0x01ab('0x8'),'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 da87ba0..952ce95 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 _0xa013=['register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappAccount.socket'];(function(_0x14d5dc,_0x5f3046){var _0x1528a7=function(_0x5b08f2){while(--_0x5b08f2){_0x14d5dc['push'](_0x14d5dc['shift']());}};_0x1528a7(++_0x5f3046);}(_0xa013,0x1ea));var _0x3a01=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xa013[_0x4bcf38];return _0x4a89be;};'use strict';var _=require('lodash');var util=require(_0x3a01('0x0'));var moment=require('moment');var BPromise=require(_0x3a01('0x1'));var rs=require(_0x3a01('0x2'));var fs=require('fs');var Redis=require(_0x3a01('0x3'));var db=require(_0x3a01('0x4'))['db'];var utils=require(_0x3a01('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a01('0x6'));var jayson=require(_0x3a01('0x7'));var client=jayson[_0x3a01('0x8')][_0x3a01('0x9')]({'port':0x232a});config['redis']=_[_0x3a01('0xa')](config[_0x3a01('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a01('0xc'))(new Redis(config[_0x3a01('0xb')]));require(_0x3a01('0xd'))[_0x3a01('0xe')](socket);function respondWithRpcPromise(_0x2c864c,_0x1bcf00,_0x5584a6){return new BPromise(function(_0x4dad65,_0x125f2d){return client[_0x3a01('0xf')](_0x2c864c,_0x5584a6)[_0x3a01('0x10')](function(_0x525645){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1bcf00,_0x3a01('0x11'));logger[_0x3a01('0x12')](_0x3a01('0x13'),_0x1bcf00,'request\x20sent',JSON[_0x3a01('0x14')](_0x525645));if(_0x525645[_0x3a01('0x15')]){if(_0x525645['error'][_0x3a01('0x16')]===0x1f4){logger[_0x3a01('0x15')](_0x3a01('0x17'),_0x1bcf00,_0x525645[_0x3a01('0x15')]['message']);return _0x125f2d(_0x525645['error'][_0x3a01('0x18')]);}logger[_0x3a01('0x15')](_0x3a01('0x17'),_0x1bcf00,_0x525645[_0x3a01('0x15')][_0x3a01('0x18')]);return _0x4dad65(_0x525645[_0x3a01('0x15')]['message']);}else{logger[_0x3a01('0x19')](_0x3a01('0x17'),_0x1bcf00,_0x3a01('0x11'));_0x4dad65(_0x525645[_0x3a01('0x1a')][_0x3a01('0x18')]);}})[_0x3a01('0x1b')](function(_0x250738){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1bcf00,_0x250738);_0x125f2d(_0x250738);});});}exports[_0x3a01('0x1c')]=function(_0x51cf62){var _0x215dfd=this;return new Promise(function(_0x3c2326,_0x2cd6f9){return db['WhatsappAccount'][_0x3a01('0x1d')]({'raw':_0x51cf62[_0x3a01('0x1e')]?_0x51cf62[_0x3a01('0x1e')][_0x3a01('0x1f')]===undefined?!![]:![]:!![],'where':_0x51cf62['options']?_0x51cf62[_0x3a01('0x1e')]['where']||null:null,'attributes':_0x51cf62[_0x3a01('0x1e')]?_0x51cf62[_0x3a01('0x1e')][_0x3a01('0x20')]||null:null,'include':_0x51cf62[_0x3a01('0x1e')]?_0x51cf62[_0x3a01('0x1e')]['include']?_[_0x3a01('0x21')](_0x51cf62[_0x3a01('0x1e')][_0x3a01('0x22')],function(_0x4f1898){return{'model':db[_0x4f1898[_0x3a01('0x23')]],'as':_0x4f1898['as'],'attributes':_0x4f1898['attributes'],'include':_0x4f1898[_0x3a01('0x22')]?_[_0x3a01('0x21')](_0x4f1898['include'],function(_0x333a24){return{'model':db[_0x333a24[_0x3a01('0x23')]],'as':_0x333a24['as'],'attributes':_0x333a24['attributes'],'include':_0x333a24[_0x3a01('0x22')]?_['map'](_0x333a24[_0x3a01('0x22')],function(_0x2688c2){return{'model':db[_0x2688c2[_0x3a01('0x23')]],'as':_0x2688c2['as'],'attributes':_0x2688c2[_0x3a01('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a01('0x10')](function(_0x357fa3){logger[_0x3a01('0x19')](_0x3a01('0x1c'),_0x51cf62);logger['debug']('ShowWhatsappAccount',_0x51cf62,JSON[_0x3a01('0x14')](_0x357fa3));_0x3c2326(_0x357fa3);})['catch'](function(_0x4c6962){logger['error']('ShowWhatsappAccount',_0x4c6962[_0x3a01('0x18')],_0x51cf62);_0x2cd6f9(_0x215dfd[_0x3a01('0x15')](0x1f4,_0x4c6962[_0x3a01('0x18')]));});});}; \ No newline at end of file +var _0xdf75=['ShowWhatsappAccount','WhatsappAccount','options','raw','attributes','include','map','model','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x22f8f9,_0x14161c){var _0x1fbf28=function(_0x45ae17){while(--_0x45ae17){_0x22f8f9['push'](_0x22f8f9['shift']());}};_0x1fbf28(++_0x14161c);}(_0xdf75,0x14d));var _0x5df7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdf75[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5df7('0x0'));var util=require(_0x5df7('0x1'));var moment=require(_0x5df7('0x2'));var BPromise=require('bluebird');var rs=require(_0x5df7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5df7('0x5'))(_0x5df7('0x6'));var config=require(_0x5df7('0x7'));var jayson=require(_0x5df7('0x8'));var client=jayson[_0x5df7('0x9')][_0x5df7('0xa')]({'port':0x232a});config['redis']=_[_0x5df7('0xb')](config[_0x5df7('0xc')],{'host':_0x5df7('0xd'),'port':0x18eb});var socket=require(_0x5df7('0xe'))(new Redis(config[_0x5df7('0xc')]));require('./whatsappAccount.socket')[_0x5df7('0xf')](socket);function respondWithRpcPromise(_0x2f47aa,_0x3d3c09,_0x3b37f1){return new BPromise(function(_0x426254,_0x310db2){return client[_0x5df7('0x10')](_0x2f47aa,_0x3b37f1)[_0x5df7('0x11')](function(_0x1614a4){logger[_0x5df7('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3d3c09,_0x5df7('0x13'));logger[_0x5df7('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3d3c09,'request\x20sent',JSON['stringify'](_0x1614a4));if(_0x1614a4[_0x5df7('0x15')]){if(_0x1614a4[_0x5df7('0x15')][_0x5df7('0x16')]===0x1f4){logger[_0x5df7('0x15')](_0x5df7('0x17'),_0x3d3c09,_0x1614a4[_0x5df7('0x15')][_0x5df7('0x18')]);return _0x310db2(_0x1614a4['error']['message']);}logger[_0x5df7('0x15')](_0x5df7('0x17'),_0x3d3c09,_0x1614a4[_0x5df7('0x15')][_0x5df7('0x18')]);return _0x426254(_0x1614a4['error'][_0x5df7('0x18')]);}else{logger['info'](_0x5df7('0x17'),_0x3d3c09,_0x5df7('0x13'));_0x426254(_0x1614a4[_0x5df7('0x19')][_0x5df7('0x18')]);}})[_0x5df7('0x1a')](function(_0xe45bf){logger[_0x5df7('0x15')](_0x5df7('0x17'),_0x3d3c09,_0xe45bf);_0x310db2(_0xe45bf);});});}exports[_0x5df7('0x1b')]=function(_0x2028e7){var _0x5e5206=this;return new Promise(function(_0x84d0c0,_0x49ca26){return db[_0x5df7('0x1c')]['find']({'raw':_0x2028e7[_0x5df7('0x1d')]?_0x2028e7['options'][_0x5df7('0x1e')]===undefined?!![]:![]:!![],'where':_0x2028e7[_0x5df7('0x1d')]?_0x2028e7['options']['where']||null:null,'attributes':_0x2028e7[_0x5df7('0x1d')]?_0x2028e7['options'][_0x5df7('0x1f')]||null:null,'include':_0x2028e7['options']?_0x2028e7[_0x5df7('0x1d')][_0x5df7('0x20')]?_[_0x5df7('0x21')](_0x2028e7[_0x5df7('0x1d')][_0x5df7('0x20')],function(_0x3c72ee){return{'model':db[_0x3c72ee[_0x5df7('0x22')]],'as':_0x3c72ee['as'],'attributes':_0x3c72ee[_0x5df7('0x1f')],'include':_0x3c72ee[_0x5df7('0x20')]?_[_0x5df7('0x21')](_0x3c72ee[_0x5df7('0x20')],function(_0xf1b3cc){return{'model':db[_0xf1b3cc[_0x5df7('0x22')]],'as':_0xf1b3cc['as'],'attributes':_0xf1b3cc[_0x5df7('0x1f')],'include':_0xf1b3cc[_0x5df7('0x20')]?_['map'](_0xf1b3cc[_0x5df7('0x20')],function(_0x296d7e){return{'model':db[_0x296d7e['model']],'as':_0x296d7e['as'],'attributes':_0x296d7e[_0x5df7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5df7('0x11')](function(_0x55dbcd){logger['info']('ShowWhatsappAccount',_0x2028e7);logger[_0x5df7('0x14')](_0x5df7('0x1b'),_0x2028e7,JSON[_0x5df7('0x23')](_0x55dbcd));_0x84d0c0(_0x55dbcd);})['catch'](function(_0x3a7eb5){logger['error'](_0x5df7('0x1b'),_0x3a7eb5[_0x5df7('0x18')],_0x2028e7);_0x49ca26(_0x5e5206[_0x5df7('0x15')](0x1f4,_0x3a7eb5[_0x5df7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index bb376b5..54261e4 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 _0x1008=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x442933,_0x55beeb){var _0x4ca31a=function(_0x404351){while(--_0x404351){_0x442933['push'](_0x442933['shift']());}};_0x4ca31a(++_0x55beeb);}(_0x1008,0x1ab));var _0x8100=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x1008[_0x183b97];return _0x629cf7;};'use strict';var WhatsappAccountEvents=require(_0x8100('0x0'));var events=[_0x8100('0x1'),_0x8100('0x2'),_0x8100('0x3')];function createListener(_0x556e0e,_0xe1487d){return function(_0x5ea9d1){_0xe1487d[_0x8100('0x4')](_0x556e0e,_0x5ea9d1);};}function removeListener(_0x59be6d,_0x553cd1){return function(){WhatsappAccountEvents['removeListener'](_0x59be6d,_0x553cd1);};}exports[_0x8100('0x5')]=function(_0x2d50c4){for(var _0x30770f=0x0,_0x9621d4=events[_0x8100('0x6')];_0x30770f<_0x9621d4;_0x30770f++){var _0x1b05b9=events[_0x30770f];var _0x3146b5=createListener(_0x8100('0x7')+_0x1b05b9,_0x2d50c4);WhatsappAccountEvents['on'](_0x1b05b9,_0x3146b5);}}; \ No newline at end of file +var _0xf22a=['removeListener','register','length','./whatsappAccount.events','save','update'];(function(_0x5b3b13,_0x10d1c0){var _0x13a6eb=function(_0xf46d69){while(--_0xf46d69){_0x5b3b13['push'](_0x5b3b13['shift']());}};_0x13a6eb(++_0x10d1c0);}(_0xf22a,0x1e3));var _0xaf22=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf22a[_0xef8146];return _0x5a6cb0;};'use strict';var WhatsappAccountEvents=require(_0xaf22('0x0'));var events=[_0xaf22('0x1'),'remove',_0xaf22('0x2')];function createListener(_0x1e9a91,_0xf4ee70){return function(_0x542aad){_0xf4ee70['emit'](_0x1e9a91,_0x542aad);};}function removeListener(_0x3ceff5,_0x53ab3b){return function(){WhatsappAccountEvents[_0xaf22('0x3')](_0x3ceff5,_0x53ab3b);};}exports[_0xaf22('0x4')]=function(_0xe36b03){for(var _0x1df17e=0x0,_0x5a1bb9=events[_0xaf22('0x5')];_0x1df17e<_0x5a1bb9;_0x1df17e++){var _0x2cbad7=events[_0x1df17e];var _0x254ce6=createListener('whatsappAccount:'+_0x2cbad7,_0xe36b03);WhatsappAccountEvents['on'](_0x2cbad7,_0x254ce6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4ed770e..9edff37 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 _0xe190=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x16d9d7,_0x4cc7fd){var _0x596ed0=function(_0x500b6e){while(--_0x500b6e){_0x16d9d7['push'](_0x16d9d7['shift']());}};_0x596ed0(++_0x4cc7fd);}(_0xe190,0xa6));var _0x0e19=function(_0x1a1d86,_0x2edf7e){_0x1a1d86=_0x1a1d86-0x0;var _0x4faaff=_0xe190[_0x1a1d86];return _0x4faaff;};'use strict';var multer=require(_0x0e19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e19('0x1'));var express=require(_0x0e19('0x2'));var router=express['Router']();var fs_extra=require(_0x0e19('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0e19('0x4'));var config=require(_0x0e19('0x5'));var controller=require(_0x0e19('0x6'));router['get']('/',auth[_0x0e19('0x7')](),controller[_0x0e19('0x8')]);router[_0x0e19('0x9')](_0x0e19('0xa'),auth['isAuthenticated'](),controller[_0x0e19('0xb')]);router[_0x0e19('0xc')]('/',auth[_0x0e19('0x7')](),controller[_0x0e19('0xd')]);router['put']('/:id',auth[_0x0e19('0x7')](),controller['update']);router[_0x0e19('0xe')](_0x0e19('0xa'),auth[_0x0e19('0x7')](),controller[_0x0e19('0xf')]);module[_0x0e19('0x10')]=router; \ No newline at end of file +var _0x82b5=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1afa30,_0xc036d5){var _0x45e4e6=function(_0x10c0ba){while(--_0x10c0ba){_0x1afa30['push'](_0x1afa30['shift']());}};_0x45e4e6(++_0xc036d5);}(_0x82b5,0x1b5));var _0x582b=function(_0x1f6aec,_0x5d7c95){_0x1f6aec=_0x1f6aec-0x0;var _0x30b518=_0x82b5[_0x1f6aec];return _0x30b518;};'use strict';var multer=require('multer');var util=require(_0x582b('0x0'));var path=require(_0x582b('0x1'));var timeout=require(_0x582b('0x2'));var express=require(_0x582b('0x3'));var router=express['Router']();var fs_extra=require(_0x582b('0x4'));var auth=require(_0x582b('0x5'));var interaction=require(_0x582b('0x6'));var config=require(_0x582b('0x7'));var controller=require('./whatsappApplication.controller');router[_0x582b('0x8')]('/',auth['isAuthenticated'](),controller[_0x582b('0x9')]);router['get'](_0x582b('0xa'),auth[_0x582b('0xb')](),controller[_0x582b('0xc')]);router[_0x582b('0xd')]('/',auth[_0x582b('0xb')](),controller[_0x582b('0xe')]);router[_0x582b('0xf')](_0x582b('0xa'),auth[_0x582b('0xb')](),controller[_0x582b('0x10')]);router[_0x582b('0x11')](_0x582b('0xa'),auth[_0x582b('0xb')](),controller[_0x582b('0x12')]);module[_0x582b('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3d0cfb8..9c84b98 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 _0x6796=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x59c86c,_0x3a9baa){var _0x27327e=function(_0x5ae753){while(--_0x5ae753){_0x59c86c['push'](_0x59c86c['shift']());}};_0x27327e(++_0x3a9baa);}(_0x6796,0x66));var _0x6679=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x6796[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x6679('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6679('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6679('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6679('0x3')]()},'description':{'type':Sequelize[_0x6679('0x2')]},'interval':{'type':Sequelize[_0x6679('0x2')],'defaultValue':_0x6679('0x4')}}; \ No newline at end of file +var _0x2f2d=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x5a5693,_0x5e2790){var _0x541967=function(_0x3f73b9){while(--_0x3f73b9){_0x5a5693['push'](_0x5a5693['shift']());}};_0x541967(++_0x5e2790);}(_0x2f2d,0x144));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd2f2('0x0'));module[_0xd2f2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd2f2('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd2f2('0x3')]},'interval':{'type':Sequelize[_0xd2f2('0x3')],'defaultValue':_0xd2f2('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 833faf9..6085d58 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 _0xcf3d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','reject','update','destroy','then','end','stack','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','keys','options','find','create','body'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x53f2b1,_0x1e2b70){_0x53f2b1=_0x53f2b1-0x0;var _0x4a4f35=_0xcf3d[_0x53f2b1];return _0x4a4f35;};'use strict';var emlformat=require(_0xdcf3('0x0'));var rimraf=require(_0xdcf3('0x1'));var zipdir=require(_0xdcf3('0x2'));var jsonpatch=require(_0xdcf3('0x3'));var rp=require('request-promise');var moment=require(_0xdcf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf3('0x5'));var util=require(_0xdcf3('0x6'));var path=require(_0xdcf3('0x7'));var sox=require(_0xdcf3('0x8'));var csv=require(_0xdcf3('0x9'));var ejs=require(_0xdcf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf3('0xb'));var squel=require('squel');var crypto=require(_0xdcf3('0xc'));var jsforce=require(_0xdcf3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdcf3('0xe'));var Redis=require(_0xdcf3('0xf'));var authService=require(_0xdcf3('0x10'));var qs=require(_0xdcf3('0x11'));var as=require(_0xdcf3('0x12'));var hardwareService=require(_0xdcf3('0x13'));var logger=require(_0xdcf3('0x14'))(_0xdcf3('0x15'));var utils=require(_0xdcf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdcf3('0x17'));var db=require(_0xdcf3('0x18'))['db'];function respondWithStatusCode(_0x4b1623,_0x40ddf7){_0x40ddf7=_0x40ddf7||0xcc;return function(_0x2e1fff){if(_0x2e1fff){return _0x4b1623[_0xdcf3('0x19')](_0x40ddf7);}return _0x4b1623[_0xdcf3('0x1a')](_0x40ddf7)['end']();};}function respondWithResult(_0x2d0bc2,_0x4b003f){_0x4b003f=_0x4b003f||0xc8;return function(_0x4d5417){if(_0x4d5417){return _0x2d0bc2[_0xdcf3('0x1a')](_0x4b003f)['json'](_0x4d5417);}};}function respondWithFilteredResult(_0x1b34b4,_0x2ebc69){return function(_0x1af727){if(_0x1af727){var _0x2c5436=typeof _0x2ebc69['offset']===_0xdcf3('0x1b')&&typeof _0x2ebc69[_0xdcf3('0x1c')]==='undefined';var _0xc64c2a=_0x1af727[_0xdcf3('0x1d')];var _0x441142=_0x2c5436?0x0:_0x2ebc69[_0xdcf3('0x1e')];var _0x1c1df7=_0x2c5436?_0x1af727[_0xdcf3('0x1d')]:_0x2ebc69[_0xdcf3('0x1e')]+_0x2ebc69[_0xdcf3('0x1c')];var _0x27a958;if(_0x1c1df7>=_0xc64c2a){_0x1c1df7=_0xc64c2a;_0x27a958=0xc8;}else{_0x27a958=0xce;}_0x1b34b4[_0xdcf3('0x1a')](_0x27a958);return _0x1b34b4[_0xdcf3('0x1f')]('Content-Range',_0x441142+'-'+_0x1c1df7+'/'+_0xc64c2a)['json'](_0x1af727);}return null;};}function patchUpdates(_0x3a4512){return function(_0x427890){try{jsonpatch['apply'](_0x427890,_0x3a4512,!![]);}catch(_0x4e3e41){return BPromise[_0xdcf3('0x20')](_0x4e3e41);}return _0x427890['save']();};}function saveUpdates(_0x5622de,_0x71009c){return function(_0x273591){if(_0x273591){return _0x273591[_0xdcf3('0x21')](_0x5622de)['then'](function(_0x40b9f1){return _0x40b9f1;});}return null;};}function removeEntity(_0x4d340a,_0x2cc3ce){return function(_0x524ab0){if(_0x524ab0){return _0x524ab0[_0xdcf3('0x22')]()[_0xdcf3('0x23')](function(){_0x4d340a[_0xdcf3('0x1a')](0xcc)[_0xdcf3('0x24')]();});}};}function handleEntityNotFound(_0x5b6fc3,_0x16ea83){return function(_0x5c8557){if(!_0x5c8557){_0x5b6fc3[_0xdcf3('0x19')](0x194);}return _0x5c8557;};}function handleError(_0x3fbd96,_0x7df45){_0x7df45=_0x7df45||0x1f4;return function(_0x4c7412){logger['error'](_0x4c7412[_0xdcf3('0x25')]);if(_0x4c7412['name']){delete _0x4c7412['name'];}_0x3fbd96['status'](_0x7df45)['send'](_0x4c7412);};}exports[_0xdcf3('0x26')]=function(_0x4cd417,_0x3165a5){var _0x56964c={},_0x3b34a5={},_0x4cc17a={'count':0x0,'rows':[]};var _0x23a893=_[_0xdcf3('0x27')](db[_0xdcf3('0x28')][_0xdcf3('0x29')],function(_0x18a560){return{'name':_0x18a560[_0xdcf3('0x2a')],'type':_0x18a560[_0xdcf3('0x2b')][_0xdcf3('0x2c')]};});_0x3b34a5[_0xdcf3('0x2d')]=_[_0xdcf3('0x27')](_0x23a893,_0xdcf3('0x2e'));_0x3b34a5[_0xdcf3('0x2f')]=_['keys'](_0x4cd417[_0xdcf3('0x2f')]);_0x3b34a5[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],_0x3b34a5[_0xdcf3('0x2f')]);_0x56964c[_0xdcf3('0x32')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x4cd417['query'][_0xdcf3('0x33')]));_0x56964c['attributes']=_0x56964c[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x56964c[_0xdcf3('0x32')]:_0x3b34a5[_0xdcf3('0x2d')];if(!_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x35')]('nolimit')){_0x56964c[_0xdcf3('0x1c')]=qs[_0xdcf3('0x1c')](_0x4cd417['query'][_0xdcf3('0x1c')]);_0x56964c[_0xdcf3('0x1e')]=qs['offset'](_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x1e')]);}_0x56964c[_0xdcf3('0x36')]=qs[_0xdcf3('0x37')](_0x4cd417['query'][_0xdcf3('0x37')]);_0x56964c[_0xdcf3('0x38')]=qs['filters'](_['pick'](_0x4cd417['query'],_0x3b34a5[_0xdcf3('0x30')]),_0x23a893);if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x39')]){_0x56964c[_0xdcf3('0x38')]=_[_0xdcf3('0x3a')](_0x56964c[_0xdcf3('0x38')],{'$or':_[_0xdcf3('0x27')](_0x23a893,function(_0x321978){if(_0x321978[_0xdcf3('0x2b')]!=='VIRTUAL'){var _0x48d9bb={};_0x48d9bb[_0x321978[_0xdcf3('0x2e')]]={'$like':'%'+_0x4cd417['query'][_0xdcf3('0x39')]+'%'};return _0x48d9bb;}})});}_0x56964c=_[_0xdcf3('0x3a')]({},_0x56964c,_0x4cd417['options']);var _0x5ba362={'where':_0x56964c[_0xdcf3('0x38')]};return db['WhatsappApplication']['count'](_0x5ba362)[_0xdcf3('0x23')](function(_0x5b472c){_0x4cc17a[_0xdcf3('0x1d')]=_0x5b472c;if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x56964c['include']=[{'all':!![]}];}return db[_0xdcf3('0x28')][_0xdcf3('0x3c')](_0x56964c);})[_0xdcf3('0x23')](function(_0x169848){_0x4cc17a[_0xdcf3('0x3d')]=_0x169848;return _0x4cc17a;})[_0xdcf3('0x23')](respondWithFilteredResult(_0x3165a5,_0x56964c))[_0xdcf3('0x3e')](handleError(_0x3165a5,null));};exports['show']=function(_0x3a32c6,_0x2e2ba0){var _0x649485={'raw':!![],'where':{'id':_0x3a32c6[_0xdcf3('0x3f')]['id']}},_0x499c8e={};_0x499c8e[_0xdcf3('0x2d')]=_['keys'](db[_0xdcf3('0x28')][_0xdcf3('0x29')]);_0x499c8e['query']=_[_0xdcf3('0x40')](_0x3a32c6[_0xdcf3('0x2f')]);_0x499c8e[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x499c8e['model'],_0x499c8e[_0xdcf3('0x2f')]);_0x649485['attributes']=_[_0xdcf3('0x31')](_0x499c8e[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x33')]));_0x649485[_0xdcf3('0x32')]=_0x649485[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x649485['attributes']:_0x499c8e[_0xdcf3('0x2d')];if(_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x649485['include']=[{'all':!![]}];}_0x649485=_['merge']({},_0x649485,_0x3a32c6[_0xdcf3('0x41')]);return db[_0xdcf3('0x28')][_0xdcf3('0x42')](_0x649485)[_0xdcf3('0x23')](handleEntityNotFound(_0x2e2ba0,null))[_0xdcf3('0x23')](respondWithResult(_0x2e2ba0,null))['catch'](handleError(_0x2e2ba0,null));};exports[_0xdcf3('0x43')]=function(_0x51f4d4,_0x4ded3f){return db[_0xdcf3('0x28')][_0xdcf3('0x43')](_0x51f4d4[_0xdcf3('0x44')],{})[_0xdcf3('0x23')](respondWithResult(_0x4ded3f,0xc9))[_0xdcf3('0x3e')](handleError(_0x4ded3f,null));};exports[_0xdcf3('0x21')]=function(_0x48abd5,_0x1ebf31){if(_0x48abd5[_0xdcf3('0x44')]['id']){delete _0x48abd5[_0xdcf3('0x44')]['id'];}return db[_0xdcf3('0x28')]['find']({'where':{'id':_0x48abd5[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x1ebf31,null))[_0xdcf3('0x23')](saveUpdates(_0x48abd5[_0xdcf3('0x44')],null))[_0xdcf3('0x23')](respondWithResult(_0x1ebf31,null))[_0xdcf3('0x3e')](handleError(_0x1ebf31,null));};exports[_0xdcf3('0x22')]=function(_0x20cdbc,_0x7dded8){return db['WhatsappApplication']['find']({'where':{'id':_0x20cdbc[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x7dded8,null))[_0xdcf3('0x23')](removeEntity(_0x7dded8,null))['catch'](handleError(_0x7dded8,null));}; \ No newline at end of file +var _0xb91a=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x299a92,_0x39dd81){var _0x1cc51f=function(_0x248578){while(--_0x248578){_0x299a92['push'](_0x299a92['shift']());}};_0x1cc51f(++_0x39dd81);}(_0xb91a,0xe5));var _0xab91=function(_0x27b081,_0x47999d){_0x27b081=_0x27b081-0x0;var _0x32a462=_0xb91a[_0x27b081];return _0x32a462;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab91('0x0'));var zipdir=require(_0xab91('0x1'));var jsonpatch=require(_0xab91('0x2'));var rp=require(_0xab91('0x3'));var moment=require('moment');var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require('util');var path=require(_0xab91('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab91('0x7'));var fs=require('fs');var fs_extra=require(_0xab91('0x8'));var _=require('lodash');var squel=require(_0xab91('0x9'));var crypto=require(_0xab91('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xb'));var toCsv=require(_0xab91('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab91('0xd'));var qs=require(_0xab91('0xe'));var as=require(_0xab91('0xf'));var hardwareService=require(_0xab91('0x10'));var logger=require('../../config/logger')(_0xab91('0x11'));var utils=require(_0xab91('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xab91('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381007,_0x56295c){_0x56295c=_0x56295c||0xcc;return function(_0x4c74ad){if(_0x4c74ad){return _0x381007[_0xab91('0x14')](_0x56295c);}return _0x381007['status'](_0x56295c)[_0xab91('0x15')]();};}function respondWithResult(_0x3d7004,_0x2f22d6){_0x2f22d6=_0x2f22d6||0xc8;return function(_0x29fadc){if(_0x29fadc){return _0x3d7004[_0xab91('0x16')](_0x2f22d6)[_0xab91('0x17')](_0x29fadc);}};}function respondWithFilteredResult(_0x490325,_0x20896){return function(_0x52614f){if(_0x52614f){var _0x23c3d8=typeof _0x20896[_0xab91('0x18')]===_0xab91('0x19')&&typeof _0x20896[_0xab91('0x1a')]==='undefined';var _0x434dcd=_0x52614f[_0xab91('0x1b')];var _0x1ece47=_0x23c3d8?0x0:_0x20896['offset'];var _0x489ef5=_0x23c3d8?_0x52614f[_0xab91('0x1b')]:_0x20896[_0xab91('0x18')]+_0x20896[_0xab91('0x1a')];var _0x1f9fa9;if(_0x489ef5>=_0x434dcd){_0x489ef5=_0x434dcd;_0x1f9fa9=0xc8;}else{_0x1f9fa9=0xce;}_0x490325[_0xab91('0x16')](_0x1f9fa9);return _0x490325[_0xab91('0x1c')](_0xab91('0x1d'),_0x1ece47+'-'+_0x489ef5+'/'+_0x434dcd)[_0xab91('0x17')](_0x52614f);}return null;};}function patchUpdates(_0x3ed266){return function(_0x32f85e){try{jsonpatch['apply'](_0x32f85e,_0x3ed266,!![]);}catch(_0x25f2d3){return BPromise[_0xab91('0x1e')](_0x25f2d3);}return _0x32f85e[_0xab91('0x1f')]();};}function saveUpdates(_0x5006ce,_0x580d67){return function(_0xad9571){if(_0xad9571){return _0xad9571[_0xab91('0x20')](_0x5006ce)[_0xab91('0x21')](function(_0x5995de){return _0x5995de;});}return null;};}function removeEntity(_0x5ef7d3,_0x2d7a9f){return function(_0x5b0c6a){if(_0x5b0c6a){return _0x5b0c6a[_0xab91('0x22')]()['then'](function(){_0x5ef7d3['status'](0xcc)[_0xab91('0x15')]();});}};}function handleEntityNotFound(_0x43f334,_0x1a57e2){return function(_0x2a1e5e){if(!_0x2a1e5e){_0x43f334[_0xab91('0x14')](0x194);}return _0x2a1e5e;};}function handleError(_0x70e00e,_0x26c96f){_0x26c96f=_0x26c96f||0x1f4;return function(_0x17a1f3){logger['error'](_0x17a1f3[_0xab91('0x23')]);if(_0x17a1f3[_0xab91('0x24')]){delete _0x17a1f3[_0xab91('0x24')];}_0x70e00e[_0xab91('0x16')](_0x26c96f)['send'](_0x17a1f3);};}exports[_0xab91('0x25')]=function(_0x284270,_0x5ec525){var _0x59e66a={},_0x3e3a94={},_0x2d45c8={'count':0x0,'rows':[]};var _0x223df1=_[_0xab91('0x26')](db[_0xab91('0x27')][_0xab91('0x28')],function(_0x11cdd8){return{'name':_0x11cdd8[_0xab91('0x29')],'type':_0x11cdd8[_0xab91('0x2a')][_0xab91('0x2b')]};});_0x3e3a94[_0xab91('0x2c')]=_['map'](_0x223df1,_0xab91('0x24'));_0x3e3a94[_0xab91('0x2d')]=_['keys'](_0x284270[_0xab91('0x2d')]);_0x3e3a94[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x3e3a94['model'],_0x3e3a94[_0xab91('0x2d')]);_0x59e66a['attributes']=_[_0xab91('0x2f')](_0x3e3a94[_0xab91('0x2c')],qs['fields'](_0x284270[_0xab91('0x2d')][_0xab91('0x30')]));_0x59e66a['attributes']=_0x59e66a[_0xab91('0x31')][_0xab91('0x32')]?_0x59e66a[_0xab91('0x31')]:_0x3e3a94['model'];if(!_0x284270[_0xab91('0x2d')][_0xab91('0x33')]('nolimit')){_0x59e66a[_0xab91('0x1a')]=qs[_0xab91('0x1a')](_0x284270[_0xab91('0x2d')]['limit']);_0x59e66a['offset']=qs[_0xab91('0x18')](_0x284270['query']['offset']);}_0x59e66a[_0xab91('0x34')]=qs[_0xab91('0x35')](_0x284270['query'][_0xab91('0x35')]);_0x59e66a[_0xab91('0x36')]=qs[_0xab91('0x2e')](_[_0xab91('0x37')](_0x284270[_0xab91('0x2d')],_0x3e3a94[_0xab91('0x2e')]),_0x223df1);if(_0x284270['query'][_0xab91('0x38')]){_0x59e66a[_0xab91('0x36')]=_[_0xab91('0x39')](_0x59e66a[_0xab91('0x36')],{'$or':_[_0xab91('0x26')](_0x223df1,function(_0x2bcfb0){if(_0x2bcfb0[_0xab91('0x2a')]!=='VIRTUAL'){var _0x4fd11c={};_0x4fd11c[_0x2bcfb0[_0xab91('0x24')]]={'$like':'%'+_0x284270[_0xab91('0x2d')]['filter']+'%'};return _0x4fd11c;}})});}_0x59e66a=_['merge']({},_0x59e66a,_0x284270[_0xab91('0x3a')]);var _0x4e32cf={'where':_0x59e66a[_0xab91('0x36')]};return db['WhatsappApplication'][_0xab91('0x1b')](_0x4e32cf)[_0xab91('0x21')](function(_0x591192){_0x2d45c8['count']=_0x591192;if(_0x284270[_0xab91('0x2d')][_0xab91('0x3b')]){_0x59e66a['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x59e66a);})[_0xab91('0x21')](function(_0x2a2024){_0x2d45c8[_0xab91('0x3c')]=_0x2a2024;return _0x2d45c8;})['then'](respondWithFilteredResult(_0x5ec525,_0x59e66a))[_0xab91('0x3d')](handleError(_0x5ec525,null));};exports[_0xab91('0x3e')]=function(_0x4714cc,_0x20354d){var _0x1a2fdf={'raw':!![],'where':{'id':_0x4714cc[_0xab91('0x3f')]['id']}},_0x1a3bdf={};_0x1a3bdf[_0xab91('0x2c')]=_[_0xab91('0x40')](db[_0xab91('0x27')][_0xab91('0x28')]);_0x1a3bdf['query']=_[_0xab91('0x40')](_0x4714cc[_0xab91('0x2d')]);_0x1a3bdf[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x1a3bdf[_0xab91('0x2c')],_0x1a3bdf[_0xab91('0x2d')]);_0x1a2fdf[_0xab91('0x31')]=_[_0xab91('0x2f')](_0x1a3bdf[_0xab91('0x2c')],qs[_0xab91('0x30')](_0x4714cc[_0xab91('0x2d')][_0xab91('0x30')]));_0x1a2fdf[_0xab91('0x31')]=_0x1a2fdf['attributes'][_0xab91('0x32')]?_0x1a2fdf['attributes']:_0x1a3bdf['model'];if(_0x4714cc[_0xab91('0x2d')]['includeAll']){_0x1a2fdf[_0xab91('0x41')]=[{'all':!![]}];}_0x1a2fdf=_[_0xab91('0x39')]({},_0x1a2fdf,_0x4714cc[_0xab91('0x3a')]);return db[_0xab91('0x27')][_0xab91('0x42')](_0x1a2fdf)[_0xab91('0x21')](handleEntityNotFound(_0x20354d,null))['then'](respondWithResult(_0x20354d,null))[_0xab91('0x3d')](handleError(_0x20354d,null));};exports[_0xab91('0x43')]=function(_0x5dfbf9,_0x3bb98e){return db[_0xab91('0x27')][_0xab91('0x43')](_0x5dfbf9[_0xab91('0x44')],{})[_0xab91('0x21')](respondWithResult(_0x3bb98e,0xc9))[_0xab91('0x3d')](handleError(_0x3bb98e,null));};exports['update']=function(_0x5648ad,_0xb02842){if(_0x5648ad[_0xab91('0x44')]['id']){delete _0x5648ad['body']['id'];}return db[_0xab91('0x27')]['find']({'where':{'id':_0x5648ad[_0xab91('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb02842,null))[_0xab91('0x21')](saveUpdates(_0x5648ad[_0xab91('0x44')],null))[_0xab91('0x21')](respondWithResult(_0xb02842,null))[_0xab91('0x3d')](handleError(_0xb02842,null));};exports[_0xab91('0x22')]=function(_0xecec47,_0x279fbf){return db[_0xab91('0x27')]['find']({'where':{'id':_0xecec47[_0xab91('0x3f')]['id']}})[_0xab91('0x21')](handleEntityNotFound(_0x279fbf,null))[_0xab91('0x21')](removeEntity(_0x279fbf,null))['catch'](handleError(_0x279fbf,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3c1d838..2ebe87f 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 _0xf8b2=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x4bd07c,_0x1dac22){_0x4bd07c=_0x4bd07c-0x0;var _0x23f7fb=_0xf8b2[_0x4bd07c];return _0x23f7fb;};'use strict';var _=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var logger=require(_0x2f8b('0x2'))(_0x2f8b('0x3'));var moment=require(_0x2f8b('0x4'));var BPromise=require(_0x2f8b('0x5'));var rp=require(_0x2f8b('0x6'));var fs=require('fs');var path=require(_0x2f8b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f8b('0x8'));module[_0x2f8b('0x9')]=function(_0x3c6838,_0x1d133a){return _0x3c6838[_0x2f8b('0xa')](_0x2f8b('0xb'),attributes,{'tableName':_0x2f8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f8b('0xd'),'collate':_0x2f8b('0xe')});}; \ No newline at end of file +var _0x950a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0x16ddf6,_0x2d5206){_0x16ddf6=_0x16ddf6-0x0;var _0x102bd1=_0x950a[_0x16ddf6];return _0x102bd1;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa950('0xb'),'collate':_0xa950('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 552ef06..b6b7f2f 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x14d382,_0x54b6bd){var _0x31c6a7=function(_0xc9bb74){while(--_0xc9bb74){_0x14d382['push'](_0x14d382['shift']());}};_0x31c6a7(++_0x54b6bd);}(_0x81bd,0x7c));var _0xd81b=function(_0x3e74d4,_0xfeb53){_0x3e74d4=_0x3e74d4-0x0;var _0x38adee=_0x81bd[_0x3e74d4];return _0x38adee;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x2180bf,_0x2966f7){var _0x59ba39=function(_0x310a84){while(--_0x310a84){_0x2180bf['push'](_0x2180bf['shift']());}};_0x59ba39(++_0x2966f7);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xba9f86,_0x1e988b){_0xba9f86=_0xba9f86-0x0;var _0x2a25ce=_0xd0bb[_0xba9f86];return _0x2a25ce;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 328bf46..07de7fa 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 _0xfd20=['download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','exports','util','express','Router','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download'];(function(_0x49c4d1,_0x247d67){var _0xb7c65=function(_0xefd5c6){while(--_0xefd5c6){_0x49c4d1['push'](_0x49c4d1['shift']());}};_0xb7c65(++_0x247d67);}(_0xfd20,0x66));var _0x0fd2=function(_0x4645bd,_0x1ad4c){_0x4645bd=_0x4645bd-0x0;var _0x59ebbb=_0xfd20[_0x4645bd];return _0x59ebbb;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/describe',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0x6')]('/:id/messages',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xc')]);router['get'](_0x0fd2('0xd'),auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);router[_0x0fd2('0xf')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x10')]);router[_0x0fd2('0xf')](_0x0fd2('0x11'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x12')]);router['post']('/:id/tags',auth[_0x0fd2('0x7')](),interaction[_0x0fd2('0x13')](_0x0fd2('0x14'),_0x0fd2('0x15')),controller['addTags']);router[_0x0fd2('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x0fd2('0x13')]('whatsapp',_0x0fd2('0x17')),controller['update']);router[_0x0fd2('0x18')]('/:id',auth[_0x0fd2('0x7')](),interaction[_0x0fd2('0x13')]('whatsapp',_0x0fd2('0x19')),controller['destroy']);router[_0x0fd2('0x18')](_0x0fd2('0x1a'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x1b')]);module[_0x0fd2('0x1c')]=router; \ No newline at end of file +var _0xeff8=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1ac121,_0x42a7d0){var _0x2095db=function(_0x4c2d86){while(--_0x4c2d86){_0x1ac121['push'](_0x1ac121['shift']());}};_0x2095db(++_0x42a7d0);}(_0xeff8,0x186));var _0x8eff=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeff8[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['get'](_0x8eff('0x11'),auth[_0x8eff('0x9')](),controller['download']);router[_0x8eff('0x12')]('/',auth[_0x8eff('0x9')](),controller['create']);router['post'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x13')]);router[_0x8eff('0x12')](_0x8eff('0x14'),auth['isAuthenticated'](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x17')),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1a')),controller[_0x8eff('0x1b')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1c')),controller[_0x8eff('0x1d')]);router[_0x8eff('0x1e')](_0x8eff('0x14'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x1f')]);module[_0x8eff('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4aebdf8..496ea7a 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 _0xb6da=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x36fe1e,_0x175199){var _0x3368ef=function(_0x74679f){while(--_0x74679f){_0x36fe1e['push'](_0x36fe1e['shift']());}};_0x3368ef(++_0x175199);}(_0xb6da,0x8e));var _0xab6d=function(_0x18dd7c,_0x34b635){_0x18dd7c=_0x18dd7c-0x0;var _0x242330=_0xb6da[_0x18dd7c];return _0x242330;};'use strict';var Sequelize=require(_0xab6d('0x0'));var moment=require('moment');module[_0xab6d('0x1')]={'closed':{'type':Sequelize[_0xab6d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab6d('0x3')]},'disposition':{'type':Sequelize[_0xab6d('0x4')]},'secondDisposition':{'type':Sequelize[_0xab6d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xab6d('0x4')]},'note':{'type':Sequelize[_0xab6d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xab6d('0x5')]('in',_0xab6d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab6d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xab6d('0x5')]('in',_0xab6d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab6d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb875=['BOOLEAN','INTEGER','sequelize','DATE','STRING','ENUM','out'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xb875,0x167));var _0x5b87=function(_0x107b8b,_0x557977){_0x107b8b=_0x107b8b-0x0;var _0x22e56c=_0xb875[_0x107b8b];return _0x22e56c;};'use strict';var Sequelize=require(_0x5b87('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b87('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5b87('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5b87('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5b87('0x2')]},'read1stAt':{'type':Sequelize[_0x5b87('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x5b87('0x3')]('in',_0x5b87('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5b87('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5b87('0x3')]('in',_0x5b87('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5b87('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5b87('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4bb2409..64575d9 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 _0x2c2d=['show','keys','filters','intersection','model','attributes','length','includeAll','include','create','body','find','params','describe','addMessage','WhatsappMessage','ids','omit','fields','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','server','attachments','format','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','get','mkdirSync','Account','Owner','N.A.','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','catch'];(function(_0x20f08f,_0x1f5c99){var _0x447c65=function(_0x400987){while(--_0x400987){_0x20f08f['push'](_0x20f08f['shift']());}};_0x447c65(++_0x1f5c99);}(_0x2c2d,0x150));var _0xd2c2=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x2c2d[_0x599e60];return _0x468e19;};'use strict';var rimraf=require(_0xd2c2('0x0'));var zipdir=require(_0xd2c2('0x1'));var moment=require(_0xd2c2('0x2'));var BPromise=require(_0xd2c2('0x3'));var util=require('util');var path=require(_0xd2c2('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd2c2('0x5'));var Redis=require(_0xd2c2('0x6'));var interaction=require(_0xd2c2('0x7'));var qs=require(_0xd2c2('0x8'));var pdf=require(_0xd2c2('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xd2c2('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd2c2('0xb')](config['redis'],{'host':_0xd2c2('0xc'),'port':0x18eb});var socket=require(_0xd2c2('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xd2c2('0xe')](socket);function respondWithStatusCode(_0x261d36,_0x4c8365){_0x4c8365=_0x4c8365||0xcc;return function(_0x47e1b7){if(_0x47e1b7){return _0x261d36['sendStatus'](_0x4c8365);}return _0x261d36[_0xd2c2('0xf')](_0x4c8365)[_0xd2c2('0x10')]();};}function respondWithResult(_0x3a92de,_0x4ae938){_0x4ae938=_0x4ae938||0xc8;return function(_0x4834a6){if(_0x4834a6){return _0x3a92de['status'](_0x4ae938)[_0xd2c2('0x11')](_0x4834a6);}};}function respondWithFilteredResult(_0x4300de,_0x14d6a9){return function(_0x26f938){if(_0x26f938){var _0x2ad631=typeof _0x14d6a9[_0xd2c2('0x12')]===_0xd2c2('0x13')&&typeof _0x14d6a9[_0xd2c2('0x14')]===_0xd2c2('0x13');var _0x11a27e=_0x26f938[_0xd2c2('0x15')];var _0x4bc8ee=_0x2ad631?0x0:_0x14d6a9['offset'];var _0x2f5ae7=_0x2ad631?_0x26f938['count']:_0x14d6a9['offset']+_0x14d6a9[_0xd2c2('0x14')];var _0x17aa09;if(_0x2f5ae7>=_0x11a27e){_0x2f5ae7=_0x11a27e;_0x17aa09=0xc8;}else{_0x17aa09=0xce;}_0x4300de[_0xd2c2('0xf')](_0x17aa09);return _0x4300de[_0xd2c2('0x16')](_0xd2c2('0x17'),_0x4bc8ee+'-'+_0x2f5ae7+'/'+_0x11a27e)[_0xd2c2('0x11')](_0x26f938);}return null;};}function saveUpdates(_0x34ea45){return function(_0x272006){if(_0x272006){return _0x272006[_0xd2c2('0x18')](_0x34ea45)[_0xd2c2('0x19')](function(_0x261b38){return _0x261b38;});}return null;};}function removeEntity(_0xf57f09){return function(_0x4bfdda){if(_0x4bfdda){return _0x4bfdda[_0xd2c2('0x1a')]()['then'](function(){_0xf57f09[_0xd2c2('0xf')](0xcc)[_0xd2c2('0x10')]();});}};}function handleEntityNotFound(_0x1b51eb){return function(_0x36577e){if(!_0x36577e){_0x1b51eb[_0xd2c2('0x1b')](0x194);}return _0x36577e;};}function handleError(_0x54597b,_0x19c0d0){_0x19c0d0=_0x19c0d0||0x1f4;return function(_0x4103a6){logger[_0xd2c2('0x1c')](_0x4103a6['stack']);if(_0x4103a6[_0xd2c2('0x1d')]){delete _0x4103a6[_0xd2c2('0x1d')];}_0x54597b[_0xd2c2('0xf')](_0x19c0d0)[_0xd2c2('0x1e')](_0x4103a6);};}exports[_0xd2c2('0x1f')]=function(_0x1e00f4,_0x446654){var _0x509701={};var _0x215298=_[_0xd2c2('0x20')](db[_0xd2c2('0x21')][_0xd2c2('0x22')],function(_0x52eb03){return{'name':_0x52eb03['fieldName'],'type':_0x52eb03[_0xd2c2('0x23')][_0xd2c2('0x24')]};});_0x509701=qs[_0xd2c2('0x25')](_0x215298,_0x1e00f4);return interaction[_0xd2c2('0x26')](_0xd2c2('0x27'),_0x1e00f4[_0xd2c2('0x28')],_0x1e00f4['user'],_0x509701,_0x215298)[_0xd2c2('0x19')](respondWithFilteredResult(_0x446654,_0x509701))[_0xd2c2('0x29')](handleError(_0x446654,null));};exports[_0xd2c2('0x2a')]=function(_0x42e2c6,_0x7e1efa){var _0x140826={'raw':![],'where':{'id':_0x42e2c6['params']['id']}},_0x1762ef={};_0x1762ef['model']=_[_0xd2c2('0x2b')](db[_0xd2c2('0x21')]['rawAttributes']);_0x1762ef['query']=_['keys'](_0x42e2c6[_0xd2c2('0x28')]);_0x1762ef[_0xd2c2('0x2c')]=_[_0xd2c2('0x2d')](_0x1762ef[_0xd2c2('0x2e')],_0x1762ef['query']);_0x140826[_0xd2c2('0x2f')]=_[_0xd2c2('0x2d')](_0x1762ef[_0xd2c2('0x2e')],qs['fields'](_0x42e2c6['query']['fields']));_0x140826[_0xd2c2('0x2f')]=_0x140826[_0xd2c2('0x2f')][_0xd2c2('0x30')]?_0x140826[_0xd2c2('0x2f')]:_0x1762ef[_0xd2c2('0x2e')];if(_0x42e2c6[_0xd2c2('0x28')][_0xd2c2('0x31')]){_0x140826[_0xd2c2('0x32')]=[{'all':!![]}];}_0x140826=_['merge']({},_0x140826,_0x42e2c6['options']);return db[_0xd2c2('0x21')]['find'](_0x140826)['then'](handleEntityNotFound(_0x7e1efa,null))[_0xd2c2('0x19')](respondWithResult(_0x7e1efa,null))[_0xd2c2('0x29')](handleError(_0x7e1efa,null));};exports[_0xd2c2('0x33')]=function(_0x5e7d81,_0xb76df){return db['WhatsappInteraction'][_0xd2c2('0x33')](_0x5e7d81['body'],{})[_0xd2c2('0x19')](respondWithResult(_0xb76df,0xc9))['catch'](handleError(_0xb76df,null));};exports[_0xd2c2('0x18')]=function(_0x518e40,_0x8f540b){if(_0x518e40[_0xd2c2('0x34')]['id']){delete _0x518e40[_0xd2c2('0x34')]['id'];}return db[_0xd2c2('0x21')][_0xd2c2('0x35')]({'where':{'id':_0x518e40[_0xd2c2('0x36')]['id']}})[_0xd2c2('0x19')](handleEntityNotFound(_0x8f540b,null))[_0xd2c2('0x19')](saveUpdates(_0x518e40['body'],null))[_0xd2c2('0x19')](respondWithResult(_0x8f540b,null))['catch'](handleError(_0x8f540b,null));};exports[_0xd2c2('0x1a')]=function(_0x1ecfcb,_0x27fc64){return db[_0xd2c2('0x21')][_0xd2c2('0x35')]({'where':{'id':_0x1ecfcb[_0xd2c2('0x36')]['id']}})[_0xd2c2('0x19')](handleEntityNotFound(_0x27fc64,null))[_0xd2c2('0x19')](removeEntity(_0x27fc64,null))[_0xd2c2('0x29')](handleError(_0x27fc64,null));};exports[_0xd2c2('0x37')]=function(_0x1c2cc9,_0x30269e){return db['WhatsappInteraction']['describe']()[_0xd2c2('0x19')](respondWithResult(_0x30269e,null))['catch'](handleError(_0x30269e,null));};exports[_0xd2c2('0x38')]=function(_0x18dd39,_0x5e9a09){return db[_0xd2c2('0x39')]['find']({'where':{'id':_0x18dd39[_0xd2c2('0x36')]['id']}})[_0xd2c2('0x19')](handleEntityNotFound(_0x5e9a09,null))[_0xd2c2('0x19')](function(_0x5b58df){if(_0x5b58df){return _0x5b58df[_0xd2c2('0x38')](_0x18dd39[_0xd2c2('0x34')][_0xd2c2('0x3a')],_[_0xd2c2('0x3b')](_0x18dd39['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5e9a09,null))[_0xd2c2('0x29')](handleError(_0x5e9a09,null));};exports['getMessages']=function(_0x46310f,_0x46f76d){var _0x306bfa={'raw':![],'where':{}};var _0x1c135e={};var _0x51e139={'count':0x0,'rows':[]};return db[_0xd2c2('0x21')]['findOne']({'where':{'id':_0x46310f[_0xd2c2('0x36')]['id']}})[_0xd2c2('0x19')](handleEntityNotFound(_0x46f76d,null))['then'](function(_0x27a2e6){if(_0x27a2e6){_0x1c135e['model']=_['keys'](db[_0xd2c2('0x39')][_0xd2c2('0x22')]);_0x1c135e[_0xd2c2('0x28')]=_['keys'](_0x46310f[_0xd2c2('0x28')]);_0x1c135e['filters']=_[_0xd2c2('0x2d')](_0x1c135e[_0xd2c2('0x2e')],_0x1c135e[_0xd2c2('0x28')]);_0x306bfa['attributes']=_['intersection'](_0x1c135e[_0xd2c2('0x2e')],qs[_0xd2c2('0x3c')](_0x46310f['query'][_0xd2c2('0x3c')]));_0x306bfa['attributes']=_0x306bfa[_0xd2c2('0x2f')][_0xd2c2('0x30')]?_0x306bfa[_0xd2c2('0x2f')]:_0x1c135e[_0xd2c2('0x2e')];if(!_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x3d')](_0xd2c2('0x3e'))){_0x306bfa[_0xd2c2('0x14')]=qs[_0xd2c2('0x14')](_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x14')]);_0x306bfa['offset']=qs[_0xd2c2('0x12')](_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x12')]);}_0x306bfa[_0xd2c2('0x3f')]=qs[_0xd2c2('0x40')](_0x46310f['query'][_0xd2c2('0x40')]);_0x306bfa[_0xd2c2('0x41')]=qs[_0xd2c2('0x2c')](_['pick'](_0x46310f[_0xd2c2('0x28')],_0x1c135e[_0xd2c2('0x2c')]));_0x306bfa[_0xd2c2('0x41')][_0xd2c2('0x42')]=_0x27a2e6['id'];if(_0x46310f['query'][_0xd2c2('0x43')]){_0x306bfa[_0xd2c2('0x41')]=_[_0xd2c2('0x44')](_0x306bfa[_0xd2c2('0x41')],{'$or':_[_0xd2c2('0x20')](_0x306bfa['attributes'],function(_0x7bfe65){var _0x806d63={};_0x806d63[_0x7bfe65]={'$like':'%'+_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x43')]+'%'};return _0x806d63;})});}if(_0x46310f['query'][_0xd2c2('0x45')]){var _0x2bf415=_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x45')][_0xd2c2('0x46')](',');var _0x1d0563={};_0x1d0563[_0x2bf415[0x0]]={'$gte':moment(_0x2bf415[0x1])['format'](_0xd2c2('0x47'))};_0x306bfa[_0xd2c2('0x41')]=_['merge'](_0x306bfa[_0xd2c2('0x41')],_0x1d0563);}_0x306bfa=_[_0xd2c2('0x44')]({},_0x306bfa,_0x46310f['options']);return db[_0xd2c2('0x39')]['count']({'where':_0x306bfa[_0xd2c2('0x41')]})['then'](function(_0xb7b81c){_0x51e139[_0xd2c2('0x15')]=_0xb7b81c;if(_0x46310f[_0xd2c2('0x28')][_0xd2c2('0x31')]){_0x306bfa[_0xd2c2('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd2c2('0x26')](_0x306bfa);})['then'](function(_0x59b601){_0x51e139[_0xd2c2('0x48')]=_0x59b601;return _0x51e139;});}})[_0xd2c2('0x19')](respondWithFilteredResult(_0x46f76d,_0x306bfa))[_0xd2c2('0x29')](handleError(_0x46f76d,null));};exports[_0xd2c2('0x49')]=function(_0x328ccb,_0x58e76c){return db[_0xd2c2('0x21')][_0xd2c2('0x35')]({'where':{'id':_0x328ccb[_0xd2c2('0x36')]['id']}})[_0xd2c2('0x19')](handleEntityNotFound(_0x58e76c,null))[_0xd2c2('0x19')](function(_0x412fd6){if(_0x412fd6){return _0x412fd6[_0xd2c2('0x4a')](_0x328ccb['body']['ids'],_[_0xd2c2('0x3b')](_0x328ccb['body'],['ids','id'])||{})['spread'](function(){return db[_0xd2c2('0x4b')][_0xd2c2('0x26')]({'attributes':['id',_0xd2c2('0x1d'),_0xd2c2('0x4c')],'where':{'id':_0x328ccb[_0xd2c2('0x34')]['ids']}});})['then'](function(_0x1f6698){socket[_0xd2c2('0x4d')](_0xd2c2('0x4e'),{'id':Number(_0x328ccb['params']['id']),'tags':_0x1f6698||[]});return{'id':Number(_0x328ccb[_0xd2c2('0x36')]['id']),'tags':_0x1f6698||[]};});}})[_0xd2c2('0x19')](respondWithResult(_0x58e76c,null))['catch'](handleError(_0x58e76c,null));};exports[_0xd2c2('0x4f')]=function(_0x1166e9,_0x47f100){return db[_0xd2c2('0x21')][_0xd2c2('0x35')]({'where':{'id':_0x1166e9[_0xd2c2('0x36')]['id']}})['then'](handleEntityNotFound(_0x47f100,null))[_0xd2c2('0x19')](function(_0x44c98a){if(_0x44c98a){return _0x44c98a[_0xd2c2('0x4f')](_0x1166e9[_0xd2c2('0x28')][_0xd2c2('0x3a')]);}})[_0xd2c2('0x19')](respondWithStatusCode(_0x47f100,null))[_0xd2c2('0x29')](handleError(_0x47f100,null));};exports[_0xd2c2('0x50')]=function(_0xe8f77d,_0x5ae991){var _0x4086ab=moment()[_0xd2c2('0x51')]()[_0xd2c2('0x52')]();var _0x2a920d=path[_0xd2c2('0x53')](config[_0xd2c2('0x54')],'server','files',_0xd2c2('0x55'));var _0x3e4e28=path[_0xd2c2('0x53')](config[_0xd2c2('0x54')],_0xd2c2('0x56'),'files',_0xd2c2('0x57'));var _0x122a06=path['join'](_0x2a920d,_0x4086ab);var _0x120390=util[_0xd2c2('0x58')](_0xd2c2('0x59'),_0xe8f77d[_0xd2c2('0x36')]['id'],_0x4086ab);var _0x5233ea=path[_0xd2c2('0x53')](_0x2a920d,_0x120390);var _0x41db01=[];_0x41db01['push']({'model':db['User'],'as':_0xd2c2('0x5a'),'attributes':['id',_0xd2c2('0x5b')],'raw':!![]});_0x41db01[_0xd2c2('0x5c')]({'model':db['CmContact'],'as':_0xd2c2('0x5d'),'attributes':['id',_0xd2c2('0x5e'),'lastName'],'raw':!![]});if(_0xe8f77d[_0xd2c2('0x28')][_0xd2c2('0x57')]){_0x41db01['push']({'model':db[_0xd2c2('0x5f')],'as':_0xd2c2('0x5f'),'raw':!![]});}var _0x35a384=[{'model':db[_0xd2c2('0x39')],'as':_0xd2c2('0x60'),'attributes':['id','body',_0xd2c2('0x61'),_0xd2c2('0x62'),_0xd2c2('0x63'),_0xd2c2('0x64')],'include':_0x41db01}];_0x35a384['push']({'model':db[_0xd2c2('0x65')],'as':'Account','attributes':['id','name']});_0x35a384[_0xd2c2('0x5c')]({'model':db[_0xd2c2('0x5a')],'as':'Owner','attributes':['id',_0xd2c2('0x5b')]});return db[_0xd2c2('0x21')]['find']({'where':{'id':_0xe8f77d[_0xd2c2('0x36')]['id']},'include':_0x35a384})[_0xd2c2('0x19')](handleEntityNotFound(_0x5ae991,null))['then'](function(_0x535d2f){if(_0x535d2f){var _0x50dd66=_0x535d2f[_0xd2c2('0x66')]({'plain':!![]});fs[_0xd2c2('0x67')](_0x122a06);var _0x20761f={'channel':'Whatsapp','account':_0x50dd66[_0xd2c2('0x68')][_0xd2c2('0x1d')],'agent':_0x50dd66[_0xd2c2('0x69')]?_0x50dd66['Owner'][_0xd2c2('0x5b')]:_0xd2c2('0x6a'),'createdAt':moment(_0x50dd66[_0xd2c2('0x61')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x50dd66[_0xd2c2('0x6b')]?moment(_0x50dd66[_0xd2c2('0x6c')])[_0xd2c2('0x58')](_0xd2c2('0x47'))[_0xd2c2('0x52')]():'','disposition':_0x50dd66[_0xd2c2('0x6d')],'messages':_(_0x50dd66[_0xd2c2('0x60')])['filter']({'secret':![]})['map'](function(_0x1ba01f){if(_0x1ba01f[_0xd2c2('0x5f')]){var _0x3ace58=path['join'](_0x3e4e28,_0x1ba01f[_0xd2c2('0x5f')]['basename']);if(fs[_0xd2c2('0x6e')](_0x3ace58)){fs[_0xd2c2('0x6f')](_0x3ace58)[_0xd2c2('0x70')](fs[_0xd2c2('0x71')](path[_0xd2c2('0x53')](_0x122a06,_0x1ba01f[_0xd2c2('0x5f')][_0xd2c2('0x72')])));}}return{'date':moment(_0x1ba01f[_0xd2c2('0x61')])[_0xd2c2('0x58')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd2c2('0x52')](),'sender':_0x1ba01f['direction']===_0xd2c2('0x73')?_0x1ba01f['User']?_0x1ba01f['User'][_0xd2c2('0x5b')]:_0xd2c2('0x74'):_0x1ba01f['Contact'][_0xd2c2('0x5e')]+(_0x1ba01f[_0xd2c2('0x5d')][_0xd2c2('0x75')]?'\x20'+_0x1ba01f[_0xd2c2('0x5d')]['lastName']:''),'body':_0x1ba01f['Attachment']?_0x1ba01f[_0xd2c2('0x5f')][_0xd2c2('0x72')]:_0x1ba01f['body'],'direction':_0x1ba01f['direction']==='out'?'A':'C','secret':_0x1ba01f['secret'],'read':_0x1ba01f[_0xd2c2('0x64')],'attachment':_0x1ba01f[_0xd2c2('0x5f')]};})['value']()};return ejs[_0xd2c2('0x76')](path[_0xd2c2('0x53')](config[_0xd2c2('0x54')],'server','views',_0xd2c2('0x77')),{'interaction':_0x20761f})[_0xd2c2('0x19')](function(_0x2b2b12){var _0x2f7b10=path[_0xd2c2('0x53')](_0x122a06,_0xd2c2('0x78')+_0x50dd66['id']+'-'+_0x4086ab+_0xd2c2('0x79'));var _0x365989={'path':_0x2f7b10,'channel':_0xd2c2('0x7a'),'interactionId':_0x50dd66['id']};return pdf[_0xd2c2('0x7b')](_0x2b2b12,_0x365989);})[_0xd2c2('0x19')](function(){return new BPromise(function(_0x4e6d87,_0x1d66fb){zipdir(_0x122a06,{'saveTo':_0x5233ea},function(_0x2fbfb1,_0x586439){if(_0x2fbfb1)return _0x1d66fb(_0x2fbfb1);return _0x4e6d87(_0x586439);});})[_0xd2c2('0x19')](function(){return new BPromise(function(_0xc82f51,_0x3e7d7e){rimraf(_0x122a06,function(_0x3157ad){if(_0x3157ad)_0x3e7d7e(_0x3157ad);return _0xc82f51();});});})[_0xd2c2('0x19')](function(){return _0x5ae991[_0xd2c2('0x50')](_0x5233ea,_0x120390,function(_0x571935){if(_0x571935){console[_0xd2c2('0x7c')](_0xd2c2('0x7d'),_0x571935);}else{fs['unlinkSync'](_0x5233ea);}});});});}else{return _0x5ae991['sendStatus'](0xc8);}})[_0xd2c2('0x29')](handleError(_0x5ae991,null));}; \ No newline at end of file +var _0x4cea=['setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','attachments','join','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','fullname','mkdirSync','Whatsapp','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','status','end','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','map','WhatsappInteraction','rawAttributes','type','key','findAll','whatsapp','query','user','catch','show','model','keys','intersection','attributes','length','include','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','filters','fields','hasOwnProperty','nolimit','order','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0x4cea,0x13c));var _0xa4ce=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4cea[_0x2c91e9];return _0x13f0ff;};'use strict';var rimraf=require(_0xa4ce('0x0'));var zipdir=require(_0xa4ce('0x1'));var moment=require(_0xa4ce('0x2'));var BPromise=require(_0xa4ce('0x3'));var util=require(_0xa4ce('0x4'));var path=require(_0xa4ce('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa4ce('0x6'));var Redis=require('ioredis');var interaction=require(_0xa4ce('0x7'));var qs=require(_0xa4ce('0x8'));var pdf=require(_0xa4ce('0x9'));var logger=require(_0xa4ce('0xa'))(_0xa4ce('0xb'));var config=require(_0xa4ce('0xc'));var db=require(_0xa4ce('0xd'))['db'];config['redis']=_[_0xa4ce('0xe')](config['redis'],{'host':_0xa4ce('0xf'),'port':0x18eb});var socket=require(_0xa4ce('0x10'))(new Redis(config[_0xa4ce('0x11')]));require(_0xa4ce('0x12'))['register'](socket);function respondWithStatusCode(_0x3f7846,_0x87597a){_0x87597a=_0x87597a||0xcc;return function(_0x35e5f4){if(_0x35e5f4){return _0x3f7846['sendStatus'](_0x87597a);}return _0x3f7846[_0xa4ce('0x13')](_0x87597a)[_0xa4ce('0x14')]();};}function respondWithResult(_0x3ed3eb,_0x5a0c85){_0x5a0c85=_0x5a0c85||0xc8;return function(_0x4e0fa8){if(_0x4e0fa8){return _0x3ed3eb[_0xa4ce('0x13')](_0x5a0c85)[_0xa4ce('0x15')](_0x4e0fa8);}};}function respondWithFilteredResult(_0x4c7196,_0x424d49){return function(_0x29507e){if(_0x29507e){var _0x3fa15f=typeof _0x424d49['offset']===_0xa4ce('0x16')&&typeof _0x424d49['limit']==='undefined';var _0x31d1f0=_0x29507e['count'];var _0x47dd86=_0x3fa15f?0x0:_0x424d49[_0xa4ce('0x17')];var _0x11a12a=_0x3fa15f?_0x29507e[_0xa4ce('0x18')]:_0x424d49[_0xa4ce('0x17')]+_0x424d49[_0xa4ce('0x19')];var _0x144643;if(_0x11a12a>=_0x31d1f0){_0x11a12a=_0x31d1f0;_0x144643=0xc8;}else{_0x144643=0xce;}_0x4c7196[_0xa4ce('0x13')](_0x144643);return _0x4c7196[_0xa4ce('0x1a')](_0xa4ce('0x1b'),_0x47dd86+'-'+_0x11a12a+'/'+_0x31d1f0)[_0xa4ce('0x15')](_0x29507e);}return null;};}function saveUpdates(_0x3370eb){return function(_0x133fff){if(_0x133fff){return _0x133fff[_0xa4ce('0x1c')](_0x3370eb)[_0xa4ce('0x1d')](function(_0x4d0c06){return _0x4d0c06;});}return null;};}function removeEntity(_0xeeca20){return function(_0xae136b){if(_0xae136b){return _0xae136b[_0xa4ce('0x1e')]()['then'](function(){_0xeeca20['status'](0xcc)[_0xa4ce('0x14')]();});}};}function handleEntityNotFound(_0x4976ca){return function(_0x253e0c){if(!_0x253e0c){_0x4976ca[_0xa4ce('0x1f')](0x194);}return _0x253e0c;};}function handleError(_0x46be8c,_0x3e6561){_0x3e6561=_0x3e6561||0x1f4;return function(_0x583f94){logger[_0xa4ce('0x20')](_0x583f94[_0xa4ce('0x21')]);if(_0x583f94[_0xa4ce('0x22')]){delete _0x583f94[_0xa4ce('0x22')];}_0x46be8c[_0xa4ce('0x13')](_0x3e6561)['send'](_0x583f94);};}exports['index']=function(_0x3631db,_0x271895){var _0x2c608b={};var _0xeff199=_[_0xa4ce('0x23')](db[_0xa4ce('0x24')][_0xa4ce('0x25')],function(_0x766a86){return{'name':_0x766a86['fieldName'],'type':_0x766a86[_0xa4ce('0x26')][_0xa4ce('0x27')]};});_0x2c608b=qs['getOptions'](_0xeff199,_0x3631db);return interaction[_0xa4ce('0x28')](_0xa4ce('0x29'),_0x3631db[_0xa4ce('0x2a')],_0x3631db[_0xa4ce('0x2b')],_0x2c608b,_0xeff199)[_0xa4ce('0x1d')](respondWithFilteredResult(_0x271895,_0x2c608b))[_0xa4ce('0x2c')](handleError(_0x271895,null));};exports[_0xa4ce('0x2d')]=function(_0x35ab8f,_0x49308e){var _0x15d543={'raw':![],'where':{'id':_0x35ab8f['params']['id']}},_0x4ce58c={};_0x4ce58c[_0xa4ce('0x2e')]=_[_0xa4ce('0x2f')](db[_0xa4ce('0x24')][_0xa4ce('0x25')]);_0x4ce58c[_0xa4ce('0x2a')]=_[_0xa4ce('0x2f')](_0x35ab8f[_0xa4ce('0x2a')]);_0x4ce58c['filters']=_[_0xa4ce('0x30')](_0x4ce58c[_0xa4ce('0x2e')],_0x4ce58c[_0xa4ce('0x2a')]);_0x15d543[_0xa4ce('0x31')]=_[_0xa4ce('0x30')](_0x4ce58c[_0xa4ce('0x2e')],qs['fields'](_0x35ab8f['query']['fields']));_0x15d543['attributes']=_0x15d543[_0xa4ce('0x31')][_0xa4ce('0x32')]?_0x15d543[_0xa4ce('0x31')]:_0x4ce58c[_0xa4ce('0x2e')];if(_0x35ab8f[_0xa4ce('0x2a')]['includeAll']){_0x15d543[_0xa4ce('0x33')]=[{'all':!![]}];}_0x15d543=_[_0xa4ce('0x34')]({},_0x15d543,_0x35ab8f[_0xa4ce('0x35')]);return db[_0xa4ce('0x24')][_0xa4ce('0x36')](_0x15d543)['then'](handleEntityNotFound(_0x49308e,null))[_0xa4ce('0x1d')](respondWithResult(_0x49308e,null))[_0xa4ce('0x2c')](handleError(_0x49308e,null));};exports[_0xa4ce('0x37')]=function(_0x584274,_0x7310d9){return db[_0xa4ce('0x24')][_0xa4ce('0x37')](_0x584274['body'],{})['then'](respondWithResult(_0x7310d9,0xc9))[_0xa4ce('0x2c')](handleError(_0x7310d9,null));};exports['update']=function(_0x24f43c,_0x379808){if(_0x24f43c[_0xa4ce('0x38')]['id']){delete _0x24f43c[_0xa4ce('0x38')]['id'];}return db[_0xa4ce('0x24')]['find']({'where':{'id':_0x24f43c[_0xa4ce('0x39')]['id']}})[_0xa4ce('0x1d')](handleEntityNotFound(_0x379808,null))['then'](saveUpdates(_0x24f43c[_0xa4ce('0x38')],null))[_0xa4ce('0x1d')](respondWithResult(_0x379808,null))[_0xa4ce('0x2c')](handleError(_0x379808,null));};exports[_0xa4ce('0x1e')]=function(_0x16d74d,_0x6feb9e){return db[_0xa4ce('0x24')][_0xa4ce('0x36')]({'where':{'id':_0x16d74d['params']['id']}})[_0xa4ce('0x1d')](handleEntityNotFound(_0x6feb9e,null))[_0xa4ce('0x1d')](removeEntity(_0x6feb9e,null))[_0xa4ce('0x2c')](handleError(_0x6feb9e,null));};exports[_0xa4ce('0x3a')]=function(_0x30b8b2,_0x31faa7){return db[_0xa4ce('0x24')][_0xa4ce('0x3a')]()[_0xa4ce('0x1d')](respondWithResult(_0x31faa7,null))[_0xa4ce('0x2c')](handleError(_0x31faa7,null));};exports[_0xa4ce('0x3b')]=function(_0x5da502,_0x16f6ba){return db[_0xa4ce('0x3c')][_0xa4ce('0x36')]({'where':{'id':_0x5da502[_0xa4ce('0x39')]['id']}})['then'](handleEntityNotFound(_0x16f6ba,null))[_0xa4ce('0x1d')](function(_0x3c20ec){if(_0x3c20ec){return _0x3c20ec[_0xa4ce('0x3b')](_0x5da502[_0xa4ce('0x38')]['ids'],_[_0xa4ce('0x3d')](_0x5da502[_0xa4ce('0x38')],[_0xa4ce('0x3e'),'id'])||{});}})[_0xa4ce('0x1d')](respondWithResult(_0x16f6ba,null))[_0xa4ce('0x2c')](handleError(_0x16f6ba,null));};exports[_0xa4ce('0x3f')]=function(_0x1c8e92,_0xd56640){var _0xe42b29={'raw':![],'where':{}};var _0x198db2={};var _0x4d1810={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xa4ce('0x40')]({'where':{'id':_0x1c8e92[_0xa4ce('0x39')]['id']}})['then'](handleEntityNotFound(_0xd56640,null))[_0xa4ce('0x1d')](function(_0x391cd5){if(_0x391cd5){_0x198db2['model']=_[_0xa4ce('0x2f')](db[_0xa4ce('0x3c')][_0xa4ce('0x25')]);_0x198db2[_0xa4ce('0x2a')]=_[_0xa4ce('0x2f')](_0x1c8e92[_0xa4ce('0x2a')]);_0x198db2[_0xa4ce('0x41')]=_[_0xa4ce('0x30')](_0x198db2[_0xa4ce('0x2e')],_0x198db2['query']);_0xe42b29[_0xa4ce('0x31')]=_[_0xa4ce('0x30')](_0x198db2[_0xa4ce('0x2e')],qs['fields'](_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x42')]));_0xe42b29[_0xa4ce('0x31')]=_0xe42b29[_0xa4ce('0x31')][_0xa4ce('0x32')]?_0xe42b29[_0xa4ce('0x31')]:_0x198db2[_0xa4ce('0x2e')];if(!_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x43')](_0xa4ce('0x44'))){_0xe42b29[_0xa4ce('0x19')]=qs[_0xa4ce('0x19')](_0x1c8e92[_0xa4ce('0x2a')]['limit']);_0xe42b29[_0xa4ce('0x17')]=qs['offset'](_0x1c8e92[_0xa4ce('0x2a')]['offset']);}_0xe42b29[_0xa4ce('0x45')]=qs['sort'](_0x1c8e92[_0xa4ce('0x2a')]['sort']);_0xe42b29[_0xa4ce('0x46')]=qs[_0xa4ce('0x41')](_[_0xa4ce('0x47')](_0x1c8e92['query'],_0x198db2[_0xa4ce('0x41')]));_0xe42b29[_0xa4ce('0x46')][_0xa4ce('0x48')]=_0x391cd5['id'];if(_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x49')]){_0xe42b29[_0xa4ce('0x46')]=_['merge'](_0xe42b29[_0xa4ce('0x46')],{'$or':_[_0xa4ce('0x23')](_0xe42b29['attributes'],function(_0x7248fc){var _0x27a9d0={};_0x27a9d0[_0x7248fc]={'$like':'%'+_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x49')]+'%'};return _0x27a9d0;})});}if(_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x4a')]){var _0x399d04=_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x4a')][_0xa4ce('0x4b')](',');var _0x46bc3d={};_0x46bc3d[_0x399d04[0x0]]={'$gte':moment(_0x399d04[0x1])[_0xa4ce('0x4c')](_0xa4ce('0x4d'))};_0xe42b29[_0xa4ce('0x46')]=_['merge'](_0xe42b29['where'],_0x46bc3d);}_0xe42b29=_[_0xa4ce('0x34')]({},_0xe42b29,_0x1c8e92['options']);return db[_0xa4ce('0x3c')]['count']({'where':_0xe42b29[_0xa4ce('0x46')]})[_0xa4ce('0x1d')](function(_0x153cfd){_0x4d1810[_0xa4ce('0x18')]=_0x153cfd;if(_0x1c8e92[_0xa4ce('0x2a')][_0xa4ce('0x4e')]){_0xe42b29[_0xa4ce('0x33')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xa4ce('0x28')](_0xe42b29);})[_0xa4ce('0x1d')](function(_0x268873){_0x4d1810[_0xa4ce('0x4f')]=_0x268873;return _0x4d1810;});}})[_0xa4ce('0x1d')](respondWithFilteredResult(_0xd56640,_0xe42b29))[_0xa4ce('0x2c')](handleError(_0xd56640,null));};exports['addTags']=function(_0x58b225,_0x2f1d2c){return db[_0xa4ce('0x24')]['find']({'where':{'id':_0x58b225['params']['id']}})[_0xa4ce('0x1d')](handleEntityNotFound(_0x2f1d2c,null))['then'](function(_0x484f40){if(_0x484f40){return _0x484f40[_0xa4ce('0x50')](_0x58b225[_0xa4ce('0x38')]['ids'],_[_0xa4ce('0x3d')](_0x58b225['body'],['ids','id'])||{})[_0xa4ce('0x51')](function(){return db[_0xa4ce('0x52')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x58b225[_0xa4ce('0x38')][_0xa4ce('0x3e')]}});})[_0xa4ce('0x1d')](function(_0xff57a0){socket[_0xa4ce('0x53')](_0xa4ce('0x54'),{'id':Number(_0x58b225[_0xa4ce('0x39')]['id']),'tags':_0xff57a0||[]});return{'id':Number(_0x58b225[_0xa4ce('0x39')]['id']),'tags':_0xff57a0||[]};});}})[_0xa4ce('0x1d')](respondWithResult(_0x2f1d2c,null))['catch'](handleError(_0x2f1d2c,null));};exports[_0xa4ce('0x55')]=function(_0x372b5f,_0x5b88a2){return db['WhatsappInteraction'][_0xa4ce('0x36')]({'where':{'id':_0x372b5f['params']['id']}})[_0xa4ce('0x1d')](handleEntityNotFound(_0x5b88a2,null))[_0xa4ce('0x1d')](function(_0x2795e5){if(_0x2795e5){return _0x2795e5['removeTags'](_0x372b5f[_0xa4ce('0x2a')][_0xa4ce('0x3e')]);}})['then'](respondWithStatusCode(_0x5b88a2,null))[_0xa4ce('0x2c')](handleError(_0x5b88a2,null));};exports['download']=function(_0x2751fa,_0xdb6402){var _0x3a71be=moment()[_0xa4ce('0x56')]()['toString']();var _0x15137d=path['join'](config[_0xa4ce('0x57')],_0xa4ce('0x58'),_0xa4ce('0x59'),'tmp');var _0xfc5967=path['join'](config[_0xa4ce('0x57')],_0xa4ce('0x58'),_0xa4ce('0x59'),_0xa4ce('0x5a'));var _0x47aad0=path[_0xa4ce('0x5b')](_0x15137d,_0x3a71be);var _0x11e6a7=util[_0xa4ce('0x4c')](_0xa4ce('0x5c'),_0x2751fa['params']['id'],_0x3a71be);var _0x298e21=path[_0xa4ce('0x5b')](_0x15137d,_0x11e6a7);var _0x3715b6=[];_0x3715b6['push']({'model':db[_0xa4ce('0x5d')],'as':_0xa4ce('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x3715b6[_0xa4ce('0x5e')]({'model':db[_0xa4ce('0x5f')],'as':_0xa4ce('0x60'),'attributes':['id',_0xa4ce('0x61'),_0xa4ce('0x62')],'raw':!![]});if(_0x2751fa['query'][_0xa4ce('0x5a')]){_0x3715b6['push']({'model':db['Attachment'],'as':_0xa4ce('0x63'),'raw':!![]});}var _0x5387ce=[{'model':db['WhatsappMessage'],'as':_0xa4ce('0x64'),'attributes':['id',_0xa4ce('0x38'),_0xa4ce('0x65'),_0xa4ce('0x66'),_0xa4ce('0x67'),_0xa4ce('0x68')],'include':_0x3715b6}];_0x5387ce[_0xa4ce('0x5e')]({'model':db[_0xa4ce('0x69')],'as':_0xa4ce('0x6a'),'attributes':['id',_0xa4ce('0x22')]});_0x5387ce['push']({'model':db[_0xa4ce('0x5d')],'as':_0xa4ce('0x6b'),'attributes':['id',_0xa4ce('0x6c')]});return db[_0xa4ce('0x24')][_0xa4ce('0x36')]({'where':{'id':_0x2751fa[_0xa4ce('0x39')]['id']},'include':_0x5387ce})[_0xa4ce('0x1d')](handleEntityNotFound(_0xdb6402,null))[_0xa4ce('0x1d')](function(_0xa9d33a){if(_0xa9d33a){var _0x1e25f9=_0xa9d33a['get']({'plain':!![]});fs[_0xa4ce('0x6d')](_0x47aad0);var _0x596499={'channel':_0xa4ce('0x6e'),'account':_0x1e25f9[_0xa4ce('0x6a')][_0xa4ce('0x22')],'agent':_0x1e25f9[_0xa4ce('0x6b')]?_0x1e25f9[_0xa4ce('0x6b')][_0xa4ce('0x6c')]:'N.A.','createdAt':moment(_0x1e25f9[_0xa4ce('0x65')])[_0xa4ce('0x4c')](_0xa4ce('0x4d'))[_0xa4ce('0x6f')](),'closedAt':_0x1e25f9[_0xa4ce('0x70')]?moment(_0x1e25f9[_0xa4ce('0x71')])[_0xa4ce('0x4c')](_0xa4ce('0x4d'))[_0xa4ce('0x6f')]():'','disposition':_0x1e25f9[_0xa4ce('0x72')],'messages':_(_0x1e25f9[_0xa4ce('0x64')])[_0xa4ce('0x49')]({'secret':![]})[_0xa4ce('0x23')](function(_0x46a583){if(_0x46a583['Attachment']){var _0x4bd423=path[_0xa4ce('0x5b')](_0xfc5967,_0x46a583['Attachment'][_0xa4ce('0x73')]);if(fs[_0xa4ce('0x74')](_0x4bd423)){fs[_0xa4ce('0x75')](_0x4bd423)[_0xa4ce('0x76')](fs[_0xa4ce('0x77')](path[_0xa4ce('0x5b')](_0x47aad0,_0x46a583['Attachment'][_0xa4ce('0x73')])));}}return{'date':moment(_0x46a583[_0xa4ce('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa4ce('0x6f')](),'sender':_0x46a583[_0xa4ce('0x66')]==='out'?_0x46a583['User']?_0x46a583[_0xa4ce('0x5d')][_0xa4ce('0x6c')]:_0xa4ce('0x78'):_0x46a583[_0xa4ce('0x60')][_0xa4ce('0x61')]+(_0x46a583['Contact'][_0xa4ce('0x62')]?'\x20'+_0x46a583[_0xa4ce('0x60')][_0xa4ce('0x62')]:''),'body':_0x46a583[_0xa4ce('0x63')]?_0x46a583[_0xa4ce('0x63')][_0xa4ce('0x73')]:_0x46a583[_0xa4ce('0x38')],'direction':_0x46a583[_0xa4ce('0x66')]==='out'?'A':'C','secret':_0x46a583[_0xa4ce('0x67')],'read':_0x46a583[_0xa4ce('0x68')],'attachment':_0x46a583[_0xa4ce('0x63')]};})[_0xa4ce('0x79')]()};return ejs[_0xa4ce('0x7a')](path[_0xa4ce('0x5b')](config[_0xa4ce('0x57')],'server',_0xa4ce('0x7b'),_0xa4ce('0x7c')),{'interaction':_0x596499})['then'](function(_0x408901){var _0x173fd8=path[_0xa4ce('0x5b')](_0x47aad0,_0xa4ce('0x7d')+_0x1e25f9['id']+'-'+_0x3a71be+_0xa4ce('0x7e'));var _0x51bca0={'path':_0x173fd8,'channel':_0xa4ce('0x6e'),'interactionId':_0x1e25f9['id']};return pdf[_0xa4ce('0x7f')](_0x408901,_0x51bca0);})[_0xa4ce('0x1d')](function(){return new BPromise(function(_0x4dec38,_0x12cd99){zipdir(_0x47aad0,{'saveTo':_0x298e21},function(_0x25bc2e,_0x268178){if(_0x25bc2e)return _0x12cd99(_0x25bc2e);return _0x4dec38(_0x268178);});})[_0xa4ce('0x1d')](function(){return new BPromise(function(_0xde9a25,_0x2ff7ce){rimraf(_0x47aad0,function(_0x297578){if(_0x297578)_0x2ff7ce(_0x297578);return _0xde9a25();});});})[_0xa4ce('0x1d')](function(){return _0xdb6402[_0xa4ce('0x80')](_0x298e21,_0x11e6a7,function(_0x40b8e7){if(_0x40b8e7){console[_0xa4ce('0x81')](_0xa4ce('0x82'),_0x40b8e7);}else{fs[_0xa4ce('0x83')](_0x298e21);}});});});}else{return _0xdb6402[_0xa4ce('0x1f')](0xc8);}})[_0xa4ce('0x2c')](handleError(_0xdb6402,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 92d5660..17b526a 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 _0x1da6=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x1da6,0x7c));var _0x61da=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x1da6[_0x2d61ac];return _0x3f7d3c;};'use strict';var EventEmitter=require(_0x61da('0x0'));var WhatsappInteraction=require(_0x61da('0x1'))['db'][_0x61da('0x2')];var WhatsappMessage=require(_0x61da('0x1'))['db'][_0x61da('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x61da('0x4')](0x0);var events={'afterCreate':_0x61da('0x5'),'afterUpdate':_0x61da('0x6'),'afterDestroy':_0x61da('0x7')};function emitEvent(_0xe55a12){return function(_0x2be3c9,_0x42f09d,_0x16cd66){_0x2be3c9[_0x61da('0x8')]({'attributes':['id'],'raw':!![]})[_0x61da('0x9')](function(_0x2c43c2){_0x2be3c9[_0x61da('0xa')](_0x61da('0xb'),_0x2c43c2[_0x61da('0xc')](function(_0xf027a6){return{'id':_0xf027a6['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2be3c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x61da('0x9')](function(_0x284ed6){_0x2be3c9[_0x61da('0xa')](_0x61da('0xd'),_0x284ed6[_0x61da('0xe')]);WhatsappInteractionEvents[_0x61da('0xf')](_0xe55a12+':'+_0x2be3c9['id'],_0x2be3c9);WhatsappInteractionEvents[_0x61da('0xf')](_0xe55a12,_0x2be3c9);_0x16cd66(null);})[_0x61da('0x10')](_0x16cd66(null));};}for(var e in events){if(events[_0x61da('0x11')](e)){var event=events[e];WhatsappInteraction[_0x61da('0x12')](e,emitEvent(event));}}module[_0x61da('0x13')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf00e=['length','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3e4531,_0x4d7cee){var _0x5f2b05=function(_0x12232a){while(--_0x12232a){_0x3e4531['push'](_0x3e4531['shift']());}};_0x5f2b05(++_0x4d7cee);}(_0xf00e,0x12f));var _0xef00=function(_0x1b239e,_0x8184c9){_0x1b239e=_0x1b239e-0x0;var _0x277669=_0xf00e[_0x1b239e];return _0x277669;};'use strict';var EventEmitter=require(_0xef00('0x0'));var WhatsappInteraction=require(_0xef00('0x1'))['db'][_0xef00('0x2')];var WhatsappMessage=require(_0xef00('0x1'))['db'][_0xef00('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xef00('0x4')](0x0);var events={'afterCreate':_0xef00('0x5'),'afterUpdate':_0xef00('0x6'),'afterDestroy':_0xef00('0x7')};function emitEvent(_0x4261ea){return function(_0x409186,_0x471e92,_0x397c39){_0x409186[_0xef00('0x8')]({'attributes':['id'],'raw':!![]})[_0xef00('0x9')](function(_0x17ec9e){_0x409186[_0xef00('0xa')](_0xef00('0xb'),_0x17ec9e['map'](function(_0x1d3b1c){return{'id':_0x1d3b1c['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x409186['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x173074){_0x409186['setDataValue']('unreadMessages',_0x173074[_0xef00('0xc')]);WhatsappInteractionEvents['emit'](_0x4261ea+':'+_0x409186['id'],_0x409186);WhatsappInteractionEvents[_0xef00('0xd')](_0x4261ea,_0x409186);_0x397c39(null);})[_0xef00('0xe')](_0x397c39(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e5546b8..fab0118 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 _0x09cb=['lodash','api','moment','bluebird','request-promise','path','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x09cb,0xdd));var _0xb09c=function(_0x50eddd,_0x183b2e){_0x50eddd=_0x50eddd-0x0;var _0x3bcda5=_0x09cb[_0x50eddd];return _0x3bcda5;};'use strict';var _=require(_0xb09c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb09c('0x1'));var moment=require(_0xb09c('0x2'));var BPromise=require(_0xb09c('0x3'));var rp=require(_0xb09c('0x4'));var fs=require('fs');var path=require(_0xb09c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xb09c('0x6')]=function(_0x57a2aa,_0x3342e1){return _0x57a2aa[_0xb09c('0x7')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4eb509,_0x490a92,_0x4c2e64){if(_0x4eb509[_0xb09c('0x8')](_0xb09c('0x9'))){_0x4eb509[_0xb09c('0xa')]=moment()[_0xb09c('0xb')](_0xb09c('0xc'));}_0x4c2e64(null,_0x4eb509);}}});}; \ No newline at end of file +var _0x5370=['../../config/logger','api','moment','bluebird','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5370,0x11f));var _0x0537=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5370[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0537('0x0'));var logger=require(_0x0537('0x1'))(_0x0537('0x2'));var moment=require(_0x0537('0x3'));var BPromise=require(_0x0537('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0537('0x5'));var config=require('../../config/environment');var attributes=require(_0x0537('0x6'));module[_0x0537('0x7')]=function(_0x601891,_0x494a2c){return _0x601891[_0x0537('0x8')](_0x0537('0x9'),attributes,{'tableName':_0x0537('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xbadf0d,_0x410404,_0x185664){if(_0xbadf0d[_0x0537('0xb')](_0x0537('0xc'))){_0xbadf0d[_0x0537('0xd')]=moment()[_0x0537('0xe')](_0x0537('0xf'));}_0x185664(null,_0xbadf0d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1d7a300..7251c02 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 _0x9bf0=['addTags','ids','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x9bf0,0x124));var _0x09bf=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x9bf0[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x09bf('0x0'));var util=require(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rs=require(_0x09bf('0x4'));var fs=require('fs');var Redis=require(_0x09bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x09bf('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x09bf('0x7'));var jayson=require(_0x09bf('0x8'));var client=jayson[_0x09bf('0x9')][_0x09bf('0xa')]({'port':0x232a});config[_0x09bf('0xb')]=_[_0x09bf('0xc')](config['redis'],{'host':_0x09bf('0xd'),'port':0x18eb});var socket=require(_0x09bf('0xe'))(new Redis(config[_0x09bf('0xb')]));require(_0x09bf('0xf'))[_0x09bf('0x10')](socket);function respondWithRpcPromise(_0x4910e8,_0x27e1c4,_0x496661){return new BPromise(function(_0x18a6e0,_0x5ce2a1){return client[_0x09bf('0x11')](_0x4910e8,_0x496661)['then'](function(_0x6e1476){logger[_0x09bf('0x12')](_0x09bf('0x13'),_0x27e1c4,_0x09bf('0x14'));logger[_0x09bf('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x27e1c4,_0x09bf('0x14'),JSON[_0x09bf('0x16')](_0x6e1476));if(_0x6e1476['error']){if(_0x6e1476[_0x09bf('0x17')][_0x09bf('0x18')]===0x1f4){logger[_0x09bf('0x17')](_0x09bf('0x13'),_0x27e1c4,_0x6e1476[_0x09bf('0x17')][_0x09bf('0x19')]);return _0x5ce2a1(_0x6e1476[_0x09bf('0x17')][_0x09bf('0x19')]);}logger[_0x09bf('0x17')](_0x09bf('0x13'),_0x27e1c4,_0x6e1476[_0x09bf('0x17')][_0x09bf('0x19')]);return _0x18a6e0(_0x6e1476['error']['message']);}else{logger[_0x09bf('0x12')](_0x09bf('0x13'),_0x27e1c4,'request\x20sent');_0x18a6e0(_0x6e1476[_0x09bf('0x1a')][_0x09bf('0x19')]);}})['catch'](function(_0xa31616){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x27e1c4,_0xa31616);_0x5ce2a1(_0xa31616);});});}exports[_0x09bf('0x1b')]=function(_0x4e0148){var _0x7f58ed=this;return new Promise(function(_0x973a45,_0x470114){return db[_0x09bf('0x1c')]['update'](_0x4e0148['body'],{'raw':_0x4e0148[_0x09bf('0x1d')]?_0x4e0148[_0x09bf('0x1d')][_0x09bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e0148[_0x09bf('0x1d')]?_0x4e0148[_0x09bf('0x1d')][_0x09bf('0x1f')]||null:null,'attributes':_0x4e0148[_0x09bf('0x1d')]?_0x4e0148['options'][_0x09bf('0x20')]||null:null,'limit':_0x4e0148[_0x09bf('0x1d')]?_0x4e0148['options'][_0x09bf('0x21')]||null:null})[_0x09bf('0x22')](function(_0x11bda4){logger['info']('UpdateWhatsappInteraction',_0x4e0148);logger[_0x09bf('0x15')](_0x09bf('0x1b'),_0x4e0148,JSON[_0x09bf('0x16')](_0x11bda4));_0x973a45(_0x11bda4);})['catch'](function(_0x521e79){logger[_0x09bf('0x17')](_0x09bf('0x1b'),_0x521e79['message'],_0x4e0148);_0x470114(_0x7f58ed[_0x09bf('0x17')](0x1f4,_0x521e79[_0x09bf('0x19')]));});});};exports[_0x09bf('0x23')]=function(_0x36bc0a){return new Promise(function(_0x6125ac,_0x37a07e){return db[_0x09bf('0x1c')]['find']({'where':_0x36bc0a[_0x09bf('0x1d')]?_0x36bc0a[_0x09bf('0x1d')][_0x09bf('0x1f')]||null:null})['then'](function(_0x448551){if(_0x448551){return _0x448551[_0x09bf('0x24')](_0x36bc0a['body'][_0x09bf('0x25')],_['omit'](_0x36bc0a[_0x09bf('0x26')],[_0x09bf('0x25'),'id'])||{});}})[_0x09bf('0x27')](function(_0x4eadbe){logger[_0x09bf('0x12')](_0x09bf('0x28'),_0x36bc0a);logger[_0x09bf('0x15')]('AddTags',_0x36bc0a,JSON[_0x09bf('0x16')](_0x4eadbe));_0x6125ac(_0x4eadbe);})['catch'](function(_0x10f6e7){logger['error'](_0x09bf('0x28'),_0x10f6e7['message'],_0x36bc0a);_0x37a07e(_this[_0x09bf('0x17')](0x1f4,_0x10f6e7[_0x09bf('0x19')]));});});}; \ No newline at end of file +var _0x596b=['stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','where','limit','find','addTags','body','ids','spread','AddTags'];(function(_0x44c0e1,_0x28bfbf){var _0x5a3ba4=function(_0x44730f){while(--_0x44730f){_0x44c0e1['push'](_0x44c0e1['shift']());}};_0x5a3ba4(++_0x28bfbf);}(_0x596b,0xef));var _0xb596=function(_0x462e9d,_0x49a430){_0x462e9d=_0x462e9d-0x0;var _0x5bb599=_0x596b[_0x462e9d];return _0x5bb599;};'use strict';var _=require('lodash');var util=require(_0xb596('0x0'));var moment=require(_0xb596('0x1'));var BPromise=require('bluebird');var rs=require(_0xb596('0x2'));var fs=require('fs');var Redis=require(_0xb596('0x3'));var db=require(_0xb596('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb596('0x5'))('rpc');var config=require(_0xb596('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb596('0x7')][_0xb596('0x8')]({'port':0x232a});config[_0xb596('0x9')]=_['defaults'](config[_0xb596('0x9')],{'host':_0xb596('0xa'),'port':0x18eb});var socket=require(_0xb596('0xb'))(new Redis(config[_0xb596('0x9')]));require(_0xb596('0xc'))['register'](socket);function respondWithRpcPromise(_0x2897d1,_0x26371f,_0x2e15ce){return new BPromise(function(_0x586a9b,_0x44fc14){return client['request'](_0x2897d1,_0x2e15ce)[_0xb596('0xd')](function(_0x2fa5d2){logger[_0xb596('0xe')](_0xb596('0xf'),_0x26371f,_0xb596('0x10'));logger[_0xb596('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x26371f,_0xb596('0x10'),JSON['stringify'](_0x2fa5d2));if(_0x2fa5d2[_0xb596('0x12')]){if(_0x2fa5d2[_0xb596('0x12')][_0xb596('0x13')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,_0x2fa5d2[_0xb596('0x12')][_0xb596('0x14')]);return _0x44fc14(_0x2fa5d2[_0xb596('0x12')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,_0x2fa5d2[_0xb596('0x12')][_0xb596('0x14')]);return _0x586a9b(_0x2fa5d2[_0xb596('0x12')]['message']);}else{logger[_0xb596('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,'request\x20sent');_0x586a9b(_0x2fa5d2['result'][_0xb596('0x14')]);}})[_0xb596('0x15')](function(_0x8836d3){logger['error'](_0xb596('0xf'),_0x26371f,_0x8836d3);_0x44fc14(_0x8836d3);});});}exports[_0xb596('0x16')]=function(_0x344e0c){var _0x22a9be=this;return new Promise(function(_0x117709,_0x41f234){return db[_0xb596('0x17')]['update'](_0x344e0c['body'],{'raw':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options'][_0xb596('0x19')]||null:null,'attributes':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options']['attributes']||null:null,'limit':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options'][_0xb596('0x1a')]||null:null})['then'](function(_0x408bdf){logger['info']('UpdateWhatsappInteraction',_0x344e0c);logger[_0xb596('0x11')](_0xb596('0x16'),_0x344e0c,JSON['stringify'](_0x408bdf));_0x117709(_0x408bdf);})[_0xb596('0x15')](function(_0x31f077){logger[_0xb596('0x12')](_0xb596('0x16'),_0x31f077[_0xb596('0x14')],_0x344e0c);_0x41f234(_0x22a9be[_0xb596('0x12')](0x1f4,_0x31f077[_0xb596('0x14')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x238a36){return new Promise(function(_0x2b7537,_0x41f1df){return db[_0xb596('0x17')][_0xb596('0x1b')]({'where':_0x238a36[_0xb596('0x18')]?_0x238a36[_0xb596('0x18')]['where']||null:null})[_0xb596('0xd')](function(_0x49c799){if(_0x49c799){return _0x49c799[_0xb596('0x1c')](_0x238a36[_0xb596('0x1d')][_0xb596('0x1e')],_['omit'](_0x238a36[_0xb596('0x1d')],['ids','id'])||{});}})[_0xb596('0x1f')](function(_0x387d1a){logger[_0xb596('0xe')](_0xb596('0x20'),_0x238a36);logger[_0xb596('0x11')]('AddTags',_0x238a36,JSON[_0xb596('0x21')](_0x387d1a));_0x2b7537(_0x387d1a);})[_0xb596('0x15')](function(_0x224596){logger['error'](_0xb596('0x20'),_0x224596[_0xb596('0x14')],_0x238a36);_0x41f1df(_this[_0xb596('0x12')](0x1f4,_0x224596[_0xb596('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bd4de21..5b57c9b 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 _0x115d=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1bb893,_0x44b939){var _0x506269=function(_0xc906a9){while(--_0xc906a9){_0x1bb893['push'](_0x1bb893['shift']());}};_0x506269(++_0x44b939);}(_0x115d,0x1b9));var _0xd115=function(_0x225261,_0x441cff){_0x225261=_0x225261-0x0;var _0x4868bf=_0x115d[_0x225261];return _0x4868bf;};'use strict';var WhatsappInteractionEvents=require(_0xd115('0x0'));var events=[_0xd115('0x1'),_0xd115('0x2'),_0xd115('0x3')];function createListener(_0x172da8,_0x2ee845){return function(_0x27dce3){_0x2ee845[_0xd115('0x4')](_0x172da8,_0x27dce3);};}function removeListener(_0x113c6b,_0x4249cc){return function(){WhatsappInteractionEvents[_0xd115('0x5')](_0x113c6b,_0x4249cc);};}exports[_0xd115('0x6')]=function(_0x59b9e0){for(var _0x2fb9a7=0x0,_0x171f56=events[_0xd115('0x7')];_0x2fb9a7<_0x171f56;_0x2fb9a7++){var _0x44ca1a=events[_0x2fb9a7];var _0x32f8ba=createListener(_0xd115('0x8')+_0x44ca1a,_0x59b9e0);WhatsappInteractionEvents['on'](_0x44ca1a,_0x32f8ba);}}; \ No newline at end of file +var _0x8524=['emit','removeListener','register','length','./whatsappInteraction.events','save','remove','update'];(function(_0x31ddb5,_0x2caf88){var _0x4acc5e=function(_0x3a159c){while(--_0x3a159c){_0x31ddb5['push'](_0x31ddb5['shift']());}};_0x4acc5e(++_0x2caf88);}(_0x8524,0x1e4));var _0x4852=function(_0x512999,_0x3ec44e){_0x512999=_0x512999-0x0;var _0x3d94c4=_0x8524[_0x512999];return _0x3d94c4;};'use strict';var WhatsappInteractionEvents=require(_0x4852('0x0'));var events=[_0x4852('0x1'),_0x4852('0x2'),_0x4852('0x3')];function createListener(_0x4aac8c,_0x32dcc9){return function(_0x353c80){_0x32dcc9[_0x4852('0x4')](_0x4aac8c,_0x353c80);};}function removeListener(_0x39bc34,_0x345283){return function(){WhatsappInteractionEvents[_0x4852('0x5')](_0x39bc34,_0x345283);};}exports[_0x4852('0x6')]=function(_0x19a7c9){for(var _0x1ff162=0x0,_0x43c541=events[_0x4852('0x7')];_0x1ff162<_0x43c541;_0x1ff162++){var _0x1cf206=events[_0x1ff162];var _0x400691=createListener('whatsappInteraction:'+_0x1cf206,_0x19a7c9);WhatsappInteractionEvents['on'](_0x1cf206,_0x400691);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f714617..f3d0493 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 _0x346a=['tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x53e35e,_0x114a69){var _0xaaaa6a=function(_0x5df197){while(--_0x5df197){_0x53e35e['push'](_0x53e35e['shift']());}};_0xaaaa6a(++_0x114a69);}(_0x346a,0xbc));var _0xa346=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x346a[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xa346('0x0'));var util=require(_0xa346('0x1'));var path=require(_0xa346('0x2'));var timeout=require('connect-timeout');var express=require(_0xa346('0x3'));var router=express[_0xa346('0x4')]();var fs_extra=require(_0xa346('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa346('0x6'));var config=require('../../config/environment');var controller=require(_0xa346('0x7'));router[_0xa346('0x8')]('/',auth['isAuthenticated'](),controller[_0xa346('0x9')]);router[_0xa346('0x8')](_0xa346('0xa'),auth[_0xa346('0xb')](),controller['describe']);router[_0xa346('0x8')](_0xa346('0xc'),auth['isAuthenticated'](),controller[_0xa346('0xd')]);router[_0xa346('0xe')]('/',auth[_0xa346('0xb')](),interaction[_0xa346('0xf')](_0xa346('0x10'),_0xa346('0x11')),controller[_0xa346('0x12')]);router['post'](_0xa346('0x13'),controller['status']);router[_0xa346('0x14')](_0xa346('0xc'),auth['isAuthenticated'](),controller[_0xa346('0x15')]);router[_0xa346('0x14')](_0xa346('0x16'),auth['isAuthenticated'](),controller[_0xa346('0x17')]);router['put'](_0xa346('0x18'),auth[_0xa346('0xb')](),controller[_0xa346('0x19')]);router[_0xa346('0x1a')](_0xa346('0xc'),auth['isAuthenticated'](),controller[_0xa346('0x1b')]);module[_0xa346('0x1c')]=router; \ No newline at end of file +var _0x0034=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','update','/:id/reject','reject'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0034,0xcd));var _0x4003=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0x0034[_0x16270b];return _0x2cd122;};'use strict';var multer=require(_0x4003('0x0'));var util=require('util');var path=require(_0x4003('0x1'));var timeout=require(_0x4003('0x2'));var express=require(_0x4003('0x3'));var router=express[_0x4003('0x4')]();var fs_extra=require(_0x4003('0x5'));var auth=require(_0x4003('0x6'));var interaction=require(_0x4003('0x7'));var config=require(_0x4003('0x8'));var controller=require(_0x4003('0x9'));router[_0x4003('0xa')]('/',auth[_0x4003('0xb')](),controller[_0x4003('0xc')]);router[_0x4003('0xa')](_0x4003('0xd'),auth['isAuthenticated'](),controller[_0x4003('0xe')]);router[_0x4003('0xa')](_0x4003('0xf'),auth[_0x4003('0xb')](),controller[_0x4003('0x10')]);router[_0x4003('0x11')]('/',auth[_0x4003('0xb')](),interaction[_0x4003('0x12')]('whatsapp',_0x4003('0x13')),controller[_0x4003('0x14')]);router[_0x4003('0x11')](_0x4003('0x15'),controller[_0x4003('0x16')]);router[_0x4003('0x17')]('/:id',auth[_0x4003('0xb')](),controller[_0x4003('0x18')]);router[_0x4003('0x17')]('/:id/accept',auth[_0x4003('0xb')](),controller['accept']);router[_0x4003('0x17')](_0x4003('0x19'),auth[_0x4003('0xb')](),controller[_0x4003('0x1a')]);router[_0x4003('0x1b')](_0x4003('0xf'),auth[_0x4003('0xb')](),controller[_0x4003('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index de1be0b..b420b05 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 _0xfc90=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0xfc90,0x17b));var _0x0fc9=function(_0x442cf8,_0x82f71){_0x442cf8=_0x442cf8-0x0;var _0x3e720c=_0xfc90[_0x442cf8];return _0x3e720c;};'use strict';var Sequelize=require(_0x0fc9('0x0'));module[_0x0fc9('0x1')]={'body':{'type':Sequelize[_0x0fc9('0x2')](_0x0fc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0fc9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0fc9('0x5')]('in','out'),'defaultValue':_0x0fc9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0fc9('0x7')](0xbe)},'phone':{'type':Sequelize[_0x0fc9('0x7')]},'readAt':{'type':Sequelize[_0x0fc9('0x8')]},'secret':{'type':Sequelize[_0x0fc9('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0fc9('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2873=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2873,0x1f2));var _0x3287=function(_0xa89bed,_0x2c0c52){_0xa89bed=_0xa89bed-0x0;var _0x53254d=_0x2873[_0xa89bed];return _0x53254d;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'body':{'type':Sequelize[_0x3287('0x2')](_0x3287('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3287('0x4')]('in',_0x3287('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3287('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3287('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3287('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3287('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 4832d43..53a0a28 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 _0x3975=['channel','motionChannel','event','reject','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageSid','messageId','MessageStatus','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','client','whatsapp-interactions','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','accept','whatsapp','acceptMessage','UserId','agent','get','WhatsappInteractionId','interaction','info','user','role','stringify','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','email','format'];(function(_0x690248,_0x1e933d){var _0xd9f899=function(_0x10934c){while(--_0x10934c){_0x690248['push'](_0x690248['shift']());}};_0xd9f899(++_0x1e933d);}(_0x3975,0x149));var _0x5397=function(_0x4e6fc0,_0x38a58f){_0x4e6fc0=_0x4e6fc0-0x0;var _0x22f7ba=_0x3975[_0x4e6fc0];return _0x22f7ba;};'use strict';var util=require('util');var _=require(_0x5397('0x0'));var Redis=require(_0x5397('0x1'));var interactionService=require(_0x5397('0x2'));var qs=require(_0x5397('0x3'));var logger=require(_0x5397('0x4'))(_0x5397('0x5'));var config=require(_0x5397('0x6'));var db=require(_0x5397('0x7'))['db'];config[_0x5397('0x8')]=_[_0x5397('0x9')](config[_0x5397('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5397('0xa'))(new Redis(config[_0x5397('0x8')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5397('0xb')]['http']({'port':0x232c});var client9002=jayson[_0x5397('0xb')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x5397('0xc'));function respondWithRpcPromise(_0x3e2761,_0x510509,_0x3a02ca,_0x4dd9e5){return new Promise(function(_0x446432,_0x1ae740){var _0x29a91e=_0x4dd9e5||client;return _0x29a91e[_0x5397('0xd')](_0x3e2761,_0x3a02ca)[_0x5397('0xe')](function(_0x3bb2ad){logger['info'](_0x5397('0xf'),_0x510509,'request\x20sent');logger[_0x5397('0x10')](_0x5397('0x11'),_0x510509,_0x5397('0x12'),JSON['stringify'](_0x3bb2ad));if(_0x3bb2ad[_0x5397('0x13')]){if(_0x3bb2ad['error'][_0x5397('0x14')]===0x1f4){logger[_0x5397('0x13')](_0x5397('0xf'),_0x510509,_0x3bb2ad['error']['message']);return _0x1ae740(_0x3bb2ad[_0x5397('0x13')]['message']);}logger[_0x5397('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x510509,_0x3bb2ad['error'][_0x5397('0x15')]);return _0x446432(_0x3bb2ad[_0x5397('0x13')][_0x5397('0x15')]);}else{logger['info'](_0x5397('0xf'),_0x510509,_0x5397('0x12'));_0x446432(_0x3bb2ad['result'][_0x5397('0x15')]);}})[_0x5397('0x16')](function(_0x19b53b){logger['error'](_0x5397('0xf'),_0x510509,_0x19b53b);_0x1ae740(_0x19b53b);});});}function respondWithResult(_0x33c54d,_0x193add){_0x193add=_0x193add||0xc8;return function(_0x357ffc){if(_0x357ffc){return _0x33c54d[_0x5397('0x17')](_0x193add)[_0x5397('0x18')](_0x357ffc);}};}function respondWithFilteredResult(_0xd3d295,_0xa17999){return function(_0x131543){if(_0x131543){var _0x20e464=typeof _0xa17999[_0x5397('0x19')]===_0x5397('0x1a')&&typeof _0xa17999[_0x5397('0x1b')]==='undefined';var _0x445945=_0x131543['count'];var _0x53af9b=_0x20e464?0x0:_0xa17999[_0x5397('0x19')];var _0x2f7914=_0x20e464?_0x131543[_0x5397('0x1c')]:_0xa17999[_0x5397('0x19')]+_0xa17999[_0x5397('0x1b')];var _0x2b4590;if(_0x2f7914>=_0x445945){_0x2f7914=_0x445945;_0x2b4590=0xc8;}else{_0x2b4590=0xce;}_0xd3d295[_0x5397('0x17')](_0x2b4590);return _0xd3d295[_0x5397('0x1d')]('Content-Range',_0x53af9b+'-'+_0x2f7914+'/'+_0x445945)[_0x5397('0x18')](_0x131543);}return null;};}function saveUpdates(_0x580da9){return function(_0x1966ca){if(_0x1966ca){return _0x1966ca[_0x5397('0x1e')](_0x580da9)[_0x5397('0xe')](function(_0x168198){return _0x168198;});}return null;};}function removeEntity(_0x27c3b4){return function(_0xfdc5bc){if(_0xfdc5bc){return _0xfdc5bc[_0x5397('0x1f')]()[_0x5397('0xe')](function(){_0x27c3b4[_0x5397('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d773){return function(_0x1e188d){if(!_0x1e188d){_0x31d773[_0x5397('0x20')](0x194);}return _0x1e188d;};}function handleError(_0x302ba9,_0x2c2fc9){_0x2c2fc9=_0x2c2fc9||0x1f4;return function(_0x4f7265){logger[_0x5397('0x13')](_0x4f7265[_0x5397('0x21')]);if(_0x4f7265[_0x5397('0x22')]){delete _0x4f7265[_0x5397('0x22')];}_0x302ba9[_0x5397('0x17')](_0x2c2fc9)[_0x5397('0x23')](_0x4f7265);};}exports[_0x5397('0x24')]=function(_0x286b86,_0x2a4dc8){var _0x43e381={},_0x43894c={},_0x11e853={'count':0x0,'rows':[]};var _0x5d1f00=_[_0x5397('0x25')](db[_0x5397('0x26')][_0x5397('0x27')],function(_0x4ad300){return{'name':_0x4ad300[_0x5397('0x28')],'type':_0x4ad300['type'][_0x5397('0x29')]};});_0x43894c['model']=_[_0x5397('0x25')](_0x5d1f00,_0x5397('0x22'));_0x43894c[_0x5397('0x2a')]=_[_0x5397('0x2b')](_0x286b86[_0x5397('0x2a')]);_0x43894c[_0x5397('0x2c')]=_['intersection'](_0x43894c['model'],_0x43894c[_0x5397('0x2a')]);_0x43e381[_0x5397('0x2d')]=_[_0x5397('0x2e')](_0x43894c[_0x5397('0x2f')],qs[_0x5397('0x30')](_0x286b86[_0x5397('0x2a')][_0x5397('0x30')]));_0x43e381[_0x5397('0x2d')]=_0x43e381['attributes'][_0x5397('0x31')]?_0x43e381[_0x5397('0x2d')]:_0x43894c['model'];if(!_0x286b86[_0x5397('0x2a')][_0x5397('0x32')](_0x5397('0x33'))){_0x43e381[_0x5397('0x1b')]=qs[_0x5397('0x1b')](_0x286b86[_0x5397('0x2a')][_0x5397('0x1b')]);_0x43e381['offset']=qs[_0x5397('0x19')](_0x286b86[_0x5397('0x2a')]['offset']);}_0x43e381[_0x5397('0x34')]=qs['sort'](_0x286b86[_0x5397('0x2a')]['sort']);_0x43e381[_0x5397('0x35')]=qs[_0x5397('0x2c')](_[_0x5397('0x36')](_0x286b86[_0x5397('0x2a')],_0x43894c[_0x5397('0x2c')]),_0x5d1f00);if(_0x286b86[_0x5397('0x2a')][_0x5397('0x37')]){_0x43e381['where']=_['merge'](_0x43e381['where'],{'$or':_['map'](_0x5d1f00,function(_0x36b8f2){if(_0x36b8f2['type']!==_0x5397('0x38')){var _0x401868={};_0x401868[_0x36b8f2['name']]={'$like':'%'+_0x286b86[_0x5397('0x2a')]['filter']+'%'};return _0x401868;}})});}_0x43e381=_[_0x5397('0x39')]({},_0x43e381,_0x286b86['options']);var _0x19e812={'where':_0x43e381[_0x5397('0x35')]};return db[_0x5397('0x26')][_0x5397('0x1c')](_0x19e812)[_0x5397('0xe')](function(_0xf98252){_0x11e853[_0x5397('0x1c')]=_0xf98252;if(_0x286b86[_0x5397('0x2a')][_0x5397('0x3a')]){_0x43e381[_0x5397('0x3b')]=[{'all':!![]}];}return db[_0x5397('0x26')][_0x5397('0x3c')](_0x43e381);})['then'](function(_0x3320e0){_0x11e853[_0x5397('0x3d')]=_0x3320e0;return _0x11e853;})['then'](respondWithFilteredResult(_0x2a4dc8,_0x43e381))['catch'](handleError(_0x2a4dc8,null));};exports[_0x5397('0x3e')]=function(_0x143646,_0x2b74b0){var _0x20d1a7={'raw':!![],'where':{'id':_0x143646[_0x5397('0x3f')]['id']}},_0x42d40={};_0x42d40[_0x5397('0x2f')]=_[_0x5397('0x2b')](db[_0x5397('0x26')][_0x5397('0x27')]);_0x42d40['query']=_['keys'](_0x143646['query']);_0x42d40[_0x5397('0x2c')]=_[_0x5397('0x2e')](_0x42d40[_0x5397('0x2f')],_0x42d40['query']);_0x20d1a7[_0x5397('0x2d')]=_[_0x5397('0x2e')](_0x42d40[_0x5397('0x2f')],qs[_0x5397('0x30')](_0x143646[_0x5397('0x2a')][_0x5397('0x30')]));_0x20d1a7[_0x5397('0x2d')]=_0x20d1a7['attributes'][_0x5397('0x31')]?_0x20d1a7[_0x5397('0x2d')]:_0x42d40[_0x5397('0x2f')];if(_0x143646[_0x5397('0x2a')][_0x5397('0x3a')]){_0x20d1a7[_0x5397('0x3b')]=[{'all':!![]}];}_0x20d1a7=_[_0x5397('0x39')]({},_0x20d1a7,_0x143646[_0x5397('0x40')]);return db[_0x5397('0x26')][_0x5397('0x41')](_0x20d1a7)[_0x5397('0xe')](handleEntityNotFound(_0x2b74b0,null))[_0x5397('0xe')](respondWithResult(_0x2b74b0,null))[_0x5397('0x16')](handleError(_0x2b74b0,null));};exports[_0x5397('0x42')]=function(_0x5cea3a,_0x47740d){return db[_0x5397('0x26')][_0x5397('0x42')](_0x5cea3a[_0x5397('0x43')],{})[_0x5397('0xe')](respondWithResult(_0x47740d,0xc9))[_0x5397('0x16')](handleError(_0x47740d,null));};exports['update']=function(_0x51b2cd,_0x123001){if(_0x51b2cd[_0x5397('0x43')]['id']){delete _0x51b2cd['body']['id'];}return db[_0x5397('0x26')][_0x5397('0x41')]({'where':{'id':_0x51b2cd[_0x5397('0x3f')]['id']}})[_0x5397('0xe')](handleEntityNotFound(_0x123001,null))[_0x5397('0xe')](saveUpdates(_0x51b2cd[_0x5397('0x43')],null))['then'](respondWithResult(_0x123001,null))[_0x5397('0x16')](handleError(_0x123001,null));};exports[_0x5397('0x1f')]=function(_0x4bb538,_0xbb777c){return db[_0x5397('0x26')][_0x5397('0x41')]({'where':{'id':_0x4bb538[_0x5397('0x3f')]['id']}})[_0x5397('0xe')](handleEntityNotFound(_0xbb777c,null))[_0x5397('0xe')](removeEntity(_0xbb777c,null))[_0x5397('0x16')](handleError(_0xbb777c,null));};exports[_0x5397('0x44')]=function(_0x1a46bb,_0x5a0333){return db[_0x5397('0x26')]['describe']()[_0x5397('0xe')](respondWithResult(_0x5a0333,null))[_0x5397('0x16')](handleError(_0x5a0333,null));};exports[_0x5397('0x45')]=function(_0x21323e,_0x9d1f9c){var _0x14bc89=_0x5397('0x46');return interactionService[_0x5397('0x47')](_0x21323e,_0x14bc89)[_0x5397('0xe')](respondWithResult(_0x9d1f9c,null))[_0x5397('0x16')](handleError(_0x9d1f9c,null));};exports['reject']=function(_0x1b1742,_0x4eebd2){var _0x3d8f04={'agent':{},'channel':'whatsapp'};if(_0x1b1742['body']['id']){delete _0x1b1742['body']['id'];}_0x1b1742['body'][_0x5397('0x48')]=_0x1b1742[_0x5397('0x43')][_0x5397('0x48')]||_0x1b1742['user']['id'];_0x3d8f04[_0x5397('0x49')]['id']=_0x1b1742[_0x5397('0x43')]['UserId'];return db[_0x5397('0x26')][_0x5397('0x41')]({'where':{'id':_0x1b1742['params']['id'],'UserId':null}})[_0x5397('0xe')](handleEntityNotFound(_0x4eebd2,null))[_0x5397('0xe')](function(_0x20c78a){if(_0x20c78a){_0x3d8f04[_0x5397('0x15')]=_0x20c78a[_0x5397('0x4a')]({'plain':!![]});return db['WhatsappInteraction'][_0x5397('0x41')]({'where':{'id':_0x20c78a[_0x5397('0x4b')]}});}return null;})[_0x5397('0xe')](handleEntityNotFound(_0x4eebd2,null))[_0x5397('0xe')](function(_0x527df5){if(_0x527df5){_0x3d8f04[_0x5397('0x4c')]=_0x527df5[_0x5397('0x4a')]({'plain':!![]});interaction_log[_0x5397('0x4d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b1742[_0x5397('0x4e')]['id'],_0x1b1742['user'][_0x5397('0x22')],_0x1b1742[_0x5397('0x4e')][_0x5397('0x4f')],_0x3d8f04[_0x5397('0x4c')]['id'],_0x1b1742[_0x5397('0x43')]?JSON[_0x5397('0x50')](_0x1b1742[_0x5397('0x43')]):_0x5397('0x51'));return respondWithRpcPromise('RejectMessage',_0x5397('0x52'),_0x3d8f04);}return null;})[_0x5397('0xe')](function(_0x510f7d){var _0x42b05f=_0x5397('0x53')+_0x510f7d[_0x5397('0x15')][_0x5397('0x54')];return db[_0x5397('0x55')]['query'](_0x42b05f,{'type':db['Sequelize'][_0x5397('0x56')][_0x5397('0x57')],'raw':!![]})[_0x5397('0xe')](function(_0x15f75a){return _0x15f75a;});})['then'](function(_0x319dfe){if(_0x319dfe){_0x3d8f04[_0x5397('0x15')][_0x5397('0x58')]=_0x319dfe[0x0];if(!_0x1b1742[_0x5397('0x43')]['UserId'])return;return db['User'][_0x5397('0x41')]({'where':{'id':_0x1b1742[_0x5397('0x43')]['UserId'],'role':_0x5397('0x49')},'attributes':['id',_0x5397('0x22'),'fullname',_0x5397('0x59'),'internal'],'raw':!![]});}return null;})[_0x5397('0xe')](function(_0x48f0ab){if(!_0x48f0ab)return null;_0x3d8f04[_0x5397('0x15')][_0x5397('0x49')]=_0x48f0ab;return _0x3d8f04;})[_0x5397('0xe')](function(_0x16af1d){if(_0x16af1d){_0x16af1d[_0x5397('0x15')]['interface']=util[_0x5397('0x5a')]('SIP/%s',_0x1b1742[_0x5397('0x4e')][_0x5397('0x22')]);_0x16af1d[_0x5397('0x15')][_0x5397('0x5b')]=_0x3d8f04[_0x5397('0x5b')];_0x16af1d[_0x5397('0x15')][_0x5397('0x5c')]=_0x3d8f04['channel'];_0x16af1d[_0x5397('0x15')][_0x5397('0x5d')]=_0x5397('0x5e');respondWithRpcPromise(_0x5397('0x5f'),'EventManager',{'event':_0x5397('0x60'),'message':_0x16af1d[_0x5397('0x15')]},client9002);return _0x3d8f04;}return null;})[_0x5397('0xe')](respondWithResult(_0x4eebd2,null))[_0x5397('0x16')](handleError(_0x4eebd2,null));};exports[_0x5397('0x17')]=function(_0xfee184,_0x2b970f){if(_0xfee184[_0x5397('0x43')]['id']){delete _0xfee184[_0x5397('0x43')]['id'];}var _0x4a2057;return db[_0x5397('0x26')]['find']({'where':{'id':_0xfee184['params']['id']}})[_0x5397('0xe')](handleEntityNotFound(_0x2b970f,null))[_0x5397('0xe')](function(_0x2c6a24){if(_0x2c6a24){_0x4a2057=_0x2c6a24;return db[_0x5397('0x61')][_0x5397('0x41')]({'where':{'id':_0x2c6a24['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2b970f,null))[_0x5397('0xe')](function(_0x50c368){if(_0x50c368){logger[_0x5397('0x10')](_0x5397('0x62'),_0x5397('0x17'),'received\x20delivery\x20report\x20from',_0x50c368[_0x5397('0x63')],util[_0x5397('0x64')](_0xfee184[_0x5397('0x43')],{'showHidden':![],'depth':null}));switch(_0x50c368[_0x5397('0x63')]){case _0x5397('0x65'):if(_0xfee184[_0x5397('0x43')][_0x5397('0x66')]&&_0xfee184[_0x5397('0x43')][_0x5397('0x66')]===_0x4a2057[_0x5397('0x67')]&&_0xfee184[_0x5397('0x43')][_0x5397('0x68')]&&_0xfee184[_0x5397('0x43')]['MessageStatus']==='read'){return _0x4a2057[_0x5397('0x1e')]({'read':!![]});}else{logger[_0x5397('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5397('0x17'),_0x5397('0x65'),util[_0x5397('0x64')](_0xfee184[_0x5397('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x4a2057;}})['then'](respondWithResult(_0x2b970f,null))[_0x5397('0x16')](handleError(_0x2b970f,null));}; \ No newline at end of file +var _0x1d5a=['user','agent','get','WhatsappInteraction','interaction','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','send','index','rawAttributes','fieldName','key','map','name','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','includeAll','findAll','rows','catch','WhatsappMessage','keys','include','find','body','params','describe','accept','whatsapp','UserId'];(function(_0x52bdfe,_0x5282ec){var _0x5c6df7=function(_0x2355bb){while(--_0x2355bb){_0x52bdfe['push'](_0x52bdfe['shift']());}};_0x5c6df7(++_0x5282ec);}(_0x1d5a,0x16c));var _0xa1d5=function(_0x2e7d4d,_0x21a340){_0x2e7d4d=_0x2e7d4d-0x0;var _0x5e45f9=_0x1d5a[_0x2e7d4d];return _0x5e45f9;};'use strict';var util=require(_0xa1d5('0x0'));var _=require(_0xa1d5('0x1'));var Redis=require(_0xa1d5('0x2'));var interactionService=require(_0xa1d5('0x3'));var qs=require(_0xa1d5('0x4'));var logger=require('../../config/logger')(_0xa1d5('0x5'));var config=require('../../config/environment');var db=require(_0xa1d5('0x6'))['db'];config[_0xa1d5('0x7')]=_[_0xa1d5('0x8')](config[_0xa1d5('0x7')],{'host':_0xa1d5('0x9'),'port':0x18eb});var socket=require(_0xa1d5('0xa'))(new Redis(config['redis']));require(_0xa1d5('0xb'))[_0xa1d5('0xc')](socket);var jayson=require(_0xa1d5('0xd'));var client=jayson[_0xa1d5('0xe')][_0xa1d5('0xf')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')('whatsapp-interactions');function respondWithRpcPromise(_0x3a18cd,_0x383ab4,_0x307a07,_0x319f37){return new Promise(function(_0x5457b8,_0x576fdf){var _0x24e621=_0x319f37||client;return _0x24e621[_0xa1d5('0x10')](_0x3a18cd,_0x307a07)[_0xa1d5('0x11')](function(_0x49a030){logger[_0xa1d5('0x12')](_0xa1d5('0x13'),_0x383ab4,_0xa1d5('0x14'));logger['debug'](_0xa1d5('0x15'),_0x383ab4,'request\x20sent',JSON[_0xa1d5('0x16')](_0x49a030));if(_0x49a030[_0xa1d5('0x17')]){if(_0x49a030['error']['code']===0x1f4){logger[_0xa1d5('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x383ab4,_0x49a030[_0xa1d5('0x17')][_0xa1d5('0x18')]);return _0x576fdf(_0x49a030[_0xa1d5('0x17')][_0xa1d5('0x18')]);}logger[_0xa1d5('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x383ab4,_0x49a030['error'][_0xa1d5('0x18')]);return _0x5457b8(_0x49a030[_0xa1d5('0x17')][_0xa1d5('0x18')]);}else{logger['info'](_0xa1d5('0x13'),_0x383ab4,'request\x20sent');_0x5457b8(_0x49a030[_0xa1d5('0x19')][_0xa1d5('0x18')]);}})['catch'](function(_0x2ab0aa){logger['error'](_0xa1d5('0x13'),_0x383ab4,_0x2ab0aa);_0x576fdf(_0x2ab0aa);});});}function respondWithResult(_0x4f31a6,_0x49958f){_0x49958f=_0x49958f||0xc8;return function(_0x5b6287){if(_0x5b6287){return _0x4f31a6[_0xa1d5('0x1a')](_0x49958f)[_0xa1d5('0x1b')](_0x5b6287);}};}function respondWithFilteredResult(_0x5776d8,_0x1d4cf3){return function(_0x535208){if(_0x535208){var _0x29d37f=typeof _0x1d4cf3['offset']===_0xa1d5('0x1c')&&typeof _0x1d4cf3[_0xa1d5('0x1d')]===_0xa1d5('0x1c');var _0x1c595e=_0x535208[_0xa1d5('0x1e')];var _0x2d8594=_0x29d37f?0x0:_0x1d4cf3[_0xa1d5('0x1f')];var _0x2e2959=_0x29d37f?_0x535208[_0xa1d5('0x1e')]:_0x1d4cf3[_0xa1d5('0x1f')]+_0x1d4cf3[_0xa1d5('0x1d')];var _0x3f5356;if(_0x2e2959>=_0x1c595e){_0x2e2959=_0x1c595e;_0x3f5356=0xc8;}else{_0x3f5356=0xce;}_0x5776d8['status'](_0x3f5356);return _0x5776d8[_0xa1d5('0x20')](_0xa1d5('0x21'),_0x2d8594+'-'+_0x2e2959+'/'+_0x1c595e)['json'](_0x535208);}return null;};}function saveUpdates(_0x2785a9){return function(_0x570be5){if(_0x570be5){return _0x570be5[_0xa1d5('0x22')](_0x2785a9)['then'](function(_0x302971){return _0x302971;});}return null;};}function removeEntity(_0x18bbde){return function(_0x5bb81b){if(_0x5bb81b){return _0x5bb81b[_0xa1d5('0x23')]()['then'](function(){_0x18bbde['status'](0xcc)[_0xa1d5('0x24')]();});}};}function handleEntityNotFound(_0x13a6aa){return function(_0x4364c1){if(!_0x4364c1){_0x13a6aa[_0xa1d5('0x25')](0x194);}return _0x4364c1;};}function handleError(_0x3599b4,_0x28ac7c){_0x28ac7c=_0x28ac7c||0x1f4;return function(_0x7952e8){logger[_0xa1d5('0x17')](_0x7952e8[_0xa1d5('0x26')]);if(_0x7952e8['name']){delete _0x7952e8['name'];}_0x3599b4[_0xa1d5('0x1a')](_0x28ac7c)[_0xa1d5('0x27')](_0x7952e8);};}exports[_0xa1d5('0x28')]=function(_0x16a662,_0x3ea4c6){var _0xd0581f={},_0x4bfa7f={},_0x3d3313={'count':0x0,'rows':[]};var _0xb93ca0=_['map'](db['WhatsappMessage'][_0xa1d5('0x29')],function(_0x2e3754){return{'name':_0x2e3754[_0xa1d5('0x2a')],'type':_0x2e3754['type'][_0xa1d5('0x2b')]};});_0x4bfa7f['model']=_[_0xa1d5('0x2c')](_0xb93ca0,_0xa1d5('0x2d'));_0x4bfa7f[_0xa1d5('0x2e')]=_['keys'](_0x16a662[_0xa1d5('0x2e')]);_0x4bfa7f[_0xa1d5('0x2f')]=_['intersection'](_0x4bfa7f['model'],_0x4bfa7f[_0xa1d5('0x2e')]);_0xd0581f[_0xa1d5('0x30')]=_[_0xa1d5('0x31')](_0x4bfa7f[_0xa1d5('0x32')],qs[_0xa1d5('0x33')](_0x16a662[_0xa1d5('0x2e')][_0xa1d5('0x33')]));_0xd0581f[_0xa1d5('0x30')]=_0xd0581f[_0xa1d5('0x30')][_0xa1d5('0x34')]?_0xd0581f[_0xa1d5('0x30')]:_0x4bfa7f['model'];if(!_0x16a662[_0xa1d5('0x2e')][_0xa1d5('0x35')](_0xa1d5('0x36'))){_0xd0581f[_0xa1d5('0x1d')]=qs[_0xa1d5('0x1d')](_0x16a662[_0xa1d5('0x2e')][_0xa1d5('0x1d')]);_0xd0581f[_0xa1d5('0x1f')]=qs[_0xa1d5('0x1f')](_0x16a662[_0xa1d5('0x2e')]['offset']);}_0xd0581f[_0xa1d5('0x37')]=qs['sort'](_0x16a662[_0xa1d5('0x2e')][_0xa1d5('0x38')]);_0xd0581f[_0xa1d5('0x39')]=qs[_0xa1d5('0x2f')](_[_0xa1d5('0x3a')](_0x16a662['query'],_0x4bfa7f[_0xa1d5('0x2f')]),_0xb93ca0);if(_0x16a662[_0xa1d5('0x2e')]['filter']){_0xd0581f[_0xa1d5('0x39')]=_[_0xa1d5('0x3b')](_0xd0581f[_0xa1d5('0x39')],{'$or':_[_0xa1d5('0x2c')](_0xb93ca0,function(_0x4aab2a){if(_0x4aab2a[_0xa1d5('0x3c')]!=='VIRTUAL'){var _0xe944ae={};_0xe944ae[_0x4aab2a[_0xa1d5('0x2d')]]={'$like':'%'+_0x16a662['query']['filter']+'%'};return _0xe944ae;}})});}_0xd0581f=_[_0xa1d5('0x3b')]({},_0xd0581f,_0x16a662[_0xa1d5('0x3d')]);var _0x31cc33={'where':_0xd0581f[_0xa1d5('0x39')]};return db['WhatsappMessage'][_0xa1d5('0x1e')](_0x31cc33)[_0xa1d5('0x11')](function(_0x5694a8){_0x3d3313[_0xa1d5('0x1e')]=_0x5694a8;if(_0x16a662[_0xa1d5('0x2e')][_0xa1d5('0x3e')]){_0xd0581f['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xa1d5('0x3f')](_0xd0581f);})[_0xa1d5('0x11')](function(_0x3fa795){_0x3d3313[_0xa1d5('0x40')]=_0x3fa795;return _0x3d3313;})[_0xa1d5('0x11')](respondWithFilteredResult(_0x3ea4c6,_0xd0581f))[_0xa1d5('0x41')](handleError(_0x3ea4c6,null));};exports['show']=function(_0x5aa636,_0x1f196f){var _0x1c330b={'raw':!![],'where':{'id':_0x5aa636['params']['id']}},_0x321680={};_0x321680['model']=_['keys'](db[_0xa1d5('0x42')]['rawAttributes']);_0x321680[_0xa1d5('0x2e')]=_[_0xa1d5('0x43')](_0x5aa636[_0xa1d5('0x2e')]);_0x321680['filters']=_[_0xa1d5('0x31')](_0x321680[_0xa1d5('0x32')],_0x321680[_0xa1d5('0x2e')]);_0x1c330b['attributes']=_[_0xa1d5('0x31')](_0x321680[_0xa1d5('0x32')],qs[_0xa1d5('0x33')](_0x5aa636['query']['fields']));_0x1c330b['attributes']=_0x1c330b['attributes'][_0xa1d5('0x34')]?_0x1c330b[_0xa1d5('0x30')]:_0x321680[_0xa1d5('0x32')];if(_0x5aa636['query'][_0xa1d5('0x3e')]){_0x1c330b[_0xa1d5('0x44')]=[{'all':!![]}];}_0x1c330b=_[_0xa1d5('0x3b')]({},_0x1c330b,_0x5aa636[_0xa1d5('0x3d')]);return db['WhatsappMessage'][_0xa1d5('0x45')](_0x1c330b)['then'](handleEntityNotFound(_0x1f196f,null))[_0xa1d5('0x11')](respondWithResult(_0x1f196f,null))['catch'](handleError(_0x1f196f,null));};exports['create']=function(_0x5187b4,_0x30e881){return db[_0xa1d5('0x42')]['create'](_0x5187b4[_0xa1d5('0x46')],{})['then'](respondWithResult(_0x30e881,0xc9))[_0xa1d5('0x41')](handleError(_0x30e881,null));};exports['update']=function(_0xc9fd1a,_0x4cab36){if(_0xc9fd1a[_0xa1d5('0x46')]['id']){delete _0xc9fd1a[_0xa1d5('0x46')]['id'];}return db['WhatsappMessage'][_0xa1d5('0x45')]({'where':{'id':_0xc9fd1a[_0xa1d5('0x47')]['id']}})[_0xa1d5('0x11')](handleEntityNotFound(_0x4cab36,null))['then'](saveUpdates(_0xc9fd1a[_0xa1d5('0x46')],null))[_0xa1d5('0x11')](respondWithResult(_0x4cab36,null))[_0xa1d5('0x41')](handleError(_0x4cab36,null));};exports[_0xa1d5('0x23')]=function(_0x42f9cd,_0x30e2a3){return db[_0xa1d5('0x42')]['find']({'where':{'id':_0x42f9cd[_0xa1d5('0x47')]['id']}})['then'](handleEntityNotFound(_0x30e2a3,null))[_0xa1d5('0x11')](removeEntity(_0x30e2a3,null))['catch'](handleError(_0x30e2a3,null));};exports[_0xa1d5('0x48')]=function(_0x31aeff,_0x2b8afc){return db['WhatsappMessage'][_0xa1d5('0x48')]()[_0xa1d5('0x11')](respondWithResult(_0x2b8afc,null))[_0xa1d5('0x41')](handleError(_0x2b8afc,null));};exports[_0xa1d5('0x49')]=function(_0x26fc4e,_0x157dea){var _0x4571a3=_0xa1d5('0x4a');return interactionService['acceptMessage'](_0x26fc4e,_0x4571a3)[_0xa1d5('0x11')](respondWithResult(_0x157dea,null))[_0xa1d5('0x41')](handleError(_0x157dea,null));};exports['reject']=function(_0x4a4ca2,_0x16bdfd){var _0x58c360={'agent':{},'channel':'whatsapp'};if(_0x4a4ca2[_0xa1d5('0x46')]['id']){delete _0x4a4ca2['body']['id'];}_0x4a4ca2[_0xa1d5('0x46')]['UserId']=_0x4a4ca2[_0xa1d5('0x46')][_0xa1d5('0x4b')]||_0x4a4ca2[_0xa1d5('0x4c')]['id'];_0x58c360[_0xa1d5('0x4d')]['id']=_0x4a4ca2[_0xa1d5('0x46')][_0xa1d5('0x4b')];return db[_0xa1d5('0x42')][_0xa1d5('0x45')]({'where':{'id':_0x4a4ca2['params']['id'],'UserId':null}})[_0xa1d5('0x11')](handleEntityNotFound(_0x16bdfd,null))[_0xa1d5('0x11')](function(_0x580a74){if(_0x580a74){_0x58c360[_0xa1d5('0x18')]=_0x580a74[_0xa1d5('0x4e')]({'plain':!![]});return db[_0xa1d5('0x4f')]['find']({'where':{'id':_0x580a74['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x16bdfd,null))[_0xa1d5('0x11')](function(_0x1d8fd8){if(_0x1d8fd8){_0x58c360[_0xa1d5('0x50')]=_0x1d8fd8[_0xa1d5('0x4e')]({'plain':!![]});interaction_log[_0xa1d5('0x12')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a4ca2[_0xa1d5('0x4c')]['id'],_0x4a4ca2[_0xa1d5('0x4c')][_0xa1d5('0x2d')],_0x4a4ca2[_0xa1d5('0x4c')][_0xa1d5('0x51')],_0x58c360['interaction']['id'],_0x4a4ca2[_0xa1d5('0x46')]?JSON['stringify'](_0x4a4ca2[_0xa1d5('0x46')]):_0xa1d5('0x52'));return respondWithRpcPromise('RejectMessage',_0xa1d5('0x53'),_0x58c360);}return null;})[_0xa1d5('0x11')](function(_0x2391b0){var _0x11c0fa=_0xa1d5('0x54')+_0x2391b0['message']['ContactId'];return db[_0xa1d5('0x55')][_0xa1d5('0x2e')](_0x11c0fa,{'type':db['Sequelize'][_0xa1d5('0x56')][_0xa1d5('0x57')],'raw':!![]})[_0xa1d5('0x11')](function(_0x2ad15e){return _0x2ad15e;});})['then'](function(_0x1daa25){if(_0x1daa25){_0x58c360['message'][_0xa1d5('0x58')]=_0x1daa25[0x0];if(!_0x4a4ca2[_0xa1d5('0x46')][_0xa1d5('0x4b')])return;return db[_0xa1d5('0x59')][_0xa1d5('0x45')]({'where':{'id':_0x4a4ca2[_0xa1d5('0x46')]['UserId'],'role':_0xa1d5('0x4d')},'attributes':['id',_0xa1d5('0x2d'),_0xa1d5('0x5a'),_0xa1d5('0x5b'),_0xa1d5('0x5c')],'raw':!![]});}return null;})['then'](function(_0x34786f){if(!_0x34786f)return null;_0x58c360[_0xa1d5('0x18')]['agent']=_0x34786f;return _0x58c360;})[_0xa1d5('0x11')](function(_0xcd32bd){if(_0xcd32bd){_0xcd32bd['message'][_0xa1d5('0x5d')]=util[_0xa1d5('0x5e')](_0xa1d5('0x5f'),_0x4a4ca2[_0xa1d5('0x4c')][_0xa1d5('0x2d')]);_0xcd32bd[_0xa1d5('0x18')][_0xa1d5('0x60')]=_0x58c360[_0xa1d5('0x60')];_0xcd32bd['message'][_0xa1d5('0x61')]=_0x58c360[_0xa1d5('0x60')];_0xcd32bd[_0xa1d5('0x18')][_0xa1d5('0x62')]='reject';respondWithRpcPromise(_0xa1d5('0x63'),_0xa1d5('0x63'),{'event':_0xa1d5('0x64'),'message':_0xcd32bd[_0xa1d5('0x18')]},client9002);return _0x58c360;}return null;})[_0xa1d5('0x11')](respondWithResult(_0x16bdfd,null))[_0xa1d5('0x41')](handleError(_0x16bdfd,null));};exports[_0xa1d5('0x1a')]=function(_0x555bcd,_0x58b425){if(_0x555bcd[_0xa1d5('0x46')]['id']){delete _0x555bcd[_0xa1d5('0x46')]['id'];}var _0x56e863;return db[_0xa1d5('0x42')][_0xa1d5('0x45')]({'where':{'id':_0x555bcd[_0xa1d5('0x47')]['id']}})[_0xa1d5('0x11')](handleEntityNotFound(_0x58b425,null))[_0xa1d5('0x11')](function(_0xfb52a2){if(_0xfb52a2){_0x56e863=_0xfb52a2;return db[_0xa1d5('0x65')][_0xa1d5('0x45')]({'where':{'id':_0xfb52a2['WhatsappAccountId']}});}})[_0xa1d5('0x11')](handleEntityNotFound(_0x58b425,null))[_0xa1d5('0x11')](function(_0x5c5636){if(_0x5c5636){logger[_0xa1d5('0x66')](_0xa1d5('0x67'),_0xa1d5('0x1a'),'received\x20delivery\x20report\x20from',_0x5c5636[_0xa1d5('0x3c')],util[_0xa1d5('0x68')](_0x555bcd[_0xa1d5('0x46')],{'showHidden':![],'depth':null}));switch(_0x5c5636[_0xa1d5('0x3c')]){case _0xa1d5('0x69'):if(_0x555bcd[_0xa1d5('0x46')][_0xa1d5('0x6a')]&&_0x555bcd[_0xa1d5('0x46')][_0xa1d5('0x6a')]===_0x56e863[_0xa1d5('0x6b')]&&_0x555bcd[_0xa1d5('0x46')]['MessageStatus']&&_0x555bcd[_0xa1d5('0x46')][_0xa1d5('0x6c')]==='read'){return _0x56e863[_0xa1d5('0x22')]({'read':!![]});}else{logger[_0xa1d5('0x17')](_0xa1d5('0x6d'),'status',_0xa1d5('0x69'),util['inspect'](_0x555bcd[_0xa1d5('0x46')],{'showHidden':![],'depth':null}));}break;}return _0x56e863;}})['then'](respondWithResult(_0x58b425,null))[_0xa1d5('0x41')](handleError(_0x58b425,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6ffe138..2c1e90a 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 _0xaaa2=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xce754,_0x597abb){var _0x53e1e1=function(_0x2fb554){while(--_0x2fb554){_0xce754['push'](_0xce754['shift']());}};_0x53e1e1(++_0x597abb);}(_0xaaa2,0xac));var _0x2aaa=function(_0x37ac5f,_0x3777f3){_0x37ac5f=_0x37ac5f-0x0;var _0x889799=_0xaaa2[_0x37ac5f];return _0x889799;};'use strict';var EventEmitter=require(_0x2aaa('0x0'));var WhatsappMessage=require(_0x2aaa('0x1'))['db'][_0x2aaa('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2aaa('0x3')](0x0);var events={'afterCreate':_0x2aaa('0x4'),'afterUpdate':_0x2aaa('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfc076){return function(_0x482489,_0x35b5c8,_0x340071){WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076+':'+_0x482489['id'],_0x482489);WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076,_0x482489);_0x340071(null);};}for(var e in events){if(events[_0x2aaa('0x7')](e)){var event=events[e];WhatsappMessage[_0x2aaa('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x4746=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4746,0xc6));var _0x6474=function(_0x562758,_0x2eab21){_0x562758=_0x562758-0x0;var _0x2d8d3e=_0x4746[_0x562758];return _0x2d8d3e;};'use strict';var EventEmitter=require(_0x6474('0x0'));var WhatsappMessage=require(_0x6474('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x6474('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6474('0x3'),'afterDestroy':_0x6474('0x4')};function emitEvent(_0x863c56){return function(_0x156374,_0x1314f4,_0x4dfa1e){WhatsappMessageEvents[_0x6474('0x5')](_0x863c56+':'+_0x156374['id'],_0x156374);WhatsappMessageEvents[_0x6474('0x5')](_0x863c56,_0x156374);_0x4dfa1e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x6474('0x6')](e,emitEvent(event));}}module[_0x6474('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5f42618..fcd9164 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 _0xa66b=['then','update','createdAt','WhatsappAccount','WhatsappAccountId','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','Bearer\x20','message_id','statuses','catch','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xa66b,0x1ad));var _0xba66=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0xa66b[_0x2dc7c9];return _0x3e6536;};'use strict';var _=require(_0xba66('0x0'));var util=require(_0xba66('0x1'));var logger=require(_0xba66('0x2'))(_0xba66('0x3'));var moment=require(_0xba66('0x4'));var BPromise=require(_0xba66('0x5'));var rp=require(_0xba66('0x6'));var fetch=require(_0xba66('0x7'));var fs=require('fs');var path=require(_0xba66('0x8'));var rimraf=require(_0xba66('0x9'));var config=require(_0xba66('0xa'));var attributes=require(_0xba66('0xb'));module[_0xba66('0xc')]=function(_0x4e3dc0,_0x491595){return _0x4e3dc0[_0xba66('0xd')](_0xba66('0xe'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xba66('0xf')]},{'name':_0xba66('0x10'),'fields':[_0xba66('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a6708,_0x1a3484,_0x5039f7){var _0x29a5e9=_0x4e3dc0[_0xba66('0x12')];var _0x511a5d=_0x5a6708[_0xba66('0x13')]({'plain':!![]});if(_0x511a5d['direction'][_0xba66('0x14')]()==='in'||_0x511a5d[_0xba66('0x15')][_0xba66('0x14')]()===_0xba66('0x16')&&!_0x511a5d[_0xba66('0x17')]&&!_[_0xba66('0x18')](_0x511a5d[_0xba66('0x19')])){_0x29a5e9['WhatsappInteraction'][_0xba66('0x1a')]({'where':{'id':_0x511a5d['WhatsappInteractionId']}})[_0xba66('0x1b')](function(_0xa74345){if(_0xa74345){_0xa74345[_0xba66('0x1c')]({'lastMsgAt':_0x511a5d[_0xba66('0x1d')],'lastMsgDirection':_0x511a5d[_0xba66('0x15')][_0xba66('0x14')]()});}})['catch'](function(_0x1973c8){console['error'](_0x1973c8);});}if(_0x511a5d[_0xba66('0x15')]==='out'&&!_0x511a5d['secret']){var _0x3242f9;_0x29a5e9[_0xba66('0x1e')]['find']({'where':{'id':_0x511a5d[_0xba66('0x1f')]},'raw':!![]})[_0xba66('0x1b')](function(_0x3de14e){_0x3242f9=_0x3de14e;if(_0x3242f9&&_0x3242f9['type']){switch(_0x3242f9['type']){case _0xba66('0x20'):var _0x4d0ea3=require(_0xba66('0x20'));if(_0x3242f9[_0xba66('0x21')]&&_0x3242f9[_0xba66('0x22')]&&_0x3242f9[_0xba66('0x23')]){var _0x236c3b=new _0x4d0ea3(_0x3242f9['accountSid'],_0x3242f9[_0xba66('0x22')]);_0x236c3b[_0xba66('0x24')]['create']({'body':_0x511a5d['body'],'to':_0xba66('0x25')+_0x511a5d[_0xba66('0x23')],'from':'whatsapp:'+_0x3242f9['phone'],'statusCallback':_0x3242f9[_0xba66('0x26')]+_0xba66('0x27')+_0x511a5d['id']+_0xba66('0x28')+_0x3242f9['token']})[_0xba66('0x1b')](function(_0x244ffa){if(_0x244ffa['sid']){return _0x5a6708[_0xba66('0x1c')]({'messageId':_0x244ffa[_0xba66('0x29')]});}})['catch'](function(_0x398d35){logger[_0xba66('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xba66('0x2b'),_0xba66('0x20'),util[_0xba66('0x2c')](_0x398d35,{'showHidden':![],'depth':null}));});}else{logger[_0xba66('0x2a')](_0xba66('0x2d'),_0xba66('0x2b'),_0xba66('0x20'),_0xba66('0x2e'));}break;case _0xba66('0x2f'):var _0x41ee56=_0x3242f9[_0xba66('0x21')];var _0x5c8a97=_0x3242f9[_0xba66('0x22')];var _0x21472c=_0x3242f9['baseUrl']+'/whatsapp/v1/'+_0x41ee56+_0xba66('0x30');var _0x4ca503={'to':[_0x511a5d[_0xba66('0x23')]],'message':{'type':_0xba66('0x31'),'text':_0x511a5d[_0xba66('0x11')]}};var _0x103806={'method':'POST','uri':_0x21472c,'headers':{'Authorization':_0xba66('0x32')+_0x5c8a97,'Content-Type':'application/json'},'body':_0x4ca503,'json':!![]};rp(_0x103806)['then'](function(_0x3b3de9){if(_0x3b3de9['statuses'][0x0][_0xba66('0x33')]){return _0x5a6708[_0xba66('0x1c')]({'messageId':_0x3b3de9[_0xba66('0x34')][0x0][_0xba66('0x33')]});}})[_0xba66('0x35')](function(_0x2a046b){logger[_0xba66('0x36')](_0xba66('0x37'),_0x2a046b);});break;}}})['finally'](function(){_0x5039f7();});}else{_0x5039f7();}}},'charset':'utf8mb4','collate':_0xba66('0x38')});}; \ No newline at end of file +var _0x65c7=['sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0x65c7,0x137));var _0x765c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65c7[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x765c('0x0'));var logger=require(_0x765c('0x1'))(_0x765c('0x2'));var moment=require(_0x765c('0x3'));var BPromise=require('bluebird');var rp=require(_0x765c('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x765c('0x5'));var rimraf=require(_0x765c('0x6'));var config=require(_0x765c('0x7'));var attributes=require(_0x765c('0x8'));module[_0x765c('0x9')]=function(_0x87e37f,_0x598dc9){return _0x87e37f[_0x765c('0xa')](_0x765c('0xb'),attributes,{'tableName':_0x765c('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x765c('0xd'),'fields':[_0x765c('0xe')],'type':_0x765c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c0d6c,_0x221031,_0x51db98){var _0x5ae3a5=_0x87e37f['models'];var _0x4e69ea=_0x5c0d6c[_0x765c('0x10')]({'plain':!![]});if(_0x4e69ea['direction'][_0x765c('0x11')]()==='in'||_0x4e69ea[_0x765c('0x12')]['toLowerCase']()==='out'&&!_0x4e69ea[_0x765c('0x13')]&&!_[_0x765c('0x14')](_0x4e69ea[_0x765c('0x15')])){_0x5ae3a5[_0x765c('0x16')]['findOne']({'where':{'id':_0x4e69ea[_0x765c('0x17')]}})[_0x765c('0x18')](function(_0x1aa26a){if(_0x1aa26a){_0x1aa26a[_0x765c('0x19')]({'lastMsgAt':_0x4e69ea[_0x765c('0x1a')],'lastMsgDirection':_0x4e69ea[_0x765c('0x12')]['toLowerCase']()});}})[_0x765c('0x1b')](function(_0x432854){console[_0x765c('0x1c')](_0x432854);});}if(_0x4e69ea[_0x765c('0x12')]===_0x765c('0x1d')&&!_0x4e69ea['secret']){var _0x257937;_0x5ae3a5[_0x765c('0x1e')][_0x765c('0x1f')]({'where':{'id':_0x4e69ea[_0x765c('0x20')]},'raw':!![]})['then'](function(_0x516fcf){_0x257937=_0x516fcf;if(_0x257937&&_0x257937[_0x765c('0x21')]){switch(_0x257937[_0x765c('0x21')]){case _0x765c('0x22'):var _0x19fa36=require('twilio');if(_0x257937['accountSid']&&_0x257937[_0x765c('0x23')]&&_0x257937[_0x765c('0x24')]){var _0x2e0845=new _0x19fa36(_0x257937[_0x765c('0x25')],_0x257937[_0x765c('0x23')]);_0x2e0845[_0x765c('0x26')]['create']({'body':_0x4e69ea['body'],'to':_0x765c('0x27')+_0x4e69ea[_0x765c('0x24')],'from':'whatsapp:'+_0x257937[_0x765c('0x24')],'statusCallback':_0x257937[_0x765c('0x28')]+_0x765c('0x29')+_0x4e69ea['id']+_0x765c('0x2a')+_0x257937['token']})[_0x765c('0x18')](function(_0x35df87){if(_0x35df87['sid']){return _0x5c0d6c['update']({'messageId':_0x35df87[_0x765c('0x2b')]});}})[_0x765c('0x1b')](function(_0x3adabb){logger[_0x765c('0x1c')](_0x765c('0x2c'),_0x765c('0x2d'),_0x765c('0x22'),util['inspect'](_0x3adabb,{'showHidden':![],'depth':null}));});}else{logger[_0x765c('0x1c')](_0x765c('0x2c'),_0x765c('0x2d'),'twilio',_0x765c('0x2e'));}break;case _0x765c('0x2f'):var _0x3cbdc8=_0x257937['accountSid'];var _0x4f1717=_0x257937['authToken'];var _0x440176=_0x257937[_0x765c('0x30')]+_0x765c('0x31')+_0x3cbdc8+_0x765c('0x32');var _0xf1b2c4={'to':[_0x4e69ea['phone']],'message':{'type':_0x765c('0x33'),'text':_0x4e69ea[_0x765c('0xe')]}};var _0x10ee33={'method':'POST','uri':_0x440176,'headers':{'Authorization':_0x765c('0x34')+_0x4f1717,'Content-Type':_0x765c('0x35')},'body':_0xf1b2c4,'json':!![]};rp(_0x10ee33)[_0x765c('0x18')](function(_0x2d4a76){if(_0x2d4a76[_0x765c('0x36')][0x0][_0x765c('0x37')]){return _0x5c0d6c['update']({'messageId':_0x2d4a76[_0x765c('0x36')][0x0][_0x765c('0x37')]});}})[_0x765c('0x1b')](function(_0x2f56f0){logger[_0x765c('0x38')](_0x765c('0x39'),_0x2f56f0);});break;}}})['finally'](function(){_0x51db98();});}else{_0x51db98();}}},'charset':'utf8mb4','collate':_0x765c('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ade8f1e..e0e65bb 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 _0x9bc5=['options','raw','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x254cb4,_0x43b2a6){var _0x4353ac=function(_0x1c0ae3){while(--_0x1c0ae3){_0x254cb4['push'](_0x254cb4['shift']());}};_0x4353ac(++_0x43b2a6);}(_0x9bc5,0x1c3));var _0x59bc=function(_0x1f96f9,_0x58c06e){_0x1f96f9=_0x1f96f9-0x0;var _0x2e236f=_0x9bc5[_0x1f96f9];return _0x2e236f;};'use strict';var _=require('lodash');var util=require(_0x59bc('0x0'));var moment=require('moment');var BPromise=require(_0x59bc('0x1'));var rs=require(_0x59bc('0x2'));var fs=require('fs');var Redis=require(_0x59bc('0x3'));var db=require(_0x59bc('0x4'))['db'];var utils=require(_0x59bc('0x5'));var logger=require(_0x59bc('0x6'))(_0x59bc('0x7'));var config=require('../../config/environment');var jayson=require(_0x59bc('0x8'));var client=jayson[_0x59bc('0x9')]['http']({'port':0x232a});config[_0x59bc('0xa')]=_[_0x59bc('0xb')](config['redis'],{'host':_0x59bc('0xc'),'port':0x18eb});var socket=require(_0x59bc('0xd'))(new Redis(config['redis']));require(_0x59bc('0xe'))[_0x59bc('0xf')](socket);function respondWithRpcPromise(_0x5a7e67,_0xde9dfc,_0xd33b8c){return new BPromise(function(_0x572647,_0x1b68f3){return client[_0x59bc('0x10')](_0x5a7e67,_0xd33b8c)[_0x59bc('0x11')](function(_0x321e0c){logger[_0x59bc('0x12')](_0x59bc('0x13'),_0xde9dfc,'request\x20sent');logger[_0x59bc('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xde9dfc,_0x59bc('0x15'),JSON['stringify'](_0x321e0c));if(_0x321e0c[_0x59bc('0x16')]){if(_0x321e0c[_0x59bc('0x16')][_0x59bc('0x17')]===0x1f4){logger[_0x59bc('0x16')](_0x59bc('0x13'),_0xde9dfc,_0x321e0c[_0x59bc('0x16')][_0x59bc('0x18')]);return _0x1b68f3(_0x321e0c['error'][_0x59bc('0x18')]);}logger[_0x59bc('0x16')](_0x59bc('0x13'),_0xde9dfc,_0x321e0c[_0x59bc('0x16')]['message']);return _0x572647(_0x321e0c[_0x59bc('0x16')][_0x59bc('0x18')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xde9dfc,'request\x20sent');_0x572647(_0x321e0c['result'][_0x59bc('0x18')]);}})[_0x59bc('0x19')](function(_0x3a5d48){logger[_0x59bc('0x16')](_0x59bc('0x13'),_0xde9dfc,_0x3a5d48);_0x1b68f3(_0x3a5d48);});});}exports[_0x59bc('0x1a')]=function(_0x59ff8a){var _0x366332=this;return new Promise(function(_0x2454b7,_0x516205){return db[_0x59bc('0x1b')][_0x59bc('0x1c')](_0x59ff8a['body'],{'raw':_0x59ff8a[_0x59bc('0x1d')]?_0x59ff8a[_0x59bc('0x1d')][_0x59bc('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1508c1){logger[_0x59bc('0x12')](_0x59bc('0x1a'),_0x59ff8a);logger[_0x59bc('0x14')](_0x59bc('0x1a'),_0x59ff8a,JSON[_0x59bc('0x1f')](_0x1508c1));_0x2454b7(_0x1508c1);})[_0x59bc('0x19')](function(_0x310503){logger[_0x59bc('0x16')](_0x59bc('0x1a'),_0x310503['message'],_0x59ff8a);_0x516205(_0x366332[_0x59bc('0x16')](0x1f4,_0x310503[_0x59bc('0x18')]));});});}; \ No newline at end of file +var _0xbbdc=['./whatsappMessage.socket','register','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','info','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter'];(function(_0x2b1810,_0x560a03){var _0x1a0c0c=function(_0x27200f){while(--_0x27200f){_0x2b1810['push'](_0x2b1810['shift']());}};_0x1a0c0c(++_0x560a03);}(_0xbbdc,0x1e3));var _0xcbbd=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0xbbdc[_0x57db49];return _0xd0636f;};'use strict';var _=require('lodash');var util=require(_0xcbbd('0x0'));var moment=require(_0xcbbd('0x1'));var BPromise=require(_0xcbbd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbbd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbd('0x4'))(_0xcbbd('0x5'));var config=require(_0xcbbd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcbbd('0x7')][_0xcbbd('0x8')]({'port':0x232a});config[_0xcbbd('0x9')]=_['defaults'](config[_0xcbbd('0x9')],{'host':_0xcbbd('0xa'),'port':0x18eb});var socket=require(_0xcbbd('0xb'))(new Redis(config[_0xcbbd('0x9')]));require(_0xcbbd('0xc'))[_0xcbbd('0xd')](socket);function respondWithRpcPromise(_0x15838d,_0x31f438,_0x12e11e){return new BPromise(function(_0x1df8ba,_0x4ca97c){return client[_0xcbbd('0xe')](_0x15838d,_0x12e11e)[_0xcbbd('0xf')](function(_0x392ab6){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x31f438,_0xcbbd('0x10'));logger[_0xcbbd('0x11')](_0xcbbd('0x12'),_0x31f438,_0xcbbd('0x10'),JSON[_0xcbbd('0x13')](_0x392ab6));if(_0x392ab6[_0xcbbd('0x14')]){if(_0x392ab6[_0xcbbd('0x14')][_0xcbbd('0x15')]===0x1f4){logger[_0xcbbd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x31f438,_0x392ab6[_0xcbbd('0x14')][_0xcbbd('0x16')]);return _0x4ca97c(_0x392ab6['error'][_0xcbbd('0x16')]);}logger['error'](_0xcbbd('0x17'),_0x31f438,_0x392ab6['error'][_0xcbbd('0x16')]);return _0x1df8ba(_0x392ab6[_0xcbbd('0x14')][_0xcbbd('0x16')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x31f438,'request\x20sent');_0x1df8ba(_0x392ab6[_0xcbbd('0x18')][_0xcbbd('0x16')]);}})[_0xcbbd('0x19')](function(_0x5c19eb){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x31f438,_0x5c19eb);_0x4ca97c(_0x5c19eb);});});}exports[_0xcbbd('0x1a')]=function(_0x1119eb){var _0x523287=this;return new Promise(function(_0x3dc14c,_0x1154c0){return db[_0xcbbd('0x1b')][_0xcbbd('0x1c')](_0x1119eb[_0xcbbd('0x1d')],{'raw':_0x1119eb[_0xcbbd('0x1e')]?_0x1119eb['options'][_0xcbbd('0x1f')]===undefined?!![]:![]:!![]})[_0xcbbd('0xf')](function(_0x24819f){logger[_0xcbbd('0x20')](_0xcbbd('0x1a'),_0x1119eb);logger[_0xcbbd('0x11')](_0xcbbd('0x1a'),_0x1119eb,JSON['stringify'](_0x24819f));_0x3dc14c(_0x24819f);})[_0xcbbd('0x19')](function(_0x5166fb){logger[_0xcbbd('0x14')](_0xcbbd('0x1a'),_0x5166fb[_0xcbbd('0x16')],_0x1119eb);_0x1154c0(_0x523287[_0xcbbd('0x14')](0x1f4,_0x5166fb['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f04f913..2b4ed25 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 _0x2a24=['emit','removeListener','register','length','./whatsappMessage.events','save','remove','update'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x2a24,0xd4));var _0x42a2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2a24[_0x2d7f0e];return _0x110b07;};'use strict';var WhatsappMessageEvents=require(_0x42a2('0x0'));var events=[_0x42a2('0x1'),_0x42a2('0x2'),_0x42a2('0x3')];function createListener(_0x41c4ac,_0x32a147){return function(_0xa973){_0x32a147[_0x42a2('0x4')](_0x41c4ac,_0xa973);};}function removeListener(_0xc7929f,_0x33a2cd){return function(){WhatsappMessageEvents[_0x42a2('0x5')](_0xc7929f,_0x33a2cd);};}exports[_0x42a2('0x6')]=function(_0x393833){for(var _0x278090=0x0,_0x53dd64=events[_0x42a2('0x7')];_0x278090<_0x53dd64;_0x278090++){var _0x7d3f84=events[_0x278090];var _0x2f2793=createListener('whatsappMessage:'+_0x7d3f84,_0x393833);WhatsappMessageEvents['on'](_0x7d3f84,_0x2f2793);}}; \ No newline at end of file +var _0xdda2=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x10cff2,_0x4af93d){var _0xbef88d=function(_0x2a33db){while(--_0x2a33db){_0x10cff2['push'](_0x10cff2['shift']());}};_0xbef88d(++_0x4af93d);}(_0xdda2,0x199));var _0x2dda=function(_0x36a66f,_0x473601){_0x36a66f=_0x36a66f-0x0;var _0x4d88ec=_0xdda2[_0x36a66f];return _0x4d88ec;};'use strict';var WhatsappMessageEvents=require(_0x2dda('0x0'));var events=[_0x2dda('0x1'),_0x2dda('0x2'),_0x2dda('0x3')];function createListener(_0xb8d3a4,_0x259b3f){return function(_0x5e1916){_0x259b3f[_0x2dda('0x4')](_0xb8d3a4,_0x5e1916);};}function removeListener(_0x5469c9,_0x27de10){return function(){WhatsappMessageEvents[_0x2dda('0x5')](_0x5469c9,_0x27de10);};}exports[_0x2dda('0x6')]=function(_0x475b72){for(var _0x3c5226=0x0,_0x491a9a=events[_0x2dda('0x7')];_0x3c5226<_0x491a9a;_0x3c5226++){var _0x1348b5=events[_0x3c5226];var _0x2513ff=createListener(_0x2dda('0x8')+_0x1348b5,_0x475b72);WhatsappMessageEvents['on'](_0x1348b5,_0x2513ff);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5009ba5..ee08eb7 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 _0xa343=['getAgents','post','create','/:id/teams','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/users'];(function(_0x222b3f,_0x133be7){var _0x20b57a=function(_0x408ec3){while(--_0x408ec3){_0x222b3f['push'](_0x222b3f['shift']());}};_0x20b57a(++_0x133be7);}(_0xa343,0x1a1));var _0x3a34=function(_0x5f08f4,_0x593a1b){_0x5f08f4=_0x5f08f4-0x0;var _0x4f4560=_0xa343[_0x5f08f4];return _0x4f4560;};'use strict';var multer=require(_0x3a34('0x0'));var util=require(_0x3a34('0x1'));var path=require(_0x3a34('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a34('0x3')]();var fs_extra=require(_0x3a34('0x4'));var auth=require(_0x3a34('0x5'));var interaction=require(_0x3a34('0x6'));var config=require(_0x3a34('0x7'));var controller=require(_0x3a34('0x8'));router[_0x3a34('0x9')]('/',auth[_0x3a34('0xa')](),controller[_0x3a34('0xb')]);router[_0x3a34('0x9')](_0x3a34('0xc'),auth[_0x3a34('0xa')](),controller[_0x3a34('0xd')]);router[_0x3a34('0x9')](_0x3a34('0xe'),auth[_0x3a34('0xa')](),controller[_0x3a34('0xf')]);router[_0x3a34('0x9')]('/:id/members',auth[_0x3a34('0xa')](),controller[_0x3a34('0x10')]);router[_0x3a34('0x9')]('/:id/teams',auth[_0x3a34('0xa')](),controller['getTeams']);router[_0x3a34('0x9')](_0x3a34('0x11'),auth[_0x3a34('0xa')](),controller[_0x3a34('0x12')]);router[_0x3a34('0x13')]('/',auth[_0x3a34('0xa')](),controller[_0x3a34('0x14')]);router[_0x3a34('0x13')](_0x3a34('0x15'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3a34('0x13')](_0x3a34('0x11'),auth['isAuthenticated'](),controller[_0x3a34('0x16')]);router[_0x3a34('0x17')]('/:id',auth[_0x3a34('0xa')](),controller[_0x3a34('0x18')]);router['delete'](_0x3a34('0xe'),auth['isAuthenticated'](),controller[_0x3a34('0x19')]);router[_0x3a34('0x1a')](_0x3a34('0x15'),auth[_0x3a34('0xa')](),controller[_0x3a34('0x1b')]);router['delete'](_0x3a34('0x11'),auth[_0x3a34('0xa')](),controller['removeAgents']);module[_0x3a34('0x1c')]=router; \ No newline at end of file +var _0xb768=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1158cf,_0x443002){var _0x479276=function(_0x1c6774){while(--_0x1c6774){_0x1158cf['push'](_0x1158cf['shift']());}};_0x479276(++_0x443002);}(_0xb768,0x1bb));var _0x8b76=function(_0x55f3a8,_0x4fe35a){_0x55f3a8=_0x55f3a8-0x0;var _0x46fa7e=_0xb768[_0x55f3a8];return _0x46fa7e;};'use strict';var multer=require(_0x8b76('0x0'));var util=require(_0x8b76('0x1'));var path=require(_0x8b76('0x2'));var timeout=require(_0x8b76('0x3'));var express=require(_0x8b76('0x4'));var router=express['Router']();var fs_extra=require(_0x8b76('0x5'));var auth=require(_0x8b76('0x6'));var interaction=require(_0x8b76('0x7'));var config=require(_0x8b76('0x8'));var controller=require(_0x8b76('0x9'));router[_0x8b76('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b76('0xa')](_0x8b76('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8b76('0xc'),auth[_0x8b76('0xd')](),controller[_0x8b76('0xe')]);router[_0x8b76('0xa')](_0x8b76('0xf'),auth[_0x8b76('0xd')](),controller[_0x8b76('0x10')]);router['get'](_0x8b76('0x11'),auth[_0x8b76('0xd')](),controller[_0x8b76('0x12')]);router['get'](_0x8b76('0x13'),auth['isAuthenticated'](),controller[_0x8b76('0x14')]);router[_0x8b76('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b76('0x15')]('/:id/teams',auth[_0x8b76('0xd')](),controller[_0x8b76('0x16')]);router[_0x8b76('0x15')](_0x8b76('0x13'),auth['isAuthenticated'](),controller[_0x8b76('0x17')]);router['put']('/:id',auth[_0x8b76('0xd')](),controller[_0x8b76('0x18')]);router[_0x8b76('0x19')](_0x8b76('0xc'),auth[_0x8b76('0xd')](),controller[_0x8b76('0x1a')]);router[_0x8b76('0x19')](_0x8b76('0x11'),auth['isAuthenticated'](),controller[_0x8b76('0x1b')]);router[_0x8b76('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x8b76('0x1c')]);module[_0x8b76('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a7c500d..9f19f40 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 _0xbde2=['rrmemory','beepall','exports','STRING','name','ENUM'];(function(_0x48ee52,_0xc5949a){var _0x198a1a=function(_0x5f0073){while(--_0x5f0073){_0x48ee52['push'](_0x48ee52['shift']());}};_0x198a1a(++_0xc5949a);}(_0xbde2,0x7a));var _0x2bde=function(_0x4c85a,_0x5e4cfc){_0x4c85a=_0x4c85a-0x0;var _0x2f2eb0=_0xbde2[_0x4c85a];return _0x2f2eb0;};'use strict';var Sequelize=require('sequelize');module[_0x2bde('0x0')]={'name':{'type':Sequelize[_0x2bde('0x1')],'unique':_0x2bde('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2bde('0x3')](_0x2bde('0x4'),_0x2bde('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x2bde('0x1')]}}; \ No newline at end of file +var _0xfc03=['roundrobin','sequelize','STRING','name','ENUM','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc03,0x16f));var _0x3fc0=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xfc03[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0x3fc0('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fc0('0x1')],'unique':_0x3fc0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3fc0('0x3')]('rrmemory',_0x3fc0('0x4'),_0x3fc0('0x5'))},'description':{'type':Sequelize[_0x3fc0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 366e7d7..49e8a45 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 _0x3b71=['agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','query','findAll','catch','params','keys','filters','model','attributes','intersection','fields','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','hasOwnProperty','order','sort','pick','WhatsappQueueId','filter','merge','UserWhatsappQueue','User','findAndCountAll','UserId'];(function(_0x4681eb,_0x398943){var _0x4a2bb2=function(_0x5a45e6){while(--_0x5a45e6){_0x4681eb['push'](_0x4681eb['shift']());}};_0x4a2bb2(++_0x398943);}(_0x3b71,0x12d));var _0x13b7=function(_0x413e41,_0x11cab2){_0x413e41=_0x413e41-0x0;var _0x4f6318=_0x3b71[_0x413e41];return _0x4f6318;};'use strict';var BPromise=require('bluebird');var util=require(_0x13b7('0x0'));var _=require(_0x13b7('0x1'));var squel=require(_0x13b7('0x2'));var Redis=require(_0x13b7('0x3'));var qs=require(_0x13b7('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x13b7('0x5'));var db=require(_0x13b7('0x6'))['db'];config[_0x13b7('0x7')]=_[_0x13b7('0x8')](config['redis'],{'host':_0x13b7('0x9'),'port':0x18eb});var socket=require(_0x13b7('0xa'))(new Redis(config[_0x13b7('0x7')]));require(_0x13b7('0xb'))[_0x13b7('0xc')](socket);function respondWithStatusCode(_0x308670,_0x1bf112){_0x1bf112=_0x1bf112||0xcc;return function(_0x22321d){if(_0x22321d){return _0x308670[_0x13b7('0xd')](_0x1bf112);}return _0x308670[_0x13b7('0xe')](_0x1bf112)[_0x13b7('0xf')]();};}function respondWithResult(_0xe6468c,_0x2a7f23){_0x2a7f23=_0x2a7f23||0xc8;return function(_0x10cfd1){if(_0x10cfd1){return _0xe6468c[_0x13b7('0xe')](_0x2a7f23)[_0x13b7('0x10')](_0x10cfd1);}};}function respondWithFilteredResult(_0x476d0f,_0x28125f){return function(_0x2f1716){if(_0x2f1716){var _0xe15f4a=typeof _0x28125f[_0x13b7('0x11')]===_0x13b7('0x12')&&typeof _0x28125f[_0x13b7('0x13')]===_0x13b7('0x12');var _0x5a4471=_0x2f1716[_0x13b7('0x14')];var _0x22d41e=_0xe15f4a?0x0:_0x28125f['offset'];var _0x3699ef=_0xe15f4a?_0x2f1716[_0x13b7('0x14')]:_0x28125f[_0x13b7('0x11')]+_0x28125f[_0x13b7('0x13')];var _0x4b18a0;if(_0x3699ef>=_0x5a4471){_0x3699ef=_0x5a4471;_0x4b18a0=0xc8;}else{_0x4b18a0=0xce;}_0x476d0f[_0x13b7('0xe')](_0x4b18a0);return _0x476d0f['set'](_0x13b7('0x15'),_0x22d41e+'-'+_0x3699ef+'/'+_0x5a4471)['json'](_0x2f1716);}return null;};}function saveUpdates(_0x316b1f){return function(_0x11f6f0){if(_0x11f6f0){return _0x11f6f0[_0x13b7('0x16')](_0x316b1f)[_0x13b7('0x17')](function(_0x7c3bb8){return _0x7c3bb8;});}return null;};}function removeEntity(_0x1e2613){return function(_0xdf2d8e){if(_0xdf2d8e){return _0xdf2d8e[_0x13b7('0x18')]()[_0x13b7('0x17')](function(){var _0x5a34fd=_0xdf2d8e[_0x13b7('0x19')]({'plain':!![]});var _0x166719='WhatsappQueues';return db[_0x13b7('0x1a')][_0x13b7('0x18')]({'where':{'type':_0x166719,'resourceId':_0x5a34fd['id']}})[_0x13b7('0x17')](function(){return _0xdf2d8e;});})[_0x13b7('0x17')](function(){_0x1e2613[_0x13b7('0xe')](0xcc)[_0x13b7('0xf')]();});}};}function handleEntityNotFound(_0x597fef){return function(_0x369138){if(!_0x369138){_0x597fef[_0x13b7('0xd')](0x194);}return _0x369138;};}function handleError(_0x279813,_0x5061e4){_0x5061e4=_0x5061e4||0x1f4;return function(_0x1cddc1){logger[_0x13b7('0x1b')](_0x1cddc1[_0x13b7('0x1c')]);if(_0x1cddc1[_0x13b7('0x1d')]){delete _0x1cddc1['name'];}_0x279813[_0x13b7('0xe')](_0x5061e4)[_0x13b7('0x1e')](_0x1cddc1);};}exports[_0x13b7('0x1f')]=function(_0x2b73d4,_0x5803a2){var _0x35c29d={};var _0x3f1237={'count':0x0,'rows':[]};var _0x49e98d=_[_0x13b7('0x20')](db[_0x13b7('0x21')][_0x13b7('0x22')],function(_0x26e8cc){return{'name':_0x26e8cc[_0x13b7('0x23')],'type':_0x26e8cc[_0x13b7('0x24')][_0x13b7('0x25')]};});_0x35c29d=qs[_0x13b7('0x26')](_0x49e98d,_0x2b73d4);var _0x2c2b20={'where':_0x35c29d[_0x13b7('0x27')]};return db[_0x13b7('0x21')][_0x13b7('0x14')](_0x2c2b20)[_0x13b7('0x17')](function(_0x359df3){_0x3f1237[_0x13b7('0x14')]=_0x359df3;_0x35c29d['include']=qs['include'](_0x2b73d4[_0x13b7('0x28')]);return db['WhatsappQueue'][_0x13b7('0x29')](_0x35c29d);})[_0x13b7('0x17')](function(_0x5af13d){_0x3f1237['rows']=_0x5af13d;return _0x3f1237;})[_0x13b7('0x17')](respondWithFilteredResult(_0x5803a2,_0x35c29d))[_0x13b7('0x2a')](handleError(_0x5803a2,null));};exports['show']=function(_0x16e6ca,_0x51ad62){var _0x4378dd={'raw':!![],'where':{'id':_0x16e6ca[_0x13b7('0x2b')]['id']}},_0x5cf970={};_0x5cf970['model']=_[_0x13b7('0x2c')](db[_0x13b7('0x21')][_0x13b7('0x22')]);_0x5cf970[_0x13b7('0x28')]=_[_0x13b7('0x2c')](_0x16e6ca[_0x13b7('0x28')]);_0x5cf970[_0x13b7('0x2d')]=_['intersection'](_0x5cf970[_0x13b7('0x2e')],_0x5cf970[_0x13b7('0x28')]);_0x4378dd[_0x13b7('0x2f')]=_[_0x13b7('0x30')](_0x5cf970['model'],qs['fields'](_0x16e6ca[_0x13b7('0x28')][_0x13b7('0x31')]));_0x4378dd['attributes']=_0x4378dd[_0x13b7('0x2f')][_0x13b7('0x32')]?_0x4378dd[_0x13b7('0x2f')]:_0x5cf970[_0x13b7('0x2e')];if(_0x16e6ca[_0x13b7('0x28')]['includeAll']){_0x4378dd[_0x13b7('0x33')]=[{'all':!![]}];}_0x4378dd=_['merge']({},_0x4378dd,_0x16e6ca[_0x13b7('0x34')]);return db[_0x13b7('0x21')]['find'](_0x4378dd)[_0x13b7('0x17')](handleEntityNotFound(_0x51ad62,null))[_0x13b7('0x17')](respondWithResult(_0x51ad62,null))[_0x13b7('0x2a')](handleError(_0x51ad62,null));};exports[_0x13b7('0x35')]=function(_0x3c4ec6,_0x5ba00a){return db[_0x13b7('0x21')][_0x13b7('0x35')](_0x3c4ec6[_0x13b7('0x36')],{})['then'](function(_0x128a2a){var _0x24588b=_0x3c4ec6[_0x13b7('0x37')][_0x13b7('0x19')]({'plain':!![]});if(!_0x24588b)throw new Error(_0x13b7('0x38'));if(_0x24588b[_0x13b7('0x39')]==='user'){var _0x2e65b9=_0x128a2a[_0x13b7('0x19')]({'plain':!![]});var _0x17414f=_0x13b7('0x3a');return db[_0x13b7('0x3b')][_0x13b7('0x3c')]({'where':{'name':_0x17414f,'userProfileId':_0x24588b[_0x13b7('0x3d')]},'raw':!![]})['then'](function(_0x49fd4e){if(_0x49fd4e&&_0x49fd4e[_0x13b7('0x3e')]===0x0){return db[_0x13b7('0x1a')]['create']({'name':_0x2e65b9['name'],'resourceId':_0x2e65b9['id'],'type':_0x49fd4e['name'],'sectionId':_0x49fd4e['id']},{})['then'](function(){return _0x128a2a;});}else{return _0x128a2a;}})[_0x13b7('0x2a')](function(_0x4d1fa6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1fa6);throw _0x4d1fa6;});}return _0x128a2a;})[_0x13b7('0x17')](respondWithResult(_0x5ba00a,0xc9))[_0x13b7('0x2a')](handleError(_0x5ba00a,null));};exports['update']=function(_0x440cb1,_0x542a19){if(_0x440cb1[_0x13b7('0x36')]['id']){delete _0x440cb1[_0x13b7('0x36')]['id'];}return db['WhatsappQueue'][_0x13b7('0x3c')]({'where':{'id':_0x440cb1[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0x542a19,null))[_0x13b7('0x17')](saveUpdates(_0x440cb1[_0x13b7('0x36')],null))[_0x13b7('0x17')](respondWithResult(_0x542a19,null))[_0x13b7('0x2a')](handleError(_0x542a19,null));};exports[_0x13b7('0x18')]=function(_0x82655,_0x3d6484){return db[_0x13b7('0x21')][_0x13b7('0x3c')]({'where':{'id':_0x82655[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0x3d6484,null))[_0x13b7('0x17')](removeEntity(_0x3d6484,null))[_0x13b7('0x2a')](handleError(_0x3d6484,null));};exports['describe']=function(_0xd40092,_0x359cb0){return db['WhatsappQueue'][_0x13b7('0x3f')]()['then'](respondWithResult(_0x359cb0,null))[_0x13b7('0x2a')](handleError(_0x359cb0,null));};exports[_0x13b7('0x40')]=function(_0x513e3a,_0x4899cd){var _0x1c1654={'raw':!![],'where':{}},_0x24a7b4={},_0x4f41cd;return db[_0x13b7('0x21')][_0x13b7('0x41')]({'where':{'id':_0x513e3a['params']['id']}})['then'](handleEntityNotFound(_0x4899cd,null))['then'](function(_0x229322){if(_0x229322){_0x4f41cd=_0x229322[_0x13b7('0x19')]({'plain':!![]});_0x24a7b4[_0x13b7('0x2e')]=_['keys'](db['UserWhatsappQueue'][_0x13b7('0x22')]);_0x24a7b4[_0x13b7('0x28')]=_['keys'](_0x513e3a[_0x13b7('0x28')]);_0x24a7b4[_0x13b7('0x2d')]=_[_0x13b7('0x30')](_0x24a7b4[_0x13b7('0x2e')],_0x24a7b4[_0x13b7('0x28')]);_0x1c1654[_0x13b7('0x2f')]=_[_0x13b7('0x30')](_0x24a7b4[_0x13b7('0x2e')],qs[_0x13b7('0x31')](_0x513e3a[_0x13b7('0x28')][_0x13b7('0x31')]));_0x1c1654[_0x13b7('0x2f')]=_0x1c1654[_0x13b7('0x2f')][_0x13b7('0x32')]?_0x1c1654['attributes']:_0x24a7b4['model'];if(!_0x513e3a['query'][_0x13b7('0x42')]('nolimit')){_0x1c1654[_0x13b7('0x13')]=qs[_0x13b7('0x13')](_0x513e3a['query'][_0x13b7('0x13')]);_0x1c1654['offset']=qs[_0x13b7('0x11')](_0x513e3a['query'][_0x13b7('0x11')]);}_0x1c1654[_0x13b7('0x43')]=qs[_0x13b7('0x44')](_0x513e3a['query'][_0x13b7('0x44')]);_0x1c1654[_0x13b7('0x27')]=qs[_0x13b7('0x2d')](_[_0x13b7('0x45')](_0x513e3a[_0x13b7('0x28')],_0x24a7b4[_0x13b7('0x2d')]));_0x1c1654[_0x13b7('0x27')][_0x13b7('0x46')]=_0x229322['id'];if(_0x513e3a['query'][_0x13b7('0x47')]){_0x1c1654['where']=_['merge'](_0x1c1654[_0x13b7('0x27')],{'$or':_[_0x13b7('0x20')](_0x1c1654[_0x13b7('0x2f')],function(_0x10a498){var _0x21364a={};_0x21364a[_0x10a498]={'$like':'%'+_0x513e3a[_0x13b7('0x28')][_0x13b7('0x47')]+'%'};return _0x21364a;})});}_0x1c1654=_[_0x13b7('0x48')]({},_0x1c1654,_0x513e3a['options']);return db[_0x13b7('0x49')][_0x13b7('0x29')](_0x1c1654);}})[_0x13b7('0x17')](function(_0x167603){if(_0x167603){return db[_0x13b7('0x4a')][_0x13b7('0x4b')]({'where':{'id':_['map'](_0x167603,_0x13b7('0x4c')),'role':_0x13b7('0x4d')},'attributes':['id',_0x13b7('0x1d'),_0x13b7('0x4e'),_0x13b7('0x4f'),'createdAt']});}})[_0x13b7('0x17')](function(_0x2113f9){if(_0x2113f9){return{'count':_0x2113f9['count'],'rows':_['map'](_0x2113f9[_0x13b7('0x50')],function(_0x330969){return{'membername':_0x330969[_0x13b7('0x1d')],'UserId':_0x330969['id'],'queue_name':_0x4f41cd[_0x13b7('0x1d')],'WhatsappQueueId':_0x4f41cd['id'],'interface':util[_0x13b7('0x51')](_0x13b7('0x52'),_0x13b7('0x53'),_0x330969[_0x13b7('0x1d')]),'penalty':0x0,'paused':_0x330969[_0x13b7('0x4e')],'createdAt':_0x330969[_0x13b7('0x54')],'updatedAt':_0x330969[_0x13b7('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x13b7('0x17')](respondWithFilteredResult(_0x4899cd,_0x1c1654))[_0x13b7('0x2a')](handleError(_0x4899cd,null));};exports[_0x13b7('0x55')]=function(_0x144d4b,_0xe0a90e){var _0x531eba={};var _0x1a60a2={};var _0x51be25;var _0x1975c2;return db[_0x13b7('0x21')]['findOne']({'where':{'id':_0x144d4b[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0xe0a90e,null))[_0x13b7('0x17')](function(_0x5ebc50){if(_0x5ebc50){_0x51be25=_0x5ebc50;_0x1a60a2[_0x13b7('0x2e')]=_['keys'](db[_0x13b7('0x56')][_0x13b7('0x22')]);_0x1a60a2['query']=_[_0x13b7('0x2c')](_0x144d4b[_0x13b7('0x28')]);_0x1a60a2[_0x13b7('0x2d')]=_['intersection'](_0x1a60a2[_0x13b7('0x2e')],_0x1a60a2[_0x13b7('0x28')]);_0x531eba[_0x13b7('0x2f')]=_[_0x13b7('0x30')](_0x1a60a2['model'],qs[_0x13b7('0x31')](_0x144d4b[_0x13b7('0x28')][_0x13b7('0x31')]));_0x531eba[_0x13b7('0x2f')]=_0x531eba[_0x13b7('0x2f')][_0x13b7('0x32')]?_0x531eba['attributes']:_0x1a60a2['model'];_0x531eba[_0x13b7('0x43')]=qs[_0x13b7('0x44')](_0x144d4b['query'][_0x13b7('0x44')]);_0x531eba[_0x13b7('0x27')]=qs['filters'](_[_0x13b7('0x45')](_0x144d4b['query'],_0x1a60a2[_0x13b7('0x2d')]));if(_0x144d4b['query'][_0x13b7('0x47')]){_0x531eba[_0x13b7('0x27')]=_['merge'](_0x531eba['where'],{'$or':_[_0x13b7('0x20')](_0x531eba[_0x13b7('0x2f')],function(_0x1ddae5){var _0xa6384d={};_0xa6384d[_0x1ddae5]={'$like':'%'+_0x144d4b['query'][_0x13b7('0x47')]+'%'};return _0xa6384d;})});}_0x531eba=_[_0x13b7('0x48')]({},_0x531eba,_0x144d4b[_0x13b7('0x34')]);return _0x51be25[_0x13b7('0x55')](_0x531eba);}})[_0x13b7('0x17')](function(_0x1c2037){if(_0x1c2037){_0x1975c2=_0x1c2037[_0x13b7('0x32')];if(!_0x144d4b[_0x13b7('0x28')][_0x13b7('0x42')](_0x13b7('0x57'))){_0x531eba[_0x13b7('0x13')]=qs[_0x13b7('0x13')](_0x144d4b[_0x13b7('0x28')]['limit']);_0x531eba['offset']=qs[_0x13b7('0x11')](_0x144d4b[_0x13b7('0x28')][_0x13b7('0x11')]);}return _0x51be25[_0x13b7('0x55')](_0x531eba);}})['then'](function(_0x5597e5){if(_0x5597e5){return _0x5597e5?{'count':_0x1975c2,'rows':_0x5597e5}:null;}})[_0x13b7('0x17')](respondWithResult(_0xe0a90e,null))['catch'](handleError(_0xe0a90e,null));};exports[_0x13b7('0x58')]=function(_0x269d24,_0x18b809){var _0x57d853=_0x269d24[_0x13b7('0x36')]['ids'];return db['Team']['findAll']({'where':{'id':_0x57d853},'attributes':['id'],'include':[{'model':db['User'],'as':_0x13b7('0x59'),'attributes':['id',_0x13b7('0x1d'),_0x13b7('0x5a'),_0x13b7('0x5b'),_0x13b7('0x5c')],'raw':!![]}]})[_0x13b7('0x17')](function(_0x5b3d61){if(_0x5b3d61){var _0x252d04=_['flatMap'](_0x5b3d61,function(_0x1af921){var _0x4c2c70=_0x1af921['get']({'plain':!![]});return _0x4c2c70[_0x13b7('0x59')];});return db[_0x13b7('0x21')][_0x13b7('0x3c')]({'where':{'id':_0x269d24[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](function(_0x3436c2){return db[_0x13b7('0x5d')][_0x13b7('0x5e')](function(_0x77396c){return _0x3436c2['addTeams'](_0x57d853,{'transaction':_0x77396c})[_0x13b7('0x17')](function(){return BPromise[_0x13b7('0x5f')](_0x252d04,function(_0x194dce){return db[_0x13b7('0x49')][_0x13b7('0x60')]({'where':{'UserId':_0x194dce['id'],'WhatsappQueueId':_0x269d24['params']['id']},'transaction':_0x77396c});});})[_0x13b7('0x17')](function(){_0x252d04[_0x13b7('0x61')](function(_0x320327){socket[_0x13b7('0x62')](_0x13b7('0x63'),{'UserId':_0x320327['id'],'WhatsappQueueId':_0x3436c2['id']});});});});});}})[_0x13b7('0x17')](respondWithStatusCode(_0x18b809,null))['catch'](handleError(_0x18b809,null));};exports['removeTeams']=function(_0x34906e,_0x1a24f4){return db['Team']['findAll']({'where':{'id':_0x34906e[_0x13b7('0x28')][_0x13b7('0x64')]},'attributes':['id'],'include':[{'model':db[_0x13b7('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x13b7('0x17')](handleEntityNotFound(_0x1a24f4,null))[_0x13b7('0x17')](function(_0xbcf851){var _0x7decad=_['map'](_0xbcf851,'id');var _0x44c0b9=[];var _0x59e1a5=[];var _0x3c9329=squel['select']();_0x3c9329['field'](_0x13b7('0x65'))[_0x13b7('0x66')](_0x13b7('0x67'),'tq')['join'](_0x13b7('0x68'),'ut',_0x13b7('0x69'))['where']('WhatsappQueueId\x20=\x20?',_0x34906e['params']['id']);for(var _0x56d832=0x0;_0x56d832<_0xbcf851[_0x13b7('0x32')];_0x56d832+=0x1){let _0x192596=_0xbcf851[_0x56d832];for(var _0x47ace3=0x0;_0x47ace3<_0x192596['Agents'][_0x13b7('0x32')];_0x47ace3+=0x1){let _0x274ed4=_0x192596[_0x13b7('0x59')][_0x47ace3];var _0x26ccef=_0x3c9329[_0x13b7('0x6a')]();_0x26ccef[_0x13b7('0x27')](_0x13b7('0x6b'),_0x274ed4['id']);_0x59e1a5[_0x13b7('0x6c')](db[_0x13b7('0x5d')][_0x13b7('0x28')](_0x26ccef[_0x13b7('0x6d')](),{'type':db[_0x13b7('0x5d')]['QueryTypes'][_0x13b7('0x6e')]})[_0x13b7('0x17')](function(_0x2955a7){if(_0x2955a7['length']===0x1){return _0x274ed4['id'];}else{var _0x8b73ab=_[_0x13b7('0x6f')](_['map'](_0x2955a7,_0x13b7('0x70')),function(_0x3ffbe0){return _[_0x13b7('0x71')](_0x7decad,_0x3ffbe0);});if(_0x8b73ab){return _0x274ed4['id'];}}}));}}return BPromise[_0x13b7('0x72')](_0x59e1a5)[_0x13b7('0x17')](function(_0xec907c){_0x44c0b9=_(_0x44c0b9)[_0x13b7('0x73')](_0xec907c)[_0x13b7('0x74')]()[_0x13b7('0x75')]();return db[_0x13b7('0x21')][_0x13b7('0x3c')]({'where':{'id':_0x34906e['params']['id']}})[_0x13b7('0x17')](function(_0x25e59e){return db[_0x13b7('0x5d')]['transaction'](function(_0x414960){return _0x25e59e['removeTeams'](_0x34906e[_0x13b7('0x28')][_0x13b7('0x64')],{'transaction':_0x414960})[_0x13b7('0x17')](function(){if(!_[_0x13b7('0x76')](_0x44c0b9)){return _0x25e59e['removeAgents'](_0x44c0b9,{'transaction':_0x414960});}})[_0x13b7('0x17')](function(){_0x44c0b9[_0x13b7('0x61')](function(_0x5dbccd){socket[_0x13b7('0x62')](_0x13b7('0x77'),{'UserId':_0x5dbccd,'WhatsappQueueId':_0x25e59e['id']});});});});});});})[_0x13b7('0x17')](respondWithStatusCode(_0x1a24f4,null))[_0x13b7('0x2a')](handleError(_0x1a24f4,null));};exports[_0x13b7('0x78')]=function(_0x5b9cff,_0x40f443){return db['WhatsappQueue'][_0x13b7('0x3c')]({'where':{'id':_0x5b9cff[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0x40f443,null))[_0x13b7('0x17')](function(_0x9fb189){if(_0x9fb189){return _0x9fb189[_0x13b7('0x78')](_0x5b9cff['body'][_0x13b7('0x64')],_[_0x13b7('0x79')](_0x5b9cff[_0x13b7('0x36')],[_0x13b7('0x64'),'id'])||{})[_0x13b7('0x7a')](function(_0x2433a2){for(var _0x34333a=0x0;_0x34333a<_0x5b9cff['body']['ids']['length'];_0x34333a+=0x1){socket[_0x13b7('0x62')]('userWhatsappQueue:save',{'UserId':Number(_0x5b9cff[_0x13b7('0x36')][_0x13b7('0x64')][_0x34333a]),'WhatsappQueueId':Number(_0x5b9cff[_0x13b7('0x2b')]['id'])});}return _0x2433a2;});}})['then'](respondWithResult(_0x40f443,null))[_0x13b7('0x2a')](handleError(_0x40f443,null));};exports['removeAgents']=function(_0x46e500,_0x462328){return db[_0x13b7('0x21')][_0x13b7('0x3c')]({'where':{'id':_0x46e500[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0x462328,null))[_0x13b7('0x17')](function(_0x2c0f6c){if(_0x2c0f6c){return _0x2c0f6c[_0x13b7('0x7b')](_0x46e500['query'][_0x13b7('0x64')])[_0x13b7('0x17')](function(){if(_[_0x13b7('0x7c')](_0x46e500['query'][_0x13b7('0x64')])){for(var _0x38e41c=0x0;_0x38e41c<_0x46e500['query'][_0x13b7('0x64')][_0x13b7('0x32')];_0x38e41c+=0x1){socket['emit'](_0x13b7('0x77'),{'UserId':Number(_0x46e500[_0x13b7('0x28')][_0x13b7('0x64')][_0x38e41c]),'WhatsappQueueId':Number(_0x46e500['params']['id'])});}}else{socket[_0x13b7('0x62')](_0x13b7('0x77'),{'UserId':Number(_0x46e500[_0x13b7('0x28')][_0x13b7('0x64')]),'WhatsappQueueId':Number(_0x46e500['params']['id'])});}});}})[_0x13b7('0x17')](respondWithStatusCode(_0x462328,null))[_0x13b7('0x2a')](handleError(_0x462328,null));};exports[_0x13b7('0x7d')]=function(_0x1ffe26,_0x360af1){var _0x280daf={};var _0x5320c1={};var _0x3d0267;var _0x199855;return db[_0x13b7('0x21')][_0x13b7('0x41')]({'where':{'id':_0x1ffe26[_0x13b7('0x2b')]['id']}})[_0x13b7('0x17')](handleEntityNotFound(_0x360af1,null))[_0x13b7('0x17')](function(_0x2788d2){if(_0x2788d2){_0x3d0267=_0x2788d2;_0x5320c1['model']=_['keys'](db[_0x13b7('0x4a')][_0x13b7('0x22')]);_0x5320c1['query']=_[_0x13b7('0x2c')](_0x1ffe26[_0x13b7('0x28')]);_0x5320c1[_0x13b7('0x2d')]=_[_0x13b7('0x30')](_0x5320c1[_0x13b7('0x2e')],_0x5320c1[_0x13b7('0x28')]);_0x280daf[_0x13b7('0x2f')]=_[_0x13b7('0x30')](_0x5320c1[_0x13b7('0x2e')],qs[_0x13b7('0x31')](_0x1ffe26['query'][_0x13b7('0x31')]));_0x280daf[_0x13b7('0x2f')]=_0x280daf[_0x13b7('0x2f')][_0x13b7('0x32')]?_0x280daf[_0x13b7('0x2f')]:_0x5320c1[_0x13b7('0x2e')];_0x280daf[_0x13b7('0x43')]=qs[_0x13b7('0x44')](_0x1ffe26[_0x13b7('0x28')][_0x13b7('0x44')]);_0x280daf[_0x13b7('0x27')]=qs[_0x13b7('0x2d')](_['pick'](_0x1ffe26['query'],_0x5320c1['filters']));if(_0x1ffe26['query']['filter']){_0x280daf[_0x13b7('0x27')]=_[_0x13b7('0x48')](_0x280daf[_0x13b7('0x27')],{'$or':_[_0x13b7('0x20')](_0x280daf[_0x13b7('0x2f')],function(_0x33700c){var _0x57f8bb={};_0x57f8bb[_0x33700c]={'$like':'%'+_0x1ffe26[_0x13b7('0x28')][_0x13b7('0x47')]+'%'};return _0x57f8bb;})});}_0x280daf=_['merge']({},_0x280daf,_0x1ffe26['options']);return _0x3d0267[_0x13b7('0x7d')](_0x280daf);}})[_0x13b7('0x17')](function(_0x41e721){if(_0x41e721){_0x199855=_0x41e721[_0x13b7('0x32')];if(!_0x1ffe26[_0x13b7('0x28')]['hasOwnProperty'](_0x13b7('0x57'))){_0x280daf[_0x13b7('0x13')]=qs[_0x13b7('0x13')](_0x1ffe26[_0x13b7('0x28')][_0x13b7('0x13')]);_0x280daf[_0x13b7('0x11')]=qs[_0x13b7('0x11')](_0x1ffe26[_0x13b7('0x28')][_0x13b7('0x11')]);}return _0x3d0267[_0x13b7('0x7d')](_0x280daf);}})[_0x13b7('0x17')](function(_0x17860d){if(_0x17860d){return _0x17860d?{'count':_0x199855,'rows':_0x17860d}:null;}})[_0x13b7('0x17')](respondWithResult(_0x360af1,null))['catch'](handleError(_0x360af1,null));}; \ No newline at end of file +var _0xa4f9=['keys','intersection','fields','attributes','options','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','filters','hasOwnProperty','WhatsappQueueId','merge','filter','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','length','order','sort','pick','nolimit','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','show','params','model'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa4f9,0x1ae));var _0x9a4f=function(_0xdeb2db,_0x16cb9c){_0xdeb2db=_0xdeb2db-0x0;var _0x4a0d01=_0xa4f9[_0xdeb2db];return _0x4a0d01;};'use strict';var BPromise=require(_0x9a4f('0x0'));var util=require(_0x9a4f('0x1'));var _=require('lodash');var squel=require(_0x9a4f('0x2'));var Redis=require(_0x9a4f('0x3'));var qs=require(_0x9a4f('0x4'));var logger=require(_0x9a4f('0x5'))(_0x9a4f('0x6'));var config=require(_0x9a4f('0x7'));var db=require(_0x9a4f('0x8'))['db'];config[_0x9a4f('0x9')]=_[_0x9a4f('0xa')](config['redis'],{'host':_0x9a4f('0xb'),'port':0x18eb});var socket=require(_0x9a4f('0xc'))(new Redis(config[_0x9a4f('0x9')]));require(_0x9a4f('0xd'))[_0x9a4f('0xe')](socket);function respondWithStatusCode(_0x201eb1,_0x4a05bb){_0x4a05bb=_0x4a05bb||0xcc;return function(_0x4f2537){if(_0x4f2537){return _0x201eb1[_0x9a4f('0xf')](_0x4a05bb);}return _0x201eb1[_0x9a4f('0x10')](_0x4a05bb)['end']();};}function respondWithResult(_0x3b506d,_0x5326f5){_0x5326f5=_0x5326f5||0xc8;return function(_0x5c7a14){if(_0x5c7a14){return _0x3b506d[_0x9a4f('0x10')](_0x5326f5)[_0x9a4f('0x11')](_0x5c7a14);}};}function respondWithFilteredResult(_0x44754b,_0x493aeb){return function(_0x3aafc2){if(_0x3aafc2){var _0x72d385=typeof _0x493aeb[_0x9a4f('0x12')]==='undefined'&&typeof _0x493aeb[_0x9a4f('0x13')]==='undefined';var _0x548eef=_0x3aafc2[_0x9a4f('0x14')];var _0x2372bb=_0x72d385?0x0:_0x493aeb[_0x9a4f('0x12')];var _0xe1471a=_0x72d385?_0x3aafc2[_0x9a4f('0x14')]:_0x493aeb[_0x9a4f('0x12')]+_0x493aeb[_0x9a4f('0x13')];var _0x507b92;if(_0xe1471a>=_0x548eef){_0xe1471a=_0x548eef;_0x507b92=0xc8;}else{_0x507b92=0xce;}_0x44754b[_0x9a4f('0x10')](_0x507b92);return _0x44754b['set'](_0x9a4f('0x15'),_0x2372bb+'-'+_0xe1471a+'/'+_0x548eef)[_0x9a4f('0x11')](_0x3aafc2);}return null;};}function saveUpdates(_0x44ec72){return function(_0x3905cd){if(_0x3905cd){return _0x3905cd[_0x9a4f('0x16')](_0x44ec72)[_0x9a4f('0x17')](function(_0x49ac25){return _0x49ac25;});}return null;};}function removeEntity(_0x52d867){return function(_0xa70fa4){if(_0xa70fa4){return _0xa70fa4[_0x9a4f('0x18')]()['then'](function(){var _0x7a3ba8=_0xa70fa4[_0x9a4f('0x19')]({'plain':!![]});var _0x388d04=_0x9a4f('0x1a');return db[_0x9a4f('0x1b')]['destroy']({'where':{'type':_0x388d04,'resourceId':_0x7a3ba8['id']}})[_0x9a4f('0x17')](function(){return _0xa70fa4;});})[_0x9a4f('0x17')](function(){_0x52d867['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42223f){return function(_0x5d08de){if(!_0x5d08de){_0x42223f['sendStatus'](0x194);}return _0x5d08de;};}function handleError(_0x1d677d,_0x522260){_0x522260=_0x522260||0x1f4;return function(_0x5a2ac8){logger[_0x9a4f('0x1c')](_0x5a2ac8['stack']);if(_0x5a2ac8[_0x9a4f('0x1d')]){delete _0x5a2ac8[_0x9a4f('0x1d')];}_0x1d677d[_0x9a4f('0x10')](_0x522260)[_0x9a4f('0x1e')](_0x5a2ac8);};}exports[_0x9a4f('0x1f')]=function(_0x40b22f,_0x563df7){var _0x4ac1b8={};var _0x5afcc7={'count':0x0,'rows':[]};var _0x2d6bb3=_[_0x9a4f('0x20')](db[_0x9a4f('0x21')][_0x9a4f('0x22')],function(_0x2d4eb6){return{'name':_0x2d4eb6[_0x9a4f('0x23')],'type':_0x2d4eb6[_0x9a4f('0x24')]['key']};});_0x4ac1b8=qs['getOptions'](_0x2d6bb3,_0x40b22f);var _0x4008ce={'where':_0x4ac1b8[_0x9a4f('0x25')]};return db[_0x9a4f('0x21')][_0x9a4f('0x14')](_0x4008ce)[_0x9a4f('0x17')](function(_0x12624d){_0x5afcc7[_0x9a4f('0x14')]=_0x12624d;_0x4ac1b8[_0x9a4f('0x26')]=qs[_0x9a4f('0x26')](_0x40b22f[_0x9a4f('0x27')]);return db[_0x9a4f('0x21')][_0x9a4f('0x28')](_0x4ac1b8);})['then'](function(_0x485764){_0x5afcc7[_0x9a4f('0x29')]=_0x485764;return _0x5afcc7;})[_0x9a4f('0x17')](respondWithFilteredResult(_0x563df7,_0x4ac1b8))[_0x9a4f('0x2a')](handleError(_0x563df7,null));};exports[_0x9a4f('0x2b')]=function(_0x8dd7a0,_0x3ae702){var _0x16461b={'raw':!![],'where':{'id':_0x8dd7a0[_0x9a4f('0x2c')]['id']}},_0x53681d={};_0x53681d[_0x9a4f('0x2d')]=_[_0x9a4f('0x2e')](db[_0x9a4f('0x21')][_0x9a4f('0x22')]);_0x53681d[_0x9a4f('0x27')]=_[_0x9a4f('0x2e')](_0x8dd7a0['query']);_0x53681d['filters']=_[_0x9a4f('0x2f')](_0x53681d[_0x9a4f('0x2d')],_0x53681d[_0x9a4f('0x27')]);_0x16461b['attributes']=_[_0x9a4f('0x2f')](_0x53681d[_0x9a4f('0x2d')],qs['fields'](_0x8dd7a0[_0x9a4f('0x27')][_0x9a4f('0x30')]));_0x16461b[_0x9a4f('0x31')]=_0x16461b['attributes']['length']?_0x16461b[_0x9a4f('0x31')]:_0x53681d[_0x9a4f('0x2d')];if(_0x8dd7a0['query']['includeAll']){_0x16461b[_0x9a4f('0x26')]=[{'all':!![]}];}_0x16461b=_['merge']({},_0x16461b,_0x8dd7a0[_0x9a4f('0x32')]);return db[_0x9a4f('0x21')][_0x9a4f('0x33')](_0x16461b)[_0x9a4f('0x17')](handleEntityNotFound(_0x3ae702,null))[_0x9a4f('0x17')](respondWithResult(_0x3ae702,null))['catch'](handleError(_0x3ae702,null));};exports[_0x9a4f('0x34')]=function(_0x5cefc3,_0x2a8577){return db[_0x9a4f('0x21')][_0x9a4f('0x34')](_0x5cefc3[_0x9a4f('0x35')],{})['then'](function(_0x238bf5){var _0x412f6f=_0x5cefc3['user']['get']({'plain':!![]});if(!_0x412f6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412f6f['role']===_0x9a4f('0x36')){var _0x2c98eb=_0x238bf5[_0x9a4f('0x19')]({'plain':!![]});var _0x246ad7=_0x9a4f('0x1a');return db[_0x9a4f('0x37')]['find']({'where':{'name':_0x246ad7,'userProfileId':_0x412f6f[_0x9a4f('0x38')]},'raw':!![]})[_0x9a4f('0x17')](function(_0x1a26c7){if(_0x1a26c7&&_0x1a26c7['autoAssociation']===0x0){return db[_0x9a4f('0x1b')]['create']({'name':_0x2c98eb[_0x9a4f('0x1d')],'resourceId':_0x2c98eb['id'],'type':_0x1a26c7[_0x9a4f('0x1d')],'sectionId':_0x1a26c7['id']},{})[_0x9a4f('0x17')](function(){return _0x238bf5;});}else{return _0x238bf5;}})['catch'](function(_0x20d778){logger[_0x9a4f('0x1c')](_0x9a4f('0x39'),_0x20d778);throw _0x20d778;});}return _0x238bf5;})[_0x9a4f('0x17')](respondWithResult(_0x2a8577,0xc9))[_0x9a4f('0x2a')](handleError(_0x2a8577,null));};exports['update']=function(_0x520af0,_0x2969f2){if(_0x520af0[_0x9a4f('0x35')]['id']){delete _0x520af0[_0x9a4f('0x35')]['id'];}return db[_0x9a4f('0x21')][_0x9a4f('0x33')]({'where':{'id':_0x520af0[_0x9a4f('0x2c')]['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x2969f2,null))['then'](saveUpdates(_0x520af0[_0x9a4f('0x35')],null))[_0x9a4f('0x17')](respondWithResult(_0x2969f2,null))[_0x9a4f('0x2a')](handleError(_0x2969f2,null));};exports[_0x9a4f('0x18')]=function(_0x357a6c,_0x56ff75){return db[_0x9a4f('0x21')]['find']({'where':{'id':_0x357a6c[_0x9a4f('0x2c')]['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x56ff75,null))[_0x9a4f('0x17')](removeEntity(_0x56ff75,null))['catch'](handleError(_0x56ff75,null));};exports[_0x9a4f('0x3a')]=function(_0x35244e,_0x44487b){return db['WhatsappQueue'][_0x9a4f('0x3a')]()[_0x9a4f('0x17')](respondWithResult(_0x44487b,null))[_0x9a4f('0x2a')](handleError(_0x44487b,null));};exports['getMembers']=function(_0x782815,_0x8a4030){var _0x545e36={'raw':!![],'where':{}},_0x37c864={},_0x385077;return db[_0x9a4f('0x21')][_0x9a4f('0x3b')]({'where':{'id':_0x782815[_0x9a4f('0x2c')]['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x8a4030,null))[_0x9a4f('0x17')](function(_0x5aaf88){if(_0x5aaf88){_0x385077=_0x5aaf88['get']({'plain':!![]});_0x37c864[_0x9a4f('0x2d')]=_[_0x9a4f('0x2e')](db[_0x9a4f('0x3c')]['rawAttributes']);_0x37c864[_0x9a4f('0x27')]=_[_0x9a4f('0x2e')](_0x782815[_0x9a4f('0x27')]);_0x37c864[_0x9a4f('0x3d')]=_[_0x9a4f('0x2f')](_0x37c864['model'],_0x37c864[_0x9a4f('0x27')]);_0x545e36[_0x9a4f('0x31')]=_[_0x9a4f('0x2f')](_0x37c864['model'],qs[_0x9a4f('0x30')](_0x782815[_0x9a4f('0x27')][_0x9a4f('0x30')]));_0x545e36[_0x9a4f('0x31')]=_0x545e36['attributes']['length']?_0x545e36[_0x9a4f('0x31')]:_0x37c864[_0x9a4f('0x2d')];if(!_0x782815[_0x9a4f('0x27')][_0x9a4f('0x3e')]('nolimit')){_0x545e36[_0x9a4f('0x13')]=qs[_0x9a4f('0x13')](_0x782815[_0x9a4f('0x27')][_0x9a4f('0x13')]);_0x545e36[_0x9a4f('0x12')]=qs[_0x9a4f('0x12')](_0x782815[_0x9a4f('0x27')]['offset']);}_0x545e36['order']=qs['sort'](_0x782815[_0x9a4f('0x27')]['sort']);_0x545e36[_0x9a4f('0x25')]=qs[_0x9a4f('0x3d')](_['pick'](_0x782815[_0x9a4f('0x27')],_0x37c864[_0x9a4f('0x3d')]));_0x545e36['where'][_0x9a4f('0x3f')]=_0x5aaf88['id'];if(_0x782815['query']['filter']){_0x545e36[_0x9a4f('0x25')]=_[_0x9a4f('0x40')](_0x545e36[_0x9a4f('0x25')],{'$or':_['map'](_0x545e36[_0x9a4f('0x31')],function(_0x23a272){var _0x52325b={};_0x52325b[_0x23a272]={'$like':'%'+_0x782815[_0x9a4f('0x27')][_0x9a4f('0x41')]+'%'};return _0x52325b;})});}_0x545e36=_[_0x9a4f('0x40')]({},_0x545e36,_0x782815['options']);return db[_0x9a4f('0x3c')][_0x9a4f('0x28')](_0x545e36);}})[_0x9a4f('0x17')](function(_0xc8d80){if(_0xc8d80){return db[_0x9a4f('0x42')]['findAndCountAll']({'where':{'id':_[_0x9a4f('0x20')](_0xc8d80,'UserId'),'role':_0x9a4f('0x43')},'attributes':['id',_0x9a4f('0x1d'),_0x9a4f('0x44'),_0x9a4f('0x45'),_0x9a4f('0x46')]});}})[_0x9a4f('0x17')](function(_0x574eaf){if(_0x574eaf){return{'count':_0x574eaf[_0x9a4f('0x14')],'rows':_[_0x9a4f('0x20')](_0x574eaf[_0x9a4f('0x29')],function(_0x3f2ed4){return{'membername':_0x3f2ed4[_0x9a4f('0x1d')],'UserId':_0x3f2ed4['id'],'queue_name':_0x385077[_0x9a4f('0x1d')],'WhatsappQueueId':_0x385077['id'],'interface':util[_0x9a4f('0x47')](_0x9a4f('0x48'),_0x9a4f('0x49'),_0x3f2ed4[_0x9a4f('0x1d')]),'penalty':0x0,'paused':_0x3f2ed4[_0x9a4f('0x44')],'createdAt':_0x3f2ed4['createdAt'],'updatedAt':_0x3f2ed4[_0x9a4f('0x45')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a4f('0x17')](respondWithFilteredResult(_0x8a4030,_0x545e36))[_0x9a4f('0x2a')](handleError(_0x8a4030,null));};exports[_0x9a4f('0x4a')]=function(_0x2c03d6,_0x20ebb5){var _0x1a412d={};var _0xc883c9={};var _0x41e56d;var _0xca788a;return db[_0x9a4f('0x21')][_0x9a4f('0x3b')]({'where':{'id':_0x2c03d6[_0x9a4f('0x2c')]['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x20ebb5,null))[_0x9a4f('0x17')](function(_0x160b5d){if(_0x160b5d){_0x41e56d=_0x160b5d;_0xc883c9[_0x9a4f('0x2d')]=_[_0x9a4f('0x2e')](db[_0x9a4f('0x4b')][_0x9a4f('0x22')]);_0xc883c9[_0x9a4f('0x27')]=_[_0x9a4f('0x2e')](_0x2c03d6[_0x9a4f('0x27')]);_0xc883c9['filters']=_[_0x9a4f('0x2f')](_0xc883c9['model'],_0xc883c9[_0x9a4f('0x27')]);_0x1a412d[_0x9a4f('0x31')]=_[_0x9a4f('0x2f')](_0xc883c9[_0x9a4f('0x2d')],qs[_0x9a4f('0x30')](_0x2c03d6[_0x9a4f('0x27')]['fields']));_0x1a412d[_0x9a4f('0x31')]=_0x1a412d[_0x9a4f('0x31')][_0x9a4f('0x4c')]?_0x1a412d['attributes']:_0xc883c9[_0x9a4f('0x2d')];_0x1a412d[_0x9a4f('0x4d')]=qs[_0x9a4f('0x4e')](_0x2c03d6[_0x9a4f('0x27')][_0x9a4f('0x4e')]);_0x1a412d['where']=qs[_0x9a4f('0x3d')](_[_0x9a4f('0x4f')](_0x2c03d6['query'],_0xc883c9[_0x9a4f('0x3d')]));if(_0x2c03d6[_0x9a4f('0x27')]['filter']){_0x1a412d[_0x9a4f('0x25')]=_['merge'](_0x1a412d[_0x9a4f('0x25')],{'$or':_[_0x9a4f('0x20')](_0x1a412d[_0x9a4f('0x31')],function(_0xa1c017){var _0x66a67d={};_0x66a67d[_0xa1c017]={'$like':'%'+_0x2c03d6[_0x9a4f('0x27')][_0x9a4f('0x41')]+'%'};return _0x66a67d;})});}_0x1a412d=_[_0x9a4f('0x40')]({},_0x1a412d,_0x2c03d6[_0x9a4f('0x32')]);return _0x41e56d['getTeams'](_0x1a412d);}})[_0x9a4f('0x17')](function(_0x42d5a8){if(_0x42d5a8){_0xca788a=_0x42d5a8['length'];if(!_0x2c03d6[_0x9a4f('0x27')][_0x9a4f('0x3e')](_0x9a4f('0x50'))){_0x1a412d[_0x9a4f('0x13')]=qs[_0x9a4f('0x13')](_0x2c03d6[_0x9a4f('0x27')][_0x9a4f('0x13')]);_0x1a412d['offset']=qs[_0x9a4f('0x12')](_0x2c03d6[_0x9a4f('0x27')][_0x9a4f('0x12')]);}return _0x41e56d[_0x9a4f('0x4a')](_0x1a412d);}})[_0x9a4f('0x17')](function(_0x308385){if(_0x308385){return _0x308385?{'count':_0xca788a,'rows':_0x308385}:null;}})[_0x9a4f('0x17')](respondWithResult(_0x20ebb5,null))[_0x9a4f('0x2a')](handleError(_0x20ebb5,null));};exports[_0x9a4f('0x51')]=function(_0x3dd758,_0x310b97){var _0x9fa05f=_0x3dd758[_0x9a4f('0x35')][_0x9a4f('0x52')];return db[_0x9a4f('0x4b')][_0x9a4f('0x28')]({'where':{'id':_0x9fa05f},'attributes':['id'],'include':[{'model':db[_0x9a4f('0x42')],'as':'Agents','attributes':['id',_0x9a4f('0x1d'),_0x9a4f('0x53'),_0x9a4f('0x54'),_0x9a4f('0x55')],'raw':!![]}]})[_0x9a4f('0x17')](function(_0x486f16){if(_0x486f16){var _0x997360=_[_0x9a4f('0x56')](_0x486f16,function(_0x147e58){var _0x2dc119=_0x147e58[_0x9a4f('0x19')]({'plain':!![]});return _0x2dc119[_0x9a4f('0x57')];});return db[_0x9a4f('0x21')][_0x9a4f('0x33')]({'where':{'id':_0x3dd758['params']['id']}})['then'](function(_0xd137ed){return db[_0x9a4f('0x58')][_0x9a4f('0x59')](function(_0xde7702){return _0xd137ed[_0x9a4f('0x51')](_0x9fa05f,{'transaction':_0xde7702})['then'](function(){return BPromise['each'](_0x997360,function(_0x2f575d){return db[_0x9a4f('0x3c')][_0x9a4f('0x5a')]({'where':{'UserId':_0x2f575d['id'],'WhatsappQueueId':_0x3dd758[_0x9a4f('0x2c')]['id']},'transaction':_0xde7702});});})['then'](function(){_0x997360[_0x9a4f('0x5b')](function(_0x350c4b){socket[_0x9a4f('0x5c')](_0x9a4f('0x5d'),{'UserId':_0x350c4b['id'],'WhatsappQueueId':_0xd137ed['id']});});});});});}})['then'](respondWithStatusCode(_0x310b97,null))['catch'](handleError(_0x310b97,null));};exports[_0x9a4f('0x5e')]=function(_0x1a8a61,_0x4b257d){return db[_0x9a4f('0x4b')][_0x9a4f('0x28')]({'where':{'id':_0x1a8a61['query'][_0x9a4f('0x52')]},'attributes':['id'],'include':[{'model':db[_0x9a4f('0x42')],'as':_0x9a4f('0x57'),'attributes':['id'],'raw':!![]}]})[_0x9a4f('0x17')](handleEntityNotFound(_0x4b257d,null))[_0x9a4f('0x17')](function(_0x36ab61){var _0x583834=_[_0x9a4f('0x20')](_0x36ab61,'id');var _0x4a4e61=[];var _0x353337=[];var _0x57c3b9=squel[_0x9a4f('0x5f')]();_0x57c3b9[_0x9a4f('0x60')]('tq.TeamId')[_0x9a4f('0x61')](_0x9a4f('0x62'),'tq')[_0x9a4f('0x63')](_0x9a4f('0x64'),'ut',_0x9a4f('0x65'))[_0x9a4f('0x25')](_0x9a4f('0x66'),_0x1a8a61['params']['id']);for(var _0x2cf904=0x0;_0x2cf904<_0x36ab61['length'];_0x2cf904+=0x1){let _0x9782b1=_0x36ab61[_0x2cf904];for(var _0x22ea9e=0x0;_0x22ea9e<_0x9782b1[_0x9a4f('0x57')][_0x9a4f('0x4c')];_0x22ea9e+=0x1){let _0x31d16=_0x9782b1['Agents'][_0x22ea9e];var _0x1666d3=_0x57c3b9['clone']();_0x1666d3[_0x9a4f('0x25')]('ut.UserId\x20=\x20?',_0x31d16['id']);_0x353337[_0x9a4f('0x67')](db['sequelize'][_0x9a4f('0x27')](_0x1666d3['toString'](),{'type':db[_0x9a4f('0x58')][_0x9a4f('0x68')][_0x9a4f('0x69')]})['then'](function(_0x46285c){if(_0x46285c[_0x9a4f('0x4c')]===0x1){return _0x31d16['id'];}else{var _0x3182cb=_[_0x9a4f('0x6a')](_[_0x9a4f('0x20')](_0x46285c,'TeamId'),function(_0x2f6765){return _['includes'](_0x583834,_0x2f6765);});if(_0x3182cb){return _0x31d16['id'];}}}));}}return BPromise[_0x9a4f('0x6b')](_0x353337)[_0x9a4f('0x17')](function(_0x215cc7){_0x4a4e61=_(_0x4a4e61)[_0x9a4f('0x6c')](_0x215cc7)[_0x9a4f('0x6d')]()[_0x9a4f('0x6e')]();return db[_0x9a4f('0x21')][_0x9a4f('0x33')]({'where':{'id':_0x1a8a61[_0x9a4f('0x2c')]['id']}})['then'](function(_0x3a9a55){return db[_0x9a4f('0x58')][_0x9a4f('0x59')](function(_0x5df090){return _0x3a9a55[_0x9a4f('0x5e')](_0x1a8a61[_0x9a4f('0x27')][_0x9a4f('0x52')],{'transaction':_0x5df090})[_0x9a4f('0x17')](function(){if(!_[_0x9a4f('0x6f')](_0x4a4e61)){return _0x3a9a55[_0x9a4f('0x70')](_0x4a4e61,{'transaction':_0x5df090});}})[_0x9a4f('0x17')](function(){_0x4a4e61[_0x9a4f('0x5b')](function(_0x41fb9a){socket[_0x9a4f('0x5c')]('userWhatsappQueue:remove',{'UserId':_0x41fb9a,'WhatsappQueueId':_0x3a9a55['id']});});});});});});})[_0x9a4f('0x17')](respondWithStatusCode(_0x4b257d,null))[_0x9a4f('0x2a')](handleError(_0x4b257d,null));};exports[_0x9a4f('0x71')]=function(_0x4407ed,_0x42b916){return db['WhatsappQueue'][_0x9a4f('0x33')]({'where':{'id':_0x4407ed[_0x9a4f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x42b916,null))[_0x9a4f('0x17')](function(_0x5a1842){if(_0x5a1842){return _0x5a1842[_0x9a4f('0x71')](_0x4407ed[_0x9a4f('0x35')][_0x9a4f('0x52')],_[_0x9a4f('0x72')](_0x4407ed[_0x9a4f('0x35')],[_0x9a4f('0x52'),'id'])||{})[_0x9a4f('0x73')](function(_0x15fc91){for(var _0x498ea8=0x0;_0x498ea8<_0x4407ed[_0x9a4f('0x35')][_0x9a4f('0x52')][_0x9a4f('0x4c')];_0x498ea8+=0x1){socket[_0x9a4f('0x5c')]('userWhatsappQueue:save',{'UserId':Number(_0x4407ed[_0x9a4f('0x35')][_0x9a4f('0x52')][_0x498ea8]),'WhatsappQueueId':Number(_0x4407ed[_0x9a4f('0x2c')]['id'])});}return _0x15fc91;});}})['then'](respondWithResult(_0x42b916,null))['catch'](handleError(_0x42b916,null));};exports['removeAgents']=function(_0x15e9b4,_0x158546){return db['WhatsappQueue'][_0x9a4f('0x33')]({'where':{'id':_0x15e9b4[_0x9a4f('0x2c')]['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x158546,null))[_0x9a4f('0x17')](function(_0x46b692){if(_0x46b692){return _0x46b692['removeAgents'](_0x15e9b4['query'][_0x9a4f('0x52')])[_0x9a4f('0x17')](function(){if(_[_0x9a4f('0x74')](_0x15e9b4[_0x9a4f('0x27')][_0x9a4f('0x52')])){for(var _0x34f57b=0x0;_0x34f57b<_0x15e9b4['query'][_0x9a4f('0x52')][_0x9a4f('0x4c')];_0x34f57b+=0x1){socket[_0x9a4f('0x5c')](_0x9a4f('0x75'),{'UserId':Number(_0x15e9b4[_0x9a4f('0x27')][_0x9a4f('0x52')][_0x34f57b]),'WhatsappQueueId':Number(_0x15e9b4[_0x9a4f('0x2c')]['id'])});}}else{socket[_0x9a4f('0x5c')](_0x9a4f('0x75'),{'UserId':Number(_0x15e9b4[_0x9a4f('0x27')][_0x9a4f('0x52')]),'WhatsappQueueId':Number(_0x15e9b4[_0x9a4f('0x2c')]['id'])});}});}})[_0x9a4f('0x17')](respondWithStatusCode(_0x158546,null))[_0x9a4f('0x2a')](handleError(_0x158546,null));};exports[_0x9a4f('0x76')]=function(_0x389365,_0x49e6c3){var _0x5a7ce5={};var _0x4f1de7={};var _0x4ffdae;var _0x6d9ce;return db[_0x9a4f('0x21')]['findOne']({'where':{'id':_0x389365['params']['id']}})[_0x9a4f('0x17')](handleEntityNotFound(_0x49e6c3,null))[_0x9a4f('0x17')](function(_0x32c423){if(_0x32c423){_0x4ffdae=_0x32c423;_0x4f1de7[_0x9a4f('0x2d')]=_[_0x9a4f('0x2e')](db[_0x9a4f('0x42')][_0x9a4f('0x22')]);_0x4f1de7['query']=_[_0x9a4f('0x2e')](_0x389365['query']);_0x4f1de7[_0x9a4f('0x3d')]=_[_0x9a4f('0x2f')](_0x4f1de7['model'],_0x4f1de7[_0x9a4f('0x27')]);_0x5a7ce5[_0x9a4f('0x31')]=_[_0x9a4f('0x2f')](_0x4f1de7[_0x9a4f('0x2d')],qs['fields'](_0x389365[_0x9a4f('0x27')][_0x9a4f('0x30')]));_0x5a7ce5['attributes']=_0x5a7ce5['attributes'][_0x9a4f('0x4c')]?_0x5a7ce5['attributes']:_0x4f1de7[_0x9a4f('0x2d')];_0x5a7ce5['order']=qs[_0x9a4f('0x4e')](_0x389365[_0x9a4f('0x27')][_0x9a4f('0x4e')]);_0x5a7ce5[_0x9a4f('0x25')]=qs['filters'](_[_0x9a4f('0x4f')](_0x389365[_0x9a4f('0x27')],_0x4f1de7['filters']));if(_0x389365[_0x9a4f('0x27')]['filter']){_0x5a7ce5[_0x9a4f('0x25')]=_['merge'](_0x5a7ce5[_0x9a4f('0x25')],{'$or':_['map'](_0x5a7ce5[_0x9a4f('0x31')],function(_0xe1029b){var _0xdcd262={};_0xdcd262[_0xe1029b]={'$like':'%'+_0x389365[_0x9a4f('0x27')]['filter']+'%'};return _0xdcd262;})});}_0x5a7ce5=_['merge']({},_0x5a7ce5,_0x389365['options']);return _0x4ffdae[_0x9a4f('0x76')](_0x5a7ce5);}})[_0x9a4f('0x17')](function(_0x1322e5){if(_0x1322e5){_0x6d9ce=_0x1322e5[_0x9a4f('0x4c')];if(!_0x389365[_0x9a4f('0x27')][_0x9a4f('0x3e')](_0x9a4f('0x50'))){_0x5a7ce5[_0x9a4f('0x13')]=qs[_0x9a4f('0x13')](_0x389365[_0x9a4f('0x27')]['limit']);_0x5a7ce5[_0x9a4f('0x12')]=qs[_0x9a4f('0x12')](_0x389365[_0x9a4f('0x27')][_0x9a4f('0x12')]);}return _0x4ffdae[_0x9a4f('0x76')](_0x5a7ce5);}})['then'](function(_0x172b4a){if(_0x172b4a){return _0x172b4a?{'count':_0x6d9ce,'rows':_0x172b4a}:null;}})[_0x9a4f('0x17')](respondWithResult(_0x49e6c3,null))['catch'](handleError(_0x49e6c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4bbab25..e1959f6 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 _0xe97b=['emit','hook','events','../../mysqldb','save','update','remove'];(function(_0x53816b,_0x2f9ba3){var _0x7f2259=function(_0x351304){while(--_0x351304){_0x53816b['push'](_0x53816b['shift']());}};_0x7f2259(++_0x2f9ba3);}(_0xe97b,0x1ec));var _0xbe97=function(_0x2e83c4,_0x355dc7){_0x2e83c4=_0x2e83c4-0x0;var _0x34d978=_0xe97b[_0x2e83c4];return _0x34d978;};'use strict';var EventEmitter=require(_0xbe97('0x0'));var WhatsappQueue=require(_0xbe97('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe97('0x2'),'afterUpdate':_0xbe97('0x3'),'afterDestroy':_0xbe97('0x4')};function emitEvent(_0x2910f3){return function(_0x569d05,_0x373073,_0x248dc2){WhatsappQueueEvents['emit'](_0x2910f3+':'+_0x569d05['id'],_0x569d05);WhatsappQueueEvents[_0xbe97('0x5')](_0x2910f3,_0x569d05);_0x248dc2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xbe97('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x640b=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x640b,0x137));var _0xb640=function(_0x401ec9,_0x77c73f){_0x401ec9=_0x401ec9-0x0;var _0x8ef3a1=_0x640b[_0x401ec9];return _0x8ef3a1;};'use strict';var EventEmitter=require(_0xb640('0x0'));var WhatsappQueue=require(_0xb640('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb640('0x2')](0x0);var events={'afterCreate':_0xb640('0x3'),'afterUpdate':_0xb640('0x4'),'afterDestroy':_0xb640('0x5')};function emitEvent(_0x8bc1ea){return function(_0xfa60b4,_0x5b9fee,_0x5a8813){WhatsappQueueEvents['emit'](_0x8bc1ea+':'+_0xfa60b4['id'],_0xfa60b4);WhatsappQueueEvents['emit'](_0x8bc1ea,_0xfa60b4);_0x5a8813(null);};}for(var e in events){if(events[_0xb640('0x6')](e)){var event=events[e];WhatsappQueue[_0xb640('0x7')](e,emitEvent(event));}}module[_0xb640('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 8a2d8a8..cb7426d 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 _0x5a1b=['define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./whatsappQueue.attributes'];(function(_0x3eaf6d,_0x5bd071){var _0x40c3ef=function(_0x28a387){while(--_0x28a387){_0x3eaf6d['push'](_0x3eaf6d['shift']());}};_0x40c3ef(++_0x5bd071);}(_0x5a1b,0x174));var _0xb5a1=function(_0x5272a2,_0x9b7850){_0x5272a2=_0x5272a2-0x0;var _0x21f0b4=_0x5a1b[_0x5272a2];return _0x21f0b4;};'use strict';var _=require(_0xb5a1('0x0'));var util=require(_0xb5a1('0x1'));var logger=require(_0xb5a1('0x2'))('api');var moment=require(_0xb5a1('0x3'));var BPromise=require(_0xb5a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5a1('0x5'));var rimraf=require(_0xb5a1('0x6'));var config=require('../../config/environment');var attributes=require(_0xb5a1('0x7'));module['exports']=function(_0x3c0a64,_0x2149e1){return _0x3c0a64[_0xb5a1('0x8')]('WhatsappQueue',attributes,{'tableName':_0xb5a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2956=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x2956,0x15e));var _0x6295=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x2956[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0x6295('0x0'));var util=require('util');var logger=require(_0x6295('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6295('0x2'));var rp=require(_0x6295('0x3'));var fs=require('fs');var path=require(_0x6295('0x4'));var rimraf=require(_0x6295('0x5'));var config=require(_0x6295('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x36c287,_0xd97971){return _0x36c287['define'](_0x6295('0x7'),attributes,{'tableName':_0x6295('0x8'),'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 e7ee081..6203b82 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 _0x5a75=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x48e7bf,_0x3011fd){var _0x18be5c=function(_0xe0d9cf){while(--_0xe0d9cf){_0x48e7bf['push'](_0x48e7bf['shift']());}};_0x18be5c(++_0x3011fd);}(_0x5a75,0x1d8));var _0x55a7=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x5a75[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x55a7('0x0'));var util=require(_0x55a7('0x1'));var moment=require(_0x55a7('0x2'));var BPromise=require(_0x55a7('0x3'));var rs=require(_0x55a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55a7('0x5'))['db'];var utils=require(_0x55a7('0x6'));var logger=require(_0x55a7('0x7'))(_0x55a7('0x8'));var config=require(_0x55a7('0x9'));var jayson=require(_0x55a7('0xa'));var client=jayson[_0x55a7('0xb')][_0x55a7('0xc')]({'port':0x232a});config[_0x55a7('0xd')]=_[_0x55a7('0xe')](config[_0x55a7('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55a7('0xd')]));require(_0x55a7('0xf'))['register'](socket);function respondWithRpcPromise(_0x28aed4,_0x1d69d2,_0x2e714){return new BPromise(function(_0x37b5f7,_0x5bbb8a){return client['request'](_0x28aed4,_0x2e714)[_0x55a7('0x10')](function(_0x171399){logger[_0x55a7('0x11')](_0x55a7('0x12'),_0x1d69d2,_0x55a7('0x13'));logger[_0x55a7('0x14')](_0x55a7('0x15'),_0x1d69d2,_0x55a7('0x13'),JSON[_0x55a7('0x16')](_0x171399));if(_0x171399['error']){if(_0x171399[_0x55a7('0x17')][_0x55a7('0x18')]===0x1f4){logger[_0x55a7('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x1d69d2,_0x171399['error'][_0x55a7('0x19')]);return _0x5bbb8a(_0x171399[_0x55a7('0x17')][_0x55a7('0x19')]);}logger[_0x55a7('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x1d69d2,_0x171399[_0x55a7('0x17')][_0x55a7('0x19')]);return _0x37b5f7(_0x171399[_0x55a7('0x17')]['message']);}else{logger[_0x55a7('0x11')](_0x55a7('0x12'),_0x1d69d2,_0x55a7('0x13'));_0x37b5f7(_0x171399['result'][_0x55a7('0x19')]);}})['catch'](function(_0x46cf58){logger[_0x55a7('0x17')](_0x55a7('0x12'),_0x1d69d2,_0x46cf58);_0x5bbb8a(_0x46cf58);});});}exports[_0x55a7('0x1a')]=function(_0x5b3417){var _0x38749c=this;return new Promise(function(_0x255aa0,_0x16a106){return db[_0x55a7('0x1b')][_0x55a7('0x1c')]({'raw':_0x5b3417[_0x55a7('0x1d')]?_0x5b3417[_0x55a7('0x1d')][_0x55a7('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b3417['options']?_0x5b3417[_0x55a7('0x1d')][_0x55a7('0x1f')]||null:null,'attributes':_0x5b3417['options']?_0x5b3417[_0x55a7('0x1d')][_0x55a7('0x20')]||null:null,'limit':_0x5b3417[_0x55a7('0x1d')]?_0x5b3417[_0x55a7('0x1d')][_0x55a7('0x21')]||null:null,'include':_0x5b3417[_0x55a7('0x1d')]?_0x5b3417[_0x55a7('0x1d')]['include']?_['map'](_0x5b3417[_0x55a7('0x1d')][_0x55a7('0x22')],function(_0x423f45){return{'model':db[_0x423f45[_0x55a7('0x23')]],'as':_0x423f45['as'],'attributes':_0x423f45[_0x55a7('0x20')],'include':_0x423f45[_0x55a7('0x22')]?_[_0x55a7('0x24')](_0x423f45['include'],function(_0x5672dc){return{'model':db[_0x5672dc[_0x55a7('0x23')]],'as':_0x5672dc['as'],'attributes':_0x5672dc[_0x55a7('0x20')],'include':_0x5672dc[_0x55a7('0x22')]?_[_0x55a7('0x24')](_0x5672dc[_0x55a7('0x22')],function(_0x50564a){return{'model':db[_0x50564a['model']],'as':_0x50564a['as'],'attributes':_0x50564a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x298657){logger[_0x55a7('0x11')]('GetWhatsappQueue',_0x5b3417);logger[_0x55a7('0x14')]('GetWhatsappQueue',_0x5b3417,JSON[_0x55a7('0x16')](_0x298657));_0x255aa0(_0x298657);})[_0x55a7('0x25')](function(_0x66deda){logger[_0x55a7('0x17')](_0x55a7('0x1a'),_0x66deda[_0x55a7('0x19')],_0x5b3417);_0x16a106(_0x38749c[_0x55a7('0x17')](0x1f4,_0x66deda[_0x55a7('0x19')]));});});};exports[_0x55a7('0x26')]=function(_0x35db1b){var _0xc92688=this;return new Promise(function(_0x40497f,_0x3d2d98){return db[_0x55a7('0x1b')][_0x55a7('0x27')]({'raw':_0x35db1b[_0x55a7('0x1d')]?_0x35db1b['options']['raw']===undefined?!![]:![]:!![],'where':_0x35db1b['options']?_0x35db1b['options']['where']||null:null,'attributes':_0x35db1b[_0x55a7('0x1d')]?_0x35db1b[_0x55a7('0x1d')][_0x55a7('0x20')]||null:null,'include':_0x35db1b[_0x55a7('0x1d')]?_0x35db1b[_0x55a7('0x1d')][_0x55a7('0x22')]?_[_0x55a7('0x24')](_0x35db1b[_0x55a7('0x1d')][_0x55a7('0x22')],function(_0x4a4a9f){return{'model':db[_0x4a4a9f[_0x55a7('0x23')]],'as':_0x4a4a9f['as'],'attributes':_0x4a4a9f[_0x55a7('0x20')],'include':_0x4a4a9f[_0x55a7('0x22')]?_[_0x55a7('0x24')](_0x4a4a9f[_0x55a7('0x22')],function(_0x1d5deb){return{'model':db[_0x1d5deb['model']],'as':_0x1d5deb['as'],'attributes':_0x1d5deb[_0x55a7('0x20')],'include':_0x1d5deb[_0x55a7('0x22')]?_[_0x55a7('0x24')](_0x1d5deb[_0x55a7('0x22')],function(_0xbbfa3d){return{'model':db[_0xbbfa3d[_0x55a7('0x23')]],'as':_0xbbfa3d['as'],'attributes':_0xbbfa3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x55a7('0x10')](function(_0x2eb54b){logger[_0x55a7('0x11')](_0x55a7('0x26'),_0x35db1b);logger[_0x55a7('0x14')]('ShowWhatsappQueue',_0x35db1b,JSON[_0x55a7('0x16')](_0x2eb54b));_0x40497f(_0x2eb54b);})[_0x55a7('0x25')](function(_0x29ec88){logger[_0x55a7('0x17')](_0x55a7('0x26'),_0x29ec88[_0x55a7('0x19')],_0x35db1b);_0x3d2d98(_0xc92688[_0x55a7('0x17')](0x1f4,_0x29ec88[_0x55a7('0x19')]));});});}; \ No newline at end of file +var _0x063b=['message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','WhatsappQueue','find','debug','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x063b,0x149));var _0xb063=function(_0x40ee27,_0x1ea59f){_0x40ee27=_0x40ee27-0x0;var _0x54d3a2=_0x063b[_0x40ee27];return _0x54d3a2;};'use strict';var _=require(_0xb063('0x0'));var util=require(_0xb063('0x1'));var moment=require(_0xb063('0x2'));var BPromise=require('bluebird');var rs=require(_0xb063('0x3'));var fs=require('fs');var Redis=require(_0xb063('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb063('0x5'));var jayson=require(_0xb063('0x6'));var client=jayson[_0xb063('0x7')][_0xb063('0x8')]({'port':0x232a});config[_0xb063('0x9')]=_['defaults'](config[_0xb063('0x9')],{'host':_0xb063('0xa'),'port':0x18eb});var socket=require(_0xb063('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xb063('0xc')](socket);function respondWithRpcPromise(_0x1974ef,_0x14d941,_0x22de74){return new BPromise(function(_0x48ee0f,_0x1159ab){return client[_0xb063('0xd')](_0x1974ef,_0x22de74)[_0xb063('0xe')](function(_0x4d0be7){logger[_0xb063('0xf')](_0xb063('0x10'),_0x14d941,'request\x20sent');logger['debug'](_0xb063('0x11'),_0x14d941,_0xb063('0x12'),JSON[_0xb063('0x13')](_0x4d0be7));if(_0x4d0be7['error']){if(_0x4d0be7[_0xb063('0x14')][_0xb063('0x15')]===0x1f4){logger[_0xb063('0x14')](_0xb063('0x10'),_0x14d941,_0x4d0be7[_0xb063('0x14')][_0xb063('0x16')]);return _0x1159ab(_0x4d0be7[_0xb063('0x14')][_0xb063('0x16')]);}logger[_0xb063('0x14')](_0xb063('0x10'),_0x14d941,_0x4d0be7[_0xb063('0x14')][_0xb063('0x16')]);return _0x48ee0f(_0x4d0be7[_0xb063('0x14')][_0xb063('0x16')]);}else{logger[_0xb063('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x14d941,'request\x20sent');_0x48ee0f(_0x4d0be7[_0xb063('0x17')][_0xb063('0x16')]);}})[_0xb063('0x18')](function(_0x105047){logger[_0xb063('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x14d941,_0x105047);_0x1159ab(_0x105047);});});}exports['GetWhatsappQueue']=function(_0x3276c7){var _0x45931b=this;return new Promise(function(_0xfb0447,_0xe40501){return db['WhatsappQueue'][_0xb063('0x19')]({'raw':_0x3276c7[_0xb063('0x1a')]?_0x3276c7['options'][_0xb063('0x1b')]===undefined?!![]:![]:!![],'where':_0x3276c7[_0xb063('0x1a')]?_0x3276c7[_0xb063('0x1a')][_0xb063('0x1c')]||null:null,'attributes':_0x3276c7[_0xb063('0x1a')]?_0x3276c7[_0xb063('0x1a')][_0xb063('0x1d')]||null:null,'limit':_0x3276c7['options']?_0x3276c7[_0xb063('0x1a')][_0xb063('0x1e')]||null:null,'include':_0x3276c7['options']?_0x3276c7[_0xb063('0x1a')][_0xb063('0x1f')]?_[_0xb063('0x20')](_0x3276c7[_0xb063('0x1a')][_0xb063('0x1f')],function(_0xa306a7){return{'model':db[_0xa306a7[_0xb063('0x21')]],'as':_0xa306a7['as'],'attributes':_0xa306a7[_0xb063('0x1d')],'include':_0xa306a7['include']?_['map'](_0xa306a7['include'],function(_0x54950f){return{'model':db[_0x54950f['model']],'as':_0x54950f['as'],'attributes':_0x54950f[_0xb063('0x1d')],'include':_0x54950f[_0xb063('0x1f')]?_[_0xb063('0x20')](_0x54950f[_0xb063('0x1f')],function(_0x238b4d){return{'model':db[_0x238b4d['model']],'as':_0x238b4d['as'],'attributes':_0x238b4d[_0xb063('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x495b2c){logger['info'](_0xb063('0x22'),_0x3276c7);logger['debug'](_0xb063('0x22'),_0x3276c7,JSON[_0xb063('0x13')](_0x495b2c));_0xfb0447(_0x495b2c);})[_0xb063('0x18')](function(_0x3a04e4){logger[_0xb063('0x14')]('GetWhatsappQueue',_0x3a04e4['message'],_0x3276c7);_0xe40501(_0x45931b[_0xb063('0x14')](0x1f4,_0x3a04e4[_0xb063('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x447a72){var _0x364c8c=this;return new Promise(function(_0x27c5fb,_0x2bed61){return db[_0xb063('0x23')][_0xb063('0x24')]({'raw':_0x447a72[_0xb063('0x1a')]?_0x447a72['options'][_0xb063('0x1b')]===undefined?!![]:![]:!![],'where':_0x447a72[_0xb063('0x1a')]?_0x447a72[_0xb063('0x1a')][_0xb063('0x1c')]||null:null,'attributes':_0x447a72[_0xb063('0x1a')]?_0x447a72[_0xb063('0x1a')][_0xb063('0x1d')]||null:null,'include':_0x447a72[_0xb063('0x1a')]?_0x447a72[_0xb063('0x1a')][_0xb063('0x1f')]?_[_0xb063('0x20')](_0x447a72['options'][_0xb063('0x1f')],function(_0x17be1c){return{'model':db[_0x17be1c[_0xb063('0x21')]],'as':_0x17be1c['as'],'attributes':_0x17be1c[_0xb063('0x1d')],'include':_0x17be1c[_0xb063('0x1f')]?_[_0xb063('0x20')](_0x17be1c['include'],function(_0x5b5ef7){return{'model':db[_0x5b5ef7[_0xb063('0x21')]],'as':_0x5b5ef7['as'],'attributes':_0x5b5ef7[_0xb063('0x1d')],'include':_0x5b5ef7[_0xb063('0x1f')]?_[_0xb063('0x20')](_0x5b5ef7[_0xb063('0x1f')],function(_0x2de771){return{'model':db[_0x2de771[_0xb063('0x21')]],'as':_0x2de771['as'],'attributes':_0x2de771['attributes']};}):[]};}):[]};}):[]:[]})[_0xb063('0xe')](function(_0x301a38){logger[_0xb063('0xf')]('ShowWhatsappQueue',_0x447a72);logger[_0xb063('0x25')](_0xb063('0x26'),_0x447a72,JSON[_0xb063('0x13')](_0x301a38));_0x27c5fb(_0x301a38);})[_0xb063('0x18')](function(_0x39675d){logger[_0xb063('0x14')]('ShowWhatsappQueue',_0x39675d['message'],_0x447a72);_0x2bed61(_0x364c8c[_0xb063('0x14')](0x1f4,_0x39675d[_0xb063('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c4c3dff..2a52aa2 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 _0x80ea=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x80ea,0x1f3));var _0xa80e=function(_0x1c29b4,_0x5787ba){_0x1c29b4=_0x1c29b4-0x0;var _0x218ad2=_0x80ea[_0x1c29b4];return _0x218ad2;};'use strict';var WhatsappQueueEvents=require(_0xa80e('0x0'));var events=[_0xa80e('0x1'),_0xa80e('0x2'),_0xa80e('0x3')];function createListener(_0x4f7754,_0x5dd905){return function(_0x2be3be){_0x5dd905[_0xa80e('0x4')](_0x4f7754,_0x2be3be);};}function removeListener(_0x30350e,_0x19125f){return function(){WhatsappQueueEvents[_0xa80e('0x5')](_0x30350e,_0x19125f);};}exports[_0xa80e('0x6')]=function(_0x2ef980){for(var _0x3a33c7=0x0,_0x2a2ef2=events[_0xa80e('0x7')];_0x3a33c7<_0x2a2ef2;_0x3a33c7++){var _0x55131a=events[_0x3a33c7];var _0x10df09=createListener(_0xa80e('0x8')+_0x55131a,_0x2ef980);WhatsappQueueEvents['on'](_0x55131a,_0x10df09);}}; \ No newline at end of file +var _0x249e=['emit','removeListener','register','length','./whatsappQueue.events','remove'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x249e,0x17e));var _0xe249=function(_0x2d5aaa,_0x1ddb67){_0x2d5aaa=_0x2d5aaa-0x0;var _0x42469d=_0x249e[_0x2d5aaa];return _0x42469d;};'use strict';var WhatsappQueueEvents=require(_0xe249('0x0'));var events=['save',_0xe249('0x1'),'update'];function createListener(_0x23e11e,_0x4ee6b1){return function(_0x14ca09){_0x4ee6b1[_0xe249('0x2')](_0x23e11e,_0x14ca09);};}function removeListener(_0x5a1423,_0x441dc2){return function(){WhatsappQueueEvents[_0xe249('0x3')](_0x5a1423,_0x441dc2);};}exports[_0xe249('0x4')]=function(_0x2e9cde){for(var _0x1ef444=0x0,_0x4011f1=events[_0xe249('0x5')];_0x1ef444<_0x4011f1;_0x1ef444++){var _0x26e0ec=events[_0x1ef444];var _0x2a49fc=createListener('whatsappQueue:'+_0x26e0ec,_0x2e9cde);WhatsappQueueEvents['on'](_0x26e0ec,_0x2a49fc);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7933f52..14bb909 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 _0xf86b=['./whatsappQueueReport.controller','get','isAuthenticated','index','describe','show','post','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x4a7b4c,_0x548e5f){var _0x2a89d8=function(_0x2af5e7){while(--_0x2af5e7){_0x4a7b4c['push'](_0x4a7b4c['shift']());}};_0x2a89d8(++_0x548e5f);}(_0xf86b,0xd7));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf86('0x0'));var timeout=require(_0xbf86('0x1'));var express=require(_0xbf86('0x2'));var router=express[_0xbf86('0x3')]();var fs_extra=require(_0xbf86('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf86('0x5'));var controller=require(_0xbf86('0x6'));router[_0xbf86('0x7')]('/',auth[_0xbf86('0x8')](),controller[_0xbf86('0x9')]);router[_0xbf86('0x7')]('/describe',auth[_0xbf86('0x8')](),controller[_0xbf86('0xa')]);router['get']('/:id',auth[_0xbf86('0x8')](),controller[_0xbf86('0xb')]);router[_0xbf86('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbf86('0xd'),auth[_0xbf86('0x8')](),controller[_0xbf86('0xe')]);router[_0xbf86('0xf')](_0xbf86('0xd'),auth[_0xbf86('0x8')](),controller['destroy']);module[_0xbf86('0x10')]=router; \ No newline at end of file +var _0x2c89=['update','delete','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xf5b29b,_0x36d7fc){var _0x57c8f8=function(_0x5dc595){while(--_0x5dc595){_0xf5b29b['push'](_0xf5b29b['shift']());}};_0x57c8f8(++_0x36d7fc);}(_0x2c89,0x103));var _0x92c8=function(_0x13a505,_0x1ccce5){_0x13a505=_0x13a505-0x0;var _0x1c0298=_0x2c89[_0x13a505];return _0x1c0298;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x92c8('0x0'));var express=require('express');var router=express[_0x92c8('0x1')]();var fs_extra=require(_0x92c8('0x2'));var auth=require(_0x92c8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x92c8('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0x92c8('0x5')]('/',auth[_0x92c8('0x6')](),controller[_0x92c8('0x7')]);router[_0x92c8('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x92c8('0x5')]('/:id',auth[_0x92c8('0x6')](),controller[_0x92c8('0x8')]);router[_0x92c8('0x9')]('/',auth[_0x92c8('0x6')](),controller[_0x92c8('0xa')]);router[_0x92c8('0xb')](_0x92c8('0xc'),auth[_0x92c8('0x6')](),controller[_0x92c8('0xd')]);router[_0x92c8('0xe')](_0x92c8('0xc'),auth[_0x92c8('0x6')](),controller['destroy']);module[_0x92c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d3dc75e..6102cba 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5e4a16,_0x108a70){var _0x379f86=function(_0x25e1c0){while(--_0x25e1c0){_0x5e4a16['push'](_0x5e4a16['shift']());}};_0x379f86(++_0x108a70);}(_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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4a1839,_0x2edf92){var _0x5251fc=function(_0x31a925){while(--_0x31a925){_0x4a1839['push'](_0x4a1839['shift']());}};_0x5251fc(++_0x2edf92);}(_0x7a54,0x106));var _0x47a5=function(_0x3715b0,_0x258ad5){_0x3715b0=_0x3715b0-0x0;var _0x2ce7e8=_0x7a54[_0x3715b0];return _0x2ce7e8;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bc5077e..c5290c6 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 _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0x58d379,_0x4d6fa5){var _0x4c322b=function(_0x1eb1ad){while(--_0x1eb1ad){_0x58d379['push'](_0x58d379['shift']());}};_0x4c322b(++_0x4d6fa5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x5eb8[_0x36bff5];return _0x80ade5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file +var _0x7af2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','keys','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x591cc2,_0x475e65){var _0x587803=function(_0x541edb){while(--_0x541edb){_0x591cc2['push'](_0x591cc2['shift']());}};_0x587803(++_0x475e65);}(_0x7af2,0x119));var _0x27af=function(_0x3886c7,_0x20c039){_0x3886c7=_0x3886c7-0x0;var _0x10be22=_0x7af2[_0x3886c7];return _0x10be22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){_0x43dd9e['status'](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x4feaf1,_0x12625c){return function(_0x396326){if(!_0x396326){_0x4feaf1['sendStatus'](0x194);}return _0x396326;};}function handleError(_0x393190,_0x1d9341){_0x1d9341=_0x1d9341||0x1f4;return function(_0x463e36){logger[_0x27af('0x24')](_0x463e36[_0x27af('0x25')]);if(_0x463e36[_0x27af('0x26')]){delete _0x463e36[_0x27af('0x26')];}_0x393190['status'](_0x1d9341)[_0x27af('0x27')](_0x463e36);};}exports[_0x27af('0x28')]=function(_0xadd38e,_0xe009a){var _0x25d65a={},_0xa08dd9={},_0x42a5b7={'count':0x0,'rows':[]};var _0x2b26ac=_[_0x27af('0x29')](db[_0x27af('0x2a')][_0x27af('0x2b')],function(_0x4f4955){return{'name':_0x4f4955[_0x27af('0x2c')],'type':_0x4f4955[_0x27af('0x2d')][_0x27af('0x2e')]};});_0xa08dd9[_0x27af('0x2f')]=_[_0x27af('0x29')](_0x2b26ac,_0x27af('0x26'));_0xa08dd9['query']=_['keys'](_0xadd38e[_0x27af('0x30')]);_0xa08dd9[_0x27af('0x31')]=_['intersection'](_0xa08dd9[_0x27af('0x2f')],_0xa08dd9[_0x27af('0x30')]);_0x25d65a[_0x27af('0x32')]=_[_0x27af('0x33')](_0xa08dd9[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xadd38e[_0x27af('0x30')][_0x27af('0x34')]));_0x25d65a[_0x27af('0x32')]=_0x25d65a[_0x27af('0x32')][_0x27af('0x35')]?_0x25d65a['attributes']:_0xa08dd9['model'];if(!_0xadd38e[_0x27af('0x30')][_0x27af('0x36')]('nolimit')){_0x25d65a[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0xadd38e['query'][_0x27af('0x1d')]);_0x25d65a[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xadd38e[_0x27af('0x30')][_0x27af('0x1b')]);}_0x25d65a['order']=qs[_0x27af('0x37')](_0xadd38e[_0x27af('0x30')]['sort']);_0x25d65a['where']=qs[_0x27af('0x31')](_[_0x27af('0x38')](_0xadd38e[_0x27af('0x30')],_0xa08dd9[_0x27af('0x31')]),_0x2b26ac);if(_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]){_0x25d65a['where']=_[_0x27af('0x3a')](_0x25d65a['where'],{'$or':_[_0x27af('0x29')](_0x2b26ac,function(_0x38a532){if(_0x38a532[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x1c6a4d={};_0x1c6a4d[_0x38a532['name']]={'$like':'%'+_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]+'%'};return _0x1c6a4d;}})});}_0x25d65a=_[_0x27af('0x3a')]({},_0x25d65a,_0xadd38e[_0x27af('0x3c')]);var _0x10c1be={'where':_0x25d65a[_0x27af('0x3d')]};return db[_0x27af('0x2a')][_0x27af('0x1e')](_0x10c1be)[_0x27af('0x23')](function(_0x18f11b){_0x42a5b7[_0x27af('0x1e')]=_0x18f11b;if(_0xadd38e[_0x27af('0x30')][_0x27af('0x3e')]){_0x25d65a[_0x27af('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x27af('0x40')](_0x25d65a);})[_0x27af('0x23')](function(_0x44534b){_0x42a5b7[_0x27af('0x41')]=_0x44534b;return _0x42a5b7;})['then'](respondWithFilteredResult(_0xe009a,_0x25d65a))[_0x27af('0x42')](handleError(_0xe009a,null));};exports['show']=function(_0x516651,_0x2425dd){var _0x3c9c81={'raw':!![],'where':{'id':_0x516651[_0x27af('0x43')]['id']}},_0x279f99={};_0x279f99[_0x27af('0x2f')]=_[_0x27af('0x44')](db[_0x27af('0x2a')][_0x27af('0x2b')]);_0x279f99[_0x27af('0x30')]=_[_0x27af('0x44')](_0x516651[_0x27af('0x30')]);_0x279f99[_0x27af('0x31')]=_['intersection'](_0x279f99[_0x27af('0x2f')],_0x279f99[_0x27af('0x30')]);_0x3c9c81['attributes']=_['intersection'](_0x279f99[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x516651[_0x27af('0x30')][_0x27af('0x34')]));_0x3c9c81[_0x27af('0x32')]=_0x3c9c81['attributes'][_0x27af('0x35')]?_0x3c9c81['attributes']:_0x279f99[_0x27af('0x2f')];if(_0x516651[_0x27af('0x30')][_0x27af('0x3e')]){_0x3c9c81[_0x27af('0x3f')]=[{'all':!![]}];}_0x3c9c81=_[_0x27af('0x3a')]({},_0x3c9c81,_0x516651[_0x27af('0x3c')]);return db[_0x27af('0x2a')]['find'](_0x3c9c81)['then'](handleEntityNotFound(_0x2425dd,null))[_0x27af('0x23')](respondWithResult(_0x2425dd,null))['catch'](handleError(_0x2425dd,null));};exports[_0x27af('0x45')]=function(_0x1b43e2,_0x226025){return db[_0x27af('0x2a')][_0x27af('0x45')](_0x1b43e2[_0x27af('0x46')],{})[_0x27af('0x23')](respondWithResult(_0x226025,0xc9))['catch'](handleError(_0x226025,null));};exports[_0x27af('0x22')]=function(_0xc7e2a8,_0x20e180){if(_0xc7e2a8[_0x27af('0x46')]['id']){delete _0xc7e2a8[_0x27af('0x46')]['id'];}return db['WhatsappQueueReport'][_0x27af('0x47')]({'where':{'id':_0xc7e2a8[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x20e180,null))['then'](saveUpdates(_0xc7e2a8['body'],null))[_0x27af('0x23')](respondWithResult(_0x20e180,null))[_0x27af('0x42')](handleError(_0x20e180,null));};exports[_0x27af('0x48')]=function(_0x5be44f,_0x495794){return db[_0x27af('0x2a')]['find']({'where':{'id':_0x5be44f[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x495794,null))[_0x27af('0x23')](removeEntity(_0x495794,null))[_0x27af('0x42')](handleError(_0x495794,null));};exports[_0x27af('0x49')]=function(_0xb9e23,_0x123533){return db[_0x27af('0x2a')][_0x27af('0x49')]()[_0x27af('0x23')](respondWithResult(_0x123533,null))[_0x27af('0x42')](handleError(_0x123533,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 208a26c..c165053 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 _0xc450=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc450,0xa8));var _0x0c45=function(_0x1dfe46,_0xff0d76){_0x1dfe46=_0x1dfe46-0x0;var _0x455b14=_0xc450[_0x1dfe46];return _0x455b14;};'use strict';var _=require('lodash');var util=require(_0x0c45('0x0'));var logger=require(_0x0c45('0x1'))(_0x0c45('0x2'));var moment=require(_0x0c45('0x3'));var BPromise=require(_0x0c45('0x4'));var rp=require(_0x0c45('0x5'));var fs=require('fs');var path=require(_0x0c45('0x6'));var rimraf=require(_0x0c45('0x7'));var config=require(_0x0c45('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0c45('0x9')]=function(_0x1b89cf,_0xd9de64){return _0x1b89cf['define'](_0x0c45('0xa'),attributes,{'tableName':_0x0c45('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0c45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdde9=['moment','bluebird','request-promise','path','./whatsappQueueReport.attributes','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x520ec8,_0x4efc4b){var _0x53f9ed=function(_0x5327e6){while(--_0x5327e6){_0x520ec8['push'](_0x520ec8['shift']());}};_0x53f9ed(++_0x4efc4b);}(_0xdde9,0x1a9));var _0x9dde=function(_0x5af740,_0x29514d){_0x5af740=_0x5af740-0x0;var _0x1244e6=_0xdde9[_0x5af740];return _0x1244e6;};'use strict';var _=require(_0x9dde('0x0'));var util=require(_0x9dde('0x1'));var logger=require(_0x9dde('0x2'))(_0x9dde('0x3'));var moment=require(_0x9dde('0x4'));var BPromise=require(_0x9dde('0x5'));var rp=require(_0x9dde('0x6'));var fs=require('fs');var path=require(_0x9dde('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9dde('0x8'));module['exports']=function(_0x412f6d,_0x48d1e0){return _0x412f6d['define']('WhatsappQueueReport',attributes,{'tableName':_0x9dde('0x9'),'paranoid':![],'indexes':[{'name':_0x9dde('0xa'),'fields':[_0x9dde('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bce6058..0c3454d 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 _0xe25b=['info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','then','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0xe25b,0x129));var _0xbe25=function(_0xcd0e3c,_0x50ac64){_0xcd0e3c=_0xcd0e3c-0x0;var _0x333329=_0xe25b[_0xcd0e3c];return _0x333329;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var moment=require(_0xbe25('0x2'));var BPromise=require(_0xbe25('0x3'));var rs=require(_0xbe25('0x4'));var fs=require('fs');var Redis=require(_0xbe25('0x5'));var db=require(_0xbe25('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe25('0x7'))('rpc');var config=require(_0xbe25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c659c,_0x3d7a03,_0x335454){return new BPromise(function(_0x4d33db,_0x2ba149){return client[_0xbe25('0xa')](_0x2c659c,_0x335454)['then'](function(_0x4bb6b5){logger[_0xbe25('0xb')](_0xbe25('0xc'),_0x3d7a03,'request\x20sent');logger['debug'](_0xbe25('0xd'),_0x3d7a03,_0xbe25('0xe'),JSON[_0xbe25('0xf')](_0x4bb6b5));if(_0x4bb6b5[_0xbe25('0x10')]){if(_0x4bb6b5[_0xbe25('0x10')]['code']===0x1f4){logger[_0xbe25('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d7a03,_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);return _0x2ba149(_0x4bb6b5['error'][_0xbe25('0x11')]);}logger[_0xbe25('0x10')](_0xbe25('0xc'),_0x3d7a03,_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);return _0x4d33db(_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);}else{logger['info'](_0xbe25('0xc'),_0x3d7a03,'request\x20sent');_0x4d33db(_0x4bb6b5['result'][_0xbe25('0x11')]);}})[_0xbe25('0x12')](function(_0x401bc3){logger[_0xbe25('0x10')](_0xbe25('0xc'),_0x3d7a03,_0x401bc3);_0x2ba149(_0x401bc3);});});}exports[_0xbe25('0x13')]=function(_0x218e63){var _0x193b54=this;return new Promise(function(_0x43d26e,_0x45cb9b){return db[_0xbe25('0x14')]['create'](_0x218e63[_0xbe25('0x15')],{'raw':_0x218e63[_0xbe25('0x16')]?_0x218e63[_0xbe25('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbe25('0x17')](function(_0x5bf982){logger[_0xbe25('0xb')]('CreateWhatsappQueueReport',_0x218e63);logger['debug'](_0xbe25('0x13'),_0x218e63,JSON['stringify'](_0x5bf982));_0x43d26e(_0x5bf982);})[_0xbe25('0x12')](function(_0xc2a1cd){logger['error'](_0xbe25('0x13'),_0xc2a1cd[_0xbe25('0x11')],_0x218e63);_0x45cb9b(_0x193b54[_0xbe25('0x10')](0x1f4,_0xc2a1cd[_0xbe25('0x11')]));});});};exports[_0xbe25('0x18')]=function(_0x58e193){var _0x146b8b=this;return new Promise(function(_0x44f7b8,_0x2ab603){return db[_0xbe25('0x14')]['update'](_0x58e193[_0xbe25('0x15')],{'raw':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')][_0xbe25('0x19')]||null:null,'attributes':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')][_0xbe25('0x1a')]||null:null,'limit':_0x58e193[_0xbe25('0x16')]?_0x58e193['options'][_0xbe25('0x1b')]||null:null})[_0xbe25('0x17')](function(_0xe2dca6){logger[_0xbe25('0xb')]('UpdateWhatsappQueueReport',_0x58e193);logger['debug'](_0xbe25('0x18'),_0x58e193,JSON[_0xbe25('0xf')](_0xe2dca6));_0x44f7b8(_0xe2dca6);})['catch'](function(_0x9f7120){logger[_0xbe25('0x10')](_0xbe25('0x18'),_0x9f7120[_0xbe25('0x11')],_0x58e193);_0x2ab603(_0x146b8b[_0xbe25('0x10')](0x1f4,_0x9f7120['message']));});});}; \ No newline at end of file +var _0x5fcd=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3c5228,_0x448d00){var _0x400abc=function(_0x4140ee){while(--_0x4140ee){_0x3c5228['push'](_0x3c5228['shift']());}};_0x400abc(++_0x448d00);}(_0x5fcd,0x11b));var _0xd5fc=function(_0x4a46be,_0x2a778d){_0x4a46be=_0x4a46be-0x0;var _0x3aff09=_0x5fcd[_0x4a46be];return _0x3aff09;};'use strict';var _=require(_0xd5fc('0x0'));var util=require(_0xd5fc('0x1'));var moment=require(_0xd5fc('0x2'));var BPromise=require(_0xd5fc('0x3'));var rs=require(_0xd5fc('0x4'));var fs=require('fs');var Redis=require(_0xd5fc('0x5'));var db=require(_0xd5fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5fc('0x7'))(_0xd5fc('0x8'));var config=require(_0xd5fc('0x9'));var jayson=require(_0xd5fc('0xa'));var client=jayson['client'][_0xd5fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x394ee1,_0x1abe20,_0x4fdced){return new BPromise(function(_0xea2a4,_0x902221){return client[_0xd5fc('0xc')](_0x394ee1,_0x4fdced)[_0xd5fc('0xd')](function(_0x18c75a){logger[_0xd5fc('0xe')](_0xd5fc('0xf'),_0x1abe20,_0xd5fc('0x10'));logger[_0xd5fc('0x11')](_0xd5fc('0x12'),_0x1abe20,_0xd5fc('0x10'),JSON['stringify'](_0x18c75a));if(_0x18c75a[_0xd5fc('0x13')]){if(_0x18c75a[_0xd5fc('0x13')]['code']===0x1f4){logger[_0xd5fc('0x13')](_0xd5fc('0xf'),_0x1abe20,_0x18c75a[_0xd5fc('0x13')]['message']);return _0x902221(_0x18c75a[_0xd5fc('0x13')]['message']);}logger['error'](_0xd5fc('0xf'),_0x1abe20,_0x18c75a[_0xd5fc('0x13')][_0xd5fc('0x14')]);return _0xea2a4(_0x18c75a[_0xd5fc('0x13')][_0xd5fc('0x14')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x1abe20,_0xd5fc('0x10'));_0xea2a4(_0x18c75a['result'][_0xd5fc('0x14')]);}})[_0xd5fc('0x15')](function(_0x3cfffa){logger[_0xd5fc('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1abe20,_0x3cfffa);_0x902221(_0x3cfffa);});});}exports[_0xd5fc('0x16')]=function(_0x9197fa){var _0x41e8cd=this;return new Promise(function(_0x12ead4,_0x3473a7){return db[_0xd5fc('0x17')][_0xd5fc('0x18')](_0x9197fa[_0xd5fc('0x19')],{'raw':_0x9197fa['options']?_0x9197fa[_0xd5fc('0x1a')][_0xd5fc('0x1b')]===undefined?!![]:![]:!![]})[_0xd5fc('0xd')](function(_0xfac00f){logger[_0xd5fc('0xe')](_0xd5fc('0x16'),_0x9197fa);logger[_0xd5fc('0x11')](_0xd5fc('0x16'),_0x9197fa,JSON[_0xd5fc('0x1c')](_0xfac00f));_0x12ead4(_0xfac00f);})['catch'](function(_0x5c5fe8){logger[_0xd5fc('0x13')]('CreateWhatsappQueueReport',_0x5c5fe8[_0xd5fc('0x14')],_0x9197fa);_0x3473a7(_0x41e8cd[_0xd5fc('0x13')](0x1f4,_0x5c5fe8[_0xd5fc('0x14')]));});});};exports[_0xd5fc('0x1d')]=function(_0x23eaef){var _0x5ca5c4=this;return new Promise(function(_0xff5529,_0x2b591d){return db[_0xd5fc('0x17')]['update'](_0x23eaef[_0xd5fc('0x19')],{'raw':_0x23eaef[_0xd5fc('0x1a')]?_0x23eaef[_0xd5fc('0x1a')][_0xd5fc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23eaef[_0xd5fc('0x1a')]?_0x23eaef[_0xd5fc('0x1a')][_0xd5fc('0x1e')]||null:null,'attributes':_0x23eaef[_0xd5fc('0x1a')]?_0x23eaef[_0xd5fc('0x1a')][_0xd5fc('0x1f')]||null:null,'limit':_0x23eaef[_0xd5fc('0x1a')]?_0x23eaef['options'][_0xd5fc('0x20')]||null:null})[_0xd5fc('0xd')](function(_0x5f4a8f){logger[_0xd5fc('0xe')]('UpdateWhatsappQueueReport',_0x23eaef);logger[_0xd5fc('0x11')](_0xd5fc('0x1d'),_0x23eaef,JSON[_0xd5fc('0x1c')](_0x5f4a8f));_0xff5529(_0x5f4a8f);})[_0xd5fc('0x15')](function(_0xcd0eb1){logger[_0xd5fc('0x13')](_0xd5fc('0x1d'),_0xcd0eb1[_0xd5fc('0x14')],_0x23eaef);_0x2b591d(_0x5ca5c4[_0xd5fc('0x13')](0x1f4,_0xcd0eb1[_0xd5fc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ee7bc8e..5b74077 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 _0xdcfe=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','exports','multer','path'];(function(_0x1489f1,_0x50518e){var _0x4d0b49=function(_0x3f972b){while(--_0x3f972b){_0x1489f1['push'](_0x1489f1['shift']());}};_0x4d0b49(++_0x50518e);}(_0xdcfe,0x86));var _0xedcf=function(_0x38cd48,_0x1ac338){_0x38cd48=_0x38cd48-0x0;var _0x117b92=_0xdcfe[_0x38cd48];return _0x117b92;};'use strict';var multer=require(_0xedcf('0x0'));var util=require('util');var path=require(_0xedcf('0x1'));var timeout=require('connect-timeout');var express=require(_0xedcf('0x2'));var router=express[_0xedcf('0x3')]();var fs_extra=require(_0xedcf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xedcf('0x5'));var config=require(_0xedcf('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xedcf('0x7')]('/',auth[_0xedcf('0x8')](),controller[_0xedcf('0x9')]);router[_0xedcf('0x7')](_0xedcf('0xa'),auth['isAuthenticated'](),controller[_0xedcf('0xb')]);router[_0xedcf('0x7')](_0xedcf('0xc'),auth[_0xedcf('0x8')](),controller[_0xedcf('0xd')]);router['post']('/',auth[_0xedcf('0x8')](),controller[_0xedcf('0xe')]);router['put'](_0xedcf('0xc'),auth[_0xedcf('0x8')](),controller[_0xedcf('0xf')]);router['delete']('/:id',auth[_0xedcf('0x8')](),controller['destroy']);module[_0xedcf('0x10')]=router; \ No newline at end of file +var _0x69f7=['destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','post','put','/:id','update','delete'];(function(_0x5e445b,_0x3a8501){var _0x184044=function(_0x307498){while(--_0x307498){_0x5e445b['push'](_0x5e445b['shift']());}};_0x184044(++_0x3a8501);}(_0x69f7,0x1d2));var _0x769f=function(_0x25310f,_0x2c5eff){_0x25310f=_0x25310f-0x0;var _0x10d319=_0x69f7[_0x25310f];return _0x10d319;};'use strict';var multer=require(_0x769f('0x0'));var util=require(_0x769f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x769f('0x2'));var router=express[_0x769f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x769f('0x4'));var config=require(_0x769f('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0x769f('0x6')]('/',auth[_0x769f('0x7')](),controller['index']);router[_0x769f('0x6')](_0x769f('0x8'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x769f('0x7')](),controller['show']);router[_0x769f('0x9')]('/',auth[_0x769f('0x7')](),controller['create']);router[_0x769f('0xa')](_0x769f('0xb'),auth[_0x769f('0x7')](),controller[_0x769f('0xc')]);router[_0x769f('0xd')](_0x769f('0xb'),auth[_0x769f('0x7')](),controller[_0x769f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6025478..6f03400 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 _0x5800=['account','queue','DATE','exports','STRING','ENUM'];(function(_0x527430,_0x27b9c7){var _0x2d2ad4=function(_0x32ca98){while(--_0x32ca98){_0x527430['push'](_0x527430['shift']());}};_0x2d2ad4(++_0x27b9c7);}(_0x5800,0x1b9));var _0x0580=function(_0x22006d,_0x373ffc){_0x22006d=_0x22006d-0x0;var _0x2e0a27=_0x5800[_0x22006d];return _0x2e0a27;};'use strict';var Sequelize=require('sequelize');module[_0x0580('0x0')]={'uniqueid':{'type':Sequelize[_0x0580('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0580('0x2')](_0x0580('0x3'),'agent',_0x0580('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0580('0x5')]}}; \ No newline at end of file +var _0x4dc0=['agent','queue','STRING','ENUM','account'];(function(_0x2d978e,_0x5d9b47){var _0x583c64=function(_0x4efbcf){while(--_0x4efbcf){_0x2d978e['push'](_0x2d978e['shift']());}};_0x583c64(++_0x5d9b47);}(_0x4dc0,0x13d));var _0x04dc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4dc0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x04dc('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x04dc('0x1')](_0x04dc('0x2'),_0x04dc('0x3'),_0x04dc('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a997355..de027e5 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 _0x49c1=['WhatsappTransferReport','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x23c97f,_0xb9be8c){var _0x1a6218=function(_0x548aa6){while(--_0x548aa6){_0x23c97f['push'](_0x23c97f['shift']());}};_0x1a6218(++_0xb9be8c);}(_0x49c1,0x68));var _0x149c=function(_0x165195,_0x207834){_0x165195=_0x165195-0x0;var _0x3889b0=_0x49c1[_0x165195];return _0x3889b0;};'use strict';var emlformat=require(_0x149c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x149c('0x1'));var moment=require(_0x149c('0x2'));var BPromise=require(_0x149c('0x3'));var Mustache=require(_0x149c('0x4'));var util=require(_0x149c('0x5'));var path=require(_0x149c('0x6'));var sox=require(_0x149c('0x7'));var csv=require(_0x149c('0x8'));var ejs=require(_0x149c('0x9'));var fs=require('fs');var fs_extra=require(_0x149c('0xa'));var _=require(_0x149c('0xb'));var squel=require('squel');var crypto=require(_0x149c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x149c('0xd'));var toCsv=require(_0x149c('0x8'));var querystring=require(_0x149c('0xe'));var Papa=require('papaparse');var Redis=require(_0x149c('0xf'));var authService=require(_0x149c('0x10'));var qs=require(_0x149c('0x11'));var as=require(_0x149c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x149c('0x13'));var utils=require(_0x149c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x149c('0x15'));var db=require(_0x149c('0x16'))['db'];function respondWithStatusCode(_0x57eefc,_0x59e91d){_0x59e91d=_0x59e91d||0xcc;return function(_0x43103a){if(_0x43103a){return _0x57eefc[_0x149c('0x17')](_0x59e91d);}return _0x57eefc[_0x149c('0x18')](_0x59e91d)['end']();};}function respondWithResult(_0x2966b9,_0x5cc085){_0x5cc085=_0x5cc085||0xc8;return function(_0x3e8e7a){if(_0x3e8e7a){return _0x2966b9[_0x149c('0x18')](_0x5cc085)[_0x149c('0x19')](_0x3e8e7a);}};}function respondWithFilteredResult(_0x3ac140,_0x2e72b5){return function(_0x545241){if(_0x545241){var _0x1e86a1=typeof _0x2e72b5[_0x149c('0x1a')]===_0x149c('0x1b')&&typeof _0x2e72b5['limit']==='undefined';var _0x47b98f=_0x545241[_0x149c('0x1c')];var _0x1763b5=_0x1e86a1?0x0:_0x2e72b5[_0x149c('0x1a')];var _0x36f0bf=_0x1e86a1?_0x545241['count']:_0x2e72b5['offset']+_0x2e72b5[_0x149c('0x1d')];var _0x14914a;if(_0x36f0bf>=_0x47b98f){_0x36f0bf=_0x47b98f;_0x14914a=0xc8;}else{_0x14914a=0xce;}_0x3ac140[_0x149c('0x18')](_0x14914a);return _0x3ac140[_0x149c('0x1e')](_0x149c('0x1f'),_0x1763b5+'-'+_0x36f0bf+'/'+_0x47b98f)[_0x149c('0x19')](_0x545241);}return null;};}function patchUpdates(_0x4f9cdd){return function(_0x24295c){try{jsonpatch[_0x149c('0x20')](_0x24295c,_0x4f9cdd,!![]);}catch(_0x4aa505){return BPromise[_0x149c('0x21')](_0x4aa505);}return _0x24295c['save']();};}function saveUpdates(_0x48159b,_0x10cba3){return function(_0x24813d){if(_0x24813d){return _0x24813d[_0x149c('0x22')](_0x48159b)[_0x149c('0x23')](function(_0x105246){return _0x105246;});}return null;};}function removeEntity(_0x178f6e,_0x349c9f){return function(_0x480276){if(_0x480276){return _0x480276[_0x149c('0x24')]()[_0x149c('0x23')](function(){_0x178f6e[_0x149c('0x18')](0xcc)[_0x149c('0x25')]();});}};}function handleEntityNotFound(_0x257ad9,_0x5af2e2){return function(_0xc4ba41){if(!_0xc4ba41){_0x257ad9[_0x149c('0x17')](0x194);}return _0xc4ba41;};}function handleError(_0x3f4d0c,_0x34d8d8){_0x34d8d8=_0x34d8d8||0x1f4;return function(_0x12f9b1){logger[_0x149c('0x26')](_0x12f9b1[_0x149c('0x27')]);if(_0x12f9b1[_0x149c('0x28')]){delete _0x12f9b1['name'];}_0x3f4d0c[_0x149c('0x18')](_0x34d8d8)[_0x149c('0x29')](_0x12f9b1);};}exports[_0x149c('0x2a')]=function(_0x2ef17e,_0x4abfe0){var _0xbff6d9={},_0x5d299e={},_0x222208={'count':0x0,'rows':[]};var _0x5df9bf=_[_0x149c('0x2b')](db[_0x149c('0x2c')]['rawAttributes'],function(_0x1866f0){return{'name':_0x1866f0['fieldName'],'type':_0x1866f0[_0x149c('0x2d')][_0x149c('0x2e')]};});_0x5d299e[_0x149c('0x2f')]=_[_0x149c('0x2b')](_0x5df9bf,_0x149c('0x28'));_0x5d299e[_0x149c('0x30')]=_[_0x149c('0x31')](_0x2ef17e['query']);_0x5d299e[_0x149c('0x32')]=_[_0x149c('0x33')](_0x5d299e[_0x149c('0x2f')],_0x5d299e['query']);_0xbff6d9['attributes']=_['intersection'](_0x5d299e[_0x149c('0x2f')],qs[_0x149c('0x34')](_0x2ef17e[_0x149c('0x30')][_0x149c('0x34')]));_0xbff6d9[_0x149c('0x35')]=_0xbff6d9[_0x149c('0x35')]['length']?_0xbff6d9[_0x149c('0x35')]:_0x5d299e[_0x149c('0x2f')];if(!_0x2ef17e[_0x149c('0x30')][_0x149c('0x36')](_0x149c('0x37'))){_0xbff6d9[_0x149c('0x1d')]=qs[_0x149c('0x1d')](_0x2ef17e[_0x149c('0x30')]['limit']);_0xbff6d9['offset']=qs[_0x149c('0x1a')](_0x2ef17e['query']['offset']);}_0xbff6d9[_0x149c('0x38')]=qs[_0x149c('0x39')](_0x2ef17e[_0x149c('0x30')][_0x149c('0x39')]);_0xbff6d9[_0x149c('0x3a')]=qs[_0x149c('0x32')](_['pick'](_0x2ef17e[_0x149c('0x30')],_0x5d299e[_0x149c('0x32')]),_0x5df9bf);if(_0x2ef17e[_0x149c('0x30')]['filter']){_0xbff6d9[_0x149c('0x3a')]=_[_0x149c('0x3b')](_0xbff6d9[_0x149c('0x3a')],{'$or':_['map'](_0x5df9bf,function(_0x54abd6){if(_0x54abd6[_0x149c('0x2d')]!=='VIRTUAL'){var _0x3842f6={};_0x3842f6[_0x54abd6[_0x149c('0x28')]]={'$like':'%'+_0x2ef17e['query'][_0x149c('0x3c')]+'%'};return _0x3842f6;}})});}_0xbff6d9=_['merge']({},_0xbff6d9,_0x2ef17e[_0x149c('0x3d')]);var _0x48c7f9={'where':_0xbff6d9['where']};return db[_0x149c('0x2c')][_0x149c('0x1c')](_0x48c7f9)['then'](function(_0x4b4170){_0x222208[_0x149c('0x1c')]=_0x4b4170;if(_0x2ef17e[_0x149c('0x30')][_0x149c('0x3e')]){_0xbff6d9[_0x149c('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x149c('0x40')](_0xbff6d9);})[_0x149c('0x23')](function(_0x403e6b){_0x222208[_0x149c('0x41')]=_0x403e6b;return _0x222208;})[_0x149c('0x23')](respondWithFilteredResult(_0x4abfe0,_0xbff6d9))[_0x149c('0x42')](handleError(_0x4abfe0,null));};exports[_0x149c('0x43')]=function(_0x155f9b,_0xdd5f64){var _0x436fe0={'raw':!![],'where':{'id':_0x155f9b[_0x149c('0x44')]['id']}},_0xbd998c={};_0xbd998c[_0x149c('0x2f')]=_['keys'](db[_0x149c('0x2c')][_0x149c('0x45')]);_0xbd998c[_0x149c('0x30')]=_['keys'](_0x155f9b[_0x149c('0x30')]);_0xbd998c[_0x149c('0x32')]=_[_0x149c('0x33')](_0xbd998c[_0x149c('0x2f')],_0xbd998c['query']);_0x436fe0[_0x149c('0x35')]=_[_0x149c('0x33')](_0xbd998c[_0x149c('0x2f')],qs['fields'](_0x155f9b[_0x149c('0x30')][_0x149c('0x34')]));_0x436fe0[_0x149c('0x35')]=_0x436fe0['attributes']['length']?_0x436fe0['attributes']:_0xbd998c[_0x149c('0x2f')];if(_0x155f9b[_0x149c('0x30')][_0x149c('0x3e')]){_0x436fe0[_0x149c('0x3f')]=[{'all':!![]}];}_0x436fe0=_[_0x149c('0x3b')]({},_0x436fe0,_0x155f9b[_0x149c('0x3d')]);return db[_0x149c('0x2c')][_0x149c('0x46')](_0x436fe0)[_0x149c('0x23')](handleEntityNotFound(_0xdd5f64,null))[_0x149c('0x23')](respondWithResult(_0xdd5f64,null))[_0x149c('0x42')](handleError(_0xdd5f64,null));};exports['create']=function(_0x360d95,_0x576ade){return db[_0x149c('0x2c')][_0x149c('0x47')](_0x360d95['body'],{})[_0x149c('0x23')](respondWithResult(_0x576ade,0xc9))['catch'](handleError(_0x576ade,null));};exports[_0x149c('0x22')]=function(_0x326c92,_0x154de2){if(_0x326c92[_0x149c('0x48')]['id']){delete _0x326c92['body']['id'];}return db[_0x149c('0x2c')]['find']({'where':{'id':_0x326c92[_0x149c('0x44')]['id']}})[_0x149c('0x23')](handleEntityNotFound(_0x154de2,null))[_0x149c('0x23')](saveUpdates(_0x326c92[_0x149c('0x48')],null))[_0x149c('0x23')](respondWithResult(_0x154de2,null))[_0x149c('0x42')](handleError(_0x154de2,null));};exports[_0x149c('0x24')]=function(_0x5a21c7,_0x5950eb){return db[_0x149c('0x2c')][_0x149c('0x46')]({'where':{'id':_0x5a21c7[_0x149c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5950eb,null))[_0x149c('0x23')](removeEntity(_0x5950eb,null))[_0x149c('0x42')](handleError(_0x5950eb,null));};exports['describe']=function(_0x916656,_0x2d01d3){return db[_0x149c('0x2c')][_0x149c('0x49')]()[_0x149c('0x23')](respondWithResult(_0x2d01d3,null))['catch'](handleError(_0x2d01d3,null));}; \ No newline at end of file +var _0x3144=['map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x4877ab,_0x22d949){var _0x36b940=function(_0x3f7d8c){while(--_0x3f7d8c){_0x4877ab['push'](_0x4877ab['shift']());}};_0x36b940(++_0x22d949);}(_0x3144,0x1dd));var _0x4314=function(_0x3b45c1,_0x5bc0d5){_0x3b45c1=_0x3b45c1-0x0;var _0x15c208=_0x3144[_0x3b45c1];return _0x15c208;};'use strict';var emlformat=require(_0x4314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4314('0x1'));var jsonpatch=require(_0x4314('0x2'));var rp=require(_0x4314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4314('0x4'));var util=require(_0x4314('0x5'));var path=require(_0x4314('0x6'));var sox=require('sox');var csv=require(_0x4314('0x7'));var ejs=require(_0x4314('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4314('0x9'));var squel=require('squel');var crypto=require(_0x4314('0xa'));var jsforce=require(_0x4314('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4314('0x7'));var querystring=require(_0x4314('0xc'));var Papa=require(_0x4314('0xd'));var Redis=require(_0x4314('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4314('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4314('0x10'))(_0x4314('0x11'));var utils=require(_0x4314('0x12'));var config=require(_0x4314('0x13'));var licenseUtil=require(_0x4314('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dc0e,_0x515702){_0x515702=_0x515702||0xcc;return function(_0x2510dc){if(_0x2510dc){return _0x51dc0e[_0x4314('0x15')](_0x515702);}return _0x51dc0e[_0x4314('0x16')](_0x515702)[_0x4314('0x17')]();};}function respondWithResult(_0x29b9e2,_0x2d6dbe){_0x2d6dbe=_0x2d6dbe||0xc8;return function(_0x2415fb){if(_0x2415fb){return _0x29b9e2['status'](_0x2d6dbe)[_0x4314('0x18')](_0x2415fb);}};}function respondWithFilteredResult(_0x3f5c30,_0x296f36){return function(_0x4de855){if(_0x4de855){var _0x365ec3=typeof _0x296f36[_0x4314('0x19')]==='undefined'&&typeof _0x296f36['limit']===_0x4314('0x1a');var _0x7ea8e9=_0x4de855['count'];var _0x41078e=_0x365ec3?0x0:_0x296f36[_0x4314('0x19')];var _0x6da36c=_0x365ec3?_0x4de855[_0x4314('0x1b')]:_0x296f36[_0x4314('0x19')]+_0x296f36[_0x4314('0x1c')];var _0x5cf5cb;if(_0x6da36c>=_0x7ea8e9){_0x6da36c=_0x7ea8e9;_0x5cf5cb=0xc8;}else{_0x5cf5cb=0xce;}_0x3f5c30[_0x4314('0x16')](_0x5cf5cb);return _0x3f5c30[_0x4314('0x1d')](_0x4314('0x1e'),_0x41078e+'-'+_0x6da36c+'/'+_0x7ea8e9)['json'](_0x4de855);}return null;};}function patchUpdates(_0x4a1b77){return function(_0x4507d9){try{jsonpatch[_0x4314('0x1f')](_0x4507d9,_0x4a1b77,!![]);}catch(_0x68a221){return BPromise[_0x4314('0x20')](_0x68a221);}return _0x4507d9[_0x4314('0x21')]();};}function saveUpdates(_0x541e50,_0x3e7468){return function(_0x34d655){if(_0x34d655){return _0x34d655[_0x4314('0x22')](_0x541e50)[_0x4314('0x23')](function(_0x154b97){return _0x154b97;});}return null;};}function removeEntity(_0x17dc4b,_0x3e342e){return function(_0x222f78){if(_0x222f78){return _0x222f78[_0x4314('0x24')]()[_0x4314('0x23')](function(){_0x17dc4b['status'](0xcc)[_0x4314('0x17')]();});}};}function handleEntityNotFound(_0x564496,_0x294dce){return function(_0x50eba3){if(!_0x50eba3){_0x564496[_0x4314('0x15')](0x194);}return _0x50eba3;};}function handleError(_0x565e3e,_0x18fe8e){_0x18fe8e=_0x18fe8e||0x1f4;return function(_0x4cbafe){logger[_0x4314('0x25')](_0x4cbafe['stack']);if(_0x4cbafe[_0x4314('0x26')]){delete _0x4cbafe[_0x4314('0x26')];}_0x565e3e['status'](_0x18fe8e)[_0x4314('0x27')](_0x4cbafe);};}exports[_0x4314('0x28')]=function(_0x27b50a,_0x2b9b5b){var _0x4e96d4={},_0x5e49c7={},_0x154ff7={'count':0x0,'rows':[]};var _0x34f3ed=_[_0x4314('0x29')](db['WhatsappTransferReport'][_0x4314('0x2a')],function(_0x3c0691){return{'name':_0x3c0691['fieldName'],'type':_0x3c0691[_0x4314('0x2b')][_0x4314('0x2c')]};});_0x5e49c7[_0x4314('0x2d')]=_[_0x4314('0x29')](_0x34f3ed,_0x4314('0x26'));_0x5e49c7[_0x4314('0x2e')]=_['keys'](_0x27b50a[_0x4314('0x2e')]);_0x5e49c7[_0x4314('0x2f')]=_[_0x4314('0x30')](_0x5e49c7[_0x4314('0x2d')],_0x5e49c7[_0x4314('0x2e')]);_0x4e96d4[_0x4314('0x31')]=_[_0x4314('0x30')](_0x5e49c7[_0x4314('0x2d')],qs[_0x4314('0x32')](_0x27b50a['query'][_0x4314('0x32')]));_0x4e96d4[_0x4314('0x31')]=_0x4e96d4[_0x4314('0x31')][_0x4314('0x33')]?_0x4e96d4['attributes']:_0x5e49c7[_0x4314('0x2d')];if(!_0x27b50a[_0x4314('0x2e')][_0x4314('0x34')](_0x4314('0x35'))){_0x4e96d4[_0x4314('0x1c')]=qs[_0x4314('0x1c')](_0x27b50a[_0x4314('0x2e')][_0x4314('0x1c')]);_0x4e96d4[_0x4314('0x19')]=qs[_0x4314('0x19')](_0x27b50a[_0x4314('0x2e')][_0x4314('0x19')]);}_0x4e96d4[_0x4314('0x36')]=qs[_0x4314('0x37')](_0x27b50a['query'][_0x4314('0x37')]);_0x4e96d4[_0x4314('0x38')]=qs[_0x4314('0x2f')](_['pick'](_0x27b50a[_0x4314('0x2e')],_0x5e49c7[_0x4314('0x2f')]),_0x34f3ed);if(_0x27b50a['query'][_0x4314('0x39')]){_0x4e96d4[_0x4314('0x38')]=_[_0x4314('0x3a')](_0x4e96d4[_0x4314('0x38')],{'$or':_[_0x4314('0x29')](_0x34f3ed,function(_0x50463c){if(_0x50463c[_0x4314('0x2b')]!==_0x4314('0x3b')){var _0x215104={};_0x215104[_0x50463c[_0x4314('0x26')]]={'$like':'%'+_0x27b50a[_0x4314('0x2e')][_0x4314('0x39')]+'%'};return _0x215104;}})});}_0x4e96d4=_[_0x4314('0x3a')]({},_0x4e96d4,_0x27b50a[_0x4314('0x3c')]);var _0x4f790c={'where':_0x4e96d4[_0x4314('0x38')]};return db[_0x4314('0x3d')][_0x4314('0x1b')](_0x4f790c)[_0x4314('0x23')](function(_0x152fff){_0x154ff7[_0x4314('0x1b')]=_0x152fff;if(_0x27b50a['query'][_0x4314('0x3e')]){_0x4e96d4[_0x4314('0x3f')]=[{'all':!![]}];}return db[_0x4314('0x3d')][_0x4314('0x40')](_0x4e96d4);})[_0x4314('0x23')](function(_0x3f551c){_0x154ff7[_0x4314('0x41')]=_0x3f551c;return _0x154ff7;})[_0x4314('0x23')](respondWithFilteredResult(_0x2b9b5b,_0x4e96d4))[_0x4314('0x42')](handleError(_0x2b9b5b,null));};exports[_0x4314('0x43')]=function(_0x1857ce,_0x5f0c90){var _0x2161bc={'raw':!![],'where':{'id':_0x1857ce[_0x4314('0x44')]['id']}},_0x4a7ec8={};_0x4a7ec8[_0x4314('0x2d')]=_['keys'](db[_0x4314('0x3d')]['rawAttributes']);_0x4a7ec8['query']=_[_0x4314('0x45')](_0x1857ce[_0x4314('0x2e')]);_0x4a7ec8[_0x4314('0x2f')]=_[_0x4314('0x30')](_0x4a7ec8['model'],_0x4a7ec8[_0x4314('0x2e')]);_0x2161bc[_0x4314('0x31')]=_[_0x4314('0x30')](_0x4a7ec8[_0x4314('0x2d')],qs[_0x4314('0x32')](_0x1857ce[_0x4314('0x2e')]['fields']));_0x2161bc[_0x4314('0x31')]=_0x2161bc[_0x4314('0x31')][_0x4314('0x33')]?_0x2161bc[_0x4314('0x31')]:_0x4a7ec8[_0x4314('0x2d')];if(_0x1857ce[_0x4314('0x2e')][_0x4314('0x3e')]){_0x2161bc[_0x4314('0x3f')]=[{'all':!![]}];}_0x2161bc=_[_0x4314('0x3a')]({},_0x2161bc,_0x1857ce[_0x4314('0x3c')]);return db['WhatsappTransferReport'][_0x4314('0x46')](_0x2161bc)[_0x4314('0x23')](handleEntityNotFound(_0x5f0c90,null))[_0x4314('0x23')](respondWithResult(_0x5f0c90,null))[_0x4314('0x42')](handleError(_0x5f0c90,null));};exports[_0x4314('0x47')]=function(_0x4ec233,_0x11d346){return db[_0x4314('0x3d')][_0x4314('0x47')](_0x4ec233[_0x4314('0x48')],{})[_0x4314('0x23')](respondWithResult(_0x11d346,0xc9))[_0x4314('0x42')](handleError(_0x11d346,null));};exports[_0x4314('0x22')]=function(_0x27b607,_0x358bba){if(_0x27b607[_0x4314('0x48')]['id']){delete _0x27b607[_0x4314('0x48')]['id'];}return db[_0x4314('0x3d')]['find']({'where':{'id':_0x27b607[_0x4314('0x44')]['id']}})[_0x4314('0x23')](handleEntityNotFound(_0x358bba,null))['then'](saveUpdates(_0x27b607[_0x4314('0x48')],null))[_0x4314('0x23')](respondWithResult(_0x358bba,null))[_0x4314('0x42')](handleError(_0x358bba,null));};exports[_0x4314('0x24')]=function(_0xae006d,_0x1394d3){return db[_0x4314('0x3d')][_0x4314('0x46')]({'where':{'id':_0xae006d['params']['id']}})[_0x4314('0x23')](handleEntityNotFound(_0x1394d3,null))[_0x4314('0x23')](removeEntity(_0x1394d3,null))['catch'](handleError(_0x1394d3,null));};exports[_0x4314('0x49')]=function(_0x339d98,_0x2d1737){return db['WhatsappTransferReport'][_0x4314('0x49')]()['then'](respondWithResult(_0x2d1737,null))[_0x4314('0x42')](handleError(_0x2d1737,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5913189..bd41354 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 _0x9a4f=['uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0x4603c5,_0xe39607){var _0x30a380=function(_0x40ba8d){while(--_0x40ba8d){_0x4603c5['push'](_0x4603c5['shift']());}};_0x30a380(++_0xe39607);}(_0x9a4f,0x85));var _0xf9a4=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0x9a4f[_0x29c934];return _0x4302de;};'use strict';var _=require(_0xf9a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf9a4('0x1'));var moment=require(_0xf9a4('0x2'));var BPromise=require(_0xf9a4('0x3'));var rp=require(_0xf9a4('0x4'));var fs=require('fs');var path=require(_0xf9a4('0x5'));var rimraf=require(_0xf9a4('0x6'));var config=require('../../config/environment');var attributes=require(_0xf9a4('0x7'));module[_0xf9a4('0x8')]=function(_0x3ef0ac,_0x4ca7b8){return _0x3ef0ac['define']('WhatsappTransferReport',attributes,{'tableName':_0xf9a4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf9a4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa9f=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xfa9f,0x1e2));var _0xffa9=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0xfa9f[_0x3b22e9];return _0x230314;};'use strict';var _=require('lodash');var util=require(_0xffa9('0x0'));var logger=require(_0xffa9('0x1'))(_0xffa9('0x2'));var moment=require(_0xffa9('0x3'));var BPromise=require(_0xffa9('0x4'));var rp=require(_0xffa9('0x5'));var fs=require('fs');var path=require(_0xffa9('0x6'));var rimraf=require(_0xffa9('0x7'));var config=require('../../config/environment');var attributes=require(_0xffa9('0x8'));module[_0xffa9('0x9')]=function(_0x17c216,_0x297e57){return _0x17c216[_0xffa9('0xa')](_0xffa9('0xb'),attributes,{'tableName':_0xffa9('0xc'),'paranoid':![],'indexes':[{'name':_0xffa9('0xd'),'fields':[_0xffa9('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 cdbbf22..a5fb38e 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 _0x4977=['debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x17e334,_0x3ea771){var _0x290034=function(_0x45e228){while(--_0x45e228){_0x17e334['push'](_0x17e334['shift']());}};_0x290034(++_0x3ea771);}(_0x4977,0x8e));var _0x7497=function(_0x1650c4,_0x444a52){_0x1650c4=_0x1650c4-0x0;var _0x5b92e6=_0x4977[_0x1650c4];return _0x5b92e6;};'use strict';var _=require(_0x7497('0x0'));var util=require(_0x7497('0x1'));var moment=require(_0x7497('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7497('0x3'));var db=require(_0x7497('0x4'))['db'];var utils=require(_0x7497('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7497('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7497('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12f82f,_0x360ad5,_0x325db0){return new BPromise(function(_0x557a40,_0x54edb8){return client[_0x7497('0x8')](_0x12f82f,_0x325db0)['then'](function(_0x2fbace){logger['info'](_0x7497('0x9'),_0x360ad5,'request\x20sent');logger[_0x7497('0xa')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x360ad5,_0x7497('0xb'),JSON[_0x7497('0xc')](_0x2fbace));if(_0x2fbace[_0x7497('0xd')]){if(_0x2fbace['error'][_0x7497('0xe')]===0x1f4){logger[_0x7497('0xd')](_0x7497('0x9'),_0x360ad5,_0x2fbace[_0x7497('0xd')][_0x7497('0xf')]);return _0x54edb8(_0x2fbace['error'][_0x7497('0xf')]);}logger['error'](_0x7497('0x9'),_0x360ad5,_0x2fbace[_0x7497('0xd')][_0x7497('0xf')]);return _0x557a40(_0x2fbace[_0x7497('0xd')][_0x7497('0xf')]);}else{logger[_0x7497('0x10')](_0x7497('0x9'),_0x360ad5,'request\x20sent');_0x557a40(_0x2fbace[_0x7497('0x11')]['message']);}})[_0x7497('0x12')](function(_0x3c595d){logger[_0x7497('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x360ad5,_0x3c595d);_0x54edb8(_0x3c595d);});});} \ No newline at end of file +var _0xe377=['info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x118320,_0x466758){var _0x1e515b=function(_0x1ec858){while(--_0x1ec858){_0x118320['push'](_0x118320['shift']());}};_0x1e515b(++_0x466758);}(_0xe377,0x145));var _0x7e37=function(_0x4fcdfa,_0x530c16){_0x4fcdfa=_0x4fcdfa-0x0;var _0x5cf828=_0xe377[_0x4fcdfa];return _0x5cf828;};'use strict';var _=require(_0x7e37('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e37('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e37('0x2'));var db=require(_0x7e37('0x3'))['db'];var utils=require(_0x7e37('0x4'));var logger=require(_0x7e37('0x5'))(_0x7e37('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e37('0x7'));var client=jayson[_0x7e37('0x8')][_0x7e37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1813d5,_0xb64d06,_0x2702c4){return new BPromise(function(_0x2640e4,_0x4d9744){return client[_0x7e37('0xa')](_0x1813d5,_0x2702c4)[_0x7e37('0xb')](function(_0x409963){logger['info'](_0x7e37('0xc'),_0xb64d06,_0x7e37('0xd'));logger[_0x7e37('0xe')](_0x7e37('0xf'),_0xb64d06,_0x7e37('0xd'),JSON[_0x7e37('0x10')](_0x409963));if(_0x409963[_0x7e37('0x11')]){if(_0x409963[_0x7e37('0x11')][_0x7e37('0x12')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xb64d06,_0x409963[_0x7e37('0x11')][_0x7e37('0x13')]);return _0x4d9744(_0x409963[_0x7e37('0x11')][_0x7e37('0x13')]);}logger[_0x7e37('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0xb64d06,_0x409963[_0x7e37('0x11')]['message']);return _0x2640e4(_0x409963[_0x7e37('0x11')][_0x7e37('0x13')]);}else{logger[_0x7e37('0x14')](_0x7e37('0xc'),_0xb64d06,_0x7e37('0xd'));_0x2640e4(_0x409963[_0x7e37('0x15')][_0x7e37('0x13')]);}})[_0x7e37('0x16')](function(_0x1ac01b){logger[_0x7e37('0x11')](_0x7e37('0xc'),_0xb64d06,_0x1ac01b);_0x4d9744(_0x1ac01b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2bed2a8..30613ce 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb66=['./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','Offline\x20apps:','status','join','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb66,0x19f));var _0x6cb6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xcb66[_0x26462c];return _0x509a42;};'use strict';var _=require('lodash');var db=require(_0x6cb6('0x0'))['db'];var seedDb=require(_0x6cb6('0x1'));var checkLicense=require(_0x6cb6('0x2'));var rpc=require(_0x6cb6('0x3'));var config=require(_0x6cb6('0x4'));var logger=require('./config/logger')(_0x6cb6('0x5'));var pm2=require(_0x6cb6('0x6'));var pm2Config=require(_0x6cb6('0x7'));var schedule=require(_0x6cb6('0x8'));var chat=require(_0x6cb6('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x6cb6('0xa'));function main(){return db[_0x6cb6('0xb')][_0x6cb6('0xc')]()[_0x6cb6('0xd')](function(){if(config[_0x6cb6('0xe')]){return seedDb[_0x6cb6('0xf')]();}})[_0x6cb6('0xd')](function(){return checkLicense[_0x6cb6('0xf')]();})[_0x6cb6('0xd')](function(){return rpc[_0x6cb6('0x10')]();})[_0x6cb6('0xd')](function(_0xb7e9e){logger[_0x6cb6('0x11')](_0xb7e9e);return chat['start']();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x6cb6('0x12')]();})[_0x6cb6('0xd')](function(){return transcribe[_0x6cb6('0x12')]();})[_0x6cb6('0xd')](function(){return provider['start']();})[_0x6cb6('0xd')](function(_0x3c6267){logger['info'](_0x3c6267);return pm2[_0x6cb6('0x12')](pm2Config);})[_0x6cb6('0xd')](function(_0x5af476){var _0x107492=_0x5af476[_0x6cb6('0x13')](function(_0x492629){return typeof _0x492629['exitCode']==='number'&&_0x492629['exitCode']>=0x0;});if(_0x107492[_0x6cb6('0x14')]>0x0){throw new Error(_0x107492[_0x6cb6('0x14')]+_0x6cb6('0x15')+_[_0x6cb6('0x16')](_0x107492,function(_0x432e48){return'\x22'+_0x432e48[_0x6cb6('0x17')]['name']+'\x22';}));}logger[_0x6cb6('0x11')](_0x6cb6('0x18'),_['map'](_['filter'](_0x5af476,{'status':'online'}),'name')['join']());logger['info'](_0x6cb6('0x19'),_[_0x6cb6('0x16')](_[_0x6cb6('0x13')](_0x5af476,function(_0x2d41c4){return _0x2d41c4[_0x6cb6('0x1a')]!=='online';}),'name')[_0x6cb6('0x1b')]()||_0x6cb6('0x1c'));console[_0x6cb6('0x1d')](_0x6cb6('0x1e'));})['catch'](function(_0x34d1a6){console[_0x6cb6('0x1d')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x34d1a6);logger['error'](_0x6cb6('0x1f'),_0x34d1a6);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x9fd4=['default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB'];(function(_0x9a38f5,_0x4605ee){var _0x143f67=function(_0x12853b){while(--_0x12853b){_0x9a38f5['push'](_0x9a38f5['shift']());}};_0x143f67(++_0x4605ee);}(_0x9fd4,0x16c));var _0x49fd=function(_0x43c6d1,_0x20edf8){_0x43c6d1=_0x43c6d1-0x0;var _0x334a91=_0x9fd4[_0x43c6d1];return _0x334a91;};'use strict';var _=require(_0x49fd('0x0'));var db=require(_0x49fd('0x1'))['db'];var seedDb=require(_0x49fd('0x2'));var checkLicense=require(_0x49fd('0x3'));var rpc=require(_0x49fd('0x4'));var config=require(_0x49fd('0x5'));var logger=require(_0x49fd('0x6'))(_0x49fd('0x7'));var pm2=require(_0x49fd('0x8'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x49fd('0x9'));var whatsapp=require(_0x49fd('0xa'));var transcribe=require(_0x49fd('0xb'));var provider=require(_0x49fd('0xc'));function main(){return db['sequelize'][_0x49fd('0xd')]()[_0x49fd('0xe')](function(){if(config[_0x49fd('0xf')]){return seedDb[_0x49fd('0x10')]();}})[_0x49fd('0xe')](function(){return checkLicense['default']();})[_0x49fd('0xe')](function(){return rpc[_0x49fd('0x11')]();})[_0x49fd('0xe')](function(_0x4969d3){logger[_0x49fd('0x12')](_0x4969d3);return chat[_0x49fd('0x13')]();})[_0x49fd('0xe')](function(){return whatsapp['start']();})[_0x49fd('0xe')](function(){return schedule[_0x49fd('0x13')]();})[_0x49fd('0xe')](function(){return transcribe[_0x49fd('0x13')]();})[_0x49fd('0xe')](function(){return provider[_0x49fd('0x13')]();})[_0x49fd('0xe')](function(_0x3fa518){logger[_0x49fd('0x12')](_0x3fa518);return pm2[_0x49fd('0x13')](pm2Config);})[_0x49fd('0xe')](function(_0x44c18c){var _0x46760f=_0x44c18c[_0x49fd('0x14')](function(_0x264ab1){return typeof _0x264ab1[_0x49fd('0x15')]===_0x49fd('0x16')&&_0x264ab1[_0x49fd('0x15')]>=0x0;});if(_0x46760f[_0x49fd('0x17')]>0x0){throw new Error(_0x46760f[_0x49fd('0x17')]+_0x49fd('0x18')+_[_0x49fd('0x19')](_0x46760f,function(_0x320fe5){return'\x22'+_0x320fe5[_0x49fd('0x1a')][_0x49fd('0x1b')]+'\x22';}));}logger[_0x49fd('0x12')]('Online\x20apps:',_[_0x49fd('0x19')](_[_0x49fd('0x14')](_0x44c18c,{'status':'online'}),'name')[_0x49fd('0x1c')]());logger['info'](_0x49fd('0x1d'),_[_0x49fd('0x19')](_['filter'](_0x44c18c,function(_0xf7efcf){return _0xf7efcf[_0x49fd('0x1e')]!=='online';}),_0x49fd('0x1b'))[_0x49fd('0x1c')]()||_0x49fd('0x1f'));console[_0x49fd('0x20')](_0x49fd('0x21'));})[_0x49fd('0x22')](function(_0x5dc839){console[_0x49fd('0x20')](_0x49fd('0x23'),_0x5dc839);logger[_0x49fd('0x24')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5dc839);process[_0x49fd('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index df1c527..674dc2f 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 _0x0ba4=['selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','user','findOne','params','closed','then','query','forceDownload','json','disposition','Unmanaged.','Forbidden.','isAuthenticated','use','headers','startsWith','authorization','Basic','find','name','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secret','options','verify','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','email','userpic','permissions','voicePause','chatPause','mailPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls'];(function(_0x3ff52c,_0x54a5e9){var _0x1b0c0f=function(_0x251ef6){while(--_0x251ef6){_0x3ff52c['push'](_0x3ff52c['shift']());}};_0x1b0c0f(++_0x54a5e9);}(_0x0ba4,0x15d));var _0x40ba=function(_0x53936a,_0x12f660){_0x53936a=_0x53936a-0x0;var _0xa7162a=_0x0ba4[_0x53936a];return _0xa7162a;};'use strict';var db=require(_0x40ba('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x40ba('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x40ba('0x2'));var expressJwt=require(_0x40ba('0x3'));var compose=require(_0x40ba('0x4'));var basicAuth=require(_0x40ba('0x5'));var crypto=require(_0x40ba('0x6'));var BPromise=require(_0x40ba('0x7'));var util=require('util');var moment=require(_0x40ba('0x8'));var validateJwt=expressJwt({'secret':config[_0x40ba('0x9')][_0x40ba('0xa')]});var userAttributes=['id',_0x40ba('0xb'),_0x40ba('0xc'),'name','internal',_0x40ba('0xd'),_0x40ba('0xe'),_0x40ba('0xf'),'md5secret',_0x40ba('0x10'),_0x40ba('0x11'),_0x40ba('0x12'),'faxPause','smsPause','openchannelPause',_0x40ba('0x13'),_0x40ba('0x14'),_0x40ba('0x15'),'lastPauseAt','crudPermissions',_0x40ba('0x16'),_0x40ba('0x17'),_0x40ba('0x18'),_0x40ba('0x19'),'phoneBarAutoAnswerDelay',_0x40ba('0x1a'),_0x40ba('0x1b'),'phoneBarEnableDtmfTone',_0x40ba('0x1c'),_0x40ba('0x1d'),_0x40ba('0x1e'),_0x40ba('0x1f'),_0x40ba('0x20'),_0x40ba('0x21'),_0x40ba('0x22'),'userProfileId',_0x40ba('0x23'),_0x40ba('0x24'),'wssPort',_0x40ba('0x25'),_0x40ba('0x26'),_0x40ba('0x27'),_0x40ba('0x28'),_0x40ba('0x29'),'chatAutoanswer',_0x40ba('0x2a'),_0x40ba('0x2b'),'emailAutoanswerDelay',_0x40ba('0x2c'),_0x40ba('0x2d'),_0x40ba('0x2e'),'openchannelAutoanswerDelay',_0x40ba('0x2f'),_0x40ba('0x30'),_0x40ba('0x31'),_0x40ba('0x32'),_0x40ba('0x33')];exports[_0x40ba('0x34')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x3fe4ef,_0x25c818,_0x5ca838){if(_0x3fe4ef[_0x40ba('0x35')]){_0x5ca838();}else{return db['ChatInteraction'][_0x40ba('0x36')]({'where':{'id':_0x3fe4ef[_0x40ba('0x37')]['id']},'attributes':['id',_0x40ba('0x38'),'disposition'],'raw':!![]})[_0x40ba('0x39')](function(_0x2b6d2d){if(_0x2b6d2d&&_0x2b6d2d[_0x40ba('0x38')]&&!_0x3fe4ef[_0x40ba('0x3a')][_0x40ba('0x3b')]){return _0x25c818['status'](_0x2b6d2d['disposition']==='unmanaged'?0x195:0x193)[_0x40ba('0x3c')]({'message':_0x2b6d2d[_0x40ba('0x3d')]==='unmanaged'?_0x40ba('0x3e'):_0x40ba('0x3f')});}else{_0x5ca838();}})['catch'](function(_0x2a78e1){_0x5ca838(_0x2a78e1);});}});};exports[_0x40ba('0x40')]=function isAuthenticated(_0x502561){return compose()[_0x40ba('0x41')](function(_0x2e2cb6,_0x15a470,_0x2215ab){var _0x2190b8;if(_0x2e2cb6[_0x40ba('0x42')]['authorization']){if(_[_0x40ba('0x43')](_0x2e2cb6[_0x40ba('0x42')][_0x40ba('0x44')],_0x40ba('0x45'))){var _0x5bd698=basicAuth(_0x2e2cb6);db['User'][_0x40ba('0x46')]({'where':{'name':_0x5bd698[_0x40ba('0x47')]}})['then'](function(_0x5700b0){if(!_0x5700b0||!_0x5700b0[_0x40ba('0x48')](_0x5bd698[_0x40ba('0x49')])){return _0x15a470[_0x40ba('0x4a')](0x191)[_0x40ba('0x3c')]({'message':_0x40ba('0x4b')});}_0x2e2cb6[_0x40ba('0x35')]={'id':_0x5700b0['id']};_0x2215ab();})[_0x40ba('0x4c')](function(_0x163a02){_0x2215ab(_0x163a02);});}else if(_['startsWith'](_0x2e2cb6[_0x40ba('0x42')][_0x40ba('0x44')],_0x40ba('0x4d'))){validateJwt(_0x2e2cb6,_0x15a470,_0x2215ab);}else{if(_0x502561){_0x2215ab();}else{return _0x15a470['status'](0x193)['json']({'message':_0x40ba('0x4e')});}}}else if(_0x2e2cb6[_0x40ba('0x3a')][_0x40ba('0x4f')]){try{var _0x555f7f={'audience':hardwareConf[_0x40ba('0x50')](),'issuer':hardwareConf[_0x40ba('0x50')]()};verifyJwt(_0x2e2cb6['query']['apikey'],_0x555f7f)[_0x40ba('0x39')](function(_0x130766){return db[_0x40ba('0x51')][_0x40ba('0x46')]({'where':{'id':_0x130766['sub']}})['then'](function(_0x2a5c17){_0x2190b8=_0x2a5c17;return db['Setting'][_0x40ba('0x36')]({'where':{'id':0x1},'attributes':[_0x40ba('0x52'),_0x40ba('0x53')],'raw':!![]});})[_0x40ba('0x39')](function(_0x49211a){if(!_0x2190b8||!_[_0x40ba('0x54')](_0x2190b8['apiKeyNonce'],_0x130766[_0x40ba('0x55')])){return _0x15a470[_0x40ba('0x4a')](0x191)[_0x40ba('0x3c')]({'message':_0x40ba('0x56')});}if(_0x2190b8[_0x40ba('0x57')]){return _0x15a470[_0x40ba('0x4a')](0x191)[_0x40ba('0x3c')]({'message':_0x40ba('0x58')});}if(_0x2190b8['blocked']){if(_0x49211a[_0x40ba('0x53')]>0x0){if(moment(_0x2190b8[_0x40ba('0x59')])[_0x40ba('0x5a')](_0x49211a[_0x40ba('0x53')],'minutes')>moment()){return _0x15a470['status'](0x191)[_0x40ba('0x3c')]({'message':_0x40ba('0x58')});}}else{return _0x15a470[_0x40ba('0x4a')](0x191)['json']({'message':_0x40ba('0x58')});}}_0x2e2cb6['user']={'id':_0x2190b8['id']};_0x2215ab();});})['catch'](function(){return _0x15a470[_0x40ba('0x4a')](0x191)[_0x40ba('0x3c')]({'message':_0x40ba('0x58')});});}catch(_0x2fc514){_0x2215ab(_0x2fc514);}}else if(_0x502561){_0x2215ab();}else{return _0x15a470[_0x40ba('0x4a')](0x193)[_0x40ba('0x3c')]({'message':_0x40ba('0x4e')});}})['use'](function(_0x13f700,_0x3cf970,_0x2f6a54){if(_0x13f700[_0x40ba('0x35')]){db['User'][_0x40ba('0x46')]({'where':{'id':_0x13f700['user']['id']},'attributes':userAttributes})[_0x40ba('0x39')](function(_0x4886eb){if(!_0x4886eb){return _0x3cf970['status'](0x194)[_0x40ba('0x3c')]({'message':_0x40ba('0x5b')});}_0x13f700[_0x40ba('0x35')]=_0x4886eb;_0x2f6a54();})[_0x40ba('0x4c')](function(_0x3bf23e){_0x2f6a54(_0x3bf23e);});}else if(_0x502561){_0x2f6a54();}else{return _0x3cf970[_0x40ba('0x4a')](0x194)[_0x40ba('0x3c')]({'message':_0x40ba('0x5c')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x40ba('0x41')](function(_0x5ed533,_0x18acd7,_0x3612f1){return licenseUtil[_0x40ba('0x5d')]()['then'](function(_0x157b1b){if(_0x157b1b[_0x40ba('0x5e')]){_0x3612f1();}else{return _0x18acd7[_0x40ba('0x4a')](0x193)[_0x40ba('0x3c')]({'message':'Forbidden'});}})[_0x40ba('0x4c')](function(_0x11dab4){_0x3612f1(_0x11dab4);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x30be57,_0x577de2,_0x35021d){return licenseUtil[_0x40ba('0x5d')]()[_0x40ba('0x39')](function(_0x458ae3){if(_0x458ae3[_0x40ba('0x5f')]){_0x35021d();}else{return _0x577de2['status'](0x193)[_0x40ba('0x3c')]({'message':'Forbidden'});}})[_0x40ba('0x4c')](function(_0x49ca4b){_0x35021d(_0x49ca4b);});});};exports[_0x40ba('0x60')]=function(_0x3f45cd,_0x58bcd7,_0x25bc75){_0x3f45cd['isMiddleware']=!![];return _0x25bc75();};exports['signToken']=function signToken(_0x34e8a6){return signJwt(_0x34e8a6);};exports[_0x40ba('0x61')]=function(_0x7054dc,_0x545982){if(!_0x7054dc['user']){return _0x545982[_0x40ba('0x4a')](0x194)[_0x40ba('0x3c')]({'message':_0x40ba('0x62')});}var _0x43783b={'payload':{'id':_0x7054dc[_0x40ba('0x35')]['id'],'role':_0x7054dc['user'][_0x40ba('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x43783b)[_0x40ba('0x39')](function(_0x35d397){_0x545982['cookie'](_0x40ba('0x63'),_0x35d397);_0x545982['redirect']('/dashboards/general');})[_0x40ba('0x4c')](function(_0x2131ce){return _0x545982[_0x40ba('0x4a')](0x1f4)[_0x40ba('0x64')](_0x2131ce);});};exports[_0x40ba('0x65')]=function(_0x5a05e6){if(_[_0x40ba('0x66')](_0x5a05e6[_0x40ba('0x67')])||_[_0x40ba('0x66')](_0x5a05e6[_0x40ba('0x68')])){return null;}else{return createJwt(_0x5a05e6);}};exports[_0x40ba('0x69')]=function(_0x18bd7b){_0x18bd7b[_0x40ba('0x67')]=generateNonce();_0x18bd7b[_0x40ba('0x68')]=generateIssuedAt();return createJwt(_0x18bd7b);};exports[_0x40ba('0x6a')]=function(_0x234846,_0x35b42a){var _0x278fa2=_0x234846[_0x40ba('0x3a')][_0x40ba('0x4f')];if(_0x278fa2){var _0x9cde89={'nonce':_0x35b42a[_0x40ba('0x67')],'iat':_0x35b42a[_0x40ba('0x68')],'audience':hardwareConf[_0x40ba('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x278fa2,_0x9cde89)['then'](function(){return generateApiKey(_0x35b42a);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x40ba('0x6b')]=function(_0x386987){var _0x2eb74a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2eb74a['test'](_0x386987))throw new db[(_0x40ba('0x6c'))]['ValidationError'](_0x40ba('0x6d'));return;};exports[_0x40ba('0x6e')]=function(_0x26e8df,_0x3d7aa9,_0x3384ee){var _0x61600b=encryptor[_0x40ba('0x6f')](_0x3d7aa9)[_0x40ba('0x70')](',');for(var _0x4878a4=0x0;_0x4878a4<_0x3384ee;_0x4878a4++){if(!_0x61600b[_0x4878a4])break;if(_0x26e8df[_0x40ba('0x71')]()===_0x61600b[_0x4878a4][_0x40ba('0x71')]()){var _0x24b710=util[_0x40ba('0x72')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3384ee);if(_0x3384ee===0x1){_0x24b710=_0x40ba('0x73');}throw new db[(_0x40ba('0x6c'))]['ValidationError'](_0x24b710);}}return;};exports[_0x40ba('0x74')]=function(_0x59d85d,_0x197124){var _0x313723=_0x197124?encryptor['decryptString'](_0x197124)[_0x40ba('0x70')](','):[];if(_0x313723[_0x40ba('0x75')]===0x5){_0x313723[_0x40ba('0x76')](-0x1,0x1);}_0x313723[_0x40ba('0x77')](_0x59d85d);return encryptor[_0x40ba('0x78')](_0x313723[_0x40ba('0x79')](','));};function signJwt(_0x31a9ce){var _0x2a0933=BPromise[_0x40ba('0x7a')](jwt['sign'],{'context':jwt});var _0x2a8413=_0x31a9ce[_0x40ba('0x7b')]||config[_0x40ba('0x9')][_0x40ba('0xa')];return new BPromise(function(_0x878804,_0x2a2d29){_0x2a0933(_0x31a9ce['payload'],_0x2a8413,_0x31a9ce[_0x40ba('0x7c')])[_0x40ba('0x39')](function(_0x512f1e){_0x878804(_0x512f1e);})[_0x40ba('0x4c')](function(_0x25df47){_0x2a2d29(_0x25df47);});});}function verifyJwt(_0x989e11,_0x4e42f2,_0x24fd2d){var _0x2b0ac6=BPromise[_0x40ba('0x7a')](jwt[_0x40ba('0x7d')],{'context':jwt});var _0x42c0f6=_0x24fd2d||config[_0x40ba('0x9')][_0x40ba('0xa')];return new BPromise(function(_0xbe26e0,_0x421cae){_0x2b0ac6(_0x989e11,_0x42c0f6,_0x4e42f2)[_0x40ba('0x39')](function(_0xf21eb0){_0xbe26e0(_0xf21eb0);})[_0x40ba('0x4c')](function(_0xb6afd9){_0x421cae(_0xb6afd9);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x40ba('0x7e')](_0x40ba('0x7f'));}function generateIssuedAt(){return Math[_0x40ba('0x80')](Date[_0x40ba('0x81')]()/0x3e8)[_0x40ba('0x7e')]();}function createJwt(_0x318bb3){var _0x260b65={'payload':{'iat':_0x318bb3['apiKeyIat'],'nonce':_0x318bb3['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x318bb3['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x40ba('0x50')]()}};return signJwt(_0x260b65)[_0x40ba('0x39')](function(_0x4ad2b6){return{'iat':_0x318bb3[_0x40ba('0x68')],'nonce':_0x318bb3[_0x40ba('0x67')],'token':_0x4ad2b6};});} \ No newline at end of file +var _0xd8ba=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','secret','options','verify','randomBytes','toString','hex','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isAuthenticated','user','params','then','closed','query','forceDownload','status','disposition','json','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','startsWith','authorization','Basic','User','find','name','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','sub','Setting','findOne','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize'];(function(_0x508131,_0x37633e){var _0x3bb9ed=function(_0x433486){while(--_0x433486){_0x508131['push'](_0x508131['shift']());}};_0x3bb9ed(++_0x37633e);}(_0xd8ba,0x12d));var _0xad8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8ba[_0x122ef9];return _0x42fba0;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0xad8b('0x0'));var licenseUtil=require(_0xad8b('0x1'));var encryptor=require(_0xad8b('0x2'));var _=require(_0xad8b('0x3'));var jwt=require(_0xad8b('0x4'));var expressJwt=require('express-jwt');var compose=require(_0xad8b('0x5'));var basicAuth=require(_0xad8b('0x6'));var crypto=require(_0xad8b('0x7'));var BPromise=require(_0xad8b('0x8'));var util=require(_0xad8b('0x9'));var moment=require(_0xad8b('0xa'));var validateJwt=expressJwt({'secret':config[_0xad8b('0xb')][_0xad8b('0xc')]});var userAttributes=['id',_0xad8b('0xd'),'fullname','name',_0xad8b('0xe'),'email',_0xad8b('0xf'),_0xad8b('0x10'),_0xad8b('0x11'),_0xad8b('0x12'),_0xad8b('0x13'),_0xad8b('0x14'),_0xad8b('0x15'),_0xad8b('0x16'),_0xad8b('0x17'),_0xad8b('0x18'),_0xad8b('0x19'),_0xad8b('0x1a'),_0xad8b('0x1b'),_0xad8b('0x1c'),'allowmessenger',_0xad8b('0x1d'),_0xad8b('0x1e'),_0xad8b('0x1f'),_0xad8b('0x20'),_0xad8b('0x21'),_0xad8b('0x22'),_0xad8b('0x23'),_0xad8b('0x24'),_0xad8b('0x25'),_0xad8b('0x26'),_0xad8b('0x27'),_0xad8b('0x28'),_0xad8b('0x29'),_0xad8b('0x2a'),'userProfileId',_0xad8b('0x2b'),_0xad8b('0x2c'),_0xad8b('0x2d'),'downloadVoiceRecordings',_0xad8b('0x2e'),_0xad8b('0x2f'),_0xad8b('0x30'),_0xad8b('0x31'),_0xad8b('0x32'),_0xad8b('0x33'),_0xad8b('0x34'),_0xad8b('0x35'),_0xad8b('0x36'),_0xad8b('0x37'),_0xad8b('0x38'),'openchannelAutoanswerDelay',_0xad8b('0x39'),_0xad8b('0x3a'),_0xad8b('0x3b'),'whatsappAutoanswerDelay','messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0xad8b('0x3c')](!![])['use'](function(_0x583323,_0x94f59,_0x15b2c1){if(_0x583323[_0xad8b('0x3d')]){_0x15b2c1();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x583323[_0xad8b('0x3e')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xad8b('0x3f')](function(_0x1db11b){if(_0x1db11b&&_0x1db11b[_0xad8b('0x40')]&&!_0x583323[_0xad8b('0x41')][_0xad8b('0x42')]){return _0x94f59[_0xad8b('0x43')](_0x1db11b[_0xad8b('0x44')]==='unmanaged'?0x195:0x193)[_0xad8b('0x45')]({'message':_0x1db11b[_0xad8b('0x44')]===_0xad8b('0x46')?_0xad8b('0x47'):_0xad8b('0x48')});}else{_0x15b2c1();}})[_0xad8b('0x49')](function(_0x127f21){_0x15b2c1(_0x127f21);});}});};exports['isAuthenticated']=function isAuthenticated(_0x20f10d){return compose()[_0xad8b('0x4a')](function(_0x247f9e,_0x13b973,_0x2a26a4){var _0x2c72e0;if(_0x247f9e[_0xad8b('0x4b')]['authorization']){if(_[_0xad8b('0x4c')](_0x247f9e[_0xad8b('0x4b')][_0xad8b('0x4d')],_0xad8b('0x4e'))){var _0x47d549=basicAuth(_0x247f9e);db[_0xad8b('0x4f')][_0xad8b('0x50')]({'where':{'name':_0x47d549[_0xad8b('0x51')]}})[_0xad8b('0x3f')](function(_0xb98409){if(!_0xb98409||!_0xb98409['authenticate'](_0x47d549['pass'])){return _0x13b973['status'](0x191)[_0xad8b('0x45')]({'message':_0xad8b('0x52')});}_0x247f9e[_0xad8b('0x3d')]={'id':_0xb98409['id']};_0x2a26a4();})[_0xad8b('0x49')](function(_0x3f6df8){_0x2a26a4(_0x3f6df8);});}else if(_['startsWith'](_0x247f9e[_0xad8b('0x4b')][_0xad8b('0x4d')],_0xad8b('0x53'))){validateJwt(_0x247f9e,_0x13b973,_0x2a26a4);}else{if(_0x20f10d){_0x2a26a4();}else{return _0x13b973[_0xad8b('0x43')](0x193)[_0xad8b('0x45')]({'message':_0xad8b('0x54')});}}}else if(_0x247f9e[_0xad8b('0x41')]['apikey']){try{var _0x3cd273={'audience':hardwareConf[_0xad8b('0x55')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x247f9e[_0xad8b('0x41')]['apikey'],_0x3cd273)[_0xad8b('0x3f')](function(_0x2eb3fd){return db[_0xad8b('0x4f')][_0xad8b('0x50')]({'where':{'id':_0x2eb3fd[_0xad8b('0x56')]}})[_0xad8b('0x3f')](function(_0x5c33f2){_0x2c72e0=_0x5c33f2;return db[_0xad8b('0x57')][_0xad8b('0x58')]({'where':{'id':0x1},'attributes':[_0xad8b('0x59'),'blockDuration'],'raw':!![]});})[_0xad8b('0x3f')](function(_0x1d3fb2){if(!_0x2c72e0||!_[_0xad8b('0x5a')](_0x2c72e0['apiKeyNonce'],_0x2eb3fd['nonce'])){return _0x13b973[_0xad8b('0x43')](0x191)[_0xad8b('0x45')]({'message':_0xad8b('0x5b')});}if(_0x2c72e0[_0xad8b('0x5c')]){return _0x13b973[_0xad8b('0x43')](0x191)['json']({'message':_0xad8b('0x5d')});}if(_0x2c72e0[_0xad8b('0x5e')]){if(_0x1d3fb2[_0xad8b('0x5f')]>0x0){if(moment(_0x2c72e0[_0xad8b('0x60')])[_0xad8b('0x61')](_0x1d3fb2[_0xad8b('0x5f')],'minutes')>moment()){return _0x13b973[_0xad8b('0x43')](0x191)[_0xad8b('0x45')]({'message':_0xad8b('0x5d')});}}else{return _0x13b973[_0xad8b('0x43')](0x191)[_0xad8b('0x45')]({'message':_0xad8b('0x5d')});}}_0x247f9e[_0xad8b('0x3d')]={'id':_0x2c72e0['id']};_0x2a26a4();});})[_0xad8b('0x49')](function(){return _0x13b973['status'](0x191)[_0xad8b('0x45')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x397bfe){_0x2a26a4(_0x397bfe);}}else if(_0x20f10d){_0x2a26a4();}else{return _0x13b973['status'](0x193)['json']({'message':_0xad8b('0x54')});}})[_0xad8b('0x4a')](function(_0x3e95a0,_0x2a45cc,_0x19da52){if(_0x3e95a0['user']){db[_0xad8b('0x4f')]['find']({'where':{'id':_0x3e95a0[_0xad8b('0x3d')]['id']},'attributes':userAttributes})['then'](function(_0x4e1eee){if(!_0x4e1eee){return _0x2a45cc['status'](0x194)[_0xad8b('0x45')]({'message':'User\x20not\x20found.'});}_0x3e95a0[_0xad8b('0x3d')]=_0x4e1eee;_0x19da52();})[_0xad8b('0x49')](function(_0x44186e){_0x19da52(_0x44186e);});}else if(_0x20f10d){_0x19da52();}else{return _0x2a45cc['status'](0x194)[_0xad8b('0x45')]({'message':_0xad8b('0x62')});}});};exports[_0xad8b('0x63')]=function canUpdate(){return compose()[_0xad8b('0x4a')](function(_0x336e92,_0x85e928,_0x4a98e5){return licenseUtil[_0xad8b('0x64')]()[_0xad8b('0x3f')](function(_0xe54d38){if(_0xe54d38[_0xad8b('0x65')]){_0x4a98e5();}else{return _0x85e928[_0xad8b('0x43')](0x193)['json']({'message':'Forbidden'});}})[_0xad8b('0x49')](function(_0x1af010){_0x4a98e5(_0x1af010);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x11f4e4,_0x28f231,_0x9d258a){return licenseUtil[_0xad8b('0x64')]()[_0xad8b('0x3f')](function(_0x934916){if(_0x934916['webrtc']){_0x9d258a();}else{return _0x28f231[_0xad8b('0x43')](0x193)[_0xad8b('0x45')]({'message':_0xad8b('0x66')});}})[_0xad8b('0x49')](function(_0x5df9b7){_0x9d258a(_0x5df9b7);});});};exports[_0xad8b('0x67')]=function(_0x1726cf,_0x31328e,_0x3a22f3){_0x1726cf['isMiddleware']=!![];return _0x3a22f3();};exports[_0xad8b('0x68')]=function signToken(_0x1a4b74){return signJwt(_0x1a4b74);};exports[_0xad8b('0x69')]=function(_0x4febee,_0x5a7198){if(!_0x4febee['user']){return _0x5a7198['status'](0x194)[_0xad8b('0x45')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5c7e1c={'payload':{'id':_0x4febee[_0xad8b('0x3d')]['id'],'role':_0x4febee[_0xad8b('0x3d')][_0xad8b('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5c7e1c)[_0xad8b('0x3f')](function(_0x4314f0){_0x5a7198[_0xad8b('0x6a')](_0xad8b('0x6b'),_0x4314f0);_0x5a7198['redirect'](_0xad8b('0x6c'));})[_0xad8b('0x49')](function(_0x32841a){return _0x5a7198[_0xad8b('0x43')](0x1f4)[_0xad8b('0x6d')](_0x32841a);});};exports[_0xad8b('0x6e')]=function(_0x143ace){if(_[_0xad8b('0x6f')](_0x143ace['apiKeyNonce'])||_[_0xad8b('0x6f')](_0x143ace[_0xad8b('0x70')])){return null;}else{return createJwt(_0x143ace);}};exports[_0xad8b('0x71')]=function(_0x4e505c){_0x4e505c[_0xad8b('0x72')]=generateNonce();_0x4e505c[_0xad8b('0x70')]=generateIssuedAt();return createJwt(_0x4e505c);};exports[_0xad8b('0x73')]=function(_0x5a35e,_0x36b1cb){var _0xf7a975=_0x5a35e[_0xad8b('0x41')][_0xad8b('0x74')];if(_0xf7a975){var _0xa79b0={'nonce':_0x36b1cb['apiKeyNonce'],'iat':_0x36b1cb[_0xad8b('0x70')],'audience':hardwareConf[_0xad8b('0x55')](),'issuer':hardwareConf[_0xad8b('0x55')]()};return verifyJwt(_0xf7a975,_0xa79b0)[_0xad8b('0x3f')](function(){return generateApiKey(_0x36b1cb);});}else{throw{'message':_0xad8b('0x75')};}};exports['validatePasswordPattern']=function(_0x161575){var _0x14f093=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x14f093['test'](_0x161575))throw new db[(_0xad8b('0x76'))][(_0xad8b('0x77'))](_0xad8b('0x78'));return;};exports[_0xad8b('0x79')]=function(_0x487eb0,_0x32a70b,_0x3e8640){var _0x12a691=encryptor[_0xad8b('0x7a')](_0x32a70b)[_0xad8b('0x7b')](',');for(var _0x29e001=0x0;_0x29e001<_0x3e8640;_0x29e001++){if(!_0x12a691[_0x29e001])break;if(_0x487eb0[_0xad8b('0x7c')]()===_0x12a691[_0x29e001][_0xad8b('0x7c')]()){var _0x474586=util[_0xad8b('0x7d')](_0xad8b('0x7e'),_0x3e8640);if(_0x3e8640===0x1){_0x474586=_0xad8b('0x7f');}throw new db[(_0xad8b('0x76'))][(_0xad8b('0x77'))](_0x474586);}}return;};exports['updatePasswordsHistory']=function(_0x3ce7f5,_0x3b6f0b){var _0x2ebf78=_0x3b6f0b?encryptor[_0xad8b('0x7a')](_0x3b6f0b)['split'](','):[];if(_0x2ebf78['length']===0x5){_0x2ebf78[_0xad8b('0x80')](-0x1,0x1);}_0x2ebf78[_0xad8b('0x81')](_0x3ce7f5);return encryptor[_0xad8b('0x82')](_0x2ebf78[_0xad8b('0x83')](','));};function signJwt(_0x33655e){var _0x128a1c=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x5980a1=_0x33655e[_0xad8b('0x84')]||config[_0xad8b('0xb')]['session'];return new BPromise(function(_0x257ff7,_0x496b6b){_0x128a1c(_0x33655e['payload'],_0x5980a1,_0x33655e[_0xad8b('0x85')])['then'](function(_0x15c5a1){_0x257ff7(_0x15c5a1);})['catch'](function(_0x17c3c6){_0x496b6b(_0x17c3c6);});});}function verifyJwt(_0x16d01b,_0x5a4f27,_0x1dcf13){var _0xc8d22=BPromise['promisify'](jwt[_0xad8b('0x86')],{'context':jwt});var _0x360bde=_0x1dcf13||config[_0xad8b('0xb')][_0xad8b('0xc')];return new BPromise(function(_0x851099,_0x35edcd){_0xc8d22(_0x16d01b,_0x360bde,_0x5a4f27)[_0xad8b('0x3f')](function(_0x5c8ece){_0x851099(_0x5c8ece);})[_0xad8b('0x49')](function(_0x2d0de4){_0x35edcd(_0x2d0de4);});});}function generateNonce(){return crypto[_0xad8b('0x87')](0x10)[_0xad8b('0x88')](_0xad8b('0x89'));}function generateIssuedAt(){return Math['floor'](Date[_0xad8b('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x1eea24){var _0x5b3bb2={'payload':{'iat':_0x1eea24['apiKeyIat'],'nonce':_0x1eea24[_0xad8b('0x72')]},'options':{'algorithm':_0xad8b('0x8b'),'subject':_0x1eea24['id']['toString'](),'issuer':hardwareConf[_0xad8b('0x55')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5b3bb2)[_0xad8b('0x3f')](function(_0x35d04a){return{'iat':_0x1eea24[_0xad8b('0x70')],'nonce':_0x1eea24['apiKeyNonce'],'token':_0x35d04a};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 43c0d79..2bc81b8 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda57=['fields','filter','clause','tags','user','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','cf_','CmCustomField','findOne','slice','all','length','fieldType','type','map','lodash','../../mysqldb','skipContactsQuery','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where'];(function(_0x529351,_0x3ac704){var _0x41cd56=function(_0x540861){while(--_0x540861){_0x529351['push'](_0x529351['shift']());}};_0x41cd56(++_0x3ac704);}(_0xda57,0xb0));var _0x7da5=function(_0x7944e6,_0x56422d){_0x7944e6=_0x7944e6-0x0;var _0x39d894=_0xda57[_0x7944e6];return _0x39d894;};'use strict';var _=require(_0x7da5('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7da5('0x1'))['db'];exports['findAll']=function(_0x16fc57,_0x2c21e7,_0x55ab0c,_0x50e4ed){var _0x320b6c={'count':0x0,'rows':[]};var _0x393717=sqlUtils[_0x7da5('0x2')](_0x2c21e7,_0x16fc57);if(_0x393717){return Promise['resolve'](_0x320b6c);}var _0x261303=sqlUtils[_0x7da5('0x3')]();var _0x2cdfcf={};var _0x2dba8c=![];var _0x1eb862=![];return Promise['resolve']()['then'](function(){if(_0x16fc57[_0x7da5('0x4')]){return sqlUtils[_0x7da5('0x5')](_0x16fc57[_0x7da5('0x4')],_0x50e4ed);}else{return sqlUtils[_0x7da5('0x6')](_0x16fc57,_0x50e4ed);}})[_0x7da5('0x7')](function(_0x317ff9){_0x261303[_0x7da5('0x8')](_0x317ff9['default']);_0x261303[_0x7da5('0x8')](_0x317ff9[_0x7da5('0x9')]);_0x261303[_0x7da5('0x8')](_0x317ff9[_0x7da5('0xa')]);_0x261303[_0x7da5('0x8')](_0x317ff9['user'][_0x7da5('0xb')]);_0x2cdfcf=_0x317ff9[_0x7da5('0xc')];_0x1eb862=_0x317ff9[_0x7da5('0xd')]['skip'];return sqlUtils[_0x7da5('0xe')](_0x2c21e7,_0x16fc57,_0x1eb862);})[_0x7da5('0x7')](function(_0x55f237){_0x261303[_0x7da5('0x8')](_0x55f237);var _0x18709b=_0x16fc57[_0x7da5('0x4')]?_0x2cdfcf[_0x7da5('0xf')]:_0x16fc57[_0x7da5('0x10')];_0x2dba8c=_0x18709b?!![]:![];return sqlUtils[_0x7da5('0x11')](_0x261303,_0x18709b);})[_0x7da5('0x7')](function(_0x1ffd89){_0x320b6c['count']=_0x1ffd89;if(_0x320b6c[_0x7da5('0x12')]===0x0){return;}if(_0x16fc57[_0x7da5('0x13')]){_0x1eb862=!![];}return sqlUtils[_0x7da5('0x14')](_0x261303,_0x16fc57[_0x7da5('0x9')],_0x55ab0c,_0x2dba8c,_0x2cdfcf[_0x7da5('0xb')],_0x1eb862);})[_0x7da5('0x7')](function(_0x52c4f5){if(!_0x52c4f5){return[];}return sqlUtils[_0x7da5('0x15')](_0x52c4f5,_0x16fc57,_0x55ab0c);})[_0x7da5('0x7')](function(_0x144c21){_0x320b6c[_0x7da5('0x16')]=_0x144c21;return _0x320b6c;})[_0x7da5('0x17')](function(_0x560779){throw _0x560779;});};exports['describe']=function(){var _0x3e6648={};var _0x465b4a=[];return db[_0x7da5('0x18')][_0x7da5('0x19')]()[_0x7da5('0x7')](function(_0x3ed979){_0x3e6648=_0x3ed979;var _0x4a2b0a=Object[_0x7da5('0x1a')](_0x3e6648)[_0x7da5('0xa')](function(_0x216c07){return _[_0x7da5('0x1b')](_0x216c07,_0x7da5('0x1c'))?_0x216c07:undefined;});var _0x49159e=_0x4a2b0a['map'](function(_0x5406ed){return db[_0x7da5('0x1d')][_0x7da5('0x1e')]({'where':{'id':_0x5406ed[_0x7da5('0x1f')](0x3)},'raw':!![]});});return Promise[_0x7da5('0x20')](_0x49159e);})['then'](function(_0x3d093d){for(var _0x5d8be4=0x0;_0x5d8be4<_0x3d093d[_0x7da5('0x21')];_0x5d8be4++){if(_0x3d093d[_0x5d8be4]){var _0x1d6351='cf_'+_0x3d093d[_0x5d8be4]['id'];_0x3e6648[_0x1d6351][_0x7da5('0x22')]=_0x3d093d[_0x5d8be4][_0x7da5('0x23')];}}_0x465b4a=_[_0x7da5('0x24')](Object[_0x7da5('0x1a')](_0x3e6648),function(_0x48650c){return{'name':_0x48650c,'type':_0x3e6648[_0x48650c]['type']};});return _0x465b4a;})[_0x7da5('0x17')](function(_0x343466){throw _0x343466;});}; \ No newline at end of file +var _0x9aee=['fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','user','tags','skip','checkListsRestrictions','ids','tag','count','buildContactsQuery','getFilteredContacts','describe','CmContact','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length'];(function(_0x15a0d4,_0x468c07){var _0x5aaef7=function(_0x29ab89){while(--_0x29ab89){_0x15a0d4['push'](_0x15a0d4['shift']());}};_0x5aaef7(++_0x468c07);}(_0x9aee,0xb2));var _0xe9ae=function(_0x424900,_0x5565b8){_0x424900=_0x424900-0x0;var _0x32968d=_0x9aee[_0x424900];return _0x32968d;};'use strict';var _=require(_0xe9ae('0x0'));var sqlUtils=require(_0xe9ae('0x1'));var db=require(_0xe9ae('0x2'))['db'];exports[_0xe9ae('0x3')]=function(_0x395529,_0x19e616,_0xb9dbec,_0x385084){var _0x4d0df7={'count':0x0,'rows':[]};var _0x2b0436=sqlUtils['skipContactsQuery'](_0x19e616,_0x395529);if(_0x2b0436){return Promise['resolve'](_0x4d0df7);}var _0x366b59=sqlUtils['getContactsSubquery']();var _0x5370a7={};var _0x1d355d=![];var _0x56a659=![];return Promise[_0xe9ae('0x4')]()[_0xe9ae('0x5')](function(){if(_0x395529[_0xe9ae('0x6')]){return sqlUtils[_0xe9ae('0x7')](_0x395529['search'],_0x385084);}else{return sqlUtils[_0xe9ae('0x8')](_0x395529,_0x385084);}})['then'](function(_0x2f34b2){_0x366b59['where'](_0x2f34b2[_0xe9ae('0x9')]);_0x366b59[_0xe9ae('0xa')](_0x2f34b2[_0xe9ae('0xb')]);_0x366b59[_0xe9ae('0xa')](_0x2f34b2['filter']);_0x366b59[_0xe9ae('0xa')](_0x2f34b2[_0xe9ae('0xc')]['clause']);_0x5370a7=_0x2f34b2[_0xe9ae('0xd')];_0x56a659=_0x2f34b2[_0xe9ae('0xc')][_0xe9ae('0xe')];return sqlUtils[_0xe9ae('0xf')](_0x19e616,_0x395529,_0x56a659);})[_0xe9ae('0x5')](function(_0x4d3945){_0x366b59[_0xe9ae('0xa')](_0x4d3945);var _0x2f31bc=_0x395529[_0xe9ae('0x6')]?_0x5370a7[_0xe9ae('0x10')]:_0x395529[_0xe9ae('0x11')];_0x1d355d=_0x2f31bc?!![]:![];return sqlUtils['countFilteredContacts'](_0x366b59,_0x2f31bc);})['then'](function(_0x288552){_0x4d0df7[_0xe9ae('0x12')]=_0x288552;if(_0x4d0df7[_0xe9ae('0x12')]===0x0){return;}if(_0x395529['User']){_0x56a659=!![];}return sqlUtils[_0xe9ae('0x13')](_0x366b59,_0x395529[_0xe9ae('0xb')],_0xb9dbec,_0x1d355d,_0x5370a7['clause'],_0x56a659);})['then'](function(_0x3917e5){if(!_0x3917e5){return[];}return sqlUtils[_0xe9ae('0x14')](_0x3917e5,_0x395529,_0xb9dbec);})[_0xe9ae('0x5')](function(_0x5d4a33){_0x4d0df7['rows']=_0x5d4a33;return _0x4d0df7;})['catch'](function(_0x58ff92){throw _0x58ff92;});};exports[_0xe9ae('0x15')]=function(){var _0x2e0989={};var _0x57a049=[];return db[_0xe9ae('0x16')][_0xe9ae('0x15')]()['then'](function(_0x2dfec6){_0x2e0989=_0x2dfec6;var _0x3cd433=Object[_0xe9ae('0x17')](_0x2e0989)[_0xe9ae('0x18')](function(_0xf1355d){return _[_0xe9ae('0x19')](_0xf1355d,_0xe9ae('0x1a'))?_0xf1355d:undefined;});var _0x2c612a=_0x3cd433[_0xe9ae('0x1b')](function(_0x2332b7){return db[_0xe9ae('0x1c')][_0xe9ae('0x1d')]({'where':{'id':_0x2332b7[_0xe9ae('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x2c612a);})[_0xe9ae('0x5')](function(_0x46e83d){for(var _0xd9fa54=0x0;_0xd9fa54<_0x46e83d[_0xe9ae('0x1f')];_0xd9fa54++){if(_0x46e83d[_0xd9fa54]){var _0x416f43=_0xe9ae('0x1a')+_0x46e83d[_0xd9fa54]['id'];_0x2e0989[_0x416f43][_0xe9ae('0x20')]=_0x46e83d[_0xd9fa54]['type'];}}_0x57a049=_['map'](Object[_0xe9ae('0x17')](_0x2e0989),function(_0x16dda5){return{'name':_0x16dda5,'type':_0x2e0989[_0x16dda5][_0xe9ae('0x21')]};});return _0x57a049;})[_0xe9ae('0x22')](function(_0x593f26){throw _0x593f26;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 22cc1a9..1facf4c 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf572=['query','toString','Tags','clone','isEmpty','sequelize','COUNT(*)','../parsers/advancedSearch','../../mysqldb','role','agent','search','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','email','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','datetime','castTo','DATE','buildExpression','type','default','text','value','map','and','tags','ids','User','user','clause','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','Tag','findAll','name','color','keyBy','Sequelize','QueryTypes','SELECT'];(function(_0x16a9da,_0x2059ec){var _0xbefa88=function(_0x7d0adc){while(--_0x7d0adc){_0x16a9da['push'](_0x16a9da['shift']());}};_0xbefa88(++_0x2059ec);}(_0xf572,0x13c));var _0x2f57=function(_0x3ea2e0,_0x261f01){_0x3ea2e0=_0x3ea2e0-0x0;var _0x552331=_0xf572[_0x3ea2e0];return _0x552331;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x2f57('0x0'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x2f57('0x1'))['db'];function skipContactsQuery(_0x30658f,_0x53000d){var _0x35b598=![];if(_0x30658f[_0x2f57('0x2')]===_0x2f57('0x3')&&!_0x53000d[_0x2f57('0x4')]&&!_0x53000d[_0x2f57('0x5')]&&_0x53000d['autocomplete']!==_0x2f57('0x6')){_0x35b598=!![];}return _0x35b598;}function getContactsSubquery(){return squel[_0x2f57('0x7')]()[_0x2f57('0x8')](_0x2f57('0x9'),'c')[_0x2f57('0xa')](_0x2f57('0xb'));}function applyJoinClauses(_0x2f7ca3,_0x4d3ca5){var _0x345766=_0x4d3ca5?'c':_0x2f57('0xc');_0x2f7ca3[_0x2f57('0xd')](_0x2f57('0xe'),'uc',_0x2f57('0xf')+_0x345766+_0x2f57('0x10'))[_0x2f57('0xd')](_0x2f57('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x345766+_0x2f57('0x10'))[_0x2f57('0xd')](_0x2f57('0x12'),'t',_0x2f57('0x13'));return _0x2f7ca3;}function addFieldsToQuery(_0x4bf35f,_0x36c129,_0x2d641c,_0x411704,_0x3e37f5){var _0x45ae18=_0x3e37f5?'c':_0x2f57('0xc');if(!_0x36c129){_0x36c129=['id',_0x2f57('0x14'),_0x2f57('0x15'),_0x2f57('0x16'),'mobile','fax',_0x2f57('0x17'),'ListId','CompanyId',_0x2f57('0x18'),_0x2f57('0x19'),_0x2f57('0x1a'),_0x2f57('0x1b')];}else if(!_0x36c129['includes']('id')){_0x36c129[_0x2f57('0x1c')]('id');}var _0x2086cb=_0x2d641c&&_0x3e37f5||!_0x2d641c&&!_0x3e37f5;if(_0x411704){_0x2086cb=_0x411704&&_0x3e37f5||!_0x411704&&!_0x3e37f5;}_0x36c129[_0x2f57('0x1d')](function(_0x1bcad8){if(_0x1bcad8===_0x2f57('0x1b')){if(_0x2086cb){_0x4bf35f[_0x2f57('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1bcad8);}else if(_0x2d641c||_0x411704){_0x4bf35f[_0x2f57('0x1e')](_0x45ae18+'.'+_0x1bcad8);}}else{_0x4bf35f[_0x2f57('0x1e')](_0x45ae18+'.'+_0x1bcad8);}});return _0x4bf35f;}function getSqlClauses(){var _0x4ebaf0={'default':squel[_0x2f57('0x1f')](),'fields':squel[_0x2f57('0x1f')](),'filter':squel[_0x2f57('0x1f')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x2f57('0x1f')](),'skip':![]}};return _0x4ebaf0;}function parseTagParameter(_0x27608e){var _0xe28e09=squel[_0x2f57('0x1f')]();if(_0x27608e){var _0x48d787=utils[_0x2f57('0x20')](_0x27608e);_0x48d787[_0x2f57('0x1d')](function(_0x3859d9){_0xe28e09['or'](_0x2f57('0x21'),'%,'+_0x3859d9+',%');});}return _0xe28e09;}function parseSearchFilter(_0x19d16e){var _0x439b29=squel[_0x2f57('0x1f')]();if(_0x19d16e){var _0x5b526b=_0x19d16e['replace']('\x5c','\x5c\x5c')[_0x2f57('0x22')](/'/g,'\x27\x27');var _0x29856e=qs['escapeLIKESpecialChars'](_0x5b526b);if(_0x5b526b[_0x2f57('0x23')]('\x20')[_0x2f57('0x24')]>0x1){_0x439b29['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2f57('0x25')](_0x5b526b,!![]),null);}else{if(qs[_0x2f57('0x26')](_0x5b526b)){_0x439b29['or'](_0x2f57('0x27'),_0x29856e+'%');_0x439b29['or'](_0x2f57('0x28'),_0x29856e+'%');_0x439b29['or'](_0x2f57('0x29'),_0x29856e+'%');_0x439b29['or'](_0x2f57('0x2a'),_0x29856e+'%');}else if(qs['isEmail'](_0x5b526b)){_0x439b29['or'](_0x2f57('0x2b'),_0x29856e+'%');}else{_0x439b29['or'](_0x2f57('0x2c'),'%'+_0x29856e+'%');_0x439b29['or'](_0x2f57('0x2d'),'%'+_0x29856e+'%');_0x439b29['or'](_0x2f57('0x2b'),'%'+_0x29856e+'%');}}}return _0x439b29;}function parseAdvancedSearchFilter(_0x7af0a8,_0x1630fc){var _0x592f36=getSqlClauses();var _0x184891=as[_0x2f57('0x2e')](_0x7af0a8);var _0x14f192=_0x184891[_0x2f57('0x2f')];for(var _0x40d61d=0x0;_0x40d61d<_0x184891[_0x2f57('0x30')][_0x2f57('0x24')];_0x40d61d++){var _0x59c987=_0x184891[_0x2f57('0x30')][_0x40d61d];var _0x3d3b0a='c';var _0x5ca32d=_[_0x2f57('0x31')](_0x1630fc,['name',_0x59c987[_0x2f57('0x1e')]]);if(_0x5ca32d){if(_0x59c987[_0x2f57('0x1e')]==='dateOfBirth'||_0x5ca32d['fieldType']===_0x2f57('0x32')){_0x59c987[_0x2f57('0x33')]=_0x2f57('0x34');}var _0x233ef4=as[_0x2f57('0x35')](_0x3d3b0a,_0x5ca32d[_0x2f57('0x36')],_0x59c987);_0x592f36[_0x2f57('0x37')][_0x14f192](_0x233ef4[_0x2f57('0x38')],_0x233ef4['value']['start'],_0x233ef4[_0x2f57('0x39')]['end']);}else{if(_0x59c987['field']==='Tag'){var _0x11ddbf=_0x59c987[_0x2f57('0x39')][_0x2f57('0x23')](',')[_0x2f57('0x3a')](function(_0x450ba5){return Number(_0x450ba5);});var _0x411487=parseTagParameter(_0x11ddbf);_0x592f36['tags']['clause'][_0x2f57('0x3b')](_0x411487);_0x592f36[_0x2f57('0x3c')][_0x2f57('0x3d')]=_0x11ddbf;}else if(_0x59c987[_0x2f57('0x1e')]===_0x2f57('0x3e')){_0x592f36[_0x2f57('0x3f')][_0x2f57('0x40')]['and']('uc.UserId\x20=\x20?',_0x59c987[_0x2f57('0x39')]);_0x592f36[_0x2f57('0x3f')][_0x2f57('0x41')]=!![];}}}return _0x592f36;}function parseModelFields(_0x58e99c,_0x33b02c){var _0x5cf6a8=squel[_0x2f57('0x1f')]();var _0x416198=_(_0x58e99c)[_0x2f57('0x42')]()['map'](function(_0x23a0dd){return _[_0x2f57('0x43')](_0x33b02c,['name',_0x23a0dd])?_0x23a0dd:undefined;})[_0x2f57('0x44')]()[_0x2f57('0x39')]();if(_0x58e99c[_0x2f57('0x45')]){_0x416198[_0x2f57('0x1c')](_0x2f57('0x45'));}if(_0x58e99c[_0x2f57('0x3e')]){_0x416198[_0x2f57('0x1c')](_0x2f57('0x3e'));}if(_0x416198['length']>0x0){_0x416198[_0x2f57('0x1d')](function(_0x1f8d91){if(_0x1f8d91===_0x2f57('0x5')){_0x5cf6a8[_0x2f57('0x3b')](_0x2f57('0x46'),[][_0x2f57('0x47')](_0x58e99c[_0x1f8d91]));}else if(_0x1f8d91===_0x2f57('0x45')){var _0x4e28eb='%'+_0x58e99c[_0x1f8d91]+'%';_0x5cf6a8[_0x2f57('0x3b')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4e28eb);}else if(_0x1f8d91===_0x2f57('0x3e')){_0x5cf6a8['and']('uc.UserId\x20=\x20?',_0x58e99c[_0x1f8d91]);}else{_0x5cf6a8[_0x2f57('0x3b')]('c.'+_0x1f8d91+_0x2f57('0x48'),_0x58e99c[_0x1f8d91]);}});}return _0x5cf6a8;}function parseQueryParameters(_0x43aec7,_0x5bb7f3){var _0x5438fd=getSqlClauses();return Promise[_0x2f57('0x49')]()['then'](function(){return parseModelFields(_0x43aec7,_0x5bb7f3);})[_0x2f57('0x4a')](function(_0xd323d1){_0x5438fd[_0x2f57('0x4b')][_0x2f57('0x3b')](_0xd323d1);return parseTagParameter(_0x43aec7[_0x2f57('0x4c')]);})[_0x2f57('0x4a')](function(_0x21bedc){_0x5438fd[_0x2f57('0x3c')][_0x2f57('0x40')]['and'](_0x21bedc);return parseSearchFilter(_0x43aec7['filter']);})[_0x2f57('0x4a')](function(_0x1472e9){_0x5438fd['filter']=_0x1472e9;return _0x5438fd;});}function checkListsRestrictions(_0x4d5f4a,_0x5a8e04,_0x1bf0ff){var _0x1bd080=squel['expr']();return Promise[_0x2f57('0x49')]()[_0x2f57('0x4a')](function(){if(_0x5a8e04[_0x2f57('0x4')]&&_0x4d5f4a[_0x2f57('0x2')]===_0x2f57('0x3')&&!_0x1bf0ff){return _0x4d5f4a[_0x2f57('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x2f57('0x4a')](function(_0x40e93c){if(_0x40e93c){if(_0x40e93c['length']===0x0){_0x1bd080['and'](_0x2f57('0x4e'));}else{_0x1bd080[_0x2f57('0x3b')](_0x2f57('0x46'),_[_0x2f57('0x3a')](_0x40e93c,'id'));}}})[_0x2f57('0x4a')](function(){return _0x1bd080;});}function buildContactsQuery(_0x14c9eb,_0x5cc05d,_0x313cc1,_0x352603,_0x11c059,_0x31ab63){if(_0x5cc05d){_0x5cc05d=_0x313cc1[_0x2f57('0x4f')];}_0x14c9eb=addFieldsToQuery(_0x14c9eb,_0x5cc05d,_0x352603,_0x31ab63,!![]);var _0x49943f=squel[_0x2f57('0x7')]();_0x49943f=addFieldsToQuery(_0x49943f,_0x5cc05d,_0x352603,_0x31ab63,![]);if(_0x352603||_0x31ab63){_0x14c9eb=applyJoinClauses(_0x14c9eb,!![]);_0x14c9eb[_0x2f57('0x50')](_0x2f57('0x51'));if(_0x313cc1[_0x2f57('0x52')]){_0x49943f[_0x2f57('0x52')](_0x313cc1['limit']);}if(_0x313cc1[_0x2f57('0x53')]){_0x49943f['offset'](_0x313cc1[_0x2f57('0x53')]);}}else{_0x49943f=applyJoinClauses(_0x49943f,![]);_0x49943f[_0x2f57('0x50')](_0x2f57('0x54'));if(_0x313cc1[_0x2f57('0x52')]){_0x14c9eb[_0x2f57('0x52')](_0x313cc1['limit']);}if(_0x313cc1[_0x2f57('0x53')]){_0x14c9eb[_0x2f57('0x53')](_0x313cc1[_0x2f57('0x53')]);}}_0x49943f['having'](_0x11c059);if(_0x313cc1[_0x2f57('0x55')]){_0x313cc1['order'][_0x2f57('0x1d')](function(_0x378dbd){_0x14c9eb[_0x2f57('0x55')]('c.'+_0x378dbd[0x0],_0x378dbd[0x1]===_0x2f57('0x56')?![]:!![]);_0x49943f['order'](_0x2f57('0x57')+_0x378dbd[0x0],_0x378dbd[0x1]===_0x2f57('0x56')?![]:!![]);});}_0x49943f[_0x2f57('0x8')](_0x14c9eb,_0x2f57('0xc'));return _0x49943f;}function getFilteredContacts(_0x8692f8){var _0x1f7468=[];return db[_0x2f57('0x58')][_0x2f57('0x59')]({'attributes':['id',_0x2f57('0x5a'),_0x2f57('0x5b')],'raw':!![]})['then'](function(_0x18df58){_0x1f7468=_[_0x2f57('0x5c')](_0x18df58,'id');var _0x273fc5={'type':db[_0x2f57('0x5d')][_0x2f57('0x5e')][_0x2f57('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2f57('0x60')](_0x8692f8[_0x2f57('0x61')](),_0x273fc5);})[_0x2f57('0x4a')](function(_0x43271f){_0x43271f['forEach'](function(_0x35fdef){if(_0x35fdef[_0x2f57('0x1b')]){_0x35fdef['Tags']=[];_0x35fdef['TagIds'][_0x2f57('0x23')](',')[_0x2f57('0x1d')](function(_0x3280c5){_0x35fdef[_0x2f57('0x62')][_0x2f57('0x1c')](_0x1f7468[_0x3280c5]);});}delete _0x35fdef['TagIds'];});return _0x43271f;});}function countFilteredContacts(_0x3d0a65,_0x10612c){var _0x2be131=_0x3d0a65[_0x2f57('0x63')]();_0x2be131[_0x2f57('0x1e')]('COUNT(*)');_0x2be131=applyJoinClauses(_0x2be131,!![]);_0x3d0a65[_0x2f57('0x50')](_0x2f57('0x51'));var _0x1ee73e=utils['getSelectedTags'](_0x10612c);if(!_[_0x2f57('0x64')](_0x1ee73e)){_0x2be131[_0x2f57('0xa')]('t.id\x20IN\x20?',_0x1ee73e);}var _0x4e32e2={'type':db[_0x2f57('0x5d')][_0x2f57('0x5e')][_0x2f57('0x5f')],'raw':!![]};return db[_0x2f57('0x65')][_0x2f57('0x60')](_0x2be131[_0x2f57('0x61')](),_0x4e32e2)[_0x2f57('0x4a')](function(_0xfac4de){return _0xfac4de[0x0][_0x2f57('0x66')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x029d=['getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','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?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','fieldType','DATE','type','default','text','value','start','end','Tag','tags','clause','and','ids','User','user','name','compact','Contact','push','c.ListId\x20IN\x20?','concat','uc.UserId\x20=\x20?','resolve','then','fields','c.ListId\x20IS\x20NULL','map','group','c.id','limit','subqry.id','offset','having','order','DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','sequelize','query','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','toString','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','search','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr'];(function(_0x5e953f,_0x1b6d75){var _0x2e822e=function(_0x2f45c3){while(--_0x2f45c3){_0x5e953f['push'](_0x5e953f['shift']());}};_0x2e822e(++_0x1b6d75);}(_0x029d,0x176));var _0xd029=function(_0x19c577,_0x67ca3a){_0x19c577=_0x19c577-0x0;var _0x11326f=_0x029d[_0x19c577];return _0x11326f;};'use strict';var _=require(_0xd029('0x0'));var squel=require(_0xd029('0x1'));var as=require(_0xd029('0x2'));var qs=require(_0xd029('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x117bb1,_0x117162){var _0x200186=![];if(_0x117bb1[_0xd029('0x4')]===_0xd029('0x5')&&!_0x117162[_0xd029('0x6')]&&!_0x117162[_0xd029('0x7')]&&_0x117162[_0xd029('0x8')]!=='true'){_0x200186=!![];}return _0x200186;}function getContactsSubquery(){return squel[_0xd029('0x9')]()['from'](_0xd029('0xa'),'c')[_0xd029('0xb')](_0xd029('0xc'));}function applyJoinClauses(_0x51d8c6,_0x2f78e7){var _0x1573ac=_0x2f78e7?'c':_0xd029('0xd');_0x51d8c6['left_join'](_0xd029('0xe'),'uc',_0xd029('0xf')+_0x1573ac+_0xd029('0x10'))[_0xd029('0x11')](_0xd029('0x12'),'ct',_0xd029('0x13')+_0x1573ac+'.id')[_0xd029('0x11')](_0xd029('0x14'),'t',_0xd029('0x15'));return _0x51d8c6;}function addFieldsToQuery(_0x55cd97,_0x379dc0,_0x24f72f,_0x30a8bc,_0x486be9){var _0x24ade4=_0x486be9?'c':_0xd029('0xd');if(!_0x379dc0){_0x379dc0=['id',_0xd029('0x16'),'lastName','phone','mobile',_0xd029('0x17'),_0xd029('0x18'),_0xd029('0x7'),_0xd029('0x19'),_0xd029('0x1a'),'updatedAt',_0xd029('0x1b'),_0xd029('0x1c')];}else if(!_0x379dc0[_0xd029('0x1d')]('id')){_0x379dc0['push']('id');}var _0x2fe93a=_0x24f72f&&_0x486be9||!_0x24f72f&&!_0x486be9;if(_0x30a8bc){_0x2fe93a=_0x30a8bc&&_0x486be9||!_0x30a8bc&&!_0x486be9;}_0x379dc0[_0xd029('0x1e')](function(_0x3b9dd1){if(_0x3b9dd1===_0xd029('0x1c')){if(_0x2fe93a){_0x55cd97[_0xd029('0x1f')](_0xd029('0x20'),_0x3b9dd1);}else if(_0x24f72f||_0x30a8bc){_0x55cd97[_0xd029('0x1f')](_0x24ade4+'.'+_0x3b9dd1);}}else{_0x55cd97[_0xd029('0x1f')](_0x24ade4+'.'+_0x3b9dd1);}});return _0x55cd97;}function getSqlClauses(){var _0x52d1dc={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0xd029('0x21')](),'ids':null},'user':{'clause':squel[_0xd029('0x21')](),'skip':![]}};return _0x52d1dc;}function parseTagParameter(_0x133b44){var _0x1ff007=squel['expr']();if(_0x133b44){var _0x4611df=utils[_0xd029('0x22')](_0x133b44);_0x4611df['forEach'](function(_0x29117a){_0x1ff007['or'](_0xd029('0x23'),'%,'+_0x29117a+',%');});}return _0x1ff007;}function parseSearchFilter(_0x54f64e){var _0x44e6c7=squel[_0xd029('0x21')]();if(_0x54f64e){var _0x3e75ae=_0x54f64e[_0xd029('0x24')]('\x5c','\x5c\x5c')[_0xd029('0x24')](/'/g,'\x27\x27');var _0x31610a=qs['escapeLIKESpecialChars'](_0x3e75ae);if(_0x3e75ae[_0xd029('0x25')]('\x20')['length']>0x1){_0x44e6c7['or'](_0xd029('0x26'),qs[_0xd029('0x27')](_0x3e75ae,!![]),null);}else{if(qs[_0xd029('0x28')](_0x3e75ae)){_0x44e6c7['or'](_0xd029('0x29'),_0x31610a+'%');_0x44e6c7['or'](_0xd029('0x2a'),_0x31610a+'%');_0x44e6c7['or'](_0xd029('0x2b'),_0x31610a+'%');_0x44e6c7['or'](_0xd029('0x2c'),_0x31610a+'%');}else if(qs[_0xd029('0x2d')](_0x3e75ae)){_0x44e6c7['or']('c.email\x20LIKE\x20?',_0x31610a+'%');}else{_0x44e6c7['or']('c.firstName\x20LIKE\x20?','%'+_0x31610a+'%');_0x44e6c7['or'](_0xd029('0x2e'),'%'+_0x31610a+'%');_0x44e6c7['or']('c.email\x20LIKE\x20?','%'+_0x31610a+'%');}}}return _0x44e6c7;}function parseAdvancedSearchFilter(_0x29ce26,_0x113787){var _0x554247=getSqlClauses();var _0x3cf9c6=as[_0xd029('0x2f')](_0x29ce26);var _0x443fc7=_0x3cf9c6[_0xd029('0x30')];for(var _0x49b231=0x0;_0x49b231<_0x3cf9c6[_0xd029('0x31')][_0xd029('0x32')];_0x49b231++){var _0x21446e=_0x3cf9c6[_0xd029('0x31')][_0x49b231];var _0x209443='c';var _0x26f4e9=_['find'](_0x113787,['name',_0x21446e[_0xd029('0x1f')]]);if(_0x26f4e9){if(_0x21446e[_0xd029('0x1f')]==='dateOfBirth'||_0x26f4e9[_0xd029('0x33')]==='datetime'){_0x21446e['castTo']=_0xd029('0x34');}var _0xeb918f=as['buildExpression'](_0x209443,_0x26f4e9[_0xd029('0x35')],_0x21446e);_0x554247[_0xd029('0x36')][_0x443fc7](_0xeb918f[_0xd029('0x37')],_0xeb918f[_0xd029('0x38')][_0xd029('0x39')],_0xeb918f[_0xd029('0x38')][_0xd029('0x3a')]);}else{if(_0x21446e[_0xd029('0x1f')]===_0xd029('0x3b')){var _0x3768e1=_0x21446e['value'][_0xd029('0x25')](',')['map'](function(_0x49d083){return Number(_0x49d083);});var _0x4461ae=parseTagParameter(_0x3768e1);_0x554247[_0xd029('0x3c')][_0xd029('0x3d')][_0xd029('0x3e')](_0x4461ae);_0x554247[_0xd029('0x3c')][_0xd029('0x3f')]=_0x3768e1;}else if(_0x21446e['field']===_0xd029('0x40')){_0x554247[_0xd029('0x41')][_0xd029('0x3d')]['and']('uc.UserId\x20=\x20?',_0x21446e['value']);_0x554247[_0xd029('0x41')]['skip']=!![];}}}return _0x554247;}function parseModelFields(_0x1947d0,_0x61b837){var _0x1925df=squel['expr']();var _0xb111f9=_(_0x1947d0)['keys']()['map'](function(_0x41837d){return _['some'](_0x61b837,[_0xd029('0x42'),_0x41837d])?_0x41837d:undefined;})[_0xd029('0x43')]()[_0xd029('0x38')]();if(_0x1947d0[_0xd029('0x44')]){_0xb111f9[_0xd029('0x45')]('Contact');}if(_0x1947d0[_0xd029('0x40')]){_0xb111f9[_0xd029('0x45')]('User');}if(_0xb111f9['length']>0x0){_0xb111f9['forEach'](function(_0x2f61da){if(_0x2f61da==='ListId'){_0x1925df[_0xd029('0x3e')](_0xd029('0x46'),[][_0xd029('0x47')](_0x1947d0[_0x2f61da]));}else if(_0x2f61da==='Contact'){var _0x5c83c6='%'+_0x1947d0[_0x2f61da]+'%';_0x1925df[_0xd029('0x3e')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x5c83c6);}else if(_0x2f61da===_0xd029('0x40')){_0x1925df['and'](_0xd029('0x48'),_0x1947d0[_0x2f61da]);}else{_0x1925df[_0xd029('0x3e')]('c.'+_0x2f61da+'\x20=\x20?',_0x1947d0[_0x2f61da]);}});}return _0x1925df;}function parseQueryParameters(_0x2789bd,_0x21f4df){var _0x4edf36=getSqlClauses();return Promise[_0xd029('0x49')]()[_0xd029('0x4a')](function(){return parseModelFields(_0x2789bd,_0x21f4df);})['then'](function(_0x23b0bd){_0x4edf36[_0xd029('0x4b')][_0xd029('0x3e')](_0x23b0bd);return parseTagParameter(_0x2789bd['tag']);})[_0xd029('0x4a')](function(_0x2139cd){_0x4edf36[_0xd029('0x3c')][_0xd029('0x3d')]['and'](_0x2139cd);return parseSearchFilter(_0x2789bd['filter']);})[_0xd029('0x4a')](function(_0x3de6dc){_0x4edf36['filter']=_0x3de6dc;return _0x4edf36;});}function checkListsRestrictions(_0x21dbb9,_0x29e572,_0x145254){var _0x59db51=squel['expr']();return Promise[_0xd029('0x49')]()[_0xd029('0x4a')](function(){if(_0x29e572[_0xd029('0x6')]&&_0x21dbb9[_0xd029('0x4')]===_0xd029('0x5')&&!_0x145254){return _0x21dbb9['getLists']({'attributes':['id'],'raw':!![]});}})[_0xd029('0x4a')](function(_0x2b2fdd){if(_0x2b2fdd){if(_0x2b2fdd['length']===0x0){_0x59db51['and'](_0xd029('0x4c'));}else{_0x59db51[_0xd029('0x3e')](_0xd029('0x46'),_[_0xd029('0x4d')](_0x2b2fdd,'id'));}}})[_0xd029('0x4a')](function(){return _0x59db51;});}function buildContactsQuery(_0xc3261,_0x2cc685,_0x244198,_0x4411c0,_0x1a83ad,_0x1d3a7a){if(_0x2cc685){_0x2cc685=_0x244198['attributes'];}_0xc3261=addFieldsToQuery(_0xc3261,_0x2cc685,_0x4411c0,_0x1d3a7a,!![]);var _0x3a4578=squel['select']();_0x3a4578=addFieldsToQuery(_0x3a4578,_0x2cc685,_0x4411c0,_0x1d3a7a,![]);if(_0x4411c0||_0x1d3a7a){_0xc3261=applyJoinClauses(_0xc3261,!![]);_0xc3261[_0xd029('0x4e')](_0xd029('0x4f'));if(_0x244198[_0xd029('0x50')]){_0x3a4578[_0xd029('0x50')](_0x244198[_0xd029('0x50')]);}if(_0x244198['offset']){_0x3a4578['offset'](_0x244198['offset']);}}else{_0x3a4578=applyJoinClauses(_0x3a4578,![]);_0x3a4578['group'](_0xd029('0x51'));if(_0x244198[_0xd029('0x50')]){_0xc3261[_0xd029('0x50')](_0x244198[_0xd029('0x50')]);}if(_0x244198['offset']){_0xc3261['offset'](_0x244198[_0xd029('0x52')]);}}_0x3a4578[_0xd029('0x53')](_0x1a83ad);if(_0x244198['order']){_0x244198['order'][_0xd029('0x1e')](function(_0x22a8f1){_0xc3261[_0xd029('0x54')]('c.'+_0x22a8f1[0x0],_0x22a8f1[0x1]===_0xd029('0x55')?![]:!![]);_0x3a4578[_0xd029('0x54')](_0xd029('0x56')+_0x22a8f1[0x0],_0x22a8f1[0x1]===_0xd029('0x55')?![]:!![]);});}_0x3a4578[_0xd029('0x57')](_0xc3261,_0xd029('0xd'));return _0x3a4578;}function getFilteredContacts(_0xf080f2){var _0x33213a=[];return db[_0xd029('0x3b')]['findAll']({'attributes':['id',_0xd029('0x42'),_0xd029('0x58')],'raw':!![]})[_0xd029('0x4a')](function(_0x14487d){_0x33213a=_[_0xd029('0x59')](_0x14487d,'id');var _0x34b797={'type':db[_0xd029('0x5a')][_0xd029('0x5b')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xd029('0x5c')][_0xd029('0x5d')](_0xf080f2['toString'](),_0x34b797);})[_0xd029('0x4a')](function(_0x592c6f){_0x592c6f[_0xd029('0x1e')](function(_0xc24a93){if(_0xc24a93[_0xd029('0x1c')]){_0xc24a93[_0xd029('0x5e')]=[];_0xc24a93[_0xd029('0x1c')]['split'](',')['forEach'](function(_0x250da5){_0xc24a93[_0xd029('0x5e')][_0xd029('0x45')](_0x33213a[_0x250da5]);});}delete _0xc24a93[_0xd029('0x1c')];});return _0x592c6f;});}function countFilteredContacts(_0x450d3a,_0x132c31){var _0x104857=_0x450d3a[_0xd029('0x5f')]();_0x104857[_0xd029('0x1f')](_0xd029('0x60'));_0x104857=applyJoinClauses(_0x104857,!![]);_0x450d3a[_0xd029('0x4e')](_0xd029('0x4f'));var _0xce714d=utils[_0xd029('0x22')](_0x132c31);if(!_[_0xd029('0x61')](_0xce714d)){_0x104857[_0xd029('0xb')](_0xd029('0x62'),_0xce714d);}var _0x5dfd79={'type':db[_0xd029('0x5a')][_0xd029('0x5b')][_0xd029('0x63')],'raw':!![]};return db[_0xd029('0x5c')]['query'](_0x104857[_0xd029('0x64')](),_0x5dfd79)['then'](function(_0x2f985f){return _0x2f985f[0x0]['COUNT(*)'];});}module[_0xd029('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7cf01b9..e395153 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 _0x439f=['../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createCipher','data','update','binary','write','end','final','close','unlink','createWriteStream','createDecipher','encryptString','secret','utf8','base64','crypto','lodash','../../config/environment'];(function(_0x920998,_0x58ae0b){var _0x371743=function(_0x6a31a9){while(--_0x6a31a9){_0x920998['push'](_0x920998['shift']());}};_0x371743(++_0x58ae0b);}(_0x439f,0xb7));var _0xf439=function(_0x4a1ec0,_0x26287b){_0x4a1ec0=_0x4a1ec0-0x0;var _0x49ab91=_0x439f[_0x4a1ec0];return _0x49ab91;};'use strict';var crypto=require(_0xf439('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xf439('0x1'));var config=require(_0xf439('0x2'));var logger=require(_0xf439('0x3'))(_0xf439('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf439('0x5')][_0xf439('0x6')],'algorithm':_0xf439('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xf439('0x8')]&&config[_0xf439('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xf439('0x8')]['algorithm']);if(isSupported){fileOptions[_0xf439('0x9')]=config[_0xf439('0x8')][_0xf439('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf439('0xa')](',\x20');logger['error'](config[_0xf439('0x8')][_0xf439('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x13dad9){return AES_SUPPORTED_RX['test'](_0x13dad9);}function getSupportedCiphers(){return crypto[_0xf439('0xb')]()[_0xf439('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0xfe3f98){return getSupportedCiphers()[_0xf439('0xd')](_0xfe3f98)>-0x1;}function combineOptions(_0x4cae9f){var _0x28e3f4={};for(var _0x2c93ac in fileOptions){if(fileOptions[_0xf439('0xe')](_0x2c93ac)){_0x28e3f4[_0x2c93ac]=fileOptions[_0x2c93ac];}}if(_0x4cae9f){for(var _0x248e77 in _0x4cae9f){if(_0x4cae9f[_0xf439('0xe')](_0x248e77)){_0x28e3f4[_0x248e77]=_0x4cae9f[_0x248e77];}}}return _0x28e3f4;}exports['encryptFile']=function(_0xf272db,_0x2fb970,_0x55f080,_0x339e97){return new BPromise(function(_0xf4d4ee,_0xd63a40){_0x339e97=combineOptions(_0x339e97);var _0x11b155=new Buffer(_0x55f080);var _0x277a90=fs[_0xf439('0xf')](_0xf272db);var _0x12f5ea=fs['createWriteStream'](_0x2fb970);var _0x22d168=crypto[_0xf439('0x10')](_0x339e97['algorithm'],_0x11b155);_0x277a90['on'](_0xf439('0x11'),function(_0x251b68){var _0x340606=new Buffer(_0x22d168[_0xf439('0x12')](_0x251b68),_0xf439('0x13'));_0x12f5ea[_0xf439('0x14')](_0x340606);});_0x277a90['on'](_0xf439('0x15'),function(){try{var _0x17fe31=new Buffer(_0x22d168[_0xf439('0x16')](_0xf439('0x13')),_0xf439('0x13'));_0x12f5ea[_0xf439('0x14')](_0x17fe31);_0x12f5ea[_0xf439('0x15')]();_0x12f5ea['on'](_0xf439('0x17'),function(){return _0xf4d4ee(_0x2fb970);});}catch(_0x149ba2){fs[_0xf439('0x18')](_0x2fb970);return _0xd63a40(_0x149ba2);}});});};exports['decryptFile']=function(_0xed05bf,_0xd7dcc0,_0x52bd99,_0x30ad9f){return new BPromise(function(_0x1c7cea,_0x4efee9){_0x30ad9f=combineOptions(_0x30ad9f);var _0x5e5fee=new Buffer(_0x52bd99);var _0x3ca6b8=fs[_0xf439('0xf')](_0xed05bf);var _0x1e86f2=fs[_0xf439('0x19')](_0xd7dcc0);var _0x52476f=crypto[_0xf439('0x1a')](_0x30ad9f[_0xf439('0x9')],_0x5e5fee);_0x3ca6b8['on'](_0xf439('0x11'),function(_0x3df754){var _0x436285=new Buffer(_0x52476f[_0xf439('0x12')](_0x3df754),'binary');_0x1e86f2[_0xf439('0x14')](_0x436285);});_0x3ca6b8['on'](_0xf439('0x15'),function(){try{var _0x4722fd=new Buffer(_0x52476f['final'](_0xf439('0x13')),_0xf439('0x13'));_0x1e86f2[_0xf439('0x14')](_0x4722fd);_0x1e86f2[_0xf439('0x15')]();_0x1e86f2['on'](_0xf439('0x17'),function(){return _0x1c7cea(_0xd7dcc0);});}catch(_0x4024f9){fs['unlink'](_0xd7dcc0);return _0x4efee9(_0x4024f9);}});});};exports[_0xf439('0x1b')]=function(_0x1af9e9,_0x156e8b,_0x19b45a){var _0x400ef3=_0x19b45a||stringOptions['algorithm'];var _0x145dcc=_0x156e8b||stringOptions[_0xf439('0x1c')];var _0x8705bc=crypto[_0xf439('0x10')](_0x400ef3,_0x145dcc);var _0x22434a=_0x8705bc[_0xf439('0x12')](_0x1af9e9,_0xf439('0x1d'),_0xf439('0x1e'));_0x22434a+=_0x8705bc['final']('base64');return _0x22434a;};exports['decryptString']=function(_0x3170d2,_0x154dc7,_0x4cf403){var _0x1e7ca0=_0x4cf403||stringOptions[_0xf439('0x9')];var _0x381fc2=_0x154dc7||stringOptions[_0xf439('0x1c')];var _0x53a099=crypto[_0xf439('0x1a')](_0x1e7ca0,_0x381fc2);var _0x217518=_0x53a099[_0xf439('0x12')](_0x3170d2,'base64',_0xf439('0x1d'));_0x217518+=_0x53a099['final']('utf8');return _0x217518;}; \ No newline at end of file +var _0x32a4=['end','final','close','unlink','decryptFile','createDecipher','data','update','encryptString','secret','utf8','base64','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','write'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32a4,0x1a4));var _0x432a=function(_0x212cc8,_0x593d9d){_0x212cc8=_0x212cc8-0x0;var _0x4cc4d9=_0x32a4[_0x212cc8];return _0x4cc4d9;};'use strict';var crypto=require(_0x432a('0x0'));var fs=require('fs');var BPromise=require(_0x432a('0x1'));var _=require('lodash');var config=require(_0x432a('0x2'));var logger=require(_0x432a('0x3'))(_0x432a('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x432a('0x5')][_0x432a('0x6')],'algorithm':_0x432a('0x7')};const fileOptions={'algorithm':_0x432a('0x8')};if(config[_0x432a('0x9')]&&config[_0x432a('0x9')][_0x432a('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x432a('0xa')]);if(isSupported){fileOptions[_0x432a('0xa')]=config[_0x432a('0x9')][_0x432a('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x432a('0xb')](',\x20');logger['error'](config[_0x432a('0x9')]['algorithm'],_0x432a('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x51644d){return AES_SUPPORTED_RX['test'](_0x51644d);}function getSupportedCiphers(){return crypto[_0x432a('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x548871){return getSupportedCiphers()[_0x432a('0xe')](_0x548871)>-0x1;}function combineOptions(_0x5335cb){var _0x32fc58={};for(var _0x49fa51 in fileOptions){if(fileOptions[_0x432a('0xf')](_0x49fa51)){_0x32fc58[_0x49fa51]=fileOptions[_0x49fa51];}}if(_0x5335cb){for(var _0x39f62f in _0x5335cb){if(_0x5335cb['hasOwnProperty'](_0x39f62f)){_0x32fc58[_0x39f62f]=_0x5335cb[_0x39f62f];}}}return _0x32fc58;}exports[_0x432a('0x10')]=function(_0x1f70b7,_0x3730eb,_0x5449e2,_0x4bc182){return new BPromise(function(_0xf00b48,_0x485150){_0x4bc182=combineOptions(_0x4bc182);var _0x3603a1=new Buffer(_0x5449e2);var _0x30fe06=fs[_0x432a('0x11')](_0x1f70b7);var _0x5daedb=fs[_0x432a('0x12')](_0x3730eb);var _0xd6a8e3=crypto[_0x432a('0x13')](_0x4bc182[_0x432a('0xa')],_0x3603a1);_0x30fe06['on']('data',function(_0xb7edac){var _0x264dca=new Buffer(_0xd6a8e3['update'](_0xb7edac),_0x432a('0x14'));_0x5daedb[_0x432a('0x15')](_0x264dca);});_0x30fe06['on'](_0x432a('0x16'),function(){try{var _0x23fb53=new Buffer(_0xd6a8e3[_0x432a('0x17')](_0x432a('0x14')),_0x432a('0x14'));_0x5daedb[_0x432a('0x15')](_0x23fb53);_0x5daedb['end']();_0x5daedb['on'](_0x432a('0x18'),function(){return _0xf00b48(_0x3730eb);});}catch(_0x30321e){fs[_0x432a('0x19')](_0x3730eb);return _0x485150(_0x30321e);}});});};exports[_0x432a('0x1a')]=function(_0xc796c2,_0x1cb99b,_0x57d462,_0xa75432){return new BPromise(function(_0x3890fc,_0x4bf525){_0xa75432=combineOptions(_0xa75432);var _0x2e5fc5=new Buffer(_0x57d462);var _0x204193=fs[_0x432a('0x11')](_0xc796c2);var _0x3f98ce=fs[_0x432a('0x12')](_0x1cb99b);var _0x228fcb=crypto[_0x432a('0x1b')](_0xa75432[_0x432a('0xa')],_0x2e5fc5);_0x204193['on'](_0x432a('0x1c'),function(_0x151750){var _0x35d366=new Buffer(_0x228fcb[_0x432a('0x1d')](_0x151750),_0x432a('0x14'));_0x3f98ce['write'](_0x35d366);});_0x204193['on']('end',function(){try{var _0x6e834e=new Buffer(_0x228fcb[_0x432a('0x17')](_0x432a('0x14')),_0x432a('0x14'));_0x3f98ce[_0x432a('0x15')](_0x6e834e);_0x3f98ce['end']();_0x3f98ce['on']('close',function(){return _0x3890fc(_0x1cb99b);});}catch(_0xf0a7f4){fs['unlink'](_0x1cb99b);return _0x4bf525(_0xf0a7f4);}});});};exports[_0x432a('0x1e')]=function(_0x4d9f8d,_0xe3cb2b,_0x55230e){var _0x1f7a34=_0x55230e||stringOptions[_0x432a('0xa')];var _0x1d3f51=_0xe3cb2b||stringOptions[_0x432a('0x1f')];var _0x4344e5=crypto[_0x432a('0x13')](_0x1f7a34,_0x1d3f51);var _0xa72b80=_0x4344e5[_0x432a('0x1d')](_0x4d9f8d,_0x432a('0x20'),_0x432a('0x21'));_0xa72b80+=_0x4344e5[_0x432a('0x17')](_0x432a('0x21'));return _0xa72b80;};exports['decryptString']=function(_0x298fec,_0x4f13f6,_0x3cb424){var _0x5db691=_0x3cb424||stringOptions[_0x432a('0xa')];var _0x42cdba=_0x4f13f6||stringOptions[_0x432a('0x1f')];var _0x5c2625=crypto[_0x432a('0x1b')](_0x5db691,_0x42cdba);var _0x4f099d=_0x5c2625['update'](_0x298fec,_0x432a('0x21'),'utf8');_0x4f099d+=_0x5c2625[_0x432a('0x17')](_0x432a('0x20'));return _0x4f099d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 97c3271..9fa5219 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 _0x2c62=['%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT','num','Empty','split','range','isInteger','forEach','push','QueryTypes','dirname','basename','length','existsSync','mkdirSync','join','%s%d.%s','csv'];(function(_0x2dffd7,_0x50e766){var _0x55e83f=function(_0x1cf727){while(--_0x1cf727){_0x2dffd7['push'](_0x2dffd7['shift']());}};_0x55e83f(++_0x50e766);}(_0x2c62,0x1c3));var _0x22c6=function(_0x1bce61,_0x1edb7a){_0x1bce61=_0x1bce61-0x0;var _0x3d7db2=_0x2c62[_0x1bce61];return _0x3d7db2;};'use strict';var util=require(_0x22c6('0x0'));var path=require(_0x22c6('0x1'));var _=require(_0x22c6('0x2'));var csv=require(_0x22c6('0x3'));var fs=require('fs');var BPromise=require(_0x22c6('0x4'));var zipdir=require(_0x22c6('0x5'));var rimraf=require(_0x22c6('0x6'));var db=require(_0x22c6('0x7'))['db'];var dbH=require(_0x22c6('0x7'))[_0x22c6('0x8')];var logger=require(_0x22c6('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x22c6('0xa')][0x2]);var QUERY=process[_0x22c6('0xa')][0x3];var PATH=process[_0x22c6('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d2e23,_0x1045f4){var _0x2bd942={'status':_0x1d2e23};var _0x4d8744={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1045f4){_0x2bd942['savename']=_0x1045f4;}return db[_0x22c6('0xb')][_0x22c6('0xc')](_0x2bd942,_0x4d8744);}function main(){var _0x209e8b=0x1388;var _0x4a9879;logger[_0x22c6('0xd')](util['format'](_0x22c6('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x22c6('0xf')][_0x22c6('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x22c6('0x11')]})[_0x22c6('0x12')](function(_0xd21df1){if(_0xd21df1){_0x4a9879=_0xd21df1;_0x209e8b=_0x4a9879[_0x22c6('0x11')]||0x1388;}})[_0x22c6('0x12')](function(){return dbH[_0x22c6('0x13')][_0x22c6('0x14')](util[_0x22c6('0x15')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x22c6('0x13')]['QueryTypes'][_0x22c6('0x16')]});})['then'](function(_0x597a4e){if(!_0x597a4e[0x0][_0x22c6('0x17')]){return analyticExtractedReport(_0x22c6('0x18'));}var _0x370030=[];var _0x5b8760=0x0;if(_0x4a9879[_0x22c6('0x19')]){if(_0x597a4e&&_0x597a4e['length']){var _0x156d16=_[_0x22c6('0x1a')](_0x597a4e[0x0][_0x22c6('0x17')]/_0x209e8b);var _0x55e7d8=Number[_0x22c6('0x1b')](_0x597a4e[0x0]['num']/_0x209e8b)?_0x597a4e[0x0]['num']%_0x209e8b:0x0;_0x156d16[_0x22c6('0x1c')](function(_0x25726e){if(_0x25726e>0x0){_0x5b8760+=_0x209e8b;}_0x370030[_0x22c6('0x1d')](dbH[_0x22c6('0x13')][_0x22c6('0x14')](util[_0x22c6('0x15')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x209e8b,_0x5b8760),{'type':dbH[_0x22c6('0x13')][_0x22c6('0x1e')]['SELECT']}));});if(_0x55e7d8>0x0){_0x5b8760+=_0x209e8b;_0x370030[_0x22c6('0x1d')](dbH[_0x22c6('0x13')]['query'](util[_0x22c6('0x15')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55e7d8,_0x5b8760),{'type':dbH[_0x22c6('0x13')][_0x22c6('0x1e')][_0x22c6('0x16')]}));}}}else{_0x370030[_0x22c6('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x22c6('0x13')][_0x22c6('0x1e')][_0x22c6('0x16')]}));}var _0x30e8ae=path[_0x22c6('0x1f')](PATH);var _0x1bc12e=path[_0x22c6('0x20')](PATH,'.csv');var _0x1bd71b=_0x4a9879[_0x22c6('0x19')]&&_0x370030[_0x22c6('0x21')]>0x1;var _0x1e2703=[];if(!fs[_0x22c6('0x22')](path['join'](_0x30e8ae,_0x1bc12e))&&_0x1bd71b){fs[_0x22c6('0x23')](path[_0x22c6('0x24')](_0x30e8ae,_0x1bc12e));}return BPromise['each'](_0x370030,function(_0x1ec7db){_0x1e2703[_0x22c6('0x1d')](_0x1ec7db);})['then'](function(){for(var _0x4b38d7=0x0;_0x4b38d7<_0x1e2703['length'];_0x4b38d7+=0x1){var _0x46006b;var _0x239552=_0x1e2703[_0x4b38d7];if(_0x1bd71b){_0x46006b=path['join'](_0x30e8ae,_0x1bc12e,util[_0x22c6('0x15')](_0x22c6('0x25'),_0x1bc12e,_0x4b38d7,_0x22c6('0x26')));}else{_0x46006b=path[_0x22c6('0x24')](_0x30e8ae,util['format'](_0x22c6('0x27'),_0x1bc12e,_0x22c6('0x26')));}fs['writeFileSync'](_0x46006b,csv(_0x239552));}})[_0x22c6('0x12')](function(){if(_0x1bd71b){return new Promise(function(_0x5f0642){zipdir(path[_0x22c6('0x24')](_0x30e8ae,_0x1bc12e),{'saveTo':path[_0x22c6('0x24')](_0x30e8ae,util[_0x22c6('0x15')](_0x22c6('0x27'),_0x1bc12e,_0x22c6('0x28')))},function(_0x3d738f,_0x195f36){rimraf(path[_0x22c6('0x24')](_0x30e8ae,_0x1bc12e),function(){});_0x5f0642('zip\x20finished');});});}})[_0x22c6('0x12')](function(){logger['info'](util['format'](_0x22c6('0x29'),EXTRACTED_REPORT_ID,_0x22c6('0x2a')));return analyticExtractedReport(_0x22c6('0x2b'),_0x1bd71b?util[_0x22c6('0x15')](_0x22c6('0x27'),_0x1bc12e,_0x1bd71b?_0x22c6('0x28'):_0x22c6('0x26')):null);});})[_0x22c6('0x2c')](function(_0x2de7d6){logger['info'](util[_0x22c6('0x15')](_0x22c6('0x2d'),EXTRACTED_REPORT_ID,_0x22c6('0x2a')),util[_0x22c6('0x2e')](_0x2de7d6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x22c6('0x2f')](function(){process[_0x22c6('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf54c=['zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.csv','existsSync','mkdirSync','each','join','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','Failed','finally','exit','util','to-csv','bluebird'];(function(_0x4838db,_0x29f50e){var _0x389bbf=function(_0x407b5e){while(--_0x407b5e){_0x4838db['push'](_0x4838db['shift']());}};_0x389bbf(++_0x29f50e);}(_0xf54c,0x1dd));var _0xcf54=function(_0x4884cd,_0x4fe79d){_0x4884cd=_0x4884cd-0x0;var _0x50d4ff=_0xf54c[_0x4884cd];return _0x50d4ff;};'use strict';var util=require(_0xcf54('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xcf54('0x1'));var fs=require('fs');var BPromise=require(_0xcf54('0x2'));var zipdir=require(_0xcf54('0x3'));var rimraf=require(_0xcf54('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xcf54('0x5'))[_0xcf54('0x6')];var logger=require(_0xcf54('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcf54('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcf54('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x39686c,_0x4cde52){var _0x2f456d={'status':_0x39686c};var _0x409dee={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4cde52){_0x2f456d[_0xcf54('0x9')]=_0x4cde52;}return db['AnalyticExtractedReport'][_0xcf54('0xa')](_0x2f456d,_0x409dee);}function main(){var _0x1a2df6=0x1388;var _0x530548;logger['info'](util[_0xcf54('0xb')](_0xcf54('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xcf54('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcf54('0xe'),_0xcf54('0xf')]})[_0xcf54('0x10')](function(_0x512362){if(_0x512362){_0x530548=_0x512362;_0x1a2df6=_0x530548['splitSizeCsv']||0x1388;}})[_0xcf54('0x10')](function(){return dbH[_0xcf54('0x11')][_0xcf54('0x12')](util[_0xcf54('0xb')](_0xcf54('0x13'),QUERY),{'type':dbH['sequelize'][_0xcf54('0x14')]['SELECT']});})['then'](function(_0x176eef){if(!_0x176eef[0x0][_0xcf54('0x15')]){return analyticExtractedReport(_0xcf54('0x16'));}var _0x5d7233=[];var _0x4cabf9=0x0;if(_0x530548[_0xcf54('0xe')]){if(_0x176eef&&_0x176eef[_0xcf54('0x17')]){var _0x20663c=_['range'](_0x176eef[0x0][_0xcf54('0x15')]/_0x1a2df6);var _0x3b3286=Number['isInteger'](_0x176eef[0x0][_0xcf54('0x15')]/_0x1a2df6)?_0x176eef[0x0][_0xcf54('0x15')]%_0x1a2df6:0x0;_0x20663c[_0xcf54('0x18')](function(_0xbfa22){if(_0xbfa22>0x0){_0x4cabf9+=_0x1a2df6;}_0x5d7233[_0xcf54('0x19')](dbH[_0xcf54('0x11')][_0xcf54('0x12')](util[_0xcf54('0xb')](_0xcf54('0x1a'),QUERY,_0x1a2df6,_0x4cabf9),{'type':dbH[_0xcf54('0x11')]['QueryTypes'][_0xcf54('0x1b')]}));});if(_0x3b3286>0x0){_0x4cabf9+=_0x1a2df6;_0x5d7233[_0xcf54('0x19')](dbH[_0xcf54('0x11')][_0xcf54('0x12')](util[_0xcf54('0xb')](_0xcf54('0x1a'),QUERY,_0x3b3286,_0x4cabf9),{'type':dbH[_0xcf54('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x5d7233[_0xcf54('0x19')](dbH[_0xcf54('0x11')][_0xcf54('0x12')](QUERY,{'type':dbH['sequelize'][_0xcf54('0x14')][_0xcf54('0x1b')]}));}var _0x1585d4=path['dirname'](PATH);var _0x153fa7=path[_0xcf54('0x1c')](PATH,_0xcf54('0x1d'));var _0x174692=_0x530548[_0xcf54('0xe')]&&_0x5d7233[_0xcf54('0x17')]>0x1;var _0x59b2ac=[];if(!fs[_0xcf54('0x1e')](path['join'](_0x1585d4,_0x153fa7))&&_0x174692){fs[_0xcf54('0x1f')](path['join'](_0x1585d4,_0x153fa7));}return BPromise[_0xcf54('0x20')](_0x5d7233,function(_0x13432e){_0x59b2ac[_0xcf54('0x19')](_0x13432e);})[_0xcf54('0x10')](function(){for(var _0x1bc813=0x0;_0x1bc813<_0x59b2ac[_0xcf54('0x17')];_0x1bc813+=0x1){var _0x3d710e;var _0x209f86=_0x59b2ac[_0x1bc813];if(_0x174692){_0x3d710e=path[_0xcf54('0x21')](_0x1585d4,_0x153fa7,util['format']('%s%d.%s',_0x153fa7,_0x1bc813,_0xcf54('0x22')));}else{_0x3d710e=path[_0xcf54('0x21')](_0x1585d4,util['format'](_0xcf54('0x23'),_0x153fa7,_0xcf54('0x22')));}fs[_0xcf54('0x24')](_0x3d710e,csv(_0x209f86));}})[_0xcf54('0x10')](function(){if(_0x174692){return new Promise(function(_0xbb8d87){zipdir(path[_0xcf54('0x21')](_0x1585d4,_0x153fa7),{'saveTo':path[_0xcf54('0x21')](_0x1585d4,util['format'](_0xcf54('0x23'),_0x153fa7,_0xcf54('0x25')))},function(_0x1888a5,_0x1ea7b){rimraf(path['join'](_0x1585d4,_0x153fa7),function(){});_0xbb8d87(_0xcf54('0x26'));});});}})[_0xcf54('0x10')](function(){logger['info'](util['format'](_0xcf54('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x174692?util[_0xcf54('0xb')]('%s.%s',_0x153fa7,_0x174692?_0xcf54('0x25'):_0xcf54('0x22')):null);});})[_0xcf54('0x28')](function(_0x214f1c){logger[_0xcf54('0x29')](util['format'](_0xcf54('0x2a'),EXTRACTED_REPORT_ID,_0xcf54('0x2b')),util[_0xcf54('0x2c')](_0x214f1c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcf54('0x2d'));})[_0xcf54('0x2e')](function(){process[_0xcf54('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f2b778e..7cb8b94 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 _0x1c97=['toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','name','startDate','header','pageBreak','before','landscape','\x20/\x20','footer','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','map'];(function(_0x9f765a,_0x261519){var _0x446c48=function(_0x37a704){while(--_0x37a704){_0x9f765a['push'](_0x9f765a['shift']());}};_0x446c48(++_0x261519);}(_0x1c97,0xf7));var _0x71c9=function(_0x5d4456,_0xcb41c7){_0x5d4456=_0x5d4456-0x0;var _0x42b124=_0x1c97[_0x5d4456];return _0x42b124;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x71c9('0x0'));var path=require(_0x71c9('0x1'));var moment=require(_0x71c9('0x2'));var htmlToPdfmake=require(_0x71c9('0x3'));var PdfPrinter=require(_0x71c9('0x4'));var zipdir=require(_0x71c9('0x5'));var rimraf=require(_0x71c9('0x6'));var JSDOM=require(_0x71c9('0x7'))[_0x71c9('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x71c9('0x9'));var db=require(_0x71c9('0xa'))['db'];var dbH=require('../../mysqldb')[_0x71c9('0xb')];var logger=require(_0x71c9('0xc'))(_0x71c9('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x71c9('0xe')][0x2]);var QUERY=process[_0x71c9('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ac053,_0x548680){var _0x54a9f0={'status':_0x5ac053};var _0x2e8fee={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x548680){_0x54a9f0['savename']=_0x548680;}return db[_0x71c9('0xf')]['update'](_0x54a9f0,_0x2e8fee);}function getHeaders(_0xbc5af1){return _[_0x71c9('0x10')](_0xbc5af1,function(_0x4cf44c){return{'text':_0x4cf44c,'style':'tableHeader'};});}function getRows(_0xb32565,_0x207665){return _[_0x71c9('0x10')](_0x207665,function(_0x1aa9de){return _(_0x1aa9de)['pick'](_0xb32565)[_0x71c9('0x10')](function(_0x123685){return _0x123685?_[_0x71c9('0x11')](_0x123685):'';})[_0x71c9('0x12')]();});}function createTable(_0x2a9066,_0x287a50){var _0x44abdf={'widths':_[_0x71c9('0x13')](Array(_0x2a9066[_0x71c9('0x14')]),0x91),'heights':function(_0x473520){return _0x473520===0x0?_0x71c9('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5375f6=getHeaders(_0x2a9066);_0x44abdf['body'][_0x71c9('0x16')](_0x5375f6);var _0xe50478=getRows(_0x2a9066,_0x287a50);_0x44abdf[_0x71c9('0x17')]=_0x44abdf[_0x71c9('0x17')][_0x71c9('0x18')](_0xe50478);return _0x44abdf;}function createTables(_0x3aadbe){var _0x2749e6=[];var _0x20d095=_[_0x71c9('0x19')](Object[_0x71c9('0x1a')](_0x3aadbe[0x0]),0x5);_0x20d095[_0x71c9('0x1b')](function(_0x1ca4e5){_0x2749e6[_0x71c9('0x16')](createTable(_0x1ca4e5,_0x3aadbe));});return _0x2749e6;}function getPDFDocDefinition(_0x115eec){var _0xcfc26c=util[_0x71c9('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x71c9('0x1d')],moment(EXTRACTED_REPORT[_0x71c9('0x1e')])[_0x71c9('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x33cdfd=[];for(var _0x16e7ef=0x0;_0x16e7ef<_0x115eec[_0x71c9('0x14')];_0x16e7ef++){var _0x58a4cd=[];if(_0x16e7ef===0x0){_0x58a4cd[_0x71c9('0x16')]({'text':_0xcfc26c,'style':_0x71c9('0x1f')});}var _0x25b00c={'table':_0x115eec[_0x16e7ef]};if(_0x16e7ef>0x0){_0x25b00c[_0x71c9('0x20')]=_0x71c9('0x21');_0x25b00c['margin']=[0x0,0x46,0x0,0x0];}_0x58a4cd[_0x71c9('0x16')](_0x25b00c);_0x33cdfd[_0x71c9('0x16')](_0x58a4cd);}return{'pageSize':'A4','pageOrientation':_0x71c9('0x22'),'content':_0x33cdfd,'footer':function(_0x229921,_0x236767){return{'text':_0x229921[_0x71c9('0x11')]()+_0x71c9('0x23')+_0x236767,'style':_0x71c9('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x71c9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1e4350){var _0x1f3d8e=0x1388;var _0x3cc8e3;if(!_0x1e4350[0x0][_0x71c9('0x26')]){return analyticExtractedReport(_0x71c9('0x27'));}return db[_0x71c9('0x28')][_0x71c9('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x71c9('0x2a'),_0x71c9('0x2b')]})['then'](function(_0x1f2a10){if(_0x1f2a10){_0x3cc8e3=_0x1f2a10;_0x1f3d8e=_0x3cc8e3['splitSizePdf']||0x3e8;}})[_0x71c9('0x2c')](function(){var _0x4452fb=[];var _0x4a0276=0x0;if(_0x3cc8e3['split']){if(_0x1e4350&&_0x1e4350['length']){var _0x201711=_[_0x71c9('0x2d')](_0x1e4350[0x0]['num']/_0x1f3d8e);var _0x41dbf3=Number[_0x71c9('0x2e')](_0x1e4350[0x0][_0x71c9('0x26')]/_0x1f3d8e)?_0x1e4350[0x0][_0x71c9('0x26')]%_0x1f3d8e:0x0;_0x201711[_0x71c9('0x1b')](function(_0x17fc6e){if(_0x17fc6e>0x0){_0x4a0276+=_0x1f3d8e;}_0x4452fb['push'](dbH[_0x71c9('0x2f')][_0x71c9('0x30')](util['format'](_0x71c9('0x31'),QUERY,_0x1f3d8e,_0x4a0276),{'type':dbH[_0x71c9('0x2f')][_0x71c9('0x32')][_0x71c9('0x33')]}));});if(_0x41dbf3>0x0){_0x4a0276+=_0x1f3d8e;_0x4452fb[_0x71c9('0x16')](dbH[_0x71c9('0x2f')][_0x71c9('0x30')](util[_0x71c9('0x1c')](_0x71c9('0x31'),QUERY,_0x41dbf3,_0x4a0276),{'type':dbH[_0x71c9('0x2f')][_0x71c9('0x32')][_0x71c9('0x33')]}));}}}else{_0x4452fb[_0x71c9('0x16')](dbH[_0x71c9('0x2f')][_0x71c9('0x30')](QUERY,{'type':dbH[_0x71c9('0x2f')][_0x71c9('0x32')]['SELECT']}));}var _0x49c371=path[_0x71c9('0x34')](PATH);var _0xd6f568=path[_0x71c9('0x35')](PATH,_0x71c9('0x36'));var _0x443b79=_0x3cc8e3[_0x71c9('0x2a')]&&_0x4452fb['length']>0x1;var _0x45577c=[];if(!fs[_0x71c9('0x37')](path[_0x71c9('0x38')](_0x49c371,_0xd6f568))&&_0x443b79){fs[_0x71c9('0x39')](path[_0x71c9('0x38')](_0x49c371,_0xd6f568));}return BPromise[_0x71c9('0x3a')](_0x4452fb,function(_0x3fba7c){_0x45577c[_0x71c9('0x16')](_0x3fba7c);})[_0x71c9('0x2c')](function(){var _0x15e112=[];for(var _0x2657d3=0x0;_0x2657d3<_0x45577c[_0x71c9('0x14')];_0x2657d3+=0x1){var _0x174901=_0x45577c[_0x2657d3];var _0x302f26=createTables(_[_0x71c9('0x3b')](_0x174901));var _0x1d23e8;var _0x117fdc=getPDFDocDefinition(_0x302f26);var _0x18a91a=getPDFPrinter();var _0x4b3f02=_0x18a91a[_0x71c9('0x3c')](_0x117fdc);if(_0x443b79){_0x1d23e8=path[_0x71c9('0x38')](_0x49c371,_0xd6f568,util['format'](_0x71c9('0x3d'),_0xd6f568,_0x2657d3,_0x71c9('0x3e')));}else{_0x1d23e8=path['join'](_0x49c371,util['format'](_0x71c9('0x3f'),_0xd6f568,_0x71c9('0x3e')));}_0x15e112['push'](writePDFDocument(_0x4b3f02,_0x1d23e8));}return Promise['all'](_0x15e112);})[_0x71c9('0x2c')](function(){if(_0x443b79){return new Promise(function(_0x249dd2){zipdir(path[_0x71c9('0x38')](_0x49c371,_0xd6f568),{'saveTo':path[_0x71c9('0x38')](_0x49c371,util[_0x71c9('0x1c')](_0x71c9('0x3f'),_0xd6f568,_0x71c9('0x40')))},function(){rimraf(path[_0x71c9('0x38')](_0x49c371,_0xd6f568),function(){});_0x249dd2(_0x71c9('0x41'));});});}})['then'](function(){if(!_0x443b79)return;rimraf(path['join'](_0x49c371,_0xd6f568),function(){});})['then'](function(){logger[_0x71c9('0x42')](util['format'](_0x71c9('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x71c9('0x44'),_0x443b79?util[_0x71c9('0x1c')]('%s.%s',_0xd6f568,_0x443b79?_0x71c9('0x40'):_0x71c9('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x71c9('0x42')](util[_0x71c9('0x1c')](_0x71c9('0x45'),EXTRACTED_REPORT_ID,_0x71c9('0x46')));return db[_0x71c9('0xf')][_0x71c9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x71c9('0x2c')](function(_0x3d3bdf){EXTRACTED_REPORT=_0x3d3bdf;return dbH['sequelize']['query'](util[_0x71c9('0x1c')](_0x71c9('0x48'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x71c9('0x33')]});})[_0x71c9('0x2c')](extractReport)[_0x71c9('0x49')](function(_0x412609){logger['info'](util[_0x71c9('0x1c')](_0x71c9('0x4a'),EXTRACTED_REPORT_ID,_0x71c9('0x46')),util['inspect'](_0x412609,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x71c9('0x4b'));})['finally'](function(){process[_0x71c9('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x497710=new PdfPrinter({'Arial':{'normal':__dirname+_0x71c9('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x71c9('0x4e')}});return _0x497710;}function getPDFDocDefinitionFromHTML(_0x74f22f,_0xfd711){var _0x4a5ef0=util[_0x71c9('0x1c')](_0x71c9('0x4f'),_0xfd711[_0x71c9('0x50')],_0xfd711['interactionId']);var _0xfacece=moment()['format'](_0x71c9('0x51'))['toString']();var _0x54775e=htmlToPdfmake(_0x74f22f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x54775e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x71c9('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x71c9('0x52')}},'header':function(){return[{'text':_0x71c9('0x53'),'style':_0x71c9('0x1f')}];},'footer':function(_0x16a956,_0x1d884b){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4a5ef0,_0x16a956,_0x1d884b,_0xfacece),'style':_0x71c9('0x24')}];}};}function writePDFDocument(_0x3d8c3f,_0x3892b6){return new Promise(function(_0x83b37e,_0x33c044){var _0xec7e6d=_0x3d8c3f['pipe'](fs[_0x71c9('0x54')](_0x3892b6));_0xec7e6d['on'](_0x71c9('0x55'),function(){_0x83b37e(_0x71c9('0x55'));});_0xec7e6d['on']('error',function(_0x5532a2){_0x33c044(_0x5532a2);});_0x3d8c3f[_0x71c9('0x56')]();});}exports[_0x71c9('0x57')]=function(_0x5393d3,_0x86d9d6){var _0x4466bb=getPDFPrinter();var _0x86a0e1=getPDFDocDefinitionFromHTML(_0x5393d3,_0x86d9d6);var _0x1f025b=_0x4466bb[_0x71c9('0x3c')](_0x86a0e1);return writePDFDocument(_0x1f025b,_0x86d9d6[_0x71c9('0x1')])[_0x71c9('0x49')](function(_0x4d04a4){throw _0x4d04a4;});}; \ No newline at end of file +var _0xee13=['pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','flatten','join','pdf','%s.%s','all','zip\x20finished','info','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','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','error','end','createPdfFromHTML','createPdfKitDocument','util','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','auto','push','body','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','length','header'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xee13,0x14c));var _0x3ee1=function(_0x30a239,_0x166cdd){_0x30a239=_0x30a239-0x0;var _0x50ed45=_0xee13[_0x30a239];return _0x50ed45;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x3ee1('0x0'));var path=require(_0x3ee1('0x1'));var moment=require(_0x3ee1('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x3ee1('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x3ee1('0x4'));var JSDOM=require(_0x3ee1('0x5'))[_0x3ee1('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x3ee1('0x7'));var db=require(_0x3ee1('0x8'))['db'];var dbH=require(_0x3ee1('0x8'))['dbH'];var logger=require(_0x3ee1('0x9'))(_0x3ee1('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x3ee1('0xb')][0x2]);var QUERY=process[_0x3ee1('0xb')][0x3];var PATH=process[_0x3ee1('0xb')][0x4];var NAME=process[_0x3ee1('0xb')][0x5];var FORMAT=_0x3ee1('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c55c5,_0xbc1e93){var _0x338ac4={'status':_0x1c55c5};var _0x51486b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbc1e93){_0x338ac4[_0x3ee1('0xd')]=_0xbc1e93;}return db[_0x3ee1('0xe')][_0x3ee1('0xf')](_0x338ac4,_0x51486b);}function getHeaders(_0x450f94){return _[_0x3ee1('0x10')](_0x450f94,function(_0xb2f5bf){return{'text':_0xb2f5bf,'style':'tableHeader'};});}function getRows(_0x268a60,_0x2ae1ef){return _[_0x3ee1('0x10')](_0x2ae1ef,function(_0x29bcb5){return _(_0x29bcb5)[_0x3ee1('0x11')](_0x268a60)[_0x3ee1('0x10')](function(_0x53e3fe){return _0x53e3fe?_[_0x3ee1('0x12')](_0x53e3fe):'';})['value']();});}function createTable(_0x3d3c9a,_0x586799){var _0x77e042={'widths':_[_0x3ee1('0x13')](Array(_0x3d3c9a['length']),0x91),'heights':function(_0x275d88){return _0x275d88===0x0?_0x3ee1('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5743bc=getHeaders(_0x3d3c9a);_0x77e042['body'][_0x3ee1('0x15')](_0x5743bc);var _0x3e2b9b=getRows(_0x3d3c9a,_0x586799);_0x77e042[_0x3ee1('0x16')]=_0x77e042[_0x3ee1('0x16')][_0x3ee1('0x17')](_0x3e2b9b);return _0x77e042;}function createTables(_0x11a6ea){var _0x3fcf93=[];var _0x11f8f2=_[_0x3ee1('0x18')](Object['keys'](_0x11a6ea[0x0]),0x5);_0x11f8f2[_0x3ee1('0x19')](function(_0x39c377){_0x3fcf93[_0x3ee1('0x15')](createTable(_0x39c377,_0x11a6ea));});return _0x3fcf93;}function getPDFDocDefinition(_0x3b4c0f){var _0x1c77bf=util['format'](_0x3ee1('0x1a'),NAME,EXTRACTED_REPORT[_0x3ee1('0x1b')],moment(EXTRACTED_REPORT[_0x3ee1('0x1c')])[_0x3ee1('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3ee1('0x1d')](FORMAT));var _0xaab674=[];for(var _0x225bc1=0x0;_0x225bc1<_0x3b4c0f[_0x3ee1('0x1e')];_0x225bc1++){var _0x225fd5=[];if(_0x225bc1===0x0){_0x225fd5[_0x3ee1('0x15')]({'text':_0x1c77bf,'style':_0x3ee1('0x1f')});}var _0x2c29b1={'table':_0x3b4c0f[_0x225bc1]};if(_0x225bc1>0x0){_0x2c29b1[_0x3ee1('0x20')]=_0x3ee1('0x21');_0x2c29b1[_0x3ee1('0x22')]=[0x0,0x46,0x0,0x0];}_0x225fd5['push'](_0x2c29b1);_0xaab674[_0x3ee1('0x15')](_0x225fd5);}return{'pageSize':'A4','pageOrientation':_0x3ee1('0x23'),'content':_0xaab674,'footer':function(_0xdda56c,_0x397837){return{'text':_0xdda56c[_0x3ee1('0x12')]()+_0x3ee1('0x24')+_0x397837,'style':_0x3ee1('0x25')};},'defaultStyle':{'font':_0x3ee1('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3ee1('0x27')},'footer':{'alignment':_0x3ee1('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x358240){var _0x1e5cbf=0x1388;var _0x28d9f4;if(!_0x358240[0x0][_0x3ee1('0x29')]){return analyticExtractedReport(_0x3ee1('0x2a'));}return db[_0x3ee1('0x2b')][_0x3ee1('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3ee1('0x2d'),'splitSizePdf']})[_0x3ee1('0x2e')](function(_0x1f69c5){if(_0x1f69c5){_0x28d9f4=_0x1f69c5;_0x1e5cbf=_0x28d9f4['splitSizePdf']||0x3e8;}})['then'](function(){var _0x4bb784=[];var _0x3e58bc=0x0;if(_0x28d9f4[_0x3ee1('0x2d')]){if(_0x358240&&_0x358240['length']){var _0x4562b7=_[_0x3ee1('0x2f')](_0x358240[0x0][_0x3ee1('0x29')]/_0x1e5cbf);var _0x3178ec=Number[_0x3ee1('0x30')](_0x358240[0x0]['num']/_0x1e5cbf)?_0x358240[0x0]['num']%_0x1e5cbf:0x0;_0x4562b7[_0x3ee1('0x19')](function(_0x2c18cc){if(_0x2c18cc>0x0){_0x3e58bc+=_0x1e5cbf;}_0x4bb784[_0x3ee1('0x15')](dbH[_0x3ee1('0x31')][_0x3ee1('0x32')](util[_0x3ee1('0x1d')](_0x3ee1('0x33'),QUERY,_0x1e5cbf,_0x3e58bc),{'type':dbH['sequelize'][_0x3ee1('0x34')][_0x3ee1('0x35')]}));});if(_0x3178ec>0x0){_0x3e58bc+=_0x1e5cbf;_0x4bb784[_0x3ee1('0x15')](dbH[_0x3ee1('0x31')][_0x3ee1('0x32')](util[_0x3ee1('0x1d')](_0x3ee1('0x33'),QUERY,_0x3178ec,_0x3e58bc),{'type':dbH[_0x3ee1('0x31')][_0x3ee1('0x34')][_0x3ee1('0x35')]}));}}}else{_0x4bb784['push'](dbH[_0x3ee1('0x31')][_0x3ee1('0x32')](QUERY,{'type':dbH[_0x3ee1('0x31')][_0x3ee1('0x34')]['SELECT']}));}var _0x208b9b=path['dirname'](PATH);var _0x50fafa=path[_0x3ee1('0x36')](PATH,_0x3ee1('0x37'));var _0xa9a8cf=_0x28d9f4[_0x3ee1('0x2d')]&&_0x4bb784[_0x3ee1('0x1e')]>0x1;var _0x1bf920=[];if(!fs[_0x3ee1('0x38')](path['join'](_0x208b9b,_0x50fafa))&&_0xa9a8cf){fs['mkdirSync'](path['join'](_0x208b9b,_0x50fafa));}return BPromise['each'](_0x4bb784,function(_0x52d3b2){_0x1bf920[_0x3ee1('0x15')](_0x52d3b2);})[_0x3ee1('0x2e')](function(){var _0x50a0ac=[];for(var _0xc6e1ad=0x0;_0xc6e1ad<_0x1bf920[_0x3ee1('0x1e')];_0xc6e1ad+=0x1){var _0x1b7895=_0x1bf920[_0xc6e1ad];var _0x249cff=createTables(_[_0x3ee1('0x39')](_0x1b7895));var _0x11bf84;var _0x598bc8=getPDFDocDefinition(_0x249cff);var _0x246d39=getPDFPrinter();var _0x41ba0e=_0x246d39['createPdfKitDocument'](_0x598bc8);if(_0xa9a8cf){_0x11bf84=path[_0x3ee1('0x3a')](_0x208b9b,_0x50fafa,util[_0x3ee1('0x1d')]('%s%d.%s',_0x50fafa,_0xc6e1ad,_0x3ee1('0x3b')));}else{_0x11bf84=path[_0x3ee1('0x3a')](_0x208b9b,util[_0x3ee1('0x1d')](_0x3ee1('0x3c'),_0x50fafa,_0x3ee1('0x3b')));}_0x50a0ac[_0x3ee1('0x15')](writePDFDocument(_0x41ba0e,_0x11bf84));}return Promise[_0x3ee1('0x3d')](_0x50a0ac);})[_0x3ee1('0x2e')](function(){if(_0xa9a8cf){return new Promise(function(_0x2b0911){zipdir(path[_0x3ee1('0x3a')](_0x208b9b,_0x50fafa),{'saveTo':path[_0x3ee1('0x3a')](_0x208b9b,util['format'](_0x3ee1('0x3c'),_0x50fafa,'zip'))},function(){rimraf(path[_0x3ee1('0x3a')](_0x208b9b,_0x50fafa),function(){});_0x2b0911(_0x3ee1('0x3e'));});});}})[_0x3ee1('0x2e')](function(){if(!_0xa9a8cf)return;rimraf(path['join'](_0x208b9b,_0x50fafa),function(){});})[_0x3ee1('0x2e')](function(){logger[_0x3ee1('0x3f')](util[_0x3ee1('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3ee1('0x40')));return analyticExtractedReport('Completed',_0xa9a8cf?util[_0x3ee1('0x1d')](_0x3ee1('0x3c'),_0x50fafa,_0xa9a8cf?_0x3ee1('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3ee1('0x3f')](util[_0x3ee1('0x1d')](_0x3ee1('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x3ee1('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3ee1('0x2e')](function(_0x5aaec1){EXTRACTED_REPORT=_0x5aaec1;return dbH['sequelize'][_0x3ee1('0x32')](util['format'](_0x3ee1('0x44'),QUERY),{'type':dbH[_0x3ee1('0x31')]['QueryTypes'][_0x3ee1('0x35')]});})['then'](extractReport)[_0x3ee1('0x45')](function(_0x13a4ac){logger['info'](util[_0x3ee1('0x1d')](_0x3ee1('0x46'),EXTRACTED_REPORT_ID,_0x3ee1('0x40')),util[_0x3ee1('0x47')](_0x13a4ac,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3ee1('0x48'));})[_0x3ee1('0x49')](function(){process[_0x3ee1('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x23c30f=new PdfPrinter({'Arial':{'normal':__dirname+_0x3ee1('0x4b'),'bold':__dirname+_0x3ee1('0x4c'),'italics':__dirname+_0x3ee1('0x4d'),'bolditalics':__dirname+_0x3ee1('0x4e')}});return _0x23c30f;}function getPDFDocDefinitionFromHTML(_0x1590db,_0x5daa0e){var _0x35cddb=util[_0x3ee1('0x1d')](_0x3ee1('0x4f'),_0x5daa0e['channel'],_0x5daa0e[_0x3ee1('0x50')]);var _0x3d6cd6=moment()[_0x3ee1('0x1d')](_0x3ee1('0x51'))[_0x3ee1('0x12')]();var _0x4976e9=htmlToPdfmake(_0x1590db,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4976e9],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3ee1('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3ee1('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3ee1('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x3ee1('0x1f')}];},'footer':function(_0x3d4ef4,_0x1a1f15){return[{'text':util['format'](_0x3ee1('0x53'),_0x35cddb,_0x3d4ef4,_0x1a1f15,_0x3d6cd6),'style':'footer'}];}};}function writePDFDocument(_0x510ce4,_0x2ba9b2){return new Promise(function(_0x440615,_0x929809){var _0x3d2aa0=_0x510ce4[_0x3ee1('0x54')](fs[_0x3ee1('0x55')](_0x2ba9b2));_0x3d2aa0['on'](_0x3ee1('0x56'),function(){_0x440615(_0x3ee1('0x56'));});_0x3d2aa0['on'](_0x3ee1('0x57'),function(_0x5f2e16){_0x929809(_0x5f2e16);});_0x510ce4[_0x3ee1('0x58')]();});}exports[_0x3ee1('0x59')]=function(_0x556dbc,_0x5b536b){var _0x28046d=getPDFPrinter();var _0x1603ca=getPDFDocDefinitionFromHTML(_0x556dbc,_0x5b536b);var _0x1c15a3=_0x28046d[_0x3ee1('0x5a')](_0x1603ca);return writePDFDocument(_0x1c15a3,_0x5b536b[_0x3ee1('0x1')])[_0x3ee1('0x45')](function(_0x3feac5){throw _0x3feac5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 19cbc36..88db8ac 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 _0xd674=['SELECT','num','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','each','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x194b25,_0x4bedc4){var _0x107ac5=function(_0x13bcce){while(--_0x13bcce){_0x194b25['push'](_0x194b25['shift']());}};_0x107ac5(++_0x4bedc4);}(_0xd674,0xb9));var _0x4d67=function(_0x4ca9aa,_0x3c3540){_0x4ca9aa=_0x4ca9aa-0x0;var _0x3d04d6=_0xd674[_0x4ca9aa];return _0x3d04d6;};'use strict';var util=require(_0x4d67('0x0'));var path=require(_0x4d67('0x1'));var _=require(_0x4d67('0x2'));var fs=require('fs');var json2xls=require(_0x4d67('0x3'));var BPromise=require(_0x4d67('0x4'));var zipdir=require(_0x4d67('0x5'));var rimraf=require(_0x4d67('0x6'));var db=require(_0x4d67('0x7'))['db'];var dbH=require(_0x4d67('0x7'))[_0x4d67('0x8')];var logger=require(_0x4d67('0x9'))(_0x4d67('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4d67('0xb')][0x2]);var QUERY=process[_0x4d67('0xb')][0x3];var PATH=process[_0x4d67('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cc1d0,_0x484baa){var _0x4a21b6={'status':_0x5cc1d0};var _0x9ccd71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x484baa){_0x4a21b6[_0x4d67('0xc')]=_0x484baa;}return db[_0x4d67('0xd')][_0x4d67('0xe')](_0x4a21b6,_0x9ccd71);}function main(){var _0x15f9b8=0x1388;var _0xf77a04;logger[_0x4d67('0xf')](util['format'](_0x4d67('0x10'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return db[_0x4d67('0x12')][_0x4d67('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4d67('0x14'),'splitSizeXlsx']})[_0x4d67('0x15')](function(_0x41bf2a){if(_0x41bf2a){_0xf77a04=_0x41bf2a;_0x15f9b8=_0xf77a04[_0x4d67('0x16')]||0x1388;}})['then'](function(){return dbH[_0x4d67('0x17')]['query'](util[_0x4d67('0x18')](_0x4d67('0x19'),QUERY),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')][_0x4d67('0x1b')]});})['then'](function(_0xcabb9b){if(!_0xcabb9b[0x0][_0x4d67('0x1c')]){return analyticExtractedReport('Empty');}var _0x35f177=[];var _0x1deca8=0x0;if(_0xf77a04[_0x4d67('0x14')]){if(_0xcabb9b&&_0xcabb9b[_0x4d67('0x1d')]){var _0x1be977=_[_0x4d67('0x1e')](_0xcabb9b[0x0][_0x4d67('0x1c')]/_0x15f9b8);var _0x2369a0=Number[_0x4d67('0x1f')](_0xcabb9b[0x0]['num']/_0x15f9b8)?_0xcabb9b[0x0]['num']%_0x15f9b8:0x0;_0x1be977[_0x4d67('0x20')](function(_0x400de1){if(_0x400de1>0x0){_0x1deca8+=_0x15f9b8;}_0x35f177['push'](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util[_0x4d67('0x18')](_0x4d67('0x22'),QUERY,_0x15f9b8,_0x1deca8),{'type':dbH[_0x4d67('0x17')]['QueryTypes'][_0x4d67('0x1b')]}));});if(_0x2369a0>0x0){_0x1deca8+=_0x15f9b8;_0x35f177[_0x4d67('0x23')](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util['format'](_0x4d67('0x22'),QUERY,_0x2369a0,_0x1deca8),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')]['SELECT']}));}}}else{_0x35f177[_0x4d67('0x23')](dbH['sequelize'][_0x4d67('0x21')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x4d67('0x1b')]}));}var _0x25c5ca=path[_0x4d67('0x24')](PATH);var _0x36f3cc=path[_0x4d67('0x25')](PATH,_0x4d67('0x26'));var _0x338e9e=_0xf77a04['split']&&_0x35f177[_0x4d67('0x1d')]>0x1;var _0x328396=[];if(!fs['existsSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc))&&_0x338e9e){fs['mkdirSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc));}return BPromise[_0x4d67('0x28')](_0x35f177,function(_0x1e0cf1){_0x328396[_0x4d67('0x23')](_0x1e0cf1);})['then'](function(){for(var _0x1b7c37=0x0;_0x1b7c37<_0x328396[_0x4d67('0x1d')];_0x1b7c37+=0x1){var _0x439360;var _0x2bac9d=_0x328396[_0x1b7c37];if(_0x338e9e){_0x439360=path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc,util[_0x4d67('0x18')]('%s%d.%s',_0x36f3cc,_0x1b7c37,_0x4d67('0x29')));}else{_0x439360=path['join'](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x4d67('0x29')));}fs['writeFileSync'](_0x439360,json2xls(_0x2bac9d),_0x4d67('0x2b'));}})['then'](function(){if(_0x338e9e){return new Promise(function(_0x55ce8f){zipdir(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),{'saveTo':path[_0x4d67('0x27')](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,'zip'))},function(_0x15c39c,_0x50b688){rimraf(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),function(){});_0x55ce8f(_0x4d67('0x2c'));});});}})['then'](function(){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x2d'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return analyticExtractedReport(_0x4d67('0x2e'),_0x338e9e?util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x338e9e?_0x4d67('0x2f'):_0x4d67('0x29')):null);});})[_0x4d67('0x30')](function(_0x182a85){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x31'),EXTRACTED_REPORT_ID,_0x4d67('0x11')),util[_0x4d67('0x32')](_0x182a85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4d67('0x33')](function(){process[_0x4d67('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1677=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport'];(function(_0x20990f,_0x3d14e5){var _0x5eb143=function(_0x1a578d){while(--_0x1a578d){_0x20990f['push'](_0x20990f['shift']());}};_0x5eb143(++_0x3d14e5);}(_0x1677,0x18f));var _0x7167=function(_0x17f671,_0x3e3865){_0x17f671=_0x17f671-0x0;var _0x34673c=_0x1677[_0x17f671];return _0x34673c;};'use strict';var util=require('util');var path=require(_0x7167('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x7167('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x7167('0x2'));var rimraf=require(_0x7167('0x3'));var db=require(_0x7167('0x4'))['db'];var dbH=require(_0x7167('0x4'))[_0x7167('0x5')];var logger=require('../../config/logger')(_0x7167('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7167('0x7')][0x3];var PATH=process[_0x7167('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x564d64,_0x5887de){var _0x1e3bc6={'status':_0x564d64};var _0x7f6d4d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5887de){_0x1e3bc6['savename']=_0x5887de;}return db[_0x7167('0x8')][_0x7167('0x9')](_0x1e3bc6,_0x7f6d4d);}function main(){var _0x504dd7=0x1388;var _0x47c35a;logger[_0x7167('0xa')](util[_0x7167('0xb')](_0x7167('0xc'),EXTRACTED_REPORT_ID,_0x7167('0xd')));return db[_0x7167('0xe')][_0x7167('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7167('0x10'),_0x7167('0x11')]})[_0x7167('0x12')](function(_0x9df74f){if(_0x9df74f){_0x47c35a=_0x9df74f;_0x504dd7=_0x47c35a[_0x7167('0x11')]||0x1388;}})[_0x7167('0x12')](function(){return dbH[_0x7167('0x13')]['query'](util[_0x7167('0xb')](_0x7167('0x14'),QUERY),{'type':dbH['sequelize'][_0x7167('0x15')][_0x7167('0x16')]});})[_0x7167('0x12')](function(_0x309cb5){if(!_0x309cb5[0x0][_0x7167('0x17')]){return analyticExtractedReport(_0x7167('0x18'));}var _0xfc248a=[];var _0x1aa38c=0x0;if(_0x47c35a[_0x7167('0x10')]){if(_0x309cb5&&_0x309cb5[_0x7167('0x19')]){var _0x56b101=_[_0x7167('0x1a')](_0x309cb5[0x0][_0x7167('0x17')]/_0x504dd7);var _0x31f2a6=Number[_0x7167('0x1b')](_0x309cb5[0x0][_0x7167('0x17')]/_0x504dd7)?_0x309cb5[0x0]['num']%_0x504dd7:0x0;_0x56b101[_0x7167('0x1c')](function(_0x1a4258){if(_0x1a4258>0x0){_0x1aa38c+=_0x504dd7;}_0xfc248a[_0x7167('0x1d')](dbH[_0x7167('0x13')][_0x7167('0x1e')](util[_0x7167('0xb')](_0x7167('0x1f'),QUERY,_0x504dd7,_0x1aa38c),{'type':dbH[_0x7167('0x13')]['QueryTypes'][_0x7167('0x16')]}));});if(_0x31f2a6>0x0){_0x1aa38c+=_0x504dd7;_0xfc248a[_0x7167('0x1d')](dbH[_0x7167('0x13')]['query'](util[_0x7167('0xb')](_0x7167('0x1f'),QUERY,_0x31f2a6,_0x1aa38c),{'type':dbH[_0x7167('0x13')]['QueryTypes'][_0x7167('0x16')]}));}}}else{_0xfc248a['push'](dbH[_0x7167('0x13')][_0x7167('0x1e')](QUERY,{'type':dbH[_0x7167('0x13')][_0x7167('0x15')][_0x7167('0x16')]}));}var _0x3b5014=path[_0x7167('0x20')](PATH);var _0x42739c=path['basename'](PATH,_0x7167('0x21'));var _0x176f73=_0x47c35a[_0x7167('0x10')]&&_0xfc248a[_0x7167('0x19')]>0x1;var _0x348f88=[];if(!fs[_0x7167('0x22')](path['join'](_0x3b5014,_0x42739c))&&_0x176f73){fs[_0x7167('0x23')](path[_0x7167('0x24')](_0x3b5014,_0x42739c));}return BPromise[_0x7167('0x25')](_0xfc248a,function(_0x255b78){_0x348f88[_0x7167('0x1d')](_0x255b78);})[_0x7167('0x12')](function(){for(var _0x4ed601=0x0;_0x4ed601<_0x348f88[_0x7167('0x19')];_0x4ed601+=0x1){var _0x33f01f;var _0x5061a3=_0x348f88[_0x4ed601];if(_0x176f73){_0x33f01f=path[_0x7167('0x24')](_0x3b5014,_0x42739c,util[_0x7167('0xb')](_0x7167('0x26'),_0x42739c,_0x4ed601,_0x7167('0x27')));}else{_0x33f01f=path[_0x7167('0x24')](_0x3b5014,util[_0x7167('0xb')](_0x7167('0x28'),_0x42739c,_0x7167('0x27')));}fs[_0x7167('0x29')](_0x33f01f,json2xls(_0x5061a3),_0x7167('0x2a'));}})[_0x7167('0x12')](function(){if(_0x176f73){return new Promise(function(_0x542844){zipdir(path[_0x7167('0x24')](_0x3b5014,_0x42739c),{'saveTo':path[_0x7167('0x24')](_0x3b5014,util[_0x7167('0xb')](_0x7167('0x28'),_0x42739c,_0x7167('0x2b')))},function(_0x5dc99a,_0x2a1a5e){rimraf(path[_0x7167('0x24')](_0x3b5014,_0x42739c),function(){});_0x542844(_0x7167('0x2c'));});});}})[_0x7167('0x12')](function(){logger['info'](util[_0x7167('0xb')](_0x7167('0x2d'),EXTRACTED_REPORT_ID,_0x7167('0xd')));return analyticExtractedReport('Completed',_0x176f73?util['format']('%s.%s',_0x42739c,_0x176f73?_0x7167('0x2b'):_0x7167('0x27')):null);});})[_0x7167('0x2e')](function(_0x235fb8){logger[_0x7167('0xa')](util[_0x7167('0xb')](_0x7167('0x2f'),EXTRACTED_REPORT_ID,_0x7167('0xd')),util[_0x7167('0x30')](_0x235fb8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7167('0x31'));})[_0x7167('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9c71d61..7863879 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 _0x895c=['concat','Hangup','transaction','destroy','bulkCreate','rewrite','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last'];(function(_0x46261b,_0xd68542){var _0x31e36f=function(_0xf5ed2b){while(--_0xf5ed2b){_0x46261b['push'](_0x46261b['shift']());}};_0x31e36f(++_0xd68542);}(_0x895c,0xd8));var _0xc895=function(_0x2df11a,_0xfb1a4f){_0x2df11a=_0x2df11a-0x0;var _0x4fefbd=_0x895c[_0x2df11a];return _0x4fefbd;};'use strict';var _=require('lodash');var util=require(_0xc895('0x0'));function rewrite(_0xcf0cf,_0x5d4e63){var _0x2566a1=this;return _0xcf0cf['models'][_0xc895('0x1')][_0xc895('0x2')]({'raw':!![]})[_0xc895('0x3')](function(_0x5762f4){_0x2566a1[_0xc895('0x4')]=_0x5762f4;return _0xcf0cf[_0xc895('0x5')][_0xc895('0x6')]['findAll']({'where':{'IntervalId':_0x5d4e63['IntervalId']},'raw':!![]});})[_0xc895('0x3')](function(_0x5e99ac){return _0xcf0cf[_0xc895('0x5')][_0xc895('0x6')][_0xc895('0x2')]({'where':{'exten':{'$in':_[_0xc895('0x7')](_[_0xc895('0x8')](_0x5e99ac,_0xc895('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xc895('0x3')](function(_0x2a38af){var _0x457f1f=_['filter'](_0x2a38af,{'priority':'1'});var _0x35e584=_[_0xc895('0xa')](_0x2a38af,{'isApp':0x1});var _0x49dd9c=_[_0xc895('0xb')](_0x35e584,'exten');var _0xb655d1=[_0xc895('0xc'),_0xc895('0xd')];var _0x441749=[];var _0x1d3c6c=[];for(var _0x5acb34 in _0x49dd9c){if(_0x49dd9c[_0xc895('0xe')](_0x5acb34)){_0x2566a1[_0xc895('0xf')]=0x2;_0x2566a1[_0xc895('0x10')]=[];_0x2566a1[_0xc895('0x11')]=_[_0xc895('0x12')](_0x457f1f,{'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')]});_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0]['type'],'app':_0xc895('0x14'),'appdata':util[_0xc895('0x15')](_0xc895('0x16'),_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')]),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});if(_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')]===_0xc895('0x1a')){_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':_0xc895('0x1b')+_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')],'context':_0x49dd9c[_0x5acb34][0x0]['context'],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});}else if(_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')]===_0xc895('0x1c')){if(_0x2566a1['extension']){_0x2566a1['extensions'][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':'CDR(destination)='+(_0x2566a1[_0xc895('0x11')][_0xc895('0x1d')]?'${EXTEN:'+_0x2566a1[_0xc895('0x11')][_0xc895('0x1d')]+'}':_0xc895('0x1e')),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1['priority']++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});}_0x2566a1['extensions'][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':'Set','appdata':_0xc895('0x1b')+_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')],'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1['priority']++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0]['VoiceExtensionId']});var _0xfb7788=_0x2566a1[_0xc895('0xf')]++;_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x1f'),'appdata':_0xc895('0x20')+(_0xfb7788+0x2)+'):Goto('+(_0xfb7788+0x1)+')','context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0xfb7788,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});if(_0x2566a1['extension']){_0x2566a1[_0xc895('0x10')]['push']({'type':_0x49dd9c[_0x5acb34][0x0]['type'],'app':_0xc895('0x14'),'appdata':_0x2566a1[_0xc895('0x11')][_0xc895('0x1d')]?_0xc895('0x21')+_0x2566a1[_0xc895('0x11')][_0xc895('0x1d')]+'}':_0xc895('0x22'),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0]['exten'],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});}_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0]['type'],'app':_0xc895('0x14'),'appdata':_0xc895('0x23')+_0x49dd9c[_0x5acb34][0x0]['VoiceExtensionId'],'context':_0x49dd9c[_0x5acb34][0x0]['context'],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1['priority']++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});if(_0x2566a1[_0xc895('0x11')]&&_0x2566a1[_0xc895('0x11')][_0xc895('0xe')](_0xc895('0x24'))&&_0x2566a1['extension'][_0xc895('0x24')]!==_0xc895('0x25')){_0x2566a1[_0xc895('0x10')]['push']({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':'Set','appdata':_0xc895('0x26'),'context':_0x49dd9c[_0x5acb34][0x0]['context'],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});_0x2566a1['extensions'][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2566a1[_0xc895('0x11')][_0xc895('0x24')]||_0xc895('0x27'),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0]['exten'],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});}}_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':_0xc895('0x28'),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1['priority']++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});_0x2566a1['extensions'][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':_0xc895('0x29'),'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0]['exten'],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0]['VoiceExtensionId']});_0x2566a1[_0xc895('0x10')]['push']({'type':_0x49dd9c[_0x5acb34][0x0]['type'],'app':_0xc895('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'exten':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x9')],'priority':_0x2566a1[_0xc895('0xf')]++,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});for(var _0x5ceb2e=0x0,_0x10074f=0x0;_0x5ceb2e<_0x49dd9c[_0x5acb34][_0xc895('0x2a')];_0x5ceb2e+=0x1,_0x10074f=0x0){var _0x29e62f=_0x49dd9c[_0x5acb34][_0x5ceb2e];if(_0x29e62f[_0xc895('0x17')]){_0x29e62f[_0xc895('0x17')]=_0x29e62f[_0xc895('0x17')][_0xc895('0x2b')]();}var _0x3d713f=[];var _0x5b3663=[];delete _0x29e62f['id'];delete _0x29e62f['createdAt'];delete _0x29e62f[_0xc895('0x2c')];var _0x40f29f=_0x29e62f[_0xc895('0x2d')]!==_0xc895('0x2e')?[_0x29e62f[_0xc895('0x2d')]]:_0x29e62f[_0xc895('0x2f')]?_[_0xc895('0x8')](_['filter'](_0x2566a1[_0xc895('0x4')],{'IntervalId':_0x29e62f['IntervalId']}),'interval'):[];if(_0x29e62f[_0xc895('0xe')](_0xc895('0x30'))){if(_0x29e62f[_0xc895('0x30')]&&_0x29e62f['tag']!=='--'){_0x3d713f[_0xc895('0x13')]({'type':_0x29e62f[_0xc895('0x17')],'app':_0xc895('0x14'),'appdata':_0xc895('0x31')+_0x29e62f[_0xc895('0x30')],'context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f[_0xc895('0x9')],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});}}if(_0x29e62f[_0xc895('0x17')]===_0xc895('0x1c')&&_0x29e62f['hasOwnProperty'](_0xc895('0x32'))){if(_0x29e62f[_0xc895('0x32')]){_0x3d713f['push']({'type':_0x29e62f[_0xc895('0x17')],'app':'ExecIf','appdata':_0xc895('0x33')+_0x29e62f['callerID']+')','context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f['exten'],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f['VoiceExtensionId']});}else{_0x3d713f['push']({'type':_0x29e62f[_0xc895('0x17')],'app':_0xc895('0x1f'),'appdata':_0xc895('0x34'),'context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f['exten'],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});}}if(_0x29e62f[_0xc895('0xe')](_0xc895('0x35'))){if(_0xb655d1[_0xc895('0x36')](_0x29e62f[_0xc895('0x37')][_0xc895('0x2b')]())>=0x0&&_0x29e62f[_0xc895('0x38')]!==_0xc895('0x39')){if(_0x29e62f['answer']){_0x3d713f[_0xc895('0x13')]({'type':_0x29e62f[_0xc895('0x17')],'app':_0xc895('0x1f'),'appdata':_0xc895('0x3a'),'context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f[_0xc895('0x9')],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1['priority']+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});_0x3d713f[_0xc895('0x13')]({'type':_0x29e62f['type'],'app':_0xc895('0x14'),'appdata':_0xc895('0x3b'),'context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f[_0xc895('0x9')],'priority':_0x40f29f['length']+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});}else{_0x3d713f[_0xc895('0x13')]({'type':_0x29e62f[_0xc895('0x17')],'app':_0xc895('0x1f'),'appdata':_0xc895('0x3c'),'context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f[_0xc895('0x9')],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});_0x3d713f[_0xc895('0x13')]({'type':_0x29e62f['type'],'app':_0xc895('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x29e62f[_0xc895('0x18')],'exten':_0x29e62f[_0xc895('0x9')],'priority':_0x40f29f[_0xc895('0x2a')]+_0x2566a1[_0xc895('0xf')]+_0x10074f++,'VoiceExtensionId':_0x29e62f[_0xc895('0x19')]});}}}for(var _0x53659a=0x0;_0x53659a<_0x40f29f[_0xc895('0x2a')];_0x53659a+=0x1){var _0x20fd14=_0x2566a1['priority']+_0x40f29f[_0xc895('0x2a')];var _0xc3b749=_0x53659a===_0x40f29f[_0xc895('0x2a')]-0x1?_0x2566a1[_0xc895('0xf')]+_0x3d713f[_0xc895('0x2a')]+_0x5b3663[_0xc895('0x2a')]+0x2:_0x2566a1['priority']+_0x53659a+0x1;_0x3d713f[_0xc895('0x3d')](_0x53659a,0x0,{'type':_0x29e62f[_0xc895('0x17')],'app':'GotoIfTime','appdata':_0x40f29f[_0x53659a]+'?'+_0x29e62f[_0xc895('0x18')]+',${EXTEN},'+_0x20fd14+':'+_0x29e62f[_0xc895('0x18')]+_0xc895('0x3e')+_0xc3b749,'exten':_0x29e62f[_0xc895('0x9')],'context':_0x29e62f[_0xc895('0x18')],'priority':_0x2566a1[_0xc895('0xf')]+_0x53659a,'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0]['VoiceExtensionId']});}_0x29e62f[_0xc895('0xf')]=_0x3d713f[_0xc895('0x2a')]?_[_0xc895('0x3f')](_0x3d713f)['priority']+0x1:_0x2566a1[_0xc895('0xf')];_0x2566a1['priority']=(_0x5b3663['length']?_['last'](_0x5b3663)[_0xc895('0xf')]:_0x29e62f['priority'])+0x1;_0x2566a1[_0xc895('0x10')]=_[_0xc895('0x40')](_0x2566a1[_0xc895('0x10')],_0x3d713f,[_0x29e62f],_0x5b3663);}_0x2566a1[_0xc895('0x10')][_0xc895('0x13')]({'type':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x17')],'app':_0xc895('0x41'),'exten':_0x49dd9c[_0x5acb34][0x0]['exten'],'context':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x18')],'priority':_0x2566a1[_0xc895('0xf')],'VoiceExtensionId':_0x49dd9c[_0x5acb34][0x0][_0xc895('0x19')]});_0x441749[_0xc895('0x13')](_0x49dd9c[_0x5acb34][0x0]['VoiceExtensionId']);_0x1d3c6c=_[_0xc895('0x40')](_0x1d3c6c,_0x2566a1[_0xc895('0x10')]);}}return _0xcf0cf[_0xc895('0x42')](function(_0x12ebfc){return _0xcf0cf['models']['VoiceExtension'][_0xc895('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x441749}},'transaction':_0x12ebfc})[_0xc895('0x3')](function(_0x4d911d){return _0xcf0cf[_0xc895('0x5')][_0xc895('0x6')][_0xc895('0x44')](_['sortBy'](_0x1d3c6c,'priority'),{'transaction':_0x12ebfc});});});})['catch'](function(_0x286cb0){console['error'](_0x286cb0);});}exports[_0xc895('0x45')]=rewrite; \ No newline at end of file +var _0xf1c1=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','rewrite','util','Interval','then','intervals','models','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer'];(function(_0x45ad37,_0x4e179f){var _0x18fd80=function(_0x5b5644){while(--_0x5b5644){_0x45ad37['push'](_0x45ad37['shift']());}};_0x18fd80(++_0x4e179f);}(_0xf1c1,0x1c4));var _0x1f1c=function(_0x34c46d,_0x4501bd){_0x34c46d=_0x34c46d-0x0;var _0x263c1a=_0xf1c1[_0x34c46d];return _0x263c1a;};'use strict';var _=require('lodash');var util=require(_0x1f1c('0x0'));function rewrite(_0x566eba,_0x14bdfb){var _0x3c9b0d=this;return _0x566eba['models'][_0x1f1c('0x1')]['findAll']({'raw':!![]})[_0x1f1c('0x2')](function(_0x7dbc6b){_0x3c9b0d[_0x1f1c('0x3')]=_0x7dbc6b;return _0x566eba[_0x1f1c('0x4')][_0x1f1c('0x5')][_0x1f1c('0x6')]({'where':{'IntervalId':_0x14bdfb['IntervalId']},'raw':!![]});})[_0x1f1c('0x2')](function(_0x47c947){return _0x566eba[_0x1f1c('0x4')][_0x1f1c('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x1f1c('0x7')](_[_0x1f1c('0x8')](_0x47c947,_0x1f1c('0x9')))}},'order':[{'raw':_0x1f1c('0xa')}],'raw':!![]});})[_0x1f1c('0x2')](function(_0xd7c0fb){var _0x3eb09b=_[_0x1f1c('0xb')](_0xd7c0fb,{'priority':'1'});var _0xe559ed=_[_0x1f1c('0xb')](_0xd7c0fb,{'isApp':0x1});var _0x35c3c1=_[_0x1f1c('0xc')](_0xe559ed,_0x1f1c('0x9'));var _0x49868a=[_0x1f1c('0xd'),_0x1f1c('0xe')];var _0x28c282=[];var _0x1cbd74=[];for(var _0x4b6e32 in _0x35c3c1){if(_0x35c3c1['hasOwnProperty'](_0x4b6e32)){_0x3c9b0d[_0x1f1c('0xf')]=0x2;_0x3c9b0d[_0x1f1c('0x10')]=[];_0x3c9b0d['extension']=_[_0x1f1c('0x11')](_0x3eb09b,{'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')]});_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':util[_0x1f1c('0x15')](_0x1f1c('0x16'),_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')]),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});if(_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')]==='inbound'){_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x19')+_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId'],'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});}else if(_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')]===_0x1f1c('0x1a')){if(_0x3c9b0d[_0x1f1c('0x1b')]){_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0]['type'],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x1c')+(_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x1d')]?_0x1f1c('0x1e')+_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x1d')]+'}':_0x1f1c('0x1f')),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId']});}_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')],'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});var _0x57b347=_0x3c9b0d[_0x1f1c('0xf')]++;_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x57b347+0x2)+_0x1f1c('0x21')+(_0x57b347+0x1)+')','context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x57b347,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId']});if(_0x3c9b0d[_0x1f1c('0x1b')]){_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0]['type'],'app':'Set','appdata':_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x1d')]?_0x1f1c('0x22')+_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0]['exten'],'priority':_0x3c9b0d['priority']++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});}_0x3c9b0d['extensions']['push']({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x23')+_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')],'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d['priority']++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});if(_0x3c9b0d[_0x1f1c('0x1b')]&&_0x3c9b0d['extension'][_0x1f1c('0x24')](_0x1f1c('0x25'))&&_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x25')]!==_0x1f1c('0x26')){_0x3c9b0d['extensions'][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':'Set','appdata':_0x1f1c('0x27'),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0]['exten'],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});_0x3c9b0d['extensions']['push']({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x28')+_0x3c9b0d[_0x1f1c('0x1b')][_0x1f1c('0x25')]||_0x1f1c('0x29'),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});}}_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x2a'),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d['priority']++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId']});_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':'Set','appdata':_0x1f1c('0x2b'),'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId']});_0x3c9b0d[_0x1f1c('0x10')]['push']({'type':_0x35c3c1[_0x4b6e32][0x0]['type'],'app':'Set','appdata':_0x1f1c('0x2c'),'context':_0x35c3c1[_0x4b6e32][0x0]['context'],'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'priority':_0x3c9b0d[_0x1f1c('0xf')]++,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});for(var _0x201f03=0x0,_0x21c4e3=0x0;_0x201f03<_0x35c3c1[_0x4b6e32][_0x1f1c('0x2d')];_0x201f03+=0x1,_0x21c4e3=0x0){var _0x4cf765=_0x35c3c1[_0x4b6e32][_0x201f03];if(_0x4cf765[_0x1f1c('0x13')]){_0x4cf765[_0x1f1c('0x13')]=_0x4cf765[_0x1f1c('0x13')]['toLowerCase']();}var _0x470b86=[];var _0x1177b9=[];delete _0x4cf765['id'];delete _0x4cf765[_0x1f1c('0x2e')];delete _0x4cf765[_0x1f1c('0x2f')];var _0x34146f=_0x4cf765[_0x1f1c('0x30')]!==_0x1f1c('0x31')?[_0x4cf765['interval']]:_0x4cf765[_0x1f1c('0x32')]?_['map'](_[_0x1f1c('0xb')](_0x3c9b0d[_0x1f1c('0x3')],{'IntervalId':_0x4cf765[_0x1f1c('0x32')]}),_0x1f1c('0x30')):[];if(_0x4cf765[_0x1f1c('0x24')](_0x1f1c('0x33'))){if(_0x4cf765['tag']&&_0x4cf765[_0x1f1c('0x33')]!=='--'){_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765[_0x1f1c('0x13')],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x34')+_0x4cf765[_0x1f1c('0x33')],'context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765['exten'],'priority':_0x34146f['length']+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765['VoiceExtensionId']});}}if(_0x4cf765[_0x1f1c('0x13')]===_0x1f1c('0x1a')&&_0x4cf765[_0x1f1c('0x24')](_0x1f1c('0x35'))){if(_0x4cf765[_0x1f1c('0x35')]){_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765['type'],'app':_0x1f1c('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4cf765['callerID']+')','context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765[_0x1f1c('0x9')],'priority':_0x34146f[_0x1f1c('0x2d')]+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765['VoiceExtensionId']});}else{_0x470b86['push']({'type':_0x4cf765[_0x1f1c('0x13')],'app':'ExecIf','appdata':_0x1f1c('0x36'),'context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765['exten'],'priority':_0x34146f[_0x1f1c('0x2d')]+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765['VoiceExtensionId']});}}if(_0x4cf765['hasOwnProperty']('answer')){if(_0x49868a[_0x1f1c('0x37')](_0x4cf765[_0x1f1c('0x38')]['toLowerCase']())>=0x0&&_0x4cf765[_0x1f1c('0x39')]!=='custom'){if(_0x4cf765[_0x1f1c('0x3a')]){_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765[_0x1f1c('0x13')],'app':_0x1f1c('0x20'),'appdata':_0x1f1c('0x3b'),'context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765['exten'],'priority':_0x34146f['length']+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765[_0x1f1c('0x18')]});_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765['type'],'app':_0x1f1c('0x14'),'appdata':_0x1f1c('0x3c'),'context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765['exten'],'priority':_0x34146f[_0x1f1c('0x2d')]+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765[_0x1f1c('0x18')]});}else{_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765[_0x1f1c('0x13')],'app':'ExecIf','appdata':_0x1f1c('0x3d'),'context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765[_0x1f1c('0x9')],'priority':_0x34146f[_0x1f1c('0x2d')]+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765[_0x1f1c('0x18')]});_0x470b86[_0x1f1c('0x12')]({'type':_0x4cf765[_0x1f1c('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4cf765[_0x1f1c('0x17')],'exten':_0x4cf765[_0x1f1c('0x9')],'priority':_0x34146f[_0x1f1c('0x2d')]+_0x3c9b0d[_0x1f1c('0xf')]+_0x21c4e3++,'VoiceExtensionId':_0x4cf765[_0x1f1c('0x18')]});}}}for(var _0x1a866=0x0;_0x1a866<_0x34146f[_0x1f1c('0x2d')];_0x1a866+=0x1){var _0x19ceff=_0x3c9b0d[_0x1f1c('0xf')]+_0x34146f[_0x1f1c('0x2d')];var _0x4a3e98=_0x1a866===_0x34146f[_0x1f1c('0x2d')]-0x1?_0x3c9b0d[_0x1f1c('0xf')]+_0x470b86[_0x1f1c('0x2d')]+_0x1177b9[_0x1f1c('0x2d')]+0x2:_0x3c9b0d['priority']+_0x1a866+0x1;_0x470b86[_0x1f1c('0x3e')](_0x1a866,0x0,{'type':_0x4cf765[_0x1f1c('0x13')],'app':_0x1f1c('0x3f'),'appdata':_0x34146f[_0x1a866]+'?'+_0x4cf765[_0x1f1c('0x17')]+_0x1f1c('0x40')+_0x19ceff+':'+_0x4cf765['context']+_0x1f1c('0x40')+_0x4a3e98,'exten':_0x4cf765[_0x1f1c('0x9')],'context':_0x4cf765[_0x1f1c('0x17')],'priority':_0x3c9b0d[_0x1f1c('0xf')]+_0x1a866,'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});}_0x4cf765['priority']=_0x470b86['length']?_[_0x1f1c('0x41')](_0x470b86)[_0x1f1c('0xf')]+0x1:_0x3c9b0d[_0x1f1c('0xf')];_0x3c9b0d[_0x1f1c('0xf')]=(_0x1177b9[_0x1f1c('0x2d')]?_[_0x1f1c('0x41')](_0x1177b9)[_0x1f1c('0xf')]:_0x4cf765['priority'])+0x1;_0x3c9b0d[_0x1f1c('0x10')]=_[_0x1f1c('0x42')](_0x3c9b0d[_0x1f1c('0x10')],_0x470b86,[_0x4cf765],_0x1177b9);}_0x3c9b0d[_0x1f1c('0x10')][_0x1f1c('0x12')]({'type':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x13')],'app':_0x1f1c('0x43'),'exten':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x9')],'context':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x17')],'priority':_0x3c9b0d[_0x1f1c('0xf')],'VoiceExtensionId':_0x35c3c1[_0x4b6e32][0x0][_0x1f1c('0x18')]});_0x28c282[_0x1f1c('0x12')](_0x35c3c1[_0x4b6e32][0x0]['VoiceExtensionId']);_0x1cbd74=_[_0x1f1c('0x42')](_0x1cbd74,_0x3c9b0d['extensions']);}}return _0x566eba[_0x1f1c('0x44')](function(_0xa793f8){return _0x566eba[_0x1f1c('0x4')]['VoiceExtension'][_0x1f1c('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x28c282}},'transaction':_0xa793f8})[_0x1f1c('0x2')](function(_0x14fca9){return _0x566eba[_0x1f1c('0x4')][_0x1f1c('0x5')]['bulkCreate'](_[_0x1f1c('0x46')](_0x1cbd74,_0x1f1c('0xf')),{'transaction':_0xa793f8});});});})[_0x1f1c('0x47')](function(_0x498099){console['error'](_0x498099);});}exports[_0x1f1c('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8cb354a..475db4a 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 _0x909b=['find','Duplicate\x20Contact','CmContact','create','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','sequelize','VoiceQueueId','onlyIfOpen','query','outbound','BlackLists','all','Campaign','dialCheckDuplicateType','get','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId'];(function(_0x50cea4,_0x2373d3){var _0x206247=function(_0x1a677c){while(--_0x1a677c){_0x50cea4['push'](_0x50cea4['shift']());}};_0x206247(++_0x2373d3);}(_0x909b,0x191));var _0xb909=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x909b[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var util=require(_0xb909('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xb909('0x1'));var Papa=require(_0xb909('0x2'));var Redis=require('ioredis');var db=require(_0xb909('0x3'))['db'];var config=require(_0xb909('0x4'));var logger=require(_0xb909('0x5'))('api');config[_0xb909('0x6')]=_[_0xb909('0x7')](config[_0xb909('0x6')],{'host':_0xb909('0x8'),'port':0x18eb});var socket=require(_0xb909('0x9'))(new Redis(config[_0xb909('0x6')]));require(_0xb909('0xa'))[_0xb909('0xb')](socket);try{if(!process[_0xb909('0xc')][0x2]||process[_0xb909('0xc')][0x2]==='undefined'||process[_0xb909('0xc')][0x2]==='null'){throw new Error(_0xb909('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xb909('0xc')][0x3]||process[_0xb909('0xc')][0x3]===_0xb909('0xe')||process[_0xb909('0xc')][0x3]==='null'||!process[_0xb909('0xc')][0x4]||process[_0xb909('0xc')][0x4]===_0xb909('0xe')||process[_0xb909('0xc')][0x4]===_0xb909('0xf')){throw new Error(_0xb909('0x10'));}var FIELDS=_[_0xb909('0x11')](process['argv'][0x3]['split'](','),process['argv'][0x4][_0xb909('0x12')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process[_0xb909('0xc')][0x5]==='null'){throw new Error(_0xb909('0x13'));}var LISTID=process[_0xb909('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xb909('0xe')&&process['argv'][0x6]!==_0xb909('0xf')?process[_0xb909('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xb909('0xc')][0x7]!==_0xb909('0xe')&&process[_0xb909('0xc')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0xb909('0xc')][0x8]||process['argv'][0x8]==='undefined'||process[_0xb909('0xc')][0x8]===_0xb909('0xf')){throw new Error(_0xb909('0x14'));}var SOCKET_TIMESTAMP=process[_0xb909('0xc')][0x8];}catch(_0x3ff43b){logger[_0xb909('0x15')](_0x3ff43b);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(_0xb8daf6,_0x172178,_0x491045,_0x4e1771){var _0x5ba270={'message':_0x172178};_0x5ba270[_0xb8daf6]=!![];if(_0x491045){_0x5ba270[_0xb909('0x16')]=_0x491045;}if(_0x4e1771){_0x5ba270['index']=_0x4e1771;}return _0x5ba270;}function isEmail(_0xaffec1){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))*$/[_0xb909('0x17')](_0xaffec1);}function checkRow(_0x56862c,_0x3a873f,_0x5401e9){return new BPromise(function(_0x1975ff,_0x1d96ca){if(_['isNil'](_0x56862c)){return _0x1d96ca(handleCheckRowError(_0xb909('0x15'),_0xb909('0x18'),null,_0x5401e9));}if(_0x56862c['errors']&&_0x56862c[_0xb909('0x19')][_0xb909('0x1a')]){var _0x324001=_[_0xb909('0x1b')](_0x56862c[_0xb909('0x19')],'message')[_0xb909('0x1c')](';');return _0x1d96ca(handleCheckRowError('error',_0x324001,null,_0x5401e9));}var _0x562bf0={};for(var _0xb202a in FIELDS){if(FIELDS[_0xb909('0x1d')](_0xb202a)&&FIELDS[_0xb202a]){_0x562bf0[_0xb202a]=_0x56862c[_0xb909('0x1e')][0x0][FIELDS[_0xb202a]]||_0x56862c[_0xb909('0x1e')][0x0]['\ufeff'+FIELDS[_0xb202a]];}}if(!_0x562bf0[_0xb909('0x1f')]){return _0x1d96ca(handleCheckRowError(_0xb909('0x15'),'firstName\x20not\x20specified!',null,_0x5401e9));}if(!_0x562bf0['phone']){return _0x1d96ca(handleCheckRowError('error',_0xb909('0x20'),null,_0x5401e9));}if(_0x562bf0['birthDate']){var _0x3cc741=moment(_0x562bf0[_0xb909('0x21')],_0xb909('0x22'));if(!_0x3cc741['isValid']()){return _0x1d96ca(handleCheckRowError(_0xb909('0x15'),_0xb909('0x23'),null,_0x5401e9));}}if(_0x562bf0['email']){if(!isEmail(_0x562bf0[_0xb909('0x24')])){return _0x1d96ca(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x5401e9));}}_0x562bf0[_0xb909('0x25')]=LISTID;_0x562bf0[_0xb909('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb909('0x1a')]&&_0x3a873f){var _0x19d5da={};for(var _0x50d75a=0x0,_0x142e89=DUPLICATES['length'];_0x50d75a<_0x142e89;_0x50d75a+=0x1){_0x19d5da[DUPLICATES[_0x50d75a]]=_0x562bf0[DUPLICATES[_0x50d75a]];}var _0x426dce=_[_0xb909('0x27')](_0x3a873f,_0x19d5da);if(_0x426dce){return _0x1d96ca(handleCheckRowError('duplicate',_0xb909('0x28'),_0x426dce,_0x5401e9));}}return db[_0xb909('0x29')][_0xb909('0x2a')](_0x562bf0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x562bf0)})[_0xb909('0x2b')](function(_0x1b0e18){if(DUPLICATES&&DUPLICATES['length']&&_0x3a873f){_0x3a873f[_0xb909('0x2c')](_['pick'](_0x562bf0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1b0e18['id'];return _0x1975ff();})[_0xb909('0x2d')](function(_0x2b407e){return _0x1d96ca(handleCheckRowError(_0xb909('0x15'),_0xb909('0x2e')+(_0x2b407e['message']||JSON[_0xb909('0x2f')](_0x2b407e)),null,_0x5401e9));});});}function checkHopper(){function _0x1cbc58(){return function(_0x546b9a){logger[_0xb909('0x15')]('cmContact',_0xb909('0x30'),util['inspect'](_0x546b9a,{'showHidden':![],'depth':null}));};}var _0x5d6635=function(_0x5e6ec8,_0x5dbb41){var _0x2aa849=squel[_0xb909('0x31')]()['into'](_0xb909('0x32'))[_0xb909('0x33')]([_0xb909('0x34'),_0xb909('0x35'),_0xb909('0x36'),_0xb909('0x25'),_0x5dbb41,_0xb909('0x37'),'updatedAt'],squel[_0xb909('0x38')]()[_0xb909('0x39')]('phone',_0xb909('0x34'))[_0xb909('0x39')](_0xb909('0x3a'),_0xb909('0x35'))[_0xb909('0x39')]('id',_0xb909('0x36'))[_0xb909('0x39')](LISTID[_0xb909('0x3b')](),'ListId')[_0xb909('0x39')](_0x5e6ec8['id'][_0xb909('0x3b')](),_0x5dbb41)[_0xb909('0x39')](_0xb909('0x3a'),_0xb909('0x37'))[_0xb909('0x39')](_0xb909('0x3a'),_0xb909('0x3c'))['from'](_0xb909('0x3d'))[_0xb909('0x3e')](_0xb909('0x3f'))['where'](_0xb909('0x40'),LISTID[_0xb909('0x3b')]())['where'](_0xb909('0x41'))[_0xb909('0x3e')](_0xb909('0x42'),squel['select']()[_0xb909('0x39')](_0xb909('0x34'))[_0xb909('0x43')](_0xb909('0x32'))['where'](_0x5dbb41+_0xb909('0x44'),_0x5e6ec8['id'][_0xb909('0x3b')]())))[_0xb909('0x3b')]();return _0x2aa849;};var _0x3a0a5e=function(_0x2e3ae3,_0x8e570f){var _0x1e7189=squel[_0xb909('0x31')]()[_0xb909('0x45')]('cm_hopper')[_0xb909('0x33')]([_0xb909('0x34'),_0xb909('0x35'),_0xb909('0x36'),_0xb909('0x25'),_0x8e570f,_0xb909('0x37'),_0xb909('0x3c')],squel[_0xb909('0x38')]()['field'](_0xb909('0x34'),_0xb909('0x34'))['field'](_0xb909('0x3a'),_0xb909('0x35'))['field']('id','ContactId')['field'](LISTID['toString'](),_0xb909('0x25'))[_0xb909('0x39')](_0x2e3ae3['id']['toString'](),_0x8e570f)['field'](_0xb909('0x3a'),_0xb909('0x37'))[_0xb909('0x39')]('NOW()',_0xb909('0x3c'))['from'](_0xb909('0x3d'))[_0xb909('0x3e')](_0xb909('0x3f'))[_0xb909('0x3e')](_0xb909('0x40'),LISTID[_0xb909('0x3b')]())['where'](_0xb909('0x46'),squel[_0xb909('0x47')](hopperContacts))[_0xb909('0x3e')](_0xb909('0x41'))[_0xb909('0x3e')](_0xb909('0x42'),squel[_0xb909('0x38')]()[_0xb909('0x39')]('calleridnum')[_0xb909('0x43')]('cm_hopper_final')[_0xb909('0x3e')](_0x8e570f+_0xb909('0x44'),_0x2e3ae3['id'][_0xb909('0x3b')]()))[_0xb909('0x3e')](_0xb909('0x42'),squel[_0xb909('0x38')]()[_0xb909('0x39')]('phone')[_0xb909('0x43')]('cm_hopper')[_0xb909('0x3e')](_0x8e570f+_0xb909('0x44'),_0x2e3ae3['id']['toString']())))[_0xb909('0x3b')]();return _0x1e7189;};function _0x58f8c9(_0x223ea3,_0x2e6e73){var _0x59b49b=squel[_0xb909('0x31')]()['into'](_0xb909('0x32'))[_0xb909('0x33')]([_0xb909('0x34'),_0xb909('0x35'),_0xb909('0x36'),_0xb909('0x25'),_0x2e6e73,_0xb909('0x37'),_0xb909('0x3c')],squel[_0xb909('0x38')]()[_0xb909('0x39')]('phone',_0xb909('0x34'))[_0xb909('0x39')](_0xb909('0x3a'),_0xb909('0x35'))['field']('id',_0xb909('0x36'))[_0xb909('0x39')](LISTID['toString'](),_0xb909('0x25'))[_0xb909('0x39')](_0x223ea3['id'][_0xb909('0x3b')](),_0x2e6e73)['field'](_0xb909('0x3a'),_0xb909('0x37'))[_0xb909('0x39')](_0xb909('0x3a'),'updatedAt')[_0xb909('0x43')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xb909('0x3e')](_0xb909('0x40'),LISTID[_0xb909('0x3b')]())[_0xb909('0x3e')](_0xb909('0x46'),squel[_0xb909('0x47')](hopperContacts))[_0xb909('0x3e')](_0xb909('0x41')))[_0xb909('0x3b')]();return _0x59b49b;}function _0x117dfc(_0x547f08,_0x34111b){var _0x11631b=squel['insert']()[_0xb909('0x45')](_0xb909('0x48'))[_0xb909('0x33')]([_0xb909('0x34'),'ContactId',_0xb909('0x25'),_0x34111b,_0xb909('0x37'),_0xb909('0x3c')],squel[_0xb909('0x38')]()[_0xb909('0x39')](_0xb909('0x34'),'phone')[_0xb909('0x39')]('id',_0xb909('0x36'))[_0xb909('0x39')](LISTID[_0xb909('0x3b')](),'ListId')['field'](_0x547f08['id']['toString'](),_0x34111b)['field'](_0xb909('0x3a'),_0xb909('0x37'))[_0xb909('0x39')](_0xb909('0x3a'),_0xb909('0x3c'))[_0xb909('0x43')](_0xb909('0x3d'))[_0xb909('0x3e')](_0xb909('0x3f'))['where'](_0xb909('0x40'),LISTID[_0xb909('0x3b')]())[_0xb909('0x3e')](_0xb909('0x46'),squel[_0xb909('0x47')](hopperContacts))[_0xb909('0x3e')](_0xb909('0x41')))[_0xb909('0x3b')]();return _0x11631b;}return db[_0xb909('0x49')][_0xb909('0x4a')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb909('0x4b')],'as':_0xb909('0x4c'),'where':{'id':LISTID}}]})[_0xb909('0x2b')](function(_0x2c1fd3){var _0x4578a4=[];if(_0x2c1fd3){var _0x53149f;for(var _0x35c0c3=0x0,_0xa14d68;_0x35c0c3<_0x2c1fd3[_0xb909('0x1a')];_0x35c0c3+=0x1){_0xa14d68=_0x2c1fd3[_0x35c0c3]['get']({'plain':!![]});switch(_0xa14d68['dialCheckDuplicateType']){case'always':_0x4578a4['push'](db[_0xb909('0x4d')]['query'](_0x3a0a5e(_0xa14d68,_0xb909('0x4e')))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));break;case _0xb909('0x4f'):_0x4578a4[_0xb909('0x2c')](db['sequelize'][_0xb909('0x50')](_0x5d6635(_0xa14d68,'VoiceQueueId'))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));break;default:_0x4578a4[_0xb909('0x2c')](db[_0xb909('0x4d')][_0xb909('0x50')](_0x58f8c9(_0xa14d68,_0xb909('0x4e')))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));}}}return _0x4578a4;})['all']()[_0xb909('0x2b')](function(){return db[_0xb909('0x49')][_0xb909('0x4a')]({'where':{'type':_0xb909('0x51')},'attributes':['id'],'include':[{'model':db[_0xb909('0x4b')],'as':_0xb909('0x52'),'where':{'id':LISTID}}]})[_0xb909('0x2b')](function(_0x1bab08){var _0x2daaad=[];if(_0x1bab08){var _0xe04132;for(var _0x364268=0x0,_0x21cc96;_0x364268<_0x1bab08['length'];_0x364268+=0x1){_0x21cc96=_0x1bab08[_0x364268]['get']({'plain':!![]});_0x2daaad[_0xb909('0x2c')](db[_0xb909('0x4d')][_0xb909('0x50')](_0x117dfc(_0x21cc96,_0xb909('0x4e')))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));}}return _0x2daaad;})[_0xb909('0x53')]();})['then'](function(){return db[_0xb909('0x54')][_0xb909('0x4a')]({'attributes':['id',_0xb909('0x55')],'include':[{'model':db['CmList'],'as':_0xb909('0x4c'),'where':{'id':LISTID}}]})[_0xb909('0x2b')](function(_0x1899b7){var _0x18729f=[];if(_0x1899b7){for(var _0x173f08=0x0,_0x43b5c3;_0x173f08<_0x1899b7[_0xb909('0x1a')];_0x173f08+=0x1){_0x43b5c3=_0x1899b7[_0x173f08][_0xb909('0x56')]({'plain':!![]});switch(_0x43b5c3[_0xb909('0x55')]){case _0xb909('0x57'):_0x18729f[_0xb909('0x2c')](db[_0xb909('0x4d')][_0xb909('0x50')](_0x3a0a5e(_0x43b5c3,_0xb909('0x58')))[_0xb909('0x2b')](function(){})['catch'](_0x1cbc58()));break;case _0xb909('0x4f'):_0x18729f['push'](db['sequelize'][_0xb909('0x50')](_0x5d6635(_0x43b5c3,_0xb909('0x58')))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));break;default:_0x18729f[_0xb909('0x2c')](db['sequelize'][_0xb909('0x50')](_0x58f8c9(_0x43b5c3,_0xb909('0x58')))[_0xb909('0x2b')](function(){})[_0xb909('0x2d')](_0x1cbc58()));}}}return _0x18729f;})[_0xb909('0x53')]();})[_0xb909('0x2b')](function(){return db[_0xb909('0x54')][_0xb909('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xb909('0x4b')],'as':_0xb909('0x52'),'where':{'id':LISTID}}]})[_0xb909('0x2b')](function(_0x2cc271){var _0x704b18=[];if(_0x2cc271){for(var _0x499482=0x0,_0x45a862;_0x499482<_0x2cc271[_0xb909('0x1a')];_0x499482+=0x1){_0x45a862=_0x2cc271[_0x499482][_0xb909('0x56')]({'plain':!![]});_0x704b18[_0xb909('0x2c')](db['sequelize']['query'](_0x117dfc(_0x45a862,_0xb909('0x58')))['then'](function(){})[_0xb909('0x2d')](_0x1cbc58()));}}return _0x704b18;})[_0xb909('0x53')]();})['catch'](function(_0xb6d394){logger[_0xb909('0x15')](_0xb909('0x59'),_0xb909('0x5a'),_0xb6d394[_0xb909('0x5b')]);});}var processPromises=function(_0x5163a5){return BPromise[_0xb909('0x53')](promises)[_0xb909('0x2b')](function(_0x3b34bc){})[_0xb909('0x2d')](function(_0x2b8c09){logger[_0xb909('0x15')](_0xb909('0x5c'),JSON['stringify'](_0x2b8c09));})['finally'](function(){socket['emit'](_0xb909('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5163a5){return _0x5163a5[_0xb909('0x5e')]();}});};var endCsv=function(){return BPromise[_0xb909('0x5f')]()[_0xb909('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0xb909('0x2b')](function(){socket[_0xb909('0x60')](_0xb909('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb909('0x61')](FILEPATH);}catch(_0x556ec6){logger[_0xb909('0x15')](_0xb909('0x62'),JSON[_0xb909('0x2f')](_0x556ec6));}finally{process[_0xb909('0x63')](0x0);}});};process['on'](_0xb909('0x64'),function(){logger['info'](_0xb909('0x65'));endCsv();});function main(){return BPromise[_0xb909('0x5f')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xb909('0x29')][_0xb909('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb909('0x2b')](function(_0x44f7d2){var _0x259dd6=fs[_0xb909('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb909('0x67')](_0x259dd6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d8b7a,_0xe547a0){total+=0x1;var _0x4f86f8=total;promises[_0xb909('0x2c')](checkRow(_0x2d8b7a,_0x44f7d2,_0x4f86f8)[_0xb909('0x2b')](function(){success+=0x1;})[_0xb909('0x2d')](function(_0x1759c3){if(_0x1759c3['error']){errors+=0x1;delete _0x1759c3[_0xb909('0x15')];}else if(_0x1759c3['duplicate']){duplicates+=0x1;delete _0x1759c3[_0xb909('0x68')];}rows['push'](_0x1759c3);}));if(total%0xc8===0x0){_0xe547a0[_0xb909('0x69')]();return processPromises(_0xe547a0);}},'complete':function(){return processPromises()[_0xb909('0x2b')](function(){logger['info'](_0xb909('0x6a'));endCsv();});},'error':function(_0x1391ce,_0x55fe00){logger[_0xb909('0x6b')](_0xb909('0x6c'),JSON[_0xb909('0x2f')](_0x1391ce));endCsv();}});})[_0xb909('0x2d')](function(_0x14e926){logger[_0xb909('0x15')](_0xb909('0x6d'),JSON['stringify'](_0x14e926));});}main(); \ No newline at end of file +var _0x1586=['undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','outbound','BlackLists','Lists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv'];(function(_0x978359,_0x5755b9){var _0x4c1f55=function(_0x3564a5){while(--_0x3564a5){_0x978359['push'](_0x978359['shift']());}};_0x4c1f55(++_0x5755b9);}(_0x1586,0x1a7));var _0x6158=function(_0x1fa19c,_0x5c740b){_0x1fa19c=_0x1fa19c-0x0;var _0x5b332d=_0x1586[_0x1fa19c];return _0x5b332d;};'use strict';var BPromise=require(_0x6158('0x0'));var util=require(_0x6158('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x6158('0x2'));var Papa=require(_0x6158('0x3'));var Redis=require(_0x6158('0x4'));var db=require(_0x6158('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x6158('0x6'))(_0x6158('0x7'));config[_0x6158('0x8')]=_[_0x6158('0x9')](config[_0x6158('0x8')],{'host':_0x6158('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6158('0x8')]));require(_0x6158('0xb'))['register'](socket);try{if(!process[_0x6158('0xc')][0x2]||process[_0x6158('0xc')][0x2]===_0x6158('0xd')||process[_0x6158('0xc')][0x2]==='null'){throw new Error(_0x6158('0xe'));}var FILEPATH=process[_0x6158('0xc')][0x2];if(!process[_0x6158('0xc')][0x3]||process[_0x6158('0xc')][0x3]==='undefined'||process[_0x6158('0xc')][0x3]===_0x6158('0xf')||!process['argv'][0x4]||process[_0x6158('0xc')][0x4]==='undefined'||process[_0x6158('0xc')][0x4]===_0x6158('0xf')){throw new Error(_0x6158('0x10'));}var FIELDS=_[_0x6158('0x11')](process[_0x6158('0xc')][0x3]['split'](','),process[_0x6158('0xc')][0x4][_0x6158('0x12')](','));if(!process[_0x6158('0xc')][0x5]||process[_0x6158('0xc')][0x5]===_0x6158('0xd')||process[_0x6158('0xc')][0x5]===_0x6158('0xf')){throw new Error(_0x6158('0x13'));}var LISTID=process[_0x6158('0xc')][0x5];var COMPANYID=process[_0x6158('0xc')][0x6]&&process[_0x6158('0xc')][0x6]!==_0x6158('0xd')&&process[_0x6158('0xc')][0x6]!==_0x6158('0xf')?process[_0x6158('0xc')][0x6]:null;var DUPLICATES=process[_0x6158('0xc')][0x7]&&process[_0x6158('0xc')][0x7]!=='undefined'&&process[_0x6158('0xc')][0x7]!==_0x6158('0xf')?process[_0x6158('0xc')][0x7]:null;if(!process[_0x6158('0xc')][0x8]||process[_0x6158('0xc')][0x8]==='undefined'||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x6158('0xc')][0x8];}catch(_0x119818){logger['error'](_0x119818);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(_0x24e21c,_0x23fe70,_0xc32d4b,_0x135a61){var _0x38ad9c={'message':_0x23fe70};_0x38ad9c[_0x24e21c]=!![];if(_0xc32d4b){_0x38ad9c[_0x6158('0x14')]=_0xc32d4b;}if(_0x135a61){_0x38ad9c[_0x6158('0x15')]=_0x135a61;}return _0x38ad9c;}function isEmail(_0x11684b){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))*$/[_0x6158('0x16')](_0x11684b);}function checkRow(_0x367df7,_0x744d4a,_0x2db230){return new BPromise(function(_0x3f25a4,_0x4d78c8){if(_[_0x6158('0x17')](_0x367df7)){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),_0x6158('0x19'),null,_0x2db230));}if(_0x367df7[_0x6158('0x1a')]&&_0x367df7[_0x6158('0x1a')][_0x6158('0x1b')]){var _0xfa550e=_[_0x6158('0x1c')](_0x367df7['errors'],_0x6158('0x1d'))[_0x6158('0x1e')](';');return _0x4d78c8(handleCheckRowError('error',_0xfa550e,null,_0x2db230));}var _0x2a5141={};for(var _0x21692b in FIELDS){if(FIELDS['hasOwnProperty'](_0x21692b)&&FIELDS[_0x21692b]){_0x2a5141[_0x21692b]=_0x367df7['data'][0x0][FIELDS[_0x21692b]]||_0x367df7[_0x6158('0x1f')][0x0]['\ufeff'+FIELDS[_0x21692b]];}}if(!_0x2a5141[_0x6158('0x20')]){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),'firstName\x20not\x20specified!',null,_0x2db230));}if(!_0x2a5141[_0x6158('0x21')]){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),_0x6158('0x22'),null,_0x2db230));}if(_0x2a5141['birthDate']){var _0x2bcdc5=moment(_0x2a5141[_0x6158('0x23')],'YYYY-MM-DD');if(!_0x2bcdc5[_0x6158('0x24')]()){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),_0x6158('0x25'),null,_0x2db230));}}if(_0x2a5141[_0x6158('0x26')]){if(!isEmail(_0x2a5141['email'])){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x2db230));}}_0x2a5141[_0x6158('0x27')]=LISTID;_0x2a5141[_0x6158('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6158('0x1b')]&&_0x744d4a){var _0x4b4505={};for(var _0x6ade97=0x0,_0x4a38cb=DUPLICATES[_0x6158('0x1b')];_0x6ade97<_0x4a38cb;_0x6ade97+=0x1){_0x4b4505[DUPLICATES[_0x6ade97]]=_0x2a5141[DUPLICATES[_0x6ade97]];}var _0x3e2422=_[_0x6158('0x29')](_0x744d4a,_0x4b4505);if(_0x3e2422){return _0x4d78c8(handleCheckRowError(_0x6158('0x2a'),'Duplicate\x20Contact',_0x3e2422,_0x2db230));}}return db[_0x6158('0x2b')][_0x6158('0x2c')](_0x2a5141,{'raw':!![],'hooks':![],'fields':_[_0x6158('0x2d')](_0x2a5141)})[_0x6158('0x2e')](function(_0x5e10fc){if(DUPLICATES&&DUPLICATES[_0x6158('0x1b')]&&_0x744d4a){_0x744d4a[_0x6158('0x2f')](_[_0x6158('0x30')](_0x2a5141,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5e10fc['id'];return _0x3f25a4();})[_0x6158('0x31')](function(_0xcea518){return _0x4d78c8(handleCheckRowError(_0x6158('0x18'),_0x6158('0x32')+(_0xcea518[_0x6158('0x1d')]||JSON[_0x6158('0x33')](_0xcea518)),null,_0x2db230));});});}function checkHopper(){function _0x552fa0(){return function(_0x1f45d8){logger['error']('cmContact',_0x6158('0x34'),util['inspect'](_0x1f45d8,{'showHidden':![],'depth':null}));};}var _0x455616=function(_0x22055f,_0x468f09){var _0x2734fd=squel[_0x6158('0x35')]()[_0x6158('0x36')](_0x6158('0x37'))[_0x6158('0x38')]([_0x6158('0x21'),_0x6158('0x39'),_0x6158('0x3a'),_0x6158('0x27'),_0x468f09,_0x6158('0x3b'),_0x6158('0x3c')],squel['select']()[_0x6158('0x3d')](_0x6158('0x21'),_0x6158('0x21'))['field']('NOW()','scheduledAt')[_0x6158('0x3d')]('id','ContactId')[_0x6158('0x3d')](LISTID[_0x6158('0x3e')](),_0x6158('0x27'))['field'](_0x22055f['id'][_0x6158('0x3e')](),_0x468f09)[_0x6158('0x3d')](_0x6158('0x3f'),'createdAt')['field'](_0x6158('0x3f'),'updatedAt')[_0x6158('0x40')](_0x6158('0x41'))[_0x6158('0x42')](_0x6158('0x43'))[_0x6158('0x42')](_0x6158('0x44'),LISTID[_0x6158('0x3e')]())['where'](_0x6158('0x45'))[_0x6158('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6158('0x3d')](_0x6158('0x21'))[_0x6158('0x40')](_0x6158('0x37'))[_0x6158('0x42')](_0x468f09+'\x20=\x20?',_0x22055f['id']['toString']())))[_0x6158('0x3e')]();return _0x2734fd;};var _0x177346=function(_0x4545de,_0x252e25){var _0x1678c3=squel[_0x6158('0x35')]()['into'](_0x6158('0x37'))[_0x6158('0x38')]([_0x6158('0x21'),_0x6158('0x39'),'ContactId',_0x6158('0x27'),_0x252e25,_0x6158('0x3b'),'updatedAt'],squel[_0x6158('0x46')]()[_0x6158('0x3d')](_0x6158('0x21'),_0x6158('0x21'))[_0x6158('0x3d')](_0x6158('0x3f'),_0x6158('0x39'))[_0x6158('0x3d')]('id',_0x6158('0x3a'))[_0x6158('0x3d')](LISTID[_0x6158('0x3e')](),_0x6158('0x27'))['field'](_0x4545de['id'][_0x6158('0x3e')](),_0x252e25)['field'](_0x6158('0x3f'),_0x6158('0x3b'))['field'](_0x6158('0x3f'),'updatedAt')[_0x6158('0x40')]('cm_contacts')[_0x6158('0x42')](_0x6158('0x43'))[_0x6158('0x42')](_0x6158('0x44'),LISTID[_0x6158('0x3e')]())[_0x6158('0x42')](_0x6158('0x47'),squel[_0x6158('0x48')](hopperContacts))[_0x6158('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x6158('0x42')](_0x6158('0x49'),squel[_0x6158('0x46')]()['field']('calleridnum')[_0x6158('0x40')](_0x6158('0x4a'))[_0x6158('0x42')](_0x252e25+'\x20=\x20?',_0x4545de['id'][_0x6158('0x3e')]()))[_0x6158('0x42')](_0x6158('0x49'),squel[_0x6158('0x46')]()[_0x6158('0x3d')](_0x6158('0x21'))[_0x6158('0x40')]('cm_hopper')['where'](_0x252e25+_0x6158('0x4b'),_0x4545de['id'][_0x6158('0x3e')]())))[_0x6158('0x3e')]();return _0x1678c3;};function _0x29758d(_0x5e0288,_0xd3a3a2){var _0x4685b7=squel['insert']()['into'](_0x6158('0x37'))[_0x6158('0x38')]([_0x6158('0x21'),_0x6158('0x39'),_0x6158('0x3a'),_0x6158('0x27'),_0xd3a3a2,_0x6158('0x3b'),_0x6158('0x3c')],squel['select']()[_0x6158('0x3d')](_0x6158('0x21'),'phone')[_0x6158('0x3d')](_0x6158('0x3f'),'scheduledAt')[_0x6158('0x3d')]('id',_0x6158('0x3a'))[_0x6158('0x3d')](LISTID['toString'](),_0x6158('0x27'))[_0x6158('0x3d')](_0x5e0288['id'][_0x6158('0x3e')](),_0xd3a3a2)['field'](_0x6158('0x3f'),_0x6158('0x3b'))[_0x6158('0x3d')]('NOW()',_0x6158('0x3c'))[_0x6158('0x40')](_0x6158('0x41'))[_0x6158('0x42')](_0x6158('0x43'))[_0x6158('0x42')](_0x6158('0x44'),LISTID[_0x6158('0x3e')]())[_0x6158('0x42')](_0x6158('0x47'),squel['str'](hopperContacts))['where'](_0x6158('0x45')))['toString']();return _0x4685b7;}function _0x5bbc26(_0x13943c,_0x5865c2){var _0x1e4f48=squel['insert']()['into'](_0x6158('0x4c'))[_0x6158('0x38')]([_0x6158('0x21'),'ContactId','ListId',_0x5865c2,_0x6158('0x3b'),'updatedAt'],squel['select']()['field'](_0x6158('0x21'),_0x6158('0x21'))[_0x6158('0x3d')]('id',_0x6158('0x3a'))[_0x6158('0x3d')](LISTID[_0x6158('0x3e')](),_0x6158('0x27'))[_0x6158('0x3d')](_0x13943c['id'][_0x6158('0x3e')](),_0x5865c2)[_0x6158('0x3d')](_0x6158('0x3f'),_0x6158('0x3b'))[_0x6158('0x3d')](_0x6158('0x3f'),_0x6158('0x3c'))[_0x6158('0x40')](_0x6158('0x41'))['where'](_0x6158('0x43'))[_0x6158('0x42')](_0x6158('0x44'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x6158('0x48')](hopperContacts))[_0x6158('0x42')](_0x6158('0x45')))[_0x6158('0x3e')]();return _0x1e4f48;}return db[_0x6158('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x6158('0x4e')],'include':[{'model':db[_0x6158('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x6158('0x2e')](function(_0xbca506){var _0x5cffa4=[];if(_0xbca506){var _0x2289ac;for(var _0x4571ba=0x0,_0x4b386d;_0x4571ba<_0xbca506[_0x6158('0x1b')];_0x4571ba+=0x1){_0x4b386d=_0xbca506[_0x4571ba][_0x6158('0x50')]({'plain':!![]});switch(_0x4b386d[_0x6158('0x4e')]){case'always':_0x5cffa4['push'](db[_0x6158('0x51')][_0x6158('0x52')](_0x177346(_0x4b386d,_0x6158('0x53')))['then'](function(){})[_0x6158('0x31')](_0x552fa0()));break;case _0x6158('0x54'):_0x5cffa4[_0x6158('0x2f')](db[_0x6158('0x51')][_0x6158('0x52')](_0x455616(_0x4b386d,'VoiceQueueId'))['then'](function(){})['catch'](_0x552fa0()));break;default:_0x5cffa4['push'](db['sequelize']['query'](_0x29758d(_0x4b386d,'VoiceQueueId'))[_0x6158('0x2e')](function(){})[_0x6158('0x31')](_0x552fa0()));}}}return _0x5cffa4;})[_0x6158('0x55')]()[_0x6158('0x2e')](function(){return db['VoiceQueue'][_0x6158('0x56')]({'where':{'type':_0x6158('0x57')},'attributes':['id'],'include':[{'model':db[_0x6158('0x4f')],'as':_0x6158('0x58'),'where':{'id':LISTID}}]})[_0x6158('0x2e')](function(_0x96868d){var _0x4f80ea=[];if(_0x96868d){var _0x28c5f0;for(var _0x429724=0x0,_0x3eb094;_0x429724<_0x96868d[_0x6158('0x1b')];_0x429724+=0x1){_0x3eb094=_0x96868d[_0x429724][_0x6158('0x50')]({'plain':!![]});_0x4f80ea[_0x6158('0x2f')](db['sequelize'][_0x6158('0x52')](_0x5bbc26(_0x3eb094,_0x6158('0x53')))['then'](function(){})[_0x6158('0x31')](_0x552fa0()));}}return _0x4f80ea;})[_0x6158('0x55')]();})[_0x6158('0x2e')](function(){return db['Campaign'][_0x6158('0x56')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6158('0x4f')],'as':_0x6158('0x59'),'where':{'id':LISTID}}]})[_0x6158('0x2e')](function(_0x6e9ed6){var _0x3d2506=[];if(_0x6e9ed6){for(var _0x324428=0x0,_0x126f7e;_0x324428<_0x6e9ed6[_0x6158('0x1b')];_0x324428+=0x1){_0x126f7e=_0x6e9ed6[_0x324428]['get']({'plain':!![]});switch(_0x126f7e['dialCheckDuplicateType']){case'always':_0x3d2506['push'](db[_0x6158('0x51')][_0x6158('0x52')](_0x177346(_0x126f7e,_0x6158('0x5a')))[_0x6158('0x2e')](function(){})['catch'](_0x552fa0()));break;case'onlyIfOpen':_0x3d2506[_0x6158('0x2f')](db[_0x6158('0x51')][_0x6158('0x52')](_0x455616(_0x126f7e,_0x6158('0x5a')))['then'](function(){})[_0x6158('0x31')](_0x552fa0()));break;default:_0x3d2506[_0x6158('0x2f')](db['sequelize']['query'](_0x29758d(_0x126f7e,_0x6158('0x5a')))['then'](function(){})[_0x6158('0x31')](_0x552fa0()));}}}return _0x3d2506;})[_0x6158('0x55')]();})[_0x6158('0x2e')](function(){return db[_0x6158('0x5b')][_0x6158('0x56')]({'attributes':['id'],'include':[{'model':db[_0x6158('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x411ed3){var _0x3b815b=[];if(_0x411ed3){for(var _0xfeb33f=0x0,_0x1bee33;_0xfeb33f<_0x411ed3[_0x6158('0x1b')];_0xfeb33f+=0x1){_0x1bee33=_0x411ed3[_0xfeb33f][_0x6158('0x50')]({'plain':!![]});_0x3b815b[_0x6158('0x2f')](db[_0x6158('0x51')]['query'](_0x5bbc26(_0x1bee33,'CampaignId'))['then'](function(){})[_0x6158('0x31')](_0x552fa0()));}}return _0x3b815b;})[_0x6158('0x55')]();})[_0x6158('0x31')](function(_0x319d01){logger['error'](_0x6158('0x5c'),_0x6158('0x5d'),_0x319d01[_0x6158('0x1d')]);});}var processPromises=function(_0x4aa4b8){return BPromise[_0x6158('0x55')](promises)[_0x6158('0x2e')](function(_0x8a0096){})[_0x6158('0x31')](function(_0x244923){logger[_0x6158('0x18')](_0x6158('0x5e'),JSON[_0x6158('0x33')](_0x244923));})[_0x6158('0x5f')](function(){socket['emit'](_0x6158('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4aa4b8){return _0x4aa4b8[_0x6158('0x61')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x6158('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x6158('0x2e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6158('0x62')](FILEPATH);}catch(_0x270bc3){logger[_0x6158('0x18')](_0x6158('0x63'),JSON['stringify'](_0x270bc3));}finally{process[_0x6158('0x64')](0x0);}});};process['on'](_0x6158('0x65'),function(){logger[_0x6158('0x66')](_0x6158('0x67'));endCsv();});function main(){return BPromise[_0x6158('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6158('0x12')](',');return db[_0x6158('0x2b')][_0x6158('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6158('0x2e')](function(_0x3c59f4){var _0x5d14c2=fs[_0x6158('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6158('0x6a')](_0x5d14c2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ac5a9,_0x5c558f){total+=0x1;var _0x447883=total;promises[_0x6158('0x2f')](checkRow(_0x5ac5a9,_0x3c59f4,_0x447883)[_0x6158('0x2e')](function(){success+=0x1;})[_0x6158('0x31')](function(_0x28bc6f){if(_0x28bc6f[_0x6158('0x18')]){errors+=0x1;delete _0x28bc6f[_0x6158('0x18')];}else if(_0x28bc6f[_0x6158('0x2a')]){duplicates+=0x1;delete _0x28bc6f[_0x6158('0x2a')];}rows[_0x6158('0x2f')](_0x28bc6f);}));if(total%0xc8===0x0){_0x5c558f['pause']();return processPromises(_0x5c558f);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x6158('0x6b'));endCsv();});},'error':function(_0x459214,_0xbcb3a7){logger[_0x6158('0x66')]('CSV\x20parse\x20error',JSON[_0x6158('0x33')](_0x459214));endCsv();}});})[_0x6158('0x31')](function(_0xe16af6){logger[_0x6158('0x18')](_0x6158('0x6c'),JSON[_0x6158('0x33')](_0xe16af6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 36dc96e..ea08be6 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 _0xb577=['voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','sequelize','main','stringify','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','SystemRow','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','affectedRows','unlink','complete','arguments\x20\x20\x20','argv','existsSync','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','where','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','create','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','into','cm_hopper_black','fromQuery','.CmListId','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.ListId\x20=\x20','\x22always\x22','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','group','info','error','exit','message','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xb577,0xfc));var _0x7b57=function(_0x46efe8,_0x162b4f){_0x46efe8=_0x46efe8-0x0;var _0x29f07e=_0xb577[_0x46efe8];return _0x29f07e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x7b57('0x0'));var Papa=require(_0x7b57('0x1'));var util=require(_0x7b57('0x2'));var BPromise=require('bluebird');var moment=require(_0x7b57('0x3'));var squel=require(_0x7b57('0x4'));var Redis=require('ioredis');var db=require(_0x7b57('0x5'))['db'];var config=require(_0x7b57('0x6'));var shared=require(_0x7b57('0x7'));var logger=require('../../../config/logger')(_0x7b57('0x8'));config['redis']=_[_0x7b57('0x9')](config[_0x7b57('0xa')],{'host':_0x7b57('0xb'),'port':0x18eb});var socket=require(_0x7b57('0xc'))(new Redis(config[_0x7b57('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7b57('0xd')](_0x7b57('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x526daa){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))*$/[_0x7b57('0xf')](_0x526daa);}function selectNotIn(_0x5864fe,_0x5b7914,_0x5ee86c,_0x3d8b10,_0x15a178){return squel[_0x7b57('0x10')]()['field'](_0x7b57('0x11'))[_0x7b57('0x12')](_0x3d8b10)[_0x7b57('0x13')](_0x5b7914,null,_0x5b7914+'.id\x20=\x20'+_0x3d8b10+'.'+_0x5ee86c)[_0x7b57('0x14')](_0x3d8b10+'.'+_0x5ee86c+'\x20=\x20'+_0x5864fe+'.'+_0x5ee86c)[_0x7b57('0x14')](_0x5b7914+'.dialCheckDuplicateType\x20IN\x20('+_0x15a178[_0x7b57('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x375af7,_0x3b12af){promisesAdditionalPhones=[];return db[_0x7b57('0x15')][_0x7b57('0x16')]({'raw':!![],'attributes':['id',_0x7b57('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7b57('0x18')](function(_0x2856a4){if(_0x2856a4!==null){var _0x6e118a=[];for(var _0x42a078=0x0;_0x42a078<_0x2856a4[_0x7b57('0x19')];_0x42a078++){var _0x18be4a=_0x2856a4[_0x42a078];_0x6e118a[_0x7b57('0x1a')](insertAdditionalPhones(_0x18be4a));}}Promise[_0x7b57('0x1b')](_0x6e118a)[_0x7b57('0x18')](function(){_0x375af7({'val':0x1});});});});}function insertAdditionalPhones(_0x480f3b){return new Promise(function(_0x3d2bc7,_0x380af6){var _0x494029=_0x480f3b['AdditionalPhones'];var _0x4ba99d=_0x494029[_0x7b57('0x1c')](';');var _0x1fe5c6=[];orderBy=0x0;for(var _0x93578=0x0;_0x93578<_0x4ba99d['length'];_0x93578++){_0x1fe5c6[_0x7b57('0x1a')](splitAdditionalPhone(_0x480f3b['id'],_0x4ba99d[_0x93578]));}Promise[_0x7b57('0x1b')](_0x1fe5c6)[_0x7b57('0x18')](function(){_0x3d2bc7({'val':_0x4ba99d['length']});});});}function splitAdditionalPhone(_0x48b552,_0x407457){return new Promise(function(_0x3a8de6,_0x2f60fb){var _0x1607ad=_0x407457[_0x7b57('0x1c')](':');var _0x252ac4=_0x1607ad[0x0];var _0x4206fe=_0x1607ad[0x1];if(!_[_0x7b57('0x1d')](_0x4206fe)){var _0x1aeb06=_0x4206fe['split']('|');var _0x132971=[];for(var _0x4c7bd9=0x0;_0x4c7bd9<_0x1aeb06[_0x7b57('0x19')];_0x4c7bd9++){if(_0x1aeb06[_0x4c7bd9]!==''){var _0x47b398=_[_0x7b57('0x1e')](promisesAdditionalPhones,{'contactId':_0x48b552,'phone':_0x1aeb06[_0x4c7bd9]});if(_0x47b398['length']==0x0){orderBy++;promisesAdditionalPhones[_0x7b57('0x1a')]({'contactId':_0x48b552,'contactTypeId':_0x252ac4,'phone':_0x1aeb06[_0x4c7bd9],'orderBy':orderBy});}}}_0x3a8de6({'ok':0x1});}else _0x3a8de6({'res':0x0});});}function createAdditionalPhone(_0x17321a,_0x549a3c,_0x48ec89,_0x19d6f4){var _0x15253b='';var _0x5edb6d='';var _0x4ce914=_0x48ec89[_0x7b57('0x1c')]('§');_0x15253b=_0x4ce914[0x0];if(_0x4ce914[_0x7b57('0x19')]==0x2)_0x5edb6d=_0x4ce914[0x1];return new Promise(function(_0xb02853,_0x2a84d6){return db[_0x7b57('0x1f')][_0x7b57('0x20')]({'where':{'CmContactId':_0x17321a,'item':_0x15253b}})['then'](function(_0x10edce){if(_0x10edce){return db[_0x7b57('0x1f')]['update']({'ItemTypeId':_0x549a3c,'description':_0x5edb6d,'OrderBy':_0x19d6f4},{'where':{'CmContactId':_0x17321a,'item':_0x15253b}})[_0x7b57('0x18')](function(_0xaea3ac){_0xb02853({'res':'updated'});});}else{return db[_0x7b57('0x1f')][_0x7b57('0x21')]({'CmContactId':_0x17321a,'item':_0x15253b,'description':_0x5edb6d,'ItemTypeId':_0x549a3c,'OrderBy':_0x19d6f4,'ItemClass':_0x7b57('0x22')})[_0x7b57('0x18')](function(_0x5ee99d){_0xb02853({'res':'inserted'});});}});});}function insertCmHopper(_0x464066,_0x1b683e,_0x44a455,_0x1c392d,_0x5866d9){var _0x4d15c8=['cm_contacts.phone',_0x7b57('0x23'),_0x7b57('0x24'),_0x7b57('0x25'),_0x1b683e+'.'+_0x1c392d,'cm_contacts.createdAt',_0x7b57('0x26'),_0x7b57('0x27'),_0x7b57('0x28'),'\x22'+_0x5866d9+'\x22'];return squel[_0x7b57('0x29')]()['into'](_0x7b57('0x2a'))['fromQuery']([_0x7b57('0x11'),_0x7b57('0x2b'),_0x7b57('0x2c'),_0x7b57('0x2d'),_0x1c392d,_0x7b57('0x2e'),_0x7b57('0x2f'),_0x7b57('0x30'),_0x7b57('0x31'),'recallme'],squel[_0x7b57('0x10')]()[_0x7b57('0x32')](_0x4d15c8)[_0x7b57('0x12')](_0x1b683e)['join'](_0x7b57('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x1b683e+'.CmListId')[_0x7b57('0x13')](_0x44a455,null,_0x44a455+_0x7b57('0x34')+_0x1b683e+'.'+_0x1c392d)['where'](_0x1b683e+_0x7b57('0x35'),_0x464066)[_0x7b57('0x14')](_0x7b57('0x36'),NOW)[_0x7b57('0x14')](_0x7b57('0x37'),selectNotIn(_0x1b683e,_0x44a455,_0x1c392d,_0x7b57('0x2a'),['\x22always\x22',_0x7b57('0x38')]))[_0x7b57('0x14')](_0x7b57('0x37'),selectNotIn(_0x1b683e,_0x44a455,_0x1c392d,'cm_hopper',['\x22always\x22'])))[_0x7b57('0x39')]();}function insertCmHopperBlack(_0x5ec97c,_0x22cf05,_0x1d3d18,_0x57ce25){var _0x344994=[_0x7b57('0x3a'),'cm_contacts.id',_0x7b57('0x25'),_0x22cf05+'.'+_0x57ce25,_0x7b57('0x3b'),_0x7b57('0x26')];return squel[_0x7b57('0x29')]()[_0x7b57('0x3c')](_0x7b57('0x3d'))[_0x7b57('0x3e')]([_0x7b57('0x11'),_0x7b57('0x2c'),'ListId',_0x57ce25,'createdAt',_0x7b57('0x2f')],squel['select']()[_0x7b57('0x32')](_0x344994)[_0x7b57('0x12')](_0x22cf05)[_0x7b57('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x22cf05+_0x7b57('0x3f'))[_0x7b57('0x13')](_0x1d3d18,null,_0x1d3d18+_0x7b57('0x34')+_0x22cf05+'.'+_0x57ce25)[_0x7b57('0x14')](_0x22cf05+_0x7b57('0x35'),_0x5ec97c)[_0x7b57('0x14')](_0x7b57('0x36'),NOW)['where'](_0x7b57('0x37'),squel[_0x7b57('0x10')]()['field'](_0x7b57('0x11'))[_0x7b57('0x12')]('cm_hopper_black')[_0x7b57('0x14')]('ListId\x20=\x20?',_0x5ec97c)[_0x7b57('0x14')](_0x57ce25+_0x7b57('0x40')+_0x22cf05+'.'+_0x57ce25)))[_0x7b57('0x39')]();}function insertTzCmHopper(_0x3486bf,_0x246e9e,_0x11e6bc,_0x3fed7a,_0x35e3ad,_0x44e3a7){var _0x277ca0=[_0x7b57('0x3a'),_0x7b57('0x41')+_0x44e3a7+'.offset-cm_contacts.utcOffset\x20minute)',_0x7b57('0x24'),_0x7b57('0x25'),_0x246e9e+'.'+_0x3fed7a,_0x7b57('0x3b'),_0x7b57('0x26'),_0x7b57('0x27'),_0x7b57('0x28'),'\x22'+_0x35e3ad+'\x22'];var _0x2165c8=squel['insert']()[_0x7b57('0x3c')](_0x7b57('0x2a'))['fromQuery']([_0x7b57('0x11'),_0x7b57('0x2b'),_0x7b57('0x2c'),'ListId',_0x3fed7a,_0x7b57('0x2e'),_0x7b57('0x2f'),_0x7b57('0x30'),'UserId','recallme'],squel['select']()['fields'](_0x277ca0)[_0x7b57('0x12')](_0x246e9e)[_0x7b57('0x13')]('cm_contacts',null,_0x7b57('0x42')+_0x246e9e+_0x7b57('0x3f'))[_0x7b57('0x13')](_0x11e6bc,null,_0x11e6bc+_0x7b57('0x34')+_0x246e9e+'.'+_0x3fed7a)['join'](_0x44e3a7,null,_0x44e3a7+_0x7b57('0x34')+_0x246e9e+'.'+_0x3fed7a)[_0x7b57('0x14')](_0x246e9e+_0x7b57('0x35'),_0x3486bf)[_0x7b57('0x14')](_0x7b57('0x36'),NOW)[_0x7b57('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x246e9e,_0x11e6bc,_0x3fed7a,_0x7b57('0x2a'),[_0x7b57('0x43'),'\x22onlyIfOpen\x22']))[_0x7b57('0x14')](_0x7b57('0x37'),selectNotIn(_0x246e9e,_0x11e6bc,_0x3fed7a,'cm_hopper',['\x22always\x22'])))[_0x7b57('0x39')]();return _0x2165c8;}function insertTzCmHopperBlack(_0x4fbe95,_0x51dccf,_0x46c403,_0x4dba){var _0x283689=[_0x7b57('0x3a'),_0x7b57('0x24'),_0x7b57('0x25'),_0x51dccf+'.'+_0x4dba,_0x7b57('0x3b'),_0x7b57('0x26')];return squel[_0x7b57('0x29')]()[_0x7b57('0x3c')]('cm_hopper_black')[_0x7b57('0x3e')]([_0x7b57('0x11'),_0x7b57('0x2c'),_0x7b57('0x2d'),_0x4dba,'createdAt',_0x7b57('0x2f')],squel[_0x7b57('0x10')]()['fields'](_0x283689)[_0x7b57('0x12')](_0x51dccf)[_0x7b57('0x13')](_0x7b57('0x33'),null,_0x7b57('0x42')+_0x51dccf+_0x7b57('0x3f'))['join'](_0x46c403,null,_0x46c403+_0x7b57('0x34')+_0x51dccf+'.'+_0x4dba)[_0x7b57('0x14')](_0x51dccf+_0x7b57('0x35'),_0x4fbe95)[_0x7b57('0x14')](_0x7b57('0x36'),NOW)[_0x7b57('0x14')](_0x7b57('0x37'),squel[_0x7b57('0x10')]()[_0x7b57('0x44')](_0x7b57('0x11'))[_0x7b57('0x12')](_0x7b57('0x3d'))[_0x7b57('0x14')]('ListId\x20=\x20?',_0x4fbe95)[_0x7b57('0x14')](_0x4dba+_0x7b57('0x40')+_0x51dccf+'.'+_0x4dba)))['toString']();}function insertCmHopperAdditionalPhones(_0xfef8f3){var _0x3fd73b=[_0x7b57('0x45'),_0x7b57('0x46'),_0x7b57('0x47'),_0x7b57('0x48'),_0x7b57('0x49')];return squel[_0x7b57('0x29')]()[_0x7b57('0x3c')](_0x7b57('0x4a'))[_0x7b57('0x3e')]([_0x7b57('0x4b'),_0x7b57('0x11'),_0x7b57('0x4c'),_0x7b57('0x2e'),_0x7b57('0x2f')],squel[_0x7b57('0x10')]()[_0x7b57('0x32')](_0x3fd73b)[_0x7b57('0x12')](_0x7b57('0x2a'))[_0x7b57('0x13')](_0x7b57('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x7b57('0x13')](_0x7b57('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x7b57('0x4e'),_0xfef8f3)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x7b57('0x39')]();}function insertCmContact(_0x44efcb,_0xdf79ab,_0xc0175f,_0x2b31a4){var _0x585286=_['concat'](_[_0x7b57('0x4f')](_0x2b31a4),[_0x7b57('0x2d'),_0x7b57('0x50'),_0x7b57('0x2e'),_0x7b57('0x2f'),_0x7b57('0x51')]);return squel[_0x7b57('0x29')]()[_0x7b57('0x3c')](_0x7b57('0x33'))[_0x7b57('0x3e')](_0x585286,squel[_0x7b57('0x10')]()[_0x7b57('0x32')](_0x585286)[_0x7b57('0x12')](_0xdf79ab)[_0x7b57('0x14')]('('+_0xc0175f[_0x7b57('0x13')](',')+_0x7b57('0x52'),squel[_0x7b57('0x10')]()[_0x7b57('0x32')](_0xc0175f)[_0x7b57('0x12')](_0x7b57('0x33'))['where'](_0x7b57('0x53'),_0x44efcb)[_0x7b57('0x14')]('deletedAt\x20IS\x20NULL'))[_0x7b57('0x14')](_0x7b57('0x54'),squel['select']()[_0x7b57('0x44')]('MIN(id)','min_id')[_0x7b57('0x12')](_0xdf79ab)[_0x7b57('0x55')](_0xc0175f[_0x7b57('0x13')](','))))[_0x7b57('0x39')]();}function handleStop(){logger[_0x7b57('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1c524a){logger[_0x7b57('0x57')](_0x1c524a['message']);process[_0x7b57('0x58')](0x1);}function handleError(_0x5069c5,_0x2c647f){stats['errors'][_0x7b57('0x1a')]({'name':_0x2c647f['code'],'message':_0x2c647f[_0x7b57('0x59')],'row':_0x5069c5});}function handleQuery(_0x1ec29e){logger['info'](_0x1ec29e);return db['sequelize'][_0x7b57('0x5a')](_0x1ec29e)[_0x7b57('0x5b')](function(_0x383c22){results['push'](_0x383c22);})[_0x7b57('0x5c')](function(_0x594383){logger[_0x7b57('0x57')](_0x594383[_0x7b57('0x59')]);});}function updateTzCampaigns(_0x198f82){return new Promise(function(_0x573c4b,_0xa1c33a){var _0x454708=squel[_0x7b57('0x10')]()[_0x7b57('0x32')](['campaigns.id',_0x7b57('0x5d')])['from'](_0x7b57('0x5e'))['join'](_0x7b57('0x5f'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x7b57('0x14')](_0x7b57('0x60')+_0x198f82);db['sequelize']['query'](_0x454708['toString']())[_0x7b57('0x5b')](function(_0x2c8c17){var _0x1006ba=[];for(var _0xb4c9d3=0x0;_0xb4c9d3<_0x2c8c17[_0x7b57('0x19')];_0xb4c9d3++){_0x1006ba[_0x7b57('0x1a')](getTimezoneData(_0x2c8c17[_0xb4c9d3],tmp_campaigns));}BPromise[_0x7b57('0x1b')](_0x1006ba)[_0x7b57('0x18')](function(){_0x573c4b({'val':0x1});});})[_0x7b57('0x5c')](function(_0x4d580c){logger[_0x7b57('0x57')](_0x4d580c['message']);_0x573c4b({'val':0x0});});});}function updateTzVoiceQueues(_0x2da92e){return new Promise(function(_0x1737cd,_0xb1720){var _0x39d4f8=squel[_0x7b57('0x10')]()['fields'](['voice_queues.id',_0x7b57('0x61')])[_0x7b57('0x12')]('voice_queues')[_0x7b57('0x13')](_0x7b57('0x62'),null,_0x7b57('0x63'))[_0x7b57('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x2da92e);db['sequelize'][_0x7b57('0x5a')](_0x39d4f8[_0x7b57('0x39')]())[_0x7b57('0x5b')](function(_0x5911b4){var _0x597560=[];for(var _0x16b57d=0x0;_0x16b57d<_0x5911b4['length'];_0x16b57d++){_0x597560[_0x7b57('0x1a')](getTimezoneData(_0x5911b4[_0x16b57d],tmp_voice_queues));}BPromise['all'](_0x597560)[_0x7b57('0x18')](function(){_0x1737cd({'val':0x1});});})[_0x7b57('0x5c')](function(_0x874daa){logger[_0x7b57('0x57')](_0x874daa[_0x7b57('0x59')]);_0x1737cd({'val':0x0});});});}function getTimezoneData(_0x49455b,_0xb8e15a){return new Promise(function(_0x37099c,_0xc788f6){var _0xd5ded5=shared[_0x7b57('0x64')];var _0x5b35c3=_0xd5ded5[_0x49455b[_0x7b57('0x65')]];if(_[_0x7b57('0x1d')](_0x5b35c3)){_0x37099c({'ret':0x1});}else{var _0x2469ab=_0x5b35c3[_0x7b57('0x66')];var _0xf1e64=squel[_0x7b57('0x29')]()[_0x7b57('0x3c')](_0xb8e15a)['set']('id',_0x49455b['id'])[_0x7b57('0x67')](_0x7b57('0x68'),_0x2469ab)[_0x7b57('0x67')](_0x7b57('0x65'),_0x49455b[_0x7b57('0x65')])[_0x7b57('0x39')]();return db['sequelize']['query'](_0xf1e64)[_0x7b57('0x5b')](function(_0x339d4c){_0x37099c({'ret':0x1});})['catch'](function(_0x143843){logger[_0x7b57('0x57')](_0x143843[_0x7b57('0x59')]);_0xc788f6({'ret':0x1});});}});}function handleTZQuery(_0x5b2caa){logger['info'](_0x5b2caa);return db[_0x7b57('0x69')][_0x7b57('0x5a')](_0x5b2caa)[_0x7b57('0x5b')](function(_0x108edf){})[_0x7b57('0x5c')](function(_0x61ad12){logger[_0x7b57('0x57')](_0x61ad12[_0x7b57('0x59')]);});}function main(_0x3a4793,_0x40b60a,_0x705410,_0x3301ea){logger[_0x7b57('0x56')](_0x7b57('0x6a'),_0x3a4793,JSON[_0x7b57('0x6b')](_0x40b60a));process['send']('start');var _0x31549a=_0x40b60a['binding'];var _0x2ac9b9=_[_0x7b57('0x6c')](_0x31549a);var _0x34c152=_0x40b60a[_0x7b57('0x6d')];var _0x56f7d0=path[_0x7b57('0x13')](config[_0x7b57('0x6e')],_0x7b57('0x6f'),_0x34c152+_0x7b57('0x70'));hasTZ=_['keys'](_0x31549a)['includes'](_0x7b57('0x65'));var _0x42578b=_[_0x7b57('0x4f')](_0x31549a)['join']();logger['info']('header',_0x42578b);db[_0x7b57('0x71')][_0x7b57('0x16')]({'raw':!![],'attributes':['id',_0x7b57('0x72')]})[_0x7b57('0x18')](function(_0x7dcdd5){for(var _0x46bd7a=0x0;_0x46bd7a<_0x7dcdd5[_0x7b57('0x19')];_0x46bd7a++){if(_0x7dcdd5[_0x46bd7a][_0x7b57('0x72')]in _0x31549a){contactItemTypes[_0x7b57('0x1a')](_0x7dcdd5[_0x46bd7a]);delete _0x2ac9b9[_0x7dcdd5[_0x46bd7a][_0x7b57('0x72')]];hasAdditionalPhones=!![];}for(var _0x520a5c in _0x31549a){if(_0x7dcdd5[_0x46bd7a][_0x7b57('0x72')]+_0x7b57('0x73')===_0x520a5c){phoneDescriptions[_0x7b57('0x1a')]({'itemTypeId':_0x7dcdd5[_0x46bd7a]['id'],'description':_0x520a5c});delete _0x2ac9b9[_0x520a5c];}}}if(hasAdditionalPhones)_0x2ac9b9[_0x7b57('0x17')]='';var _0x2b6b47=_[_0x7b57('0x4f')](_0x2ac9b9)[_0x7b57('0x13')]();logger['info']('header',_0x2b6b47);fs[_0x7b57('0x74')](_0x56f7d0,_0x2b6b47+'\x0a');Papa[_0x7b57('0x75')](fs[_0x7b57('0x76')](_0x3a4793),{'header':!![],'skipEmptyLines':!![],'step':function(_0x28ca79,_0x5b2d17){try{for(var _0x5b020d=0x0,_0x27b6eb=[];_0x5b020d<_0x28ca79[_0x7b57('0x77')][_0x7b57('0x19')];_0x5b020d++){stats[_0x7b57('0x78')]+=0x1;if(_0x28ca79[_0x7b57('0x79')][_0x5b020d]){handleError(_0x28ca79[_0x7b57('0x77')][_0x5b020d],_0x28ca79[_0x7b57('0x79')][_0x5b020d]);}else{var _0x24ea91=[];var _0x2043ef=[];var _0x47baf1={};for(var _0x3da473 in _0x31549a){let _0x3c3e8c=contactItemTypes[_0x7b57('0x7a')](_0x2b24f0=>_0x2b24f0[_0x7b57('0x72')]===_0x3da473);let _0x539088=contactItemTypes['find'](_0x10e089=>_0x10e089['name']+'_description'===_0x3da473);if(_[_0x7b57('0x1d')](_0x3c3e8c)&&_[_0x7b57('0x1d')](_0x539088)){if(_0x31549a[_0x7b57('0x7b')](_0x3da473)){if(_0x28ca79[_0x7b57('0x77')][_0x5b020d][_0x31549a[_0x3da473]]){var _0xe1a923=_[_0x7b57('0x7c')](_0x28ca79[_0x7b57('0x77')][_0x5b020d][_0x31549a[_0x3da473]][_0x7b57('0x7d')](/"/g,'\x27'));switch(_0x3da473){case _0x7b57('0x2b'):var _0x503b6a=moment(_0xe1a923,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x503b6a[_0x7b57('0x7e')]()){_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0xe1a923+'\x22');}else{_0x24ea91[_0x7b57('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7b57('0x30'):var _0x10d1f1=parseInt(_0xe1a923);_0xe1a923=_[_0x7b57('0x7f')](_0x10d1f1)||_0x10d1f1<0x0||_0x10d1f1>0x4?_0x3301ea?0x3:0x2:_0x10d1f1;_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0xe1a923+'\x22');break;case _0x7b57('0x31'):var _0x38b05c=parseInt(_0xe1a923);if(_[_0x7b57('0x80')](_0x38b05c)&&_['includes'](_0x705410,_0x38b05c)){_0x27b6eb['push']('\x22'+_0x38b05c+'\x22');}else{_0x24ea91[_0x7b57('0x1a')](_0x7b57('0x81'));}break;case _0x7b57('0x82'):if(isEmail(_0xe1a923)){_0x27b6eb['push']('\x22'+_0xe1a923+'\x22');}else{_0x24ea91[_0x7b57('0x1a')](_0x7b57('0x83'));}break;case _0x7b57('0x84'):var _0x127bf4=moment(_0xe1a923,_0x7b57('0x85'),!![]);if(_0x127bf4['isValid']()){_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0xe1a923+'\x22');}else{_0x24ea91[_0x7b57('0x1a')](_0x7b57('0x86'));}break;case _0x7b57('0x65'):var _0x397cf8=shared[_0x7b57('0x64')];var _0x56cf73=_0x397cf8[_0xe1a923];if(!_['isNil'](_0x56cf73)){var _0x51083c=_0x56cf73[_0x7b57('0x66')];_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0xe1a923+'\x22');_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0x51083c+'\x22');}break;default:_0x27b6eb['push']('\x22'+_0xe1a923+'\x22');}}else{switch(_0x3da473){case _0x7b57('0x87'):case _0x7b57('0x11'):_0x24ea91[_0x7b57('0x1a')](_0x3da473+_0x7b57('0x88'));break;default:_0x27b6eb[_0x7b57('0x1a')]('\x22\x22');}}}}else{var _0x98d72b='';if(!_[_0x7b57('0x1d')](_0x3c3e8c)){if(!_0x47baf1['hasOwnProperty'](_0x3c3e8c['id'])){if(!_['isNil'](_0x28ca79[_0x7b57('0x77')][_0x5b020d][_0x31549a[_0x3da473]])){var _0xe1a923=_['trim'](_0x28ca79['data'][_0x5b020d][_0x31549a[_0x3da473]][_0x7b57('0x7d')](/"/g,'\x27'));var _0xe7814a=phoneDescriptions[_0x7b57('0x7a')](_0x44e0ce=>_0x44e0ce[_0x7b57('0x89')]===_0x3c3e8c['id']);if(!_['isNil'](_0xe7814a)){var _0x442171=_[_0x7b57('0x7c')](_0x28ca79['data'][_0x5b020d][_0x31549a[_0xe7814a['description']]][_0x7b57('0x7d')](/"/g,'\x27'));if(!_['isNil'](_0x442171))_0xe1a923=_0xe1a923+'§'+_0x442171;}if(_0x98d72b=='')_0x98d72b=_0xe1a923;else _0x98d72b+='|'+_0xe1a923;}_0x2043ef['push'](_0x3c3e8c['id']+':'+_0x98d72b);_0x47baf1[_0x3c3e8c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x27b6eb[_0x7b57('0x1a')]('\x22'+_0x2043ef[_0x7b57('0x13')](';')+'\x22');}if(_0x24ea91[_0x7b57('0x19')]){handleError(_0x28ca79['data'][_0x5b020d],{'code':_0x7b57('0x8a'),'message':_0x24ea91[_0x7b57('0x13')]()});}else{fs['appendFileSync'](_0x56f7d0,_0x27b6eb[_0x7b57('0x13')]()+'\x0a');}_0x27b6eb=[];}if(!(stats[_0x7b57('0x78')]%0xc8)){socket[_0x7b57('0x8b')](_0x7b57('0x8c')+_0x34c152,stats);stats[_0x7b57('0x79')]=[];}}if(stopped){logger[_0x7b57('0x56')]('Abort\x20parser');_0x5b2d17[_0x7b57('0x8d')]();}}catch(_0x10c31f){handleError(_0x28ca79[_0x7b57('0x77')][_0x5b020d],{'code':_0x7b57('0x8e'),'message':_0x10c31f[_0x7b57('0x59')]});logger['error'](_0x7b57('0x8f'),_0x10c31f['message']);}},'complete':function(){try{var _0x2a0a50=[];var _0x13f64c=[];var _0x570272=_0x7b57('0x33');if(_0x40b60a['duplicates']&&_0x40b60a[_0x7b57('0x90')][_0x7b57('0x19')]){_0x570272=_0x7b57('0x91')+_0x34c152;_0x2a0a50['push']('CREATE\x20TABLE\x20'+_0x570272+_0x7b57('0x92'));}tmp_campaigns='campaigns_'+_0x34c152;tmp_voice_queues=_0x7b57('0x93')+_0x34c152;_0x13f64c[_0x7b57('0x1a')](_0x7b57('0x94')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x13f64c[_0x7b57('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x7b57('0x95'));BPromise[_0x7b57('0x96')](_0x13f64c,handleTZQuery)[_0x7b57('0x18')](function(_0x5d743d){updateTzCampaigns(_0x40b60a[_0x7b57('0x2d')])['then'](function(_0x430668){updateTzVoiceQueues(_0x40b60a[_0x7b57('0x2d')])['then'](function(_0x26d4dc){if(hasTZ)_0x2b6b47=_0x2b6b47[_0x7b57('0x7d')]('dialTimezone',_0x7b57('0x97'));var _0x5eaf9e=util['format'](_0x7b57('0x98'),_0x56f7d0,_0x570272,_0x2b6b47,_0x40b60a[_0x7b57('0x2d')],_0x40b60a[_0x7b57('0x50')]||null,NOW,NOW);if(_['isNil'](_0x31549a[_0x7b57('0x2b')])){_0x5eaf9e+=',\x20scheduledAt\x20=\x20NOW()';}_0x2a0a50[_0x7b57('0x1a')](_0x5eaf9e);if(_0x40b60a[_0x7b57('0x90')]&&_0x40b60a[_0x7b57('0x90')]['length']){_0x2a0a50['push'](insertCmContact(_0x40b60a[_0x7b57('0x2d')],_0x570272,_0x40b60a[_0x7b57('0x90')],_0x31549a));_0x2a0a50[_0x7b57('0x1a')]('DROP\x20TABLE\x20'+_0x570272+';');}BPromise[_0x7b57('0x96')](_0x2a0a50,handleQuery)['then'](function(_0x7b0e11){BPromise[_0x7b57('0x1b')]([handleAdditionalPhones()])[_0x7b57('0x18')](function(){_0x2a0a50=[];for(var _0x8c1fa7=0x0;_0x8c1fa7_0x388b0c['name']===_0x4e1f4c);let _0x308bd5=contactItemTypes[_0xfd9a('0x7d')](_0x2a2ce1=>_0x2a2ce1[_0xfd9a('0x75')]+_0xfd9a('0x76')===_0x4e1f4c);if(_[_0xfd9a('0x1b')](_0x22752c)&&_[_0xfd9a('0x1b')](_0x308bd5)){if(_0xe96dbb[_0xfd9a('0x7e')](_0x4e1f4c)){if(_0x4fa1bd['data'][_0x373d05][_0xe96dbb[_0x4e1f4c]]){var _0x20f883=_[_0xfd9a('0x7f')](_0x4fa1bd['data'][_0x373d05][_0xe96dbb[_0x4e1f4c]][_0xfd9a('0x80')](/"/g,'\x27'));switch(_0x4e1f4c){case _0xfd9a('0x2b'):var _0x1fd0f9=moment(_0x20f883,_0xfd9a('0xc'),!![]);if(_0x1fd0f9[_0xfd9a('0x81')]()){_0x154f5b['push']('\x22'+_0x20f883+'\x22');}else{_0x2722c6[_0xfd9a('0x17')](_0xfd9a('0x82'));}break;case _0xfd9a('0x2f'):var _0x1a790c=parseInt(_0x20f883);_0x20f883=_[_0xfd9a('0x83')](_0x1a790c)||_0x1a790c<0x0||_0x1a790c>0x4?_0x3ad7eb?0x3:0x2:_0x1a790c;_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x20f883+'\x22');break;case _0xfd9a('0x30'):var _0x574088=parseInt(_0x20f883);if(_['isNumber'](_0x574088)&&_[_0xfd9a('0x72')](_0x53b19d,_0x574088)){_0x154f5b['push']('\x22'+_0x574088+'\x22');}else{_0x2722c6[_0xfd9a('0x17')](_0xfd9a('0x84'));}break;case _0xfd9a('0x85'):if(isEmail(_0x20f883)){_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x20f883+'\x22');}else{_0x2722c6[_0xfd9a('0x17')](_0xfd9a('0x86'));}break;case'dateOfBirth':var _0x5eaa5b=moment(_0x20f883,_0xfd9a('0x87'),!![]);if(_0x5eaa5b['isValid']()){_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x20f883+'\x22');}else{_0x2722c6[_0xfd9a('0x17')](_0xfd9a('0x88'));}break;case'dialTimezone':var _0x4241f1=shared[_0xfd9a('0x67')];var _0x4215d9=_0x4241f1[_0x20f883];if(!_['isNil'](_0x4215d9)){var _0x65410a=_0x4215d9['utcOffset'];_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x20f883+'\x22');_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x65410a+'\x22');}break;default:_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x20f883+'\x22');}}else{switch(_0x4e1f4c){case _0xfd9a('0x89'):case _0xfd9a('0xe'):_0x2722c6['push'](_0x4e1f4c+'\x20not\x20specified');break;default:_0x154f5b[_0xfd9a('0x17')]('\x22\x22');}}}}else{var _0x35a182='';if(!_[_0xfd9a('0x1b')](_0x22752c)){if(!_0x308fb9[_0xfd9a('0x7e')](_0x22752c['id'])){if(!_[_0xfd9a('0x1b')](_0x4fa1bd['data'][_0x373d05][_0xe96dbb[_0x4e1f4c]])){var _0x20f883=_['trim'](_0x4fa1bd[_0xfd9a('0x7b')][_0x373d05][_0xe96dbb[_0x4e1f4c]]['replace'](/"/g,'\x27'));var _0x43b75f=phoneDescriptions[_0xfd9a('0x7d')](_0x1728e5=>_0x1728e5[_0xfd9a('0x8a')]===_0x22752c['id']);if(!_[_0xfd9a('0x1b')](_0x43b75f)){var _0x13bb38=_[_0xfd9a('0x7f')](_0x4fa1bd[_0xfd9a('0x7b')][_0x373d05][_0xe96dbb[_0x43b75f['description']]][_0xfd9a('0x80')](/"/g,'\x27'));if(!_[_0xfd9a('0x1b')](_0x13bb38))_0x20f883=_0x20f883+'§'+_0x13bb38;}if(_0x35a182=='')_0x35a182=_0x20f883;else _0x35a182+='|'+_0x20f883;}_0x5edba0['push'](_0x22752c['id']+':'+_0x35a182);_0x308fb9[_0x22752c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x154f5b[_0xfd9a('0x17')]('\x22'+_0x5edba0[_0xfd9a('0xf')](';')+'\x22');}if(_0x2722c6[_0xfd9a('0x16')]){handleError(_0x4fa1bd['data'][_0x373d05],{'code':_0xfd9a('0x8b'),'message':_0x2722c6[_0xfd9a('0xf')]()});}else{fs['appendFileSync'](_0xd79146,_0x154f5b[_0xfd9a('0xf')]()+'\x0a');}_0x154f5b=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xfd9a('0x8c')+_0x13568a,stats);stats[_0xfd9a('0x59')]=[];}}if(stopped){logger[_0xfd9a('0x5b')](_0xfd9a('0x8d'));_0x2ad6ba[_0xfd9a('0x8e')]();}}catch(_0x55c0ab){handleError(_0x4fa1bd[_0xfd9a('0x7b')][_0x373d05],{'code':_0xfd9a('0x8f'),'message':_0x55c0ab['message']});logger[_0xfd9a('0x56')](_0xfd9a('0x90'),_0x55c0ab[_0xfd9a('0x57')]);}},'complete':function(){try{var _0x2f5281=[];var _0x5dc54a=[];var _0x29ecdc=_0xfd9a('0x34');if(_0x2058fa['duplicates']&&_0x2058fa[_0xfd9a('0x91')][_0xfd9a('0x16')]){_0x29ecdc='cm_contacts_'+_0x13568a;_0x2f5281[_0xfd9a('0x17')]('CREATE\x20TABLE\x20'+_0x29ecdc+_0xfd9a('0x92'));}tmp_campaigns='campaigns_'+_0x13568a;tmp_voice_queues=_0xfd9a('0x93')+_0x13568a;_0x5dc54a['push'](_0xfd9a('0x94')+tmp_campaigns+_0xfd9a('0x95'));_0x5dc54a[_0xfd9a('0x17')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xfd9a('0x95'));BPromise[_0xfd9a('0x96')](_0x5dc54a,handleTZQuery)[_0xfd9a('0x19')](function(_0x33e298){updateTzCampaigns(_0x2058fa[_0xfd9a('0x2d')])[_0xfd9a('0x19')](function(_0x27d79a){updateTzVoiceQueues(_0x2058fa[_0xfd9a('0x2d')])[_0xfd9a('0x19')](function(_0x609d55){if(hasTZ)_0x261763=_0x261763['replace'](_0xfd9a('0x6b'),_0xfd9a('0x97'));var _0x3e6bf9=util[_0xfd9a('0xb')](_0xfd9a('0x98'),_0xd79146,_0x29ecdc,_0x261763,_0x2058fa[_0xfd9a('0x2d')],_0x2058fa['CompanyId']||null,NOW,NOW);if(_[_0xfd9a('0x1b')](_0xe96dbb[_0xfd9a('0x2b')])){_0x3e6bf9+=_0xfd9a('0x99');}_0x2f5281[_0xfd9a('0x17')](_0x3e6bf9);if(_0x2058fa[_0xfd9a('0x91')]&&_0x2058fa['duplicates']['length']){_0x2f5281['push'](insertCmContact(_0x2058fa[_0xfd9a('0x2d')],_0x29ecdc,_0x2058fa[_0xfd9a('0x91')],_0xe96dbb));_0x2f5281[_0xfd9a('0x17')](_0xfd9a('0x9a')+_0x29ecdc+';');}BPromise[_0xfd9a('0x96')](_0x2f5281,handleQuery)[_0xfd9a('0x19')](function(_0x5e3c1f){BPromise[_0xfd9a('0x18')]([handleAdditionalPhones()])[_0xfd9a('0x19')](function(){_0x2f5281=[];for(var _0x2b600e=0x0;_0x2b600e\x20\x20');}var _0x5502e6=path[_0xfd9a('0xf')](config[_0xfd9a('0xaa')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0xfd9a('0xab')](_0x5502e6)){throw new Error(_0xfd9a('0xac'));}var _0x2c5f1a={};try{_0x2c5f1a=JSON[_0xfd9a('0x79')](process[_0xfd9a('0xa9')][0x3]);if(!_0x2c5f1a['binding']){throw new Error(_0xfd9a('0xad'));}if(!_0x2c5f1a['binding'][_0xfd9a('0xe')]){throw new Error(_0xfd9a('0xae'));}if(!_0x2c5f1a[_0xfd9a('0x6e')][_0xfd9a('0x89')]){throw new Error(_0xfd9a('0xaf'));}var _0x1447e5=0x0;if(_0x2c5f1a[_0xfd9a('0x6e')]['UserId']){_0x1447e5=0x1;}if(!_0x2c5f1a[_0xfd9a('0x2d')]){throw new Error(_0xfd9a('0xb0'));}}catch(_0xed529e){throw new Error(_0xfd9a('0xb1'));}var _0x11bc1f=[];try{_0x11bc1f=_[_0xfd9a('0xb2')](JSON[_0xfd9a('0x79')](process[_0xfd9a('0xa9')][0x4]),'id');}catch(_0xaa18b6){logger[_0xfd9a('0x5b')]('No\x20agent\x20available');}main(_0x5502e6,_0x2c5f1a,_0x11bc1f,_0x1447e5);}validate();process['on'](_0xfd9a('0xb3'),handleStop);process['on'](_0xfd9a('0xb4'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 7895429..255e973 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc15c=['step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','exit','complete','argv','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','squel','../../../config/environment','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','phone','join','where','sequelize','length','AdditionalPhones','push','catch','message','isNil','split','all','then','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','into','cm_hopper_black','createdAt','field','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','errors','code','query','spread','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','findAll','name','writeFileSync','parse','createReadStream','rows','data','find','_description','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','description','contact:import:','Abort\x20parser','SystemError'];(function(_0x64a88e,_0x246d56){var _0x3f7e15=function(_0x32008a){while(--_0x32008a){_0x64a88e['push'](_0x64a88e['shift']());}};_0x3f7e15(++_0x246d56);}(_0xc15c,0xae));var _0xcc15=function(_0x4aa62c,_0x4dd9d6){_0x4aa62c=_0x4aa62c-0x0;var _0x32afe8=_0xc15c[_0x4aa62c];return _0x32afe8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xcc15('0x0'));var util=require(_0xcc15('0x1'));var BPromise=require(_0xcc15('0x2'));var moment=require('moment');var squel=require(_0xcc15('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xcc15('0x4'));var logger=require('../../../config/logger')('import');config[_0xcc15('0x5')]=_[_0xcc15('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcc15('0x7'))(new Redis(config[_0xcc15('0x5')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xcc15('0x8')](_0xcc15('0x9'));var tempTableName=_0xcc15('0xa')+moment()['format'](_0xcc15('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x363e58){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))*$/[_0xcc15('0xc')](_0x363e58);}function selectNotIn(_0x391197,_0x55a853,_0x329add,_0x2bb966,_0x40dded){return squel['select']()['field'](_0xcc15('0xd'))['from'](_0x2bb966)[_0xcc15('0xe')](_0x55a853,null,_0x55a853+'.id\x20=\x20'+_0x2bb966+'.'+_0x329add)[_0xcc15('0xf')](_0x2bb966+'.'+_0x329add+'\x20=\x20'+_0x391197+'.'+_0x329add)[_0xcc15('0xf')](_0x55a853+'.dialCheckDuplicateType\x20IN\x20('+_0x40dded[_0xcc15('0xe')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1ffa48,_0xca9007){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcc15('0x10')]['query']('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x591c2f){if(_0x591c2f!==null){var _0x38ab87=[];for(var _0x343e21=0x0;_0x343e21<_0x591c2f[_0xcc15('0x11')];_0x343e21++){var _0x5d7926=_0x591c2f[_0x343e21];if(!_['isNil'](_0x5d7926[_0xcc15('0xd')])){if(!_['isNil'](_0x5d7926[_0xcc15('0x12')]))_0x38ab87[_0xcc15('0x13')](insertAdditionalPhones(_0x5d7926));promisesContact[_0xcc15('0x13')]({'contact':_0x5d7926});}}}Promise['all'](_0x38ab87)['then'](function(){_0x1ffa48({'val':0x1});});})[_0xcc15('0x14')](function(_0x46e67b){logger['error'](_0x46e67b[_0xcc15('0x15')]);});});}function insertAdditionalPhones(_0x3254a9){return new Promise(function(_0x3f574c,_0x4cf37e){var _0x3bff3e=_0x3254a9['AdditionalPhones'];if(_[_0xcc15('0x16')](_0x3bff3e))_0x4cf37e({'val':0x0});else{var _0x4949ed=_0x3bff3e[_0xcc15('0x17')](';');var _0xc49a73=[];orderBy=0x0;for(var _0x610317=0x0;_0x610317<_0x4949ed[_0xcc15('0x11')];_0x610317++){_0xc49a73['push'](splitAdditionalPhone(_0x3254a9['id'],_0x4949ed[_0x610317]));}Promise[_0xcc15('0x18')](_0xc49a73)[_0xcc15('0x19')](function(){_0x3f574c({'val':_0x4949ed[_0xcc15('0x11')]});});}});}function splitAdditionalPhone(_0x168ee9,_0x5cb463){return new Promise(function(_0x2a3e2b,_0x1a4f95){var _0x52a9d8=_0x5cb463['split'](':');var _0x2005d5=_0x52a9d8[0x0];var _0x3ebade=_0x52a9d8[0x1];if(_0x3ebade!==''){var _0xdd7f26=_0x3ebade[_0xcc15('0x17')]('|');var _0x5750d2=[];for(var _0x3cce80=0x0;_0x3cce80<_0xdd7f26[_0xcc15('0x11')];_0x3cce80++){if(_0xdd7f26[_0x3cce80]!==''){var _0x4f4af8=_[_0xcc15('0x1a')](promisesAdditionalPhones,{'contactId':_0x168ee9,'phone':_0xdd7f26[_0x3cce80]});if(_0x4f4af8['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x168ee9,'contactTypeId':_0x2005d5,'phone':_0xdd7f26[_0x3cce80],'orderBy':orderBy});}}}_0x2a3e2b({'ok':0x1});}else _0x2a3e2b({'res':0x0});});}function createAdditionalPhone(_0xb92104,_0x4ced34,_0x481c4e,_0x1333cd){var _0x182ef8='';var _0x24a6b9='';var _0x171a09=_0x481c4e[_0xcc15('0x17')]('§');_0x182ef8=_0x171a09[0x0];if(_0x171a09['length']==0x2)_0x24a6b9=_0x171a09[0x1];return new Promise(function(_0xd7a3b1,_0x37c14b){return db[_0xcc15('0x1b')][_0xcc15('0x1c')]({'where':{'CmContactId':_0xb92104,'item':_0x182ef8}})[_0xcc15('0x19')](function(_0x42a740){if(_0x42a740){return db[_0xcc15('0x1b')][_0xcc15('0x1d')]({'ItemTypeId':_0x4ced34,'description':_0x24a6b9,'OrderBy':_0x1333cd},{'where':{'CmContactId':_0xb92104,'item':_0x182ef8}})[_0xcc15('0x19')](function(_0x392fd8){_0xd7a3b1({'res':'updated'});});}else{return db['CmContactHasItem'][_0xcc15('0x1e')]({'CmContactId':_0xb92104,'item':_0x182ef8,'ItemTypeId':_0x4ced34,'description':_0x24a6b9,'OrderBy':_0x1333cd,'ItemClass':_0xcc15('0x1f')})[_0xcc15('0x19')](function(_0x264580){_0xd7a3b1({'res':_0xcc15('0x20')});});}});});}function updateContact(_0x184af6){return new Promise(function(_0x5f5575,_0x18ac74){var _0x520f4c=_0x184af6['id'];delete _0x184af6['id'];return db[_0xcc15('0x21')][_0xcc15('0x1d')](_0x184af6,{'where':{'id':_0x520f4c}})[_0xcc15('0x19')](function(_0x3bec5a){updatedRows+=0x1;return db[_0xcc15('0x22')][_0xcc15('0x1d')]({'phone':_0x184af6[_0xcc15('0xd')]},{'where':{'ContactId':_0x520f4c}})[_0xcc15('0x19')](function(_0x2926f4){_0x5f5575({'ret':'OK'});});});});}function insertCmHopper(_0x1bfbdb,_0x54fd37,_0xb0116,_0x2b6702,_0x36a190){var _0x1494f1=[_0xcc15('0x23'),'cm_contacts.scheduledat',_0xcc15('0x24'),_0xcc15('0x25'),_0x54fd37+'.'+_0x2b6702,_0xcc15('0x26'),'cm_contacts.updatedAt','cm_contacts.priority',_0xcc15('0x27'),'\x22'+_0x36a190+'\x22'];return squel[_0xcc15('0x28')]()['into'](_0xcc15('0x29'))['fromQuery']([_0xcc15('0xd'),_0xcc15('0x2a'),_0xcc15('0x2b'),_0xcc15('0x2c'),_0x2b6702,'createdAt',_0xcc15('0x2d'),_0xcc15('0x2e'),_0xcc15('0x2f'),_0xcc15('0x30')],squel[_0xcc15('0x31')]()[_0xcc15('0x32')](_0x1494f1)[_0xcc15('0x33')](_0x54fd37)[_0xcc15('0xe')](_0xcc15('0x34'),null,_0xcc15('0x35')+_0x54fd37+_0xcc15('0x36'))[_0xcc15('0xe')](_0xb0116,null,_0xb0116+_0xcc15('0x37')+_0x54fd37+'.'+_0x2b6702)[_0xcc15('0xf')](_0x54fd37+_0xcc15('0x38'),_0x1bfbdb)['where'](_0xcc15('0x39'),NOW)[_0xcc15('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x54fd37,_0xb0116,_0x2b6702,_0xcc15('0x29'),[_0xcc15('0x3a'),_0xcc15('0x3b')]))[_0xcc15('0xf')](_0xcc15('0x3c'),selectNotIn(_0x54fd37,_0xb0116,_0x2b6702,_0xcc15('0x29'),[_0xcc15('0x3a')])))[_0xcc15('0x3d')]();}function insertCmHopperBlack(_0xcad86f,_0x3e763b,_0x44d7c2,_0x3178af){var _0x53712e=['cm_contacts.phone',_0xcc15('0x24'),_0xcc15('0x25'),_0x3e763b+'.'+_0x3178af,_0xcc15('0x26'),_0xcc15('0x3e')];return squel['insert']()[_0xcc15('0x3f')](_0xcc15('0x40'))['fromQuery'](['phone',_0xcc15('0x2b'),_0xcc15('0x2c'),_0x3178af,_0xcc15('0x41'),_0xcc15('0x2d')],squel[_0xcc15('0x31')]()[_0xcc15('0x32')](_0x53712e)['from'](_0x3e763b)[_0xcc15('0xe')](_0xcc15('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x3e763b+_0xcc15('0x36'))['join'](_0x44d7c2,null,_0x44d7c2+'.id\x20=\x20'+_0x3e763b+'.'+_0x3178af)[_0xcc15('0xf')](_0x3e763b+'.CmListId\x20=\x20?',_0xcad86f)[_0xcc15('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xcc15('0xf')](_0xcc15('0x3c'),squel[_0xcc15('0x31')]()[_0xcc15('0x42')](_0xcc15('0xd'))[_0xcc15('0x33')]('cm_hopper_black')[_0xcc15('0xf')](_0xcc15('0x43'),_0xcad86f)['where'](_0x3178af+_0xcc15('0x44'),_0x3e763b+'.'+_0x3178af)))[_0xcc15('0x3d')]();}function insertCmHopperAdditionalPhones(_0x1c1b03){var _0x18306f=['cm_hopper.id',_0xcc15('0x45'),_0xcc15('0x46'),_0xcc15('0x47'),_0xcc15('0x48')];return squel[_0xcc15('0x28')]()[_0xcc15('0x3f')](_0xcc15('0x49'))[_0xcc15('0x4a')]([_0xcc15('0x4b'),_0xcc15('0xd'),_0xcc15('0x4c'),_0xcc15('0x41'),_0xcc15('0x2d')],squel[_0xcc15('0x31')]()[_0xcc15('0x32')](_0x18306f)[_0xcc15('0x33')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xcc15('0xe')](_0xcc15('0x4d'),null,_0xcc15('0x4e'))[_0xcc15('0xf')]('cm_hopper.ListId\x20=\x20?',_0x1c1b03)[_0xcc15('0xf')](_0xcc15('0x39'),NOW))[_0xcc15('0x3d')]();}function insertCmContact(_0x12b9e9,_0x19982b,_0x200599,_0x3f3c3d){var _0x521cfe=_[_0xcc15('0x4f')](_[_0xcc15('0x50')](_0x3f3c3d),[_0xcc15('0x2c'),_0xcc15('0x51'),_0xcc15('0x41'),'updatedAt']);return squel[_0xcc15('0x28')]()[_0xcc15('0x3f')]('cm_contacts')[_0xcc15('0x4a')](_0x521cfe,squel['select']()[_0xcc15('0x32')](_0x521cfe)[_0xcc15('0x33')](_0x19982b)[_0xcc15('0xf')]('('+_0x200599[_0xcc15('0xe')](',')+_0xcc15('0x52'),squel[_0xcc15('0x31')]()[_0xcc15('0x32')](_0x200599)[_0xcc15('0x33')](_0xcc15('0x34'))[_0xcc15('0xf')](_0xcc15('0x43'),_0x12b9e9))[_0xcc15('0xf')](_0xcc15('0x53'),squel['select']()[_0xcc15('0x42')](_0xcc15('0x54'),'min_id')['from'](_0x19982b)['group'](_0x200599[_0xcc15('0xe')](','))))[_0xcc15('0x3d')]();}function handleStop(){logger[_0xcc15('0x55')](_0xcc15('0x56'));stopped=!![];}function handleUncaughtException(_0x2b5a93){logger[_0xcc15('0x57')](_0x2b5a93[_0xcc15('0x15')]);process['exit'](0x1);}function handleError(_0x701c05,_0x34c3e1){stats[_0xcc15('0x58')][_0xcc15('0x13')]({'name':_0x34c3e1[_0xcc15('0x59')],'message':_0x34c3e1[_0xcc15('0x15')],'row':_0x701c05});}function handleQuery(_0x5b4cff){logger[_0xcc15('0x55')](_0x5b4cff);return db[_0xcc15('0x10')][_0xcc15('0x5a')](_0x5b4cff)[_0xcc15('0x5b')](function(_0x121317){results[_0xcc15('0x13')](_0x121317);})[_0xcc15('0x14')](function(_0x2bc715){logger[_0xcc15('0x57')](_0x2bc715['message']);});}function main(_0xe660f6,_0x1b6335,_0x3d5770,_0x5ab176){logger['info']('main',_0xe660f6,JSON[_0xcc15('0x5c')](_0x1b6335));process[_0xcc15('0x5d')](_0xcc15('0x5e'));var _0x3ed2e5=_0x1b6335[_0xcc15('0x5f')];var _0x5352bc=_[_0xcc15('0x60')](_0x3ed2e5);var _0x1d60be=_0x1b6335[_0xcc15('0x61')];var _0x23f998=path[_0xcc15('0xe')](config['root'],_0xcc15('0x62'),_0x1d60be+_0xcc15('0x63'));logger[_0xcc15('0x55')]('body',_0x1b6335);db['ContactItemType'][_0xcc15('0x64')]({'raw':!![],'attributes':['id',_0xcc15('0x65')]})[_0xcc15('0x19')](function(_0x1f9928){for(var _0x28fa85=0x0;_0x28fa85<_0x1f9928[_0xcc15('0x11')];_0x28fa85++){if(_0x1f9928[_0x28fa85]['name']in _0x3ed2e5){contactItemTypes[_0xcc15('0x13')](_0x1f9928[_0x28fa85]);delete _0x5352bc[_0x1f9928[_0x28fa85][_0xcc15('0x65')]];hasAdditionalPhones=!![];}for(var _0x6c5ecd in _0x3ed2e5){if(_0x1f9928[_0x28fa85][_0xcc15('0x65')]+'_description'===_0x6c5ecd){phoneDescriptions[_0xcc15('0x13')]({'itemTypeId':_0x1f9928[_0x28fa85]['id'],'description':_0x6c5ecd});delete _0x5352bc[_0x6c5ecd];}}}if(hasAdditionalPhones)_0x5352bc['AdditionalPhones']='';var _0x42797d=_[_0xcc15('0x50')](_0x5352bc)['join']();logger[_0xcc15('0x55')]('header',_0x42797d);fs[_0xcc15('0x66')](_0x23f998,_0x42797d+'\x0a');Papa[_0xcc15('0x67')](fs[_0xcc15('0x68')](_0xe660f6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d443b,_0x3693b7){try{for(var _0x2f00bc=0x0,_0x481385=[];_0x2f00bc<_0x2d443b['data'][_0xcc15('0x11')];_0x2f00bc++){stats[_0xcc15('0x69')]+=0x1;if(_0x2d443b['errors'][_0x2f00bc]){handleError(_0x2d443b[_0xcc15('0x6a')][_0x2f00bc],_0x2d443b[_0xcc15('0x58')][_0x2f00bc]);}else{var _0x44a60c=[];var _0x5e50ad=[];var _0xa15e07={};for(var _0x5e8850 in _0x3ed2e5){let _0x1b08c2=contactItemTypes[_0xcc15('0x6b')](_0x168bac=>_0x168bac[_0xcc15('0x65')]===_0x5e8850);let _0x169d0e=contactItemTypes[_0xcc15('0x6b')](_0x486bf3=>_0x486bf3[_0xcc15('0x65')]+_0xcc15('0x6c')===_0x5e8850);if(_[_0xcc15('0x16')](_0x1b08c2)&&_[_0xcc15('0x16')](_0x169d0e)){if(_0x3ed2e5['hasOwnProperty'](_0x5e8850)){if(_0x2d443b['data'][_0x2f00bc][_0x3ed2e5[_0x5e8850]]){var _0x193344=_[_0xcc15('0x6d')](_0x2d443b[_0xcc15('0x6a')][_0x2f00bc][_0x3ed2e5[_0x5e8850]][_0xcc15('0x6e')](/"/g,'\x27'));switch(_0x5e8850){case _0xcc15('0x2a'):var _0x3bad55=moment(_0x193344,_0xcc15('0x9'),!![]);if(_0x3bad55[_0xcc15('0x6f')]()){_0x481385[_0xcc15('0x13')]('\x22'+_0x193344+'\x22');}else{_0x44a60c[_0xcc15('0x13')](_0xcc15('0x70'));}break;case _0xcc15('0x2e'):var _0x16e39b=parseInt(_0x193344);_0x193344=_[_0xcc15('0x71')](_0x16e39b)||_0x16e39b<0x0||_0x16e39b>0x4?_0x5ab176?0x3:0x2:_0x16e39b;_0x481385[_0xcc15('0x13')]('\x22'+_0x193344+'\x22');break;case'UserId':var _0x425cbb=parseInt(_0x193344);if(_[_0xcc15('0x72')](_0x425cbb)&&_[_0xcc15('0x73')](_0x3d5770,_0x425cbb)){_0x481385[_0xcc15('0x13')]('\x22'+_0x425cbb+'\x22');}else{_0x44a60c['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x193344)){_0x481385[_0xcc15('0x13')]('\x22'+_0x193344+'\x22');}else{_0x44a60c['push'](_0xcc15('0x74'));}break;case _0xcc15('0x75'):var _0x58b418=moment(_0x193344,_0xcc15('0x76'),!![]);if(_0x58b418[_0xcc15('0x6f')]()){_0x481385[_0xcc15('0x13')]('\x22'+_0x193344+'\x22');}else{_0x44a60c['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x481385[_0xcc15('0x13')]('\x22'+_0x193344+'\x22');}}else{switch(_0x5e8850){case _0xcc15('0x77'):case'phone':_0x44a60c['push'](_0x5e8850+_0xcc15('0x78'));break;default:_0x481385[_0xcc15('0x13')]('\x22\x22');}}}}else{var _0x7907a7='';if(!_[_0xcc15('0x16')](_0x1b08c2)){if(!_0xa15e07['hasOwnProperty'](_0x1b08c2['id'])){for(var _0x17a98e=0x0;_0x17a98e<_0x3ed2e5[_0x5e8850][_0xcc15('0x11')];_0x17a98e++){var _0x193344=_[_0xcc15('0x6d')](_0x2d443b[_0xcc15('0x6a')][_0x2f00bc][_0x3ed2e5[_0x5e8850][_0x17a98e]][_0xcc15('0x6e')](/"/g,'\x27'));var _0x2e95ab=phoneDescriptions[_0xcc15('0x6b')](_0x277781=>_0x277781[_0xcc15('0x79')]===_0x1b08c2['id']);if(!_[_0xcc15('0x16')](_0x2e95ab)){var _0x4f0211=_[_0xcc15('0x6d')](_0x2d443b[_0xcc15('0x6a')][_0x2f00bc][_0x3ed2e5[_0x2e95ab[_0xcc15('0x7a')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x4f0211))_0x193344=_0x193344+'§'+_0x4f0211;}if(_0x7907a7=='')_0x7907a7=_0x193344;else _0x7907a7+='|'+_0x193344;}_0x5e50ad['push'](_0x1b08c2['id']+':'+_0x7907a7);_0xa15e07[_0x1b08c2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x481385[_0xcc15('0x13')]('\x22'+_0x5e50ad['join'](';')+'\x22');}if(_0x44a60c[_0xcc15('0x11')]){handleError(_0x2d443b[_0xcc15('0x6a')][_0x2f00bc],{'code':'SystemRow','message':_0x44a60c[_0xcc15('0xe')]()});}else{fs['appendFileSync'](_0x23f998,_0x481385['join']()+'\x0a');}_0x481385=[];}if(!(stats[_0xcc15('0x69')]%0xc8)){socket['emit'](_0xcc15('0x7b')+_0x1d60be,stats);stats['errors']=[];}}if(stopped){logger[_0xcc15('0x55')](_0xcc15('0x7c'));_0x3693b7['abort']();}}catch(_0x5f5570){handleError(_0x2d443b[_0xcc15('0x6a')][_0x2f00bc],{'code':_0xcc15('0x7d'),'message':_0x5f5570[_0xcc15('0x15')]});logger[_0xcc15('0x57')](_0xcc15('0x7e'),_0x5f5570[_0xcc15('0x15')]);}},'complete':function(){try{var _0x4ee34d=[];var _0x36b0a2=tempTableName;_0x4ee34d[_0xcc15('0x13')](_0xcc15('0x7f')+_0x36b0a2+_0xcc15('0x80'));logger['info']('CIS\x20len',contactItemTypes[_0xcc15('0x11')]);var _0x4785da=util['format'](_0xcc15('0x81'),_0x23f998,_0x36b0a2,_0x42797d,_0x1b6335[_0xcc15('0x2c')],_0x1b6335[_0xcc15('0x51')]||null,NOW,NOW);if(_[_0xcc15('0x16')](_0x3ed2e5['scheduledat'])){_0x4785da+=',\x20scheduledAt\x20=\x20NOW()';}_0x4ee34d['push'](_0x4785da);BPromise[_0xcc15('0x82')](_0x4ee34d,handleQuery)[_0xcc15('0x19')](function(_0x51db30){BPromise[_0xcc15('0x18')]([handleAdditionalPhones()])[_0xcc15('0x19')](function(){_0x4ee34d=[];for(var _0x2a3ad3=0x0;_0x2a3ad3\x20\x20');}var _0x2c550b=path['join'](config[_0xcc15('0x8f')],_0xcc15('0x62'),process['argv'][0x2]);if(!fs['existsSync'](_0x2c550b)){throw new Error(_0xcc15('0x90'));}var _0x377e63={};try{_0x377e63=JSON[_0xcc15('0x67')](process['argv'][0x3]);if(!_0x377e63[_0xcc15('0x5f')]){throw new Error(_0xcc15('0x91'));}var _0x3be1a8=0x0;if(_0x377e63['binding'][_0xcc15('0x2f')]){_0x3be1a8=0x1;}if(!_0x377e63[_0xcc15('0x2c')]){throw new Error(_0xcc15('0x92'));}}catch(_0x120a0b){throw new Error('body\x20id\x20mandatory');}var _0x5bd699=[];try{_0x5bd699=_['map'](JSON[_0xcc15('0x67')](process[_0xcc15('0x8e')][0x4]),'id');}catch(_0x56a7f4){logger[_0xcc15('0x55')](_0xcc15('0x93'));}main(_0x2c550b,_0x377e63,_0x5bd699,_0x3be1a8);}validate();process['on'](_0xcc15('0x94'),handleStop);process['on'](_0xcc15('0x95'),handleUncaughtException); \ No newline at end of file +var _0xa49b=['../../../mysqldb','../../../config/logger','import','redis','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','spread','isNil','phone','AdditionalPhones','push','all','catch','error','split','length','findOne','CmContactHasItem','update','updated','PHONE','then','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','from','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','field','min_id','errors','code','message','main','stringify','start','binding','clone','socket_timestamp','root','.csv','info','body','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','isValid','priority','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','firstName','trim','replace','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis'];(function(_0x372360,_0x30b03b){var _0x9db770=function(_0x5552f9){while(--_0x5552f9){_0x372360['push'](_0x372360['shift']());}};_0x9db770(++_0x30b03b);}(_0xa49b,0x126));var _0xba49=function(_0x378735,_0x263a2d){_0x378735=_0x378735-0x0;var _0x22d29b=_0xa49b[_0x378735];return _0x22d29b;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xba49('0x0'));var Papa=require(_0xba49('0x1'));var util=require(_0xba49('0x2'));var BPromise=require(_0xba49('0x3'));var moment=require('moment');var squel=require(_0xba49('0x4'));var Redis=require(_0xba49('0x5'));var db=require(_0xba49('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xba49('0x7'))(_0xba49('0x8'));config[_0xba49('0x9')]=_['defaults'](config[_0xba49('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xba49('0xa'))(new Redis(config[_0xba49('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xba49('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xba49('0xc')+moment()[_0xba49('0xb')](_0xba49('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5251e4){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'](_0x5251e4);}function selectNotIn(_0x27ec37,_0x1c26a0,_0x1e5a50,_0x4fa7b8,_0x5d0f30){return squel[_0xba49('0xe')]()['field']('phone')['from'](_0x4fa7b8)[_0xba49('0xf')](_0x1c26a0,null,_0x1c26a0+'.id\x20=\x20'+_0x4fa7b8+'.'+_0x1e5a50)['where'](_0x4fa7b8+'.'+_0x1e5a50+_0xba49('0x10')+_0x27ec37+'.'+_0x1e5a50)[_0xba49('0x11')](_0x1c26a0+_0xba49('0x12')+_0x5d0f30[_0xba49('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5cc5b2,_0x2a88f4){promisesAdditionalPhones=[];promisesContact=[];return db[_0xba49('0x13')]['query']('select\x20*\x20from\x20'+tempTableName)[_0xba49('0x14')](function(_0x1e11e4){if(_0x1e11e4!==null){var _0x28df24=[];for(var _0x153b4c=0x0;_0x153b4c<_0x1e11e4['length'];_0x153b4c++){var _0x32a818=_0x1e11e4[_0x153b4c];if(!_[_0xba49('0x15')](_0x32a818[_0xba49('0x16')])){if(!_['isNil'](_0x32a818[_0xba49('0x17')]))_0x28df24[_0xba49('0x18')](insertAdditionalPhones(_0x32a818));promisesContact[_0xba49('0x18')]({'contact':_0x32a818});}}}Promise[_0xba49('0x19')](_0x28df24)['then'](function(){_0x5cc5b2({'val':0x1});});})[_0xba49('0x1a')](function(_0x59af33){logger[_0xba49('0x1b')](_0x59af33['message']);});});}function insertAdditionalPhones(_0x2c6617){return new Promise(function(_0x36b21b,_0x4524e2){var _0x15dc74=_0x2c6617[_0xba49('0x17')];if(_[_0xba49('0x15')](_0x15dc74))_0x4524e2({'val':0x0});else{var _0x93c3f0=_0x15dc74[_0xba49('0x1c')](';');var _0x2abc3b=[];orderBy=0x0;for(var _0x4f1f1d=0x0;_0x4f1f1d<_0x93c3f0['length'];_0x4f1f1d++){_0x2abc3b[_0xba49('0x18')](splitAdditionalPhone(_0x2c6617['id'],_0x93c3f0[_0x4f1f1d]));}Promise[_0xba49('0x19')](_0x2abc3b)['then'](function(){_0x36b21b({'val':_0x93c3f0['length']});});}});}function splitAdditionalPhone(_0x5711ed,_0x4e65c4){return new Promise(function(_0x26312e,_0x3cd3f4){var _0x45ed70=_0x4e65c4[_0xba49('0x1c')](':');var _0x81f0aa=_0x45ed70[0x0];var _0x34c92b=_0x45ed70[0x1];if(_0x34c92b!==''){var _0x26e3d3=_0x34c92b[_0xba49('0x1c')]('|');var _0x51345d=[];for(var _0x437357=0x0;_0x437357<_0x26e3d3[_0xba49('0x1d')];_0x437357++){if(_0x26e3d3[_0x437357]!==''){var _0x1badf6=_['filter'](promisesAdditionalPhones,{'contactId':_0x5711ed,'phone':_0x26e3d3[_0x437357]});if(_0x1badf6[_0xba49('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xba49('0x18')]({'contactId':_0x5711ed,'contactTypeId':_0x81f0aa,'phone':_0x26e3d3[_0x437357],'orderBy':orderBy});}}}_0x26312e({'ok':0x1});}else _0x26312e({'res':0x0});});}function createAdditionalPhone(_0x4b78fc,_0x4b3bb7,_0x214e20,_0x15f9ac){var _0x529415='';var _0x2c0854='';var _0x3d62af=_0x214e20[_0xba49('0x1c')]('§');_0x529415=_0x3d62af[0x0];if(_0x3d62af[_0xba49('0x1d')]==0x2)_0x2c0854=_0x3d62af[0x1];return new Promise(function(_0x21942f,_0x3aae7e){return db['CmContactHasItem'][_0xba49('0x1e')]({'where':{'CmContactId':_0x4b78fc,'item':_0x529415}})['then'](function(_0xc64929){if(_0xc64929){return db[_0xba49('0x1f')][_0xba49('0x20')]({'ItemTypeId':_0x4b3bb7,'description':_0x2c0854,'OrderBy':_0x15f9ac},{'where':{'CmContactId':_0x4b78fc,'item':_0x529415}})['then'](function(_0x217b0c){_0x21942f({'res':_0xba49('0x21')});});}else{return db[_0xba49('0x1f')]['create']({'CmContactId':_0x4b78fc,'item':_0x529415,'ItemTypeId':_0x4b3bb7,'description':_0x2c0854,'OrderBy':_0x15f9ac,'ItemClass':_0xba49('0x22')})[_0xba49('0x23')](function(_0x590be8){_0x21942f({'res':_0xba49('0x24')});});}});});}function updateContact(_0x3f078a){return new Promise(function(_0x1820c2,_0x5d18ef){var _0x59581e=_0x3f078a['id'];delete _0x3f078a['id'];return db[_0xba49('0x25')][_0xba49('0x20')](_0x3f078a,{'where':{'id':_0x59581e}})[_0xba49('0x23')](function(_0x44e0fc){updatedRows+=0x1;return db[_0xba49('0x26')][_0xba49('0x20')]({'phone':_0x3f078a['phone']},{'where':{'ContactId':_0x59581e}})[_0xba49('0x23')](function(_0x360cd6){_0x1820c2({'ret':'OK'});});});});}function insertCmHopper(_0x4c49e8,_0x1636fd,_0x5d103e,_0x4a9cd9,_0x34c3c4){var _0x545f6a=[_0xba49('0x27'),_0xba49('0x28'),_0xba49('0x29'),_0xba49('0x2a'),_0x1636fd+'.'+_0x4a9cd9,_0xba49('0x2b'),_0xba49('0x2c'),_0xba49('0x2d'),_0xba49('0x2e'),'\x22'+_0x34c3c4+'\x22'];return squel[_0xba49('0x2f')]()[_0xba49('0x30')]('cm_hopper')[_0xba49('0x31')]([_0xba49('0x16'),_0xba49('0x32'),_0xba49('0x33'),_0xba49('0x34'),_0x4a9cd9,_0xba49('0x35'),_0xba49('0x36'),'priority',_0xba49('0x37'),'recallme'],squel[_0xba49('0xe')]()['fields'](_0x545f6a)['from'](_0x1636fd)[_0xba49('0xf')](_0xba49('0x38'),null,_0xba49('0x39')+_0x1636fd+'.CmListId')['join'](_0x5d103e,null,_0x5d103e+'.id\x20=\x20'+_0x1636fd+'.'+_0x4a9cd9)[_0xba49('0x11')](_0x1636fd+'.CmListId\x20=\x20?',_0x4c49e8)[_0xba49('0x11')](_0xba49('0x3a'),NOW)['where'](_0xba49('0x3b'),selectNotIn(_0x1636fd,_0x5d103e,_0x4a9cd9,_0xba49('0x3c'),[_0xba49('0x3d'),_0xba49('0x3e')]))[_0xba49('0x11')](_0xba49('0x3b'),selectNotIn(_0x1636fd,_0x5d103e,_0x4a9cd9,'cm_hopper',['\x22always\x22'])))[_0xba49('0x3f')]();}function insertCmHopperBlack(_0x265c3c,_0x3810d1,_0x1d61af,_0x3c2a61){var _0x29d04a=[_0xba49('0x27'),_0xba49('0x29'),_0xba49('0x2a'),_0x3810d1+'.'+_0x3c2a61,_0xba49('0x2b'),_0xba49('0x2c')];return squel[_0xba49('0x2f')]()[_0xba49('0x30')](_0xba49('0x40'))['fromQuery']([_0xba49('0x16'),_0xba49('0x33'),_0xba49('0x34'),_0x3c2a61,'createdAt',_0xba49('0x36')],squel[_0xba49('0xe')]()['fields'](_0x29d04a)['from'](_0x3810d1)[_0xba49('0xf')]('cm_contacts',null,_0xba49('0x39')+_0x3810d1+_0xba49('0x41'))[_0xba49('0xf')](_0x1d61af,null,_0x1d61af+_0xba49('0x42')+_0x3810d1+'.'+_0x3c2a61)[_0xba49('0x11')](_0x3810d1+_0xba49('0x43'),_0x265c3c)['where'](_0xba49('0x3a'),NOW)[_0xba49('0x11')](_0xba49('0x3b'),squel[_0xba49('0xe')]()['field'](_0xba49('0x16'))[_0xba49('0x44')](_0xba49('0x40'))['where']('ListId\x20=\x20?',_0x265c3c)[_0xba49('0x11')](_0x3c2a61+_0xba49('0x45'),_0x3810d1+'.'+_0x3c2a61)))[_0xba49('0x3f')]();}function insertCmHopperAdditionalPhones(_0x4f5d27){var _0x10c177=[_0xba49('0x46'),_0xba49('0x47'),'cm_contact_has_items.OrderBy',_0xba49('0x48'),_0xba49('0x49')];return squel[_0xba49('0x2f')]()[_0xba49('0x30')](_0xba49('0x4a'))[_0xba49('0x31')](['CmHopperId','phone','OrderBy',_0xba49('0x35'),_0xba49('0x36')],squel['select']()[_0xba49('0x4b')](_0x10c177)[_0xba49('0x44')](_0xba49('0x3c'))[_0xba49('0xf')]('cm_contacts',null,_0xba49('0x4c'))[_0xba49('0xf')]('cm_contact_has_items',null,_0xba49('0x4d'))[_0xba49('0x11')]('cm_hopper.ListId\x20=\x20?',_0x4f5d27)[_0xba49('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xba49('0x3f')]();}function insertCmContact(_0x137355,_0xbd3bcb,_0x23ffce,_0x1951c0){var _0x11f2be=_['concat'](_[_0xba49('0x4e')](_0x1951c0),[_0xba49('0x34'),'CompanyId','createdAt',_0xba49('0x36')]);return squel[_0xba49('0x2f')]()[_0xba49('0x30')](_0xba49('0x38'))[_0xba49('0x31')](_0x11f2be,squel[_0xba49('0xe')]()[_0xba49('0x4b')](_0x11f2be)[_0xba49('0x44')](_0xbd3bcb)[_0xba49('0x11')]('('+_0x23ffce['join'](',')+_0xba49('0x4f'),squel[_0xba49('0xe')]()[_0xba49('0x4b')](_0x23ffce)[_0xba49('0x44')](_0xba49('0x38'))[_0xba49('0x11')](_0xba49('0x50'),_0x137355))[_0xba49('0x11')](_0xba49('0x51'),squel[_0xba49('0xe')]()[_0xba49('0x52')]('MIN(id)',_0xba49('0x53'))['from'](_0xbd3bcb)['group'](_0x23ffce[_0xba49('0xf')](','))))[_0xba49('0x3f')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x178ef9){logger[_0xba49('0x1b')](_0x178ef9['message']);process['exit'](0x1);}function handleError(_0x2e577f,_0xb4d959){stats[_0xba49('0x54')][_0xba49('0x18')]({'name':_0xb4d959[_0xba49('0x55')],'message':_0xb4d959['message'],'row':_0x2e577f});}function handleQuery(_0x109ca3){logger['info'](_0x109ca3);return db[_0xba49('0x13')]['query'](_0x109ca3)['spread'](function(_0x18edb1){results[_0xba49('0x18')](_0x18edb1);})['catch'](function(_0x43a39c){logger[_0xba49('0x1b')](_0x43a39c[_0xba49('0x56')]);});}function main(_0x219ccb,_0x18b8ad,_0x45d0af,_0x34a12f){logger['info'](_0xba49('0x57'),_0x219ccb,JSON[_0xba49('0x58')](_0x18b8ad));process['send'](_0xba49('0x59'));var _0x2a2f2b=_0x18b8ad[_0xba49('0x5a')];var _0x5293b4=_[_0xba49('0x5b')](_0x2a2f2b);var _0x31dcf4=_0x18b8ad[_0xba49('0x5c')];var _0x4d795a=path[_0xba49('0xf')](config[_0xba49('0x5d')],'server/files/tmp',_0x31dcf4+_0xba49('0x5e'));logger[_0xba49('0x5f')](_0xba49('0x60'),_0x18b8ad);db[_0xba49('0x61')]['findAll']({'raw':!![],'attributes':['id',_0xba49('0x62')]})[_0xba49('0x23')](function(_0x34bf6b){for(var _0x24de1d=0x0;_0x24de1d<_0x34bf6b['length'];_0x24de1d++){if(_0x34bf6b[_0x24de1d]['name']in _0x2a2f2b){contactItemTypes['push'](_0x34bf6b[_0x24de1d]);delete _0x5293b4[_0x34bf6b[_0x24de1d][_0xba49('0x62')]];hasAdditionalPhones=!![];}for(var _0x53d92f in _0x2a2f2b){if(_0x34bf6b[_0x24de1d][_0xba49('0x62')]+_0xba49('0x63')===_0x53d92f){phoneDescriptions['push']({'itemTypeId':_0x34bf6b[_0x24de1d]['id'],'description':_0x53d92f});delete _0x5293b4[_0x53d92f];}}}if(hasAdditionalPhones)_0x5293b4[_0xba49('0x17')]='';var _0x248c52=_['keys'](_0x5293b4)[_0xba49('0xf')]();logger[_0xba49('0x5f')]('header',_0x248c52);fs[_0xba49('0x64')](_0x4d795a,_0x248c52+'\x0a');Papa[_0xba49('0x65')](fs['createReadStream'](_0x219ccb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3fb6a0,_0x359f0d){try{for(var _0x55f353=0x0,_0x2c3bce=[];_0x55f353<_0x3fb6a0[_0xba49('0x66')][_0xba49('0x1d')];_0x55f353++){stats[_0xba49('0x67')]+=0x1;if(_0x3fb6a0[_0xba49('0x54')][_0x55f353]){handleError(_0x3fb6a0['data'][_0x55f353],_0x3fb6a0[_0xba49('0x54')][_0x55f353]);}else{var _0x4337a5=[];var _0x14d145=[];var _0xd7c96d={};for(var _0x22d4e3 in _0x2a2f2b){let _0x51c167=contactItemTypes[_0xba49('0x68')](_0x5b0200=>_0x5b0200[_0xba49('0x62')]===_0x22d4e3);let _0x29ca82=contactItemTypes['find'](_0x5b7b61=>_0x5b7b61[_0xba49('0x62')]+_0xba49('0x63')===_0x22d4e3);if(_[_0xba49('0x15')](_0x51c167)&&_[_0xba49('0x15')](_0x29ca82)){if(_0x2a2f2b[_0xba49('0x69')](_0x22d4e3)){if(_0x3fb6a0['data'][_0x55f353][_0x2a2f2b[_0x22d4e3]]){var _0x2c8c4=_['trim'](_0x3fb6a0['data'][_0x55f353][_0x2a2f2b[_0x22d4e3]]['replace'](/"/g,'\x27'));switch(_0x22d4e3){case'scheduledat':var _0x41dffa=moment(_0x2c8c4,_0xba49('0x6a'),!![]);if(_0x41dffa[_0xba49('0x6b')]()){_0x2c3bce['push']('\x22'+_0x2c8c4+'\x22');}else{_0x4337a5[_0xba49('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xba49('0x6c'):var _0x3536fc=parseInt(_0x2c8c4);_0x2c8c4=_[_0xba49('0x6d')](_0x3536fc)||_0x3536fc<0x0||_0x3536fc>0x4?_0x34a12f?0x3:0x2:_0x3536fc;_0x2c3bce[_0xba49('0x18')]('\x22'+_0x2c8c4+'\x22');break;case'UserId':var _0x352310=parseInt(_0x2c8c4);if(_[_0xba49('0x6e')](_0x352310)&&_['includes'](_0x45d0af,_0x352310)){_0x2c3bce[_0xba49('0x18')]('\x22'+_0x352310+'\x22');}else{_0x4337a5[_0xba49('0x18')](_0xba49('0x6f'));}break;case _0xba49('0x70'):if(isEmail(_0x2c8c4)){_0x2c3bce['push']('\x22'+_0x2c8c4+'\x22');}else{_0x4337a5[_0xba49('0x18')]('email\x20wrong\x20format');}break;case _0xba49('0x71'):var _0x3b3c77=moment(_0x2c8c4,'YYYY-MM-DD',!![]);if(_0x3b3c77[_0xba49('0x6b')]()){_0x2c3bce[_0xba49('0x18')]('\x22'+_0x2c8c4+'\x22');}else{_0x4337a5[_0xba49('0x18')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2c3bce['push']('\x22'+_0x2c8c4+'\x22');}}else{switch(_0x22d4e3){case _0xba49('0x72'):case _0xba49('0x16'):_0x4337a5[_0xba49('0x18')](_0x22d4e3+'\x20not\x20specified');break;default:_0x2c3bce[_0xba49('0x18')]('\x22\x22');}}}}else{var _0x56d927='';if(!_[_0xba49('0x15')](_0x51c167)){if(!_0xd7c96d[_0xba49('0x69')](_0x51c167['id'])){for(var _0x4b2d83=0x0;_0x4b2d83<_0x2a2f2b[_0x22d4e3][_0xba49('0x1d')];_0x4b2d83++){var _0x2c8c4=_[_0xba49('0x73')](_0x3fb6a0[_0xba49('0x66')][_0x55f353][_0x2a2f2b[_0x22d4e3][_0x4b2d83]][_0xba49('0x74')](/"/g,'\x27'));var _0x5bbd53=phoneDescriptions[_0xba49('0x68')](_0x10bde4=>_0x10bde4[_0xba49('0x75')]===_0x51c167['id']);if(!_[_0xba49('0x15')](_0x5bbd53)){var _0x40da98=_[_0xba49('0x73')](_0x3fb6a0[_0xba49('0x66')][_0x55f353][_0x2a2f2b[_0x5bbd53['description']][0x0]][_0xba49('0x74')](/"/g,'\x27'));if(!_['isNil'](_0x40da98))_0x2c8c4=_0x2c8c4+'§'+_0x40da98;}if(_0x56d927=='')_0x56d927=_0x2c8c4;else _0x56d927+='|'+_0x2c8c4;}_0x14d145[_0xba49('0x18')](_0x51c167['id']+':'+_0x56d927);_0xd7c96d[_0x51c167['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2c3bce['push']('\x22'+_0x14d145['join'](';')+'\x22');}if(_0x4337a5[_0xba49('0x1d')]){handleError(_0x3fb6a0[_0xba49('0x66')][_0x55f353],{'code':_0xba49('0x76'),'message':_0x4337a5['join']()});}else{fs[_0xba49('0x77')](_0x4d795a,_0x2c3bce[_0xba49('0xf')]()+'\x0a');}_0x2c3bce=[];}if(!(stats['rows']%0xc8)){socket[_0xba49('0x78')](_0xba49('0x79')+_0x31dcf4,stats);stats[_0xba49('0x54')]=[];}}if(stopped){logger[_0xba49('0x5f')](_0xba49('0x7a'));_0x359f0d[_0xba49('0x7b')]();}}catch(_0x11c0d6){handleError(_0x3fb6a0[_0xba49('0x66')][_0x55f353],{'code':_0xba49('0x7c'),'message':_0x11c0d6[_0xba49('0x56')]});logger[_0xba49('0x1b')]('step',_0x11c0d6['message']);}},'complete':function(){try{var _0x5da759=[];var _0x163cba=tempTableName;_0x5da759[_0xba49('0x18')](_0xba49('0x7d')+_0x163cba+_0xba49('0x7e'));logger['info'](_0xba49('0x7f'),contactItemTypes['length']);var _0x1a25f0=util['format'](_0xba49('0x80'),_0x4d795a,_0x163cba,_0x248c52,_0x18b8ad[_0xba49('0x34')],_0x18b8ad[_0xba49('0x81')]||null,NOW,NOW);if(_['isNil'](_0x2a2f2b[_0xba49('0x32')])){_0x1a25f0+=_0xba49('0x82');}_0x5da759[_0xba49('0x18')](_0x1a25f0);BPromise[_0xba49('0x83')](_0x5da759,handleQuery)[_0xba49('0x23')](function(_0x397b27){BPromise[_0xba49('0x19')]([handleAdditionalPhones()])[_0xba49('0x23')](function(){_0x5da759=[];for(var _0x47bcaf=0x0;_0x47bcaf\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','limit','offset','sequelize','toString','groupBy','findOne','enableEmailPreview','clone','where','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','left_join','users','length','\x20IN\x20?','map','getInteractionsTables','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','fax'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0xcdbb,0x71));var _0xbcdb=function(_0x37dd27,_0x49fcfc){_0x37dd27=_0x37dd27-0x0;var _0x9a371a=_0xcdbb[_0x37dd27];return _0x9a371a;};'use strict';var _=require(_0xbcdb('0x0'));var squel=require(_0xbcdb('0x1'));var as=require(_0xbcdb('0x2'));var qs=require(_0xbcdb('0x3'));var updateInteraction=require(_0xbcdb('0x4'))[_0xbcdb('0x5')];var utils=require(_0xbcdb('0x6'));var db=require(_0xbcdb('0x7'))['db'];function skipInteractionsQuery(_0x345b83,_0x4ddd36,_0x284693){var _0x5f58aa=![];var _0x401444=utils[_0xbcdb('0x8')](_0x345b83);if(_0x4ddd36[_0xbcdb('0x9')]===_0xbcdb('0xa')&&!_0x284693[_0xbcdb('0xb')]&&!_0x284693[_0x401444]){_0x5f58aa=!![];}return _0x5f58aa;}function getTagsQuery(){return squel[_0xbcdb('0xc')]()[_0xbcdb('0xd')]('id')[_0xbcdb('0xd')](_0xbcdb('0xe'))[_0xbcdb('0xd')](_0xbcdb('0xf'))[_0xbcdb('0x10')](_0xbcdb('0x11'));}function getUsersQuery(_0x200cd9,_0x2c21e8){var _0x16325d=utils[_0xbcdb('0x12')](_0x200cd9);var _0xda154a=_0xbcdb('0x13')+_0x200cd9+'_interactions';var _0x562a17=squel[_0xbcdb('0xc')]()[_0xbcdb('0xd')](_0xbcdb('0x14'))[_0xbcdb('0xd')](_0xbcdb('0x15'))[_0xbcdb('0xd')](_0xbcdb('0x16')+_0x16325d)[_0xbcdb('0x10')](_0xda154a,'ui')[_0xbcdb('0x17')](_0xbcdb('0x18'),'u','u.id\x20=\x20ui.UserId');if(_0x2c21e8[_0xbcdb('0x19')]>0x0){_0x562a17['where'](_0xbcdb('0x16')+_0x16325d+_0xbcdb('0x1a'),_[_0xbcdb('0x1b')](_0x2c21e8,'id'));}return _0x562a17;}function getInteractionsQuery(_0x422608){var _0x517588=utils[_0xbcdb('0x1c')](_0x422608);var _0x56c199=utils[_0xbcdb('0x8')](_0x422608);var _0x3feffa=utils[_0xbcdb('0x12')](_0x422608);return squel['select']()[_0xbcdb('0x10')](_0x517588['interactions'],'i')['left_join']('cm_contacts','c',_0xbcdb('0x1d'))[_0xbcdb('0x17')](_0xbcdb('0x18'),'o',_0xbcdb('0x1e'))[_0xbcdb('0x17')](_0x517588[_0xbcdb('0x1f')],'a',_0xbcdb('0x20')+_0x56c199)['left_join'](_0x517588[_0xbcdb('0x21')],'me',_0xbcdb('0x22')+_0x3feffa+_0xbcdb('0x23'))[_0xbcdb('0x17')](_0x517588[_0xbcdb('0x24')],'it',_0xbcdb('0x25')+_0x3feffa+_0xbcdb('0x23'))[_0xbcdb('0x17')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x309b39={'body':squel[_0xbcdb('0x26')](),'contact':squel[_0xbcdb('0x26')](),'default':squel['expr'](),'fields':squel[_0xbcdb('0x26')](),'filter':squel[_0xbcdb('0x26')](),'read':squel[_0xbcdb('0x26')](),'tags':{'clause':squel[_0xbcdb('0x26')](),'ids':null},'user':squel[_0xbcdb('0x26')]()};return _0x309b39;}function parseTagParameter(_0xb135c8){var _0xe9cd45=squel['expr']();if(_0xb135c8){var _0x4aae36=utils[_0xbcdb('0x27')](_0xb135c8);_0x4aae36['forEach'](function(_0x1b6f10){_0xe9cd45['or'](_0xbcdb('0x28'),'%,'+_0x1b6f10+',%');});}return _0xe9cd45;}function parseReadParameter(_0x10007f){var _0x48e588='';if(_0x10007f){_0x48e588=_0xbcdb('0x29');if(_0x10007f==='1'){_0x48e588=_0x48e588[_0xbcdb('0x2a')](_0xbcdb('0x2b'),'=');}else{_0x48e588=_0x48e588[_0xbcdb('0x2a')]('{OPERATOR}','>');}}return _0x48e588;}function parseSearchFilter(_0x3725d3,_0xe7bd79){var _0x5b8d54=squel[_0xbcdb('0x26')]();if(_0xe7bd79){var _0x5c51d4=_0xe7bd79[_0xbcdb('0x2a')]('\x5c','\x5c\x5c')[_0xbcdb('0x2a')](/'/g,'\x27\x27');var _0x91b2c2=qs['escapeLIKESpecialChars'](_0x5c51d4);if(qs[_0xbcdb('0x2c')](_0x5c51d4)){_0x5b8d54['or']('i.id\x20LIKE\x20?',_0x91b2c2+'%');if(['sms',_0xbcdb('0x2d')][_0xbcdb('0x2e')](_0x3725d3)){_0x5b8d54['or'](_0xbcdb('0x2f'),_0x91b2c2+'%');}else if(_0x3725d3===_0xbcdb('0x30')){_0x5b8d54['or'](_0xbcdb('0x31'),_0x91b2c2+'%');}else if(_0x3725d3===_0xbcdb('0x32')){_0x5b8d54['or'](_0xbcdb('0x33'),_0x91b2c2+'%');}}else if(_0x3725d3===_0xbcdb('0x34')&&qs['isEmail'](_0x5c51d4)){_0x5b8d54['or'](_0xbcdb('0x35'),_0x91b2c2+'%');}else{if(_0x3725d3==='mail'){_0x5b8d54['or'](_0xbcdb('0x36'),qs[_0xbcdb('0x37')](_0x5c51d4,!![]))['or'](_0xbcdb('0x38'),qs[_0xbcdb('0x37')](_0x5c51d4));}else if(_0x3725d3!==_0xbcdb('0x30')){_0x5b8d54['or'](_0xbcdb('0x39'),qs[_0xbcdb('0x37')](_0x5c51d4));}_0x5b8d54['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbcdb('0x37')](_0x5c51d4,!![]),null);}}return _0x5b8d54;}function parseAdvancedSearchFilter(_0xeef36d,_0x1334b3){var _0x6c1019=getSqlClauses();var _0x5c247f=as[_0xbcdb('0x3a')](_0xeef36d);var _0x2fb813=_0x5c247f[_0xbcdb('0x3b')];for(var _0x244cf6=0x0;_0x244cf6<_0x5c247f[_0xbcdb('0x3c')][_0xbcdb('0x19')];_0x244cf6++){var _0x540f0e=_0x5c247f[_0xbcdb('0x3c')][_0x244cf6];var _0x3d8873='i';var _0x127fd5=_[_0xbcdb('0x3d')](_0x1334b3,[_0xbcdb('0xe'),_0x540f0e[_0xbcdb('0xd')]]);if(_0x127fd5){var _0x41a5b5=as['buildExpression'](_0x3d8873,_0x127fd5['type'],_0x540f0e);_0x6c1019[_0xbcdb('0x3e')][_0x2fb813](_0x41a5b5['text'],_0x41a5b5['value'][_0xbcdb('0x3f')],_0x41a5b5[_0xbcdb('0x40')][_0xbcdb('0x41')]);}else{switch(_0x540f0e[_0xbcdb('0xd')]){case'unreadMessages':var _0x113f04=parseReadParameter(_0x540f0e[_0xbcdb('0x40')]);_0x6c1019[_0xbcdb('0x42')][_0xbcdb('0x43')](_0x113f04);break;case _0xbcdb('0x44'):if(_0x540f0e[_0xbcdb('0x45')]===_0xbcdb('0x46')){if(_0x540f0e[_0xbcdb('0x40')][_0xbcdb('0x47')]('\x20')[_0xbcdb('0x19')]>0x1){_0x6c1019[_0xbcdb('0x48')][_0x2fb813](_0xbcdb('0x49'),qs[_0xbcdb('0x37')](_0x540f0e[_0xbcdb('0x40')],!![]),null);}else{var _0x1d988b='%'+_0x540f0e[_0xbcdb('0x40')]+'%';_0x6c1019[_0xbcdb('0x48')][_0x2fb813](_0xbcdb('0x4a'),_0x1d988b,_0x1d988b,_0x1d988b);}}else{_0x127fd5=_['find'](_0x1334b3,[_0xbcdb('0xe'),'ContactId']);_0x540f0e[_0xbcdb('0xd')]='ContactId';_0x41a5b5=as[_0xbcdb('0x4b')](_0x3d8873,_0x127fd5[_0xbcdb('0x4c')],_0x540f0e);_0x6c1019[_0xbcdb('0x48')][_0x2fb813](_0x41a5b5['text'],_0x41a5b5[_0xbcdb('0x40')]['start'],_0x41a5b5[_0xbcdb('0x40')]['end']);}break;case _0xbcdb('0x4d'):var _0x4c8018=_0x540f0e[_0xbcdb('0x40')][_0xbcdb('0x47')](',')[_0xbcdb('0x1b')](function(_0x29c66e){return Number(_0x29c66e);});var _0x159734=parseTagParameter(_0x4c8018);_0x6c1019[_0xbcdb('0x4e')][_0xbcdb('0x4f')][_0xbcdb('0x43')](_0x159734);_0x6c1019['tags'][_0xbcdb('0x50')]=_0x4c8018;break;case'User':if(_0x540f0e['operator']==='$substring'){_0x6c1019['user'][_0x2fb813](_0xbcdb('0x51'),'%'+_0x540f0e[_0xbcdb('0x40')]+'%',null);}else{_0x127fd5=_[_0xbcdb('0x3d')](_0x1334b3,['name','UserId']);_0x540f0e['field']=_0xbcdb('0x52');_0x41a5b5=as[_0xbcdb('0x4b')](_0x3d8873,_0x127fd5[_0xbcdb('0x4c')],_0x540f0e);_0x6c1019[_0xbcdb('0x53')][_0x2fb813](_0x41a5b5['text'],_0x41a5b5[_0xbcdb('0x40')][_0xbcdb('0x3f')],_0x41a5b5[_0xbcdb('0x40')][_0xbcdb('0x41')]);}break;case _0xbcdb('0x54'):case'plainBody':_0x41a5b5=as[_0xbcdb('0x4b')]('me',null,_0x540f0e);_0x6c1019['body'][_0x2fb813](_0x41a5b5[_0xbcdb('0x55')],_0x41a5b5[_0xbcdb('0x40')][_0xbcdb('0x3f')],_0x41a5b5[_0xbcdb('0x40')][_0xbcdb('0x41')]);break;}}}return _0x6c1019;}function parseModelFields(_0x2b5b3c,_0x5222c0,_0x446aa7){var _0x488242=utils['getAccountFK'](_0x2b5b3c);var _0x319789=squel[_0xbcdb('0x26')]();var _0x23fad3=_(_0x5222c0)[_0xbcdb('0x56')]()[_0xbcdb('0x1b')](function(_0x3b8673){return _[_0xbcdb('0x57')](_0x446aa7,[_0xbcdb('0xe'),_0x3b8673])?_0x3b8673:undefined;})['compact']()['value']();if(_0x23fad3[_0xbcdb('0x19')]>0x0){_0x23fad3[_0xbcdb('0x58')](function(_0x43015b){if(_0x43015b===_0x488242){_0x319789['and']('i.'+_0x488242+_0xbcdb('0x1a'),[][_0xbcdb('0x59')](_0x5222c0[_0x43015b]));}else if(_0x43015b===_0xbcdb('0x5a')){var _0x4c7420=JSON[_0xbcdb('0x5b')](_0x5222c0[_0x43015b])[_0xbcdb('0x5c')];var _0x73dc49=JSON[_0xbcdb('0x5b')](_0x5222c0[_0x43015b])['$lte'];_0x319789[_0xbcdb('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4c7420,_0x73dc49);}else{if(_0x5222c0[_0x43015b]===_0xbcdb('0x5d')){_0x319789[_0xbcdb('0x43')]('i.'+_0x43015b+'\x20IS\x20NULL');}else{_0x319789['and']('i.'+_0x43015b+_0xbcdb('0x5e'),_0x5222c0[_0x43015b]);}}});}return _0x319789;}function parseQueryParameters(_0x48151f,_0x2d8c5f,_0x215190){var _0x4748a2=getSqlClauses();return Promise['resolve']()[_0xbcdb('0x5f')](function(){return parseModelFields(_0x48151f,_0x2d8c5f,_0x215190);})[_0xbcdb('0x5f')](function(_0x55774b){_0x4748a2[_0xbcdb('0x60')][_0xbcdb('0x43')](_0x55774b);return parseReadParameter(_0x2d8c5f[_0xbcdb('0x42')]);})['then'](function(_0x1c2cef){_0x4748a2[_0xbcdb('0x42')][_0xbcdb('0x43')](_0x1c2cef);return parseTagParameter(_0x2d8c5f[_0xbcdb('0x61')]);})[_0xbcdb('0x5f')](function(_0x414dcc){_0x4748a2[_0xbcdb('0x4e')][_0xbcdb('0x4f')][_0xbcdb('0x43')](_0x414dcc);return parseSearchFilter(_0x48151f,_0x2d8c5f[_0xbcdb('0x62')]);})[_0xbcdb('0x5f')](function(_0x4d456d){_0x4748a2[_0xbcdb('0x62')]=_0x4d456d;return _0x4748a2;});}function checkAccountsRestrictions(_0x559f75,_0x1a7e1c,_0x3670d7){var _0x5853cd=utils['getAccountFK'](_0x559f75);var _0x1ec1d2=_0xbcdb('0x63')+_[_0xbcdb('0x64')](_0x559f75)+(_0x559f75==='chat'?_0xbcdb('0x65'):_0xbcdb('0x66'));var _0x5da334=squel[_0xbcdb('0x26')]();return Promise[_0xbcdb('0x67')]()[_0xbcdb('0x5f')](function(){if(_0x3670d7[_0xbcdb('0xb')]&&_0x1a7e1c[_0xbcdb('0x9')]===_0xbcdb('0xa')){return _0x1a7e1c[_0x1ec1d2]({'attributes':['id'],'raw':!![]});}})[_0xbcdb('0x5f')](function(_0xc3f361){if(_0xc3f361){if(_0xc3f361[_0xbcdb('0x19')]===0x0){_0x5da334[_0xbcdb('0x43')]('i.'+_0x5853cd+_0xbcdb('0x68'));}else{_0x5da334[_0xbcdb('0x43')]('i.'+_0x5853cd+_0xbcdb('0x1a'),_['map'](_0xc3f361,'id'));}}else if(!_0x3670d7[_0x5853cd]){_0x5da334['and']('i.'+_0x5853cd+_0xbcdb('0x69'));}})['then'](function(){return _0x5da334;});}function getClosedOrderClause(_0x4caa6d,_0x57ddf8){var _0x158d98='';var _0x1b9483=['i.thirdDisposition',_0xbcdb('0x6a'),_0xbcdb('0x6b')];if(_0x4caa6d===_0xbcdb('0x34')){_0x1b9483[_0xbcdb('0x6c')](_0xbcdb('0x6d'));}if(_0x57ddf8[_0xbcdb('0x6e')]==='0'&&_0x4caa6d===_0xbcdb('0x34')){_0x158d98='i.substatus';}else{if(_0x57ddf8[_0xbcdb('0x6e')]==='1'){_0x1b9483['shift']();}_0x158d98=_0xbcdb('0x6f')+_0x1b9483[_0xbcdb('0x70')](',\x20')+')';}return _0x158d98;}function getFilteredInteractions(_0x341d45,_0x4af277,_0x200be5,_0xf2b33d){var _0x44680e=utils[_0xbcdb('0x12')](_0x341d45);var _0x11dd49=_[_0xbcdb('0x64')](_0x341d45)+_0xbcdb('0x71');var _0x2fb38b=[];var _0x28a8a2=getTagsQuery();var _0x542cdc={'type':db['Sequelize'][_0xbcdb('0x72')]['SELECT'],'raw':!![]};var _0x1818a0=[];var _0x3f61a4=[];return db['sequelize'][_0xbcdb('0x73')](_0x28a8a2['toString'](),_0x542cdc)[_0xbcdb('0x5f')](function(_0x5168f5){_0x2fb38b=_[_0xbcdb('0x74')](_0x5168f5,'id');_0x542cdc=_[_0xbcdb('0x75')](_0x542cdc,{'model':db[_0x11dd49],'mapToModel':!![],'nest':!![]});if(_0x200be5[_0xbcdb('0x60')]){_0xf2b33d['attributes'][_0xbcdb('0x58')](function(_0x1f234a){_0x4af277['field']('i.'+_0x1f234a);});}else{_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x76'),_0xbcdb('0x77'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x78'),_0xbcdb('0x79'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x7a'),_0xbcdb('0x7b'));if(_0x341d45===_0xbcdb('0x34')){_0x4af277[_0xbcdb('0xd')]('a.email',_0xbcdb('0x7c'));_0x4af277['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xbcdb('0x7d'));_0x4af277['field']('i.id');_0x4af277['field']('i.createdAt');_0x4af277['field'](_0xbcdb('0x7e'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x7f'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x80'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x81'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x82'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x83'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x84'));_0x4af277[_0xbcdb('0xd')]('i.disposition');_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x6a'));_0x4af277['field'](_0xbcdb('0x85'));_0x4af277['field'](_0xbcdb('0x6d'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x86'));_0x4af277[_0xbcdb('0xd')]('i.ContactId');_0x4af277['field'](_0xbcdb('0x87'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x88'));}else if(_0x341d45===_0xbcdb('0x32')){_0x4af277[_0xbcdb('0xd')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}else{_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x89'),_0xbcdb('0x7d'));}if(_0x341d45!==_0xbcdb('0x34')){_0x4af277[_0xbcdb('0xd')]('i.*');}_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x8a'),_0xbcdb('0x8b'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x8c'),_0xbcdb('0x8d'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x8e'),_0xbcdb('0x8f'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x90'),_0xbcdb('0x91'));_0x4af277[_0xbcdb('0xd')]('c.mobile',_0xbcdb('0x92'));_0x4af277[_0xbcdb('0xd')](_0xbcdb('0x93'),_0xbcdb('0x94'));_0x4af277[_0xbcdb('0xd')]('o.fullname',_0xbcdb('0x95'));_0x4af277[_0xbcdb('0xd')]('o.internal','Owner.internal');_0x4af277[_0xbcdb('0xd')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xf2b33d['limit']){_0x4af277[_0xbcdb('0x96')](_0xf2b33d[_0xbcdb('0x96')]);}if(_0xf2b33d['offset']){_0x4af277[_0xbcdb('0x97')](_0xf2b33d[_0xbcdb('0x97')]);}return db['sequelize'][_0xbcdb('0x73')](_0x4af277['toString'](),_0x542cdc);})[_0xbcdb('0x5f')](function(_0x15a78e){_0x1818a0=_0x15a78e;var _0x59da88=getUsersQuery(_0x341d45,_0x1818a0);return db[_0xbcdb('0x98')][_0xbcdb('0x73')](_0x59da88[_0xbcdb('0x99')](),_0x542cdc);})[_0xbcdb('0x5f')](function(_0x225eaa){_0x3f61a4=_[_0xbcdb('0x9a')](_0x225eaa,_0x44680e);if(_0x341d45===_0xbcdb('0x34')){return db['Setting'][_0xbcdb('0x9b')]({'attributes':[_0xbcdb('0x9c')],'raw':!![]});}})[_0xbcdb('0x5f')](function(_0x423e03){var _0x40b099=_0x423e03?_0x423e03[_0xbcdb('0x9c')]:undefined;var _0x58169d=_0x1818a0[_0xbcdb('0x1b')](function(_0x20f2d9){return updateInteraction(_0x20f2d9,_0x2fb38b,_0x3f61a4,_0x40b099);});return Promise['all'](_0x58169d);});}function countFilteredInteractions(_0x5cec60,_0x1024a0){var _0x701f6d=_0x5cec60[_0xbcdb('0x9d')]();_0x701f6d[_0xbcdb('0xd')]('COUNT(*)');_0x701f6d[_0xbcdb('0xd')](_0xbcdb('0x76'),_0xbcdb('0x77'));var _0x36130d=utils[_0xbcdb('0x27')](_0x1024a0);if(!_['isEmpty'](_0x36130d)){_0x701f6d[_0xbcdb('0x9e')](_0xbcdb('0x9f'),_0x36130d);}var _0x203ca7={'type':db[_0xbcdb('0xa0')][_0xbcdb('0x72')]['SELECT'],'raw':!![]};return db[_0xbcdb('0x98')][_0xbcdb('0x73')](_0x701f6d[_0xbcdb('0x99')](),_0x203ca7);}module[_0xbcdb('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x825f=['mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','buildExpression','type','text','value','start','end','read','and','operator','$substring','split','contact','ContactId','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','plainBody','some','concat','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','resolve','then','filter','get','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','contactName','i.id','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','enableEmailPreview','all','clone','COUNT(*)','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','from','getInteractionFK','user_has_','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?'];(function(_0x1796bc,_0x1d8a78){var _0x3a381f=function(_0x3a8e5d){while(--_0x3a8e5d){_0x1796bc['push'](_0x1796bc['shift']());}};_0x3a381f(++_0x1d8a78);}(_0x825f,0x1b2));var _0xf825=function(_0x3ba318,_0x494b55){_0x3ba318=_0x3ba318-0x0;var _0x59ba0b=_0x825f[_0x3ba318];return _0x59ba0b;};'use strict';var _=require(_0xf825('0x0'));var squel=require(_0xf825('0x1'));var as=require(_0xf825('0x2'));var qs=require(_0xf825('0x3'));var updateInteraction=require('./update-interaction')[_0xf825('0x4')];var utils=require(_0xf825('0x5'));var db=require(_0xf825('0x6'))['db'];function skipInteractionsQuery(_0xba3a81,_0x54c575,_0x43e2c6){var _0x442ffd=![];var _0x1c7341=utils[_0xf825('0x7')](_0xba3a81);if(_0x54c575[_0xf825('0x8')]==='agent'&&!_0x43e2c6[_0xf825('0x9')]&&!_0x43e2c6[_0x1c7341]){_0x442ffd=!![];}return _0x442ffd;}function getTagsQuery(){return squel[_0xf825('0xa')]()[_0xf825('0xb')]('id')[_0xf825('0xb')](_0xf825('0xc'))[_0xf825('0xb')]('color')[_0xf825('0xd')]('tools_tags');}function getUsersQuery(_0x584422,_0x59e1ef){var _0x17dd32=utils[_0xf825('0xe')](_0x584422);var _0x182edc=_0xf825('0xf')+_0x584422+'_interactions';var _0x18d126=squel[_0xf825('0xa')]()[_0xf825('0xb')]('u.id')[_0xf825('0xb')](_0xf825('0x10'))[_0xf825('0xb')](_0xf825('0x11')+_0x17dd32)['from'](_0x182edc,'ui')['left_join'](_0xf825('0x12'),'u',_0xf825('0x13'));if(_0x59e1ef['length']>0x0){_0x18d126[_0xf825('0x14')](_0xf825('0x11')+_0x17dd32+_0xf825('0x15'),_[_0xf825('0x16')](_0x59e1ef,'id'));}return _0x18d126;}function getInteractionsQuery(_0x2c5460){var _0x6d52b8=utils[_0xf825('0x17')](_0x2c5460);var _0x1c6aeb=utils[_0xf825('0x7')](_0x2c5460);var _0x104eeb=utils[_0xf825('0xe')](_0x2c5460);return squel[_0xf825('0xa')]()['from'](_0x6d52b8[_0xf825('0x18')],'i')[_0xf825('0x19')](_0xf825('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf825('0x19')](_0xf825('0x12'),'o',_0xf825('0x1b'))[_0xf825('0x19')](_0x6d52b8[_0xf825('0x1c')],'a',_0xf825('0x1d')+_0x1c6aeb)[_0xf825('0x19')](_0x6d52b8[_0xf825('0x1e')],'me','me.'+_0x104eeb+_0xf825('0x1f'))['left_join'](_0x6d52b8[_0xf825('0x20')],'it',_0xf825('0x21')+_0x104eeb+'\x20=\x20i.id')[_0xf825('0x19')](_0xf825('0x22'),'t',_0xf825('0x23'));}function getSqlClauses(){var _0x5833d8={'body':squel[_0xf825('0x24')](),'contact':squel[_0xf825('0x24')](),'default':squel[_0xf825('0x24')](),'fields':squel[_0xf825('0x24')](),'filter':squel[_0xf825('0x24')](),'read':squel[_0xf825('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xf825('0x24')]()};return _0x5833d8;}function parseTagParameter(_0x133203){var _0x4ca93b=squel[_0xf825('0x24')]();if(_0x133203){var _0x245aae=utils[_0xf825('0x25')](_0x133203);_0x245aae[_0xf825('0x26')](function(_0x25db66){_0x4ca93b['or'](_0xf825('0x27'),'%,'+_0x25db66+',%');});}return _0x4ca93b;}function parseReadParameter(_0x47900a){var _0x8df1c3='';if(_0x47900a){_0x8df1c3=_0xf825('0x28');if(_0x47900a==='1'){_0x8df1c3=_0x8df1c3[_0xf825('0x29')](_0xf825('0x2a'),'=');}else{_0x8df1c3=_0x8df1c3['replace'](_0xf825('0x2a'),'>');}}return _0x8df1c3;}function parseSearchFilter(_0x2304c1,_0x51a9b8){var _0x390e7c=squel[_0xf825('0x24')]();if(_0x51a9b8){var _0x123332=_0x51a9b8[_0xf825('0x29')]('\x5c','\x5c\x5c')[_0xf825('0x29')](/'/g,'\x27\x27');var _0x123173=qs[_0xf825('0x2b')](_0x123332);if(qs[_0xf825('0x2c')](_0x123332)){_0x390e7c['or']('i.id\x20LIKE\x20?',_0x123173+'%');if([_0xf825('0x2d'),_0xf825('0x2e')][_0xf825('0x2f')](_0x2304c1)){_0x390e7c['or'](_0xf825('0x30'),_0x123173+'%');}else if(_0x2304c1==='fax'){_0x390e7c['or'](_0xf825('0x31'),_0x123173+'%');}else if(_0x2304c1===_0xf825('0x32')){_0x390e7c['or'](_0xf825('0x33'),_0x123173+'%');}}else if(_0x2304c1===_0xf825('0x34')&&qs[_0xf825('0x35')](_0x123332)){_0x390e7c['or']('c.email\x20LIKE\x20?',_0x123173+'%');}else{if(_0x2304c1===_0xf825('0x34')){_0x390e7c['or'](_0xf825('0x36'),qs[_0xf825('0x37')](_0x123332,!![]))['or'](_0xf825('0x38'),qs[_0xf825('0x37')](_0x123332));}else if(_0x2304c1!==_0xf825('0x39')){_0x390e7c['or'](_0xf825('0x3a'),qs[_0xf825('0x37')](_0x123332));}_0x390e7c['or'](_0xf825('0x3b'),qs[_0xf825('0x37')](_0x123332,!![]),null);}}return _0x390e7c;}function parseAdvancedSearchFilter(_0x5e154e,_0x1c6195){var _0x3c2c98=getSqlClauses();var _0x46218f=as[_0xf825('0x3c')](_0x5e154e);var _0x568905=_0x46218f[_0xf825('0x3d')];for(var _0x29f0b0=0x0;_0x29f0b0<_0x46218f[_0xf825('0x3e')][_0xf825('0x3f')];_0x29f0b0++){var _0x54e8a3=_0x46218f[_0xf825('0x3e')][_0x29f0b0];var _0x288535='i';var _0x46e758=_[_0xf825('0x40')](_0x1c6195,[_0xf825('0xc'),_0x54e8a3[_0xf825('0xb')]]);if(_0x46e758){var _0x418b46=as[_0xf825('0x41')](_0x288535,_0x46e758[_0xf825('0x42')],_0x54e8a3);_0x3c2c98['default'][_0x568905](_0x418b46[_0xf825('0x43')],_0x418b46[_0xf825('0x44')][_0xf825('0x45')],_0x418b46['value'][_0xf825('0x46')]);}else{switch(_0x54e8a3[_0xf825('0xb')]){case'unreadMessages':var _0x1d6144=parseReadParameter(_0x54e8a3[_0xf825('0x44')]);_0x3c2c98[_0xf825('0x47')][_0xf825('0x48')](_0x1d6144);break;case'Contact':if(_0x54e8a3[_0xf825('0x49')]===_0xf825('0x4a')){if(_0x54e8a3[_0xf825('0x44')][_0xf825('0x4b')]('\x20')['length']>0x1){_0x3c2c98[_0xf825('0x4c')][_0x568905](_0xf825('0x3b'),qs[_0xf825('0x37')](_0x54e8a3[_0xf825('0x44')],!![]),null);}else{var _0x4a37aa='%'+_0x54e8a3[_0xf825('0x44')]+'%';_0x3c2c98[_0xf825('0x4c')][_0x568905]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4a37aa,_0x4a37aa,_0x4a37aa);}}else{_0x46e758=_[_0xf825('0x40')](_0x1c6195,['name',_0xf825('0x4d')]);_0x54e8a3['field']='ContactId';_0x418b46=as[_0xf825('0x41')](_0x288535,_0x46e758[_0xf825('0x42')],_0x54e8a3);_0x3c2c98[_0xf825('0x4c')][_0x568905](_0x418b46[_0xf825('0x43')],_0x418b46[_0xf825('0x44')][_0xf825('0x45')],_0x418b46[_0xf825('0x44')][_0xf825('0x46')]);}break;case _0xf825('0x4e'):var _0xbd56ed=_0x54e8a3[_0xf825('0x44')][_0xf825('0x4b')](',')['map'](function(_0x1e981b){return Number(_0x1e981b);});var _0xb4762=parseTagParameter(_0xbd56ed);_0x3c2c98[_0xf825('0x4f')][_0xf825('0x50')][_0xf825('0x48')](_0xb4762);_0x3c2c98[_0xf825('0x4f')][_0xf825('0x51')]=_0xbd56ed;break;case _0xf825('0x52'):if(_0x54e8a3[_0xf825('0x49')]==='$substring'){_0x3c2c98[_0xf825('0x53')][_0x568905](_0xf825('0x54'),'%'+_0x54e8a3['value']+'%',null);}else{_0x46e758=_['find'](_0x1c6195,[_0xf825('0xc'),_0xf825('0x55')]);_0x54e8a3[_0xf825('0xb')]=_0xf825('0x55');_0x418b46=as[_0xf825('0x41')](_0x288535,_0x46e758['type'],_0x54e8a3);_0x3c2c98[_0xf825('0x53')][_0x568905](_0x418b46[_0xf825('0x43')],_0x418b46[_0xf825('0x44')][_0xf825('0x45')],_0x418b46[_0xf825('0x44')][_0xf825('0x46')]);}break;case'body':case _0xf825('0x56'):_0x418b46=as[_0xf825('0x41')]('me',null,_0x54e8a3);_0x3c2c98['body'][_0x568905](_0x418b46[_0xf825('0x43')],_0x418b46[_0xf825('0x44')][_0xf825('0x45')],_0x418b46[_0xf825('0x44')][_0xf825('0x46')]);break;}}}return _0x3c2c98;}function parseModelFields(_0x31ae4d,_0x1ceb1a,_0x4e583e){var _0x1c65f0=utils[_0xf825('0x7')](_0x31ae4d);var _0xcc859e=squel['expr']();var _0x35a602=_(_0x1ceb1a)['keys']()['map'](function(_0x180fd6){return _[_0xf825('0x57')](_0x4e583e,[_0xf825('0xc'),_0x180fd6])?_0x180fd6:undefined;})['compact']()[_0xf825('0x44')]();if(_0x35a602[_0xf825('0x3f')]>0x0){_0x35a602[_0xf825('0x26')](function(_0x4cdab8){if(_0x4cdab8===_0x1c65f0){_0xcc859e['and']('i.'+_0x1c65f0+_0xf825('0x15'),[][_0xf825('0x58')](_0x1ceb1a[_0x4cdab8]));}else if(_0x4cdab8==='createdAt'){var _0x1a66a6=JSON[_0xf825('0x59')](_0x1ceb1a[_0x4cdab8])[_0xf825('0x5a')];var _0x249901=JSON[_0xf825('0x59')](_0x1ceb1a[_0x4cdab8])[_0xf825('0x5b')];_0xcc859e[_0xf825('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a66a6,_0x249901);}else{if(_0x1ceb1a[_0x4cdab8]==='null'){_0xcc859e[_0xf825('0x48')]('i.'+_0x4cdab8+_0xf825('0x5c'));}else{_0xcc859e['and']('i.'+_0x4cdab8+_0xf825('0x5d'),_0x1ceb1a[_0x4cdab8]);}}});}return _0xcc859e;}function parseQueryParameters(_0x4dbe72,_0x2b8afe,_0x5bc81a){var _0x2bfb73=getSqlClauses();return Promise[_0xf825('0x5e')]()[_0xf825('0x5f')](function(){return parseModelFields(_0x4dbe72,_0x2b8afe,_0x5bc81a);})['then'](function(_0x2f8615){_0x2bfb73['fields'][_0xf825('0x48')](_0x2f8615);return parseReadParameter(_0x2b8afe[_0xf825('0x47')]);})['then'](function(_0x5ca4c2){_0x2bfb73[_0xf825('0x47')][_0xf825('0x48')](_0x5ca4c2);return parseTagParameter(_0x2b8afe['tag']);})[_0xf825('0x5f')](function(_0x5d5f5f){_0x2bfb73[_0xf825('0x4f')][_0xf825('0x50')][_0xf825('0x48')](_0x5d5f5f);return parseSearchFilter(_0x4dbe72,_0x2b8afe[_0xf825('0x60')]);})[_0xf825('0x5f')](function(_0x5c4ef4){_0x2bfb73[_0xf825('0x60')]=_0x5c4ef4;return _0x2bfb73;});}function checkAccountsRestrictions(_0x365dcb,_0x18c0ef,_0x4ffc42){var _0x38bca6=utils[_0xf825('0x7')](_0x365dcb);var _0x13a19c=_0xf825('0x61')+_['capitalize'](_0x365dcb)+(_0x365dcb===_0xf825('0x62')?_0xf825('0x63'):_0xf825('0x64'));var _0x1892c0=squel[_0xf825('0x24')]();return Promise['resolve']()[_0xf825('0x5f')](function(){if(_0x4ffc42[_0xf825('0x9')]&&_0x18c0ef['role']===_0xf825('0x65')){return _0x18c0ef[_0x13a19c]({'attributes':['id'],'raw':!![]});}})[_0xf825('0x5f')](function(_0x26003b){if(_0x26003b){if(_0x26003b[_0xf825('0x3f')]===0x0){_0x1892c0[_0xf825('0x48')]('i.'+_0x38bca6+_0xf825('0x5c'));}else{_0x1892c0[_0xf825('0x48')]('i.'+_0x38bca6+_0xf825('0x15'),_[_0xf825('0x16')](_0x26003b,'id'));}}else if(!_0x4ffc42[_0x38bca6]){_0x1892c0[_0xf825('0x48')]('i.'+_0x38bca6+_0xf825('0x66'));}})[_0xf825('0x5f')](function(){return _0x1892c0;});}function getClosedOrderClause(_0x3e90d0,_0x55b738){var _0x53b62f='';var _0x2f517d=[_0xf825('0x67'),_0xf825('0x68'),'i.disposition'];if(_0x3e90d0===_0xf825('0x34')){_0x2f517d[_0xf825('0x69')]('i.substatus');}if(_0x55b738[_0xf825('0x6a')]==='0'&&_0x3e90d0===_0xf825('0x34')){_0x53b62f=_0xf825('0x6b');}else{if(_0x55b738[_0xf825('0x6a')]==='1'){_0x2f517d[_0xf825('0x6c')]();}_0x53b62f=_0xf825('0x6d')+_0x2f517d['join'](',\x20')+')';}return _0x53b62f;}function getFilteredInteractions(_0x645383,_0x4e7a89,_0x45199e,_0x42adcb){var _0x26af58=utils[_0xf825('0xe')](_0x645383);var _0x54f960=_[_0xf825('0x6e')](_0x645383)+'Interaction';var _0x154e9b=[];var _0x2c74f8=getTagsQuery();var _0x1119dd={'type':db[_0xf825('0x6f')][_0xf825('0x70')][_0xf825('0x71')],'raw':!![]};var _0x57e7e2=[];var _0x15c98d=[];return db[_0xf825('0x72')][_0xf825('0x73')](_0x2c74f8[_0xf825('0x74')](),_0x1119dd)['then'](function(_0x385394){_0x154e9b=_[_0xf825('0x75')](_0x385394,'id');_0x1119dd=_['merge'](_0x1119dd,{'model':db[_0x54f960],'mapToModel':!![],'nest':!![]});if(_0x45199e[_0xf825('0x76')]){_0x42adcb[_0xf825('0x77')][_0xf825('0x26')](function(_0x2a39fd){_0x4e7a89[_0xf825('0xb')]('i.'+_0x2a39fd);});}else{_0x4e7a89[_0xf825('0xb')](_0xf825('0x78'),_0xf825('0x79'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x7a'),'Account.key');_0x4e7a89[_0xf825('0xb')](_0xf825('0x7b'),_0xf825('0x7c'));if(_0x645383===_0xf825('0x34')){_0x4e7a89[_0xf825('0xb')](_0xf825('0x7d'),'Account.email');_0x4e7a89['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xf825('0x7e'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x7f'));_0x4e7a89[_0xf825('0xb')]('i.createdAt');_0x4e7a89[_0xf825('0xb')](_0xf825('0x80'));_0x4e7a89[_0xf825('0xb')]('i.closed');_0x4e7a89[_0xf825('0xb')]('i.closedAt');_0x4e7a89['field'](_0xf825('0x81'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x82'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x83'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x84'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x85'));_0x4e7a89[_0xf825('0xb')]('i.secondDisposition');_0x4e7a89[_0xf825('0xb')](_0xf825('0x67'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x6b'));_0x4e7a89['field'](_0xf825('0x86'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x87'));_0x4e7a89[_0xf825('0xb')]('i.MailAccountId');_0x4e7a89[_0xf825('0xb')](_0xf825('0x88'));}else if(_0x645383===_0xf825('0x32')){_0x4e7a89[_0xf825('0xb')](_0xf825('0x89'),_0xf825('0x7e'));}else{_0x4e7a89[_0xf825('0xb')](_0xf825('0x8a'),_0xf825('0x7e'));}if(_0x645383!=='mail'){_0x4e7a89['field'](_0xf825('0x8b'));}_0x4e7a89[_0xf825('0xb')](_0xf825('0x8c'),_0xf825('0x8d'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x8e'),_0xf825('0x8f'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x90'),_0xf825('0x91'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x92'),'Contact.phone');_0x4e7a89[_0xf825('0xb')](_0xf825('0x93'),_0xf825('0x94'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x95'),_0xf825('0x96'));_0x4e7a89[_0xf825('0xb')]('o.fullname',_0xf825('0x97'));_0x4e7a89[_0xf825('0xb')](_0xf825('0x98'),'Owner.internal');_0x4e7a89['field'](_0xf825('0x99'),_0xf825('0x9a'));}if(_0x42adcb[_0xf825('0x9b')]){_0x4e7a89['limit'](_0x42adcb['limit']);}if(_0x42adcb[_0xf825('0x9c')]){_0x4e7a89[_0xf825('0x9c')](_0x42adcb[_0xf825('0x9c')]);}return db[_0xf825('0x72')][_0xf825('0x73')](_0x4e7a89[_0xf825('0x74')](),_0x1119dd);})['then'](function(_0x57a98f){_0x57e7e2=_0x57a98f;var _0x142833=getUsersQuery(_0x645383,_0x57e7e2);return db[_0xf825('0x72')]['query'](_0x142833['toString'](),_0x1119dd);})['then'](function(_0x5d22b0){_0x15c98d=_['groupBy'](_0x5d22b0,_0x26af58);if(_0x645383===_0xf825('0x34')){return db[_0xf825('0x9d')]['findOne']({'attributes':[_0xf825('0x9e')],'raw':!![]});}})[_0xf825('0x5f')](function(_0x55dc12){var _0x69b73a=_0x55dc12?_0x55dc12[_0xf825('0x9e')]:undefined;var _0x38f92e=_0x57e7e2['map'](function(_0x914922){return updateInteraction(_0x914922,_0x154e9b,_0x15c98d,_0x69b73a);});return Promise[_0xf825('0x9f')](_0x38f92e);});}function countFilteredInteractions(_0x953ca2,_0x2513f7){var _0x2d3ec7=_0x953ca2[_0xf825('0xa0')]();_0x2d3ec7[_0xf825('0xb')](_0xf825('0xa1'));_0x2d3ec7[_0xf825('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf825('0x79'));var _0xfe17aa=utils[_0xf825('0x25')](_0x2513f7);if(!_['isEmpty'](_0xfe17aa)){_0x2d3ec7[_0xf825('0x14')]('t.id\x20IN\x20?',_0xfe17aa);}var _0x4ba113={'type':db['Sequelize'][_0xf825('0x70')][_0xf825('0x71')],'raw':!![]};return db[_0xf825('0x72')][_0xf825('0x73')](_0x2d3ec7[_0xf825('0x74')](),_0x4ba113);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 0960f15..bbba015 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d82=['waiting','unmanaged','total','closed','abandoned','UserId','disposition','findOne','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','push'];(function(_0x584985,_0x31a01f){var _0x123c16=function(_0x54ae33){while(--_0x54ae33){_0x584985['push'](_0x584985['shift']());}};_0x123c16(++_0x31a01f);}(_0x0d82,0xb3));var _0x20d8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0d82[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var db=require(_0x20d8('0x0'))['db'];function getInteractionUsers(_0xf13ceb,_0x33c783){return new Promise(function(_0x2bcd49,_0x26ba28){try{var _0x504f4e=[];if(_0x33c783[_0xf13ceb]){_0x504f4e=_0x33c783[_0xf13ceb][_0x20d8('0x1')](function(_0x4a6a1e){return{'id':_0x4a6a1e['id'],'fullname':_0x4a6a1e[_0x20d8('0x2')]};});}return _0x2bcd49(_0x504f4e);}catch(_0x590435){_0x26ba28(_0x590435);}});}function getInteractionTags(_0x479cf0,_0x3b5368){var _0x413cbf=[];if(_0x479cf0){_0x479cf0[_0x20d8('0x3')](',')['forEach'](function(_0x527c46){_0x413cbf[_0x20d8('0x4')](_0x3b5368[_0x527c46]);});}return _0x413cbf;}function updateWaitingCounter(_0x5de537){if(_0x5de537['waiting']){_0x5de537[_0x20d8('0x5')]-=0x1;}}function updateInteractionCounters(_0x1f2ce6){_0x1f2ce6[_0x20d8('0x5')]=0x0;_0x1f2ce6['talking']=0x0;_0x1f2ce6['answered']=0x0;_0x1f2ce6[_0x20d8('0x6')]=0x0;_0x1f2ce6['abandoned']=0x0;_0x1f2ce6[_0x20d8('0x7')]=0x0;if(_0x1f2ce6[_0x20d8('0x8')]){if(_0x1f2ce6['disposition']===_0x20d8('0x9')){_0x1f2ce6[_0x20d8('0x9')]+=0x1;updateWaitingCounter(_0x1f2ce6);}if(_0x1f2ce6[_0x20d8('0xa')]){_0x1f2ce6['answered']+=0x1;if(_0x1f2ce6['talking']){_0x1f2ce6['talking']-=0x1;}}else{if(_0x1f2ce6[_0x20d8('0xb')]){_0x1f2ce6[_0x20d8('0x6')]+=0x1;updateWaitingCounter(_0x1f2ce6);}}}else{if(!_0x1f2ce6[_0x20d8('0xa')]){_0x1f2ce6[_0x20d8('0x5')]+=0x1;}if(_0x1f2ce6['UserId']){_0x1f2ce6['talking']+=0x1;updateWaitingCounter(_0x1f2ce6);}}_0x1f2ce6[_0x20d8('0x7')]+=0x1;return _0x1f2ce6;}function getLastMessageText(_0x464b65){return db['MailMessage'][_0x20d8('0xc')]({'where':{'$and':[{'MailInteractionId':_0x464b65['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x20d8('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x20d8('0xe')],'order':_0x20d8('0xf'),'raw':!![]})[_0x20d8('0x10')](function(_0x30a400){if(_0x30a400&&_0x30a400[_0x20d8('0xe')]){_0x464b65[_0x20d8('0x11')]=_['trimStart'](_0x30a400[_0x20d8('0xe')]);}return _0x464b65;})[_0x20d8('0x12')](function(_0x1929d4){throw _0x1929d4;});}exports[_0x20d8('0x13')]=function(_0x2941a0,_0x49e50f,_0x1915b9,_0x45ed7d){return new Promise(function(_0x728a28,_0x17ad13){return getInteractionUsers(_0x2941a0['id'],_0x1915b9)[_0x20d8('0x10')](function(_0x27de5b){_0x2941a0[_0x20d8('0x14')]=_0x27de5b;return getInteractionTags(_0x2941a0[_0x20d8('0x15')],_0x49e50f);})['then'](function(_0x27b1c0){_0x2941a0[_0x20d8('0x16')]=_0x27b1c0;delete _0x2941a0[_0x20d8('0x15')];return updateInteractionCounters(_0x2941a0);})[_0x20d8('0x10')](function(_0x5681d4){if(_0x45ed7d){return getLastMessageText(_0x5681d4);}else{return _0x5681d4;}})['then'](function(_0x203328){_0x728a28(_0x203328);})['catch'](function(_0x272796){_0x17ad13(_0x272796);});});}; \ No newline at end of file +var _0xe0a6=['fullname','split','push','waiting','talking','answered','total','closed','abandoned','UserId','disposition','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds'];(function(_0x24cb26,_0x2a0cd6){var _0x530598=function(_0x3fd2ef){while(--_0x3fd2ef){_0x24cb26['push'](_0x24cb26['shift']());}};_0x530598(++_0x2a0cd6);}(_0xe0a6,0x108));var _0x6e0a=function(_0x390994,_0xddc697){_0x390994=_0x390994-0x0;var _0x27cb56=_0xe0a6[_0x390994];return _0x27cb56;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x35747f,_0x3a627b){return new Promise(function(_0xc02299,_0x4a169f){try{var _0x35e2ab=[];if(_0x3a627b[_0x35747f]){_0x35e2ab=_0x3a627b[_0x35747f]['map'](function(_0x301df2){return{'id':_0x301df2['id'],'fullname':_0x301df2[_0x6e0a('0x0')]};});}return _0xc02299(_0x35e2ab);}catch(_0xc4cc74){_0x4a169f(_0xc4cc74);}});}function getInteractionTags(_0x2f8ce2,_0x1dc365){var _0x575d19=[];if(_0x2f8ce2){_0x2f8ce2[_0x6e0a('0x1')](',')['forEach'](function(_0x296171){_0x575d19[_0x6e0a('0x2')](_0x1dc365[_0x296171]);});}return _0x575d19;}function updateWaitingCounter(_0x91d4b0){if(_0x91d4b0[_0x6e0a('0x3')]){_0x91d4b0[_0x6e0a('0x3')]-=0x1;}}function updateInteractionCounters(_0x8f6827){_0x8f6827[_0x6e0a('0x3')]=0x0;_0x8f6827[_0x6e0a('0x4')]=0x0;_0x8f6827[_0x6e0a('0x5')]=0x0;_0x8f6827['unmanaged']=0x0;_0x8f6827['abandoned']=0x0;_0x8f6827[_0x6e0a('0x6')]=0x0;if(_0x8f6827[_0x6e0a('0x7')]){if(_0x8f6827['disposition']===_0x6e0a('0x8')){_0x8f6827[_0x6e0a('0x8')]+=0x1;updateWaitingCounter(_0x8f6827);}if(_0x8f6827[_0x6e0a('0x9')]){_0x8f6827[_0x6e0a('0x5')]+=0x1;if(_0x8f6827[_0x6e0a('0x4')]){_0x8f6827['talking']-=0x1;}}else{if(_0x8f6827[_0x6e0a('0xa')]){_0x8f6827[_0x6e0a('0xb')]+=0x1;updateWaitingCounter(_0x8f6827);}}}else{if(!_0x8f6827[_0x6e0a('0x9')]){_0x8f6827['waiting']+=0x1;}if(_0x8f6827[_0x6e0a('0x9')]){_0x8f6827['talking']+=0x1;updateWaitingCounter(_0x8f6827);}}_0x8f6827['total']+=0x1;return _0x8f6827;}function getLastMessageText(_0x106392){return db[_0x6e0a('0xc')][_0x6e0a('0xd')]({'where':{'$and':[{'MailInteractionId':_0x106392['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6e0a('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6e0a('0xf')],'order':_0x6e0a('0x10'),'raw':!![]})[_0x6e0a('0x11')](function(_0x377cb6){if(_0x377cb6&&_0x377cb6[_0x6e0a('0xf')]){_0x106392[_0x6e0a('0x12')]=_[_0x6e0a('0x13')](_0x377cb6[_0x6e0a('0xf')]);}return _0x106392;})[_0x6e0a('0x14')](function(_0x3197d9){throw _0x3197d9;});}exports[_0x6e0a('0x15')]=function(_0xaa86e0,_0x77cd8e,_0x2a5900,_0x1ec9b3){return new Promise(function(_0x1f2234,_0xbb219e){return getInteractionUsers(_0xaa86e0['id'],_0x2a5900)[_0x6e0a('0x11')](function(_0xda019d){_0xaa86e0[_0x6e0a('0x16')]=_0xda019d;return getInteractionTags(_0xaa86e0['TagIds'],_0x77cd8e);})['then'](function(_0x2109c6){_0xaa86e0['Tags']=_0x2109c6;delete _0xaa86e0[_0x6e0a('0x17')];return updateInteractionCounters(_0xaa86e0);})[_0x6e0a('0x11')](function(_0x1c37b8){if(_0x1ec9b3){return getLastMessageText(_0x1c37b8);}else{return _0x1c37b8;}})[_0x6e0a('0x11')](function(_0x2d5142){_0x1f2234(_0x2d5142);})[_0x6e0a('0x14')](function(_0xd79e58){_0xbb219e(_0xd79e58);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7178479..334c11f 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c8e=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','_interactions','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','then','update','catch','error','info','toUpperCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20interaction=','\x20body='];(function(_0x206d4b,_0x290d9e){var _0x26aae7=function(_0x331e92){while(--_0x331e92){_0x206d4b['push'](_0x206d4b['shift']());}};_0x26aae7(++_0x290d9e);}(_0x2c8e,0x69));var _0xe2c8=function(_0x52784c,_0x5751d6){_0x52784c=_0x52784c-0x0;var _0x147746=_0x2c8e[_0x52784c];return _0x147746;};'use strict';var _=require(_0xe2c8('0x0'));var db=require(_0xe2c8('0x1'))['db'];var loggers={'openchannel':require(_0xe2c8('0x2'))(_0xe2c8('0x3')),'mail':require('../../config/logger')(_0xe2c8('0x4')),'fax':require(_0xe2c8('0x2'))('fax-interactions'),'sms':require(_0xe2c8('0x2'))(_0xe2c8('0x5')),'chat':require('../../config/logger')(_0xe2c8('0x6')),'whatsapp':require(_0xe2c8('0x2'))('whatsapp-interactions')};function getAccountFK(_0x26e180){return _[_0xe2c8('0x7')](_0x26e180)+(_0x26e180===_0xe2c8('0x8')?_0xe2c8('0x9'):_0xe2c8('0xa'))+'Id';}function getInteractionFK(_0x40734f){return _[_0xe2c8('0x7')](_0x40734f)+_0xe2c8('0xb');}function getInteractionId(_0xa00f83,_0x565be3,_0xd4e851){if(_0xa00f83&&_0xa00f83[_[_0xe2c8('0xc')](_0xd4e851)+_0xe2c8('0xb')]){return _0xa00f83[_[_0xe2c8('0xc')](_0xd4e851)+_0xe2c8('0xb')];}else if(_0xa00f83&&_0xa00f83['id']){return _0xa00f83['id'];}else if(_0x565be3&&_0x565be3['id']){return _0x565be3['id'];}else{return _0xe2c8('0xd');}}function getInteractionsTables(_0x17cef1){return{'accounts':_0x17cef1+'_'+(_0x17cef1==='chat'?'websites':'accounts'),'interactions':_0x17cef1+_0xe2c8('0xe'),'interactionsTags':_0x17cef1+'_interaction_has_tags','messages':_0x17cef1+_0xe2c8('0xf'),'userInteractions':_0xe2c8('0x10')+_0x17cef1+_0xe2c8('0xe')};}function getSelectedTags(_0xc5cba4){var _0x5ced90=[];if(_0xc5cba4){_0x5ced90=Array[_0xe2c8('0x11')](_0xc5cba4)?_0xc5cba4:[_0xc5cba4];}return _0x5ced90;}function log(_0x216484,_0x3671a4,_0x5c9c55,_0x6a6634,_0x2c1d3c,_0x540841){loggers[_0x2c1d3c[_0xe2c8('0x12')]()][_0x216484](_0xe2c8('0x13'),_0x540841['toUpperCase'](),_0x3671a4?_0x3671a4['id']:null,_0x3671a4?_0x3671a4[_0xe2c8('0x14')]:null,_0x3671a4?_0x3671a4[_0xe2c8('0x15')]:null,getInteractionId(_0x5c9c55,_0x6a6634,_0x2c1d3c),_0x5c9c55?JSON['stringify'](_0x5c9c55):_0xe2c8('0x16'));}function updateUser(_0x4d809b,_0x5cf10e,_0x166b92,_0x519cba,_0x33c719){db[_[_0xe2c8('0xc')](_0x519cba)+_0xe2c8('0x17')][_0xe2c8('0x18')]({'where':{'id':getInteractionId(_0x5cf10e,_0x166b92,_0x519cba)}})[_0xe2c8('0x19')](function(_0x30815c){if(_0x30815c){return _0x30815c[_0xe2c8('0x1a')]({'UserId':_0x4d809b?_0x4d809b['id']:null});}})[_0xe2c8('0x19')](function(_0x3da0bf){if(_0x3da0bf){log('info',_0x4d809b,_0x5cf10e,_0x166b92,_0x519cba,_0x33c719);}})[_0xe2c8('0x1b')](function(){log(_0xe2c8('0x1c'),_0x4d809b,_0x5cf10e,_0x166b92,_0x519cba,_0x33c719);});}function logAcceptMessage(_0x311d9b,_0x1f68a3,_0xbbeffe,_0x2e920b){var _0x116179=loggers[_0x311d9b[_0xe2c8('0x12')]()];var _0x5b2f74=_0x1f68a3['id'];var _0x2b2dff=_0x1f68a3[_0xe2c8('0x14')];var _0x1067dc=_0x1f68a3[_0xe2c8('0x15')];var _0x4168a3=JSON['stringify'](_0x2e920b||null);_0x116179[_0xe2c8('0x1d')]('['+_0x311d9b[_0xe2c8('0x1e')]()+_0xe2c8('0x1f')+_0x5b2f74+_0xe2c8('0x20')+_0x2b2dff+'\x20role='+_0x1067dc+_0xe2c8('0x21')+_0xbbeffe+_0xe2c8('0x22')+_0x4168a3);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x4f96=['sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','info','\x20name=','\x20role=','\x20interaction=','exports','../../config/logger','fax-interactions'];(function(_0xac94a6,_0x45aa2c){var _0x8f3bc2=function(_0x5d6bac){while(--_0x5d6bac){_0xac94a6['push'](_0xac94a6['shift']());}};_0x8f3bc2(++_0x45aa2c);}(_0x4f96,0x17e));var _0x64f9=function(_0x3f86a9,_0x48e78b){_0x3f86a9=_0x3f86a9-0x0;var _0x2456ee=_0x4f96[_0x3f86a9];return _0x2456ee;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x64f9('0x0'))('openchannel-interactions'),'mail':require(_0x64f9('0x0'))('mail-interactions'),'fax':require(_0x64f9('0x0'))(_0x64f9('0x1')),'sms':require(_0x64f9('0x0'))(_0x64f9('0x2')),'chat':require(_0x64f9('0x0'))(_0x64f9('0x3')),'whatsapp':require('../../config/logger')(_0x64f9('0x4'))};function getAccountFK(_0x529c07){return _['capitalize'](_0x529c07)+(_0x529c07===_0x64f9('0x5')?_0x64f9('0x6'):_0x64f9('0x7'))+'Id';}function getInteractionFK(_0x51a0ac){return _[_0x64f9('0x8')](_0x51a0ac)+_0x64f9('0x9');}function getInteractionId(_0x2cd159,_0x41d3a3,_0x576cd1){if(_0x2cd159&&_0x2cd159[_['upperFirst'](_0x576cd1)+'InteractionId']){return _0x2cd159[_[_0x64f9('0xa')](_0x576cd1)+'InteractionId'];}else if(_0x2cd159&&_0x2cd159['id']){return _0x2cd159['id'];}else if(_0x41d3a3&&_0x41d3a3['id']){return _0x41d3a3['id'];}else{return _0x64f9('0xb');}}function getInteractionsTables(_0xa499f6){return{'accounts':_0xa499f6+'_'+(_0xa499f6==='chat'?_0x64f9('0xc'):_0x64f9('0xd')),'interactions':_0xa499f6+_0x64f9('0xe'),'interactionsTags':_0xa499f6+_0x64f9('0xf'),'messages':_0xa499f6+_0x64f9('0x10'),'userInteractions':_0x64f9('0x11')+_0xa499f6+_0x64f9('0xe')};}function getSelectedTags(_0x25473f){var _0x1b3b3f=[];if(_0x25473f){_0x1b3b3f=Array['isArray'](_0x25473f)?_0x25473f:[_0x25473f];}return _0x1b3b3f;}function log(_0x17b683,_0x5f0a5b,_0x5f181f,_0x10aadd,_0x470608,_0x18c295){loggers[_0x470608[_0x64f9('0x12')]()][_0x17b683](_0x64f9('0x13'),_0x18c295[_0x64f9('0x14')](),_0x5f0a5b?_0x5f0a5b['id']:null,_0x5f0a5b?_0x5f0a5b[_0x64f9('0x15')]:null,_0x5f0a5b?_0x5f0a5b[_0x64f9('0x16')]:null,getInteractionId(_0x5f181f,_0x10aadd,_0x470608),_0x5f181f?JSON[_0x64f9('0x17')](_0x5f181f):_0x64f9('0x18'));}function updateUser(_0x389a55,_0x3bceda,_0x645179,_0x2cdfe4,_0x5dc2a0){db[_[_0x64f9('0xa')](_0x2cdfe4)+'Interaction'][_0x64f9('0x19')]({'where':{'id':getInteractionId(_0x3bceda,_0x645179,_0x2cdfe4)}})[_0x64f9('0x1a')](function(_0x8f544){if(_0x8f544){return _0x8f544['update']({'UserId':_0x389a55?_0x389a55['id']:null});}})[_0x64f9('0x1a')](function(_0x587dd0){if(_0x587dd0){log('info',_0x389a55,_0x3bceda,_0x645179,_0x2cdfe4,_0x5dc2a0);}})['catch'](function(){log('error',_0x389a55,_0x3bceda,_0x645179,_0x2cdfe4,_0x5dc2a0);});}function logAcceptMessage(_0x5bea55,_0x254c76,_0xd9ae,_0x14425c){var _0x49525f=loggers[_0x5bea55[_0x64f9('0x12')]()];var _0x3728b7=_0x254c76['id'];var _0x318baa=_0x254c76[_0x64f9('0x15')];var _0x460b00=_0x254c76[_0x64f9('0x16')];var _0x397fc2=JSON[_0x64f9('0x17')](_0x14425c||null);_0x49525f[_0x64f9('0x1b')]('['+_0x5bea55[_0x64f9('0x14')]()+'MESSAGE:ACCEPT]\x20id='+_0x3728b7+_0x64f9('0x1c')+_0x318baa+_0x64f9('0x1d')+_0x460b00+_0x64f9('0x1e')+_0xd9ae+'\x20body='+_0x397fc2);}module[_0x64f9('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 24eec96..c32c12c 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 _0xc9b7=['hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc9b7,0x1b4));var _0x7c9b=function(_0x3c86b4,_0x431782){_0x3c86b4=_0x3c86b4-0x0;var _0x268334=_0xc9b7[_0x3c86b4];return _0x268334;};'use strict';var crypto=require(_0x7c9b('0x0'));var util=require('util');var compose=require(_0x7c9b('0x1'));var db=require(_0x7c9b('0x2'))['db'];var config=require(_0x7c9b('0x3'));function getValueFromLicense(_0x444339,_0x2683d9){if(_0x444339&&_0x2683d9){if(_0x2683d9[_0x7c9b('0x4')]&&_0x2683d9[_0x7c9b('0x5')]){var _0x3ce251=_0x2683d9[_0x7c9b('0x4')];var _0xc7aff5=_0x2683d9['license'];var _0x4d70aa=_0x3ce251['split']('-')[0x4];var _0x3ed4c0=_0x3ce251[_0x7c9b('0x6')]('-')[0x0];var _0x303f34=crypto['createDecipher'](_0x7c9b('0x7'),util[_0x7c9b('0x8')](_0x7c9b('0x9'),_0x4d70aa,_0x3ce251,_0x3ed4c0));var _0x59e035=_0x303f34['update'](_0xc7aff5,_0x7c9b('0xa'),_0x7c9b('0xb'));_0x59e035+=_0x303f34[_0x7c9b('0xc')](_0x7c9b('0xb'));var _0x2fcc83=JSON[_0x7c9b('0xd')](_0x59e035);return _0x2fcc83[_0x7c9b('0xe')](_0x444339)?_0x2fcc83[_0x444339]:null;}}return null;}function isLimit(_0xd10790,_0x5a485f,_0x1e6490,_0x23821f){var _0x47f38b=_0x5a485f;return compose()[_0x7c9b('0xf')](function(_0x9af6b3,_0x4ab289,_0x4effd4){return db[_0x7c9b('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7c9b('0x11')](function(_0x7d8f41){var _0x749326=getValueFromLicense(_0xd10790,_0x7d8f41);return _0x749326?_0x749326:_0x47f38b;})['then'](function(_0x3484b4){_0x47f38b=_0x3484b4;return _0x1e6490[_0x7c9b('0x12')](_0x23821f);})['then'](function(_0xae22f2){if(_0xae22f2>=_0x47f38b){return _0x4ab289[_0x7c9b('0x13')](0x193)[_0x7c9b('0x14')]({'message':util[_0x7c9b('0x8')](_0x7c9b('0x15'),_0xd10790)});}_0x4effd4();})[_0x7c9b('0x16')](function(_0x16987c){_0x4effd4(_0x16987c);});});}function isUserLimit(){return isLimit(_0x7c9b('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x7c9b('0x18')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xe72a=['createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe72a,0xd9));var _0xae72=function(_0x5e3ecd,_0x117ca0){_0x5e3ecd=_0x5e3ecd-0x0;var _0x2270b8=_0xe72a[_0x5e3ecd];return _0x2270b8;};'use strict';var crypto=require('crypto');var util=require(_0xae72('0x0'));var compose=require(_0xae72('0x1'));var db=require(_0xae72('0x2'))['db'];var config=require(_0xae72('0x3'));function getValueFromLicense(_0x97ff8f,_0x1637e9){if(_0x97ff8f&&_0x1637e9){if(_0x1637e9[_0xae72('0x4')]&&_0x1637e9['license']){var _0x57eecb=_0x1637e9[_0xae72('0x4')];var _0x461724=_0x1637e9[_0xae72('0x5')];var _0x3d8a1e=_0x57eecb[_0xae72('0x6')]('-')[0x4];var _0x1d3281=_0x57eecb[_0xae72('0x6')]('-')[0x0];var _0x33a5eb=crypto[_0xae72('0x7')](_0xae72('0x8'),util['format'](_0xae72('0x9'),_0x3d8a1e,_0x57eecb,_0x1d3281));var _0x3bbba1=_0x33a5eb[_0xae72('0xa')](_0x461724,_0xae72('0xb'),_0xae72('0xc'));_0x3bbba1+=_0x33a5eb[_0xae72('0xd')]('utf8');var _0x4def12=JSON['parse'](_0x3bbba1);return _0x4def12[_0xae72('0xe')](_0x97ff8f)?_0x4def12[_0x97ff8f]:null;}}return null;}function isLimit(_0x2d9e31,_0x242e95,_0x128d92,_0x20e2bb){var _0x2dff67=_0x242e95;return compose()[_0xae72('0xf')](function(_0xd51115,_0x28d39,_0x3c2d92){return db[_0xae72('0x10')][_0xae72('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3a420b){var _0x494f4e=getValueFromLicense(_0x2d9e31,_0x3a420b);return _0x494f4e?_0x494f4e:_0x2dff67;})[_0xae72('0x12')](function(_0xab90c){_0x2dff67=_0xab90c;return _0x128d92[_0xae72('0x13')](_0x20e2bb);})[_0xae72('0x12')](function(_0x475354){if(_0x475354>=_0x2dff67){return _0x28d39[_0xae72('0x14')](0x193)[_0xae72('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2d9e31)});}_0x3c2d92();})[_0xae72('0x16')](function(_0x1178cc){_0x3c2d92(_0x1178cc);});});}function isUserLimit(){return isLimit(_0xae72('0x17'),0x1,db[_0xae72('0x18')],{'where':{'$or':[{'role':_0xae72('0x19')},{'role':_0xae72('0x1a')}]}});}exports[_0xae72('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 67dbca9..9bbec93 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 _0x4b74=['split','length','slice','forEach','shift','match','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','<\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','[$or]','replace','[$and]'];(function(_0x38c0de,_0x32eb18){var _0x1b4579=function(_0x36827d){while(--_0x36827d){_0x38c0de['push'](_0x38c0de['shift']());}};_0x1b4579(++_0x32eb18);}(_0x4b74,0x192));var _0x44b7=function(_0x57a85b,_0x23c478){_0x57a85b=_0x57a85b-0x0;var _0x1d1082=_0x4b74[_0x57a85b];return _0x1d1082;};'use strict';var _=require(_0x44b7('0x0'));var moment=require(_0x44b7('0x1'));exports[_0x44b7('0x2')]=function(_0x56deac){var _0x385f84={'conditions':[]};_0x385f84['sqlOperator']=_['startsWith'](_0x56deac,_0x44b7('0x3'))?'or':'and';var _0x2bfe66=_0x56deac[_0x44b7('0x4')](_0x44b7('0x5'),'')[_0x44b7('0x4')](_0x44b7('0x3'),'')[_0x44b7('0x6')]('||');for(var _0x4ead02=0x0;_0x4ead02<_0x2bfe66[_0x44b7('0x7')];_0x4ead02++){var _0x53f252=_0x2bfe66[_0x4ead02][_0x44b7('0x6')](':=');var _0x10115a=_0x53f252[0x0];var _0x38f121=_0x53f252[_0x44b7('0x8')](0x1);_0x38f121[_0x44b7('0x9')](function(_0x16f526){var _0x395ee4=_0x16f526[_0x44b7('0x6')]('[')[_0x44b7('0xa')]();var _0x3d7a45=_0x16f526[_0x44b7('0xb')](/\[(.*?)\]/g);_0x3d7a45[_0x44b7('0x9')](function(_0x490df2){var _0x4e600a=_0x490df2[_0x44b7('0x6')]('[')['filter'](function(_0xd3a21d){return _0xd3a21d[_0x44b7('0xc')](']')>-0x1;})[_0x44b7('0xd')](function(_0x4aaef0){return _0x4aaef0[_0x44b7('0x6')](']')[0x0];})[0x0];_0x385f84[_0x44b7('0xe')]['push']({'field':_0x10115a,'operator':_0x395ee4,'value':_0x4e600a});});});}return _0x385f84;};exports[_0x44b7('0xf')]=function(_0x1d98dc,_0xf895e8,_0x21ee03){var _0x106559={};if(_0xf895e8===_0x44b7('0x10')){if(_0x21ee03[_0x44b7('0x11')]===_0x44b7('0x12')){_0x21ee03[_0x44b7('0x11')]=_0x44b7('0x13');_0x21ee03[_0x44b7('0x14')]+=','+_0x21ee03['value'];}else if(_[_0x44b7('0x15')](['$gt',_0x44b7('0x16')],_0x21ee03[_0x44b7('0x11')])){_0x21ee03[_0x44b7('0x14')]=moment(_0x21ee03[_0x44b7('0x14')])[_0x44b7('0x17')](0x1,_0x44b7('0x18'))[_0x44b7('0x19')](_0x44b7('0x1a'));}}if(_0x21ee03[_0x44b7('0x1b')]){_0xf895e8=_0x21ee03[_0x44b7('0x1b')];_0x106559[_0x44b7('0x1c')]='CAST('+_0x1d98dc+'.'+_0x21ee03[_0x44b7('0x1d')]+'\x20AS\x20'+_0x21ee03['castTo']+')\x20'+parseOperator(_0x21ee03['operator']);}else{_0x106559[_0x44b7('0x1c')]=_0x1d98dc+'.'+_0x21ee03['field']+'\x20'+parseOperator(_0x21ee03['operator']);}if(_['includes'](['$ne',_0x44b7('0x1e')],_0x21ee03['operator']))_0x106559[_0x44b7('0x1c')]='('+_0x106559[_0x44b7('0x1c')]+_0x44b7('0x1f')+_0x1d98dc+'.'+_0x21ee03['field']+_0x44b7('0x20');_0x106559[_0x44b7('0x14')]=parseValue(_0xf895e8,_0x21ee03[_0x44b7('0x11')],_0x21ee03[_0x44b7('0x14')]);return _0x106559;};function parseOperator(_0x52aca3){var _0x2171e7;switch(_0x52aca3){case _0x44b7('0x21'):_0x2171e7=_0x44b7('0x22');break;case _0x44b7('0x1e'):_0x2171e7=_0x44b7('0x23');break;case _0x44b7('0x12'):_0x2171e7=_0x44b7('0x24');break;case _0x44b7('0x25'):_0x2171e7=_0x44b7('0x26');break;case _0x44b7('0x27'):case'$startsWith':case _0x44b7('0x28'):_0x2171e7='LIKE\x20?';break;case'$lt':_0x2171e7=_0x44b7('0x29');break;case'$gt':_0x2171e7='>\x20?';break;case _0x44b7('0x16'):_0x2171e7=_0x44b7('0x2a');break;case'$gte':_0x2171e7=_0x44b7('0x2b');break;case _0x44b7('0x13'):_0x2171e7=_0x44b7('0x2c');break;}return _0x2171e7;}function parseValue(_0x2f3b4d,_0x133cb9,_0x101cc8){var _0x3beaac={'start':undefined,'end':undefined};switch(_0x133cb9){case _0x44b7('0x21'):case'$notIn':_0x3beaac[_0x44b7('0x2d')]=_0x101cc8[_0x44b7('0x6')](',');break;case _0x44b7('0x27'):_0x3beaac['start']='%'+_0x101cc8+'%';break;case'$startsWith':_0x3beaac[_0x44b7('0x2d')]=_0x101cc8+'%';break;case _0x44b7('0x28'):_0x3beaac[_0x44b7('0x2d')]='%'+_0x101cc8;break;case'$between':var _0x5c23a4=_0x101cc8[_0x44b7('0x6')](',');var _0x101cc8=_0x5c23a4[_0x44b7('0xa')]();var _0x53ffa2=_0x5c23a4[_0x44b7('0x2e')]();if(_0x2f3b4d===_0x44b7('0x10')){_0x101cc8=moment(_0x101cc8)['utcOffset'](0x0,!![])[_0x44b7('0x19')]();_0x53ffa2=moment(_0x53ffa2)[_0x44b7('0x2f')](0x0,!![])[_0x44b7('0x17')](0x17,_0x44b7('0x30'))['add'](0x3b,_0x44b7('0x31'))[_0x44b7('0x17')](0x3b,_0x44b7('0x32'))['format']();}_0x3beaac={'start':_0x101cc8,'end':_0x53ffa2};break;default:_0x3beaac[_0x44b7('0x2d')]=_0x101cc8;break;}return _0x3beaac;} \ No newline at end of file +var _0x7dd2=['shift','match','filter','map','conditions','push','buildExpression','DATE','operator','value','$gt','$lte','add','YYYY-MM-DD','castTo','text','CAST(','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','utcOffset','format','hours','minutes','seconds','moment','[$and]','replace','[$or]','split','length','slice','forEach'];(function(_0x14aed7,_0x315935){var _0x26f959=function(_0x1a0293){while(--_0x1a0293){_0x14aed7['push'](_0x14aed7['shift']());}};_0x26f959(++_0x315935);}(_0x7dd2,0xfc));var _0x27dd=function(_0x156aaa,_0x37d421){_0x156aaa=_0x156aaa-0x0;var _0xd2453e=_0x7dd2[_0x156aaa];return _0xd2453e;};'use strict';var _=require('lodash');var moment=require(_0x27dd('0x0'));exports['parseSearch']=function(_0x2778c8){var _0x122396={'conditions':[]};_0x122396['sqlOperator']=_['startsWith'](_0x2778c8,'[$or]')?'or':'and';var _0x26ccf6=_0x2778c8['replace'](_0x27dd('0x1'),'')[_0x27dd('0x2')](_0x27dd('0x3'),'')[_0x27dd('0x4')]('||');for(var _0x12d1a0=0x0;_0x12d1a0<_0x26ccf6[_0x27dd('0x5')];_0x12d1a0++){var _0x53d473=_0x26ccf6[_0x12d1a0][_0x27dd('0x4')](':=');var _0x57df48=_0x53d473[0x0];var _0x14f0c3=_0x53d473[_0x27dd('0x6')](0x1);_0x14f0c3[_0x27dd('0x7')](function(_0x4bb864){var _0x19bc71=_0x4bb864[_0x27dd('0x4')]('[')[_0x27dd('0x8')]();var _0x4f4993=_0x4bb864[_0x27dd('0x9')](/\[(.*?)\]/g);_0x4f4993[_0x27dd('0x7')](function(_0xa17d1e){var _0x3eb35d=_0xa17d1e[_0x27dd('0x4')]('[')[_0x27dd('0xa')](function(_0x431965){return _0x431965['indexOf'](']')>-0x1;})[_0x27dd('0xb')](function(_0x472c2a){return _0x472c2a[_0x27dd('0x4')](']')[0x0];})[0x0];_0x122396[_0x27dd('0xc')][_0x27dd('0xd')]({'field':_0x57df48,'operator':_0x19bc71,'value':_0x3eb35d});});});}return _0x122396;};exports[_0x27dd('0xe')]=function(_0x30c84e,_0xb426e7,_0x3537d1){var _0x32c774={};if(_0xb426e7===_0x27dd('0xf')){if(_0x3537d1[_0x27dd('0x10')]==='$eq'){_0x3537d1[_0x27dd('0x10')]='$between';_0x3537d1[_0x27dd('0x11')]+=','+_0x3537d1[_0x27dd('0x11')];}else if(_['includes']([_0x27dd('0x12'),_0x27dd('0x13')],_0x3537d1[_0x27dd('0x10')])){_0x3537d1[_0x27dd('0x11')]=moment(_0x3537d1[_0x27dd('0x11')])[_0x27dd('0x14')](0x1,'days')['format'](_0x27dd('0x15'));}}if(_0x3537d1[_0x27dd('0x16')]){_0xb426e7=_0x3537d1['castTo'];_0x32c774[_0x27dd('0x17')]=_0x27dd('0x18')+_0x30c84e+'.'+_0x3537d1[_0x27dd('0x19')]+'\x20AS\x20'+_0x3537d1[_0x27dd('0x16')]+')\x20'+parseOperator(_0x3537d1['operator']);}else{_0x32c774[_0x27dd('0x17')]=_0x30c84e+'.'+_0x3537d1[_0x27dd('0x19')]+'\x20'+parseOperator(_0x3537d1[_0x27dd('0x10')]);}if(_[_0x27dd('0x1a')]([_0x27dd('0x1b'),_0x27dd('0x1c')],_0x3537d1[_0x27dd('0x10')]))_0x32c774[_0x27dd('0x17')]='('+_0x32c774[_0x27dd('0x17')]+_0x27dd('0x1d')+_0x30c84e+'.'+_0x3537d1[_0x27dd('0x19')]+_0x27dd('0x1e');_0x32c774[_0x27dd('0x11')]=parseValue(_0xb426e7,_0x3537d1[_0x27dd('0x10')],_0x3537d1[_0x27dd('0x11')]);return _0x32c774;};function parseOperator(_0x34d210){var _0x6ee8a6;switch(_0x34d210){case _0x27dd('0x1f'):_0x6ee8a6=_0x27dd('0x20');break;case _0x27dd('0x1c'):_0x6ee8a6=_0x27dd('0x21');break;case _0x27dd('0x22'):_0x6ee8a6=_0x27dd('0x23');break;case _0x27dd('0x1b'):_0x6ee8a6='<>\x20?';break;case _0x27dd('0x24'):case _0x27dd('0x25'):case'$endsWith':_0x6ee8a6=_0x27dd('0x26');break;case'$lt':_0x6ee8a6=_0x27dd('0x27');break;case'$gt':_0x6ee8a6='>\x20?';break;case'$lte':_0x6ee8a6=_0x27dd('0x28');break;case _0x27dd('0x29'):_0x6ee8a6=_0x27dd('0x2a');break;case'$between':_0x6ee8a6=_0x27dd('0x2b');break;}return _0x6ee8a6;}function parseValue(_0x2597fb,_0x56e297,_0x30869d){var _0x105ce2={'start':undefined,'end':undefined};switch(_0x56e297){case _0x27dd('0x1f'):case _0x27dd('0x1c'):_0x105ce2[_0x27dd('0x2c')]=_0x30869d[_0x27dd('0x4')](',');break;case _0x27dd('0x24'):_0x105ce2[_0x27dd('0x2c')]='%'+_0x30869d+'%';break;case _0x27dd('0x25'):_0x105ce2['start']=_0x30869d+'%';break;case'$endsWith':_0x105ce2[_0x27dd('0x2c')]='%'+_0x30869d;break;case _0x27dd('0x2d'):var _0x2629f9=_0x30869d[_0x27dd('0x4')](',');var _0x30869d=_0x2629f9[_0x27dd('0x8')]();var _0x15a25a=_0x2629f9[_0x27dd('0x2e')]();if(_0x2597fb===_0x27dd('0xf')){_0x30869d=moment(_0x30869d)[_0x27dd('0x2f')](0x0,!![])[_0x27dd('0x30')]();_0x15a25a=moment(_0x15a25a)[_0x27dd('0x2f')](0x0,!![])[_0x27dd('0x14')](0x17,_0x27dd('0x31'))[_0x27dd('0x14')](0x3b,_0x27dd('0x32'))[_0x27dd('0x14')](0x3b,_0x27dd('0x33'))[_0x27dd('0x30')]();}_0x105ce2={'start':_0x30869d,'end':_0x15a25a};break;default:_0x105ce2[_0x27dd('0x2c')]=_0x30869d;break;}return _0x105ce2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d8bf401..29c4243 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 _0x251a=['isString','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','replace','trim','forEach','{EXPR}','join','$id','query','model','intersection','attributes','length','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','includeAll','push','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','alias','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','DESC','col','unsigned','ASC','omit','isObject'];(function(_0x35cfbd,_0x425f62){var _0x11c8ed=function(_0x44d22e){while(--_0x44d22e){_0x35cfbd['push'](_0x35cfbd['shift']());}};_0x11c8ed(++_0x425f62);}(_0x251a,0xf5));var _0xa251=function(_0x5891aa,_0x2baf88){_0x5891aa=_0x5891aa-0x0;var _0xabe03d=_0x251a[_0x5891aa];return _0xabe03d;};'use strict';var _=require(_0xa251('0x0'));var sequelize=require(_0xa251('0x1'));var moment=require(_0xa251('0x2'));var db=require(_0xa251('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x51850e){var _0x588282=['ne'];try{var _0x5785cb=JSON[_0xa251('0x4')](_0x51850e);var _0x501afd=Object[_0xa251('0x5')](_0x5785cb)[0x0];return _0x588282[_0xa251('0x6')](_0x501afd);}catch(_0x1455b5){return![];}}function getOperatorValue(_0x3d486f){var _0x587d5b=JSON[_0xa251('0x4')](_0x3d486f);var _0x2a1470=Object['keys'](_0x587d5b)[0x0];var _0x2fbd65=_0x587d5b[_0x2a1470];return{['$'+_0x2a1470]:_0x2fbd65};}function parseIncludeModel(_0x49f299){var _0x5d0597=JSON[_0xa251('0x4')](_0x49f299);return{'model':db[_0x5d0597['model']],'as':_0x5d0597[_0xa251('0x7')],'attributes':_0x5d0597[_0xa251('0x8')],'raw':_0x5d0597[_0xa251('0x9')]};}exports[_0xa251('0x8')]=function(_0x13bb2b){var _0x55382b=null;if(_0x13bb2b){_0x55382b=_0x13bb2b[_0xa251('0xa')](',');}return _0x55382b;};exports[_0xa251('0xb')]=function(_0x45bbc6,_0x14ce65){var _0x362e54={};if(!_[_0xa251('0xc')](_0x45bbc6)){_[_0xa251('0xd')](_0x45bbc6,function(_0x3fe323,_0x217530){try{if(_0x14ce65){var _0x4add66=_['find'](_0x14ce65,{'name':_0x217530})||{};if(hasSequelizeOperator(_0x3fe323)){_0x362e54[_0x217530]=getOperatorValue(_0x3fe323);}else if(_0x4add66[_0xa251('0xe')]===_0xa251('0xf')&&_[_0xa251('0x10')](_0x3fe323)){var _0x1132e3=JSON['parse'](_0x3fe323);var _0x525658={'$gte':moment(moment(_0x1132e3[_0xa251('0x11')])[_0xa251('0x12')]('YYYY-MM-DD'))[_0xa251('0x13')]()['format'](),'$lte':moment(moment(_0x1132e3[_0xa251('0x14')])[_0xa251('0x12')](_0xa251('0x15')))[_0xa251('0x13')]()[_0xa251('0x16')](0x1,'s')[_0xa251('0x12')]()};_0x362e54[_0x217530]=_0x525658;}else if(_0x4add66[_0xa251('0x17')]===_0xa251('0x18')){_0x362e54[_0x217530]=_0x3fe323;}else{_0x362e54[_0x217530]=_[_0xa251('0x19')](_0x3fe323)?_0x3fe323:JSON['parse'](_0x3fe323);}}else{_0x362e54[_0x217530]=_['isArray'](_0x3fe323)?_0x3fe323:JSON['parse'](_0x3fe323);}}catch(_0x3c6451){_0x362e54[_0x217530]=_0x3fe323[_0xa251('0xa')](',');}});}return _0x362e54;};exports[_0xa251('0x1a')]=function(_0xa226f4){_0xa226f4=parseInt(_0xa226f4,0xa);if(!_0xa226f4||_0xa226f4<0x0){_0xa226f4=LIMIT_VALUE;}return _0xa226f4;};exports[_0xa251('0x1b')]=function(_0x33a3f6){_0x33a3f6=parseInt(_0x33a3f6,0xa);if(!_0x33a3f6||_0x33a3f6<0x0){_0x33a3f6=0x0;}return _0x33a3f6;};exports[_0xa251('0x1c')]=function(_0xb836a0){var _0x4d6b26,_0x1ea919=null;if(_0xb836a0){_0x4d6b26=_0xb836a0[_0xa251('0xa')](',');_0x1ea919=_[_0xa251('0x1d')](_0x4d6b26,function(_0x21bd2d){if(_0x21bd2d[_0xa251('0x1e')]('-')===0x0){return[_0x21bd2d===_0xa251('0x1f')?sequelize[_0xa251('0x20')](sequelize['col']('priority'),'unsigned'):_0x21bd2d['substr'](0x1),_0xa251('0x21')];}else{return[_0x21bd2d==='priority'?sequelize[_0xa251('0x20')](sequelize[_0xa251('0x22')]('priority'),_0xa251('0x23')):_0x21bd2d,_0xa251('0x24')];}});}return _0x1ea919;};exports[_0xa251('0x25')]=function(_0x240e04,_0x42f7f1){if(_['isEmpty'](_0x240e04)){return _0x240e04;}if(_[_0xa251('0x19')](_0x240e04)){for(var _0x5d2d85=0x0;_0x5d2d85<_0x240e04['length'];_0x5d2d85+=0x1){_0x240e04[_0x5d2d85]=this[_0xa251('0x25')](_0x240e04[_0x5d2d85],_0x42f7f1);}return _0x240e04;}if(!_[_0xa251('0x26')](_0x240e04)){return _0x240e04;}if(_[_0xa251('0x27')](_0x42f7f1)){_0x42f7f1=[_0x42f7f1];}if(!_[_0xa251('0x19')](_0x42f7f1)){return _0x240e04;}for(var _0x510061=0x0;_0x510061<_0x42f7f1['length'];_0x510061+=0x1){_['unset'](_0x240e04,_0x42f7f1[_0x510061]);}for(var _0x13003e in _0x240e04){if(_0x240e04[_0xa251('0x28')](_0x13003e)){_0x240e04[_0x13003e]=this['omit'](_0x240e04[_0x13003e],_0x42f7f1);}}return _0x240e04;};exports['isNumeric']=function(_0x32162a){return _0x32162a[_0xa251('0x29')](RegExp(_0xa251('0x2a')))?!![]:![];};exports[_0xa251('0x2b')]=function(_0x282597){return _0x282597[_0xa251('0x29')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2a5062,_0x259781){var _0x4d6e06=[];var _0x28579a=/([^:]")"+/g;var _0x513a46=/[*<>~@-]/g;var _0xba6d1c=/[ `!@#$%^&*()_\-?~<>]/;var _0x9fe15b=/[ ,]+/;var _0x43c35d=_0x259781?_0xa251('0x2c'):'{EXPR}';if(_0x259781){_0x2a5062=_0x2a5062[_0xa251('0x2d')](_0x513a46,'\x20')[_0xa251('0x2e')]();}_0x2a5062[_0xa251('0xa')](_0x9fe15b)[_0xa251('0x2f')](function(_0x58f52f){_0x58f52f=_0x58f52f[_0xa251('0x2d')](_0x28579a,'$1');_0x58f52f='+'+_0x58f52f+'*';var _0x2a45cb=_0x58f52f[_0xa251('0x29')](_0xba6d1c);if(_0x2a45cb){_0x58f52f='\x22'+_0x58f52f+'\x22';}_0x4d6e06['push'](_0x58f52f);});_0x43c35d=_0x43c35d['replace'](_0xa251('0x30'),_0x4d6e06[_0xa251('0x31')]('\x20'));return _0x43c35d;};exports['getOptions']=function(_0x307f76,_0x1b50fb,_0x1ccdc5){var _0x53afa2={},_0x1ca945={};if(_0x1b50fb['query'][_0xa251('0x32')]){_0x1b50fb[_0xa251('0x33')]['id']=_0x1b50fb[_0xa251('0x33')]['$id'];delete _0x1b50fb[_0xa251('0x33')][_0xa251('0x32')];}_0x53afa2[_0xa251('0x34')]=_[_0xa251('0x1d')](_0x307f76,_0xa251('0x17'));_0x53afa2[_0xa251('0x33')]=_[_0xa251('0x5')](_0x1b50fb[_0xa251('0x33')]);_0x53afa2[_0xa251('0xb')]=_[_0xa251('0x35')](_0x53afa2[_0xa251('0x34')],_0x53afa2['query']);_0x1ca945[_0xa251('0x36')]=_[_0xa251('0x35')](_0x53afa2['model'],this[_0xa251('0x8')](_0x1b50fb[_0xa251('0x33')][_0xa251('0x8')]));_0x1ca945[_0xa251('0x36')]=_0x1ca945[_0xa251('0x36')][_0xa251('0x37')]?_0x1ca945[_0xa251('0x36')]:_0x53afa2[_0xa251('0x34')];if(!_0x1b50fb[_0xa251('0x33')][_0xa251('0x28')](_0xa251('0x38'))){_0x1ca945[_0xa251('0x1a')]=this['limit'](_0x1b50fb[_0xa251('0x33')][_0xa251('0x1a')]);_0x1ca945['offset']=this[_0xa251('0x1b')](_0x1b50fb[_0xa251('0x33')][_0xa251('0x1b')]);}_0x1ca945['order']=this['sort'](_0x1b50fb['query'][_0xa251('0x1c')]);_0x1ca945[_0xa251('0x39')]=this[_0xa251('0xb')](_[_0xa251('0x3a')](_0x1b50fb[_0xa251('0x33')],_0x53afa2[_0xa251('0xb')]),_0x307f76);if(_0x1b50fb[_0xa251('0x33')][_0xa251('0x3b')]){var _0xa4316c=_0x307f76;var _0xac788f=_0x1b50fb['query'][_0xa251('0x3b')];if(typeof _0xac788f===_0xa251('0x3c')){_0xa4316c=_[_0xa251('0x3b')](_0x307f76,function(_0x1862f1){return _[_0xa251('0x6')](_0xac788f[_0xa251('0x3d')],_0x1862f1[_0xa251('0x17')]);});_0xac788f=_0xac788f[_0xa251('0x3e')];}_0x1ca945[_0xa251('0x39')]=_[_0xa251('0x3f')](_0x1ca945[_0xa251('0x39')],{'$or':_[_0xa251('0x1d')](_0xa4316c,function(_0x11bcf6){if(_0x11bcf6['type']!==_0xa251('0x40')){if(_0x1ccdc5){return sequelize[_0xa251('0x39')](sequelize['fn'](_0xa251('0x41'),sequelize[_0xa251('0x22')](_0x11bcf6['name'])),{'$like':sequelize['fn'](_0xa251('0x41'),'%'+_0x1b50fb[_0xa251('0x33')][_0xa251('0x3b')]+'%')});}else{var _0x18aae8={};_0x18aae8[_0x11bcf6[_0xa251('0x17')]]={'$like':'%'+_0x1b50fb[_0xa251('0x33')][_0xa251('0x3b')]+'%'};return _0x18aae8;}}})});}_0x1ca945=_[_0xa251('0x3f')]({},_0x1ca945,_0x1b50fb[_0xa251('0x42')]);return _0x1ca945;};exports['include']=function(_0x372ab){var _0x10e073=[];if(_0x372ab[_0xa251('0x43')]){_0x10e073[_0xa251('0x44')]({'all':!![]});}else if(_0x372ab[_0xa251('0x45')]){if(Array['isArray'](_0x372ab['include'])){_0x10e073=Object['keys'](_0x372ab['include'])[_0xa251('0x1d')](function(_0x21fdce){return parseIncludeModel(_0x372ab['include'][_0x21fdce]);});}else{var _0x5701df=parseIncludeModel(_0x372ab[_0xa251('0x45')]);_0x10e073['push'](_0x5701df);}}return _0x10e073;};exports[_0xa251('0x46')]=function(_0xda4881){return _0xda4881[_0xa251('0x2d')](/[%_^-]/g,function(_0x373d7c){return'\x5c'+_0x373d7c;});}; \ No newline at end of file +var _0x6b3d=['unsigned','ASC','omit','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','replace','trim','forEach','push','join','query','$id','intersection','model','attributes','length','where','filter','columns','value','merge','type','lower','options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','includes','keys','parse','alias','fields','raw','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','substr','DESC'];(function(_0x5c936a,_0xe29226){var _0x58a8a0=function(_0x5f36fd){while(--_0x5f36fd){_0x5c936a['push'](_0x5c936a['shift']());}};_0x58a8a0(++_0xe29226);}(_0x6b3d,0xe9));var _0xd6b3=function(_0x4eba0d,_0x181613){_0x4eba0d=_0x4eba0d-0x0;var _0x6ad88=_0x6b3d[_0x4eba0d];return _0x6ad88;};'use strict';var _=require(_0xd6b3('0x0'));var sequelize=require(_0xd6b3('0x1'));var moment=require(_0xd6b3('0x2'));var db=require(_0xd6b3('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x82ef62){var _0x2c5658=['ne'];try{var _0x343c60=JSON['parse'](_0x82ef62);var _0x2ca8ff=Object['keys'](_0x343c60)[0x0];return _0x2c5658[_0xd6b3('0x4')](_0x2ca8ff);}catch(_0x39f171){return![];}}function getOperatorValue(_0x331697){var _0x52b748=JSON['parse'](_0x331697);var _0x2c0b6c=Object[_0xd6b3('0x5')](_0x52b748)[0x0];var _0x28d9d5=_0x52b748[_0x2c0b6c];return{['$'+_0x2c0b6c]:_0x28d9d5};}function parseIncludeModel(_0x7dc8b1){var _0x25fe4a=JSON[_0xd6b3('0x6')](_0x7dc8b1);return{'model':db[_0x25fe4a['model']],'as':_0x25fe4a[_0xd6b3('0x7')],'attributes':_0x25fe4a[_0xd6b3('0x8')],'raw':_0x25fe4a[_0xd6b3('0x9')]};}exports[_0xd6b3('0x8')]=function(_0x9dac72){var _0x306d02=null;if(_0x9dac72){_0x306d02=_0x9dac72[_0xd6b3('0xa')](',');}return _0x306d02;};exports[_0xd6b3('0xb')]=function(_0x2bd58b,_0x58c880){var _0x3a54d4={};if(!_[_0xd6b3('0xc')](_0x2bd58b)){_[_0xd6b3('0xd')](_0x2bd58b,function(_0x162646,_0x4b919d){try{if(_0x58c880){var _0x25fafa=_[_0xd6b3('0xe')](_0x58c880,{'name':_0x4b919d})||{};if(hasSequelizeOperator(_0x162646)){_0x3a54d4[_0x4b919d]=getOperatorValue(_0x162646);}else if(_0x25fafa['type']===_0xd6b3('0xf')&&_[_0xd6b3('0x10')](_0x162646)){var _0x1075fe=JSON['parse'](_0x162646);var _0x351df2={'$gte':moment(moment(_0x1075fe[_0xd6b3('0x11')])[_0xd6b3('0x12')](_0xd6b3('0x13')))[_0xd6b3('0x14')]()[_0xd6b3('0x12')](),'$lte':moment(moment(_0x1075fe[_0xd6b3('0x15')])[_0xd6b3('0x12')]('YYYY-MM-DD'))[_0xd6b3('0x14')]()[_0xd6b3('0x16')](0x1,'s')[_0xd6b3('0x12')]()};_0x3a54d4[_0x4b919d]=_0x351df2;}else if(_0x25fafa[_0xd6b3('0x17')]===_0xd6b3('0x18')){_0x3a54d4[_0x4b919d]=_0x162646;}else{_0x3a54d4[_0x4b919d]=_[_0xd6b3('0x19')](_0x162646)?_0x162646:JSON[_0xd6b3('0x6')](_0x162646);}}else{_0x3a54d4[_0x4b919d]=_[_0xd6b3('0x19')](_0x162646)?_0x162646:JSON[_0xd6b3('0x6')](_0x162646);}}catch(_0x4d9581){_0x3a54d4[_0x4b919d]=_0x162646[_0xd6b3('0xa')](',');}});}return _0x3a54d4;};exports[_0xd6b3('0x1a')]=function(_0x2c604f){_0x2c604f=parseInt(_0x2c604f,0xa);if(!_0x2c604f||_0x2c604f<0x0){_0x2c604f=LIMIT_VALUE;}return _0x2c604f;};exports[_0xd6b3('0x1b')]=function(_0xed966c){_0xed966c=parseInt(_0xed966c,0xa);if(!_0xed966c||_0xed966c<0x0){_0xed966c=0x0;}return _0xed966c;};exports[_0xd6b3('0x1c')]=function(_0x26086b){var _0x5d1493,_0x1c475f=null;if(_0x26086b){_0x5d1493=_0x26086b['split'](',');_0x1c475f=_[_0xd6b3('0x1d')](_0x5d1493,function(_0x205f9e){if(_0x205f9e['indexOf']('-')===0x0){return[_0x205f9e===_0xd6b3('0x1e')?sequelize[_0xd6b3('0x1f')](sequelize[_0xd6b3('0x20')]('priority'),'unsigned'):_0x205f9e[_0xd6b3('0x21')](0x1),_0xd6b3('0x22')];}else{return[_0x205f9e===_0xd6b3('0x1e')?sequelize['cast'](sequelize[_0xd6b3('0x20')](_0xd6b3('0x1e')),_0xd6b3('0x23')):_0x205f9e,_0xd6b3('0x24')];}});}return _0x1c475f;};exports['omit']=function(_0x179ee0,_0x2a76e0){if(_['isEmpty'](_0x179ee0)){return _0x179ee0;}if(_[_0xd6b3('0x19')](_0x179ee0)){for(var _0x3c7ca6=0x0;_0x3c7ca6<_0x179ee0['length'];_0x3c7ca6+=0x1){_0x179ee0[_0x3c7ca6]=this[_0xd6b3('0x25')](_0x179ee0[_0x3c7ca6],_0x2a76e0);}return _0x179ee0;}if(!_['isObject'](_0x179ee0)){return _0x179ee0;}if(_[_0xd6b3('0x26')](_0x2a76e0)){_0x2a76e0=[_0x2a76e0];}if(!_['isArray'](_0x2a76e0)){return _0x179ee0;}for(var _0x1123aa=0x0;_0x1123aa<_0x2a76e0['length'];_0x1123aa+=0x1){_[_0xd6b3('0x27')](_0x179ee0,_0x2a76e0[_0x1123aa]);}for(var _0x130593 in _0x179ee0){if(_0x179ee0[_0xd6b3('0x28')](_0x130593)){_0x179ee0[_0x130593]=this['omit'](_0x179ee0[_0x130593],_0x2a76e0);}}return _0x179ee0;};exports[_0xd6b3('0x29')]=function(_0x558ad7){return _0x558ad7[_0xd6b3('0x2a')](RegExp(_0xd6b3('0x2b')))?!![]:![];};exports['isEmail']=function(_0x145f01){return _0x145f01['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd6b3('0x2c')]=function(_0x330451,_0x46106e){var _0x2a2a2d=[];var _0x1cf135=/([^:]")"+/g;var _0xcac560=/[*<>~@-]/g;var _0x53b9f5=/[ `!@#$%^&*()_\-?~<>]/;var _0x5cdc2b=/[ ,]+/;var _0x591c82=_0x46106e?'\x22{EXPR}\x22':_0xd6b3('0x2d');if(_0x46106e){_0x330451=_0x330451[_0xd6b3('0x2e')](_0xcac560,'\x20')[_0xd6b3('0x2f')]();}_0x330451[_0xd6b3('0xa')](_0x5cdc2b)[_0xd6b3('0x30')](function(_0x2254db){_0x2254db=_0x2254db[_0xd6b3('0x2e')](_0x1cf135,'$1');_0x2254db='+'+_0x2254db+'*';var _0x5b6c1e=_0x2254db[_0xd6b3('0x2a')](_0x53b9f5);if(_0x5b6c1e){_0x2254db='\x22'+_0x2254db+'\x22';}_0x2a2a2d[_0xd6b3('0x31')](_0x2254db);});_0x591c82=_0x591c82[_0xd6b3('0x2e')](_0xd6b3('0x2d'),_0x2a2a2d[_0xd6b3('0x32')]('\x20'));return _0x591c82;};exports['getOptions']=function(_0x3551c6,_0x5e5465,_0x5c39dd){var _0x1ed634={},_0x3c2cc5={};if(_0x5e5465[_0xd6b3('0x33')]['$id']){_0x5e5465['query']['id']=_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x34')];delete _0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x34')];}_0x1ed634['model']=_['map'](_0x3551c6,'name');_0x1ed634[_0xd6b3('0x33')]=_[_0xd6b3('0x5')](_0x5e5465[_0xd6b3('0x33')]);_0x1ed634[_0xd6b3('0xb')]=_[_0xd6b3('0x35')](_0x1ed634[_0xd6b3('0x36')],_0x1ed634[_0xd6b3('0x33')]);_0x3c2cc5['attributes']=_[_0xd6b3('0x35')](_0x1ed634['model'],this[_0xd6b3('0x8')](_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x8')]));_0x3c2cc5[_0xd6b3('0x37')]=_0x3c2cc5['attributes'][_0xd6b3('0x38')]?_0x3c2cc5[_0xd6b3('0x37')]:_0x1ed634[_0xd6b3('0x36')];if(!_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x28')]('nolimit')){_0x3c2cc5[_0xd6b3('0x1a')]=this['limit'](_0x5e5465['query'][_0xd6b3('0x1a')]);_0x3c2cc5[_0xd6b3('0x1b')]=this['offset'](_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x1b')]);}_0x3c2cc5['order']=this['sort'](_0x5e5465['query'][_0xd6b3('0x1c')]);_0x3c2cc5[_0xd6b3('0x39')]=this[_0xd6b3('0xb')](_['pick'](_0x5e5465[_0xd6b3('0x33')],_0x1ed634[_0xd6b3('0xb')]),_0x3551c6);if(_0x5e5465['query']['filter']){var _0x389bdb=_0x3551c6;var _0x3340b4=_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x3a')];if(typeof _0x3340b4==='object'){_0x389bdb=_['filter'](_0x3551c6,function(_0x129822){return _[_0xd6b3('0x4')](_0x3340b4[_0xd6b3('0x3b')],_0x129822[_0xd6b3('0x17')]);});_0x3340b4=_0x3340b4[_0xd6b3('0x3c')];}_0x3c2cc5[_0xd6b3('0x39')]=_[_0xd6b3('0x3d')](_0x3c2cc5[_0xd6b3('0x39')],{'$or':_[_0xd6b3('0x1d')](_0x389bdb,function(_0x3b84b0){if(_0x3b84b0[_0xd6b3('0x3e')]!=='VIRTUAL'){if(_0x5c39dd){return sequelize[_0xd6b3('0x39')](sequelize['fn'](_0xd6b3('0x3f'),sequelize[_0xd6b3('0x20')](_0x3b84b0[_0xd6b3('0x17')])),{'$like':sequelize['fn'](_0xd6b3('0x3f'),'%'+_0x5e5465['query'][_0xd6b3('0x3a')]+'%')});}else{var _0x2272ed={};_0x2272ed[_0x3b84b0[_0xd6b3('0x17')]]={'$like':'%'+_0x5e5465[_0xd6b3('0x33')][_0xd6b3('0x3a')]+'%'};return _0x2272ed;}}})});}_0x3c2cc5=_[_0xd6b3('0x3d')]({},_0x3c2cc5,_0x5e5465[_0xd6b3('0x40')]);return _0x3c2cc5;};exports[_0xd6b3('0x41')]=function(_0x2ffadd){var _0xe1d9aa=[];if(_0x2ffadd['includeAll']){_0xe1d9aa[_0xd6b3('0x31')]({'all':!![]});}else if(_0x2ffadd[_0xd6b3('0x41')]){if(Array[_0xd6b3('0x19')](_0x2ffadd[_0xd6b3('0x41')])){_0xe1d9aa=Object[_0xd6b3('0x5')](_0x2ffadd[_0xd6b3('0x41')])['map'](function(_0x34399e){return parseIncludeModel(_0x2ffadd['include'][_0x34399e]);});}else{var _0x11acdf=parseIncludeModel(_0x2ffadd[_0xd6b3('0x41')]);_0xe1d9aa['push'](_0x11acdf);}}return _0xe1d9aa;};exports[_0xd6b3('0x42')]=function(_0x576510){return _0x576510[_0xd6b3('0x2e')](/[%_^-]/g,function(_0x52926c){return'\x5c'+_0x52926c;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8c4feb6..ebad92c 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef3=['voiceStatus','pause','chatStatus','mailStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','map','getAgents','all','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','pauseType','find','merge','split','fields','globalStatus','order','startsWith','DESC','getUpdatedSortOptions','fullname','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','whatsappStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','mailPause','omit','pick','role','openchannelStatusTime','chatCapacity','openchannelCapacity','smsCapacity','chatCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xfef3,0x118));var _0x3fef=function(_0x14691c,_0xe1c878){_0x14691c=_0x14691c-0x0;var _0xbec98=_0xfef3[_0x14691c];return _0xbec98;};'use strict';var _=require(_0x3fef('0x0'));var jayson=require('jayson/promise');var db=require(_0x3fef('0x1'))['db'];var amiClient=jayson['client'][_0x3fef('0x2')]({'port':0x232a});var routingClient=jayson[_0x3fef('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x1873fc,_0x3b71e5){var _0x538f28=[_0x1873fc[_0x3fef('0x4')],_0x1873fc[_0x3fef('0x5')],_0x1873fc['mailPause'],_0x1873fc[_0x3fef('0x6')],_0x1873fc[_0x3fef('0x7')],_0x1873fc[_0x3fef('0x8')],_0x1873fc[_0x3fef('0x9')]];if(!_0x3b71e5)return _[_0x3fef('0xa')](_0x538f28);var _0x41960c=_[_0x3fef('0xb')](_0x538f28);return _0x41960c[_0x3fef('0xc')]>0x0&&_0x41960c[_0x3fef('0xc')]<_0x538f28[_0x3fef('0xc')]?!![]:![];}function isIdle(_0x67cdd8){return _0x67cdd8===_0x3fef('0xd')||_0x67cdd8===_0x3fef('0xe')||_0x67cdd8===_0x3fef('0xf')||_0x67cdd8==='ringing'||_[_0x3fef('0x10')](_0x67cdd8);}function isAgentIdle(_0x3560d9){if(_0x3560d9[_0x3fef('0x11')]!=='idle'&&_0x3560d9[_0x3fef('0x8')]){_0x3560d9['voiceStatus']=_0x3fef('0x12');return![];}return _[_0x3fef('0xa')]([_0x3560d9[_0x3fef('0x13')],_0x3560d9['faxStatus'],_0x3560d9[_0x3fef('0x14')],_0x3560d9['openchannelStatus'],_0x3560d9[_0x3fef('0x15')],_0x3560d9[_0x3fef('0x11')],_0x3560d9['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x3fef('0x16')](_0x3fef('0x17'),{})[_0x3fef('0x18')](function(_0x79b617){if(_0x79b617[_0x3fef('0x19')]){throw new Error(_0x3fef('0x1a'));}var _0x5c899f=_0x79b617[_0x3fef('0x1b')];return routingClient[_0x3fef('0x16')](_0x3fef('0x17'),{})[_0x3fef('0x18')](function(_0x1613ad){if(_0x1613ad[_0x3fef('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x36669d=_0x1613ad[_0x3fef('0x1b')];return _['merge']({},_0x5c899f,_0x36669d);});})[_0x3fef('0x1c')](function(_0x51a554){throw _0x51a554;});}exports[_0x3fef('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x218f91){var _0x245332=_0x3fef('0xe');if(isAgentPaused(_0x218f91))_0x245332=_0x3fef('0x12');else if(isAgentPaused(_0x218f91,!![]))_0x245332=_0x3fef('0x1e');else if(isAgentIdle(_0x218f91))_0x245332=_0x3fef('0xd');else _0x245332=_0x3fef('0x1f');return _0x245332;}exports[_0x3fef('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x3bb110,_0x2eb578){var _0x39a8ea=_[_0x3fef('0x21')](_0x3bb110)?_0x3bb110:[_0x3bb110];var _0x58f6cf=_['startCase'](_0x2eb578)+'Queue';var _0x378b03=_[_0x3fef('0x22')](_0x39a8ea,function(_0xa16dc){return db[_0x58f6cf]['findOne']({'where':{'id':_0xa16dc}})[_0x3fef('0x18')](function(_0x56c542){if(!_0x56c542)return[];return _0x56c542[_0x3fef('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x3fef('0x24')](_0x378b03)[_0x3fef('0x18')](function(_0xf2b269){var _0x30e17a=_(_0xf2b269)['flatten']()['map']('id')['uniq']()[_0x3fef('0x25')]();return _0x30e17a;});}exports[_0x3fef('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4ea2ab,_0x462ee7,_0x6d08cd){try{if(_0x462ee7['length']>0x0){_0x4ea2ab=_0x4ea2ab[_0x3fef('0xb')](function(_0x3bdf03){return _0x462ee7[_0x3fef('0x27')](_0x3bdf03['id']);});}var _0x2b73fb=_0x4ea2ab[_0x3fef('0xb')](function(_0x137849){var _0x20abb6='busy';if(isAgentIdle(_0x137849)){_0x20abb6=_0x3fef('0xd');}return _0x20abb6===_0x6d08cd;});return _[_0x3fef('0x22')](_0x2b73fb,'id');}catch(_0x21aad4){throw _0x21aad4;}}exports[_0x3fef('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5dbbc0,_0xcd635d,_0x5dae67){return Promise[_0x3fef('0x29')]()[_0x3fef('0x18')](function(){if(_0xcd635d[_0x3fef('0xc')]>0x0){_0x5dbbc0=_0x5dbbc0[_0x3fef('0xb')](function(_0x10b803){return _0xcd635d[_0x3fef('0x27')](_0x10b803['id']);});}return _0x5dbbc0;})[_0x3fef('0x18')](function(){return db[_0x3fef('0x2a')][_0x3fef('0x2b')]({'attributes':['id',_0x3fef('0x2c'),'fullname','chatPause',_0x3fef('0x5'),'mailPause',_0x3fef('0x6'),_0x3fef('0x7'),_0x3fef('0x8'),_0x3fef('0x9'),_0x3fef('0x2d')],'where':{'id':{'$in':_[_0x3fef('0x22')](_0x5dbbc0,'id')}},'raw':!![]});})[_0x3fef('0x18')](function(_0x2ce6c4){return _0x2ce6c4[_0x3fef('0x22')](function(_0xd77b2e){var _0x841e6d=_[_0x3fef('0x2e')](_0x5dbbc0,['id',_0xd77b2e['id']]);var _0x10c91e=filterAgentAttributes(_0x841e6d);_[_0x3fef('0x2f')](_0xd77b2e,_0x10c91e);_0xd77b2e['globalStatus']=getAgentStatus(_0xd77b2e);return _0xd77b2e;});})[_0x3fef('0x18')](function(_0x428486){var _0x31669f=sortAgentsByStatus(_0x428486,_0x5dae67);return _[_0x3fef('0x22')](_0x31669f,'id');})[_0x3fef('0x1c')](function(_0x52a3c4){throw _0x52a3c4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5cbea8){var _0x272312={'fields':[],'order':null};var _0x163de0=_0x5cbea8[_0x3fef('0x30')](',');_0x272312[_0x3fef('0x31')]=_[_0x3fef('0xb')](_0x163de0,function(_0x788b6c){if(!_0x788b6c[_0x3fef('0x27')](_0x3fef('0x32'))){return!![];}_0x272312[_0x3fef('0x33')]=_[_0x3fef('0x34')](_0x788b6c,'-')?_0x3fef('0x35'):'ASC';return![];});return _0x272312;}exports[_0x3fef('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x260606){if(!_0x260606){_0x260606='fullname,internal';}if(_0x260606['includes'](_0x3fef('0x37'))&&!_0x260606[_0x3fef('0x27')](_0x3fef('0x38'))){var _0x21c531=_0x260606[_0x3fef('0x39')](0x0,_0x260606[_0x3fef('0x3a')](_0x3fef('0x37')));_0x260606+=','+_0x21c531+_0x3fef('0x38');}return _0x260606;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x107d42,_0x1de815){var _0x2859db=_0x107d42[_0x3fef('0x3b')](function(_0x1fe9ee,_0x2143ec){if(_0x1fe9ee[_0x3fef('0x32')]===_0x2143ec[_0x3fef('0x32')]){if(_0x1fe9ee[_0x3fef('0x32')]===_0x3fef('0x12')){if(_0x1de815===_0x3fef('0x35')){return(_0x1fe9ee[_0x3fef('0x2d')]||'')<(_0x2143ec[_0x3fef('0x2d')]||'')||_0x1fe9ee[_0x3fef('0x37')][_0x3fef('0x3c')]()>_0x2143ec['fullname'][_0x3fef('0x3c')]()?0x1:-0x1;}else{return(_0x1fe9ee[_0x3fef('0x2d')]||'')<(_0x2143ec[_0x3fef('0x2d')]||'')||_0x1fe9ee[_0x3fef('0x37')][_0x3fef('0x3c')]()>_0x2143ec[_0x3fef('0x37')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1de815===_0x3fef('0x35')){return _0x1fe9ee['fullname'][_0x3fef('0x3c')]()<_0x2143ec[_0x3fef('0x37')]['toLowerCase']()?0x1:-0x1;}else{return _0x1fe9ee[_0x3fef('0x37')]['toLowerCase']()<_0x2143ec[_0x3fef('0x37')][_0x3fef('0x3c')]()?-0x1:0x1;}}}else{if(_0x1de815===_0x3fef('0x35')){return _0x1fe9ee[_0x3fef('0x32')]<_0x2143ec[_0x3fef('0x32')]?0x1:-0x1;}else{return _0x1fe9ee[_0x3fef('0x32')]<_0x2143ec[_0x3fef('0x32')]?-0x1:0x1;}}});return _0x2859db;}exports[_0x3fef('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x42b64b){var _0xc07e2c=[_0x3fef('0x3e'),_0x3fef('0x3f'),_0x3fef('0x40'),'lastPauseAt',_0x3fef('0x2d'),_0x3fef('0x41'),'internal',_0x3fef('0x42'),_0x3fef('0x4'),_0x3fef('0x6'),'mailPause',_0x3fef('0x7'),_0x3fef('0x9'),'faxPause',_0x3fef('0x8'),'chatCapacity','openchannelCapacity',_0x3fef('0x43'),'smsCapacity',_0x3fef('0x44'),_0x3fef('0x45'),'chatCurrentCapacity',_0x3fef('0x46'),_0x3fef('0x47'),_0x3fef('0x48'),'whatsappCurrentCapacity',_0x3fef('0x49'),_0x3fef('0x13'),_0x3fef('0x4a'),'mailStatus',_0x3fef('0x15'),_0x3fef('0x4b'),_0x3fef('0x4c'),_0x3fef('0x11'),_0x3fef('0x4d'),'openchannelStatusTime',_0x3fef('0x4e'),_0x3fef('0x4f'),_0x3fef('0x50'),_0x3fef('0x51'),_0x3fef('0x52'),_0x3fef('0x53'),_0x3fef('0x54'),_0x3fef('0x55'),_0x3fef('0x56'),'phoneBarEnableAutomaticScreenRecording'];var _0x5cdbd6=[_0x3fef('0x4'),_0x3fef('0x6'),_0x3fef('0x57'),_0x3fef('0x7'),_0x3fef('0x9'),_0x3fef('0x5'),_0x3fef('0x8'),_0x3fef('0x3f')];var _0x10d80e=_(_0x42b64b)[_0x3fef('0x58')](_0x5cdbd6)[_0x3fef('0x59')](_0xc07e2c)[_0x3fef('0x25')]();return _0x10d80e;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x3fef('0x2c'),_0x3fef('0x37'),_0x3fef('0x5a'),_0x3fef('0x38'),'online',_0x3fef('0x32'),_0x3fef('0x3e'),_0x3fef('0x40'),_0x3fef('0x2d'),'lastPauseAt',_0x3fef('0x5'),_0x3fef('0x4'),_0x3fef('0x57'),'openchannelPause','smsPause',_0x3fef('0x8'),_0x3fef('0x9'),_0x3fef('0x13'),_0x3fef('0x4c'),'mailStatus',_0x3fef('0x4a'),'smsStatus',_0x3fef('0x11'),'whatsappStatus',_0x3fef('0x4d'),'faxStatusTime',_0x3fef('0x4e'),_0x3fef('0x5b'),_0x3fef('0x4f'),'voiceStatusTime','whatsappStatusTime',_0x3fef('0x5c'),_0x3fef('0x45'),_0x3fef('0x43'),_0x3fef('0x5d'),_0x3fef('0x5e'),_0x3fef('0x44'),_0x3fef('0x5f'),_0x3fef('0x49'),'mailCurrentCapacity',_0x3fef('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x3fef('0x56'),_0x3fef('0x60'),_0x3fef('0x54'),_0x3fef('0x61'),_0x3fef('0x53'),_0x3fef('0x55')];}exports[_0x3fef('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x390a=['destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','name','role','smsStatus','voiceStatusTime','faxCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','filter','length','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','openchannelStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','getRealtimeAgents','*pause','idle','startCase','map','getAgents','uniq','value','getAgentIdsByQueues','includes','busy','resolve','User','fullname','whatsappPause','pauseType','find','merge','catch','fields','globalStatus','order','startsWith','DESC','fullname,internal','internal','substring','indexOf','pause','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue'];(function(_0x54a0bc,_0x456c20){var _0x5ab0a3=function(_0x3c4dd2){while(--_0x3c4dd2){_0x54a0bc['push'](_0x54a0bc['shift']());}};_0x5ab0a3(++_0x456c20);}(_0x390a,0xc9));var _0xa390=function(_0x473a66,_0x299480){_0x473a66=_0x473a66-0x0;var _0x3ace8b=_0x390a[_0x473a66];return _0x3ace8b;};'use strict';var _=require(_0xa390('0x0'));var jayson=require(_0xa390('0x1'));var db=require(_0xa390('0x2'))['db'];var amiClient=jayson[_0xa390('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xa390('0x3')][_0xa390('0x4')]({'port':0x232c});function isAgentPaused(_0x4879dd,_0x3f1ee2){var _0x4fe49e=[_0x4879dd[_0xa390('0x5')],_0x4879dd[_0xa390('0x6')],_0x4879dd[_0xa390('0x7')],_0x4879dd['openchannelPause'],_0x4879dd[_0xa390('0x8')],_0x4879dd[_0xa390('0x9')],_0x4879dd['whatsappPause']];if(!_0x3f1ee2)return _['every'](_0x4fe49e);var _0xc8cd85=_[_0xa390('0xa')](_0x4fe49e);return _0xc8cd85[_0xa390('0xb')]>0x0&&_0xc8cd85[_0xa390('0xb')]<_0x4fe49e[_0xa390('0xb')]?!![]:![];}function isIdle(_0x5106eb){return _0x5106eb==='idle'||_0x5106eb===_0xa390('0xc')||_0x5106eb===_0xa390('0xd')||_0x5106eb===_0xa390('0xe')||_['isNil'](_0x5106eb);}function isAgentIdle(_0x41f9f2){if(_0x41f9f2[_0xa390('0xf')]!=='idle'&&_0x41f9f2[_0xa390('0x9')]){_0x41f9f2[_0xa390('0xf')]='pause';return![];}return _['every']([_0x41f9f2[_0xa390('0x10')],_0x41f9f2[_0xa390('0x11')],_0x41f9f2['mailStatus'],_0x41f9f2[_0xa390('0x12')],_0x41f9f2['smsStatus'],_0x41f9f2['voiceStatus'],_0x41f9f2['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xa390('0x13')]('Agents',{})[_0xa390('0x14')](function(_0x4645be){if(_0x4645be['error']){throw new Error(_0xa390('0x15'));}var _0x180429=_0x4645be['result'];return routingClient[_0xa390('0x13')]('Agents',{})[_0xa390('0x14')](function(_0x225e2c){if(_0x225e2c[_0xa390('0x16')]){throw new Error(_0xa390('0x17'));}var _0x555ade=_0x225e2c[_0xa390('0x18')];return _['merge']({},_0x180429,_0x555ade);});})['catch'](function(_0x4969c9){throw _0x4969c9;});}exports[_0xa390('0x19')]=getRealtimeAgents;function getAgentStatus(_0x555323){var _0x3815bd=_0xa390('0xc');if(isAgentPaused(_0x555323))_0x3815bd='pause';else if(isAgentPaused(_0x555323,!![]))_0x3815bd=_0xa390('0x1a');else if(isAgentIdle(_0x555323))_0x3815bd=_0xa390('0x1b');else _0x3815bd='busy';return _0x3815bd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x18a0f0,_0x374ea9){var _0x130355=_['isArray'](_0x18a0f0)?_0x18a0f0:[_0x18a0f0];var _0x4d320d=_[_0xa390('0x1c')](_0x374ea9)+'Queue';var _0x3f2840=_[_0xa390('0x1d')](_0x130355,function(_0x2aeb9f){return db[_0x4d320d]['findOne']({'where':{'id':_0x2aeb9f}})[_0xa390('0x14')](function(_0x4541a6){if(!_0x4541a6)return[];return _0x4541a6[_0xa390('0x1e')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3f2840)[_0xa390('0x14')](function(_0x5a92bd){var _0x34f865=_(_0x5a92bd)['flatten']()[_0xa390('0x1d')]('id')[_0xa390('0x1f')]()[_0xa390('0x20')]();return _0x34f865;});}exports[_0xa390('0x21')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x22c5ba,_0x351913,_0x55e360){try{if(_0x351913['length']>0x0){_0x22c5ba=_0x22c5ba[_0xa390('0xa')](function(_0x5022aa){return _0x351913[_0xa390('0x22')](_0x5022aa['id']);});}var _0x45d572=_0x22c5ba[_0xa390('0xa')](function(_0x11ce69){var _0x272949=_0xa390('0x23');if(isAgentIdle(_0x11ce69)){_0x272949='idle';}return _0x272949===_0x55e360;});return _[_0xa390('0x1d')](_0x45d572,'id');}catch(_0x4234e1){throw _0x4234e1;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b2448,_0x421ac0,_0x4f5b64){return Promise[_0xa390('0x24')]()[_0xa390('0x14')](function(){if(_0x421ac0['length']>0x0){_0x2b2448=_0x2b2448[_0xa390('0xa')](function(_0x2601c7){return _0x421ac0[_0xa390('0x22')](_0x2601c7['id']);});}return _0x2b2448;})[_0xa390('0x14')](function(){return db[_0xa390('0x25')]['findAll']({'attributes':['id','name',_0xa390('0x26'),_0xa390('0x5'),'faxPause',_0xa390('0x7'),'openchannelPause',_0xa390('0x8'),_0xa390('0x9'),_0xa390('0x27'),_0xa390('0x28')],'where':{'id':{'$in':_[_0xa390('0x1d')](_0x2b2448,'id')}},'raw':!![]});})[_0xa390('0x14')](function(_0x385cfc){return _0x385cfc[_0xa390('0x1d')](function(_0x231616){var _0x32ba94=_[_0xa390('0x29')](_0x2b2448,['id',_0x231616['id']]);var _0x57e821=filterAgentAttributes(_0x32ba94);_[_0xa390('0x2a')](_0x231616,_0x57e821);_0x231616['globalStatus']=getAgentStatus(_0x231616);return _0x231616;});})[_0xa390('0x14')](function(_0x526dd0){var _0x1369bb=sortAgentsByStatus(_0x526dd0,_0x4f5b64);return _[_0xa390('0x1d')](_0x1369bb,'id');})[_0xa390('0x2b')](function(_0x347082){throw _0x347082;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3bc936){var _0x5ae5f6={'fields':[],'order':null};var _0x298169=_0x3bc936['split'](',');_0x5ae5f6[_0xa390('0x2c')]=_[_0xa390('0xa')](_0x298169,function(_0x2fe9f3){if(!_0x2fe9f3[_0xa390('0x22')](_0xa390('0x2d'))){return!![];}_0x5ae5f6[_0xa390('0x2e')]=_[_0xa390('0x2f')](_0x2fe9f3,'-')?_0xa390('0x30'):'ASC';return![];});return _0x5ae5f6;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x26a191){if(!_0x26a191){_0x26a191=_0xa390('0x31');}if(_0x26a191[_0xa390('0x22')](_0xa390('0x26'))&&!_0x26a191[_0xa390('0x22')](_0xa390('0x32'))){var _0x49fd4f=_0x26a191[_0xa390('0x33')](0x0,_0x26a191[_0xa390('0x34')](_0xa390('0x26')));_0x26a191+=','+_0x49fd4f+_0xa390('0x32');}return _0x26a191;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x176acd,_0x222b8d){var _0x5c00fd=_0x176acd['sort'](function(_0x4b8288,_0x9f74fd){if(_0x4b8288[_0xa390('0x2d')]===_0x9f74fd[_0xa390('0x2d')]){if(_0x4b8288[_0xa390('0x2d')]===_0xa390('0x35')){if(_0x222b8d===_0xa390('0x30')){return(_0x4b8288[_0xa390('0x28')]||'')<(_0x9f74fd[_0xa390('0x28')]||'')||_0x4b8288[_0xa390('0x26')]['toLowerCase']()>_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?0x1:-0x1;}else{return(_0x4b8288[_0xa390('0x28')]||'')<(_0x9f74fd[_0xa390('0x28')]||'')||_0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()>_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?-0x1:0x1;}}else{if(_0x222b8d===_0xa390('0x30')){return _0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()<_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?0x1:-0x1;}else{return _0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()<_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?-0x1:0x1;}}}else{if(_0x222b8d===_0xa390('0x30')){return _0x4b8288[_0xa390('0x2d')]<_0x9f74fd[_0xa390('0x2d')]?0x1:-0x1;}else{return _0x4b8288[_0xa390('0x2d')]<_0x9f74fd['globalStatus']?-0x1:0x1;}}});return _0x5c00fd;}exports[_0xa390('0x37')]=sortAgentsByStatus;function filterAgentAttributes(_0x1dc90d){var _0x700837=[_0xa390('0x38'),_0xa390('0x39'),_0xa390('0x3a'),'lastPauseAt',_0xa390('0x28'),_0xa390('0x3b'),_0xa390('0x32'),'address',_0xa390('0x5'),_0xa390('0x3c'),_0xa390('0x7'),'smsPause',_0xa390('0x27'),_0xa390('0x6'),_0xa390('0x9'),_0xa390('0x3d'),_0xa390('0x3e'),_0xa390('0x3f'),_0xa390('0x40'),_0xa390('0x41'),_0xa390('0x42'),_0xa390('0x43'),_0xa390('0x44'),_0xa390('0x45'),_0xa390('0x46'),_0xa390('0x47'),'faxCurrentCapacity','chatStatus',_0xa390('0x12'),_0xa390('0x48'),'smsStatus',_0xa390('0x49'),_0xa390('0x11'),_0xa390('0xf'),_0xa390('0x4a'),_0xa390('0x4b'),_0xa390('0x4c'),_0xa390('0x4d'),_0xa390('0x4e'),_0xa390('0x4f'),'voiceStatusTime',_0xa390('0x50'),_0xa390('0x51'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xa390('0x52')];var _0x119d25=[_0xa390('0x5'),'openchannelPause','mailPause',_0xa390('0x8'),_0xa390('0x27'),_0xa390('0x6'),_0xa390('0x9'),_0xa390('0x39')];var _0x5849d9=_(_0x1dc90d)[_0xa390('0x53')](_0x119d25)[_0xa390('0x54')](_0x700837)[_0xa390('0x20')]();return _0x5849d9;}exports[_0xa390('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xa390('0x56'),_0xa390('0x26'),_0xa390('0x57'),_0xa390('0x32'),_0xa390('0x39'),_0xa390('0x2d'),'userpic',_0xa390('0x3a'),_0xa390('0x28'),_0xa390('0x3b'),_0xa390('0x6'),_0xa390('0x5'),_0xa390('0x7'),_0xa390('0x3c'),_0xa390('0x8'),_0xa390('0x9'),'whatsappPause','chatStatus',_0xa390('0x11'),_0xa390('0x48'),'openchannelStatus',_0xa390('0x58'),'voiceStatus',_0xa390('0x49'),_0xa390('0x4a'),_0xa390('0x4f'),'mailStatusTime',_0xa390('0x4b'),_0xa390('0x4d'),_0xa390('0x59'),_0xa390('0x4e'),_0xa390('0x3d'),_0xa390('0x42'),_0xa390('0x3f'),'openchannelCapacity',_0xa390('0x40'),_0xa390('0x41'),_0xa390('0x43'),_0xa390('0x5a'),_0xa390('0x45'),_0xa390('0x44'),'smsCurrentCapacity',_0xa390('0x47'),_0xa390('0x5b'),_0xa390('0x52'),_0xa390('0x51'),_0xa390('0x5c'),_0xa390('0x50'),'screenrecording'];}exports[_0xa390('0x5d')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e2e0e5f..5995e44 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fa8=['initializeQueues','lodash','jayson/promise','util','client','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','get','pTalking','find','merge','pick'];(function(_0x2fe197,_0x409c73){var _0x41f48d=function(_0x2de202){while(--_0x2de202){_0x2fe197['push'](_0x2fe197['shift']());}};_0x41f48d(++_0x409c73);}(_0x9fa8,0x1a9));var _0x89fa=function(_0x3099ff,_0x198dac){_0x3099ff=_0x3099ff-0x0;var _0x134a42=_0x9fa8[_0x3099ff];return _0x134a42;};'use strict';var _=require(_0x89fa('0x0'));var jayson=require(_0x89fa('0x1'));var util=require(_0x89fa('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x89fa('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x89fa('0x4'),_0x89fa('0x5'),_0x89fa('0x6'),_0x89fa('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x89fa('0x8'),_0x89fa('0x9'),_0x89fa('0xa'),_0x89fa('0xb'),_0x89fa('0xc'),_0x89fa('0xd'),_0x89fa('0xe'),_0x89fa('0xf'),_0x89fa('0x10'),'unavailable',_0x89fa('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x89fa('0x12'),_0x89fa('0x13'),_0x89fa('0x14'),_0x89fa('0x15'),_0x89fa('0x16'),_0x89fa('0x17'),'startPredictive',_0x89fa('0x18'),_0x89fa('0x19'),_0x89fa('0x1a'),_0x89fa('0x1b'),_0x89fa('0x1c'),_0x89fa('0x1d'),_0x89fa('0x1e'),_0x89fa('0x1f'),_0x89fa('0x20'),_0x89fa('0x21'),'predictiveIntervalAnsweredCalls',_0x89fa('0x22'),_0x89fa('0x23'),_0x89fa('0x24'),_0x89fa('0x25')];function getRealtimeQueues(_0x3f722c,_0x20bfc2){var _0x263e7c=_0x20bfc2===_0x89fa('0x26')?amiClient:routingClient;return _0x263e7c['request'](_[_0x89fa('0x27')](_0x20bfc2)+_0x89fa('0x28'),_0x3f722c)['then'](function(_0x345692){if(_0x345692['error'])throw new Error(util['format'](_0x89fa('0x29'),_0x20bfc2));return _0x345692[_0x89fa('0x2a')];})[_0x89fa('0x2b')](function(_0x23c4e4){throw _0x23c4e4;});}exports[_0x89fa('0x2c')]=getRealtimeQueues;function initializeQueues(_0x455421,_0x279483,_0x5a86cc,_0x1cf01c){var _0x475496=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5a86cc==='voice'){if(_0x1cf01c==='inbound'){_0x475496=_0x475496[_0x89fa('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1cf01c===_0x89fa('0x2e')){_0x475496=_0x475496[_0x89fa('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x455421['map'](function(_0x2c361a){var _0x10535a=_0x2c361a[_0x89fa('0x2f')]({'plain':!![]});_0x10535a[_0x89fa('0x6')]=0x0;_0x10535a[_0x89fa('0xb')]=0x0;_0x10535a[_0x89fa('0x5')]=0x0;_0x10535a[_0x89fa('0x4')]=0x0;_0x10535a['waiting']=0x0;if(_0x5a86cc==='voice'){_0x10535a[_0x89fa('0x10')]=0x0;_0x10535a['busy']=0x0;if(_0x1cf01c===_0x89fa('0x2e')){_0x10535a[_0x89fa('0x30')]=0x0;_0x10535a[_0x89fa('0x12')]=0x0;}}var _0x124da5=_[_0x89fa('0x31')](_0x279483,['id',_0x10535a['id']]);if(_0x124da5){_[_0x89fa('0x32')](_0x10535a,_[_0x89fa('0x33')](_0x124da5,_0x475496));}return _0x10535a;});}exports[_0x89fa('0x34')]=initializeQueues; \ No newline at end of file +var _0xfea6=['available','paused','waiting','busy','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','outbound','concat','map','voice','find','merge','pick','initializeQueues','jayson/promise','util','client'];(function(_0x2e4d1f,_0x13885c){var _0x3da68c=function(_0x537c9b){while(--_0x537c9b){_0x2e4d1f['push'](_0x2e4d1f['shift']());}};_0x3da68c(++_0x13885c);}(_0xfea6,0xc5));var _0x6fea=function(_0x510b1a,_0x454a28){_0x510b1a=_0x510b1a-0x0;var _0x45a944=_0xfea6[_0x510b1a];return _0x45a944;};'use strict';var _=require('lodash');var jayson=require(_0x6fea('0x0'));var util=require(_0x6fea('0x1'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x6fea('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x6fea('0x3'),'loggedIn',_0x6fea('0x4'),_0x6fea('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x6fea('0x6'),'inUse',_0x6fea('0x7'),_0x6fea('0x8'),_0x6fea('0x9'),'onHold',_0x6fea('0xa'),_0x6fea('0xb'),_0x6fea('0xc'),_0x6fea('0xd'),_0x6fea('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6fea('0xf'),_0x6fea('0x10'),'message',_0x6fea('0x11'),'dialActive',_0x6fea('0x12'),'Trunk',_0x6fea('0x13'),_0x6fea('0x14'),_0x6fea('0x15'),_0x6fea('0x16'),_0x6fea('0x17'),_0x6fea('0x18'),_0x6fea('0x19'),_0x6fea('0x1a'),_0x6fea('0x1b'),_0x6fea('0x1c'),_0x6fea('0x1d'),'predictiveIntervalAnsweredCalls',_0x6fea('0x1e'),_0x6fea('0x1f'),_0x6fea('0x20'),_0x6fea('0x21')];function getRealtimeQueues(_0x413f23,_0x45d778){var _0x45432e=_0x45d778==='voice'?amiClient:routingClient;return _0x45432e['request'](_['startCase'](_0x45d778)+_0x6fea('0x22'),_0x413f23)['then'](function(_0x36d4c4){if(_0x36d4c4[_0x6fea('0x23')])throw new Error(util[_0x6fea('0x24')](_0x6fea('0x25'),_0x45d778));return _0x36d4c4[_0x6fea('0x26')];})[_0x6fea('0x27')](function(_0xbc5a9c){throw _0xbc5a9c;});}exports[_0x6fea('0x28')]=getRealtimeQueues;function initializeQueues(_0x3a58b6,_0x4406e2,_0x23e5aa,_0xa31c0e){var _0x328fb0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x23e5aa==='voice'){if(_0xa31c0e===_0x6fea('0x29')){_0x328fb0=_0x328fb0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0xa31c0e===_0x6fea('0x2a')){_0x328fb0=_0x328fb0[_0x6fea('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3a58b6[_0x6fea('0x2c')](function(_0x37bb67){var _0xd3043f=_0x37bb67['get']({'plain':!![]});_0xd3043f[_0x6fea('0x4')]=0x0;_0xd3043f['loggedInDb']=0x0;_0xd3043f['loggedIn']=0x0;_0xd3043f[_0x6fea('0x3')]=0x0;_0xd3043f[_0x6fea('0x5')]=0x0;if(_0x23e5aa===_0x6fea('0x2d')){_0xd3043f['talking']=0x0;_0xd3043f[_0x6fea('0x6')]=0x0;if(_0xa31c0e===_0x6fea('0x2a')){_0xd3043f[_0x6fea('0xf')]=0x0;_0xd3043f[_0x6fea('0x10')]=0x0;}}var _0x2e3e94=_[_0x6fea('0x2e')](_0x4406e2,['id',_0xd3043f['id']]);if(_0x2e3e94){_[_0x6fea('0x2f')](_0xd3043f,_[_0x6fea('0x30')](_0x2e3e94,_0x328fb0));}return _0xd3043f;});}exports[_0x6fea('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 63fe767..336184d 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(_0x58b301,_0x45e991){var _0x2171b3=function(_0x30b475){while(--_0x30b475){_0x58b301['push'](_0x58b301['shift']());}};_0x2171b3(++_0x45e991);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 5dec317..dc81680 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 _0x5599=['networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','address','127.0.0.1','cpus','model','join','md5','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','createHash','update','digest','substring','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x5b91f8,_0x2586ea){var _0x53dca0=function(_0x2db32b){while(--_0x2db32b){_0x5b91f8['push'](_0x5b91f8['shift']());}};_0x53dca0(++_0x2586ea);}(_0x5599,0xf1));var _0x9559=function(_0x17bb33,_0x5f2a5a){_0x17bb33=_0x17bb33-0x0;var _0x324a4d=_0x5599[_0x17bb33];return _0x324a4d;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x9559('0x0'));var exec=require(_0x9559('0x1'))[_0x9559('0x2')];var config=require(_0x9559('0x3'));function getInterfaces(){var _0x44bed1=[];var _0x19421c=os[_0x9559('0x4')]();var _0x47dc17=_[_0x9559('0x5')](_[_0x9559('0x6')](_0x19421c));for(var _0x2357c1=0x0;_0x2357c1<_0x47dc17[_0x9559('0x7')];_0x2357c1++){var _0x16934a=_0x19421c[_0x47dc17[_0x2357c1]][_0x9559('0x8')](function(_0x2e96a6){return _0x2e96a6[_0x9559('0x9')]===_0x9559('0xa')&&_0x2e96a6[_0x9559('0xb')]===![];});_0x44bed1=_0x44bed1[_0x9559('0xc')](_0x16934a);}return _0x44bed1;}function getFirstInterface(){var _0x4525a5=_['head'](getInterfaces());return{'macAddress':_0x4525a5&&_0x4525a5[_0x9559('0xd')]?_0x4525a5[_0x9559('0xd')]:'00:00:00:00:00:00','ipAddress':_0x4525a5&&_0x4525a5['address']?_0x4525a5[_0x9559('0xe')]:_0x9559('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x138785=_[_0x9559('0x5')](os[_0x9559('0x10')]()['map'](function(_0x3e872e){return _0x3e872e[_0x9559('0x11')];}))[_0x9559('0x12')](':');return crypto['createHash'](_0x9559('0x13'))['update'](_0x138785)['digest'](_0x9559('0x14'));}exports[_0x9559('0x15')]=function(){var _0x49356c=os[_0x9559('0x16')]();var _0x32303b=/[0-9a-f-]{36}/;if(config[_0x9559('0x17')]&&_0x32303b[_0x9559('0x18')](config[_0x9559('0x17')])){return config[_0x9559('0x17')];}else if(_0x49356c===_0x9559('0x19')){return exec(_0x9559('0x1a'),{'encoding':_0x9559('0x1b')})[_0x9559('0x1c')]('\x0d\x0a','');}else{var _0x25cbf4=getFirstInterface();var _0x55acd5=getCPUhash();var _0x3e406e=_0x55acd5+'|'+os['hostname']()+'|'+_0x25cbf4[_0x9559('0x1d')]+'|'+_0x25cbf4[_0x9559('0x1e')];var _0x3051c4=crypto[_0x9559('0x1f')](_0x9559('0x13'))[_0x9559('0x20')](_0x3e406e)[_0x9559('0x21')](_0x9559('0x14'));return _0x3051c4['substring'](0x0,0x8)+'-'+_0x3051c4[_0x9559('0x22')](0x8,0xc)+'-'+_0x3051c4[_0x9559('0x22')](0xc,0x10)+'-'+_0x3051c4['substring'](0x10,0x14)+'-'+_0x3051c4[_0x9559('0x22')](0x14);}}; \ No newline at end of file +var _0x7673=['test','utf8','replace','hostname','macAddress','ipAddress','createHash','update','hex','substring','execSync','../environment','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','md5','digest','getUuid','platform','licenseToken'];(function(_0x56391d,_0x5788f5){var _0x334a97=function(_0x446ea8){while(--_0x446ea8){_0x56391d['push'](_0x56391d['shift']());}};_0x334a97(++_0x5788f5);}(_0x7673,0x16a));var _0x3767=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x7673[_0xd9c529];return _0x146760;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x3767('0x0')];var config=require(_0x3767('0x1'));function getInterfaces(){var _0x1b7e93=[];var _0x27ab02=os['networkInterfaces']();var _0x680ccf=_[_0x3767('0x2')](_[_0x3767('0x3')](_0x27ab02));for(var _0x132e56=0x0;_0x132e56<_0x680ccf['length'];_0x132e56++){var _0x44301f=_0x27ab02[_0x680ccf[_0x132e56]][_0x3767('0x4')](function(_0x36978f){return _0x36978f[_0x3767('0x5')]===_0x3767('0x6')&&_0x36978f[_0x3767('0x7')]===![];});_0x1b7e93=_0x1b7e93[_0x3767('0x8')](_0x44301f);}return _0x1b7e93;}function getFirstInterface(){var _0x1af6e6=_[_0x3767('0x9')](getInterfaces());return{'macAddress':_0x1af6e6&&_0x1af6e6[_0x3767('0xa')]?_0x1af6e6[_0x3767('0xa')]:_0x3767('0xb'),'ipAddress':_0x1af6e6&&_0x1af6e6[_0x3767('0xc')]?_0x1af6e6[_0x3767('0xc')]:_0x3767('0xd')};}exports[_0x3767('0xe')]=getFirstInterface;function getCPUhash(){var _0x503144=_[_0x3767('0x2')](os['cpus']()[_0x3767('0xf')](function(_0x585986){return _0x585986['model'];}))[_0x3767('0x10')](':');return crypto['createHash'](_0x3767('0x11'))['update'](_0x503144)[_0x3767('0x12')]('hex');}exports[_0x3767('0x13')]=function(){var _0x7239e3=os[_0x3767('0x14')]();var _0x461044=/[0-9a-f-]{36}/;if(config[_0x3767('0x15')]&&_0x461044[_0x3767('0x16')](config[_0x3767('0x15')])){return config[_0x3767('0x15')];}else if(_0x7239e3==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3767('0x17')})[_0x3767('0x18')]('\x0d\x0a','');}else{var _0x378f39=getFirstInterface();var _0x16fe7d=getCPUhash();var _0x10476a=_0x16fe7d+'|'+os[_0x3767('0x19')]()+'|'+_0x378f39[_0x3767('0x1a')]+'|'+_0x378f39[_0x3767('0x1b')];var _0x53ff87=crypto[_0x3767('0x1c')](_0x3767('0x11'))[_0x3767('0x1d')](_0x10476a)['digest'](_0x3767('0x1e'));return _0x53ff87[_0x3767('0x1f')](0x0,0x8)+'-'+_0x53ff87[_0x3767('0x1f')](0x8,0xc)+'-'+_0x53ff87[_0x3767('0x1f')](0xc,0x10)+'-'+_0x53ff87['substring'](0x10,0x14)+'-'+_0x53ff87['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9fc29b6..ee53f07 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 _0xa233=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','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','data1','active','data2'];(function(_0x1d6b8a,_0x20cdb1){var _0xdb2420=function(_0x195729){while(--_0x195729){_0x1d6b8a['push'](_0x1d6b8a['shift']());}};_0xdb2420(++_0x20cdb1);}(_0xa233,0xab));var _0x3a23=function(_0x520b8d,_0x463274){_0x520b8d=_0x520b8d-0x0;var _0xea3f2c=_0xa233[_0x520b8d];return _0xea3f2c;};'use strict';var util=require(_0x3a23('0x0'));var moment=require(_0x3a23('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x3a23('0x2'));var db=require(_0x3a23('0x3'))['db'];var encryptor=require(_0x3a23('0x4'));var hardware=require(_0x3a23('0x5'));var logger=require(_0x3a23('0x6'))(_0x3a23('0x7'));var HOST=_0x3a23('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x34777e){return new BPromise(function(_0x3a68ab,_0x502249){var _0x553f67=util[_0x3a23('0x9')](_0x3a23('0xa'),HOST,_0x34777e,module[_0x3a23('0xb')][_0x3a23('0x2')]);if(oldToken){_0x553f67=util['format'](_0x3a23('0xc'),HOST,_0x34777e,module[_0x3a23('0xb')]['version'],oldToken);}var _0x1a4b7c={'uri':_0x553f67,'method':_0x3a23('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x1a4b7c)[_0x3a23('0xe')](function(_0x56a012){_0x3a68ab(_0x56a012);})[_0x3a23('0xf')](function(_0x5bc030){_0x502249(_0x5bc030);});});}function manageLicense(_0x5d1c9e,_0x4290de){var _0x5ce109=_0x4290de['get']({'plain':!![]});if(!isOldTokenSent&&_0x5ce109[_0x3a23('0x10')]!==_0x5d1c9e&&!_0x5ce109['data2']){oldToken=_0x5ce109[_0x3a23('0x10')];}httpRequest(_0x5d1c9e)[_0x3a23('0xe')](function(_0x167e04){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x167e04[_0x3a23('0x11')]){isOldTokenSent=![];if(!_0x5ce109[_0x3a23('0x7')]&&_0x5ce109[_0x3a23('0x7')]!=_0x167e04[_0x3a23('0x7')]||_0x5ce109['license']&&_0x5ce109[_0x3a23('0x12')]){logger[_0x3a23('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5ce109[_0x3a23('0x7')]&&!_0x5ce109[_0x3a23('0x12')]&&_0x5ce109[_0x3a23('0x7')]!=_0x167e04[_0x3a23('0x7')]){logger[_0x3a23('0x13')](_0x3a23('0x14'));}if(_0x5ce109['license']&&!_0x5ce109['data2']&&_0x5ce109[_0x3a23('0x7')]==_0x167e04[_0x3a23('0x7')]){return _0x4290de;}return _0x4290de[_0x3a23('0x15')]({'data1':_0x5d1c9e,'data2':null,'license':_0x167e04[_0x3a23('0x7')]});}else{if(_0x167e04[_0x3a23('0x7')]||_0x5ce109[_0x3a23('0x7')]){if(!_0x5ce109['data2']){if(_0x5ce109['data1']==_0x5d1c9e){GRAY_PERIOD_REASON=_0x3a23('0x16');logger[_0x3a23('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3a23('0x17');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5ce109[_0x3a23('0x10')],_0x5d1c9e);}logger['info'](_0x3a23('0x18'),GRAY_PERIOD_REASON[_0x3a23('0x19')](),moment()[_0x3a23('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x4290de[_0x3a23('0x15')]({'data2':encryptor['encryptString'](moment()[_0x3a23('0x9')](_0x3a23('0x1a')))});}else{if(moment()[_0x3a23('0x1b')](encryptor[_0x3a23('0x1c')](_0x5ce109['data2']),_0x3a23('0x1d'))>DAYS){logger[_0x3a23('0x13')](_0x3a23('0x1e'),moment()[_0x3a23('0x9')](_0x3a23('0x1a')));isOldTokenSent=![];return _0x4290de['update']({'data1':_0x5d1c9e,'data2':null,'license':null});}}}else{if(_0x5ce109[_0x3a23('0x10')]!=_0x5d1c9e){logger[_0x3a23('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5ce109['data1'],_0x5d1c9e);return _0x4290de[_0x3a23('0x15')]({'data1':_0x5d1c9e,'data2':null,'license':null});}}}return _0x4290de;})[_0x3a23('0xe')](function(_0x5f0b2a){_0x4290de=_0x5f0b2a;})['catch'](function(_0x79d810){logger[_0x3a23('0x1f')](_0x79d810[_0x3a23('0x20')]);})[_0x3a23('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4290de);},TIME);});}function defaultLicense(){var _0x3fa940=hardware[_0x3a23('0x22')]();if(_0x3fa940){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3fa940}})[_0x3a23('0x23')](function(_0x1e0db1,_0x263d47){logger['info'](_0x3a23('0x24'),_0x3fa940);manageLicense(_0x3fa940,_0x1e0db1);})[_0x3a23('0xf')](function(_0xa8521e){logger[_0x3a23('0x1f')](_0xa8521e[_0x3a23('0x20')]);});}}exports[_0x3a23('0x25')]=defaultLicense; \ No newline at end of file +var _0xcd4c=['bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcd4c,0x1cc));var _0xccd4=function(_0x239044,_0x3df5a6){_0x239044=_0x239044-0x0;var _0x48ed8e=_0xcd4c[_0x239044];return _0x48ed8e;};'use strict';var util=require('util');var moment=require(_0xccd4('0x0'));var rp=require(_0xccd4('0x1'));var BPromise=require(_0xccd4('0x2'));var pkginfo=require(_0xccd4('0x3'))(module,_0xccd4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xccd4('0x5'));var hardware=require('./hardware');var logger=require(_0xccd4('0x6'))('license');var HOST=_0xccd4('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x28465c){return new BPromise(function(_0x59d897,_0x428f35){var _0x37f094=util[_0xccd4('0x8')](_0xccd4('0x9'),HOST,_0x28465c,module[_0xccd4('0xa')][_0xccd4('0x4')]);if(oldToken){_0x37f094=util[_0xccd4('0x8')](_0xccd4('0xb'),HOST,_0x28465c,module['exports'][_0xccd4('0x4')],oldToken);}var _0x3a252b={'uri':_0x37f094,'method':_0xccd4('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3a252b)['then'](function(_0x1d0c8f){_0x59d897(_0x1d0c8f);})[_0xccd4('0xd')](function(_0x4bf648){_0x428f35(_0x4bf648);});});}function manageLicense(_0xe7cc0a,_0x6c725e){var _0x23581e=_0x6c725e[_0xccd4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x23581e[_0xccd4('0xf')]!==_0xe7cc0a&&!_0x23581e[_0xccd4('0x10')]){oldToken=_0x23581e[_0xccd4('0xf')];}httpRequest(_0xe7cc0a)[_0xccd4('0x11')](function(_0x595906){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x595906[_0xccd4('0x12')]){isOldTokenSent=![];if(!_0x23581e[_0xccd4('0x13')]&&_0x23581e['license']!=_0x595906[_0xccd4('0x13')]||_0x23581e[_0xccd4('0x13')]&&_0x23581e['data2']){logger[_0xccd4('0x14')](_0xccd4('0x15'));}if(_0x23581e[_0xccd4('0x13')]&&!_0x23581e['data2']&&_0x23581e[_0xccd4('0x13')]!=_0x595906[_0xccd4('0x13')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x23581e['license']&&!_0x23581e['data2']&&_0x23581e[_0xccd4('0x13')]==_0x595906[_0xccd4('0x13')]){return _0x6c725e;}return _0x6c725e[_0xccd4('0x16')]({'data1':_0xe7cc0a,'data2':null,'license':_0x595906[_0xccd4('0x13')]});}else{if(_0x595906[_0xccd4('0x13')]||_0x23581e[_0xccd4('0x13')]){if(!_0x23581e[_0xccd4('0x10')]){if(_0x23581e['data1']==_0xe7cc0a){GRAY_PERIOD_REASON=_0xccd4('0x17');logger[_0xccd4('0x14')](_0xccd4('0x18'));}else{GRAY_PERIOD_REASON=_0xccd4('0x19');logger[_0xccd4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x23581e[_0xccd4('0xf')],_0xe7cc0a);}logger[_0xccd4('0x14')](_0xccd4('0x1a'),GRAY_PERIOD_REASON[_0xccd4('0x1b')](),moment()['format'](_0xccd4('0x1c')));return _0x6c725e[_0xccd4('0x16')]({'data2':encryptor[_0xccd4('0x1d')](moment()[_0xccd4('0x8')](_0xccd4('0x1c')))});}else{if(moment()[_0xccd4('0x1e')](encryptor[_0xccd4('0x1f')](_0x23581e[_0xccd4('0x10')]),_0xccd4('0x20'))>DAYS){logger[_0xccd4('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0xccd4('0x8')](_0xccd4('0x1c')));isOldTokenSent=![];return _0x6c725e[_0xccd4('0x16')]({'data1':_0xe7cc0a,'data2':null,'license':null});}}}else{if(_0x23581e['data1']!=_0xe7cc0a){logger[_0xccd4('0x14')](_0xccd4('0x21'),_0x23581e[_0xccd4('0xf')],_0xe7cc0a);return _0x6c725e[_0xccd4('0x16')]({'data1':_0xe7cc0a,'data2':null,'license':null});}}}return _0x6c725e;})['then'](function(_0x4f3cbc){_0x6c725e=_0x4f3cbc;})['catch'](function(_0x3bef88){logger[_0xccd4('0x22')](_0x3bef88['message']);})[_0xccd4('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xccd4('0x24')](),_0x6c725e);},TIME);});}function defaultLicense(){var _0x3087e1=hardware[_0xccd4('0x24')]();if(_0x3087e1){return db[_0xccd4('0x25')][_0xccd4('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3087e1}})['spread'](function(_0xae268c,_0x1f35ea){logger['info'](_0xccd4('0x27'),_0x3087e1);manageLicense(_0x3087e1,_0xae268c);})['catch'](function(_0x30fa8a){logger[_0xccd4('0x22')](_0x30fa8a[_0xccd4('0x28')]);});}}exports[_0xccd4('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e8d69f4..8514f8e 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 _0x10ea=['col','admin','telephone','users','telephones','forEach','user','count','countBy','License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT'];(function(_0x534617,_0x41a7ba){var _0x516e6a=function(_0x2cbb81){while(--_0x2cbb81){_0x534617['push'](_0x534617['shift']());}};_0x516e6a(++_0x41a7ba);}(_0x10ea,0xe7));var _0xa10e=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x10ea[_0x34ad72];return _0x5c9aa8;};'use strict';var util=require('util');var _=require(_0xa10e('0x0'));var moment=require(_0xa10e('0x1'));var BPromise=require('bluebird');var hardware=require(_0xa10e('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xa10e('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa10e('0x4'),'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':_0xa10e('0x5'),'machineUuid':hardware[_0xa10e('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ce34d){return new BPromise(function(_0x5751b0,_0x3cd400){return db[_0xa10e('0x7')]['find'](_[_0xa10e('0x8')](_0x1ce34d,{'raw':!![],'where':{'id':0x1}}))[_0xa10e('0x9')](function(_0x3a9119){return checkLicense(_0x3a9119,null);})[_0xa10e('0x9')](function(_0x44dcf1){_0x5751b0(_0x44dcf1);return;})[_0xa10e('0xa')](function(_0x12dc52){_0x3cd400(_0x12dc52);});});}function checkLicense(_0x5d428a,_0x59709b){if(!_0x5d428a){demoLicense[_0xa10e('0xb')]=_0x5d428a[_0xa10e('0xc')];return demoLicense;}try{var _0x14d635=_0x59709b||_0x5d428a[_0xa10e('0xd')];if(_[_0xa10e('0xe')](_0x14d635)){throw new Error(_0xa10e('0xf'));}var _0x359cde=_0x5d428a[_0xa10e('0xc')];var _0xfc3371=_0x5d428a[_0xa10e('0x10')];var _0x4bed79=_0x359cde['split']('-')[0x4];var _0x3089f8=_0x359cde[_0xa10e('0x11')]('-')[0x0];var _0x5bc893=encryptor[_0xa10e('0x12')](_0x14d635,util[_0xa10e('0x13')](_0xa10e('0x14'),_0x4bed79,_0x359cde,_0x3089f8));var _0x559b23=JSON[_0xa10e('0x15')](_0x5bc893);_0x559b23['demo']=![];_0x559b23['uuid']=_0x359cde;_0x559b23[_0xa10e('0x16')]=hardware[_0xa10e('0x6')]();if(_0xfc3371){var _0x52d60b=encryptor[_0xa10e('0x12')](_0xfc3371);_0x559b23[_0xa10e('0x17')]=_0x52d60b;_0x559b23['deadline']=moment(_0x52d60b)['add'](0x7,_0xa10e('0x18'))[_0xa10e('0x13')]();_0x559b23[_0xa10e('0x19')]=_0x559b23[_0xa10e('0xb')]!=_0x559b23[_0xa10e('0x16')]?'changed':_0xa10e('0x1a');}return _0x559b23;}catch(_0x26063e){breakingLicense['uuid']=_0x5d428a[_0xa10e('0xc')];breakingLicense[_0xa10e('0x1b')]=_0x26063e[_0xa10e('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x35f511,_0x1b5420){getLicense()[_0xa10e('0x9')](function(_0x4a09eb){return db[_0xa10e('0x1c')][_0xa10e('0x1d')]({'attributes':[_0xa10e('0x1e'),[db[_0xa10e('0x1f')]['fn'](_0xa10e('0x20'),db[_0xa10e('0x1f')][_0xa10e('0x21')](_0xa10e('0x1e'))),'count']],'group':_0xa10e('0x1e'),'where':{'role':{'$or':[_0xa10e('0x22'),'user',_0xa10e('0x23')]}},'raw':!![]})[_0xa10e('0x9')](function(_0xa88549){var _0x13e043={'user':_0x4a09eb[_0xa10e('0x24')]||0x0,'telephone':_0x4a09eb[_0xa10e('0x25')]||0x0};_0xa88549[_0xa10e('0x26')](function(_0x5d83d6){var _0x269e4f=_0x5d83d6[_0xa10e('0x1e')]===_0xa10e('0x22')?_0xa10e('0x27'):_0x5d83d6[_0xa10e('0x1e')];_0x13e043[_0x269e4f]-=_0x5d83d6[_0xa10e('0x28')];if(_0x13e043[_0x269e4f]<0x0)_0x13e043[_0x269e4f]=0x0;});_0x35f511(_0x13e043);return;});})[_0xa10e('0xa')](function(_0x58760c){_0x1b5420(_0x58760c);});});}function checkUserLimits(_0x23903a){return new BPromise(function(_0x824f19,_0x5573d7){getLimits()[_0xa10e('0x9')](function(_0x476ab1){var _0x5e84cb=_['pick'](_[_0xa10e('0x29')](_0x23903a,_0xa10e('0x1e')),['admin',_0xa10e('0x27'),_0xa10e('0x23')]);var _0x1fb832=(_0x5e84cb[_0xa10e('0x22')]||0x0)+(_0x5e84cb[_0xa10e('0x27')]||0x0);var _0x39e2b6=_0x5e84cb[_0xa10e('0x23')]||0x0;if(_0x1fb832>_0x476ab1[_0xa10e('0x27')])return _0x5573d7(_0xa10e('0x2a'));if(_0x39e2b6>_0x476ab1[_0xa10e('0x23')])return _0x5573d7('License\x20limit\x20reached\x20for\x20telephones');return _0x824f19();})[_0xa10e('0xa')](function(_0x333274){_0x5573d7(_0x333274);});});}module[_0xa10e('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4341=['add','grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','then','catch','data1','license','data2','split','decryptString','format','parse','demo','uuid','machineUuid','gray','deadline'];(function(_0x54388a,_0x112d3e){var _0x3f5f0e=function(_0x2f1016){while(--_0x2f1016){_0x54388a['push'](_0x54388a['shift']());}};_0x3f5f0e(++_0x112d3e);}(_0x4341,0x18d));var _0x1434=function(_0x4c00a3,_0x2d23e2){_0x4c00a3=_0x4c00a3-0x0;var _0x893854=_0x4341[_0x4c00a3];return _0x893854;};'use strict';var util=require(_0x1434('0x0'));var _=require(_0x1434('0x1'));var moment=require(_0x1434('0x2'));var BPromise=require(_0x1434('0x3'));var hardware=require(_0x1434('0x4'));var encryptor=require(_0x1434('0x5'));var db=require(_0x1434('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1434('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1434('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1434('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1434('0x9'),'machineUuid':hardware[_0x1434('0xa')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x510156){return new BPromise(function(_0x2ba258,_0x5ebeda){return db['License'][_0x1434('0xb')](_['defaults'](_0x510156,{'raw':!![],'where':{'id':0x1}}))[_0x1434('0xc')](function(_0x1d537c){return checkLicense(_0x1d537c,null);})[_0x1434('0xc')](function(_0xb74249){_0x2ba258(_0xb74249);return;})[_0x1434('0xd')](function(_0x58dea1){_0x5ebeda(_0x58dea1);});});}function checkLicense(_0xc08dba,_0x24853d){if(!_0xc08dba){demoLicense['uuid']=_0xc08dba[_0x1434('0xe')];return demoLicense;}try{var _0x34d0ff=_0x24853d||_0xc08dba[_0x1434('0xf')];if(_['isEmpty'](_0x34d0ff)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1b45c0=_0xc08dba[_0x1434('0xe')];var _0x469ab2=_0xc08dba[_0x1434('0x10')];var _0x7a4fe0=_0x1b45c0['split']('-')[0x4];var _0x59bd7d=_0x1b45c0[_0x1434('0x11')]('-')[0x0];var _0x514784=encryptor[_0x1434('0x12')](_0x34d0ff,util[_0x1434('0x13')]('%s:%s:%s',_0x7a4fe0,_0x1b45c0,_0x59bd7d));var _0x244c53=JSON[_0x1434('0x14')](_0x514784);_0x244c53[_0x1434('0x15')]=![];_0x244c53[_0x1434('0x16')]=_0x1b45c0;_0x244c53[_0x1434('0x17')]=hardware[_0x1434('0xa')]();if(_0x469ab2){var _0x2f2440=encryptor[_0x1434('0x12')](_0x469ab2);_0x244c53[_0x1434('0x18')]=_0x2f2440;_0x244c53[_0x1434('0x19')]=moment(_0x2f2440)[_0x1434('0x1a')](0x7,'days')[_0x1434('0x13')]();_0x244c53[_0x1434('0x1b')]=_0x244c53[_0x1434('0x16')]!=_0x244c53[_0x1434('0x17')]?_0x1434('0x1c'):_0x1434('0x1d');}return _0x244c53;}catch(_0x27db11){breakingLicense[_0x1434('0x16')]=_0xc08dba[_0x1434('0xe')];breakingLicense[_0x1434('0x1e')]=_0x27db11['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x16a23b,_0x4b3d81){getLicense()[_0x1434('0xc')](function(_0x2db902){return db['User'][_0x1434('0x1f')]({'attributes':[_0x1434('0x20'),[db[_0x1434('0x21')]['fn'](_0x1434('0x22'),db[_0x1434('0x21')][_0x1434('0x23')](_0x1434('0x20'))),_0x1434('0x24')]],'group':_0x1434('0x20'),'where':{'role':{'$or':[_0x1434('0x25'),'user',_0x1434('0x26')]}},'raw':!![]})[_0x1434('0xc')](function(_0x463cb4){var _0x516d3c={'user':_0x2db902[_0x1434('0x27')]||0x0,'telephone':_0x2db902[_0x1434('0x28')]||0x0};_0x463cb4[_0x1434('0x29')](function(_0x325874){var _0x371a18=_0x325874[_0x1434('0x20')]===_0x1434('0x25')?_0x1434('0x2a'):_0x325874[_0x1434('0x20')];_0x516d3c[_0x371a18]-=_0x325874[_0x1434('0x24')];if(_0x516d3c[_0x371a18]<0x0)_0x516d3c[_0x371a18]=0x0;});_0x16a23b(_0x516d3c);return;});})[_0x1434('0xd')](function(_0xbe7bec){_0x4b3d81(_0xbe7bec);});});}function checkUserLimits(_0x4a2edd){return new BPromise(function(_0x73201,_0x21ffd9){getLimits()[_0x1434('0xc')](function(_0x514e03){var _0x21d2a3=_[_0x1434('0x2b')](_['countBy'](_0x4a2edd,'role'),[_0x1434('0x25'),'user',_0x1434('0x26')]);var _0x5cd089=(_0x21d2a3[_0x1434('0x25')]||0x0)+(_0x21d2a3['user']||0x0);var _0x2ab4f5=_0x21d2a3[_0x1434('0x26')]||0x0;if(_0x5cd089>_0x514e03[_0x1434('0x2a')])return _0x21ffd9(_0x1434('0x2c'));if(_0x2ab4f5>_0x514e03[_0x1434('0x26')])return _0x21ffd9(_0x1434('0x2d'));return _0x73201();})['catch'](function(_0x52bf6b){_0x21ffd9(_0x52bf6b);});});}module[_0x1434('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 1d0146b..38a7625 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 _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8952,0x17e));var _0x2895=function(_0x53d94b,_0xfbcc75){_0x53d94b=_0x53d94b-0x0;var _0x17b7e6=_0x8952[_0x53d94b];return _0x17b7e6;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xd914=['http://localhost:9000','app-id','secret','exports'];(function(_0x13722d,_0x275f21){var _0x3362c4=function(_0x2dcd48){while(--_0x2dcd48){_0x13722d['push'](_0x13722d['shift']());}};_0x3362c4(++_0x275f21);}(_0xd914,0x17f));var _0x4d91=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xd914[_0x2307fa];return _0x496486;};'use strict';module[_0x4d91('0x0')]={'DOMAIN':_0x4d91('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4d91('0x2'),'GOOGLE_SECRET':_0x4d91('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 18ccc9e..e6f8732 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0cd=['fileLogger','../utils/loggers'];(function(_0x12fadf,_0x6f0d6){var _0x1214de=function(_0x493072){while(--_0x493072){_0x12fadf['push'](_0x12fadf['shift']());}};_0x1214de(++_0x6f0d6);}(_0xa0cd,0x1db));var _0xda0c=function(_0x4102a1,_0x2baefd){_0x4102a1=_0x4102a1-0x0;var _0x443434=_0xa0cd[_0x4102a1];return _0x443434;};'use strict';var fileLogger=require(_0xda0c('0x0'))[_0xda0c('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x4b96=['fileLogger','exports','../utils/loggers'];(function(_0x4db546,_0x1f8ef7){var _0x4b3a08=function(_0x2d24d1){while(--_0x2d24d1){_0x4db546['push'](_0x4db546['shift']());}};_0x4b3a08(++_0x1f8ef7);}(_0x4b96,0x19d));var _0x64b9=function(_0x313063,_0x581102){_0x313063=_0x313063-0x0;var _0x4091a7=_0x4b96[_0x313063];return _0x4091a7;};'use strict';var fileLogger=require(_0x64b9('0x0'))[_0x64b9('0x1')];module[_0x64b9('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0d7c310..4de5738 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 _0xaf7c=['ami','../../services/ami/index.js','agi','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','express','../../services/express/index.js'];(function(_0x1bff8e,_0x131966){var _0x2b269a=function(_0x2b7b99){while(--_0x2b7b99){_0x1bff8e['push'](_0x1bff8e['shift']());}};_0x2b269a(++_0x131966);}(_0xaf7c,0x1d5));var _0xcaf7=function(_0x27b0c4,_0x17192c){_0x27b0c4=_0x27b0c4-0x0;var _0xb66ebb=_0xaf7c[_0x27b0c4];return _0xb66ebb;};'use strict';var path=require(_0xcaf7('0x0'));var cfg=require(_0xcaf7('0x1'));var env={'NODE_PATH':path[_0xcaf7('0x2')](path[_0xcaf7('0x3')](cfg[_0xcaf7('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xcaf7('0x5'),'script':path[_0xcaf7('0x3')](__dirname,_0xcaf7('0x6')),'env':env},{'name':_0xcaf7('0x7'),'script':path[_0xcaf7('0x3')](__dirname,_0xcaf7('0x8')),'env':env},{'name':_0xcaf7('0x9'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xcaf7('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xcaf7('0xa'),'script':path['join'](__dirname,_0xcaf7('0xb')),'env':env},{'name':'xdr','script':path[_0xcaf7('0x3')](__dirname,_0xcaf7('0xc')),'env':env}]};module[_0xcaf7('0xd')]=pm2config; \ No newline at end of file +var _0x2dfe=['../../services/routing/index.js','xdr','../../services/xdr/index.js','../../config/environment','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x2dfe,0x1d1));var _0xe2df=function(_0x20073b,_0x9c031e){_0x20073b=_0x20073b-0x0;var _0x428d14=_0x2dfe[_0x20073b];return _0x428d14;};'use strict';var path=require('path');var cfg=require(_0xe2df('0x0'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0xe2df('0x1')],_0xe2df('0x2')))};var pm2config={'apps':[{'name':_0xe2df('0x3'),'script':path[_0xe2df('0x4')](__dirname,_0xe2df('0x5')),'env':env},{'name':_0xe2df('0x6'),'script':path['join'](__dirname,_0xe2df('0x7')),'env':env},{'name':'agi','script':path[_0xe2df('0x4')](__dirname,_0xe2df('0x8')),'env':env},{'name':_0xe2df('0x9'),'script':path[_0xe2df('0x4')](__dirname,_0xe2df('0xa')),'env':env},{'name':'routing','script':path[_0xe2df('0x4')](__dirname,_0xe2df('0xb')),'env':env},{'name':_0xe2df('0xc'),'script':path[_0xe2df('0x4')](__dirname,_0xe2df('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 87de3d4..5954c15 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 _0xedac=['then','disconnect','stop','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start'];(function(_0x472e2e,_0x230bcb){var _0xf8ddc=function(_0x14cce3){while(--_0x14cce3){_0x472e2e['push'](_0x472e2e['shift']());}};_0xf8ddc(++_0x230bcb);}(_0xedac,0x19e));var _0xceda=function(_0x4d2875,_0x275fe3){_0x4d2875=_0x4d2875-0x0;var _0xb7f25e=_0xedac[_0x4d2875];return _0xb7f25e;};'use strict';var pm2=require(_0xceda('0x0'));var BPromise=require(_0xceda('0x1'));var config=require(_0xceda('0x2'));function connect(){return new BPromise(function(_0x3c6eaa,_0x4f74ec){return pm2[_0xceda('0x3')](function(_0x442eb7){if(_0x442eb7){return _0x4f74ec(_0x442eb7);}return _0x3c6eaa(_0xceda('0x4'));});});};exports[_0xceda('0x5')]=function(_0x5a6278){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x3ba40b,_0x4b46b1){return pm2[_0xceda('0x5')](_0x5a6278,function(_0x1faea2,_0x1f9950){if(_0x1faea2){return _0x4b46b1(_0x1faea2);}pm2[_0xceda('0x7')]();return _0x3ba40b(_0x1f9950);});});});};exports[_0xceda('0x8')]=function(_0x559baa){return connect()['then'](function(){return new BPromise(function(_0x151b45,_0x532d6a){return pm2[_0xceda('0x8')](_0x559baa,function(_0xeab8de,_0x5589b2){if(_0xeab8de){return _0x532d6a(_0xeab8de);}pm2[_0xceda('0x7')]();return _0x151b45(_0x5589b2);});});});};exports['restart']=function(_0x4d39a6){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x52b77a,_0x4808cf){return pm2[_0xceda('0x9')](_0x4d39a6,function(_0x287b56,_0x5adc90){if(_0x287b56){return _0x4808cf(_0x287b56);}pm2['disconnect']();return _0x52b77a(_0x5adc90);});});});};exports[_0xceda('0xa')]=function(){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x261b6c,_0x20c1ff){return pm2[_0xceda('0xa')](function(_0x1984c4,_0x38048d){if(_0x1984c4){return _0x20c1ff(_0x1984c4);}pm2[_0xceda('0x7')]();return _0x261b6c(_0x38048d);});});});};exports[_0xceda('0xb')]=function(_0x3a5b09){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x4327bd,_0x397c9d){return pm2[_0xceda('0xb')](_0x3a5b09,function(_0x99809b,_0x5d3c98){if(_0x99809b){return _0x397c9d(_0x99809b);}pm2['disconnect']();return _0x4327bd(_0x5d3c98);});});});};exports[_0xceda('0xc')]=function(_0x248ab2){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x26aad6,_0x5a3fbf){return pm2[_0xceda('0xc')](_0x248ab2,function(_0x3807bc,_0x160e8d){if(_0x3807bc){return _0x5a3fbf(_0x3807bc);}pm2[_0xceda('0x7')]();return _0x26aad6(_0x160e8d);});});});};exports[_0xceda('0xd')]=function(){return connect()[_0xceda('0x6')](function(){return new BPromise(function(_0x224086,_0x131091){return pm2[_0xceda('0xd')](function(_0x166ba4){if(_0x166ba4){return _0x131091(_0x166ba4);}return _0x224086('saved');});});});}; \ No newline at end of file +var _0xefb1=['disconnect','stop','restart','list','describe','delete','dump','bluebird','./config','connect','connected','start','then'];(function(_0x276996,_0xa5f83a){var _0x38cc05=function(_0x424665){while(--_0x424665){_0x276996['push'](_0x276996['shift']());}};_0x38cc05(++_0xa5f83a);}(_0xefb1,0xe4));var _0x1efb=function(_0x5e0ee0,_0x3bbeee){_0x5e0ee0=_0x5e0ee0-0x0;var _0x1c91ab=_0xefb1[_0x5e0ee0];return _0x1c91ab;};'use strict';var pm2=require('pm2');var BPromise=require(_0x1efb('0x0'));var config=require(_0x1efb('0x1'));function connect(){return new BPromise(function(_0x3553c3,_0x43e916){return pm2[_0x1efb('0x2')](function(_0x534511){if(_0x534511){return _0x43e916(_0x534511);}return _0x3553c3(_0x1efb('0x3'));});});};exports[_0x1efb('0x4')]=function(_0x2ff661){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x18d35f,_0x2e3392){return pm2['start'](_0x2ff661,function(_0x43bafe,_0x4a2e71){if(_0x43bafe){return _0x2e3392(_0x43bafe);}pm2[_0x1efb('0x6')]();return _0x18d35f(_0x4a2e71);});});});};exports[_0x1efb('0x7')]=function(_0x43fcb9){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x14ea9e,_0xdb7b0a){return pm2['stop'](_0x43fcb9,function(_0x48fe6e,_0x27536b){if(_0x48fe6e){return _0xdb7b0a(_0x48fe6e);}pm2[_0x1efb('0x6')]();return _0x14ea9e(_0x27536b);});});});};exports[_0x1efb('0x8')]=function(_0x121ce3){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x4ed4d8,_0x31c6bd){return pm2[_0x1efb('0x8')](_0x121ce3,function(_0xd621e9,_0x3047cf){if(_0xd621e9){return _0x31c6bd(_0xd621e9);}pm2['disconnect']();return _0x4ed4d8(_0x3047cf);});});});};exports[_0x1efb('0x9')]=function(){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x30dded,_0x20a579){return pm2['list'](function(_0x5aaafc,_0x107ce6){if(_0x5aaafc){return _0x20a579(_0x5aaafc);}pm2['disconnect']();return _0x30dded(_0x107ce6);});});});};exports[_0x1efb('0xa')]=function(_0x1226ad){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x58bc4d,_0x167d78){return pm2[_0x1efb('0xa')](_0x1226ad,function(_0x5a97e8,_0x36e563){if(_0x5a97e8){return _0x167d78(_0x5a97e8);}pm2[_0x1efb('0x6')]();return _0x58bc4d(_0x36e563);});});});};exports[_0x1efb('0xb')]=function(_0x3daf48){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x26f3ac,_0x2154d3){return pm2[_0x1efb('0xb')](_0x3daf48,function(_0x583777,_0x48c5a2){if(_0x583777){return _0x2154d3(_0x583777);}pm2[_0x1efb('0x6')]();return _0x26f3ac(_0x48c5a2);});});});};exports[_0x1efb('0xc')]=function(){return connect()[_0x1efb('0x5')](function(){return new BPromise(function(_0x594813,_0x4127a3){return pm2[_0x1efb('0xc')](function(_0x2b3f9e){if(_0x2b3f9e){return _0x4127a3(_0x2b3f9e);}return _0x594813('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6b849b2..84c270a 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 _0xd0b2=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xd0b2,0x6f));var _0x2d0b=function(_0x131af5,_0xc4d6d9){_0x131af5=_0x131af5-0x0;var _0x22f8cb=_0xd0b2[_0x131af5];return _0x22f8cb;};'use strict';var _=require(_0x2d0b('0x0'));var moment=require(_0x2d0b('0x1'));var Redis=require('ioredis');var util=require(_0x2d0b('0x2'));var config=require(_0x2d0b('0x3'));var db=require(_0x2d0b('0x4'))['db'];var logger=require(_0x2d0b('0x5'))(_0x2d0b('0x6'));config[_0x2d0b('0x7')]=_['defaults'](config[_0x2d0b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2d0b('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x4f890f=0x0;var _0xc459f9=[];return db[_0x2d0b('0x9')][_0x2d0b('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x2d0b('0xb')](function(_0x4fef73){_0x4f890f=_0x4fef73[_0x2d0b('0xc')];if(_0x4f890f){return db[_0x2d0b('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x2d0b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2d0b('0xf')](_0x4fef73['chatTimeout'],_0x2d0b('0x10'))}}});}else{return[];}})['then'](function(_0xa17636){if(_0xa17636&&_0xa17636['length']){_0xc459f9=_['map'](_0xa17636||[],'id');logger[_0x2d0b('0x11')](_0x2d0b('0x12'),_0xc459f9['join']());return db[_0x2d0b('0xd')][_0x2d0b('0x13')]({'closeReason':_0x2d0b('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x2d0b('0x15'))},{'where':{'id':_0xc459f9}});}})[_0x2d0b('0xb')](function(){if(_0xc459f9&&_0xc459f9[_0x2d0b('0x16')]){logger[_0x2d0b('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xc459f9['join']());for(var _0x199197=0x0;_0x199197<_0xc459f9['length'];_0x199197++){io['emit'](_0x2d0b('0x17'),{'id':_0xc459f9[_0x199197],'closed':!![]});}}})['catch'](function(_0xeaa198){logger['error'](_0x2d0b('0x18'),_0xeaa198?util[_0x2d0b('0x19')](_0xeaa198,{'showHidden':![],'depth':null}):'');});}exports[_0x2d0b('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x174e=['schedule','redis','defaults','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','util','../../mysqldb','../logger'];(function(_0x4a1724,_0x581e12){var _0x124874=function(_0xc86215){while(--_0xc86215){_0x4a1724['push'](_0x4a1724['shift']());}};_0x124874(++_0x581e12);}(_0x174e,0xb6));var _0xe174=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x174e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xe174('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xe174('0x1'));var config=require('../../config/environment');var db=require(_0xe174('0x2'))['db'];var logger=require(_0xe174('0x3'))(_0xe174('0x4'));config[_0xe174('0x5')]=_[_0xe174('0x6')](config[_0xe174('0x5')],{'host':_0xe174('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe174('0x5')]));function closeInteractions(){var _0x57a5b2=0x0;var _0x2dfac6=[];return db[_0xe174('0x8')][_0xe174('0x9')]({'raw':!![],'attributes':['id',_0xe174('0xa')],'where':{'id':0x1}})[_0xe174('0xb')](function(_0x2b18a4){_0x57a5b2=_0x2b18a4[_0xe174('0xa')];if(_0x57a5b2){return db[_0xe174('0xc')][_0xe174('0xd')]({'raw':!![],'attributes':['id',_0xe174('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe174('0xf')](_0x2b18a4[_0xe174('0xa')],'minutes')}}});}else{return[];}})[_0xe174('0xb')](function(_0x2f363b){if(_0x2f363b&&_0x2f363b[_0xe174('0x10')]){_0x2dfac6=_[_0xe174('0x11')](_0x2f363b||[],'id');logger['info'](_0xe174('0x12'),_0x2dfac6[_0xe174('0x13')]());return db[_0xe174('0xc')][_0xe174('0x14')]({'closeReason':_0xe174('0x15'),'disposition':_0xe174('0x16'),'closed':!![],'closedAt':moment()['format'](_0xe174('0x17'))},{'where':{'id':_0x2dfac6}});}})[_0xe174('0xb')](function(){if(_0x2dfac6&&_0x2dfac6[_0xe174('0x10')]){logger[_0xe174('0x18')](_0xe174('0x19'),_0x2dfac6[_0xe174('0x13')]());for(var _0x2b2f6f=0x0;_0x2b2f6f<_0x2dfac6['length'];_0x2b2f6f++){io[_0xe174('0x1a')](_0xe174('0x1b'),{'id':_0x2dfac6[_0x2b2f6f],'closed':!![]});}}})[_0xe174('0x1c')](function(_0x2d7d78){logger[_0xe174('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2d7d78?util[_0xe174('0x1e')](_0x2d7d78,{'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 f0997aa..fdcfc4f 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 _0x4fa0=['exports','startAllRefreshIntervals'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x4fa0,0x105));var _0x04fa=function(_0x17a627,_0x377afe){_0x17a627=_0x17a627-0x0;var _0x53e6ce=_0x4fa0[_0x17a627];return _0x53e6ce;};'use strict';function start(){var _0x513b15=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x513b15[_0x04fa('0x0')]();}module[_0x04fa('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4b8e=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x212de6,_0x4d6d7a){var _0x4b1be3=function(_0x43270c){while(--_0x43270c){_0x212de6['push'](_0x212de6['shift']());}};_0x4b1be3(++_0x4d6d7a);}(_0x4b8e,0x6f));var _0xe4b8=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x4b8e[_0x3c0dcc];return _0x1a224c;};'use strict';function start(){var _0x113f03=require(_0xe4b8('0x0'));return _0x113f03[_0xe4b8('0x1')]();}module[_0xe4b8('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 e01e18a..07380bf 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 _0x7628=['update','update\x20cron','deleteJob','run','start','path','lodash','moment','cron-job-manager','../logger','schedule','retry','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','MailAccount','getSmtpOptions','format','name','email','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','savename','%s.%s','join','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','existsSync','status','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','job','data','stop','operation','still\x20loading','case\x20completed','case\x20empty','case\x20failed','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','intersection','difference','length','exists','delete\x20cron','toRun','resolve','cron','active','startAt','add\x20cron','stop\x20cron','endAt'];(function(_0x135f97,_0x31ec06){var _0x4cb8ab=function(_0x37325f){while(--_0x37325f){_0x135f97['push'](_0x135f97['shift']());}};_0x4cb8ab(++_0x31ec06);}(_0x7628,0x125));var _0x8762=function(_0xaefa77,_0x34c56d){_0xaefa77=_0xaefa77-0x0;var _0x159f15=_0x7628[_0xaefa77];return _0x159f15;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8762('0x0'));var _=require(_0x8762('0x1'));var moment=require(_0x8762('0x2'));var CronJobManager=require(_0x8762('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x8762('0x4'))(_0x8762('0x5'));var db=require('../../mysqldb')['db'];const retry=require(_0x8762('0x6'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8762('0x7')][_0x8762('0x8')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x48ed2c){const _0x31201d={};if(typeof _0x48ed2c===_0x8762('0x9')){_0x31201d['id']=_0x48ed2c;}return db[_0x8762('0xa')][_0x8762('0xb')]({'where':_0x31201d})[_0x8762('0xc')](function(_0x103e31){return _0x103e31;})[_0x8762('0xd')](function(_0x3b7a98){logger[_0x8762('0xe')](_0x3b7a98);});}function handleSendEmail(_0x3d423b,_0x5360b3){logger[_0x8762('0xf')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3d423b['email']);var _0xbd37a2=!![];var _0x130ead=_0x3d423b[_0x8762('0x10')][_0x8762('0x11')]();var _0x1df75c={'account':_0x130ead,'message':{'from':util[_0x8762('0x12')]('\x22%s\x22\x20<%s>',_0x3d423b[_0x8762('0x10')][_0x8762('0x13')],_0x3d423b[_0x8762('0x10')][_0x8762('0x14')]||_0x3d423b['MailAccount'][_0x8762('0x15')]['user']),'to':_0x3d423b['email'],'cc':_0x3d423b['cc'],'bcc':_0x3d423b['bcc'],'subject':util[_0x8762('0x12')](_0x8762('0x16'),_0x5360b3[_0x8762('0x13')],_0x3d423b['subtractNumber'],_0x3d423b[_0x8762('0x17')])}};var _0x516d66=path['join'](__dirname,'../../files/reports');var _0x28a590=_0x5360b3[_0x8762('0x18')];var _0x2e9508=util[_0x8762('0x12')](_0x8762('0x19'),path['basename'](_0x5360b3[_0x8762('0x18')],path['extname'](_0x5360b3[_0x8762('0x18')])),'zip');var _0x4f1a71=path[_0x8762('0x1a')](_0x516d66,_0x28a590);var _0x43bf89=path[_0x8762('0x1a')](_0x516d66,_0x2e9508);if(fs['existsSync'](_0x4f1a71)){_0x5360b3['status']=_0x8762('0x1b');_0x1df75c['message'][_0x8762('0x1c')]=[{'filename':_0x28a590,'path':_0x4f1a71}];_0x1df75c[_0x8762('0x1d')][_0x8762('0x1e')]=util['format'](_0x8762('0x1f'),JSON[_0x8762('0x20')](_0x5360b3,null,0x2));}else if(fs[_0x8762('0x21')](_0x43bf89)){_0x5360b3['status']=_0x8762('0x1b');_0x1df75c['message'][_0x8762('0x1c')]=[{'filename':_0x2e9508,'path':_0x43bf89}];}else{if(_0x5360b3[_0x8762('0x22')]==='Empty'){_0x1df75c[_0x8762('0x1d')][_0x8762('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3d423b['sendIfEmpty']){_0xbd37a2=![];logger[_0x8762('0xf')](_0x8762('0x23'));}}else if(_0x5360b3[_0x8762('0x22')]===_0x8762('0x24')){_0x1df75c[_0x8762('0x1d')]['text']=_0x8762('0x25');}else if(_0x5360b3[_0x8762('0x22')]==='Completed'){_0x1df75c[_0x8762('0x1d')][_0x8762('0x1e')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5360b3['status']===_0x8762('0x26')){_0x1df75c[_0x8762('0x1d')][_0x8762('0x1e')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x8762('0xe')](_0x8762('0x27'),_0x5360b3[_0x8762('0x22')]);}}if(_0xbd37a2){return client[_0x8762('0x28')]('SendMail',_0x1df75c)[_0x8762('0xc')](function(_0x4d5caf){if(_0x4d5caf[_0x8762('0xe')]){return logger[_0x8762('0xe')](_0x8762('0x29'),JSON[_0x8762('0x20')](_0x4d5caf));}return logger[_0x8762('0xf')]('email\x20sent');})[_0x8762('0xd')](function(_0xeb2860){return logger['error']('error\x20mail',JSON['stringify'](_0xeb2860));});}}function handleError(){return function(_0x301997){return logger[_0x8762('0xe')](JSON[_0x8762('0x20')](_0x301997));};}function loading(_0x379687){logger['info'](_0x8762('0x2a'));if(_0x379687[_0x8762('0x2b')]===_0x379687[_0x8762('0x2c')][_0x8762('0x2d')]){handleSendEmail(_0x379687[_0x8762('0x2e')],_0x379687[_0x8762('0x2f')]);_0x379687['operation'][_0x8762('0x30')]();}else{_0x379687[_0x8762('0x31')]['retry'](_0x8762('0x32'));}}function completed(_0x380cc){logger[_0x8762('0xf')](_0x8762('0x33'));handleSendEmail(_0x380cc[_0x8762('0x2e')],_0x380cc[_0x8762('0x2f')]);_0x380cc[_0x8762('0x31')][_0x8762('0x30')]();}function empty(_0x147137){logger['info'](_0x8762('0x34'));handleSendEmail(_0x147137[_0x8762('0x2e')],_0x147137[_0x8762('0x2f')]);_0x147137[_0x8762('0x31')][_0x8762('0x30')]();}function failed(_0x3b59b8){logger['info'](_0x8762('0x35'));handleSendEmail(_0x3b59b8['job'],_0x3b59b8[_0x8762('0x2f')]);_0x3b59b8[_0x8762('0x31')][_0x8762('0x30')]();}function urecognized(_0xe9a725){logger['error']('Unrecognized\x20status:',_0xe9a725['entity'][_0x8762('0x36')][_0x8762('0x22')]);_0xe9a725[_0x8762('0x31')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x457ae3,_0x5408d8){const _0x4ab0ad={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1be764=retry['operation'](_0x4ab0ad);_0x1be764[_0x8762('0x37')](_0x27ba76=>{logger[_0x8762('0xf')](_0x8762('0x38')+_0x457ae3['id']+_0x8762('0x39')+_0x27ba76);try{getReportData(_0x5408d8['id'])[_0x8762('0xc')](function(_0xb1189a){_0x5408d8=_0xb1189a;logger['info']('report\x20status:',_0xb1189a[_0x8762('0x36')][_0x8762('0x22')]);if(!reportStatusStrategies[_0xb1189a[_0x8762('0x36')][_0x8762('0x22')]]){logger[_0x8762('0xe')](_0x8762('0x3a'),_0xb1189a[_0x8762('0x36')][_0x8762('0x22')]);_0x1be764[_0x8762('0x6')]();}reportStatusStrategies[_0xb1189a['dataValues'][_0x8762('0x22')]]({'operation':_0x1be764,'currentAttempt':_0x27ba76,'retryOptions':_0x4ab0ad,'job':_0x457ae3,'data':_0x5408d8,'entity':_0xb1189a});});}catch(_0x2733db){_0x1be764[_0x8762('0x6')](_0x2733db);}});}function handleResult(_0x2c0a6d){return function(_0x3930ce){if(_0x2c0a6d[_0x8762('0x3b')]&&_0x2c0a6d[_0x8762('0x10')]&&_0x2c0a6d[_0x8762('0x10')][_0x8762('0x15')]&&!_[_0x8762('0x3c')](_0x2c0a6d['email'])){retryer(_0x2c0a6d,_0x3930ce);}};}function handleJob(_0x52a215){return function(){try{if(_['isNil'](_0x52a215[_0x8762('0x3d')])){return logger[_0x8762('0xf')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x8762('0x3c')](_0x52a215[_0x8762('0x17')])){return logger[_0x8762('0xf')](_0x8762('0x3e'));}var _0x110616={'startDate':moment()[_0x8762('0x3f')](_0x52a215[_0x8762('0x3d')],_0x52a215[_0x8762('0x17')])[_0x8762('0x12')](_0x8762('0x40')),'endDate':moment()[_0x8762('0x12')](_0x8762('0x40')),'type':'scheduled','output':_0x52a215[_0x8762('0x41')],'name':_0x52a215[_0x8762('0x13')]};if(!_['isNil'](_0x52a215[_0x8762('0x42')])){logger[_0x8762('0xf')](_0x8762('0x43'),_0x52a215[_0x8762('0x42')]);return analyticDefaultReportController['runReport']({'id':_0x52a215[_0x8762('0x42')]},_0x110616)[_0x8762('0xc')](handleResult(_0x52a215))['catch'](handleError());}if(!_[_0x8762('0x3c')](_0x52a215['CustomReportId'])){logger[_0x8762('0xf')](_0x8762('0x44'),_0x52a215['CustomReportId']);return analyticCustomReportController[_0x8762('0x45')]({'id':_0x52a215[_0x8762('0x46')]},_0x110616)[_0x8762('0xc')](handleResult(_0x52a215))['catch'](handleError());}}catch(_0x267d6e){logger[_0x8762('0xe')](JSON[_0x8762('0x20')](_0x267d6e));}return logger[_0x8762('0xf')]('no\x20report\x20id');};}function getJobs(_0x108db2){var _0x5d2162={};if(_0x108db2){_0x5d2162['id']=_0x108db2;}return db[_0x8762('0x47')][_0x8762('0x48')]({'where':_0x5d2162,'include':[{'model':db[_0x8762('0x10')],'attributes':['id',_0x8762('0x13'),_0x8762('0x14')],'include':[{'model':db[_0x8762('0x49')],'as':'Smtp','include':[{'model':db[_0x8762('0x4a')],'as':_0x8762('0x4a')}]}]}]})[_0x8762('0xc')](function(_0x4794d7){var _0x5b5390=_['keys'](manager[_0x8762('0x4b')]);var _0x49d2f5=_[_0x8762('0x4c')](_0x4794d7,function(_0x1fd764){return _0x1fd764['id']['toString']();});var _0x4e2815=_['keyBy'](_0x4794d7,function(_0x230ace){return _0x230ace['id'][_0x8762('0x4d')]();});var _0x58c862=_0x108db2?_0x49d2f5:_['difference'](_0x49d2f5,_0x5b5390);var _0x41f212=_[_0x8762('0x4e')](_0x49d2f5,_0x5b5390);var _0x17bf19=_[_0x8762('0x4f')](_0x5b5390,_0x49d2f5);var _0x279581;var _0x3b268d;for(_0x279581=0x0;_0x279581<_0x17bf19[_0x8762('0x50')]&&!_0x108db2;_0x279581+=0x1){_0x3b268d=_0x17bf19[_0x279581]['toString']();if(manager[_0x8762('0x51')](_0x3b268d)){manager[_0x8762('0x30')](_0x3b268d);manager['deleteJob'](_0x3b268d);logger[_0x8762('0xf')](_0x8762('0x52'),_0x3b268d);}}logger[_0x8762('0xf')](_0x8762('0x53'),JSON[_0x8762('0x20')](_0x58c862));for(_0x279581=0x0;_0x279581<_0x58c862[_0x8762('0x50')];_0x279581+=0x1){_0x3b268d=_0x58c862[_0x279581][_0x8762('0x4d')]();if(_0x108db2){logger[_0x8762('0xf')](JSON[_0x8762('0x20')](_0x4e2815[_0x3b268d]));BPromise[_0x8762('0x54')]()[_0x8762('0xc')](handleJob(_0x4e2815[_0x3b268d]));logger[_0x8762('0xf')]('run\x20job',_0x4e2815[_0x3b268d][_0x8762('0x13')],_0x4e2815[_0x3b268d][_0x8762('0x55')]);}else if(_0x4e2815[_0x3b268d]['cron']&&_0x4e2815[_0x3b268d][_0x8762('0x56')]&&moment()['isBetween'](_0x4e2815[_0x3b268d][_0x8762('0x57')],_0x4e2815[_0x3b268d]['endAt'])){manager['add'](_0x3b268d,_0x4e2815[_0x3b268d][_0x8762('0x55')],handleJob(_0x4e2815[_0x3b268d]));manager['start'](_0x3b268d);logger[_0x8762('0xf')](_0x8762('0x58'),_0x4e2815[_0x3b268d][_0x8762('0x13')],_0x4e2815[_0x3b268d][_0x8762('0x55')]);}else if(manager[_0x8762('0x51')](_0x3b268d)){manager['stop'](_0x3b268d);manager['deleteJob'](_0x3b268d);logger['info'](_0x8762('0x59'),_0x4e2815[_0x3b268d][_0x8762('0x13')],_0x4e2815[_0x3b268d]['cron']);}}for(_0x279581=0x0,_0x3b268d;_0x279581<_0x41f212[_0x8762('0x50')]&&!_0x108db2;_0x279581+=0x1){_0x3b268d=_0x41f212[_0x279581][_0x8762('0x4d')]();if(manager['exists'](_0x3b268d)){if(_0x4e2815[_0x3b268d][_0x8762('0x55')]&&_0x4e2815[_0x3b268d][_0x8762('0x56')]&&moment()['isBetween'](_0x4e2815[_0x3b268d][_0x8762('0x57')],_0x4e2815[_0x3b268d][_0x8762('0x5a')])){manager[_0x8762('0x5b')](_0x3b268d,_0x4e2815[_0x3b268d][_0x8762('0x55')],handleJob(_0x4e2815[_0x3b268d]));logger['info'](_0x8762('0x5c'),_0x4e2815[_0x3b268d][_0x8762('0x13')],_0x4e2815[_0x3b268d][_0x8762('0x55')]);}else{manager[_0x8762('0x30')](_0x3b268d);manager[_0x8762('0x5d')](_0x3b268d);logger[_0x8762('0xf')]('stop\x20cron',_0x4e2815[_0x3b268d][_0x8762('0x13')],_0x4e2815[_0x3b268d][_0x8762('0x55')]);}}}})[_0x8762('0xd')](function(_0x163e44){logger['error'](JSON[_0x8762('0x20')](_0x163e44));});}exports[_0x8762('0x5e')]=function(_0x5ebe6e){return getJobs(_0x5ebe6e);};exports[_0x8762('0x5f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6feb=['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','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','error\x20mail','stringify','catch','case\x20loading','currentAttempt','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','length','run\x20job','cron','active','isBetween','startAt','endAt','start','stop\x20cron','update\x20cron','util','path','lodash','cron-job-manager','bluebird','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','MailAccount','Smtp','name','subtractNumber','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent'];(function(_0x50da6f,_0xfeb8d1){var _0xaff1c5=function(_0x41f703){while(--_0x41f703){_0x50da6f['push'](_0x50da6f['shift']());}};_0xaff1c5(++_0xfeb8d1);}(_0x6feb,0xa6));var _0xb6fe=function(_0x246bf2,_0x2cc953){_0x246bf2=_0x246bf2-0x0;var _0x16a062=_0x6feb[_0x246bf2];return _0x16a062;};'use strict';var fs=require('fs');var util=require(_0xb6fe('0x0'));var path=require(_0xb6fe('0x1'));var _=require(_0xb6fe('0x2'));var moment=require('moment');var CronJobManager=require(_0xb6fe('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xb6fe('0x4'));var logger=require('../logger')(_0xb6fe('0x5'));var db=require('../../mysqldb')['db'];const retry=require(_0xb6fe('0x6'));var analyticCustomReportController=require(_0xb6fe('0x7'));var analyticDefaultReportController=require(_0xb6fe('0x8'));var client=jayson['client'][_0xb6fe('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x340db8){const _0x360b53={};if(typeof _0x340db8===_0xb6fe('0xa')){_0x360b53['id']=_0x340db8;}return db['AnalyticExtractedReport'][_0xb6fe('0xb')]({'where':_0x360b53})[_0xb6fe('0xc')](function(_0x286606){return _0x286606;})['catch'](function(_0x2dd4b8){logger[_0xb6fe('0xd')](_0x2dd4b8);});}function handleSendEmail(_0x5ac0aa,_0x199060){logger[_0xb6fe('0xe')](_0xb6fe('0xf'),_0x5ac0aa[_0xb6fe('0x10')]);var _0x30c2d4=!![];var _0xdddfbb=_0x5ac0aa['MailAccount'][_0xb6fe('0x11')]();var _0x5b9b6a={'account':_0xdddfbb,'message':{'from':util[_0xb6fe('0x12')]('\x22%s\x22\x20<%s>',_0x5ac0aa[_0xb6fe('0x13')]['name'],_0x5ac0aa[_0xb6fe('0x13')][_0xb6fe('0x10')]||_0x5ac0aa['MailAccount'][_0xb6fe('0x14')]['user']),'to':_0x5ac0aa[_0xb6fe('0x10')],'cc':_0x5ac0aa['cc'],'bcc':_0x5ac0aa['bcc'],'subject':util[_0xb6fe('0x12')]('Report\x20%s\x20last\x20%s\x20%s',_0x199060[_0xb6fe('0x15')],_0x5ac0aa[_0xb6fe('0x16')],_0x5ac0aa['subtractUnit'])}};var _0x3473ff=path[_0xb6fe('0x17')](__dirname,'../../files/reports');var _0xffd52b=_0x199060[_0xb6fe('0x18')];var _0xc789de=util[_0xb6fe('0x12')](_0xb6fe('0x19'),path[_0xb6fe('0x1a')](_0x199060[_0xb6fe('0x18')],path[_0xb6fe('0x1b')](_0x199060['savename'])),_0xb6fe('0x1c'));var _0xf67cf9=path[_0xb6fe('0x17')](_0x3473ff,_0xffd52b);var _0x38984c=path[_0xb6fe('0x17')](_0x3473ff,_0xc789de);if(fs[_0xb6fe('0x1d')](_0xf67cf9)){_0x199060[_0xb6fe('0x1e')]=_0xb6fe('0x1f');_0x5b9b6a['message'][_0xb6fe('0x20')]=[{'filename':_0xffd52b,'path':_0xf67cf9}];_0x5b9b6a[_0xb6fe('0x21')][_0xb6fe('0x22')]=util[_0xb6fe('0x12')](_0xb6fe('0x23'),JSON['stringify'](_0x199060,null,0x2));}else if(fs[_0xb6fe('0x1d')](_0x38984c)){_0x199060['status']=_0xb6fe('0x1f');_0x5b9b6a[_0xb6fe('0x21')][_0xb6fe('0x20')]=[{'filename':_0xc789de,'path':_0x38984c}];}else{if(_0x199060[_0xb6fe('0x1e')]===_0xb6fe('0x24')){_0x5b9b6a[_0xb6fe('0x21')]['text']=_0xb6fe('0x25');if(!_0x5ac0aa[_0xb6fe('0x26')]){_0x30c2d4=![];logger[_0xb6fe('0xe')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x199060[_0xb6fe('0x1e')]===_0xb6fe('0x27')){_0x5b9b6a[_0xb6fe('0x21')][_0xb6fe('0x22')]=_0xb6fe('0x28');}else if(_0x199060['status']==='Completed'){_0x5b9b6a[_0xb6fe('0x21')][_0xb6fe('0x22')]=_0xb6fe('0x29');}else if(_0x199060[_0xb6fe('0x1e')]==='Failed'){_0x5b9b6a['message'][_0xb6fe('0x22')]=_0xb6fe('0x2a');}else{logger[_0xb6fe('0xd')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x199060[_0xb6fe('0x1e')]);}}if(_0x30c2d4){return client[_0xb6fe('0x2b')](_0xb6fe('0x2c'),_0x5b9b6a)[_0xb6fe('0xc')](function(_0x12fb3a){if(_0x12fb3a[_0xb6fe('0xd')]){return logger['error'](_0xb6fe('0x2d'),JSON[_0xb6fe('0x2e')](_0x12fb3a));}return logger[_0xb6fe('0xe')]('email\x20sent');})[_0xb6fe('0x2f')](function(_0x1b8014){return logger[_0xb6fe('0xd')](_0xb6fe('0x2d'),JSON[_0xb6fe('0x2e')](_0x1b8014));});}}function handleError(){return function(_0x45f2ff){return logger[_0xb6fe('0xd')](JSON[_0xb6fe('0x2e')](_0x45f2ff));};}function loading(_0x204aad){logger[_0xb6fe('0xe')](_0xb6fe('0x30'));if(_0x204aad[_0xb6fe('0x31')]===_0x204aad['retryOptions'][_0xb6fe('0x32')]){handleSendEmail(_0x204aad[_0xb6fe('0x33')],_0x204aad[_0xb6fe('0x34')]);_0x204aad[_0xb6fe('0x35')][_0xb6fe('0x36')]();}else{_0x204aad[_0xb6fe('0x35')][_0xb6fe('0x6')](_0xb6fe('0x37'));}}function completed(_0x57db9c){logger[_0xb6fe('0xe')](_0xb6fe('0x38'));handleSendEmail(_0x57db9c[_0xb6fe('0x33')],_0x57db9c['data']);_0x57db9c[_0xb6fe('0x35')]['stop']();}function empty(_0xe0919a){logger[_0xb6fe('0xe')](_0xb6fe('0x39'));handleSendEmail(_0xe0919a[_0xb6fe('0x33')],_0xe0919a[_0xb6fe('0x34')]);_0xe0919a[_0xb6fe('0x35')]['stop']();}function failed(_0xc00ad4){logger[_0xb6fe('0xe')](_0xb6fe('0x3a'));handleSendEmail(_0xc00ad4[_0xb6fe('0x33')],_0xc00ad4['data']);_0xc00ad4[_0xb6fe('0x35')][_0xb6fe('0x36')]();}function urecognized(_0x52658a){logger[_0xb6fe('0xd')](_0xb6fe('0x3b'),_0x52658a[_0xb6fe('0x3c')][_0xb6fe('0x3d')][_0xb6fe('0x1e')]);_0x52658a['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1d7adf,_0x5490dc){const _0x52974e={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x57300a=retry['operation'](_0x52974e);_0x57300a['attempt'](_0xcef90a=>{logger[_0xb6fe('0xe')](_0xb6fe('0x3e')+_0x1d7adf['id']+_0xb6fe('0x3f')+_0xcef90a);try{getReportData(_0x5490dc['id'])[_0xb6fe('0xc')](function(_0x5629b4){_0x5490dc=_0x5629b4;logger[_0xb6fe('0xe')](_0xb6fe('0x40'),_0x5629b4[_0xb6fe('0x3d')][_0xb6fe('0x1e')]);if(!reportStatusStrategies[_0x5629b4[_0xb6fe('0x3d')][_0xb6fe('0x1e')]]){logger[_0xb6fe('0xd')]('report\x20status:',_0x5629b4[_0xb6fe('0x3d')][_0xb6fe('0x1e')]);_0x57300a[_0xb6fe('0x6')]();}reportStatusStrategies[_0x5629b4[_0xb6fe('0x3d')][_0xb6fe('0x1e')]]({'operation':_0x57300a,'currentAttempt':_0xcef90a,'retryOptions':_0x52974e,'job':_0x1d7adf,'data':_0x5490dc,'entity':_0x5629b4});});}catch(_0x368fb6){_0x57300a['retry'](_0x368fb6);}});}function handleResult(_0x4ef410){return function(_0x198618){if(_0x4ef410[_0xb6fe('0x41')]&&_0x4ef410[_0xb6fe('0x13')]&&_0x4ef410[_0xb6fe('0x13')]['Smtp']&&!_[_0xb6fe('0x42')](_0x4ef410[_0xb6fe('0x10')])){retryer(_0x4ef410,_0x198618);}};}function handleJob(_0x485b75){return function(){try{if(_[_0xb6fe('0x42')](_0x485b75[_0xb6fe('0x16')])){return logger[_0xb6fe('0xe')](_0xb6fe('0x43'));}if(_['isNil'](_0x485b75[_0xb6fe('0x44')])){return logger[_0xb6fe('0xe')]('subtractUnit\x20null\x20or\x20undefined');}var _0x2238d0={'startDate':moment()['subtract'](_0x485b75[_0xb6fe('0x16')],_0x485b75['subtractUnit'])[_0xb6fe('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb6fe('0x12')](_0xb6fe('0x45')),'type':'scheduled','output':_0x485b75['output'],'name':_0x485b75[_0xb6fe('0x15')]};if(!_[_0xb6fe('0x42')](_0x485b75['DefaultReportId'])){logger[_0xb6fe('0xe')](_0xb6fe('0x46'),_0x485b75[_0xb6fe('0x47')]);return analyticDefaultReportController[_0xb6fe('0x48')]({'id':_0x485b75['DefaultReportId']},_0x2238d0)['then'](handleResult(_0x485b75))['catch'](handleError());}if(!_[_0xb6fe('0x42')](_0x485b75[_0xb6fe('0x49')])){logger[_0xb6fe('0xe')](_0xb6fe('0x4a'),_0x485b75[_0xb6fe('0x49')]);return analyticCustomReportController['runReport']({'id':_0x485b75['CustomReportId']},_0x2238d0)[_0xb6fe('0xc')](handleResult(_0x485b75))['catch'](handleError());}}catch(_0x227154){logger[_0xb6fe('0xd')](JSON[_0xb6fe('0x2e')](_0x227154));}return logger[_0xb6fe('0xe')](_0xb6fe('0x4b'));};}function getJobs(_0x5bf49e){var _0x3cc604={};if(_0x5bf49e){_0x3cc604['id']=_0x5bf49e;}return db[_0xb6fe('0x4c')][_0xb6fe('0x4d')]({'where':_0x3cc604,'include':[{'model':db[_0xb6fe('0x13')],'attributes':['id',_0xb6fe('0x15'),_0xb6fe('0x10')],'include':[{'model':db[_0xb6fe('0x4e')],'as':_0xb6fe('0x14'),'include':[{'model':db['CloudProvider'],'as':_0xb6fe('0x4f')}]}]}]})[_0xb6fe('0xc')](function(_0x3f7356){var _0x127d40=_[_0xb6fe('0x50')](manager[_0xb6fe('0x51')]);var _0x133b51=_['map'](_0x3f7356,function(_0x1dfc77){return _0x1dfc77['id'][_0xb6fe('0x52')]();});var _0xb02707=_[_0xb6fe('0x53')](_0x3f7356,function(_0x24bb5f){return _0x24bb5f['id'][_0xb6fe('0x52')]();});var _0x565a1a=_0x5bf49e?_0x133b51:_[_0xb6fe('0x54')](_0x133b51,_0x127d40);var _0x3fd161=_[_0xb6fe('0x55')](_0x133b51,_0x127d40);var _0x33de2f=_['difference'](_0x127d40,_0x133b51);var _0x57160f;var _0x5d1b0b;for(_0x57160f=0x0;_0x57160f<_0x33de2f['length']&&!_0x5bf49e;_0x57160f+=0x1){_0x5d1b0b=_0x33de2f[_0x57160f][_0xb6fe('0x52')]();if(manager[_0xb6fe('0x56')](_0x5d1b0b)){manager[_0xb6fe('0x36')](_0x5d1b0b);manager[_0xb6fe('0x57')](_0x5d1b0b);logger[_0xb6fe('0xe')](_0xb6fe('0x58'),_0x5d1b0b);}}logger[_0xb6fe('0xe')]('toRun',JSON[_0xb6fe('0x2e')](_0x565a1a));for(_0x57160f=0x0;_0x57160f<_0x565a1a[_0xb6fe('0x59')];_0x57160f+=0x1){_0x5d1b0b=_0x565a1a[_0x57160f]['toString']();if(_0x5bf49e){logger['info'](JSON[_0xb6fe('0x2e')](_0xb02707[_0x5d1b0b]));BPromise['resolve']()[_0xb6fe('0xc')](handleJob(_0xb02707[_0x5d1b0b]));logger[_0xb6fe('0xe')](_0xb6fe('0x5a'),_0xb02707[_0x5d1b0b][_0xb6fe('0x15')],_0xb02707[_0x5d1b0b][_0xb6fe('0x5b')]);}else if(_0xb02707[_0x5d1b0b]['cron']&&_0xb02707[_0x5d1b0b][_0xb6fe('0x5c')]&&moment()[_0xb6fe('0x5d')](_0xb02707[_0x5d1b0b][_0xb6fe('0x5e')],_0xb02707[_0x5d1b0b][_0xb6fe('0x5f')])){manager['add'](_0x5d1b0b,_0xb02707[_0x5d1b0b]['cron'],handleJob(_0xb02707[_0x5d1b0b]));manager[_0xb6fe('0x60')](_0x5d1b0b);logger[_0xb6fe('0xe')]('add\x20cron',_0xb02707[_0x5d1b0b][_0xb6fe('0x15')],_0xb02707[_0x5d1b0b]['cron']);}else if(manager[_0xb6fe('0x56')](_0x5d1b0b)){manager[_0xb6fe('0x36')](_0x5d1b0b);manager[_0xb6fe('0x57')](_0x5d1b0b);logger[_0xb6fe('0xe')](_0xb6fe('0x61'),_0xb02707[_0x5d1b0b][_0xb6fe('0x15')],_0xb02707[_0x5d1b0b][_0xb6fe('0x5b')]);}}for(_0x57160f=0x0,_0x5d1b0b;_0x57160f<_0x3fd161[_0xb6fe('0x59')]&&!_0x5bf49e;_0x57160f+=0x1){_0x5d1b0b=_0x3fd161[_0x57160f][_0xb6fe('0x52')]();if(manager[_0xb6fe('0x56')](_0x5d1b0b)){if(_0xb02707[_0x5d1b0b][_0xb6fe('0x5b')]&&_0xb02707[_0x5d1b0b][_0xb6fe('0x5c')]&&moment()[_0xb6fe('0x5d')](_0xb02707[_0x5d1b0b][_0xb6fe('0x5e')],_0xb02707[_0x5d1b0b][_0xb6fe('0x5f')])){manager['update'](_0x5d1b0b,_0xb02707[_0x5d1b0b][_0xb6fe('0x5b')],handleJob(_0xb02707[_0x5d1b0b]));logger[_0xb6fe('0xe')](_0xb6fe('0x62'),_0xb02707[_0x5d1b0b][_0xb6fe('0x15')],_0xb02707[_0x5d1b0b][_0xb6fe('0x5b')]);}else{manager['stop'](_0x5d1b0b);manager[_0xb6fe('0x57')](_0x5d1b0b);logger[_0xb6fe('0xe')](_0xb6fe('0x61'),_0xb02707[_0x5d1b0b][_0xb6fe('0x15')],_0xb02707[_0x5d1b0b]['cron']);}}}})[_0xb6fe('0x2f')](function(_0x31f2b5){logger[_0xb6fe('0xd')](JSON[_0xb6fe('0x2e')](_0x31f2b5));});}exports['run']=function(_0x1ff70a){return getJobs(_0x1ff70a);};exports[_0xb6fe('0x60')]=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 7285def..9afd87c 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 _0x5987=['Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','bucket','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative'];(function(_0x59d567,_0x594d9d){var _0xb08e0e=function(_0xe37b6){while(--_0xe37b6){_0x59d567['push'](_0x59d567['shift']());}};_0xb08e0e(++_0x594d9d);}(_0x5987,0x128));var _0x7598=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5987[_0x3b380d];return _0x54502b;};var _=require(_0x7598('0x0'));var AWS=require(_0x7598('0x1'));var rp=require(_0x7598('0x2'));var util=require(_0x7598('0x3'));var BPromise=require('bluebird');var db=require(_0x7598('0x4'))['db'];var logger=require(_0x7598('0x5'))(_0x7598('0x6'));function getTranscriptionJob(_0x373ef6,_0x2820fc,_0x1d3f9e,_0x1a5a7d){return new Promise(function(_0x56cc44,_0x1c78e){var _0x4ae889=new AWS[(_0x7598('0x7'))]({'accessKeyId':_0x2820fc,'secretAccessKey':_0x373ef6,'region':_0x1d3f9e});_0x4ae889[_0x7598('0x8')]({'TranscriptionJobName':_0x1a5a7d},function(_0x2cf89d,_0x163b1){if(_0x2cf89d){return _0x1c78e(_0x2cf89d);}else{return _0x56cc44(_0x163b1);}});});}function sentiment(_0x3510af,_0x1c1835,_0x3871d4,_0x4bafbc,_0x5c1782){return new Promise(function(_0x55f8a5,_0x8ac2a3){var _0x138510=new AWS[(_0x7598('0x9'))]({'accessKeyId':_0x1c1835,'secretAccessKey':_0x3510af,'region':_0x3871d4});_0x138510['detectSentiment']({'Text':_0x4bafbc,'LanguageCode':_0x5c1782['substring'](0x0,0x2)},function(_0x30f0f2,_0xee86a3){if(_0x30f0f2){return _0x8ac2a3(_0x30f0f2);}else{return _0x55f8a5(_0xee86a3);}});});}function checkTranscribeJob(_0x1be21a,_0x1a92e9,_0x22cc20){var _0x52bc43;return new BPromise(function(_0x212ee4,_0x5242a1){logger['info'](util[_0x7598('0xa')](_0x7598('0xb'),_0x1be21a['id'],_0x1be21a[_0x7598('0xc')]));return getTranscriptionJob(_0x22cc20[_0x7598('0xd')],_0x22cc20['data2'],_0x1a92e9[_0x7598('0xe')],_0x1be21a[_0x7598('0xc')])[_0x7598('0xf')](function(_0x3282de){logger['info'](util[_0x7598('0xa')](_0x7598('0x10'),_0x1be21a['id'],_0x1be21a[_0x7598('0xc')],_0x3282de[_0x7598('0x11')][_0x7598('0x12')]));if(!_0x1be21a[_0x7598('0x13')]){switch(_0x3282de['TranscriptionJob'][_0x7598('0x12')]){case _0x7598('0x14'):var _0x50c315={'transcribeStatus':_0x3282de[_0x7598('0x11')][_0x7598('0x12')],'fileUri':_0x3282de['TranscriptionJob']['Transcript'][_0x7598('0x15')]};logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x17'),_0x1be21a['id']));return rp({'uri':_0x3282de[_0x7598('0x11')]['Transcript'][_0x7598('0x15')],'json':!![]})[_0x7598('0xf')](function(_0x1d6e1b){logger[_0x7598('0x16')](util[_0x7598('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1be21a['id']));if(_0x1d6e1b&&_0x1d6e1b[_0x7598('0x18')]&&_0x1d6e1b[_0x7598('0x18')][_0x7598('0x19')]&&_0x1d6e1b[_0x7598('0x18')][_0x7598('0x19')][_0x7598('0x1a')]){_0x50c315['fileText']='';for(var _0x4bfac0=0x0;_0x4bfac0<_0x1d6e1b[_0x7598('0x18')]['transcripts']['length'];_0x4bfac0++){_0x50c315[_0x7598('0x13')]+=_0x1d6e1b[_0x7598('0x18')][_0x7598('0x19')][_0x4bfac0]['transcript']+'';}}return _0x1be21a['update'](_0x50c315);})['then'](function(){logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x1b'),_0x1be21a['id']));if(!_0x1be21a[_0x7598('0x1c')]){throw new db[(_0x7598('0x1d'))][(_0x7598('0x1e'))](_0x7598('0x1f'));}if(!_0x1a92e9[_0x7598('0x20')]||!_0x1a92e9[_0x7598('0x21')]||!_0x1a92e9[_0x7598('0x22')]||!_0x1a92e9['language']||!_0x1a92e9['bucket']){throw new db['Sequelize'][(_0x7598('0x1e'))](_0x7598('0x23'));}if(!_0x50c315[_0x7598('0x13')]){throw new Error(_0x7598('0x24'));}if(_0x1a92e9['sentimentAccountId']===_0x22cc20['id']){return _0x22cc20;}else{return db[_0x7598('0x25')][_0x7598('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7598('0xf')](function(_0x511a1d){if(!_0x511a1d){throw new db[(_0x7598('0x1d'))][(_0x7598('0x1e'))](_0x7598('0x27'));}if(!_0x511a1d['data1']||!_0x511a1d['data2']){throw new db[(_0x7598('0x1d'))]['ValidationError'](_0x7598('0x28'));}_0x52bc43=_0x511a1d;logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x29'),_0x1be21a['id']));return sentiment(_0x52bc43['data1'],_0x52bc43[_0x7598('0x2a')],_0x1a92e9[_0x7598('0x22')],_0x50c315[_0x7598('0x13')],_0x1a92e9[_0x7598('0x2b')]);})[_0x7598('0xf')](function(_0x2ae444){logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x2c'),_0x1be21a['id']));return _0x1be21a['update']({'sentiment':_0x2ae444[_0x7598('0x2d')],'sPositive':_0x2ae444['SentimentScore'][_0x7598('0x2e')],'sNegative':_0x2ae444[_0x7598('0x2f')][_0x7598('0x30')],'sMixed':_0x2ae444[_0x7598('0x2f')][_0x7598('0x31')],'sNeutral':_0x2ae444[_0x7598('0x2f')][_0x7598('0x32')]});})[_0x7598('0xf')](function(){logger['info'](util['format'](_0x7598('0x1b'),_0x1be21a['id']));_0x212ee4();});case _0x7598('0x33'):return _0x1be21a['update']({'transcribeStatus':'FAILED','failureReason':_0x3282de['TranscriptionJob'][_0x7598('0x34')]})[_0x7598('0xf')](function(){logger['info'](util['format'](_0x7598('0x1b'),_0x1be21a['id']));_0x212ee4();});default:logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x35'),_0x1be21a['id']));break;}}else{return BPromise[_0x7598('0x36')]()[_0x7598('0xf')](function(){if(!_0x1be21a[_0x7598('0x1c')]){throw new db['Sequelize'][(_0x7598('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1a92e9['sentiment']||!_0x1a92e9[_0x7598('0x21')]||!_0x1a92e9[_0x7598('0x22')]||!_0x1a92e9[_0x7598('0x2b')]||!_0x1a92e9['bucket']){throw new db[(_0x7598('0x1d'))]['ValidationError'](_0x7598('0x23'));}if(!_0x1be21a[_0x7598('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1a92e9[_0x7598('0x21')]===_0x22cc20['id']){return _0x22cc20;}else{return db[_0x7598('0x25')][_0x7598('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7598('0xf')](function(_0x803c9){if(!_0x803c9){throw new db[(_0x7598('0x1d'))][(_0x7598('0x1e'))](_0x7598('0x27'));}if(!_0x803c9[_0x7598('0xd')]||!_0x803c9[_0x7598('0x2a')]){throw new db[(_0x7598('0x1d'))][(_0x7598('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x52bc43=_0x803c9;logger[_0x7598('0x16')](util['format'](_0x7598('0x29'),_0x1be21a['id']));return sentiment(_0x52bc43[_0x7598('0xd')],_0x52bc43[_0x7598('0x2a')],_0x1a92e9['sentimentRegion'],_0x1be21a[_0x7598('0x13')],_0x1a92e9['language']);})[_0x7598('0xf')](function(_0x186d91){logger[_0x7598('0x16')](util[_0x7598('0xa')](_0x7598('0x2c'),_0x1be21a['id']));return _0x1be21a['update']({'sentiment':_0x186d91['Sentiment'],'sPositive':_0x186d91[_0x7598('0x2f')][_0x7598('0x2e')],'sNegative':_0x186d91[_0x7598('0x2f')][_0x7598('0x30')],'sMixed':_0x186d91['SentimentScore'][_0x7598('0x31')],'sNeutral':_0x186d91['SentimentScore']['Neutral'],'transcribeStatus':_0x7598('0x14')});})[_0x7598('0xf')](function(){logger[_0x7598('0x16')](util[_0x7598('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1be21a['id']));_0x212ee4();});}})[_0x7598('0x37')](function(_0x1adf67){if(_0x1adf67){if(!_0x1adf67[_0x7598('0x38')]||_0x1adf67[_0x7598('0x38')]!==_0x7598('0x39')){logger[_0x7598('0x3a')](util[_0x7598('0xa')](_0x7598('0x3b'),_0x1be21a['id']),util[_0x7598('0x3c')](_0x1adf67,{'showHidden':![],'depth':null}));}}_0x212ee4();});});}function checkTranscribe(){var _0x58fee6;var _0x293100;var _0x2efa18;return db[_0x7598('0x3d')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x334a54){if(!_0x334a54||!_0x334a54[_0x7598('0x1a')]){throw new db[(_0x7598('0x1d'))][(_0x7598('0x1e'))](_0x7598('0x3e'));}_0x58fee6=_0x334a54;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x7598('0xf')](function(_0x33a6a5){if(!_0x33a6a5){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x293100=_0x33a6a5;if(!_0x293100[_0x7598('0x6')]||!_0x293100['transcribeAccountId']||!_0x293100['transcribeRegion']||!_0x293100[_0x7598('0x2b')]||!_0x293100[_0x7598('0x3f')]){throw new db[(_0x7598('0x1d'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x7598('0x25')][_0x7598('0x26')]({'where':{'id':_0x293100[_0x7598('0x40')]}});})['then'](function(_0x1ce912){if(!_0x1ce912){throw new db[(_0x7598('0x1d'))]['ValidationError'](_0x7598('0x27'));}if(!_0x1ce912[_0x7598('0xd')]||!_0x1ce912['data2']){throw new db['Sequelize'][(_0x7598('0x1e'))](_0x7598('0x28'));}_0x2efa18=_0x1ce912;var _0x3891fb=[];_0x58fee6[_0x7598('0x41')](function(_0x47f44e){_0x3891fb[_0x7598('0x42')](checkTranscribeJob(_0x47f44e,_0x293100,_0x2efa18));});return BPromise[_0x7598('0x43')](_0x3891fb);})[_0x7598('0x37')](function(_0x7235ec){if(_0x7235ec){if(!_0x7235ec[_0x7598('0x38')]||_0x7235ec[_0x7598('0x38')]!==_0x7598('0x39')){logger[_0x7598('0x3a')](util['inspect'](_0x7235ec,{'showHidden':![],'depth':null}));}}});}exports[_0x7598('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc16f=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','start','lodash','aws-sdk','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','update','info','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available'];(function(_0x4d5957,_0x59be7e){var _0x487b2f=function(_0x444f45){while(--_0x444f45){_0x4d5957['push'](_0x4d5957['shift']());}};_0x487b2f(++_0x59be7e);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};var _=require(_0xfc16('0x0'));var AWS=require(_0xfc16('0x1'));var rp=require('request-promise');var util=require(_0xfc16('0x2'));var BPromise=require(_0xfc16('0x3'));var db=require(_0xfc16('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x2d277f,_0x4eed0d,_0x15130b,_0x332e4c){return new Promise(function(_0x365e8b,_0x2fbdb1){var _0x1f2225=new AWS[(_0xfc16('0x5'))]({'accessKeyId':_0x4eed0d,'secretAccessKey':_0x2d277f,'region':_0x15130b});_0x1f2225[_0xfc16('0x6')]({'TranscriptionJobName':_0x332e4c},function(_0x3331cc,_0x38737c){if(_0x3331cc){return _0x2fbdb1(_0x3331cc);}else{return _0x365e8b(_0x38737c);}});});}function sentiment(_0x378d34,_0x40c1f8,_0x548e1f,_0x49ff5c,_0x31223b){return new Promise(function(_0x550b75,_0x496f1f){var _0x41d23f=new AWS[(_0xfc16('0x7'))]({'accessKeyId':_0x40c1f8,'secretAccessKey':_0x378d34,'region':_0x548e1f});_0x41d23f['detectSentiment']({'Text':_0x49ff5c,'LanguageCode':_0x31223b['substring'](0x0,0x2)},function(_0x35680c,_0x30ec42){if(_0x35680c){return _0x496f1f(_0x35680c);}else{return _0x550b75(_0x30ec42);}});});}function checkTranscribeJob(_0x36075b,_0x456478,_0x2dcd29){var _0x1384e2;return new BPromise(function(_0x18868b,_0x2db167){logger['info'](util[_0xfc16('0x8')](_0xfc16('0x9'),_0x36075b['id'],_0x36075b[_0xfc16('0xa')]));return getTranscriptionJob(_0x2dcd29[_0xfc16('0xb')],_0x2dcd29[_0xfc16('0xc')],_0x456478[_0xfc16('0xd')],_0x36075b[_0xfc16('0xa')])[_0xfc16('0xe')](function(_0x36e3e1){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x36075b['id'],_0x36075b['transcribeName'],_0x36e3e1['TranscriptionJob'][_0xfc16('0xf')]));if(!_0x36075b['fileText']){switch(_0x36e3e1[_0xfc16('0x10')][_0xfc16('0xf')]){case _0xfc16('0x11'):var _0x8327f8={'transcribeStatus':_0x36e3e1[_0xfc16('0x10')][_0xfc16('0xf')],'fileUri':_0x36e3e1[_0xfc16('0x10')]['Transcript']['TranscriptFileUri']};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x36075b['id']));return rp({'uri':_0x36e3e1['TranscriptionJob'][_0xfc16('0x12')][_0xfc16('0x13')],'json':!![]})[_0xfc16('0xe')](function(_0x1cdd64){logger['info'](util['format'](_0xfc16('0x14'),_0x36075b['id']));if(_0x1cdd64&&_0x1cdd64[_0xfc16('0x15')]&&_0x1cdd64[_0xfc16('0x15')]['transcripts']&&_0x1cdd64[_0xfc16('0x15')]['transcripts'][_0xfc16('0x16')]){_0x8327f8[_0xfc16('0x17')]='';for(var _0xf2a0b5=0x0;_0xf2a0b5<_0x1cdd64[_0xfc16('0x15')]['transcripts'][_0xfc16('0x16')];_0xf2a0b5++){_0x8327f8['fileText']+=_0x1cdd64[_0xfc16('0x15')][_0xfc16('0x18')][_0xf2a0b5]['transcript']+'';}}return _0x36075b[_0xfc16('0x19')](_0x8327f8);})[_0xfc16('0xe')](function(){logger[_0xfc16('0x1a')](util[_0xfc16('0x8')](_0xfc16('0x1b'),_0x36075b['id']));if(!_0x36075b[_0xfc16('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xfc16('0x1d'));}if(!_0x456478[_0xfc16('0x1e')]||!_0x456478['sentimentAccountId']||!_0x456478[_0xfc16('0x1f')]||!_0x456478[_0xfc16('0x20')]||!_0x456478[_0xfc16('0x21')]){throw new db['Sequelize'][(_0xfc16('0x22'))](_0xfc16('0x23'));}if(!_0x8327f8[_0xfc16('0x17')]){throw new Error(_0xfc16('0x24'));}if(_0x456478[_0xfc16('0x25')]===_0x2dcd29['id']){return _0x2dcd29;}else{return db[_0xfc16('0x26')][_0xfc16('0x27')]({'where':{'id':_settings[_0xfc16('0x25')]}});}})[_0xfc16('0xe')](function(_0x57cea2){if(!_0x57cea2){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x57cea2[_0xfc16('0xb')]||!_0x57cea2['data2']){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))](_0xfc16('0x29'));}_0x1384e2=_0x57cea2;logger[_0xfc16('0x1a')](util[_0xfc16('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x36075b['id']));return sentiment(_0x1384e2[_0xfc16('0xb')],_0x1384e2[_0xfc16('0xc')],_0x456478['sentimentRegion'],_0x8327f8[_0xfc16('0x17')],_0x456478['language']);})[_0xfc16('0xe')](function(_0x539a7f){logger[_0xfc16('0x1a')](util[_0xfc16('0x8')](_0xfc16('0x2a'),_0x36075b['id']));return _0x36075b[_0xfc16('0x19')]({'sentiment':_0x539a7f[_0xfc16('0x2b')],'sPositive':_0x539a7f[_0xfc16('0x2c')][_0xfc16('0x2d')],'sNegative':_0x539a7f['SentimentScore'][_0xfc16('0x2e')],'sMixed':_0x539a7f[_0xfc16('0x2c')][_0xfc16('0x2f')],'sNeutral':_0x539a7f['SentimentScore'][_0xfc16('0x30')]});})['then'](function(){logger[_0xfc16('0x1a')](util[_0xfc16('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36075b['id']));_0x18868b();});case _0xfc16('0x31'):return _0x36075b[_0xfc16('0x19')]({'transcribeStatus':_0xfc16('0x31'),'failureReason':_0x36e3e1[_0xfc16('0x10')][_0xfc16('0x32')]})[_0xfc16('0xe')](function(){logger[_0xfc16('0x1a')](util['format'](_0xfc16('0x1b'),_0x36075b['id']));_0x18868b();});default:logger[_0xfc16('0x1a')](util[_0xfc16('0x8')](_0xfc16('0x33'),_0x36075b['id']));break;}}else{return BPromise[_0xfc16('0x34')]()['then'](function(){if(!_0x36075b[_0xfc16('0x1c')]){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))](_0xfc16('0x1d'));}if(!_0x456478['sentiment']||!_0x456478[_0xfc16('0x25')]||!_0x456478[_0xfc16('0x1f')]||!_0x456478[_0xfc16('0x20')]||!_0x456478[_0xfc16('0x21')]){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))](_0xfc16('0x23'));}if(!_0x36075b['fileText']){throw new Error(_0xfc16('0x24'));}if(_0x456478[_0xfc16('0x25')]===_0x2dcd29['id']){return _0x2dcd29;}else{return db[_0xfc16('0x26')][_0xfc16('0x27')]({'where':{'id':_settings[_0xfc16('0x25')]}});}})[_0xfc16('0xe')](function(_0x5a6a8f){if(!_0x5a6a8f){throw new db['Sequelize'][(_0xfc16('0x22'))](_0xfc16('0x35'));}if(!_0x5a6a8f[_0xfc16('0xb')]||!_0x5a6a8f[_0xfc16('0xc')]){throw new db['Sequelize'][(_0xfc16('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x1384e2=_0x5a6a8f;logger[_0xfc16('0x1a')](util[_0xfc16('0x8')](_0xfc16('0x36'),_0x36075b['id']));return sentiment(_0x1384e2[_0xfc16('0xb')],_0x1384e2[_0xfc16('0xc')],_0x456478['sentimentRegion'],_0x36075b['fileText'],_0x456478['language']);})[_0xfc16('0xe')](function(_0x2e6673){logger['info'](util[_0xfc16('0x8')](_0xfc16('0x2a'),_0x36075b['id']));return _0x36075b[_0xfc16('0x19')]({'sentiment':_0x2e6673[_0xfc16('0x2b')],'sPositive':_0x2e6673[_0xfc16('0x2c')][_0xfc16('0x2d')],'sNegative':_0x2e6673[_0xfc16('0x2c')][_0xfc16('0x2e')],'sMixed':_0x2e6673[_0xfc16('0x2c')][_0xfc16('0x2f')],'sNeutral':_0x2e6673[_0xfc16('0x2c')][_0xfc16('0x30')],'transcribeStatus':_0xfc16('0x11')});})[_0xfc16('0xe')](function(){logger[_0xfc16('0x1a')](util['format'](_0xfc16('0x1b'),_0x36075b['id']));_0x18868b();});}})[_0xfc16('0x37')](function(_0x17d6d4){if(_0x17d6d4){if(!_0x17d6d4['name']||_0x17d6d4[_0xfc16('0x38')]!==_0xfc16('0x39')){logger[_0xfc16('0x3a')](util['format'](_0xfc16('0x3b'),_0x36075b['id']),util[_0xfc16('0x3c')](_0x17d6d4,{'showHidden':![],'depth':null}));}}_0x18868b();});});}function checkTranscribe(){var _0x3f2390;var _0x3baeea;var _0x5d1223;return db[_0xfc16('0x3d')]['findAll']({'where':{'transcribeStatus':_0xfc16('0x3e')}})[_0xfc16('0xe')](function(_0x295d3e){if(!_0x295d3e||!_0x295d3e['length']){throw new db[(_0xfc16('0x28'))]['ValidationError'](_0xfc16('0x3f'));}_0x3f2390=_0x295d3e;return db[_0xfc16('0x40')]['findOne']({'where':{'id':0x1}});})[_0xfc16('0xe')](function(_0x585bc0){if(!_0x585bc0){throw new db['Sequelize'][(_0xfc16('0x22'))](_0xfc16('0x41'));}_0x3baeea=_0x585bc0;if(!_0x3baeea[_0xfc16('0x42')]||!_0x3baeea[_0xfc16('0x43')]||!_0x3baeea['transcribeRegion']||!_0x3baeea[_0xfc16('0x20')]||!_0x3baeea[_0xfc16('0x21')]){throw new db[(_0xfc16('0x28'))]['ValidationError'](_0xfc16('0x44'));}return db['CloudProvider'][_0xfc16('0x27')]({'where':{'id':_0x3baeea['transcribeAccountId']}});})[_0xfc16('0xe')](function(_0x69e05d){if(!_0x69e05d){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x69e05d['data1']||!_0x69e05d[_0xfc16('0xc')]){throw new db[(_0xfc16('0x28'))][(_0xfc16('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x5d1223=_0x69e05d;var _0x5b1127=[];_0x3f2390[_0xfc16('0x45')](function(_0x36ec49){_0x5b1127['push'](checkTranscribeJob(_0x36ec49,_0x3baeea,_0x5d1223));});return BPromise['all'](_0x5b1127);})[_0xfc16('0x37')](function(_0x5d2955){if(_0x5d2955){if(!_0x5d2955[_0xfc16('0x38')]||_0x5d2955[_0xfc16('0x38')]!==_0xfc16('0x39')){logger[_0xfc16('0x3a')](util[_0xfc16('0x3c')](_0x5d2955,{'showHidden':![],'depth':null}));}}});}exports[_0xfc16('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 b514cda..f2673d4 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 _0x0075=['../../mysqldb','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment'];(function(_0x3c1cf4,_0x507534){var _0x4aea52=function(_0x11bf95){while(--_0x11bf95){_0x3c1cf4['push'](_0x3c1cf4['shift']());}};_0x4aea52(++_0x507534);}(_0x0075,0x150));var _0x5007=function(_0x5471cc,_0x5d1c30){_0x5471cc=_0x5471cc-0x0;var _0x41b1b6=_0x0075[_0x5471cc];return _0x41b1b6;};'use strict';var _=require(_0x5007('0x0'));var moment=require(_0x5007('0x1'));var Redis=require(_0x5007('0x2'));var util=require(_0x5007('0x3'));var config=require(_0x5007('0x4'));var db=require(_0x5007('0x5'))['db'];var logger=require('../logger')(_0x5007('0x6'));config[_0x5007('0x7')]=_[_0x5007('0x8')](config[_0x5007('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5007('0x9'))(new Redis(config[_0x5007('0x7')]));function closeInteractions(){var _0x588e9a=[];return db[_0x5007('0xa')][_0x5007('0xb')]({'raw':!![],'attributes':['id',_0x5007('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x5007('0xd'))}}})[_0x5007('0xe')](function(_0x3cf043){if(_0x3cf043&&_0x3cf043[_0x5007('0xf')]){_0x588e9a=_[_0x5007('0x10')](_0x3cf043||[],'id');logger[_0x5007('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x588e9a[_0x5007('0x12')]());return db['WhatsappInteraction'][_0x5007('0x13')]({'closeReason':_0x5007('0x14'),'disposition':_0x5007('0x15'),'closed':!![],'closedAt':moment()[_0x5007('0x16')](_0x5007('0x17'))},{'where':{'id':_0x588e9a}});}})[_0x5007('0xe')](function(){if(_0x588e9a&&_0x588e9a[_0x5007('0xf')]){logger[_0x5007('0x11')](_0x5007('0x18'),_0x588e9a[_0x5007('0x12')]());for(var _0x5e3bdd=0x0;_0x5e3bdd<_0x588e9a['length'];_0x5e3bdd++){io[_0x5007('0x19')](_0x5007('0x1a'),{'id':_0x588e9a[_0x5e3bdd],'closed':!![]});}}})[_0x5007('0x1b')](function(_0x3c5496){logger[_0x5007('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x3c5496?util[_0x5007('0x1d')](_0x3c5496,{'showHidden':![],'depth':null}):'');});}exports[_0x5007('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfbad=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','join','update','system'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfbad,0x129));var _0xdfba=function(_0x5d9f5c,_0x189d90){_0x5d9f5c=_0x5d9f5c-0x0;var _0x171fba=_0xfbad[_0x5d9f5c];return _0x171fba;};'use strict';var _=require(_0xdfba('0x0'));var moment=require(_0xdfba('0x1'));var Redis=require(_0xdfba('0x2'));var util=require(_0xdfba('0x3'));var config=require(_0xdfba('0x4'));var db=require(_0xdfba('0x5'))['db'];var logger=require(_0xdfba('0x6'))(_0xdfba('0x7'));config[_0xdfba('0x8')]=_[_0xdfba('0x9')](config[_0xdfba('0x8')],{'host':_0xdfba('0xa'),'port':0x18eb});var io=require(_0xdfba('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x1c94ea=[];return db[_0xdfba('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xdfba('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdfba('0xe')](0x18,_0xdfba('0xf'))}}})[_0xdfba('0x10')](function(_0x55cddb){if(_0x55cddb&&_0x55cddb[_0xdfba('0x11')]){_0x1c94ea=_[_0xdfba('0x12')](_0x55cddb||[],'id');logger[_0xdfba('0x13')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1c94ea[_0xdfba('0x14')]());return db[_0xdfba('0xc')][_0xdfba('0x15')]({'closeReason':_0xdfba('0x16'),'disposition':_0xdfba('0x17'),'closed':!![],'closedAt':moment()[_0xdfba('0x18')](_0xdfba('0x19'))},{'where':{'id':_0x1c94ea}});}})[_0xdfba('0x10')](function(){if(_0x1c94ea&&_0x1c94ea['length']){logger[_0xdfba('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1c94ea[_0xdfba('0x14')]());for(var _0x5bdacf=0x0;_0x5bdacf<_0x1c94ea[_0xdfba('0x11')];_0x5bdacf++){io[_0xdfba('0x1a')](_0xdfba('0x1b'),{'id':_0x1c94ea[_0x5bdacf],'closed':!![]});}}})[_0xdfba('0x1c')](function(_0x5a53a0){logger[_0xdfba('0x1d')](_0xdfba('0x1e'),_0x5a53a0?util['inspect'](_0x5a53a0,{'showHidden':![],'depth':null}):'');});}exports[_0xdfba('0x1f')]=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 47ce554..9a27e84 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bdb=['bulkCreate','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','now','push','@xcally.com','CmContact','then','log','finished\x20populating','contacts1','CmHopper','destroy'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x3bdb,0x89));var _0xb3bd=function(_0x507560,_0x2ec237){_0x507560=_0x507560-0x0;var _0x68c41a=_0x3bdb[_0x507560];return _0x68c41a;};'use strict';var util=require(_0xb3bd('0x0'));var db=require(_0xb3bd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb3bd('0x2')+i,'lastName':_0xb3bd('0x3')+i,'phone':0xf879fb460+i,'email':_0xb3bd('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb3bd('0x5')](),'updatedAt':Date[_0xb3bd('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb3bd('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb3bd('0x4')+i+_0xb3bd('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb3bd('0x5')](),'updatedAt':Date['now']()});}db[_0xb3bd('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0xb3bd('0x8')]['bulkCreate'](contacts);})[_0xb3bd('0x9')](function(){console[_0xb3bd('0xa')](_0xb3bd('0xb'),_0xb3bd('0xc'));return db[_0xb3bd('0xd')][_0xb3bd('0xe')]({'where':{}});})[_0xb3bd('0x9')](function(){return db['CmHopper'][_0xb3bd('0xf')](hopper);})[_0xb3bd('0x9')](function(){console[_0xb3bd('0xa')](_0xb3bd('0xb'),'hopper1');return db[_0xb3bd('0x8')]['bulkCreate'](contacts2);})[_0xb3bd('0x9')](function(){console[_0xb3bd('0xa')](_0xb3bd('0xb'),_0xb3bd('0x10'));return db[_0xb3bd('0xd')][_0xb3bd('0xf')](hopper2);})[_0xb3bd('0x9')](function(){console[_0xb3bd('0xa')]('finished\x20populating',_0xb3bd('0x11'));})[_0xb3bd('0x12')](function(_0x423f23){console[_0xb3bd('0xa')](_0x423f23);}); \ No newline at end of file +var _0xfb7c=['catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','CmContact','bulkCreate','then','contacts1','CmHopper','finished\x20populating','hopper1','log','contacts2','hopper2'];(function(_0xbe7320,_0x106a76){var _0x43f0a9=function(_0x1ecd82){while(--_0x1ecd82){_0xbe7320['push'](_0xbe7320['shift']());}};_0x43f0a9(++_0x106a76);}(_0xfb7c,0x1b9));var _0xcfb7=function(_0x4b91ef,_0x243df2){_0x4b91ef=_0x4b91ef-0x0;var _0x397cd0=_0xfb7c[_0x4b91ef];return _0x397cd0;};'use strict';var util=require(_0xcfb7('0x0'));var db=require(_0xcfb7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xcfb7('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xcfb7('0x3')+i,'phone':0xf879fb460+i,'email':_0xcfb7('0x4')+i+_0xcfb7('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xcfb7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcfb7('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xcfb7('0x2')]({'id':i,'firstName':_0xcfb7('0x7')+i,'lastName':_0xcfb7('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xcfb7('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xcfb7('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xcfb7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcfb7('0x6')](),'updatedAt':Date[_0xcfb7('0x6')]()});}db['CmContact'][_0xcfb7('0x8')]({'where':{}})['then'](function(){return db[_0xcfb7('0x9')][_0xcfb7('0xa')](contacts);})[_0xcfb7('0xb')](function(){console['log']('finished\x20populating',_0xcfb7('0xc'));return db[_0xcfb7('0xd')][_0xcfb7('0x8')]({'where':{}});})[_0xcfb7('0xb')](function(){return db['CmHopper'][_0xcfb7('0xa')](hopper);})[_0xcfb7('0xb')](function(){console['log'](_0xcfb7('0xe'),_0xcfb7('0xf'));return db[_0xcfb7('0x9')][_0xcfb7('0xa')](contacts2);})[_0xcfb7('0xb')](function(){console[_0xcfb7('0x10')](_0xcfb7('0xe'),_0xcfb7('0x11'));return db[_0xcfb7('0xd')][_0xcfb7('0xa')](hopper2);})[_0xcfb7('0xb')](function(){console[_0xcfb7('0x10')](_0xcfb7('0xe'),_0xcfb7('0x12'));})[_0xcfb7('0x13')](function(_0xd9db10){console[_0xcfb7('0x10')](_0xd9db10);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index afe0204..83faade 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30ff=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','ulaw','yes'];(function(_0x4064a5,_0x15662d){var _0xf7b4f0=function(_0x224d89){while(--_0x224d89){_0x4064a5['push'](_0x4064a5['shift']());}};_0xf7b4f0(++_0x15662d);}(_0x30ff,0x14b));var _0xf30f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x30ff[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xf30f('0x0'));var db=require(_0xf30f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf30f('0x2')]({'name':util[_0xf30f('0x3')](_0xf30f('0x4'),_0xf30f('0x5'),i),'fullname':util['format']('%s%s',_0xf30f('0x5'),i),'email':util[_0xf30f('0x3')](_0xf30f('0x6'),_0xf30f('0x5'),i),'role':_0xf30f('0x5'),'password':'password','internal':0xfa0+i,'type':_0xf30f('0x7'),'transport':[_0xf30f('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0xf30f('0x9')],'defaultuser':util[_0xf30f('0x3')]('%s%s','agent',i),'encryption':_0xf30f('0xa'),'avpf':_0xf30f('0xa'),'force_avp':_0xf30f('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf30f('0xb'),'dtlssetup':_0xf30f('0xc'),'callerid':util['format'](_0xf30f('0xd'),util[_0xf30f('0x3')](_0xf30f('0x4'),_0xf30f('0x5'),i),0xfa0+i)});}db[_0xf30f('0xe')]['bulkCreate'](users)[_0xf30f('0xf')](function(){console[_0xf30f('0x10')](_0xf30f('0x11'));})[_0xf30f('0x12')](function(_0x4af259){console['log'](_0x4af259);}); \ No newline at end of file +var _0x220a=['../mysqldb','format','%s%s','agent','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch'];(function(_0x59a40c,_0x35999f){var _0x3cf340=function(_0x3d2c47){while(--_0x3d2c47){_0x59a40c['push'](_0x59a40c['shift']());}};_0x3cf340(++_0x35999f);}(_0x220a,0x144));var _0xa220=function(_0x467e52,_0x33222f){_0x467e52=_0x467e52-0x0;var _0x5ad69c=_0x220a[_0x467e52];return _0x5ad69c;};'use strict';var util=require('util');var db=require(_0xa220('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xa220('0x1')](_0xa220('0x2'),'agent',i),'fullname':util[_0xa220('0x1')](_0xa220('0x2'),_0xa220('0x3'),i),'email':util[_0xa220('0x1')]('%s%s@xcally.com',_0xa220('0x3'),i),'role':_0xa220('0x3'),'password':'password','internal':0xfa0+i,'type':_0xa220('0x4'),'transport':[_0xa220('0x5'),'ws',_0xa220('0x6')],'disallow':['all'],'allow':[_0xa220('0x7')],'defaultuser':util[_0xa220('0x1')](_0xa220('0x2'),_0xa220('0x3'),i),'encryption':_0xa220('0x8'),'avpf':_0xa220('0x8'),'force_avp':_0xa220('0x8'),'icesupport':_0xa220('0x8'),'dtlsenable':_0xa220('0x8'),'dtlsverify':'no','dtlscertfile':_0xa220('0x9'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xa220('0xa'),'callerid':util[_0xa220('0x1')](_0xa220('0xb'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xa220('0xc')][_0xa220('0xd')](users)[_0xa220('0xe')](function(){console[_0xa220('0xf')](_0xa220('0x10'));})[_0xa220('0x11')](function(_0x58adab){console[_0xa220('0xf')](_0x58adab);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cd31275..9f05c80 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4f8=['getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','setMaxListeners','address','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','map','User','where','role','Campaign','%s:queue:%s','length','format','user:%s','query','find','userProfileId','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','MailQueues','IvrCampaigns','voice:outbound'];(function(_0x2771fa,_0xedd90c){var _0x3695be=function(_0x4cdedc){while(--_0x4cdedc){_0x2771fa['push'](_0x2771fa['shift']());}};_0x3695be(++_0xedd90c);}(_0xb4f8,0x83));var _0x8b4f=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xb4f8[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var BPromise=require(_0x8b4f('0x1'));var db=require(_0x8b4f('0x2'))['db'];var config=require(_0x8b4f('0x3'));var queryQueues={'attributes':['id',_0x8b4f('0x4')],'include':[{'as':_0x8b4f('0x5'),'model':db['User'],'attributes':['id',_0x8b4f('0x4'),'role'],'raw':!![],'where':{'role':_0x8b4f('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8b4f('0x4')],'where':{'role':_0x8b4f('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8b4f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x8b4f('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8b4f('0x4'),_0x8b4f('0x8')],'where':{'type':_0x8b4f('0x9')}};function getAssociatedResources(_0x58c0db,_0x382038,_0x13d37a){return db[_0x8b4f('0xa')][_0x8b4f('0xb')]({'where':{'name':_0x58c0db,'userProfileId':_0x382038},'raw':!![]})[_0x8b4f('0xc')](function(_0x499db2){if(_0x499db2){if(_0x499db2[_0x8b4f('0xd')]){switch(_0x58c0db){case _0x8b4f('0xe'):case'ChatQueues':case _0x8b4f('0xf'):case _0x8b4f('0x10'):case'MailQueues':case _0x8b4f('0x11'):case _0x8b4f('0x12'):return db[_0x13d37a]['findAll'](queryQueues);case _0x8b4f('0x13'):return db[_0x13d37a][_0x8b4f('0x14')](queryTelephones);case _0x8b4f('0x15'):return db[_0x13d37a][_0x8b4f('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x13d37a][_0x8b4f('0x14')](queryCampaigns);}}else{return db[_0x8b4f('0x16')][_0x8b4f('0x14')]({'attributes':[_0x8b4f('0x17')],'where':{'sectionId':_0x499db2['id']},'raw':!![]})[_0x8b4f('0xc')](function(_0x181153){if(_0x181153){var _0x59311c={'where':{'id':_[_0x8b4f('0x18')](_0x181153,_0x8b4f('0x17'))},'raw':!![]};switch(_0x13d37a){case _0x8b4f('0x19'):_0x59311c[_0x8b4f('0x1a')][_0x8b4f('0x1b')]=_0x8b4f('0x7');break;case _0x8b4f('0x1c'):_0x59311c['where'][_0x8b4f('0x8')]=_0x8b4f('0x9');break;}return db[_0x13d37a][_0x8b4f('0x14')](_0x59311c);}else{return[];}});}}else{return[];}})[_0x8b4f('0xc')](function(_0x4e09ab){return _0x4e09ab;});}function joinOrLeaveQueues(_0xca93c9,_0x48aaaf,_0x39c8d4,_0x3eb2b0){_0xca93c9[_0x48aaaf](util['format'](_0x8b4f('0x1d'),_0x39c8d4,_0x3eb2b0['name']));if(_0x3eb2b0['Agents']){for(var _0x4b85fe=0x0;_0x4b85fe<_0x3eb2b0[_0x8b4f('0x5')][_0x8b4f('0x1e')];_0x4b85fe+=0x1){_0xca93c9[_0x48aaaf](util[_0x8b4f('0x1f')](_0x8b4f('0x20'),_0x3eb2b0['Agents'][_0x4b85fe][_0x8b4f('0x4')]));}}}function joinOrLeave(_0x3571e6,_0x31934a,_0x137db8){var _0x28df19;if(_0x3571e6['handshake'][_0x8b4f('0x21')]['id']){db[_0x8b4f('0x19')][_0x8b4f('0x22')]({'attributes':['id',_0x8b4f('0x4'),'role',_0x8b4f('0x23')],'where':{'id':_0x3571e6['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8b4f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8b4f('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8b4f('0x26')],'as':_0x8b4f('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8b4f('0x28')],'as':_0x8b4f('0x29'),'attributes':['id'],'raw':!![]}]})[_0x8b4f('0xc')](function(_0x44b7f6){if(_0x44b7f6){_0x28df19=_0x44b7f6;_0x3571e6[_0x31934a](util[_0x8b4f('0x1f')](_0x8b4f('0x20'),_0x44b7f6[_0x8b4f('0x4')]));var _0xe56f25=[];switch(_0x44b7f6[_0x8b4f('0x1b')]){case'admin':_0x3571e6[_0x31934a](_0x8b4f('0x2a'));_0x3571e6[_0x31934a]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x8b4f('0x2b'))){delete queryQueues[_0x8b4f('0x2b')];}_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x2d')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db['ChatQueue'][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x2e')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x2f')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x30')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x31')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x32')][_0x8b4f('0x14')](queryQueues));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x19')][_0x8b4f('0x14')](queryTelephones));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x33')][_0x8b4f('0x14')](queryTrunks));_0xe56f25['push'](db[_0x8b4f('0x1c')][_0x8b4f('0x14')](queryCampaigns));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x19')][_0x8b4f('0x14')](queryAgents));break;case _0x8b4f('0x34'):_0x3571e6[_0x31934a]('voice:inbound');_0x3571e6[_0x31934a]('voice:outbound');_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources('VoiceQueues',_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x2d')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x35'),_0x44b7f6['userProfileId'],'ChatQueue'));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0xf'),_0x44b7f6['userProfileId'],_0x8b4f('0x2e')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x10'),_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x2f')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x36'),_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x30')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x11'),_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x31')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x12'),_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x32')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x13'),_0x44b7f6[_0x8b4f('0x23')],'User'));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x15'),_0x44b7f6[_0x8b4f('0x23')],_0x8b4f('0x33')));_0xe56f25[_0x8b4f('0x2c')](getAssociatedResources(_0x8b4f('0x37'),_0x44b7f6[_0x8b4f('0x23')],'Campaign'));_0xe56f25[_0x8b4f('0x2c')](db[_0x8b4f('0x19')]['findAll'](queryAgents));break;case _0x8b4f('0x6'):_0x3571e6[_0x31934a](_0x8b4f('0x2a'));_0x3571e6[_0x31934a](_0x8b4f('0x38'));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6[_0x8b4f('0x39')]({'attributes':['id',_0x8b4f('0x4')]}));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6[_0x8b4f('0x3a')]({'attributes':['id',_0x8b4f('0x4')]}));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6[_0x8b4f('0x3b')]({'attributes':['id','name']}));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6[_0x8b4f('0x3c')]({'attributes':['id',_0x8b4f('0x4')]}));_0xe56f25['push'](_0x44b7f6['getMailQueues']({'attributes':['id',_0x8b4f('0x4')]}));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6['getOpenchannelQueues']({'attributes':['id',_0x8b4f('0x4')]}));_0xe56f25[_0x8b4f('0x2c')](_0x44b7f6[_0x8b4f('0x3d')]({'attributes':['id',_0x8b4f('0x4')]}));break;}return BPromise[_0x8b4f('0x3e')](_0xe56f25);}})[_0x8b4f('0xc')](function(_0x24e04c){if(_0x24e04c&&_0x24e04c[_0x8b4f('0x1e')]){for(var _0x1b2705=0x0;_0x1b2705<_0x24e04c[_0x8b4f('0x1e')];_0x1b2705+=0x1){for(var _0x3db152=0x0;_0x3db152<_0x24e04c[_0x1b2705][_0x8b4f('0x1e')];_0x3db152+=0x1){switch(_0x1b2705){case 0x0:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x3f'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x1:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x40'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x2:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x41'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x3:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x42'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x4:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x43'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x5:joinOrLeaveQueues(_0x3571e6,_0x31934a,_0x8b4f('0x44'),_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x6:joinOrLeaveQueues(_0x3571e6,_0x31934a,'whatsapp',_0x24e04c[_0x1b2705][_0x3db152]);break;case 0x7:if(_0x28df19[_0x8b4f('0x1b')]!==_0x8b4f('0x6'))_0x3571e6[_0x31934a](util['format']('telephone:%s',_0x24e04c[_0x1b2705][_0x3db152][_0x8b4f('0x4')]));break;case 0x8:if(_0x28df19[_0x8b4f('0x1b')]!==_0x8b4f('0x6'))_0x3571e6[_0x31934a](util[_0x8b4f('0x1f')]('trunk:%s',_0x24e04c[_0x1b2705][_0x3db152][_0x8b4f('0x4')]));break;case 0x9:if(_0x28df19['role']!==_0x8b4f('0x6'))_0x3571e6[_0x31934a](util[_0x8b4f('0x1f')](_0x8b4f('0x45'),_0x24e04c[_0x1b2705][_0x3db152][_0x8b4f('0x8')],_0x24e04c[_0x1b2705][_0x3db152][_0x8b4f('0x4')]));break;case 0xa:_0x3571e6[_0x31934a](util['format'](_0x8b4f('0x20'),_0x24e04c[_0x1b2705][_0x3db152]['name']));break;}}}}})[_0x8b4f('0xc')](function(){if(_0x31934a==='leave'){var _0x276698=_[_0x8b4f('0x18')](_0x28df19['ChatInteractions'],'id');return _0x28df19[_0x8b4f('0x46')](_0x276698)[_0x8b4f('0xc')](function(){for(var _0x150667=0x0;_0x150667<_0x276698[_0x8b4f('0x1e')];_0x150667+=0x1){_0x137db8[_0x8b4f('0x47')](_0x8b4f('0x48'),{'ChatInteractionId':Number(_0x276698[_0x150667]),'UserId':Number(_0x28df19['id'])});}});}})['then'](function(){if(_0x31934a===_0x8b4f('0x49')){var _0x337cb6=_[_0x8b4f('0x18')](_0x28df19[_0x8b4f('0x4a')],'id');return _0x28df19['removeMailInteractions'](_0x337cb6)[_0x8b4f('0xc')](function(){for(var _0x1c1e21=0x0;_0x1c1e21<_0x337cb6[_0x8b4f('0x1e')];_0x1c1e21+=0x1){_0x137db8[_0x8b4f('0x47')](_0x8b4f('0x4b'),{'MailInteractionId':Number(_0x337cb6[_0x1c1e21]),'UserId':Number(_0x28df19['id'])});}});}})[_0x8b4f('0xc')](function(){if(_0x31934a===_0x8b4f('0x49')){var _0x47b816=_[_0x8b4f('0x18')](_0x28df19[_0x8b4f('0x24')],'id');return _0x28df19[_0x8b4f('0x4c')](_0x47b816)['then'](function(){for(var _0x5aa01f=0x0;_0x5aa01f<_0x47b816[_0x8b4f('0x1e')];_0x5aa01f+=0x1){_0x137db8['emit'](_0x8b4f('0x4d'),{'FaxInteractionId':Number(_0x47b816[_0x5aa01f]),'UserId':Number(_0x28df19['id'])});}});}})[_0x8b4f('0xc')](function(){if(_0x31934a==='leave'){var _0x1ddace=_[_0x8b4f('0x18')](_0x28df19[_0x8b4f('0x4e')],'id');return _0x28df19['removeSmsInteractions'](_0x1ddace)[_0x8b4f('0xc')](function(){for(var _0x2d3bad=0x0;_0x2d3bad<_0x1ddace[_0x8b4f('0x1e')];_0x2d3bad+=0x1){_0x137db8[_0x8b4f('0x47')](_0x8b4f('0x4f'),{'SmsInteractionId':Number(_0x1ddace[_0x2d3bad]),'UserId':Number(_0x28df19['id'])});}});}})[_0x8b4f('0xc')](function(){if(_0x31934a===_0x8b4f('0x49')){var _0x50e639=_[_0x8b4f('0x18')](_0x28df19[_0x8b4f('0x27')],'id');return _0x28df19[_0x8b4f('0x50')](_0x50e639)[_0x8b4f('0xc')](function(){for(var _0x16689a=0x0;_0x16689a<_0x50e639[_0x8b4f('0x1e')];_0x16689a+=0x1){_0x137db8[_0x8b4f('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x50e639[_0x16689a]),'UserId':Number(_0x28df19['id'])});}});}})[_0x8b4f('0xc')](function(){if(_0x31934a===_0x8b4f('0x49')){var _0x1dd5aa=_[_0x8b4f('0x18')](_0x28df19[_0x8b4f('0x29')],'id');return _0x28df19[_0x8b4f('0x51')](_0x1dd5aa)[_0x8b4f('0xc')](function(){for(var _0x1ee952=0x0;_0x1ee952<_0x1dd5aa['length'];_0x1ee952+=0x1){_0x137db8['emit'](_0x8b4f('0x52'),{'WhatsappInteractionId':Number(_0x1dd5aa[_0x1ee952]),'UserId':Number(_0x28df19['id'])});}});}})['catch'](function(_0x4c129c){_0x3571e6[_0x8b4f('0x53')](_0x4c129c);});}}function onDisconnect(_0x129526,_0x39c822){joinOrLeave(_0x129526,_0x8b4f('0x49'),_0x39c822);}function onConnect(_0x186321){joinOrLeave(_0x186321,_0x8b4f('0x54'));}exports[_0x8b4f('0x55')]=function(_0x2c7f9f){_0x2c7f9f['on']('connection',function(_0x5cf55b){_0x5cf55b[_0x8b4f('0x56')](0x0);_0x5cf55b[_0x8b4f('0x57')]=_0x5cf55b['request']['connection'][_0x8b4f('0x58')]+':'+_0x5cf55b['request']['connection'][_0x8b4f('0x59')];_0x5cf55b['connectedAt']=new Date();_0x5cf55b[_0x8b4f('0x53')]=function(_0x42e514){console[_0x8b4f('0x53')](_0x8b4f('0x5a')+_0x5cf55b['nsp'][_0x8b4f('0x4')]+'['+_0x5cf55b[_0x8b4f('0x57')]+']',_0x42e514);};_0x5cf55b['on'](_0x8b4f('0x5b'),function(){onDisconnect(_0x5cf55b,_0x2c7f9f);_0x5cf55b['log'](_0x8b4f('0x5c'));});onConnect(_0x5cf55b);_0x5cf55b[_0x8b4f('0x53')](_0x8b4f('0x5d'));});}; \ No newline at end of file +var _0xed65=['WhatsappInteraction','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','userProfileId','FaxQueue','WhatsappQueues','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','leave','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','format','%s:queue:%s','Agents','length','user:%s','handshake','find','query','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions'];(function(_0x358e0b,_0x22f7ee){var _0x486438=function(_0x59bacc){while(--_0x59bacc){_0x358e0b['push'](_0x358e0b['shift']());}};_0x486438(++_0x22f7ee);}(_0xed65,0xa1));var _0x5ed6=function(_0x915de9,_0xabf9e5){_0x915de9=_0x915de9-0x0;var _0x274129=_0xed65[_0x915de9];return _0x274129;};'use strict';var _=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var BPromise=require(_0x5ed6('0x2'));var db=require(_0x5ed6('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x5ed6('0x4')],'include':[{'as':'Agents','model':db[_0x5ed6('0x5')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x5ed6('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5ed6('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5ed6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x5ed6('0x4')],'where':{'role':_0x5ed6('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5ed6('0x4'),_0x5ed6('0x8')],'where':{'type':_0x5ed6('0x9')}};function getAssociatedResources(_0x1f04bb,_0x5b9df4,_0x277dde){return db[_0x5ed6('0xa')][_0x5ed6('0xb')]({'where':{'name':_0x1f04bb,'userProfileId':_0x5b9df4},'raw':!![]})[_0x5ed6('0xc')](function(_0x29963c){if(_0x29963c){if(_0x29963c[_0x5ed6('0xd')]){switch(_0x1f04bb){case _0x5ed6('0xe'):case _0x5ed6('0xf'):case _0x5ed6('0x10'):case _0x5ed6('0x11'):case _0x5ed6('0x12'):case _0x5ed6('0x13'):case'WhatsappQueues':return db[_0x277dde][_0x5ed6('0x14')](queryQueues);case _0x5ed6('0x15'):return db[_0x277dde][_0x5ed6('0x14')](queryTelephones);case _0x5ed6('0x16'):return db[_0x277dde][_0x5ed6('0x14')](queryTrunks);case _0x5ed6('0x17'):return db[_0x277dde][_0x5ed6('0x14')](queryCampaigns);}}else{return db[_0x5ed6('0x18')][_0x5ed6('0x14')]({'attributes':[_0x5ed6('0x19')],'where':{'sectionId':_0x29963c['id']},'raw':!![]})[_0x5ed6('0xc')](function(_0x290f17){if(_0x290f17){var _0x3b0265={'where':{'id':_[_0x5ed6('0x1a')](_0x290f17,_0x5ed6('0x19'))},'raw':!![]};switch(_0x277dde){case _0x5ed6('0x5'):_0x3b0265['where'][_0x5ed6('0x1b')]=_0x5ed6('0x7');break;case _0x5ed6('0x1c'):_0x3b0265[_0x5ed6('0x1d')][_0x5ed6('0x8')]=_0x5ed6('0x9');break;}return db[_0x277dde][_0x5ed6('0x14')](_0x3b0265);}else{return[];}});}}else{return[];}})[_0x5ed6('0xc')](function(_0x587eaa){return _0x587eaa;});}function joinOrLeaveQueues(_0x4219c9,_0x374fc9,_0x1bbad6,_0xe4a883){_0x4219c9[_0x374fc9](util[_0x5ed6('0x1e')](_0x5ed6('0x1f'),_0x1bbad6,_0xe4a883[_0x5ed6('0x4')]));if(_0xe4a883['Agents']){for(var _0x139bd0=0x0;_0x139bd0<_0xe4a883[_0x5ed6('0x20')][_0x5ed6('0x21')];_0x139bd0+=0x1){_0x4219c9[_0x374fc9](util[_0x5ed6('0x1e')](_0x5ed6('0x22'),_0xe4a883[_0x5ed6('0x20')][_0x139bd0][_0x5ed6('0x4')]));}}}function joinOrLeave(_0x24ad7f,_0x4077c5,_0xd5ead6){var _0x4f0a01;if(_0x24ad7f[_0x5ed6('0x23')]['query']['id']){db[_0x5ed6('0x5')][_0x5ed6('0x24')]({'attributes':['id',_0x5ed6('0x4'),_0x5ed6('0x1b'),'userProfileId'],'where':{'id':_0x24ad7f['handshake'][_0x5ed6('0x25')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x5ed6('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5ed6('0x27')],'as':_0x5ed6('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x5ed6('0x29')],'as':_0x5ed6('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5ed6('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x5ed6('0xc')](function(_0x1dd2f5){if(_0x1dd2f5){_0x4f0a01=_0x1dd2f5;_0x24ad7f[_0x4077c5](util[_0x5ed6('0x1e')](_0x5ed6('0x22'),_0x1dd2f5[_0x5ed6('0x4')]));var _0x1be45a=[];switch(_0x1dd2f5['role']){case _0x5ed6('0x2c'):_0x24ad7f[_0x4077c5]('voice:inbound');_0x24ad7f[_0x4077c5]('voice:outbound');if(queryQueues[_0x5ed6('0x2d')](_0x5ed6('0x2e'))){delete queryQueues['include'];}_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x30')][_0x5ed6('0x14')](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x31')][_0x5ed6('0x14')](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db['FaxQueue'][_0x5ed6('0x14')](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x32')][_0x5ed6('0x14')](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x33')][_0x5ed6('0x14')](queryQueues));_0x1be45a['push'](db[_0x5ed6('0x34')][_0x5ed6('0x14')](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x35')]['findAll'](queryQueues));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x5')][_0x5ed6('0x14')](queryTelephones));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x36')][_0x5ed6('0x14')](queryTrunks));_0x1be45a[_0x5ed6('0x2f')](db['Campaign'][_0x5ed6('0x14')](queryCampaigns));_0x1be45a['push'](db[_0x5ed6('0x5')]['findAll'](queryAgents));break;case'user':_0x24ad7f[_0x4077c5](_0x5ed6('0x37'));_0x24ad7f[_0x4077c5]('voice:outbound');_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources('VoiceQueues',_0x1dd2f5[_0x5ed6('0x38')],_0x5ed6('0x30')));_0x1be45a['push'](getAssociatedResources(_0x5ed6('0xf'),_0x1dd2f5[_0x5ed6('0x38')],_0x5ed6('0x31')));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources(_0x5ed6('0x10'),_0x1dd2f5['userProfileId'],_0x5ed6('0x39')));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources(_0x5ed6('0x11'),_0x1dd2f5[_0x5ed6('0x38')],_0x5ed6('0x32')));_0x1be45a['push'](getAssociatedResources(_0x5ed6('0x12'),_0x1dd2f5[_0x5ed6('0x38')],'MailQueue'));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources(_0x5ed6('0x13'),_0x1dd2f5['userProfileId'],_0x5ed6('0x34')));_0x1be45a['push'](getAssociatedResources(_0x5ed6('0x3a'),_0x1dd2f5[_0x5ed6('0x38')],_0x5ed6('0x35')));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources(_0x5ed6('0x15'),_0x1dd2f5[_0x5ed6('0x38')],'User'));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources(_0x5ed6('0x16'),_0x1dd2f5[_0x5ed6('0x38')],'Trunk'));_0x1be45a[_0x5ed6('0x2f')](getAssociatedResources('IvrCampaigns',_0x1dd2f5[_0x5ed6('0x38')],_0x5ed6('0x1c')));_0x1be45a[_0x5ed6('0x2f')](db[_0x5ed6('0x5')][_0x5ed6('0x14')](queryAgents));break;case _0x5ed6('0x6'):_0x24ad7f[_0x4077c5](_0x5ed6('0x37'));_0x24ad7f[_0x4077c5](_0x5ed6('0x3b'));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x3c')]({'attributes':['id','name']}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x3d')]({'attributes':['id','name']}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x3e')]({'attributes':['id',_0x5ed6('0x4')]}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x3f')]({'attributes':['id',_0x5ed6('0x4')]}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x40')]({'attributes':['id',_0x5ed6('0x4')]}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x41')]({'attributes':['id',_0x5ed6('0x4')]}));_0x1be45a[_0x5ed6('0x2f')](_0x1dd2f5[_0x5ed6('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x5ed6('0x43')](_0x1be45a);}})['then'](function(_0x511e3b){if(_0x511e3b&&_0x511e3b['length']){for(var _0x3dcf02=0x0;_0x3dcf02<_0x511e3b[_0x5ed6('0x21')];_0x3dcf02+=0x1){for(var _0x284c65=0x0;_0x284c65<_0x511e3b[_0x3dcf02][_0x5ed6('0x21')];_0x284c65+=0x1){switch(_0x3dcf02){case 0x0:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,_0x5ed6('0x44'),_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x1:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,_0x5ed6('0x45'),_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x2:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,_0x5ed6('0x46'),_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x3:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,'sms',_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x4:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,_0x5ed6('0x47'),_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x5:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,_0x5ed6('0x48'),_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x6:joinOrLeaveQueues(_0x24ad7f,_0x4077c5,'whatsapp',_0x511e3b[_0x3dcf02][_0x284c65]);break;case 0x7:if(_0x4f0a01['role']!==_0x5ed6('0x6'))_0x24ad7f[_0x4077c5](util[_0x5ed6('0x1e')](_0x5ed6('0x49'),_0x511e3b[_0x3dcf02][_0x284c65][_0x5ed6('0x4')]));break;case 0x8:if(_0x4f0a01['role']!==_0x5ed6('0x6'))_0x24ad7f[_0x4077c5](util['format'](_0x5ed6('0x4a'),_0x511e3b[_0x3dcf02][_0x284c65]['name']));break;case 0x9:if(_0x4f0a01[_0x5ed6('0x1b')]!=='agent')_0x24ad7f[_0x4077c5](util[_0x5ed6('0x1e')](_0x5ed6('0x4b'),_0x511e3b[_0x3dcf02][_0x284c65]['type'],_0x511e3b[_0x3dcf02][_0x284c65][_0x5ed6('0x4')]));break;case 0xa:_0x24ad7f[_0x4077c5](util['format'](_0x5ed6('0x22'),_0x511e3b[_0x3dcf02][_0x284c65][_0x5ed6('0x4')]));break;}}}}})[_0x5ed6('0xc')](function(){if(_0x4077c5==='leave'){var _0x4dcb6c=_[_0x5ed6('0x1a')](_0x4f0a01[_0x5ed6('0x4c')],'id');return _0x4f0a01[_0x5ed6('0x4d')](_0x4dcb6c)['then'](function(){for(var _0x22f3ed=0x0;_0x22f3ed<_0x4dcb6c[_0x5ed6('0x21')];_0x22f3ed+=0x1){_0xd5ead6['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4dcb6c[_0x22f3ed]),'UserId':Number(_0x4f0a01['id'])});}});}})[_0x5ed6('0xc')](function(){if(_0x4077c5==='leave'){var _0x50d458=_[_0x5ed6('0x1a')](_0x4f0a01[_0x5ed6('0x26')],'id');return _0x4f0a01['removeMailInteractions'](_0x50d458)['then'](function(){for(var _0x370669=0x0;_0x370669<_0x50d458[_0x5ed6('0x21')];_0x370669+=0x1){_0xd5ead6[_0x5ed6('0x4e')](_0x5ed6('0x4f'),{'MailInteractionId':Number(_0x50d458[_0x370669]),'UserId':Number(_0x4f0a01['id'])});}});}})[_0x5ed6('0xc')](function(){if(_0x4077c5==='leave'){var _0x435b33=_[_0x5ed6('0x1a')](_0x4f0a01[_0x5ed6('0x50')],'id');return _0x4f0a01[_0x5ed6('0x51')](_0x435b33)[_0x5ed6('0xc')](function(){for(var _0x228b5d=0x0;_0x228b5d<_0x435b33[_0x5ed6('0x21')];_0x228b5d+=0x1){_0xd5ead6[_0x5ed6('0x4e')](_0x5ed6('0x52'),{'FaxInteractionId':Number(_0x435b33[_0x228b5d]),'UserId':Number(_0x4f0a01['id'])});}});}})['then'](function(){if(_0x4077c5===_0x5ed6('0x53')){var _0x12437d=_[_0x5ed6('0x1a')](_0x4f0a01[_0x5ed6('0x28')],'id');return _0x4f0a01[_0x5ed6('0x54')](_0x12437d)[_0x5ed6('0xc')](function(){for(var _0x3f78eb=0x0;_0x3f78eb<_0x12437d[_0x5ed6('0x21')];_0x3f78eb+=0x1){_0xd5ead6[_0x5ed6('0x4e')](_0x5ed6('0x55'),{'SmsInteractionId':Number(_0x12437d[_0x3f78eb]),'UserId':Number(_0x4f0a01['id'])});}});}})[_0x5ed6('0xc')](function(){if(_0x4077c5===_0x5ed6('0x53')){var _0x2512d5=_[_0x5ed6('0x1a')](_0x4f0a01['OpenchannelInteractions'],'id');return _0x4f0a01[_0x5ed6('0x56')](_0x2512d5)[_0x5ed6('0xc')](function(){for(var _0x4fea77=0x0;_0x4fea77<_0x2512d5['length'];_0x4fea77+=0x1){_0xd5ead6[_0x5ed6('0x4e')](_0x5ed6('0x57'),{'OpenchannelInteractionId':Number(_0x2512d5[_0x4fea77]),'UserId':Number(_0x4f0a01['id'])});}});}})[_0x5ed6('0xc')](function(){if(_0x4077c5==='leave'){var _0x12558e=_[_0x5ed6('0x1a')](_0x4f0a01[_0x5ed6('0x58')],'id');return _0x4f0a01[_0x5ed6('0x59')](_0x12558e)[_0x5ed6('0xc')](function(){for(var _0x4b8c77=0x0;_0x4b8c77<_0x12558e[_0x5ed6('0x21')];_0x4b8c77+=0x1){_0xd5ead6['emit'](_0x5ed6('0x5a'),{'WhatsappInteractionId':Number(_0x12558e[_0x4b8c77]),'UserId':Number(_0x4f0a01['id'])});}});}})['catch'](function(_0x357f97){_0x24ad7f[_0x5ed6('0x5b')](_0x357f97);});}}function onDisconnect(_0x45b31a,_0x19ed98){joinOrLeave(_0x45b31a,_0x5ed6('0x53'),_0x19ed98);}function onConnect(_0x4a7314){joinOrLeave(_0x4a7314,_0x5ed6('0x5c'));}exports['default']=function(_0xa15cc7){_0xa15cc7['on'](_0x5ed6('0x5d'),function(_0x3e78b5){_0x3e78b5[_0x5ed6('0x5e')](0x0);_0x3e78b5[_0x5ed6('0x5f')]=_0x3e78b5[_0x5ed6('0x60')][_0x5ed6('0x5d')][_0x5ed6('0x61')]+':'+_0x3e78b5[_0x5ed6('0x60')][_0x5ed6('0x5d')][_0x5ed6('0x62')];_0x3e78b5[_0x5ed6('0x63')]=new Date();_0x3e78b5[_0x5ed6('0x5b')]=function(_0x18098c){console[_0x5ed6('0x5b')]('SocketIO\x20'+_0x3e78b5['nsp'][_0x5ed6('0x4')]+'['+_0x3e78b5[_0x5ed6('0x5f')]+']',_0x18098c);};_0x3e78b5['on'](_0x5ed6('0x64'),function(){onDisconnect(_0x3e78b5,_0xa15cc7);_0x3e78b5[_0x5ed6('0x5b')](_0x5ed6('0x65'));});onConnect(_0x3e78b5);_0x3e78b5[_0x5ed6('0x5b')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 71344b8..9bd6639 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 _0x733f=['afterUpdate','ChatOfflineMessage','afterCreate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','Trigger,\x20%s','error','code','catch','get','motionChannel','event','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','opened','resolve','name','AfterCreate','changed','closed','substatus','AfterUpdate','User','fullname','email','internal','default','hasOwnProperty','model','hook','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','newinteraction'];(function(_0x1faf56,_0x1544d7){var _0x5ead5=function(_0xa4fd41){while(--_0xa4fd41){_0x1faf56['push'](_0x1faf56['shift']());}};_0x5ead5(++_0x1544d7);}(_0x733f,0xcc));var _0xf733=function(_0x2b20c7,_0x278d49){_0x2b20c7=_0x2b20c7-0x0;var _0x3a6e02=_0x733f[_0x2b20c7];return _0x3a6e02;};'use strict';var util=require(_0xf733('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf733('0x1'));var logger=require(_0xf733('0x2'))(_0xf733('0x3'));var client=jayson[_0xf733('0x4')][_0xf733('0x5')]({'port':0x232a});var triggers=[{'channel':_0xf733('0x6'),'model':_0xf733('0x7'),'event':'afterCreate','condition':_0xf733('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0xf733('0x7'),'event':_0xf733('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf733('0x6'),'model':_0xf733('0xa'),'event':_0xf733('0xb'),'condition':_0xf733('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xf733('0xd'),'model':_0xf733('0xe'),'event':_0xf733('0xb'),'condition':_0xf733('0x8'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0xf733('0x9'),'condition':_0xf733('0xf'),'callback':afterUpdate},{'channel':_0xf733('0xd'),'model':_0xf733('0x10'),'event':_0xf733('0xb'),'condition':_0xf733('0xc'),'callback':afterCreateMessage},{'channel':_0xf733('0x11'),'model':_0xf733('0x12'),'event':_0xf733('0xb'),'condition':_0xf733('0x8'),'callback':afterCreate},{'channel':_0xf733('0x11'),'model':'WhatsappInteraction','event':_0xf733('0x9'),'condition':_0xf733('0xf'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0xf733('0xb'),'condition':_0xf733('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xf733('0x13'),'event':_0xf733('0xb'),'condition':_0xf733('0x8'),'callback':afterCreate},{'channel':_0xf733('0x14'),'model':'FaxInteraction','event':_0xf733('0x9'),'condition':_0xf733('0xf'),'callback':afterUpdate},{'channel':_0xf733('0x14'),'model':'FaxMessage','event':'afterCreate','condition':_0xf733('0xc'),'callback':afterCreateMessage},{'channel':_0xf733('0x15'),'model':_0xf733('0x16'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xf733('0x15'),'model':_0xf733('0x16'),'event':_0xf733('0x9'),'condition':_0xf733('0xf'),'callback':afterUpdate},{'channel':'Mail','model':_0xf733('0x17'),'event':_0xf733('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf733('0x18'),'model':_0xf733('0x19'),'event':_0xf733('0xb'),'condition':_0xf733('0x8'),'callback':afterCreate},{'channel':_0xf733('0x18'),'model':_0xf733('0x19'),'event':_0xf733('0x9'),'condition':_0xf733('0xf'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xf733('0x1a'),'event':_0xf733('0xb'),'condition':_0xf733('0xc'),'callback':afterCreateMessage}];function request(_0x58c2a0){return client[_0xf733('0x1b')](_0xf733('0x1c'),_0x58c2a0)['then'](function(_0xd45ebf){logger['info'](_0xf733('0x1d'),_0xf733('0x1c'),_0xd45ebf);if(_0xd45ebf['error']){if(_0xd45ebf[_0xf733('0x1e')][_0xf733('0x1f')]===0x1f4){logger[_0xf733('0x1e')](_0xf733('0x1d'),_0xf733('0x1c'),_0xd45ebf[_0xf733('0x1e')]);}}})[_0xf733('0x20')](function(_0x227d0a){logger['error'](_0xf733('0x1d'),_0xf733('0x1c'),_0x227d0a);});}function afterCreateMessage(_0x349cca){return function(_0x594950){_0x594950=_0x594950[_0xf733('0x21')]({'plain':!![]});_0x594950['channel']=_0x349cca;_0x594950[_0xf733('0x22')]=_0x349cca;_0x594950[_0xf733('0x23')]=_0x594950['direction'];Promise['resolve']()[_0xf733('0x24')](function(){if(typeof _0x594950[_0xf733('0x25')]==='undefined')return null;var _0x2eca4b=_0xf733('0x26')+_0x594950[_0xf733('0x25')];return db[_0xf733('0x27')][_0xf733('0x28')](_0x2eca4b,{'type':db[_0xf733('0x29')][_0xf733('0x2a')][_0xf733('0x2b')],'raw':!![]});})[_0xf733('0x24')](function(_0x477a3b){if(_0x477a3b){_0x594950[_0xf733('0x2c')]=_0x477a3b[0x0];}if(typeof _0x594950[_0xf733('0x2d')]===_0xf733('0x2e'))return;return getAgent(_0x594950[_0xf733('0x2d')]);})['then'](function(_0x399c35){if(_0x399c35){_0x594950[_0xf733('0x2f')]=util[_0xf733('0x30')](_0xf733('0x31'),_0x399c35['name']);_0x594950[_0xf733('0x32')]=_0x399c35;_0x594950[_0xf733('0x33')]=_0x349cca;return request({'event':_0xf733('0x34'),'message':_0x594950});}else{return request({'event':_0xf733('0x35'),'message':_0x594950});}})[_0xf733('0x20')](function(_0x2d7fb4){logger['error'](_0xf733('0x1d'),_0xf733('0x36'),_0x2d7fb4);});};}function afterCreateOfflineMessage(_0x39446e){return function(_0x56396d){_0x56396d=_0x56396d['get']({'plain':!![]});_0x56396d[_0xf733('0x33')]=_0x39446e;_0x56396d[_0xf733('0x22')]=_0x39446e;_0x56396d[_0xf733('0x23')]='offlineMessage';return request({'event':_0x56396d[_0xf733('0x23')],'message':_0x56396d});};}function afterCreate(_0x26b7f0,_0x3ff24d){return function(_0xd2aeb2){var _0x4cf445=_0xd2aeb2[_0xf733('0x21')]({'plain':!![]});_0x4cf445['channel']=_0x26b7f0;_0x4cf445[_0xf733('0x22')]=_0x26b7f0;_0x4cf445[_0xf733('0x23')]=_0xf733('0x37');Promise[_0xf733('0x38')]()[_0xf733('0x24')](function(){var _0xfd58ec=_0xf733('0x26')+_0x4cf445[_0xf733('0x25')];return db[_0xf733('0x27')][_0xf733('0x28')](_0xfd58ec,{'type':db[_0xf733('0x29')][_0xf733('0x2a')][_0xf733('0x2b')],'raw':!![]});})[_0xf733('0x24')](function(_0x300621){if(_0x300621){_0x4cf445[_0xf733('0x2c')]=_0x300621[0x0];}if(_0x4cf445[_0xf733('0x2d')]){return getAgent(_0x4cf445[_0xf733('0x2d')]);}return;})[_0xf733('0x24')](function(_0x58df5e){if(_0x58df5e){_0x4cf445[_0xf733('0x2f')]=util[_0xf733('0x30')]('SIP/%s',_0x58df5e[_0xf733('0x39')]);_0x4cf445[_0xf733('0x32')]=_0x58df5e;}return request({'event':_0x3ff24d,'message':_0x4cf445});})[_0xf733('0x20')](function(_0x3fc7e4){logger[_0xf733('0x1e')](_0xf733('0x1d'),_0xf733('0x3a'),_0x3fc7e4);});};}function afterUpdate(_0x524acc){return function(_0x1a5ad2){var _0x57ebdb=_0x1a5ad2[_0xf733('0x3b')]('closed')&&_0x1a5ad2[_0xf733('0x3c')];var _0x38260e=_0x1a5ad2['changed'](_0xf733('0x3d'));if(_0x57ebdb||_0x38260e){var _0x39264c=_0x57ebdb?_0xf733('0xf'):_0xf733('0x3d');var _0xb366d5=_0x1a5ad2[_0xf733('0x21')]({'plain':!![]});_0xb366d5[_0xf733('0x33')]=_0x524acc;_0xb366d5[_0xf733('0x22')]=_0x524acc;_0xb366d5[_0xf733('0x23')]=_0x57ebdb?_0xf733('0x3c'):_0xf733('0x3d');var _0x2a639a=_0xf733('0x26')+_0xb366d5['ContactId'];return db[_0xf733('0x27')][_0xf733('0x28')](_0x2a639a,{'type':db[_0xf733('0x29')]['QueryTypes'][_0xf733('0x2b')],'raw':!![]})[_0xf733('0x24')](function(_0x4a36f9){if(_0x4a36f9){_0xb366d5[_0xf733('0x2c')]=_0x4a36f9[0x0];}if(typeof _0xb366d5[_0xf733('0x2d')]===_0xf733('0x2e'))return;return getAgent(_0xb366d5[_0xf733('0x2d')]);})[_0xf733('0x24')](function(_0x18c5ba){if(_0x18c5ba){_0xb366d5[_0xf733('0x2f')]=util[_0xf733('0x30')](_0xf733('0x31'),_0x18c5ba[_0xf733('0x39')]);_0xb366d5[_0xf733('0x32')]=_0x18c5ba;}return request({'event':_0x39264c,'message':_0xb366d5});})['catch'](function(_0x557387){logger[_0xf733('0x1e')](_0xf733('0x1d'),_0xf733('0x3e'),_0x557387);});}};}function getAgent(_0x5caa20){return db[_0xf733('0x3f')]['find']({'where':{'id':_0x5caa20},'attributes':['id',_0xf733('0x39'),_0xf733('0x40'),_0xf733('0x41'),_0xf733('0x42')],'raw':!![]})[_0xf733('0x24')](function(_0x118d25){return _0x118d25;});}exports[_0xf733('0x43')]=function(){for(var _0x2c4ee9=0x0;_0x2c4ee9=_0x1081f3[_0x0f3f('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2ecf62(_0x378952);})['catch'](function(_0x3688e8){_0x52b120(_0x3688e8);});});}; \ No newline at end of file +var _0x7c8b=['openchannel','getChannels','toLowerCase','includes','blockedAt','updateAttributes','role','agent','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','voice','mail','chat','fax'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c8b,0xad));var _0xb7c8=function(_0x283903,_0xfa7986){_0x283903=_0x283903-0x0;var _0x33cbbe=_0x7c8b[_0x283903];return _0x33cbbe;};'use strict';var _=require(_0xb7c8('0x0'));var BPromise=require('bluebird');var db=require(_0xb7c8('0x1'))['db'];var util=require(_0xb7c8('0x2'));var channels=[_0xb7c8('0x3'),_0xb7c8('0x4'),_0xb7c8('0x5'),_0xb7c8('0x6'),'sms','whatsapp',_0xb7c8('0x7')];exports[_0xb7c8('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x1fa30e){_0x1fa30e=_0x1fa30e[_0xb7c8('0x9')]();return _[_0xb7c8('0xa')](channels,_0x1fa30e);};exports['clearBlockUser']=function(_0x4f3742,_0x5c51ca,_0x2b0039,_0x570bc1){var _0x1b1181={'loginAttempts':_0x5c51ca,'blocked':_0x2b0039};if(!_['isUndefined'](_0x570bc1)){_0x1b1181[_0xb7c8('0xb')]=_0x570bc1;}return _0x4f3742[_0xb7c8('0xc')](_0x1b1181);};exports['getLicense']=function(_0x15c3f0){return new BPromise(function(_0x43a5f3,_0x3270ba){var _0x44e654=0x0;if(_0x15c3f0[_0xb7c8('0xd')]!==_0xb7c8('0xe')){_0x43a5f3(_0x15c3f0);}db['User'][_0xb7c8('0xf')]({'where':{'role':_0xb7c8('0xe'),'online':!![],'id':{'$ne':_0x15c3f0['id']}}})[_0xb7c8('0x10')](function(_0x322a20){_0x44e654=_0x322a20;return util[_0xb7c8('0x11')]();})[_0xb7c8('0x10')](function(_0x2fda06){if(_0x2fda06&&_0x2fda06['agents']&&_0x44e654>=_0x2fda06[_0xb7c8('0x12')]){throw Error(_0xb7c8('0x13'));}_0x43a5f3(_0x15c3f0);})['catch'](function(_0x1bae53){_0x3270ba(_0x1bae53);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 61fb1bd..236263c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x892c=['name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','OutOfInterval','Resource\x20Conflict','Conflict','stack','statusMessage','send','util','../config/logger','message'];(function(_0x476226,_0x3d224a){var _0x21419d=function(_0x2bfcae){while(--_0x2bfcae){_0x476226['push'](_0x476226['shift']());}};_0x21419d(++_0x3d224a);}(_0x892c,0x14d));var _0xc892=function(_0x511723,_0x4db8e2){_0x511723=_0x511723-0x0;var _0x25add0=_0x892c[_0x511723];return _0x25add0;};'use strict';var util=require(_0xc892('0x0'));var logger=require(_0xc892('0x1'))('api');var APIError=function(_0x166501,_0x213a8e){this[_0xc892('0x2')]=_0x166501||'Internal\x20Server\x20Error';this[_0xc892('0x3')]=_0x213a8e||'Error';util[_0xc892('0x4')](APIError,Error);};var APIBadRequestError=function(_0x5239fc){this['message']=_0x5239fc||_0xc892('0x5');this[_0xc892('0x3')]=_0xc892('0x5');util[_0xc892('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x30d7a5){this[_0xc892('0x2')]=_0x30d7a5||_0xc892('0x6');this[_0xc892('0x3')]=_0xc892('0x6');util[_0xc892('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x212529){this[_0xc892('0x2')]=_0x212529||_0xc892('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x32eb3a){this['message']=_0x32eb3a||_0xc892('0x8');this['name']=_0xc892('0x9');this['code']=0x193;this['details']={'type':_0xc892('0xa')};util[_0xc892('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1c9a92){this[_0xc892('0x2')]=_0x1c9a92||_0xc892('0xb');this['name']=_0xc892('0xc');util[_0xc892('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x400141){switch(_0x400141){case _0xc892('0x5'):return 0x190;case _0xc892('0x6'),_0xc892('0x9'):return 0x193;case'Not\x20Found':return 0x194;case _0xc892('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4d6468){if(_0x4d6468===_0xc892('0x9'))return _0x4d6468;return null;}function handleError(_0x3af52f){return function(_0x24779f){logger['error'](_0x24779f[_0xc892('0xd')]);var _0x514cc0=getStatusCode(_0x24779f[_0xc892('0x3')]);var _0x57dca8=getCustomStatusMessage(_0x24779f[_0xc892('0x3')]);if(_0x24779f[_0xc892('0x3')]){delete _0x24779f[_0xc892('0x3')];}if(_0x57dca8){_0x3af52f[_0xc892('0xe')]=_0x57dca8;}return _0x3af52f['status'](_0x514cc0)[_0xc892('0xf')](_0x24779f);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x56a8=['api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','exports','../config/logger'];(function(_0x87f3b4,_0x293430){var _0x38cb3c=function(_0x1e5e47){while(--_0x1e5e47){_0x87f3b4['push'](_0x87f3b4['shift']());}};_0x38cb3c(++_0x293430);}(_0x56a8,0x1cd));var _0x856a=function(_0x31cb1f,_0x5e0181){_0x31cb1f=_0x31cb1f-0x0;var _0x576476=_0x56a8[_0x31cb1f];return _0x576476;};'use strict';var util=require('util');var logger=require(_0x856a('0x0'))(_0x856a('0x1'));var APIError=function(_0x2fcc92,_0x328983){this[_0x856a('0x2')]=_0x2fcc92||_0x856a('0x3');this[_0x856a('0x4')]=_0x328983||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x5a4035){this['message']=_0x5a4035||_0x856a('0x5');this['name']=_0x856a('0x5');util[_0x856a('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x249689){this['message']=_0x249689||_0x856a('0x7');this[_0x856a('0x4')]='Forbidden';util[_0x856a('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x32b1bb){this[_0x856a('0x2')]=_0x32b1bb||_0x856a('0x8');this[_0x856a('0x4')]=_0x856a('0x9');util[_0x856a('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1302c3){this['message']=_0x1302c3||_0x856a('0xa');this[_0x856a('0x4')]=_0x856a('0xb');this[_0x856a('0xc')]=0x193;this[_0x856a('0xd')]={'type':_0x856a('0xe')};util[_0x856a('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x489529){this[_0x856a('0x2')]=_0x489529||_0x856a('0xf');this['name']=_0x856a('0x10');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x4a9a15){switch(_0x4a9a15){case _0x856a('0x5'):return 0x190;case'Forbidden',_0x856a('0xb'):return 0x193;case _0x856a('0x9'):return 0x194;case _0x856a('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5d0c8b){if(_0x5d0c8b===_0x856a('0xb'))return _0x5d0c8b;return null;}function handleError(_0x551422){return function(_0x4b89b3){logger[_0x856a('0x11')](_0x4b89b3[_0x856a('0x12')]);var _0x420e87=getStatusCode(_0x4b89b3[_0x856a('0x4')]);var _0x594d78=getCustomStatusMessage(_0x4b89b3[_0x856a('0x4')]);if(_0x4b89b3['name']){delete _0x4b89b3['name'];}if(_0x594d78){_0x551422[_0x856a('0x13')]=_0x594d78;}return _0x551422[_0x856a('0x14')](_0x420e87)['send'](_0x4b89b3);};}module[_0x856a('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ccdcf76..a7ebd22 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeb7=['404','status','render','json','send'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdeb7,0x82));var _0x7deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb7[_0x321bb2];return _0x9c12ed;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5993e9,_0x2556f4){var _0x3cd3a5=_0x7deb('0x0');var _0x4f1f20=0x194;var _0x2b2505={'status':_0x4f1f20};_0x2556f4['status'](_0x2b2505[_0x7deb('0x1')]);_0x2556f4[_0x7deb('0x2')](_0x3cd3a5,{},function(_0x1586b6,_0x3dcb97){if(_0x1586b6){return _0x2556f4[_0x7deb('0x1')](_0x2b2505['status'])[_0x7deb('0x3')](_0x2b2505);}_0x2556f4[_0x7deb('0x4')](_0x3dcb97);});}; \ No newline at end of file +var _0xb81f=['exports','status','render'];(function(_0x2fd469,_0xb4999d){var _0x3b8b17=function(_0x186190){while(--_0x186190){_0x2fd469['push'](_0x2fd469['shift']());}};_0x3b8b17(++_0xb4999d);}(_0xb81f,0xcc));var _0xfb81=function(_0x482c18,_0x248754){_0x482c18=_0x482c18-0x0;var _0x42f233=_0xb81f[_0x482c18];return _0x42f233;};'use strict';module[_0xfb81('0x0')][0x194]=function pageNotFound(_0xa8d5d1,_0x50e126){var _0x5cc33f='404';var _0x55ffbe=0x194;var _0x401378={'status':_0x55ffbe};_0x50e126[_0xfb81('0x1')](_0x401378[_0xfb81('0x1')]);_0x50e126[_0xfb81('0x2')](_0x5cc33f,{},function(_0x3c42dd,_0x5486cd){if(_0x3c42dd){return _0x50e126[_0xfb81('0x1')](_0x401378[_0xfb81('0x1')])['json'](_0x401378);}_0x50e126['send'](_0x5486cd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 826e5b7..e131302 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f84=['Dispositions','Answers','Interactions','Applications','List','ListId','team_has_mail_queues','Account','Owner','Tags','ThroughTags','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','DashboardItem','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Users','SmsAccount','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CampaignId','Condition','Any','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','Schedule','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','sms_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','Configurations','AccountId','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','Dynamics365Configuration','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','team_has_fax_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','sequelize','lodash','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserSetting','userSetting','hasMany','Recordings','VoiceQueuesRt','UserId','Extensions','HopperHistory','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','CmList','ChatWebsite','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceContext','Sound','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut'];(function(_0x3cb56b,_0xe6882b){var _0x4f6313=function(_0x1d4d25){while(--_0x1d4d25){_0x3cb56b['push'](_0x3cb56b['shift']());}};_0x4f6313(++_0xe6882b);}(_0x1f84,0x98));var _0x41f8=function(_0x30b9e3,_0x9a40cb){_0x30b9e3=_0x30b9e3-0x0;var _0x1bbab0=_0x1f84[_0x30b9e3];return _0x1bbab0;};'use strict';var config=require(_0x41f8('0x0'));var Sequelize=require(_0x41f8('0x1'));var _=require(_0x41f8('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x41f8('0x1')]=_[_0x41f8('0x3')](config[_0x41f8('0x1')],{'database':_0x41f8('0x4'),'username':'xcall','password':_0x41f8('0x5'),'options':{'host':_0x41f8('0x6'),'port':0xcea,'dialect':_0x41f8('0x7'),'dialectOptions':{'charset':_0x41f8('0x8')},'logging':![],'timezone':timezone[_0x41f8('0x9')](),'define':{'charset':_0x41f8('0xa'),'collate':_0x41f8('0xb')}}});config[_0x41f8('0xc')]=_[_0x41f8('0x3')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0x41f8('0x6'),'port':0xcea,'dialect':_0x41f8('0x7'),'dialectOptions':{'charset':_0x41f8('0x8')},'logging':![],'timezone':timezone[_0x41f8('0x9')](),'define':{'charset':_0x41f8('0xa'),'collate':_0x41f8('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x41f8('0x1')][_0x41f8('0xd')],config[_0x41f8('0x1')][_0x41f8('0xe')],config['sequelize'][_0x41f8('0xf')],config[_0x41f8('0x1')][_0x41f8('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x41f8('0xd')],config[_0x41f8('0xc')][_0x41f8('0xe')],config[_0x41f8('0xc')][_0x41f8('0xf')],config['sequelizeHistory'][_0x41f8('0x10')])};db[_0x41f8('0x11')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x13'));db['VoiceContext']=db['sequelize']['import'](_0x41f8('0x14'));db[_0x41f8('0x15')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x16'));db[_0x41f8('0x17')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x41f8('0x18')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x19'));db[_0x41f8('0x1a')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x1b'));db[_0x41f8('0x1c')]=db['sequelize'][_0x41f8('0x12')]('../api/screenRecording/screenRecording.model');db[_0x41f8('0x1d')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x1e'));db[_0x41f8('0x1f')]=db['sequelize']['import'](_0x41f8('0x20'));db[_0x41f8('0x21')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0x41f8('0x22')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x23'));db['VoiceAgentReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x24'));db[_0x41f8('0x25')]=db['sequelize'][_0x41f8('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x41f8('0x26')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x27'));db[_0x41f8('0x28')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/trunk/trunk.model');db[_0x41f8('0x29')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x41f8('0x2a')]=db[_0x41f8('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x41f8('0x2b')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x41f8('0x2c')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x2d'));db[_0x41f8('0x2e')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x2f'));db[_0x41f8('0x30')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x31'));db['UserSmsQueue']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x32'));db['UserOpenchannelQueue']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x33'));db[_0x41f8('0x34')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x35'));db[_0x41f8('0x36')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x37'));db['MailServerOut']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x41f8('0x38')]=db[_0x41f8('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0x41f8('0x39')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x3a'));db['MailSubstatus']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x3b'));db[_0x41f8('0x3c')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x3d'));db[_0x41f8('0x3e')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/mailMessage/mailMessage.model');db[_0x41f8('0x3f')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x40'));db[_0x41f8('0x41')]=db['sequelize'][_0x41f8('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0x41f8('0x42')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x43'));db['DashboardItem']=db['sequelize'][_0x41f8('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x41f8('0x44')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x45'));db[_0x41f8('0x46')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x47'));db[_0x41f8('0x48')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x49'));db[_0x41f8('0x4a')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x4b'));db[_0x41f8('0x4c')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x4d'));db[_0x41f8('0x4e')]=db['sequelize']['import'](_0x41f8('0x4f'));db['SmsAccount']=db['sequelize'][_0x41f8('0x12')]('../api/smsAccount/smsAccount.model');db[_0x41f8('0x50')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/smsApplication/smsApplication.model');db[_0x41f8('0x51')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x52'));db[_0x41f8('0x53')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x54'));db[_0x41f8('0x55')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x56'));db[_0x41f8('0x57')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0x41f8('0x58')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x59'));db[_0x41f8('0x5a')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x5b'));db[_0x41f8('0x5c')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x5d'));db[_0x41f8('0x5e')]=db['sequelize']['import'](_0x41f8('0x5f'));db['ChatWebsite']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x60'));db['OpenchannelQueueReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x61'));db[_0x41f8('0x62')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x63'));db[_0x41f8('0x64')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x65'));db[_0x41f8('0x66')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x67'));db[_0x41f8('0x68')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x69'));db['ChatQueue']=db['sequelize'][_0x41f8('0x12')]('../api/chatQueue/chatQueue.model');db[_0x41f8('0x6a')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x6b'));db[_0x41f8('0x6c')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x6d'));db[_0x41f8('0x6e')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/cmCompany/cmCompany.model');db[_0x41f8('0x6f')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x70'));db[_0x41f8('0x71')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x72'));db[_0x41f8('0x73')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x74'));db[_0x41f8('0x75')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x76'));db[_0x41f8('0x77')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x78'));db[_0x41f8('0x79')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x7a'));db[_0x41f8('0x7b')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x7c'));db[_0x41f8('0x7d')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x7e'));db[_0x41f8('0x7f')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x80'));db[_0x41f8('0x81')]=db['sequelize'][_0x41f8('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x41f8('0x82')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x83'));db['Condition']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x84'));db['Interval']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/interval/interval.model');db[_0x41f8('0x85')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x86'));db['Cdr']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/cdr/cdr.model');db[_0x41f8('0x87')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x88'));db['Schedule']=db['sequelize']['import'](_0x41f8('0x89'));db['Sound']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x8a'));db[_0x41f8('0x8b')]=db['sequelize'][_0x41f8('0x12')]('../api/tag/tag.model');db[_0x41f8('0x8c')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x8d'));db[_0x41f8('0x8e')]=db['sequelize'][_0x41f8('0x12')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x41f8('0x8f')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x90'));db[_0x41f8('0x91')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x92'));db['Trigger']=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x41f8('0x93')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x94'));db['Integration']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x95'));db['IntegrationReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x96'));db[_0x41f8('0x97')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x98'));db['AnalyticDefaultReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x99'));db[_0x41f8('0x9a')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x9b'));db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x9c'));db[_0x41f8('0x9d')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x9e'));db[_0x41f8('0x9f')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xa0'));db[_0x41f8('0xa1')]=db[_0x41f8('0x1')]['import'](_0x41f8('0xa2'));db[_0x41f8('0xa3')]=db['sequelize']['import'](_0x41f8('0xa4'));db['SugarcrmAccount']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xa5'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x41f8('0xa6'));db[_0x41f8('0xa7')]=db['sequelize'][_0x41f8('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x41f8('0xa8')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x41f8('0xa9')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x41f8('0xaa')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xab'));db[_0x41f8('0xac')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xad'));db[_0x41f8('0xae')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xaf'));db[_0x41f8('0xb0')]=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db[_0x41f8('0xb1')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xb2'));db[_0x41f8('0xb3')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xb4'));db[_0x41f8('0xb5')]=db['sequelize'][_0x41f8('0x12')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xb6'));db[_0x41f8('0xb7')]=db['sequelize'][_0x41f8('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x41f8('0xb8')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xb9'));db[_0x41f8('0xba')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xbb'));db[_0x41f8('0xbc')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xbd'));db[_0x41f8('0xbe')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xbf'));db['ServicenowAccount']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc0'));db['ServicenowConfiguration']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc1'));db[_0x41f8('0xc2')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc3'));db[_0x41f8('0xc4')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc5'));db['Dynamics365Configuration']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc6'));db[_0x41f8('0xc7')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xc8'));db[_0x41f8('0xc9')]=db[_0x41f8('0x1')]['import'](_0x41f8('0xca'));db[_0x41f8('0xcb')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xcc'));db[_0x41f8('0xcd')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xce'));db[_0x41f8('0xcf')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x95'));db['Network']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xd0'));db[_0x41f8('0xd1')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xd2'));db['ChatInternalMessage']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x41f8('0xd3')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xd4'));db['JscriptyQuestionReport']=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xd5'));db[_0x41f8('0xd6')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xd7'));db['SmsQueueReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xd8'));db[_0x41f8('0xd9')]=db[_0x41f8('0x1')]['import'](_0x41f8('0xda'));db['SquareDetailsReport']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xdb'));db[_0x41f8('0xdc')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xdd'));db['Setting']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/setting/setting.model');db[_0x41f8('0xde')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xdf'));db[_0x41f8('0xe0')]=db[_0x41f8('0x1')]['import'](_0x41f8('0xe1'));db[_0x41f8('0xe2')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xe3'));db[_0x41f8('0xe4')]=db['sequelize'][_0x41f8('0x12')]('../api/squareMessage/squareMessage.model');db[_0x41f8('0xe5')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xe6'));db['License']=db['sequelize'][_0x41f8('0x12')]('../api/license/license.model');db[_0x41f8('0xe7')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xe8'));db[_0x41f8('0xe9')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xea'));db[_0x41f8('0xeb')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xec'));db[_0x41f8('0xed')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xee'));db[_0x41f8('0xef')]=db['sequelize']['import'](_0x41f8('0xf0'));db[_0x41f8('0xf1')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xf2'));db[_0x41f8('0xf3')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xf4'));db[_0x41f8('0xf5')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xf6'));db[_0x41f8('0xf7')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x41f8('0x1')]['import']('../api/cmList/cmList.model');db[_0x41f8('0xf8')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xf9'));db['UserProfile']=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/userProfile/userProfile.model');db[_0x41f8('0xfa')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xfb'));db[_0x41f8('0xfc')]=db['sequelize'][_0x41f8('0x12')](_0x41f8('0xfd'));db[_0x41f8('0xfe')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0xff'));db[_0x41f8('0x100')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x101'));db[_0x41f8('0x102')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x103'));db[_0x41f8('0x104')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x41f8('0x105')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x106'));db[_0x41f8('0x107')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0x41f8('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x41f8('0x108')]=db[_0x41f8('0x1')]['import'](_0x41f8('0x109'));db[_0x41f8('0x10a')]=db[_0x41f8('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x41f8('0x10b')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x10c'));db[_0x41f8('0x10d')]=db[_0x41f8('0x1')][_0x41f8('0x12')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x41f8('0x10e')]=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x10f'));db['UserSetting']=db[_0x41f8('0x1')][_0x41f8('0x12')](_0x41f8('0x110'));db['MailInteractionHasTag']=db['sequelize'][_0x41f8('0x12')](_0x41f8('0x111'));db[_0x41f8('0x11')][_0x41f8('0x112')](db[_0x41f8('0x1d')],{'as':_0x41f8('0x1d'),'onDelete':_0x41f8('0x113'),'foreignKey':'UserId'});db['User'][_0x41f8('0x112')](db[_0x41f8('0x114')],{'as':_0x41f8('0x115'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x41f8('0x116')](db[_0x41f8('0x1a')],{'as':_0x41f8('0x117'),'foreignKey':'UserId'});db[_0x41f8('0x11')][_0x41f8('0x116')](db[_0x41f8('0x2a')],{'as':_0x41f8('0x118'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')]['hasMany'](db[_0x41f8('0x15')],{'as':_0x41f8('0x11a'),'onDelete':_0x41f8('0x113'),'hooks':!![]});db[_0x41f8('0x11')]['hasMany'](db[_0x41f8('0x75')],{'as':'HopperFinals','foreignKey':'UserId'});db['User'][_0x41f8('0x116')](db['CmHopperHistory'],{'as':_0x41f8('0x11b'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')][_0x41f8('0x116')](db['ReportAgentPreview'],{'as':_0x41f8('0x79'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')][_0x41f8('0x116')](db[_0x41f8('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')]['hasMany'](db[_0x41f8('0x64')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0x41f8('0x116')](db[_0x41f8('0x51')],{'as':_0x41f8('0x11c'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')][_0x41f8('0x116')](db['FaxInteraction'],{'as':_0x41f8('0x11d'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')][_0x41f8('0x116')](db[_0x41f8('0x3c')],{'as':_0x41f8('0x11e'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')]['hasMany'](db['WhatsappInteraction'],{'as':_0x41f8('0x11f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x11')][_0x41f8('0x116')](db[_0x41f8('0xfe')],{'as':_0x41f8('0x120'),'foreignKey':_0x41f8('0x121')});db[_0x41f8('0x11')]['hasMany'](db[_0x41f8('0x71')],{'as':'Hoppers','foreignKey':_0x41f8('0x119'),'onDelete':_0x41f8('0x122')});db['User'][_0x41f8('0x123')](db[_0x41f8('0x124')],{'as':_0x41f8('0x124'),'foreignKey':_0x41f8('0x125')});db['User'][_0x41f8('0x126')](db[_0x41f8('0x6a')],{'as':'Groups','through':_0x41f8('0x127')});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x6f')],{'as':_0x41f8('0x128'),'through':_0x41f8('0x129')});db[_0x41f8('0x11')][_0x41f8('0x126')](db['CmList'],{'as':_0x41f8('0x12a'),'through':_0x41f8('0x12b')});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'through':_0x41f8('0x12c')});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x3c')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x64')],{'as':_0x41f8('0x12d'),'through':_0x41f8('0x12e')});db['User'][_0x41f8('0x126')](db['FaxInteraction'],{'as':_0x41f8('0x11d'),'through':_0x41f8('0x12f')});db['User']['belongsToMany'](db[_0x41f8('0x51')],{'as':_0x41f8('0x11c'),'through':_0x41f8('0x130')});db[_0x41f8('0x11')][_0x41f8('0x126')](db['OpenchannelInteraction'],{'as':_0x41f8('0x131'),'through':_0x41f8('0x132')});db['User']['belongsToMany'](db[_0x41f8('0x104')],{'as':_0x41f8('0x11f'),'through':_0x41f8('0x133')});db[_0x41f8('0x11')]['belongsToMany'](db[_0x41f8('0x18')],{'as':_0x41f8('0x134'),'through':'UserVoiceQueue','required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0xf8')],{'as':_0x41f8('0x135'),'through':'UserVoicePrefix','required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x39')],{'as':_0x41f8('0x136'),'through':'UserMailQueue','required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x137')],{'as':_0x41f8('0x138'),'through':_0x41f8('0x2c'),'required':![],'hooks':!![]});db[_0x41f8('0x11')]['belongsToMany'](db[_0x41f8('0x4c')],{'as':_0x41f8('0x139'),'through':'UserFaxQueue','required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x55')],{'as':_0x41f8('0x13a'),'through':_0x41f8('0x13b'),'required':![]});db['User'][_0x41f8('0x126')](db[_0x41f8('0x5e')],{'as':_0x41f8('0x13c'),'through':_0x41f8('0x13d'),'required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x108')],{'as':_0x41f8('0x13e'),'through':_0x41f8('0x34'),'required':![]});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x13f')],{'through':'cm_user_has_lists'});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x140')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x41f8('0x11')][_0x41f8('0x126')](db[_0x41f8('0x44')],{'as':'FaxAccounts','through':_0x41f8('0x141')});db['User'][_0x41f8('0x126')](db[_0x41f8('0x38')],{'as':_0x41f8('0x142'),'through':_0x41f8('0x143')});db['User'][_0x41f8('0x126')](db['OpenchannelAccount'],{'as':_0x41f8('0x144'),'through':'user_has_openchannel_accounts'});db[_0x41f8('0x11')][_0x41f8('0x126')](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0x41f8('0x126')](db[_0x41f8('0x100')],{'as':_0x41f8('0x145'),'through':_0x41f8('0x146')});db['VoiceChanSpy'][_0x41f8('0x116')](db[_0x41f8('0x15')],{'as':_0x41f8('0x147'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x148')});db[_0x41f8('0x149')][_0x41f8('0x116')](db['VoiceExtension'],{'onDelete':_0x41f8('0x113')});db[_0x41f8('0x15')][_0x41f8('0x116')](db[_0x41f8('0x15')],{'as':'Applications','onDelete':_0x41f8('0x113')});db[_0x41f8('0x17')][_0x41f8('0x126')](db[_0x41f8('0x14a')],{'as':'Sounds','through':'moh_has_sounds'});db[_0x41f8('0x18')][_0x41f8('0x116')](db[_0x41f8('0x2a')],{'as':'Members','foreignKey':_0x41f8('0x14b')});db[_0x41f8('0x18')]['hasMany'](db[_0x41f8('0x71')],{'as':_0x41f8('0x14c'),'foreignKey':_0x41f8('0x14b')});db[_0x41f8('0x18')][_0x41f8('0x116')](db['CmHopperFinal'],{'as':_0x41f8('0x14d'),'foreignKey':_0x41f8('0x14b')});db[_0x41f8('0x18')]['hasMany'](db['CmHopperHistory'],{'as':_0x41f8('0x14e'),'foreignKey':_0x41f8('0x14b')});db[_0x41f8('0x18')]['hasMany'](db[_0x41f8('0x79')],{'as':_0x41f8('0x79'),'foreignKey':'VoiceQueueId'});db[_0x41f8('0x18')]['hasMany'](db[_0x41f8('0x73')],{'as':_0x41f8('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x41f8('0x116')](db['JscriptySessionReport'],{'as':_0x41f8('0x150'),'foreignKey':_0x41f8('0x14b')});db[_0x41f8('0x18')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x41f8('0x151')});db[_0x41f8('0x18')][_0x41f8('0x123')](db[_0x41f8('0x28')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x41f8('0x18')][_0x41f8('0x123')](db[_0x41f8('0x152')],{'as':_0x41f8('0x152'),'foreignKey':_0x41f8('0x153')});db[_0x41f8('0x18')][_0x41f8('0x123')](db[_0x41f8('0x85')],{'as':_0x41f8('0x154'),'foreignKey':_0x41f8('0x155')});db['VoiceQueue'][_0x41f8('0x126')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x12a'),'through':_0x41f8('0x156')});db[_0x41f8('0x18')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x2b')});db['VoiceQueue'][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'as':_0x41f8('0x158'),'through':_0x41f8('0x10b')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x41f8('0x159'),'through':_0x41f8('0x15a')});db[_0x41f8('0x1a')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x11'),'foreignKey':'UserId'});db[_0x41f8('0x1c')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x11'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x1d')]['hasMany'](db[_0x41f8('0x1f')],{'as':_0x41f8('0x15b'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x15c'),'sourceKey':'mailbox'});db[_0x41f8('0x1f')]['belongsTo'](db[_0x41f8('0x1d')],{'foreignKey':_0x41f8('0x15c'),'targetKey':_0x41f8('0x15d')});db['VoiceCallReport'][_0x41f8('0x116')](db[_0x41f8('0x25')],{'as':_0x41f8('0x15e'),'foreignKey':_0x41f8('0x15f'),'constraints':![]});db['VoiceCallReport'][_0x41f8('0x116')](db['VoiceAgentReport'],{'as':_0x41f8('0x160'),'foreignKey':_0x41f8('0x15f'),'constraints':![]});db[_0x41f8('0x21')][_0x41f8('0x123')](db['User'],{'as':_0x41f8('0x11'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x21')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x36')][_0x41f8('0x123')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x41f8('0x163')});db[_0x41f8('0x36')][_0x41f8('0x123')](db[_0x41f8('0x10a')],{'as':_0x41f8('0x10a'),'foreignKey':_0x41f8('0x164'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x166')]['belongsTo'](db[_0x41f8('0x38')],{'as':_0x41f8('0x38'),'foreignKey':_0x41f8('0x163')});db[_0x41f8('0x166')][_0x41f8('0x123')](db[_0x41f8('0x10a')],{'as':_0x41f8('0x10a'),'foreignKey':_0x41f8('0x164'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x38')][_0x41f8('0x112')](db[_0x41f8('0x36')],{'as':'Imap','onDelete':_0x41f8('0x113')});db[_0x41f8('0x38')][_0x41f8('0x112')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db[_0x41f8('0x38')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x41f8('0x81')],{'as':_0x41f8('0x168'),'foreignKey':_0x41f8('0x163')});db[_0x41f8('0x38')]['hasMany'](db[_0x41f8('0x3e')],{'as':'Messages','foreignKey':_0x41f8('0x163')});db[_0x41f8('0x38')][_0x41f8('0x116')](db['MailInteraction'],{'as':_0x41f8('0x169')});db['MailAccount'][_0x41f8('0x116')](db[_0x41f8('0x3f')],{'as':_0x41f8('0x16a'),'foreignKey':_0x41f8('0x163'),'onDelete':_0x41f8('0x113')});db['MailAccount'][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db['MailAccount'][_0x41f8('0x123')](db[_0x41f8('0x91')],{'as':_0x41f8('0x91'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0x41f8('0x85')],{'as':_0x41f8('0x154'),'foreignKey':_0x41f8('0x155')});db[_0x41f8('0x38')][_0x41f8('0x126')](db['User'],{'as':_0x41f8('0x157'),'through':_0x41f8('0x143')});db[_0x41f8('0x39')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x2e')});db[_0x41f8('0x39')][_0x41f8('0x126')](db['Team'],{'through':_0x41f8('0x16d'),'as':_0x41f8('0x158')});db[_0x41f8('0x3c')]['hasMany'](db[_0x41f8('0x3e')],{'as':_0x41f8('0x15b'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction']['belongsTo'](db[_0x41f8('0x38')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x163')});db[_0x41f8('0x3c')][_0x41f8('0x123')](db['CmContact'],{'as':'Contact','foreignKey':_0x41f8('0x162')});db[_0x41f8('0x3c')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x3c')]['belongsToMany'](db[_0x41f8('0x8b')],{'through':'mail_interaction_has_tags','as':_0x41f8('0x170')});db[_0x41f8('0x3c')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':'mail_interaction_has_tags','as':_0x41f8('0x171')});db[_0x41f8('0x3c')]['belongsToMany'](db['User'],{'as':'Users','through':_0x41f8('0x172'),'foreignKey':_0x41f8('0x173')});db[_0x41f8('0x3e')]['hasMany'](db[_0x41f8('0xeb')],{'as':_0x41f8('0x174'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x3e')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x11')});db[_0x41f8('0x3e')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x41f8('0x3e')]['belongsTo'](db['MailInteraction'],{'as':_0x41f8('0x175'),'foreignKey':_0x41f8('0x173')});db[_0x41f8('0x3e')][_0x41f8('0x123')](db[_0x41f8('0x38')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x163')});db[_0x41f8('0x3e')]['belongsTo'](db[_0x41f8('0x140')],{'as':_0x41f8('0x140'),'foreignKey':_0x41f8('0x176')});db[_0x41f8('0x3e')][_0x41f8('0x123')](db['ChatOfflineMessage'],{'as':_0x41f8('0x68'),'foreignKey':_0x41f8('0x177')});db[_0x41f8('0x3f')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x3f')][_0x41f8('0x123')](db[_0x41f8('0x39')],{'onDelete':_0x41f8('0x165')});db['MailApplication'][_0x41f8('0x123')](db[_0x41f8('0x38')],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x3f')][_0x41f8('0x123')](db[_0x41f8('0x152')],{'onDelete':'restrict','foreignKey':_0x41f8('0x153')});db[_0x41f8('0x3f')][_0x41f8('0x123')](db[_0x41f8('0x8b')],{'onDelete':_0x41f8('0x165'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x41f8('0x41')][_0x41f8('0x123')](db['CmList'],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x41')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':'Contact','foreignKey':_0x41f8('0x162')});db[_0x41f8('0x41')][_0x41f8('0x123')](db[_0x41f8('0x3c')],{});db[_0x41f8('0x41')][_0x41f8('0x123')](db['MailMessage'],{});db[_0x41f8('0x41')][_0x41f8('0x123')](db[_0x41f8('0x11')],{});db[_0x41f8('0x41')][_0x41f8('0x123')](db[_0x41f8('0x39')],{});db[_0x41f8('0x42')][_0x41f8('0x116')](db[_0x41f8('0x178')],{'as':_0x41f8('0x179'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x44')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':'Dispositions','foreignKey':_0x41f8('0x17a'),'onDelete':_0x41f8('0x113')});db['FaxAccount']['hasMany'](db[_0x41f8('0x81')],{'as':_0x41f8('0x168'),'foreignKey':_0x41f8('0x17a')});db['FaxAccount'][_0x41f8('0x116')](db[_0x41f8('0x48')],{'as':'Interactions'});db[_0x41f8('0x44')][_0x41f8('0x116')](db['FaxApplication'],{'as':'Applications','foreignKey':_0x41f8('0x17a'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x44')]['hasMany'](db[_0x41f8('0x15')],{'as':_0x41f8('0x17b'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x44')][_0x41f8('0x116')](db[_0x41f8('0x4a')],{'as':_0x41f8('0x15b')});db['FaxAccount'][_0x41f8('0x123')](db[_0x41f8('0x28')],{'as':'Trunk'});db['FaxAccount'][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x44')][_0x41f8('0x123')](db['Pause'],{'as':_0x41f8('0x154'),'foreignKey':_0x41f8('0x155')});db['FaxAccount'][_0x41f8('0x126')](db['User'],{'as':_0x41f8('0x157'),'through':_0x41f8('0x141')});db[_0x41f8('0x46')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'onDelete':'restrict'});db[_0x41f8('0x46')][_0x41f8('0x123')](db[_0x41f8('0x4c')],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x46')]['belongsTo'](db[_0x41f8('0x44')],{'onDelete':_0x41f8('0x165')});db['FaxApplication'][_0x41f8('0x123')](db['Tag'],{'onDelete':_0x41f8('0x165'),'foreignKey':_0x41f8('0x17c')});db[_0x41f8('0x48')]['hasMany'](db[_0x41f8('0x4a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x41f8('0x17d')});db[_0x41f8('0x48')][_0x41f8('0x123')](db[_0x41f8('0x44')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x17a')});db['FaxInteraction'][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':'Contact','foreignKey':_0x41f8('0x162')});db[_0x41f8('0x48')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':'UserId'});db[_0x41f8('0x48')][_0x41f8('0x126')](db['Tag'],{'through':_0x41f8('0x17e'),'as':'Tags'});db[_0x41f8('0x48')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x17e'),'as':'ThroughTags'});db[_0x41f8('0x48')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x17f'),'through':_0x41f8('0x12f'),'foreignKey':_0x41f8('0x17d')});db[_0x41f8('0x4a')]['belongsTo'](db[_0x41f8('0x11')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x11')});db[_0x41f8('0x4a')][_0x41f8('0x123')](db[_0x41f8('0x48')],{'as':_0x41f8('0x175'),'foreignKey':_0x41f8('0x17d')});db[_0x41f8('0x4a')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'onDelete':_0x41f8('0x113'),'as':'Contact'});db[_0x41f8('0x4a')]['belongsTo'](db[_0x41f8('0xeb')],{'as':_0x41f8('0xeb'),'foreignKey':'AttachmentId'});db[_0x41f8('0x4a')][_0x41f8('0x123')](db[_0x41f8('0x44')],{'as':_0x41f8('0x16e'),'foreignKey':'FaxAccountId'});db[_0x41f8('0x4c')]['belongsToMany'](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x30')});db[_0x41f8('0x4c')][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'through':'team_has_fax_queues','as':_0x41f8('0x158')});db[_0x41f8('0x4e')][_0x41f8('0x123')](db[_0x41f8('0x44')],{});db[_0x41f8('0x4e')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db['FaxQueueReport']['belongsTo'](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':'ContactId'});db[_0x41f8('0x4e')][_0x41f8('0x123')](db[_0x41f8('0x48')],{});db['FaxQueueReport'][_0x41f8('0x123')](db[_0x41f8('0x4a')],{});db[_0x41f8('0x4e')][_0x41f8('0x123')](db[_0x41f8('0x11')],{});db[_0x41f8('0x4e')]['belongsTo'](db[_0x41f8('0x4c')],{});db[_0x41f8('0x180')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':_0x41f8('0x181'),'onDelete':'cascade'});db[_0x41f8('0x180')]['hasMany'](db[_0x41f8('0x81')],{'as':'Answers','foreignKey':_0x41f8('0x181')});db['SmsAccount'][_0x41f8('0x116')](db[_0x41f8('0x53')],{'as':_0x41f8('0x15b'),'foreignKey':_0x41f8('0x181')});db['SmsAccount'][_0x41f8('0x116')](db['SmsInteraction'],{'as':'Interactions'});db[_0x41f8('0x180')][_0x41f8('0x116')](db[_0x41f8('0x50')],{'as':_0x41f8('0x16a'),'foreignKey':'SmsAccountId','onDelete':_0x41f8('0x113')});db['SmsAccount'][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db['SmsAccount'][_0x41f8('0x123')](db[_0x41f8('0x85')],{'as':_0x41f8('0x154'),'foreignKey':_0x41f8('0x155')});db[_0x41f8('0x180')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':'user_has_sms_accounts'});db[_0x41f8('0x50')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x50')][_0x41f8('0x123')](db[_0x41f8('0x55')],{'onDelete':'restrict'});db[_0x41f8('0x50')][_0x41f8('0x123')](db[_0x41f8('0x180')],{'onDelete':_0x41f8('0x165')});db['SmsApplication'][_0x41f8('0x123')](db[_0x41f8('0x152')],{'onDelete':_0x41f8('0x165'),'foreignKey':'IntervalId'});db[_0x41f8('0x50')][_0x41f8('0x123')](db['Tag'],{'onDelete':_0x41f8('0x165'),'foreignKey':_0x41f8('0x17c')});db[_0x41f8('0x51')][_0x41f8('0x116')](db[_0x41f8('0x53')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x41f8('0x182')});db[_0x41f8('0x51')][_0x41f8('0x123')](db[_0x41f8('0x180')],{'as':_0x41f8('0x16e'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x51')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x51')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':'sms_interaction_has_tags','as':_0x41f8('0x170')});db[_0x41f8('0x51')][_0x41f8('0x126')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x41f8('0x51')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x17f'),'through':_0x41f8('0x130'),'foreignKey':_0x41f8('0x182')});db[_0x41f8('0x53')]['belongsTo'](db[_0x41f8('0x11')],{'as':_0x41f8('0x11')});db[_0x41f8('0x53')][_0x41f8('0x123')](db['CmContact'],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x161')});db[_0x41f8('0x53')]['belongsTo'](db[_0x41f8('0x51')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x175'),'foreignKey':_0x41f8('0x182')});db[_0x41f8('0x53')][_0x41f8('0x123')](db[_0x41f8('0x180')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x181')});db[_0x41f8('0x55')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x13b'),'foreignKey':_0x41f8('0x183')});db[_0x41f8('0x55')][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'through':_0x41f8('0x184'),'as':_0x41f8('0x158')});db[_0x41f8('0x57')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':'Dispositions','foreignKey':_0x41f8('0x185'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x57')]['hasMany'](db[_0x41f8('0x81')],{'as':'Answers','foreignKey':_0x41f8('0x185')});db[_0x41f8('0x57')][_0x41f8('0x116')](db[_0x41f8('0x5a')],{'as':_0x41f8('0x169'),'foreignKey':_0x41f8('0x185')});db[_0x41f8('0x57')][_0x41f8('0x116')](db['OpenchannelMessage'],{'as':_0x41f8('0x15b'),'foreignKey':_0x41f8('0x185')});db[_0x41f8('0x57')][_0x41f8('0x116')](db[_0x41f8('0x58')],{'as':_0x41f8('0x16a'),'foreignKey':_0x41f8('0x185'),'onDelete':'cascade'});db[_0x41f8('0x57')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db['OpenchannelAccount'][_0x41f8('0x123')](db[_0x41f8('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x41f8('0x155')});db['OpenchannelAccount'][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x186')});db[_0x41f8('0x58')]['belongsTo'](db['User'],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x58')][_0x41f8('0x123')](db[_0x41f8('0x5e')],{'onDelete':'restrict','foreignKey':_0x41f8('0x187')});db[_0x41f8('0x58')][_0x41f8('0x123')](db[_0x41f8('0x57')],{'onDelete':'restrict','foreignKey':_0x41f8('0x185')});db['OpenchannelApplication'][_0x41f8('0x123')](db[_0x41f8('0x152')],{'onDelete':_0x41f8('0x165'),'foreignKey':_0x41f8('0x153')});db[_0x41f8('0x58')]['belongsTo'](db[_0x41f8('0x8b')],{'onDelete':_0x41f8('0x165'),'foreignKey':'TagId'});db[_0x41f8('0x5a')]['hasMany'](db[_0x41f8('0x5c')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x41f8('0x188')});db['OpenchannelInteraction']['belongsTo'](db[_0x41f8('0x57')],{'as':_0x41f8('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x41f8('0x5a')]['belongsTo'](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db['OpenchannelInteraction'][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x41f8('0x126')](db['Tag'],{'through':_0x41f8('0x189'),'as':'Tags'});db[_0x41f8('0x5a')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x189'),'as':_0x41f8('0x171')});db[_0x41f8('0x5a')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x17f'),'through':_0x41f8('0x132'),'foreignKey':_0x41f8('0x188')});db[_0x41f8('0x5c')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'onDelete':'cascade','as':_0x41f8('0x11')});db[_0x41f8('0x5c')]['belongsTo'](db['CmContact'],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x161')});db[_0x41f8('0x5c')][_0x41f8('0x123')](db[_0x41f8('0x5a')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x175'),'foreignKey':_0x41f8('0x188')});db[_0x41f8('0x5c')][_0x41f8('0x123')](db[_0x41f8('0xeb')],{'as':_0x41f8('0xeb'),'foreignKey':_0x41f8('0x18a')});db[_0x41f8('0x5c')][_0x41f8('0x123')](db[_0x41f8('0x57')],{'as':_0x41f8('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x41f8('0x5e')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x13d'),'foreignKey':'OpenchannelQueueId'});db[_0x41f8('0x5e')][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'through':_0x41f8('0x18b'),'as':_0x41f8('0x158')});db['ChatWebsite']['hasMany'](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':'ChatWebsiteId','onDelete':_0x41f8('0x113')});db[_0x41f8('0x140')][_0x41f8('0x116')](db[_0x41f8('0x81')],{'as':_0x41f8('0x168'),'foreignKey':_0x41f8('0x176')});db[_0x41f8('0x140')][_0x41f8('0x116')](db[_0x41f8('0x6c')],{'as':_0x41f8('0x18c')});db[_0x41f8('0x140')][_0x41f8('0x116')](db['ChatInteraction'],{'as':_0x41f8('0x169')});db[_0x41f8('0x140')]['hasMany'](db['ChatApplication'],{'as':_0x41f8('0x16a'),'foreignKey':_0x41f8('0x176'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x140')][_0x41f8('0x116')](db[_0x41f8('0x66')],{'as':_0x41f8('0x15b')});db[_0x41f8('0x140')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':'List','foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x140')][_0x41f8('0x123')](db[_0x41f8('0x152')],{'as':_0x41f8('0x152'),'foreignKey':_0x41f8('0x153')});db['ChatWebsite'][_0x41f8('0x123')](db[_0x41f8('0x38')],{'as':_0x41f8('0x38'),'foreignKey':'MailAccountId'});db[_0x41f8('0x140')][_0x41f8('0x123')](db[_0x41f8('0x85')],{'as':_0x41f8('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x41f8('0x140')]['belongsToMany'](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x18d')});db[_0x41f8('0x18e')][_0x41f8('0x123')](db[_0x41f8('0x57')],{});db[_0x41f8('0x18e')][_0x41f8('0x123')](db['CmList'],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x18e')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db['OpenchannelQueueReport']['belongsTo'](db[_0x41f8('0x5a')],{});db['OpenchannelQueueReport'][_0x41f8('0x123')](db[_0x41f8('0x5c')],{});db['OpenchannelQueueReport'][_0x41f8('0x123')](db[_0x41f8('0x11')],{});db[_0x41f8('0x18e')][_0x41f8('0x123')](db[_0x41f8('0x5e')],{});db[_0x41f8('0x62')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x18f'),'foreignKey':_0x41f8('0x119'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x62')][_0x41f8('0x123')](db[_0x41f8('0x137')],{'as':_0x41f8('0x190'),'foreignKey':_0x41f8('0x191'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x62')][_0x41f8('0x123')](db['ChatWebsite'],{'as':_0x41f8('0x192'),'foreignKey':_0x41f8('0x176'),'onDelete':_0x41f8('0x165')});db['ChatApplication'][_0x41f8('0x123')](db[_0x41f8('0x8b')],{'onDelete':_0x41f8('0x165'),'foreignKey':_0x41f8('0x17c')});db[_0x41f8('0x64')][_0x41f8('0x116')](db[_0x41f8('0x66')],{'as':_0x41f8('0x15b'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x41f8('0x123')](db[_0x41f8('0x140')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x176')});db[_0x41f8('0x64')]['belongsTo'](db[_0x41f8('0x6f')],{'as':'Contact','foreignKey':_0x41f8('0x162')});db[_0x41f8('0x64')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x64')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x193'),'as':_0x41f8('0x170')});db['ChatInteraction'][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db[_0x41f8('0x11')],{'as':_0x41f8('0x17f'),'through':_0x41f8('0x12e'),'foreignKey':_0x41f8('0x194')});db[_0x41f8('0x66')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x11')});db[_0x41f8('0x66')]['belongsTo'](db[_0x41f8('0x6f')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x41f8('0x64')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x175'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x41f8('0x123')](db[_0x41f8('0xeb')],{'as':'Attachment','foreignKey':_0x41f8('0x18a')});db[_0x41f8('0x66')]['belongsTo'](db[_0x41f8('0x140')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x176')});db[_0x41f8('0x68')][_0x41f8('0x116')](db[_0x41f8('0xeb')],{'as':_0x41f8('0x174'),'foreignKey':_0x41f8('0x177'),'onDelete':_0x41f8('0x113'),'hooks':!![]});db['ChatOfflineMessage'][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x68')][_0x41f8('0x123')](db[_0x41f8('0x140')],{'as':_0x41f8('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0x41f8('0x137')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x2c'),'hooks':!![]});db[_0x41f8('0x137')]['belongsToMany'](db['Team'],{'through':_0x41f8('0x195'),'as':_0x41f8('0x158')});db[_0x41f8('0x6a')][_0x41f8('0x116')](db[_0x41f8('0x196')],{'as':_0x41f8('0x15b'),'foreignKey':_0x41f8('0x197'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x6a')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x198'),'through':_0x41f8('0x127')});db[_0x41f8('0x6c')][_0x41f8('0x123')](db['ChatWebsite'],{'as':_0x41f8('0x192'),'foreignKey':'ChatWebsiteId'});db[_0x41f8('0x6e')][_0x41f8('0x116')](db[_0x41f8('0x6f')],{'as':'Contacts','foreignKey':_0x41f8('0x199')});db['CmContact'][_0x41f8('0x116')](db[_0x41f8('0x8e')],{'as':_0x41f8('0x19a'),'foreignKey':_0x41f8('0x19b')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db['CmHopper'],{'as':_0x41f8('0x14c'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db[_0x41f8('0x75')],{'as':_0x41f8('0x14d'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x41f8('0x162')});db['CmContact'][_0x41f8('0x116')](db[_0x41f8('0x79')],{'as':_0x41f8('0x79'),'foreignKey':'ContactId'});db[_0x41f8('0x6f')][_0x41f8('0x116')](db['JscriptySessionReport'],{'as':_0x41f8('0x150'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db[_0x41f8('0x5a')],{'as':_0x41f8('0x131'),'foreignKey':_0x41f8('0x162'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db[_0x41f8('0x64')],{'as':'ChatInteractions','foreignKey':_0x41f8('0x162'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db[_0x41f8('0x51')],{'as':'SmsInteractions','foreignKey':_0x41f8('0x162'),'onDelete':'restrict'});db['CmContact']['hasMany'](db['FaxInteraction'],{'as':_0x41f8('0x11d'),'foreignKey':_0x41f8('0x162'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x6f')][_0x41f8('0x116')](db[_0x41f8('0x3c')],{'as':_0x41f8('0x11e'),'foreignKey':_0x41f8('0x162'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x6f')][_0x41f8('0x123')](db['CmCompany'],{'as':_0x41f8('0x19c'),'foreignKey':_0x41f8('0x199')});db[_0x41f8('0x6f')]['belongsTo'](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c'),'onDelete':'cascade'});db[_0x41f8('0x6f')]['belongsToMany'](db[_0x41f8('0x11')],{'as':_0x41f8('0x17f'),'through':_0x41f8('0x129')});db[_0x41f8('0x6f')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'as':_0x41f8('0x170'),'through':_0x41f8('0x19d')});db['CmContact'][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x19d'),'as':'ThroughTags'});db[_0x41f8('0x71')][_0x41f8('0x116')](db['CmHopperAdditionalPhone'],{'as':_0x41f8('0x19e'),'foreignKey':'CmHopperId'});db[_0x41f8('0x71')][_0x41f8('0x123')](db['CmContact'],{'as':'Contact','foreignKey':_0x41f8('0x162'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x71')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x71')]['belongsTo'](db[_0x41f8('0x11')],{'as':_0x41f8('0x18f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x71')][_0x41f8('0x123')](db[_0x41f8('0x18')],{'as':_0x41f8('0x190'),'foreignKey':_0x41f8('0x14b'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x71')]['belongsTo'](db[_0x41f8('0xe7')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x41f8('0x71')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':'Contact','foreignKey':_0x41f8('0x162'),'onDelete':'cascade'});db[_0x41f8('0x73')]['belongsTo'](db['CmList'],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c'),'onDelete':_0x41f8('0x113')});db['CmHopperBlack'][_0x41f8('0x123')](db[_0x41f8('0x18')],{'as':_0x41f8('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x41f8('0x113')});db[_0x41f8('0x73')][_0x41f8('0x123')](db[_0x41f8('0xe7')],{'as':_0x41f8('0xe7'),'foreignKey':_0x41f8('0x19f'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x7f')]['hasMany'](db[_0x41f8('0x1a0')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x41f8('0x7f')][_0x41f8('0x116')](db[_0x41f8('0x1a0')],{'as':{'plural':_0x41f8('0x1a1'),'singular':'OneAny'},'foreignKey':_0x41f8('0x1a2'),'onDelete':_0x41f8('0x113'),'hooks':!![]});db[_0x41f8('0x7f')][_0x41f8('0x116')](db['Action'],{'as':_0x41f8('0x1a3'),'foreignKey':'AutomationId','onDelete':_0x41f8('0x113'),'hooks':!![]});db['Disposition'][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':_0x41f8('0x1a4'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x152')][_0x41f8('0x116')](db[_0x41f8('0x152')],{'as':_0x41f8('0x1a5'),'foreignKey':_0x41f8('0x153'),'onDelete':_0x41f8('0x113'),'hooks':!![],'required':![]});db[_0x41f8('0x152')][_0x41f8('0x116')](db[_0x41f8('0x15')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x41f8('0x165')});db[_0x41f8('0x152')][_0x41f8('0x116')](db[_0x41f8('0x3f')],{'as':_0x41f8('0x1a6'),'foreignKey':'IntervalId'});db[_0x41f8('0x152')][_0x41f8('0x116')](db[_0x41f8('0x62')],{'as':_0x41f8('0x1a7'),'foreignKey':_0x41f8('0x153')});db[_0x41f8('0x152')]['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x41f8('0x152')]['hasMany'](db[_0x41f8('0x50')],{'as':_0x41f8('0x1a8'),'foreignKey':'IntervalId'});db[_0x41f8('0x1a9')][_0x41f8('0x123')](db['MailAccount'],{});db[_0x41f8('0x1a9')][_0x41f8('0x123')](db[_0x41f8('0x1aa')],{'foreignKey':_0x41f8('0x1ab')});db['Schedule'][_0x41f8('0x123')](db[_0x41f8('0x97')],{'foreignKey':_0x41f8('0x1ac')});db[_0x41f8('0x14a')][_0x41f8('0x126')](db[_0x41f8('0x17')],{'as':_0x41f8('0x1ad'),'through':_0x41f8('0x1ae'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x8b')][_0x41f8('0x126')](db[_0x41f8('0x6f')],{'through':'cm_contact_has_tags'});db['Tag'][_0x41f8('0x126')](db[_0x41f8('0x64')],{'through':_0x41f8('0x193')});db[_0x41f8('0x8b')][_0x41f8('0x126')](db[_0x41f8('0x3c')],{'through':'mail_interaction_has_tags'});db[_0x41f8('0x8b')][_0x41f8('0x126')](db['SmsInteraction'],{'through':_0x41f8('0x1af')});db[_0x41f8('0x8b')][_0x41f8('0x126')](db[_0x41f8('0x48')],{'through':_0x41f8('0x17e')});db[_0x41f8('0x8b')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x41f8('0x189')});db[_0x41f8('0x8b')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x41f8('0x1b0')});db[_0x41f8('0x8e')][_0x41f8('0x123')](db[_0x41f8('0x8c')],{'as':_0x41f8('0x1b1'),'foreignKey':_0x41f8('0x1b2')});db[_0x41f8('0x8f')][_0x41f8('0x123')](db[_0x41f8('0x71')],{'as':'Hopper','foreignKey':_0x41f8('0x1b3')});db[_0x41f8('0x8e')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x19b')});db[_0x41f8('0x1b4')][_0x41f8('0x116')](db[_0x41f8('0x1a0')],{'as':{'plural':_0x41f8('0x1b5'),'singular':_0x41f8('0x1b6')},'foreignKey':_0x41f8('0x1b7'),'onDelete':_0x41f8('0x113'),'hooks':!![]});db[_0x41f8('0x1b4')]['hasMany'](db[_0x41f8('0x1a0')],{'as':{'plural':_0x41f8('0x1b8'),'singular':_0x41f8('0x1b9')},'foreignKey':_0x41f8('0x1ba'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x41f8('0x116')](db['Action'],{'as':'Actions','foreignKey':_0x41f8('0x1bb'),'onDelete':_0x41f8('0x113'),'hooks':!![]});db['AnalyticCustomReport'][_0x41f8('0x116')](db[_0x41f8('0x1bc')],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1ac'),'hooks':!![]});db[_0x41f8('0x1aa')][_0x41f8('0x116')](db['AnalyticFieldReport'],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1ab')});db[_0x41f8('0x1be')][_0x41f8('0x116')](db['AnalyticFieldReport'],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':'MetricId'});db[_0x41f8('0x1bc')][_0x41f8('0x123')](db[_0x41f8('0x1be')],{'foreignKey':'MetricId'});db[_0x41f8('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x41f8('0x113'),'foreignKey':'AccountId'});db[_0x41f8('0xa1')][_0x41f8('0x116')](db[_0x41f8('0xa3')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xa1')][_0x41f8('0x116')](db[_0x41f8('0xa3')],{'as':_0x41f8('0x1c1'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c2')});db['SalesforceConfiguration'][_0x41f8('0x116')](db['SalesforceField'],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xa1')][_0x41f8('0x123')](db[_0x41f8('0x9f')],{'as':_0x41f8('0x16e'),'foreignKey':'AccountId'});db[_0x41f8('0xa3')][_0x41f8('0x116')](db[_0x41f8('0xa3')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xa3')][_0x41f8('0x116')](db[_0x41f8('0xa3')],{'as':_0x41f8('0x1c5'),'foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xa3')][_0x41f8('0x116')](db[_0x41f8('0xa3')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xa3')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':_0x41f8('0x1c7')});db[_0x41f8('0x1c8')]['hasMany'](db[_0x41f8('0x1c9')],{'as':_0x41f8('0x1ca'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db['SugarcrmConfiguration'][_0x41f8('0x116')](db[_0x41f8('0xa7')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':'SubjectId'});db[_0x41f8('0x1c9')]['hasMany'](db[_0x41f8('0xa7')],{'as':_0x41f8('0x1c1'),'onDelete':_0x41f8('0x113'),'foreignKey':'DescriptionId'});db[_0x41f8('0x1c9')]['hasMany'](db['SugarcrmField'],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x41f8('0x123')](db[_0x41f8('0x1c8')],{'as':_0x41f8('0x16e'),'foreignKey':'AccountId'});db[_0x41f8('0xa7')][_0x41f8('0x116')](db[_0x41f8('0xa7')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xa7')][_0x41f8('0x116')](db[_0x41f8('0xa7')],{'as':'Description','foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xa7')][_0x41f8('0x116')](db['SugarcrmField'],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db['SugarcrmField'][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':'VariableId'});db[_0x41f8('0xa8')][_0x41f8('0x116')](db[_0x41f8('0xa9')],{'as':_0x41f8('0x1ca'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xa9')][_0x41f8('0x116')](db[_0x41f8('0xaa')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xa9')][_0x41f8('0x116')](db[_0x41f8('0xaa')],{'as':'Descriptions','onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xa9')][_0x41f8('0x116')](db[_0x41f8('0xaa')],{'as':'Fields','onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xa9')][_0x41f8('0x123')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x1cc')});db[_0x41f8('0xaa')]['hasMany'](db[_0x41f8('0xaa')],{'as':'Subject','foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xaa')][_0x41f8('0x116')](db['DeskField'],{'as':'Description','foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xaa')][_0x41f8('0x116')](db[_0x41f8('0xaa')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db['DeskField'][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x41f8('0x116')](db[_0x41f8('0xae')],{'as':'Configurations','onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xae')][_0x41f8('0x116')](db[_0x41f8('0xb0')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':'SubjectId'});db['ZohoConfiguration']['hasMany'](db[_0x41f8('0xb0')],{'as':_0x41f8('0x1c1'),'onDelete':_0x41f8('0x113'),'foreignKey':'DescriptionId'});db[_0x41f8('0xae')][_0x41f8('0x116')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xae')][_0x41f8('0x123')](db['ZohoAccount'],{'as':_0x41f8('0x16e'),'foreignKey':'AccountId'});db['ZohoField'][_0x41f8('0x116')](db[_0x41f8('0xb0')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xb0')][_0x41f8('0x116')](db['ZohoField'],{'as':'Description','foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xb0')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':'Variable','foreignKey':_0x41f8('0x1c7')});db[_0x41f8('0xb1')]['hasMany'](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xb3')]['hasMany'](db['ZendeskField'],{'as':_0x41f8('0x1bf'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xb3')][_0x41f8('0x116')](db[_0x41f8('0xb5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x41f8('0x116')](db[_0x41f8('0xb5')],{'as':_0x41f8('0x1bd'),'foreignKey':_0x41f8('0x1c3')});db['ZendeskConfiguration'][_0x41f8('0x123')](db[_0x41f8('0xb1')],{'as':'Account','foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xb3')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x1cd')});db[_0x41f8('0xb5')][_0x41f8('0x116')](db[_0x41f8('0xb5')],{'as':'Subject','foreignKey':_0x41f8('0x1c0')});db['ZendeskField']['hasMany'](db[_0x41f8('0xb5')],{'as':_0x41f8('0x1c5'),'foreignKey':'DescriptionId'});db[_0x41f8('0xb5')][_0x41f8('0x116')](db[_0x41f8('0xb5')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xb5')]['belongsTo'](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':_0x41f8('0x1c7')});db['FreshdeskAccount'][_0x41f8('0x116')](db['FreshdeskConfiguration'],{'as':_0x41f8('0x1ca'),'onDelete':'cascade','foreignKey':_0x41f8('0x1cb')});db['FreshdeskConfiguration'][_0x41f8('0x116')](db[_0x41f8('0xb8')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xb7')][_0x41f8('0x116')](db[_0x41f8('0xb8')],{'as':_0x41f8('0x1c1'),'onDelete':_0x41f8('0x113'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x41f8('0x116')](db['FreshdeskField'],{'as':_0x41f8('0x1bd'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xb7')]['belongsTo'](db[_0x41f8('0x1ce')],{'as':'Account','foreignKey':_0x41f8('0x1cb')});db['FreshdeskConfiguration'][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':_0x41f8('0x1cf')});db['FreshdeskField'][_0x41f8('0x116')](db[_0x41f8('0xb8')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db['FreshdeskField'][_0x41f8('0x116')](db[_0x41f8('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x41f8('0xb8')][_0x41f8('0x116')](db[_0x41f8('0xb8')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xb8')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':'VariableId'});db[_0x41f8('0xba')][_0x41f8('0x116')](db[_0x41f8('0xbc')],{'as':_0x41f8('0x1ca'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xbc')]['hasMany'](db[_0x41f8('0xbe')],{'as':'Subjects','foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xbc')][_0x41f8('0x116')](db[_0x41f8('0xbe')],{'as':_0x41f8('0x1c1'),'foreignKey':_0x41f8('0x1c2')});db['VtigerConfiguration'][_0x41f8('0x116')](db[_0x41f8('0xbe')],{'as':'Fields','foreignKey':'FieldId'});db[_0x41f8('0xbc')][_0x41f8('0x123')](db[_0x41f8('0xba')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xbe')]['hasMany'](db[_0x41f8('0xbe')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xbe')][_0x41f8('0x116')](db[_0x41f8('0xbe')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x41f8('0xbe')][_0x41f8('0x116')](db[_0x41f8('0xbe')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db['VtigerField'][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':_0x41f8('0x1c7')});db[_0x41f8('0x1d0')][_0x41f8('0x116')](db[_0x41f8('0x1d1')],{'as':_0x41f8('0x1ca'),'onDelete':_0x41f8('0x113'),'foreignKey':'AccountId'});db[_0x41f8('0x1d1')]['hasMany'](db[_0x41f8('0xc2')],{'as':_0x41f8('0x1bf'),'foreignKey':_0x41f8('0x1c0')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x41f8('0x1c1'),'foreignKey':_0x41f8('0x1c2')});db['ServicenowConfiguration']['hasMany'](db[_0x41f8('0xc2')],{'as':_0x41f8('0x1bd'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0x41f8('0x16e'),'foreignKey':'AccountId'});db[_0x41f8('0xc2')][_0x41f8('0x116')](db[_0x41f8('0xc2')],{'as':_0x41f8('0x1c4'),'foreignKey':'SubjectId'});db[_0x41f8('0xc2')][_0x41f8('0x116')](db[_0x41f8('0xc2')],{'as':_0x41f8('0x1c5'),'foreignKey':'DescriptionId'});db[_0x41f8('0xc2')][_0x41f8('0x116')](db[_0x41f8('0xc2')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xc2')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':'VariableId'});db[_0x41f8('0xc4')]['hasMany'](db[_0x41f8('0x1d2')],{'as':_0x41f8('0x1ca'),'onDelete':'cascade','foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xc4')]['belongsTo'](db[_0x41f8('0x10a')],{'as':_0x41f8('0x10a'),'foreignKey':_0x41f8('0x164')});db[_0x41f8('0x1d2')][_0x41f8('0x116')](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1bf'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c0')});db['Dynamics365Configuration'][_0x41f8('0x116')](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1c1'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1c2')});db['Dynamics365Configuration']['hasMany'](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1bd'),'onDelete':'cascade','foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0x1d2')][_0x41f8('0x123')](db[_0x41f8('0xc4')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x1cb')});db[_0x41f8('0xc7')]['hasMany'](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1c4'),'foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xc7')][_0x41f8('0x116')](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1c5'),'foreignKey':_0x41f8('0x1c2')});db[_0x41f8('0xc7')][_0x41f8('0x116')](db[_0x41f8('0xc7')],{'as':_0x41f8('0x1c6'),'foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xc7')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':'Variable','foreignKey':_0x41f8('0x1c7')});db[_0x41f8('0xc9')][_0x41f8('0x116')](db['FreshsalesConfiguration'],{'as':_0x41f8('0x1ca'),'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1cb')});db['FreshsalesConfiguration'][_0x41f8('0x116')](db[_0x41f8('0xcd')],{'as':_0x41f8('0x1bf'),'foreignKey':'SubjectId'});db[_0x41f8('0xcb')][_0x41f8('0x116')](db[_0x41f8('0xcd')],{'as':_0x41f8('0x1c1'),'foreignKey':_0x41f8('0x1c2')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x41f8('0x1bd'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x41f8('0x123')](db[_0x41f8('0xc9')],{'as':'Account','foreignKey':_0x41f8('0x1cb')});db['FreshsalesField'][_0x41f8('0x116')](db[_0x41f8('0xcd')],{'as':'Subject','foreignKey':_0x41f8('0x1c0')});db[_0x41f8('0xcd')]['hasMany'](db[_0x41f8('0xcd')],{'as':_0x41f8('0x1c5'),'foreignKey':'DescriptionId'});db[_0x41f8('0xcd')][_0x41f8('0x116')](db[_0x41f8('0xcd')],{'as':'Field','foreignKey':_0x41f8('0x1c3')});db[_0x41f8('0xcd')][_0x41f8('0x123')](db[_0x41f8('0x93')],{'as':_0x41f8('0x93'),'foreignKey':'VariableId'});db[_0x41f8('0xd1')]['belongsTo'](db['ChatWebsite'],{});db[_0x41f8('0xd1')][_0x41f8('0x123')](db['CmList'],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0xd1')]['belongsTo'](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0xd1')][_0x41f8('0x123')](db[_0x41f8('0x64')],{});db['ChatQueueReport'][_0x41f8('0x123')](db['ChatMessage'],{});db['ChatQueueReport'][_0x41f8('0x123')](db[_0x41f8('0x11')],{});db[_0x41f8('0xd1')][_0x41f8('0x123')](db['ChatQueue'],{});db[_0x41f8('0x196')]['belongsTo'](db[_0x41f8('0x11')],{'onDelete':'cascade','foreignKey':_0x41f8('0x1d3')});db[_0x41f8('0x196')][_0x41f8('0x123')](db['User'],{'onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1d4')});db[_0x41f8('0xd6')][_0x41f8('0x116')](db[_0x41f8('0x1d5')],{'foreignKey':_0x41f8('0x1d6'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0xd6')][_0x41f8('0x116')](db[_0x41f8('0xd3')],{'foreignKey':_0x41f8('0x1d6'),'onDelete':'cascade'});db['SmsQueueReport'][_0x41f8('0x123')](db[_0x41f8('0x180')],{});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':'List','foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':_0x41f8('0x161'),'foreignKey':'ContactId'});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db['SmsInteraction'],{});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db[_0x41f8('0x53')],{});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db[_0x41f8('0x11')],{});db[_0x41f8('0x1d7')][_0x41f8('0x123')](db[_0x41f8('0x55')],{});db[_0x41f8('0xdc')][_0x41f8('0x116')](db[_0x41f8('0xd6')],{'foreignKey':_0x41f8('0x1d8')});db[_0x41f8('0xdc')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x41f8('0x1d8')});db['JscriptyProject'][_0x41f8('0x116')](db[_0x41f8('0xd3')],{'foreignKey':_0x41f8('0x1d8')});db[_0x41f8('0xe5')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x12c')});db['Team'][_0x41f8('0x126')](db['VoiceQueue'],{'through':_0x41f8('0x10b'),'as':_0x41f8('0x134')});db[_0x41f8('0xe5')][_0x41f8('0x126')](db['MailQueue'],{'through':_0x41f8('0x16d'),'as':_0x41f8('0x136')});db[_0x41f8('0xe5')][_0x41f8('0x126')](db[_0x41f8('0x137')],{'through':'team_has_chat_queues','as':_0x41f8('0x138')});db[_0x41f8('0xe5')]['belongsToMany'](db['FaxQueue'],{'through':_0x41f8('0x1d9'),'as':'FaxQueues'});db[_0x41f8('0xe5')][_0x41f8('0x126')](db[_0x41f8('0x55')],{'through':_0x41f8('0x184'),'as':_0x41f8('0x13a')});db['Team'][_0x41f8('0x126')](db[_0x41f8('0x5e')],{'through':_0x41f8('0x18b'),'as':_0x41f8('0x13c')});db[_0x41f8('0xe5')][_0x41f8('0x126')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x41f8('0xe5')][_0x41f8('0x126')](db['VoicePrefix'],{'through':_0x41f8('0x10d'),'as':_0x41f8('0x135')});db[_0x41f8('0xe7')][_0x41f8('0x116')](db[_0x41f8('0x71')],{'as':'Hoppers','foreignKey':_0x41f8('0x19f')});db[_0x41f8('0xe7')][_0x41f8('0x116')](db['CmHopperFinal'],{'as':_0x41f8('0x14d'),'foreignKey':_0x41f8('0x19f')});db[_0x41f8('0xe7')][_0x41f8('0x116')](db[_0x41f8('0x77')],{'as':_0x41f8('0x14e'),'foreignKey':_0x41f8('0x19f')});db[_0x41f8('0xe7')][_0x41f8('0x116')](db[_0x41f8('0x73')],{'as':_0x41f8('0x14f'),'foreignKey':_0x41f8('0x19f')});db['Campaign'][_0x41f8('0x123')](db[_0x41f8('0x28')],{'as':_0x41f8('0x28'),'foreignKey':_0x41f8('0x151')});db[_0x41f8('0xe7')][_0x41f8('0x123')](db[_0x41f8('0x28')],{'as':_0x41f8('0x1da'),'foreignKey':_0x41f8('0x1db')});db[_0x41f8('0xe7')][_0x41f8('0x123')](db['Interval'],{'as':_0x41f8('0x152'),'foreignKey':_0x41f8('0x153')});db[_0x41f8('0xe7')][_0x41f8('0x123')](db[_0x41f8('0xe0')],{'as':'SquareProject','foreignKey':_0x41f8('0x1dc')});db[_0x41f8('0xe7')][_0x41f8('0x126')](db['CmList'],{'as':'Lists','through':_0x41f8('0x1dd')});db['Campaign'][_0x41f8('0x126')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x159'),'through':_0x41f8('0x1de')});db[_0x41f8('0xeb')][_0x41f8('0x123')](db[_0x41f8('0x68')],{'as':_0x41f8('0x68'),'foreignKey':_0x41f8('0x177')});db[_0x41f8('0xef')][_0x41f8('0x123')](db['MailMessage'],{});db[_0x41f8('0xef')]['belongsTo'](db[_0x41f8('0x3c')],{});db['MailTransferReport'][_0x41f8('0x123')](db[_0x41f8('0x38')],{'foreignKey':'FromMailAccountId','as':_0x41f8('0x1df')});db[_0x41f8('0xef')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e0'),'as':_0x41f8('0x1e1')});db[_0x41f8('0xef')]['belongsTo'](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e2'),'as':_0x41f8('0x1e3')});db[_0x41f8('0xef')][_0x41f8('0x123')](db[_0x41f8('0x39')],{'foreignKey':_0x41f8('0x1e4'),'as':_0x41f8('0x1e5')});db['MailTransferReport']['belongsTo'](db[_0x41f8('0x38')],{'foreignKey':_0x41f8('0x1e6'),'as':_0x41f8('0x1e7')});db[_0x41f8('0xf1')][_0x41f8('0x123')](db[_0x41f8('0x66')],{});db[_0x41f8('0xf1')]['belongsTo'](db[_0x41f8('0x64')],{});db[_0x41f8('0xf1')][_0x41f8('0x123')](db[_0x41f8('0x140')],{'foreignKey':_0x41f8('0x1e8'),'as':_0x41f8('0x1df')});db[_0x41f8('0xf1')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':'FromUserId','as':_0x41f8('0x1e1')});db[_0x41f8('0xf1')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e2'),'as':_0x41f8('0x1e3')});db[_0x41f8('0xf1')][_0x41f8('0x123')](db[_0x41f8('0x137')],{'foreignKey':_0x41f8('0x1e9'),'as':'ToQueue'});db[_0x41f8('0xf1')]['belongsTo'](db[_0x41f8('0x140')],{'foreignKey':_0x41f8('0x1ea'),'as':_0x41f8('0x1e7')});db['FaxTransferReport'][_0x41f8('0x123')](db[_0x41f8('0x4a')],{});db[_0x41f8('0xf3')][_0x41f8('0x123')](db['FaxInteraction'],{});db[_0x41f8('0xf3')][_0x41f8('0x123')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x41f8('0x1df')});db[_0x41f8('0xf3')]['belongsTo'](db[_0x41f8('0x11')],{'foreignKey':'FromUserId','as':_0x41f8('0x1e1')});db[_0x41f8('0xf3')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e2'),'as':_0x41f8('0x1e3')});db[_0x41f8('0xf3')][_0x41f8('0x123')](db[_0x41f8('0x4c')],{'foreignKey':_0x41f8('0x1eb'),'as':_0x41f8('0x1e5')});db['FaxTransferReport']['belongsTo'](db[_0x41f8('0x44')],{'foreignKey':_0x41f8('0x1ec'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x41f8('0x123')](db[_0x41f8('0x5c')],{});db['OpenchannelTransferReport'][_0x41f8('0x123')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x41f8('0x123')](db[_0x41f8('0x57')],{'foreignKey':_0x41f8('0x1ed'),'as':_0x41f8('0x1df')});db[_0x41f8('0xf5')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x41f8('0x1e1')});db[_0x41f8('0xf5')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e2'),'as':_0x41f8('0x1e3')});db[_0x41f8('0xf5')][_0x41f8('0x123')](db[_0x41f8('0x5e')],{'foreignKey':_0x41f8('0x1ee'),'as':_0x41f8('0x1e5')});db[_0x41f8('0xf5')][_0x41f8('0x123')](db[_0x41f8('0x57')],{'foreignKey':_0x41f8('0x1ef'),'as':_0x41f8('0x1e7')});db['SmsTransferReport']['belongsTo'](db[_0x41f8('0x53')],{});db[_0x41f8('0xf7')][_0x41f8('0x123')](db[_0x41f8('0x51')],{});db[_0x41f8('0xf7')]['belongsTo'](db[_0x41f8('0x180')],{'foreignKey':_0x41f8('0x1f0'),'as':_0x41f8('0x1df')});db[_0x41f8('0xf7')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e0'),'as':_0x41f8('0x1e1')});db[_0x41f8('0xf7')]['belongsTo'](db[_0x41f8('0x11')],{'foreignKey':_0x41f8('0x1e2'),'as':_0x41f8('0x1e3')});db[_0x41f8('0xf7')]['belongsTo'](db[_0x41f8('0x55')],{'foreignKey':_0x41f8('0x1f1'),'as':'ToQueue'});db[_0x41f8('0xf7')]['belongsTo'](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x41f8('0x13f')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':'ListId','onDelete':_0x41f8('0x113')});db[_0x41f8('0x13f')][_0x41f8('0x116')](db[_0x41f8('0x7b')],{'as':_0x41f8('0x1f2'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x13f')][_0x41f8('0x116')](db[_0x41f8('0x6f')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x41f8('0x16c')});db['CmList'][_0x41f8('0x116')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x41f8('0x77')],{'as':_0x41f8('0x11b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x13f')][_0x41f8('0x116')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x13f')][_0x41f8('0x126')](db['VoiceQueue'],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x41f8('0x13f')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':_0x41f8('0x12b')});db[_0x41f8('0xf8')][_0x41f8('0x116')](db[_0x41f8('0x15')],{'as':_0x41f8('0x11a'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0xf8')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':'Agents','through':_0x41f8('0x10e')});db['VoicePrefix'][_0x41f8('0x126')](db['Team'],{'through':_0x41f8('0x10d'),'as':_0x41f8('0x158')});db[_0x41f8('0x124')][_0x41f8('0x116')](db[_0x41f8('0x11')],{'as':'Users','foreignKey':_0x41f8('0x125')});db[_0x41f8('0x124')][_0x41f8('0x116')](db[_0x41f8('0xfa')],{'as':_0x41f8('0x1f3'),'foreignKey':_0x41f8('0x125'),'onDelete':_0x41f8('0x113')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x41f8('0x1f4'),'foreignKey':_0x41f8('0x1f5'),'onDelete':_0x41f8('0x113')});db[_0x41f8('0x100')][_0x41f8('0x116')](db[_0x41f8('0x82')],{'as':_0x41f8('0x167'),'foreignKey':'WhatsappAccountId','onDelete':_0x41f8('0x113')});db[_0x41f8('0x100')][_0x41f8('0x116')](db['CannedAnswer'],{'as':_0x41f8('0x168'),'foreignKey':_0x41f8('0x1f6')});db[_0x41f8('0x100')][_0x41f8('0x116')](db[_0x41f8('0x105')],{'as':'Messages','foreignKey':_0x41f8('0x1f6')});db[_0x41f8('0x100')]['hasMany'](db[_0x41f8('0x104')],{'as':_0x41f8('0x169')});db[_0x41f8('0x100')]['hasMany'](db[_0x41f8('0x102')],{'as':_0x41f8('0x16a'),'foreignKey':'WhatsappAccountId','onDelete':_0x41f8('0x113')});db[_0x41f8('0x100')][_0x41f8('0x123')](db['CmList'],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x100')][_0x41f8('0x123')](db[_0x41f8('0x85')],{'as':_0x41f8('0x154'),'foreignKey':_0x41f8('0x155')});db['WhatsappAccount']['belongsToMany'](db[_0x41f8('0x11')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x41f8('0x102')]['belongsTo'](db[_0x41f8('0x11')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x41f8('0x123')](db[_0x41f8('0x108')],{'onDelete':_0x41f8('0x165')});db[_0x41f8('0x102')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x41f8('0x165')});db['WhatsappApplication'][_0x41f8('0x123')](db[_0x41f8('0x152')],{'onDelete':'restrict','foreignKey':_0x41f8('0x153')});db[_0x41f8('0x102')]['belongsTo'](db[_0x41f8('0x8b')],{'onDelete':_0x41f8('0x165'),'foreignKey':'TagId'});db[_0x41f8('0x104')][_0x41f8('0x116')](db[_0x41f8('0x105')],{'as':'Messages','onDelete':_0x41f8('0x113'),'foreignKey':_0x41f8('0x1f7')});db[_0x41f8('0x104')][_0x41f8('0x123')](db[_0x41f8('0x100')],{'as':_0x41f8('0x16e'),'foreignKey':_0x41f8('0x1f6')});db['WhatsappInteraction'][_0x41f8('0x123')](db[_0x41f8('0x6f')],{'as':'Contact','foreignKey':_0x41f8('0x162')});db['WhatsappInteraction'][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x16f'),'foreignKey':_0x41f8('0x119')});db[_0x41f8('0x104')][_0x41f8('0x126')](db['Tag'],{'through':_0x41f8('0x1b0'),'as':'Tags'});db[_0x41f8('0x104')][_0x41f8('0x126')](db[_0x41f8('0x8b')],{'through':'whatsapp_interaction_has_tags','as':_0x41f8('0x171')});db[_0x41f8('0x104')][_0x41f8('0x126')](db[_0x41f8('0x11')],{'as':'Users','through':_0x41f8('0x133'),'foreignKey':_0x41f8('0x1f7')});db[_0x41f8('0x105')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'as':_0x41f8('0x11')});db[_0x41f8('0x105')][_0x41f8('0x123')](db['CmContact'],{'onDelete':_0x41f8('0x113'),'as':'Contact'});db[_0x41f8('0x105')]['belongsTo'](db[_0x41f8('0x104')],{'onDelete':_0x41f8('0x113'),'as':_0x41f8('0x175'),'foreignKey':_0x41f8('0x1f7')});db[_0x41f8('0x105')][_0x41f8('0x123')](db[_0x41f8('0x100')],{'as':'Account','foreignKey':_0x41f8('0x1f6')});db[_0x41f8('0x107')]['belongsTo'](db['WhatsappAccount'],{});db[_0x41f8('0x107')][_0x41f8('0x123')](db[_0x41f8('0x13f')],{'as':_0x41f8('0x16b'),'foreignKey':_0x41f8('0x16c')});db[_0x41f8('0x107')][_0x41f8('0x123')](db['CmContact'],{'as':_0x41f8('0x161'),'foreignKey':_0x41f8('0x162')});db[_0x41f8('0x107')][_0x41f8('0x123')](db[_0x41f8('0x104')],{});db[_0x41f8('0x107')][_0x41f8('0x123')](db[_0x41f8('0x108')],{});db[_0x41f8('0x107')][_0x41f8('0x123')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x41f8('0x123')](db['User'],{});db[_0x41f8('0x1f8')][_0x41f8('0x123')](db['WhatsappMessage'],{});db[_0x41f8('0x1f8')][_0x41f8('0x123')](db[_0x41f8('0x104')],{});db[_0x41f8('0x1f8')]['belongsTo'](db[_0x41f8('0x100')],{'foreignKey':_0x41f8('0x1f9'),'as':_0x41f8('0x1df')});db[_0x41f8('0x1f8')][_0x41f8('0x123')](db[_0x41f8('0x100')],{'foreignKey':_0x41f8('0x1fa'),'as':'ToAccount'});db[_0x41f8('0x1f8')][_0x41f8('0x123')](db[_0x41f8('0x108')],{'foreignKey':_0x41f8('0x1fb'),'as':_0x41f8('0x1e5')});db[_0x41f8('0x1f8')]['belongsTo'](db[_0x41f8('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x41f8('0x1f8')][_0x41f8('0x123')](db[_0x41f8('0x11')],{'foreignKey':'ToUserId','as':_0x41f8('0x1e3')});db[_0x41f8('0x108')]['belongsToMany'](db[_0x41f8('0x11')],{'as':_0x41f8('0x157'),'through':'UserWhatsappQueue','foreignKey':_0x41f8('0x1fc')});db[_0x41f8('0x108')][_0x41f8('0x126')](db[_0x41f8('0xe5')],{'through':_0x41f8('0x1fd'),'as':_0x41f8('0x158')});db['UserSetting']['belongsTo'](db[_0x41f8('0x11')],{'as':_0x41f8('0x1fe'),'foreignKey':'UserId','onDelete':_0x41f8('0x113'),'hooks':!![]});db[_0x41f8('0x10a')]['hasOne'](db[_0x41f8('0xc4')],{'as':_0x41f8('0xc4'),'onDelete':_0x41f8('0x165')});db[_0x41f8('0x10a')][_0x41f8('0x112')](db[_0x41f8('0x36')],{'as':'Imap','onDelete':'restrict'});db[_0x41f8('0x10a')][_0x41f8('0x112')](db[_0x41f8('0x166')],{'as':'Smtp','onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x412a=['ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','MailInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotification','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','VoicePrefix','VoicePrefixes','UserVoicePrefix','MailQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','ChatWebsiteId','List','ContactId','Items','FaxAccountId','Exntensions','FaxApplication','TagId','fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','UserFaxQueue','SmsAccountId','sms_interaction_has_tags','Users','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','Variable','VariableId','SugarcrmField','DeskConfiguration','DeskAccount','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','ChatQueues','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','Resources','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','utf8','utf8_general_ci','sequelizeHistory','xcall','127.0.0.1','mysql','utf8mb4','database','username','password','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','Tag'];(function(_0x3e8dab,_0x4109c2){var _0x299b2c=function(_0x329714){while(--_0x329714){_0x3e8dab['push'](_0x3e8dab['shift']());}};_0x299b2c(++_0x4109c2);}(_0x412a,0x17f));var _0xa412=function(_0x524ce8,_0x2ad225){_0x524ce8=_0x524ce8-0x0;var _0x3737d7=_0x412a[_0x524ce8];return _0x3737d7;};'use strict';var config=require(_0xa412('0x0'));var Sequelize=require(_0xa412('0x1'));var _=require(_0xa412('0x2'));var jstz=require(_0xa412('0x3'));var timezone=jstz['determine']();config[_0xa412('0x1')]=_[_0xa412('0x4')](config[_0xa412('0x1')],{'database':_0xa412('0x5'),'username':'xcall','password':_0xa412('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa412('0x7'),'collate':_0xa412('0x8')}}});config[_0xa412('0x9')]=_['defaultsDeep'](config[_0xa412('0x9')],{'database':'motion2','username':_0xa412('0xa'),'password':_0xa412('0x6'),'options':{'host':_0xa412('0xb'),'port':0xcea,'dialect':_0xa412('0xc'),'dialectOptions':{'charset':_0xa412('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa412('0x7'),'collate':_0xa412('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xa412('0xe')],config[_0xa412('0x1')][_0xa412('0xf')],config['sequelize'][_0xa412('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xa412('0xe')],config[_0xa412('0x9')][_0xa412('0xf')],config[_0xa412('0x9')][_0xa412('0x10')],config[_0xa412('0x9')]['options'])};db[_0xa412('0x11')]=db[_0xa412('0x1')]['import'](_0xa412('0x12'));db['VoiceChanSpy']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x14'));db[_0xa412('0x15')]=db[_0xa412('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0xa412('0x16')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x17'));db['VoiceMusicOnHold']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x18'));db['VoiceQueue']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x19'));db[_0xa412('0x1a')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x1b'));db[_0xa412('0x1c')]=db['sequelize'][_0xa412('0x13')]('../api/screenRecording/screenRecording.model');db[_0xa412('0x1d')]=db['sequelize']['import'](_0xa412('0x1e'));db[_0xa412('0x1f')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x20'));db['VoiceCallReport']=db[_0xa412('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xa412('0x21')]=db['sequelize']['import'](_0xa412('0x22'));db['VoiceAgentReport']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x23'));db['VoiceQueueReport']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x24'));db[_0xa412('0x25')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/memberReport/memberReport.model');db[_0xa412('0x26')]=db[_0xa412('0x1')]['import']('../api/trunk/trunk.model');db[_0xa412('0x27')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x28'));db[_0xa412('0x29')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x2a'));db['UserVoiceQueue']=db['sequelize'][_0xa412('0x13')](_0xa412('0x2b'));db[_0xa412('0x2c')]=db['sequelize']['import'](_0xa412('0x2d'));db[_0xa412('0x2e')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x2f'));db['UserFaxQueue']=db[_0xa412('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xa412('0x30')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xa412('0x31')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xa412('0x32')]=db['sequelize']['import'](_0xa412('0x33'));db['MailServerIn']=db['sequelize'][_0xa412('0x13')](_0xa412('0x34'));db[_0xa412('0x35')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x36'));db[_0xa412('0x37')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x38'));db[_0xa412('0x39')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x3a'));db[_0xa412('0x3b')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x3c'));db['MailInteraction']=db['sequelize'][_0xa412('0x13')](_0xa412('0x3d'));db['MailMessage']=db[_0xa412('0x1')][_0xa412('0x13')]('../api/mailMessage/mailMessage.model');db[_0xa412('0x3e')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x3f'));db[_0xa412('0x40')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x41'));db[_0xa412('0x42')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x43'));db[_0xa412('0x44')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x45'));db['FaxAccount']=db['sequelize'][_0xa412('0x13')](_0xa412('0x46'));db['FaxApplication']=db[_0xa412('0x1')]['import'](_0xa412('0x47'));db[_0xa412('0x48')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x49'));db[_0xa412('0x4a')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x4b'));db[_0xa412('0x4c')]=db['sequelize']['import'](_0xa412('0x4d'));db[_0xa412('0x4e')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x4f'));db['SmsAccount']=db[_0xa412('0x1')]['import'](_0xa412('0x50'));db[_0xa412('0x51')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x52'));db['SmsInteraction']=db[_0xa412('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db[_0xa412('0x53')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x54'));db[_0xa412('0x55')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x56'));db[_0xa412('0x57')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x58'));db[_0xa412('0x59')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x5a'));db[_0xa412('0x5b')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x5c'));db[_0xa412('0x5d')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x5e'));db['OpenchannelQueue']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x5f'));db[_0xa412('0x60')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xa412('0x61')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x62'));db[_0xa412('0x63')]=db[_0xa412('0x1')]['import'](_0xa412('0x64'));db[_0xa412('0x65')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x66'));db[_0xa412('0x67')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x68'));db[_0xa412('0x69')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x6a'));db[_0xa412('0x6b')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x6c'));db['ChatGroup']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x6d'));db[_0xa412('0x6e')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x6f'));db[_0xa412('0x70')]=db['sequelize']['import'](_0xa412('0x71'));db[_0xa412('0x72')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/cmContact/cmContact.model');db[_0xa412('0x73')]=db[_0xa412('0x1')]['import'](_0xa412('0x74'));db[_0xa412('0x75')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db['sequelize'][_0xa412('0x13')](_0xa412('0x76'));db[_0xa412('0x77')]=db[_0xa412('0x1')]['import'](_0xa412('0x78'));db[_0xa412('0x79')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x7a'));db['CmCustomField']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x7b'));db[_0xa412('0x7c')]=db[_0xa412('0x1')]['import'](_0xa412('0x7d'));db[_0xa412('0x7e')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x7f'));db[_0xa412('0x80')]=db[_0xa412('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xa412('0x81')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x82'));db[_0xa412('0x83')]=db[_0xa412('0x1')]['import'](_0xa412('0x84'));db['Interval']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x85'));db['Pause']=db[_0xa412('0x1')][_0xa412('0x13')]('../api/pause/pause.model');db[_0xa412('0x86')]=db[_0xa412('0x1')]['import'](_0xa412('0x87'));db[_0xa412('0x88')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x89'));db['Schedule']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x8a'));db[_0xa412('0x8b')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/sound/sound.model');db[_0xa412('0x8c')]=db[_0xa412('0x1')]['import']('../api/tag/tag.model');db[_0xa412('0x8d')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/contactItemType/contactItemType.model');db[_0xa412('0x8e')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x8f'));db[_0xa412('0x90')]=db[_0xa412('0x1')]['import'](_0xa412('0x91'));db[_0xa412('0x92')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x93'));db[_0xa412('0x94')]=db[_0xa412('0x1')]['import'](_0xa412('0x95'));db['Variable']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x96'));db['Integration']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x97'));db[_0xa412('0x98')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x99'));db[_0xa412('0x9a')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xa412('0x9b')]=db[_0xa412('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xa412('0x9c')]=db['sequelize'][_0xa412('0x13')](_0xa412('0x9d'));db[_0xa412('0x9e')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xa412('0x9f')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xa412('0x1')]['import'](_0xa412('0xa0'));db[_0xa412('0xa1')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xa2'));db[_0xa412('0xa3')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xa412('0xa4')]=db[_0xa412('0x1')]['import'](_0xa412('0xa5'));db[_0xa412('0xa6')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xa7'));db[_0xa412('0xa8')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xa9'));db['SugarcrmField']=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xaa'));db['DeskConfiguration']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xab'));db[_0xa412('0xac')]=db['sequelize']['import'](_0xa412('0xad'));db[_0xa412('0xae')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xaf'));db[_0xa412('0xb0')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xb1'));db[_0xa412('0xb2')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xa412('0x1')]['import'](_0xa412('0xb3'));db[_0xa412('0xb4')]=db[_0xa412('0x1')]['import'](_0xa412('0xb5'));db[_0xa412('0xb6')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xa412('0xb7')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xb8'));db[_0xa412('0xb9')]=db[_0xa412('0x1')]['import'](_0xa412('0xba'));db[_0xa412('0xbb')]=db['sequelize']['import'](_0xa412('0xbc'));db[_0xa412('0xbd')]=db['sequelize'][_0xa412('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xa412('0xbe')]=db['sequelize'][_0xa412('0x13')](_0xa412('0xbf'));db[_0xa412('0xc0')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xa412('0xc1')]=db['sequelize'][_0xa412('0x13')](_0xa412('0xc2'));db[_0xa412('0xc3')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xa412('0xc4')]=db[_0xa412('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize'][_0xa412('0x13')](_0xa412('0xc5'));db[_0xa412('0xc6')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xa412('0xc7')]=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xa412('0xc8')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xc9'));db[_0xa412('0xca')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xcb'));db[_0xa412('0xcc')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/integration/integration.model');db[_0xa412('0xcd')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xce'));db[_0xa412('0xcf')]=db['sequelize'][_0xa412('0x13')](_0xa412('0xd0'));db['ChatInternalMessage']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xd1'));db[_0xa412('0xd2')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xa412('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xd3'));db[_0xa412('0xd4')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xd5'));db[_0xa412('0xd6')]=db[_0xa412('0x1')]['import'](_0xa412('0xd7'));db[_0xa412('0xd8')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xd9'));db[_0xa412('0xda')]=db['sequelize']['import'](_0xa412('0xdb'));db[_0xa412('0xdc')]=db[_0xa412('0x1')]['import'](_0xa412('0xdd'));db[_0xa412('0xde')]=db[_0xa412('0x1')]['import']('../api/squareProject/squareProject.model');db[_0xa412('0xdf')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xe0'));db[_0xa412('0xe1')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xe2'));db[_0xa412('0xe3')]=db['sequelize'][_0xa412('0x13')](_0xa412('0xe4'));db[_0xa412('0xe5')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xe6'));db['Campaign']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xe7'));db['Migration']=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xe8'));db[_0xa412('0xe9')]=db[_0xa412('0x1')]['import']('../api/attachment/attachment.model');db[_0xa412('0xea')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xeb'));db[_0xa412('0xec')]=db['sequelize']['import'](_0xa412('0xed'));db[_0xa412('0xee')]=db[_0xa412('0x1')]['import'](_0xa412('0xef'));db['FaxTransferReport']=db[_0xa412('0x1')]['import'](_0xa412('0xf0'));db[_0xa412('0xf1')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xf2'));db[_0xa412('0xf3')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xf4'));db[_0xa412('0xf5')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xf6'));db['VoicePrefix']=db[_0xa412('0x1')]['import'](_0xa412('0xf7'));db[_0xa412('0xf8')]=db[_0xa412('0x1')]['import'](_0xa412('0xf9'));db[_0xa412('0xfa')]=db[_0xa412('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0xa412('0xfb')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0xfc'));db['UserNotification']=db['sequelize']['import'](_0xa412('0xfd'));db[_0xa412('0xfe')]=db[_0xa412('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xa412('0xff')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x100'));db['WhatsappInteraction']=db['sequelize'][_0xa412('0x13')](_0xa412('0x101'));db[_0xa412('0x102')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x103'));db[_0xa412('0x104')]=db[_0xa412('0x1')]['import'](_0xa412('0x105'));db[_0xa412('0x106')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x107'));db['WhatsappQueue']=db['sequelize'][_0xa412('0x13')](_0xa412('0x108'));db[_0xa412('0x109')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x10a'));db[_0xa412('0x10b')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x10c'));db[_0xa412('0x10d')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xa412('0x1')]['import'](_0xa412('0x10e'));db[_0xa412('0x10f')]=db[_0xa412('0x1')][_0xa412('0x13')]('../api/user-setting/user-setting.model');db[_0xa412('0x110')]=db[_0xa412('0x1')][_0xa412('0x13')](_0xa412('0x111'));db['User'][_0xa412('0x112')](db[_0xa412('0x1d')],{'as':_0xa412('0x1d'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x112')](db[_0xa412('0x10f')],{'as':'userSetting','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x114')});db['User'][_0xa412('0x115')](db['VoiceRecording'],{'as':_0xa412('0x116'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')]['hasMany'](db[_0xa412('0x29')],{'as':_0xa412('0x117'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x16')],{'as':_0xa412('0x118'),'onDelete':_0xa412('0x113'),'hooks':!![]});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x119')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x77')],{'as':'HopperHistory','foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x79')],{'as':_0xa412('0x79'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')]['hasMany'](db[_0xa412('0x5b')],{'as':_0xa412('0x11a'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x65')],{'as':_0xa412('0x11b'),'foreignKey':'UserId'});db[_0xa412('0x11')]['hasMany'](db[_0xa412('0x11c')],{'as':_0xa412('0x11d'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x115')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xa412('0x114')});db[_0xa412('0x11')]['hasMany'](db[_0xa412('0x11e')],{'as':_0xa412('0x11f'),'foreignKey':'UserId'});db['User'][_0xa412('0x115')](db[_0xa412('0x120')],{'as':_0xa412('0x121'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11')][_0xa412('0x115')](db[_0xa412('0x122')],{'as':_0xa412('0x123'),'foreignKey':_0xa412('0x124')});db['User']['hasMany'](db['CmHopper'],{'as':_0xa412('0x125'),'foreignKey':_0xa412('0x114'),'onDelete':_0xa412('0x126')});db['User'][_0xa412('0x127')](db[_0xa412('0xf8')],{'as':'UserProfile','foreignKey':_0xa412('0x128')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x12a')],{'as':_0xa412('0x12b'),'through':_0xa412('0x12c')});db[_0xa412('0x11')]['belongsToMany'](db[_0xa412('0x72')],{'as':_0xa412('0x12d'),'through':_0xa412('0x12e')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0xf5')],{'as':_0xa412('0x12f'),'through':_0xa412('0x130')});db['User'][_0xa412('0x129')](db[_0xa412('0xe3')],{'through':'user_has_teams'});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x11e')],{'as':_0xa412('0x11f'),'through':_0xa412('0x131')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x65')],{'as':_0xa412('0x11b'),'through':_0xa412('0x132')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x48')],{'as':_0xa412('0x133'),'through':_0xa412('0x134')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x11c')],{'as':'SmsInteractions','through':_0xa412('0x135')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xa412('0x136')});db[_0xa412('0x11')][_0xa412('0x129')](db['WhatsappInteraction'],{'as':_0xa412('0x121'),'through':'user_has_whatsapp_interactions'});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x137')],{'as':_0xa412('0x138'),'through':_0xa412('0x139'),'required':![]});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x13a')],{'as':_0xa412('0x13b'),'through':_0xa412('0x13c'),'required':![]});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x39')],{'as':_0xa412('0x13d'),'through':_0xa412('0x2e'),'required':![]});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x6b')],{'as':'ChatQueues','through':_0xa412('0x2c'),'required':![],'hooks':!![]});db['User'][_0xa412('0x129')](db[_0xa412('0x4c')],{'as':_0xa412('0x13e'),'through':'UserFaxQueue','required':![]});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x55')],{'as':_0xa412('0x13f'),'through':_0xa412('0x30'),'required':![]});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x140')],{'as':_0xa412('0x141'),'through':_0xa412('0x31'),'required':![]});db['User'][_0xa412('0x129')](db[_0xa412('0x142')],{'as':_0xa412('0x143'),'through':_0xa412('0x32'),'required':![]});db['User'][_0xa412('0x129')](db[_0xa412('0xf5')],{'through':'cm_user_has_lists'});db[_0xa412('0x11')]['belongsToMany'](db[_0xa412('0x60')],{'as':_0xa412('0x144'),'through':_0xa412('0x145')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x146')],{'as':_0xa412('0x147'),'through':'user_has_fax_accounts'});db['User'][_0xa412('0x129')](db['MailAccount'],{'as':_0xa412('0x148'),'through':_0xa412('0x149')});db[_0xa412('0x11')][_0xa412('0x129')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xa412('0x14a')});db[_0xa412('0x11')][_0xa412('0x129')](db[_0xa412('0x14b')],{'as':_0xa412('0x14c'),'through':_0xa412('0x14d')});db['User'][_0xa412('0x129')](db['WhatsappAccount'],{'as':_0xa412('0x14e'),'through':_0xa412('0x14f')});db[_0xa412('0x150')][_0xa412('0x115')](db[_0xa412('0x16')],{'as':'SpiedAgents','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x151')});db[_0xa412('0x15')]['hasMany'](db[_0xa412('0x16')],{'onDelete':'cascade'});db[_0xa412('0x16')][_0xa412('0x115')](db[_0xa412('0x16')],{'as':_0xa412('0x152'),'onDelete':_0xa412('0x113')});db['VoiceMusicOnHold'][_0xa412('0x129')](db[_0xa412('0x8b')],{'as':_0xa412('0x153'),'through':_0xa412('0x154')});db[_0xa412('0x137')][_0xa412('0x115')](db[_0xa412('0x29')],{'as':_0xa412('0x155'),'foreignKey':_0xa412('0x156')});db['VoiceQueue'][_0xa412('0x115')](db[_0xa412('0x73')],{'as':_0xa412('0x125'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xa412('0x119')],{'as':_0xa412('0x157'),'foreignKey':'VoiceQueueId'});db[_0xa412('0x137')][_0xa412('0x115')](db[_0xa412('0x77')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xa412('0x137')][_0xa412('0x115')](db[_0xa412('0x79')],{'as':_0xa412('0x79'),'foreignKey':_0xa412('0x156')});db[_0xa412('0x137')][_0xa412('0x115')](db[_0xa412('0x75')],{'as':_0xa412('0x158'),'foreignKey':'VoiceQueueId'});db[_0xa412('0x137')]['hasMany'](db[_0xa412('0x159')],{'as':_0xa412('0x15a'),'foreignKey':_0xa412('0x156')});db[_0xa412('0x137')][_0xa412('0x127')](db[_0xa412('0x26')],{'as':_0xa412('0x26'),'foreignKey':_0xa412('0x15b')});db['VoiceQueue']['belongsTo'](db[_0xa412('0x26')],{'as':_0xa412('0x15c'),'foreignKey':_0xa412('0x15d')});db[_0xa412('0x137')]['belongsTo'](db[_0xa412('0x15e')],{'as':_0xa412('0x15e'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x137')][_0xa412('0x127')](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':_0xa412('0x162')});db['VoiceQueue'][_0xa412('0x129')](db[_0xa412('0xf5')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xa412('0x137')]['belongsToMany'](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':'UserVoiceQueue'});db[_0xa412('0x137')][_0xa412('0x129')](db['Team'],{'as':_0xa412('0x164'),'through':_0xa412('0x10b')});db[_0xa412('0x137')][_0xa412('0x129')](db[_0xa412('0xf5')],{'as':_0xa412('0x165'),'through':_0xa412('0x166')});db[_0xa412('0x1a')][_0xa412('0x127')](db['User'],{'as':'User','foreignKey':_0xa412('0x114')});db[_0xa412('0x1c')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x11'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x1d')][_0xa412('0x115')](db['VoiceMailMessage'],{'as':_0xa412('0x167'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x168'),'sourceKey':_0xa412('0x169')});db[_0xa412('0x1f')][_0xa412('0x127')](db[_0xa412('0x1d')],{'foreignKey':_0xa412('0x168'),'targetKey':_0xa412('0x169')});db[_0xa412('0x16a')][_0xa412('0x115')](db[_0xa412('0x16b')],{'as':_0xa412('0x16c'),'foreignKey':'uniqueid','constraints':![]});db[_0xa412('0x16a')][_0xa412('0x115')](db[_0xa412('0x16d')],{'as':_0xa412('0x16e'),'foreignKey':_0xa412('0x16f'),'constraints':![]});db[_0xa412('0x16a')]['belongsTo'](db[_0xa412('0x11')],{'as':'User','foreignKey':_0xa412('0x114')});db[_0xa412('0x16a')]['belongsTo'](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':'ContactId'});db[_0xa412('0x171')][_0xa412('0x127')](db[_0xa412('0x37')],{'as':_0xa412('0x37'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x171')][_0xa412('0x127')](db[_0xa412('0x109')],{'as':_0xa412('0x109'),'foreignKey':_0xa412('0x173'),'onDelete':_0xa412('0x174')});db[_0xa412('0x35')]['belongsTo'](db[_0xa412('0x37')],{'as':'MailAccount','foreignKey':_0xa412('0x172')});db[_0xa412('0x35')]['belongsTo'](db[_0xa412('0x109')],{'as':_0xa412('0x109'),'foreignKey':_0xa412('0x173'),'onDelete':_0xa412('0x174')});db[_0xa412('0x37')]['hasOne'](db[_0xa412('0x171')],{'as':_0xa412('0x175'),'onDelete':_0xa412('0x113')});db[_0xa412('0x37')][_0xa412('0x112')](db[_0xa412('0x35')],{'as':_0xa412('0x176'),'onDelete':_0xa412('0x113')});db['MailAccount'][_0xa412('0x115')](db['Disposition'],{'as':_0xa412('0x177'),'foreignKey':_0xa412('0x172'),'onDelete':'cascade'});db[_0xa412('0x37')]['hasMany'](db[_0xa412('0x80')],{'as':_0xa412('0x178'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x37')]['hasMany'](db[_0xa412('0x179')],{'as':_0xa412('0x167'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x37')][_0xa412('0x115')](db[_0xa412('0x11e')],{'as':_0xa412('0x17a')});db[_0xa412('0x37')][_0xa412('0x115')](db[_0xa412('0x3e')],{'as':_0xa412('0x152'),'foreignKey':'MailAccountId','onDelete':_0xa412('0x113')});db[_0xa412('0x37')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b')});db[_0xa412('0x37')][_0xa412('0x127')](db[_0xa412('0x92')],{'as':'Template','foreignKey':_0xa412('0x17c')});db['MailAccount'][_0xa412('0x127')](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa412('0x37')][_0xa412('0x129')](db['User'],{'as':_0xa412('0x163'),'through':_0xa412('0x149')});db[_0xa412('0x39')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':'UserMailQueue'});db[_0xa412('0x39')][_0xa412('0x129')](db[_0xa412('0xe3')],{'through':_0xa412('0x17d'),'as':_0xa412('0x164')});db['MailInteraction']['hasMany'](db[_0xa412('0x179')],{'as':_0xa412('0x167'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x17e')});db[_0xa412('0x11e')][_0xa412('0x127')](db[_0xa412('0x37')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x11e')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':'ContactId'});db[_0xa412('0x11e')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x180'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x11e')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x181'),'as':_0xa412('0x182')});db[_0xa412('0x11e')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x181'),'as':_0xa412('0x183')});db[_0xa412('0x11e')]['belongsToMany'](db[_0xa412('0x11')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xa412('0x17e')});db['MailMessage'][_0xa412('0x115')](db[_0xa412('0xe9')],{'as':'Attachments','onDelete':_0xa412('0x113')});db['MailMessage'][_0xa412('0x127')](db['User'],{'as':_0xa412('0x11')});db[_0xa412('0x179')][_0xa412('0x127')](db[_0xa412('0x72')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x170')});db['MailMessage'][_0xa412('0x127')](db[_0xa412('0x11e')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xa412('0x179')]['belongsTo'](db[_0xa412('0x37')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x179')][_0xa412('0x127')](db[_0xa412('0x60')],{'as':_0xa412('0x60'),'foreignKey':_0xa412('0x184')});db['MailMessage']['belongsTo'](db[_0xa412('0x69')],{'as':_0xa412('0x69'),'foreignKey':'ChatOfflineMessageId'});db[_0xa412('0x3e')]['belongsTo'](db[_0xa412('0x11')],{'onDelete':_0xa412('0x174')});db[_0xa412('0x3e')][_0xa412('0x127')](db[_0xa412('0x39')],{'onDelete':_0xa412('0x174')});db[_0xa412('0x3e')][_0xa412('0x127')](db[_0xa412('0x37')],{'onDelete':'restrict'});db['MailApplication'][_0xa412('0x127')](db[_0xa412('0x15e')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x3e')][_0xa412('0x127')](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0xa412('0x37')],{});db[_0xa412('0x40')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0x40')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db[_0xa412('0x40')]['belongsTo'](db[_0xa412('0x11e')],{});db[_0xa412('0x40')][_0xa412('0x127')](db[_0xa412('0x179')],{});db[_0xa412('0x40')][_0xa412('0x127')](db[_0xa412('0x11')],{});db[_0xa412('0x40')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0xa412('0x115')](db[_0xa412('0x44')],{'as':_0xa412('0x187'),'onDelete':_0xa412('0x113')});db[_0xa412('0x146')][_0xa412('0x115')](db[_0xa412('0x81')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xa412('0x113')});db[_0xa412('0x146')][_0xa412('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xa412('0x188')});db[_0xa412('0x146')][_0xa412('0x115')](db[_0xa412('0x48')],{'as':_0xa412('0x17a')});db['FaxAccount'][_0xa412('0x115')](db['FaxApplication'],{'as':_0xa412('0x152'),'foreignKey':_0xa412('0x188'),'onDelete':_0xa412('0x113')});db[_0xa412('0x146')][_0xa412('0x115')](db[_0xa412('0x16')],{'as':_0xa412('0x189'),'onDelete':_0xa412('0x113')});db[_0xa412('0x146')][_0xa412('0x115')](db['FaxMessage'],{'as':_0xa412('0x167')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0xa412('0x26')});db['FaxAccount'][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b')});db[_0xa412('0x146')]['belongsTo'](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':_0xa412('0x162')});db[_0xa412('0x146')]['belongsToMany'](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':'user_has_fax_accounts'});db[_0xa412('0x18a')][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':_0xa412('0x174')});db[_0xa412('0x18a')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xa412('0x174')});db[_0xa412('0x18a')][_0xa412('0x127')](db['FaxAccount'],{'onDelete':_0xa412('0x174')});db[_0xa412('0x18a')][_0xa412('0x127')](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x18b')});db[_0xa412('0x48')][_0xa412('0x115')](db[_0xa412('0x4a')],{'as':'Messages','onDelete':_0xa412('0x113'),'foreignKey':'FaxInteractionId'});db[_0xa412('0x48')][_0xa412('0x127')](db[_0xa412('0x146')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x188')});db['FaxInteraction'][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':'ContactId'});db[_0xa412('0x48')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x180'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x48')]['belongsToMany'](db['Tag'],{'through':_0xa412('0x18c'),'as':'Tags'});db[_0xa412('0x48')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xa412('0x183')});db[_0xa412('0x48')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':'Users','through':_0xa412('0x134'),'foreignKey':_0xa412('0x18d')});db[_0xa412('0x4a')][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':_0xa412('0x113'),'as':'User'});db[_0xa412('0x4a')][_0xa412('0x127')](db[_0xa412('0x48')],{'as':_0xa412('0x18e'),'foreignKey':'FaxInteractionId'});db[_0xa412('0x4a')][_0xa412('0x127')](db[_0xa412('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0xa412('0x4a')][_0xa412('0x127')](db[_0xa412('0xe9')],{'as':_0xa412('0xe9'),'foreignKey':_0xa412('0x18f')});db['FaxMessage'][_0xa412('0x127')](db[_0xa412('0x146')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x188')});db[_0xa412('0x4c')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x190')});db[_0xa412('0x4c')]['belongsToMany'](db[_0xa412('0xe3')],{'through':'team_has_fax_queues','as':_0xa412('0x164')});db[_0xa412('0x4e')][_0xa412('0x127')](db[_0xa412('0x146')],{});db[_0xa412('0x4e')][_0xa412('0x127')](db['CmList'],{'as':'List','foreignKey':_0xa412('0x17b')});db[_0xa412('0x4e')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa412('0x4e')][_0xa412('0x127')](db[_0xa412('0x48')],{});db[_0xa412('0x4e')][_0xa412('0x127')](db['FaxMessage'],{});db['FaxQueueReport'][_0xa412('0x127')](db[_0xa412('0x11')],{});db[_0xa412('0x4e')][_0xa412('0x127')](db['FaxQueue'],{});db[_0xa412('0x14b')][_0xa412('0x115')](db['Disposition'],{'as':_0xa412('0x177'),'foreignKey':_0xa412('0x191'),'onDelete':_0xa412('0x113')});db[_0xa412('0x14b')]['hasMany'](db[_0xa412('0x80')],{'as':_0xa412('0x178'),'foreignKey':_0xa412('0x191')});db[_0xa412('0x14b')]['hasMany'](db[_0xa412('0x53')],{'as':_0xa412('0x167'),'foreignKey':_0xa412('0x191')});db[_0xa412('0x14b')][_0xa412('0x115')](db[_0xa412('0x11c')],{'as':_0xa412('0x17a')});db['SmsAccount'][_0xa412('0x115')](db[_0xa412('0x51')],{'as':_0xa412('0x152'),'foreignKey':_0xa412('0x191'),'onDelete':_0xa412('0x113')});db[_0xa412('0x14b')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b')});db[_0xa412('0x14b')][_0xa412('0x127')](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':_0xa412('0x162')});db[_0xa412('0x14b')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x14d')});db[_0xa412('0x51')][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':_0xa412('0x174')});db[_0xa412('0x51')][_0xa412('0x127')](db[_0xa412('0x55')],{'onDelete':'restrict'});db[_0xa412('0x51')][_0xa412('0x127')](db['SmsAccount'],{'onDelete':_0xa412('0x174')});db[_0xa412('0x51')][_0xa412('0x127')](db['Interval'],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x51')][_0xa412('0x127')](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x18b')});db[_0xa412('0x11c')][_0xa412('0x115')](db['SmsMessage'],{'as':_0xa412('0x167'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xa412('0x11c')][_0xa412('0x127')](db[_0xa412('0x14b')],{'as':'Account','foreignKey':_0xa412('0x191')});db['SmsInteraction'][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db['SmsInteraction']['belongsTo'](db[_0xa412('0x11')],{'as':'Owner','foreignKey':_0xa412('0x114')});db[_0xa412('0x11c')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x192'),'as':_0xa412('0x182')});db[_0xa412('0x11c')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x192'),'as':_0xa412('0x183')});db[_0xa412('0x11c')][_0xa412('0x129')](db['User'],{'as':_0xa412('0x193'),'through':_0xa412('0x135'),'foreignKey':_0xa412('0x194')});db[_0xa412('0x53')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x11')});db[_0xa412('0x53')][_0xa412('0x127')](db[_0xa412('0x72')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x170')});db[_0xa412('0x53')][_0xa412('0x127')](db[_0xa412('0x11c')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x18e'),'foreignKey':_0xa412('0x194')});db[_0xa412('0x53')]['belongsTo'](db[_0xa412('0x14b')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x191')});db[_0xa412('0x55')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':'Agents','through':_0xa412('0x30'),'foreignKey':_0xa412('0x195')});db[_0xa412('0x55')][_0xa412('0x129')](db[_0xa412('0xe3')],{'through':_0xa412('0x196'),'as':_0xa412('0x164')});db[_0xa412('0x57')][_0xa412('0x115')](db[_0xa412('0x81')],{'as':_0xa412('0x177'),'foreignKey':'OpenchannelAccountId','onDelete':_0xa412('0x113')});db[_0xa412('0x57')][_0xa412('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xa412('0x197')});db[_0xa412('0x57')][_0xa412('0x115')](db[_0xa412('0x5b')],{'as':_0xa412('0x17a'),'foreignKey':_0xa412('0x197')});db[_0xa412('0x57')][_0xa412('0x115')](db[_0xa412('0x5d')],{'as':_0xa412('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xa412('0x57')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xa412('0x197'),'onDelete':_0xa412('0x113')});db['OpenchannelAccount'][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0x57')]['belongsTo'](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa412('0x57')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x14a')});db['OpenchannelApplication'][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':_0xa412('0x174')});db[_0xa412('0x59')][_0xa412('0x127')](db[_0xa412('0x140')],{'onDelete':'restrict','foreignKey':_0xa412('0x198')});db[_0xa412('0x59')]['belongsTo'](db[_0xa412('0x57')],{'onDelete':_0xa412('0x174'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xa412('0x127')](db[_0xa412('0x15e')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x59')]['belongsTo'](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0xa412('0x115')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0xa412('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0xa412('0x5b')][_0xa412('0x127')](db[_0xa412('0x57')],{'as':'Account','foreignKey':_0xa412('0x197')});db[_0xa412('0x5b')]['belongsTo'](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db[_0xa412('0x5b')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':'Owner','foreignKey':_0xa412('0x114')});db[_0xa412('0x5b')]['belongsToMany'](db[_0xa412('0x8c')],{'through':_0xa412('0x199'),'as':_0xa412('0x182')});db['OpenchannelInteraction'][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0xa412('0x183')});db[_0xa412('0x5b')][_0xa412('0x129')](db['User'],{'as':_0xa412('0x193'),'through':_0xa412('0x136'),'foreignKey':_0xa412('0x19a')});db['OpenchannelMessage'][_0xa412('0x127')](db['User'],{'onDelete':_0xa412('0x113'),'as':'User'});db[_0xa412('0x5d')]['belongsTo'](db[_0xa412('0x72')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x170')});db[_0xa412('0x5d')][_0xa412('0x127')](db[_0xa412('0x5b')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x18e'),'foreignKey':_0xa412('0x19a')});db[_0xa412('0x5d')][_0xa412('0x127')](db[_0xa412('0xe9')],{'as':_0xa412('0xe9'),'foreignKey':_0xa412('0x18f')});db['OpenchannelMessage']['belongsTo'](db[_0xa412('0x57')],{'as':'Account','foreignKey':_0xa412('0x197')});db[_0xa412('0x140')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x31'),'foreignKey':_0xa412('0x198')});db[_0xa412('0x140')]['belongsToMany'](db[_0xa412('0xe3')],{'through':_0xa412('0x19b'),'as':_0xa412('0x164')});db['ChatWebsite'][_0xa412('0x115')](db[_0xa412('0x81')],{'as':'Dispositions','foreignKey':_0xa412('0x184'),'onDelete':_0xa412('0x113')});db['ChatWebsite'][_0xa412('0x115')](db[_0xa412('0x80')],{'as':_0xa412('0x178'),'foreignKey':_0xa412('0x184')});db['ChatWebsite'][_0xa412('0x115')](db[_0xa412('0x6e')],{'as':_0xa412('0x19c')});db[_0xa412('0x60')][_0xa412('0x115')](db[_0xa412('0x65')],{'as':_0xa412('0x17a')});db[_0xa412('0x60')][_0xa412('0x115')](db['ChatApplication'],{'as':'Applications','foreignKey':_0xa412('0x184'),'onDelete':_0xa412('0x113')});db['ChatWebsite'][_0xa412('0x115')](db[_0xa412('0x67')],{'as':'Messages'});db[_0xa412('0x60')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db['ChatWebsite'][_0xa412('0x127')](db[_0xa412('0x15e')],{'as':_0xa412('0x15e'),'foreignKey':'IntervalId'});db[_0xa412('0x60')][_0xa412('0x127')](db[_0xa412('0x37')],{'as':_0xa412('0x37'),'foreignKey':_0xa412('0x172')});db[_0xa412('0x60')][_0xa412('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa412('0x162')});db[_0xa412('0x60')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':'user_has_chat_websites'});db[_0xa412('0x61')][_0xa412('0x127')](db[_0xa412('0x57')],{});db[_0xa412('0x61')]['belongsTo'](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0x61')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':'Contact','foreignKey':_0xa412('0x186')});db[_0xa412('0x61')][_0xa412('0x127')](db[_0xa412('0x5b')],{});db[_0xa412('0x61')][_0xa412('0x127')](db[_0xa412('0x5d')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xa412('0x11')],{});db[_0xa412('0x61')]['belongsTo'](db[_0xa412('0x140')],{});db[_0xa412('0x63')][_0xa412('0x127')](db['User'],{'as':_0xa412('0x19d'),'foreignKey':_0xa412('0x114'),'onDelete':_0xa412('0x174')});db[_0xa412('0x63')]['belongsTo'](db[_0xa412('0x6b')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xa412('0x174')});db['ChatApplication'][_0xa412('0x127')](db['ChatWebsite'],{'as':_0xa412('0x19e'),'foreignKey':_0xa412('0x184'),'onDelete':_0xa412('0x174')});db[_0xa412('0x63')][_0xa412('0x127')](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x18b')});db['ChatInteraction'][_0xa412('0x115')](db[_0xa412('0x67')],{'as':_0xa412('0x167'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x19f')});db[_0xa412('0x65')][_0xa412('0x127')](db[_0xa412('0x60')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x184')});db[_0xa412('0x65')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db['ChatInteraction'][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x180'),'foreignKey':_0xa412('0x114')});db['ChatInteraction'][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x1a0'),'as':'Tags'});db[_0xa412('0x65')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':'chat_interaction_has_tags','as':_0xa412('0x183')});db['ChatInteraction'][_0xa412('0x129')](db['User'],{'as':_0xa412('0x193'),'through':_0xa412('0x132'),'foreignKey':_0xa412('0x19f')});db[_0xa412('0x67')][_0xa412('0x127')](db['User'],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x11')});db['ChatMessage'][_0xa412('0x127')](db[_0xa412('0x72')],{'onDelete':'cascade','as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db['ChatMessage'][_0xa412('0x127')](db['ChatInteraction'],{'onDelete':_0xa412('0x113'),'as':'Interaction','foreignKey':_0xa412('0x19f')});db[_0xa412('0x67')][_0xa412('0x127')](db[_0xa412('0xe9')],{'as':_0xa412('0xe9'),'foreignKey':_0xa412('0x18f')});db[_0xa412('0x67')][_0xa412('0x127')](db[_0xa412('0x60')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x184')});db['ChatOfflineMessage'][_0xa412('0x115')](db[_0xa412('0xe9')],{'as':'Attachments','foreignKey':_0xa412('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0xa412('0x69')][_0xa412('0x127')](db[_0xa412('0x72')],{'onDelete':'cascade','as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db[_0xa412('0x69')][_0xa412('0x127')](db['ChatWebsite'],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x184')});db[_0xa412('0x6b')][_0xa412('0x129')](db['User'],{'as':_0xa412('0x163'),'through':_0xa412('0x2c'),'hooks':!![]});db[_0xa412('0x6b')][_0xa412('0x129')](db['Team'],{'through':_0xa412('0x1a2'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0xa412('0x1a3')],{'as':'Messages','foreignKey':_0xa412('0x1a4'),'onDelete':_0xa412('0x113')});db[_0xa412('0x12a')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x155'),'through':'chat_group_has_users'});db[_0xa412('0x6e')][_0xa412('0x127')](db[_0xa412('0x60')],{'as':_0xa412('0x19e'),'foreignKey':_0xa412('0x184')});db['CmCompany'][_0xa412('0x115')](db[_0xa412('0x72')],{'as':_0xa412('0x12d'),'foreignKey':_0xa412('0x1a5')});db[_0xa412('0x72')]['hasMany'](db[_0xa412('0x8e')],{'as':_0xa412('0x1a6'),'foreignKey':_0xa412('0x1a7')});db['CmContact'][_0xa412('0x115')](db['CmHopper'],{'as':_0xa412('0x125'),'foreignKey':_0xa412('0x186')});db[_0xa412('0x72')][_0xa412('0x115')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xa412('0x186')});db['CmContact']['hasMany'](db[_0xa412('0x77')],{'as':_0xa412('0x1a8'),'foreignKey':'ContactId'});db[_0xa412('0x72')][_0xa412('0x115')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xa412('0x72')][_0xa412('0x115')](db[_0xa412('0x159')],{'as':_0xa412('0x15a'),'foreignKey':_0xa412('0x186')});db[_0xa412('0x72')]['hasMany'](db[_0xa412('0x5b')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xa412('0x174')});db['CmContact'][_0xa412('0x115')](db[_0xa412('0x65')],{'as':_0xa412('0x11b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa412('0x72')][_0xa412('0x115')](db[_0xa412('0x11c')],{'as':_0xa412('0x11d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa412('0x72')][_0xa412('0x115')](db[_0xa412('0x48')],{'as':_0xa412('0x133'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa412('0x72')][_0xa412('0x115')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xa412('0x186'),'onDelete':_0xa412('0x174')});db[_0xa412('0x72')][_0xa412('0x127')](db[_0xa412('0x70')],{'as':_0xa412('0x1a9'),'foreignKey':_0xa412('0x1a5')});db[_0xa412('0x72')]['belongsTo'](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b'),'onDelete':_0xa412('0x113')});db['CmContact']['belongsToMany'](db[_0xa412('0x11')],{'as':_0xa412('0x193'),'through':_0xa412('0x12e')});db[_0xa412('0x72')][_0xa412('0x129')](db[_0xa412('0x8c')],{'as':_0xa412('0x182'),'through':_0xa412('0x1aa')});db[_0xa412('0x72')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x1aa'),'as':_0xa412('0x183')});db[_0xa412('0x73')][_0xa412('0x115')](db[_0xa412('0x90')],{'as':_0xa412('0x1ab'),'foreignKey':_0xa412('0x1ac')});db['CmHopper'][_0xa412('0x127')](db[_0xa412('0x72')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xa412('0x113')});db['CmHopper']['belongsTo'](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b'),'onDelete':'cascade'});db[_0xa412('0x73')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':'Agent','foreignKey':'UserId'});db[_0xa412('0x73')]['belongsTo'](db[_0xa412('0x137')],{'as':_0xa412('0x1ad'),'foreignKey':_0xa412('0x156'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xa412('0x1ae')],{'as':_0xa412('0x1ae'),'foreignKey':_0xa412('0x1af'),'onDelete':_0xa412('0x113')});db['CmHopper'][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x180'),'foreignKey':_0xa412('0x1b0')});db[_0xa412('0x75')][_0xa412('0x127')](db['CmContact'],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186'),'onDelete':_0xa412('0x113')});db[_0xa412('0x75')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b'),'onDelete':_0xa412('0x113')});db[_0xa412('0x75')][_0xa412('0x127')](db[_0xa412('0x137')],{'as':_0xa412('0x1ad'),'foreignKey':_0xa412('0x156'),'onDelete':_0xa412('0x113')});db['CmHopperBlack'][_0xa412('0x127')](db[_0xa412('0x1ae')],{'as':_0xa412('0x1ae'),'foreignKey':_0xa412('0x1af'),'onDelete':_0xa412('0x113')});db['Automation'][_0xa412('0x115')](db[_0xa412('0x83')],{'as':{'plural':_0xa412('0x1b1'),'singular':_0xa412('0x1b2')},'foreignKey':_0xa412('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0xa412('0x7e')][_0xa412('0x115')](db[_0xa412('0x83')],{'as':{'plural':_0xa412('0x1b4'),'singular':_0xa412('0x1b5')},'foreignKey':_0xa412('0x1b6'),'onDelete':_0xa412('0x113'),'hooks':!![]});db[_0xa412('0x7e')]['hasMany'](db[_0xa412('0x7c')],{'as':_0xa412('0x1b7'),'foreignKey':'AutomationId','onDelete':_0xa412('0x113'),'hooks':!![]});db[_0xa412('0x81')]['hasMany'](db[_0xa412('0x81')],{'as':_0xa412('0x177'),'foreignKey':_0xa412('0x1b8'),'onDelete':_0xa412('0x113')});db['Interval']['hasMany'](db[_0xa412('0x15e')],{'as':_0xa412('0x1b9'),'foreignKey':'IntervalId','onDelete':_0xa412('0x113'),'hooks':!![],'required':![]});db[_0xa412('0x15e')]['hasMany'](db[_0xa412('0x16')],{'as':_0xa412('0x118'),'foreignKey':_0xa412('0x15f'),'onDelete':'restrict'});db[_0xa412('0x15e')][_0xa412('0x115')](db[_0xa412('0x3e')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xa412('0x15e')]['hasMany'](db['ChatApplication'],{'as':_0xa412('0x1ba'),'foreignKey':'IntervalId'});db['Interval'][_0xa412('0x115')](db[_0xa412('0x18a')],{'as':_0xa412('0x1bb'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x15e')][_0xa412('0x115')](db[_0xa412('0x51')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xa412('0x1bc')][_0xa412('0x127')](db[_0xa412('0x37')],{});db['Schedule'][_0xa412('0x127')](db[_0xa412('0x9b')],{'foreignKey':_0xa412('0x1bd')});db['Schedule'][_0xa412('0x127')](db[_0xa412('0x9a')],{'foreignKey':_0xa412('0x1be')});db['Sound']['belongsToMany'](db[_0xa412('0x1bf')],{'as':'Mohs','through':_0xa412('0x154'),'onDelete':_0xa412('0x174')});db[_0xa412('0x8c')][_0xa412('0x129')](db[_0xa412('0x72')],{'through':_0xa412('0x1aa')});db[_0xa412('0x8c')][_0xa412('0x129')](db[_0xa412('0x65')],{'through':_0xa412('0x1a0')});db[_0xa412('0x8c')][_0xa412('0x129')](db['MailInteraction'],{'through':_0xa412('0x181')});db[_0xa412('0x8c')][_0xa412('0x129')](db[_0xa412('0x11c')],{'through':_0xa412('0x192')});db[_0xa412('0x8c')][_0xa412('0x129')](db['FaxInteraction'],{'through':_0xa412('0x18c')});db[_0xa412('0x8c')][_0xa412('0x129')](db[_0xa412('0x5b')],{'through':'openchannel_interaction_has_tags'});db[_0xa412('0x8c')][_0xa412('0x129')](db[_0xa412('0x120')],{'through':_0xa412('0x1c0')});db[_0xa412('0x8e')][_0xa412('0x127')](db[_0xa412('0x8d')],{'as':_0xa412('0x1c1'),'foreignKey':_0xa412('0x1c2')});db[_0xa412('0x90')][_0xa412('0x127')](db[_0xa412('0x73')],{'as':_0xa412('0x1c3'),'foreignKey':_0xa412('0x1ac')});db[_0xa412('0x8e')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x1a7')});db[_0xa412('0x94')]['hasMany'](db[_0xa412('0x83')],{'as':{'plural':_0xa412('0x1c4'),'singular':_0xa412('0x1c5')},'foreignKey':_0xa412('0x1c6'),'onDelete':'cascade','hooks':!![]});db[_0xa412('0x94')][_0xa412('0x115')](db[_0xa412('0x83')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xa412('0x1c7'),'onDelete':'cascade','hooks':!![]});db[_0xa412('0x94')][_0xa412('0x115')](db[_0xa412('0x7c')],{'as':_0xa412('0x1b7'),'foreignKey':_0xa412('0x1c8'),'onDelete':_0xa412('0x113'),'hooks':!![]});db[_0xa412('0x9a')][_0xa412('0x115')](db[_0xa412('0x9f')],{'as':_0xa412('0x1c9'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1be'),'hooks':!![]});db[_0xa412('0x9b')][_0xa412('0x115')](db[_0xa412('0x9f')],{'as':_0xa412('0x1c9'),'onDelete':_0xa412('0x113'),'foreignKey':'DefaultReportId'});db[_0xa412('0x9e')][_0xa412('0x115')](db['AnalyticFieldReport'],{'as':_0xa412('0x1c9'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1ca')});db['AnalyticFieldReport'][_0xa412('0x127')](db['AnalyticMetric'],{'foreignKey':_0xa412('0x1ca')});db[_0xa412('0xa1')][_0xa412('0x115')](db[_0xa412('0xa3')],{'as':_0xa412('0x1cb'),'onDelete':_0xa412('0x113'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0xa412('0x115')](db[_0xa412('0xa4')],{'as':_0xa412('0x1cc'),'onDelete':_0xa412('0x113'),'foreignKey':'SubjectId'});db[_0xa412('0xa3')][_0xa412('0x115')](db['SalesforceField'],{'as':_0xa412('0x1cd'),'onDelete':'cascade','foreignKey':_0xa412('0x1ce')});db['SalesforceConfiguration'][_0xa412('0x115')](db[_0xa412('0xa4')],{'as':'Fields','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xa3')][_0xa412('0x127')](db[_0xa412('0xa1')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xa4')][_0xa412('0x115')](db['SalesforceField'],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xa4')][_0xa412('0x115')](db[_0xa412('0xa4')],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xa4')][_0xa412('0x115')](db['SalesforceField'],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xa4')][_0xa412('0x127')](db[_0xa412('0x1d5')],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db['SugarcrmAccount']['hasMany'](db[_0xa412('0xa8')],{'as':_0xa412('0x1cb'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xa8')]['hasMany'](db[_0xa412('0x1d7')],{'as':_0xa412('0x1cc'),'onDelete':'cascade','foreignKey':_0xa412('0x1d2')});db[_0xa412('0xa8')][_0xa412('0x115')](db['SugarcrmField'],{'as':_0xa412('0x1cd'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xa8')][_0xa412('0x115')](db[_0xa412('0x1d7')],{'as':_0xa412('0x1c9'),'onDelete':_0xa412('0x113'),'foreignKey':'FieldId'});db[_0xa412('0xa8')]['belongsTo'](db[_0xa412('0xa6')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0x1d7')]['hasMany'](db['SugarcrmField'],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0xa412('0x1d7')],{'as':'Description','foreignKey':_0xa412('0x1ce')});db[_0xa412('0x1d7')][_0xa412('0x115')](db['SugarcrmField'],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0x1d7')][_0xa412('0x127')](db[_0xa412('0x1d5')],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db['DeskAccount'][_0xa412('0x115')](db['DeskConfiguration'],{'as':_0xa412('0x1cb'),'onDelete':_0xa412('0x113'),'foreignKey':'AccountId'});db[_0xa412('0x1d8')][_0xa412('0x115')](db[_0xa412('0xac')],{'as':_0xa412('0x1cc'),'onDelete':_0xa412('0x113'),'foreignKey':'SubjectId'});db[_0xa412('0x1d8')][_0xa412('0x115')](db[_0xa412('0xac')],{'as':_0xa412('0x1cd'),'onDelete':'cascade','foreignKey':_0xa412('0x1ce')});db['DeskConfiguration']['hasMany'](db[_0xa412('0xac')],{'as':_0xa412('0x1c9'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0x1d8')][_0xa412('0x127')](db[_0xa412('0x1d9')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0x1d8')]['belongsToMany'](db['Tag'],{'through':_0xa412('0x1da')});db['DeskField']['hasMany'](db[_0xa412('0xac')],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xac')][_0xa412('0x115')](db[_0xa412('0xac')],{'as':'Description','foreignKey':_0xa412('0x1ce')});db[_0xa412('0xac')][_0xa412('0x115')](db[_0xa412('0xac')],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xac')][_0xa412('0x127')](db[_0xa412('0x1d5')],{'as':_0xa412('0x1d5'),'foreignKey':'VariableId'});db[_0xa412('0xae')]['hasMany'](db[_0xa412('0xb0')],{'as':'Configurations','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xb0')][_0xa412('0x115')](db[_0xa412('0xb2')],{'as':'Subjects','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xb0')]['hasMany'](db[_0xa412('0xb2')],{'as':_0xa412('0x1cd'),'onDelete':'cascade','foreignKey':_0xa412('0x1ce')});db[_0xa412('0xb0')]['hasMany'](db[_0xa412('0xb2')],{'as':'Fields','onDelete':_0xa412('0x113'),'foreignKey':'FieldId'});db[_0xa412('0xb0')][_0xa412('0x127')](db[_0xa412('0xae')],{'as':_0xa412('0x17f'),'foreignKey':'AccountId'});db[_0xa412('0xb2')][_0xa412('0x115')](db[_0xa412('0xb2')],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xb2')][_0xa412('0x115')](db[_0xa412('0xb2')],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xb2')][_0xa412('0x115')](db[_0xa412('0xb2')],{'as':_0xa412('0x1d4'),'foreignKey':'FieldId'});db[_0xa412('0xb2')][_0xa412('0x127')](db['Variable'],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db['ZendeskAccount'][_0xa412('0x115')](db[_0xa412('0xb4')],{'as':_0xa412('0x1cb'),'onDelete':'cascade','foreignKey':_0xa412('0x1d0')});db[_0xa412('0xb4')][_0xa412('0x115')](db[_0xa412('0xb6')],{'as':_0xa412('0x1cc'),'foreignKey':_0xa412('0x1d2')});db['ZendeskConfiguration'][_0xa412('0x115')](db[_0xa412('0xb6')],{'as':_0xa412('0x1cd'),'foreignKey':'DescriptionId'});db[_0xa412('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0xa412('0x1c9'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xb4')][_0xa412('0x127')](db[_0xa412('0x1db')],{'as':'Account','foreignKey':_0xa412('0x1d0')});db[_0xa412('0xb4')]['belongsToMany'](db[_0xa412('0x8c')],{'through':_0xa412('0x1dc')});db['ZendeskField'][_0xa412('0x115')](db[_0xa412('0xb6')],{'as':_0xa412('0x1d1'),'foreignKey':'SubjectId'});db[_0xa412('0xb6')][_0xa412('0x115')](db[_0xa412('0xb6')],{'as':'Description','foreignKey':_0xa412('0x1ce')});db[_0xa412('0xb6')][_0xa412('0x115')](db[_0xa412('0xb6')],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xb6')]['belongsTo'](db[_0xa412('0x1d5')],{'as':'Variable','foreignKey':_0xa412('0x1d6')});db[_0xa412('0xb7')][_0xa412('0x115')](db[_0xa412('0xb9')],{'as':'Configurations','onDelete':_0xa412('0x113'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xa412('0x115')](db[_0xa412('0xbb')],{'as':_0xa412('0x1cc'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xb9')][_0xa412('0x115')](db['FreshdeskField'],{'as':_0xa412('0x1cd'),'onDelete':_0xa412('0x113'),'foreignKey':'DescriptionId'});db[_0xa412('0xb9')][_0xa412('0x115')](db['FreshdeskField'],{'as':_0xa412('0x1c9'),'onDelete':'cascade','foreignKey':_0xa412('0x1cf')});db[_0xa412('0xb9')][_0xa412('0x127')](db[_0xa412('0xb7')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xb9')][_0xa412('0x129')](db['Tag'],{'through':_0xa412('0x1dd')});db[_0xa412('0xbb')]['hasMany'](db[_0xa412('0xbb')],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xbb')]['hasMany'](db[_0xa412('0xbb')],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xbb')][_0xa412('0x127')](db['Variable'],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db[_0xa412('0xbd')]['hasMany'](db[_0xa412('0xbe')],{'as':_0xa412('0x1cb'),'onDelete':_0xa412('0x113'),'foreignKey':'AccountId'});db[_0xa412('0xbe')]['hasMany'](db[_0xa412('0xc0')],{'as':_0xa412('0x1cc'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xbe')][_0xa412('0x115')](db[_0xa412('0xc0')],{'as':_0xa412('0x1cd'),'foreignKey':_0xa412('0x1ce')});db['VtigerConfiguration']['hasMany'](db[_0xa412('0xc0')],{'as':_0xa412('0x1c9'),'foreignKey':'FieldId'});db[_0xa412('0xbe')][_0xa412('0x127')](db[_0xa412('0xbd')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xc0')][_0xa412('0x115')](db[_0xa412('0xc0')],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xc0')][_0xa412('0x115')](db[_0xa412('0xc0')],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db['VtigerField']['hasMany'](db[_0xa412('0xc0')],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db[_0xa412('0xc0')]['belongsTo'](db[_0xa412('0x1d5')],{'as':'Variable','foreignKey':_0xa412('0x1d6')});db[_0xa412('0xc1')]['hasMany'](db[_0xa412('0xc3')],{'as':'Configurations','onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1d0')});db[_0xa412('0xc3')][_0xa412('0x115')](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xa412('0xc3')][_0xa412('0x115')](db[_0xa412('0xc4')],{'as':_0xa412('0x1cd'),'foreignKey':'DescriptionId'});db[_0xa412('0xc3')]['hasMany'](db[_0xa412('0xc4')],{'as':_0xa412('0x1c9'),'foreignKey':_0xa412('0x1cf')});db['ServicenowConfiguration'][_0xa412('0x127')](db[_0xa412('0xc1')],{'as':_0xa412('0x17f'),'foreignKey':'AccountId'});db[_0xa412('0xc4')]['hasMany'](db[_0xa412('0xc4')],{'as':'Subject','foreignKey':_0xa412('0x1d2')});db[_0xa412('0xc4')][_0xa412('0x115')](db['ServicenowField'],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xc4')][_0xa412('0x115')](db[_0xa412('0xc4')],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db['ServicenowField'][_0xa412('0x127')](db['Variable'],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db[_0xa412('0x1de')][_0xa412('0x115')](db[_0xa412('0xc6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa412('0x1d0')});db[_0xa412('0x1de')][_0xa412('0x127')](db[_0xa412('0x109')],{'as':_0xa412('0x109'),'foreignKey':'CloudProviderId'});db[_0xa412('0xc6')]['hasMany'](db[_0xa412('0xc7')],{'as':'Subjects','onDelete':_0xa412('0x113'),'foreignKey':'SubjectId'});db[_0xa412('0xc6')][_0xa412('0x115')](db[_0xa412('0xc7')],{'as':_0xa412('0x1cd'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xc6')][_0xa412('0x115')](db[_0xa412('0xc7')],{'as':_0xa412('0x1c9'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xa412('0xc6')][_0xa412('0x127')](db['Dynamics365Account'],{'as':_0xa412('0x17f'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xa412('0x115')](db[_0xa412('0xc7')],{'as':_0xa412('0x1d1'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xa412('0x115')](db['Dynamics365Field'],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db['Dynamics365Field'][_0xa412('0x115')](db['Dynamics365Field'],{'as':_0xa412('0x1d4'),'foreignKey':_0xa412('0x1cf')});db['Dynamics365Field'][_0xa412('0x127')](db[_0xa412('0x1d5')],{'as':_0xa412('0x1d5'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa412('0x1d0')});db['FreshsalesConfiguration'][_0xa412('0x115')](db[_0xa412('0x1df')],{'as':_0xa412('0x1cc'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0xca')]['hasMany'](db[_0xa412('0x1df')],{'as':_0xa412('0x1cd'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0xca')][_0xa412('0x115')](db['FreshsalesField'],{'as':_0xa412('0x1c9'),'foreignKey':'FieldId'});db[_0xa412('0xca')][_0xa412('0x127')](db[_0xa412('0xc8')],{'as':'Account','foreignKey':'AccountId'});db[_0xa412('0x1df')][_0xa412('0x115')](db['FreshsalesField'],{'as':_0xa412('0x1d1'),'foreignKey':_0xa412('0x1d2')});db[_0xa412('0x1df')][_0xa412('0x115')](db[_0xa412('0x1df')],{'as':_0xa412('0x1d3'),'foreignKey':_0xa412('0x1ce')});db[_0xa412('0x1df')][_0xa412('0x115')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xa412('0x1cf')});db[_0xa412('0x1df')][_0xa412('0x127')](db[_0xa412('0x1d5')],{'as':_0xa412('0x1d5'),'foreignKey':_0xa412('0x1d6')});db['ChatQueueReport'][_0xa412('0x127')](db[_0xa412('0x60')],{});db[_0xa412('0xcf')]['belongsTo'](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0xcf')][_0xa412('0x127')](db['CmContact'],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db['ChatQueueReport'][_0xa412('0x127')](db[_0xa412('0x65')],{});db['ChatQueueReport'][_0xa412('0x127')](db[_0xa412('0x67')],{});db[_0xa412('0xcf')][_0xa412('0x127')](db['User'],{});db['ChatQueueReport'][_0xa412('0x127')](db[_0xa412('0x6b')],{});db['ChatInternalMessage'][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':'cascade','foreignKey':_0xa412('0x1e0')});db[_0xa412('0x1a3')]['belongsTo'](db[_0xa412('0x11')],{'onDelete':'cascade','foreignKey':_0xa412('0x1e1')});db[_0xa412('0x159')][_0xa412('0x115')](db[_0xa412('0x1e2')],{'foreignKey':'SessionId','onDelete':_0xa412('0x113')});db[_0xa412('0x159')][_0xa412('0x115')](db[_0xa412('0xd2')],{'foreignKey':_0xa412('0x1e3'),'onDelete':'cascade'});db['SmsQueueReport'][_0xa412('0x127')](db[_0xa412('0x14b')],{});db[_0xa412('0xd4')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':'List','foreignKey':_0xa412('0x17b')});db[_0xa412('0xd4')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':'Contact','foreignKey':_0xa412('0x186')});db[_0xa412('0xd4')][_0xa412('0x127')](db[_0xa412('0x11c')],{});db[_0xa412('0xd4')][_0xa412('0x127')](db[_0xa412('0x53')],{});db[_0xa412('0xd4')][_0xa412('0x127')](db[_0xa412('0x11')],{});db['SmsQueueReport'][_0xa412('0x127')](db[_0xa412('0x55')],{});db[_0xa412('0x1e4')][_0xa412('0x115')](db[_0xa412('0x159')],{'foreignKey':_0xa412('0x1e5')});db[_0xa412('0x1e4')][_0xa412('0x115')](db[_0xa412('0x1e2')],{'foreignKey':_0xa412('0x1e5')});db['JscriptyProject'][_0xa412('0x115')](db[_0xa412('0xd2')],{'foreignKey':_0xa412('0x1e5')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':'Agents','through':'user_has_teams'});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x137')],{'through':_0xa412('0x10b'),'as':_0xa412('0x138')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x39')],{'through':_0xa412('0x17d'),'as':_0xa412('0x13d')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x6b')],{'through':'team_has_chat_queues','as':_0xa412('0x1e6')});db['Team']['belongsToMany'](db[_0xa412('0x4c')],{'through':_0xa412('0x1e7'),'as':_0xa412('0x13e')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x55')],{'through':_0xa412('0x196'),'as':_0xa412('0x13f')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x140')],{'through':_0xa412('0x19b'),'as':'OpenchannelQueues'});db[_0xa412('0xe3')]['belongsToMany'](db[_0xa412('0x142')],{'through':_0xa412('0x1e8'),'as':_0xa412('0x143')});db[_0xa412('0xe3')][_0xa412('0x129')](db[_0xa412('0x13a')],{'through':_0xa412('0x10d'),'as':_0xa412('0x13b')});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0xa412('0x125'),'foreignKey':_0xa412('0x1af')});db[_0xa412('0x1ae')][_0xa412('0x115')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xa412('0x1ae')][_0xa412('0x115')](db[_0xa412('0x77')],{'as':_0xa412('0x1a8'),'foreignKey':_0xa412('0x1af')});db[_0xa412('0x1ae')][_0xa412('0x115')](db['CmHopperBlack'],{'as':_0xa412('0x158'),'foreignKey':_0xa412('0x1af')});db[_0xa412('0x1ae')]['belongsTo'](db['Trunk'],{'as':_0xa412('0x26'),'foreignKey':_0xa412('0x15b')});db['Campaign'][_0xa412('0x127')](db[_0xa412('0x26')],{'as':_0xa412('0x15c'),'foreignKey':_0xa412('0x15d')});db[_0xa412('0x1ae')][_0xa412('0x127')](db[_0xa412('0x15e')],{'as':_0xa412('0x15e'),'foreignKey':_0xa412('0x15f')});db[_0xa412('0x1ae')][_0xa412('0x127')](db[_0xa412('0xde')],{'as':_0xa412('0xde'),'foreignKey':_0xa412('0x1e9')});db[_0xa412('0x1ae')]['belongsToMany'](db[_0xa412('0xf5')],{'as':'Lists','through':_0xa412('0x1ea')});db['Campaign'][_0xa412('0x129')](db[_0xa412('0xf5')],{'as':_0xa412('0x165'),'through':_0xa412('0x1eb')});db[_0xa412('0xe9')][_0xa412('0x127')](db[_0xa412('0x69')],{'as':'ChatOfflineMessage','foreignKey':_0xa412('0x1a1')});db[_0xa412('0xec')][_0xa412('0x127')](db[_0xa412('0x179')],{});db[_0xa412('0xec')][_0xa412('0x127')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0xa412('0x37')],{'foreignKey':'FromMailAccountId','as':_0xa412('0x1ec')});db[_0xa412('0xec')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':_0xa412('0x1ed'),'as':_0xa412('0x1ee')});db[_0xa412('0xec')]['belongsTo'](db[_0xa412('0x11')],{'foreignKey':_0xa412('0x1ef'),'as':_0xa412('0x1f0')});db['MailTransferReport'][_0xa412('0x127')](db[_0xa412('0x39')],{'foreignKey':_0xa412('0x1f1'),'as':_0xa412('0x1f2')});db['MailTransferReport'][_0xa412('0x127')](db[_0xa412('0x37')],{'foreignKey':_0xa412('0x1f3'),'as':_0xa412('0x1f4')});db[_0xa412('0xee')][_0xa412('0x127')](db[_0xa412('0x67')],{});db['ChatTransferReport']['belongsTo'](db[_0xa412('0x65')],{});db[_0xa412('0xee')]['belongsTo'](db[_0xa412('0x60')],{'foreignKey':_0xa412('0x1f5'),'as':_0xa412('0x1ec')});db[_0xa412('0xee')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':'FromUserId','as':_0xa412('0x1ee')});db[_0xa412('0xee')][_0xa412('0x127')](db['User'],{'foreignKey':'ToUserId','as':_0xa412('0x1f0')});db[_0xa412('0xee')][_0xa412('0x127')](db[_0xa412('0x6b')],{'foreignKey':_0xa412('0x1f6'),'as':_0xa412('0x1f2')});db['ChatTransferReport'][_0xa412('0x127')](db['ChatWebsite'],{'foreignKey':_0xa412('0x1f7'),'as':_0xa412('0x1f4')});db[_0xa412('0x1f8')][_0xa412('0x127')](db[_0xa412('0x4a')],{});db[_0xa412('0x1f8')][_0xa412('0x127')](db['FaxInteraction'],{});db[_0xa412('0x1f8')]['belongsTo'](db[_0xa412('0x146')],{'foreignKey':_0xa412('0x1f9'),'as':'FromAccount'});db['FaxTransferReport'][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa412('0x1f8')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':'ToUserId','as':_0xa412('0x1f0')});db['FaxTransferReport']['belongsTo'](db[_0xa412('0x4c')],{'foreignKey':_0xa412('0x1fa'),'as':_0xa412('0x1f2')});db['FaxTransferReport'][_0xa412('0x127')](db[_0xa412('0x146')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0xa412('0xf1')]['belongsTo'](db[_0xa412('0x5b')],{});db[_0xa412('0xf1')][_0xa412('0x127')](db[_0xa412('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa412('0x1ec')});db[_0xa412('0xf1')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':_0xa412('0x1ed'),'as':_0xa412('0x1ee')});db['OpenchannelTransferReport'][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':_0xa412('0x1ef'),'as':_0xa412('0x1f0')});db[_0xa412('0xf1')][_0xa412('0x127')](db[_0xa412('0x140')],{'foreignKey':'ToOpenchannelQueueId','as':_0xa412('0x1f2')});db[_0xa412('0xf1')]['belongsTo'](db[_0xa412('0x57')],{'foreignKey':_0xa412('0x1fb'),'as':'ToAccount'});db[_0xa412('0xf3')]['belongsTo'](db[_0xa412('0x53')],{});db['SmsTransferReport'][_0xa412('0x127')](db[_0xa412('0x11c')],{});db['SmsTransferReport'][_0xa412('0x127')](db['SmsAccount'],{'foreignKey':_0xa412('0x1fc'),'as':_0xa412('0x1ec')});db[_0xa412('0xf3')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xa412('0x1ee')});db[_0xa412('0xf3')]['belongsTo'](db[_0xa412('0x11')],{'foreignKey':'ToUserId','as':_0xa412('0x1f0')});db['SmsTransferReport'][_0xa412('0x127')](db[_0xa412('0x55')],{'foreignKey':_0xa412('0x1fd'),'as':_0xa412('0x1f2')});db[_0xa412('0xf3')][_0xa412('0x127')](db[_0xa412('0x14b')],{'foreignKey':_0xa412('0x1fe'),'as':_0xa412('0x1f4')});db[_0xa412('0xf5')][_0xa412('0x115')](db[_0xa412('0x81')],{'as':_0xa412('0x177'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xa412('0xf5')][_0xa412('0x115')](db['CmCustomField'],{'as':_0xa412('0x1ff'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0xf5')]['hasMany'](db['CmContact'],{'as':_0xa412('0x12d'),'onDelete':_0xa412('0x113'),'foreignKey':_0xa412('0x17b')});db['CmList'][_0xa412('0x115')](db['CmHopperFinal'],{'as':_0xa412('0x157'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0xf5')][_0xa412('0x115')](db[_0xa412('0x77')],{'as':'HopperHistory','foreignKey':_0xa412('0x17b')});db[_0xa412('0xf5')]['hasMany'](db[_0xa412('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xa412('0x17b')});db[_0xa412('0xf5')][_0xa412('0x129')](db[_0xa412('0x137')],{'as':_0xa412('0x200'),'through':_0xa412('0x201')});db[_0xa412('0xf5')]['belongsToMany'](db[_0xa412('0x11')],{'as':'Agents','through':_0xa412('0x130')});db[_0xa412('0x13a')]['hasMany'](db['VoiceExtension'],{'as':_0xa412('0x118'),'onDelete':_0xa412('0x113')});db['VoicePrefix']['belongsToMany'](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':'UserVoicePrefix'});db[_0xa412('0x13a')][_0xa412('0x129')](db[_0xa412('0xe3')],{'through':_0xa412('0x10d'),'as':_0xa412('0x164')});db['UserProfile'][_0xa412('0x115')](db[_0xa412('0x11')],{'as':_0xa412('0x193'),'foreignKey':_0xa412('0x128')});db[_0xa412('0xf8')][_0xa412('0x115')](db[_0xa412('0xfa')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xa412('0x113')});db[_0xa412('0xfa')][_0xa412('0x115')](db[_0xa412('0xfb')],{'as':_0xa412('0x202'),'foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount'][_0xa412('0x115')](db[_0xa412('0x81')],{'as':_0xa412('0x177'),'foreignKey':_0xa412('0x203'),'onDelete':'cascade'});db[_0xa412('0xfe')][_0xa412('0x115')](db[_0xa412('0x80')],{'as':_0xa412('0x178'),'foreignKey':_0xa412('0x203')});db[_0xa412('0xfe')][_0xa412('0x115')](db[_0xa412('0x102')],{'as':_0xa412('0x167'),'foreignKey':_0xa412('0x203')});db[_0xa412('0xfe')][_0xa412('0x115')](db[_0xa412('0x120')],{'as':'Interactions'});db[_0xa412('0xfe')]['hasMany'](db[_0xa412('0xff')],{'as':_0xa412('0x152'),'foreignKey':_0xa412('0x203'),'onDelete':'cascade'});db[_0xa412('0xfe')][_0xa412('0x127')](db[_0xa412('0xf5')],{'as':_0xa412('0x185'),'foreignKey':'ListId'});db[_0xa412('0xfe')]['belongsTo'](db[_0xa412('0x160')],{'as':_0xa412('0x161'),'foreignKey':_0xa412('0x162')});db['WhatsappAccount'][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x14f')});db[_0xa412('0xff')][_0xa412('0x127')](db[_0xa412('0x11')],{'onDelete':_0xa412('0x174')});db[_0xa412('0xff')][_0xa412('0x127')](db[_0xa412('0x142')],{'onDelete':_0xa412('0x174')});db[_0xa412('0xff')]['belongsTo'](db[_0xa412('0xfe')],{'onDelete':'restrict'});db[_0xa412('0xff')][_0xa412('0x127')](db[_0xa412('0x15e')],{'onDelete':_0xa412('0x174'),'foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db[_0xa412('0x8c')],{'onDelete':_0xa412('0x174'),'foreignKey':_0xa412('0x18b')});db['WhatsappInteraction'][_0xa412('0x115')](db[_0xa412('0x102')],{'as':_0xa412('0x167'),'onDelete':'cascade','foreignKey':_0xa412('0x204')});db[_0xa412('0x120')][_0xa412('0x127')](db[_0xa412('0xfe')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':'ContactId'});db[_0xa412('0x120')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':_0xa412('0x180'),'foreignKey':_0xa412('0x114')});db[_0xa412('0x120')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x1c0'),'as':_0xa412('0x182')});db[_0xa412('0x120')][_0xa412('0x129')](db[_0xa412('0x8c')],{'through':_0xa412('0x1c0'),'as':_0xa412('0x183')});db[_0xa412('0x120')]['belongsToMany'](db[_0xa412('0x11')],{'as':_0xa412('0x193'),'through':_0xa412('0x205'),'foreignKey':_0xa412('0x204')});db[_0xa412('0x102')][_0xa412('0x127')](db[_0xa412('0x11')],{'as':'User'});db[_0xa412('0x102')][_0xa412('0x127')](db['CmContact'],{'onDelete':_0xa412('0x113'),'as':'Contact'});db[_0xa412('0x102')][_0xa412('0x127')](db[_0xa412('0x120')],{'onDelete':_0xa412('0x113'),'as':_0xa412('0x18e'),'foreignKey':'WhatsappInteractionId'});db[_0xa412('0x102')]['belongsTo'](db[_0xa412('0xfe')],{'as':_0xa412('0x17f'),'foreignKey':_0xa412('0x203')});db['WhatsappQueueReport'][_0xa412('0x127')](db[_0xa412('0xfe')],{});db['WhatsappQueueReport'][_0xa412('0x127')](db['CmList'],{'as':_0xa412('0x185'),'foreignKey':_0xa412('0x17b')});db[_0xa412('0x104')][_0xa412('0x127')](db[_0xa412('0x72')],{'as':_0xa412('0x170'),'foreignKey':_0xa412('0x186')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0xa412('0x104')][_0xa412('0x127')](db[_0xa412('0x142')],{});db[_0xa412('0x104')]['belongsTo'](db[_0xa412('0x102')],{});db[_0xa412('0x104')]['belongsTo'](db[_0xa412('0x11')],{});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0x102')],{});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0x120')],{});db['WhatsappTransferReport'][_0xa412('0x127')](db[_0xa412('0xfe')],{'foreignKey':_0xa412('0x206'),'as':'FromAccount'});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0xfe')],{'foreignKey':_0xa412('0x207'),'as':_0xa412('0x1f4')});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0x142')],{'foreignKey':_0xa412('0x208'),'as':_0xa412('0x1f2')});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':_0xa412('0x1ed'),'as':_0xa412('0x1ee')});db[_0xa412('0x106')][_0xa412('0x127')](db[_0xa412('0x11')],{'foreignKey':'ToUserId','as':_0xa412('0x1f0')});db[_0xa412('0x142')][_0xa412('0x129')](db[_0xa412('0x11')],{'as':_0xa412('0x163'),'through':_0xa412('0x32'),'foreignKey':_0xa412('0x209')});db[_0xa412('0x142')][_0xa412('0x129')](db[_0xa412('0xe3')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0xa412('0x10f')]['belongsTo'](db[_0xa412('0x11')],{'as':_0xa412('0x20a'),'foreignKey':'UserId','onDelete':_0xa412('0x113'),'hooks':!![]});db['CloudProvider'][_0xa412('0x112')](db[_0xa412('0x1de')],{'as':_0xa412('0x1de'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0xa412('0x171')],{'as':'Imap','onDelete':_0xa412('0x174')});db[_0xa412('0x109')][_0xa412('0x112')](db[_0xa412('0x35')],{'as':_0xa412('0x176'),'onDelete':_0xa412('0x174')});module[_0xa412('0x20b')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c9904c5..dcfc961 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x430c=['./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','root','/apidoc','/www','/demo','/snippet','join','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','path','./config/environment','./utils/client-side-logger','setupLoggers','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/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/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/schedule','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x430c,0x1a1));var _0xc430=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0x430c[_0xf6e75d];return _0x27514d;};'use strict';var path=require(_0xc430('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0xc430('0x1'));var setupLoggers=require(_0xc430('0x2'))[_0xc430('0x3')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x5ccda6){return setupLoggers(_0x5ccda6)['then'](function(){_0x5ccda6[_0xc430('0x4')](_0xc430('0x5'),require('./api/user'));_0x5ccda6[_0xc430('0x4')]('/api/voice/chanspy',require(_0xc430('0x6')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x7'),require(_0xc430('0x8')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x9'),require(_0xc430('0xa')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xb'),require('./api/voiceMusicOnHold'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc'),require('./api/voiceQueue'));_0x5ccda6[_0xc430('0x4')]('/api/voice/recordings',require(_0xc430('0xd')));_0x5ccda6['use'](_0xc430('0xe'),require(_0xc430('0xf')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x10'),require(_0xc430('0x11')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x12'),require('./api/voiceMailMessage'));_0x5ccda6['use'](_0xc430('0x13'),require(_0xc430('0x14')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x15'),require(_0xc430('0x16')));_0x5ccda6['use'](_0xc430('0x17'),require('./api/voiceAgentReport'));_0x5ccda6['use'](_0xc430('0x18'),require(_0xc430('0x19')));_0x5ccda6[_0xc430('0x4')]('/api/members/reports',require('./api/memberReport'));_0x5ccda6[_0xc430('0x4')]('/api/trunks',require(_0xc430('0x1a')));_0x5ccda6['use']('/api/voice/transfers/reports',require(_0xc430('0x1b')));_0x5ccda6['use'](_0xc430('0x1c'),require(_0xc430('0x1d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x1e'),require(_0xc430('0x1f')));_0x5ccda6['use'](_0xc430('0x20'),require('./api/mailQueue'));_0x5ccda6['use'](_0xc430('0x21'),require(_0xc430('0x22')));_0x5ccda6[_0xc430('0x4')]('/api/mail/interactions',require(_0xc430('0x23')));_0x5ccda6['use'](_0xc430('0x24'),require(_0xc430('0x25')));_0x5ccda6['use'](_0xc430('0x26'),require(_0xc430('0x27')));_0x5ccda6['use'](_0xc430('0x28'),require('./api/mailQueueReport'));_0x5ccda6[_0xc430('0x4')]('/api/dashboards',require(_0xc430('0x29')));_0x5ccda6[_0xc430('0x4')]('/api/dashboards/items',require(_0xc430('0x2a')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x2b'),require(_0xc430('0x2c')));_0x5ccda6[_0xc430('0x4')]('/api/fax/applications',require(_0xc430('0x2d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x2e'),require(_0xc430('0x2f')));_0x5ccda6['use'](_0xc430('0x30'),require('./api/faxMessage'));_0x5ccda6[_0xc430('0x4')]('/api/fax/queues',require(_0xc430('0x31')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x32'),require(_0xc430('0x33')));_0x5ccda6['use'](_0xc430('0x34'),require(_0xc430('0x35')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x36'),require('./api/smsApplication'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x37'),require('./api/smsInteraction'));_0x5ccda6[_0xc430('0x4')]('/api/sms/messages',require('./api/smsMessage'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x38'),require(_0xc430('0x39')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x3a'),require(_0xc430('0x3b')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x3c'),require('./api/openchannelApplication'));_0x5ccda6[_0xc430('0x4')]('/api/openchannel/interactions',require(_0xc430('0x3d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x3e'),require(_0xc430('0x3f')));_0x5ccda6['use'](_0xc430('0x40'),require('./api/openchannelQueue'));_0x5ccda6['use'](_0xc430('0x41'),require(_0xc430('0x42')));_0x5ccda6['use'](_0xc430('0x43'),require(_0xc430('0x44')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x45'),require(_0xc430('0x46')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x47'),require(_0xc430('0x48')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x49'),require(_0xc430('0x4a')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x4b'),require(_0xc430('0x4c')));_0x5ccda6[_0xc430('0x4')]('/api/chat/queues',require(_0xc430('0x4d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x4e'),require(_0xc430('0x4f')));_0x5ccda6['use'](_0xc430('0x50'),require(_0xc430('0x51')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x52'),require(_0xc430('0x53')));_0x5ccda6[_0xc430('0x4')]('/api/cm/contacts',require(_0xc430('0x54')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x55'),require(_0xc430('0x56')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x57'),require(_0xc430('0x58')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x59'),require(_0xc430('0x5a')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x5b'),require(_0xc430('0x5c')));_0x5ccda6[_0xc430('0x4')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x5ccda6['use'](_0xc430('0x5d'),require(_0xc430('0x5e')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x5f'),require(_0xc430('0x60')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x61'),require(_0xc430('0x62')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x63'),require(_0xc430('0x64')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x65'),require(_0xc430('0x66')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x67'),require('./api/interval'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x68'),require(_0xc430('0x69')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x6a'),require(_0xc430('0x6b')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x6c'),require('./api/voiceQueuesLog'));_0x5ccda6[_0xc430('0x4')]('/api/schedules',require(_0xc430('0x6d')));_0x5ccda6[_0xc430('0x4')]('/api/sounds',require('./api/sound'));_0x5ccda6[_0xc430('0x4')]('/api/tags',require('./api/tag'));_0x5ccda6[_0xc430('0x4')]('/api/contact_item_types',require(_0xc430('0x6e')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x6f'),require('./api/cmContactHasItem'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x70'),require(_0xc430('0x71')));_0x5ccda6['use'](_0xc430('0x72'),require(_0xc430('0x73')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x74'),require(_0xc430('0x75')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x76'),require('./api/variable'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x77'),require(_0xc430('0x78')));_0x5ccda6['use'](_0xc430('0x79'),require(_0xc430('0x7a')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x7b'),require('./api/analyticCustomReport'));_0x5ccda6[_0xc430('0x4')]('/api/analytics/default_reports',require(_0xc430('0x7c')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x7d'),require(_0xc430('0x7e')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x7f'),require('./api/analyticMetric'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x80'),require('./api/analyticFieldReport'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x81'),require(_0xc430('0x82')));_0x5ccda6[_0xc430('0x4')]('/api/integrations/salesforce/accounts',require(_0xc430('0x83')));_0x5ccda6['use'](_0xc430('0x84'),require(_0xc430('0x85')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x86'),require('./api/intSalesforceField'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x87'),require('./api/intSugarcrmAccount'));_0x5ccda6['use'](_0xc430('0x88'),require(_0xc430('0x89')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x8a'),require(_0xc430('0x8b')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x8c'),require('./api/intDeskAccount'));_0x5ccda6[_0xc430('0x4')]('/api/integrations/desk/configurations',require(_0xc430('0x8d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x8e'),require(_0xc430('0x8f')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x90'),require('./api/intZohoAccount'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x91'),require(_0xc430('0x92')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x93'),require(_0xc430('0x94')));_0x5ccda6[_0xc430('0x4')]('/api/integrations/zendesk/accounts',require(_0xc430('0x95')));_0x5ccda6['use'](_0xc430('0x96'),require('./api/intZendeskConfiguration'));_0x5ccda6[_0xc430('0x4')](_0xc430('0x97'),require(_0xc430('0x98')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x99'),require(_0xc430('0x9a')));_0x5ccda6['use'](_0xc430('0x9b'),require(_0xc430('0x9c')));_0x5ccda6['use']('/api/integrations/freshdesk/fields',require(_0xc430('0x9d')));_0x5ccda6[_0xc430('0x4')](_0xc430('0x9e'),require(_0xc430('0x9f')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa0'),require(_0xc430('0xa1')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa2'),require(_0xc430('0xa3')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa4'),require('./api/intServicenowAccount'));_0x5ccda6['use'](_0xc430('0xa5'),require('./api/intServicenowConfiguration'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa6'),require('./api/intServicenowField'));_0x5ccda6[_0xc430('0x4')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa7'),require('./api/intDynamics365Configuration'));_0x5ccda6[_0xc430('0x4')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xa8'),require(_0xc430('0xa9')));_0x5ccda6[_0xc430('0x4')]('/api/integrations/freshsales/configurations',require(_0xc430('0xaa')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xab'),require(_0xc430('0xac')));_0x5ccda6['use'](_0xc430('0xad'),require(_0xc430('0xae')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xaf'),require(_0xc430('0xb0')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xb1'),require(_0xc430('0xb2')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xb3'),require(_0xc430('0xb4')));_0x5ccda6['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xb5'),require(_0xc430('0xb6')));_0x5ccda6['use']('/api/sms/reports/queue',require(_0xc430('0xb7')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xb8'),require(_0xc430('0xb9')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xba'),require(_0xc430('0xbb')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xbc'),require(_0xc430('0xbd')));_0x5ccda6['use'](_0xc430('0xbe'),require(_0xc430('0xbf')));_0x5ccda6[_0xc430('0x4')]('/api/square/odbc',require('./api/squareOdbc'));_0x5ccda6['use'](_0xc430('0xc0'),require(_0xc430('0xc1')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc2'),require('./api/squareRecording'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc3'),require(_0xc430('0xc4')));_0x5ccda6['use'](_0xc430('0xc5'),require('./api/team'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc6'),require(_0xc430('0xc7')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc8'),require('./api/campaign'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xc9'),require(_0xc430('0xca')));_0x5ccda6[_0xc430('0x4')]('/api/attachments',require('./api/attachment'));_0x5ccda6[_0xc430('0x4')]('/api/plugins',require('./api/plugin'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xcb'),require('./api/mailTransferReport'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xcc'),require(_0xc430('0xcd')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xce'),require(_0xc430('0xcf')));_0x5ccda6['use'](_0xc430('0xd0'),require(_0xc430('0xd1')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xd2'),require('./api/smsTransferReport'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xd3'),require(_0xc430('0xd4')));_0x5ccda6['use'](_0xc430('0xd5'),require('./api/voicePrefix'));_0x5ccda6['use'](_0xc430('0xd6'),require('./api/userProfile'));_0x5ccda6[_0xc430('0x4')]('/api/userProfile/sections',require(_0xc430('0xd7')));_0x5ccda6[_0xc430('0x4')]('/api/userProfile/resources',require(_0xc430('0xd8')));_0x5ccda6[_0xc430('0x4')]('/api/userNotifications',require(_0xc430('0xd9')));_0x5ccda6[_0xc430('0x4')]('/api/whatsapp/accounts',require(_0xc430('0xda')));_0x5ccda6[_0xc430('0x4')]('/api/whatsapp/applications',require(_0xc430('0xdb')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xdc'),require(_0xc430('0xdd')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xde'),require(_0xc430('0xdf')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xe0'),require(_0xc430('0xe1')));_0x5ccda6[_0xc430('0x4')]('/api/whatsapp/reports/transfer',require(_0xc430('0xe2')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xe3'),require('./api/whatsappQueue'));_0x5ccda6['use'](_0xc430('0xe4'),require('./api/cloudProvider'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xe5'),require('./api/realtime'));_0x5ccda6['use'](_0xc430('0xe6'),require(_0xc430('0xe7')));_0x5ccda6[_0xc430('0x4')]('/api/mail_interaction_has_tags',require(_0xc430('0xe8')));_0x5ccda6['use']('/api/auth/local',require(_0xc430('0xe9')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xea'),require('./api/authGoogle'));_0x5ccda6[_0xc430('0x4')](_0xc430('0xeb'),require(_0xc430('0xec')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xed'),require('./api/jira'));_0x5ccda6['use'](_0xc430('0xee'),require(_0xc430('0xef')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xf0'),require(_0xc430('0xf1')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xf2'),require(_0xc430('0xf3')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xf4'),require(_0xc430('0xf5')));_0x5ccda6['use'](_0xc430('0xf6'),require(_0xc430('0xf7')));_0x5ccda6[_0xc430('0x4')](_0xc430('0xf8'),clientSideLogs);_0x5ccda6['use']('/apidoc',express[_0xc430('0xf9')](path['join'](config[_0xc430('0xfa')],_0xc430('0xfb'))));_0x5ccda6[_0xc430('0x4')](_0xc430('0xfc'),express[_0xc430('0xf9')](path['join'](config['root'],'/www')));_0x5ccda6['use'](_0xc430('0xfd'),express['static'](path['join'](config[_0xc430('0xfa')],_0xc430('0xfd'))));_0x5ccda6[_0xc430('0x4')](_0xc430('0xfe'),express[_0xc430('0xf9')](path[_0xc430('0xff')](config[_0xc430('0xfa')],_0xc430('0x100'),_0xc430('0x101'))));_0x5ccda6[_0xc430('0x4')](_0xc430('0x102'),express[_0xc430('0xf9')](path[_0xc430('0xff')](config['root'],_0xc430('0x103'))));_0x5ccda6[_0xc430('0x104')](_0xc430('0x105'))[_0xc430('0x106')](errors[0x194]);_0x5ccda6[_0xc430('0x104')]('/*')[_0xc430('0x106')](function(_0x369446,_0x3c4c9b){_0x3c4c9b['sendFile'](path[_0xc430('0x107')](_0x5ccda6[_0xc430('0x106')]('appPath')+_0xc430('0x108')));});return _0x5ccda6;});}; \ No newline at end of file +var _0x9f0e=['resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','./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/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/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/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/demo','/snippet','3.13.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get'];(function(_0x2c119d,_0x4e41d3){var _0x1ab5c4=function(_0x3df9c8){while(--_0x3df9c8){_0x2c119d['push'](_0x2c119d['shift']());}};_0x1ab5c4(++_0x4e41d3);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3687ed,_0x22cab8){_0x3687ed=_0x3687ed-0x0;var _0x7304ab=_0x9f0e[_0x3687ed];return _0x7304ab;};'use strict';var path=require(_0xe9f0('0x0'));var express=require(_0xe9f0('0x1'));var errors=require(_0xe9f0('0x2'));var config=require(_0xe9f0('0x3'));var setupLoggers=require(_0xe9f0('0x4'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xe9f0('0x5')]=function(_0x150a03){return setupLoggers(_0x150a03)[_0xe9f0('0x6')](function(){_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x8'),require('./api/user'));_0x150a03['use'](_0xe9f0('0x9'),require(_0xe9f0('0xa')));_0x150a03[_0xe9f0('0x7')]('/api/voice/contexts',require(_0xe9f0('0xb')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xc'),require(_0xe9f0('0xd')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xe'),require(_0xe9f0('0xf')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x10'),require('./api/voiceQueue'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x11'),require(_0xe9f0('0x12')));_0x150a03['use'](_0xe9f0('0x13'),require('./api/screenRecording'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x14'),require(_0xe9f0('0x15')));_0x150a03[_0xe9f0('0x7')]('/api/voice/mails/messages',require(_0xe9f0('0x16')));_0x150a03['use'](_0xe9f0('0x17'),require(_0xe9f0('0x18')));_0x150a03[_0xe9f0('0x7')]('/api/voice/dials/reports',require(_0xe9f0('0x19')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x1a'),require('./api/voiceAgentReport'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x1b'),require(_0xe9f0('0x1c')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x1d'),require(_0xe9f0('0x1e')));_0x150a03[_0xe9f0('0x7')]('/api/trunks',require(_0xe9f0('0x1f')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x20'),require('./api/voiceTransferReport'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x21'),require(_0xe9f0('0x22')));_0x150a03[_0xe9f0('0x7')]('/api/mail/accounts',require(_0xe9f0('0x23')));_0x150a03[_0xe9f0('0x7')]('/api/mail/queues',require('./api/mailQueue'));_0x150a03['use'](_0xe9f0('0x24'),require(_0xe9f0('0x25')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x26'),require(_0xe9f0('0x27')));_0x150a03['use'](_0xe9f0('0x28'),require(_0xe9f0('0x29')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x2a'),require(_0xe9f0('0x2b')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x2c'),require(_0xe9f0('0x2d')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x2e'),require('./api/dashboard'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x2f'),require(_0xe9f0('0x30')));_0x150a03[_0xe9f0('0x7')]('/api/fax/accounts',require(_0xe9f0('0x31')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x32'),require(_0xe9f0('0x33')));_0x150a03[_0xe9f0('0x7')]('/api/fax/interactions',require(_0xe9f0('0x34')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x35'),require(_0xe9f0('0x36')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x37'),require(_0xe9f0('0x38')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x39'),require(_0xe9f0('0x3a')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x3b'),require(_0xe9f0('0x3c')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x3d'),require(_0xe9f0('0x3e')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x3f'),require(_0xe9f0('0x40')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x41'),require(_0xe9f0('0x42')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x43'),require('./api/smsQueue'));_0x150a03['use']('/api/openchannel/accounts',require(_0xe9f0('0x44')));_0x150a03['use'](_0xe9f0('0x45'),require(_0xe9f0('0x46')));_0x150a03['use'](_0xe9f0('0x47'),require('./api/openchannelInteraction'));_0x150a03['use']('/api/openchannel/messages',require(_0xe9f0('0x48')));_0x150a03[_0xe9f0('0x7')]('/api/openchannel/queues',require(_0xe9f0('0x49')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x4a'),require('./api/chatWebsite'));_0x150a03['use'](_0xe9f0('0x4b'),require(_0xe9f0('0x4c')));_0x150a03[_0xe9f0('0x7')]('/api/chat/applications',require(_0xe9f0('0x4d')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x4e'),require(_0xe9f0('0x4f')));_0x150a03[_0xe9f0('0x7')]('/api/chat/messages',require(_0xe9f0('0x50')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x51'),require('./api/chatOfflineMessage'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x52'),require('./api/chatQueue'));_0x150a03[_0xe9f0('0x7')]('/api/chat/groups',require(_0xe9f0('0x53')));_0x150a03['use']('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x150a03['use']('/api/cm/companies',require(_0xe9f0('0x54')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x55'),require(_0xe9f0('0x56')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x57'),require(_0xe9f0('0x58')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x59'),require('./api/cmHopperBlack'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x5a'),require(_0xe9f0('0x5b')));_0x150a03['use']('/api/cm/hopper_history',require(_0xe9f0('0x5c')));_0x150a03['use'](_0xe9f0('0x5d'),require(_0xe9f0('0x5e')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x5f'),require('./api/action'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x60'),require(_0xe9f0('0x61')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x62'),require('./api/cannedAnswer'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x63'),require(_0xe9f0('0x64')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x65'),require('./api/condition'));_0x150a03[_0xe9f0('0x7')]('/api/intervals',require('./api/interval'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x66'),require('./api/pause'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x67'),require(_0xe9f0('0x68')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x69'),require(_0xe9f0('0x6a')));_0x150a03[_0xe9f0('0x7')]('/api/schedules',require(_0xe9f0('0x6b')));_0x150a03['use'](_0xe9f0('0x6c'),require('./api/sound'));_0x150a03[_0xe9f0('0x7')]('/api/tags',require(_0xe9f0('0x6d')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x6e'),require('./api/contactItemType'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x6f'),require(_0xe9f0('0x70')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x71'),require(_0xe9f0('0x72')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x73'),require(_0xe9f0('0x74')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x75'),require(_0xe9f0('0x76')));_0x150a03['use']('/api/variables',require(_0xe9f0('0x77')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x78'),require('./api/integration'));_0x150a03[_0xe9f0('0x7')]('/api/integrations/reports',require(_0xe9f0('0x79')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x7a'),require(_0xe9f0('0x7b')));_0x150a03['use'](_0xe9f0('0x7c'),require(_0xe9f0('0x7d')));_0x150a03['use'](_0xe9f0('0x7e'),require(_0xe9f0('0x7f')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x80'),require('./api/analyticMetric'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x81'),require(_0xe9f0('0x82')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x83'),require(_0xe9f0('0x84')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x85'),require('./api/intSalesforceAccount'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x86'),require(_0xe9f0('0x87')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x88'),require(_0xe9f0('0x89')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x8a'),require(_0xe9f0('0x8b')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x8c'),require(_0xe9f0('0x8d')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x8e'),require('./api/intSugarcrmField'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x8f'),require(_0xe9f0('0x90')));_0x150a03['use']('/api/integrations/desk/configurations',require(_0xe9f0('0x91')));_0x150a03['use'](_0xe9f0('0x92'),require(_0xe9f0('0x93')));_0x150a03[_0xe9f0('0x7')]('/api/integrations/zoho/accounts',require(_0xe9f0('0x94')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x95'),require(_0xe9f0('0x96')));_0x150a03['use'](_0xe9f0('0x97'),require(_0xe9f0('0x98')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x99'),require('./api/intZendeskAccount'));_0x150a03['use'](_0xe9f0('0x9a'),require(_0xe9f0('0x9b')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x9c'),require(_0xe9f0('0x9d')));_0x150a03['use'](_0xe9f0('0x9e'),require('./api/intFreshdeskAccount'));_0x150a03[_0xe9f0('0x7')]('/api/integrations/freshdesk/configurations',require(_0xe9f0('0x9f')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xa0'),require(_0xe9f0('0xa1')));_0x150a03[_0xe9f0('0x7')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x150a03['use'](_0xe9f0('0xa2'),require(_0xe9f0('0xa3')));_0x150a03['use'](_0xe9f0('0xa4'),require('./api/intVtigerField'));_0x150a03['use'](_0xe9f0('0xa5'),require(_0xe9f0('0xa6')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xa7'),require(_0xe9f0('0xa8')));_0x150a03[_0xe9f0('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xa9'),require(_0xe9f0('0xaa')));_0x150a03[_0xe9f0('0x7')]('/api/integrations/dynamics365/configurations',require(_0xe9f0('0xab')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xac'),require(_0xe9f0('0xad')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xae'),require('./api/intFreshsalesAccount'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xaf'),require(_0xe9f0('0xb0')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xb1'),require('./api/intFreshsalesField'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xb2'),require(_0xe9f0('0xb3')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xb4'),require(_0xe9f0('0xb5')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xb6'),require(_0xe9f0('0xb7')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xb8'),require(_0xe9f0('0xb9')));_0x150a03['use'](_0xe9f0('0xba'),require(_0xe9f0('0xbb')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xbc'),require(_0xe9f0('0xbd')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xbe'),require('./api/smsQueueReport'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xbf'),require('./api/squareReport'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xc0'),require(_0xe9f0('0xc1')));_0x150a03['use'](_0xe9f0('0xc2'),require(_0xe9f0('0xc3')));_0x150a03['use'](_0xe9f0('0xc4'),require(_0xe9f0('0xc5')));_0x150a03['use']('/api/square/odbc',require(_0xe9f0('0xc6')));_0x150a03['use'](_0xe9f0('0xc7'),require(_0xe9f0('0xc8')));_0x150a03['use'](_0xe9f0('0xc9'),require(_0xe9f0('0xca')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xcb'),require(_0xe9f0('0xcc')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xcd'),require(_0xe9f0('0xce')));_0x150a03[_0xe9f0('0x7')]('/api/license',require(_0xe9f0('0xcf')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xd0'),require(_0xe9f0('0xd1')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xd2'),require(_0xe9f0('0xd3')));_0x150a03[_0xe9f0('0x7')]('/api/attachments',require(_0xe9f0('0xd4')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xd5'),require(_0xe9f0('0xd6')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xd7'),require('./api/mailTransferReport'));_0x150a03[_0xe9f0('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x150a03['use'](_0xe9f0('0xd8'),require(_0xe9f0('0xd9')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xda'),require(_0xe9f0('0xdb')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xdc'),require(_0xe9f0('0xdd')));_0x150a03[_0xe9f0('0x7')]('/api/cm/lists',require(_0xe9f0('0xde')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xdf'),require(_0xe9f0('0xe0')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xe1'),require(_0xe9f0('0xe2')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xe3'),require(_0xe9f0('0xe4')));_0x150a03['use']('/api/userProfile/resources',require(_0xe9f0('0xe5')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xe6'),require(_0xe9f0('0xe7')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xe8'),require(_0xe9f0('0xe9')));_0x150a03[_0xe9f0('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xea'),require('./api/whatsappInteraction'));_0x150a03['use'](_0xe9f0('0xeb'),require(_0xe9f0('0xec')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xed'),require(_0xe9f0('0xee')));_0x150a03['use'](_0xe9f0('0xef'),require(_0xe9f0('0xf0')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xf1'),require(_0xe9f0('0xf2')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xf3'),require('./api/cloudProvider'));_0x150a03['use']('/api/realtime',require(_0xe9f0('0xf4')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xf5'),require(_0xe9f0('0xf6')));_0x150a03['use'](_0xe9f0('0xf7'),require('./api/mailInteractionHasTag'));_0x150a03[_0xe9f0('0x7')]('/api/auth/local',require(_0xe9f0('0xf8')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xf9'),require(_0xe9f0('0xfa')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xfb'),require('./api/authActiveDirectory'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xfc'),require(_0xe9f0('0xfd')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xfe'),require('./api/rpc'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0xff'),require('./api/version'));_0x150a03[_0xe9f0('0x7')]('/api/system',require(_0xe9f0('0x100')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x101'),require('./api/pm2'));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x102'),require(_0xe9f0('0x103')));_0x150a03['use'](_0xe9f0('0x104'),clientSideLogs);_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x105'),express[_0xe9f0('0x106')](path[_0xe9f0('0x107')](config[_0xe9f0('0x108')],_0xe9f0('0x105'))));_0x150a03['use']('/www',express[_0xe9f0('0x106')](path[_0xe9f0('0x107')](config[_0xe9f0('0x108')],'/www')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x109'),express[_0xe9f0('0x106')](path[_0xe9f0('0x107')](config['root'],'/demo')));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x10a'),express['static'](path[_0xe9f0('0x107')](config['root'],'snippet',_0xe9f0('0x10b'))));_0x150a03[_0xe9f0('0x7')](_0xe9f0('0x10c'),express[_0xe9f0('0x106')](path[_0xe9f0('0x107')](config['root'],'/server/files/plugins')));_0x150a03[_0xe9f0('0x10d')](_0xe9f0('0x10e'))[_0xe9f0('0x10f')](errors[0x194]);_0x150a03[_0xe9f0('0x10d')]('/*')[_0xe9f0('0x10f')](function(_0x5cf4ff,_0x57b0d0){_0x57b0d0['sendFile'](path[_0xe9f0('0x110')](_0x150a03['get'](_0xe9f0('0x111'))+_0xe9f0('0x112')));});return _0x150a03;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c4c5d11..aa4b50b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9820=['../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc'];(function(_0xd701c6,_0x20625a){var _0x44092b=function(_0x45b518){while(--_0x45b518){_0xd701c6['push'](_0xd701c6['shift']());}};_0x44092b(++_0x20625a);}(_0x9820,0x93));var _0x0982=function(_0x2724f7,_0x29f704){_0x2724f7=_0x2724f7-0x0;var _0x377eb2=_0x9820[_0x2724f7];return _0x377eb2;};'use strict';var jayson=require(_0x0982('0x0'));var _=require(_0x0982('0x1'));var config=require(_0x0982('0x2'));exports[_0x0982('0x3')]=function(){return new Promise(function(_0x209689,_0x452bc3){var _0x8a27f5={};_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x5')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x6')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x7')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x8')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x9')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0xa')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0xb')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0xc')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0xd')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0xe')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0xf')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/mailServerIn/mailServerIn.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x10')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x11')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x12')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x13')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x14')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x15')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x16')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x17')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x18')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x19')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x1a')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x1b')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/smsAccount/smsAccount.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/smsInteraction/smsInteraction.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x1c')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x1d')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x1e')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x1f')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x20')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x21')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x22')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x23')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x24')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x25')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/cmContact/cmContact.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x26')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x27')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x28')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x29')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2a')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2b')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2c')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2d')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2e')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x2f')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x30')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x31')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x32')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x33')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x34')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x35')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x36')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x37')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x38')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x39')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3a')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3b')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3c')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/squareReport/squareReport.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3d')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3e')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x3f')));_0x8a27f5=_['merge'](_0x8a27f5,require('../api/squareProject/squareProject.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require('../api/squareRecording/squareRecording.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x40')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x41')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x42')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x43')));_0x8a27f5=_['merge'](_0x8a27f5,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x8a27f5=_['merge'](_0x8a27f5,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x44')));_0x8a27f5=_['merge'](_0x8a27f5,require(_0x0982('0x45')));_0x8a27f5=_[_0x0982('0x4')](_0x8a27f5,require(_0x0982('0x46')));var _0x2e443b=jayson[_0x0982('0x47')](_0x8a27f5)[_0x0982('0x48')]();var _0x2914c2=config[_0x0982('0x49')]['port']||config['port']+0x1;var _0x1b5319=config[_0x0982('0x49')]['ip']||_0x0982('0x4a');_0x2e443b['on'](_0x0982('0x4b'),function(_0x5f4103){return _0x452bc3(_0x5f4103);});_0x2e443b[_0x0982('0x3')](_0x2914c2,_0x1b5319,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1b5319,_0x2914c2);require('../config/triggers')[_0x0982('0x4c')]();return _0x209689(_0x0982('0x4d')+_0x1b5319+':'+_0x2914c2);});});}; \ No newline at end of file +var _0x5539=['../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x21f90a,_0x1d4ca1){var _0x131268=function(_0x87e815){while(--_0x87e815){_0x21f90a['push'](_0x21f90a['shift']());}};_0x131268(++_0x1d4ca1);}(_0x5539,0x9c));var _0x9553=function(_0x20f1de,_0xe2ba79){_0x20f1de=_0x20f1de-0x0;var _0x171139=_0x5539[_0x20f1de];return _0x171139;};'use strict';var jayson=require(_0x9553('0x0'));var _=require(_0x9553('0x1'));var config=require(_0x9553('0x2'));exports[_0x9553('0x3')]=function(){return new Promise(function(_0x496264,_0x43c44d){var _0x3238e9={};_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x5')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x6')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x7')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x8')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x9')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0xa')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0xb')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0xc')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0xd')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0xe')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0xf')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x10')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x11')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x12')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x13')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x14')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x15')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x16')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x17')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x18')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x19')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/faxMessage/faxMessage.rpc'));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x1a')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x1b')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/smsAccount/smsAccount.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x1c')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x1d')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x1e')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x1f')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x20')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x21')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x22')));_0x3238e9=_['merge'](_0x3238e9,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x23')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x24')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x25')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x26')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x27')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x28')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x29')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x2a')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x2b')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x2c')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x2d')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x2e')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x2f')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x30')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x31')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x32')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x33')));_0x3238e9=_['merge'](_0x3238e9,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x34')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x35')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x36')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x37')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x38')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x39')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/setting/setting.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x3a')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/squareProject/squareProject.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x3b')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x3c')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x3d')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x3e')));_0x3238e9=_['merge'](_0x3238e9,require(_0x9553('0x3f')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x40')));_0x3238e9=_['merge'](_0x3238e9,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require(_0x9553('0x41')));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3238e9=_[_0x9553('0x4')](_0x3238e9,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x537d47=jayson['server'](_0x3238e9)['http']();var _0x3aaaeb=config[_0x9553('0x42')][_0x9553('0x43')]||config[_0x9553('0x43')]+0x1;var _0x245734=config[_0x9553('0x42')]['ip']||_0x9553('0x44');_0x537d47['on']('error',function(_0x54ff9b){return _0x43c44d(_0x54ff9b);});_0x537d47['listen'](_0x3aaaeb,_0x245734,function(){console['log'](_0x9553('0x45'),_0x245734,_0x3aaaeb);require(_0x9553('0x46'))['default']();return _0x496264(_0x9553('0x47')+_0x245734+':'+_0x3aaaeb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 7503316..e8de504 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 _0xf19c=['join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','close','sendRequest','command','sync','prototype','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s'];(function(_0x3a6c2b,_0x27c53b){var _0x34e25f=function(_0x353537){while(--_0x353537){_0x3a6c2b['push'](_0x3a6c2b['shift']());}};_0x34e25f(++_0x27c53b);}(_0xf19c,0x10b));var _0xcf19=function(_0x43ec3b,_0x182f2a){_0x43ec3b=_0x43ec3b-0x0;var _0x47acc5=_0xf19c[_0x43ec3b];return _0x47acc5;};'use strict';var util=require(_0xcf19('0x0'));var _=require(_0xcf19('0x1'));var EventEmitter=require(_0xcf19('0x2'))['EventEmitter'];var AGIReply=require(_0xcf19('0x3'));var AGIError=require(_0xcf19('0x4'));function AGIChannel(_0x5e6003){var _0x1fa8dc=this,_0x2addca=new AGIReply(),_0x460b4f=![],_0x87534f={};EventEmitter[_0xcf19('0x5')](_0x1fa8dc);_0x5e6003['setEncoding'](_0xcf19('0x6'));_0x5e6003[_0xcf19('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2addca[_0xcf19('0x8')](_0xcf19('0x6'));_0x2addca['on'](_0xcf19('0x9'),function(_0x22c4bf){for(var _0x5e0540 in _0x22c4bf){_0x1fa8dc[_0x5e0540]=_0x22c4bf[_0x5e0540];}_0x1fa8dc[_0xcf19('0xa')](_0xcf19('0xb'));});_0x2addca['on'](_0xcf19('0xc'),function(_0x257184){if(_0x257184[_0xcf19('0xd')]()==_0xcf19('0xe')){_0x1fa8dc[_0xcf19('0xa')](_0xcf19('0xe'));return;}if(_0x257184[_0xcf19('0xf')](0x0,0xb)=='520-Invalid'){_0x460b4f=!![];}if(_0x460b4f){_0x87534f['rx']+=_0x257184+'\x0a';if(_0x257184[_0xcf19('0x10')](_0xcf19('0x11'))!=-0x1){_0x460b4f=![];}}else{_0x87534f['rx']=_0x257184;}if(_0x460b4f){return;}if(typeof _0x87534f['cb']==_0xcf19('0x12')){var _0x1d6396=_0x87534f['rx'][_0xcf19('0xf')](0x0,0x3),_0x226339=null,_0x241547=null;_0x1d6396=parseInt(_0x1d6396);if(isNaN(_0x1d6396)){_0x87534f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xcf19('0x13')});return;}if(_0x1d6396!=0xc8){_0x87534f['cb'](null,{'code':_0x1d6396,'result':-0x1,'extra':'KO'});return;}_0x226339=_0x87534f['rx'][_0xcf19('0xf')](0x4)[_0xcf19('0x14')](_0xcf19('0x15'),'');if(_0x226339[_0xcf19('0x16')]('\x20')!=-0x1){_0x226339=_0x226339[_0xcf19('0x17')](0x0,_0x226339[_0xcf19('0x16')]('\x20'));}if(_[_0xcf19('0x18')](_0x226339,'-1')){_0x226339=parseInt(_0x226339);}_0x241547=_0x87534f['rx'][_0xcf19('0x19')]('\x20');if(_0x241547['length']==0x3){_0x241547=_0x241547[0x2]['substring'](0x1,_0x241547[0x2][_0xcf19('0x1a')]-0x1);}else if(_0x241547[_0xcf19('0x1a')]>0x3){var _0x41cf03=/\((.+)\)/;var _0x409e41=_0x87534f['rx'][_0xcf19('0x1b')](_0x41cf03);if(_0x409e41){_0x241547=_0x409e41[0x1];}else{_0x241547=null;}}else{_0x241547=null;}_0x87534f['cb'](null,{'code':_0x1d6396,'result':_0x226339,'extra':_0x241547});}});_0x5e6003['on'](_0xcf19('0x1c'),function(_0x5f3fc0){_0x1fa8dc[_0xcf19('0xa')](_0xcf19('0x1c'),new AGIError('E_AGI_SOCKET_ERROR',_0x5f3fc0[_0xcf19('0x1d')]));});_0x5e6003['on']('close',function(){_0x1fa8dc[_0xcf19('0xa')]('close',new AGIError(_0xcf19('0x1e')));});_0x5e6003['on'](_0xcf19('0x1f'),function(){_0x1fa8dc[_0xcf19('0xa')](_0xcf19('0x1f'),new AGIError(_0xcf19('0x20')));_0x5e6003[_0xcf19('0x21')]();});_0x5e6003['pipe'](_0x2addca);this['command']=function(_0x37f1ae,_0x1deb93){var _0x37f1ae=_0x37f1ae||'',_0x1deb93=typeof _0x1deb93==_0xcf19('0x12')?_0x1deb93:new Function();_0x87534f={'tx':_0x37f1ae,'rx':'','cb':_0x1deb93};_0x5e6003[_0xcf19('0x22')](_0x37f1ae+'\x0a');},this[_0xcf19('0x23')]=function(){_0x5e6003[_0xcf19('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xcf19('0x24')]=function(_0x381dfa){return this[_0xcf19('0x25')][_0xcf19('0x26')](this,_0x381dfa);};AGIChannel[_0xcf19('0x27')][_0xcf19('0x28')]=function(){return this[_0xcf19('0x24')]('ANSWER');};AGIChannel['prototype'][_0xcf19('0x29')]=function(_0x3c3c44,_0xa84e33,_0x982593){_0x3c3c44=_0x3c3c44===undefined?_0xcf19('0x2a'):_0x3c3c44;_0xa84e33=_0xa84e33===undefined?'5':_0xa84e33;_0x982593=_0x982593===undefined?'1':_0x982593;return this[_0xcf19('0x24')](util[_0xcf19('0x2b')](_0xcf19('0x2c'),_0x3c3c44,_0xa84e33*0x3e8,_0x982593));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x2d')]=function(_0x552b9f){_0x552b9f=_0x552b9f||'NO\x20MESSAGE';return this[_0xcf19('0x24')](util['format'](_0xcf19('0x2e'),_0x552b9f));};AGIChannel[_0xcf19('0x27')]['exec']=function(_0x1c96ab,_0x1a47a1){if(_[_0xcf19('0x2f')](_0x1a47a1)){return this['sendRequest'](util['format'](_0xcf19('0x30'),_0x1c96ab,_0x1a47a1[_0xcf19('0x31')](',')));}return this[_0xcf19('0x24')](util[_0xcf19('0x2b')]('EXEC\x20%s\x20%s',_0x1c96ab,_0x1a47a1));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x32')]=function(_0x4f075f){return this[_0xcf19('0x24')](util[_0xcf19('0x2b')](_0xcf19('0x33'),_0x4f075f));};AGIChannel[_0xcf19('0x27')]['setExtension']=function(_0x4b58ca){return this[_0xcf19('0x24')](util['format'](_0xcf19('0x34'),_0x4b58ca));};AGIChannel[_0xcf19('0x27')]['setPriority']=function(_0x101722){return this[_0xcf19('0x24')](util[_0xcf19('0x2b')](_0xcf19('0x35'),_0x101722));};AGIChannel[_0xcf19('0x27')][_0xcf19('0xe')]=function(){return this[_0xcf19('0x24')](_0xcf19('0x36'));};AGIChannel[_0xcf19('0x27')]['setVariable']=function(_0x82cc06,_0x5ea0bd){var _0x199114=_[_0xcf19('0x37')](_0x5ea0bd)||_[_0xcf19('0x38')](_0x5ea0bd)?_0x5ea0bd[_0xcf19('0x39')]():_0x5ea0bd;return this['sendRequest'](util[_0xcf19('0x2b')](_0xcf19('0x3a'),_0x82cc06,_0x199114?_0x199114[_0xcf19('0x39')]()[_0xcf19('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcf19('0x27')]['sayNumber']=function(_0x4f77ad,_0x53b01e){return this['sendRequest'](util[_0xcf19('0x2b')](_0xcf19('0x3b'),_0x4f77ad,_0x53b01e));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x3c')]=function(_0x3a2226,_0x53e83b){return this['sendRequest'](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x3a2226,_0x53e83b));};AGIChannel['prototype']['sayPhonetic']=function(_0x19668a,_0x322a54){return this[_0xcf19('0x24')](util[_0xcf19('0x2b')](_0xcf19('0x3d'),_0x19668a,_0x322a54));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x3e')]=function(_0x77c67b,_0x5e7e65,_0x554a3f){_0x5e7e65=_0x5e7e65||this[_0xcf19('0x3f')];_0x554a3f=_0x554a3f||0x1;this[_0xcf19('0x32')](_0x77c67b);this[_0xcf19('0x40')](_0x5e7e65);this[_0xcf19('0x41')](_0x554a3f);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x77c67b,_0x5e7e65,_0x554a3f));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x42')]=function(_0x4b0880){return this[_0xcf19('0x24')](util[_0xcf19('0x2b')](_0xcf19('0x43'),_0x4b0880));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x44')]=function(_0x10d79f,_0x11d67f,_0x535f89,_0xcca645,_0x4072be,_0x9a5dcb){_0x11d67f=_0x11d67f||'wav';_0x535f89=_0x535f89||'';_0xcca645=_0xcca645===undefined?-0x1:_0xcca645==='-1'?-0x1:_0xcca645*0x3e8;_0x4072be=_0x4072be===undefined?'':'s='+_0x4072be;_0x9a5dcb=_0x9a5dcb?_0xcf19('0x45'):'';return this[_0xcf19('0x24')](util['format'](_0xcf19('0x46'),_0x10d79f,_0x11d67f,_0x535f89,_0xcca645,_0x9a5dcb,_0x4072be));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x47')]=function(_0x6a770d,_0x210b27){_0x210b27=_0x210b27||'';return this['sendRequest'](util[_0xcf19('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x6a770d,_0x210b27));};AGIChannel[_0xcf19('0x27')][_0xcf19('0x48')]=function(_0x3b0108){return this[_0xcf19('0x49')](_0xcf19('0x4a'),_0x3b0108);};AGIChannel['prototype'][_0xcf19('0x4b')]=function(_0x50c40c){return this[_0xcf19('0x49')](_0xcf19('0x4c'),_0x50c40c);};AGIChannel[_0xcf19('0x27')][_0xcf19('0x1c')]=function(_0x35cd1c,_0x59c910){this['noop'](util['format'](_0xcf19('0x4d'),_0x35cd1c['id'],_0x35cd1c['label'],_0x59c910));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcf19('0x4e')]=AGIChannel; \ No newline at end of file +var _0xe4bd=['utf8','headers','ready','toLowerCase','emit','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','replace','result=','substr','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','setEncoding'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0xe4bd,0x89));var _0xde4b=function(_0x164951,_0x4c2c5d){_0x164951=_0x164951-0x0;var _0x448187=_0xe4bd[_0x164951];return _0x448187;};'use strict';var util=require(_0xde4b('0x0'));var _=require(_0xde4b('0x1'));var EventEmitter=require('events')[_0xde4b('0x2')];var AGIReply=require(_0xde4b('0x3'));var AGIError=require('./error');function AGIChannel(_0x565732){var _0x2a9809=this,_0x4cf2dc=new AGIReply(),_0x4d4e99=![],_0x1cfb8f={};EventEmitter['call'](_0x2a9809);_0x565732[_0xde4b('0x4')](_0xde4b('0x5'));_0x565732['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4cf2dc[_0xde4b('0x4')](_0xde4b('0x5'));_0x4cf2dc['on'](_0xde4b('0x6'),function(_0x5d9e62){for(var _0x56c3f7 in _0x5d9e62){_0x2a9809[_0x56c3f7]=_0x5d9e62[_0x56c3f7];}_0x2a9809['emit'](_0xde4b('0x7'));});_0x4cf2dc['on']('line',function(_0x5e34e5){if(_0x5e34e5[_0xde4b('0x8')]()=='hangup'){_0x2a9809[_0xde4b('0x9')](_0xde4b('0xa'));return;}if(_0x5e34e5[_0xde4b('0xb')](0x0,0xb)==_0xde4b('0xc')){_0x4d4e99=!![];}if(_0x4d4e99){_0x1cfb8f['rx']+=_0x5e34e5+'\x0a';if(_0x5e34e5['search'](_0xde4b('0xd'))!=-0x1){_0x4d4e99=![];}}else{_0x1cfb8f['rx']=_0x5e34e5;}if(_0x4d4e99){return;}if(typeof _0x1cfb8f['cb']==_0xde4b('0xe')){var _0x19d383=_0x1cfb8f['rx'][_0xde4b('0xb')](0x0,0x3),_0x645911=null,_0x54939c=null;_0x19d383=parseInt(_0x19d383);if(isNaN(_0x19d383)){_0x1cfb8f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x19d383!=0xc8){_0x1cfb8f['cb'](null,{'code':_0x19d383,'result':-0x1,'extra':'KO'});return;}_0x645911=_0x1cfb8f['rx'][_0xde4b('0xb')](0x4)[_0xde4b('0xf')](_0xde4b('0x10'),'');if(_0x645911['indexOf']('\x20')!=-0x1){_0x645911=_0x645911[_0xde4b('0x11')](0x0,_0x645911[_0xde4b('0x12')]('\x20'));}if(_[_0xde4b('0x13')](_0x645911,'-1')){_0x645911=parseInt(_0x645911);}_0x54939c=_0x1cfb8f['rx'][_0xde4b('0x14')]('\x20');if(_0x54939c[_0xde4b('0x15')]==0x3){_0x54939c=_0x54939c[0x2]['substring'](0x1,_0x54939c[0x2][_0xde4b('0x15')]-0x1);}else if(_0x54939c['length']>0x3){var _0x3ad061=/\((.+)\)/;var _0x3f35e2=_0x1cfb8f['rx'][_0xde4b('0x16')](_0x3ad061);if(_0x3f35e2){_0x54939c=_0x3f35e2[0x1];}else{_0x54939c=null;}}else{_0x54939c=null;}_0x1cfb8f['cb'](null,{'code':_0x19d383,'result':_0x645911,'extra':_0x54939c});}});_0x565732['on'](_0xde4b('0x17'),function(_0x95fe82){_0x2a9809[_0xde4b('0x9')](_0xde4b('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x95fe82[_0xde4b('0x18')]));});_0x565732['on'](_0xde4b('0x19'),function(){_0x2a9809[_0xde4b('0x9')](_0xde4b('0x19'),new AGIError(_0xde4b('0x1a')));});_0x565732['on'](_0xde4b('0x1b'),function(){_0x2a9809['emit'](_0xde4b('0x1b'),new AGIError(_0xde4b('0x1c')));_0x565732[_0xde4b('0x1d')]();});_0x565732[_0xde4b('0x1e')](_0x4cf2dc);this[_0xde4b('0x1f')]=function(_0x46afeb,_0x1bbf6f){var _0x46afeb=_0x46afeb||'',_0x1bbf6f=typeof _0x1bbf6f=='function'?_0x1bbf6f:new Function();_0x1cfb8f={'tx':_0x46afeb,'rx':'','cb':_0x1bbf6f};_0x565732['write'](_0x46afeb+'\x0a');},this[_0xde4b('0x19')]=function(){_0x565732[_0xde4b('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xde4b('0x20')][_0xde4b('0x21')]=function(_0x1d195a){return this['command'][_0xde4b('0x22')](this,_0x1d195a);};AGIChannel[_0xde4b('0x20')][_0xde4b('0x23')]=function(){return this['sendRequest'](_0xde4b('0x24'));};AGIChannel[_0xde4b('0x20')]['getData']=function(_0x4bf43e,_0x35adc9,_0x377a51){_0x4bf43e=_0x4bf43e===undefined?_0xde4b('0x25'):_0x4bf43e;_0x35adc9=_0x35adc9===undefined?'5':_0x35adc9;_0x377a51=_0x377a51===undefined?'1':_0x377a51;return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x27'),_0x4bf43e,_0x35adc9*0x3e8,_0x377a51));};AGIChannel['prototype'][_0xde4b('0x28')]=function(_0x35a6ac){_0x35a6ac=_0x35a6ac||_0xde4b('0x29');return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x2a'),_0x35a6ac));};AGIChannel['prototype'][_0xde4b('0x2b')]=function(_0x3b12ad,_0x53cd5c){if(_[_0xde4b('0x2c')](_0x53cd5c)){return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x2d'),_0x3b12ad,_0x53cd5c[_0xde4b('0x2e')](',')));}return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x2d'),_0x3b12ad,_0x53cd5c));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x2f')]=function(_0x19f217){return this['sendRequest'](util[_0xde4b('0x26')]('SET\x20CONTEXT\x20%s',_0x19f217));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x30')]=function(_0xab1e35){return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x31'),_0xab1e35));};AGIChannel[_0xde4b('0x20')]['setPriority']=function(_0x54828b){return this[_0xde4b('0x21')](util['format'](_0xde4b('0x32'),_0x54828b));};AGIChannel[_0xde4b('0x20')][_0xde4b('0xa')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xde4b('0x20')]['setVariable']=function(_0x2783e2,_0x33b45d){var _0x4507ac=_[_0xde4b('0x33')](_0x33b45d)||_[_0xde4b('0x34')](_0x33b45d)?_0x33b45d[_0xde4b('0x35')]():_0x33b45d;return this[_0xde4b('0x21')](util[_0xde4b('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2783e2,_0x4507ac?_0x4507ac[_0xde4b('0x35')]()[_0xde4b('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xde4b('0x20')]['sayNumber']=function(_0x1406bb,_0x163a4d){return this[_0xde4b('0x21')](util['format'](_0xde4b('0x36'),_0x1406bb,_0x163a4d));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x37')]=function(_0x57f2a1,_0x15e08b){return this['sendRequest'](util[_0xde4b('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x57f2a1,_0x15e08b));};AGIChannel[_0xde4b('0x20')]['sayPhonetic']=function(_0x1483ef,_0x3c974e){return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x38'),_0x1483ef,_0x3c974e));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x39')]=function(_0x4f6c2f,_0x1a73d7,_0x5d769f){_0x1a73d7=_0x1a73d7||this[_0xde4b('0x3a')];_0x5d769f=_0x5d769f||0x1;this['setContext'](_0x4f6c2f);this[_0xde4b('0x30')](_0x1a73d7);this[_0xde4b('0x3b')](_0x5d769f);return this[_0xde4b('0x28')](util[_0xde4b('0x26')](_0xde4b('0x3c'),_0x4f6c2f,_0x1a73d7,_0x5d769f));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x3d')]=function(_0x38efaf){return this[_0xde4b('0x21')](util[_0xde4b('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x38efaf));};AGIChannel['prototype'][_0xde4b('0x3e')]=function(_0x28b587,_0x373b0b,_0x1fe118,_0x5f108f,_0x2791e5,_0x336c74){_0x373b0b=_0x373b0b||_0xde4b('0x3f');_0x1fe118=_0x1fe118||'';_0x5f108f=_0x5f108f===undefined?-0x1:_0x5f108f==='-1'?-0x1:_0x5f108f*0x3e8;_0x2791e5=_0x2791e5===undefined?'':'s='+_0x2791e5;_0x336c74=_0x336c74?'BEEP':'';return this[_0xde4b('0x21')](util[_0xde4b('0x26')](_0xde4b('0x40'),_0x28b587,_0x373b0b,_0x1fe118,_0x5f108f,_0x336c74,_0x2791e5));};AGIChannel[_0xde4b('0x20')]['streamFile']=function(_0x37a92e,_0x5e211d){_0x5e211d=_0x5e211d||'';return this['sendRequest'](util[_0xde4b('0x26')](_0xde4b('0x41'),_0x37a92e,_0x5e211d));};AGIChannel[_0xde4b('0x20')][_0xde4b('0x42')]=function(_0x34816f){return this[_0xde4b('0x2b')]('AGI',_0x34816f);};AGIChannel[_0xde4b('0x20')]['wait']=function(_0x146e4c){return this[_0xde4b('0x2b')](_0xde4b('0x43'),_0x146e4c);};AGIChannel[_0xde4b('0x20')]['error']=function(_0x5e1fbb,_0x5977b1){this[_0xde4b('0x28')](util[_0xde4b('0x26')](_0xde4b('0x44'),_0x5e1fbb['id'],_0x5e1fbb[_0xde4b('0x45')],_0x5977b1));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xde4b('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 09ec342..11abd41 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 _0x412d=['Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x412d,0xf5));var _0xd412=function(_0x500555,_0x21715a){_0x500555=_0x500555-0x0;var _0x8bbecd=_0x412d[_0x500555];return _0x8bbecd;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xd412('0x0'),'E_AGI_ARGUMENT_PORT':_0xd412('0x1'),'E_AGI_SERVER_ERROR':_0xd412('0x2'),'E_AGI_SERVER_CLOSE':_0xd412('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xd412('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xd412('0x5'),'E_AGI_SOCKET_CLOSE':_0xd412('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xd412('0x7'),'E_AGI_COMMAND_EMPTY':_0xd412('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5ccb54){var _0x5ccb54=_0x5ccb54||null,_0xe3a84=_0xe3a84||[],_0x2bd970=0x1,_0x1c0eaf='';if(!error[_0x5ccb54]){_0x5ccb54=_0xd412('0x9');}_0xe3a84[_0xd412('0xa')](error[_0x5ccb54]);while(arguments[_0x2bd970]){_0xe3a84[_0xd412('0xa')](arguments[_0x2bd970]);_0x2bd970++;}_0x1c0eaf=util[_0xd412('0xb')][_0xd412('0xc')](util,_0xe3a84);this[_0xd412('0xd')]=_0x1c0eaf;this['name']=_0x5ccb54;}module['exports']=AGIError; \ No newline at end of file +var _0x68fc=['util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x2a7180,_0x34cb92){var _0x522588=function(_0x29a6b9){while(--_0x29a6b9){_0x2a7180['push'](_0x2a7180['shift']());}};_0x522588(++_0x34cb92);}(_0x68fc,0x165));var _0xc68f=function(_0x27315f,_0x4eb352){_0x27315f=_0x27315f-0x0;var _0x4ef1bd=_0x68fc[_0x27315f];return _0x4ef1bd;};'use strict';var util=require(_0xc68f('0x0'));var error={'E_AGI_UNDEFINED':_0xc68f('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc68f('0x2'),'E_AGI_SERVER_CLOSE':_0xc68f('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc68f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc68f('0x5'),'E_AGI_SOCKET_ERROR':_0xc68f('0x6'),'E_AGI_SOCKET_CLOSE':_0xc68f('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xc68f('0x8'),'E_AGI_COMMAND_EMPTY':_0xc68f('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc68f('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x43f286){var _0x43f286=_0x43f286||null,_0x56136c=_0x56136c||[],_0x54b9d7=0x1,_0x32c23='';if(!error[_0x43f286]){_0x43f286=_0xc68f('0xb');}_0x56136c[_0xc68f('0xc')](error[_0x43f286]);while(arguments[_0x54b9d7]){_0x56136c[_0xc68f('0xc')](arguments[_0x54b9d7]);_0x54b9d7++;}_0x32c23=util[_0xc68f('0xd')]['apply'](util,_0x56136c);this[_0xc68f('0xe')]=_0x32c23;this[_0xc68f('0xf')]=_0x43f286;}module[_0xc68f('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index b7a3ce7..9a96185 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5de=['projectUpdate','error','exports','lodash','events','ioredis','../../config/environment','redis','defaults','localhost','subscribe','emit','E_AGI_SERVER_ERROR','message','agi'];(function(_0x58c3eb,_0x3405e4){var _0x4686e9=function(_0x177f9b){while(--_0x177f9b){_0x58c3eb['push'](_0x58c3eb['shift']());}};_0x4686e9(++_0x3405e4);}(_0xe5de,0x6c));var _0xee5d=function(_0x4dee9d,_0x182d1c){_0x4dee9d=_0x4dee9d-0x0;var _0x3d0297=_0xe5de[_0x4dee9d];return _0x3d0297;};'use strict';var _=require(_0xee5d('0x0'));var EventEmitter=require(_0xee5d('0x1'))['EventEmitter'];var Redis=require(_0xee5d('0x2'));var AGIError=require('./error');var config=require(_0xee5d('0x3'));config[_0xee5d('0x4')]=_[_0xee5d('0x5')](config['redis'],{'host':_0xee5d('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xee5d('0x7')]('agi',function(_0x5f3e65){if(_0x5f3e65)return eventEmitter[_0xee5d('0x8')]('error',new AGIError(_0xee5d('0x9'),_0x5f3e65));});sub['on'](_0xee5d('0xa'),function(_0x48cf5d,_0x2e1ee4){if(_0x48cf5d!==_0xee5d('0xb'))return;try{var _0x476243=JSON['parse'](_0x2e1ee4);eventEmitter[_0xee5d('0x8')](_0xee5d('0xc'),_0x476243);}catch(_0x568e62){eventEmitter[_0xee5d('0x8')](_0xee5d('0xd'),new AGIError(_0xee5d('0x9'),_0x568e62));}});module[_0xee5d('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1bcd=['redis','defaults','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','EventEmitter','ioredis','../../config/environment'];(function(_0x265dec,_0x3082bc){var _0x84ec1d=function(_0x1c61f0){while(--_0x1c61f0){_0x265dec['push'](_0x265dec['shift']());}};_0x84ec1d(++_0x3082bc);}(_0x1bcd,0x183));var _0xd1bc=function(_0x1431df,_0x3b3773){_0x1431df=_0x1431df-0x0;var _0x18978b=_0x1bcd[_0x1431df];return _0x18978b;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xd1bc('0x0')];var Redis=require(_0xd1bc('0x1'));var AGIError=require('./error');var config=require(_0xd1bc('0x2'));config[_0xd1bc('0x3')]=_[_0xd1bc('0x4')](config[_0xd1bc('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd1bc('0x3')]);sub['subscribe'](_0xd1bc('0x5'),function(_0x4fb098){if(_0x4fb098)return eventEmitter[_0xd1bc('0x6')](_0xd1bc('0x7'),new AGIError(_0xd1bc('0x8'),_0x4fb098));});sub['on'](_0xd1bc('0x9'),function(_0x575f9e,_0x231fab){if(_0x575f9e!=='agi')return;try{var _0x19caac=JSON[_0xd1bc('0xa')](_0x231fab);eventEmitter[_0xd1bc('0x6')](_0xd1bc('0xb'),_0x19caac);}catch(_0x25d7c5){eventEmitter['emit'](_0xd1bc('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x25d7c5));}});module[_0xd1bc('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 3bbfc5f..a0e04f6 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 _0xc13b=['condition','split','agicommand','vswitch','default','target','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available'];(function(_0xc29e65,_0x7f1e9e){var _0x36240d=function(_0x29a1ce){while(--_0x29a1ce){_0xc29e65['push'](_0xc29e65['shift']());}};_0x36240d(++_0x7f1e9e);}(_0xc13b,0xc0));var _0xbc13=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xc13b[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xbc13('0x0'));var verticesWithRetry=[_0xbc13('0x1'),'getdigits',_0xbc13('0x2')];var Graph=function(){this['vertices']={};this[_0xbc13('0x3')]={};this[_0xbc13('0x4')]=0x0;};Graph[_0xbc13('0x5')][_0xbc13('0x6')]=function(_0x4f5b22){this[_0xbc13('0x7')][_0x4f5b22['id']]=_0x4f5b22;this[_0xbc13('0x3')][_0x4f5b22['id']]=[];};Graph[_0xbc13('0x5')][_0xbc13('0x8')]=function(_0x3e9b6e,_0xf685f0,_0x340534){this[_0xbc13('0x3')][_0x3e9b6e][_0xbc13('0x9')]({'target':_0xf685f0,'condition':_0x340534});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _[_0xbc13('0xa')](this[_0xbc13('0x7')]);};Graph[_0xbc13('0x5')][_0xbc13('0xb')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0xbc13('0xc')]=function(_0x485b5f){return this[_0xbc13('0x7')][_0x485b5f];};Graph[_0xbc13('0x5')]['traverseBFS']=function(_0xeb958f,_0x153958){if(!this[_0xbc13('0x7')][_0xeb958f]){return logger[_0xbc13('0xd')](_0xbc13('0xe'));}var _0x181f15=_0x153958(this[_0xbc13('0x7')][_0xeb958f]);if(!_0x181f15){return logger[_0xbc13('0xd')](_0xbc13('0xf'));}if(this[_0xbc13('0x3')][_0xeb958f][_0xbc13('0x10')]===0x0){return logger[_0xbc13('0xd')](_0xbc13('0x11'));}for(var _0x585c7a=0x0,_0x365364=[],_0x5d19db=![];_0x585c7a\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','evtHangup','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','close','hangup','find','handleNotFound','handleUnpublished','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','agi','./rpc','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted'];(function(_0x4b7522,_0x44875c){var _0x59a10f=function(_0x41f592){while(--_0x41f592){_0x4b7522['push'](_0x4b7522['shift']());}};_0x59a10f(++_0x44875c);}(_0xa984,0xce));var _0x4a98=function(_0x482b74,_0x4ff641){_0x482b74=_0x482b74-0x0;var _0x3c478f=_0xa984[_0x482b74];return _0x3c478f;};'use strict';var _=require(_0x4a98('0x0'));var syncho=require(_0x4a98('0x1'));var util=require(_0x4a98('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x4a98('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x4a98('0x4'));var Project=require('./project');var AGIEmitter=require(_0x4a98('0x5'))[_0x4a98('0x6')];var projects=[];config[_0x4a98('0x3')]=_[_0x4a98('0x7')](config[_0x4a98('0x3')],{'ip':_0x4a98('0x8'),'port':0x11dd});AGIEmitter['on'](_0x4a98('0x9'),projectUpdateHandler);function connectionHandler(_0xb52eaa){process[_0x4a98('0xa')](function(){syncho(function(){try{setChannelVariables(_0xb52eaa);agiHandler(_0xb52eaa);}catch(_0x37bdf3){logger['error'](_0x37bdf3[_0x4a98('0xb')]);}});});}function projectUpdateHandler(_0x228656){try{var _0x245504=_[_0x4a98('0xc')](projects,['id',_0x228656['id']]);if(_0x245504>-0x1){if(_0x228656[_0x4a98('0xd')]===!![]){projects[_0x4a98('0xe')](_0x245504,0x1);}else{projects[_0x245504]=_0x228656;}}else{projects['push'](_0x228656);}}catch(_0x55d360){logger[_0x4a98('0xf')](_0x55d360[_0x4a98('0xb')]);}}function listeningHandler(){var _0x48281d=config[_0x4a98('0x10')]===_0x4a98('0x11')||![];console[_0x4a98('0x12')](_0x4a98('0x13'),config[_0x4a98('0x3')][_0x4a98('0x14')]);logger[_0x4a98('0x15')](util[_0x4a98('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x48281d?config[_0x4a98('0x3')]['ip']:_0x4a98('0x17'),config['agi'][_0x4a98('0x14')]));}function errorHandler(_0x238a87){if(_0x238a87&&_0x238a87[_0x4a98('0x18')]&&_0x238a87['message']){logger[_0x4a98('0xf')](util[_0x4a98('0x16')]('[%s]\x20%s',_0x238a87[_0x4a98('0x18')],_0x238a87[_0x4a98('0x19')]));}else{logger[_0x4a98('0xf')](util[_0x4a98('0x16')](_0x4a98('0x1a'),_0x238a87[_0x4a98('0xb')]));}}function closeHandler(){logger[_0x4a98('0x15')](util[_0x4a98('0x16')](_0x4a98('0x1b'),this[_0x4a98('0x1c')],this[_0x4a98('0x1d')],this[_0x4a98('0x1e')],this[_0x4a98('0x1f')],this[_0x4a98('0x20')]));try{createSquareReport(this);}catch(_0x159453){logger[_0x4a98('0xf')](_0x159453[_0x4a98('0xb')]);}}function timeoutHandler(){logger[_0x4a98('0x15')](util[_0x4a98('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4a98('0x1c')],this['calleridname'],this[_0x4a98('0x1e')],this[_0x4a98('0x1f')],this[_0x4a98('0x20')]));}function hangupHandler(){logger['info'](util[_0x4a98('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4a98('0x1c')],this[_0x4a98('0x1d')],this[_0x4a98('0x1e')],this[_0x4a98('0x1f')],this[_0x4a98('0x20')]));this[_0x4a98('0x21')]=!![];}function createSquareReport(_0xbe9b88,_0x1ce4aa){rpc['createSquareReport'](_0xbe9b88)[_0x4a98('0x22')](function(_0x414358){if(_0x1ce4aa){_0x1ce4aa(null,_0x414358);}})[_0x4a98('0x23')](function(_0x1cac99){if(_0x1ce4aa){_0x1ce4aa(null,_0x1cac99);}});}function setChannelVariables(_0x167f06){for(var _0x64d056 in _0x167f06){if(_0x167f06[_0x4a98('0x24')](_0x64d056)){if(_0x64d056[_0x4a98('0x25')]('agi_')===0x0){_0x167f06[_0x64d056[_0x4a98('0x26')](0x4)]=_0x167f06[_0x64d056];delete _0x167f06[_0x64d056];}}}}function agiHandler(_0x6e40ff){logger[_0x4a98('0x27')](_0x4a98('0x28'),JSON[_0x4a98('0x29')](_0x6e40ff,null,0x2));logger[_0x4a98('0x15')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x6e40ff[_0x4a98('0x1c')],_0x6e40ff['calleridname'],_0x6e40ff[_0x4a98('0x1e')],_0x6e40ff[_0x4a98('0x1f')],_0x6e40ff[_0x4a98('0x20')]));_0x6e40ff['on']('error',errorHandler);_0x6e40ff['on'](_0x4a98('0x2a'),closeHandler);_0x6e40ff['on']('timeout',timeoutHandler);_0x6e40ff[_0x4a98('0x21')]=![];_0x6e40ff['on'](_0x4a98('0x2b'),hangupHandler);var _0x216a39=_[_0x4a98('0x2c')](projects,['name',_0x6e40ff['arg_1']]);if(!_0x216a39)return Project[_0x4a98('0x2d')](_0x6e40ff);if(!_0x216a39[_0x4a98('0x11')])return Project[_0x4a98('0x2e')](_0x6e40ff);return Project['initialize'](_0x216a39,_0x6e40ff);}function main(){var _0x531d60;return utilLicense['getLicense']()[_0x4a98('0x22')](function(_0x170193){if(!_0x170193)return;if(_0x170193[_0x4a98('0x2f')]){if(_0x170193[_0x4a98('0x30')]&&_0x170193[_0x4a98('0x30')]>0x0){logger[_0x4a98('0x15')](util[_0x4a98('0x16')](_0x4a98('0x31'),_0x170193['callysquare']));_0x531d60=_0x170193[_0x4a98('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x4a98('0x15')](_0x4a98('0x32'));_0x531d60=-0x1;}})[_0x4a98('0x22')](function(){return Project['getAll']();})['then'](function(_0x516c96){projects=_0x516c96;return;})['catch'](function(_0x2a88b9){logger[_0x4a98('0xf')](_0x4a98('0x33'),_0x2a88b9[_0x4a98('0xb')]);})['finally'](function(){var _0x131562=require(_0x4a98('0x34'))(config[_0x4a98('0x3')][_0x4a98('0x14')],config[_0x4a98('0x3')]['ip'],_0x531d60);_0x131562['on'](_0x4a98('0xf'),errorHandler);_0x131562['on'](_0x4a98('0x35'),listeningHandler);_0x131562['on'](_0x4a98('0x36'),connectionHandler);_0x131562['on'](_0x4a98('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x5807=['[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','./server','listening','connection','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1','nextTick','stack','findIndex','deleted','splice','push','error','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','evtHangup','createSquareReport','catch','hasOwnProperty','substring','debug','variables','close','timeout','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x133fd7,_0x2095fa){var _0x2f7c62=function(_0x27b6c9){while(--_0x27b6c9){_0x133fd7['push'](_0x133fd7['shift']());}};_0x2f7c62(++_0x2095fa);}(_0x5807,0x1b4));var _0x7580=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x5807[_0x241424];return _0x3da798;};'use strict';var _=require(_0x7580('0x0'));var syncho=require('syncho');var util=require(_0x7580('0x1'));var config=require(_0x7580('0x2'));var logger=require(_0x7580('0x3'))(_0x7580('0x4'));var utilLicense=require(_0x7580('0x5'));var rpc=require(_0x7580('0x6'));var Project=require('./project');var AGIEmitter=require(_0x7580('0x7'))[_0x7580('0x8')];var projects=[];config[_0x7580('0x4')]=_['defaults'](config[_0x7580('0x4')],{'ip':_0x7580('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x2c3e7e){process[_0x7580('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2c3e7e);agiHandler(_0x2c3e7e);}catch(_0x1b071f){logger['error'](_0x1b071f[_0x7580('0xb')]);}});});}function projectUpdateHandler(_0x5a12c4){try{var _0x140bab=_[_0x7580('0xc')](projects,['id',_0x5a12c4['id']]);if(_0x140bab>-0x1){if(_0x5a12c4[_0x7580('0xd')]===!![]){projects[_0x7580('0xe')](_0x140bab,0x1);}else{projects[_0x140bab]=_0x5a12c4;}}else{projects[_0x7580('0xf')](_0x5a12c4);}}catch(_0x5460d3){logger[_0x7580('0x10')](_0x5460d3[_0x7580('0xb')]);}}function listeningHandler(){var _0x16b01d=config[_0x7580('0x11')]===_0x7580('0x12')||![];console[_0x7580('0x13')](_0x7580('0x14'),config[_0x7580('0x4')][_0x7580('0x15')]);logger[_0x7580('0x16')](util[_0x7580('0x17')](_0x7580('0x18'),_0x16b01d?config[_0x7580('0x4')]['ip']:_0x7580('0x19'),config['agi'][_0x7580('0x15')]));}function errorHandler(_0xff5a7d){if(_0xff5a7d&&_0xff5a7d[_0x7580('0x1a')]&&_0xff5a7d[_0x7580('0x1b')]){logger['error'](util[_0x7580('0x17')](_0x7580('0x1c'),_0xff5a7d[_0x7580('0x1a')],_0xff5a7d[_0x7580('0x1b')]));}else{logger[_0x7580('0x10')](util[_0x7580('0x17')](_0x7580('0x1d'),_0xff5a7d[_0x7580('0xb')]));}}function closeHandler(){logger[_0x7580('0x16')](util[_0x7580('0x17')](_0x7580('0x1e'),this[_0x7580('0x1f')],this['calleridname'],this['callerid'],this[_0x7580('0x20')],this[_0x7580('0x21')]));try{createSquareReport(this);}catch(_0x3dd1b5){logger[_0x7580('0x10')](_0x3dd1b5[_0x7580('0xb')]);}}function timeoutHandler(){logger[_0x7580('0x16')](util[_0x7580('0x17')](_0x7580('0x22'),this['arg_1'],this[_0x7580('0x23')],this[_0x7580('0x24')],this[_0x7580('0x20')],this[_0x7580('0x21')]));}function hangupHandler(){logger[_0x7580('0x16')](util[_0x7580('0x17')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7580('0x1f')],this[_0x7580('0x23')],this['callerid'],this[_0x7580('0x20')],this[_0x7580('0x21')]));this[_0x7580('0x25')]=!![];}function createSquareReport(_0x37fe1b,_0x41f752){rpc[_0x7580('0x26')](_0x37fe1b)['then'](function(_0x3eeef6){if(_0x41f752){_0x41f752(null,_0x3eeef6);}})[_0x7580('0x27')](function(_0x3bc025){if(_0x41f752){_0x41f752(null,_0x3bc025);}});}function setChannelVariables(_0x16d19b){for(var _0x55d79e in _0x16d19b){if(_0x16d19b[_0x7580('0x28')](_0x55d79e)){if(_0x55d79e['indexOf']('agi_')===0x0){_0x16d19b[_0x55d79e[_0x7580('0x29')](0x4)]=_0x16d19b[_0x55d79e];delete _0x16d19b[_0x55d79e];}}}}function agiHandler(_0x8c8631){logger[_0x7580('0x2a')](_0x7580('0x2b'),JSON['stringify'](_0x8c8631,null,0x2));logger[_0x7580('0x16')](util[_0x7580('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x8c8631[_0x7580('0x1f')],_0x8c8631[_0x7580('0x23')],_0x8c8631[_0x7580('0x24')],_0x8c8631[_0x7580('0x20')],_0x8c8631[_0x7580('0x21')]));_0x8c8631['on'](_0x7580('0x10'),errorHandler);_0x8c8631['on'](_0x7580('0x2c'),closeHandler);_0x8c8631['on'](_0x7580('0x2d'),timeoutHandler);_0x8c8631[_0x7580('0x25')]=![];_0x8c8631['on']('hangup',hangupHandler);var _0x478903=_[_0x7580('0x2e')](projects,[_0x7580('0x1a'),_0x8c8631[_0x7580('0x1f')]]);if(!_0x478903)return Project[_0x7580('0x2f')](_0x8c8631);if(!_0x478903[_0x7580('0x12')])return Project['handleUnpublished'](_0x8c8631);return Project[_0x7580('0x30')](_0x478903,_0x8c8631);}function main(){var _0xd6b9f5;return utilLicense['getLicense']()['then'](function(_0x3cc465){if(!_0x3cc465)return;if(_0x3cc465[_0x7580('0x31')]){if(_0x3cc465[_0x7580('0x32')]&&_0x3cc465[_0x7580('0x32')]>0x0){logger[_0x7580('0x16')](util[_0x7580('0x17')](_0x7580('0x33'),_0x3cc465['callysquare']));_0xd6b9f5=_0x3cc465[_0x7580('0x32')];}else{logger['info'](_0x7580('0x34'));}}else{logger[_0x7580('0x16')](_0x7580('0x35'));_0xd6b9f5=-0x1;}})[_0x7580('0x36')](function(){return Project[_0x7580('0x37')]();})[_0x7580('0x36')](function(_0x27b074){projects=_0x27b074;return;})['catch'](function(_0xa6333){logger[_0x7580('0x10')](_0x7580('0x38'),_0xa6333[_0x7580('0xb')]);})[_0x7580('0x39')](function(){var _0x30da35=require(_0x7580('0x3a'))(config['agi'][_0x7580('0x15')],config[_0x7580('0x4')]['ip'],_0xd6b9f5);_0x30da35['on'](_0x7580('0x10'),errorHandler);_0x30da35['on'](_0x7580('0x3b'),listeningHandler);_0x30da35['on'](_0x7580('0x3c'),connectionHandler);_0x30da35['on'](_0x7580('0x2c'),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 d3cd63c..7ed96a8 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 _0x2dda=['then','error','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x585a3d,_0x254d75){var _0x3f6f06=function(_0x3b2fe3){while(--_0x3b2fe3){_0x585a3d['push'](_0x585a3d['shift']());}};_0x3f6f06(++_0x254d75);}(_0x2dda,0x146));var _0xa2dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dda[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xa2dd('0x0'));var jayson=require(_0xa2dd('0x1'));var client=jayson['client'][_0xa2dd('0x2')]({'port':0x232b});function request(_0x54ea65,_0x53218d){return new BPromise(function(_0x1bcc0c,_0x344130){return client['request'](_0x54ea65,_0x53218d)[_0xa2dd('0x3')](function(_0x127515){if(_0x127515['error']){return _0x344130(_0x127515[_0xa2dd('0x4')]['message']);}else{return _0x1bcc0c(_0x127515['result']);}})['catch'](function(_0x535f13){return _0x344130(_0x535f13);});});}exports[_0xa2dd('0x5')]=function(_0xfe36c,_0x1c1f7c){return request(_0xa2dd('0x6'),{'account':_0xfe36c,'message':_0x1c1f7c});}; \ No newline at end of file +var _0xe052=['http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x4b103d,_0x5d8238){var _0x589d3a=function(_0x321f30){while(--_0x321f30){_0x4b103d['push'](_0x4b103d['shift']());}};_0x589d3a(++_0x5d8238);}(_0xe052,0x8a));var _0x2e05=function(_0x5ca037,_0x33d189){_0x5ca037=_0x5ca037-0x0;var _0x28ad94=_0xe052[_0x5ca037];return _0x28ad94;};'use strict';var BPromise=require(_0x2e05('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x2e05('0x1')][_0x2e05('0x2')]({'port':0x232b});function request(_0x45593b,_0x57de73){return new BPromise(function(_0x5df2cc,_0x266a1b){return client['request'](_0x45593b,_0x57de73)[_0x2e05('0x3')](function(_0x5a2c09){if(_0x5a2c09[_0x2e05('0x4')]){return _0x266a1b(_0x5a2c09[_0x2e05('0x4')][_0x2e05('0x5')]);}else{return _0x5df2cc(_0x5a2c09[_0x2e05('0x6')]);}})[_0x2e05('0x7')](function(_0x32fc61){return _0x266a1b(_0x32fc61);});});}exports[_0x2e05('0x8')]=function(_0x1da934,_0x4c33b5){return request(_0x2e05('0x9'),{'account':_0x1da934,'message':_0x4c33b5});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 0a7fcec..5793530 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde6f=['production','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','start','clear','vertex','stringify','context','priority','agicommand','response','code','result','evtHangup','error','agicommand\x20not\x20found','finally','arg_1','calleridname','traverseBFS','toString','[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','extension','close','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','./vertices','getSquareProjects','catch','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','root','inspect'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0xde6f,0xda));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfde6('0x0'));var moment=require(_0xfde6('0x1'));var parser=require(_0xfde6('0x2'));var util=require(_0xfde6('0x3'));var logger=require(_0xfde6('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0xfde6('0x5'));var Graph=require('./graph');var Vertices=require(_0xfde6('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xfde6('0x7')]()[_0xfde6('0x8')](function(_0x2030bf){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x2030bf[_0xfde6('0x9')]);return[];});}function addVertex(_0x300a11,_0x58315c,_0x287d84){_0x58315c['agicommand']=_0x287d84;if(_0x58315c[_0xfde6('0xa')](_0xfde6('0xb'))){_0x58315c[_0xfde6('0xc')]=parseInt(_0x58315c['retry'],0xa);}_0x300a11[_0xfde6('0xd')](_[_0xfde6('0xe')](_0x58315c,_0xfde6('0xf')));}function initGraph(_0x4fda0e,_0x7ce6e5){var _0x5c01c4=new Graph();for(var _0x4ed61c in _0x4fda0e){if(_0x4fda0e['hasOwnProperty'](_0x4ed61c)){if(_[_0xfde6('0x10')](_0x4fda0e[_0x4ed61c])){for(var _0x479af2=0x0;_0x479af2<_0x4fda0e[_0x4ed61c][_0xfde6('0x11')];_0x479af2+=0x1){addVertex(_0x5c01c4,_0x4fda0e[_0x4ed61c][_0x479af2],_0x4ed61c);}}else{addVertex(_0x5c01c4,_0x4fda0e[_0x4ed61c],_0x4ed61c);}}}for(var _0x4243ba=0x0;_0x4243ba<_0x7ce6e5[_0xfde6('0x11')];_0x4243ba+=0x1){if(_0x7ce6e5[_0x4243ba]['source']&&_0x7ce6e5[_0x4243ba][_0xfde6('0x12')]){_0x5c01c4[_0xfde6('0x13')](_0x7ce6e5[_0x4243ba][_0xfde6('0x14')],_0x7ce6e5[_0x4243ba]['target'],_0x7ce6e5[_0x4243ba][_0xfde6('0x15')]);}}return _0x5c01c4;}function getRoot(_0x3cfbc3){return parser[_0xfde6('0x16')](_0x3cfbc3,{'object':!![]})[_0xfde6('0x17')][_0xfde6('0x18')];}function inspect(_0x265b97){return util[_0xfde6('0x19')](_0x265b97,{'showHidden':![],'depth':null});}function initialize(_0x335548,_0x42b5b8){var _0x5a9ed2=getRoot(_0x335548[_0xfde6('0x1a')]);if(!_0x5a9ed2||!_0x5a9ed2['start'])return;var _0x107ff0,_0x17a5ea,_0x1ef955;logger[_0xfde6('0x1b')](_0xfde6('0x18'),JSON['stringify'](_0x5a9ed2,null,0x2));_0x42b5b8[_0xfde6('0x1c')]=moment()[_0xfde6('0x1d')](_0xfde6('0x1e'));_0x107ff0=initGraph(_[_0xfde6('0xe')](_0x5a9ed2,_0xfde6('0xf')),_0x5a9ed2[_0xfde6('0xf')]);_0x17a5ea=new Vertices(_0x42b5b8,rpc,mailRpc);logger[_0xfde6('0x1f')](util['format'](_0xfde6('0x20'),_0x42b5b8['arg_1'],_0x42b5b8['calleridname'],_0x42b5b8[_0xfde6('0x21')],_0x42b5b8[_0xfde6('0x22')],_0x42b5b8[_0xfde6('0x23')]));_0x107ff0['traverseBFS'](_0x5a9ed2[_0xfde6('0x24')]['id'],function(_0x2ba7d6){try{_0x2ba7d6=_0x17a5ea[_0xfde6('0x25')](_0x2ba7d6);logger['debug'](_0xfde6('0x26'),JSON[_0xfde6('0x27')](_0x2ba7d6,null,0x2));if(_0x2ba7d6['agicommand']==='gotoc'){logger[_0xfde6('0x1f')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x42b5b8['context']=_0x2ba7d6[_0xfde6('0x28')]||_0x42b5b8[_0xfde6('0x28')];_0x42b5b8['extension']=_0x2ba7d6['extension'];_0x42b5b8[_0xfde6('0x29')]=_0x2ba7d6[_0xfde6('0x29')]?_0x2ba7d6[_0xfde6('0x29')]-0x1:0x1;return null;}else if(_0x2ba7d6&&_0x17a5ea[_0x2ba7d6['agicommand']]){_0x1ef955=_0x17a5ea[_0x2ba7d6[_0xfde6('0x2a')]](_0x2ba7d6);logger['info'](_0xfde6('0x2b'),JSON[_0xfde6('0x27')](_0x1ef955,null,0x2));if(_0x1ef955&&_0x1ef955[_0xfde6('0x2c')]===AGI_CODE_SUCCESS&&_0x1ef955[_0xfde6('0x2d')]!==AGI_RESULT_ERROR&&!_0x42b5b8[_0xfde6('0x2e')]){logger[_0xfde6('0x1b')](_0xfde6('0x2b'),inspect(_0x1ef955));return _['isUndefined'](_0x1ef955[_0xfde6('0x2d')])?null:_0x1ef955['result']['toString']();}else{logger[_0xfde6('0x2f')]('response',inspect(_0x1ef955));return null;}}else{logger[_0xfde6('0x2f')](_0xfde6('0x30'));return null;}}catch(_0x6919d7){logger['error'](_0x6919d7[_0xfde6('0x9')]);return null;}});if(_0x5a9ed2[_0xfde6('0x31')]){logger[_0xfde6('0x1f')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42b5b8[_0xfde6('0x32')],_0x42b5b8[_0xfde6('0x33')],_0x42b5b8['callerid'],_0x42b5b8[_0xfde6('0x22')],_0x42b5b8[_0xfde6('0x23')]));_0x107ff0[_0xfde6('0x34')](_0x5a9ed2[_0xfde6('0x31')]['id'],function(_0x46de32){try{_0x46de32=_0x17a5ea['clear'](_0x46de32);logger['debug'](_0xfde6('0x26'),JSON[_0xfde6('0x27')](_0x46de32,null,0x2));if(_0x46de32&&_0x17a5ea[_0x46de32[_0xfde6('0x2a')]]){_0x1ef955=_0x17a5ea[_0x46de32[_0xfde6('0x2a')]](_0x46de32);if(_0x1ef955){logger['debug'](_0xfde6('0x2b'),inspect(_0x1ef955));return _['isUndefined'](_0x1ef955['result'])?null:_0x1ef955[_0xfde6('0x2d')][_0xfde6('0x35')]();}else{logger[_0xfde6('0x2f')](_0xfde6('0x2b'),inspect(_0x1ef955));return null;}}else{logger[_0xfde6('0x2f')]('agicommand\x20not\x20found');return null;}}catch(_0x2c2889){logger[_0xfde6('0x2f')](_0x2c2889['stack']);return null;}});}logger[_0xfde6('0x1f')](util[_0xfde6('0x1d')](_0xfde6('0x36'),_0x42b5b8['arg_1'],_0x42b5b8[_0xfde6('0x33')],_0x42b5b8[_0xfde6('0x21')],_0x42b5b8[_0xfde6('0x22')],_0x42b5b8[_0xfde6('0x23')]));logger[_0xfde6('0x1f')](util[_0xfde6('0x1d')](_0xfde6('0x37'),_0x42b5b8['context'],_0x42b5b8[_0xfde6('0x38')],parseInt(_0x42b5b8[_0xfde6('0x29')],0xa)+0x1));_0x42b5b8['continueAt'](_0x42b5b8[_0xfde6('0x28')],_0x42b5b8['extension'],parseInt(_0x42b5b8[_0xfde6('0x29')],0xa)+0x1);_0x42b5b8[_0xfde6('0x39')]();}function handleNotFound(_0x5baef3){logger[_0xfde6('0x2f')](util[_0xfde6('0x1d')]('Project\x20%s\x20not\x20found',_0x5baef3['arg_1']));_0x5baef3[_0xfde6('0x3a')](_0x5baef3['context'],_0x5baef3[_0xfde6('0x38')],parseInt(_0x5baef3[_0xfde6('0x29')],0xa)+0x1);_0x5baef3[_0xfde6('0x39')]();}function handleUnpublished(_0xb4f154){logger['error'](util['format'](_0xfde6('0x3b'),_0xb4f154[_0xfde6('0x32')]));_0xb4f154[_0xfde6('0x3a')](_0xb4f154[_0xfde6('0x28')],_0xb4f154['extension'],parseInt(_0xb4f154[_0xfde6('0x29')],0xa)+0x1);_0xb4f154['close']();}module[_0xfde6('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x3df2=['evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','moment','util','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','mxCell','length','source','target','addEdge','value','toJson','root','inspect','start','debug','stringify','format','omit','info','arg_1','calleridname','callerid','dnid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result'];(function(_0x55fc4a,_0x808780){var _0x49482a=function(_0x41b60b){while(--_0x41b60b){_0x55fc4a['push'](_0x55fc4a['shift']());}};_0x49482a(++_0x808780);}(_0x3df2,0x19c));var _0x23df=function(_0xcf95a8,_0x27f72f){_0xcf95a8=_0xcf95a8-0x0;var _0x303f47=_0x3df2[_0xcf95a8];return _0x303f47;};'use strict';var _=require('lodash');var moment=require(_0x23df('0x0'));var parser=require('xml2json');var util=require(_0x23df('0x1'));var logger=require('../../config/logger')(_0x23df('0x2'));var rpc=require(_0x23df('0x3'));var mailRpc=require(_0x23df('0x4'));var Graph=require('./graph');var Vertices=require(_0x23df('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x23df('0x6')]()[_0x23df('0x7')](function(_0x1c155b){logger[_0x23df('0x8')](_0x23df('0x9'),_0x1c155b[_0x23df('0xa')]);return[];});}function addVertex(_0x30a47b,_0x3dd1a7,_0x34a44e){_0x3dd1a7[_0x23df('0xb')]=_0x34a44e;if(_0x3dd1a7[_0x23df('0xc')](_0x23df('0xd'))){_0x3dd1a7[_0x23df('0xe')]=parseInt(_0x3dd1a7[_0x23df('0xd')],0xa);}_0x30a47b['addVertex'](_['omit'](_0x3dd1a7,_0x23df('0xf')));}function initGraph(_0x5d288c,_0x49f61c){var _0xa6f937=new Graph();for(var _0x234f20 in _0x5d288c){if(_0x5d288c[_0x23df('0xc')](_0x234f20)){if(_['isArray'](_0x5d288c[_0x234f20])){for(var _0x40d510=0x0;_0x40d510<_0x5d288c[_0x234f20][_0x23df('0x10')];_0x40d510+=0x1){addVertex(_0xa6f937,_0x5d288c[_0x234f20][_0x40d510],_0x234f20);}}else{addVertex(_0xa6f937,_0x5d288c[_0x234f20],_0x234f20);}}}for(var _0x15d1f2=0x0;_0x15d1f2<_0x49f61c['length'];_0x15d1f2+=0x1){if(_0x49f61c[_0x15d1f2][_0x23df('0x11')]&&_0x49f61c[_0x15d1f2][_0x23df('0x12')]){_0xa6f937[_0x23df('0x13')](_0x49f61c[_0x15d1f2][_0x23df('0x11')],_0x49f61c[_0x15d1f2][_0x23df('0x12')],_0x49f61c[_0x15d1f2][_0x23df('0x14')]);}}return _0xa6f937;}function getRoot(_0x4e5e53){return parser[_0x23df('0x15')](_0x4e5e53,{'object':!![]})['mxGraphModel'][_0x23df('0x16')];}function inspect(_0xe15b12){return util[_0x23df('0x17')](_0xe15b12,{'showHidden':![],'depth':null});}function initialize(_0x2297ae,_0x38d54f){var _0x23d97b=getRoot(_0x2297ae['production']);if(!_0x23d97b||!_0x23d97b[_0x23df('0x18')])return;var _0x345e90,_0x2ba233,_0x268b90;logger[_0x23df('0x19')](_0x23df('0x16'),JSON[_0x23df('0x1a')](_0x23d97b,null,0x2));_0x38d54f['joinAt']=moment()[_0x23df('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');_0x345e90=initGraph(_[_0x23df('0x1c')](_0x23d97b,'mxCell'),_0x23d97b[_0x23df('0xf')]);_0x2ba233=new Vertices(_0x38d54f,rpc,mailRpc);logger[_0x23df('0x1d')](util[_0x23df('0x1b')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x38d54f[_0x23df('0x1e')],_0x38d54f[_0x23df('0x1f')],_0x38d54f[_0x23df('0x20')],_0x38d54f[_0x23df('0x21')],_0x38d54f['uniqueid']));_0x345e90[_0x23df('0x22')](_0x23d97b[_0x23df('0x18')]['id'],function(_0x3915b7){try{_0x3915b7=_0x2ba233[_0x23df('0x23')](_0x3915b7);logger[_0x23df('0x19')](_0x23df('0x24'),JSON[_0x23df('0x1a')](_0x3915b7,null,0x2));if(_0x3915b7[_0x23df('0xb')]===_0x23df('0x25')){logger['info'](_0x23df('0x26'));_0x38d54f[_0x23df('0x27')]=_0x3915b7[_0x23df('0x27')]||_0x38d54f['context'];_0x38d54f[_0x23df('0x28')]=_0x3915b7['extension'];_0x38d54f['priority']=_0x3915b7[_0x23df('0x29')]?_0x3915b7[_0x23df('0x29')]-0x1:0x1;return null;}else if(_0x3915b7&&_0x2ba233[_0x3915b7['agicommand']]){_0x268b90=_0x2ba233[_0x3915b7[_0x23df('0xb')]](_0x3915b7);logger[_0x23df('0x1d')]('response',JSON[_0x23df('0x1a')](_0x268b90,null,0x2));if(_0x268b90&&_0x268b90[_0x23df('0x2a')]===AGI_CODE_SUCCESS&&_0x268b90[_0x23df('0x2b')]!==AGI_RESULT_ERROR&&!_0x38d54f[_0x23df('0x2c')]){logger[_0x23df('0x19')](_0x23df('0x2d'),inspect(_0x268b90));return _[_0x23df('0x2e')](_0x268b90[_0x23df('0x2b')])?null:_0x268b90[_0x23df('0x2b')][_0x23df('0x2f')]();}else{logger[_0x23df('0x8')](_0x23df('0x2d'),inspect(_0x268b90));return null;}}else{logger[_0x23df('0x8')](_0x23df('0x30'));return null;}}catch(_0x4dbc37){logger[_0x23df('0x8')](_0x4dbc37[_0x23df('0xa')]);return null;}});if(_0x23d97b[_0x23df('0x31')]){logger[_0x23df('0x1d')](util[_0x23df('0x1b')](_0x23df('0x32'),_0x38d54f[_0x23df('0x1e')],_0x38d54f['calleridname'],_0x38d54f['callerid'],_0x38d54f[_0x23df('0x21')],_0x38d54f[_0x23df('0x33')]));_0x345e90[_0x23df('0x22')](_0x23d97b[_0x23df('0x31')]['id'],function(_0x24d6a3){try{_0x24d6a3=_0x2ba233['clear'](_0x24d6a3);logger['debug'](_0x23df('0x24'),JSON[_0x23df('0x1a')](_0x24d6a3,null,0x2));if(_0x24d6a3&&_0x2ba233[_0x24d6a3[_0x23df('0xb')]]){_0x268b90=_0x2ba233[_0x24d6a3[_0x23df('0xb')]](_0x24d6a3);if(_0x268b90){logger['debug'](_0x23df('0x2d'),inspect(_0x268b90));return _[_0x23df('0x2e')](_0x268b90['result'])?null:_0x268b90['result'][_0x23df('0x2f')]();}else{logger[_0x23df('0x8')](_0x23df('0x2d'),inspect(_0x268b90));return null;}}else{logger[_0x23df('0x8')](_0x23df('0x30'));return null;}}catch(_0x3c5d47){logger[_0x23df('0x8')](_0x3c5d47[_0x23df('0xa')]);return null;}});}logger[_0x23df('0x1d')](util[_0x23df('0x1b')](_0x23df('0x34'),_0x38d54f[_0x23df('0x1e')],_0x38d54f['calleridname'],_0x38d54f['callerid'],_0x38d54f[_0x23df('0x21')],_0x38d54f['uniqueid']));logger[_0x23df('0x1d')](util[_0x23df('0x1b')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x38d54f[_0x23df('0x27')],_0x38d54f[_0x23df('0x28')],parseInt(_0x38d54f[_0x23df('0x29')],0xa)+0x1));_0x38d54f[_0x23df('0x35')](_0x38d54f[_0x23df('0x27')],_0x38d54f[_0x23df('0x28')],parseInt(_0x38d54f[_0x23df('0x29')],0xa)+0x1);_0x38d54f[_0x23df('0x36')]();}function handleNotFound(_0x2b186f){logger[_0x23df('0x8')](util[_0x23df('0x1b')](_0x23df('0x37'),_0x2b186f[_0x23df('0x1e')]));_0x2b186f[_0x23df('0x35')](_0x2b186f['context'],_0x2b186f[_0x23df('0x28')],parseInt(_0x2b186f[_0x23df('0x29')],0xa)+0x1);_0x2b186f[_0x23df('0x36')]();}function handleUnpublished(_0x13e072){logger[_0x23df('0x8')](util[_0x23df('0x1b')](_0x23df('0x38'),_0x13e072[_0x23df('0x1e')]));_0x13e072[_0x23df('0x35')](_0x13e072[_0x23df('0x27')],_0x13e072['extension'],parseInt(_0x13e072[_0x23df('0x29')],0xa)+0x1);_0x13e072[_0x23df('0x36')]();}module['exports']={'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 9561767..a248e2e 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 _0x2b39=['_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','slice','trim','emit','line','exports','util','stream','Transform','call'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2b39,0x11c));var _0x92b3=function(_0x13b6fc,_0x539ca2){_0x13b6fc=_0x13b6fc-0x0;var _0x5079aa=_0x2b39[_0x13b6fc];return _0x5079aa;};'use strict';var util=require(_0x92b3('0x0'));var Transform=require(_0x92b3('0x1'))[_0x92b3('0x2')];function AGIReply(_0x2b7073){Transform[_0x92b3('0x3')](this,_0x2b7073);this['_localBuffer']='';this[_0x92b3('0x4')]=![];}util[_0x92b3('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x92b3('0x6')]=function(_0x279fc4,_0x3f9be2,_0x12e85d){var _0x3bb2dd='\x0a',_0x2db13f=['\x0a\x0a',_0x92b3('0x7')],_0x145cf0=-0x1,_0x43d220=-0x1,_0x3bfce1='',_0x2430d7=0x0,_0x5daa62='',_0x140bf2='';this[_0x92b3('0x8')]+=_0x279fc4[_0x92b3('0x9')]();_0x5daa62=this[_0x92b3('0x8')];if(!this[_0x92b3('0x4')]){_0x2430d7=0x0;while(_0x2db13f[_0x2430d7]){while((_0x43d220=_0x5daa62[_0x92b3('0xa')](_0x2db13f[_0x2430d7]))!=-0x1){_0x3bfce1=_0x2db13f[_0x2430d7];_0x140bf2=_0x5daa62[_0x92b3('0xb')](0x0,_0x43d220);_0x5daa62=_0x5daa62[_0x92b3('0xb')](_0x43d220+_0x3bfce1[_0x92b3('0xc')]);var _0x449c70=_0x140bf2['split'](_0x3bb2dd),_0xa4b15b=0x0,_0x4d0cd7={},_0x1cef46='',_0x3a3ef5='',_0x362066=-0x1;while(_0x449c70[_0xa4b15b]){_0x362066=_0x449c70[_0xa4b15b][_0x92b3('0xa')](':');if(_0x362066!=-0x1){_0x1cef46=_0x449c70[_0xa4b15b][_0x92b3('0xd')](0x0,_0x362066)[_0x92b3('0xe')]();_0x3a3ef5=_0x449c70[_0xa4b15b][_0x92b3('0xd')](_0x362066+0x1)[_0x92b3('0xe')]();if(_0x1cef46[_0x92b3('0xc')]>0x0){_0x4d0cd7[_0x1cef46]=_0x3a3ef5;}}else{}_0xa4b15b++;}this[_0x92b3('0xf')]('headers',_0x4d0cd7);this['_inBody']=!![];}_0x2430d7++;}this[_0x92b3('0x8')]=_0x5daa62;}else{while((_0x145cf0=_0x5daa62[_0x92b3('0xa')](_0x3bb2dd))!=-0x1){_0x140bf2=_0x5daa62['substring'](0x0,_0x145cf0);this[_0x92b3('0xf')](_0x92b3('0x10'),_0x140bf2);_0x5daa62=_0x5daa62[_0x92b3('0xb')](_0x145cf0+_0x3bb2dd[_0x92b3('0xc')]);}this[_0x92b3('0x8')]=_0x5daa62;}_0x12e85d();};module[_0x92b3('0x11')]=AGIReply; \ No newline at end of file +var _0x2baf=['_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','trim','slice','emit','line','exports','util','stream','Transform'];(function(_0x261e49,_0x5dae29){var _0x28bbe5=function(_0x531a01){while(--_0x531a01){_0x261e49['push'](_0x261e49['shift']());}};_0x28bbe5(++_0x5dae29);}(_0x2baf,0xe7));var _0xf2ba=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x2baf[_0x38af48];return _0x445384;};'use strict';var util=require(_0xf2ba('0x0'));var Transform=require(_0xf2ba('0x1'))[_0xf2ba('0x2')];function AGIReply(_0x73483a){Transform['call'](this,_0x73483a);this[_0xf2ba('0x3')]='';this['_inBody']=![];}util[_0xf2ba('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xf2ba('0x5')]=function(_0x4b278c,_0x30e091,_0x5cc617){var _0x218117='\x0a',_0x4dc01f=['\x0a\x0a',_0xf2ba('0x6')],_0xb4d073=-0x1,_0x47bbe7=-0x1,_0x22b39f='',_0x5d00e5=0x0,_0x27438d='',_0x39ae25='';this['_localBuffer']+=_0x4b278c[_0xf2ba('0x7')]();_0x27438d=this[_0xf2ba('0x3')];if(!this[_0xf2ba('0x8')]){_0x5d00e5=0x0;while(_0x4dc01f[_0x5d00e5]){while((_0x47bbe7=_0x27438d[_0xf2ba('0x9')](_0x4dc01f[_0x5d00e5]))!=-0x1){_0x22b39f=_0x4dc01f[_0x5d00e5];_0x39ae25=_0x27438d[_0xf2ba('0xa')](0x0,_0x47bbe7);_0x27438d=_0x27438d[_0xf2ba('0xa')](_0x47bbe7+_0x22b39f[_0xf2ba('0xb')]);var _0xd3ed84=_0x39ae25[_0xf2ba('0xc')](_0x218117),_0x2cf68b=0x0,_0x40d67a={},_0x570ad8='',_0x6a379d='',_0x2141dd=-0x1;while(_0xd3ed84[_0x2cf68b]){_0x2141dd=_0xd3ed84[_0x2cf68b][_0xf2ba('0x9')](':');if(_0x2141dd!=-0x1){_0x570ad8=_0xd3ed84[_0x2cf68b]['slice'](0x0,_0x2141dd)[_0xf2ba('0xd')]();_0x6a379d=_0xd3ed84[_0x2cf68b][_0xf2ba('0xe')](_0x2141dd+0x1)[_0xf2ba('0xd')]();if(_0x570ad8[_0xf2ba('0xb')]>0x0){_0x40d67a[_0x570ad8]=_0x6a379d;}}else{}_0x2cf68b++;}this[_0xf2ba('0xf')]('headers',_0x40d67a);this[_0xf2ba('0x8')]=!![];}_0x5d00e5++;}this[_0xf2ba('0x3')]=_0x27438d;}else{while((_0xb4d073=_0x27438d[_0xf2ba('0x9')](_0x218117))!=-0x1){_0x39ae25=_0x27438d['substring'](0x0,_0xb4d073);this[_0xf2ba('0xf')](_0xf2ba('0x10'),_0x39ae25);_0x27438d=_0x27438d[_0xf2ba('0xa')](_0xb4d073+_0x218117['length']);}this[_0xf2ba('0x3')]=_0x27438d;}_0x5cc617();};module[_0xf2ba('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6a85a46..8a8c434 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 _0x4849=['ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','error','message','result','catch','getSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact'];(function(_0x4deb38,_0x4b084b){var _0x2037af=function(_0x2aed8e){while(--_0x2aed8e){_0x4deb38['push'](_0x4deb38['shift']());}};_0x2037af(++_0x4b084b);}(_0x4849,0x86));var _0x9484=function(_0x9b32dc,_0x2e9f4f){_0x9b32dc=_0x9b32dc-0x0;var _0x3b8f24=_0x4849[_0x9b32dc];return _0x3b8f24;};'use strict';var _=require(_0x9484('0x0'));var moment=require(_0x9484('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x9484('0x2')][_0x9484('0x3')]({'port':0x2329});function request(_0x189741,_0x17b19a){return new Promise(function(_0x1f7bd1,_0x3f3057){return client[_0x9484('0x4')](_0x189741,_0x17b19a)['then'](function(_0x237411){if(_0x237411[_0x9484('0x5')]){return _0x3f3057(_0x237411['error'][_0x9484('0x6')]);}else{return _0x1f7bd1(_0x237411[_0x9484('0x7')]);}})[_0x9484('0x8')](function(_0x387fb5){return _0x3f3057(_0x387fb5);});});}exports[_0x9484('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x9484('0xa'),_0x9484('0xb')]}});};exports[_0x9484('0xc')]=function(_0xa8058a){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xa8058a},'attributes':[_0x9484('0xb')]}});};exports[_0x9484('0xd')]=function(_0xaeb858){return request(_0x9484('0xe'),{'options':{'raw':![],'where':{'id':_0xaeb858},'include':[{'model':_0x9484('0xf'),'as':_0x9484('0x10'),'include':[{'model':_0x9484('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0x9484('0xa'),_0x9484('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5ed6a9){return request(_0x9484('0x13'),{'options':{'where':{'id':_0x5ed6a9},'attributes':[_0x9484('0xa')]}});};exports[_0x9484('0x14')]=function(_0x4200c1){return request(_0x9484('0x15'),{'options':{'where':{'id':_0x4200c1},'attributes':[_0x9484('0xa')]}});};exports[_0x9484('0x16')]=function(_0x3ff7d7){return request(_0x9484('0x17'),{'options':{'where':{'id':_0x3ff7d7},'attributes':[_0x9484('0xa')]}});};exports['getSquareOdbcById']=function(_0x96d182){return request(_0x9484('0x18'),{'options':{'where':{'id':_0x96d182},'attributes':['dsn']}});};exports[_0x9484('0x19')]=function(_0x30634f){return request(_0x9484('0x1a'),{'options':{'where':{'id':_0x30634f},'attributes':[_0x9484('0xa')]}});};exports[_0x9484('0x1b')]=function(_0x515320){return request(_0x9484('0x1c'),{'options':{'where':{'phone':_0x515320[_0x9484('0x1d')]},'attributes':['id']}});};exports[_0x9484('0x1e')]=function(_0x45f183){return request(_0x9484('0x1f'),{'options':{'where':{'id':_0x45f183},'attributes':['name']}});};exports[_0x9484('0x20')]=function(_0x225b76){return request('ShowSound',{'options':{'where':{'id':_0x225b76},'attributes':[_0x9484('0x21')]}});};exports['getIntervalById']=function(_0x1558e4){return request(_0x9484('0x22'),{'options':{'raw':![],'where':{'id':_0x1558e4},'include':[{'model':_0x9484('0x23'),'as':_0x9484('0x24')}]}});};exports[_0x9484('0x25')]=function(_0x39240b){return request(_0x9484('0x26'),{'options':{'where':{'id':_0x39240b},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x4bfc05){return request('CreateSmsMessage',{'body':_0x4bfc05});};exports[_0x9484('0x27')]=function(_0x41665b){return request(_0x9484('0x28'),{'body':_0x41665b});};exports[_0x9484('0x29')]=function(_0x299791){return request(_0x9484('0x2a'),{'body':_['merge'](_0x299791,{'project_name':_0x299791[_0x9484('0x2b')],'prev_project_name':_0x299791['arg_2']||'','is_subproject':_0x299791['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x9484('0x2c'))})});};exports[_0x9484('0x2d')]=function(_0x425760){return request(_0x9484('0x2e'),{'body':_0x425760});};exports['createSquareMessage']=function(_0x1addcb){return request(_0x9484('0x2f'),{'body':_0x1addcb});};exports[_0x9484('0x30')]=function(_0x563b13){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x563b13['phone'],'ListId':_0x563b13[_0x9484('0x31')]}}})[_0x9484('0x32')](function(_0x10a8d7){if(_0x10a8d7){return _0x10a8d7;}return request('CreateCmContact',{'body':_0x563b13});});};exports[_0x9484('0x33')]=function(_0x30cfd5){return request(_0x9484('0x34'),{'options':{'where':{'id':_0x30cfd5},'attributes':[_0x9484('0xa')]}});};exports[_0x9484('0x35')]=function(_0xb10926,_0x401123){return request(_0x9484('0x36'),{'body':{'interface':_0x401123},'options':{'where':_0xb10926}});};exports[_0x9484('0x37')]=function(_0x1839c8,_0x4b0fec,_0x1f8b1b){return request(_0x9484('0x38'),{'body':{'type':_0x4b0fec,'uniqueid':_0x1f8b1b},'options':{'where':_0x1839c8}});};exports[_0x9484('0x39')]=function(_0xf49813){return request(_0x9484('0x3a'),{'body':{},'options':{'where':_0xf49813}});};exports[_0x9484('0x3b')]=function(_0x17b0d7){return request(_0x9484('0x3c'),{'body':{},'options':{'where':_0x17b0d7}});}; \ No newline at end of file +var _0x9099=['getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','lodash','jayson/promise','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk'];(function(_0x2cfa09,_0x1ffa9a){var _0x5eafc4=function(_0x5c46f3){while(--_0x5c46f3){_0x2cfa09['push'](_0x2cfa09['shift']());}};_0x5eafc4(++_0x1ffa9a);}(_0x9099,0x1ac));var _0x9909=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x9099[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0x9909('0x0'));var moment=require('moment');var jayson=require(_0x9909('0x1'));var client=jayson[_0x9909('0x2')][_0x9909('0x3')]({'port':0x2329});function request(_0x2524d3,_0x3fd4b4){return new Promise(function(_0x34aabc,_0x2168ff){return client[_0x9909('0x4')](_0x2524d3,_0x3fd4b4)[_0x9909('0x5')](function(_0x25cf23){if(_0x25cf23[_0x9909('0x6')]){return _0x2168ff(_0x25cf23[_0x9909('0x6')][_0x9909('0x7')]);}else{return _0x34aabc(_0x25cf23[_0x9909('0x8')]);}})['catch'](function(_0x6d755a){return _0x2168ff(_0x6d755a);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x9909('0x9')]=function(_0x592725){return request(_0x9909('0xa'),{'options':{'raw':![],'where':{'name':_0x592725},'attributes':[_0x9909('0xb')]}});};exports[_0x9909('0xc')]=function(_0x514573){return request(_0x9909('0xd'),{'options':{'raw':![],'where':{'id':_0x514573},'include':[{'model':'MailServerOut','as':_0x9909('0xe'),'include':[{'model':_0x9909('0xf'),'as':_0x9909('0xf')}]}],'attributes':['id',_0x9909('0x10'),_0x9909('0x11')],'smtp':!![]}});};exports[_0x9909('0x12')]=function(_0x22224a){return request(_0x9909('0xa'),{'options':{'where':{'id':_0x22224a},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x13')]=function(_0x1c2668){return request(_0x9909('0x14'),{'options':{'where':{'id':_0x1c2668},'attributes':[_0x9909('0x10')]}});};exports['getVariableById']=function(_0x33a8e3){return request('ShowVariable',{'options':{'where':{'id':_0x33a8e3},'attributes':[_0x9909('0x10')]}});};exports['getSquareOdbcById']=function(_0x1a9c97){return request(_0x9909('0x15'),{'options':{'where':{'id':_0x1a9c97},'attributes':[_0x9909('0x16')]}});};exports['getUserById']=function(_0x9a16a6){return request(_0x9909('0x17'),{'options':{'where':{'id':_0x9a16a6},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x18')]=function(_0x1106e5){return request(_0x9909('0x19'),{'options':{'where':{'phone':_0x1106e5[_0x9909('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1b038f){return request(_0x9909('0x1b'),{'options':{'where':{'id':_0x1b038f},'attributes':['name']}});};exports[_0x9909('0x1c')]=function(_0x446ebb){return request(_0x9909('0x1d'),{'options':{'where':{'id':_0x446ebb},'attributes':[_0x9909('0x1e')]}});};exports[_0x9909('0x1f')]=function(_0x222cd9){return request(_0x9909('0x20'),{'options':{'raw':![],'where':{'id':_0x222cd9},'include':[{'model':'Interval','as':_0x9909('0x21')}]}});};exports[_0x9909('0x22')]=function(_0x4a626b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x4a626b},'attributes':['id',_0x9909('0x10')]}});};exports[_0x9909('0x23')]=function(_0xdd5088){return request(_0x9909('0x24'),{'body':_0xdd5088});};exports[_0x9909('0x25')]=function(_0x59c5c9){return request('CreateSquareDetailsReport',{'body':_0x59c5c9});};exports[_0x9909('0x26')]=function(_0x25007c){return request(_0x9909('0x27'),{'body':_[_0x9909('0x28')](_0x25007c,{'project_name':_0x25007c['arg_1'],'prev_project_name':_0x25007c[_0x9909('0x29')]||'','is_subproject':_0x25007c[_0x9909('0x29')]?!![]:![],'leaveAt':moment()[_0x9909('0x2a')](_0x9909('0x2b'))})});};exports['createSquareRecording']=function(_0x405c5e){return request(_0x9909('0x2c'),{'body':_0x405c5e});};exports[_0x9909('0x2d')]=function(_0x14ec4b){return request('CreateSquareMessage',{'body':_0x14ec4b});};exports[_0x9909('0x2e')]=function(_0x175d52){return request(_0x9909('0x2f'),{'options':{'raw':![],'where':{'phone':_0x175d52[_0x9909('0x1a')],'ListId':_0x175d52[_0x9909('0x30')]}}})[_0x9909('0x5')](function(_0x427530){if(_0x427530){return _0x427530;}return request('CreateCmContact',{'body':_0x175d52});});};exports[_0x9909('0x31')]=function(_0x3a3f4f){return request(_0x9909('0x32'),{'options':{'where':{'id':_0x3a3f4f},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x33')]=function(_0x519066,_0x4245eb){return request(_0x9909('0x34'),{'body':{'interface':_0x4245eb},'options':{'where':_0x519066}});};exports[_0x9909('0x35')]=function(_0x3e599a,_0xc1bd06,_0x222dd1){return request(_0x9909('0x36'),{'body':{'type':_0xc1bd06,'uniqueid':_0x222dd1},'options':{'where':_0x3e599a}});};exports[_0x9909('0x37')]=function(_0x59886b){return request('UnpauseUser',{'body':{},'options':{'where':_0x59886b}});};exports[_0x9909('0x38')]=function(_0x1afb2f){return request('LogoutUser',{'body':{},'options':{'where':_0x1afb2f}});}; \ 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 b1e7500..db95e48 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 _0xdc59=['./polly','./lex','exports'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdc59,0x12c));var _0x9dc5=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xdc59[_0x11005e];return _0x29338f;};var polly=require(_0x9dc5('0x0'));var lex=require(_0x9dc5('0x1'));module[_0x9dc5('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5024=['exports','./polly','./lex'];(function(_0x45468d,_0x17ec6b){var _0x53cc19=function(_0x303857){while(--_0x303857){_0x45468d['push'](_0x45468d['shift']());}};_0x53cc19(++_0x17ec6b);}(_0x5024,0xf7));var _0x4502=function(_0x1a9299,_0x1e8093){_0x1a9299=_0x1a9299-0x0;var _0x12e3ed=_0x5024[_0x1a9299];return _0x12e3ed;};var polly=require(_0x4502('0x0'));var lex=require(_0x4502('0x1'));module[_0x4502('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 55321ad..8c753f3 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 _0x750a=['exports'];(function(_0x23faa6,_0x3625c8){var _0x387ebe=function(_0x26e68f){while(--_0x26e68f){_0x23faa6['push'](_0x23faa6['shift']());}};_0x387ebe(++_0x3625c8);}(_0x750a,0x140));var _0xa750=function(_0x3f5b67,_0xd8d4e2){_0x3f5b67=_0x3f5b67-0x0;var _0x39fbff=_0x750a[_0x3f5b67];return _0x39fbff;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ No newline at end of file +var _0x9348=['exports','./lib/api'];(function(_0x23d43f,_0x42c3e2){var _0x17e07b=function(_0x3fc0c5){while(--_0x3fc0c5){_0x23d43f['push'](_0x23d43f['shift']());}};_0x17e07b(++_0x42c3e2);}(_0x9348,0x10d));var _0x8934=function(_0x247dff,_0x43f01c){_0x247dff=_0x247dff-0x0;var _0x17e32d=_0x9348[_0x247dff];return _0x17e32d;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ 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 4eb6dec..6ff436f 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(_0x2482d6,_0x9ef9b1){var _0x38f007=function(_0xe456db){while(--_0xe456db){_0x2482d6['push'](_0x2482d6['shift']());}};_0x38f007(++_0x9ef9b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x4c14f3,_0x30cb49){var _0x381404=function(_0x1068cf){while(--_0x1068cf){_0x4c14f3['push'](_0x4c14f3['shift']());}};_0x381404(++_0x30cb49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 94755a3..9e5b1f6 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 _0x220c=['./lib/api'];(function(_0x524cb1,_0x503314){var _0xaf5709=function(_0x83a46a){while(--_0x83a46a){_0x524cb1['push'](_0x524cb1['shift']());}};_0xaf5709(++_0x503314);}(_0x220c,0xe1));var _0xc220=function(_0x1156d3,_0x1899b4){_0x1156d3=_0x1156d3-0x0;var _0x146fe2=_0x220c[_0x1156d3];return _0x146fe2;};'use strict';var polly=require(_0xc220('0x0'));module['exports']=function(_0x43b211,_0x2c7d56,_0x3a35e6,_0x31fab0,_0x104085,_0x1fa1da,_0x1dd9db){return polly(_0x43b211,_0x2c7d56,_0x3a35e6,_0x31fab0,_0x104085,_0x1fa1da,_0x1dd9db);}; \ No newline at end of file +var _0x558c=['./lib/api'];(function(_0x5d45fd,_0x2ae7ee){var _0x1f16d7=function(_0x46567){while(--_0x46567){_0x5d45fd['push'](_0x5d45fd['shift']());}};_0x1f16d7(++_0x2ae7ee);}(_0x558c,0x18d));var _0xc558=function(_0x2ed341,_0x18f3c1){_0x2ed341=_0x2ed341-0x0;var _0x8b680f=_0x558c[_0x2ed341];return _0x8b680f;};'use strict';var polly=require(_0xc558('0x0'));module['exports']=function(_0x259a56,_0x4d9b67,_0x1b7507,_0x3c3bd5,_0x1bc7e6,_0x59dafd,_0x14360d){return polly(_0x259a56,_0x4d9b67,_0x1b7507,_0x3c3bd5,_0x1bc7e6,_0x59dafd,_0x14360d);}; \ 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 e9be1b4..99ebeb5 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 _0x00ee=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','exports','Polly'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x00ee,0x19c));var _0xe00e=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x00ee[_0x564821];return _0x2b604d;};'use strict';var fs=require('fs');var path=require(_0xe00e('0x0'));var BPromise=require(_0xe00e('0x1'));var rs=require(_0xe00e('0x2'));var AWS=require(_0xe00e('0x3'));function pollyResult(_0x49ddd8,_0x1450b9,_0x570bd1){return new BPromise(function(_0x33bad0,_0x597a1d){_0x49ddd8[_0xe00e('0x4')](_0x1450b9,function(_0x21ef8e,_0x5c11eb){if(_0x21ef8e){_0x597a1d(_0x21ef8e);}else if(_0x5c11eb){if(_0x5c11eb[_0xe00e('0x5')]instanceof Buffer){fs['writeFile'](_0x570bd1,_0x5c11eb[_0xe00e('0x5')],function(_0x4431d4){if(_0x4431d4){_0x597a1d(_0x4431d4);}else{_0x33bad0();}});}else{_0x597a1d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x597a1d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe00e('0x6')]=function(_0x1aa7a,_0x5af331,_0x5df23a,_0x1c0b67,_0x3e1a1a,_0x4ad116,_0x5eb683){var _0x1a32c6=new AWS[(_0xe00e('0x7'))]({'accessKeyId':_0x1aa7a,'secretAccessKey':_0x5af331,'region':_0x5df23a});var _0x9bf7d6={'Text':_0x3e1a1a,'TextType':_0x4ad116||_0xe00e('0x8'),'OutputFormat':_0xe00e('0x9'),'VoiceId':_0x1c0b67};return pollyResult(_0x1a32c6,_0x9bf7d6,_0x5eb683);}; \ No newline at end of file +var _0x7158=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x52224b,_0x2e6950){var _0x31f0f5=function(_0xaf7936){while(--_0xaf7936){_0x52224b['push'](_0x52224b['shift']());}};_0x31f0f5(++_0x2e6950);}(_0x7158,0x138));var _0x8715=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7158[_0x13ea00];return _0x1f7347;};'use strict';var fs=require('fs');var path=require(_0x8715('0x0'));var BPromise=require(_0x8715('0x1'));var rs=require(_0x8715('0x2'));var AWS=require(_0x8715('0x3'));function pollyResult(_0x24f329,_0x10980f,_0x3f6d67){return new BPromise(function(_0x1a2b3e,_0x41ccd7){_0x24f329[_0x8715('0x4')](_0x10980f,function(_0x5c8a3d,_0x1a7b95){if(_0x5c8a3d){_0x41ccd7(_0x5c8a3d);}else if(_0x1a7b95){if(_0x1a7b95[_0x8715('0x5')]instanceof Buffer){fs[_0x8715('0x6')](_0x3f6d67,_0x1a7b95[_0x8715('0x5')],function(_0x5510f4){if(_0x5510f4){_0x41ccd7(_0x5510f4);}else{_0x1a2b3e();}});}else{_0x41ccd7(new Error(_0x8715('0x7')));}}else{_0x41ccd7(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x8715('0x8')]=function(_0x3d8c37,_0x4a8c72,_0x56cb3b,_0x500a69,_0x270f58,_0x1d7c96,_0xd7c79f){var _0x352fad=new AWS['Polly']({'accessKeyId':_0x3d8c37,'secretAccessKey':_0x4a8c72,'region':_0x56cb3b});var _0x24547a={'Text':_0x270f58,'TextType':_0x1d7c96||_0x8715('0x9'),'OutputFormat':_0x8715('0xa'),'VoiceId':_0x500a69};return pollyResult(_0x352fad,_0x24547a,_0xd7c79f);}; \ 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 cec9bf2..3798788 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 _0x51e4=['./lib/api','exports'];(function(_0x5643a1,_0x335a54){var _0x4818e8=function(_0xdd5d8e){while(--_0xdd5d8e){_0x5643a1['push'](_0x5643a1['shift']());}};_0x4818e8(++_0x335a54);}(_0x51e4,0xfc));var _0x451e=function(_0x4e2e79,_0x580d9c){_0x4e2e79=_0x4e2e79-0x0;var _0x5b8eff=_0x51e4[_0x4e2e79];return _0x5b8eff;};'use strict';var asr=require(_0x451e('0x0'));module[_0x451e('0x1')]=function(_0x1a52d6,_0x117737,_0x179364,_0x2bffe7){return asr(_0x1a52d6,_0x117737,_0x179364);}; \ No newline at end of file +var _0x87f0=['exports'];(function(_0x4c3e96,_0x297395){var _0x38ec99=function(_0x12c7d2){while(--_0x12c7d2){_0x4c3e96['push'](_0x4c3e96['shift']());}};_0x38ec99(++_0x297395);}(_0x87f0,0x183));var _0x087f=function(_0x49f009,_0x55459a){_0x49f009=_0x49f009-0x0;var _0x12d842=_0x87f0[_0x49f009];return _0x12d842;};'use strict';var asr=require('./lib/api');module[_0x087f('0x0')]=function(_0xdbb7ba,_0x28e23e,_0x40a7e5,_0x4a2046){return asr(_0xdbb7ba,_0x28e23e,_0x40a7e5);}; \ 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 540dbd3..cf5177f 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 _0x2ce1=['length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','exports'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0x2ce1,0x8b));var _0x12ce=function(_0x21e569,_0x84dea2){_0x21e569=_0x21e569-0x0;var _0x406a6a=_0x2ce1[_0x21e569];return _0x406a6a;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x12ce('0x0')]=function(_0x190dc3,_0x9601f9,_0xfe8bb0){return new BPromise(function(_0x4918dc,_0x37b568){var _0x168e95;if(typeof _0x190dc3!=='string'||_0x190dc3[_0x12ce('0x1')]===0x0){return _0x37b568(_0x12ce('0x2'));}if(typeof _0x9601f9!==_0x12ce('0x3')||_0x9601f9['length']===0x0){return _0x37b568(_0x12ce('0x4'));}if(typeof _0xfe8bb0!=='undefined'&&(typeof _0xfe8bb0!==_0x12ce('0x3')||_0xfe8bb0[_0x12ce('0x1')]===0x0)){return _0x37b568(_0x12ce('0x5'));}try{_0x168e95=fs['readFileSync'](_0x190dc3)[_0x12ce('0x6')](_0x12ce('0x7'));}catch(_0x3e1ee9){return _0x37b568(_0x3e1ee9);}return _0x4918dc({'method':_0x12ce('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x9601f9,'body':{'config':{'encoding':_0x12ce('0x9'),'sampleRateHertz':'8000','languageCode':_0xfe8bb0},'audio':{'content':_0x168e95}},'json':!![]});});}; \ No newline at end of file +var _0xe130=['filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','url','bluebird','exports','string','length'];(function(_0x51d564,_0x137d27){var _0x1db56d=function(_0x573af5){while(--_0x573af5){_0x51d564['push'](_0x51d564['shift']());}};_0x1db56d(++_0x137d27);}(_0xe130,0x127));var _0x0e13=function(_0x21bcf8,_0x13269b){_0x21bcf8=_0x21bcf8-0x0;var _0x5a8c33=_0xe130[_0x21bcf8];return _0x5a8c33;};'use strict';var url=require(_0x0e13('0x0'));var BPromise=require(_0x0e13('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x0e13('0x2')]=function(_0x3cbccc,_0x1dd4fa,_0x360489){return new BPromise(function(_0x449ddd,_0x504f15){var _0x1489a9;if(typeof _0x3cbccc!==_0x0e13('0x3')||_0x3cbccc[_0x0e13('0x4')]===0x0){return _0x504f15(_0x0e13('0x5'));}if(typeof _0x1dd4fa!=='string'||_0x1dd4fa[_0x0e13('0x4')]===0x0){return _0x504f15('key\x20should\x20be\x20a\x20string');}if(typeof _0x360489!=='undefined'&&(typeof _0x360489!=='string'||_0x360489[_0x0e13('0x4')]===0x0)){return _0x504f15(_0x0e13('0x6'));}try{_0x1489a9=fs['readFileSync'](_0x3cbccc)['toString'](_0x0e13('0x7'));}catch(_0x124e0d){return _0x504f15(_0x124e0d);}return _0x449ddd({'method':_0x0e13('0x8'),'uri':host+_0x0e13('0x9')+_0x1dd4fa,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x360489},'audio':{'content':_0x1489a9}},'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 ea6c131..fd5629c 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4877=['exports','./asr'];(function(_0x5aeba7,_0xd318d6){var _0x2a9689=function(_0x29a4b2){while(--_0x29a4b2){_0x5aeba7['push'](_0x5aeba7['shift']());}};_0x2a9689(++_0xd318d6);}(_0x4877,0xad));var _0x7487=function(_0x4556e5,_0x4f839b){_0x4556e5=_0x4556e5-0x0;var _0x523295=_0x4877[_0x4556e5];return _0x523295;};var asr=require(_0x7487('0x0'));module[_0x7487('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbd0b=['exports','./asr'];(function(_0xb0b64a,_0x36774e){var _0x550abf=function(_0x425b0c){while(--_0x425b0c){_0xb0b64a['push'](_0xb0b64a['shift']());}};_0x550abf(++_0x36774e);}(_0xbd0b,0x1b5));var _0xbbd0=function(_0x96d067,_0x27afc7){_0x96d067=_0x96d067-0x0;var _0xbbc073=_0xbd0b[_0x96d067];return _0xbbc073;};var asr=require(_0xbbd0('0x0'));module[_0xbbd0('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 02d0831..0c82251 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 _0x9238=['tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','https','md5','querystring','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','data','end','transcode','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','queryText','responseId','intentDetectionConfidence'];(function(_0x38941c,_0x8ab496){var _0x44aaae=function(_0x235318){while(--_0x235318){_0x38941c['push'](_0x38941c['shift']());}};_0x44aaae(++_0x8ab496);}(_0x9238,0x9e));var _0x8923=function(_0x447df5,_0x3c74c3){_0x447df5=_0x447df5-0x0;var _0x487115=_0x9238[_0x447df5];return _0x487115;};'use strict';var apiai=require(_0x8923('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x8923('0x1'));var md5=require(_0x8923('0x2'));var path=require('path');var querystring=require(_0x8923('0x3'));var rp=require('request-promise');var rs=require(_0x8923('0x4'));var sox=require(_0x8923('0x5'));var tts=require(_0x8923('0x6'));var urlParse=require('url')[_0x8923('0x7')];var util=require(_0x8923('0x8'));var aws=require(_0x8923('0x9'));var google=require(_0x8923('0xa'));var sestek=require(_0x8923('0xb'));var tilde=require(_0x8923('0xc'));var logger=require(_0x8923('0xd'))(_0x8923('0xe'));var ISPEECH_API=_0x8923('0xf');function downloadFile(_0x5d72ed,_0x2b1202){return new BPromise(function(_0x4b021f,_0x2c202e){var _0x8273dd=urlParse(_0x5d72ed);var _0x271d1d=_0x8273dd['protocol']===_0x8923('0x10')?https:http;var _0x4502cf={'host':_0x8273dd[_0x8923('0x11')],'path':_0x8273dd[_0x8923('0x12')],'headers':{'user-agent':_0x8923('0x13')}};_0x271d1d['get'](_0x4502cf,function(_0x3e4c7e){if(_0x3e4c7e[_0x8923('0x14')]!==0xc8){logger[_0x8923('0x15')](_0x8923('0x16')+_0x5d72ed+_0x8923('0x17')+_0x3e4c7e[_0x8923('0x14')]+'\x20('+_0x3e4c7e[_0x8923('0x18')]+')');_0x2c202e(new Error(_0x8923('0x16')+_0x5d72ed+'\x20failed,\x20status\x20code\x20=\x20'+_0x3e4c7e['statusCode']+'\x20('+_0x3e4c7e[_0x8923('0x18')]+')'));return;}var _0x2b0058=fs[_0x8923('0x19')](_0x2b1202);_0x2b0058['on']('finish',function(){logger[_0x8923('0x1a')](_0x8923('0x1b'));_0x2b0058[_0x8923('0x1c')](_0x4b021f);});_0x2b0058['on'](_0x8923('0x15'),function(_0x2555bf){fs[_0x8923('0x1d')](_0x2b1202);logger[_0x8923('0x15')](_0x8923('0x1e'),_0x2555bf);_0x2c202e(_0x2555bf);});_0x3e4c7e[_0x8923('0x1f')](_0x2b0058);})['on'](_0x8923('0x15'),function(_0x272ee4){logger['error'](_0x272ee4);_0x2c202e(_0x272ee4);})['end']();});}function uploadFile(_0x269bc9){return new BPromise(function(_0x561bbe,_0x1860b0){var _0x6615e8=urlParse(_0x269bc9);var _0x15604e=_0x6615e8['protocol']===_0x8923('0x10')?https:http;var _0x191016={'host':_0x6615e8[_0x8923('0x11')],'path':_0x6615e8[_0x8923('0x12')],'headers':{'user-agent':_0x8923('0x13')}};_0x15604e[_0x8923('0x20')](_0x191016,function(_0xa9c2a9){if(_0xa9c2a9['statusCode']!==0xc8){_0x1860b0(new Error(_0x8923('0x16')+_0x269bc9+_0x8923('0x17')+_0xa9c2a9[_0x8923('0x14')]+'\x20('+_0xa9c2a9['statusMessage']+')'));return;}var _0x3cc5e2='';_0xa9c2a9['on'](_0x8923('0x21'),function(_0xb21215){_0x3cc5e2+=_0xb21215;});_0xa9c2a9['on'](_0x8923('0x22'),function(){_0x561bbe(_0x3cc5e2);});})['on'](_0x8923('0x15'),function(_0x6045be){_0x1860b0(_0x6045be);})[_0x8923('0x22')]();});}function convertFile(_0x229d46,_0x25cdc3){return new BPromise(function(_0x138c39,_0x3508d2){var _0x3d9064=sox[_0x8923('0x23')](_0x229d46,_0x25cdc3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d9064['on'](_0x8923('0x15'),function(_0x12fc21){logger[_0x8923('0x15')]('error\x20convert',_0x12fc21);_0x3508d2(_0x12fc21);});_0x3d9064['on'](_0x8923('0x22'),function(){logger['info'](_0x8923('0x24'));_0x138c39();});_0x3d9064[_0x8923('0x25')]();});}function base64Decode(_0x2c666a,_0x446b5d){var _0x2a9596=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+_0x8923('0x29'));fs[_0x8923('0x2a')](_0x2a9596,_0x2c666a,_0x8923('0x2b'));return convertFile(_0x2a9596,_0x446b5d)[_0x8923('0x2c')](function(){try{fs[_0x8923('0x1d')](_0x2a9596);fs[_0x8923('0x2d')](_0x446b5d,_0x8923('0x2e'));}catch(_0x1e173a){logger[_0x8923('0x15')](_0x1e173a);}return _0x446b5d[_0x8923('0x2f')]('.')[0x0];});}function base64Encode(_0x2b191b){var _0x115121=fs['readFileSync'](_0x2b191b);return new Buffer(_0x115121)[_0x8923('0x30')]('base64');}exports['googleCloudTTS']=function(_0xbd4f9e,_0xab4d0,_0x4e84bd,_0x40acc5,_0x205097,_0x27fa36){var _0x4744d1,_0x20b3be;var _0x225647='https://texttospeech.googleapis.com/v1/';var _0x50815f='?key='+_0xbd4f9e;var _0x588a1b={};if(_0xab4d0===_0x8923('0x31')){_0x588a1b[_0x8923('0x32')]={'ssml':_0x4e84bd};}else{_0x588a1b[_0x8923('0x32')]={'text':_0x4e84bd};};_0x588a1b[_0x8923('0x33')]={'languageCode':_0x40acc5,'ssmlGender':_0x205097};_0x588a1b[_0x8923('0x34')]={'audioEncoding':_0x8923('0x35'),'sampleRateHertz':0x1f40};var _0x154b09={'url':_0x225647+_0x8923('0x36')+_0x50815f,'method':_0x8923('0x37'),'json':!![],'body':_0x588a1b};return rp(_0x154b09)['then'](function(_0x92a94a){return new BPromise(function(_0x38cf7a,_0x3702e0){_0x4744d1=path['resolve'](__dirname,'tmp',rs[_0x8923('0x28')](0x4)+_0x8923('0x38'));var _0x5355bb=Buffer[_0x8923('0x39')](_0x92a94a[_0x8923('0x3a')],_0x8923('0x2b'));return fs[_0x8923('0x3b')](_0x4744d1,_0x5355bb,function(_0x392079){_0x3702e0(_0x392079);},function(_0x200b2a){fs[_0x8923('0x2d')](_0x4744d1,_0x8923('0x2e'));_0x38cf7a(_0x200b2a);});});})[_0x8923('0x2c')](function(_0x37030f){_0x20b3be=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+_0x8923('0x29'));return convertFile(_0x4744d1,_0x20b3be);})[_0x8923('0x2c')](function(){try{fs['unlink'](_0x4744d1);fs[_0x8923('0x2d')](_0x20b3be,'777');}catch(_0x4337e1){logger[_0x8923('0x15')](_0x4337e1);}logger[_0x8923('0x1a')](_0x8923('0x3c'),_0x20b3be[_0x8923('0x2f')]('.')[0x0]);return _0x20b3be[_0x8923('0x2f')]('.')[0x0];});};exports[_0x8923('0x3d')]=function(_0x47fd33,_0x417c69){var _0x385721=_0x8923('0x3e');var _0x1cf062,_0x511dad;var _0x3c5206;var _0x5d73f4={'encoding':_0x8923('0x3f'),'method':_0x8923('0x37'),'timeout':0x2710,'url':_0x385721,'headers':{'Content-Type':_0x8923('0x40')},'body':_0x8923('0x41')+encodeURIComponent(JSON[_0x8923('0x42')]([[[_0x8923('0x43'),JSON['stringify']([_0x47fd33,_0x417c69||'en',![],_0x8923('0x44')]),null,_0x8923('0x45')]]]))};return rp(_0x5d73f4)['then'](function(_0x6cd410){try{_0x3c5206=eval(_0x6cd410[_0x8923('0x46')](0x5))[0x0][0x2];}catch(_0x22eb52){throw new Error(_0x8923('0x47')+_0x6cd410[_0x8923('0x21')]);}if(!_0x3c5206){if(_0x47fd33[_0x8923('0x48')]>0xc8){throw new Error(_0x8923('0x49'));}else{throw new Error('lang\x20\x22'+_0x417c69+_0x8923('0x4a'));}}try{_0x3c5206=eval(_0x3c5206)[0x0];}catch(_0x303ef9){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8923('0x21')]);}const _0x5c2e17=_0x3c5206;_0x1cf062=path['resolve'](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+'.mp3');fs[_0x8923('0x2a')](_0x1cf062,_0x3c5206,{'encoding':_0x8923('0x2b')});_0x511dad=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+'.wav');return convertFile(_0x1cf062,_0x511dad);})[_0x8923('0x2c')](function(){try{fs[_0x8923('0x1d')](_0x1cf062);fs[_0x8923('0x2d')](_0x511dad,_0x8923('0x2e'));}catch(_0x1771fd){logger[_0x8923('0x15')](_0x1771fd);}logger[_0x8923('0x1a')](_0x8923('0x4b'),_0x511dad[_0x8923('0x2f')]('.')[0x0]);return _0x511dad[_0x8923('0x2f')]('.')[0x0];});};exports[_0x8923('0x4c')]=function(_0x376b53,_0x4167fe,_0xd3f48d){return google['asr'](_0x376b53,_0x4167fe,_0xd3f48d)[_0x8923('0x2c')](function(_0x16c8ad){logger[_0x8923('0x1a')](_0x16c8ad[_0x8923('0x4d')]);return rp(_0x16c8ad);})[_0x8923('0x2c')](function(_0x4addbe){var _0x16d4fb='';var _0x2c76ca=0x0;try{fs['unlink'](_0x376b53);}catch(_0x5a65cc){logger[_0x8923('0x15')](_0x5a65cc);}if(_0x4addbe&&_0x4addbe[_0x8923('0x4e')]){_0x16d4fb=_0x4addbe[_0x8923('0x4e')][_0x8923('0x4f')](function(_0x445dc5){return _0x445dc5&&_0x445dc5[_0x8923('0x50')][0x0]&&_0x445dc5[_0x8923('0x50')][0x0][_0x8923('0x51')]?_0x445dc5[_0x8923('0x50')][0x0]['transcript']:'';})[_0x8923('0x52')]('\x0a');_0x2c76ca=_0x4addbe[_0x8923('0x4e')][_0x8923('0x4f')](function(_0x49a27a){return _0x49a27a&&_0x49a27a['alternatives'][0x0]&&_0x49a27a['alternatives'][0x0][_0x8923('0x53')]?_0x49a27a[_0x8923('0x50')][0x0][_0x8923('0x53')]:0x0;})[_0x8923('0x52')]('\x0a');}logger['info'](_0x8923('0x54'),_0x16d4fb);logger['info'](_0x8923('0x55'),_0x2c76ca);return{'transcript':_0x16d4fb,'confidence':_0x2c76ca};})[_0x8923('0x56')](function(_0x1f2fc1){logger[_0x8923('0x15')](_0x8923('0x57'),_0x1f2fc1[_0x8923('0x14')],_0x1f2fc1[_0x8923('0x58')],_0x1f2fc1[_0x8923('0x59')]);});};exports[_0x8923('0x5a')]=function(_0x123251,_0x43fc5b,_0x5851c0,_0x3cb2a9){var _0x26e76f=apiai(_0x43fc5b,{'language':_0x3cb2a9||'en'});return _0x26e76f[_0x8923('0x5b')](_0x5851c0,{'sessionId':md5(_0x123251)})['then'](function(_0x3185da){logger[_0x8923('0x1a')](JSON[_0x8923('0x42')](_0x3185da));return{'source':_0x3185da['result'][_0x8923('0x5c')],'resolvedQuery':_0x3185da[_0x8923('0x5d')][_0x8923('0x5e')],'action':_0x3185da[_0x8923('0x5d')][_0x8923('0x5f')],'actionIncomplete':_0x3185da['result'][_0x8923('0x60')],'speech':_0x3185da[_0x8923('0x5d')][_0x8923('0x61')][_0x8923('0x62')],'score':_0x3185da[_0x8923('0x5d')]['score'],'statusCode':_0x3185da[_0x8923('0x63')][_0x8923('0x64')],'endConversation':_0x3185da['result'][_0x8923('0x65')][_0x8923('0x66')]||![],'isFallbackIntent':_0x3185da[_0x8923('0x5d')]['metadata'][_0x8923('0x67')]};});};exports[_0x8923('0x68')]=function(_0x4da7e0,_0x11a978,_0x348f34,_0x268550,_0x36ed60,_0x1b8646){var _0x4950c0=_0x268550['replace'](/\\n/g,'\x0a');var _0x436050={'credentials':{'private_key':_0x4950c0,'client_email':_0x348f34}};var _0x2595c1=new dialogflow[(_0x8923('0x69'))](_0x436050);var _0x577211=_0x2595c1[_0x8923('0x6a')](_0x11a978,md5(_0x4da7e0));var _0x50686e={'session':_0x577211,'queryInput':{'text':{'text':_0x36ed60,'languageCode':_0x1b8646}}};return _0x2595c1[_0x8923('0x6b')](_0x50686e)[_0x8923('0x2c')](function(_0xc83920){if(_0xc83920&&_0xc83920['length']){logger[_0x8923('0x1a')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0xc83920));var _0x403366=_0xc83920[0x0];if(_0x403366){var _0x30613c={'action':_0x403366['queryResult'][_0x8923('0x5f')],'allRequiredParamsPresent':_0x403366[_0x8923('0x6c')][_0x8923('0x6d')],'endConversation':_0x403366[_0x8923('0x6c')][_0x8923('0x6e')]&&_0x403366[_0x8923('0x6c')][_0x8923('0x6e')]['fields']?_0x403366[_0x8923('0x6c')][_0x8923('0x6e')][_0x8923('0x6f')][_0x8923('0x70')][_0x8923('0x71')]:![],'fulfillmentText':_0x403366[_0x8923('0x6c')][_0x8923('0x72')],'intentName':_0x403366[_0x8923('0x6c')][_0x8923('0x73')][_0x8923('0x58')],'intentDisplayName':_0x403366[_0x8923('0x6c')][_0x8923('0x73')]['displayName'],'isFallbackIntent':_0x403366['queryResult'][_0x8923('0x73')]['isFallback'],'languageCode':_0x403366[_0x8923('0x6c')][_0x8923('0x74')],'queryText':_0x403366[_0x8923('0x6c')][_0x8923('0x75')],'responseId':_0x403366[_0x8923('0x76')],'score':_0x403366[_0x8923('0x6c')][_0x8923('0x77')],'speech':_0x403366[_0x8923('0x6c')][_0x8923('0x72')],'providerResponse':JSON['stringify'](_0xc83920)};return _0x30613c;}}});};exports[_0x8923('0x78')]=function(_0x3dce6f,_0x34ebea,_0x400dc7,_0x3f020a){return tilde[_0x8923('0x79')](_0x3dce6f,_0x34ebea,_0x400dc7,_0x3f020a)['then'](function(_0x5cf3d5){try{fs[_0x8923('0x1d')](_0x3dce6f);}catch(_0x83c891){logger[_0x8923('0x15')](_0x83c891);}logger[_0x8923('0x1a')]('Tilde\x20ASR\x20transcription',_0x5cf3d5[_0x8923('0x51')]);logger[_0x8923('0x1a')](_0x8923('0x7a'),_0x5cf3d5[_0x8923('0x53')]);return _0x5cf3d5;});};exports[_0x8923('0x7b')]=function(_0x4cb7b8,_0x1d2478,_0x4e7c7a,_0x4ba097,_0x31b661,_0x4a8b69){var _0x1a30ce=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+_0x8923('0x38'));var _0x86d690;return aws[_0x8923('0x7c')](_0x4cb7b8,_0x1d2478,_0x4e7c7a,_0x4ba097,_0x31b661,_0x4a8b69,_0x1a30ce)[_0x8923('0x2c')](function(){_0x86d690=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+'.wav');return convertFile(_0x1a30ce,_0x86d690);})[_0x8923('0x2c')](function(){try{fs[_0x8923('0x1d')](_0x1a30ce);fs[_0x8923('0x2d')](_0x86d690,_0x8923('0x2e'));}catch(_0x931adb){logger[_0x8923('0x15')](_0x931adb);}return _0x86d690[_0x8923('0x2f')]('.')[0x0];});};exports[_0x8923('0x7d')]=function(_0x42a97f,_0x385484,_0x1de2c8,_0x30189b,_0xe9f975,_0x2c496e){return aws[_0x8923('0x7e')](_0x42a97f,_0x385484,_0x1de2c8,_0x30189b,_0xe9f975,_0x2c496e)['then'](function(_0x571d53){logger[_0x8923('0x1a')](JSON[_0x8923('0x42')](_0x571d53));return _0x571d53;});};exports[_0x8923('0x7f')]=function(_0x3c257a,_0x411de3,_0x5562b6,_0x167793){var _0x125163=util[_0x8923('0x80')](_0x8923('0x81'),ISPEECH_API,_0x3c257a,encodeURIComponent(_0x411de3),_0x5562b6,_0x167793);var _0x17f477=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+'.mp3');var _0x1aad10;return downloadFile(_0x125163,_0x17f477)['then'](function(){_0x1aad10=path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+_0x8923('0x29'));return convertFile(_0x17f477,_0x1aad10);})[_0x8923('0x2c')](function(){try{fs[_0x8923('0x1d')](_0x17f477);fs['chmodSync'](_0x1aad10,_0x8923('0x2e'));}catch(_0x1a8d92){logger[_0x8923('0x15')](_0x1a8d92);}return _0x1aad10[_0x8923('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x37e8d2,_0x153e01,_0xeba49f,_0x5829c6){var _0x3fc6b3=util[_0x8923('0x80')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x153e01,_0xeba49f,base64Encode(_0x37e8d2),_0x5829c6?util['format']('model=%s',encodeURIComponent(_0x5829c6)):_0x8923('0x82'));return uploadFile(_0x3fc6b3)[_0x8923('0x2c')](function(_0x2f5bf1){return querystring[_0x8923('0x7')](_0x2f5bf1);});};exports[_0x8923('0x83')]=function(_0x2b6006,_0x3a559f){return sestek['nda'](_0x2b6006,_0x3a559f)[_0x8923('0x2c')](function(_0x5c7732){logger['info'](JSON[_0x8923('0x42')](_0x5c7732));var _0x104f2b={'speech':_0x5c7732[_0x8923('0x84')],'action':_0x5c7732[_0x8923('0x85')]?_0x5c7732[_0x8923('0x85')][_0x8923('0x86')]:undefined,'actiondata':_0x5c7732['channelData']?_0x5c7732[_0x8923('0x85')][_0x8923('0x87')]:undefined};if(_0x5c7732[_0x8923('0x85')]&&_0x5c7732[_0x8923('0x85')]['AudioFromTts']){return base64Decode(_0x5c7732[_0x8923('0x85')][_0x8923('0x88')]['Data'],path[_0x8923('0x26')](__dirname,_0x8923('0x27'),rs[_0x8923('0x28')](0x4)+_0x8923('0x29')))['then'](function(_0x591266){_0x104f2b[_0x8923('0x89')]=_0x591266;return _0x104f2b;});}return _0x104f2b;});};exports[_0x8923('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x6c8d=['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','nda','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','path','querystring','request-promise','sox','google-tts-api','parse','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','data','wav','start','tmp','generate','.wav','writeFileSync','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','resolve','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0x6c8d,0x94));var _0xd6c8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6c8d[_0x4b369d];return _0x571a98;};'use strict';var apiai=require(_0xd6c8('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xd6c8('0x1'));var fs=require('fs');var http=require(_0xd6c8('0x2'));var https=require(_0xd6c8('0x3'));var md5=require('md5');var path=require(_0xd6c8('0x4'));var querystring=require(_0xd6c8('0x5'));var rp=require(_0xd6c8('0x6'));var rs=require('randomstring');var sox=require(_0xd6c8('0x7'));var tts=require(_0xd6c8('0x8'));var urlParse=require('url')[_0xd6c8('0x9')];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require(_0xd6c8('0xa'));var tilde=require(_0xd6c8('0xb'));var logger=require(_0xd6c8('0xc'))(_0xd6c8('0xd'));var ISPEECH_API=_0xd6c8('0xe');function downloadFile(_0x568b5e,_0x3ab728){return new BPromise(function(_0xd963a7,_0x15474f){var _0xc7580f=urlParse(_0x568b5e);var _0x382f31=_0xc7580f[_0xd6c8('0xf')]===_0xd6c8('0x10')?https:http;var _0x394bf1={'host':_0xc7580f[_0xd6c8('0x11')],'path':_0xc7580f[_0xd6c8('0x4')],'headers':{'user-agent':_0xd6c8('0x12')}};_0x382f31[_0xd6c8('0x13')](_0x394bf1,function(_0x36a964){if(_0x36a964[_0xd6c8('0x14')]!==0xc8){logger['error'](_0xd6c8('0x15')+_0x568b5e+_0xd6c8('0x16')+_0x36a964[_0xd6c8('0x14')]+'\x20('+_0x36a964[_0xd6c8('0x17')]+')');_0x15474f(new Error('request\x20to\x20'+_0x568b5e+_0xd6c8('0x16')+_0x36a964[_0xd6c8('0x14')]+'\x20('+_0x36a964[_0xd6c8('0x17')]+')'));return;}var _0x1ab58b=fs['createWriteStream'](_0x3ab728);_0x1ab58b['on'](_0xd6c8('0x18'),function(){logger[_0xd6c8('0x19')](_0xd6c8('0x1a'));_0x1ab58b[_0xd6c8('0x1b')](_0xd963a7);});_0x1ab58b['on'](_0xd6c8('0x1c'),function(_0x5e3bb5){fs[_0xd6c8('0x1d')](_0x3ab728);logger[_0xd6c8('0x1c')](_0xd6c8('0x1e'),_0x5e3bb5);_0x15474f(_0x5e3bb5);});_0x36a964[_0xd6c8('0x1f')](_0x1ab58b);})['on'](_0xd6c8('0x1c'),function(_0x272c20){logger[_0xd6c8('0x1c')](_0x272c20);_0x15474f(_0x272c20);})[_0xd6c8('0x20')]();});}function uploadFile(_0x1b6e62){return new BPromise(function(_0x49ae88,_0x3b22c2){var _0x26deb1=urlParse(_0x1b6e62);var _0x3ed847=_0x26deb1[_0xd6c8('0xf')]==='https:'?https:http;var _0x19eb4a={'host':_0x26deb1['host'],'path':_0x26deb1[_0xd6c8('0x4')],'headers':{'user-agent':_0xd6c8('0x12')}};_0x3ed847['get'](_0x19eb4a,function(_0x3244c2){if(_0x3244c2[_0xd6c8('0x14')]!==0xc8){_0x3b22c2(new Error('request\x20to\x20'+_0x1b6e62+_0xd6c8('0x16')+_0x3244c2[_0xd6c8('0x14')]+'\x20('+_0x3244c2['statusMessage']+')'));return;}var _0x537888='';_0x3244c2['on'](_0xd6c8('0x21'),function(_0x33e05b){_0x537888+=_0x33e05b;});_0x3244c2['on'](_0xd6c8('0x20'),function(){_0x49ae88(_0x537888);});})['on'](_0xd6c8('0x1c'),function(_0x21da6e){_0x3b22c2(_0x21da6e);})[_0xd6c8('0x20')]();});}function convertFile(_0x5b2935,_0xf1351a){return new BPromise(function(_0x54214c,_0x18e573){var _0x4b21e4=sox['transcode'](_0x5b2935,_0xf1351a,{'sampleRate':0x1f40,'format':_0xd6c8('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b21e4['on'](_0xd6c8('0x1c'),function(_0x43ee36){logger[_0xd6c8('0x1c')]('error\x20convert',_0x43ee36);_0x18e573(_0x43ee36);});_0x4b21e4['on']('end',function(){logger[_0xd6c8('0x19')]('finish\x20to\x20convert');_0x54214c();});_0x4b21e4[_0xd6c8('0x23')]();});}function base64Decode(_0x5ac476,_0x4630f8){var _0x5efab4=path['resolve'](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x26'));fs[_0xd6c8('0x27')](_0x5efab4,_0x5ac476,'base64');return convertFile(_0x5efab4,_0x4630f8)['then'](function(){try{fs['unlink'](_0x5efab4);fs[_0xd6c8('0x28')](_0x4630f8,_0xd6c8('0x29'));}catch(_0x4d4b03){logger[_0xd6c8('0x1c')](_0x4d4b03);}return _0x4630f8[_0xd6c8('0x2a')]('.')[0x0];});}function base64Encode(_0x5cd0df){var _0x2d0ab4=fs[_0xd6c8('0x2b')](_0x5cd0df);return new Buffer(_0x2d0ab4)[_0xd6c8('0x2c')](_0xd6c8('0x2d'));}exports[_0xd6c8('0x2e')]=function(_0x37a1b1,_0xb911f2,_0x461ef1,_0x2d04e6,_0x43f640,_0x1d4cab){var _0xebddd6,_0x4b450c;var _0x406e09='https://texttospeech.googleapis.com/v1/';var _0x1443b2=_0xd6c8('0x2f')+_0x37a1b1;var _0x21721a={};if(_0xb911f2===_0xd6c8('0x30')){_0x21721a['input']={'ssml':_0x461ef1};}else{_0x21721a[_0xd6c8('0x31')]={'text':_0x461ef1};};_0x21721a[_0xd6c8('0x32')]={'languageCode':_0x2d04e6,'ssmlGender':_0x43f640};_0x21721a[_0xd6c8('0x33')]={'audioEncoding':_0xd6c8('0x34'),'sampleRateHertz':0x1f40};var _0x5c1615={'url':_0x406e09+_0xd6c8('0x35')+_0x1443b2,'method':_0xd6c8('0x36'),'json':!![],'body':_0x21721a};return rp(_0x5c1615)[_0xd6c8('0x37')](function(_0x5e5c5a){return new BPromise(function(_0x3c9345,_0x1e3ff6){_0xebddd6=path['resolve'](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x38'));var _0x1c5e6c=Buffer[_0xd6c8('0x39')](_0x5e5c5a[_0xd6c8('0x3a')],'base64');return fs[_0xd6c8('0x3b')](_0xebddd6,_0x1c5e6c,function(_0x125e43){_0x1e3ff6(_0x125e43);},function(_0x44391a){fs['chmodSync'](_0xebddd6,_0xd6c8('0x29'));_0x3c9345(_0x44391a);});});})['then'](function(_0x3053cf){_0x4b450c=path[_0xd6c8('0x3c')](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x26'));return convertFile(_0xebddd6,_0x4b450c);})[_0xd6c8('0x37')](function(){try{fs[_0xd6c8('0x1d')](_0xebddd6);fs[_0xd6c8('0x28')](_0x4b450c,'777');}catch(_0x3c7fe1){logger['error'](_0x3c7fe1);}logger[_0xd6c8('0x19')](_0xd6c8('0x3d'),_0x4b450c[_0xd6c8('0x2a')]('.')[0x0]);return _0x4b450c[_0xd6c8('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x4b8312,_0x22fdd1){var _0x76be22='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x55742f,_0x2885fb;var _0x940967;var _0x55de85={'encoding':_0xd6c8('0x3e'),'method':_0xd6c8('0x36'),'timeout':0x2710,'url':_0x76be22,'headers':{'Content-Type':_0xd6c8('0x3f')},'body':_0xd6c8('0x40')+encodeURIComponent(JSON['stringify']([[[_0xd6c8('0x41'),JSON[_0xd6c8('0x42')]([_0x4b8312,_0x22fdd1||'en',![],_0xd6c8('0x43')]),null,_0xd6c8('0x44')]]]))};return rp(_0x55de85)[_0xd6c8('0x37')](function(_0x5cf105){try{_0x940967=eval(_0x5cf105[_0xd6c8('0x45')](0x5))[0x0][0x2];}catch(_0x542a90){throw new Error(_0xd6c8('0x46')+_0x5cf105[_0xd6c8('0x21')]);}if(!_0x940967){if(_0x4b8312[_0xd6c8('0x47')]>0xc8){throw new Error(_0xd6c8('0x48'));}else{throw new Error(_0xd6c8('0x49')+_0x22fdd1+_0xd6c8('0x4a'));}}try{_0x940967=eval(_0x940967)[0x0];}catch(_0x2d2abf){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd6c8('0x21')]);}const _0x56c5c0=_0x940967;_0x55742f=path[_0xd6c8('0x3c')](__dirname,_0xd6c8('0x24'),rs['generate'](0x4)+_0xd6c8('0x38'));fs[_0xd6c8('0x27')](_0x55742f,_0x940967,{'encoding':_0xd6c8('0x2d')});_0x2885fb=path[_0xd6c8('0x3c')](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x26'));return convertFile(_0x55742f,_0x2885fb);})['then'](function(){try{fs['unlink'](_0x55742f);fs[_0xd6c8('0x28')](_0x2885fb,_0xd6c8('0x29'));}catch(_0x98cfaf){logger['error'](_0x98cfaf);}logger[_0xd6c8('0x19')](_0xd6c8('0x4b'),_0x2885fb['split']('.')[0x0]);return _0x2885fb[_0xd6c8('0x2a')]('.')[0x0];});};exports[_0xd6c8('0x4c')]=function(_0x48a5a9,_0x1702a6,_0x17729e){return google['asr'](_0x48a5a9,_0x1702a6,_0x17729e)[_0xd6c8('0x37')](function(_0x349820){logger['info'](_0x349820[_0xd6c8('0x4d')]);return rp(_0x349820);})[_0xd6c8('0x37')](function(_0x53c250){var _0x12d347='';var _0xfa93c1=0x0;try{fs['unlink'](_0x48a5a9);}catch(_0x322e0c){logger[_0xd6c8('0x1c')](_0x322e0c);}if(_0x53c250&&_0x53c250[_0xd6c8('0x4e')]){_0x12d347=_0x53c250[_0xd6c8('0x4e')][_0xd6c8('0x4f')](function(_0x4ebba6){return _0x4ebba6&&_0x4ebba6[_0xd6c8('0x50')][0x0]&&_0x4ebba6[_0xd6c8('0x50')][0x0]['transcript']?_0x4ebba6['alternatives'][0x0][_0xd6c8('0x51')]:'';})[_0xd6c8('0x52')]('\x0a');_0xfa93c1=_0x53c250[_0xd6c8('0x4e')][_0xd6c8('0x4f')](function(_0x272a44){return _0x272a44&&_0x272a44[_0xd6c8('0x50')][0x0]&&_0x272a44[_0xd6c8('0x50')][0x0][_0xd6c8('0x53')]?_0x272a44[_0xd6c8('0x50')][0x0]['confidence']:0x0;})[_0xd6c8('0x52')]('\x0a');}logger[_0xd6c8('0x19')](_0xd6c8('0x54'),_0x12d347);logger[_0xd6c8('0x19')]('googleASR\x20confidence',_0xfa93c1);return{'transcript':_0x12d347,'confidence':_0xfa93c1};})[_0xd6c8('0x55')](function(_0x4ae6c6){logger[_0xd6c8('0x1c')](_0xd6c8('0x56'),_0x4ae6c6[_0xd6c8('0x14')],_0x4ae6c6[_0xd6c8('0x57')],_0x4ae6c6[_0xd6c8('0x58')]);});};exports[_0xd6c8('0x59')]=function(_0x46e8bc,_0x494f99,_0x2880c1,_0xc387){var _0xbc882a=apiai(_0x494f99,{'language':_0xc387||'en'});return _0xbc882a[_0xd6c8('0x5a')](_0x2880c1,{'sessionId':md5(_0x46e8bc)})['then'](function(_0x31c2ee){logger[_0xd6c8('0x19')](JSON[_0xd6c8('0x42')](_0x31c2ee));return{'source':_0x31c2ee[_0xd6c8('0x5b')][_0xd6c8('0x5c')],'resolvedQuery':_0x31c2ee[_0xd6c8('0x5b')][_0xd6c8('0x5d')],'action':_0x31c2ee['result'][_0xd6c8('0x5e')],'actionIncomplete':_0x31c2ee[_0xd6c8('0x5b')][_0xd6c8('0x5f')],'speech':_0x31c2ee[_0xd6c8('0x5b')][_0xd6c8('0x60')][_0xd6c8('0x61')],'score':_0x31c2ee[_0xd6c8('0x5b')]['score'],'statusCode':_0x31c2ee['status']['code'],'endConversation':_0x31c2ee['result'][_0xd6c8('0x62')]['endConversation']||![],'isFallbackIntent':_0x31c2ee[_0xd6c8('0x5b')]['metadata'][_0xd6c8('0x63')]};});};exports[_0xd6c8('0x64')]=function(_0xcd74b5,_0x5a10e2,_0x511fa8,_0x495394,_0x31e5a0,_0x2aec0e){var _0xa7bfb2=_0x495394[_0xd6c8('0x65')](/\\n/g,'\x0a');var _0x310d04={'credentials':{'private_key':_0xa7bfb2,'client_email':_0x511fa8}};var _0x13ffc5=new dialogflow[(_0xd6c8('0x66'))](_0x310d04);var _0x56ed58=_0x13ffc5[_0xd6c8('0x67')](_0x5a10e2,md5(_0xcd74b5));var _0x517885={'session':_0x56ed58,'queryInput':{'text':{'text':_0x31e5a0,'languageCode':_0x2aec0e}}};return _0x13ffc5[_0xd6c8('0x68')](_0x517885)[_0xd6c8('0x37')](function(_0x4cc6d){if(_0x4cc6d&&_0x4cc6d[_0xd6c8('0x47')]){logger[_0xd6c8('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0xd6c8('0x42')](_0x4cc6d));var _0x2c975c=_0x4cc6d[0x0];if(_0x2c975c){var _0x2e3820={'action':_0x2c975c[_0xd6c8('0x69')]['action'],'allRequiredParamsPresent':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x6a')],'endConversation':_0x2c975c['queryResult'][_0xd6c8('0x6b')]&&_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x6b')][_0xd6c8('0x6c')]?_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x6b')][_0xd6c8('0x6c')][_0xd6c8('0x6d')][_0xd6c8('0x6e')]:![],'fulfillmentText':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x6f')],'intentName':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x70')][_0xd6c8('0x57')],'intentDisplayName':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x70')][_0xd6c8('0x71')],'isFallbackIntent':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x70')]['isFallback'],'languageCode':_0x2c975c['queryResult'][_0xd6c8('0x72')],'queryText':_0x2c975c['queryResult'][_0xd6c8('0x73')],'responseId':_0x2c975c[_0xd6c8('0x74')],'score':_0x2c975c[_0xd6c8('0x69')]['intentDetectionConfidence'],'speech':_0x2c975c[_0xd6c8('0x69')][_0xd6c8('0x6f')],'providerResponse':JSON[_0xd6c8('0x42')](_0x4cc6d)};return _0x2e3820;}}});};exports[_0xd6c8('0x75')]=function(_0x435ce4,_0x47c4ac,_0x2af286,_0x7ff581){return tilde[_0xd6c8('0x76')](_0x435ce4,_0x47c4ac,_0x2af286,_0x7ff581)[_0xd6c8('0x37')](function(_0x58e784){try{fs[_0xd6c8('0x1d')](_0x435ce4);}catch(_0x445c3f){logger['error'](_0x445c3f);}logger['info'](_0xd6c8('0x77'),_0x58e784[_0xd6c8('0x51')]);logger[_0xd6c8('0x19')](_0xd6c8('0x78'),_0x58e784[_0xd6c8('0x53')]);return _0x58e784;});};exports['awsPolly']=function(_0x3fdf82,_0x504d92,_0xd1214d,_0x2813fd,_0x50b25e,_0x530d95){var _0x949d71=path[_0xd6c8('0x3c')](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x38'));var _0x524788;return aws['polly'](_0x3fdf82,_0x504d92,_0xd1214d,_0x2813fd,_0x50b25e,_0x530d95,_0x949d71)[_0xd6c8('0x37')](function(){_0x524788=path[_0xd6c8('0x3c')](__dirname,'tmp',rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x26'));return convertFile(_0x949d71,_0x524788);})[_0xd6c8('0x37')](function(){try{fs['unlink'](_0x949d71);fs['chmodSync'](_0x524788,_0xd6c8('0x29'));}catch(_0x10143d){logger['error'](_0x10143d);}return _0x524788[_0xd6c8('0x2a')]('.')[0x0];});};exports[_0xd6c8('0x79')]=function(_0x4eb7d7,_0xbfc013,_0x389235,_0x5e2f8c,_0x560afc,_0x422e6e){return aws[_0xd6c8('0x7a')](_0x4eb7d7,_0xbfc013,_0x389235,_0x5e2f8c,_0x560afc,_0x422e6e)[_0xd6c8('0x37')](function(_0x1ed800){logger[_0xd6c8('0x19')](JSON[_0xd6c8('0x42')](_0x1ed800));return _0x1ed800;});};exports[_0xd6c8('0x7b')]=function(_0x179abe,_0x15ca49,_0x12031f,_0x2d5d95){var _0x51775d=util[_0xd6c8('0x7c')](_0xd6c8('0x7d'),ISPEECH_API,_0x179abe,encodeURIComponent(_0x15ca49),_0x12031f,_0x2d5d95);var _0x40c4a2=path[_0xd6c8('0x3c')](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x38'));var _0x39172;return downloadFile(_0x51775d,_0x40c4a2)[_0xd6c8('0x37')](function(){_0x39172=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xd6c8('0x26'));return convertFile(_0x40c4a2,_0x39172);})[_0xd6c8('0x37')](function(){try{fs[_0xd6c8('0x1d')](_0x40c4a2);fs[_0xd6c8('0x28')](_0x39172,_0xd6c8('0x29'));}catch(_0x3c0b55){logger[_0xd6c8('0x1c')](_0x3c0b55);}return _0x39172['split']('.')[0x0];});};exports[_0xd6c8('0x7e')]=function(_0x371654,_0x1fe005,_0x4d743a,_0x838286){var _0x50089e=util[_0xd6c8('0x7c')](_0xd6c8('0x7f'),ISPEECH_API,_0x1fe005,_0x4d743a,base64Encode(_0x371654),_0x838286?util['format']('model=%s',encodeURIComponent(_0x838286)):_0xd6c8('0x80'));return uploadFile(_0x50089e)['then'](function(_0x5c4718){return querystring['parse'](_0x5c4718);});};exports['sestekNDA']=function(_0x15b567,_0x445af9){return sestek[_0xd6c8('0x81')](_0x15b567,_0x445af9)[_0xd6c8('0x37')](function(_0x901f95){logger['info'](JSON[_0xd6c8('0x42')](_0x901f95));var _0x415f72={'speech':_0x901f95[_0xd6c8('0x82')],'action':_0x901f95[_0xd6c8('0x83')]?_0x901f95[_0xd6c8('0x83')][_0xd6c8('0x84')]:undefined,'actiondata':_0x901f95[_0xd6c8('0x83')]?_0x901f95[_0xd6c8('0x83')]['CustomActionData']:undefined};if(_0x901f95[_0xd6c8('0x83')]&&_0x901f95[_0xd6c8('0x83')][_0xd6c8('0x85')]){return base64Decode(_0x901f95[_0xd6c8('0x83')][_0xd6c8('0x85')]['Data'],path['resolve'](__dirname,_0xd6c8('0x24'),rs[_0xd6c8('0x25')](0x4)+_0xd6c8('0x26')))[_0xd6c8('0x37')](function(_0xe04c85){_0x415f72[_0xd6c8('0x86')]=_0xe04c85;return _0x415f72;});}return _0x415f72;});};exports[_0xd6c8('0x87')]=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 a2416a6..b33e658 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 _0x8207=['exports','./nda'];(function(_0x1b25d4,_0x2e9817){var _0x1e8324=function(_0x450475){while(--_0x450475){_0x1b25d4['push'](_0x1b25d4['shift']());}};_0x1e8324(++_0x2e9817);}(_0x8207,0x149));var _0x7820=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8207[_0x2dafbe];return _0x58a45a;};var nda=require(_0x7820('0x0'));module[_0x7820('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe6d5=['exports','./nda'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe6d5,0x15d));var _0x5e6d=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xe6d5[_0x383356];return _0x32ee5a;};var nda=require(_0x5e6d('0x0'));module[_0x5e6d('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index fbe582f..4ab26bb 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 _0xab3a=['custom_action_data','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','extension','text','Bearer\x20','project','channelData','ndagenerate_audio','body','AudioOutputSettings','audio/wav','CustomAction','CustomActionData'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab3a,0x1d3));var _0xaab3=function(_0x4a6992,_0x15fed3){_0x4a6992=_0x4a6992-0x0;var _0x5cbaee=_0xab3a[_0x4a6992];return _0x5cbaee;};'use strict';var rp=require(_0xaab3('0x0'));var url=require(_0xaab3('0x1'));var logger=require(_0xaab3('0x2'))(_0xaab3('0x3'));module[_0xaab3('0x4')]=function(_0x19399d,_0x4065be){var _0x545929={'method':_0xaab3('0x5'),'uri':url[_0xaab3('0x6')](_0x4065be[_0xaab3('0x7')],_0xaab3('0x8')),'form':{'grant_type':_0xaab3('0x9'),'username':_0x4065be['username'],'password':_0x4065be['password']},'json':!![]};return rp(_0x545929)[_0xaab3('0xa')](function(_0x1fd19f){var _0x146453={'method':_0xaab3('0x5'),'uri':url[_0xaab3('0x6')](_0x4065be[_0xaab3('0xb')],_0xaab3('0xc')),'body':{'type':_0x4065be[_0xaab3('0xd')]||_0xaab3('0xe'),'channelId':_0xaab3('0xf'),'conversation':{'id':_0x19399d[_0xaab3('0x10')]},'from':{'id':_0x19399d['callerid'],'name':_0x19399d['calleridname']},'recipient':{'id':_0x19399d[_0xaab3('0x11')],'name':_0x19399d[_0xaab3('0x12')]},'text':_0x4065be[_0xaab3('0x13')],'channelData':{}},'headers':{'Authorization':_0xaab3('0x14')+_0x1fd19f['access_token']},'json':!![]};if(_0x4065be[_0xaab3('0x15')]){_0x146453['body'][_0xaab3('0x16')]['ProjectName']=_0x4065be[_0xaab3('0x15')];}if(_0x4065be[_0xaab3('0x17')]=='1'){_0x146453[_0xaab3('0x18')]['channelData'][_0xaab3('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xaab3('0x1a')};}if(_0x4065be['custom_action']){_0x146453[_0xaab3('0x18')][_0xaab3('0x16')][_0xaab3('0x1b')]=_0x4065be['custom_action'];if(_0x4065be['custom_action_data']){_0x146453['body']['channelData'][_0xaab3('0x1c')]=_0x4065be[_0xaab3('0x1d')];}}logger[_0xaab3('0x1e')](JSON['stringify'](_0x146453));return rp(_0x146453);});}; \ No newline at end of file +var _0x7eb9=['audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','agi','POST','ndauth_url','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x4fc2ca,_0x19ba6a){var _0x2a74a5=function(_0x559775){while(--_0x559775){_0x4fc2ca['push'](_0x4fc2ca['shift']());}};_0x2a74a5(++_0x19ba6a);}(_0x7eb9,0xd9));var _0x97eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7eb9[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x97eb('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x97eb('0x1'));module['exports']=function(_0x580fd1,_0x41d2c7){var _0x67960={'method':_0x97eb('0x2'),'uri':url['resolve'](_0x41d2c7[_0x97eb('0x3')],'/token'),'form':{'grant_type':_0x97eb('0x4'),'username':_0x41d2c7['username'],'password':_0x41d2c7[_0x97eb('0x4')]},'json':!![]};return rp(_0x67960)['then'](function(_0x5227f4){var _0x429ed6={'method':'POST','uri':url[_0x97eb('0x5')](_0x41d2c7[_0x97eb('0x6')],_0x97eb('0x7')),'body':{'type':_0x41d2c7[_0x97eb('0x8')]||_0x97eb('0x9'),'channelId':'Nda','conversation':{'id':_0x580fd1['uniqueid']},'from':{'id':_0x580fd1[_0x97eb('0xa')],'name':_0x580fd1[_0x97eb('0xb')]},'recipient':{'id':_0x580fd1[_0x97eb('0xc')],'name':_0x580fd1[_0x97eb('0xd')]},'text':_0x41d2c7[_0x97eb('0xe')],'channelData':{}},'headers':{'Authorization':_0x97eb('0xf')+_0x5227f4[_0x97eb('0x10')]},'json':!![]};if(_0x41d2c7[_0x97eb('0x11')]){_0x429ed6[_0x97eb('0x12')][_0x97eb('0x13')][_0x97eb('0x14')]=_0x41d2c7[_0x97eb('0x11')];}if(_0x41d2c7[_0x97eb('0x15')]=='1'){_0x429ed6[_0x97eb('0x12')]['channelData'][_0x97eb('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x97eb('0x17')};}if(_0x41d2c7[_0x97eb('0x18')]){_0x429ed6['body'][_0x97eb('0x13')][_0x97eb('0x19')]=_0x41d2c7[_0x97eb('0x18')];if(_0x41d2c7['custom_action_data']){_0x429ed6['body'][_0x97eb('0x13')][_0x97eb('0x1a')]=_0x41d2c7[_0x97eb('0x1b')];}}logger[_0x97eb('0x1c')](JSON[_0x97eb('0x1d')](_0x429ed6));return rp(_0x429ed6);});}; \ 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 1b2fc16..7400bfe 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 _0x8e19=['exports','./lib/api'];(function(_0x25732b,_0x5518c){var _0x1cd903=function(_0x4fbedf){while(--_0x4fbedf){_0x25732b['push'](_0x25732b['shift']());}};_0x1cd903(++_0x5518c);}(_0x8e19,0x1ad));var _0x98e1=function(_0x24ff6b,_0x2d35e4){_0x24ff6b=_0x24ff6b-0x0;var _0x1d6ed0=_0x8e19[_0x24ff6b];return _0x1d6ed0;};'use strict';var asr=require(_0x98e1('0x0'));module[_0x98e1('0x1')]=function(_0x17a9c6,_0x14dcaa,_0x1f5317,_0x3f0ff6){return asr(_0x17a9c6,_0x14dcaa,_0x1f5317,_0x3f0ff6);}; \ No newline at end of file +var _0x414b=['./lib/api','exports'];(function(_0x586328,_0x4603db){var _0x41b9c9=function(_0x3eedaf){while(--_0x3eedaf){_0x586328['push'](_0x586328['shift']());}};_0x41b9c9(++_0x4603db);}(_0x414b,0xb0));var _0xb414=function(_0x1189c3,_0x8e52dd){_0x1189c3=_0x1189c3-0x0;var _0x116d9c=_0x414b[_0x1189c3];return _0x116d9c;};'use strict';var asr=require(_0xb414('0x0'));module[_0xb414('0x1')]=function(_0x43ce07,_0x17bc57,_0x4fe621,_0x4c25ab){return asr(_0x43ce07,_0x17bc57,_0x4fe621,_0x4c25ab);}; \ 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 5d74d43..4086bc9 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 _0x1d47=['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.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0x4ad46c,_0x11ede1){var _0x1ee372=function(_0xd47f9e){while(--_0xd47f9e){_0x4ad46c['push'](_0x4ad46c['shift']());}};_0x1ee372(++_0x11ede1);}(_0x1d47,0x123));var _0x71d4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1d47[_0x432682];return _0x463d05;};'use strict';var BPromise=require(_0x71d4('0x0'));var _=require(_0x71d4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x71d4('0x2'))(_0x71d4('0x3'));module[_0x71d4('0x4')]=function(_0x21f01b,_0x5c7788,_0x138f2f,_0xc286f5){return new BPromise(function(_0x1238f4,_0x4f7c54){logger[_0x71d4('0x5')](_0x71d4('0x6'),_0xc286f5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x34473a=new WebSocket(_0xc286f5||_0x71d4('0x7'),{'perMessageDeflate':![]});var _0x41e50e='';var _0x188a90='0';var _0x548018='1';var _0xcc7011=_0x71d4('0x8');function _0x525554(_0x4badf7){var _0x91f5a0=crypto['createHash'](_0x71d4('0x9'));_0x91f5a0[_0x71d4('0xa')](_0x4badf7);return _0x91f5a0[_0x71d4('0xb')](_0x71d4('0xc'));}function _0x18b78a(){try{logger[_0x71d4('0x5')](_0x71d4('0xd'));var _0x2bf322=moment()[_0x71d4('0xe')]();var _0x2948ac=_0x525554(_0x2bf322+_0x5c7788+_0x138f2f);_0x34473a[_0x71d4('0xf')](JSON['stringify']({'appID':_0x5c7788,'timestamp':_0x2bf322,'appKey':_0x2948ac}));var _0x3a64e9=fs[_0x71d4('0x10')](_0x21f01b);_0x3a64e9['on'](_0x71d4('0x11'),function(_0x25211c){_0x34473a[_0x71d4('0xf')](_0x25211c);});_0x3a64e9['on'](_0x71d4('0x12'),function(){_0x34473a[_0x71d4('0xf')](_0x71d4('0x13'));});}catch(_0x5e7ab7){logger[_0x71d4('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x71d4('0x15')](_0x5e7ab7));_0x34473a[_0x71d4('0x16')]();}}function _0x459c25(_0x591e2d){try{if(_0x591e2d){var _0x3a05fc=JSON[_0x71d4('0x17')](_0x591e2d);switch(_0x3a05fc[_0x71d4('0x18')]){case 0x0:if(_0x3a05fc['result']){if(_0x3a05fc[_0x71d4('0x19')][_0x71d4('0x1a')]){logger[_0x71d4('0x5')](_0x71d4('0x1b'),JSON['stringify'](_0x3a05fc['result'][_0x71d4('0x1c')]));_0x41e50e=_0x3a05fc[_0x71d4('0x19')][_0x71d4('0x1c')][0x0][_0x71d4('0x1d')];_0x188a90=_0x3a05fc[_0x71d4('0x19')][_0x71d4('0x1c')][0x0][_0x71d4('0x1e')];_0x548018='0';_0xcc7011=_0x71d4('0x1f');_0x34473a[_0x71d4('0x16')]();}}break;case 0x1:logger[_0x71d4('0x5')](_0x71d4('0x8'));_0x548018='1';_0xcc7011=_0x71d4('0x8');break;case 0x2:logger[_0x71d4('0x5')](_0x71d4('0x20'));_0x548018='2';_0xcc7011=_0x71d4('0x20');break;case 0x9:logger['info'](_0x71d4('0x21'));_0x548018='9';_0xcc7011=_0x71d4('0x21');break;case 0xa:logger[_0x71d4('0x5')](_0x71d4('0x22'));_0x548018='10';_0xcc7011=_0x71d4('0x22');break;case 0xb:logger[_0x71d4('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x548018='11';_0xcc7011=_0x71d4('0x23');}}}catch(_0x5c55d5){logger[_0x71d4('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x5c55d5));_0x34473a['terminate']();}}function _0xaedf64(){logger[_0x71d4('0x5')](_0x71d4('0x24'));_0x1238f4({'transcript':_0x41e50e,'confidence':_0x188a90,'status':_0x548018,'status_message':_0xcc7011});}function _0x3b34ab(_0x545c09){logger[_0x71d4('0x14')](_0x71d4('0x25'));if(!_['isNil'](_0x545c09)){logger[_0x71d4('0x14')](_['isObject'](_0x545c09)?JSON[_0x71d4('0x15')](_0x545c09):_0x545c09);}}_0x34473a['on'](_0x71d4('0x26'),_0x18b78a);_0x34473a['on'](_0x71d4('0x27'),_0x459c25);_0x34473a['on'](_0x71d4('0x12'),_0xaedf64);_0x34473a['on'](_0x71d4('0x14'),_0x3b34ab);});}; \ No newline at end of file +var _0xffd1=['message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','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','hex','Open\x20Tilde\x20ASR\x20socket','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffd1,0xc9));var _0x1ffd=function(_0x5d01b7,_0x1debc6){_0x5d01b7=_0x5d01b7-0x0;var _0x3089bc=_0xffd1[_0x5d01b7];return _0x3089bc;};'use strict';var BPromise=require(_0x1ffd('0x0'));var _=require(_0x1ffd('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1ffd('0x2'));var crypto=require(_0x1ffd('0x3'));var logger=require(_0x1ffd('0x4'))(_0x1ffd('0x5'));module[_0x1ffd('0x6')]=function(_0x4d7c70,_0x3beb4b,_0x57dacd,_0x13ff8e){return new BPromise(function(_0x1823d8,_0x8246b6){logger[_0x1ffd('0x7')]('Tilde\x20URI',_0x13ff8e||_0x1ffd('0x8'));var _0x2c7581=new WebSocket(_0x13ff8e||_0x1ffd('0x8'),{'perMessageDeflate':![]});var _0x51123f='';var _0x2ba22c='0';var _0x1868ed='1';var _0x3aa3ca=_0x1ffd('0x9');function _0x35ff30(_0x236623){var _0x27b0fe=crypto[_0x1ffd('0xa')](_0x1ffd('0xb'));_0x27b0fe[_0x1ffd('0xc')](_0x236623);return _0x27b0fe['digest'](_0x1ffd('0xd'));}function _0x59ed39(){try{logger['info'](_0x1ffd('0xe'));var _0x36f690=moment()['unix']();var _0x1a57ea=_0x35ff30(_0x36f690+_0x3beb4b+_0x57dacd);_0x2c7581['send'](JSON['stringify']({'appID':_0x3beb4b,'timestamp':_0x36f690,'appKey':_0x1a57ea}));var _0x4bd1ff=fs[_0x1ffd('0xf')](_0x4d7c70);_0x4bd1ff['on'](_0x1ffd('0x10'),function(_0x341ca4){_0x2c7581[_0x1ffd('0x11')](_0x341ca4);});_0x4bd1ff['on'](_0x1ffd('0x12'),function(){_0x2c7581[_0x1ffd('0x11')](_0x1ffd('0x13'));});}catch(_0x55c56f){logger[_0x1ffd('0x14')](_0x1ffd('0x15'),JSON[_0x1ffd('0x16')](_0x55c56f));_0x2c7581[_0x1ffd('0x17')]();}}function _0x7d66f8(_0x43576a){try{if(_0x43576a){var _0x562cf6=JSON[_0x1ffd('0x18')](_0x43576a);switch(_0x562cf6[_0x1ffd('0x19')]){case 0x0:if(_0x562cf6['result']){if(_0x562cf6[_0x1ffd('0x1a')][_0x1ffd('0x1b')]){logger['info'](_0x1ffd('0x1c'),JSON[_0x1ffd('0x16')](_0x562cf6[_0x1ffd('0x1a')][_0x1ffd('0x1d')]));_0x51123f=_0x562cf6[_0x1ffd('0x1a')]['hypotheses'][0x0][_0x1ffd('0x1e')];_0x2ba22c=_0x562cf6['result']['hypotheses'][0x0]['likelihood'];_0x1868ed='0';_0x3aa3ca='Success.';_0x2c7581[_0x1ffd('0x17')]();}}break;case 0x1:logger[_0x1ffd('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1868ed='1';_0x3aa3ca=_0x1ffd('0x9');break;case 0x2:logger[_0x1ffd('0x7')](_0x1ffd('0x1f'));_0x1868ed='2';_0x3aa3ca=_0x1ffd('0x1f');break;case 0x9:logger[_0x1ffd('0x7')](_0x1ffd('0x20'));_0x1868ed='9';_0x3aa3ca=_0x1ffd('0x20');break;case 0xa:logger[_0x1ffd('0x7')](_0x1ffd('0x21'));_0x1868ed='10';_0x3aa3ca=_0x1ffd('0x21');break;case 0xb:logger[_0x1ffd('0x7')](_0x1ffd('0x22'));_0x1868ed='11';_0x3aa3ca=_0x1ffd('0x22');}}}catch(_0x332e1d){logger[_0x1ffd('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x1ffd('0x16')](_0x332e1d));_0x2c7581[_0x1ffd('0x17')]();}}function _0xe93593(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x1823d8({'transcript':_0x51123f,'confidence':_0x2ba22c,'status':_0x1868ed,'status_message':_0x3aa3ca});}function _0x599812(_0x35746e){logger['error'](_0x1ffd('0x23'));if(!_[_0x1ffd('0x24')](_0x35746e)){logger['error'](_[_0x1ffd('0x25')](_0x35746e)?JSON[_0x1ffd('0x16')](_0x35746e):_0x35746e);}}_0x2c7581['on'](_0x1ffd('0x26'),_0x59ed39);_0x2c7581['on'](_0x1ffd('0x27'),_0x7d66f8);_0x2c7581['on'](_0x1ffd('0x12'),_0xe93593);_0x2c7581['on'](_0x1ffd('0x14'),_0x599812);});}; \ 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 f372323..ebbb5d8 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 _0x66d7=['exports'];(function(_0x52bcf3,_0x541acc){var _0xecb681=function(_0x87407d){while(--_0x87407d){_0x52bcf3['push'](_0x52bcf3['shift']());}};_0xecb681(++_0x541acc);}(_0x66d7,0x161));var _0x766d=function(_0xc7b62e,_0x247892){_0xc7b62e=_0xc7b62e-0x0;var _0x8167bf=_0x66d7[_0xc7b62e];return _0x8167bf;};var asr=require('./asr');module[_0x766d('0x0')]={'asr':asr}; \ No newline at end of file +var _0x941e=['exports'];(function(_0xd98277,_0x191271){var _0xb364b4=function(_0x4793c7){while(--_0x4793c7){_0xd98277['push'](_0xd98277['shift']());}};_0xb364b4(++_0x191271);}(_0x941e,0x18a));var _0xe941=function(_0x5dc9e9,_0x6263a1){_0x5dc9e9=_0x5dc9e9-0x0;var _0x144d50=_0x941e[_0x5dc9e9];return _0x144d50;};var asr=require('./asr');module[_0xe941('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e445fda..ac19d57 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0xe706,0xa3));var _0x6e70=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0xe706[_0xe47217];return _0x3dc84c;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4769f2b..689d028 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 _0xce50=['agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','moment','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','name','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_bot_name','googleASR','appid','clone','hasOwnProperty','isString','isPlainObject','recursiveNodeIndex','length','replaceAllVariables','saveRestApiResult','isArray','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','DIAL','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','substr','generate','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','recordFile','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','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','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI'];(function(_0x2aa375,_0x2bfaa4){var _0x443c44=function(_0x58739f){while(--_0x58739f){_0x2aa375['push'](_0x2aa375['shift']());}};_0x443c44(++_0x2bfaa4);}(_0xce50,0x1d8));var _0x0ce5=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xce50[_0x24f31b];return _0x488401;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0ce5('0x0'));var sh=require(_0x0ce5('0x1'));var odbc=require(_0x0ce5('0x2'))();var rs=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x0ce5('0x5'))('agi');var config=require('../../config/environment');var scripts=require(_0x0ce5('0x6'));var FILES_PATH=_0x0ce5('0x7');var recursiveMapAttributes=[_0x0ce5('0x8'),_0x0ce5('0x9')];var verticesWithRetry=['menu',_0x0ce5('0xa'),_0x0ce5('0xb')];var AGIVertices=function(_0x4d9a49,_0x1cdb92,_0x55639f){this[_0x0ce5('0xc')]=_0x4d9a49;this[_0x0ce5('0xd')]=_0x1cdb92;this[_0x0ce5('0xe')]=_0x55639f;};AGIVertices[_0x0ce5('0xf')]['getVariable']=function(_0x29abcd,_0x2b5559){this[_0x0ce5('0xd')][_0x0ce5('0x10')](_0x29abcd)[_0x0ce5('0x11')](function(_0x5dc9fa){_0x2b5559(null,_0x5dc9fa?_0x5dc9fa['name']:![]);})['catch'](function(_0x59c22e){_0x2b5559(_0x59c22e);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x12')]=function(_0x282453,_0x4f4a14){this[_0x0ce5('0xd')][_0x0ce5('0x13')](_0x282453)['then'](function(_0x45dacd){_0x4f4a14(null,_0x45dacd?_0x45dacd['name']:![]);})[_0x0ce5('0x14')](function(_0x1dd856){_0x4f4a14(_0x1dd856);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x15')]=function(_0x470087,_0x20452f){this[_0x0ce5('0xd')][_0x0ce5('0x16')](_0x470087)['then'](function(_0xfd429a){_0x20452f(null,_0xfd429a?_0xfd429a[_0x0ce5('0x17')]:![]);})['catch'](function(_0x4f5e0b){_0x20452f(_0x4f5e0b);});};AGIVertices[_0x0ce5('0xf')]['getSquareOdbc']=function(_0x2602ca,_0x477451){this[_0x0ce5('0xd')][_0x0ce5('0x18')](_0x2602ca)[_0x0ce5('0x11')](function(_0x22bf81){_0x477451(null,_0x22bf81?_0x22bf81['dsn']:![]);})[_0x0ce5('0x14')](function(_0xff25d){_0x477451(_0xff25d);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x19')]=function(_0x5a12e6,_0x20f520){this['rpc'][_0x0ce5('0x1a')](_0x5a12e6)[_0x0ce5('0x11')](function(_0x3be760){_0x20f520(null,_0x3be760?_0x3be760[_0x0ce5('0x17')]:![]);})[_0x0ce5('0x14')](function(_0xbb1a2c){_0x20f520(_0xbb1a2c);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1b')]=function(_0x133d41,_0xb4678b){this['rpc']['getTrunkById'](_0x133d41)[_0x0ce5('0x11')](function(_0x56ef06){_0xb4678b(null,_0x56ef06?_0x56ef06['name']:![]);})[_0x0ce5('0x14')](function(_0x564276){_0xb4678b(_0x564276);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1c')]=function(_0x5bdf41,_0x52b64d){var _0x33d945=this;this[_0x0ce5('0xd')]['getSoundById'](_0x5bdf41)[_0x0ce5('0x11')](function(_0x470fb6){_0x52b64d(null,_0x470fb6?_0x33d945[_0x0ce5('0x1d')](_0x470fb6['save_name']):![]);})['catch'](function(_0x343137){_0x52b64d(_0x343137);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1e')]=function(_0x3ea1bd,_0x460ccf){this[_0x0ce5('0xd')][_0x0ce5('0x1f')](_0x3ea1bd)[_0x0ce5('0x11')](function(_0x34612a){_0x460ccf(null,_0x34612a?_0x34612a:![]);})[_0x0ce5('0x14')](function(_0x2f392c){_0x460ccf(_0x2f392c);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x20')]=function(_0xfef4a3,_0x733d8a,_0x143960){this[_0x0ce5('0xe')][_0x0ce5('0x20')](_0xfef4a3,_0x733d8a)[_0x0ce5('0x11')](function(){_0x143960(null);})[_0x0ce5('0x14')](function(_0x1d7351){_0x143960(_0x1d7351);});};AGIVertices[_0x0ce5('0xf')]['getIntervals']=function(_0x168e40,_0x2ab6a8){this[_0x0ce5('0xd')]['getIntervalById'](_0x168e40)[_0x0ce5('0x11')](function(_0x14cceb){if(_0x14cceb){if(_0x14cceb[_0x0ce5('0x21')]){_0x2ab6a8(null,[_0x14cceb[_0x0ce5('0x22')]]);}else{_0x2ab6a8(null,_['map'](_0x14cceb[_0x0ce5('0x23')],_0x0ce5('0x22')));}}else{_0x2ab6a8(null,![]);}})[_0x0ce5('0x14')](function(_0x2a3ed6){_0x2ab6a8(_0x2a3ed6);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1d')]=function(_0x1fe492){return util[_0x0ce5('0x24')](_0x0ce5('0x25'),FILES_PATH,_0x1fe492);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x26')]=function(_0x453ee4,_0x4d5a1d,_0x13d73e){odbc[_0x0ce5('0x27')](_0x453ee4,function(_0x3b22b3){if(_0x3b22b3){logger['error'](_0x0ce5('0x28'),_0x3b22b3);_0x13d73e(_0x3b22b3);}else{logger[_0x0ce5('0x29')](_0x0ce5('0x2a'));odbc[_0x0ce5('0x2b')](_0x4d5a1d,function(_0x48a052,_0x222362){if(_0x48a052){logger['info'](_0x0ce5('0x2c'),_0x4d5a1d);_0x13d73e(_0x48a052);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4d5a1d);odbc[_0x0ce5('0x2d')](function(_0x415523){if(_0x415523){logger[_0x0ce5('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x415523);}_0x13d73e(null,_0x222362);});}});}});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x2f')]=function(_0x245ac6,_0x1c2fd0){this['rpc'][_0x0ce5('0x30')](_0x245ac6)[_0x0ce5('0x11')](function(_0x238f52){_0x1c2fd0(null,_0x238f52?_0x238f52:![]);})[_0x0ce5('0x14')](function(_0x3952c6){_0x1c2fd0(_0x3952c6);});};AGIVertices[_0x0ce5('0xf')]['createSmsMessage']=function(_0x29f290,_0x1eb781){this[_0x0ce5('0xd')][_0x0ce5('0x31')](_0x29f290)[_0x0ce5('0x11')](function(_0x1e75c5){_0x1eb781(null,_0x1e75c5);})[_0x0ce5('0x14')](function(_0x2be933){_0x1eb781(_0x2be933);});};AGIVertices[_0x0ce5('0xf')]['createSquareDetailsReport']=function(_0x5e280c,_0x1a16b7,_0x320639){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'node':_0x5e280c[_0x0ce5('0x33')],'application':_0x5e280c[_0x0ce5('0x34')],'data':_0x1a16b7||null,'project_name':this[_0x0ce5('0xc')][_0x0ce5('0x35')],'callerid':this[_0x0ce5('0xc')][_0x0ce5('0x36')]})[_0x0ce5('0x11')](function(_0x3ce14a){if(_0x320639){_0x320639(null,_0x3ce14a);}})['catch'](function(_0x511825){if(_0x320639){_0x320639(_0x511825);}});};AGIVertices['prototype'][_0x0ce5('0x37')]=function(_0x29cf23,_0x40e217,_0xecab39,_0x6e2f61){this[_0x0ce5('0xd')]['createSquareRecording']({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'callerid':this[_0x0ce5('0xc')][_0x0ce5('0x36')],'calleridname':this['channel'][_0x0ce5('0x38')],'context':this['channel']['context'],'extension':this[_0x0ce5('0xc')][_0x0ce5('0x39')],'priority':this[_0x0ce5('0xc')][_0x0ce5('0x3a')],'accountcode':this[_0x0ce5('0xc')][_0x0ce5('0x3b')],'dnid':this[_0x0ce5('0xc')][_0x0ce5('0x3c')],'projectName':this[_0x0ce5('0xc')][_0x0ce5('0x35')],'saveName':_0x40e217,'filename':_0x29cf23[_0x0ce5('0x3d')]||_0x40e217,'savePath':_0xecab39})[_0x0ce5('0x11')](function(_0x5629f4){_0x6e2f61(null,_0x5629f4);})[_0x0ce5('0x14')](function(_0x57a64a){_0x6e2f61(_0x57a64a);});};AGIVertices[_0x0ce5('0xf')]['createSquareMessage']=function(_0x4bca60,_0x5809a8,_0xc66bc3,_0x5bded9,_0x4eeaa6){this['rpc'][_0x0ce5('0x3e')]({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'body':_0x4bca60,'direction':_0x5809a8,'providerName':_0xc66bc3,'providerResponse':_0x5bded9})[_0x0ce5('0x11')](function(_0x536582){if(_0x4eeaa6){_0x4eeaa6(null,_0x536582);}})['catch'](function(_0xb6734e){if(_0x4eeaa6){_0x4eeaa6(_0xb6734e);}});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x3f')]=function(_0x248553,_0x4256e3){this[_0x0ce5('0xd')][_0x0ce5('0x3f')]({'firstName':_[_0x0ce5('0x40')](_0x248553[_0x0ce5('0x17')])||_[_0x0ce5('0x41')](_0x248553[_0x0ce5('0x17')])?_0x0ce5('0x42')+Math[_0x0ce5('0x43')]():_0x248553[_0x0ce5('0x17')],'lastName':_[_0x0ce5('0x40')](_0x248553[_0x0ce5('0x44')])||_[_0x0ce5('0x41')](_0x248553[_0x0ce5('0x44')])?null:_0x248553[_0x0ce5('0x44')],'phone':_0x248553['phone'],'ListId':_0x248553[_0x0ce5('0x45')],'scheduledat':_0x248553['scheduledAt'],'callbackUniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'tags':_0x0ce5('0x46'),'description':_0x0ce5('0x47')+_0x248553[_0x0ce5('0x48')][_0x0ce5('0x49')](),'priority':_0x248553[_0x0ce5('0x4a')]})[_0x0ce5('0x11')](function(_0x4476ce){_0x4256e3(null,_0x4476ce);})[_0x0ce5('0x14')](function(_0x847e99){_0x4256e3(_0x847e99);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x4b')]=function(_0x122ca3,_0x29cca6){this[_0x0ce5('0xd')][_0x0ce5('0x4c')](_0x122ca3)[_0x0ce5('0x11')](function(_0x1f0a7f){_0x29cca6(null,_0x1f0a7f?_0x1f0a7f[_0x0ce5('0x17')]:![]);})[_0x0ce5('0x14')](function(_0xc7ba0a){_0x29cca6(_0xc7ba0a);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x4d')]=function(_0x394875,_0x1975ca,_0x40a1f0){var _0x261355={'role':_0x0ce5('0x4e')};_0x261355[_0x394875]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x4d')](_0x261355,_0x1975ca,this[_0x0ce5('0xc')][_0x0ce5('0x32')])[_0x0ce5('0x11')](function(_0x501f6){_0x40a1f0(null,_['isNil'](_0x501f6)?![]:!![]);})['catch'](function(_0x5931fe){logger['error'](_0x5931fe);_0x40a1f0(null,![]);});};AGIVertices['prototype'][_0x0ce5('0x4f')]=function(_0x25bef0,_0x4768d8){var _0x394d41={'role':_0x0ce5('0x4e')};_0x394d41[_0x25bef0]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x4f')](_0x394d41)[_0x0ce5('0x11')](function(_0x3f6301){_0x4768d8(null,_[_0x0ce5('0x41')](_0x3f6301)?![]:!![]);})['catch'](function(_0x26e324){logger[_0x0ce5('0x2e')](_0x26e324);_0x4768d8(null,![]);});};AGIVertices['prototype'][_0x0ce5('0x50')]=function(_0x2e7d65,_0x10e4b5){var _0x374740={'role':_0x0ce5('0x4e')};_0x374740[_0x2e7d65]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x50')](_0x374740)[_0x0ce5('0x11')](function(_0x562092){_0x10e4b5(null,_[_0x0ce5('0x41')](_0x562092)?![]:!![]);})[_0x0ce5('0x14')](function(_0x43a734){logger[_0x0ce5('0x2e')](_0x43a734);_0x10e4b5(null,![]);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x51')]=function(_0x5da67b,_0x60b857){var _0x104eaf={'role':_0x0ce5('0x4e')};_0x104eaf[_0x5da67b]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];var _0x429410=_0x5da67b!='internal'?util[_0x0ce5('0x24')](_0x0ce5('0x52'),_0x0ce5('0x53'),this['channel'][_0x0ce5('0x36')]):undefined;this[_0x0ce5('0xd')]['agentLogin'](_0x104eaf,_0x429410)[_0x0ce5('0x11')](function(_0x53e7e5){_0x60b857(null,_['isNil'](_0x53e7e5)?![]:!![]);})[_0x0ce5('0x14')](function(_0x2a0ecd){logger[_0x0ce5('0x2e')](_0x2a0ecd);_0x60b857(null,![]);});};AGIVertices[_0x0ce5('0xf')]['shellCommand']=function(_0x3485b7,_0x253a15){sh['exec'](_[_0x0ce5('0x54')](_0x3485b7),function(_0x2f297b,_0x4903c7){var _0x5eaa68=_0x4903c7[_0x0ce5('0x55')](/(\r\n|\n|\r)/gm,'');_0x253a15(null,_0x5eaa68);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x56')]=function(_0x5c2f23,_0xa1c6ae){scripts[_0x0ce5('0x56')](_0x5c2f23[_0x0ce5('0x57')],_0x5c2f23['google_cloud_tts_text_type']||_0x0ce5('0x58'),_0x5c2f23[_0x0ce5('0x58')],_0x5c2f23['languageCode']||_0x0ce5('0x59'),_0x5c2f23[_0x0ce5('0x5a')]||'MALE',_0x5c2f23[_0x0ce5('0x5b')]||_0x0ce5('0x5c'))[_0x0ce5('0x11')](function(_0x2f0afc){_0xa1c6ae(null,_0x2f0afc);})['catch'](function(_0xed6e2){_0xa1c6ae(_0xed6e2);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x5d')]=function(_0x2c8448,_0x58738a){scripts[_0x0ce5('0x5d')](_0x2c8448[_0x0ce5('0x58')],_0x2c8448[_0x0ce5('0x5e')]||'en',0x1)[_0x0ce5('0x11')](function(_0x2bfb07){_0x58738a(null,_0x2bfb07);})['catch'](function(_0x5f23dc){_0x58738a(_0x5f23dc);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x5f')]=function(_0x8e976f,_0x5763c6){var _0x29298d={'uri':_0x8e976f[_0x0ce5('0x60')],'method':_0x8e976f[_0x0ce5('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x8e976f[_0x0ce5('0x62')])===_0x0ce5('0x63')&&parseInt(_0x8e976f[_0x0ce5('0x62')])>=0x1?parseInt(_0x8e976f[_0x0ce5('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x0ce5('0x64')](['POST',_0x0ce5('0x65')],_0x29298d[_0x0ce5('0x61')][_0x0ce5('0x66')]())){try{_0x29298d[_0x0ce5('0x67')]=_0x8e976f[_0x0ce5('0x9')]?JSON[_0x0ce5('0x68')](_0x8e976f[_0x0ce5('0x9')]):{};}catch(_0x5f14e2){logger[_0x0ce5('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5f14e2);}}try{_0x29298d['headers']=_0x8e976f[_0x0ce5('0x8')]?JSON[_0x0ce5('0x68')](_0x8e976f[_0x0ce5('0x8')]):{};}catch(_0x598b1c){logger[_0x0ce5('0x2e')](_0x0ce5('0x69'),_0x598b1c);}if(_0x8e976f[_0x0ce5('0x6a')]){try{var _0xe8a509=require(_0x8e976f[_0x0ce5('0x6a')])[_0x0ce5('0x6b')](this,_0x29298d);_0x29298d[_0x0ce5('0x6c')]=Mustache[_0x0ce5('0x6d')](_0x8e976f[_0x0ce5('0x60')],_0xe8a509,{},['$$','$$']);if(_0x29298d[_0x0ce5('0x6e')]){_0x29298d[_0x0ce5('0x6e')]=JSON[_0x0ce5('0x68')](Mustache[_0x0ce5('0x6d')](JSON[_0x0ce5('0x6f')](_0x29298d[_0x0ce5('0x6e')]),_0xe8a509,{},['$$','$$']));}if(_0x29298d['body']){_0x29298d[_0x0ce5('0x67')]=JSON['parse'](Mustache[_0x0ce5('0x6d')](JSON[_0x0ce5('0x6f')](_0x29298d[_0x0ce5('0x67')]),_0xe8a509,{},['$$','$$']));}}catch(_0x507bba){logger[_0x0ce5('0x2e')](_0x0ce5('0x70'),_0x507bba);}}rp(_0x29298d)['then'](function(_0x4ba926){var _0x4659fb={'statusCode':_0x4ba926[_0x0ce5('0x71')]||0xc8,'statusMessage':_0x4ba926['statusMessage']||'OK','headers':_0x4ba926['headers']||{},'body':_0x4ba926[_0x0ce5('0x67')]||{}};_0x5763c6(null,_0x4659fb);})['catch'](function(_0x45b0ca){var _0x38ddc1={'statusCode':_0x45b0ca['statusCode']||0x1f4,'statusMessage':_0x45b0ca[_0x0ce5('0x72')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x45b0ca[_0x0ce5('0x73')][_0x0ce5('0x6e')]||{},'body':_0x45b0ca[_0x0ce5('0x73')][_0x0ce5('0x67')]||{}};_0x5763c6(null,_0x38ddc1);});};AGIVertices[_0x0ce5('0xf')]['googleDialogflow']=function(_0x1bad83,_0x4d5bf6){scripts[_0x0ce5('0x74')](this[_0x0ce5('0xc')]['uniqueid'],_0x1bad83[_0x0ce5('0x75')],_0x1bad83['text'],_0x1bad83['dialogflow_language']||'en')[_0x0ce5('0x11')](function(_0x2e636a){_0x4d5bf6(null,_0x2e636a);})[_0x0ce5('0x14')](function(_0x40c866){_0x4d5bf6(_0x40c866);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x76')]=function(_0x316d4d,_0xd9726e){scripts[_0x0ce5('0x76')](this[_0x0ce5('0xc')][_0x0ce5('0x32')],_0x316d4d[_0x0ce5('0x77')],_0x316d4d[_0x0ce5('0x78')],_0x316d4d[_0x0ce5('0x79')],_0x316d4d[_0x0ce5('0x58')],_0x316d4d[_0x0ce5('0x7a')]||'en')[_0x0ce5('0x11')](function(_0x93a098){_0xd9726e(null,_0x93a098);})[_0x0ce5('0x14')](function(_0x312c06){_0xd9726e(_0x312c06);});};AGIVertices['prototype'][_0x0ce5('0x7b')]=function(_0x478e85,_0x443d0c){scripts[_0x0ce5('0x7b')](this[_0x0ce5('0xc')],_0x478e85)[_0x0ce5('0x11')](function(_0x5481ab){_0x443d0c(null,_0x5481ab);})[_0x0ce5('0x14')](function(_0x1921d0){_0x443d0c(_0x1921d0);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x7c')]=function(_0x22e286,_0x518b07){scripts[_0x0ce5('0x7c')](_0x22e286[_0x0ce5('0x75')],_0x22e286[_0x0ce5('0x58')],_0x22e286['ispeech_tts_language']||_0x0ce5('0x59'),_0x22e286['speed'])[_0x0ce5('0x11')](function(_0x326a71){_0x518b07(null,_0x326a71);})[_0x0ce5('0x14')](function(_0x4727df){_0x518b07(_0x4727df);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x7d')]=function(_0x51338d,_0x4808d8,_0x1e5be8){scripts[_0x0ce5('0x7d')](_0x4808d8,_0x51338d[_0x0ce5('0x75')],_0x51338d[_0x0ce5('0x7e')]||_0x0ce5('0x59'),this[_0x0ce5('0x7f')](_0x51338d[_0x0ce5('0x80')])?_0x51338d[_0x0ce5('0x80')]:undefined)['then'](function(_0x37dc41){_0x1e5be8(null,_0x37dc41);})['catch'](function(_0x1c2a92){_0x1e5be8(_0x1c2a92);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x81')]=function(_0x3b1e80,_0x401000){scripts[_0x0ce5('0x81')](_0x3b1e80[_0x0ce5('0x82')],_0x3b1e80[_0x0ce5('0x83')],_0x3b1e80[_0x0ce5('0x84')],_0x3b1e80[_0x0ce5('0x85')]||'Amy',_0x3b1e80[_0x0ce5('0x58')],_0x3b1e80['aws_text_type']||'text')[_0x0ce5('0x11')](function(_0x3ca695){_0x401000(null,_0x3ca695);})[_0x0ce5('0x14')](function(_0x5063d8){_0x401000(_0x5063d8);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x86')]=function(_0x1c0367,_0x1d515e){scripts['awsLex'](this[_0x0ce5('0xc')]['uniqueid'],_0x1c0367[_0x0ce5('0x82')],_0x1c0367[_0x0ce5('0x83')],_0x1c0367['aws_lex_region'],_0x1c0367['text'],_0x1c0367[_0x0ce5('0x87')])[_0x0ce5('0x11')](function(_0x4abfb5){_0x1d515e(null,_0x4abfb5);})[_0x0ce5('0x14')](function(_0x2a6350){_0x1d515e(_0x2a6350);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x88')]=function(_0xb1cf15,_0xdd90d1,_0x473e1d){scripts[_0x0ce5('0x88')](_0xdd90d1,_0xb1cf15[_0x0ce5('0x75')],_0xb1cf15['google_asr_language']||_0x0ce5('0x59'))[_0x0ce5('0x11')](function(_0x455ea0){_0x473e1d(null,_0x455ea0);})[_0x0ce5('0x14')](function(_0x1f57dc){_0x473e1d(_0x1f57dc);});};AGIVertices[_0x0ce5('0xf')]['tildeASR']=function(_0x2b4dfc,_0x17ba87,_0x1447aa){scripts['tildeASR'](_0x17ba87,_0x2b4dfc[_0x0ce5('0x89')],_0x2b4dfc['appsecret'],_0x2b4dfc[_0x0ce5('0x6c')])[_0x0ce5('0x11')](function(_0x209771){_0x1447aa(null,_0x209771);})[_0x0ce5('0x14')](function(_0xc62690){_0x1447aa(_0xc62690);});};AGIVertices[_0x0ce5('0xf')]['clear']=function(_0x333d54){var _0x2cc226=_[_0x0ce5('0x64')](verticesWithRetry,_0x333d54[_0x0ce5('0x34')])?_0x333d54:_[_0x0ce5('0x8a')](_0x333d54);for(var _0x22bf95 in _0x2cc226){if(_0x2cc226[_0x0ce5('0x8b')](_0x22bf95)){if(_0x2cc226[_0x22bf95]&&_[_0x0ce5('0x8c')](_0x2cc226[_0x22bf95])){if(_['includes'](recursiveMapAttributes,_0x22bf95)){_0x2cc226[_0x22bf95]=this['replaceObjectAllVariables'](_0x2cc226[_0x22bf95]);}else{_0x2cc226[_0x22bf95]=this['replaceAllVariables'](_0x2cc226[_0x22bf95]);}}}}return _0x2cc226;};AGIVertices[_0x0ce5('0xf')]['recursiveNodeIndex']=function(_0x44ec28){for(var _0x5a23b3 in _0x44ec28){if(_0x44ec28[_0x0ce5('0x8b')](_0x5a23b3)){if(_[_0x0ce5('0x8d')](_0x44ec28[_0x5a23b3])){this[_0x0ce5('0x8e')](_0x44ec28[_0x5a23b3]);}else if(_['isArray'](_0x44ec28[_0x5a23b3])){for(var _0xdbbf50=0x0;_0xdbbf50<_0x44ec28[_0x5a23b3][_0x0ce5('0x8f')];_0xdbbf50++){this[_0x0ce5('0x8e')](_0x44ec28[_0x5a23b3][_0xdbbf50]);}}else if(_[_0x0ce5('0x8c')](_0x44ec28[_0x5a23b3])){_0x44ec28[_0x5a23b3]=this[_0x0ce5('0x90')](_0x44ec28[_0x5a23b3]);}}}};AGIVertices['prototype'][_0x0ce5('0x91')]=function(_0x27696f,_0x576ff2){for(var _0x496501 in _0x27696f){if(_0x27696f[_0x0ce5('0x8b')](_0x496501)){if(_[_0x0ce5('0x8d')](_0x27696f[_0x496501])){if(!_['isEmpty'](_0x27696f[_0x496501])){this[_0x0ce5('0x91')](_0x27696f[_0x496501],util[_0x0ce5('0x24')]('%s.%s',_0x576ff2,_0x496501));}}else if(_[_0x0ce5('0x92')](_0x27696f[_0x496501])){for(var _0x1c7384=0x0;_0x1c7384<_0x27696f[_0x496501][_0x0ce5('0x8f')];_0x1c7384++){this['saveRestApiResult'](_0x27696f[_0x496501][_0x1c7384],util['format'](_0x0ce5('0x93'),_0x576ff2,_0x496501+'['+_0x1c7384+']'));}}else{if(!_[_0x0ce5('0x41')](_0x27696f[_0x496501])){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x93'),_0x576ff2,_0x496501),_0x27696f[_0x496501]);}}}}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x95')]=function(_0x116b3c){try{var _0x5690a9=JSON['parse'](_0x116b3c);this[_0x0ce5('0x8e')](_0x5690a9);return JSON['stringify'](_0x5690a9);}catch(_0x2fa3f6){return this[_0x0ce5('0x90')](_0x116b3c);}};AGIVertices[_0x0ce5('0xf')]['replaceAllVariables']=function(_0xfc96f0){var _0x48302b=_0xfc96f0[_0x0ce5('0x96')]('{');for(var _0x3edd27=0x1;_0x3edd27<_0x48302b[_0x0ce5('0x8f')];_0x3edd27+=0x1){var _0x555b61=_0x48302b[_0x3edd27][_0x0ce5('0x96')]('}');if(_0x555b61[_0x0ce5('0x8f')]>0x1){_0xfc96f0=_0xfc96f0[_0x0ce5('0x97')]('{'+_0x555b61[0x0]+'}',this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x555b61[0x0])[_0x0ce5('0x99')]||_0x555b61[0x0]);}}if(_0x48302b[_0x0ce5('0x8f')]===0x1){return _0xfc96f0['toString']();}return this[_0x0ce5('0x90')](_0xfc96f0);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9a')]=function(_0x30bdc4,_0x39b669){var _0x194b41=this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x30bdc4);if(_0x194b41['result']===-0x1){return _0x194b41;}logger['info'](util['format'](_0x0ce5('0x9b'),_0x39b669,_0x194b41[_0x0ce5('0x99')]));return this['channel']['setVariable'](_0x39b669,_0x194b41[_0x0ce5('0x99')]);};AGIVertices['prototype'][_0x0ce5('0x7f')]=function(_0x3b33c9){return _0x3b33c9&&_0x3b33c9!=='0'&&_0x3b33c9!=='-1'&&_0x3b33c9!=='';};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9c')]=function(_0x464fac){this[_0x0ce5('0x9d')]['sync'](this,_0x464fac,'-');_0x464fac['retry']=_0x464fac['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0ce5('0xf')]['mrcpsynth']=function(_0x19a4c2){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x9e'),_0x19a4c2[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x19a4c2[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x267ee0='\x22'+_0x19a4c2[_0x0ce5('0x58')]+'\x22';if(this[_0x0ce5('0x7f')](_0x19a4c2[_0x0ce5('0x73')])){_0x267ee0+=','+_0x19a4c2[_0x0ce5('0x73')];}var _0x1021e8=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa2'),_0x267ee0);if(_0x1021e8[_0x0ce5('0xa3')]===-0x1){return _0x1021e8;}return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xa4'),_0x267ee0));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xa5')]=function(_0x225219){logger['info'](util[_0x0ce5('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x225219[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x225219['grammar'])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0xa6'));}var _0x3a4260=_0x225219[_0x0ce5('0xa7')];if(this['isConfigured'](_0x225219['options'])){_0x3a4260+=','+_0x225219[_0x0ce5('0x73')];}var _0x99d56c=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x3a4260);if(_0x99d56c[_0x0ce5('0xa3')]===-0x1){return _0x99d56c;}var _0x9893e0=this['getAndSetVariable'](_0x0ce5('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x9893e0['result']===-0x1){return _0x9893e0;}var _0x12d9ed=this[_0x0ce5('0x9a')](_0x0ce5('0xaa'),_0x0ce5('0xab'));if(_0x12d9ed['result']===-0x1){return _0x12d9ed;}var _0x4b16c4=this['getAndSetVariable'](_0x0ce5('0xac'),_0x0ce5('0xad'));if(_0x4b16c4[_0x0ce5('0xa3')]===-0x1){return _0x4b16c4;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3a4260));};AGIVertices['prototype'][_0x0ce5('0xae')]=function(_0xfb086f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xaf'),_0xfb086f[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0xae')]([_0xfb086f['command'],_0xfb086f[_0x0ce5('0xb0')]]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xb1')]=function(_0x5d099f){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0xb2'),_0x5d099f[_0x0ce5('0x33')]));if(this['isConfigured'](_0x5d099f[_0x0ce5('0x62')])){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0xb3'),_0x5d099f['timeout']));var _0x349c79=this[_0x0ce5('0xc')][_0x0ce5('0xb4')](_0x5d099f[_0x0ce5('0x62')]);if(_0x349c79['result']===-0x1){return _0x349c79;}}return this['channel'][_0x0ce5('0xb1')]();};AGIVertices[_0x0ce5('0xf')]['callback']=function(_0x5864a1){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5864a1[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x5864a1[_0x0ce5('0x45')])){return this['channel'][_0x0ce5('0x2e')](_0x5864a1,'no\x20list\x20selected');}_0x5864a1[_0x0ce5('0x48')]=moment();if(this[_0x0ce5('0x7f')](_0x5864a1[_0x0ce5('0xb5')])){_0x5864a1[_0x0ce5('0x48')]=moment()['add'](_0x5864a1[_0x0ce5('0xb5')],_0x0ce5('0xb6'));}if(!this['isConfigured'](_0x5864a1[_0x0ce5('0x4a')])){_0x5864a1[_0x0ce5('0x4a')]=0x2;}this[_0x0ce5('0x3f')][_0x0ce5('0x6b')](this,_0x5864a1);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xb7'),_0x5864a1[_0x0ce5('0xb8')],_0x5864a1[_0x0ce5('0x45')],_0x5864a1['scheduledAt']));};AGIVertices[_0x0ce5('0xf')]['custom_app']=function(_0x529801){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x529801['label']));var _0x507972=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x529801[_0x0ce5('0xb9')],_0x529801[_0x0ce5('0x73')]);if(_0x507972[_0x0ce5('0xa3')]===-0x1){return _0x507972;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xba'),_0x529801[_0x0ce5('0xb9')],_0x529801[_0x0ce5('0x73')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xbb')]=function(_0x2a7ccc){logger['info'](util[_0x0ce5('0x24')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2a7ccc[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x2a7ccc[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x995794='\x22'+_0x2a7ccc[_0x0ce5('0x58')]+'\x22';if(this[_0x0ce5('0x7f')](_0x2a7ccc[_0x0ce5('0x73')])){_0x995794+=','+_0x2a7ccc[_0x0ce5('0x73')];}var _0x98c7fc=this['channel']['exec'](_0x0ce5('0xa2'),_0x995794);if(_0x98c7fc[_0x0ce5('0xa3')]===-0x1){return _0x98c7fc;}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0xa4'),_0x995794));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xbc')]=function(_0x185a34){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0xbd'),_0x185a34[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x185a34[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x47508e='\x22'+_0x185a34[_0x0ce5('0x58')]+'\x22';if(this['isConfigured'](_0x185a34[_0x0ce5('0x73')])){_0x47508e+=','+_0x185a34['options'];}var _0x3bdf50=this['channel'][_0x0ce5('0xa1')](_0x0ce5('0xa2'),_0x47508e);if(_0x3bdf50[_0x0ce5('0xa3')]===-0x1){return _0x3bdf50;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xa4'),_0x47508e));};AGIVertices['prototype'][_0x0ce5('0xbe')]=function(_0x278606){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xbf'),_0x278606['label']));if(!this[_0x0ce5('0x7f')](_0x278606['grammar'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa6'));}var _0x4920e3=_0x278606[_0x0ce5('0xa7')];if(this[_0x0ce5('0x7f')](_0x278606[_0x0ce5('0x73')])){_0x4920e3+=','+_0x278606['options'];}var _0x5a3886=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x4920e3);if(_0x5a3886['result']===-0x1){return _0x5a3886;}var _0x1d1654=this[_0x0ce5('0x9a')](_0x0ce5('0xa9'),_0x0ce5('0xc0'));if(_0x1d1654[_0x0ce5('0xa3')]===-0x1){return _0x1d1654;}var _0x145b66=this[_0x0ce5('0x9a')]('RECOG_INPUT()',_0x0ce5('0xc1'));if(_0x145b66[_0x0ce5('0xa3')]===-0x1){return _0x145b66;}var _0x3bb994=this[_0x0ce5('0x9a')]('RECOG_INSTANCE()',_0x0ce5('0xc2'));if(_0x3bb994[_0x0ce5('0xa3')]===-0x1){return _0x3bb994;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xc3'),_0x4920e3));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xc4')]=function(_0x1960c5){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xc5'),_0x1960c5[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1960c5[_0x0ce5('0xa7')])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0xa6'));}var _0x2200ed=_0x1960c5[_0x0ce5('0xa7')];if(this[_0x0ce5('0x7f')](_0x1960c5['options'])){_0x2200ed+=','+_0x1960c5[_0x0ce5('0x73')];}var _0x53122f=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x2200ed);if(_0x53122f[_0x0ce5('0xa3')]===-0x1){return _0x53122f;}var _0x2d0da1=this[_0x0ce5('0x9a')](_0x0ce5('0xa9'),_0x0ce5('0xc6'));if(_0x2d0da1[_0x0ce5('0xa3')]===-0x1){return _0x2d0da1;}var _0xea6f7a=this[_0x0ce5('0x9a')](_0x0ce5('0xaa'),_0x0ce5('0xc7'));if(_0xea6f7a[_0x0ce5('0xa3')]===-0x1){return _0xea6f7a;}var _0x5b5118=this['getAndSetVariable']('RECOG_INSTANCE()',_0x0ce5('0xc8'));if(_0x5b5118[_0x0ce5('0xa3')]===-0x1){return _0x5b5118;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xc3'),_0x2200ed));};AGIVertices[_0x0ce5('0xf')]['database']=function(_0x1e79c9){logger['info'](util['format'](_0x0ce5('0xc9'),_0x1e79c9[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x1e79c9['odbc_id'])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xca'));}var _0x439f75=this['getSquareOdbc'][_0x0ce5('0x6b')](this,_0x1e79c9[_0x0ce5('0xcb')]);if(!_0x439f75){return this['channel'][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xcc'));}if(!this['isConfigured'](_0x1e79c9[_0x0ce5('0x2b')])){return this['channel'][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xcd'));}var _0x1dff31=_0x1e79c9['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xce'),_0x1dff31));var _0xaf7964=this[_0x0ce5('0x26')][_0x0ce5('0x6b')](this,_0x439f75,_0x1dff31);this['createSquareDetailsReport']['sync'](this,_0x1e79c9,_0x1dff31);if(!this[_0x0ce5('0x7f')](_0x1e79c9['variable_id'])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xcf'));}var _0x200b67=this['getVariable'][_0x0ce5('0x6b')](this,_0x1e79c9[_0x0ce5('0xd0')]);if(!_0x200b67){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1e79c9,'no\x20variable\x20found');}var _0x14a153=this;_0xaf7964['forEach'](function(_0x30f772,_0x283832){Object[_0x0ce5('0xd1')](_0x30f772)[_0x0ce5('0xd2')](function(_0x24570c){_0x14a153[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0xd3'),_0x200b67,_0x283832,_0x24570c),_0x30f772[_0x24570c]);});});this['channel']['setVariable'](util[_0x0ce5('0x24')](_0x0ce5('0xd4'),_0x200b67),_0xaf7964[_0x0ce5('0x8f')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('variable\x20%s\x20set',_0x200b67));};AGIVertices[_0x0ce5('0xf')]['dial']=function(_0x27632f){logger[_0x0ce5('0xd5')](util[_0x0ce5('0x24')](_0x0ce5('0xd6'),_0x27632f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x27632f[_0x0ce5('0xd7')])){return this[_0x0ce5('0xc')]['error'](_0x27632f,'no\x20user\x20selected');}var _0x3ea2a7=this[_0x0ce5('0x19')][_0x0ce5('0x6b')](this,_0x27632f[_0x0ce5('0xd7')]);if(!_0x3ea2a7){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x27632f,_0x0ce5('0xd8'));}var _0x47c770=this[_0x0ce5('0xc')][_0x0ce5('0xa1')]('DIAL',[util['format'](_0x0ce5('0xd9'),_0x3ea2a7),_0x27632f[_0x0ce5('0x62')],_0x27632f['opts'],_0x27632f[_0x0ce5('0x60')]]);if(_0x47c770[_0x0ce5('0xa3')]===-0x1){return _0x47c770;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('Executed\x20command\x20%s',_0x0ce5('0xda')));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xdb')]=function(_0x509f0f){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x509f0f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x509f0f[_0x0ce5('0x75')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xdc'));}if(!this[_0x0ce5('0x7f')](_0x509f0f[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this['channel'][_0x0ce5('0xdd')]=!![];this['createSquareDetailsReport'](_0x509f0f);this[_0x0ce5('0x3e')](_0x509f0f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('Trying\x20Dialogflow:\x20%s',_0x509f0f[_0x0ce5('0x58')]));var _0x34cb4f=this['googleDialogflow'][_0x0ce5('0x6b')](this,_0x509f0f);if(_0x34cb4f){for(var _0x516850 in _0x34cb4f){if(_0x34cb4f[_0x0ce5('0x8b')](_0x516850)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0xde'),_0x516850[_0x0ce5('0x66')]()),_0x34cb4f[_0x516850]);}}this[_0x0ce5('0x3e')](_0x34cb4f[_0x0ce5('0xdf')],'out','dialogflow','');return this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')]('Dialogflow\x20Result\x20%s',_0x34cb4f[_0x0ce5('0xdf')]));}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x509f0f,_0x0ce5('0xe0'));};AGIVertices['prototype'][_0x0ce5('0xe1')]=function(_0x4c713f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xe2'),_0x4c713f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x4c713f['dialogflowV2_project_id'])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xe3'));}if(!this['isConfigured'](_0x4c713f['client_email'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xe4'));}if(!this[_0x0ce5('0x7f')](_0x4c713f[_0x0ce5('0x79')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xe5'));}if(!this['isConfigured'](_0x4c713f[_0x0ce5('0x7a')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xe6'));}if(!this[_0x0ce5('0x7f')](_0x4c713f[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this['channel'][_0x0ce5('0xdd')]=!![];this[_0x0ce5('0x9d')](_0x4c713f);this[_0x0ce5('0x3e')](_0x4c713f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x4c713f[_0x0ce5('0x58')]));var _0x137452=this[_0x0ce5('0x76')][_0x0ce5('0x6b')](this,_0x4c713f);if(_0x137452){for(var _0x4725e1 in _0x137452){if(_0x137452[_0x0ce5('0x8b')](_0x4725e1)){if(_0x4725e1!=='providerResponse'){this[_0x0ce5('0xc')]['setVariable'](util[_0x0ce5('0x24')](_0x0ce5('0xde'),_0x4725e1[_0x0ce5('0x66')]()),_0x137452[_0x4725e1]);}}}this[_0x0ce5('0x3e')](_0x137452['speech'],'out',_0x0ce5('0xe1'),_0x137452[_0x0ce5('0xe7')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('DialogflowV2\x20Result\x20%s',_0x137452[_0x0ce5('0xdf')]));}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x4c713f,_0x0ce5('0xe8'));};AGIVertices['prototype'][_0x0ce5('0xe9')]=function(_0x82577f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xea'),_0x82577f['label']));if(!this[_0x0ce5('0x7f')](_0x82577f[_0x0ce5('0xeb')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xec'));}if(!this[_0x0ce5('0x7f')](_0x82577f[_0x0ce5('0xed')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20username\x20configured');}if(!this[_0x0ce5('0x7f')](_0x82577f['password'])){return this[_0x0ce5('0xc')]['noop']('no\x20password\x20configured');}if(!this[_0x0ce5('0x7f')](_0x82577f['ndassistant_url'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this[_0x0ce5('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x82577f);this[_0x0ce5('0x3e')](_0x82577f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SestekNDA:\x20%s',_0x82577f[_0x0ce5('0x58')]));var _0x16284d=this[_0x0ce5('0x7b')][_0x0ce5('0x6b')](this,_0x82577f);if(_0x16284d){for(var _0x4c8a40 in _0x16284d){if(_0x16284d['hasOwnProperty'](_0x4c8a40)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')]('SESTEK_NDA_%s',_0x4c8a40[_0x0ce5('0x66')]()),_0x16284d[_0x4c8a40]);}}this[_0x0ce5('0x3e')](_0x16284d[_0x0ce5('0xdf')],_0x0ce5('0xee'),_0x0ce5('0xe9'),'');if(_0x16284d[_0x0ce5('0xef')]){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xf0'),_0x16284d[_0x0ce5('0xef')]));var _0x42c144=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x16284d[_0x0ce5('0xef')]);try{fs[_0x0ce5('0xf2')](_0x16284d[_0x0ce5('0xef')]+_0x0ce5('0xf3'));}catch(_0x12f6e8){logger[_0x0ce5('0x2e')](_0x12f6e8);}return _0x42c144;}else{return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xf4'),_0x16284d[_0x0ce5('0xdf')]));}}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x82577f,_0x0ce5('0xf5'));};AGIVertices[_0x0ce5('0xf')]['end']=function(_0xdb43b2){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0xdb43b2['label']));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('end');};AGIVertices[_0x0ce5('0xf')]['ext_dial']=function(_0x1802f9){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xf6'),_0x1802f9[_0x0ce5('0x33')]));var _0x37c1b3='';if(_0x1802f9[_0x0ce5('0xf7')]){if(!this['isConfigured'](_0x1802f9[_0x0ce5('0xf7')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1802f9,_0x0ce5('0xf8'));}else{var _0x30def9=parseInt(_0x1802f9[_0x0ce5('0xf7')],0xa);if(isNaN(_0x30def9)){_0x37c1b3=_0x1802f9[_0x0ce5('0xf7')];}else{_0x37c1b3=this[_0x0ce5('0x1b')][_0x0ce5('0x6b')](this,_0x1802f9[_0x0ce5('0xf7')]);if(!_0x37c1b3){return this[_0x0ce5('0xc')]['error'](_0x1802f9,_0x0ce5('0xf9'));}}}}else if(_0x1802f9['trunk_name']){_0x37c1b3=_0x1802f9[_0x0ce5('0xfa')];}else{return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1802f9,_0x0ce5('0xf8'));}var _0x544726=this['channel']['exec'](_0x0ce5('0xda'),[util[_0x0ce5('0x24')](_0x0ce5('0xfb'),_0x37c1b3,_0x1802f9[_0x0ce5('0xb8')]),_0x1802f9[_0x0ce5('0x62')],_0x1802f9[_0x0ce5('0xfc')],_0x1802f9['url']]);if(_0x544726[_0x0ce5('0xa3')]===-0x1){return _0x544726;}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0xfd'),_0x0ce5('0xda')));};AGIVertices[_0x0ce5('0xf')]['finally']=function(_0x49e293){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xfe'),_0x49e293[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xff'));};AGIVertices['prototype'][_0x0ce5('0xa')]=function(_0x3d5e73){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x100'),_0x3d5e73[_0x0ce5('0x33')]));if(_0x3d5e73[_0x0ce5('0x101')]===0x0){return this[_0x0ce5('0x9c')](_0x3d5e73);}_0x3d5e73[_0x0ce5('0x101')]-=0x1;if(!this['isConfigured'](_0x3d5e73[_0x0ce5('0x102')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x3d5e73,_0x0ce5('0x103'));}var _0x421848=this[_0x0ce5('0x1c')][_0x0ce5('0x6b')](this,_0x3d5e73[_0x0ce5('0x102')]);if(!_0x421848){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x3d5e73,_0x0ce5('0x104'));}if(!this[_0x0ce5('0x7f')](_0x3d5e73[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')]['error'](_0x0ce5('0xcf'));}var _0x23824b=this[_0x0ce5('0xc')][_0x0ce5('0x105')](_0x421848,_0x3d5e73['response'],_0x3d5e73[_0x0ce5('0x106')]);var _0x311458=_0x23824b[_0x0ce5('0xa3')]?_0x23824b[_0x0ce5('0xa3')][_0x0ce5('0x49')]():'';logger[_0x0ce5('0x29')]('test',JSON['stringify'](_0x23824b));if(_0x23824b[_0x0ce5('0xa3')]===-0x1){this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x3d5e73,_0x311458);return _0x23824b;}else if(_0x23824b['extra']===_0x0ce5('0x62')){_0x23824b['result']=_0x311458['length']>=parseInt(_0x3d5e73[_0x0ce5('0x107')])?'x':'i';}else{_0x23824b[_0x0ce5('0xa3')]=_0x311458[_0x0ce5('0x8f')]>=parseInt(_0x3d5e73[_0x0ce5('0x107')])&&_0x311458[_0x0ce5('0x8f')]<=parseInt(_0x3d5e73[_0x0ce5('0x106')])?'x':'i';}var _0x3be551=this['getVariable']['sync'](this,_0x3d5e73['variable_id']);if(!_0x3be551){return this[_0x0ce5('0xc')]['error'](_0x3d5e73,_0x0ce5('0x108'));}this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x3be551,_0x311458);if(this[_0x0ce5('0x7f')](_0x3d5e73[_0x0ce5('0x109')])){var _0x31605f=parseInt(_0x3d5e73['hiddendigitsnum'],0xa);var _0x5557bc=rs['generate']({'charset':'*','length':_0x31605f});var _0xae0233=_0x311458[_0x0ce5('0x8f')];if(_0xae0233>0x0){if(_0xae0233>_0x31605f){this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x3d5e73,_0x3d5e73[_0x0ce5('0x10a')]==='first'?_0x5557bc+_0x311458['substr'](_0x31605f):_0x311458[_0x0ce5('0x10b')](0x0,_0xae0233-_0x31605f)+_0x5557bc);}else{this['createSquareDetailsReport']['sync'](this,_0x3d5e73,rs[_0x0ce5('0x10c')]({'charset':'*','length':_0xae0233}));}}else{this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x3d5e73,'');}}else{this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x3d5e73,_0x311458);}return _0x23824b;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xb')]=function(_0x277281){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x277281[_0x0ce5('0x33')]));return this[_0x0ce5('0xa')](_0x277281);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x10d')]=function(_0x31f547){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x31f547[_0x0ce5('0x33')]));this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x31f547,_0x31f547[_0x0ce5('0x10e')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x10f'),_0x31f547[_0x0ce5('0x10e')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x110')]=function(_0x5f04cd){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x111'),_0x5f04cd['label']));if(!this['isConfigured'](_0x5f04cd[_0x0ce5('0x82')])||!this['isConfigured'](_0x5f04cd[_0x0ce5('0x83')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x0ce5('0x7f')](_0x5f04cd[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x112'),_0x5f04cd[_0x0ce5('0x58')]));var _0x57a7cd=this[_0x0ce5('0x81')][_0x0ce5('0x6b')](this,_0x5f04cd);if(_0x57a7cd){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x113'),_0x57a7cd));var _0x38c7db=this[_0x0ce5('0xc')]['streamFile'](_0x57a7cd);try{fs[_0x0ce5('0xf2')](_0x57a7cd+'.wav');}catch(_0xd96521){logger[_0x0ce5('0x2e')](_0xd96521);}return _0x38c7db;}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x5f04cd,_0x0ce5('0x114'));};AGIVertices['prototype'][_0x0ce5('0x115')]=function(_0x15b2c7){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x116'),_0x15b2c7[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x82')])||!this[_0x0ce5('0x7f')](_0x15b2c7['aws_secret_access_key'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x117'));}if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x87')])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0x118'));}if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this['channel'][_0x0ce5('0xdd')]=!![];this[_0x0ce5('0x9d')](_0x15b2c7);this[_0x0ce5('0x3e')](_0x15b2c7[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x119'),_0x15b2c7[_0x0ce5('0x58')]));var _0x16feb3=this[_0x0ce5('0x86')][_0x0ce5('0x6b')](this,_0x15b2c7);if(_0x16feb3){for(var _0x23929e in _0x16feb3){if(_0x16feb3[_0x0ce5('0x8b')](_0x23929e)&&_[_0x0ce5('0x8c')](_0x16feb3[_0x23929e])){this['channel'][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x11a'),_0x23929e[_0x0ce5('0x66')]()),_0x16feb3[_0x23929e]);}}if(_[_0x0ce5('0x41')](_0x16feb3[_0x0ce5('0x72')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x11b'));}else{this[_0x0ce5('0x3e')](_0x16feb3[_0x0ce5('0x72')],_0x0ce5('0xee'),'amazonlex','');return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x11c'),_0x16feb3[_0x0ce5('0x72')]));}}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x15b2c7,_0x0ce5('0x11d'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x11e')]=function(_0x775277){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x11f'),_0x775277['label'],_0x775277[_0x0ce5('0x62')]));if(!this[_0x0ce5('0x7f')](_0x775277[_0x0ce5('0x75')])){return this['channel']['noop'](_0x0ce5('0xdc'));}var _0x260bb4=_0x0ce5('0x120');var _0x4a9fdd=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,rs['generate'](0x4));var _0x4dceb7=util[_0x0ce5('0x24')](_0x0ce5('0x93'),_0x4a9fdd,_0x260bb4);var _0x578e27=!![];if(_0x775277[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0x578e27=![];}var _0x33c031=this['channel']['recordFile'](_0x4a9fdd,_0x260bb4,_0x775277[_0x0ce5('0x124')],_0x775277['timeout'],undefined,_0x578e27);if(_0x33c031[_0x0ce5('0xa3')]!==-0x1){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x125'),_0x4dceb7));var _0x141d13=this['googleASR'][_0x0ce5('0x6b')](this,_0x775277,_0x4dceb7);if(_0x141d13){for(var _0x20c7f8 in _0x141d13){if(_0x141d13[_0x0ce5('0x8b')](_0x20c7f8)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')]('GOOGLE_ASR_%s',_0x20c7f8['toUpperCase']()),_0x141d13[_0x20c7f8]);}}return this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x126'),JSON[_0x0ce5('0x6f')](_0x141d13)));}}return _0x33c031;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x127')]=function(_0x2e13a3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x128'),_0x2e13a3[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x2e13a3[_0x0ce5('0x89')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0x129'));}if(!this['isConfigured'](_0x2e13a3[_0x0ce5('0x12a')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20appsecret\x20configured');}var _0x4db3a2='wav';var _0x558d90=util['format'](_0x0ce5('0x121'),FILES_PATH,rs[_0x0ce5('0x10c')](0x4));var _0x53459e=util['format'](_0x0ce5('0x93'),_0x558d90,_0x4db3a2);var _0xcf5aad=!![];if(_0x2e13a3[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0xcf5aad=![];}var _0x53a1be=this[_0x0ce5('0xc')]['recordFile'](_0x558d90,_0x4db3a2,_0x2e13a3[_0x0ce5('0x124')],_0x2e13a3[_0x0ce5('0x62')],undefined,_0xcf5aad);if(_0x53a1be['result']!==-0x1){this['channel']['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x12b'),_0x53459e));var _0x54f9b3=this[_0x0ce5('0x12c')][_0x0ce5('0x6b')](this,_0x2e13a3,_0x53459e);if(_0x54f9b3){for(var _0x2f03da in _0x54f9b3){if(_0x54f9b3[_0x0ce5('0x8b')](_0x2f03da)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x12d'),_0x2f03da[_0x0ce5('0x66')]()),_0x54f9b3[_0x2f03da]);}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x12e'),JSON[_0x0ce5('0x6f')](_0x54f9b3)));}}return _0x53a1be;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x12f')]=function(_0x219ae0){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x130'),_0x219ae0[_0x0ce5('0x33')]));return this['channel'][_0x0ce5('0x131')](_0x219ae0[_0x0ce5('0x132')],_0x219ae0['extension'],_0x219ae0[_0x0ce5('0x3a')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x133')]=function(_0x21b66f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x134'),_0x21b66f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x21b66f[_0x0ce5('0x135')])){return this['channel'][_0x0ce5('0x2e')](_0x21b66f,_0x0ce5('0x136'));}try{var _0x39998a=eval(_0x21b66f[_0x0ce5('0x135')])?'true':_0x0ce5('0x137');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x138'),_0x21b66f[_0x0ce5('0x135')],_0x39998a));return{'code':0xc8,'result':_0x39998a};}catch(_0x6b7c2b){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x139')]=function(_0x49393c){logger['info'](util['format'](_0x0ce5('0x13a'),_0x49393c['label']));if(!this[_0x0ce5('0x7f')](_0x49393c['interval_id'])){return this['channel']['error'](_0x49393c,_0x0ce5('0x13b'));}var _0x3f1d50=this[_0x0ce5('0x13c')][_0x0ce5('0x6b')](this,_0x49393c[_0x0ce5('0x13d')]);if(!_0x3f1d50){return this[_0x0ce5('0xc')]['error'](_0x49393c,_0x0ce5('0x13e'));}for(var _0xe144f3=0x0;_0xe144f3<_0x3f1d50[_0x0ce5('0x8f')];_0xe144f3+=0x1){var _0x49ee3a=this[_0x0ce5('0xc')]['getVariable'](util[_0x0ce5('0x24')](_0x0ce5('0x13f'),_0x3f1d50[_0xe144f3]));if(_0x49ee3a[_0x0ce5('0xa3')]===-0x1){return _0x49ee3a;}logger['info'](util['format'](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x49ee3a[_0x0ce5('0x99')]));if(_0x49ee3a['extra']===_0x0ce5('0x141')){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x0ce5('0x141')));this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x0ce5('0x141')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],'false'));this['channel'][_0x0ce5('0x9f')](util['format']('IFTIME\x20%s\x20%s',_0x3f1d50[_0xe144f3],_0x0ce5('0x137')));}}return{'code':0xc8,'result':_0x0ce5('0x137')};};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x142')]=function(_0x3c64f4){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3c64f4[_0x0ce5('0x33')]));return this['channel'][_0x0ce5('0x142')]();};AGIVertices['prototype'][_0x0ce5('0x143')]=function(_0x27df07){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x27df07['label']));if(!this[_0x0ce5('0x7f')](_0x27df07[_0x0ce5('0x75')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xdc'));}var _0x48b95f='wav';var _0x134948=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,rs['generate'](0x4));var _0x59b819=util[_0x0ce5('0x24')](_0x0ce5('0x93'),_0x134948,_0x48b95f);var _0x22bdc4=!![];if(_0x27df07[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0x22bdc4=![];}var _0x30b4ec=this['channel'][_0x0ce5('0x144')](_0x134948,_0x48b95f,_0x27df07[_0x0ce5('0x124')],_0x27df07['timeout'],undefined,_0x22bdc4);if(_0x30b4ec['result']!==-0x1){this['channel']['noop'](util[_0x0ce5('0x24')]('ispeech\x20%s\x20file\x20created',_0x59b819));var _0x37757d=this[_0x0ce5('0x7d')]['sync'](this,_0x27df07,_0x59b819);if(_0x37757d){for(var _0x4746a4 in _0x37757d){if(_0x37757d[_0x0ce5('0x8b')](_0x4746a4)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x145'),_0x4746a4[_0x0ce5('0x66')]()),_0x37757d[_0x4746a4]);}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x146'),JSON['stringify'](_0x37757d)));}}return _0x30b4ec;};AGIVertices[_0x0ce5('0xf')]['ispeechtts']=function(_0xb3a608){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xb3a608[_0x0ce5('0x33')]));if(!this['isConfigured'](_0xb3a608[_0x0ce5('0x75')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20key\x20configured');}if(!this[_0x0ce5('0x7f')](_0xb3a608[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20ispeech\x20TTS\x20%s',_0xb3a608[_0x0ce5('0x58')]));var _0x4bd044=this[_0x0ce5('0x7c')][_0x0ce5('0x6b')](this,_0xb3a608);if(_0x4bd044){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x147'),_0x4bd044));var _0x4f0f8f=this['channel'][_0x0ce5('0xf1')](_0x4bd044,_0xb3a608[_0x0ce5('0x124')]);try{fs[_0x0ce5('0xf2')](_0x4bd044+_0x0ce5('0xf3'));}catch(_0x1829d9){logger[_0x0ce5('0x2e')](_0x1829d9);}return _0x4f0f8f;}return this['channel'][_0x0ce5('0x2e')](_0xb3a608,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x419786){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x148'),_0x419786['label']));if(!this[_0x0ce5('0x7f')](_0x419786[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x419786,_0x0ce5('0x14a'));}logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this['channel'][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));var _0x2575df=this[_0x0ce5('0x51')][_0x0ce5('0x6b')](this,_0x419786['findBy']);if(_0x2575df){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x14c'),this['channel'][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')]['callerid'],_0x419786[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x150')]=function(_0x19de7a){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x151'),_0x19de7a['label']));if(!this['isConfigured'](_0x19de7a[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x19de7a,_0x0ce5('0x14a'));}logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a['findBy']));var _0xd203b2=this[_0x0ce5('0x50')][_0x0ce5('0x6b')](this,_0x19de7a[_0x0ce5('0x149')]);if(_0xd203b2){logger['info'](util['format'](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0ce5('0x36')],_0x19de7a['findBy']));this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x152')]=function(_0x563a96){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x153'),_0x563a96[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x563a96[_0x0ce5('0x154')])){return this['channel']['error'](_0x563a96,_0x0ce5('0x155'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x156'),_0x563a96[_0x0ce5('0x154')]));var _0x10569f=eval(_0x563a96[_0x0ce5('0x154')]);if(!this[_0x0ce5('0x7f')](_0x563a96[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xcf'));}var _0x2a2f2d=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x563a96[_0x0ce5('0xd0')]);if(!_0x2a2f2d){return this[_0x0ce5('0xc')]['error'](_0x563a96,_0x0ce5('0x108'));}if(_[_0x0ce5('0x92')](_0x10569f)){var _0x59e312=this;_0x10569f[_0x0ce5('0xd2')](function(_0x4fc10b,_0xe176bf){_0x59e312['channel'][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x157'),_0x2a2f2d,_0xe176bf),_0x4fc10b);});return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x158'),_0x2a2f2d));}else{return this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x2a2f2d,_0x10569f);}};AGIVertices[_0x0ce5('0xf')]['menu']=function(_0x1ea651){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x159'),_0x1ea651[_0x0ce5('0x33')]));if(_0x1ea651[_0x0ce5('0x101')]===0x0){return this[_0x0ce5('0x9c')](_0x1ea651);}_0x1ea651[_0x0ce5('0x101')]-=0x1;if(!this[_0x0ce5('0x7f')](_0x1ea651[_0x0ce5('0x102')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1ea651,'no\x20file\x20audio\x20selected');}var _0xda174c=this['getSound'][_0x0ce5('0x6b')](this,_0x1ea651[_0x0ce5('0x102')]);if(!_0xda174c){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1ea651,_0x0ce5('0x104'));}var _0xde6f02=this[_0x0ce5('0xc')][_0x0ce5('0x105')](_0xda174c,_0x1ea651['response'],_0x1ea651[_0x0ce5('0x15a')]);var _0x8677f2=_0xde6f02[_0x0ce5('0xa3')];if(_0xde6f02['result']===-0x1){this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x1ea651,'-1');return _0xde6f02;}else if(_0xde6f02[_0x0ce5('0x99')]==='timeout'){_0xde6f02[_0x0ce5('0xa3')]=_0xde6f02['result'][_0x0ce5('0x8f')]>0x0?_0xde6f02[_0x0ce5('0xa3')]:'t';}else if(_[_0x0ce5('0x40')](_0xde6f02[_0x0ce5('0xa3')])){_0xde6f02['result']='#';_0x8677f2='#';}if(!this['isConfigured'](_0x1ea651[_0x0ce5('0xd0')])){this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5edde5=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x1ea651[_0x0ce5('0xd0')]);if(!_0x5edde5){return this[_0x0ce5('0xc')]['error'](_0x1ea651,'no\x20variable\x20found');}this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x5edde5,_0x8677f2);}this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x1ea651,_0x8677f2);return _0xde6f02;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9f')]=function(_0x3959a4){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x15b'),_0x3959a4[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x3959a4[_0x0ce5('0x15c')]||_0x3959a4[_0x0ce5('0x33')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x15d')]=function(_0x1948d0){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1948d0[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1948d0[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1948d0,_0x0ce5('0x14a'));}logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x1948d0['findBy']));var _0x4a939b=this[_0x0ce5('0x4b')]['sync'](this,_0x1948d0['pause_id']);var _0x2fd9f3=this[_0x0ce5('0x4d')][_0x0ce5('0x6b')](this,_0x1948d0[_0x0ce5('0x149')],_0x4a939b);if(_0x2fd9f3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')]['callerid'],_0x1948d0['findBy']));this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this['channel']['callerid'],_0x1948d0[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x1948d0[_0x0ce5('0x149')]));this['channel'][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x14c'),this[_0x0ce5('0xc')]['callerid'],_0x1948d0['findBy']));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices['prototype'][_0x0ce5('0x15e')]=function(_0x56c551){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x15f'),_0x56c551['label']));if(!this[_0x0ce5('0x7f')](_0x56c551['file_id'])){return this[_0x0ce5('0xc')]['error'](_0x56c551,_0x0ce5('0x103'));}var _0x1fe94=this['getSound'][_0x0ce5('0x6b')](this,_0x56c551[_0x0ce5('0x102')]);if(!_0x1fe94){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x56c551,_0x0ce5('0x104'));}var _0x496d5f=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0x160'),[_0x1fe94,_0x56c551[_0x0ce5('0xfc')]]);if(_0x496d5f[_0x0ce5('0xa3')]===-0x1){return _0x496d5f;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x160'),_0x1fe94));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x161')]=function(_0x4c98ec){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x162'),_0x4c98ec[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x4c98ec[_0x0ce5('0x163')])){return this[_0x0ce5('0xc')]['error'](_0x4c98ec,_0x0ce5('0x164'));}var _0x530e4d='';var _0x1d3c89=parseInt(_0x4c98ec[_0x0ce5('0x163')],0xa);if(isNaN(_0x1d3c89)){_0x530e4d=_0x4c98ec['queue_id'];}else{_0x530e4d=this['getVoiceQueue'][_0x0ce5('0x6b')](this,_0x4c98ec[_0x0ce5('0x163')]);if(!_0x530e4d){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x4c98ec,'no\x20queue\x20found');}}var _0x48c568='';if(this[_0x0ce5('0x7f')](_0x4c98ec[_0x0ce5('0x102')])){var _0x221285=this[_0x0ce5('0x1c')][_0x0ce5('0x6b')](this,_0x4c98ec[_0x0ce5('0x102')]);if(_0x221285){_0x48c568=_0x221285;}}this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x4c98ec,_0x530e4d);if(_0x4c98ec[_0x0ce5('0xfc')][_0x0ce5('0x165')]('x')<0x0){_0x4c98ec[_0x0ce5('0xfc')]+='x';}if(_0x4c98ec[_0x0ce5('0xfc')][_0x0ce5('0x165')]('X')<0x0){_0x4c98ec[_0x0ce5('0xfc')]+='X';}this['channel'][_0x0ce5('0x94')]('XMCS-QUEUE',_0x530e4d?_0x530e4d['toLowerCase']():'');var _0x46faca=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0x166'),[_0x530e4d,_0x4c98ec['opts'],_0x4c98ec['url'],_0x48c568,_0x4c98ec[_0x0ce5('0x62')],_0x4c98ec[_0x0ce5('0xae')],_0x4c98ec[_0x0ce5('0x167')],_0x4c98ec[_0x0ce5('0x168')],'',_0x4c98ec[_0x0ce5('0x169')]]);if(_0x46faca['result']===-0x1){return _0x46faca;}return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xba'),_0x0ce5('0x166'),_0x530e4d));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x16a')]=function(_0x20495c){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x16b'),_0x20495c['label']));var _0x19b3d3=_0x20495c[_0x0ce5('0x16c')]||_0x0ce5('0x120');var _0x52c540=util[_0x0ce5('0x24')](_0x0ce5('0x16d'),this[_0x0ce5('0xc')][_0x0ce5('0x32')],rs['generate'](0x5));var _0xe9c56e=util[_0x0ce5('0x24')](_0x0ce5('0x16e'),FILES_PATH,_0x52c540,_0x19b3d3);var _0x5b82da=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,_0x52c540);this[_0x0ce5('0x37')][_0x0ce5('0x6b')](this,_0x20495c,_0x52c540,_0xe9c56e);this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x0ce5('0x16f'),_0x52c540);logger[_0x0ce5('0x29')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5b82da,_0x19b3d3,_0x20495c[_0x0ce5('0x170')],_0x20495c[_0x0ce5('0x62')]);return this[_0x0ce5('0xc')][_0x0ce5('0x144')](_0x5b82da,_0x19b3d3,_0x20495c[_0x0ce5('0x170')],_0x20495c['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x0ce5('0x171')]=function(_0x1357b0){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x172'),_0x1357b0[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1357b0[_0x0ce5('0x60')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0x173'));}var _0x40906d=this[_0x0ce5('0x5f')][_0x0ce5('0x6b')](this,_0x1357b0);logger['info'](util['format'](_0x0ce5('0x174'),util['inspect'](_0x40906d,{'showHidden':![],'depth':null})));if(!this[_0x0ce5('0x7f')](_0x1357b0[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x175'));}var _0x17c195=this[_0x0ce5('0x98')]['sync'](this,_0x1357b0[_0x0ce5('0xd0')]);if(!_0x17c195){return this['channel'][_0x0ce5('0x2e')](_0x1357b0,'no\x20variable\x20found');}this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x176'),_0x17c195),_0x40906d[_0x0ce5('0x71')]?_0x40906d[_0x0ce5('0x71')]:_0x0ce5('0x177'));this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x178'),_0x17c195),_0x40906d[_0x0ce5('0x179')]?_0x40906d[_0x0ce5('0x179')]:'OK');if(_0x40906d[_0x0ce5('0x67')]){try{this['saveRestApiResult'](_0x40906d['body'],_0x17c195);}catch(_0x3a0745){logger['error'](util[_0x0ce5('0x24')](_0x0ce5('0x17a'),_0x17c195));}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x17b'),_0x17c195));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x17c')]=function(_0x374ebe){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x17d'),_0x374ebe[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x17e')](_0x374ebe[_0x0ce5('0x17f')][_0x0ce5('0x55')](/\s+/g,''),_0x374ebe[_0x0ce5('0x170')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x180')]=function(_0x5147e3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x181'),_0x5147e3[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x182')](_0x5147e3[_0x0ce5('0x63')][_0x0ce5('0x55')](/\s+/g,''),_0x5147e3[_0x0ce5('0x170')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x183')]=function(_0x1791dc){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x184'),_0x1791dc[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')]['sayPhonetic'](_0x1791dc[_0x0ce5('0x58')],_0x1791dc['escape_digits']);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x185')]=function(_0x229232){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x186'),_0x229232[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x229232[_0x0ce5('0x187')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x188'));}var _0x3a2809=this['getMailAccount']['sync'](this,_0x229232[_0x0ce5('0x187')]);if(!_0x3a2809||!_0x3a2809[_0x0ce5('0x189')]){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x229232,_0x0ce5('0x18a'));}var _0xcf2dde={'from':util[_0x0ce5('0x24')](_0x0ce5('0x18b'),_0x3a2809[_0x0ce5('0x17')],_0x3a2809[_0x0ce5('0x18c')]||_0x3a2809[_0x0ce5('0x189')][_0x0ce5('0x18d')]),'to':_0x229232['to']||'','cc':_0x229232['cc']||'','bcc':_0x229232[_0x0ce5('0x18e')]||'','subject':_0x229232[_0x0ce5('0x18f')],'html':_0x229232[_0x0ce5('0x58')],'text':_0x229232[_0x0ce5('0x58')]};if(this[_0x0ce5('0x7f')](_0x229232[_0x0ce5('0x190')])){}logger[_0x0ce5('0xd5')](_0x0ce5('0x191'),JSON[_0x0ce5('0x6f')](_0xcf2dde));this[_0x0ce5('0x9d')]['sync'](this,_0x229232,_0x229232[_0x0ce5('0x187')]);this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3a2809[_0x0ce5('0x17')]));this['sendMailMessage'][_0x0ce5('0x6b')](this,_0x3a2809[_0x0ce5('0x192')],_0xcf2dde);return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0x193'));};AGIVertices['prototype'][_0x0ce5('0x194')]=function(_0x4c3c8b){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x195'),_0x4c3c8b['label']));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x196'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x197')]=function(_0x55e3e3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x198'),_0x55e3e3[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x55e3e3[_0x0ce5('0x199')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x19a'));}var _0x4b8ed8=this[_0x0ce5('0x2f')][_0x0ce5('0x6b')](this,_0x55e3e3[_0x0ce5('0x199')]);if(!_0x4b8ed8){return this[_0x0ce5('0xc')]['error'](_0x55e3e3,'no\x20sms\x20account\x20found');}var _0x344537={'body':_0x55e3e3['sms_text'],'phone':_0x55e3e3['to']||'','SmsAccountId':_0x4b8ed8['id']};logger['debug']('sendSMS\x20message',JSON[_0x0ce5('0x6f')](_0x344537));this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x55e3e3,_0x55e3e3['sms_account_id']);this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4b8ed8['name']));this[_0x0ce5('0x31')][_0x0ce5('0x6b')](this,_0x344537);return this['channel']['noop'](_0x0ce5('0x19b'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x19c')]=function(_0x1486bd){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x19d'),_0x1486bd[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x1486bd['variable_id'])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1486bd,_0x0ce5('0x19e'));}var _0x2fbe6f=this['getVariable'][_0x0ce5('0x6b')](this,_0x1486bd[_0x0ce5('0xd0')]);if(!_0x2fbe6f){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1486bd,_0x0ce5('0x108'));}return this[_0x0ce5('0xc')]['setVariable'](_0x2fbe6f,_0x1486bd[_0x0ce5('0x19f')]);};AGIVertices[_0x0ce5('0xf')]['start']=function(_0x47009d){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1a0'),_0x47009d[_0x0ce5('0x33')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a1'));var _0x83f9fa=this[_0x0ce5('0xc')]['getVariable']('XMCS-UNIQUEID');if(!_[_0x0ce5('0x40')](_0x83f9fa['extra'])){this[_0x0ce5('0xc')][_0x0ce5('0x32')]=_0x83f9fa[_0x0ce5('0x99')];}if(_0x47009d['answer']===_0x0ce5('0x1a2')){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a3'));return this[_0x0ce5('0xc')][_0x0ce5('0xb1')]();}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a4'));};AGIVertices['prototype'][_0x0ce5('0x1a5')]=function(_0x2513ca){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x1a6'),_0x2513ca[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x2513ca[_0x0ce5('0x1a7')])){return this[_0x0ce5('0xc')]['error'](_0x2513ca,_0x0ce5('0x1a8'));}var _0x31748a=this['getSquareProject'][_0x0ce5('0x6b')](this,_0x2513ca[_0x0ce5('0x1a7')]);if(!this[_0x0ce5('0x7f')](_0x31748a)){return this['channel'][_0x0ce5('0x2e')](_0x2513ca,util['format'](_0x0ce5('0x1a9'),_0x2513ca[_0x0ce5('0x1a7')]));}if(_0x31748a===this[_0x0ce5('0xc')][_0x0ce5('0x35')]){return this[_0x0ce5('0xc')]['error'](_0x2513ca,_0x0ce5('0x1aa'));}this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x2513ca,_0x31748a);var _0x5c2d91=this['channel'][_0x0ce5('0xa1')](_0x0ce5('0x1ab'),util['format'](_0x0ce5('0x1ac'),config[_0x0ce5('0xae')][_0x0ce5('0x1ad')]||_0x0ce5('0x1ae'),_0x31748a,this[_0x0ce5('0xc')][_0x0ce5('0x35')]));if(_0x5c2d91['result']===-0x1){return _0x5c2d91;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x1ab'),_0x31748a));};AGIVertices[_0x0ce5('0xf')]['system']=function(_0x52ef76){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1af'),_0x52ef76['label']));var _0x1f4847=this[_0x0ce5('0x1b0')][_0x0ce5('0x6b')](this,_0x52ef76[_0x0ce5('0x1b1')]);this['createSquareDetailsReport']['sync'](this,_0x52ef76,_0x52ef76[_0x0ce5('0x1b1')]);if(this[_0x0ce5('0x7f')](_0x52ef76[_0x0ce5('0xd0')])){var _0x110389=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x52ef76['variable_id']);if(_0x110389){this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x110389,_0x1f4847);return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1b2'),_0x52ef76[_0x0ce5('0x1b1')],_0x110389));}}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0x1b3'),_0x52ef76[_0x0ce5('0x1b1')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1b4')]=function(_0x50e804){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1b5'),_0x50e804[_0x0ce5('0x33')]));_0x50e804[_0x0ce5('0x58')]=_0x50e804[_0x0ce5('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0ce5('0x7f')](_0x50e804[_0x0ce5('0x57')])){return this[_0x0ce5('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x0ce5('0x7f')](_0x50e804[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1b6'),_0x50e804[_0x0ce5('0x58')]));var _0x3d7277=this[_0x0ce5('0x56')][_0x0ce5('0x6b')](this,_0x50e804);if(_0x3d7277){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3d7277));var _0x104797=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x3d7277);try{fs['unlink'](_0x3d7277+_0x0ce5('0xf3'));}catch(_0x3d6758){logger[_0x0ce5('0x2e')](_0x3d6758);}return _0x104797;}return this['channel'][_0x0ce5('0x2e')](_0x50e804,_0x0ce5('0x1b7'));};AGIVertices[_0x0ce5('0xf')]['tts']=function(_0x2e989d){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1b8'),_0x2e989d[_0x0ce5('0x33')]));_0x2e989d[_0x0ce5('0x58')]=_0x2e989d[_0x0ce5('0x58')][_0x0ce5('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0ce5('0x7f')](_0x2e989d[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x1b9'),_0x2e989d[_0x0ce5('0x58')]));var _0x2cb07d=this[_0x0ce5('0x5d')][_0x0ce5('0x6b')](this,_0x2e989d);if(_0x2cb07d){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1ba'),_0x2cb07d));var _0x230bd4=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x2cb07d);try{fs[_0x0ce5('0xf2')](_0x2cb07d+_0x0ce5('0xf3'));}catch(_0x4902b5){logger[_0x0ce5('0x2e')](_0x4902b5);}return _0x230bd4;}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x2e989d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x0ce5('0x1bb')]=function(_0x35a4c7){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x1bc'),_0x35a4c7['label']));if(!this[_0x0ce5('0x7f')](_0x35a4c7[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')]['error'](_0x35a4c7,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));var _0x1ae785=this[_0x0ce5('0x4f')]['sync'](this,_0x35a4c7[_0x0ce5('0x149')]);if(_0x1ae785){logger[_0x0ce5('0x29')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7['findBy']));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7['findBy']));this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0ce5('0xf')]['voicemail']=function(_0x496111){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x1bd'),_0x496111[_0x0ce5('0x33')]));var _0x3cbe27=this[_0x0ce5('0xc')]['exec'](_0x0ce5('0x1be'),[_0x496111[_0x0ce5('0x1bf')],_0x496111[_0x0ce5('0x73')]]);if(_0x3cbe27[_0x0ce5('0xa3')]===-0x1){return _0x3cbe27;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x1be'),_0x496111[_0x0ce5('0x1bf')]));};AGIVertices[_0x0ce5('0xf')]['vswitch']=function(_0x12e37){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x1c0'),_0x12e37[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x12e37[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x12e37,_0x0ce5('0x19e'));}var _0x581b21=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x12e37[_0x0ce5('0xd0')]);if(!_0x581b21){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x12e37,_0x0ce5('0x108'));}var _0x41dd65=this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x581b21);return{'code':0xc8,'result':_0x41dd65[_0x0ce5('0x99')]?_0x41dd65['extra']:'-'};};String[_0x0ce5('0xf')][_0x0ce5('0x97')]=function(_0x37f4ad,_0x448cbe){return this[_0x0ce5('0x96')](_0x37f4ad)['join'](_0x448cbe);};module[_0x0ce5('0x1c1')]=AGIVertices; \ No newline at end of file +var _0x4944=['failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','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','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','util','shelljs','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareOdbc','dsn','getUser','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','callback_','isEmpty','lastName','isNil','phone','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','text','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','replaceAllVariables','replaceAll','getVariable','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','scheduledAt','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20variable\x20selected\x20for\x20the\x20result','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY'];(function(_0x1dadad,_0x459788){var _0x17d58d=function(_0x622d35){while(--_0x622d35){_0x1dadad['push'](_0x1dadad['shift']());}};_0x17d58d(++_0x459788);}(_0x4944,0x6d));var _0x4494=function(_0x4d6cde,_0x68644c){_0x4d6cde=_0x4d6cde-0x0;var _0x17f4f3=_0x4944[_0x4d6cde];return _0x17f4f3;};'use strict';var fs=require('fs');var util=require(_0x4494('0x0'));var _=require('lodash');var sh=require(_0x4494('0x1'));var odbc=require(_0x4494('0x2'))();var rs=require(_0x4494('0x3'));var moment=require(_0x4494('0x4'));var Mustache=require(_0x4494('0x5'));var rp=require('request-promise');var logger=require(_0x4494('0x6'))('agi');var config=require(_0x4494('0x7'));var scripts=require(_0x4494('0x8'));var FILES_PATH=_0x4494('0x9');var recursiveMapAttributes=[_0x4494('0xa'),_0x4494('0xb')];var verticesWithRetry=[_0x4494('0xc'),_0x4494('0xd'),_0x4494('0xe')];var AGIVertices=function(_0x21098c,_0x5b14d5,_0x1b6476){this[_0x4494('0xf')]=_0x21098c;this[_0x4494('0x10')]=_0x5b14d5;this[_0x4494('0x11')]=_0x1b6476;};AGIVertices['prototype']['getVariable']=function(_0x461714,_0x3b1a11){this[_0x4494('0x10')]['getVariableById'](_0x461714)['then'](function(_0x3108b2){_0x3b1a11(null,_0x3108b2?_0x3108b2[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x1c9750){_0x3b1a11(_0x1c9750);});};AGIVertices[_0x4494('0x14')][_0x4494('0x15')]=function(_0x50b102,_0x34959d){this[_0x4494('0x10')][_0x4494('0x16')](_0x50b102)[_0x4494('0x17')](function(_0x9e92d0){_0x34959d(null,_0x9e92d0?_0x9e92d0[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x53fed5){_0x34959d(_0x53fed5);});};AGIVertices[_0x4494('0x14')]['getSquareProject']=function(_0x5570a4,_0x1a93bc){this[_0x4494('0x10')]['getSquareProjectById'](_0x5570a4)['then'](function(_0xcbe5a4){_0x1a93bc(null,_0xcbe5a4?_0xcbe5a4['name']:![]);})[_0x4494('0x13')](function(_0x42880b){_0x1a93bc(_0x42880b);});};AGIVertices['prototype'][_0x4494('0x18')]=function(_0x5e5806,_0x37d435){this[_0x4494('0x10')]['getSquareOdbcById'](_0x5e5806)['then'](function(_0x434e43){_0x37d435(null,_0x434e43?_0x434e43[_0x4494('0x19')]:![]);})[_0x4494('0x13')](function(_0x15d9d1){_0x37d435(_0x15d9d1);});};AGIVertices[_0x4494('0x14')][_0x4494('0x1a')]=function(_0x2c1b76,_0xae958d){this['rpc']['getUserById'](_0x2c1b76)['then'](function(_0x4d80c5){_0xae958d(null,_0x4d80c5?_0x4d80c5[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x1b3630){_0xae958d(_0x1b3630);});};AGIVertices[_0x4494('0x14')]['getTrunk']=function(_0x10f7fe,_0xdd08b8){this['rpc'][_0x4494('0x1b')](_0x10f7fe)[_0x4494('0x17')](function(_0x87d98){_0xdd08b8(null,_0x87d98?_0x87d98['name']:![]);})[_0x4494('0x13')](function(_0x5926fc){_0xdd08b8(_0x5926fc);});};AGIVertices[_0x4494('0x14')]['getSound']=function(_0x29e625,_0x2fcc43){var _0xce3c8d=this;this['rpc'][_0x4494('0x1c')](_0x29e625)[_0x4494('0x17')](function(_0x491027){_0x2fcc43(null,_0x491027?_0xce3c8d[_0x4494('0x1d')](_0x491027[_0x4494('0x1e')]):![]);})[_0x4494('0x13')](function(_0x57c34f){_0x2fcc43(_0x57c34f);});};AGIVertices[_0x4494('0x14')][_0x4494('0x1f')]=function(_0x1273d7,_0x19f483){this[_0x4494('0x10')][_0x4494('0x20')](_0x1273d7)[_0x4494('0x17')](function(_0xcce4da){_0x19f483(null,_0xcce4da?_0xcce4da:![]);})['catch'](function(_0x1d47f6){_0x19f483(_0x1d47f6);});};AGIVertices[_0x4494('0x14')][_0x4494('0x21')]=function(_0x5d90e0,_0x209fe8,_0x1c93f0){this[_0x4494('0x11')][_0x4494('0x21')](_0x5d90e0,_0x209fe8)[_0x4494('0x17')](function(){_0x1c93f0(null);})[_0x4494('0x13')](function(_0x279631){_0x1c93f0(_0x279631);});};AGIVertices['prototype'][_0x4494('0x22')]=function(_0x1c6ff8,_0x2f4740){this[_0x4494('0x10')][_0x4494('0x23')](_0x1c6ff8)[_0x4494('0x17')](function(_0x5bba31){if(_0x5bba31){if(_0x5bba31[_0x4494('0x24')]){_0x2f4740(null,[_0x5bba31[_0x4494('0x25')]]);}else{_0x2f4740(null,_[_0x4494('0x26')](_0x5bba31[_0x4494('0x27')],_0x4494('0x25')));}}else{_0x2f4740(null,![]);}})['catch'](function(_0x11f55d){_0x2f4740(_0x11f55d);});};AGIVertices[_0x4494('0x14')]['getSoundPath']=function(_0x3660ea){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x3660ea);};AGIVertices['prototype'][_0x4494('0x28')]=function(_0x250a0b,_0x322748,_0x546133){odbc['open'](_0x250a0b,function(_0x28480a){if(_0x28480a){logger[_0x4494('0x29')](_0x4494('0x2a'),_0x28480a);_0x546133(_0x28480a);}else{logger[_0x4494('0x2b')](_0x4494('0x2c'));odbc[_0x4494('0x2d')](_0x322748,function(_0x9c1605,_0x45e88f){if(_0x9c1605){logger[_0x4494('0x2b')](_0x4494('0x2e'),_0x322748);_0x546133(_0x9c1605);}else{logger[_0x4494('0x2b')](_0x4494('0x2f'),_0x322748);odbc[_0x4494('0x30')](function(_0x4a8dc1){if(_0x4a8dc1){logger[_0x4494('0x29')](_0x4494('0x31'),_0x4a8dc1);}_0x546133(null,_0x45e88f);});}});}});};AGIVertices[_0x4494('0x14')][_0x4494('0x32')]=function(_0x20b267,_0x3cd671){this[_0x4494('0x10')][_0x4494('0x33')](_0x20b267)[_0x4494('0x17')](function(_0x47f55c){_0x3cd671(null,_0x47f55c?_0x47f55c:![]);})['catch'](function(_0x1620f6){_0x3cd671(_0x1620f6);});};AGIVertices['prototype'][_0x4494('0x34')]=function(_0x2df148,_0x28cb6c){this[_0x4494('0x10')][_0x4494('0x34')](_0x2df148)['then'](function(_0x4e9bac){_0x28cb6c(null,_0x4e9bac);})[_0x4494('0x13')](function(_0x579bb8){_0x28cb6c(_0x579bb8);});};AGIVertices[_0x4494('0x14')][_0x4494('0x35')]=function(_0x124d0a,_0x2d10f4,_0x2dd0e9){this[_0x4494('0x10')][_0x4494('0x35')]({'uniqueid':this['channel'][_0x4494('0x36')],'node':_0x124d0a[_0x4494('0x37')],'application':_0x124d0a['agicommand'],'data':_0x2d10f4||null,'project_name':this[_0x4494('0xf')][_0x4494('0x38')],'callerid':this[_0x4494('0xf')]['callerid']})[_0x4494('0x17')](function(_0x3f19b9){if(_0x2dd0e9){_0x2dd0e9(null,_0x3f19b9);}})[_0x4494('0x13')](function(_0x465f5e){if(_0x2dd0e9){_0x2dd0e9(_0x465f5e);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x392d96,_0x3b9995,_0xa057a3,_0x4c755d){this['rpc'][_0x4494('0x39')]({'uniqueid':this[_0x4494('0xf')][_0x4494('0x36')],'callerid':this['channel'][_0x4494('0x3a')],'calleridname':this[_0x4494('0xf')]['calleridname'],'context':this[_0x4494('0xf')][_0x4494('0x3b')],'extension':this[_0x4494('0xf')][_0x4494('0x3c')],'priority':this[_0x4494('0xf')]['priority'],'accountcode':this[_0x4494('0xf')][_0x4494('0x3d')],'dnid':this[_0x4494('0xf')][_0x4494('0x3e')],'projectName':this[_0x4494('0xf')][_0x4494('0x38')],'saveName':_0x3b9995,'filename':_0x392d96[_0x4494('0x3f')]||_0x3b9995,'savePath':_0xa057a3})[_0x4494('0x17')](function(_0x102010){_0x4c755d(null,_0x102010);})[_0x4494('0x13')](function(_0x4a2d84){_0x4c755d(_0x4a2d84);});};AGIVertices[_0x4494('0x14')]['createSquareMessage']=function(_0x1227e4,_0x3d90bc,_0x702ab7,_0x35071a,_0x473b00){this['rpc'][_0x4494('0x40')]({'uniqueid':this['channel']['uniqueid'],'body':_0x1227e4,'direction':_0x3d90bc,'providerName':_0x702ab7,'providerResponse':_0x35071a})['then'](function(_0x5bcbfb){if(_0x473b00){_0x473b00(null,_0x5bcbfb);}})['catch'](function(_0x2d3ec9){if(_0x473b00){_0x473b00(_0x2d3ec9);}});};AGIVertices[_0x4494('0x14')][_0x4494('0x41')]=function(_0x3ffea6,_0x1b76a4){this[_0x4494('0x10')][_0x4494('0x41')]({'firstName':_['isEmpty'](_0x3ffea6['name'])||_['isNil'](_0x3ffea6[_0x4494('0x12')])?_0x4494('0x42')+Math['random']():_0x3ffea6[_0x4494('0x12')],'lastName':_[_0x4494('0x43')](_0x3ffea6[_0x4494('0x44')])||_[_0x4494('0x45')](_0x3ffea6[_0x4494('0x44')])?null:_0x3ffea6['lastName'],'phone':_0x3ffea6[_0x4494('0x46')],'ListId':_0x3ffea6['list_id'],'scheduledat':_0x3ffea6['scheduledAt'],'callbackUniqueid':this[_0x4494('0xf')]['uniqueid'],'tags':_0x4494('0x47'),'description':_0x4494('0x48')+_0x3ffea6['scheduledAt']['toString'](),'priority':_0x3ffea6[_0x4494('0x49')]})[_0x4494('0x17')](function(_0xc32e50){_0x1b76a4(null,_0xc32e50);})['catch'](function(_0x2ea074){_0x1b76a4(_0x2ea074);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4a')]=function(_0xfbb520,_0x282b45){this[_0x4494('0x10')]['getPauseById'](_0xfbb520)['then'](function(_0x5dc638){_0x282b45(null,_0x5dc638?_0x5dc638['name']:![]);})[_0x4494('0x13')](function(_0x3aff06){_0x282b45(_0x3aff06);});};AGIVertices[_0x4494('0x14')]['agentPause']=function(_0x4dd3af,_0x1e1ab4,_0x43bfba){var _0x4766dd={'role':_0x4494('0x4b')};_0x4766dd[_0x4dd3af]=this[_0x4494('0xf')][_0x4494('0x3a')];this[_0x4494('0x10')]['agentPause'](_0x4766dd,_0x1e1ab4,this[_0x4494('0xf')][_0x4494('0x36')])['then'](function(_0x414655){_0x43bfba(null,_[_0x4494('0x45')](_0x414655)?![]:!![]);})[_0x4494('0x13')](function(_0x470236){logger[_0x4494('0x29')](_0x470236);_0x43bfba(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4c')]=function(_0x43583a,_0x3a7d93){var _0x567269={'role':_0x4494('0x4b')};_0x567269[_0x43583a]=this['channel']['callerid'];this[_0x4494('0x10')][_0x4494('0x4c')](_0x567269)['then'](function(_0xc7e69a){_0x3a7d93(null,_[_0x4494('0x45')](_0xc7e69a)?![]:!![]);})[_0x4494('0x13')](function(_0x2a303a){logger[_0x4494('0x29')](_0x2a303a);_0x3a7d93(null,![]);});};AGIVertices['prototype'][_0x4494('0x4d')]=function(_0x266fdd,_0x33d976){var _0x299b8c={'role':_0x4494('0x4b')};_0x299b8c[_0x266fdd]=this[_0x4494('0xf')]['callerid'];this['rpc'][_0x4494('0x4d')](_0x299b8c)[_0x4494('0x17')](function(_0x3f62f4){_0x33d976(null,_[_0x4494('0x45')](_0x3f62f4)?![]:!![]);})[_0x4494('0x13')](function(_0x2f3e39){logger[_0x4494('0x29')](_0x2f3e39);_0x33d976(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4e')]=function(_0x11aba8,_0x508128){var _0x5562a3={'role':'agent'};_0x5562a3[_0x11aba8]=this[_0x4494('0xf')][_0x4494('0x3a')];var _0x5b7a0a=_0x11aba8!=_0x4494('0x4f')?util[_0x4494('0x50')](_0x4494('0x51'),_0x4494('0x52'),this[_0x4494('0xf')][_0x4494('0x3a')]):undefined;this[_0x4494('0x10')]['agentLogin'](_0x5562a3,_0x5b7a0a)[_0x4494('0x17')](function(_0x15a2c3){_0x508128(null,_[_0x4494('0x45')](_0x15a2c3)?![]:!![]);})[_0x4494('0x13')](function(_0x178f3e){logger[_0x4494('0x29')](_0x178f3e);_0x508128(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x53')]=function(_0x51d709,_0xff46f3){sh['exec'](_['trim'](_0x51d709),function(_0x7654c6,_0x36714f){var _0x4c90e0=_0x36714f['replace'](/(\r\n|\n|\r)/gm,'');_0xff46f3(null,_0x4c90e0);});};AGIVertices[_0x4494('0x14')][_0x4494('0x54')]=function(_0x4f6387,_0x1a6c03){scripts[_0x4494('0x54')](_0x4f6387[_0x4494('0x55')],_0x4f6387['google_cloud_tts_text_type']||'text',_0x4f6387['text'],_0x4f6387[_0x4494('0x56')]||_0x4494('0x57'),_0x4f6387[_0x4494('0x58')]||_0x4494('0x59'),_0x4f6387[_0x4494('0x5a')]||'MP3')[_0x4494('0x17')](function(_0x5c1473){_0x1a6c03(null,_0x5c1473);})['catch'](function(_0x23cd7e){_0x1a6c03(_0x23cd7e);});};AGIVertices['prototype'][_0x4494('0x5b')]=function(_0x4c8b25,_0x5fc7d9){scripts['googleTTS'](_0x4c8b25['text'],_0x4c8b25['google_tts_language']||'en',0x1)['then'](function(_0x1be3af){_0x5fc7d9(null,_0x1be3af);})[_0x4494('0x13')](function(_0x161735){_0x5fc7d9(_0x161735);});};AGIVertices[_0x4494('0x14')][_0x4494('0x5c')]=function(_0x19daf1,_0x6131f6){var _0x46ec48={'uri':_0x19daf1[_0x4494('0x5d')],'method':_0x19daf1[_0x4494('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x19daf1['timeout'])==='number'&&parseInt(_0x19daf1['timeout'])>=0x1?parseInt(_0x19daf1[_0x4494('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x4494('0x60')]([_0x4494('0x61'),'PUT'],_0x46ec48[_0x4494('0x5e')][_0x4494('0x62')]())){try{_0x46ec48[_0x4494('0x63')]=_0x19daf1[_0x4494('0xb')]?JSON[_0x4494('0x64')](_0x19daf1['rawBody']):{};}catch(_0x37d4f7){logger[_0x4494('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x37d4f7);}}try{_0x46ec48['headers']=_0x19daf1['rawHeaders']?JSON['parse'](_0x19daf1['rawHeaders']):{};}catch(_0x56594d){logger[_0x4494('0x29')](_0x4494('0x65'),_0x56594d);}if(_0x19daf1[_0x4494('0x66')]){try{var _0x25dc58=require(_0x19daf1[_0x4494('0x66')])[_0x4494('0x67')](this,_0x46ec48);_0x46ec48[_0x4494('0x68')]=Mustache['render'](_0x19daf1[_0x4494('0x5d')],_0x25dc58,{},['$$','$$']);if(_0x46ec48['headers']){_0x46ec48[_0x4494('0x69')]=JSON[_0x4494('0x64')](Mustache[_0x4494('0x6a')](JSON[_0x4494('0x6b')](_0x46ec48[_0x4494('0x69')]),_0x25dc58,{},['$$','$$']));}if(_0x46ec48['body']){_0x46ec48[_0x4494('0x63')]=JSON[_0x4494('0x64')](Mustache['render'](JSON['stringify'](_0x46ec48[_0x4494('0x63')]),_0x25dc58,{},['$$','$$']));}}catch(_0xe0e497){logger[_0x4494('0x29')](_0x4494('0x6c'),_0xe0e497);}}rp(_0x46ec48)[_0x4494('0x17')](function(_0xcc8382){var _0x3957ff={'statusCode':_0xcc8382[_0x4494('0x6d')]||0xc8,'statusMessage':_0xcc8382[_0x4494('0x6e')]||'OK','headers':_0xcc8382['headers']||{},'body':_0xcc8382[_0x4494('0x63')]||{}};_0x6131f6(null,_0x3957ff);})['catch'](function(_0x344817){var _0x9a945={'statusCode':_0x344817[_0x4494('0x6d')]||0x1f4,'statusMessage':_0x344817['message']||_0x4494('0x6f'),'headers':_0x344817['options'][_0x4494('0x69')]||{},'body':_0x344817[_0x4494('0x70')][_0x4494('0x63')]||{}};_0x6131f6(null,_0x9a945);});};AGIVertices[_0x4494('0x14')][_0x4494('0x71')]=function(_0x45b340,_0x4875ee){scripts[_0x4494('0x71')](this[_0x4494('0xf')]['uniqueid'],_0x45b340[_0x4494('0x72')],_0x45b340['text'],_0x45b340[_0x4494('0x73')]||'en')[_0x4494('0x17')](function(_0x33e790){_0x4875ee(null,_0x33e790);})[_0x4494('0x13')](function(_0x4ace35){_0x4875ee(_0x4ace35);});};AGIVertices[_0x4494('0x14')]['googleDialogflowV2']=function(_0x360c65,_0x1aa889){scripts[_0x4494('0x74')](this[_0x4494('0xf')][_0x4494('0x36')],_0x360c65['dialogflowV2_project_id'],_0x360c65['client_email'],_0x360c65[_0x4494('0x75')],_0x360c65[_0x4494('0x76')],_0x360c65['dialogflowV2_language']||'en')[_0x4494('0x17')](function(_0x29dfc3){_0x1aa889(null,_0x29dfc3);})[_0x4494('0x13')](function(_0x56fa0a){_0x1aa889(_0x56fa0a);});};AGIVertices[_0x4494('0x14')][_0x4494('0x77')]=function(_0x356ef6,_0x371cbd){scripts[_0x4494('0x77')](this['channel'],_0x356ef6)[_0x4494('0x17')](function(_0x47677d){_0x371cbd(null,_0x47677d);})[_0x4494('0x13')](function(_0x4a84e7){_0x371cbd(_0x4a84e7);});};AGIVertices['prototype'][_0x4494('0x78')]=function(_0x15c2d3,_0x2aa96c){scripts['ispeechTTS'](_0x15c2d3[_0x4494('0x72')],_0x15c2d3['text'],_0x15c2d3[_0x4494('0x79')]||_0x4494('0x57'),_0x15c2d3[_0x4494('0x7a')])[_0x4494('0x17')](function(_0x47547a){_0x2aa96c(null,_0x47547a);})[_0x4494('0x13')](function(_0x6aaf4c){_0x2aa96c(_0x6aaf4c);});};AGIVertices[_0x4494('0x14')][_0x4494('0x7b')]=function(_0xdf2114,_0x1083ea,_0x4f3b27){scripts[_0x4494('0x7b')](_0x1083ea,_0xdf2114[_0x4494('0x72')],_0xdf2114[_0x4494('0x7c')]||_0x4494('0x57'),this[_0x4494('0x7d')](_0xdf2114[_0x4494('0x7e')])?_0xdf2114[_0x4494('0x7e')]:undefined)[_0x4494('0x17')](function(_0x201cce){_0x4f3b27(null,_0x201cce);})['catch'](function(_0x5f589c){_0x4f3b27(_0x5f589c);});};AGIVertices[_0x4494('0x14')][_0x4494('0x7f')]=function(_0x1b5347,_0x32c5e7){scripts[_0x4494('0x7f')](_0x1b5347[_0x4494('0x80')],_0x1b5347[_0x4494('0x81')],_0x1b5347[_0x4494('0x82')],_0x1b5347[_0x4494('0x83')]||_0x4494('0x84'),_0x1b5347[_0x4494('0x76')],_0x1b5347[_0x4494('0x85')]||_0x4494('0x76'))[_0x4494('0x17')](function(_0x88cf8){_0x32c5e7(null,_0x88cf8);})[_0x4494('0x13')](function(_0x599c3e){_0x32c5e7(_0x599c3e);});};AGIVertices['prototype'][_0x4494('0x86')]=function(_0x219604,_0x471f5d){scripts['awsLex'](this[_0x4494('0xf')][_0x4494('0x36')],_0x219604['aws_access_key_id'],_0x219604[_0x4494('0x81')],_0x219604[_0x4494('0x87')],_0x219604[_0x4494('0x76')],_0x219604[_0x4494('0x88')])['then'](function(_0x31105a){_0x471f5d(null,_0x31105a);})[_0x4494('0x13')](function(_0x4fdaa6){_0x471f5d(_0x4fdaa6);});};AGIVertices[_0x4494('0x14')][_0x4494('0x89')]=function(_0x26ea75,_0x20dbdd,_0x56dc2b){scripts[_0x4494('0x89')](_0x20dbdd,_0x26ea75[_0x4494('0x72')],_0x26ea75[_0x4494('0x8a')]||_0x4494('0x57'))['then'](function(_0x80091b){_0x56dc2b(null,_0x80091b);})[_0x4494('0x13')](function(_0x19584b){_0x56dc2b(_0x19584b);});};AGIVertices[_0x4494('0x14')][_0x4494('0x8b')]=function(_0x3b8fed,_0x51c4c6,_0x2dfed2){scripts[_0x4494('0x8b')](_0x51c4c6,_0x3b8fed[_0x4494('0x8c')],_0x3b8fed[_0x4494('0x8d')],_0x3b8fed['uri'])[_0x4494('0x17')](function(_0x2dceeb){_0x2dfed2(null,_0x2dceeb);})[_0x4494('0x13')](function(_0x15baf1){_0x2dfed2(_0x15baf1);});};AGIVertices[_0x4494('0x14')][_0x4494('0x8e')]=function(_0x1b0f9d){var _0x4e6ab0=_[_0x4494('0x60')](verticesWithRetry,_0x1b0f9d['agicommand'])?_0x1b0f9d:_[_0x4494('0x8f')](_0x1b0f9d);for(var _0x5b073b in _0x4e6ab0){if(_0x4e6ab0['hasOwnProperty'](_0x5b073b)){if(_0x4e6ab0[_0x5b073b]&&_[_0x4494('0x90')](_0x4e6ab0[_0x5b073b])){if(_[_0x4494('0x60')](recursiveMapAttributes,_0x5b073b)){_0x4e6ab0[_0x5b073b]=this['replaceObjectAllVariables'](_0x4e6ab0[_0x5b073b]);}else{_0x4e6ab0[_0x5b073b]=this['replaceAllVariables'](_0x4e6ab0[_0x5b073b]);}}}}return _0x4e6ab0;};AGIVertices[_0x4494('0x14')][_0x4494('0x91')]=function(_0x6be397){for(var _0x4c5cee in _0x6be397){if(_0x6be397[_0x4494('0x92')](_0x4c5cee)){if(_[_0x4494('0x93')](_0x6be397[_0x4c5cee])){this[_0x4494('0x91')](_0x6be397[_0x4c5cee]);}else if(_[_0x4494('0x94')](_0x6be397[_0x4c5cee])){for(var _0xcfdb17=0x0;_0xcfdb17<_0x6be397[_0x4c5cee]['length'];_0xcfdb17++){this[_0x4494('0x91')](_0x6be397[_0x4c5cee][_0xcfdb17]);}}else if(_[_0x4494('0x90')](_0x6be397[_0x4c5cee])){_0x6be397[_0x4c5cee]=this['replaceAllVariables'](_0x6be397[_0x4c5cee]);}}}};AGIVertices[_0x4494('0x14')][_0x4494('0x95')]=function(_0x1d4b7f,_0x2abf92){for(var _0x189183 in _0x1d4b7f){if(_0x1d4b7f['hasOwnProperty'](_0x189183)){if(_[_0x4494('0x93')](_0x1d4b7f[_0x189183])){if(!_['isEmpty'](_0x1d4b7f[_0x189183])){this[_0x4494('0x95')](_0x1d4b7f[_0x189183],util[_0x4494('0x50')](_0x4494('0x96'),_0x2abf92,_0x189183));}}else if(_['isArray'](_0x1d4b7f[_0x189183])){for(var _0x4de911=0x0;_0x4de911<_0x1d4b7f[_0x189183][_0x4494('0x97')];_0x4de911++){this['saveRestApiResult'](_0x1d4b7f[_0x189183][_0x4de911],util[_0x4494('0x50')](_0x4494('0x96'),_0x2abf92,_0x189183+'['+_0x4de911+']'));}}else{if(!_['isNil'](_0x1d4b7f[_0x189183])){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s.%s',_0x2abf92,_0x189183),_0x1d4b7f[_0x189183]);}}}}};AGIVertices[_0x4494('0x14')][_0x4494('0x99')]=function(_0x302712){try{var _0x183bb2=JSON[_0x4494('0x64')](_0x302712);this['recursiveNodeIndex'](_0x183bb2);return JSON[_0x4494('0x6b')](_0x183bb2);}catch(_0x20b1b8){return this[_0x4494('0x9a')](_0x302712);}};AGIVertices[_0x4494('0x14')][_0x4494('0x9a')]=function(_0x5eb3da){var _0xa78aaf=_0x5eb3da['split']('{');for(var _0xb91080=0x1;_0xb91080<_0xa78aaf[_0x4494('0x97')];_0xb91080+=0x1){var _0x54d6a2=_0xa78aaf[_0xb91080]['split']('}');if(_0x54d6a2[_0x4494('0x97')]>0x1){_0x5eb3da=_0x5eb3da[_0x4494('0x9b')]('{'+_0x54d6a2[0x0]+'}',this['channel'][_0x4494('0x9c')](_0x54d6a2[0x0])[_0x4494('0x9d')]||_0x54d6a2[0x0]);}}if(_0xa78aaf[_0x4494('0x97')]===0x1){return _0x5eb3da[_0x4494('0x9e')]();}return this[_0x4494('0x9a')](_0x5eb3da);};AGIVertices[_0x4494('0x14')]['getAndSetVariable']=function(_0xab98b8,_0x3ccceb){var _0x1db7b8=this[_0x4494('0xf')][_0x4494('0x9c')](_0xab98b8);if(_0x1db7b8[_0x4494('0x9f')]===-0x1){return _0x1db7b8;}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xa0'),_0x3ccceb,_0x1db7b8[_0x4494('0x9d')]));return this['channel'][_0x4494('0x98')](_0x3ccceb,_0x1db7b8[_0x4494('0x9d')]);};AGIVertices[_0x4494('0x14')][_0x4494('0x7d')]=function(_0x14e312){return _0x14e312&&_0x14e312!=='0'&&_0x14e312!=='-1'&&_0x14e312!=='';};AGIVertices[_0x4494('0x14')][_0x4494('0xa1')]=function(_0x2348c7){this[_0x4494('0x35')]['sync'](this,_0x2348c7,'-');_0x2348c7['retry']=_0x2348c7[_0x4494('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4494('0x14')][_0x4494('0xa2')]=function(_0x53e6e4){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xa3'),_0x53e6e4[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x53e6e4['text'])){return this['channel'][_0x4494('0xa4')]('no\x20text\x20configured');}var _0x1db2a3='\x22'+_0x53e6e4['text']+'\x22';if(this[_0x4494('0x7d')](_0x53e6e4['options'])){_0x1db2a3+=','+_0x53e6e4[_0x4494('0x70')];}var _0x2575be=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xa6'),_0x1db2a3);if(_0x2575be['result']===-0x1){return _0x2575be;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xa7'),_0x1db2a3));};AGIVertices[_0x4494('0x14')][_0x4494('0xa8')]=function(_0x33d536){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x33d536[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x33d536[_0x4494('0xa9')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20grammar\x20configured');}var _0x2d0201=_0x33d536[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x33d536[_0x4494('0x70')])){_0x2d0201+=','+_0x33d536[_0x4494('0x70')];}var _0x44a545=this[_0x4494('0xf')][_0x4494('0xa5')]('MRCPRecog',_0x2d0201);if(_0x44a545[_0x4494('0x9f')]===-0x1){return _0x44a545;}var _0x2a90fa=this['getAndSetVariable'](_0x4494('0xaa'),_0x4494('0xab'));if(_0x2a90fa[_0x4494('0x9f')]===-0x1){return _0x2a90fa;}var _0x59cc45=this[_0x4494('0xac')](_0x4494('0xad'),_0x4494('0xae'));if(_0x59cc45['result']===-0x1){return _0x59cc45;}var _0xb1acfb=this['getAndSetVariable'](_0x4494('0xaf'),_0x4494('0xb0'));if(_0xb1acfb[_0x4494('0x9f')]===-0x1){return _0xb1acfb;}return this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d0201));};AGIVertices[_0x4494('0x14')]['agi']=function(_0x4455d0){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xb1'),_0x4455d0[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xb2')]([_0x4455d0[_0x4494('0xb3')],_0x4455d0[_0x4494('0xb4')]]);};AGIVertices['prototype']['answer']=function(_0x2174c3){logger[_0x4494('0x2b')](util['format'](_0x4494('0xb5'),_0x2174c3['label']));if(this[_0x4494('0x7d')](_0x2174c3['timeout'])){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2174c3[_0x4494('0x5f')]));var _0x448773=this[_0x4494('0xf')][_0x4494('0xb6')](_0x2174c3['timeout']);if(_0x448773[_0x4494('0x9f')]===-0x1){return _0x448773;}}return this['channel'][_0x4494('0xb7')]();};AGIVertices[_0x4494('0x14')]['callback']=function(_0x6ee59f){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xb8'),_0x6ee59f[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0xb9')])){return this[_0x4494('0xf')]['error'](_0x6ee59f,_0x4494('0xba'));}_0x6ee59f[_0x4494('0xbb')]=moment();if(this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0xbc')])){_0x6ee59f['scheduledAt']=moment()[_0x4494('0xbd')](_0x6ee59f[_0x4494('0xbc')],_0x4494('0xbe'));}if(!this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0x49')])){_0x6ee59f['callback_priority']=0x2;}this[_0x4494('0x41')][_0x4494('0x67')](this,_0x6ee59f);return this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0xbf'),_0x6ee59f['phone'],_0x6ee59f[_0x4494('0xb9')],_0x6ee59f[_0x4494('0xbb')]));};AGIVertices[_0x4494('0x14')][_0x4494('0xc0')]=function(_0x4ebbb7){logger[_0x4494('0x2b')](util['format'](_0x4494('0xc1'),_0x4ebbb7[_0x4494('0x37')]));var _0x5e833d=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4ebbb7[_0x4494('0xc2')],_0x4ebbb7['options']);if(_0x5e833d['result']===-0x1){return _0x5e833d;}return this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0xc3'),_0x4ebbb7[_0x4494('0xc2')],_0x4ebbb7['options']));};AGIVertices[_0x4494('0x14')]['lumenvoxtts']=function(_0x1e2e43){logger[_0x4494('0x2b')](util['format'](_0x4494('0xc4'),_0x1e2e43[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x1e2e43[_0x4494('0x76')])){return this['channel'][_0x4494('0xa4')](_0x4494('0xc5'));}var _0x424d57='\x22'+_0x1e2e43[_0x4494('0x76')]+'\x22';if(this['isConfigured'](_0x1e2e43[_0x4494('0x70')])){_0x424d57+=','+_0x1e2e43[_0x4494('0x70')];}var _0x24e36e=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xa6'),_0x424d57);if(_0x24e36e[_0x4494('0x9f')]===-0x1){return _0x24e36e;}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0xa7'),_0x424d57));};AGIVertices[_0x4494('0x14')][_0x4494('0xc6')]=function(_0x562ce5){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x562ce5['label']));if(!this['isConfigured'](_0x562ce5[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}var _0x1f2558='\x22'+_0x562ce5[_0x4494('0x76')]+'\x22';if(this['isConfigured'](_0x562ce5['options'])){_0x1f2558+=','+_0x562ce5[_0x4494('0x70')];}var _0x23c1dd=this[_0x4494('0xf')][_0x4494('0xa5')]('MRCPSynth',_0x1f2558);if(_0x23c1dd[_0x4494('0x9f')]===-0x1){return _0x23c1dd;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1f2558));};AGIVertices[_0x4494('0x14')][_0x4494('0xc7')]=function(_0x466e98){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xc8'),_0x466e98['label']));if(!this['isConfigured'](_0x466e98[_0x4494('0xa9')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc9'));}var _0x2251d8=_0x466e98[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x466e98[_0x4494('0x70')])){_0x2251d8+=','+_0x466e98['options'];}var _0x33ee3a=this['channel'][_0x4494('0xa5')](_0x4494('0xca'),_0x2251d8);if(_0x33ee3a['result']===-0x1){return _0x33ee3a;}var _0x5b5001=this['getAndSetVariable'](_0x4494('0xaa'),_0x4494('0xcb'));if(_0x5b5001[_0x4494('0x9f')]===-0x1){return _0x5b5001;}var _0x4f8b34=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x4f8b34['result']===-0x1){return _0x4f8b34;}var _0x30ee59=this[_0x4494('0xac')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x30ee59['result']===-0x1){return _0x30ee59;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xcc'),_0x2251d8));};AGIVertices['prototype'][_0x4494('0xcd')]=function(_0x193268){logger['info'](util[_0x4494('0x50')](_0x4494('0xce'),_0x193268['label']));if(!this[_0x4494('0x7d')](_0x193268[_0x4494('0xa9')])){return this['channel'][_0x4494('0xa4')](_0x4494('0xc9'));}var _0x8430=_0x193268[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x193268[_0x4494('0x70')])){_0x8430+=','+_0x193268[_0x4494('0x70')];}var _0xbb76b4=this[_0x4494('0xf')]['exec'](_0x4494('0xca'),_0x8430);if(_0xbb76b4[_0x4494('0x9f')]===-0x1){return _0xbb76b4;}var _0x23314a=this[_0x4494('0xac')]('RECOG_CONFIDENCE()',_0x4494('0xcf'));if(_0x23314a['result']===-0x1){return _0x23314a;}var _0x16b2fc=this[_0x4494('0xac')]('RECOG_INPUT()',_0x4494('0xd0'));if(_0x16b2fc[_0x4494('0x9f')]===-0x1){return _0x16b2fc;}var _0x96a784=this[_0x4494('0xac')](_0x4494('0xaf'),_0x4494('0xd1'));if(_0x96a784['result']===-0x1){return _0x96a784;}return this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0xcc'),_0x8430));};AGIVertices['prototype'][_0x4494('0xd2')]=function(_0x516d87){logger['info'](util[_0x4494('0x50')](_0x4494('0xd3'),_0x516d87['label']));if(!this['isConfigured'](_0x516d87[_0x4494('0xd4')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x516d87,_0x4494('0xd5'));}var _0x45548e=this[_0x4494('0x18')][_0x4494('0x67')](this,_0x516d87[_0x4494('0xd4')]);if(!_0x45548e){return this[_0x4494('0xf')][_0x4494('0x29')](_0x516d87,_0x4494('0xd6'));}if(!this['isConfigured'](_0x516d87[_0x4494('0x2d')])){return this['channel'][_0x4494('0x29')](_0x516d87,_0x4494('0xd7'));}var _0x14f9c1=_0x516d87[_0x4494('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4494('0xa4')](util['format'](_0x4494('0xd8'),_0x14f9c1));var _0x1936c9=this[_0x4494('0x28')][_0x4494('0x67')](this,_0x45548e,_0x14f9c1);this['createSquareDetailsReport']['sync'](this,_0x516d87,_0x14f9c1);if(!this[_0x4494('0x7d')](_0x516d87[_0x4494('0xd9')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x7a1277=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x516d87[_0x4494('0xd9')]);if(!_0x7a1277){return this['channel']['error'](_0x516d87,_0x4494('0xda'));}var _0x2dcb06=this;_0x1936c9[_0x4494('0xdb')](function(_0x1c00d6,_0x310711){Object[_0x4494('0xdc')](_0x1c00d6)[_0x4494('0xdb')](function(_0x28f032){_0x2dcb06[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s[%s][%s]',_0x7a1277,_0x310711,_0x28f032),_0x1c00d6[_0x28f032]);});});this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xdd'),_0x7a1277),_0x1936c9[_0x4494('0x97')]);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xde'),_0x7a1277));};AGIVertices[_0x4494('0x14')]['dial']=function(_0x5bad9d){logger[_0x4494('0xdf')](util[_0x4494('0x50')](_0x4494('0xe0'),_0x5bad9d[_0x4494('0x37')]));if(!this['isConfigured'](_0x5bad9d[_0x4494('0xe1')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x5bad9d,'no\x20user\x20selected');}var _0x190b80=this[_0x4494('0x1a')][_0x4494('0x67')](this,_0x5bad9d[_0x4494('0xe1')]);if(!_0x190b80){return this['channel'][_0x4494('0x29')](_0x5bad9d,_0x4494('0xe2'));}var _0x964835=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xe3'),[util[_0x4494('0x50')](_0x4494('0xe4'),_0x190b80),_0x5bad9d[_0x4494('0x5f')],_0x5bad9d[_0x4494('0xe5')],_0x5bad9d[_0x4494('0x5d')]]);if(_0x964835['result']===-0x1){return _0x964835;}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x4494('0x14')]['dialogflow']=function(_0x3c178f){logger[_0x4494('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x3c178f['label']));if(!this[_0x4494('0x7d')](_0x3c178f[_0x4494('0x72')])){return this[_0x4494('0xf')]['noop'](_0x4494('0xe6'));}if(!this['isConfigured'](_0x3c178f[_0x4494('0x76')])){return this['channel']['noop'](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x3c178f);this[_0x4494('0x40')](_0x3c178f[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xe8'),_0x3c178f[_0x4494('0x76')]));var _0x5d7b29=this[_0x4494('0x71')][_0x4494('0x67')](this,_0x3c178f);if(_0x5d7b29){for(var _0x58ef6e in _0x5d7b29){if(_0x5d7b29[_0x4494('0x92')](_0x58ef6e)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xe9'),_0x58ef6e[_0x4494('0x62')]()),_0x5d7b29[_0x58ef6e]);}}this[_0x4494('0x40')](_0x5d7b29['speech'],_0x4494('0xea'),_0x4494('0xeb'),'');return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xec'),_0x5d7b29[_0x4494('0xed')]));}return this[_0x4494('0xf')]['error'](_0x3c178f,_0x4494('0xee'));};AGIVertices[_0x4494('0x14')]['dialogflowV2']=function(_0x46ac84){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x46ac84[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x46ac84[_0x4494('0xef')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf0'));}if(!this[_0x4494('0x7d')](_0x46ac84['client_email'])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20client_email\x20configured');}if(!this[_0x4494('0x7d')](_0x46ac84['private_key'])){return this['channel'][_0x4494('0xa4')](_0x4494('0xf1'));}if(!this[_0x4494('0x7d')](_0x46ac84['dialogflowV2_language'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf2'));}if(!this[_0x4494('0x7d')](_0x46ac84[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x46ac84);this[_0x4494('0x40')](_0x46ac84[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x46ac84[_0x4494('0x76')]));var _0x53c8f9=this[_0x4494('0x74')][_0x4494('0x67')](this,_0x46ac84);if(_0x53c8f9){for(var _0x1f1723 in _0x53c8f9){if(_0x53c8f9[_0x4494('0x92')](_0x1f1723)){if(_0x1f1723!=='providerResponse'){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('DIALOGFLOW_%s',_0x1f1723[_0x4494('0x62')]()),_0x53c8f9[_0x1f1723]);}}}this[_0x4494('0x40')](_0x53c8f9['speech'],_0x4494('0xea'),'dialogflowV2',_0x53c8f9[_0x4494('0xf3')]);return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xf4'),_0x53c8f9[_0x4494('0xed')]));}return this[_0x4494('0xf')][_0x4494('0x29')](_0x46ac84,_0x4494('0xf5'));};AGIVertices[_0x4494('0x14')]['sesteknda']=function(_0x5ea66f){logger['info'](util['format'](_0x4494('0xf6'),_0x5ea66f[_0x4494('0x37')]));if(!this['isConfigured'](_0x5ea66f[_0x4494('0xf7')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf8'));}if(!this[_0x4494('0x7d')](_0x5ea66f['username'])){return this['channel'][_0x4494('0xa4')](_0x4494('0xf9'));}if(!this[_0x4494('0x7d')](_0x5ea66f[_0x4494('0xfa')])){return this[_0x4494('0xf')]['noop'](_0x4494('0xfb'));}if(!this[_0x4494('0x7d')](_0x5ea66f['ndassistant_url'])){return this[_0x4494('0xf')]['noop'](_0x4494('0xc5'));}this[_0x4494('0xf')]['bot']=!![];this[_0x4494('0x35')](_0x5ea66f);this[_0x4494('0x40')](_0x5ea66f[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0xfc'),_0x5ea66f[_0x4494('0x76')]));var _0x1342b4=this[_0x4494('0x77')][_0x4494('0x67')](this,_0x5ea66f);if(_0x1342b4){for(var _0x3cd400 in _0x1342b4){if(_0x1342b4[_0x4494('0x92')](_0x3cd400)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xfd'),_0x3cd400[_0x4494('0x62')]()),_0x1342b4[_0x3cd400]);}}this[_0x4494('0x40')](_0x1342b4[_0x4494('0xed')],'out',_0x4494('0xfe'),'');if(_0x1342b4[_0x4494('0xff')]){this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x1342b4['audiofile']));var _0x5a50ff=this[_0x4494('0xf')][_0x4494('0x100')](_0x1342b4[_0x4494('0xff')]);try{fs[_0x4494('0x101')](_0x1342b4['audiofile']+_0x4494('0x102'));}catch(_0x53e309){logger[_0x4494('0x29')](_0x53e309);}return _0x5a50ff;}else{return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')]('SestekNDA\x20Result\x20%s',_0x1342b4[_0x4494('0xed')]));}}return this[_0x4494('0xf')][_0x4494('0x29')](_0x5ea66f,_0x4494('0x103'));};AGIVertices[_0x4494('0x14')][_0x4494('0x104')]=function(_0x247d16){logger['info'](util[_0x4494('0x50')](_0x4494('0x105'),_0x247d16[_0x4494('0x37')]));return this['channel'][_0x4494('0xa4')](_0x4494('0x104'));};AGIVertices[_0x4494('0x14')][_0x4494('0x106')]=function(_0xf891d9){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xf891d9['label']));var _0x9db5a3='';if(_0xf891d9[_0x4494('0x107')]){if(!this[_0x4494('0x7d')](_0xf891d9[_0x4494('0x107')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xf891d9,'no\x20trunk\x20selected');}else{var _0x5940b3=parseInt(_0xf891d9['trunk_id'],0xa);if(isNaN(_0x5940b3)){_0x9db5a3=_0xf891d9[_0x4494('0x107')];}else{_0x9db5a3=this['getTrunk'][_0x4494('0x67')](this,_0xf891d9[_0x4494('0x107')]);if(!_0x9db5a3){return this['channel'][_0x4494('0x29')](_0xf891d9,_0x4494('0x108'));}}}}else if(_0xf891d9['trunk_name']){_0x9db5a3=_0xf891d9[_0x4494('0x109')];}else{return this[_0x4494('0xf')][_0x4494('0x29')](_0xf891d9,_0x4494('0x10a'));}var _0x8b1590=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xe3'),[util['format'](_0x4494('0x10b'),_0x9db5a3,_0xf891d9['phone']),_0xf891d9[_0x4494('0x5f')],_0xf891d9['opts'],_0xf891d9[_0x4494('0x5d')]]);if(_0x8b1590[_0x4494('0x9f')]===-0x1){return _0x8b1590;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s',_0x4494('0xe3')));};AGIVertices[_0x4494('0x14')][_0x4494('0x10c')]=function(_0x30df24){logger[_0x4494('0x2b')](util['format'](_0x4494('0x10d'),_0x30df24[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x10c'));};AGIVertices['prototype'][_0x4494('0xd')]=function(_0x199c52){logger[_0x4494('0x2b')](util['format'](_0x4494('0x10e'),_0x199c52[_0x4494('0x37')]));if(_0x199c52['retry']===0x0){return this[_0x4494('0xa1')](_0x199c52);}_0x199c52[_0x4494('0x10f')]-=0x1;if(!this[_0x4494('0x7d')](_0x199c52['file_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x199c52,_0x4494('0x110'));}var _0x3412ca=this[_0x4494('0x111')][_0x4494('0x67')](this,_0x199c52[_0x4494('0x112')]);if(!_0x3412ca){return this[_0x4494('0xf')][_0x4494('0x29')](_0x199c52,'no\x20file\x20audio\x20found');}if(!this[_0x4494('0x7d')](_0x199c52['variable_id'])){return this['channel'][_0x4494('0x29')](_0x4494('0x113'));}var _0x26230f=this['channel']['getData'](_0x3412ca,_0x199c52[_0x4494('0x114')],_0x199c52['maxdigit']);var _0x59b28a=_0x26230f[_0x4494('0x9f')]?_0x26230f[_0x4494('0x9f')]['toString']():'';logger[_0x4494('0x2b')](_0x4494('0x115'),JSON[_0x4494('0x6b')](_0x26230f));if(_0x26230f['result']===-0x1){this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,_0x59b28a);return _0x26230f;}else if(_0x26230f[_0x4494('0x9d')]===_0x4494('0x5f')){_0x26230f[_0x4494('0x9f')]=_0x59b28a['length']>=parseInt(_0x199c52[_0x4494('0x116')])?'x':'i';}else{_0x26230f['result']=_0x59b28a[_0x4494('0x97')]>=parseInt(_0x199c52[_0x4494('0x116')])&&_0x59b28a['length']<=parseInt(_0x199c52[_0x4494('0x117')])?'x':'i';}var _0x2da9c3=this['getVariable'][_0x4494('0x67')](this,_0x199c52['variable_id']);if(!_0x2da9c3){return this['channel'][_0x4494('0x29')](_0x199c52,'no\x20variable\x20found');}this[_0x4494('0xf')][_0x4494('0x98')](_0x2da9c3,_0x59b28a);if(this[_0x4494('0x7d')](_0x199c52[_0x4494('0x118')])){var _0x51263=parseInt(_0x199c52['hiddendigitsnum'],0xa);var _0x124d27=rs[_0x4494('0x119')]({'charset':'*','length':_0x51263});var _0x55b685=_0x59b28a['length'];if(_0x55b685>0x0){if(_0x55b685>_0x51263){this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,_0x199c52['hiddendigitspos']===_0x4494('0x11a')?_0x124d27+_0x59b28a[_0x4494('0x11b')](_0x51263):_0x59b28a['substr'](0x0,_0x55b685-_0x51263)+_0x124d27);}else{this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,rs[_0x4494('0x119')]({'charset':'*','length':_0x55b685}));}}else{this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x199c52,'');}}else{this[_0x4494('0x35')]['sync'](this,_0x199c52,_0x59b28a);}return _0x26230f;};AGIVertices[_0x4494('0x14')][_0x4494('0xe')]=function(_0xd10dda){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x11c'),_0xd10dda[_0x4494('0x37')]));return this['getdigits'](_0xd10dda);};AGIVertices[_0x4494('0x14')][_0x4494('0x11d')]=function(_0x385cd8){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x11e'),_0x385cd8['label']));this[_0x4494('0x35')][_0x4494('0x67')](this,_0x385cd8,_0x385cd8[_0x4494('0x11f')]);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('GOAL\x20%s',_0x385cd8[_0x4494('0x11f')]));};AGIVertices[_0x4494('0x14')][_0x4494('0x120')]=function(_0x35b4ce){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x121'),_0x35b4ce[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x35b4ce['aws_access_key_id'])||!this[_0x4494('0x7d')](_0x35b4ce[_0x4494('0x81')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4494('0x7d')](_0x35b4ce[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x122'),_0x35b4ce[_0x4494('0x76')]));var _0x17bdb9=this[_0x4494('0x7f')][_0x4494('0x67')](this,_0x35b4ce);if(_0x17bdb9){this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x123'),_0x17bdb9));var _0x8ae25b=this['channel'][_0x4494('0x100')](_0x17bdb9);try{fs[_0x4494('0x101')](_0x17bdb9+_0x4494('0x102'));}catch(_0xb72327){logger['error'](_0xb72327);}return _0x8ae25b;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x35b4ce,_0x4494('0x124'));};AGIVertices[_0x4494('0x14')][_0x4494('0x125')]=function(_0x1bee16){logger['info'](util['format'](_0x4494('0x126'),_0x1bee16[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x1bee16['aws_access_key_id'])||!this[_0x4494('0x7d')](_0x1bee16['aws_secret_access_key'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x127'));}if(!this[_0x4494('0x7d')](_0x1bee16['aws_bot_name'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x128'));}if(!this[_0x4494('0x7d')](_0x1bee16[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x1bee16);this[_0x4494('0x40')](_0x1bee16[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1bee16[_0x4494('0x76')]));var _0x21dc17=this[_0x4494('0x86')][_0x4494('0x67')](this,_0x1bee16);if(_0x21dc17){for(var _0x4d45b9 in _0x21dc17){if(_0x21dc17[_0x4494('0x92')](_0x4d45b9)&&_[_0x4494('0x90')](_0x21dc17[_0x4d45b9])){this['channel'][_0x4494('0x98')](util['format'](_0x4494('0x129'),_0x4d45b9[_0x4494('0x62')]()),_0x21dc17[_0x4d45b9]);}}if(_[_0x4494('0x45')](_0x21dc17['message'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x12a'));}else{this[_0x4494('0x40')](_0x21dc17[_0x4494('0x12b')],_0x4494('0xea'),_0x4494('0x12c'),'');return this['channel']['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x21dc17['message']));}}return this['channel'][_0x4494('0x29')](_0x1bee16,_0x4494('0x12d'));};AGIVertices['prototype'][_0x4494('0x12e')]=function(_0x1c340b){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x12f'),_0x1c340b[_0x4494('0x37')],_0x1c340b['timeout']));if(!this[_0x4494('0x7d')](_0x1c340b[_0x4494('0x72')])){return this['channel']['noop'](_0x4494('0xe6'));}var _0x39c50d=_0x4494('0x130');var _0x2ea3a8=util[_0x4494('0x50')](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x41cbe3=util['format'](_0x4494('0x96'),_0x2ea3a8,_0x39c50d);var _0x41e6aa=!![];if(_0x1c340b[_0x4494('0x132')]===_0x4494('0x133')){_0x41e6aa=![];}var _0x515ef1=this[_0x4494('0xf')][_0x4494('0x134')](_0x2ea3a8,_0x39c50d,_0x1c340b['intKey'],_0x1c340b[_0x4494('0x5f')],undefined,_0x41e6aa);if(_0x515ef1['result']!==-0x1){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x135'),_0x41cbe3));var _0x81428b=this[_0x4494('0x89')][_0x4494('0x67')](this,_0x1c340b,_0x41cbe3);if(_0x81428b){for(var _0x140bc4 in _0x81428b){if(_0x81428b[_0x4494('0x92')](_0x140bc4)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0x136'),_0x140bc4[_0x4494('0x62')]()),_0x81428b[_0x140bc4]);}}return this['channel']['noop'](util[_0x4494('0x50')](_0x4494('0x137'),JSON['stringify'](_0x81428b)));}}return _0x515ef1;};AGIVertices[_0x4494('0x14')][_0x4494('0x138')]=function(_0x14be39){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x139'),_0x14be39[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x14be39[_0x4494('0x8c')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20appid\x20configured');}if(!this[_0x4494('0x7d')](_0x14be39['appsecret'])){return this['channel']['noop'](_0x4494('0x13a'));}var _0x21c0ff=_0x4494('0x130');var _0x39c0da=util[_0x4494('0x50')](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x4e14c5=util[_0x4494('0x50')](_0x4494('0x96'),_0x39c0da,_0x21c0ff);var _0x151054=!![];if(_0x14be39[_0x4494('0x132')]===_0x4494('0x133')){_0x151054=![];}var _0x4064ef=this[_0x4494('0xf')][_0x4494('0x134')](_0x39c0da,_0x21c0ff,_0x14be39['intKey'],_0x14be39[_0x4494('0x5f')],undefined,_0x151054);if(_0x4064ef[_0x4494('0x9f')]!==-0x1){this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x13b'),_0x4e14c5));var _0x4fdb6d=this[_0x4494('0x8b')][_0x4494('0x67')](this,_0x14be39,_0x4e14c5);if(_0x4fdb6d){for(var _0x1725f5 in _0x4fdb6d){if(_0x4fdb6d[_0x4494('0x92')](_0x1725f5)){this[_0x4494('0xf')][_0x4494('0x98')](util['format'](_0x4494('0x13c'),_0x1725f5[_0x4494('0x62')]()),_0x4fdb6d[_0x1725f5]);}}return this['channel']['noop'](util['format'](_0x4494('0x13d'),JSON[_0x4494('0x6b')](_0x4fdb6d)));}}return _0x4064ef;};AGIVertices[_0x4494('0x14')][_0x4494('0x13e')]=function(_0x5b1b92){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5b1b92[_0x4494('0x37')]));return this[_0x4494('0xf')]['continueAt'](_0x5b1b92[_0x4494('0x3b')],_0x5b1b92['extension'],_0x5b1b92['priority']);};AGIVertices[_0x4494('0x14')][_0x4494('0x13f')]=function(_0x51b967){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x51b967[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x51b967[_0x4494('0x140')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x51b967,_0x4494('0x141'));}try{var _0x2f4144=eval(_0x51b967[_0x4494('0x140')])?_0x4494('0x142'):_0x4494('0x143');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x144'),_0x51b967[_0x4494('0x140')],_0x2f4144));return{'code':0xc8,'result':_0x2f4144};}catch(_0x18a01c){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4494('0x14')][_0x4494('0x145')]=function(_0xeefb10){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xeefb10[_0x4494('0x37')]));if(!this['isConfigured'](_0xeefb10[_0x4494('0x146')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xeefb10,_0x4494('0x147'));}var _0x1d84cb=this[_0x4494('0x22')][_0x4494('0x67')](this,_0xeefb10[_0x4494('0x146')]);if(!_0x1d84cb){return this[_0x4494('0xf')]['error'](_0xeefb10,_0x4494('0x148'));}for(var _0x6c687=0x0;_0x6c687<_0x1d84cb[_0x4494('0x97')];_0x6c687+=0x1){var _0x11a9a7=this[_0x4494('0xf')]['getVariable'](util[_0x4494('0x50')]('IFTIME(%s?true:false)',_0x1d84cb[_0x6c687]));if(_0x11a9a7[_0x4494('0x9f')]===-0x1){return _0x11a9a7;}logger['info'](util[_0x4494('0x50')]('IFTIME\x20%s\x20%s',_0x1d84cb[_0x6c687],_0x11a9a7[_0x4494('0x9d')]));if(_0x11a9a7[_0x4494('0x9d')]==='true'){logger['info'](util[_0x4494('0x50')](_0x4494('0x149'),_0x1d84cb[_0x6c687],_0x4494('0x142')));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x149'),_0x1d84cb[_0x6c687],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x4494('0x2b')](util['format'](_0x4494('0x149'),_0x1d84cb[_0x6c687],_0x4494('0x143')));this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('IFTIME\x20%s\x20%s',_0x1d84cb[_0x6c687],_0x4494('0x143')));}}return{'code':0xc8,'result':_0x4494('0x143')};};AGIVertices[_0x4494('0x14')][_0x4494('0x14a')]=function(_0x15728a){logger[_0x4494('0x2b')](util['format'](_0x4494('0x14b'),_0x15728a['label']));return this['channel'][_0x4494('0x14a')]();};AGIVertices[_0x4494('0x14')][_0x4494('0x14c')]=function(_0x58ff54){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x14d'),_0x58ff54[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x58ff54['key'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xe6'));}var _0x2a37c5=_0x4494('0x130');var _0x1ed582=util['format'](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x510990=util[_0x4494('0x50')]('%s.%s',_0x1ed582,_0x2a37c5);var _0x20074d=!![];if(_0x58ff54['beep']===_0x4494('0x133')){_0x20074d=![];}var _0x1b667f=this[_0x4494('0xf')][_0x4494('0x134')](_0x1ed582,_0x2a37c5,_0x58ff54[_0x4494('0x14e')],_0x58ff54['timeout'],undefined,_0x20074d);if(_0x1b667f['result']!==-0x1){this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('ispeech\x20%s\x20file\x20created',_0x510990));var _0xb70dd8=this[_0x4494('0x7b')][_0x4494('0x67')](this,_0x58ff54,_0x510990);if(_0xb70dd8){for(var _0x2ba86d in _0xb70dd8){if(_0xb70dd8[_0x4494('0x92')](_0x2ba86d)){this['channel'][_0x4494('0x98')](util[_0x4494('0x50')]('ISPEECH_ASR_%s',_0x2ba86d[_0x4494('0x62')]()),_0xb70dd8[_0x2ba86d]);}}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('IspeechASR\x20Result\x20%s',JSON[_0x4494('0x6b')](_0xb70dd8)));}}return _0x1b667f;};AGIVertices['prototype']['ispeechtts']=function(_0x4e40c1){logger['info'](util[_0x4494('0x50')](_0x4494('0x14f'),_0x4e40c1[_0x4494('0x37')]));if(!this['isConfigured'](_0x4e40c1[_0x4494('0x72')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20key\x20configured');}if(!this[_0x4494('0x7d')](_0x4e40c1[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x150'),_0x4e40c1[_0x4494('0x76')]));var _0x106f7a=this[_0x4494('0x78')][_0x4494('0x67')](this,_0x4e40c1);if(_0x106f7a){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x151'),_0x106f7a));var _0x3e435a=this[_0x4494('0xf')]['streamFile'](_0x106f7a,_0x4e40c1[_0x4494('0x14e')]);try{fs['unlink'](_0x106f7a+_0x4494('0x102'));}catch(_0x5a3cdc){logger[_0x4494('0x29')](_0x5a3cdc);}return _0x3e435a;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x4e40c1,_0x4494('0x152'));};AGIVertices[_0x4494('0x14')][_0x4494('0x153')]=function(_0xb15eae){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x154'),_0xb15eae['label']));if(!this[_0x4494('0x7d')](_0xb15eae[_0x4494('0x155')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xb15eae,'no\x20find\x20by\x20configured');}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this['channel'][_0x4494('0x3a')],_0xb15eae['findBy']));var _0x2173de=this[_0x4494('0x4e')][_0x4494('0x67')](this,_0xb15eae['findBy']);if(_0x2173de){logger['info'](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x158')};}else{logger[_0x4494('0x2b')](util[_0x4494('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4494('0xf')]['callerid'],_0xb15eae[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')]['logout']=function(_0x5cd61e){logger['info'](util['format'](_0x4494('0x15b'),_0x5cd61e[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x5cd61e[_0x4494('0x155')])){return this[_0x4494('0xf')]['error'](_0x5cd61e,_0x4494('0x15c'));}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));var _0x1e52cc=this[_0x4494('0x4d')]['sync'](this,_0x5cd61e[_0x4494('0x155')]);if(_0x1e52cc){logger[_0x4494('0x2b')](util['format'](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4494('0x50')](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e['findBy']));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x159'),this['channel']['callerid'],_0x5cd61e[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')][_0x4494('0x15d')]=function(_0x3b9724){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x15e'),_0x3b9724[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x3b9724[_0x4494('0x15f')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x3b9724,'no\x20operation\x20configured');}this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('math\x20%s',_0x3b9724['operation']));var _0x5c792f=eval(_0x3b9724[_0x4494('0x15f')]);if(!this['isConfigured'](_0x3b9724[_0x4494('0xd9')])){return this['channel']['noop'](_0x4494('0x113'));}var _0xaf5459=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x3b9724['variable_id']);if(!_0xaf5459){return this[_0x4494('0xf')][_0x4494('0x29')](_0x3b9724,_0x4494('0xda'));}if(_[_0x4494('0x94')](_0x5c792f)){var _0x563db4=this;_0x5c792f[_0x4494('0xdb')](function(_0x3eda3a,_0x16c476){_0x563db4[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0x160'),_0xaf5459,_0x16c476),_0x3eda3a);});return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('variable\x20%s[key]\x20set',_0xaf5459));}else{return this[_0x4494('0xf')]['setVariable'](_0xaf5459,_0x5c792f);}};AGIVertices[_0x4494('0x14')][_0x4494('0xc')]=function(_0x16ea41){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x161'),_0x16ea41[_0x4494('0x37')]));if(_0x16ea41['retry']===0x0){return this['maxRetry'](_0x16ea41);}_0x16ea41[_0x4494('0x10f')]-=0x1;if(!this[_0x4494('0x7d')](_0x16ea41[_0x4494('0x112')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x16ea41,_0x4494('0x110'));}var _0x3d2014=this['getSound'][_0x4494('0x67')](this,_0x16ea41[_0x4494('0x112')]);if(!_0x3d2014){return this[_0x4494('0xf')]['error'](_0x16ea41,_0x4494('0x162'));}var _0x5cbd1e=this[_0x4494('0xf')][_0x4494('0x163')](_0x3d2014,_0x16ea41['response'],_0x16ea41[_0x4494('0x164')]);var _0x3515fa=_0x5cbd1e[_0x4494('0x9f')];if(_0x5cbd1e[_0x4494('0x9f')]===-0x1){this[_0x4494('0x35')]['sync'](this,_0x16ea41,'-1');return _0x5cbd1e;}else if(_0x5cbd1e[_0x4494('0x9d')]===_0x4494('0x5f')){_0x5cbd1e['result']=_0x5cbd1e[_0x4494('0x9f')][_0x4494('0x97')]>0x0?_0x5cbd1e['result']:'t';}else if(_[_0x4494('0x43')](_0x5cbd1e['result'])){_0x5cbd1e['result']='#';_0x3515fa='#';}if(!this[_0x4494('0x7d')](_0x16ea41[_0x4494('0xd9')])){this['channel'][_0x4494('0xa4')](_0x4494('0x113'));}else{var _0x35fa7d=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x16ea41[_0x4494('0xd9')]);if(!_0x35fa7d){return this['channel'][_0x4494('0x29')](_0x16ea41,'no\x20variable\x20found');}this['channel'][_0x4494('0x98')](_0x35fa7d,_0x3515fa);}this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x16ea41,_0x3515fa);return _0x5cbd1e;};AGIVertices['prototype']['noop']=function(_0x4d51e5){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x165'),_0x4d51e5[_0x4494('0x37')]));return this['channel'][_0x4494('0xa4')](_0x4d51e5['output']||_0x4d51e5[_0x4494('0x37')]);};AGIVertices[_0x4494('0x14')][_0x4494('0x166')]=function(_0x33cd7a){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x167'),_0x33cd7a['label']));if(!this[_0x4494('0x7d')](_0x33cd7a[_0x4494('0x155')])){return this['channel'][_0x4494('0x29')](_0x33cd7a,'no\x20find\x20by\x20configured');}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));var _0x1e1a71=this[_0x4494('0x4a')][_0x4494('0x67')](this,_0x33cd7a[_0x4494('0x168')]);var _0x48b640=this['agentPause'][_0x4494('0x67')](this,_0x33cd7a[_0x4494('0x155')],_0x1e1a71);if(_0x48b640){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x158')};}else{logger[_0x4494('0x2b')](util['format'](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')]['callerid'],_0x33cd7a['findBy']));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')][_0x4494('0x169')]=function(_0x313e3c){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x16a'),_0x313e3c['label']));if(!this[_0x4494('0x7d')](_0x313e3c['file_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x313e3c,_0x4494('0x110'));}var _0x2be577=this[_0x4494('0x111')][_0x4494('0x67')](this,_0x313e3c[_0x4494('0x112')]);if(!_0x2be577){return this[_0x4494('0xf')][_0x4494('0x29')](_0x313e3c,_0x4494('0x162'));}var _0x5b9791=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0x16b'),[_0x2be577,_0x313e3c[_0x4494('0xe5')]]);if(_0x5b9791[_0x4494('0x9f')]===-0x1){return _0x5b9791;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xc3'),_0x4494('0x16b'),_0x2be577));};AGIVertices[_0x4494('0x14')][_0x4494('0x16c')]=function(_0x13c261){logger['info'](util['format'](_0x4494('0x16d'),_0x13c261[_0x4494('0x37')]));if(!this['isConfigured'](_0x13c261['queue_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x13c261,_0x4494('0x16e'));}var _0x4c1f7e='';var _0x3e907b=parseInt(_0x13c261[_0x4494('0x16f')],0xa);if(isNaN(_0x3e907b)){_0x4c1f7e=_0x13c261[_0x4494('0x16f')];}else{_0x4c1f7e=this[_0x4494('0x15')][_0x4494('0x67')](this,_0x13c261[_0x4494('0x16f')]);if(!_0x4c1f7e){return this['channel'][_0x4494('0x29')](_0x13c261,_0x4494('0x170'));}}var _0x3995bd='';if(this['isConfigured'](_0x13c261['file_id'])){var _0x1af55b=this[_0x4494('0x111')]['sync'](this,_0x13c261[_0x4494('0x112')]);if(_0x1af55b){_0x3995bd=_0x1af55b;}}this[_0x4494('0x35')][_0x4494('0x67')](this,_0x13c261,_0x4c1f7e);if(_0x13c261[_0x4494('0xe5')][_0x4494('0x171')]('x')<0x0){_0x13c261['opts']+='x';}if(_0x13c261['opts'][_0x4494('0x171')]('X')<0x0){_0x13c261[_0x4494('0xe5')]+='X';}this[_0x4494('0xf')][_0x4494('0x98')](_0x4494('0x172'),_0x4c1f7e?_0x4c1f7e['toLowerCase']():'');var _0x12c081=this[_0x4494('0xf')]['exec'](_0x4494('0x173'),[_0x4c1f7e,_0x13c261[_0x4494('0xe5')],_0x13c261[_0x4494('0x5d')],_0x3995bd,_0x13c261[_0x4494('0x5f')],_0x13c261[_0x4494('0xb2')],_0x13c261[_0x4494('0x174')],_0x13c261['gosub'],'',_0x13c261[_0x4494('0x175')]]);if(_0x12c081['result']===-0x1){return _0x12c081;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x4494('0x173'),_0x4c1f7e));};AGIVertices[_0x4494('0x14')][_0x4494('0x176')]=function(_0x5316ea){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x177'),_0x5316ea[_0x4494('0x37')]));var _0x420d34=_0x5316ea[_0x4494('0x178')]||_0x4494('0x130');var _0x5bf29f=util[_0x4494('0x50')](_0x4494('0x179'),this[_0x4494('0xf')][_0x4494('0x36')],rs[_0x4494('0x119')](0x5));var _0x44bbd3=util[_0x4494('0x50')](_0x4494('0x17a'),FILES_PATH,_0x5bf29f,_0x420d34);var _0x4fae90=util[_0x4494('0x50')]('%s/recordings/%s',FILES_PATH,_0x5bf29f);this[_0x4494('0x39')]['sync'](this,_0x5316ea,_0x5bf29f,_0x44bbd3);this['channel'][_0x4494('0x98')](_0x4494('0x17b'),_0x5bf29f);logger[_0x4494('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x4fae90,_0x420d34,_0x5316ea[_0x4494('0x17c')],_0x5316ea[_0x4494('0x5f')]);return this[_0x4494('0xf')][_0x4494('0x134')](_0x4fae90,_0x420d34,_0x5316ea[_0x4494('0x17c')],_0x5316ea[_0x4494('0x5f')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x54184c){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x54184c[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x54184c['url'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x17d'));}var _0x2bd5ab=this['restAPI'][_0x4494('0x67')](this,_0x54184c);logger[_0x4494('0x2b')](util['format']('Response:',util[_0x4494('0x17e')](_0x2bd5ab,{'showHidden':![],'depth':null})));if(!this[_0x4494('0x7d')](_0x54184c[_0x4494('0xd9')])){return this[_0x4494('0xf')]['noop'](_0x4494('0x17f'));}var _0x3fbabb=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x54184c[_0x4494('0xd9')]);if(!_0x3fbabb){return this[_0x4494('0xf')]['error'](_0x54184c,_0x4494('0xda'));}this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s_STATUS_CODE',_0x3fbabb),_0x2bd5ab[_0x4494('0x6d')]?_0x2bd5ab[_0x4494('0x6d')]:_0x4494('0x180'));this[_0x4494('0xf')]['setVariable'](util[_0x4494('0x50')](_0x4494('0x181'),_0x3fbabb),_0x2bd5ab[_0x4494('0x6e')]?_0x2bd5ab[_0x4494('0x6e')]:'OK');if(_0x2bd5ab[_0x4494('0x63')]){try{this['saveRestApiResult'](_0x2bd5ab[_0x4494('0x63')],_0x3fbabb);}catch(_0x539210){logger['error'](util[_0x4494('0x50')](_0x4494('0x182'),_0x3fbabb));}}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('variable\x20%s\x20set',_0x3fbabb));};AGIVertices[_0x4494('0x14')]['saydigits']=function(_0x328ea2){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x328ea2[_0x4494('0x37')]));return this[_0x4494('0xf')]['sayDigits'](_0x328ea2[_0x4494('0x183')][_0x4494('0x184')](/\s+/g,''),_0x328ea2['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x185')]=function(_0x1ca7f0){logger['info'](util[_0x4494('0x50')](_0x4494('0x186'),_0x1ca7f0['label']));return this[_0x4494('0xf')]['sayNumber'](_0x1ca7f0[_0x4494('0x187')][_0x4494('0x184')](/\s+/g,''),_0x1ca7f0['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x188')]=function(_0x31fd10){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x189'),_0x31fd10[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0x18a')](_0x31fd10[_0x4494('0x76')],_0x31fd10['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x18b')]=function(_0x110a85){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x18c'),_0x110a85[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x110a85[_0x4494('0x18d')])){return this['channel'][_0x4494('0xa4')](_0x4494('0x18e'));}var _0x50f7ac=this[_0x4494('0x1f')][_0x4494('0x67')](this,_0x110a85[_0x4494('0x18d')]);if(!_0x50f7ac||!_0x50f7ac[_0x4494('0x18f')]){return this[_0x4494('0xf')][_0x4494('0x29')](_0x110a85,_0x4494('0x190'));}var _0x283cdf={'from':util[_0x4494('0x50')]('\x22%s\x22\x20<%s>',_0x50f7ac[_0x4494('0x12')],_0x50f7ac[_0x4494('0x191')]||_0x50f7ac['Smtp'][_0x4494('0x192')]),'to':_0x110a85['to']||'','cc':_0x110a85['cc']||'','bcc':_0x110a85[_0x4494('0x193')]||'','subject':_0x110a85[_0x4494('0x194')],'html':_0x110a85[_0x4494('0x76')],'text':_0x110a85[_0x4494('0x76')]};if(this['isConfigured'](_0x110a85[_0x4494('0x195')])){}logger[_0x4494('0xdf')]('sendMail\x20message',JSON['stringify'](_0x283cdf));this['createSquareDetailsReport']['sync'](this,_0x110a85,_0x110a85[_0x4494('0x18d')]);this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x196'),_0x50f7ac['name']));this[_0x4494('0x21')][_0x4494('0x67')](this,_0x50f7ac[_0x4494('0x197')],_0x283cdf);return this['channel'][_0x4494('0xa4')](_0x4494('0x198'));};AGIVertices[_0x4494('0x14')]['sendFax']=function(_0x3fbbd5){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x199'),_0x3fbbd5[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x19a'));};AGIVertices[_0x4494('0x14')][_0x4494('0x19b')]=function(_0x2bf571){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2bf571[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x2bf571[_0x4494('0x19c')])){return this['channel']['noop'](_0x4494('0x19d'));}var _0x5689d6=this[_0x4494('0x32')][_0x4494('0x67')](this,_0x2bf571[_0x4494('0x19c')]);if(!_0x5689d6){return this[_0x4494('0xf')][_0x4494('0x29')](_0x2bf571,_0x4494('0x19e'));}var _0x4f3da9={'body':_0x2bf571[_0x4494('0x19f')],'phone':_0x2bf571['to']||'','SmsAccountId':_0x5689d6['id']};logger[_0x4494('0xdf')](_0x4494('0x1a0'),JSON[_0x4494('0x6b')](_0x4f3da9));this[_0x4494('0x35')][_0x4494('0x67')](this,_0x2bf571,_0x2bf571[_0x4494('0x19c')]);this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0x1a1'),_0x5689d6[_0x4494('0x12')]));this[_0x4494('0x34')][_0x4494('0x67')](this,_0x4f3da9);return this[_0x4494('0xf')]['noop'](_0x4494('0x1a2'));};AGIVertices[_0x4494('0x14')]['set']=function(_0x468195){logger[_0x4494('0x2b')](util['format'](_0x4494('0x1a3'),_0x468195[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x468195['variable_id'])){return this['channel'][_0x4494('0x29')](_0x468195,_0x4494('0x1a4'));}var _0x26649b=this['getVariable'][_0x4494('0x67')](this,_0x468195[_0x4494('0xd9')]);if(!_0x26649b){return this[_0x4494('0xf')]['error'](_0x468195,_0x4494('0xda'));}return this[_0x4494('0xf')]['setVariable'](_0x26649b,_0x468195['variable_value']);};AGIVertices['prototype']['start']=function(_0x53c296){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1a5'),_0x53c296[_0x4494('0x37')]));this['channel'][_0x4494('0xa4')](_0x4494('0x1a6'));var _0x228a00=this['channel']['getVariable'](_0x4494('0x1a7'));if(!_[_0x4494('0x43')](_0x228a00[_0x4494('0x9d')])){this[_0x4494('0xf')][_0x4494('0x36')]=_0x228a00[_0x4494('0x9d')];}if(_0x53c296[_0x4494('0xb7')]==='yes'){this['channel'][_0x4494('0xa4')](_0x4494('0x1a8'));return this[_0x4494('0xf')][_0x4494('0xb7')]();}return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x1a9'));};AGIVertices[_0x4494('0x14')][_0x4494('0x1aa')]=function(_0x5f5718){logger['info'](util[_0x4494('0x50')](_0x4494('0x1ab'),_0x5f5718[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x5f5718[_0x4494('0x1ac')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x5f5718,_0x4494('0x1ad'));}var _0x1701bc=this[_0x4494('0x1ae')][_0x4494('0x67')](this,_0x5f5718['project_id']);if(!this['isConfigured'](_0x1701bc)){return this[_0x4494('0xf')]['error'](_0x5f5718,util['format'](_0x4494('0x1af'),_0x5f5718[_0x4494('0x1ac')]));}if(_0x1701bc===this[_0x4494('0xf')]['arg_1']){return this['channel']['error'](_0x5f5718,_0x4494('0x1b0'));}this[_0x4494('0x35')][_0x4494('0x67')](this,_0x5f5718,_0x1701bc);var _0x4b9c06=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0x1b1'),util[_0x4494('0x50')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4494('0xb2')][_0x4494('0x1b2')]||_0x4494('0x1b3'),_0x1701bc,this[_0x4494('0xf')]['arg_1']));if(_0x4b9c06[_0x4494('0x9f')]===-0x1){return _0x4b9c06;}return this['channel'][_0x4494('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x4494('0x1b1'),_0x1701bc));};AGIVertices[_0x4494('0x14')]['system']=function(_0x2124bf){logger[_0x4494('0x2b')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2124bf['label']));var _0x182fdb=this[_0x4494('0x53')][_0x4494('0x67')](this,_0x2124bf[_0x4494('0xb3')]);this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x2124bf,_0x2124bf[_0x4494('0xb3')]);if(this[_0x4494('0x7d')](_0x2124bf[_0x4494('0xd9')])){var _0x4b958a=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x2124bf[_0x4494('0xd9')]);if(_0x4b958a){this[_0x4494('0xf')][_0x4494('0x98')](_0x4b958a,_0x182fdb);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b4'),_0x2124bf[_0x4494('0xb3')],_0x4b958a));}}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b5'),_0x2124bf['command']));};AGIVertices[_0x4494('0x14')][_0x4494('0x1b6')]=function(_0x278fa3){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x278fa3['label']));_0x278fa3['text']=_0x278fa3[_0x4494('0x76')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x278fa3[_0x4494('0x55')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x1b7'));}if(!this[_0x4494('0x7d')](_0x278fa3[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20text\x20configured');}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x1b8'),_0x278fa3[_0x4494('0x76')]));var _0x591fd7=this['googleCloudTTS']['sync'](this,_0x278fa3);if(_0x591fd7){this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b9'),_0x591fd7));var _0x1c88f7=this[_0x4494('0xf')]['streamFile'](_0x591fd7);try{fs[_0x4494('0x101')](_0x591fd7+_0x4494('0x102'));}catch(_0x156d26){logger[_0x4494('0x29')](_0x156d26);}return _0x1c88f7;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x278fa3,_0x4494('0x1ba'));};AGIVertices[_0x4494('0x14')][_0x4494('0x1bb')]=function(_0x106577){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x106577[_0x4494('0x37')]));_0x106577[_0x4494('0x76')]=_0x106577[_0x4494('0x76')][_0x4494('0x184')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x106577[_0x4494('0x76')])){return this[_0x4494('0xf')]['noop']('no\x20text\x20configured');}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x1bc'),_0x106577['text']));var _0x1a1a39=this[_0x4494('0x5b')][_0x4494('0x67')](this,_0x106577);if(_0x1a1a39){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1bd'),_0x1a1a39));var _0x31a0eb=this[_0x4494('0xf')][_0x4494('0x100')](_0x1a1a39);try{fs[_0x4494('0x101')](_0x1a1a39+_0x4494('0x102'));}catch(_0x367f8d){logger[_0x4494('0x29')](_0x367f8d);}return _0x31a0eb;}return this['channel'][_0x4494('0x29')](_0x106577,_0x4494('0x1be'));};AGIVertices[_0x4494('0x14')]['unpause']=function(_0x48d15b){logger['info'](util[_0x4494('0x50')](_0x4494('0x1bf'),_0x48d15b['label']));if(!this[_0x4494('0x7d')](_0x48d15b[_0x4494('0x155')])){return this['channel'][_0x4494('0x29')](_0x48d15b,_0x4494('0x15c'));}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this['channel']['callerid'],_0x48d15b[_0x4494('0x155')]));var _0x25912a=this[_0x4494('0x4c')][_0x4494('0x67')](this,_0x48d15b[_0x4494('0x155')]);if(_0x25912a){logger[_0x4494('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4494('0xf')][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x157'),this['channel'][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4494('0x50')](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x48d15b[_0x4494('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4494('0x14')][_0x4494('0x1c0')]=function(_0x181302){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1c1'),_0x181302['label']));var _0x2172a1=this[_0x4494('0xf')]['exec'](_0x4494('0x1c2'),[_0x181302['mailbox'],_0x181302['options']]);if(_0x2172a1[_0x4494('0x9f')]===-0x1){return _0x2172a1;}return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')]('Executed\x20command\x20%s\x20%s',_0x4494('0x1c2'),_0x181302['mailbox']));};AGIVertices[_0x4494('0x14')][_0x4494('0x1c3')]=function(_0x404ad2){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1c4'),_0x404ad2[_0x4494('0x37')]));if(!this['isConfigured'](_0x404ad2[_0x4494('0xd9')])){return this[_0x4494('0xf')]['error'](_0x404ad2,_0x4494('0x1a4'));}var _0xaec37d=this['getVariable'][_0x4494('0x67')](this,_0x404ad2[_0x4494('0xd9')]);if(!_0xaec37d){return this[_0x4494('0xf')][_0x4494('0x29')](_0x404ad2,_0x4494('0xda'));}var _0x579fcd=this[_0x4494('0xf')][_0x4494('0x9c')](_0xaec37d);return{'code':0xc8,'result':_0x579fcd['extra']?_0x579fcd[_0x4494('0x9d')]:'-'};};String['prototype'][_0x4494('0x9b')]=function(_0x4008fe,_0x182e49){return this[_0x4494('0x1c5')](_0x4008fe)[_0x4494('0x1c6')](_0x182e49);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1a950a4..6cecb72 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 _0x0e51=['mandatoryDispositionPause','name','agents','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','finally','[ACW][START]\x20%s','message','getAgent','pauseType','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','startAcw','channels','queue','ACW','mandatoryDisposition'];(function(_0x4d1049,_0x36a8c0){var _0x16d010=function(_0x474c4d){while(--_0x474c4d){_0x4d1049['push'](_0x4d1049['shift']());}};_0x16d010(++_0x36a8c0);}(_0x0e51,0x89));var _0x10e5=function(_0x391547,_0x1102be){_0x391547=_0x391547-0x0;var _0x39a884=_0x0e51[_0x391547];return _0x39a884;};'use strict';var _=require(_0x10e5('0x0'));var moment=require(_0x10e5('0x1'));var ami=require(_0x10e5('0x2'));var logger=require(_0x10e5('0x3'))(_0x10e5('0x4'));var RpcUser=require(_0x10e5('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x51bfab){this['voiceQueues']=_0x51bfab[_0x10e5('0x6')];this['agents']=_0x51bfab['agents'];this[_0x10e5('0x7')]=_0x51bfab[_0x10e5('0x7')];this['channels']={};ami['on'](_0x10e5('0x8'),this[_0x10e5('0x9')][_0x10e5('0xa')](this));ami['on'](_0x10e5('0xb'),this[_0x10e5('0xc')][_0x10e5('0xa')](this));ami['on'](_0x10e5('0xd'),this[_0x10e5('0xe')]['bind'](this));ami['on'](_0x10e5('0xf'),this[_0x10e5('0x10')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x10e5('0xa')](this));ami['on'](_0x10e5('0x11'),this[_0x10e5('0x12')][_0x10e5('0xa')](this));ami['on'](_0x10e5('0x13'),this[_0x10e5('0x14')]['bind'](this));}function getDiff(_0x29ab3a){var _0x3e3abe=moment()[_0x10e5('0x15')](0x0);var _0x3758b3=moment(_0x29ab3a)[_0x10e5('0x15')](0x0);return _0x3e3abe['diff'](_0x3758b3,_0x10e5('0x16'));}Acw[_0x10e5('0x17')][_0x10e5('0x18')]=function(_0x7391ba,_0x310511){var _0x44ebe9=this;var _0x285cfd=getDiff(_0x44ebe9[_0x10e5('0x7')][_0x7391ba][_0x10e5('0x19')]);clearTimeout(_0x44ebe9[_0x10e5('0x7')][_0x7391ba][_0x10e5('0x1a')]);_0x44ebe9['timers'][_0x7391ba][_0x10e5('0x1a')]=![];return RpcVoiceAgentReport[_0x10e5('0x1b')]({'acwtime':_0x285cfd},_0x44ebe9[_0x10e5('0x7')][_0x7391ba][_0x10e5('0x1c')],_0x7391ba)[_0x10e5('0x1d')](function(_0x9603be){logger[_0x10e5('0x1e')](_0x10e5('0x1f'),_0x310511,_0x285cfd,_0x9603be);})['catch'](function(_0x12b35e){logger[_0x10e5('0x20')](_0x10e5('0x21'),_0x310511,_0x12b35e);})['finally'](function(){delete _0x44ebe9[_0x10e5('0x7')][_0x7391ba];});};Acw[_0x10e5('0x17')][_0x10e5('0x22')]=function(_0x32dd4c){try{var _0x4d3839=this;var _0x224ffb=this[_0x10e5('0x23')][_0x32dd4c]['interface'];var _0x1fe959=this[_0x10e5('0x23')][_0x32dd4c][_0x10e5('0x24')];var _0x5aaeec=this[_0x10e5('0x6')][_0x1fe959];var _0x20b85a=![];var _0x178f20=_0x10e5('0x25');if(_0x5aaeec[_0x10e5('0x26')]&&_0x5aaeec[_0x10e5('0x27')][_0x10e5('0x28')]){_0x20b85a=!![];_0x178f20=_0x5aaeec['mandatoryDispositionPause'][_0x10e5('0x28')];}return ami['Action']({'action':'QueuePause','interface':_0x224ffb,'paused':!![],'reason':_0x178f20})['then'](function(){if(_0x4d3839['agents'][_0x224ffb]){return RpcUser['getAgent'](_0x4d3839[_0x10e5('0x29')][_0x224ffb]['id'])[_0x10e5('0x1d')](function(_0x26866){if(!_0x26866||_0x26866['voicePause']){logger['info'](_0x10e5('0x2a'),_0x32dd4c,_0x224ffb,_0x1fe959);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x32dd4c,_0x224ffb,_0x1fe959);var _0x539ef5=_0x4d3839[_0x10e5('0x23')][_0x32dd4c][_0x10e5('0x2b')]&&_0x4d3839['channels'][_0x32dd4c][_0x10e5('0x2c')]?_0x4d3839[_0x10e5('0x23')][_0x32dd4c][_0x10e5('0x2c')]:_0x32dd4c;return RpcUser[_0x10e5('0x2d')](_0x4d3839['agents'][_0x224ffb],_0x178f20,_0x539ef5)[_0x10e5('0x1d')](function(_0x4a27f6){_0x4d3839[_0x10e5('0x6')][_0x1fe959][_0x10e5('0x2e')]-=0x1;_0x4d3839[_0x10e5('0x6')][_0x1fe959][_0x10e5('0x2f')]+=0x1;return _0x4a27f6;});})['then'](function(_0x34d4f2){if(_0x20b85a||!_0x34d4f2){return;}_0x4d3839['timers'][_0x224ffb]={};logger['info'](_0x10e5('0x30'),_0x32dd4c,_0x4d3839['voiceQueues'][_0x1fe959][_0x10e5('0x31')],_0x224ffb,_0x1fe959);_0x4d3839[_0x10e5('0x7')][_0x224ffb][_0x10e5('0x1a')]=setTimeout(_0x4d3839[_0x10e5('0x32')][_0x10e5('0xa')](_0x4d3839,_0x224ffb),_0x4d3839[_0x10e5('0x6')][_0x1fe959][_0x10e5('0x31')]*0x3e8);_0x4d3839['timers'][_0x224ffb][_0x10e5('0x19')]=moment()[_0x10e5('0x33')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d3839[_0x10e5('0x7')][_0x224ffb][_0x10e5('0x1c')]=_0x32dd4c;_0x4d3839[_0x10e5('0x7')][_0x224ffb][_0x10e5('0x24')]=_0x1fe959;_0x4d3839[_0x10e5('0x7')][_0x224ffb][_0x10e5('0x18')]=_0x4d3839['updateAcw'][_0x10e5('0xa')](_0x4d3839,_0x224ffb,_0x32dd4c);});}})['catch'](function(){logger[_0x10e5('0x20')](_0x10e5('0x30'),_0x32dd4c,_0x4d3839['voiceQueues'][_0x1fe959][_0x10e5('0x31')],_0x224ffb,_0x1fe959);})[_0x10e5('0x34')](function(){delete _0x4d3839[_0x10e5('0x23')][_0x32dd4c];});}catch(_0x11c405){logger[_0x10e5('0x20')](_0x10e5('0x35'),_0x11c405[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')]['stopAcw']=function(_0x4a4ec5){try{var _0x48ef06=this;if(_0x48ef06[_0x10e5('0x7')][_0x4a4ec5]){_0x48ef06[_0x10e5('0x7')][_0x4a4ec5][_0x10e5('0x1a')]=![];var _0x5370bd=_0x48ef06['timers'][_0x4a4ec5]['uniqueid'];var _0x179864=_0x48ef06['timers'][_0x4a4ec5][_0x10e5('0x24')];var _0x4eb8a4=_0x48ef06[_0x10e5('0x6')][_0x179864]['acwTimeout'];logger[_0x10e5('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x5370bd,_0x4a4ec5);RpcUser[_0x10e5('0x37')](this[_0x10e5('0x29')][_0x4a4ec5]['id'])[_0x10e5('0x1d')](function(_0x47333e){if(_0x47333e[_0x10e5('0x38')]===_0x10e5('0x25')){return RpcUser[_0x10e5('0x39')](_0x48ef06['agents'][_0x4a4ec5]);}});RpcVoiceAgentReport['update']({'acwtime':_0x4eb8a4,'agentacw':!![]},_0x5370bd,_0x4a4ec5)[_0x10e5('0x1d')](function(_0x4a1ecc){logger[_0x10e5('0x1e')](_0x10e5('0x1f'),_0x5370bd,_0x4eb8a4,_0x4a1ecc);})[_0x10e5('0x3a')](function(_0x331c56){logger[_0x10e5('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x5370bd,_0x331c56);});}else{logger[_0x10e5('0x20')](_0x10e5('0x3b'),_0x4a4ec5);if(_0x48ef06['timers']){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x48ef06['timers']));}}}catch(_0x3faf94){logger[_0x10e5('0x20')]('[ACW][STOP]\x20%s',_0x3faf94['message']);}};Acw[_0x10e5('0x17')]['syncAgentConnect']=function(_0x278822){try{if(this[_0x10e5('0x6')][_0x278822[_0x10e5('0x24')]]&&(this[_0x10e5('0x6')][_0x278822[_0x10e5('0x24')]][_0x10e5('0x4')]||this[_0x10e5('0x6')][_0x278822['queue']][_0x10e5('0x26')])){if(this[_0x10e5('0x29')][_0x278822[_0x10e5('0x3c')]]){this['channels'][_0x278822[_0x10e5('0x1c')]]={'queue':_0x278822['queue'],'interface':_0x278822[_0x10e5('0x3c')],'destlinkedid':_0x278822['destlinkedid']};}}}catch(_0x14bb76){logger[_0x10e5('0x20')](_0x10e5('0x3d'),_0x14bb76[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')][_0x10e5('0x14')]=function(_0x137d91){try{if(this['voiceQueues'][_0x137d91[_0x10e5('0x24')]]&&(this[_0x10e5('0x6')][_0x137d91[_0x10e5('0x24')]][_0x10e5('0x4')]||this['voiceQueues'][_0x137d91[_0x10e5('0x24')]][_0x10e5('0x26')])){if(this[_0x10e5('0x29')][_0x137d91[_0x10e5('0x3c')]]){this['channels'][_0x137d91['uniqueid']]={'queue':_0x137d91[_0x10e5('0x24')],'interface':_0x137d91[_0x10e5('0x3c')]};}}}catch(_0x27254c){logger['error'](_0x10e5('0x3e'),_0x27254c[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')][_0x10e5('0xc')]=function(_0x272e94){try{if(this[_0x10e5('0x23')][_0x272e94[_0x10e5('0x1c')]]&&_[_0x10e5('0x3f')](this['channels'][_0x272e94['uniqueid']][_0x10e5('0x2b')])){logger['info'](_0x10e5('0x40'),_0x272e94['uniqueid']);this['startAcw'](_0x272e94[_0x10e5('0x1c')]);}else if(this[_0x10e5('0x23')][_0x272e94[_0x10e5('0x41')]]&&_[_0x10e5('0x3f')](this[_0x10e5('0x23')][_0x272e94[_0x10e5('0x41')]][_0x10e5('0x2b')])){logger[_0x10e5('0x1e')](_0x10e5('0x42'),_0x272e94[_0x10e5('0x41')]);this[_0x10e5('0x22')](_0x272e94['linkedid']);}}catch(_0x422d0c){logger[_0x10e5('0x20')](_0x10e5('0x43'),_0x422d0c[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')][_0x10e5('0xe')]=function(_0x15675f){try{if(this[_0x10e5('0x23')][_0x15675f[_0x10e5('0x1c')]]&&this['channels'][_0x15675f[_0x10e5('0x1c')]][_0x10e5('0x2b')]){logger[_0x10e5('0x1e')](_0x10e5('0x44'),_0x15675f[_0x10e5('0x1c')]);this['startAcw'](_0x15675f[_0x10e5('0x1c')]);}else if(this['channels'][_0x15675f['linkedid']]&&this[_0x10e5('0x23')][_0x15675f[_0x10e5('0x41')]][_0x10e5('0x2b')]){logger[_0x10e5('0x1e')](_0x10e5('0x45'),_0x15675f[_0x10e5('0x41')]);this['startAcw'](_0x15675f['linkedid']);}}catch(_0x5af8c6){logger[_0x10e5('0x20')](_0x10e5('0x46'),_0x5af8c6['message']);}};Acw[_0x10e5('0x17')][_0x10e5('0x47')]=function(_0x26b731){try{if(!_[_0x10e5('0x48')](this[_0x10e5('0x23')][_0x26b731[_0x10e5('0x49')]])){this[_0x10e5('0x22')](_0x26b731['transfereeuniqueid']);if(this['channels'][_0x26b731[_0x10e5('0x4a')]]){this[_0x10e5('0x23')][_0x26b731[_0x10e5('0x4a')]]['attended']=!![];this['channels'][_0x26b731[_0x10e5('0x4b')]]=this['channels'][_0x26b731[_0x10e5('0x4a')]];this[_0x10e5('0x4c')](_0x26b731['secondtransfereruniqueid']);}}else if(!_[_0x10e5('0x48')](this[_0x10e5('0x23')][_0x26b731[_0x10e5('0x4b')]])){this[_0x10e5('0x22')](_0x26b731[_0x10e5('0x4b')]);if(this[_0x10e5('0x23')][_0x26b731['origtransfereruniqueid']]){this['channels'][_0x26b731[_0x10e5('0x4d')]][_0x10e5('0x2b')]=!![];this[_0x10e5('0x23')][_0x26b731[_0x10e5('0x49')]]=this['channels'][_0x26b731[_0x10e5('0x4d')]];this[_0x10e5('0x4c')](_0x26b731[_0x10e5('0x4d')]);}}}catch(_0x2731cb){logger[_0x10e5('0x20')](_0x10e5('0x4e'),_0x2731cb[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')][_0x10e5('0x12')]=function(_0x3b6fcb){try{if(this[_0x10e5('0x23')][_0x3b6fcb[_0x10e5('0x4f')]]){logger[_0x10e5('0x1e')](_0x10e5('0x50'),JSON[_0x10e5('0x51')](_0x3b6fcb['transfereruniqueid']));this[_0x10e5('0x22')](_0x3b6fcb[_0x10e5('0x4f')]);}else if(this['channels'][_0x3b6fcb[_0x10e5('0x52')]]){logger[_0x10e5('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x10e5('0x51')](_0x3b6fcb[_0x10e5('0x52')]));this[_0x10e5('0x22')](_0x3b6fcb[_0x10e5('0x52')]);}}catch(_0x3a862f){logger[_0x10e5('0x20')](_0x10e5('0x53'),_0x3a862f[_0x10e5('0x36')]);}};Acw[_0x10e5('0x17')]['syncAgentRingNoAnswer']=function(_0x89895f){try{if(this[_0x10e5('0x6')][_0x89895f[_0x10e5('0x24')]]&&this[_0x10e5('0x6')][_0x89895f[_0x10e5('0x24')]]['autopause']==='all'){if(this[_0x10e5('0x29')][_0x89895f['interface']]){logger[_0x10e5('0x1e')](_0x10e5('0x54'),_0x89895f[_0x10e5('0x1c')],_0x89895f[_0x10e5('0x3c')],_0x89895f[_0x10e5('0x24')]);return RpcUser[_0x10e5('0x2d')](this[_0x10e5('0x29')][_0x89895f[_0x10e5('0x3c')]],_0x10e5('0x55'),_0x89895f['uniqueid']);}}}catch(_0x7e629f){logger[_0x10e5('0x20')](_0x10e5('0x56'),_0x7e629f[_0x10e5('0x36')]);}};Acw['prototype'][_0x10e5('0x4c')]=function(_0x1667c2,_0x261f8f=0x2710){if(this['channels'][_0x1667c2]){setTimeout(()=>{delete this[_0x10e5('0x23')][_0x1667c2];},_0x261f8f);}};module[_0x10e5('0x57')]=Acw; \ No newline at end of file +var _0xd982=['[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','interface','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','isNil','transfertargetuniqueid','origtransfereruniqueid'];(function(_0x3a095e,_0xd1e5dc){var _0x3f13bf=function(_0x421779){while(--_0x421779){_0x3a095e['push'](_0x3a095e['shift']());}};_0x3f13bf(++_0xd1e5dc);}(_0xd982,0x174));var _0x2d98=function(_0x28aeb2,_0x319b38){_0x28aeb2=_0x28aeb2-0x0;var _0x1d33e1=_0xd982[_0x28aeb2];return _0x1d33e1;};'use strict';var _=require(_0x2d98('0x0'));var moment=require(_0x2d98('0x1'));var ami=require(_0x2d98('0x2'));var logger=require('../../../config/logger')(_0x2d98('0x3'));var RpcUser=require(_0x2d98('0x4'));var RpcVoiceAgentReport=require(_0x2d98('0x5'));function Acw(_0x3b45cf){this['voiceQueues']=_0x3b45cf['voiceQueues'];this[_0x2d98('0x6')]=_0x3b45cf['agents'];this['timers']=_0x3b45cf[_0x2d98('0x7')];this[_0x2d98('0x8')]={};ami['on'](_0x2d98('0x9'),this[_0x2d98('0xa')][_0x2d98('0xb')](this));ami['on'](_0x2d98('0xc'),this[_0x2d98('0xd')][_0x2d98('0xb')](this));ami['on'](_0x2d98('0xe'),this['syncHangup'][_0x2d98('0xb')](this));ami['on']('agentringnoanswer',this[_0x2d98('0xf')][_0x2d98('0xb')](this));ami['on'](_0x2d98('0x10'),this['syncAttendedTransfer'][_0x2d98('0xb')](this));ami['on'](_0x2d98('0x11'),this[_0x2d98('0x12')][_0x2d98('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x2d98('0x13')][_0x2d98('0xb')](this));}function getDiff(_0x201c81){var _0x3ee611=moment()[_0x2d98('0x14')](0x0);var _0x23b587=moment(_0x201c81)[_0x2d98('0x14')](0x0);return _0x3ee611[_0x2d98('0x15')](_0x23b587,_0x2d98('0x16'));}Acw['prototype'][_0x2d98('0x17')]=function(_0x35fdeb,_0x376644){var _0xb0dadc=this;var _0x2b053a=getDiff(_0xb0dadc[_0x2d98('0x7')][_0x35fdeb][_0x2d98('0x18')]);clearTimeout(_0xb0dadc['timers'][_0x35fdeb][_0x2d98('0x19')]);_0xb0dadc[_0x2d98('0x7')][_0x35fdeb][_0x2d98('0x19')]=![];return RpcVoiceAgentReport[_0x2d98('0x1a')]({'acwtime':_0x2b053a},_0xb0dadc[_0x2d98('0x7')][_0x35fdeb][_0x2d98('0x1b')],_0x35fdeb)[_0x2d98('0x1c')](function(_0x193a4b){logger[_0x2d98('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x376644,_0x2b053a,_0x193a4b);})[_0x2d98('0x1e')](function(_0x15ab4b){logger[_0x2d98('0x1f')](_0x2d98('0x20'),_0x376644,_0x15ab4b);})[_0x2d98('0x21')](function(){delete _0xb0dadc[_0x2d98('0x7')][_0x35fdeb];});};Acw[_0x2d98('0x22')]['startAcw']=function(_0x487987){try{var _0x1ae610=this;var _0xdbe0b8=this[_0x2d98('0x8')][_0x487987][_0x2d98('0x23')];var _0x1f95d4=this[_0x2d98('0x8')][_0x487987]['queue'];var _0x19aefa=this[_0x2d98('0x24')][_0x1f95d4];var _0x5dbba5=![];var _0x4db82e=_0x2d98('0x25');if(_0x19aefa[_0x2d98('0x26')]&&_0x19aefa[_0x2d98('0x27')][_0x2d98('0x28')]){_0x5dbba5=!![];_0x4db82e=_0x19aefa[_0x2d98('0x27')]['name'];}return ami['Action']({'action':'QueuePause','interface':_0xdbe0b8,'paused':!![],'reason':_0x4db82e})[_0x2d98('0x1c')](function(){if(_0x1ae610[_0x2d98('0x6')][_0xdbe0b8]){return RpcUser['getAgent'](_0x1ae610['agents'][_0xdbe0b8]['id'])[_0x2d98('0x1c')](function(_0x1a1e3b){if(!_0x1a1e3b||_0x1a1e3b[_0x2d98('0x29')]){logger[_0x2d98('0x1d')](_0x2d98('0x2a'),_0x487987,_0xdbe0b8,_0x1f95d4);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x487987,_0xdbe0b8,_0x1f95d4);var _0x10532f=_0x1ae610[_0x2d98('0x8')][_0x487987][_0x2d98('0x2b')]&&_0x1ae610['channels'][_0x487987][_0x2d98('0x2c')]?_0x1ae610[_0x2d98('0x8')][_0x487987]['destlinkedid']:_0x487987;return RpcUser['savePause'](_0x1ae610[_0x2d98('0x6')][_0xdbe0b8],_0x4db82e,_0x10532f)[_0x2d98('0x1c')](function(_0x37390d){_0x1ae610[_0x2d98('0x24')][_0x1f95d4][_0x2d98('0x2d')]-=0x1;_0x1ae610[_0x2d98('0x24')][_0x1f95d4][_0x2d98('0x2e')]+=0x1;return _0x37390d;});})[_0x2d98('0x1c')](function(_0x1455b1){if(_0x5dbba5||!_0x1455b1){return;}_0x1ae610[_0x2d98('0x7')][_0xdbe0b8]={};logger[_0x2d98('0x1d')](_0x2d98('0x2f'),_0x487987,_0x1ae610[_0x2d98('0x24')][_0x1f95d4][_0x2d98('0x30')],_0xdbe0b8,_0x1f95d4);_0x1ae610[_0x2d98('0x7')][_0xdbe0b8][_0x2d98('0x19')]=setTimeout(_0x1ae610[_0x2d98('0x31')][_0x2d98('0xb')](_0x1ae610,_0xdbe0b8),_0x1ae610['voiceQueues'][_0x1f95d4]['acwTimeout']*0x3e8);_0x1ae610['timers'][_0xdbe0b8][_0x2d98('0x18')]=moment()[_0x2d98('0x32')](_0x2d98('0x33'));_0x1ae610['timers'][_0xdbe0b8][_0x2d98('0x1b')]=_0x487987;_0x1ae610[_0x2d98('0x7')][_0xdbe0b8][_0x2d98('0x34')]=_0x1f95d4;_0x1ae610['timers'][_0xdbe0b8][_0x2d98('0x17')]=_0x1ae610[_0x2d98('0x17')][_0x2d98('0xb')](_0x1ae610,_0xdbe0b8,_0x487987);});}})['catch'](function(){logger[_0x2d98('0x1f')](_0x2d98('0x2f'),_0x487987,_0x1ae610[_0x2d98('0x24')][_0x1f95d4]['acwTimeout'],_0xdbe0b8,_0x1f95d4);})['finally'](function(){delete _0x1ae610['channels'][_0x487987];});}catch(_0x20d572){logger[_0x2d98('0x1f')](_0x2d98('0x35'),_0x20d572[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')][_0x2d98('0x31')]=function(_0xf8ee58){try{var _0x4f605a=this;if(_0x4f605a[_0x2d98('0x7')][_0xf8ee58]){_0x4f605a['timers'][_0xf8ee58]['timer']=![];var _0x5c3eb1=_0x4f605a['timers'][_0xf8ee58]['uniqueid'];var _0x3da5f6=_0x4f605a[_0x2d98('0x7')][_0xf8ee58][_0x2d98('0x34')];var _0x12c20c=_0x4f605a[_0x2d98('0x24')][_0x3da5f6][_0x2d98('0x30')];logger[_0x2d98('0x1d')](_0x2d98('0x37'),_0x5c3eb1,_0xf8ee58);RpcUser['getAgent'](this[_0x2d98('0x6')][_0xf8ee58]['id'])[_0x2d98('0x1c')](function(_0x1c1fd5){if(_0x1c1fd5['pauseType']===_0x2d98('0x25')){return RpcUser[_0x2d98('0x38')](_0x4f605a['agents'][_0xf8ee58]);}});RpcVoiceAgentReport[_0x2d98('0x1a')]({'acwtime':_0x12c20c,'agentacw':!![]},_0x5c3eb1,_0xf8ee58)[_0x2d98('0x1c')](function(_0x4bffac){logger[_0x2d98('0x1d')](_0x2d98('0x39'),_0x5c3eb1,_0x12c20c,_0x4bffac);})[_0x2d98('0x1e')](function(_0x58172e){logger[_0x2d98('0x1f')](_0x2d98('0x20'),_0x5c3eb1,_0x58172e);});}else{logger[_0x2d98('0x1f')](_0x2d98('0x3a'),_0xf8ee58);if(_0x4f605a[_0x2d98('0x7')]){logger[_0x2d98('0x1d')](_0x2d98('0x3b'),JSON['stringify'](_0x4f605a['timers']));}}}catch(_0x4e27cd){logger[_0x2d98('0x1f')](_0x2d98('0x3c'),_0x4e27cd[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')][_0x2d98('0xa')]=function(_0x5ece91){try{if(this['voiceQueues'][_0x5ece91[_0x2d98('0x34')]]&&(this[_0x2d98('0x24')][_0x5ece91[_0x2d98('0x34')]][_0x2d98('0x3')]||this['voiceQueues'][_0x5ece91[_0x2d98('0x34')]][_0x2d98('0x26')])){if(this['agents'][_0x5ece91[_0x2d98('0x23')]]){this['channels'][_0x5ece91['uniqueid']]={'queue':_0x5ece91[_0x2d98('0x34')],'interface':_0x5ece91[_0x2d98('0x23')],'destlinkedid':_0x5ece91['destlinkedid']};}}}catch(_0x2f7756){logger[_0x2d98('0x1f')](_0x2d98('0x3d'),_0x2f7756['message']);}};Acw['prototype'][_0x2d98('0x13')]=function(_0x36d5e3){try{if(this['voiceQueues'][_0x36d5e3[_0x2d98('0x34')]]&&(this[_0x2d98('0x24')][_0x36d5e3[_0x2d98('0x34')]]['acw']||this[_0x2d98('0x24')][_0x36d5e3[_0x2d98('0x34')]][_0x2d98('0x26')])){if(this[_0x2d98('0x6')][_0x36d5e3[_0x2d98('0x23')]]){this[_0x2d98('0x8')][_0x36d5e3[_0x2d98('0x1b')]]={'queue':_0x36d5e3[_0x2d98('0x34')],'interface':_0x36d5e3[_0x2d98('0x23')]};}}}catch(_0x3af21f){logger[_0x2d98('0x1f')](_0x2d98('0x3e'),_0x3af21f['message']);}};Acw[_0x2d98('0x22')][_0x2d98('0xd')]=function(_0x22e6ca){try{if(this[_0x2d98('0x8')][_0x22e6ca['uniqueid']]&&_['isUndefined'](this[_0x2d98('0x8')][_0x22e6ca[_0x2d98('0x1b')]][_0x2d98('0x2b')])){logger[_0x2d98('0x1d')](_0x2d98('0x3f'),_0x22e6ca['uniqueid']);this['startAcw'](_0x22e6ca[_0x2d98('0x1b')]);}else if(this[_0x2d98('0x8')][_0x22e6ca[_0x2d98('0x40')]]&&_[_0x2d98('0x41')](this['channels'][_0x22e6ca[_0x2d98('0x40')]]['attended'])){logger[_0x2d98('0x1d')](_0x2d98('0x42'),_0x22e6ca['linkedid']);this[_0x2d98('0x43')](_0x22e6ca['linkedid']);}}catch(_0x46788a){logger[_0x2d98('0x1f')](_0x2d98('0x44'),_0x46788a['message']);}};Acw[_0x2d98('0x22')][_0x2d98('0x45')]=function(_0x2554fb){try{if(this[_0x2d98('0x8')][_0x2554fb[_0x2d98('0x1b')]]&&this[_0x2d98('0x8')][_0x2554fb[_0x2d98('0x1b')]][_0x2d98('0x2b')]){logger[_0x2d98('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2554fb[_0x2d98('0x1b')]);this[_0x2d98('0x43')](_0x2554fb[_0x2d98('0x1b')]);}else if(this[_0x2d98('0x8')][_0x2554fb[_0x2d98('0x40')]]&&this['channels'][_0x2554fb['linkedid']][_0x2d98('0x2b')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2554fb[_0x2d98('0x40')]);this[_0x2d98('0x43')](_0x2554fb[_0x2d98('0x40')]);}}catch(_0x2dff32){logger['error'](_0x2d98('0x46'),_0x2dff32[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')][_0x2d98('0x47')]=function(_0x2cbcdb){try{if(!_['isNil'](this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x48')]])){this[_0x2d98('0x43')](_0x2cbcdb[_0x2d98('0x48')]);if(this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x49')]]){this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x49')]][_0x2d98('0x2b')]=!![];this[_0x2d98('0x8')][_0x2cbcdb['transfertargetuniqueid']]=this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x49')]];this[_0x2d98('0x4a')](_0x2cbcdb[_0x2d98('0x49')]);}}else if(!_[_0x2d98('0x4b')](this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x4c')]])){this[_0x2d98('0x43')](_0x2cbcdb[_0x2d98('0x4c')]);if(this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x4d')]]){this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x4d')]][_0x2d98('0x2b')]=!![];this[_0x2d98('0x8')][_0x2cbcdb['transfereeuniqueid']]=this[_0x2d98('0x8')][_0x2cbcdb[_0x2d98('0x4d')]];this[_0x2d98('0x4a')](_0x2cbcdb[_0x2d98('0x4d')]);}}}catch(_0x246226){logger[_0x2d98('0x1f')](_0x2d98('0x4e'),_0x246226[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')][_0x2d98('0x12')]=function(_0x1d8d36){try{if(this[_0x2d98('0x8')][_0x1d8d36[_0x2d98('0x4f')]]){logger[_0x2d98('0x1d')](_0x2d98('0x50'),JSON[_0x2d98('0x51')](_0x1d8d36[_0x2d98('0x4f')]));this['startAcw'](_0x1d8d36['transfereruniqueid']);}else if(this['channels'][_0x1d8d36[_0x2d98('0x52')]]){logger[_0x2d98('0x1d')](_0x2d98('0x53'),JSON['stringify'](_0x1d8d36['transfererlinkedid']));this[_0x2d98('0x43')](_0x1d8d36[_0x2d98('0x52')]);}}catch(_0x59c99d){logger[_0x2d98('0x1f')](_0x2d98('0x54'),_0x59c99d[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')]['syncAgentRingNoAnswer']=function(_0xda476d){try{if(this[_0x2d98('0x24')][_0xda476d['queue']]&&this['voiceQueues'][_0xda476d['queue']][_0x2d98('0x55')]===_0x2d98('0x56')){if(this[_0x2d98('0x6')][_0xda476d['interface']]){logger[_0x2d98('0x1d')](_0x2d98('0x57'),_0xda476d[_0x2d98('0x1b')],_0xda476d[_0x2d98('0x23')],_0xda476d['queue']);return RpcUser['savePause'](this[_0x2d98('0x6')][_0xda476d[_0x2d98('0x23')]],_0x2d98('0x58'),_0xda476d[_0x2d98('0x1b')]);}}}catch(_0x5f4941){logger[_0x2d98('0x1f')](_0x2d98('0x59'),_0x5f4941[_0x2d98('0x36')]);}};Acw[_0x2d98('0x22')][_0x2d98('0x4a')]=function(_0xb9b898,_0x5bfdca=0x2710){if(this['channels'][_0xb9b898]){setTimeout(()=>{delete this[_0x2d98('0x8')][_0xb9b898];},_0x5bfdca);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 789fef5..71e5dfb 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 _0x91fd=['catch','exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipPeerStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91fd,0x161));var _0xd91f=function(_0x5315db,_0x16a1d6){_0x5315db=_0x5315db-0x0;var _0x2587ed=_0x91fd[_0x5315db];return _0x2587ed;};'use strict';var Manager=require(_0xd91f('0x0'));var BPromise=require('bluebird');var util=require(_0xd91f('0x1'));var logger=require(_0xd91f('0x2'))(_0xd91f('0x3'));var config=require(_0xd91f('0x4'));var ami=new Manager(config['asterisk'][_0xd91f('0x5')],config[_0xd91f('0x6')]['ip'],config[_0xd91f('0x6')][_0xd91f('0x7')],config['asterisk'][_0xd91f('0x8')],!![]);ami[_0xd91f('0x9')]();ami['Action']=BPromise[_0xd91f('0xa')](ami[_0xd91f('0xb')]);function error(_0x52e282){logger[_0xd91f('0xc')](util[_0xd91f('0xd')](_0xd91f('0xe'),config['asterisk'][_0xd91f('0x7')],config[_0xd91f('0x6')]['ip'],config[_0xd91f('0x6')][_0xd91f('0x5')],util[_0xd91f('0xf')](_0x52e282,![],null)));}function close(){logger[_0xd91f('0xc')](util[_0xd91f('0xd')](_0xd91f('0x10'),config[_0xd91f('0x6')][_0xd91f('0x7')],config[_0xd91f('0x6')]['ip'],config[_0xd91f('0x6')][_0xd91f('0x5')]));}ami[_0xd91f('0x11')]=function(){return function(){return ami[_0xd91f('0x12')]({'action':_0xd91f('0x13')});};};ami[_0xd91f('0x14')]=function(){return function(){return ami['Action']({'action':_0xd91f('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xd91f('0x12')]({'action':_0xd91f('0x16')});};};ami[_0xd91f('0x17')]=function(){return function(){return ami['Action']({'action':_0xd91f('0x18')});};};ami[_0xd91f('0x19')]=function(){return function(){return ami[_0xd91f('0x12')]({'action':_0xd91f('0x1a')});};};function connect(){logger[_0xd91f('0x1b')](util[_0xd91f('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xd91f('0x6')][_0xd91f('0x7')],config[_0xd91f('0x6')]['ip'],config[_0xd91f('0x6')][_0xd91f('0x5')]));ami[_0xd91f('0x1c')](_0xd91f('0xc'),error);ami[_0xd91f('0x1c')](_0xd91f('0x1d'),close);}ami['on'](_0xd91f('0x1e'),connect);ami['on'](_0xd91f('0x1f'),function(_0x5c34f4){logger[_0xd91f('0x1b')](util[_0xd91f('0xd')](_0xd91f('0x20'),config['asterisk'][_0xd91f('0x7')],config['asterisk']['ip'],config[_0xd91f('0x6')][_0xd91f('0x5')],util[_0xd91f('0xf')](_0x5c34f4,![],null)));});ami['on'](_0xd91f('0x21'),function(){logger[_0xd91f('0x1b')](util[_0xd91f('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0xd91f('0x6')][_0xd91f('0x5')]));return Promise[_0xd91f('0x22')]()[_0xd91f('0x23')](ami['actionSipShowRegistry']())[_0xd91f('0x23')](ami[_0xd91f('0x14')]())['then'](ami[_0xd91f('0x24')]())[_0xd91f('0x23')](ami[_0xd91f('0x17')]())['then'](ami['actionCoreShowChannels']())[_0xd91f('0x25')](function(_0x58b2c3){logger[_0xd91f('0xc')]('[ami.js][fullybooted]',util[_0xd91f('0xf')](_0x58b2c3,{'showHidden':![],'depth':null}));});});ami[_0xd91f('0x1c')]('error',error);ami['once']('close',close);module[_0xd91f('0x26')]=ami; \ No newline at end of file +var _0x6f59=['actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username'];(function(_0x19c315,_0x2b2e84){var _0x3dc378=function(_0x258022){while(--_0x258022){_0x19c315['push'](_0x19c315['shift']());}};_0x3dc378(++_0x2b2e84);}(_0x6f59,0x11f));var _0x96f5=function(_0x1cfc0c,_0x484b58){_0x1cfc0c=_0x1cfc0c-0x0;var _0x5266fe=_0x6f59[_0x1cfc0c];return _0x5266fe;};'use strict';var Manager=require(_0x96f5('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x96f5('0x1'))(_0x96f5('0x2'));var config=require(_0x96f5('0x3'));var ami=new Manager(config[_0x96f5('0x4')][_0x96f5('0x5')],config[_0x96f5('0x4')]['ip'],config[_0x96f5('0x4')]['username'],config[_0x96f5('0x4')][_0x96f5('0x6')],!![]);ami[_0x96f5('0x7')]();ami[_0x96f5('0x8')]=BPromise[_0x96f5('0x9')](ami[_0x96f5('0xa')]);function error(_0xa4ec3a){logger[_0x96f5('0xb')](util[_0x96f5('0xc')](_0x96f5('0xd'),config[_0x96f5('0x4')]['username'],config[_0x96f5('0x4')]['ip'],config[_0x96f5('0x4')][_0x96f5('0x5')],util[_0x96f5('0xe')](_0xa4ec3a,![],null)));}function close(){logger['error'](util[_0x96f5('0xc')](_0x96f5('0xf'),config[_0x96f5('0x4')][_0x96f5('0x10')],config[_0x96f5('0x4')]['ip'],config[_0x96f5('0x4')][_0x96f5('0x5')]));}ami[_0x96f5('0x11')]=function(){return function(){return ami['Action']({'action':_0x96f5('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x96f5('0x13')});};};ami[_0x96f5('0x14')]=function(){return function(){return ami[_0x96f5('0x8')]({'action':_0x96f5('0x15')});};};ami[_0x96f5('0x16')]=function(){return function(){return ami[_0x96f5('0x8')]({'action':_0x96f5('0x17')});};};ami[_0x96f5('0x18')]=function(){return function(){return ami[_0x96f5('0x8')]({'action':_0x96f5('0x19')});};};function connect(){logger[_0x96f5('0x1a')](util[_0x96f5('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x96f5('0x4')]['username'],config[_0x96f5('0x4')]['ip'],config['asterisk'][_0x96f5('0x5')]));ami[_0x96f5('0x1b')]('error',error);ami['once'](_0x96f5('0x1c'),close);}ami['on'](_0x96f5('0x1d'),connect);ami['on']('shutdown',function(_0x304c7d){logger[_0x96f5('0x1a')](util[_0x96f5('0xc')](_0x96f5('0x1e'),config[_0x96f5('0x4')][_0x96f5('0x10')],config[_0x96f5('0x4')]['ip'],config[_0x96f5('0x4')][_0x96f5('0x5')],util['inspect'](_0x304c7d,![],null)));});ami['on'](_0x96f5('0x1f'),function(){logger[_0x96f5('0x1a')](util[_0x96f5('0xc')](_0x96f5('0x20'),config[_0x96f5('0x4')][_0x96f5('0x10')],config[_0x96f5('0x4')]['ip'],config[_0x96f5('0x4')][_0x96f5('0x5')]));return Promise['resolve']()[_0x96f5('0x21')](ami['actionSipShowRegistry']())[_0x96f5('0x21')](ami[_0x96f5('0x22')]())[_0x96f5('0x21')](ami['actionSipPeerStatus']())[_0x96f5('0x21')](ami[_0x96f5('0x16')]())[_0x96f5('0x21')](ami['actionCoreShowChannels']())[_0x96f5('0x23')](function(_0x589354){logger['error'](_0x96f5('0x24'),util[_0x96f5('0xe')](_0x589354,{'showHidden':![],'depth':null}));});});ami['once'](_0x96f5('0xb'),error);ami[_0x96f5('0x1b')](_0x96f5('0x1c'),close);module[_0x96f5('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7f074c8..da0e900 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xda3f,0xec));var _0xfda3=function(_0x2d0224,_0x17dd72){_0x2d0224=_0x2d0224-0x0;var _0x79d21d=_0xda3f[_0x2d0224];return _0x79d21d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0xac4a,0x13f));var _0xaac4=function(_0x4cb155,_0x3d3b63){_0x4cb155=_0x4cb155-0x0;var _0x40885b=_0xac4a[_0x4cb155];return _0x40885b;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 23d3242..599eba8 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 _0x70c8=['SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','finally','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','object','reason','custom:agentnosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','milliseconds','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','originated','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','not_inuse','push','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[handlePower]','[getContactCampaign2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','util','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/agentComplete','./models/hangup','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','[ifTime][Action]','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','timezones','\x20Timezone\x20unknow\x20','length','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','decrementOriginate','[syncAgentConnect]','answertime','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','agiafterat','countglobal','voiceQueue','dialDropMaxRetry','additional','countdropretry','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','rescheduleContact','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','isNil','locked','stateinterface','pick','idHopper','paused','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','ivr','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','createHistory','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','AMD','countcongestionretry','reason19\x20machine....','reason\x2019\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','UserId','[emptyContact][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','variables'];(function(_0x3bdf9c,_0x4c0c11){var _0x460c47=function(_0x1c92b7){while(--_0x1c92b7){_0x3bdf9c['push'](_0x3bdf9c['shift']());}};_0x460c47(++_0x4c0c11);}(_0x70c8,0x9d));var _0x870c=function(_0x1900b5,_0x444496){_0x1900b5=_0x1900b5-0x0;var _0x22358d=_0x70c8[_0x1900b5];return _0x22358d;};'use strict';var util=require(_0x870c('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x870c('0x1'));var utils=require('./utils');var hopperUtils=require(_0x870c('0x2'));var ut=require('../preview/util/util');var config=require(_0x870c('0x3'));var logger=require(_0x870c('0x4'))(_0x870c('0x5'));var loggerBooked=require('../../../config/logger')(_0x870c('0x6'));var loggerPredictive=require(_0x870c('0x4'))(_0x870c('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x870c('0x8'));var loggerSyncQueueSummary=require(_0x870c('0x4'))(_0x870c('0x9'));var ami=require(_0x870c('0xa'));config['redis']=_[_0x870c('0xb')](config[_0x870c('0xc')],{'host':_0x870c('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x870c('0xe'));var voiceQueueRt=require(_0x870c('0xf'));var RpcSetting=require(_0x870c('0x10'));var Interval=require('../rpc/interval');var Action=require(_0x870c('0x11'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x870c('0x12'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x870c('0x13'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x870c('0x14')][_0x870c('0x15')]=function(_0x2a175f){this[_0x870c('0x16')]=this[_0x870c('0x16')]?this[_0x870c('0x16')]['finally'](_0x2a175f):_0x2a175f();};function Dialer(_0x41f067,_0xc342a1){this[_0x870c('0x17')]=new Sequence();this[_0x870c('0x18')]=_0xc342a1;this[_0x870c('0x19')]=_0x41f067[_0x870c('0x19')];this[_0x870c('0x1a')]=_0x41f067[_0x870c('0x1a')];this[_0x870c('0x1b')]=_0x41f067[_0x870c('0x1b')];this[_0x870c('0x1c')]=_0x41f067[_0x870c('0x1c')];this['maxNumberOriginate']=config[_0x870c('0x1d')]||0x2;this['channels']={};this[_0x870c('0x1e')]={};this[_0x870c('0x1f')]={};this[_0x870c('0x20')]={};this[_0x870c('0x21')]={};this['startPredictive']={};this[_0x870c('0x22')]={};this['ivrOriginated']={};this[_0x870c('0x23')]={};this[_0x870c('0x24')]={};this[_0x870c('0x25')]={};ami['on'](_0x870c('0x26'),this[_0x870c('0x27')]['bind'](this));ami['on']('queuecallerabandon',this[_0x870c('0x28')][_0x870c('0x29')](this));ami['on']('originateresponse',this[_0x870c('0x2a')][_0x870c('0x29')](this));ami['on'](_0x870c('0x2b'),this[_0x870c('0x2c')]['bind'](this));ami['on'](_0x870c('0x2d'),this[_0x870c('0x9')][_0x870c('0x29')](this));ami['on']('custom:queuesummarycomplete',this[_0x870c('0x2e')]['bind'](this));ami['on'](_0x870c('0x2f'),this[_0x870c('0x30')][_0x870c('0x29')](this));ami['on'](_0x870c('0x31'),this[_0x870c('0x32')][_0x870c('0x29')](this));ami['on'](_0x870c('0x33'),this[_0x870c('0x34')]['bind'](this));ami['on'](_0x870c('0x35'),this['syncQueueMember'][_0x870c('0x29')](this));ami['on']('queuestatuscomplete',this[_0x870c('0x36')][_0x870c('0x29')](this));this[_0x870c('0x37')]();this['loopClearZombieChannels']();RpcSetting[_0x870c('0x38')]()[_0x870c('0x39')](function(_0x3681c7){previewRecallmeReminderInterval=_0x3681c7[_0x870c('0x3a')];});}function isNotNull(_0x198559){return _0x198559!==null&&!_[_0x870c('0x3b')](_0x198559);}function msgResponse(_0x41c936,_0x961a25,_0x51a0a0){return{'action':_0x41c936,'response':_0x961a25,'message':_0x51a0a0,'stack':_0x51a0a0};}function emit(_0x59f277,_0x543ffa,_0x329aac){io['to'](_0x59f277)['emit'](_0x543ffa,_0x329aac);}function emitOutboundVoiceQueueSummary(_0x3235f4){if(_0x3235f4[_0x870c('0x3c')]===_0x870c('0x3d')){logger[_0x870c('0x3e')](_0x870c('0x3f'),util[_0x870c('0x40')](_0x3235f4,{'showHidden':![],'depth':null}));emit(util[_0x870c('0x41')](_0x870c('0x42'),_0x3235f4[_0x870c('0x43')]),_0x870c('0x44'),_0x3235f4);}}function checkGetDataPredictive(_0x1aa16b){if(isNotNull(_0x1aa16b)&&!_[_0x870c('0x45')](_0x1aa16b)){loggerPredictive[_0x870c('0x46')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x870c('0x46')](_0x870c('0x47'),_0x1aa16b[_0x870c('0x48')]);loggerPredictive[_0x870c('0x46')](_0x870c('0x49'),_0x1aa16b[_0x870c('0x4a')]);loggerPredictive[_0x870c('0x46')](_0x870c('0x4b'),_0x1aa16b[_0x870c('0x4c')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa16b[_0x870c('0x4d')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa16b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x870c('0x46')](_0x870c('0x4e'),_0x1aa16b[_0x870c('0x4f')]);loggerPredictive[_0x870c('0x46')]('---------------------------');if(_0x1aa16b[_0x870c('0x48')]>0x0){if(!_[_0x870c('0x3b')](_0x1aa16b['predictiveIntervalAvgTalktime'])&&_0x1aa16b[_0x870c('0x4f')]>0x0){return!![];}loggerPredictive[_0x870c('0x46')](_0x870c('0x50'));if(!_[_0x870c('0x3b')](_0x1aa16b['predictiveIntervalAvgHoldtime'])&&_0x1aa16b[_0x870c('0x51')]>0x0){return!![];}loggerPredictive['info'](_0x870c('0x52'));}else{loggerPredictive[_0x870c('0x46')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x870c('0x46')](_0x870c('0x53'));}return![];}function mergeDataErlangB(_0x254f77){return function(_0x2d9a85){loggerPredictive[_0x870c('0x46')](_0x870c('0x54'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d9a85['erlangCalls']);loggerPredictive[_0x870c('0x46')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d9a85['erlangCallToSecond']);loggerPredictive['info'](_0x870c('0x55'),_0x2d9a85[_0x870c('0x56')]);loggerPredictive[_0x870c('0x46')](_0x870c('0x57'),_0x2d9a85['erlangBusyFactor']);loggerPredictive[_0x870c('0x46')](_0x870c('0x55'),_0x2d9a85[_0x870c('0x56')]);loggerPredictive[_0x870c('0x46')](_0x870c('0x58'));_[_0x870c('0x59')](_0x254f77,_0x2d9a85);};}function ifInterval(_0x325dc8,_0x3ab743){if(_[_0x870c('0x3b')](_0x3ab743)){return![];}return utils[_0x870c('0x5a')](undefined,_0x3ab743)<_0x325dc8*0x3c;}function clearPredictiveAttributes(_0x268ebd){if(_0x268ebd[_0x870c('0x22')]){_0x268ebd[_0x870c('0x22')]=undefined;loggerPredictive[_0x870c('0x3e')](_0x268ebd[_0x870c('0x43')],_0x870c('0x5b'));}if(_0x268ebd['startPredictive']){_0x268ebd[_0x870c('0x5c')]=undefined;loggerPredictive[_0x870c('0x3e')](_0x268ebd['name'],'startPredictive\x20value\x20cleared');}if(_0x268ebd[_0x870c('0x5d')]){clearInterval(_0x268ebd[_0x870c('0x5d')]);_0x268ebd[_0x870c('0x5d')]=undefined;loggerPredictive[_0x870c('0x3e')](_0x268ebd[_0x870c('0x43')],_0x870c('0x5e'));}}function loggerCatchPredictive(_0x437836,_0x2fac55){return function(_0x40b3d6){loggerPredictive['error'](_0x2fac55[_0x870c('0x43')],_0x437836);loggerPredictive[_0x870c('0x5f')](_0x40b3d6[_0x870c('0x60')]);clearPredictiveAttributes(_0x2fac55);};}function loggerCatch(_0x4fbb55){return function(_0x5a437e){logger[_0x870c('0x5f')](_0x4fbb55,util[_0x870c('0x40')](_0x5a437e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4f1142){return function(_0x256c38){if(isNotNull(_0x256c38)&&isNotNull(_0x256c38[0x0])){if(_0x256c38[0x0][_0x870c('0x61')]>0x0){_0x4f1142[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x64')];logger[_0x870c('0x46')]('[getContactDialer2][ReScheduled]'+_0x4f1142[_0x870c('0x43')],_0x256c38[0x0]['contactsRescheduled'],_0x870c('0x65'));}else{_0x4f1142['message']=utils[_0x870c('0x63')][_0x870c('0x66')];logger[_0x870c('0x46')](_0x870c('0x67')+_0x4f1142[_0x870c('0x43')]);}}};}function createObjHistory(_0x574fb9,_0x26fb4f,_0x51b905,_0x4ee133,_0x21b5e6){_0x574fb9[_0x870c('0x62')]=_0x51b905;var _0x39d7c7=new Action(_0x574fb9,_0x26fb4f);var _0x46f02b=new History(_0x39d7c7);_0x46f02b[_0x870c('0x68')]=_0x4ee133;_0x46f02b[_0x870c('0x69')]=_0x21b5e6;_0x46f02b[_0x870c('0x6a')]=_0x39d7c7[_0x870c('0x6b')];return _0x46f02b;}function unlockQueueStatus(_0x4060bc,_0x2f3fc6){setTimeout(function(){if(_['isUndefined'](_0x4060bc[_0x870c('0x6c')])){loggerBooked[_0x870c('0x5f')](_0x870c('0x6d'),_0x2f3fc6);}_0x4060bc[_0x870c('0x6c')]=!![];loggerBooked[_0x870c('0x46')]('[booked][unlockQueueStatus]',_0x2f3fc6,JSON[_0x870c('0x6e')](_['pick'](_0x4060bc,[_0x870c('0x43'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x6cf338){return function(){if(!isNotNull(_0x6cf338[_0x870c('0x6f')])){_0x6cf338['message']=utils[_0x870c('0x63')][_0x870c('0x70')];throw _0x6cf338['name']+_0x870c('0x71');}if(!isNotNull(_0x6cf338[_0x870c('0x6f')][_0x870c('0x72')])){_0x6cf338[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x70')];throw _0x6cf338[_0x870c('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x870c('0x45')](_0x6cf338['Interval'][_0x870c('0x72')]))){_0x6cf338[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x70')];throw _0x6cf338[_0x870c('0x43')]+_0x870c('0x71');}};}function checkIsIVRCampaignActive(_0x28ab98){return function(){if(!utils[_0x870c('0x73')](_0x28ab98)){_0x28ab98[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x74')];throw _0x28ab98[_0x870c('0x43')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x50a5bd){if(utils['isIVRCampaign'](_0x50a5bd)){emit(util[_0x870c('0x41')](_0x870c('0x75'),_0x50a5bd['name']),_0x870c('0x76'),_0x50a5bd);}}function loggerCatchQueueSummary(_0x1bc1de,_0x506a41){return function(_0x4695a8){clearPredictiveAttributes(_0x506a41);emitCampaignSummary(_0x506a41);loggerSyncQueueSummary['debug'](_0x1bc1de,util[_0x870c('0x40')](_0x4695a8,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x222162){if(_0x222162[_0x870c('0x77')]){if(_0x222162['originated']===0x0){_0x222162[_0x870c('0x77')]=![];_0x222162['message']=utils['CAMPAIGN_STATUS'][_0x870c('0x74')];loggerSyncQueueSummary[_0x870c('0x3e')](_0x870c('0x78'),_0x222162[_0x870c('0x43')],'is\x20not\x20active');}else{_0x222162[_0x870c('0x62')]=utils['CAMPAIGN_STATUS'][_0x870c('0x79')];loggerSyncQueueSummary['debug'](_0x870c('0x78'),_0x222162[_0x870c('0x43')],_0x870c('0x7a'));}emitCampaignSummary(_0x222162);}}function myreject(_0x10d2dd){return function(_0x54bb7f){return _0x10d2dd(msgResponse(_0x870c('0x7b'),'Error',JSON[_0x870c('0x6e')](_0x54bb7f)));};}Dialer[_0x870c('0x14')][_0x870c('0x7c')]=function(_0x12963d){return!_[_0x870c('0x3b')](_0x12963d)&&_0x12963d&&!_[_0x870c('0x3b')](_0x12963d['name'])&&!_[_0x870c('0x3b')](_0x12963d[_0x870c('0x7d')])&&_0x12963d[_0x870c('0x7d')]&&(this[_0x870c('0x1c')][util[_0x870c('0x41')]('SIP/%s',_0x12963d[_0x870c('0x43')])][_0x870c('0x7e')]===_0x870c('0x7f')||this['trunks'][util['format'](_0x870c('0x80'),_0x12963d[_0x870c('0x43')])]['status']===_0x870c('0x81'));};Dialer[_0x870c('0x14')][_0x870c('0x82')]=function(_0x2befeb){var _0x568505=this;return function(){if(!_0x568505['isTrunkReachable'](_0x2befeb[_0x870c('0x83')])){if(!_0x568505[_0x870c('0x7c')](_0x2befeb['TrunkBackup'])){_0x2befeb[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x84')];throw _0x2befeb[_0x870c('0x43')]+_0x870c('0x85');}}};};Dialer['prototype']['checkIfTime']=function(_0x4e7b0e,_0x23ee33,_0x1e0b89,_0x55083d){var _0x511ced=this;return function(){var _0x4e48b9=!![];return _0x511ced['ifTimeIvr'](_0x4e7b0e,_0x23ee33,_0x1e0b89,_0x55083d,_0x4e48b9);};};Dialer[_0x870c('0x14')][_0x870c('0x86')]=function(_0x586235,_0x2e5d64,_0x430a0b,_0x492516){var _0x33f73a=this;return function(){var _0x387ce9=![];return _0x33f73a[_0x870c('0x87')](_0x586235[_0x870c('0x72')],_0x2e5d64,_0x430a0b,_0x492516,_0x387ce9);};};Dialer[_0x870c('0x14')][_0x870c('0x87')]=function(_0x180336,_0x534232,_0x43bd6c,_0x224a82,_0x16be14){var _0x3afc9c=[];return new Promise(function(_0x4156ba,_0x2e41f1){if(!isNotNull(_0x180336)){_0x224a82['message']=utils[_0x870c('0x63')]['NULL_INTERVAL'];return _0x2e41f1(msgResponse(_0x870c('0x88'),_0x870c('0x89'),_0x43bd6c+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x180336)){_0x224a82[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x8a')];return _0x2e41f1(msgResponse('ifTime',_0x870c('0x89'),_0x43bd6c+'\x20Intervals\x20is\x20empty\x20'));}if(_0x534232&&_[_0x870c('0x3b')](config[_0x870c('0x8b')][_0x534232])){_0x224a82[_0x870c('0x62')]=utils[_0x870c('0x63')]['UNKNOWN_TIMEZONE'];return _0x2e41f1(msgResponse(_0x870c('0x88'),_0x870c('0x89'),_0x43bd6c+_0x870c('0x8c')+_0x534232));}if(_['isArray'](_0x180336)){for(var _0x2fbcc4=0x0;_0x2fbcc4<_0x180336[_0x870c('0x8d')];_0x2fbcc4+=0x1){_0x3afc9c['push'](ami[_0x870c('0x8e')]({'action':_0x870c('0x8f'),'command':util[_0x870c('0x41')](_0x870c('0x90'),_0x180336[_0x2fbcc4][_0x870c('0x91')],!_[_0x870c('0x3b')](config[_0x870c('0x8b')][_0x534232])?_0x534232:'')})[_0x870c('0x39')](function(_0x1de984){return _0x1de984[_0x870c('0x92')][_0x870c('0x93')]('true')>=0x0;})['catch'](myreject(_0x2e41f1)));}}else{_0x3afc9c['push'](ami[_0x870c('0x8e')]({'action':_0x870c('0x8f'),'command':util['format'](_0x870c('0x90'),_0x180336,!_[_0x870c('0x3b')](config['timezones'][_0x534232])?_0x534232:'')})['then'](function(_0x542111){return _0x542111['content']['indexOf'](_0x870c('0x94'))>=0x0;})[_0x870c('0x95')](myreject(_0x2e41f1)));}Promise['all'](_0x3afc9c)[_0x870c('0x39')](function(_0x52e998){var _0x43c10d=_[_0x870c('0x96')](_0x52e998);if(_0x43c10d){return _0x4156ba(_0x43c10d);}else{_0x224a82[_0x870c('0x62')]=_0x16be14?utils[_0x870c('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x870c('0x63')][_0x870c('0x97')];return _0x2e41f1(msgResponse(_0x870c('0x98'),_0x870c('0x89'),_0x870c('0x99')+_0x16be14+'\x20'+_0x43bd6c+'\x20Interval\x20is\x20overtime:\x20'+util[_0x870c('0x40')](_0x180336,{'showHidden':![],'depth':null})+_0x870c('0x9a')+_0x534232));}})[_0x870c('0x95')](function(_0x44db4c){return _0x2e41f1(msgResponse('ifTime','Failure',JSON[_0x870c('0x6e')](_0x44db4c)));});});};Dialer[_0x870c('0x14')][_0x870c('0x37')]=function(){var _0x27c253=this;return cmHopper[_0x870c('0x9b')]({'active':![]},{'where':{'active':!![]}})[_0x870c('0x39')](function(){setInterval(function(){_0x27c253['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x870c('0x9c')]=function(){var _0x9455f2=this;var _0x8582ba;for(var _0x458df2 in this[_0x870c('0x1a')]){if(typeof this[_0x870c('0x1a')][_0x458df2]!==_0x870c('0x9d')){_0x8582ba=this[_0x870c('0x1a')][_0x458df2];if(utils[_0x870c('0x9e')](_0x8582ba)&&utils[_0x870c('0x73')](_0x8582ba)){_0x8582ba[_0x870c('0x77')]=!![];Promise[_0x870c('0x9f')]()['then'](checkIsIVRCampaignActive(_0x8582ba))[_0x870c('0x39')](checkInterval(_0x8582ba))[_0x870c('0x39')](_0x9455f2[_0x870c('0x82')](_0x8582ba))[_0x870c('0x39')](_0x9455f2[_0x870c('0xa0')](_0x8582ba[_0x870c('0xa1')],_0x8582ba[_0x870c('0xa2')],_0x8582ba[_0x870c('0x43')],_0x8582ba))[_0x870c('0x39')](_0x9455f2[_0x870c('0x86')](_0x8582ba[_0x870c('0x6f')],_0x8582ba['dialTimezone'],_0x8582ba[_0x870c('0x43')],_0x8582ba))['then'](_0x9455f2[_0x870c('0xa3')](_0x8582ba))['catch'](loggerCatchQueueSummary(_0x870c('0xa4'),_0x8582ba));}else{notSendMessagesCampaign(_0x8582ba);}}}};Dialer[_0x870c('0x14')][_0x870c('0xa5')]=function(_0x120396){if(_0x120396[_0x870c('0xa6')]!==_0x870c('0x7')){clearPredictiveAttributes(_0x120396);}switch(_0x120396[_0x870c('0xa6')]){case'progressive':this[_0x870c('0xa7')](_0x120396,0x1);break;case _0x870c('0xa8'):this[_0x870c('0xa7')](_0x120396,_0x120396['dialPowerLevel']);break;case _0x870c('0x7'):this[_0x870c('0x7')](_0x120396);break;case _0x870c('0x6'):this[_0x870c('0xa7')](_0x120396,0x1);break;default:logger[_0x870c('0x5f')](_0x870c('0xa9'),_0x120396[_0x870c('0x43')],_0x870c('0xaa'));}};Dialer[_0x870c('0x14')][_0x870c('0x88')]=function(_0x4d6a3d,_0x116471){var _0x4b88f9=_0x4d6a3d['dialTimezone'];var _0x343fc0=_0x116471?_0x4d6a3d[_0x870c('0xa1')]:_0x4d6a3d['Interval']['Intervals'];logger[_0x870c('0xab')](_0x870c('0xac'),_0x343fc0,_0x4b88f9,_0x4d6a3d['name'],util['format'](_0x870c('0xad'),_0x4d6a3d[_0x870c('0x43')],_0x4d6a3d['id']));var _0x4c4346=null;return Interval['intervalIftime'](_0x343fc0,_0x4b88f9)[_0x870c('0x39')](function(_0x212f2d){if(_0x212f2d===!![]){return _0x212f2d;}else{_0x4d6a3d[_0x870c('0x62')]=_0x116471?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x870c('0x63')][_0x870c('0x97')];_0x4c4346=msgResponse('[ifTime][promiseAll]',_0x870c('0x89'),_0x870c('0x99')+_0x116471+'\x20'+_0x4d6a3d[_0x870c('0x43')]+_0x870c('0xae')+util['inspect'](_0x343fc0,{'showHidden':![],'depth':null})+_0x870c('0x9a')+_0x4b88f9);}if(_0x4c4346!==null){logger[_0x870c('0xab')](_0x870c('0xaf'),_0x4c4346);_0x4c4346[_0x870c('0xb0')]=_0x116471;throw _0x4c4346;}})['catch'](function(_0x42ae76){logger['error'](_0x870c('0xb1'),_0x42ae76);throw msgResponse('[ifTime][Action]',_0x870c('0xb2'),util['inspect'](_0x42ae76,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x389c71){if(this[_0x870c('0x19')][_0x389c71[_0x870c('0xb3')]]){if(this[_0x870c('0x20')][_0x389c71[_0x870c('0xb4')]]&&this[_0x870c('0x20')][_0x389c71[_0x870c('0xb4')]][_0x870c('0x3c')]!=='ivr'){utils[_0x870c('0xb5')](this[_0x870c('0x19')][_0x389c71[_0x870c('0xb3')]],_0x870c('0xb6'));this[_0x870c('0x20')][_0x389c71[_0x870c('0xb4')]][_0x870c('0xb7')]=moment()[_0x870c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x870c('0x14')][_0x870c('0x2c')]=function(_0x2fdb37){var _0x590337=this[_0x870c('0x20')][_0x2fdb37[_0x870c('0xb4')]];if(this['voiceQueues'][_0x2fdb37[_0x870c('0xb3')]]){if(_0x590337&&_0x590337[_0x870c('0x3c')]!=='ivr'){delete this[_0x870c('0x20')][_0x2fdb37[_0x870c('0xb4')]];this['voiceQueues'][_0x2fdb37[_0x870c('0xb3')]][_0x870c('0xb8')]+=0x1;var _0x1691e4=new AgentComplete(_0x590337,_0x2fdb37);if(_0x2fdb37['reason']===_0x870c('0xb9')){_0x1691e4['agiafterat']=this[_0x870c('0x19')][_0x2fdb37[_0x870c('0xb3')]][_0x870c('0xba')]&&this[_0x870c('0x19')][_0x2fdb37['queue']][_0x870c('0xbb')]?moment()[_0x870c('0x41')](_0x870c('0xbc')):undefined;}hopperUtils['createHistory'](_0x1691e4)[_0x870c('0x95')](loggerCatch(_0x870c('0xbd')));hopperUtils[_0x870c('0xbe')](_0x1691e4)[_0x870c('0x95')](loggerCatch(_0x870c('0xbf')));}}};Dialer[_0x870c('0x14')][_0x870c('0x28')]=function(_0x25759d){var _0x1656b3=this[_0x870c('0x20')][_0x25759d[_0x870c('0xb4')]];var _0x2f458e=this;var _0x6b5b5b=![];var _0xba0618;var _0x4ca628;if(this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]]){if(_0x1656b3&&_0x1656b3['type']!=='ivr'){delete this[_0x870c('0x20')][_0x25759d[_0x870c('0xb4')]];utils[_0x870c('0xb5')](this['voiceQueues'][_0x25759d[_0x870c('0xb3')]],_0x870c('0xc0'));_0x1656b3[_0x870c('0xc1')]=moment()[_0x870c('0x41')](_0x870c('0xbc'));var _0x2c7cf0=new QueueCallerAbandon(_0x1656b3,_0x25759d);if(utils[_0x870c('0x5a')](_0x1656b3['droptime'],_0x1656b3[_0x870c('0xc2')])>=_0x1656b3[_0x870c('0xc3')]){this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]][_0x870c('0x4c')]+=0x1;this['voiceQueues'][_0x25759d[_0x870c('0xb3')]][_0x870c('0xc4')]+=0x1;this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2c7cf0[_0x870c('0x68')]=0xa;_0x2c7cf0[_0x870c('0x69')]=_0x870c('0xc5');_0x2c7cf0[_0x870c('0xc6')]='TIMEOUT';_0x2c7cf0[_0x870c('0xc7')]=this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]][_0x870c('0xba')]?moment()[_0x870c('0x41')](_0x870c('0xbc')):undefined;_0x2c7cf0['countdropretry']+=0x1;_0x2c7cf0[_0x870c('0xc8')]+=0x1;_0xba0618=this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]]['dialDropRetryFrequency'];_0x4ca628=this[_0x870c('0x19')][_0x25759d['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x2c7cf0,_0x2c7cf0[_0x870c('0x68')],_0x1656b3[_0x870c('0xc9')])[_0x870c('0x39')](function(_0x3c31db){_0x6b5b5b=_0x3c31db['additional']==0x1;if(_0x2c7cf0['countdropretry']>=_0x2f458e[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]][_0x870c('0xca')]){_0x2f458e['queueCallerAbandonCreateState'](_0x2c7cf0,_0x3c31db[_0x870c('0xcb')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2c7cf0[_0x870c('0xcc')],'scheduledat':moment()[_0x870c('0xcd')](_0x2f458e[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]]['dialDropRetryFrequency'],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1656b3[_0x870c('0xcf')],'ListId':_0x1656b3[_0x870c('0xd0')],'VoiceQueueId':_0x1656b3[_0x870c('0xd1')]||undefined,'CampaignId':_0x1656b3[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0xd3')));var _0x4fbfe5=new History(_0x2c7cf0);_0x4fbfe5[_0x870c('0x68')]=0xa;_0x4fbfe5[_0x870c('0x69')]=_0x870c('0xc5');_0x4fbfe5[_0x870c('0x6b')]=moment()['format'](_0x870c('0xbc'));_0x4fbfe5['endtime']=_0x4fbfe5['starttime'];_0x4fbfe5[_0x870c('0xd4')]=_0x2c7cf0[_0x870c('0xd4')];_0x4fbfe5[_0x870c('0xd5')]=_0x2c7cf0[_0x870c('0xd5')];hopperUtils['createHistory'](_0x4fbfe5)['catch'](loggerCatch(_0x870c('0xd6')));}})[_0x870c('0x39')](function(){if(_0x6b5b5b)hopperUtils[_0x870c('0xd7')](_0x2c7cf0,_0xba0618,_0x4ca628)[_0x870c('0x39')](function(){return 0x1;});});}else{this['voiceQueues'][_0x25759d[_0x870c('0xb3')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x25759d[_0x870c('0xb3')]][_0x870c('0xd8')]+=0x1;_0x2c7cf0[_0x870c('0x68')]=0xb;_0x2c7cf0[_0x870c('0x69')]='Abandoned';_0x2c7cf0[_0x870c('0xc6')]=_0x870c('0xd9');_0x2c7cf0[_0x870c('0xda')]+=0x1;_0x2c7cf0[_0x870c('0xc8')]+=0x1;_0xba0618=this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]][_0x870c('0xdb')];_0x4ca628=this[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x870c('0xdc')](_0x2c7cf0,_0x2c7cf0[_0x870c('0x68')],_0x1656b3[_0x870c('0xc9')])[_0x870c('0x39')](function(_0x208326){if(_0x2c7cf0[_0x870c('0xda')]>=_0x2f458e[_0x870c('0x19')][_0x25759d[_0x870c('0xb3')]][_0x870c('0xdd')]){_0x2f458e['queueCallerAbandonCreateState'](_0x2c7cf0,_0x208326[_0x870c('0xcb')]);}else{hopperUtils[_0x870c('0xde')]({'active':![],'countabandonedretry':_0x2c7cf0[_0x870c('0xda')],'scheduledat':moment()[_0x870c('0xcd')](_0x2f458e['voiceQueues'][_0x25759d[_0x870c('0xb3')]]['dialAbandonedRetryFrequency'],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1656b3[_0x870c('0xcf')],'ListId':_0x1656b3['ListId'],'VoiceQueueId':_0x1656b3[_0x870c('0xd1')]||undefined,'CampaignId':_0x1656b3[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x27e13e=new History(_0x2c7cf0);_0x27e13e['state']=0xb;_0x27e13e['statedesc']='Abandoned';_0x27e13e[_0x870c('0x6b')]=moment()[_0x870c('0x41')](_0x870c('0xbc'));_0x27e13e[_0x870c('0x6a')]=_0x27e13e[_0x870c('0x6b')];_0x27e13e['calleridname']=_0x2c7cf0[_0x870c('0xd4')];_0x27e13e['calleridnum']=_0x2c7cf0[_0x870c('0xd5')];hopperUtils['createHistory'](_0x27e13e)['catch'](loggerCatch(_0x870c('0xdf')));}})['then'](function(){if(_0x6b5b5b)hopperUtils[_0x870c('0xd7')](_0x2c7cf0,_0xba0618,_0x4ca628)[_0x870c('0x39')](function(){return 0x1;});});}}}};Dialer[_0x870c('0x14')][_0x870c('0x32')]=function(_0x24185e){if(this[_0x870c('0x1e')][_0x24185e[_0x870c('0xb4')]]){this[_0x870c('0x1e')][_0x24185e[_0x870c('0xb4')]][_0x870c('0xe0')]=_0x24185e[_0x870c('0xe0')];}if(this[_0x870c('0x20')][_0x24185e['uniqueid']]){this[_0x870c('0x20')][_0x24185e[_0x870c('0xb4')]][_0x870c('0xe0')]=_0x24185e[_0x870c('0xe0')];}};Dialer[_0x870c('0x14')][_0x870c('0xe1')]=function(_0x3af588){if(!this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]]){return;}var _0x447383=this['voiceQueues'][this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]]['queue']][_0x870c('0xe3')]||'rrmemory';if(_0x447383==='roundrobin'){if(this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]]&&_[_0x870c('0xe4')](this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]][_0x870c('0xe5')])&&_0x3af588[_0x870c('0x7e')]==='1'&&_0x3af588['paused']==='0'){if(this[_0x870c('0x1b')][_0x3af588['stateinterface']]){if(!this[_0x870c('0x1b')][_0x3af588['stateinterface']]['locked']){this[_0x870c('0x1b')][_0x3af588[_0x870c('0xe6')]][_0x870c('0xe5')]=!![];this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]][_0x870c('0xe5')]=!![];this['actions'][_0x3af588[_0x870c('0xe2')]]['stateinterface']=_0x3af588[_0x870c('0xe6')];}}}}else if(_0x447383==='rrmemory'){if(this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]]){if(this[_0x870c('0x1b')][_0x3af588['stateinterface']]){this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]][_0x870c('0xe6')]=_0x3af588['stateinterface'];if(_['isNil'](this[_0x870c('0x23')][this[_0x870c('0x1e')][_0x3af588[_0x870c('0xe2')]]['queue']])){this['queueBooked'][this['actions'][_0x3af588['actionid']][_0x870c('0xb3')]]=[];}this[_0x870c('0x23')][this[_0x870c('0x1e')][_0x3af588['actionid']][_0x870c('0xb3')]]['push'](_[_0x870c('0x59')](_[_0x870c('0xe7')](this[_0x870c('0x1e')][_0x3af588['actionid']],[_0x870c('0xe8'),_0x870c('0xe6')]),{'status':_0x3af588[_0x870c('0x7e')],'paused':_0x3af588[_0x870c('0xe9')]}));}}}};Dialer[_0x870c('0x14')][_0x870c('0x36')]=function(_0x2f2ee1){if(!this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]){return;}var _0x12d7bb=this;var _0x3d91ab=this['voiceQueues'][this[_0x870c('0x1e')][_0x2f2ee1['actionid']]['queue']];var _0x1a80ca=_0x3d91ab[_0x870c('0xe3')]||'rrmemory';if(_0x1a80ca==='roundrobin'){if(this['actions'][_0x2f2ee1['actionid']]&&this[_0x870c('0x1e')][_0x2f2ee1['actionid']][_0x870c('0xe6')]){this['preview'][_0x870c('0xea')](this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xe8')],this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]['stateinterface'])[_0x870c('0x95')](function(_0x1b691e){logger[_0x870c('0x5f')](_0x870c('0xeb'),util[_0x870c('0x40')](_0x1b691e,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x870c('0xb5')](_0x12d7bb['voiceQueues'][_0x12d7bb[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]],'[syncQueueStatusComplete]');_0x12d7bb['agents'][_0x12d7bb['actions'][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xe6')]][_0x870c('0xe5')]=![];delete _0x12d7bb[_0x870c('0x1e')][_0x2f2ee1['actionid']];unlockQueueStatus(_0x3d91ab);});}else{utils[_0x870c('0xb5')](this[_0x870c('0x19')][this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]['queue']],_0x870c('0xec'));hopperUtils[_0x870c('0xde')]({'active':![],'ContactId':this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xcf')],'ListId':this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xd0')],'VoiceQueueId':this[_0x870c('0x1e')][_0x2f2ee1['actionid']][_0x870c('0xd1')]||undefined,'CampaignId':this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x870c('0xed')));delete this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]];unlockQueueStatus(_0x3d91ab);}}else if(_0x1a80ca===_0x870c('0xee')){var _0x32869c;if(this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]&&!_[_0x870c('0x45')](this[_0x870c('0x23')][this['actions'][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]])){if(this['queueBookedRR'][_0x12d7bb[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]]){this['queueBookedRR'][_0x12d7bb['actions'][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]]=this[_0x870c('0x24')][this['actions'][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]]?this[_0x870c('0x24')][this[_0x870c('0x1e')][_0x2f2ee1['actionid']][_0x870c('0xb3')]]:this[_0x870c('0x23')][this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]]['queue']]?this[_0x870c('0x23')][this['actions'][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]]['_rr']||0x0:0x0;}this[_0x870c('0x23')][this['actions'][_0x2f2ee1['actionid']][_0x870c('0xb3')]][_0x870c('0xef')]=this[_0x870c('0x24')][this[_0x870c('0x1e')][_0x2f2ee1[_0x870c('0xe2')]][_0x870c('0xb3')]];for(var _0x301f82=0x0;_0x301f82=_0x34b306[_0x870c('0x118')]){_0x4957a6[_0x870c('0x119')](_0x4429fa,_0x470710,_0x4aad3d,'reason19\x20machine....');}else{if(_0x4429fa[_0x870c('0x111')]>=_0x34b306[_0x870c('0x11a')]){_0x4957a6[_0x870c('0x11b')](_0x4429fa,_0x470710,_0x4aad3d,'reason\x2019\x20machine....');}else{hopperUtils[_0x870c('0xde')]({'active':![],'countmachineretry':_0x4429fa[_0x870c('0x111')],'scheduledat':moment()[_0x870c('0xcd')](_0x34b306[_0x870c('0x11c')],_0x870c('0xce'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4429fa[_0x870c('0xcf')],'ListId':_0x4429fa[_0x870c('0xd0')],'VoiceQueueId':_0x4429fa[_0x870c('0xd1')]||undefined,'CampaignId':_0x4429fa['CampaignId']||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0x11d')));_0x470710({'reschedule':0x1});}}});}if(_0xb7ec98[_0x870c('0x3c')]===_0x870c('0xf8')&&this['campaigns'][_0xb7ec98[_0x870c('0xb3')]][_0x870c('0x102')]&&_0x1f24d8['value']===_0x870c('0x104')){delete this['uniqueId'][_0x1f24d8[_0x870c('0xb4')]];utils[_0x870c('0xb5')](this[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]],_0x870c('0x105'));_0x30b37b=new Hangup(_0xb7ec98,_0x1f24d8);_0x30b37b[_0x870c('0x68')]=0x12;_0x30b37b['statedesc']=_0x870c('0x107');_0x30b37b['membername']='AMD';ami[_0x870c('0x109')]('custom:amd',ut['buildObj'](_0x30b37b,_0x870c('0x10c')));this[_0x870c('0x10d')](_0x30b37b,'[syncHangupInAMDIvr][createHistory]',_0x870c('0x11e'));}if(_0xb7ec98[_0x870c('0x3c')]===_0x870c('0xf8')&&this[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]][_0x870c('0x102')]&&_0x1f24d8[_0x870c('0x103')]===_0x870c('0x10f')){return new Promise(function(_0x3ae87b,_0x3d922e){delete _0x4957a6[_0x870c('0x20')][_0x1f24d8['uniqueid']];utils['decrementOriginate'](_0x4957a6[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]],_0x870c('0x105'));_0x4957a6[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]][_0x870c('0xb8')]+=0x1;_0x4957a6[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]][_0x870c('0x106')]+=0x1;var _0x4c2661=_0x4957a6[_0x870c('0x1a')][_0xb7ec98[_0x870c('0xb3')]];var _0x7c0c0b=new Hangup(_0xb7ec98,_0x1f24d8);_0x7c0c0b['state']=0x13;_0x7c0c0b[_0x870c('0x69')]=_0x870c('0x110');_0x7c0c0b['membername']=_0x870c('0x11f');_0x7c0c0b[_0x870c('0x111')]+=0x1;_0x7c0c0b[_0x870c('0xc8')]+=0x1;_0x7c0c0b[_0x870c('0x10c')]=!![];ami[_0x870c('0x109')]('custom:amd',ut[_0x870c('0x10b')](_0x7c0c0b,_0x870c('0x10c')));hopperUtils[_0x870c('0x112')](_0x7c0c0b)[_0x870c('0x95')](loggerCatch(_0x870c('0x113')));if(_0x7c0c0b[_0x870c('0x114')]+_0x7c0c0b[_0x870c('0x120')]+_0x7c0c0b[_0x870c('0x115')]+_0x7c0c0b[_0x870c('0x116')]+_0x7c0c0b[_0x870c('0xcc')]+_0x7c0c0b['countabandonedretry']+_0x7c0c0b[_0x870c('0x111')]+_0x7c0c0b['countagentrejectretry']>=_0x4c2661[_0x870c('0x118')]){_0x4957a6['stateGlobal'](_0x7c0c0b,_0x3ae87b,_0x3d922e,_0x870c('0x121'));}else{if(_0x7c0c0b['countmachineretry']>=_0x4c2661[_0x870c('0x11a')]){_0x4957a6[_0x870c('0x11b')](_0x7c0c0b,_0x3ae87b,_0x3d922e,_0x870c('0x122'));}else{hopperUtils[_0x870c('0xde')]({'active':![],'countmachineretry':_0x7c0c0b[_0x870c('0x111')],'scheduledat':moment()[_0x870c('0xcd')](_0x4c2661[_0x870c('0x11c')],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x7c0c0b[_0x870c('0xcf')],'ListId':_0x7c0c0b[_0x870c('0xd0')],'VoiceQueueId':_0x7c0c0b[_0x870c('0xd1')]||undefined,'CampaignId':_0x7c0c0b[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0x11d')));_0x3ae87b({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x870c('0x30')]=function(_0x1d649a){var _0xd89618=this['uniqueId'][_0x1d649a[_0x870c('0xb4')]];var _0x3b9649;if(!_0xd89618){return;}if(_0xd89618['type']===_0x870c('0xf8')){delete this[_0x870c('0x20')][_0x1d649a['uniqueid']];utils[_0x870c('0xb5')](this[_0x870c('0x1a')][_0xd89618[_0x870c('0xb3')]],_0x870c('0x123'));this[_0x870c('0x1a')][_0xd89618['queue']][_0x870c('0x124')]+=0x1;if(_0x1d649a[_0x870c('0x125')]===_0x870c('0x126')){const _0x509060=new AgentComplete(_0xd89618,_0x1d649a);_0x509060[_0x870c('0xd2')]=this['campaigns'][_0xd89618['queue']]['id'];hopperUtils[_0x870c('0x112')](_0x509060)[_0x870c('0x95')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x509060)[_0x870c('0x95')](loggerCatch(_0x870c('0x127')));}else{_0x3b9649=new Hangup(_0xd89618,_0x1d649a);hopperUtils[_0x870c('0x112')](_0x3b9649)[_0x870c('0x95')](loggerCatch(_0x870c('0x128')));hopperUtils[_0x870c('0xbe')](_0x3b9649)[_0x870c('0x95')](loggerCatch(_0x870c('0x129')));}}else{if(isNotNull(this[_0x870c('0x19')][_0xd89618['queue']][_0x870c('0x12a')])){delete this[_0x870c('0x20')][_0x1d649a['uniqueid']];utils[_0x870c('0xb5')](this[_0x870c('0x19')][_0xd89618[_0x870c('0xb3')]],'[syncHangup]');this['voiceQueues'][_0xd89618['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0xd89618[_0x870c('0xb3')]][_0x870c('0x106')]+=0x1;_0x3b9649=new Hangup(_0xd89618,_0x1d649a);_0x3b9649[_0x870c('0x68')]=0x10;_0x3b9649['statedesc']='AnswerAGI';_0x3b9649[_0x870c('0x108')]=_0x870c('0x12b');hopperUtils[_0x870c('0x112')](_0x3b9649)[_0x870c('0x95')](loggerCatch(_0x870c('0x128')));hopperUtils[_0x870c('0xbe')](_0x3b9649)[_0x870c('0x95')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x870c('0x20')][_0x1d649a[_0x870c('0xb4')]];utils[_0x870c('0xb5')](this[_0x870c('0x19')][_0xd89618[_0x870c('0xb3')]],_0x870c('0x12c'));if(_0x1d649a[_0x870c('0x125')]==='Normal\x20Clearing'){this['voiceQueues'][_0xd89618[_0x870c('0xb3')]][_0x870c('0xb8')]+=0x1;const _0xd5abed=new AgentComplete(_0xd89618,_0x1d649a);_0xd5abed['VoiceQueueId']=this['voiceQueues'][_0xd89618[_0x870c('0xb3')]]['id'];hopperUtils['createHistory'](_0xd5abed)[_0x870c('0x95')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x870c('0xbe')](_0xd5abed)[_0x870c('0x95')](loggerCatch(_0x870c('0xbf')));}else{this[_0x870c('0x19')][_0xd89618[_0x870c('0xb3')]][_0x870c('0x12d')]+=0x1;_0x3b9649=new Hangup(_0xd89618,_0x1d649a);_0x3b9649[_0x870c('0x68')]=0xc;_0x3b9649['statedesc']=_0x1d649a['cause-txt'];_0x3b9649[_0x870c('0x108')]=_0x870c('0x12e');hopperUtils['createHistory'](_0x3b9649)[_0x870c('0x95')](loggerCatch(_0x870c('0x12f')));hopperUtils['moveContactManagedDialer'](_0x3b9649)[_0x870c('0x95')](loggerCatch(_0x870c('0x123')));}}}};Dialer[_0x870c('0x14')]['syncQueueSummary']=function(_0x4db145){var _0x232fdb=this;if(!_0x232fdb['queuesSummary'][_0x4db145['name']]){_0x232fdb['queuesSummary'][_0x4db145[_0x870c('0x43')]]={'running':![]};}else if(_0x232fdb[_0x870c('0x25')][_0x4db145['name']]['running']===!![]){return;}else if(_0x232fdb[_0x870c('0x25')][_0x4db145[_0x870c('0x43')]][_0x870c('0x130')]===![]){_0x232fdb[_0x870c('0x25')][_0x4db145['name']][_0x870c('0x130')]=!![];}var _0x460b44=_0x232fdb['voiceQueues'][_0x4db145[_0x870c('0x43')]];var _0x15f727=_0x460b44[_0x870c('0x62')]!==utils[_0x870c('0x63')][_0x870c('0x74')];var _0x886027=utils[_0x870c('0x131')](_0x460b44);_0x460b44[_0x870c('0x132')]=utils[_0x870c('0x133')](_0x460b44,_0x232fdb[_0x870c('0x1c')]);Promise[_0x870c('0x9f')]()[_0x870c('0x39')](function(){if(_0x460b44[_0x870c('0x132')]===utils[_0x870c('0x63')][_0x870c('0x74')]){if(_0x15f727){clearPredictiveAttributes(_0x460b44);_0x4db145[_0x870c('0x5c')]=undefined;_0x4db145[_0x870c('0x22')]=undefined;}if(_0x460b44[_0x870c('0x132')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x4db145['available']=0x0;_0x4db145['paused']=0x0;_0x4db145[_0x870c('0x134')]=0x0;_0x4db145[_0x870c('0x135')]=0x0;_0x4db145[_0x870c('0x136')]=0x0;}}else if(_0x460b44[_0x870c('0x132')]===utils[_0x870c('0x63')][_0x870c('0x137')]&&!_0x886027){return _0x232fdb[_0x870c('0x88')](_0x460b44,!![])[_0x870c('0x39')](function(){return _0x232fdb[_0x870c('0x88')](_0x460b44,![]);})[_0x870c('0x39')](function(){return _0x232fdb[_0x870c('0xa5')](_0x460b44);})['catch'](function(_0x490550){loggerSyncQueueSummary[_0x870c('0x3e')](_0x870c('0x138'),util['inspect'](_0x490550,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x460b44);});}else{clearPredictiveAttributes(_0x460b44);}})[_0x870c('0x39')](function(){var _0x25b715=_0x4db145[_0x870c('0x139')](_0x460b44);if(_0x25b715||_0x460b44[_0x870c('0x13a')]){_0x460b44[_0x870c('0x13a')]=![];_0x4db145[_0x870c('0x13b')](_0x460b44);Object[_0x870c('0x13c')](_0x460b44,_0x4db145);emitOutboundVoiceQueueSummary(_0x4db145);}_0x232fdb[_0x870c('0x25')][_0x460b44['name']][_0x870c('0x130')]=![];})[_0x870c('0x95')](function(_0x28d8e0){logger[_0x870c('0x5f')]('[syncQueueSummary]',util[_0x870c('0x40')](_0x28d8e0,{'showHidden':![],'depth':null}));_0x232fdb[_0x870c('0x25')][_0x460b44[_0x870c('0x43')]][_0x870c('0x130')]=![];});};Dialer['prototype'][_0x870c('0x2e')]=_[_0x870c('0x13d')](function(){var _0x1b9b3e=_[_0x870c('0x13e')](this[_0x870c('0x19')],function(_0x4e6dde){return _0x4e6dde[_0x870c('0x13f')];});var _0x1d43a2=_[_0x870c('0x13e')](this[_0x870c('0x1b')],function(_0x3e3fde){return _0x3e3fde[_0x870c('0x140')]&&_0x3e3fde[_0x870c('0x7e')]==='reachable';});if(_0x1b9b3e[_0x870c('0x8d')]>0x0&&_0x1d43a2[_0x870c('0x8d')]>0x0){return Promise[_0x870c('0x9f')]()[_0x870c('0x39')](cmHopper[_0x870c('0x141')](_['map'](_0x1b9b3e,'id'),previewRecallmeReminderInterval,_[_0x870c('0x142')](_0x1d43a2,'id')))['then'](function(_0x3fdf54){for(var _0x239e68=0x0;_0x239e68<_0x3fdf54[_0x870c('0x8d')];_0x239e68++){var _0xd73c33=_0x3fdf54[_0x239e68][_0x870c('0x143')]['name'];if(_0xd73c33)io['to'](util[_0x870c('0x41')]('user:%s',_0xd73c33))['emit'](_0x870c('0x144'),{'hopper':_0x3fdf54[_0x239e68]});}})[_0x870c('0x95')](function(_0xe75c17){logger[_0x870c('0x5f')](_0x870c('0x145'),_0xe75c17);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x870c('0x14')][_0x870c('0x146')]=function(){var _0x295bf7=this;setInterval(function(){_0x295bf7[_0x870c('0x147')](_0x295bf7[_0x870c('0x20')],'[uniqueid]');_0x295bf7[_0x870c('0x147')](_0x295bf7[_0x870c('0x1e')],'[actions]');},0x32c8);};Dialer[_0x870c('0x14')][_0x870c('0x147')]=function(_0x577c2d,_0x21adb9){var _0x5c0a78=this;for(var _0x4a186d in _0x577c2d){if(typeof _0x577c2d[_0x4a186d]!==_0x870c('0x9d')){this['sequence'][_0x870c('0x15')](function(){if(!_[_0x870c('0xe4')](_0x577c2d[_0x4a186d])){return ami[_0x870c('0x8e')]({'action':_0x870c('0x7e'),'channel':_0x577c2d[_0x4a186d]['channel']})[_0x870c('0x95')](function(_0x47ef7b){if(_0x47ef7b[_0x870c('0x62')]===_0x870c('0x148')){setTimeout(function(){if(_0x577c2d[_0x4a186d]&&_0x577c2d[_0x4a186d][_0x870c('0x3c')]!==_0x870c('0xf8')){utils[_0x870c('0xb5')](_0x5c0a78[_0x870c('0x19')][_0x577c2d[_0x4a186d][_0x870c('0xb3')]],'[clearZombieChannels]');logger[_0x870c('0x5f')](_0x870c('0x149'),_0x21adb9,_0x4a186d,_0x577c2d[_0x4a186d][_0x870c('0xb3')]);delete _0x577c2d[_0x4a186d];}if(_0x577c2d[_0x4a186d]&&_0x577c2d[_0x4a186d]['type']==='ivr'){utils['decrementOriginate'](_0x5c0a78[_0x870c('0x1a')][_0x577c2d[_0x4a186d][_0x870c('0xb3')]],_0x870c('0x14a'));logger[_0x870c('0x5f')](_0x870c('0x14b'),_0x21adb9,_0x4a186d,_0x577c2d[_0x4a186d][_0x870c('0xb3')]);delete _0x577c2d[_0x4a186d];}},0x2328);}});}});}}};Dialer[_0x870c('0x14')][_0x870c('0x14c')]=function(_0x167de5){return Promise['resolve']()[_0x870c('0x39')](voiceQueueRt['getVoiceQueueRtPauses'](_0x167de5))[_0x870c('0x95')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x870c('0x14')][_0x870c('0x14d')]=function(_0x3581a9,_0x1ec79d,_0x4af361){var _0x770de6={'state':0x19,'statedesc':_0x870c('0x14e')};utils[_0x870c('0xb5')](_0x1ec79d,'[emptyContact]'+_0x3581a9);this[_0x870c('0x10d')](_[_0x870c('0x59')](_0x770de6,_[_0x870c('0xe7')](_0x4af361,[_0x870c('0xcf'),'ListId',_0x870c('0x14f'),_0x870c('0xd1'),'CampaignId'])),_0x870c('0x150'),'[emptyContact]');logger[_0x870c('0x5f')](_0x3581a9);};Dialer[_0x870c('0x14')][_0x870c('0x10d')]=function(_0x296f28,_0x393e68,_0x28320e){hopperUtils[_0x870c('0x112')](_0x296f28)[_0x870c('0x95')](loggerCatch(_0x393e68));hopperUtils[_0x870c('0xbe')](_0x296f28)[_0x870c('0x95')](loggerCatch(_0x28320e));};Dialer[_0x870c('0x14')][_0x870c('0x151')]=function(_0x5c188f,_0x49bfe5){hopperUtils[_0x870c('0x112')](_0x5c188f)[_0x870c('0x95')](loggerCatch(_0x870c('0xbd')));if(_0x49bfe5==0x0){hopperUtils[_0x870c('0xbe')](_0x5c188f)[_0x870c('0x95')](loggerCatch(_0x870c('0x152')));}};Dialer[_0x870c('0x14')][_0x870c('0x145')]=function(_0x58369c){return Promise[_0x870c('0x9f')]()[_0x870c('0x39')](cmHopper[_0x870c('0x141')](_0x58369c['id'],previewRecallmeReminderInterval))[_0x870c('0x39')](function(_0x4fa442){for(var _0x1186b1=0x0;_0x1186b1<_0x4fa442[_0x870c('0x8d')];_0x1186b1++){var _0x4ad451=_0x4fa442[_0x1186b1][_0x870c('0x143')]['name'];if(_0x4ad451)io['to'](util[_0x870c('0x41')]('user:%s',_0x4ad451))['emit'](_0x870c('0x144'),{'hopper':_0x4fa442[_0x1186b1]});}})[_0x870c('0x95')](function(){});};Dialer[_0x870c('0x14')][_0x870c('0xa3')]=function(_0x4d244d){var _0x34b1f8=this;return function(){_0x34b1f8[_0x870c('0x153')](_0x4d244d);};};Dialer[_0x870c('0x14')]['actionOriginate']=function(_0x11c99d,_0xb1bbf){var _0x1e7e20=this;var _0x1c0f78=uuid['v4']();this[_0x870c('0x1e')][_0x1c0f78]=new Action(_0x11c99d,_0xb1bbf,_0x1c0f78);return new Promise(function(_0x30d367,_0x47d2fe){if(_[_0x870c('0x3b')](_0x11c99d)&&typeof _0x11c99d!=='object'){return _0x47d2fe(msgResponse('originate',_0x870c('0x89'),_0x870c('0x154')));}if(_[_0x870c('0x3b')](_0xb1bbf[_0x870c('0x155')])||_0xb1bbf[_0x870c('0x155')]===null){return _0x47d2fe(msgResponse(_0x870c('0x156'),_0x870c('0x89'),_0x870c('0x157')));}var _0x3c2421={'XMD-CALLERID':_0x1e7e20['actions'][_0x1c0f78]['getCaller'](),'XMD-AGI':_0x11c99d[_0x870c('0x12a')]?util[_0x870c('0x41')](_0x870c('0x158'),ipAgi,_0x11c99d[_0x870c('0x12a')]):_0x870c('0x159'),'XMD-AGIAFTER':_0x11c99d[_0x870c('0xba')]?util[_0x870c('0x41')](_0x870c('0x158'),ipAgi,_0x11c99d[_0x870c('0xba')]):_0x870c('0x159'),'XMD-QUEUE':utils[_0x870c('0x15a')](_0x11c99d)?util[_0x870c('0x41')](_0x870c('0x15b'),_0x11c99d[_0x870c('0x43')],_0x11c99d[_0x870c('0x15c')]||'',_0x11c99d['dialAgiAfterHangupAgent']?'c':'',_0x11c99d[_0x870c('0xc3')]||0x3):_0x870c('0x159'),'XMD-CONTACTID':_0xb1bbf[_0x870c('0xcf')],'XMD-CDRTYPE':_0x870c('0x5'),'CALLERID(all)':_0x1e7e20[_0x870c('0x1e')][_0x1c0f78][_0x870c('0x15d')](),'XMD-AMD':_0x11c99d[_0x870c('0x102')]?_0x870c('0x137'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x11c99d['dialAMDActive']){_0x3c2421[_0x870c('0x15e')]=_0x11c99d[_0x870c('0x15f')]||0x9c4;_0x3c2421[_0x870c('0x160')]=_0x11c99d['dialAMDGreeting']||0x5dc;_0x3c2421[_0x870c('0x161')]=_0x11c99d[_0x870c('0x162')]||0x320;_0x3c2421[_0x870c('0x163')]=_0x11c99d[_0x870c('0x164')]||0x1388;_0x3c2421[_0x870c('0x165')]=_0x11c99d['dialAMDMinWordLength']||0x64;_0x3c2421[_0x870c('0x166')]=_0x11c99d[_0x870c('0x167')]||0x32;_0x3c2421[_0x870c('0x168')]=_0x11c99d[_0x870c('0x169')]||0x3;_0x3c2421[_0x870c('0x16a')]=_0x11c99d['dialAMDSilenceThreshold']||0x100;_0x3c2421[_0x870c('0x16b')]=_0x11c99d[_0x870c('0x16c')]||0x1388;}if(utils[_0x870c('0x15a')](_0x11c99d)){_0x3c2421[_0x870c('0x16d')]=_0xb1bbf['VoiceQueueId'];}else{_0x3c2421[_0x870c('0x16e')]=_0xb1bbf['CampaignId'];}var _0x302d73=utils[_0x870c('0x16f')](_0xb1bbf[_0x870c('0x170')]);Object['assign'](_0x3c2421,_0x302d73);var _0x275b8b=_0x1e7e20[_0x870c('0x7c')](_0x11c99d[_0x870c('0x83')])?utils[_0x870c('0x171')](_0x11c99d[_0x870c('0x83')]['callerid'],_0x11c99d['dialOriginateCallerIdName'],_0x11c99d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x870c('0x172')](_0x11c99d[_0x870c('0x173')],_0x11c99d['dialRandomLastDigitCallerIdNumber']):_0x11c99d[_0x870c('0x173')]):utils[_0x870c('0x171')](_[_0x870c('0xe4')](_0x11c99d[_0x870c('0x174')])?_0x11c99d[_0x870c('0x83')][_0x870c('0x175')]:_0x11c99d[_0x870c('0x174')][_0x870c('0x175')],_0x11c99d[_0x870c('0x176')],_0x11c99d[_0x870c('0x177')]>0x0?utils[_0x870c('0x172')](_0x11c99d[_0x870c('0x173')],_0x11c99d['dialRandomLastDigitCallerIdNumber']):_0x11c99d[_0x870c('0x173')]);if(_0x275b8b){_0x3c2421[_0x870c('0x178')]=_0x1e7e20['actions'][_0x1c0f78]['originatecalleridname']=utils['extractCalleridName'](_0x275b8b);_0x3c2421[_0x870c('0x179')]=_0xb1bbf['phone'];}_0x11c99d[_0x870c('0x17a')]=_0x3c2421;return ami[_0x870c('0x8e')]({'actionid':_0x1c0f78,'action':_0x870c('0x156'),'channel':_0x1e7e20[_0x870c('0x7c')](_0x11c99d[_0x870c('0x83')])?util[_0x870c('0x41')](_0x870c('0x17b'),_0x11c99d[_0x870c('0x83')][_0x870c('0x43')],isNotNull(_0x11c99d[_0x870c('0x17c')])?_0x11c99d['dialPrefix']['trim']()||'':'',_0x11c99d[_0x870c('0x17d')]>0x0?_0xb1bbf['phone']['substring'](_0x11c99d[_0x870c('0x17d')]):_0xb1bbf['phone']):util['format']('SIP/%s/%s%s',_[_0x870c('0xe4')](_0x11c99d['TrunkBackup'])?_0x11c99d[_0x870c('0x83')]['name']:_0x11c99d['TrunkBackup'][_0x870c('0x43')],isNotNull(_0x11c99d[_0x870c('0x17c')])?_0x11c99d[_0x870c('0x17c')][_0x870c('0x17e')]()||'':'',_0x11c99d[_0x870c('0x17d')]>0x0?_0xb1bbf[_0x870c('0x155')][_0x870c('0x17f')](_0x11c99d[_0x870c('0x17d')]):_0xb1bbf[_0x870c('0x155')]),'callerid':_0x275b8b,'Exten':_0x870c('0x101'),'Context':_0x870c('0x180'),'Priority':'1','variable':_0x3c2421,'timeout':(_0x11c99d[_0x870c('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1c0f78})['then'](function(_0x2167b0){return _0x30d367(_0x2167b0);})[_0x870c('0x95')](function(_0x15a767){_0x11c99d[_0x870c('0x182')]+=0x1;var _0xf1a216=new History(_0x1e7e20[_0x870c('0x1e')][_0x1c0f78]);logger[_0x870c('0x5f')](util[_0x870c('0x41')](_0x870c('0x183'),JSON['stringify'](_0x15a767)));_0xf1a216['state']=0xe;_0xf1a216[_0x870c('0x69')]=_0x870c('0x184');_0xf1a216[_0x870c('0x6b')]=moment()[_0x870c('0x41')](_0x870c('0xbc'));_0xf1a216[_0x870c('0x6a')]=_0xf1a216[_0x870c('0x6b')];hopperUtils['createHistory'](_0xf1a216)[_0x870c('0x95')](loggerCatch(_0x870c('0x185')));_0x1e7e20[_0x870c('0xbe')](_0xf1a216)[_0x870c('0x95')](loggerCatch('[originate][error]'))[_0x870c('0x186')](function(){delete _0x1e7e20[_0x870c('0x1e')][_0x1c0f78];return _0x47d2fe(msgResponse(_0x870c('0x156'),_0x870c('0xb2'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x870c('0x187')]=function(_0x11a198,_0x2c4c84,_0x8f6546){var _0x1ab7f0=new History(_0x2c4c84);if(_0x1ab7f0[_0x870c('0x114')]+_0x1ab7f0['countcongestionretry']+_0x1ab7f0['countnoanswerretry']+_0x1ab7f0[_0x870c('0x116')]+_0x1ab7f0['countdropretry']+_0x1ab7f0['countabandonedretry']+_0x1ab7f0[_0x870c('0x111')]+_0x1ab7f0[_0x870c('0x117')]>=_0x8f6546[_0x870c('0x118')]-0x1){return!![];}switch(_0x11a198){case 0x3:if(_0x1ab7f0[_0x870c('0x115')]>=_0x8f6546[_0x870c('0x188')]-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countnoanswerretry':_0x1ab7f0['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546['dialNoAnswerRetryFrequency'],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0[_0x870c('0xd1')]||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0x189')));break;case 0x5:if(_0x1ab7f0[_0x870c('0x114')]>=_0x8f6546[_0x870c('0x18a')]-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countbusyretry':_0x1ab7f0[_0x870c('0x114')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546[_0x870c('0x18b')],'minutes')[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0['VoiceQueueId']||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1ab7f0[_0x870c('0x120')]>=_0x8f6546[_0x870c('0x18c')]-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countcongestionretry':_0x1ab7f0[_0x870c('0x120')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546[_0x870c('0x18d')],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1ab7f0['ContactId'],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0[_0x870c('0xd1')]||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1ab7f0[_0x870c('0x116')]>=_0x8f6546[_0x870c('0x18e')]-0x1){return!![];}else{hopperUtils[_0x870c('0xde')]({'active':![],'countnosuchnumberretry':_0x1ab7f0[_0x870c('0x116')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546[_0x870c('0x18f')],_0x870c('0xce'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0['VoiceQueueId']||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})['catch'](loggerCatch(_0x870c('0x190')));}break;case 0xa:if(_0x1ab7f0[_0x870c('0xcc')]>=_0x8f6546['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countdropretry':_0x1ab7f0[_0x870c('0xcc')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546['dialDropRetryFrequency'],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0[_0x870c('0xd1')]||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})['catch'](loggerCatch(_0x870c('0xd3')));break;case 0xb:if(_0x1ab7f0[_0x870c('0xda')]>=_0x8f6546[_0x870c('0xdd')]-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countabandonedretry':_0x1ab7f0[_0x870c('0xda')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546['dialAbandonedRetryFrequency'],_0x870c('0xce'))[_0x870c('0x41')](_0x870c('0xbc')),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0['VoiceQueueId']||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0x191')));break;case 0x13:if(_0x1ab7f0[_0x870c('0x111')]>=_0x8f6546[_0x870c('0x11a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1ab7f0[_0x870c('0x111')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546[_0x870c('0x11c')],_0x870c('0xce'))['format'](_0x870c('0xbc')),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0['VoiceQueueId']||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch(_0x870c('0x11d')));break;case 0x14:if(_0x1ab7f0['countagentrejectretry']>=_0x8f6546[_0x870c('0x192')]-0x1){return!![];}hopperUtils[_0x870c('0xde')]({'active':![],'countagentrejectretry':_0x1ab7f0[_0x870c('0x117')]+=0x1,'scheduledat':moment()[_0x870c('0xcd')](_0x8f6546[_0x870c('0x193')],_0x870c('0xce'))[_0x870c('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab7f0[_0x870c('0xcf')],'ListId':_0x1ab7f0[_0x870c('0xd0')],'VoiceQueueId':_0x1ab7f0[_0x870c('0xd1')]||undefined,'CampaignId':_0x1ab7f0[_0x870c('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x870c('0xfd')]=function(_0x4ea4da,_0x24f759,_0x41414c){var _0x2fbfef=this;var _0x228f2d=new History(_0x4ea4da);var _0x5df42d=![];var _0x807bcd;var _0x3a8435;return new Promise(function(_0x529024,_0xfc718){if(_['isUndefined'](_0x24f759)&&typeof _0x24f759!=='object'){return _0xfc718(msgResponse(_0x870c('0x194'),_0x870c('0x89'),'entity\x20is\x20undefine'));}if(_[_0x870c('0x3b')](_0x41414c)&&typeof _0x41414c!==_0x870c('0x195')){return _0xfc718(msgResponse(_0x870c('0x194'),_0x870c('0x89'),'evt\x20is\x20undefine'));}hopperUtils[_0x870c('0xdc')](_0x228f2d,_0x41414c[_0x870c('0x196')],_0x24f759)[_0x870c('0x39')](function(_0x360acd){if(_0x360acd[_0x870c('0xcb')]==0x1)_0x5df42d=!![];switch(_0x41414c[_0x870c('0x196')]){case'0':_0x24f759['outboundNoSuchCallsDay']+=0x1;_0x228f2d['state']=0x0;_0x228f2d[_0x870c('0x69')]='NoSuchNumber';_0x228f2d[_0x870c('0x116')]+=0x1;_0x228f2d['countglobal']+=0x1;ami[_0x870c('0x109')](_0x870c('0x197'),ut['buildObj'](_0x4ea4da,'nosuchnumber'));_0x807bcd=_0x24f759[_0x870c('0x18f')];_0x3a8435=_0x24f759[_0x870c('0x198')];hopperUtils[_0x870c('0x112')](_0x228f2d)[_0x870c('0x95')](loggerCatch(_0x870c('0x113')));if(_0x2fbfef[_0x870c('0x187')](0x0,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0x116')]>=_0x24f759[_0x870c('0x18e')]){_0x2fbfef[_0x870c('0x11b')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x199'));}else{_0x2fbfef['stateGlobal'](_0x228f2d,_0x529024,_0xfc718,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x24f759[_0x870c('0x19a')]+=0x1;_0x228f2d[_0x870c('0x68')]=0x3;_0x228f2d[_0x870c('0x69')]='NoAnswer';_0x228f2d[_0x870c('0x115')]+=0x1;_0x228f2d[_0x870c('0xc8')]+=0x1;var _0x77e1a0=ut['buildNoAnswerEventPayload'](_0x4ea4da,_0x24f759);ami[_0x870c('0x109')](_0x870c('0x19b'),_0x77e1a0);_0x807bcd=_0x24f759[_0x870c('0x19c')];_0x3a8435=_0x24f759[_0x870c('0x198')];hopperUtils[_0x870c('0x112')](_0x228f2d)[_0x870c('0x95')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2fbfef[_0x870c('0x187')](0x3,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d['countnoanswerretry']>=_0x24f759[_0x870c('0x188')]){_0x2fbfef['createStateFinal'](_0x228f2d,_0x529024,_0xfc718,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2fbfef[_0x870c('0x119')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x19d'));}}break;case'5':_0x24f759[_0x870c('0x19e')]+=0x1;_0x228f2d[_0x870c('0x68')]=0x5;_0x228f2d[_0x870c('0x69')]='Busy';_0x228f2d['countbusyretry']+=0x1;_0x228f2d[_0x870c('0xc8')]+=0x1;ami[_0x870c('0x109')](_0x870c('0x19f'),ut[_0x870c('0x10b')](_0x4ea4da,_0x870c('0x1a0')));_0x807bcd=_0x24f759[_0x870c('0x18b')];_0x3a8435=_0x24f759[_0x870c('0x198')];hopperUtils[_0x870c('0x112')](_0x228f2d)[_0x870c('0x95')](loggerCatch(_0x870c('0x1a1')));if(_0x2fbfef[_0x870c('0x187')](0x5,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0x114')]>=_0x24f759[_0x870c('0x18a')]){_0x2fbfef[_0x870c('0x11b')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1a2'));}else{_0x2fbfef['stateGlobal'](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1a2'));}}break;case'8':_0x24f759[_0x870c('0x1a3')]+=0x1;_0x228f2d['state']=0x8;_0x228f2d[_0x870c('0x69')]=_0x870c('0x1a4');_0x228f2d[_0x870c('0x120')]+=0x1;_0x228f2d[_0x870c('0xc8')]+=0x1;_0x807bcd=_0x24f759[_0x870c('0x18d')];_0x3a8435=_0x24f759[_0x870c('0x198')];ami[_0x870c('0x109')](_0x870c('0x1a5'),ut['buildObj'](_0x4ea4da,_0x870c('0x1a6')));hopperUtils[_0x870c('0x112')](_0x228f2d)[_0x870c('0x95')](loggerCatch(_0x870c('0x1a7')));if(_0x2fbfef[_0x870c('0x187')](0x8,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0x120')]>=_0x24f759[_0x870c('0x18c')]){_0x2fbfef[_0x870c('0x11b')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1a8'));}else{_0x2fbfef[_0x870c('0x119')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1a8'));}}break;case'11':_0x24f759[_0x870c('0x1a9')]+=0x1;_0x228f2d[_0x870c('0x68')]=0xb;_0x228f2d[_0x870c('0x69')]=_0x870c('0x1aa');_0x228f2d[_0x870c('0xda')]+=0x1;_0x228f2d[_0x870c('0xc8')]+=0x1;_0x807bcd=_0x24f759[_0x870c('0xdb')];_0x3a8435=_0x24f759[_0x870c('0x198')];hopperUtils['createHistory'](_0x228f2d)[_0x870c('0x95')](loggerCatch(_0x870c('0xdf')));if(_0x2fbfef[_0x870c('0x187')](0xb,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0xda')]>=_0x24f759[_0x870c('0xdd')]){_0x2fbfef[_0x870c('0x11b')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1ab'));}else{_0x2fbfef['stateGlobal'](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1ab'));}}break;case'20':_0x24f759[_0x870c('0x1ac')]+=0x1;_0x228f2d[_0x870c('0x68')]=0x14;_0x228f2d['statedesc']=_0x870c('0x1ad');_0x228f2d[_0x870c('0x117')]+=0x1;_0x228f2d['countglobal']+=0x1;_0x807bcd=_0x24f759['dialAgentRejectRetryFrequency'];_0x3a8435=_0x24f759[_0x870c('0x198')];ami[_0x870c('0x109')](_0x870c('0x1ae'),ut[_0x870c('0x10b')](_0x4ea4da,_0x870c('0x1af')));hopperUtils['createHistory'](_0x228f2d)[_0x870c('0x95')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2fbfef[_0x870c('0x187')](0x14,_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0x117')]>=_0x24f759[_0x870c('0x192')]){_0x2fbfef[_0x870c('0x11b')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1b0'));}else{_0x2fbfef[_0x870c('0x119')](_0x228f2d,_0x529024,_0xfc718,_0x870c('0x1b0'));}}break;default:_0x24f759[_0x870c('0x12d')]+=0x1;_0x228f2d[_0x870c('0x68')]=0xc;_0x228f2d['statedesc']=_0x41414c['reason'];_0x807bcd=_0x24f759[_0x870c('0x193')];_0x3a8435=_0x24f759['callAdditionalPhoneAfterMin'];hopperUtils[_0x870c('0x112')](_0x228f2d)[_0x870c('0x95')](loggerCatch(_0x870c('0x1b1')));if(_0x2fbfef[_0x870c('0x187')](_0x41414c[_0x870c('0x196')],_0x4ea4da,_0x24f759)&&!_0x5df42d){if(_0x228f2d[_0x870c('0x114')]+_0x228f2d[_0x870c('0x120')]+_0x228f2d[_0x870c('0x115')]+_0x228f2d[_0x870c('0x116')]+_0x228f2d[_0x870c('0xcc')]+_0x228f2d['countabandonedretry']+_0x228f2d['countmachineretry']+_0x228f2d[_0x870c('0x117')]>=_0x24f759['dialGlobalMaxRetry']){_0x2fbfef[_0x870c('0x119')](_0x228f2d,_0x529024,_0xfc718,_0x41414c['reason']);}else{_0x2fbfef['createStateFinal'](_0x228f2d,_0x529024,_0xfc718,_0x41414c[_0x870c('0x196')]);}}}})['then'](function(){if(_0x5df42d){hopperUtils[_0x870c('0xd7')](_0x228f2d,_0x807bcd,_0x3a8435)[_0x870c('0x39')](function(){return _0x529024(0x1);});}});});};Dialer['prototype'][_0x870c('0x119')]=function(_0x5ba83d,_0x3e56a0,_0x878126,_0x2836a7){var _0x41c0bc=new Final(_0x5ba83d);_0x41c0bc[_0x870c('0x68')]=0xf;_0x41c0bc[_0x870c('0x69')]=_0x870c('0x1b2');this[_0x870c('0x11b')](_0x41c0bc,_0x3e56a0,_0x878126,_0x2836a7);};Dialer[_0x870c('0x14')][_0x870c('0x11b')]=function(_0x1add2d,_0x58d388,_0x17d6f4,_0x55bc7d){hopperUtils['moveContactManagedDialer'](_0x1add2d)[_0x870c('0x39')](function(){return _0x58d388(msgResponse(_0x870c('0x194'),_0x870c('0xfb'),_0x55bc7d));})['catch'](function(){return _0x17d6f4(msgResponse(_0x870c('0x1b3'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x870c('0x14')][_0x870c('0x7')]=function(_0x40d5c7){var _0x50963f=_0x40d5c7['dialPredictiveOptimizationPercentage']/0x64;var _0xc28514=_0x40d5c7[_0x870c('0xc4')]/(_0x40d5c7[_0x870c('0xc4')]+_0x40d5c7[_0x870c('0xb8')]);var _0x3ee8d6=Math[_0x870c('0x1b4')](_0x40d5c7[_0x870c('0x1b5')]*(_0x40d5c7['predictiveIntervalMaxThreshold']/0x64));var _0x5b5723=Math[_0x870c('0x1b4')](_0x40d5c7[_0x870c('0x1b5')]*(_0x40d5c7[_0x870c('0x1b6')]/0x64));var _0x53ccad=_0x40d5c7[_0x870c('0x1b7')]+_0x40d5c7['talking'];var _0x5271ea=Math[_0x870c('0x1b8')](_0x40d5c7[_0x870c('0x1b9')]*_0x40d5c7['erlangAbandonmentRate']*_0x40d5c7[_0x870c('0x1ba')]*_0x40d5c7[_0x870c('0x1bb')]);if(_[_0x870c('0x3b')](_0x40d5c7[_0x870c('0x22')])){if(!_[_0x870c('0x3b')](_0x40d5c7['startPredictive'])){_0x40d5c7['startPredictive']=undefined;loggerPredictive['error'](_0x870c('0x1bc'),_0x870c('0x1bd'));}if(!_[_0x870c('0x3b')](_0x40d5c7[_0x870c('0x5d')])){loggerPredictive[_0x870c('0x5f')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x40d5c7[_0x870c('0x5d')]);_0x40d5c7['handlePredictive']=undefined;}_0x40d5c7[_0x870c('0x22')]=moment()[_0x870c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x870c('0x46')](_0x40d5c7[_0x870c('0x43')],_0x870c('0x1be'),_0x40d5c7[_0x870c('0x22')]);this[_0x870c('0xa7')](_0x40d5c7,0x1);}else if(ifInterval(_0x40d5c7[_0x870c('0x1bf')],_0x40d5c7[_0x870c('0x22')])){this[_0x870c('0xa7')](_0x40d5c7,0x1);loggerPredictiveCalls[_0x870c('0x46')](_0x870c('0x1c0'),_0x40d5c7['startProgressive'],_0x40d5c7[_0x870c('0x43')]);_0x40d5c7['erlangCalls']=0x0;_0x40d5c7[_0x870c('0x1c1')]=0x0;}else if(_0x50963f<_0xc28514&&_0x40d5c7['dialPredictiveOptimization']===_0x870c('0x1c2')){clearPredictiveAttributes(_0x40d5c7);loggerPredictive[_0x870c('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x870c('0x1c3'),_0xc28514,'startProgressive',_0x40d5c7[_0x870c('0x43')]);}else if(_0x5271ea<_0x40d5c7['predictiveIntervalErlangCallsDroppedCalls']&&_0x40d5c7[_0x870c('0x1c4')]===_0x870c('0x1c2')){clearPredictiveAttributes(_0x40d5c7);loggerPredictive[_0x870c('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x870c('0x1c5'),_0x5271ea,_0x870c('0x1c6'),_0x40d5c7[_0x870c('0x1c1')],'startProgressive',_0x40d5c7[_0x870c('0x43')]);}else if(!ifInterval(_0x40d5c7[_0x870c('0x1bf')],_0x40d5c7[_0x870c('0x22')])&&_[_0x870c('0x3b')](_0x40d5c7[_0x870c('0x5c')])&&!_[_0x870c('0x3b')](_0x40d5c7['startProgressive'])){_0x40d5c7[_0x870c('0x5c')]=moment()[_0x870c('0x41')](_0x870c('0xbc'));loggerPredictive[_0x870c('0x46')](_0x40d5c7['name'],_0x870c('0x1c7'),_0x40d5c7[_0x870c('0x5c')]);hopperUtils['avgHandleTime'](_0x40d5c7[_0x870c('0x1bf')])[_0x870c('0x39')](this[_0x870c('0x1c8')](_0x40d5c7))[_0x870c('0x39')](mergeDataErlangB(_0x40d5c7))[_0x870c('0x39')](this[_0x870c('0x1c9')](_0x40d5c7))[_0x870c('0x95')](loggerCatchPredictive(_0x870c('0x1ca'),_0x40d5c7));}else if(!ifInterval(_0x40d5c7[_0x870c('0x1bf')],_0x40d5c7[_0x870c('0x5c')])){_0x40d5c7[_0x870c('0x1c1')]=0x0;_0x40d5c7[_0x870c('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x40d5c7['name'],'recalculate\x20predictive\x20at',_0x40d5c7[_0x870c('0x5c')]);clearInterval(_0x40d5c7['handlePredictive']);_0x40d5c7[_0x870c('0x5d')]=undefined;hopperUtils['avgHandleTime'](_0x40d5c7[_0x870c('0x1bf')])[_0x870c('0x39')](this[_0x870c('0x1c8')](_0x40d5c7))[_0x870c('0x39')](mergeDataErlangB(_0x40d5c7))[_0x870c('0x39')](this[_0x870c('0x1c9')](_0x40d5c7))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x40d5c7));}else if(_0x40d5c7[_0x870c('0x1b5')]&&_0x53ccad<_0x40d5c7[_0x870c('0x1b5')]-_0x5b5723){clearPredictiveAttributes(_0x40d5c7);loggerPredictive[_0x870c('0x46')](_0x40d5c7[_0x870c('0x43')],_0x870c('0x1cb'),_0x53ccad,_0x870c('0x1cc'),_0x40d5c7[_0x870c('0x1b5')],'-',_0x5b5723,'=',_0x40d5c7[_0x870c('0x1b5')]-_0x5b5723,')');}else if(_0x40d5c7[_0x870c('0x1b5')]&&_0x53ccad>_0x40d5c7[_0x870c('0x1b5')]+_0x3ee8d6){clearPredictiveAttributes(_0x40d5c7);loggerPredictive[_0x870c('0x46')](_0x40d5c7['name'],_0x870c('0x1cb'),_0x53ccad,_0x870c('0x1cd'),_0x40d5c7[_0x870c('0x1b5')],'+',_0x3ee8d6,'=',_0x40d5c7[_0x870c('0x1b5')]+_0x3ee8d6,')');}};Dialer[_0x870c('0x14')][_0x870c('0x1c8')]=function(_0x1428d2){var _0x2b13bd=this;return function(_0xa2511){return new Promise(function(_0x3fad79,_0x15094b){_[_0x870c('0x59')](_0x1428d2,_0xa2511[0x0]);if(checkGetDataPredictive(_0xa2511[0x0])){var _0x61a1fd=_0x1428d2['predictiveIntervalAvailable']=_0x1428d2['talking']+_0x1428d2[_0x870c('0x1b7')];var _0x309057=_0x1428d2[_0x870c('0x1bf')]*0x3c;var _0x395988=_0xa2511[0x0][_0x870c('0x4f')]+_0xa2511[0x0][_0x870c('0x51')];var _0x167f3e=(_0xa2511[0x0][_0x870c('0x4a')]+_0xa2511[0x0][_0x870c('0x4c')]+_0xa2511[0x0][_0x870c('0x4d')])/_0xa2511[0x0][_0x870c('0x48')];_0x1428d2[_0x870c('0x1ba')]=_0x167f3e>0x0?_0x167f3e:0x1;switch(_0x1428d2[_0x870c('0x1c4')]){case _0x870c('0x1c2'):var _0x141eca=_0x1428d2[_0x870c('0x1ce')]/0x64;return _0x2b13bd[_0x870c('0x1cf')](_0x61a1fd,_0x309057,_0x395988,_0x167f3e,_0x141eca)[_0x870c('0x39')](function(_0x2a11eb){return _0x3fad79(_0x2a11eb);});case _0x870c('0x1d0'):var _0xd18ae1=_0x1428d2[_0x870c('0x1ce')]/0x64;return _0x2b13bd['busyFactor'](_0x61a1fd,_0x309057,_0x395988,_0x167f3e,_0xd18ae1)[_0x870c('0x39')](function(_0x5003b8){return _0x3fad79(_0x5003b8);});default:return _0x15094b(msgResponse(_0x870c('0x1d1'),_0x870c('0x89'),'Unknown\x20Predictive'));}}else{return _0x15094b(msgResponse(_0x870c('0x1d1'),_0x870c('0x89'),_0x870c('0x1d2')));}});};};Dialer['prototype'][_0x870c('0x1d3')]=function(_0x3cd78a){var _0x59920f=this;return function(_0x272000){return new Promise(function(_0x4be98a,_0x287787){_['merge'](_0x3cd78a,_0x272000[0x0]);if(checkGetDataPredictive(_0x272000[0x0])){loggerPredictive[_0x870c('0x46')](JSON[_0x870c('0x6e')](_0x272000[0x0]));if(_0x3cd78a[_0x870c('0x1c4')]===_0x870c('0x1c2')){return _0x59920f['getVoiceQueueRtPauses'](_0x3cd78a['id'])[_0x870c('0x39')](function(_0x47683f){var _0x1eb637=_0x3cd78a[_0x870c('0x1d4')]-_0x47683f[0x0][_0x870c('0x1d5')];var _0x38398d=_0x3cd78a[_0x870c('0x1bf')]*0x3c;var _0x4fd9bf=_0x272000[0x0][_0x870c('0x4f')]+_0x272000[0x0]['predictiveIntervalAvgHoldtime'];var _0xa20f3c=(_0x272000[0x0][_0x870c('0x4a')]+_0x272000[0x0][_0x870c('0x4c')]+_0x272000[0x0][_0x870c('0x4d')])/_0x272000[0x0][_0x870c('0x48')];var _0x5aad40=_0x3cd78a[_0x870c('0x1ce')]/0x64;_0x3cd78a[_0x870c('0x1d6')]=_0x47683f[0x0]['outboundQueuePauses']||0x0;_0x3cd78a[_0x870c('0x1ba')]=_0xa20f3c>0x0?_0xa20f3c:0x1;return _0x59920f[_0x870c('0x1cf')](_0x1eb637,_0x38398d,_0x4fd9bf,_0xa20f3c,_0x5aad40);})[_0x870c('0x39')](function(_0x21183c){return _0x4be98a(_0x21183c);})[_0x870c('0x95')](function(_0x2cf5d7){return _0x287787(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x2cf5d7)));});}if(_0x3cd78a[_0x870c('0x1c4')]==='agentBusyFactor'){return _0x59920f[_0x870c('0x14c')](_0x3cd78a['id'])[_0x870c('0x39')](function(_0x5ae099){var _0x388ef6=_0x3cd78a[_0x870c('0x1d4')]-_0x5ae099[0x0]['outboundQueuePauses'];var _0x55d059=_0x3cd78a[_0x870c('0x1bf')]*0x3c;var _0x28c7b9=_0x272000[0x0][_0x870c('0x4f')]+_0x272000[0x0][_0x870c('0x51')];var _0x42a74f=(_0x272000[0x0][_0x870c('0x4a')]+_0x272000[0x0][_0x870c('0x4c')]+_0x272000[0x0][_0x870c('0x4d')])/_0x272000[0x0][_0x870c('0x48')];var _0x550e45=_0x3cd78a['dialPredictiveOptimizationPercentage']/0x64;_0x3cd78a[_0x870c('0x1d6')]=_0x5ae099[0x0][_0x870c('0x1d5')]||0x0;_0x3cd78a[_0x870c('0x1ba')]=_0x42a74f>0x0?_0x42a74f:0x1;return _0x59920f['busyFactor'](_0x388ef6,_0x55d059,_0x28c7b9,_0x42a74f,_0x550e45);})[_0x870c('0x39')](function(_0x348a00){return _0x4be98a(_0x348a00);})[_0x870c('0x95')](function(_0x2d4cf4){return _0x287787(msgResponse(_0x870c('0x1d7'),_0x870c('0x89'),JSON[_0x870c('0x6e')](_0x2d4cf4)));});}}else{return _0x287787(msgResponse(_0x870c('0x1d1'),_0x870c('0x89'),_0x870c('0x1d2')));}});};};Dialer[_0x870c('0x14')][_0x870c('0x1c9')]=function(_0x2e8143){var _0x2e707e=this;return function(){var _0x2e7fb4=0x0;var _0x1ef3bb=Math[_0x870c('0x1b8')](_0x2e8143[_0x870c('0x1d8')]*0x3e8);if(_0x1ef3bb>0x0){_0x1ef3bb=_0x1ef3bb<0x64?0x64:_0x1ef3bb;loggerPredictive['info'](_0x2e8143[_0x870c('0x43')],'one\x20call\x20every:',_0x1ef3bb,_0x870c('0x1d9'));_0x2e8143[_0x870c('0x5d')]=setInterval(function(){_0x2e707e[_0x870c('0x5d')](_0x2e8143);loggerPredictiveCalls[_0x870c('0x46')](_0x870c('0x1da'),_0x2e7fb4+=0x1);},_0x1ef3bb);}else{loggerPredictive[_0x870c('0x46')](_0x2e8143['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x870c('0x14')]['checkContactBlack']=function(_0x392742,_0x21c3df){var _0x29ca5a=this;return function(_0x1e79a6){if(_[_0x870c('0x45')](_0x1e79a6)){if(_['isNil'](_0x21c3df[_0x870c('0x14f')])||!_0x21c3df[_0x870c('0x1db')]){if(_0x392742['dialMethod']===_0x870c('0x6')){_0x392742[_0x870c('0x6c')]=_[_0x870c('0x3b')](_0x392742[_0x870c('0x6c')])?!![]:_0x392742[_0x870c('0x6c')];var _0x41d662=uuid['v4']();_0x29ca5a[_0x870c('0x1e')][_0x41d662]=new Action(_0x392742,_0x21c3df,_0x41d662);loggerBooked['info'](_0x870c('0x1dc'),_0x41d662,_0x870c('0x1dd'),JSON[_0x870c('0x6e')](_0x392742[_0x870c('0x6c')]),_0x870c('0x1de'),_0x392742[_0x870c('0x43')]);if(_0x392742['queueStatusComplete']){_0x392742['queueStatusComplete']=![];_0x29ca5a['queueBooked'][_0x29ca5a[_0x870c('0x1e')][_0x41d662][_0x870c('0xb3')]]=[];ami['Action']({'actionid':_0x41d662,'action':'queuestatus','queue':_0x392742[_0x870c('0x43')]})[_0x870c('0x95')](function(){utils[_0x870c('0xb5')](_0x392742,_0x870c('0x1df'));hopperUtils[_0x870c('0xde')]({'active':![],'ContactId':_0x29ca5a[_0x870c('0x1e')][_0x41d662][_0x870c('0xcf')],'ListId':_0x29ca5a['actions'][_0x41d662][_0x870c('0xd0')],'VoiceQueueId':_0x29ca5a['actions'][_0x41d662][_0x870c('0xd1')]||undefined,'CampaignId':_0x29ca5a[_0x870c('0x1e')][_0x41d662][_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x29ca5a[_0x870c('0x1e')][_0x41d662];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x870c('0x6e')](_0x392742['queueStatusComplete']),_0x870c('0x1de'),_0x392742[_0x870c('0x43')]);utils[_0x870c('0xb5')](_0x392742,_0x870c('0x1df'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x29ca5a[_0x870c('0x1e')][_0x41d662][_0x870c('0xcf')],'ListId':_0x29ca5a['actions'][_0x41d662][_0x870c('0xd0')],'VoiceQueueId':_0x29ca5a['actions'][_0x41d662]['VoiceQueueId']||undefined,'CampaignId':_0x29ca5a[_0x870c('0x1e')][_0x41d662]['CampaignId']||undefined})[_0x870c('0x95')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x29ca5a[_0x870c('0x1e')][_0x41d662];}}else{return _0x29ca5a[_0x870c('0x1e0')](_0x392742,_0x21c3df);}}else{if(utils[_0x870c('0x5a')](undefined,_0x21c3df[_0x870c('0x1e1')])<_0x392742[_0x870c('0x1e2')]*0x3c){if(_0x21c3df[_0x870c('0x143')]&&!_0x21c3df[_0x870c('0x143')][_0x870c('0x1e3')]){_0x29ca5a[_0x870c('0x18')][_0x870c('0xea')](_0x21c3df['id'])[_0x870c('0x186')](function(){utils[_0x870c('0xb5')](_0x392742,_0x870c('0x1df'));});}else{hopperUtils[_0x870c('0x1e4')]({'active':![]},_0x21c3df['id'],0x1)['finally'](function(){utils[_0x870c('0xb5')](_0x392742,_0x870c('0x1df'));});}}else{_0x392742['outboundReCallsDay']+=0x1;utils['decrementOriginate'](_0x392742,_0x870c('0x1df'));if(_0x392742[_0x870c('0x1e5')]){hopperUtils[_0x870c('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x21c3df['ContactId'],'ListId':_0x21c3df[_0x870c('0xd0')],'VoiceQueueId':_0x21c3df[_0x870c('0xd1')]||undefined,'CampaignId':_0x21c3df[_0x870c('0xd2')]||undefined})[_0x870c('0x95')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x870c('0x112')](createObjHistory(_0x392742,_0x21c3df,utils[_0x870c('0x63')]['QUEUE_RECALL'],0x17,_0x870c('0x1e6')))[_0x870c('0x95')](loggerCatch(_0x870c('0x1e7')));}else{_0x29ca5a[_0x870c('0x10d')](createObjHistory(_0x392742,_0x21c3df,utils[_0x870c('0x63')][_0x870c('0x1e8')],0x16,_0x870c('0x1e9')),_0x870c('0x1ea'),_0x870c('0x1eb'));}}}}else{_0x392742[_0x870c('0x1ec')]+=0x1;_0x29ca5a[_0x870c('0x10d')](createObjHistory(_0x392742,_0x21c3df,utils[_0x870c('0x63')][_0x870c('0x1ed')],0xd,_0x870c('0x1ee')),'[Originate][historyBlacklist]',_0x870c('0x1ef'));throw'inBlackList';}};};Dialer[_0x870c('0x14')]['handleIvr']=function(_0x38106a){var _0x1eb80a=this;var _0x2c330d=_0x38106a['limitCalls']-_0x38106a[_0x870c('0x1f0')];emitCampaignSummary(_0x38106a);if(_0x2c330d>0x0&&_0x38106a[_0x870c('0x1f1')]==0x0){if(_0x2c330d>this[_0x870c('0x1d')]){_0x2c330d=this[_0x870c('0x1d')];}_0x38106a['temp']=0x1;hopperUtils[_0x870c('0x1f2')](_0x38106a,_0x2c330d)['then'](function(_0x17b528){_0x38106a[_0x870c('0x1f1')]=0x0;if(_0x17b528){if(!utils[_0x870c('0x1f3')](_0x17b528)){_0x38106a[_0x870c('0x62')]=utils[_0x870c('0x63')]['NO_AVAILABLE_CONTACTS'];logger[_0x870c('0x46')](_0x870c('0x1f4')+_0x38106a[_0x870c('0x43')]);}else{_0x38106a['originated']+=_0x17b528[_0x870c('0x8d')];_0x38106a[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x1f5')];for(var _0x39826b=0x0;_0x39826b<_0x17b528[_0x870c('0x8d')];_0x39826b+=0x1){_0x38106a[_0x870c('0x1f6')]+=0x1;if(_['isNil'](_0x17b528[_0x39826b])||_['isNil'](_0x17b528[_0x39826b][_0x870c('0x170')])||_[_0x870c('0xe4')](_0x17b528[_0x39826b]['phone'])){_0x1eb80a[_0x870c('0x14d')]('[actionOriginate]\x20',_0x38106a,_0x17b528[_0x39826b]);}else{hopperUtils[_0x870c('0x1f7')](_[_0x870c('0xe7')](_0x17b528[_0x39826b],[_0x870c('0xd2'),_0x870c('0x155')]))[_0x870c('0x39')](_0x1eb80a[_0x870c('0x1f8')](_0x38106a,_0x17b528[_0x39826b]))['catch'](function(_0x43347e){logger['error'](_0x870c('0x1f9'),_0x43347e);utils[_0x870c('0xb5')](_0x38106a,_0x870c('0x1fa'));});}}}}})['catch'](function(_0x428ed8){_0x38106a['temp']=0x0;logger['error']('[getContactCampaign2]',_0x428ed8);});}};Dialer['prototype']['handlePower']=function(_0x3fc4be,_0x3c998d){var _0x40bf3b=this;var _0x5e8bca=[];if(_0x3c998d<0x1||_0x3fc4be['dialMethod']==='booked'){_0x3c998d=0x1;}var _0x4bfe10=Math[_0x870c('0x1b8')](_0x3fc4be[_0x870c('0x1b7')]*_0x3c998d)-_0x3fc4be[_0x870c('0x1f0')];if(_0x3fc4be['dialLimitQueue']>0x0){var _0x107e73=_0x3fc4be['dialLimitQueue']-_0x3fc4be[_0x870c('0x1f0')]-_0x3fc4be[_0x870c('0x135')]-_0x3fc4be[_0x870c('0x136')];if(_0x4bfe10>_0x107e73){_0x4bfe10=_0x107e73;}}if(_0x4bfe10>0x0&&_0x3fc4be['temp']==0x0){if(_0x3fc4be[_0x870c('0xa6')]===_0x870c('0x6')){_0x4bfe10=0x1;}if(_0x4bfe10>this['maxNumberOriginate']){_0x4bfe10=this['maxNumberOriginate'];}for(var _0x47de9a in this[_0x870c('0x1b')]){if(typeof this['agents'][_0x47de9a]!==_0x870c('0x9d')){if(this[_0x870c('0x1b')][_0x47de9a][_0x870c('0x68')]===_0x870c('0x1fb')&&this[_0x870c('0x1b')][_0x47de9a][_0x870c('0x7e')]===_0x870c('0x7f')){_0x5e8bca[_0x870c('0x1fc')](this[_0x870c('0x1b')][_0x47de9a]['id']);}}}_0x3fc4be[_0x870c('0x1f1')]=0x1;hopperUtils[_0x870c('0x1fd')](_0x3fc4be,_0x5e8bca,_0x4bfe10)[_0x870c('0x39')](function(_0x3c644f){_0x3fc4be['temp']=0x0;if(_0x3c644f){if(!utils[_0x870c('0x1f3')](_0x3c644f)){hopperUtils[_0x870c('0x1fe')](_0x3fc4be)['then'](sendMessageReschedule(_0x3fc4be))['catch'](loggerCatch(_0x870c('0x1ff')));}else{_0x3fc4be[_0x870c('0x1f0')]+=_0x3c644f[_0x870c('0x8d')];_0x3fc4be['message']=_0x3fc4be[_0x870c('0xa6')]==='booked'?utils[_0x870c('0x63')][_0x870c('0x137')]:utils[_0x870c('0x63')][_0x870c('0x1f5')];for(var _0x3045a7=0x0;_0x3045a7<_0x3c644f['length'];_0x3045a7+=0x1){if(_[_0x870c('0xe4')](_0x3c644f[_0x3045a7])||_[_0x870c('0xe4')](_0x3c644f[_0x3045a7][_0x870c('0x170')])||_[_0x870c('0xe4')](_0x3c644f[_0x3045a7][_0x870c('0x155')])){_0x40bf3b[_0x870c('0x14d')](_0x870c('0x200'),_0x3fc4be,_0x3c644f[_0x3045a7]);}else{hopperUtils['checkIsBlackList'](_[_0x870c('0xe7')](_0x3c644f[_0x3045a7],['VoiceQueueId',_0x870c('0x155')]))[_0x870c('0x39')](_0x40bf3b[_0x870c('0x1f8')](_0x3fc4be,_0x3c644f[_0x3045a7]))['catch'](function(_0x117972){logger[_0x870c('0x5f')]('[actionOriginate]',_0x117972);utils['decrementOriginate'](_0x3fc4be,_0x870c('0x201'));});}}}}})[_0x870c('0x95')](function(_0x137d34){_0x3fc4be['temp']=0x0;logger[_0x870c('0x5f')](_0x870c('0x202'),_0x137d34);});}};Dialer[_0x870c('0x14')]['handlePredictive']=function(_0x3a2f1e){if(_0x3a2f1e['dialLimitQueue']>0x0){var _0x580829=_0x3a2f1e[_0x870c('0x203')]-_0x3a2f1e[_0x870c('0x1f0')]-_0x3a2f1e['talking'];if(_0x580829>0x0&&_0x3a2f1e[_0x870c('0x1f1')]==0x0){this[_0x870c('0x204')](_0x3a2f1e);}else{loggerPredictiveCalls[_0x870c('0x46')](_0x870c('0x205'));}}else{this[_0x870c('0x204')](_0x3a2f1e);}};Dialer[_0x870c('0x14')][_0x870c('0x204')]=function(_0x123105){var _0x53528f=this;var _0x96107a=[];_0x123105[_0x870c('0x1f0')]+=0x1;for(var _0x4d698b in this[_0x870c('0x1b')]){if(typeof this[_0x870c('0x1b')][_0x4d698b]!=='undefined'){if(this[_0x870c('0x1b')][_0x4d698b][_0x870c('0x68')]===_0x870c('0x1fb')&&this[_0x870c('0x1b')][_0x4d698b][_0x870c('0x7e')]===_0x870c('0x7f')){_0x96107a[_0x870c('0x1fc')](this['agents'][_0x4d698b]['id']);}}}_0x123105[_0x870c('0x1f1')]=0x1;return this[_0x870c('0x1fd')](_0x123105['id'],_0x96107a,0x1,_0x123105['dialOrderByScheduledAt'],_0x123105)[_0x870c('0x39')](function(_0x4e0753){_0x123105[_0x870c('0x1f1')]=0x1;if(_0x4e0753){if(!utils[_0x870c('0x1f3')](_0x4e0753)){utils[_0x870c('0x206')](_0x123105,0x1,0x0);return hopperUtils['countReScheduled'](_0x123105)[_0x870c('0x39')](sendMessageReschedule(_0x123105))['catch'](loggerCatch(_0x870c('0x1ff')));}else{_0x123105[_0x870c('0x62')]=utils[_0x870c('0x63')][_0x870c('0x1f5')];if(_[_0x870c('0xe4')](_0x4e0753[0x0])||_[_0x870c('0xe4')](_0x4e0753[0x0][_0x870c('0x170')])||_[_0x870c('0xe4')](_0x4e0753[0x0]['phone'])){_0x53528f[_0x870c('0x14d')](_0x870c('0x200'),_0x123105,_0x4e0753[0x0]);}else{return hopperUtils[_0x870c('0x207')](_[_0x870c('0xe7')](_0x4e0753[0x0],[_0x870c('0xd1'),_0x870c('0x155')]))['then'](_0x53528f[_0x870c('0x1f8')](_0x123105,_0x4e0753[0x0]))['catch'](function(_0x2a1c7a){logger[_0x870c('0x5f')](_0x870c('0x208'),_0x2a1c7a);utils['decrementOriginate'](_0x123105,_0x870c('0x208'));});}}}})['catch'](function(_0x204013){_0x123105[_0x870c('0x1f1')]=0x0;logger[_0x870c('0x5f')](_0x870c('0x202'),_0x204013);});};Dialer[_0x870c('0x14')]['abandonmentRate']=function(_0x5451c4,_0x18ad59,_0x2d77c0,_0x343261,_0x2c160e,_0xf97d61){loggerPredictive[_0x870c('0x46')](_0x870c('0x209'));loggerPredictive['info'](_0x870c('0x20a'),_0x5451c4);loggerPredictive[_0x870c('0x46')](_0x870c('0x20b'),_0x18ad59);loggerPredictive[_0x870c('0x46')]('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',_0x2d77c0);loggerPredictive[_0x870c('0x46')]('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',_0x343261);loggerPredictive[_0x870c('0x46')](_0x870c('0x20c'),_0x2c160e);loggerPredictive[_0x870c('0x46')](_0x870c('0x58'));return new Promise(function(_0x158b07,_0x253561){if(_0x5451c4<=0x0||isNaN(_0x5451c4)){return _0x253561(msgResponse(_0x870c('0x20d'),_0x870c('0xb2'),_0x870c('0x20e')+_0x5451c4));}if(_0x2d77c0<=0x0||isNaN(_0x2d77c0)){return _0x253561(msgResponse(_0x870c('0x20d'),_0x870c('0xb2'),_0x870c('0x20f')+_0x2d77c0));}if(_0x343261<=0x0||isNaN(_0x343261)){return _0x253561(msgResponse(_0x870c('0x20d'),'Error','p\x20=\x20'+_0x343261));}if(_0x18ad59<=0x0||isNaN(_0x18ad59)){return _0x253561(msgResponse(_0x870c('0x20d'),_0x870c('0xb2'),_0x870c('0x210')+_0x18ad59));}if(_0x2c160e<=0x0||isNaN(_0x2c160e)){return _0x253561(msgResponse(_0x870c('0x20d'),_0x870c('0xb2'),'Amax\x20=\x20'+_0x2c160e));}_0xf97d61=_0xf97d61||0x0;var _0x420aa6=0x1/_0x2d77c0;var _0x3fce7c=0x0;var _0x3a2db0=0x0;var _0x7799cf=0x0;var _0xb443ff=0x0;for(var _0x4c3d68=0x0;_0x7799cf<_0x2c160e;_0x4c3d68+=0x1){_0x3a2db0=_0x4c3d68/_0x18ad59;_0x3fce7c=(_0x343261*_0x3a2db0+_0xf97d61)/_0x420aa6;_0x7799cf=utils['erlangb'](_0x3fce7c,_0x5451c4);_0xb443ff=_0x3fce7c/_0x5451c4*(0x1-utils[_0x870c('0x211')](_0x3fce7c,_0x5451c4));}return _0x158b07({'erlangCalls':_0x4c3d68,'erlangCallToSecond':_0x18ad59/_0x4c3d68,'erlangAbandonmentRate':_0x7799cf,'erlangBusyFactor':_0xb443ff});});};Dialer[_0x870c('0x14')][_0x870c('0x212')]=function(_0x1bfb57,_0x219a8b,_0x3019a4,_0x7c8dad,_0x2a7ba1,_0x3901c1){loggerPredictive[_0x870c('0x46')](_0x870c('0x213'));loggerPredictive[_0x870c('0x46')](_0x870c('0x20a'),_0x1bfb57);loggerPredictive[_0x870c('0x46')](_0x870c('0x20b'),_0x219a8b);loggerPredictive['info'](_0x870c('0x214'),_0x3019a4);loggerPredictive[_0x870c('0x46')]('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',_0x7c8dad);loggerPredictive[_0x870c('0x46')](_0x870c('0x215'),_0x2a7ba1);loggerPredictive['info'](_0x870c('0x58'));return new Promise(function(_0x56fb82,_0x55d754){if(_0x1bfb57<=0x0||isNaN(_0x1bfb57)){return _0x55d754(msgResponse('[busyFactor]',_0x870c('0xb2'),_0x870c('0x20e')+_0x1bfb57));}if(_0x3019a4<=0x0||isNaN(_0x3019a4)){return _0x55d754(msgResponse(_0x870c('0x216'),'Error',_0x870c('0x20f')+_0x3019a4));}if(_0x7c8dad<=0x0||isNaN(_0x7c8dad)){return _0x55d754(msgResponse(_0x870c('0x216'),_0x870c('0xb2'),_0x870c('0x217')+_0x7c8dad));}if(_0x219a8b<=0x0||isNaN(_0x219a8b)){return _0x55d754(msgResponse(_0x870c('0x216'),_0x870c('0xb2'),_0x870c('0x210')+_0x219a8b));}if(_0x2a7ba1<=0x0||isNaN(_0x2a7ba1)){return _0x55d754(msgResponse(_0x870c('0x216'),'Error','Umin\x20=\x20'+_0x2a7ba1));}_0x3901c1=_0x3901c1||0x0;var _0x2f1abe=0x1/_0x3019a4;var _0x3fa37a=0x0;var _0x3b822f=0x0;var _0x480d3f=0x0;var _0x2aef7c=0x0;for(var _0x2ec3a5=0x0;_0x2aef7c<_0x2a7ba1;_0x2ec3a5+=0x1){_0x3b822f=_0x2ec3a5/_0x219a8b;_0x3fa37a=(_0x7c8dad*_0x3b822f+_0x3901c1)/_0x2f1abe;_0x480d3f=utils['erlangb'](_0x3fa37a,_0x1bfb57);_0x2aef7c=_0x3fa37a/_0x1bfb57*(0x1-utils['erlangb'](_0x3fa37a,_0x1bfb57));}return _0x56fb82({'erlangCalls':_0x2ec3a5,'erlangCallToSecond':_0x219a8b/_0x2ec3a5,'erlangAbandonmentRate':_0x480d3f,'erlangBusyFactor':_0x2aef7c});});};module['exports']=Dialer; \ No newline at end of file +var _0xda7e=['queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','Error','prototype','isTrunkReachable','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','voiceQueues','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','state','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','dialDropRetryFrequency','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','CampaignId','[rescheduleContact][Abandoned]','Abandoned','channel','actionid','strategy','rrmemory','roundrobin','stateinterface','locked','isNil','paused','preview','run','idHopper','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countbusyretry','dialMachineMaxRetry','syncHangup','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','cause-txt','outboundUnknownCallsDay','[syncHangup][createHistory]','running','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','launchHandleIvr','handleIvr','actionOriginate','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialAgentRejectMaxRetry','object','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','swapAdditionalPhones','Global','contact\x20not\x20moved','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','undefined','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','Contact','checkIsBlackList','[actionOriginate]','tryOriginatePredictive','checkContactLowerLimitOriginate','[actionOriginatePredictive]','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','127.0.0.1','enqueue','tail','finally','sequence','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','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','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','starttime','[unlockQueueStatus][undefined]'];(function(_0x2ae0eb,_0x2950e5){var _0x5cb451=function(_0x16f6df){while(--_0x16f6df){_0x2ae0eb['push'](_0x2ae0eb['shift']());}};_0x5cb451(++_0x2950e5);}(_0xda7e,0x1bb));var _0xeda7=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0xda7e[_0x43c8b8];return _0x413be3;};'use strict';var util=require(_0xeda7('0x0'));var _=require('lodash');var uuid=require(_0xeda7('0x1'));var moment=require(_0xeda7('0x2'));var rr=require('rr');var Redis=require(_0xeda7('0x3'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0xeda7('0x4'));var config=require(_0xeda7('0x5'));var logger=require(_0xeda7('0x6'))(_0xeda7('0x7'));var loggerBooked=require(_0xeda7('0x6'))('booked');var loggerPredictive=require(_0xeda7('0x6'))('predictive');var loggerPredictiveCalls=require(_0xeda7('0x6'))(_0xeda7('0x8'));var loggerSyncQueueSummary=require(_0xeda7('0x6'))(_0xeda7('0x9'));var ami=require(_0xeda7('0xa'));config[_0xeda7('0xb')]=_['defaults'](config['redis'],{'host':_0xeda7('0xc'),'port':0x18eb});var io=require(_0xeda7('0xd'))(new Redis(config[_0xeda7('0xb')]));var cmHopper=require(_0xeda7('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xeda7('0xf'));var Interval=require(_0xeda7('0x10'));var Action=require(_0xeda7('0x11'));var History=require(_0xeda7('0x12'));var Final=require(_0xeda7('0x13'));var AgentComplete=require(_0xeda7('0x14'));var QueueCallerAbandon=require(_0xeda7('0x15'));var Hangup=require(_0xeda7('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xeda7('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xeda7('0x18')]=function(_0x4c0525){this['tail']=this[_0xeda7('0x19')]?this[_0xeda7('0x19')][_0xeda7('0x1a')](_0x4c0525):_0x4c0525();};function Dialer(_0x2b56f8,_0x5d8e4a){this[_0xeda7('0x1b')]=new Sequence();this['preview']=_0x5d8e4a;this['voiceQueues']=_0x2b56f8['voiceQueues'];this['campaigns']=_0x2b56f8[_0xeda7('0x1c')];this[_0xeda7('0x1d')]=_0x2b56f8['agents'];this[_0xeda7('0x1e')]=_0x2b56f8[_0xeda7('0x1e')];this[_0xeda7('0x1f')]=config[_0xeda7('0x1f')]||0x2;this[_0xeda7('0x20')]={};this[_0xeda7('0x21')]={};this['contactsId']={};this[_0xeda7('0x22')]={};this[_0xeda7('0x23')]={};this[_0xeda7('0x24')]={};this['startProgressive']={};this[_0xeda7('0x25')]={};this[_0xeda7('0x26')]={};this[_0xeda7('0x27')]={};this[_0xeda7('0x28')]={};ami['on'](_0xeda7('0x29'),this[_0xeda7('0x2a')][_0xeda7('0x2b')](this));ami['on'](_0xeda7('0x2c'),this[_0xeda7('0x2d')][_0xeda7('0x2b')](this));ami['on']('originateresponse',this[_0xeda7('0x2e')][_0xeda7('0x2b')](this));ami['on'](_0xeda7('0x2f'),this[_0xeda7('0x30')]['bind'](this));ami['on'](_0xeda7('0x31'),this[_0xeda7('0x9')][_0xeda7('0x2b')](this));ami['on'](_0xeda7('0x32'),this[_0xeda7('0x33')]['bind'](this));ami['on'](_0xeda7('0x34'),this['syncHangup'][_0xeda7('0x2b')](this));ami['on']('newexten',this[_0xeda7('0x35')]['bind'](this));ami['on'](_0xeda7('0x36'),this[_0xeda7('0x37')][_0xeda7('0x2b')](this));ami['on'](_0xeda7('0x38'),this['syncQueueMember'][_0xeda7('0x2b')](this));ami['on'](_0xeda7('0x39'),this[_0xeda7('0x3a')]['bind'](this));this[_0xeda7('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0xeda7('0x3c')]()['then'](function(_0x192680){previewRecallmeReminderInterval=_0x192680[_0xeda7('0x3d')];});}function isNotNull(_0x5a4e7a){return _0x5a4e7a!==null&&!_[_0xeda7('0x3e')](_0x5a4e7a);}function msgResponse(_0x214a13,_0x35f2b2,_0x126c53){return{'action':_0x214a13,'response':_0x35f2b2,'message':_0x126c53,'stack':_0x126c53};}function emit(_0x5d6015,_0x169a1c,_0x22015d){io['to'](_0x5d6015)[_0xeda7('0x3f')](_0x169a1c,_0x22015d);}function emitOutboundVoiceQueueSummary(_0x12f1c0){if(_0x12f1c0[_0xeda7('0x40')]===_0xeda7('0x41')){logger[_0xeda7('0x42')](_0xeda7('0x43'),util[_0xeda7('0x44')](_0x12f1c0,{'showHidden':![],'depth':null}));emit(util[_0xeda7('0x45')](_0xeda7('0x46'),_0x12f1c0[_0xeda7('0x47')]),_0xeda7('0x48'),_0x12f1c0);}}function checkGetDataPredictive(_0x9981aa){if(isNotNull(_0x9981aa)&&!_[_0xeda7('0x49')](_0x9981aa)){loggerPredictive[_0xeda7('0x4a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9981aa[_0xeda7('0x4b')]);loggerPredictive[_0xeda7('0x4a')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9981aa[_0xeda7('0x4c')]);loggerPredictive['info'](_0xeda7('0x4d'),_0x9981aa[_0xeda7('0x4e')]);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x4f'),_0x9981aa[_0xeda7('0x50')]);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x51'),_0x9981aa['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xeda7('0x4a')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9981aa[_0xeda7('0x52')]);loggerPredictive['info']('---------------------------');if(_0x9981aa[_0xeda7('0x4b')]>0x0){if(!_[_0xeda7('0x3e')](_0x9981aa[_0xeda7('0x52')])&&_0x9981aa['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xeda7('0x4a')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x9981aa[_0xeda7('0x53')])&&_0x9981aa['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x54'));}else{loggerPredictive[_0xeda7('0x4a')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xeda7('0x4a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x46db24){return function(_0x2252c0){loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x55'));loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x56'),_0x2252c0[_0xeda7('0x57')]);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x58'),_0x2252c0[_0xeda7('0x59')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2252c0[_0xeda7('0x5a')]);loggerPredictive['info'](_0xeda7('0x5b'),_0x2252c0['erlangBusyFactor']);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x5c'),_0x2252c0[_0xeda7('0x5a')]);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x5d'));_[_0xeda7('0x5e')](_0x46db24,_0x2252c0);};}function ifInterval(_0x3288ac,_0x391fe9){if(_[_0xeda7('0x3e')](_0x391fe9)){return![];}return utils[_0xeda7('0x5f')](undefined,_0x391fe9)<_0x3288ac*0x3c;}function clearPredictiveAttributes(_0x55586c){if(_0x55586c[_0xeda7('0x60')]){_0x55586c[_0xeda7('0x60')]=undefined;loggerPredictive[_0xeda7('0x42')](_0x55586c[_0xeda7('0x47')],_0xeda7('0x61'));}if(_0x55586c[_0xeda7('0x24')]){_0x55586c[_0xeda7('0x24')]=undefined;loggerPredictive['debug'](_0x55586c['name'],_0xeda7('0x62'));}if(_0x55586c[_0xeda7('0x63')]){clearInterval(_0x55586c[_0xeda7('0x63')]);_0x55586c[_0xeda7('0x63')]=undefined;loggerPredictive[_0xeda7('0x42')](_0x55586c[_0xeda7('0x47')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x162917,_0x59840b){return function(_0x35e4c6){loggerPredictive[_0xeda7('0x64')](_0x59840b[_0xeda7('0x47')],_0x162917);loggerPredictive[_0xeda7('0x64')](_0x35e4c6[_0xeda7('0x65')]);clearPredictiveAttributes(_0x59840b);};}function loggerCatch(_0x1a9d31){return function(_0x31263c){logger[_0xeda7('0x64')](_0x1a9d31,util[_0xeda7('0x44')](_0x31263c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x703c06){return function(_0x3c8de0){if(isNotNull(_0x3c8de0)&&isNotNull(_0x3c8de0[0x0])){if(_0x3c8de0[0x0][_0xeda7('0x66')]>0x0){_0x703c06[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS'][_0xeda7('0x68')];logger['info'](_0xeda7('0x69')+_0x703c06[_0xeda7('0x47')],_0x3c8de0[0x0]['contactsRescheduled'],_0xeda7('0x6a'));}else{_0x703c06['message']=utils[_0xeda7('0x6b')][_0xeda7('0x6c')];logger[_0xeda7('0x4a')](_0xeda7('0x6d')+_0x703c06['name']);}}};}function createObjHistory(_0x41b218,_0x4cbe83,_0x3cffe2,_0x394083,_0x375255){_0x41b218[_0xeda7('0x67')]=_0x3cffe2;var _0x57fee2=new Action(_0x41b218,_0x4cbe83);var _0x52ff54=new History(_0x57fee2);_0x52ff54['state']=_0x394083;_0x52ff54[_0xeda7('0x6e')]=_0x375255;_0x52ff54['endtime']=_0x57fee2[_0xeda7('0x6f')];return _0x52ff54;}function unlockQueueStatus(_0x521c48,_0x16a504){setTimeout(function(){if(_[_0xeda7('0x3e')](_0x521c48['queueStatusComplete'])){loggerBooked[_0xeda7('0x64')](_0xeda7('0x70'),_0x16a504);}_0x521c48[_0xeda7('0x71')]=!![];loggerBooked[_0xeda7('0x4a')](_0xeda7('0x72'),_0x16a504,JSON[_0xeda7('0x73')](_[_0xeda7('0x74')](_0x521c48,[_0xeda7('0x47'),_0xeda7('0x71')])));},0x1f3);}function checkInterval(_0x5014c2){return function(){if(!isNotNull(_0x5014c2[_0xeda7('0x75')])){_0x5014c2[_0xeda7('0x67')]=utils[_0xeda7('0x6b')][_0xeda7('0x76')];throw _0x5014c2[_0xeda7('0x47')]+_0xeda7('0x77');}if(!isNotNull(_0x5014c2['Interval'][_0xeda7('0x78')])){_0x5014c2[_0xeda7('0x67')]=utils[_0xeda7('0x6b')]['NULL_INTERVAL'];throw _0x5014c2['name']+_0xeda7('0x77');}if(!isNotNull(_[_0xeda7('0x49')](_0x5014c2['Interval'][_0xeda7('0x78')]))){_0x5014c2[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS'][_0xeda7('0x76')];throw _0x5014c2[_0xeda7('0x47')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x5e1946){return function(){if(!utils[_0xeda7('0x79')](_0x5e1946)){_0x5e1946[_0xeda7('0x67')]=utils[_0xeda7('0x6b')][_0xeda7('0x7a')];throw _0x5e1946[_0xeda7('0x47')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x5da5b5){if(utils[_0xeda7('0x7b')](_0x5da5b5)){emit(util[_0xeda7('0x45')]('campaign:ivr:%s',_0x5da5b5[_0xeda7('0x47')]),'campaign:save',_0x5da5b5);}}function loggerCatchQueueSummary(_0x7b738,_0x12696b){return function(_0x31c8ce){clearPredictiveAttributes(_0x12696b);emitCampaignSummary(_0x12696b);loggerSyncQueueSummary[_0xeda7('0x42')](_0x7b738,util[_0xeda7('0x44')](_0x31c8ce,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x40dfb0){if(_0x40dfb0[_0xeda7('0x7c')]){if(_0x40dfb0['originated']===0x0){_0x40dfb0[_0xeda7('0x7c')]=![];_0x40dfb0[_0xeda7('0x67')]=utils[_0xeda7('0x6b')][_0xeda7('0x7a')];loggerSyncQueueSummary[_0xeda7('0x42')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x40dfb0[_0xeda7('0x47')],_0xeda7('0x7d'));}else{_0x40dfb0[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS'][_0xeda7('0x7e')];loggerSyncQueueSummary['debug'](_0xeda7('0x7f'),_0x40dfb0[_0xeda7('0x47')],_0xeda7('0x80'));}emitCampaignSummary(_0x40dfb0);}}function myreject(_0x4126dd){return function(_0x1b56be){return _0x4126dd(msgResponse('[ifTime][Action]',_0xeda7('0x81'),JSON[_0xeda7('0x73')](_0x1b56be)));};}Dialer[_0xeda7('0x82')][_0xeda7('0x83')]=function(_0x410ee1){return!_['isUndefined'](_0x410ee1)&&_0x410ee1&&!_[_0xeda7('0x3e')](_0x410ee1[_0xeda7('0x47')])&&!_[_0xeda7('0x3e')](_0x410ee1['active'])&&_0x410ee1['active']&&(this['trunks'][util[_0xeda7('0x45')](_0xeda7('0x84'),_0x410ee1[_0xeda7('0x47')])][_0xeda7('0x85')]===_0xeda7('0x86')||this[_0xeda7('0x1e')][util[_0xeda7('0x45')](_0xeda7('0x84'),_0x410ee1[_0xeda7('0x47')])][_0xeda7('0x85')]===_0xeda7('0x87'));};Dialer['prototype'][_0xeda7('0x88')]=function(_0x3d1ba6){var _0x838007=this;return function(){if(!_0x838007['isTrunkReachable'](_0x3d1ba6[_0xeda7('0x89')])){if(!_0x838007[_0xeda7('0x83')](_0x3d1ba6[_0xeda7('0x8a')])){_0x3d1ba6[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x3d1ba6[_0xeda7('0x47')]+_0xeda7('0x8b');}}};};Dialer[_0xeda7('0x82')][_0xeda7('0x8c')]=function(_0x3e8354,_0x5810af,_0x104f96,_0x4acf89){var _0x1de531=this;return function(){var _0x4c1e6e=!![];return _0x1de531[_0xeda7('0x8d')](_0x3e8354,_0x5810af,_0x104f96,_0x4acf89,_0x4c1e6e);};};Dialer[_0xeda7('0x82')][_0xeda7('0x8e')]=function(_0x38e1b7,_0x4af019,_0x116d04,_0x163802){var _0x38da4d=this;return function(){var _0x13514f=![];return _0x38da4d[_0xeda7('0x8d')](_0x38e1b7[_0xeda7('0x78')],_0x4af019,_0x116d04,_0x163802,_0x13514f);};};Dialer[_0xeda7('0x82')][_0xeda7('0x8d')]=function(_0x511047,_0x59a971,_0x2c240a,_0x136be4,_0x29cef8){var _0x1a12d3=[];return new Promise(function(_0x22bece,_0x7137a7){if(!isNotNull(_0x511047)){_0x136be4[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS'][_0xeda7('0x76')];return _0x7137a7(msgResponse(_0xeda7('0x8f'),'Failure',_0x2c240a+_0xeda7('0x90')));}if(_['isEmpty'](_0x511047)){_0x136be4[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS'][_0xeda7('0x91')];return _0x7137a7(msgResponse(_0xeda7('0x8f'),_0xeda7('0x92'),_0x2c240a+_0xeda7('0x93')));}if(_0x59a971&&_[_0xeda7('0x3e')](config[_0xeda7('0x94')][_0x59a971])){_0x136be4[_0xeda7('0x67')]=utils[_0xeda7('0x6b')][_0xeda7('0x95')];return _0x7137a7(msgResponse('ifTime',_0xeda7('0x92'),_0x2c240a+'\x20Timezone\x20unknow\x20'+_0x59a971));}if(_[_0xeda7('0x96')](_0x511047)){for(var _0x3f6f37=0x0;_0x3f6f37<_0x511047[_0xeda7('0x97')];_0x3f6f37+=0x1){_0x1a12d3[_0xeda7('0x98')](ami[_0xeda7('0x99')]({'action':_0xeda7('0x9a'),'command':util[_0xeda7('0x45')](_0xeda7('0x9b'),_0x511047[_0x3f6f37][_0xeda7('0x9c')],!_[_0xeda7('0x3e')](config[_0xeda7('0x94')][_0x59a971])?_0x59a971:'')})[_0xeda7('0x9d')](function(_0x28c880){return _0x28c880[_0xeda7('0x9e')][_0xeda7('0x9f')]('true')>=0x0;})['catch'](myreject(_0x7137a7)));}}else{_0x1a12d3[_0xeda7('0x98')](ami[_0xeda7('0x99')]({'action':_0xeda7('0x9a'),'command':util[_0xeda7('0x45')](_0xeda7('0x9b'),_0x511047,!_[_0xeda7('0x3e')](config[_0xeda7('0x94')][_0x59a971])?_0x59a971:'')})[_0xeda7('0x9d')](function(_0xeec1e8){return _0xeec1e8[_0xeda7('0x9e')][_0xeda7('0x9f')](_0xeda7('0xa0'))>=0x0;})[_0xeda7('0xa1')](myreject(_0x7137a7)));}Promise[_0xeda7('0xa2')](_0x1a12d3)[_0xeda7('0x9d')](function(_0x498742){var _0x21feeb=_[_0xeda7('0xa3')](_0x498742);if(_0x21feeb){return _0x22bece(_0x21feeb);}else{_0x136be4[_0xeda7('0x67')]=_0x29cef8?utils[_0xeda7('0x6b')][_0xeda7('0xa4')]:utils[_0xeda7('0x6b')][_0xeda7('0xa5')];return _0x7137a7(msgResponse(_0xeda7('0xa6'),_0xeda7('0x92'),_0xeda7('0xa7')+_0x29cef8+'\x20'+_0x2c240a+_0xeda7('0xa8')+util[_0xeda7('0x44')](_0x511047,{'showHidden':![],'depth':null})+_0xeda7('0xa9')+_0x59a971));}})[_0xeda7('0xa1')](function(_0x424f41){return _0x7137a7(msgResponse('ifTime',_0xeda7('0x92'),JSON[_0xeda7('0x73')](_0x424f41)));});});};Dialer['prototype'][_0xeda7('0x3b')]=function(){var _0x29f96e=this;return cmHopper[_0xeda7('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0xeda7('0x9d')](function(){setInterval(function(){_0x29f96e[_0xeda7('0xab')]();},0x3e8);});};Dialer[_0xeda7('0x82')][_0xeda7('0xab')]=function(){var _0x50fa3a=this;var _0x3cb3fb;for(var _0x200720 in this[_0xeda7('0x1c')]){if(typeof this[_0xeda7('0x1c')][_0x200720]!=='undefined'){_0x3cb3fb=this[_0xeda7('0x1c')][_0x200720];if(utils[_0xeda7('0x7b')](_0x3cb3fb)&&utils[_0xeda7('0x79')](_0x3cb3fb)){_0x3cb3fb['sendMessageOneNotActive']=!![];Promise[_0xeda7('0xac')]()[_0xeda7('0x9d')](checkIsIVRCampaignActive(_0x3cb3fb))[_0xeda7('0x9d')](checkInterval(_0x3cb3fb))[_0xeda7('0x9d')](_0x50fa3a['checkIsTrunkReachable'](_0x3cb3fb))['then'](_0x50fa3a[_0xeda7('0x8c')](_0x3cb3fb[_0xeda7('0xad')],_0x3cb3fb['dialTimezone'],_0x3cb3fb[_0xeda7('0x47')],_0x3cb3fb))[_0xeda7('0x9d')](_0x50fa3a['checkIfTimeIntervals'](_0x3cb3fb[_0xeda7('0x75')],_0x3cb3fb[_0xeda7('0xae')],_0x3cb3fb[_0xeda7('0x47')],_0x3cb3fb))[_0xeda7('0x9d')](_0x50fa3a['launchHandleIvr'](_0x3cb3fb))[_0xeda7('0xa1')](loggerCatchQueueSummary(_0xeda7('0xaf'),_0x3cb3fb));}else{notSendMessagesCampaign(_0x3cb3fb);}}}};Dialer[_0xeda7('0x82')][_0xeda7('0xb0')]=function(_0x4d2b56){if(_0x4d2b56[_0xeda7('0xb1')]!==_0xeda7('0xb2')){clearPredictiveAttributes(_0x4d2b56);}switch(_0x4d2b56[_0xeda7('0xb1')]){case _0xeda7('0xb3'):this['handlePower'](_0x4d2b56,0x1);break;case _0xeda7('0xb4'):this[_0xeda7('0xb5')](_0x4d2b56,_0x4d2b56[_0xeda7('0xb6')]);break;case _0xeda7('0xb2'):this[_0xeda7('0xb2')](_0x4d2b56);break;case'booked':this[_0xeda7('0xb5')](_0x4d2b56,0x1);break;default:logger[_0xeda7('0x64')](_0xeda7('0xb7'),_0x4d2b56[_0xeda7('0x47')],_0xeda7('0xb8'));}};Dialer[_0xeda7('0x82')]['ifTime']=function(_0xc487f0,_0x462043){var _0x54af0d=_0xc487f0[_0xeda7('0xae')];var _0x9391e0=_0x462043?_0xc487f0[_0xeda7('0xad')]:_0xc487f0['Interval'][_0xeda7('0x78')];logger[_0xeda7('0xb9')](_0xeda7('0xba'),_0x9391e0,_0x54af0d,_0xc487f0[_0xeda7('0x47')],util[_0xeda7('0x45')]('Voice\x20Queue\x20%s\x20$s',_0xc487f0[_0xeda7('0x47')],_0xc487f0['id']));var _0x1f8199=null;return Interval['intervalIftime'](_0x9391e0,_0x54af0d)['then'](function(_0x43a471){if(_0x43a471===!![]){return _0x43a471;}else{_0xc487f0[_0xeda7('0x67')]=_0x462043?utils[_0xeda7('0x6b')][_0xeda7('0xa4')]:utils[_0xeda7('0x6b')][_0xeda7('0xa5')];_0x1f8199=msgResponse(_0xeda7('0xa6'),_0xeda7('0x92'),_0xeda7('0xa7')+_0x462043+'\x20'+_0xc487f0['name']+_0xeda7('0xa8')+util[_0xeda7('0x44')](_0x9391e0,{'showHidden':![],'depth':null})+_0xeda7('0xa9')+_0x54af0d);}if(_0x1f8199!==null){logger[_0xeda7('0xb9')](_0xeda7('0xbb'),_0x1f8199);_0x1f8199[_0xeda7('0xbc')]=_0x462043;throw _0x1f8199;}})[_0xeda7('0xa1')](function(_0x5bbaa8){logger[_0xeda7('0x64')](_0xeda7('0xbd'),_0x5bbaa8);throw msgResponse(_0xeda7('0xbe'),'Error',util[_0xeda7('0x44')](_0x5bbaa8,{'showHidden':![],'depth':null}));});};Dialer[_0xeda7('0x82')][_0xeda7('0x2a')]=function(_0x5afff9){if(this[_0xeda7('0xbf')][_0x5afff9[_0xeda7('0xc0')]]){if(this[_0xeda7('0x22')][_0x5afff9[_0xeda7('0xc1')]]&&this['uniqueId'][_0x5afff9[_0xeda7('0xc1')]][_0xeda7('0x40')]!==_0xeda7('0xc2')){utils[_0xeda7('0xc3')](this['voiceQueues'][_0x5afff9['queue']],_0xeda7('0xc4'));this[_0xeda7('0x22')][_0x5afff9[_0xeda7('0xc1')]][_0xeda7('0xc5')]=moment()[_0xeda7('0x45')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xeda7('0x82')][_0xeda7('0x30')]=function(_0x23ec02){var _0x3e8b4d=this[_0xeda7('0x22')][_0x23ec02[_0xeda7('0xc1')]];if(this['voiceQueues'][_0x23ec02['queue']]){if(_0x3e8b4d&&_0x3e8b4d[_0xeda7('0x40')]!=='ivr'){delete this[_0xeda7('0x22')][_0x23ec02[_0xeda7('0xc1')]];this[_0xeda7('0xbf')][_0x23ec02['queue']][_0xeda7('0xc6')]+=0x1;var _0x2c5c48=new AgentComplete(_0x3e8b4d,_0x23ec02);if(_0x23ec02[_0xeda7('0xc7')]===_0xeda7('0xc8')){_0x2c5c48[_0xeda7('0xc9')]=this[_0xeda7('0xbf')][_0x23ec02[_0xeda7('0xc0')]][_0xeda7('0xca')]&&this['voiceQueues'][_0x23ec02[_0xeda7('0xc0')]][_0xeda7('0xcb')]?moment()[_0xeda7('0x45')](_0xeda7('0xcc')):undefined;}hopperUtils[_0xeda7('0xcd')](_0x2c5c48)[_0xeda7('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xeda7('0xce')](_0x2c5c48)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xcf')));}}};Dialer[_0xeda7('0x82')]['syncQueueCallerAbandon']=function(_0x29b8f6){var _0x1fd035=this[_0xeda7('0x22')][_0x29b8f6[_0xeda7('0xc1')]];var _0x4ad5bd=this;var _0xf18b5c=![];var _0x2d5d2d;var _0x1987cb;if(this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]]){if(_0x1fd035&&_0x1fd035[_0xeda7('0x40')]!==_0xeda7('0xc2')){delete this[_0xeda7('0x22')][_0x29b8f6['uniqueid']];utils[_0xeda7('0xc3')](this['voiceQueues'][_0x29b8f6[_0xeda7('0xc0')]],_0xeda7('0xd0'));_0x1fd035[_0xeda7('0xd1')]=moment()[_0xeda7('0x45')](_0xeda7('0xcc'));var _0x1907b7=new QueueCallerAbandon(_0x1fd035,_0x29b8f6);if(utils[_0xeda7('0x5f')](_0x1fd035[_0xeda7('0xd1')],_0x1fd035['responsetime'])>=_0x1fd035['dialQueueTimeout']){this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0x4e')]+=0x1;this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xd2')]+=0x1;this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xd3')]+=0x1;_0x1907b7['state']=0xa;_0x1907b7['statedesc']='Drop';_0x1907b7[_0xeda7('0xd4')]=_0xeda7('0xd5');_0x1907b7[_0xeda7('0xc9')]=this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]]['dialQueueProject2']?moment()[_0xeda7('0x45')](_0xeda7('0xcc')):undefined;_0x1907b7['countdropretry']+=0x1;_0x1907b7[_0xeda7('0xd6')]+=0x1;_0x2d5d2d=this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]]['dialDropRetryFrequency'];_0x1987cb=this['voiceQueues'][_0x29b8f6['queue']][_0xeda7('0xd7')];hopperUtils[_0xeda7('0xd8')](_0x1907b7,_0x1907b7[_0xeda7('0xd9')],_0x1fd035['voiceQueue'])[_0xeda7('0x9d')](function(_0x46342){_0xf18b5c=_0x46342[_0xeda7('0xda')]==0x1;if(_0x1907b7['countdropretry']>=_0x4ad5bd[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xdb')]){_0x4ad5bd[_0xeda7('0xdc')](_0x1907b7,_0x46342[_0xeda7('0xda')]);}else{hopperUtils[_0xeda7('0xdd')]({'active':![],'countdropretry':_0x1907b7[_0xeda7('0xde')],'scheduledat':moment()[_0xeda7('0xdf')](_0x4ad5bd[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xe0')],'minutes')[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x1fd035[_0xeda7('0xe1')],'ListId':_0x1fd035[_0xeda7('0xe2')],'VoiceQueueId':_0x1fd035[_0xeda7('0xe3')]||undefined,'CampaignId':_0x1fd035['CampaignId']||undefined})['catch'](loggerCatch(_0xeda7('0xe4')));var _0x819062=new History(_0x1907b7);_0x819062[_0xeda7('0xd9')]=0xa;_0x819062[_0xeda7('0x6e')]=_0xeda7('0xe5');_0x819062['starttime']=moment()[_0xeda7('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x819062[_0xeda7('0xe6')]=_0x819062[_0xeda7('0x6f')];_0x819062[_0xeda7('0xe7')]=_0x1907b7[_0xeda7('0xe7')];_0x819062[_0xeda7('0xe8')]=_0x1907b7[_0xeda7('0xe8')];hopperUtils[_0xeda7('0xcd')](_0x819062)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xe9')));}})['then'](function(){if(_0xf18b5c)hopperUtils['swapAdditionalPhones'](_0x1907b7,_0x2d5d2d,_0x1987cb)[_0xeda7('0x9d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0x50')]+=0x1;this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xea')]+=0x1;_0x1907b7[_0xeda7('0xd9')]=0xb;_0x1907b7[_0xeda7('0x6e')]='Abandoned';_0x1907b7['dropreason']='CALLEREXIT';_0x1907b7[_0xeda7('0xeb')]+=0x1;_0x1907b7['countglobal']+=0x1;_0x2d5d2d=this[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xec')];_0x1987cb=this[_0xeda7('0xbf')][_0x29b8f6['queue']][_0xeda7('0xd7')];hopperUtils[_0xeda7('0xd8')](_0x1907b7,_0x1907b7[_0xeda7('0xd9')],_0x1fd035['voiceQueue'])[_0xeda7('0x9d')](function(_0x47ee14){if(_0x1907b7[_0xeda7('0xeb')]>=_0x4ad5bd[_0xeda7('0xbf')][_0x29b8f6[_0xeda7('0xc0')]][_0xeda7('0xed')]){_0x4ad5bd[_0xeda7('0xdc')](_0x1907b7,_0x47ee14[_0xeda7('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1907b7[_0xeda7('0xeb')],'scheduledat':moment()[_0xeda7('0xdf')](_0x4ad5bd[_0xeda7('0xbf')][_0x29b8f6['queue']][_0xeda7('0xec')],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x1fd035[_0xeda7('0xe1')],'ListId':_0x1fd035['ListId'],'VoiceQueueId':_0x1fd035[_0xeda7('0xe3')]||undefined,'CampaignId':_0x1fd035[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xf0')));var _0x5b21a1=new History(_0x1907b7);_0x5b21a1[_0xeda7('0xd9')]=0xb;_0x5b21a1['statedesc']=_0xeda7('0xf1');_0x5b21a1[_0xeda7('0x6f')]=moment()[_0xeda7('0x45')](_0xeda7('0xcc'));_0x5b21a1[_0xeda7('0xe6')]=_0x5b21a1[_0xeda7('0x6f')];_0x5b21a1[_0xeda7('0xe7')]=_0x1907b7[_0xeda7('0xe7')];_0x5b21a1[_0xeda7('0xe8')]=_0x1907b7[_0xeda7('0xe8')];hopperUtils[_0xeda7('0xcd')](_0x5b21a1)[_0xeda7('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xeda7('0x9d')](function(){if(_0xf18b5c)hopperUtils['swapAdditionalPhones'](_0x1907b7,_0x2d5d2d,_0x1987cb)[_0xeda7('0x9d')](function(){return 0x1;});});}}}};Dialer[_0xeda7('0x82')][_0xeda7('0x35')]=function(_0x346b3c){if(this[_0xeda7('0x21')][_0x346b3c[_0xeda7('0xc1')]]){this[_0xeda7('0x21')][_0x346b3c[_0xeda7('0xc1')]][_0xeda7('0xf2')]=_0x346b3c[_0xeda7('0xf2')];}if(this[_0xeda7('0x22')][_0x346b3c[_0xeda7('0xc1')]]){this['uniqueId'][_0x346b3c['uniqueid']][_0xeda7('0xf2')]=_0x346b3c[_0xeda7('0xf2')];}};Dialer[_0xeda7('0x82')]['syncQueueMember']=function(_0x287109){if(!this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]]){return;}var _0x240bab=this['voiceQueues'][this['actions'][_0x287109[_0xeda7('0xf3')]][_0xeda7('0xc0')]][_0xeda7('0xf4')]||_0xeda7('0xf5');if(_0x240bab===_0xeda7('0xf6')){if(this[_0xeda7('0x21')][_0x287109['actionid']]&&_['isNil'](this['actions'][_0x287109['actionid']]['locked'])&&_0x287109[_0xeda7('0x85')]==='1'&&_0x287109['paused']==='0'){if(this[_0xeda7('0x1d')][_0x287109[_0xeda7('0xf7')]]){if(!this[_0xeda7('0x1d')][_0x287109[_0xeda7('0xf7')]][_0xeda7('0xf8')]){this[_0xeda7('0x1d')][_0x287109[_0xeda7('0xf7')]]['locked']=!![];this[_0xeda7('0x21')][_0x287109['actionid']]['locked']=!![];this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]]['stateinterface']=_0x287109['stateinterface'];}}}}else if(_0x240bab===_0xeda7('0xf5')){if(this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]]){if(this[_0xeda7('0x1d')][_0x287109[_0xeda7('0xf7')]]){this['actions'][_0x287109[_0xeda7('0xf3')]][_0xeda7('0xf7')]=_0x287109[_0xeda7('0xf7')];if(_[_0xeda7('0xf9')](this['queueBooked'][this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]][_0xeda7('0xc0')]])){this[_0xeda7('0x26')][this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]][_0xeda7('0xc0')]]=[];}this[_0xeda7('0x26')][this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]][_0xeda7('0xc0')]][_0xeda7('0x98')](_[_0xeda7('0x5e')](_['pick'](this[_0xeda7('0x21')][_0x287109[_0xeda7('0xf3')]],['idHopper',_0xeda7('0xf7')]),{'status':_0x287109[_0xeda7('0x85')],'paused':_0x287109[_0xeda7('0xfa')]}));}}}};Dialer[_0xeda7('0x82')][_0xeda7('0x3a')]=function(_0x27ca11){if(!this[_0xeda7('0x21')][_0x27ca11['actionid']]){return;}var _0xbd61a0=this;var _0x24a3c3=this[_0xeda7('0xbf')][this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]];var _0x253ddd=_0x24a3c3[_0xeda7('0xf4')]||_0xeda7('0xf5');if(_0x253ddd===_0xeda7('0xf6')){if(this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]]&&this['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xf7')]){this[_0xeda7('0xfb')][_0xeda7('0xfc')](this[_0xeda7('0x21')][_0x27ca11['actionid']][_0xeda7('0xfd')],this['actions'][_0x27ca11[_0xeda7('0xf3')]]['stateinterface'])[_0xeda7('0xa1')](function(_0x360731){logger[_0xeda7('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xeda7('0x44')](_0x360731,{'showHidden':![],'depth':null}));})[_0xeda7('0x1a')](function(){utils[_0xeda7('0xc3')](_0xbd61a0['voiceQueues'][_0xbd61a0['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]],'[syncQueueStatusComplete]');_0xbd61a0[_0xeda7('0x1d')][_0xbd61a0[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]]['stateinterface']][_0xeda7('0xf8')]=![];delete _0xbd61a0[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]];unlockQueueStatus(_0x24a3c3);});}else{utils[_0xeda7('0xc3')](this[_0xeda7('0xbf')][this[_0xeda7('0x21')][_0x27ca11['actionid']][_0xeda7('0xc0')]],_0xeda7('0xfe'));hopperUtils[_0xeda7('0xdd')]({'active':![],'ContactId':this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xe1')],'ListId':this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xe2')],'VoiceQueueId':this[_0xeda7('0x21')][_0x27ca11['actionid']][_0xeda7('0xe3')]||undefined,'CampaignId':this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xff')));delete this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]];unlockQueueStatus(_0x24a3c3);}}else if(_0x253ddd===_0xeda7('0xf5')){var _0x1311c1;if(this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]]&&!_[_0xeda7('0x49')](this['queueBooked'][this['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]])){if(this[_0xeda7('0x27')][_0xbd61a0[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]]){this[_0xeda7('0x27')][_0xbd61a0['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]]=this[_0xeda7('0x27')][this[_0xeda7('0x21')][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]]?this['queueBookedRR'][this['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]]:this[_0xeda7('0x26')][this[_0xeda7('0x21')][_0x27ca11['actionid']][_0xeda7('0xc0')]]?this['queueBooked'][this['actions'][_0x27ca11['actionid']][_0xeda7('0xc0')]][_0xeda7('0x100')]||0x0:0x0;}this[_0xeda7('0x26')][this[_0xeda7('0x21')][_0x27ca11['actionid']][_0xeda7('0xc0')]][_0xeda7('0x100')]=this[_0xeda7('0x27')][this['actions'][_0x27ca11[_0xeda7('0xf3')]][_0xeda7('0xc0')]];for(var _0x5caf07=0x0;_0x5caf07=_0x3f3bca[_0xeda7('0x127')]){_0x32db50[_0xeda7('0x128')](_0x1b86a4,_0x4dc392,_0xcfda4e,_0xeda7('0x129'));}else{if(_0x1b86a4[_0xeda7('0x120')]>=_0x3f3bca['dialMachineMaxRetry']){_0x32db50[_0xeda7('0x12a')](_0x1b86a4,_0x4dc392,_0xcfda4e,_0xeda7('0x12b'));}else{hopperUtils[_0xeda7('0xdd')]({'active':![],'countmachineretry':_0x1b86a4[_0xeda7('0x120')],'scheduledat':moment()[_0xeda7('0xdf')](_0x3f3bca[_0xeda7('0x12c')],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x1b86a4[_0xeda7('0xe1')],'ListId':_0x1b86a4[_0xeda7('0xe2')],'VoiceQueueId':_0x1b86a4[_0xeda7('0xe3')]||undefined,'CampaignId':_0x1b86a4[_0xeda7('0xef')]||undefined})['catch'](loggerCatch(_0xeda7('0x12d')));_0x4dc392({'reschedule':0x1});}}});}if(_0x51fc69[_0xeda7('0x40')]===_0xeda7('0xc2')&&this[_0xeda7('0x1c')][_0x51fc69[_0xeda7('0xc0')]]['dialAMDActive']&&_0x54f70b[_0xeda7('0x117')]===_0xeda7('0x12e')){delete this['uniqueId'][_0x54f70b[_0xeda7('0xc1')]];utils[_0xeda7('0xc3')](this[_0xeda7('0x1c')][_0x51fc69[_0xeda7('0xc0')]],_0xeda7('0x118'));_0x1718e7=new Hangup(_0x51fc69,_0x54f70b);_0x1718e7[_0xeda7('0xd9')]=0x12;_0x1718e7['statedesc']='HangupInAMD';_0x1718e7[_0xeda7('0x11b')]=_0xeda7('0x11c');ami[_0xeda7('0x3f')](_0xeda7('0x121'),ut[_0xeda7('0x11d')](_0x1718e7,_0xeda7('0x11e')));this[_0xeda7('0x11f')](_0x1718e7,_0xeda7('0x12f'),_0xeda7('0x130'));}if(_0x51fc69['type']===_0xeda7('0xc2')&&this[_0xeda7('0x1c')][_0x51fc69[_0xeda7('0xc0')]][_0xeda7('0x116')]&&_0x54f70b['value']==='MACHINE'){return new Promise(function(_0x1a07f8,_0x43ad55){delete _0x32db50['uniqueId'][_0x54f70b['uniqueid']];utils[_0xeda7('0xc3')](_0x32db50[_0xeda7('0x1c')][_0x51fc69[_0xeda7('0xc0')]],'[syncVarSet]');_0x32db50['campaigns'][_0x51fc69[_0xeda7('0xc0')]][_0xeda7('0xc6')]+=0x1;_0x32db50['campaigns'][_0x51fc69[_0xeda7('0xc0')]][_0xeda7('0x119')]+=0x1;var _0x4607df=_0x32db50[_0xeda7('0x1c')][_0x51fc69[_0xeda7('0xc0')]];var _0x5890be=new Hangup(_0x51fc69,_0x54f70b);_0x5890be[_0xeda7('0xd9')]=0x13;_0x5890be[_0xeda7('0x6e')]=_0xeda7('0x131');_0x5890be[_0xeda7('0x11b')]='AMD';_0x5890be[_0xeda7('0x120')]+=0x1;_0x5890be['countglobal']+=0x1;_0x5890be[_0xeda7('0x11e')]=!![];ami[_0xeda7('0x3f')](_0xeda7('0x121'),ut[_0xeda7('0x11d')](_0x5890be,_0xeda7('0x11e')));hopperUtils['createHistory'](_0x5890be)['catch'](loggerCatch(_0xeda7('0x122')));if(_0x5890be[_0xeda7('0x132')]+_0x5890be['countcongestionretry']+_0x5890be['countnoanswerretry']+_0x5890be[_0xeda7('0x125')]+_0x5890be[_0xeda7('0xde')]+_0x5890be[_0xeda7('0xeb')]+_0x5890be[_0xeda7('0x120')]+_0x5890be[_0xeda7('0x126')]>=_0x4607df[_0xeda7('0x127')]){_0x32db50[_0xeda7('0x128')](_0x5890be,_0x1a07f8,_0x43ad55,_0xeda7('0x129'));}else{if(_0x5890be[_0xeda7('0x120')]>=_0x4607df[_0xeda7('0x133')]){_0x32db50[_0xeda7('0x12a')](_0x5890be,_0x1a07f8,_0x43ad55,'reason\x2019\x20machine....');}else{hopperUtils[_0xeda7('0xdd')]({'active':![],'countmachineretry':_0x5890be[_0xeda7('0x120')],'scheduledat':moment()['add'](_0x4607df[_0xeda7('0x12c')],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x5890be[_0xeda7('0xe1')],'ListId':_0x5890be[_0xeda7('0xe2')],'VoiceQueueId':_0x5890be[_0xeda7('0xe3')]||undefined,'CampaignId':_0x5890be[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x12d')));_0x1a07f8({'reschedule':0x1});}}});}}};Dialer[_0xeda7('0x82')][_0xeda7('0x134')]=function(_0x58de56){var _0x24c340=this[_0xeda7('0x22')][_0x58de56[_0xeda7('0xc1')]];var _0x5acf9f;if(!_0x24c340){return;}if(_0x24c340['type']===_0xeda7('0xc2')){delete this['uniqueId'][_0x58de56[_0xeda7('0xc1')]];utils[_0xeda7('0xc3')](this['campaigns'][_0x24c340[_0xeda7('0xc0')]],_0xeda7('0x135'));this[_0xeda7('0x1c')][_0x24c340[_0xeda7('0xc0')]][_0xeda7('0x136')]+=0x1;if(_0x58de56['cause-txt']===_0xeda7('0x137')){const _0x27694a=new AgentComplete(_0x24c340,_0x58de56);_0x27694a[_0xeda7('0xef')]=this[_0xeda7('0x1c')][_0x24c340[_0xeda7('0xc0')]]['id'];hopperUtils[_0xeda7('0xcd')](_0x27694a)['catch'](loggerCatch(_0xeda7('0x138')));hopperUtils[_0xeda7('0xce')](_0x27694a)['catch'](loggerCatch(_0xeda7('0x139')));}else{_0x5acf9f=new Hangup(_0x24c340,_0x58de56);hopperUtils[_0xeda7('0xcd')](_0x5acf9f)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x13a')));hopperUtils['moveContactManagedDialer'](_0x5acf9f)[_0xeda7('0xa1')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this[_0xeda7('0xbf')][_0x24c340['queue']][_0xeda7('0x13b')])){delete this['uniqueId'][_0x58de56[_0xeda7('0xc1')]];utils[_0xeda7('0xc3')](this[_0xeda7('0xbf')][_0x24c340['queue']],_0xeda7('0x135'));this['voiceQueues'][_0x24c340[_0xeda7('0xc0')]][_0xeda7('0xc6')]+=0x1;this[_0xeda7('0xbf')][_0x24c340['queue']][_0xeda7('0x119')]+=0x1;_0x5acf9f=new Hangup(_0x24c340,_0x58de56);_0x5acf9f['state']=0x10;_0x5acf9f[_0xeda7('0x6e')]=_0xeda7('0x13c');_0x5acf9f['membername']=_0xeda7('0x13d');hopperUtils[_0xeda7('0xcd')](_0x5acf9f)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x13a')));hopperUtils[_0xeda7('0xce')](_0x5acf9f)['catch'](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x58de56[_0xeda7('0xc1')]];utils[_0xeda7('0xc3')](this['voiceQueues'][_0x24c340[_0xeda7('0xc0')]],_0xeda7('0x13e'));if(_0x58de56[_0xeda7('0x13f')]===_0xeda7('0x137')){this[_0xeda7('0xbf')][_0x24c340[_0xeda7('0xc0')]]['outboundAnswerCallsDay']+=0x1;const _0x2d2660=new AgentComplete(_0x24c340,_0x58de56);_0x2d2660[_0xeda7('0xe3')]=this[_0xeda7('0xbf')][_0x24c340['queue']]['id'];hopperUtils[_0xeda7('0xcd')](_0x2d2660)[_0xeda7('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xeda7('0xce')](_0x2d2660)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xcf')));}else{this['voiceQueues'][_0x24c340[_0xeda7('0xc0')]][_0xeda7('0x140')]+=0x1;_0x5acf9f=new Hangup(_0x24c340,_0x58de56);_0x5acf9f['state']=0xc;_0x5acf9f['statedesc']=_0x58de56['cause-txt'];_0x5acf9f['membername']='Unknown';hopperUtils['createHistory'](_0x5acf9f)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x141')));hopperUtils['moveContactManagedDialer'](_0x5acf9f)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x135')));}}}};Dialer[_0xeda7('0x82')][_0xeda7('0x9')]=function(_0x386357){var _0x4737e0=this;if(!_0x4737e0[_0xeda7('0x28')][_0x386357[_0xeda7('0x47')]]){_0x4737e0['queuesSummary'][_0x386357[_0xeda7('0x47')]]={'running':![]};}else if(_0x4737e0['queuesSummary'][_0x386357[_0xeda7('0x47')]][_0xeda7('0x142')]===!![]){return;}else if(_0x4737e0[_0xeda7('0x28')][_0x386357[_0xeda7('0x47')]][_0xeda7('0x142')]===![]){_0x4737e0['queuesSummary'][_0x386357[_0xeda7('0x47')]][_0xeda7('0x142')]=!![];}var _0x5e3fb6=_0x4737e0['voiceQueues'][_0x386357[_0xeda7('0x47')]];var _0x75ce3f=_0x5e3fb6[_0xeda7('0x67')]!==utils[_0xeda7('0x6b')][_0xeda7('0x7a')];var _0x180b1d=utils['isPreviewCampaign'](_0x5e3fb6);_0x5e3fb6[_0xeda7('0x143')]=utils[_0xeda7('0x144')](_0x5e3fb6,_0x4737e0[_0xeda7('0x1e')]);Promise[_0xeda7('0xac')]()['then'](function(){if(_0x5e3fb6[_0xeda7('0x143')]===utils['CAMPAIGN_STATUS'][_0xeda7('0x7a')]){if(_0x75ce3f){clearPredictiveAttributes(_0x5e3fb6);_0x386357[_0xeda7('0x24')]=undefined;_0x386357[_0xeda7('0x60')]=undefined;}if(_0x5e3fb6[_0xeda7('0x143')]===utils[_0xeda7('0x6b')][_0xeda7('0x7a')]){_0x386357['available']=0x0;_0x386357['paused']=0x0;_0x386357[_0xeda7('0x145')]=0x0;_0x386357[_0xeda7('0x146')]=0x0;_0x386357[_0xeda7('0x147')]=0x0;}}else if(_0x5e3fb6[_0xeda7('0x143')]===utils[_0xeda7('0x6b')][_0xeda7('0x148')]&&!_0x180b1d){return _0x4737e0['ifTime'](_0x5e3fb6,!![])[_0xeda7('0x9d')](function(){return _0x4737e0['ifTime'](_0x5e3fb6,![]);})['then'](function(){return _0x4737e0[_0xeda7('0xb0')](_0x5e3fb6);})['catch'](function(_0x1e3e75){loggerSyncQueueSummary[_0xeda7('0x42')](_0xeda7('0x149'),util[_0xeda7('0x44')](_0x1e3e75,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5e3fb6);});}else{clearPredictiveAttributes(_0x5e3fb6);}})[_0xeda7('0x9d')](function(){var _0x3ddd2c=_0x386357['compareToOutboundQueue'](_0x5e3fb6);if(_0x3ddd2c||_0x5e3fb6['queueSummaryCountersUpdated']){_0x5e3fb6[_0xeda7('0x14a')]=![];_0x386357[_0xeda7('0x14b')](_0x5e3fb6);Object[_0xeda7('0x14c')](_0x5e3fb6,_0x386357);emitOutboundVoiceQueueSummary(_0x386357);}_0x4737e0[_0xeda7('0x28')][_0x5e3fb6[_0xeda7('0x47')]][_0xeda7('0x142')]=![];})[_0xeda7('0xa1')](function(_0x3e672a){logger[_0xeda7('0x64')]('[syncQueueSummary]',util[_0xeda7('0x44')](_0x3e672a,{'showHidden':![],'depth':null}));_0x4737e0[_0xeda7('0x28')][_0x5e3fb6['name']][_0xeda7('0x142')]=![];});};Dialer[_0xeda7('0x82')][_0xeda7('0x33')]=_['throttle'](function(){var _0x540dd3=_['filter'](this[_0xeda7('0xbf')],function(_0x340838){return _0x340838[_0xeda7('0x14d')];});var _0x5c8c4f=_[_0xeda7('0x14e')](this[_0xeda7('0x1d')],function(_0x715ce1){return _0x715ce1[_0xeda7('0x14f')]&&_0x715ce1[_0xeda7('0x85')]===_0xeda7('0x86');});if(_0x540dd3[_0xeda7('0x97')]>0x0&&_0x5c8c4f[_0xeda7('0x97')]>0x0){return Promise[_0xeda7('0xac')]()[_0xeda7('0x9d')](cmHopper['handlePreviewRecallNotifications'](_[_0xeda7('0x150')](_0x540dd3,'id'),previewRecallmeReminderInterval,_['map'](_0x5c8c4f,'id')))['then'](function(_0x2c5a74){for(var _0x3835f2=0x0;_0x3835f2<_0x2c5a74[_0xeda7('0x97')];_0x3835f2++){var _0x5753d3=_0x2c5a74[_0x3835f2]['Agent']['name'];if(_0x5753d3)io['to'](util[_0xeda7('0x45')](_0xeda7('0x151'),_0x5753d3))[_0xeda7('0x3f')](_0xeda7('0x152'),{'hopper':_0x2c5a74[_0x3835f2]});}})['catch'](function(_0x124d82){logger[_0xeda7('0x64')](_0xeda7('0x153'),_0x124d82);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xeda7('0x82')][_0xeda7('0x154')]=function(){var _0xe25e64=this;setInterval(function(){_0xe25e64['clearZombieChannels'](_0xe25e64[_0xeda7('0x22')],_0xeda7('0x155'));_0xe25e64[_0xeda7('0x156')](_0xe25e64['actions'],'[actions]');},0x32c8);};Dialer[_0xeda7('0x82')]['clearZombieChannels']=function(_0xa42c77,_0x3f1202){var _0x115a35=this;for(var _0x708ebc in _0xa42c77){if(typeof _0xa42c77[_0x708ebc]!=='undefined'){this[_0xeda7('0x1b')][_0xeda7('0x18')](function(){if(!_[_0xeda7('0xf9')](_0xa42c77[_0x708ebc])){return ami[_0xeda7('0x99')]({'action':_0xeda7('0x85'),'channel':_0xa42c77[_0x708ebc][_0xeda7('0xf2')]})[_0xeda7('0xa1')](function(_0x48728a){if(_0x48728a[_0xeda7('0x67')]===_0xeda7('0x157')){setTimeout(function(){if(_0xa42c77[_0x708ebc]&&_0xa42c77[_0x708ebc]['type']!==_0xeda7('0xc2')){utils['decrementOriginate'](_0x115a35[_0xeda7('0xbf')][_0xa42c77[_0x708ebc][_0xeda7('0xc0')]],_0xeda7('0x158'));logger[_0xeda7('0x64')](_0xeda7('0x159'),_0x3f1202,_0x708ebc,_0xa42c77[_0x708ebc][_0xeda7('0xc0')]);delete _0xa42c77[_0x708ebc];}if(_0xa42c77[_0x708ebc]&&_0xa42c77[_0x708ebc][_0xeda7('0x40')]===_0xeda7('0xc2')){utils[_0xeda7('0xc3')](_0x115a35[_0xeda7('0x1c')][_0xa42c77[_0x708ebc][_0xeda7('0xc0')]],_0xeda7('0x158'));logger[_0xeda7('0x64')](_0xeda7('0x15a'),_0x3f1202,_0x708ebc,_0xa42c77[_0x708ebc]['queue']);delete _0xa42c77[_0x708ebc];}},0x2328);}});}});}}};Dialer[_0xeda7('0x82')][_0xeda7('0x15b')]=function(_0x5ad9e3){return Promise[_0xeda7('0xac')]()[_0xeda7('0x9d')](voiceQueueRt[_0xeda7('0x15b')](_0x5ad9e3))['catch'](loggerCatch(_0xeda7('0x15c')));};Dialer[_0xeda7('0x82')][_0xeda7('0x15d')]=function(_0x23f4df,_0x1d83e6,_0xf66fa0){var _0x45659b={'state':0x19,'statedesc':_0xeda7('0x15e')};utils['decrementOriginate'](_0x1d83e6,'[emptyContact]'+_0x23f4df);this[_0xeda7('0x11f')](_[_0xeda7('0x5e')](_0x45659b,_['pick'](_0xf66fa0,[_0xeda7('0xe1'),_0xeda7('0xe2'),'UserId',_0xeda7('0xe3'),_0xeda7('0xef')])),_0xeda7('0x15f'),'[emptyContact]');logger[_0xeda7('0x64')](_0x23f4df);};Dialer[_0xeda7('0x82')][_0xeda7('0x11f')]=function(_0xaa0272,_0x5a8297,_0xf9f381){hopperUtils[_0xeda7('0xcd')](_0xaa0272)[_0xeda7('0xa1')](loggerCatch(_0x5a8297));hopperUtils[_0xeda7('0xce')](_0xaa0272)['catch'](loggerCatch(_0xf9f381));};Dialer[_0xeda7('0x82')][_0xeda7('0xdc')]=function(_0x1e0d97,_0x138593){hopperUtils[_0xeda7('0xcd')](_0x1e0d97)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x160')));if(_0x138593==0x0){hopperUtils[_0xeda7('0xce')](_0x1e0d97)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x161')));}};Dialer[_0xeda7('0x82')][_0xeda7('0x153')]=function(_0x34965b){return Promise[_0xeda7('0xac')]()['then'](cmHopper[_0xeda7('0x162')](_0x34965b['id'],previewRecallmeReminderInterval))[_0xeda7('0x9d')](function(_0x580b63){for(var _0x3d3cfc=0x0;_0x3d3cfc<_0x580b63[_0xeda7('0x97')];_0x3d3cfc++){var _0x44e910=_0x580b63[_0x3d3cfc][_0xeda7('0x163')][_0xeda7('0x47')];if(_0x44e910)io['to'](util[_0xeda7('0x45')](_0xeda7('0x151'),_0x44e910))['emit'](_0xeda7('0x152'),{'hopper':_0x580b63[_0x3d3cfc]});}})[_0xeda7('0xa1')](function(){});};Dialer[_0xeda7('0x82')][_0xeda7('0x164')]=function(_0x4cf316){var _0x36a97b=this;return function(){_0x36a97b[_0xeda7('0x165')](_0x4cf316);};};Dialer[_0xeda7('0x82')][_0xeda7('0x166')]=function(_0x2fab02,_0xcdf655){var _0x1ec4f3=this;var _0x2c5c31=uuid['v4']();this['actions'][_0x2c5c31]=new Action(_0x2fab02,_0xcdf655,_0x2c5c31);return new Promise(function(_0x2b780e,_0xaa1eef){if(_[_0xeda7('0x3e')](_0x2fab02)&&typeof _0x2fab02!=='object'){return _0xaa1eef(msgResponse('originate',_0xeda7('0x92'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0xcdf655[_0xeda7('0x167')])||_0xcdf655['phone']===null){return _0xaa1eef(msgResponse(_0xeda7('0x168'),_0xeda7('0x92'),_0xeda7('0x169')));}var _0x41e180={'XMD-CALLERID':_0x1ec4f3[_0xeda7('0x21')][_0x2c5c31][_0xeda7('0x16a')](),'XMD-AGI':_0x2fab02[_0xeda7('0x13b')]?util[_0xeda7('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2fab02[_0xeda7('0x13b')]):'NONE','XMD-AGIAFTER':_0x2fab02['dialQueueProject2']?util[_0xeda7('0x45')](_0xeda7('0x16b'),ipAgi,_0x2fab02['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0xeda7('0x16c')](_0x2fab02)?util[_0xeda7('0x45')](_0xeda7('0x16d'),_0x2fab02['name'],_0x2fab02[_0xeda7('0x16e')]||'',_0x2fab02[_0xeda7('0xcb')]?'c':'',_0x2fab02[_0xeda7('0x16f')]||0x3):_0xeda7('0x170'),'XMD-CONTACTID':_0xcdf655['ContactId'],'XMD-CDRTYPE':_0xeda7('0x7'),'CALLERID(all)':_0x1ec4f3[_0xeda7('0x21')][_0x2c5c31]['getCaller'](),'XMD-AMD':_0x2fab02[_0xeda7('0x116')]?_0xeda7('0x148'):_0xeda7('0x170'),'XMD-DESTINATION':_0xeda7('0x115')};if(_0x2fab02[_0xeda7('0x116')]){_0x41e180[_0xeda7('0x171')]=_0x2fab02[_0xeda7('0x172')]||0x9c4;_0x41e180['XMD-AMDGREETING']=_0x2fab02['dialAMDGreeting']||0x5dc;_0x41e180[_0xeda7('0x173')]=_0x2fab02[_0xeda7('0x174')]||0x320;_0x41e180[_0xeda7('0x175')]=_0x2fab02[_0xeda7('0x176')]||0x1388;_0x41e180[_0xeda7('0x177')]=_0x2fab02[_0xeda7('0x178')]||0x64;_0x41e180[_0xeda7('0x179')]=_0x2fab02['dialAMDBetweenWordsSilence']||0x32;_0x41e180['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2fab02['dialAMDMaximumNumberOfWords']||0x3;_0x41e180[_0xeda7('0x17a')]=_0x2fab02[_0xeda7('0x17b')]||0x100;_0x41e180[_0xeda7('0x17c')]=_0x2fab02['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xeda7('0x16c')](_0x2fab02)){_0x41e180['XMD-VOICEQUEUEID']=_0xcdf655[_0xeda7('0xe3')];}else{_0x41e180[_0xeda7('0x17d')]=_0xcdf655[_0xeda7('0xef')];}var _0x393d64=utils['setXMDContactVariables'](_0xcdf655['Contact']);Object[_0xeda7('0x14c')](_0x41e180,_0x393d64);var _0x5af8f1=_0x1ec4f3['isTrunkReachable'](_0x2fab02[_0xeda7('0x89')])?utils[_0xeda7('0x17e')](_0x2fab02[_0xeda7('0x89')][_0xeda7('0x17f')],_0x2fab02['dialOriginateCallerIdName'],_0x2fab02[_0xeda7('0x180')]>0x0?utils['getCallerIdRandom'](_0x2fab02[_0xeda7('0x181')],_0x2fab02[_0xeda7('0x180')]):_0x2fab02[_0xeda7('0x181')]):utils[_0xeda7('0x17e')](_[_0xeda7('0xf9')](_0x2fab02[_0xeda7('0x8a')])?_0x2fab02[_0xeda7('0x89')][_0xeda7('0x17f')]:_0x2fab02[_0xeda7('0x8a')][_0xeda7('0x17f')],_0x2fab02[_0xeda7('0x182')],_0x2fab02['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2fab02[_0xeda7('0x181')],_0x2fab02[_0xeda7('0x180')]):_0x2fab02[_0xeda7('0x181')]);if(_0x5af8f1){_0x41e180[_0xeda7('0x183')]=_0x1ec4f3['actions'][_0x2c5c31]['originatecalleridname']=utils[_0xeda7('0x184')](_0x5af8f1);_0x41e180[_0xeda7('0x185')]=_0xcdf655[_0xeda7('0x167')];}_0x2fab02[_0xeda7('0x186')]=_0x41e180;return ami[_0xeda7('0x99')]({'actionid':_0x2c5c31,'action':'originate','channel':_0x1ec4f3[_0xeda7('0x83')](_0x2fab02['Trunk'])?util[_0xeda7('0x45')](_0xeda7('0x187'),_0x2fab02[_0xeda7('0x89')]['name'],isNotNull(_0x2fab02[_0xeda7('0x188')])?_0x2fab02['dialPrefix'][_0xeda7('0x189')]()||'':'',_0x2fab02[_0xeda7('0x18a')]>0x0?_0xcdf655[_0xeda7('0x167')][_0xeda7('0x18b')](_0x2fab02[_0xeda7('0x18a')]):_0xcdf655[_0xeda7('0x167')]):util['format']('SIP/%s/%s%s',_[_0xeda7('0xf9')](_0x2fab02['TrunkBackup'])?_0x2fab02['Trunk']['name']:_0x2fab02['TrunkBackup'][_0xeda7('0x47')],isNotNull(_0x2fab02[_0xeda7('0x188')])?_0x2fab02[_0xeda7('0x188')][_0xeda7('0x189')]()||'':'',_0x2fab02[_0xeda7('0x18a')]>0x0?_0xcdf655[_0xeda7('0x167')][_0xeda7('0x18b')](_0x2fab02[_0xeda7('0x18a')]):_0xcdf655['phone']),'callerid':_0x5af8f1,'Exten':_0xeda7('0x115'),'Context':_0xeda7('0x18c'),'Priority':'1','variable':_0x41e180,'timeout':(_0x2fab02['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2c5c31})['then'](function(_0x160e6e){return _0x2b780e(_0x160e6e);})['catch'](function(_0x142c46){_0x2fab02[_0xeda7('0x18d')]+=0x1;var _0x44e0b3=new History(_0x1ec4f3[_0xeda7('0x21')][_0x2c5c31]);logger[_0xeda7('0x64')](util[_0xeda7('0x45')](_0xeda7('0x18e'),JSON[_0xeda7('0x73')](_0x142c46)));_0x44e0b3[_0xeda7('0xd9')]=0xe;_0x44e0b3['statedesc']=_0xeda7('0x18f');_0x44e0b3[_0xeda7('0x6f')]=moment()[_0xeda7('0x45')](_0xeda7('0xcc'));_0x44e0b3[_0xeda7('0xe6')]=_0x44e0b3[_0xeda7('0x6f')];hopperUtils[_0xeda7('0xcd')](_0x44e0b3)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x190')));_0x1ec4f3[_0xeda7('0xce')](_0x44e0b3)[_0xeda7('0xa1')](loggerCatch('[originate][error]'))[_0xeda7('0x1a')](function(){delete _0x1ec4f3['actions'][_0x2c5c31];return _0xaa1eef(msgResponse('originate',_0xeda7('0x81'),_0xeda7('0x191')));});});});};Dialer[_0xeda7('0x82')][_0xeda7('0x192')]=function(_0x328440,_0x23575e,_0x3b56cc){var _0x587929=new History(_0x23575e);if(_0x587929[_0xeda7('0x132')]+_0x587929[_0xeda7('0x123')]+_0x587929['countnoanswerretry']+_0x587929[_0xeda7('0x125')]+_0x587929[_0xeda7('0xde')]+_0x587929['countabandonedretry']+_0x587929[_0xeda7('0x120')]+_0x587929[_0xeda7('0x126')]>=_0x3b56cc[_0xeda7('0x127')]-0x1){return!![];}switch(_0x328440){case 0x3:if(_0x587929['countnoanswerretry']>=_0x3b56cc[_0xeda7('0x193')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countnoanswerretry':_0x587929[_0xeda7('0x124')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc[_0xeda7('0x194')],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x587929['ContactId'],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929['VoiceQueueId']||undefined,'CampaignId':_0x587929[_0xeda7('0xef')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x587929['countbusyretry']>=_0x3b56cc[_0xeda7('0x195')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countbusyretry':_0x587929[_0xeda7('0x132')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialBusyRetryFrequency'],_0xeda7('0xee'))[_0xeda7('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x587929[_0xeda7('0xe1')],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x196')));break;case 0x8:if(_0x587929[_0xeda7('0x123')]>=_0x3b56cc[_0xeda7('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x587929[_0xeda7('0x123')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialCongestionRetryFrequency'],_0xeda7('0xee'))['format'](_0xeda7('0xcc')),'ContactId':_0x587929[_0xeda7('0xe1')],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929['CampaignId']||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x198')));break;case 0x0:if(_0x587929['countnosuchnumberretry']>=_0x3b56cc['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xeda7('0xdd')]({'active':![],'countnosuchnumberretry':_0x587929[_0xeda7('0x125')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialNoSuchNumberRetryFrequency'],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x587929[_0xeda7('0xe1')],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929['VoiceQueueId']||undefined,'CampaignId':_0x587929[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x587929['countdropretry']>=_0x3b56cc[_0xeda7('0xdb')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countdropretry':_0x587929[_0xeda7('0xde')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialDropRetryFrequency'],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x587929[_0xeda7('0xe1')],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929['CampaignId']||undefined})['catch'](loggerCatch(_0xeda7('0xe4')));break;case 0xb:if(_0x587929[_0xeda7('0xeb')]>=_0x3b56cc[_0xeda7('0xed')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countabandonedretry':_0x587929['countabandonedretry']+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialAbandonedRetryFrequency'],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x587929[_0xeda7('0xe1')],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929['CampaignId']||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0xf0')));break;case 0x13:if(_0x587929[_0xeda7('0x120')]>=_0x3b56cc[_0xeda7('0x133')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countmachineretry':_0x587929[_0xeda7('0x120')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc[_0xeda7('0x12c')],_0xeda7('0xee'))[_0xeda7('0x45')](_0xeda7('0xcc')),'ContactId':_0x587929['ContactId'],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929['CampaignId']||undefined})[_0xeda7('0xa1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x587929[_0xeda7('0x126')]>=_0x3b56cc[_0xeda7('0x199')]-0x1){return!![];}hopperUtils[_0xeda7('0xdd')]({'active':![],'countagentrejectretry':_0x587929[_0xeda7('0x126')]+=0x1,'scheduledat':moment()[_0xeda7('0xdf')](_0x3b56cc['dialAgentRejectRetryFrequency'],_0xeda7('0xee'))[_0xeda7('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x587929['ContactId'],'ListId':_0x587929[_0xeda7('0xe2')],'VoiceQueueId':_0x587929[_0xeda7('0xe3')]||undefined,'CampaignId':_0x587929[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xeda7('0x82')][_0xeda7('0x110')]=function(_0x286154,_0x1d27ec,_0x27f204){var _0x299ba1=this;var _0x1f5074=new History(_0x286154);var _0x842678=![];var _0x3d6ee9;var _0x37af15;return new Promise(function(_0x431611,_0x93593f){if(_[_0xeda7('0x3e')](_0x1d27ec)&&typeof _0x1d27ec!==_0xeda7('0x19a')){return _0x93593f(msgResponse(_0xeda7('0x19b'),_0xeda7('0x92'),_0xeda7('0x19c')));}if(_[_0xeda7('0x3e')](_0x27f204)&&typeof _0x27f204!=='object'){return _0x93593f(msgResponse(_0xeda7('0x19b'),_0xeda7('0x92'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x1f5074,_0x27f204['reason'],_0x1d27ec)[_0xeda7('0x9d')](function(_0x4339a4){if(_0x4339a4['additional']==0x1)_0x842678=!![];switch(_0x27f204['reason']){case'0':_0x1d27ec[_0xeda7('0x19d')]+=0x1;_0x1f5074['state']=0x0;_0x1f5074[_0xeda7('0x6e')]='NoSuchNumber';_0x1f5074['countnosuchnumberretry']+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;ami[_0xeda7('0x3f')](_0xeda7('0x19e'),ut[_0xeda7('0x11d')](_0x286154,_0xeda7('0x19f')));_0x3d6ee9=_0x1d27ec[_0xeda7('0x1a0')];_0x37af15=_0x1d27ec[_0xeda7('0xd7')];hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x122')));if(_0x299ba1['checkRetriveMax'](0x0,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x125')]>=_0x1d27ec[_0xeda7('0x1a1')]){_0x299ba1['createStateFinal'](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1a2'));}else{_0x299ba1[_0xeda7('0x128')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1a2'));}}break;case'3':_0x1d27ec[_0xeda7('0x1a3')]+=0x1;_0x1f5074[_0xeda7('0xd9')]=0x3;_0x1f5074['statedesc']=_0xeda7('0x1a4');_0x1f5074['countnoanswerretry']+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;var _0x5f1a5a=ut[_0xeda7('0x1a5')](_0x286154,_0x1d27ec);ami[_0xeda7('0x3f')](_0xeda7('0x1a6'),_0x5f1a5a);_0x3d6ee9=_0x1d27ec[_0xeda7('0x194')];_0x37af15=_0x1d27ec[_0xeda7('0xd7')];hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1a7')));if(_0x299ba1[_0xeda7('0x192')](0x3,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x124')]>=_0x1d27ec[_0xeda7('0x193')]){_0x299ba1[_0xeda7('0x12a')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1a8'));}else{_0x299ba1['stateGlobal'](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1a8'));}}break;case'5':_0x1d27ec[_0xeda7('0x1a9')]+=0x1;_0x1f5074['state']=0x5;_0x1f5074['statedesc']='Busy';_0x1f5074[_0xeda7('0x132')]+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;ami[_0xeda7('0x3f')]('custom:agentbusy',ut[_0xeda7('0x11d')](_0x286154,_0xeda7('0x1aa')));_0x3d6ee9=_0x1d27ec['dialBusyRetryFrequency'];_0x37af15=_0x1d27ec['callAdditionalPhoneAfterMin'];hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1ab')));if(_0x299ba1[_0xeda7('0x192')](0x5,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x132')]>=_0x1d27ec[_0xeda7('0x195')]){_0x299ba1['createStateFinal'](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1ac'));}else{_0x299ba1['stateGlobal'](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1ac'));}}break;case'8':_0x1d27ec[_0xeda7('0x1ad')]+=0x1;_0x1f5074[_0xeda7('0xd9')]=0x8;_0x1f5074[_0xeda7('0x6e')]='Congestion';_0x1f5074[_0xeda7('0x123')]+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;_0x3d6ee9=_0x1d27ec['dialCongestionRetryFrequency'];_0x37af15=_0x1d27ec['callAdditionalPhoneAfterMin'];ami[_0xeda7('0x3f')](_0xeda7('0x1ae'),ut[_0xeda7('0x11d')](_0x286154,_0xeda7('0x1af')));hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1b0')));if(_0x299ba1['checkRetriveMax'](0x8,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x123')]>=_0x1d27ec[_0xeda7('0x197')]){_0x299ba1[_0xeda7('0x12a')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1b1'));}else{_0x299ba1[_0xeda7('0x128')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1b1'));}}break;case'11':_0x1d27ec[_0xeda7('0x1b2')]+=0x1;_0x1f5074['state']=0xb;_0x1f5074[_0xeda7('0x6e')]=_0xeda7('0xf1');_0x1f5074[_0xeda7('0xeb')]+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;_0x3d6ee9=_0x1d27ec['dialAbandonedRetryFrequency'];_0x37af15=_0x1d27ec[_0xeda7('0xd7')];hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1b3')));if(_0x299ba1['checkRetriveMax'](0xb,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074['countabandonedretry']>=_0x1d27ec[_0xeda7('0xed')]){_0x299ba1[_0xeda7('0x12a')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1b4'));}else{_0x299ba1[_0xeda7('0x128')](_0x1f5074,_0x431611,_0x93593f,'reason\x2011\x20abandoned');}}break;case'20':_0x1d27ec[_0xeda7('0x1b5')]+=0x1;_0x1f5074[_0xeda7('0xd9')]=0x14;_0x1f5074[_0xeda7('0x6e')]=_0xeda7('0x1b6');_0x1f5074['countagentrejectretry']+=0x1;_0x1f5074[_0xeda7('0xd6')]+=0x1;_0x3d6ee9=_0x1d27ec['dialAgentRejectRetryFrequency'];_0x37af15=_0x1d27ec['callAdditionalPhoneAfterMin'];ami[_0xeda7('0x3f')](_0xeda7('0x1b7'),ut['buildObj'](_0x286154,_0xeda7('0x1b8')));hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1b9')));if(_0x299ba1[_0xeda7('0x192')](0x14,_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x126')]>=_0x1d27ec[_0xeda7('0x199')]){_0x299ba1[_0xeda7('0x12a')](_0x1f5074,_0x431611,_0x93593f,'reason\x2020\x20agentreject');}else{_0x299ba1[_0xeda7('0x128')](_0x1f5074,_0x431611,_0x93593f,_0xeda7('0x1ba'));}}break;default:_0x1d27ec[_0xeda7('0x140')]+=0x1;_0x1f5074[_0xeda7('0xd9')]=0xc;_0x1f5074[_0xeda7('0x6e')]=_0x27f204[_0xeda7('0xc7')];_0x3d6ee9=_0x1d27ec[_0xeda7('0x1bb')];_0x37af15=_0x1d27ec['callAdditionalPhoneAfterMin'];hopperUtils[_0xeda7('0xcd')](_0x1f5074)[_0xeda7('0xa1')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x299ba1[_0xeda7('0x192')](_0x27f204['reason'],_0x286154,_0x1d27ec)&&!_0x842678){if(_0x1f5074[_0xeda7('0x132')]+_0x1f5074[_0xeda7('0x123')]+_0x1f5074[_0xeda7('0x124')]+_0x1f5074['countnosuchnumberretry']+_0x1f5074[_0xeda7('0xde')]+_0x1f5074[_0xeda7('0xeb')]+_0x1f5074[_0xeda7('0x120')]+_0x1f5074[_0xeda7('0x126')]>=_0x1d27ec[_0xeda7('0x127')]){_0x299ba1[_0xeda7('0x128')](_0x1f5074,_0x431611,_0x93593f,_0x27f204[_0xeda7('0xc7')]);}else{_0x299ba1[_0xeda7('0x12a')](_0x1f5074,_0x431611,_0x93593f,_0x27f204['reason']);}}}})['then'](function(){if(_0x842678){hopperUtils[_0xeda7('0x1bc')](_0x1f5074,_0x3d6ee9,_0x37af15)['then'](function(){return _0x431611(0x1);});}});});};Dialer[_0xeda7('0x82')]['stateGlobal']=function(_0xeddf47,_0x58ef9e,_0xc0d4cf,_0x4ed8d6){var _0x3073bf=new Final(_0xeddf47);_0x3073bf[_0xeda7('0xd9')]=0xf;_0x3073bf[_0xeda7('0x6e')]=_0xeda7('0x1bd');this[_0xeda7('0x12a')](_0x3073bf,_0x58ef9e,_0xc0d4cf,_0x4ed8d6);};Dialer[_0xeda7('0x82')]['createStateFinal']=function(_0x28320e,_0x1b914e,_0x339aa5,_0x155dd7){hopperUtils[_0xeda7('0xce')](_0x28320e)[_0xeda7('0x9d')](function(){return _0x1b914e(msgResponse(_0xeda7('0x19b'),'Success',_0x155dd7));})['catch'](function(){return _0x339aa5(msgResponse('[moveContactManagedDialer][0]','Failure',_0xeda7('0x1be')));});};Dialer[_0xeda7('0x82')][_0xeda7('0xb2')]=function(_0x5c76fa){var _0xe2e300=_0x5c76fa['dialPredictiveOptimizationPercentage']/0x64;var _0x585733=_0x5c76fa[_0xeda7('0xd2')]/(_0x5c76fa['outboundDropCallsDayTimeout']+_0x5c76fa[_0xeda7('0xc6')]);var _0x5d90af=Math['round'](_0x5c76fa[_0xeda7('0x1bf')]*(_0x5c76fa[_0xeda7('0x1c0')]/0x64));var _0x4b17cf=Math[_0xeda7('0x1c1')](_0x5c76fa[_0xeda7('0x1bf')]*(_0x5c76fa[_0xeda7('0x1c2')]/0x64));var _0x32b00a=_0x5c76fa[_0xeda7('0x1c3')]+_0x5c76fa[_0xeda7('0x146')];var _0x3ea28f=Math[_0xeda7('0x1c4')](_0x5c76fa['erlangCalls']*_0x5c76fa['erlangAbandonmentRate']*_0x5c76fa['predictiveIntervalHitRate']*_0x5c76fa[_0xeda7('0x1c5')]);if(_[_0xeda7('0x3e')](_0x5c76fa['startProgressive'])){if(!_[_0xeda7('0x3e')](_0x5c76fa[_0xeda7('0x24')])){_0x5c76fa['startPredictive']=undefined;loggerPredictive[_0xeda7('0x64')]('[startMethodPredictive][StartProgressive]',_0xeda7('0x1c6'));}if(!_[_0xeda7('0x3e')](_0x5c76fa[_0xeda7('0x63')])){loggerPredictive[_0xeda7('0x64')](_0xeda7('0x1c7'),_0xeda7('0x1c8'));clearInterval(_0x5c76fa['handlePredictive']);_0x5c76fa[_0xeda7('0x63')]=undefined;}_0x5c76fa[_0xeda7('0x60')]=moment()[_0xeda7('0x45')](_0xeda7('0xcc'));loggerPredictive[_0xeda7('0x4a')](_0x5c76fa[_0xeda7('0x47')],_0xeda7('0x1c9'),_0x5c76fa[_0xeda7('0x60')]);this['handlePower'](_0x5c76fa,0x1);}else if(ifInterval(_0x5c76fa[_0xeda7('0x1ca')],_0x5c76fa[_0xeda7('0x60')])){this['handlePower'](_0x5c76fa,0x1);loggerPredictiveCalls[_0xeda7('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x5c76fa['startProgressive'],_0x5c76fa[_0xeda7('0x47')]);_0x5c76fa[_0xeda7('0x57')]=0x0;_0x5c76fa['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xe2e300<_0x585733&&_0x5c76fa[_0xeda7('0x1cb')]===_0xeda7('0x1cc')){clearPredictiveAttributes(_0x5c76fa);loggerPredictive['info'](_0xeda7('0x1cd'),_0xeda7('0x1ce'),_0x585733,_0xeda7('0x60'),_0x5c76fa[_0xeda7('0x47')]);}else if(_0x3ea28f<_0x5c76fa[_0xeda7('0xd3')]&&_0x5c76fa[_0xeda7('0x1cb')]===_0xeda7('0x1cc')){clearPredictiveAttributes(_0x5c76fa);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x1cf'),'Max\x20Drop\x20',_0x3ea28f,_0xeda7('0x1d0'),_0x5c76fa['predictiveIntervalErlangCallsDroppedCalls'],_0xeda7('0x60'),_0x5c76fa[_0xeda7('0x47')]);}else if(!ifInterval(_0x5c76fa[_0xeda7('0x1ca')],_0x5c76fa['startProgressive'])&&_[_0xeda7('0x3e')](_0x5c76fa[_0xeda7('0x24')])&&!_['isUndefined'](_0x5c76fa['startProgressive'])){_0x5c76fa[_0xeda7('0x24')]=moment()[_0xeda7('0x45')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5c76fa['name'],_0xeda7('0x1d1'),_0x5c76fa[_0xeda7('0x24')]);hopperUtils[_0xeda7('0x1d2')](_0x5c76fa[_0xeda7('0x1ca')])['then'](this[_0xeda7('0x1d3')](_0x5c76fa))[_0xeda7('0x9d')](mergeDataErlangB(_0x5c76fa))['then'](this[_0xeda7('0x1d4')](_0x5c76fa))[_0xeda7('0xa1')](loggerCatchPredictive(_0xeda7('0x1d5'),_0x5c76fa));}else if(!ifInterval(_0x5c76fa['dialPredictiveInterval'],_0x5c76fa[_0xeda7('0x24')])){_0x5c76fa['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5c76fa[_0xeda7('0x24')]=moment()[_0xeda7('0x45')](_0xeda7('0xcc'));loggerPredictive[_0xeda7('0x4a')](_0x5c76fa[_0xeda7('0x47')],'recalculate\x20predictive\x20at',_0x5c76fa[_0xeda7('0x24')]);clearInterval(_0x5c76fa['handlePredictive']);_0x5c76fa[_0xeda7('0x63')]=undefined;hopperUtils['avgHandleTime'](_0x5c76fa[_0xeda7('0x1ca')])[_0xeda7('0x9d')](this[_0xeda7('0x1d3')](_0x5c76fa))['then'](mergeDataErlangB(_0x5c76fa))['then'](this[_0xeda7('0x1d4')](_0x5c76fa))['catch'](loggerCatchPredictive(_0xeda7('0x1d6'),_0x5c76fa));}else if(_0x5c76fa[_0xeda7('0x1bf')]&&_0x32b00a<_0x5c76fa[_0xeda7('0x1bf')]-_0x4b17cf){clearPredictiveAttributes(_0x5c76fa);loggerPredictive['info'](_0x5c76fa[_0xeda7('0x47')],_0xeda7('0x1d7'),_0x32b00a,_0xeda7('0x1d8'),_0x5c76fa['predictiveIntervalAvailable'],'-',_0x4b17cf,'=',_0x5c76fa[_0xeda7('0x1bf')]-_0x4b17cf,')');}else if(_0x5c76fa['predictiveIntervalAvailable']&&_0x32b00a>_0x5c76fa[_0xeda7('0x1bf')]+_0x5d90af){clearPredictiveAttributes(_0x5c76fa);loggerPredictive[_0xeda7('0x4a')](_0x5c76fa[_0xeda7('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x32b00a,_0xeda7('0x1d9'),_0x5c76fa[_0xeda7('0x1bf')],'+',_0x5d90af,'=',_0x5c76fa[_0xeda7('0x1bf')]+_0x5d90af,')');}};Dialer[_0xeda7('0x82')][_0xeda7('0x1d3')]=function(_0x12fd60){var _0x41511a=this;return function(_0x3906f0){return new Promise(function(_0x474298,_0x4cc200){_[_0xeda7('0x5e')](_0x12fd60,_0x3906f0[0x0]);if(checkGetDataPredictive(_0x3906f0[0x0])){var _0x22a4bc=_0x12fd60[_0xeda7('0x1bf')]=_0x12fd60[_0xeda7('0x146')]+_0x12fd60['available'];var _0x1bee97=_0x12fd60[_0xeda7('0x1ca')]*0x3c;var _0x16257c=_0x3906f0[0x0][_0xeda7('0x52')]+_0x3906f0[0x0][_0xeda7('0x53')];var _0x1fbea8=(_0x3906f0[0x0]['predictiveIntervalAnsweredCalls']+_0x3906f0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3906f0[0x0][_0xeda7('0x50')])/_0x3906f0[0x0][_0xeda7('0x4b')];_0x12fd60['predictiveIntervalHitRate']=_0x1fbea8>0x0?_0x1fbea8:0x1;switch(_0x12fd60[_0xeda7('0x1cb')]){case _0xeda7('0x1cc'):var _0x2c039f=_0x12fd60['dialPredictiveOptimizationPercentage']/0x64;return _0x41511a[_0xeda7('0x1da')](_0x22a4bc,_0x1bee97,_0x16257c,_0x1fbea8,_0x2c039f)[_0xeda7('0x9d')](function(_0xc62e90){return _0x474298(_0xc62e90);});case'agentBusyFactor':var _0x5c8afe=_0x12fd60[_0xeda7('0x1db')]/0x64;return _0x41511a[_0xeda7('0x1dc')](_0x22a4bc,_0x1bee97,_0x16257c,_0x1fbea8,_0x5c8afe)[_0xeda7('0x9d')](function(_0x34a273){return _0x474298(_0x34a273);});default:return _0x4cc200(msgResponse(_0xeda7('0x1dd'),_0xeda7('0x92'),_0xeda7('0x1de')));}}else{return _0x4cc200(msgResponse(_0xeda7('0x1dd'),_0xeda7('0x92'),_0xeda7('0x1df')));}});};};Dialer['prototype'][_0xeda7('0x1e0')]=function(_0x4732df){var _0x3796d8=this;return function(_0x15644a){return new Promise(function(_0x177d3a,_0x112ad8){_[_0xeda7('0x5e')](_0x4732df,_0x15644a[0x0]);if(checkGetDataPredictive(_0x15644a[0x0])){loggerPredictive[_0xeda7('0x4a')](JSON[_0xeda7('0x73')](_0x15644a[0x0]));if(_0x4732df[_0xeda7('0x1cb')]===_0xeda7('0x1cc')){return _0x3796d8[_0xeda7('0x15b')](_0x4732df['id'])['then'](function(_0x1e20ea){var _0x381b58=_0x4732df[_0xeda7('0x1e1')]-_0x1e20ea[0x0][_0xeda7('0x1e2')];var _0xa2b74d=_0x4732df[_0xeda7('0x1ca')]*0x3c;var _0x18eed1=_0x15644a[0x0][_0xeda7('0x52')]+_0x15644a[0x0]['predictiveIntervalAvgHoldtime'];var _0x1cad29=(_0x15644a[0x0][_0xeda7('0x4c')]+_0x15644a[0x0][_0xeda7('0x4e')]+_0x15644a[0x0][_0xeda7('0x50')])/_0x15644a[0x0][_0xeda7('0x4b')];var _0x3932a8=_0x4732df[_0xeda7('0x1db')]/0x64;_0x4732df[_0xeda7('0x1e3')]=_0x1e20ea[0x0][_0xeda7('0x1e2')]||0x0;_0x4732df[_0xeda7('0x1e4')]=_0x1cad29>0x0?_0x1cad29:0x1;return _0x3796d8['abandonmentRate'](_0x381b58,_0xa2b74d,_0x18eed1,_0x1cad29,_0x3932a8);})[_0xeda7('0x9d')](function(_0x2c787f){return _0x177d3a(_0x2c787f);})[_0xeda7('0xa1')](function(_0x3ad4d0){return _0x112ad8(msgResponse(_0xeda7('0x1e5'),'Failure',JSON['stringify'](_0x3ad4d0)));});}if(_0x4732df['dialPredictiveOptimization']===_0xeda7('0x1e6')){return _0x3796d8[_0xeda7('0x15b')](_0x4732df['id'])[_0xeda7('0x9d')](function(_0x6cc749){var _0x194061=_0x4732df[_0xeda7('0x1e1')]-_0x6cc749[0x0]['outboundQueuePauses'];var _0x3c5d77=_0x4732df[_0xeda7('0x1ca')]*0x3c;var _0xa3a1bd=_0x15644a[0x0]['predictiveIntervalAvgTalktime']+_0x15644a[0x0][_0xeda7('0x53')];var _0x3cfa76=(_0x15644a[0x0][_0xeda7('0x4c')]+_0x15644a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x15644a[0x0][_0xeda7('0x50')])/_0x15644a[0x0][_0xeda7('0x4b')];var _0x1daa64=_0x4732df[_0xeda7('0x1db')]/0x64;_0x4732df[_0xeda7('0x1e3')]=_0x6cc749[0x0][_0xeda7('0x1e2')]||0x0;_0x4732df[_0xeda7('0x1e4')]=_0x3cfa76>0x0?_0x3cfa76:0x1;return _0x3796d8[_0xeda7('0x1dc')](_0x194061,_0x3c5d77,_0xa3a1bd,_0x3cfa76,_0x1daa64);})[_0xeda7('0x9d')](function(_0x508ab4){return _0x177d3a(_0x508ab4);})[_0xeda7('0xa1')](function(_0xf8d1de){return _0x112ad8(msgResponse(_0xeda7('0x1e5'),_0xeda7('0x92'),JSON[_0xeda7('0x73')](_0xf8d1de)));});}}else{return _0x112ad8(msgResponse(_0xeda7('0x1dd'),_0xeda7('0x92'),_0xeda7('0x1df')));}});};};Dialer[_0xeda7('0x82')][_0xeda7('0x1d4')]=function(_0x51d2a6){var _0x25bc74=this;return function(){var _0x3569c6=0x0;var _0x58d005=Math[_0xeda7('0x1c4')](_0x51d2a6[_0xeda7('0x59')]*0x3e8);if(_0x58d005>0x0){_0x58d005=_0x58d005<0x64?0x64:_0x58d005;loggerPredictive['info'](_0x51d2a6[_0xeda7('0x47')],_0xeda7('0x1e7'),_0x58d005,'milliseconds');_0x51d2a6[_0xeda7('0x63')]=setInterval(function(){_0x25bc74['handlePredictive'](_0x51d2a6);loggerPredictiveCalls[_0xeda7('0x4a')](_0xeda7('0x1e8'),_0x3569c6+=0x1);},_0x58d005);}else{loggerPredictive[_0xeda7('0x4a')](_0x51d2a6[_0xeda7('0x47')],_0xeda7('0x1e9'));}};};Dialer[_0xeda7('0x82')][_0xeda7('0x1ea')]=function(_0x3414f0,_0xc8ced7){var _0x3522bb=this;return function(_0x351687){if(_[_0xeda7('0x49')](_0x351687)){if(_[_0xeda7('0xf9')](_0xc8ced7[_0xeda7('0x1eb')])||!_0xc8ced7[_0xeda7('0x1ec')]){if(_0x3414f0[_0xeda7('0xb1')]===_0xeda7('0x1ed')){_0x3414f0[_0xeda7('0x71')]=_[_0xeda7('0x3e')](_0x3414f0[_0xeda7('0x71')])?!![]:_0x3414f0[_0xeda7('0x71')];var _0x4e1383=uuid['v4']();_0x3522bb[_0xeda7('0x21')][_0x4e1383]=new Action(_0x3414f0,_0xc8ced7,_0x4e1383);loggerBooked[_0xeda7('0x4a')](_0xeda7('0x1ee'),_0x4e1383,_0xeda7('0x1ef'),JSON[_0xeda7('0x73')](_0x3414f0['queueStatusComplete']),_0xeda7('0x1f0'),_0x3414f0['name']);if(_0x3414f0['queueStatusComplete']){_0x3414f0[_0xeda7('0x71')]=![];_0x3522bb['queueBooked'][_0x3522bb[_0xeda7('0x21')][_0x4e1383][_0xeda7('0xc0')]]=[];ami['Action']({'actionid':_0x4e1383,'action':_0xeda7('0x1f1'),'queue':_0x3414f0[_0xeda7('0x47')]})[_0xeda7('0xa1')](function(){utils[_0xeda7('0xc3')](_0x3414f0,_0xeda7('0x1f2'));hopperUtils[_0xeda7('0xdd')]({'active':![],'ContactId':_0x3522bb['actions'][_0x4e1383][_0xeda7('0xe1')],'ListId':_0x3522bb[_0xeda7('0x21')][_0x4e1383][_0xeda7('0xe2')],'VoiceQueueId':_0x3522bb[_0xeda7('0x21')][_0x4e1383]['VoiceQueueId']||undefined,'CampaignId':_0x3522bb['actions'][_0x4e1383][_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3522bb['actions'][_0x4e1383];});}else{loggerBooked[_0xeda7('0x4a')](_0xeda7('0x1f3'),JSON[_0xeda7('0x73')](_0x3414f0[_0xeda7('0x71')]),'Queue:\x20',_0x3414f0[_0xeda7('0x47')]);utils[_0xeda7('0xc3')](_0x3414f0,_0xeda7('0x1f2'));hopperUtils[_0xeda7('0xdd')]({'active':![],'ContactId':_0x3522bb[_0xeda7('0x21')][_0x4e1383][_0xeda7('0xe1')],'ListId':_0x3522bb[_0xeda7('0x21')][_0x4e1383][_0xeda7('0xe2')],'VoiceQueueId':_0x3522bb[_0xeda7('0x21')][_0x4e1383]['VoiceQueueId']||undefined,'CampaignId':_0x3522bb[_0xeda7('0x21')][_0x4e1383][_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1f4')));delete _0x3522bb['actions'][_0x4e1383];}}else{return _0x3522bb[_0xeda7('0x166')](_0x3414f0,_0xc8ced7);}}else{if(utils[_0xeda7('0x5f')](undefined,_0xc8ced7['scheduledat'])<_0x3414f0['dialRecallMeTimeout']*0x3c){if(_0xc8ced7[_0xeda7('0x163')]&&!_0xc8ced7[_0xeda7('0x163')][_0xeda7('0x1f5')]){_0x3522bb[_0xeda7('0xfb')]['run'](_0xc8ced7['id'])[_0xeda7('0x1a')](function(){utils['decrementOriginate'](_0x3414f0,_0xeda7('0x1f2'));});}else{hopperUtils['unlockContact']({'active':![]},_0xc8ced7['id'],0x1)[_0xeda7('0x1a')](function(){utils[_0xeda7('0xc3')](_0x3414f0,_0xeda7('0x1f2'));});}}else{_0x3414f0['outboundReCallsDay']+=0x1;utils[_0xeda7('0xc3')](_0x3414f0,_0xeda7('0x1f2'));if(_0x3414f0[_0xeda7('0x1f6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xc8ced7['ContactId'],'ListId':_0xc8ced7['ListId'],'VoiceQueueId':_0xc8ced7[_0xeda7('0xe3')]||undefined,'CampaignId':_0xc8ced7[_0xeda7('0xef')]||undefined})[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1f7')));hopperUtils['createHistory'](createObjHistory(_0x3414f0,_0xc8ced7,utils[_0xeda7('0x6b')][_0xeda7('0x1f8')],0x17,_0xeda7('0x1f9')))[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x1fa')));}else{_0x3522bb[_0xeda7('0x11f')](createObjHistory(_0x3414f0,_0xc8ced7,utils[_0xeda7('0x6b')][_0xeda7('0x1fb')],0x16,_0xeda7('0x1fc')),_0xeda7('0x1fd'),_0xeda7('0x1fe'));}}}}else{_0x3414f0[_0xeda7('0x1ff')]+=0x1;_0x3522bb[_0xeda7('0x11f')](createObjHistory(_0x3414f0,_0xc8ced7,utils[_0xeda7('0x6b')][_0xeda7('0x200')],0xd,_0xeda7('0x201')),_0xeda7('0x202'),_0xeda7('0x203'));throw _0xeda7('0x204');}};};Dialer[_0xeda7('0x82')][_0xeda7('0x165')]=function(_0x3a4e6e){var _0x13496b=this;var _0x23823f=_0x3a4e6e[_0xeda7('0x205')]-_0x3a4e6e[_0xeda7('0x206')];emitCampaignSummary(_0x3a4e6e);if(_0x23823f>0x0&&_0x3a4e6e[_0xeda7('0x207')]==0x0){if(_0x23823f>this[_0xeda7('0x1f')]){_0x23823f=this['maxNumberOriginate'];}_0x3a4e6e[_0xeda7('0x207')]=0x1;hopperUtils[_0xeda7('0x208')](_0x3a4e6e,_0x23823f)['then'](function(_0x486534){_0x3a4e6e[_0xeda7('0x207')]=0x0;if(_0x486534){if(!utils[_0xeda7('0x209')](_0x486534)){_0x3a4e6e[_0xeda7('0x67')]=utils[_0xeda7('0x6b')][_0xeda7('0x6c')];logger[_0xeda7('0x4a')](_0xeda7('0x20a')+_0x3a4e6e[_0xeda7('0x47')]);}else{_0x3a4e6e[_0xeda7('0x206')]+=_0x486534['length'];_0x3a4e6e[_0xeda7('0x67')]=utils[_0xeda7('0x6b')]['RUNNING'];for(var _0x492632=0x0;_0x492632<_0x486534[_0xeda7('0x97')];_0x492632+=0x1){_0x3a4e6e[_0xeda7('0x20b')]+=0x1;if(_[_0xeda7('0xf9')](_0x486534[_0x492632])||_[_0xeda7('0xf9')](_0x486534[_0x492632]['Contact'])||_[_0xeda7('0xf9')](_0x486534[_0x492632][_0xeda7('0x167')])){_0x13496b[_0xeda7('0x15d')](_0xeda7('0x20c'),_0x3a4e6e,_0x486534[_0x492632]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xeda7('0x74')](_0x486534[_0x492632],[_0xeda7('0xef'),'phone']))[_0xeda7('0x9d')](_0x13496b[_0xeda7('0x1ea')](_0x3a4e6e,_0x486534[_0x492632]))[_0xeda7('0xa1')](function(_0x2582f3){logger['error'](_0xeda7('0x20d'),_0x2582f3);utils[_0xeda7('0xc3')](_0x3a4e6e,_0xeda7('0x20e'));});}}}}})[_0xeda7('0xa1')](function(_0x4e644a){_0x3a4e6e[_0xeda7('0x207')]=0x0;logger[_0xeda7('0x64')](_0xeda7('0x20f'),_0x4e644a);});}};Dialer[_0xeda7('0x82')][_0xeda7('0xb5')]=function(_0x2a8957,_0x3e2d74){var _0x347914=this;var _0x481a3f=[];if(_0x3e2d74<0x1||_0x2a8957[_0xeda7('0xb1')]===_0xeda7('0x1ed')){_0x3e2d74=0x1;}var _0x1aad7b=Math[_0xeda7('0x1c4')](_0x2a8957[_0xeda7('0x1c3')]*_0x3e2d74)-_0x2a8957[_0xeda7('0x206')];if(_0x2a8957[_0xeda7('0x210')]>0x0){var _0x3d80db=_0x2a8957[_0xeda7('0x210')]-_0x2a8957[_0xeda7('0x206')]-_0x2a8957[_0xeda7('0x146')]-_0x2a8957['pTalking'];if(_0x1aad7b>_0x3d80db){_0x1aad7b=_0x3d80db;}}if(_0x1aad7b>0x0&&_0x2a8957[_0xeda7('0x207')]==0x0){if(_0x2a8957['dialMethod']==='booked'){_0x1aad7b=0x1;}if(_0x1aad7b>this[_0xeda7('0x1f')]){_0x1aad7b=this['maxNumberOriginate'];}for(var _0x3630f4 in this[_0xeda7('0x1d')]){if(typeof this['agents'][_0x3630f4]!==_0xeda7('0x211')){if(this[_0xeda7('0x1d')][_0x3630f4][_0xeda7('0xd9')]===_0xeda7('0x212')&&this[_0xeda7('0x1d')][_0x3630f4][_0xeda7('0x85')]===_0xeda7('0x86')){_0x481a3f[_0xeda7('0x98')](this[_0xeda7('0x1d')][_0x3630f4]['id']);}}}_0x2a8957[_0xeda7('0x207')]=0x1;hopperUtils[_0xeda7('0x213')](_0x2a8957,_0x481a3f,_0x1aad7b)[_0xeda7('0x9d')](function(_0x558d85){_0x2a8957[_0xeda7('0x207')]=0x0;if(_0x558d85){if(!utils[_0xeda7('0x209')](_0x558d85)){hopperUtils[_0xeda7('0x214')](_0x2a8957)[_0xeda7('0x9d')](sendMessageReschedule(_0x2a8957))[_0xeda7('0xa1')](loggerCatch(_0xeda7('0x215')));}else{_0x2a8957['originated']+=_0x558d85[_0xeda7('0x97')];_0x2a8957[_0xeda7('0x67')]=_0x2a8957[_0xeda7('0xb1')]==='booked'?utils['CAMPAIGN_STATUS'][_0xeda7('0x148')]:utils[_0xeda7('0x6b')][_0xeda7('0x216')];for(var _0x452d16=0x0;_0x452d16<_0x558d85['length'];_0x452d16+=0x1){if(_[_0xeda7('0xf9')](_0x558d85[_0x452d16])||_[_0xeda7('0xf9')](_0x558d85[_0x452d16][_0xeda7('0x217')])||_['isNil'](_0x558d85[_0x452d16]['phone'])){_0x347914[_0xeda7('0x15d')](_0xeda7('0x20c'),_0x2a8957,_0x558d85[_0x452d16]);}else{hopperUtils[_0xeda7('0x218')](_[_0xeda7('0x74')](_0x558d85[_0x452d16],[_0xeda7('0xe3'),_0xeda7('0x167')]))[_0xeda7('0x9d')](_0x347914[_0xeda7('0x1ea')](_0x2a8957,_0x558d85[_0x452d16]))['catch'](function(_0x31dafc){logger[_0xeda7('0x64')](_0xeda7('0x219'),_0x31dafc);utils[_0xeda7('0xc3')](_0x2a8957,'[handlePower]');});}}}}})[_0xeda7('0xa1')](function(_0x2ca14d){_0x2a8957[_0xeda7('0x207')]=0x0;logger[_0xeda7('0x64')](_0xeda7('0x20f'),_0x2ca14d);});}};Dialer[_0xeda7('0x82')][_0xeda7('0x63')]=function(_0x5aca74){if(_0x5aca74[_0xeda7('0x210')]>0x0){var _0x5d7474=_0x5aca74[_0xeda7('0x210')]-_0x5aca74[_0xeda7('0x206')]-_0x5aca74[_0xeda7('0x146')];if(_0x5d7474>0x0&&_0x5aca74['temp']==0x0){this[_0xeda7('0x21a')](_0x5aca74);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xeda7('0x21a')](_0x5aca74);}};Dialer['prototype'][_0xeda7('0x21a')]=function(_0x46cecc){var _0x21d783=this;var _0x56bf6e=[];_0x46cecc[_0xeda7('0x206')]+=0x1;for(var _0x1cc5c2 in this[_0xeda7('0x1d')]){if(typeof this[_0xeda7('0x1d')][_0x1cc5c2]!=='undefined'){if(this['agents'][_0x1cc5c2][_0xeda7('0xd9')]===_0xeda7('0x212')&&this['agents'][_0x1cc5c2]['status']===_0xeda7('0x86')){_0x56bf6e[_0xeda7('0x98')](this[_0xeda7('0x1d')][_0x1cc5c2]['id']);}}}_0x46cecc[_0xeda7('0x207')]=0x1;return this[_0xeda7('0x213')](_0x46cecc['id'],_0x56bf6e,0x1,_0x46cecc['dialOrderByScheduledAt'],_0x46cecc)[_0xeda7('0x9d')](function(_0x4acada){_0x46cecc['temp']=0x1;if(_0x4acada){if(!utils[_0xeda7('0x209')](_0x4acada)){utils[_0xeda7('0x21b')](_0x46cecc,0x1,0x0);return hopperUtils['countReScheduled'](_0x46cecc)[_0xeda7('0x9d')](sendMessageReschedule(_0x46cecc))['catch'](loggerCatch(_0xeda7('0x215')));}else{_0x46cecc[_0xeda7('0x67')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0xeda7('0xf9')](_0x4acada[0x0])||_[_0xeda7('0xf9')](_0x4acada[0x0][_0xeda7('0x217')])||_[_0xeda7('0xf9')](_0x4acada[0x0][_0xeda7('0x167')])){_0x21d783[_0xeda7('0x15d')](_0xeda7('0x20c'),_0x46cecc,_0x4acada[0x0]);}else{return hopperUtils[_0xeda7('0x218')](_['pick'](_0x4acada[0x0],[_0xeda7('0xe3'),_0xeda7('0x167')]))['then'](_0x21d783[_0xeda7('0x1ea')](_0x46cecc,_0x4acada[0x0]))[_0xeda7('0xa1')](function(_0x13a24b){logger[_0xeda7('0x64')](_0xeda7('0x21c'),_0x13a24b);utils[_0xeda7('0xc3')](_0x46cecc,_0xeda7('0x21c'));});}}}})['catch'](function(_0x3ebd63){_0x46cecc['temp']=0x0;logger[_0xeda7('0x64')](_0xeda7('0x20f'),_0x3ebd63);});};Dialer['prototype']['abandonmentRate']=function(_0x566146,_0x4feb02,_0x199852,_0x181de1,_0x23d31f,_0x5775c4){loggerPredictive[_0xeda7('0x4a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x21d'),_0x566146);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4feb02);loggerPredictive['info'](_0xeda7('0x21e'),_0x199852);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x21f'),_0x181de1);loggerPredictive[_0xeda7('0x4a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23d31f);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x5d'));return new Promise(function(_0x811ed6,_0x1bc53e){if(_0x566146<=0x0||isNaN(_0x566146)){return _0x1bc53e(msgResponse(_0xeda7('0x220'),_0xeda7('0x81'),'m\x20=\x20'+_0x566146));}if(_0x199852<=0x0||isNaN(_0x199852)){return _0x1bc53e(msgResponse(_0xeda7('0x220'),_0xeda7('0x81'),_0xeda7('0x221')+_0x199852));}if(_0x181de1<=0x0||isNaN(_0x181de1)){return _0x1bc53e(msgResponse(_0xeda7('0x220'),_0xeda7('0x81'),_0xeda7('0x222')+_0x181de1));}if(_0x4feb02<=0x0||isNaN(_0x4feb02)){return _0x1bc53e(msgResponse('[abandonmentRate]',_0xeda7('0x81'),'interval\x20=\x20'+_0x4feb02));}if(_0x23d31f<=0x0||isNaN(_0x23d31f)){return _0x1bc53e(msgResponse(_0xeda7('0x220'),_0xeda7('0x81'),_0xeda7('0x223')+_0x23d31f));}_0x5775c4=_0x5775c4||0x0;var _0x1abf88=0x1/_0x199852;var _0x2b6df0=0x0;var _0x2714b8=0x0;var _0x155d75=0x0;var _0xa6e7bd=0x0;for(var _0x179e80=0x0;_0x155d75<_0x23d31f;_0x179e80+=0x1){_0x2714b8=_0x179e80/_0x4feb02;_0x2b6df0=(_0x181de1*_0x2714b8+_0x5775c4)/_0x1abf88;_0x155d75=utils[_0xeda7('0x224')](_0x2b6df0,_0x566146);_0xa6e7bd=_0x2b6df0/_0x566146*(0x1-utils[_0xeda7('0x224')](_0x2b6df0,_0x566146));}return _0x811ed6({'erlangCalls':_0x179e80,'erlangCallToSecond':_0x4feb02/_0x179e80,'erlangAbandonmentRate':_0x155d75,'erlangBusyFactor':_0xa6e7bd});});};Dialer[_0xeda7('0x82')][_0xeda7('0x1dc')]=function(_0x56d659,_0x3c51bc,_0x581845,_0x51e6cc,_0x2af021,_0x3069ff){loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x225'));loggerPredictive['info'](_0xeda7('0x21d'),_0x56d659);loggerPredictive[_0xeda7('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c51bc);loggerPredictive['info'](_0xeda7('0x21e'),_0x581845);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x21f'),_0x51e6cc);loggerPredictive[_0xeda7('0x4a')](_0xeda7('0x226'),_0x2af021);loggerPredictive['info']('---------------------------');return new Promise(function(_0x558fe8,_0x2f98c4){if(_0x56d659<=0x0||isNaN(_0x56d659)){return _0x2f98c4(msgResponse(_0xeda7('0x227'),'Error',_0xeda7('0x228')+_0x56d659));}if(_0x581845<=0x0||isNaN(_0x581845)){return _0x2f98c4(msgResponse(_0xeda7('0x227'),_0xeda7('0x81'),_0xeda7('0x221')+_0x581845));}if(_0x51e6cc<=0x0||isNaN(_0x51e6cc)){return _0x2f98c4(msgResponse(_0xeda7('0x227'),_0xeda7('0x81'),'p\x20=\x20'+_0x51e6cc));}if(_0x3c51bc<=0x0||isNaN(_0x3c51bc)){return _0x2f98c4(msgResponse(_0xeda7('0x227'),_0xeda7('0x81'),_0xeda7('0x229')+_0x3c51bc));}if(_0x2af021<=0x0||isNaN(_0x2af021)){return _0x2f98c4(msgResponse('[busyFactor]','Error',_0xeda7('0x22a')+_0x2af021));}_0x3069ff=_0x3069ff||0x0;var _0xe8d341=0x1/_0x581845;var _0x4047fa=0x0;var _0xbde8ee=0x0;var _0x5ede0f=0x0;var _0x17a42b=0x0;for(var _0x49d89c=0x0;_0x17a42b<_0x2af021;_0x49d89c+=0x1){_0xbde8ee=_0x49d89c/_0x3c51bc;_0x4047fa=(_0x51e6cc*_0xbde8ee+_0x3069ff)/_0xe8d341;_0x5ede0f=utils[_0xeda7('0x224')](_0x4047fa,_0x56d659);_0x17a42b=_0x4047fa/_0x56d659*(0x1-utils['erlangb'](_0x4047fa,_0x56d659));}return _0x558fe8({'erlangCalls':_0x49d89c,'erlangCallToSecond':_0x3c51bc/_0x49d89c,'erlangAbandonmentRate':_0x5ede0f,'erlangBusyFactor':_0x17a42b});});};module[_0xeda7('0x22b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 1607827..76d22cb 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8031=['string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','exports','isNil'];(function(_0x56d970,_0x42c6e6){var _0x9180e6=function(_0x38b9d9){while(--_0x38b9d9){_0x56d970['push'](_0x56d970['shift']());}};_0x9180e6(++_0x42c6e6);}(_0x8031,0x1b7));var _0x1803=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x8031[_0x45783c];return _0x1161da;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x148310,_0x60af97,_0x215316){var _0x299d1f='';if(!_['isNil'](_0x60af97)&&'string'===typeof _0x60af97){_0x299d1f+=_0x60af97;}if(!_[_0x1803('0x0')](_0x215316)&&_0x1803('0x1')===typeof _0x215316){_0x299d1f+='\x20'+_0x215316;}if(_0x299d1f!==''){return _0x299d1f;}return _0x148310;}function Action(_0x448bb3,_0x4341ac,_0x10f1e9){this[_0x1803('0x2')]=_0x448bb3;this[_0x1803('0x3')]=_0x10f1e9||undefined;this['name']=checkNameSurname(_0x4341ac[_0x1803('0x4')][_0x1803('0x5')],_0x4341ac[_0x1803('0x4')][_0x1803('0x6')],_0x4341ac['Contact'][_0x1803('0x7')]);this[_0x1803('0x8')]=_0x4341ac['phone'];this[_0x1803('0x9')]=_0x448bb3[_0x1803('0xa')];this['active']=_0x4341ac[_0x1803('0xb')]||![];this[_0x1803('0xc')]=_0x448bb3['type'];this[_0x1803('0xd')]=_0x448bb3[_0x1803('0xd')]||0x3;this[_0x1803('0xe')]=_0x4341ac[_0x1803('0xe')];this['countbusyretry']=_0x4341ac[_0x1803('0xf')];this[_0x1803('0x10')]=_0x4341ac[_0x1803('0x10')];this[_0x1803('0x11')]=_0x4341ac['countnoanswerretry'];this[_0x1803('0x12')]=_0x4341ac[_0x1803('0x12')];this[_0x1803('0x13')]=_0x4341ac['countdropretry'];this[_0x1803('0x14')]=_0x4341ac[_0x1803('0x14')];this[_0x1803('0x15')]=_0x4341ac[_0x1803('0x15')];this[_0x1803('0x16')]=_0x4341ac[_0x1803('0x16')];this[_0x1803('0x17')]=_0x4341ac[_0x1803('0x17')];this[_0x1803('0x18')]=_0x4341ac[_0x1803('0x18')];this[_0x1803('0x19')]=_0x4341ac[_0x1803('0x19')];this['VoiceQueueId']=_0x4341ac[_0x1803('0x1a')];this[_0x1803('0x1b')]=_0x4341ac['CampaignId'];this[_0x1803('0x1c')]=_0x4341ac['id'];this[_0x1803('0x1d')]=_0x4341ac[_0x1803('0x4')]['firstName']||'';this['starttime']=moment()[_0x1803('0x1e')](_0x1803('0x1f'));this['callback']=_0x4341ac[_0x1803('0x20')];this[_0x1803('0x21')]=_0x4341ac['callbackuniqueid'];this[_0x1803('0x22')]=_0x4341ac[_0x1803('0x22')];this[_0x1803('0x23')]=_0x4341ac[_0x1803('0x23')];this[_0x1803('0x24')]='';this[_0x1803('0x25')]='';}Action['prototype'][_0x1803('0x26')]=function(){return util[_0x1803('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x1803('0x2')][_0x1803('0x27')]>0x0?this[_0x1803('0x8')][_0x1803('0x28')](this[_0x1803('0x2')][_0x1803('0x27')]):this[_0x1803('0x8')]);};Action[_0x1803('0x29')][_0x1803('0x2a')]=function(){return this[_0x1803('0x9')];};module[_0x1803('0x2b')]=Action; \ No newline at end of file +var _0x84cb=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','Contact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x84cb,0xa5));var _0xb84c=function(_0x37e7a9,_0x248258){_0x37e7a9=_0x37e7a9-0x0;var _0x2fe1b8=_0x84cb[_0x37e7a9];return _0x2fe1b8;};'use strict';var util=require(_0xb84c('0x0'));var _=require(_0xb84c('0x1'));var moment=require('moment');function checkNameSurname(_0x8af3ed,_0x1d60ba,_0x433a36){var _0x2fc2c6='';if(!_['isNil'](_0x1d60ba)&&'string'===typeof _0x1d60ba){_0x2fc2c6+=_0x1d60ba;}if(!_[_0xb84c('0x2')](_0x433a36)&&_0xb84c('0x3')===typeof _0x433a36){_0x2fc2c6+='\x20'+_0x433a36;}if(_0x2fc2c6!==''){return _0x2fc2c6;}return _0x8af3ed;}function Action(_0xf556ee,_0x4970c2,_0x5a8319){this[_0xb84c('0x4')]=_0xf556ee;this[_0xb84c('0x5')]=_0x5a8319||undefined;this[_0xb84c('0x6')]=checkNameSurname(_0x4970c2['Contact']['phone'],_0x4970c2['Contact'][_0xb84c('0x7')],_0x4970c2['Contact'][_0xb84c('0x8')]);this[_0xb84c('0x9')]=_0x4970c2[_0xb84c('0xa')];this[_0xb84c('0xb')]=_0xf556ee[_0xb84c('0x6')];this[_0xb84c('0xc')]=_0x4970c2[_0xb84c('0xc')]||![];this['type']=_0xf556ee[_0xb84c('0xd')];this[_0xb84c('0xe')]=_0xf556ee[_0xb84c('0xe')]||0x3;this[_0xb84c('0xf')]=_0x4970c2[_0xb84c('0xf')];this[_0xb84c('0x10')]=_0x4970c2[_0xb84c('0x10')];this[_0xb84c('0x11')]=_0x4970c2['countcongestionretry'];this[_0xb84c('0x12')]=_0x4970c2[_0xb84c('0x12')];this['countnosuchnumberretry']=_0x4970c2[_0xb84c('0x13')];this[_0xb84c('0x14')]=_0x4970c2[_0xb84c('0x14')];this[_0xb84c('0x15')]=_0x4970c2[_0xb84c('0x15')];this[_0xb84c('0x16')]=_0x4970c2['countmachineretry'];this['countagentrejectretry']=_0x4970c2[_0xb84c('0x17')];this[_0xb84c('0x18')]=_0x4970c2[_0xb84c('0x18')];this['ListId']=_0x4970c2[_0xb84c('0x19')];this['UserId']=_0x4970c2[_0xb84c('0x1a')];this[_0xb84c('0x1b')]=_0x4970c2[_0xb84c('0x1b')];this[_0xb84c('0x1c')]=_0x4970c2['CampaignId'];this[_0xb84c('0x1d')]=_0x4970c2['id'];this[_0xb84c('0x1e')]=_0x4970c2[_0xb84c('0x1f')][_0xb84c('0x7')]||'';this[_0xb84c('0x20')]=moment()[_0xb84c('0x21')](_0xb84c('0x22'));this[_0xb84c('0x23')]=_0x4970c2[_0xb84c('0x23')];this[_0xb84c('0x24')]=_0x4970c2[_0xb84c('0x24')];this['callbackat']=_0x4970c2[_0xb84c('0x25')];this['recallme']=_0x4970c2[_0xb84c('0x26')];this['originatecalleridnum']='';this[_0xb84c('0x27')]='';}Action['prototype'][_0xb84c('0x28')]=function(){return util[_0xb84c('0x21')](_0xb84c('0x29'),this['name'],this['voiceQueue'][_0xb84c('0x2a')]>0x0?this[_0xb84c('0x9')][_0xb84c('0x2b')](this['voiceQueue'][_0xb84c('0x2a')]):this['number']);};Action['prototype'][_0xb84c('0x2c')]=function(){return this[_0xb84c('0xb')];};module[_0xb84c('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index f530e03..122820b 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d84=['statedesc','Answer','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state'];(function(_0xde4150,_0x5ca59d){var _0x31f571=function(_0x42db4a){while(--_0x42db4a){_0xde4150['push'](_0xde4150['shift']());}};_0x31f571(++_0x5ca59d);}(_0x4d84,0xad));var _0x44d8=function(_0x1120c7,_0x18f931){_0x1120c7=_0x1120c7-0x0;var _0x436f8a=_0x4d84[_0x1120c7];return _0x436f8a;};'use strict';var moment=require(_0x44d8('0x0'));var utils=require(_0x44d8('0x1'));function AgentComplete(_0xddbc90,_0x421920){this[_0x44d8('0x2')]=0x4;this[_0x44d8('0x3')]=_0x44d8('0x4');this['scheduledat']=_0xddbc90['scheduledat'];this['type']=_0xddbc90[_0x44d8('0x5')];this[_0x44d8('0x6')]=_0xddbc90[_0x44d8('0x5')]==='outbound'?_0x44d8('0x7'):_0xddbc90[_0x44d8('0x5')];this[_0x44d8('0x8')]=_0xddbc90[_0x44d8('0x8')];this[_0x44d8('0x9')]=_0xddbc90[_0x44d8('0x9')];this[_0x44d8('0xa')]=_0xddbc90[_0x44d8('0xa')];this['countglobal']=_0xddbc90[_0x44d8('0x8')]+_0xddbc90['countcongestionretry']+_0xddbc90[_0x44d8('0xa')]+_0xddbc90[_0x44d8('0xb')]+_0xddbc90[_0x44d8('0xc')]+_0xddbc90[_0x44d8('0xd')]+_0xddbc90['countmachineretry']+_0xddbc90[_0x44d8('0xe')];this[_0x44d8('0xb')]=_0xddbc90[_0x44d8('0xb')];this[_0x44d8('0xc')]=_0xddbc90[_0x44d8('0xc')];this[_0x44d8('0xd')]=_0xddbc90[_0x44d8('0xd')];this[_0x44d8('0xf')]=_0xddbc90[_0x44d8('0xf')];this[_0x44d8('0xe')]=_0xddbc90['countagentrejectretry'];this[_0x44d8('0x10')]=_0x421920[_0x44d8('0x10')];this[_0x44d8('0x11')]=_0xddbc90[_0x44d8('0x12')];this[_0x44d8('0x13')]=_0xddbc90[_0x44d8('0x14')];this[_0x44d8('0x15')]=_0xddbc90[_0x44d8('0x15')];this['responsetime']=_0xddbc90[_0x44d8('0x16')];this[_0x44d8('0x17')]=_0xddbc90['answertime'];this['endtime']=moment()[_0x44d8('0x18')](_0x44d8('0x19'));this[_0x44d8('0x1a')]=utils['getSeconds'](_0xddbc90[_0x44d8('0x16')],_0xddbc90['starttime']);this[_0x44d8('0x1b')]=utils[_0x44d8('0x1c')](_0xddbc90[_0x44d8('0x17')],_0xddbc90[_0x44d8('0x16')]);this['talktime']=utils['getSeconds'](this[_0x44d8('0x1d')],_0xddbc90[_0x44d8('0x17')]);this['queue']=_0x421920[_0x44d8('0x7')];this[_0x44d8('0x1e')]=_0x421920[_0x44d8('0x1e')];this[_0x44d8('0x1f')]=_0x421920[_0x44d8('0x1f')];this[_0x44d8('0x20')]=_0xddbc90[_0x44d8('0x20')];this[_0x44d8('0x21')]=_0xddbc90[_0x44d8('0x21')];this[_0x44d8('0x22')]=_0xddbc90[_0x44d8('0x22')];this['recallme']=_0xddbc90[_0x44d8('0x23')];this[_0x44d8('0x24')]=_0xddbc90[_0x44d8('0x24')];this[_0x44d8('0x25')]=_0xddbc90[_0x44d8('0x25')];this[_0x44d8('0x26')]=_0xddbc90[_0x44d8('0x26')];this[_0x44d8('0x27')]=_0xddbc90[_0x44d8('0x27')];this['CampaignId']=_0xddbc90[_0x44d8('0x28')];this[_0x44d8('0x29')]=_0xddbc90[_0x44d8('0x29')]||'';this[_0x44d8('0x2a')]=_0xddbc90['originatecalleridname']||'';this[_0x44d8('0x2b')]=_0xddbc90[_0x44d8('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x69b7=['countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry'];(function(_0x1aeb3f,_0x2ae595){var _0x427183=function(_0x2f56b9){while(--_0x2f56b9){_0x1aeb3f['push'](_0x1aeb3f['shift']());}};_0x427183(++_0x2ae595);}(_0x69b7,0x1c0));var _0x769b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x69b7[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x769b('0x0'));var utils=require(_0x769b('0x1'));function AgentComplete(_0x237473,_0x373a1d){this['state']=0x4;this[_0x769b('0x2')]=_0x769b('0x3');this[_0x769b('0x4')]=_0x237473['scheduledat'];this[_0x769b('0x5')]=_0x237473[_0x769b('0x5')];this[_0x769b('0x6')]=_0x237473[_0x769b('0x5')]==='outbound'?_0x769b('0x7'):_0x237473['type'];this[_0x769b('0x8')]=_0x237473['countbusyretry'];this[_0x769b('0x9')]=_0x237473[_0x769b('0x9')];this[_0x769b('0xa')]=_0x237473[_0x769b('0xa')];this[_0x769b('0xb')]=_0x237473['countbusyretry']+_0x237473[_0x769b('0x9')]+_0x237473[_0x769b('0xa')]+_0x237473['countnosuchnumberretry']+_0x237473[_0x769b('0xc')]+_0x237473['countabandonedretry']+_0x237473[_0x769b('0xd')]+_0x237473['countagentrejectretry'];this['countnosuchnumberretry']=_0x237473[_0x769b('0xe')];this[_0x769b('0xc')]=_0x237473[_0x769b('0xc')];this[_0x769b('0xf')]=_0x237473[_0x769b('0xf')];this[_0x769b('0xd')]=_0x237473[_0x769b('0xd')];this[_0x769b('0x10')]=_0x237473[_0x769b('0x10')];this[_0x769b('0x11')]=_0x373a1d['uniqueid'];this[_0x769b('0x12')]=_0x237473[_0x769b('0x13')];this['calleridnum']=_0x237473[_0x769b('0x14')];this[_0x769b('0x15')]=_0x237473[_0x769b('0x15')];this[_0x769b('0x16')]=_0x237473['responsetime'];this[_0x769b('0x17')]=_0x237473[_0x769b('0x17')];this[_0x769b('0x18')]=moment()[_0x769b('0x19')](_0x769b('0x1a'));this[_0x769b('0x1b')]=utils['getSeconds'](_0x237473['responsetime'],_0x237473['starttime']);this['holdtime']=utils[_0x769b('0x1c')](_0x237473[_0x769b('0x17')],_0x237473[_0x769b('0x16')]);this['talktime']=utils[_0x769b('0x1c')](this[_0x769b('0x18')],_0x237473[_0x769b('0x17')]);this[_0x769b('0x7')]=_0x373a1d[_0x769b('0x7')];this['membername']=_0x373a1d['membername'];this['reason']=_0x373a1d[_0x769b('0x1d')];this[_0x769b('0x1e')]=_0x237473[_0x769b('0x1e')];this[_0x769b('0x1f')]=_0x237473[_0x769b('0x1f')];this[_0x769b('0x20')]=_0x237473[_0x769b('0x20')];this[_0x769b('0x21')]=_0x237473[_0x769b('0x21')];this[_0x769b('0x22')]=_0x237473['ContactId'];this[_0x769b('0x23')]=_0x237473[_0x769b('0x23')];this['UserId']=_0x237473[_0x769b('0x24')];this[_0x769b('0x25')]=_0x237473['VoiceQueueId'];this[_0x769b('0x26')]=_0x237473[_0x769b('0x26')];this[_0x769b('0x27')]=_0x237473[_0x769b('0x27')]||'';this['originatecalleridname']=_0x237473[_0x769b('0x28')]||'';this[_0x769b('0x29')]=_0x237473[_0x769b('0x29')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index b0268cf..41ee874 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae2a=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x18cf50,_0x3d88f9){var _0x408c31=function(_0x57fe02){while(--_0x57fe02){_0x18cf50['push'](_0x18cf50['shift']());}};_0x408c31(++_0x3d88f9);}(_0xae2a,0x8b));var _0xaae2=function(_0x99f6a5,_0x3abde8){_0x99f6a5=_0x99f6a5-0x0;var _0x2e6bc4=_0xae2a[_0x99f6a5];return _0x2e6bc4;};'use strict';function Final(_0x52eae2){this[_0xaae2('0x0')]=_0x52eae2[_0xaae2('0x0')];this[_0xaae2('0x1')]=_0x52eae2[_0xaae2('0x1')];this[_0xaae2('0x2')]=_0x52eae2[_0xaae2('0x2')];this[_0xaae2('0x3')]=_0x52eae2[_0xaae2('0x2')]===_0xaae2('0x4')?_0xaae2('0x5'):_0x52eae2['type'];this['countbusyretry']=_0x52eae2[_0xaae2('0x6')];this[_0xaae2('0x7')]=_0x52eae2[_0xaae2('0x7')];this[_0xaae2('0x8')]=_0x52eae2[_0xaae2('0x8')];this[_0xaae2('0x9')]=_0x52eae2[_0xaae2('0x6')]+_0x52eae2[_0xaae2('0x7')]+_0x52eae2[_0xaae2('0x8')]+_0x52eae2[_0xaae2('0xa')]+_0x52eae2[_0xaae2('0xb')]+_0x52eae2[_0xaae2('0xc')]+_0x52eae2[_0xaae2('0xd')]+_0x52eae2[_0xaae2('0xe')];this[_0xaae2('0xa')]=_0x52eae2[_0xaae2('0xa')];this['countdropretry']=_0x52eae2[_0xaae2('0xb')];this[_0xaae2('0xc')]=_0x52eae2[_0xaae2('0xc')];this[_0xaae2('0xd')]=_0x52eae2[_0xaae2('0xd')];this[_0xaae2('0xe')]=_0x52eae2[_0xaae2('0xe')];this[_0xaae2('0x5')]=_0x52eae2[_0xaae2('0x5')];this[_0xaae2('0xf')]=_0x52eae2[_0xaae2('0xf')];this['calleridnum']=_0x52eae2[_0xaae2('0x10')];this[_0xaae2('0x11')]=_0x52eae2[_0xaae2('0x11')];this[_0xaae2('0x12')]=_0x52eae2[_0xaae2('0x12')];this[_0xaae2('0x13')]=_0x52eae2['responsetime'];this['ringtime']=_0x52eae2[_0xaae2('0x14')]||0x0;this['holdtime']=_0x52eae2[_0xaae2('0x15')]||0x0;this[_0xaae2('0x16')]=_0x52eae2['talktime']||0x0;this[_0xaae2('0x17')]=_0x52eae2[_0xaae2('0x17')];this[_0xaae2('0x18')]=_0x52eae2[_0xaae2('0x18')];this['callbackat']=_0x52eae2[_0xaae2('0x19')];this[_0xaae2('0x1a')]=_0x52eae2[_0xaae2('0x1a')];this[_0xaae2('0x1b')]=_0x52eae2[_0xaae2('0x1b')];this[_0xaae2('0x1c')]=_0x52eae2[_0xaae2('0x1c')];this['UserId']=_0x52eae2[_0xaae2('0x1d')];this[_0xaae2('0x1e')]=_0x52eae2[_0xaae2('0x1e')];this[_0xaae2('0x1f')]=_0x52eae2[_0xaae2('0x1f')];this[_0xaae2('0x20')]=_0x52eae2[_0xaae2('0x20')]||'';this['originatecalleridname']=_0x52eae2[_0xaae2('0x21')]||'';this['state']=_0x52eae2[_0xaae2('0x22')];this[_0xaae2('0x23')]=_0x52eae2[_0xaae2('0x23')];}module[_0xaae2('0x24')]=Final; \ No newline at end of file +var _0x5a9c=['state','statedesc','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x20ac37,_0x247531){var _0x3401e5=function(_0x55a04e){while(--_0x55a04e){_0x20ac37['push'](_0x20ac37['shift']());}};_0x3401e5(++_0x247531);}(_0x5a9c,0xac));var _0xc5a9=function(_0x460d7,_0x2df046){_0x460d7=_0x460d7-0x0;var _0x538359=_0x5a9c[_0x460d7];return _0x538359;};'use strict';function Final(_0x34600e){this[_0xc5a9('0x0')]=_0x34600e['uniqueid'];this[_0xc5a9('0x1')]=_0x34600e[_0xc5a9('0x1')];this[_0xc5a9('0x2')]=_0x34600e[_0xc5a9('0x2')];this[_0xc5a9('0x3')]=_0x34600e[_0xc5a9('0x2')]==='outbound'?'queue':_0x34600e[_0xc5a9('0x2')];this[_0xc5a9('0x4')]=_0x34600e[_0xc5a9('0x4')];this[_0xc5a9('0x5')]=_0x34600e[_0xc5a9('0x5')];this['countnoanswerretry']=_0x34600e[_0xc5a9('0x6')];this[_0xc5a9('0x7')]=_0x34600e['countbusyretry']+_0x34600e[_0xc5a9('0x5')]+_0x34600e[_0xc5a9('0x6')]+_0x34600e[_0xc5a9('0x8')]+_0x34600e[_0xc5a9('0x9')]+_0x34600e[_0xc5a9('0xa')]+_0x34600e[_0xc5a9('0xb')]+_0x34600e[_0xc5a9('0xc')];this[_0xc5a9('0x8')]=_0x34600e[_0xc5a9('0x8')];this[_0xc5a9('0x9')]=_0x34600e[_0xc5a9('0x9')];this[_0xc5a9('0xa')]=_0x34600e[_0xc5a9('0xa')];this['countmachineretry']=_0x34600e[_0xc5a9('0xb')];this[_0xc5a9('0xc')]=_0x34600e[_0xc5a9('0xc')];this['queue']=_0x34600e['queue'];this[_0xc5a9('0xd')]=_0x34600e[_0xc5a9('0xd')];this[_0xc5a9('0xe')]=_0x34600e['calleridnum'];this[_0xc5a9('0xf')]=_0x34600e[_0xc5a9('0xf')];this[_0xc5a9('0x10')]=_0x34600e['responsetime'];this[_0xc5a9('0x11')]=_0x34600e[_0xc5a9('0x10')];this[_0xc5a9('0x12')]=_0x34600e['ringtime']||0x0;this[_0xc5a9('0x13')]=_0x34600e[_0xc5a9('0x13')]||0x0;this[_0xc5a9('0x14')]=_0x34600e[_0xc5a9('0x14')]||0x0;this[_0xc5a9('0x15')]=_0x34600e[_0xc5a9('0x15')];this[_0xc5a9('0x16')]=_0x34600e[_0xc5a9('0x16')];this[_0xc5a9('0x17')]=_0x34600e[_0xc5a9('0x17')];this[_0xc5a9('0x18')]=_0x34600e['recallme'];this[_0xc5a9('0x19')]=_0x34600e[_0xc5a9('0x19')];this[_0xc5a9('0x1a')]=_0x34600e['ListId'];this['UserId']=_0x34600e[_0xc5a9('0x1b')];this[_0xc5a9('0x1c')]=_0x34600e[_0xc5a9('0x1c')];this['CampaignId']=_0x34600e[_0xc5a9('0x1d')];this[_0xc5a9('0x1e')]=_0x34600e[_0xc5a9('0x1e')]||'';this[_0xc5a9('0x1f')]=_0x34600e[_0xc5a9('0x1f')]||'';this[_0xc5a9('0x20')]=_0x34600e[_0xc5a9('0x20')];this[_0xc5a9('0x21')]=_0x34600e['statedesc'];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 43f03f7..6abb89c 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56ea=['countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','moment','../utils','state','statedesc','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x56ea,0x1dd));var _0xa56e=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x56ea[_0x4704dc];return _0x254d81;};'use strict';var moment=require(_0xa56e('0x0'));var utils=require(_0xa56e('0x1'));function Hangup(_0x5af2aa,_0x5b4c56){this[_0xa56e('0x2')]=0x4;this[_0xa56e('0x3')]='Answer';this[_0xa56e('0x4')]=_0x5af2aa[_0xa56e('0x4')];this[_0xa56e('0x5')]=_0x5af2aa['type'];this['campaigntype']=_0x5af2aa[_0xa56e('0x5')]==='outbound'?_0xa56e('0x6'):_0x5af2aa[_0xa56e('0x5')];this[_0xa56e('0x7')]=_0x5af2aa['amd']||![];this[_0xa56e('0x8')]=_0x5af2aa[_0xa56e('0x8')];this[_0xa56e('0x9')]=_0x5af2aa[_0xa56e('0x9')];this[_0xa56e('0xa')]=_0x5af2aa[_0xa56e('0xa')];this[_0xa56e('0xb')]=_0x5af2aa[_0xa56e('0x8')]+_0x5af2aa[_0xa56e('0x9')]+_0x5af2aa['countnoanswerretry']+_0x5af2aa['countnosuchnumberretry']+_0x5af2aa[_0xa56e('0xc')]+_0x5af2aa['countabandonedretry']+_0x5af2aa['countmachineretry']+_0x5af2aa[_0xa56e('0xd')];this[_0xa56e('0xe')]=_0x5af2aa['countnosuchnumberretry'];this[_0xa56e('0xc')]=_0x5af2aa[_0xa56e('0xc')];this[_0xa56e('0xf')]=_0x5af2aa[_0xa56e('0xf')];this[_0xa56e('0x10')]=_0x5af2aa[_0xa56e('0x10')];this[_0xa56e('0xd')]=_0x5af2aa['countagentrejectretry'];this[_0xa56e('0x11')]=_0x5b4c56['uniqueid'];this[_0xa56e('0x12')]=_0x5af2aa[_0xa56e('0x13')];this[_0xa56e('0x14')]=_0x5af2aa[_0xa56e('0x15')];this[_0xa56e('0x16')]=_0x5af2aa[_0xa56e('0x16')];this[_0xa56e('0x17')]=_0x5af2aa[_0xa56e('0x17')];this[_0xa56e('0x18')]=moment()[_0xa56e('0x19')](_0xa56e('0x1a'));this[_0xa56e('0x1b')]=utils[_0xa56e('0x1c')](_0x5af2aa[_0xa56e('0x17')],_0x5af2aa[_0xa56e('0x16')]);this[_0xa56e('0x1d')]=0x0;this[_0xa56e('0x1e')]=utils[_0xa56e('0x1c')](this[_0xa56e('0x18')],_0x5af2aa[_0xa56e('0x17')]);this['queue']=_0x5af2aa[_0xa56e('0x6')];this[_0xa56e('0x1f')]='IVR';this[_0xa56e('0x20')]=_0x5b4c56[_0xa56e('0x21')];this['callback']=_0x5af2aa[_0xa56e('0x22')];this[_0xa56e('0x23')]=_0x5af2aa[_0xa56e('0x23')];this[_0xa56e('0x24')]=_0x5af2aa[_0xa56e('0x24')];this[_0xa56e('0x25')]=_0x5af2aa[_0xa56e('0x25')];this[_0xa56e('0x26')]=_0x5af2aa[_0xa56e('0x26')];this['ListId']=_0x5af2aa['ListId'];this[_0xa56e('0x27')]=_0x5af2aa[_0xa56e('0x27')];this['VoiceQueueId']=_0x5af2aa[_0xa56e('0x28')];this['CampaignId']=_0x5af2aa['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x3901=['IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime'];(function(_0x3562e0,_0x161e2c){var _0x4d746e=function(_0x8572a3){while(--_0x8572a3){_0x3562e0['push'](_0x3562e0['shift']());}};_0x4d746e(++_0x161e2c);}(_0x3901,0x1cf));var _0x1390=function(_0x32a773,_0x57b5c7){_0x32a773=_0x32a773-0x0;var _0x430dcb=_0x3901[_0x32a773];return _0x430dcb;};'use strict';var moment=require('moment');var utils=require(_0x1390('0x0'));function Hangup(_0x293c4a,_0x2bb023){this[_0x1390('0x1')]=0x4;this['statedesc']=_0x1390('0x2');this[_0x1390('0x3')]=_0x293c4a[_0x1390('0x3')];this['type']=_0x293c4a[_0x1390('0x4')];this[_0x1390('0x5')]=_0x293c4a[_0x1390('0x4')]==='outbound'?_0x1390('0x6'):_0x293c4a[_0x1390('0x4')];this[_0x1390('0x7')]=_0x293c4a[_0x1390('0x7')]||![];this[_0x1390('0x8')]=_0x293c4a[_0x1390('0x8')];this[_0x1390('0x9')]=_0x293c4a[_0x1390('0x9')];this[_0x1390('0xa')]=_0x293c4a[_0x1390('0xa')];this[_0x1390('0xb')]=_0x293c4a[_0x1390('0x8')]+_0x293c4a[_0x1390('0x9')]+_0x293c4a[_0x1390('0xa')]+_0x293c4a['countnosuchnumberretry']+_0x293c4a[_0x1390('0xc')]+_0x293c4a[_0x1390('0xd')]+_0x293c4a[_0x1390('0xe')]+_0x293c4a['countagentrejectretry'];this[_0x1390('0xf')]=_0x293c4a['countnosuchnumberretry'];this['countdropretry']=_0x293c4a['countdropretry'];this[_0x1390('0xd')]=_0x293c4a[_0x1390('0xd')];this[_0x1390('0xe')]=_0x293c4a[_0x1390('0xe')];this[_0x1390('0x10')]=_0x293c4a[_0x1390('0x10')];this[_0x1390('0x11')]=_0x2bb023[_0x1390('0x11')];this[_0x1390('0x12')]=_0x293c4a[_0x1390('0x13')];this[_0x1390('0x14')]=_0x293c4a['number'];this[_0x1390('0x15')]=_0x293c4a[_0x1390('0x15')];this[_0x1390('0x16')]=_0x293c4a[_0x1390('0x16')];this[_0x1390('0x17')]=moment()[_0x1390('0x18')](_0x1390('0x19'));this[_0x1390('0x1a')]=utils[_0x1390('0x1b')](_0x293c4a[_0x1390('0x16')],_0x293c4a[_0x1390('0x15')]);this[_0x1390('0x1c')]=0x0;this['talktime']=utils[_0x1390('0x1b')](this[_0x1390('0x17')],_0x293c4a[_0x1390('0x16')]);this[_0x1390('0x6')]=_0x293c4a['queue'];this['membername']=_0x1390('0x1d');this[_0x1390('0x1e')]=_0x2bb023['cause-txt'];this[_0x1390('0x1f')]=_0x293c4a[_0x1390('0x1f')];this[_0x1390('0x20')]=_0x293c4a['callbackuniqueid'];this[_0x1390('0x21')]=_0x293c4a[_0x1390('0x21')];this[_0x1390('0x22')]=_0x293c4a[_0x1390('0x22')];this[_0x1390('0x23')]=_0x293c4a[_0x1390('0x23')];this[_0x1390('0x24')]=_0x293c4a[_0x1390('0x24')];this[_0x1390('0x25')]=_0x293c4a['UserId'];this['VoiceQueueId']=_0x293c4a[_0x1390('0x26')];this[_0x1390('0x27')]=_0x293c4a['CampaignId'];}module[_0x1390('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 8139f56..6451969 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ddf=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x38003c,_0x374f5e){var _0x2762f2=function(_0x129496){while(--_0x129496){_0x38003c['push'](_0x38003c['shift']());}};_0x2762f2(++_0x374f5e);}(_0x8ddf,0x139));var _0xf8dd=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x8ddf[_0x1ae5ab];return _0x1ce001;};'use strict';var utils=require(_0xf8dd('0x0'));function History(_0x5ee3c7){this[_0xf8dd('0x1')]=_0x5ee3c7[_0xf8dd('0x1')];this[_0xf8dd('0x2')]=_0x5ee3c7[_0xf8dd('0x2')]||undefined;this[_0xf8dd('0x3')]=_0x5ee3c7['type'];this[_0xf8dd('0x4')]=_0x5ee3c7['type']===_0xf8dd('0x5')?'queue':_0x5ee3c7[_0xf8dd('0x3')];this['countbusyretry']=_0x5ee3c7[_0xf8dd('0x6')];this['countcongestionretry']=_0x5ee3c7[_0xf8dd('0x7')];this[_0xf8dd('0x8')]=_0x5ee3c7[_0xf8dd('0x8')];this[_0xf8dd('0x9')]=_0x5ee3c7[_0xf8dd('0x6')]+_0x5ee3c7[_0xf8dd('0x7')]+_0x5ee3c7['countnoanswerretry']+_0x5ee3c7[_0xf8dd('0xa')]+_0x5ee3c7[_0xf8dd('0xb')]+_0x5ee3c7[_0xf8dd('0xc')]+_0x5ee3c7[_0xf8dd('0xd')]+_0x5ee3c7[_0xf8dd('0xe')];this[_0xf8dd('0xa')]=_0x5ee3c7['countnosuchnumberretry'];this['countdropretry']=_0x5ee3c7[_0xf8dd('0xb')];this[_0xf8dd('0xc')]=_0x5ee3c7[_0xf8dd('0xc')];this[_0xf8dd('0xd')]=_0x5ee3c7[_0xf8dd('0xd')];this[_0xf8dd('0xe')]=_0x5ee3c7['countagentrejectretry'];this[_0xf8dd('0xf')]=_0x5ee3c7[_0xf8dd('0xf')];this[_0xf8dd('0x10')]=_0x5ee3c7['name'];this[_0xf8dd('0x11')]=_0x5ee3c7['number'];this[_0xf8dd('0x12')]=_0x5ee3c7[_0xf8dd('0x12')];this[_0xf8dd('0x13')]=_0x5ee3c7[_0xf8dd('0x13')];this[_0xf8dd('0x14')]=_0x5ee3c7['responsetime'];this[_0xf8dd('0x15')]=utils[_0xf8dd('0x16')](_0x5ee3c7[_0xf8dd('0x13')],_0x5ee3c7['starttime']);this['holdtime']=0x0;this[_0xf8dd('0x17')]=0x0;this[_0xf8dd('0x18')]=_0x5ee3c7[_0xf8dd('0x18')];this[_0xf8dd('0x19')]=_0x5ee3c7[_0xf8dd('0x19')];this[_0xf8dd('0x1a')]=_0x5ee3c7[_0xf8dd('0x1a')];this[_0xf8dd('0x1b')]=_0x5ee3c7[_0xf8dd('0x1b')];this['ContactId']=_0x5ee3c7[_0xf8dd('0x1c')];this[_0xf8dd('0x1d')]=_0x5ee3c7['ListId'];this[_0xf8dd('0x1e')]=_0x5ee3c7[_0xf8dd('0x1e')];this[_0xf8dd('0x1f')]=_0x5ee3c7[_0xf8dd('0x1f')];this[_0xf8dd('0x20')]=_0x5ee3c7[_0xf8dd('0x20')];this[_0xf8dd('0x21')]=_0x5ee3c7[_0xf8dd('0x21')]||'';this[_0xf8dd('0x22')]=_0x5ee3c7[_0xf8dd('0x22')]||'';this['state']=_0x5ee3c7[_0xf8dd('0x23')];this[_0xf8dd('0x24')]=_0x5ee3c7['statedesc'];}module[_0xf8dd('0x25')]=History; \ No newline at end of file +var _0x0e5c=['calleridname','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue'];(function(_0x330fd1,_0x219869){var _0x2f3fea=function(_0x2fb134){while(--_0x2fb134){_0x330fd1['push'](_0x330fd1['shift']());}};_0x2f3fea(++_0x219869);}(_0x0e5c,0x1ad));var _0xc0e5=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0x0e5c[_0x3cc05d];return _0x28b736;};'use strict';var utils=require(_0xc0e5('0x0'));function History(_0x532331){this['uniqueid']=_0x532331['uniqueid'];this[_0xc0e5('0x1')]=_0x532331['scheduledat']||undefined;this[_0xc0e5('0x2')]=_0x532331[_0xc0e5('0x2')];this[_0xc0e5('0x3')]=_0x532331['type']===_0xc0e5('0x4')?'queue':_0x532331[_0xc0e5('0x2')];this[_0xc0e5('0x5')]=_0x532331[_0xc0e5('0x5')];this[_0xc0e5('0x6')]=_0x532331['countcongestionretry'];this[_0xc0e5('0x7')]=_0x532331[_0xc0e5('0x7')];this[_0xc0e5('0x8')]=_0x532331[_0xc0e5('0x5')]+_0x532331['countcongestionretry']+_0x532331['countnoanswerretry']+_0x532331[_0xc0e5('0x9')]+_0x532331[_0xc0e5('0xa')]+_0x532331[_0xc0e5('0xb')]+_0x532331[_0xc0e5('0xc')]+_0x532331[_0xc0e5('0xd')];this['countnosuchnumberretry']=_0x532331[_0xc0e5('0x9')];this['countdropretry']=_0x532331['countdropretry'];this[_0xc0e5('0xb')]=_0x532331[_0xc0e5('0xb')];this[_0xc0e5('0xc')]=_0x532331[_0xc0e5('0xc')];this[_0xc0e5('0xd')]=_0x532331[_0xc0e5('0xd')];this[_0xc0e5('0xe')]=_0x532331[_0xc0e5('0xe')];this[_0xc0e5('0xf')]=_0x532331['name'];this['calleridnum']=_0x532331[_0xc0e5('0x10')];this[_0xc0e5('0x11')]=_0x532331['starttime'];this[_0xc0e5('0x12')]=_0x532331[_0xc0e5('0x12')];this[_0xc0e5('0x13')]=_0x532331[_0xc0e5('0x12')];this[_0xc0e5('0x14')]=utils['getSeconds'](_0x532331[_0xc0e5('0x12')],_0x532331[_0xc0e5('0x11')]);this[_0xc0e5('0x15')]=0x0;this[_0xc0e5('0x16')]=0x0;this[_0xc0e5('0x17')]=_0x532331[_0xc0e5('0x17')];this[_0xc0e5('0x18')]=_0x532331[_0xc0e5('0x18')];this[_0xc0e5('0x19')]=_0x532331[_0xc0e5('0x19')];this['recallme']=_0x532331[_0xc0e5('0x1a')];this[_0xc0e5('0x1b')]=_0x532331[_0xc0e5('0x1b')];this[_0xc0e5('0x1c')]=_0x532331[_0xc0e5('0x1c')];this[_0xc0e5('0x1d')]=_0x532331[_0xc0e5('0x1d')];this[_0xc0e5('0x1e')]=_0x532331['VoiceQueueId'];this[_0xc0e5('0x1f')]=_0x532331[_0xc0e5('0x1f')];this[_0xc0e5('0x20')]=_0x532331[_0xc0e5('0x20')]||'';this[_0xc0e5('0x21')]=_0x532331['originatecalleridname']||'';this[_0xc0e5('0x22')]=_0x532331['state'];this[_0xc0e5('0x23')]=_0x532331[_0xc0e5('0x23')];}module[_0xc0e5('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index ce3d7f1..2c67447 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88fe=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue'];(function(_0x29579f,_0x2b98ea){var _0x36cb5a=function(_0x3378fb){while(--_0x3378fb){_0x29579f['push'](_0x29579f['shift']());}};_0x36cb5a(++_0x2b98ea);}(_0x88fe,0x14a));var _0xe88f=function(_0x7450d2,_0x46afc8){_0x7450d2=_0x7450d2-0x0;var _0x5987aa=_0x88fe[_0x7450d2];return _0x5987aa;};'use strict';var utils=require(_0xe88f('0x0'));function QueueCallerAbandon(_0x1065ba,_0x1bf7ab){this[_0xe88f('0x1')]=_0x1065ba['scheduledat'];this[_0xe88f('0x2')]=_0x1065ba['type'];this[_0xe88f('0x3')]=_0x1065ba[_0xe88f('0x2')]===_0xe88f('0x4')?_0xe88f('0x5'):_0x1065ba['type'];this[_0xe88f('0x6')]=_0x1065ba[_0xe88f('0x6')];this[_0xe88f('0x7')]=_0x1065ba[_0xe88f('0x7')];this[_0xe88f('0x8')]=_0x1065ba[_0xe88f('0x8')];this[_0xe88f('0x9')]=_0x1065ba['countbusyretry']+_0x1065ba[_0xe88f('0x7')]+_0x1065ba['countnoanswerretry']+_0x1065ba[_0xe88f('0xa')]+_0x1065ba['countdropretry']+_0x1065ba[_0xe88f('0xb')]+_0x1065ba[_0xe88f('0xc')]+_0x1065ba['countagentrejectretry'];this['countnosuchnumberretry']=_0x1065ba[_0xe88f('0xa')];this[_0xe88f('0xd')]=_0x1065ba[_0xe88f('0xd')];this[_0xe88f('0xb')]=_0x1065ba[_0xe88f('0xb')];this[_0xe88f('0xc')]=_0x1065ba[_0xe88f('0xc')];this[_0xe88f('0xe')]=_0x1065ba[_0xe88f('0xe')];this[_0xe88f('0xf')]=_0x1bf7ab[_0xe88f('0xf')];this[_0xe88f('0x10')]=_0x1065ba[_0xe88f('0x11')];this[_0xe88f('0x12')]=_0x1065ba[_0xe88f('0x13')];this[_0xe88f('0x14')]=_0x1065ba['starttime'];this['responsetime']=_0x1065ba[_0xe88f('0x15')];this[_0xe88f('0x16')]=_0x1065ba[_0xe88f('0x16')];this[_0xe88f('0x17')]=_0x1065ba[_0xe88f('0x17')];this['endtime']=this[_0xe88f('0x16')];this['ringtime']=utils[_0xe88f('0x18')](_0x1065ba[_0xe88f('0x15')],_0x1065ba[_0xe88f('0x14')]);this[_0xe88f('0x19')]=utils[_0xe88f('0x18')](this[_0xe88f('0x16')],_0x1065ba[_0xe88f('0x15')]);this[_0xe88f('0x1a')]=0x0;this[_0xe88f('0x5')]=_0x1bf7ab[_0xe88f('0x5')];this[_0xe88f('0x1b')]=_0x1bf7ab['connectedlinename'];this[_0xe88f('0x1c')]=_0x1bf7ab['reason'];this[_0xe88f('0x1d')]=_0x1065ba[_0xe88f('0x1d')];this[_0xe88f('0x1e')]=_0x1065ba[_0xe88f('0x1e')];this[_0xe88f('0x1f')]=_0x1065ba[_0xe88f('0x1f')];this['recallme']=_0x1065ba['recallme'];this[_0xe88f('0x20')]=_0x1065ba['ContactId'];this[_0xe88f('0x21')]=_0x1065ba['ListId'];this[_0xe88f('0x22')]=_0x1065ba['UserId'];this[_0xe88f('0x23')]=_0x1065ba[_0xe88f('0x23')];this[_0xe88f('0x24')]=_0x1065ba[_0xe88f('0x24')];this['originatecalleridnum']=_0x1065ba[_0xe88f('0x25')]||'';this[_0xe88f('0x26')]=_0x1065ba[_0xe88f('0x26')]||'';this[_0xe88f('0x27')]=_0x1065ba[_0xe88f('0x27')];this[_0xe88f('0x28')]=_0x1065ba[_0xe88f('0x28')];this[_0xe88f('0x29')]=_0x1065ba[_0xe88f('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xe593=['exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc'];(function(_0x412ff1,_0x2741d5){var _0x25955=function(_0x51509e){while(--_0x51509e){_0x412ff1['push'](_0x412ff1['shift']());}};_0x25955(++_0x2741d5);}(_0xe593,0x85));var _0x3e59=function(_0x515dd4,_0x2cfd51){_0x515dd4=_0x515dd4-0x0;var _0x50465d=_0xe593[_0x515dd4];return _0x50465d;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x118b8b,_0x27ab8e){this['scheduledat']=_0x118b8b[_0x3e59('0x0')];this[_0x3e59('0x1')]=_0x118b8b[_0x3e59('0x1')];this[_0x3e59('0x2')]=_0x118b8b[_0x3e59('0x1')]===_0x3e59('0x3')?_0x3e59('0x4'):_0x118b8b['type'];this[_0x3e59('0x5')]=_0x118b8b[_0x3e59('0x5')];this[_0x3e59('0x6')]=_0x118b8b[_0x3e59('0x6')];this[_0x3e59('0x7')]=_0x118b8b[_0x3e59('0x7')];this[_0x3e59('0x8')]=_0x118b8b[_0x3e59('0x5')]+_0x118b8b['countcongestionretry']+_0x118b8b[_0x3e59('0x7')]+_0x118b8b[_0x3e59('0x9')]+_0x118b8b[_0x3e59('0xa')]+_0x118b8b[_0x3e59('0xb')]+_0x118b8b['countmachineretry']+_0x118b8b[_0x3e59('0xc')];this['countnosuchnumberretry']=_0x118b8b[_0x3e59('0x9')];this['countdropretry']=_0x118b8b[_0x3e59('0xa')];this[_0x3e59('0xb')]=_0x118b8b['countabandonedretry'];this['countmachineretry']=_0x118b8b[_0x3e59('0xd')];this[_0x3e59('0xc')]=_0x118b8b[_0x3e59('0xc')];this[_0x3e59('0xe')]=_0x27ab8e[_0x3e59('0xe')];this[_0x3e59('0xf')]=_0x118b8b[_0x3e59('0x10')];this[_0x3e59('0x11')]=_0x118b8b[_0x3e59('0x12')];this[_0x3e59('0x13')]=_0x118b8b[_0x3e59('0x13')];this[_0x3e59('0x14')]=_0x118b8b['responsetime'];this['droptime']=_0x118b8b[_0x3e59('0x15')];this['dropreason']=_0x118b8b['dropreason'];this[_0x3e59('0x16')]=this['droptime'];this['ringtime']=utils[_0x3e59('0x17')](_0x118b8b[_0x3e59('0x14')],_0x118b8b[_0x3e59('0x13')]);this[_0x3e59('0x18')]=utils['getSeconds'](this[_0x3e59('0x15')],_0x118b8b[_0x3e59('0x14')]);this[_0x3e59('0x19')]=0x0;this[_0x3e59('0x4')]=_0x27ab8e[_0x3e59('0x4')];this[_0x3e59('0x1a')]=_0x27ab8e[_0x3e59('0x1b')];this['reason']=_0x27ab8e[_0x3e59('0x1c')];this[_0x3e59('0x1d')]=_0x118b8b[_0x3e59('0x1d')];this[_0x3e59('0x1e')]=_0x118b8b[_0x3e59('0x1e')];this['callbackat']=_0x118b8b[_0x3e59('0x1f')];this[_0x3e59('0x20')]=_0x118b8b['recallme'];this['ContactId']=_0x118b8b[_0x3e59('0x21')];this[_0x3e59('0x22')]=_0x118b8b[_0x3e59('0x22')];this['UserId']=_0x118b8b[_0x3e59('0x23')];this[_0x3e59('0x24')]=_0x118b8b['VoiceQueueId'];this[_0x3e59('0x25')]=_0x118b8b[_0x3e59('0x25')];this[_0x3e59('0x26')]=_0x118b8b[_0x3e59('0x26')]||'';this[_0x3e59('0x27')]=_0x118b8b[_0x3e59('0x27')]||'';this['agiafterat']=_0x118b8b[_0x3e59('0x28')];this[_0x3e59('0x29')]=_0x118b8b['state'];this[_0x3e59('0x2a')]=_0x118b8b[_0x3e59('0x2a')];}module[_0x3e59('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 392c192..14c1c3e 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ace=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','getContactDialerIvr','catch','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','error','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x8ace[_0xb29bef];return _0x878163;};'use strict';var util=require(_0xe8ac('0x0'));var logger=require(_0xe8ac('0x1'))(_0xe8ac('0x2'));var cmHopper=require(_0xe8ac('0x3'));var cmHopperAdditionalPhone=require(_0xe8ac('0x4'));var cmHopperBlack=require(_0xe8ac('0x5'));var cmHopperHistory=require(_0xe8ac('0x6'));function inspectError(_0x274d7d){return util[_0xe8ac('0x7')](_0x274d7d,{'showHidden':![],'depth':null});}function getContactDialer(_0xf6af00,_0x199794,_0x224fc8){return cmHopper[_0xe8ac('0x8')](_0xf6af00['id'],_0x199794,_0x224fc8,_0xf6af00[_0xe8ac('0x9')])['catch'](function(_0x2d56f0){_0xf6af00[_0xe8ac('0xa')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x2d56f0));});}exports[_0xe8ac('0x8')]=getContactDialer;function getContactDialerIvr(_0x513793,_0x1b5467){return cmHopper[_0xe8ac('0xb')](_0x513793['id'],_0x1b5467,_0x513793[_0xe8ac('0x9')])[_0xe8ac('0xc')](function(_0xa18ae1){_0x513793[_0xe8ac('0xa')]=0x0;logger['error'](_0xe8ac('0xd'),inspectError(_0xa18ae1));});}exports[_0xe8ac('0xb')]=getContactDialerIvr;function countReScheduled(_0x1f71ff){return cmHopper['countReScheduled'](_0x1f71ff)[_0xe8ac('0xc')](function(_0x4735cb){logger['error'](_0xe8ac('0xe'),inspectError(_0x4735cb));});}exports[_0xe8ac('0xf')]=countReScheduled;function rescheduleContact(_0x383fe0){return cmHopper[_0xe8ac('0x10')](_0x383fe0)[_0xe8ac('0xc')](function(_0x317078){logger[_0xe8ac('0x11')](_0xe8ac('0x12'),inspectError(_0x317078));});}exports[_0xe8ac('0x10')]=rescheduleContact;function unlockContact(_0x369d36,_0x5e4495,_0x224bda){return cmHopper[_0xe8ac('0x13')](_0x369d36,_0x5e4495,_0x224bda)['catch'](function(_0xf219c){logger[_0xe8ac('0x11')](_0xe8ac('0x14'),inspectError(_0xf219c));});}exports[_0xe8ac('0x13')]=unlockContact;function moveContactManagedDialer(_0x25d219){return cmHopper[_0xe8ac('0x15')](_0x25d219)['catch'](function(_0x59df3d){logger['error'](_0xe8ac('0x16'),inspectError(_0x59df3d));});}exports[_0xe8ac('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x4e5d00){return cmHopperBlack[_0xe8ac('0x17')](_0x4e5d00)['catch'](function(_0xae385f){logger[_0xe8ac('0x11')]('[checkIsBlackList]',inspectError(_0xae385f));});}exports[_0xe8ac('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x169929){return cmHopperBlack[_0xe8ac('0x18')](_0x169929)[_0xe8ac('0xc')](function(_0x5c492c){logger[_0xe8ac('0x11')]('[checkIsBlackListIvr]',inspectError(_0x5c492c));});}exports[_0xe8ac('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3933d2,_0x3c3a78,_0x252440){return cmHopperAdditionalPhone[_0xe8ac('0x19')](_0x3933d2,_0x3c3a78,_0x252440)[_0xe8ac('0xc')](function(_0x38565d){logger['error'](_0xe8ac('0x1a'),inspectError(_0x38565d));});}exports[_0xe8ac('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x183dbf,_0x7c3450,_0x340ae0){return cmHopperAdditionalPhone[_0xe8ac('0x1b')](_0x183dbf,_0x7c3450,_0x340ae0)[_0xe8ac('0xc')](function(_0x3e3fc2){logger[_0xe8ac('0x11')]('[swapAdditionalPhone]',inspectError(_0x3e3fc2));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x346dcb){return cmHopperHistory[_0xe8ac('0x1c')](_0x346dcb)['catch'](function(_0x2a78c6){logger[_0xe8ac('0x11')]('[avgHandleTime]',inspectError(_0x2a78c6));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x1f1e44){return cmHopperHistory[_0xe8ac('0x1d')](_0x1f1e44)[_0xe8ac('0xc')](function(_0x5d7562){logger[_0xe8ac('0x11')](_0xe8ac('0x1e'),inspectError(_0x5d7562));});}exports[_0xe8ac('0x1d')]=createHistory; \ No newline at end of file +var _0x0295=['getContactDialerIvr','temp','[getContactDialerIvr]','rescheduleContact','error','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopper','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','[getContactDialer]'];(function(_0x1e9d0d,_0x191c26){var _0x21ac76=function(_0x1f6cc1){while(--_0x1f6cc1){_0x1e9d0d['push'](_0x1e9d0d['shift']());}};_0x21ac76(++_0x191c26);}(_0x0295,0x1f0));var _0x5029=function(_0x22b6a3,_0x1c3f7b){_0x22b6a3=_0x22b6a3-0x0;var _0x2d4f3b=_0x0295[_0x22b6a3];return _0x2d4f3b;};'use strict';var util=require(_0x5029('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0x5029('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5029('0x2'));function inspectError(_0x36335d){return util[_0x5029('0x3')](_0x36335d,{'showHidden':![],'depth':null});}function getContactDialer(_0x3d0af1,_0x170504,_0x69a497){return cmHopper[_0x5029('0x4')](_0x3d0af1['id'],_0x170504,_0x69a497,_0x3d0af1[_0x5029('0x5')])[_0x5029('0x6')](function(_0x502a62){_0x3d0af1['temp']=0x0;logger['error'](_0x5029('0x7'),inspectError(_0x502a62));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1532e9,_0x5bccfc){return cmHopper[_0x5029('0x8')](_0x1532e9['id'],_0x5bccfc,_0x1532e9['dialOrderByScheduledAt'])[_0x5029('0x6')](function(_0x22cfb4){_0x1532e9[_0x5029('0x9')]=0x0;logger['error'](_0x5029('0xa'),inspectError(_0x22cfb4));});}exports[_0x5029('0x8')]=getContactDialerIvr;function countReScheduled(_0x3fe6d1){return cmHopper['countReScheduled'](_0x3fe6d1)[_0x5029('0x6')](function(_0x2442b2){logger['error']('[countReScheduled]',inspectError(_0x2442b2));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x4aebb6){return cmHopper[_0x5029('0xb')](_0x4aebb6)[_0x5029('0x6')](function(_0x12c237){logger[_0x5029('0xc')](_0x5029('0xd'),inspectError(_0x12c237));});}exports[_0x5029('0xb')]=rescheduleContact;function unlockContact(_0xe278b7,_0x317c20,_0x10bf55){return cmHopper[_0x5029('0xe')](_0xe278b7,_0x317c20,_0x10bf55)[_0x5029('0x6')](function(_0x353cba){logger[_0x5029('0xc')](_0x5029('0xf'),inspectError(_0x353cba));});}exports[_0x5029('0xe')]=unlockContact;function moveContactManagedDialer(_0x4f7ab4){return cmHopper[_0x5029('0x10')](_0x4f7ab4)[_0x5029('0x6')](function(_0x35de81){logger[_0x5029('0xc')](_0x5029('0x11'),inspectError(_0x35de81));});}exports[_0x5029('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0xaba461){return cmHopperBlack['checkIsBlackList'](_0xaba461)[_0x5029('0x6')](function(_0x5696b1){logger[_0x5029('0xc')](_0x5029('0x12'),inspectError(_0x5696b1));});}exports[_0x5029('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x3cf0fb){return cmHopperBlack['checkIsBlackListIvr'](_0x3cf0fb)['catch'](function(_0x4c9184){logger['error'](_0x5029('0x14'),inspectError(_0x4c9184));});}exports[_0x5029('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1eb228,_0x2bbbcb,_0x16bd22){return cmHopperAdditionalPhone[_0x5029('0x16')](_0x1eb228,_0x2bbbcb,_0x16bd22)[_0x5029('0x6')](function(_0x356dac){logger[_0x5029('0xc')]('[verifyAdditionalPhone]',inspectError(_0x356dac));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x49f347,_0x588d90,_0x45666c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x49f347,_0x588d90,_0x45666c)['catch'](function(_0x181da0){logger[_0x5029('0xc')](_0x5029('0x17'),inspectError(_0x181da0));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x2c501f){return cmHopperHistory[_0x5029('0x18')](_0x2c501f)['catch'](function(_0x2b6d99){logger[_0x5029('0xc')](_0x5029('0x19'),inspectError(_0x2b6d99));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x32da06){return cmHopperHistory[_0x5029('0x1a')](_0x32da06)[_0x5029('0x6')](function(_0x4b6f92){logger[_0x5029('0xc')](_0x5029('0x1b'),inspectError(_0x4b6f92));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 24a6267..23c67d4 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0414=['AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','TrunkBackup','includes','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','timezones','ACTIVE','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED'];(function(_0x1958be,_0x58482e){var _0x4dcf1b=function(_0x4b21ff){while(--_0x4b21ff){_0x1958be['push'](_0x1958be['shift']());}};_0x4dcf1b(++_0x58482e);}(_0x0414,0x1e1));var _0x4041=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x0414[_0x35485a];return _0x5148e6;};'use strict';var _=require(_0x4041('0x0'));var moment=require(_0x4041('0x1'));var util=require(_0x4041('0x2'));var logger=require(_0x4041('0x3'))('dialer');var timezones=require('../../../../config/environment/shared')[_0x4041('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x4041('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x4041('0x6'),'DISACTIVED':_0x4041('0x7'),'EMPTY_INTERVAL':_0x4041('0x8'),'INACTIVE':_0x4041('0x9'),'NO_AGENTS_LOGGED':_0x4041('0xa'),'NO_AVAILABLE_CONTACTS':_0x4041('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x4041('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x4041('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x4041('0xe'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x4041('0xf')};exports[_0x4041('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2cbc9f){return _0x2cbc9f[_0x4041('0x11')]==='preview';}exports[_0x4041('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x189d5f){return _0x189d5f['type']==='ivr';}exports[_0x4041('0x13')]=isIVRCampaign;function isOutboundQueue(_0x47a5a5){return _0x47a5a5[_0x4041('0x14')]===_0x4041('0x15');}exports[_0x4041('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x46ffbc){return _0x46ffbc[_0x4041('0x17')];}exports[_0x4041('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x37abe4){return _0x37abe4[_0x4041('0x19')];}exports[_0x4041('0x1a')]=isIVRCampaignActive;function getSeconds(_0xe59c3e,_0x378743){var _0x4150a9=moment(_0xe59c3e)[_0x4041('0x1b')](0x0);var _0x27fa2f=moment(_0x378743)[_0x4041('0x1b')](0x0);return _0x4150a9[_0x4041('0x1c')](_0x27fa2f,_0x4041('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x426aec,_0x5e7d9b){var _0x2da122=![];var _0x2600fa=_0x426aec[_0x4041('0x11')]!==_0x5e7d9b['dialMethod']||_0x426aec[_0x4041('0x17')]!==_0x5e7d9b[_0x4041('0x17')]||_0x426aec['message']!==_0x5e7d9b['message'];var _0x46cb2d=_0x426aec[_0x4041('0x1e')]!==_0x5e7d9b[_0x4041('0x1e')]||_0x426aec[_0x4041('0x1f')]!==_0x5e7d9b['loggedIn']||_0x426aec[_0x4041('0x20')]!==_0x5e7d9b[_0x4041('0x20')]||_0x426aec[_0x4041('0x21')]!==_0x5e7d9b['paused']||_0x426aec[_0x4041('0x22')]!==_0x5e7d9b[_0x4041('0x22')]||_0x426aec[_0x4041('0x23')]!==_0x5e7d9b[_0x4041('0x23')]||_0x426aec[_0x4041('0x24')]!==_0x5e7d9b['waiting']||_0x426aec[_0x4041('0x25')]!==_0x5e7d9b[_0x4041('0x25')]||_0x426aec[_0x4041('0x26')]!==_0x5e7d9b[_0x4041('0x26')];if(_0x426aec[_0x4041('0x27')]&&_0x5e7d9b[_0x4041('0x27')]){_0x2da122=_0x426aec[_0x4041('0x27')]['name']!==_0x5e7d9b[_0x4041('0x27')][_0x4041('0x28')]||_0x426aec[_0x4041('0x27')]['active']!==_0x5e7d9b['Trunk'][_0x4041('0x19')];}return _0x2600fa||_0x46cb2d||_0x2da122;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x35bb8b){var _0x56636b=null;var _0x1d1382=_0x35bb8b[_0x4041('0x29')];if(_[_0x4041('0x2a')](_0x35bb8b[_0x4041('0x2b')])||_[_0x4041('0x2a')](_0x35bb8b['Interval'])||_[_0x4041('0x2a')](_0x35bb8b[_0x4041('0x2c')][_0x4041('0x2d')])){_0x56636b=CAMPAIGN_STATUS[_0x4041('0x2e')];}else if(_[_0x4041('0x2f')](_0x35bb8b[_0x4041('0x2b')])||_[_0x4041('0x2f')](_0x35bb8b[_0x4041('0x2c')][_0x4041('0x2d')])){_0x56636b=CAMPAIGN_STATUS[_0x4041('0x30')];}else if(_0x1d1382&&!timezones[_0x1d1382]){_0x56636b=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x56636b;}function checkAnyValidTrunk(_0x15d584,_0x503023){var _0x226b03=null;var _0x2319b6=_0x4041('0x31');var _0x5b72b3=[_0x4041('0x32'),'unmonitored'];var _0x20c147=!![];if(_0x15d584[_0x4041('0x27')]&&_0x15d584['Trunk'][_0x4041('0x19')]){_0x2319b6+=_0x15d584['Trunk']['name'];_0x226b03=_0x503023[_0x2319b6];_0x20c147=_0x5b72b3['includes'](_0x226b03['status']);}else if(_0x15d584[_0x4041('0x33')]&&_0x15d584[_0x4041('0x33')][_0x4041('0x19')]){_0x2319b6+=_0x15d584[_0x4041('0x33')][_0x4041('0x28')];_0x226b03=_0x503023[_0x2319b6];_0x20c147=_0x5b72b3[_0x4041('0x34')](_0x226b03['status']);}return _0x20c147;}function getQueueCampaignStatusMessage(_0x510e23,_0x3ee488){var _0x591c92=CAMPAIGN_STATUS[_0x4041('0x5')];var _0x3457f0=isPreviewCampaign(_0x510e23);if(!isQueueCampaignActive(_0x510e23)){if(_0x3457f0){_0x591c92=CAMPAIGN_STATUS[_0x4041('0x35')];}else{if(_0x510e23[_0x4041('0x26')]===0x0&&_0x510e23[_0x4041('0x22')]===0x0&&_0x510e23['waiting']===0x0&&(_0x510e23['pTalking']||0x0)===0x0){_0x591c92=CAMPAIGN_STATUS[_0x4041('0x35')];}else{_0x591c92=CAMPAIGN_STATUS[_0x4041('0x36')];}}}else if(_0x510e23[_0x4041('0x1f')]===0x0){_0x591c92=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x510e23,_0x3ee488)){_0x591c92=CAMPAIGN_STATUS[_0x4041('0x37')];}else if(!isPreviewCampaign(_0x510e23)){var _0x22791a=checkAnyValidQueueCampaignInterval(_0x510e23);if(_0x22791a){_0x591c92=_0x22791a;}}return _0x591c92;}exports[_0x4041('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x52669d){var _0x10e27e=CAMPAIGN_STATUS['DISACTIVED'];if(_0x52669d[_0x4041('0x26')]===0x0&&_0x52669d['talking']===0x0&&_0x52669d[_0x4041('0x24')]===0x0&&(_0x52669d[_0x4041('0x23')]||0x0)===0x0){_0x10e27e=CAMPAIGN_STATUS[_0x4041('0x35')];}return _0x10e27e;}exports[_0x4041('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x23f20f){var _0x5ed0a3=_0x23f20f['match'](/"(.*?)"/);return _0x5ed0a3?_0x5ed0a3[0x1]:_0x23f20f;}exports[_0x4041('0x3a')]=extractCalleridName;function getCallerId(_0x4f6518,_0x593cab,_0x21f2a7){if(!_[_0x4041('0x3b')](_0x21f2a7)&&typeof _0x21f2a7===_0x4041('0x3c')&&!_[_0x4041('0x2f')](_0x21f2a7)){if(!_[_0x4041('0x3b')](_0x593cab)&&typeof _0x593cab==='string'&&!_['isEmpty'](_0x593cab)){return util[_0x4041('0x3d')](_0x4041('0x3e'),_0x593cab,_0x21f2a7);}return util[_0x4041('0x3d')](_0x4041('0x3e'),_0x21f2a7,_0x21f2a7);}if(!_['isUndefined'](_0x4f6518)&&typeof _0x4f6518===_0x4041('0x3c')&&!_[_0x4041('0x2f')](_0x4f6518)){return _0x4f6518;}return _0x4041('0x3f');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0xcda227,_0x2471da){var _0x50b051;var _0x4d6be5;var _0x27d8fa;if(_0x2471da<=0x0){_0x2471da=0x1;}_0x50b051=new RegExp('\x5cw{0,'+_0x2471da+'}$');_0x4d6be5=Math[_0x4041('0x40')](0xa,_0x2471da-0x1);_0x27d8fa=Math['pow'](0xa,_0x2471da)-0x1;return util['format']('%s',_['replace'](_0xcda227,_0x50b051,_[_0x4041('0x41')](_0x4d6be5,_0x27d8fa)[_0x4041('0x42')]()));}exports[_0x4041('0x43')]=getCallerIdRandom;function decrementOriginate(_0x2631b2,_0x4af5d2){if(_0x2631b2[_0x4041('0x26')]&&_0x2631b2[_0x4041('0x26')]>0x0){_0x2631b2[_0x4041('0x26')]-=0x1;}else{logger[_0x4041('0x44')](_0x4041('0x45'),_0x4af5d2);}}exports[_0x4041('0x46')]=decrementOriginate;function checkContactEmpty(_0x39212c){return _0x39212c&&_0x39212c[_0x4041('0x47')]>0x0;}exports[_0x4041('0x48')]=checkContactEmpty;function erlangb(_0x4b0f6f,_0x51dc4a){if(_0x51dc4a===0x0){return 0x0;}var _0x3b329c=0x1;for(var _0x41b081=0x1;_0x41b081<=_0x51dc4a;_0x41b081+=0x1){_0x3b329c=0x1+_0x3b329c*_0x41b081/_0x4b0f6f;}return 0x1/_0x3b329c;}exports[_0x4041('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x13ae96,_0x3c707a,_0x43b28a){if(_0x3c707a>_0x43b28a){for(var _0x4e8d92=0x0;_0x4e8d92<_0x3c707a-_0x43b28a;_0x4e8d92+=0x1){decrementOriginate(_0x13ae96,_0x4041('0x4a'));}}}exports[_0x4041('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x164131){var _0x54740a={};var _0x4563f5=['id',_0x4041('0x4c'),'tags',_0x4041('0x4d')];const _0x594081=0xfa;if(_0x164131){for(var _0x5ed4fd in _0x164131){if(typeof _0x164131[_0x5ed4fd]!==_0x4041('0x4e')){if(!_[_0x4041('0x2a')](_0x164131[_0x5ed4fd])&&!_0x4563f5[_0x4041('0x34')](_0x5ed4fd)){if(_0x5ed4fd===_0x4041('0x4f')&&_0x164131[_0x5ed4fd][_0x4041('0x47')]>_0x594081){_0x54740a['XMD-'+_0x5ed4fd['toUpperCase']()]=_0x164131[_0x5ed4fd]['toString']()['substring'](0x0,_0x594081);}else{_0x54740a[_0x4041('0x50')+_0x5ed4fd['toUpperCase']()]=_0x164131[_0x5ed4fd];}}}}}return _0x54740a;}exports[_0x4041('0x51')]=setXMDContactVariables; \ No newline at end of file +var _0x1dcb=['DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','loggedIn','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','length','checkContactEmpty','erlangb','createdAt','tags','toUpperCase','XMD-','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dcb,0x141));var _0xb1dc=function(_0x3a8b32,_0x20211b){_0x3a8b32=_0x3a8b32-0x0;var _0x1e37d8=_0x1dcb[_0x3a8b32];return _0x1e37d8;};'use strict';var _=require(_0xb1dc('0x0'));var moment=require(_0xb1dc('0x1'));var util=require('util');var logger=require(_0xb1dc('0x2'))(_0xb1dc('0x3'));var timezones=require(_0xb1dc('0x4'))[_0xb1dc('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xb1dc('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb1dc('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb1dc('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xb1dc('0x9'),'NO_AVAILABLE_CONTACTS':_0xb1dc('0xa'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xb1dc('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0xb1dc('0xc'),'QUEUE_RECALL':_0xb1dc('0xd'),'RECALL_TIMEOUT':_0xb1dc('0xe'),'RUNNING':_0xb1dc('0xf'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xb1dc('0x10')};exports[_0xb1dc('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xa7f246){return _0xa7f246['dialMethod']===_0xb1dc('0x12');}exports[_0xb1dc('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x2bf491){return _0x2bf491[_0xb1dc('0x14')]===_0xb1dc('0x15');}exports[_0xb1dc('0x16')]=isIVRCampaign;function isOutboundQueue(_0x434172){return _0x434172['type']==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x4d80c8){return _0x4d80c8['dialActive'];}exports[_0xb1dc('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x23c420){return _0x23c420[_0xb1dc('0x18')];}exports[_0xb1dc('0x19')]=isIVRCampaignActive;function getSeconds(_0xa2bc51,_0x7a8b2e){var _0x5ae803=moment(_0xa2bc51)[_0xb1dc('0x1a')](0x0);var _0x10a166=moment(_0x7a8b2e)[_0xb1dc('0x1a')](0x0);return _0x5ae803[_0xb1dc('0x1b')](_0x10a166,_0xb1dc('0x1c'));}exports[_0xb1dc('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x28ea87,_0x4ed805){var _0x56b39f=![];var _0x41676b=_0x28ea87[_0xb1dc('0x1e')]!==_0x4ed805[_0xb1dc('0x1e')]||_0x28ea87[_0xb1dc('0x1f')]!==_0x4ed805[_0xb1dc('0x1f')]||_0x28ea87['message']!==_0x4ed805[_0xb1dc('0x20')];var _0x454fd5=_0x28ea87[_0xb1dc('0x21')]!==_0x4ed805[_0xb1dc('0x21')]||_0x28ea87['loggedIn']!==_0x4ed805['loggedIn']||_0x28ea87[_0xb1dc('0x22')]!==_0x4ed805[_0xb1dc('0x22')]||_0x28ea87[_0xb1dc('0x23')]!==_0x4ed805[_0xb1dc('0x23')]||_0x28ea87[_0xb1dc('0x24')]!==_0x4ed805['talking']||_0x28ea87[_0xb1dc('0x25')]!==_0x4ed805[_0xb1dc('0x25')]||_0x28ea87[_0xb1dc('0x26')]!==_0x4ed805[_0xb1dc('0x26')]||_0x28ea87[_0xb1dc('0x27')]!==_0x4ed805[_0xb1dc('0x27')]||_0x28ea87[_0xb1dc('0x28')]!==_0x4ed805[_0xb1dc('0x28')];if(_0x28ea87['Trunk']&&_0x4ed805['Trunk']){_0x56b39f=_0x28ea87[_0xb1dc('0x29')]['name']!==_0x4ed805[_0xb1dc('0x29')]['name']||_0x28ea87[_0xb1dc('0x29')][_0xb1dc('0x18')]!==_0x4ed805[_0xb1dc('0x29')][_0xb1dc('0x18')];}return _0x41676b||_0x454fd5||_0x56b39f;}exports[_0xb1dc('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x57242a){var _0x53af89=null;var _0x2d2706=_0x57242a['dialTimezone'];if(_['isNil'](_0x57242a[_0xb1dc('0x2b')])||_[_0xb1dc('0x2c')](_0x57242a[_0xb1dc('0x2d')])||_[_0xb1dc('0x2c')](_0x57242a[_0xb1dc('0x2d')]['Intervals'])){_0x53af89=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xb1dc('0x2e')](_0x57242a['dialGlobalInterval'])||_[_0xb1dc('0x2e')](_0x57242a[_0xb1dc('0x2d')][_0xb1dc('0x2f')])){_0x53af89=CAMPAIGN_STATUS[_0xb1dc('0x30')];}else if(_0x2d2706&&!timezones[_0x2d2706]){_0x53af89=CAMPAIGN_STATUS[_0xb1dc('0x31')];}return _0x53af89;}function checkAnyValidTrunk(_0x14e673,_0x531e96){var _0x3a20cc=null;var _0x3186f5='SIP/';var _0x400a61=[_0xb1dc('0x32'),_0xb1dc('0x33')];var _0x37b00e=!![];if(_0x14e673[_0xb1dc('0x29')]&&_0x14e673[_0xb1dc('0x29')][_0xb1dc('0x18')]){_0x3186f5+=_0x14e673['Trunk']['name'];_0x3a20cc=_0x531e96[_0x3186f5];_0x37b00e=_0x400a61[_0xb1dc('0x34')](_0x3a20cc[_0xb1dc('0x35')]);}else if(_0x14e673[_0xb1dc('0x36')]&&_0x14e673['TrunkBackup'][_0xb1dc('0x18')]){_0x3186f5+=_0x14e673[_0xb1dc('0x36')]['name'];_0x3a20cc=_0x531e96[_0x3186f5];_0x37b00e=_0x400a61[_0xb1dc('0x34')](_0x3a20cc[_0xb1dc('0x35')]);}return _0x37b00e;}function getQueueCampaignStatusMessage(_0xf40f0c,_0x51c0c2){var _0x32d9c7=CAMPAIGN_STATUS[_0xb1dc('0x37')];var _0x42afee=isPreviewCampaign(_0xf40f0c);if(!isQueueCampaignActive(_0xf40f0c)){if(_0x42afee){_0x32d9c7=CAMPAIGN_STATUS[_0xb1dc('0x38')];}else{if(_0xf40f0c['originated']===0x0&&_0xf40f0c[_0xb1dc('0x24')]===0x0&&_0xf40f0c[_0xb1dc('0x26')]===0x0&&(_0xf40f0c['pTalking']||0x0)===0x0){_0x32d9c7=CAMPAIGN_STATUS['INACTIVE'];}else{_0x32d9c7=CAMPAIGN_STATUS[_0xb1dc('0x39')];}}}else if(_0xf40f0c[_0xb1dc('0x3a')]===0x0){_0x32d9c7=CAMPAIGN_STATUS[_0xb1dc('0x3b')];}else if(!checkAnyValidTrunk(_0xf40f0c,_0x51c0c2)){_0x32d9c7=CAMPAIGN_STATUS[_0xb1dc('0x3c')];}else if(!isPreviewCampaign(_0xf40f0c)){var _0x5c24dc=checkAnyValidQueueCampaignInterval(_0xf40f0c);if(_0x5c24dc){_0x32d9c7=_0x5c24dc;}}return _0x32d9c7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2886c1){var _0x5aa0df=CAMPAIGN_STATUS[_0xb1dc('0x39')];if(_0x2886c1[_0xb1dc('0x28')]===0x0&&_0x2886c1[_0xb1dc('0x24')]===0x0&&_0x2886c1[_0xb1dc('0x26')]===0x0&&(_0x2886c1[_0xb1dc('0x25')]||0x0)===0x0){_0x5aa0df=CAMPAIGN_STATUS[_0xb1dc('0x38')];}return _0x5aa0df;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x173495){var _0x1cfad2=_0x173495['match'](/"(.*?)"/);return _0x1cfad2?_0x1cfad2[0x1]:_0x173495;}exports[_0xb1dc('0x3d')]=extractCalleridName;function getCallerId(_0x26898b,_0x502069,_0x281410){if(!_[_0xb1dc('0x3e')](_0x281410)&&typeof _0x281410===_0xb1dc('0x3f')&&!_[_0xb1dc('0x2e')](_0x281410)){if(!_['isUndefined'](_0x502069)&&typeof _0x502069===_0xb1dc('0x3f')&&!_['isEmpty'](_0x502069)){return util[_0xb1dc('0x40')]('\x22%s\x22\x20<%s>',_0x502069,_0x281410);}return util[_0xb1dc('0x40')](_0xb1dc('0x41'),_0x281410,_0x281410);}if(!_[_0xb1dc('0x3e')](_0x26898b)&&typeof _0x26898b==='string'&&!_[_0xb1dc('0x2e')](_0x26898b)){return _0x26898b;}return _0xb1dc('0x42');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x117c56,_0x2876d2){var _0x554324;var _0x370f3f;var _0x22beac;if(_0x2876d2<=0x0){_0x2876d2=0x1;}_0x554324=new RegExp(_0xb1dc('0x43')+_0x2876d2+'}$');_0x370f3f=Math[_0xb1dc('0x44')](0xa,_0x2876d2-0x1);_0x22beac=Math['pow'](0xa,_0x2876d2)-0x1;return util[_0xb1dc('0x40')]('%s',_[_0xb1dc('0x45')](_0x117c56,_0x554324,_['random'](_0x370f3f,_0x22beac)[_0xb1dc('0x46')]()));}exports[_0xb1dc('0x47')]=getCallerIdRandom;function decrementOriginate(_0x450278,_0x491626){if(_0x450278['originated']&&_0x450278[_0xb1dc('0x28')]>0x0){_0x450278[_0xb1dc('0x28')]-=0x1;}else{logger[_0xb1dc('0x48')](_0xb1dc('0x49'),_0x491626);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x4e481c){return _0x4e481c&&_0x4e481c[_0xb1dc('0x4a')]>0x0;}exports[_0xb1dc('0x4b')]=checkContactEmpty;function erlangb(_0x562319,_0x51d9d9){if(_0x51d9d9===0x0){return 0x0;}var _0x43b107=0x1;for(var _0x3bfcb5=0x1;_0x3bfcb5<=_0x51d9d9;_0x3bfcb5+=0x1){_0x43b107=0x1+_0x43b107*_0x3bfcb5/_0x562319;}return 0x1/_0x43b107;}exports[_0xb1dc('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x1ca034,_0x5cb4bb,_0x2d4f9f){if(_0x5cb4bb>_0x2d4f9f){for(var _0x4e2bbb=0x0;_0x4e2bbb<_0x5cb4bb-_0x2d4f9f;_0x4e2bbb+=0x1){decrementOriginate(_0x1ca034,'[checkContactLowerLimitOriginate]\x20');}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1a1f8f){var _0x200e4c={};var _0x5ac59d=['id',_0xb1dc('0x4d'),_0xb1dc('0x4e'),'updatedAt'];const _0x1be6bc=0xfa;if(_0x1a1f8f){for(var _0x160c88 in _0x1a1f8f){if(typeof _0x1a1f8f[_0x160c88]!=='undefined'){if(!_['isNil'](_0x1a1f8f[_0x160c88])&&!_0x5ac59d[_0xb1dc('0x34')](_0x160c88)){if(_0x160c88==='description'&&_0x1a1f8f[_0x160c88][_0xb1dc('0x4a')]>_0x1be6bc){_0x200e4c['XMD-'+_0x160c88[_0xb1dc('0x4f')]()]=_0x1a1f8f[_0x160c88]['toString']()['substring'](0x0,_0x1be6bc);}else{_0x200e4c[_0xb1dc('0x50')+_0x160c88[_0xb1dc('0x4f')]()]=_0x1a1f8f[_0x160c88];}}}}}return _0x200e4c;}exports[_0xb1dc('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2024c4f..74a6e43 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(_0x3aad50,_0x5e1d9a){var _0x3381e6=function(_0x164174){while(--_0x164174){_0x3aad50['push'](_0x3aad50['shift']());}};_0x3381e6(++_0x5e1d9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x48b223,_0x3c12c7){var _0x5843cc=function(_0x299596){while(--_0x299596){_0x48b223['push'](_0x48b223['shift']());}};_0x5843cc(++_0x3c12c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 0475961..1056f12 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 _0x4b3b=['moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','bluebird','uuid'];(function(_0x180659,_0xa1b1c4){var _0x224761=function(_0xe29201){while(--_0xe29201){_0x180659['push'](_0x180659['shift']());}};_0x224761(++_0xa1b1c4);}(_0x4b3b,0x1d9));var _0xb4b3=function(_0x1a0459,_0x5b4a86){_0x1a0459=_0x1a0459-0x0;var _0x277a3d=_0x4b3b[_0x1a0459];return _0x277a3d;};'use strict';var util=require(_0xb4b3('0x0'));var _=require('lodash');var BPromise=require(_0xb4b3('0x1'));var uuid=require(_0xb4b3('0x2'));var moment=require(_0xb4b3('0x3'));var path=require(_0xb4b3('0x4'));var tiff2pdf=require(_0xb4b3('0x5'));var gs=require('./util/gs');var logger=require(_0xb4b3('0x6'))(_0xb4b3('0x7'));var ami=require(_0xb4b3('0x8'));var rpcDb=require(_0xb4b3('0x9'));var Channel=require(_0xb4b3('0xa'));var ut=require(_0xb4b3('0xb'));var Action=require(_0xb4b3('0xc'));var faxAccount=require(_0xb4b3('0xd'));var attachment=require(_0xb4b3('0xe'));var faxMessage=require(_0xb4b3('0xf'));function Fax(_0x219bb8){this[_0xb4b3('0x10')]={};this[_0xb4b3('0x11')]=_0x219bb8['faxAccounts'];this[_0xb4b3('0x12')]=_0x219bb8[_0xb4b3('0x12')];this[_0xb4b3('0x13')]={};ami['on'](_0xb4b3('0x14'),this[_0xb4b3('0x15')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x17'),this[_0xb4b3('0x18')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x19'),this[_0xb4b3('0x1a')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0xb4b3('0x1c'),this[_0xb4b3('0x1d')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x1e'),this[_0xb4b3('0x1f')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x20'),this[_0xb4b3('0x21')][_0xb4b3('0x16')](this));ami['on'](_0xb4b3('0x22'),this['syncOriginateResponse']['bind'](this));}Fax[_0xb4b3('0x23')]['syncNewchannel']=function(_0x381ac4){if(_0x381ac4['context']===_0xb4b3('0x24')){for(var _0xb26a3 in this[_0xb4b3('0x11')]){if(this[_0xb4b3('0x11')][_0xb4b3('0x25')](_0xb26a3)){if(_0x381ac4[_0xb4b3('0x26')]===this[_0xb4b3('0x11')][_0xb26a3][_0xb4b3('0x27')]){this[_0xb4b3('0x10')][_0x381ac4[_0xb4b3('0x28')]]={};this[_0xb4b3('0x10')][_0x381ac4[_0xb4b3('0x28')]][_0xb4b3('0x29')]=_0x381ac4['channel'];this['channels'][_0x381ac4[_0xb4b3('0x28')]]['id']=this[_0xb4b3('0x11')][_0xb26a3]['id'];this[_0xb4b3('0x10')][_0x381ac4[_0xb4b3('0x28')]][_0xb4b3('0x2a')]=this[_0xb4b3('0x11')][_0xb26a3][_0xb4b3('0x2a')];logger[_0xb4b3('0x2b')](_0x381ac4['uniqueid'],_0xb4b3('0x2c'));}}}}if(this['actions'][_0x381ac4[_0xb4b3('0x28')]]){this[_0xb4b3('0x10')][_0x381ac4[_0xb4b3('0x28')]]={};this[_0xb4b3('0x10')][_0x381ac4[_0xb4b3('0x28')]][_0xb4b3('0x29')]=_0x381ac4[_0xb4b3('0x29')];logger[_0xb4b3('0x2b')](_0x381ac4[_0xb4b3('0x28')],_0xb4b3('0x2c'));}};Fax[_0xb4b3('0x23')][_0xb4b3('0x18')]=function(_0x2a1098){if(this[_0xb4b3('0x10')][_0x2a1098[_0xb4b3('0x28')]]){for(var _0x308e0e in _0x2a1098[_0xb4b3('0x2d')]){if(_0x2a1098[_0xb4b3('0x2d')]['hasOwnProperty'](_0x308e0e)){this[_0xb4b3('0x10')][_0x2a1098['uniqueid']][_0x308e0e]=_0x2a1098['value'];}}}};Fax['prototype']['syncNewState']=function(_0x13bd97){if(this[_0xb4b3('0x10')][_0x13bd97[_0xb4b3('0x28')]]){this['channels'][_0x13bd97[_0xb4b3('0x28')]][_0xb4b3('0x2e')]=_0x13bd97[_0xb4b3('0x2e')];this[_0xb4b3('0x10')][_0x13bd97[_0xb4b3('0x28')]][_0xb4b3('0x2f')]=_0x13bd97['channelstatedesc'];}};Fax['prototype'][_0xb4b3('0x30')]=function(_0x445145){if(this[_0xb4b3('0x10')][_0x445145[_0xb4b3('0x28')]]){for(var _0xdcd6c7 in _0x445145[_0xb4b3('0x2d')]){if(_0x445145[_0xb4b3('0x2d')]['hasOwnProperty'](_0xdcd6c7)){this[_0xb4b3('0x10')][_0x445145[_0xb4b3('0x28')]][_0xdcd6c7]=_0x445145['value'];}}}};Fax[_0xb4b3('0x23')][_0xb4b3('0x1d')]=function(_0x3802e4){if(this[_0xb4b3('0x10')][_0x3802e4['uniqueid']]){this[_0xb4b3('0x10')][_0x3802e4[_0xb4b3('0x28')]]['operation']=_0x3802e4[_0xb4b3('0x31')];this[_0xb4b3('0x10')][_0x3802e4[_0xb4b3('0x28')]][_0xb4b3('0x32')]=_0x3802e4['status'];this[_0xb4b3('0x10')][_0x3802e4['uniqueid']]['localstationid']=_0x3802e4[_0xb4b3('0x27')];this[_0xb4b3('0x10')][_0x3802e4[_0xb4b3('0x28')]][_0xb4b3('0x33')]=_0x3802e4[_0xb4b3('0x33')];logger[_0xb4b3('0x2b')](_0x3802e4[_0xb4b3('0x28')],_0xb4b3('0x34'));}};Fax[_0xb4b3('0x23')][_0xb4b3('0x1f')]=function(_0x2bc75e){var _0x3b9863=this;if(this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]]){var _0x3c1ba6=this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]]['id'];this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]][_0xb4b3('0x35')]=_0x2bc75e['remotestationid'];this['channels'][_0x2bc75e['uniqueid']][_0xb4b3('0x36')]=_0x2bc75e[_0xb4b3('0x36')];this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]][_0xb4b3('0x27')]=_0x2bc75e[_0xb4b3('0x27')];this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]]['resolution']=_0x2bc75e[_0xb4b3('0x37')];this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]][_0xb4b3('0x38')]=_0x2bc75e['transferrate'];this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]]['filename']=_0x2bc75e[_0xb4b3('0x33')];this[_0xb4b3('0x10')][_0x2bc75e['uniqueid']][_0xb4b3('0x39')]=_0x2bc75e[_0xb4b3('0x39')];if(this[_0xb4b3('0x10')][_0x2bc75e[_0xb4b3('0x28')]][_0xb4b3('0x36')]>0x0){tiff2pdf(_0x2bc75e[_0xb4b3('0x33')],_0xb4b3('0x3a'),function(_0x5a634f){logger[_0xb4b3('0x2b')](_0x2bc75e['uniqueid'],_0xb4b3('0x3b'),_0x5a634f['message']);attachment[_0xb4b3('0x3c')]({'name':path['parse'](_0x2bc75e['filename'])[_0xb4b3('0x2a')],'basename':path[_0xb4b3('0x3d')](_0x2bc75e[_0xb4b3('0x33')])['name']+_0xb4b3('0x3e'),'type':_0xb4b3('0x3f')})[_0xb4b3('0x40')](function(_0x46e998){faxAccount[_0xb4b3('0x41')](_0x3c1ba6,{'from':_0x2bc75e[_0xb4b3('0x39')],'mapKey':'fax','body':path[_0xb4b3('0x3d')](_0x2bc75e['filename'])[_0xb4b3('0x2a')]+_0xb4b3('0x3e'),'AttachmentId':_0x46e998['id']})[_0xb4b3('0x42')](function(_0x34b797){logger[_0xb4b3('0x43')](_0x2bc75e['uniqueid'],'\x20notify\x20',JSON[_0xb4b3('0x44')](_0x34b797));});})['catch'](function(_0x2b8556){logger[_0xb4b3('0x43')](_0x2bc75e[_0xb4b3('0x28')],_0xb4b3('0x45'),JSON[_0xb4b3('0x44')](_0x2b8556));});});}logger[_0xb4b3('0x2b')](_0x2bc75e['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xb4b3('0x23')][_0xb4b3('0x46')]=function(_0x743b54){if(this[_0xb4b3('0x13')][_0x743b54[_0xb4b3('0x28')]]){_['merge'](this['channels'][_0x743b54[_0xb4b3('0x28')]],_[_0xb4b3('0x47')](_0x743b54,[_0xb4b3('0x48'),'reason']));}};function updateStatus(_0x422432){if(_0x422432[_0xb4b3('0x49')]){faxMessage[_0xb4b3('0x4a')](_0x422432['AttachmentId'],{'failMessage':_0xb4b3('0x4b')})[_0xb4b3('0x40')](function(_0x503caf){ut[_0xb4b3('0x4c')](_0xb4b3('0x4d'),_0x503caf);})[_0xb4b3('0x42')](function(_0x2e3337){ut[_0xb4b3('0x4c')]('[Fax][Message][Error][NoUpdate1]',_0x2e3337);});}else{ut[_0xb4b3('0x4c')](_0xb4b3('0x4e'));}}Fax[_0xb4b3('0x23')][_0xb4b3('0x4f')]=function(_0x21139c,_0x33cce2,_0x38a1ba){var _0x22d696=this;var _0x2f8e67={};if(_0x33cce2){_0x2f8e67={'read':_0x33cce2};}else{_0x2f8e67={'failMessage':_0x38a1ba};}if(this['actions'][_0x21139c][_0xb4b3('0x49')]){faxMessage['update'](this['actions'][_0x21139c]['AttachmentId'],_0x2f8e67)[_0xb4b3('0x40')](function(_0x48fd11){ut[_0xb4b3('0x4c')](_0xb4b3('0x50'),_0x48fd11);})[_0xb4b3('0x42')](function(_0x2358c6){ut[_0xb4b3('0x4c')](_0xb4b3('0x51'),_0x2358c6);})[_0xb4b3('0x52')](function(){delete _0x22d696[_0xb4b3('0x10')][_0x21139c];delete _0x22d696[_0xb4b3('0x13')][_0x21139c];});}else{ut['logger'](_0xb4b3('0x53'));this[_0xb4b3('0x54')](_0x21139c);delete this[_0xb4b3('0x13')][_0x21139c];}};Fax[_0xb4b3('0x23')][_0xb4b3('0x21')]=function(_0x273e53){var _0x37c2a4=this;if(this['channels'][_0x273e53['uniqueid']]){if(this[_0xb4b3('0x13')][_0x273e53[_0xb4b3('0x28')]]){this['channels'][_0x273e53[_0xb4b3('0x28')]]['id']=this[_0xb4b3('0x13')][_0x273e53[_0xb4b3('0x28')]]['id'];this[_0xb4b3('0x10')][_0x273e53[_0xb4b3('0x28')]][_0xb4b3('0x2a')]=this['actions'][_0x273e53[_0xb4b3('0x28')]][_0xb4b3('0x2a')];}logger[_0xb4b3('0x2b')](_0x273e53['uniqueid'],this['actions'][_0x273e53['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xb4b3('0x55'),JSON[_0xb4b3('0x44')](this[_0xb4b3('0x10')][_0x273e53[_0xb4b3('0x28')]]));if(this[_0xb4b3('0x13')][_0x273e53[_0xb4b3('0x28')]]){if(this[_0xb4b3('0x10')][_0x273e53['uniqueid']][_0xb4b3('0x56')]>0x0&&this['channels'][_0x273e53[_0xb4b3('0x28')]][_0xb4b3('0x1c')]===_0xb4b3('0x57')){this[_0xb4b3('0x4f')](_0x273e53['uniqueid'],!![]);}else{this[_0xb4b3('0x4f')](_0x273e53[_0xb4b3('0x28')],![],this[_0xb4b3('0x10')][_0x273e53['uniqueid']][_0xb4b3('0x58')]?_0xb4b3('0x59')+this[_0xb4b3('0x10')][_0x273e53['uniqueid']][_0xb4b3('0x58')]:_0xb4b3('0x5a'));}}}};Fax['prototype'][_0xb4b3('0x5b')]=function(_0x1cbc86){var _0x131624=this;return new BPromise(function(_0x4a2ef4,_0x18e6c6){_0x131624['execOriginate'](_0x1cbc86,_0x131624['faxAccounts'][_0x1cbc86[_0xb4b3('0x5c')]])[_0xb4b3('0x40')](function(_0x54c45f){ut[_0xb4b3('0x4c')]('[Fax][execOriginate][success]',_0x54c45f);_0x4a2ef4(ut[_0xb4b3('0x5d')](_0xb4b3('0x5e')));})[_0xb4b3('0x42')](function(_0x5bba8f){ut[_0xb4b3('0x4c')](_0xb4b3('0x5f'),_0x5bba8f);updateStatus(_0x1cbc86);_0x18e6c6(ut[_0xb4b3('0x5d')](_0xb4b3('0x60')));});});};Fax['prototype']['checkAfterSend']=function(_0x44ffa3){var _0x67e645=this;return new BPromise(function(_0x1d5819,_0x32acf6){var _0xffb71b=_0x67e645[_0xb4b3('0x61')](_0x67e645['faxAccounts'][_0x44ffa3[_0xb4b3('0x5c')]][_0xb4b3('0x62')],_0x44ffa3);if(_0xffb71b[_0xb4b3('0x63')]){_0x1d5819(ut[_0xb4b3('0x5d')]('Trunk\x20Reachable'));}else{_0x32acf6(ut[_0xb4b3('0x5d')](_0xffb71b['message']));}});};function originate(_0x513dc4,_0x563818,_0x2058ec){return new BPromise(function(_0x589480,_0x72b3b7){if(_0x2058ec){var _0xfa2d05=util['format'](_0xb4b3('0x64'),path['parse'](_0x513dc4['path'])[_0xb4b3('0x2a')],_0x513dc4[_0xb4b3('0x4')]);gs[_0xb4b3('0x65')](_0xfa2d05)[_0xb4b3('0x40')](function(){_0x513dc4[_0xb4b3('0x4')]=util[_0xb4b3('0x66')](_0xb4b3('0x67'),path[_0xb4b3('0x3d')](_0x513dc4['path'])[_0xb4b3('0x68')],path[_0xb4b3('0x3d')](_0x513dc4['path'])[_0xb4b3('0x2a')]);_0x563818['XMF-PATH']=_0x513dc4['path'];ut[_0xb4b3('0x4c')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xb4b3('0x69')](_0x513dc4,_0x563818))['then'](function(_0x29bbb5){_0x589480(_0x29bbb5);})[_0xb4b3('0x42')](function(_0x2003ba){_0x72b3b7(_0x2003ba);});})[_0xb4b3('0x42')](function(_0x4a4146){_0x72b3b7(_0x4a4146);});}else{ami[_0xb4b3('0x6a')](ut[_0xb4b3('0x69')](_0x513dc4,_0x563818))[_0xb4b3('0x40')](function(_0x60dce8){_0x589480(_0x60dce8);})[_0xb4b3('0x42')](function(_0x3de675){_0x72b3b7(_0x3de675);});}});}Fax[_0xb4b3('0x23')]['execOriginate']=function(_0x4266e4,_0x485b74){var _0x3d5d52=this;return new BPromise(function(_0x16efea,_0x4489f2){var _0x543f8d=uuid['v4']();var _0x50b1bd=ut[_0xb4b3('0x6b')](_0x4266e4,_0x485b74);_0x3d5d52[_0xb4b3('0x13')][_0x543f8d]=new Action(_0x543f8d,_0x485b74,_0x4266e4);var _0x1ae70d=_0x3d5d52[_0xb4b3('0x13')][_0x543f8d];if(path['parse'](_0x4266e4[_0xb4b3('0x4')])[_0xb4b3('0x6c')]===_0xb4b3('0x3e')){originate(_0x1ae70d,_0x50b1bd,!![])[_0xb4b3('0x40')](function(_0x4bcbe5){_0x16efea(_0x4bcbe5);})[_0xb4b3('0x42')](function(_0x3c2f31){_0x4489f2(_0x3c2f31);});}else{originate(_0x1ae70d,_0x50b1bd,![])['then'](function(_0x1e0b04){_0x16efea(_0x1e0b04);})[_0xb4b3('0x42')](function(_0x43d9ec){_0x4489f2(_0x43d9ec);});}});};Fax[_0xb4b3('0x23')][_0xb4b3('0x6d')]=function(_0x4e24f9){return!_[_0xb4b3('0x6e')](_0x4e24f9)&&!_[_0xb4b3('0x6e')](_0x4e24f9[_0xb4b3('0x2a')])&&!_['isNil'](_0x4e24f9[_0xb4b3('0x6f')])&&_0x4e24f9[_0xb4b3('0x6f')]&&!_[_0xb4b3('0x6e')](this['trunks'][util['format'](_0xb4b3('0x70'),_0x4e24f9[_0xb4b3('0x2a')])])&&!_[_0xb4b3('0x6e')](this[_0xb4b3('0x12')][util['format'](_0xb4b3('0x70'),_0x4e24f9[_0xb4b3('0x2a')])][_0xb4b3('0x32')])&&(this[_0xb4b3('0x12')][util[_0xb4b3('0x66')](_0xb4b3('0x70'),_0x4e24f9[_0xb4b3('0x2a')])]['status']==='reachable'||this['trunks'][util[_0xb4b3('0x66')](_0xb4b3('0x70'),_0x4e24f9[_0xb4b3('0x2a')])][_0xb4b3('0x32')]===_0xb4b3('0x71'));};Fax[_0xb4b3('0x23')][_0xb4b3('0x61')]=function(_0x1c29da,_0x59d622){if(!this['isTrunkReachable'](_0x1c29da)){ut[_0xb4b3('0x4c')](_0xb4b3('0x72'),_[_0xb4b3('0x6e')](_0x1c29da)?'':_0x1c29da[_0xb4b3('0x2a')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xb4b3('0x6e')](_0x59d622['fax'])){ut[_0xb4b3('0x4c')](_0xb4b3('0x73'),JSON[_0xb4b3('0x44')](_0x59d622));return{'isValid':![],'message':_0xb4b3('0x74')};}if(_[_0xb4b3('0x6e')](_0x59d622[_0xb4b3('0x4')])){ut[_0xb4b3('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xb4b3('0x44')](_0x59d622));return{'isValid':![],'message':_0xb4b3('0x75')};}return{'isValid':!![],'message':_0xb4b3('0x76')};};Fax['prototype'][_0xb4b3('0x54')]=function(_0x3295e4,_0xd51566=0x2710){if(this[_0xb4b3('0x10')][_0x3295e4]){setTimeout(()=>{delete this[_0xb4b3('0x10')][_0x3295e4];},_0xd51566);}};module['exports']=Fax; \ No newline at end of file +var _0x085e=['info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','channel','uniqueid','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x085e,0x1bb));var _0xe085=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x085e[_0x5d6456];return _0x4d66c1;};'use strict';var util=require('util');var _=require(_0xe085('0x0'));var BPromise=require('bluebird');var uuid=require(_0xe085('0x1'));var moment=require(_0xe085('0x2'));var path=require(_0xe085('0x3'));var tiff2pdf=require(_0xe085('0x4'));var gs=require(_0xe085('0x5'));var logger=require(_0xe085('0x6'))(_0xe085('0x7'));var ami=require(_0xe085('0x8'));var rpcDb=require(_0xe085('0x9'));var Channel=require(_0xe085('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xe085('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xe085('0xc'));function Fax(_0x3c6978){this[_0xe085('0xd')]={};this[_0xe085('0xe')]=_0x3c6978[_0xe085('0xe')];this[_0xe085('0xf')]=_0x3c6978[_0xe085('0xf')];this[_0xe085('0x10')]={};ami['on']('newchannel',this[_0xe085('0x11')][_0xe085('0x12')](this));ami['on'](_0xe085('0x13'),this[_0xe085('0x14')][_0xe085('0x12')](this));ami['on'](_0xe085('0x15'),this[_0xe085('0x16')][_0xe085('0x12')](this));ami['on'](_0xe085('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xe085('0x18'),this['syncFaxStatus']['bind'](this));ami['on'](_0xe085('0x19'),this[_0xe085('0x1a')][_0xe085('0x12')](this));ami['on'](_0xe085('0x1b'),this[_0xe085('0x1c')][_0xe085('0x12')](this));ami['on'](_0xe085('0x1d'),this[_0xe085('0x1e')][_0xe085('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x4f2068){if(_0x4f2068[_0xe085('0x1f')]==='from-voip-provider'){for(var _0x59ec6f in this[_0xe085('0xe')]){if(this[_0xe085('0xe')][_0xe085('0x20')](_0x59ec6f)){if(_0x4f2068['exten']===this['faxAccounts'][_0x59ec6f][_0xe085('0x21')]){this[_0xe085('0xd')][_0x4f2068['uniqueid']]={};this['channels'][_0x4f2068['uniqueid']][_0xe085('0x22')]=_0x4f2068['channel'];this[_0xe085('0xd')][_0x4f2068[_0xe085('0x23')]]['id']=this[_0xe085('0xe')][_0x59ec6f]['id'];this[_0xe085('0xd')][_0x4f2068[_0xe085('0x23')]][_0xe085('0x24')]=this['faxAccounts'][_0x59ec6f][_0xe085('0x24')];logger[_0xe085('0x25')](_0x4f2068[_0xe085('0x23')],_0xe085('0x26'));}}}}if(this[_0xe085('0x10')][_0x4f2068['uniqueid']]){this['channels'][_0x4f2068[_0xe085('0x23')]]={};this['channels'][_0x4f2068[_0xe085('0x23')]][_0xe085('0x22')]=_0x4f2068['channel'];logger[_0xe085('0x25')](_0x4f2068[_0xe085('0x23')],_0xe085('0x26'));}};Fax[_0xe085('0x27')][_0xe085('0x14')]=function(_0xd277c0){if(this[_0xe085('0xd')][_0xd277c0[_0xe085('0x23')]]){for(var _0x473170 in _0xd277c0[_0xe085('0x28')]){if(_0xd277c0[_0xe085('0x28')][_0xe085('0x20')](_0x473170)){this['channels'][_0xd277c0['uniqueid']][_0x473170]=_0xd277c0[_0xe085('0x29')];}}}};Fax[_0xe085('0x27')][_0xe085('0x16')]=function(_0x205c73){if(this['channels'][_0x205c73[_0xe085('0x23')]]){this['channels'][_0x205c73[_0xe085('0x23')]]['channelstate']=_0x205c73[_0xe085('0x2a')];this[_0xe085('0xd')][_0x205c73[_0xe085('0x23')]]['channelstatedesc']=_0x205c73[_0xe085('0x2b')];}};Fax[_0xe085('0x27')]['syncNewExten']=function(_0x110d80){if(this[_0xe085('0xd')][_0x110d80[_0xe085('0x23')]]){for(var _0x5924d9 in _0x110d80[_0xe085('0x28')]){if(_0x110d80[_0xe085('0x28')][_0xe085('0x20')](_0x5924d9)){this[_0xe085('0xd')][_0x110d80[_0xe085('0x23')]][_0x5924d9]=_0x110d80['value'];}}}};Fax['prototype'][_0xe085('0x2c')]=function(_0x15e50f){if(this['channels'][_0x15e50f['uniqueid']]){this[_0xe085('0xd')][_0x15e50f[_0xe085('0x23')]][_0xe085('0x2d')]=_0x15e50f['operation'];this['channels'][_0x15e50f[_0xe085('0x23')]]['status']=_0x15e50f[_0xe085('0x2e')];this[_0xe085('0xd')][_0x15e50f[_0xe085('0x23')]][_0xe085('0x21')]=_0x15e50f[_0xe085('0x21')];this['channels'][_0x15e50f['uniqueid']][_0xe085('0x2f')]=_0x15e50f[_0xe085('0x2f')];logger[_0xe085('0x25')](_0x15e50f[_0xe085('0x23')],_0xe085('0x30'));}};Fax['prototype'][_0xe085('0x1a')]=function(_0x5be8f5){var _0x3822a9=this;if(this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]]){var _0x507977=this['channels'][_0x5be8f5[_0xe085('0x23')]]['id'];this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]][_0xe085('0x31')]=_0x5be8f5['remotestationid'];this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]][_0xe085('0x32')]=_0x5be8f5[_0xe085('0x32')];this['channels'][_0x5be8f5[_0xe085('0x23')]][_0xe085('0x21')]=_0x5be8f5['localstationid'];this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]]['resolution']=_0x5be8f5[_0xe085('0x33')];this['channels'][_0x5be8f5[_0xe085('0x23')]]['transferrate']=_0x5be8f5[_0xe085('0x34')];this[_0xe085('0xd')][_0x5be8f5['uniqueid']][_0xe085('0x2f')]=_0x5be8f5['filename'];this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]][_0xe085('0x35')]=_0x5be8f5[_0xe085('0x35')];if(this[_0xe085('0xd')][_0x5be8f5[_0xe085('0x23')]][_0xe085('0x32')]>0x0){tiff2pdf(_0x5be8f5[_0xe085('0x2f')],_0xe085('0x36'),function(_0x48c653){logger[_0xe085('0x25')](_0x5be8f5[_0xe085('0x23')],_0xe085('0x37'),_0x48c653[_0xe085('0x38')]);attachment[_0xe085('0x39')]({'name':path[_0xe085('0x3a')](_0x5be8f5[_0xe085('0x2f')])[_0xe085('0x24')],'basename':path[_0xe085('0x3a')](_0x5be8f5[_0xe085('0x2f')])[_0xe085('0x24')]+'.pdf','type':_0xe085('0x3b')})[_0xe085('0x3c')](function(_0x15bd2a){faxAccount[_0xe085('0x3d')](_0x507977,{'from':_0x5be8f5[_0xe085('0x35')],'mapKey':_0xe085('0x7'),'body':path[_0xe085('0x3a')](_0x5be8f5[_0xe085('0x2f')])[_0xe085('0x24')]+_0xe085('0x3e'),'AttachmentId':_0x15bd2a['id']})['catch'](function(_0x19960a){logger[_0xe085('0x3f')](_0x5be8f5[_0xe085('0x23')],_0xe085('0x40'),JSON[_0xe085('0x41')](_0x19960a));});})[_0xe085('0x42')](function(_0x13c578){logger['error'](_0x5be8f5['uniqueid'],_0xe085('0x43'),JSON[_0xe085('0x41')](_0x13c578));});});}logger[_0xe085('0x25')](_0x5be8f5['uniqueid'],_0xe085('0x43'));}};Fax['prototype'][_0xe085('0x1e')]=function(_0x4e2f42){if(this[_0xe085('0x10')][_0x4e2f42[_0xe085('0x23')]]){_[_0xe085('0x44')](this[_0xe085('0xd')][_0x4e2f42['uniqueid']],_[_0xe085('0x45')](_0x4e2f42,[_0xe085('0x46'),_0xe085('0x47')]));}};function updateStatus(_0x7cd1de){if(_0x7cd1de[_0xe085('0x48')]){faxMessage[_0xe085('0x49')](_0x7cd1de[_0xe085('0x48')],{'failMessage':_0xe085('0x4a')})['then'](function(_0x49cb7f){ut['logger'](_0xe085('0x4b'),_0x49cb7f);})['catch'](function(_0x32f8e4){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x32f8e4);});}else{ut[_0xe085('0x4c')](_0xe085('0x4d'));}}Fax['prototype'][_0xe085('0x4e')]=function(_0x12af68,_0x119779,_0x5b2cbf){var _0x3b98d8=this;var _0x4ed28f={};if(_0x119779){_0x4ed28f={'read':_0x119779};}else{_0x4ed28f={'failMessage':_0x5b2cbf};}if(this[_0xe085('0x10')][_0x12af68][_0xe085('0x48')]){faxMessage['update'](this[_0xe085('0x10')][_0x12af68][_0xe085('0x48')],_0x4ed28f)[_0xe085('0x3c')](function(_0x4d6799){ut['logger'](_0xe085('0x4f'),_0x4d6799);})[_0xe085('0x42')](function(_0x2f8337){ut[_0xe085('0x4c')](_0xe085('0x50'),_0x2f8337);})[_0xe085('0x51')](function(){delete _0x3b98d8[_0xe085('0xd')][_0x12af68];delete _0x3b98d8[_0xe085('0x10')][_0x12af68];});}else{ut[_0xe085('0x4c')](_0xe085('0x52'));this[_0xe085('0x53')](_0x12af68);delete this[_0xe085('0x10')][_0x12af68];}};Fax[_0xe085('0x27')]['syncHangup']=function(_0x2ed229){var _0x392b9a=this;if(this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]]){if(this[_0xe085('0x10')][_0x2ed229[_0xe085('0x23')]]){this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]]['id']=this[_0xe085('0x10')][_0x2ed229[_0xe085('0x23')]]['id'];this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]][_0xe085('0x24')]=this['actions'][_0x2ed229[_0xe085('0x23')]][_0xe085('0x24')];}logger[_0xe085('0x25')](_0x2ed229[_0xe085('0x23')],this[_0xe085('0x10')][_0x2ed229[_0xe085('0x23')]]?'\x20hangup\x20sendFile\x20':_0xe085('0x54'),JSON[_0xe085('0x41')](this['channels'][_0x2ed229[_0xe085('0x23')]]));if(this[_0xe085('0x10')][_0x2ed229['uniqueid']]){if(this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]][_0xe085('0x55')]>0x0&&this['channels'][_0x2ed229[_0xe085('0x23')]]['faxstatus']===_0xe085('0x56')){this['updateStatus'](_0x2ed229['uniqueid'],!![]);}else{this[_0xe085('0x4e')](_0x2ed229[_0xe085('0x23')],![],this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]][_0xe085('0x57')]?_0xe085('0x58')+this[_0xe085('0xd')][_0x2ed229[_0xe085('0x23')]]['faxstatusstring']:_0xe085('0x59'));}}}};Fax['prototype'][_0xe085('0x5a')]=function(_0xdde42f){var _0x390bca=this;return new BPromise(function(_0x348c83,_0x528da3){_0x390bca['execOriginate'](_0xdde42f,_0x390bca[_0xe085('0xe')][_0xdde42f[_0xe085('0x5b')]])[_0xe085('0x3c')](function(_0x541059){ut[_0xe085('0x4c')]('[Fax][execOriginate][success]',_0x541059);_0x348c83(ut['message']('Fax\x20received'));})[_0xe085('0x42')](function(_0x26555f){ut[_0xe085('0x4c')](_0xe085('0x5c'),_0x26555f);updateStatus(_0xdde42f);_0x528da3(ut['message'](_0xe085('0x5d')));});});};Fax[_0xe085('0x27')][_0xe085('0x5e')]=function(_0x35ea25){var _0x4f61cc=this;return new BPromise(function(_0x193960,_0x522d82){var _0x657e7f=_0x4f61cc[_0xe085('0x5f')](_0x4f61cc['faxAccounts'][_0x35ea25['FaxAccountId']]['Trunk'],_0x35ea25);if(_0x657e7f[_0xe085('0x60')]){_0x193960(ut[_0xe085('0x38')](_0xe085('0x61')));}else{_0x522d82(ut[_0xe085('0x38')](_0x657e7f[_0xe085('0x38')]));}});};function originate(_0x3c1416,_0x5485c1,_0x17bb8b){return new BPromise(function(_0x910725,_0x36571f){if(_0x17bb8b){var _0x3d63fc=util[_0xe085('0x62')](_0xe085('0x63'),path[_0xe085('0x3a')](_0x3c1416['path'])['name'],_0x3c1416['path']);gs[_0xe085('0x64')](_0x3d63fc)['then'](function(){_0x3c1416[_0xe085('0x3')]=util[_0xe085('0x62')](_0xe085('0x65'),path[_0xe085('0x3a')](_0x3c1416[_0xe085('0x3')])[_0xe085('0x66')],path[_0xe085('0x3a')](_0x3c1416[_0xe085('0x3')])['name']);_0x5485c1['XMF-PATH']=_0x3c1416[_0xe085('0x3')];ut['logger'](_0xe085('0x67'),'');ami[_0xe085('0x68')](ut[_0xe085('0x69')](_0x3c1416,_0x5485c1))[_0xe085('0x3c')](function(_0x385180){_0x910725(_0x385180);})[_0xe085('0x42')](function(_0x187c59){_0x36571f(_0x187c59);});})[_0xe085('0x42')](function(_0x115f1e){_0x36571f(_0x115f1e);});}else{ami[_0xe085('0x68')](ut['variablesAction'](_0x3c1416,_0x5485c1))['then'](function(_0x29bcfd){_0x910725(_0x29bcfd);})['catch'](function(_0x284f23){_0x36571f(_0x284f23);});}});}Fax[_0xe085('0x27')][_0xe085('0x6a')]=function(_0x27e41a,_0x2f6768){var _0x3ec51a=this;return new BPromise(function(_0x9f631c,_0x2f953c){var _0x222960=uuid['v4']();var _0x2cee7f=ut[_0xe085('0x6b')](_0x27e41a,_0x2f6768);_0x3ec51a[_0xe085('0x10')][_0x222960]=new Action(_0x222960,_0x2f6768,_0x27e41a);var _0x2174d1=_0x3ec51a[_0xe085('0x10')][_0x222960];if(path[_0xe085('0x3a')](_0x27e41a[_0xe085('0x3')])[_0xe085('0x6c')]===_0xe085('0x3e')){originate(_0x2174d1,_0x2cee7f,!![])[_0xe085('0x3c')](function(_0x324e76){_0x9f631c(_0x324e76);})[_0xe085('0x42')](function(_0x168612){_0x2f953c(_0x168612);});}else{originate(_0x2174d1,_0x2cee7f,![])['then'](function(_0x1f33a7){_0x9f631c(_0x1f33a7);})[_0xe085('0x42')](function(_0x57e6d8){_0x2f953c(_0x57e6d8);});}});};Fax[_0xe085('0x27')][_0xe085('0x6d')]=function(_0x33af19){return!_[_0xe085('0x6e')](_0x33af19)&&!_[_0xe085('0x6e')](_0x33af19[_0xe085('0x24')])&&!_[_0xe085('0x6e')](_0x33af19[_0xe085('0x6f')])&&_0x33af19[_0xe085('0x6f')]&&!_[_0xe085('0x6e')](this[_0xe085('0xf')][util[_0xe085('0x62')]('SIP/%s',_0x33af19[_0xe085('0x24')])])&&!_[_0xe085('0x6e')](this[_0xe085('0xf')][util[_0xe085('0x62')](_0xe085('0x70'),_0x33af19[_0xe085('0x24')])][_0xe085('0x2e')])&&(this[_0xe085('0xf')][util[_0xe085('0x62')](_0xe085('0x70'),_0x33af19[_0xe085('0x24')])][_0xe085('0x2e')]===_0xe085('0x71')||this[_0xe085('0xf')][util[_0xe085('0x62')](_0xe085('0x70'),_0x33af19[_0xe085('0x24')])]['status']===_0xe085('0x72'));};Fax[_0xe085('0x27')][_0xe085('0x5f')]=function(_0x516bc7,_0x4d969e){if(!this[_0xe085('0x6d')](_0x516bc7)){ut[_0xe085('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x516bc7)?'':_0x516bc7[_0xe085('0x24')]+_0xe085('0x73'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xe085('0x6e')](_0x4d969e['fax'])){ut[_0xe085('0x4c')](_0xe085('0x74'),JSON[_0xe085('0x41')](_0x4d969e));return{'isValid':![],'message':_0xe085('0x75')};}if(_['isNil'](_0x4d969e[_0xe085('0x3')])){ut[_0xe085('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xe085('0x41')](_0x4d969e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe085('0x76')};};Fax[_0xe085('0x27')][_0xe085('0x53')]=function(_0x4b240f,_0x5dc13b=0x2710){if(this[_0xe085('0xd')][_0x4b240f]){setTimeout(()=>{delete this[_0xe085('0xd')][_0x4b240f];},_0x5dc13b);}};module[_0xe085('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b4d3783..704ecf2 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 _0xf300=['resolve','then','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf300,0x100));var _0x0f30=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xf300[_0x55969b];return _0x3d7fc1;};'use strict';var util=require('util');var BPromise=require(_0x0f30('0x0'));var logger=require(_0x0f30('0x1'))(_0x0f30('0x2'));var _=require(_0x0f30('0x3'));var faxAccount=require(_0x0f30('0x4'));function loggerCatch(_0x4d0791){return function(_0x3cc755){logger[_0x0f30('0x5')](_0x4d0791,util[_0x0f30('0x6')](_0x3cc755,{'showHidden':![],'depth':null}));};}exports[_0x0f30('0x7')]=function(_0x41e1dd,_0x1e9dfa){return BPromise[_0x0f30('0x8')]()[_0x0f30('0x9')](faxAccount[_0x0f30('0x7')](_0x41e1dd,_0x1e9dfa))['catch'](loggerCatch(_0x0f30('0xa')));}; \ No newline at end of file +var _0x9d8a=['error','notify','resolve','then','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x26ba11,_0x2fc5ab){var _0x2fb045=function(_0x5e321d){while(--_0x5e321d){_0x26ba11['push'](_0x26ba11['shift']());}};_0x2fb045(++_0x2fc5ab);}(_0x9d8a,0x139));var _0xa9d8=function(_0x18851f,_0x5e8881){_0x18851f=_0x18851f-0x0;var _0x47078c=_0x9d8a[_0x18851f];return _0x47078c;};'use strict';var util=require(_0xa9d8('0x0'));var BPromise=require(_0xa9d8('0x1'));var logger=require(_0xa9d8('0x2'))(_0xa9d8('0x3'));var _=require(_0xa9d8('0x4'));var faxAccount=require(_0xa9d8('0x5'));function loggerCatch(_0x277fe2){return function(_0x561191){logger[_0xa9d8('0x6')](_0x277fe2,util['inspect'](_0x561191,{'showHidden':![],'depth':null}));};}exports[_0xa9d8('0x7')]=function(_0x39e3fd,_0x4c1cb9){return BPromise[_0xa9d8('0x8')]()[_0xa9d8('0x9')](faxAccount[_0xa9d8('0x7')](_0x39e3fd,_0x4c1cb9))[_0xa9d8('0xa')](loggerCatch('[Notify]\x20'));}; \ 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 ed6c555..a9e9e72 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 _0x612a=['execute','info','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird'];(function(_0x2be0eb,_0x1ea79d){var _0x9382f4=function(_0x477675){while(--_0x477675){_0x2be0eb['push'](_0x2be0eb['shift']());}};_0x9382f4(++_0x1ea79d);}(_0x612a,0x170));var _0xa612=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x612a[_0x5d7227];return _0x15ac55;};'use strict';var util=require('util');var logger=require(_0xa612('0x0'))(_0xa612('0x1'));var BPromise=require(_0xa612('0x2'));var exec=require('child_process')['exec'];exports[_0xa612('0x3')]=function(_0x18c4ff){return new BPromise(function(_0x283035,_0x5ab55f){exec(_0x18c4ff,function(_0x4734c1,_0x3c001b,_0x938713){logger['info']('Exec\x20gs',_0x3c001b);if(_0x4734c1){logger[_0xa612('0x4')]('Exec\x20gs',_0xa612('0x5'),util[_0xa612('0x6')](_0x4734c1,{'showHidden':![],'depth':null}),_0x3c001b,_0x938713);_0x5ab55f(_0x4734c1);}_0x283035(_0x3c001b);});});}; \ No newline at end of file +var _0x192c=['info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x192c,0x17c));var _0xc192=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0x192c[_0x21a2b2];return _0x2060b4;};'use strict';var util=require(_0xc192('0x0'));var logger=require(_0xc192('0x1'))(_0xc192('0x2'));var BPromise=require(_0xc192('0x3'));var exec=require(_0xc192('0x4'))[_0xc192('0x5')];exports[_0xc192('0x6')]=function(_0x10e4f4){return new BPromise(function(_0x374425,_0x493994){exec(_0x10e4f4,function(_0x274a1f,_0x1dc726,_0x2007f3){logger[_0xc192('0x7')](_0xc192('0x8'),_0x1dc726);if(_0x274a1f){logger[_0xc192('0x7')](_0xc192('0x8'),'\x20Error\x20:',util['inspect'](_0x274a1f,{'showHidden':![],'depth':null}),_0x1dc726,_0x2007f3);_0x493994(_0x274a1f);}_0x374425(_0x1dc726);});});}; \ 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 0606e48..97bc0e6 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 _0x666c=['headerinfo','localstationid','lodash','fax','message','logger','info','inspect','ecm','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x666c,0xde));var _0xc666=function(_0x5b1c9c,_0x47981a){_0x5b1c9c=_0x5b1c9c-0x0;var _0x977fd3=_0x666c[_0x5b1c9c];return _0x977fd3;};'use strict';var util=require('util');var _=require(_0xc666('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xc666('0x1'));exports[_0xc666('0x2')]=function(_0x14bd9f){return{'message':_0x14bd9f};};exports[_0xc666('0x3')]=function(_0x52e86e,_0x103078){logger[_0xc666('0x4')](_0x52e86e,util[_0xc666('0x5')](_0x103078,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5badfd,_0x35d8dd){var _0x5a7ce1={'XMF-ECM':_0x35d8dd[_0xc666('0x6')],'XMF-HEADERINFO':_0x35d8dd['headerinfo'],'XMF-MINRATE':_0x35d8dd[_0xc666('0x7')],'XMF-MAXRATE':_0x35d8dd['maxrate'],'XMF-MODEM':util[_0xc666('0x8')](_0xc666('0x9'),_0x35d8dd[_0xc666('0xa')]),'XMF-GATEWAY':_0x35d8dd['gateway'],'XMF-FAXDETECT':_0x35d8dd[_0xc666('0xb')],'XMF-T38TIMEOUT':_0x35d8dd[_0xc666('0xc')],'XMF-LOCALSTATIONID':_0x35d8dd['localstationid'],'XMF-PATH':_0x5badfd['path']};return _0x5a7ce1;};exports[_0xc666('0xd')]=function(_0x1f1082,_0xde2a44){return{'actionid':_0x1f1082[_0xc666('0xe')],'action':'originate','channel':_0x1f1082['channel'],'Exten':_0xc666('0xf'),'Context':_0xc666('0x10'),'Priority':'1','callerid':util['format'](_0xc666('0x11'),_0x1f1082[_0xc666('0x12')]?_0x1f1082[_0xc666('0x12')]:'',_0x1f1082[_0xc666('0x13')]),'variable':_0xde2a44,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f1082[_0xc666('0xe')]};}; \ No newline at end of file +var _0x88f3=['headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm'];(function(_0x132421,_0x4b8978){var _0x232c83=function(_0x5e47ab){while(--_0x5e47ab){_0x132421['push'](_0x132421['shift']());}};_0x232c83(++_0x4b8978);}(_0x88f3,0x1f1));var _0x388f=function(_0x506b4d,_0x15745b){_0x506b4d=_0x506b4d-0x0;var _0x4191fc=_0x88f3[_0x506b4d];return _0x4191fc;};'use strict';var util=require('util');var _=require(_0x388f('0x0'));var moment=require(_0x388f('0x1'));var logger=require(_0x388f('0x2'))(_0x388f('0x3'));exports[_0x388f('0x4')]=function(_0x2dd1e3){return{'message':_0x2dd1e3};};exports['logger']=function(_0x13a6ee,_0x79b608){logger[_0x388f('0x5')](_0x13a6ee,util[_0x388f('0x6')](_0x79b608,{'showHidden':![],'depth':null}));};exports[_0x388f('0x7')]=function(_0x469122,_0x214217){var _0x328784={'XMF-ECM':_0x214217[_0x388f('0x8')],'XMF-HEADERINFO':_0x214217[_0x388f('0x9')],'XMF-MINRATE':_0x214217[_0x388f('0xa')],'XMF-MAXRATE':_0x214217[_0x388f('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x214217[_0x388f('0xc')]),'XMF-GATEWAY':_0x214217[_0x388f('0xd')],'XMF-FAXDETECT':_0x214217[_0x388f('0xe')],'XMF-T38TIMEOUT':_0x214217[_0x388f('0xf')],'XMF-LOCALSTATIONID':_0x214217[_0x388f('0x10')],'XMF-PATH':_0x469122['path']};return _0x328784;};exports[_0x388f('0x11')]=function(_0x57e4d7,_0x3dc4b6){return{'actionid':_0x57e4d7[_0x388f('0x12')],'action':'originate','channel':_0x57e4d7[_0x388f('0x13')],'Exten':_0x388f('0x14'),'Context':_0x388f('0x15'),'Priority':'1','callerid':util[_0x388f('0x16')]('\x22%s\x22\x20<%s>',_0x57e4d7[_0x388f('0x9')]?_0x57e4d7[_0x388f('0x9')]:'',_0x57e4d7['localstationid']),'variable':_0x3dc4b6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x57e4d7[_0x388f('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2d78776..b20eeb7 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 _0x75de=['error','[index.js][initParams]','inspect','listen','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x2136a6,_0x467bd7){var _0x5945a6=function(_0x41d96b){while(--_0x41d96b){_0x2136a6['push'](_0x2136a6['shift']());}};_0x5945a6(++_0x467bd7);}(_0x75de,0x1ae));var _0xe75d=function(_0x1a83c8,_0x193672){_0x1a83c8=_0x1a83c8-0x0;var _0x4e21f2=_0x75de[_0x1a83c8];return _0x4e21f2;};'use strict';var util=require(_0xe75d('0x0'));var moment=require(_0xe75d('0x1'));var server=require(_0xe75d('0x2'));var Realtime=require(_0xe75d('0x3'));var Report=require(_0xe75d('0x4'));var Acw=require(_0xe75d('0x5'));var Trigger=require(_0xe75d('0x6'));var Dialer=require(_0xe75d('0x7'));var Preview=require(_0xe75d('0x8'));var Fax=require(_0xe75d('0x9'));var user=require(_0xe75d('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe75d('0xb'));var trigger=require(_0xe75d('0xc'));var template=require(_0xe75d('0xd'));var cmHopperHistory=require(_0xe75d('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe75d('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe75d('0x10'));var salesforce=require(_0xe75d('0x11'));var sugarcrm=require(_0xe75d('0x12'));var freshdesk=require(_0xe75d('0x13'));var desk=require(_0xe75d('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xe75d('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe75d('0x16'))(_0xe75d('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe75d('0x18')](_0xe75d('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe75d('0x18')](_0xe75d('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xe75d('0x1a')]()['then'](user[_0xe75d('0x1b')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x1d')]())[_0xe75d('0x1c')](user[_0xe75d('0x1e')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x1f')]())['then'](trunk[_0xe75d('0x20')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x21')]())[_0xe75d('0x1c')](voiceQueue[_0xe75d('0x22')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x23')]())[_0xe75d('0x1c')](trigger[_0xe75d('0x24')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x25')]())['then'](template['getTemplates']())[_0xe75d('0x1c')](realtime[_0xe75d('0x26')]())['then'](zendesk[_0xe75d('0x27')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x28')]())['then'](salesforce[_0xe75d('0x29')]())[_0xe75d('0x1c')](realtime['initSalesforceAccounts']())[_0xe75d('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xe75d('0x1c')](realtime[_0xe75d('0x2a')]())[_0xe75d('0x1c')](freshdesk[_0xe75d('0x2b')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x2c')]())[_0xe75d('0x1c')](desk[_0xe75d('0x2d')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x2e')]())['then'](zoho['getZohoAccounts']())[_0xe75d('0x1c')](realtime[_0xe75d('0x2f')]())[_0xe75d('0x1c')](vtiger[_0xe75d('0x30')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x31')]())['then'](freshsales[_0xe75d('0x32')]())['then'](realtime[_0xe75d('0x33')]())[_0xe75d('0x1c')](servicenow[_0xe75d('0x34')]())[_0xe75d('0x1c')](realtime['initServicenowAccounts']())[_0xe75d('0x1c')](dynamics365['getDynamics365Accounts']())[_0xe75d('0x1c')](realtime[_0xe75d('0x35')]())[_0xe75d('0x1c')](campaign[_0xe75d('0x36')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x37')]())[_0xe75d('0x1c')](voiceExtension[_0xe75d('0x38')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x39')]())['then'](faxAccount['getFaxAccounts']())[_0xe75d('0x1c')](realtime[_0xe75d('0x3a')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xe75d('0x1a')]()[_0xe75d('0x1c')](voiceQueueReport[_0xe75d('0x3b')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x3c')]())['then'](cmHopperHistory[_0xe75d('0x3d')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x3e')]())[_0xe75d('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xe75d('0x1c')](realtime[_0xe75d('0x3f')]())[_0xe75d('0x1c')](voiceCallReport[_0xe75d('0x40')]())[_0xe75d('0x1c')](realtime[_0xe75d('0x41')]())[_0xe75d('0x42')](function(_0x39cf17){logger[_0xe75d('0x43')](_0xe75d('0x44'),util[_0xe75d('0x45')](_0x39cf17,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe75d('0x46')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe75d('0x42')](function(_0x480126){logger[_0xe75d('0x43')]('[index.js][main]',util['inspect'](_0x480126,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x2b98=['./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','getAgents','then','getTelephones','getTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow'];(function(_0x52ec28,_0x5a3f7a){var _0x115c61=function(_0x3983e7){while(--_0x3983e7){_0x52ec28['push'](_0x52ec28['shift']());}};_0x115c61(++_0x5a3f7a);}(_0x2b98,0xab));var _0x82b9=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2b98[_0x47e7cb];return _0x2a8874;};'use strict';var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0x82b9('0x0'));var Report=require(_0x82b9('0x1'));var Acw=require(_0x82b9('0x2'));var Trigger=require(_0x82b9('0x3'));var Dialer=require(_0x82b9('0x4'));var Preview=require(_0x82b9('0x5'));var Fax=require(_0x82b9('0x6'));var user=require(_0x82b9('0x7'));var voiceQueue=require(_0x82b9('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x82b9('0x9'));var template=require(_0x82b9('0xa'));var cmHopperHistory=require(_0x82b9('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x82b9('0xc'));var faxAccount=require(_0x82b9('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x82b9('0xe'));var sugarcrm=require(_0x82b9('0xf'));var freshdesk=require(_0x82b9('0x10'));var desk=require(_0x82b9('0x11'));var zoho=require(_0x82b9('0x12'));var vtiger=require(_0x82b9('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x82b9('0x14'));var dynamics365=require(_0x82b9('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x82b9('0x16'))(_0x82b9('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x82b9('0x18')](_0x82b9('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x82b9('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()['then'](user[_0x82b9('0x1a')]())[_0x82b9('0x1b')](realtime['initAgents']())[_0x82b9('0x1b')](user[_0x82b9('0x1c')]())[_0x82b9('0x1b')](realtime['initTelephones']())[_0x82b9('0x1b')](trunk[_0x82b9('0x1d')]())[_0x82b9('0x1b')](realtime['initTrunks']())[_0x82b9('0x1b')](voiceQueue[_0x82b9('0x1e')]())[_0x82b9('0x1b')](realtime['initVoiceQueues']())[_0x82b9('0x1b')](trigger['getTriggers']())[_0x82b9('0x1b')](realtime[_0x82b9('0x1f')]())[_0x82b9('0x1b')](template[_0x82b9('0x20')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x21')]())[_0x82b9('0x1b')](zendesk['getZendeskAccounts']())[_0x82b9('0x1b')](realtime[_0x82b9('0x22')]())[_0x82b9('0x1b')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x82b9('0x23')]())[_0x82b9('0x1b')](sugarcrm[_0x82b9('0x24')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x25')]())[_0x82b9('0x1b')](freshdesk[_0x82b9('0x26')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x27')]())[_0x82b9('0x1b')](desk['getDeskAccounts']())['then'](realtime[_0x82b9('0x28')]())[_0x82b9('0x1b')](zoho[_0x82b9('0x29')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x2a')]())[_0x82b9('0x1b')](vtiger[_0x82b9('0x2b')]())['then'](realtime[_0x82b9('0x2c')]())[_0x82b9('0x1b')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x82b9('0x2d')]())[_0x82b9('0x1b')](servicenow[_0x82b9('0x2e')]())[_0x82b9('0x1b')](realtime['initServicenowAccounts']())[_0x82b9('0x1b')](dynamics365[_0x82b9('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x82b9('0x1b')](campaign['getCampaigns']())[_0x82b9('0x1b')](realtime['initCampaigns']())['then'](voiceExtension[_0x82b9('0x30')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x31')]())['then'](faxAccount['getFaxAccounts']())[_0x82b9('0x1b')](realtime[_0x82b9('0x32')]())[_0x82b9('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x82b9('0x33')]()[_0x82b9('0x1b')](voiceQueueReport[_0x82b9('0x34')]())['then'](realtime[_0x82b9('0x35')]())['then'](cmHopperHistory[_0x82b9('0x36')]())[_0x82b9('0x1b')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x82b9('0x37')]())[_0x82b9('0x1b')](realtime[_0x82b9('0x38')]())[_0x82b9('0x1b')](voiceCallReport['getVoiceCallReports']())[_0x82b9('0x1b')](realtime[_0x82b9('0x39')]())[_0x82b9('0x3a')](function(_0x5129e2){logger[_0x82b9('0x3b')](_0x82b9('0x3c'),util[_0x82b9('0x3d')](_0x5129e2,{'showHidden':![],'depth':null}));});}function main(){return server[_0x82b9('0x3e')](realtime,preview,fax)[_0x82b9('0x1b')](function(){return initRealtime();})[_0x82b9('0x1b')](function(){return initParams();})['then'](function(){report[_0x82b9('0x3f')]();setInterval(initRealtime,0x1388);})[_0x82b9('0x3a')](function(_0x5a6d10){logger['error']('[index.js][main]',util['inspect'](_0x5a6d10,{'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 200a79f..ab57da2 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 _0x8cd2=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','mobile','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','inuse','talking','statePause','toNumber','format','stateTime','address','online','interface','onhold','user:%s','emit','omit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8cd2,0x14e));var _0x28cd=function(_0x350f77,_0x12a9b8){_0x350f77=_0x350f77-0x0;var _0x1305b6=_0x8cd2[_0x350f77];return _0x1305b6;};'use strict';var _=require('lodash');var util=require(_0x28cd('0x0'));var moment=require(_0x28cd('0x1'));var md5=require(_0x28cd('0x2'));var Redis=require(_0x28cd('0x3'));var config=require(_0x28cd('0x4'));config[_0x28cd('0x5')]=_[_0x28cd('0x6')](config[_0x28cd('0x5')],{'host':_0x28cd('0x7'),'port':0x18eb});var io=require(_0x28cd('0x8'))(new Redis(config[_0x28cd('0x5')]));function Agent(_0x52d39b){this['id']=_0x52d39b['id']||0x0;this[_0x28cd('0x9')]=_0x52d39b['name']||'';this[_0x28cd('0xa')]=_0x52d39b['email']||'';this[_0x28cd('0xb')]=_0x52d39b['accountcode']||'';this['fullname']=_0x52d39b[_0x28cd('0xc')]||'';this[_0x28cd('0xd')]=_0x28cd('0xe');this['stateTime']=0x0;this[_0x28cd('0xf')]=_0x28cd('0xe');this['address']='';this['phone']='';this[_0x28cd('0x10')]='';this['interface']='';this['online']=_0x52d39b['online']||![];this[_0x28cd('0x11')]=_0x28cd('0xe');this[_0x28cd('0x12')]=0x0;this[_0x28cd('0x13')]='';this[_0x28cd('0x14')]='';this['onhold']=![];this[_0x28cd('0x15')]=![];this[_0x28cd('0x2')]='';}Agent[_0x28cd('0x16')][_0x28cd('0x17')]=function(_0x111f11){var _0x59b63c;if(_0x111f11&&_0x111f11[_0x28cd('0xd')]){_0x59b63c=_0x111f11['state']['toLowerCase']();switch(_0x59b63c){case'not_inuse':_0x59b63c='idle';break;case _0x28cd('0x18'):_0x59b63c=_0x28cd('0x19');break;}}if(_0x59b63c&&this['voiceStatus']!==_0x59b63c||_0x111f11[_0x28cd('0x1a')]){this['voiceStatusTime']=_[_0x28cd('0x1b')](moment()[_0x28cd('0x1c')]('x'));}if(_0x59b63c){this[_0x28cd('0x11')]=_0x59b63c;}var _0x34d152={'id':this['id'],'name':this['name'],'email':this[_0x28cd('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x28cd('0xc')],'state':this[_0x28cd('0xd')],'stateTime':this[_0x28cd('0x1d')],'status':this[_0x28cd('0xf')],'address':this[_0x28cd('0x1e')],'online':this[_0x28cd('0x1f')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x28cd('0x12')],'voiceStatusCallerIdNumber':this[_0x28cd('0x13')],'voiceStatusQueue':this[_0x28cd('0x14')],'interface':this[_0x28cd('0x20')],'onhold':this[_0x28cd('0x21')]};var _0x197b27=md5(JSON['stringify'](_0x34d152));if(this[_0x28cd('0x2')]!==_0x197b27){this['md5']=_0x197b27;io['to'](util[_0x28cd('0x1c')](_0x28cd('0x22'),_0x34d152[_0x28cd('0x9')]))[_0x28cd('0x23')]('user:ami:update',_[_0x28cd('0x24')](_0x34d152,[_0x28cd('0x1f')]));io[_0x28cd('0x23')](_0x28cd('0x25'),_0x34d152);}};module['exports']=Agent; \ No newline at end of file +var _0x06cf=['user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatusTime','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','inuse','talking','voiceStatus','statePause','toNumber','format','address','voiceStatusCallerIdNumber','onhold','stringify','user:%s','emit','omit'];(function(_0xd33500,_0xdb6be5){var _0xfbaa3a=function(_0x16b3c2){while(--_0x16b3c2){_0xd33500['push'](_0xd33500['shift']());}};_0xfbaa3a(++_0xdb6be5);}(_0x06cf,0xce));var _0xf06c=function(_0x59d4b6,_0x4491a6){_0x59d4b6=_0x59d4b6-0x0;var _0x39a612=_0x06cf[_0x59d4b6];return _0x39a612;};'use strict';var _=require(_0xf06c('0x0'));var util=require(_0xf06c('0x1'));var moment=require(_0xf06c('0x2'));var md5=require(_0xf06c('0x3'));var Redis=require(_0xf06c('0x4'));var config=require(_0xf06c('0x5'));config[_0xf06c('0x6')]=_[_0xf06c('0x7')](config[_0xf06c('0x6')],{'host':_0xf06c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf06c('0x6')]));function Agent(_0x4ccdc6){this['id']=_0x4ccdc6['id']||0x0;this[_0xf06c('0x9')]=_0x4ccdc6[_0xf06c('0x9')]||'';this[_0xf06c('0xa')]=_0x4ccdc6[_0xf06c('0xa')]||'';this[_0xf06c('0xb')]=_0x4ccdc6[_0xf06c('0xb')]||'';this[_0xf06c('0xc')]=_0x4ccdc6[_0xf06c('0xc')]||'';this[_0xf06c('0xd')]=_0xf06c('0xe');this[_0xf06c('0xf')]=0x0;this[_0xf06c('0x10')]=_0xf06c('0xe');this['address']='';this[_0xf06c('0x11')]='';this[_0xf06c('0x12')]='';this[_0xf06c('0x13')]='';this[_0xf06c('0x14')]=_0x4ccdc6['online']||![];this['voiceStatus']='unknown';this[_0xf06c('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xf06c('0x16')]='';this['onhold']=![];this[_0xf06c('0x17')]=![];this[_0xf06c('0x3')]='';}Agent[_0xf06c('0x18')][_0xf06c('0x19')]=function(_0x1114e5){var _0x142e6d;if(_0x1114e5&&_0x1114e5['state']){_0x142e6d=_0x1114e5['state'][_0xf06c('0x1a')]();switch(_0x142e6d){case'not_inuse':_0x142e6d='idle';break;case _0xf06c('0x1b'):_0x142e6d=_0xf06c('0x1c');break;}}if(_0x142e6d&&this[_0xf06c('0x1d')]!==_0x142e6d||_0x1114e5[_0xf06c('0x1e')]){this['voiceStatusTime']=_[_0xf06c('0x1f')](moment()[_0xf06c('0x20')]('x'));}if(_0x142e6d){this['voiceStatus']=_0x142e6d;}var _0x2d4be4={'id':this['id'],'name':this[_0xf06c('0x9')],'email':this[_0xf06c('0xa')],'accountcode':this[_0xf06c('0xb')],'fullname':this[_0xf06c('0xc')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xf06c('0x21')],'online':this[_0xf06c('0x14')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xf06c('0x22')],'voiceStatusQueue':this[_0xf06c('0x16')],'interface':this['interface'],'onhold':this[_0xf06c('0x23')]};var _0x566df8=md5(JSON[_0xf06c('0x24')](_0x2d4be4));if(this[_0xf06c('0x3')]!==_0x566df8){this['md5']=_0x566df8;io['to'](util[_0xf06c('0x20')](_0xf06c('0x25'),_0x2d4be4['name']))[_0xf06c('0x26')]('user:ami:update',_[_0xf06c('0x27')](_0x2d4be4,['online']));io['emit'](_0xf06c('0x28'),_0x2d4be4);}};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 0d078d7..8bc46cb 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 _0x0001=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x146214,_0x13482f){var _0x2c2acb=function(_0xb0ad23){while(--_0xb0ad23){_0x146214['push'](_0x146214['shift']());}};_0x2c2acb(++_0x13482f);}(_0x0001,0x78));var _0x1000=function(_0x1ade31,_0x14cfcd){_0x1ade31=_0x1ade31-0x0;var _0x18ed07=_0x0001[_0x1ade31];return _0x18ed07;};'use strict';function Campaign(_0x100dfa){this['id']=_0x100dfa['id']||0x0;this[_0x1000('0x0')]=_0x100dfa[_0x1000('0x0')]||'';this[_0x1000('0x1')]=_0x100dfa['type']||_0x1000('0x2');this[_0x1000('0x3')]=0x0;this[_0x1000('0x4')]=0x0;this[_0x1000('0x5')]=0x0;this[_0x1000('0x6')]=0x0;this[_0x1000('0x7')]='';this[_0x1000('0x8')]=!![];this['active']=_0x100dfa[_0x1000('0x9')];this[_0x1000('0xa')]=_0x100dfa[_0x1000('0xa')];this[_0x1000('0xb')]=_0x100dfa[_0x1000('0xb')]||null;this[_0x1000('0xc')]=_0x100dfa[_0x1000('0xc')]?_0x100dfa['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x100dfa['dialOriginateCallerIdName'];this[_0x1000('0xd')]=_0x100dfa[_0x1000('0xd')];this['dialOriginateTimeout']=_0x100dfa[_0x1000('0xe')]||0x1e;this[_0x1000('0xf')]=_0x100dfa['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x100dfa[_0x1000('0x10')];this[_0x1000('0x11')]=_0x100dfa[_0x1000('0x11')];this[_0x1000('0x12')]=_0x100dfa[_0x1000('0x12')];this[_0x1000('0x13')]=_0x100dfa['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x100dfa['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x100dfa['dialGlobalMaxRetry'];this[_0x1000('0x14')]=_0x100dfa[_0x1000('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x100dfa['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x100dfa[_0x1000('0x15')]||0x3;this[_0x1000('0x16')]=_0x100dfa[_0x1000('0x16')]||0x96;this[_0x1000('0x17')]=_0x100dfa['dialAbandonedMaxRetry']||0x3;this[_0x1000('0x18')]=_0x100dfa[_0x1000('0x18')]||0x96;this['dialMachineMaxRetry']=_0x100dfa[_0x1000('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x100dfa[_0x1000('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x100dfa['dialAgentRejectMaxRetry']||0x3;this[_0x1000('0x1b')]=_0x100dfa['dialAgentRejectRetryFrequency']||0x96;this[_0x1000('0x1c')]=_0x100dfa[_0x1000('0x1c')]||_0x1000('0x1d');this['dialPrefix']=_0x100dfa[_0x1000('0x1e')]||undefined;this[_0x1000('0x1f')]=_0x100dfa[_0x1000('0x1f')]||undefined;this['dialCutDigit']=_0x100dfa[_0x1000('0x20')]||undefined;this['TrunkBackup']=_0x100dfa[_0x1000('0x21')]?_0x100dfa['TrunkBackup']:undefined;this['Trunk']=_0x100dfa[_0x1000('0x22')]?_0x100dfa[_0x1000('0x22')]:undefined;this[_0x1000('0x23')]=_0x100dfa[_0x1000('0x23')]?_0x100dfa['Interval']:undefined;this[_0x1000('0x24')]=_0x100dfa[_0x1000('0x24')]?_0x100dfa[_0x1000('0x24')]:undefined;this['dialQueueProject']=_0x100dfa[_0x1000('0x24')]?_0x100dfa[_0x1000('0x24')]['name']:undefined;this['dialAMDActive']=_0x100dfa[_0x1000('0x25')]||![];this[_0x1000('0x26')]=_0x100dfa[_0x1000('0x26')];this[_0x1000('0x27')]=_0x100dfa[_0x1000('0x27')];this[_0x1000('0x28')]=_0x100dfa[_0x1000('0x28')];this[_0x1000('0x29')]=_0x100dfa[_0x1000('0x29')];this[_0x1000('0x2a')]=_0x100dfa[_0x1000('0x2a')];this['dialAMDBetweenWordsSilence']=_0x100dfa[_0x1000('0x2b')];this[_0x1000('0x2c')]=_0x100dfa['dialAMDMaximumNumberOfWords'];this[_0x1000('0x2d')]=_0x100dfa[_0x1000('0x2d')];this['dialAMDMaximumWordLength']=_0x100dfa[_0x1000('0x2e')];}module[_0x1000('0x2f')]=Campaign; \ No newline at end of file +var _0xfa2b=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x75d849,_0x119548){var _0x2abec8=function(_0xa39cd7){while(--_0xa39cd7){_0x75d849['push'](_0x75d849['shift']());}};_0x2abec8(++_0x119548);}(_0xfa2b,0x1f1));var _0xbfa2=function(_0x4a4039,_0x574a6e){_0x4a4039=_0x4a4039-0x0;var _0x4b5913=_0xfa2b[_0x4a4039];return _0x4b5913;};'use strict';function Campaign(_0x3b7457){this['id']=_0x3b7457['id']||0x0;this[_0xbfa2('0x0')]=_0x3b7457[_0xbfa2('0x0')]||'';this[_0xbfa2('0x1')]=_0x3b7457[_0xbfa2('0x1')]||_0xbfa2('0x2');this[_0xbfa2('0x3')]=0x0;this[_0xbfa2('0x4')]=0x0;this[_0xbfa2('0x5')]=0x0;this[_0xbfa2('0x6')]=0x0;this[_0xbfa2('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xbfa2('0x8')]=_0x3b7457[_0xbfa2('0x8')];this['limitCalls']=_0x3b7457[_0xbfa2('0x9')];this[_0xbfa2('0xa')]=_0x3b7457[_0xbfa2('0xa')]||null;this[_0xbfa2('0xb')]=_0x3b7457['dialGlobalInterval']?_0x3b7457[_0xbfa2('0xb')]:null;this[_0xbfa2('0xc')]=_0x3b7457['dialOriginateCallerIdName'];this[_0xbfa2('0xd')]=_0x3b7457[_0xbfa2('0xd')];this[_0xbfa2('0xe')]=_0x3b7457[_0xbfa2('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x3b7457[_0xbfa2('0xf')];this[_0xbfa2('0x10')]=_0x3b7457[_0xbfa2('0x10')];this[_0xbfa2('0x11')]=_0x3b7457[_0xbfa2('0x11')];this[_0xbfa2('0x12')]=_0x3b7457[_0xbfa2('0x12')];this[_0xbfa2('0x13')]=_0x3b7457[_0xbfa2('0x13')];this['dialNoAnswerRetryFrequency']=_0x3b7457['dialNoAnswerRetryFrequency'];this[_0xbfa2('0x14')]=_0x3b7457[_0xbfa2('0x14')];this[_0xbfa2('0x15')]=_0x3b7457[_0xbfa2('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3b7457[_0xbfa2('0x16')]||0x96;this[_0xbfa2('0x17')]=_0x3b7457[_0xbfa2('0x17')]||0x3;this[_0xbfa2('0x18')]=_0x3b7457[_0xbfa2('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x3b7457[_0xbfa2('0x19')]||0x3;this[_0xbfa2('0x1a')]=_0x3b7457[_0xbfa2('0x1a')]||0x96;this[_0xbfa2('0x1b')]=_0x3b7457[_0xbfa2('0x1b')]||0x3;this[_0xbfa2('0x1c')]=_0x3b7457['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x3b7457[_0xbfa2('0x1d')]||0x3;this[_0xbfa2('0x1e')]=_0x3b7457[_0xbfa2('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x3b7457[_0xbfa2('0x1f')]||_0xbfa2('0x20');this[_0xbfa2('0x21')]=_0x3b7457['dialPrefix']||undefined;this[_0xbfa2('0x22')]=_0x3b7457['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbfa2('0x23')]=_0x3b7457['dialCutDigit']||undefined;this[_0xbfa2('0x24')]=_0x3b7457[_0xbfa2('0x24')]?_0x3b7457['TrunkBackup']:undefined;this[_0xbfa2('0x25')]=_0x3b7457[_0xbfa2('0x25')]?_0x3b7457[_0xbfa2('0x25')]:undefined;this[_0xbfa2('0x26')]=_0x3b7457['Interval']?_0x3b7457['Interval']:undefined;this['SquareProject']=_0x3b7457[_0xbfa2('0x27')]?_0x3b7457[_0xbfa2('0x27')]:undefined;this[_0xbfa2('0x28')]=_0x3b7457[_0xbfa2('0x27')]?_0x3b7457[_0xbfa2('0x27')][_0xbfa2('0x0')]:undefined;this['dialAMDActive']=_0x3b7457[_0xbfa2('0x29')]||![];this[_0xbfa2('0x2a')]=_0x3b7457['dialAMDInitialSilence'];this[_0xbfa2('0x2b')]=_0x3b7457[_0xbfa2('0x2b')];this['dialAMDAfterGreetingSilence']=_0x3b7457[_0xbfa2('0x2c')];this['dialAMDTotalAnalysisTime']=_0x3b7457['dialAMDTotalAnalysisTime'];this[_0xbfa2('0x2d')]=_0x3b7457[_0xbfa2('0x2d')];this[_0xbfa2('0x2e')]=_0x3b7457[_0xbfa2('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x3b7457[_0xbfa2('0x2f')];this[_0xbfa2('0x30')]=_0x3b7457[_0xbfa2('0x30')];this[_0xbfa2('0x31')]=_0x3b7457[_0xbfa2('0x31')];}module[_0xbfa2('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index eba96dc..1396fd4 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 _0x5919=['unmanaged','abandoned','lastdata','duration','tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','accountcode','context','uniqueid','linkedid','exten','answered','endtime'];(function(_0x841dd6,_0x32cb31){var _0x3dcdbf=function(_0x2d39fe){while(--_0x2d39fe){_0x841dd6['push'](_0x841dd6['shift']());}};_0x3dcdbf(++_0x32cb31);}(_0x5919,0x15d));var _0x9591=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x5919[_0x5eef05];return _0x56d4b8;};'use strict';function Channel(){this[_0x9591('0x0')]=null;this[_0x9591('0x1')]='';this['destinationchannel']='';this[_0x9591('0x2')]=0x0;this[_0x9591('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x9591('0x4')]=0x0;this[_0x9591('0x5')]='';this[_0x9591('0x6')]=0x0;this[_0x9591('0x7')]=0x0;this[_0x9591('0x8')]=0x0;this[_0x9591('0x9')]=![];this['answertime']=null;this[_0x9591('0xa')]=null;this[_0x9591('0xb')]=![];this[_0x9591('0xc')]=![];this['lastapplication']='';this[_0x9591('0xd')]='';this[_0x9591('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x9591('0xf')]=null;this[_0x9591('0x10')]=null;this[_0x9591('0x11')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x9591('0x12')]=[];this[_0x9591('0x13')]=undefined;this[_0x9591('0x14')]=undefined;this[_0x9591('0x15')]=undefined;this[_0x9591('0x16')]=0x0;}module[_0x9591('0x17')]=Channel; \ No newline at end of file +var _0xe0dc=['context','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode'];(function(_0x546125,_0xfa3bf){var _0x77b546=function(_0x475555){while(--_0x475555){_0x546125['push'](_0x546125['shift']());}};_0x77b546(++_0xfa3bf);}(_0xe0dc,0x190));var _0xce0d=function(_0x5808f5,_0x17154){_0x5808f5=_0x5808f5-0x0;var _0x51c16d=_0xe0dc[_0x5808f5];return _0x51c16d;};'use strict';function Channel(){this[_0xce0d('0x0')]=null;this['channel']='';this[_0xce0d('0x1')]='';this[_0xce0d('0x2')]=0x0;this['calleridname']='';this[_0xce0d('0x3')]=undefined;this[_0xce0d('0x4')]=undefined;this[_0xce0d('0x5')]=0x0;this[_0xce0d('0x6')]='';this['uniqueid']=0x0;this[_0xce0d('0x7')]=0x0;this['exten']=0x0;this[_0xce0d('0x8')]=![];this[_0xce0d('0x9')]=null;this[_0xce0d('0xa')]=null;this[_0xce0d('0xb')]=![];this[_0xce0d('0xc')]=![];this[_0xce0d('0xd')]='';this[_0xce0d('0xe')]='';this[_0xce0d('0xf')]=0x0;this[_0xce0d('0x10')]=0x0;this[_0xce0d('0x11')]=0x0;this[_0xce0d('0x12')]=null;this[_0xce0d('0x13')]=null;this[_0xce0d('0x14')]=null;this[_0xce0d('0x15')]=![];this[_0xce0d('0x16')]=null;this[_0xce0d('0x17')]=null;this[_0xce0d('0x18')]=[];this[_0xce0d('0x19')]=undefined;this[_0xce0d('0x1a')]=undefined;this['transferType']=undefined;this[_0xce0d('0x1b')]=0x0;}module[_0xce0d('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 32eb98f..faf33d8 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 _0xeaec=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x207187,_0x435f9d){var _0x1ce87f=function(_0x185e02){while(--_0x185e02){_0x207187['push'](_0x207187['shift']());}};_0x1ce87f(++_0x435f9d);}(_0xeaec,0xbe));var _0xceae=function(_0x478271,_0x5b065d){_0x478271=_0x478271-0x0;var _0x524733=_0xeaec[_0x478271];return _0x524733;};'use strict';function DeskAccount(_0x424307){this['id']=_0x424307['id']||0x0;this[_0xceae('0x0')]=_0x424307['name']||'';this[_0xceae('0x1')]=_0x424307[_0xceae('0x1')]||'';this[_0xceae('0x2')]=_0x424307[_0xceae('0x2')]||'';this['authType']=_0x424307['authType']||'';this[_0xceae('0x3')]=_0x424307['password']||'';this[_0xceae('0x4')]=_0x424307['consumerKey']||'';this[_0xceae('0x5')]=_0x424307[_0xceae('0x5')]||'';this[_0xceae('0x6')]=_0x424307['token']||'';this[_0xceae('0x7')]=_0x424307[_0xceae('0x7')]||'';this[_0xceae('0x8')]=_0x424307['type']||'';this['serverUrl']=_0x424307[_0xceae('0x9')]||'';this[_0xceae('0xa')]=_0x424307[_0xceae('0xa')]||{};}module[_0xceae('0xb')]=DeskAccount; \ No newline at end of file +var _0xb0a2=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x24b36c,_0x1be0a7){var _0x418d69=function(_0x2f4e33){while(--_0x2f4e33){_0x24b36c['push'](_0x24b36c['shift']());}};_0x418d69(++_0x1be0a7);}(_0xb0a2,0x114));var _0x2b0a=function(_0x4e1bf6,_0x2242ae){_0x4e1bf6=_0x4e1bf6-0x0;var _0x24fae8=_0xb0a2[_0x4e1bf6];return _0x24fae8;};'use strict';function DeskAccount(_0x3f5822){this['id']=_0x3f5822['id']||0x0;this[_0x2b0a('0x0')]=_0x3f5822['name']||'';this['username']=_0x3f5822[_0x2b0a('0x1')]||'';this[_0x2b0a('0x2')]=_0x3f5822[_0x2b0a('0x2')]||'';this[_0x2b0a('0x3')]=_0x3f5822[_0x2b0a('0x3')]||'';this[_0x2b0a('0x4')]=_0x3f5822[_0x2b0a('0x4')]||'';this[_0x2b0a('0x5')]=_0x3f5822[_0x2b0a('0x5')]||'';this[_0x2b0a('0x6')]=_0x3f5822[_0x2b0a('0x6')]||'';this[_0x2b0a('0x7')]=_0x3f5822[_0x2b0a('0x7')]||'';this[_0x2b0a('0x8')]=_0x3f5822['tokenSecret']||'';this[_0x2b0a('0x9')]=_0x3f5822[_0x2b0a('0x9')]||'';this[_0x2b0a('0xa')]=_0x3f5822[_0x2b0a('0xa')]||'';this[_0x2b0a('0xb')]=_0x3f5822['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5224cb8..e9930a4 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 _0xde12=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x2eee9f,_0x58762a){var _0x3377a6=function(_0x56b5aa){while(--_0x56b5aa){_0x2eee9f['push'](_0x2eee9f['shift']());}};_0x3377a6(++_0x58762a);}(_0xde12,0x158));var _0x2de1=function(_0x5b9d70,_0x1a8208){_0x5b9d70=_0x5b9d70-0x0;var _0x14c43e=_0xde12[_0x5b9d70];return _0x14c43e;};'use strict';function Dynamics365Account(_0x10210a){this['id']=_0x10210a['id']||0x0;this[_0x2de1('0x0')]=_0x10210a['name']||'';this[_0x2de1('0x1')]=_0x10210a[_0x2de1('0x1')]||'';this[_0x2de1('0x2')]=_0x10210a[_0x2de1('0x2')]||'';this[_0x2de1('0x3')]=_0x10210a[_0x2de1('0x3')]||'';this[_0x2de1('0x4')]=_0x10210a[_0x2de1('0x4')]||'';this[_0x2de1('0x5')]=_0x10210a[_0x2de1('0x5')]||'';this[_0x2de1('0x6')]=_0x10210a[_0x2de1('0x6')]||{};this[_0x2de1('0x7')]=_0x10210a['serverUrl']||'';this[_0x2de1('0x8')]=_0x10210a[_0x2de1('0x8')]||![];this[_0x2de1('0x9')]=_0x10210a[_0x2de1('0x9')]||{};this[_0x2de1('0xa')]=_0x10210a[_0x2de1('0xa')]||{};}module[_0x2de1('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x07b3=['username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x1907bd,_0x34aac7){var _0x3a8bcf=function(_0x1a0cc5){while(--_0x1a0cc5){_0x1907bd['push'](_0x1907bd['shift']());}};_0x3a8bcf(++_0x34aac7);}(_0x07b3,0x135));var _0x307b=function(_0x100817,_0x274b80){_0x100817=_0x100817-0x0;var _0x12b7ea=_0x07b3[_0x100817];return _0x12b7ea;};'use strict';function Dynamics365Account(_0x1ffe2a){this['id']=_0x1ffe2a['id']||0x0;this[_0x307b('0x0')]=_0x1ffe2a['name']||'';this['username']=_0x1ffe2a[_0x307b('0x1')]||'';this[_0x307b('0x2')]=_0x1ffe2a[_0x307b('0x2')]||'';this['remoteUri']=_0x1ffe2a[_0x307b('0x3')]||'';this[_0x307b('0x4')]=_0x1ffe2a[_0x307b('0x4')]||'';this['clientId']=_0x1ffe2a[_0x307b('0x5')]||'';this[_0x307b('0x6')]=_0x1ffe2a[_0x307b('0x6')]||{};this['serverUrl']=_0x1ffe2a['serverUrl']||'';this[_0x307b('0x7')]=_0x1ffe2a[_0x307b('0x7')]||![];this[_0x307b('0x8')]=_0x1ffe2a[_0x307b('0x8')]||{};this[_0x307b('0x9')]=_0x1ffe2a['CloudProvider']||{};}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 8cf87b5..f7cbc64 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 _0x7c82=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x2b1e93,_0x379251){var _0xb73cf3=function(_0x55303d){while(--_0x55303d){_0x2b1e93['push'](_0x2b1e93['shift']());}};_0xb73cf3(++_0x379251);}(_0x7c82,0xcc));var _0x27c8=function(_0x257ada,_0x117063){_0x257ada=_0x257ada-0x0;var _0x38bbfd=_0x7c82[_0x257ada];return _0x38bbfd;};'use strict';function FaxAccount(_0xeeddba){this['id']=_0xeeddba['id']||0x0;this[_0x27c8('0x0')]=_0xeeddba[_0x27c8('0x0')]||'';this['description']=_0xeeddba[_0x27c8('0x1')];this['ecm']=_0xeeddba[_0x27c8('0x2')];this[_0x27c8('0x3')]=_0xeeddba[_0x27c8('0x3')];this['localstationid']=_0xeeddba[_0x27c8('0x4')];this[_0x27c8('0x5')]=_0xeeddba[_0x27c8('0x5')]||0x960;this[_0x27c8('0x6')]=_0xeeddba['maxrate']||0x3840;this[_0x27c8('0x7')]=_0xeeddba[_0x27c8('0x7')]||'v17,v27,v29';this[_0x27c8('0x8')]=_0xeeddba[_0x27c8('0x8')]||'no';this[_0x27c8('0x9')]=_0xeeddba[_0x27c8('0x9')]||'no';this['t38timeout']=_0xeeddba[_0x27c8('0xa')]||0x1388;this[_0x27c8('0xb')]=_0xeeddba[_0x27c8('0xb')]||_0x27c8('0xc');this[_0x27c8('0xd')]=_0xeeddba[_0x27c8('0xd')]?_0xeeddba['Trunk']:undefined;this[_0x27c8('0xe')]=_0xeeddba[_0x27c8('0xe')];this[_0x27c8('0xf')]=_0xeeddba[_0x27c8('0xf')];}module[_0x27c8('0x10')]=FaxAccount; \ No newline at end of file +var _0xae4e=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xae4e,0x116));var _0xeae4=function(_0x2ee3a0,_0x53da7d){_0x2ee3a0=_0x2ee3a0-0x0;var _0x2e2a45=_0xae4e[_0x2ee3a0];return _0x2e2a45;};'use strict';function FaxAccount(_0x7cc6bd){this['id']=_0x7cc6bd['id']||0x0;this[_0xeae4('0x0')]=_0x7cc6bd['name']||'';this['description']=_0x7cc6bd[_0xeae4('0x1')];this[_0xeae4('0x2')]=_0x7cc6bd[_0xeae4('0x2')];this[_0xeae4('0x3')]=_0x7cc6bd[_0xeae4('0x3')];this[_0xeae4('0x4')]=_0x7cc6bd[_0xeae4('0x4')];this[_0xeae4('0x5')]=_0x7cc6bd[_0xeae4('0x5')]||0x960;this[_0xeae4('0x6')]=_0x7cc6bd[_0xeae4('0x6')]||0x3840;this[_0xeae4('0x7')]=_0x7cc6bd['modem']||_0xeae4('0x8');this[_0xeae4('0x9')]=_0x7cc6bd[_0xeae4('0x9')]||'no';this[_0xeae4('0xa')]=_0x7cc6bd[_0xeae4('0xa')]||'no';this[_0xeae4('0xb')]=_0x7cc6bd[_0xeae4('0xb')]||0x1388;this[_0xeae4('0xc')]=_0x7cc6bd[_0xeae4('0xc')]||_0xeae4('0xd');this[_0xeae4('0xe')]=_0x7cc6bd[_0xeae4('0xe')]?_0x7cc6bd[_0xeae4('0xe')]:undefined;this[_0xeae4('0xf')]=_0x7cc6bd[_0xeae4('0xf')];this[_0xeae4('0x10')]=_0x7cc6bd[_0xeae4('0x10')];}module[_0xeae4('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2e9c352..9bc6ce2 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 _0x7742=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7742,0x113));var _0x2774=function(_0xe16c95,_0xcf5b2f){_0xe16c95=_0xe16c95-0x0;var _0x38f17f=_0x7742[_0xe16c95];return _0x38f17f;};'use strict';function FreshdeskAccount(_0x3dea58){this['id']=_0x3dea58['id']||0x0;this['name']=_0x3dea58[_0x2774('0x0')]||'';this[_0x2774('0x1')]=_0x3dea58['username']||'';this[_0x2774('0x2')]=_0x3dea58[_0x2774('0x3')]||'';this[_0x2774('0x4')]=_0x3dea58['remoteUri']||'';this[_0x2774('0x5')]=_0x3dea58[_0x2774('0x5')]||'';this['Configurations']=_0x3dea58[_0x2774('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x19dd=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x19dd,0x1b5));var _0xd19d=function(_0x270e77,_0x4628fe){_0x270e77=_0x270e77-0x0;var _0x2d03ac=_0x19dd[_0x270e77];return _0x2d03ac;};'use strict';function FreshdeskAccount(_0x5e02e1){this['id']=_0x5e02e1['id']||0x0;this[_0xd19d('0x0')]=_0x5e02e1['name']||'';this[_0xd19d('0x1')]=_0x5e02e1[_0xd19d('0x1')]||'';this[_0xd19d('0x2')]=_0x5e02e1['token']||'';this[_0xd19d('0x3')]=_0x5e02e1[_0xd19d('0x3')]||'';this['serverUrl']=_0x5e02e1[_0xd19d('0x4')]||'';this[_0xd19d('0x5')]=_0x5e02e1[_0xd19d('0x5')]||{};}module[_0xd19d('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 06c0b3c..abb4e89 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 _0x5031=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0xddeb7e,_0x4fff6e){var _0x2082d2=function(_0x246316){while(--_0x246316){_0xddeb7e['push'](_0xddeb7e['shift']());}};_0x2082d2(++_0x4fff6e);}(_0x5031,0x144));var _0x1503=function(_0x2779a2,_0x29df5b){_0x2779a2=_0x2779a2-0x0;var _0x3745c0=_0x5031[_0x2779a2];return _0x3745c0;};'use strict';function FreshsalesAccount(_0x5d9675){this['id']=_0x5d9675['id']||0x0;this[_0x1503('0x0')]=_0x5d9675[_0x1503('0x0')]||'';this[_0x1503('0x1')]=_0x5d9675[_0x1503('0x1')]||'';this['apiKey']=_0x5d9675['token']||'';this[_0x1503('0x2')]=_0x5d9675[_0x1503('0x2')]||'';this[_0x1503('0x3')]=_0x5d9675[_0x1503('0x3')]||'';this[_0x1503('0x4')]=_0x5d9675[_0x1503('0x4')]||{};}module[_0x1503('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x0be3=['token','remoteUri','serverUrl','exports','name','username'];(function(_0x227c3d,_0x110ffb){var _0x1ec9f4=function(_0x5cd916){while(--_0x5cd916){_0x227c3d['push'](_0x227c3d['shift']());}};_0x1ec9f4(++_0x110ffb);}(_0x0be3,0x9a));var _0x30be=function(_0x376fdb,_0x7d654e){_0x376fdb=_0x376fdb-0x0;var _0xe3c1eb=_0x0be3[_0x376fdb];return _0xe3c1eb;};'use strict';function FreshsalesAccount(_0x1b3dd0){this['id']=_0x1b3dd0['id']||0x0;this['name']=_0x1b3dd0[_0x30be('0x0')]||'';this[_0x30be('0x1')]=_0x1b3dd0[_0x30be('0x1')]||'';this['apiKey']=_0x1b3dd0[_0x30be('0x2')]||'';this['remoteUri']=_0x1b3dd0[_0x30be('0x3')]||'';this[_0x30be('0x4')]=_0x1b3dd0[_0x30be('0x4')]||'';this['Configurations']=_0x1b3dd0['Configurations']||{};}module[_0x30be('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8422ae7..9b14fac 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 _0xd16a=['connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0x2e903c,_0x3c2157){var _0xb65f6b=function(_0x556552){while(--_0x556552){_0x2e903c['push'](_0x2e903c['shift']());}};_0xb65f6b(++_0x3c2157);}(_0xd16a,0xaf));var _0xad16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd16a[_0x20a584];return _0x4b41a8;};'use strict';function QueueReport(){this[_0xad16('0x0')]=_0xad16('0x1');this['uniqueid']='';this[_0xad16('0x2')]='';this[_0xad16('0x3')]='';this[_0xad16('0x4')]='';this[_0xad16('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xad16('0x6')]=0x1;this[_0xad16('0x7')]=![];this['queuecallerabandonAt']=null;this[_0xad16('0x8')]=![];this[_0xad16('0x9')]=null;this[_0xad16('0xa')]=![];this[_0xad16('0xb')]=null;this[_0xad16('0xc')]=0x1;this[_0xad16('0xd')]='';this[_0xad16('0xe')]='';this[_0xad16('0xf')]='';this[_0xad16('0x10')]='';this['context']='';this[_0xad16('0x11')]='';this[_0xad16('0x12')]='';this[_0xad16('0x13')]=0x0;this[_0xad16('0x14')]=![];this[_0xad16('0x15')]='';this[_0xad16('0x16')]=_0xad16('0x17');this[_0xad16('0x18')]=0x0;this[_0xad16('0x19')]={};}module[_0xad16('0x1a')]=QueueReport; \ No newline at end of file +var _0xa889=['priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','count','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','exten'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xa889,0xc5));var _0x9a88=function(_0x5b169,_0x532990){_0x5b169=_0x5b169-0x0;var _0x45620b=_0xa889[_0x5b169];return _0x45620b;};'use strict';function QueueReport(){this['type']=_0x9a88('0x0');this[_0x9a88('0x1')]='';this[_0x9a88('0x2')]='';this[_0x9a88('0x3')]='';this['queue']='';this[_0x9a88('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x9a88('0x5')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x9a88('0x6')]=null;this['queuecallerexit']=![];this[_0x9a88('0x7')]=null;this[_0x9a88('0x8')]=0x1;this['channel']='';this[_0x9a88('0x9')]='';this[_0x9a88('0xa')]='';this[_0x9a88('0xb')]='';this['context']='';this[_0x9a88('0xc')]='';this[_0x9a88('0xd')]='';this[_0x9a88('0xe')]=0x0;this[_0x9a88('0xf')]=![];this[_0x9a88('0x10')]='';this['motionChannel']=_0x9a88('0x11');this[_0x9a88('0x12')]=0x0;this[_0x9a88('0x13')]={};}module[_0x9a88('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 786428e..68d7464 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 _0x127f=['serverUrl','Configurations','exports','name','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0xf29d31,_0x27353b){var _0x123f03=function(_0x176a31){while(--_0x176a31){_0xf29d31['push'](_0xf29d31['shift']());}};_0x123f03(++_0x27353b);}(_0x127f,0xea));var _0xf127=function(_0x1d5c12,_0x12777e){_0x1d5c12=_0x1d5c12-0x0;var _0x553d6f=_0x127f[_0x1d5c12];return _0x553d6f;};'use strict';function SalesforceAccount(_0x38b23b){this['id']=_0x38b23b['id']||0x0;this[_0xf127('0x0')]=_0x38b23b[_0xf127('0x0')]||'';this['username']=_0x38b23b['username']||'';this['remoteUri']=_0x38b23b[_0xf127('0x1')]||'';this[_0xf127('0x2')]=_0x38b23b['password']||'';this[_0xf127('0x3')]=_0x38b23b['clientId']||'';this['clientSecret']=_0x38b23b[_0xf127('0x4')]||'';this[_0xf127('0x5')]=_0x38b23b[_0xf127('0x5')]||'';this[_0xf127('0x6')]=_0x38b23b[_0xf127('0x6')]||_0xf127('0x7');this[_0xf127('0x8')]=_0x38b23b[_0xf127('0x8')]||'';this['Configurations']=_0x38b23b[_0xf127('0x9')]||{};}module[_0xf127('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x5324=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x39878a,_0x3310ea){var _0x376e06=function(_0xfac9f4){while(--_0xfac9f4){_0x39878a['push'](_0x39878a['shift']());}};_0x376e06(++_0x3310ea);}(_0x5324,0x154));var _0x4532=function(_0x48efe8,_0x2a1051){_0x48efe8=_0x48efe8-0x0;var _0x3202f1=_0x5324[_0x48efe8];return _0x3202f1;};'use strict';function SalesforceAccount(_0x23871a){this['id']=_0x23871a['id']||0x0;this[_0x4532('0x0')]=_0x23871a[_0x4532('0x0')]||'';this[_0x4532('0x1')]=_0x23871a['username']||'';this[_0x4532('0x2')]=_0x23871a['remoteUri']||'';this[_0x4532('0x3')]=_0x23871a[_0x4532('0x3')]||'';this[_0x4532('0x4')]=_0x23871a[_0x4532('0x4')]||'';this[_0x4532('0x5')]=_0x23871a[_0x4532('0x5')]||'';this[_0x4532('0x6')]=_0x23871a[_0x4532('0x6')]||'';this['type']=_0x23871a[_0x4532('0x7')]||_0x4532('0x8');this[_0x4532('0x9')]=_0x23871a[_0x4532('0x9')]||'';this[_0x4532('0xa')]=_0x23871a[_0x4532('0xa')]||{};}module[_0x4532('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8124d90..a40bdeb 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 _0xfa6c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x113ad5,_0x3a0b63){var _0x562642=function(_0x3ecadb){while(--_0x3ecadb){_0x113ad5['push'](_0x113ad5['shift']());}};_0x562642(++_0x3a0b63);}(_0xfa6c,0x12a));var _0xcfa6=function(_0xc3cfa1,_0x29f926){_0xc3cfa1=_0xc3cfa1-0x0;var _0x505652=_0xfa6c[_0xc3cfa1];return _0x505652;};'use strict';function ServicenowAccount(_0x3021fb){this['id']=_0x3021fb['id']||0x0;this[_0xcfa6('0x0')]=_0x3021fb[_0xcfa6('0x0')]||'';this[_0xcfa6('0x1')]=_0x3021fb[_0xcfa6('0x1')]||'';this['password']=_0x3021fb[_0xcfa6('0x2')]||'';this[_0xcfa6('0x3')]=_0x3021fb[_0xcfa6('0x3')]||'';this[_0xcfa6('0x4')]=_0x3021fb[_0xcfa6('0x4')]||'';this['Configurations']=_0x3021fb[_0xcfa6('0x5')]||{};}module[_0xcfa6('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb1dd=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x347042,_0x3601e5){var _0x91c699=function(_0x162f8c){while(--_0x162f8c){_0x347042['push'](_0x347042['shift']());}};_0x91c699(++_0x3601e5);}(_0xb1dd,0x99));var _0xdb1d=function(_0x1f271c,_0x370589){_0x1f271c=_0x1f271c-0x0;var _0x27294e=_0xb1dd[_0x1f271c];return _0x27294e;};'use strict';function ServicenowAccount(_0x9ead9){this['id']=_0x9ead9['id']||0x0;this[_0xdb1d('0x0')]=_0x9ead9[_0xdb1d('0x0')]||'';this[_0xdb1d('0x1')]=_0x9ead9[_0xdb1d('0x1')]||'';this[_0xdb1d('0x2')]=_0x9ead9['password']||'';this[_0xdb1d('0x3')]=_0x9ead9[_0xdb1d('0x3')]||'';this[_0xdb1d('0x4')]=_0x9ead9[_0xdb1d('0x4')]||'';this[_0xdb1d('0x5')]=_0x9ead9[_0xdb1d('0x5')]||{};}module[_0xdb1d('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 7a86ecb..1bf5881 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 _0x231d=['serverUrl','Configurations','name','password','remoteUri'];(function(_0x425973,_0x188500){var _0xe00d92=function(_0x572693){while(--_0x572693){_0x425973['push'](_0x425973['shift']());}};_0xe00d92(++_0x188500);}(_0x231d,0x10b));var _0xd231=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x231d[_0x20a584];return _0x4b41a8;};'use strict';function SugarcrmAccount(_0x26e394){this['id']=_0x26e394['id']||0x0;this[_0xd231('0x0')]=_0x26e394[_0xd231('0x0')]||'';this['username']=_0x26e394['username']||'';this[_0xd231('0x1')]=_0x26e394['password']||'';this[_0xd231('0x2')]=_0x26e394[_0xd231('0x2')]||'';this[_0xd231('0x3')]=_0x26e394[_0xd231('0x3')]||'';this['Configurations']=_0x26e394[_0xd231('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x4f1e=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5af2aa,_0x55aa5b){var _0x2f1da2=function(_0x3d4487){while(--_0x3d4487){_0x5af2aa['push'](_0x5af2aa['shift']());}};_0x2f1da2(++_0x55aa5b);}(_0x4f1e,0x1a6));var _0xe4f1=function(_0x2cd8d9,_0x28de29){_0x2cd8d9=_0x2cd8d9-0x0;var _0x224bc6=_0x4f1e[_0x2cd8d9];return _0x224bc6;};'use strict';function SugarcrmAccount(_0x29d212){this['id']=_0x29d212['id']||0x0;this[_0xe4f1('0x0')]=_0x29d212['name']||'';this[_0xe4f1('0x1')]=_0x29d212[_0xe4f1('0x1')]||'';this[_0xe4f1('0x2')]=_0x29d212[_0xe4f1('0x2')]||'';this[_0xe4f1('0x3')]=_0x29d212['remoteUri']||'';this[_0xe4f1('0x4')]=_0x29d212[_0xe4f1('0x4')]||'';this['Configurations']=_0x29d212[_0xe4f1('0x5')]||{};}module[_0xe4f1('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 04e7eb7..aed1595 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 _0x7af2=['exports','name','accountcode','unknown','stateTime','status','address'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x5bd8b3,_0x26a7ac){_0x5bd8b3=_0x5bd8b3-0x0;var _0x323c25=_0x7af2[_0x5bd8b3];return _0x323c25;};'use strict';function Telephone(_0x587613){this['id']=_0x587613['id']||0x0;this[_0x27af('0x0')]=_0x587613[_0x27af('0x0')]||'';this[_0x27af('0x1')]=_0x587613[_0x27af('0x1')]||'';this['state']=_0x27af('0x2');this[_0x27af('0x3')]=0x0;this[_0x27af('0x4')]=_0x27af('0x2');this[_0x27af('0x5')]='';}module[_0x27af('0x6')]=Telephone; \ No newline at end of file +var _0x88c8=['address','exports','name','accountcode','stateTime','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88c8,0x7a));var _0x888c=function(_0x4faf96,_0x489a92){_0x4faf96=_0x4faf96-0x0;var _0x464bd6=_0x88c8[_0x4faf96];return _0x464bd6;};'use strict';function Telephone(_0x269c8a){this['id']=_0x269c8a['id']||0x0;this[_0x888c('0x0')]=_0x269c8a['name']||'';this['accountcode']=_0x269c8a[_0x888c('0x1')]||'';this['state']='unknown';this[_0x888c('0x2')]=0x0;this[_0x888c('0x3')]='unknown';this[_0x888c('0x4')]='';}module[_0x888c('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index bdb8781..e5342cd 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x1d985b,_0x39b2de){var _0x561ed0=function(_0x4f59e5){while(--_0x4f59e5){_0x1d985b['push'](_0x1d985b['shift']());}};_0x561ed0(++_0x39b2de);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bf35e,_0x4ccc17){_0x5bf35e=_0x5bf35e-0x0;var _0x35b3d7=_0xb10b[_0x5bf35e];return _0x35b3d7;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xdbaf9d,_0x5c430c){var _0x29e35b=function(_0xb9709f){while(--_0xb9709f){_0xdbaf9d['push'](_0xdbaf9d['shift']());}};_0x29e35b(++_0x5c430c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 663f307..65ec19d 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x5f3738,_0x2774a4){var _0x1c400e=function(_0x410637){while(--_0x410637){_0x5f3738['push'](_0x5f3738['shift']());}};_0x1c400e(++_0x2774a4);}(_0xda3f,0xec));var _0xfda3=function(_0x1ab7c4,_0x111a4a){_0x1ab7c4=_0x1ab7c4-0x0;var _0x46dca6=_0xda3f[_0x1ab7c4];return _0x46dca6;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x0b0e[_0x33080e];return _0x407395;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ec43823..81b4d8b 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 _0x1aee=['active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser'];(function(_0x19fe15,_0x5dbccb){var _0x384442=function(_0x161b69){while(--_0x161b69){_0x19fe15['push'](_0x19fe15['shift']());}};_0x384442(++_0x5dbccb);}(_0x1aee,0xa0));var _0xe1ae=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x1aee[_0x38841c];return _0x500610;};'use strict';function Trunk(_0x21dad2){this['id']=_0x21dad2['id']||0x0;this[_0xe1ae('0x0')]=_0x21dad2[_0xe1ae('0x0')]||![];this['name']=_0x21dad2[_0xe1ae('0x1')]||'';this[_0xe1ae('0x2')]=_0xe1ae('0x3');this[_0xe1ae('0x4')]=0x0;this['status']=_0xe1ae('0x3');this[_0xe1ae('0x5')]=_0x21dad2[_0xe1ae('0x5')]&&_0x21dad2[_0xe1ae('0x5')][_0xe1ae('0x6')](':')?_0x21dad2[_0xe1ae('0x5')][_0xe1ae('0x7')](':')[0x0]:'';this[_0xe1ae('0x8')]='';this[_0xe1ae('0x9')]='';this[_0xe1ae('0xa')]='';this[_0xe1ae('0xb')]='';this[_0xe1ae('0xc')]='';this[_0xe1ae('0xd')]=_0xe1ae('0x3');this[_0xe1ae('0xe')]='';this['address']='';this['defaultuser']=_0x21dad2[_0xe1ae('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x7be9=['unknown','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x1c5bdd,_0x865bdd){var _0x3a5288=function(_0x3a90c7){while(--_0x3a90c7){_0x1c5bdd['push'](_0x1c5bdd['shift']());}};_0x3a5288(++_0x865bdd);}(_0x7be9,0xa7));var _0x97be=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x7be9[_0x172747];return _0x509692;};'use strict';function Trunk(_0x200243){this['id']=_0x200243['id']||0x0;this['active']=_0x200243[_0x97be('0x0')]||![];this[_0x97be('0x1')]=_0x200243[_0x97be('0x1')]||'';this[_0x97be('0x2')]=_0x97be('0x3');this['stateTime']=0x0;this[_0x97be('0x4')]='unknown';this['registry']=_0x200243[_0x97be('0x5')]&&_0x200243[_0x97be('0x5')][_0x97be('0x6')](':')?_0x200243[_0x97be('0x5')][_0x97be('0x7')](':')[0x0]:'';this[_0x97be('0x8')]='';this[_0x97be('0x9')]='';this['domain']='';this[_0x97be('0xa')]='';this[_0x97be('0xb')]='';this[_0x97be('0xc')]=_0x97be('0x3');this[_0x97be('0xd')]='';this[_0x97be('0xe')]='';this[_0x97be('0xf')]=_0x200243[_0x97be('0xf')]||'';}module[_0x97be('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 83217c4..40d71eb 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 _0x0570=['exports','recordingFormat','none'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0570,0x118));var _0x0057=function(_0x2f558b,_0x5020c4){_0x2f558b=_0x2f558b-0x0;var _0x226eba=_0x0570[_0x2f558b];return _0x226eba;};'use strict';function voiceExtension(_0x137fae){this['id']=_0x137fae['id']||0x0;this['exten']=_0x137fae['exten']||'';this[_0x0057('0x0')]=_0x137fae['recordingFormat']||_0x0057('0x1');this['mandatoryDisposition']=_0x137fae['mandatoryDisposition']||![];}module[_0x0057('0x2')]=voiceExtension; \ No newline at end of file +var _0x40ea=['exten','recordingFormat','exports'];(function(_0x3530e3,_0x5afa79){var _0x19791b=function(_0x4a2ea7){while(--_0x4a2ea7){_0x3530e3['push'](_0x3530e3['shift']());}};_0x19791b(++_0x5afa79);}(_0x40ea,0x1b0));var _0xa40e=function(_0x59d1e5,_0x14a680){_0x59d1e5=_0x59d1e5-0x0;var _0x58f6d3=_0x40ea[_0x59d1e5];return _0x58f6d3;};'use strict';function voiceExtension(_0x2aac05){this['id']=_0x2aac05['id']||0x0;this[_0xa40e('0x0')]=_0x2aac05[_0xa40e('0x0')]||'';this[_0xa40e('0x1')]=_0x2aac05['recordingFormat']||'none';this['mandatoryDisposition']=_0x2aac05['mandatoryDisposition']||![];}module[_0xa40e('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index bd06142..08ba0dc 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 _0x9485=['dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x9485,0x8b));var _0x5948=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x9485[_0x1286d5];return _0x1e06b0;};'use strict';var monitorFormat={'wav':_0x5948('0x0'),'wav49':_0x5948('0x1'),'gsm':_0x5948('0x2')};var strategy={'fewestcalls':_0x5948('0x3'),'leastrecent':'leastrecent','linear':_0x5948('0x4'),'random':_0x5948('0x5'),'ringall':_0x5948('0x6'),'rr':'roundrobin','rrmemory':_0x5948('0x7'),'rrordered':_0x5948('0x8'),'wrandom':_0x5948('0x9')};function VoiceQueue(_0x4312a8){this['id']=_0x4312a8['id']||0x0;this[_0x5948('0xa')]=_0x4312a8[_0x5948('0xa')]||'';this['monitor_format']=_0x4312a8[_0x5948('0xb')]||'';this['type']=_0x4312a8[_0x5948('0xc')]||_0x5948('0xd');this['waiting']=0x0;this[_0x5948('0xe')]=0x0;this[_0x5948('0xf')]=0x0;this['sumDuration']=0x0;this[_0x5948('0x10')]=0x0;this[_0x5948('0x11')]=0x0;this[_0x5948('0x12')]=0x0;this[_0x5948('0x13')]=0x0;this[_0x5948('0x14')]=0x0;this[_0x5948('0x15')]=0x0;this[_0x5948('0x16')]=0x0;this[_0x5948('0x17')]=0x0;this[_0x5948('0x18')]=0x0;this[_0x5948('0x19')]=0x0;this[_0x5948('0x1a')]=0x0;this['paused']=0x0;this[_0x5948('0x1b')]=0x0;this[_0x5948('0x1c')]=0x0;this[_0x5948('0x1d')]=0x0;this[_0x5948('0x1e')]=0x0;this[_0x5948('0x1f')]=0x0;this[_0x5948('0x20')]=_0x4312a8[_0x5948('0x20')]||![];this[_0x5948('0x21')]=_0x4312a8[_0x5948('0x21')]||0xa;this[_0x5948('0x22')]=_0x4312a8[_0x5948('0x22')]||'no';this[_0x5948('0x23')]=!![];this[_0x5948('0x24')]='';this[_0x5948('0x25')]='';this[_0x5948('0x26')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x4312a8['dialTimezone']||null;this[_0x5948('0x27')]=_0x4312a8[_0x5948('0x27')]?_0x4312a8[_0x5948('0x27')]:null;this[_0x5948('0x28')]=_0x4312a8[_0x5948('0x28')];this[_0x5948('0x29')]=_0x4312a8['dialMethod']||_0x5948('0x2a');this[_0x5948('0x2b')]=_0x4312a8[_0x5948('0x2b')]||0x0;this[_0x5948('0x2c')]=_0x4312a8['dialLimitQueue']||0x0;this[_0x5948('0x2d')]=_0x4312a8[_0x5948('0x2d')]||0x1;this[_0x5948('0x2e')]=_0x4312a8[_0x5948('0x2e')]||_0x5948('0x2f');this[_0x5948('0x30')]=_0x4312a8[_0x5948('0x30')]||0.03;this[_0x5948('0x31')]=_0x4312a8[_0x5948('0x31')]||0x258;this[_0x5948('0x32')]=_0x4312a8['dialOriginateCallerIdName']||_0x5948('0x33');this['dialOriginateCallerIdNumber']=_0x4312a8[_0x5948('0x34')]||_0x5948('0x33');this[_0x5948('0x35')]=_0x4312a8[_0x5948('0x35')]||0x1e;this[_0x5948('0x36')]=_0x4312a8[_0x5948('0x36')]||_0x5948('0x37');this[_0x5948('0x38')]=_0x4312a8['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x4312a8['dialQueueProject']||undefined;this[_0x5948('0x39')]=_0x4312a8[_0x5948('0x39')]||0x3;this[_0x5948('0x3a')]=_0x4312a8['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x4312a8[_0x5948('0x3b')]||0x3;this['dialBusyRetryFrequency']=_0x4312a8[_0x5948('0x3c')]||0x96;this['dialNoAnswerMaxRetry']=_0x4312a8[_0x5948('0x3d')]||0x3;this[_0x5948('0x3e')]=_0x4312a8[_0x5948('0x3e')]||0x96;this[_0x5948('0x3f')]=_0x4312a8[_0x5948('0x3f')]||0x3;this[_0x5948('0x40')]=_0x4312a8['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4312a8[_0x5948('0x41')]||0x3;this[_0x5948('0x42')]=_0x4312a8['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x4312a8['dialAbandonedMaxRetry']||0x3;this[_0x5948('0x43')]=_0x4312a8[_0x5948('0x43')]||0x96;this[_0x5948('0x44')]=_0x4312a8[_0x5948('0x44')]||0x3;this['dialMachineRetryFrequency']=_0x4312a8['dialMachineRetryFrequency']||0x96;this[_0x5948('0x45')]=_0x4312a8['dialAgentRejectMaxRetry']||0x3;this[_0x5948('0x46')]=_0x4312a8['dialAgentRejectRetryFrequency']||0x96;this[_0x5948('0x47')]=_0x4312a8[_0x5948('0x47')]||0x3;this[_0x5948('0x48')]=_0x4312a8[_0x5948('0x48')]||0x4;this[_0x5948('0x49')]=_0x4312a8[_0x5948('0x49')]?_0x4312a8[_0x5948('0x49')]:undefined;this[_0x5948('0x4a')]=_0x4312a8[_0x5948('0x4a')]?_0x4312a8[_0x5948('0x4a')]:undefined;this['dialPrefix']=_0x4312a8[_0x5948('0x4b')]||undefined;this[_0x5948('0x4c')]=_0x4312a8['Interval']?_0x4312a8[_0x5948('0x4c')]:undefined;this['dialOrderByScheduledAt']=_0x4312a8[_0x5948('0x4d')]||_0x5948('0x4e');this['dialRandomLastDigitCallerIdNumber']=_0x4312a8[_0x5948('0x4f')]||undefined;this['dialCutDigit']=_0x4312a8[_0x5948('0x50')]||undefined;this[_0x5948('0x51')]=strategy[_0x4312a8[_0x5948('0x51')]];this[_0x5948('0x52')]=!![];this[_0x5948('0x53')]=_0x4312a8[_0x5948('0x53')]||![];this[_0x5948('0x54')]=_0x4312a8[_0x5948('0x54')];this[_0x5948('0x55')]=_0x4312a8[_0x5948('0x55')];this[_0x5948('0x56')]=_0x4312a8['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x4312a8['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4312a8['dialAMDMinWordLength'];this[_0x5948('0x57')]=_0x4312a8[_0x5948('0x57')];this[_0x5948('0x58')]=_0x4312a8['dialAMDMaximumNumberOfWords'];this[_0x5948('0x59')]=_0x4312a8[_0x5948('0x59')];this['dialAMDMaximumWordLength']=_0x4312a8[_0x5948('0x5a')];this['outboundRejectCallsDay']=0x0;this[_0x5948('0x5b')]=0x0;this[_0x5948('0x5c')]=_0x4312a8[_0x5948('0x5c')];this[_0x5948('0x5d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x5948('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x5948('0x5f')]=0x0;this[_0x5948('0x60')]=0x0;this[_0x5948('0x61')]=0x0;this[_0x5948('0x62')]=0x0;this[_0x5948('0x63')]=0x0;this[_0x5948('0x64')]=0x0;this[_0x5948('0x65')]=0x0;this[_0x5948('0x66')]=0x0;this[_0x5948('0x67')]=0x0;this[_0x5948('0x68')]=0x0;this[_0x5948('0x69')]=undefined;this['startPredictive']=undefined;this[_0x5948('0x6a')]=undefined;this[_0x5948('0x6b')]=1.05;this[_0x5948('0x6c')]=0x0;this[_0x5948('0x6d')]=0x0;this[_0x5948('0x6e')]=0x0;this[_0x5948('0x6f')]=0x0;this[_0x5948('0x70')]=0x0;this[_0x5948('0x71')]=0x0;this[_0x5948('0x72')]=0x0;this[_0x5948('0x73')]=0x0;this[_0x5948('0x74')]=_0x4312a8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x5948('0x75')]=_0x4312a8[_0x5948('0x76')]||0xa;this[_0x5948('0x77')]=0x0;this[_0x5948('0x78')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x5948('0x79')]=0x0;this[_0x5948('0x7a')]=0x0;this['erlangBusyFactor']=0x0;this[_0x5948('0x7b')]=_0x4312a8['dialRecallMeTimeout']||0x1e;this[_0x5948('0x7c')]=_0x4312a8[_0x5948('0x7c')]||![];this[_0x5948('0x7d')]=!!_0x4312a8[_0x5948('0x7d')]||![];this['dialPreviewRecallmeReminder']=!!_0x4312a8[_0x5948('0x7e')]||![];this[_0x5948('0x7f')]=_0x4312a8[_0x5948('0x7f')]||undefined;this['dialAgiAfterHangupClient']=_0x4312a8[_0x5948('0x80')]||![];this[_0x5948('0x81')]=_0x4312a8['dialAgiAfterHangupAgent']||![];this[_0x5948('0xb')]=monitorFormat[_0x4312a8[_0x5948('0xb')]]?monitorFormat[_0x4312a8[_0x5948('0xb')]]:undefined;this[_0x5948('0x82')]=_0x4312a8[_0x5948('0x82')]||![];this['mandatoryDispositionPause']=_0x4312a8[_0x5948('0x83')]?_0x4312a8['mandatoryDispositionPause']:undefined;this[_0x5948('0x84')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x27a0=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','linear','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x27a0,0xbf));var _0x027a=function(_0x17f5aa,_0x4cb2bf){_0x17f5aa=_0x17f5aa-0x0;var _0x397374=_0x27a0[_0x17f5aa];return _0x397374;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x027a('0x0'),'gsm':_0x027a('0x1')};var strategy={'fewestcalls':_0x027a('0x2'),'leastrecent':_0x027a('0x3'),'linear':_0x027a('0x4'),'random':'random','ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x027a('0x5'),'wrandom':_0x027a('0x6')};function VoiceQueue(_0x137b09){this['id']=_0x137b09['id']||0x0;this[_0x027a('0x7')]=_0x137b09[_0x027a('0x7')]||'';this[_0x027a('0x8')]=_0x137b09['monitor_format']||'';this[_0x027a('0x9')]=_0x137b09[_0x027a('0x9')]||_0x027a('0xa');this['waiting']=0x0;this[_0x027a('0xb')]=0x0;this[_0x027a('0xc')]=0x0;this[_0x027a('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0x027a('0xe')]=0x0;this[_0x027a('0xf')]=0x0;this[_0x027a('0x10')]=0x0;this[_0x027a('0x11')]=0x0;this[_0x027a('0x12')]=0x0;this[_0x027a('0x13')]=0x0;this[_0x027a('0x14')]=0x0;this[_0x027a('0x15')]=0x0;this[_0x027a('0x16')]=0x0;this[_0x027a('0x17')]=0x0;this[_0x027a('0x18')]=0x0;this['ringing']=0x0;this[_0x027a('0x19')]=0x0;this[_0x027a('0x1a')]=0x0;this[_0x027a('0x1b')]=0x0;this[_0x027a('0x1c')]=0x0;this[_0x027a('0x1d')]=_0x137b09['acw']||![];this['acwTimeout']=_0x137b09[_0x027a('0x1e')]||0xa;this['autopause']=_0x137b09[_0x027a('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this[_0x027a('0x20')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0x027a('0x21')]=_0x137b09[_0x027a('0x21')]||null;this[_0x027a('0x22')]=_0x137b09[_0x027a('0x22')]?_0x137b09['dialGlobalInterval']:null;this[_0x027a('0x23')]=_0x137b09[_0x027a('0x23')];this['dialMethod']=_0x137b09['dialMethod']||_0x027a('0x24');this['dialLimitChannel']=_0x137b09[_0x027a('0x25')]||0x0;this['dialLimitQueue']=_0x137b09['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x137b09['dialPowerLevel']||0x1;this[_0x027a('0x26')]=_0x137b09[_0x027a('0x26')]||_0x027a('0x27');this[_0x027a('0x28')]=_0x137b09['dialPredictiveOptimizationPercentage']||0.03;this[_0x027a('0x29')]=_0x137b09[_0x027a('0x29')]||0x258;this[_0x027a('0x2a')]=_0x137b09[_0x027a('0x2a')]||_0x027a('0x2b');this[_0x027a('0x2c')]=_0x137b09['dialOriginateCallerIdNumber']||_0x027a('0x2b');this['dialOriginateTimeout']=_0x137b09[_0x027a('0x2d')]||0x1e;this[_0x027a('0x2e')]=_0x137b09[_0x027a('0x2e')]||_0x027a('0x2f');this['dialQueueTimeout']=_0x137b09['dialQueueTimeout']||0x3;this[_0x027a('0x30')]=_0x137b09[_0x027a('0x30')]||undefined;this[_0x027a('0x31')]=_0x137b09[_0x027a('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x137b09[_0x027a('0x32')]||0x96;this['dialBusyMaxRetry']=_0x137b09[_0x027a('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x137b09[_0x027a('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x137b09['dialNoAnswerMaxRetry']||0x3;this[_0x027a('0x35')]=_0x137b09['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x137b09[_0x027a('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x137b09[_0x027a('0x37')]||0x96;this['dialDropMaxRetry']=_0x137b09[_0x027a('0x38')]||0x3;this[_0x027a('0x39')]=_0x137b09['dialDropRetryFrequency']||0x96;this[_0x027a('0x3a')]=_0x137b09['dialAbandonedMaxRetry']||0x3;this[_0x027a('0x3b')]=_0x137b09[_0x027a('0x3b')]||0x96;this[_0x027a('0x3c')]=_0x137b09[_0x027a('0x3c')]||0x3;this[_0x027a('0x3d')]=_0x137b09[_0x027a('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x137b09[_0x027a('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x137b09[_0x027a('0x3f')]||0x96;this['callAdditionalPhoneAfterMin']=_0x137b09[_0x027a('0x40')]||0x3;this[_0x027a('0x41')]=_0x137b09[_0x027a('0x41')]||0x4;this[_0x027a('0x42')]=_0x137b09[_0x027a('0x42')]?_0x137b09['Trunk']:undefined;this[_0x027a('0x43')]=_0x137b09[_0x027a('0x43')]?_0x137b09[_0x027a('0x43')]:undefined;this[_0x027a('0x44')]=_0x137b09[_0x027a('0x44')]||undefined;this[_0x027a('0x45')]=_0x137b09[_0x027a('0x45')]?_0x137b09[_0x027a('0x45')]:undefined;this[_0x027a('0x46')]=_0x137b09[_0x027a('0x46')]||_0x027a('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x137b09[_0x027a('0x48')]||undefined;this[_0x027a('0x49')]=_0x137b09[_0x027a('0x49')]||undefined;this[_0x027a('0x4a')]=strategy[_0x137b09[_0x027a('0x4a')]];this[_0x027a('0x4b')]=!![];this[_0x027a('0x4c')]=_0x137b09['dialAMDActive']||![];this[_0x027a('0x4d')]=_0x137b09[_0x027a('0x4d')];this[_0x027a('0x4e')]=_0x137b09['dialAMDGreeting'];this[_0x027a('0x4f')]=_0x137b09['dialAMDAfterGreetingSilence'];this[_0x027a('0x50')]=_0x137b09[_0x027a('0x50')];this[_0x027a('0x51')]=_0x137b09['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x137b09[_0x027a('0x52')];this[_0x027a('0x53')]=_0x137b09['dialAMDMaximumNumberOfWords'];this[_0x027a('0x54')]=_0x137b09[_0x027a('0x54')];this[_0x027a('0x55')]=_0x137b09[_0x027a('0x55')];this[_0x027a('0x56')]=0x0;this[_0x027a('0x57')]=0x0;this[_0x027a('0x58')]=_0x137b09[_0x027a('0x58')];this[_0x027a('0x59')]=0x0;this[_0x027a('0x5a')]=0x0;this[_0x027a('0x5b')]=0x0;this[_0x027a('0x5c')]=0x0;this[_0x027a('0x5d')]=0x0;this[_0x027a('0x5e')]=0x0;this[_0x027a('0x5f')]=0x0;this[_0x027a('0x60')]=0x0;this[_0x027a('0x61')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x027a('0x62')]=0x0;this[_0x027a('0x63')]=0x0;this[_0x027a('0x64')]=0x0;this[_0x027a('0x65')]=0x0;this[_0x027a('0x66')]=undefined;this[_0x027a('0x67')]=undefined;this['handlePredictive']=undefined;this[_0x027a('0x68')]=1.05;this[_0x027a('0x69')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x027a('0x6a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x027a('0x6b')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x027a('0x6c')]=0x0;this[_0x027a('0x6d')]=_0x137b09[_0x027a('0x6e')]||0x14;this[_0x027a('0x6f')]=_0x137b09[_0x027a('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x027a('0x70')]=0x0;this[_0x027a('0x71')]=0x1;this[_0x027a('0x72')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x137b09[_0x027a('0x73')]||0x1e;this[_0x027a('0x74')]=_0x137b09[_0x027a('0x74')]||![];this[_0x027a('0x75')]=!!_0x137b09[_0x027a('0x75')]||![];this[_0x027a('0x76')]=!!_0x137b09['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x137b09[_0x027a('0x77')]||undefined;this[_0x027a('0x78')]=_0x137b09[_0x027a('0x78')]||![];this[_0x027a('0x79')]=_0x137b09[_0x027a('0x79')]||![];this[_0x027a('0x8')]=monitorFormat[_0x137b09[_0x027a('0x8')]]?monitorFormat[_0x137b09[_0x027a('0x8')]]:undefined;this[_0x027a('0x7a')]=_0x137b09['mandatoryDisposition']||![];this[_0x027a('0x7b')]=_0x137b09[_0x027a('0x7b')]?_0x137b09[_0x027a('0x7b')]:undefined;this[_0x027a('0x7c')]=![];}module[_0x027a('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index d74e676..497c3df 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14f=['sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','incall','status','booked','dialer','xcally-motion-preview','prototype','some','compareToOutboundQueue','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xe14f,0xea));var _0xfe14=function(_0x2522d6,_0x419cd4){_0x2522d6=_0x2522d6-0x0;var _0x1c8f89=_0xe14f[_0x2522d6];return _0x1c8f89;};'use strict';var INBOUND_COUNTERS=[_0xfe14('0x0'),_0xfe14('0x1'),_0xfe14('0x2'),_0xfe14('0x3'),_0xfe14('0x4'),_0xfe14('0x5'),_0xfe14('0x6')];var OUTBOUND_COUNTERS=[_0xfe14('0x0'),_0xfe14('0x7'),'inUse','loggedIn',_0xfe14('0x2'),'originated',_0xfe14('0x8'),_0xfe14('0x9'),_0xfe14('0xa'),_0xfe14('0xb'),_0xfe14('0xc'),_0xfe14('0xd'),_0xfe14('0xe'),_0xfe14('0xf'),_0xfe14('0x10'),'outboundUnknownCallsDay',_0xfe14('0x3'),_0xfe14('0x11'),_0xfe14('0x5'),_0xfe14('0x12'),_0xfe14('0x13'),_0xfe14('0x14'),'waiting'];function VoiceQueueSummary(_0x3ae040){this['id']=_0x3ae040['id'];this['name']=_0x3ae040[_0xfe14('0x15')];this[_0xfe14('0x16')]=_0x3ae040[_0xfe14('0x16')];this[_0xfe14('0x17')]=_0x3ae040[_0xfe14('0x17')]||0x0;this[_0xfe14('0x7')]=_0x3ae040['answered']||0x0;this['available']=_0x3ae040[_0xfe14('0x0')]||0x0;this[_0xfe14('0x18')]=_0x3ae040[_0xfe14('0x18')]||0x0;this['inUse']=_0x3ae040[_0xfe14('0x19')]||0x0;this['invalid']=_0x3ae040[_0xfe14('0x1a')]||0x0;this[_0xfe14('0x1')]=_0x3ae040[_0xfe14('0x1')]||0x0;this[_0xfe14('0x2')]=_0x3ae040[_0xfe14('0x2')]||0x0;this[_0xfe14('0x1b')]=_0x3ae040[_0xfe14('0x1b')]||0x0;this[_0xfe14('0x1c')]=_0x3ae040[_0xfe14('0x1c')]||0x0;this['paused']=_0x3ae040['paused']||0x0;this[_0xfe14('0x4')]=_0x3ae040[_0xfe14('0x4')]||0x0;this[_0xfe14('0x1d')]=_0x3ae040[_0xfe14('0x1d')];this[_0xfe14('0x12')]=_0x3ae040[_0xfe14('0x12')];this[_0xfe14('0x13')]=_0x3ae040[_0xfe14('0x13')];this['sumHoldTime']=_0x3ae040[_0xfe14('0x1e')]||0x0;this[_0xfe14('0x5')]=_0x3ae040[_0xfe14('0x5')]||0x0;this[_0xfe14('0x14')]=_0x3ae040[_0xfe14('0x14')]||0x0;this['type']=_0x3ae040[_0xfe14('0x1f')];this[_0xfe14('0x20')]=_0x3ae040[_0xfe14('0x20')]||0x0;this[_0xfe14('0x21')]=_0x3ae040[_0xfe14('0x21')]||0x0;this['unmanaged']=_0x3ae040[_0xfe14('0x22')]||0x0;this[_0xfe14('0x6')]=_0x3ae040[_0xfe14('0x6')]||0x0;if(_0x3ae040[_0xfe14('0x1f')]==='outbound'){this['pTalking']=_0x3ae040[_0xfe14('0x11')]||0x0;this[_0xfe14('0x23')]=_0x3ae040[_0xfe14('0x23')];this[_0xfe14('0x24')]=_0x3ae040[_0xfe14('0x24')];this[_0xfe14('0x25')]=_0x3ae040[_0xfe14('0x25')];this[_0xfe14('0x26')]=_0x3ae040['dialOriginateCallerIdNumber'];this[_0xfe14('0x27')]=_0x3ae040[_0xfe14('0x27')];this[_0xfe14('0x28')]=_0x3ae040[_0xfe14('0x28')];this[_0xfe14('0x29')]=_0x3ae040[_0xfe14('0x29')];this[_0xfe14('0x2a')]=_0x3ae040[_0xfe14('0x2a')];this[_0xfe14('0x9')]=_0x3ae040['outboundAnswerCallsDay'];this[_0xfe14('0xa')]=_0x3ae040[_0xfe14('0xa')];this['outboundBusyCallsDay']=_0x3ae040[_0xfe14('0xb')];this[_0xfe14('0xc')]=_0x3ae040[_0xfe14('0xc')];this[_0xfe14('0x2b')]=_0x3ae040[_0xfe14('0x2b')];this[_0xfe14('0x2c')]=_0x3ae040[_0xfe14('0x2c')];this['outboundDropCallsDayTimeout']=_0x3ae040[_0xfe14('0x2d')];this[_0xfe14('0xd')]=_0x3ae040[_0xfe14('0xd')];this[_0xfe14('0xe')]=_0x3ae040[_0xfe14('0xe')];this[_0xfe14('0x2e')]=_0x3ae040['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x3ae040[_0xfe14('0xf')];this['outboundRejectCallsDay']=_0x3ae040['outboundRejectCallsDay'];this[_0xfe14('0x2f')]=_0x3ae040[_0xfe14('0x2f')];this[_0xfe14('0x30')]=_0x3ae040[_0xfe14('0x30')];this[_0xfe14('0x31')]=_0x3ae040[_0xfe14('0x31')];this[_0xfe14('0x32')]=_0x3ae040['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x3ae040[_0xfe14('0x33')];this[_0xfe14('0x34')]=_0x3ae040[_0xfe14('0x34')];this[_0xfe14('0x35')]=_0x3ae040[_0xfe14('0x35')];this[_0xfe14('0x36')]=_0x3ae040['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x3ae040[_0xfe14('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x3ae040['predictiveIntervalMultiplicativeFactor'];this[_0xfe14('0x38')]=_0x3ae040[_0xfe14('0x38')];this[_0xfe14('0x39')]=_0x3ae040[_0xfe14('0x39')];this[_0xfe14('0x3a')]=_0x3ae040['predictiveIntervalTotalCalls'];this[_0xfe14('0x3b')]=_0x3ae040[_0xfe14('0x3b')];this['erlangCalls']=_0x3ae040[_0xfe14('0x3c')];this[_0xfe14('0x3d')]=_0x3ae040[_0xfe14('0x3d')];this['erlangAbandonmentRate']=_0x3ae040['erlangAbandonmentRate'];this[_0xfe14('0x3e')]=_0x3ae040[_0xfe14('0x3e')];this[_0xfe14('0x3f')]=_0x3ae040[_0xfe14('0x3f')];this[_0xfe14('0x40')]=_0x3ae040[_0xfe14('0x40')];this[_0xfe14('0x41')]=_0x3ae040[_0xfe14('0x41')];this[_0xfe14('0x42')]=_0x3ae040[_0xfe14('0x42')];}if(_0x3ae040[_0xfe14('0x43')]){this['Trunk']={'id':_0x3ae040['Trunk']['id'],'name':_0x3ae040['Trunk'][_0xfe14('0x15')],'active':_0x3ae040['Trunk'][_0xfe14('0x44')],'callerid':_0x3ae040[_0xfe14('0x43')][_0xfe14('0x45')]};}}VoiceQueueSummary['prototype'][_0xfe14('0x46')]=function(_0x229e21,_0x3479c2,_0x2c071b,_0xe48a94){this['loggedInDb']=0x0;this[_0xfe14('0x5')]=0x0;this[_0xfe14('0x3')]=0x0;this[_0xfe14('0x21')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xfe14('0x1a')]=0x0;this[_0xfe14('0x20')]=0x0;this['ringing']=0x0;this[_0xfe14('0x1d')]=0x0;this['onHold']=0x0;if(_0x2c071b){if(_0x2c071b[_0xfe14('0x0')]){this['available']=Number(_0x2c071b[_0xfe14('0x0')]);}if(_0x2c071b['loggedin']){this[_0xfe14('0x1')]=Number(_0x2c071b[_0xfe14('0x47')]);}if(_0x2c071b[_0xfe14('0x48')]){this[_0xfe14('0x6')]=Number(_0x2c071b[_0xfe14('0x48')]);}}for(var _0x3c26d2=0x0;_0x3c26d2<_0x229e21[_0xfe14('0x49')];_0x3c26d2++){var _0x48d51c=_0x3479c2[_0xfe14('0x4a')+_0x229e21[_0x3c26d2][_0xfe14('0x15')]];if(_0x48d51c&&_0x48d51c['online']){this[_0xfe14('0x2')]+=0x1;}if(_0x229e21[_0x3c26d2][_0xfe14('0x4b')]==='1'){this[_0xfe14('0x5')]+=0x1;}if(_0x229e21[_0x3c26d2][_0xfe14('0x3')]==='1'&&!['2','7','8']['includes'](_0x229e21[_0x3c26d2]['status'])){this[_0xfe14('0x3')]+=0x1;}switch(_0x229e21[_0x3c26d2][_0xfe14('0x4c')]){case'0':this[_0xfe14('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xfe14('0x19')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xfe14('0x1a')]+=0x1;break;case'5':this[_0xfe14('0x20')]+=0x1;break;case'6':this[_0xfe14('0x4')]+=0x1;break;case'7':this[_0xfe14('0x1d')]+=0x1;break;case'8':this[_0xfe14('0x1b')]+=0x1;break;}}if(this['dialMethod']===_0xfe14('0x4d')){var _0x21c2f2=Object['keys'](_0xe48a94);for(var _0x427453=0x0;_0x427453<_0x21c2f2[_0xfe14('0x49')];_0x427453++){var _0x4f7160=_0x21c2f2[_0x427453];var _0xc7ae87=_0xe48a94[_0x4f7160];if(_0xc7ae87['queue']===this[_0xfe14('0x15')]&&_0xc7ae87['type']===_0xfe14('0x4e')&&_0xc7ae87['exten']===_0xfe14('0x4f')){this['talking']+=0x1;}}if(this['talking']>this[_0xfe14('0x19')]){this['talking']=this[_0xfe14('0x19')];}this[_0xfe14('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xfe14('0x50')]['compareToInboundQueue']=function(_0x98b6ae){var _0x4f23b8=![];if(_0x98b6ae){_0x4f23b8=INBOUND_COUNTERS[_0xfe14('0x51')](function(_0x4b64d7){return this[_0x4b64d7]!==_0x98b6ae[_0x4b64d7];},this);}return _0x4f23b8;};VoiceQueueSummary[_0xfe14('0x50')][_0xfe14('0x52')]=function(_0x5cd2e6){var _0x365b24=![];var _0x510126=![];var _0x14904e=![];if(_0x5cd2e6){_0x365b24=this[_0xfe14('0x24')]!==_0x5cd2e6['dialMethod']||this[_0xfe14('0x23')]!==_0x5cd2e6[_0xfe14('0x23')]||this[_0xfe14('0x41')]!==_0x5cd2e6[_0xfe14('0x41')]||this[_0xfe14('0x42')]!==_0x5cd2e6['statusMessage'];_0x510126=OUTBOUND_COUNTERS[_0xfe14('0x51')](function(_0x25391b){return this[_0x25391b]!==_0x5cd2e6[_0x25391b];},this);if(this[_0xfe14('0x43')]&&_0x5cd2e6[_0xfe14('0x43')]){_0x14904e=this['Trunk'][_0xfe14('0x15')]!==_0x5cd2e6[_0xfe14('0x43')]['name']||this[_0xfe14('0x43')][_0xfe14('0x44')]!==_0x5cd2e6[_0xfe14('0x43')][_0xfe14('0x44')];}}return _0x365b24||_0x510126||_0x14904e;};VoiceQueueSummary[_0xfe14('0x50')][_0xfe14('0x53')]=function(_0x5bf7a8){this[_0xfe14('0x7')]=_0x5bf7a8['answered'];this[_0xfe14('0x41')]=_0x5bf7a8[_0xfe14('0x41')];this[_0xfe14('0x42')]=_0x5bf7a8[_0xfe14('0x42')];this[_0xfe14('0x3b')]=_0x5bf7a8['originated'];this['outboundAbandonedCallsDay']=_0x5bf7a8['outboundAbandonedCallsDay'];this[_0xfe14('0x9')]=_0x5bf7a8[_0xfe14('0x9')];this[_0xfe14('0xa')]=_0x5bf7a8['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x5bf7a8[_0xfe14('0xb')];this['outboundCongestionCallsDay']=_0x5bf7a8[_0xfe14('0xc')];this[_0xfe14('0xd')]=_0x5bf7a8[_0xfe14('0xd')];this['outboundNoSuchCallsDay']=_0x5bf7a8[_0xfe14('0xe')];this[_0xfe14('0xf')]=_0x5bf7a8[_0xfe14('0xf')];this[_0xfe14('0x10')]=_0x5bf7a8[_0xfe14('0x10')];this[_0xfe14('0x2f')]=_0x5bf7a8[_0xfe14('0x2f')];this['sumBillable']=_0x5bf7a8[_0xfe14('0x12')];this[_0xfe14('0x13')]=_0x5bf7a8['sumDuration'];this[_0xfe14('0x14')]=_0x5bf7a8[_0xfe14('0x14')];if(this['dialMethod']==='preview'){this[_0xfe14('0x11')]=_0x5bf7a8[_0xfe14('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x5075=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','active','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor'];(function(_0xc7925c,_0x30cf47){var _0x2b659c=function(_0x3e88de){while(--_0x3e88de){_0xc7925c['push'](_0xc7925c['shift']());}};_0x2b659c(++_0x30cf47);}(_0x5075,0x73));var _0x5507=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x5075[_0x46111d];return _0xe82586;};'use strict';var INBOUND_COUNTERS=[_0x5507('0x0'),_0x5507('0x1'),_0x5507('0x2'),_0x5507('0x3'),_0x5507('0x4'),_0x5507('0x5'),_0x5507('0x6')];var OUTBOUND_COUNTERS=['available',_0x5507('0x7'),_0x5507('0x8'),_0x5507('0x1'),'loggedInDb','originated',_0x5507('0x9'),_0x5507('0xa'),'outboundBlacklistCallsDay',_0x5507('0xb'),_0x5507('0xc'),_0x5507('0xd'),'outboundNoSuchCallsDay','outboundReCallsDay',_0x5507('0xe'),_0x5507('0xf'),_0x5507('0x3'),_0x5507('0x10'),'talking',_0x5507('0x11'),_0x5507('0x12'),'total',_0x5507('0x6')];function VoiceQueueSummary(_0x5fbe08){this['id']=_0x5fbe08['id'];this['name']=_0x5fbe08[_0x5507('0x13')];this[_0x5507('0x14')]=_0x5fbe08[_0x5507('0x14')];this[_0x5507('0x15')]=_0x5fbe08[_0x5507('0x15')]||0x0;this[_0x5507('0x7')]=_0x5fbe08['answered']||0x0;this[_0x5507('0x0')]=_0x5fbe08[_0x5507('0x0')]||0x0;this[_0x5507('0x16')]=_0x5fbe08[_0x5507('0x16')]||0x0;this['inUse']=_0x5fbe08[_0x5507('0x8')]||0x0;this[_0x5507('0x17')]=_0x5fbe08[_0x5507('0x17')]||0x0;this[_0x5507('0x1')]=_0x5fbe08[_0x5507('0x1')]||0x0;this[_0x5507('0x2')]=_0x5fbe08[_0x5507('0x2')]||0x0;this[_0x5507('0x18')]=_0x5fbe08[_0x5507('0x18')]||0x0;this[_0x5507('0x19')]=_0x5fbe08[_0x5507('0x19')]||0x0;this[_0x5507('0x3')]=_0x5fbe08[_0x5507('0x3')]||0x0;this['ringing']=_0x5fbe08[_0x5507('0x4')]||0x0;this[_0x5507('0x1a')]=_0x5fbe08[_0x5507('0x1a')];this[_0x5507('0x11')]=_0x5fbe08['sumBillable'];this[_0x5507('0x12')]=_0x5fbe08[_0x5507('0x12')];this[_0x5507('0x1b')]=_0x5fbe08[_0x5507('0x1b')]||0x0;this[_0x5507('0x5')]=_0x5fbe08[_0x5507('0x5')]||0x0;this['total']=_0x5fbe08[_0x5507('0x1c')]||0x0;this[_0x5507('0x1d')]=_0x5fbe08[_0x5507('0x1d')];this[_0x5507('0x1e')]=_0x5fbe08[_0x5507('0x1e')]||0x0;this[_0x5507('0x1f')]=_0x5fbe08[_0x5507('0x1f')]||0x0;this[_0x5507('0x20')]=_0x5fbe08[_0x5507('0x20')]||0x0;this[_0x5507('0x6')]=_0x5fbe08[_0x5507('0x6')]||0x0;if(_0x5fbe08[_0x5507('0x1d')]===_0x5507('0x21')){this[_0x5507('0x10')]=_0x5fbe08[_0x5507('0x10')]||0x0;this['dialActive']=_0x5fbe08[_0x5507('0x22')];this['dialMethod']=_0x5fbe08[_0x5507('0x23')];this['dialOriginateCallerIdName']=_0x5fbe08[_0x5507('0x24')];this[_0x5507('0x25')]=_0x5fbe08['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x5fbe08[_0x5507('0x26')];this[_0x5507('0x27')]=_0x5fbe08['dialPrefix'];this[_0x5507('0x28')]=_0x5fbe08[_0x5507('0x28')];this[_0x5507('0x29')]=_0x5fbe08[_0x5507('0x29')];this[_0x5507('0xa')]=_0x5fbe08[_0x5507('0xa')];this['outboundBlacklistCallsDay']=_0x5fbe08[_0x5507('0x2a')];this[_0x5507('0xb')]=_0x5fbe08[_0x5507('0xb')];this[_0x5507('0xc')]=_0x5fbe08[_0x5507('0xc')];this['outboundDropCallsDayACS']=_0x5fbe08['outboundDropCallsDayACS'];this[_0x5507('0x2b')]=_0x5fbe08[_0x5507('0x2b')];this[_0x5507('0x2c')]=_0x5fbe08[_0x5507('0x2c')];this['outboundNoAnswerCallsDay']=_0x5fbe08[_0x5507('0xd')];this[_0x5507('0x2d')]=_0x5fbe08[_0x5507('0x2d')];this[_0x5507('0x2e')]=_0x5fbe08[_0x5507('0x2e')];this[_0x5507('0x2f')]=_0x5fbe08[_0x5507('0x2f')];this[_0x5507('0xe')]=_0x5fbe08['outboundRejectCallsDay'];this[_0x5507('0xf')]=_0x5fbe08[_0x5507('0xf')];this[_0x5507('0x30')]=_0x5fbe08['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x5fbe08[_0x5507('0x31')];this[_0x5507('0x32')]=_0x5fbe08[_0x5507('0x32')];this[_0x5507('0x33')]=_0x5fbe08[_0x5507('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x5fbe08['predictiveIntervalDroppedCallsTimeout'];this[_0x5507('0x34')]=_0x5fbe08[_0x5507('0x34')];this[_0x5507('0x35')]=_0x5fbe08[_0x5507('0x35')];this['predictiveIntervalHitRate']=_0x5fbe08['predictiveIntervalHitRate'];this[_0x5507('0x36')]=_0x5fbe08['predictiveIntervalMultiplicativeFactor'];this[_0x5507('0x37')]=_0x5fbe08[_0x5507('0x37')];this[_0x5507('0x38')]=_0x5fbe08[_0x5507('0x38')];this[_0x5507('0x39')]=_0x5fbe08[_0x5507('0x39')];this[_0x5507('0x3a')]=_0x5fbe08[_0x5507('0x3a')];this[_0x5507('0x3b')]=_0x5fbe08[_0x5507('0x3b')];this['erlangCallToSecond']=_0x5fbe08['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x5fbe08['erlangAbandonmentRate'];this[_0x5507('0x3c')]=_0x5fbe08[_0x5507('0x3c')];this[_0x5507('0x3d')]=_0x5fbe08[_0x5507('0x3d')];this[_0x5507('0x3e')]=_0x5fbe08[_0x5507('0x3e')];this[_0x5507('0x3f')]=_0x5fbe08[_0x5507('0x3f')];this[_0x5507('0x40')]=_0x5fbe08[_0x5507('0x40')];}if(_0x5fbe08[_0x5507('0x41')]){this[_0x5507('0x41')]={'id':_0x5fbe08[_0x5507('0x41')]['id'],'name':_0x5fbe08[_0x5507('0x41')]['name'],'active':_0x5fbe08['Trunk']['active'],'callerid':_0x5fbe08[_0x5507('0x41')][_0x5507('0x42')]};}}VoiceQueueSummary[_0x5507('0x43')][_0x5507('0x44')]=function(_0xcd4df5,_0x17d7db,_0x340c4c,_0x371136){this[_0x5507('0x2')]=0x0;this[_0x5507('0x5')]=0x0;this[_0x5507('0x3')]=0x0;this[_0x5507('0x1f')]=0x0;this[_0x5507('0x19')]=0x0;this[_0x5507('0x8')]=0x0;this[_0x5507('0x16')]=0x0;this[_0x5507('0x17')]=0x0;this[_0x5507('0x1e')]=0x0;this[_0x5507('0x4')]=0x0;this[_0x5507('0x1a')]=0x0;this['onHold']=0x0;if(_0x340c4c){if(_0x340c4c[_0x5507('0x0')]){this[_0x5507('0x0')]=Number(_0x340c4c['available']);}if(_0x340c4c['loggedin']){this[_0x5507('0x1')]=Number(_0x340c4c[_0x5507('0x45')]);}if(_0x340c4c[_0x5507('0x46')]){this[_0x5507('0x6')]=Number(_0x340c4c[_0x5507('0x46')]);}}for(var _0x54be04=0x0;_0x54be04<_0xcd4df5[_0x5507('0x47')];_0x54be04++){var _0x39ac17=_0x17d7db[_0x5507('0x48')+_0xcd4df5[_0x54be04]['name']];if(_0x39ac17&&_0x39ac17[_0x5507('0x49')]){this[_0x5507('0x2')]+=0x1;}if(_0xcd4df5[_0x54be04][_0x5507('0x4a')]==='1'){this[_0x5507('0x5')]+=0x1;}if(_0xcd4df5[_0x54be04][_0x5507('0x3')]==='1'&&!['2','7','8']['includes'](_0xcd4df5[_0x54be04][_0x5507('0x4b')])){this['paused']+=0x1;}switch(_0xcd4df5[_0x54be04][_0x5507('0x4b')]){case'0':this[_0x5507('0x1f')]+=0x1;break;case'1':this[_0x5507('0x19')]+=0x1;break;case'2':this[_0x5507('0x8')]+=0x1;break;case'3':this[_0x5507('0x16')]+=0x1;break;case'4':this[_0x5507('0x17')]+=0x1;break;case'5':this[_0x5507('0x1e')]+=0x1;break;case'6':this[_0x5507('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x5507('0x18')]+=0x1;break;}}if(this[_0x5507('0x23')]==='booked'){var _0x4a2d14=Object['keys'](_0x371136);for(var _0x39b20f=0x0;_0x39b20f<_0x4a2d14['length'];_0x39b20f++){var _0x403d03=_0x4a2d14[_0x39b20f];var _0x4e53fa=_0x371136[_0x403d03];if(_0x4e53fa[_0x5507('0x4c')]===this['name']&&_0x4e53fa['type']===_0x5507('0x4d')&&_0x4e53fa[_0x5507('0x4e')]===_0x5507('0x4f')){this[_0x5507('0x5')]+=0x1;}}if(this[_0x5507('0x5')]>this[_0x5507('0x8')]){this['talking']=this[_0x5507('0x8')];}this[_0x5507('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x5507('0x43')]['compareToInboundQueue']=function(_0x1ec672){var _0xe4b14c=![];if(_0x1ec672){_0xe4b14c=INBOUND_COUNTERS[_0x5507('0x50')](function(_0x2e0cfc){return this[_0x2e0cfc]!==_0x1ec672[_0x2e0cfc];},this);}return _0xe4b14c;};VoiceQueueSummary[_0x5507('0x43')][_0x5507('0x51')]=function(_0x352001){var _0x34f197=![];var _0x4674f9=![];var _0x245456=![];if(_0x352001){_0x34f197=this[_0x5507('0x23')]!==_0x352001['dialMethod']||this['dialActive']!==_0x352001[_0x5507('0x22')]||this[_0x5507('0x3f')]!==_0x352001[_0x5507('0x3f')]||this[_0x5507('0x40')]!==_0x352001[_0x5507('0x40')];_0x4674f9=OUTBOUND_COUNTERS[_0x5507('0x50')](function(_0x18b566){return this[_0x18b566]!==_0x352001[_0x18b566];},this);if(this[_0x5507('0x41')]&&_0x352001[_0x5507('0x41')]){_0x245456=this[_0x5507('0x41')][_0x5507('0x13')]!==_0x352001[_0x5507('0x41')][_0x5507('0x13')]||this[_0x5507('0x41')][_0x5507('0x52')]!==_0x352001[_0x5507('0x41')]['active'];}}return _0x34f197||_0x4674f9||_0x245456;};VoiceQueueSummary[_0x5507('0x43')]['updateReportFromOutboundQueue']=function(_0x5af5f5){this[_0x5507('0x7')]=_0x5af5f5[_0x5507('0x7')];this[_0x5507('0x3f')]=_0x5af5f5[_0x5507('0x3f')];this['statusMessage']=_0x5af5f5[_0x5507('0x40')];this[_0x5507('0x3a')]=_0x5af5f5[_0x5507('0x3a')];this[_0x5507('0x9')]=_0x5af5f5[_0x5507('0x9')];this[_0x5507('0xa')]=_0x5af5f5['outboundAnswerCallsDay'];this[_0x5507('0x2a')]=_0x5af5f5[_0x5507('0x2a')];this[_0x5507('0xb')]=_0x5af5f5['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x5af5f5[_0x5507('0xc')];this['outboundNoAnswerCallsDay']=_0x5af5f5[_0x5507('0xd')];this[_0x5507('0x2d')]=_0x5af5f5['outboundNoSuchCallsDay'];this[_0x5507('0x2f')]=_0x5af5f5[_0x5507('0x2f')];this[_0x5507('0xe')]=_0x5af5f5[_0x5507('0xe')];this[_0x5507('0xf')]=_0x5af5f5[_0x5507('0xf')];this[_0x5507('0x11')]=_0x5af5f5[_0x5507('0x11')];this[_0x5507('0x12')]=_0x5af5f5[_0x5507('0x12')];this[_0x5507('0x1c')]=_0x5af5f5[_0x5507('0x1c')];if(this['dialMethod']===_0x5507('0x53')){this[_0x5507('0x10')]=_0x5af5f5[_0x5507('0x10')];}};module[_0x5507('0x54')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f8deab9..35acf77 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 _0x17be=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x17aa7a,_0x2be8e4){var _0x2321f8=function(_0x2324fc){while(--_0x2324fc){_0x17aa7a['push'](_0x17aa7a['shift']());}};_0x2321f8(++_0x2be8e4);}(_0x17be,0xb6));var _0xe17b=function(_0x62e597,_0x16f167){_0x62e597=_0x62e597-0x0;var _0x33cf0d=_0x17be[_0x62e597];return _0x33cf0d;};'use strict';function VtigerAccount(_0xa391b){this['id']=_0xa391b['id']||0x0;this[_0xe17b('0x0')]=_0xa391b[_0xe17b('0x0')]||'';this[_0xe17b('0x1')]=_0xa391b[_0xe17b('0x1')]||'';this[_0xe17b('0x2')]=_0xa391b[_0xe17b('0x2')]||'';this[_0xe17b('0x3')]=_0xa391b[_0xe17b('0x3')]||'';this['serverUrl']=_0xa391b[_0xe17b('0x4')]||'';this[_0xe17b('0x5')]=_0xa391b[_0xe17b('0x5')]||{};}module[_0xe17b('0x6')]=VtigerAccount; \ No newline at end of file +var _0x19a8=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x27cfc5,_0x630ac4){var _0x21eb36=function(_0x67e00d){while(--_0x67e00d){_0x27cfc5['push'](_0x27cfc5['shift']());}};_0x21eb36(++_0x630ac4);}(_0x19a8,0xef));var _0x819a=function(_0x26ce01,_0x34e617){_0x26ce01=_0x26ce01-0x0;var _0x1770b8=_0x19a8[_0x26ce01];return _0x1770b8;};'use strict';function VtigerAccount(_0x71502){this['id']=_0x71502['id']||0x0;this[_0x819a('0x0')]=_0x71502[_0x819a('0x0')]||'';this[_0x819a('0x1')]=_0x71502['username']||'';this[_0x819a('0x2')]=_0x71502[_0x819a('0x2')]||'';this[_0x819a('0x3')]=_0x71502[_0x819a('0x3')]||'';this[_0x819a('0x4')]=_0x71502['serverUrl']||'';this[_0x819a('0x5')]=_0x71502[_0x819a('0x5')]||{};}module[_0x819a('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 ab0ad00..b7ad407 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 _0x6281=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0xd90971,_0x31beda){var _0x2795b6=function(_0x173298){while(--_0x173298){_0xd90971['push'](_0xd90971['shift']());}};_0x2795b6(++_0x31beda);}(_0x6281,0x1cf));var _0x1628=function(_0x11062a,_0x286e8d){_0x11062a=_0x11062a-0x0;var _0x511a54=_0x6281[_0x11062a];return _0x511a54;};'use strict';function ZendeskAccount(_0x28abfc){this['id']=_0x28abfc['id']||0x0;this[_0x1628('0x0')]=_0x28abfc[_0x1628('0x0')]||'';this[_0x1628('0x1')]=_0x28abfc[_0x1628('0x1')]||'';this['password']=_0x28abfc[_0x1628('0x2')]||'';this[_0x1628('0x3')]=_0x28abfc['token']||'';this[_0x1628('0x4')]=_0x28abfc[_0x1628('0x4')]||'';this[_0x1628('0x5')]=_0x28abfc[_0x1628('0x5')]||'';this[_0x1628('0x6')]=_0x28abfc['type']||_0x1628('0x7');this[_0x1628('0x8')]=_0x28abfc[_0x1628('0x8')]||'';this['Configurations']=_0x28abfc[_0x1628('0x9')]||{};}module[_0x1628('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xbd53=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x31fb93,_0x12c7f2){var _0x10b4ee=function(_0x452911){while(--_0x452911){_0x31fb93['push'](_0x31fb93['shift']());}};_0x10b4ee(++_0x12c7f2);}(_0xbd53,0x10b));var _0x3bd5=function(_0x4c5353,_0x45cd75){_0x4c5353=_0x4c5353-0x0;var _0x2713ee=_0xbd53[_0x4c5353];return _0x2713ee;};'use strict';function ZendeskAccount(_0x3faca9){this['id']=_0x3faca9['id']||0x0;this[_0x3bd5('0x0')]=_0x3faca9[_0x3bd5('0x0')]||'';this[_0x3bd5('0x1')]=_0x3faca9[_0x3bd5('0x1')]||'';this[_0x3bd5('0x2')]=_0x3faca9['password']||'';this[_0x3bd5('0x3')]=_0x3faca9[_0x3bd5('0x3')]||'';this[_0x3bd5('0x4')]=_0x3faca9[_0x3bd5('0x4')]||'';this['authType']=_0x3faca9[_0x3bd5('0x5')]||'';this[_0x3bd5('0x6')]=_0x3faca9[_0x3bd5('0x6')]||_0x3bd5('0x7');this['serverUrl']=_0x3faca9[_0x3bd5('0x8')]||'';this[_0x3bd5('0x9')]=_0x3faca9[_0x3bd5('0x9')]||{};}module[_0x3bd5('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ecf6ca9..2262b0e 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 _0x2163=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x5b71c7,_0x3c70a3){var _0x1c760d=function(_0x1493c8){while(--_0x1493c8){_0x5b71c7['push'](_0x5b71c7['shift']());}};_0x1c760d(++_0x3c70a3);}(_0x2163,0x98));var _0x3216=function(_0x5359ea,_0x1ca760){_0x5359ea=_0x5359ea-0x0;var _0x58d772=_0x2163[_0x5359ea];return _0x58d772;};'use strict';function ZohoAccount(_0x2ac4d2){this['id']=_0x2ac4d2['id']||0x0;this[_0x3216('0x0')]=_0x2ac4d2['name']||'';this[_0x3216('0x1')]=_0x2ac4d2[_0x3216('0x1')]||'';this[_0x3216('0x2')]=_0x2ac4d2[_0x3216('0x2')]||'';this[_0x3216('0x3')]=_0x2ac4d2[_0x3216('0x3')]||'';this['clientId']=_0x2ac4d2[_0x3216('0x4')]||'';this[_0x3216('0x5')]=_0x2ac4d2[_0x3216('0x5')]||'';this['serverUrl']=_0x2ac4d2[_0x3216('0x6')]||'';this[_0x3216('0x7')]=_0x2ac4d2['code']||'';this[_0x3216('0x8')]=_0x2ac4d2[_0x3216('0x8')]||'';this[_0x3216('0x9')]=_0x2ac4d2[_0x3216('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x2a26=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x17664d,_0x4617b2){var _0x1af766=function(_0x349b2d){while(--_0x349b2d){_0x17664d['push'](_0x17664d['shift']());}};_0x1af766(++_0x4617b2);}(_0x2a26,0xcf));var _0x62a2=function(_0x70bb8,_0x1da278){_0x70bb8=_0x70bb8-0x0;var _0x48ba84=_0x2a26[_0x70bb8];return _0x48ba84;};'use strict';function ZohoAccount(_0x30f90){this['id']=_0x30f90['id']||0x0;this[_0x62a2('0x0')]=_0x30f90['name']||'';this['description']=_0x30f90[_0x62a2('0x1')]||'';this[_0x62a2('0x2')]=_0x30f90[_0x62a2('0x2')]||'';this['zone']=_0x30f90[_0x62a2('0x3')]||'';this[_0x62a2('0x4')]=_0x30f90['clientId']||'';this[_0x62a2('0x5')]=_0x30f90[_0x62a2('0x5')]||'';this[_0x62a2('0x6')]=_0x30f90[_0x62a2('0x6')]||'';this['code']=_0x30f90[_0x62a2('0x7')]||'';this['refreshToken']=_0x30f90[_0x62a2('0x8')]||'';this[_0x62a2('0x9')]=_0x30f90[_0x62a2('0x9')]||{};}module[_0x62a2('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f3d9504..a37e678 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 _0x47c5=['originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x169585,_0x476cc6){var _0x5cf666=function(_0x4f7106){while(--_0x4f7106){_0x169585['push'](_0x169585['shift']());}};_0x5cf666(++_0x476cc6);}(_0x47c5,0x165));var _0x547c=function(_0x4b13ee,_0x587562){_0x4b13ee=_0x4b13ee-0x0;var _0x190d07=_0x47c5[_0x4b13ee];return _0x190d07;};'use strict';var util=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));function checkNameSurname(_0x123697,_0x5fe74c,_0x3260c8){var _0x500b86='';if(!_[_0x547c('0x3')](_0x5fe74c)&&_0x547c('0x4')===typeof _0x5fe74c){_0x500b86+=_0x5fe74c;}if(!_['isNil'](_0x3260c8)&&_0x547c('0x4')===typeof _0x3260c8){_0x500b86+='\x20'+_0x3260c8;}if(_0x500b86!==''){return _0x500b86;}return _0x123697;}function Action(_0x468220,_0x51ab7f,_0x2e5b57,_0x439f25,_0x381f2e){this[_0x547c('0x5')]=_0x2e5b57||undefined;this[_0x547c('0x6')]=_0x468220['id'];this[_0x547c('0x7')]=_0x51ab7f[_0x547c('0x8')];this[_0x547c('0x9')]=_0x51ab7f[_0x547c('0x9')];this[_0x547c('0xa')]=_0x547c('0x7');this[_0x547c('0xb')]=![];this[_0x547c('0xc')]=_[_0x547c('0x3')](_0x468220[_0x547c('0xd')])?undefined:_0x468220[_0x547c('0xd')][_0x547c('0x8')];this['channelAgent']=this[_0x547c('0xc')]?util[_0x547c('0xe')]('SIP/%s',this[_0x547c('0xc')]):_0x439f25||undefined;this[_0x547c('0xf')]=checkNameSurname(_0x468220[_0x547c('0x10')][_0x547c('0x11')],_0x468220[_0x547c('0x10')][_0x547c('0x12')],_0x468220[_0x547c('0x10')][_0x547c('0x13')]);this[_0x547c('0x14')]=_0x468220[_0x547c('0x14')]||![];this[_0x547c('0x15')]=_0x468220[_0x547c('0x11')];this[_0x547c('0x16')]=_0x468220[_0x547c('0x16')];this[_0x547c('0x17')]=_0x468220[_0x547c('0x17')]||0x0;this[_0x547c('0x18')]=_0x468220[_0x547c('0x18')]||0x0;this['countnoanswerretry']=_0x468220['countnoanswerretry']||0x0;this[_0x547c('0x19')]=(_0x468220[_0x547c('0x17')]||0x0)+(_0x468220[_0x547c('0x18')]||0x0)+(_0x468220['countnoanswerretry']||0x0)+(_0x468220[_0x547c('0x1a')]||0x0)+(_0x468220[_0x547c('0x1b')]||0x0)+(_0x468220[_0x547c('0x1c')]||0x0)+(_0x468220['countmachineretry']||0x0)+(_0x468220[_0x547c('0x1d')]||0x0);this[_0x547c('0x1a')]=_0x468220['countnosuchnumberretry']||0x0;this['countdropretry']=_0x468220[_0x547c('0x1b')]||0x0;this[_0x547c('0x1c')]=_0x468220['countabandonedretry']||0x0;this[_0x547c('0x1e')]=_0x468220[_0x547c('0x1e')]||0x0;this['countagentrejectretry']=_0x468220[_0x547c('0x1d')]||0x0;this[_0x547c('0x1f')]=_0x468220[_0x547c('0x1f')];this['callbackuniqueid']=_0x468220[_0x547c('0x20')];this[_0x547c('0x21')]=_0x468220[_0x547c('0x21')];this[_0x547c('0x22')]=_0x468220[_0x547c('0x22')];this[_0x547c('0x23')]=_0x468220[_0x547c('0x23')];this[_0x547c('0x24')]=_0x468220['ListId'];this[_0x547c('0x25')]=_['isNil'](_0x468220['Agent'])?_0x468220['UserId']:_0x468220['Agent']['id'];this[_0x547c('0x26')]=_0x468220['VoiceQueueId'];this[_0x547c('0x27')]='';this['originatecalleridname']='';}Action[_0x547c('0x28')]['getCaller']=function(){return util[_0x547c('0xe')](_0x547c('0x29'),this[_0x547c('0xf')],this[_0x547c('0x2a')]);};module[_0x547c('0x2b')]=Action; \ No newline at end of file +var _0x7096=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','number','lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x5f504b,_0x22813a){var _0x1cf25a=function(_0x4e9f04){while(--_0x4e9f04){_0x5f504b['push'](_0x5f504b['shift']());}};_0x1cf25a(++_0x22813a);}(_0x7096,0x10c));var _0x6709=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7096[_0x411add];return _0x238242;};'use strict';var util=require('util');var _=require(_0x6709('0x0'));var moment=require('moment');function checkNameSurname(_0x253760,_0x5c668a,_0x233cbf){var _0x9544e0='';if(!_[_0x6709('0x1')](_0x5c668a)&&_0x6709('0x2')===typeof _0x5c668a){_0x9544e0+=_0x5c668a;}if(!_[_0x6709('0x1')](_0x233cbf)&&_0x6709('0x2')===typeof _0x233cbf){_0x9544e0+='\x20'+_0x233cbf;}if(_0x9544e0!==''){return _0x9544e0;}return _0x253760;}function Action(_0xb8fe6d,_0x9d630f,_0xa35832,_0x3e2223,_0x11ad23){this[_0x6709('0x3')]=_0xa35832||undefined;this[_0x6709('0x4')]=_0xb8fe6d['id'];this['queue']=_0x9d630f['name'];this[_0x6709('0x5')]=_0x9d630f[_0x6709('0x5')];this[_0x6709('0x6')]=_0x6709('0x7');this[_0x6709('0x8')]=![];this[_0x6709('0x9')]=_['isNil'](_0xb8fe6d['Agent'])?undefined:_0xb8fe6d[_0x6709('0xa')][_0x6709('0xb')];this[_0x6709('0xc')]=this[_0x6709('0x9')]?util[_0x6709('0xd')](_0x6709('0xe'),this[_0x6709('0x9')]):_0x3e2223||undefined;this[_0x6709('0xf')]=checkNameSurname(_0xb8fe6d['Contact'][_0x6709('0x10')],_0xb8fe6d[_0x6709('0x11')][_0x6709('0x12')],_0xb8fe6d[_0x6709('0x11')]['lastName']);this[_0x6709('0x13')]=_0xb8fe6d['active']||![];this[_0x6709('0x14')]=_0xb8fe6d['phone'];this[_0x6709('0x15')]=_0xb8fe6d[_0x6709('0x15')];this[_0x6709('0x16')]=_0xb8fe6d[_0x6709('0x16')]||0x0;this['countcongestionretry']=_0xb8fe6d['countcongestionretry']||0x0;this['countnoanswerretry']=_0xb8fe6d[_0x6709('0x17')]||0x0;this[_0x6709('0x18')]=(_0xb8fe6d['countbusyretry']||0x0)+(_0xb8fe6d[_0x6709('0x19')]||0x0)+(_0xb8fe6d[_0x6709('0x17')]||0x0)+(_0xb8fe6d[_0x6709('0x1a')]||0x0)+(_0xb8fe6d['countdropretry']||0x0)+(_0xb8fe6d[_0x6709('0x1b')]||0x0)+(_0xb8fe6d[_0x6709('0x1c')]||0x0)+(_0xb8fe6d[_0x6709('0x1d')]||0x0);this[_0x6709('0x1a')]=_0xb8fe6d['countnosuchnumberretry']||0x0;this[_0x6709('0x1e')]=_0xb8fe6d[_0x6709('0x1e')]||0x0;this[_0x6709('0x1b')]=_0xb8fe6d[_0x6709('0x1b')]||0x0;this[_0x6709('0x1c')]=_0xb8fe6d[_0x6709('0x1c')]||0x0;this[_0x6709('0x1d')]=_0xb8fe6d[_0x6709('0x1d')]||0x0;this[_0x6709('0x1f')]=_0xb8fe6d[_0x6709('0x1f')];this[_0x6709('0x20')]=_0xb8fe6d[_0x6709('0x20')];this['callbackat']=_0xb8fe6d[_0x6709('0x21')];this[_0x6709('0x22')]=_0xb8fe6d[_0x6709('0x22')];this['ContactId']=_0xb8fe6d[_0x6709('0x23')];this[_0x6709('0x24')]=_0xb8fe6d[_0x6709('0x24')];this[_0x6709('0x25')]=_['isNil'](_0xb8fe6d[_0x6709('0xa')])?_0xb8fe6d[_0x6709('0x25')]:_0xb8fe6d['Agent']['id'];this[_0x6709('0x26')]=_0xb8fe6d[_0x6709('0x26')];this['originatecalleridnum']='';this[_0x6709('0x27')]='';}Action[_0x6709('0x28')]['getCaller']=function(){return util[_0x6709('0xd')]('\x22%s\x22\x20<%s>',this[_0x6709('0xf')],this[_0x6709('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b0edc99..33bac6a 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 _0x12b4=['../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','logger','\x20is\x20deactivated','loopCampaigns','syncCampaigns','preview','dialMethod','booked','outbound','clearZombieChannels','hasOwnProperty','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','stringify','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[action]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','logger2','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','dialAnswer','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','mandatoryDisposition','custom:agentcomplete','complete','total','answered','[16]','Answer','talktime','sumBillable','pTalking:\x20','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','Contact\x20in\x20black\x20List','active','SIP/%s','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','dialPrefix','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','merge','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','ioredis','../../../config/logger','actionPreview'];(function(_0xe33eca,_0x332ee5){var _0x2184d6=function(_0x49d39a){while(--_0x49d39a){_0xe33eca['push'](_0xe33eca['shift']());}};_0x2184d6(++_0x332ee5);}(_0x12b4,0x13c));var _0x412b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x12b4[_0x4a53d];return _0x27410e;};'use strict';var util=require(_0x412b('0x0'));var _=require(_0x412b('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x412b('0x2'));var config=require('../../../config/environment');var logger=require(_0x412b('0x3'))('preview');var loggerAction=require('../../../config/logger')(_0x412b('0x4'));var ami=require(_0x412b('0x5'));var rpcDb=require(_0x412b('0x6'));var cmHopperAdditionalPhone=require(_0x412b('0x7'));var Action=require(_0x412b('0x8'));var ut=require(_0x412b('0x9'));var utils=require(_0x412b('0xa'));config[_0x412b('0xb')]=_[_0x412b('0xc')](config['redis'],{'host':_0x412b('0xd'),'port':0x18eb});var io=require(_0x412b('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x412b('0xf')][_0x412b('0x10')]=function(_0x2eb59f){this[_0x412b('0x11')]=this[_0x412b('0x11')]?this[_0x412b('0x11')][_0x412b('0x12')](_0x2eb59f):_0x2eb59f();};function Preview(_0x3bd320){this['sequence']=new Sequence();this['campaignsPreview']=_0x3bd320[_0x412b('0x13')];this[_0x412b('0x14')]=_0x3bd320[_0x412b('0x14')];this['actions']={};this['agents']=_0x3bd320[_0x412b('0x15')];this[_0x412b('0x16')]=0x0;ami['on'](_0x412b('0x17'),this[_0x412b('0x18')][_0x412b('0x19')](this));ami['on'](_0x412b('0x1a'),this[_0x412b('0x1b')][_0x412b('0x19')](this));ami['on']('hanguprequest',this[_0x412b('0x1c')]['bind'](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on'](_0x412b('0x1d'),this[_0x412b('0x1e')][_0x412b('0x19')](this));ami['on'](_0x412b('0x1f'),this[_0x412b('0x20')][_0x412b('0x19')](this));ami['on']('attendedtransfer',this[_0x412b('0x21')]['bind'](this));ami['on'](_0x412b('0x22'),this['syncBlindTransfer'][_0x412b('0x19')](this));this['loopCampaigns'](this[_0x412b('0x23')]);}function emit(_0x216e27,_0x52b4c5,_0x3f19ab){io['to'](_0x216e27)[_0x412b('0x24')](_0x52b4c5,_0x3f19ab);}function emitVoiceQueueChannelRemove(_0x548cc7){logger[_0x412b('0x25')](_0x412b('0x26'),JSON['stringify'](_0x548cc7));emit(util[_0x412b('0x27')]('voice:queue:%s',_0x548cc7[_0x412b('0x28')]),_0x412b('0x29'),_0x548cc7);io[_0x412b('0x24')](_0x412b('0x2a'),_0x548cc7);}function notSendMessagesQueue(_0x12c80c){if(_0x12c80c[_0x412b('0x2b')]){if(_0x12c80c[_0x412b('0x2c')]===0x0&&_0x12c80c[_0x412b('0x2d')]===0x0){_0x12c80c[_0x412b('0x2b')]=![];_0x12c80c[_0x412b('0x2e')]=0x0;_0x12c80c[_0x412b('0x2f')]=0x0;_0x12c80c[_0x412b('0x30')]=utils['CAMPAIGN_STATUS'][_0x412b('0x31')];ut['logger'](_0x412b('0x32'),_0x12c80c[_0x412b('0x28')]+_0x412b('0x33'));}else{_0x12c80c[_0x412b('0x30')]=utils[_0x412b('0x34')][_0x412b('0x35')];ut[_0x412b('0x36')](_0x412b('0x32'),_0x12c80c[_0x412b('0x28')]+_0x412b('0x37'));}}}Preview[_0x412b('0xf')][_0x412b('0x38')]=function(){var _0x250baa=this;setInterval(function(){_0x250baa[_0x412b('0x39')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x5efad9=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x4dee89 in _0x5efad9){if(_0x5efad9['hasOwnProperty'](_0x4dee89)&&(_0x5efad9[_0x4dee89]['dialMethod']===_0x412b('0x3a')||_0x5efad9[_0x4dee89][_0x412b('0x3b')]===_0x412b('0x3c'))&&_0x5efad9[_0x4dee89]['type']===_0x412b('0x3d')){if(this[_0x412b('0x16')]>0x7){this[_0x412b('0x16')]=0x0;this[_0x412b('0x3e')]();}}if(_0x5efad9[_0x412b('0x3f')](_0x4dee89)&&_0x5efad9[_0x4dee89][_0x412b('0x3b')]===_0x412b('0x3a')&&_0x5efad9[_0x4dee89][_0x412b('0x40')]===_0x412b('0x3d')){if(_0x5efad9[_0x4dee89][_0x412b('0x41')]){this[_0x412b('0x42')](_0x5efad9[_0x4dee89]);if(_0x5efad9[_0x4dee89][_0x412b('0x43')])this[_0x412b('0x44')](_0x5efad9[_0x4dee89]);}else{notSendMessagesQueue(_0x5efad9[_0x4dee89]);}}}};Preview['prototype'][_0x412b('0x45')]=function(_0x5cd767){var _0x1e8bb8=this;this['sequence'][_0x412b('0x10')](function(){if(!_[_0x412b('0x46')](_0x1e8bb8[_0x412b('0x47')][_0x5cd767])){loggerAction[_0x412b('0x25')](_0x412b('0x48'),_0x5cd767,_0x412b('0x49'),_0x1e8bb8['actions'][_0x5cd767][_0x412b('0x4a')],'originated:\x20',JSON[_0x412b('0x4b')](_0x1e8bb8['campaignsPreview'][_0x1e8bb8['actions'][_0x5cd767][_0x412b('0x4a')]][_0x412b('0x2c')]),'pTalking:\x20',JSON[_0x412b('0x4b')](_0x1e8bb8[_0x412b('0x23')][_0x1e8bb8[_0x412b('0x47')][_0x5cd767][_0x412b('0x4a')]][_0x412b('0x2d')]),JSON[_0x412b('0x4b')](_0x1e8bb8[_0x412b('0x47')][_0x5cd767]['dialAnswer']),JSON['stringify'](_[_0x412b('0x4c')](_0x1e8bb8[_0x412b('0x47')][_0x5cd767],[_0x412b('0x4d'),_0x412b('0x4e'),_0x412b('0x4f'),_0x412b('0x50')])));return ami['Action']({'action':_0x412b('0x51'),'channel':_0x1e8bb8[_0x412b('0x47')][_0x5cd767][_0x412b('0x52')]})[_0x412b('0x53')](function(_0x236516){if(_0x236516[_0x412b('0x30')]===_0x412b('0x54')){setTimeout(function(){if(_0x1e8bb8[_0x412b('0x47')][_0x5cd767]){utils[_0x412b('0x55')](_0x1e8bb8[_0x412b('0x23')][_0x1e8bb8[_0x412b('0x47')][_0x5cd767][_0x412b('0x4a')]],_0x412b('0x56'));if(_0x1e8bb8[_0x412b('0x47')][_0x5cd767]['dialAnswer']===!![]){ut[_0x412b('0x57')](_0x1e8bb8[_0x412b('0x23')][_0x1e8bb8[_0x412b('0x47')][_0x5cd767]['queue']],_0x412b('0x56'));ut[_0x412b('0x58')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5cd767,_0x1e8bb8[_0x412b('0x47')][_0x5cd767]['queue']);}ut[_0x412b('0x58')]('[Dialer][checkChannel][Preview]'+_0x5cd767,_0x1e8bb8[_0x412b('0x47')][_0x5cd767][_0x412b('0x4a')]);delete _0x1e8bb8[_0x412b('0x47')][_0x5cd767];}},0x2328);}});}});};Preview[_0x412b('0xf')][_0x412b('0x3e')]=function(){var _0x571735=this;loggerAction[_0x412b('0x25')](_0x412b('0x59'),_[_0x412b('0x5a')](this[_0x412b('0x47')]));for(var _0x329dc0 in this[_0x412b('0x47')]){if(_0x571735['actions'][_0x412b('0x3f')](_0x329dc0)){_0x571735[_0x412b('0x45')](_0x329dc0);}}};Preview['prototype'][_0x412b('0x44')]=function(_0x2fdf59){var _0x4ba595=this;rpcDb['getContactRecallMe'](_0x2fdf59['id'],ut[_0x412b('0x5b')](this[_0x412b('0x15')]))[_0x412b('0x5c')](function(_0x2b881f){if(!_[_0x412b('0x46')](_0x2b881f)){for(var _0x455e79=0x0;_0x455e79<_0x2b881f[_0x412b('0x5d')];_0x455e79+=0x1){if(ut[_0x412b('0x5e')](_0x2b881f[_0x455e79][_0x412b('0x5f')])<_0x2fdf59['dialRecallMeTimeout']*0x3c){if(_0x2b881f[_0x455e79]['Agent']&&!_0x2b881f[_0x455e79][_0x412b('0x60')][_0x412b('0x61')]){_0x4ba595[_0x412b('0x62')](_0x2b881f[_0x455e79]['id'])[_0x412b('0x5c')](ut['logger2'](_0x412b('0x63')))['catch'](ut[_0x412b('0x64')](_0x412b('0x63')));}else{rpcDb[_0x412b('0x65')](_0x2b881f[_0x455e79]['id']);}}else{var _0x47ff83=new Action(_0x2b881f[_0x455e79],_0x2fdf59);_0x47ff83['starttime']=moment()[_0x412b('0x27')](_0x412b('0x66'));_0x2fdf59[_0x412b('0x67')]+=0x1;ut[_0x412b('0x68')](_0x47ff83,0x17,_0x412b('0x69'));if(_0x2fdf59['dialRecallInQueue']){rpcDb[_0x412b('0x6a')](ut[_0x412b('0x6b')](_0x2b881f[_0x455e79]));rpcDb[_0x412b('0x6c')](_0x47ff83,_0x412b('0x6d'));}else{ut['logCustomer'](_0x47ff83,0x16,_0x412b('0x6e'));rpcDb[_0x412b('0x6c')](_0x47ff83,'[HistoryRecallClose]');rpcDb[_0x412b('0x6f')](_0x47ff83,_0x412b('0x70'));}}}}})['catch'](ut[_0x412b('0x64')](_0x412b('0x71')));};Preview[_0x412b('0xf')]['setMessage']=function(_0x1562d6){_0x1562d6[_0x412b('0x2b')]=!![];if(ut[_0x412b('0x72')](_0x1562d6[_0x412b('0x73')])){_0x1562d6[_0x412b('0x30')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0x412b('0x74')](_0x1562d6[_0x412b('0x41')])){_0x1562d6[_0x412b('0x30')]=utils['CAMPAIGN_STATUS'][_0x412b('0x31')];}else if(!this[_0x412b('0x75')](_0x1562d6['Trunk'])){if(!this[_0x412b('0x75')](_0x1562d6[_0x412b('0x76')])){_0x1562d6['message']=utils[_0x412b('0x34')][_0x412b('0x77')];}else{_0x1562d6[_0x412b('0x30')]=utils[_0x412b('0x34')][_0x412b('0x78')];}}else{_0x1562d6['message']=utils['CAMPAIGN_STATUS'][_0x412b('0x78')];}};Preview[_0x412b('0xf')][_0x412b('0x79')]=function(_0xf39172,_0x2804c6,_0x23b781){var _0x3223e0=this;var _0x2824d1=this[_0x412b('0x47')][_0x2804c6];var _0x47fa66=this[_0x412b('0x23')][_0x2824d1['queue']];var _0x9317d0;var _0x2e7e94=![];var _0x10a98f=0x2;var _0x2b5a57=0x3;if(_0x47fa66){switch(_0x23b781){case'1':_0x47fa66[_0x412b('0x7a')]+=0x1;_0x2824d1[_0x412b('0x7b')]+=0x1;_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x0,_0x412b('0x7e'));ami[_0x412b('0x24')](_0x412b('0x7f'),ut['buildObj'](_0x2824d1,_0x412b('0x80')));rpcDb['createCustomerHistory'](_0x2824d1,'[callProgressDetectingCustomer][logNoSuch]');_0x3223e0[_0x412b('0x81')](_0x2824d1,'0',_0x47fa66)['then'](function(_0x3e7c42){_0x2e7e94=_0x3e7c42[_0x412b('0x82')]==0x1;_0x10a98f=_0x47fa66[_0x412b('0x83')];_0x2b5a57=_0x47fa66[_0x412b('0x84')];if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66['dialGlobalMaxRetry']){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,_0x412b('0x86'));rpcDb[_0x412b('0x6f')](_0x9317d0,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2824d1[_0x412b('0x7b')]>=_0x47fa66[_0x412b('0x87')]){rpcDb[_0x412b('0x6f')](_0x2824d1,_0x412b('0x88'));}else{rpcDb[_0x412b('0x89')](ut[_0x412b('0x8a')](_0x2824d1,'countnosuchnumberretry',_0x47fa66[_0x412b('0x83')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}delete this['actions'][_0xf39172[_0x412b('0x8d')]];}else{_0x2824d1[_0x412b('0x7b')]++;logger[_0x412b('0x25')](_0x412b('0x8e'),_0x2824d1[_0x412b('0x7b')]);logger['info']('id',_0x2824d1[_0x412b('0x8f')]);_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnosuchnumberretry':_0x2824d1[_0x412b('0x7b')]}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)['then'](function(){});});}});break;case _0x412b('0x92'):var _0x2782f2=moment()[_0x412b('0x27')](_0x412b('0x66'));_0x2824d1[_0x412b('0x93')]=_0x2782f2;_0x2824d1[_0x412b('0x94')]=_0x2782f2;_0x2824d1[_0x412b('0x95')]=!![];_0x47fa66[_0x412b('0x2d')]+=0x1;logger['info'](_0x412b('0x96'),_0x2824d1['uniqueid'],_0x412b('0x97'),_0x47fa66['name'],'pTalking:\x20',_0x47fa66[_0x412b('0x2d')]);ami['emit'](_0x412b('0x98'),ut[_0x412b('0x99')](_0x2824d1,_0x412b('0x9a'),this[_0x412b('0x23')][_0x2824d1['queue']]));if(_0x47fa66[_0x412b('0x9b')]||_0x47fa66[_0x412b('0x9c')]){ami['emit']('custom:agentConnectPreview',{'queue':_0x2824d1['queue'],'interface':_0x2824d1['channelAgent'],'uniqueid':_0x2824d1['uniqueid']});}break;case'16':ami[_0x412b('0x24')](_0x412b('0x9d'),ut[_0x412b('0x99')](_0x2824d1,_0x412b('0x9e'),this[_0x412b('0x23')][_0x2824d1[_0x412b('0x4a')]]));emitVoiceQueueChannelRemove(ut[_0x412b('0x99')](_0x2824d1,_0x412b('0x9e')));_0x47fa66['outboundAnswerCallsDay']+=0x1;_0x47fa66[_0x412b('0x9f')]+=0x1;_0x47fa66[_0x412b('0xa0')]+=0x1;ut[_0x412b('0x57')](_0x47fa66,_0x412b('0xa1'));_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut['logCustomer'](_0x2824d1,0x4,_0x412b('0xa2'));rpcDb[_0x412b('0x6c')](_0x2824d1,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x412b('0x6f')](_0x2824d1,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2824d1);_0x47fa66['sumDuration']+=_0x2824d1[_0x412b('0xa3')];_0x47fa66[_0x412b('0xa4')]+=_0x2824d1['talktime'];logger[_0x412b('0x25')]('[syncHangup][talking][decrement]',_0x2824d1['uniqueid'],_0x412b('0x97'),_0x47fa66['name'],_0x412b('0xa5'),_0x47fa66[_0x412b('0x2d')]);delete this[_0x412b('0x47')][_0xf39172[_0x412b('0x8d')]];break;case _0x412b('0xa6'):_0x47fa66[_0x412b('0xa7')]+=0x1;_0x2824d1[_0x412b('0xa8')]+=0x1;_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x5,_0x412b('0xa9'));_0x10a98f=_0x47fa66[_0x412b('0xaa')];_0x2b5a57=_0x47fa66[_0x412b('0x84')];ami[_0x412b('0x24')]('custom:agentbusy',ut[_0x412b('0x99')](_0x2824d1,_0x412b('0xab')));rpcDb[_0x412b('0x6c')](_0x2824d1,'[callProgressDetectingCustomer][logBusy]');_0x3223e0[_0x412b('0x81')](_0x2824d1,'5',_0x47fa66)[_0x412b('0x5c')](function(_0x5c774d){_0x2e7e94=_0x5c774d[_0x412b('0x82')]==0x1;if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,_0x412b('0x86'));rpcDb[_0x412b('0x6f')](_0x9317d0,_0x412b('0xad'));}else{if(_0x2824d1['countbusyretry']>=_0x47fa66[_0x412b('0xae')]){rpcDb[_0x412b('0x6f')](_0x2824d1,_0x412b('0xaf'));}else{rpcDb[_0x412b('0x89')](ut[_0x412b('0x8a')](_0x2824d1,'countbusyretry',_0x47fa66[_0x412b('0xaa')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}}else{_0x2824d1['countbusyretry']++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countbusyretry':_0x2824d1['countbusyretry']}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)[_0x412b('0x5c')](function(){});});}});break;case _0x412b('0xb0'):_0x47fa66[_0x412b('0xb1')]+=0x1;_0x2824d1[_0x412b('0xb2')]+=0x1;_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x3,'NoAnswer');_0x10a98f=_0x47fa66[_0x412b('0xb3')];_0x2b5a57=_0x47fa66[_0x412b('0x84')];var _0x4f1354=ut[_0x412b('0xb4')](_0x2824d1,_0x47fa66);ami[_0x412b('0x24')](_0x412b('0xb5'),_0x4f1354);rpcDb[_0x412b('0x6c')](_0x2824d1,_0x412b('0xb6'));_0x3223e0[_0x412b('0x81')](_0x2824d1,'3',_0x47fa66)[_0x412b('0x5c')](function(_0x3c2a87){_0x2e7e94=_0x3c2a87['additional']==0x1;if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,_0x412b('0x86'));rpcDb['createCustomerFinal'](_0x9317d0,_0x412b('0xb7'));}else{if(_0x2824d1[_0x412b('0xb2')]>=_0x47fa66['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x2824d1,_0x412b('0xb6'));}else{rpcDb[_0x412b('0x89')](ut[_0x412b('0x8a')](_0x2824d1,_0x412b('0xb2'),_0x47fa66[_0x412b('0xb3')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}}else{_0x2824d1['countnoanswerretry']++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnoanswerretry':_0x2824d1[_0x412b('0xb2')]}})['then'](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)['then'](function(){});});}});break;case _0x412b('0xb8'):_0x47fa66['outboundCongestionCallsDay']+=0x1;_0x2824d1[_0x412b('0xb9')]+=0x1;_0x2824d1['countglobal']=ut['totalGlobal'](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x8,_0x412b('0xba'));_0x10a98f=_0x47fa66[_0x412b('0xbb')];_0x2b5a57=_0x47fa66[_0x412b('0x84')];ami[_0x412b('0x24')](_0x412b('0xbc'),ut[_0x412b('0x99')](_0x2824d1,_0x412b('0xbd')));rpcDb[_0x412b('0x6c')](_0x2824d1,_0x412b('0xbe'));_0x3223e0[_0x412b('0x81')](_0x2824d1,'8',_0x47fa66)['then'](function(_0x501df1){_0x2e7e94=_0x501df1['additional']==0x1;if(!_0x2e7e94){if(ut['totalGlobal'](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut['cloneAction'](_0x2824d1,0xf,_0x412b('0x86'));rpcDb[_0x412b('0x6f')](_0x9317d0,_0x412b('0xbf'));}else{if(_0x2824d1['countcongestionretry']>=_0x47fa66['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x2824d1,_0x412b('0xbe'));}else{rpcDb[_0x412b('0x89')](ut[_0x412b('0x8a')](_0x2824d1,'countcongestionretry',_0x47fa66[_0x412b('0xaa')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}}else{_0x2824d1[_0x412b('0xb9')]++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countcongestionretry':_0x2824d1[_0x412b('0xb9')]}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)[_0x412b('0x5c')](function(){});});}});break;case _0x412b('0xc0'):_0x47fa66[_0x412b('0xc1')]+=0x1;_0x2824d1[_0x412b('0xc2')]+=0x1;_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut['logCustomer'](_0x2824d1,0x14,_0x412b('0xc3'));_0x10a98f=_0x47fa66['dialAgentRejectRetryFrequency'];_0x2b5a57=_0x47fa66[_0x412b('0x84')];ami[_0x412b('0x24')](_0x412b('0xc4'),ut['buildObj'](_0x2824d1,'agentreject'));rpcDb[_0x412b('0x6c')](_0x2824d1,_0x412b('0xc5'));_0x3223e0[_0x412b('0x81')](_0x2824d1,'20',_0x47fa66)[_0x412b('0x5c')](function(_0x411de8){_0x2e7e94=_0x411de8['additional']==0x1;if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66['dialGlobalMaxRetry']){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0x14,_0x412b('0xc3'));rpcDb[_0x412b('0x6f')](_0x9317d0,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2824d1[_0x412b('0xc2')]>=_0x47fa66[_0x412b('0xc6')]){rpcDb[_0x412b('0x6f')](_0x2824d1,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x412b('0x8a')](_0x2824d1,'countagentrejectretry',_0x47fa66[_0x412b('0xc7')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}}else{_0x2824d1['countnoanswerretry']++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnoanswerretry':_0x2824d1[_0x412b('0xb2')]}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)[_0x412b('0x5c')](function(){});});}});break;case'ABANDONED':_0x47fa66[_0x412b('0xc8')]+=0x1;_0x2824d1[_0x412b('0xc9')]+=0x1;_0x2824d1[_0x412b('0x7c')]=ut['totalGlobal'](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0xb,_0x412b('0xca'));rpcDb[_0x412b('0x6c')](_0x2824d1,_0x412b('0xcb'));_0x3223e0[_0x412b('0x81')](_0x2824d1,'11',_0x47fa66)['then'](function(_0x153b37){_0x2e7e94=_0x153b37[_0x412b('0x82')]==0x1;if(!_0x2e7e94){if(ut['totalGlobal'](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,'Global');rpcDb[_0x412b('0x6f')](_0x9317d0,_0x412b('0xcb'));}else{if(_0x2824d1[_0x412b('0xcc')]>=_0x47fa66[_0x412b('0xcd')]){rpcDb[_0x412b('0x6f')](_0x2824d1,_0x412b('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0x412b('0x8a')](_0x2824d1,_0x412b('0xc9'),_0x47fa66[_0x412b('0xce')]),_0x2824d1[_0x412b('0x8b')],_0x2824d1[_0x412b('0x8c')]);}}}else{_0x2824d1[_0x412b('0xb2')]++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnoanswerretry':_0x2824d1[_0x412b('0xb2')]}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)['then'](function(){});});}});break;case'18':_0x47fa66['outboundUnknownCallsDay']+=0x1;_0x2824d1[_0x412b('0xcf')]+=0x1;_0x2824d1['countglobal']=ut[_0x412b('0x7d')](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x12,_0xf39172[_0x412b('0xd0')]||_0xf39172['dialstatus']);ami[_0x412b('0x24')](_0x412b('0xd1'),ut['buildObj'](_0x2824d1,'amd'));rpcDb['createCustomerHistory'](_0x2824d1,'[callProgressDetectingCustomer][hangupInAMD]');_0x3223e0[_0x412b('0x81')](_0x2824d1,'18',_0x47fa66)[_0x412b('0x5c')](function(_0x4d9107){_0x2e7e94=_0x4d9107[_0x412b('0x82')]==0x1;if(!_0x2e7e94){if(ut['totalGlobal'](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0x12,_0x412b('0x86'));rpcDb[_0x412b('0x6f')](_0x9317d0,_0x412b('0xd2'));}else{rpcDb[_0x412b('0x6f')](_0x2824d1,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2824d1[_0x412b('0xb2')]++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnoanswerretry':_0x2824d1[_0x412b('0xb2')]}})[_0x412b('0x5c')](function(){_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)[_0x412b('0x5c')](function(){});});}});delete this[_0x412b('0x47')][_0xf39172[_0x412b('0x8d')]];break;case'19':_0x47fa66['outboundUnknownCallsDay']+=0x1;_0x2824d1[_0x412b('0x7c')]=ut[_0x412b('0x7d')](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0x13,_0xf39172[_0x412b('0xd0')]||_0xf39172[_0x412b('0xd3')]);ami[_0x412b('0x24')](_0x412b('0xd1'),ut[_0x412b('0x99')](_0x2824d1,_0x412b('0xd4')));rpcDb[_0x412b('0x6c')](_0x2824d1,'[callProgressDetectingCustomer][machine]');_0x3223e0[_0x412b('0x81')](_0x2824d1,'18',_0x47fa66)[_0x412b('0x5c')](function(_0x51add3){_0x2e7e94=_0x51add3[_0x412b('0x82')]==0x1;if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,_0x412b('0x86'));rpcDb[_0x412b('0x6f')](_0x9317d0,_0x412b('0xd5'));}else{rpcDb[_0x412b('0x6f')](_0x2824d1,_0x412b('0xd5'));}}else{_0x2824d1['countnoanswerretry']++;_0x3223e0[_0x412b('0x90')]({'id':_0x2824d1[_0x412b('0x8f')],'field':{'countnoanswerretry':_0x2824d1[_0x412b('0xb2')]}})['then'](function(){_0x3223e0['swapAdditionalPhones'](_0x2824d1,_0x10a98f,_0x2b5a57)[_0x412b('0x5c')](function(){});});}});delete this[_0x412b('0x47')][_0xf39172[_0x412b('0x8d')]];break;default:if(_0x2824d1[_0x412b('0x95')]){ut[_0x412b('0x57')](_0x47fa66,_0x412b('0xd6'));ut[_0x412b('0x58')](_0x412b('0xd7')+_0x47fa66[_0x412b('0x28')],_0xf39172);}_0x47fa66[_0x412b('0xd8')]+=0x1;_0x2824d1['countglobal']=ut['totalGlobal'](_0x2824d1);ut[_0x412b('0x68')](_0x2824d1,0xc,_0xf39172['cause-txt']||_0xf39172[_0x412b('0xd3')]);_0x10a98f=_0x47fa66[_0x412b('0xc7')];_0x2b5a57=_0x47fa66[_0x412b('0x84')];rpcDb['createCustomerHistory'](_0x2824d1,_0x412b('0xd9'));_0x3223e0['verifyAdditionalPhones'](_0x2824d1,'20',_0x47fa66)[_0x412b('0x5c')](function(_0x3fca99){_0x2e7e94=_0x3fca99['additional']==0x1;if(!_0x2e7e94){if(ut[_0x412b('0x7d')](_0x2824d1)>=_0x47fa66[_0x412b('0xac')]){_0x9317d0=ut[_0x412b('0x85')](_0x2824d1,0xf,_0x412b('0x86'));rpcDb['createCustomerFinal'](_0x9317d0,_0x412b('0xda'));}else{rpcDb[_0x412b('0x6f')](_0x2824d1,_0x412b('0xda'));}delete this['actions'][_0xf39172['linkedid']];}else{_0x3223e0[_0x412b('0x91')](_0x2824d1,_0x10a98f,_0x2b5a57)['then'](function(){});}});}if(!(_0x2824d1[_0x412b('0x95')]&&_0x23b781==='16')){utils['decrementOriginate'](_0x47fa66,_0x412b('0xdb'));logger[_0x412b('0x25')](_0x412b('0xdc'),_0x2824d1[_0x412b('0xdd')],'\x20Queue',_0x47fa66[_0x412b('0x28')],_0x412b('0xde'),_0x47fa66[_0x412b('0x2c')]);}if(_0x23b781!==_0x412b('0x92')){delete this[_0x412b('0x47')][_0xf39172[_0x412b('0x8d')]];delete this[_0x412b('0x47')][_0xf39172[_0x412b('0xdf')]];}_0x47fa66[_0x412b('0xe0')]=!![];}};Preview[_0x412b('0xf')][_0x412b('0xe1')]=function(_0x50724c,_0x222080,_0x2ae0a9){if(_['isUndefined'](_0x222080)&&_0x412b('0xe2')!==typeof _0x222080){return;}if(_['isUndefined'](_0x2ae0a9)&&_0x412b('0xe2')!==typeof _0x2ae0a9){return;}switch(_0x2ae0a9[_0x412b('0xe3')]){case'0':ut['logAgent'](_0x50724c,0x0,_0x412b('0x7e'));rpcDb[_0x412b('0xe4')](_0x50724c,_0x412b('0xe5'));break;case'3':ut[_0x412b('0xe6')](_0x50724c,0x3,_0x412b('0xe7'));rpcDb[_0x412b('0xe4')](_0x50724c,_0x412b('0xe8'));break;case'5':ut[_0x412b('0xe6')](_0x50724c,0x5,_0x412b('0xa9'));rpcDb['createAgentHistory'](_0x50724c,_0x412b('0xe9'));break;case'8':ut[_0x412b('0xe6')](_0x50724c,0x8,_0x412b('0xba'));rpcDb[_0x412b('0xe4')](_0x50724c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x412b('0xe6')](_0x50724c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x50724c,_0x412b('0xea'));break;default:ut['logAgent'](_0x50724c,0xc,_0x2ae0a9[_0x412b('0xe3')]);rpcDb[_0x412b('0xe4')](_0x50724c,_0x412b('0xeb'));}utils[_0x412b('0x55')](_0x222080,_0x412b('0xec'));logger[_0x412b('0x25')](_0x412b('0xed'),_0x50724c[_0x412b('0xdd')],_0x412b('0x97'),_0x222080['name'],_0x412b('0xde'),_0x222080[_0x412b('0x2c')]);delete this[_0x412b('0x47')][_0x50724c[_0x412b('0xdd')]];};Preview[_0x412b('0xf')][_0x412b('0x81')]=function(_0x3256b6,_0x4c04fe,_0x56acfd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3256b6,_0x4c04fe,_0x56acfd)[_0x412b('0x53')](logger[_0x412b('0x25')](_0x412b('0xee')));};Preview[_0x412b('0xf')][_0x412b('0x91')]=function(_0x24c66c,_0x321ce2,_0x50d2f9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x24c66c,_0x321ce2,_0x50d2f9)[_0x412b('0x53')](logger['info'](_0x412b('0xef')));};Preview['prototype'][_0x412b('0x90')]=function(_0x1c67b6){return Promise[_0x412b('0xf0')]()[_0x412b('0x5c')](cmHopperAdditionalPhone[_0x412b('0x90')](_0x1c67b6))[_0x412b('0x53')](logger[_0x412b('0x25')](_0x412b('0xf1')));};Preview[_0x412b('0xf')]['checkInBlack']=function(_0x32b689,_0x5644ab,_0x28a3dc,_0x446420,_0x157790){var _0x22ab29=this;return new Promise(function(_0x2557c1,_0x2a8178){if(_[_0x412b('0x46')](_0x5644ab)||_[_0x412b('0x46')](_0x5644ab[_0x412b('0xf2')])||_[_0x412b('0x46')](_0x5644ab[_0x412b('0xf3')])||_[_0x412b('0x46')](_0x5644ab[_0x412b('0x4f')])){_0x2a8178(ut['message']('Contact\x20is\x20undefined',_0x446420,_0x157790));return;}var _0x221f45=uuid['v4']();var _0x47823f=_0x22ab29[_0x412b('0x23')][_0x5644ab[_0x412b('0x49')][_0x412b('0x28')]];var _0x3b0f3b=_0x28a3dc?_0x22ab29[_0x412b('0x15')][_0x28a3dc]['id']:undefined;_0x22ab29[_0x412b('0x47')][_0x221f45]=new Action(_0x5644ab,_0x47823f,_0x221f45,_0x28a3dc,_0x3b0f3b);var _0x252185=_0x22ab29[_0x412b('0x47')][_0x221f45];_0x252185[_0x412b('0x8b')]=_0x446420;_0x252185['activeContact']=_0x157790;_0x252185[_0x412b('0xf4')]=_0x28a3dc;if(_['isEmpty'](_0x32b689)){_0x22ab29[_0x412b('0xf5')](_0x252185,_0x47823f,_0x5644ab,_0x28a3dc)['then'](function(_0xf1444d){logger[_0x412b('0x25')](_0x412b('0xf6'),_0x412b('0xf7')+_0x252185[_0x412b('0x4a')]+'\x20IdHopper:\x20'+_0x252185[_0x412b('0x8f')],JSON[_0x412b('0x4b')](_0xf1444d));ami[_0x412b('0x24')]('custom:agentcalled',ut['buildObj'](_0x252185,_0x412b('0xf8'),_0x22ab29[_0x412b('0x23')][_0x252185[_0x412b('0x4a')]]));_0x2557c1(ut['message'](_0x412b('0xf9')));})[_0x412b('0x53')](function(_0x145d1a){ut['logger']('[Preview][execCall][failure]',_0x145d1a);_0x2a8178(ut['message'](_0x412b('0xfa'),_0x446420,_0x157790));});}else{_0x47823f[_0x412b('0xfb')]+=0x1;ut['logBlacklist'](_0x252185);rpcDb['createHistory'](_0x252185,'[Blacklist][error]');delete _0x22ab29[_0x412b('0x47')][_0x221f45];_0x2a8178(ut[_0x412b('0x30')](_0x412b('0xfc'),_0x446420,_0x157790));}});};Preview['prototype'][_0x412b('0x75')]=function(_0x135664){return!_[_0x412b('0x46')](_0x135664)&&!_[_0x412b('0x46')](_0x135664[_0x412b('0x28')])&&!_[_0x412b('0x46')](_0x135664[_0x412b('0xfd')])&&_0x135664[_0x412b('0xfd')]&&!_[_0x412b('0x46')](this[_0x412b('0x14')][util[_0x412b('0x27')](_0x412b('0xfe'),_0x135664[_0x412b('0x28')])])&&!_['isNil'](this['trunks'][util[_0x412b('0x27')](_0x412b('0xfe'),_0x135664[_0x412b('0x28')])]['status'])&&(this[_0x412b('0x14')][util[_0x412b('0x27')](_0x412b('0xfe'),_0x135664[_0x412b('0x28')])]['status']==='reachable'||this['trunks'][util['format'](_0x412b('0xfe'),_0x135664[_0x412b('0x28')])][_0x412b('0x51')]==='unmonitored');};Preview[_0x412b('0xf')]['run']=function(_0x287274,_0x4c936e){return this[_0x412b('0xff')](_0x287274,_0x4c936e)['then'](function(_0x210aed){return _['pick'](_0x210aed,[_0x412b('0x30')]);})['catch'](function(_0x1c63b1){if(_0x1c63b1[_0x412b('0x100')]){rpcDb['unlockContact'](_0x287274);}if(_0x1c63b1[_0x412b('0xfd')]){rpcDb[_0x412b('0x65')](_0x287274);}throw _['pick'](_0x1c63b1,['message']);});};Preview[_0x412b('0xf')][_0x412b('0xff')]=function(_0x53fd32,_0x314ad0){var _0x415d83=this;var _0x28a6e4,_0x43726a;return rpcDb[_0x412b('0x101')](_0x53fd32)[_0x412b('0x5c')](function(_0x4aefc1){if(!_[_0x412b('0x46')](_0x4aefc1[0x0])){_0x43726a=_0x4aefc1[0x0][_0x412b('0x102')]?![]:!![];_0x28a6e4=_0x4aefc1[0x0][_0x412b('0x102')]?!![]:![];_0x28a6e4=_0x314ad0?!![]:_0x28a6e4;}var _0x337944=_0x415d83[_0x412b('0x103')](_0x4aefc1);if(_0x337944[_0x412b('0x104')]){rpcDb[_0x412b('0x105')](_['pick'](_0x4aefc1[0x0],[_0x412b('0x4f'),_0x412b('0xf3')]))[_0x412b('0x5c')](function(_0x652888){_0x415d83[_0x412b('0x106')](_0x652888,_0x4aefc1[0x0],_0x314ad0,_0x43726a,_0x28a6e4)[_0x412b('0x5c')](function(_0x194613){return _0x194613;})['catch'](function(_0xb71bad){throw _0xb71bad;});})['catch'](function(_0x664e65){ut['logger'](_0x412b('0x107'),_0x664e65);throw ut[_0x412b('0x30')](_0x412b('0x108'),_0x43726a,_0x28a6e4);});}else{throw ut[_0x412b('0x30')](_0x337944[_0x412b('0x30')],_0x43726a,_0x28a6e4);}})['catch'](function(_0x3158a6){ut[_0x412b('0x36')]('[Preview][getContactPreview]',_0x3158a6);throw ut[_0x412b('0x30')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x412b('0xf')][_0x412b('0x103')]=function(_0x262c0a){if(_['isNil'](_0x262c0a)||_['isEmpty'](_0x262c0a)||!_[_0x412b('0x46')](_0x262c0a[0x0]['Agent'])&&_[_0x412b('0x46')](_0x262c0a[0x0][_0x412b('0x60')]['name'])){ut[_0x412b('0x36')](_0x412b('0x109'),_0x262c0a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x22c2da=this[_0x412b('0x23')][_0x262c0a[0x0]['Queue'][_0x412b('0x28')]];_0x22c2da[_0x412b('0x30')]=utils[_0x412b('0x34')][_0x412b('0x78')];if(_[_0x412b('0x46')](_0x22c2da)){ut[_0x412b('0x36')](_0x412b('0x10a'),_0x22c2da);return{'isValid':![],'message':_0x412b('0x10b')};}if(!this[_0x412b('0x75')](_0x22c2da[_0x412b('0x10c')])){ut[_0x412b('0x36')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x22c2da[_0x412b('0x28')]+_0x412b('0x10d'));if(!this[_0x412b('0x75')](_0x22c2da[_0x412b('0x76')])){ut[_0x412b('0x36')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x22c2da['name']+_0x412b('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x412b('0x74')](_0x22c2da[_0x412b('0x41')])){ut['logger'](_0x412b('0x10f'),_0x22c2da[_0x412b('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x412b('0x110')+_0x22c2da['name']+_0x412b('0x111')};}return{'isValid':!![],'message':_0x412b('0x112')};};Preview[_0x412b('0xf')][_0x412b('0xf5')]=function(_0x31ff0c,_0x48a8f1,_0x51ef18,_0x2fbdf2){var _0x2f5428=this;return new Promise(function(_0x3a1b29,_0x48f82b){var _0x36bc59=_0x31ff0c[_0x412b('0xdd')];var _0xaa7cd8=_0x2f5428[_0x412b('0x75')](_0x48a8f1['Trunk'])?util[_0x412b('0x27')](_0x412b('0x113'),_0x48a8f1['Trunk'][_0x412b('0x28')],_['isNil'](_0x48a8f1['dialPrefix'])?'':_0x48a8f1['dialPrefix']['trim']()||'',_0x48a8f1[_0x412b('0x114')]>0x0?_0x51ef18[_0x412b('0xf3')][_0x412b('0x115')](_0x48a8f1['dialCutDigit']):_0x51ef18['phone']):util[_0x412b('0x27')](_0x412b('0x113'),_[_0x412b('0x46')](_0x48a8f1[_0x412b('0x76')])?_0x48a8f1[_0x412b('0x10c')]['name']:_0x48a8f1[_0x412b('0x76')][_0x412b('0x28')],_[_0x412b('0x46')](_0x48a8f1[_0x412b('0x116')])?'':_0x48a8f1[_0x412b('0x116')]['trim']()||'',_0x48a8f1[_0x412b('0x114')]>0x0?_0x51ef18[_0x412b('0xf3')][_0x412b('0x115')](_0x48a8f1['dialCutDigit']):_0x51ef18[_0x412b('0xf3')]);var _0xe14468=_0x2f5428[_0x412b('0x75')](_0x48a8f1[_0x412b('0x10c')])?ut['getCallerId'](_0x48a8f1[_0x412b('0x10c')]['callerid'],_0x48a8f1[_0x412b('0x117')],_0x48a8f1[_0x412b('0x118')]>0x0?ut[_0x412b('0x119')](_0x48a8f1[_0x412b('0x11a')],_0x48a8f1[_0x412b('0x118')]):_0x48a8f1[_0x412b('0x11a')]):ut[_0x412b('0x11b')](_[_0x412b('0x46')](_0x48a8f1['TrunkBackup'])?_0x48a8f1['Trunk'][_0x412b('0x11c')]:_0x48a8f1[_0x412b('0x76')][_0x412b('0x11c')],_0x48a8f1[_0x412b('0x117')],_0x48a8f1[_0x412b('0x118')]>0x0?ut['getCallerIdRandom'](_0x48a8f1[_0x412b('0x11a')],_0x48a8f1[_0x412b('0x118')]):_0x48a8f1[_0x412b('0x11a')]);if(_0xe14468){_0x31ff0c['originatecalleridname']=ut['extractCalleridName'](_0xe14468);_0x31ff0c[_0x412b('0x11d')]=ut[_0x412b('0x11e')](_0xe14468);}var _0x2bca0b=ut['addVariables'](_0x48a8f1,_0x51ef18,_0xaa7cd8,_0xe14468,_0x36bc59,_0x31ff0c);var _0x53f347=utils[_0x412b('0x11f')](_0x51ef18[_0x412b('0xf2')]);Object['assign'](_0x2bca0b,_0x53f347);_[_0x412b('0x120')](_0x31ff0c,ut['toLowerVariables'](_0x2bca0b));_0x31ff0c['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x48a8f1[_0x412b('0x121')]=_0x2bca0b;var _0x49220b=ut[_0x412b('0x122')](_0x31ff0c,_0x48a8f1,_0x2bca0b,_0x31ff0c[_0x412b('0x8c')],_0x2fbdf2);return ami[_0x412b('0x123')](_0x49220b)[_0x412b('0x5c')](function(_0x1b6da7){_0x48a8f1[_0x412b('0x2c')]+=0x1;logger[_0x412b('0x25')](_0x412b('0x124'),_0x36bc59,_0x412b('0x97'),_0x48a8f1['name'],_0x412b('0xde'),_0x48a8f1[_0x412b('0x2c')]);_0x3a1b29(_0x1b6da7);})[_0x412b('0x53')](function(_0x55ae41){ut[_0x412b('0xe6')](_0x31ff0c,0xe,_0x412b('0x125'));rpcDb[_0x412b('0xe4')](_0x31ff0c,_0x412b('0x126'));_0x48f82b(_0x55ae41);});});};Preview['prototype']['syncNewExten']=function(_0x5c20c4){if(this['actions'][_0x5c20c4[_0x412b('0x8d')]]){this[_0x412b('0x47')][_0x5c20c4['linkedid']]['channel']=_0x5c20c4[_0x412b('0x52')];}};Preview[_0x412b('0xf')]['syncOriginateResponse']=function(_0x220355){var _0x28b9a2=this;var _0x37b22b=this[_0x412b('0x47')][_0x220355['actionid']];if(_0x37b22b){if(_0x37b22b[_0x412b('0xf4')]&&this[_0x412b('0x15')][_0x37b22b[_0x412b('0xf4')]]){ut['logLookAgent'](_0x37b22b,this[_0x412b('0x15')][_0x37b22b[_0x412b('0xf4')]][_0x412b('0x28')],this[_0x412b('0x15')][_0x37b22b[_0x412b('0xf4')]]['id']);}var _0x5efe0f=_['clone'](_0x37b22b);_0x5efe0f[_0x412b('0x93')]=moment()[_0x412b('0x27')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b8539=_0x28b9a2[_0x412b('0x23')][_0x37b22b[_0x412b('0x4a')]];if(ut[_0x412b('0x127')](_0x220355[_0x412b('0x128')])){if(_0x37b22b['unlockAgent']){rpcDb[_0x412b('0x129')](_0x37b22b[_0x412b('0x8f')]);}if(_0x37b22b[_0x412b('0x8c')]){rpcDb['disableContact'](_0x37b22b['idContact']);}ami['emit'](_0x412b('0x12a'),ut['buildObj'](_0x37b22b,_0x412b('0x12b'),this[_0x412b('0x23')][_0x37b22b[_0x412b('0x4a')]]));this['callProgressDetectingAgent'](_0x5efe0f,_0x3b8539,_0x220355);}else{_0x37b22b[_0x412b('0x12c')]=moment()[_0x412b('0x27')](_0x412b('0x66'));ut[_0x412b('0xe6')](_0x5efe0f,0x4,_0x412b('0xa2'));rpcDb[_0x412b('0xe4')](_0x5efe0f,_0x412b('0x12d'));}}};Preview[_0x412b('0xf')][_0x412b('0x1b')]=function(_0x4b9e47){var _0x5c34fa=this['actions'][_0x4b9e47[_0x412b('0x8d')]];var _0x5742e4;if(_0x5c34fa){_0x5742e4=this[_0x412b('0x23')][_0x5c34fa[_0x412b('0x4a')]];logger[_0x412b('0x25')]('[syncHangup][talking]',_0x4b9e47[_0x412b('0x8d')],_0x412b('0x97'),_0x5742e4[_0x412b('0x28')],'pTalking:\x20',_0x5742e4[_0x412b('0x2d')]);}if(this[_0x412b('0x47')][_0x4b9e47['linkedid']]&&_0x4b9e47[_0x412b('0x8d')]!==_0x4b9e47[_0x412b('0xdd')]){if(_0x4b9e47[_0x412b('0x12e')]==='16'&&this[_0x412b('0x47')][_0x4b9e47['linkedid']][_0x412b('0x95')]){this[_0x412b('0x79')](_0x4b9e47,_0x4b9e47['linkedid'],_0x4b9e47[_0x412b('0x12e')]);}else if(this[_0x412b('0x47')][_0x4b9e47[_0x412b('0x8d')]]['dialAnswer']){logger[_0x412b('0x25')](_0x412b('0x12f'),_0x4b9e47[_0x412b('0x8d')],_0x4b9e47[_0x412b('0x12e')],_0x412b('0x97'),_0x5742e4[_0x412b('0x28')],_0x412b('0xa5'),_0x5742e4['pTalking']);this[_0x412b('0x79')](_0x4b9e47,_0x4b9e47[_0x412b('0x8d')],_0x4b9e47[_0x412b('0x12e')]);}}else if(_0x5c34fa&&_[_0x412b('0x46')](_0x5c34fa[_0x412b('0x130')])&&_0x5742e4[_0x412b('0x131')]&&_0x4b9e47[_0x412b('0x8d')]===_0x4b9e47['uniqueid']&&_[_0x412b('0x46')](_0x4b9e47['reason'])&&_0x4b9e47[_0x412b('0x12e')]==='16'&&_0x4b9e47[_0x412b('0x132')]==='6'&&_[_0x412b('0x133')](_0x5c34fa[_0x412b('0x134')])){if(_0x5c34fa[_0x412b('0x8b')]){rpcDb[_0x412b('0x129')](_0x5c34fa['idContact']);}if(_0x5c34fa[_0x412b('0x8c')]){rpcDb['disableContact'](_0x5c34fa[_0x412b('0x8f')]);}_0x4b9e47[_0x412b('0xe3')]='22';this['callProgressDetectingAgent'](_0x5c34fa,_0x5742e4,_0x4b9e47);}else if(_0x5c34fa&&_0x5c34fa[_0x412b('0x134')]){if(_0x4b9e47[_0x412b('0x12e')]==='16'&&this[_0x412b('0x47')][_0x4b9e47[_0x412b('0x8d')]][_0x412b('0x95')]){logger[_0x412b('0x25')](_0x412b('0x135'),_0x4b9e47[_0x412b('0x8d')],_0x4b9e47[_0x412b('0x12e')],_0x412b('0x97'),_0x5742e4['name'],_0x412b('0xa5'),_0x5742e4[_0x412b('0x2d')]);this[_0x412b('0x79')](_0x4b9e47,_0x4b9e47[_0x412b('0x8d')],_0x4b9e47['cause']);}else if(this[_0x412b('0x47')][_0x4b9e47[_0x412b('0x8d')]][_0x412b('0x95')]){logger[_0x412b('0x25')]('[syncHangup][talking][cause]',_0x4b9e47['linkedid'],_0x4b9e47[_0x412b('0x12e')],_0x412b('0x97'),_0x5742e4[_0x412b('0x28')],_0x412b('0xa5'),_0x5742e4[_0x412b('0x2d')]);this['callProgressDetectingCustomer'](_0x4b9e47,_0x4b9e47[_0x412b('0x8d')],_0x4b9e47[_0x412b('0x12e')]);}}};Preview[_0x412b('0xf')]['syncDialEnd']=function(_0x558a57){if(this['actions'][_0x558a57[_0x412b('0xdf')]]&&_0x558a57[_0x412b('0xdf')]!==_0x558a57[_0x412b('0x136')]){this[_0x412b('0x79')](_0x558a57,_0x558a57[_0x412b('0xdf')],_0x558a57[_0x412b('0xd3')]);}};Preview[_0x412b('0xf')]['syncHangupRequest']=function(_0x2cd4fb){if(this['actions'][_0x2cd4fb[_0x412b('0x8d')]]&&_0x2cd4fb[_0x412b('0x8d')]!==_0x2cd4fb[_0x412b('0xdd')]&&!this[_0x412b('0x47')][_0x2cd4fb[_0x412b('0x8d')]][_0x412b('0x95')]){if(_0x2cd4fb[_0x412b('0x12e')]==='1'){this[_0x412b('0x79')](_0x2cd4fb,_0x2cd4fb[_0x412b('0x8d')],_0x2cd4fb[_0x412b('0x12e')]);}}};Preview[_0x412b('0xf')][_0x412b('0x137')]=function(_0x510f9b,_0x31549d,_0x5f50be){if(this[_0x412b('0x47')][_0x510f9b]){if(_['isNil'](this[_0x412b('0x47')][_0x510f9b]['variables'])){this['actions'][_0x510f9b][_0x412b('0x121')]={};}this['actions'][_0x510f9b][_0x412b('0x121')][_0x31549d]=_0x5f50be;}};Preview[_0x412b('0xf')][_0x412b('0x20')]=function(_0x4aeefe){try{if(!_[_0x412b('0x46')](_0x4aeefe)){if(ut[_0x412b('0x138')](_['keys'](_0x4aeefe[_0x412b('0x139')])[0x0])){this[_0x412b('0x137')](_0x4aeefe['uniqueid'],_['keys'](_0x4aeefe[_0x412b('0x139')])[0x0],_0x4aeefe['value']);}}}catch(_0xaf9411){logger[_0x412b('0x13a')](_0x412b('0x13b'),util[_0x412b('0x13c')](_0xaf9411,{'showHidden':![],'depth':null}));}};Preview[_0x412b('0xf')][_0x412b('0x21')]=function(_0x45d8c6){if(_0x45d8c6){if(this['actions'][_0x45d8c6[_0x412b('0x13d')]]){this[_0x412b('0x47')][_0x45d8c6[_0x412b('0x13d')]][_0x412b('0x134')]=!![];}}};Preview['prototype'][_0x412b('0x13e')]=function(_0x46295e){if(_0x46295e){if(this[_0x412b('0x47')][_0x46295e[_0x412b('0x13f')]]){this[_0x412b('0x47')][_0x46295e[_0x412b('0x13f')]][_0x412b('0x134')]=!![];}}};module[_0x412b('0x140')]=Preview; \ No newline at end of file +var _0x9fda=['countabandonedetry','dialAbandonedMaxRety','countabandonedretry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','loggerError','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','trunks','status','reachable','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','Agent','Empty\x20Contact','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','TrunkBackup','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','actions','agents','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','blindtransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','getDiff','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentcomplete','complete','outboundAnswerCallsDay','total','decrementTalking','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]'];(function(_0x553bc5,_0x4a7036){var _0x3db8af=function(_0x17962f){while(--_0x17962f){_0x553bc5['push'](_0x553bc5['shift']());}};_0x3db8af(++_0x4a7036);}(_0x9fda,0x7d));var _0xa9fd=function(_0x56a44b,_0x47e301){_0x56a44b=_0x56a44b-0x0;var _0x5099de=_0x9fda[_0x56a44b];return _0x5099de;};'use strict';var util=require('util');var _=require(_0xa9fd('0x0'));var uuid=require(_0xa9fd('0x1'));var moment=require('moment');var Redis=require(_0xa9fd('0x2'));var config=require(_0xa9fd('0x3'));var logger=require(_0xa9fd('0x4'))(_0xa9fd('0x5'));var loggerAction=require(_0xa9fd('0x4'))(_0xa9fd('0x6'));var ami=require(_0xa9fd('0x7'));var rpcDb=require(_0xa9fd('0x8'));var cmHopperAdditionalPhone=require(_0xa9fd('0x9'));var Action=require(_0xa9fd('0xa'));var ut=require(_0xa9fd('0xb'));var utils=require('../dialer/utils');config[_0xa9fd('0xc')]=_['defaults'](config[_0xa9fd('0xc')],{'host':_0xa9fd('0xd'),'port':0x18eb});var io=require(_0xa9fd('0xe'))(new Redis(config[_0xa9fd('0xc')]));var Sequence=function(){};Sequence[_0xa9fd('0xf')][_0xa9fd('0x10')]=function(_0x521c3c){this[_0xa9fd('0x11')]=this[_0xa9fd('0x11')]?this[_0xa9fd('0x11')][_0xa9fd('0x12')](_0x521c3c):_0x521c3c();};function Preview(_0x545f50){this[_0xa9fd('0x13')]=new Sequence();this[_0xa9fd('0x14')]=_0x545f50['voiceQueues'];this['trunks']=_0x545f50['trunks'];this[_0xa9fd('0x15')]={};this[_0xa9fd('0x16')]=_0x545f50[_0xa9fd('0x16')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xa9fd('0x17')]['bind'](this));ami['on']('hangup',this[_0xa9fd('0x18')][_0xa9fd('0x19')](this));ami['on'](_0xa9fd('0x1a'),this[_0xa9fd('0x1b')][_0xa9fd('0x19')](this));ami['on'](_0xa9fd('0x1c'),this[_0xa9fd('0x1d')][_0xa9fd('0x19')](this));ami['on'](_0xa9fd('0x1e'),this[_0xa9fd('0x1f')]['bind'](this));ami['on'](_0xa9fd('0x20'),this['syncVarSet'][_0xa9fd('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xa9fd('0x19')](this));ami['on'](_0xa9fd('0x21'),this['syncBlindTransfer'][_0xa9fd('0x19')](this));this['loopCampaigns'](this[_0xa9fd('0x14')]);}function emit(_0x4dad11,_0x463c84,_0x1701d2){io['to'](_0x4dad11)[_0xa9fd('0x22')](_0x463c84,_0x1701d2);}function emitVoiceQueueChannelRemove(_0x2452fd){logger['info'](_0xa9fd('0x23'),JSON['stringify'](_0x2452fd));emit(util['format'](_0xa9fd('0x24'),_0x2452fd[_0xa9fd('0x25')]),_0xa9fd('0x26'),_0x2452fd);io[_0xa9fd('0x22')]('voice_queue_presence:remove',_0x2452fd);}function notSendMessagesQueue(_0x529a2f){if(_0x529a2f[_0xa9fd('0x27')]){if(_0x529a2f[_0xa9fd('0x28')]===0x0&&_0x529a2f[_0xa9fd('0x29')]===0x0){_0x529a2f[_0xa9fd('0x27')]=![];_0x529a2f[_0xa9fd('0x2a')]=0x0;_0x529a2f[_0xa9fd('0x2b')]=0x0;_0x529a2f['message']=utils[_0xa9fd('0x2c')][_0xa9fd('0x2d')];ut[_0xa9fd('0x2e')](_0xa9fd('0x2f'),_0x529a2f[_0xa9fd('0x25')]+_0xa9fd('0x30'));}else{_0x529a2f[_0xa9fd('0x31')]=utils[_0xa9fd('0x2c')][_0xa9fd('0x32')];ut['logger'](_0xa9fd('0x2f'),_0x529a2f[_0xa9fd('0x25')]+_0xa9fd('0x33'));}}}Preview[_0xa9fd('0xf')]['loopCampaigns']=function(){var _0x5e0879=this;setInterval(function(){_0x5e0879[_0xa9fd('0x34')]();},0x7cf);};Preview['prototype'][_0xa9fd('0x34')]=function(){var _0x36cebd=this[_0xa9fd('0x14')];this[_0xa9fd('0x35')]+=0x1;for(var _0x332a38 in _0x36cebd){if(_0x36cebd[_0xa9fd('0x36')](_0x332a38)&&(_0x36cebd[_0x332a38][_0xa9fd('0x37')]==='preview'||_0x36cebd[_0x332a38][_0xa9fd('0x37')]===_0xa9fd('0x38'))&&_0x36cebd[_0x332a38][_0xa9fd('0x39')]===_0xa9fd('0x3a')){if(this[_0xa9fd('0x35')]>0x7){this[_0xa9fd('0x35')]=0x0;this[_0xa9fd('0x3b')]();}}if(_0x36cebd[_0xa9fd('0x36')](_0x332a38)&&_0x36cebd[_0x332a38][_0xa9fd('0x37')]===_0xa9fd('0x5')&&_0x36cebd[_0x332a38][_0xa9fd('0x39')]===_0xa9fd('0x3a')){if(_0x36cebd[_0x332a38][_0xa9fd('0x3c')]){this[_0xa9fd('0x3d')](_0x36cebd[_0x332a38]);if(_0x36cebd[_0x332a38][_0xa9fd('0x3e')])this[_0xa9fd('0x3f')](_0x36cebd[_0x332a38]);}else{notSendMessagesQueue(_0x36cebd[_0x332a38]);}}}};Preview['prototype'][_0xa9fd('0x40')]=function(_0x11a500){var _0x397147=this;this['sequence']['enqueue'](function(){if(!_[_0xa9fd('0x41')](_0x397147['actions'][_0x11a500])){loggerAction[_0xa9fd('0x42')](_0xa9fd('0x43'),_0x11a500,_0xa9fd('0x44'),_0x397147['actions'][_0x11a500][_0xa9fd('0x45')],_0xa9fd('0x46'),JSON[_0xa9fd('0x47')](_0x397147[_0xa9fd('0x14')][_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x45')]]['originated']),_0xa9fd('0x48'),JSON[_0xa9fd('0x47')](_0x397147[_0xa9fd('0x14')][_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x45')]]['pTalking']),JSON[_0xa9fd('0x47')](_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x49')]),JSON[_0xa9fd('0x47')](_['pick'](_0x397147['actions'][_0x11a500],[_0xa9fd('0x4a'),_0xa9fd('0x4b'),_0xa9fd('0x4c'),'ListId'])));return ami[_0xa9fd('0x4d')]({'action':'status','channel':_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x4e')]})[_0xa9fd('0x4f')](function(_0xc44578){if(_0xc44578[_0xa9fd('0x31')]===_0xa9fd('0x50')){setTimeout(function(){if(_0x397147[_0xa9fd('0x15')][_0x11a500]){utils[_0xa9fd('0x51')](_0x397147[_0xa9fd('0x14')][_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x45')]],_0xa9fd('0x52'));if(_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x49')]===!![]){ut['decrementTalking'](_0x397147[_0xa9fd('0x14')][_0x397147[_0xa9fd('0x15')][_0x11a500]['queue']],_0xa9fd('0x52'));ut['loggerError'](_0xa9fd('0x53')+_0x11a500,_0x397147['actions'][_0x11a500][_0xa9fd('0x45')]);}ut['loggerError'](_0xa9fd('0x54')+_0x11a500,_0x397147[_0xa9fd('0x15')][_0x11a500][_0xa9fd('0x45')]);delete _0x397147[_0xa9fd('0x15')][_0x11a500];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x5ebf0e=this;loggerAction['info'](_0xa9fd('0x55'),_['size'](this['actions']));for(var _0x163abc in this['actions']){if(_0x5ebf0e[_0xa9fd('0x15')][_0xa9fd('0x36')](_0x163abc)){_0x5ebf0e[_0xa9fd('0x40')](_0x163abc);}}};Preview[_0xa9fd('0xf')][_0xa9fd('0x3f')]=function(_0x21240e){var _0x584315=this;rpcDb['getContactRecallMe'](_0x21240e['id'],ut[_0xa9fd('0x56')](this[_0xa9fd('0x16')]))[_0xa9fd('0x57')](function(_0x5b6f49){if(!_[_0xa9fd('0x41')](_0x5b6f49)){for(var _0x5a9278=0x0;_0x5a9278<_0x5b6f49['length'];_0x5a9278+=0x1){if(ut[_0xa9fd('0x58')](_0x5b6f49[_0x5a9278]['scheduledat'])<_0x21240e[_0xa9fd('0x59')]*0x3c){if(_0x5b6f49[_0x5a9278]['Agent']&&!_0x5b6f49[_0x5a9278]['Agent'][_0xa9fd('0x5a')]){_0x584315[_0xa9fd('0x5b')](_0x5b6f49[_0x5a9278]['id'])[_0xa9fd('0x57')](ut[_0xa9fd('0x5c')](_0xa9fd('0x5d')))[_0xa9fd('0x4f')](ut[_0xa9fd('0x5c')]('[RecallMe]'));}else{rpcDb[_0xa9fd('0x5e')](_0x5b6f49[_0x5a9278]['id']);}}else{var _0x5e0e77=new Action(_0x5b6f49[_0x5a9278],_0x21240e);_0x5e0e77['starttime']=moment()[_0xa9fd('0x5f')](_0xa9fd('0x60'));_0x21240e['outboundReCallsDay']+=0x1;ut[_0xa9fd('0x61')](_0x5e0e77,0x17,'RecallInQueue');if(_0x21240e[_0xa9fd('0x62')]){rpcDb[_0xa9fd('0x63')](ut[_0xa9fd('0x64')](_0x5b6f49[_0x5a9278]));rpcDb[_0xa9fd('0x65')](_0x5e0e77,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x5e0e77,0x16,_0xa9fd('0x66'));rpcDb[_0xa9fd('0x65')](_0x5e0e77,_0xa9fd('0x67'));rpcDb['createCustomerFinal'](_0x5e0e77,_0xa9fd('0x67'));}}}}})['catch'](ut[_0xa9fd('0x5c')](_0xa9fd('0x68')));};Preview['prototype']['setMessage']=function(_0x20491c){_0x20491c['sendMessageOneNotActive']=!![];if(ut[_0xa9fd('0x69')](_0x20491c[_0xa9fd('0x6a')])){_0x20491c['message']=utils[_0xa9fd('0x2c')][_0xa9fd('0x6b')];}else if(!ut[_0xa9fd('0x6c')](_0x20491c[_0xa9fd('0x3c')])){_0x20491c[_0xa9fd('0x31')]=utils[_0xa9fd('0x2c')][_0xa9fd('0x2d')];}else if(!this['isTrunkReachable'](_0x20491c['Trunk'])){if(!this[_0xa9fd('0x6d')](_0x20491c['TrunkBackup'])){_0x20491c['message']=utils[_0xa9fd('0x2c')][_0xa9fd('0x6e')];}else{_0x20491c[_0xa9fd('0x31')]=utils['CAMPAIGN_STATUS'][_0xa9fd('0x6f')];}}else{_0x20491c[_0xa9fd('0x31')]=utils['CAMPAIGN_STATUS'][_0xa9fd('0x6f')];}};Preview[_0xa9fd('0xf')][_0xa9fd('0x70')]=function(_0x28cc18,_0x4d0e97,_0x549380){var _0x71b8cc=this;var _0x594556=this[_0xa9fd('0x15')][_0x4d0e97];var _0x41f240=this[_0xa9fd('0x14')][_0x594556[_0xa9fd('0x45')]];var _0x57f028;var _0x2e036c=![];var _0x1dec79=0x2;var _0x11fea3=0x3;if(_0x41f240){switch(_0x549380){case'1':_0x41f240[_0xa9fd('0x71')]+=0x1;_0x594556[_0xa9fd('0x72')]+=0x1;_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x0,_0xa9fd('0x75'));ami['emit'](_0xa9fd('0x76'),ut[_0xa9fd('0x77')](_0x594556,'nosuchnumber'));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0x78'));_0x71b8cc[_0xa9fd('0x79')](_0x594556,'0',_0x41f240)[_0xa9fd('0x57')](function(_0x14f7c5){_0x2e036c=_0x14f7c5[_0xa9fd('0x7a')]==0x1;_0x1dec79=_0x41f240['dialNoSuchNumberRetryFrequency'];_0x11fea3=_0x41f240['callAdditionalPhoneAfterMin'];if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240['dialGlobalMaxRetry']){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,_0xa9fd('0x7c'));rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0x7e'));}else{if(_0x594556[_0xa9fd('0x72')]>=_0x41f240[_0xa9fd('0x7f')]){rpcDb[_0xa9fd('0x7d')](_0x594556,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xa9fd('0x80')](ut[_0xa9fd('0x81')](_0x594556,_0xa9fd('0x72'),_0x41f240[_0xa9fd('0x82')]),_0x594556[_0xa9fd('0x83')],_0x594556[_0xa9fd('0x84')]);}}delete this[_0xa9fd('0x15')][_0x28cc18[_0xa9fd('0x85')]];}else{_0x594556['countnosuchnumberretry']++;logger[_0xa9fd('0x42')](_0xa9fd('0x86'),_0x594556[_0xa9fd('0x72')]);logger[_0xa9fd('0x42')]('id',_0x594556[_0xa9fd('0x87')]);_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556[_0xa9fd('0x87')],'field':{'countnosuchnumberretry':_0x594556[_0xa9fd('0x72')]}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});});}});break;case'ANSWER':var _0xfa2507=moment()[_0xa9fd('0x5f')](_0xa9fd('0x60'));_0x594556[_0xa9fd('0x8a')]=_0xfa2507;_0x594556[_0xa9fd('0x8b')]=_0xfa2507;_0x594556[_0xa9fd('0x49')]=!![];_0x41f240[_0xa9fd('0x29')]+=0x1;logger[_0xa9fd('0x42')](_0xa9fd('0x8c'),_0x594556[_0xa9fd('0x8d')],_0xa9fd('0x8e'),_0x41f240['name'],_0xa9fd('0x48'),_0x41f240['pTalking']);ami[_0xa9fd('0x22')](_0xa9fd('0x8f'),ut[_0xa9fd('0x77')](_0x594556,_0xa9fd('0x90'),this['campaignsPreview'][_0x594556['queue']]));if(_0x41f240[_0xa9fd('0x91')]||_0x41f240[_0xa9fd('0x92')]){ami[_0xa9fd('0x22')]('custom:agentConnectPreview',{'queue':_0x594556[_0xa9fd('0x45')],'interface':_0x594556['channelAgent'],'uniqueid':_0x594556[_0xa9fd('0x8d')]});}break;case'16':ami[_0xa9fd('0x22')](_0xa9fd('0x93'),ut[_0xa9fd('0x77')](_0x594556,_0xa9fd('0x94'),this['campaignsPreview'][_0x594556[_0xa9fd('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xa9fd('0x77')](_0x594556,_0xa9fd('0x94')));_0x41f240[_0xa9fd('0x95')]+=0x1;_0x41f240[_0xa9fd('0x96')]+=0x1;_0x41f240['answered']+=0x1;ut[_0xa9fd('0x97')](_0x41f240,'[16]');_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x4,'Answer');rpcDb[_0xa9fd('0x65')](_0x594556,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa9fd('0x7d')](_0x594556,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x594556);_0x41f240[_0xa9fd('0x98')]+=_0x594556['talktime'];_0x41f240[_0xa9fd('0x99')]+=_0x594556[_0xa9fd('0x9a')];logger['info'](_0xa9fd('0x9b'),_0x594556[_0xa9fd('0x8d')],'\x20Queue',_0x41f240[_0xa9fd('0x25')],_0xa9fd('0x48'),_0x41f240[_0xa9fd('0x29')]);delete this['actions'][_0x28cc18['linkedid']];break;case _0xa9fd('0x9c'):_0x41f240['outboundBusyCallsDay']+=0x1;_0x594556['countbusyretry']+=0x1;_0x594556['countglobal']=ut['totalGlobal'](_0x594556);ut['logCustomer'](_0x594556,0x5,'Busy');_0x1dec79=_0x41f240[_0xa9fd('0x9d')];_0x11fea3=_0x41f240[_0xa9fd('0x9e')];ami[_0xa9fd('0x22')](_0xa9fd('0x9f'),ut[_0xa9fd('0x77')](_0x594556,_0xa9fd('0xa0')));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xa1'));_0x71b8cc[_0xa9fd('0x79')](_0x594556,'5',_0x41f240)['then'](function(_0x45af34){_0x2e036c=_0x45af34['additional']==0x1;if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut['cloneAction'](_0x594556,0xf,'Global');rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xa3'));}else{if(_0x594556[_0xa9fd('0xa4')]>=_0x41f240[_0xa9fd('0xa5')]){rpcDb['createCustomerFinal'](_0x594556,_0xa9fd('0xa1'));}else{rpcDb[_0xa9fd('0x80')](ut[_0xa9fd('0x81')](_0x594556,'countbusyretry',_0x41f240['dialBusyRetryFrequency']),_0x594556['unlockAgent'],_0x594556['activeContact']);}}}else{_0x594556[_0xa9fd('0xa4')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556['idContact'],'field':{'countbusyretry':_0x594556[_0xa9fd('0xa4')]}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});});}});break;case _0xa9fd('0xa6'):_0x41f240['outboundNoAnswerCallsDay']+=0x1;_0x594556[_0xa9fd('0xa7')]+=0x1;_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x3,_0xa9fd('0xa8'));_0x1dec79=_0x41f240[_0xa9fd('0xa9')];_0x11fea3=_0x41f240['callAdditionalPhoneAfterMin'];var _0xe6b51d=ut[_0xa9fd('0xaa')](_0x594556,_0x41f240);ami['emit'](_0xa9fd('0xab'),_0xe6b51d);rpcDb[_0xa9fd('0x65')](_0x594556,'[callProgressDetectingCustomer][logNoAnswer]');_0x71b8cc[_0xa9fd('0x79')](_0x594556,'3',_0x41f240)['then'](function(_0x42ac8d){_0x2e036c=_0x42ac8d[_0xa9fd('0x7a')]==0x1;if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,_0xa9fd('0x7c'));rpcDb['createCustomerFinal'](_0x57f028,_0xa9fd('0xac'));}else{if(_0x594556[_0xa9fd('0xa7')]>=_0x41f240[_0xa9fd('0xad')]){rpcDb[_0xa9fd('0x7d')](_0x594556,_0xa9fd('0xae'));}else{rpcDb[_0xa9fd('0x80')](ut['scheduledAt'](_0x594556,'countnoanswerretry',_0x41f240[_0xa9fd('0xa9')]),_0x594556[_0xa9fd('0x83')],_0x594556['activeContact']);}}}else{_0x594556[_0xa9fd('0xa7')]++;_0x71b8cc['incrementPreviewCounters']({'id':_0x594556['idContact'],'field':{'countnoanswerretry':_0x594556[_0xa9fd('0xa7')]}})[_0xa9fd('0x57')](function(){_0x71b8cc['swapAdditionalPhones'](_0x594556,_0x1dec79,_0x11fea3)['then'](function(){});});}});break;case _0xa9fd('0xaf'):_0x41f240[_0xa9fd('0xb0')]+=0x1;_0x594556['countcongestionretry']+=0x1;_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut['logCustomer'](_0x594556,0x8,_0xa9fd('0xb1'));_0x1dec79=_0x41f240[_0xa9fd('0xb2')];_0x11fea3=_0x41f240[_0xa9fd('0x9e')];ami[_0xa9fd('0x22')](_0xa9fd('0xb3'),ut['buildObj'](_0x594556,'congestion'));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xb4'));_0x71b8cc[_0xa9fd('0x79')](_0x594556,'8',_0x41f240)[_0xa9fd('0x57')](function(_0x17463b){_0x2e036c=_0x17463b[_0xa9fd('0x7a')]==0x1;if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,_0xa9fd('0x7c'));rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xb5'));}else{if(_0x594556[_0xa9fd('0xb6')]>=_0x41f240[_0xa9fd('0xb7')]){rpcDb[_0xa9fd('0x7d')](_0x594556,_0xa9fd('0xb4'));}else{rpcDb[_0xa9fd('0x80')](ut['scheduledAt'](_0x594556,_0xa9fd('0xb6'),_0x41f240[_0xa9fd('0x9d')]),_0x594556[_0xa9fd('0x83')],_0x594556[_0xa9fd('0x84')]);}}}else{_0x594556[_0xa9fd('0xb6')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556[_0xa9fd('0x87')],'field':{'countcongestionretry':_0x594556[_0xa9fd('0xb6')]}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});});}});break;case _0xa9fd('0xb8'):_0x41f240['outboundRejectCallsDay']+=0x1;_0x594556['countagentrejectretry']+=0x1;_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x14,_0xa9fd('0xb9'));_0x1dec79=_0x41f240[_0xa9fd('0xba')];_0x11fea3=_0x41f240[_0xa9fd('0x9e')];ami[_0xa9fd('0x22')](_0xa9fd('0xbb'),ut[_0xa9fd('0x77')](_0x594556,'agentreject'));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xbc'));_0x71b8cc[_0xa9fd('0x79')](_0x594556,'20',_0x41f240)[_0xa9fd('0x57')](function(_0x3f6dc0){_0x2e036c=_0x3f6dc0['additional']==0x1;if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut['cloneAction'](_0x594556,0x14,_0xa9fd('0xb9'));rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xbd'));}else{if(_0x594556['countagentrejectretry']>=_0x41f240[_0xa9fd('0xbe')]){rpcDb[_0xa9fd('0x7d')](_0x594556,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9fd('0x80')](ut[_0xa9fd('0x81')](_0x594556,_0xa9fd('0xbf'),_0x41f240['dialAgentRejectRetryFrequency']),_0x594556['unlockAgent'],_0x594556['activeContact']);}}}else{_0x594556[_0xa9fd('0xa7')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556['idContact'],'field':{'countnoanswerretry':_0x594556[_0xa9fd('0xa7')]}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});});}});break;case _0xa9fd('0xc0'):_0x41f240['outboundAbandonedCallsDay']+=0x1;_0x594556['countabandonedretry']+=0x1;_0x594556[_0xa9fd('0x73')]=ut['totalGlobal'](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0xb,_0xa9fd('0xc1'));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xc2'));_0x71b8cc['verifyAdditionalPhones'](_0x594556,'11',_0x41f240)['then'](function(_0x1df4b5){_0x2e036c=_0x1df4b5['additional']==0x1;if(!_0x2e036c){if(ut['totalGlobal'](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,_0xa9fd('0x7c'));rpcDb['createCustomerFinal'](_0x57f028,_0xa9fd('0xc2'));}else{if(_0x594556[_0xa9fd('0xc3')]>=_0x41f240[_0xa9fd('0xc4')]){rpcDb[_0xa9fd('0x7d')](_0x594556,_0xa9fd('0xc2'));}else{rpcDb[_0xa9fd('0x80')](ut[_0xa9fd('0x81')](_0x594556,_0xa9fd('0xc5'),_0x41f240['dialAbandonedRetryFrequency']),_0x594556[_0xa9fd('0x83')],_0x594556[_0xa9fd('0x84')]);}}}else{_0x594556[_0xa9fd('0xa7')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556[_0xa9fd('0x87')],'field':{'countnoanswerretry':_0x594556['countnoanswerretry']}})['then'](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)['then'](function(){});});}});break;case'18':_0x41f240[_0xa9fd('0xc6')]+=0x1;_0x594556[_0xa9fd('0xc7')]+=0x1;_0x594556['countglobal']=ut['totalGlobal'](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x12,_0x28cc18[_0xa9fd('0xc8')]||_0x28cc18[_0xa9fd('0xc9')]);ami['emit'](_0xa9fd('0xca'),ut['buildObj'](_0x594556,_0xa9fd('0xcb')));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xcc'));_0x71b8cc[_0xa9fd('0x79')](_0x594556,'18',_0x41f240)[_0xa9fd('0x57')](function(_0x61540b){_0x2e036c=_0x61540b[_0xa9fd('0x7a')]==0x1;if(!_0x2e036c){if(ut['totalGlobal'](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0x12,_0xa9fd('0x7c'));rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xcc'));}else{rpcDb['createCustomerFinal'](_0x594556,_0xa9fd('0xcc'));}}else{_0x594556[_0xa9fd('0xa7')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556['idContact'],'field':{'countnoanswerretry':_0x594556['countnoanswerretry']}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)['then'](function(){});});}});delete this[_0xa9fd('0x15')][_0x28cc18['linkedid']];break;case'19':_0x41f240['outboundUnknownCallsDay']+=0x1;_0x594556[_0xa9fd('0x73')]=ut[_0xa9fd('0x74')](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0x13,_0x28cc18[_0xa9fd('0xc8')]||_0x28cc18['dialstatus']);ami[_0xa9fd('0x22')](_0xa9fd('0xca'),ut['buildObj'](_0x594556,'amd'));rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xcd'));_0x71b8cc['verifyAdditionalPhones'](_0x594556,'18',_0x41f240)[_0xa9fd('0x57')](function(_0x425286){_0x2e036c=_0x425286[_0xa9fd('0x7a')]==0x1;if(!_0x2e036c){if(ut[_0xa9fd('0x74')](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,'Global');rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xcd'));}else{rpcDb[_0xa9fd('0x7d')](_0x594556,'[callProgressDetectingCustomer][machine]');}}else{_0x594556[_0xa9fd('0xa7')]++;_0x71b8cc[_0xa9fd('0x88')]({'id':_0x594556['idContact'],'field':{'countnoanswerretry':_0x594556[_0xa9fd('0xa7')]}})[_0xa9fd('0x57')](function(){_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});});}});delete this[_0xa9fd('0x15')][_0x28cc18[_0xa9fd('0x85')]];break;default:if(_0x594556['dialAnswer']){ut[_0xa9fd('0x97')](_0x41f240,_0xa9fd('0xce'));ut[_0xa9fd('0xcf')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x41f240[_0xa9fd('0x25')],_0x28cc18);}_0x41f240['outboundUnknownCallsDay']+=0x1;_0x594556[_0xa9fd('0x73')]=ut['totalGlobal'](_0x594556);ut[_0xa9fd('0x61')](_0x594556,0xc,_0x28cc18[_0xa9fd('0xc8')]||_0x28cc18[_0xa9fd('0xc9')]);_0x1dec79=_0x41f240[_0xa9fd('0xba')];_0x11fea3=_0x41f240[_0xa9fd('0x9e')];rpcDb[_0xa9fd('0x65')](_0x594556,_0xa9fd('0xd0'));_0x71b8cc['verifyAdditionalPhones'](_0x594556,'20',_0x41f240)[_0xa9fd('0x57')](function(_0x2a0a93){_0x2e036c=_0x2a0a93['additional']==0x1;if(!_0x2e036c){if(ut['totalGlobal'](_0x594556)>=_0x41f240[_0xa9fd('0xa2')]){_0x57f028=ut[_0xa9fd('0x7b')](_0x594556,0xf,_0xa9fd('0x7c'));rpcDb[_0xa9fd('0x7d')](_0x57f028,_0xa9fd('0xd1'));}else{rpcDb['createCustomerFinal'](_0x594556,_0xa9fd('0xd1'));}delete this[_0xa9fd('0x15')][_0x28cc18[_0xa9fd('0x85')]];}else{_0x71b8cc[_0xa9fd('0x89')](_0x594556,_0x1dec79,_0x11fea3)[_0xa9fd('0x57')](function(){});}});}if(!(_0x594556[_0xa9fd('0x49')]&&_0x549380==='16')){utils['decrementOriginate'](_0x41f240,_0xa9fd('0xd2'));logger[_0xa9fd('0x42')](_0xa9fd('0xd3'),_0x594556[_0xa9fd('0x8d')],_0xa9fd('0x8e'),_0x41f240[_0xa9fd('0x25')],_0xa9fd('0x46'),_0x41f240['originated']);}if(_0x549380!==_0xa9fd('0xd4')){delete this[_0xa9fd('0x15')][_0x28cc18[_0xa9fd('0x85')]];delete this[_0xa9fd('0x15')][_0x28cc18['destlinkedid']];}_0x41f240['queueSummaryCountersUpdated']=!![];}};Preview[_0xa9fd('0xf')][_0xa9fd('0xd5')]=function(_0x15b50b,_0x27f776,_0x371337){if(_['isUndefined'](_0x27f776)&&_0xa9fd('0xd6')!==typeof _0x27f776){return;}if(_[_0xa9fd('0xd7')](_0x371337)&&_0xa9fd('0xd6')!==typeof _0x371337){return;}switch(_0x371337['reason']){case'0':ut[_0xa9fd('0xd8')](_0x15b50b,0x0,_0xa9fd('0x75'));rpcDb[_0xa9fd('0xd9')](_0x15b50b,_0xa9fd('0xda'));break;case'3':ut[_0xa9fd('0xd8')](_0x15b50b,0x3,_0xa9fd('0xa8'));rpcDb[_0xa9fd('0xd9')](_0x15b50b,_0xa9fd('0xdb'));break;case'5':ut['logAgent'](_0x15b50b,0x5,_0xa9fd('0xdc'));rpcDb['createAgentHistory'](_0x15b50b,_0xa9fd('0xdd'));break;case'8':ut['logAgent'](_0x15b50b,0x8,_0xa9fd('0xb1'));rpcDb['createAgentHistory'](_0x15b50b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xa9fd('0xd8')](_0x15b50b,0x16,_0xa9fd('0xde'));rpcDb[_0xa9fd('0xd9')](_0x15b50b,_0xa9fd('0xdf'));break;default:ut[_0xa9fd('0xd8')](_0x15b50b,0xc,_0x371337[_0xa9fd('0xe0')]);rpcDb[_0xa9fd('0xd9')](_0x15b50b,_0xa9fd('0xe1'));}utils[_0xa9fd('0x51')](_0x27f776,_0xa9fd('0xe2'));logger['info'](_0xa9fd('0xe3'),_0x15b50b['uniqueid'],_0xa9fd('0x8e'),_0x27f776[_0xa9fd('0x25')],'originated:\x20',_0x27f776['originated']);delete this['actions'][_0x15b50b[_0xa9fd('0x8d')]];};Preview[_0xa9fd('0xf')][_0xa9fd('0x79')]=function(_0x4c9956,_0x648764,_0x3e004c){return cmHopperAdditionalPhone[_0xa9fd('0x79')](_0x4c9956,_0x648764,_0x3e004c)['catch'](logger[_0xa9fd('0x42')](_0xa9fd('0xe4')));};Preview[_0xa9fd('0xf')][_0xa9fd('0x89')]=function(_0x31e4f5,_0x1949ae,_0x15c8fb){return cmHopperAdditionalPhone[_0xa9fd('0x89')](_0x31e4f5,_0x1949ae,_0x15c8fb)['catch'](logger[_0xa9fd('0x42')](_0xa9fd('0xe5')));};Preview[_0xa9fd('0xf')][_0xa9fd('0x88')]=function(_0x4b81b4){return Promise[_0xa9fd('0xe6')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x4b81b4))[_0xa9fd('0x4f')](logger['info'](_0xa9fd('0xe7')));};Preview[_0xa9fd('0xf')]['checkInBlack']=function(_0x566314,_0x38245a,_0x585c51,_0x47d96f,_0x55104f){var _0xac88a0=this;return new Promise(function(_0x11c496,_0x1da9b4){if(_[_0xa9fd('0x41')](_0x38245a)||_[_0xa9fd('0x41')](_0x38245a[_0xa9fd('0xe8')])||_[_0xa9fd('0x41')](_0x38245a[_0xa9fd('0xe9')])||_[_0xa9fd('0x41')](_0x38245a[_0xa9fd('0x4c')])){_0x1da9b4(ut['message'](_0xa9fd('0xea'),_0x47d96f,_0x55104f));return;}var _0x3d4787=uuid['v4']();var _0x34d664=_0xac88a0['campaignsPreview'][_0x38245a['Queue'][_0xa9fd('0x25')]];var _0x310bf0=_0x585c51?_0xac88a0[_0xa9fd('0x16')][_0x585c51]['id']:undefined;_0xac88a0[_0xa9fd('0x15')][_0x3d4787]=new Action(_0x38245a,_0x34d664,_0x3d4787,_0x585c51,_0x310bf0);var _0x5d6c1f=_0xac88a0['actions'][_0x3d4787];_0x5d6c1f[_0xa9fd('0x83')]=_0x47d96f;_0x5d6c1f[_0xa9fd('0x84')]=_0x55104f;_0x5d6c1f[_0xa9fd('0xeb')]=_0x585c51;if(_[_0xa9fd('0xec')](_0x566314)){_0xac88a0['execCall'](_0x5d6c1f,_0x34d664,_0x38245a,_0x585c51)[_0xa9fd('0x57')](function(_0x2c2f50){logger[_0xa9fd('0x42')]('[Preview][execCall][success]','Queue:\x20'+_0x5d6c1f[_0xa9fd('0x45')]+_0xa9fd('0xed')+_0x5d6c1f[_0xa9fd('0x87')],JSON[_0xa9fd('0x47')](_0x2c2f50));ami[_0xa9fd('0x22')](_0xa9fd('0xee'),ut['buildObj'](_0x5d6c1f,_0xa9fd('0xef'),_0xac88a0['campaignsPreview'][_0x5d6c1f['queue']]));_0x11c496(ut['message']('Calling'));})['catch'](function(_0x2ffc82){ut[_0xa9fd('0x2e')](_0xa9fd('0xf0'),_0x2ffc82);_0x1da9b4(ut[_0xa9fd('0x31')]('Call\x20failed',_0x47d96f,_0x55104f));});}else{_0x34d664['outboundBlacklistCallsDay']+=0x1;ut[_0xa9fd('0xf1')](_0x5d6c1f);rpcDb[_0xa9fd('0xf2')](_0x5d6c1f,_0xa9fd('0xf3'));delete _0xac88a0[_0xa9fd('0x15')][_0x3d4787];_0x1da9b4(ut[_0xa9fd('0x31')](_0xa9fd('0xf4'),_0x47d96f,_0x55104f));}});};Preview[_0xa9fd('0xf')][_0xa9fd('0x6d')]=function(_0x1a1ba3){return!_[_0xa9fd('0x41')](_0x1a1ba3)&&!_[_0xa9fd('0x41')](_0x1a1ba3[_0xa9fd('0x25')])&&!_[_0xa9fd('0x41')](_0x1a1ba3['active'])&&_0x1a1ba3[_0xa9fd('0xf5')]&&!_[_0xa9fd('0x41')](this['trunks'][util[_0xa9fd('0x5f')](_0xa9fd('0xf6'),_0x1a1ba3['name'])])&&!_['isNil'](this[_0xa9fd('0xf7')][util['format'](_0xa9fd('0xf6'),_0x1a1ba3['name'])][_0xa9fd('0xf8')])&&(this[_0xa9fd('0xf7')][util[_0xa9fd('0x5f')](_0xa9fd('0xf6'),_0x1a1ba3['name'])][_0xa9fd('0xf8')]===_0xa9fd('0xf9')||this[_0xa9fd('0xf7')][util['format'](_0xa9fd('0xf6'),_0x1a1ba3['name'])][_0xa9fd('0xf8')]==='unmonitored');};Preview[_0xa9fd('0xf')]['run']=function(_0x5e01a5,_0x252e3e){return this[_0xa9fd('0xfa')](_0x5e01a5,_0x252e3e)['then'](function(_0x58c603){return _[_0xa9fd('0xfb')](_0x58c603,[_0xa9fd('0x31')]);})[_0xa9fd('0x4f')](function(_0x2539b5){if(_0x2539b5[_0xa9fd('0xfc')]){rpcDb[_0xa9fd('0xfd')](_0x5e01a5);}if(_0x2539b5['active']){rpcDb[_0xa9fd('0x5e')](_0x5e01a5);}throw _[_0xa9fd('0xfb')](_0x2539b5,['message']);});};Preview['prototype'][_0xa9fd('0xfa')]=function(_0x5d2ad4,_0x39a574){var _0x41d638=this;var _0x115d88,_0xa4dd7f;return rpcDb[_0xa9fd('0xfe')](_0x5d2ad4)[_0xa9fd('0x57')](function(_0x3ddd50){if(!_[_0xa9fd('0x41')](_0x3ddd50[0x0])){_0xa4dd7f=_0x3ddd50[0x0][_0xa9fd('0xff')]?![]:!![];_0x115d88=_0x3ddd50[0x0][_0xa9fd('0xff')]?!![]:![];_0x115d88=_0x39a574?!![]:_0x115d88;}var _0xd4167e=_0x41d638[_0xa9fd('0x100')](_0x3ddd50);if(_0xd4167e[_0xa9fd('0x101')]){rpcDb[_0xa9fd('0x102')](_[_0xa9fd('0xfb')](_0x3ddd50[0x0],['VoiceQueueId',_0xa9fd('0xe9')]))[_0xa9fd('0x57')](function(_0x168f9f){_0x41d638[_0xa9fd('0x103')](_0x168f9f,_0x3ddd50[0x0],_0x39a574,_0xa4dd7f,_0x115d88)[_0xa9fd('0x57')](function(_0xd87c21){return _0xd87c21;})[_0xa9fd('0x4f')](function(_0xd998fc){throw _0xd998fc;});})['catch'](function(_0x1f0eee){ut['logger'](_0xa9fd('0x104'),_0x1f0eee);throw ut['message']('Call\x20unsuccessful',_0xa4dd7f,_0x115d88);});}else{throw ut[_0xa9fd('0x31')](_0xd4167e[_0xa9fd('0x31')],_0xa4dd7f,_0x115d88);}})[_0xa9fd('0x4f')](function(_0x485b17){ut['logger'](_0xa9fd('0x105'),_0x485b17);throw ut[_0xa9fd('0x31')](_0xa9fd('0x106'),![],!![]);});};Preview[_0xa9fd('0xf')][_0xa9fd('0x100')]=function(_0x326e9f){if(_[_0xa9fd('0x41')](_0x326e9f)||_['isEmpty'](_0x326e9f)||!_[_0xa9fd('0x41')](_0x326e9f[0x0][_0xa9fd('0x107')])&&_[_0xa9fd('0x41')](_0x326e9f[0x0][_0xa9fd('0x107')]['name'])){ut[_0xa9fd('0x2e')]('[Preview][validateContact][Empty\x20Contact]',_0x326e9f);return{'isValid':![],'message':_0xa9fd('0x108')};}var _0x33693a=this['campaignsPreview'][_0x326e9f[0x0][_0xa9fd('0x44')][_0xa9fd('0x25')]];_0x33693a[_0xa9fd('0x31')]=utils[_0xa9fd('0x2c')]['ACTIVE'];if(_[_0xa9fd('0x41')](_0x33693a)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x33693a);return{'isValid':![],'message':_0xa9fd('0x109')};}if(!this['isTrunkReachable'](_0x33693a[_0xa9fd('0x10a')])){ut['logger'](_0xa9fd('0x10b'),_0xa9fd('0x10c')+_0x33693a[_0xa9fd('0x25')]+_0xa9fd('0x10d'));if(!this[_0xa9fd('0x6d')](_0x33693a['TrunkBackup'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x33693a[_0xa9fd('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa9fd('0x10e')};}}if(!ut['isActive'](_0x33693a[_0xa9fd('0x3c')])){ut[_0xa9fd('0x2e')](_0xa9fd('0x10f'),_0x33693a[_0xa9fd('0x25')]+_0xa9fd('0x110'));return{'isValid':![],'message':_0xa9fd('0x10c')+_0x33693a[_0xa9fd('0x25')]+_0xa9fd('0x110')};}return{'isValid':!![],'message':_0xa9fd('0x111')};};Preview['prototype']['execCall']=function(_0xc68d79,_0x19ec58,_0x2f289b,_0x10fe07){var _0x5bae66=this;return new Promise(function(_0x3885e5,_0x14f1ca){var _0x2761c0=_0xc68d79[_0xa9fd('0x8d')];var _0x8fa42e=_0x5bae66[_0xa9fd('0x6d')](_0x19ec58['Trunk'])?util[_0xa9fd('0x5f')](_0xa9fd('0x112'),_0x19ec58[_0xa9fd('0x10a')]['name'],_[_0xa9fd('0x41')](_0x19ec58[_0xa9fd('0x113')])?'':_0x19ec58[_0xa9fd('0x113')][_0xa9fd('0x114')]()||'',_0x19ec58[_0xa9fd('0x115')]>0x0?_0x2f289b[_0xa9fd('0xe9')][_0xa9fd('0x116')](_0x19ec58[_0xa9fd('0x115')]):_0x2f289b[_0xa9fd('0xe9')]):util['format'](_0xa9fd('0x112'),_[_0xa9fd('0x41')](_0x19ec58[_0xa9fd('0x117')])?_0x19ec58[_0xa9fd('0x10a')][_0xa9fd('0x25')]:_0x19ec58[_0xa9fd('0x117')][_0xa9fd('0x25')],_['isNil'](_0x19ec58[_0xa9fd('0x113')])?'':_0x19ec58[_0xa9fd('0x113')][_0xa9fd('0x114')]()||'',_0x19ec58[_0xa9fd('0x115')]>0x0?_0x2f289b[_0xa9fd('0xe9')][_0xa9fd('0x116')](_0x19ec58[_0xa9fd('0x115')]):_0x2f289b[_0xa9fd('0xe9')]);var _0x56fb8f=_0x5bae66[_0xa9fd('0x6d')](_0x19ec58[_0xa9fd('0x10a')])?ut['getCallerId'](_0x19ec58[_0xa9fd('0x10a')][_0xa9fd('0x118')],_0x19ec58[_0xa9fd('0x119')],_0x19ec58[_0xa9fd('0x11a')]>0x0?ut['getCallerIdRandom'](_0x19ec58[_0xa9fd('0x11b')],_0x19ec58['dialRandomLastDigitCallerIdNumber']):_0x19ec58[_0xa9fd('0x11b')]):ut['getCallerId'](_[_0xa9fd('0x41')](_0x19ec58['TrunkBackup'])?_0x19ec58['Trunk']['callerid']:_0x19ec58[_0xa9fd('0x117')]['callerid'],_0x19ec58['dialOriginateCallerIdName'],_0x19ec58[_0xa9fd('0x11a')]>0x0?ut['getCallerIdRandom'](_0x19ec58['dialOriginateCallerIdNumber'],_0x19ec58['dialRandomLastDigitCallerIdNumber']):_0x19ec58[_0xa9fd('0x11b')]);if(_0x56fb8f){_0xc68d79[_0xa9fd('0x11c')]=ut['extractCalleridName'](_0x56fb8f);_0xc68d79[_0xa9fd('0x11d')]=ut[_0xa9fd('0x11e')](_0x56fb8f);}var _0x29fd25=ut['addVariables'](_0x19ec58,_0x2f289b,_0x8fa42e,_0x56fb8f,_0x2761c0,_0xc68d79);var _0x497b88=utils['setXMDContactVariables'](_0x2f289b[_0xa9fd('0xe8')]);Object['assign'](_0x29fd25,_0x497b88);_[_0xa9fd('0x11f')](_0xc68d79,ut['toLowerVariables'](_0x29fd25));_0xc68d79[_0xa9fd('0x120')]=moment()[_0xa9fd('0x5f')](_0xa9fd('0x60'));_0x19ec58[_0xa9fd('0x121')]=_0x29fd25;var _0x548451=ut[_0xa9fd('0x122')](_0xc68d79,_0x19ec58,_0x29fd25,_0xc68d79[_0xa9fd('0x84')],_0x10fe07);return ami[_0xa9fd('0x4d')](_0x548451)['then'](function(_0x10eaca){_0x19ec58[_0xa9fd('0x28')]+=0x1;logger[_0xa9fd('0x42')](_0xa9fd('0x123'),_0x2761c0,_0xa9fd('0x8e'),_0x19ec58['name'],_0xa9fd('0x46'),_0x19ec58['originated']);_0x3885e5(_0x10eaca);})[_0xa9fd('0x4f')](function(_0x1d44a9){ut[_0xa9fd('0xd8')](_0xc68d79,0xe,'OriginateError');rpcDb[_0xa9fd('0xd9')](_0xc68d79,_0xa9fd('0x124'));_0x14f1ca(_0x1d44a9);});});};Preview[_0xa9fd('0xf')][_0xa9fd('0x1f')]=function(_0x267357){if(this[_0xa9fd('0x15')][_0x267357['linkedid']]){this[_0xa9fd('0x15')][_0x267357[_0xa9fd('0x85')]]['channel']=_0x267357['channel'];}};Preview[_0xa9fd('0xf')][_0xa9fd('0x17')]=function(_0x3ac773){var _0x48f90a=this;var _0x33d58e=this['actions'][_0x3ac773['actionid']];if(_0x33d58e){if(_0x33d58e[_0xa9fd('0xeb')]&&this[_0xa9fd('0x16')][_0x33d58e[_0xa9fd('0xeb')]]){ut[_0xa9fd('0x125')](_0x33d58e,this['agents'][_0x33d58e[_0xa9fd('0xeb')]][_0xa9fd('0x25')],this[_0xa9fd('0x16')][_0x33d58e[_0xa9fd('0xeb')]]['id']);}var _0x3386c2=_[_0xa9fd('0x126')](_0x33d58e);_0x3386c2[_0xa9fd('0x8a')]=moment()[_0xa9fd('0x5f')](_0xa9fd('0x60'));var _0x320091=_0x48f90a[_0xa9fd('0x14')][_0x33d58e['queue']];if(ut[_0xa9fd('0x127')](_0x3ac773[_0xa9fd('0x128')])){if(_0x33d58e[_0xa9fd('0x83')]){rpcDb['unlockContact'](_0x33d58e['idContact']);}if(_0x33d58e[_0xa9fd('0x84')]){rpcDb[_0xa9fd('0x5e')](_0x33d58e[_0xa9fd('0x87')]);}ami[_0xa9fd('0x22')]('custom:agentringnoanswer',ut[_0xa9fd('0x77')](_0x33d58e,_0xa9fd('0x129'),this['campaignsPreview'][_0x33d58e[_0xa9fd('0x45')]]));this['callProgressDetectingAgent'](_0x3386c2,_0x320091,_0x3ac773);}else{_0x33d58e['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0xa9fd('0xd8')](_0x3386c2,0x4,_0xa9fd('0x12a'));rpcDb['createAgentHistory'](_0x3386c2,_0xa9fd('0x12b'));}}};Preview[_0xa9fd('0xf')][_0xa9fd('0x18')]=function(_0xa99f5a){var _0x900534=this[_0xa9fd('0x15')][_0xa99f5a[_0xa9fd('0x85')]];var _0x23fada;if(_0x900534){_0x23fada=this['campaignsPreview'][_0x900534['queue']];logger[_0xa9fd('0x42')](_0xa9fd('0x12c'),_0xa99f5a[_0xa9fd('0x85')],_0xa9fd('0x8e'),_0x23fada[_0xa9fd('0x25')],_0xa9fd('0x48'),_0x23fada['pTalking']);}if(this[_0xa9fd('0x15')][_0xa99f5a[_0xa9fd('0x85')]]&&_0xa99f5a[_0xa9fd('0x85')]!==_0xa99f5a[_0xa9fd('0x8d')]){if(_0xa99f5a[_0xa9fd('0x12d')]==='16'&&this[_0xa9fd('0x15')][_0xa99f5a['linkedid']][_0xa9fd('0x49')]){this['callProgressDetectingCustomer'](_0xa99f5a,_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a['cause']);}else if(this[_0xa9fd('0x15')][_0xa99f5a[_0xa9fd('0x85')]][_0xa9fd('0x49')]){logger[_0xa9fd('0x42')]('[syncHangup][talking][cause]',_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a[_0xa9fd('0x12d')],_0xa9fd('0x8e'),_0x23fada[_0xa9fd('0x25')],_0xa9fd('0x48'),_0x23fada[_0xa9fd('0x29')]);this[_0xa9fd('0x70')](_0xa99f5a,_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a[_0xa9fd('0x12d')]);}}else if(_0x900534&&_[_0xa9fd('0x41')](_0x900534['statedesc'])&&_0x23fada[_0xa9fd('0x12e')]&&_0xa99f5a['linkedid']===_0xa99f5a[_0xa9fd('0x8d')]&&_[_0xa9fd('0x41')](_0xa99f5a[_0xa9fd('0xe0')])&&_0xa99f5a[_0xa9fd('0x12d')]==='16'&&_0xa99f5a[_0xa9fd('0x12f')]==='6'&&_['isUndefined'](_0x900534['transfer'])){if(_0x900534[_0xa9fd('0x83')]){rpcDb['unlockContact'](_0x900534['idContact']);}if(_0x900534['activeContact']){rpcDb[_0xa9fd('0x5e')](_0x900534[_0xa9fd('0x87')]);}_0xa99f5a[_0xa9fd('0xe0')]='22';this[_0xa9fd('0xd5')](_0x900534,_0x23fada,_0xa99f5a);}else if(_0x900534&&_0x900534['transfer']){if(_0xa99f5a[_0xa9fd('0x12d')]==='16'&&this[_0xa9fd('0x15')][_0xa99f5a[_0xa9fd('0x85')]][_0xa9fd('0x49')]){logger[_0xa9fd('0x42')]('[syncHangup][talking][transfer]',_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a[_0xa9fd('0x12d')],'\x20Queue',_0x23fada[_0xa9fd('0x25')],_0xa9fd('0x48'),_0x23fada[_0xa9fd('0x29')]);this[_0xa9fd('0x70')](_0xa99f5a,_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a[_0xa9fd('0x12d')]);}else if(this[_0xa9fd('0x15')][_0xa99f5a[_0xa9fd('0x85')]][_0xa9fd('0x49')]){logger['info'](_0xa9fd('0x130'),_0xa99f5a[_0xa9fd('0x85')],_0xa99f5a[_0xa9fd('0x12d')],_0xa9fd('0x8e'),_0x23fada[_0xa9fd('0x25')],_0xa9fd('0x48'),_0x23fada['pTalking']);this[_0xa9fd('0x70')](_0xa99f5a,_0xa99f5a['linkedid'],_0xa99f5a[_0xa9fd('0x12d')]);}}};Preview[_0xa9fd('0xf')][_0xa9fd('0x1d')]=function(_0x2e46cd){if(this['actions'][_0x2e46cd[_0xa9fd('0x131')]]&&_0x2e46cd['destlinkedid']!==_0x2e46cd[_0xa9fd('0x132')]){this[_0xa9fd('0x70')](_0x2e46cd,_0x2e46cd[_0xa9fd('0x131')],_0x2e46cd[_0xa9fd('0xc9')]);}};Preview[_0xa9fd('0xf')][_0xa9fd('0x1b')]=function(_0x43864f){if(this[_0xa9fd('0x15')][_0x43864f[_0xa9fd('0x85')]]&&_0x43864f[_0xa9fd('0x85')]!==_0x43864f[_0xa9fd('0x8d')]&&!this['actions'][_0x43864f[_0xa9fd('0x85')]]['dialAnswer']){if(_0x43864f[_0xa9fd('0x12d')]==='1'){this['callProgressDetectingCustomer'](_0x43864f,_0x43864f['linkedid'],_0x43864f[_0xa9fd('0x12d')]);}}};Preview[_0xa9fd('0xf')][_0xa9fd('0x133')]=function(_0x4e0586,_0x578265,_0x244826){if(this[_0xa9fd('0x15')][_0x4e0586]){if(_[_0xa9fd('0x41')](this[_0xa9fd('0x15')][_0x4e0586][_0xa9fd('0x121')])){this[_0xa9fd('0x15')][_0x4e0586][_0xa9fd('0x121')]={};}this[_0xa9fd('0x15')][_0x4e0586][_0xa9fd('0x121')][_0x578265]=_0x244826;}};Preview[_0xa9fd('0xf')][_0xa9fd('0x134')]=function(_0x51ff0a){try{if(!_[_0xa9fd('0x41')](_0x51ff0a)){if(ut[_0xa9fd('0x135')](_[_0xa9fd('0x136')](_0x51ff0a[_0xa9fd('0x137')])[0x0])){this[_0xa9fd('0x133')](_0x51ff0a['uniqueid'],_['keys'](_0x51ff0a['variable'])[0x0],_0x51ff0a[_0xa9fd('0x138')]);}}}catch(_0x4a2a47){logger[_0xa9fd('0x139')](_0xa9fd('0x13a'),util['inspect'](_0x4a2a47,{'showHidden':![],'depth':null}));}};Preview[_0xa9fd('0xf')]['syncAttendedTransfer']=function(_0x3427f2){if(_0x3427f2){if(this[_0xa9fd('0x15')][_0x3427f2[_0xa9fd('0x13b')]]){this[_0xa9fd('0x15')][_0x3427f2[_0xa9fd('0x13b')]][_0xa9fd('0x13c')]=!![];}}};Preview[_0xa9fd('0xf')][_0xa9fd('0x13d')]=function(_0x18646){if(_0x18646){if(this[_0xa9fd('0x15')][_0x18646[_0xa9fd('0x13e')]]){this[_0xa9fd('0x15')][_0x18646[_0xa9fd('0x13e')]][_0xa9fd('0x13c')]=!![];}}};module[_0xa9fd('0x13f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b827274..3410fbd 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 _0xdf40=['xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','then','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xdf40,0xd6));var _0x0df4=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xdf40[_0x58e469];return _0x4c01c5;};'use strict';var util=require(_0x0df4('0x0'));var BPromise=require(_0x0df4('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x0df4('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0df4('0x3'));var agentReportPreview=require(_0x0df4('0x4'));var voiceQueueReport=require(_0x0df4('0x5'));function loggerCatch(_0x231421){return function(_0x30f6b9){logger[_0x0df4('0x6')](_0x231421,util['inspect'](_0x30f6b9,{'showHidden':![],'depth':null}));};}function create(_0x2ceec4){return cmHopperHistory[_0x0df4('0x7')](_0x2ceec4)[_0x0df4('0x8')](loggerCatch(_0x0df4('0x9')));}function createAgent(_0x2ed81a){return BPromise[_0x0df4('0xa')]()['then'](agentReportPreview[_0x0df4('0x7')](_0x2ed81a))[_0x0df4('0x8')](loggerCatch(_0x0df4('0x9')));}function moveContact(_0x146f70){return cmHopper[_0x0df4('0xb')](_0x146f70,!![])['catch'](loggerCatch(_0x0df4('0xc')));}exports[_0x0df4('0xd')]=function(_0x5f1571){return cmHopperBlack['checkIsBlackList'](_0x5f1571)[_0x0df4('0x8')](loggerCatch(_0x0df4('0xe')));};exports[_0x0df4('0xf')]=function(_0x382e53){return BPromise['resolve']()['then'](cmHopper[_0x0df4('0xf')](_0x382e53))[_0x0df4('0x8')](loggerCatch(_0x0df4('0x10')));};exports[_0x0df4('0x7')]=function(_0xf91b24,_0x499800){create(_0xf91b24)[_0x0df4('0x8')](loggerCatch(_0x499800));moveContact(_0xf91b24)[_0x0df4('0x8')](loggerCatch(_0x499800));};exports[_0x0df4('0x11')]=function(_0x19279b,_0x45e12b){createAgent(_0x19279b)[_0x0df4('0x8')](loggerCatch(_0x45e12b));};exports[_0x0df4('0x12')]=function(_0x35dc86,_0x916190){create(_0x35dc86)[_0x0df4('0x8')](loggerCatch(_0x916190));};exports['createCustomerFinal']=function(_0x58203c,_0x3941fa){moveContact(_0x58203c)[_0x0df4('0x8')](loggerCatch(_0x3941fa));};exports[_0x0df4('0x13')]=function(_0x24c990,_0x4a0b40,_0x3af852){if(_0x4a0b40){_0x24c990[_0x0df4('0x14')]=null;}if(_0x3af852){_0x24c990[_0x0df4('0x15')]=![];}return cmHopper[_0x0df4('0x13')](_0x24c990)[_0x0df4('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x0df4('0x16')]=function(_0x52c35c){return cmHopper[_0x0df4('0x16')](_0x52c35c)[_0x0df4('0x8')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x2c4e33){return cmHopper[_0x0df4('0x17')]({'UserId':null},_0x2c4e33,0x1)[_0x0df4('0x8')](loggerCatch(_0x0df4('0x18')));};exports[_0x0df4('0x19')]=function(_0x10cc88){return cmHopper[_0x0df4('0x17')]({'active':![]},_0x10cc88,0x1)[_0x0df4('0x8')](loggerCatch(_0x0df4('0x1a')));};exports[_0x0df4('0x1b')]=function(_0x5cefa2){var _0x14e29d={};_0x14e29d[_0x0df4('0x1c')]=_0x5cefa2[_0x0df4('0x1c')];_0x14e29d[_0x0df4('0x1d')]=_0x5cefa2[_0x0df4('0x1d')];_0x14e29d['calleridnum']=_0x5cefa2['calleridnum'];_0x14e29d[_0x0df4('0x1e')]=_0x5cefa2[_0x0df4('0x1e')];_0x14e29d[_0x0df4('0x1f')]=_0x5cefa2['queue'];_0x14e29d['queuecallerjoinAt']=_0x5cefa2[_0x0df4('0x20')];_0x14e29d[_0x0df4('0x21')]=_0x5cefa2[_0x0df4('0x20')];_0x14e29d[_0x0df4('0x22')]=0x1;_0x14e29d[_0x0df4('0x23')]=_0x5cefa2[_0x0df4('0x24')];_0x14e29d[_0x0df4('0x25')]=_0x5cefa2[_0x0df4('0x26')];_0x14e29d[_0x0df4('0x27')]='from-sip';_0x14e29d[_0x0df4('0x28')]=_0x0df4('0x29');_0x14e29d[_0x0df4('0x2a')]=0x0;_0x14e29d['assigned']=0x1;_0x14e29d[_0x0df4('0x2b')]=_0x5cefa2[_0x0df4('0x26')];_0x14e29d[_0x0df4('0x2c')]=_0x0df4('0x2d');return BPromise[_0x0df4('0xa')]()[_0x0df4('0x2e')](voiceQueueReport[_0x0df4('0x2f')](_0x14e29d))['catch'](loggerCatch(_0x0df4('0x30')));};exports['getContactRecallMe']=function(_0x3cc7f9,_0x5173bb){return BPromise[_0x0df4('0xa')]()[_0x0df4('0x2e')](cmHopper['getContactRecallMe'](_0x3cc7f9,_0x5173bb))[_0x0df4('0x8')](loggerCatch(_0x0df4('0x31')));};exports[_0x0df4('0x32')]=function(_0x250973){return cmHopper[_0x0df4('0x13')](_0x250973,!![],!![])[_0x0df4('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x42ae=['rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','then','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','UserId','active'];(function(_0x2d719c,_0x59b346){var _0x16c7e8=function(_0x2cd5a8){while(--_0x2cd5a8){_0x2d719c['push'](_0x2d719c['shift']());}};_0x16c7e8(++_0x59b346);}(_0x42ae,0x18b));var _0xe42a=function(_0x38e5ee,_0x3cd0cb){_0x38e5ee=_0x38e5ee-0x0;var _0x85812d=_0x42ae[_0x38e5ee];return _0x85812d;};'use strict';var util=require(_0xe42a('0x0'));var BPromise=require('bluebird');var logger=require(_0xe42a('0x1'))(_0xe42a('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xe42a('0x3'));var cmHopperBlack=require(_0xe42a('0x4'));var agentReportPreview=require(_0xe42a('0x5'));var voiceQueueReport=require(_0xe42a('0x6'));function loggerCatch(_0x5b9dc8){return function(_0x5ac7ae){logger[_0xe42a('0x7')](_0x5b9dc8,util[_0xe42a('0x8')](_0x5ac7ae,{'showHidden':![],'depth':null}));};}function create(_0x1af4ef){return cmHopperHistory[_0xe42a('0x9')](_0x1af4ef)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x143441){return BPromise[_0xe42a('0xa')]()['then'](agentReportPreview['createHistory'](_0x143441))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4848ea){return cmHopper[_0xe42a('0xb')](_0x4848ea,!![])['catch'](loggerCatch(_0xe42a('0xc')));}exports[_0xe42a('0xd')]=function(_0x17b48e){return cmHopperBlack[_0xe42a('0xd')](_0x17b48e)[_0xe42a('0xe')](loggerCatch(_0xe42a('0xf')));};exports[_0xe42a('0x10')]=function(_0x56239c){return BPromise[_0xe42a('0xa')]()['then'](cmHopper[_0xe42a('0x10')](_0x56239c))[_0xe42a('0xe')](loggerCatch(_0xe42a('0x11')));};exports[_0xe42a('0x9')]=function(_0x3ce529,_0x31d5e3){create(_0x3ce529)['catch'](loggerCatch(_0x31d5e3));moveContact(_0x3ce529)[_0xe42a('0xe')](loggerCatch(_0x31d5e3));};exports['createAgentHistory']=function(_0x1d70d,_0x9e38d2){createAgent(_0x1d70d)[_0xe42a('0xe')](loggerCatch(_0x9e38d2));};exports['createCustomerHistory']=function(_0xf13897,_0x571abb){create(_0xf13897)[_0xe42a('0xe')](loggerCatch(_0x571abb));};exports[_0xe42a('0x12')]=function(_0x39b928,_0x130bd6){moveContact(_0x39b928)[_0xe42a('0xe')](loggerCatch(_0x130bd6));};exports['rescheduleContact']=function(_0x1e2c6b,_0x5e86eb,_0x31545e){if(_0x5e86eb){_0x1e2c6b[_0xe42a('0x13')]=null;}if(_0x31545e){_0x1e2c6b[_0xe42a('0x14')]=![];}return cmHopper[_0xe42a('0x15')](_0x1e2c6b)[_0xe42a('0xe')](loggerCatch(_0xe42a('0x16')));};exports[_0xe42a('0x17')]=function(_0x16b6b3){return cmHopper['countReScheduled'](_0x16b6b3)[_0xe42a('0xe')](loggerCatch(_0xe42a('0x18')));};exports[_0xe42a('0x19')]=function(_0x22c94e){return cmHopper['unlockContact']({'UserId':null},_0x22c94e,0x1)[_0xe42a('0xe')](loggerCatch(_0xe42a('0x1a')));};exports['disableContact']=function(_0x104969){return cmHopper[_0xe42a('0x19')]({'active':![]},_0x104969,0x1)[_0xe42a('0xe')](loggerCatch(_0xe42a('0x1b')));};exports[_0xe42a('0x1c')]=function(_0x5a14f9){var _0x23bebd={};_0x23bebd[_0xe42a('0x1d')]=_0x5a14f9[_0xe42a('0x1d')];_0x23bebd[_0xe42a('0x1e')]=_0x5a14f9['uniqueid'];_0x23bebd['calleridnum']=_0x5a14f9['calleridnum'];_0x23bebd['calleridname']=_0x5a14f9[_0xe42a('0x1f')];_0x23bebd['queue']=_0x5a14f9[_0xe42a('0x20')];_0x23bebd[_0xe42a('0x21')]=_0x5a14f9[_0xe42a('0x22')];_0x23bebd[_0xe42a('0x23')]=_0x5a14f9[_0xe42a('0x22')];_0x23bebd[_0xe42a('0x24')]=0x1;_0x23bebd[_0xe42a('0x25')]=_0x5a14f9[_0xe42a('0x26')];_0x23bebd[_0xe42a('0x27')]=_0x5a14f9['membername'];_0x23bebd[_0xe42a('0x28')]=_0xe42a('0x29');_0x23bebd['exten']=_0xe42a('0x2a');_0x23bebd['holdtime']=0x0;_0x23bebd[_0xe42a('0x2b')]=0x1;_0x23bebd[_0xe42a('0x2c')]=_0x5a14f9[_0xe42a('0x2d')];_0x23bebd[_0xe42a('0x2e')]='COMPLETED';return BPromise[_0xe42a('0xa')]()[_0xe42a('0x2f')](voiceQueueReport[_0xe42a('0x30')](_0x23bebd))[_0xe42a('0xe')](loggerCatch(_0xe42a('0x31')));};exports[_0xe42a('0x32')]=function(_0x1868da,_0x34e4fe){return BPromise['resolve']()['then'](cmHopper[_0xe42a('0x32')](_0x1868da,_0x34e4fe))[_0xe42a('0xe')](loggerCatch(_0xe42a('0x33')));};exports['rescheduleContactInQueue']=function(_0x1cb44d){return cmHopper[_0xe42a('0x15')](_0x1cb44d,!![],!![])[_0xe42a('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 d5d6370..b48aa9c 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 _0x50ab=['pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking'];(function(_0x2ddf2a,_0x396249){var _0x397962=function(_0x5aa472){while(--_0x5aa472){_0x2ddf2a['push'](_0x2ddf2a['shift']());}};_0x397962(++_0x396249);}(_0x50ab,0x1eb));var _0xb50a=function(_0xc3f0cd,_0x3886a2){_0xc3f0cd=_0xc3f0cd-0x0;var _0x14a8c4=_0x50ab[_0xc3f0cd];return _0x14a8c4;};'use strict';var util=require(_0xb50a('0x0'));var _=require(_0xb50a('0x1'));var moment=require(_0xb50a('0x2'));var logger=require(_0xb50a('0x3'))('preview');var ipAgi=process[_0xb50a('0x4')][_0xb50a('0x5')]||_0xb50a('0x6');var utils=require('../../dialer/utils');exports[_0xb50a('0x7')]=function(_0x36dfd){return function(_0x4f1360){logger[_0xb50a('0x8')](_0x36dfd,util['inspect'](_0x4f1360,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0x9')]=function(_0x2f97ba,_0x60b6c5){logger[_0xb50a('0xa')](_0x2f97ba,util[_0xb50a('0xb')](_0x60b6c5,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xc')]=function(_0x22fd68,_0x27e5fc){logger[_0xb50a('0x8')](_0x22fd68,util[_0xb50a('0xb')](_0x27e5fc,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xd')]=function(_0x5d6f5c){return function(_0x5c26be){logger[_0xb50a('0xa')](_0x5d6f5c,util[_0xb50a('0xb')](_0x5c26be,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0xe')]=function(_0x5308b3,_0x471fc9,_0x26f772){return{'message':_0x5308b3,'unlock':_0x471fc9,'active':_0x26f772};};exports['getCallerId']=function(_0x4a139b,_0x12031,_0x448236){if(!_['isUndefined'](_0x448236)&&_0xb50a('0xf')===typeof _0x448236&&!_[_0xb50a('0x10')](_0x448236)){if(!_[_0xb50a('0x11')](_0x12031)&&_0xb50a('0xf')===typeof _0x12031&&!_['isEmpty'](_0x12031)){return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x12031,_0x448236);}return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x448236,_0x448236);}if(!_['isUndefined'](_0x4a139b)&&_0xb50a('0xf')===typeof _0x4a139b&&!_['isEmpty'](_0x4a139b)){return _0x4a139b;}return _0xb50a('0x14');};exports[_0xb50a('0x15')]=function(_0x478299){if(_[_0xb50a('0x16')](_0x478299)){return![];}return _0x478299;};exports[_0xb50a('0x17')]=function(_0xee4cef,_0x35c554,_0x3ccf0c,_0x171c22,_0x275ece,_0x56a0d3){var _0x438249={'XMD-QUEUE':_0x35c554['Queue']?_0x35c554[_0xb50a('0x18')][_0xb50a('0x19')]:'','XMD-CALLERID':_0x171c22,'XMD-CALLERID-PREVIEW':_0x56a0d3?util[_0xb50a('0x12')](_0xb50a('0x13'),_0x56a0d3[_0xb50a('0x1a')],_0x56a0d3[_0xb50a('0x1b')]):_0x171c22,'XMD-DIALID':_0x275ece,'XMD-CONTACTID':_0x35c554[_0xb50a('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x171c22,'XMD-VOICEQUEUEID':_0x35c554['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3ccf0c,'XMD-DIALTIMEOUT':_0xee4cef['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb50a('0x12')]('\x22rtTxX%s%s\x22',_0xee4cef[_0xb50a('0x1d')]?'g':'',_['isEmpty'](_0xee4cef['monitor_format'])?'':_0xb50a('0x1e')),'XMD-DIALURL':_0xee4cef[_0xb50a('0x1f')]||'','XMD-AGI':_0xee4cef[_0xb50a('0x20')]?util['format'](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x20')]):'NONE','XMD-AGIAFTER':_0xee4cef[_0xb50a('0x1d')]?util[_0xb50a('0x12')](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x1d')]):_0xb50a('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x56a0d3?_0x56a0d3[_0xb50a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x56a0d3?_0x56a0d3['originatecalleridname']:'','XMD-DESTINATION':_0xb50a('0x24'),'SIPADDHEADER':_0xb50a('0x25')};if(!_[_0xb50a('0x10')](_0xee4cef[_0xb50a('0x26')])){_0x438249[util['format']('%s',_0xb50a('0x27'))]=_0xee4cef[_0xb50a('0x26')];_0x438249[util[_0xb50a('0x12')]('%s',_0xb50a('0x28'))]=_0x275ece;}return _0x438249;};exports[_0xb50a('0x29')]=function(_0x93ffff){var _0x5fa9b8={};for(var _0x50343d in _0x93ffff){if(_0x93ffff[_0xb50a('0x2a')](_0x50343d)){_0x5fa9b8[util['format']('%s',_[_0xb50a('0x2b')](_0x50343d))]=_0x93ffff[_0x50343d];}}return{'variables':_0x5fa9b8};};exports[_0xb50a('0x2c')]=function(_0x4310e7){var _0x59c51a=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4310e7[_0xb50a('0x2e')]=0xd;_0x4310e7[_0xb50a('0x2f')]='Blacklist';_0x4310e7[_0xb50a('0x30')]=_0x59c51a;_0x4310e7[_0xb50a('0x31')]=_0x59c51a;_0x4310e7['endtime']=_0x59c51a;};exports['logAgent']=function(_0x229601,_0x237f0c,_0x32f8a6){var _0x5d2396=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x229601[_0xb50a('0x2e')]=_0x237f0c;_0x229601[_0xb50a('0x2f')]=_0x32f8a6;_0x229601['responsetime']=_0x5d2396;_0x229601[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x229601[_0xb50a('0x31')],_0x229601['starttime']);};exports[_0xb50a('0x34')]=function(_0xbade32,_0x317e18,_0xe11c65){_0xbade32['membername']=_0x317e18;_0xbade32[_0xb50a('0x35')]=_0xe11c65;};exports[_0xb50a('0x36')]=function(_0x25d80a,_0x4bf1a4,_0x244d15){var _0x3a7ebb=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x25d80a[_0xb50a('0x2e')]=_0x4bf1a4;_0x25d80a['statedesc']=_0x244d15;_0x25d80a[_0xb50a('0x31')]=_0x25d80a[_0xb50a('0x31')]?_0x25d80a[_0xb50a('0x31')]:_0x3a7ebb;_0x25d80a[_0xb50a('0x37')]=_0x25d80a['endtime']?_0x25d80a['endtime']:_0x3a7ebb;_0x25d80a[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x25d80a['responsetime']||0x0,_0x25d80a[_0xb50a('0x30')]||0x0);_0x25d80a[_0xb50a('0x38')]=_0x25d80a[_0xb50a('0x39')]?utils[_0xb50a('0x33')](_0x25d80a[_0xb50a('0x37')],_0x25d80a[_0xb50a('0x39')]):0x0;};exports['isFailure']=function(_0x3d08c6){return _0x3d08c6==='Failure';};exports[_0xb50a('0x3a')]=function(_0x5b0429,_0x5c902d,_0x333cac,_0x537e62,_0x45a251){var _0x1cd660=_0x537e62?_0xb50a('0x3b'):_0x5b0429[_0xb50a('0x1a')];_0x1cd660=_0x45a251?'BOOKED':_0x1cd660;return{'actionid':_0x5b0429[_0xb50a('0x3c')],'action':'originate','channel':_0x5b0429[_0xb50a('0x3d')],'callerid':util[_0xb50a('0x12')](_0xb50a('0x13'),_0x1cd660,_0x5b0429['calleridnum']),'Exten':_0xb50a('0x24'),'Context':_0xb50a('0x3e'),'Priority':'1','variable':_0x333cac,'timeout':(_0x5c902d[_0xb50a('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b0429[_0xb50a('0x3c')]};};exports[_0xb50a('0x40')]=function(_0x4a1dca){return _0x4a1dca[_0xb50a('0x41')]+_0x4a1dca[_0xb50a('0x42')]+_0x4a1dca[_0xb50a('0x43')]+_0x4a1dca['countagentrejectretry']+_0x4a1dca['countnosuchnumberretry'];};exports[_0xb50a('0x44')]=function(_0x12d6b3){var _0x52d340=_[_0xb50a('0x45')](_0x12d6b3);_0x52d340[_0xb50a('0x2e')]=0xf;_0x52d340[_0xb50a('0x2f')]=_0xb50a('0x46');return _0x52d340;};exports[_0xb50a('0x47')]=function(_0x2280fe,_0x25ff25,_0x5b5417){var _0x4cec87={};_0x4cec87[_0x25ff25]=_0x2280fe[_0x25ff25];_0x4cec87[_0xb50a('0x48')]=![];_0x4cec87['scheduledat']=moment()[_0xb50a('0x49')](_0x5b5417,'minutes')[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4cec87['ContactId']=_0x2280fe['ContactId'];_0x4cec87[_0xb50a('0x4a')]=_0x2280fe[_0xb50a('0x4a')];_0x4cec87['VoiceQueueId']=_0x2280fe[_0xb50a('0x4b')]||undefined;return _0x4cec87;};exports[_0xb50a('0x4c')]=function(_0x4b7408,_0x20ff41){if(!_['isNil'](_0x4b7408)){if(_0x4b7408['pTalking']>0x0){_0x4b7408[_0xb50a('0x4d')]-=0x1;}else{logger['info'](_0x20ff41,_0xb50a('0x4e'));}}else{logger['error'](_0x20ff41,_0xb50a('0x4f'));}};exports[_0xb50a('0x50')]=function(_0x1a5282){if(_0x1a5282<=0x0){return!![];}return![];};function buildObj(_0x327fe8,_0xebdc3d,_0x6065b8){_0x327fe8[_0xb50a('0x51')]=_0xebdc3d;_0x327fe8[_0xb50a('0x19')]=_0x327fe8[_0xb50a('0x52')];_0x327fe8[_0xb50a('0x53')]=_0x327fe8['channelAgent'];_0x327fe8[_0xb50a('0x54')]=_0xb50a('0x55');if(_0x6065b8){_0x327fe8[_0xb50a('0x56')]=_0x6065b8[_0xb50a('0x56')];}return _0x327fe8;}exports['buildObj']=buildObj;exports[_0xb50a('0x57')]=function(_0xb94726){var _0x164a43=[];for(var _0x29e03e in _0xb94726){if(_0xb94726[_0xb50a('0x2a')](_0x29e03e)){if(!_[_0xb50a('0x16')](_0xb94726[_0x29e03e])&&_0xb94726[_0x29e03e]['state']==='not_inuse'&&_0xb94726[_0x29e03e][_0xb50a('0x58')]===_0xb50a('0x59')){_0x164a43[_0xb50a('0x5a')](_0xb94726[_0x29e03e]['id']);}}}return _0x164a43;};exports[_0xb50a('0x5b')]=function(_0x43ae63){var _0x139993=moment()[_0xb50a('0x5c')](0x0);var _0x161635=moment(_0x43ae63)[_0xb50a('0x5c')](0x0);return _0x139993[_0xb50a('0x5d')](_0x161635,'seconds');};exports[_0xb50a('0x5e')]=function(_0x380f7a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x380f7a[_0xb50a('0x1c')],'ListId':_0x380f7a[_0xb50a('0x4a')],'VoiceQueueId':_0x380f7a[_0xb50a('0x4b')]||undefined,'CampaignId':_0x380f7a[_0xb50a('0x5f')]||undefined};};exports[_0xb50a('0x60')]=function(_0x5a7606){if(_0x5a7606==='uniqueid'||_0x5a7606===_0xb50a('0x61')||_0x5a7606===_0xb50a('0x52')||_0x5a7606==='type'||_0x5a7606===_0xb50a('0x62')||_0x5a7606===_0xb50a('0x63')||_0x5a7606===_0xb50a('0x64')||_0x5a7606==='channelAgent'||_0x5a7606===_0xb50a('0x1a')||_0x5a7606===_0xb50a('0x48')||_0x5a7606===_0xb50a('0x1b')||_0x5a7606===_0xb50a('0x65')||_0x5a7606===_0xb50a('0x41')||_0x5a7606==='countcongestionretry'||_0x5a7606==='countnoanswerretry'||_0x5a7606===_0xb50a('0x66')||_0x5a7606===_0xb50a('0x67')||_0x5a7606===_0xb50a('0x68')||_0x5a7606===_0xb50a('0x69')||_0x5a7606===_0xb50a('0x6a')||_0x5a7606===_0xb50a('0x1c')||_0x5a7606===_0xb50a('0x4a')||_0x5a7606===_0xb50a('0x35')||_0x5a7606===_0xb50a('0x4b')||_0x5a7606==='sipcallid'||_0x5a7606===_0xb50a('0x6b')||_0x5a7606===_0xb50a('0x6c')||_0x5a7606===_0xb50a('0x6d')||_0x5a7606===_0xb50a('0x6e')||_0x5a7606===_0xb50a('0x6f')||_0x5a7606===_0xb50a('0x70')||_0x5a7606===_0xb50a('0x71')||_0x5a7606===_0xb50a('0x72')||_0x5a7606===_0xb50a('0x73')||_0x5a7606===_0xb50a('0x74')||_0x5a7606===_0xb50a('0x75')||_0x5a7606===_0xb50a('0x76')||_0x5a7606===_0xb50a('0x77')||_0x5a7606===_0xb50a('0x78')||_0x5a7606===_0xb50a('0x79')||_0x5a7606===_0xb50a('0x7a')||_0x5a7606===_0xb50a('0x7b')||_0x5a7606==='rtpaudioqosjitterbridged'||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606==='rtpaudioqosrtt'||_0x5a7606==='rtpaudioqosrttbridged'||_0x5a7606===_0xb50a('0x79')||_0x5a7606==='rtpaudioqosbridged'||_0x5a7606==='rtpaudioqosjitter'||_0x5a7606===_0xb50a('0x7e')||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606===_0xb50a('0x7f')||_0x5a7606===_0xb50a('0x80')||_0x5a7606===_0xb50a('0x81')||_0x5a7606===_0xb50a('0x82')||_0x5a7606===_0xb50a('0x2e')||_0x5a7606===_0xb50a('0x2f')){return![];}return!![];};exports[_0xb50a('0x83')]=function(_0xbb237e,_0x5639b6){var _0x428fa1,_0x1b5853,_0x24a743;if(_0x5639b6<=0x0){_0x5639b6=0x1;}_0x428fa1=new RegExp(_0xb50a('0x84')+_0x5639b6+'}$');_0x1b5853=Math['pow'](0xa,_0x5639b6-0x1);_0x24a743=Math[_0xb50a('0x85')](0xa,_0x5639b6)-0x1;return util[_0xb50a('0x12')]('%s',_[_0xb50a('0x86')](_0xbb237e,_0x428fa1,_[_0xb50a('0x87')](_0x1b5853,_0x24a743)));};exports['extractCalleridName']=function(_0x5da9b5){var _0x527485=_0x5da9b5[_0xb50a('0x88')](/"(.*?)"/);return _0x527485?_0x527485[0x1]:_0x5da9b5;};exports['extractCalleridNumber']=function(_0x4945e0){var _0x57525c=_0x4945e0['match'](/<(.*?)>/);return _0x57525c?_0x57525c[0x1]:_0x4945e0;};function buildNoAnswerEventPayload(_0x3b7e53,_0x44524e){var _0x97f1ad=buildObj(_0x3b7e53,_0xb50a('0x89'));if(!_['isEmpty'](_0x44524e[_0xb50a('0x8a')])){Object[_0xb50a('0x8b')](_0x44524e['variables'])[_0xb50a('0x8c')](function(_0x4be676){_0x97f1ad[_0x4be676['toLowerCase']()]=_0x44524e[_0xb50a('0x8a')][_0x4be676];});}return _0x97f1ad;}exports[_0xb50a('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x385e=['xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','../../dialer/utils','loggerCatch','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','logAgent','statedesc','ringtime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','getSeconds','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','clone','Global','scheduledAt','add','minutes','ContactId','ListId','pTalking','error','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','status','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','scheduledat','countglobal','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel'];(function(_0xca1c26,_0x2db0b5){var _0x5878c5=function(_0x268dd0){while(--_0x268dd0){_0xca1c26['push'](_0xca1c26['shift']());}};_0x5878c5(++_0x2db0b5);}(_0x385e,0xa2));var _0xe385=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x385e[_0x45aa72];return _0x75adaa;};'use strict';var util=require(_0xe385('0x0'));var _=require(_0xe385('0x1'));var moment=require(_0xe385('0x2'));var logger=require(_0xe385('0x3'))('preview');var ipAgi=process[_0xe385('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0xe385('0x5'));exports[_0xe385('0x6')]=function(_0x277697){return function(_0x3b8808){logger['error'](_0x277697,util[_0xe385('0x7')](_0x3b8808,{'showHidden':![],'depth':null}));};};exports[_0xe385('0x8')]=function(_0x4dd89d,_0x56deb6){logger['info'](_0x4dd89d,util[_0xe385('0x7')](_0x56deb6,{'showHidden':![],'depth':null}));};exports[_0xe385('0x9')]=function(_0x4a771c,_0x5cb3ab){logger['error'](_0x4a771c,util[_0xe385('0x7')](_0x5cb3ab,{'showHidden':![],'depth':null}));};exports[_0xe385('0xa')]=function(_0x15f6ce){return function(_0x2abb42){logger[_0xe385('0xb')](_0x15f6ce,util[_0xe385('0x7')](_0x2abb42,{'showHidden':![],'depth':null}));};};exports[_0xe385('0xc')]=function(_0x1181fc,_0x39f049,_0x5b9542){return{'message':_0x1181fc,'unlock':_0x39f049,'active':_0x5b9542};};exports[_0xe385('0xd')]=function(_0x42d43d,_0x2488eb,_0x565edf){if(!_[_0xe385('0xe')](_0x565edf)&&_0xe385('0xf')===typeof _0x565edf&&!_[_0xe385('0x10')](_0x565edf)){if(!_[_0xe385('0xe')](_0x2488eb)&&_0xe385('0xf')===typeof _0x2488eb&&!_[_0xe385('0x10')](_0x2488eb)){return util['format'](_0xe385('0x11'),_0x2488eb,_0x565edf);}return util[_0xe385('0x12')](_0xe385('0x11'),_0x565edf,_0x565edf);}if(!_[_0xe385('0xe')](_0x42d43d)&&_0xe385('0xf')===typeof _0x42d43d&&!_[_0xe385('0x10')](_0x42d43d)){return _0x42d43d;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x3a2833){if(_[_0xe385('0x13')](_0x3a2833)){return![];}return _0x3a2833;};exports[_0xe385('0x14')]=function(_0x137db6,_0x48a928,_0xc726d3,_0x581337,_0xf0df34,_0x14afa0){var _0x682499={'XMD-QUEUE':_0x48a928['Queue']?_0x48a928[_0xe385('0x15')][_0xe385('0x16')]:'','XMD-CALLERID':_0x581337,'XMD-CALLERID-PREVIEW':_0x14afa0?util[_0xe385('0x12')](_0xe385('0x11'),_0x14afa0[_0xe385('0x17')],_0x14afa0[_0xe385('0x18')]):_0x581337,'XMD-DIALID':_0xf0df34,'XMD-CONTACTID':_0x48a928['ContactId'],'XMD-CDRTYPE':_0xe385('0x19'),'CALLERID(all)':_0x581337,'XMD-VOICEQUEUEID':_0x48a928[_0xe385('0x1a')],'XMD-DIALCHANNEL':_0xc726d3,'XMD-DIALTIMEOUT':_0x137db6[_0xe385('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xe385('0x12')](_0xe385('0x1c'),_0x137db6['dialQueueProject2']?'g':'',_[_0xe385('0x10')](_0x137db6[_0xe385('0x1d')])?'':_0xe385('0x1e')),'XMD-DIALURL':_0x137db6[_0xe385('0x1f')]||'','XMD-AGI':_0x137db6[_0xe385('0x20')]?util['format'](_0xe385('0x21'),ipAgi,_0x137db6['dialQueueProject']):_0xe385('0x22'),'XMD-AGIAFTER':_0x137db6[_0xe385('0x23')]?util[_0xe385('0x12')](_0xe385('0x21'),ipAgi,_0x137db6[_0xe385('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x14afa0?_0x14afa0[_0xe385('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x14afa0?_0x14afa0[_0xe385('0x25')]:'','XMD-DESTINATION':_0xe385('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xe385('0x10')](_0x137db6[_0xe385('0x1d')])){_0x682499[util[_0xe385('0x12')]('%s',_0xe385('0x27'))]=_0x137db6[_0xe385('0x1d')];_0x682499[util['format']('%s',_0xe385('0x28'))]=_0xf0df34;}return _0x682499;};exports[_0xe385('0x29')]=function(_0x503d6b){var _0x2fc6f1={};for(var _0x43119b in _0x503d6b){if(_0x503d6b[_0xe385('0x2a')](_0x43119b)){_0x2fc6f1[util[_0xe385('0x12')]('%s',_[_0xe385('0x2b')](_0x43119b))]=_0x503d6b[_0x43119b];}}return{'variables':_0x2fc6f1};};exports[_0xe385('0x2c')]=function(_0x2c6866){var _0x675503=moment()[_0xe385('0x12')](_0xe385('0x2d'));_0x2c6866[_0xe385('0x2e')]=0xd;_0x2c6866['statedesc']='Blacklist';_0x2c6866[_0xe385('0x2f')]=_0x675503;_0x2c6866[_0xe385('0x30')]=_0x675503;_0x2c6866['endtime']=_0x675503;};exports[_0xe385('0x31')]=function(_0x35ced1,_0x38b7d0,_0x5e5076){var _0x19153d=moment()[_0xe385('0x12')](_0xe385('0x2d'));_0x35ced1[_0xe385('0x2e')]=_0x38b7d0;_0x35ced1[_0xe385('0x32')]=_0x5e5076;_0x35ced1[_0xe385('0x30')]=_0x19153d;_0x35ced1[_0xe385('0x33')]=utils['getSeconds'](_0x35ced1[_0xe385('0x30')],_0x35ced1[_0xe385('0x2f')]);};exports[_0xe385('0x34')]=function(_0x3ec5d4,_0x157593,_0x304002){_0x3ec5d4['membername']=_0x157593;_0x3ec5d4[_0xe385('0x35')]=_0x304002;};exports[_0xe385('0x36')]=function(_0x1e9ff8,_0x3b5c32,_0xcfb5fb){var _0x2adb30=moment()[_0xe385('0x12')](_0xe385('0x2d'));_0x1e9ff8[_0xe385('0x2e')]=_0x3b5c32;_0x1e9ff8[_0xe385('0x32')]=_0xcfb5fb;_0x1e9ff8[_0xe385('0x30')]=_0x1e9ff8[_0xe385('0x30')]?_0x1e9ff8[_0xe385('0x30')]:_0x2adb30;_0x1e9ff8[_0xe385('0x37')]=_0x1e9ff8['endtime']?_0x1e9ff8['endtime']:_0x2adb30;_0x1e9ff8[_0xe385('0x33')]=utils['getSeconds'](_0x1e9ff8[_0xe385('0x30')]||0x0,_0x1e9ff8[_0xe385('0x2f')]||0x0);_0x1e9ff8[_0xe385('0x38')]=_0x1e9ff8[_0xe385('0x39')]?utils[_0xe385('0x3a')](_0x1e9ff8[_0xe385('0x37')],_0x1e9ff8[_0xe385('0x39')]):0x0;};exports[_0xe385('0x3b')]=function(_0xf300){return _0xf300===_0xe385('0x3c');};exports['variablesAction']=function(_0x1e8e33,_0x3ab8f7,_0x402911,_0x55bdc4,_0x249da2){var _0x1043d8=_0x55bdc4?_0xe385('0x3d'):_0x1e8e33[_0xe385('0x17')];_0x1043d8=_0x249da2?_0xe385('0x3e'):_0x1043d8;return{'actionid':_0x1e8e33[_0xe385('0x3f')],'action':_0xe385('0x40'),'channel':_0x1e8e33['channelAgent'],'callerid':util[_0xe385('0x12')](_0xe385('0x11'),_0x1043d8,_0x1e8e33['calleridnum']),'Exten':_0xe385('0x26'),'Context':_0xe385('0x41'),'Priority':'1','variable':_0x402911,'timeout':(_0x3ab8f7['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1e8e33['uniqueid']};};exports[_0xe385('0x42')]=function(_0x4c2b37){return _0x4c2b37[_0xe385('0x43')]+_0x4c2b37[_0xe385('0x44')]+_0x4c2b37[_0xe385('0x45')]+_0x4c2b37['countagentrejectretry']+_0x4c2b37['countnosuchnumberretry'];};exports['cloneAction']=function(_0x1c729d){var _0x46d704=_[_0xe385('0x46')](_0x1c729d);_0x46d704['state']=0xf;_0x46d704['statedesc']=_0xe385('0x47');return _0x46d704;};exports[_0xe385('0x48')]=function(_0x5532a3,_0x125d01,_0x4f49a9){var _0x2f6b41={};_0x2f6b41[_0x125d01]=_0x5532a3[_0x125d01];_0x2f6b41['active']=![];_0x2f6b41['scheduledat']=moment()[_0xe385('0x49')](_0x4f49a9,_0xe385('0x4a'))[_0xe385('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f6b41['ContactId']=_0x5532a3[_0xe385('0x4b')];_0x2f6b41[_0xe385('0x4c')]=_0x5532a3[_0xe385('0x4c')];_0x2f6b41['VoiceQueueId']=_0x5532a3[_0xe385('0x1a')]||undefined;return _0x2f6b41;};exports['decrementTalking']=function(_0x36db97,_0x22b2c1){if(!_[_0xe385('0x13')](_0x36db97)){if(_0x36db97['pTalking']>0x0){_0x36db97[_0xe385('0x4d')]-=0x1;}else{logger[_0xe385('0xb')](_0x22b2c1,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe385('0x4e')](_0x22b2c1,_0xe385('0x4f'));}};exports['IsNotLoggedIn']=function(_0x52262b){if(_0x52262b<=0x0){return!![];}return![];};function buildObj(_0x53b753,_0x4347ed,_0x12aa02){_0x53b753[_0xe385('0x50')]=_0x4347ed;_0x53b753['name']=_0x53b753[_0xe385('0x51')];_0x53b753[_0xe385('0x52')]=_0x53b753['channelAgent'];_0x53b753[_0xe385('0x53')]=_0xe385('0x54');if(_0x12aa02){_0x53b753['mandatoryDisposition']=_0x12aa02[_0xe385('0x55')];}return _0x53b753;}exports['buildObj']=buildObj;exports[_0xe385('0x56')]=function(_0x3393be){var _0x4fa727=[];for(var _0x2ccbfc in _0x3393be){if(_0x3393be['hasOwnProperty'](_0x2ccbfc)){if(!_[_0xe385('0x13')](_0x3393be[_0x2ccbfc])&&_0x3393be[_0x2ccbfc][_0xe385('0x2e')]==='not_inuse'&&_0x3393be[_0x2ccbfc][_0xe385('0x57')]==='reachable'){_0x4fa727['push'](_0x3393be[_0x2ccbfc]['id']);}}}return _0x4fa727;};exports[_0xe385('0x58')]=function(_0x504418){var _0x4d8585=moment()['milliseconds'](0x0);var _0x196517=moment(_0x504418)[_0xe385('0x59')](0x0);return _0x4d8585[_0xe385('0x5a')](_0x196517,'seconds');};exports[_0xe385('0x5b')]=function(_0x36b78e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x36b78e[_0xe385('0x4b')],'ListId':_0x36b78e[_0xe385('0x4c')],'VoiceQueueId':_0x36b78e[_0xe385('0x1a')]||undefined,'CampaignId':_0x36b78e[_0xe385('0x5c')]||undefined};};exports[_0xe385('0x5d')]=function(_0x2f630f){if(_0x2f630f===_0xe385('0x3f')||_0x2f630f===_0xe385('0x5e')||_0x2f630f==='queue'||_0x2f630f===_0xe385('0x5f')||_0x2f630f===_0xe385('0x60')||_0x2f630f===_0xe385('0x61')||_0x2f630f===_0xe385('0x62')||_0x2f630f==='channelAgent'||_0x2f630f===_0xe385('0x17')||_0x2f630f===_0xe385('0x63')||_0x2f630f===_0xe385('0x18')||_0x2f630f===_0xe385('0x64')||_0x2f630f==='countbusyretry'||_0x2f630f===_0xe385('0x44')||_0x2f630f===_0xe385('0x45')||_0x2f630f===_0xe385('0x65')||_0x2f630f===_0xe385('0x66')||_0x2f630f==='callbackuniqueid'||_0x2f630f===_0xe385('0x67')||_0x2f630f==='recallme'||_0x2f630f===_0xe385('0x4b')||_0x2f630f==='ListId'||_0x2f630f===_0xe385('0x35')||_0x2f630f===_0xe385('0x1a')||_0x2f630f===_0xe385('0x68')||_0x2f630f===_0xe385('0x69')||_0x2f630f===_0xe385('0x6a')||_0x2f630f===_0xe385('0x6b')||_0x2f630f===_0xe385('0x6c')||_0x2f630f==='xmd-dialurl'||_0x2f630f===_0xe385('0x6d')||_0x2f630f==='xmd-dialoptions'||_0x2f630f===_0xe385('0x6e')||_0x2f630f===_0xe385('0x6f')||_0x2f630f===_0xe385('0x70')||_0x2f630f==='xmd-cdrtype'||_0x2f630f==='xmd-callerid'||_0x2f630f===_0xe385('0x71')||_0x2f630f===_0xe385('0x72')||_0x2f630f==='rtpaudioqos'||_0x2f630f===_0xe385('0x73')||_0x2f630f==='rtpaudioqosjitter'||_0x2f630f===_0xe385('0x74')||_0x2f630f===_0xe385('0x75')||_0x2f630f===_0xe385('0x76')||_0x2f630f===_0xe385('0x77')||_0x2f630f===_0xe385('0x78')||_0x2f630f===_0xe385('0x79')||_0x2f630f===_0xe385('0x73')||_0x2f630f===_0xe385('0x7a')||_0x2f630f==='rtpaudioqosjitterbridged'||_0x2f630f===_0xe385('0x75')||_0x2f630f==='rtpaudioqoslossbridged'||_0x2f630f===_0xe385('0x77')||_0x2f630f==='rtpaudioqosrttbridged'||_0x2f630f===_0xe385('0x7b')||_0x2f630f===_0xe385('0x7c')||_0x2f630f===_0xe385('0x2e')||_0x2f630f===_0xe385('0x32')){return![];}return!![];};exports[_0xe385('0x7d')]=function(_0x40fbac,_0x117a51){var _0x2bcb7c,_0x5e9929,_0x122965;if(_0x117a51<=0x0){_0x117a51=0x1;}_0x2bcb7c=new RegExp(_0xe385('0x7e')+_0x117a51+'}$');_0x5e9929=Math[_0xe385('0x7f')](0xa,_0x117a51-0x1);_0x122965=Math[_0xe385('0x7f')](0xa,_0x117a51)-0x1;return util[_0xe385('0x12')]('%s',_[_0xe385('0x80')](_0x40fbac,_0x2bcb7c,_['random'](_0x5e9929,_0x122965)));};exports[_0xe385('0x81')]=function(_0x3ead11){var _0x2e6a0d=_0x3ead11[_0xe385('0x82')](/"(.*?)"/);return _0x2e6a0d?_0x2e6a0d[0x1]:_0x3ead11;};exports['extractCalleridNumber']=function(_0x3679c1){var _0x1c4228=_0x3679c1['match'](/<(.*?)>/);return _0x1c4228?_0x1c4228[0x1]:_0x3679c1;};function buildNoAnswerEventPayload(_0x1dd663,_0xf7e34d){var _0x34164f=buildObj(_0x1dd663,_0xe385('0x83'));if(!_[_0xe385('0x10')](_0xf7e34d[_0xe385('0x84')])){Object[_0xe385('0x85')](_0xf7e34d[_0xe385('0x84')])[_0xe385('0x86')](function(_0x5b859e){_0x34164f[_0x5b859e[_0xe385('0x87')]()]=_0xf7e34d[_0xe385('0x84')][_0x5b859e];});}return _0x34164f;}exports[_0xe385('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6f11255..bf04ae4 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 _0xfe4a=['number','queuepause','boolean','voicequeuechannel','voicequeuechannelredirect','string'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfe4a,0x119));var _0xafe4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xfe4a[_0x297fd3];return _0x2af381;};'use strict';exports['queueadd']={'queue':{'type':_0xafe4('0x0'),'required':!![]},'interface':{'type':_0xafe4('0x0'),'required':!![]},'membername':{'type':_0xafe4('0x0'),'required':!![]},'penalty':{'type':_0xafe4('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xafe4('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xafe4('0x2')]={'interface':{'type':_0xafe4('0x0'),'required':!![]},'paused':{'type':_0xafe4('0x3')},'reason':{'type':_0xafe4('0x0'),'required':![]}};exports['reload']={'module':{'type':_0xafe4('0x0'),'required':![]}};exports[_0xafe4('0x4')]={'uniqueid':{'type':_0xafe4('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xafe4('0x0'),'required':!![]},'filename':{'type':_0xafe4('0x0')},'format':{'type':_0xafe4('0x0')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xafe4('0x0'),'required':!![]}};exports[_0xafe4('0x5')]={'uniqueid':{'type':_0xafe4('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xafe4('0x0')}}; \ No newline at end of file +var _0x244c=['number','boolean','queuepause','reload','voicequeuechannel','voicechannel','string'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x244c,0x1f0));var _0xc244=function(_0xb8d602,_0x537237){_0xb8d602=_0xb8d602-0x0;var _0x22101e=_0x244c[_0xb8d602];return _0x22101e;};'use strict';exports['queueadd']={'queue':{'type':_0xc244('0x0'),'required':!![]},'interface':{'type':_0xc244('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xc244('0x1'),'required':![]},'paused':{'type':_0xc244('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xc244('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xc244('0x3')]={'interface':{'type':_0xc244('0x0'),'required':!![]},'paused':{'type':_0xc244('0x2')},'reason':{'type':_0xc244('0x0'),'required':![]}};exports[_0xc244('0x4')]={'module':{'type':'string','required':![]}};exports[_0xc244('0x5')]={'uniqueid':{'type':_0xc244('0x0'),'required':!![]}};exports[_0xc244('0x6')]={'uniqueid':{'type':_0xc244('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xc244('0x0')},'mixmonitorid':{'type':_0xc244('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xc244('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xc244('0x0'),'required':!![]},'exten':{'type':_0xc244('0x0'),'required':!![]},'context':{'type':_0xc244('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a414339..5c1ef86 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x3bf63e,_0x291ed0){var _0x3c0fba=function(_0x207f41){while(--_0x207f41){_0x3bf63e['push'](_0x3bf63e['shift']());}};_0x3c0fba(++_0x291ed0);}(_0xb10b,0x12a));var _0xbb10=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0xb10b[_0x4befae];return _0x76c573;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x4b92f4,_0x32a49a){var _0x4b2ca2=function(_0x5df795){while(--_0x5df795){_0x4b92f4['push'](_0x4b92f4['shift']());}};_0x4b2ca2(++_0x32a49a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x289921,_0xb32038){_0x289921=_0x289921-0x0;var _0x4ac780=_0x5f2f[_0x289921];return _0x4ac780;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a54211d..d35ea04 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7098=['assign','mergeDBDataToRealtime'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x7098,0x148));var _0x8709=function(_0x8d93c7,_0x3c840f){_0x8d93c7=_0x8d93c7-0x0;var _0x516b32=_0x7098[_0x8d93c7];return _0x516b32;};'use strict';function mergeDBDataToRealtime(_0x49e1e3,_0x12569d){var _0x256ce9=Object[_0x8709('0x0')]({},_0x49e1e3);for(var _0x538272 in _0x12569d){if(_0x256ce9['hasOwnProperty'](_0x538272)){_0x256ce9[_0x538272]=_0x12569d[_0x538272];}}return _0x256ce9;}exports[_0x8709('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x1cf4=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x17266e,_0x5d273d){var _0x8eeaf4=function(_0xda6721){while(--_0xda6721){_0x17266e['push'](_0x17266e['shift']());}};_0x8eeaf4(++_0x5d273d);}(_0x1cf4,0x9b));var _0x41cf=function(_0x3cf5c5,_0x278235){_0x3cf5c5=_0x3cf5c5-0x0;var _0x132952=_0x1cf4[_0x3cf5c5];return _0x132952;};'use strict';function mergeDBDataToRealtime(_0x5daa19,_0x1ab23d){var _0x30a05f=Object[_0x41cf('0x0')]({},_0x5daa19);for(var _0x423dcd in _0x1ab23d){if(_0x30a05f[_0x41cf('0x1')](_0x423dcd)){_0x30a05f[_0x423dcd]=_0x1ab23d[_0x423dcd];}}return _0x30a05f;}exports[_0x41cf('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 56a5f98..920dcc2 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 _0xb9f2=['keys','getCallType','channel','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','originatecalleridnum','destinationchannel','calleridpreview','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','voiceQueueReport','create','getAgentByInternal'];(function(_0x181577,_0x140ed2){var _0x2d1eab=function(_0x4b5ea2){while(--_0x4b5ea2){_0x181577['push'](_0x181577['shift']());}};_0x2d1eab(++_0x140ed2);}(_0xb9f2,0xde));var _0x2b9f=function(_0x334ee2,_0xca246d){_0x334ee2=_0x334ee2-0x0;var _0x3d565d=_0xb9f2[_0x334ee2];return _0x3d565d;};'use strict';var _=require(_0x2b9f('0x0'));var moment=require('moment');var util=require(_0x2b9f('0x1'));var config=require(_0x2b9f('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2b9f('0x3'));var RpcVoiceCallReport=require(_0x2b9f('0x4'));var RpcVoiceDialReport=require(_0x2b9f('0x5'));var RpcMemberReport=require(_0x2b9f('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2b9f('0x7'));var RpcVoiceTransferReport=require(_0x2b9f('0x8'));var VoiceQueueReport=require(_0x2b9f('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2b9f('0xa'));var VoiceDialReport=require(_0x2b9f('0xb'));var UserReport=require('./userReport');function Report(_0x20352a){this[_0x2b9f('0xc')]=_0x20352a;this[_0x2b9f('0xd')]=_0x20352a['agents'];this[_0x2b9f('0xe')]=_0x20352a[_0x2b9f('0xe')];}Report[_0x2b9f('0xf')][_0x2b9f('0x10')]=function(_0x3f30c9){var _0x1cdd81=new VoiceQueueReport(this[_0x2b9f('0xc')]);var _0x4bedc2=new VoiceAgentReport(this[_0x2b9f('0xc')]);var _0x587978=new VoiceDialReport(this['realtime']);var _0x463b9=new VoiceCallReport(this[_0x2b9f('0xc')]);var _0x2762b2=new UserReport(this[_0x2b9f('0xc')]);if(config[_0x2b9f('0x11')]&&config[_0x2b9f('0x11')][_0x2b9f('0x12')]){ami['on'](_0x2b9f('0x13'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x2b9f('0x14')][_0x2b9f('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x2b9f('0x16')][_0x2b9f('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x2b9f('0x17')][_0x2b9f('0x15')](this));ami['on'](_0x2b9f('0x18'),this[_0x2b9f('0x19')][_0x2b9f('0x15')](this));ami['on'](_0x2b9f('0x1a'),this['attendedTransfer'][_0x2b9f('0x15')](this));}};Report['prototype'][_0x2b9f('0x1b')]=function(_0x140ba5){var _0x4540bb;_0x4540bb=_[_0x2b9f('0x1c')](this[_0x2b9f('0xd')],function(_0x48db7d){return _0x48db7d[_0x2b9f('0x1d')]==_0x140ba5||_0x48db7d[_0x2b9f('0x1e')]==_0x140ba5;});if(_[_0x2b9f('0x1f')](_0x4540bb)){var _0x12cb49=_['find'](this[_0x2b9f('0xe')],function(_0x5eecb9){return _0x5eecb9[_0x2b9f('0x1d')]==_0x140ba5||_0x5eecb9[_0x2b9f('0x1e')]==_0x140ba5;});if(_0x12cb49){_0x4540bb=_['find'](this[_0x2b9f('0xd')],function(_0x793baf){return _0x793baf['interface']==util[_0x2b9f('0x20')](_0x2b9f('0x21'),_0x12cb49[_0x2b9f('0x1e')]);});}}return _0x4540bb;};Report['prototype']['voiceQueueReport']=function(_0x568af0){for(var _0x244524=0x0;_0x244524<_0x568af0[_0x2b9f('0x22')];_0x244524+=0x1){var _0x3c3f3b=this['findAgent'](_0x568af0[_0x244524][_0x2b9f('0x23')]);if(_0x3c3f3b){_0x568af0[_0x244524][_0x2b9f('0x1d')]=_0x3c3f3b[_0x2b9f('0x1d')];_0x568af0[_0x244524][_0x2b9f('0x24')]=!![];_0x568af0[_0x244524][_0x2b9f('0x25')]=_0x3c3f3b[_0x2b9f('0x1e')];_0x568af0[_0x244524]['interface']=_[_0x2b9f('0x1f')](_0x3c3f3b[_0x2b9f('0x26')])?util['format'](_0x2b9f('0x21'),_0x3c3f3b[_0x2b9f('0x1e')]):_0x3c3f3b[_0x2b9f('0x26')];if(_0x568af0[_0x244524][_0x2b9f('0x27')]){_0x568af0[_0x244524][_0x2b9f('0x28')]=moment()[_0x2b9f('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x568af0[_0x244524][_0x2b9f('0x29')]){_0x568af0[_0x244524]['queuecallerexitAt']=moment()[_0x2b9f('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x2b9f('0x2a')](_0x568af0[_0x244524]);}RpcVoiceQueueReport[_0x2b9f('0x2b')](_0x568af0[_0x244524]);}};function extractCalleridNumber(_0x40568d){var _0xfff5d7=_0x40568d['match'](/<(.*?)>/);return _0xfff5d7?_0xfff5d7[0x1]:_0x40568d;}Report['prototype'][_0x2b9f('0x2c')]=function(_0xa1c409){for(var _0x350a98=0x0;_0x350a98',_0x380be4[_0x2b9f('0x40')],_0x380be4[_0x2b9f('0x31')]);}if(RpcVoiceTransferReport[_0x2b9f('0x41')][_0x380be4['linkedid']]){var _0x8a7a44=RpcVoiceTransferReport['transfers'][_0x380be4[_0x2b9f('0x42')]];_0x8a7a44['transfereelinkedid']=_0x380be4[_0x2b9f('0x43')];RpcVoiceTransferReport[_0x2b9f('0x19')](_0x8a7a44);delete RpcVoiceTransferReport[_0x2b9f('0x41')][_0x380be4[_0x2b9f('0x42')]];}if(_['isNil'](_0x380be4['type'])){_0x380be4[_0x2b9f('0x35')]=this[_0x2b9f('0x2e')](_0x380be4);}if(_['isNil'](_0x380be4[_0x2b9f('0x44')])){var _0x256951=_0x380be4[_0x2b9f('0x2f')][_0x2b9f('0x30')]('-')[0x0];var _0x45b50e=this[_0x2b9f('0xd')][_0x256951];if(!_0x45b50e)_0x45b50e=this[_0x2b9f('0x2c')](_0x380be4['accountcode']);if(_0x45b50e){_0x380be4[_0x2b9f('0x44')]=_0x45b50e['id'];_0x380be4[_0x2b9f('0x45')]=_0x45b50e['name'];}}RpcVoiceCallReport[_0x2b9f('0x2b')](_0x380be4);if(_0x380be4[_0x2b9f('0x46')]){for(var _0x1a1eda=0x0;_0x1a1eda<_0x380be4['monitors'][_0x2b9f('0x22')];_0x1a1eda+=0x1){_0x380be4[_0x2b9f('0x47')]=_0x380be4[_0x2b9f('0x48')][_0x1a1eda][_0x2b9f('0x49')];_0x380be4[_0x2b9f('0x4a')]=_0x380be4[_0x2b9f('0x48')][_0x1a1eda][_0x2b9f('0x4a')];if(_0x380be4[_0x2b9f('0x34')]==_0x2b9f('0x4b')){_0x380be4[_0x2b9f('0x31')]=_0x380be4[_0x2b9f('0x23')];_0x380be4[_0x2b9f('0x40')]=_0x380be4['connectedlinename'];_0x380be4[_0x2b9f('0x23')]=_0x380be4[_0x2b9f('0x1d')];_0x380be4[_0x2b9f('0x4c')]=_0x380be4[_0x2b9f('0x45')];_0x380be4[_0x2b9f('0x34')]=_0x380be4[_0x2b9f('0x3d')];}else if(_0x380be4[_0x2b9f('0x34')]==_0x2b9f('0x4d')){_0x380be4[_0x2b9f('0x31')]=_0x380be4[_0x2b9f('0x33')];_0x380be4[_0x2b9f('0x34')]=_0x380be4['originatecalleridnum'];}RpcVoiceRecording[_0x2b9f('0x2b')](_0x380be4);}}};Report['prototype']['voiceAgentReport']=function(_0x5669ff){if(_[_0x2b9f('0x4e')](_0x5669ff)){_0x5669ff[_0x2b9f('0x4f')](function(_0x236ffb){RpcVoiceAgentReport[_0x2b9f('0x2b')](_0x236ffb);});}else{RpcVoiceAgentReport[_0x2b9f('0x2b')](_0x5669ff);}};Report[_0x2b9f('0xf')][_0x2b9f('0x17')]=function(_0x139b57){RpcVoiceDialReport['create'](_0x139b57);var _0x3728d4;var _0x18069c;var _0x1626d2=_0x139b57[_0x2b9f('0x2f')];if(_[_0x2b9f('0x50')](_0x1626d2,_0x2b9f('0x51'))){_0x18069c=_0x1626d2[_0x2b9f('0x52')](_0x1626d2[_0x2b9f('0x53')]('/')+0x1,_0x1626d2[_0x2b9f('0x53')]('@'));_0x3728d4=_[_0x2b9f('0x1c')](this[_0x2b9f('0xd')],function(_0x334aa7){return _0x334aa7[_0x2b9f('0x54')]==_0x18069c||_0x334aa7[_0x2b9f('0x55')]==_0x18069c||_0x334aa7[_0x2b9f('0x1d')]==_0x18069c;});}else{_0x18069c=_0x1626d2[_0x2b9f('0x52')](_0x1626d2[_0x2b9f('0x53')]('/')+0x1,_0x1626d2[_0x2b9f('0x56')]('-'));_0x3728d4=this['findAgent'](_0x18069c);}if(_0x3728d4){_0x139b57['interface']=_[_0x2b9f('0x1f')](_0x3728d4['interface'])?util['format'](_0x2b9f('0x21'),_0x3728d4[_0x2b9f('0x1e')]):_0x3728d4['interface'];_0x139b57[_0x2b9f('0x45')]=_0x3728d4['name'];_0x139b57[_0x2b9f('0x1d')]=_0x3728d4[_0x2b9f('0x1d')];RpcMemberReport[_0x2b9f('0x17')](_0x139b57);}};Report[_0x2b9f('0xf')]['blindTransfer']=function(_0x209293){RpcVoiceTransferReport[_0x2b9f('0x41')][_0x209293['transfererlinkedid']]=_0x209293;};Report[_0x2b9f('0xf')][_0x2b9f('0x57')]=function(_0x485971){RpcVoiceTransferReport['attendedTransfer'](_0x485971);};module[_0x2b9f('0x58')]=Report; \ No newline at end of file +var _0x2a2b=['realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','name','interface','format','length','connectedlinenum','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','internal','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','destinationchannel','calleridnum','originatecalleridnum','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','exten','isArray','startsWith','Local','substring','indexOf','mobile','lastIndexOf','SIP/%s','transfererlinkedid','attendedTransfer','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport'];(function(_0x204b4a,_0x138226){var _0x15d4b1=function(_0xbfb3f2){while(--_0xbfb3f2){_0x204b4a['push'](_0x204b4a['shift']());}};_0x15d4b1(++_0x138226);}(_0x2a2b,0x147));var _0xb2a2=function(_0x2ea74f,_0x358a70){_0x2ea74f=_0x2ea74f-0x0;var _0x448bdc=_0x2a2b[_0x2ea74f];return _0x448bdc;};'use strict';var _=require(_0xb2a2('0x0'));var moment=require(_0xb2a2('0x1'));var util=require(_0xb2a2('0x2'));var config=require('../../../config/environment');var ami=require(_0xb2a2('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xb2a2('0x4'));var RpcVoiceDialReport=require(_0xb2a2('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xb2a2('0x6'));var RpcVoiceRecording=require(_0xb2a2('0x7'));var RpcVoiceTransferReport=require(_0xb2a2('0x8'));var VoiceQueueReport=require(_0xb2a2('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xb2a2('0xa'));var VoiceDialReport=require(_0xb2a2('0xb'));var UserReport=require(_0xb2a2('0xc'));function Report(_0x5a2230){this[_0xb2a2('0xd')]=_0x5a2230;this[_0xb2a2('0xe')]=_0x5a2230[_0xb2a2('0xe')];this[_0xb2a2('0xf')]=_0x5a2230[_0xb2a2('0xf')];}Report[_0xb2a2('0x10')]['sync']=function(_0xab6d35){var _0x537b6a=new VoiceQueueReport(this['realtime']);var _0x17072a=new VoiceAgentReport(this[_0xb2a2('0xd')]);var _0x912935=new VoiceDialReport(this[_0xb2a2('0xd')]);var _0x5a2c64=new VoiceCallReport(this[_0xb2a2('0xd')]);var _0x2b4472=new UserReport(this[_0xb2a2('0xd')]);if(config['xdr']&&config[_0xb2a2('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xb2a2('0x12')][_0xb2a2('0x13')](this));ami['on']('custom:voiceCallReport',this[_0xb2a2('0x14')]['bind'](this));ami['on'](_0xb2a2('0x15'),this[_0xb2a2('0x16')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0xb2a2('0x17')]['bind'](this));ami['on'](_0xb2a2('0x18'),this[_0xb2a2('0x19')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xb2a2('0x13')](this));}};Report[_0xb2a2('0x10')][_0xb2a2('0x1a')]=function(_0x2e8d9f){var _0x120654;_0x120654=_[_0xb2a2('0x1b')](this[_0xb2a2('0xe')],function(_0xf1616a){return _0xf1616a[_0xb2a2('0x1c')]==_0x2e8d9f||_0xf1616a[_0xb2a2('0x1d')]==_0x2e8d9f;});if(_['isNil'](_0x120654)){var _0x14df3f=_['find'](this[_0xb2a2('0xf')],function(_0xf57917){return _0xf57917[_0xb2a2('0x1c')]==_0x2e8d9f||_0xf57917['name']==_0x2e8d9f;});if(_0x14df3f){_0x120654=_[_0xb2a2('0x1b')](this[_0xb2a2('0xe')],function(_0x3f027a){return _0x3f027a[_0xb2a2('0x1e')]==util[_0xb2a2('0x1f')]('SIP/%s',_0x14df3f[_0xb2a2('0x1d')]);});}}return _0x120654;};Report[_0xb2a2('0x10')][_0xb2a2('0x12')]=function(_0x5a6ef6){for(var _0x45fb23=0x0;_0x45fb23<_0x5a6ef6[_0xb2a2('0x20')];_0x45fb23+=0x1){var _0x42629d=this[_0xb2a2('0x1a')](_0x5a6ef6[_0x45fb23][_0xb2a2('0x21')]);if(_0x42629d){_0x5a6ef6[_0x45fb23]['accountcode']=_0x42629d[_0xb2a2('0x1c')];_0x5a6ef6[_0x45fb23]['assigned']=!![];_0x5a6ef6[_0x45fb23][_0xb2a2('0x22')]=_0x42629d[_0xb2a2('0x1d')];_0x5a6ef6[_0x45fb23][_0xb2a2('0x1e')]=_[_0xb2a2('0x23')](_0x42629d[_0xb2a2('0x1e')])?util[_0xb2a2('0x1f')]('SIP/%s',_0x42629d[_0xb2a2('0x1d')]):_0x42629d[_0xb2a2('0x1e')];if(_0x5a6ef6[_0x45fb23]['queuecallercomplete']){_0x5a6ef6[_0x45fb23][_0xb2a2('0x24')]=moment()['format'](_0xb2a2('0x25'));}if(_0x5a6ef6[_0x45fb23][_0xb2a2('0x26')]){_0x5a6ef6[_0x45fb23][_0xb2a2('0x27')]=moment()['format'](_0xb2a2('0x25'));}RpcMemberReport[_0xb2a2('0x12')](_0x5a6ef6[_0x45fb23]);}RpcVoiceQueueReport[_0xb2a2('0x28')](_0x5a6ef6[_0x45fb23]);}};function extractCalleridNumber(_0x5e2598){var _0x69b05e=_0x5e2598[_0xb2a2('0x29')](/<(.*?)>/);return _0x69b05e?_0x69b05e[0x1]:_0x5e2598;}Report[_0xb2a2('0x10')][_0xb2a2('0x2a')]=function(_0x85a028){for(var _0xce883f=0x0;_0xce883f',_0x225d7f[_0xb2a2('0x3c')],_0x225d7f['calleridnum']);}if(RpcVoiceTransferReport[_0xb2a2('0x3d')][_0x225d7f[_0xb2a2('0x3e')]]){var _0x14b6ce=RpcVoiceTransferReport[_0xb2a2('0x3d')][_0x225d7f[_0xb2a2('0x3e')]];_0x14b6ce[_0xb2a2('0x3f')]=_0x225d7f[_0xb2a2('0x40')];RpcVoiceTransferReport[_0xb2a2('0x19')](_0x14b6ce);delete RpcVoiceTransferReport['transfers'][_0x225d7f[_0xb2a2('0x3e')]];}if(_[_0xb2a2('0x23')](_0x225d7f[_0xb2a2('0x30')])){_0x225d7f[_0xb2a2('0x30')]=this[_0xb2a2('0x41')](_0x225d7f);}if(_[_0xb2a2('0x23')](_0x225d7f[_0xb2a2('0x42')])){var _0x12c12d=_0x225d7f[_0xb2a2('0x2c')][_0xb2a2('0x2d')]('-')[0x0];var _0x469ed4=this['agents'][_0x12c12d];if(!_0x469ed4)_0x469ed4=this['getAgentByInternal'](_0x225d7f['accountcode']);if(_0x469ed4){_0x225d7f[_0xb2a2('0x42')]=_0x469ed4['id'];_0x225d7f[_0xb2a2('0x43')]=_0x469ed4[_0xb2a2('0x1d')];}}RpcVoiceCallReport['create'](_0x225d7f);if(_0x225d7f[_0xb2a2('0x44')]){for(var _0x187fb7=0x0;_0x187fb7<_0x225d7f[_0xb2a2('0x45')][_0xb2a2('0x20')];_0x187fb7+=0x1){_0x225d7f[_0xb2a2('0x46')]=_0x225d7f[_0xb2a2('0x45')][_0x187fb7][_0xb2a2('0x47')];_0x225d7f[_0xb2a2('0x48')]=_0x225d7f['monitors'][_0x187fb7]['createdAt'];if(_0x225d7f['exten']=='xcally-motion-preview'){_0x225d7f[_0xb2a2('0x39')]=_0x225d7f[_0xb2a2('0x21')];_0x225d7f[_0xb2a2('0x3c')]=_0x225d7f[_0xb2a2('0x49')];_0x225d7f[_0xb2a2('0x21')]=_0x225d7f[_0xb2a2('0x1c')];_0x225d7f[_0xb2a2('0x49')]=_0x225d7f[_0xb2a2('0x43')];_0x225d7f[_0xb2a2('0x4a')]=_0x225d7f[_0xb2a2('0x3a')];}else if(_0x225d7f[_0xb2a2('0x4a')]=='xcally-motion-dialer'){_0x225d7f['calleridnum']=_0x225d7f[_0xb2a2('0x2f')];_0x225d7f[_0xb2a2('0x4a')]=_0x225d7f[_0xb2a2('0x3a')];}RpcVoiceRecording[_0xb2a2('0x28')](_0x225d7f);}}};Report['prototype'][_0xb2a2('0x16')]=function(_0x3f1b1b){if(_[_0xb2a2('0x4b')](_0x3f1b1b)){_0x3f1b1b['forEach'](function(_0x472ed6){RpcVoiceAgentReport[_0xb2a2('0x28')](_0x472ed6);});}else{RpcVoiceAgentReport[_0xb2a2('0x28')](_0x3f1b1b);}};Report[_0xb2a2('0x10')][_0xb2a2('0x17')]=function(_0x33bc27){RpcVoiceDialReport['create'](_0x33bc27);var _0x96d635;var _0x1ccdbb;var _0x2d5e70=_0x33bc27['channel'];if(_[_0xb2a2('0x4c')](_0x2d5e70,_0xb2a2('0x4d'))){_0x1ccdbb=_0x2d5e70[_0xb2a2('0x4e')](_0x2d5e70[_0xb2a2('0x4f')]('/')+0x1,_0x2d5e70[_0xb2a2('0x4f')]('@'));_0x96d635=_[_0xb2a2('0x1b')](this['agents'],function(_0x3fdc8d){return _0x3fdc8d[_0xb2a2('0x50')]==_0x1ccdbb||_0x3fdc8d['phone']==_0x1ccdbb||_0x3fdc8d[_0xb2a2('0x1c')]==_0x1ccdbb;});}else{_0x1ccdbb=_0x2d5e70[_0xb2a2('0x4e')](_0x2d5e70[_0xb2a2('0x4f')]('/')+0x1,_0x2d5e70[_0xb2a2('0x51')]('-'));_0x96d635=this['findAgent'](_0x1ccdbb);}if(_0x96d635){_0x33bc27[_0xb2a2('0x1e')]=_[_0xb2a2('0x23')](_0x96d635[_0xb2a2('0x1e')])?util[_0xb2a2('0x1f')](_0xb2a2('0x52'),_0x96d635[_0xb2a2('0x1d')]):_0x96d635[_0xb2a2('0x1e')];_0x33bc27[_0xb2a2('0x43')]=_0x96d635[_0xb2a2('0x1d')];_0x33bc27[_0xb2a2('0x1c')]=_0x96d635[_0xb2a2('0x1c')];RpcMemberReport[_0xb2a2('0x17')](_0x33bc27);}};Report['prototype']['blindTransfer']=function(_0x381cd2){RpcVoiceTransferReport[_0xb2a2('0x3d')][_0x381cd2[_0xb2a2('0x53')]]=_0x381cd2;};Report[_0xb2a2('0x10')]['attendedTransfer']=function(_0x5b355f){RpcVoiceTransferReport[_0xb2a2('0x54')](_0x5b355f);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 6e7f962..6857c64 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x279f=['actionDeviceStateList','error','[userReport][devicestatelist]','resolve','[userReport][sippeerstatus]','prototype','emit','info','username','state','[userReport][registry]','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','inuse','local','toNumber','toLowerCase','updateStatusRealtime','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','indexOf','find','mobile','phone','accountcode','[userReport][devicestatechange]','syncPeerStatus','isNotNull','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncRealtimeShow','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect'];(function(_0x5b350a,_0xcb5c77){var _0x553d7e=function(_0x361c89){while(--_0x361c89){_0x5b350a['push'](_0x5b350a['shift']());}};_0x553d7e(++_0xcb5c77);}(_0x279f,0x164));var _0xf279=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x279f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf279('0x0'));var moment=require(_0xf279('0x1'));var util=require(_0xf279('0x2'));var Redis=require(_0xf279('0x3'));var BPromise=require('bluebird');var config=require(_0xf279('0x4'));var logger=require(_0xf279('0x5'))(_0xf279('0x6'));var ami=require(_0xf279('0x7'));config[_0xf279('0x8')]=_[_0xf279('0x9')](config[_0xf279('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf279('0x8')]));function UserReport(_0x296a4d){this['trunks']=_0x296a4d[_0xf279('0xa')];this[_0xf279('0xb')]=_0x296a4d[_0xf279('0xb')];this[_0xf279('0xc')]=_0x296a4d[_0xf279('0xc')];ami['on'](_0xf279('0xd'),this[_0xf279('0xe')]['bind'](this));ami['on']('registry',this[_0xf279('0xe')][_0xf279('0xf')](this));ami['on'](_0xf279('0x10'),this[_0xf279('0x11')][_0xf279('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus']['bind'](this));return this[_0xf279('0x12')]();}function showSipRegistrations(){Promise['resolve']()[_0xf279('0x13')](ami[_0xf279('0x14')]())[_0xf279('0x15')](function(_0x3275d6){logger['error'](_0xf279('0x16'),util[_0xf279('0x17')](_0x3275d6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xf279('0x13')](ami[_0xf279('0x18')]())[_0xf279('0x15')](function(_0x29c68b){logger[_0xf279('0x19')](_0xf279('0x1a'),util[_0xf279('0x17')](_0x29c68b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xf279('0x1b')]()[_0xf279('0x13')](ami['actionSipPeerStatus']())['catch'](function(_0x405dae){logger[_0xf279('0x19')](_0xf279('0x1c'),util[_0xf279('0x17')](_0x405dae,{'showHidden':![],'depth':null}));});}UserReport[_0xf279('0x1d')][_0xf279('0x12')]=function(){setInterval(function(){BPromise[_0xf279('0x1b')]()[_0xf279('0x13')](showSipRegistrations())[_0xf279('0x13')](listDeviceStates())[_0xf279('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xf279('0x1d')]['isNotNull']=function(_0x30df8b){return _0x30df8b!==null&&!_['isUndefined'](_0x30df8b);};UserReport[_0xf279('0x1d')][_0xf279('0x1e')]=function(_0x332e0e,_0x61b1ff,_0x5176ff){io['to'](_0x332e0e)['emit'](_0x61b1ff,_0x5176ff);};UserReport[_0xf279('0x1d')][_0xf279('0xe')]=function(_0x37c692){try{if(this['isNotNull'](_0x37c692)){logger[_0xf279('0x1f')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x37c692[_0xf279('0x20')],_0x37c692[_0xf279('0x21')]);logger['debug'](_0xf279('0x22'),util[_0xf279('0x17')](_0x37c692,{'showHidden':![],'depth':null}));var _0x263b7f=_['find'](this[_0xf279('0xa')],{'defaultuser':_0x37c692[_0xf279('0x20')]});if(_0x263b7f){_0x37c692[_0xf279('0x23')]=_0x37c692[_0xf279('0x21')];_[_0xf279('0x24')](_0x263b7f,_[_0xf279('0x25')](_0x37c692,[_0xf279('0x26'),_0xf279('0x27'),_0xf279('0x20'),'state']));logger[_0xf279('0x28')](_0xf279('0x29'),util[_0xf279('0x17')](_0x263b7f,{'showHidden':![],'depth':null}));this[_0xf279('0x1e')](util[_0xf279('0x2a')](_0xf279('0x2b'),_0x263b7f[_0xf279('0x2c')]),'trunk:save',_0x263b7f);}}}catch(_0x4f3a63){logger[_0xf279('0x19')](_0xf279('0x22'),util[_0xf279('0x17')](_0x4f3a63,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf279('0x11')]=function(_0x546180){try{if(this['isNotNull'](_0x546180)){logger['info'](_0xf279('0x2d'),_0x546180[_0xf279('0x2e')],_0x546180['state']);logger[_0xf279('0x28')]('[userReport][devicestatechange]',util['inspect'](_0x546180,{'showHidden':![],'depth':null}));if(this[_0xf279('0xb')][_0x546180[_0xf279('0x2e')]]){if(!this['agents'][_0x546180['device']]['local']||_0x546180[_0xf279('0x21')]['toLowerCase']()==_0xf279('0x2f')){this[_0xf279('0xb')][_0x546180[_0xf279('0x2e')]][_0xf279('0x30')]=![];if(this[_0xf279('0xb')][_0x546180['device']][_0xf279('0x21')]!==_0x546180[_0xf279('0x21')]['toLowerCase']()){this['agents'][_0x546180[_0xf279('0x2e')]]['stateTime']=_[_0xf279('0x31')](moment()[_0xf279('0x2a')]('x'));}this[_0xf279('0xb')][_0x546180[_0xf279('0x2e')]][_0xf279('0x21')]=_0x546180[_0xf279('0x21')][_0xf279('0x32')]();this[_0xf279('0xb')][_0x546180[_0xf279('0x2e')]][_0xf279('0x33')](_0x546180);}}else if(this[_0xf279('0xc')][_0x546180['device']]){if(this['telephones'][_0x546180[_0xf279('0x2e')]][_0xf279('0x21')]!==_0x546180['state']['toLowerCase']()){this[_0xf279('0xc')][_0x546180[_0xf279('0x2e')]][_0xf279('0x34')]=_[_0xf279('0x31')](moment()[_0xf279('0x2a')]('x'));}this[_0xf279('0xc')][_0x546180[_0xf279('0x2e')]]['state']=_0x546180[_0xf279('0x21')]['toLowerCase']();logger[_0xf279('0x28')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xf279('0x17')](this[_0xf279('0xc')][_0x546180[_0xf279('0x2e')]],{'showHidden':![],'depth':null}));this[_0xf279('0x1e')](util[_0xf279('0x2a')](_0xf279('0x35'),this[_0xf279('0xc')][_0x546180['device']][_0xf279('0x2c')]),_0xf279('0x36'),this['telephones'][_0x546180[_0xf279('0x2e')]]);}else if(this[_0xf279('0xa')][_0x546180[_0xf279('0x2e')]]){if(this['trunks'][_0x546180[_0xf279('0x2e')]][_0xf279('0x21')]!==_0x546180[_0xf279('0x21')]['toLowerCase']()){this[_0xf279('0xa')][_0x546180['device']][_0xf279('0x34')]=_[_0xf279('0x31')](moment()[_0xf279('0x2a')]('x'));}this[_0xf279('0xa')][_0x546180[_0xf279('0x2e')]][_0xf279('0x21')]=_0x546180[_0xf279('0x21')][_0xf279('0x32')]();logger['debug'](_0xf279('0x37'),util['inspect'](this['trunks'][_0x546180[_0xf279('0x2e')]],{'showHidden':![],'depth':null}));this[_0xf279('0x1e')](util['format'](_0xf279('0x2b'),this[_0xf279('0xa')][_0x546180[_0xf279('0x2e')]][_0xf279('0x2c')]),_0xf279('0x38'),this[_0xf279('0xa')][_0x546180[_0xf279('0x2e')]]);}else if(_[_0xf279('0x39')](_0x546180[_0xf279('0x2e')],_0xf279('0x3a'))){var _0x3fab87=_0x546180[_0xf279('0x2e')];var _0x1917c8=_0x3fab87['substring'](_0x3fab87[_0xf279('0x3b')]('/')+0x1,_0x3fab87[_0xf279('0x3b')]('@'));var _0x1463f0=_[_0xf279('0x3c')](this[_0xf279('0xb')],function(_0x1b79a8){return _0x1b79a8[_0xf279('0x3d')]==_0x1917c8||_0x1b79a8[_0xf279('0x3e')]==_0x1917c8||_0x1b79a8[_0xf279('0x3f')]==_0x1917c8;});if(_0x1463f0){if(_0x1463f0[_0xf279('0x21')]!==_0x546180[_0xf279('0x21')][_0xf279('0x32')]()){_0x1463f0[_0xf279('0x34')]=_['toNumber'](moment()[_0xf279('0x2a')]('x'));}_0x1463f0[_0xf279('0x21')]=_0x546180[_0xf279('0x21')][_0xf279('0x32')]();_0x1463f0[_0xf279('0x30')]=!![];_0x1463f0['updateStatusRealtime'](_0x546180);}}}}catch(_0x2871fc){logger[_0xf279('0x19')](_0xf279('0x40'),util[_0xf279('0x17')](_0x2871fc,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf279('0x41')]=function(_0x23fa13){try{if(this['isNotNull'](_0x23fa13)&&this[_0xf279('0x42')](_0x23fa13[_0xf279('0x43')])){logger['info'](_0xf279('0x44'),_0x23fa13[_0xf279('0x45')],_0x23fa13['address'],_0x23fa13[_0xf279('0x43')]);logger['debug']('[userReport][peerstatus]',util[_0xf279('0x17')](_0x23fa13,{'showHidden':![],'depth':null}));if(this[_0xf279('0xb')][_0x23fa13[_0xf279('0x45')]]){if(!this[_0xf279('0xb')][_0x23fa13['peer']][_0xf279('0x30')]||_0x23fa13['peerstatus']['toLowerCase']()==_0xf279('0x46')){this[_0xf279('0xb')][_0x23fa13[_0xf279('0x45')]][_0xf279('0x30')]=![];this[_0xf279('0xb')][_0x23fa13[_0xf279('0x45')]][_0xf279('0x47')]=_0x23fa13[_0xf279('0x43')][_0xf279('0x32')]();this[_0xf279('0xb')][_0x23fa13[_0xf279('0x45')]]['address']=_0x23fa13['address'];this[_0xf279('0xb')][_0x23fa13[_0xf279('0x45')]]['updateStatusRealtime'](_0x23fa13);}}else if(this[_0xf279('0xc')][_0x23fa13[_0xf279('0x45')]]){this[_0xf279('0xc')][_0x23fa13[_0xf279('0x45')]][_0xf279('0x47')]=_0x23fa13[_0xf279('0x43')][_0xf279('0x32')]();this[_0xf279('0xc')][_0x23fa13['peer']][_0xf279('0x48')]=_0x23fa13['address'];logger[_0xf279('0x28')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xf279('0x17')](this[_0xf279('0xc')][_0x23fa13['peer']],{'showHidden':![],'depth':null}));this[_0xf279('0x1e')](util[_0xf279('0x2a')]('telephone:%s',this[_0xf279('0xc')][_0x23fa13['peer']][_0xf279('0x2c')]),_0xf279('0x36'),this[_0xf279('0xc')][_0x23fa13[_0xf279('0x45')]]);}else if(this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]]){this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]]['status']=_0x23fa13[_0xf279('0x43')][_0xf279('0x32')]();this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]][_0xf279('0x48')]=_0x23fa13[_0xf279('0x48')];logger['debug'](_0xf279('0x49'),util[_0xf279('0x17')](this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]],{'showHidden':![],'depth':null}));this[_0xf279('0x1e')](util[_0xf279('0x2a')](_0xf279('0x2b'),this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]][_0xf279('0x2c')]),_0xf279('0x38'),this[_0xf279('0xa')][_0x23fa13[_0xf279('0x45')]]);}}}catch(_0x2642fe){logger[_0xf279('0x19')](_0xf279('0x4a'),util['inspect'](_0x2642fe,{'showHidden':![],'depth':null}));}};module[_0xf279('0x4b')]=UserReport; \ No newline at end of file +var _0x3bc4=['peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','devicestatechange','syncDeviceState','bind','syncPeerStatus','syncRealtimeShow','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','resolve','then','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','state','debug','find','username','stateRegistry','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','updateStatusRealtime','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','indexOf','mobile','phone','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0x3bc4,0xe1));var _0x43bc=function(_0x4b01b7,_0x183b04){_0x4b01b7=_0x4b01b7-0x0;var _0x2ed185=_0x3bc4[_0x4b01b7];return _0x2ed185;};'use strict';var _=require('lodash');var moment=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var Redis=require(_0x43bc('0x2'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0x43bc('0x3'))(_0x43bc('0x4'));var ami=require(_0x43bc('0x5'));config['redis']=_[_0x43bc('0x6')](config[_0x43bc('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x43bc('0x8'))(new Redis(config[_0x43bc('0x7')]));function UserReport(_0x598377){this[_0x43bc('0x9')]=_0x598377[_0x43bc('0x9')];this[_0x43bc('0xa')]=_0x598377[_0x43bc('0xa')];this[_0x43bc('0xb')]=_0x598377[_0x43bc('0xb')];ami['on']('registryentry',this[_0x43bc('0xc')]['bind'](this));ami['on'](_0x43bc('0xd'),this[_0x43bc('0xc')]['bind'](this));ami['on'](_0x43bc('0xe'),this[_0x43bc('0xf')][_0x43bc('0x10')](this));ami['on']('peerstatus',this[_0x43bc('0x11')][_0x43bc('0x10')](this));return this[_0x43bc('0x12')]();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0x43bc('0x13')]())[_0x43bc('0x14')](function(_0x120f98){logger[_0x43bc('0x15')](_0x43bc('0x16'),util['inspect'](_0x120f98,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x43bc('0x17')]()[_0x43bc('0x18')](ami['actionDeviceStateList']())[_0x43bc('0x14')](function(_0x3dff2a){logger[_0x43bc('0x15')]('[userReport][devicestatelist]',util[_0x43bc('0x19')](_0x3dff2a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x43bc('0x17')]()[_0x43bc('0x18')](ami[_0x43bc('0x1a')]())[_0x43bc('0x14')](function(_0x2595b3){logger[_0x43bc('0x15')](_0x43bc('0x1b'),util[_0x43bc('0x19')](_0x2595b3,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x43bc('0x12')]=function(){setInterval(function(){BPromise[_0x43bc('0x17')]()[_0x43bc('0x18')](showSipRegistrations())[_0x43bc('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x43bc('0x1c')][_0x43bc('0x1d')]=function(_0x350f3f){return _0x350f3f!==null&&!_[_0x43bc('0x1e')](_0x350f3f);};UserReport[_0x43bc('0x1c')][_0x43bc('0x1f')]=function(_0x21aa35,_0xff099f,_0x112820){io['to'](_0x21aa35)[_0x43bc('0x1f')](_0xff099f,_0x112820);};UserReport[_0x43bc('0x1c')]['syncRegistry']=function(_0x2b7fa5){try{if(this['isNotNull'](_0x2b7fa5)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x2b7fa5['username'],_0x2b7fa5[_0x43bc('0x20')]);logger[_0x43bc('0x21')]('[userReport][registry]',util[_0x43bc('0x19')](_0x2b7fa5,{'showHidden':![],'depth':null}));var _0x30af86=_[_0x43bc('0x22')](this['trunks'],{'defaultuser':_0x2b7fa5[_0x43bc('0x23')]});if(_0x30af86){_0x2b7fa5[_0x43bc('0x24')]=_0x2b7fa5['state'];_[_0x43bc('0x25')](_0x30af86,_[_0x43bc('0x26')](_0x2b7fa5,['event',_0x43bc('0x27'),'username',_0x43bc('0x20')]));logger[_0x43bc('0x21')](_0x43bc('0x28'),util[_0x43bc('0x19')](_0x30af86,{'showHidden':![],'depth':null}));this['emit'](util[_0x43bc('0x29')](_0x43bc('0x2a'),_0x30af86[_0x43bc('0x2b')]),_0x43bc('0x2c'),_0x30af86);}}}catch(_0x5066c2){logger[_0x43bc('0x15')](_0x43bc('0x2d'),util[_0x43bc('0x19')](_0x5066c2,{'showHidden':![],'depth':null}));}};UserReport[_0x43bc('0x1c')][_0x43bc('0xf')]=function(_0x45f67a){try{if(this[_0x43bc('0x1d')](_0x45f67a)){logger[_0x43bc('0x2e')](_0x43bc('0x2f'),_0x45f67a['device'],_0x45f67a[_0x43bc('0x20')]);logger[_0x43bc('0x21')](_0x43bc('0x30'),util['inspect'](_0x45f67a,{'showHidden':![],'depth':null}));if(this[_0x43bc('0xa')][_0x45f67a[_0x43bc('0x31')]]){if(!this[_0x43bc('0xa')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x32')]||_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]()==_0x43bc('0x34')){this[_0x43bc('0xa')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x32')]=![];if(this[_0x43bc('0xa')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x20')]!==_0x45f67a[_0x43bc('0x20')]['toLowerCase']()){this['agents'][_0x45f67a[_0x43bc('0x31')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['agents'][_0x45f67a['device']][_0x43bc('0x20')]=_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]();this[_0x43bc('0xa')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x35')](_0x45f67a);}}else if(this['telephones'][_0x45f67a[_0x43bc('0x31')]]){if(this[_0x43bc('0xb')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x20')]!==_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]()){this[_0x43bc('0xb')][_0x45f67a['device']][_0x43bc('0x36')]=_[_0x43bc('0x37')](moment()[_0x43bc('0x29')]('x'));}this[_0x43bc('0xb')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x20')]=_0x45f67a['state']['toLowerCase']();logger[_0x43bc('0x21')](_0x43bc('0x38'),util['inspect'](this[_0x43bc('0xb')][_0x45f67a[_0x43bc('0x31')]],{'showHidden':![],'depth':null}));this[_0x43bc('0x1f')](util['format']('telephone:%s',this[_0x43bc('0xb')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x2b')]),_0x43bc('0x39'),this[_0x43bc('0xb')][_0x45f67a[_0x43bc('0x31')]]);}else if(this[_0x43bc('0x9')][_0x45f67a[_0x43bc('0x31')]]){if(this[_0x43bc('0x9')][_0x45f67a[_0x43bc('0x31')]][_0x43bc('0x20')]!==_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]()){this[_0x43bc('0x9')][_0x45f67a[_0x43bc('0x31')]]['stateTime']=_[_0x43bc('0x37')](moment()[_0x43bc('0x29')]('x'));}this[_0x43bc('0x9')][_0x45f67a['device']][_0x43bc('0x20')]=_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]();logger[_0x43bc('0x21')](_0x43bc('0x3a'),util['inspect'](this[_0x43bc('0x9')][_0x45f67a[_0x43bc('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x43bc('0x29')]('trunk:%s',this['trunks'][_0x45f67a[_0x43bc('0x31')]]['name']),_0x43bc('0x2c'),this['trunks'][_0x45f67a[_0x43bc('0x31')]]);}else if(_[_0x43bc('0x3b')](_0x45f67a['device'],'Local')){var _0x3c1335=_0x45f67a[_0x43bc('0x31')];var _0x32d0b8=_0x3c1335['substring'](_0x3c1335[_0x43bc('0x3c')]('/')+0x1,_0x3c1335[_0x43bc('0x3c')]('@'));var _0x3aa41f=_[_0x43bc('0x22')](this[_0x43bc('0xa')],function(_0x172ecd){return _0x172ecd[_0x43bc('0x3d')]==_0x32d0b8||_0x172ecd[_0x43bc('0x3e')]==_0x32d0b8||_0x172ecd['accountcode']==_0x32d0b8;});if(_0x3aa41f){if(_0x3aa41f[_0x43bc('0x20')]!==_0x45f67a['state'][_0x43bc('0x33')]()){_0x3aa41f[_0x43bc('0x36')]=_[_0x43bc('0x37')](moment()[_0x43bc('0x29')]('x'));}_0x3aa41f[_0x43bc('0x20')]=_0x45f67a[_0x43bc('0x20')][_0x43bc('0x33')]();_0x3aa41f['local']=!![];_0x3aa41f[_0x43bc('0x35')](_0x45f67a);}}}}catch(_0x36ee64){logger[_0x43bc('0x15')](_0x43bc('0x30'),util[_0x43bc('0x19')](_0x36ee64,{'showHidden':![],'depth':null}));}};UserReport[_0x43bc('0x1c')][_0x43bc('0x11')]=function(_0x207c75){try{if(this[_0x43bc('0x1d')](_0x207c75)&&this['isNotNull'](_0x207c75[_0x43bc('0x3f')])){logger[_0x43bc('0x2e')](_0x43bc('0x40'),_0x207c75['peer'],_0x207c75[_0x43bc('0x41')],_0x207c75['peerstatus']);logger[_0x43bc('0x21')](_0x43bc('0x42'),util[_0x43bc('0x19')](_0x207c75,{'showHidden':![],'depth':null}));if(this[_0x43bc('0xa')][_0x207c75[_0x43bc('0x43')]]){if(!this[_0x43bc('0xa')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x32')]||_0x207c75['peerstatus'][_0x43bc('0x33')]()==_0x43bc('0x44')){this[_0x43bc('0xa')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x32')]=![];this[_0x43bc('0xa')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x45')]=_0x207c75[_0x43bc('0x3f')][_0x43bc('0x33')]();this[_0x43bc('0xa')][_0x207c75['peer']][_0x43bc('0x41')]=_0x207c75[_0x43bc('0x41')];this[_0x43bc('0xa')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x35')](_0x207c75);}}else if(this[_0x43bc('0xb')][_0x207c75[_0x43bc('0x43')]]){this[_0x43bc('0xb')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x45')]=_0x207c75[_0x43bc('0x3f')][_0x43bc('0x33')]();this[_0x43bc('0xb')][_0x207c75[_0x43bc('0x43')]]['address']=_0x207c75['address'];logger[_0x43bc('0x21')](_0x43bc('0x46'),util[_0x43bc('0x19')](this[_0x43bc('0xb')][_0x207c75[_0x43bc('0x43')]],{'showHidden':![],'depth':null}));this[_0x43bc('0x1f')](util[_0x43bc('0x29')]('telephone:%s',this[_0x43bc('0xb')][_0x207c75['peer']][_0x43bc('0x2b')]),_0x43bc('0x39'),this[_0x43bc('0xb')][_0x207c75[_0x43bc('0x43')]]);}else if(this[_0x43bc('0x9')][_0x207c75[_0x43bc('0x43')]]){this['trunks'][_0x207c75['peer']][_0x43bc('0x45')]=_0x207c75['peerstatus'][_0x43bc('0x33')]();this[_0x43bc('0x9')][_0x207c75[_0x43bc('0x43')]][_0x43bc('0x41')]=_0x207c75[_0x43bc('0x41')];logger[_0x43bc('0x21')](_0x43bc('0x47'),util[_0x43bc('0x19')](this['trunks'][_0x207c75['peer']],{'showHidden':![],'depth':null}));this[_0x43bc('0x1f')](util[_0x43bc('0x29')](_0x43bc('0x2a'),this[_0x43bc('0x9')][_0x207c75['peer']][_0x43bc('0x2b')]),'trunk:save',this['trunks'][_0x207c75['peer']]);}}}catch(_0xe64bcf){logger['error'](_0x43bc('0x42'),util[_0x43bc('0x19')](_0xe64bcf,{'showHidden':![],'depth':null}));}};module[_0x43bc('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 594a8a6..a271e47 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7de8=['ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','assign','omit','event','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:%s','user:agentconnect','agentcomplete','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7de8,0x133));var _0x87de=function(_0x12f30b,_0x12e25a){_0x12f30b=_0x12f30b-0x0;var _0xb56d25=_0x7de8[_0x12f30b];return _0xb56d25;};'use strict';var _=require(_0x87de('0x0'));var moment=require(_0x87de('0x1'));var util=require(_0x87de('0x2'));var Redis=require(_0x87de('0x3'));var config=require('../../../config/environment');var logger=require(_0x87de('0x4'))(_0x87de('0x5'));var ami=require('../ami');config[_0x87de('0x6')]=_['defaults'](config[_0x87de('0x6')],{'host':_0x87de('0x7'),'port':0x18eb});var io=require(_0x87de('0x8'))(new Redis(config[_0x87de('0x6')]));function VoiceAgentReport(_0x1f38a9){this[_0x87de('0x9')]={};this[_0x87de('0xa')]=_0x1f38a9['channels'];this[_0x87de('0xb')]=_0x1f38a9[_0x87de('0xb')];this['agents']=_0x1f38a9[_0x87de('0xc')];this[_0x87de('0xd')]={};ami['on'](_0x87de('0xe'),this[_0x87de('0xf')][_0x87de('0x10')](this));ami['on'](_0x87de('0x11'),this[_0x87de('0x12')][_0x87de('0x10')](this));ami['on'](_0x87de('0x13'),this[_0x87de('0x14')][_0x87de('0x10')](this));ami['on']('queuecallerabandon',this[_0x87de('0x15')]['bind'](this));ami['on']('agentcomplete',this[_0x87de('0x16')][_0x87de('0x10')](this));ami['on'](_0x87de('0x17'),this[_0x87de('0x18')]['bind'](this));ami['on'](_0x87de('0x19'),this[_0x87de('0x1a')]['bind'](this));ami['on'](_0x87de('0x1b'),this[_0x87de('0x1c')]['bind'](this));ami['on'](_0x87de('0x1d'),this[_0x87de('0x1e')][_0x87de('0x10')](this));ami['on']('attendedtransfer',this[_0x87de('0x1f')][_0x87de('0x10')](this));ami['on'](_0x87de('0x20'),this[_0x87de('0x21')][_0x87de('0x10')](this));}VoiceAgentReport[_0x87de('0x22')][_0x87de('0x23')]=function(_0x3f5791,_0x2bde7c,_0x43ee0d){io['to'](_0x3f5791)[_0x87de('0x23')](_0x2bde7c,_0x43ee0d);};VoiceAgentReport['prototype'][_0x87de('0x24')]=function(_0x550631){return _0x550631!==null&&!_[_0x87de('0x25')](_0x550631);};VoiceAgentReport['prototype'][_0x87de('0xf')]=function(_0x59a66a){try{if(this[_0x87de('0x24')](_0x59a66a)){logger[_0x87de('0x26')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x59a66a['uniqueid'],_0x59a66a[_0x87de('0x27')],_0x59a66a[_0x87de('0x28')]);logger[_0x87de('0x29')](_0x87de('0x2a'),_0x59a66a[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x59a66a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x87de('0x9')][_0x59a66a[_0x87de('0x2b')]])){this[_0x87de('0x9')][_0x59a66a[_0x87de('0x2b')]]={};}var _0x23d039=this['agents'][_0x59a66a[_0x87de('0x2d')]];var _0x1c3566=this[_0x87de('0x9')][_0x59a66a[_0x87de('0x2b')]][_0x59a66a[_0x87de('0x28')]];var _0x57f6d1=this['voiceQueues'][_0x59a66a[_0x87de('0x2e')]];var _0x5451a7=this[_0x87de('0xd')][_0x59a66a[_0x87de('0x2b')]];if(_[_0x87de('0x25')](_0x1c3566)){_0x1c3566={'agentcalledAt':moment()['format'](_0x87de('0x2f')),'lastevent':'called','mandatoryDisposition':_0x57f6d1&&_0x57f6d1['mandatoryDisposition']?_0x57f6d1[_0x87de('0x30')]:![],'type':_0x57f6d1&&_0x57f6d1[_0x87de('0x31')]?_0x57f6d1['type']:_0x87de('0x32'),'variables':_0x5451a7,'motionChannel':_0x87de('0x33')};}Object[_0x87de('0x34')](_0x1c3566,_[_0x87de('0x35')](_0x59a66a,[_0x87de('0x36'),'privilege']));this['channels'][_0x59a66a['uniqueid']][_0x59a66a[_0x87de('0x28')]]=_0x1c3566;logger[_0x87de('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x59a66a[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x1c3566,{'showHidden':![],'depth':null}));ami[_0x87de('0x23')](_0x87de('0x37'),_0x1c3566);var _0x362ee0={'id':_0x23d039['id'],'calleridnum':_0x1c3566[_0x87de('0x38')],'queue':_0x1c3566['queue'],'variables':_0x1c3566[_0x87de('0xd')],'uniqueid':_0x59a66a[_0x87de('0x2b')]};logger['debug'](_0x87de('0x39'),_0x59a66a[_0x87de('0x2b')],util['inspect'](_0x362ee0,{'showHidden':![],'depth':null}));this['emit'](util[_0x87de('0x3a')]('user:%s',_0x59a66a[_0x87de('0x27')]),'user:called',_0x362ee0);}}catch(_0x28debf){logger[_0x87de('0x3b')](_0x87de('0x3c'),_0x59a66a['uniqueid'],util['inspect'](_0x28debf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x12')]=function(_0x5ed5fe){try{if(this[_0x87de('0x24')](_0x5ed5fe)){if(this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]]){for(var _0x6d01fd in this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]]){if(this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x87de('0x3d')](_0x6d01fd)){if(_0x5ed5fe[_0x87de('0x28')]===_0x6d01fd){logger['info'](_0x87de('0x3e'),_0x5ed5fe['uniqueid'],_0x5ed5fe[_0x87de('0x27')],_0x5ed5fe['destuniqueid']);this[_0x87de('0x9')][_0x5ed5fe['uniqueid']][_0x6d01fd][_0x87de('0x3f')]=moment()[_0x87de('0x3a')](_0x87de('0x2f'));this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x40')]=_0x5ed5fe[_0x87de('0x40')];this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x41')]=_0x5ed5fe['connectedlinenum'];this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd]['destchannelstate']=_0x5ed5fe[_0x87de('0x42')];this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x43')]=_0x5ed5fe[_0x87de('0x43')];this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x44')]=_0x5ed5fe[_0x87de('0x44')];this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x45')]='connect';_['merge'](this[_0x87de('0xc')][_0x5ed5fe['interface']],_[_0x87de('0x46')](_0x5ed5fe,[_0x87de('0x2e'),_0x87de('0x47')]));var _0x5f3f25=this[_0x87de('0xc')][_0x5ed5fe[_0x87de('0x2d')]];var _0x1fa868={'id':_0x5f3f25['id'],'name':_0x5f3f25[_0x87de('0x48')],'agentconnected':!![],'destaccountcode':_0x5f3f25[_0x87de('0x49')],'destconnectedlinenum':this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x5ed5fe['destuniqueid']][_0x87de('0x4a')],'queue':this[_0x87de('0x9')][_0x5ed5fe['uniqueid']][_0x5ed5fe[_0x87de('0x28')]][_0x87de('0x2e')],'uniqueid':this['channels'][_0x5ed5fe['uniqueid']][_0x5ed5fe[_0x87de('0x28')]][_0x87de('0x2b')]};ami[_0x87de('0x23')](_0x87de('0x4b'),this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x5ed5fe[_0x87de('0x28')]]);this[_0x87de('0x23')](util['format'](_0x87de('0x4c'),_0x5ed5fe['membername']),_0x87de('0x4d'),_0x1fa868);}else if(!this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x13')]&&!this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x4e')]){logger[_0x87de('0x26')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x5ed5fe['uniqueid'],this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x27')],_0x6d01fd);this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x13')]=!![];this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x4f')]=moment()[_0x87de('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x50')]=_0x5ed5fe['destuniqueid'];this[_0x87de('0x9')][_0x5ed5fe['uniqueid']][_0x6d01fd][_0x87de('0x51')]=_0x5ed5fe[_0x87de('0x27')];this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd][_0x87de('0x45')]='answered_elsewhere';this[_0x87de('0x9')][_0x5ed5fe['uniqueid']][_0x6d01fd][_0x87de('0x52')]=_0x87de('0x53');logger[_0x87de('0x29')](_0x87de('0x54'),_0x5ed5fe[_0x87de('0x2b')],util[_0x87de('0x2c')](this['channels'][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd],{'showHidden':![],'depth':null}));ami[_0x87de('0x23')](_0x87de('0x55'),this[_0x87de('0x9')][_0x5ed5fe[_0x87de('0x2b')]][_0x6d01fd]);}else{logger[_0x87de('0x29')](_0x87de('0x56'),_0x5ed5fe['uniqueid']);}}}}}}catch(_0x2565f8){logger[_0x87de('0x3b')](_0x87de('0x57'),_0x5ed5fe['uniqueid'],util['inspect'](_0x2565f8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')]['syncAgentRingNoAnswer']=function(_0x4ddacb){try{if(this['isNotNull'](_0x4ddacb)){logger[_0x87de('0x29')](_0x87de('0x58'),_0x4ddacb[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x4ddacb,{'showHidden':![],'depth':null}));if(this[_0x87de('0x9')][_0x4ddacb['uniqueid']]&&this[_0x87de('0x9')][_0x4ddacb[_0x87de('0x2b')]][_0x4ddacb['destuniqueid']]){logger[_0x87de('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x4ddacb['uniqueid'],_0x4ddacb[_0x87de('0x27')],_0x4ddacb[_0x87de('0x28')]);var _0x19e88f=this[_0x87de('0xc')][_0x4ddacb['interface']];var _0x62beac=this[_0x87de('0x9')][_0x4ddacb[_0x87de('0x2b')]][_0x4ddacb[_0x87de('0x28')]];_0x62beac['agentringnoanswer']=!![];_0x62beac['agentringnoanswerAt']=moment()['format'](_0x87de('0x2f'));_0x62beac[_0x87de('0x45')]=_0x87de('0x59');_0x62beac[_0x87de('0x52')]=_0x87de('0x59');var _0x229752={'id':_0x19e88f['id'],'name':_0x19e88f['name'],'queue':_0x62beac['queue'],'uniqueid':_0x62beac[_0x87de('0x2b')]};logger[_0x87de('0x29')](_0x87de('0x5a'),_0x4ddacb[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x229752,{'showHidden':![],'depth':null}));this[_0x87de('0x23')](util[_0x87de('0x3a')](_0x87de('0x4c'),_0x19e88f[_0x87de('0x48')]),_0x87de('0x5b'),_0x229752);ami[_0x87de('0x23')](_0x87de('0x5c'),_0x62beac);this[_0x87de('0x9')][_0x4ddacb[_0x87de('0x2b')]][_0x4ddacb['destuniqueid']]=Object['assign']({},_0x62beac);}}}catch(_0x81066e){logger[_0x87de('0x3b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x4ddacb[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x81066e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x15')]=function(_0x4559d6){try{if(this[_0x87de('0x24')](_0x4559d6)){logger[_0x87de('0x29')](_0x87de('0x5d'),_0x4559d6[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x4559d6,{'showHidden':![],'depth':null}));if(this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]]){for(var _0x363adb in this['channels'][_0x4559d6['uniqueid']]){if(this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]]['hasOwnProperty'](_0x363adb)&&!this[_0x87de('0x9')][_0x4559d6['uniqueid']][_0x363adb][_0x87de('0x13')]&&!this['channels'][_0x4559d6[_0x87de('0x2b')]][_0x363adb]['agentcomplete']){logger[_0x87de('0x26')](_0x87de('0x5e'),_0x4559d6[_0x87de('0x2b')],this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]][_0x363adb][_0x87de('0x27')],_0x363adb);this['channels'][_0x4559d6[_0x87de('0x2b')]][_0x363adb]['agentringnoanswer']=!![];this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]][_0x363adb]['agentringnoanswerAt']=moment()[_0x87de('0x3a')](_0x87de('0x2f'));this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]][_0x363adb][_0x87de('0x45')]=_0x87de('0x5f');this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]][_0x363adb][_0x87de('0x52')]=_0x87de('0x5f');logger[_0x87de('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x4559d6[_0x87de('0x2b')],util[_0x87de('0x2c')](this[_0x87de('0x9')][_0x4559d6['uniqueid']][_0x363adb],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x87de('0x9')][_0x4559d6[_0x87de('0x2b')]][_0x363adb]);}}}}}catch(_0x1993a3){logger[_0x87de('0x3b')](_0x87de('0x60'),_0x4559d6['uniqueid'],util[_0x87de('0x2c')](_0x1993a3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x87de('0x16')]=function(_0x4d5295){try{if(this[_0x87de('0x24')](_0x4d5295)){logger[_0x87de('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x4d5295[_0x87de('0x2b')],util['inspect'](_0x4d5295,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d5295[_0x87de('0x2b')]]){for(var _0x275ef2 in this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]]){if(this['channels'][_0x4d5295['uniqueid']]['hasOwnProperty'](_0x275ef2)){if(this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2]['agentconnectAt']&&!this['channels'][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x4e')]){logger[_0x87de('0x26')](_0x87de('0x61'),_0x4d5295['uniqueid'],this['channels'][_0x4d5295[_0x87de('0x2b')]][_0x275ef2]['membername'],_0x275ef2);this['channels'][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x4e')]=!![];this['channels'][_0x4d5295[_0x87de('0x2b')]][_0x275ef2]['agentcompleteAt']=moment()[_0x87de('0x3a')](_0x87de('0x2f'));this[_0x87de('0x9')][_0x4d5295['uniqueid']][_0x275ef2][_0x87de('0x45')]=_0x87de('0x62');this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x52')]=_0x4d5295[_0x87de('0x52')]=='transfer'?_0x87de('0x63'):_0x4d5295[_0x87de('0x52')];this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x64')]=_0x4d5295[_0x87de('0x64')];if(this['voiceQueues'][_0x4d5295[_0x87de('0x2e')]]&&this[_0x87de('0xb')][_0x4d5295[_0x87de('0x2e')]][_0x87de('0x65')]){this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x66')]=this[_0x87de('0xb')][_0x4d5295['queue']]['acwTimeout'];this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2][_0x87de('0x67')]=!![];}this[_0x87de('0xc')][_0x4d5295[_0x87de('0x2d')]]=_['omit'](this['agents'][_0x4d5295['interface']],[_0x87de('0x2e'),_0x87de('0x47')]);logger[_0x87de('0x29')](_0x87de('0x68'),_0x4d5295[_0x87de('0x2b')],util[_0x87de('0x2c')](this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2],{'showHidden':![],'depth':null}));ami['emit'](_0x87de('0x69'),this[_0x87de('0x9')][_0x4d5295[_0x87de('0x2b')]][_0x275ef2]);logger[_0x87de('0x29')](_0x87de('0x6a'),_0x4d5295['uniqueid'],util[_0x87de('0x2c')]({'id':this[_0x87de('0xc')][_0x4d5295[_0x87de('0x2d')]]['id'],'destaccountcode':_0x4d5295[_0x87de('0x6b')]},{'showHidden':![],'depth':null}));this[_0x87de('0x23')](util[_0x87de('0x3a')](_0x87de('0x4c'),_0x4d5295[_0x87de('0x27')]),'user:agentcomplete',{'id':this[_0x87de('0xc')][_0x4d5295[_0x87de('0x2d')]]['id'],'destaccountcode':Number(_0x4d5295[_0x87de('0x6b')])});}}}}}}catch(_0x2851eb){logger[_0x87de('0x3b')]('[%s][voiceAgentReport][agentcomplete]',_0x4d5295[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x2851eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x18')]=function(_0x3e9506){try{if(this[_0x87de('0x24')](_0x3e9506)){logger[_0x87de('0x29')](_0x87de('0x6c'),_0x3e9506['uniqueid'],util[_0x87de('0x2c')](_0x3e9506,{'showHidden':![],'depth':null}));this[_0x87de('0x6d')](_0x3e9506[_0x87de('0x2b')],_[_0x87de('0x6e')](_0x3e9506[_0x87de('0x6f')])[0x0],_0x3e9506[_0x87de('0x70')]);if(this[_0x87de('0x9')][_0x3e9506[_0x87de('0x2b')]]){for(var _0x2f8a15 in this[_0x87de('0x9')][_0x3e9506[_0x87de('0x2b')]]){if(this['channels'][_0x3e9506['uniqueid']][_0x87de('0x3d')](_0x2f8a15)){logger['info'](_0x87de('0x71'),_0x3e9506[_0x87de('0x2b')],_0x2f8a15,_[_0x87de('0x6e')](_0x3e9506['variable'])[0x0],_0x3e9506[_0x87de('0x70')]);if(_[_0x87de('0x25')](this[_0x87de('0x9')][_0x3e9506['uniqueid']][_0x2f8a15][_0x87de('0xd')])){this[_0x87de('0x9')][_0x3e9506['uniqueid']][_0x2f8a15][_0x87de('0xd')]={};}this[_0x87de('0x9')][_0x3e9506['uniqueid']][_0x2f8a15]['variables']=this[_0x87de('0xd')][_0x3e9506['uniqueid']];}}}}}catch(_0x3d408a){logger[_0x87de('0x3b')](_0x87de('0x72'),_0x3e9506[_0x87de('0x2b')],util['inspect'](_0x3d408a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x6d')]=function(_0x49f1e0,_0x45fdba,_0x2731a7){var _0x16361d=['rtpaudioqos',_0x87de('0x73'),_0x87de('0x74'),_0x87de('0x75'),'rtpaudioqosloss',_0x87de('0x76'),_0x87de('0x77'),_0x87de('0x78'),'sipcallid',_0x87de('0x79'),_0x87de('0x7a'),_0x87de('0x7b'),_0x87de('0x7c'),_0x87de('0x7d'),_0x87de('0x7e'),_0x87de('0x7f'),_0x87de('0x27'),'memberpenalty',_0x87de('0x80')];if(!_[_0x87de('0x81')](_0x45fdba)&&!_[_0x87de('0x82')](_0x16361d,_0x45fdba)){if(_[_0x87de('0x25')](this[_0x87de('0xd')][_0x49f1e0])){this[_0x87de('0xd')][_0x49f1e0]={};}this['variables'][_0x49f1e0][_0x45fdba]=_0x2731a7;}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x1a')]=function(_0x3a30c8){try{if(this[_0x87de('0x24')](_0x3a30c8)){logger[_0x87de('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x3a30c8[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x3a30c8,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a30c8[_0x87de('0x2b')]]){for(var _0x213eb0 in this[_0x87de('0x9')][_0x3a30c8[_0x87de('0x2b')]]){if(this['channels'][_0x3a30c8['uniqueid']][_0x87de('0x3d')](_0x213eb0)){if(this[_0x87de('0x9')][_0x3a30c8[_0x87de('0x2b')]][_0x213eb0][_0x87de('0x52')]=='transfer'&&this[_0x87de('0x9')][_0x3a30c8[_0x87de('0x2b')]][_0x213eb0]['agentcomplete']){logger[_0x87de('0x26')](_0x87de('0x83'),_0x3a30c8['uniqueid'],_0x213eb0);this[_0x87de('0x9')][_0x3a30c8['uniqueid']][_0x213eb0][_0x87de('0x84')]=moment()[_0x87de('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x87de('0x29')](_0x87de('0x85'),_0x3a30c8['uniqueid'],util[_0x87de('0x2c')](_[_0x87de('0x86')](this[_0x87de('0x9')][_0x3a30c8['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0x87de('0x87'),_['values'](this[_0x87de('0x9')][_0x3a30c8[_0x87de('0x2b')]]));this[_0x87de('0x88')](_0x3a30c8[_0x87de('0x2b')]);}if(this[_0x87de('0xd')][_0x3a30c8[_0x87de('0x2b')]]){delete this[_0x87de('0xd')][_0x3a30c8[_0x87de('0x2b')]];}}}catch(_0x2e6a6d){logger['error'](_0x87de('0x89'),_0x3a30c8[_0x87de('0x2b')],util['inspect'](_0x2e6a6d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')]['syncAttendedTransfer']=function(_0x441b78){try{if(this[_0x87de('0x24')](_0x441b78)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x441b78[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x441b78,{'showHidden':![],'depth':null}));if(this['channels'][_0x441b78[_0x87de('0x8a')]]){for(var _0x5bbb71 in this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]]){if(this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]]['hasOwnProperty'](_0x5bbb71)){if(_0x441b78[_0x87de('0x8b')]===_0x5bbb71){logger[_0x87de('0x26')](_0x87de('0x8c'),_0x441b78[_0x87de('0x2b')],this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]][_0x5bbb71]['membername'],_0x5bbb71);var _0x359495=moment();this['channels'][_0x441b78[_0x87de('0x8a')]][_0x5bbb71][_0x87de('0x4e')]=!![];this['channels'][_0x441b78[_0x87de('0x8a')]][_0x5bbb71][_0x87de('0x84')]=moment()[_0x87de('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]][_0x5bbb71]['lastevent']=_0x87de('0x62');this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]][_0x5bbb71][_0x87de('0x52')]='transfer';this['channels'][_0x441b78[_0x87de('0x8a')]][_0x5bbb71][_0x87de('0x64')]=_0x359495[_0x87de('0x8d')](this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]][_0x5bbb71][_0x87de('0x3f')],_0x87de('0x8e'));}}}}if(this[_0x87de('0x9')][_0x441b78[_0x87de('0x8f')]]){var _0x12d478=this[_0x87de('0x9')][_0x441b78[_0x87de('0x8f')]];this[_0x87de('0x9')][_0x441b78[_0x87de('0x8f')]]=this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]];this[_0x87de('0x9')][_0x441b78[_0x87de('0x8a')]]=_0x12d478;}}}catch(_0x1b62cf){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x441b78[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x1b62cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x21')]=function(_0x7c3971){try{if(this[_0x87de('0x24')](_0x7c3971)){logger[_0x87de('0x29')](_0x87de('0x90'),_0x7c3971[_0x87de('0x2b')],util['inspect'](_0x7c3971,{'showHidden':![],'depth':null}));if(this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]]){for(var _0x41ed82 in this[_0x87de('0x9')][_0x7c3971['transfereeuniqueid']]){if(this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x87de('0x3d')](_0x41ed82)){if(_0x7c3971['transfereruniqueid']===_0x41ed82){logger[_0x87de('0x26')](_0x87de('0x91'),_0x7c3971[_0x87de('0x2b')],this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x27')],_0x41ed82);var _0x26740f=moment();this['channels'][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x4e')]=!![];this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x84')]=_0x26740f;this[_0x87de('0x9')][_0x7c3971['transfereeuniqueid']][_0x41ed82]['lastevent']='complete';this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x52')]='transfer';this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x64')]=_0x26740f[_0x87de('0x8d')](this[_0x87de('0x9')][_0x7c3971[_0x87de('0x8a')]][_0x41ed82][_0x87de('0x3f')],'seconds');}}}}}}catch(_0x43588d){logger[_0x87de('0x3b')](_0x87de('0x92'),_0x7c3971[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x43588d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x1c')]=function(_0x179ef2){var _0x4d5f79='';try{if(this[_0x87de('0x24')](_0x179ef2)){logger[_0x87de('0x29')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x179ef2[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x179ef2,{'showHidden':![],'depth':null}));if(_0x179ef2['channel']){_0x4d5f79=_0x179ef2[_0x87de('0x93')][_0x87de('0x94')](0x0,_0x179ef2[_0x87de('0x93')][_0x87de('0x95')]('-'));if(this[_0x87de('0xc')][_0x4d5f79]){logger[_0x87de('0x26')](_0x87de('0x96'),_0x179ef2['uniqueid'],_0x4d5f79);this['agents'][_0x4d5f79]['onhold']=!![];}}}}catch(_0xdf929b){logger[_0x87de('0x3b')](_0x87de('0x97'),_0x179ef2[_0x87de('0x2b')],util[_0x87de('0x2c')](_0xdf929b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')]['syncMusicOnHoldStop']=function(_0x5398b6){var _0x5c653d='';try{if(this[_0x87de('0x24')](_0x5398b6)){logger[_0x87de('0x29')](_0x87de('0x98'),_0x5398b6[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x5398b6,{'showHidden':![],'depth':null}));if(_0x5398b6[_0x87de('0x93')]){_0x5c653d=_0x5398b6['channel'][_0x87de('0x94')](0x0,_0x5398b6[_0x87de('0x93')][_0x87de('0x95')]('-'));if(this['agents'][_0x5c653d]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5398b6[_0x87de('0x2b')],_0x5c653d);this['agents'][_0x5c653d][_0x87de('0x99')]=![];}}}}catch(_0x498d96){logger[_0x87de('0x3b')](_0x87de('0x9a'),_0x5398b6[_0x87de('0x2b')],util[_0x87de('0x2c')](_0x498d96,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x87de('0x22')][_0x87de('0x88')]=function(_0x5d64c3,_0x274327=0x2710){if(this[_0x87de('0x9')][_0x5d64c3]){setTimeout(()=>{delete this[_0x87de('0x9')][_0x5d64c3];},_0x274327);}};module[_0x87de('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0x629d=['destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','name','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','deleteChannelAfterTimeout','transfereeuniqueid','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','lodash','util','ioredis','ami','../ami','redis','defaults','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','inspect','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','omit'];(function(_0xb40e07,_0x57a69c){var _0x8a7e58=function(_0x14bd75){while(--_0x14bd75){_0xb40e07['push'](_0xb40e07['shift']());}};_0x8a7e58(++_0x57a69c);}(_0x629d,0x67));var _0xd629=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x629d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xd629('0x0'));var moment=require('moment');var util=require(_0xd629('0x1'));var Redis=require(_0xd629('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xd629('0x3'));var ami=require(_0xd629('0x4'));config[_0xd629('0x5')]=_[_0xd629('0x6')](config[_0xd629('0x5')],{'host':_0xd629('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd629('0x5')]));function VoiceAgentReport(_0x1c5e44){this[_0xd629('0x8')]={};this[_0xd629('0x9')]=_0x1c5e44[_0xd629('0x8')];this[_0xd629('0xa')]=_0x1c5e44[_0xd629('0xa')];this['agents']=_0x1c5e44[_0xd629('0xb')];this[_0xd629('0xc')]={};ami['on'](_0xd629('0xd'),this[_0xd629('0xe')]['bind'](this));ami['on'](_0xd629('0xf'),this['syncAgentConnect'][_0xd629('0x10')](this));ami['on'](_0xd629('0x11'),this[_0xd629('0x12')][_0xd629('0x10')](this));ami['on'](_0xd629('0x13'),this['syncQueueCallerAbandon'][_0xd629('0x10')](this));ami['on'](_0xd629('0x14'),this[_0xd629('0x15')][_0xd629('0x10')](this));ami['on'](_0xd629('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0xd629('0x17'),this[_0xd629('0x18')]['bind'](this));ami['on'](_0xd629('0x19'),this[_0xd629('0x1a')][_0xd629('0x10')](this));ami['on']('musiconholdstop',this[_0xd629('0x1b')][_0xd629('0x10')](this));ami['on'](_0xd629('0x1c'),this[_0xd629('0x1d')][_0xd629('0x10')](this));ami['on'](_0xd629('0x1e'),this['syncBlindTransfer'][_0xd629('0x10')](this));}VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x20')]=function(_0x451942,_0x1b0195,_0x1e3816){io['to'](_0x451942)['emit'](_0x1b0195,_0x1e3816);};VoiceAgentReport[_0xd629('0x1f')]['isNotNull']=function(_0x6011c2){return _0x6011c2!==null&&!_['isUndefined'](_0x6011c2);};VoiceAgentReport['prototype'][_0xd629('0xe')]=function(_0x2b925c){try{if(this[_0xd629('0x21')](_0x2b925c)){logger[_0xd629('0x22')](_0xd629('0x23'),_0x2b925c[_0xd629('0x24')],_0x2b925c[_0xd629('0x25')],_0x2b925c['destuniqueid']);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x2b925c[_0xd629('0x24')],util[_0xd629('0x26')](_0x2b925c,{'showHidden':![],'depth':null}));if(_[_0xd629('0x27')](this[_0xd629('0x8')][_0x2b925c['uniqueid']])){this[_0xd629('0x8')][_0x2b925c[_0xd629('0x24')]]={};}var _0x269cb3=this['agents'][_0x2b925c[_0xd629('0x28')]];var _0x5276c4=this['channels'][_0x2b925c[_0xd629('0x24')]][_0x2b925c['destuniqueid']];var _0x4216f9=this[_0xd629('0xa')][_0x2b925c[_0xd629('0x29')]];var _0x1f9c3c=this['variables'][_0x2b925c[_0xd629('0x24')]];if(_[_0xd629('0x27')](_0x5276c4)){_0x5276c4={'agentcalledAt':moment()[_0xd629('0x2a')](_0xd629('0x2b')),'lastevent':_0xd629('0x2c'),'mandatoryDisposition':_0x4216f9&&_0x4216f9[_0xd629('0x2d')]?_0x4216f9['mandatoryDisposition']:![],'type':_0x4216f9&&_0x4216f9[_0xd629('0x2e')]?_0x4216f9[_0xd629('0x2e')]:_0xd629('0x2f'),'variables':_0x1f9c3c,'motionChannel':_0xd629('0x30')};}Object['assign'](_0x5276c4,_[_0xd629('0x31')](_0x2b925c,['event','privilege']));this[_0xd629('0x8')][_0x2b925c[_0xd629('0x24')]][_0x2b925c[_0xd629('0x32')]]=_0x5276c4;logger[_0xd629('0x33')](_0xd629('0x34'),_0x2b925c[_0xd629('0x24')],util[_0xd629('0x26')](_0x5276c4,{'showHidden':![],'depth':null}));ami[_0xd629('0x20')]('custom:agentcalled',_0x5276c4);var _0x958c23={'id':_0x269cb3['id'],'calleridnum':_0x5276c4[_0xd629('0x35')],'queue':_0x5276c4[_0xd629('0x29')],'variables':_0x5276c4[_0xd629('0xc')],'uniqueid':_0x2b925c[_0xd629('0x24')]};logger[_0xd629('0x33')](_0xd629('0x36'),_0x2b925c[_0xd629('0x24')],util[_0xd629('0x26')](_0x958c23,{'showHidden':![],'depth':null}));this[_0xd629('0x20')](util['format'](_0xd629('0x37'),_0x2b925c[_0xd629('0x25')]),_0xd629('0x38'),_0x958c23);}}catch(_0x32dd2a){logger[_0xd629('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x2b925c[_0xd629('0x24')],util[_0xd629('0x26')](_0x32dd2a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x3a')]=function(_0xa75323){try{if(this[_0xd629('0x21')](_0xa75323)){if(this['channels'][_0xa75323[_0xd629('0x24')]]){for(var _0x4b2d2c in this[_0xd629('0x8')][_0xa75323['uniqueid']]){if(this[_0xd629('0x8')][_0xa75323['uniqueid']][_0xd629('0x3b')](_0x4b2d2c)){if(_0xa75323['destuniqueid']===_0x4b2d2c){logger[_0xd629('0x22')](_0xd629('0x3c'),_0xa75323[_0xd629('0x24')],_0xa75323[_0xd629('0x25')],_0xa75323[_0xd629('0x32')]);this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x3d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x3e')]=_0xa75323[_0xd629('0x3e')];this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x3f')]=_0xa75323[_0xd629('0x3f')];this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x40')]=_0xa75323[_0xd629('0x40')];this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c]['destchannelstatedesc']=_0xa75323[_0xd629('0x41')];this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x42')]=_0xa75323[_0xd629('0x42')];this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x43')]=_0xd629('0x44');_[_0xd629('0x45')](this['agents'][_0xa75323[_0xd629('0x28')]],_[_0xd629('0x46')](_0xa75323,[_0xd629('0x29'),_0xd629('0x47')]));var _0x2c4a55=this[_0xd629('0xb')][_0xa75323[_0xd629('0x28')]];var _0x579b62={'id':_0x2c4a55['id'],'name':_0x2c4a55[_0xd629('0x48')],'agentconnected':!![],'destaccountcode':_0x2c4a55['accountcode'],'destconnectedlinenum':this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0xa75323['destuniqueid']][_0xd629('0x49')],'queue':this['channels'][_0xa75323[_0xd629('0x24')]][_0xa75323['destuniqueid']]['queue'],'uniqueid':this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0xa75323[_0xd629('0x32')]]['uniqueid']};ami[_0xd629('0x20')](_0xd629('0x4a'),this[_0xd629('0x8')][_0xa75323['uniqueid']][_0xa75323['destuniqueid']]);this['emit'](util[_0xd629('0x2a')](_0xd629('0x37'),_0xa75323[_0xd629('0x25')]),_0xd629('0x4b'),_0x579b62);}else if(!this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x11')]&&!this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x14')]){logger[_0xd629('0x22')](_0xd629('0x4c'),_0xa75323[_0xd629('0x24')],this[_0xd629('0x8')][_0xa75323['uniqueid']][_0x4b2d2c][_0xd629('0x25')],_0x4b2d2c);this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x11')]=!![];this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x4d')]=moment()[_0xd629('0x2a')](_0xd629('0x2b'));this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x4e')]=_0xa75323[_0xd629('0x32')];this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x4f')]=_0xa75323[_0xd629('0x25')];this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c][_0xd629('0x43')]='answered_elsewhere';this['channels'][_0xa75323[_0xd629('0x24')]][_0x4b2d2c]['reason']=_0xd629('0x50');logger[_0xd629('0x33')](_0xd629('0x51'),_0xa75323[_0xd629('0x24')],util[_0xd629('0x26')](this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c],{'showHidden':![],'depth':null}));ami[_0xd629('0x20')]('custom:agentansweredelsewhere',this[_0xd629('0x8')][_0xa75323[_0xd629('0x24')]][_0x4b2d2c]);}else{logger[_0xd629('0x33')](_0xd629('0x52'),_0xa75323['uniqueid']);}}}}}}catch(_0x108fef){logger[_0xd629('0x39')](_0xd629('0x53'),_0xa75323[_0xd629('0x24')],util['inspect'](_0x108fef,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x28c1e2){try{if(this[_0xd629('0x21')](_0x28c1e2)){logger[_0xd629('0x33')](_0xd629('0x54'),_0x28c1e2[_0xd629('0x24')],util['inspect'](_0x28c1e2,{'showHidden':![],'depth':null}));if(this['channels'][_0x28c1e2['uniqueid']]&&this[_0xd629('0x8')][_0x28c1e2['uniqueid']][_0x28c1e2[_0xd629('0x32')]]){logger[_0xd629('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x28c1e2[_0xd629('0x24')],_0x28c1e2[_0xd629('0x25')],_0x28c1e2['destuniqueid']);var _0x1a66f5=this[_0xd629('0xb')][_0x28c1e2[_0xd629('0x28')]];var _0x25aa3b=this[_0xd629('0x8')][_0x28c1e2[_0xd629('0x24')]][_0x28c1e2[_0xd629('0x32')]];_0x25aa3b[_0xd629('0x11')]=!![];_0x25aa3b[_0xd629('0x4d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25aa3b[_0xd629('0x43')]=_0xd629('0x55');_0x25aa3b[_0xd629('0x56')]=_0xd629('0x55');var _0x475247={'id':_0x1a66f5['id'],'name':_0x1a66f5['name'],'queue':_0x25aa3b['queue'],'uniqueid':_0x25aa3b[_0xd629('0x24')]};logger['debug'](_0xd629('0x57'),_0x28c1e2['uniqueid'],util[_0xd629('0x26')](_0x475247,{'showHidden':![],'depth':null}));this[_0xd629('0x20')](util[_0xd629('0x2a')]('user:%s',_0x1a66f5[_0xd629('0x48')]),_0xd629('0x58'),_0x475247);ami[_0xd629('0x20')](_0xd629('0x59'),_0x25aa3b);this[_0xd629('0x8')][_0x28c1e2[_0xd629('0x24')]][_0x28c1e2['destuniqueid']]=Object[_0xd629('0x5a')]({},_0x25aa3b);}}}catch(_0x7bae4f){logger[_0xd629('0x39')]('[%s][voiceAgentReport][agentringnoanswer]',_0x28c1e2['uniqueid'],util[_0xd629('0x26')](_0x7bae4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')]['syncQueueCallerAbandon']=function(_0x292e1c){try{if(this[_0xd629('0x21')](_0x292e1c)){logger[_0xd629('0x33')](_0xd629('0x5b'),_0x292e1c[_0xd629('0x24')],util[_0xd629('0x26')](_0x292e1c,{'showHidden':![],'depth':null}));if(this[_0xd629('0x8')][_0x292e1c['uniqueid']]){for(var _0x4cd9bf in this[_0xd629('0x8')][_0x292e1c[_0xd629('0x24')]]){if(this['channels'][_0x292e1c[_0xd629('0x24')]][_0xd629('0x3b')](_0x4cd9bf)&&!this[_0xd629('0x8')][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf][_0xd629('0x11')]&&!this[_0xd629('0x8')][_0x292e1c['uniqueid']][_0x4cd9bf][_0xd629('0x14')]){logger[_0xd629('0x22')](_0xd629('0x5c'),_0x292e1c[_0xd629('0x24')],this['channels'][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf][_0xd629('0x25')],_0x4cd9bf);this[_0xd629('0x8')][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf][_0xd629('0x11')]=!![];this[_0xd629('0x8')][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf][_0xd629('0x4d')]=moment()['format'](_0xd629('0x2b'));this['channels'][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf][_0xd629('0x43')]=_0xd629('0x5d');this[_0xd629('0x8')][_0x292e1c['uniqueid']][_0x4cd9bf][_0xd629('0x56')]=_0xd629('0x5d');logger[_0xd629('0x33')](_0xd629('0x5e'),_0x292e1c[_0xd629('0x24')],util[_0xd629('0x26')](this['channels'][_0x292e1c[_0xd629('0x24')]][_0x4cd9bf],{'showHidden':![],'depth':null}));ami['emit'](_0xd629('0x5f'),this[_0xd629('0x8')][_0x292e1c['uniqueid']][_0x4cd9bf]);}}}}}catch(_0xb888a7){logger[_0xd629('0x39')](_0xd629('0x60'),_0x292e1c[_0xd629('0x24')],util[_0xd629('0x26')](_0xb888a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x15')]=function(_0x112050){try{if(this[_0xd629('0x21')](_0x112050)){logger[_0xd629('0x33')](_0xd629('0x61'),_0x112050[_0xd629('0x24')],util[_0xd629('0x26')](_0x112050,{'showHidden':![],'depth':null}));if(this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]]){for(var _0x478ec5 in this['channels'][_0x112050[_0xd629('0x24')]]){if(this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0xd629('0x3b')](_0x478ec5)){if(this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5][_0xd629('0x3d')]&&!this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5]['agentcomplete']){logger[_0xd629('0x22')](_0xd629('0x62'),_0x112050[_0xd629('0x24')],this[_0xd629('0x8')][_0x112050['uniqueid']][_0x478ec5]['membername'],_0x478ec5);this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5]['agentcomplete']=!![];this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5][_0xd629('0x63')]=moment()['format'](_0xd629('0x2b'));this[_0xd629('0x8')][_0x112050['uniqueid']][_0x478ec5][_0xd629('0x43')]=_0xd629('0x64');this[_0xd629('0x8')][_0x112050['uniqueid']][_0x478ec5]['reason']=_0x112050['reason']=='transfer'?_0xd629('0x65'):_0x112050['reason'];this[_0xd629('0x8')][_0x112050['uniqueid']][_0x478ec5]['talktime']=_0x112050[_0xd629('0x66')];if(this['voiceQueues'][_0x112050[_0xd629('0x29')]]&&this['voiceQueues'][_0x112050[_0xd629('0x29')]]['acw']){this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5]['acwtime']=this['voiceQueues'][_0x112050[_0xd629('0x29')]][_0xd629('0x67')];this[_0xd629('0x8')][_0x112050[_0xd629('0x24')]][_0x478ec5][_0xd629('0x68')]=!![];}this[_0xd629('0xb')][_0x112050['interface']]=_['omit'](this[_0xd629('0xb')][_0x112050['interface']],[_0xd629('0x29'),_0xd629('0x47')]);logger[_0xd629('0x33')](_0xd629('0x69'),_0x112050[_0xd629('0x24')],util[_0xd629('0x26')](this['channels'][_0x112050['uniqueid']][_0x478ec5],{'showHidden':![],'depth':null}));ami[_0xd629('0x20')](_0xd629('0x6a'),this[_0xd629('0x8')][_0x112050['uniqueid']][_0x478ec5]);logger[_0xd629('0x33')](_0xd629('0x6b'),_0x112050['uniqueid'],util[_0xd629('0x26')]({'id':this['agents'][_0x112050[_0xd629('0x28')]]['id'],'destaccountcode':_0x112050[_0xd629('0x6c')]},{'showHidden':![],'depth':null}));this[_0xd629('0x20')](util[_0xd629('0x2a')](_0xd629('0x37'),_0x112050[_0xd629('0x25')]),_0xd629('0x6d'),{'id':this['agents'][_0x112050[_0xd629('0x28')]]['id'],'destaccountcode':Number(_0x112050['destaccountcode'])});}}}}}}catch(_0x2e0084){logger[_0xd629('0x39')](_0xd629('0x6e'),_0x112050[_0xd629('0x24')],util[_0xd629('0x26')](_0x2e0084,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x6f')]=function(_0x119c8c){try{if(this['isNotNull'](_0x119c8c)){logger[_0xd629('0x33')](_0xd629('0x70'),_0x119c8c[_0xd629('0x24')],util['inspect'](_0x119c8c,{'showHidden':![],'depth':null}));this[_0xd629('0x71')](_0x119c8c['uniqueid'],_[_0xd629('0x72')](_0x119c8c['variable'])[0x0],_0x119c8c['value']);if(this['channels'][_0x119c8c[_0xd629('0x24')]]){for(var _0x3fbefc in this[_0xd629('0x8')][_0x119c8c[_0xd629('0x24')]]){if(this[_0xd629('0x8')][_0x119c8c[_0xd629('0x24')]]['hasOwnProperty'](_0x3fbefc)){logger[_0xd629('0x22')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x119c8c[_0xd629('0x24')],_0x3fbefc,_[_0xd629('0x72')](_0x119c8c[_0xd629('0x73')])[0x0],_0x119c8c[_0xd629('0x74')]);if(_[_0xd629('0x27')](this[_0xd629('0x8')][_0x119c8c['uniqueid']][_0x3fbefc]['variables'])){this[_0xd629('0x8')][_0x119c8c[_0xd629('0x24')]][_0x3fbefc]['variables']={};}this[_0xd629('0x8')][_0x119c8c['uniqueid']][_0x3fbefc][_0xd629('0xc')]=this[_0xd629('0xc')][_0x119c8c[_0xd629('0x24')]];}}}}}catch(_0x36829e){logger[_0xd629('0x39')]('[%s][voiceAgentReport][varset]',_0x119c8c[_0xd629('0x24')],util['inspect'](_0x36829e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x4bec45,_0x15b49c,_0x596b7c){var _0x29ad0a=['rtpaudioqos','rtpaudioqosbridged',_0xd629('0x75'),_0xd629('0x76'),_0xd629('0x77'),_0xd629('0x78'),_0xd629('0x79'),_0xd629('0x7a'),_0xd629('0x7b'),'sipuri',_0xd629('0x7c'),_0xd629('0x7d'),_0xd629('0x7e'),'memberdynamic',_0xd629('0x7f'),_0xd629('0x80'),_0xd629('0x25'),'memberpenalty',_0xd629('0x81')];if(!_[_0xd629('0x82')](_0x15b49c)&&!_[_0xd629('0x83')](_0x29ad0a,_0x15b49c)){if(_[_0xd629('0x27')](this[_0xd629('0xc')][_0x4bec45])){this['variables'][_0x4bec45]={};}this[_0xd629('0xc')][_0x4bec45][_0x15b49c]=_0x596b7c;}};VoiceAgentReport[_0xd629('0x1f')]['syncHangup']=function(_0x49ee59){try{if(this[_0xd629('0x21')](_0x49ee59)){logger[_0xd629('0x33')](_0xd629('0x84'),_0x49ee59[_0xd629('0x24')],util[_0xd629('0x26')](_0x49ee59,{'showHidden':![],'depth':null}));if(this[_0xd629('0x8')][_0x49ee59[_0xd629('0x24')]]){for(var _0x342717 in this[_0xd629('0x8')][_0x49ee59[_0xd629('0x24')]]){if(this['channels'][_0x49ee59[_0xd629('0x24')]][_0xd629('0x3b')](_0x342717)){if(this[_0xd629('0x8')][_0x49ee59[_0xd629('0x24')]][_0x342717][_0xd629('0x56')]==_0xd629('0x85')&&this[_0xd629('0x8')][_0x49ee59[_0xd629('0x24')]][_0x342717][_0xd629('0x14')]){logger[_0xd629('0x22')](_0xd629('0x86'),_0x49ee59['uniqueid'],_0x342717);this[_0xd629('0x8')][_0x49ee59['uniqueid']][_0x342717][_0xd629('0x63')]=moment()[_0xd629('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xd629('0x33')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x49ee59[_0xd629('0x24')],util[_0xd629('0x26')](_[_0xd629('0x87')](this[_0xd629('0x8')][_0x49ee59['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xd629('0x20')](_0xd629('0x88'),_[_0xd629('0x87')](this[_0xd629('0x8')][_0x49ee59[_0xd629('0x24')]]));this[_0xd629('0x89')](_0x49ee59['uniqueid']);}if(this[_0xd629('0xc')][_0x49ee59[_0xd629('0x24')]]){delete this[_0xd629('0xc')][_0x49ee59['uniqueid']];}}}catch(_0x1b2926){logger['error']('[%s][voiceAgentReport][hangup]',_0x49ee59['uniqueid'],util[_0xd629('0x26')](_0x1b2926,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x1d')]=function(_0x5b0427){try{if(this[_0xd629('0x21')](_0x5b0427)){logger[_0xd629('0x33')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x5b0427[_0xd629('0x24')],util['inspect'](_0x5b0427,{'showHidden':![],'depth':null}));if(this['channels'][_0x5b0427[_0xd629('0x8a')]]){for(var _0x26c3b2 in this[_0xd629('0x8')][_0x5b0427['transfereeuniqueid']]){if(this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]]['hasOwnProperty'](_0x26c3b2)){if(_0x5b0427['origtransfereruniqueid']===_0x26c3b2){logger[_0xd629('0x22')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5b0427['uniqueid'],this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2][_0xd629('0x25')],_0x26c3b2);var _0x257586=moment();this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2][_0xd629('0x14')]=!![];this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2]['agentcompleteAt']=moment()[_0xd629('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2][_0xd629('0x43')]=_0xd629('0x64');this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2]['reason']='transfer';this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2]['talktime']=_0x257586['diff'](this['channels'][_0x5b0427[_0xd629('0x8a')]][_0x26c3b2][_0xd629('0x3d')],'seconds');}}}}if(this['channels'][_0x5b0427['secondtransfereruniqueid']]){var _0x230a35=this['channels'][_0x5b0427[_0xd629('0x8b')]];this['channels'][_0x5b0427[_0xd629('0x8b')]]=this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]];this[_0xd629('0x8')][_0x5b0427[_0xd629('0x8a')]]=_0x230a35;}}}catch(_0x551760){logger['error'](_0xd629('0x8c'),_0x5b0427['uniqueid'],util[_0xd629('0x26')](_0x551760,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd629('0x8d')]=function(_0x5eb81e){try{if(this[_0xd629('0x21')](_0x5eb81e)){logger[_0xd629('0x33')](_0xd629('0x8e'),_0x5eb81e[_0xd629('0x24')],util[_0xd629('0x26')](_0x5eb81e,{'showHidden':![],'depth':null}));if(this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]]){for(var _0x454876 in this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]]){if(this[_0xd629('0x8')][_0x5eb81e['transfereeuniqueid']]['hasOwnProperty'](_0x454876)){if(_0x5eb81e['transfereruniqueid']===_0x454876){logger[_0xd629('0x22')](_0xd629('0x8f'),_0x5eb81e[_0xd629('0x24')],this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]][_0x454876][_0xd629('0x25')],_0x454876);var _0x572512=moment();this['channels'][_0x5eb81e[_0xd629('0x8a')]][_0x454876]['agentcomplete']=!![];this['channels'][_0x5eb81e[_0xd629('0x8a')]][_0x454876][_0xd629('0x63')]=_0x572512;this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]][_0x454876][_0xd629('0x43')]=_0xd629('0x64');this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]][_0x454876][_0xd629('0x56')]=_0xd629('0x85');this[_0xd629('0x8')][_0x5eb81e['transfereeuniqueid']][_0x454876]['talktime']=_0x572512[_0xd629('0x90')](this[_0xd629('0x8')][_0x5eb81e[_0xd629('0x8a')]][_0x454876][_0xd629('0x3d')],'seconds');}}}}}}catch(_0x218bde){logger[_0xd629('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x5eb81e[_0xd629('0x24')],util['inspect'](_0x218bde,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x1a')]=function(_0x313626){var _0x551041='';try{if(this[_0xd629('0x21')](_0x313626)){logger[_0xd629('0x33')](_0xd629('0x91'),_0x313626[_0xd629('0x24')],util[_0xd629('0x26')](_0x313626,{'showHidden':![],'depth':null}));if(_0x313626[_0xd629('0x92')]){_0x551041=_0x313626[_0xd629('0x92')]['substring'](0x0,_0x313626[_0xd629('0x92')][_0xd629('0x93')]('-'));if(this[_0xd629('0xb')][_0x551041]){logger[_0xd629('0x22')](_0xd629('0x94'),_0x313626[_0xd629('0x24')],_0x551041);this['agents'][_0x551041][_0xd629('0x95')]=!![];}}}}catch(_0x306947){logger[_0xd629('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x313626[_0xd629('0x24')],util[_0xd629('0x26')](_0x306947,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x1b')]=function(_0x10b202){var _0x42fa07='';try{if(this[_0xd629('0x21')](_0x10b202)){logger[_0xd629('0x33')](_0xd629('0x96'),_0x10b202['uniqueid'],util[_0xd629('0x26')](_0x10b202,{'showHidden':![],'depth':null}));if(_0x10b202[_0xd629('0x92')]){_0x42fa07=_0x10b202[_0xd629('0x92')][_0xd629('0x97')](0x0,_0x10b202[_0xd629('0x92')][_0xd629('0x93')]('-'));if(this['agents'][_0x42fa07]){logger[_0xd629('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x10b202['uniqueid'],_0x42fa07);this[_0xd629('0xb')][_0x42fa07][_0xd629('0x95')]=![];}}}}catch(_0x466a38){logger[_0xd629('0x39')](_0xd629('0x98'),_0x10b202[_0xd629('0x24')],util[_0xd629('0x26')](_0x466a38,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd629('0x1f')][_0xd629('0x89')]=function(_0x4919f8,_0xca91e1=0x2710){if(this['channels'][_0x4919f8]){setTimeout(()=>{delete this[_0xd629('0x8')][_0x4919f8];},_0xca91e1);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0017117..5e740c7 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3fe=['callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','undefined','isEmpty','getSettings','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferToInternal','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','keys','context','from-sip','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','channel','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','seconds','lastapplication','lastdata','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','calleridnum','connectedlinename','destinationchannel','UserId','membername','answertime','diff','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid'];(function(_0x42e98e,_0x164011){var _0x568bcd=function(_0x350aa4){while(--_0x350aa4){_0x42e98e['push'](_0x42e98e['shift']());}};_0x568bcd(++_0x164011);}(_0xf3fe,0x1e0));var _0xef3f=function(_0x340a3a,_0x28aebb){_0x340a3a=_0x340a3a-0x0;var _0x294444=_0xf3fe[_0x340a3a];return _0x294444;};'use strict';var _=require(_0xef3f('0x0'));var moment=require(_0xef3f('0x1'));var util=require(_0xef3f('0x2'));var path=require(_0xef3f('0x3'));var Redis=require(_0xef3f('0x4'));var config=require(_0xef3f('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0xef3f('0x6'));var Channel=require(_0xef3f('0x7'));var RpcSetting=require(_0xef3f('0x8'));var applications=[_0xef3f('0x9'),'queue',_0xef3f('0xa'),_0xef3f('0xb'),_0xef3f('0xc'),_0xef3f('0xd')];var dispositions=['NO\x20ANSWER',_0xef3f('0xe'),_0xef3f('0xe'),_0xef3f('0xf'),_0xef3f('0xf'),_0xef3f('0xf'),_0xef3f('0x10'),_0xef3f('0x11'),_0xef3f('0xe'),'FAILED',_0xef3f('0xe')];config[_0xef3f('0x12')]=_[_0xef3f('0x13')](config['redis'],{'host':_0xef3f('0x14'),'port':0x18eb});var io=require(_0xef3f('0x15'))(new Redis(config[_0xef3f('0x12')]));function VoiceCallReport(_0xef0ef8){this[_0xef3f('0x16')]=_0xef0ef8[_0xef3f('0x16')];this[_0xef3f('0x17')]=_0xef0ef8[_0xef3f('0x17')];this['blindTransfers']={};ami['on'](_0xef3f('0x18'),this[_0xef3f('0x19')][_0xef3f('0x1a')](this));ami['on'](_0xef3f('0x1b'),this[_0xef3f('0x19')][_0xef3f('0x1a')](this));ami['on'](_0xef3f('0x1c'),this[_0xef3f('0x1d')][_0xef3f('0x1a')](this));ami['on']('newstate',this[_0xef3f('0x1e')][_0xef3f('0x1a')](this));ami['on'](_0xef3f('0x1f'),this[_0xef3f('0x20')][_0xef3f('0x1a')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xef3f('0x21'),this[_0xef3f('0x22')][_0xef3f('0x1a')](this));ami['on'](_0xef3f('0x23'),this[_0xef3f('0x24')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xef3f('0x1a')](this));ami['on']('musiconholdstart',this[_0xef3f('0x25')]['bind'](this));ami['on']('musiconholdstop',this[_0xef3f('0x26')][_0xef3f('0x1a')](this));try{logger[_0xef3f('0x27')](_0xef3f('0x28'));ami[_0xef3f('0x29')]();}catch(_0x498fb9){logger[_0xef3f('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0xef3f('0x2b')](_0x498fb9,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xef3f('0x2c')]=function(_0x56bf03){return _0x56bf03!==null&&!_[_0xef3f('0x2d')](_0x56bf03);};VoiceCallReport[_0xef3f('0x2e')][_0xef3f('0x2f')]=function(_0x1fa791,_0x492c17,_0x54557){io['to'](_0x1fa791)[_0xef3f('0x2f')](_0x492c17,_0x54557);};VoiceCallReport[_0xef3f('0x2e')]['syncNewCallerId']=function(_0x59ac52){try{if(this[_0xef3f('0x2c')](_0x59ac52)){logger[_0xef3f('0x27')](_0xef3f('0x30'),_0x59ac52[_0xef3f('0x31')],_0x59ac52[_0xef3f('0x32')],_0x59ac52['calleridnum']);logger[_0xef3f('0x33')](_0xef3f('0x34'),_0x59ac52['uniqueid'],util[_0xef3f('0x2b')](_0x59ac52,{'showHidden':![],'depth':null}));if(_0x59ac52[_0xef3f('0x31')]===_0x59ac52['linkedid']){if(!_['isUndefined'](this[_0xef3f('0x16')][_0x59ac52['uniqueid']])){_[_0xef3f('0x35')](this[_0xef3f('0x16')][_0x59ac52['uniqueid']],_['pick'](_0x59ac52,_[_0xef3f('0x36')](this[_0xef3f('0x16')][_0x59ac52[_0xef3f('0x31')]])));}}if(_0x59ac52[_0xef3f('0x37')]===_0xef3f('0x38')){var _0x49b84e=this[_0xef3f('0x17')][_0x59ac52['channel'][_0xef3f('0x39')]('-')[0x0]];if(_0x49b84e){if(_0x59ac52['exten']==_0xef3f('0x3a')){_0x49b84e[_0xef3f('0x3b')]=_0x59ac52[_0xef3f('0x3c')];this[_0xef3f('0x2f')](util[_0xef3f('0x3d')]('user:%s',_0x49b84e[_0xef3f('0x3e')]),_0xef3f('0x3f'),{'id':_0x49b84e['id'],'destaccountcode':_0x49b84e[_0xef3f('0x40')],'destconnectedlinenum':_0x59ac52[_0xef3f('0x3c')]});}}}}}catch(_0x357a03){logger[_0xef3f('0x2a')](_0xef3f('0x41'),_0x59ac52[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x357a03,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xef3f('0x2e')][_0xef3f('0x1d')]=function(_0x1c07ed){try{if(this['isNotNull'](_0x1c07ed)){logger[_0xef3f('0x33')](_0xef3f('0x42'),_0x1c07ed['uniqueid'],util[_0xef3f('0x2b')](_0x1c07ed,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c07ed['uniqueid']]){return;}if(_0x1c07ed['channel']==='OutgoingSpoolFailed'){return;}if(_0x1c07ed[_0xef3f('0x31')]!==_0x1c07ed[_0xef3f('0x43')]&&!this[_0xef3f('0x44')][_0x1c07ed[_0xef3f('0x43')]]){return;}logger[_0xef3f('0x27')](_0xef3f('0x45'),_0x1c07ed[_0xef3f('0x31')],_0x1c07ed[_0xef3f('0x37')],_0x1c07ed[_0xef3f('0x46')]);this['channels'][_0x1c07ed['uniqueid']]=new Channel();this[_0xef3f('0x16')][_0x1c07ed['uniqueid']][_0xef3f('0x47')]=moment()[_0xef3f('0x3d')](_0xef3f('0x48'));this[_0xef3f('0x16')][_0x1c07ed[_0xef3f('0x31')]][_0xef3f('0x49')]=dispositions[_[_0xef3f('0x4a')](_0x1c07ed[_0xef3f('0x4b')])];_[_0xef3f('0x35')](this['channels'][_0x1c07ed['uniqueid']],_[_0xef3f('0x4c')](_0x1c07ed,_['keys'](this[_0xef3f('0x16')][_0x1c07ed['uniqueid']])));if(_0x1c07ed['context']==='from-sip'){var _0x314877=this[_0xef3f('0x17')][_0x1c07ed[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]];if(_0x314877&&typeof _0x314877[_0xef3f('0x3b')]==='undefined'){_0x314877[_0xef3f('0x3b')]=_0x1c07ed[_0xef3f('0x46')];logger[_0xef3f('0x33')](_0xef3f('0x4e'),_0x1c07ed[_0xef3f('0x31')],util[_0xef3f('0x2b')]({'id':_0x314877['id'],'destaccountcode':_0x314877[_0xef3f('0x40')],'destconnectedlinenum':_0x1c07ed['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0xef3f('0x3d')]('user:%s',_0x314877[_0xef3f('0x3e')]),_0xef3f('0x3f'),{'id':_0x314877['id'],'destaccountcode':_0x314877[_0xef3f('0x40')],'destconnectedlinenum':_0x1c07ed[_0xef3f('0x46')]});}}}}catch(_0x325cfb){logger['error'](_0xef3f('0x4f'),_0x1c07ed[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x325cfb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xef3f('0x2e')][_0xef3f('0x19')]=function(_0x4b3153){try{if(this['isNotNull'](_0x4b3153)){logger[_0xef3f('0x33')]('[%s][voiceCallReport][newexten]\x20event:',_0x4b3153[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x4b3153,{'showHidden':![],'depth':null}));if(_0x4b3153[_0xef3f('0x4d')]==='OutgoingSpoolFailed'||_0x4b3153['exten']==='h')return;if(_0x4b3153[_0xef3f('0x31')]===_0x4b3153[_0xef3f('0x43')]||this[_0xef3f('0x44')][_0x4b3153[_0xef3f('0x43')]]){_0x4b3153[_0xef3f('0x50')]=_0x4b3153[_0xef3f('0x50')]?_0x4b3153['application'][_0xef3f('0x51')]():undefined;_0x4b3153[_0xef3f('0x52')]=_0x4b3153[_0xef3f('0x53')]||_0x4b3153[_0xef3f('0x52')];if(_0x4b3153[_0xef3f('0x53')]&&_0x4b3153[_0xef3f('0x50')]!==_0xef3f('0x54')){_0x4b3153[_0xef3f('0x52')]=_0x4b3153[_0xef3f('0x52')]['toLowerCase']();}logger[_0xef3f('0x27')](_0xef3f('0x55'),_0x4b3153[_0xef3f('0x31')],_0x4b3153['application'],_0x4b3153[_0xef3f('0x52')]);if(_[_0xef3f('0x2d')](this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]])){this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]]=new Channel();this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]][_0xef3f('0x47')]=_0x4b3153['duration']?moment()[_0xef3f('0x56')](moment['duration'](_0x4b3153['duration'])[_0xef3f('0x57')](),_0xef3f('0x57'))['format'](_0xef3f('0x48')):moment()[_0xef3f('0x3d')](_0xef3f('0x48'));this['channels'][_0x4b3153[_0xef3f('0x31')]]['disposition']='NO\x20ANSWER';}_['merge'](this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]],_[_0xef3f('0x4c')](_0x4b3153,_[_0xef3f('0x36')](this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]])));if(_['includes'](applications,_0x4b3153[_0xef3f('0x50')])){this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]][_0xef3f('0x58')]=_0x4b3153['application'];this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]][_0xef3f('0x59')]=_0x4b3153[_0xef3f('0x52')];if(_0x4b3153[_0xef3f('0x50')]==='set'&&_['startsWith'](_0x4b3153[_0xef3f('0x52')]['toLowerCase'](),'cdr(')){var _0x7a5489=_0x4b3153[_0xef3f('0x52')][_0xef3f('0x39')]('=');var _0x24149e=_0x7a5489[0x0][_0xef3f('0x51')]()[_0xef3f('0x5a')](/cdr\((.*)\)/);if(_0x24149e){if(_0x24149e[0x1]===_0xef3f('0x5b')&&!_[_0xef3f('0x5c')](this['channels'][_0x4b3153[_0xef3f('0x31')]][_0x24149e[0x1]]))return;this[_0xef3f('0x16')][_0x4b3153[_0xef3f('0x31')]][_0x24149e[0x1]]=_0x7a5489[0x1];}}else if(_0x4b3153[_0xef3f('0x50')]==='queue'){this['channels'][_0x4b3153[_0xef3f('0x31')]][_0xef3f('0x54')]=_0x4b3153[_0xef3f('0x52')][_0xef3f('0x39')](',')[0x0];}}}}}catch(_0x43bf31){logger[_0xef3f('0x2a')](_0xef3f('0x5d'),_0x4b3153[_0xef3f('0x31')],util['inspect'](_0x43bf31,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xef3f('0x2e')][_0xef3f('0x1e')]=function(_0x23e8b){try{if(this['isNotNull'](_0x23e8b)){logger[_0xef3f('0x27')](_0xef3f('0x5e'),_0x23e8b[_0xef3f('0x31')],_0x23e8b[_0xef3f('0x43')],_0x23e8b['calleridname'],_0x23e8b['calleridnum']);logger[_0xef3f('0x33')](_0xef3f('0x5f'),_0x23e8b[_0xef3f('0x31')],util['inspect'](_0x23e8b,{'showHidden':![],'depth':null}));if(_0x23e8b['channelstate']!=='6')return;var _0x7e3d30=this['agents'][_0x23e8b[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]];if(_0x23e8b[_0xef3f('0x31')]!==_0x23e8b[_0xef3f('0x43')]){var _0x104bcd=moment();if(this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]]){if(!this[_0xef3f('0x16')][_0x23e8b['linkedid']][_0xef3f('0x60')]){this[_0xef3f('0x16')][_0x23e8b['linkedid']]['answered']=!![];this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]]['answertime']=_0x104bcd['format'](_0xef3f('0x48'));if(this['channels'][_0x23e8b[_0xef3f('0x43')]]['starttime']){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x61')]=_0x104bcd['diff'](this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x47')],_0xef3f('0x57'));}}this['channels'][_0x23e8b[_0xef3f('0x43')]]['linkedid']=_0x23e8b['uniqueid'];if(_0x23e8b['calleridnum']!==_0xef3f('0x3a')){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]]['connectedlinenum']=_0x23e8b[_0xef3f('0x62')];}this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x63')]=_0x23e8b[_0xef3f('0x32')];this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x64')]=_0x23e8b[_0xef3f('0x4d')];this['channels'][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x49')]=dispositions[_['toNumber'](_0x23e8b[_0xef3f('0x4b')])];if(_0x7e3d30){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x65')]=_0x7e3d30['id'];this['channels'][_0x23e8b[_0xef3f('0x43')]][_0xef3f('0x66')]=_0x7e3d30[_0xef3f('0x3e')];}}if(this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]]){if(!this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x60')]){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x60')]=!![];this['channels'][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x67')]=_0x104bcd[_0xef3f('0x3d')](_0xef3f('0x48'));if(this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x47')]){this[_0xef3f('0x16')][_0x23e8b['uniqueid']]['holdtime']=_0x104bcd[_0xef3f('0x68')](this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x47')],'seconds');}}if(_0x23e8b['calleridnum']!=='xcally-motion-preview'){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]]['connectedlinenum']=_0x23e8b[_0xef3f('0x62')];}this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x63')]=_0x23e8b['calleridname'];this[_0xef3f('0x16')][_0x23e8b['uniqueid']]['destinationchannel']=_0x23e8b[_0xef3f('0x4d')];this['channels'][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x49')]=dispositions[_['toNumber'](_0x23e8b[_0xef3f('0x4b')])];}}else{if(this['channels'][_0x23e8b['uniqueid']]){if(_0x7e3d30){this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]]['UserId']=_0x7e3d30['id'];this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x66')]=_0x7e3d30[_0xef3f('0x3e')];}}}if(_0x23e8b[_0xef3f('0x37')]===_0xef3f('0x38')){if(_0x7e3d30){_0x7e3d30['destconnectedlinenum']=_0x23e8b[_0xef3f('0x46')];var _0x3469f1;if(this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]]){_0x3469f1=this[_0xef3f('0x16')][_0x23e8b[_0xef3f('0x31')]][_0xef3f('0x54')];}else if(this['channels'][_0x23e8b['linkedid']]){_0x3469f1=this[_0xef3f('0x16')][_0x23e8b['linkedid']][_0xef3f('0x54')];}_0x7e3d30[_0xef3f('0x54')]=_0x3469f1;var _0x3efbd0={'id':_0x7e3d30['id'],'name':_0x7e3d30[_0xef3f('0x3e')],'agentconnected':!![],'destaccountcode':_0x7e3d30[_0xef3f('0x40')],'destconnectedlinenum':_0x23e8b[_0xef3f('0x46')],'queue':_0x3469f1||undefined,'uniqueid':_0x23e8b[_0xef3f('0x43')]};logger[_0xef3f('0x33')](_0xef3f('0x69'),_0x23e8b[_0xef3f('0x31')],util['inspect'](_0x3efbd0,{'showHidden':![],'depth':null}));this[_0xef3f('0x2f')](util[_0xef3f('0x3d')](_0xef3f('0x6a'),_0x7e3d30[_0xef3f('0x3e')]),'user:agentconnect',_0x3efbd0);}}}}catch(_0x115041){logger[_0xef3f('0x2a')](_0xef3f('0x6b'),_0x23e8b[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x115041,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xef3f('0x6c')]=function(_0x22deb2,_0x1d3b64){try{if(this[_0xef3f('0x16')][_0x22deb2]){logger['info'](_0xef3f('0x6d'),_0x22deb2,_0x1d3b64);this[_0xef3f('0x16')][_0x22deb2][_0xef3f('0x6e')]=!![];if(_[_0xef3f('0x6f')](_0x1d3b64,_0xef3f('0x70'))){_0x1d3b64=_0x1d3b64[_0xef3f('0x71')](_0xef3f('0x70'),_0xef3f('0x72'));}this[_0xef3f('0x16')][_0x22deb2][_0xef3f('0x73')]=_0x1d3b64;var _0x493355=_[_0xef3f('0x74')](this[_0xef3f('0x16')][_0x22deb2]['monitors'],{'filename':_0x1d3b64});if(_[_0xef3f('0x5c')](_0x493355)){this['channels'][_0x22deb2][_0xef3f('0x75')]['push']({'filename':_0x1d3b64,'createdAt':moment()[_0xef3f('0x3d')](_0xef3f('0x48')),'mixmonitorid':'','status':_0xef3f('0x76')});}}}catch(_0x55bcc4){logger[_0xef3f('0x2a')](_0xef3f('0x77'),_0x22deb2,util[_0xef3f('0x2b')](_0x55bcc4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x199898){try{if(this[_0xef3f('0x2c')](_0x199898)){logger[_0xef3f('0x33')](_0xef3f('0x78'),_0x199898[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x199898,{'showHidden':![],'depth':null}));if(this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]]&&_0x199898['channel']!=_0xef3f('0x79')){if(this[_0xef3f('0x2c')](_0x199898[_0xef3f('0x7a')])){if(this[_0xef3f('0x2c')](_0x199898['variable'][_0xef3f('0x7b')])){logger['info'](_0xef3f('0x7c'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this['syncMixMonitorFilename'](_0x199898[_0xef3f('0x31')],_0x199898['value']);}else if(this[_0xef3f('0x2c')](_0x199898['variable'][_0xef3f('0x7e')])){logger['info'](_0xef3f('0x7f'),_0x199898['uniqueid'],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]][_0xef3f('0x62')]=_0x199898['value'];}else if(this['isNotNull'](_0x199898[_0xef3f('0x7a')][_0xef3f('0x80')])){logger[_0xef3f('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this['channels'][_0x199898[_0xef3f('0x31')]][_0xef3f('0x81')]=_0x199898['value'];}else if(this[_0xef3f('0x2c')](_0x199898[_0xef3f('0x7a')][_0xef3f('0x82')])){logger['info'](_0xef3f('0x83'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]]['type']=_0x199898[_0xef3f('0x7d')];}else if(this['isNotNull'](_0x199898[_0xef3f('0x7a')][_0xef3f('0x84')])){logger['info'](_0xef3f('0x85'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')][_0xef3f('0x39')](',')[0x0]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]][_0xef3f('0x54')]=_0x199898[_0xef3f('0x7d')][_0xef3f('0x39')](',')[0x0];}else if(this[_0xef3f('0x2c')](_0x199898[_0xef3f('0x7a')]['xmd-originatecalleridnum'])){logger[_0xef3f('0x27')](_0xef3f('0x86'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]][_0xef3f('0x87')]=_0x199898[_0xef3f('0x7d')];}else if(this[_0xef3f('0x2c')](_0x199898[_0xef3f('0x7a')][_0xef3f('0x88')])){logger[_0xef3f('0x27')](_0xef3f('0x89'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898['uniqueid']]['destination']=_0x199898['value'];}else if(this['isNotNull'](_0x199898[_0xef3f('0x7a')]['xmd-callerid-preview'])){logger[_0xef3f('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x199898['uniqueid'],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]]['calleridpreview']=_0x199898[_0xef3f('0x7d')];}else if(this[_0xef3f('0x2c')](_0x199898['variable'][_0xef3f('0x8a')])){logger[_0xef3f('0x27')](_0xef3f('0x8b'),_0x199898[_0xef3f('0x31')],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x31')]][_0xef3f('0x54')]=_0x199898[_0xef3f('0x7d')];}else if(this['isNotNull'](_0x199898[_0xef3f('0x7a')]['sipcallid'])){logger['info'](_0xef3f('0x8c'),_0x199898['uniqueid'],_0x199898[_0xef3f('0x7d')]);this[_0xef3f('0x16')][_0x199898['uniqueid']][_0xef3f('0x8d')]=_0x199898[_0xef3f('0x7d')];}}}else if(this['isNotNull'](_0x199898[_0xef3f('0x7a')][_0xef3f('0x7b')])){if(_0x199898['value']){var _0xa734f2=path[_0xef3f('0x8e')](_0x199898[_0xef3f('0x7d')])[_0xef3f('0x3e')];logger[_0xef3f('0x27')](_0xef3f('0x7c'),_0xa734f2,_0x199898[_0xef3f('0x7d')]);this['syncMixMonitorFilename'](_0xa734f2,_0x199898[_0xef3f('0x7d')]);}}else if(this[_0xef3f('0x16')][_0x199898[_0xef3f('0x43')]]){if(this['isNotNull'](_0x199898[_0xef3f('0x7a')])){if(this[_0xef3f('0x2c')](_0x199898[_0xef3f('0x7a')][_0xef3f('0x8f')])){logger[_0xef3f('0x27')](_0xef3f('0x8c'),_0x199898[_0xef3f('0x43')],_0x199898['value']);this[_0xef3f('0x16')][_0x199898[_0xef3f('0x43')]][_0xef3f('0x90')]=_0x199898['value'];}}}}}catch(_0xa217d5){logger['error'](_0xef3f('0x91'),_0x199898[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0xa217d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xef3f('0x2e')][_0xef3f('0x92')]=function(_0x236b7f){try{if(this[_0xef3f('0x2c')](_0x236b7f)){logger['debug'](_0xef3f('0x93'),_0x236b7f[_0xef3f('0x31')],util[_0xef3f('0x2b')](_0x236b7f,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]]){if(this[_0xef3f('0x16')][this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]]['linkedid']]){this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f['linkedid']][_0xef3f('0x43')]]['uniqueid']=_0x236b7f[_0xef3f('0x31')];this['channels'][this[_0xef3f('0x44')][_0x236b7f['linkedid']][_0xef3f('0x43')]]['answered']=this['channels'][_0x236b7f[_0xef3f('0x31')]][_0xef3f('0x60')];this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f['linkedid']][_0xef3f('0x43')]][_0xef3f('0x67')]=this[_0xef3f('0x16')][_0x236b7f['uniqueid']][_0xef3f('0x67')];this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x43')]][_0xef3f('0x64')]=this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x43')]][_0xef3f('0x4d')];this['channels'][this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x43')]][_0xef3f('0x49')]=this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]][_0xef3f('0x49')];this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]=this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x43')]];this['deleteChannelAfterTimeout'](this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x43')]);}else if(this['channels'][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]]){this['channels'][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]]['uniqueid']][_0xef3f('0x31')]=[this[_0xef3f('0x16')][this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]]['uniqueid']][_0xef3f('0x43')],this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]][_0xef3f('0x43')]=this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f['linkedid']][_0xef3f('0x31')]][_0xef3f('0x31')]][0x0];this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]]['uniqueid']][_0xef3f('0x60')]=this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]['answered'];this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]]['answertime']=this[_0xef3f('0x16')][_0x236b7f['uniqueid']]['answertime'];this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]]['uniqueid']]['destinationchannel']=this[_0xef3f('0x16')][this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]]['channel'];this[_0xef3f('0x16')][this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]][_0xef3f('0x49')]=this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]['disposition'];this['channels'][_0x236b7f[_0xef3f('0x31')]]=this[_0xef3f('0x16')][this['blindTransfers'][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]];this[_0xef3f('0x94')](this[_0xef3f('0x44')][_0x236b7f[_0xef3f('0x43')]][_0xef3f('0x31')]);}}if(this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]){logger[_0xef3f('0x27')](_0xef3f('0x95'),_0x236b7f[_0xef3f('0x31')],_0x236b7f[_0xef3f('0x96')]);var _0x57df8c=moment();this['channels'][_0x236b7f[_0xef3f('0x31')]][_0xef3f('0x97')]=_0x57df8c[_0xef3f('0x3d')](_0xef3f('0x48'));this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]['duration']=_0x57df8c[_0xef3f('0x68')](this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]][_0xef3f('0x47')],'seconds');if(this[_0xef3f('0x16')][_0x236b7f['uniqueid']][_0xef3f('0x60')]){this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]['billableseconds']=_0x57df8c['diff'](this[_0xef3f('0x16')][_0x236b7f['uniqueid']]['answertime'],_0xef3f('0x57'));this['channels'][_0x236b7f['uniqueid']][_0xef3f('0x61')]=this[_0xef3f('0x16')][_0x236b7f[_0xef3f('0x31')]]['duration']-this['channels'][_0x236b7f['uniqueid']][_0xef3f('0x98')];}if(_0x236b7f['context']===_0xef3f('0x38')){if(this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]]){this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')]['split']('-')[0x0]]=_[_0xef3f('0x99')](this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]],[_0xef3f('0x3b')]);logger[_0xef3f('0x33')](_0xef3f('0x9a'),_0x236b7f['uniqueid'],util[_0xef3f('0x2b')]({'id':this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]][_0xef3f('0x40')]},{'showHidden':![],'depth':null}));this[_0xef3f('0x2f')](util[_0xef3f('0x3d')](_0xef3f('0x6a'),this['agents'][_0x236b7f[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]]['name']),_0xef3f('0x9b'),{'id':this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')][_0xef3f('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xef3f('0x17')][_0x236b7f[_0xef3f('0x4d')]['split']('-')[0x0]][_0xef3f('0x40')]});for(var _0x2d8640=0x0;_0x2d8640{delete this[_0xef3f('0x16')][_0xa26599];},_0x53ce52);}};module[_0xef3f('0xca')]=VoiceCallReport; \ No newline at end of file +var _0x94b7=['OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','destinationchannel','UserId','membername','answertime','connectedlinename','from-sip','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','endtime','billableseconds','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','monitors','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','BLIND','transfererchannel','transfereruniqueid','BlindTransfer','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','pick','keys','context','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','user:agentconnect','accountcode','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]'];(function(_0x46807d,_0x5998fd){var _0x32bace=function(_0x4bdd38){while(--_0x4bdd38){_0x46807d['push'](_0x46807d['shift']());}};_0x32bace(++_0x5998fd);}(_0x94b7,0x136));var _0x794b=function(_0x3e8e5d,_0x394f33){_0x3e8e5d=_0x3e8e5d-0x0;var _0x1f0902=_0x94b7[_0x3e8e5d];return _0x1f0902;};'use strict';var _=require(_0x794b('0x0'));var moment=require('moment');var util=require(_0x794b('0x1'));var path=require(_0x794b('0x2'));var Redis=require(_0x794b('0x3'));var config=require('../../../config/environment');var logger=require(_0x794b('0x4'))(_0x794b('0x5'));var ami=require(_0x794b('0x6'));var Channel=require(_0x794b('0x7'));var RpcSetting=require(_0x794b('0x8'));var applications=[_0x794b('0x9'),_0x794b('0xa'),_0x794b('0xb'),_0x794b('0xc'),'playback',_0x794b('0xd')];var dispositions=[_0x794b('0xe'),_0x794b('0xf'),_0x794b('0xf'),'NO\x20ANSWER',_0x794b('0xe'),_0x794b('0xe'),_0x794b('0x10'),'BUSY',_0x794b('0xf'),_0x794b('0xf'),'FAILED'];config[_0x794b('0x11')]=_[_0x794b('0x12')](config[_0x794b('0x11')],{'host':_0x794b('0x13'),'port':0x18eb});var io=require(_0x794b('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0x248f2d){this[_0x794b('0x15')]=_0x248f2d[_0x794b('0x15')];this['agents']=_0x248f2d[_0x794b('0x16')];this[_0x794b('0x17')]={};ami['on'](_0x794b('0x18'),this[_0x794b('0x19')][_0x794b('0x1a')](this));ami['on'](_0x794b('0x1b'),this[_0x794b('0x19')][_0x794b('0x1a')](this));ami['on'](_0x794b('0x1c'),this[_0x794b('0x1d')][_0x794b('0x1a')](this));ami['on'](_0x794b('0x1e'),this[_0x794b('0x1f')]['bind'](this));ami['on'](_0x794b('0x20'),this[_0x794b('0x21')][_0x794b('0x1a')](this));ami['on']('hangup',this[_0x794b('0x22')]['bind'](this));ami['on'](_0x794b('0x23'),this[_0x794b('0x24')][_0x794b('0x1a')](this));ami['on']('attendedtransfer',this[_0x794b('0x25')][_0x794b('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x794b('0x26'),this[_0x794b('0x27')][_0x794b('0x1a')](this));ami['on'](_0x794b('0x28'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x794b('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x794b('0x2a')]();}catch(_0x304d38){logger[_0x794b('0x2b')](_0x794b('0x2c'),util['inspect'](_0x304d38,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x794b('0x2d')][_0x794b('0x2e')]=function(_0x14018b){return _0x14018b!==null&&!_[_0x794b('0x2f')](_0x14018b);};VoiceCallReport[_0x794b('0x2d')][_0x794b('0x30')]=function(_0x26a77a,_0x746b5c,_0x3779db){io['to'](_0x26a77a)[_0x794b('0x30')](_0x746b5c,_0x3779db);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x2fbb93){try{if(this[_0x794b('0x2e')](_0x2fbb93)){logger[_0x794b('0x29')](_0x794b('0x31'),_0x2fbb93[_0x794b('0x32')],_0x2fbb93['calleridname'],_0x2fbb93[_0x794b('0x33')]);logger[_0x794b('0x34')](_0x794b('0x35'),_0x2fbb93[_0x794b('0x32')],util[_0x794b('0x36')](_0x2fbb93,{'showHidden':![],'depth':null}));if(_0x2fbb93[_0x794b('0x32')]===_0x2fbb93[_0x794b('0x37')]){if(!_[_0x794b('0x2f')](this[_0x794b('0x15')][_0x2fbb93[_0x794b('0x32')]])){_['merge'](this[_0x794b('0x15')][_0x2fbb93[_0x794b('0x32')]],_[_0x794b('0x38')](_0x2fbb93,_[_0x794b('0x39')](this[_0x794b('0x15')][_0x2fbb93[_0x794b('0x32')]])));}}if(_0x2fbb93[_0x794b('0x3a')]==='from-sip'){var _0x98061a=this[_0x794b('0x16')][_0x2fbb93['channel']['split']('-')[0x0]];if(_0x98061a){if(_0x2fbb93[_0x794b('0x3b')]==_0x794b('0x3c')){_0x98061a[_0x794b('0x3d')]=_0x2fbb93[_0x794b('0x3e')];this[_0x794b('0x30')](util['format'](_0x794b('0x3f'),_0x98061a['name']),_0x794b('0x40'),{'id':_0x98061a['id'],'destaccountcode':_0x98061a[_0x794b('0x41')],'destconnectedlinenum':_0x2fbb93['connectedlinenum']});}}}}}catch(_0x5c85b1){logger['error']('[%s][voiceCallReport][newcallerid]',_0x2fbb93[_0x794b('0x32')],util['inspect'](_0x5c85b1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')][_0x794b('0x1d')]=function(_0x202883){try{if(this['isNotNull'](_0x202883)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x202883[_0x794b('0x32')],util[_0x794b('0x36')](_0x202883,{'showHidden':![],'depth':null}));if(this['channels'][_0x202883[_0x794b('0x32')]]){return;}if(_0x202883[_0x794b('0x42')]==='OutgoingSpoolFailed'){return;}if(_0x202883['uniqueid']!==_0x202883[_0x794b('0x37')]&&!this[_0x794b('0x17')][_0x202883[_0x794b('0x37')]]){return;}logger[_0x794b('0x29')](_0x794b('0x43'),_0x202883['uniqueid'],_0x202883[_0x794b('0x3a')],_0x202883[_0x794b('0x3b')]);this[_0x794b('0x15')][_0x202883[_0x794b('0x32')]]=new Channel();this[_0x794b('0x15')][_0x202883[_0x794b('0x32')]][_0x794b('0x44')]=moment()[_0x794b('0x45')](_0x794b('0x46'));this[_0x794b('0x15')][_0x202883[_0x794b('0x32')]][_0x794b('0x47')]=dispositions[_[_0x794b('0x48')](_0x202883[_0x794b('0x49')])];_[_0x794b('0x4a')](this[_0x794b('0x15')][_0x202883[_0x794b('0x32')]],_[_0x794b('0x38')](_0x202883,_[_0x794b('0x39')](this['channels'][_0x202883[_0x794b('0x32')]])));if(_0x202883[_0x794b('0x3a')]==='from-sip'){var _0x54e6bb=this[_0x794b('0x16')][_0x202883[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]];if(_0x54e6bb&&typeof _0x54e6bb[_0x794b('0x3d')]===_0x794b('0x4c')){_0x54e6bb['destconnectedlinenum']=_0x202883['exten'];logger[_0x794b('0x34')](_0x794b('0x4d'),_0x202883[_0x794b('0x32')],util[_0x794b('0x36')]({'id':_0x54e6bb['id'],'destaccountcode':_0x54e6bb[_0x794b('0x41')],'destconnectedlinenum':_0x202883[_0x794b('0x3b')]},{'showHidden':![],'depth':null}));this[_0x794b('0x30')](util[_0x794b('0x45')](_0x794b('0x3f'),_0x54e6bb[_0x794b('0x4e')]),_0x794b('0x40'),{'id':_0x54e6bb['id'],'destaccountcode':_0x54e6bb[_0x794b('0x41')],'destconnectedlinenum':_0x202883[_0x794b('0x3b')]});}}}}catch(_0x21584d){logger[_0x794b('0x2b')](_0x794b('0x4f'),_0x202883[_0x794b('0x32')],util['inspect'](_0x21584d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')]['syncNewExten']=function(_0x3c7d65){try{if(this[_0x794b('0x2e')](_0x3c7d65)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x3c7d65[_0x794b('0x32')],util[_0x794b('0x36')](_0x3c7d65,{'showHidden':![],'depth':null}));if(_0x3c7d65[_0x794b('0x42')]===_0x794b('0x50')||_0x3c7d65[_0x794b('0x3b')]==='h')return;if(_0x3c7d65[_0x794b('0x32')]===_0x3c7d65[_0x794b('0x37')]||this[_0x794b('0x17')][_0x3c7d65[_0x794b('0x37')]]){_0x3c7d65[_0x794b('0x51')]=_0x3c7d65[_0x794b('0x51')]?_0x3c7d65[_0x794b('0x51')][_0x794b('0x52')]():undefined;_0x3c7d65[_0x794b('0x53')]=_0x3c7d65[_0x794b('0x54')]||_0x3c7d65[_0x794b('0x53')];if(_0x3c7d65[_0x794b('0x54')]&&_0x3c7d65[_0x794b('0x51')]!==_0x794b('0xa')){_0x3c7d65[_0x794b('0x53')]=_0x3c7d65['applicationdata'][_0x794b('0x52')]();}logger['info'](_0x794b('0x55'),_0x3c7d65[_0x794b('0x32')],_0x3c7d65[_0x794b('0x51')],_0x3c7d65[_0x794b('0x53')]);if(_['isUndefined'](this[_0x794b('0x15')][_0x3c7d65['uniqueid']])){this[_0x794b('0x15')][_0x3c7d65['uniqueid']]=new Channel();this[_0x794b('0x15')][_0x3c7d65['uniqueid']][_0x794b('0x44')]=_0x3c7d65['duration']?moment()[_0x794b('0x56')](moment[_0x794b('0x57')](_0x3c7d65[_0x794b('0x57')])[_0x794b('0x58')](),_0x794b('0x58'))['format'](_0x794b('0x46')):moment()[_0x794b('0x45')](_0x794b('0x46'));this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]]['disposition']='NO\x20ANSWER';}_[_0x794b('0x4a')](this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]],_['pick'](_0x3c7d65,_['keys'](this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]])));if(_[_0x794b('0x59')](applications,_0x3c7d65['application'])){this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]][_0x794b('0x5a')]=_0x3c7d65[_0x794b('0x51')];this[_0x794b('0x15')][_0x3c7d65['uniqueid']][_0x794b('0x5b')]=_0x3c7d65[_0x794b('0x53')];if(_0x3c7d65[_0x794b('0x51')]===_0x794b('0x9')&&_[_0x794b('0x5c')](_0x3c7d65[_0x794b('0x53')][_0x794b('0x52')](),_0x794b('0x5d'))){var _0x57ca51=_0x3c7d65[_0x794b('0x53')][_0x794b('0x4b')]('=');var _0x3820a0=_0x57ca51[0x0][_0x794b('0x52')]()[_0x794b('0x5e')](/cdr\((.*)\)/);if(_0x3820a0){if(_0x3820a0[0x1]===_0x794b('0x5f')&&!_[_0x794b('0x60')](this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]][_0x3820a0[0x1]]))return;this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]][_0x3820a0[0x1]]=_0x57ca51[0x1];}}else if(_0x3c7d65[_0x794b('0x51')]===_0x794b('0xa')){this[_0x794b('0x15')][_0x3c7d65[_0x794b('0x32')]][_0x794b('0xa')]=_0x3c7d65[_0x794b('0x53')]['split'](',')[0x0];}}}}}catch(_0x5b6353){logger[_0x794b('0x2b')]('[%s][voiceCallReport][newexten]',_0x3c7d65[_0x794b('0x32')],util[_0x794b('0x36')](_0x5b6353,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')][_0x794b('0x1f')]=function(_0x1dfb29){try{if(this[_0x794b('0x2e')](_0x1dfb29)){logger[_0x794b('0x29')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1dfb29[_0x794b('0x32')],_0x1dfb29['linkedid'],_0x1dfb29[_0x794b('0x61')],_0x1dfb29[_0x794b('0x33')]);logger['debug'](_0x794b('0x62'),_0x1dfb29[_0x794b('0x32')],util[_0x794b('0x36')](_0x1dfb29,{'showHidden':![],'depth':null}));if(_0x1dfb29[_0x794b('0x49')]!=='6')return;var _0x196e05=this[_0x794b('0x16')][_0x1dfb29['channel'][_0x794b('0x4b')]('-')[0x0]];if(_0x1dfb29['uniqueid']!==_0x1dfb29[_0x794b('0x37')]){var _0x33fb46=moment();if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]){if(!this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x63')]){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x63')]=!![];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]['answertime']=_0x33fb46[_0x794b('0x45')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x44')]){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x64')]=_0x33fb46[_0x794b('0x65')](this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]['starttime'],'seconds');}}this[_0x794b('0x15')][_0x1dfb29['linkedid']][_0x794b('0x37')]=_0x1dfb29[_0x794b('0x32')];if(_0x1dfb29['calleridnum']!=='xcally-motion-preview'){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]['connectedlinenum']=_0x1dfb29['calleridnum'];}this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]['connectedlinename']=_0x1dfb29[_0x794b('0x61')];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x66')]=_0x1dfb29[_0x794b('0x42')];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x47')]=dispositions[_['toNumber'](_0x1dfb29[_0x794b('0x49')])];if(_0x196e05){this['channels'][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x67')]=_0x196e05['id'];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0x68')]=_0x196e05[_0x794b('0x4e')];}}if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]]){if(!this['channels'][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x63')]){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x63')]=!![];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x69')]=_0x33fb46['format'](_0x794b('0x46'));if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x44')]){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x64')]=_0x33fb46[_0x794b('0x65')](this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x44')],_0x794b('0x58'));}}if(_0x1dfb29[_0x794b('0x33')]!==_0x794b('0x3c')){this[_0x794b('0x15')][_0x1dfb29['uniqueid']]['connectedlinenum']=_0x1dfb29[_0x794b('0x33')];}this['channels'][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x6a')]=_0x1dfb29[_0x794b('0x61')];this['channels'][_0x1dfb29[_0x794b('0x32')]]['destinationchannel']=_0x1dfb29[_0x794b('0x42')];this['channels'][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x47')]=dispositions[_[_0x794b('0x48')](_0x1dfb29[_0x794b('0x49')])];}}else{if(this[_0x794b('0x15')][_0x1dfb29['uniqueid']]){if(_0x196e05){this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x67')]=_0x196e05['id'];this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0x68')]=_0x196e05[_0x794b('0x4e')];}}}if(_0x1dfb29[_0x794b('0x3a')]===_0x794b('0x6b')){if(_0x196e05){_0x196e05[_0x794b('0x3d')]=_0x1dfb29[_0x794b('0x3b')];var _0x2629f9;if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]]){_0x2629f9=this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x32')]][_0x794b('0xa')];}else if(this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]]){_0x2629f9=this[_0x794b('0x15')][_0x1dfb29[_0x794b('0x37')]][_0x794b('0xa')];}_0x196e05['queue']=_0x2629f9;var _0x25592a={'id':_0x196e05['id'],'name':_0x196e05[_0x794b('0x4e')],'agentconnected':!![],'destaccountcode':_0x196e05[_0x794b('0x41')],'destconnectedlinenum':_0x1dfb29[_0x794b('0x3b')],'queue':_0x2629f9||undefined,'uniqueid':_0x1dfb29[_0x794b('0x37')]};logger[_0x794b('0x34')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1dfb29[_0x794b('0x32')],util[_0x794b('0x36')](_0x25592a,{'showHidden':![],'depth':null}));this[_0x794b('0x30')](util[_0x794b('0x45')]('user:%s',_0x196e05[_0x794b('0x4e')]),_0x794b('0x40'),_0x25592a);}}}}catch(_0x1c1d4b){logger[_0x794b('0x2b')](_0x794b('0x6c'),_0x1dfb29['uniqueid'],util[_0x794b('0x36')](_0x1c1d4b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')]['syncMixMonitorFilename']=function(_0x227302,_0x4a9db6){try{if(this[_0x794b('0x15')][_0x227302]){logger[_0x794b('0x29')](_0x794b('0x6d'),_0x227302,_0x4a9db6);this[_0x794b('0x15')][_0x227302][_0x794b('0x6e')]=!![];if(_[_0x794b('0x6f')](_0x4a9db6,'.wav49')){_0x4a9db6=_0x4a9db6[_0x794b('0x70')](_0x794b('0x71'),_0x794b('0x72'));}this['channels'][_0x227302][_0x794b('0x73')]=_0x4a9db6;var _0x922aae=_[_0x794b('0x74')](this[_0x794b('0x15')][_0x227302]['monitors'],{'filename':_0x4a9db6});if(_['isNil'](_0x922aae)){this[_0x794b('0x15')][_0x227302]['monitors'][_0x794b('0x75')]({'filename':_0x4a9db6,'createdAt':moment()[_0x794b('0x45')](_0x794b('0x46')),'mixmonitorid':'','status':_0x794b('0x76')});}}}catch(_0x16b763){logger[_0x794b('0x2b')](_0x794b('0x77'),_0x227302,util[_0x794b('0x36')](_0x16b763,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')]['syncVarSet']=function(_0x47cf3e){try{if(this['isNotNull'](_0x47cf3e)){logger[_0x794b('0x34')](_0x794b('0x78'),_0x47cf3e[_0x794b('0x32')],util['inspect'](_0x47cf3e,{'showHidden':![],'depth':null}));if(this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]]&&_0x47cf3e[_0x794b('0x42')]!=_0x794b('0x50')){if(this[_0x794b('0x2e')](_0x47cf3e[_0x794b('0x79')])){if(this['isNotNull'](_0x47cf3e[_0x794b('0x79')][_0x794b('0x7a')])){logger[_0x794b('0x29')](_0x794b('0x7b'),_0x47cf3e[_0x794b('0x32')],_0x47cf3e['value']);this['syncMixMonitorFilename'](_0x47cf3e[_0x794b('0x32')],_0x47cf3e[_0x794b('0x7c')]);}else if(this[_0x794b('0x2e')](_0x47cf3e[_0x794b('0x79')]['xmd-phone'])){logger[_0x794b('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x47cf3e[_0x794b('0x32')],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x33')]=_0x47cf3e[_0x794b('0x7c')];}else if(this['isNotNull'](_0x47cf3e[_0x794b('0x79')][_0x794b('0x7d')])){logger[_0x794b('0x29')](_0x794b('0x7e'),_0x47cf3e[_0x794b('0x32')],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x7f')]=_0x47cf3e[_0x794b('0x7c')];}else if(this['isNotNull'](_0x47cf3e[_0x794b('0x79')][_0x794b('0x80')])){logger[_0x794b('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x47cf3e[_0x794b('0x32')],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x5f')]=_0x47cf3e[_0x794b('0x7c')];}else if(this[_0x794b('0x2e')](_0x47cf3e['variable'][_0x794b('0x81')])){logger['info'](_0x794b('0x82'),_0x47cf3e[_0x794b('0x32')],_0x47cf3e['value'][_0x794b('0x4b')](',')[0x0]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]]['queue']=_0x47cf3e[_0x794b('0x7c')][_0x794b('0x4b')](',')[0x0];}else if(this[_0x794b('0x2e')](_0x47cf3e['variable']['xmd-originatecalleridnum'])){logger[_0x794b('0x29')](_0x794b('0x83'),_0x47cf3e['uniqueid'],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]]['originatecalleridnum']=_0x47cf3e['value'];}else if(this[_0x794b('0x2e')](_0x47cf3e[_0x794b('0x79')][_0x794b('0x84')])){logger[_0x794b('0x29')](_0x794b('0x85'),_0x47cf3e['uniqueid'],_0x47cf3e['value']);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x86')]=_0x47cf3e['value'];}else if(this['isNotNull'](_0x47cf3e['variable']['xmd-callerid-preview'])){logger[_0x794b('0x29')](_0x794b('0x87'),_0x47cf3e[_0x794b('0x32')],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x88')]=_0x47cf3e[_0x794b('0x7c')];}else if(this[_0x794b('0x2e')](_0x47cf3e['variable'][_0x794b('0x89')])){logger['info'](_0x794b('0x8a'),_0x47cf3e[_0x794b('0x32')],_0x47cf3e['value']);this[_0x794b('0x15')][_0x47cf3e['uniqueid']][_0x794b('0xa')]=_0x47cf3e[_0x794b('0x7c')];}else if(this[_0x794b('0x2e')](_0x47cf3e[_0x794b('0x79')][_0x794b('0x8b')])){logger[_0x794b('0x29')](_0x794b('0x8c'),_0x47cf3e['uniqueid'],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x32')]][_0x794b('0x8d')]=_0x47cf3e[_0x794b('0x7c')];}}}else if(this[_0x794b('0x2e')](_0x47cf3e[_0x794b('0x79')][_0x794b('0x7a')])){if(_0x47cf3e[_0x794b('0x7c')]){var _0x475106=path[_0x794b('0x8e')](_0x47cf3e[_0x794b('0x7c')])[_0x794b('0x4e')];logger[_0x794b('0x29')](_0x794b('0x7b'),_0x475106,_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x8f')](_0x475106,_0x47cf3e[_0x794b('0x7c')]);}}else if(this[_0x794b('0x15')][_0x47cf3e['linkedid']]){if(this['isNotNull'](_0x47cf3e[_0x794b('0x79')])){if(this['isNotNull'](_0x47cf3e['variable'][_0x794b('0x8b')])){logger['info'](_0x794b('0x8c'),_0x47cf3e[_0x794b('0x37')],_0x47cf3e[_0x794b('0x7c')]);this[_0x794b('0x15')][_0x47cf3e[_0x794b('0x37')]][_0x794b('0x90')]=_0x47cf3e[_0x794b('0x7c')];}}}}}catch(_0x411269){logger[_0x794b('0x2b')]('[%s][voiceCallReport][varset]',_0x47cf3e[_0x794b('0x32')],util['inspect'](_0x411269,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x794b('0x2d')]['syncHangup']=function(_0x52a70d){try{if(this['isNotNull'](_0x52a70d)){logger[_0x794b('0x34')](_0x794b('0x91'),_0x52a70d[_0x794b('0x32')],util[_0x794b('0x36')](_0x52a70d,{'showHidden':![],'depth':null}));if(this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]){if(this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['linkedid']]){this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['linkedid']]['uniqueid']=_0x52a70d['uniqueid'];this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x37')]][_0x794b('0x63')]=this[_0x794b('0x15')][_0x52a70d['uniqueid']][_0x794b('0x63')];this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['linkedid']][_0x794b('0x69')]=this['channels'][_0x52a70d[_0x794b('0x32')]][_0x794b('0x69')];this[_0x794b('0x15')][this['blindTransfers'][_0x52a70d[_0x794b('0x37')]][_0x794b('0x37')]][_0x794b('0x66')]=this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['linkedid']][_0x794b('0x42')];this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x37')]][_0x794b('0x47')]=this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]]['disposition'];this['channels'][_0x52a70d['uniqueid']]=this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x37')]];this[_0x794b('0x92')](this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['linkedid']);}else if(this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d['linkedid']][_0x794b('0x32')]]){this['channels'][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x32')]=[this['channels'][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x37')],this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x37')]=this['channels'][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x32')]][0x0];this['channels'][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x63')]=this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]][_0x794b('0x63')];this['channels'][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]]['uniqueid']][_0x794b('0x69')]=this[_0x794b('0x15')][_0x52a70d['uniqueid']][_0x794b('0x69')];this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d['linkedid']][_0x794b('0x32')]][_0x794b('0x66')]=this[_0x794b('0x15')][this['blindTransfers'][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]]['channel'];this[_0x794b('0x15')][this[_0x794b('0x17')][_0x52a70d[_0x794b('0x37')]][_0x794b('0x32')]][_0x794b('0x47')]=this[_0x794b('0x15')][_0x52a70d['uniqueid']]['disposition'];this['channels'][_0x52a70d[_0x794b('0x32')]]=this['channels'][this[_0x794b('0x17')][_0x52a70d['linkedid']][_0x794b('0x32')]];this[_0x794b('0x92')](this[_0x794b('0x17')][_0x52a70d['linkedid']][_0x794b('0x32')]);}}if(this[_0x794b('0x15')][_0x52a70d['uniqueid']]){logger[_0x794b('0x29')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x52a70d[_0x794b('0x32')],_0x52a70d['cause-txt']);var _0x41f761=moment();this['channels'][_0x52a70d[_0x794b('0x32')]][_0x794b('0x93')]=_0x41f761[_0x794b('0x45')](_0x794b('0x46'));this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]][_0x794b('0x57')]=_0x41f761[_0x794b('0x65')](this['channels'][_0x52a70d[_0x794b('0x32')]][_0x794b('0x44')],_0x794b('0x58'));if(this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]][_0x794b('0x63')]){this['channels'][_0x52a70d[_0x794b('0x32')]][_0x794b('0x94')]=_0x41f761[_0x794b('0x65')](this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]][_0x794b('0x69')],'seconds');this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]][_0x794b('0x64')]=this['channels'][_0x52a70d[_0x794b('0x32')]][_0x794b('0x57')]-this[_0x794b('0x15')][_0x52a70d[_0x794b('0x32')]]['billableseconds'];}if(_0x52a70d[_0x794b('0x3a')]===_0x794b('0x6b')){if(this['agents'][_0x52a70d[_0x794b('0x42')]['split']('-')[0x0]]){this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]]=_[_0x794b('0x95')](this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]],[_0x794b('0x3d')]);logger[_0x794b('0x34')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x52a70d[_0x794b('0x32')],util[_0x794b('0x36')]({'id':this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x52a70d[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]][_0x794b('0x41')]},{'showHidden':![],'depth':null}));this[_0x794b('0x30')](util['format']('user:%s',this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]][_0x794b('0x4e')]),_0x794b('0x96'),{'id':this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x794b('0x16')][_0x52a70d[_0x794b('0x42')][_0x794b('0x4b')]('-')[0x0]][_0x794b('0x41')]});for(var _0x35a21d=0x0;_0x35a21d{delete this['channels'][_0x372186];},_0x580c4b);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 9a0d85b..d12c8c2 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31fa=['applications','variables','syncDialBegin','dialend','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','inspect','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','emit','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberpenalty','memberrealtime','isUndefined','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','endtime','diff','starttime','complete','total','answered','holdtime','seconds','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','application','toLowerCase','appdata','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceDialReport][newexten]','deleteChannelAfterTimeout','exports','lodash','moment','util','ioredis','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound'];(function(_0x27ccfa,_0x4885d1){var _0x2f4f2=function(_0x2463ff){while(--_0x2463ff){_0x27ccfa['push'](_0x27ccfa['shift']());}};_0x2f4f2(++_0x4885d1);}(_0x31fa,0x1a6));var _0xa31f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x31fa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xa31f('0x0'));var moment=require(_0xa31f('0x1'));var util=require(_0xa31f('0x2'));var Redis=require(_0xa31f('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xa31f('0x4')]=_[_0xa31f('0x5')](config[_0xa31f('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa31f('0x6'))(new Redis(config['redis']));function VoiceDialReport(_0x250e0d){this[_0xa31f('0x7')]=_0x250e0d[_0xa31f('0x8')];this[_0xa31f('0x9')]=_0x250e0d[_0xa31f('0x9')];this[_0xa31f('0xa')]={};this[_0xa31f('0xb')]={};ami['on']('dialbegin',this[_0xa31f('0xc')]['bind'](this));ami['on'](_0xa31f('0xd'),this['syncDialEnd'][_0xa31f('0xe')](this));ami['on'](_0xa31f('0xf'),this[_0xa31f('0x10')][_0xa31f('0xe')](this));ami['on']('hangup',this[_0xa31f('0x11')][_0xa31f('0xe')](this));}VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x13')]=function(_0x149c4b){return _0x149c4b!==null&&!_['isUndefined'](_0x149c4b);};VoiceDialReport['prototype']['emit']=function(_0x1a9ea4,_0x2c1f77,_0x30a74f){io['to'](_0x1a9ea4)['emit'](_0x2c1f77,_0x30a74f);};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0xc')]=function(_0x4dc336){try{if(this[_0xa31f('0x13')](_0x4dc336)){logger['debug'](_0xa31f('0x14'),_0x4dc336['uniqueid'],util['inspect'](_0x4dc336,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dc336[_0xa31f('0x15')]]){_['merge'](this['channels'][_0x4dc336[_0xa31f('0x15')]],{'starttime':moment()[_0xa31f('0x16')](_0xa31f('0x17')),'lastevent':'called','interface':_0x4dc336['channel']['substring'](0x0,_0x4dc336[_0xa31f('0x18')][_0xa31f('0x19')]('-')),'membername':_0x4dc336[_0xa31f('0x18')][_0xa31f('0x1a')](_0x4dc336[_0xa31f('0x18')][_0xa31f('0x19')]('/')+0x1,_0x4dc336[_0xa31f('0x18')]['lastIndexOf']('-'))},_[_0xa31f('0x1b')](_0x4dc336,[_0xa31f('0x1c'),_0xa31f('0x1d')]));logger[_0xa31f('0x1e')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4dc336[_0xa31f('0x15')],this[_0xa31f('0x7')][_0x4dc336['uniqueid']][_0xa31f('0x1f')],this[_0xa31f('0x7')][_0x4dc336[_0xa31f('0x15')]][_0xa31f('0x20')]);logger['debug'](_0xa31f('0x21'),_0x4dc336[_0xa31f('0x15')],util['inspect'](this[_0xa31f('0x7')][_0x4dc336[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));if(this[_0xa31f('0xa')][_0x4dc336[_0xa31f('0x15')]])_[_0xa31f('0x22')](this[_0xa31f('0x7')][_0x4dc336[_0xa31f('0x15')]],this[_0xa31f('0xa')][_0x4dc336['uniqueid']]);this['emit'](_0xa31f('0x23'),_0xa31f('0x24'),this[_0xa31f('0x7')][_0x4dc336['uniqueid']]);logger[_0xa31f('0x25')](_0xa31f('0x26'),_0x4dc336[_0xa31f('0x15')],util['inspect'](this[_0xa31f('0x7')][_0x4dc336[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa31f('0x27'),this['channels'][_0x4dc336[_0xa31f('0x15')]]);}}}catch(_0xbf6536){logger[_0xa31f('0x28')](_0xa31f('0x29'),_0x4dc336[_0xa31f('0x15')],util[_0xa31f('0x2a')](_0xbf6536,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa31f('0x12')]['syncDialEnd']=function(_0x2773dc){try{if(this['isNotNull'](_0x2773dc)){logger[_0xa31f('0x25')]('[%s][voiceDialReport][dialend]\x20event:',_0x2773dc['uniqueid'],util[_0xa31f('0x2a')](_0x2773dc,{'showHidden':![],'depth':null}));if(this['channels'][_0x2773dc['uniqueid']]){this['channels'][_0x2773dc['uniqueid']][_0xa31f('0x2b')]=_0x2773dc[_0xa31f('0x2b')];if(_0x2773dc[_0xa31f('0x2b')]===_0xa31f('0x2c')){this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]][_0xa31f('0x2d')]=_0x2773dc[_0xa31f('0x2d')];this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]]['connectedlinename']=_0x2773dc['connectedlinename'];this[_0xa31f('0x7')][_0x2773dc['uniqueid']][_0xa31f('0x2e')]=moment()['format'](_0xa31f('0x17'));this['channels'][_0x2773dc[_0xa31f('0x15')]][_0xa31f('0x2f')]=_0xa31f('0x30');logger[_0xa31f('0x1e')](_0xa31f('0x31'),_0x2773dc[_0xa31f('0x15')],_0x2773dc['channel'][_0xa31f('0x1a')](_0x2773dc['channel'][_0xa31f('0x19')]('/')+0x1,_0x2773dc[_0xa31f('0x18')][_0xa31f('0x19')]('-')));logger[_0xa31f('0x25')](_0xa31f('0x32'),_0x2773dc[_0xa31f('0x15')],util[_0xa31f('0x2a')](this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));ami[_0xa31f('0x33')]('custom:dialconnect',this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]]);}logger[_0xa31f('0x25')](_0xa31f('0x34'),_0x2773dc[_0xa31f('0x15')],util[_0xa31f('0x2a')](this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));this[_0xa31f('0x33')](_0xa31f('0x23'),_0xa31f('0x24'),this[_0xa31f('0x7')][_0x2773dc[_0xa31f('0x15')]]);}}}catch(_0x2b63c5){logger[_0xa31f('0x28')]('[%s][voiceDialReport][dialend]',_0x2773dc[_0xa31f('0x15')],util['inspect'](_0x2b63c5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x10')]=function(_0x3aae24){try{if(this[_0xa31f('0x13')](_0x3aae24)){logger[_0xa31f('0x25')]('[%s][voiceDialReport][varset]\x20event:',_0x3aae24[_0xa31f('0x15')],util[_0xa31f('0x2a')](_0x3aae24,{'showHidden':![],'depth':null}));this[_0xa31f('0x35')](_0x3aae24[_0xa31f('0x15')],_['keys'](_0x3aae24[_0xa31f('0x36')])[0x0],_0x3aae24[_0xa31f('0x37')]);if(this[_0xa31f('0x13')](_0x3aae24[_0xa31f('0x36')])&&this[_0xa31f('0x13')](_0x3aae24['variable'][_0xa31f('0x38')])){if(_['isUndefined'](this[_0xa31f('0x7')][_0x3aae24[_0xa31f('0x15')]])){this[_0xa31f('0x7')][_0x3aae24[_0xa31f('0x15')]]={'routeId':_0x3aae24['value'],'variables':this[_0xa31f('0xb')][_0x3aae24['uniqueid']],'motionChannel':_0xa31f('0x39')};logger[_0xa31f('0x1e')](_0xa31f('0x3a'),_0x3aae24['uniqueid'],_0x3aae24[_0xa31f('0x36')][_0xa31f('0x38')],_[_0xa31f('0x3b')](_0x3aae24[_0xa31f('0x36')])[0x0],_0x3aae24[_0xa31f('0x37')]);logger[_0xa31f('0x25')](_0xa31f('0x3c'),_0x3aae24[_0xa31f('0x15')],util[_0xa31f('0x2a')](this['channels'][_0x3aae24['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa31f('0x33')](_0xa31f('0x23'),_0xa31f('0x24'),this[_0xa31f('0x7')][_0x3aae24[_0xa31f('0x15')]]);}}}}catch(_0x24b2ed){logger[_0xa31f('0x28')]('[%s][voiceDialReport][varset]',_0x3aae24[_0xa31f('0x15')],util[_0xa31f('0x2a')](_0x24b2ed,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x35')]=function(_0x271a5f,_0xd06e49,_0xbaf499){var _0x167c06=[_0xa31f('0x3d'),_0xa31f('0x3e'),_0xa31f('0x3f'),_0xa31f('0x40'),_0xa31f('0x41'),_0xa31f('0x42'),_0xa31f('0x43'),_0xa31f('0x44'),_0xa31f('0x45'),_0xa31f('0x46'),_0xa31f('0x47'),'bridgepvtcallid','membercalls',_0xa31f('0x48'),'memberinterface','memberlastcall',_0xa31f('0x1f'),_0xa31f('0x49'),_0xa31f('0x4a')];if(!_['isNil'](_0xd06e49)&&!_['includes'](_0x167c06,_0xd06e49)){if(_[_0xa31f('0x4b')](this[_0xa31f('0xb')][_0x271a5f])){this['variables'][_0x271a5f]={};}this[_0xa31f('0xb')][_0x271a5f][_0xd06e49]=_0xbaf499;}};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x11')]=function(_0x231b22){try{if(this[_0xa31f('0x13')](_0x231b22)){logger[_0xa31f('0x25')](_0xa31f('0x4c'),_0x231b22[_0xa31f('0x15')],util['inspect'](_0x231b22,{'showHidden':![],'depth':null}));if(this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]]){logger[_0xa31f('0x1e')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x231b22[_0xa31f('0x15')],_0x231b22[_0xa31f('0x4d')]);this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]]['endtime']=moment()[_0xa31f('0x16')](_0xa31f('0x17'));this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x4e')]=moment(this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x4f')])[_0xa31f('0x50')](this['channels'][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x51')],'seconds');this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x2f')]=_0xa31f('0x52');this[_0xa31f('0x9')][_0xa31f('0x53')]+=0x1;if(this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x2e')]){this['outbound'][_0xa31f('0x54')]+=0x1;this['channels'][_0x231b22['uniqueid']][_0xa31f('0x55')]=moment(this[_0xa31f('0x7')][_0x231b22['uniqueid']][_0xa31f('0x2e')])['diff'](this[_0xa31f('0x7')][_0x231b22['uniqueid']][_0xa31f('0x51')],_0xa31f('0x56'));this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x57')]=moment(this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x4f')])[_0xa31f('0x50')](this['channels'][_0x231b22['uniqueid']][_0xa31f('0x2e')],_0xa31f('0x56'));this[_0xa31f('0x9')][_0xa31f('0x58')]+=this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x55')]||0x0;this[_0xa31f('0x9')]['sumBillable']+=this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x57')];}this[_0xa31f('0x9')][_0xa31f('0x59')]+=this['channels'][_0x231b22[_0xa31f('0x15')]][_0xa31f('0x4e')];logger[_0xa31f('0x25')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x231b22['uniqueid'],util[_0xa31f('0x2a')](this['channels'][_0x231b22[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));ami[_0xa31f('0x33')](_0xa31f('0x5a'),this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]]);logger[_0xa31f('0x25')](_0xa31f('0x5b'),_0x231b22['uniqueid'],util[_0xa31f('0x2a')](this['channels'][_0x231b22['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa31f('0x33')]('custom:dialend',this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]]);logger[_0xa31f('0x25')](_0xa31f('0x5c'),_0x231b22[_0xa31f('0x15')],util[_0xa31f('0x2a')](this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0xa31f('0x23'),_0xa31f('0x5d'),this[_0xa31f('0x9')]);logger[_0xa31f('0x1e')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x231b22['uniqueid']]));logger[_0xa31f('0x25')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x231b22[_0xa31f('0x15')],util[_0xa31f('0x2a')](this[_0xa31f('0x7')][_0x231b22['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa31f('0x33')](_0xa31f('0x23'),_0xa31f('0x5e'),this[_0xa31f('0x7')][_0x231b22['uniqueid']]);this['deleteChannelAfterTimeout'](_0x231b22[_0xa31f('0x15')]);}else if(this[_0xa31f('0x7')][_0x231b22[_0xa31f('0x5f')]]){this[_0xa31f('0x7')][_0x231b22['linkedid']]['uniqueid']=this[_0xa31f('0x7')][_0x231b22['linkedid']]['destuniqueid'];}if(this[_0xa31f('0xb')][_0x231b22['uniqueid']]){delete this['variables'][_0x231b22[_0xa31f('0x15')]];}}}catch(_0x3371ba){logger[_0xa31f('0x28')](_0xa31f('0x60'),_0x231b22[_0xa31f('0x15')],util['inspect'](_0x3371ba,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x61')]=function(_0x216ae5){try{if(this[_0xa31f('0x13')](_0x216ae5)){logger[_0xa31f('0x25')]('[%s][voiceDialReport][newexten]\x20event:',_0x216ae5['uniqueid'],util[_0xa31f('0x2a')](_0x216ae5,{'showHidden':![],'depth':null}));if(_0x216ae5[_0xa31f('0x62')][_0xa31f('0x63')]()==='set'){_0x216ae5['applicationdata']=(_0x216ae5[_0xa31f('0x64')]||_0x216ae5[_0xa31f('0x65')])[_0xa31f('0x63')]();if(_['startsWith'](_0x216ae5[_0xa31f('0x65')],_0xa31f('0x66'))){if(_[_0xa31f('0x4b')](this['applications'][_0x216ae5['uniqueid']]))this[_0xa31f('0xa')][_0x216ae5[_0xa31f('0x15')]]={};logger['info'](_0xa31f('0x67'),_0x216ae5[_0xa31f('0x15')],_0x216ae5[_0xa31f('0x62')],_0x216ae5[_0xa31f('0x65')]);var _0x48945c=_0x216ae5['applicationdata'][_0xa31f('0x68')]('=');var _0xb80f51=_0x48945c[0x0]['match'](/cdr\((.*)\)/);if(_0xb80f51)this[_0xa31f('0xa')][_0x216ae5[_0xa31f('0x15')]][_0xb80f51[0x1]]=_0x48945c[0x1];}}}}catch(_0x3825dc){logger[_0xa31f('0x28')](_0xa31f('0x69'),_0x216ae5[_0xa31f('0x15')],util['inspect'](_0x3825dc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa31f('0x12')][_0xa31f('0x6a')]=function(_0x1e9076,_0x41334e=0x2710){if(this[_0xa31f('0x7')][_0x1e9076]){setTimeout(()=>{delete this[_0xa31f('0x7')][_0x1e9076];},_0x41334e);}};module[_0xa31f('0x6b')]=VoiceDialReport; \ No newline at end of file +var _0xd84c=['outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','called','substring','lastIndexOf','channel','omit','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','applications','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','YYYY-MM-DD\x20HH:mm:ss','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','variables','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','starttime','lastevent','total','answered','seconds','billableseconds','diff','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xd84c,0x13e));var _0xcd84=function(_0x14ef9e,_0x149ffa){_0x14ef9e=_0x14ef9e-0x0;var _0x2f999e=_0xd84c[_0x14ef9e];return _0x2f999e;};'use strict';var _=require(_0xcd84('0x0'));var moment=require(_0xcd84('0x1'));var util=require(_0xcd84('0x2'));var Redis=require(_0xcd84('0x3'));var config=require(_0xcd84('0x4'));var logger=require(_0xcd84('0x5'))(_0xcd84('0x6'));var ami=require(_0xcd84('0x7'));config[_0xcd84('0x8')]=_[_0xcd84('0x9')](config[_0xcd84('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcd84('0xa'))(new Redis(config[_0xcd84('0x8')]));function VoiceDialReport(_0xdcb87f){this[_0xcd84('0xb')]=_0xdcb87f[_0xcd84('0xc')];this[_0xcd84('0xd')]=_0xdcb87f['outbound'];this['applications']={};this['variables']={};ami['on'](_0xcd84('0xe'),this[_0xcd84('0xf')][_0xcd84('0x10')](this));ami['on'](_0xcd84('0x11'),this[_0xcd84('0x12')][_0xcd84('0x10')](this));ami['on']('varset',this[_0xcd84('0x13')]['bind'](this));ami['on']('hangup',this[_0xcd84('0x14')][_0xcd84('0x10')](this));}VoiceDialReport['prototype'][_0xcd84('0x15')]=function(_0xf1b02d){return _0xf1b02d!==null&&!_[_0xcd84('0x16')](_0xf1b02d);};VoiceDialReport[_0xcd84('0x17')][_0xcd84('0x18')]=function(_0x55724a,_0x5b9586,_0x407a0f){io['to'](_0x55724a)[_0xcd84('0x18')](_0x5b9586,_0x407a0f);};VoiceDialReport[_0xcd84('0x17')][_0xcd84('0xf')]=function(_0x23b175){try{if(this[_0xcd84('0x15')](_0x23b175)){logger[_0xcd84('0x19')](_0xcd84('0x1a'),_0x23b175[_0xcd84('0x1b')],util['inspect'](_0x23b175,{'showHidden':![],'depth':null}));if(this[_0xcd84('0xb')][_0x23b175['uniqueid']]){_[_0xcd84('0x1c')](this['channels'][_0x23b175[_0xcd84('0x1b')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xcd84('0x1d'),'interface':_0x23b175['channel'][_0xcd84('0x1e')](0x0,_0x23b175['channel'][_0xcd84('0x1f')]('-')),'membername':_0x23b175[_0xcd84('0x20')][_0xcd84('0x1e')](_0x23b175[_0xcd84('0x20')][_0xcd84('0x1f')]('/')+0x1,_0x23b175[_0xcd84('0x20')][_0xcd84('0x1f')]('-'))},_[_0xcd84('0x21')](_0x23b175,['event',_0xcd84('0x22')]));logger['info'](_0xcd84('0x23'),_0x23b175[_0xcd84('0x1b')],this[_0xcd84('0xb')][_0x23b175[_0xcd84('0x1b')]][_0xcd84('0x24')],this[_0xcd84('0xb')][_0x23b175[_0xcd84('0x1b')]]['interface']);logger['debug'](_0xcd84('0x25'),_0x23b175[_0xcd84('0x1b')],util[_0xcd84('0x26')](this['channels'][_0x23b175[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0xcd84('0x27')][_0x23b175['uniqueid']])_['merge'](this['channels'][_0x23b175[_0xcd84('0x1b')]],this[_0xcd84('0x27')][_0x23b175[_0xcd84('0x1b')]]);this[_0xcd84('0x18')]('voice:outbound',_0xcd84('0x28'),this[_0xcd84('0xb')][_0x23b175[_0xcd84('0x1b')]]);logger[_0xcd84('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x23b175[_0xcd84('0x1b')],util['inspect'](this[_0xcd84('0xb')][_0x23b175['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xcd84('0x18')](_0xcd84('0x29'),this[_0xcd84('0xb')][_0x23b175[_0xcd84('0x1b')]]);}}}catch(_0x3db75b){logger[_0xcd84('0x2a')]('[%s][voiceDialReport][dialbegin]',_0x23b175[_0xcd84('0x1b')],util[_0xcd84('0x26')](_0x3db75b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd84('0x17')]['syncDialEnd']=function(_0x296b8d){try{if(this[_0xcd84('0x15')](_0x296b8d)){logger['debug'](_0xcd84('0x2b'),_0x296b8d[_0xcd84('0x1b')],util[_0xcd84('0x26')](_0x296b8d,{'showHidden':![],'depth':null}));if(this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]]){this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]][_0xcd84('0x2c')]=_0x296b8d[_0xcd84('0x2c')];if(_0x296b8d[_0xcd84('0x2c')]===_0xcd84('0x2d')){this['channels'][_0x296b8d[_0xcd84('0x1b')]][_0xcd84('0x2e')]=_0x296b8d['connectedlinenum'];this['channels'][_0x296b8d[_0xcd84('0x1b')]][_0xcd84('0x2f')]=_0x296b8d[_0xcd84('0x2f')];this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]][_0xcd84('0x30')]=moment()[_0xcd84('0x31')](_0xcd84('0x32'));this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]]['lastevent']='connect';logger[_0xcd84('0x33')](_0xcd84('0x34'),_0x296b8d[_0xcd84('0x1b')],_0x296b8d['channel'][_0xcd84('0x1e')](_0x296b8d[_0xcd84('0x20')][_0xcd84('0x1f')]('/')+0x1,_0x296b8d['channel'][_0xcd84('0x1f')]('-')));logger[_0xcd84('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x296b8d['uniqueid'],util[_0xcd84('0x26')](this['channels'][_0x296b8d[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]]);}logger['debug'](_0xcd84('0x35'),_0x296b8d[_0xcd84('0x1b')],util[_0xcd84('0x26')](this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));this[_0xcd84('0x18')]('voice:outbound',_0xcd84('0x28'),this[_0xcd84('0xb')][_0x296b8d[_0xcd84('0x1b')]]);}}}catch(_0x1cf43e){logger[_0xcd84('0x2a')]('[%s][voiceDialReport][dialend]',_0x296b8d[_0xcd84('0x1b')],util['inspect'](_0x1cf43e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd84('0x17')][_0xcd84('0x13')]=function(_0x57adad){try{if(this['isNotNull'](_0x57adad)){logger[_0xcd84('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x57adad['uniqueid'],util[_0xcd84('0x26')](_0x57adad,{'showHidden':![],'depth':null}));this[_0xcd84('0x36')](_0x57adad[_0xcd84('0x1b')],_['keys'](_0x57adad[_0xcd84('0x37')])[0x0],_0x57adad[_0xcd84('0x38')]);if(this[_0xcd84('0x15')](_0x57adad[_0xcd84('0x37')])&&this[_0xcd84('0x15')](_0x57adad['variable']['outboundrouteid'])){if(_[_0xcd84('0x16')](this[_0xcd84('0xb')][_0x57adad[_0xcd84('0x1b')]])){this[_0xcd84('0xb')][_0x57adad[_0xcd84('0x1b')]]={'routeId':_0x57adad['value'],'variables':this['variables'][_0x57adad[_0xcd84('0x1b')]],'motionChannel':'voice'};logger[_0xcd84('0x33')](_0xcd84('0x39'),_0x57adad[_0xcd84('0x1b')],_0x57adad['variable'][_0xcd84('0x3a')],_[_0xcd84('0x3b')](_0x57adad[_0xcd84('0x37')])[0x0],_0x57adad['value']);logger[_0xcd84('0x19')](_0xcd84('0x3c'),_0x57adad[_0xcd84('0x1b')],util[_0xcd84('0x26')](this[_0xcd84('0xb')][_0x57adad[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));this[_0xcd84('0x18')](_0xcd84('0x3d'),_0xcd84('0x28'),this[_0xcd84('0xb')][_0x57adad[_0xcd84('0x1b')]]);}}}}catch(_0xfb9fe0){logger['error'](_0xcd84('0x3e'),_0x57adad[_0xcd84('0x1b')],util['inspect'](_0xfb9fe0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xcd84('0x36')]=function(_0x374584,_0x5d4394,_0x5e6ab6){var _0x3842b8=['rtpaudioqos','rtpaudioqosbridged',_0xcd84('0x3f'),'rtpaudioqosjitterbridged',_0xcd84('0x40'),'rtpaudioqoslossbridged',_0xcd84('0x41'),'rtpaudioqosrttbridged',_0xcd84('0x42'),_0xcd84('0x43'),_0xcd84('0x44'),_0xcd84('0x45'),'membercalls','memberdynamic',_0xcd84('0x46'),_0xcd84('0x47'),_0xcd84('0x24'),_0xcd84('0x48'),_0xcd84('0x49')];if(!_['isNil'](_0x5d4394)&&!_[_0xcd84('0x4a')](_0x3842b8,_0x5d4394)){if(_[_0xcd84('0x16')](this['variables'][_0x374584])){this[_0xcd84('0x4b')][_0x374584]={};}this[_0xcd84('0x4b')][_0x374584][_0x5d4394]=_0x5e6ab6;}};VoiceDialReport['prototype']['syncHangup']=function(_0x579fab){try{if(this[_0xcd84('0x15')](_0x579fab)){logger[_0xcd84('0x19')](_0xcd84('0x4c'),_0x579fab[_0xcd84('0x1b')],util[_0xcd84('0x26')](_0x579fab,{'showHidden':![],'depth':null}));if(this[_0xcd84('0xb')][_0x579fab['uniqueid']]){logger[_0xcd84('0x33')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x579fab[_0xcd84('0x1b')],_0x579fab[_0xcd84('0x4d')]);this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x4e')]=moment()['format'](_0xcd84('0x32'));this[_0xcd84('0xb')][_0x579fab['uniqueid']][_0xcd84('0x4f')]=moment(this[_0xcd84('0xb')][_0x579fab['uniqueid']][_0xcd84('0x4e')])['diff'](this['channels'][_0x579fab['uniqueid']][_0xcd84('0x50')],'seconds');this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x51')]='complete';this[_0xcd84('0xd')][_0xcd84('0x52')]+=0x1;if(this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]]['answertime']){this[_0xcd84('0xd')][_0xcd84('0x53')]+=0x1;this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]]['holdtime']=moment(this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x30')])['diff'](this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x50')],_0xcd84('0x54'));this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x55')]=moment(this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x4e')])[_0xcd84('0x56')](this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x30')],_0xcd84('0x54'));this[_0xcd84('0xd')]['sumHoldTime']+=this[_0xcd84('0xb')][_0x579fab['uniqueid']][_0xcd84('0x57')]||0x0;this[_0xcd84('0xd')][_0xcd84('0x58')]+=this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x55')];}this[_0xcd84('0xd')][_0xcd84('0x59')]+=this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]][_0xcd84('0x4f')];logger[_0xcd84('0x19')](_0xcd84('0x5a'),_0x579fab[_0xcd84('0x1b')],util[_0xcd84('0x26')](this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd84('0x18')]('custom:voiceDialReport',this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]]);logger[_0xcd84('0x19')](_0xcd84('0x5b'),_0x579fab[_0xcd84('0x1b')],util[_0xcd84('0x26')](this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd84('0x18')]('custom:dialend',this['channels'][_0x579fab[_0xcd84('0x1b')]]);logger[_0xcd84('0x19')](_0xcd84('0x5c'),_0x579fab[_0xcd84('0x1b')],util['inspect'](this['channels'][_0x579fab[_0xcd84('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0xcd84('0x3d'),_0xcd84('0x5d'),this['outbound']);logger['info'](_0xcd84('0x5e'),JSON[_0xcd84('0x5f')](this['channels'][_0x579fab[_0xcd84('0x1b')]]));logger[_0xcd84('0x19')](_0xcd84('0x60'),_0x579fab[_0xcd84('0x1b')],util[_0xcd84('0x26')](this[_0xcd84('0xb')][_0x579fab['uniqueid']],{'showHidden':![],'depth':null}));this[_0xcd84('0x18')]('voice:outbound',_0xcd84('0x61'),this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x1b')]]);this[_0xcd84('0x62')](_0x579fab[_0xcd84('0x1b')]);}else if(this['channels'][_0x579fab[_0xcd84('0x63')]]){this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x63')]][_0xcd84('0x1b')]=this[_0xcd84('0xb')][_0x579fab[_0xcd84('0x63')]][_0xcd84('0x64')];}if(this[_0xcd84('0x4b')][_0x579fab['uniqueid']]){delete this['variables'][_0x579fab[_0xcd84('0x1b')]];}}}catch(_0x406f42){logger[_0xcd84('0x2a')]('[%s][voiceDialReport][hangup]',_0x579fab[_0xcd84('0x1b')],util['inspect'](_0x406f42,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x93869e){try{if(this[_0xcd84('0x15')](_0x93869e)){logger[_0xcd84('0x19')](_0xcd84('0x65'),_0x93869e[_0xcd84('0x1b')],util[_0xcd84('0x26')](_0x93869e,{'showHidden':![],'depth':null}));if(_0x93869e[_0xcd84('0x66')][_0xcd84('0x67')]()==='set'){_0x93869e[_0xcd84('0x68')]=(_0x93869e['appdata']||_0x93869e[_0xcd84('0x68')])[_0xcd84('0x67')]();if(_['startsWith'](_0x93869e[_0xcd84('0x68')],'cdr(')){if(_[_0xcd84('0x16')](this[_0xcd84('0x27')][_0x93869e[_0xcd84('0x1b')]]))this[_0xcd84('0x27')][_0x93869e['uniqueid']]={};logger[_0xcd84('0x33')](_0xcd84('0x69'),_0x93869e[_0xcd84('0x1b')],_0x93869e[_0xcd84('0x66')],_0x93869e[_0xcd84('0x68')]);var _0x146c5f=_0x93869e[_0xcd84('0x68')][_0xcd84('0x6a')]('=');var _0x373a6b=_0x146c5f[0x0][_0xcd84('0x6b')](/cdr\((.*)\)/);if(_0x373a6b)this[_0xcd84('0x27')][_0x93869e[_0xcd84('0x1b')]][_0x373a6b[0x1]]=_0x146c5f[0x1];}}}}catch(_0x3115d2){logger[_0xcd84('0x2a')](_0xcd84('0x6c'),_0x93869e[_0xcd84('0x1b')],util['inspect'](_0x3115d2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd84('0x17')]['deleteChannelAfterTimeout']=function(_0x3bb438,_0x2f89ab=0x2710){if(this[_0xcd84('0xb')][_0x3bb438]){setTimeout(()=>{delete this['channels'][_0x3bb438];},_0x2f89ab);}};module[_0xcd84('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 65a9c36..2a370ea 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5df8=['Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','prototype','syncFullyBooted','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queue','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','name','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','loopQueueSummary','isRunning','queuestatus','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','createReport','handleInboundQueueSummaryReport','assign','inbound','custom:queuesummary','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','transfer','COMPLETED','toLowerCase','local/','linkedid','queuecallerjoinAt','add','seconds','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','queuecallerexitAt','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','diff','ATTENDEDTRANSFER','COMPLETEDBYAGENT','sumDuration','milliseconds','total','answered','sumBillable','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','cause','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','applicationdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','hasOwnProperty','originated','isEmpty','talking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','isNil'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5df8,0xb0));var _0x85df=function(_0x44cbee,_0x30a63e){_0x44cbee=_0x44cbee-0x0;var _0x4ab90c=_0x5df8[_0x44cbee];return _0x4ab90c;};'use strict';var _=require(_0x85df('0x0'));var moment=require(_0x85df('0x1'));var util=require(_0x85df('0x2'));var Redis=require(_0x85df('0x3'));var config=require(_0x85df('0x4'));var logger=require(_0x85df('0x5'))('ami');var ami=require('../ami');var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x85df('0x6'));config[_0x85df('0x7')]=_[_0x85df('0x8')](config[_0x85df('0x7')],{'host':_0x85df('0x9'),'port':0x18eb});var io=require(_0x85df('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x85df('0xb')]=function(_0x461023){this[_0x85df('0xc')]=this[_0x85df('0xc')]?this['tail'][_0x85df('0xd')](_0x461023):_0x461023();};function VoiceQueueReport(_0x427ff2){this[_0x85df('0xe')]=new Sequence();this[_0x85df('0xf')]={};this[_0x85df('0x10')]=_0x427ff2;this[_0x85df('0x11')]=_0x427ff2[_0x85df('0x11')];this[_0x85df('0x12')]=_0x427ff2[_0x85df('0x13')];this[_0x85df('0x14')]=_0x427ff2[_0x85df('0x14')];this[_0x85df('0x15')]=_0x427ff2[_0x85df('0x15')];this[_0x85df('0x16')]=initializeSummary();this[_0x85df('0x17')]={};ami['on'](_0x85df('0x18'),this[_0x85df('0x19')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x1b'),this[_0x85df('0x1c')][_0x85df('0x1a')](this));ami['on']('queuemember',this[_0x85df('0x1d')]['bind'](this));ami['on'](_0x85df('0x1e'),this[_0x85df('0x1f')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x20'),this[_0x85df('0x21')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x22'),this[_0x85df('0x23')][_0x85df('0x1a')](this));ami['on']('queuecallerleave',this[_0x85df('0x24')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x25'),this[_0x85df('0x26')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x27'),this[_0x85df('0x28')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x29'),this['syncVarSet'][_0x85df('0x1a')](this));ami['on'](_0x85df('0x2a'),this[_0x85df('0x2b')]['bind'](this));ami['on'](_0x85df('0x2c'),this['syncFullyBooted']['bind'](this));ami['on']('musiconholdstart',this[_0x85df('0x2d')]['bind'](this));ami['on'](_0x85df('0x2e'),this[_0x85df('0x2f')][_0x85df('0x1a')](this));ami['on'](_0x85df('0x30'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x85df('0x31')][_0x85df('0x1a')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x565a31){if(!_['isEmpty'](_0x565a31)){for(var _0x33ffc3 in _0x565a31){if(_0x565a31[_0x85df('0x32')](_0x33ffc3)){delete _0x565a31[_0x33ffc3];}}}}function clearCampaigns(_0x51f19b){if(!_['isEmpty'](_0x51f19b)){for(var _0xcfa360 in _0x51f19b){if(_0x51f19b[_0x85df('0x32')](_0xcfa360)){_0x51f19b[_0xcfa360][_0x85df('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2a25c5){if(!_[_0x85df('0x34')](_0x2a25c5)){for(var _0x58621f in _0x2a25c5){if(_0x2a25c5[_0x85df('0x32')](_0x58621f)){_0x2a25c5[_0x58621f][_0x85df('0x33')]=0x0;_0x2a25c5[_0x58621f][_0x85df('0x35')]=0x0;_0x2a25c5[_0x58621f]['pTalking']=0x0;_0x2a25c5[_0x58621f][_0x85df('0x36')]=0x0;_0x2a25c5[_0x58621f][_0x85df('0x37')]=!![];}}}}function clearAgentBooked(_0x37f15e){if(!_[_0x85df('0x34')](_0x37f15e)){for(var _0xe3a2e3 in _0x37f15e){if(_0x37f15e[_0x85df('0x32')](_0xe3a2e3)){_0x37f15e[_0xe3a2e3][_0x85df('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x4f60ba){return _0x4f60ba[_0x85df('0x39')]||_0x4f60ba[_0x85df('0x22')]||_0x4f60ba[_0x85df('0x3a')];}VoiceQueueReport['prototype'][_0x85df('0x3b')]=function(){var _0x547a49=this;for(var _0x390d69 in this['channels']){if(this[_0x85df('0x12')][_0x85df('0x32')](_0x390d69)&&!this[_0x85df('0x12')][_0x390d69][_0x85df('0x3c')]){this[_0x85df('0xe')][_0x85df('0xb')](function(){if(!_[_0x85df('0x3d')](_0x547a49[_0x85df('0x12')][_0x390d69])){return ami[_0x85df('0x3e')]({'action':_0x85df('0x3f'),'channel':_0x547a49[_0x85df('0x12')][_0x390d69][_0x85df('0x40')]})[_0x85df('0x41')](function(_0x3e4df5){if(_0x3e4df5[_0x85df('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x547a49[_0x85df('0x12')][_0x390d69]){delete _0x547a49['channels'][_0x390d69];logger[_0x85df('0x43')](_0x85df('0x44'),_0x390d69,util[_0x85df('0x45')](_0x3e4df5,{'showHidden':![],'depth':null}));}if(_0x547a49[_0x85df('0xf')][_0x390d69]){delete _0x547a49[_0x85df('0xf')][_0x390d69];logger[_0x85df('0x43')](_0x85df('0x46'),_0x390d69,util['inspect'](_0x3e4df5,{'showHidden':![],'depth':null}));}if(_0x547a49['variables'][_0x390d69]){delete _0x547a49['variables'][_0x390d69];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x390d69,util['inspect'](_0x3e4df5,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x48')]=function(){logger[_0x85df('0x43')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x85df('0x12')]);this[_0x85df('0x49')](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x85df('0x14')]);clearCampaigns(this['campaigns']);this['summary']=initializeSummary();};VoiceQueueReport[_0x85df('0x47')]['clearQueueReport']=function(_0x1db0f0){var _0x1e857d=this;if(!_['isEmpty'](_0x1db0f0)){for(var _0x11631c in _0x1db0f0){if(_0x1db0f0[_0x85df('0x32')](_0x11631c)){_0x1e857d[_0x85df('0x4a')](_0x1db0f0[_0x11631c],_0x85df('0x4b'));delete _0x1db0f0[_0x11631c];}}}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x4c')]=function(_0x3f401c,_0x137bbe,_0x3889a2){io['to'](_0x3f401c)[_0x85df('0x4c')](_0x137bbe,_0x3889a2);};VoiceQueueReport[_0x85df('0x47')]['emitVoiceQueueChannelSave']=function(_0x30c058,_0x304aff){logger['debug'](_0x85df('0x4d')+_0x304aff+_0x85df('0x4e'),_0x30c058[_0x85df('0x4f')],util[_0x85df('0x45')](_0x30c058,{'showHidden':![],'depth':null}));this[_0x85df('0x4c')](util[_0x85df('0x50')](_0x85df('0x51'),_0x30c058['queue']),_0x85df('0x52'),_0x30c058);io['emit']('voice_queue_presence:save',_0x30c058);};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x4a')]=function(_0x2d7696,_0x2d20e6){logger[_0x85df('0x53')](_0x85df('0x4d')+_0x2d20e6+_0x85df('0x54'),_0x2d7696[_0x85df('0x4f')],util[_0x85df('0x45')](_0x2d7696,{'showHidden':![],'depth':null}));if(_0x2d7696['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x85df('0x4c')](util[_0x85df('0x50')]('voice:queue:%s',_0x2d7696[_0x85df('0x55')]),_0x85df('0x56'),_0x2d7696);io[_0x85df('0x4c')](_0x85df('0x57'),_0x2d7696);};VoiceQueueReport['prototype'][_0x85df('0x58')]=function(_0x213a27){if(_0x213a27[_0x85df('0x59')]==='inbound'){logger[_0x85df('0x53')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x85df('0x45')](_0x213a27,{'showHidden':![],'depth':null}));this[_0x85df('0x4c')](util['format'](_0x85df('0x51'),_0x213a27[_0x85df('0x5a')]),_0x85df('0x5b'),_0x213a27);}};VoiceQueueReport[_0x85df('0x47')]['isNotNull']=function(_0x559f98){return _0x559f98!==null&&!_[_0x85df('0x5c')](_0x559f98);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x1df3ad=this;setInterval(function(){_0x1df3ad[_0x85df('0x3b')]();ami[_0x85df('0x3e')]({'action':_0x85df('0x5d')})[_0x85df('0x41')](function(_0x1ee795){logger['error'](_0x85df('0x5e'),util['inspect'](_0x1ee795,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x85df('0x5f')]=function(){var _0x339fd7=this;setInterval(function(){if(!_0x339fd7[_0x85df('0x16')]['isRunning']){return ami['Action']({'action':_0x85df('0x18')})['then'](function(_0x5e3162){_0x339fd7[_0x85df('0x16')]['id']=_0x5e3162['actionid'];_0x339fd7[_0x85df('0x16')][_0x85df('0x60')]=!![];_0x339fd7[_0x85df('0x16')][_0x85df('0x61')][_0x5e3162[_0x85df('0x62')]]={};})['catch'](function(_0xccf71b){logger[_0x85df('0x43')](_0x85df('0x63'),util[_0x85df('0x45')](_0xccf71b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x64')]=function(_0x5344a7,_0x239a4d){var _0x49d02c;if(this[_0x85df('0x16')]&&this[_0x85df('0x16')][_0x85df('0x5d')]&&this[_0x85df('0x16')][_0x85df('0x5d')][_0x5344a7[_0x85df('0x5a')]]){_0x49d02c=this[_0x85df('0x16')][_0x85df('0x5d')][_0x5344a7[_0x85df('0x5a')]]['summaryEvent'];}var _0x139363=new VoiceQueueSummary(_0x5344a7);return _0x139363[_0x85df('0x65')](_0x239a4d[_0x85df('0x11')],this['agents'],_0x49d02c,this['realtime'][_0x85df('0x12')]);};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x66')]=function(_0x21c259,_0x5e52a6){var _0x288898=this[_0x85df('0x64')](_0x21c259,_0x5e52a6);var _0x1a35b8=![];_0x1a35b8=_0x288898['compareToInboundQueue'](_0x21c259);if(_0x1a35b8){Object[_0x85df('0x67')](_0x21c259,_0x288898);this[_0x85df('0x10')][_0x85df('0x14')][_0x21c259[_0x85df('0x5a')]]=_0x21c259;this['emitInboundVoiceQueueSummary'](_0x288898);}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x1f')]=function(_0x31e3d5){var _0x2db30d=null;var _0x4076c6=this['summary']['id'];if(this[_0x85df('0x16')][_0x85df('0x61')][_0x4076c6]){_0x2db30d=this['summary']['queuestatus'][_0x4076c6][_0x31e3d5[_0x85df('0x62')]];}if(!_0x2db30d){this['summary']=initializeSummary();return;}var _0x5d24a7=this[_0x85df('0x14')][_0x2db30d[_0x85df('0x55')]];if(_0x5d24a7[_0x85df('0x59')]===_0x85df('0x68')){this[_0x85df('0x66')](_0x5d24a7,_0x2db30d);}else if(_0x5d24a7[_0x85df('0x59')]==='outbound'){var _0xb6cbd8=this['createQueueSummaryReport'](_0x5d24a7,_0x2db30d);ami[_0x85df('0x4c')](_0x85df('0x69'),_0xb6cbd8);}this[_0x85df('0x16')][_0x85df('0x6a')]-=0x1;var _0x5b36c7=this[_0x85df('0x16')][_0x85df('0x6a')]>0x0?!![]:![];if(!_0x5b36c7){return this['syncQueueSummaryComplete'](this[_0x85df('0x16')][_0x85df('0x6b')]);}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x1d')]=function(_0x474b10){var _0x34d1e8=this[_0x85df('0x16')]['id'];if(this['summary'][_0x85df('0x61')][_0x34d1e8]&&this[_0x85df('0x16')]['queuestatus'][_0x34d1e8][_0x474b10[_0x85df('0x62')]]){this[_0x85df('0x16')][_0x85df('0x61')][_0x34d1e8][_0x474b10[_0x85df('0x62')]][_0x85df('0x11')][_0x85df('0x6c')](_0x474b10);}};VoiceQueueReport[_0x85df('0x47')]['syncQueueSummary']=function(_0x458e60){var _0x42dbc6=this;try{if(this['isNotNull'](_0x458e60)&&this[_0x85df('0x6d')](_0x458e60[_0x85df('0x55')])){logger['debug'](_0x85df('0x6e'),util['inspect'](_0x458e60,{'showHidden':![],'depth':null}));var _0x2a017c=this['voiceQueues'][_0x458e60[_0x85df('0x55')]];if(_0x2a017c){logger[_0x85df('0x53')](_0x85df('0x6f'),_0x2a017c[_0x85df('0x5a')]);this[_0x85df('0x16')]['queues'][_0x2a017c[_0x85df('0x5a')]]={'summaryEvent':_0x458e60};this['summary'][_0x85df('0x6a')]+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x2a017c['name']})['then'](function(_0x12994e){if(!_0x42dbc6['summary'][_0x85df('0x61')][_0x458e60['actionid']]){_0x42dbc6[_0x85df('0x16')]['queuestatus'][_0x458e60[_0x85df('0x62')]]={};}_0x42dbc6[_0x85df('0x16')][_0x85df('0x61')][_0x458e60[_0x85df('0x62')]][_0x12994e[_0x85df('0x62')]]={'queue':_0x2a017c[_0x85df('0x5a')],'agents':[]};})[_0x85df('0x41')](function(_0x2f9264){throw _0x2f9264;});}}}catch(_0x4c7244){logger[_0x85df('0x43')](_0x85df('0x63'),util[_0x85df('0x45')](_0x4c7244,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x1c')]=function(_0x323327){if(this['summary'][_0x85df('0x6a')]>0x0){this[_0x85df('0x16')][_0x85df('0x6b')]=_0x323327;return;}logger[_0x85df('0x53')](_0x85df('0x70'),util[_0x85df('0x45')](_0x323327,{'showHidden':![],'depth':null}));this[_0x85df('0x16')]=initializeSummary();ami[_0x85df('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0x85df('0x21')]=function(_0x3de1c4){try{if(this[_0x85df('0x6d')](_0x3de1c4)){logger[_0x85df('0x53')](_0x85df('0x71'),_0x3de1c4[_0x85df('0x4f')],util[_0x85df('0x45')](_0x3de1c4,{'showHidden':![],'depth':null}));if(_[_0x85df('0x5c')](this[_0x85df('0xf')][_0x3de1c4[_0x85df('0x4f')]])){this[_0x85df('0xf')][_0x3de1c4['uniqueid']]=[];}if(_[_0x85df('0x5c')](this['channels'][_0x3de1c4[_0x85df('0x4f')]])){this[_0x85df('0x12')][_0x3de1c4[_0x85df('0x4f')]]={};}var _0x31a44d=new QueueReport();_0x31a44d[_0x85df('0x55')]=_0x3de1c4[_0x85df('0x55')];_0x31a44d[_0x85df('0x59')]=this[_0x85df('0x14')][_0x31a44d['queue']]&&this[_0x85df('0x14')][_0x31a44d['queue']][_0x85df('0x59')]?this[_0x85df('0x14')][_0x31a44d['queue']][_0x85df('0x59')]||_0x85df('0x68'):_0x85df('0x68');_0x31a44d['queuecallerjoinAt']=moment()['format'](_0x85df('0x72'));_0x31a44d[_0x85df('0x73')]=_0x3de1c4[_0x85df('0x73')];_0x31a44d[_0x85df('0x74')]=_0x3de1c4[_0x85df('0x74')];_0x31a44d[_0x85df('0x4f')]=_0x3de1c4['uniqueid'];logger[_0x85df('0x75')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x31a44d[_0x85df('0x55')],_0x31a44d[_0x85df('0x59')]);Object[_0x85df('0x67')](_0x31a44d,_['pick'](_0x3de1c4,_[_0x85df('0x76')](_0x31a44d)));this[_0x85df('0xf')][_0x3de1c4[_0x85df('0x4f')]][_0x85df('0x6c')](_0x31a44d);this[_0x85df('0x12')][_0x3de1c4['uniqueid']]=_0x31a44d;this[_0x85df('0x77')](_0x31a44d,_0x85df('0x20'));}}catch(_0x212128){logger[_0x85df('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3de1c4[_0x85df('0x4f')],util[_0x85df('0x45')](_0x212128,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')]['syncQueueCallerAbandon']=function(_0xb89855){try{if(this[_0x85df('0x6d')](_0xb89855)){logger[_0x85df('0x53')](_0x85df('0x78'),_0xb89855[_0x85df('0x4f')],util['inspect'](_0xb89855,{'showHidden':![],'depth':null}));if(this[_0x85df('0xf')][_0xb89855['uniqueid']]){var _0x535699=_[_0x85df('0x79')](this[_0x85df('0xf')][_0xb89855[_0x85df('0x4f')]]);_0x535699[_0x85df('0x3a')]=![];_0x535699['queuecallercompleteAt']=null;_0x535699[_0x85df('0x7a')]=_0xb89855[_0x85df('0x7a')];_0x535699['originalposition']=_0xb89855[_0x85df('0x7b')];_0x535699[_0x85df('0x22')]=!![];_0x535699['queuecallerabandonAt']=moment()[_0x85df('0x50')](_0x85df('0x72'));_0x535699[_0x85df('0x7c')]='ABANDONED';_0x535699[_0x85df('0x7d')]=null;logger[_0x85df('0x75')](_0x85df('0x7e'),_0x535699[_0x85df('0x55')],_0x535699[_0x85df('0x59')]);this[_0x85df('0x12')][_0xb89855[_0x85df('0x4f')]]=_0x535699;this['emitVoiceQueueChannelRemove'](_0x535699,_0x85df('0x22'));}}}catch(_0x38aa32){logger[_0x85df('0x43')](_0x85df('0x78'),_0xb89855[_0x85df('0x4f')],util['inspect'](_0x38aa32,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x24')]=function(_0x12eb65){try{if(this[_0x85df('0x6d')](_0x12eb65)){logger[_0x85df('0x53')](_0x85df('0x7f'),_0x12eb65[_0x85df('0x4f')],util[_0x85df('0x45')](_0x12eb65,{'showHidden':![],'depth':null}));if(this[_0x85df('0xf')][_0x12eb65['uniqueid']]){var _0x13adb0=_[_0x85df('0x79')](this[_0x85df('0xf')][_0x12eb65[_0x85df('0x4f')]]);_0x13adb0[_0x85df('0x80')]=moment()[_0x85df('0x50')](_0x85df('0x72'));_0x13adb0[_0x85df('0x81')]=_0x12eb65[_0x85df('0x81')];_0x13adb0[_0x85df('0x82')]=_0x12eb65[_0x85df('0x82')];logger[_0x85df('0x75')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x13adb0[_0x85df('0x55')],_0x13adb0[_0x85df('0x59')],_0x12eb65['connectedlinenum'],_0x12eb65[_0x85df('0x82')]);this['channels'][_0x12eb65[_0x85df('0x4f')]]=_0x13adb0;this[_0x85df('0x77')](_0x13adb0,_0x85df('0x83'));}}}catch(_0x5700d7){logger[_0x85df('0x43')](_0x85df('0x7f'),_0x12eb65[_0x85df('0x4f')],util[_0x85df('0x45')](_0x5700d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x28')]=function(_0x87322d){try{if(this['isNotNull'](_0x87322d)){logger[_0x85df('0x53')]('[%s][voiceQueueReport][agentconnect]',_0x87322d[_0x85df('0x4f')],util[_0x85df('0x45')](_0x87322d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x87322d[_0x85df('0x4f')]]){var _0x36384a=_[_0x85df('0x79')](this[_0x85df('0xf')][_0x87322d['uniqueid']]);_0x36384a[_0x85df('0x3a')]=!![];_0x36384a[_0x85df('0x7c')]='COMPLETEDBYAGENT';logger[_0x85df('0x75')](_0x85df('0x84'),_0x36384a[_0x85df('0x55')],_0x36384a[_0x85df('0x59')]);}}}catch(_0xbf15e8){logger[_0x85df('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x87322d[_0x85df('0x4f')],util[_0x85df('0x45')](_0xbf15e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')]['syncAgentComplete']=function(_0x7f2ae8){try{if(this[_0x85df('0x6d')](_0x7f2ae8)){logger[_0x85df('0x53')](_0x85df('0x85'),_0x7f2ae8[_0x85df('0x4f')],util[_0x85df('0x45')](_0x7f2ae8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x7f2ae8[_0x85df('0x4f')]]){var _0x5907b0=_['last'](this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x4f')]]);_0x5907b0[_0x85df('0x22')]=![];_0x5907b0[_0x85df('0x86')]=null;_0x5907b0[_0x85df('0x87')]=!![];_0x5907b0[_0x85df('0x7d')]=_0x7f2ae8[_0x85df('0x88')];_0x5907b0[_0x85df('0x7a')]=_0x7f2ae8[_0x85df('0x7a')];_0x5907b0[_0x85df('0x3a')]=!![];_0x5907b0[_0x85df('0x39')]=![];_0x5907b0['queuecallerexitAt']=null;if(!_0x5907b0[_0x85df('0x89')]){if(_0x7f2ae8['reason']=='transfer'){_0x5907b0['queuecallerexitreason']=_0x85df('0x8a');logger[_0x85df('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5907b0[_0x85df('0x55')],_0x5907b0['type']);}else{if(_['startsWith'](_0x7f2ae8[_0x85df('0x40')][_0x85df('0x8b')](),_0x85df('0x8c'))){if(this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x8d')]]){var _0x556a88=_[_0x85df('0x79')](this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x8d')]]);_0x556a88[_0x85df('0x3a')]=![];_0x556a88['queuecallerexit']=!![];_0x556a88['queuecallerexitAt']=moment(_0x5907b0[_0x85df('0x8e')])[_0x85df('0x8f')](_0x7f2ae8['holdtime'],_0x85df('0x90'))[_0x85df('0x50')](_0x85df('0x72'));_0x556a88[_0x85df('0x7c')]='FORWARDTRANSFER';_0x556a88[_0x85df('0x89')]=!![];_0x556a88[_0x85df('0x91')]=_0x85df('0x92');_0x556a88[_0x85df('0x93')]=_0x7f2ae8['destexten'];_0x556a88[_0x85df('0x94')]=_0x7f2ae8['uniqueid'];logger['info'](_0x85df('0x95'),_0x556a88[_0x85df('0x55')],_0x556a88[_0x85df('0x59')]);var _0x5b618b=this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x8d')]];this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x8d')]]=this[_0x85df('0xf')][_0x7f2ae8['uniqueid']];this[_0x85df('0xf')][_0x7f2ae8[_0x85df('0x4f')]]=_0x5b618b;}}else{_0x5907b0[_0x85df('0x7c')]=_0x85df('0x96')+_0x7f2ae8['reason'][_0x85df('0x97')]();logger[_0x85df('0x75')](_0x85df('0x98'),_0x5907b0[_0x85df('0x55')],_0x5907b0[_0x85df('0x59')],_0x5907b0[_0x85df('0x7c')]);}}}this[_0x85df('0x12')][_0x7f2ae8[_0x85df('0x4f')]]=_0x5907b0;}}}catch(_0x3b5fbb){logger['error'](_0x85df('0x85'),_0x7f2ae8[_0x85df('0x4f')],util[_0x85df('0x45')](_0x3b5fbb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x99')]=function(_0x1f25c4){try{if(this[_0x85df('0x6d')](_0x1f25c4)){logger[_0x85df('0x53')](_0x85df('0x9a'),_0x1f25c4[_0x85df('0x4f')],util[_0x85df('0x45')](_0x1f25c4,{'showHidden':![],'depth':null}));this[_0x85df('0x9b')](_0x1f25c4[_0x85df('0x4f')],_[_0x85df('0x76')](_0x1f25c4[_0x85df('0x9c')])[0x0],_0x1f25c4['value']);if(this[_0x85df('0xf')][_0x1f25c4[_0x85df('0x4f')]]){var _0xf30d71=_['last'](this['queueReports'][_0x1f25c4[_0x85df('0x4f')]]);if(_0xf30d71){if(this[_0x85df('0x6d')](_0x1f25c4[_0x85df('0x9c')])&&this['isNotNull'](_0x1f25c4[_0x85df('0x9c')][_0x85df('0x61')])){switch(_0x1f25c4[_0x85df('0x9d')]){case _0x85df('0x9e'):_0xf30d71[_0x85df('0x39')]=![];_0xf30d71[_0x85df('0x9f')]=null;break;case'TIMEOUT':_0xf30d71[_0x85df('0xa0')]=_0x85df('0xa1');_0xf30d71[_0x85df('0x39')]=!![];_0xf30d71[_0x85df('0x9f')]=moment()[_0x85df('0x50')](_0x85df('0x72'));_0xf30d71[_0x85df('0x80')]=moment()[_0x85df('0x50')](_0x85df('0x72'));logger['debug'](_0x85df('0xa2'),_0x1f25c4[_0x85df('0x4f')],util['inspect'](_0xf30d71,{'showHidden':![],'depth':null}));ami['emit'](_0x85df('0xa3'),_0xf30d71);break;default:_0xf30d71[_0x85df('0x39')]=!![];_0xf30d71[_0x85df('0x9f')]=moment()[_0x85df('0x50')](_0x85df('0x72'));_0xf30d71[_0x85df('0x80')]=moment()[_0x85df('0x50')](_0x85df('0x72'));}_0xf30d71[_0x85df('0x22')]=![];_0xf30d71[_0x85df('0x86')]=null;_0xf30d71['queuecallerexitreason']=_0x1f25c4['value'];this[_0x85df('0x12')][_0x1f25c4[_0x85df('0x4f')]]=_0xf30d71;this['emitVoiceQueueChannelRemove'](_0xf30d71,'varset');}else if(this['isNotNull'](_0x1f25c4[_0x85df('0x9c')])&&this[_0x85df('0x6d')](_0x1f25c4[_0x85df('0x9c')][_0x85df('0xa4')])){if(!_0xf30d71[_0x85df('0x22')]){_0xf30d71['queuecallerexit']=!![];_0xf30d71[_0x85df('0x9f')]=moment()['format'](_0x85df('0x72'));_0xf30d71['queuecallerexitreason']=_0x85df('0xa5');_0xf30d71[_0x85df('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x85df('0x12')][_0x1f25c4[_0x85df('0x4f')]]=_0xf30d71;}}logger['info'](_0x85df('0xa6'),_0x1f25c4['uniqueid'],_0xf30d71[_0x85df('0x55')],_0xf30d71[_0x85df('0x59')],_[_0x85df('0x76')](_0x1f25c4[_0x85df('0x9c')])[0x0],_0x1f25c4[_0x85df('0x9d')]);_0xf30d71[_0x85df('0x17')]=this[_0x85df('0x17')][_0x1f25c4['uniqueid']];}}}}catch(_0x5604a3){logger['error'](_0x85df('0x9a'),_0x1f25c4[_0x85df('0x4f')],util[_0x85df('0x45')](_0x5604a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x85df('0x47')][_0x85df('0x9b')]=function(_0x4294b5,_0x36e177,_0xb75e4f){var _0x5d29f2=[_0x85df('0xa7'),_0x85df('0xa8'),_0x85df('0xa9'),_0x85df('0xaa'),_0x85df('0xab'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x85df('0xac'),_0x85df('0xad'),_0x85df('0xae'),_0x85df('0xaf'),_0x85df('0xb0'),_0x85df('0xb1'),'memberdynamic',_0x85df('0xb2'),_0x85df('0xb3'),'membername',_0x85df('0xb4'),_0x85df('0xb5')];if(!_[_0x85df('0x3d')](_0x36e177)&&!_[_0x85df('0xb6')](_0x5d29f2,_0x36e177)){if(_[_0x85df('0x5c')](this[_0x85df('0x17')][_0x4294b5])){this[_0x85df('0x17')][_0x4294b5]={};}this['variables'][_0x4294b5][_0x36e177]=_0xb75e4f;}};VoiceQueueReport['prototype'][_0x85df('0xb7')]=function(_0x52e032,_0x467843,_0x31ed08){try{var _0x31b628={};if(this[_0x85df('0xf')][_0x52e032]){for(var _0x51767e=0x0;_0x51767e{delete this[_0x85df('0x12')][_0x18d420];},_0x3c2a32);}};module[_0x85df('0xed')]=VoiceQueueReport; \ No newline at end of file +var _0x6857=['queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','seconds','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','sumHoldTime','diff','length','sumDuration','queuecallerjoinAt','total','answered','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','lastevent','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','transfereeuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','deleteChannelAfterTimeout','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','queueChannels','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','catch','queueReports','error','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','clearQueueReport','voiceQueues','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','queues','name','createQueueSummaryReport','assign','emitInboundVoiceQueueSummary','syncQueueStatusComplete','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','lastAssignedTo','membername'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x6857,0x14c));var _0x7685=function(_0x46275c,_0x2c5665){_0x46275c=_0x46275c-0x0;var _0x433793=_0x6857[_0x46275c];return _0x433793;};'use strict';var _=require(_0x7685('0x0'));var moment=require(_0x7685('0x1'));var util=require(_0x7685('0x2'));var Redis=require(_0x7685('0x3'));var config=require(_0x7685('0x4'));var logger=require(_0x7685('0x5'))(_0x7685('0x6'));var ami=require(_0x7685('0x7'));var QueueReport=require(_0x7685('0x8'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x7685('0x9')]=_[_0x7685('0xa')](config['redis'],{'host':_0x7685('0xb'),'port':0x18eb});var io=require(_0x7685('0xc'))(new Redis(config[_0x7685('0x9')]));var Sequence=function(){};Sequence[_0x7685('0xd')][_0x7685('0xe')]=function(_0x1e3455){this['tail']=this[_0x7685('0xf')]?this[_0x7685('0xf')][_0x7685('0x10')](_0x1e3455):_0x1e3455();};function VoiceQueueReport(_0x360f1e){this[_0x7685('0x11')]=new Sequence();this['queueReports']={};this[_0x7685('0x12')]=_0x360f1e;this[_0x7685('0x13')]=_0x360f1e[_0x7685('0x13')];this['channels']=_0x360f1e[_0x7685('0x14')];this['voiceQueues']=_0x360f1e['voiceQueues'];this[_0x7685('0x15')]=_0x360f1e['campaigns'];this[_0x7685('0x16')]=initializeSummary();this[_0x7685('0x17')]={};ami['on'](_0x7685('0x18'),this[_0x7685('0x19')][_0x7685('0x1a')](this));ami['on']('queuesummarycomplete',this[_0x7685('0x1b')][_0x7685('0x1a')](this));ami['on']('queuemember',this[_0x7685('0x1c')][_0x7685('0x1a')](this));ami['on'](_0x7685('0x1d'),this['syncQueueStatusComplete'][_0x7685('0x1a')](this));ami['on'](_0x7685('0x1e'),this[_0x7685('0x1f')][_0x7685('0x1a')](this));ami['on']('queuecallerabandon',this[_0x7685('0x20')][_0x7685('0x1a')](this));ami['on'](_0x7685('0x21'),this[_0x7685('0x22')][_0x7685('0x1a')](this));ami['on'](_0x7685('0x23'),this['syncAgentComplete'][_0x7685('0x1a')](this));ami['on'](_0x7685('0x24'),this['syncAgentConnect'][_0x7685('0x1a')](this));ami['on'](_0x7685('0x25'),this[_0x7685('0x26')]['bind'](this));ami['on']('hangup',this[_0x7685('0x27')]['bind'](this));ami['on'](_0x7685('0x28'),this[_0x7685('0x29')][_0x7685('0x1a')](this));ami['on'](_0x7685('0x2a'),this['syncMusicOnHoldStart'][_0x7685('0x1a')](this));ami['on'](_0x7685('0x2b'),this['syncMusicOnHoldStop'][_0x7685('0x1a')](this));ami['on']('attendedtransfer',this[_0x7685('0x2c')][_0x7685('0x1a')](this));ami['on'](_0x7685('0x2d'),this['syncBlindTransfer']['bind'](this));this[_0x7685('0x2e')]();this[_0x7685('0x2f')]();}function clearChannels(_0x33ecb6){if(!_['isEmpty'](_0x33ecb6)){for(var _0x293285 in _0x33ecb6){if(_0x33ecb6[_0x7685('0x30')](_0x293285)){delete _0x33ecb6[_0x293285];}}}}function clearCampaigns(_0x53c97a){if(!_[_0x7685('0x31')](_0x53c97a)){for(var _0xb8cf5 in _0x53c97a){if(_0x53c97a[_0x7685('0x30')](_0xb8cf5)){_0x53c97a[_0xb8cf5][_0x7685('0x32')]=0x0;}}}}function clearVoiceQueues(_0x436196){if(!_[_0x7685('0x31')](_0x436196)){for(var _0x239ba1 in _0x436196){if(_0x436196[_0x7685('0x30')](_0x239ba1)){_0x436196[_0x239ba1][_0x7685('0x32')]=0x0;_0x436196[_0x239ba1]['talking']=0x0;_0x436196[_0x239ba1][_0x7685('0x33')]=0x0;_0x436196[_0x239ba1][_0x7685('0x34')]=0x0;_0x436196[_0x239ba1][_0x7685('0x35')]=!![];}}}}function clearAgentBooked(_0x552434){if(!_[_0x7685('0x31')](_0x552434)){for(var _0x42eb21 in _0x552434){if(_0x552434[_0x7685('0x30')](_0x42eb21)){_0x552434[_0x42eb21][_0x7685('0x36')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x417a77){return _0x417a77[_0x7685('0x37')]||_0x417a77[_0x7685('0x38')]||_0x417a77[_0x7685('0x39')];}VoiceQueueReport[_0x7685('0xd')][_0x7685('0x3a')]=function(){var _0x21c83f=this;for(var _0x4c6438 in this[_0x7685('0x3b')]){if(this[_0x7685('0x3b')][_0x7685('0x30')](_0x4c6438)&&!this[_0x7685('0x3b')][_0x4c6438][_0x7685('0x3c')]){this[_0x7685('0x11')][_0x7685('0xe')](function(){if(!_[_0x7685('0x3d')](_0x21c83f[_0x7685('0x3b')][_0x4c6438])){return ami[_0x7685('0x3e')]({'action':_0x7685('0x3f'),'channel':_0x21c83f[_0x7685('0x3b')][_0x4c6438]['channel']})[_0x7685('0x40')](function(_0xc17625){if(_0xc17625['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x21c83f['channels'][_0x4c6438]){delete _0x21c83f['channels'][_0x4c6438];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x4c6438,util['inspect'](_0xc17625,{'showHidden':![],'depth':null}));}if(_0x21c83f[_0x7685('0x41')][_0x4c6438]){delete _0x21c83f[_0x7685('0x41')][_0x4c6438];logger[_0x7685('0x42')](_0x7685('0x43'),_0x4c6438,util[_0x7685('0x44')](_0xc17625,{'showHidden':![],'depth':null}));}if(_0x21c83f['variables'][_0x4c6438]){delete _0x21c83f[_0x7685('0x17')][_0x4c6438];logger['error'](_0x7685('0x45'),_0x4c6438,util[_0x7685('0x44')](_0xc17625,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x7685('0x29')]=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x7685('0x46')](this[_0x7685('0x41')]);clearAgentBooked(this[_0x7685('0x13')]);clearVoiceQueues(this[_0x7685('0x47')]);clearCampaigns(this[_0x7685('0x15')]);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0x7685('0x46')]=function(_0x3c2a0b){var _0x393fea=this;if(!_['isEmpty'](_0x3c2a0b)){for(var _0x4c1fdd in _0x3c2a0b){if(_0x3c2a0b[_0x7685('0x30')](_0x4c1fdd)){_0x393fea['emitVoiceQueueChannelRemove'](_0x3c2a0b[_0x4c1fdd],'clearqueuereport');delete _0x3c2a0b[_0x4c1fdd];}}}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x48')]=function(_0x3623f7,_0x1ed6d4,_0xe03d7b){io['to'](_0x3623f7)[_0x7685('0x48')](_0x1ed6d4,_0xe03d7b);};VoiceQueueReport[_0x7685('0xd')]['emitVoiceQueueChannelSave']=function(_0x19993f,_0x107c0e){logger[_0x7685('0x49')](_0x7685('0x4a')+_0x107c0e+_0x7685('0x4b'),_0x19993f[_0x7685('0x4c')],util[_0x7685('0x44')](_0x19993f,{'showHidden':![],'depth':null}));this[_0x7685('0x48')](util[_0x7685('0x4d')](_0x7685('0x4e'),_0x19993f[_0x7685('0x4f')]),'voice_queue_channel:save',_0x19993f);io[_0x7685('0x48')](_0x7685('0x50'),_0x19993f);};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x51')]=function(_0x556c04,_0x57d400){logger[_0x7685('0x49')](_0x7685('0x4a')+_0x57d400+_0x7685('0x52'),_0x556c04[_0x7685('0x4c')],util['inspect'](_0x556c04,{'showHidden':![],'depth':null}));if(_0x556c04[_0x7685('0x53')]===_0x7685('0x54')){return;}this[_0x7685('0x48')](util['format'](_0x7685('0x4e'),_0x556c04[_0x7685('0x4f')]),_0x7685('0x55'),_0x556c04);io[_0x7685('0x48')]('voice_queue_presence:remove',_0x556c04);};VoiceQueueReport[_0x7685('0xd')]['emitInboundVoiceQueueSummary']=function(_0x351efa){if(_0x351efa[_0x7685('0x56')]===_0x7685('0x57')){logger['debug'](_0x7685('0x58'),util[_0x7685('0x44')](_0x351efa,{'showHidden':![],'depth':null}));this[_0x7685('0x48')](util[_0x7685('0x4d')](_0x7685('0x4e'),_0x351efa['name']),_0x7685('0x59'),_0x351efa);}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x5a')]=function(_0x5011f9){return _0x5011f9!==null&&!_['isUndefined'](_0x5011f9);};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x2f')]=function(){var _0x276aa8=this;setInterval(function(){_0x276aa8[_0x7685('0x3a')]();ami['Action']({'action':'queues'})[_0x7685('0x40')](function(_0x3f4399){logger[_0x7685('0x42')](_0x7685('0x5b'),util['inspect'](_0x3f4399,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x2e')]=function(){var _0xa93b2d=this;setInterval(function(){if(!_0xa93b2d['summary'][_0x7685('0x5c')]){return ami[_0x7685('0x3e')]({'action':'queuesummary'})[_0x7685('0x5d')](function(_0x41320e){_0xa93b2d[_0x7685('0x16')]['id']=_0x41320e[_0x7685('0x5e')];_0xa93b2d['summary'][_0x7685('0x5c')]=!![];_0xa93b2d[_0x7685('0x16')][_0x7685('0x5f')][_0x41320e[_0x7685('0x5e')]]={};})[_0x7685('0x40')](function(_0x26cf1b){logger[_0x7685('0x42')]('[voiceQueueReport][queuesummary]',util[_0x7685('0x44')](_0x26cf1b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x53b6f3,_0x26e161){var _0x2dcd1e;if(this['summary']&&this[_0x7685('0x16')][_0x7685('0x60')]&&this[_0x7685('0x16')][_0x7685('0x60')][_0x53b6f3[_0x7685('0x61')]]){_0x2dcd1e=this[_0x7685('0x16')][_0x7685('0x60')][_0x53b6f3['name']]['summaryEvent'];}var _0x27fce4=new VoiceQueueSummary(_0x53b6f3);return _0x27fce4['createReport'](_0x26e161[_0x7685('0x13')],this[_0x7685('0x13')],_0x2dcd1e,this[_0x7685('0x12')][_0x7685('0x3b')]);};VoiceQueueReport[_0x7685('0xd')]['handleInboundQueueSummaryReport']=function(_0x2810c2,_0x3ed967){var _0x38443d=this[_0x7685('0x62')](_0x2810c2,_0x3ed967);var _0x5a5693=![];_0x5a5693=_0x38443d['compareToInboundQueue'](_0x2810c2);if(_0x5a5693){Object[_0x7685('0x63')](_0x2810c2,_0x38443d);this[_0x7685('0x12')][_0x7685('0x47')][_0x2810c2[_0x7685('0x61')]]=_0x2810c2;this[_0x7685('0x64')](_0x38443d);}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x65')]=function(_0x278a66){var _0x168512=null;var _0x21a318=this['summary']['id'];if(this[_0x7685('0x16')]['queuestatus'][_0x21a318]){_0x168512=this[_0x7685('0x16')]['queuestatus'][_0x21a318][_0x278a66[_0x7685('0x5e')]];}if(!_0x168512){this['summary']=initializeSummary();return;}var _0x442d62=this[_0x7685('0x47')][_0x168512[_0x7685('0x4f')]];if(_0x442d62[_0x7685('0x56')]===_0x7685('0x57')){this[_0x7685('0x66')](_0x442d62,_0x168512);}else if(_0x442d62[_0x7685('0x56')]===_0x7685('0x67')){var _0x594f87=this[_0x7685('0x62')](_0x442d62,_0x168512);ami['emit'](_0x7685('0x68'),_0x594f87);}this[_0x7685('0x16')][_0x7685('0x69')]-=0x1;var _0x107b2a=this[_0x7685('0x16')]['statusRequests']>0x0?!![]:![];if(!_0x107b2a){return this['syncQueueSummaryComplete'](this[_0x7685('0x16')][_0x7685('0x6a')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x317c74){var _0x32a1a9=this[_0x7685('0x16')]['id'];if(this[_0x7685('0x16')][_0x7685('0x5f')][_0x32a1a9]&&this[_0x7685('0x16')][_0x7685('0x5f')][_0x32a1a9][_0x317c74[_0x7685('0x5e')]]){this[_0x7685('0x16')][_0x7685('0x5f')][_0x32a1a9][_0x317c74[_0x7685('0x5e')]][_0x7685('0x13')][_0x7685('0x6b')](_0x317c74);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x5267a0){var _0x3beceb=this;try{if(this[_0x7685('0x5a')](_0x5267a0)&&this[_0x7685('0x5a')](_0x5267a0[_0x7685('0x4f')])){logger[_0x7685('0x49')](_0x7685('0x6c'),util[_0x7685('0x44')](_0x5267a0,{'showHidden':![],'depth':null}));var _0x11f55a=this['voiceQueues'][_0x5267a0['queue']];if(_0x11f55a){logger[_0x7685('0x49')](_0x7685('0x6d'),_0x11f55a[_0x7685('0x61')]);this[_0x7685('0x16')]['queues'][_0x11f55a['name']]={'summaryEvent':_0x5267a0};this[_0x7685('0x16')]['statusRequests']+=0x1;return ami[_0x7685('0x3e')]({'action':_0x7685('0x5f'),'queue':_0x11f55a[_0x7685('0x61')]})[_0x7685('0x5d')](function(_0x38ee07){if(!_0x3beceb['summary'][_0x7685('0x5f')][_0x5267a0[_0x7685('0x5e')]]){_0x3beceb[_0x7685('0x16')]['queuestatus'][_0x5267a0[_0x7685('0x5e')]]={};}_0x3beceb[_0x7685('0x16')]['queuestatus'][_0x5267a0['actionid']][_0x38ee07['actionid']]={'queue':_0x11f55a[_0x7685('0x61')],'agents':[]};})[_0x7685('0x40')](function(_0x1a3700){throw _0x1a3700;});}}}catch(_0x1ab5ba){logger[_0x7685('0x42')]('[voiceQueueReport][queuesummary]',util[_0x7685('0x44')](_0x1ab5ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')]['syncQueueSummaryComplete']=function(_0x2fd3db){if(this['summary'][_0x7685('0x69')]>0x0){this['summary'][_0x7685('0x6a')]=_0x2fd3db;return;}logger['debug'](_0x7685('0x6e'),util[_0x7685('0x44')](_0x2fd3db,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0x7685('0x6f'),{});};VoiceQueueReport['prototype'][_0x7685('0x1f')]=function(_0xdba97c){try{if(this[_0x7685('0x5a')](_0xdba97c)){logger[_0x7685('0x49')](_0x7685('0x70'),_0xdba97c[_0x7685('0x4c')],util['inspect'](_0xdba97c,{'showHidden':![],'depth':null}));if(_[_0x7685('0x71')](this[_0x7685('0x41')][_0xdba97c[_0x7685('0x4c')]])){this[_0x7685('0x41')][_0xdba97c[_0x7685('0x4c')]]=[];}if(_[_0x7685('0x71')](this['channels'][_0xdba97c['uniqueid']])){this[_0x7685('0x3b')][_0xdba97c['uniqueid']]={};}var _0x553fc0=new QueueReport();_0x553fc0[_0x7685('0x4f')]=_0xdba97c['queue'];_0x553fc0[_0x7685('0x56')]=this['voiceQueues'][_0x553fc0[_0x7685('0x4f')]]&&this['voiceQueues'][_0x553fc0[_0x7685('0x4f')]][_0x7685('0x56')]?this['voiceQueues'][_0x553fc0[_0x7685('0x4f')]][_0x7685('0x56')]||_0x7685('0x57'):_0x7685('0x57');_0x553fc0['queuecallerjoinAt']=moment()[_0x7685('0x4d')](_0x7685('0x72'));_0x553fc0[_0x7685('0x73')]=_0xdba97c[_0x7685('0x73')];_0x553fc0[_0x7685('0x74')]=_0xdba97c['count'];_0x553fc0[_0x7685('0x4c')]=_0xdba97c[_0x7685('0x4c')];logger[_0x7685('0x75')](_0x7685('0x76'),_0x553fc0[_0x7685('0x4f')],_0x553fc0[_0x7685('0x56')]);Object[_0x7685('0x63')](_0x553fc0,_['pick'](_0xdba97c,_[_0x7685('0x77')](_0x553fc0)));this[_0x7685('0x41')][_0xdba97c[_0x7685('0x4c')]][_0x7685('0x6b')](_0x553fc0);this[_0x7685('0x3b')][_0xdba97c[_0x7685('0x4c')]]=_0x553fc0;this[_0x7685('0x78')](_0x553fc0,_0x7685('0x1e'));}}catch(_0x474902){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0xdba97c[_0x7685('0x4c')],util[_0x7685('0x44')](_0x474902,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')]['syncQueueCallerAbandon']=function(_0x1553c9){try{if(this[_0x7685('0x5a')](_0x1553c9)){logger['debug'](_0x7685('0x79'),_0x1553c9[_0x7685('0x4c')],util[_0x7685('0x44')](_0x1553c9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1553c9[_0x7685('0x4c')]]){var _0x1df4da=_[_0x7685('0x7a')](this[_0x7685('0x41')][_0x1553c9['uniqueid']]);_0x1df4da[_0x7685('0x39')]=![];_0x1df4da[_0x7685('0x7b')]=null;_0x1df4da[_0x7685('0x7c')]=_0x1553c9[_0x7685('0x7c')];_0x1df4da[_0x7685('0x7d')]=_0x1553c9[_0x7685('0x7d')];_0x1df4da[_0x7685('0x38')]=!![];_0x1df4da[_0x7685('0x7e')]=moment()[_0x7685('0x4d')](_0x7685('0x72'));_0x1df4da['queuecallerexitreason']='ABANDONED';_0x1df4da['lastAssignedTo']=null;logger[_0x7685('0x75')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1df4da[_0x7685('0x4f')],_0x1df4da[_0x7685('0x56')]);this[_0x7685('0x3b')][_0x1553c9[_0x7685('0x4c')]]=_0x1df4da;this[_0x7685('0x51')](_0x1df4da,'queuecallerabandon');}}}catch(_0x203a76){logger['error'](_0x7685('0x79'),_0x1553c9[_0x7685('0x4c')],util[_0x7685('0x44')](_0x203a76,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x22')]=function(_0x4e816f){try{if(this[_0x7685('0x5a')](_0x4e816f)){logger[_0x7685('0x49')](_0x7685('0x7f'),_0x4e816f['uniqueid'],util[_0x7685('0x44')](_0x4e816f,{'showHidden':![],'depth':null}));if(this[_0x7685('0x41')][_0x4e816f['uniqueid']]){var _0x16f95e=_[_0x7685('0x7a')](this[_0x7685('0x41')][_0x4e816f['uniqueid']]);_0x16f95e[_0x7685('0x80')]=moment()[_0x7685('0x4d')](_0x7685('0x72'));_0x16f95e[_0x7685('0x81')]=_0x4e816f[_0x7685('0x81')];_0x16f95e['connectedlinename']=_0x4e816f[_0x7685('0x82')];logger[_0x7685('0x75')](_0x7685('0x83'),_0x16f95e['queue'],_0x16f95e[_0x7685('0x56')],_0x4e816f[_0x7685('0x81')],_0x4e816f[_0x7685('0x82')]);this[_0x7685('0x3b')][_0x4e816f['uniqueid']]=_0x16f95e;this[_0x7685('0x78')](_0x16f95e,_0x7685('0x21'));}}}catch(_0x5be002){logger[_0x7685('0x42')](_0x7685('0x7f'),_0x4e816f[_0x7685('0x4c')],util[_0x7685('0x44')](_0x5be002,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x84')]=function(_0x117a7b){try{if(this[_0x7685('0x5a')](_0x117a7b)){logger[_0x7685('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x117a7b[_0x7685('0x4c')],util['inspect'](_0x117a7b,{'showHidden':![],'depth':null}));if(this[_0x7685('0x41')][_0x117a7b[_0x7685('0x4c')]]){var _0x481ed5=_[_0x7685('0x7a')](this[_0x7685('0x41')][_0x117a7b[_0x7685('0x4c')]]);_0x481ed5[_0x7685('0x39')]=!![];_0x481ed5[_0x7685('0x53')]=_0x7685('0x85');logger['info'](_0x7685('0x86'),_0x481ed5[_0x7685('0x4f')],_0x481ed5[_0x7685('0x56')]);}}}catch(_0x470340){logger[_0x7685('0x42')](_0x7685('0x87'),_0x117a7b['uniqueid'],util[_0x7685('0x44')](_0x470340,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x88')]=function(_0x32823a){try{if(this[_0x7685('0x5a')](_0x32823a)){logger[_0x7685('0x49')](_0x7685('0x89'),_0x32823a[_0x7685('0x4c')],util[_0x7685('0x44')](_0x32823a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x32823a[_0x7685('0x4c')]]){var _0x23d550=_[_0x7685('0x7a')](this[_0x7685('0x41')][_0x32823a[_0x7685('0x4c')]]);_0x23d550[_0x7685('0x38')]=![];_0x23d550[_0x7685('0x7e')]=null;_0x23d550['assigned']=!![];_0x23d550[_0x7685('0x8a')]=_0x32823a[_0x7685('0x8b')];_0x23d550[_0x7685('0x7c')]=_0x32823a[_0x7685('0x7c')];_0x23d550[_0x7685('0x39')]=!![];_0x23d550[_0x7685('0x37')]=![];_0x23d550[_0x7685('0x8c')]=null;if(!_0x23d550[_0x7685('0x8d')]){if(_0x32823a[_0x7685('0x8e')]=='transfer'){_0x23d550[_0x7685('0x53')]=_0x7685('0x8f');logger['info'](_0x7685('0x90'),_0x23d550['queue'],_0x23d550[_0x7685('0x56')]);}else{if(_[_0x7685('0x91')](_0x32823a[_0x7685('0x92')][_0x7685('0x93')](),_0x7685('0x94'))){if(this['queueReports'][_0x32823a['linkedid']]){var _0x3c2c2f=_['last'](this[_0x7685('0x41')][_0x32823a[_0x7685('0x95')]]);_0x3c2c2f[_0x7685('0x39')]=![];_0x3c2c2f[_0x7685('0x37')]=!![];_0x3c2c2f[_0x7685('0x8c')]=moment(_0x23d550['queuecallerjoinAt'])['add'](_0x32823a['holdtime'],_0x7685('0x96'))['format'](_0x7685('0x72'));_0x3c2c2f[_0x7685('0x53')]='FORWARDTRANSFER';_0x3c2c2f['transfer']=!![];_0x3c2c2f['transfertype']=_0x7685('0x97');_0x3c2c2f[_0x7685('0x98')]=_0x32823a['destexten'];_0x3c2c2f[_0x7685('0x99')]=_0x32823a[_0x7685('0x4c')];logger[_0x7685('0x75')](_0x7685('0x9a'),_0x3c2c2f[_0x7685('0x4f')],_0x3c2c2f[_0x7685('0x56')]);var _0x436aa1=this[_0x7685('0x41')][_0x32823a[_0x7685('0x95')]];this[_0x7685('0x41')][_0x32823a[_0x7685('0x95')]]=this[_0x7685('0x41')][_0x32823a[_0x7685('0x4c')]];this['queueReports'][_0x32823a[_0x7685('0x4c')]]=_0x436aa1;}}else{_0x23d550[_0x7685('0x53')]=_0x7685('0x9b')+_0x32823a[_0x7685('0x8e')][_0x7685('0x9c')]();logger[_0x7685('0x75')](_0x7685('0x9d'),_0x23d550['queue'],_0x23d550['type'],_0x23d550['queuecallerexitreason']);}}}this[_0x7685('0x3b')][_0x32823a['uniqueid']]=_0x23d550;}}}catch(_0x1dc174){logger['error'](_0x7685('0x89'),_0x32823a[_0x7685('0x4c')],util['inspect'](_0x1dc174,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x26')]=function(_0x51a265){try{if(this['isNotNull'](_0x51a265)){logger[_0x7685('0x49')](_0x7685('0x9e'),_0x51a265[_0x7685('0x4c')],util[_0x7685('0x44')](_0x51a265,{'showHidden':![],'depth':null}));this[_0x7685('0x9f')](_0x51a265[_0x7685('0x4c')],_['keys'](_0x51a265[_0x7685('0xa0')])[0x0],_0x51a265[_0x7685('0xa1')]);if(this[_0x7685('0x41')][_0x51a265[_0x7685('0x4c')]]){var _0x54be88=_['last'](this[_0x7685('0x41')][_0x51a265[_0x7685('0x4c')]]);if(_0x54be88){if(this[_0x7685('0x5a')](_0x51a265[_0x7685('0xa0')])&&this[_0x7685('0x5a')](_0x51a265['variable']['queuestatus'])){switch(_0x51a265[_0x7685('0xa1')]){case _0x7685('0xa2'):_0x54be88['queuecallerexit']=![];_0x54be88['queuecallerexitAt']=null;break;case'TIMEOUT':_0x54be88['lastevent']='timeout';_0x54be88[_0x7685('0x37')]=!![];_0x54be88[_0x7685('0x8c')]=moment()[_0x7685('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x54be88['queuecallerleaveAt']=moment()['format'](_0x7685('0x72'));logger['debug'](_0x7685('0xa3'),_0x51a265[_0x7685('0x4c')],util[_0x7685('0x44')](_0x54be88,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x54be88);break;default:_0x54be88['queuecallerexit']=!![];_0x54be88['queuecallerexitAt']=moment()[_0x7685('0x4d')](_0x7685('0x72'));_0x54be88[_0x7685('0x80')]=moment()[_0x7685('0x4d')](_0x7685('0x72'));}_0x54be88[_0x7685('0x38')]=![];_0x54be88['queuecallerabandonAt']=null;_0x54be88[_0x7685('0x53')]=_0x51a265[_0x7685('0xa1')];this['channels'][_0x51a265[_0x7685('0x4c')]]=_0x54be88;this['emitVoiceQueueChannelRemove'](_0x54be88,_0x7685('0x25'));}else if(this[_0x7685('0x5a')](_0x51a265[_0x7685('0xa0')])&&this['isNotNull'](_0x51a265[_0x7685('0xa0')][_0x7685('0xa4')])){if(!_0x54be88[_0x7685('0x38')]){_0x54be88[_0x7685('0x37')]=!![];_0x54be88[_0x7685('0x8c')]=moment()[_0x7685('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x54be88[_0x7685('0x53')]=_0x7685('0xa5');_0x54be88[_0x7685('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x51a265[_0x7685('0x4c')]]=_0x54be88;}}logger['info'](_0x7685('0xa6'),_0x51a265[_0x7685('0x4c')],_0x54be88['queue'],_0x54be88[_0x7685('0x56')],_[_0x7685('0x77')](_0x51a265[_0x7685('0xa0')])[0x0],_0x51a265['value']);_0x54be88[_0x7685('0x17')]=this[_0x7685('0x17')][_0x51a265[_0x7685('0x4c')]];}}}}catch(_0x1c3d5f){logger[_0x7685('0x42')]('[%s][voiceQueueReport][varset]',_0x51a265[_0x7685('0x4c')],util[_0x7685('0x44')](_0x1c3d5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7685('0xd')][_0x7685('0x9f')]=function(_0x70302a,_0x7bba79,_0x218960){var _0x3f0b99=['rtpaudioqos',_0x7685('0xa7'),_0x7685('0xa8'),_0x7685('0xa9'),_0x7685('0xaa'),_0x7685('0xab'),_0x7685('0xac'),_0x7685('0xad'),'sipcallid','sipuri',_0x7685('0xae'),'bridgepvtcallid',_0x7685('0xaf'),_0x7685('0xb0'),'memberinterface','memberlastcall',_0x7685('0x8b'),_0x7685('0xb1'),_0x7685('0xb2')];if(!_['isNil'](_0x7bba79)&&!_[_0x7685('0xb3')](_0x3f0b99,_0x7bba79)){if(_[_0x7685('0x71')](this[_0x7685('0x17')][_0x70302a])){this[_0x7685('0x17')][_0x70302a]={};}this['variables'][_0x70302a][_0x7bba79]=_0x218960;}};VoiceQueueReport[_0x7685('0xd')]['handleHangup']=function(_0x5c174a,_0x10c6bc,_0x11d2be){try{var _0x3b2020={};if(this[_0x7685('0x41')][_0x5c174a]){for(var _0x115d03=0x0;_0x115d03{delete this[_0x7685('0x3b')][_0x5bf7f9];},_0x1d63ce);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 2fd1dda..74304f9 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9af=['CreateReportAgentPreview','createHistory','queue','Request'];(function(_0x2ae731,_0x4f3584){var _0x2514d3=function(_0x267382){while(--_0x267382){_0x2ae731['push'](_0x2ae731['shift']());}};_0x2514d3(++_0x4f3584);}(_0xd9af,0x10d));var _0xfd9a=function(_0x4a0ad7,_0x469cbb){_0x4a0ad7=_0x4a0ad7-0x0;var _0x262757=_0xd9af[_0x4a0ad7];return _0x262757;};'use strict';var client=require('../client');exports[_0xfd9a('0x0')]=function(_0xfa9132){return function(){_0xfa9132['campaign']=_0xfa9132[_0xfd9a('0x1')];return client[_0xfd9a('0x2')](_0xfd9a('0x3'),{'body':_0xfa9132,'log':_0xfd9a('0x3')});};}; \ No newline at end of file +var _0xbb95=['Request','CreateReportAgentPreview','campaign','queue'];(function(_0x18ea0e,_0x3078d8){var _0x4fe40a=function(_0x412ef0){while(--_0x412ef0){_0x18ea0e['push'](_0x18ea0e['shift']());}};_0x4fe40a(++_0x3078d8);}(_0xbb95,0x14e));var _0x5bb9=function(_0x266b0c,_0x4fb269){_0x266b0c=_0x266b0c-0x0;var _0xd1bfa7=_0xbb95[_0x266b0c];return _0xd1bfa7;};'use strict';var client=require('../client');exports['createHistory']=function(_0x21520c){return function(){_0x21520c[_0x5bb9('0x0')]=_0x21520c[_0x5bb9('0x1')];return client[_0x5bb9('0x2')](_0x5bb9('0x3'),{'body':_0x21520c,'log':_0x5bb9('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index cf85d9f..5880486 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdb9=['CreateAttachment','create','Request'];(function(_0x579bb2,_0x14df02){var _0x1f8f78=function(_0x4a02d8){while(--_0x4a02d8){_0x579bb2['push'](_0x579bb2['shift']());}};_0x1f8f78(++_0x14df02);}(_0xcdb9,0x82));var _0x9cdb=function(_0x48d041,_0x37b797){_0x48d041=_0x48d041-0x0;var _0x4677ad=_0xcdb9[_0x48d041];return _0x4677ad;};'use strict';var client=require('../client');exports[_0x9cdb('0x0')]=function(_0x1ef155){return client[_0x9cdb('0x1')]('CreateAttachment',{'body':_0x1ef155,'log':_0x9cdb('0x2')});}; \ No newline at end of file +var _0x707b=['CreateAttachment','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707b,0xdf));var _0xb707=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x707b[_0x6cf622];return _0x1887fe;};'use strict';var client=require(_0xb707('0x0'));exports[_0xb707('0x1')]=function(_0x45c58c){return client['Request'](_0xb707('0x2'),{'body':_0x45c58c,'log':'CreateAttachment'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 00f7bff..6658d7b 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','GetCampaign','name','type','active','limitCalls'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc8fd95,_0x43cdad){_0xc8fd95=_0xc8fd95-0x0;var _0x3d6ada=_0x5f2f[_0xc8fd95];return _0x3d6ada;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'dialNoAnswerRetryFrequency',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'dialDropMaxRetry',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'dialMachineMaxRetry',_0xf5f2('0x14'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf5f2('0x15'),_0xf5f2('0x16'),'dialAMDActive',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'dialAMDMaximumNumberOfWords',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'dialCutDigit'],'include':[{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x22'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x24'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x25'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x26'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x27')]}]},{'model':'SquareProject','as':_0xf5f2('0x28'),'attributes':['id',_0xf5f2('0x4')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x21bad5,_0x23a39d){var _0x235106=function(_0x281b1f){while(--_0x281b1f){_0x21bad5['push'](_0x21bad5['shift']());}};_0x235106(++_0x23a39d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index e6e93d1..1de8d7c 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x328c=['createContact','Request','GetCmContact','../client'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x328c,0x8b));var _0xc328=function(_0x5b9cbd,_0x61a776){_0x5b9cbd=_0x5b9cbd-0x0;var _0x50b648=_0x328c[_0x5b9cbd];return _0x50b648;};'use strict';var client=require(_0xc328('0x0'));exports[_0xc328('0x1')]=function(_0x55daac){return function(){return client[_0xc328('0x2')]('CreateCmContact',{'body':_0x55daac,'log':'CreateCmContact'});};};exports['getContacts']=function(_0x3e1359){return function(){return client[_0xc328('0x2')]('GetCmContact',{'options':_0x3e1359,'log':_0xc328('0x3')});};}; \ No newline at end of file +var _0x5d0b=['../client','createContact','Request','CreateCmContact','GetCmContact'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5d0b,0x1a9));var _0xb5d0=function(_0x5446c1,_0x2d555c){_0x5446c1=_0x5446c1-0x0;var _0x184727=_0x5d0b[_0x5446c1];return _0x184727;};'use strict';var client=require(_0xb5d0('0x0'));exports[_0xb5d0('0x1')]=function(_0x563019){return function(){return client[_0xb5d0('0x2')](_0xb5d0('0x3'),{'body':_0x563019,'log':_0xb5d0('0x3')});};};exports['getContacts']=function(_0xa93287){return function(){return client[_0xb5d0('0x2')]('GetCmContact',{'options':_0xa93287,'log':_0xb5d0('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 8e07915..7d7ba59 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','getCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','priority','scheduledat','ASC','getContactDialerIvr','CmContact','DESC','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','GetCmHopperPreview','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','User','voicePause'];(function(_0x308d33,_0x1525b7){var _0x35d0db=function(_0x4d4649){while(--_0x4d4649){_0x308d33['push'](_0x308d33['shift']());}};_0x35d0db(++_0x1525b7);}(_0x7da7,0x10d));var _0x77da=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x7da7[_0x17882c];return _0x355a59;};'use strict';var client=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));exports[_0x77da('0x2')]=function(_0x571213,_0x59892b){return function(){return client[_0x77da('0x3')](_0x77da('0x4'),{'options':{'where':{'VoiceQueueId':_0x571213},'include':[{'model':'CmContact','as':_0x77da('0x5')}],'limit':_0x59892b,'raw':![]},'log':_0x77da('0x6')});};};exports['updateContacts']=function(_0x19331c,_0xc54a12,_0x47da81){return function(){return client[_0x77da('0x3')]('UpdateCmHopper',{'body':_0x19331c,'options':{'where':{'VoiceQueueId':_0xc54a12,'scheduledat':{'$lte':moment()[_0x77da('0x7')](_0x77da('0x8'))}},'limit':_0x47da81},'log':_0x77da('0x9')});};};exports[_0x77da('0xa')]=function(_0x252128){return client['Request'](_0x77da('0x9'),{'body':_0x252128,'options':{'where':{'ContactId':_0x252128[_0x77da('0xb')],'ListId':_0x252128[_0x77da('0xc')],'VoiceQueueId':_0x252128['VoiceQueueId'],'CampaignId':_0x252128[_0x77da('0xd')]}},'log':_0x77da('0xa')});};exports[_0x77da('0xe')]=function(_0x2a675a,_0x5f3a91,_0x93f149){return function(){return client[_0x77da('0x3')](_0x77da('0xf'),{'options':{'where':{'VoiceQueueId':_0x2a675a,'ListId':_0x5f3a91,'ContactId':_0x93f149}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x26e3ff,_0x4263d9,_0x589aa1,_0x3b0ff2){return client[_0x77da('0x3')](_0x77da('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x26e3ff,'active':![],'scheduledat':{'$lte':moment()[_0x77da('0x7')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x4263d9}}]},'order':[[_0x77da('0x11'),'DESC'],[_0x77da('0x12'),_0x3b0ff2],['id',_0x77da('0x13')]],'raw':!![],'limit':_0x589aa1},'log':_0x77da('0x10')});};exports[_0x77da('0x14')]=function(_0x4ecd98,_0x5c07da,_0x514016){return client['Request'](_0x77da('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4ecd98,'active':![],'scheduledat':{'$lte':moment()[_0x77da('0x7')](_0x77da('0x8'))}},'include':[{'model':_0x77da('0x15'),'as':_0x77da('0x5')}],'order':[[_0x77da('0x11'),_0x77da('0x16')],[_0x77da('0x12'),_0x514016],['id','ASC']],'raw':!![],'limit':_0x5c07da},'log':'GetContactDialerIvr'});};exports[_0x77da('0x17')]=function(_0x4d1512,_0x507979){_0x4d1512[_0x77da('0x18')]=_0x4d1512[_0x77da('0x19')];return client[_0x77da('0x3')]('MoveContactManagedDialer',{'body':_0x4d1512,'options':{'where':{'ContactId':_0x4d1512['ContactId'],'ListId':_0x4d1512[_0x77da('0xc')],'VoiceQueueId':_0x4d1512['VoiceQueueId'],'CampaignId':_0x4d1512[_0x77da('0xd')],'active':_0x507979?undefined:!![]}},'log':_0x77da('0x1a')});};exports[_0x77da('0x1b')]=function(_0x27b6c7){return client[_0x77da('0x3')](_0x77da('0x1c'),{'options':{'where':{'VoiceQueueId':_0x27b6c7['id']?_0x27b6c7['id']||null:null}},'log':_0x77da('0x1b')});};exports['getContactPreview']=function(_0x4885ec){return function(){return client[_0x77da('0x3')](_0x77da('0x1d'),{'options':{'where':{'id':_0x4885ec},'include':[{'model':_0x77da('0x15'),'as':_0x77da('0x5')},{'model':'User','as':_0x77da('0x1e'),'attributes':['id',_0x77da('0x1f')]},{'model':_0x77da('0x20'),'as':_0x77da('0x21'),'attributes':['id',_0x77da('0x1f')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x77da('0x22')]=function(_0x3e090d,_0x1f2279,_0x2913f7){return client['Request']('UpdateCmHopper',{'body':_0x3e090d,'options':{'where':{'id':_0x1f2279},'limit':_0x2913f7},'log':'UpdateCmHopper'});};exports[_0x77da('0x23')]=function(_0x30456a,_0x410d09){return function(){return client[_0x77da('0x3')](_0x77da('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x30456a,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x77da('0x8'))},'UserId':{'$in':_0x410d09}},'order':[[_0x77da('0x11'),_0x77da('0x16')],[_0x77da('0x12'),_0x77da('0x16')],['id',_0x77da('0x13')]],'include':[{'model':'CmContact','as':_0x77da('0x5')},{'model':_0x77da('0x25'),'as':_0x77da('0x1e'),'attributes':['id',_0x77da('0x1f'),_0x77da('0x26')]}],'group':_0x77da('0x27'),'raw':!![]},'log':_0x77da('0x10')});};};exports[_0x77da('0x28')]=function(_0x5b9b05,_0x5e8d1e){return client[_0x77da('0x3')](_0x77da('0x29'),{'body':_0x5b9b05,'options':_0x5e8d1e||{},'log':'ResetActiveCalls'});};exports[_0x77da('0x2a')]=function(_0x390399,_0x1f7993,_0x10540a){return function(){return client[_0x77da('0x3')](_0x77da('0x2b'),{'body':{'where':{'voiceQueueIds':_0x390399,'interval':_0x1f7993,'availableAgentsIds':_0x10540a}},'log':_0x77da('0x2a')});};}; \ No newline at end of file +var _0x0bde=['DestroyCmHopper','priority','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','VoiceQueueId','CountReScheduled','getContactPreview','GetCmHopperPreview','Contact','Agent','name','VoiceQueue','unlockContact','getContactRecallMe','User','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','CampaignId','destroyContact'];(function(_0x143fd9,_0x36d5d6){var _0x18f011=function(_0x6417c0){while(--_0x6417c0){_0x143fd9['push'](_0x143fd9['shift']());}};_0x18f011(++_0x36d5d6);}(_0x0bde,0x110));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xe0bd('0x0'));var moment=require('moment');exports[_0xe0bd('0x1')]=function(_0xab624e,_0x5644f8){return function(){return client[_0xe0bd('0x2')](_0xe0bd('0x3'),{'options':{'where':{'VoiceQueueId':_0xab624e},'include':[{'model':_0xe0bd('0x4'),'as':'Contact'}],'limit':_0x5644f8,'raw':![]},'log':_0xe0bd('0x5')});};};exports[_0xe0bd('0x6')]=function(_0x17608f,_0x3a3cd2,_0x37289f){return function(){return client[_0xe0bd('0x2')](_0xe0bd('0x7'),{'body':_0x17608f,'options':{'where':{'VoiceQueueId':_0x3a3cd2,'scheduledat':{'$lte':moment()[_0xe0bd('0x8')](_0xe0bd('0x9'))}},'limit':_0x37289f},'log':_0xe0bd('0x7')});};};exports[_0xe0bd('0xa')]=function(_0x3c2ee1){return client[_0xe0bd('0x2')]('UpdateCmHopper',{'body':_0x3c2ee1,'options':{'where':{'ContactId':_0x3c2ee1[_0xe0bd('0xb')],'ListId':_0x3c2ee1[_0xe0bd('0xc')],'VoiceQueueId':_0x3c2ee1['VoiceQueueId'],'CampaignId':_0x3c2ee1[_0xe0bd('0xd')]}},'log':'rescheduleContact'});};exports[_0xe0bd('0xe')]=function(_0x3b6752,_0x3cc36c,_0x7bd715){return function(){return client[_0xe0bd('0x2')](_0xe0bd('0xf'),{'options':{'where':{'VoiceQueueId':_0x3b6752,'ListId':_0x3cc36c,'ContactId':_0x7bd715}},'log':_0xe0bd('0xf')});};};exports['getContactDialer']=function(_0xadea83,_0x40c17c,_0x3dfc72,_0x5c76f1){return client[_0xe0bd('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xadea83,'active':![],'scheduledat':{'$lte':moment()[_0xe0bd('0x8')](_0xe0bd('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x40c17c}}]},'order':[[_0xe0bd('0x10'),_0xe0bd('0x11')],[_0xe0bd('0x12'),_0x5c76f1],['id',_0xe0bd('0x13')]],'raw':!![],'limit':_0x3dfc72},'log':_0xe0bd('0x14')});};exports[_0xe0bd('0x15')]=function(_0x4ea791,_0x49c222,_0x2d2ba3){return client[_0xe0bd('0x2')](_0xe0bd('0x14'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4ea791,'active':![],'scheduledat':{'$lte':moment()[_0xe0bd('0x8')](_0xe0bd('0x9'))}},'include':[{'model':_0xe0bd('0x4'),'as':'Contact'}],'order':[['priority',_0xe0bd('0x11')],[_0xe0bd('0x12'),_0x2d2ba3],['id',_0xe0bd('0x13')]],'raw':!![],'limit':_0x49c222},'log':_0xe0bd('0x16')});};exports[_0xe0bd('0x17')]=function(_0x154480,_0x3dbd98){_0x154480['campaign']=_0x154480['queue'];return client[_0xe0bd('0x2')](_0xe0bd('0x18'),{'body':_0x154480,'options':{'where':{'ContactId':_0x154480[_0xe0bd('0xb')],'ListId':_0x154480[_0xe0bd('0xc')],'VoiceQueueId':_0x154480[_0xe0bd('0x19')],'CampaignId':_0x154480['CampaignId'],'active':_0x3dbd98?undefined:!![]}},'log':_0xe0bd('0x18')});};exports['countReScheduled']=function(_0x242cbe){return client[_0xe0bd('0x2')](_0xe0bd('0x1a'),{'options':{'where':{'VoiceQueueId':_0x242cbe['id']?_0x242cbe['id']||null:null}},'log':'countReScheduled'});};exports[_0xe0bd('0x1b')]=function(_0x1ba8e5){return function(){return client['Request'](_0xe0bd('0x1c'),{'options':{'where':{'id':_0x1ba8e5},'include':[{'model':'CmContact','as':_0xe0bd('0x1d')},{'model':'User','as':_0xe0bd('0x1e'),'attributes':['id',_0xe0bd('0x1f')]},{'model':_0xe0bd('0x20'),'as':'Queue','attributes':['id',_0xe0bd('0x1f')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xe0bd('0x21')]=function(_0x43fe31,_0x58198f,_0x54bc12){return client[_0xe0bd('0x2')](_0xe0bd('0x7'),{'body':_0x43fe31,'options':{'where':{'id':_0x58198f},'limit':_0x54bc12},'log':_0xe0bd('0x7')});};exports[_0xe0bd('0x22')]=function(_0x2d7f2f,_0x17e614){return function(){return client[_0xe0bd('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2d7f2f,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xe0bd('0x8')](_0xe0bd('0x9'))},'UserId':{'$in':_0x17e614}},'order':[[_0xe0bd('0x10'),_0xe0bd('0x11')],[_0xe0bd('0x12'),_0xe0bd('0x11')],['id','ASC']],'include':[{'model':_0xe0bd('0x4'),'as':_0xe0bd('0x1d')},{'model':_0xe0bd('0x23'),'as':_0xe0bd('0x1e'),'attributes':['id',_0xe0bd('0x1f'),_0xe0bd('0x24')]}],'group':_0xe0bd('0x25'),'raw':!![]},'log':_0xe0bd('0x14')});};};exports['resetActiveCalls']=function(_0x5cac1a,_0x1aafde){return client[_0xe0bd('0x2')](_0xe0bd('0x26'),{'body':_0x5cac1a,'options':_0x1aafde||{},'log':_0xe0bd('0x26')});};exports[_0xe0bd('0x27')]=function(_0x5d9370,_0x52deff,_0x5c26e2){return function(){return client[_0xe0bd('0x2')](_0xe0bd('0x28'),{'body':{'where':{'voiceQueueIds':_0x5d9370,'interval':_0x52deff,'availableAgentsIds':_0x5c26e2}},'log':_0xe0bd('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index c3fd87a..00b98cc 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x896e=['swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0x896e,0x130));var _0xe896=function(_0x2d41a3,_0x1b63e6){_0x2d41a3=_0x2d41a3-0x0;var _0x47aff7=_0x896e[_0x2d41a3];return _0x47aff7;};'use strict';var client=require(_0xe896('0x0'));exports[_0xe896('0x1')]=function(_0x19141f,_0x9df023,_0x5594b5){return client[_0xe896('0x2')](_0xe896('0x3'),{'body':_0x19141f,'reason':_0x9df023,'entity':_0x5594b5,'log':_0xe896('0x3')});};exports[_0xe896('0x4')]=function(_0x162f82,_0x534587,_0x4345da){return client['Request'](_0xe896('0x5'),{'body':_0x162f82,'duration':_0x534587,'waitTime':_0x4345da,'log':_0xe896('0x5')});};exports['incrementPreviewCounters']=function(_0x5cebdb){return function(){return client[_0xe896('0x2')](_0xe896('0x6'),{'body':_0x5cebdb,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0x61e1=['../client','verifyAdditionalPhones','swapAdditionalPhones','Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x18bf92,_0x51d136){var _0x5bb7d0=function(_0x1966da){while(--_0x1966da){_0x18bf92['push'](_0x18bf92['shift']());}};_0x5bb7d0(++_0x51d136);}(_0x61e1,0xe7));var _0x161e=function(_0x4e4140,_0x5adf57){_0x4e4140=_0x4e4140-0x0;var _0x13f3f5=_0x61e1[_0x4e4140];return _0x13f3f5;};'use strict';var client=require(_0x161e('0x0'));exports[_0x161e('0x1')]=function(_0x2dbd3c,_0x2d696b,_0x5ee7ab){return client['Request']('VerifyAdditionalPhones',{'body':_0x2dbd3c,'reason':_0x2d696b,'entity':_0x5ee7ab,'log':'VerifyAdditionalPhones'});};exports[_0x161e('0x2')]=function(_0x296300,_0x1d7ef3,_0x18ce0d){return client[_0x161e('0x3')](_0x161e('0x4'),{'body':_0x296300,'duration':_0x1d7ef3,'waitTime':_0x18ce0d,'log':_0x161e('0x4')});};exports[_0x161e('0x5')]=function(_0x59a037){return function(){return client['Request'](_0x161e('0x6'),{'body':_0x59a037,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 4394732..2ef8630 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb92e=['phone','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','GetCmHopperBlack','VoiceQueueId'];(function(_0x33a7a6,_0x333d39){var _0x6e2458=function(_0x5cef30){while(--_0x5cef30){_0x33a7a6['push'](_0x33a7a6['shift']());}};_0x6e2458(++_0x333d39);}(_0xb92e,0x129));var _0xeb92=function(_0x48d218,_0x38ae7b){_0x48d218=_0x48d218-0x0;var _0x5d86c7=_0xb92e[_0x48d218];return _0x5d86c7;};'use strict';var client=require(_0xeb92('0x0'));exports[_0xeb92('0x1')]=function(_0x4e7334){return client['Request'](_0xeb92('0x2'),{'options':{'where':{'VoiceQueueId':_0x4e7334[_0xeb92('0x3')],'phone':_0x4e7334[_0xeb92('0x4')]},'raw':![]},'log':'GetCmHopperBlack'});};exports['checkIsBlackListIvr']=function(_0x21e53f){return client['Request'](_0xeb92('0x2'),{'options':{'where':{'CampaignId':_0x21e53f[_0xeb92('0x5')],'phone':_0x21e53f[_0xeb92('0x4')]},'raw':![]},'log':_0xeb92('0x6')});}; \ No newline at end of file +var _0x9bf3=['CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','phone','checkIsBlackListIvr'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x9bf3,0x112));var _0x39bf=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x9bf3[_0x18a79d];return _0x4f8848;};'use strict';var client=require(_0x39bf('0x0'));exports[_0x39bf('0x1')]=function(_0x324e20){return client[_0x39bf('0x2')](_0x39bf('0x3'),{'options':{'where':{'VoiceQueueId':_0x324e20['VoiceQueueId'],'phone':_0x324e20[_0x39bf('0x4')]},'raw':![]},'log':_0x39bf('0x3')});};exports[_0x39bf('0x5')]=function(_0x28309a){return client['Request'](_0x39bf('0x3'),{'options':{'where':{'CampaignId':_0x28309a[_0x39bf('0x6')],'phone':_0x28309a['phone']},'raw':![]},'log':_0x39bf('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index be402aa..a4f7099 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5ae=['Request','CreateCmHopperFinal','createContact','campaign'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xc5ae,0x156));var _0xec5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc5ae[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xec5a('0x0')]=function(_0x209520){return function(){_0x209520[_0xec5a('0x1')]=_0x209520['queue'];return client[_0xec5a('0x2')](_0xec5a('0x3'),{'body':_0x209520,'log':_0xec5a('0x3')});};}; \ No newline at end of file +var _0xbc8b=['../client','createContact','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbc8b,0xcc));var _0xbbc8=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xbc8b[_0x2e7a43];return _0x52e9e1;};'use strict';var client=require(_0xbbc8('0x0'));exports[_0xbbc8('0x1')]=function(_0x176959){return function(){_0x176959[_0xbbc8('0x2')]=_0x176959[_0xbbc8('0x3')];return client[_0xbbc8('0x4')](_0xbbc8('0x5'),{'body':_0x176959,'log':_0xbbc8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 734c618..8d8d6f8 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb40e=['../client','createHistory','queue','CreateCmHopperHistory','Request','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','endOf','day','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','ivr'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb40e,0x120));var _0xeb40=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb40e[_0x52e68e];return _0x3211a4;};'use strict';var client=require(_0xeb40('0x0'));var moment=require('moment');exports[_0xeb40('0x1')]=function(_0x4e61fb){_0x4e61fb['campaign']=_0x4e61fb[_0xeb40('0x2')];return client['Request'](_0xeb40('0x3'),{'body':_0x4e61fb,'log':_0xeb40('0x3')});};exports['avgHandleTime']=function(_0x152caa){return client[_0xeb40('0x4')](_0xeb40('0x5'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x152caa,_0xeb40('0x6'))[_0xeb40('0x7')](_0xeb40('0x8')),moment()[_0xeb40('0x7')](_0xeb40('0x8'))]}},'raw':![]},'log':_0xeb40('0x9')});};exports[_0xeb40('0xa')]=function(){return function(){return client[_0xeb40('0x4')](_0xeb40('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xeb40('0x7')](_0xeb40('0x8')),moment()[_0xeb40('0xc')](_0xeb40('0xd'))[_0xeb40('0x7')](_0xeb40('0x8'))]},'campaigntype':_0xeb40('0x2')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0xeb40('0xe')]=function(){return function(){return client[_0xeb40('0x4')](_0xeb40('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xeb40('0x10')](_0xeb40('0xd'))[_0xeb40('0x7')](_0xeb40('0x8')),moment()['endOf'](_0xeb40('0xd'))[_0xeb40('0x7')](_0xeb40('0x8'))]},'campaigntype':_0xeb40('0x11')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0xaa3f=['CreateCmHopperHistory','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','Request','startOf','day','endOf','queue','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','campaign'];(function(_0x2b5c84,_0x49f72a){var _0x8786d4=function(_0xbaea33){while(--_0xbaea33){_0x2b5c84['push'](_0x2b5c84['shift']());}};_0x8786d4(++_0x49f72a);}(_0xaa3f,0x95));var _0xfaa3=function(_0x1eda5b,_0x4d2cce){_0x1eda5b=_0x1eda5b-0x0;var _0x393f38=_0xaa3f[_0x1eda5b];return _0x393f38;};'use strict';var client=require(_0xfaa3('0x0'));var moment=require(_0xfaa3('0x1'));exports['createHistory']=function(_0x328553){_0x328553[_0xfaa3('0x2')]=_0x328553['queue'];return client['Request'](_0xfaa3('0x3'),{'body':_0x328553,'log':_0xfaa3('0x3')});};exports['avgHandleTime']=function(_0x39f49f){return client['Request'](_0xfaa3('0x4'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x39f49f,_0xfaa3('0x5'))[_0xfaa3('0x6')](_0xfaa3('0x7')),moment()['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0xfaa3('0x8')});};exports[_0xfaa3('0x9')]=function(){return function(){return client[_0xfaa3('0xa')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xfaa3('0xb')](_0xfaa3('0xc'))['format'](_0xfaa3('0x7')),moment()[_0xfaa3('0xd')](_0xfaa3('0xc'))['format'](_0xfaa3('0x7'))]},'campaigntype':_0xfaa3('0xe')},'raw':![]},'log':_0xfaa3('0xf')});};};exports[_0xfaa3('0x10')]=function(){return function(){return client['Request'](_0xfaa3('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xfaa3('0xb')](_0xfaa3('0xc'))[_0xfaa3('0x6')](_0xfaa3('0x7')),moment()[_0xfaa3('0xd')]('day')[_0xfaa3('0x6')](_0xfaa3('0x7'))]},'campaigntype':_0xfaa3('0x12')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index e822c46..2176787 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f2f=['GetFaxAccount','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','ListId','key','Trunk','name','callerid','active','NotifyFaxAccount','Request'];(function(_0x3cce74,_0x283275){var _0x70b1c7=function(_0x586021){while(--_0x586021){_0x3cce74['push'](_0x3cce74['shift']());}};_0x70b1c7(++_0x283275);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x4f2f[_0x9df060];return _0x338dfe;};'use strict';var client=require('../client');exports['getFaxAccounts']=function(){return function(){return client[_0xf4f2('0x0')](_0xf4f2('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xf4f2('0x2'),_0xf4f2('0x3'),_0xf4f2('0x4'),_0xf4f2('0x5'),_0xf4f2('0x6'),_0xf4f2('0x7'),_0xf4f2('0x8'),_0xf4f2('0x9'),_0xf4f2('0xa'),_0xf4f2('0xb'),_0xf4f2('0xc'),'TrunkId',_0xf4f2('0xd'),_0xf4f2('0xe')],'include':[{'model':'Trunk','as':_0xf4f2('0xf'),'attributes':['id',_0xf4f2('0x10'),_0xf4f2('0x11'),_0xf4f2('0x12')]}]},'log':'getFaxAccount'});};};exports['notify']=function(_0x4b44d9,_0x4ffa40){return client[_0xf4f2('0x0')](_0xf4f2('0x13'),{'account':{'id':_0x4b44d9},'body':_0x4ffa40,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0xd117=['maxrate','modem','gateway','faxdetect','t38timeout','tech','ListId','key','Trunk','callerid','active','notify','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd117,0x182));var _0x7d11=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xd117[_0x11a220];return _0x20d8fe;};'use strict';var client=require(_0x7d11('0x0'));exports[_0x7d11('0x1')]=function(){return function(){return client[_0x7d11('0x2')](_0x7d11('0x3'),{'options':{'raw':![],'attributes':['id',_0x7d11('0x4'),_0x7d11('0x5'),_0x7d11('0x6'),_0x7d11('0x7'),_0x7d11('0x8'),_0x7d11('0x9'),_0x7d11('0xa'),_0x7d11('0xb'),_0x7d11('0xc'),_0x7d11('0xd'),_0x7d11('0xe'),_0x7d11('0xf'),'TrunkId',_0x7d11('0x10'),_0x7d11('0x11')],'include':[{'model':_0x7d11('0x12'),'as':'Trunk','attributes':['id',_0x7d11('0x4'),_0x7d11('0x13'),_0x7d11('0x14')]}]},'log':'getFaxAccount'});};};exports[_0x7d11('0x15')]=function(_0x48b0f1,_0x58a6fd){return client[_0x7d11('0x2')]('NotifyFaxAccount',{'account':{'id':_0x48b0f1},'body':_0x58a6fd,'log':'NotifyFaxAccount'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index ea5c698..92a114d 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c58=['UpdateFaxMessage','update','Request'];(function(_0x4102cc,_0x1c5fa9){var _0x4b9b5c=function(_0x561ac8){while(--_0x561ac8){_0x4102cc['push'](_0x4102cc['shift']());}};_0x4b9b5c(++_0x1c5fa9);}(_0x8c58,0x1f3));var _0x88c5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x8c58[_0xe66cf2];return _0x2d84e7;};'use strict';var client=require('../client');exports[_0x88c5('0x0')]=function(_0x455305,_0x28e39a){return client[_0x88c5('0x1')](_0x88c5('0x2'),{'body':_0x28e39a,'options':{'where':{'AttachmentId':_0x455305}},'log':_0x88c5('0x2')});}; \ No newline at end of file +var _0xd215=['UpdateFaxMessage','../client','update'];(function(_0x5138d1,_0x23d46d){var _0x422c8c=function(_0x5502d0){while(--_0x5502d0){_0x5138d1['push'](_0x5138d1['shift']());}};_0x422c8c(++_0x23d46d);}(_0xd215,0x172));var _0x5d21=function(_0x4bc370,_0x36882f){_0x4bc370=_0x4bc370-0x0;var _0x1a87bf=_0xd215[_0x4bc370];return _0x1a87bf;};'use strict';var client=require(_0x5d21('0x0'));exports[_0x5d21('0x1')]=function(_0x1c3440,_0x4e4c47){return client['Request']('UpdateFaxMessage',{'body':_0x4e4c47,'options':{'where':{'AttachmentId':_0x1c3440}},'log':_0x5d21('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index c212e90..187cc92 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0519=['name','username','remoteUri','authType','type','DeskConfiguration','Configurations','DeskField','Subjects','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','Tags','../../client','getDeskAccounts','GetDeskAccount'];(function(_0x563330,_0x4597c4){var _0x12544a=function(_0x14bb5d){while(--_0x14bb5d){_0x563330['push'](_0x563330['shift']());}};_0x12544a(++_0x4597c4);}(_0x0519,0x128));var _0x9051=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x0519[_0x31b5b2];return _0x364f13;};'use strict';var client=require(_0x9051('0x0'));exports[_0x9051('0x1')]=function(){return function(_0xe69914){return client['Request'](_0x9051('0x2'),{'options':{'raw':![],'attributes':['id',_0x9051('0x3'),'description',_0x9051('0x4'),'password',_0x9051('0x5'),_0x9051('0x6'),_0x9051('0x7'),'serverUrl'],'include':[{'model':_0x9051('0x8'),'as':_0x9051('0x9'),'attributes':['id','name'],'include':[{'model':_0x9051('0xa'),'as':_0x9051('0xb'),'attributes':['id',_0x9051('0x7'),_0x9051('0xc'),'variableName'],'include':[{'model':_0x9051('0xd'),'as':_0x9051('0xd'),'attributes':['id',_0x9051('0x3')]}]},{'model':_0x9051('0xa'),'as':_0x9051('0xe'),'attributes':['id',_0x9051('0x7'),_0x9051('0xc'),_0x9051('0xf'),_0x9051('0x10'),_0x9051('0x11'),_0x9051('0x12')],'include':[{'model':_0x9051('0xd'),'as':_0x9051('0xd'),'attributes':['id',_0x9051('0x3')]}]},{'model':_0x9051('0xa'),'as':_0x9051('0x13'),'attributes':['id','type',_0x9051('0xc'),_0x9051('0x14'),_0x9051('0x15'),'customField',_0x9051('0x12')],'include':[{'model':_0x9051('0xd'),'as':_0x9051('0xd'),'attributes':['id',_0x9051('0x3')]}]},{'model':'Tag','as':_0x9051('0x16'),'attributes':['id',_0x9051('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x68b5=['variableName','Variable','key','keyContent','Fields','idField','nameField','Tag','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content'];(function(_0x73ed0f,_0xd3a672){var _0x2ed688=function(_0x4a43d7){while(--_0x4a43d7){_0x73ed0f['push'](_0x73ed0f['shift']());}};_0x2ed688(++_0xd3a672);}(_0x68b5,0x68));var _0x568b=function(_0x2c6a2b,_0x52e433){_0x2c6a2b=_0x2c6a2b-0x0;var _0x329168=_0x68b5[_0x2c6a2b];return _0x329168;};'use strict';var client=require(_0x568b('0x0'));exports[_0x568b('0x1')]=function(){return function(_0x309a1d){return client[_0x568b('0x2')](_0x568b('0x3'),{'options':{'raw':![],'attributes':['id',_0x568b('0x4'),_0x568b('0x5'),_0x568b('0x6'),'password',_0x568b('0x7'),_0x568b('0x8'),_0x568b('0x9'),_0x568b('0xa')],'include':[{'model':_0x568b('0xb'),'as':_0x568b('0xc'),'attributes':['id',_0x568b('0x4')],'include':[{'model':_0x568b('0xd'),'as':_0x568b('0xe'),'attributes':['id',_0x568b('0x9'),_0x568b('0xf'),_0x568b('0x10')],'include':[{'model':_0x568b('0x11'),'as':_0x568b('0x11'),'attributes':['id',_0x568b('0x4')]}]},{'model':_0x568b('0xd'),'as':'Descriptions','attributes':['id',_0x568b('0x9'),_0x568b('0xf'),_0x568b('0x12'),'keyType',_0x568b('0x13'),_0x568b('0x10')],'include':[{'model':'Variable','as':_0x568b('0x11'),'attributes':['id',_0x568b('0x4')]}]},{'model':_0x568b('0xd'),'as':_0x568b('0x14'),'attributes':['id',_0x568b('0x9'),_0x568b('0xf'),_0x568b('0x15'),_0x568b('0x16'),'customField',_0x568b('0x10')],'include':[{'model':_0x568b('0x11'),'as':'Variable','attributes':['id',_0x568b('0x4')]}]},{'model':_0x568b('0x17'),'as':'Tags','attributes':['id',_0x568b('0x4')]}]}]},'log':_0x568b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 9cccbe5..0fd5deb 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7033=['variableName','Descriptions','key','Variable','Fields','idField','nameField','customField','CloudProvider','data2','data7','../../client','getDynamics365Accounts','Request','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','type','content'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7033,0x19e));var _0x3703=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7033[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x3703('0x0'));exports[_0x3703('0x1')]=function(){return function(_0x43eee5){return client[_0x3703('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0x3703('0x3'),_0x3703('0x4'),_0x3703('0x5'),_0x3703('0x6'),_0x3703('0x7'),_0x3703('0x8'),_0x3703('0x9'),_0x3703('0xa'),_0x3703('0xb'),_0x3703('0xc')],'include':[{'model':'Dynamics365Configuration','as':'Configurations','attributes':['id','name',_0x3703('0xd'),_0x3703('0xe'),_0x3703('0xf'),_0x3703('0x10')],'include':[{'model':_0x3703('0x11'),'as':'Subjects','attributes':['id',_0x3703('0x12'),_0x3703('0x13'),_0x3703('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3703('0x3')]}]},{'model':'Dynamics365Field','as':_0x3703('0x15'),'attributes':['id',_0x3703('0x12'),_0x3703('0x13'),_0x3703('0x16'),'keyType','keyContent',_0x3703('0x14')],'include':[{'model':_0x3703('0x17'),'as':_0x3703('0x17'),'attributes':['id',_0x3703('0x3')]}]},{'model':_0x3703('0x11'),'as':_0x3703('0x18'),'attributes':['id',_0x3703('0x12'),_0x3703('0x13'),_0x3703('0x19'),_0x3703('0x1a'),_0x3703('0x1b'),_0x3703('0x14')],'include':[{'model':_0x3703('0x17'),'as':_0x3703('0x17'),'attributes':['id','name']}]}]},{'model':_0x3703('0x1c'),'as':'CloudProvider','attributes':['id',_0x3703('0x1d'),'data5',_0x3703('0x1e')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file +var _0xd4dc=['content','variableName','Variable','Descriptions','type','key','keyType','Fields','idField','nameField','customField','CloudProvider','data2','data5','data7','../../client','Request','GetDynamics365Account','name','username','password','remoteUri','clientId','description','Dynamics365Configuration','Configurations','ticketType','moduleCreate','Dynamics365Field','Subjects'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0xd4dc,0xff));var _0xcd4d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd4dc[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xcd4d('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x2712ce){return client[_0xcd4d('0x1')](_0xcd4d('0x2'),{'options':{'raw':![],'attributes':['id',_0xcd4d('0x3'),_0xcd4d('0x4'),_0xcd4d('0x5'),_0xcd4d('0x6'),'tenantId',_0xcd4d('0x7'),'clientSecret','serverUrl',_0xcd4d('0x8'),'modernAuthentication'],'include':[{'model':_0xcd4d('0x9'),'as':_0xcd4d('0xa'),'attributes':['id',_0xcd4d('0x3'),_0xcd4d('0xb'),_0xcd4d('0xc'),'additionalSearchContact','openNewTab'],'include':[{'model':_0xcd4d('0xd'),'as':_0xcd4d('0xe'),'attributes':['id','type',_0xcd4d('0xf'),_0xcd4d('0x10')],'include':[{'model':_0xcd4d('0x11'),'as':'Variable','attributes':['id',_0xcd4d('0x3')]}]},{'model':'Dynamics365Field','as':_0xcd4d('0x12'),'attributes':['id',_0xcd4d('0x13'),_0xcd4d('0xf'),_0xcd4d('0x14'),_0xcd4d('0x15'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0xcd4d('0x11'),'attributes':['id',_0xcd4d('0x3')]}]},{'model':_0xcd4d('0xd'),'as':_0xcd4d('0x16'),'attributes':['id',_0xcd4d('0x13'),_0xcd4d('0xf'),_0xcd4d('0x17'),_0xcd4d('0x18'),_0xcd4d('0x19'),_0xcd4d('0x10')],'include':[{'model':'Variable','as':_0xcd4d('0x11'),'attributes':['id',_0xcd4d('0x3')]}]}]},{'model':_0xcd4d('0x1a'),'as':_0xcd4d('0x1a'),'attributes':['id',_0xcd4d('0x1b'),_0xcd4d('0x1c'),_0xcd4d('0x1d')]}]},'log':_0xcd4d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 67439dd..e53e5bc 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3308=['Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','Fields','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','serverUrl','Configurations'];(function(_0x449b81,_0x4b2a6f){var _0xb9b60c=function(_0x2e9e0a){while(--_0x2e9e0a){_0x449b81['push'](_0x449b81['shift']());}};_0xb9b60c(++_0x4b2a6f);}(_0x3308,0x160));var _0x8330=function(_0x1ff766,_0x35481a){_0x1ff766=_0x1ff766-0x0;var _0x1692f2=_0x3308[_0x1ff766];return _0x1692f2;};'use strict';var client=require(_0x8330('0x0'));exports[_0x8330('0x1')]=function(){return function(_0x20dac5){return client[_0x8330('0x2')](_0x8330('0x3'),{'options':{'raw':![],'attributes':['id',_0x8330('0x4'),_0x8330('0x5'),'apiKey','remoteUri',_0x8330('0x6')],'include':[{'model':'FreshdeskConfiguration','as':_0x8330('0x7'),'attributes':['id',_0x8330('0x4')],'include':[{'model':_0x8330('0x8'),'attributes':['id','name']},{'model':_0x8330('0x9'),'as':_0x8330('0xa'),'attributes':['id',_0x8330('0xb'),_0x8330('0xc'),_0x8330('0xd')],'include':[{'model':_0x8330('0xe'),'as':'Variable','attributes':['id',_0x8330('0x4')]}]},{'model':_0x8330('0x9'),'as':_0x8330('0xf'),'attributes':['id','type','content','key','keyType','keyContent','variableName'],'include':[{'model':_0x8330('0xe'),'as':'Variable','attributes':['id',_0x8330('0x4')]}]},{'model':_0x8330('0x9'),'as':_0x8330('0x10'),'attributes':['id',_0x8330('0xb'),_0x8330('0xc'),'idField',_0x8330('0x11'),'customField',_0x8330('0xd')],'include':[{'model':_0x8330('0xe'),'as':_0x8330('0xe'),'attributes':['id',_0x8330('0x4')]}]}]}]},'log':_0x8330('0x3')});};}; \ No newline at end of file +var _0xb627=['content','Variable','Descriptions','type','key','keyType','keyContent','variableName','Fields','idField','customField','GetFreshdeskAccount','../../client','Request','name','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects'];(function(_0x1f0a78,_0x54ae1f){var _0x2a706d=function(_0x23bf96){while(--_0x23bf96){_0x1f0a78['push'](_0x1f0a78['shift']());}};_0x2a706d(++_0x54ae1f);}(_0xb627,0x144));var _0x7b62=function(_0x27c6b5,_0x5589f4){_0x27c6b5=_0x27c6b5-0x0;var _0x28007d=_0xb627[_0x27c6b5];return _0x28007d;};'use strict';var client=require(_0x7b62('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x486023){return client[_0x7b62('0x1')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x7b62('0x2'),_0x7b62('0x3'),_0x7b62('0x4'),_0x7b62('0x5'),_0x7b62('0x6')],'include':[{'model':_0x7b62('0x7'),'as':_0x7b62('0x8'),'attributes':['id','name'],'include':[{'model':_0x7b62('0x9'),'attributes':['id','name']},{'model':_0x7b62('0xa'),'as':_0x7b62('0xb'),'attributes':['id','type',_0x7b62('0xc'),'variableName'],'include':[{'model':_0x7b62('0xd'),'as':_0x7b62('0xd'),'attributes':['id',_0x7b62('0x2')]}]},{'model':'FreshdeskField','as':_0x7b62('0xe'),'attributes':['id',_0x7b62('0xf'),_0x7b62('0xc'),_0x7b62('0x10'),_0x7b62('0x11'),_0x7b62('0x12'),_0x7b62('0x13')],'include':[{'model':_0x7b62('0xd'),'as':_0x7b62('0xd'),'attributes':['id',_0x7b62('0x2')]}]},{'model':_0x7b62('0xa'),'as':_0x7b62('0x14'),'attributes':['id',_0x7b62('0xf'),'content',_0x7b62('0x15'),'nameField',_0x7b62('0x16'),'variableName'],'include':[{'model':_0x7b62('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x7b62('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 7cf1192..a3dc2f6 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236d=['variableName','Variable','type','content','key','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','name','username','apiKey','remoteUri','Configurations','FreshsalesField','Subjects'];(function(_0x15d4d8,_0x447edc){var _0x1ca21f=function(_0x4e903a){while(--_0x4e903a){_0x15d4d8['push'](_0x15d4d8['shift']());}};_0x1ca21f(++_0x447edc);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd236('0x0'));exports[_0xd236('0x1')]=function(){return function(_0x5b2229){return client[_0xd236('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0xd236('0x3'),_0xd236('0x4'),_0xd236('0x5'),_0xd236('0x6'),'serverUrl'],'include':[{'model':'FreshsalesConfiguration','as':_0xd236('0x7'),'attributes':['id',_0xd236('0x3')],'include':[{'model':_0xd236('0x8'),'as':_0xd236('0x9'),'attributes':['id','type','content',_0xd236('0xa')],'include':[{'model':_0xd236('0xb'),'as':'Variable','attributes':['id',_0xd236('0x3')]}]},{'model':_0xd236('0x8'),'as':'Descriptions','attributes':['id',_0xd236('0xc'),_0xd236('0xd'),_0xd236('0xe'),'keyType',_0xd236('0xf'),_0xd236('0xa')],'include':[{'model':_0xd236('0xb'),'as':'Variable','attributes':['id',_0xd236('0x3')]}]}]}]},'log':_0xd236('0x10')});};}; \ No newline at end of file +var _0xfd20=['apiKey','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','content','variableName','Variable','Descriptions','key','keyContent','GetFreshsalesccount','getFreshsalesAccounts','GetFreshsalesAccount','name'];(function(_0x381038,_0x58baed){var _0x2ca21a=function(_0x2dc530){while(--_0x2dc530){_0x381038['push'](_0x381038['shift']());}};_0x2ca21a(++_0x58baed);}(_0xfd20,0x66));var _0x0fd2=function(_0x24fef8,_0x470e9b){_0x24fef8=_0x24fef8-0x0;var _0x517938=_0xfd20[_0x24fef8];return _0x517938;};'use strict';var client=require('../../client');exports[_0x0fd2('0x0')]=function(){return function(_0x4ab0a6){return client['Request'](_0x0fd2('0x1'),{'options':{'raw':![],'attributes':['id',_0x0fd2('0x2'),'username',_0x0fd2('0x3'),'remoteUri',_0x0fd2('0x4')],'include':[{'model':_0x0fd2('0x5'),'as':_0x0fd2('0x6'),'attributes':['id',_0x0fd2('0x2')],'include':[{'model':_0x0fd2('0x7'),'as':'Subjects','attributes':['id','type',_0x0fd2('0x8'),_0x0fd2('0x9')],'include':[{'model':_0x0fd2('0xa'),'as':_0x0fd2('0xa'),'attributes':['id',_0x0fd2('0x2')]}]},{'model':_0x0fd2('0x7'),'as':_0x0fd2('0xb'),'attributes':['id','type',_0x0fd2('0x8'),_0x0fd2('0xc'),'keyType',_0x0fd2('0xd'),'variableName'],'include':[{'model':_0x0fd2('0xa'),'as':_0x0fd2('0xa'),'attributes':['id',_0x0fd2('0x2')]}]}]}]},'log':_0x0fd2('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 7b6dd77..ed6a669 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf264=['moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','SalesforceField','Subjects','Descriptions','Variable','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','Request','name','password','clientId','securityToken','serverUrl','type','SalesforceConfiguration','Configurations'];(function(_0x15d8bb,_0x6ffe31){var _0x42c1d9=function(_0x1416a5){while(--_0x1416a5){_0x15d8bb['push'](_0x15d8bb['shift']());}};_0x42c1d9(++_0x6ffe31);}(_0xf264,0xfd));var _0x4f26=function(_0x8eb387,_0x3ec776){_0x8eb387=_0x8eb387-0x0;var _0x54ff5c=_0xf264[_0x8eb387];return _0x54ff5c;};'use strict';var client=require(_0x4f26('0x0'));exports[_0x4f26('0x1')]=function(){return function(_0x130ae2){return client[_0x4f26('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x4f26('0x3'),'username',_0x4f26('0x4'),'remoteUri',_0x4f26('0x5'),'clientSecret',_0x4f26('0x6'),_0x4f26('0x7'),_0x4f26('0x8')],'include':[{'model':_0x4f26('0x9'),'as':_0x4f26('0xa'),'attributes':['id','name','moduleSearch',_0x4f26('0xb'),_0x4f26('0xc'),_0x4f26('0xd'),_0x4f26('0xe'),_0x4f26('0xf'),'additionalSearchLead'],'include':[{'model':_0x4f26('0x10'),'as':_0x4f26('0x11'),'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x4f26('0x10'),'as':_0x4f26('0x12'),'include':[{'model':_0x4f26('0x13'),'as':_0x4f26('0x13'),'attributes':['id','name']}]},{'model':_0x4f26('0x10'),'as':_0x4f26('0x14'),'include':[{'model':_0x4f26('0x13'),'as':'Variable','attributes':['id',_0x4f26('0x3')]}]}]}]},'log':_0x4f26('0x15')});};}; \ No newline at end of file +var _0xd983=['password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','Configurations','name','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Variable','SalesforceField','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xd983,0x1df));var _0x3d98=function(_0x4d84ff,_0x137292){_0x4d84ff=_0x4d84ff-0x0;var _0x45ba7a=_0xd983[_0x4d84ff];return _0x45ba7a;};'use strict';var client=require(_0x3d98('0x0'));exports[_0x3d98('0x1')]=function(){return function(_0x424803){return client[_0x3d98('0x2')](_0x3d98('0x3'),{'options':{'raw':![],'attributes':['id','name','username',_0x3d98('0x4'),_0x3d98('0x5'),_0x3d98('0x6'),_0x3d98('0x7'),_0x3d98('0x8'),_0x3d98('0x9'),_0x3d98('0xa')],'include':[{'model':'SalesforceConfiguration','as':_0x3d98('0xb'),'attributes':['id',_0x3d98('0xc'),_0x3d98('0xd'),_0x3d98('0xe'),_0x3d98('0xf'),_0x3d98('0x10'),_0x3d98('0x11'),_0x3d98('0x12'),_0x3d98('0x13')],'include':[{'model':'SalesforceField','as':'Subjects','include':[{'model':_0x3d98('0x14'),'as':_0x3d98('0x14'),'attributes':['id',_0x3d98('0xc')]}]},{'model':_0x3d98('0x15'),'as':'Descriptions','include':[{'model':'Variable','as':_0x3d98('0x14'),'attributes':['id',_0x3d98('0xc')]}]},{'model':_0x3d98('0x15'),'as':_0x3d98('0x16'),'include':[{'model':'Variable','as':_0x3d98('0x14'),'attributes':['id',_0x3d98('0xc')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 8eb79c5..c042995 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(){return function(_0x370399){return client[_0x7413('0x2')](_0x7413('0x3'),{'options':{'raw':![],'attributes':['id',_0x7413('0x4'),_0x7413('0x5'),_0x7413('0x6'),_0x7413('0x7'),_0x7413('0x8'),_0x7413('0x9'),_0x7413('0xa')],'include':[{'model':'ServicenowConfiguration','as':_0x7413('0xb'),'attributes':['id',_0x7413('0x4')],'include':[{'model':_0x7413('0xc'),'as':_0x7413('0xd'),'attributes':['id','type',_0x7413('0xe'),_0x7413('0xf')],'include':[{'model':'Variable','as':_0x7413('0x10'),'attributes':['id',_0x7413('0x4')]}]},{'model':'ServicenowField','as':_0x7413('0x11'),'attributes':['id',_0x7413('0x12'),_0x7413('0xe'),_0x7413('0x13'),_0x7413('0x14'),'keyContent',_0x7413('0xf')],'include':[{'model':_0x7413('0x10'),'as':'Variable','attributes':['id',_0x7413('0x4')]}]},{'model':_0x7413('0xc'),'as':_0x7413('0x15'),'attributes':['id','type','content','idField',_0x7413('0x16'),_0x7413('0x17'),'variableName'],'include':[{'model':_0x7413('0x10'),'as':_0x7413('0x10'),'attributes':['id','name']}]}]}]},'log':_0x7413('0x18')});};}; \ No newline at end of file +var _0x326f=['variableName','GetServicenowkAccount','../../client','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','ServicenowField','Subjects','type','Variable','Descriptions','key','keyContent','content','idField','nameField'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x326f,0xd1));var _0xf326=function(_0x3201f4,_0x35c43c){_0x3201f4=_0x3201f4-0x0;var _0x146b24=_0x326f[_0x3201f4];return _0x146b24;};'use strict';var client=require(_0xf326('0x0'));exports['getServicenowAccounts']=function(){return function(_0x5452cc){return client[_0xf326('0x1')](_0xf326('0x2'),{'options':{'raw':![],'attributes':['id',_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9')],'include':[{'model':_0xf326('0xa'),'as':'Configurations','attributes':['id',_0xf326('0x3')],'include':[{'model':_0xf326('0xb'),'as':_0xf326('0xc'),'attributes':['id',_0xf326('0xd'),'content','variableName'],'include':[{'model':'Variable','as':_0xf326('0xe'),'attributes':['id',_0xf326('0x3')]}]},{'model':_0xf326('0xb'),'as':_0xf326('0xf'),'attributes':['id',_0xf326('0xd'),'content',_0xf326('0x10'),'keyType',_0xf326('0x11'),'variableName'],'include':[{'model':_0xf326('0xe'),'as':'Variable','attributes':['id',_0xf326('0x3')]}]},{'model':_0xf326('0xb'),'as':'Fields','attributes':['id',_0xf326('0xd'),_0xf326('0x12'),_0xf326('0x13'),_0xf326('0x14'),'customField',_0xf326('0x15')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xf326('0x3')]}]}]}]},'log':_0xf326('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 6f9b8fa..3b3c31c 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['nameField','customField','../../client','getSugarcrmAccounts','GetSugarcrmAccount','name','password','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','variableName','Fields','idField'];(function(_0x2739ef,_0x4203e8){var _0x426714=function(_0x48dbf8){while(--_0x48dbf8){_0x2739ef['push'](_0x2739ef['shift']());}};_0x426714(++_0x4203e8);}(_0x7a54,0x106));var _0x47a5=function(_0x2840d3,_0x2e643f){_0x2840d3=_0x2840d3-0x0;var _0x48b289=_0x7a54[_0x2840d3];return _0x48b289;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'username',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6')],'include':[{'model':_0x47a5('0x7'),'as':_0x47a5('0x8'),'attributes':['id','name'],'include':[{'model':_0x47a5('0x9'),'as':'Subjects','attributes':['id',_0x47a5('0xa'),_0x47a5('0xb'),'variableName'],'include':[{'model':_0x47a5('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':'SugarcrmField','as':_0x47a5('0xd'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0xe'),'keyType','keyContent',_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0x9'),'as':_0x47a5('0x10'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]}]}]},'log':_0x47a5('0x2')});};}; \ No newline at end of file +var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0x2ba1ca,_0x4f07ea){var _0xaf5c2d=function(_0x3ebc9b){while(--_0x3ebc9b){_0x2ba1ca['push'](_0x2ba1ca['shift']());}};_0xaf5c2d(++_0x4f07ea);}(_0x2ef3,0xba));var _0x32ef=function(_0x72abea,_0x1aa550){_0x72abea=_0x72abea-0x0;var _0x1d221a=_0x2ef3[_0x72abea];return _0x1d221a;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'username',_0x32ef('0x5'),_0x32ef('0x6'),'serverUrl'],'include':[{'model':_0x32ef('0x7'),'as':_0x32ef('0x8'),'attributes':['id','name'],'include':[{'model':'SugarcrmField','as':_0x32ef('0x9'),'attributes':['id',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0xe'),'as':_0x32ef('0xf'),'attributes':['id',_0x32ef('0xa'),'content','key',_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'SugarcrmField','as':_0x32ef('0x12'),'attributes':['id','type',_0x32ef('0xb'),_0x32ef('0x13'),'nameField','customField',_0x32ef('0xc')],'include':[{'model':'Variable','as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':_0x32ef('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 87e8ccb..875936f 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf830=['variableName','Variable','Descriptions','keyType','Fields','idField','getVtigerAccounts','GetVtigerAccount','name','username','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','type'];(function(_0x38e558,_0x2937e9){var _0x2b1048=function(_0x5f23cd){while(--_0x5f23cd){_0x38e558['push'](_0x38e558['shift']());}};_0x2b1048(++_0x2937e9);}(_0xf830,0x146));var _0x0f83=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xf830[_0x10852d];return _0x13a8d6;};'use strict';var client=require('../../client');exports[_0x0f83('0x0')]=function(){return function(_0xc55515){return client['Request'](_0x0f83('0x1'),{'options':{'raw':![],'attributes':['id',_0x0f83('0x2'),'description',_0x0f83('0x3'),'accessKey',_0x0f83('0x4'),_0x0f83('0x5')],'include':[{'model':_0x0f83('0x6'),'as':_0x0f83('0x7'),'attributes':['id',_0x0f83('0x2')],'include':[{'model':_0x0f83('0x8'),'as':'Subjects','attributes':['id',_0x0f83('0x9'),'content',_0x0f83('0xa')],'include':[{'model':'Variable','as':_0x0f83('0xb'),'attributes':['id',_0x0f83('0x2')]}]},{'model':'VtigerField','as':_0x0f83('0xc'),'attributes':['id',_0x0f83('0x9'),'content','key',_0x0f83('0xd'),'keyContent','variableName'],'include':[{'model':_0x0f83('0xb'),'as':_0x0f83('0xb'),'attributes':['id','name']}]},{'model':_0x0f83('0x8'),'as':_0x0f83('0xe'),'attributes':['id','type','content',_0x0f83('0xf'),'nameField','customField',_0x0f83('0xa')],'include':[{'model':'Variable','as':_0x0f83('0xb'),'attributes':['id',_0x0f83('0x2')]}]}]}]},'log':_0x0f83('0x1')});};}; \ No newline at end of file +var _0x91e1=['customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','keyContent','Fields'];(function(_0xddf2eb,_0x4bc8ab){var _0x39948f=function(_0x4da182){while(--_0x4da182){_0xddf2eb['push'](_0xddf2eb['shift']());}};_0x39948f(++_0x4bc8ab);}(_0x91e1,0x115));var _0x191e=function(_0x31ac7e,_0x387cbb){_0x31ac7e=_0x31ac7e-0x0;var _0x3df58e=_0x91e1[_0x31ac7e];return _0x3df58e;};'use strict';var client=require(_0x191e('0x0'));exports[_0x191e('0x1')]=function(){return function(_0x47cbf1){return client[_0x191e('0x2')](_0x191e('0x3'),{'options':{'raw':![],'attributes':['id',_0x191e('0x4'),_0x191e('0x5'),_0x191e('0x6'),_0x191e('0x7'),'remoteUri',_0x191e('0x8')],'include':[{'model':_0x191e('0x9'),'as':_0x191e('0xa'),'attributes':['id','name'],'include':[{'model':_0x191e('0xb'),'as':_0x191e('0xc'),'attributes':['id','type',_0x191e('0xd'),_0x191e('0xe')],'include':[{'model':_0x191e('0xf'),'as':'Variable','attributes':['id',_0x191e('0x4')]}]},{'model':'VtigerField','as':_0x191e('0x10'),'attributes':['id',_0x191e('0x11'),_0x191e('0xd'),_0x191e('0x12'),_0x191e('0x13'),_0x191e('0x14'),_0x191e('0xe')],'include':[{'model':_0x191e('0xf'),'as':_0x191e('0xf'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0x191e('0x15'),'attributes':['id',_0x191e('0x11'),_0x191e('0xd'),'idField','nameField',_0x191e('0x16'),'variableName'],'include':[{'model':_0x191e('0xf'),'as':'Variable','attributes':['id',_0x191e('0x4')]}]}]}]},'log':_0x191e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index e34b32a..b6f0ab4 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28c9=['content','key','keyType','keyContent','variableName','Fields','idField','nameField','GetZendeskAccount','getZendeskAccounts','Request','password','token','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','name','ZendeskField','Variable','Descriptions'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0x28c9,0xef));var _0x928c=function(_0x3c307c,_0x1b06c4){_0x3c307c=_0x3c307c-0x0;var _0x32cf08=_0x28c9[_0x3c307c];return _0x32cf08;};'use strict';var client=require('../../client');exports[_0x928c('0x0')]=function(){return function(_0x30dfd8){return client[_0x928c('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name','username',_0x928c('0x2'),_0x928c('0x3'),'remoteUri',_0x928c('0x4'),_0x928c('0x5'),_0x928c('0x6')],'include':[{'model':_0x928c('0x7'),'as':_0x928c('0x8'),'attributes':['id','name'],'include':[{'model':_0x928c('0x9'),'attributes':['id',_0x928c('0xa')]},{'model':_0x928c('0xb'),'as':'Subjects','attributes':['id',_0x928c('0x6'),'content','variableName'],'include':[{'model':_0x928c('0xc'),'as':_0x928c('0xc'),'attributes':['id',_0x928c('0xa')]}]},{'model':_0x928c('0xb'),'as':_0x928c('0xd'),'attributes':['id',_0x928c('0x6'),_0x928c('0xe'),_0x928c('0xf'),_0x928c('0x10'),_0x928c('0x11'),_0x928c('0x12')],'include':[{'model':_0x928c('0xc'),'as':_0x928c('0xc'),'attributes':['id','name']}]},{'model':_0x928c('0xb'),'as':_0x928c('0x13'),'attributes':['id',_0x928c('0x6'),_0x928c('0xe'),_0x928c('0x14'),_0x928c('0x15'),'customField',_0x928c('0x12')],'include':[{'model':'Variable','as':_0x928c('0xc'),'attributes':['id','name']}]}]}]},'log':_0x928c('0x16')});};}; \ No newline at end of file +var _0xe8ec=['Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','Request','username','token','remoteUri','serverUrl','ZendeskConfiguration','Configurations','Tag','name','ZendeskField','Subjects','content','variableName','Variable'];(function(_0x15e6e9,_0x2640ae){var _0x1c583d=function(_0xc4c9d8){while(--_0xc4c9d8){_0x15e6e9['push'](_0x15e6e9['shift']());}};_0x1c583d(++_0x2640ae);}(_0xe8ec,0x159));var _0xce8e=function(_0x347db7,_0x54d139){_0x347db7=_0x347db7-0x0;var _0x333418=_0xe8ec[_0x347db7];return _0x333418;};'use strict';var client=require(_0xce8e('0x0'));exports['getZendeskAccounts']=function(){return function(_0x525c15){return client[_0xce8e('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name',_0xce8e('0x2'),'password',_0xce8e('0x3'),_0xce8e('0x4'),'authType',_0xce8e('0x5'),'type'],'include':[{'model':_0xce8e('0x6'),'as':_0xce8e('0x7'),'attributes':['id','name'],'include':[{'model':_0xce8e('0x8'),'attributes':['id',_0xce8e('0x9')]},{'model':_0xce8e('0xa'),'as':_0xce8e('0xb'),'attributes':['id','type',_0xce8e('0xc'),_0xce8e('0xd')],'include':[{'model':_0xce8e('0xe'),'as':'Variable','attributes':['id',_0xce8e('0x9')]}]},{'model':_0xce8e('0xa'),'as':_0xce8e('0xf'),'attributes':['id',_0xce8e('0x10'),_0xce8e('0xc'),_0xce8e('0x11'),_0xce8e('0x12'),_0xce8e('0x13'),'variableName'],'include':[{'model':'Variable','as':_0xce8e('0xe'),'attributes':['id',_0xce8e('0x9')]}]},{'model':_0xce8e('0xa'),'as':_0xce8e('0x14'),'attributes':['id',_0xce8e('0x10'),'content',_0xce8e('0x15'),_0xce8e('0x16'),_0xce8e('0x17'),_0xce8e('0xd')],'include':[{'model':_0xce8e('0xe'),'as':_0xce8e('0xe'),'attributes':['id',_0xce8e('0x9')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 17a62cf..4b4aad5 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5131=['ZohoField','Descriptions','key','keyContent','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','serverUrl','refreshToken','Configurations','moduleCreate','moduleSearch','type','content','variableName','Variable'];(function(_0x4014b6,_0x2a5163){var _0x1552db=function(_0x5e1287){while(--_0x5e1287){_0x4014b6['push'](_0x4014b6['shift']());}};_0x1552db(++_0x2a5163);}(_0x5131,0x11b));var _0x1513=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5131[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x1513('0x0'));exports[_0x1513('0x1')]=function(){return function(_0x26a8fa){return client[_0x1513('0x2')](_0x1513('0x3'),{'options':{'raw':![],'attributes':['id',_0x1513('0x4'),_0x1513('0x5'),_0x1513('0x6'),'zone','clientId','clientSecret',_0x1513('0x7'),'code',_0x1513('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x1513('0x9'),'attributes':['id',_0x1513('0x4'),_0x1513('0xa'),_0x1513('0xb'),'description'],'include':[{'model':'ZohoField','as':'Subjects','attributes':['id',_0x1513('0xc'),_0x1513('0xd'),_0x1513('0xe')],'include':[{'model':_0x1513('0xf'),'as':'Variable','attributes':['id',_0x1513('0x4')]}]},{'model':_0x1513('0x10'),'as':_0x1513('0x11'),'attributes':['id','type',_0x1513('0xd'),_0x1513('0x12'),'keyType',_0x1513('0x13'),_0x1513('0xe')],'include':[{'model':_0x1513('0xf'),'as':_0x1513('0xf'),'attributes':['id',_0x1513('0x4')]}]},{'model':_0x1513('0x10'),'as':'Fields','attributes':['id',_0x1513('0xc'),_0x1513('0xd'),_0x1513('0x14'),_0x1513('0x15'),_0x1513('0x16'),_0x1513('0xe')],'include':[{'model':_0x1513('0xf'),'as':_0x1513('0xf'),'attributes':['id',_0x1513('0x4')]}]}]}]},'log':_0x1513('0x3')});};}; \ No newline at end of file +var _0xc672=['zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField','type','content','variableName','Variable','Descriptions','keyType','Fields','idField','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','name','description','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc672,0x7c));var _0x2c67=function(_0x5c455f,_0x189561){_0x5c455f=_0x5c455f-0x0;var _0x268cb9=_0xc672[_0x5c455f];return _0x268cb9;};'use strict';var client=require(_0x2c67('0x0'));exports[_0x2c67('0x1')]=function(){return function(_0x488c57){return client['Request'](_0x2c67('0x2'),{'options':{'raw':![],'attributes':['id',_0x2c67('0x3'),_0x2c67('0x4'),_0x2c67('0x5'),_0x2c67('0x6'),_0x2c67('0x7'),_0x2c67('0x8'),_0x2c67('0x9'),_0x2c67('0xa'),_0x2c67('0xb')],'include':[{'model':_0x2c67('0xc'),'as':_0x2c67('0xd'),'attributes':['id',_0x2c67('0x3'),'moduleCreate',_0x2c67('0xe'),_0x2c67('0x4')],'include':[{'model':_0x2c67('0xf'),'as':'Subjects','attributes':['id',_0x2c67('0x10'),_0x2c67('0x11'),_0x2c67('0x12')],'include':[{'model':_0x2c67('0x13'),'as':_0x2c67('0x13'),'attributes':['id',_0x2c67('0x3')]}]},{'model':_0x2c67('0xf'),'as':_0x2c67('0x14'),'attributes':['id',_0x2c67('0x10'),'content','key',_0x2c67('0x15'),'keyContent',_0x2c67('0x12')],'include':[{'model':_0x2c67('0x13'),'as':_0x2c67('0x13'),'attributes':['id',_0x2c67('0x3')]}]},{'model':_0x2c67('0xf'),'as':_0x2c67('0x16'),'attributes':['id',_0x2c67('0x10'),_0x2c67('0x11'),_0x2c67('0x17'),_0x2c67('0x18'),_0x2c67('0x19'),_0x2c67('0x12')],'include':[{'model':'Variable','as':_0x2c67('0x13'),'attributes':['id',_0x2c67('0x3')]}]}]}]},'log':_0x2c67('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 565c87c..80125df 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79b2=['length','resolve','every','string','map','concat','IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray'];(function(_0x35dadd,_0x3ed50f){var _0x2728ed=function(_0x80656f){while(--_0x80656f){_0x35dadd['push'](_0x35dadd['shift']());}};_0x2728ed(++_0x3ed50f);}(_0x79b2,0x68));var _0x279b=function(_0x22ba04,_0x228a16){_0x22ba04=_0x22ba04-0x0;var _0x24dfbb=_0x79b2[_0x22ba04];return _0x24dfbb;};var logger=require(_0x279b('0x0'))('dialer');var client=require(_0x279b('0x1'));function intervalIftime(_0xc31d19,_0x5b791a){const _0x3499bf=new Error()[_0x279b('0x2')][_0x279b('0x3')](/^Error/,'')[_0x279b('0x4')]();logger[_0x279b('0x5')](_0x279b('0x6'),_0xc31d19,_0x5b791a,_0x3499bf);const _0x44edbd=Array[_0x279b('0x7')](_0xc31d19);if(!_0xc31d19||_0x44edbd&&_0xc31d19[_0x279b('0x8')]===0x0){return Promise[_0x279b('0x9')](![]);}else{var _0x24f630=[];var _0x247798=[];var _0x424de8=_0x44edbd?_0xc31d19:[_0xc31d19];var _0x10b32a=_0x424de8[_0x279b('0xa')](function(_0xf3714f){return typeof _0xf3714f==='number';});var _0xce9cd2=_0x424de8['every'](function(_0x23893f){return typeof _0x23893f===_0x279b('0xb');});if(!_0x10b32a&&!_0xce9cd2){_0x24f630=_0x424de8[_0x279b('0xc')](function(_0x52eb52){return _0x52eb52['id'];});if(_0x24f630[_0x279b('0x8')]===0x0){_0x247798=_0x424de8[_0x279b('0xc')](function(_0x1a6903){return _0x1a6903['interval'];});}}else{if(_0x10b32a){_0x24f630=_0x24f630[_0x279b('0xd')](_0x424de8);}if(_0xce9cd2){_0x247798=_0x247798['concat'](_0x424de8);}}return client['Request'](_0x279b('0xe'),{'intervalIds':_0x24f630,'intervals':_0x247798,'timezone':_0x5b791a,'log':_0x279b('0xe')});}}exports[_0x279b('0xf')]=intervalIftime; \ No newline at end of file +var _0x5348=['isArray','length','every','number','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','../client','replace','trim','silly','intervalIftime\x20called\x20with'];(function(_0x50ab39,_0x241aa0){var _0x403be0=function(_0x1d1cdf){while(--_0x1d1cdf){_0x50ab39['push'](_0x50ab39['shift']());}};_0x403be0(++_0x241aa0);}(_0x5348,0x14a));var _0x8534=function(_0x456277,_0x4126e7){_0x456277=_0x456277-0x0;var _0x442092=_0x5348[_0x456277];return _0x442092;};var logger=require(_0x8534('0x0'))('dialer');var client=require(_0x8534('0x1'));function intervalIftime(_0x23ae60,_0x28f52f){const _0x4d101b=new Error()['stack'][_0x8534('0x2')](/^Error/,'')[_0x8534('0x3')]();logger[_0x8534('0x4')](_0x8534('0x5'),_0x23ae60,_0x28f52f,_0x4d101b);const _0x111ce4=Array[_0x8534('0x6')](_0x23ae60);if(!_0x23ae60||_0x111ce4&&_0x23ae60[_0x8534('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0x43c2e6=[];var _0x550350=[];var _0x1c41a2=_0x111ce4?_0x23ae60:[_0x23ae60];var _0x1b9533=_0x1c41a2[_0x8534('0x8')](function(_0x26fe2b){return typeof _0x26fe2b===_0x8534('0x9');});var _0x5299ca=_0x1c41a2[_0x8534('0x8')](function(_0x374967){return typeof _0x374967==='string';});if(!_0x1b9533&&!_0x5299ca){_0x43c2e6=_0x1c41a2['map'](function(_0x528d58){return _0x528d58['id'];});if(_0x43c2e6['length']===0x0){_0x550350=_0x1c41a2[_0x8534('0xa')](function(_0x3e8a92){return _0x3e8a92[_0x8534('0xb')];});}}else{if(_0x1b9533){_0x43c2e6=_0x43c2e6[_0x8534('0xc')](_0x1c41a2);}if(_0x5299ca){_0x550350=_0x550350[_0x8534('0xc')](_0x1c41a2);}}return client[_0x8534('0xd')](_0x8534('0xe'),{'intervalIds':_0x43c2e6,'intervals':_0x550350,'timezone':_0x28f52f,'log':_0x8534('0xe')});}}exports[_0x8534('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index da36142..e75666a 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc585=['calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','diff','seconds','inbound'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xc585,0x139));var _0x5c58=function(_0x26d4a0,_0x4df6c7){_0x26d4a0=_0x26d4a0-0x0;var _0x3d34a6=_0xc585[_0x26d4a0];return _0x3d34a6;};'use strict';var moment=require(_0x5c58('0x0'));var _=require(_0x5c58('0x1'));var util=require(_0x5c58('0x2'));var client=require(_0x5c58('0x3'));exports[_0x5c58('0x4')]=function(_0x4b692a){var _0x5be382=_0x4b692a['queuecallercompleteAt']||_0x4b692a[_0x5c58('0x5')];return client[_0x5c58('0x6')](_0x5c58('0x7'),{'body':{'channel':_0x5c58('0x8'),'membername':_0x4b692a[_0x5c58('0x9')],'interface':_[_0x5c58('0xa')](_0x4b692a[_0x5c58('0xb')])?util[_0x5c58('0xc')]('SIP/%s',_0x4b692a['lastAssignedTo']):_0x4b692a['interface'],'type':_0x5c58('0xd'),'enterAt':_0x4b692a['queuecallerleaveAt'],'exitAt':_0x5be382,'duration':moment(_0x5be382)[_0x5c58('0xe')](_0x4b692a['queuecallerleaveAt'],_0x5c58('0xf')),'data1':_0x5c58('0x10'),'data2':_0x4b692a[_0x5c58('0x11')],'data3':_0x4b692a[_0x5c58('0x12')],'data4':null,'data5':_0x4b692a[_0x5c58('0x13')],'role':_0x5c58('0x14'),'internal':_0x4b692a[_0x5c58('0x15')]?_[_0x5c58('0x16')](_0x4b692a[_0x5c58('0x15')]):undefined,'uniqueid':_0x4b692a[_0x5c58('0x17')]},'log':_0x5c58('0x7')});};exports[_0x5c58('0x18')]=function(_0x2e76bf){return client[_0x5c58('0x6')](_0x5c58('0x7'),{'body':{'channel':_0x5c58('0x8'),'membername':_0x2e76bf[_0x5c58('0x19')],'interface':_0x2e76bf[_0x5c58('0xb')],'type':_0x5c58('0xd'),'enterAt':_0x2e76bf['starttime'],'exitAt':_0x2e76bf[_0x5c58('0x1a')],'duration':moment(_0x2e76bf[_0x5c58('0x1a')])[_0x5c58('0xe')](_0x2e76bf[_0x5c58('0x1b')],'seconds')>=0x0?moment(_0x2e76bf['endtime'])[_0x5c58('0xe')](_0x2e76bf[_0x5c58('0x1b')],_0x5c58('0xf')):null,'data1':_0x5c58('0x1c'),'data2':_0x2e76bf[_0x5c58('0x15')],'data3':_0x2e76bf[_0x5c58('0x12')],'data4':_0x2e76bf[_0x5c58('0x1d')]||null,'role':_0x5c58('0x14'),'internal':_0x2e76bf['accountcode']?_['toNumber'](_0x2e76bf[_0x5c58('0x15')]):undefined,'uniqueid':_0x2e76bf[_0x5c58('0x17')]},'log':_0x5c58('0x7')});}; \ No newline at end of file +var _0xb058=['seconds','inbound','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','exten','dialstring','agent','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING','queuecallerleaveAt','diff'];(function(_0x290ed3,_0x5126ae){var _0x234f87=function(_0x121585){while(--_0x121585){_0x290ed3['push'](_0x290ed3['shift']());}};_0x234f87(++_0x5126ae);}(_0xb058,0x142));var _0x8b05=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb058[_0x3899d1];return _0xeb4a7d;};'use strict';var moment=require(_0x8b05('0x0'));var _=require('lodash');var util=require(_0x8b05('0x1'));var client=require('../client');exports[_0x8b05('0x2')]=function(_0x871db4){var _0x8328e5=_0x871db4[_0x8b05('0x3')]||_0x871db4[_0x8b05('0x4')];return client[_0x8b05('0x5')](_0x8b05('0x6'),{'body':{'channel':_0x8b05('0x7'),'membername':_0x871db4[_0x8b05('0x8')],'interface':_['isNil'](_0x871db4[_0x8b05('0x9')])?util[_0x8b05('0xa')]('SIP/%s',_0x871db4[_0x8b05('0x8')]):_0x871db4[_0x8b05('0x9')],'type':_0x8b05('0xb'),'enterAt':_0x871db4[_0x8b05('0xc')],'exitAt':_0x8328e5,'duration':moment(_0x8328e5)[_0x8b05('0xd')](_0x871db4['queuecallerleaveAt'],_0x8b05('0xe')),'data1':_0x8b05('0xf'),'data2':_0x871db4['calleridnum'],'data3':_0x871db4['exten'],'data4':null,'data5':_0x871db4[_0x8b05('0x10')],'role':'agent','internal':_0x871db4[_0x8b05('0x11')]?_[_0x8b05('0x12')](_0x871db4[_0x8b05('0x11')]):undefined,'uniqueid':_0x871db4[_0x8b05('0x13')]},'log':_0x8b05('0x6')});};exports[_0x8b05('0x14')]=function(_0x300f6d){return client[_0x8b05('0x5')](_0x8b05('0x6'),{'body':{'channel':_0x8b05('0x7'),'membername':_0x300f6d[_0x8b05('0x15')],'interface':_0x300f6d[_0x8b05('0x9')],'type':_0x8b05('0xb'),'enterAt':_0x300f6d[_0x8b05('0x16')],'exitAt':_0x300f6d[_0x8b05('0x17')],'duration':moment(_0x300f6d[_0x8b05('0x17')])[_0x8b05('0xd')](_0x300f6d['starttime'],_0x8b05('0xe'))>=0x0?moment(_0x300f6d[_0x8b05('0x17')])[_0x8b05('0xd')](_0x300f6d['starttime'],_0x8b05('0xe')):null,'data1':_0x8b05('0x18'),'data2':_0x300f6d['accountcode'],'data3':_0x300f6d[_0x8b05('0x19')],'data4':_0x300f6d[_0x8b05('0x1a')]||null,'role':_0x8b05('0x1b'),'internal':_0x300f6d[_0x8b05('0x11')]?_['toNumber'](_0x300f6d['accountcode']):undefined,'uniqueid':_0x300f6d['uniqueid']},'log':_0x8b05('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3943081..b972547 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 _0x9660=['stopRecordingOnTransfer','GetSettings','../client','Request','ShowSetting'];(function(_0x1f0265,_0x498b5d){var _0x5965af=function(_0x3db97f){while(--_0x3db97f){_0x1f0265['push'](_0x1f0265['shift']());}};_0x5965af(++_0x498b5d);}(_0x9660,0x1f1));var _0x0966=function(_0x2fceb5,_0x229415){_0x2fceb5=_0x2fceb5-0x0;var _0x35edaa=_0x9660[_0x2fceb5];return _0x35edaa;};'use strict';var client=require(_0x0966('0x0'));exports['getSettings']=function(){return client[_0x0966('0x1')](_0x0966('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0966('0x3'),'previewRecallmeReminderInterval']},'log':_0x0966('0x4')});}; \ No newline at end of file +var _0xbbfd=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','Request'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xbbfd,0x1df));var _0xdbbf=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xbbfd[_0x39096d];return _0x13da4f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xdbbf('0x0')](_0xdbbf('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdbbf('0x2'),_0xdbbf('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a40a8ae..da4c759 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 _0x3166=['name','getTemplates','GetTemplate'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3166,0xbb));var _0x6316=function(_0x236f2e,_0x3a674f){_0x236f2e=_0x236f2e-0x0;var _0x337a74=_0x3166[_0x236f2e];return _0x337a74;};'use strict';var client=require('../client');exports[_0x6316('0x0')]=function(_0x37af38){return function(_0x12349b){return client['Request'](_0x6316('0x1'),{'options':{'raw':!![],'attributes':['id',_0x6316('0x2'),'html']},'log':_0x6316('0x1')});};}; \ No newline at end of file +var _0xec5b=['html','../client','Request','GetTemplate'];(function(_0xb9a137,_0x1e3e80){var _0x1afaf8=function(_0x5af1fb){while(--_0x5af1fb){_0xb9a137['push'](_0xb9a137['shift']());}};_0x1afaf8(++_0x1e3e80);}(_0xec5b,0x175));var _0xbec5=function(_0x35fd74,_0x4b4935){_0x35fd74=_0x35fd74-0x0;var _0x55e1b9=_0xec5b[_0x35fd74];return _0x55e1b9;};'use strict';var client=require(_0xbec5('0x0'));exports['getTemplates']=function(_0xb3a866){return function(_0x4bf879){return client[_0xbec5('0x1')](_0xbec5('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xbec5('0x3')]},'log':_0xbec5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 341cd75..6f94b65 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 _0x825f=['AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data2','data3','data4','data7','../client','Request','GetTrigger','name','channel','Condition'];(function(_0x108ef9,_0x5d3141){var _0x450fa2=function(_0x2ed964){while(--_0x2ed964){_0x108ef9['push'](_0x108ef9['shift']());}};_0x450fa2(++_0x5d3141);}(_0x825f,0x150));var _0xf825=function(_0x125f69,_0x4cc81c){_0x125f69=_0x125f69-0x0;var _0x191a87=_0x825f[_0x125f69];return _0x191a87;};'use strict';var client=require(_0xf825('0x0'));exports['getTriggers']=function(_0x251372){return function(_0x916e0){return client[_0xf825('0x1')](_0xf825('0x2'),{'options':{'raw':![],'attributes':['id',_0xf825('0x3'),_0xf825('0x4'),'status'],'include':[{'model':_0xf825('0x5'),'as':_0xf825('0x6'),'attributes':['id','field',_0xf825('0x7'),_0xf825('0x8')]},{'model':_0xf825('0x5'),'as':_0xf825('0x9'),'attributes':['id',_0xf825('0xa'),'operator',_0xf825('0x8')]},{'model':_0xf825('0xb'),'as':_0xf825('0xc'),'attributes':['id','action',_0xf825('0xd'),_0xf825('0xe'),_0xf825('0xf'),_0xf825('0x10'),'data5','data6',_0xf825('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x4c2a=['AnyConditions','field','Actions','action','data1','data2','data4','data7','../client','getTriggers','Request','GetTrigger','channel','status','AllConditions','Condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c2a,0xe8));var _0xa4c2=function(_0x226bdd,_0x5bca05){_0x226bdd=_0x226bdd-0x0;var _0x48a9cd=_0x4c2a[_0x226bdd];return _0x48a9cd;};'use strict';var client=require(_0xa4c2('0x0'));exports[_0xa4c2('0x1')]=function(_0x2c35bb){return function(_0x57518b){return client[_0xa4c2('0x2')](_0xa4c2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xa4c2('0x4'),_0xa4c2('0x5')],'include':[{'model':'Condition','as':_0xa4c2('0x6'),'attributes':['id','field','operator','value']},{'model':_0xa4c2('0x7'),'as':_0xa4c2('0x8'),'attributes':['id',_0xa4c2('0x9'),'operator','value']},{'model':'Action','as':_0xa4c2('0xa'),'attributes':['id',_0xa4c2('0xb'),_0xa4c2('0xc'),_0xa4c2('0xd'),'data3',_0xa4c2('0xe'),'data5','data6',_0xa4c2('0xf')]}]},'log':_0xa4c2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index fb12bec..92cc950 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 _0x6631=['registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x2d92b1,_0x49ddad){var _0x295751=function(_0x15603c){while(--_0x15603c){_0x2d92b1['push'](_0x2d92b1['shift']());}};_0x295751(++_0x49ddad);}(_0x6631,0x134));var _0x1663=function(_0x3d2063,_0x5100c8){_0x3d2063=_0x3d2063-0x0;var _0x5eff65=_0x6631[_0x3d2063];return _0x5eff65;};'use strict';var client=require(_0x1663('0x0'));exports[_0x1663('0x1')]=function(_0x3a71ee){return function(_0x8a1e8e){return client[_0x1663('0x2')](_0x1663('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x1663('0x4'),_0x1663('0x5')]},'log':_0x1663('0x3')});};}; \ No newline at end of file +var _0x8fe0=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x4c07c5,_0x30ab0b){var _0xb21a59=function(_0x311ec0){while(--_0x311ec0){_0x4c07c5['push'](_0x4c07c5['shift']());}};_0xb21a59(++_0x30ab0b);}(_0x8fe0,0x1ab));var _0x08fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x08fe('0x0'));exports[_0x08fe('0x1')]=function(_0x25b304){return function(_0x415267){return client[_0x08fe('0x2')](_0x08fe('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x08fe('0x4'),_0x08fe('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7e232fc..58cd480 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x438eef,_0x22c644){var _0x4bd748=function(_0x1b3c63){while(--_0x1b3c63){_0x438eef['push'](_0x438eef['shift']());}};_0x4bd748(++_0x22c644);}(_0x34e8,0x12c));var _0x834e=function(_0x57e34e,_0x1eabc8){_0x57e34e=_0x57e34e-0x0;var _0x16a5ed=_0x34e8[_0x57e34e];return _0x16a5ed;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x4035ac,_0x28e703){var _0x3b7fd2=function(_0x55100f){while(--_0x55100f){_0x4035ac['push'](_0x4035ac['shift']());}};_0x3b7fd2(++_0x28e703);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a25539c..03d6f7d 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 _0x31e3=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0x31e3,0x1d5));var _0x331e=function(_0x105735,_0x10c76c){_0x105735=_0x105735-0x0;var _0x190411=_0x31e3[_0x105735];return _0x190411;};'use strict';var client=require(_0x331e('0x0'));exports[_0x331e('0x1')]=function(_0x2b1a5f){return client[_0x331e('0x2')]('CreateVoiceAgentReport',{'body':_0x2b1a5f,'log':_0x331e('0x3')});};exports[_0x331e('0x4')]=function(_0x37c92b,_0x4eb2bb,_0x13c05d){return client['Request'](_0x331e('0x5'),{'body':_0x37c92b,'options':{'where':{'uniqueid':_0x4eb2bb,'interface':_0x13c05d,'agentcomplete':!![]}},'log':_0x331e('0x5')});}; \ No newline at end of file +var _0xb515=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0xb515,0x102));var _0x5b51=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0xb515[_0x4f1da5];return _0xe972a8;};'use strict';var client=require(_0x5b51('0x0'));exports['create']=function(_0xd542cd){return client[_0x5b51('0x1')](_0x5b51('0x2'),{'body':_0xd542cd,'log':_0x5b51('0x2')});};exports[_0x5b51('0x3')]=function(_0x4c69d2,_0x182c58,_0x237ef0){return client[_0x5b51('0x1')](_0x5b51('0x4'),{'body':_0x4c69d2,'options':{'where':{'uniqueid':_0x182c58,'interface':_0x237ef0,'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 d2689e6..c5a1f2b 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 _0xa971=['moment','util','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','disposition','duration','billableseconds'];(function(_0x45905c,_0x2dc7c9){var _0x212224=function(_0x2915b0){while(--_0x2915b0){_0x45905c['push'](_0x45905c['shift']());}};_0x212224(++_0x2dc7c9);}(_0xa971,0x98));var _0x1a97=function(_0xbd712d,_0x2cc49e){_0xbd712d=_0xbd712d-0x0;var _0x1e5575=_0xa971[_0xbd712d];return _0x1e5575;};'use strict';var moment=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var _=require('lodash');var client=require(_0x1a97('0x2'));exports[_0x1a97('0x3')]=function(_0x1c4a71){return client[_0x1a97('0x4')](_0x1a97('0x5'),{'body':_['merge'](_0x1c4a71,{'source':_0x1c4a71[_0x1a97('0x6')],'destinationcontext':_0x1c4a71[_0x1a97('0x7')],'callerid':_0x1c4a71[_0x1a97('0x8')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1a97('0x4')](_0x1a97('0x9'),{'options':{'where':{'type':[_0x1a97('0xa')],'createdAt':{'$between':[moment()[_0x1a97('0xb')]('day')['format'](_0x1a97('0xc')),moment()[_0x1a97('0xd')](_0x1a97('0xe'))[_0x1a97('0xf')](_0x1a97('0xc'))]}},'attributes':['type',_0x1a97('0x10'),_0x1a97('0x11'),_0x1a97('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x1e65=['util','lodash','../client','create','Request','merge','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e65,0x1c7));var _0x51e6=function(_0x28cb71,_0x506c7e){_0x28cb71=_0x28cb71-0x0;var _0x2ad9f4=_0x1e65[_0x28cb71];return _0x2ad9f4;};'use strict';var moment=require(_0x51e6('0x0'));var util=require(_0x51e6('0x1'));var _=require(_0x51e6('0x2'));var client=require(_0x51e6('0x3'));exports[_0x51e6('0x4')]=function(_0x57d95c){return client[_0x51e6('0x5')]('CreateVoiceCallReport',{'body':_[_0x51e6('0x6')](_0x57d95c,{'source':_0x57d95c['calleridnum'],'destinationcontext':_0x57d95c[_0x51e6('0x7')],'callerid':_0x57d95c[_0x51e6('0x8')],'amaflags':_0x51e6('0x9')}),'log':_0x51e6('0xa')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x51e6('0x5')](_0x51e6('0xb'),{'options':{'where':{'type':[_0x51e6('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x51e6('0xd'))['format'](_0x51e6('0xe')),moment()['endOf'](_0x51e6('0xd'))['format'](_0x51e6('0xe'))]}},'attributes':[_0x51e6('0xf'),'disposition',_0x51e6('0x10'),_0x51e6('0x11')]},'log':_0x51e6('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 439c52d..2109ccc 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 _0x6927=['CreateVoiceDialReport','../client','create','Request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6927,0x85));var _0x7692=function(_0x17d0e3,_0x138bde){_0x17d0e3=_0x17d0e3-0x0;var _0x310752=_0x6927[_0x17d0e3];return _0x310752;};'use strict';var client=require(_0x7692('0x0'));exports[_0x7692('0x1')]=function(_0x13cebd){return client[_0x7692('0x2')]('CreateVoiceDialReport',{'body':_0x13cebd,'log':_0x7692('0x3')});}; \ No newline at end of file +var _0x2f98=['../client','create','Request','CreateVoiceDialReport'];(function(_0x104619,_0x2e19b7){var _0x3269a7=function(_0x5b7cf5){while(--_0x5b7cf5){_0x104619['push'](_0x104619['shift']());}};_0x3269a7(++_0x2e19b7);}(_0x2f98,0x130));var _0x82f9=function(_0x55c5ca,_0x463637){_0x55c5ca=_0x55c5ca-0x0;var _0x2a32f7=_0x2f98[_0x55c5ca];return _0x2a32f7;};'use strict';var client=require(_0x82f9('0x0'));exports[_0x82f9('0x1')]=function(_0x402a5f){return client[_0x82f9('0x2')](_0x82f9('0x3'),{'body':_0x402a5f,'log':_0x82f9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f8c4346..d5f23fe 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 _0x750a=['exten','recordingFormat','getVoiceExtensions'];(function(_0x4d8d5f,_0x3d4b92){var _0x58a8b0=function(_0x30eb74){while(--_0x30eb74){_0x4d8d5f['push'](_0x4d8d5f['shift']());}};_0x58a8b0(++_0x3d4b92);}(_0x750a,0x140));var _0xa750=function(_0x347790,_0x382fd1){_0x347790=_0x347790-0x0;var _0x43a1b6=_0x750a[_0x347790];return _0x43a1b6;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xa750('0x0')});};}; \ No newline at end of file +var _0x705f=['getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0x4f3dee,_0x46bb90){_0x4f3dee=_0x4f3dee-0x0;var _0x291aad=_0x705f[_0x4f3dee];return _0x291aad;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xf705('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf705('0x1'),_0xf705('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xf705('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ece74fb..0bc20b0 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 _0x644e=['dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','monitor_format','type','dialActive'];(function(_0x594de8,_0x46d0d2){var _0x5fcbf=function(_0x48c215){while(--_0x48c215){_0x594de8['push'](_0x594de8['shift']());}};_0x5fcbf(++_0x46d0d2);}(_0x644e,0x1c0));var _0xe644=function(_0x212a66,_0x5c016b){_0x212a66=_0x212a66-0x0;var _0x42a9a7=_0x644e[_0x212a66];return _0x42a9a7;};'use strict';var client=require(_0xe644('0x0'));exports[_0xe644('0x1')]=function(){return function(){return client[_0xe644('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe644('0x3'),_0xe644('0x4'),'acwTimeout','autopause',_0xe644('0x5'),_0xe644('0x6'),_0xe644('0x7'),_0xe644('0x8'),_0xe644('0x9'),_0xe644('0xa'),_0xe644('0xb'),_0xe644('0xc'),'dialPredictiveOptimizationPercentage',_0xe644('0xd'),_0xe644('0xe'),_0xe644('0xf'),_0xe644('0x10'),_0xe644('0x11'),_0xe644('0x12'),'dialQueueProject','dialCongestionMaxRetry',_0xe644('0x13'),_0xe644('0x14'),_0xe644('0x15'),_0xe644('0x16'),_0xe644('0x17'),_0xe644('0x18'),_0xe644('0x19'),'dialGlobalInterval',_0xe644('0x1a'),'dialCheckDuplicateType',_0xe644('0x1b'),_0xe644('0x1c'),_0xe644('0x1d'),_0xe644('0x1e'),_0xe644('0x1f'),'dialAMDMinWordLength',_0xe644('0x20'),_0xe644('0x21'),_0xe644('0x22'),'dialAMDMaximumWordLength',_0xe644('0x23'),'dialRecallMeTimeout',_0xe644('0x24'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xe644('0x25'),_0xe644('0x5'),_0xe644('0x26'),_0xe644('0x27'),_0xe644('0x28'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xe644('0x29'),_0xe644('0x2a'),_0xe644('0x2b'),_0xe644('0x2c'),'dialMachineMaxRetry',_0xe644('0x2d'),'dialAgentRejectMaxRetry',_0xe644('0x2e'),_0xe644('0x2f'),_0xe644('0x30'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xe644('0x31'),'attributes':['id',_0xe644('0x3'),_0xe644('0x32'),_0xe644('0x33')]},{'model':_0xe644('0x34'),'as':'mandatoryDispositionPause','attributes':['id',_0xe644('0x3')]},{'model':'Trunk','as':_0xe644('0x35'),'attributes':['id',_0xe644('0x3'),_0xe644('0x32'),_0xe644('0x33')]},{'model':_0xe644('0x36'),'as':_0xe644('0x36'),'attributes':['id','name'],'include':[{'model':_0xe644('0x36'),'as':_0xe644('0x37'),'attributes':['id',_0xe644('0x3'),_0xe644('0x38')]}]}]},'log':_0xe644('0x1')});};}; \ No newline at end of file +var _0x05c2=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions'];(function(_0x430275,_0x4125d4){var _0xcc8449=function(_0x34f292){while(--_0x34f292){_0x430275['push'](_0x430275['shift']());}};_0xcc8449(++_0x4125d4);}(_0x05c2,0x174));var _0x205c=function(_0x50bd09,_0x11d849){_0x50bd09=_0x50bd09-0x0;var _0x1cd11e=_0x05c2[_0x50bd09];return _0x1cd11e;};'use strict';var client=require(_0x205c('0x0'));exports[_0x205c('0x1')]=function(){return function(){return client['Request'](_0x205c('0x2'),{'options':{'raw':![],'attributes':['id',_0x205c('0x3'),_0x205c('0x4'),'acwTimeout',_0x205c('0x5'),_0x205c('0x6'),_0x205c('0x7'),_0x205c('0x8'),_0x205c('0x9'),_0x205c('0xa'),'dialLimitQueue',_0x205c('0xb'),_0x205c('0xc'),_0x205c('0xd'),_0x205c('0xe'),_0x205c('0xf'),'dialOriginateCallerIdNumber',_0x205c('0x10'),_0x205c('0x11'),_0x205c('0x12'),_0x205c('0x13'),_0x205c('0x14'),_0x205c('0x15'),_0x205c('0x16'),_0x205c('0x17'),_0x205c('0x18'),'dialNoAnswerRetryFrequency',_0x205c('0x19'),'dialTimezone','dialGlobalInterval',_0x205c('0x1a'),_0x205c('0x1b'),_0x205c('0x1c'),_0x205c('0x1d'),_0x205c('0x1e'),_0x205c('0x1f'),_0x205c('0x20'),_0x205c('0x21'),_0x205c('0x22'),_0x205c('0x23'),_0x205c('0x24'),_0x205c('0x25'),_0x205c('0x26'),'dialRecallMeTimeout',_0x205c('0x27'),_0x205c('0x28'),'dialAgiAfterHangupAgent',_0x205c('0x29'),_0x205c('0x2a'),_0x205c('0x6'),_0x205c('0x2b'),_0x205c('0x2c'),_0x205c('0x2d'),_0x205c('0x2e'),'dialNoSuchNumberRetryFrequency',_0x205c('0x2f'),'dialDropRetryFrequency',_0x205c('0x30'),_0x205c('0x31'),_0x205c('0x32'),_0x205c('0x33'),_0x205c('0x34'),_0x205c('0x35'),_0x205c('0x36'),_0x205c('0x37'),'dialPredictiveIntervalMinThreshold',_0x205c('0x38'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x205c('0x39'),'as':_0x205c('0x39'),'attributes':['id',_0x205c('0x3'),_0x205c('0x3a'),_0x205c('0x3b')]},{'model':_0x205c('0x3c'),'as':_0x205c('0x3d'),'attributes':['id','name']},{'model':_0x205c('0x39'),'as':'TrunkBackup','attributes':['id',_0x205c('0x3'),_0x205c('0x3a'),'active']},{'model':_0x205c('0x3e'),'as':'Interval','attributes':['id',_0x205c('0x3')],'include':[{'model':_0x205c('0x3e'),'as':_0x205c('0x3f'),'attributes':['id',_0x205c('0x3'),_0x205c('0x40')]}]}]},'log':_0x205c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index df7341b..264231b 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(_0x1a4e1f,_0x411c29){var _0x14d20d=function(_0x5913e5){while(--_0x5913e5){_0x1a4e1f['push'](_0x1a4e1f['shift']());}};_0x14d20d(++_0x411c29);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x295466,_0x223238){var _0x5bb591=function(_0x45a2c9){while(--_0x45a2c9){_0x295466['push'](_0x295466['shift']());}};_0x5bb591(++_0x223238);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 50b89dc..a89dd33 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 _0x4eca=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5c4df1,_0x3d62da){var _0xeef330=function(_0x2fea33){while(--_0x2fea33){_0x5c4df1['push'](_0x5c4df1['shift']());}};_0xeef330(++_0x3d62da);}(_0x4eca,0x1bf));var _0xa4ec=function(_0x3b346b,_0x4bb0c3){_0x3b346b=_0x3b346b-0x0;var _0x509b7c=_0x4eca[_0x3b346b];return _0x509b7c;};'use strict';var client=require(_0xa4ec('0x0'));exports[_0xa4ec('0x1')]=function(_0x7ef86a){return function(){return client[_0xa4ec('0x2')](_0xa4ec('0x3'),{'options':{'where':{'VoiceQueueId':_0x7ef86a,'paused':!![]},'raw':!![]},'log':_0xa4ec('0x1')});};}; \ No newline at end of file +var _0x2cf3=['getVoiceQueueRtPauses'];(function(_0x4cfb98,_0x3910eb){var _0x48f46b=function(_0x5e9eae){while(--_0x5e9eae){_0x4cfb98['push'](_0x4cfb98['shift']());}};_0x48f46b(++_0x3910eb);}(_0x2cf3,0xa7));var _0x32cf=function(_0x24b3db,_0x445a36){_0x24b3db=_0x24b3db-0x0;var _0x2e4e34=_0x2cf3[_0x24b3db];return _0x2e4e34;};'use strict';var client=require('../client');exports[_0x32cf('0x0')]=function(_0x56cab5){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x56cab5,'paused':!![]},'raw':!![]},'log':_0x32cf('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1788320..4ba534a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x51d642,_0x1849e7){var _0xfacf64=function(_0x56b4f9){while(--_0x56b4f9){_0x51d642['push'](_0x51d642['shift']());}};_0xfacf64(++_0x1849e7);}(_0x7a54,0x106));var _0x47a5=function(_0x53da33,_0x58f2db){_0x53da33=_0x53da33-0x0;var _0x108a8c=_0x7a54[_0x53da33];return _0x108a8c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x38398b,_0x1e194a){var _0x5b91d5=function(_0x2d5843){while(--_0x2d5843){_0x38398b['push'](_0x38398b['shift']());}};_0x5b91d5(++_0x1e194a);}(_0x7a54,0x106));var _0x47a5=function(_0x15285c,_0x4e89c0){_0x15285c=_0x15285c-0x0;var _0x155c01=_0x7a54[_0x15285c];return _0x155c01;};'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 34fef76..2fae16e 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 _0xc6e6=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0xc6e6,0x131));var _0x6c6e=function(_0x576d6d,_0x130086){_0x576d6d=_0x576d6d-0x0;var _0x5bf03e=_0xc6e6[_0x576d6d];return _0x5bf03e;};'use strict';var client=require(_0x6c6e('0x0'));exports[_0x6c6e('0x1')]={};exports[_0x6c6e('0x2')]=function(_0xfe6a1c){return client[_0x6c6e('0x3')](_0x6c6e('0x4'),{'body':{'result':_0xfe6a1c[_0x6c6e('0x5')],'transfererchannel':_0xfe6a1c[_0x6c6e('0x6')],'transferercalleridnum':_0xfe6a1c[_0x6c6e('0x7')],'transferercalleridname':_0xfe6a1c['transferercalleridname'],'transfererconnectedlinenum':_0xfe6a1c[_0x6c6e('0x8')],'transfererconnectedlinename':_0xfe6a1c[_0x6c6e('0x9')],'transfereraccountcode':_0xfe6a1c[_0x6c6e('0xa')],'transferercontext':_0xfe6a1c[_0x6c6e('0xb')],'transfererexten':_0xfe6a1c[_0x6c6e('0xc')],'transfererlinkedid':_0xfe6a1c[_0x6c6e('0xd')],'transfereechannel':_0xfe6a1c['transfereechannel'],'transfereecalleridnum':_0xfe6a1c[_0x6c6e('0xe')],'transfereecalleridname':_0xfe6a1c[_0x6c6e('0xf')],'transfereeconnectedlinenum':_0xfe6a1c[_0x6c6e('0x10')],'transfereeconnectedlinename':_0xfe6a1c['transfereeconnectedlinename'],'transfereeaccountcode':_0xfe6a1c[_0x6c6e('0x11')],'transfereecontext':_0xfe6a1c[_0x6c6e('0x12')],'transfereeexten':_0xfe6a1c[_0x6c6e('0x13')],'transfereelinkedid':_0xfe6a1c[_0x6c6e('0x14')],'isexternal':_0xfe6a1c[_0x6c6e('0x15')],'context':_0xfe6a1c[_0x6c6e('0x16')],'extension':_0xfe6a1c['extension'],'type':'blind'},'log':_0x6c6e('0x4')});};exports['attendedTransfer']=function(_0x22cc0e){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x22cc0e[_0x6c6e('0x5')],'transfererchannel':_0x22cc0e['origtransfererchannel'],'transferercalleridnum':_0x22cc0e[_0x6c6e('0x17')],'transferercalleridname':_0x22cc0e[_0x6c6e('0x18')],'transfererconnectedlinenum':_0x22cc0e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x22cc0e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x22cc0e[_0x6c6e('0x19')],'transferercontext':_0x22cc0e[_0x6c6e('0x1a')],'transfererexten':_0x22cc0e['secondtransfererexten'],'transfererlinkedid':_0x22cc0e[_0x6c6e('0x1b')],'transfereechannel':_0x22cc0e[_0x6c6e('0x1c')],'transfereecalleridnum':_0x22cc0e[_0x6c6e('0x1d')],'transfereecalleridname':_0x22cc0e[_0x6c6e('0x1e')],'transfereeconnectedlinenum':_0x22cc0e[_0x6c6e('0x1f')],'transfereeconnectedlinename':_0x22cc0e[_0x6c6e('0x20')],'transfereeaccountcode':_0x22cc0e[_0x6c6e('0x21')],'transfereecontext':_0x22cc0e['transfertargetcontext'],'transfereeexten':_0x22cc0e[_0x6c6e('0x22')],'transfereelinkedid':_0x22cc0e['transfertargetlinkedid'],'isexternal':_0x22cc0e[_0x6c6e('0x15')],'context':_0x22cc0e['origtransferercontext'],'extension':_0x22cc0e[_0x6c6e('0x23')],'type':_0x6c6e('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x3a6e=['transfereelinkedid','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x58f16c,_0x47c7bb){var _0x3f6d37=function(_0x400af7){while(--_0x400af7){_0x58f16c['push'](_0x58f16c['shift']());}};_0x3f6d37(++_0x47c7bb);}(_0x3a6e,0x1b9));var _0xe3a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3a6e[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xe3a6('0x0'));exports[_0xe3a6('0x1')]={};exports[_0xe3a6('0x2')]=function(_0x2e2a27){return client[_0xe3a6('0x3')](_0xe3a6('0x4'),{'body':{'result':_0x2e2a27[_0xe3a6('0x5')],'transfererchannel':_0x2e2a27[_0xe3a6('0x6')],'transferercalleridnum':_0x2e2a27[_0xe3a6('0x7')],'transferercalleridname':_0x2e2a27[_0xe3a6('0x8')],'transfererconnectedlinenum':_0x2e2a27[_0xe3a6('0x9')],'transfererconnectedlinename':_0x2e2a27[_0xe3a6('0xa')],'transfereraccountcode':_0x2e2a27[_0xe3a6('0xb')],'transferercontext':_0x2e2a27[_0xe3a6('0xc')],'transfererexten':_0x2e2a27[_0xe3a6('0xd')],'transfererlinkedid':_0x2e2a27[_0xe3a6('0xe')],'transfereechannel':_0x2e2a27[_0xe3a6('0xf')],'transfereecalleridnum':_0x2e2a27[_0xe3a6('0x10')],'transfereecalleridname':_0x2e2a27[_0xe3a6('0x11')],'transfereeconnectedlinenum':_0x2e2a27[_0xe3a6('0x12')],'transfereeconnectedlinename':_0x2e2a27[_0xe3a6('0x13')],'transfereeaccountcode':_0x2e2a27[_0xe3a6('0x14')],'transfereecontext':_0x2e2a27['transfereecontext'],'transfereeexten':_0x2e2a27['transfereeexten'],'transfereelinkedid':_0x2e2a27[_0xe3a6('0x15')],'isexternal':_0x2e2a27['isexternal'],'context':_0x2e2a27[_0xe3a6('0x16')],'extension':_0x2e2a27[_0xe3a6('0x17')],'type':'blind'},'log':_0xe3a6('0x4')});};exports['attendedTransfer']=function(_0xcbb0ce){return client[_0xe3a6('0x3')](_0xe3a6('0x4'),{'body':{'result':_0xcbb0ce[_0xe3a6('0x5')],'transfererchannel':_0xcbb0ce[_0xe3a6('0x18')],'transferercalleridnum':_0xcbb0ce[_0xe3a6('0x19')],'transferercalleridname':_0xcbb0ce[_0xe3a6('0x1a')],'transfererconnectedlinenum':_0xcbb0ce[_0xe3a6('0x1b')],'transfererconnectedlinename':_0xcbb0ce[_0xe3a6('0x1c')],'transfereraccountcode':_0xcbb0ce[_0xe3a6('0x1d')],'transferercontext':_0xcbb0ce['secondtransferercontext'],'transfererexten':_0xcbb0ce[_0xe3a6('0x1e')],'transfererlinkedid':_0xcbb0ce[_0xe3a6('0x1f')],'transfereechannel':_0xcbb0ce['transfertargetchannel'],'transfereecalleridnum':_0xcbb0ce[_0xe3a6('0x20')],'transfereecalleridname':_0xcbb0ce[_0xe3a6('0x21')],'transfereeconnectedlinenum':_0xcbb0ce[_0xe3a6('0x22')],'transfereeconnectedlinename':_0xcbb0ce[_0xe3a6('0x23')],'transfereeaccountcode':_0xcbb0ce[_0xe3a6('0x24')],'transfereecontext':_0xcbb0ce[_0xe3a6('0x25')],'transfereeexten':_0xcbb0ce[_0xe3a6('0x26')],'transfereelinkedid':_0xcbb0ce[_0xe3a6('0x27')],'isexternal':_0xcbb0ce[_0xe3a6('0x28')],'context':_0xcbb0ce[_0xe3a6('0x29')],'extension':_0xcbb0ce['origtransfererexten'],'type':'attended'},'log':_0xe3a6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 701479f..8fc5ebd 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2e4a1c,_0x4bf96f){var _0x8c2c74=function(_0x28a35f){while(--_0x28a35f){_0x2e4a1c['push'](_0x2e4a1c['shift']());}};_0x8c2c74(++_0x4bf96f);}(_0x7a54,0x106));var _0x47a5=function(_0xa09b60,_0x177c19){_0xa09b60=_0xa09b60-0x0;var _0x385fd9=_0x7a54[_0xa09b60];return _0x385fd9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x57a7cb,_0x1e2985){var _0x343986=function(_0x34826e){while(--_0x34826e){_0x57a7cb['push'](_0x57a7cb['shift']());}};_0x343986(++_0x1e2985);}(_0x7a54,0x106));var _0x47a5=function(_0x29fe35,_0x2aa009){_0x29fe35=_0x29fe35-0x0;var _0x1dc859=_0x7a54[_0x29fe35];return _0x1dc859;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 903579f..97ea680 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 _0x8872=['../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','then','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','action','toLowerCase','merge','length','bluebird'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x8872,0x131));var _0x2887=function(_0x3e89b3,_0x348d6b){_0x3e89b3=_0x3e89b3-0x0;var _0x294d74=_0x8872[_0x3e89b3];return _0x294d74;};'use strict';var _=require('lodash');var BPromise=require(_0x2887('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x2887('0x1'));var logger=require('../../../../config/logger')(_0x2887('0x2'));var cmContactRpc=require(_0x2887('0x3'));config[_0x2887('0x4')]=_[_0x2887('0x5')](config[_0x2887('0x4')],{'host':_0x2887('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x18acca,_0x57cb80,_0x51ba03,_0x3cffe1,_0x8ada94){logger[_0x2887('0x7')](_0x2887('0x8'),_0x18acca,_0x57cb80['id'],_0x51ba03,_0x3cffe1,JSON[_0x2887('0x9')](_0x8ada94));io['to'](_0x51ba03)['emit'](_0x3cffe1,_0x8ada94);}exports['exec']=function(_0x44d1e9,_0x37484f,_0x33228a,_0x489491){var _0x2ae833,_0x15b047;var _0x26c7f4={};var _0x2dbf93;var _0xd02bfa=Number(_0x33228a[_0x2887('0xa')]);var _0x323497=_0x33228a[_0x2887('0xb')]?Boolean(Number(_0x33228a[_0x2887('0xb')])):![];var _0x101850;var _0x49a3bb=![];if(!_[_0x2887('0xc')](_0x33228a['data5'])){if(_0x33228a[_0x2887('0xd')]=='1')_0x49a3bb=!![];}if(!_0x49a3bb){if(_0x489491[_0x2887('0xe')]){_0x26c7f4['id']=_0x489491['xmd-contactid'];}}if(!_0x26c7f4['id']){_0x26c7f4[_0x2887('0xf')]=_0xd02bfa;_0x101850=_0x33228a[_0x2887('0x10')]&&_0x33228a['data3']!=='0'?_0x33228a[_0x2887('0x10')]['split'](','):[_0x2887('0x11')];_0x26c7f4[_0x2887('0x12')]=_[_0x2887('0x13')](_0x101850,function(_0x5d7eb7){var _0x374b10={};_0x374b10[_0x5d7eb7]=_0x489491[_0x2887('0x14')]?_0x489491['destcalleridnum']:_0x489491[_0x2887('0x15')];return _0x374b10;});_0x2dbf93=_0x489491[_0x2887('0x14')]?_0x489491[_0x2887('0x16')]:_0x489491[_0x2887('0x15')];}var _0x537d7c=['id',_0x2887('0x17'),_0x2887('0x18'),'phone',_0x2887('0x19'),_0x2887('0x1a'),_0x2887('0xf'),_0x2887('0x1b'),_0x2887('0x1c'),'updatedAt'];var _0xe72bad=_[_0x2887('0x1d')](_0x537d7c,_0x101850);BPromise['resolve']()[_0x2887('0x1e')](cmContactRpc['getContacts']({'attributes':_0xe72bad,'where':_0x26c7f4,'phone':_0x2dbf93}))[_0x2887('0x1e')](function(_0x376bd3){_0x15b047=_0x376bd3;if(!_['isEmpty'](_0x15b047)){if(_0x15b047['length']===0x1){_0x2ae833=_0x15b047[0x0];logger[_0x2887('0x7')](_0x2887('0x1f'),_0x489491[_0x2887('0x20')],_0x37484f['id'],_0x2ae833['id']);}else{logger['info'](_0x2887('0x21'),_0x489491[_0x2887('0x20')],_0x37484f['id'],_[_0x2887('0x13')](_0x15b047,'id')['join'](','));}return;}else{logger[_0x2887('0x7')](_0x2887('0x22'),_0x489491[_0x2887('0x20')],_0x37484f['id']);var _0x335632={'ListId':_0xd02bfa};var _0xb9e1d4=_0x33228a[_0x2887('0x23')]&&_0x33228a[_0x2887('0x23')]!=='0'?_0x33228a['data4']:_0x2887('0x11');if(_0x323497){logger[_0x2887('0x7')](_0x2887('0x24'),_0x489491[_0x2887('0x20')],_0x37484f['id']);_0x335632[_0xb9e1d4]=_[_0x2887('0xc')](_0x489491[_0x2887('0x14')])?_0x489491['calleridnum']:_0x489491[_0x2887('0x16')];if(_[_0x2887('0xc')](_0x489491[_0x2887('0x14')])){_0x335632[_0x2887('0x17')]=_0x489491[_0x2887('0x25')]&&_0x489491[_0x2887('0x25')]!==_0x2887('0x26')?_0x489491['calleridname']:_0x2887('0x27');}else{_0x335632[_0x2887('0x17')]=_0x489491[_0x2887('0x28')]&&_0x489491[_0x2887('0x28')]!==''?_0x489491[_0x2887('0x28')]:'Unknown';}return BPromise[_0x2887('0x29')]()[_0x2887('0x1e')](cmContactRpc[_0x2887('0x2a')](_0x335632))['then'](function(_0x1f7f4d){_0x2ae833=_0x1f7f4d;_0x15b047[_0x2887('0x2b')](_0x1f7f4d);if(_0x2ae833){logger['info'](_0x2887('0x2c'),_0x489491['uniqueid'],_0x37484f['id'],_0x2ae833['id']);}return;});}else{logger[_0x2887('0x7')](_0x2887('0x2d'),_0x489491[_0x2887('0x20')],_0x37484f['id']);_0x335632[_0xb9e1d4]=_[_0x2887('0xc')](_0x489491[_0x2887('0x14')])?_0x489491[_0x2887('0x15')]:_0x489491[_0x2887('0x16')];if(_['isNil'](_0x489491[_0x2887('0x14')])){_0x335632[_0x2887('0x17')]=_0x489491[_0x2887('0x25')]&&_0x489491['calleridname']!==_0x2887('0x26')?_0x489491[_0x2887('0x25')]:_0x2887('0x27');}else{_0x335632[_0x2887('0x17')]=_0x489491[_0x2887('0x28')]&&_0x489491['destcalleridname']!==_0x2887('0x26')?_0x489491[_0x2887('0x28')]:_0x2887('0x27');}_0x2ae833=_0x335632;_0x15b047[_0x2887('0x2b')](_0x335632);return;}}})['then'](function(){if(_0x44d1e9){emit(_0x489491[_0x2887('0x20')],_0x37484f,util[_0x2887('0x2e')]('user:%s',_0x44d1e9['name']),util['format']('trigger:%s',_0x33228a[_0x2887('0x2f')][_0x2887('0x30')]()),{'evt':_[_0x2887('0x31')](_0x489491,{'autoCreate':_0x323497}),'contact':_0x2ae833===undefined?{}:_0x2ae833,'contacts':_0x15b047[_0x2887('0x32')]===0x0?undefined:_0x15b047});}});}; \ No newline at end of file +var _0x88f8=['../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','updatedAt','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','util','../../../../config/environment','trigger'];(function(_0x4ec582,_0x5374b7){var _0x331a97=function(_0x1a584b){while(--_0x1a584b){_0x4ec582['push'](_0x4ec582['shift']());}};_0x331a97(++_0x5374b7);}(_0x88f8,0xd4));var _0x888f=function(_0x376940,_0x34a45e){_0x376940=_0x376940-0x0;var _0x30803d=_0x88f8[_0x376940];return _0x30803d;};'use strict';var _=require('lodash');var BPromise=require(_0x888f('0x0'));var Redis=require('ioredis');var util=require(_0x888f('0x1'));var config=require(_0x888f('0x2'));var logger=require('../../../../config/logger')(_0x888f('0x3'));var cmContactRpc=require(_0x888f('0x4'));config[_0x888f('0x5')]=_[_0x888f('0x6')](config[_0x888f('0x5')],{'host':_0x888f('0x7'),'port':0x18eb});var io=require(_0x888f('0x8'))(new Redis(config[_0x888f('0x5')]));function emit(_0x40f059,_0x5525fc,_0x3c4d5e,_0x3f8a10,_0xd3b761){logger[_0x888f('0x9')](_0x888f('0xa'),_0x40f059,_0x5525fc['id'],_0x3c4d5e,_0x3f8a10,JSON[_0x888f('0xb')](_0xd3b761));io['to'](_0x3c4d5e)[_0x888f('0xc')](_0x3f8a10,_0xd3b761);}exports[_0x888f('0xd')]=function(_0x53a2c3,_0x4b0490,_0x39937f,_0x588f19){var _0x431c14,_0xe21f56;var _0x40600b={};var _0x32400c;var _0x1d46f4=Number(_0x39937f[_0x888f('0xe')]);var _0x402fd0=_0x39937f[_0x888f('0xf')]?Boolean(Number(_0x39937f['data2'])):![];var _0x18d74c;var _0x29350a=![];if(!_[_0x888f('0x10')](_0x39937f[_0x888f('0x11')])){if(_0x39937f[_0x888f('0x11')]=='1')_0x29350a=!![];}if(!_0x29350a){if(_0x588f19['xmd-contactid']){_0x40600b['id']=_0x588f19[_0x888f('0x12')];}}if(!_0x40600b['id']){_0x40600b['ListId']=_0x1d46f4;_0x18d74c=_0x39937f[_0x888f('0x13')]&&_0x39937f[_0x888f('0x13')]!=='0'?_0x39937f[_0x888f('0x13')][_0x888f('0x14')](','):['phone'];_0x40600b['$or']=_[_0x888f('0x15')](_0x18d74c,function(_0x37cf98){var _0x187b48={};_0x187b48[_0x37cf98]=_0x588f19[_0x888f('0x16')]?_0x588f19[_0x888f('0x17')]:_0x588f19[_0x888f('0x18')];return _0x187b48;});_0x32400c=_0x588f19['routeId']?_0x588f19[_0x888f('0x17')]:_0x588f19[_0x888f('0x18')];}var _0xf382fa=['id',_0x888f('0x19'),'lastName','phone',_0x888f('0x1a'),_0x888f('0x1b'),_0x888f('0x1c'),'createdAt','scheduledAt',_0x888f('0x1d')];var _0x1a4186=_['union'](_0xf382fa,_0x18d74c);BPromise[_0x888f('0x1e')]()[_0x888f('0x1f')](cmContactRpc[_0x888f('0x20')]({'attributes':_0x1a4186,'where':_0x40600b,'phone':_0x32400c}))['then'](function(_0x2629be){_0xe21f56=_0x2629be;if(!_['isEmpty'](_0xe21f56)){if(_0xe21f56[_0x888f('0x21')]===0x1){_0x431c14=_0xe21f56[0x0];logger['info'](_0x888f('0x22'),_0x588f19[_0x888f('0x23')],_0x4b0490['id'],_0x431c14['id']);}else{logger[_0x888f('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x588f19[_0x888f('0x23')],_0x4b0490['id'],_['map'](_0xe21f56,'id')[_0x888f('0x24')](','));}return;}else{logger[_0x888f('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x588f19[_0x888f('0x23')],_0x4b0490['id']);var _0x1a0e92={'ListId':_0x1d46f4};var _0x2b10f0=_0x39937f['data4']&&_0x39937f[_0x888f('0x25')]!=='0'?_0x39937f[_0x888f('0x25')]:_0x888f('0x26');if(_0x402fd0){logger['info'](_0x888f('0x27'),_0x588f19[_0x888f('0x23')],_0x4b0490['id']);_0x1a0e92[_0x2b10f0]=_['isNil'](_0x588f19[_0x888f('0x16')])?_0x588f19[_0x888f('0x18')]:_0x588f19[_0x888f('0x17')];if(_[_0x888f('0x10')](_0x588f19[_0x888f('0x16')])){_0x1a0e92[_0x888f('0x19')]=_0x588f19[_0x888f('0x28')]&&_0x588f19[_0x888f('0x28')]!==''?_0x588f19[_0x888f('0x28')]:_0x888f('0x29');}else{_0x1a0e92[_0x888f('0x19')]=_0x588f19[_0x888f('0x2a')]&&_0x588f19[_0x888f('0x2a')]!==_0x888f('0x2b')?_0x588f19[_0x888f('0x2a')]:_0x888f('0x29');}return BPromise['resolve']()[_0x888f('0x1f')](cmContactRpc[_0x888f('0x2c')](_0x1a0e92))[_0x888f('0x1f')](function(_0x4e3cb7){_0x431c14=_0x4e3cb7;_0xe21f56[_0x888f('0x2d')](_0x4e3cb7);if(_0x431c14){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x588f19[_0x888f('0x23')],_0x4b0490['id'],_0x431c14['id']);}return;});}else{logger[_0x888f('0x9')](_0x888f('0x2e'),_0x588f19[_0x888f('0x23')],_0x4b0490['id']);_0x1a0e92[_0x2b10f0]=_[_0x888f('0x10')](_0x588f19[_0x888f('0x16')])?_0x588f19[_0x888f('0x18')]:_0x588f19[_0x888f('0x17')];if(_[_0x888f('0x10')](_0x588f19['routeId'])){_0x1a0e92[_0x888f('0x19')]=_0x588f19[_0x888f('0x28')]&&_0x588f19['calleridname']!==''?_0x588f19[_0x888f('0x28')]:_0x888f('0x29');}else{_0x1a0e92[_0x888f('0x19')]=_0x588f19[_0x888f('0x2a')]&&_0x588f19['destcalleridname']!==_0x888f('0x2b')?_0x588f19['destcalleridname']:_0x888f('0x29');}_0x431c14=_0x1a0e92;_0xe21f56['push'](_0x1a0e92);return;}}})[_0x888f('0x1f')](function(){if(_0x53a2c3){emit(_0x588f19[_0x888f('0x23')],_0x4b0490,util[_0x888f('0x2f')](_0x888f('0x30'),_0x53a2c3[_0x888f('0x31')]),util[_0x888f('0x2f')](_0x888f('0x32'),_0x39937f[_0x888f('0x33')][_0x888f('0x34')]()),{'evt':_[_0x888f('0x35')](_0x588f19,{'autoCreate':_0x402fd0}),'contact':_0x431c14===undefined?{}:_0x431c14,'contacts':_0xe21f56[_0x888f('0x21')]===0x0?undefined:_0xe21f56});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0d101b4..eaa6f7b 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 _0x7556=['equals','exports','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','checkTrigger','merge','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','query','search','replace','checkConditions','channel','AnyConditions','some','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','lastevent','mailSubstatus','substatus','offlineMessage','created'];(function(_0x3980e3,_0x2fade2){var _0x17add5=function(_0x3017ba){while(--_0x3017ba){_0x3980e3['push'](_0x3980e3['shift']());}};_0x17add5(++_0x2fade2);}(_0x7556,0x188));var _0x6755=function(_0x415edf,_0x34cf3e){_0x415edf=_0x415edf-0x0;var _0x9d29db=_0x7556[_0x415edf];return _0x9d29db;};'use strict';var util=require('util');var _=require('lodash');var url=require('url');var Mustache=require(_0x6755('0x0'));var Redis=require(_0x6755('0x1'));var urlforward=require(_0x6755('0x2'));var integration=require(_0x6755('0x3'));var cmContact=require(_0x6755('0x4'));var script=require(_0x6755('0x5'));var config=require('../../../config/environment');var logger=require(_0x6755('0x6'))(_0x6755('0x7'));var ami=require(_0x6755('0x8'));config[_0x6755('0x9')]=_[_0x6755('0xa')](config[_0x6755('0x9')],{'host':_0x6755('0xb'),'port':0x18eb});var io=require(_0x6755('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x3bd5d8,_0x2a3cc8){return _0x3bd5d8==_0x2a3cc8;},'not_equals':function(_0x32f838,_0x3eb29c){return _0x32f838!=_0x3eb29c;}};var barAndWebActions=['popup',_0x6755('0xd'),_0x6755('0xe')];function Trigger(_0x5820e8){this['triggers']=_0x5820e8[_0x6755('0xf')];this[_0x6755('0x10')]=_0x5820e8['agents'];this[_0x6755('0x11')]=_0x5820e8[_0x6755('0x11')];this[_0x6755('0x12')]=_0x5820e8[_0x6755('0x12')];this[_0x6755('0x13')]=_0x5820e8['voiceExtensions'];this[_0x6755('0x14')]=_0x5820e8['zendeskAccounts'];this[_0x6755('0x15')]=_0x5820e8[_0x6755('0x15')];this[_0x6755('0x16')]=_0x5820e8[_0x6755('0x16')];this[_0x6755('0x17')]=_0x5820e8['sugarcrmAccounts'];this['zohoAccounts']=_0x5820e8[_0x6755('0x18')];this[_0x6755('0x19')]=_0x5820e8[_0x6755('0x19')];this[_0x6755('0x1a')]=_0x5820e8[_0x6755('0x1a')];this[_0x6755('0x1b')]=_0x5820e8[_0x6755('0x1b')];this['dynamics365Accounts']=_0x5820e8[_0x6755('0x1c')];this[_0x6755('0x1d')]=_0x5820e8[_0x6755('0x1d')];this[_0x6755('0x1e')]={'zendesk':this[_0x6755('0x14')],'salesforce':this[_0x6755('0x16')],'freshdesk':this[_0x6755('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x6755('0x19')],'vtiger':this[_0x6755('0x1a')],'dynamics365':this[_0x6755('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6755('0x1b')]};ami['on'](_0x6755('0x1f'),this['syncCustomEvent'][_0x6755('0x20')](this));ami['on'](_0x6755('0x21'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x23'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x24'),this[_0x6755('0x22')]['bind'](this));ami['on'](_0x6755('0x25'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x26'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x27'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x28'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0x6755('0x20')](this));ami['on'](_0x6755('0x29'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x2a'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x2b'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x2c'),this[_0x6755('0x2d')][_0x6755('0x20')](this));ami['on'](_0x6755('0x2e'),this[_0x6755('0x2d')][_0x6755('0x20')](this));ami['on'](_0x6755('0x2f'),this[_0x6755('0x2d')][_0x6755('0x20')](this));ami['on'](_0x6755('0x30'),this['syncCustomEvent'][_0x6755('0x20')](this));ami['on'](_0x6755('0x31'),this['syncCustomEvent']['bind'](this));ami['on']('custom:substatus',this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x32'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x33'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on']('custom:acceptmessage',this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on'](_0x6755('0x34'),this[_0x6755('0x22')][_0x6755('0x20')](this));ami['on']('custom:offlineMessage',this[_0x6755('0x22')][_0x6755('0x20')](this));}Trigger[_0x6755('0x35')][_0x6755('0x36')]=function(_0x3a4807,_0x3baf8b,_0x47382c){logger[_0x6755('0x37')](_0x3a4807,_0x3baf8b,JSON[_0x6755('0x38')](_0x47382c));io['to'](_0x3a4807)[_0x6755('0x36')](_0x3baf8b,_0x47382c);};Trigger[_0x6755('0x35')][_0x6755('0x22')]=function(_0x3da684){var _0x98301b=_[_0x6755('0x39')](_0x3da684);if(typeof _0x98301b[_0x6755('0x3a')]===_0x6755('0x3b')){_0x98301b['motionChannel']=_0x6755('0x3c');}logger[_0x6755('0x3d')](_0x6755('0x22'),util[_0x6755('0x3e')](_0x98301b,{'showHidden':!![],'depth':null}));this[_0x6755('0x3f')](_0x98301b);};Trigger['prototype'][_0x6755('0x2d')]=function(_0x426340){if(this[_0x6755('0x10')][_0x426340['interface']]){this[_0x6755('0x22')](_0x426340);}};Trigger[_0x6755('0x35')][_0x6755('0x3f')]=function(_0x3776b){var _0x5989cf;for(var _0x41dc38 in this['triggers']){if(this[_0x6755('0xf')]['hasOwnProperty'](_0x41dc38)){if(this[_0x6755('0xf')][_0x41dc38]['status']){_0x5989cf=this[_0x6755('0x40')](this['triggers'][_0x41dc38],_0x3776b);if(_0x5989cf){_[_0x6755('0x41')](_0x3776b,_0x3776b['variables']);for(var _0x371fca=0x0,_0x26b3e6,_0x3c01ef,_0x42f648;_0x371fca0x0){_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 +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x5fc3[_0x39872b];return _0x55fa18;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 e0c77f2..0cfdfd7 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 _0x8891=[']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','catch','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=','\x20eq\x20\x27','replace','%2b','nothing','info','forEach','includes','string','picklist','type','customField','indexOf','ticketType','incident','incidents','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:'];(function(_0x588a54,_0x263041){var _0x1957e2=function(_0x2a2476){while(--_0x2a2476){_0x588a54['push'](_0x588a54['shift']());}};_0x1957e2(++_0x263041);}(_0x8891,0xdb));var _0x1889=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x8891[_0xe1269d];return _0x261ca1;};'use strict';var _=require(_0x1889('0x0'));var rp=require('request-promise');var util=require(_0x1889('0x1'));var intUtil=require(_0x1889('0x2'));var md5=require('md5');var Redis=require(_0x1889('0x3'));var logger=require(_0x1889('0x4'))(_0x1889('0x5'));var config=require('../../../../config/environment');config[_0x1889('0x6')]=_[_0x1889('0x7')](config[_0x1889('0x6')],{'host':_0x1889('0x8'),'port':0x18eb});var io=require(_0x1889('0x9'))(new Redis(config[_0x1889('0x6')]));function getAuthToken(_0x19fa79,_0x3c318d,_0x5af1e0){if(_0x19fa79['modernAuthentication']){_0x19fa79[_0x1889('0xa')]=_0x19fa79[_0x1889('0xb')][_0x1889('0xc')];_0x19fa79[_0x1889('0xd')]=_0x19fa79[_0x1889('0xb')][_0x1889('0xe')];return Promise[_0x1889('0xf')](_0x19fa79[_0x1889('0xb')]['data5']);}var _0x182e43={'method':'POST','uri':_0x3c318d,'form':{'client_id':_0x19fa79[_0x1889('0x10')],'resource':_0x19fa79[_0x1889('0xa')],'username':_0x19fa79[_0x1889('0x11')],'password':_0x19fa79[_0x1889('0x12')],'grant_type':_0x1889('0x12'),'client_secret':_0x19fa79[_0x1889('0x13')]},'json':!![]};return rp(_0x182e43)[_0x1889('0x14')](function(_0x5a8252){return _0x5a8252[_0x1889('0x15')];})['catch'](function(_0x293013){logger[_0x1889('0x16')]('['+[_0x5af1e0[_0x1889('0x17')]()]+_0x1889('0x18'));return _0x293013['message'];});}function getUser(_0x945d57,_0x42a812,_0x7dbd4f,_0x5d8d27,_0x270183,_0x41c290){return new Promise(function(_0x3e6ebe,_0x3fa096){return getAuthToken(_0x42a812,_0x5d8d27,_0x41c290)[_0x1889('0x14')](function(_0x96a82d){var _0x244e7c={'method':_0x1889('0x19'),'uri':_0x270183+_0x1889('0x1a'),'headers':{'Authorization':_0x1889('0x1b')+_0x96a82d,'OData-Version':_0x1889('0x1c')},'json':!![]};return rp(_0x244e7c);})[_0x1889('0x14')](function(_0x3cc771){var _0x337c1d=_0x3cc771[_0x1889('0x1d')];var _0x2c669f=![];var _0x1cc649=null;if(!_[_0x1889('0x1e')](_0x7dbd4f)){if(intUtil[_0x1889('0x1f')](_0x7dbd4f[_0x1889('0x20')])){_0x945d57[_0x1889('0x21')]=_0x7dbd4f[_0x1889('0x20')];for(_0x1cc649=0x0;_0x1cc649<_0x337c1d[_0x1889('0x22')];_0x1cc649++){if(_0x337c1d[_0x1cc649][_0x1889('0x23')]===_0x7dbd4f[_0x1889('0x20')]&&!_0x337c1d[_0x1cc649][_0x1889('0x24')]){_0x2c669f=!![];logger['info']('['+[_0x41c290[_0x1889('0x17')]()]+_0x1889('0x25')+_0x337c1d[_0x1cc649][_0x1889('0x26')]+'!');_0x945d57[_0x1889('0x27')]=_0x337c1d[_0x1cc649][_0x1889('0x26')];}}}}if(!_0x2c669f){logger['info']('['+[_0x41c290[_0x1889('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x945d57['userEmail']=_0x42a812[_0x1889('0x11')];for(_0x1cc649=0x0;_0x1cc649<_0x337c1d[_0x1889('0x22')];_0x1cc649++){if(_0x337c1d[_0x1cc649][_0x1889('0x23')]===_0x42a812['username']){_0x945d57['userId']=_0x337c1d[_0x1cc649]['systemuserid'];}}}_0x3e6ebe(_0x945d57);})[_0x1889('0x28')](function(_0x5db801){_0x3fa096(_0x5db801[_0x1889('0x29')]);});});}function createEndUser(_0x3dedec,_0x484c1c,_0x3a0344,_0x1716c7,_0x13f74f,_0x59c325,_0xf1fc79){return new Promise(function(_0x2ab4e5,_0x47b6d3){return getAuthToken(_0x484c1c,_0x3a0344,_0x59c325)[_0x1889('0x14')](function(_0x2a7dd9){var _0x1cd081=_0x59c325[_0x1889('0x2a')]()===_0x1889('0x2b')?_0x13f74f[_0x1889('0x2c')]:_0x13f74f[_0x1889('0x2d')];var _0x446312={'method':_0x1889('0x2e'),'uri':_0x1716c7+'contacts','body':{'fullname':_0x1cd081,'firstname':_0x1cd081,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1889('0x2f')+_0x3dedec[_0x1889('0x27')]+')'},'headers':{'Authorization':_0x1889('0x1b')+_0x2a7dd9,'OData-Version':_0x1889('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x446312['body'][_0xf1fc79]=_0x1cd081;return rp(_0x446312);})[_0x1889('0x14')](function(_0x128c8e){var _0x21a886=_0x128c8e[_0x1889('0x30')]['odata-entityid'];var _0x2ec613=_0x21a886[_0x1889('0x31')](_0x21a886[_0x1889('0x32')]('(')+0x1,_0x21a886[_0x1889('0x32')](')'));_0x3dedec[_0x1889('0x33')]=_0x2ec613;_0x2ab4e5(_0x3dedec);})['catch'](function(_0x26c7e6){_0x47b6d3(_0x26c7e6[_0x1889('0x29')]);});});}function getEndUser(_0x12e318,_0x119a33,_0x3fb8c3,_0x2e8350,_0xd8e8df,_0x26146c,_0x54a823,_0x453022){var _0x133ac4=_0x26146c[_0x1889('0x2a')]()===_0x1889('0x2b')?_0xd8e8df[_0x1889('0x2c')]:_0xd8e8df[_0x1889('0x2d')];return getAuthToken(_0x119a33,_0x3fb8c3,_0x26146c)[_0x1889('0x14')](function(_0x7d7509){_0x453022=_0x453022?_0x453022:'telephone1';var _0x172438={'method':_0x1889('0x19'),'uri':_0x2e8350+_0x1889('0x34')+_0x453022+'&$filter='+_0x453022+_0x1889('0x35')+_0x133ac4[_0x1889('0x36')]('+',_0x1889('0x37'))+'\x27','headers':{'Authorization':_0x1889('0x1b')+_0x7d7509,'If-None-Match':null,'OData-Version':_0x1889('0x1c')},'json':!![]};return rp(_0x172438);})[_0x1889('0x14')](function(_0x3644f9){var _0xc90f82=![];if(!_0x3644f9)return _0xc90f82;var _0xe86867=_0x3644f9[_0x1889('0x1d')];for(var _0x4f5572=0x0;_0x4f5572<_0xe86867[_0x1889('0x22')];_0x4f5572++){if(_0xe86867[_0x4f5572][_0x453022]===_0x133ac4){_0xc90f82=!![];_0x12e318[_0x1889('0x33')]=_0xe86867[_0x4f5572]['contactid'];}}return _0xc90f82;})['then'](function(_0x4c6b43){if(_0x4c6b43)return _0x12e318;if(_0x54a823===_0x1889('0x38')){logger[_0x1889('0x39')]('['+[_0x26146c[_0x1889('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x12e318;}return createEndUser(_0x12e318,_0x119a33,_0x3fb8c3,_0x2e8350,_0xd8e8df,_0x26146c,_0x453022)[_0x1889('0x14')](function(_0xd818e6){logger['info']('['+[_0x26146c[_0x1889('0x17')]()]+']\x20Enduser\x20created!',_0xd818e6['enduserId']);return _0xd818e6;});});}function getCustomFields(_0x29b8f5,_0x25e12b,_0x3e314c){var _0x2f8232={};if(_0x29b8f5[_0x1889('0x22')]>0x0){_[_0x1889('0x3a')](_0x29b8f5,function(_0x739ac1){if(_[_0x1889('0x3b')]([_0x1889('0x3c'),_0x1889('0x3d')],_0x739ac1[_0x1889('0x3e')])&&_0x739ac1['nameField']&&!_0x739ac1[_0x1889('0x3f')]){var _0x2aebf2=_0x739ac1['idField'][_0x1889('0x2a')]();var _0x29ca26=_0x2aebf2[_0x1889('0x31')](0x0,_0x2aebf2['indexOf']('_'));var _0x1cbbbb=_0x2aebf2['substring'](_0x2aebf2[_0x1889('0x40')]('_')+0x1);if(_0x29ca26===_0x3e314c){_0x2f8232[_0x1cbbbb]=_0x739ac1['content'];}}});}return _0x2f8232;}function getTicket(_0x283a36,_0x2e1de3,_0x1197e5,_0x59653b,_0x38908e,_0x225cf0,_0x5df7c0){return new Promise(function(_0x427738,_0x1f360c){var _0x320cf0;return getAuthToken(_0x2e1de3,_0x1197e5,_0x5df7c0)['then'](function(_0x522fdc){if(_0x225cf0[_0x1889('0x41')]===_0x1889('0x42')){_0x320cf0={'method':'POST','uri':_0x59653b+_0x1889('0x43'),'body':Object['assign']({},{'title':intUtil[_0x1889('0x44')](_0x225cf0[_0x1889('0x45')],_0x38908e,'\x20'),'description':intUtil[_0x1889('0x44')](_0x225cf0['Descriptions'],_0x38908e,'\x0a'),'customerid_contact@odata.bind':_0x283a36[_0x1889('0x33')]?_0x1889('0x46')+_0x283a36[_0x1889('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x283a36[_0x1889('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x225cf0[_0x1889('0x47')],_0x38908e,_0x225cf0[_0x1889('0x41')])),'headers':{'Authorization':_0x1889('0x1b')+_0x522fdc,'OData-Version':_0x1889('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x225cf0['ticketType']===_0x1889('0x48')){var _0x1220ef=_0x283a36[_0x1889('0x33')]?[{'partyid_systemuser@odata.bind':_0x1889('0x2f')+_0x283a36['userId']+')','participationtypemask':_0x283a36[_0x1889('0x49')]===_0x1889('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x1889('0x46')+_0x283a36['enduserId']+')','participationtypemask':_0x283a36[_0x1889('0x49')]===_0x1889('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1889('0x2f')+_0x283a36['userId']+')','participationtypemask':_0x283a36[_0x1889('0x49')]==='queue'?0x2:0x1}];_0x320cf0={'method':'POST','uri':_0x59653b+_0x1889('0x4b'),'body':Object[_0x1889('0x4c')]({},{'subject':intUtil[_0x1889('0x44')](_0x225cf0[_0x1889('0x45')],_0x38908e,'\x20'),'phonenumber':String(_0x38908e[_0x1889('0x2d')]),'description':intUtil[_0x1889('0x44')](_0x225cf0['Descriptions'],_0x38908e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x283a36['enduserId']?_0x1889('0x46')+_0x283a36[_0x1889('0x33')]+')':undefined,'ownerid@odata.bind':_0x1889('0x2f')+_0x283a36[_0x1889('0x27')]+')','directioncode':_0x283a36['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x1220ef},getCustomFields(_0x225cf0[_0x1889('0x47')],_0x38908e,_0x225cf0['ticketType'])),'headers':{'Authorization':_0x1889('0x1b')+_0x522fdc,'OData-Version':_0x1889('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x320cf0);})['then'](function(_0x3ccd52){var _0x9de711=_0x3ccd52[_0x1889('0x30')][_0x1889('0x4d')];var _0x1912f1=_0x9de711[_0x1889('0x31')](_0x9de711[_0x1889('0x32')]('(')+0x1,_0x9de711[_0x1889('0x32')](')'));_0x283a36[_0x1889('0x4e')]=_0x1912f1;_0x427738(_0x283a36);})['catch'](function(_0x3a700e){_0x1f360c(_0x3a700e[_0x1889('0x29')]);});});}function emit(_0x14319e,_0x583c5c,_0x3e5810,_0x5d9c5e){var _0x405ef3={'uri':util[_0x1889('0x4f')](_0x1889('0x50'),_0x14319e,_0x3e5810,_0x5d9c5e)};io['to'](util[_0x1889('0x4f')](_0x1889('0x51'),_0x583c5c))[_0x1889('0x52')](_0x1889('0x53'),_0x405ef3);}exports['cs']=function(_0x7f0d53,_0x40d5a9,_0x4fc15b,_0x2128a0,_0x272862,_0x29acf5,_0x338ef6,_0x3d5788){var _0x4c6cbf={};_0x29acf5[_0x1889('0xa')]=_0x29acf5[_0x1889('0x54')]?intUtil[_0x1889('0x55')](_0x29acf5[_0x1889('0xb')][_0x1889('0xc')]):intUtil[_0x1889('0x55')](_0x29acf5[_0x1889('0xa')]);_0x29acf5[_0x1889('0x56')]=intUtil[_0x1889('0x55')](_0x29acf5[_0x1889('0x56')]);_0x4c6cbf[_0x1889('0x49')]=_0x3d5788===_0x1889('0x4a')||_0x3d5788===_0x1889('0x57')?_0x1889('0x4a'):_0x1889('0x2b');var _0x25b52f=_0x29acf5['modernAuthentication']?util['format'](_0x1889('0x58'),_0x29acf5['CloudProvider'][_0x1889('0xc')]):util['format'](_0x1889('0x58'),_0x29acf5[_0x1889('0xa')]);var _0x370891=util[_0x1889('0x4f')](_0x1889('0x59'),_0x29acf5[_0x1889('0xd')]);var _0x461a6a=util[_0x1889('0x4f')](_0x1889('0x5a'),_0x29acf5[_0x1889('0x56')],_0x40d5a9[_0x1889('0x5b')],md5(_0x40d5a9[_0x1889('0x5b')]));if(_0x272862&&_0x272862[_0x1889('0x5c')]){logger[_0x1889('0x39')](_0x1889('0x5d'),_0x1889('0x5e'));_0x40d5a9['recordingURL']=_0x461a6a;}else if(_0x338ef6&&_0x338ef6[_0x1889('0x5f')]&&_0x338ef6[_0x1889('0x5f')]!==_0x1889('0x60')){logger[_0x1889('0x39')](_0x1889('0x61'),'Recording\x20is\x20enabled!');_0x40d5a9['recordingURL']=_0x461a6a;}else{_0x40d5a9[_0x1889('0x62')]='';}return getUser(_0x4c6cbf,_0x29acf5,_0x2128a0,_0x370891,_0x25b52f,_0x3d5788)[_0x1889('0x14')](function(_0x1ff489){logger[_0x1889('0x39')]('['+_0x3d5788['toUpperCase']()+_0x1889('0x63'),_0x1ff489[_0x1889('0x27')]);logger[_0x1889('0x39')]('['+_0x3d5788[_0x1889('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x1ff489['userEmail']);return getEndUser(_0x1ff489,_0x29acf5,_0x370891,_0x25b52f,_0x40d5a9,_0x3d5788,_0x4fc15b['moduleCreate'],_0x4fc15b[_0x1889('0x64')]);})[_0x1889('0x14')](function(_0x5a61d7){logger[_0x1889('0x39')]('['+_0x3d5788[_0x1889('0x17')]()+_0x1889('0x65'),_0x5a61d7[_0x1889('0x33')]);logger[_0x1889('0x39')]('['+_0x3d5788[_0x1889('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x40d5a9[_0x1889('0x2d')]);return getTicket(_0x5a61d7,_0x29acf5,_0x370891,_0x25b52f,_0x40d5a9,_0x4fc15b,_0x3d5788);})[_0x1889('0x14')](function(_0x5b86af){logger[_0x1889('0x39')](util['format']('['+_0x3d5788[_0x1889('0x17')]()+_0x1889('0x66'),_0x4fc15b[_0x1889('0x41')],_0x5b86af[_0x1889('0x4e')]));logger[_0x1889('0x39')](util[_0x1889('0x4f')]('['+_0x3d5788[_0x1889('0x17')]()+_0x1889('0x67'),_0x3d5788));if(_0x3d5788!==_0x1889('0x57')&&_0x4fc15b[_0x1889('0x68')]){logger[_0x1889('0x39')]('['+_0x3d5788['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x29acf5[_0x1889('0xa')],_0x2128a0[_0x1889('0x69')],_0x4fc15b[_0x1889('0x41')],_0x5b86af[_0x1889('0x4e')]);}})[_0x1889('0x28')](function(_0x34edc7){logger[_0x1889('0x16')]('['+_0x3d5788[_0x1889('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x34edc7[_0x1889('0x29')]);console['error'](_0x1889('0x6a'),_0x34edc7);});}; \ No newline at end of file +var _0x66c8=['error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','customField','idField','indexOf','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x57dea9,_0x2b1cae){var _0x258130=function(_0x260677){while(--_0x260677){_0x57dea9['push'](_0x57dea9['shift']());}};_0x258130(++_0x2b1cae);}(_0x66c8,0x1be));var _0x866c=function(_0x27b482,_0x4f246f){_0x27b482=_0x27b482-0x0;var _0x4d685d=_0x66c8[_0x27b482];return _0x4d685d;};'use strict';var _=require(_0x866c('0x0'));var rp=require(_0x866c('0x1'));var util=require(_0x866c('0x2'));var intUtil=require('./util');var md5=require(_0x866c('0x3'));var Redis=require(_0x866c('0x4'));var logger=require(_0x866c('0x5'))(_0x866c('0x6'));var config=require(_0x866c('0x7'));config[_0x866c('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x866c('0x9'))(new Redis(config[_0x866c('0x8')]));function getAuthToken(_0x2a9937,_0x20d7a4,_0x3e42d3){if(_0x2a9937[_0x866c('0xa')]){_0x2a9937[_0x866c('0xb')]=_0x2a9937[_0x866c('0xc')][_0x866c('0xd')];_0x2a9937[_0x866c('0xe')]=_0x2a9937[_0x866c('0xc')][_0x866c('0xf')];return Promise[_0x866c('0x10')](_0x2a9937[_0x866c('0xc')][_0x866c('0x11')]);}var _0x5beac3={'method':'POST','uri':_0x20d7a4,'form':{'client_id':_0x2a9937[_0x866c('0x12')],'resource':_0x2a9937[_0x866c('0xb')],'username':_0x2a9937[_0x866c('0x13')],'password':_0x2a9937[_0x866c('0x14')],'grant_type':_0x866c('0x14'),'client_secret':_0x2a9937[_0x866c('0x15')]},'json':!![]};return rp(_0x5beac3)[_0x866c('0x16')](function(_0x213cf1){return _0x213cf1[_0x866c('0x17')];})[_0x866c('0x18')](function(_0x2eb42c){logger['error']('['+[_0x3e42d3[_0x866c('0x19')]()]+_0x866c('0x1a'));return _0x2eb42c[_0x866c('0x1b')];});}function getUser(_0x3cf372,_0x4a9c7f,_0xb2adfb,_0x33654c,_0x362760,_0x5091e7){return new Promise(function(_0x3a9f41,_0x59fb99){return getAuthToken(_0x4a9c7f,_0x33654c,_0x5091e7)[_0x866c('0x16')](function(_0x19501b){var _0x55b0f1={'method':'GET','uri':_0x362760+_0x866c('0x1c'),'headers':{'Authorization':_0x866c('0x1d')+_0x19501b,'OData-Version':'4.0'},'json':!![]};return rp(_0x55b0f1);})[_0x866c('0x16')](function(_0x4467de){var _0x11c371=_0x4467de[_0x866c('0x1e')];var _0xcebb88=![];var _0x215a6d=null;if(!_[_0x866c('0x1f')](_0xb2adfb)){if(intUtil[_0x866c('0x20')](_0xb2adfb[_0x866c('0x21')])){_0x3cf372[_0x866c('0x22')]=_0xb2adfb[_0x866c('0x21')];for(_0x215a6d=0x0;_0x215a6d<_0x11c371[_0x866c('0x23')];_0x215a6d++){if(_0x11c371[_0x215a6d][_0x866c('0x24')]===_0xb2adfb['email']&&!_0x11c371[_0x215a6d][_0x866c('0x25')]){_0xcebb88=!![];logger['info']('['+[_0x5091e7['toUpperCase']()]+_0x866c('0x26')+_0x11c371[_0x215a6d][_0x866c('0x27')]+'!');_0x3cf372[_0x866c('0x28')]=_0x11c371[_0x215a6d][_0x866c('0x27')];}}}}if(!_0xcebb88){logger[_0x866c('0x29')]('['+[_0x5091e7[_0x866c('0x19')]()]+_0x866c('0x2a'));_0x3cf372[_0x866c('0x22')]=_0x4a9c7f['username'];for(_0x215a6d=0x0;_0x215a6d<_0x11c371[_0x866c('0x23')];_0x215a6d++){if(_0x11c371[_0x215a6d][_0x866c('0x24')]===_0x4a9c7f[_0x866c('0x13')]){_0x3cf372[_0x866c('0x28')]=_0x11c371[_0x215a6d][_0x866c('0x27')];}}}_0x3a9f41(_0x3cf372);})['catch'](function(_0x5d7b41){_0x59fb99(_0x5d7b41[_0x866c('0x1b')]);});});}function createEndUser(_0x9598c9,_0x355415,_0x4e7f8c,_0x59278e,_0x11b77c,_0x200bfa,_0x325efc){return new Promise(function(_0x4f6b29,_0x477998){return getAuthToken(_0x355415,_0x4e7f8c,_0x200bfa)[_0x866c('0x16')](function(_0x42e251){var _0x5b8589=_0x200bfa[_0x866c('0x2b')]()==='outbound'?_0x11b77c[_0x866c('0x2c')]:_0x11b77c[_0x866c('0x2d')];var _0x43964b={'method':'POST','uri':_0x59278e+_0x866c('0x2e'),'body':{'fullname':_0x5b8589,'firstname':_0x5b8589,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x866c('0x2f')+_0x9598c9[_0x866c('0x28')]+')'},'headers':{'Authorization':_0x866c('0x1d')+_0x42e251,'OData-Version':_0x866c('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0x43964b['body'][_0x325efc]=_0x5b8589;return rp(_0x43964b);})[_0x866c('0x16')](function(_0x111759){var _0x1e6334=_0x111759['headers'][_0x866c('0x31')];var _0x565409=_0x1e6334[_0x866c('0x32')](_0x1e6334[_0x866c('0x33')]('(')+0x1,_0x1e6334[_0x866c('0x33')](')'));_0x9598c9[_0x866c('0x34')]=_0x565409;_0x4f6b29(_0x9598c9);})[_0x866c('0x18')](function(_0x453da7){_0x477998(_0x453da7[_0x866c('0x1b')]);});});}function getEndUser(_0x5713d8,_0x4d22d6,_0xd6fcf2,_0xe74485,_0x4877ad,_0x4b65c5,_0x3cc101,_0x30dfc2){var _0x4a969f=_0x4b65c5['toLowerCase']()==='outbound'?_0x4877ad[_0x866c('0x2c')]:_0x4877ad[_0x866c('0x2d')];return getAuthToken(_0x4d22d6,_0xd6fcf2,_0x4b65c5)[_0x866c('0x16')](function(_0x25b259){_0x30dfc2=_0x30dfc2?_0x30dfc2:_0x866c('0x35');var _0x35479e={'method':_0x866c('0x36'),'uri':_0xe74485+_0x866c('0x37')+_0x30dfc2+_0x866c('0x38')+_0x30dfc2+_0x866c('0x39')+_0x4a969f['replace']('+',_0x866c('0x3a'))+'\x27','headers':{'Authorization':_0x866c('0x1d')+_0x25b259,'If-None-Match':null,'OData-Version':_0x866c('0x30')},'json':!![]};return rp(_0x35479e);})[_0x866c('0x16')](function(_0x36da51){var _0x2ee5ce=![];if(!_0x36da51)return _0x2ee5ce;var _0x150074=_0x36da51[_0x866c('0x1e')];for(var _0x44b10e=0x0;_0x44b10e<_0x150074['length'];_0x44b10e++){if(_0x150074[_0x44b10e][_0x30dfc2]===_0x4a969f){_0x2ee5ce=!![];_0x5713d8[_0x866c('0x34')]=_0x150074[_0x44b10e]['contactid'];}}return _0x2ee5ce;})[_0x866c('0x16')](function(_0x13cde3){if(_0x13cde3)return _0x5713d8;if(_0x3cc101===_0x866c('0x3b')){logger[_0x866c('0x29')]('['+[_0x4b65c5[_0x866c('0x19')]()]+_0x866c('0x3c'));return _0x5713d8;}return createEndUser(_0x5713d8,_0x4d22d6,_0xd6fcf2,_0xe74485,_0x4877ad,_0x4b65c5,_0x30dfc2)[_0x866c('0x16')](function(_0x444927){logger[_0x866c('0x29')]('['+[_0x4b65c5[_0x866c('0x19')]()]+']\x20Enduser\x20created!',_0x444927[_0x866c('0x34')]);return _0x444927;});});}function getCustomFields(_0x4d1de3,_0x128f7d,_0x3abc7b){var _0x35d9d2={};if(_0x4d1de3[_0x866c('0x23')]>0x0){_[_0x866c('0x3d')](_0x4d1de3,function(_0x4dd0df){if(_[_0x866c('0x3e')]([_0x866c('0x3f'),_0x866c('0x40')],_0x4dd0df['type'])&&_0x4dd0df['nameField']&&!_0x4dd0df[_0x866c('0x41')]){var _0x469aa3=_0x4dd0df[_0x866c('0x42')][_0x866c('0x2b')]();var _0xbc03e2=_0x469aa3['substring'](0x0,_0x469aa3[_0x866c('0x43')]('_'));var _0x55d7f2=_0x469aa3[_0x866c('0x32')](_0x469aa3[_0x866c('0x43')]('_')+0x1);if(_0xbc03e2===_0x3abc7b){_0x35d9d2[_0x55d7f2]=_0x4dd0df['content'];}}});}return _0x35d9d2;}function getTicket(_0x5942ce,_0x55fa06,_0x1a44be,_0xf4e7b9,_0x295abf,_0x130491,_0x4c5ad7){return new Promise(function(_0x1e948e,_0x1a3913){var _0x19438e;return getAuthToken(_0x55fa06,_0x1a44be,_0x4c5ad7)[_0x866c('0x16')](function(_0x3af7da){if(_0x130491['ticketType']===_0x866c('0x44')){_0x19438e={'method':_0x866c('0x45'),'uri':_0xf4e7b9+_0x866c('0x46'),'body':Object[_0x866c('0x47')]({},{'title':intUtil[_0x866c('0x48')](_0x130491[_0x866c('0x49')],_0x295abf,'\x20'),'description':intUtil['getString'](_0x130491[_0x866c('0x4a')],_0x295abf,'\x0a'),'customerid_contact@odata.bind':_0x5942ce[_0x866c('0x34')]?_0x866c('0x4b')+_0x5942ce[_0x866c('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5942ce[_0x866c('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x130491[_0x866c('0x4c')],_0x295abf,_0x130491['ticketType'])),'headers':{'Authorization':_0x866c('0x1d')+_0x3af7da,'OData-Version':_0x866c('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x130491[_0x866c('0x4d')]===_0x866c('0x4e')){var _0x1dd9ad=_0x5942ce['enduserId']?[{'partyid_systemuser@odata.bind':_0x866c('0x2f')+_0x5942ce['userId']+')','participationtypemask':_0x5942ce[_0x866c('0x4f')]===_0x866c('0x50')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5942ce[_0x866c('0x34')]+')','participationtypemask':_0x5942ce['callDirection']===_0x866c('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x866c('0x2f')+_0x5942ce[_0x866c('0x28')]+')','participationtypemask':_0x5942ce[_0x866c('0x4f')]==='queue'?0x2:0x1}];_0x19438e={'method':_0x866c('0x45'),'uri':_0xf4e7b9+'phonecalls','body':Object[_0x866c('0x47')]({},{'subject':intUtil[_0x866c('0x48')](_0x130491['Subjects'],_0x295abf,'\x20'),'phonenumber':String(_0x295abf[_0x866c('0x2d')]),'description':intUtil[_0x866c('0x48')](_0x130491[_0x866c('0x4a')],_0x295abf,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5942ce[_0x866c('0x34')]?'/contacts('+_0x5942ce[_0x866c('0x34')]+')':undefined,'ownerid@odata.bind':_0x866c('0x2f')+_0x5942ce[_0x866c('0x28')]+')','directioncode':_0x5942ce[_0x866c('0x4f')]===_0x866c('0x50')?![]:!![],'phonecall_activity_parties':_0x1dd9ad},getCustomFields(_0x130491['Fields'],_0x295abf,_0x130491[_0x866c('0x4d')])),'headers':{'Authorization':_0x866c('0x1d')+_0x3af7da,'OData-Version':_0x866c('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x19438e);})[_0x866c('0x16')](function(_0x5e03d2){var _0x15c8e9=_0x5e03d2[_0x866c('0x51')][_0x866c('0x31')];var _0x2e5de5=_0x15c8e9[_0x866c('0x32')](_0x15c8e9[_0x866c('0x33')]('(')+0x1,_0x15c8e9[_0x866c('0x33')](')'));_0x5942ce[_0x866c('0x52')]=_0x2e5de5;_0x1e948e(_0x5942ce);})['catch'](function(_0x2dcf3e){_0x1a3913(_0x2dcf3e['message']);});});}function emit(_0x4f672b,_0xa3c322,_0x50cd40,_0x136385){var _0x2eecdb={'uri':util[_0x866c('0x53')](_0x866c('0x54'),_0x4f672b,_0x50cd40,_0x136385)};io['to'](util[_0x866c('0x53')]('user:%s',_0xa3c322))['emit'](_0x866c('0x55'),_0x2eecdb);}exports['cs']=function(_0x28e417,_0x391d95,_0x5d057c,_0x347eaa,_0x5a4e2b,_0x147640,_0x449c6f,_0x211142){var _0xf92cbc={};_0x147640[_0x866c('0xb')]=_0x147640[_0x866c('0xa')]?intUtil[_0x866c('0x56')](_0x147640[_0x866c('0xc')]['data7']):intUtil[_0x866c('0x56')](_0x147640[_0x866c('0xb')]);_0x147640[_0x866c('0x57')]=intUtil[_0x866c('0x56')](_0x147640[_0x866c('0x57')]);_0xf92cbc[_0x866c('0x4f')]=_0x211142===_0x866c('0x50')||_0x211142===_0x866c('0x58')?_0x866c('0x50'):'outbound';var _0x2d51a0=_0x147640[_0x866c('0xa')]?util[_0x866c('0x53')]('%s/api/data/v9.0/',_0x147640[_0x866c('0xc')][_0x866c('0xd')]):util[_0x866c('0x53')](_0x866c('0x59'),_0x147640[_0x866c('0xb')]);var _0x295762=util['format'](_0x866c('0x5a'),_0x147640[_0x866c('0xe')]);var _0x1119e3=util[_0x866c('0x53')](_0x866c('0x5b'),_0x147640['serverUrl'],_0x391d95[_0x866c('0x5c')],md5(_0x391d95['uniqueid']));if(_0x5a4e2b&&_0x5a4e2b[_0x866c('0x5d')]){logger[_0x866c('0x29')](_0x866c('0x5e'),'Recording\x20is\x20enabled!');_0x391d95[_0x866c('0x5f')]=_0x1119e3;}else if(_0x449c6f&&_0x449c6f[_0x866c('0x60')]&&_0x449c6f['recordingFormat']!==_0x866c('0x61')){logger[_0x866c('0x29')]('[OUTBOUND]',_0x866c('0x62'));_0x391d95['recordingURL']=_0x1119e3;}else{_0x391d95[_0x866c('0x5f')]='';}return getUser(_0xf92cbc,_0x147640,_0x347eaa,_0x295762,_0x2d51a0,_0x211142)[_0x866c('0x16')](function(_0x651ccc){logger[_0x866c('0x29')]('['+_0x211142['toUpperCase']()+_0x866c('0x63'),_0x651ccc['userId']);logger[_0x866c('0x29')]('['+_0x211142[_0x866c('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x651ccc['userEmail']);return getEndUser(_0x651ccc,_0x147640,_0x295762,_0x2d51a0,_0x391d95,_0x211142,_0x5d057c[_0x866c('0x64')],_0x5d057c[_0x866c('0x65')]);})[_0x866c('0x16')](function(_0x8c000){logger['info']('['+_0x211142['toUpperCase']()+_0x866c('0x66'),_0x8c000[_0x866c('0x34')]);logger[_0x866c('0x29')]('['+_0x211142[_0x866c('0x19')]()+_0x866c('0x67'),_0x391d95[_0x866c('0x2d')]);return getTicket(_0x8c000,_0x147640,_0x295762,_0x2d51a0,_0x391d95,_0x5d057c,_0x211142);})[_0x866c('0x16')](function(_0x5464a9){logger[_0x866c('0x29')](util[_0x866c('0x53')]('['+_0x211142[_0x866c('0x19')]()+_0x866c('0x68'),_0x5d057c['ticketType'],_0x5464a9[_0x866c('0x52')]));logger[_0x866c('0x29')](util[_0x866c('0x53')]('['+_0x211142[_0x866c('0x19')]()+_0x866c('0x69'),_0x211142));if(_0x211142!==_0x866c('0x58')&&_0x5d057c[_0x866c('0x6a')]){logger[_0x866c('0x29')]('['+_0x211142['toUpperCase']()+']',_0x866c('0x6b'));emit(_0x147640[_0x866c('0xb')],_0x347eaa[_0x866c('0x6c')],_0x5d057c[_0x866c('0x4d')],_0x5464a9[_0x866c('0x52')]);}})['catch'](function(_0x4895d1){logger[_0x866c('0x6d')]('['+_0x211142[_0x866c('0x19')]()+_0x866c('0x6e'),_0x4895d1[_0x866c('0x1b')]);console[_0x866c('0x6d')]('Error\x20running\x20Dynamics365\x20integration',_0x4895d1);});}; \ 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 a0f21c6..bb06143 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 _0xc81d=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','error','lastevent','toUpperCase','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','then','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','GET','length','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc81d,0x1df));var _0xdc81=function(_0x5f3452,_0x26486f){_0x5f3452=_0x5f3452-0x0;var _0x4e7667=_0xc81d[_0x5f3452];return _0x4e7667;};'use strict';var _=require('lodash');var rp=require(_0xdc81('0x0'));var md5=require('md5');var util=require(_0xdc81('0x1'));var Redis=require(_0xdc81('0x2'));var intUtil=require('./util');var config=require(_0xdc81('0x3'));var logger=require(_0xdc81('0x4'))(_0xdc81('0x5'));config['redis']=_[_0xdc81('0x6')](config[_0xdc81('0x7')],{'host':_0xdc81('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdc81('0x7')]));var headers={'Content-Type':_0xdc81('0x9'),'Accept':_0xdc81('0x9')};function emit(_0x463fae,_0xae3426,_0x423616){io['to'](_0x463fae)['emit'](_0xae3426,_0x423616);}function getTicket(_0x282a37,_0x468c54,_0x572e20,_0x140c25,_0x3c0bd0){logger[_0xdc81('0xa')](_0xdc81('0xb'));var _0x343826=_['merge']({'responder_id':_0x468c54['id'],'requester_id':_0x572e20['id'],'name':util[_0xdc81('0xc')](_0xdc81('0xd'),_0x3c0bd0['calleridname']),'phone':_0x3c0bd0[_0xdc81('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdc81('0xf')](_0x140c25[_0xdc81('0x10')],_0x3c0bd0,'\x20'),'description':intUtil['getString'](_0x140c25['Descriptions'],_0x3c0bd0,_0xdc81('0x11')),'tags':getTags(_0x140c25[_0xdc81('0x12')],_0xdc81('0x13'))},getCustomFields(_0x140c25['Fields'],_0x3c0bd0));_0x343826[_0xdc81('0x14')]=_[_0xdc81('0x15')](_['keyBy'](_0x343826[_0xdc81('0x14')],'id'),_0xdc81('0x16'));return request({'uri':util[_0xdc81('0xc')](_0xdc81('0x17'),_0x282a37['remoteUri']),'method':'POST','body':_0x343826})[_0xdc81('0x18')](function(_0x43e00e){logger[_0xdc81('0xa')]('Ticket\x20created!');return _0x43e00e;});}function getUser(_0x42b9e4,_0x17f2ef){if(intUtil['validateEmail'](_0x17f2ef)){return request({'uri':util[_0xdc81('0xc')](_0xdc81('0x19'),_0x42b9e4[_0xdc81('0x1a')]),'qs':{'email':_0x17f2ef}})['then'](function(_0x4c3139){if(_0x4c3139['length']){logger['info'](_0xdc81('0x1b'));return _[_0xdc81('0x1c')](_0x4c3139,function(_0x2808ab){return _0x2808ab[_0xdc81('0x1d')][_0xdc81('0x1e')]===_0x17f2ef;});}else{logger[_0xdc81('0xa')](_0xdc81('0x1f'));return request({'uri':util['format'](_0xdc81('0x20'),_0x42b9e4[_0xdc81('0x1a')])})[_0xdc81('0x18')](function(_0x4eab41){logger[_0xdc81('0xa')](_0xdc81('0x21'));return _0x4eab41;});}});}else{logger[_0xdc81('0xa')](_0xdc81('0x22'));return request({'uri':util[_0xdc81('0xc')](_0xdc81('0x20'),_0x42b9e4['remoteUri'])})['then'](function(_0x2fe21c){logger[_0xdc81('0xa')]('Admin\x20account\x20selected.');return _0x2fe21c;});}}function getEndUser(_0x1df12c,_0x2f46fd,_0x5efeaa){logger[_0xdc81('0xa')](_0xdc81('0x23'),_0x5efeaa);return request({'uri':util[_0xdc81('0xc')](_0xdc81('0x24'),_0x1df12c[_0xdc81('0x1a')]),'qs':{'phone':_0x5efeaa}})[_0xdc81('0x18')](function(_0x422405){if(_0x422405['length']){logger[_0xdc81('0xa')](_0xdc81('0x25'));return _[_0xdc81('0x1c')](_0x422405,{'phone':_0x5efeaa});}else{logger[_0xdc81('0xa')](_0xdc81('0x26'));return request({'uri':util['format'](_0xdc81('0x24'),_0x1df12c[_0xdc81('0x1a')]),'method':_0xdc81('0x27'),'body':{'name':_0x2f46fd,'phone':_0x5efeaa}})[_0xdc81('0x18')](function(_0xe5f0c6){logger['info'](_0xdc81('0x28'));return _0xe5f0c6;});}});}function getAuth(_0x475639){return util[_0xdc81('0xc')]('Basic\x20%s',new Buffer(_0x475639[_0xdc81('0x29')]+':X')[_0xdc81('0x2a')]('base64'));}function request(_0x8b60d0){logger[_0xdc81('0x2b')](_0xdc81('0x2c'),JSON[_0xdc81('0x2d')](_0x8b60d0));return rp(_[_0xdc81('0x6')](_0x8b60d0,{'method':_0xdc81('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x21aec5,_0x455aed){var _0x12b495=[];if(_0x21aec5&&_0x21aec5[_0xdc81('0x2f')]>0x0){_0x12b495=_['map'](_0x21aec5,_0x455aed);}return _0x12b495;}function getCustomFields(_0x5cc6fa,_0x9277fa){var _0x3853d5=[];var _0x4409b4={'custom_fields':[]};if(_0x5cc6fa[_0xdc81('0x2f')]>0x0){_[_0xdc81('0x30')](_0x5cc6fa,function(_0x5d3865){if(_[_0xdc81('0x31')]([_0xdc81('0x32'),_0xdc81('0x33')],_0x5d3865[_0xdc81('0x34')])&&_0x5d3865['nameField']&&!_0x5d3865[_0xdc81('0x35')]){_0x4409b4[_0x5d3865[_0xdc81('0x36')][_0xdc81('0x37')]()]=_0x5d3865[_0xdc81('0x38')]['toString']();}else if(_[_0xdc81('0x31')]([_0xdc81('0x32'),'picklist'],_0x5d3865[_0xdc81('0x34')])&&_0x5d3865['idField']&&_0x5d3865[_0xdc81('0x35')]){_0x4409b4[_0xdc81('0x14')]['push']({'id':_0x5d3865[_0xdc81('0x39')],'value':_0x5d3865['content'][_0xdc81('0x2a')]()});}else if(_0x5d3865[_0xdc81('0x34')]===_0xdc81('0x3a')&&_0x5d3865[_0xdc81('0x3b')]&&_0x5d3865['idField']&&_0x5d3865[_0xdc81('0x35')]){_0x9277fa[_0x5d3865[_0xdc81('0x3b')]]&&_0x4409b4[_0xdc81('0x14')][_0xdc81('0x3c')]({'id':_0x5d3865[_0xdc81('0x39')],'value':_0x9277fa[_0x5d3865[_0xdc81('0x3b')]][_0xdc81('0x2a')]()});}else if(_0x5d3865[_0xdc81('0x34')]==='customVariable'&&_0x5d3865['Variable']&&_0x5d3865[_0xdc81('0x3d')]['name']&&_0x5d3865['idField']&&_0x5d3865[_0xdc81('0x35')]){_0x9277fa[_0x5d3865[_0xdc81('0x3d')][_0xdc81('0x13')][_0xdc81('0x37')]()]&&_0x4409b4[_0xdc81('0x14')]['push']({'id':_0x5d3865['idField'],'value':_0x9277fa[_0x5d3865[_0xdc81('0x3d')][_0xdc81('0x13')][_0xdc81('0x37')]()][_0xdc81('0x2a')]()});}});}return _0x4409b4;}exports[_0xdc81('0x3e')]=function(_0x3eccde,_0x37ab10,_0x890aa1,_0x4a3078,_0x392f48,_0x31d9e8){var _0x24bc13,_0x35c1e0;_0x31d9e8[_0xdc81('0x1a')]=intUtil[_0xdc81('0x3f')](_0x31d9e8[_0xdc81('0x1a')]);_0x31d9e8[_0xdc81('0x40')]=intUtil[_0xdc81('0x3f')](_0x31d9e8['serverUrl']);if(_0x392f48&&_0x392f48[_0xdc81('0x41')]){logger[_0xdc81('0xa')](_0xdc81('0x42'),_0xdc81('0x43'));_0x37ab10[_0xdc81('0x44')]=util[_0xdc81('0xc')](_0xdc81('0x45'),_0x31d9e8['serverUrl'],_0x37ab10[_0xdc81('0x46')],md5(_0x37ab10[_0xdc81('0x46')]));}else{_0x37ab10['recordingURL']='';}headers[_0xdc81('0x47')]=getAuth(_0x31d9e8);return getUser(_0x31d9e8,_0x4a3078[_0xdc81('0x1e')])[_0xdc81('0x18')](function(_0x5d6a4b){_0x24bc13=_0x5d6a4b;logger[_0xdc81('0xa')](_0xdc81('0x48'),_0x24bc13['id']);return getEndUser(_0x31d9e8,_0x37ab10[_0xdc81('0x49')],_0x37ab10[_0xdc81('0xe')]);})[_0xdc81('0x18')](function(_0x430f37){_0x35c1e0=_0x430f37;logger['info']('The\x20Enduser\x20ID\x20is:',_0x35c1e0['id']);return getTicket(_0x31d9e8,_0x24bc13,_0x35c1e0,_0x890aa1,_0x37ab10);})['then'](function(_0x20ed97){if(_0x20ed97&&_0x20ed97['id']){logger[_0xdc81('0xa')](_0xdc81('0x4a'));logger[_0xdc81('0xa')](_0xdc81('0x4b'),_0x20ed97['id']);logger[_0xdc81('0xa')](_0xdc81('0x42'),_0xdc81('0x4c'));emit(util['format']('user:%s',_0x4a3078[_0xdc81('0x13')]),_0xdc81('0x4d'),{'uri':util[_0xdc81('0xc')](_0xdc81('0x4e'),_0x31d9e8['remoteUri'],_0x20ed97['id'])});}})[_0xdc81('0x4f')](function(_0x4a0eee){logger['error'](_0xdc81('0x42'),JSON['stringify'](_0x4a0eee));});};exports[_0xdc81('0x50')]=function(_0x456477,_0x6d29d8,_0x40796f,_0x2c75b7,_0x5055ba,_0x108c41,_0x284a7c){var _0x10bed1,_0x43f07c;_0x108c41['remoteUri']=intUtil[_0xdc81('0x3f')](_0x108c41[_0xdc81('0x1a')]);_0x108c41[_0xdc81('0x40')]=intUtil[_0xdc81('0x3f')](_0x108c41['serverUrl']);if(_0x284a7c&&_0x284a7c[_0xdc81('0x51')]&&_0x284a7c[_0xdc81('0x51')]!==_0xdc81('0x52')){logger[_0xdc81('0xa')](_0xdc81('0x53'),_0xdc81('0x43'));_0x6d29d8[_0xdc81('0x44')]=util[_0xdc81('0xc')](_0xdc81('0x45'),_0x108c41[_0xdc81('0x40')],_0x6d29d8[_0xdc81('0x46')],md5(_0x6d29d8[_0xdc81('0x46')]));}headers[_0xdc81('0x47')]=getAuth(_0x108c41);return getUser(_0x108c41,_0x2c75b7['email'])[_0xdc81('0x18')](function(_0x497d0a){_0x10bed1=_0x497d0a;logger[_0xdc81('0xa')](_0xdc81('0x48'),_0x10bed1['id']);return getEndUser(_0x108c41,_0x6d29d8[_0xdc81('0x54')],_0x6d29d8[_0xdc81('0x55')]);})[_0xdc81('0x18')](function(_0x4c50c2){_0x43f07c=_0x4c50c2;logger[_0xdc81('0xa')](_0xdc81('0x56'),_0x43f07c['id']);return getTicket(_0x108c41,_0x10bed1,_0x43f07c,_0x40796f,_0x6d29d8);})[_0xdc81('0x18')](function(_0x1a327f){if(_0x1a327f&&_0x1a327f['id']){logger['info'](_0xdc81('0x4a'));logger[_0xdc81('0xa')](_0xdc81('0x4b'),_0x1a327f['id']);logger[_0xdc81('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdc81('0xc')](_0xdc81('0x57'),_0x2c75b7[_0xdc81('0x13')]),'trigger:browser:url',{'uri':util[_0xdc81('0xc')](_0xdc81('0x4e'),_0x108c41[_0xdc81('0x1a')],_0x1a327f['id'])});}})[_0xdc81('0x4f')](function(_0x1d4a59){logger[_0xdc81('0x58')]('[OUTBOUND]',JSON['stringify'](_0x1d4a59));});};exports['unmanaged']=function(_0x2f7f77,_0x38f855,_0x3b6c47,_0x5620c6,_0x29fc21,_0x49df0c){var _0x58eaec,_0x304dce;_0x49df0c[_0xdc81('0x1a')]=intUtil[_0xdc81('0x3f')](_0x49df0c[_0xdc81('0x1a')]);_0x49df0c[_0xdc81('0x40')]=intUtil[_0xdc81('0x3f')](_0x49df0c['serverUrl']);if(_0x29fc21&&_0x29fc21[_0xdc81('0x41')]){logger[_0xdc81('0xa')]('['+_0x38f855[_0xdc81('0x59')][_0xdc81('0x5a')]()+']',_0xdc81('0x43'));_0x38f855[_0xdc81('0x44')]=util[_0xdc81('0xc')](_0xdc81('0x45'),_0x49df0c['serverUrl'],_0x38f855['uniqueid'],md5(_0x38f855[_0xdc81('0x46')]));}else{_0x38f855[_0xdc81('0x44')]='';}headers[_0xdc81('0x47')]=getAuth(_0x49df0c);return getUser(_0x49df0c,'')[_0xdc81('0x18')](function(_0x58be5d){_0x58eaec=_0x58be5d;logger['info'](_0xdc81('0x48'),_0x58eaec['id']);return getEndUser(_0x49df0c,_0x38f855[_0xdc81('0x49')],_0x38f855['calleridnum']);})[_0xdc81('0x18')](function(_0x489e75){_0x304dce=_0x489e75;logger[_0xdc81('0xa')]('The\x20Enduser\x20ID\x20is:',_0x304dce['id']);return getTicket(_0x49df0c,_0x58eaec,_0x304dce,_0x3b6c47,_0x38f855);})[_0xdc81('0x18')](function(_0x31abfe){if(_0x31abfe){logger[_0xdc81('0xa')](_0xdc81('0x4a'));logger[_0xdc81('0xa')]('The\x20Ticket\x20ID\x20is:',_0x31abfe['id']);}})[_0xdc81('0x4f')](function(_0x3e25e1){logger[_0xdc81('0x58')]('['+_0x38f855[_0xdc81('0x59')][_0xdc81('0x5a')]()+']',JSON['stringify'](_0x3e25e1));});}; \ No newline at end of file +var _0x6162=['toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','toLowerCase','content','string','idField','customField','push','variable','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','lastevent','catch','toUpperCase','lodash','request-promise','ioredis','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','
','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6162,0xe8));var _0x2616=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6162[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x2616('0x0'));var rp=require(_0x2616('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x2616('0x2'));var intUtil=require('./util');var config=require(_0x2616('0x3'));var logger=require('../../../../config/logger')(_0x2616('0x4'));config[_0x2616('0x5')]=_['defaults'](config[_0x2616('0x5')],{'host':_0x2616('0x6'),'port':0x18eb});var io=require(_0x2616('0x7'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x2616('0x8')};function emit(_0x558f9e,_0x1c8c2a,_0x976bc3){io['to'](_0x558f9e)[_0x2616('0x9')](_0x1c8c2a,_0x976bc3);}function getTicket(_0x551a7a,_0x445ea4,_0xdd1b2c,_0x29e90d,_0x4b3470){logger[_0x2616('0xa')](_0x2616('0xb'));var _0x3604e2=_[_0x2616('0xc')]({'responder_id':_0x445ea4['id'],'requester_id':_0xdd1b2c['id'],'name':util['format']('Caller\x20-\x20%s',_0x4b3470[_0x2616('0xd')]),'phone':_0x4b3470[_0x2616('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2616('0xf')](_0x29e90d['Subjects'],_0x4b3470,'\x20'),'description':intUtil[_0x2616('0xf')](_0x29e90d['Descriptions'],_0x4b3470,_0x2616('0x10')),'tags':getTags(_0x29e90d['Tags'],_0x2616('0x11'))},getCustomFields(_0x29e90d[_0x2616('0x12')],_0x4b3470));_0x3604e2[_0x2616('0x13')]=_[_0x2616('0x14')](_['keyBy'](_0x3604e2['custom_fields'],'id'),_0x2616('0x15'));return request({'uri':util[_0x2616('0x16')](_0x2616('0x17'),_0x551a7a[_0x2616('0x18')]),'method':'POST','body':_0x3604e2})['then'](function(_0x356ba0){logger[_0x2616('0xa')]('Ticket\x20created!');return _0x356ba0;});}function getUser(_0x3b8c5c,_0x1d438c){if(intUtil[_0x2616('0x19')](_0x1d438c)){return request({'uri':util[_0x2616('0x16')](_0x2616('0x1a'),_0x3b8c5c[_0x2616('0x18')]),'qs':{'email':_0x1d438c}})[_0x2616('0x1b')](function(_0x1975aa){if(_0x1975aa[_0x2616('0x1c')]){logger[_0x2616('0xa')](_0x2616('0x1d'));return _[_0x2616('0x1e')](_0x1975aa,function(_0xb3b24){return _0xb3b24[_0x2616('0x1f')]['email']===_0x1d438c;});}else{logger[_0x2616('0xa')](_0x2616('0x20'));return request({'uri':util[_0x2616('0x16')](_0x2616('0x21'),_0x3b8c5c[_0x2616('0x18')])})['then'](function(_0x194232){logger[_0x2616('0xa')](_0x2616('0x22'));return _0x194232;});}});}else{logger['info'](_0x2616('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x3b8c5c['remoteUri'])})[_0x2616('0x1b')](function(_0x3c8074){logger[_0x2616('0xa')]('Admin\x20account\x20selected.');return _0x3c8074;});}}function getEndUser(_0x399480,_0x21aa8f,_0x441542){logger[_0x2616('0xa')]('Searching\x20enduser\x20with\x20phone',_0x441542);return request({'uri':util[_0x2616('0x16')](_0x2616('0x24'),_0x399480['remoteUri']),'qs':{'phone':_0x441542}})[_0x2616('0x1b')](function(_0x424792){if(_0x424792[_0x2616('0x1c')]){logger[_0x2616('0xa')]('Enduser\x20found!');return _[_0x2616('0x1e')](_0x424792,{'phone':_0x441542});}else{logger['info'](_0x2616('0x25'));return request({'uri':util[_0x2616('0x16')]('%s/api/v2/contacts',_0x399480['remoteUri']),'method':_0x2616('0x26'),'body':{'name':_0x21aa8f,'phone':_0x441542}})[_0x2616('0x1b')](function(_0xed6235){logger[_0x2616('0xa')]('Enduser\x20created.');return _0xed6235;});}});}function getAuth(_0x3b0a73){return util[_0x2616('0x16')](_0x2616('0x27'),new Buffer(_0x3b0a73[_0x2616('0x28')]+':X')[_0x2616('0x29')](_0x2616('0x2a')));}function request(_0x548784){logger[_0x2616('0x2b')](_0x2616('0x2c'),JSON[_0x2616('0x2d')](_0x548784));return rp(_[_0x2616('0x2e')](_0x548784,{'method':_0x2616('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x4a1022,_0x50d046){var _0x5ddc27=[];if(_0x4a1022&&_0x4a1022[_0x2616('0x1c')]>0x0){_0x5ddc27=_[_0x2616('0x30')](_0x4a1022,_0x50d046);}return _0x5ddc27;}function getCustomFields(_0x4f83fd,_0x41870){var _0x368067=[];var _0x461968={'custom_fields':[]};if(_0x4f83fd['length']>0x0){_[_0x2616('0x31')](_0x4f83fd,function(_0x538c04){if(_[_0x2616('0x32')](['string',_0x2616('0x33')],_0x538c04[_0x2616('0x34')])&&_0x538c04[_0x2616('0x35')]&&!_0x538c04['customField']){_0x461968[_0x538c04[_0x2616('0x35')][_0x2616('0x36')]()]=_0x538c04[_0x2616('0x37')]['toString']();}else if(_['includes']([_0x2616('0x38'),_0x2616('0x33')],_0x538c04[_0x2616('0x34')])&&_0x538c04[_0x2616('0x39')]&&_0x538c04[_0x2616('0x3a')]){_0x461968[_0x2616('0x13')][_0x2616('0x3b')]({'id':_0x538c04[_0x2616('0x39')],'value':_0x538c04[_0x2616('0x37')]['toString']()});}else if(_0x538c04[_0x2616('0x34')]===_0x2616('0x3c')&&_0x538c04[_0x2616('0x3d')]&&_0x538c04['idField']&&_0x538c04[_0x2616('0x3a')]){_0x41870[_0x538c04[_0x2616('0x3d')]]&&_0x461968[_0x2616('0x13')][_0x2616('0x3b')]({'id':_0x538c04[_0x2616('0x39')],'value':_0x41870[_0x538c04[_0x2616('0x3d')]][_0x2616('0x29')]()});}else if(_0x538c04[_0x2616('0x34')]==='customVariable'&&_0x538c04[_0x2616('0x3e')]&&_0x538c04['Variable'][_0x2616('0x11')]&&_0x538c04[_0x2616('0x39')]&&_0x538c04['customField']){_0x41870[_0x538c04[_0x2616('0x3e')]['name']['toLowerCase']()]&&_0x461968[_0x2616('0x13')][_0x2616('0x3b')]({'id':_0x538c04[_0x2616('0x39')],'value':_0x41870[_0x538c04[_0x2616('0x3e')]['name']['toLowerCase']()]['toString']()});}});}return _0x461968;}exports[_0x2616('0x3f')]=function(_0x8f7837,_0x468b33,_0x45e96a,_0x59a315,_0xc38964,_0x51305b){var _0x533122,_0x65ce60;_0x51305b[_0x2616('0x18')]=intUtil['stripTrailingSlash'](_0x51305b[_0x2616('0x18')]);_0x51305b[_0x2616('0x40')]=intUtil[_0x2616('0x41')](_0x51305b[_0x2616('0x40')]);if(_0xc38964&&_0xc38964[_0x2616('0x42')]){logger[_0x2616('0xa')](_0x2616('0x43'),_0x2616('0x44'));_0x468b33[_0x2616('0x45')]=util[_0x2616('0x16')](_0x2616('0x46'),_0x51305b[_0x2616('0x40')],_0x468b33[_0x2616('0x47')],md5(_0x468b33[_0x2616('0x47')]));}else{_0x468b33[_0x2616('0x45')]='';}headers[_0x2616('0x48')]=getAuth(_0x51305b);return getUser(_0x51305b,_0x59a315[_0x2616('0x49')])[_0x2616('0x1b')](function(_0x4c8151){_0x533122=_0x4c8151;logger['info']('The\x20User\x20ID\x20is:',_0x533122['id']);return getEndUser(_0x51305b,_0x468b33[_0x2616('0xd')],_0x468b33[_0x2616('0xe')]);})[_0x2616('0x1b')](function(_0x570658){_0x65ce60=_0x570658;logger[_0x2616('0xa')](_0x2616('0x4a'),_0x65ce60['id']);return getTicket(_0x51305b,_0x533122,_0x65ce60,_0x45e96a,_0x468b33);})['then'](function(_0x129a5d){if(_0x129a5d&&_0x129a5d['id']){logger[_0x2616('0xa')](_0x2616('0x4b'));logger[_0x2616('0xa')](_0x2616('0x4c'),_0x129a5d['id']);logger[_0x2616('0xa')]('[QUEUE]',_0x2616('0x4d'));emit(util[_0x2616('0x16')](_0x2616('0x4e'),_0x59a315[_0x2616('0x11')]),_0x2616('0x4f'),{'uri':util[_0x2616('0x16')](_0x2616('0x50'),_0x51305b[_0x2616('0x18')],_0x129a5d['id'])});}})['catch'](function(_0x2ac80b){logger[_0x2616('0x51')](_0x2616('0x43'),JSON[_0x2616('0x2d')](_0x2ac80b));});};exports['outbound']=function(_0x145828,_0x3dea10,_0x312447,_0xf6ed18,_0x2a1ff4,_0x4335e2,_0x3a1174){var _0x244180,_0x143040;_0x4335e2[_0x2616('0x18')]=intUtil[_0x2616('0x41')](_0x4335e2['remoteUri']);_0x4335e2[_0x2616('0x40')]=intUtil[_0x2616('0x41')](_0x4335e2[_0x2616('0x40')]);if(_0x3a1174&&_0x3a1174[_0x2616('0x52')]&&_0x3a1174[_0x2616('0x52')]!==_0x2616('0x53')){logger['info'](_0x2616('0x54'),'Recording\x20is\x20enabled!');_0x3dea10[_0x2616('0x45')]=util[_0x2616('0x16')](_0x2616('0x46'),_0x4335e2[_0x2616('0x40')],_0x3dea10['uniqueid'],md5(_0x3dea10['uniqueid']));}headers[_0x2616('0x48')]=getAuth(_0x4335e2);return getUser(_0x4335e2,_0xf6ed18[_0x2616('0x49')])['then'](function(_0x3a42d8){_0x244180=_0x3a42d8;logger[_0x2616('0xa')](_0x2616('0x55'),_0x244180['id']);return getEndUser(_0x4335e2,_0x3dea10[_0x2616('0x56')],_0x3dea10[_0x2616('0x57')]);})[_0x2616('0x1b')](function(_0x7dd19c){_0x143040=_0x7dd19c;logger[_0x2616('0xa')](_0x2616('0x4a'),_0x143040['id']);return getTicket(_0x4335e2,_0x244180,_0x143040,_0x312447,_0x3dea10);})[_0x2616('0x1b')](function(_0x5c64ac){if(_0x5c64ac&&_0x5c64ac['id']){logger[_0x2616('0xa')]('Ticket\x20created!');logger['info'](_0x2616('0x4c'),_0x5c64ac['id']);logger[_0x2616('0xa')](_0x2616('0x54'),_0x2616('0x4d'));emit(util[_0x2616('0x16')]('user:%s',_0xf6ed18[_0x2616('0x11')]),_0x2616('0x4f'),{'uri':util[_0x2616('0x16')](_0x2616('0x50'),_0x4335e2[_0x2616('0x18')],_0x5c64ac['id'])});}})['catch'](function(_0x50c0f3){logger['error'](_0x2616('0x54'),JSON[_0x2616('0x2d')](_0x50c0f3));});};exports['unmanaged']=function(_0x731b31,_0x3fc955,_0x525155,_0x2fe126,_0x4e1d58,_0x46c8a3){var _0xb25139,_0x5f4dae;_0x46c8a3[_0x2616('0x18')]=intUtil['stripTrailingSlash'](_0x46c8a3[_0x2616('0x18')]);_0x46c8a3[_0x2616('0x40')]=intUtil['stripTrailingSlash'](_0x46c8a3['serverUrl']);if(_0x4e1d58&&_0x4e1d58[_0x2616('0x42')]){logger[_0x2616('0xa')]('['+_0x3fc955[_0x2616('0x58')]['toUpperCase']()+']',_0x2616('0x44'));_0x3fc955[_0x2616('0x45')]=util[_0x2616('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46c8a3[_0x2616('0x40')],_0x3fc955[_0x2616('0x47')],md5(_0x3fc955[_0x2616('0x47')]));}else{_0x3fc955[_0x2616('0x45')]='';}headers[_0x2616('0x48')]=getAuth(_0x46c8a3);return getUser(_0x46c8a3,'')['then'](function(_0x214571){_0xb25139=_0x214571;logger[_0x2616('0xa')](_0x2616('0x55'),_0xb25139['id']);return getEndUser(_0x46c8a3,_0x3fc955[_0x2616('0xd')],_0x3fc955[_0x2616('0xe')]);})['then'](function(_0x24a856){_0x5f4dae=_0x24a856;logger['info'](_0x2616('0x4a'),_0x5f4dae['id']);return getTicket(_0x46c8a3,_0xb25139,_0x5f4dae,_0x525155,_0x3fc955);})['then'](function(_0xb5be70){if(_0xb5be70){logger[_0x2616('0xa')]('Ticket\x20created!');logger['info'](_0x2616('0x4c'),_0xb5be70['id']);}})[_0x2616('0x59')](function(_0x4238b7){logger[_0x2616('0x51')]('['+_0x3fc955[_0x2616('0x58')][_0x2616('0x5a')]()+']',JSON[_0x2616('0x2d')](_0x4238b7));});}; \ 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 f0ef259..7ec75c9 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 _0xe1fd=['remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','GET','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','error','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey'];(function(_0x1d223e,_0x3383e7){var _0x38e07e=function(_0x3431f2){while(--_0x3431f2){_0x1d223e['push'](_0x1d223e['shift']());}};_0x38e07e(++_0x3383e7);}(_0xe1fd,0x6f));var _0xde1f=function(_0x61796d,_0x185ed5){_0x61796d=_0x61796d-0x0;var _0x4cc353=_0xe1fd[_0x61796d];return _0x4cc353;};'use strict';var _=require(_0xde1f('0x0'));var rp=require('request-promise');var md5=require(_0xde1f('0x1'));var util=require(_0xde1f('0x2'));var moment=require(_0xde1f('0x3'));var Promise=require(_0xde1f('0x4'));var Redis=require(_0xde1f('0x5'));var intUtil=require(_0xde1f('0x6'));var config=require(_0xde1f('0x7'));var logger=require(_0xde1f('0x8'))(_0xde1f('0x9'));config[_0xde1f('0xa')]=_[_0xde1f('0xb')](config['redis'],{'host':_0xde1f('0xc'),'port':0x18eb});var io=require(_0xde1f('0xd'))(new Redis(config[_0xde1f('0xa')]));function getAdminId(_0x5351ff,_0x5838bc,_0x1386a5,_0x9af372){return new Promise(function(_0x30c48f,_0xb0a75){var _0x4711a1=![];var _0x44fac8={'method':'GET','uri':_0x9af372+'/api/selector/owners','json':!![]};_0x44fac8['headers']=_0x1386a5;logger[_0xde1f('0xe')](_0xde1f('0xf'));return rp(_0x44fac8)[_0xde1f('0x10')](function(_0x5e1d90){if(_0x5e1d90){var _0x1ae6d9=_0x5e1d90[_0xde1f('0x11')];var _0x4e5625=null;for(_0x4e5625=0x0;_0x4e5625<_0x1ae6d9[_0xde1f('0x12')];_0x4e5625++){if(_0x1ae6d9[_0x4e5625][_0xde1f('0x13')]===_0x5351ff[_0xde1f('0x14')]){_0x5351ff[_0xde1f('0x15')]=_0x1ae6d9[_0x4e5625]['id'];_0x4711a1=!![];}}if(_0x4711a1){logger['info']('Admin\x20found:',_0x5351ff[_0xde1f('0x15')]);_0x30c48f(_0x5351ff);}else{_0xb0a75({'statusCode':0x194,'message':_0xde1f('0x16')});}}else{_0xb0a75({'statusCode':0x194,'message':_0xde1f('0x16')});}})[_0xde1f('0x17')](function(_0x53ad9b){logger['error']('['+[_0x5838bc[_0xde1f('0x18')]()]+']',_0x53ad9b['message']);_0xb0a75(_0x53ad9b);});});}function getUser(_0x342228,_0xa371cf,_0x401baa){return function(_0x542494){return new Promise(function(_0x411cdb,_0x55f92b){var _0x3578e7={'method':_0xde1f('0x19'),'uri':_0x401baa+_0xde1f('0x1a'),'json':!![]};_0x3578e7[_0xde1f('0x1b')]=_0xa371cf;logger[_0xde1f('0xe')](_0xde1f('0x1c'));return rp(_0x3578e7)[_0xde1f('0x10')](function(_0x23ce42){if(_0x23ce42){var _0x4c8c59=_0x23ce42[_0xde1f('0x11')];var _0x339da9=![];var _0x2268a2=null;if(_0x542494[_0xde1f('0x1d')]!==null){logger[_0xde1f('0xe')](_0xde1f('0x1e'),_0x542494[_0xde1f('0x1d')]);_0x542494['userEmail']=_0x542494['agentEmail'];for(_0x2268a2=0x0;_0x2268a2<_0x4c8c59[_0xde1f('0x12')];_0x2268a2++){if(_0x4c8c59[_0x2268a2][_0xde1f('0x13')]===_0x542494[_0xde1f('0x1d')]){_0x339da9=!![];_0x542494[_0xde1f('0x1f')]=_0x4c8c59[_0x2268a2]['id'];logger[_0xde1f('0xe')]('User\x20found:',_0x542494[_0xde1f('0x1f')]);}}}if(!_0x339da9){logger[_0xde1f('0xe')](_0xde1f('0x20'));_0x542494[_0xde1f('0x21')]=_0x542494[_0xde1f('0x14')];_0x542494['userId']=_0x542494['adminId'];_0x339da9=!![];}if(_0x339da9){_0x411cdb(_0x542494);}else{_0x55f92b({'statusCode':0x194,'message':_0xde1f('0x16')});}}else{_0x55f92b({'statusCode':0x194,'message':_0xde1f('0x16')});}})[_0xde1f('0x17')](function(_0x41cae7){logger['error']('['+[_0x342228['toUpperCase']()]+']',_0x41cae7[_0xde1f('0x22')]);_0x55f92b(_0x41cae7);});});};}function searchContact(_0x224069,_0x2f8e50,_0xc612f6,_0x3f1b49){return new Promise(function(_0xd579e1,_0x5a0f79){var _0x1262aa={'method':_0xde1f('0x19'),'headers':_0x2f8e50,'uri':_0x224069+_0xde1f('0x23')+_0x3f1b49+_0xde1f('0x24')+_0xc612f6+_0xde1f('0x25'),'json':!![]};rp(_0x1262aa)[_0xde1f('0x10')](function(_0x20d0ec){var _0x31a3f5=_[_0xde1f('0x26')](_0x20d0ec[_0xde1f('0x27')][_0xde1f('0x27')],[_0xc612f6,_0x3f1b49]);_0xd579e1(_0x31a3f5);})[_0xde1f('0x17')](function(_0x2efcaa){_0x5a0f79(_0x2efcaa);});});}function getEndUser(_0xcc5708,_0x50cb5b,_0x1ce330){return function(_0x3009b4){return new Promise(function(_0x329bc1,_0x17b07c){logger[_0xde1f('0xe')](util[_0xde1f('0x28')](_0xde1f('0x29'),_0x3009b4['contactNumber']));searchContact(_0x1ce330,_0x50cb5b,_0xde1f('0x2a'),_0x3009b4[_0xde1f('0x2b')])[_0xde1f('0x10')](function(_0x1d19e4){if(_0x1d19e4){_0x3009b4[_0xde1f('0x2c')]=_0x1d19e4['id'];logger[_0xde1f('0xe')](_0xde1f('0x2d'),_0x3009b4[_0xde1f('0x2c')]);return _0x329bc1(_0x3009b4);}searchContact(_0x1ce330,_0x50cb5b,_0xde1f('0x2e'),_0x3009b4[_0xde1f('0x2b')])[_0xde1f('0x10')](function(_0x4e9890){if(_0x4e9890){_0x3009b4[_0xde1f('0x2c')]=_0x4e9890['id'];logger['info'](_0xde1f('0x2f'),_0x3009b4[_0xde1f('0x2c')]);return _0x329bc1(_0x3009b4);}createEndUser(_0x3009b4,_0xcc5708,_0x50cb5b,_0x1ce330)[_0xde1f('0x10')](function(_0x28aecd){logger[_0xde1f('0xe')](_0xde1f('0x30'),_0x28aecd['endUserId']);return _0x329bc1(_0x28aecd);});});})[_0xde1f('0x17')](function(_0x5da062){_0x17b07c(_0x5da062);});});};}function createEndUser(_0x3f4e28,_0xf5085b,_0x219497,_0x267c58){return new Promise(function(_0x4787bd,_0x1c19ca){var _0xeb1dd9=moment();var _0x124368={'method':_0xde1f('0x31'),'uri':_0x267c58+_0xde1f('0x32'),'body':{'contact':{'last_name':_0x3f4e28[_0xde1f('0x2b')],'work_number':_0x3f4e28['contactNumber'],'mobile_number':_0x3f4e28[_0xde1f('0x2b')],'owner_id':_0x3f4e28['userId'],'created_at':_0xeb1dd9['format'](_0xde1f('0x33'))}},'json':!![]};_0x124368[_0xde1f('0x1b')]=_0x219497;logger[_0xde1f('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x124368)[_0xde1f('0x10')](function(_0x4ad3e8){_0x3f4e28[_0xde1f('0x2c')]=_0x4ad3e8[_0xde1f('0x34')]['id'];_0x4787bd(_0x3f4e28);})[_0xde1f('0x17')](function(_0x557816){logger['error']('['+[_0xf5085b[_0xde1f('0x18')]()]+']',_0x557816[_0xde1f('0x22')]);_0x1c19ca(_0x557816[_0xde1f('0x22')]);});});}function getTicket(_0x1ef2ea,_0x25461e,_0x1e7b53,_0x49d19e,_0x2bc008){return function(_0x1f4087){logger[_0xde1f('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x2b6f3f,_0x5ad3cd){var _0xcfdee3=moment();var _0x3630cf={'method':_0xde1f('0x31'),'uri':_0x1e7b53+_0xde1f('0x35'),'body':{'title':intUtil['getString'](_0x49d19e[_0xde1f('0x36')],_0x2bc008,'\x20'),'description':intUtil[_0xde1f('0x37')](_0x49d19e[_0xde1f('0x38')],_0x2bc008,'\x0a'),'owner_id':_0x1f4087[_0xde1f('0x1f')],'creater_id':_0x1f4087[_0xde1f('0x15')],'targetable_id':_0x1f4087[_0xde1f('0x2c')],'targetable_type':_0xde1f('0x39'),'created_at':_0xcfdee3[_0xde1f('0x28')](_0xde1f('0x33')),'due_date':_0xcfdee3[_0xde1f('0x3a')](0x1e,'m')[_0xde1f('0x28')](_0xde1f('0x33'))},'json':!![]};_0x3630cf[_0xde1f('0x1b')]=_0x25461e;return rp(_0x3630cf)[_0xde1f('0x10')](function(_0x116e82){_0x1f4087[_0xde1f('0x3b')]=_0x116e82[_0xde1f('0x3c')]['id'];logger['info'](_0xde1f('0x3d'),_0x1f4087['ticketId']);_0x2b6f3f(_0x1f4087);})[_0xde1f('0x17')](function(_0x3c9595){logger[_0xde1f('0x3e')]('['+[_0x1ef2ea[_0xde1f('0x18')]()]+']',_0x3c9595['message']);_0x5ad3cd(_0x3c9595[_0xde1f('0x22')]);});});};}function emit(_0x5e68f6,_0x2000e9,_0x35a940){var _0xcf68eb={'uri':_0x5e68f6+_0xde1f('0x3f')+_0x35a940};io['to'](util[_0xde1f('0x28')](_0xde1f('0x40'),_0x2000e9))[_0xde1f('0x41')](_0xde1f('0x42'),_0xcf68eb);}exports['cs']=function(_0x2b7bfc,_0x17d367,_0x133479,_0x4f8f4c,_0x16ea80,_0x3126de,_0x2dd031,_0x376dd1){var _0x28da33={};var _0x2dae68={'Authorization':_0xde1f('0x43')+_0x3126de[_0xde1f('0x44')]};_0x3126de[_0xde1f('0x45')]=intUtil['stripTrailingSlash'](_0x3126de[_0xde1f('0x45')]);_0x3126de[_0xde1f('0x46')]=intUtil[_0xde1f('0x47')](_0x3126de[_0xde1f('0x46')]);var _0x2a731c=_0x3126de[_0xde1f('0x45')];_0x28da33[_0xde1f('0x14')]=_0x3126de[_0xde1f('0x48')];_0x28da33[_0xde1f('0x2b')]=_0x376dd1[_0xde1f('0x49')]()===_0xde1f('0x4a')?_0x17d367['destcalleridnum']:_0x17d367['calleridnum'];_0x28da33['callDirection']=_0x376dd1===_0xde1f('0x4b')||_0x376dd1===_0xde1f('0x4c')?_0xde1f('0x4b'):_0xde1f('0x4a');if(_0x4f8f4c){_0x28da33[_0xde1f('0x1d')]=_0x4f8f4c[_0xde1f('0x13')];}var _0x5b64f8=util[_0xde1f('0x28')](_0xde1f('0x4d'),_0x3126de[_0xde1f('0x46')],_0x17d367[_0xde1f('0x4e')],md5(_0x17d367['uniqueid']));if(_0x16ea80&&_0x16ea80[_0xde1f('0x4f')]){logger[_0xde1f('0xe')](_0xde1f('0x50'),_0xde1f('0x51'));_0x17d367['recordingURL']=_0x5b64f8;}else if(_0x2dd031&&_0x2dd031['recordingFormat']&&_0x2dd031[_0xde1f('0x52')]!==_0xde1f('0x53')){logger[_0xde1f('0xe')](_0xde1f('0x54'),_0xde1f('0x51'));_0x17d367[_0xde1f('0x55')]=_0x5b64f8;}else{_0x17d367[_0xde1f('0x55')]='';}return getAdminId(_0x28da33,_0x376dd1,_0x2dae68,_0x2a731c)['then'](getUser(_0x376dd1,_0x2dae68,_0x2a731c))[_0xde1f('0x10')](getEndUser(_0x376dd1,_0x2dae68,_0x2a731c))[_0xde1f('0x10')](getTicket(_0x376dd1,_0x2dae68,_0x2a731c,_0x133479,_0x17d367))[_0xde1f('0x10')](function(_0x1e7de2){logger[_0xde1f('0xe')](util[_0xde1f('0x28')](_0xde1f('0x56'),_0x1e7de2['ticketId']));if(_0x376dd1!=='unmanaged'){logger[_0xde1f('0xe')]('['+[_0x376dd1[_0xde1f('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2a731c,_0x4f8f4c[_0xde1f('0x57')],_0x1e7de2['endUserId']);}})[_0xde1f('0x17')](function(_0x7a2eb6){logger['error']('['+[_0x376dd1[_0xde1f('0x18')]()]+_0xde1f('0x58'),util[_0xde1f('0x59')](_0x7a2eb6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xba6e=['Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','redis','localhost','GET','headers','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','Admin\x20selected','userId','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts'];(function(_0xc7d9a7,_0xe56cb){var _0x1f94a6=function(_0x2ff3b8){while(--_0x2ff3b8){_0xc7d9a7['push'](_0xc7d9a7['shift']());}};_0x1f94a6(++_0xe56cb);}(_0xba6e,0xd4));var _0xeba6=function(_0x4d2394,_0x4b0803){_0x4d2394=_0x4d2394-0x0;var _0x128719=_0xba6e[_0x4d2394];return _0x128719;};'use strict';var _=require(_0xeba6('0x0'));var rp=require(_0xeba6('0x1'));var md5=require(_0xeba6('0x2'));var util=require(_0xeba6('0x3'));var moment=require(_0xeba6('0x4'));var Promise=require(_0xeba6('0x5'));var Redis=require(_0xeba6('0x6'));var intUtil=require('./util');var config=require(_0xeba6('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0xeba6('0x8')]=_['defaults'](config['redis'],{'host':_0xeba6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeba6('0x8')]));function getAdminId(_0x1a572d,_0x40617b,_0x2685fe,_0x592bf7){return new Promise(function(_0x35cb00,_0x195fdf){var _0xd3c25e=![];var _0x466df3={'method':_0xeba6('0xa'),'uri':_0x592bf7+'/api/selector/owners','json':!![]};_0x466df3[_0xeba6('0xb')]=_0x2685fe;logger['info'](_0xeba6('0xc'));return rp(_0x466df3)[_0xeba6('0xd')](function(_0x5c673d){if(_0x5c673d){var _0x1dea32=_0x5c673d[_0xeba6('0xe')];var _0x46f091=null;for(_0x46f091=0x0;_0x46f091<_0x1dea32[_0xeba6('0xf')];_0x46f091++){if(_0x1dea32[_0x46f091]['email']===_0x1a572d[_0xeba6('0x10')]){_0x1a572d[_0xeba6('0x11')]=_0x1dea32[_0x46f091]['id'];_0xd3c25e=!![];}}if(_0xd3c25e){logger[_0xeba6('0x12')]('Admin\x20found:',_0x1a572d['adminId']);_0x35cb00(_0x1a572d);}else{_0x195fdf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x195fdf({'statusCode':0x194,'message':_0xeba6('0x13')});}})[_0xeba6('0x14')](function(_0x527a3c){logger['error']('['+[_0x40617b[_0xeba6('0x15')]()]+']',_0x527a3c[_0xeba6('0x16')]);_0x195fdf(_0x527a3c);});});}function getUser(_0x5292e6,_0x565369,_0x5c22b3){return function(_0x4eb80f){return new Promise(function(_0x2b230c,_0x45ecec){var _0xdf48cd={'method':_0xeba6('0xa'),'uri':_0x5c22b3+_0xeba6('0x17'),'json':!![]};_0xdf48cd[_0xeba6('0xb')]=_0x565369;logger[_0xeba6('0x12')](_0xeba6('0x18'));return rp(_0xdf48cd)[_0xeba6('0xd')](function(_0x5c9f85){if(_0x5c9f85){var _0x4d961e=_0x5c9f85[_0xeba6('0xe')];var _0x1bb769=![];var _0x455587=null;if(_0x4eb80f[_0xeba6('0x19')]!==null){logger['info'](_0xeba6('0x1a'),_0x4eb80f[_0xeba6('0x19')]);_0x4eb80f[_0xeba6('0x1b')]=_0x4eb80f['agentEmail'];for(_0x455587=0x0;_0x455587<_0x4d961e['length'];_0x455587++){if(_0x4d961e[_0x455587][_0xeba6('0x1c')]===_0x4eb80f[_0xeba6('0x19')]){_0x1bb769=!![];_0x4eb80f['userId']=_0x4d961e[_0x455587]['id'];logger[_0xeba6('0x12')](_0xeba6('0x1d'),_0x4eb80f['userId']);}}}if(!_0x1bb769){logger[_0xeba6('0x12')](_0xeba6('0x1e'));_0x4eb80f[_0xeba6('0x1b')]=_0x4eb80f[_0xeba6('0x10')];_0x4eb80f[_0xeba6('0x1f')]=_0x4eb80f[_0xeba6('0x11')];_0x1bb769=!![];}if(_0x1bb769){_0x2b230c(_0x4eb80f);}else{_0x45ecec({'statusCode':0x194,'message':_0xeba6('0x13')});}}else{_0x45ecec({'statusCode':0x194,'message':_0xeba6('0x13')});}})['catch'](function(_0x117224){logger[_0xeba6('0x20')]('['+[_0x5292e6[_0xeba6('0x15')]()]+']',_0x117224[_0xeba6('0x16')]);_0x45ecec(_0x117224);});});};}function searchContact(_0x1cfecd,_0x37e091,_0x3c56c3,_0x43649c){return new Promise(function(_0x47fab3,_0x24af12){var _0x501dab={'method':_0xeba6('0xa'),'headers':_0x37e091,'uri':_0x1cfecd+_0xeba6('0x21')+_0x43649c+_0xeba6('0x22')+_0x3c56c3+_0xeba6('0x23'),'json':!![]};rp(_0x501dab)[_0xeba6('0xd')](function(_0x177779){var _0x1c0dcc=_[_0xeba6('0x24')](_0x177779[_0xeba6('0x25')][_0xeba6('0x25')],[_0x3c56c3,_0x43649c]);_0x47fab3(_0x1c0dcc);})[_0xeba6('0x14')](function(_0x3179d8){_0x24af12(_0x3179d8);});});}function getEndUser(_0x122d36,_0xc15765,_0x3495e7){return function(_0x2b36a5){return new Promise(function(_0x5a29a6,_0x25c81b){logger[_0xeba6('0x12')](util[_0xeba6('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2b36a5['contactNumber']));searchContact(_0x3495e7,_0xc15765,_0xeba6('0x27'),_0x2b36a5[_0xeba6('0x28')])[_0xeba6('0xd')](function(_0x17e476){if(_0x17e476){_0x2b36a5[_0xeba6('0x29')]=_0x17e476['id'];logger[_0xeba6('0x12')](_0xeba6('0x2a'),_0x2b36a5['endUserId']);return _0x5a29a6(_0x2b36a5);}searchContact(_0x3495e7,_0xc15765,_0xeba6('0x2b'),_0x2b36a5[_0xeba6('0x28')])[_0xeba6('0xd')](function(_0x2a454f){if(_0x2a454f){_0x2b36a5[_0xeba6('0x29')]=_0x2a454f['id'];logger[_0xeba6('0x12')]('Contact\x20found\x20work_number:',_0x2b36a5[_0xeba6('0x29')]);return _0x5a29a6(_0x2b36a5);}createEndUser(_0x2b36a5,_0x122d36,_0xc15765,_0x3495e7)[_0xeba6('0xd')](function(_0x41bcee){logger[_0xeba6('0x12')]('Contact\x20created:',_0x41bcee[_0xeba6('0x29')]);return _0x5a29a6(_0x41bcee);});});})[_0xeba6('0x14')](function(_0x3d8ab4){_0x25c81b(_0x3d8ab4);});});};}function createEndUser(_0x4ab458,_0x20cff0,_0x576f81,_0x39f331){return new Promise(function(_0x3646ed,_0x300f0b){var _0x4bb9de=moment();var _0x1ae597={'method':_0xeba6('0x2c'),'uri':_0x39f331+_0xeba6('0x2d'),'body':{'contact':{'last_name':_0x4ab458[_0xeba6('0x28')],'work_number':_0x4ab458[_0xeba6('0x28')],'mobile_number':_0x4ab458[_0xeba6('0x28')],'owner_id':_0x4ab458['userId'],'created_at':_0x4bb9de['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1ae597['headers']=_0x576f81;logger['info'](_0xeba6('0x2e'));return rp(_0x1ae597)[_0xeba6('0xd')](function(_0x33d840){_0x4ab458['endUserId']=_0x33d840[_0xeba6('0x2f')]['id'];_0x3646ed(_0x4ab458);})[_0xeba6('0x14')](function(_0x33b62a){logger[_0xeba6('0x20')]('['+[_0x20cff0[_0xeba6('0x15')]()]+']',_0x33b62a['message']);_0x300f0b(_0x33b62a[_0xeba6('0x16')]);});});}function getTicket(_0x3ebc74,_0x517eb1,_0x50551e,_0x545ddf,_0x308cf4){return function(_0xb0713c){logger[_0xeba6('0x12')](_0xeba6('0x30'));return new Promise(function(_0x550e1d,_0x2fef28){var _0x30cedc=moment();var _0x2acdbe={'method':_0xeba6('0x2c'),'uri':_0x50551e+_0xeba6('0x31'),'body':{'title':intUtil[_0xeba6('0x32')](_0x545ddf[_0xeba6('0x33')],_0x308cf4,'\x20'),'description':intUtil[_0xeba6('0x32')](_0x545ddf['Descriptions'],_0x308cf4,'\x0a'),'owner_id':_0xb0713c[_0xeba6('0x1f')],'creater_id':_0xb0713c[_0xeba6('0x11')],'targetable_id':_0xb0713c[_0xeba6('0x29')],'targetable_type':_0xeba6('0x34'),'created_at':_0x30cedc['format'](_0xeba6('0x35')),'due_date':_0x30cedc[_0xeba6('0x36')](0x1e,'m')[_0xeba6('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2acdbe[_0xeba6('0xb')]=_0x517eb1;return rp(_0x2acdbe)[_0xeba6('0xd')](function(_0x5ac3a1){_0xb0713c[_0xeba6('0x37')]=_0x5ac3a1[_0xeba6('0x38')]['id'];logger['info'](_0xeba6('0x39'),_0xb0713c[_0xeba6('0x37')]);_0x550e1d(_0xb0713c);})[_0xeba6('0x14')](function(_0x15ef4b){logger[_0xeba6('0x20')]('['+[_0x3ebc74[_0xeba6('0x15')]()]+']',_0x15ef4b[_0xeba6('0x16')]);_0x2fef28(_0x15ef4b[_0xeba6('0x16')]);});});};}function emit(_0x5d79c3,_0x3ce2b2,_0x3b24e7){var _0x36a8b0={'uri':_0x5d79c3+_0xeba6('0x3a')+_0x3b24e7};io['to'](util[_0xeba6('0x26')](_0xeba6('0x3b'),_0x3ce2b2))[_0xeba6('0x3c')](_0xeba6('0x3d'),_0x36a8b0);}exports['cs']=function(_0x1568c9,_0x3dd4d7,_0x1fa21b,_0x2bcfc8,_0x59556b,_0x38a3,_0x4486f4,_0x579cdd){var _0x4b8459={};var _0x3b8745={'Authorization':_0xeba6('0x3e')+_0x38a3[_0xeba6('0x3f')]};_0x38a3[_0xeba6('0x40')]=intUtil[_0xeba6('0x41')](_0x38a3[_0xeba6('0x40')]);_0x38a3[_0xeba6('0x42')]=intUtil[_0xeba6('0x41')](_0x38a3[_0xeba6('0x42')]);var _0x2c61b2=_0x38a3['remoteUri'];_0x4b8459[_0xeba6('0x10')]=_0x38a3[_0xeba6('0x43')];_0x4b8459[_0xeba6('0x28')]=_0x579cdd[_0xeba6('0x44')]()===_0xeba6('0x45')?_0x3dd4d7['destcalleridnum']:_0x3dd4d7[_0xeba6('0x46')];_0x4b8459[_0xeba6('0x47')]=_0x579cdd===_0xeba6('0x48')||_0x579cdd===_0xeba6('0x49')?_0xeba6('0x48'):'outbound';if(_0x2bcfc8){_0x4b8459[_0xeba6('0x19')]=_0x2bcfc8[_0xeba6('0x1c')];}var _0x344c73=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38a3['serverUrl'],_0x3dd4d7[_0xeba6('0x4a')],md5(_0x3dd4d7['uniqueid']));if(_0x59556b&&_0x59556b[_0xeba6('0x4b')]){logger[_0xeba6('0x12')](_0xeba6('0x4c'),'Recording\x20is\x20enabled!');_0x3dd4d7[_0xeba6('0x4d')]=_0x344c73;}else if(_0x4486f4&&_0x4486f4[_0xeba6('0x4e')]&&_0x4486f4['recordingFormat']!=='none'){logger['info'](_0xeba6('0x4f'),_0xeba6('0x50'));_0x3dd4d7[_0xeba6('0x4d')]=_0x344c73;}else{_0x3dd4d7[_0xeba6('0x4d')]='';}return getAdminId(_0x4b8459,_0x579cdd,_0x3b8745,_0x2c61b2)[_0xeba6('0xd')](getUser(_0x579cdd,_0x3b8745,_0x2c61b2))['then'](getEndUser(_0x579cdd,_0x3b8745,_0x2c61b2))[_0xeba6('0xd')](getTicket(_0x579cdd,_0x3b8745,_0x2c61b2,_0x1fa21b,_0x3dd4d7))[_0xeba6('0xd')](function(_0xcfbc7c){logger['info'](util[_0xeba6('0x26')](_0xeba6('0x51'),_0xcfbc7c['ticketId']));if(_0x579cdd!==_0xeba6('0x49')){logger[_0xeba6('0x12')]('['+[_0x579cdd[_0xeba6('0x15')]()]+']',_0xeba6('0x52'));emit(_0x2c61b2,_0x2bcfc8[_0xeba6('0x53')],_0xcfbc7c[_0xeba6('0x29')]);}})['catch'](function(_0x1fc13c){logger[_0xeba6('0x20')]('['+[_0x579cdd[_0xeba6('0x15')]()]+_0xeba6('0x54'),util[_0xeba6('0x55')](_0x1fc13c,{'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 f54cc3f..728be8a 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 _0x1e02=['dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','queue','routeId','log','unmanaged','vtiger','../../../../config/logger','[EXEC]','data3','format','%s\x20account\x20#%s\x20not\x20found','error','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk'];(function(_0x12f277,_0x291aa6){var _0xb2b6ca=function(_0x46c0ed){while(--_0x46c0ed){_0x12f277['push'](_0x12f277['shift']());}};_0xb2b6ca(++_0x291aa6);}(_0x1e02,0x108));var _0x21e0=function(_0x30eb4b,_0x5963a1){_0x30eb4b=_0x30eb4b-0x0;var _0x2a6e84=_0x1e02[_0x30eb4b];return _0x2a6e84;};'use strict';var _=require('lodash');var util=require(_0x21e0('0x0'));var zendesk=require(_0x21e0('0x1'));var salesforce=require(_0x21e0('0x2'));var sugarcrm=require(_0x21e0('0x3'));var freshdesk=require(_0x21e0('0x4'));var zoho=require(_0x21e0('0x5'));var desk=require(_0x21e0('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x21e0('0x7'));var dynamics365=require(_0x21e0('0x8'));var freshsales=require(_0x21e0('0x9'));var integrations=[_0x21e0('0xa'),_0x21e0('0xb'),_0x21e0('0xc'),_0x21e0('0xd'),_0x21e0('0xe'),_0x21e0('0xf'),'vtiger',_0x21e0('0x10'),_0x21e0('0x11'),_0x21e0('0x12')];exports[_0x21e0('0x13')]=function(_0x47336c,_0x3d48c2,_0x317ecc,_0x558679,_0x1666eb,_0x3f0780){if(_0x317ecc){if(_[_0x21e0('0x14')](integrations,_0x47336c['data1'][_0x21e0('0x15')]())){try{var _0x304a76=null;var _0x3ddad5='';var _0x3c5a1a=_0x317ecc[_0x47336c[_0x21e0('0x16')]['toLowerCase']()];if(_0x3c5a1a){var _0x7a42b0=_0x3c5a1a[_0x47336c[_0x21e0('0x17')]];if(_0x7a42b0){var _0x2c9e7c=_['find'](_0x7a42b0['Configurations'],{'id':parseInt(_0x47336c['data3'],0xa)});if(_0x2c9e7c){if(_0x558679){if(_0x1666eb&&_0x3d48c2[_0x21e0('0x18')]){_0x3ddad5=_0x21e0('0x18');}else if(_0x3d48c2[_0x21e0('0x19')]){_0x3ddad5='outbound';}else{console[_0x21e0('0x1a')]('EVENT\x20UNKNOWN',_0x3d48c2);}}else{_0x3ddad5=_0x21e0('0x1b');}switch(_0x47336c[_0x21e0('0x16')][_0x21e0('0x15')]()){case _0x21e0('0xa'):zendesk[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0xb'):salesforce[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0xc'):sugarcrm[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0xd'):freshdesk[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0xe'):zoho[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0xf'):desk[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0x1c'):vtiger[_0x3ddad5](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780);break;case _0x21e0('0x11'):freshsales['cs'](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780,_0x3ddad5);break;case _0x21e0('0x12'):servicenow['cs'](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780,_0x3ddad5);break;case _0x21e0('0x10'):dynamics365['cs'](_0x47336c,_0x3d48c2,_0x2c9e7c,_0x558679,_0x1666eb,_0x7a42b0,_0x3f0780,_0x3ddad5);break;default:console['log']('unknown\x20integration');}}else{_0x304a76=require(_0x21e0('0x1d'))(_0x47336c['data1']['toLowerCase']());_0x304a76['error'](_0x21e0('0x1e'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x47336c[_0x21e0('0x16')]['toLowerCase'](),_0x47336c[_0x21e0('0x1f')]));}}else{_0x304a76=require('../../../../config/logger')(_0x47336c[_0x21e0('0x16')]['toLowerCase']());_0x304a76['error']('[EXEC]',util[_0x21e0('0x20')](_0x21e0('0x21'),_0x47336c['data1'][_0x21e0('0x15')](),_0x47336c[_0x21e0('0x17')]));}}else{}}catch(_0x966604){console[_0x21e0('0x22')](_0x966604);}}}}; \ No newline at end of file +var _0xe5f1=['./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk'];(function(_0x162bb3,_0x35701f){var _0x623248=function(_0x472db1){while(--_0x472db1){_0x162bb3['push'](_0x162bb3['shift']());}};_0x623248(++_0x35701f);}(_0xe5f1,0x16f));var _0x1e5f=function(_0x46a94e,_0x2c883a){_0x46a94e=_0x46a94e-0x0;var _0x8f2237=_0xe5f1[_0x46a94e];return _0x8f2237;};'use strict';var _=require(_0x1e5f('0x0'));var util=require(_0x1e5f('0x1'));var zendesk=require(_0x1e5f('0x2'));var salesforce=require(_0x1e5f('0x3'));var sugarcrm=require(_0x1e5f('0x4'));var freshdesk=require(_0x1e5f('0x5'));var zoho=require(_0x1e5f('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x1e5f('0x7'));var dynamics365=require(_0x1e5f('0x8'));var freshsales=require('./freshsales');var integrations=[_0x1e5f('0x9'),_0x1e5f('0xa'),'sugarcrm',_0x1e5f('0xb'),_0x1e5f('0xc'),'desk',_0x1e5f('0xd'),_0x1e5f('0xe'),_0x1e5f('0xf'),_0x1e5f('0x10')];exports[_0x1e5f('0x11')]=function(_0x3b80a8,_0x1553db,_0x3c08f9,_0x4aeb53,_0x5ec160,_0x145692){if(_0x3c08f9){if(_[_0x1e5f('0x12')](integrations,_0x3b80a8[_0x1e5f('0x13')][_0x1e5f('0x14')]())){try{var _0x4817f3=null;var _0x146492='';var _0x4ba8bc=_0x3c08f9[_0x3b80a8[_0x1e5f('0x13')][_0x1e5f('0x14')]()];if(_0x4ba8bc){var _0x1a5455=_0x4ba8bc[_0x3b80a8[_0x1e5f('0x15')]];if(_0x1a5455){var _0x298e0d=_[_0x1e5f('0x16')](_0x1a5455['Configurations'],{'id':parseInt(_0x3b80a8['data3'],0xa)});if(_0x298e0d){if(_0x4aeb53){if(_0x5ec160&&_0x1553db['queue']){_0x146492='queue';}else if(_0x1553db['routeId']){_0x146492=_0x1e5f('0x17');}else{console[_0x1e5f('0x18')](_0x1e5f('0x19'),_0x1553db);}}else{_0x146492=_0x1e5f('0x1a');}switch(_0x3b80a8['data1'][_0x1e5f('0x14')]()){case _0x1e5f('0x9'):zendesk[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case _0x1e5f('0xa'):salesforce[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case _0x1e5f('0x1b'):sugarcrm[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case _0x1e5f('0xb'):freshdesk[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case'zoho':zoho[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case _0x1e5f('0x1c'):desk[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case _0x1e5f('0xd'):vtiger[_0x146492](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692);break;case'freshsales':freshsales['cs'](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692,_0x146492);break;case'servicenow':servicenow['cs'](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692,_0x146492);break;case _0x1e5f('0xe'):dynamics365['cs'](_0x3b80a8,_0x1553db,_0x298e0d,_0x4aeb53,_0x5ec160,_0x1a5455,_0x145692,_0x146492);break;default:console['log'](_0x1e5f('0x1d'));}}else{_0x4817f3=require(_0x1e5f('0x1e'))(_0x3b80a8[_0x1e5f('0x13')][_0x1e5f('0x14')]());_0x4817f3[_0x1e5f('0x1f')](_0x1e5f('0x20'),util[_0x1e5f('0x21')](_0x1e5f('0x22'),_0x3b80a8['data1'][_0x1e5f('0x14')](),_0x3b80a8[_0x1e5f('0x23')]));}}else{_0x4817f3=require(_0x1e5f('0x1e'))(_0x3b80a8[_0x1e5f('0x13')][_0x1e5f('0x14')]());_0x4817f3[_0x1e5f('0x1f')](_0x1e5f('0x20'),util['format'](_0x1e5f('0x24'),_0x3b80a8[_0x1e5f('0x13')][_0x1e5f('0x14')](),_0x3b80a8['data2']));}}else{}}catch(_0x208f12){console[_0x1e5f('0x1f')](_0x208f12);}}}}; \ 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 5ab6090..c6b5c70 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 _0x097b=['emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','WhoId','account','WhatId','Case','ContactId','endUserType','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','lead','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','resolve','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','No\x20Company','Name','','upperFirst','forEach','includes','idField','content','toString','variable','variableName','customVariable','name','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','calleridnum','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','localhost','redis'];(function(_0x53feac,_0x47127d){var _0x20a9c3=function(_0x455574){while(--_0x455574){_0x53feac['push'](_0x53feac['shift']());}};_0x20a9c3(++_0x47127d);}(_0x097b,0xed));var _0xb097=function(_0xe2164a,_0x5d6865){_0xe2164a=_0xe2164a-0x0;var _0x4cf616=_0x097b[_0xe2164a];return _0x4cf616;};'use strict';var _=require('lodash');var rp=require(_0xb097('0x0'));var moment=require('moment');var BPromise=require(_0xb097('0x1'));var md5=require(_0xb097('0x2'));var jsforce=require('jsforce');var util=require(_0xb097('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb097('0x4'));var config=require(_0xb097('0x5'));var logger=require(_0xb097('0x6'))('salesforce');config['redis']=_['defaults'](config['redis'],{'host':_0xb097('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb097('0x8')]));function emit(_0x2bc0eb,_0x268d1e,_0x397b3f){io['to'](_0x2bc0eb)[_0xb097('0x9')](_0x268d1e,_0x397b3f);}function getTicket(_0x13b589,_0x22a1aa,_0x5daeb4,_0x2f6ea0,_0x1b5f39,_0x1c6df1,_0x49e591,_0x4224f0){var _0x272e59=Object[_0xb097('0xa')]({},{'OwnerId':_0x22a1aa['id'],'Subject':intUtil['getString'](_0x2f6ea0[_0xb097('0xb')],_0x1b5f39,'\x20'),'Description':intUtil['getString'](_0x2f6ea0[_0xb097('0xc')],_0x1b5f39,'\x0a')},getCustomFields(_0x1c6df1,_0x1b5f39));if(_0x5daeb4){if(_0x2f6ea0[_0xb097('0xd')]===_0xb097('0xe')){_0x272e59[_0xb097('0xf')]=moment[_0xb097('0x10')]();_0x272e59[_0xb097('0x11')]=![];_0x272e59['IsRecurrence']=![];if(_0x5daeb4['endUserType']==='contact'||_0x5daeb4['endUserType']==='lead'){_0x272e59[_0xb097('0x12')]=_0x5daeb4['id'];}else if(_0x5daeb4['endUserType']===_0xb097('0x13')){_0x272e59[_0xb097('0x14')]=_0x5daeb4['id'];}}else if(_0x2f6ea0['ticketType']===_0xb097('0x15')){if(_0x5daeb4['endUserType']==='contact'){_0x272e59[_0xb097('0x16')]=_0x5daeb4['id'];}else if(_0x5daeb4[_0xb097('0x17')]==='account'){_0x272e59[_0xb097('0x18')]=_0x5daeb4['id'];}else if(_0x5daeb4[_0xb097('0x17')]==='lead'&&_0x2f6ea0[_0xb097('0x19')]){_0x272e59[_0x2f6ea0[_0xb097('0x19')]]=_0x5daeb4['id'];}else{logger[_0xb097('0x1a')](_0xb097('0x1b'));}}}return _0x49e591[_0xb097('0x1c')](_0x2f6ea0[_0xb097('0xd')])['create'](_0x272e59);}function getUser(_0x21d773,_0x1fc1d5,_0x20280b){if(!_[_0xb097('0x1d')](_0x1fc1d5)&&intUtil['validateEmail'](_0x1fc1d5)){var _0x592047={'Email':_0x1fc1d5};var _0x418ba6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x20280b[_0xb097('0x1c')](_0xb097('0x1e'))[_0xb097('0x1f')](_0x592047,_0x418ba6)[_0xb097('0x20')]()[_0xb097('0x21')](function(_0x5ba9e3){if(_0x5ba9e3[_0xb097('0x22')]){var _0x18ef4d=_[_0xb097('0x1f')](_0x5ba9e3,function(_0x17d1d2){return _0x17d1d2[_0xb097('0x23')]===_0x1fc1d5;});if(_0x18ef4d){logger[_0xb097('0x1a')](_0xb097('0x24'),_0x1fc1d5);return BPromise['resolve']({'id':_0x18ef4d['Id'],'name':_0x18ef4d['Name']});}}else{logger[_0xb097('0x1a')](_0xb097('0x25'),_0x1fc1d5);return _0x20280b['identity']()[_0xb097('0x21')](function(_0x223652){return BPromise['resolve']({'id':_0x223652[_0xb097('0x26')],'name':_0x223652['display_name']});});}});}else{logger[_0xb097('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1fc1d5);return _0x20280b['identity']()[_0xb097('0x21')](function(_0x5042b4){return BPromise['resolve']({'id':_0x5042b4[_0xb097('0x26')],'name':_0x5042b4[_0xb097('0x27')]});});}}function getEndUser(_0x25e4f0,_0x3e7832,_0x5e4144,_0x391685,_0x3bbe4f){var _0x2920e4={'$or':{'Phone':_0x391685}};var _0x42ba62={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xb097('0x21')](function(){logger[_0xb097('0x1a')](_0xb097('0x28'),_0x391685,_0x3e7832[_0xb097('0x29')]);switch(_0x3e7832[_0xb097('0x29')]){case'contact_lead':var _0x3b642c=_['cloneDeep'](_0x2920e4);if(_0x3e7832[_0xb097('0x2a')]){var _0xc9cf46={};_0xc9cf46[_0x3e7832[_0xb097('0x2a')]]=_0x391685;_[_0xb097('0x2b')](_0x3b642c[_0xb097('0x2c')],_0xc9cf46);}return _0x3bbe4f['sobject'](_0xb097('0x2d'))[_0xb097('0x1f')](_0x3b642c,_0x42ba62)[_0xb097('0x20')]()[_0xb097('0x21')](function(_0x3cb0c9){if(_0x3cb0c9&&_0x3cb0c9[_0xb097('0x22')]){return _0x3cb0c9;}else{var _0x79869f=_['cloneDeep'](_0x2920e4);if(_0x3e7832[_0xb097('0x2e')]){var _0xb3f156={};_0xb3f156[_0x3e7832[_0xb097('0x2e')]]=_0x391685;_[_0xb097('0x2b')](_0x79869f['$or'],_0xb3f156);}return _0x3bbe4f[_0xb097('0x1c')](_0xb097('0x2f'))[_0xb097('0x1f')](_0x79869f,_0x42ba62);}});case _0xb097('0x30'):var _0x3cfbf9=_[_0xb097('0x31')](_0x2920e4);if(_0x3e7832[_0xb097('0x32')]){var _0xc9cf46={};_0xc9cf46[_0x3e7832[_0xb097('0x32')]]=_0x391685;_[_0xb097('0x2b')](_0x3cfbf9[_0xb097('0x2c')],_0xc9cf46);}return _0x3bbe4f[_0xb097('0x1c')](_0xb097('0x33'))[_0xb097('0x1f')](_0x3cfbf9,_0x42ba62)['execute']()['then'](function(_0x2c00bd){if(_0x2c00bd&&_0x2c00bd[_0xb097('0x22')]){return _0x2c00bd;}else{var _0x1ab9d2=_[_0xb097('0x31')](_0x2920e4);if(_0x3e7832[_0xb097('0x2a')]){var _0x54105f={};_0x54105f[_0x3e7832['additionalSearchContact']]=_0x391685;_[_0xb097('0x2b')](_0x1ab9d2[_0xb097('0x2c')],_0x54105f);}return _0x3bbe4f[_0xb097('0x1c')](_0xb097('0x2d'))['find'](_0x1ab9d2,_0x42ba62)[_0xb097('0x21')](function(_0x4d0a18){if(_0x4d0a18&&_0x4d0a18['length']){return _0x4d0a18;}else{var _0x8a52e7=_['cloneDeep'](_0x2920e4);if(_0x3e7832['additionalSearchLead']){var _0x1bf9c1={};_0x1bf9c1[_0x3e7832[_0xb097('0x2e')]]=_0x391685;_[_0xb097('0x2b')](_0x8a52e7['$or'],_0x1bf9c1);}return _0x3bbe4f[_0xb097('0x1c')]('Lead')[_0xb097('0x1f')](_0x8a52e7,_0x42ba62);}});}});case'contact':var _0x3b642c=_[_0xb097('0x31')](_0x2920e4);if(_0x3e7832[_0xb097('0x2a')]){var _0xc9cf46={};_0xc9cf46[_0x3e7832[_0xb097('0x2a')]]=_0x391685;_[_0xb097('0x2b')](_0x3b642c['$or'],_0xc9cf46);}return _0x3bbe4f['sobject'](_0xb097('0x2d'))['find'](_0x3b642c,_0x42ba62)[_0xb097('0x20')]();case _0xb097('0x34'):var _0x3bdc57=_[_0xb097('0x31')](_0x2920e4);if(_0x3e7832[_0xb097('0x2e')]){var _0xc9cf46={};_0xc9cf46[_0x3e7832['additionalSearchLead']]=_0x391685;_['merge'](_0x3bdc57['$or'],_0xc9cf46);}return _0x3bbe4f[_0xb097('0x1c')](_0xb097('0x2f'))[_0xb097('0x1f')](_0x3bdc57,_0x42ba62);case _0xb097('0x13'):var _0x3cfbf9=_[_0xb097('0x31')](_0x2920e4);if(_0x3e7832[_0xb097('0x32')]){var _0xc9cf46={};_0xc9cf46[_0x3e7832[_0xb097('0x32')]]=_0x391685;_[_0xb097('0x2b')](_0x3cfbf9[_0xb097('0x2c')],_0xc9cf46);}return _0x3bbe4f['sobject']('Account')[_0xb097('0x1f')](_0x3cfbf9,_0x42ba62);default:return null;}})[_0xb097('0x21')](function(_0x550926){if(_0x550926&&_0x550926[_0xb097('0x22')]){var _0xa85ac0=_['first'](_0x550926);if(_0xa85ac0){return BPromise['resolve']({'id':_0xa85ac0['Id'],'name':_0xa85ac0['Name'],'phone':_0xa85ac0[_0xb097('0x35')],'endUserType':_0xa85ac0[_0xb097('0x36')][_0xb097('0x37')][_0xb097('0x38')]()});}}})[_0xb097('0x21')](function(_0x5cccfc){if(_0x5cccfc){logger[_0xb097('0x1a')](_0xb097('0x39'),_0x5cccfc['endUserType'],_0x391685);return BPromise[_0xb097('0x3a')](_0x5cccfc);}else{logger[_0xb097('0x1a')](_0xb097('0x3b'),_0x391685);var _0x321369={'Phone':_0x391685};if(_0x3e7832[_0xb097('0x3c')]){if(_0x3e7832['moduleCreate']===_0xb097('0x3d')){logger[_0xb097('0x1a')](_0xb097('0x3e'),_0x391685,_0x3e7832['moduleCreate']);_0x321369[_0xb097('0x3f')]=_0x5e4144!==''?_0x5e4144:util[_0xb097('0x40')](_0xb097('0x41'),_0x391685);}else if(_0x3e7832[_0xb097('0x3c')]===_0xb097('0x34')){logger[_0xb097('0x1a')](_0xb097('0x3e'),_0x391685,_0x3e7832['moduleCreate']);_0x321369[_0xb097('0x3f')]=_0x5e4144!==''?_0x5e4144:util[_0xb097('0x40')](_0xb097('0x41'),_0x391685);_0x321369['Company']=_0xb097('0x42');}else if(_0x3e7832[_0xb097('0x3c')]===_0xb097('0x13')){logger['info'](_0xb097('0x3e'),_0x391685,_0x3e7832['moduleCreate']);_0x321369[_0xb097('0x43')]=_0x5e4144!==_0xb097('0x44')?_0x5e4144:util[_0xb097('0x40')](_0xb097('0x41'),_0x391685);}else{return null;}}return _0x3bbe4f[_0xb097('0x1c')](_[_0xb097('0x45')](_0x3e7832['moduleCreate']))['create'](_0x321369)[_0xb097('0x21')](function(_0x4bba9a){return BPromise[_0xb097('0x3a')]({'id':_0x4bba9a['id'],'endUserType':_0x3e7832['moduleCreate']});});}});}function getCustomFields(_0x213df6,_0x278657){var _0x3046e6={};if(_0x213df6[_0xb097('0x22')]>0x0){_[_0xb097('0x46')](_0x213df6,function(_0x3dbbde){if(_[_0xb097('0x47')](['string','picklist'],_0x3dbbde['type'])&&_0x3dbbde[_0xb097('0x48')]){_0x3046e6[_0x3dbbde['idField']]=_0x3dbbde[_0xb097('0x49')][_0xb097('0x4a')]();}else if(_0x3dbbde[_0xb097('0x37')]===_0xb097('0x4b')&&_0x3dbbde[_0xb097('0x4c')]&&_0x3dbbde[_0xb097('0x48')]){_0x278657[_0x3dbbde[_0xb097('0x4c')]]&&(_0x3046e6[_0x3dbbde[_0xb097('0x48')]]=_0x278657[_0x3dbbde[_0xb097('0x4c')]]['toString']());}else if(_0x3dbbde['type']===_0xb097('0x4d')&&_0x3dbbde['Variable']&&_0x3dbbde['Variable'][_0xb097('0x4e')]&&_0x3dbbde[_0xb097('0x48')]){_0x278657[_0x3dbbde[_0xb097('0x4f')][_0xb097('0x4e')]['toLowerCase']()]&&(_0x3046e6[_0x3dbbde[_0xb097('0x48')]]=_0x278657[_0x3dbbde['Variable'][_0xb097('0x4e')][_0xb097('0x38')]()][_0xb097('0x4a')]());}});}return _0x3046e6;}function getConnection(_0x135910){var _0x268039=_0x135910[_0xb097('0x50')][_0xb097('0x51')](_0x135910[_0xb097('0x52')]);var _0x305152=new jsforce[(_0xb097('0x53'))]({'oauth2':{'loginUrl':_0x135910[_0xb097('0x54')]||_0xb097('0x55'),'clientId':_0x135910['clientId'],'clientSecret':_0x135910[_0xb097('0x56')]}});return _0x305152['login'](_0x135910[_0xb097('0x57')],_0x268039)[_0xb097('0x21')](function(){logger[_0xb097('0x1a')]('Connection\x20established.');return _0x305152;});}exports[_0xb097('0x58')]=function(_0x24cc24,_0x240eea,_0x480698,_0xe232fc,_0x375908,_0x3d73aa){var _0x47b3f9,_0x2ac609,_0x267e93,_0xc54a86;_0x3d73aa['serverUrl']=intUtil[_0xb097('0x59')](_0x3d73aa[_0xb097('0x5a')]);_0x3d73aa[_0xb097('0x54')]=intUtil[_0xb097('0x59')](_0x3d73aa[_0xb097('0x54')]);if(_0x375908&&_0x375908['monitor_format']){logger[_0xb097('0x1a')](_0xb097('0x5b'),_0xb097('0x5c'));_0x240eea[_0xb097('0x5d')]=util[_0xb097('0x40')](_0xb097('0x5e'),_0x3d73aa[_0xb097('0x5a')],_0x240eea[_0xb097('0x5f')],md5(_0x240eea[_0xb097('0x5f')]));}else{_0x240eea['recordingURL']='';}return getConnection(_0x3d73aa)[_0xb097('0x21')](function(_0x2a571a){_0xc54a86=_0x2a571a;return getUser(_0x3d73aa,_0xe232fc['email'],_0xc54a86);})[_0xb097('0x21')](function(_0x1edb91){_0x47b3f9=_0x1edb91;return getEndUser(_0x3d73aa,_0x480698,_0x240eea[_0xb097('0x60')],_0x240eea['calleridnum'],_0xc54a86);})[_0xb097('0x21')](function(_0x56ca81){_0x2ac609=_0x56ca81;return getTicket(_0x3d73aa,_0x47b3f9,_0x2ac609,_0x480698,_0x240eea,_0x480698['Fields'],_0xc54a86,_0xb097('0x58'));})[_0xb097('0x21')](function(_0x2ca5c2){_0x267e93=_0x2ca5c2;logger[_0xb097('0x1a')](_0xb097('0x61'),_0x267e93['id']);logger[_0xb097('0x1a')](_0xb097('0x62'),_0x267e93['id'],_0xe232fc[_0xb097('0x4e')],_0x3d73aa[_0xb097('0x37')]);switch(_0x3d73aa[_0xb097('0x37')]){case _0xb097('0x63'):emit(util[_0xb097('0x40')](_0xb097('0x64'),_0xe232fc[_0xb097('0x4e')]),'trigger:salesforce:display',{'recordId':_0x267e93['id']});break;case'newTab':emit(util[_0xb097('0x40')](_0xb097('0x64'),_0xe232fc[_0xb097('0x4e')]),'trigger:browser:url',{'uri':util['format'](_0xb097('0x65'),_0xc54a86[_0xb097('0x66')],_0x267e93['id'])});break;default:logger[_0xb097('0x67')](_0xb097('0x68'));}})[_0xb097('0x69')](function(_0x5297b0){logger[_0xb097('0x67')](_0xb097('0x5b'),_0x5297b0);});};exports[_0xb097('0x6a')]=function(_0x414962,_0x57a6e9,_0x55b4cb,_0x1cdac0,_0x20893c,_0x145104,_0x3458ac){var _0x91b1a2,_0x51b4cc,_0x264a24,_0x2ef677;_0x145104['serverUrl']=intUtil['stripTrailingSlash'](_0x145104['serverUrl']);_0x145104['remoteUri']=intUtil[_0xb097('0x59')](_0x145104[_0xb097('0x54')]);if(_0x3458ac&&_0x3458ac[_0xb097('0x6b')]&&_0x3458ac['recordingFormat']!==_0xb097('0x6c')){logger[_0xb097('0x1a')](_0xb097('0x6d'),_0xb097('0x5c'));_0x57a6e9[_0xb097('0x5d')]=util[_0xb097('0x40')](_0xb097('0x5e'),_0x145104[_0xb097('0x5a')],_0x57a6e9[_0xb097('0x5f')],md5(_0x57a6e9[_0xb097('0x5f')]));}return getConnection(_0x145104)[_0xb097('0x21')](function(_0x375e0c){_0x2ef677=_0x375e0c;return getUser(_0x145104,_0x1cdac0[_0xb097('0x6e')],_0x2ef677);})[_0xb097('0x21')](function(_0x48b425){_0x91b1a2=_0x48b425;return getEndUser(_0x145104,_0x55b4cb,_0x57a6e9[_0xb097('0x6f')],_0x57a6e9['destcalleridnum'],_0x2ef677);})[_0xb097('0x21')](function(_0x49f47a){_0x51b4cc=_0x49f47a;return getTicket(_0x145104,_0x91b1a2,_0x51b4cc,_0x55b4cb,_0x57a6e9,_0x55b4cb[_0xb097('0x70')],_0x2ef677,_0xb097('0x6a'));})[_0xb097('0x21')](function(_0x58a895){_0x264a24=_0x58a895;logger[_0xb097('0x1a')](_0xb097('0x71'),_0x264a24['id']);logger[_0xb097('0x1a')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x264a24['id'],_0x1cdac0[_0xb097('0x4e')],_0x145104[_0xb097('0x37')]);switch(_0x145104[_0xb097('0x37')]){case _0xb097('0x63'):emit(util['format'](_0xb097('0x64'),_0x1cdac0[_0xb097('0x4e')]),_0xb097('0x72'),{'recordId':_0x264a24['id']});break;case'newTab':emit(util['format']('user:%s',_0x1cdac0[_0xb097('0x4e')]),_0xb097('0x73'),{'uri':util['format'](_0xb097('0x65'),_0x2ef677[_0xb097('0x66')],_0x264a24['id'])});break;default:logger[_0xb097('0x67')]('[OUTBOUND]',_0xb097('0x74'));}})[_0xb097('0x69')](function(_0x329f38){logger[_0xb097('0x67')](_0xb097('0x6d'),_0x329f38);});};exports[_0xb097('0x75')]=function(_0x435bcc,_0x4e776b,_0x11d43a,_0x692983,_0x3b4ae1,_0x22ebc2){var _0x1084b6,_0x5d01fe,_0x5a4b24,_0x1bfd40;_0x22ebc2['serverUrl']=intUtil[_0xb097('0x59')](_0x22ebc2['serverUrl']);_0x22ebc2[_0xb097('0x54')]=intUtil[_0xb097('0x59')](_0x22ebc2[_0xb097('0x54')]);if(_0x3b4ae1&&_0x3b4ae1[_0xb097('0x76')]){logger[_0xb097('0x1a')]('['+_0x4e776b[_0xb097('0x77')]['toUpperCase']()+']',_0xb097('0x5c'));_0x4e776b[_0xb097('0x5d')]=util[_0xb097('0x40')](_0xb097('0x5e'),_0x22ebc2[_0xb097('0x5a')],_0x4e776b[_0xb097('0x5f')],md5(_0x4e776b[_0xb097('0x5f')]));}else{_0x4e776b[_0xb097('0x5d')]='';}return getConnection(_0x22ebc2)[_0xb097('0x21')](function(_0x2b02d0){_0x1bfd40=_0x2b02d0;if(!_[_0xb097('0x1d')](_0x692983)){return getUser(_0x22ebc2,_0x692983[_0xb097('0x4e')],_0x1bfd40);}else{return getUser(_0x22ebc2,null,_0x1bfd40);}})[_0xb097('0x21')](function(_0x383df7){_0x1084b6=_0x383df7;return getEndUser(_0x22ebc2,_0x11d43a,_0x4e776b[_0xb097('0x60')],_0x4e776b[_0xb097('0x78')],_0x1bfd40);})[_0xb097('0x21')](function(_0x1758cc){_0x5d01fe=_0x1758cc;return getTicket(_0x22ebc2,_0x1084b6,_0x5d01fe,_0x11d43a,_0x4e776b,_0x11d43a[_0xb097('0x70')],_0x1bfd40);})['then'](function(_0x38a795){_0x5a4b24=_0x38a795;logger[_0xb097('0x1a')]('['+_0x4e776b['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x5a4b24['id']);logger[_0xb097('0x1a')]('['+_0x4e776b[_0xb097('0x77')][_0xb097('0x79')]()+_0xb097('0x7a'),_0x22ebc2[_0xb097('0x37')]);})[_0xb097('0x69')](function(_0x610493){logger[_0xb097('0x67')]('['+_0x4e776b[_0xb097('0x77')][_0xb097('0x79')]()+']',_0x610493);});}; \ No newline at end of file +var _0x9777=['contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Account','Lead','first','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','username','Connection\x20established.','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','[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','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','Task','utc','IsReminderSet','contact','endUserType','lead','ticketType','Case','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','info','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9777,0xd2));var _0x7977=function(_0xef79dd,_0x2ad38e){_0xef79dd=_0xef79dd-0x0;var _0x499300=_0x9777[_0xef79dd];return _0x499300;};'use strict';var _=require('lodash');var rp=require(_0x7977('0x0'));var moment=require(_0x7977('0x1'));var BPromise=require(_0x7977('0x2'));var md5=require(_0x7977('0x3'));var jsforce=require(_0x7977('0x4'));var util=require(_0x7977('0x5'));var Redis=require(_0x7977('0x6'));var intUtil=require(_0x7977('0x7'));var config=require(_0x7977('0x8'));var logger=require(_0x7977('0x9'))('salesforce');config[_0x7977('0xa')]=_[_0x7977('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7977('0xc'))(new Redis(config['redis']));function emit(_0x19d312,_0x1d9c45,_0x21e3cb){io['to'](_0x19d312)['emit'](_0x1d9c45,_0x21e3cb);}function getTicket(_0x2a4748,_0x176b27,_0x4b2f9e,_0x2bf2d0,_0x2c450c,_0x26cf4e,_0x46a2e2,_0x3ff2aa){var _0x5dd14f=Object[_0x7977('0xd')]({},{'OwnerId':_0x176b27['id'],'Subject':intUtil[_0x7977('0xe')](_0x2bf2d0[_0x7977('0xf')],_0x2c450c,'\x20'),'Description':intUtil[_0x7977('0xe')](_0x2bf2d0[_0x7977('0x10')],_0x2c450c,'\x0a')},getCustomFields(_0x26cf4e,_0x2c450c));if(_0x4b2f9e){if(_0x2bf2d0['ticketType']===_0x7977('0x11')){_0x5dd14f['ActivityDate']=moment[_0x7977('0x12')]();_0x5dd14f[_0x7977('0x13')]=![];_0x5dd14f['IsRecurrence']=![];if(_0x4b2f9e['endUserType']===_0x7977('0x14')||_0x4b2f9e[_0x7977('0x15')]===_0x7977('0x16')){_0x5dd14f['WhoId']=_0x4b2f9e['id'];}else if(_0x4b2f9e[_0x7977('0x15')]==='account'){_0x5dd14f['WhatId']=_0x4b2f9e['id'];}}else if(_0x2bf2d0[_0x7977('0x17')]===_0x7977('0x18')){if(_0x4b2f9e[_0x7977('0x15')]===_0x7977('0x14')){_0x5dd14f['ContactId']=_0x4b2f9e['id'];}else if(_0x4b2f9e[_0x7977('0x15')]===_0x7977('0x19')){_0x5dd14f[_0x7977('0x1a')]=_0x4b2f9e['id'];}else if(_0x4b2f9e[_0x7977('0x15')]===_0x7977('0x16')&&_0x2bf2d0[_0x7977('0x1b')]){_0x5dd14f[_0x2bf2d0['leadId']]=_0x4b2f9e['id'];}else{logger['info'](_0x7977('0x1c'));}}}return _0x46a2e2[_0x7977('0x1d')](_0x2bf2d0['ticketType'])[_0x7977('0x1e')](_0x5dd14f);}function getUser(_0x21a77b,_0x1fc168,_0x40de53){if(!_[_0x7977('0x1f')](_0x1fc168)&&intUtil[_0x7977('0x20')](_0x1fc168)){var _0x46dded={'Email':_0x1fc168};var _0x30fc85={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x40de53[_0x7977('0x1d')](_0x7977('0x21'))['find'](_0x46dded,_0x30fc85)[_0x7977('0x22')]()[_0x7977('0x23')](function(_0x31970f){if(_0x31970f[_0x7977('0x24')]){var _0x511d1a=_[_0x7977('0x25')](_0x31970f,function(_0x5a8ded){return _0x5a8ded[_0x7977('0x26')]===_0x1fc168;});if(_0x511d1a){logger['info'](_0x7977('0x27'),_0x1fc168);return BPromise[_0x7977('0x28')]({'id':_0x511d1a['Id'],'name':_0x511d1a['Name']});}}else{logger[_0x7977('0x29')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1fc168);return _0x40de53[_0x7977('0x2a')]()[_0x7977('0x23')](function(_0x3111fc){return BPromise[_0x7977('0x28')]({'id':_0x3111fc[_0x7977('0x2b')],'name':_0x3111fc[_0x7977('0x2c')]});});}});}else{logger[_0x7977('0x29')](_0x7977('0x2d'),_0x1fc168);return _0x40de53['identity']()[_0x7977('0x23')](function(_0xe8a614){return BPromise[_0x7977('0x28')]({'id':_0xe8a614[_0x7977('0x2b')],'name':_0xe8a614[_0x7977('0x2c')]});});}}function getEndUser(_0xaae379,_0x1ba154,_0xed3bf9,_0x5e4844,_0x237fa7){var _0x31ec10={'$or':{'Phone':_0x5e4844}};var _0x280616={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7977('0x28')]()[_0x7977('0x23')](function(){logger['info'](_0x7977('0x2e'),_0x5e4844,_0x1ba154[_0x7977('0x2f')]);switch(_0x1ba154[_0x7977('0x2f')]){case _0x7977('0x30'):var _0x2ee40b=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154['additionalSearchContact']){var _0x3f7482={};_0x3f7482[_0x1ba154[_0x7977('0x32')]]=_0x5e4844;_['merge'](_0x2ee40b[_0x7977('0x33')],_0x3f7482);}return _0x237fa7['sobject'](_0x7977('0x34'))['find'](_0x2ee40b,_0x280616)['execute']()[_0x7977('0x23')](function(_0x4596c2){if(_0x4596c2&&_0x4596c2[_0x7977('0x24')]){return _0x4596c2;}else{var _0x2267e2=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154[_0x7977('0x35')]){var _0x5e6c5f={};_0x5e6c5f[_0x1ba154[_0x7977('0x35')]]=_0x5e4844;_[_0x7977('0x36')](_0x2267e2[_0x7977('0x33')],_0x5e6c5f);}return _0x237fa7['sobject']('Lead')['find'](_0x2267e2,_0x280616);}});case _0x7977('0x37'):var _0x6e4d41=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154[_0x7977('0x38')]){var _0x3f7482={};_0x3f7482[_0x1ba154[_0x7977('0x38')]]=_0x5e4844;_[_0x7977('0x36')](_0x6e4d41[_0x7977('0x33')],_0x3f7482);}return _0x237fa7['sobject'](_0x7977('0x39'))['find'](_0x6e4d41,_0x280616)['execute']()[_0x7977('0x23')](function(_0x4da6db){if(_0x4da6db&&_0x4da6db[_0x7977('0x24')]){return _0x4da6db;}else{var _0x400879=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154['additionalSearchContact']){var _0x5a0d41={};_0x5a0d41[_0x1ba154[_0x7977('0x32')]]=_0x5e4844;_[_0x7977('0x36')](_0x400879['$or'],_0x5a0d41);}return _0x237fa7[_0x7977('0x1d')]('Contact')[_0x7977('0x25')](_0x400879,_0x280616)[_0x7977('0x23')](function(_0x31096b){if(_0x31096b&&_0x31096b[_0x7977('0x24')]){return _0x31096b;}else{var _0x525f90=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154[_0x7977('0x35')]){var _0x51694d={};_0x51694d[_0x1ba154[_0x7977('0x35')]]=_0x5e4844;_['merge'](_0x525f90['$or'],_0x51694d);}return _0x237fa7[_0x7977('0x1d')](_0x7977('0x3a'))['find'](_0x525f90,_0x280616);}});}});case _0x7977('0x14'):var _0x2ee40b=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154['additionalSearchContact']){var _0x3f7482={};_0x3f7482[_0x1ba154[_0x7977('0x32')]]=_0x5e4844;_[_0x7977('0x36')](_0x2ee40b[_0x7977('0x33')],_0x3f7482);}return _0x237fa7[_0x7977('0x1d')]('Contact')[_0x7977('0x25')](_0x2ee40b,_0x280616)[_0x7977('0x22')]();case _0x7977('0x16'):var _0x4d25bf=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154[_0x7977('0x35')]){var _0x3f7482={};_0x3f7482[_0x1ba154[_0x7977('0x35')]]=_0x5e4844;_[_0x7977('0x36')](_0x4d25bf['$or'],_0x3f7482);}return _0x237fa7[_0x7977('0x1d')](_0x7977('0x3a'))['find'](_0x4d25bf,_0x280616);case _0x7977('0x19'):var _0x6e4d41=_[_0x7977('0x31')](_0x31ec10);if(_0x1ba154[_0x7977('0x38')]){var _0x3f7482={};_0x3f7482[_0x1ba154[_0x7977('0x38')]]=_0x5e4844;_[_0x7977('0x36')](_0x6e4d41[_0x7977('0x33')],_0x3f7482);}return _0x237fa7[_0x7977('0x1d')](_0x7977('0x39'))[_0x7977('0x25')](_0x6e4d41,_0x280616);default:return null;}})[_0x7977('0x23')](function(_0x497429){if(_0x497429&&_0x497429[_0x7977('0x24')]){var _0x1cd4ca=_[_0x7977('0x3b')](_0x497429);if(_0x1cd4ca){return BPromise[_0x7977('0x28')]({'id':_0x1cd4ca['Id'],'name':_0x1cd4ca[_0x7977('0x3c')],'phone':_0x1cd4ca[_0x7977('0x3d')],'endUserType':_0x1cd4ca['attributes'][_0x7977('0x3e')][_0x7977('0x3f')]()});}}})['then'](function(_0x4b19a6){if(_0x4b19a6){logger[_0x7977('0x29')](_0x7977('0x40'),_0x4b19a6[_0x7977('0x15')],_0x5e4844);return BPromise[_0x7977('0x28')](_0x4b19a6);}else{logger[_0x7977('0x29')](_0x7977('0x41'),_0x5e4844);var _0x12569a={'Phone':_0x5e4844};if(_0x1ba154[_0x7977('0x42')]){if(_0x1ba154['moduleCreate']===_0x7977('0x14')){logger[_0x7977('0x29')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5e4844,_0x1ba154[_0x7977('0x42')]);_0x12569a[_0x7977('0x43')]=_0xed3bf9!==_0x7977('0x44')?_0xed3bf9:util[_0x7977('0x45')]('Caller\x20-\x20%s',_0x5e4844);}else if(_0x1ba154[_0x7977('0x42')]==='lead'){logger[_0x7977('0x29')](_0x7977('0x46'),_0x5e4844,_0x1ba154[_0x7977('0x42')]);_0x12569a[_0x7977('0x43')]=_0xed3bf9!==_0x7977('0x44')?_0xed3bf9:util[_0x7977('0x45')](_0x7977('0x47'),_0x5e4844);_0x12569a[_0x7977('0x48')]=_0x7977('0x49');}else if(_0x1ba154['moduleCreate']==='account'){logger[_0x7977('0x29')](_0x7977('0x46'),_0x5e4844,_0x1ba154[_0x7977('0x42')]);_0x12569a[_0x7977('0x3c')]=_0xed3bf9!==_0x7977('0x44')?_0xed3bf9:util['format']('Caller\x20-\x20%s',_0x5e4844);}else{return null;}}return _0x237fa7[_0x7977('0x1d')](_[_0x7977('0x4a')](_0x1ba154[_0x7977('0x42')]))[_0x7977('0x1e')](_0x12569a)['then'](function(_0x346006){return BPromise[_0x7977('0x28')]({'id':_0x346006['id'],'endUserType':_0x1ba154[_0x7977('0x42')]});});}});}function getCustomFields(_0x194dbb,_0x13c448){var _0x251458={};if(_0x194dbb[_0x7977('0x24')]>0x0){_[_0x7977('0x4b')](_0x194dbb,function(_0x34cf15){if(_[_0x7977('0x4c')](['string',_0x7977('0x4d')],_0x34cf15[_0x7977('0x3e')])&&_0x34cf15['idField']){_0x251458[_0x34cf15[_0x7977('0x4e')]]=_0x34cf15[_0x7977('0x4f')]['toString']();}else if(_0x34cf15[_0x7977('0x3e')]===_0x7977('0x50')&&_0x34cf15[_0x7977('0x51')]&&_0x34cf15[_0x7977('0x4e')]){_0x13c448[_0x34cf15[_0x7977('0x51')]]&&(_0x251458[_0x34cf15[_0x7977('0x4e')]]=_0x13c448[_0x34cf15[_0x7977('0x51')]]['toString']());}else if(_0x34cf15[_0x7977('0x3e')]===_0x7977('0x52')&&_0x34cf15[_0x7977('0x53')]&&_0x34cf15[_0x7977('0x53')][_0x7977('0x54')]&&_0x34cf15['idField']){_0x13c448[_0x34cf15['Variable']['name'][_0x7977('0x3f')]()]&&(_0x251458[_0x34cf15['idField']]=_0x13c448[_0x34cf15['Variable'][_0x7977('0x54')][_0x7977('0x3f')]()]['toString']());}});}return _0x251458;}function getConnection(_0x281221){var _0x36627=_0x281221[_0x7977('0x55')][_0x7977('0x56')](_0x281221[_0x7977('0x57')]);var _0x29ec2b=new jsforce[(_0x7977('0x58'))]({'oauth2':{'loginUrl':_0x281221[_0x7977('0x59')]||'https://login.salesforce.com','clientId':_0x281221[_0x7977('0x5a')],'clientSecret':_0x281221[_0x7977('0x5b')]}});return _0x29ec2b['login'](_0x281221[_0x7977('0x5c')],_0x36627)[_0x7977('0x23')](function(){logger[_0x7977('0x29')](_0x7977('0x5d'));return _0x29ec2b;});}exports['queue']=function(_0x58929a,_0x12bdb1,_0x24301f,_0x534e67,_0x3408e9,_0x290903){var _0x39be41,_0x546d04,_0x5df6e6,_0x5000e3;_0x290903['serverUrl']=intUtil[_0x7977('0x5e')](_0x290903['serverUrl']);_0x290903[_0x7977('0x59')]=intUtil[_0x7977('0x5e')](_0x290903['remoteUri']);if(_0x3408e9&&_0x3408e9[_0x7977('0x5f')]){logger['info']('[QUEUE]',_0x7977('0x60'));_0x12bdb1[_0x7977('0x61')]=util[_0x7977('0x45')](_0x7977('0x62'),_0x290903[_0x7977('0x63')],_0x12bdb1[_0x7977('0x64')],md5(_0x12bdb1[_0x7977('0x64')]));}else{_0x12bdb1[_0x7977('0x61')]='';}return getConnection(_0x290903)['then'](function(_0x52ef90){_0x5000e3=_0x52ef90;return getUser(_0x290903,_0x534e67[_0x7977('0x65')],_0x5000e3);})[_0x7977('0x23')](function(_0x7178a9){_0x39be41=_0x7178a9;return getEndUser(_0x290903,_0x24301f,_0x12bdb1[_0x7977('0x66')],_0x12bdb1[_0x7977('0x67')],_0x5000e3);})[_0x7977('0x23')](function(_0x298834){_0x546d04=_0x298834;return getTicket(_0x290903,_0x39be41,_0x546d04,_0x24301f,_0x12bdb1,_0x24301f['Fields'],_0x5000e3,'queue');})['then'](function(_0x33c955){_0x5df6e6=_0x33c955;logger[_0x7977('0x29')](_0x7977('0x68'),_0x5df6e6['id']);logger[_0x7977('0x29')](_0x7977('0x69'),_0x5df6e6['id'],_0x534e67[_0x7977('0x54')],_0x290903[_0x7977('0x3e')]);switch(_0x290903[_0x7977('0x3e')]){case _0x7977('0x6a'):emit(util[_0x7977('0x45')](_0x7977('0x6b'),_0x534e67[_0x7977('0x54')]),_0x7977('0x6c'),{'recordId':_0x5df6e6['id']});break;case _0x7977('0x6d'):emit(util[_0x7977('0x45')](_0x7977('0x6b'),_0x534e67[_0x7977('0x54')]),_0x7977('0x6e'),{'uri':util[_0x7977('0x45')](_0x7977('0x6f'),_0x5000e3[_0x7977('0x70')],_0x5df6e6['id'])});break;default:logger[_0x7977('0x71')](_0x7977('0x72'));}})[_0x7977('0x73')](function(_0x2c62f0){logger[_0x7977('0x71')](_0x7977('0x74'),_0x2c62f0);});};exports[_0x7977('0x75')]=function(_0x4e872f,_0x2972bc,_0x18caca,_0x4bdb1e,_0x51c6fa,_0xd02454,_0x250329){var _0x32bcba,_0x17b54a,_0x9dacd9,_0x2aa465;_0xd02454[_0x7977('0x63')]=intUtil['stripTrailingSlash'](_0xd02454[_0x7977('0x63')]);_0xd02454[_0x7977('0x59')]=intUtil[_0x7977('0x5e')](_0xd02454['remoteUri']);if(_0x250329&&_0x250329[_0x7977('0x76')]&&_0x250329[_0x7977('0x76')]!==_0x7977('0x77')){logger['info'](_0x7977('0x78'),_0x7977('0x60'));_0x2972bc[_0x7977('0x61')]=util[_0x7977('0x45')](_0x7977('0x62'),_0xd02454[_0x7977('0x63')],_0x2972bc['uniqueid'],md5(_0x2972bc[_0x7977('0x64')]));}return getConnection(_0xd02454)[_0x7977('0x23')](function(_0x3128d1){_0x2aa465=_0x3128d1;return getUser(_0xd02454,_0x4bdb1e[_0x7977('0x65')],_0x2aa465);})[_0x7977('0x23')](function(_0x9e522c){_0x32bcba=_0x9e522c;return getEndUser(_0xd02454,_0x18caca,_0x2972bc[_0x7977('0x79')],_0x2972bc['destcalleridnum'],_0x2aa465);})[_0x7977('0x23')](function(_0x30ef2f){_0x17b54a=_0x30ef2f;return getTicket(_0xd02454,_0x32bcba,_0x17b54a,_0x18caca,_0x2972bc,_0x18caca[_0x7977('0x7a')],_0x2aa465,_0x7977('0x75'));})[_0x7977('0x23')](function(_0x2377a5){_0x9dacd9=_0x2377a5;logger[_0x7977('0x29')](_0x7977('0x7b'),_0x9dacd9['id']);logger['info'](_0x7977('0x7c'),_0x9dacd9['id'],_0x4bdb1e[_0x7977('0x54')],_0xd02454[_0x7977('0x3e')]);switch(_0xd02454[_0x7977('0x3e')]){case _0x7977('0x6a'):emit(util[_0x7977('0x45')](_0x7977('0x6b'),_0x4bdb1e['name']),_0x7977('0x6c'),{'recordId':_0x9dacd9['id']});break;case'newTab':emit(util[_0x7977('0x45')](_0x7977('0x6b'),_0x4bdb1e['name']),_0x7977('0x6e'),{'uri':util[_0x7977('0x45')](_0x7977('0x6f'),_0x2aa465[_0x7977('0x70')],_0x9dacd9['id'])});break;default:logger[_0x7977('0x71')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7977('0x73')](function(_0xb551ba){logger[_0x7977('0x71')](_0x7977('0x78'),_0xb551ba);});};exports['unmanaged']=function(_0x3ae957,_0x457354,_0x503a87,_0x215c0f,_0x35bfdb,_0x1e1609){var _0x2a5614,_0x33a8fc,_0x58ea7c,_0x59b3c7;_0x1e1609[_0x7977('0x63')]=intUtil[_0x7977('0x5e')](_0x1e1609[_0x7977('0x63')]);_0x1e1609[_0x7977('0x59')]=intUtil[_0x7977('0x5e')](_0x1e1609['remoteUri']);if(_0x35bfdb&&_0x35bfdb[_0x7977('0x5f')]){logger[_0x7977('0x29')]('['+_0x457354[_0x7977('0x7d')][_0x7977('0x7e')]()+']',_0x7977('0x60'));_0x457354[_0x7977('0x61')]=util[_0x7977('0x45')](_0x7977('0x62'),_0x1e1609[_0x7977('0x63')],_0x457354[_0x7977('0x64')],md5(_0x457354['uniqueid']));}else{_0x457354['recordingURL']='';}return getConnection(_0x1e1609)[_0x7977('0x23')](function(_0x2ac371){_0x59b3c7=_0x2ac371;if(!_[_0x7977('0x1f')](_0x215c0f)){return getUser(_0x1e1609,_0x215c0f['name'],_0x59b3c7);}else{return getUser(_0x1e1609,null,_0x59b3c7);}})['then'](function(_0x163d9d){_0x2a5614=_0x163d9d;return getEndUser(_0x1e1609,_0x503a87,_0x457354[_0x7977('0x66')],_0x457354[_0x7977('0x67')],_0x59b3c7);})[_0x7977('0x23')](function(_0x10f1fe){_0x33a8fc=_0x10f1fe;return getTicket(_0x1e1609,_0x2a5614,_0x33a8fc,_0x503a87,_0x457354,_0x503a87['Fields'],_0x59b3c7);})[_0x7977('0x23')](function(_0x254909){_0x58ea7c=_0x254909;logger[_0x7977('0x29')]('['+_0x457354[_0x7977('0x7d')][_0x7977('0x7e')]()+_0x7977('0x7f'),_0x58ea7c['id']);logger['info']('['+_0x457354[_0x7977('0x7d')]['toUpperCase']()+_0x7977('0x80'),_0x1e1609[_0x7977('0x3e')]);})['catch'](function(_0xdf6666){logger['error']('['+_0x457354[_0x7977('0x7d')]['toUpperCase']()+']',_0xdf6666);});}; \ 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 a070154..2775906 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 _0xcf5d=['serverUrl','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','redis','then','length','adminId','result','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri'];(function(_0x2f6b8e,_0xb29dcc){var _0x2af6dd=function(_0x547588){while(--_0x547588){_0x2f6b8e['push'](_0x2f6b8e['shift']());}};_0x2af6dd(++_0xb29dcc);}(_0xcf5d,0x1ca));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var Promise=require(_0xdcf5('0x1'));var rp=require(_0xdcf5('0x2'));var util=require(_0xdcf5('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0xdcf5('0x4'));var config=require(_0xdcf5('0x5'));var logger=require(_0xdcf5('0x6'))(_0xdcf5('0x7'));config['redis']=_[_0xdcf5('0x8')](config['redis'],{'host':_0xdcf5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdcf5('0xa')]));function getAdminUser(_0x435d23,_0x5c5be5,_0x265715,_0x3f9dfc,_0x786ed6,_0x42ced2){return new Promise(function(_0x54aed,_0x5e32d9){var _0xab618b={'method':'GET','uri':_0x3f9dfc+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x786ed6+'&'+_0x42ced2,'auth':_0x5c5be5,'json':!![]};return rp(_0xab618b)[_0xdcf5('0xb')](function(_0x386727){if(_0x386727['result'][_0xdcf5('0xc')]>0x0){_0x265715[_0xdcf5('0xd')]=_0x386727[_0xdcf5('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x435d23[_0xdcf5('0xf')]()]+_0xdcf5('0x10'),_0x265715);_0x54aed(_0x265715);})[_0xdcf5('0x11')](function(_0x107e24){logger[_0xdcf5('0x12')]('['+[_0x435d23[_0xdcf5('0xf')]()]+']',_0x107e24[_0xdcf5('0x13')]);_0x5e32d9(_0x107e24[_0xdcf5('0x13')]);});});}function getUser(_0x135d2d,_0x143d0b,_0x5122cc,_0x148683,_0x2d4f5d){return function(_0x6c116){logger['info']('['+[_0x135d2d[_0xdcf5('0xf')]()]+_0xdcf5('0x14'),_0x6c116);return new Promise(function(_0x47b452,_0x4cf294){if(intUtil[_0xdcf5('0x15')](_0x6c116[_0xdcf5('0x16')])){var _0x30bee7={'method':'GET','uri':_0x5122cc+'sys_user?sysparm_query=email%3D'+_0x6c116[_0xdcf5('0x16')]+'&'+_0x148683+'&'+_0x2d4f5d,'auth':_0x143d0b,'json':!![]};logger[_0xdcf5('0x17')]('['+[_0x135d2d[_0xdcf5('0xf')]()]+_0xdcf5('0x18'),_0x30bee7);return rp(_0x30bee7)['then'](function(_0xdaa879){logger[_0xdcf5('0x17')]('['+[_0x135d2d['toUpperCase']()]+_0xdcf5('0x19'),_0xdaa879);if(_0xdaa879[_0xdcf5('0xe')][_0xdcf5('0xc')]>0x0&&String(_0xdaa879[_0xdcf5('0xe')][0x0][_0xdcf5('0x1a')])===_0xdcf5('0x1b')){_0x6c116[_0xdcf5('0x1c')]=_0xdaa879['result'][0x0][_0xdcf5('0x1d')];}else{_0x6c116[_0xdcf5('0x1c')]=_0x6c116[_0xdcf5('0xd')];_0x6c116[_0xdcf5('0x16')]=_0x6c116[_0xdcf5('0x1e')];}logger[_0xdcf5('0x17')]('['+[_0x135d2d[_0xdcf5('0xf')]()]+'],\x20getUser\x20crm',_0x6c116);_0x47b452(_0x6c116);})[_0xdcf5('0x11')](function(_0x1d6dfe){logger[_0xdcf5('0x12')]('['+[_0x135d2d[_0xdcf5('0xf')]()]+']',_0x1d6dfe[_0xdcf5('0x13')]);_0x4cf294(_0x1d6dfe[_0xdcf5('0x13')]);});}else{logger['info']('['+[_0x135d2d[_0xdcf5('0xf')]()]+_0xdcf5('0x1f'));_0x6c116[_0xdcf5('0x1c')]=_0x6c116[_0xdcf5('0xd')];_0x6c116[_0xdcf5('0x16')]=_0x6c116[_0xdcf5('0x1e')];_0x47b452(_0x6c116);}});};}function createEndUser(_0x5f157c,_0x39bd5e,_0x1fae30,_0x4aacef,_0x336b26){logger[_0xdcf5('0x17')]('['+[_0x5f157c['toUpperCase']()]+_0xdcf5('0x20'),_0x1fae30);return new Promise(function(_0x44f44d,_0x48e447){var _0x1b3f94={'method':_0xdcf5('0x21'),'uri':_0x4aacef+_0xdcf5('0x22')+_0x336b26,'body':{'user_name':_0x1fae30[_0xdcf5('0x23')],'roles':'user','first_name':_0x1fae30['endUserNumber'],'active':_0xdcf5('0x1b'),'date_format':_0xdcf5('0x24'),'phone':_0x1fae30[_0xdcf5('0x23')]},'auth':_0x39bd5e,'json':!![]};return rp(_0x1b3f94)[_0xdcf5('0xb')](function(_0x3f2720){logger[_0xdcf5('0x17')]('['+[_0x5f157c['toUpperCase']()]+_0xdcf5('0x25'),_0x3f2720[_0xdcf5('0xe')]);_0x1fae30[_0xdcf5('0x26')]=_0x3f2720[_0xdcf5('0xe')]['sys_id'];_0x44f44d(_0x1fae30);})[_0xdcf5('0x11')](function(_0x3a0c94){logger['error']('['+[_0x5f157c[_0xdcf5('0xf')]()]+']',_0x3a0c94[_0xdcf5('0x13')]);_0x48e447(_0x3a0c94[_0xdcf5('0x13')]);});});}function getEndUser(_0x3228df,_0x110e21,_0x36cad7,_0x301686,_0x31dea8){return function(_0x3397be){logger[_0xdcf5('0x17')]('['+[_0x3228df[_0xdcf5('0xf')]()]+_0xdcf5('0x27'),_0x3397be);return new Promise(function(_0x328a3c,_0x4b02e1){var _0x2632a8={'method':_0xdcf5('0x28'),'uri':_0x36cad7+_0xdcf5('0x29')+_0x3397be[_0xdcf5('0x23')]+'&'+_0x301686+'&'+_0x31dea8,'auth':_0x110e21,'json':!![]};return rp(_0x2632a8)[_0xdcf5('0xb')](function(_0x4978f8){if(_0x4978f8[_0xdcf5('0xe')][_0xdcf5('0xc')]>0x0){_0x3397be[_0xdcf5('0x26')]=_0x4978f8[_0xdcf5('0xe')][0x0][_0xdcf5('0x1d')];logger[_0xdcf5('0x17')]('['+[_0x3228df['toUpperCase']()]+_0xdcf5('0x2a'),_0x3397be);_0x328a3c(_0x3397be);}else{return createEndUser(_0x3228df,_0x110e21,_0x3397be,_0x36cad7,_0x301686)[_0xdcf5('0xb')](function(_0x43d634){logger['info']('['+[_0x3228df[_0xdcf5('0xf')]()]+_0xdcf5('0x2b'),_0x43d634);_0x328a3c(_0x43d634);});}})[_0xdcf5('0x11')](function(_0xa8717b){logger[_0xdcf5('0x12')]('['+[_0x3228df['toUpperCase']()]+']',_0xa8717b[_0xdcf5('0x13')]);_0x4b02e1(_0xa8717b[_0xdcf5('0x13')]);});});};}function getCustomFields(_0x20dbb6,_0x41b2b9){var _0x37c7d4={};if(_0x20dbb6['length']>0x0){_[_0xdcf5('0x2c')](_0x20dbb6,function(_0x15c36c){if(_[_0xdcf5('0x2d')]([_0xdcf5('0x2e'),_0xdcf5('0x2f')],_0x15c36c['type'])&&_0x15c36c['nameField']&&!_0x15c36c['customField']){_0x37c7d4[_0x15c36c[_0xdcf5('0x30')][_0xdcf5('0x31')]()]=_0x15c36c[_0xdcf5('0x32')][_0xdcf5('0x33')]();}else if(_[_0xdcf5('0x2d')]([_0xdcf5('0x2e'),_0xdcf5('0x2f')],_0x15c36c[_0xdcf5('0x34')])&&_0x15c36c[_0xdcf5('0x35')]&&_0x15c36c[_0xdcf5('0x36')]){_0x37c7d4[_0x15c36c['idField'][_0xdcf5('0x31')]()]=_0x15c36c[_0xdcf5('0x32')][_0xdcf5('0x33')]();}else if(_0x15c36c[_0xdcf5('0x34')]===_0xdcf5('0x37')&&_0x15c36c[_0xdcf5('0x38')]&&_0x15c36c[_0xdcf5('0x35')]&&_0x15c36c['customField']){_0x37c7d4[_0x15c36c[_0xdcf5('0x35')][_0xdcf5('0x31')]()]=_0x41b2b9[_0x15c36c['variableName']]['toString']();}else if(_0x15c36c['type']===_0xdcf5('0x39')&&_0x15c36c[_0xdcf5('0x3a')]&&_0x15c36c['Variable']['name']&&_0x15c36c[_0xdcf5('0x35')]&&_0x15c36c[_0xdcf5('0x36')]){_0x37c7d4[_0x15c36c[_0xdcf5('0x35')][_0xdcf5('0x31')]()]=_0x41b2b9[_0x15c36c[_0xdcf5('0x3a')][_0xdcf5('0x3b')][_0xdcf5('0x31')]()][_0xdcf5('0x33')]();}});}return _0x37c7d4;}function getTicket(_0x26fe85,_0x11354e,_0x28fdf7,_0x26df51,_0x242fcd,_0x496d50){return function(_0x5f5d6d){logger[_0xdcf5('0x17')]('['+[_0x26fe85[_0xdcf5('0xf')]()]+_0xdcf5('0x3c'),_0x5f5d6d);return new Promise(function(_0x431100,_0x125eb5){var _0x428e1f=_0x26fe85[_0xdcf5('0x31')]()===_0xdcf5('0x3d')?_0x5f5d6d[_0xdcf5('0x1c')]:_0x5f5d6d[_0xdcf5('0x26')];var _0x30ae29={'method':_0xdcf5('0x21'),'uri':_0x28fdf7+_0xdcf5('0x3e')+'?'+_0x496d50,'body':Object[_0xdcf5('0x3f')]({},{'active':_0xdcf5('0x1b'),'caller_id':_0x428e1f,'assigned_to':_0x5f5d6d[_0xdcf5('0x1c')],'short_description':intUtil[_0xdcf5('0x40')](_0x26df51[_0xdcf5('0x41')],_0x242fcd,'\x20'),'description':intUtil[_0xdcf5('0x40')](_0x26df51['Descriptions'],_0x242fcd,'\x0a')},getCustomFields(_0x26df51[_0xdcf5('0x42')],_0x242fcd)),'auth':_0x11354e,'json':!![]};return rp(_0x30ae29)[_0xdcf5('0xb')](function(_0x2d3c9e){logger[_0xdcf5('0x17')]('['+[_0x26fe85[_0xdcf5('0xf')]()]+_0xdcf5('0x43'),_0x2d3c9e['result']);_0x5f5d6d[_0xdcf5('0x44')]=_0x2d3c9e[_0xdcf5('0xe')]['sys_id'];_0x5f5d6d[_0xdcf5('0x45')]=_0x2d3c9e['result'][_0xdcf5('0x46')];logger[_0xdcf5('0x17')]('['+[_0x26fe85[_0xdcf5('0xf')]()]+']\x20getTicket\x20crm',_0x5f5d6d);_0x431100(_0x5f5d6d);})[_0xdcf5('0x11')](function(_0x50e3c8){logger['error']('['+[_0x26fe85[_0xdcf5('0xf')]()]+']',_0x50e3c8[_0xdcf5('0x13')]);_0x125eb5(_0x50e3c8[_0xdcf5('0x13')]);});});};}function createRemoteTag(_0x2c6ae7,_0x98b3ff,_0x539558,_0x2cb961){return new Promise(function(_0x4e9eb8,_0xfde319){var _0x282580={'method':'POST','uri':_0x539558+'label'+'?'+_0x2cb961,'body':{'short_description':_0x2c6ae7,'global':!![],'active':!![],'name':_0x2c6ae7},'auth':_0x98b3ff,'json':!![]};return rp(_0x282580)[_0xdcf5('0xb')](function(_0x148b04){var _0x5362c7=_0x148b04[_0xdcf5('0xe')][_0xdcf5('0x1d')];_0x4e9eb8(_0x5362c7);});});}function getRemoteTag(_0x24b0e3,_0x2b1073,_0x47bab1,_0x17ff83,_0x4a27fa){return new Promise(function(_0x1727e5,_0x49acc4){var _0x6b7e73={'method':_0xdcf5('0x28'),'uri':_0x47bab1+'label'+_0xdcf5('0x47')+_0x24b0e3+'&'+_0x17ff83,'auth':_0x2b1073,'json':!![]};return rp(_0x6b7e73)[_0xdcf5('0xb')](function(_0x11aa3f){if(_0x11aa3f['result'][_0xdcf5('0xc')]>0x0){var _0x318c3d=_0x11aa3f[_0xdcf5('0xe')][0x0]['sys_id'];_0x1727e5(_0x318c3d);}else{return createRemoteTag(_0x24b0e3,_0x2b1073,_0x47bab1,_0x17ff83)[_0xdcf5('0xb')](function(_0xc0e925){_0x1727e5(_0xc0e925);});}});});}function assignTagToIncident(_0x42d445,_0x255ca5,_0x524c1d,_0x2708bb,_0x945b51){return new Promise(function(_0x1a3626,_0x156eb1){var _0x1c3fe3={'method':_0xdcf5('0x21'),'uri':_0x524c1d+_0xdcf5('0x48')+'?'+_0x945b51,'body':{'label':_0x42d445,'table':_0xdcf5('0x3e'),'id_type':_0xdcf5('0x49'),'table_key':_0x2708bb['ticketId'],'title':_0xdcf5('0x4a')+_0x2708bb[_0xdcf5('0x45')],'id_display':_0x2708bb[_0xdcf5('0x45')]},'auth':_0x255ca5,'json':!![]};return rp(_0x1c3fe3)['then'](function(_0x197fd3){_0x1a3626();})['catch'](function(){_0x1a3626();});});}function manageTags(_0x26413a,_0x148506,_0x59c1b4,_0x5e5299,_0x434ed4,_0xc4a5d7,_0x45ef46){return new Promise(function(_0x15d27b,_0x2d6856){var _0xe00cd5=[];_0x148506[_0xdcf5('0x2c')](function(_0x30c917){_0xe00cd5[_0xdcf5('0x4b')](getRemoteTag(_0x30c917,_0x59c1b4,_0x5e5299,_0xc4a5d7,_0x45ef46));});return Promise[_0xdcf5('0x4c')](_0xe00cd5)[_0xdcf5('0xb')](function(_0x422aa4){if(_0x422aa4[_0xdcf5('0xc')]){logger[_0xdcf5('0x17')]('['+[_0x26413a[_0xdcf5('0xf')]()]+_0xdcf5('0x4d'),_0x422aa4);var _0x476fd2=[];_0x422aa4['forEach'](function(_0x2f6d35){_0x476fd2[_0xdcf5('0x4b')](assignTagToIncident(_0x2f6d35,_0x59c1b4,_0x5e5299,_0x434ed4,_0xc4a5d7));});return Promise['all'](_0x476fd2)['then'](function(){_0x15d27b();})[_0xdcf5('0x11')](function(){_0x15d27b();});}else{_0x15d27b();}});});}function getTags(_0x366397,_0x117dff,_0x8b91d0,_0x29ba3d,_0xd4a166,_0x456477){return function(_0x3d9524){return new Promise(function(_0x403710,_0x1afe98){var _0x2f93a5=[];var _0x2eeb64=_0x29ba3d[_0xdcf5('0x4e')];if(_0x2eeb64&&_0x2eeb64[_0xdcf5('0xc')]>0x0){_0x2f93a5=_[_0xdcf5('0x4f')](_0x2eeb64,_0xdcf5('0x3b'));}if(_0x2f93a5['length']>0x0){return manageTags(_0x366397,_0x2f93a5,_0x117dff,_0x8b91d0,_0x3d9524,_0xd4a166,_0x456477)[_0xdcf5('0xb')](function(){_0x403710(_0x3d9524);});}else{_0x403710(_0x3d9524);}});};}function emit(_0x557073,_0x3c3b3c,_0x32c135){var _0x5c3f75=_0xdcf5('0x50')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xdcf5('0x51')+_0xdcf5('0x52');var _0x46ee3c={'uri':_0x557073+_0xdcf5('0x53')+_0x32c135+_0x5c3f75};io['to'](util[_0xdcf5('0x54')](_0xdcf5('0x55'),_0x3c3b3c))[_0xdcf5('0x56')](_0xdcf5('0x57'),_0x46ee3c);}exports['cs']=function(_0x5403d8,_0x1f1027,_0x130707,_0x20afb9,_0xcbc34f,_0x58be50,_0x2f0929,_0x2fcf46){var _0x35055a={};var _0x462cba={'user':_0x58be50[_0xdcf5('0x58')],'pass':_0x58be50[_0xdcf5('0x59')]};var _0x2ecdf0='sysparm_limit=1';var _0x3c80a2=_0xdcf5('0x5a');_0x58be50[_0xdcf5('0x5b')]=intUtil['stripTrailingSlash'](_0x58be50[_0xdcf5('0x5b')]);_0x58be50[_0xdcf5('0x5c')]=intUtil[_0xdcf5('0x5d')](_0x58be50[_0xdcf5('0x5c')]);var _0x2e05e0=util[_0xdcf5('0x54')](_0xdcf5('0x5e'),_0x58be50[_0xdcf5('0x5b')]);_0x35055a[_0xdcf5('0x16')]=!_['isNil'](_0x20afb9)?_0x20afb9[_0xdcf5('0x5f')]:null;_0x35055a['adminEmail']=_0x58be50[_0xdcf5('0x5f')];_0x35055a[_0xdcf5('0x23')]=_0x2fcf46[_0xdcf5('0x31')]()===_0xdcf5('0x3d')?_0x1f1027[_0xdcf5('0x60')]:_0x1f1027[_0xdcf5('0x61')];_0x35055a['callDirection']=_0x2fcf46===_0xdcf5('0x62')||_0x2fcf46==='unmanaged'?_0xdcf5('0x62'):_0xdcf5('0x3d');var _0x5bf9cd=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58be50[_0xdcf5('0x5c')],_0x1f1027[_0xdcf5('0x63')],md5(_0x1f1027[_0xdcf5('0x63')]));if(_0xcbc34f&&_0xcbc34f[_0xdcf5('0x64')]){logger['info']('[QUEUE]',_0xdcf5('0x65'));_0x1f1027['recordingURL']=_0x5bf9cd;}else if(_0x2f0929&&_0x2f0929[_0xdcf5('0x66')]&&_0x2f0929['recordingFormat']!==_0xdcf5('0x67')){logger['info']('[OUTBOUND]',_0xdcf5('0x65'));_0x1f1027['recordingURL']=_0x5bf9cd;}else{_0x1f1027['recordingURL']='';}return getAdminUser(_0x2fcf46,_0x462cba,_0x35055a,_0x2e05e0,_0x3c80a2,_0x2ecdf0)[_0xdcf5('0xb')](getUser(_0x2fcf46,_0x462cba,_0x2e05e0,_0x3c80a2,_0x2ecdf0))[_0xdcf5('0xb')](getEndUser(_0x2fcf46,_0x462cba,_0x2e05e0,_0x3c80a2,_0x2ecdf0))['then'](getTicket(_0x2fcf46,_0x462cba,_0x2e05e0,_0x130707,_0x1f1027,_0x3c80a2))[_0xdcf5('0xb')](function(_0x5b794d){logger[_0xdcf5('0x17')](util[_0xdcf5('0x54')](_0xdcf5('0x68'),_0x5b794d['ticketId']));logger[_0xdcf5('0x17')](util[_0xdcf5('0x54')](_0xdcf5('0x69'),_0x2fcf46));if(_0x2fcf46!==_0xdcf5('0x6a')){logger[_0xdcf5('0x17')]('['+[_0x2fcf46[_0xdcf5('0xf')]()]+']',_0xdcf5('0x6b'));emit(_0x58be50['remoteUri'],_0x20afb9[_0xdcf5('0x3b')],_0x5b794d[_0xdcf5('0x44')]);}})[_0xdcf5('0x11')](function(_0x3c03fd){logger['error']('['+[_0x2fcf46[_0xdcf5('0xf')]()]+_0xdcf5('0x6c'),util[_0xdcf5('0x6d')](_0x3c03fd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x026f=['sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','content','idField','customField','toLowerCase','toString','variableName','type','name','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','none','Recording\x20is\x20enabled!','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail'];(function(_0x37afb7,_0x9e5353){var _0x30ae66=function(_0x5f2dbd){while(--_0x5f2dbd){_0x37afb7['push'](_0x37afb7['shift']());}};_0x30ae66(++_0x9e5353);}(_0x026f,0x185));var _0xf026=function(_0x11119c,_0x199c80){_0x11119c=_0x11119c-0x0;var _0x308a25=_0x026f[_0x11119c];return _0x308a25;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xf026('0x0'));var util=require(_0xf026('0x1'));var md5=require('md5');var Redis=require(_0xf026('0x2'));var intUtil=require(_0xf026('0x3'));var config=require(_0xf026('0x4'));var logger=require('../../../../config/logger')(_0xf026('0x5'));config[_0xf026('0x6')]=_[_0xf026('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf026('0x6')]));function getAdminUser(_0x2d74cd,_0x5aa5d6,_0x2eed05,_0xde5c44,_0x30e5d7,_0x2a3fa4){return new Promise(function(_0x2ed621,_0x476ed7){var _0x19acb5={'method':_0xf026('0x8'),'uri':_0xde5c44+_0xf026('0x9')+'&'+_0x30e5d7+'&'+_0x2a3fa4,'auth':_0x5aa5d6,'json':!![]};return rp(_0x19acb5)[_0xf026('0xa')](function(_0x1238ee){if(_0x1238ee[_0xf026('0xb')][_0xf026('0xc')]>0x0){_0x2eed05[_0xf026('0xd')]=_0x1238ee[_0xf026('0xb')][0x0][_0xf026('0xe')];}logger[_0xf026('0xf')]('['+[_0x2d74cd[_0xf026('0x10')]()]+'],\x20getAdminUser\x20crm',_0x2eed05);_0x2ed621(_0x2eed05);})[_0xf026('0x11')](function(_0x2f6c21){logger[_0xf026('0x12')]('['+[_0x2d74cd[_0xf026('0x10')]()]+']',_0x2f6c21[_0xf026('0x13')]);_0x476ed7(_0x2f6c21['message']);});});}function getUser(_0x505c46,_0xcf8a8,_0x5c6d0f,_0x200a8a,_0x307232){return function(_0x1db122){logger[_0xf026('0xf')]('['+[_0x505c46['toUpperCase']()]+_0xf026('0x14'),_0x1db122);return new Promise(function(_0x4a177f,_0x4fcf99){if(intUtil[_0xf026('0x15')](_0x1db122[_0xf026('0x16')])){var _0x12a72e={'method':_0xf026('0x8'),'uri':_0x5c6d0f+_0xf026('0x17')+_0x1db122[_0xf026('0x16')]+'&'+_0x200a8a+'&'+_0x307232,'auth':_0xcf8a8,'json':!![]};logger[_0xf026('0xf')]('['+[_0x505c46[_0xf026('0x10')]()]+_0xf026('0x18'),_0x12a72e);return rp(_0x12a72e)[_0xf026('0xa')](function(_0x51a181){logger[_0xf026('0xf')]('['+[_0x505c46[_0xf026('0x10')]()]+_0xf026('0x19'),_0x51a181);if(_0x51a181[_0xf026('0xb')][_0xf026('0xc')]>0x0&&String(_0x51a181[_0xf026('0xb')][0x0][_0xf026('0x1a')])==='true'){_0x1db122[_0xf026('0x1b')]=_0x51a181[_0xf026('0xb')][0x0][_0xf026('0xe')];}else{_0x1db122['userId']=_0x1db122[_0xf026('0xd')];_0x1db122[_0xf026('0x16')]=_0x1db122[_0xf026('0x1c')];}logger[_0xf026('0xf')]('['+[_0x505c46[_0xf026('0x10')]()]+_0xf026('0x1d'),_0x1db122);_0x4a177f(_0x1db122);})[_0xf026('0x11')](function(_0x4a4166){logger[_0xf026('0x12')]('['+[_0x505c46[_0xf026('0x10')]()]+']',_0x4a4166[_0xf026('0x13')]);_0x4fcf99(_0x4a4166[_0xf026('0x13')]);});}else{logger[_0xf026('0xf')]('['+[_0x505c46[_0xf026('0x10')]()]+']\x20using\x20admin\x20profile');_0x1db122[_0xf026('0x1b')]=_0x1db122[_0xf026('0xd')];_0x1db122['userEmail']=_0x1db122[_0xf026('0x1c')];_0x4a177f(_0x1db122);}});};}function createEndUser(_0x4e8e52,_0x54fe98,_0x3d5dd4,_0x16ada2,_0x2e1a68){logger[_0xf026('0xf')]('['+[_0x4e8e52[_0xf026('0x10')]()]+_0xf026('0x1e'),_0x3d5dd4);return new Promise(function(_0x4b35fc,_0x2317ef){var _0x1277eb={'method':'POST','uri':_0x16ada2+_0xf026('0x1f')+_0x2e1a68,'body':{'user_name':_0x3d5dd4[_0xf026('0x20')],'roles':_0xf026('0x21'),'first_name':_0x3d5dd4[_0xf026('0x20')],'active':_0xf026('0x22'),'date_format':_0xf026('0x23'),'phone':_0x3d5dd4[_0xf026('0x20')]},'auth':_0x54fe98,'json':!![]};return rp(_0x1277eb)[_0xf026('0xa')](function(_0x464eb3){logger['info']('['+[_0x4e8e52[_0xf026('0x10')]()]+'],\x20EndUser\x20schema',_0x464eb3['result']);_0x3d5dd4[_0xf026('0x24')]=_0x464eb3[_0xf026('0xb')][_0xf026('0xe')];_0x4b35fc(_0x3d5dd4);})[_0xf026('0x11')](function(_0x58c48c){logger[_0xf026('0x12')]('['+[_0x4e8e52[_0xf026('0x10')]()]+']',_0x58c48c[_0xf026('0x13')]);_0x2317ef(_0x58c48c['message']);});});}function getEndUser(_0xbbac1,_0xca3510,_0x4f4586,_0x2c7835,_0x5d884f){return function(_0x4350ca){logger[_0xf026('0xf')]('['+[_0xbbac1[_0xf026('0x10')]()]+_0xf026('0x25'),_0x4350ca);return new Promise(function(_0x38e6ac,_0x103b96){var _0x3e9d0e={'method':_0xf026('0x8'),'uri':_0x4f4586+'sys_user?sysparm_query=phone%3D'+_0x4350ca[_0xf026('0x20')]+'&'+_0x2c7835+'&'+_0x5d884f,'auth':_0xca3510,'json':!![]};return rp(_0x3e9d0e)[_0xf026('0xa')](function(_0x1ec2b6){if(_0x1ec2b6[_0xf026('0xb')][_0xf026('0xc')]>0x0){_0x4350ca[_0xf026('0x24')]=_0x1ec2b6['result'][0x0][_0xf026('0xe')];logger[_0xf026('0xf')]('['+[_0xbbac1[_0xf026('0x10')]()]+'],\x20getEndUser\x20crm',_0x4350ca);_0x38e6ac(_0x4350ca);}else{return createEndUser(_0xbbac1,_0xca3510,_0x4350ca,_0x4f4586,_0x2c7835)['then'](function(_0x564533){logger[_0xf026('0xf')]('['+[_0xbbac1['toUpperCase']()]+_0xf026('0x26'),_0x564533);_0x38e6ac(_0x564533);});}})[_0xf026('0x11')](function(_0xd66173){logger[_0xf026('0x12')]('['+[_0xbbac1[_0xf026('0x10')]()]+']',_0xd66173[_0xf026('0x13')]);_0x103b96(_0xd66173[_0xf026('0x13')]);});});};}function getCustomFields(_0x573888,_0x84dfe5){var _0x158878={};if(_0x573888[_0xf026('0xc')]>0x0){_[_0xf026('0x27')](_0x573888,function(_0x4b2b87){if(_[_0xf026('0x28')](['string',_0xf026('0x29')],_0x4b2b87['type'])&&_0x4b2b87[_0xf026('0x2a')]&&!_0x4b2b87['customField']){_0x158878[_0x4b2b87[_0xf026('0x2a')]['toLowerCase']()]=_0x4b2b87[_0xf026('0x2b')]['toString']();}else if(_[_0xf026('0x28')](['string','picklist'],_0x4b2b87['type'])&&_0x4b2b87[_0xf026('0x2c')]&&_0x4b2b87[_0xf026('0x2d')]){_0x158878[_0x4b2b87[_0xf026('0x2c')][_0xf026('0x2e')]()]=_0x4b2b87[_0xf026('0x2b')][_0xf026('0x2f')]();}else if(_0x4b2b87['type']==='variable'&&_0x4b2b87[_0xf026('0x30')]&&_0x4b2b87[_0xf026('0x2c')]&&_0x4b2b87['customField']){_0x158878[_0x4b2b87[_0xf026('0x2c')][_0xf026('0x2e')]()]=_0x84dfe5[_0x4b2b87[_0xf026('0x30')]][_0xf026('0x2f')]();}else if(_0x4b2b87[_0xf026('0x31')]==='customVariable'&&_0x4b2b87['Variable']&&_0x4b2b87['Variable'][_0xf026('0x32')]&&_0x4b2b87[_0xf026('0x2c')]&&_0x4b2b87[_0xf026('0x2d')]){_0x158878[_0x4b2b87[_0xf026('0x2c')][_0xf026('0x2e')]()]=_0x84dfe5[_0x4b2b87[_0xf026('0x33')]['name']['toLowerCase']()][_0xf026('0x2f')]();}});}return _0x158878;}function getTicket(_0x14844d,_0x6b8ec1,_0x39b780,_0x1e27dc,_0x373092,_0x14c66a){return function(_0x1d7a97){logger['info']('['+[_0x14844d[_0xf026('0x10')]()]+_0xf026('0x34'),_0x1d7a97);return new Promise(function(_0x39f6e9,_0x53b5eb){var _0x1fbe52=_0x14844d[_0xf026('0x2e')]()===_0xf026('0x35')?_0x1d7a97['userId']:_0x1d7a97[_0xf026('0x24')];var _0x12ecdc={'method':_0xf026('0x36'),'uri':_0x39b780+_0xf026('0x37')+'?'+_0x14c66a,'body':Object[_0xf026('0x38')]({},{'active':_0xf026('0x22'),'caller_id':_0x1fbe52,'assigned_to':_0x1d7a97[_0xf026('0x1b')],'short_description':intUtil[_0xf026('0x39')](_0x1e27dc[_0xf026('0x3a')],_0x373092,'\x20'),'description':intUtil[_0xf026('0x39')](_0x1e27dc[_0xf026('0x3b')],_0x373092,'\x0a')},getCustomFields(_0x1e27dc[_0xf026('0x3c')],_0x373092)),'auth':_0x6b8ec1,'json':!![]};return rp(_0x12ecdc)['then'](function(_0xa8f1fa){logger[_0xf026('0xf')]('['+[_0x14844d[_0xf026('0x10')]()]+_0xf026('0x3d'),_0xa8f1fa[_0xf026('0xb')]);_0x1d7a97[_0xf026('0x3e')]=_0xa8f1fa[_0xf026('0xb')][_0xf026('0xe')];_0x1d7a97['ticketNumber']=_0xa8f1fa['result']['number'];logger['info']('['+[_0x14844d[_0xf026('0x10')]()]+']\x20getTicket\x20crm',_0x1d7a97);_0x39f6e9(_0x1d7a97);})[_0xf026('0x11')](function(_0xcb2633){logger[_0xf026('0x12')]('['+[_0x14844d['toUpperCase']()]+']',_0xcb2633[_0xf026('0x13')]);_0x53b5eb(_0xcb2633[_0xf026('0x13')]);});});};}function createRemoteTag(_0x466a96,_0x347c81,_0x4646d8,_0x3a518a){return new Promise(function(_0x4dbab2,_0x7eeb5e){var _0x2b9079={'method':'POST','uri':_0x4646d8+'label'+'?'+_0x3a518a,'body':{'short_description':_0x466a96,'global':!![],'active':!![],'name':_0x466a96},'auth':_0x347c81,'json':!![]};return rp(_0x2b9079)[_0xf026('0xa')](function(_0x4e7a96){var _0x5917fc=_0x4e7a96[_0xf026('0xb')][_0xf026('0xe')];_0x4dbab2(_0x5917fc);});});}function getRemoteTag(_0x1daadc,_0x297130,_0x324d21,_0x14649c,_0x369c93){return new Promise(function(_0x13ec06,_0x5894df){var _0x31b361={'method':_0xf026('0x8'),'uri':_0x324d21+_0xf026('0x3f')+_0xf026('0x40')+_0x1daadc+'&'+_0x14649c,'auth':_0x297130,'json':!![]};return rp(_0x31b361)['then'](function(_0x405d30){if(_0x405d30[_0xf026('0xb')][_0xf026('0xc')]>0x0){var _0x2fc929=_0x405d30[_0xf026('0xb')][0x0][_0xf026('0xe')];_0x13ec06(_0x2fc929);}else{return createRemoteTag(_0x1daadc,_0x297130,_0x324d21,_0x14649c)['then'](function(_0x5202f4){_0x13ec06(_0x5202f4);});}});});}function assignTagToIncident(_0x5758d5,_0x5eb303,_0x10925e,_0xa7532a,_0x37c311){return new Promise(function(_0x48c509,_0x4d4228){var _0x375da7={'method':_0xf026('0x36'),'uri':_0x10925e+_0xf026('0x41')+'?'+_0x37c311,'body':{'label':_0x5758d5,'table':_0xf026('0x37'),'id_type':_0xf026('0x42'),'table_key':_0xa7532a[_0xf026('0x3e')],'title':_0xf026('0x43')+_0xa7532a[_0xf026('0x44')],'id_display':_0xa7532a['ticketNumber']},'auth':_0x5eb303,'json':!![]};return rp(_0x375da7)[_0xf026('0xa')](function(_0x57611b){_0x48c509();})['catch'](function(){_0x48c509();});});}function manageTags(_0x472e06,_0x1f701e,_0x1a3e47,_0x19d110,_0x1e9d48,_0x41658a,_0x37c8c0){return new Promise(function(_0x11922b,_0x460815){var _0x5a46ac=[];_0x1f701e['forEach'](function(_0x30b5b4){_0x5a46ac['push'](getRemoteTag(_0x30b5b4,_0x1a3e47,_0x19d110,_0x41658a,_0x37c8c0));});return Promise[_0xf026('0x45')](_0x5a46ac)[_0xf026('0xa')](function(_0x171a4c){if(_0x171a4c[_0xf026('0xc')]){logger[_0xf026('0xf')]('['+[_0x472e06[_0xf026('0x10')]()]+_0xf026('0x46'),_0x171a4c);var _0x311375=[];_0x171a4c[_0xf026('0x27')](function(_0x1366dd){_0x311375[_0xf026('0x47')](assignTagToIncident(_0x1366dd,_0x1a3e47,_0x19d110,_0x1e9d48,_0x41658a));});return Promise[_0xf026('0x45')](_0x311375)[_0xf026('0xa')](function(){_0x11922b();})[_0xf026('0x11')](function(){_0x11922b();});}else{_0x11922b();}});});}function getTags(_0x54e9de,_0x6102b9,_0x15499d,_0xed5a46,_0x34a6c5,_0x3f0686){return function(_0x23eec7){return new Promise(function(_0x48ac29,_0x47b6b7){var _0x3e24cf=[];var _0x304732=_0xed5a46[_0xf026('0x48')];if(_0x304732&&_0x304732[_0xf026('0xc')]>0x0){_0x3e24cf=_['map'](_0x304732,_0xf026('0x32'));}if(_0x3e24cf[_0xf026('0xc')]>0x0){return manageTags(_0x54e9de,_0x3e24cf,_0x6102b9,_0x15499d,_0x23eec7,_0x34a6c5,_0x3f0686)[_0xf026('0xa')](function(){_0x48ac29(_0x23eec7);});}else{_0x48ac29(_0x23eec7);}});};}function emit(_0x13c47a,_0x127bdd,_0x34f16e){var _0x4e0543='%26sysparm_record_target%3Dincident'+_0xf026('0x49')+_0xf026('0x4a')+_0xf026('0x4b');var _0x43405c={'uri':_0x13c47a+_0xf026('0x4c')+_0x34f16e+_0x4e0543};io['to'](util[_0xf026('0x4d')](_0xf026('0x4e'),_0x127bdd))[_0xf026('0x4f')](_0xf026('0x50'),_0x43405c);}exports['cs']=function(_0x1059dc,_0x266271,_0x31ab4a,_0x2b06d4,_0x16ebb1,_0x384bb8,_0x199367,_0x59f2dc){var _0x1cf0d9={};var _0x1ce590={'user':_0x384bb8[_0xf026('0x51')],'pass':_0x384bb8['password']};var _0x2ee590=_0xf026('0x52');var _0x16c99b=_0xf026('0x53');_0x384bb8[_0xf026('0x54')]=intUtil[_0xf026('0x55')](_0x384bb8[_0xf026('0x54')]);_0x384bb8[_0xf026('0x56')]=intUtil[_0xf026('0x55')](_0x384bb8[_0xf026('0x56')]);var _0x69e5c7=util[_0xf026('0x4d')]('%s/api/now/table/',_0x384bb8['remoteUri']);_0x1cf0d9[_0xf026('0x16')]=!_[_0xf026('0x57')](_0x2b06d4)?_0x2b06d4[_0xf026('0x58')]:null;_0x1cf0d9['adminEmail']=_0x384bb8['email'];_0x1cf0d9[_0xf026('0x20')]=_0x59f2dc[_0xf026('0x2e')]()===_0xf026('0x35')?_0x266271[_0xf026('0x59')]:_0x266271[_0xf026('0x5a')];_0x1cf0d9[_0xf026('0x5b')]=_0x59f2dc===_0xf026('0x5c')||_0x59f2dc===_0xf026('0x5d')?_0xf026('0x5c'):_0xf026('0x35');var _0x3f4741=util[_0xf026('0x4d')](_0xf026('0x5e'),_0x384bb8[_0xf026('0x56')],_0x266271['uniqueid'],md5(_0x266271[_0xf026('0x5f')]));if(_0x16ebb1&&_0x16ebb1[_0xf026('0x60')]){logger[_0xf026('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x266271[_0xf026('0x61')]=_0x3f4741;}else if(_0x199367&&_0x199367['recordingFormat']&&_0x199367['recordingFormat']!==_0xf026('0x62')){logger[_0xf026('0xf')]('[OUTBOUND]',_0xf026('0x63'));_0x266271['recordingURL']=_0x3f4741;}else{_0x266271[_0xf026('0x61')]='';}return getAdminUser(_0x59f2dc,_0x1ce590,_0x1cf0d9,_0x69e5c7,_0x16c99b,_0x2ee590)['then'](getUser(_0x59f2dc,_0x1ce590,_0x69e5c7,_0x16c99b,_0x2ee590))['then'](getEndUser(_0x59f2dc,_0x1ce590,_0x69e5c7,_0x16c99b,_0x2ee590))[_0xf026('0xa')](getTicket(_0x59f2dc,_0x1ce590,_0x69e5c7,_0x31ab4a,_0x266271,_0x16c99b))[_0xf026('0xa')](function(_0x41120e){logger[_0xf026('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x41120e[_0xf026('0x3e')]));logger[_0xf026('0xf')](util[_0xf026('0x4d')]('call\x20direction:\x20%s',_0x59f2dc));if(_0x59f2dc!==_0xf026('0x5d')){logger[_0xf026('0xf')]('['+[_0x59f2dc[_0xf026('0x10')]()]+']',_0xf026('0x64'));emit(_0x384bb8[_0xf026('0x54')],_0x2b06d4[_0xf026('0x32')],_0x41120e[_0xf026('0x3e')]);}})[_0xf026('0x11')](function(_0x24a518){logger[_0xf026('0x12')]('['+[_0x59f2dc[_0xf026('0x10')]()]+_0xf026('0x65'),util[_0xf026('0x66')](_0x24a518,{'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 10877fa..86cc38f 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 _0x2146=['recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','lastevent','The\x20User\x20ID\x20is:','Fields','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','emit','info','name','getString','Subjects','created_by','description','slice','duration_hours','duration_minutes','parent_id','Contacts','direction','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','custom_fields','push','content','variable','customVariable','Variable','login','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x2146,0x1da));var _0x6214=function(_0x92b647,_0x3cf1d1){_0x92b647=_0x92b647-0x0;var _0x5f1b4e=_0x2146[_0x92b647];return _0x5f1b4e;};'use strict';var _=require(_0x6214('0x0'));var rp=require(_0x6214('0x1'));var BPromise=require(_0x6214('0x2'));var md5=require(_0x6214('0x3'));var util=require('util');var Redis=require(_0x6214('0x4'));var intUtil=require(_0x6214('0x5'));var config=require(_0x6214('0x6'));var logger=require(_0x6214('0x7'))(_0x6214('0x8'));config[_0x6214('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6214('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x4b6e42,_0x39ae6f,_0xf7bb32){io['to'](_0x4b6e42)[_0x6214('0xb')](_0x39ae6f,_0xf7bb32);}function getTicket(_0x3885d9,_0x7b7474,_0x50df0e,_0x1619cb,_0x195a5b,_0x2e9ea3,_0x29d7b6,_0x43a223){logger[_0x6214('0xc')]('Creating\x20new\x20ticket...');var _0x4724f3=new Date();var _0x354108=[{'name':_0x6214('0xd'),'value':intUtil[_0x6214('0xe')](_0x1619cb[_0x6214('0xf')],_0x195a5b,'\x20')},{'name':'assigned_user_id','value':_0x7b7474['id']},{'name':_0x6214('0x10'),'value':_0x7b7474['id']},{'name':_0x6214('0x11'),'value':intUtil['getString'](_0x1619cb['Descriptions'],_0x195a5b,'\x0a')},{'name':'date_start','value':_0x4724f3['toISOString']()[_0x6214('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0x6214('0x13'),'value':'0'},{'name':_0x6214('0x14'),'value':'15'},{'name':_0x6214('0x15'),'value':_0x50df0e['id']},{'name':'parent_type','value':_0x6214('0x16')},{'name':'parent_name','value':_0x50df0e[_0x6214('0xd')]},{'name':_0x6214('0x17'),'value':_0x43a223}];if(_0x2e9ea3['length']){_['forEach'](_0x2e9ea3,function(_0x342452){if(_0x195a5b[_0x342452[_0x6214('0x18')]]){_0x354108['push']({'name':_0x342452[_0x6214('0x19')],'value':_0x195a5b[_0x342452[_0x6214('0x18')]]});}});}return request({'form':{'method':_0x6214('0x1a'),'input_type':_0x6214('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6214('0x1c')]({'session':_0x29d7b6['id'],'module_name':_0x6214('0x1d'),'name_value_list':_0x354108})}});}function getAuth(_0x7edebb){return util[_0x6214('0x1e')](_0x6214('0x1f'),new Buffer(_0x7edebb['apiKey']+':X')[_0x6214('0x20')](_0x6214('0x21')));}function getServerInfo(_0x239ef6){return request({'form':{'method':_0x6214('0x22'),'input_type':_0x6214('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6214('0x1c')]({'session':_0x239ef6['id']})}});}function getUser(_0x1f2a93,_0x21a114,_0x344d4d){if(!_[_0x6214('0x23')](_0x21a114)){logger[_0x6214('0xc')](_0x6214('0x24'),_0x21a114);return request({'form':{'method':_0x6214('0x25'),'input_type':'JSON','response_type':_0x6214('0x1b'),'rest_data':JSON[_0x6214('0x1c')]({'session':_0x344d4d['id'],'module_name':_0x6214('0x26'),'query':util[_0x6214('0x1e')](_0x6214('0x27'),_0x21a114),'order_by':'','offset':'0','select_fields':['id','name',_0x6214('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6214('0x29')](function(_0x5d6e64){if(_0x5d6e64[_0x6214('0x2a')]['length']){var _0x25ad09=_[_0x6214('0x2b')](_0x5d6e64[_0x6214('0x2a')],function(_0x36ebb0){return _0x36ebb0['name_value_list'][_0x6214('0x28')][_0x6214('0x2c')]===_0x21a114;});if(_0x25ad09){logger[_0x6214('0xc')](_0x6214('0x2d'));return BPromise['resolve']({'id':_0x25ad09['name_value_list']['id'][_0x6214('0x2c')],'name':_0x25ad09[_0x6214('0x2e')]['name']['value']});}}logger[_0x6214('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6214('0x2f')]({'id':_0x344d4d[_0x6214('0x2e')][_0x6214('0x30')][_0x6214('0x2c')],'name':_0x344d4d['name_value_list'][_0x6214('0x28')]['value']});});}else{logger[_0x6214('0xc')](_0x6214('0x31'));return BPromise['resolve']({'id':_0x344d4d[_0x6214('0x2e')][_0x6214('0x30')][_0x6214('0x2c')],'name':_0x344d4d[_0x6214('0x2e')][_0x6214('0x28')][_0x6214('0x2c')]});}}function getEndUser(_0x24d10a,_0x3e7868,_0x1ecfb5,_0x459376){logger['info'](_0x6214('0x32'),_0x1ecfb5);return request({'form':{'method':'get_entry_list','input_type':_0x6214('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6214('0x1c')]({'session':_0x459376['id'],'module_name':_0x6214('0x16'),'query':util[_0x6214('0x1e')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x1ecfb5),'order_by':'','offset':'0','select_fields':['id',_0x6214('0xd'),_0x6214('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5c546e){if(_0x5c546e[_0x6214('0x2a')][_0x6214('0x34')]){var _0x32e7ad=_[_0x6214('0x2b')](_0x5c546e['entry_list'],function(_0x4a7dbb){return _0x4a7dbb['name_value_list']['phone_home'][_0x6214('0x2c')]===_0x1ecfb5;});if(_0x32e7ad){logger[_0x6214('0xc')]('Enduser\x20found!');return BPromise[_0x6214('0x2f')]({'id':_0x32e7ad[_0x6214('0x2e')]['id']['value'],'name':_0x32e7ad[_0x6214('0x2e')][_0x6214('0xd')][_0x6214('0x2c')],'phone':_0x32e7ad[_0x6214('0x2e')]['phone_home']['value']});}}else{logger[_0x6214('0xc')](_0x6214('0x35'));return request({'form':{'method':_0x6214('0x1a'),'input_type':_0x6214('0x1b'),'response_type':_0x6214('0x1b'),'rest_data':JSON['stringify']({'session':_0x459376['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x3e7868!==_0x6214('0x36')?_0x3e7868:util['format'](_0x6214('0x37'),_0x1ecfb5)},{'name':'phone_home','value':_0x1ecfb5}]})}})[_0x6214('0x29')](function(_0x3d24ad){logger[_0x6214('0xc')]('Enduser\x20created.');return BPromise[_0x6214('0x2f')]({'id':_0x3d24ad['id'],'name':_0x3d24ad[_0x6214('0x2a')]['first_name'][_0x6214('0x2c')],'phone':_0x3d24ad[_0x6214('0x2a')][_0x6214('0x33')]['value']});});}});}function request(_0x52fac2){logger['debug'](_0x6214('0x38'),JSON['stringify'](_0x52fac2));return rp(_[_0x6214('0x39')](def,_0x52fac2));}function getTags(_0xc349f3,_0x534cde){var _0x24097a=[];if(_0xc349f3&&_0xc349f3[_0x6214('0x34')]>0x0){_0x24097a=_[_0x6214('0x3a')](_0xc349f3,_0x534cde);}return _0x24097a;}function getCustomFields(_0xea146c,_0x117d20){var _0x34fb92=[];var _0x2a4457={'custom_fields':[]};if(_0xea146c[_0x6214('0x34')]>0x0){_[_0x6214('0x3b')](_0xea146c,function(_0x31b7a6){if(_0x31b7a6[_0x6214('0x3c')]===_0x6214('0x3d')&&_0x31b7a6[_0x6214('0x3e')]&&!_0x31b7a6[_0x6214('0x3f')]){_0x2a4457[_0x31b7a6[_0x6214('0x3e')][_0x6214('0x40')]()]=_0x31b7a6['content']['toString']();}else if(_0x31b7a6[_0x6214('0x3c')]===_0x6214('0x3d')&&_0x31b7a6[_0x6214('0x19')]&&_0x31b7a6[_0x6214('0x3f')]){_0x2a4457[_0x6214('0x41')][_0x6214('0x42')]({'id':_0x31b7a6['idField'],'value':_0x31b7a6[_0x6214('0x43')]['toString']()});}else if(_0x31b7a6[_0x6214('0x3c')]===_0x6214('0x44')&&_0x31b7a6['variableName']&&_0x31b7a6[_0x6214('0x19')]&&_0x31b7a6['customField']){_0x117d20[_0x31b7a6['variableName']]&&_0x2a4457[_0x6214('0x41')][_0x6214('0x42')]({'id':_0x31b7a6['idField'],'value':_0x117d20[_0x31b7a6['variableName']][_0x6214('0x20')]()});}else if(_0x31b7a6[_0x6214('0x3c')]===_0x6214('0x45')&&_0x31b7a6[_0x6214('0x46')]&&_0x31b7a6[_0x6214('0x46')][_0x6214('0xd')]&&_0x31b7a6[_0x6214('0x19')]&&_0x31b7a6[_0x6214('0x3f')]){_0x117d20[_0x31b7a6[_0x6214('0x46')][_0x6214('0xd')][_0x6214('0x40')]()]&&_0x2a4457['custom_fields'][_0x6214('0x42')]({'id':_0x31b7a6[_0x6214('0x19')],'value':_0x117d20[_0x31b7a6[_0x6214('0x46')]['name'][_0x6214('0x40')]()][_0x6214('0x20')]()});}});}return _0x2a4457;}function getConnection(_0x3d21dd){return request({'method':'POST','form':{'method':_0x6214('0x47'),'input_type':_0x6214('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6214('0x1c')]({'user_auth':{'user_name':_0x3d21dd['username'],'password':_0x3d21dd['password'],'encryption':'PLAIN'},'application':_0x6214('0x48')})}})[_0x6214('0x29')](function(_0x2f11d4){var _0x40c12e=_0x2f11d4;if(_0x40c12e['id']){def[_0x6214('0x49')]=_0x40c12e['id'];return BPromise[_0x6214('0x2f')](_0x40c12e);}else{throw new Error(util[_0x6214('0x1e')](_0x6214('0x4a'),_0x3d21dd['id']));}});}function setRelationship(_0x1bdbc8,_0x35aa43,_0x5b8c77,_0x3385ca){return request({'form':{'method':_0x6214('0x4b'),'input_type':_0x6214('0x1b'),'response_type':_0x6214('0x1b'),'rest_data':JSON[_0x6214('0x1c')]({'session':_0x1bdbc8['id'],'module_name':'Calls','module_id':_0x5b8c77['id'],'link_field_name':_0x3385ca,'related_ids':[_0x35aa43['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x46e41c,_0x275875,_0x4bd1d8,_0x391b4b,_0x4a54f6,_0xfb5b33){var _0x49fa94,_0x44915a,_0x465c21,_0x307195;_0xfb5b33[_0x6214('0x4c')]=intUtil['stripTrailingSlash'](_0xfb5b33[_0x6214('0x4c')]);_0xfb5b33[_0x6214('0x4d')]=intUtil[_0x6214('0x4e')](_0xfb5b33[_0x6214('0x4d')]);def['uri']=util[_0x6214('0x1e')](_0x6214('0x4f'),_0xfb5b33[_0x6214('0x4c')]);if(_0x4a54f6&&_0x4a54f6[_0x6214('0x50')]){logger[_0x6214('0xc')](_0x6214('0x51'),_0x6214('0x52'));_0x275875[_0x6214('0x53')]=util[_0x6214('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfb5b33[_0x6214('0x4d')],_0x275875['uniqueid'],md5(_0x275875['uniqueid']));}else{_0x275875['recordingURL']='';}return getConnection(_0xfb5b33)['then'](function(_0x3f9f28){_0x307195=_0x3f9f28;return getUser(_0xfb5b33,_0x391b4b[_0x6214('0xd')],_0x307195);})[_0x6214('0x29')](function(_0x5d7cb7){_0x49fa94=_0x5d7cb7;logger[_0x6214('0xc')]('The\x20User\x20ID\x20is:',_0x49fa94['id']);return getEndUser(_0xfb5b33,_0x275875[_0x6214('0x54')],_0x275875[_0x6214('0x55')],_0x307195);})[_0x6214('0x29')](function(_0x579306){_0x44915a=_0x579306;logger['info'](_0x6214('0x56'),_0x44915a['id']);return getTicket(_0xfb5b33,_0x49fa94,_0x44915a,_0x4bd1d8,_0x275875,_0x4bd1d8['Fields'],_0x307195,_0x6214('0x57'));})[_0x6214('0x29')](function(_0x531315){_0x465c21=_0x531315;logger['info'](_0x6214('0x58'));logger[_0x6214('0xc')]('The\x20Ticket\x20ID\x20is:',_0x465c21['id']);return setRelationship(_0x307195,_0x49fa94,_0x465c21,_0x6214('0x59'));})[_0x6214('0x29')](function(){return setRelationship(_0x307195,_0x44915a,_0x465c21,_0x6214('0x5a'));})[_0x6214('0x29')](function(){return getServerInfo(_0x307195);})[_0x6214('0x29')](function(_0x1189e9){var _0x527829=parseInt(_0x1189e9[_0x6214('0x5b')][_0x6214('0x5c')](0x0));var _0x5cb439=util[_0x6214('0x1e')](_0x6214('0x5d'),_0xfb5b33['remoteUri'],_0x465c21['id']);if(_0x527829>0x6){_0x5cb439=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xfb5b33[_0x6214('0x4c')],_0x465c21['id']);}logger[_0x6214('0xc')]('[QUEUE]',_0x6214('0x5e'));emit(util['format'](_0x6214('0x5f'),_0x391b4b[_0x6214('0xd')]),_0x6214('0x60'),{'uri':_0x5cb439});})[_0x6214('0x61')](function(_0xd05deb){logger[_0x6214('0x62')](_0x6214('0x51'),JSON['stringify'](_0xd05deb));});};exports[_0x6214('0x63')]=function(_0x2e7d7f,_0x1b57a7,_0x38ac74,_0x5e7114,_0x25d176,_0x6c6f5a,_0x5339a0){var _0x1886db,_0x3bc7f0,_0x14eea6,_0x4d69c4;_0x6c6f5a[_0x6214('0x4c')]=intUtil[_0x6214('0x4e')](_0x6c6f5a[_0x6214('0x4c')]);_0x6c6f5a['serverUrl']=intUtil[_0x6214('0x4e')](_0x6c6f5a[_0x6214('0x4d')]);def[_0x6214('0x64')]=util['format'](_0x6214('0x4f'),_0x6c6f5a['remoteUri']);if(_0x5339a0&&_0x5339a0[_0x6214('0x65')]&&_0x5339a0['recordingFormat']!==_0x6214('0x66')){logger['info']('[OUTBOUND]',_0x6214('0x52'));_0x1b57a7[_0x6214('0x53')]=util['format'](_0x6214('0x67'),_0x6c6f5a['serverUrl'],_0x1b57a7[_0x6214('0x68')],md5(_0x1b57a7[_0x6214('0x68')]));}return getConnection(_0x6c6f5a)['then'](function(_0x499e1c){_0x4d69c4=_0x499e1c;return getUser(_0x6c6f5a,_0x5e7114[_0x6214('0xd')],_0x4d69c4);})[_0x6214('0x29')](function(_0x45032d){_0x1886db=_0x45032d;logger[_0x6214('0xc')]('The\x20User\x20ID\x20is:',_0x1886db['id']);return getEndUser(_0x6c6f5a,_0x1b57a7[_0x6214('0x69')],_0x1b57a7[_0x6214('0x6a')],_0x4d69c4);})[_0x6214('0x29')](function(_0x29b16b){_0x3bc7f0=_0x29b16b;logger[_0x6214('0xc')](_0x6214('0x56'),_0x3bc7f0['id']);return getTicket(_0x6c6f5a,_0x1886db,_0x3bc7f0,_0x38ac74,_0x1b57a7,_0x38ac74['Fields'],_0x4d69c4,_0x6214('0x6b'));})[_0x6214('0x29')](function(_0x27357c){_0x14eea6=_0x27357c;logger['info'](_0x6214('0x58'));logger[_0x6214('0xc')](_0x6214('0x6c'),_0x14eea6['id']);return setRelationship(_0x4d69c4,_0x1886db,_0x14eea6,_0x6214('0x59'));})['then'](function(){return setRelationship(_0x4d69c4,_0x3bc7f0,_0x14eea6,_0x6214('0x5a'));})[_0x6214('0x29')](function(){return getServerInfo(_0x4d69c4);})[_0x6214('0x29')](function(_0x3e23d9){var _0x4d5da0=parseInt(_0x3e23d9['version'][_0x6214('0x5c')](0x0));var _0x5e9e27=util[_0x6214('0x1e')](_0x6214('0x5d'),_0x6c6f5a[_0x6214('0x4c')],_0x14eea6['id']);if(_0x4d5da0>0x6){_0x5e9e27=util[_0x6214('0x1e')](_0x6214('0x6d'),_0x6c6f5a['remoteUri'],_0x14eea6['id']);}logger[_0x6214('0xc')](_0x6214('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6214('0x1e')](_0x6214('0x5f'),_0x5e7114[_0x6214('0xd')]),_0x6214('0x60'),{'uri':_0x5e9e27});})['catch'](function(_0x55bf57){logger[_0x6214('0x62')](_0x6214('0x6e'),JSON[_0x6214('0x1c')](_0x55bf57));});};exports['unmanaged']=function(_0xcf7b34,_0x1c0a69,_0x36c118,_0x5ed8c8,_0xf1ebb8,_0x38b7c3){var _0x37b796,_0x515df5,_0x495631,_0x511056;_0x38b7c3[_0x6214('0x4c')]=intUtil[_0x6214('0x4e')](_0x38b7c3[_0x6214('0x4c')]);_0x38b7c3['serverUrl']=intUtil[_0x6214('0x4e')](_0x38b7c3[_0x6214('0x4d')]);def[_0x6214('0x64')]=util[_0x6214('0x1e')](_0x6214('0x4f'),_0x38b7c3[_0x6214('0x4c')]);if(_0xf1ebb8&&_0xf1ebb8['monitor_format']){logger['info']('['+_0x1c0a69[_0x6214('0x6f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1c0a69['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38b7c3[_0x6214('0x4d')],_0x1c0a69[_0x6214('0x68')],md5(_0x1c0a69[_0x6214('0x68')]));}else{_0x1c0a69[_0x6214('0x53')]='';}return getConnection(_0x38b7c3)['then'](function(_0x257975){_0x511056=_0x257975;if(!_['isNil'](_0x5ed8c8)){return getUser(_0x38b7c3,_0x5ed8c8[_0x6214('0xd')],_0x511056);}else{return getUser(_0x38b7c3,null,_0x511056);}})[_0x6214('0x29')](function(_0x51a041){_0x37b796=_0x51a041;logger['info'](_0x6214('0x70'),_0x37b796['id']);return getEndUser(_0x38b7c3,_0x1c0a69['calleridname'],_0x1c0a69[_0x6214('0x55')],_0x511056);})[_0x6214('0x29')](function(_0x242c1b){_0x515df5=_0x242c1b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x515df5['id']);return getTicket(_0x38b7c3,_0x37b796,_0x515df5,_0x36c118,_0x1c0a69,_0x36c118[_0x6214('0x71')],_0x511056,'Inbound');})['then'](function(_0xb90b35){_0x495631=_0xb90b35;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x495631['id']);return setRelationship(_0x511056,_0x37b796,_0x495631,_0x6214('0x59'));})['then'](function(){return setRelationship(_0x511056,_0x515df5,_0x495631,'contacts');})[_0x6214('0x29')](function(){return getServerInfo(_0x511056);})[_0x6214('0x61')](function(_0x59ebb5){logger[_0x6214('0x62')]('['+_0x1c0a69[_0x6214('0x6f')][_0x6214('0x72')]()+']',JSON[_0x6214('0x1c')](_0x59ebb5));});}; \ No newline at end of file +var _0x256e=['parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','info','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','[HTTP]','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','outbound','serverUrl','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','Outbound','user:%s','lastevent','toUpperCase','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x256e,0xd7));var _0xe256=function(_0x2c09cf,_0x3896cf){_0x2c09cf=_0x2c09cf-0x0;var _0x4ffcf7=_0x256e[_0x2c09cf];return _0x4ffcf7;};'use strict';var _=require(_0xe256('0x0'));var rp=require('request-promise');var BPromise=require(_0xe256('0x1'));var md5=require('md5');var util=require(_0xe256('0x2'));var Redis=require(_0xe256('0x3'));var intUtil=require(_0xe256('0x4'));var config=require(_0xe256('0x5'));var logger=require(_0xe256('0x6'))(_0xe256('0x7'));config[_0xe256('0x8')]=_[_0xe256('0x9')](config[_0xe256('0x8')],{'host':_0xe256('0xa'),'port':0x18eb});var io=require(_0xe256('0xb'))(new Redis(config[_0xe256('0x8')]));var def={'method':_0xe256('0xc'),'json':!![]};function emit(_0x2c160f,_0x334ede,_0x1cfd74){io['to'](_0x2c160f)['emit'](_0x334ede,_0x1cfd74);}function getTicket(_0x2002c0,_0x133859,_0x55cefe,_0x4a84a0,_0x1a80c6,_0x36e16c,_0x3d4c10,_0x2b6b43){logger['info'](_0xe256('0xd'));var _0x17db65=new Date();var _0x5812ff=[{'name':_0xe256('0xe'),'value':intUtil[_0xe256('0xf')](_0x4a84a0['Subjects'],_0x1a80c6,'\x20')},{'name':_0xe256('0x10'),'value':_0x133859['id']},{'name':_0xe256('0x11'),'value':_0x133859['id']},{'name':_0xe256('0x12'),'value':intUtil[_0xe256('0xf')](_0x4a84a0['Descriptions'],_0x1a80c6,'\x0a')},{'name':_0xe256('0x13'),'value':_0x17db65[_0xe256('0x14')]()[_0xe256('0x15')](0x0,0x13)[_0xe256('0x16')]('T','\x20')},{'name':_0xe256('0x17'),'value':'0'},{'name':_0xe256('0x18'),'value':'15'},{'name':'parent_id','value':_0x55cefe['id']},{'name':_0xe256('0x19'),'value':_0xe256('0x1a')},{'name':_0xe256('0x1b'),'value':_0x55cefe['name']},{'name':_0xe256('0x1c'),'value':_0x2b6b43}];if(_0x36e16c[_0xe256('0x1d')]){_[_0xe256('0x1e')](_0x36e16c,function(_0x2450fc){if(_0x1a80c6[_0x2450fc[_0xe256('0x1f')]]){_0x5812ff[_0xe256('0x20')]({'name':_0x2450fc[_0xe256('0x21')],'value':_0x1a80c6[_0x2450fc['variableName']]});}});}return request({'form':{'method':_0xe256('0x22'),'input_type':_0xe256('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3d4c10['id'],'module_name':'Calls','name_value_list':_0x5812ff})}});}function getAuth(_0x3f5b54){return util['format'](_0xe256('0x24'),new Buffer(_0x3f5b54[_0xe256('0x25')]+':X')[_0xe256('0x26')]('base64'));}function getServerInfo(_0x337a26){return request({'form':{'method':_0xe256('0x27'),'input_type':_0xe256('0x23'),'response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'session':_0x337a26['id']})}});}function getUser(_0x5b116f,_0x4644bb,_0x55d813){if(!_[_0xe256('0x29')](_0x4644bb)){logger['info'](_0xe256('0x2a'),_0x4644bb);return request({'form':{'method':'get_entry_list','input_type':_0xe256('0x23'),'response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'session':_0x55d813['id'],'module_name':_0xe256('0x2b'),'query':util[_0xe256('0x2c')](_0xe256('0x2d'),_0x4644bb),'order_by':'','offset':'0','select_fields':['id',_0xe256('0xe'),_0xe256('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe256('0x2f')](function(_0x4cab16){if(_0x4cab16[_0xe256('0x30')][_0xe256('0x1d')]){var _0x361254=_[_0xe256('0x31')](_0x4cab16[_0xe256('0x30')],function(_0x4433c8){return _0x4433c8[_0xe256('0x32')]['user_name'][_0xe256('0x33')]===_0x4644bb;});if(_0x361254){logger[_0xe256('0x34')]('Agent\x20found!');return BPromise[_0xe256('0x35')]({'id':_0x361254[_0xe256('0x32')]['id'][_0xe256('0x33')],'name':_0x361254['name_value_list'][_0xe256('0xe')][_0xe256('0x33')]});}}logger['info'](_0xe256('0x36'));return BPromise['resolve']({'id':_0x55d813['name_value_list']['user_id'][_0xe256('0x33')],'name':_0x55d813[_0xe256('0x32')][_0xe256('0x2e')][_0xe256('0x33')]});});}else{logger[_0xe256('0x34')](_0xe256('0x37'));return BPromise[_0xe256('0x35')]({'id':_0x55d813[_0xe256('0x32')][_0xe256('0x38')]['value'],'name':_0x55d813[_0xe256('0x32')][_0xe256('0x2e')]['value']});}}function getEndUser(_0x18a161,_0x584d00,_0x3f80ff,_0x1304e3){logger[_0xe256('0x34')](_0xe256('0x39'),_0x3f80ff);return request({'form':{'method':_0xe256('0x3a'),'input_type':'JSON','response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'session':_0x1304e3['id'],'module_name':_0xe256('0x1a'),'query':util[_0xe256('0x2c')](_0xe256('0x3b'),_0x3f80ff),'order_by':'','offset':'0','select_fields':['id',_0xe256('0xe'),_0xe256('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe256('0x2f')](function(_0x935eaa){if(_0x935eaa[_0xe256('0x30')][_0xe256('0x1d')]){var _0xc1db68=_['find'](_0x935eaa[_0xe256('0x30')],function(_0x32670f){return _0x32670f[_0xe256('0x32')][_0xe256('0x3c')]['value']===_0x3f80ff;});if(_0xc1db68){logger[_0xe256('0x34')](_0xe256('0x3d'));return BPromise[_0xe256('0x35')]({'id':_0xc1db68['name_value_list']['id'][_0xe256('0x33')],'name':_0xc1db68[_0xe256('0x32')][_0xe256('0xe')][_0xe256('0x33')],'phone':_0xc1db68[_0xe256('0x32')][_0xe256('0x3c')]['value']});}}else{logger[_0xe256('0x34')](_0xe256('0x3e'));return request({'form':{'method':_0xe256('0x22'),'input_type':_0xe256('0x23'),'response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'session':_0x1304e3['id'],'module_name':_0xe256('0x1a'),'name_value_list':[{'name':'first_name','value':_0x584d00!==_0xe256('0x3f')?_0x584d00:util['format'](_0xe256('0x40'),_0x3f80ff)},{'name':_0xe256('0x3c'),'value':_0x3f80ff}]})}})[_0xe256('0x2f')](function(_0x391c52){logger['info'](_0xe256('0x41'));return BPromise['resolve']({'id':_0x391c52['id'],'name':_0x391c52['entry_list'][_0xe256('0x42')][_0xe256('0x33')],'phone':_0x391c52[_0xe256('0x30')][_0xe256('0x3c')]['value']});});}});}function request(_0x46f304){logger['debug'](_0xe256('0x43'),JSON['stringify'](_0x46f304));return rp(_['merge'](def,_0x46f304));}function getTags(_0x14635f,_0x28e2f3){var _0x3f1bfa=[];if(_0x14635f&&_0x14635f[_0xe256('0x1d')]>0x0){_0x3f1bfa=_['map'](_0x14635f,_0x28e2f3);}return _0x3f1bfa;}function getCustomFields(_0x3cbca0,_0x2f514c){var _0x425833=[];var _0x237c13={'custom_fields':[]};if(_0x3cbca0[_0xe256('0x1d')]>0x0){_[_0xe256('0x1e')](_0x3cbca0,function(_0x1648d1){if(_0x1648d1[_0xe256('0x44')]===_0xe256('0x45')&&_0x1648d1[_0xe256('0x46')]&&!_0x1648d1[_0xe256('0x47')]){_0x237c13[_0x1648d1[_0xe256('0x46')][_0xe256('0x48')]()]=_0x1648d1[_0xe256('0x49')][_0xe256('0x26')]();}else if(_0x1648d1['type']===_0xe256('0x45')&&_0x1648d1['idField']&&_0x1648d1[_0xe256('0x47')]){_0x237c13['custom_fields'][_0xe256('0x20')]({'id':_0x1648d1[_0xe256('0x21')],'value':_0x1648d1[_0xe256('0x49')]['toString']()});}else if(_0x1648d1[_0xe256('0x44')]===_0xe256('0x4a')&&_0x1648d1['variableName']&&_0x1648d1[_0xe256('0x21')]&&_0x1648d1[_0xe256('0x47')]){_0x2f514c[_0x1648d1[_0xe256('0x1f')]]&&_0x237c13[_0xe256('0x4b')][_0xe256('0x20')]({'id':_0x1648d1['idField'],'value':_0x2f514c[_0x1648d1[_0xe256('0x1f')]][_0xe256('0x26')]()});}else if(_0x1648d1[_0xe256('0x44')]===_0xe256('0x4c')&&_0x1648d1[_0xe256('0x4d')]&&_0x1648d1[_0xe256('0x4d')]['name']&&_0x1648d1[_0xe256('0x21')]&&_0x1648d1[_0xe256('0x47')]){_0x2f514c[_0x1648d1[_0xe256('0x4d')]['name']['toLowerCase']()]&&_0x237c13[_0xe256('0x4b')][_0xe256('0x20')]({'id':_0x1648d1[_0xe256('0x21')],'value':_0x2f514c[_0x1648d1[_0xe256('0x4d')][_0xe256('0xe')][_0xe256('0x48')]()]['toString']()});}});}return _0x237c13;}function getConnection(_0x5632a0){return request({'method':'POST','form':{'method':_0xe256('0x4e'),'input_type':'JSON','response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'user_auth':{'user_name':_0x5632a0['username'],'password':_0x5632a0[_0xe256('0x4f')],'encryption':_0xe256('0x50')},'application':_0xe256('0x51')})}})[_0xe256('0x2f')](function(_0x2bb165){var _0x1c63d7=_0x2bb165;if(_0x1c63d7['id']){def[_0xe256('0x52')]=_0x1c63d7['id'];return BPromise[_0xe256('0x35')](_0x1c63d7);}else{throw new Error(util[_0xe256('0x2c')]('Account\x20%d\x20is\x20not\x20valid',_0x5632a0['id']));}});}function setRelationship(_0x538124,_0x3f0be2,_0x1c282b,_0x5c9261){return request({'form':{'method':_0xe256('0x53'),'input_type':_0xe256('0x23'),'response_type':_0xe256('0x23'),'rest_data':JSON[_0xe256('0x28')]({'session':_0x538124['id'],'module_name':'Calls','module_id':_0x1c282b['id'],'link_field_name':_0x5c9261,'related_ids':[_0x3f0be2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3a638f,_0x2966de,_0x438b56,_0x7e381d,_0x5e4233,_0x2daf77){var _0xc023c2,_0x2ad3c8,_0xa9bbd2,_0x30544a;_0x2daf77[_0xe256('0x54')]=intUtil[_0xe256('0x55')](_0x2daf77['remoteUri']);_0x2daf77['serverUrl']=intUtil[_0xe256('0x55')](_0x2daf77['serverUrl']);def[_0xe256('0x56')]=util[_0xe256('0x2c')]('%s/service/v4_1/rest.php',_0x2daf77['remoteUri']);if(_0x5e4233&&_0x5e4233[_0xe256('0x57')]){logger['info'](_0xe256('0x58'),_0xe256('0x59'));_0x2966de[_0xe256('0x5a')]=util[_0xe256('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2daf77['serverUrl'],_0x2966de[_0xe256('0x5b')],md5(_0x2966de[_0xe256('0x5b')]));}else{_0x2966de[_0xe256('0x5a')]='';}return getConnection(_0x2daf77)['then'](function(_0x4c817a){_0x30544a=_0x4c817a;return getUser(_0x2daf77,_0x7e381d[_0xe256('0xe')],_0x30544a);})[_0xe256('0x2f')](function(_0x2d6c5e){_0xc023c2=_0x2d6c5e;logger['info'](_0xe256('0x5c'),_0xc023c2['id']);return getEndUser(_0x2daf77,_0x2966de['calleridname'],_0x2966de[_0xe256('0x5d')],_0x30544a);})[_0xe256('0x2f')](function(_0x51bdfd){_0x2ad3c8=_0x51bdfd;logger[_0xe256('0x34')](_0xe256('0x5e'),_0x2ad3c8['id']);return getTicket(_0x2daf77,_0xc023c2,_0x2ad3c8,_0x438b56,_0x2966de,_0x438b56['Fields'],_0x30544a,_0xe256('0x5f'));})[_0xe256('0x2f')](function(_0x5a9703){_0xa9bbd2=_0x5a9703;logger[_0xe256('0x34')](_0xe256('0x60'));logger['info'](_0xe256('0x61'),_0xa9bbd2['id']);return setRelationship(_0x30544a,_0xc023c2,_0xa9bbd2,_0xe256('0x62'));})[_0xe256('0x2f')](function(){return setRelationship(_0x30544a,_0x2ad3c8,_0xa9bbd2,_0xe256('0x63'));})['then'](function(){return getServerInfo(_0x30544a);})[_0xe256('0x2f')](function(_0x2050df){var _0x37e674=parseInt(_0x2050df[_0xe256('0x64')][_0xe256('0x65')](0x0));var _0x4bd562=util[_0xe256('0x2c')](_0xe256('0x66'),_0x2daf77[_0xe256('0x54')],_0xa9bbd2['id']);if(_0x37e674>0x6){_0x4bd562=util[_0xe256('0x2c')](_0xe256('0x67'),_0x2daf77['remoteUri'],_0xa9bbd2['id']);}logger['info'](_0xe256('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe256('0x2c')]('user:%s',_0x7e381d['name']),_0xe256('0x68'),{'uri':_0x4bd562});})[_0xe256('0x69')](function(_0x118104){logger[_0xe256('0x6a')](_0xe256('0x58'),JSON['stringify'](_0x118104));});};exports[_0xe256('0x6b')]=function(_0x7614c9,_0x97d2f1,_0x3a87ac,_0x4d50c8,_0x4f9f90,_0x2a33bc,_0x3669ab){var _0x144f12,_0x4f9392,_0xf0481c,_0x4e35b2;_0x2a33bc[_0xe256('0x54')]=intUtil[_0xe256('0x55')](_0x2a33bc[_0xe256('0x54')]);_0x2a33bc['serverUrl']=intUtil[_0xe256('0x55')](_0x2a33bc[_0xe256('0x6c')]);def[_0xe256('0x56')]=util[_0xe256('0x2c')](_0xe256('0x6d'),_0x2a33bc[_0xe256('0x54')]);if(_0x3669ab&&_0x3669ab['recordingFormat']&&_0x3669ab[_0xe256('0x6e')]!==_0xe256('0x6f')){logger[_0xe256('0x34')](_0xe256('0x70'),_0xe256('0x59'));_0x97d2f1[_0xe256('0x5a')]=util[_0xe256('0x2c')](_0xe256('0x71'),_0x2a33bc[_0xe256('0x6c')],_0x97d2f1[_0xe256('0x5b')],md5(_0x97d2f1[_0xe256('0x5b')]));}return getConnection(_0x2a33bc)[_0xe256('0x2f')](function(_0x2fb5a9){_0x4e35b2=_0x2fb5a9;return getUser(_0x2a33bc,_0x4d50c8[_0xe256('0xe')],_0x4e35b2);})['then'](function(_0x59595b){_0x144f12=_0x59595b;logger[_0xe256('0x34')](_0xe256('0x5c'),_0x144f12['id']);return getEndUser(_0x2a33bc,_0x97d2f1[_0xe256('0x72')],_0x97d2f1[_0xe256('0x73')],_0x4e35b2);})[_0xe256('0x2f')](function(_0x33d259){_0x4f9392=_0x33d259;logger[_0xe256('0x34')]('The\x20Enduser\x20ID\x20is:',_0x4f9392['id']);return getTicket(_0x2a33bc,_0x144f12,_0x4f9392,_0x3a87ac,_0x97d2f1,_0x3a87ac[_0xe256('0x74')],_0x4e35b2,_0xe256('0x75'));})[_0xe256('0x2f')](function(_0x3ed9ad){_0xf0481c=_0x3ed9ad;logger[_0xe256('0x34')](_0xe256('0x60'));logger[_0xe256('0x34')]('The\x20Ticket\x20ID\x20is:',_0xf0481c['id']);return setRelationship(_0x4e35b2,_0x144f12,_0xf0481c,_0xe256('0x62'));})[_0xe256('0x2f')](function(){return setRelationship(_0x4e35b2,_0x4f9392,_0xf0481c,_0xe256('0x63'));})['then'](function(){return getServerInfo(_0x4e35b2);})[_0xe256('0x2f')](function(_0x1dbe90){var _0x24d379=parseInt(_0x1dbe90[_0xe256('0x64')][_0xe256('0x65')](0x0));var _0x79fc85=util[_0xe256('0x2c')](_0xe256('0x66'),_0x2a33bc[_0xe256('0x54')],_0xf0481c['id']);if(_0x24d379>0x6){_0x79fc85=util[_0xe256('0x2c')](_0xe256('0x67'),_0x2a33bc[_0xe256('0x54')],_0xf0481c['id']);}logger[_0xe256('0x34')](_0xe256('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe256('0x2c')](_0xe256('0x76'),_0x4d50c8['name']),_0xe256('0x68'),{'uri':_0x79fc85});})[_0xe256('0x69')](function(_0x292fde){logger[_0xe256('0x6a')](_0xe256('0x70'),JSON[_0xe256('0x28')](_0x292fde));});};exports['unmanaged']=function(_0x295da8,_0x235ae4,_0x27a734,_0x277db5,_0x404df5,_0x400910){var _0x18c103,_0x496657,_0x2222f2,_0x1ab8df;_0x400910['remoteUri']=intUtil['stripTrailingSlash'](_0x400910['remoteUri']);_0x400910[_0xe256('0x6c')]=intUtil[_0xe256('0x55')](_0x400910[_0xe256('0x6c')]);def['uri']=util[_0xe256('0x2c')](_0xe256('0x6d'),_0x400910['remoteUri']);if(_0x404df5&&_0x404df5[_0xe256('0x57')]){logger[_0xe256('0x34')]('['+_0x235ae4[_0xe256('0x77')][_0xe256('0x78')]()+']','Recording\x20is\x20enabled!');_0x235ae4[_0xe256('0x5a')]=util[_0xe256('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x400910['serverUrl'],_0x235ae4[_0xe256('0x5b')],md5(_0x235ae4[_0xe256('0x5b')]));}else{_0x235ae4[_0xe256('0x5a')]='';}return getConnection(_0x400910)[_0xe256('0x2f')](function(_0x28040e){_0x1ab8df=_0x28040e;if(!_[_0xe256('0x29')](_0x277db5)){return getUser(_0x400910,_0x277db5['name'],_0x1ab8df);}else{return getUser(_0x400910,null,_0x1ab8df);}})['then'](function(_0x381b84){_0x18c103=_0x381b84;logger[_0xe256('0x34')]('The\x20User\x20ID\x20is:',_0x18c103['id']);return getEndUser(_0x400910,_0x235ae4['calleridname'],_0x235ae4[_0xe256('0x5d')],_0x1ab8df);})[_0xe256('0x2f')](function(_0xea316d){_0x496657=_0xea316d;logger[_0xe256('0x34')](_0xe256('0x5e'),_0x496657['id']);return getTicket(_0x400910,_0x18c103,_0x496657,_0x27a734,_0x235ae4,_0x27a734[_0xe256('0x74')],_0x1ab8df,_0xe256('0x5f'));})['then'](function(_0x1422d7){_0x2222f2=_0x1422d7;logger[_0xe256('0x34')]('Ticket\x20created!');logger[_0xe256('0x34')](_0xe256('0x61'),_0x2222f2['id']);return setRelationship(_0x1ab8df,_0x18c103,_0x2222f2,_0xe256('0x62'));})[_0xe256('0x2f')](function(){return setRelationship(_0x1ab8df,_0x496657,_0x2222f2,_0xe256('0x63'));})[_0xe256('0x2f')](function(){return getServerInfo(_0x1ab8df);})[_0xe256('0x69')](function(_0x357804){logger[_0xe256('0x6a')]('['+_0x235ae4[_0xe256('0x77')][_0xe256('0x78')]()+']',JSON[_0xe256('0x28')](_0x357804));});}; \ 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 f190c54..26a74c9 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 _0x9ae0=['slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','type','push','content','variable','variableName','toString','Variable','name','toLowerCase','string','key','format','%s:\x20%s','keyType','customVariable','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ae0,0x163));var _0x09ae=function(_0x24bfcd,_0x604e0){_0x24bfcd=_0x24bfcd-0x0;var _0x398143=_0x9ae0[_0x24bfcd];return _0x398143;};'use strict';var _=require(_0x09ae('0x0'));var util=require('util');exports[_0x09ae('0x1')]=function(_0x8a4c55,_0x39845c,_0x1ca15e){var _0x4a4080=[];if(_0x8a4c55[_0x09ae('0x2')]>0x0){var _0x42e3a7=_[_0x09ae('0x3')](_0x8a4c55,['id']);for(var _0x4cf36c=0x0;_0x4cf36c<_0x42e3a7[_0x09ae('0x2')];_0x4cf36c++){var _0x178412=_0x42e3a7[_0x4cf36c];if(_0x178412[_0x09ae('0x4')]==='string'){_0x4a4080[_0x09ae('0x5')](_0x178412[_0x09ae('0x6')]);}else if(_0x178412['type']===_0x09ae('0x7')&&_0x178412['variableName']){_0x39845c[_0x178412['variableName']]&&_0x4a4080[_0x09ae('0x5')](_0x39845c[_0x178412[_0x09ae('0x8')]][_0x09ae('0x9')]());}else if(_0x178412['type']==='customVariable'&&_0x178412[_0x09ae('0xa')]&&_0x178412[_0x09ae('0xa')][_0x09ae('0xb')]){_0x39845c[_0x178412[_0x09ae('0xa')]['name'][_0x09ae('0xc')]()]&&_0x4a4080[_0x09ae('0x5')](_0x39845c[_0x178412['Variable'][_0x09ae('0xb')][_0x09ae('0xc')]()][_0x09ae('0x9')]());}else if(_0x178412[_0x09ae('0x4')]==='keyValue'){if(_0x178412['keyType']===_0x09ae('0xd')&&_0x178412[_0x09ae('0xe')]){_0x4a4080[_0x09ae('0x5')](util[_0x09ae('0xf')](_0x09ae('0x10'),_0x178412[_0x09ae('0xe')],_0x178412['keyContent']));}else if(_0x178412[_0x09ae('0x11')]===_0x09ae('0x7')&&_0x178412['variableName']&&_0x178412['key']){_0x39845c[_0x178412['variableName']]&&_0x4a4080[_0x09ae('0x5')](util[_0x09ae('0xf')](_0x09ae('0x10'),_0x178412[_0x09ae('0xe')],_0x39845c[_0x178412[_0x09ae('0x8')]]));}else if(_0x178412['keyType']===_0x09ae('0x12')&&_0x178412[_0x09ae('0xa')]&&_0x178412['Variable'][_0x09ae('0xb')]&&_0x178412[_0x09ae('0xe')]){_0x39845c[_0x178412[_0x09ae('0xa')][_0x09ae('0xb')][_0x09ae('0xc')]()]&&_0x4a4080[_0x09ae('0x5')](util[_0x09ae('0xf')]('%s:\x20%s',_0x178412[_0x09ae('0xe')],_0x39845c[_0x178412[_0x09ae('0xa')]['name'][_0x09ae('0xc')]()]));}}}}return _0x4a4080[_0x09ae('0x13')](_0x1ca15e);};exports['stripTrailingSlash']=function(_0x383aee){var _0x5b57fc=_0x383aee[_0x09ae('0x14')](-0x1);if(_0x5b57fc==='/'){_0x383aee=_0x383aee['substring'](0x0,_0x383aee[_0x09ae('0x15')](_0x5b57fc));}return _0x383aee;};exports[_0x09ae('0x16')]=function(_0x128bba){if(!_[_0x09ae('0x17')](_0x128bba)&&_0x128bba!==''){var _0x1f9f1e=/^(([^<>()\[\]\\.,;:\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 _0x1f9f1e[_0x09ae('0x18')](String(_0x128bba)[_0x09ae('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x3b51=['sortBy','type','push','content','variableName','toString','customVariable','name','toLowerCase','Variable','keyValue','keyType','string','format','key','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x3edee0,_0xb8a912){var _0x4da85d=function(_0x273071){while(--_0x273071){_0x3edee0['push'](_0x3edee0['shift']());}};_0x4da85d(++_0xb8a912);}(_0x3b51,0x176));var _0x13b5=function(_0x4bfbda,_0x332198){_0x4bfbda=_0x4bfbda-0x0;var _0x3811c8=_0x3b51[_0x4bfbda];return _0x3811c8;};'use strict';var _=require(_0x13b5('0x0'));var util=require(_0x13b5('0x1'));exports[_0x13b5('0x2')]=function(_0x3525ab,_0x270be8,_0x210133){var _0x433f53=[];if(_0x3525ab[_0x13b5('0x3')]>0x0){var _0x355ac8=_[_0x13b5('0x4')](_0x3525ab,['id']);for(var _0x283bc3=0x0;_0x283bc3<_0x355ac8[_0x13b5('0x3')];_0x283bc3++){var _0x100ff8=_0x355ac8[_0x283bc3];if(_0x100ff8[_0x13b5('0x5')]==='string'){_0x433f53[_0x13b5('0x6')](_0x100ff8[_0x13b5('0x7')]);}else if(_0x100ff8[_0x13b5('0x5')]==='variable'&&_0x100ff8[_0x13b5('0x8')]){_0x270be8[_0x100ff8[_0x13b5('0x8')]]&&_0x433f53[_0x13b5('0x6')](_0x270be8[_0x100ff8[_0x13b5('0x8')]][_0x13b5('0x9')]());}else if(_0x100ff8[_0x13b5('0x5')]===_0x13b5('0xa')&&_0x100ff8['Variable']&&_0x100ff8['Variable'][_0x13b5('0xb')]){_0x270be8[_0x100ff8['Variable'][_0x13b5('0xb')][_0x13b5('0xc')]()]&&_0x433f53['push'](_0x270be8[_0x100ff8[_0x13b5('0xd')][_0x13b5('0xb')]['toLowerCase']()][_0x13b5('0x9')]());}else if(_0x100ff8[_0x13b5('0x5')]===_0x13b5('0xe')){if(_0x100ff8[_0x13b5('0xf')]===_0x13b5('0x10')&&_0x100ff8['key']){_0x433f53[_0x13b5('0x6')](util[_0x13b5('0x11')]('%s:\x20%s',_0x100ff8[_0x13b5('0x12')],_0x100ff8[_0x13b5('0x13')]));}else if(_0x100ff8[_0x13b5('0xf')]==='variable'&&_0x100ff8['variableName']&&_0x100ff8[_0x13b5('0x12')]){_0x270be8[_0x100ff8[_0x13b5('0x8')]]&&_0x433f53['push'](util['format']('%s:\x20%s',_0x100ff8[_0x13b5('0x12')],_0x270be8[_0x100ff8['variableName']]));}else if(_0x100ff8[_0x13b5('0xf')]==='customVariable'&&_0x100ff8[_0x13b5('0xd')]&&_0x100ff8['Variable'][_0x13b5('0xb')]&&_0x100ff8[_0x13b5('0x12')]){_0x270be8[_0x100ff8['Variable'][_0x13b5('0xb')][_0x13b5('0xc')]()]&&_0x433f53[_0x13b5('0x6')](util['format']('%s:\x20%s',_0x100ff8[_0x13b5('0x12')],_0x270be8[_0x100ff8[_0x13b5('0xd')][_0x13b5('0xb')][_0x13b5('0xc')]()]));}}}}return _0x433f53[_0x13b5('0x14')](_0x210133);};exports[_0x13b5('0x15')]=function(_0x452632){var _0x501331=_0x452632[_0x13b5('0x16')](-0x1);if(_0x501331==='/'){_0x452632=_0x452632['substring'](0x0,_0x452632[_0x13b5('0x17')](_0x501331));}return _0x452632;};exports[_0x13b5('0x18')]=function(_0x4364fc){if(!_[_0x13b5('0x19')](_0x4364fc)&&_0x4364fc!==''){var _0x791a4c=/^(([^<>()\[\]\\.,;:\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 _0x791a4c[_0x13b5('0x1a')](String(_0x4364fc)[_0x13b5('0xc')]());}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 0bdc109..c9db432 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x564567,_0x19a572){var _0xb728f8=function(_0x42a100){while(--_0x42a100){_0x564567['push'](_0x564567['shift']());}};_0xb728f8(++_0x19a572);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3ef124,_0x1f34f9){var _0x8aa83b=function(_0x4329d1){while(--_0x4329d1){_0x3ef124['push'](_0x3ef124['shift']());}};_0x8aa83b(++_0x1f34f9);}(_0xe706,0xa3));var _0x6e70=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xe706[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 a451620..4622d7b 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 _0xf0f5=['../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','%s/tickets.json','remoteUri','POST','merge','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','Basic\x20%s','base64','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','push','variable','variableName','toString','customVariable','Variable','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','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...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','Recording\x20is\x20enabled!','calleridname','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','../../../../config/environment'];(function(_0x23d6fa,_0x2a7531){var _0x23afe1=function(_0x18789e){while(--_0x18789e){_0x23d6fa['push'](_0x23d6fa['shift']());}};_0x23afe1(++_0x2a7531);}(_0xf0f5,0x137));var _0x5f0f=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0xf0f5[_0x43f552];return _0x17911b;};'use strict';var _=require('lodash');var rp=require(_0x5f0f('0x0'));var md5=require(_0x5f0f('0x1'));var util=require(_0x5f0f('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5f0f('0x3'));var logger=require(_0x5f0f('0x4'))('zendesk');config[_0x5f0f('0x5')]=_[_0x5f0f('0x6')](config[_0x5f0f('0x5')],{'host':_0x5f0f('0x7'),'port':0x18eb});var io=require(_0x5f0f('0x8'))(new Redis(config[_0x5f0f('0x5')]));function emit(_0x3546bb,_0x194c79,_0x174b4b){io['to'](_0x3546bb)['emit'](_0x194c79,_0x174b4b);}var headers={'Content-Type':_0x5f0f('0x9'),'Accept':'application/json'};function getTicket(_0x1630ab,_0x513a3a,_0xc259a4,_0x5e1958,_0x58bba1){logger[_0x5f0f('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x5f0f('0xb'),_0x1630ab[_0x5f0f('0xc')]),'method':_0x5f0f('0xd'),'body':{'ticket':_[_0x5f0f('0xe')]({'requester_id':_0xc259a4['id'],'submitter_id':_0x513a3a?_0x513a3a['id']:undefined,'assignee_id':_0x513a3a?_0x513a3a['id']:undefined,'tags':getTags(_0x5e1958['Tags'],_0x5f0f('0xf')),'subject':intUtil[_0x5f0f('0x10')](_0x5e1958['Subjects'],_0x58bba1,'\x20'),'description':intUtil[_0x5f0f('0x10')](_0x5e1958[_0x5f0f('0x11')],_0x58bba1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5f0f('0x10')](_0x5e1958[_0x5f0f('0x11')],_0x58bba1,'\x0a')}},getCustomFields(_0x5e1958[_0x5f0f('0x12')],_0x58bba1))}})[_0x5f0f('0x13')](function(_0x35d02a){logger[_0x5f0f('0xa')](_0x5f0f('0x14'));return _0x35d02a[_0x5f0f('0x15')];});}function getUser(_0x4fe8c6,_0x43ecf3){if(intUtil[_0x5f0f('0x16')](_0x43ecf3)){logger[_0x5f0f('0xa')](_0x5f0f('0x17'),_0x43ecf3);return request({'uri':util['format']('%s/search.json',_0x4fe8c6[_0x5f0f('0xc')]),'qs':{'query':util['format'](_0x5f0f('0x18'),_0x43ecf3)}})[_0x5f0f('0x13')](function(_0x24c4b8){if(_0x24c4b8[_0x5f0f('0x19')]){logger[_0x5f0f('0xa')](_0x5f0f('0x1a'));return _[_0x5f0f('0x1b')](_0x24c4b8['results'],{'email':_0x43ecf3,'role':'agent'});}else{logger[_0x5f0f('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x5f0f('0x1c'),_0x4fe8c6[_0x5f0f('0xc')])})['then'](function(_0x357651){logger[_0x5f0f('0xa')]('Admin\x20account\x20selected.');return _0x357651[_0x5f0f('0x1d')];});}});}else{logger[_0x5f0f('0xa')](_0x5f0f('0x1e'));return request({'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x1c'),_0x4fe8c6['remoteUri'])})[_0x5f0f('0x13')](function(_0x1c2364){logger[_0x5f0f('0xa')]('Admin\x20account\x20selected.');return _0x1c2364[_0x5f0f('0x1d')];});}}function getEndUser(_0xe5e6a7,_0xb1e53f,_0x4b4ccc){logger[_0x5f0f('0xa')](_0x5f0f('0x20'),_0x4b4ccc);return request({'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x21'),_0xe5e6a7[_0x5f0f('0xc')]),'qs':{'query':util[_0x5f0f('0x1f')](_0x5f0f('0x22'),_0x4b4ccc)}})[_0x5f0f('0x13')](function(_0x42a926){var _0x49bd5b;if(_0x42a926[_0x5f0f('0x23')][_0x5f0f('0x24')]){_0x42a926[_0x5f0f('0x23')]=_[_0x5f0f('0x25')](_0x42a926['results'],{'suspended':![],'role':'end-user'});if(_0x42a926[_0x5f0f('0x23')][_0x5f0f('0x24')]){_0x49bd5b=_['first'](_0x42a926[_0x5f0f('0x23')]);}}if(_0x49bd5b){logger['info']('Enduser\x20found!');return _0x49bd5b;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x26'),_0xe5e6a7['remoteUri']),'method':'POST','body':{'user':{'role':_0x5f0f('0x27'),'name':util[_0x5f0f('0x1f')](_0x5f0f('0x28'),_0xb1e53f||_0x4b4ccc),'phone':_0x4b4ccc}}})[_0x5f0f('0x13')](function(_0x5d72ad){logger[_0x5f0f('0xa')](_0x5f0f('0x29'));return _0x5d72ad[_0x5f0f('0x1d')];});}});}function getAuth(_0x54baa3){var _0xa9d01;if(_0x54baa3[_0x5f0f('0x2a')]==='password'){_0xa9d01=util[_0x5f0f('0x1f')](_0x5f0f('0x2b'),_0x54baa3[_0x5f0f('0x2c')],_0x54baa3['password']);}else if(_0x54baa3['authType']===_0x5f0f('0x2d')){_0xa9d01=util[_0x5f0f('0x1f')]('%s/token:%s',_0x54baa3[_0x5f0f('0x2c')],_0x54baa3[_0x5f0f('0x2d')]);}return util[_0x5f0f('0x1f')](_0x5f0f('0x2e'),new Buffer(_0xa9d01)['toString'](_0x5f0f('0x2f')));}function request(_0x2b8e5a){logger['debug'](_0x5f0f('0x30'),JSON[_0x5f0f('0x31')](_0x2b8e5a));return rp(_['defaults'](_0x2b8e5a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x535b6a,_0x19bcda){var _0x51fc2d=[];if(_0x535b6a&&_0x535b6a['length']>0x0){_0x51fc2d=_[_0x5f0f('0x32')](_0x535b6a,_0x19bcda);}return _0x51fc2d;}function getCustomFields(_0x140057,_0x3f718a){var _0x5b62d3=[];var _0x2ebac8={'custom_fields':[]};if(_0x140057[_0x5f0f('0x24')]>0x0){_[_0x5f0f('0x33')](_0x140057,function(_0x7a91b0){if(_['includes']([_0x5f0f('0x34'),_0x5f0f('0x35')],_0x7a91b0[_0x5f0f('0x36')])&&_0x7a91b0[_0x5f0f('0x37')]&&!_0x7a91b0[_0x5f0f('0x38')]){_0x2ebac8[_0x7a91b0[_0x5f0f('0x37')][_0x5f0f('0x39')]()]=_0x7a91b0[_0x5f0f('0x3a')]['toString']();}else if(_[_0x5f0f('0x3b')]([_0x5f0f('0x34'),'picklist'],_0x7a91b0[_0x5f0f('0x36')])&&_0x7a91b0[_0x5f0f('0x3c')]&&_0x7a91b0[_0x5f0f('0x38')]){_0x2ebac8[_0x5f0f('0x3d')][_0x5f0f('0x3e')]({'id':_0x7a91b0[_0x5f0f('0x3c')],'value':_0x7a91b0[_0x5f0f('0x3a')]['toString']()});}else if(_0x7a91b0[_0x5f0f('0x36')]===_0x5f0f('0x3f')&&_0x7a91b0[_0x5f0f('0x40')]&&_0x7a91b0['idField']&&_0x7a91b0[_0x5f0f('0x38')]){_0x3f718a[_0x7a91b0[_0x5f0f('0x40')]]&&_0x2ebac8['custom_fields'][_0x5f0f('0x3e')]({'id':_0x7a91b0[_0x5f0f('0x3c')],'value':_0x3f718a[_0x7a91b0['variableName']][_0x5f0f('0x41')]()});}else if(_0x7a91b0[_0x5f0f('0x36')]===_0x5f0f('0x42')&&_0x7a91b0[_0x5f0f('0x43')]&&_0x7a91b0[_0x5f0f('0x43')][_0x5f0f('0xf')]&&_0x7a91b0[_0x5f0f('0x3c')]&&_0x7a91b0[_0x5f0f('0x38')]){_0x3f718a[_0x7a91b0[_0x5f0f('0x43')][_0x5f0f('0xf')]['toLowerCase']()]&&_0x2ebac8['custom_fields'][_0x5f0f('0x3e')]({'id':_0x7a91b0[_0x5f0f('0x3c')],'value':_0x3f718a[_0x7a91b0[_0x5f0f('0x43')][_0x5f0f('0xf')][_0x5f0f('0x39')]()][_0x5f0f('0x41')]()});}});}return _0x2ebac8;}exports['queue']=function(_0x10daaf,_0x27b6c7,_0x31c571,_0x2d5212,_0x348367,_0x25c5f6){var _0x22ca8c,_0x4a2aea;_0x25c5f6[_0x5f0f('0xc')]=intUtil['stripTrailingSlash'](_0x25c5f6[_0x5f0f('0xc')]);_0x25c5f6[_0x5f0f('0x44')]=intUtil[_0x5f0f('0x45')](_0x25c5f6[_0x5f0f('0x44')]);if(_0x348367&&_0x348367['monitor_format']){logger['info'](_0x5f0f('0x46'),'Recording\x20is\x20enabled!');_0x27b6c7[_0x5f0f('0x47')]=util[_0x5f0f('0x1f')](_0x5f0f('0x48'),_0x25c5f6[_0x5f0f('0x44')],_0x27b6c7['uniqueid'],md5(_0x27b6c7['uniqueid']));}else{_0x27b6c7[_0x5f0f('0x47')]='';}headers[_0x5f0f('0x49')]=getAuth(_0x25c5f6);return getUser(_0x25c5f6,_0x2d5212[_0x5f0f('0x4a')])[_0x5f0f('0x13')](function(_0xff61c6){_0x22ca8c=_0xff61c6;logger[_0x5f0f('0xa')](_0x5f0f('0x4b'),_0x22ca8c['id']);return getEndUser(_0x25c5f6,_0x27b6c7['calleridname'],_0x27b6c7['calleridnum']);})[_0x5f0f('0x13')](function(_0x196c40){_0x4a2aea=_0x196c40;logger[_0x5f0f('0xa')](_0x5f0f('0x4c'),_0x4a2aea['id']);return getTicket(_0x25c5f6,_0x22ca8c,_0x4a2aea,_0x31c571,_0x27b6c7);})[_0x5f0f('0x13')](function(_0x687ce2){if(_0x687ce2){logger[_0x5f0f('0xa')](_0x5f0f('0x4d'),_0x687ce2['id']);switch(_0x25c5f6[_0x5f0f('0x36')]){case _0x5f0f('0x4e'):logger['info']('[QUEUE]',_0x5f0f('0x4f'));return request({'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x50'),_0x25c5f6['remoteUri'],_0x22ca8c['id'],_0x687ce2['id']),'method':_0x5f0f('0xd')});case _0x5f0f('0x51'):logger['info'](_0x5f0f('0x46'),_0x5f0f('0x52'));emit(util[_0x5f0f('0x1f')]('user:%s',_0x2d5212['name']),_0x5f0f('0x53'),{'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x54'),_0x25c5f6[_0x5f0f('0xc')]['replace'](_0x5f0f('0x55'),''),_0x687ce2['id'])});break;default:logger['error'](_0x5f0f('0x46'),_0x5f0f('0x56'));}}})[_0x5f0f('0x57')](function(_0x33cf49){logger[_0x5f0f('0x58')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x33cf49,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x520539,_0x432059,_0x2838d2,_0x1a127c,_0x632cbf,_0x5a5545,_0xb0f793){var _0x4ff1b2,_0x514ded;_0x5a5545[_0x5f0f('0xc')]=intUtil[_0x5f0f('0x45')](_0x5a5545[_0x5f0f('0xc')]);_0x5a5545[_0x5f0f('0x44')]=intUtil[_0x5f0f('0x45')](_0x5a5545[_0x5f0f('0x44')]);if(_0xb0f793&&_0xb0f793[_0x5f0f('0x59')]&&_0xb0f793['recordingFormat']!==_0x5f0f('0x5a')){logger[_0x5f0f('0xa')](_0x5f0f('0x5b'),'Recording\x20is\x20enabled!');_0x432059[_0x5f0f('0x47')]=util[_0x5f0f('0x1f')](_0x5f0f('0x48'),_0x5a5545[_0x5f0f('0x44')],_0x432059[_0x5f0f('0x5c')],md5(_0x432059['uniqueid']));}headers[_0x5f0f('0x49')]=getAuth(_0x5a5545);return getUser(_0x5a5545,_0x1a127c[_0x5f0f('0x4a')])['then'](function(_0x4c4744){_0x4ff1b2=_0x4c4744;logger[_0x5f0f('0xa')]('The\x20User\x20ID\x20is:',_0x4ff1b2['id']);return getEndUser(_0x5a5545,_0x432059[_0x5f0f('0x5d')],_0x432059[_0x5f0f('0x5e')]);})[_0x5f0f('0x13')](function(_0x41570a){_0x514ded=_0x41570a;logger[_0x5f0f('0xa')]('The\x20Enduser\x20ID\x20is:',_0x514ded['id']);return getTicket(_0x5a5545,_0x4ff1b2,_0x514ded,_0x2838d2,_0x432059);})[_0x5f0f('0x13')](function(_0x57e954){if(_0x57e954){logger[_0x5f0f('0xa')](_0x5f0f('0x4d'),_0x57e954['id']);switch(_0x5a5545[_0x5f0f('0x36')]){case'integrationTab':logger[_0x5f0f('0xa')](_0x5f0f('0x5b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x50'),_0x5a5545[_0x5f0f('0xc')],_0x4ff1b2['id'],_0x57e954['id']),'method':'POST'});case _0x5f0f('0x51'):logger[_0x5f0f('0xa')](_0x5f0f('0x5b'),_0x5f0f('0x52'));emit(util[_0x5f0f('0x1f')]('user:%s',_0x1a127c['name']),_0x5f0f('0x53'),{'uri':util[_0x5f0f('0x1f')](_0x5f0f('0x54'),_0x5a5545[_0x5f0f('0xc')][_0x5f0f('0x5f')](_0x5f0f('0x55'),''),_0x57e954['id'])});break;default:logger[_0x5f0f('0x58')](_0x5f0f('0x5b'),_0x5f0f('0x56'));}}})[_0x5f0f('0x57')](function(_0x3a2116){logger[_0x5f0f('0x58')](_0x5f0f('0x60'),util[_0x5f0f('0x61')](_0x3a2116,{'showHidden':!![],'depth':null}));});};exports[_0x5f0f('0x62')]=function(_0x2fb6cc,_0x133719,_0x3f2dc7,_0x356abc,_0x47792c,_0x180ab9){var _0xad5b86,_0x21f44c;_0x180ab9[_0x5f0f('0xc')]=intUtil[_0x5f0f('0x45')](_0x180ab9[_0x5f0f('0xc')]);_0x180ab9['serverUrl']=intUtil['stripTrailingSlash'](_0x180ab9[_0x5f0f('0x44')]);if(_0x47792c&&_0x47792c['monitor_format']){logger[_0x5f0f('0xa')]('['+_0x133719[_0x5f0f('0x63')]['toUpperCase']()+']',_0x5f0f('0x64'));_0x133719['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x180ab9[_0x5f0f('0x44')],_0x133719['uniqueid'],md5(_0x133719['uniqueid']));}else{_0x133719[_0x5f0f('0x47')]='';}headers[_0x5f0f('0x49')]=getAuth(_0x180ab9);return getUser(_0x180ab9)[_0x5f0f('0x13')](function(_0x1da2d3){_0xad5b86=_0x1da2d3;logger[_0x5f0f('0xa')](_0x5f0f('0x4b'),_0xad5b86['id']);return getEndUser(_0x180ab9,_0x133719[_0x5f0f('0x65')],_0x133719[_0x5f0f('0x66')]);})[_0x5f0f('0x13')](function(_0x59133f){_0x21f44c=_0x59133f;logger[_0x5f0f('0xa')](_0x5f0f('0x4c'),_0x21f44c['id']);return getTicket(_0x180ab9,_0xad5b86,_0x21f44c,_0x3f2dc7,_0x133719);})[_0x5f0f('0x13')](function(_0xdd9e7d){if(_0xdd9e7d){logger['info'](_0x5f0f('0x4d'),_0xdd9e7d['id']);}})['catch'](function(_0x2adc91){logger['error']('['+_0x133719[_0x5f0f('0x63')][_0x5f0f('0x67')]()+']'+_0x5f0f('0x68'),util[_0x5f0f('0x61')](_0x2adc91,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x007d=['type','nameField','customField','toLowerCase','picklist','idField','custom_fields','content','variableName','push','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\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','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','uniqueid','email','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','inspect','unmanaged','lastevent','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','authType','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','[HTTP]','stringify','GET','map','includes','string'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x007d,0x1f3));var _0xd007=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x007d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd007('0x0'));var rp=require('request-promise');var md5=require(_0xd007('0x1'));var util=require('util');var Redis=require(_0xd007('0x2'));var intUtil=require(_0xd007('0x3'));var config=require(_0xd007('0x4'));var logger=require(_0xd007('0x5'))(_0xd007('0x6'));config[_0xd007('0x7')]=_[_0xd007('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd007('0x9'))(new Redis(config[_0xd007('0x7')]));function emit(_0x1b1cd9,_0x258d47,_0x3d52c6){io['to'](_0x1b1cd9)[_0xd007('0xa')](_0x258d47,_0x3d52c6);}var headers={'Content-Type':_0xd007('0xb'),'Accept':_0xd007('0xb')};function getTicket(_0x147c22,_0x2c07d7,_0x46ad0c,_0x1d67a0,_0x1e350a){logger[_0xd007('0xc')](_0xd007('0xd'));return request({'uri':util[_0xd007('0xe')](_0xd007('0xf'),_0x147c22['remoteUri']),'method':'POST','body':{'ticket':_[_0xd007('0x10')]({'requester_id':_0x46ad0c['id'],'submitter_id':_0x2c07d7?_0x2c07d7['id']:undefined,'assignee_id':_0x2c07d7?_0x2c07d7['id']:undefined,'tags':getTags(_0x1d67a0[_0xd007('0x11')],_0xd007('0x12')),'subject':intUtil['getString'](_0x1d67a0[_0xd007('0x13')],_0x1e350a,'\x20'),'description':intUtil[_0xd007('0x14')](_0x1d67a0[_0xd007('0x15')],_0x1e350a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd007('0x14')](_0x1d67a0[_0xd007('0x15')],_0x1e350a,'\x0a')}},getCustomFields(_0x1d67a0[_0xd007('0x16')],_0x1e350a))}})[_0xd007('0x17')](function(_0x225fdd){logger[_0xd007('0xc')](_0xd007('0x18'));return _0x225fdd[_0xd007('0x19')];});}function getUser(_0x2f5e70,_0x5dd3e5){if(intUtil[_0xd007('0x1a')](_0x5dd3e5)){logger[_0xd007('0xc')](_0xd007('0x1b'),_0x5dd3e5);return request({'uri':util[_0xd007('0xe')](_0xd007('0x1c'),_0x2f5e70[_0xd007('0x1d')]),'qs':{'query':util[_0xd007('0xe')](_0xd007('0x1e'),_0x5dd3e5)}})[_0xd007('0x17')](function(_0x321ecc){if(_0x321ecc[_0xd007('0x1f')]){logger[_0xd007('0xc')]('Agent\x20found!');return _[_0xd007('0x20')](_0x321ecc[_0xd007('0x21')],{'email':_0x5dd3e5,'role':'agent'});}else{logger[_0xd007('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd007('0xe')](_0xd007('0x22'),_0x2f5e70[_0xd007('0x1d')])})[_0xd007('0x17')](function(_0x1ffdb3){logger[_0xd007('0xc')](_0xd007('0x23'));return _0x1ffdb3[_0xd007('0x24')];});}});}else{logger['info'](_0xd007('0x25'));return request({'uri':util[_0xd007('0xe')]('%s/users/me.json',_0x2f5e70[_0xd007('0x1d')])})[_0xd007('0x17')](function(_0x1453ef){logger[_0xd007('0xc')]('Admin\x20account\x20selected.');return _0x1453ef[_0xd007('0x24')];});}}function getEndUser(_0x2affe5,_0x2f5861,_0x5b1393){logger[_0xd007('0xc')](_0xd007('0x26'),_0x5b1393);return request({'uri':util[_0xd007('0xe')](_0xd007('0x1c'),_0x2affe5['remoteUri']),'qs':{'query':util[_0xd007('0xe')](_0xd007('0x27'),_0x5b1393)}})[_0xd007('0x17')](function(_0xde723e){var _0x35ba5e;if(_0xde723e[_0xd007('0x21')][_0xd007('0x28')]){_0xde723e[_0xd007('0x21')]=_[_0xd007('0x29')](_0xde723e[_0xd007('0x21')],{'suspended':![],'role':_0xd007('0x2a')});if(_0xde723e[_0xd007('0x21')][_0xd007('0x28')]){_0x35ba5e=_['first'](_0xde723e['results']);}}if(_0x35ba5e){logger[_0xd007('0xc')](_0xd007('0x2b'));return _0x35ba5e;}else{logger[_0xd007('0xc')](_0xd007('0x2c'));return request({'uri':util[_0xd007('0xe')](_0xd007('0x2d'),_0x2affe5[_0xd007('0x1d')]),'method':_0xd007('0x2e'),'body':{'user':{'role':_0xd007('0x2a'),'name':util[_0xd007('0xe')](_0xd007('0x2f'),_0x2f5861||_0x5b1393),'phone':_0x5b1393}}})[_0xd007('0x17')](function(_0x1742f1){logger[_0xd007('0xc')]('Enduser\x20created.');return _0x1742f1[_0xd007('0x24')];});}});}function getAuth(_0x1bb53d){var _0x9774df;if(_0x1bb53d[_0xd007('0x30')]==='password'){_0x9774df=util['format'](_0xd007('0x31'),_0x1bb53d['username'],_0x1bb53d['password']);}else if(_0x1bb53d[_0xd007('0x30')]===_0xd007('0x32')){_0x9774df=util[_0xd007('0xe')](_0xd007('0x33'),_0x1bb53d[_0xd007('0x34')],_0x1bb53d[_0xd007('0x32')]);}return util['format'](_0xd007('0x35'),new Buffer(_0x9774df)[_0xd007('0x36')]('base64'));}function request(_0x2989ba){logger['debug'](_0xd007('0x37'),JSON[_0xd007('0x38')](_0x2989ba));return rp(_[_0xd007('0x8')](_0x2989ba,{'method':_0xd007('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x145233,_0x2dba8b){var _0xc9d30e=[];if(_0x145233&&_0x145233[_0xd007('0x28')]>0x0){_0xc9d30e=_[_0xd007('0x3a')](_0x145233,_0x2dba8b);}return _0xc9d30e;}function getCustomFields(_0x5377ef,_0x3ab839){var _0x53e8ec=[];var _0x3dbc7b={'custom_fields':[]};if(_0x5377ef[_0xd007('0x28')]>0x0){_['forEach'](_0x5377ef,function(_0xc54727){if(_[_0xd007('0x3b')]([_0xd007('0x3c'),'picklist'],_0xc54727[_0xd007('0x3d')])&&_0xc54727[_0xd007('0x3e')]&&!_0xc54727[_0xd007('0x3f')]){_0x3dbc7b[_0xc54727[_0xd007('0x3e')][_0xd007('0x40')]()]=_0xc54727['content'][_0xd007('0x36')]();}else if(_['includes']([_0xd007('0x3c'),_0xd007('0x41')],_0xc54727[_0xd007('0x3d')])&&_0xc54727[_0xd007('0x42')]&&_0xc54727[_0xd007('0x3f')]){_0x3dbc7b[_0xd007('0x43')]['push']({'id':_0xc54727[_0xd007('0x42')],'value':_0xc54727[_0xd007('0x44')][_0xd007('0x36')]()});}else if(_0xc54727[_0xd007('0x3d')]==='variable'&&_0xc54727[_0xd007('0x45')]&&_0xc54727['idField']&&_0xc54727[_0xd007('0x3f')]){_0x3ab839[_0xc54727[_0xd007('0x45')]]&&_0x3dbc7b['custom_fields'][_0xd007('0x46')]({'id':_0xc54727[_0xd007('0x42')],'value':_0x3ab839[_0xc54727['variableName']][_0xd007('0x36')]()});}else if(_0xc54727[_0xd007('0x3d')]===_0xd007('0x47')&&_0xc54727[_0xd007('0x48')]&&_0xc54727[_0xd007('0x48')]['name']&&_0xc54727[_0xd007('0x42')]&&_0xc54727[_0xd007('0x3f')]){_0x3ab839[_0xc54727[_0xd007('0x48')][_0xd007('0x12')][_0xd007('0x40')]()]&&_0x3dbc7b[_0xd007('0x43')]['push']({'id':_0xc54727[_0xd007('0x42')],'value':_0x3ab839[_0xc54727[_0xd007('0x48')]['name'][_0xd007('0x40')]()][_0xd007('0x36')]()});}});}return _0x3dbc7b;}exports[_0xd007('0x49')]=function(_0x1613d4,_0x4c22cf,_0x29a455,_0x3662fa,_0x100aa2,_0x410d16){var _0x28551b,_0x1b821b;_0x410d16[_0xd007('0x1d')]=intUtil['stripTrailingSlash'](_0x410d16[_0xd007('0x1d')]);_0x410d16[_0xd007('0x4a')]=intUtil[_0xd007('0x4b')](_0x410d16[_0xd007('0x4a')]);if(_0x100aa2&&_0x100aa2[_0xd007('0x4c')]){logger[_0xd007('0xc')](_0xd007('0x4d'),_0xd007('0x4e'));_0x4c22cf[_0xd007('0x4f')]=util[_0xd007('0xe')](_0xd007('0x50'),_0x410d16[_0xd007('0x4a')],_0x4c22cf['uniqueid'],md5(_0x4c22cf['uniqueid']));}else{_0x4c22cf[_0xd007('0x4f')]='';}headers[_0xd007('0x51')]=getAuth(_0x410d16);return getUser(_0x410d16,_0x3662fa['email'])['then'](function(_0x17ebaf){_0x28551b=_0x17ebaf;logger['info'](_0xd007('0x52'),_0x28551b['id']);return getEndUser(_0x410d16,_0x4c22cf[_0xd007('0x53')],_0x4c22cf['calleridnum']);})['then'](function(_0x433266){_0x1b821b=_0x433266;logger[_0xd007('0xc')](_0xd007('0x54'),_0x1b821b['id']);return getTicket(_0x410d16,_0x28551b,_0x1b821b,_0x29a455,_0x4c22cf);})[_0xd007('0x17')](function(_0x23e210){if(_0x23e210){logger['info']('The\x20Ticket\x20ID\x20is:',_0x23e210['id']);switch(_0x410d16[_0xd007('0x3d')]){case _0xd007('0x55'):logger[_0xd007('0xc')](_0xd007('0x4d'),_0xd007('0x56'));return request({'uri':util[_0xd007('0xe')](_0xd007('0x57'),_0x410d16[_0xd007('0x1d')],_0x28551b['id'],_0x23e210['id']),'method':_0xd007('0x2e')});case _0xd007('0x58'):logger[_0xd007('0xc')](_0xd007('0x4d'),_0xd007('0x59'));emit(util[_0xd007('0xe')](_0xd007('0x5a'),_0x3662fa['name']),_0xd007('0x5b'),{'uri':util[_0xd007('0xe')](_0xd007('0x5c'),_0x410d16[_0xd007('0x1d')][_0xd007('0x5d')](_0xd007('0x5e'),''),_0x23e210['id'])});break;default:logger[_0xd007('0x5f')](_0xd007('0x4d'),_0xd007('0x60'));}}})[_0xd007('0x61')](function(_0x2ef73d){logger[_0xd007('0x5f')](_0xd007('0x62'),util['inspect'](_0x2ef73d,{'showHidden':!![],'depth':null}));});};exports[_0xd007('0x63')]=function(_0x55df28,_0x3368a1,_0x9f3a26,_0x5a4721,_0x4d300e,_0x164b3c,_0x2269fc){var _0x279f22,_0x429cd8;_0x164b3c['remoteUri']=intUtil[_0xd007('0x4b')](_0x164b3c['remoteUri']);_0x164b3c[_0xd007('0x4a')]=intUtil[_0xd007('0x4b')](_0x164b3c[_0xd007('0x4a')]);if(_0x2269fc&&_0x2269fc['recordingFormat']&&_0x2269fc[_0xd007('0x64')]!==_0xd007('0x65')){logger[_0xd007('0xc')]('[OUTBOUND]',_0xd007('0x4e'));_0x3368a1['recordingURL']=util[_0xd007('0xe')](_0xd007('0x50'),_0x164b3c[_0xd007('0x4a')],_0x3368a1[_0xd007('0x66')],md5(_0x3368a1[_0xd007('0x66')]));}headers['Authorization']=getAuth(_0x164b3c);return getUser(_0x164b3c,_0x5a4721[_0xd007('0x67')])['then'](function(_0x35c139){_0x279f22=_0x35c139;logger[_0xd007('0xc')](_0xd007('0x52'),_0x279f22['id']);return getEndUser(_0x164b3c,_0x3368a1[_0xd007('0x68')],_0x3368a1['destcalleridnum']);})[_0xd007('0x17')](function(_0x4be9b0){_0x429cd8=_0x4be9b0;logger['info'](_0xd007('0x54'),_0x429cd8['id']);return getTicket(_0x164b3c,_0x279f22,_0x429cd8,_0x9f3a26,_0x3368a1);})['then'](function(_0x8bbe8e){if(_0x8bbe8e){logger[_0xd007('0xc')](_0xd007('0x69'),_0x8bbe8e['id']);switch(_0x164b3c[_0xd007('0x3d')]){case _0xd007('0x55'):logger[_0xd007('0xc')](_0xd007('0x6a'),_0xd007('0x56'));return request({'uri':util[_0xd007('0xe')](_0xd007('0x57'),_0x164b3c[_0xd007('0x1d')],_0x279f22['id'],_0x8bbe8e['id']),'method':_0xd007('0x2e')});case _0xd007('0x58'):logger[_0xd007('0xc')](_0xd007('0x6a'),_0xd007('0x59'));emit(util[_0xd007('0xe')]('user:%s',_0x5a4721[_0xd007('0x12')]),_0xd007('0x5b'),{'uri':util[_0xd007('0xe')](_0xd007('0x5c'),_0x164b3c[_0xd007('0x1d')]['replace'](_0xd007('0x5e'),''),_0x8bbe8e['id'])});break;default:logger[_0xd007('0x5f')](_0xd007('0x6a'),_0xd007('0x60'));}}})['catch'](function(_0x5ca74e){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd007('0x6b')](_0x5ca74e,{'showHidden':!![],'depth':null}));});};exports[_0xd007('0x6c')]=function(_0x4d1dc6,_0x681636,_0x11adda,_0x113f85,_0x153de8,_0x2e95d0){var _0x3b6e3d,_0x255e2b;_0x2e95d0[_0xd007('0x1d')]=intUtil[_0xd007('0x4b')](_0x2e95d0[_0xd007('0x1d')]);_0x2e95d0['serverUrl']=intUtil[_0xd007('0x4b')](_0x2e95d0[_0xd007('0x4a')]);if(_0x153de8&&_0x153de8[_0xd007('0x4c')]){logger['info']('['+_0x681636[_0xd007('0x6d')]['toUpperCase']()+']',_0xd007('0x4e'));_0x681636[_0xd007('0x4f')]=util[_0xd007('0xe')](_0xd007('0x50'),_0x2e95d0['serverUrl'],_0x681636[_0xd007('0x66')],md5(_0x681636[_0xd007('0x66')]));}else{_0x681636['recordingURL']='';}headers['Authorization']=getAuth(_0x2e95d0);return getUser(_0x2e95d0)[_0xd007('0x17')](function(_0x45622e){_0x3b6e3d=_0x45622e;logger['info'](_0xd007('0x52'),_0x3b6e3d['id']);return getEndUser(_0x2e95d0,_0x681636[_0xd007('0x53')],_0x681636[_0xd007('0x6e')]);})[_0xd007('0x17')](function(_0x11a36d){_0x255e2b=_0x11a36d;logger[_0xd007('0xc')](_0xd007('0x54'),_0x255e2b['id']);return getTicket(_0x2e95d0,_0x3b6e3d,_0x255e2b,_0x11adda,_0x681636);})[_0xd007('0x17')](function(_0x3f3094){if(_0x3f3094){logger[_0xd007('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3f3094['id']);}})[_0xd007('0x61')](function(_0x2dbf20){logger[_0xd007('0x5f')]('['+_0x681636['lastevent']['toUpperCase']()+']'+_0xd007('0x6f'),util[_0xd007('0x6b')](_0x2dbf20,{'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 6bac1f3..7145ea2 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 _0xb575=['lead','administrator','Subject','getString','Subjects','Description','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Outbound','unmanaged','toUpperCase','lodash','request-promise','util','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','Zoho-oauthtoken\x20','code','SUCCESS','data','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xb575,0xda));var _0x5b57=function(_0xf2d4f5,_0x3a05ae){_0xf2d4f5=_0xf2d4f5-0x0;var _0x25e4fa=_0xb575[_0xf2d4f5];return _0x25e4fa;};'use strict';var _=require(_0x5b57('0x0'));var rp=require(_0x5b57('0x1'));var md5=require('md5');var util=require(_0x5b57('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x5b57('0x3'));var config=require(_0x5b57('0x4'));var logger=require('../../../../config/logger')(_0x5b57('0x5'));config[_0x5b57('0x6')]=_[_0x5b57('0x7')](config[_0x5b57('0x6')],{'host':_0x5b57('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b57('0x6')]));function emit(_0x5dd0c7,_0x2f9789,_0xa9166b){io['to'](_0x5dd0c7)[_0x5b57('0x9')](_0x2f9789,_0xa9166b);}function request(_0x49ce3a){logger[_0x5b57('0xa')](_0x5b57('0xb'),JSON[_0x5b57('0xc')](_0x49ce3a));return rp(_0x49ce3a);}function getCustomFields(_0x566a8d,_0x342e70){var _0x375daf={};if(_0x566a8d['length']>0x0){_['forEach'](_0x566a8d,function(_0x502e0e){if(_[_0x5b57('0xd')]([_0x5b57('0xe'),_0x5b57('0xf')],_0x502e0e[_0x5b57('0x10')])&&_0x502e0e[_0x5b57('0x11')]){_0x375daf[_0x502e0e[_0x5b57('0x11')]]=_0x502e0e[_0x5b57('0x12')][_0x5b57('0x13')]();}else if(_0x502e0e[_0x5b57('0x10')]==='variable'&&_0x502e0e[_0x5b57('0x14')]&&_0x502e0e[_0x5b57('0x11')]&&_0x342e70[_0x502e0e[_0x5b57('0x14')]]){_0x375daf[_0x502e0e['idField']]=_0x342e70[_0x502e0e[_0x5b57('0x14')]][_0x5b57('0x13')]();}else if(_0x502e0e[_0x5b57('0x10')]===_0x5b57('0x15')&&_0x502e0e[_0x5b57('0x16')]&&_0x502e0e[_0x5b57('0x16')][_0x5b57('0x17')]&&_0x502e0e[_0x5b57('0x11')]&&_0x342e70[_0x502e0e['Variable'][_0x5b57('0x17')][_0x5b57('0x18')]()]){_0x375daf[_0x502e0e[_0x5b57('0x11')]]=_0x342e70[_0x502e0e[_0x5b57('0x16')][_0x5b57('0x17')][_0x5b57('0x18')]()]['toString']();}});}return _0x375daf;}function getName(_0x2fc33d){if(_0x2fc33d[_0x5b57('0x19')]('\x20')>0x0){var _0x41df30=_0x2fc33d[_0x5b57('0x1a')](/ (.+)/);if(_0x41df30[0x1]){return _0x41df30;}}return[_0x2fc33d,_0x2fc33d];}var accountsTokens={};function getAccessToken(_0x53378c){return new Promise(function(_0x3c7f4f,_0x2dfaae){if(!_[_0x5b57('0x1b')](accountsTokens[_0x53378c['id']])&&!_['isNil'](accountsTokens[_0x53378c['id']][_0x5b57('0x1c')])){if(moment()[_0x5b57('0x1d')](accountsTokens[_0x53378c['id']][_0x5b57('0x1e')])){_0x3c7f4f(accountsTokens[_0x53378c['id']][_0x5b57('0x1c')]);}}var _0x429146;switch(_0x53378c[_0x5b57('0x1f')]){case'US':_0x429146='https://accounts.zoho.com';break;case'AU':_0x429146=_0x5b57('0x20');break;case'EU':_0x429146='https://accounts.zoho.eu';break;case'IN':_0x429146=_0x5b57('0x21');break;case'CN':_0x429146=_0x5b57('0x22');break;default:_0x429146='https://accounts.zoho.eu';break;}var _0x52e4b0={'method':_0x5b57('0x23'),'uri':_0x429146+'/oauth/v2/token','qs':{'refresh_token':_0x53378c[_0x5b57('0x24')],'client_id':_0x53378c[_0x5b57('0x25')],'client_secret':_0x53378c[_0x5b57('0x26')],'grant_type':_0x5b57('0x27')},'json':!![]};return rp(_0x52e4b0)[_0x5b57('0x28')](function(_0x17ac8b){accountsTokens[_0x53378c['id']]={'access_token':_0x17ac8b[_0x5b57('0x1c')],'expires_in':moment()[_0x5b57('0x29')](_0x17ac8b[_0x5b57('0x1e')],_0x5b57('0x2a'))};_0x3c7f4f(_0x17ac8b[_0x5b57('0x1c')]);})[_0x5b57('0x2b')](function(_0x511a00){logger[_0x5b57('0x2c')](_0x5b57('0x2d'),_0x511a00[_0x5b57('0x2e')]);_0x2dfaae(_0x511a00);});});}function getUser(_0x3e8bc6,_0x4da4a8,_0x42b276,_0x5e21a1){logger[_0x5b57('0x2f')](_0x5b57('0x30'));return request({'method':_0x5b57('0x31'),'uri':util[_0x5b57('0x32')](_0x5b57('0x33'),_0x4da4a8),'qs':{'type':_0x5b57('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e8bc6},'json':!![]})[_0x5b57('0x28')](function(_0x28bb84){if(_0x28bb84[_0x5b57('0x35')]){var _0x3336da=-0x1;if(_[_0x5b57('0x36')](_0x28bb84['users'])){if(!_[_0x5b57('0x1b')](_0x5e21a1)){_0x3336da=_['findIndex'](_0x28bb84[_0x5b57('0x35')],function(_0x4f3598){return _0x4f3598[_0x5b57('0x37')]===_0x5e21a1;});}if(_0x3336da>=0x0){logger[_0x5b57('0x2f')](_0x5b57('0x38'));}else{logger[_0x5b57('0x2f')](_0x5b57('0x39'));_0x3336da=_[_0x5b57('0x3a')](_0x28bb84[_0x5b57('0x35')],function(_0x27ed21){return _0x27ed21[_0x5b57('0x3b')][_0x5b57('0x17')]==='Administrator';});}return _0x28bb84[_0x5b57('0x35')][_0x3336da];}else{if(_0x28bb84[_0x5b57('0x3c')][_0x5b57('0x3b')][_0x5b57('0x17')]===_0x5b57('0x3d')){logger[_0x5b57('0x2f')](_0x5b57('0x39'));user=_0x28bb84[_0x5b57('0x3c')];return user;}else{logger[_0x5b57('0x2c')](_0x5b57('0x3e'),JSON[_0x5b57('0xc')](_0x28bb84));throw new Error(_0x5b57('0x3f')+JSON[_0x5b57('0xc')](_0x28bb84));}}}else{logger[_0x5b57('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5b57('0xc')](_0x28bb84));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5b57('0xc')](_0x28bb84));}})[_0x5b57('0x2b')](function(_0x1973f4){console[_0x5b57('0x2c')](_0x1973f4);});}function getZohoUser(_0x6e1f94,_0x14a728){return new BPromise(function(_0xc2052d,_0x4ea7d6){request(_0x6e1f94)[_0x5b57('0x28')](function(_0x1ec1dc){var _0x28c59b=null;if(_0x1ec1dc){_0x28c59b=_0x1ec1dc['data'][0x0];_0x28c59b[_0x5b57('0x40')]=_0x14a728;}_0xc2052d(_0x28c59b);})[_0x5b57('0x2b')](function(_0x5eea89){_0x4ea7d6(_0x5eea89);});});}function createEndUser(_0x33d7fd,_0x11db96,_0xa417ce,_0x568f36,_0x5631f1,_0x88eb0d){var _0xa417ce=getName(_0xa417ce);return request({'method':'POST','uri':_0x5b57('0x41')+_0x11db96+'/crm/v2/'+_[_0x5b57('0x42')](_0x88eb0d[_0x5b57('0x43')])+'s','body':{'data':[{'Last_Name':_0xa417ce[0x1],'First_Name':_0xa417ce[0x0],'Phone':_0x568f36,'Owner':{'name':!_['isNil'](_0x5631f1[_0x5b57('0x44')][_0x5b57('0x17')])?_0x5631f1[_0x5b57('0x44')][_0x5b57('0x17')]:!_[_0x5b57('0x1b')](_0x5631f1[_0x5b57('0x45')])?_0x5631f1[_0x5b57('0x45')]+'\x20'+_0x5631f1['last_name']:_0x5631f1['last_name'],'id':_0x5631f1['id']}}]},'headers':{'Authorization':_0x5b57('0x46')+_0x33d7fd},'json':!![]})['then'](function(_0x19dc27){if(_0x19dc27&&_0x19dc27['data'][0x0][_0x5b57('0x47')]===_0x5b57('0x48')){var _0x30a53a=_0x19dc27[_0x5b57('0x49')][0x0][_0x5b57('0x4a')];_0x30a53a[_0x5b57('0x40')]=_[_0x5b57('0x42')](_0x88eb0d[_0x5b57('0x43')])+'s';return _0x30a53a;}logger[_0x5b57('0x2c')](_0x5b57('0x3e'),JSON[_0x5b57('0xc')](data));throw new Error(_0x5b57('0x4b')+JSON[_0x5b57('0xc')](data));})[_0x5b57('0x2b')](function(_0xa7048d){console[_0x5b57('0x4c')](_0x5b57('0x4d'),_0xa7048d);});}function getEndUser(_0x1d8674,_0x30bde9,_0x56dcb1,_0x3d50ef,_0x20560c,_0x123212,_0x53e698){var _0x212947={'method':_0x5b57('0x31'),'uri':'','headers':{'Authorization':_0x5b57('0x46')+_0x1d8674},'json':!![]};switch(_0x53e698[_0x5b57('0x4e')]){case'contact_lead':_0x212947['uri']='https://www.zohoapis.'+_0x30bde9+_0x5b57('0x4f')+_0x20560c+'))';return getZohoUser(_0x212947,_0x5b57('0x50'))['then'](function(_0x1866a9){if(_0x1866a9)return _0x1866a9;_0x212947[_0x5b57('0x51')]=_0x5b57('0x41')+_0x30bde9+_0x5b57('0x52')+_0x20560c+'))';return getZohoUser(_0x212947,_0x5b57('0x53'))[_0x5b57('0x28')](function(_0x22ea65){if(_0x22ea65)return _0x22ea65;if(_0x53e698[_0x5b57('0x43')]!=_0x5b57('0x54')){return createEndUser(_0x1d8674,_0x30bde9,_0x3d50ef,_0x20560c,_0x123212,_0x53e698);}else{return{};}});});break;case _0x5b57('0x55'):_0x212947[_0x5b57('0x51')]=_0x5b57('0x41')+_0x30bde9+_0x5b57('0x4f')+_0x20560c+'))';return getZohoUser(_0x212947,_0x5b57('0x50'))[_0x5b57('0x28')](function(_0x3e32f5){if(_0x3e32f5)return _0x3e32f5;if(_0x53e698[_0x5b57('0x43')]!=_0x5b57('0x54')){return createEndUser(_0x1d8674,_0x30bde9,_0x3d50ef,_0x20560c,_0x123212,_0x53e698);}else{return{};}});break;case _0x5b57('0x56'):_0x212947[_0x5b57('0x51')]=_0x5b57('0x41')+_0x30bde9+_0x5b57('0x52')+_0x20560c+'))';return getZohoUser(_0x212947,'Leads')['then'](function(_0x42013c){if(_0x42013c)return _0x42013c;if(_0x53e698['moduleCreate']!=_0x5b57('0x54')){return createEndUser(_0x1d8674,_0x30bde9,_0x3d50ef,_0x20560c,_0x123212,_0x53e698);}else{return{};}});break;}}function getCall(_0x4e54f9,_0x9ad4eb,_0x302176,_0x3087b7,_0x4fabac,_0x4ebca6,_0x5304c1,_0x56597c){logger[_0x5b57('0x2f')]('Creating\x20new\x20call...');var _0x4f8d97={};_0x4f8d97['Owner']={'name':!_[_0x5b57('0x1b')](_0x3087b7[_0x5b57('0x44')][_0x5b57('0x17')])&&!_[_0x5b57('0x1b')](_0x3087b7[_0x5b57('0x3b')][_0x5b57('0x17')])&&_0x3087b7['profile'][_0x5b57('0x17')]===_0x5b57('0x57')?_0x3087b7['role'][_0x5b57('0x17')]:!_[_0x5b57('0x1b')](_0x3087b7[_0x5b57('0x45')])?_0x3087b7[_0x5b57('0x45')]+'\x20'+_0x3087b7['last_name']:_0x3087b7['last_name'],'id':_0x3087b7['id']};_0x4f8d97[_0x5b57('0x58')]=intUtil[_0x5b57('0x59')](_0x4ebca6[_0x5b57('0x5a')],_0x5304c1,'\x20');_0x4f8d97[_0x5b57('0x5b')]=intUtil[_0x5b57('0x59')](_0x4ebca6['Descriptions'],_0x5304c1,'\x0a');if(_0x4fabac['enduserType']===_0x5b57('0x50')){_0x4f8d97[_0x5b57('0x5c')]={'name':!_[_0x5b57('0x1b')](_0x4fabac['Full_Name'])?_0x4fabac['Full_Name']:!_['isNil'](_0x4fabac['First_Name'])?_0x4fabac[_0x5b57('0x5d')]+'\x20'+_0x4fabac[_0x5b57('0x5e')]:_0x4fabac[_0x5b57('0x5e')],'id':_0x4fabac['id']};}if(_0x4fabac[_0x5b57('0x40')]===_0x5b57('0x53')){_0x4f8d97[_0x5b57('0x5f')]={'name':!_[_0x5b57('0x1b')](_0x4fabac[_0x5b57('0x60')])?_0x4fabac['Full_Name']:!_[_0x5b57('0x1b')](_0x4fabac[_0x5b57('0x5d')])?_0x4fabac[_0x5b57('0x5d')]+'\x20'+_0x4fabac[_0x5b57('0x5e')]:_0x4fabac['Last_Name'],'id':_0x4fabac['id']};_0x4f8d97[_0x5b57('0x61')]=_['startCase'](_0x4fabac[_0x5b57('0x40')]);}if(_0x5304c1[_0x5b57('0x62')]){_0x4f8d97['Call_Duration']=moment[_0x5b57('0x63')](parseInt(_0x5304c1['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x5304c1[_0x5b57('0x64')]&&_0x5304c1['endtime']){_0x4f8d97[_0x5b57('0x65')]=moment[_0x5b57('0x63')](moment(_0x5304c1[_0x5b57('0x66')],_0x5b57('0x67'))[_0x5b57('0x68')](moment(_0x5304c1[_0x5b57('0x69')],_0x5b57('0x67'))))[_0x5b57('0x32')]('mm:ss');}switch(_0x5304c1[_0x5b57('0x6a')]){case _0x5b57('0x6b'):_0x4f8d97[_0x5b57('0x6c')]=_0x5b57('0x6d');break;case'complete':case _0x5b57('0x6e'):_0x4f8d97[_0x5b57('0x6c')]='Answered';break;case'rejected':_0x4f8d97[_0x5b57('0x6c')]=_0x5b57('0x6f');break;case _0x5b57('0x70'):_0x4f8d97[_0x5b57('0x6c')]=_0x5b57('0x71');break;case _0x5b57('0x72'):_0x4f8d97['Call_Result']=_0x5b57('0x73');default:}_0x4f8d97[_0x5b57('0x74')]=(_0x56597c===_0x5b57('0x75')?moment(_0x5304c1[_0x5b57('0x69')])['format'](_0x5b57('0x67')):moment(_0x5304c1[_0x5b57('0x76')])['format'](_0x5b57('0x67')))||moment()[_0x5b57('0x32')](_0x5b57('0x67'));_0x4f8d97['Call_Type']=_0x56597c||_0x5b57('0x77');_0x4f8d97=_[_0x5b57('0x78')](_0x4f8d97,getCustomFields(_0x4ebca6[_0x5b57('0x79')],_0x5304c1));return request({'method':_0x5b57('0x23'),'uri':'https://www.zohoapis.'+_0x9ad4eb+_0x5b57('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4e54f9},'body':{'data':[_0x4f8d97]},'json':!![]})[_0x5b57('0x28')](function(_0x4e3051){if(_0x4e3051&&_0x4e3051['data'][0x0][_0x5b57('0x47')]===_0x5b57('0x48')){logger[_0x5b57('0x2f')]('Call\x20created!');return{'id':_0x4e3051[_0x5b57('0x49')][0x0][_0x5b57('0x4a')]['id']};}})[_0x5b57('0x2b')](function(_0x8ccc32){logger['info'](_0x5b57('0x7b'),_0x8ccc32['stack']);console['log'](_0x5b57('0x7b'),_0x8ccc32);});}exports[_0x5b57('0x7c')]=function(_0x59d443,_0x2f89ee,_0x57053d,_0x5c5bf3,_0xdb45d3,_0x584b9e){var _0x4b0caa,_0x4acc9a,_0x2d7434;_0x584b9e[_0x5b57('0x7d')]=intUtil[_0x5b57('0x7e')](_0x584b9e[_0x5b57('0x7d')]);_0x584b9e[_0x5b57('0x7f')]=intUtil[_0x5b57('0x7e')](_0x584b9e[_0x5b57('0x7f')]);if(_0xdb45d3&&_0xdb45d3[_0x5b57('0x80')]){logger[_0x5b57('0x2f')]('[QUEUE]',_0x5b57('0x81'));_0x2f89ee[_0x5b57('0x82')]=_0x584b9e[_0x5b57('0x7f')]+_0x5b57('0x83')+_0x2f89ee[_0x5b57('0x84')]+_0x5b57('0x85')+md5(_0x2f89ee['uniqueid']);}else{_0x2f89ee[_0x5b57('0x82')]='';}var _0x46d8a1=_0x584b9e[_0x5b57('0x7d')]===_0x5b57('0x86')?'eu':_0x5b57('0x87');return getAccessToken(_0x584b9e)[_0x5b57('0x28')](function(_0x34a2f3){_0x2d7434=_0x34a2f3;return getUser(_0x2d7434,_0x46d8a1,_0x584b9e,_0x5c5bf3[_0x5b57('0x37')]);})[_0x5b57('0x28')](function(_0x230af3){_0x4b0caa=_0x230af3;logger[_0x5b57('0x2f')](_0x5b57('0x88'),_0x4b0caa['id']);return getEndUser(_0x2d7434,_0x46d8a1,_0x584b9e,_0x2f89ee[_0x5b57('0x89')],_0x2f89ee[_0x5b57('0x8a')],_0x4b0caa,_0x57053d);})[_0x5b57('0x28')](function(_0x5ce8ff){_0x4acc9a=_0x5ce8ff;return getCall(_0x2d7434,_0x46d8a1,_0x584b9e,_0x4b0caa,_0x4acc9a,_0x57053d,_0x2f89ee,_0x5b57('0x77'));})[_0x5b57('0x28')](function(_0x15f8ec){if(_0x15f8ec){logger[_0x5b57('0x2f')](_0x5b57('0x8b'),_0x15f8ec['id']);logger[_0x5b57('0x2f')](_0x5b57('0x8c'),_0x5b57('0x8d'));emit(util[_0x5b57('0x32')](_0x5b57('0x8e'),_0x5c5bf3[_0x5b57('0x17')]),_0x5b57('0x8f'),{'uri':_0x5b57('0x90')+_0x584b9e[_0x5b57('0x7d')]+_0x5b57('0x91')+_0x15f8ec['id']});}})[_0x5b57('0x2b')](function(_0x5e13f8){logger[_0x5b57('0x2c')](_0x5b57('0x8c'),JSON[_0x5b57('0xc')](_0x5e13f8));});};exports[_0x5b57('0x75')]=function(_0x3371a3,_0x29ea78,_0x20cac4,_0x64f5bd,_0x3834bc,_0x1a2b78,_0x79114){var _0xf7a7a0,_0x21a67f,_0x43be6d;_0x1a2b78[_0x5b57('0x7d')]=intUtil['stripTrailingSlash'](_0x1a2b78[_0x5b57('0x7d')]);_0x1a2b78[_0x5b57('0x7f')]=intUtil['stripTrailingSlash'](_0x1a2b78['serverUrl']);if(_0x79114&&_0x79114['recordingFormat']&&_0x79114[_0x5b57('0x92')]!==_0x5b57('0x93')){logger[_0x5b57('0x2f')](_0x5b57('0x94'),_0x5b57('0x81'));_0x29ea78[_0x5b57('0x82')]=_0x1a2b78[_0x5b57('0x7f')]+_0x5b57('0x83')+_0x29ea78['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x29ea78[_0x5b57('0x84')]);}var _0x305233=_0x1a2b78[_0x5b57('0x7d')]===_0x5b57('0x86')?'eu':_0x5b57('0x87');return getAccessToken(_0x1a2b78)[_0x5b57('0x28')](function(_0x291a02){_0x43be6d=_0x291a02;return getUser(_0x43be6d,_0x305233,_0x1a2b78,_0x64f5bd['email']);})[_0x5b57('0x28')](function(_0x26808a){_0xf7a7a0=_0x26808a;logger[_0x5b57('0x2f')](_0x5b57('0x88'),_0xf7a7a0['id']);return getEndUser(_0x43be6d,_0x305233,_0x1a2b78,_0x29ea78['destcalleridname'],_0x29ea78['destcalleridnum'],_0xf7a7a0,_0x20cac4);})['then'](function(_0x5c1455){_0x21a67f=_0x5c1455;return getCall(_0x43be6d,_0x305233,_0x1a2b78,_0xf7a7a0,_0x21a67f,_0x20cac4,_0x29ea78,_0x5b57('0x95'));})[_0x5b57('0x28')](function(_0x378122){if(_0x378122){logger[_0x5b57('0x2f')](_0x5b57('0x8b'),_0x378122['id']);logger[_0x5b57('0x2f')](_0x5b57('0x94'),_0x5b57('0x8d'));emit(util[_0x5b57('0x32')](_0x5b57('0x8e'),_0x64f5bd[_0x5b57('0x17')]),_0x5b57('0x8f'),{'uri':_0x5b57('0x90')+_0x1a2b78[_0x5b57('0x7d')]+_0x5b57('0x91')+_0x378122['id']});}})[_0x5b57('0x2b')](function(_0x2d1e3c){logger[_0x5b57('0x2c')](_0x5b57('0x94'),JSON['stringify'](_0x2d1e3c));});};exports[_0x5b57('0x96')]=function(_0x3ee489,_0x4e5f99,_0x3dbd06,_0x446ef3,_0x39a955,_0x4ce92a){var _0x2261c2,_0x8435a7,_0x3da69f;_0x4ce92a[_0x5b57('0x7d')]=intUtil[_0x5b57('0x7e')](_0x4ce92a[_0x5b57('0x7d')]);_0x4ce92a[_0x5b57('0x7f')]=intUtil[_0x5b57('0x7e')](_0x4ce92a[_0x5b57('0x7f')]);if(_0x39a955&&_0x39a955[_0x5b57('0x80')]){logger[_0x5b57('0x2f')]('['+_0x4e5f99[_0x5b57('0x6a')][_0x5b57('0x97')]()+']','Recording\x20is\x20enabled!');_0x4e5f99[_0x5b57('0x82')]=_0x4ce92a[_0x5b57('0x7f')]+_0x5b57('0x83')+_0x4e5f99['uniqueid']+_0x5b57('0x85')+md5(_0x4e5f99[_0x5b57('0x84')]);}else{_0x4e5f99['recordingURL']='';}var _0x2d30fe=_0x4ce92a[_0x5b57('0x7d')]===_0x5b57('0x86')?'eu':_0x5b57('0x87');return getAccessToken(_0x4ce92a)[_0x5b57('0x28')](function(_0x4afb7a){_0x3da69f=_0x4afb7a;return getUser(_0x3da69f,_0x2d30fe,_0x4ce92a);})['then'](function(_0x3caf23){_0x2261c2=_0x3caf23;logger['info'](_0x5b57('0x88'),_0x2261c2['id']);return getEndUser(_0x3da69f,_0x2d30fe,_0x4ce92a,_0x4e5f99[_0x5b57('0x89')],_0x4e5f99[_0x5b57('0x8a')],_0x2261c2,_0x3dbd06);})[_0x5b57('0x28')](function(_0x5ef596){_0x8435a7=_0x5ef596;return getCall(_0x3da69f,_0x2d30fe,_0x4ce92a,_0x2261c2,_0x8435a7,_0x3dbd06,_0x4e5f99,_0x5b57('0x77'));})[_0x5b57('0x28')](function(_0x37c849){if(_0x37c849){logger[_0x5b57('0x2f')](_0x5b57('0x8b'),_0x37c849['id']);}})[_0x5b57('0x2b')](function(_0x339c18){logger['error']('['+_0x4e5f99[_0x5b57('0x6a')][_0x5b57('0x97')]()+']',JSON['stringify'](_0x339c18));});}; \ No newline at end of file +var _0xc420=['/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','The\x20Call\x20ID\x20is:','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','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.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','ActiveUsers','isArrayLikeObject','users','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','connect','Answered','abandoned','timeout','Timeout','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.'];(function(_0x3f0abe,_0x5be6b0){var _0x322994=function(_0x38198c){while(--_0x38198c){_0x3f0abe['push'](_0x3f0abe['shift']());}};_0x322994(++_0x5be6b0);}(_0xc420,0x143));var _0x0c42=function(_0x21f7ad,_0x26d123){_0x21f7ad=_0x21f7ad-0x0;var _0x10da6a=_0xc420[_0x21f7ad];return _0x10da6a;};'use strict';var _=require('lodash');var rp=require(_0x0c42('0x0'));var md5=require(_0x0c42('0x1'));var util=require(_0x0c42('0x2'));var intUtil=require(_0x0c42('0x3'));var moment=require(_0x0c42('0x4'));var Redis=require(_0x0c42('0x5'));var BPromise=require(_0x0c42('0x6'));var config=require(_0x0c42('0x7'));var logger=require('../../../../config/logger')(_0x0c42('0x8'));config[_0x0c42('0x9')]=_[_0x0c42('0xa')](config['redis'],{'host':_0x0c42('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c42('0x9')]));function emit(_0x13199e,_0x594f10,_0x5712d5){io['to'](_0x13199e)['emit'](_0x594f10,_0x5712d5);}function request(_0xfef922){logger['debug'](_0x0c42('0xc'),JSON[_0x0c42('0xd')](_0xfef922));return rp(_0xfef922);}function getCustomFields(_0x157c6b,_0x4f85ad){var _0x475c76={};if(_0x157c6b[_0x0c42('0xe')]>0x0){_[_0x0c42('0xf')](_0x157c6b,function(_0x2d4496){if(_[_0x0c42('0x10')]([_0x0c42('0x11'),_0x0c42('0x12')],_0x2d4496['type'])&&_0x2d4496[_0x0c42('0x13')]){_0x475c76[_0x2d4496[_0x0c42('0x13')]]=_0x2d4496[_0x0c42('0x14')][_0x0c42('0x15')]();}else if(_0x2d4496[_0x0c42('0x16')]===_0x0c42('0x17')&&_0x2d4496[_0x0c42('0x18')]&&_0x2d4496[_0x0c42('0x13')]&&_0x4f85ad[_0x2d4496[_0x0c42('0x18')]]){_0x475c76[_0x2d4496[_0x0c42('0x13')]]=_0x4f85ad[_0x2d4496[_0x0c42('0x18')]]['toString']();}else if(_0x2d4496[_0x0c42('0x16')]===_0x0c42('0x19')&&_0x2d4496[_0x0c42('0x1a')]&&_0x2d4496[_0x0c42('0x1a')]['name']&&_0x2d4496[_0x0c42('0x13')]&&_0x4f85ad[_0x2d4496[_0x0c42('0x1a')][_0x0c42('0x1b')][_0x0c42('0x1c')]()]){_0x475c76[_0x2d4496[_0x0c42('0x13')]]=_0x4f85ad[_0x2d4496[_0x0c42('0x1a')][_0x0c42('0x1b')][_0x0c42('0x1c')]()][_0x0c42('0x15')]();}});}return _0x475c76;}function getName(_0x2f403c){if(_0x2f403c[_0x0c42('0x1d')]('\x20')>0x0){var _0x5ccf15=_0x2f403c[_0x0c42('0x1e')](/ (.+)/);if(_0x5ccf15[0x1]){return _0x5ccf15;}}return[_0x2f403c,_0x2f403c];}var accountsTokens={};function getAccessToken(_0x22c57a){return new Promise(function(_0x497c55,_0x22fc06){if(!_[_0x0c42('0x1f')](accountsTokens[_0x22c57a['id']])&&!_['isNil'](accountsTokens[_0x22c57a['id']][_0x0c42('0x20')])){if(moment()[_0x0c42('0x21')](accountsTokens[_0x22c57a['id']][_0x0c42('0x22')])){_0x497c55(accountsTokens[_0x22c57a['id']][_0x0c42('0x20')]);}}var _0x491b60;switch(_0x22c57a[_0x0c42('0x23')]){case'US':_0x491b60=_0x0c42('0x24');break;case'AU':_0x491b60=_0x0c42('0x25');break;case'EU':_0x491b60=_0x0c42('0x26');break;case'IN':_0x491b60=_0x0c42('0x27');break;case'CN':_0x491b60=_0x0c42('0x28');break;default:_0x491b60=_0x0c42('0x26');break;}var _0x47fc85={'method':_0x0c42('0x29'),'uri':_0x491b60+_0x0c42('0x2a'),'qs':{'refresh_token':_0x22c57a['refreshToken'],'client_id':_0x22c57a[_0x0c42('0x2b')],'client_secret':_0x22c57a[_0x0c42('0x2c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x47fc85)[_0x0c42('0x2d')](function(_0x42ded1){accountsTokens[_0x22c57a['id']]={'access_token':_0x42ded1[_0x0c42('0x20')],'expires_in':moment()[_0x0c42('0x2e')](_0x42ded1[_0x0c42('0x22')],_0x0c42('0x2f'))};_0x497c55(_0x42ded1[_0x0c42('0x20')]);})[_0x0c42('0x30')](function(_0x59fe55){logger[_0x0c42('0x31')](_0x0c42('0x32'),_0x59fe55[_0x0c42('0x33')]);_0x22fc06(_0x59fe55);});});}function getUser(_0x7331f,_0x1554cb,_0x35f4e5,_0x3ef92a){logger['info'](_0x0c42('0x34'));return request({'method':'GET','uri':util[_0x0c42('0x35')]('https://www.zohoapis.%s/crm/v2/users',_0x1554cb),'qs':{'type':_0x0c42('0x36')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x7331f},'json':!![]})['then'](function(_0x2b7777){if(_0x2b7777['users']){var _0x4ef412=-0x1;if(_[_0x0c42('0x37')](_0x2b7777[_0x0c42('0x38')])){if(!_[_0x0c42('0x1f')](_0x3ef92a)){_0x4ef412=_[_0x0c42('0x39')](_0x2b7777[_0x0c42('0x38')],function(_0x302980){return _0x302980['email']===_0x3ef92a;});}if(_0x4ef412>=0x0){logger[_0x0c42('0x3a')](_0x0c42('0x3b'));}else{logger['info'](_0x0c42('0x3c'));_0x4ef412=_[_0x0c42('0x39')](_0x2b7777[_0x0c42('0x38')],function(_0x232689){return _0x232689[_0x0c42('0x3d')][_0x0c42('0x1b')]===_0x0c42('0x3e');});}return _0x2b7777[_0x0c42('0x38')][_0x4ef412];}else{if(_0x2b7777[_0x0c42('0x3f')][_0x0c42('0x3d')]['name']===_0x0c42('0x3e')){logger['info'](_0x0c42('0x3c'));user=_0x2b7777['user'];return user;}else{logger[_0x0c42('0x31')](_0x0c42('0x40'),JSON[_0x0c42('0xd')](_0x2b7777));throw new Error(_0x0c42('0x41')+JSON[_0x0c42('0xd')](_0x2b7777));}}}else{logger['error'](_0x0c42('0x40'),JSON[_0x0c42('0xd')](_0x2b7777));throw new Error(_0x0c42('0x41')+JSON['stringify'](_0x2b7777));}})[_0x0c42('0x30')](function(_0x2c36ab){console[_0x0c42('0x31')](_0x2c36ab);});}function getZohoUser(_0x25fbab,_0x23ec35){return new BPromise(function(_0x227590,_0x30ea7e){request(_0x25fbab)['then'](function(_0x2d14ba){var _0x1ff62e=null;if(_0x2d14ba){_0x1ff62e=_0x2d14ba[_0x0c42('0x42')][0x0];_0x1ff62e[_0x0c42('0x43')]=_0x23ec35;}_0x227590(_0x1ff62e);})[_0x0c42('0x30')](function(_0x271aeb){_0x30ea7e(_0x271aeb);});});}function createEndUser(_0x570a6c,_0x1f2300,_0x3b7eaf,_0x3d5ff8,_0x2f8db4,_0x1f654c){var _0x3b7eaf=getName(_0x3b7eaf);return request({'method':_0x0c42('0x29'),'uri':_0x0c42('0x44')+_0x1f2300+_0x0c42('0x45')+_['startCase'](_0x1f654c[_0x0c42('0x46')])+'s','body':{'data':[{'Last_Name':_0x3b7eaf[0x1],'First_Name':_0x3b7eaf[0x0],'Phone':_0x3d5ff8,'Owner':{'name':!_[_0x0c42('0x1f')](_0x2f8db4['role'][_0x0c42('0x1b')])?_0x2f8db4[_0x0c42('0x47')][_0x0c42('0x1b')]:!_[_0x0c42('0x1f')](_0x2f8db4['first_name'])?_0x2f8db4[_0x0c42('0x48')]+'\x20'+_0x2f8db4[_0x0c42('0x49')]:_0x2f8db4[_0x0c42('0x49')],'id':_0x2f8db4['id']}}]},'headers':{'Authorization':_0x0c42('0x4a')+_0x570a6c},'json':!![]})['then'](function(_0x8f215b){if(_0x8f215b&&_0x8f215b[_0x0c42('0x42')][0x0][_0x0c42('0x4b')]===_0x0c42('0x4c')){var _0x47ac59=_0x8f215b[_0x0c42('0x42')][0x0][_0x0c42('0x4d')];_0x47ac59['enduserType']=_['startCase'](_0x1f654c[_0x0c42('0x46')])+'s';return _0x47ac59;}logger[_0x0c42('0x31')]('The\x20failing\x20result\x20is',JSON[_0x0c42('0xd')](data));throw new Error(_0x0c42('0x4e')+JSON[_0x0c42('0xd')](data));})['catch'](function(_0x4226b0){console[_0x0c42('0x4f')]('CREATE\x20ERROR',_0x4226b0);});}function getEndUser(_0x349b90,_0x109c67,_0x4779b5,_0xa36a94,_0xf7264,_0x1d157f,_0x1679d2){var _0x7cb9a5={'method':'GET','uri':'','headers':{'Authorization':_0x0c42('0x4a')+_0x349b90},'json':!![]};switch(_0x1679d2[_0x0c42('0x50')]){case'contact_lead':_0x7cb9a5[_0x0c42('0x51')]='https://www.zohoapis.'+_0x109c67+_0x0c42('0x52')+_0xf7264+'))';return getZohoUser(_0x7cb9a5,_0x0c42('0x53'))[_0x0c42('0x2d')](function(_0x1b4657){if(_0x1b4657)return _0x1b4657;_0x7cb9a5[_0x0c42('0x51')]=_0x0c42('0x44')+_0x109c67+_0x0c42('0x54')+_0xf7264+'))';return getZohoUser(_0x7cb9a5,_0x0c42('0x55'))[_0x0c42('0x2d')](function(_0x34c99d){if(_0x34c99d)return _0x34c99d;if(_0x1679d2[_0x0c42('0x46')]!=_0x0c42('0x56')){return createEndUser(_0x349b90,_0x109c67,_0xa36a94,_0xf7264,_0x1d157f,_0x1679d2);}else{return{};}});});break;case _0x0c42('0x57'):_0x7cb9a5[_0x0c42('0x51')]=_0x0c42('0x44')+_0x109c67+_0x0c42('0x52')+_0xf7264+'))';return getZohoUser(_0x7cb9a5,'Contacts')[_0x0c42('0x2d')](function(_0x15690b){if(_0x15690b)return _0x15690b;if(_0x1679d2[_0x0c42('0x46')]!=_0x0c42('0x56')){return createEndUser(_0x349b90,_0x109c67,_0xa36a94,_0xf7264,_0x1d157f,_0x1679d2);}else{return{};}});break;case _0x0c42('0x58'):_0x7cb9a5[_0x0c42('0x51')]=_0x0c42('0x44')+_0x109c67+_0x0c42('0x54')+_0xf7264+'))';return getZohoUser(_0x7cb9a5,'Leads')[_0x0c42('0x2d')](function(_0x41c661){if(_0x41c661)return _0x41c661;if(_0x1679d2[_0x0c42('0x46')]!=_0x0c42('0x56')){return createEndUser(_0x349b90,_0x109c67,_0xa36a94,_0xf7264,_0x1d157f,_0x1679d2);}else{return{};}});break;}}function getCall(_0x1338da,_0x379b25,_0x12939f,_0x368a42,_0x2887a6,_0x4b6791,_0x5116b8,_0xbb0915){logger[_0x0c42('0x3a')](_0x0c42('0x59'));var _0x123b67={};_0x123b67[_0x0c42('0x5a')]={'name':!_[_0x0c42('0x1f')](_0x368a42[_0x0c42('0x47')]['name'])&&!_[_0x0c42('0x1f')](_0x368a42[_0x0c42('0x3d')][_0x0c42('0x1b')])&&_0x368a42[_0x0c42('0x3d')][_0x0c42('0x1b')]==='administrator'?_0x368a42['role'][_0x0c42('0x1b')]:!_['isNil'](_0x368a42['first_name'])?_0x368a42[_0x0c42('0x48')]+'\x20'+_0x368a42[_0x0c42('0x49')]:_0x368a42[_0x0c42('0x49')],'id':_0x368a42['id']};_0x123b67['Subject']=intUtil['getString'](_0x4b6791[_0x0c42('0x5b')],_0x5116b8,'\x20');_0x123b67[_0x0c42('0x5c')]=intUtil[_0x0c42('0x5d')](_0x4b6791[_0x0c42('0x5e')],_0x5116b8,'\x0a');if(_0x2887a6[_0x0c42('0x43')]===_0x0c42('0x53')){_0x123b67[_0x0c42('0x5f')]={'name':!_[_0x0c42('0x1f')](_0x2887a6[_0x0c42('0x60')])?_0x2887a6['Full_Name']:!_[_0x0c42('0x1f')](_0x2887a6[_0x0c42('0x61')])?_0x2887a6[_0x0c42('0x61')]+'\x20'+_0x2887a6[_0x0c42('0x62')]:_0x2887a6['Last_Name'],'id':_0x2887a6['id']};}if(_0x2887a6[_0x0c42('0x43')]==='Leads'){_0x123b67[_0x0c42('0x63')]={'name':!_['isNil'](_0x2887a6[_0x0c42('0x60')])?_0x2887a6[_0x0c42('0x60')]:!_['isNil'](_0x2887a6['First_Name'])?_0x2887a6[_0x0c42('0x61')]+'\x20'+_0x2887a6[_0x0c42('0x62')]:_0x2887a6[_0x0c42('0x62')],'id':_0x2887a6['id']};_0x123b67[_0x0c42('0x64')]=_[_0x0c42('0x65')](_0x2887a6['enduserType']);}if(_0x5116b8['talktime']){_0x123b67[_0x0c42('0x66')]=moment[_0x0c42('0x67')](parseInt(_0x5116b8['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x5116b8[_0x0c42('0x68')]&&_0x5116b8[_0x0c42('0x69')]){_0x123b67[_0x0c42('0x66')]=moment['utc'](moment(_0x5116b8['endtime'],_0x0c42('0x6a'))[_0x0c42('0x6b')](moment(_0x5116b8['starttime'],_0x0c42('0x6a'))))['format']('mm:ss');}switch(_0x5116b8[_0x0c42('0x6c')]){case _0x0c42('0x6d'):_0x123b67[_0x0c42('0x6e')]=_0x0c42('0x6f');break;case _0x0c42('0x70'):case _0x0c42('0x71'):_0x123b67[_0x0c42('0x6e')]=_0x0c42('0x72');break;case'rejected':_0x123b67[_0x0c42('0x6e')]='Rejected';break;case _0x0c42('0x73'):_0x123b67[_0x0c42('0x6e')]='Abandoned';break;case _0x0c42('0x74'):_0x123b67[_0x0c42('0x6e')]=_0x0c42('0x75');default:}_0x123b67['Call_Start_Time']=(_0xbb0915==='outbound'?moment(_0x5116b8['starttime'])[_0x0c42('0x35')](_0x0c42('0x6a')):moment(_0x5116b8['agentcalledAt'])[_0x0c42('0x35')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x0c42('0x35')]('YYYY-MM-DDTHH:mm:ss');_0x123b67['Call_Type']=_0xbb0915||_0x0c42('0x76');_0x123b67=_[_0x0c42('0x77')](_0x123b67,getCustomFields(_0x4b6791[_0x0c42('0x78')],_0x5116b8));return request({'method':_0x0c42('0x29'),'uri':'https://www.zohoapis.'+_0x379b25+_0x0c42('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1338da},'body':{'data':[_0x123b67]},'json':!![]})[_0x0c42('0x2d')](function(_0x5ac762){if(_0x5ac762&&_0x5ac762[_0x0c42('0x42')][0x0][_0x0c42('0x4b')]===_0x0c42('0x4c')){logger[_0x0c42('0x3a')](_0x0c42('0x7a'));return{'id':_0x5ac762[_0x0c42('0x42')][0x0]['details']['id']};}})[_0x0c42('0x30')](function(_0x822434){logger['info'](_0x0c42('0x7b'),_0x822434[_0x0c42('0x33')]);console[_0x0c42('0x4f')](_0x0c42('0x7b'),_0x822434);});}exports[_0x0c42('0x7c')]=function(_0x360a99,_0x294056,_0x31fe2e,_0x1f458f,_0x4c0cfb,_0x420df1){var _0x2c05ca,_0x54616d,_0x1cce5b;_0x420df1[_0x0c42('0x7d')]=intUtil[_0x0c42('0x7e')](_0x420df1[_0x0c42('0x7d')]);_0x420df1[_0x0c42('0x7f')]=intUtil[_0x0c42('0x7e')](_0x420df1[_0x0c42('0x7f')]);if(_0x4c0cfb&&_0x4c0cfb['monitor_format']){logger[_0x0c42('0x3a')](_0x0c42('0x80'),_0x0c42('0x81'));_0x294056['recordingURL']=_0x420df1['serverUrl']+_0x0c42('0x82')+_0x294056['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x294056[_0x0c42('0x83')]);}else{_0x294056[_0x0c42('0x84')]='';}var _0x38a00b=_0x420df1[_0x0c42('0x7d')]===_0x0c42('0x85')?'eu':_0x0c42('0x86');return getAccessToken(_0x420df1)['then'](function(_0x3651b7){_0x1cce5b=_0x3651b7;return getUser(_0x1cce5b,_0x38a00b,_0x420df1,_0x1f458f[_0x0c42('0x87')]);})[_0x0c42('0x2d')](function(_0x47357e){_0x2c05ca=_0x47357e;logger['info']('The\x20User\x20ID\x20is:',_0x2c05ca['id']);return getEndUser(_0x1cce5b,_0x38a00b,_0x420df1,_0x294056[_0x0c42('0x88')],_0x294056[_0x0c42('0x89')],_0x2c05ca,_0x31fe2e);})[_0x0c42('0x2d')](function(_0x46247c){_0x54616d=_0x46247c;return getCall(_0x1cce5b,_0x38a00b,_0x420df1,_0x2c05ca,_0x54616d,_0x31fe2e,_0x294056,'Inbound');})[_0x0c42('0x2d')](function(_0x33e7b0){if(_0x33e7b0){logger[_0x0c42('0x3a')]('The\x20Call\x20ID\x20is:',_0x33e7b0['id']);logger[_0x0c42('0x3a')]('[QUEUE]',_0x0c42('0x8a'));emit(util[_0x0c42('0x35')](_0x0c42('0x8b'),_0x1f458f[_0x0c42('0x1b')]),_0x0c42('0x8c'),{'uri':_0x0c42('0x8d')+_0x420df1[_0x0c42('0x7d')]+_0x0c42('0x8e')+_0x33e7b0['id']});}})[_0x0c42('0x30')](function(_0x1a0e22){logger['error']('[QUEUE]',JSON[_0x0c42('0xd')](_0x1a0e22));});};exports[_0x0c42('0x8f')]=function(_0x3ca5db,_0xf643fd,_0x77f9d9,_0x450b9c,_0x1f5b7e,_0x3888bb,_0x44f2e3){var _0x5df299,_0x4f7a59,_0x5e6fe9;_0x3888bb['host']=intUtil[_0x0c42('0x7e')](_0x3888bb[_0x0c42('0x7d')]);_0x3888bb['serverUrl']=intUtil[_0x0c42('0x7e')](_0x3888bb['serverUrl']);if(_0x44f2e3&&_0x44f2e3[_0x0c42('0x90')]&&_0x44f2e3[_0x0c42('0x90')]!==_0x0c42('0x91')){logger[_0x0c42('0x3a')](_0x0c42('0x92'),_0x0c42('0x81'));_0xf643fd[_0x0c42('0x84')]=_0x3888bb[_0x0c42('0x7f')]+'/api/voice/recordings/'+_0xf643fd[_0x0c42('0x83')]+'/downloads?type=uniqueid&token='+md5(_0xf643fd[_0x0c42('0x83')]);}var _0x48a640=_0x3888bb[_0x0c42('0x7d')]===_0x0c42('0x85')?'eu':_0x0c42('0x86');return getAccessToken(_0x3888bb)['then'](function(_0x3cce56){_0x5e6fe9=_0x3cce56;return getUser(_0x5e6fe9,_0x48a640,_0x3888bb,_0x450b9c[_0x0c42('0x87')]);})[_0x0c42('0x2d')](function(_0x3c2406){_0x5df299=_0x3c2406;logger[_0x0c42('0x3a')](_0x0c42('0x93'),_0x5df299['id']);return getEndUser(_0x5e6fe9,_0x48a640,_0x3888bb,_0xf643fd[_0x0c42('0x94')],_0xf643fd[_0x0c42('0x95')],_0x5df299,_0x77f9d9);})['then'](function(_0x41b059){_0x4f7a59=_0x41b059;return getCall(_0x5e6fe9,_0x48a640,_0x3888bb,_0x5df299,_0x4f7a59,_0x77f9d9,_0xf643fd,'Outbound');})[_0x0c42('0x2d')](function(_0x1da706){if(_0x1da706){logger[_0x0c42('0x3a')]('The\x20Call\x20ID\x20is:',_0x1da706['id']);logger[_0x0c42('0x3a')]('[OUTBOUND]',_0x0c42('0x8a'));emit(util['format'](_0x0c42('0x8b'),_0x450b9c[_0x0c42('0x1b')]),_0x0c42('0x8c'),{'uri':_0x0c42('0x8d')+_0x3888bb[_0x0c42('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1da706['id']});}})['catch'](function(_0x42ce82){logger[_0x0c42('0x31')]('[OUTBOUND]',JSON[_0x0c42('0xd')](_0x42ce82));});};exports[_0x0c42('0x96')]=function(_0x389527,_0x3bf863,_0x1f1788,_0x1ed56d,_0x57f7b5,_0x229bfa){var _0x14efc6,_0x44d111,_0x2d712c;_0x229bfa['host']=intUtil[_0x0c42('0x7e')](_0x229bfa['host']);_0x229bfa[_0x0c42('0x7f')]=intUtil['stripTrailingSlash'](_0x229bfa[_0x0c42('0x7f')]);if(_0x57f7b5&&_0x57f7b5[_0x0c42('0x97')]){logger[_0x0c42('0x3a')]('['+_0x3bf863[_0x0c42('0x6c')][_0x0c42('0x98')]()+']',_0x0c42('0x81'));_0x3bf863['recordingURL']=_0x229bfa[_0x0c42('0x7f')]+'/api/voice/recordings/'+_0x3bf863['uniqueid']+_0x0c42('0x99')+md5(_0x3bf863[_0x0c42('0x83')]);}else{_0x3bf863[_0x0c42('0x84')]='';}var _0x254c06=_0x229bfa[_0x0c42('0x7d')]===_0x0c42('0x85')?'eu':_0x0c42('0x86');return getAccessToken(_0x229bfa)['then'](function(_0x38f1dd){_0x2d712c=_0x38f1dd;return getUser(_0x2d712c,_0x254c06,_0x229bfa);})[_0x0c42('0x2d')](function(_0xa50049){_0x14efc6=_0xa50049;logger['info'](_0x0c42('0x93'),_0x14efc6['id']);return getEndUser(_0x2d712c,_0x254c06,_0x229bfa,_0x3bf863[_0x0c42('0x88')],_0x3bf863[_0x0c42('0x89')],_0x14efc6,_0x1f1788);})[_0x0c42('0x2d')](function(_0x6b1f3){_0x44d111=_0x6b1f3;return getCall(_0x2d712c,_0x254c06,_0x229bfa,_0x14efc6,_0x44d111,_0x1f1788,_0x3bf863,_0x0c42('0x76'));})[_0x0c42('0x2d')](function(_0x3c83d0){if(_0x3c83d0){logger['info'](_0x0c42('0x9a'),_0x3c83d0['id']);}})[_0x0c42('0x30')](function(_0x16a4c0){logger[_0x0c42('0x31')]('['+_0x3bf863[_0x0c42('0x6c')]['toUpperCase']()+']',JSON[_0x0c42('0xd')](_0x16a4c0));});}; \ 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 b350660..e46d2bd 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 _0xaf26=['render','error','format','%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','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0x40dd3e,_0x2f1ec2){var _0x1c9f86=function(_0x5ba7d6){while(--_0x5ba7d6){_0x40dd3e['push'](_0x40dd3e['shift']());}};_0x1c9f86(++_0x2f1ec2);}(_0xaf26,0x1f3));var _0x6af2=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xaf26[_0x54b283];return _0x2462b3;};'use strict';var util=require(_0x6af2('0x0'));var sh=require(_0x6af2('0x1'));var Mustache=require(_0x6af2('0x2'));var logger=require(_0x6af2('0x3'))(_0x6af2('0x4'));exports['exec']=function(_0x3c4324,_0x4ba501){var _0x372b75=_0x3c4324['data2']?_0x3c4324[_0x6af2('0x5')]:_0x6af2('0x6');var _0x7405c9=_0x3c4324[_0x6af2('0x7')]?Mustache[_0x6af2('0x8')](_0x3c4324[_0x6af2('0x7')],_0x4ba501):_0x4ba501;sh['exec'](_0x7405c9,function(_0x4b6e06,_0x172919,_0x188858){if(_0x4b6e06!==0x0){logger[_0x6af2('0x9')](util[_0x6af2('0xa')](_0x6af2('0xb'),_0x372b75,_0x7405c9,_0x4b6e06,_0x188858));}else{logger['info'](util[_0x6af2('0xa')](_0x6af2('0xc'),_0x372b75,_0x7405c9,_0x172919));}});}; \ No newline at end of file +var _0x940a=['mustache','../../../../config/logger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','shelljs'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x940a,0x77));var _0xa940=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x940a[_0x6dd5c];return _0x5a87fa;};'use strict';var util=require('util');var sh=require(_0xa940('0x0'));var Mustache=require(_0xa940('0x1'));var logger=require(_0xa940('0x2'))('trigger');exports[_0xa940('0x3')]=function(_0x424027,_0x3386ce){var _0x56fe17=_0x424027[_0xa940('0x4')]?_0x424027[_0xa940('0x4')]:'Script';var _0xc5a08e=_0x424027[_0xa940('0x5')]?Mustache[_0xa940('0x6')](_0x424027[_0xa940('0x5')],_0x3386ce):_0x3386ce;sh[_0xa940('0x3')](_0xc5a08e,function(_0x486d86,_0x352dac,_0x2de3e7){if(_0x486d86!==0x0){logger[_0xa940('0x7')](util[_0xa940('0x8')](_0xa940('0x9'),_0x56fe17,_0xc5a08e,_0x486d86,_0x2de3e7));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x56fe17,_0xc5a08e,_0x352dac));}});}; \ 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 d0ac7d5..9f57c6c 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 _0x9d61=['parse','stack','DELETE','POST','data7','error','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','../../../../config/logger','data1','toUpperCase','render','data2','data5','number','headers','data6'];(function(_0x141930,_0x86e413){var _0x2eb996=function(_0x21a076){while(--_0x21a076){_0x141930['push'](_0x141930['shift']());}};_0x2eb996(++_0x86e413);}(_0x9d61,0x1c6));var _0x19d6=function(_0x2319c5,_0x158f40){_0x2319c5=_0x2319c5-0x0;var _0x2e44fb=_0x9d61[_0x2319c5];return _0x2e44fb;};'use strict';var rp=require(_0x19d6('0x0'));var util=require(_0x19d6('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x19d6('0x2'))('trigger');exports['exec']=function(_0x26aa81,_0x16e7f3){var _0x33b667,_0x12aea7;var _0x3abb70={'method':_0x26aa81[_0x19d6('0x3')][_0x19d6('0x4')](),'uri':Mustache[_0x19d6('0x5')](_0x26aa81[_0x19d6('0x6')],_0x16e7f3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x26aa81[_0x19d6('0x7')])===_0x19d6('0x8')&&parseInt(_0x26aa81[_0x19d6('0x7')])>=0x1&&parseInt(_0x26aa81[_0x19d6('0x7')])<=0xa?parseInt(_0x26aa81[_0x19d6('0x7')])*0x3e8:0x5*0x3e8};try{_0x3abb70[_0x19d6('0x9')]=_0x26aa81[_0x19d6('0xa')]?JSON[_0x19d6('0xb')](Mustache[_0x19d6('0x5')](_0x26aa81[_0x19d6('0xa')],_0x16e7f3)):{};}catch(_0x53578a){logger['error'](_0x53578a[_0x19d6('0xc')]);}switch(_0x26aa81[_0x19d6('0x3')]['toUpperCase']()){case'GET':case _0x19d6('0xd'):_0x33b667=null;_0x3abb70['qs']=_0x16e7f3;break;case _0x19d6('0xe'):case'PUT':if(_0x26aa81[_0x19d6('0xf')]){try{_0x33b667=JSON['parse'](Mustache[_0x19d6('0x5')](_0x26aa81[_0x19d6('0xf')],_0x16e7f3));_0x3abb70['body']=_0x33b667;}catch(_0x26ca9d){logger[_0x19d6('0x10')](_0x26ca9d[_0x19d6('0xc')]);logger[_0x19d6('0x10')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x33b667=_0x16e7f3;_0x3abb70[_0x19d6('0x11')]=_0x33b667;}break;}logger[_0x19d6('0x12')](util[_0x19d6('0x13')](_0x19d6('0x14'),_0x26aa81[_0x19d6('0x3')],_0x26aa81['data2'],JSON[_0x19d6('0x15')](_0x3abb70)));rp(_0x3abb70)[_0x19d6('0x16')](function(_0x354e5f){_0x33b667=!_[_0x19d6('0x17')](_0x33b667)?_0x19d6('0x18')+_0x33b667:'';_0x12aea7=typeof _0x354e5f[_0x19d6('0x11')]===_0x19d6('0x19')?JSON[_0x19d6('0x15')](_0x354e5f[_0x19d6('0x11')]):_0x354e5f[_0x19d6('0x11')];logger[_0x19d6('0x12')](util['format'](_0x19d6('0x1a'),_0x26aa81[_0x19d6('0x3')],_0x26aa81[_0x19d6('0x6')],_0x354e5f[_0x19d6('0x1b')],_0x12aea7));})['catch'](function(_0xd5f60c){logger[_0x19d6('0x10')](util[_0x19d6('0x13')](_0x19d6('0x1c'),_0x26aa81[_0x19d6('0x3')],_0x26aa81[_0x19d6('0x6')],_0xd5f60c[_0x19d6('0x1b')],_0xd5f60c[_0x19d6('0x1d')],_0xd5f60c[_0x19d6('0x1e')]));});}; \ No newline at end of file +var _0x4509=['PUT','parse','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','../../../../config/logger','trigger','toUpperCase','render','data2','data5','number','headers','data6','stack','data1','GET','DELETE','POST'];(function(_0x3ee0da,_0x2c9bff){var _0x442836=function(_0x11d40e){while(--_0x11d40e){_0x3ee0da['push'](_0x3ee0da['shift']());}};_0x442836(++_0x2c9bff);}(_0x4509,0x1cd));var _0x9450=function(_0x19eefa,_0x390ee1){_0x19eefa=_0x19eefa-0x0;var _0x3e2e73=_0x4509[_0x19eefa];return _0x3e2e73;};'use strict';var rp=require('request-promise');var util=require(_0x9450('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x9450('0x1'))(_0x9450('0x2'));exports['exec']=function(_0x2f63d4,_0xf240bf){var _0x19a356,_0x2b8887;var _0x33dc31={'method':_0x2f63d4['data1'][_0x9450('0x3')](),'uri':Mustache[_0x9450('0x4')](_0x2f63d4[_0x9450('0x5')],_0xf240bf),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f63d4[_0x9450('0x6')])===_0x9450('0x7')&&parseInt(_0x2f63d4[_0x9450('0x6')])>=0x1&&parseInt(_0x2f63d4[_0x9450('0x6')])<=0xa?parseInt(_0x2f63d4['data5'])*0x3e8:0x5*0x3e8};try{_0x33dc31[_0x9450('0x8')]=_0x2f63d4[_0x9450('0x9')]?JSON['parse'](Mustache[_0x9450('0x4')](_0x2f63d4[_0x9450('0x9')],_0xf240bf)):{};}catch(_0x4b14d6){logger['error'](_0x4b14d6[_0x9450('0xa')]);}switch(_0x2f63d4[_0x9450('0xb')][_0x9450('0x3')]()){case _0x9450('0xc'):case _0x9450('0xd'):_0x19a356=null;_0x33dc31['qs']=_0xf240bf;break;case _0x9450('0xe'):case _0x9450('0xf'):if(_0x2f63d4['data7']){try{_0x19a356=JSON[_0x9450('0x10')](Mustache[_0x9450('0x4')](_0x2f63d4[_0x9450('0x11')],_0xf240bf));_0x33dc31[_0x9450('0x12')]=_0x19a356;}catch(_0x28354){logger[_0x9450('0x13')](_0x28354['stack']);logger[_0x9450('0x13')](_0x9450('0x14'));}}else{_0x19a356=_0xf240bf;_0x33dc31[_0x9450('0x12')]=_0x19a356;}break;}logger[_0x9450('0x15')](util[_0x9450('0x16')](_0x9450('0x17'),_0x2f63d4[_0x9450('0xb')],_0x2f63d4[_0x9450('0x5')],JSON[_0x9450('0x18')](_0x33dc31)));rp(_0x33dc31)[_0x9450('0x19')](function(_0x5aad6d){_0x19a356=!_[_0x9450('0x1a')](_0x19a356)?_0x9450('0x1b')+_0x19a356:'';_0x2b8887=typeof _0x5aad6d[_0x9450('0x12')]===_0x9450('0x1c')?JSON[_0x9450('0x18')](_0x5aad6d[_0x9450('0x12')]):_0x5aad6d['body'];logger[_0x9450('0x15')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2f63d4[_0x9450('0xb')],_0x2f63d4[_0x9450('0x5')],_0x5aad6d[_0x9450('0x1d')],_0x2b8887));})[_0x9450('0x1e')](function(_0x577a6d){logger['error'](util['format'](_0x9450('0x1f'),_0x2f63d4[_0x9450('0xb')],_0x2f63d4[_0x9450('0x5')],_0x577a6d[_0x9450('0x1d')],_0x577a6d[_0x9450('0x20')],_0x577a6d[_0x9450('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8a16d8e..e9fb524 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 _0x4b6f=['error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc'];(function(_0x5397d9,_0x220f1c){var _0xfcdfb7=function(_0x3c6890){while(--_0x3c6890){_0x5397d9['push'](_0x5397d9['shift']());}};_0xfcdfb7(++_0x220f1c);}(_0x4b6f,0xf5));var _0xf4b6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4b6f[_0x42245d];return _0x4b211a;};'use strict';var jayson=require(_0xf4b6('0x0'));var BPromise=require(_0xf4b6('0x1'));var logger=require('../../config/logger')(_0xf4b6('0x2'));var client=jayson[_0xf4b6('0x3')][_0xf4b6('0x4')]({'port':0x2329});client[_0xf4b6('0x5')]=function(_0x98ce6b,_0x237e83){return new BPromise(function(_0xe15d1c,_0x14897d){return client[_0xf4b6('0x6')](_0x98ce6b,_0x237e83)[_0xf4b6('0x7')](function(_0x5485c4){logger[_0xf4b6('0x8')](_0xf4b6('0x9'),_0xf4b6('0x2'),_0x98ce6b,_0x237e83,_0x5485c4);if(_0x5485c4[_0xf4b6('0xa')]){logger[_0xf4b6('0xa')]('rpc',_0xf4b6('0x2'),_0x98ce6b,_0x5485c4[_0xf4b6('0xa')][_0xf4b6('0xb')],_0x237e83);return _0x14897d(_0x5485c4[_0xf4b6('0xa')]['message']);}else{return _0xe15d1c(_0x5485c4[_0xf4b6('0xc')]);}})[_0xf4b6('0xd')](function(_0x3c7889){logger[_0xf4b6('0xa')](_0xf4b6('0x9'),'routing',_0x98ce6b,_0x3c7889,_0x237e83);return _0x14897d(_0x3c7889);});});};module[_0xf4b6('0xe')]=client; \ No newline at end of file +var _0xef5c=['rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','client','http','Request','request','then','debug'];(function(_0x2dd059,_0x79d40a){var _0x26ab91=function(_0x28eb29){while(--_0x28eb29){_0x2dd059['push'](_0x2dd059['shift']());}};_0x26ab91(++_0x79d40a);}(_0xef5c,0x106));var _0xcef5=function(_0x23f3e4,_0x232400){_0x23f3e4=_0x23f3e4-0x0;var _0x5a43f1=_0xef5c[_0x23f3e4];return _0x5a43f1;};'use strict';var jayson=require(_0xcef5('0x0'));var BPromise=require(_0xcef5('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xcef5('0x2')][_0xcef5('0x3')]({'port':0x2329});client[_0xcef5('0x4')]=function(_0x2414a8,_0x27e75b){return new BPromise(function(_0x27a64f,_0x5ad353){return client[_0xcef5('0x5')](_0x2414a8,_0x27e75b)[_0xcef5('0x6')](function(_0x6d299d){logger[_0xcef5('0x7')](_0xcef5('0x8'),_0xcef5('0x9'),_0x2414a8,_0x27e75b,_0x6d299d);if(_0x6d299d[_0xcef5('0xa')]){logger['error'](_0xcef5('0x8'),'routing',_0x2414a8,_0x6d299d[_0xcef5('0xa')][_0xcef5('0xb')],_0x27e75b);return _0x5ad353(_0x6d299d[_0xcef5('0xa')][_0xcef5('0xb')]);}else{return _0x27a64f(_0x6d299d[_0xcef5('0xc')]);}})[_0xcef5('0xd')](function(_0x3cdd1e){logger[_0xcef5('0xa')]('rpc',_0xcef5('0x9'),_0x2414a8,_0x3cdd1e,_0x27e75b);return _0x5ad353(_0x3cdd1e);});});};module[_0xcef5('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2797bf6..e4c22ce 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 _0xdd85=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then'];(function(_0x17e4f9,_0x4318be){var _0xf6cb46=function(_0x329493){while(--_0x329493){_0x17e4f9['push'](_0x17e4f9['shift']());}};_0xf6cb46(++_0x4318be);}(_0xdd85,0x108));var _0x5dd8=function(_0x5c381a,_0x6905cb){_0x5c381a=_0x5c381a-0x0;var _0x6932cb=_0xdd85[_0x5c381a];return _0x6932cb;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5dd8('0x0'));var mailAccount=require(_0x5dd8('0x1'));var setting=require(_0x5dd8('0x2'));var logger=require(_0x5dd8('0x3'))(_0x5dd8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x5dd8('0x5')](mailAccount[_0x5dd8('0x6')]())[_0x5dd8('0x5')](realtime[_0x5dd8('0x7')]())['then'](function(){email[_0x5dd8('0x8')](realtime[_0x5dd8('0x9')]);return realtime;});}function main(){return server[_0x5dd8('0xa')](realtime,email)[_0x5dd8('0x5')](function(){return initRealtime();})[_0x5dd8('0x5')](function(){return setting[_0x5dd8('0xb')]();})[_0x5dd8('0x5')](function(_0x29a0e2){return setInterval(initRealtime,_0x29a0e2[_0x5dd8('0xc')]*0x3e8);})['catch'](function(_0x2b0d01){logger[_0x5dd8('0xd')](_0x5dd8('0xe'),_0x2b0d01);});}main(); \ No newline at end of file +var _0x3be1=['error','Email\x20service\x20initialization','./realtime','email','resolve','then','getMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x52ef50,_0x343159){var _0x4b7f92=function(_0x3d3c7d){while(--_0x3d3c7d){_0x52ef50['push'](_0x52ef50['shift']());}};_0x4b7f92(++_0x343159);}(_0x3be1,0x16d));var _0x13be=function(_0x5b8366,_0x2a3e59){_0x5b8366=_0x5b8366-0x0;var _0x1db201=_0x3be1[_0x5b8366];return _0x1db201;};'use strict';var server=require('./server');var Realtime=require(_0x13be('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x13be('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x13be('0x2')]()[_0x13be('0x3')](mailAccount[_0x13be('0x4')]())[_0x13be('0x3')](realtime['initMailAccounts']())[_0x13be('0x3')](function(){email['refresh'](realtime[_0x13be('0x5')]);return realtime;});}function main(){return server[_0x13be('0x6')](realtime,email)[_0x13be('0x3')](function(){return initRealtime();})[_0x13be('0x3')](function(){return setting[_0x13be('0x7')]();})['then'](function(_0x56617d){return setInterval(initRealtime,_0x56617d[_0x13be('0x8')]*0x3e8);})['catch'](function(_0x2be0ec){logger[_0x13be('0x9')](_0x13be('0xa'),_0x2be0ec);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f13f392..919c2ba 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 _0x5953=['verify','then','Smtp','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','info','start\x20email\x20channel','mailAccounts','emit','key','active','Imap','status','messageStatus','isNil','md5','mailAccount:update','prototype','refresh','hasOwnProperty','service','custom','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','handleImapError','sendMail','smtp','send','verifySmtp'];(function(_0x36b535,_0x2fb432){var _0xd347ec=function(_0x2d797a){while(--_0x2d797a){_0x36b535['push'](_0x36b535['shift']());}};_0xd347ec(++_0x2fb432);}(_0x5953,0x121));var _0x3595=function(_0x1f54ce,_0x17b1ca){_0x1f54ce=_0x1f54ce-0x0;var _0x594827=_0x5953[_0x1f54ce];return _0x594827;};'use strict';var _=require(_0x3595('0x0'));var moment=require(_0x3595('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x3595('0x2'));var config=require(_0x3595('0x3'));var logger=require(_0x3595('0x4'))(_0x3595('0x5'));config[_0x3595('0x6')]=_[_0x3595('0x7')](config[_0x3595('0x6')],{'host':_0x3595('0x8'),'port':0x18eb});var io=require(_0x3595('0x9'))(new Redis(config[_0x3595('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4904e7){logger[_0x3595('0xa')](_0x3595('0xb'));this['mailAccounts']=_0x4904e7[_0x3595('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x3595('0xd')]=function(_0x59a0c9){var _0x110b55=this[_0x3595('0xc')][_0x59a0c9];var _0x1ffb62={'id':_0x110b55['id'],'name':_0x110b55['name'],'key':_0x110b55[_0x3595('0xe')],'active':_0x110b55[_0x3595('0xf')],'Imap':{'status':_0x110b55[_0x3595('0x10')][_0x3595('0x11')],'messageStatus':_0x110b55['Imap'][_0x3595('0x12')],'total':_0x110b55[_0x3595('0x10')]['total']}};if(_[_0x3595('0x13')](md5Accounts[_0x59a0c9])){md5Accounts[_0x59a0c9]={};}var _0x5ba4b0=md5(JSON['stringify'](_0x1ffb62));if(md5Accounts[_0x59a0c9][_0x3595('0x14')]!==_0x5ba4b0){md5Accounts[_0x59a0c9]['md5']=_0x5ba4b0;io['emit'](_0x3595('0x15'),_0x1ffb62);}};EmailChannel[_0x3595('0x16')][_0x3595('0x17')]=function(_0xda689a){for(var _0x12ed18 in _0xda689a){if(_0xda689a[_0x3595('0x18')](_0x12ed18)){if(_0xda689a[_0x12ed18]['Imap']&&_0xda689a[_0x12ed18][_0x3595('0xf')]){var _0x30b306=_0xda689a[_0x12ed18][_0x3595('0x10')];if(!_0x30b306[_0x3595('0x19')]&&_0xda689a[_0x12ed18]['provider']!==_0x3595('0x1a'))_0x30b306[_0x3595('0x19')]=_0xda689a[_0x12ed18][_0x3595('0x1b')];if(!this[_0x3595('0x1c')]['hasOwnProperty'](_0x30b306['id'])){this[_0x3595('0x1c')][_0x30b306['id']]=new EmailImap(_0x30b306,_0xda689a[_0x12ed18][_0x3595('0x5')]);this[_0x3595('0x1c')][_0x30b306['id']]['on'](_0x3595('0x1d'),this[_0x3595('0x1e')][_0x3595('0x1f')](this,_0x12ed18));this[_0x3595('0x1c')][_0x30b306['id']]['on'](_0x3595('0x5'),this[_0x3595('0x20')][_0x3595('0x1f')](this,_0x12ed18));this[_0x3595('0x1c')][_0x30b306['id']]['on'](_0x3595('0x21'),this['handleImapEnd'][_0x3595('0x1f')](this,_0x12ed18));this[_0x3595('0x1c')][_0x30b306['id']]['on'](_0x3595('0x22'),this['handleImapError'][_0x3595('0x1f')](this,_0x12ed18));}}else{if(_[_0x3595('0x13')](this[_0x3595('0xc')][_0x12ed18][_0x3595('0x10')])){this[_0x3595('0xc')][_0x12ed18]['Imap']={};}this[_0x3595('0xc')][_0x12ed18][_0x3595('0x10')][_0x3595('0x11')]=_0x3595('0x23');this[_0x3595('0xc')][_0x12ed18]['Imap']['messageStatus']='';this[_0x3595('0xd')](_0x12ed18);}}}};EmailChannel[_0x3595('0x16')]['handleImapBox']=function(_0x2f05b3,_0x29d7d3){if(this[_0x3595('0xc')][_0x2f05b3]){this['mailAccounts'][_0x2f05b3][_0x3595('0x10')][_0x3595('0x11')]=_0x3595('0x24');this['mailAccounts'][_0x2f05b3]['Imap'][_0x3595('0x12')]=_0x29d7d3['name'];if(_0x29d7d3[_0x3595('0x25')]){this['mailAccounts'][_0x2f05b3][_0x3595('0x10')]['total']=_0x29d7d3[_0x3595('0x25')]['total'];}return this[_0x3595('0xd')](_0x2f05b3);}};EmailChannel[_0x3595('0x16')][_0x3595('0x20')]=function(_0x2b67d3,_0x5a20cb){logger[_0x3595('0xa')](_0x3595('0x26'),_0x5a20cb[_0x3595('0x27')],_0x5a20cb[_0x3595('0x28')],_0x5a20cb[_0x3595('0x29')],_0x2b67d3);if(this[_0x3595('0xc')][_0x2b67d3]){return mailAccount['notify'](_0x2b67d3,_0x5a20cb)['then'](function(_0x5a63a7){if(_0x5a63a7){logger[_0x3595('0xa')](_0x3595('0x2a'));}})[_0x3595('0x2b')](function(_0x1826e7){logger['error'](_0x3595('0x2c'),JSON[_0x3595('0x2d')](_0x1826e7));});}};EmailChannel[_0x3595('0x16')][_0x3595('0x2e')]=function(_0x4586f8){if(this['mailAccounts'][_0x4586f8]&&this['mailAccounts'][_0x4586f8][_0x3595('0x10')]){if(this['imapAccounts'][this[_0x3595('0xc')][_0x4586f8][_0x3595('0x10')]['id']]){delete this[_0x3595('0x1c')][this[_0x3595('0xc')][_0x4586f8][_0x3595('0x10')]['id']];}this[_0x3595('0xc')][_0x4586f8][_0x3595('0x10')][_0x3595('0x2f')]=moment();this[_0x3595('0xd')](_0x4586f8);}};EmailChannel[_0x3595('0x16')][_0x3595('0x30')]=function(_0x6fe5d,_0x3c859a){if(this[_0x3595('0xc')][_0x6fe5d]){this[_0x3595('0xc')][_0x6fe5d][_0x3595('0x10')][_0x3595('0x11')]=_0x3595('0x22');this[_0x3595('0xc')][_0x6fe5d][_0x3595('0x10')][_0x3595('0x12')]=_0x3c859a;return this[_0x3595('0xd')](_0x6fe5d);}};EmailChannel[_0x3595('0x16')][_0x3595('0x31')]=function(_0x2caca8,_0x56c735){return this[_0x3595('0x32')][_0x3595('0x33')](_0x2caca8,_0x56c735);};EmailChannel[_0x3595('0x16')][_0x3595('0x34')]=function(_0x49c803){var _0x2793d5=this;if(this['mailAccounts'][_0x49c803['id']]){if(_['isNil'](this[_0x3595('0xc')][_0x49c803['id']]['Smtp'])){this[_0x3595('0xc')][_0x49c803['id']]['Smtp']={};}this[_0x3595('0xc')][_0x49c803['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x1f9bc7,_0x487112){return _0x2793d5[_0x3595('0x32')][_0x3595('0x35')](_0x49c803)[_0x3595('0x36')](function(_0x4daf83){_0x2793d5[_0x3595('0xc')][_0x49c803['id']]['Smtp'][_0x3595('0x11')]='verified';_0x2793d5['mailAccounts'][_0x49c803['id']]['Smtp'][_0x3595('0x12')]='';_0x2793d5[_0x3595('0xd')](_0x49c803['id']);_0x1f9bc7(_0x4daf83);})[_0x3595('0x2b')](function(_0x36acf0){_0x2793d5[_0x3595('0xc')][_0x49c803['id']][_0x3595('0x37')]['status']=_0x3595('0x22');_0x2793d5[_0x3595('0xc')][_0x49c803['id']][_0x3595('0x37')][_0x3595('0x12')]=_0x36acf0;_0x2793d5[_0x3595('0xd')](_0x49c803['id']);_0x487112(_0x36acf0);});});}return this[_0x3595('0x32')]['verify'](_0x49c803);};module[_0x3595('0x38')]=EmailChannel; \ No newline at end of file +var _0x76c6=['md5','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','Imap','status','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','active','service','provider','box','bind','handleImapEnd','handleImapError','isNil','emit','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verified','error','exports','moment','bluebird'];(function(_0x49b970,_0x1baf8a){var _0x4b146e=function(_0x4d2bd4){while(--_0x4d2bd4){_0x49b970['push'](_0x49b970['shift']());}};_0x4b146e(++_0x1baf8a);}(_0x76c6,0x196));var _0x676c=function(_0xd93cf7,_0xc8445b){_0xd93cf7=_0xd93cf7-0x0;var _0x2791eb=_0x76c6[_0xd93cf7];return _0x2791eb;};'use strict';var _=require('lodash');var moment=require(_0x676c('0x0'));var BPromise=require(_0x676c('0x1'));var md5=require(_0x676c('0x2'));var Redis=require('ioredis');var config=require(_0x676c('0x3'));var logger=require(_0x676c('0x4'))(_0x676c('0x5'));config[_0x676c('0x6')]=_[_0x676c('0x7')](config[_0x676c('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x676c('0x6')]));var EmailImap=require(_0x676c('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x676c('0x9'));var md5Accounts={};function EmailChannel(_0x25ba10){logger['info'](_0x676c('0xa'));this[_0x676c('0xb')]=_0x25ba10[_0x676c('0xb')];this[_0x676c('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x676c('0xd')]['emit']=function(_0x51671a){var _0x4d4cf1=this[_0x676c('0xb')][_0x51671a];var _0x1d11be={'id':_0x4d4cf1['id'],'name':_0x4d4cf1[_0x676c('0xe')],'key':_0x4d4cf1[_0x676c('0xf')],'active':_0x4d4cf1['active'],'Imap':{'status':_0x4d4cf1[_0x676c('0x10')][_0x676c('0x11')],'messageStatus':_0x4d4cf1[_0x676c('0x10')][_0x676c('0x12')],'total':_0x4d4cf1[_0x676c('0x10')][_0x676c('0x13')]}};if(_['isNil'](md5Accounts[_0x51671a])){md5Accounts[_0x51671a]={};}var _0x4d7b68=md5(JSON[_0x676c('0x14')](_0x1d11be));if(md5Accounts[_0x51671a][_0x676c('0x2')]!==_0x4d7b68){md5Accounts[_0x51671a][_0x676c('0x2')]=_0x4d7b68;io['emit'](_0x676c('0x15'),_0x1d11be);}};EmailChannel['prototype']['refresh']=function(_0x55dd7f){for(var _0x16c2d6 in _0x55dd7f){if(_0x55dd7f[_0x676c('0x16')](_0x16c2d6)){if(_0x55dd7f[_0x16c2d6][_0x676c('0x10')]&&_0x55dd7f[_0x16c2d6][_0x676c('0x17')]){var _0x32af2f=_0x55dd7f[_0x16c2d6]['Imap'];if(!_0x32af2f[_0x676c('0x18')]&&_0x55dd7f[_0x16c2d6]['provider']!=='custom')_0x32af2f[_0x676c('0x18')]=_0x55dd7f[_0x16c2d6][_0x676c('0x19')];if(!this[_0x676c('0xc')][_0x676c('0x16')](_0x32af2f['id'])){this[_0x676c('0xc')][_0x32af2f['id']]=new EmailImap(_0x32af2f,_0x55dd7f[_0x16c2d6]['email']);this[_0x676c('0xc')][_0x32af2f['id']]['on'](_0x676c('0x1a'),this['handleImapBox'][_0x676c('0x1b')](this,_0x16c2d6));this[_0x676c('0xc')][_0x32af2f['id']]['on'](_0x676c('0x5'),this['handleImapEmail'][_0x676c('0x1b')](this,_0x16c2d6));this[_0x676c('0xc')][_0x32af2f['id']]['on']('end',this[_0x676c('0x1c')][_0x676c('0x1b')](this,_0x16c2d6));this[_0x676c('0xc')][_0x32af2f['id']]['on']('error',this[_0x676c('0x1d')][_0x676c('0x1b')](this,_0x16c2d6));}}else{if(_[_0x676c('0x1e')](this['mailAccounts'][_0x16c2d6][_0x676c('0x10')])){this['mailAccounts'][_0x16c2d6][_0x676c('0x10')]={};}this['mailAccounts'][_0x16c2d6][_0x676c('0x10')][_0x676c('0x11')]='disabled';this['mailAccounts'][_0x16c2d6][_0x676c('0x10')]['messageStatus']='';this[_0x676c('0x1f')](_0x16c2d6);}}}};EmailChannel[_0x676c('0xd')][_0x676c('0x20')]=function(_0x1e3d23,_0x1e6b24){if(this[_0x676c('0xb')][_0x1e3d23]){this[_0x676c('0xb')][_0x1e3d23]['Imap'][_0x676c('0x11')]=_0x676c('0x21');this[_0x676c('0xb')][_0x1e3d23][_0x676c('0x10')][_0x676c('0x12')]=_0x1e6b24['name'];if(_0x1e6b24[_0x676c('0x22')]){this[_0x676c('0xb')][_0x1e3d23]['Imap']['total']=_0x1e6b24[_0x676c('0x22')][_0x676c('0x13')];}return this[_0x676c('0x1f')](_0x1e3d23);}};EmailChannel[_0x676c('0xd')][_0x676c('0x23')]=function(_0x26450b,_0x651e51){logger['info'](_0x676c('0x24'),_0x651e51['firstName'],_0x651e51['lastName'],_0x651e51[_0x676c('0x25')],_0x26450b);if(this[_0x676c('0xb')][_0x26450b]){return mailAccount[_0x676c('0x26')](_0x26450b,_0x651e51)[_0x676c('0x27')](function(_0x2c2d4f){if(_0x2c2d4f){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x676c('0x28')](function(_0x5add5b){logger['error'](_0x676c('0x29'),JSON[_0x676c('0x14')](_0x5add5b));});}};EmailChannel['prototype'][_0x676c('0x1c')]=function(_0x27c297){if(this[_0x676c('0xb')][_0x27c297]&&this[_0x676c('0xb')][_0x27c297][_0x676c('0x10')]){if(this[_0x676c('0xc')][this['mailAccounts'][_0x27c297][_0x676c('0x10')]['id']]){delete this[_0x676c('0xc')][this[_0x676c('0xb')][_0x27c297][_0x676c('0x10')]['id']];}this['mailAccounts'][_0x27c297][_0x676c('0x10')][_0x676c('0x2a')]=moment();this[_0x676c('0x1f')](_0x27c297);}};EmailChannel['prototype']['handleImapError']=function(_0x47f1be,_0x5b1e37){if(this[_0x676c('0xb')][_0x47f1be]){this[_0x676c('0xb')][_0x47f1be]['Imap'][_0x676c('0x11')]='error';this[_0x676c('0xb')][_0x47f1be][_0x676c('0x10')][_0x676c('0x12')]=_0x5b1e37;return this[_0x676c('0x1f')](_0x47f1be);}};EmailChannel[_0x676c('0xd')][_0x676c('0x2b')]=function(_0x21d876,_0x44f7e5){return this[_0x676c('0x2c')][_0x676c('0x2d')](_0x21d876,_0x44f7e5);};EmailChannel[_0x676c('0xd')][_0x676c('0x2e')]=function(_0x131191){var _0xe4ada4=this;if(this[_0x676c('0xb')][_0x131191['id']]){if(_[_0x676c('0x1e')](this[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')])){this[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')]={};}this[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')]['lastSync']=moment();return new BPromise(function(_0x17480b,_0x33082b){return _0xe4ada4['smtp']['verify'](_0x131191)[_0x676c('0x27')](function(_0xdba05e){_0xe4ada4[_0x676c('0xb')][_0x131191['id']]['Smtp'][_0x676c('0x11')]=_0x676c('0x30');_0xe4ada4[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')][_0x676c('0x12')]='';_0xe4ada4[_0x676c('0x1f')](_0x131191['id']);_0x17480b(_0xdba05e);})[_0x676c('0x28')](function(_0x229a68){_0xe4ada4[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')][_0x676c('0x11')]=_0x676c('0x31');_0xe4ada4[_0x676c('0xb')][_0x131191['id']][_0x676c('0x2f')][_0x676c('0x12')]=_0x229a68;_0xe4ada4[_0x676c('0x1f')](_0x131191['id']);_0x33082b(_0x229a68);});});}return this[_0x676c('0x2c')]['verify'](_0x131191);};module[_0x676c('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index baf7a61..bd8ce2f 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 _0x7513=['exports','lodash','util','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','handleReady','once','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','authentication','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty'];(function(_0x3ecde5,_0x11eb8a){var _0xcf4404=function(_0x4c819b){while(--_0x4c819b){_0x3ecde5['push'](_0x3ecde5['shift']());}};_0xcf4404(++_0x11eb8a);}(_0x7513,0x1e1));var _0x3751=function(_0x4811a5,_0x48fadc){_0x4811a5=_0x4811a5-0x0;var _0x1c6a8a=_0x7513[_0x4811a5];return _0x1c6a8a;};'use strict';var _=require(_0x3751('0x0'));var util=require(_0x3751('0x1'));var Imap=require('imap');var simpleParser=require(_0x3751('0x2'))[_0x3751('0x3')];var Iconv=require(_0x3751('0x4'))['Iconv'];var EventEmitter=require(_0x3751('0x5'))['EventEmitter'];var utils=require(_0x3751('0x6'));var logger=require(_0x3751('0x7'))(_0x3751('0x8'));function EmailImap(_0x2d5792,_0x3d10b5){this[_0x3751('0x9')]=_0x2d5792[_0x3751('0x9')];this[_0x3751('0xa')]=this[_0x3751('0xb')](_0x2d5792,_0x3d10b5);this[_0x3751('0xc')]=new Imap(this[_0x3751('0xa')]);this[_0x3751('0xc')]['once']('ready',this[_0x3751('0xd')]['bind'](this));this[_0x3751('0xc')][_0x3751('0xe')](_0x3751('0xf'),this[_0x3751('0x10')][_0x3751('0x11')](this));this[_0x3751('0xc')]['on'](_0x3751('0x12'),this[_0x3751('0x13')][_0x3751('0x11')](this));this['imap'][_0x3751('0x14')]();}util[_0x3751('0x15')](EmailImap,EventEmitter);EmailImap[_0x3751('0x16')]['getAccount']=function(_0x99ca67,_0x1030bc){var _0x30c090={'connTimeout':_0x99ca67[_0x3751('0x17')]?_0x99ca67[_0x3751('0x17')]*0x3e8:0x2710,'authTimeout':_0x99ca67[_0x3751('0x18')]?_0x99ca67[_0x3751('0x18')]*0x3e8:0x1388};if(_0x99ca67[_0x3751('0x19')]){_0x30c090[_0x3751('0x1a')]=_0x99ca67[_0x3751('0x1a')];if(_0x99ca67[_0x3751('0x1b')]){_0x30c090[_0x3751('0x1c')]=utils[_0x3751('0x1d')](_0x99ca67[_0x3751('0x1e')]['data5'],_0x99ca67[_0x3751('0x1a')]);}else{_0x30c090['password']=_0x99ca67['password'];}}else{if(_0x99ca67[_0x3751('0x1f')]){_0x30c090['user']=_0x99ca67[_0x3751('0x1a')];_0x30c090[_0x3751('0x20')]=_0x99ca67[_0x3751('0x20')];}}_0x30c090[_0x3751('0x8')]=_0x1030bc||_0x99ca67[_0x3751('0x1a')]||_0x3751('0x21');_0x30c090[_0x3751('0x22')]=_0x99ca67['host'];_0x30c090[_0x3751('0x23')]=_0x99ca67['port']||0x3e1;if(_0x99ca67[_0x3751('0x24')]){_0x30c090[_0x3751('0x24')]=!![];}else{_0x30c090[_0x3751('0x24')]=![];_0x30c090[_0x3751('0x25')]=_0x3751('0x26');}return _0x30c090;};EmailImap[_0x3751('0x16')]['handleReady']=function(){this[_0x3751('0xc')][_0x3751('0x27')](this[_0x3751('0x9')],![],this['handleOpenBox'][_0x3751('0x11')](this));};EmailImap[_0x3751('0x16')]['handleOpenBox']=function(_0x5d7b95,_0x3dc0e3){if(_0x5d7b95){this[_0x3751('0x13')](_0x5d7b95,!![]);}else{this[_0x3751('0x28')](_0x3751('0x29'),_0x3dc0e3);this[_0x3751('0x2a')]();}};EmailImap[_0x3751('0x16')][_0x3751('0x2b')]=function(_0x18575a){if(_0x18575a){this[_0x3751('0x13')](_0x18575a,!![]);}else{this[_0x3751('0xc')][_0x3751('0xf')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x3751('0x2c')](['UNSEEN'],this['handleReadUnseen'][_0x3751('0x11')](this));};EmailImap[_0x3751('0x16')][_0x3751('0x2d')]=function(_0x5c5bac,_0x4c63eb){if(_0x5c5bac){this[_0x3751('0x13')](_0x5c5bac,!![]);}else{if(_0x4c63eb[_0x3751('0x2e')]){try{var _0x222730=this[_0x3751('0xc')][_0x3751('0x2f')](_0x4c63eb[_0x3751('0x30')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x222730['on'](_0x3751('0x31'),this[_0x3751('0x32')][_0x3751('0x11')](this));_0x222730[_0x3751('0xe')](_0x3751('0x12'),this['handleFetchError'][_0x3751('0x11')](this));_0x222730[_0x3751('0xe')](_0x3751('0xf'),this['handleFetchEnd']['bind'](this));}catch(_0x40767){logger[_0x3751('0x12')](_0x40767);}}else{this[_0x3751('0xc')][_0x3751('0x33')](!![],this[_0x3751('0x2b')][_0x3751('0x11')](this));}}};EmailImap['prototype'][_0x3751('0x32')]=function(_0x5ac68c){_0x5ac68c['on']('body',this['handleMessageBody'][_0x3751('0x11')](this));_0x5ac68c[_0x3751('0xe')](_0x3751('0x34'),this[_0x3751('0x35')][_0x3751('0x11')](this));_0x5ac68c[_0x3751('0xe')](_0x3751('0xf'),this[_0x3751('0x36')][_0x3751('0x11')](this));};EmailImap[_0x3751('0x16')]['handleMessageBody']=function(_0x3830d1){simpleParser(_0x3830d1,{'Iconv':Iconv},this[_0x3751('0x37')][_0x3751('0x11')](this));};EmailImap[_0x3751('0x16')][_0x3751('0x35')]=function(){};EmailImap['prototype'][_0x3751('0x36')]=function(){};EmailImap['prototype'][_0x3751('0x37')]=function(_0x522695,_0x51de48){if(_0x522695){logger['error'](_0x522695);}else{var _0x543820=this;utils['parser'](this['account'],_0x51de48,function(_0x5cc764){_0x543820[_0x3751('0x28')]('email',_0x5cc764);});}};EmailImap[_0x3751('0x16')]['handleFetchEnd']=function(){this[_0x3751('0xc')]['closeBox'](!![],this[_0x3751('0x2b')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x65f8b3){this[_0x3751('0x13')](_0x65f8b3);this['imap'][_0x3751('0x33')](!![],this[_0x3751('0x2b')][_0x3751('0x11')](this));};EmailImap[_0x3751('0x16')][_0x3751('0x10')]=function(){this[_0x3751('0x28')](_0x3751('0xf'));};EmailImap[_0x3751('0x16')][_0x3751('0x13')]=function(_0x4ccb90,_0x75665f){logger['error'](_0x3751('0x13'),this[_0x3751('0xa')][_0x3751('0x8')],JSON[_0x3751('0x38')](_0x4ccb90));var _0x116326='';if(_0x4ccb90){if(_0x4ccb90[_0x3751('0x39')]){_0x116326=_0x4ccb90[_0x3751('0x39')];}else{for(var _0x4032c4 in _0x4ccb90){if(_0x4ccb90[_0x3751('0x3a')](_0x4032c4)){_0x116326+=_['upperFirst'](_0x4032c4)+':\x20'+_0x4ccb90[_0x4032c4]+'\x0a';}}}}if(_0x75665f){this[_0x3751('0xc')][_0x3751('0xf')]();}else{this[_0x3751('0x28')]('error',_0x116326);this['emit'](_0x3751('0xf'));}};module[_0x3751('0x3b')]=EmailImap; \ No newline at end of file +var _0x91d0=['textCode','hasOwnProperty','upperFirst','lodash','util','imap','events','EventEmitter','./utils','email','mailbox','account','getAccount','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','password','authentication','anonymous@xcally.com','host','tls','autotls','required','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','handleFetchError'];(function(_0x470ad3,_0x636d6c){var _0xfcb17b=function(_0x43ea9c){while(--_0x43ea9c){_0x470ad3['push'](_0x470ad3['shift']());}};_0xfcb17b(++_0x636d6c);}(_0x91d0,0x1bb));var _0x091d=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x91d0[_0x479509];return _0x382da8;};'use strict';var _=require(_0x091d('0x0'));var util=require(_0x091d('0x1'));var Imap=require(_0x091d('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x091d('0x3'))[_0x091d('0x4')];var utils=require(_0x091d('0x5'));var logger=require('../../../config/logger')(_0x091d('0x6'));function EmailImap(_0x17344f,_0x725d62){this[_0x091d('0x7')]=_0x17344f['mailbox'];this[_0x091d('0x8')]=this[_0x091d('0x9')](_0x17344f,_0x725d62);this[_0x091d('0x2')]=new Imap(this[_0x091d('0x8')]);this[_0x091d('0x2')]['once']('ready',this[_0x091d('0xa')][_0x091d('0xb')](this));this[_0x091d('0x2')][_0x091d('0xc')](_0x091d('0xd'),this[_0x091d('0xe')][_0x091d('0xb')](this));this[_0x091d('0x2')]['on'](_0x091d('0xf'),this[_0x091d('0x10')][_0x091d('0xb')](this));this['imap']['connect']();}util[_0x091d('0x11')](EmailImap,EventEmitter);EmailImap[_0x091d('0x12')][_0x091d('0x9')]=function(_0x23d343,_0x18897b){var _0x3270a2={'connTimeout':_0x23d343[_0x091d('0x13')]?_0x23d343[_0x091d('0x13')]*0x3e8:0x2710,'authTimeout':_0x23d343[_0x091d('0x14')]?_0x23d343[_0x091d('0x14')]*0x3e8:0x1388};if(_0x23d343['service']){_0x3270a2[_0x091d('0x15')]=_0x23d343[_0x091d('0x15')];if(_0x23d343[_0x091d('0x16')]){_0x3270a2[_0x091d('0x17')]=utils['generateXOAuth2Token'](_0x23d343['CloudProvider']['data5'],_0x23d343[_0x091d('0x15')]);}else{_0x3270a2[_0x091d('0x18')]=_0x23d343[_0x091d('0x18')];}}else{if(_0x23d343[_0x091d('0x19')]){_0x3270a2[_0x091d('0x15')]=_0x23d343[_0x091d('0x15')];_0x3270a2[_0x091d('0x18')]=_0x23d343[_0x091d('0x18')];}}_0x3270a2['email']=_0x18897b||_0x23d343['user']||_0x091d('0x1a');_0x3270a2[_0x091d('0x1b')]=_0x23d343['host'];_0x3270a2['port']=_0x23d343['port']||0x3e1;if(_0x23d343[_0x091d('0x1c')]){_0x3270a2['tls']=!![];}else{_0x3270a2[_0x091d('0x1c')]=![];_0x3270a2[_0x091d('0x1d')]=_0x091d('0x1e');}return _0x3270a2;};EmailImap[_0x091d('0x12')][_0x091d('0xa')]=function(){this[_0x091d('0x2')]['openBox'](this[_0x091d('0x7')],![],this['handleOpenBox'][_0x091d('0xb')](this));};EmailImap[_0x091d('0x12')][_0x091d('0x1f')]=function(_0xfd389a,_0x2c35cf){if(_0xfd389a){this[_0x091d('0x10')](_0xfd389a,!![]);}else{this[_0x091d('0x20')]('box',_0x2c35cf);this[_0x091d('0x21')]();}};EmailImap[_0x091d('0x12')][_0x091d('0x22')]=function(_0x534a4b){if(_0x534a4b){this['handleError'](_0x534a4b,!![]);}else{this[_0x091d('0x2')][_0x091d('0xd')]();this[_0x091d('0x20')](_0x091d('0xd'));}};EmailImap[_0x091d('0x12')][_0x091d('0x21')]=function(){this['imap'][_0x091d('0x23')]([_0x091d('0x24')],this[_0x091d('0x25')][_0x091d('0xb')](this));};EmailImap['prototype'][_0x091d('0x25')]=function(_0x48e6a1,_0x3e05ab){if(_0x48e6a1){this[_0x091d('0x10')](_0x48e6a1,!![]);}else{if(_0x3e05ab[_0x091d('0x26')]){try{var _0x803400=this[_0x091d('0x2')][_0x091d('0x27')](_0x3e05ab[_0x091d('0x28')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x803400['on'](_0x091d('0x29'),this[_0x091d('0x2a')]['bind'](this));_0x803400[_0x091d('0xc')](_0x091d('0xf'),this['handleFetchError']['bind'](this));_0x803400[_0x091d('0xc')](_0x091d('0xd'),this[_0x091d('0x2b')]['bind'](this));}catch(_0x5df4e3){logger[_0x091d('0xf')](_0x091d('0x25'),this[_0x091d('0x8')][_0x091d('0x6')],_0x5df4e3);this[_0x091d('0x2')]['closeBox'](!![],this[_0x091d('0x22')][_0x091d('0xb')](this));}}else{this[_0x091d('0x2')][_0x091d('0x2c')](!![],this[_0x091d('0x22')][_0x091d('0xb')](this));}}};EmailImap[_0x091d('0x12')]['handleFetchMessage']=function(_0x171291){_0x171291['on'](_0x091d('0x2d'),this[_0x091d('0x2e')][_0x091d('0xb')](this));_0x171291['once'](_0x091d('0x2f'),this['handleMessageAttributes']['bind'](this));_0x171291['once']('end',this[_0x091d('0x30')][_0x091d('0xb')](this));};EmailImap[_0x091d('0x12')][_0x091d('0x2e')]=function(_0x1bf63c){simpleParser(_0x1bf63c,{'Iconv':Iconv},this[_0x091d('0x31')]['bind'](this));};EmailImap[_0x091d('0x12')][_0x091d('0x32')]=function(){};EmailImap[_0x091d('0x12')][_0x091d('0x30')]=function(){};EmailImap[_0x091d('0x12')][_0x091d('0x31')]=function(_0x4f5f94,_0x475ddc){if(_0x4f5f94){logger[_0x091d('0xf')](_0x4f5f94);}else{var _0x5e5f8c=this;utils['parser'](this[_0x091d('0x8')],_0x475ddc,function(_0x1dcb1c){_0x5e5f8c[_0x091d('0x20')](_0x091d('0x6'),_0x1dcb1c);});}};EmailImap[_0x091d('0x12')][_0x091d('0x2b')]=function(){this[_0x091d('0x2')][_0x091d('0x2c')](!![],this[_0x091d('0x22')][_0x091d('0xb')](this));};EmailImap[_0x091d('0x12')][_0x091d('0x33')]=function(_0x1c14d9){this['handleError'](_0x1c14d9);this['imap'][_0x091d('0x2c')](!![],this[_0x091d('0x22')]['bind'](this));};EmailImap[_0x091d('0x12')]['handleEnd']=function(){this[_0x091d('0x20')](_0x091d('0xd'));};EmailImap[_0x091d('0x12')][_0x091d('0x10')]=function(_0x2ecdd9,_0xc66320){logger[_0x091d('0xf')](_0x091d('0x10'),this[_0x091d('0x8')]['email'],JSON['stringify'](_0x2ecdd9));var _0x586645='';if(_0x2ecdd9){if(_0x2ecdd9[_0x091d('0x34')]){_0x586645=_0x2ecdd9['textCode'];}else{for(var _0x560d0b in _0x2ecdd9){if(_0x2ecdd9[_0x091d('0x35')](_0x560d0b)){_0x586645+=_[_0x091d('0x36')](_0x560d0b)+':\x20'+_0x2ecdd9[_0x560d0b]+'\x0a';}}}}if(_0xc66320){this[_0x091d('0x2')][_0x091d('0xd')]();}else{this[_0x091d('0x20')](_0x091d('0xf'),_0x586645);this[_0x091d('0x20')](_0x091d('0xd'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1dc2d72..cfa302b 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 _0x1849=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','verify','Not\x20verifired'];(function(_0x202aa2,_0x584b66){var _0x4e8000=function(_0x400b30){while(--_0x400b30){_0x202aa2['push'](_0x202aa2['shift']());}};_0x4e8000(++_0x584b66);}(_0x1849,0x83));var _0x9184=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1849[_0x3947c9];return _0x2e7871;};'use strict';var nodemailer=require(_0x9184('0x0'));var inlineBase64=require(_0x9184('0x1'));function EmailSmtp(){}EmailSmtp[_0x9184('0x2')][_0x9184('0x3')]=function(_0x4dc9d7,_0x176d7a){return new Promise(function(_0x3861d7,_0x57515e){var _0x4bf41d=nodemailer[_0x9184('0x4')](_0x4dc9d7);_0x4bf41d[_0x9184('0x5')]('compile',inlineBase64());_0x4bf41d[_0x9184('0x6')](_0x176d7a,function(_0x4ccc28,_0x3a53fb){if(_0x4ccc28){_0x57515e(_0x4ccc28['toString']());}else{_0x3861d7(_0x3a53fb);}});});};EmailSmtp[_0x9184('0x2')][_0x9184('0x7')]=function(_0x68e6f1){return new Promise(function(_0x2a6f55,_0xe2b0d0){var _0x21c735=nodemailer[_0x9184('0x4')](_0x68e6f1);_0x21c735[_0x9184('0x7')](function(_0x52b490,_0x2d9925){if(_0x52b490){_0xe2b0d0(_0x52b490['toString']());}else{if(_0x2d9925){_0x2a6f55(_0x2d9925);}else{_0xe2b0d0(_0x9184('0x8'));}}});});};module[_0x9184('0x9')]=EmailSmtp; \ No newline at end of file +var _0x08ad=['nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail','toString','verify'];(function(_0x5bc1c1,_0x198fe9){var _0x6a2c0d=function(_0x212eb6){while(--_0x212eb6){_0x5bc1c1['push'](_0x5bc1c1['shift']());}};_0x6a2c0d(++_0x198fe9);}(_0x08ad,0x178));var _0xd08a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x08ad[_0x1cc8fe];return _0x230054;};'use strict';var nodemailer=require(_0xd08a('0x0'));var inlineBase64=require(_0xd08a('0x1'));function EmailSmtp(){}EmailSmtp[_0xd08a('0x2')]['send']=function(_0x472773,_0x3f9c7b){return new Promise(function(_0xdbaae7,_0x6ecafc){var _0x6836e2=nodemailer[_0xd08a('0x3')](_0x472773);_0x6836e2[_0xd08a('0x4')]('compile',inlineBase64());_0x6836e2[_0xd08a('0x5')](_0x3f9c7b,function(_0x4faedd,_0x33d55d){if(_0x4faedd){_0x6ecafc(_0x4faedd[_0xd08a('0x6')]());}else{_0xdbaae7(_0x33d55d);}});});};EmailSmtp[_0xd08a('0x2')][_0xd08a('0x7')]=function(_0x43fece){return new Promise(function(_0x5ca9d5,_0x32b133){var _0x42d6bc=nodemailer[_0xd08a('0x3')](_0x43fece);_0x42d6bc[_0xd08a('0x7')](function(_0x2a1452,_0x3644a7){if(_0x2a1452){_0x32b133(_0x2a1452[_0xd08a('0x6')]());}else{if(_0x3644a7){_0x5ca9d5(_0x3644a7);}else{_0x32b133('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 936ed13..15a48c1 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 _0xaa05=['Data','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','generate','@xcally.com','head','name','substring','indexOf','length','slice','join','Anonymous','isEmpty','anonymous','html','test','replace','attachments','push','filename','_SRC','_IMG','body','Empty\x20message

','Attachments','Title'];(function(_0x5da730,_0x27c81c){var _0x459c62=function(_0x506a8e){while(--_0x506a8e){_0x5da730['push'](_0x5da730['shift']());}};_0x459c62(++_0x27c81c);}(_0xaa05,0x120));var _0x5aa0=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0xaa05[_0x1ca9eb];return _0x2e284e;};'use strict';var _=require(_0x5aa0('0x0'));var moment=require(_0x5aa0('0x1'));var random=require(_0x5aa0('0x2'));var fs=require('fs');var path=require(_0x5aa0('0x3'));var util=require(_0x5aa0('0x4'));var tnef=require(_0x5aa0('0x5'));var logger=require(_0x5aa0('0x6'))(_0x5aa0('0x7'));var config=require(_0x5aa0('0x8'));function getAddress(_0x56b1c3){var _0x5603a8=_['head'](_0x56b1c3[_0x5aa0('0x9')]);return _0x5603a8&&_0x5603a8['address']?_0x5603a8[_0x5aa0('0xa')]:'anonymous'+random[_0x5aa0('0xb')](0x6)+_0x5aa0('0xc');}function getFirstName(_0x5a65d5){var _0x2adc56=_[_0x5aa0('0xd')](_0x5a65d5[_0x5aa0('0x9')]);if(_0x2adc56&&_0x2adc56[_0x5aa0('0xe')]){if(_0x2adc56['name']==_0x2adc56[_0x5aa0('0xa')]){return _0x2adc56[_0x5aa0('0xe')][_0x5aa0('0xf')](0x0,_0x2adc56[_0x5aa0('0xe')][_0x5aa0('0x10')]('@'));}var _0x57aaf5=_0x2adc56[_0x5aa0('0xe')]['split'](/\s+/);return _0x57aaf5[_0x5aa0('0x11')]>0x1?_0x57aaf5[_0x5aa0('0x12')](0x0,-0x1)[_0x5aa0('0x13')]('\x20'):_0x2adc56['name'];}return _0x5aa0('0x14');}function getLastName(_0x13211e){var _0x27e42b=_[_0x5aa0('0xd')](_0x13211e[_0x5aa0('0x9')]);if(_0x27e42b&&_0x27e42b[_0x5aa0('0xe')]){var _0x3f401a=_0x27e42b[_0x5aa0('0xe')]['split'](/\s+/);return _0x3f401a[_0x5aa0('0x11')]>0x1?_0x3f401a['pop']():'';}return'';}function getMails(_0x563801,_0x5c1dd9){var _0x3ae106='';for(var _0x526705=0x0;_0x526705<_0x5c1dd9[_0x5aa0('0x9')]['length'];_0x526705+=0x1){if(_0x5c1dd9['value'][_0x526705]['address']!==_0x563801){if(!_[_0x5aa0('0x15')](_0x3ae106)){_0x3ae106+=',';}_0x3ae106+=_0x5c1dd9[_0x5aa0('0x9')][_0x526705][_0x5aa0('0xe')]||_0x5c1dd9[_0x5aa0('0x9')][_0x526705][_0x5aa0('0xa')]||'';_0x3ae106+='\x20<';_0x3ae106+=_0x5c1dd9['value'][_0x526705]['address']?_0x5c1dd9[_0x5aa0('0x9')][_0x526705][_0x5aa0('0xa')]:_0x5aa0('0x16')+random[_0x5aa0('0xb')](0x6)+_0x5aa0('0xc');_0x3ae106+='>';}}return _0x3ae106;}function parseEmail(_0x538e28,_0x143bd2,_0x5662b8){if(_0x143bd2[_0x5aa0('0x17')]){var _0x29e124=/)<[^<]*)*<\/script>/gi;while(_0x29e124[_0x5aa0('0x18')](_0x143bd2[_0x5aa0('0x17')])){_0x143bd2[_0x5aa0('0x17')]=_0x143bd2[_0x5aa0('0x17')][_0x5aa0('0x19')](_0x29e124,'');}if(_0x143bd2['html']['includes']('{_0x43b302[_0x5aa0('0x1b')](_0x50481a[_0x5aa0('0x1c')]);});var _0x3e435f=/]+>/g;var _0x3e2f17=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x56a759=_0x143bd2[_0x5aa0('0x17')]['replace'](_0x3e2f17,_0x5aa0('0x1d'));var _0x37dba3=_0x56a759[_0x5aa0('0x19')](_0x3e435f,_0x5aa0('0x1e'));for(let _0x389c88=0x0;_0x389c88<_0x43b302['length'];_0x389c88++){var _0x5b2695=_0x37dba3[_0x5aa0('0x19')](_0x5aa0('0x1e'),'\x20[Attachment:\x20'+_0x43b302[_0x389c88]+'\x20]');_0x37dba3=_0x5b2695;}_0x143bd2[_0x5aa0('0x17')]=_0x37dba3;}_0x5662b8[_0x5aa0('0x1f')]=_0x143bd2[_0x5aa0('0x17')];}else{_0x5662b8['body']=_0x143bd2['textAsHtml'];}if(_0x5662b8[_0x5aa0('0x1f')]){_0x5662b8[_0x5aa0('0x1f')]=_0x5662b8[_0x5aa0('0x1f')][_0x5aa0('0x19')](/0x0){var _0x231e56=['Auto-Submitted:\x20auto-replied',_0x5aa0('0x30'),_0x5aa0('0x31')];for(var _0x5191eb=0x0;_0x5191eb<_0x143bd2[_0x5aa0('0x2f')][_0x5aa0('0x11')];_0x5191eb++){var _0x59b472=_[_0x5aa0('0x10')](_0x231e56,_0x143bd2[_0x5aa0('0x2f')][_0x5191eb][_0x5aa0('0x32')]);if(_0x59b472>=0x0){_0x5662b8[_0x5aa0('0x33')]=!![];}}}return _0x5662b8;}exports['parser']=function(_0x1cae65,_0x141378,_0x16b62c){var _0x59e21f={'from':getAddress(_0x141378['from']),'firstName':getFirstName(_0x141378[_0x5aa0('0x34')]),'lastName':getLastName(_0x141378['from']),'mapKey':_0x5aa0('0x7'),'message':{'from':getMails(_0x1cae65[_0x5aa0('0x7')],_0x141378[_0x5aa0('0x34')]),'to':_0x1cae65[_0x5aa0('0x7')],'cc':'','subject':_0x141378[_0x5aa0('0x35')]||'','messageId':_0x141378[_0x5aa0('0x36')],'inReplyTo':_0x141378[_0x5aa0('0x37')],'sentAt':moment(_0x141378[_0x5aa0('0x38')])[_0x5aa0('0x2a')](_0x5aa0('0x39')),'attach':![],'attachments':[]}};if(!_0x141378[_0x5aa0('0x17')]&&!_0x141378[_0x5aa0('0x3a')]){var _0x2d15f0=_[_0x5aa0('0x3b')](_0x141378[_0x5aa0('0x1a')],{'contentType':_0x5aa0('0x3c')});if(_0x2d15f0['length']){logger[_0x5aa0('0x3d')](util[_0x5aa0('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x141378[_0x5aa0('0x36')]));tnef['parseBuffer'](_[_0x5aa0('0x3e')](_0x2d15f0)[_0x5aa0('0x3f')],function(_0x97bcd3,_0x294a8d){if(_0x294a8d){_0x141378[_0x5aa0('0x17')]=_0x294a8d['BodyHTML']||_0x5aa0('0x40');if(_0x294a8d[_0x5aa0('0x41')]){for(var _0x43d2d8=0x0;_0x43d2d8<_0x294a8d[_0x5aa0('0x41')][_0x5aa0('0x11')];_0x43d2d8++){var _0x4c3e57=_0x294a8d[_0x5aa0('0x41')][_0x43d2d8];_0x59e21f[_0x5aa0('0x21')]['attachments'][_0x5aa0('0x1b')]({'filename':_0x4c3e57[_0x5aa0('0x42')],'content':Buffer[_0x5aa0('0x34')](_0x4c3e57[_0x5aa0('0x43')])});}}}_0x16b62c(parseEmail(_0x1cae65,_0x141378,_0x59e21f));});}else{_0x141378[_0x5aa0('0x17')]='

Empty\x20message

';_0x16b62c(parseEmail(_0x1cae65,_0x141378,_0x59e21f));}}else{_0x16b62c(parseEmail(_0x1cae65,_0x141378,_0x59e21f));}};exports['generateXOAuth2Token']=function(_0x5c0179,_0x4289df){var _0x2ec463=['user='+(_0x4289df||''),_0x5aa0('0x44')+_0x5c0179,'',''];return Buffer[_0x5aa0('0x34')](_0x2ec463['join'](''),_0x5aa0('0x45'))['toString'](_0x5aa0('0x46'));}; \ No newline at end of file +var _0x4d91=['content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','parseBuffer','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','../../../config/logger','email','head','value','address','generate','@xcally.com','name','substring','indexOf','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','includes','attachments','forEach','push','filename','_SRC','_IMG','replace','\x20]','body','0x1?_0x358b7d[_0x14d9('0xe')](0x0,-0x1)[_0x14d9('0xf')]('\x20'):_0x1dcc3d[_0x14d9('0xa')];}return _0x14d9('0x10');}function getLastName(_0x3d6f9b){var _0x4a1438=_['head'](_0x3d6f9b[_0x14d9('0x6')]);if(_0x4a1438&&_0x4a1438['name']){var _0x444bfe=_0x4a1438[_0x14d9('0xa')]['split'](/\s+/);return _0x444bfe['length']>0x1?_0x444bfe[_0x14d9('0x11')]():'';}return'';}function getMails(_0x94d8af,_0x58adb4){var _0x4b7e6e='';for(var _0x160452=0x0;_0x160452<_0x58adb4[_0x14d9('0x6')][_0x14d9('0xd')];_0x160452+=0x1){if(_0x58adb4[_0x14d9('0x6')][_0x160452][_0x14d9('0x7')]!==_0x94d8af){if(!_[_0x14d9('0x12')](_0x4b7e6e)){_0x4b7e6e+=',';}_0x4b7e6e+=_0x58adb4['value'][_0x160452][_0x14d9('0xa')]||_0x58adb4['value'][_0x160452][_0x14d9('0x7')]||'';_0x4b7e6e+='\x20<';_0x4b7e6e+=_0x58adb4[_0x14d9('0x6')][_0x160452][_0x14d9('0x7')]?_0x58adb4[_0x14d9('0x6')][_0x160452][_0x14d9('0x7')]:_0x14d9('0x13')+random[_0x14d9('0x8')](0x6)+_0x14d9('0x9');_0x4b7e6e+='>';}}return _0x4b7e6e;}function parseEmail(_0xf03f70,_0x587e92,_0x4d1079){if(_0x587e92[_0x14d9('0x14')]){var _0x45d231=/)<[^<]*)*<\/script>/gi;while(_0x45d231[_0x14d9('0x15')](_0x587e92[_0x14d9('0x14')])){_0x587e92['html']=_0x587e92[_0x14d9('0x14')]['replace'](_0x45d231,'');}if(_0x587e92['html'][_0x14d9('0x16')]('{_0x208784[_0x14d9('0x19')](_0x41e3bb[_0x14d9('0x1a')]);});var _0x315458=/]+>/g;var _0x1cfd93=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x589721=_0x587e92[_0x14d9('0x14')]['replace'](_0x1cfd93,_0x14d9('0x1b'));var _0x4195c7=_0x589721['replace'](_0x315458,_0x14d9('0x1c'));for(let _0x12148e=0x0;_0x12148e<_0x208784[_0x14d9('0xd')];_0x12148e++){var _0x4d3e5a=_0x4195c7[_0x14d9('0x1d')](_0x14d9('0x1c'),'\x20[Attachment:\x20'+_0x208784[_0x12148e]+_0x14d9('0x1e'));_0x4195c7=_0x4d3e5a;}_0x587e92['html']=_0x4195c7;}_0x4d1079[_0x14d9('0x1f')]=_0x587e92[_0x14d9('0x14')];}else{_0x4d1079['body']=_0x587e92['textAsHtml'];}if(_0x4d1079[_0x14d9('0x1f')]){_0x4d1079[_0x14d9('0x1f')]=_0x4d1079[_0x14d9('0x1f')][_0x14d9('0x1d')](/0x0){var _0x49ddfa=['Auto-Submitted:\x20auto-replied',_0x14d9('0x30'),_0x14d9('0x31')];for(var _0x3658f1=0x0;_0x3658f1<_0x587e92[_0x14d9('0x2f')]['length'];_0x3658f1++){var _0x39fe92=_[_0x14d9('0xc')](_0x49ddfa,_0x587e92[_0x14d9('0x2f')][_0x3658f1][_0x14d9('0x32')]);if(_0x39fe92>=0x0){_0x4d1079[_0x14d9('0x33')]=!![];}}}return _0x4d1079;}exports['parser']=function(_0x4e1698,_0x391e2c,_0x346031){var _0x52b27c={'from':getAddress(_0x391e2c[_0x14d9('0x34')]),'firstName':getFirstName(_0x391e2c[_0x14d9('0x34')]),'lastName':getLastName(_0x391e2c[_0x14d9('0x34')]),'mapKey':_0x14d9('0x4'),'message':{'from':getMails(_0x4e1698[_0x14d9('0x4')],_0x391e2c[_0x14d9('0x34')]),'to':_0x4e1698['email'],'cc':'','subject':_0x391e2c['subject']||'','messageId':_0x391e2c['messageId'],'inReplyTo':_0x391e2c[_0x14d9('0x35')],'sentAt':moment(_0x391e2c[_0x14d9('0x36')])[_0x14d9('0x28')](_0x14d9('0x37')),'attach':![],'attachments':[]}};if(!_0x391e2c[_0x14d9('0x14')]&&!_0x391e2c['textAsHtml']){var _0x50b39c=_[_0x14d9('0x38')](_0x391e2c[_0x14d9('0x17')],{'contentType':'application/ms-tnef'});if(_0x50b39c[_0x14d9('0xd')]){logger[_0x14d9('0x39')](util[_0x14d9('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x391e2c['messageId']));tnef[_0x14d9('0x3a')](_['first'](_0x50b39c)[_0x14d9('0x2d')],function(_0x378a14,_0x164f2b){if(_0x164f2b){_0x391e2c[_0x14d9('0x14')]=_0x164f2b['BodyHTML']||_0x14d9('0x3b');if(_0x164f2b[_0x14d9('0x3c')]){for(var _0x4bff45=0x0;_0x4bff45<_0x164f2b[_0x14d9('0x3c')]['length'];_0x4bff45++){var _0x86fc63=_0x164f2b[_0x14d9('0x3c')][_0x4bff45];_0x52b27c['message'][_0x14d9('0x17')][_0x14d9('0x19')]({'filename':_0x86fc63[_0x14d9('0x3d')],'content':Buffer[_0x14d9('0x34')](_0x86fc63[_0x14d9('0x3e')])});}}}_0x346031(parseEmail(_0x4e1698,_0x391e2c,_0x52b27c));});}else{_0x391e2c[_0x14d9('0x14')]=_0x14d9('0x3b');_0x346031(parseEmail(_0x4e1698,_0x391e2c,_0x52b27c));}}else{_0x346031(parseEmail(_0x4e1698,_0x391e2c,_0x52b27c));}};exports[_0x14d9('0x3f')]=function(_0x523fb6,_0x212085){var _0x326a7b=[_0x14d9('0x40')+(_0x212085||''),_0x14d9('0x41')+_0x523fb6,'',''];return Buffer['from'](_0x326a7b[_0x14d9('0xf')](''),_0x14d9('0x42'))[_0x14d9('0x43')](_0x14d9('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e4ca3ee..283885f 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 _0x2e0c=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x26222c,_0x336f8c){var _0x29a78e=function(_0x14b17e){while(--_0x14b17e){_0x26222c['push'](_0x26222c['shift']());}};_0x29a78e(++_0x336f8c);}(_0x2e0c,0x17e));var _0xc2e0=function(_0x4b935f,_0x404ec3){_0x4b935f=_0x4b935f-0x0;var _0x4f9254=_0x2e0c[_0x4b935f];return _0x4f9254;};'use strict';var _=require(_0xc2e0('0x0'));function MailAccount(_0x48fce3){this['id']=_0x48fce3['id']||0x0;this['name']=_0x48fce3[_0xc2e0('0x1')]||_0xc2e0('0x2');this['key']=_0x48fce3[_0xc2e0('0x3')]||_0xc2e0('0x4');this[_0xc2e0('0x5')]=_0x48fce3['active']||![];this['Imap']=_0x48fce3[_0xc2e0('0x6')]||[];this['Smtp']=_0x48fce3[_0xc2e0('0x7')]||[];}module[_0xc2e0('0x8')]=MailAccount; \ No newline at end of file +var _0x8a92=['lodash','name','key','SERV','active','Imap','Smtp','exports'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x8a92,0x140));var _0x28a9=function(_0x24389f,_0x435920){_0x24389f=_0x24389f-0x0;var _0x12221b=_0x8a92[_0x24389f];return _0x12221b;};'use strict';var _=require(_0x28a9('0x0'));function MailAccount(_0xafdd5c){this['id']=_0xafdd5c['id']||0x0;this[_0x28a9('0x1')]=_0xafdd5c['name']||'Service';this[_0x28a9('0x2')]=_0xafdd5c[_0x28a9('0x2')]||_0x28a9('0x3');this[_0x28a9('0x4')]=_0xafdd5c[_0x28a9('0x4')]||![];this[_0x28a9('0x5')]=_0xafdd5c['Imap']||[];this[_0x28a9('0x6')]=_0xafdd5c['Smtp']||[];}module[_0x28a9('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 9a0c845..6f2cb60 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 _0x7112=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts'];(function(_0x5070dc,_0xa6ec7a){var _0x575f1d=function(_0x179785){while(--_0x179785){_0x5070dc['push'](_0x5070dc['shift']());}};_0x575f1d(++_0xa6ec7a);}(_0x7112,0xed));var _0x2711=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7112[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2711('0x0'));var MailAccount=require(_0x2711('0x1'));var Realtime=function(){this[_0x2711('0x2')]={};};function freeIsNotKey(_0x57b71e,_0x4bfe2c,_0x4607d1){var _0x49ae78=_['mapKeys'](_0x57b71e,function(_0x5be9ba,_0x46e2fd){return _0x5be9ba[_0x4607d1];});for(var _0x432436 in _0x4bfe2c){if(_0x4bfe2c[_0x2711('0x3')](_0x432436)){if(!_0x49ae78[_0x432436]){delete _0x4bfe2c[_0x432436];}}}}Realtime[_0x2711('0x4')][_0x2711('0x5')]=function(_0x1a92eb,_0x1eb01b){for(var _0x2ba9de in _0x1eb01b){if(_0x1a92eb[_0x2711('0x3')](_0x2ba9de)){_0x1a92eb[_0x2ba9de]=_0x1eb01b[_0x2ba9de];}}};Realtime[_0x2711('0x4')][_0x2711('0x6')]=function(){var _0x4c41d8=this;return function(_0x16683b){if(_0x16683b){freeIsNotKey(_0x16683b,_0x4c41d8[_0x2711('0x2')],'id');for(var _0x1c1c13=0x0,_0x16e219={},_0x36d6db={};_0x1c1c13<_0x16683b[_0x2711('0x7')];_0x1c1c13+=0x1){_0x16e219=_0x16683b[_0x1c1c13];if(_[_0x2711('0x8')](_0x4c41d8['mailAccounts'][_0x16e219['id']])){_0x4c41d8[_0x2711('0x2')][_0x16e219['id']]=new MailAccount(_0x16e219);}else{_[_0x2711('0x9')](_0x4c41d8[_0x2711('0x2')][_0x16e219['id']],_0x16e219);}}}return _0x4c41d8[_0x2711('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x715f=['initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x1a4bbb,_0x175dcf){var _0x3f7098=function(_0x3912c1){while(--_0x3912c1){_0x1a4bbb['push'](_0x1a4bbb['shift']());}};_0x3f7098(++_0x175dcf);}(_0x715f,0x191));var _0xf715=function(_0x22a771,_0x522694){_0x22a771=_0x22a771-0x0;var _0x48125a=_0x715f[_0x22a771];return _0x48125a;};'use strict';var _=require(_0xf715('0x0'));var MailAccount=require(_0xf715('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3fb62f,_0xf375df,_0x13edbc){var _0x465399=_[_0xf715('0x2')](_0x3fb62f,function(_0x4bc079,_0x1e4059){return _0x4bc079[_0x13edbc];});for(var _0x4e45df in _0xf375df){if(_0xf375df[_0xf715('0x3')](_0x4e45df)){if(!_0x465399[_0x4e45df]){delete _0xf375df[_0x4e45df];}}}}Realtime[_0xf715('0x4')][_0xf715('0x5')]=function(_0x4dc8c4,_0x3c0b05){for(var _0x5c73a1 in _0x3c0b05){if(_0x4dc8c4[_0xf715('0x3')](_0x5c73a1)){_0x4dc8c4[_0x5c73a1]=_0x3c0b05[_0x5c73a1];}}};Realtime[_0xf715('0x4')][_0xf715('0x6')]=function(){var _0x3c7fb1=this;return function(_0x5e3bac){if(_0x5e3bac){freeIsNotKey(_0x5e3bac,_0x3c7fb1[_0xf715('0x7')],'id');for(var _0x3dbb28=0x0,_0x592296={},_0x1a09f4={};_0x3dbb28<_0x5e3bac[_0xf715('0x8')];_0x3dbb28+=0x1){_0x592296=_0x5e3bac[_0x3dbb28];if(_['isUndefined'](_0x3c7fb1[_0xf715('0x7')][_0x592296['id']])){_0x3c7fb1[_0xf715('0x7')][_0x592296['id']]=new MailAccount(_0x592296);}else{_[_0xf715('0x9')](_0x3c7fb1['mailAccounts'][_0x592296['id']],_0x592296);}}}return _0x3c7fb1[_0xf715('0x7')];};};module[_0xf715('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f7474f0..4b20414 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 _0x87d8=['active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider','service','email'];(function(_0x217c57,_0x56f505){var _0x18da08=function(_0x54973c){while(--_0x54973c){_0x217c57['push'](_0x217c57['shift']());}};_0x18da08(++_0x56f505);}(_0x87d8,0x1a9));var _0x887d=function(_0xc4e092,_0x5059f7){_0xc4e092=_0xc4e092-0x0;var _0xa4f542=_0x87d8[_0xc4e092];return _0xa4f542;};'use strict';var client=require('../client');exports[_0x887d('0x0')]=function(){return function(){return client[_0x887d('0x1')](_0x887d('0x2'),{'options':{'attributes':['id',_0x887d('0x3'),_0x887d('0x4'),_0x887d('0x5'),_0x887d('0x6'),_0x887d('0x7'),_0x887d('0x8'),_0x887d('0x9'),_0x887d('0xa')],'raw':![],'include':[{'model':_0x887d('0xb'),'as':_0x887d('0xc'),'include':[{'model':_0x887d('0xd'),'attributes':['id',_0x887d('0x3'),'service',_0x887d('0xe'),_0x887d('0xf')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x887d('0x3'),_0x887d('0x5'),_0x887d('0xe'),_0x887d('0xf')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x887d('0x10')]=function(_0x1ab39e,_0x2dac84){return client[_0x887d('0x1')](_0x887d('0x11'),{'account':{'id':_0x1ab39e},'body':_0x2dac84,'log':_0x887d('0x11')});}; \ No newline at end of file +var _0xe9e7=['provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x156b18,_0x59b30a){_0x156b18=_0x156b18-0x0;var _0x48ead0=_0xe9e7[_0x156b18];return _0x48ead0;};'use strict';var client=require(_0x7e9e('0x0'));exports[_0x7e9e('0x1')]=function(){return function(){return client[_0x7e9e('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x7e9e('0x3'),_0x7e9e('0x4'),_0x7e9e('0x5'),_0x7e9e('0x6'),_0x7e9e('0x7'),_0x7e9e('0x8'),_0x7e9e('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0x7e9e('0xa'),'as':_0x7e9e('0xb'),'include':[{'model':_0x7e9e('0xc'),'attributes':['id','name',_0x7e9e('0x5'),'type',_0x7e9e('0xd')],'as':_0x7e9e('0xc')}]},{'model':_0x7e9e('0xe'),'as':_0x7e9e('0xf'),'include':[{'model':_0x7e9e('0xc'),'attributes':['id',_0x7e9e('0x3'),_0x7e9e('0x5'),_0x7e9e('0x10'),_0x7e9e('0xd')],'as':_0x7e9e('0xc')}]}]},'log':_0x7e9e('0x11')});};};exports[_0x7e9e('0x12')]=function(_0x499603,_0x498a95){return client['Request'](_0x7e9e('0x13'),{'account':{'id':_0x499603},'body':_0x498a95,'log':_0x7e9e('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index cf54102..f3c5ce7 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 _0xb3b9=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x428b68,_0x279233){var _0x5d9c3=function(_0x1edee7){while(--_0x1edee7){_0x428b68['push'](_0x428b68['shift']());}};_0x5d9c3(++_0x279233);}(_0xb3b9,0xf3));var _0x9b3b=function(_0x52fa5e,_0x38f086){_0x52fa5e=_0x52fa5e-0x0;var _0x3e3cda=_0xb3b9[_0x52fa5e];return _0x3e3cda;};'use strict';var client=require(_0x9b3b('0x0'));exports[_0x9b3b('0x1')]=function(){return client[_0x9b3b('0x2')](_0x9b3b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9b3b('0x4')]},'log':_0x9b3b('0x5')});}; \ No newline at end of file +var _0x829b=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x5b52af,_0x4f6085){var _0x22a4e5=function(_0x4c00f0){while(--_0x4c00f0){_0x5b52af['push'](_0x5b52af['shift']());}};_0x22a4e5(++_0x4f6085);}(_0x829b,0x73));var _0xb829=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x829b[_0x2b9b7f];return _0x4ed19a;};'use strict';var client=require('../client');exports[_0xb829('0x0')]=function(){return client[_0xb829('0x1')](_0xb829('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb829('0x3')]},'log':_0xb829('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 1c437af..5efeb0f 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 a4276ac..25aaa1d 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 _0x0d06=['default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis'];(function(_0x1ac283,_0x41468f){var _0x23c45e=function(_0x81bf67){while(--_0x81bf67){_0x1ac283['push'](_0x1ac283['shift']());}};_0x23c45e(++_0x41468f);}(_0x0d06,0x143));var _0x60d0=function(_0x48ccc4,_0x4045e4){_0x48ccc4=_0x48ccc4-0x0;var _0x49d8bd=_0x0d06[_0x48ccc4];return _0x49d8bd;};'use strict';var _=require(_0x60d0('0x0'));var http=require(_0x60d0('0x1'));var express=require('express');var sticky=require(_0x60d0('0x2'));var Redis=require('ioredis');var config=require(_0x60d0('0x3'));var app=express();var server=http[_0x60d0('0x4')](app);server[_0x60d0('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x60d0('0x6'))(server,{'transports':[_0x60d0('0x7'),_0x60d0('0x8')]});config['redis']=_['defaults'](config[_0x60d0('0x9')],{'host':_0x60d0('0xa'),'port':0x18eb});socketio[_0x60d0('0xb')](require(_0x60d0('0xc'))({'pubClient':new Redis(config[_0x60d0('0x9')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x60d0('0xd')]();require(_0x60d0('0xe'))[_0x60d0('0xd')](socketio);require(_0x60d0('0xf'))[_0x60d0('0xd')](app);require(_0x60d0('0x10'))['default'](app);}else{server['once'](_0x60d0('0x11'),function(){console[_0x60d0('0x12')](_0x60d0('0x13'),config['port']);});}exports=module[_0x60d0('0x14')]=app; \ No newline at end of file +var _0x3423=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','listening','log','exports','lodash','http','sticky-session','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x3423,0x155));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var http=require(_0x3342('0x1'));var express=require('express');var sticky=require(_0x3342('0x2'));var Redis=require('ioredis');var config=require(_0x3342('0x3'));var app=express();var server=http[_0x3342('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x3342('0x5')](server,config[_0x3342('0x6')])){var socketio=require(_0x3342('0x7'))(server,{'transports':[_0x3342('0x8'),_0x3342('0x9')]});config[_0x3342('0xa')]=_[_0x3342('0xb')](config[_0x3342('0xa')],{'host':_0x3342('0xc'),'port':0x18eb});socketio[_0x3342('0xd')](require(_0x3342('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3342('0xa')])}));require(_0x3342('0xf'))[_0x3342('0x10')]();require(_0x3342('0x11'))[_0x3342('0x10')](socketio);require(_0x3342('0x12'))['default'](app);require('../../routes')[_0x3342('0x10')](app);}else{server['once'](_0x3342('0x13'),function(){console[_0x3342('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3342('0x6')]);});}exports=module[_0x3342('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index cc89983..0bb2381 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 _0x1ccf=['bluebird','../../config/logger','client','http','debug','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x1ccf,0x16b));var _0xf1cc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1ccf[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0xf1cc('0x0'));var BPromise=require(_0xf1cc('0x1'));var logger=require(_0xf1cc('0x2'))('routing');var client=jayson[_0xf1cc('0x3')][_0xf1cc('0x4')]({'port':0x2329});client['Request']=function(_0x56fa2f,_0x39bff4){return new BPromise(function(_0x8383c3,_0x31819f){return client['request'](_0x56fa2f,_0x39bff4)['then'](function(_0x4d9aa6){logger[_0xf1cc('0x5')](_0xf1cc('0x6'),_0xf1cc('0x7'),_0x56fa2f,_0x39bff4,_0x4d9aa6);if(_0x4d9aa6[_0xf1cc('0x8')]){logger[_0xf1cc('0x8')](_0xf1cc('0x6'),_0xf1cc('0x7'),_0x56fa2f,_0x4d9aa6[_0xf1cc('0x8')][_0xf1cc('0x9')],_0x39bff4);return _0x31819f(_0x4d9aa6[_0xf1cc('0x8')][_0xf1cc('0x9')]);}else{return _0x8383c3(_0x4d9aa6[_0xf1cc('0xa')]);}})[_0xf1cc('0xb')](function(_0x1f36d8){logger['error'](_0xf1cc('0x6'),_0xf1cc('0x7'),_0x56fa2f,_0x1f36d8,_0x39bff4);return _0x31819f(_0x1f36d8);});});};module[_0xf1cc('0xc')]=client; \ No newline at end of file +var _0x4017=['catch','routing','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x4017,0x1b6));var _0x7401=function(_0x39999e,_0x3e7f70){_0x39999e=_0x39999e-0x0;var _0x524116=_0x4017[_0x39999e];return _0x524116;};'use strict';var jayson=require(_0x7401('0x0'));var BPromise=require(_0x7401('0x1'));var logger=require(_0x7401('0x2'))('routing');var client=jayson[_0x7401('0x3')][_0x7401('0x4')]({'port':0x2329});client[_0x7401('0x5')]=function(_0x32daeb,_0x3a6347){return new BPromise(function(_0x5e0c4c,_0x3c1522){return client[_0x7401('0x6')](_0x32daeb,_0x3a6347)[_0x7401('0x7')](function(_0x39c480){logger[_0x7401('0x8')](_0x7401('0x9'),'routing',_0x32daeb,_0x3a6347,_0x39c480);if(_0x39c480[_0x7401('0xa')]){logger['error'](_0x7401('0x9'),'routing',_0x32daeb,_0x39c480[_0x7401('0xa')][_0x7401('0xb')],_0x3a6347);return _0x3c1522(_0x39c480[_0x7401('0xa')][_0x7401('0xb')]);}else{return _0x5e0c4c(_0x39c480['result']);}})[_0x7401('0xc')](function(_0x195f36){logger['error']('rpc',_0x7401('0xd'),_0x32daeb,_0x195f36,_0x3a6347);return _0x3c1522(_0x195f36);});});};module[_0x7401('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d844d90..746c5bb 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 _0x2642=['getAgents','initAgents','then','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x2642,0xa9));var _0x2264=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2642[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x2264('0x0'));var server=require(_0x2264('0x1'));var Realtime=require('./realtime');var user=require(_0x2264('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x2264('0x3'));var mailQueue=require(_0x2264('0x4'));var faxQueue=require(_0x2264('0x5'));var whatsappQueue=require(_0x2264('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x2264('0x7')]())['then'](realtime[_0x2264('0x8')]())[_0x2264('0x9')](interval['getIntervals']())[_0x2264('0x9')](realtime['initIntervals']())[_0x2264('0x9')](openchannelQueue[_0x2264('0xa')]())[_0x2264('0x9')](realtime[_0x2264('0xb')]())[_0x2264('0x9')](chatQueue[_0x2264('0xc')]())['then'](realtime[_0x2264('0xd')]())['then'](smsQueue['getSmsQueues']())[_0x2264('0x9')](realtime['initSmsQueues']())[_0x2264('0x9')](mailQueue[_0x2264('0xe')]())[_0x2264('0x9')](realtime[_0x2264('0xf')]())[_0x2264('0x9')](faxQueue[_0x2264('0x10')]())[_0x2264('0x9')](realtime[_0x2264('0x11')]())[_0x2264('0x9')](whatsappQueue[_0x2264('0x12')]())['then'](realtime[_0x2264('0x13')]())[_0x2264('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x169b7a){return initRealtime();})[_0x2264('0x9')](function(_0x2bdd49){return setInterval(initRealtime,0x1388);})[_0x2264('0x14')](function(_0x2d26d5){console[_0x2264('0x15')](_0x2d26d5);});}main(); \ No newline at end of file +var _0x1530=['initWhatsappQueues','listen','log','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0x1530,0x15c));var _0x0153=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1530[_0xae7c2f];return _0x5d7001;};'use strict';var BPromise=require('bluebird');var server=require(_0x0153('0x0'));var Realtime=require(_0x0153('0x1'));var user=require('./rpc/user');var interval=require(_0x0153('0x2'));var openchannelQueue=require(_0x0153('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x0153('0x4'));var mailQueue=require(_0x0153('0x5'));var faxQueue=require(_0x0153('0x6'));var whatsappQueue=require(_0x0153('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x0153('0x8')]())[_0x0153('0x9')](realtime['initAgents']())['then'](interval[_0x0153('0xa')]())['then'](realtime[_0x0153('0xb')]())['then'](openchannelQueue[_0x0153('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0x0153('0x9')](chatQueue[_0x0153('0xd')]())[_0x0153('0x9')](realtime[_0x0153('0xe')]())[_0x0153('0x9')](smsQueue['getSmsQueues']())['then'](realtime[_0x0153('0xf')]())[_0x0153('0x9')](mailQueue[_0x0153('0x10')]())['then'](realtime['initMailQueues']())[_0x0153('0x9')](faxQueue[_0x0153('0x11')]())[_0x0153('0x9')](realtime[_0x0153('0x12')]())['then'](whatsappQueue[_0x0153('0x13')]())[_0x0153('0x9')](realtime[_0x0153('0x14')]())[_0x0153('0x9')](function(){return realtime;});}function main(){return server[_0x0153('0x15')](realtime)[_0x0153('0x9')](function(_0x2052a9){return initRealtime();})['then'](function(_0x318bbb){return setInterval(initRealtime,0x1388);})['catch'](function(_0x563b54){console[_0x0153('0x16')](_0x563b54);});}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 2fc24d6..3932849 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x57c498,_0x28cd86){var _0x46cd67=function(_0x41a29c){while(--_0x41a29c){_0x57c498['push'](_0x57c498['shift']());}};_0x46cd67(++_0x28cd86);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=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(_0x42bb10,_0x9a917f){var _0x4a0783=function(_0x2b3a40){while(--_0x2b3a40){_0x42bb10['push'](_0x42bb10['shift']());}};_0x4a0783(++_0x9a917f);}(_0xe14b,0x93));var _0xbe14=function(_0x2caedc,_0x208068){_0x2caedc=_0x2caedc-0x0;var _0x3f2ec3=_0xe14b[_0x2caedc];return _0x3f2ec3;};'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 ce8cd70..9ebf74d 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 _0x0bd0=['result','catch','SendMail','bluebird','jayson/promise','http','request','then','error','message'];(function(_0x269bbf,_0x42dcac){var _0x23caa3=function(_0x21bdb2){while(--_0x21bdb2){_0x269bbf['push'](_0x269bbf['shift']());}};_0x23caa3(++_0x42dcac);}(_0x0bd0,0xdf));var _0x00bd=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0bd0[_0x4c12ec];return _0x3ae42c;};'use strict';var BPromise=require(_0x00bd('0x0'));var jayson=require(_0x00bd('0x1'));var client=jayson['client'][_0x00bd('0x2')]({'port':0x232b});function request(_0x5cd670,_0x2d71ac){return new BPromise(function(_0x5d149c,_0x280fed){return client[_0x00bd('0x3')](_0x5cd670,_0x2d71ac)[_0x00bd('0x4')](function(_0x7cc239){if(_0x7cc239[_0x00bd('0x5')]){return _0x280fed(_0x7cc239[_0x00bd('0x5')][_0x00bd('0x6')]);}else{return _0x5d149c(_0x7cc239[_0x00bd('0x7')]);}})[_0x00bd('0x8')](function(_0x4b9c71){return _0x280fed(_0x4b9c71);});});}exports['sendMailMessage']=function(_0x3ad586,_0x5c51af){return request(_0x00bd('0x9'),{'account':_0x3ad586,'message':_0x5c51af});}; \ No newline at end of file +var _0x8604=['message','result','sendMailMessage','jayson/promise','error'];(function(_0x180ee9,_0x2d8d1a){var _0x38486e=function(_0x72f311){while(--_0x72f311){_0x180ee9['push'](_0x180ee9['shift']());}};_0x38486e(++_0x2d8d1a);}(_0x8604,0xee));var _0x4860=function(_0x20d690,_0x4e17d9){_0x20d690=_0x20d690-0x0;var _0x45a9a5=_0x8604[_0x20d690];return _0x45a9a5;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4860('0x0'));var client=jayson['client']['http']({'port':0x232b});function request(_0x41ca7,_0x385048){return new BPromise(function(_0x1c1f8d,_0x12ea34){return client['request'](_0x41ca7,_0x385048)['then'](function(_0x2836d2){if(_0x2836d2[_0x4860('0x1')]){return _0x12ea34(_0x2836d2['error'][_0x4860('0x2')]);}else{return _0x1c1f8d(_0x2836d2[_0x4860('0x3')]);}})['catch'](function(_0x19abae){return _0x12ea34(_0x19abae);});});}exports[_0x4860('0x4')]=function(_0x9a47fe,_0x50ae0f){return request('SendMail',{'account':_0x9a47fe,'message':_0x50ae0f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a691fe4..d57f098 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 _0x5430=['mailWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','mailCurrentCapacity','faxStatusTime','busy'];(function(_0x2db055,_0x5bde11){var _0xb2f3a4=function(_0x4719b8){while(--_0x4719b8){_0x2db055['push'](_0x2db055['shift']());}};_0xb2f3a4(++_0x5bde11);}(_0x5430,0x10c));var _0x0543=function(_0x5895da,_0x4a8204){_0x5895da=_0x5895da-0x0;var _0xd6b69d=_0x5430[_0x5895da];return _0xd6b69d;};'use strict';var _=require(_0x0543('0x0'));var md5=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var Redis=require(_0x0543('0x3'));var config=require(_0x0543('0x4'));config[_0x0543('0x5')]=_['defaults'](config['redis'],{'host':_0x0543('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0xce0b65){this['id']=_0xce0b65['id']||0x0;this[_0x0543('0x7')]=_0xce0b65[_0x0543('0x7')]||'';this[_0x0543('0x8')]=_0xce0b65[_0x0543('0x8')]||!![];this['voicePause']=_0xce0b65[_0x0543('0x9')]||![];this[_0x0543('0xa')]=_0xce0b65[_0x0543('0xa')]||![];this[_0x0543('0xb')]=_0xce0b65[_0x0543('0xb')]||![];this[_0x0543('0xc')]=_0xce0b65['faxPause']||![];this[_0x0543('0xd')]=_0xce0b65[_0x0543('0xd')]||![];this['openchannelPause']=_0xce0b65[_0x0543('0xe')]||![];this[_0x0543('0xf')]=_0x0543('0x10');this[_0x0543('0x11')]=0x0;this[_0x0543('0x12')]=_0xce0b65[_0x0543('0x12')]||0x0;this[_0x0543('0x13')]=0x0;this[_0x0543('0x14')]=_0x0543('0x10');this[_0x0543('0x15')]=0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x0543('0x17')]=_0x0543('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0xce0b65[_0x0543('0x18')]||0x0;this[_0x0543('0x19')]=0x0;this[_0x0543('0x1a')]=_0x0543('0x10');this[_0x0543('0x1b')]=0x0;this['smsCapacity']=_0xce0b65[_0x0543('0x1c')]||0x0;this[_0x0543('0x1d')]=0x0;this[_0x0543('0x1e')]=_0x0543('0x10');this[_0x0543('0x1f')]=0x0;this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x0543('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')]||0x0;this[_0x0543('0x23')]=0x0;this['busy']=![];this[_0x0543('0x24')]=undefined;this['md5']='';this[_0x0543('0x25')]={};this[_0x0543('0x26')]={};this['mailWaitingInteractions']={};this[_0x0543('0x27')]={};this[_0x0543('0x28')]={};this[_0x0543('0x29')]={};this[_0x0543('0x2a')]();}Agent[_0x0543('0x2b')][_0x0543('0x2c')]=function(_0x4adba7){if(this[_0x4adba7+'CurrentCapacity']>0x0){if(this[_0x4adba7+'Capacity']>0x0&&this[_0x4adba7+_0x0543('0x2d')]>=this[_0x4adba7+_0x0543('0x2e')]){return _0x0543('0x2f');}else{return _0x0543('0x30');}}else{return _0x0543('0x31');}};Agent[_0x0543('0x2b')][_0x0543('0x2a')]=function(){var _0x17a3de=[_0x0543('0x32'),_0x0543('0x33'),_0x0543('0x34'),_0x0543('0x35'),'sms',_0x0543('0x36')];for(var _0x153bda=0x0;_0x153bda<_0x17a3de[_0x0543('0x37')];_0x153bda+=0x1){var _0x4f2592=this[_0x0543('0x2c')](_0x17a3de[_0x153bda]);if(this[_0x17a3de[_0x153bda]+_0x0543('0x38')]!==_0x4f2592){this[_0x17a3de[_0x153bda]+_0x0543('0x39')]=_[_0x0543('0x3a')](moment()['format']('x'));}this[_0x17a3de[_0x153bda]+_0x0543('0x38')]=_0x4f2592;}var _0x10b9f3={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x0543('0x9')],'chatPause':this[_0x0543('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x0543('0xd')],'faxPause':this[_0x0543('0xc')],'openchannelPause':this[_0x0543('0xe')],'chatStatus':this[_0x0543('0xf')],'chatStatusTime':this[_0x0543('0x11')],'chatCapacity':this[_0x0543('0x12')],'chatCurrentCapacity':this[_0x0543('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0543('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0543('0x3b')],'faxStatus':this[_0x0543('0x17')],'faxStatusTime':this[_0x0543('0x3c')],'faxCapacity':this[_0x0543('0x18')],'faxCurrentCapacity':this[_0x0543('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0543('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0543('0x1d')],'whatsappStatus':this[_0x0543('0x1e')],'whatsappStatusTime':this[_0x0543('0x1f')],'whatsappCapacity':this[_0x0543('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0543('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0543('0x22')],'openchannelCurrentCapacity':this[_0x0543('0x23')],'busy':this[_0x0543('0x3d')],'busyQueue':this[_0x0543('0x24')],'chatWaitingInteractions':this[_0x0543('0x25')],'faxWaitingInteractions':this[_0x0543('0x26')],'mailWaitingInteractions':this[_0x0543('0x3e')],'openchannelWaitingInteractions':this[_0x0543('0x27')],'smsWaitingInteractions':this[_0x0543('0x28')],'whatsappWaitingInteractions':this[_0x0543('0x29')]};var _0x55eeba=md5(JSON[_0x0543('0x3f')](_0x10b9f3));if(this[_0x0543('0x1')]!==_0x55eeba){this['md5']=_0x55eeba;io[_0x0543('0x40')]('user:routing:update',_[_0x0543('0x41')](_0x10b9f3,[_0x0543('0x8')]));}};module['exports']=Agent; \ No newline at end of file +var _0xaebd=['socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','Status','format','chatStatusTime','smsStatusTime','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','smsWaitingInteractions','whatsappWaitingInteractions','emit','omit','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4e05d8,_0xab2ee9){_0x4e05d8=_0x4e05d8-0x0;var _0x356a48=_0xaebd[_0x4e05d8];return _0x356a48;};'use strict';var _=require(_0xdaeb('0x0'));var md5=require('md5');var moment=require(_0xdaeb('0x1'));var Redis=require(_0xdaeb('0x2'));var config=require(_0xdaeb('0x3'));config[_0xdaeb('0x4')]=_[_0xdaeb('0x5')](config['redis'],{'host':_0xdaeb('0x6'),'port':0x18eb});var io=require(_0xdaeb('0x7'))(new Redis(config[_0xdaeb('0x4')]));function Agent(_0x1141fe){this['id']=_0x1141fe['id']||0x0;this[_0xdaeb('0x8')]=_0x1141fe['name']||'';this[_0xdaeb('0x9')]=_0x1141fe[_0xdaeb('0x9')]||!![];this['voicePause']=_0x1141fe['voicePause']||![];this[_0xdaeb('0xa')]=_0x1141fe[_0xdaeb('0xa')]||![];this[_0xdaeb('0xb')]=_0x1141fe['mailPause']||![];this[_0xdaeb('0xc')]=_0x1141fe['faxPause']||![];this[_0xdaeb('0xd')]=_0x1141fe['smsPause']||![];this[_0xdaeb('0xe')]=_0x1141fe['openchannelPause']||![];this[_0xdaeb('0xf')]=_0xdaeb('0x10');this['chatStatusTime']=0x0;this['chatCapacity']=_0x1141fe[_0xdaeb('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xdaeb('0x12')]=_0xdaeb('0x10');this[_0xdaeb('0x13')]=0x0;this[_0xdaeb('0x14')]=_0x1141fe[_0xdaeb('0x14')]||0x0;this[_0xdaeb('0x15')]=0x0;this[_0xdaeb('0x16')]='unknown';this['faxStatusTime']=0x0;this[_0xdaeb('0x17')]=_0x1141fe[_0xdaeb('0x17')]||0x0;this[_0xdaeb('0x18')]=0x0;this[_0xdaeb('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0xdaeb('0x1a')]=_0x1141fe['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xdaeb('0x1b')]=_0xdaeb('0x10');this[_0xdaeb('0x1c')]=0x0;this[_0xdaeb('0x1d')]=_0x1141fe[_0xdaeb('0x1d')]||0x0;this[_0xdaeb('0x1e')]=0x0;this['openchannelStatus']=_0xdaeb('0x10');this['openchannelStatusTime']=0x0;this[_0xdaeb('0x1f')]=_0x1141fe[_0xdaeb('0x1f')]||0x0;this[_0xdaeb('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xdaeb('0x21')]='';this[_0xdaeb('0x22')]={};this[_0xdaeb('0x23')]={};this[_0xdaeb('0x24')]={};this[_0xdaeb('0x25')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0xdaeb('0x26')]();}Agent[_0xdaeb('0x27')][_0xdaeb('0x28')]=function(_0x1d919a){if(this[_0x1d919a+_0xdaeb('0x29')]>0x0){if(this[_0x1d919a+'Capacity']>0x0&&this[_0x1d919a+_0xdaeb('0x29')]>=this[_0x1d919a+'Capacity']){return _0xdaeb('0x2a');}else{return _0xdaeb('0x2b');}}else{return _0xdaeb('0x2c');}};Agent[_0xdaeb('0x27')][_0xdaeb('0x26')]=function(){var _0x4fc3e2=[_0xdaeb('0x2d'),_0xdaeb('0x2e'),_0xdaeb('0x2f'),'fax','sms',_0xdaeb('0x30')];for(var _0x4e7f44=0x0;_0x4e7f44<_0x4fc3e2['length'];_0x4e7f44+=0x1){var _0x16cee7=this[_0xdaeb('0x28')](_0x4fc3e2[_0x4e7f44]);if(this[_0x4fc3e2[_0x4e7f44]+_0xdaeb('0x31')]!==_0x16cee7){this[_0x4fc3e2[_0x4e7f44]+'StatusTime']=_['toNumber'](moment()[_0xdaeb('0x32')]('x'));}this[_0x4fc3e2[_0x4e7f44]+_0xdaeb('0x31')]=_0x16cee7;}var _0x37f468={'id':this['id'],'name':this['name'],'online':this[_0xdaeb('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xdaeb('0xb')],'smsPause':this[_0xdaeb('0xd')],'faxPause':this[_0xdaeb('0xc')],'openchannelPause':this[_0xdaeb('0xe')],'chatStatus':this[_0xdaeb('0xf')],'chatStatusTime':this[_0xdaeb('0x33')],'chatCapacity':this[_0xdaeb('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xdaeb('0x12')],'mailStatusTime':this[_0xdaeb('0x13')],'mailCapacity':this[_0xdaeb('0x14')],'mailCurrentCapacity':this[_0xdaeb('0x15')],'faxStatus':this[_0xdaeb('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xdaeb('0x17')],'faxCurrentCapacity':this[_0xdaeb('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xdaeb('0x34')],'smsCapacity':this[_0xdaeb('0x1a')],'smsCurrentCapacity':this[_0xdaeb('0x35')],'whatsappStatus':this[_0xdaeb('0x1b')],'whatsappStatusTime':this[_0xdaeb('0x1c')],'whatsappCapacity':this[_0xdaeb('0x1d')],'whatsappCurrentCapacity':this[_0xdaeb('0x1e')],'openchannelStatus':this[_0xdaeb('0x36')],'openchannelStatusTime':this[_0xdaeb('0x37')],'openchannelCapacity':this[_0xdaeb('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xdaeb('0x38')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xdaeb('0x23')],'mailWaitingInteractions':this[_0xdaeb('0x24')],'openchannelWaitingInteractions':this[_0xdaeb('0x25')],'smsWaitingInteractions':this[_0xdaeb('0x39')],'whatsappWaitingInteractions':this[_0xdaeb('0x3a')]};var _0xfa78c1=md5(JSON['stringify'](_0x37f468));if(this[_0xdaeb('0x21')]!==_0xfa78c1){this[_0xdaeb('0x21')]=_0xfa78c1;io[_0xdaeb('0x3b')]('user:routing:update',_[_0xdaeb('0x3c')](_0x37f468,[_0xdaeb('0x9')]));}};module[_0xdaeb('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a0ac360..9b60dcf 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 _0xfabc=['updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','online','chatPause','available','loggedIn','stringify','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting'];(function(_0xbe492e,_0x27b122){var _0x5174cf=function(_0x11a19e){while(--_0x11a19e){_0xbe492e['push'](_0xbe492e['shift']());}};_0x5174cf(++_0x27b122);}(_0xfabc,0x1a2));var _0xcfab=function(_0x52e1b5,_0x3c6e96){_0x52e1b5=_0x52e1b5-0x0;var _0x264a33=_0xfabc[_0x52e1b5];return _0x264a33;};'use strict';var _=require(_0xcfab('0x0'));var md5=require(_0xcfab('0x1'));var util=require(_0xcfab('0x2'));var Redis=require(_0xcfab('0x3'));var config=require(_0xcfab('0x4'));config[_0xcfab('0x5')]=_[_0xcfab('0x6')](config[_0xcfab('0x5')],{'host':_0xcfab('0x7'),'port':0x18eb});var io=require(_0xcfab('0x8'))(new Redis(config[_0xcfab('0x5')]));function ChatQueue(_0x3279aa){this['id']=_0x3279aa['id']||0x0;this['name']=_0x3279aa[_0xcfab('0x9')]||'';this[_0xcfab('0xa')]=_0x3279aa[_0xcfab('0xa')]||0xa;this[_0xcfab('0xb')]=_0x3279aa[_0xcfab('0xb')]||_0xcfab('0xc');this[_0xcfab('0xd')]=_0x3279aa[_0xcfab('0xd')];this['mapAgentsId']={};this[_0xcfab('0xe')]=0x0;this[_0xcfab('0x1')]='';this[_0xcfab('0xf')]();this[_0xcfab('0x10')]();}ChatQueue[_0xcfab('0x11')]['updateRouting']=function(){var _0x1be6b6=this[_0xcfab('0x12')][_0xcfab('0x13')];this[_0xcfab('0x12')]=_[_0xcfab('0x14')](this[_0xcfab('0xd')],'id');this['mapAgentsId'][_0xcfab('0x13')]=_0x1be6b6;};ChatQueue[_0xcfab('0x11')][_0xcfab('0x10')]=function(){this['loggedIn']=0x0;this[_0xcfab('0x15')]=0x0;for(var _0x58f2b0=0x0;_0x58f2b0=0x0?this[_0xcfab('0x19')]:0x0;var _0x66d40a={'id':this['id'],'available':this[_0xcfab('0x19')],'loggedIn':this[_0xcfab('0x1a')],'name':this[_0xcfab('0x9')],'paused':this['paused'],'waiting':this[_0xcfab('0xe')]};var _0x26a875=md5(JSON[_0xcfab('0x1b')](_0x66d40a));if(this[_0xcfab('0x1')]!==_0x26a875){this[_0xcfab('0x1')]=_0x26a875;io['to'](util['format']('chat:queue:%s',_0x66d40a[_0xcfab('0x9')]))[_0xcfab('0x1c')](_0xcfab('0x1d'),_0x66d40a);}};module[_0xcfab('0x1e')]=ChatQueue; \ No newline at end of file +var _0xe9a3=['updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x3e189c,_0x19df21){var _0xf6386c=function(_0x30c920){while(--_0x30c920){_0x3e189c['push'](_0x3e189c['shift']());}};_0xf6386c(++_0x19df21);}(_0xe9a3,0x9a));var _0x3e9a=function(_0x36a199,_0x8ba7e7){_0x36a199=_0x36a199-0x0;var _0xc39a94=_0xe9a3[_0x36a199];return _0xc39a94;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x3e9a('0x0'));var config=require(_0x3e9a('0x1'));config[_0x3e9a('0x2')]=_[_0x3e9a('0x3')](config['redis'],{'host':_0x3e9a('0x4'),'port':0x18eb});var io=require(_0x3e9a('0x5'))(new Redis(config[_0x3e9a('0x2')]));function ChatQueue(_0x4821bd){this['id']=_0x4821bd['id']||0x0;this[_0x3e9a('0x6')]=_0x4821bd[_0x3e9a('0x6')]||'';this[_0x3e9a('0x7')]=_0x4821bd['timeout']||0xa;this['strategy']=_0x4821bd[_0x3e9a('0x8')]||'beepall';this[_0x3e9a('0x9')]=_0x4821bd[_0x3e9a('0x9')];this[_0x3e9a('0xa')]={};this[_0x3e9a('0xb')]=0x0;this[_0x3e9a('0xc')]='';this[_0x3e9a('0xd')]();this[_0x3e9a('0xe')]();}ChatQueue[_0x3e9a('0xf')][_0x3e9a('0xd')]=function(){var _0x175912=this['mapAgentsId'][_0x3e9a('0x10')];this[_0x3e9a('0xa')]=_[_0x3e9a('0x11')](this[_0x3e9a('0x9')],'id');this['mapAgentsId'][_0x3e9a('0x10')]=_0x175912;};ChatQueue[_0x3e9a('0xf')][_0x3e9a('0xe')]=function(){this[_0x3e9a('0x12')]=0x0;this[_0x3e9a('0x13')]=0x0;for(var _0x28f7ee=0x0;_0x28f7ee=0x0?this['available']:0x0;var _0x3ea8cd={'id':this['id'],'available':this[_0x3e9a('0x15')],'loggedIn':this[_0x3e9a('0x12')],'name':this[_0x3e9a('0x6')],'paused':this[_0x3e9a('0x13')],'waiting':this[_0x3e9a('0xb')]};var _0x4332ca=md5(JSON[_0x3e9a('0x16')](_0x3ea8cd));if(this[_0x3e9a('0xc')]!==_0x4332ca){this[_0x3e9a('0xc')]=_0x4332ca;io['to'](util[_0x3e9a('0x17')](_0x3e9a('0x18'),_0x3ea8cd[_0x3e9a('0x6')]))[_0x3e9a('0x19')](_0x3e9a('0x1a'),_0x3ea8cd);}};module[_0x3e9a('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c52051f..c3f4a96 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 _0xa14d=['emit','fax_queue:save','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s'];(function(_0x561195,_0x1f9dec){var _0x5c87c3=function(_0x32ee97){while(--_0x32ee97){_0x561195['push'](_0x561195['shift']());}};_0x5c87c3(++_0x1f9dec);}(_0xa14d,0x108));var _0xda14=function(_0x1ed6fd,_0x4de9df){_0x1ed6fd=_0x1ed6fd-0x0;var _0x554952=_0xa14d[_0x1ed6fd];return _0x554952;};'use strict';var _=require('lodash');var md5=require(_0xda14('0x0'));var util=require(_0xda14('0x1'));var Redis=require(_0xda14('0x2'));var config=require('../../../config/environment');config[_0xda14('0x3')]=_['defaults'](config['redis'],{'host':_0xda14('0x4'),'port':0x18eb});var io=require(_0xda14('0x5'))(new Redis(config[_0xda14('0x3')]));function FaxQueue(_0x361d72){this['id']=_0x361d72['id']||0x0;this[_0xda14('0x6')]=_0x361d72[_0xda14('0x6')]||'';this[_0xda14('0x7')]=_0x361d72[_0xda14('0x7')]||0xa;this[_0xda14('0x8')]=_0x361d72[_0xda14('0x8')]||_0xda14('0x9');this[_0xda14('0xa')]=_0x361d72[_0xda14('0xa')];this[_0xda14('0xb')]={};this[_0xda14('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xda14('0xd')]();}FaxQueue[_0xda14('0xe')][_0xda14('0xf')]=function(){var _0x5c00ae=this[_0xda14('0xb')][_0xda14('0x10')];this[_0xda14('0xb')]=_[_0xda14('0x11')](this[_0xda14('0xa')],'id');this[_0xda14('0xb')][_0xda14('0x10')]=_0x5c00ae;};FaxQueue[_0xda14('0xe')][_0xda14('0xd')]=function(){this[_0xda14('0x12')]=0x0;this[_0xda14('0x13')]=0x0;for(var _0x23b38b=0x0;_0x23b38b=0x0?this[_0xda14('0x17')]:0x0;var _0x9f96d9={'id':this['id'],'available':this[_0xda14('0x17')],'loggedIn':this[_0xda14('0x12')],'name':this[_0xda14('0x6')],'paused':this[_0xda14('0x13')],'waiting':this[_0xda14('0xc')]};var _0x46a4a8=md5(JSON['stringify'](_0x9f96d9));if(this['md5']!==_0x46a4a8){this['md5']=_0x46a4a8;io['to'](util[_0xda14('0x18')](_0xda14('0x19'),_0x9f96d9[_0xda14('0x6')]))[_0xda14('0x1a')](_0xda14('0x1b'),_0x9f96d9);}};module[_0xda14('0x1c')]=FaxQueue; \ No newline at end of file +var _0x1dee=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1dee,0x147));var _0xe1de=function(_0x396832,_0x3ccff6){_0x396832=_0x396832-0x0;var _0x560da3=_0x1dee[_0x396832];return _0x560da3;};'use strict';var _=require(_0xe1de('0x0'));var md5=require(_0xe1de('0x1'));var util=require(_0xe1de('0x2'));var Redis=require(_0xe1de('0x3'));var config=require(_0xe1de('0x4'));config[_0xe1de('0x5')]=_[_0xe1de('0x6')](config['redis'],{'host':_0xe1de('0x7'),'port':0x18eb});var io=require(_0xe1de('0x8'))(new Redis(config['redis']));function FaxQueue(_0x5b9730){this['id']=_0x5b9730['id']||0x0;this[_0xe1de('0x9')]=_0x5b9730[_0xe1de('0x9')]||'';this[_0xe1de('0xa')]=_0x5b9730[_0xe1de('0xa')]||0xa;this['strategy']=_0x5b9730['strategy']||_0xe1de('0xb');this['Agents']=_0x5b9730[_0xe1de('0xc')];this[_0xe1de('0xd')]={};this[_0xe1de('0xe')]=0x0;this['md5']='';this[_0xe1de('0xf')]();this[_0xe1de('0x10')]();}FaxQueue[_0xe1de('0x11')][_0xe1de('0xf')]=function(){var _0x3564a3=this[_0xe1de('0xd')][_0xe1de('0x12')];this[_0xe1de('0xd')]=_['map'](this[_0xe1de('0xc')],'id');this[_0xe1de('0xd')]['_rr']=_0x3564a3;};FaxQueue[_0xe1de('0x11')]['updateRealtime']=function(){this[_0xe1de('0x13')]=0x0;this['paused']=0x0;for(var _0x4ef591=0x0;_0x4ef591=0x0?this[_0xe1de('0x17')]:0x0;var _0x18a4cf={'id':this['id'],'available':this[_0xe1de('0x17')],'loggedIn':this[_0xe1de('0x13')],'name':this[_0xe1de('0x9')],'paused':this[_0xe1de('0x16')],'waiting':this[_0xe1de('0xe')]};var _0x8561f2=md5(JSON[_0xe1de('0x18')](_0x18a4cf));if(this[_0xe1de('0x1')]!==_0x8561f2){this['md5']=_0x8561f2;io['to'](util[_0xe1de('0x19')](_0xe1de('0x1a'),_0x18a4cf[_0xe1de('0x9')]))[_0xe1de('0x1b')](_0xe1de('0x1c'),_0x18a4cf);}};module[_0xe1de('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 2e34992..004549b 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 _0xa676=['exports','name','Intervals'];(function(_0x2bd567,_0x999084){var _0xa2d549=function(_0x424449){while(--_0x424449){_0x2bd567['push'](_0x2bd567['shift']());}};_0xa2d549(++_0x999084);}(_0xa676,0x145));var _0x6a67=function(_0x28063a,_0x1ae52e){_0x28063a=_0x28063a-0x0;var _0x3eeb40=_0xa676[_0x28063a];return _0x3eeb40;};'use strict';function Interval(_0x1437b0){this['id']=_0x1437b0['id']||0x0;this[_0x6a67('0x0')]=_0x1437b0[_0x6a67('0x0')]||'';this[_0x6a67('0x1')]=_0x1437b0[_0x6a67('0x1')]||{};}module[_0x6a67('0x2')]=Interval; \ No newline at end of file +var _0x6901=['exports','name'];(function(_0x2bc92e,_0x521367){var _0x7d4e19=function(_0x4790c8){while(--_0x4790c8){_0x2bc92e['push'](_0x2bc92e['shift']());}};_0x7d4e19(++_0x521367);}(_0x6901,0xc1));var _0x1690=function(_0x196dc8,_0x2f0caa){_0x196dc8=_0x196dc8-0x0;var _0x2a5725=_0x6901[_0x196dc8];return _0x2a5725;};'use strict';function Interval(_0x154e32){this['id']=_0x154e32['id']||0x0;this[_0x1690('0x0')]=_0x154e32[_0x1690('0x0')]||'';this['Intervals']=_0x154e32['Intervals']||{};}module[_0x1690('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7f89824..fe1de7a 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 _0xdd14=['timeout','strategy','beepall','mapAgentsId','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','Agents','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x2fe3d6,_0x299fcc){var _0x197c90=function(_0x1392a2){while(--_0x1392a2){_0x2fe3d6['push'](_0x2fe3d6['shift']());}};_0x197c90(++_0x299fcc);}(_0xdd14,0x142));var _0x4dd1=function(_0x5ec99e,_0x45cbf4){_0x5ec99e=_0x5ec99e-0x0;var _0x7e3a73=_0xdd14[_0x5ec99e];return _0x7e3a73;};'use strict';var _=require(_0x4dd1('0x0'));var md5=require(_0x4dd1('0x1'));var util=require('util');var Redis=require(_0x4dd1('0x2'));var config=require(_0x4dd1('0x3'));config[_0x4dd1('0x4')]=_[_0x4dd1('0x5')](config[_0x4dd1('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4dd1('0x6'))(new Redis(config[_0x4dd1('0x4')]));function MailQueue(_0x4a3e9c){this['id']=_0x4a3e9c['id']||0x0;this[_0x4dd1('0x7')]=_0x4a3e9c[_0x4dd1('0x7')]||'';this['timeout']=_0x4a3e9c[_0x4dd1('0x8')]||0xa;this[_0x4dd1('0x9')]=_0x4a3e9c[_0x4dd1('0x9')]||_0x4dd1('0xa');this['Agents']=_0x4a3e9c['Agents'];this[_0x4dd1('0xb')]={};this['waiting']=0x0;this[_0x4dd1('0x1')]='';this[_0x4dd1('0xc')]();this['updateRealtime']();}MailQueue['prototype'][_0x4dd1('0xc')]=function(){var _0x2c0b72=this[_0x4dd1('0xb')][_0x4dd1('0xd')];this['mapAgentsId']=_[_0x4dd1('0xe')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2c0b72;};MailQueue[_0x4dd1('0xf')][_0x4dd1('0x10')]=function(){this[_0x4dd1('0x11')]=0x0;this[_0x4dd1('0x12')]=0x0;for(var _0x1fe31a=0x0;_0x1fe31a=0x0?this[_0x4dd1('0x16')]:0x0;var _0x409275={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4dd1('0x11')],'name':this[_0x4dd1('0x7')],'paused':this['paused'],'waiting':this[_0x4dd1('0x17')]};var _0x440590=md5(JSON[_0x4dd1('0x18')](_0x409275));if(this[_0x4dd1('0x1')]!==_0x440590){this[_0x4dd1('0x1')]=_0x440590;io['to'](util[_0x4dd1('0x19')](_0x4dd1('0x1a'),_0x409275['name']))[_0x4dd1('0x1b')](_0x4dd1('0x1c'),_0x409275);}};module[_0x4dd1('0x1d')]=MailQueue; \ No newline at end of file +var _0xd248=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','prototype','paused','length','mailPause','loggedIn','available','waiting','stringify','md5','format','mail:queue:%s','mail_queue:save','lodash','../../../config/environment'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xd248,0x1e4));var _0x8d24=function(_0x156a68,_0x340a98){_0x156a68=_0x156a68-0x0;var _0x341861=_0xd248[_0x156a68];return _0x341861;};'use strict';var _=require(_0x8d24('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x8d24('0x1'));config['redis']=_['defaults'](config[_0x8d24('0x2')],{'host':_0x8d24('0x3'),'port':0x18eb});var io=require(_0x8d24('0x4'))(new Redis(config[_0x8d24('0x2')]));function MailQueue(_0x47db59){this['id']=_0x47db59['id']||0x0;this[_0x8d24('0x5')]=_0x47db59[_0x8d24('0x5')]||'';this[_0x8d24('0x6')]=_0x47db59['timeout']||0xa;this[_0x8d24('0x7')]=_0x47db59[_0x8d24('0x7')]||_0x8d24('0x8');this[_0x8d24('0x9')]=_0x47db59['Agents'];this[_0x8d24('0xa')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x8d24('0xb')]();}MailQueue['prototype'][_0x8d24('0xc')]=function(){var _0x2a7cb0=this[_0x8d24('0xa')][_0x8d24('0xd')];this[_0x8d24('0xa')]=_[_0x8d24('0xe')](this[_0x8d24('0x9')],'id');this['mapAgentsId'][_0x8d24('0xd')]=_0x2a7cb0;};MailQueue[_0x8d24('0xf')][_0x8d24('0xb')]=function(){this['loggedIn']=0x0;this[_0x8d24('0x10')]=0x0;for(var _0x350952=0x0;_0x350952=0x0?this[_0x8d24('0x14')]:0x0;var _0x40155c={'id':this['id'],'available':this[_0x8d24('0x14')],'loggedIn':this[_0x8d24('0x13')],'name':this[_0x8d24('0x5')],'paused':this[_0x8d24('0x10')],'waiting':this[_0x8d24('0x15')]};var _0x192361=md5(JSON[_0x8d24('0x16')](_0x40155c));if(this[_0x8d24('0x17')]!==_0x192361){this[_0x8d24('0x17')]=_0x192361;io['to'](util[_0x8d24('0x18')](_0x8d24('0x19'),_0x40155c[_0x8d24('0x5')]))['emit'](_0x8d24('0x1a'),_0x40155c);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f39ed4b..19e34a1 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0a98301..971aace 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 _0x3c7b=['smsPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online'];(function(_0x533708,_0x13d843){var _0x2bd49c=function(_0x556492){while(--_0x556492){_0x533708['push'](_0x533708['shift']());}};_0x2bd49c(++_0x13d843);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x25494c,_0x345a2a){_0x25494c=_0x25494c-0x0;var _0x178fa1=_0x3c7b[_0x25494c];return _0x178fa1;};'use strict';var _=require(_0xb3c7('0x0'));var md5=require(_0xb3c7('0x1'));var util=require(_0xb3c7('0x2'));var Redis=require(_0xb3c7('0x3'));var config=require(_0xb3c7('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb3c7('0x5'))(new Redis(config[_0xb3c7('0x6')]));function SmsQueue(_0x4b3f30){this['id']=_0x4b3f30['id']||0x0;this[_0xb3c7('0x7')]=_0x4b3f30['name']||'';this[_0xb3c7('0x8')]=_0x4b3f30[_0xb3c7('0x8')]||0xa;this[_0xb3c7('0x9')]=_0x4b3f30[_0xb3c7('0x9')]||_0xb3c7('0xa');this['Agents']=_0x4b3f30[_0xb3c7('0xb')];this['mapAgentsId']={};this[_0xb3c7('0xc')]=0x0;this[_0xb3c7('0x1')]='';this[_0xb3c7('0xd')]();this[_0xb3c7('0xe')]();}SmsQueue['prototype'][_0xb3c7('0xd')]=function(){var _0x23f08c=this['mapAgentsId'][_0xb3c7('0xf')];this[_0xb3c7('0x10')]=_[_0xb3c7('0x11')](this[_0xb3c7('0xb')],'id');this[_0xb3c7('0x10')][_0xb3c7('0xf')]=_0x23f08c;};SmsQueue[_0xb3c7('0x12')]['updateRealtime']=function(){this[_0xb3c7('0x13')]=0x0;this[_0xb3c7('0x14')]=0x0;for(var _0x4d66c8=0x0;_0x4d66c8=0x0?this['available']:0x0;var _0x1cfafc={'id':this['id'],'available':this[_0xb3c7('0x18')],'loggedIn':this[_0xb3c7('0x13')],'name':this[_0xb3c7('0x7')],'paused':this[_0xb3c7('0x14')],'waiting':this['waiting']};var _0xdbbb66=md5(JSON[_0xb3c7('0x19')](_0x1cfafc));if(this[_0xb3c7('0x1')]!==_0xdbbb66){this[_0xb3c7('0x1')]=_0xdbbb66;io['to'](util['format']('sms:queue:%s',_0x1cfafc[_0xb3c7('0x7')]))[_0xb3c7('0x1a')]('sms_queue:save',_0x1cfafc);}};module[_0xb3c7('0x1b')]=SmsQueue; \ No newline at end of file +var _0xf041=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1f04('0x0'));var Redis=require(_0x1f04('0x1'));var config=require(_0x1f04('0x2'));config[_0x1f04('0x3')]=_['defaults'](config[_0x1f04('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1f04('0x4'))(new Redis(config['redis']));function SmsQueue(_0x530a67){this['id']=_0x530a67['id']||0x0;this[_0x1f04('0x5')]=_0x530a67['name']||'';this[_0x1f04('0x6')]=_0x530a67[_0x1f04('0x6')]||0xa;this[_0x1f04('0x7')]=_0x530a67[_0x1f04('0x7')]||'beepall';this[_0x1f04('0x8')]=_0x530a67[_0x1f04('0x8')];this[_0x1f04('0x9')]={};this[_0x1f04('0xa')]=0x0;this[_0x1f04('0xb')]='';this[_0x1f04('0xc')]();this[_0x1f04('0xd')]();}SmsQueue[_0x1f04('0xe')]['updateRouting']=function(){var _0x4f4e37=this[_0x1f04('0x9')][_0x1f04('0xf')];this[_0x1f04('0x9')]=_[_0x1f04('0x10')](this[_0x1f04('0x8')],'id');this[_0x1f04('0x9')][_0x1f04('0xf')]=_0x4f4e37;};SmsQueue[_0x1f04('0xe')][_0x1f04('0xd')]=function(){this[_0x1f04('0x11')]=0x0;this[_0x1f04('0x12')]=0x0;for(var _0x4ebd86=0x0;_0x4ebd86=0x0?this['available']:0x0;var _0x4964bd={'id':this['id'],'available':this[_0x1f04('0x15')],'loggedIn':this[_0x1f04('0x11')],'name':this[_0x1f04('0x5')],'paused':this[_0x1f04('0x12')],'waiting':this[_0x1f04('0xa')]};var _0x30d2e5=md5(JSON[_0x1f04('0x16')](_0x4964bd));if(this[_0x1f04('0xb')]!==_0x30d2e5){this['md5']=_0x30d2e5;io['to'](util[_0x1f04('0x17')](_0x1f04('0x18'),_0x4964bd[_0x1f04('0x5')]))['emit'](_0x1f04('0x19'),_0x4964bd);}};module[_0x1f04('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 224bce2..a18612c 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 _0x08b9=['name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','_rr','map','Agents','prototype','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x08b9,0x120));var _0x908b=function(_0x1591f7,_0x5aedd6){_0x1591f7=_0x1591f7-0x0;var _0x4e1517=_0x08b9[_0x1591f7];return _0x4e1517;};'use strict';var _=require(_0x908b('0x0'));var md5=require(_0x908b('0x1'));var util=require(_0x908b('0x2'));var Redis=require(_0x908b('0x3'));var config=require(_0x908b('0x4'));config['redis']=_[_0x908b('0x5')](config[_0x908b('0x6')],{'host':_0x908b('0x7'),'port':0x18eb});var io=require(_0x908b('0x8'))(new Redis(config[_0x908b('0x6')]));function WhatsappQueue(_0x3c22f4){this['id']=_0x3c22f4['id']||0x0;this[_0x908b('0x9')]=_0x3c22f4[_0x908b('0x9')]||'';this['timeout']=_0x3c22f4[_0x908b('0xa')]||0xa;this[_0x908b('0xb')]=_0x3c22f4[_0x908b('0xb')]||_0x908b('0xc');this['Agents']=_0x3c22f4['Agents'];this[_0x908b('0xd')]={};this[_0x908b('0xe')]=0x0;this[_0x908b('0x1')]='';this[_0x908b('0xf')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x908b('0xf')]=function(){var _0x445582=this['mapAgentsId'][_0x908b('0x10')];this[_0x908b('0xd')]=_[_0x908b('0x11')](this[_0x908b('0x12')],'id');this[_0x908b('0xd')][_0x908b('0x10')]=_0x445582;};WhatsappQueue[_0x908b('0x13')][_0x908b('0x14')]=function(){this[_0x908b('0x15')]=0x0;this[_0x908b('0x16')]=0x0;for(var _0x1cedba=0x0;_0x1cedba=0x0?this[_0x908b('0x1a')]:0x0;var _0x9c84f3={'id':this['id'],'available':this[_0x908b('0x1a')],'loggedIn':this[_0x908b('0x15')],'name':this[_0x908b('0x9')],'paused':this[_0x908b('0x16')],'waiting':this['waiting']};var _0xa69cf2=md5(JSON[_0x908b('0x1b')](_0x9c84f3));if(this['md5']!==_0xa69cf2){this[_0x908b('0x1')]=_0xa69cf2;io['to'](util[_0x908b('0x1c')](_0x908b('0x1d'),_0x9c84f3[_0x908b('0x9')]))[_0x908b('0x1e')](_0x908b('0x1f'),_0x9c84f3);}};module[_0x908b('0x20')]=WhatsappQueue; \ No newline at end of file +var _0x310e=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','loggedIn','paused','length','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash'];(function(_0x1a50a4,_0x10593e){var _0x413338=function(_0x3c55ed){while(--_0x3c55ed){_0x1a50a4['push'](_0x1a50a4['shift']());}};_0x413338(++_0x10593e);}(_0x310e,0xf2));var _0xe310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x310e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe310('0x0'));var md5=require(_0xe310('0x1'));var util=require('util');var Redis=require(_0xe310('0x2'));var config=require(_0xe310('0x3'));config[_0xe310('0x4')]=_[_0xe310('0x5')](config[_0xe310('0x4')],{'host':_0xe310('0x6'),'port':0x18eb});var io=require(_0xe310('0x7'))(new Redis(config[_0xe310('0x4')]));function WhatsappQueue(_0x435977){this['id']=_0x435977['id']||0x0;this['name']=_0x435977[_0xe310('0x8')]||'';this['timeout']=_0x435977[_0xe310('0x9')]||0xa;this[_0xe310('0xa')]=_0x435977['strategy']||_0xe310('0xb');this[_0xe310('0xc')]=_0x435977['Agents'];this['mapAgentsId']={};this[_0xe310('0xd')]=0x0;this[_0xe310('0x1')]='';this[_0xe310('0xe')]();this['updateRealtime']();}WhatsappQueue[_0xe310('0xf')][_0xe310('0xe')]=function(){var _0x3983a8=this[_0xe310('0x10')][_0xe310('0x11')];this[_0xe310('0x10')]=_['map'](this[_0xe310('0xc')],'id');this[_0xe310('0x10')]['_rr']=_0x3983a8;};WhatsappQueue[_0xe310('0xf')]['updateRealtime']=function(){this[_0xe310('0x12')]=0x0;this[_0xe310('0x13')]=0x0;for(var _0x2791e3=0x0;_0x2791e3=0x0?this['available']:0x0;var _0x42fe40={'id':this['id'],'available':this[_0xe310('0x16')],'loggedIn':this[_0xe310('0x12')],'name':this[_0xe310('0x8')],'paused':this[_0xe310('0x13')],'waiting':this[_0xe310('0xd')]};var _0x4ec6c9=md5(JSON[_0xe310('0x17')](_0x42fe40));if(this[_0xe310('0x1')]!==_0x4ec6c9){this[_0xe310('0x1')]=_0x4ec6c9;io['to'](util['format'](_0xe310('0x18'),_0x42fe40['name']))['emit'](_0xe310('0x19'),_0x42fe40);}};module[_0xe310('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 02d2acc..2f4d747 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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b04ed3c..1ee659d 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 _0x850b=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x4f8b44,_0x4eda31){var _0x45727b=function(_0x566b10){while(--_0x566b10){_0x4f8b44['push'](_0x4f8b44['shift']());}};_0x45727b(++_0x4eda31);}(_0x850b,0x151));var _0xb850=function(_0x1c1f5a,_0x5f2383){_0x1c1f5a=_0x1c1f5a-0x0;var _0x505066=_0x850b[_0x1c1f5a];return _0x505066;};'use strict';var client=require(_0xb850('0x0'));exports[_0xb850('0x1')]=function(_0x58ac83,_0xb17d05){return client[_0xb850('0x2')](_0xb850('0x3'),{'body':_0xb17d05,'options':{'where':{'id':_0x58ac83}},'log':_0xb850('0x4')});};exports[_0xb850('0x5')]=function(_0x428615,_0x47c626){return client[_0xb850('0x2')](_0xb850('0x6'),{'body':_0x47c626,'options':{'where':{'id':_0x428615}},'log':_0xb850('0x7')});}; \ No newline at end of file +var _0xc006=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x2d1010,_0xdbbd05){var _0x592928=function(_0x30c13c){while(--_0x30c13c){_0x2d1010['push'](_0x2d1010['shift']());}};_0x592928(++_0xdbbd05);}(_0xc006,0x1dd));var _0x6c00=function(_0xab9630,_0xe19d9c){_0xab9630=_0xab9630-0x0;var _0x1567a3=_0xc006[_0xab9630];return _0x1567a3;};'use strict';var client=require(_0x6c00('0x0'));exports[_0x6c00('0x1')]=function(_0x24ee42,_0xb3342a){return client['Request'](_0x6c00('0x2'),{'body':_0xb3342a,'options':{'where':{'id':_0x24ee42}},'log':_0x6c00('0x3')});};exports[_0x6c00('0x4')]=function(_0x50fb7f,_0x32f798){return client[_0x6c00('0x5')](_0x6c00('0x6'),{'body':_0x32f798,'options':{'where':{'id':_0x50fb7f}},'log':_0x6c00('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 67aa50e..00156de 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 _0xf2c8=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0xf2c8,0x12c));var _0x8f2c=function(_0x21ba31,_0x4ae3b9){_0x21ba31=_0x21ba31-0x0;var _0x247c26=_0xf2c8[_0x21ba31];return _0x247c26;};'use strict';var client=require('../client');exports[_0x8f2c('0x0')]=function(_0x19e054){return client[_0x8f2c('0x1')](_0x8f2c('0x2'),{'body':_0x19e054,'log':_0x8f2c('0x3')});}; \ No newline at end of file +var _0x1864=['create','Request','createChatMessage','../client'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x1864,0xa3));var _0x4186=function(_0x5a64c9,_0x2138ac){_0x5a64c9=_0x5a64c9-0x0;var _0x10148b=_0x1864[_0x5a64c9];return _0x10148b;};'use strict';var client=require(_0x4186('0x0'));exports[_0x4186('0x1')]=function(_0x2e88ed){return client[_0x4186('0x2')]('CreateChatMessage',{'body':_0x2e88ed,'log':_0x4186('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 732897c..b5a3e8c 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 _0xbfda=['strategy','User','Agents','chatPause','../client','getChatQueues','Request','name'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0xbfda,0x1dc));var _0xabfd=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xbfda[_0x100682];return _0xcb6e87;};'use strict';var client=require(_0xabfd('0x0'));exports[_0xabfd('0x1')]=function(){return function(){return client[_0xabfd('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xabfd('0x3'),'timeout',_0xabfd('0x4')],'include':[{'model':_0xabfd('0x5'),'as':_0xabfd('0x6'),'attributes':['id',_0xabfd('0x3'),'online',_0xabfd('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x46fc=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client'];(function(_0x6ef9ba,_0x293783){var _0x4b35f8=function(_0x218f72){while(--_0x218f72){_0x6ef9ba['push'](_0x6ef9ba['shift']());}};_0x4b35f8(++_0x293783);}(_0x46fc,0x103));var _0xc46f=function(_0x28ccad,_0x413b5b){_0x28ccad=_0x28ccad-0x0;var _0x3271cc=_0x46fc[_0x28ccad];return _0x3271cc;};'use strict';var client=require(_0xc46f('0x0'));exports[_0xc46f('0x1')]=function(){return function(){return client[_0xc46f('0x2')](_0xc46f('0x3'),{'options':{'raw':![],'attributes':['id',_0xc46f('0x4'),_0xc46f('0x5'),_0xc46f('0x6')],'include':[{'model':_0xc46f('0x7'),'as':_0xc46f('0x8'),'attributes':['id','name','online',_0xc46f('0x9')]}]},'log':_0xc46f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d5eabde..2300e77 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 _0x5ed2=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed2,0x114));var _0x25ed=function(_0x7835a,_0x7ef740){_0x7835a=_0x7835a-0x0;var _0xd46e11=_0x5ed2[_0x7835a];return _0xd46e11;};'use strict';var client=require(_0x25ed('0x0'));exports['create']=function(_0xf95d0a){return client[_0x25ed('0x1')]('CreateChatQueueReport',{'body':_0xf95d0a,'log':_0x25ed('0x2')});};exports[_0x25ed('0x3')]=function(_0x591e52,_0x1ce8d8){return client[_0x25ed('0x1')](_0x25ed('0x4'),{'body':_0x1ce8d8,'options':{'where':{'uniqueid':_0x591e52},'order':[['id',_0x25ed('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x5309=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x453f6c,_0x58291a){var _0x2074bf=function(_0x685112){while(--_0x685112){_0x453f6c['push'](_0x453f6c['shift']());}};_0x2074bf(++_0x58291a);}(_0x5309,0x1aa));var _0x9530=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x5309[_0x20ebb5];return _0x487182;};'use strict';var client=require(_0x9530('0x0'));exports[_0x9530('0x1')]=function(_0x2658ab){return client[_0x9530('0x2')](_0x9530('0x3'),{'body':_0x2658ab,'log':_0x9530('0x3')});};exports[_0x9530('0x4')]=function(_0x13abba,_0x169a84){return client[_0x9530('0x2')]('UpdateChatQueueReport',{'body':_0x169a84,'options':{'where':{'uniqueid':_0x13abba},'order':[['id','DESC']],'limit':0x1},'log':_0x9530('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 74bb108..82b08c7 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(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x7a54,0x106));var _0x47a5=function(_0x413641,_0x34518a){_0x413641=_0x413641-0x0;var _0x105649=_0x7a54[_0x413641];return _0x105649;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x26c4aa,_0x2eb22c){var _0xd7c782=function(_0x538ee9){while(--_0x538ee9){_0x26c4aa['push'](_0x26c4aa['shift']());}};_0xd7c782(++_0x2eb22c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 46b81e8..86f3f38 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 _0x7dae=['createFaxMessage','CreateFaxMessage'];(function(_0x4facf5,_0x5691af){var _0x3d201d=function(_0x2b1032){while(--_0x2b1032){_0x4facf5['push'](_0x4facf5['shift']());}};_0x3d201d(++_0x5691af);}(_0x7dae,0x77));var _0xe7da=function(_0x43b576,_0x297b35){_0x43b576=_0x43b576-0x0;var _0xf29c71=_0x7dae[_0x43b576];return _0xf29c71;};'use strict';var client=require('../client');exports['create']=function(_0x50194b){return client['Request'](_0xe7da('0x0'),{'body':_0x50194b,'log':_0xe7da('0x1')});}; \ No newline at end of file +var _0x059f=['createFaxMessage','create'];(function(_0x2aa86f,_0x20c650){var _0x3fd5f0=function(_0x311d94){while(--_0x311d94){_0x2aa86f['push'](_0x2aa86f['shift']());}};_0x3fd5f0(++_0x20c650);}(_0x059f,0x10f));var _0xf059=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x059f[_0x6d6a66];return _0x11eb6e;};'use strict';var client=require('../client');exports[_0xf059('0x0')]=function(_0x36603c){return client['Request']('CreateFaxMessage',{'body':_0x36603c,'log':_0xf059('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 248c6f0..bd55778 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 _0x3361=['timeout','User','name','online','faxPause','getFaxQueues','../client','Request'];(function(_0x34d1d2,_0x3d4b6){var _0x423350=function(_0x30bc43){while(--_0x30bc43){_0x34d1d2['push'](_0x34d1d2['shift']());}};_0x423350(++_0x3d4b6);}(_0x3361,0x1d6));var _0x1336=function(_0x1c8e09,_0x4e1a3c){_0x1c8e09=_0x1c8e09-0x0;var _0x52e217=_0x3361[_0x1c8e09];return _0x52e217;};'use strict';var client=require(_0x1336('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x1336('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x1336('0x2'),'strategy'],'include':[{'model':_0x1336('0x3'),'as':'Agents','attributes':['id',_0x1336('0x4'),_0x1336('0x5'),_0x1336('0x6')]}]},'log':_0x1336('0x7')});};}; \ No newline at end of file +var _0xc380=['User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x439240,_0x3a2878){var _0x415e6d=function(_0x20a832){while(--_0x20a832){_0x439240['push'](_0x439240['shift']());}};_0x415e6d(++_0x3a2878);}(_0xc380,0xa5));var _0x0c38=function(_0x165056,_0x3632f5){_0x165056=_0x165056-0x0;var _0x43e33b=_0xc380[_0x165056];return _0x43e33b;};'use strict';var client=require(_0x0c38('0x0'));exports[_0x0c38('0x1')]=function(){return function(){return client[_0x0c38('0x2')](_0x0c38('0x3'),{'options':{'raw':![],'attributes':['id',_0x0c38('0x4'),_0x0c38('0x5'),'strategy'],'include':[{'model':_0x0c38('0x6'),'as':_0x0c38('0x7'),'attributes':['id',_0x0c38('0x4'),'online',_0x0c38('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7e9e7c4..0a24043 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 _0x965f=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x46440c,_0x4da44f){var _0x1cb968=function(_0x2f2b37){while(--_0x2f2b37){_0x46440c['push'](_0x46440c['shift']());}};_0x1cb968(++_0x4da44f);}(_0x965f,0x139));var _0xf965=function(_0x5af086,_0x5520ee){_0x5af086=_0x5af086-0x0;var _0x34a6e8=_0x965f[_0x5af086];return _0x34a6e8;};'use strict';var client=require(_0xf965('0x0'));exports[_0xf965('0x1')]=function(_0x281393){return client[_0xf965('0x2')](_0xf965('0x3'),{'body':_0x281393,'log':_0xf965('0x3')});};exports['update']=function(_0x37f680,_0x27bcc6){return client[_0xf965('0x2')](_0xf965('0x4'),{'body':_0x27bcc6,'options':{'where':{'uniqueid':_0x37f680},'order':[['id',_0xf965('0x5')]],'limit':0x1},'log':_0xf965('0x4')});}; \ No newline at end of file +var _0x4ccd=['../client','create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x4ccd,0x126));var _0xd4cc=function(_0x39acf8,_0x158e5a){_0x39acf8=_0x39acf8-0x0;var _0x378ac3=_0x4ccd[_0x39acf8];return _0x378ac3;};'use strict';var client=require(_0xd4cc('0x0'));exports[_0xd4cc('0x1')]=function(_0x23932b){return client[_0xd4cc('0x2')](_0xd4cc('0x3'),{'body':_0x23932b,'log':_0xd4cc('0x3')});};exports[_0xd4cc('0x4')]=function(_0x44c415,_0x2c0be2){return client[_0xd4cc('0x2')]('UpdateFaxQueueReport',{'body':_0x2c0be2,'options':{'where':{'uniqueid':_0x44c415},'order':[['id',_0xd4cc('0x5')]],'limit':0x1},'log':_0xd4cc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 516596a..7651870 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 _0xcfa9=['../client','getIntervals','Interval','Intervals','interval'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xcfa9,0x145));var _0x9cfa=function(_0xf0dec5,_0x17c711){_0xf0dec5=_0xf0dec5-0x0;var _0x5220db=_0xcfa9[_0xf0dec5];return _0x5220db;};'use strict';var client=require(_0x9cfa('0x0'));exports[_0x9cfa('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9cfa('0x2'),'as':_0x9cfa('0x3'),'attributes':['id','name',_0x9cfa('0x4')]}]},'log':_0x9cfa('0x1')});};}; \ No newline at end of file +var _0xe06c=['GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x5351df,_0xd782ca){var _0x1ab52d=function(_0x2f9fa7){while(--_0x2f9fa7){_0x5351df['push'](_0x5351df['shift']());}};_0x1ab52d(++_0xd782ca);}(_0xe06c,0x171));var _0xce06=function(_0x34e9c8,_0x1d2f14){_0x34e9c8=_0x34e9c8-0x0;var _0x570baa=_0xe06c[_0x34e9c8];return _0x570baa;};'use strict';var client=require(_0xce06('0x0'));exports[_0xce06('0x1')]=function(){return function(){return client['Request'](_0xce06('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xce06('0x3'),'as':_0xce06('0x4'),'attributes':['id',_0xce06('0x5'),_0xce06('0x6')]}]},'log':_0xce06('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4a586ab..7dfe765 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 _0x2ef3=['../client','update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x2ef3,0xba));var _0x32ef=function(_0x4b15bc,_0x238296){_0x4b15bc=_0x4b15bc-0x0;var _0x42382a=_0x2ef3[_0x4b15bc];return _0x42382a;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(_0x47513a,_0x26e56e){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'body':_0x26e56e,'options':{'where':{'id':_0x47513a}},'log':'updateMailInteraction'});};exports[_0x32ef('0x4')]=function(_0x38b7f3,_0x524ab6){return client[_0x32ef('0x2')](_0x32ef('0x5'),{'body':_0x524ab6,'options':{'where':{'id':_0x38b7f3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2a07=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x2a07,0x74));var _0x72a0=function(_0xb2fcbd,_0x5bfcfd){_0xb2fcbd=_0xb2fcbd-0x0;var _0x253dca=_0x2a07[_0xb2fcbd];return _0x253dca;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateMailInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f7b72ef..25dcb01 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 _0x705c=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0xcf7ad8,_0x17f8bb){var _0x5d298a=function(_0x3db7f2){while(--_0x3db7f2){_0xcf7ad8['push'](_0xcf7ad8['shift']());}};_0x5d298a(++_0x17f8bb);}(_0x705c,0x79));var _0xc705=function(_0xd096d4,_0x216274){_0xd096d4=_0xd096d4-0x0;var _0x3f84e9=_0x705c[_0xd096d4];return _0x3f84e9;};'use strict';var client=require(_0xc705('0x0'));exports['create']=function(_0x468a2f){return client[_0xc705('0x1')](_0xc705('0x2'),{'body':_0x468a2f,'log':_0xc705('0x3')});}; \ No newline at end of file +var _0xcf54=['Request','createMailMessage'];(function(_0x178040,_0x178d62){var _0x489e9f=function(_0x3388e9){while(--_0x3388e9){_0x178040['push'](_0x178040['shift']());}};_0x489e9f(++_0x178d62);}(_0xcf54,0x172));var _0x4cf5=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xcf54[_0x43de22];return _0x4b15ee;};'use strict';var client=require('../client');exports['create']=function(_0x12070f){return client[_0x4cf5('0x0')]('CreateMailMessage',{'body':_0x12070f,'log':_0x4cf5('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 72a3e29..3106515 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 _0xfeef=['online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x326daa,_0x2f4ea3){var _0x4bf855=function(_0x58e1b5){while(--_0x58e1b5){_0x326daa['push'](_0x326daa['shift']());}};_0x4bf855(++_0x2f4ea3);}(_0xfeef,0x10b));var _0xffee=function(_0x5e6b34,_0x2dbee5){_0x5e6b34=_0x5e6b34-0x0;var _0x3862c1=_0xfeef[_0x5e6b34];return _0x3862c1;};'use strict';var client=require(_0xffee('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xffee('0x1')](_0xffee('0x2'),{'options':{'raw':![],'attributes':['id',_0xffee('0x3'),_0xffee('0x4'),_0xffee('0x5')],'include':[{'model':_0xffee('0x6'),'as':_0xffee('0x7'),'attributes':['id',_0xffee('0x3'),_0xffee('0x8'),_0xffee('0x9')]}]},'log':_0xffee('0xa')});};}; \ No newline at end of file +var _0x0205=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x110600,_0x16f298){var _0x376eac=function(_0x478aee){while(--_0x478aee){_0x110600['push'](_0x110600['shift']());}};_0x376eac(++_0x16f298);}(_0x0205,0xfc));var _0x5020=function(_0x1cb766,_0x55b2c2){_0x1cb766=_0x1cb766-0x0;var _0x235b09=_0x0205[_0x1cb766];return _0x235b09;};'use strict';var client=require(_0x5020('0x0'));exports[_0x5020('0x1')]=function(){return function(){return client[_0x5020('0x2')](_0x5020('0x3'),{'options':{'raw':![],'attributes':['id',_0x5020('0x4'),_0x5020('0x5'),_0x5020('0x6')],'include':[{'model':_0x5020('0x7'),'as':_0x5020('0x8'),'attributes':['id',_0x5020('0x4'),_0x5020('0x9'),_0x5020('0xa')]}]},'log':_0x5020('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a110f3e..5544001 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 _0xee40=['UpdateMailQueueReport','../client','create','update','Request'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xee40,0x15f));var _0x0ee4=function(_0x150a72,_0x4dda50){_0x150a72=_0x150a72-0x0;var _0x5b5c63=_0xee40[_0x150a72];return _0x5b5c63;};'use strict';var client=require(_0x0ee4('0x0'));exports[_0x0ee4('0x1')]=function(_0xa9bd6c){return client['Request']('CreateMailQueueReport',{'body':_0xa9bd6c,'log':'CreateMailQueueReport'});};exports[_0x0ee4('0x2')]=function(_0x205f3f,_0x39364b){return client[_0x0ee4('0x3')]('UpdateMailQueueReport',{'body':_0x39364b,'options':{'where':{'uniqueid':_0x205f3f},'order':[['id','DESC']],'limit':0x1},'log':_0x0ee4('0x4')});}; \ No newline at end of file +var _0xb852=['UpdateMailQueueReport','DESC','create','CreateMailQueueReport','Request'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xb852,0x66));var _0x2b85=function(_0x31d102,_0x35fcf2){_0x31d102=_0x31d102-0x0;var _0x17fcc3=_0xb852[_0x31d102];return _0x17fcc3;};'use strict';var client=require('../client');exports[_0x2b85('0x0')]=function(_0x301554){return client['Request'](_0x2b85('0x1'),{'body':_0x301554,'log':_0x2b85('0x1')});};exports['update']=function(_0x3f3268,_0xc2d76c){return client[_0x2b85('0x2')](_0x2b85('0x3'),{'body':_0xc2d76c,'options':{'where':{'uniqueid':_0x3f3268},'order':[['id',_0x2b85('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0b7ec05..cc250ab 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 _0x19f0=['addTags','../client','Request','updateOpenchannelInteraction'];(function(_0x31e1eb,_0x21665d){var _0x24b751=function(_0x2360aa){while(--_0x2360aa){_0x31e1eb['push'](_0x31e1eb['shift']());}};_0x24b751(++_0x21665d);}(_0x19f0,0x159));var _0x019f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19f0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x019f('0x0'));exports['update']=function(_0xc52eda,_0x22b0e5){return client[_0x019f('0x1')]('UpdateOpenchannelInteraction',{'body':_0x22b0e5,'options':{'where':{'id':_0xc52eda}},'log':_0x019f('0x2')});};exports[_0x019f('0x3')]=function(_0x366ec9,_0xa071c1){return client[_0x019f('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0xa071c1,'options':{'where':{'id':_0x366ec9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x020b=['../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x020b,0x1dc));var _0xb020=function(_0x39b85e,_0x457ac5){_0x39b85e=_0x39b85e-0x0;var _0x2855a7=_0x020b[_0x39b85e];return _0x2855a7;};'use strict';var client=require(_0xb020('0x0'));exports[_0xb020('0x1')]=function(_0x3ce42d,_0x1061a9){return client['Request'](_0xb020('0x2'),{'body':_0x1061a9,'options':{'where':{'id':_0x3ce42d}},'log':_0xb020('0x3')});};exports[_0xb020('0x4')]=function(_0x1a7880,_0x288f3f){return client[_0xb020('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x288f3f,'options':{'where':{'id':_0x1a7880}},'log':_0xb020('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d608241..c342aff 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 _0xb3b4=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x4b7731,_0x1c639a){var _0x345aac=function(_0x45d968){while(--_0x45d968){_0x4b7731['push'](_0x4b7731['shift']());}};_0x345aac(++_0x1c639a);}(_0xb3b4,0xae));var _0x4b3b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb3b4[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0x4b3b('0x0'));exports[_0x4b3b('0x1')]=function(_0x32744f){return client['Request'](_0x4b3b('0x2'),{'body':_0x32744f,'log':_0x4b3b('0x3')});}; \ No newline at end of file +var _0x4a47=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4a47,0x189));var _0x74a4=function(_0x1098a9,_0x2748f9){_0x1098a9=_0x1098a9-0x0;var _0x166c83=_0x4a47[_0x1098a9];return _0x166c83;};'use strict';var client=require('../client');exports[_0x74a4('0x0')]=function(_0x1f29c4){return client[_0x74a4('0x1')](_0x74a4('0x2'),{'body':_0x1f29c4,'log':_0x74a4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 13fc696..f43f9d6 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 _0xb566=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents','name'];(function(_0x47c7df,_0x484b74){var _0x261bc8=function(_0x328733){while(--_0x328733){_0x47c7df['push'](_0x47c7df['shift']());}};_0x261bc8(++_0x484b74);}(_0xb566,0x1f1));var _0x6b56=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xb566[_0x4b174a];return _0x3cd7bf;};'use strict';var client=require(_0x6b56('0x0'));exports[_0x6b56('0x1')]=function(){return function(){return client[_0x6b56('0x2')](_0x6b56('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6b56('0x4'),_0x6b56('0x5')],'include':[{'model':_0x6b56('0x6'),'as':_0x6b56('0x7'),'attributes':['id',_0x6b56('0x8'),_0x6b56('0x9'),_0x6b56('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x3b1e=['timeout','strategy','Agents','name','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x3b1e,0x10e));var _0xe3b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3b1e[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0xe3b1('0x0')]=function(){return function(){return client[_0xe3b1('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xe3b1('0x2'),_0xe3b1('0x3')],'include':[{'model':'User','as':_0xe3b1('0x4'),'attributes':['id',_0xe3b1('0x5'),_0xe3b1('0x6'),_0xe3b1('0x7')]}]},'log':_0xe3b1('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4e135a3..df9ac3e 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 _0xc474=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0xc474,0xe8));var _0x4c47=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc474[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x4c47('0x0'));exports[_0x4c47('0x1')]=function(_0x4bf339){return client[_0x4c47('0x2')](_0x4c47('0x3'),{'body':_0x4bf339,'log':_0x4c47('0x3')});};exports[_0x4c47('0x4')]=function(_0x1327c2,_0x5f4c76){return client[_0x4c47('0x2')](_0x4c47('0x5'),{'body':_0x5f4c76,'options':{'where':{'uniqueid':_0x1327c2},'order':[['id',_0x4c47('0x6')]],'limit':0x1},'log':_0x4c47('0x5')});}; \ No newline at end of file +var _0x4d41=['update','Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x4d41,0x153));var _0x14d4=function(_0x3f9606,_0x5b0a04){_0x3f9606=_0x3f9606-0x0;var _0x4487d6=_0x4d41[_0x3f9606];return _0x4487d6;};'use strict';var client=require(_0x14d4('0x0'));exports[_0x14d4('0x1')]=function(_0xc3fa40){return client['Request'](_0x14d4('0x2'),{'body':_0xc3fa40,'log':_0x14d4('0x2')});};exports[_0x14d4('0x3')]=function(_0x55ec0d,_0x1d6194){return client[_0x14d4('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x1d6194,'options':{'where':{'uniqueid':_0x55ec0d},'order':[['id','DESC']],'limit':0x1},'log':_0x14d4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 582588a..203a9e1 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 _0xf50b=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x25e02b,_0x1ecf5c){var _0x562c2e=function(_0x1b7b86){while(--_0x1b7b86){_0x25e02b['push'](_0x25e02b['shift']());}};_0x562c2e(++_0x1ecf5c);}(_0xf50b,0xc8));var _0xbf50=function(_0xa7e746,_0x2071b3){_0xa7e746=_0xa7e746-0x0;var _0x27c383=_0xf50b[_0xa7e746];return _0x27c383;};'use strict';var client=require(_0xbf50('0x0'));exports[_0xbf50('0x1')]=function(_0x5a5798,_0x389fbd){return client[_0xbf50('0x2')](_0xbf50('0x3'),{'body':_0x389fbd,'options':{'where':{'id':_0x5a5798}},'log':_0xbf50('0x4')});};exports['addTags']=function(_0x32217d,_0x4f5ba8){return client[_0xbf50('0x2')](_0xbf50('0x5'),{'body':_0x4f5ba8,'options':{'where':{'id':_0x32217d}},'log':_0xbf50('0x6')});}; \ No newline at end of file +var _0xf725=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf725,0x7e));var _0x5f72=function(_0x1684be,_0x39d723){_0x1684be=_0x1684be-0x0;var _0x4aa663=_0xf725[_0x1684be];return _0x4aa663;};'use strict';var client=require(_0x5f72('0x0'));exports[_0x5f72('0x1')]=function(_0x3fb132,_0x3ccab6){return client[_0x5f72('0x2')](_0x5f72('0x3'),{'body':_0x3ccab6,'options':{'where':{'id':_0x3fb132}},'log':_0x5f72('0x4')});};exports[_0x5f72('0x5')]=function(_0x4200ff,_0x17a5bc){return client['Request'](_0x5f72('0x6'),{'body':_0x17a5bc,'options':{'where':{'id':_0x4200ff}},'log':_0x5f72('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 48f161c..80618e6 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 _0x1420=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x13700f,_0x540581){var _0x1d2505=function(_0xfc8893){while(--_0xfc8893){_0x13700f['push'](_0x13700f['shift']());}};_0x1d2505(++_0x540581);}(_0x1420,0x1a4));var _0x0142=function(_0x3d0551,_0x40b6f1){_0x3d0551=_0x3d0551-0x0;var _0x129c28=_0x1420[_0x3d0551];return _0x129c28;};'use strict';var client=require(_0x0142('0x0'));exports[_0x0142('0x1')]=function(_0x3627b2){return client['Request'](_0x0142('0x2'),{'body':_0x3627b2,'log':_0x0142('0x3')});}; \ No newline at end of file +var _0x8c66=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x43ee7e,_0x78e09b){var _0x22d326=function(_0x2261a4){while(--_0x2261a4){_0x43ee7e['push'](_0x43ee7e['shift']());}};_0x22d326(++_0x78e09b);}(_0x8c66,0x134));var _0x68c6=function(_0x57e4aa,_0x482b33){_0x57e4aa=_0x57e4aa-0x0;var _0x203e32=_0x8c66[_0x57e4aa];return _0x203e32;};'use strict';var client=require(_0x68c6('0x0'));exports[_0x68c6('0x1')]=function(_0x140cb7){return client[_0x68c6('0x2')](_0x68c6('0x3'),{'body':_0x140cb7,'log':_0x68c6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 96e42ca..311d001 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x26d0b4,_0x3091c9){var _0x3ac956=function(_0x837ace){while(--_0x837ace){_0x26d0b4['push'](_0x26d0b4['shift']());}};_0x3ac956(++_0x3091c9);}(_0x70e0,0x17b));var _0x070e=function(_0x3fa33f,_0x22a79c){_0x3fa33f=_0x3fa33f-0x0;var _0x103ceb=_0x70e0[_0x3fa33f];return _0x103ceb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xf71a68,_0x5d1544){var _0x2ba67d=function(_0x488df5){while(--_0x488df5){_0xf71a68['push'](_0xf71a68['shift']());}};_0x2ba67d(++_0x5d1544);}(_0xe706,0xa3));var _0x6e70=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0xe706[_0x57cb4f];return _0x29bb45;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a328af5..287c85d 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4940a0,_0x3f9be1){var _0x556f14=function(_0x119685){while(--_0x119685){_0x4940a0['push'](_0x4940a0['shift']());}};_0x556f14(++_0x3f9be1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x258980,_0x5d09c7){var _0x4fdded=function(_0x406a31){while(--_0x406a31){_0x258980['push'](_0x258980['shift']());}};_0x4fdded(++_0x5d09c7);}(_0x34e8,0x12c));var _0x834e=function(_0x184d5d,_0x150a67){_0x184d5d=_0x184d5d-0x0;var _0x549946=_0x34e8[_0x184d5d];return _0x549946;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5f95c98..8c500ea 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(_0x3a4385,_0xd087e){var _0x233d18=function(_0x142704){while(--_0x142704){_0x3a4385['push'](_0x3a4385['shift']());}};_0x233d18(++_0xd087e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x5f1d31,_0x339914){var _0x2de72=function(_0x16aced){while(--_0x16aced){_0x5f1d31['push'](_0x5f1d31['shift']());}};_0x2de72(++_0x339914);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 92243cc..0dd1664 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 _0x5fab=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x450ca4,_0x45b632){var _0x4a720a=function(_0x31c6c4){while(--_0x31c6c4){_0x450ca4['push'](_0x450ca4['shift']());}};_0x4a720a(++_0x45b632);}(_0x5fab,0x177));var _0xb5fa=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0x5fab[_0x140d2f];return _0x1a04c6;};'use strict';var client=require(_0xb5fa('0x0'));exports[_0xb5fa('0x1')]=function(_0x4c67f9,_0xc34cfd){return client[_0xb5fa('0x2')](_0xb5fa('0x3'),{'body':_0xc34cfd,'options':{'where':{'id':_0x4c67f9}},'log':_0xb5fa('0x4')});};exports[_0xb5fa('0x5')]=function(_0x595d8b,_0x29390a){return client[_0xb5fa('0x2')](_0xb5fa('0x6'),{'body':_0x29390a,'options':{'where':{'id':_0x595d8b}},'log':_0xb5fa('0x7')});}; \ No newline at end of file +var _0x6c45=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x6c45,0xb1));var _0x56c4=function(_0x4fa2b1,_0x168546){_0x4fa2b1=_0x4fa2b1-0x0;var _0xf7ae5f=_0x6c45[_0x4fa2b1];return _0xf7ae5f;};'use strict';var client=require(_0x56c4('0x0'));exports[_0x56c4('0x1')]=function(_0x559ee6,_0x2f7ee3){return client[_0x56c4('0x2')](_0x56c4('0x3'),{'body':_0x2f7ee3,'options':{'where':{'id':_0x559ee6}},'log':_0x56c4('0x4')});};exports[_0x56c4('0x5')]=function(_0x18d229,_0x1096ce){return client[_0x56c4('0x2')](_0x56c4('0x6'),{'body':_0x1096ce,'options':{'where':{'id':_0x18d229}},'log':_0x56c4('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 95ac567..e4d3362 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 _0x12ff=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x12ff,0x14f));var _0xf12f=function(_0x5b532b,_0x5f47e3){_0x5b532b=_0x5b532b-0x0;var _0x3d6594=_0x12ff[_0x5b532b];return _0x3d6594;};'use strict';var client=require('../client');exports[_0xf12f('0x0')]=function(_0x57e652){return client['Request'](_0xf12f('0x1'),{'body':_0x57e652,'log':_0xf12f('0x2')});}; \ No newline at end of file +var _0x67a3=['Request','CreateWhatsappMessage','../client','create'];(function(_0x15afbe,_0x362ca1){var _0x332f02=function(_0x3c9884){while(--_0x3c9884){_0x15afbe['push'](_0x15afbe['shift']());}};_0x332f02(++_0x362ca1);}(_0x67a3,0x19a));var _0x367a=function(_0x23173a,_0x3a9e78){_0x23173a=_0x23173a-0x0;var _0x164fe1=_0x67a3[_0x23173a];return _0x164fe1;};'use strict';var client=require(_0x367a('0x0'));exports[_0x367a('0x1')]=function(_0x531ba1){return client[_0x367a('0x2')](_0x367a('0x3'),{'body':_0x531ba1,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ad6bef8..1df3241 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 _0x5515=['getWhatsappQueues','GetWhatsappQueue','timeout','strategy','User','name','online','whatsappPause','../client'];(function(_0x5aa2ee,_0x2b5bc2){var _0x2437fe=function(_0x129186){while(--_0x129186){_0x5aa2ee['push'](_0x5aa2ee['shift']());}};_0x2437fe(++_0x2b5bc2);}(_0x5515,0x116));var _0x5551=function(_0x2a01d3,_0x1b7cf0){_0x2a01d3=_0x2a01d3-0x0;var _0x5610d5=_0x5515[_0x2a01d3];return _0x5610d5;};'use strict';var client=require(_0x5551('0x0'));exports[_0x5551('0x1')]=function(){return function(){return client['Request'](_0x5551('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5551('0x3'),_0x5551('0x4')],'include':[{'model':_0x5551('0x5'),'as':'Agents','attributes':['id',_0x5551('0x6'),_0x5551('0x7'),_0x5551('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xc684=['Request','GetWhatsappQueue','name','User','Agents','online','../client','getWhatsappQueues'];(function(_0x1e6659,_0x42223e){var _0x528143=function(_0x1edcd8){while(--_0x1edcd8){_0x1e6659['push'](_0x1e6659['shift']());}};_0x528143(++_0x42223e);}(_0xc684,0x1be));var _0x4c68=function(_0x74ef71,_0x7dcf39){_0x74ef71=_0x74ef71-0x0;var _0x1d5efa=_0xc684[_0x74ef71];return _0x1d5efa;};'use strict';var client=require(_0x4c68('0x0'));exports[_0x4c68('0x1')]=function(){return function(){return client[_0x4c68('0x2')](_0x4c68('0x3'),{'options':{'raw':![],'attributes':['id',_0x4c68('0x4'),'timeout','strategy'],'include':[{'model':_0x4c68('0x5'),'as':_0x4c68('0x6'),'attributes':['id',_0x4c68('0x4'),_0x4c68('0x7'),'whatsappPause']}]},'log':_0x4c68('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 94915e6..0afcdb0 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 _0xb9e7=['UpdateWhatsappQueueReport','../client','Request','update'];(function(_0x2f5467,_0x439b3f){var _0x4fe548=function(_0x45dfbb){while(--_0x45dfbb){_0x2f5467['push'](_0x2f5467['shift']());}};_0x4fe548(++_0x439b3f);}(_0xb9e7,0x101));var _0x7b9e=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xb9e7[_0x2f57b2];return _0x5ace77;};'use strict';var client=require(_0x7b9e('0x0'));exports['create']=function(_0x57cc89){return client[_0x7b9e('0x1')]('CreateWhatsappQueueReport',{'body':_0x57cc89,'log':'CreateWhatsappQueueReport'});};exports[_0x7b9e('0x2')]=function(_0x2f199a,_0x3f0658){return client['Request'](_0x7b9e('0x3'),{'body':_0x3f0658,'options':{'where':{'uniqueid':_0x2f199a},'order':[['id','DESC']],'limit':0x1},'log':_0x7b9e('0x3')});}; \ No newline at end of file +var _0xda5e=['Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x514c5c,_0x39748b){var _0x2c6ddf=function(_0x340bf5){while(--_0x340bf5){_0x514c5c['push'](_0x514c5c['shift']());}};_0x2c6ddf(++_0x39748b);}(_0xda5e,0xd5));var _0xeda5=function(_0x5cfeda,_0x14912c){_0x5cfeda=_0x5cfeda-0x0;var _0x33202c=_0xda5e[_0x5cfeda];return _0x33202c;};'use strict';var client=require(_0xeda5('0x0'));exports[_0xeda5('0x1')]=function(_0x384e8b){return client['Request'](_0xeda5('0x2'),{'body':_0x384e8b,'log':_0xeda5('0x2')});};exports['update']=function(_0x311b90,_0x410274){return client[_0xeda5('0x3')](_0xeda5('0x4'),{'body':_0x410274,'options':{'where':{'uniqueid':_0x311b90},'order':[['id',_0xeda5('0x5')]],'limit':0x1},'log':_0xeda5('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 a323a87..5e27bfd 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 _0xe457=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map','message','join','stop','find','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','./strategy','timeout\x20is\x20a\x20number','info','format'];(function(_0x5ea49b,_0x132709){var _0x598154=function(_0x34f700){while(--_0x34f700){_0x5ea49b['push'](_0x5ea49b['shift']());}};_0x598154(++_0x132709);}(_0xe457,0x93));var _0x7e45=function(_0x205101,_0x4fffeb){_0x205101=_0x205101-0x0;var _0x44dd13=_0xe457[_0x205101];return _0x44dd13;};'use strict';var schema=require(_0x7e45('0x0'));var _=require(_0x7e45('0x1'));var util=require(_0x7e45('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x7e45('0x3'))('routing');var strategy=require(_0x7e45('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7e45('0x5')}});function writeLog(_0x4943d3,_0x501943,_0x59ac40){return logger[_0x7e45('0x6')](util[_0x7e45('0x7')](_0x7e45('0x8'),_0x4943d3,_0x501943['name'],_0x59ac40));}function handleFindAgent(_0x23267b){return function(_0x23b99c){return _0x23b99c[_0x7e45('0x9')][_0x7e45('0xa')]()===_0x23267b[_0x7e45('0xa')]();};}exports[_0x7e45('0xb')]=function(_0xe49dc8,_0xf45e5e,_0x212abd,_0x384899){return function(_0x5c41c0){try{var _0x4d26a5={'name':_0xf45e5e[0x0],'timeout':_0xf45e5e[0x1]};var _0x4dcda5=queue[_0x7e45('0x0')](_0x4d26a5,{'typecast':!![]});if(_0x4dcda5['length']){logger[_0x7e45('0xc')]('[%s][AGENT]\x20%s',_0xe49dc8,_[_0x7e45('0xd')](_0x4dcda5,_0x7e45('0xe'))[_0x7e45('0xf')](',\x20'));_0x5c41c0[_0x7e45('0x10')]();}else{var _0x48ffd3=_[_0x7e45('0x11')](_0x212abd['agents'],handleFindAgent(_0x4d26a5[_0x7e45('0x9')]));if(_0x48ffd3){var _0x3164fb=(_0x4d26a5['timeout']||0xa)*0x3e8;var _0x4d744c,_0x5161ae;var _0x13245e=seqqueue[_0x7e45('0x12')](_0x3164fb);_0x13245e['id']=_0xe49dc8;_0x13245e['atimeout']=_0x3164fb;_0x13245e[_0x7e45('0x13')]=_0x384899['channel'];writeLog(_0xe49dc8,_0x48ffd3,util[_0x7e45('0x7')](_0x7e45('0x14'),_0x3164fb));_0x212abd[_0x7e45('0x15')][_0xe49dc8]['on']('end',function(){logger[_0x7e45('0x6')](_0x7e45('0x16'),_0xe49dc8);clearTimeout(_0x5161ae);_0x5161ae=undefined;_0x13245e[_0x7e45('0x17')]();if(_0x212abd[_0x7e45('0x15')][_0xe49dc8]){delete _0x212abd[_0x7e45('0x15')][_0xe49dc8];}_0x5c41c0[_0x7e45('0x10')]();});_0x212abd[_0x7e45('0x15')][_0xe49dc8]['on'](_0x7e45('0x18'),function(){if(_0x212abd[_0x7e45('0x15')][_0xe49dc8]){delete _0x212abd['rules'][_0xe49dc8];}});_0x5161ae=setTimeout(function(){logger[_0x7e45('0x6')](_0x7e45('0x19'),_0xe49dc8);clearTimeout(_0x5161ae);_0x13245e[_0x7e45('0x17')]();_0x5c41c0[_0x7e45('0x1a')]();},_0x3164fb);strategy[_0x7e45('0x1b')](_0x13245e,_0x48ffd3,_0x212abd,_0x384899);}else{logger[_0x7e45('0xc')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xe49dc8,_0x4d26a5['name']);_0x5c41c0['stop']();}}}catch(_0x51e6d8){console[_0x7e45('0x1c')](_0x51e6d8);logger[_0x7e45('0xc')](_0x7e45('0x1d'),_0xe49dc8,_0x51e6d8[_0x7e45('0x1e')]);_0x5c41c0[_0x7e45('0x10')]();}};}; \ No newline at end of file +var _0x692a=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x692a,0x12a));var _0xa692=function(_0x2a3d7b,_0x557b91){_0x2a3d7b=_0x2a3d7b-0x0;var _0x2c15fb=_0x692a[_0x2a3d7b];return _0x2c15fb;};'use strict';var schema=require(_0xa692('0x0'));var _=require(_0xa692('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xa692('0x2'))(_0xa692('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xa692('0x4')},'timeout':{'type':_0xa692('0x5'),'message':_0xa692('0x6')}});function writeLog(_0x46f794,_0x496d52,_0x2c0ed1){return logger[_0xa692('0x7')](util['format'](_0xa692('0x8'),_0x46f794,_0x496d52['name'],_0x2c0ed1));}function handleFindAgent(_0x261cb2){return function(_0x2ba08f){return _0x2ba08f[_0xa692('0x9')][_0xa692('0xa')]()===_0x261cb2[_0xa692('0xa')]();};}exports[_0xa692('0xb')]=function(_0x383927,_0x1d9ad4,_0x256759,_0x5b77ac){return function(_0x2e67cf){try{var _0x37753b={'name':_0x1d9ad4[0x0],'timeout':_0x1d9ad4[0x1]};var _0x1b22e5=queue[_0xa692('0x0')](_0x37753b,{'typecast':!![]});if(_0x1b22e5[_0xa692('0xc')]){logger['error'](_0xa692('0xd'),_0x383927,_['map'](_0x1b22e5,_0xa692('0xe'))[_0xa692('0xf')](',\x20'));_0x2e67cf[_0xa692('0x10')]();}else{var _0x5b2934=_[_0xa692('0x11')](_0x256759[_0xa692('0x12')],handleFindAgent(_0x37753b['name']));if(_0x5b2934){var _0x10b3ee=(_0x37753b[_0xa692('0x13')]||0xa)*0x3e8;var _0x2b8bfa,_0x4b671d;var _0x32b766=seqqueue[_0xa692('0x14')](_0x10b3ee);_0x32b766['id']=_0x383927;_0x32b766[_0xa692('0x15')]=_0x10b3ee;_0x32b766[_0xa692('0x16')]=_0x5b77ac['channel'];writeLog(_0x383927,_0x5b2934,util['format'](_0xa692('0x17'),_0x10b3ee));_0x256759[_0xa692('0x18')][_0x383927]['on'](_0xa692('0x19'),function(){logger[_0xa692('0x7')](_0xa692('0x1a'),_0x383927);clearTimeout(_0x4b671d);_0x4b671d=undefined;_0x32b766[_0xa692('0x1b')]();if(_0x256759['rules'][_0x383927]){delete _0x256759[_0xa692('0x18')][_0x383927];}_0x2e67cf[_0xa692('0x10')]();});_0x256759[_0xa692('0x18')][_0x383927]['on']('complete',function(){if(_0x256759[_0xa692('0x18')][_0x383927]){delete _0x256759[_0xa692('0x18')][_0x383927];}});_0x4b671d=setTimeout(function(){logger[_0xa692('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x383927);clearTimeout(_0x4b671d);_0x32b766[_0xa692('0x1b')]();_0x2e67cf['next']();},_0x10b3ee);strategy[_0xa692('0x1c')](_0x32b766,_0x5b2934,_0x256759,_0x5b77ac);}else{logger[_0xa692('0x1d')](_0xa692('0x1e'),_0x383927,_0x37753b['name']);_0x2e67cf[_0xa692('0x10')]();}}}catch(_0x4aab8a){console[_0xa692('0x1f')](_0x4aab8a);logger['error'](_0xa692('0x20'),_0x383927,_0x4aab8a[_0xa692('0x21')]);_0x2e67cf['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 6ede1ab..cfd6f48 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 _0xb82d=['stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','amazonlex','providerResponse','Message','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','getMustacheRender','create','catch','error'];(function(_0xdf8eb,_0x221174){var _0x4274be=function(_0x107bfc){while(--_0x107bfc){_0xdf8eb['push'](_0xdf8eb['shift']());}};_0x4274be(++_0x221174);}(_0xb82d,0xc8));var _0xdb82=function(_0x4afca7,_0x14016b){_0x4afca7=_0x4afca7-0x0;var _0x1c5908=_0xb82d[_0x4afca7];return _0x1c5908;};'use strict';var _=require(_0xdb82('0x0'));var moment=require('moment');var AWS=require(_0xdb82('0x1'));var utils=require(_0xdb82('0x2'));var logger=require(_0xdb82('0x3'))(_0xdb82('0x4'));var rpc={'chatMessage':require(_0xdb82('0x5')),'openchannelMessage':require(_0xdb82('0x6')),'mailMessage':require(_0xdb82('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdb82('0x8')),'whatsappMessage':require(_0xdb82('0x9'))};exports['consequence']=function(_0x1eaf9f,_0x196205){return function(_0x55799f){try{if(!_[_0xdb82('0xa')](this[_0xdb82('0xb')][_0xdb82('0xc')])){logger[_0xdb82('0xd')](_0xdb82('0xe'),_0x1eaf9f,_0xdb82('0xf'));return _0x55799f[_0xdb82('0x10')]();}var _0x3ad001={'ContactId':this[_0xdb82('0x11')]['id'],'sentAt':moment()[_0xdb82('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xdb82('0x13')]===_0xdb82('0x14')||this[_0xdb82('0x13')]===_0xdb82('0x15')){_0x3ad001[_0xdb82('0x16')]=this[_0xdb82('0xb')][_0xdb82('0x16')];}var _0x4cae81=this[_0xdb82('0x13')];if(_0x4cae81===_0xdb82('0x17')){_0x3ad001[_0xdb82('0x18')]=this['account']['id'];}else{_0x3ad001[_[_0xdb82('0x19')](_0x4cae81)+_0xdb82('0x1a')]=this[_0xdb82('0x1b')]['id'];}_0x3ad001[_[_0xdb82('0x19')](_0x4cae81)+_0xdb82('0x1c')]=this[_0xdb82('0xb')]['id'];if(this[_0xdb82('0xb')]['created']){var _0x93cef6=_0x196205[0x4];if(!_[_0xdb82('0x1d')](_0x93cef6)){_0x3ad001[_0xdb82('0x1e')]=utils[_0xdb82('0x1f')](_0x93cef6,this);return rpc[_0x4cae81+'Message'][_0xdb82('0x20')](_0x3ad001)['then'](function(_0x304dae){logger[_0xdb82('0xd')](_0xdb82('0xe'),_0x1eaf9f,_0x3ad001[_0xdb82('0x1e')]);})[_0xdb82('0x21')](function(_0x4ec8ea){logger[_0xdb82('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1eaf9f,JSON[_0xdb82('0x23')](_0x4ec8ea));})[_0xdb82('0x24')](function(){logger[_0xdb82('0xd')](_0xdb82('0x25'),_0x1eaf9f);_0x55799f['stop']();});}else{logger['info'](_0xdb82('0x26'),_0x1eaf9f);_0x55799f[_0xdb82('0x27')]();}}else{var _0x14eb0b=this;var _0x5cf3e3=new AWS[(_0xdb82('0x28'))]({'accessKeyId':_0x196205[0x0],'secretAccessKey':_0x196205[0x1],'region':_0x196205[0x2]});var _0x17eb75={'botAlias':_0xdb82('0x29'),'botName':_0x196205[0x3],'inputText':this[_0xdb82('0x2a')][_0xdb82('0x1e')],'userId':this[_0xdb82('0x13')]+':'+this['interaction']['id']['toString']()};_0x5cf3e3['postText'](_0x17eb75,function(_0x20d2d8,_0x4390b4){if(_0x20d2d8){logger[_0xdb82('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1eaf9f,_0x20d2d8['message']);_0x55799f[_0xdb82('0x10')]();}else if(_0x4390b4&&_0x4390b4[_0xdb82('0x2a')]){_0x14eb0b[_0xdb82('0x1e')][_0xdb82('0x2b')]=_0x4390b4;_0x3ad001[_0xdb82('0x1e')]=_0x4390b4[_0xdb82('0x2a')];_0x3ad001['providerName']=_0xdb82('0x2b');_0x3ad001[_0xdb82('0x2c')]=JSON[_0xdb82('0x23')](_0x4390b4);return rpc[_0x4cae81+_0xdb82('0x2d')]['create'](_0x3ad001)['then'](function(_0x47c81c){logger[_0xdb82('0xd')](_0xdb82('0xe'),_0x1eaf9f,_0x3ad001[_0xdb82('0x1e')]);if(_0x4390b4['dialogState']==_0xdb82('0x2e')){_0x55799f[_0xdb82('0x10')]();}else{_0x55799f[_0xdb82('0x27')]();}})[_0xdb82('0x21')](function(_0x163a58){logger[_0xdb82('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1eaf9f,JSON[_0xdb82('0x23')](_0x163a58));_0x55799f[_0xdb82('0x10')]();});}else{_0x55799f[_0xdb82('0x10')]();}});}}catch(_0x4f47c3){logger[_0xdb82('0x22')](_0xdb82('0xe'),_0x1eaf9f,JSON[_0xdb82('0x23')](_0x4f47c3));_0x55799f[_0xdb82('0x27')]();}};}; \ No newline at end of file +var _0x92ca=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','create','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x41601d,_0x36ad17){var _0x1d5fb2=function(_0x27e1b6){while(--_0x27e1b6){_0x41601d['push'](_0x41601d['shift']());}};_0x1d5fb2(++_0x36ad17);}(_0x92ca,0x181));var _0xa92c=function(_0x114ff6,_0x19e80d){_0x114ff6=_0x114ff6-0x0;var _0x4d3a58=_0x92ca[_0x114ff6];return _0x4d3a58;};'use strict';var _=require(_0xa92c('0x0'));var moment=require(_0xa92c('0x1'));var AWS=require(_0xa92c('0x2'));var utils=require(_0xa92c('0x3'));var logger=require(_0xa92c('0x4'))(_0xa92c('0x5'));var rpc={'chatMessage':require(_0xa92c('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa92c('0x7')),'smsMessage':require(_0xa92c('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa92c('0x9'))};exports[_0xa92c('0xa')]=function(_0x592220,_0x12372d){return function(_0x44dd60){try{if(!_[_0xa92c('0xb')](this[_0xa92c('0xc')]['UserId'])){logger[_0xa92c('0xd')](_0xa92c('0xe'),_0x592220,_0xa92c('0xf'));return _0x44dd60['next']();}var _0x549afe={'ContactId':this[_0xa92c('0x10')]['id'],'sentAt':moment()[_0xa92c('0x11')](_0xa92c('0x12')),'direction':_0xa92c('0x13')};if(this[_0xa92c('0x14')]===_0xa92c('0x15')||this[_0xa92c('0x14')]===_0xa92c('0x16')){_0x549afe['phone']=this[_0xa92c('0xc')]['phone'];}var _0x51e176=this[_0xa92c('0x14')];if(_0x51e176==='chat'){_0x549afe[_0xa92c('0x17')]=this[_0xa92c('0x18')]['id'];}else{_0x549afe[_[_0xa92c('0x19')](_0x51e176)+_0xa92c('0x1a')]=this[_0xa92c('0x18')]['id'];}_0x549afe[_[_0xa92c('0x19')](_0x51e176)+_0xa92c('0x1b')]=this[_0xa92c('0xc')]['id'];if(this[_0xa92c('0xc')][_0xa92c('0x1c')]){var _0x1a40e8=_0x12372d[0x4];if(!_['isEmpty'](_0x1a40e8)){_0x549afe[_0xa92c('0x1d')]=utils[_0xa92c('0x1e')](_0x1a40e8,this);return rpc[_0x51e176+_0xa92c('0x1f')]['create'](_0x549afe)[_0xa92c('0x20')](function(_0x1cdc9f){logger['info']('[%s][AMAZONLEX]\x20%s',_0x592220,_0x549afe['body']);})['catch'](function(_0x24a615){logger[_0xa92c('0x21')]('[%s][AMAZONLEX]\x20%s',_0x592220,JSON[_0xa92c('0x22')](_0x24a615));})[_0xa92c('0x23')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x592220);_0x44dd60['stop']();});}else{logger[_0xa92c('0xd')](_0xa92c('0x24'),_0x592220);_0x44dd60[_0xa92c('0x25')]();}}else{var _0x43e833=this;var _0x252915=new AWS[(_0xa92c('0x26'))]({'accessKeyId':_0x12372d[0x0],'secretAccessKey':_0x12372d[0x1],'region':_0x12372d[0x2]});var _0x28163b={'botAlias':_0xa92c('0x27'),'botName':_0x12372d[0x3],'inputText':this[_0xa92c('0x28')][_0xa92c('0x1d')],'userId':this[_0xa92c('0x14')]+':'+this[_0xa92c('0xc')]['id'][_0xa92c('0x29')]()};_0x252915[_0xa92c('0x2a')](_0x28163b,function(_0xf6329,_0x354ce9){if(_0xf6329){logger['error'](_0xa92c('0xe'),_0x592220,_0xf6329['message']);_0x44dd60['next']();}else if(_0x354ce9&&_0x354ce9['message']){_0x43e833[_0xa92c('0x1d')][_0xa92c('0x2b')]=_0x354ce9;_0x549afe[_0xa92c('0x1d')]=_0x354ce9[_0xa92c('0x28')];_0x549afe[_0xa92c('0x2c')]=_0xa92c('0x2b');_0x549afe[_0xa92c('0x2d')]=JSON['stringify'](_0x354ce9);return rpc[_0x51e176+_0xa92c('0x1f')][_0xa92c('0x2e')](_0x549afe)[_0xa92c('0x20')](function(_0x291c5e){logger[_0xa92c('0xd')]('[%s][AMAZONLEX]\x20%s',_0x592220,_0x549afe[_0xa92c('0x1d')]);if(_0x354ce9['dialogState']==_0xa92c('0x2f')){_0x44dd60[_0xa92c('0x30')]();}else{_0x44dd60['stop']();}})['catch'](function(_0x5079bc){logger[_0xa92c('0x21')](_0xa92c('0xe'),_0x592220,JSON[_0xa92c('0x22')](_0x5079bc));_0x44dd60['next']();});}else{_0x44dd60[_0xa92c('0x30')]();}});}}catch(_0x9a9bc0){logger[_0xa92c('0x21')](_0xa92c('0xe'),_0x592220,JSON[_0xa92c('0x22')](_0x9a9bc0));_0x44dd60[_0xa92c('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index f6567bc..b6b7ae9 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 _0x6cbf=['Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','';_0xc8e3da['headers']={'Auto-Submitted':_0xf6cb('0x35'),'X-Auto-Response-Suppress':_0xf6cb('0x36'),'Precedence':_0xf6cb('0x37')};return mailRpc['sendMailMessage'](this[_0xf6cb('0x2a')][_0xf6cb('0x38')],_0xc8e3da)[_0xf6cb('0x39')](function(_0x59b964){logger['info'](_0xf6cb('0x3a'),_0x1cab49);_0xc8e3da['messageId']=_0x59b964[_0xf6cb('0x20')][_0xf6cb('0x2f')];return rpc[_0x452b85+'Message'][_0xf6cb('0x3b')](_0xc8e3da);})['then'](function(_0x40c3e9){logger[_0xf6cb('0x12')](_0xf6cb('0x17'),_0x1cab49,JSON['stringify'](_0x40c3e9));})['catch'](function(_0x4f49d0){logger[_0xf6cb('0x3c')](_0xf6cb('0x3d'),_0x1cab49,JSON[_0xf6cb('0x3e')](_0x4f49d0));})[_0xf6cb('0x3f')](function(){Promise[_0xf6cb('0x40')]()[_0xf6cb('0x39')](function(){if(_0x3f5872[0x0]!=='2'||_0x2195ef['autoreplyExecuted'])return;return rpc[_0x452b85+'Interaction'][_0xf6cb('0x41')](_0x2195ef['id'],{'autoreplyExecuted':!![]})[_0xf6cb('0x39')](function(_0x1dd486){logger[_0xf6cb('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1cab49,JSON[_0xf6cb('0x3e')](_0x1dd486));})[_0xf6cb('0x42')](function(_0x559f95){logger['error'](_0xf6cb('0x43'),_0x1cab49,JSON['stringify'](_0x559f95));});})[_0xf6cb('0x39')](function(){_0x1a3c08[_0xf6cb('0x19')]();});});}else{return rpc[this[_0xf6cb('0xe')]+_0xf6cb('0x2e')][_0xf6cb('0x3b')](_0xc8e3da)['then'](function(){logger['info'](_0xf6cb('0x17'),_0x1cab49,_0xc8e3da[_0xf6cb('0x10')]);})[_0xf6cb('0x42')](function(_0x58d3c9){logger[_0xf6cb('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1cab49,JSON['stringify'](_0x58d3c9));})['finally'](function(){Promise['resolve']()[_0xf6cb('0x39')](function(){if(_0x3f5872[0x0]!=='2'||_0x2195ef[_0xf6cb('0x1a')])return;return rpc[_0x452b85+_0xf6cb('0x44')][_0xf6cb('0x41')](_0x2195ef['id'],{'autoreplyExecuted':!![]})[_0xf6cb('0x39')](function(_0x265c68){logger[_0xf6cb('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1cab49,JSON[_0xf6cb('0x3e')](_0x265c68));})[_0xf6cb('0x42')](function(_0x3f561f){logger[_0xf6cb('0x3c')](_0xf6cb('0x43'),_0x1cab49,JSON[_0xf6cb('0x3e')](_0x3f561f));});})[_0xf6cb('0x39')](function(){_0x1a3c08['next']();});});}}}catch(_0x117dab){logger[_0xf6cb('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1cab49,JSON['stringify'](_0x117dab));_0x1a3c08[_0xf6cb('0x45')]();}};}; \ No newline at end of file +var _0xe55f=['startsWith','Re:','Re:\x20','upperFirst','AccountId','InteractionId','inReplyTo','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','account','smtpOptions','then','messageId','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Interaction','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','resolve','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject'];(function(_0x5ad324,_0x2f373c){var _0x3b83ab=function(_0x1db2b9){while(--_0x1db2b9){_0x5ad324['push'](_0x5ad324['shift']());}};_0x3b83ab(++_0x2f373c);}(_0xe55f,0xf1));var _0xfe55=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0xe55f[_0x44b0de];return _0x21da2a;};'use strict';var _=require(_0xfe55('0x0'));var moment=require(_0xfe55('0x1'));var utils=require(_0xfe55('0x2'));var logger=require(_0xfe55('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfe55('0x4')),'mailMessage':require(_0xfe55('0x5')),'smsMessage':require(_0xfe55('0x6')),'faxMessage':require(_0xfe55('0x7')),'whatsappMessage':require(_0xfe55('0x8')),'chatInteraction':require(_0xfe55('0x9')),'openchannelInteraction':require(_0xfe55('0xa')),'mailInteraction':require(_0xfe55('0xb')),'smsInteraction':require(_0xfe55('0xc')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfe55('0xd'))};var mailRpc=require(_0xfe55('0xe'));exports['consequence']=function(_0x11e3ca,_0x25e089,_0x332330,_0x7fc8fa){return function(_0x2b0ecc){try{var _0x1bcc6d=this[_0xfe55('0xf')];if(_0x1bcc6d===_0xfe55('0x10')&&_0x7fc8fa[_0xfe55('0x11')][_0xfe55('0x12')]){logger[_0xfe55('0x13')](_0xfe55('0x14'),_0x11e3ca,_0xfe55('0x15'));return _0x2b0ecc[_0xfe55('0x16')]();}if(_0x25e089[0x0]==='1'&&(_[_0xfe55('0x17')](this[_0xfe55('0x18')][_0xfe55('0x19')])||!this[_0xfe55('0x18')][_0xfe55('0x19')])){logger[_0xfe55('0x13')](_0xfe55('0x14'),_0x11e3ca,_0xfe55('0x1a'));return _0x2b0ecc['next']();}if(_0x25e089[0x0]==='2'&&this[_0xfe55('0x18')][_0xfe55('0x1b')]){logger['info'](_0xfe55('0x1c'),_0x11e3ca,'One\x20Time\x20already\x20sent');return _0x2b0ecc['next']();}var _0x455446={'ContactId':this[_0xfe55('0x1d')]['id'],'sentAt':moment()[_0xfe55('0x1e')](_0xfe55('0x1f')),'direction':_0xfe55('0x20')};if(this['channel']===_0xfe55('0x10')){_0x455446[_0xfe55('0x11')]=utils[_0xfe55('0x21')](_0x25e089[0x2],this);}else{_0x455446[_0xfe55('0x11')]=utils[_0xfe55('0x21')](_0x25e089[0x1],this);}if(this[_0xfe55('0x22')]){_0x455446['to']=this['message'][_0xfe55('0x23')]||'';if(this['channel']===_0xfe55('0x10')&&_0x25e089[0x1]==='1'){_0x455446['cc']=this[_0xfe55('0x22')]['cc']||'';}_0x455446[_0xfe55('0x23')]=this['message']['to']||'';_0x455446[_0xfe55('0x24')]=this[_0xfe55('0x22')][_0xfe55('0x24')]||'';_0x455446[_0xfe55('0x25')]=!![];if(this[_0xfe55('0x22')][_0xfe55('0x26')]){_0x455446['subject']='';_0x455446[_0xfe55('0x26')]+=_[_0xfe55('0x27')](this['message'][_0xfe55('0x26')],_0xfe55('0x28'))?'':_0xfe55('0x29');_0x455446['subject']+=this[_0xfe55('0x22')]['subject'];}}if(this['channel']==='chat'){_0x455446['ChatWebsiteId']=this['account']['id'];}else{_0x455446[_[_0xfe55('0x2a')](this[_0xfe55('0xf')])+_0xfe55('0x2b')]=this['account']['id'];}_0x455446[_[_0xfe55('0x2a')](this[_0xfe55('0xf')])+_0xfe55('0x2c')]=this['interaction']['id'];var _0x43faf8=this[_0xfe55('0x18')];if(rpc[this[_0xfe55('0xf')]+'Message']){if(this['channel']===_0xfe55('0x10')){_0x455446[_0xfe55('0x2d')]=this[_0xfe55('0x22')]['messageId'];_0x455446[_0xfe55('0x2e')]=_0xfe55('0x2f')+_[_0xfe55('0x30')](_0x455446[_0xfe55('0x11')],_0xfe55('0x31'),_0xfe55('0x32'))+_0xfe55('0x33');_0x455446[_0xfe55('0x34')]={'Auto-Submitted':_0xfe55('0x35'),'X-Auto-Response-Suppress':'All','Precedence':_0xfe55('0x36')};return mailRpc[_0xfe55('0x37')](this[_0xfe55('0x38')][_0xfe55('0x39')],_0x455446)[_0xfe55('0x3a')](function(_0x2333ea){logger[_0xfe55('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x11e3ca);_0x455446['messageId']=_0x2333ea['message'][_0xfe55('0x3b')];return rpc[_0x1bcc6d+'Message'][_0xfe55('0x3c')](_0x455446);})[_0xfe55('0x3a')](function(_0x8b9f00){logger['info'](_0xfe55('0x14'),_0x11e3ca,JSON['stringify'](_0x8b9f00));})['catch'](function(_0x3818ba){logger[_0xfe55('0x3d')](_0xfe55('0x3e'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x3818ba));})[_0xfe55('0x40')](function(){Promise['resolve']()[_0xfe55('0x3a')](function(){if(_0x25e089[0x0]!=='2'||_0x43faf8[_0xfe55('0x1b')])return;return rpc[_0x1bcc6d+_0xfe55('0x41')]['update'](_0x43faf8['id'],{'autoreplyExecuted':!![]})[_0xfe55('0x3a')](function(_0x323071){logger[_0xfe55('0x13')](_0xfe55('0x1c'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x323071));})[_0xfe55('0x42')](function(_0x32affd){logger[_0xfe55('0x3d')](_0xfe55('0x43'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x32affd));});})[_0xfe55('0x3a')](function(){_0x2b0ecc[_0xfe55('0x16')]();});});}else{return rpc[this[_0xfe55('0xf')]+_0xfe55('0x44')][_0xfe55('0x3c')](_0x455446)[_0xfe55('0x3a')](function(){logger[_0xfe55('0x13')](_0xfe55('0x14'),_0x11e3ca,_0x455446[_0xfe55('0x11')]);})['catch'](function(_0x2fea7c){logger[_0xfe55('0x3d')](_0xfe55('0x14'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x2fea7c));})[_0xfe55('0x40')](function(){Promise[_0xfe55('0x45')]()[_0xfe55('0x3a')](function(){if(_0x25e089[0x0]!=='2'||_0x43faf8['autoreplyExecuted'])return;return rpc[_0x1bcc6d+_0xfe55('0x41')]['update'](_0x43faf8['id'],{'autoreplyExecuted':!![]})[_0xfe55('0x3a')](function(_0x45cbd8){logger[_0xfe55('0x13')](_0xfe55('0x1c'),_0x11e3ca,JSON['stringify'](_0x45cbd8));})[_0xfe55('0x42')](function(_0x534724){logger[_0xfe55('0x3d')](_0xfe55('0x43'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x534724));});})[_0xfe55('0x3a')](function(){_0x2b0ecc['next']();});});}}}catch(_0x16fdb5){logger['error'](_0xfe55('0x14'),_0x11e3ca,JSON[_0xfe55('0x3f')](_0x16fdb5));_0x2b0ecc['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index bed013c..d6fe19c 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe71a=['../../../../config/logger','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','format','system','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop'];(function(_0x213508,_0x5f3ff0){var _0x1b0363=function(_0x19bb1f){while(--_0x19bb1f){_0x213508['push'](_0x213508['shift']());}};_0x1b0363(++_0x5f3ff0);}(_0xe71a,0x11d));var _0xae71=function(_0x7a4a2,_0x59a3c4){_0x7a4a2=_0x7a4a2-0x0;var _0x32bb72=_0xe71a[_0x7a4a2];return _0x32bb72;};'use strict';var moment=require('moment');var logger=require(_0xae71('0x0'))('routing');var rpc={'chatInteraction':require(_0xae71('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xae71('0x2')),'faxInteraction':require(_0xae71('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x1e0f7e,_0x1521cf,_0x46a5cf,_0x171ca4){return function(_0x13908d){try{logger[_0xae71('0x4')]('[%s][CLOSE]\x20reason\x20%s',_0x1e0f7e,_0x1521cf[0x0]);var _0x306a6b={'closed':0x1,'closedAt':moment()[_0xae71('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xae71('0x6'),'disposition':_0x1521cf[0x0]};if(rpc[_0x171ca4['channel']+_0xae71('0x7')]){rpc[_0x171ca4['channel']+_0xae71('0x7')][_0xae71('0x8')](_0x171ca4[_0xae71('0x9')]['id'],_0x306a6b)['then'](function(_0x56b833){logger[_0xae71('0x4')](_0xae71('0xa'),_0x1e0f7e,_0x171ca4[_0xae71('0x9')]['id']);})['catch'](function(_0x4f5f66){logger[_0xae71('0xb')](_0xae71('0xc'),_0x1e0f7e,JSON['stringify'](_0x4f5f66));})[_0xae71('0xd')](function(){_0x13908d[_0xae71('0xe')]();});}}catch(_0x423957){logger['error']('[%s][CLOSE]\x20%s',_0x1e0f7e,JSON['stringify'](_0x423957));_0x13908d['stop']();}};}; \ No newline at end of file +var _0xed4b=['../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x47faa2,_0x4ea3bb){var _0x2ce608=function(_0x3626da){while(--_0x3626da){_0x47faa2['push'](_0x47faa2['shift']());}};_0x2ce608(++_0x4ea3bb);}(_0xed4b,0x1b4));var _0xbed4=function(_0x4a67e2,_0xada92e){_0x4a67e2=_0x4a67e2-0x0;var _0x552721=_0xed4b[_0x4a67e2];return _0x552721;};'use strict';var moment=require('moment');var logger=require(_0xbed4('0x0'))(_0xbed4('0x1'));var rpc={'chatInteraction':require(_0xbed4('0x2')),'openchannelInteraction':require(_0xbed4('0x3')),'smsInteraction':require(_0xbed4('0x4')),'mailInteraction':require(_0xbed4('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xbed4('0x6')]=function(_0x115c78,_0x51fbe0,_0x580341,_0x4e88ba){return function(_0x497c36){try{logger[_0xbed4('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x115c78,_0x51fbe0[0x0]);var _0x2644d1={'closed':0x1,'closedAt':moment()['format'](_0xbed4('0x8')),'closeReason':_0xbed4('0x9'),'disposition':_0x51fbe0[0x0]};if(rpc[_0x4e88ba[_0xbed4('0xa')]+_0xbed4('0xb')]){rpc[_0x4e88ba[_0xbed4('0xa')]+'Interaction'][_0xbed4('0xc')](_0x4e88ba['interaction']['id'],_0x2644d1)[_0xbed4('0xd')](function(_0x217748){logger[_0xbed4('0x7')](_0xbed4('0xe'),_0x115c78,_0x4e88ba[_0xbed4('0xf')]['id']);})[_0xbed4('0x10')](function(_0x1b4bd1){logger['error'](_0xbed4('0x11'),_0x115c78,JSON[_0xbed4('0x12')](_0x1b4bd1));})[_0xbed4('0x13')](function(){_0x497c36[_0xbed4('0x14')]();});}}catch(_0x2fa1bb){logger[_0xbed4('0x15')](_0xbed4('0x11'),_0x115c78,JSON[_0xbed4('0x12')](_0x2fa1bb));_0x497c36[_0xbed4('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 7539ad2..a1540ac 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc9b=['create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','providerName','providerResponse','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x47a291,_0x29c5bf){var _0xeff777=function(_0x58aa56){while(--_0x58aa56){_0x47a291['push'](_0x47a291['shift']());}};_0xeff777(++_0x29c5bf);}(_0xfc9b,0x74));var _0xbfc9=function(_0x5697ef,_0x46b17b){_0x5697ef=_0x5697ef-0x0;var _0x4670ca=_0xfc9b[_0x5697ef];return _0x4670ca;};'use strict';var _=require(_0xbfc9('0x0'));var moment=require(_0xbfc9('0x1'));var apiai=require(_0xbfc9('0x2'));var md5=require(_0xbfc9('0x3'));var utils=require(_0xbfc9('0x4'));var logger=require(_0xbfc9('0x5'))(_0xbfc9('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbfc9('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xbfc9('0x8')),'faxMessage':require(_0xbfc9('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbfc9('0xa')]=function(_0x266c05,_0xed6492){return function(_0xe288d1){try{if(!_['isNil'](this[_0xbfc9('0xb')]['UserId'])){logger[_0xbfc9('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x266c05,_0xbfc9('0xd'));return _0xe288d1['next']();}var _0x2c3bab={'ContactId':this[_0xbfc9('0xe')]['id'],'sentAt':moment()[_0xbfc9('0xf')](_0xbfc9('0x10')),'direction':_0xbfc9('0x11')};if(this[_0xbfc9('0x12')]==='sms'||this[_0xbfc9('0x12')]===_0xbfc9('0x13')){_0x2c3bab['phone']=this[_0xbfc9('0xb')]['phone'];}var _0x40500b=this[_0xbfc9('0x12')];if(_0x40500b===_0xbfc9('0x14')){_0x2c3bab[_0xbfc9('0x15')]=this['account']['id'];}else{_0x2c3bab[_[_0xbfc9('0x16')](_0x40500b)+_0xbfc9('0x17')]=this[_0xbfc9('0x18')]['id'];}_0x2c3bab[_[_0xbfc9('0x16')](_0x40500b)+_0xbfc9('0x19')]=this[_0xbfc9('0xb')]['id'];if(this[_0xbfc9('0xb')][_0xbfc9('0x1a')]){var _0x1cec94=_0xed6492[0x2];if(!_[_0xbfc9('0x1b')](_0x1cec94)){_0x2c3bab[_0xbfc9('0x1c')]=utils[_0xbfc9('0x1d')](_0x1cec94,this);return rpc[_0x40500b+_0xbfc9('0x1e')][_0xbfc9('0x1f')](_0x2c3bab)[_0xbfc9('0x20')](function(_0x345e7a){logger[_0xbfc9('0xc')](_0xbfc9('0x21'),_0x266c05,_0x2c3bab[_0xbfc9('0x1c')]);})[_0xbfc9('0x22')](function(_0x5a6078){logger[_0xbfc9('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x266c05,JSON[_0xbfc9('0x24')](_0x5a6078));})[_0xbfc9('0x25')](function(){logger[_0xbfc9('0xc')](_0xbfc9('0x26'),_0x266c05);_0xe288d1[_0xbfc9('0x27')]();});}else{logger[_0xbfc9('0xc')](_0xbfc9('0x28'),_0x266c05);_0xe288d1[_0xbfc9('0x27')]();}}else{var _0x2e6e5b=this;var _0x3f6c00=apiai(_0xed6492[0x0],{'language':_0xed6492[0x1]||'en'});return _0x3f6c00[_0xbfc9('0x29')](this[_0xbfc9('0x2a')][_0xbfc9('0x1c')],{'sessionId':md5(this[_0xbfc9('0xb')]['id'])})['then'](function(_0x1f365f){_0x2e6e5b[_0xbfc9('0x1c')][_0xbfc9('0x2b')]=_0x1f365f;_0x2c3bab[_0xbfc9('0x1c')]=_0x1f365f[_0xbfc9('0x2c')]['fulfillment'][_0xbfc9('0x2d')];_0x2c3bab[_0xbfc9('0x2e')]=_0xbfc9('0x2b');_0x2c3bab[_0xbfc9('0x2f')]=JSON[_0xbfc9('0x24')](_0x1f365f);return rpc[_0x40500b+_0xbfc9('0x1e')][_0xbfc9('0x1f')](_0x2c3bab)[_0xbfc9('0x20')](function(_0x127040){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x266c05,_0x2c3bab['body']);if(_0x1f365f[_0xbfc9('0x2c')]['metadata']['endConversation']){_0xe288d1[_0xbfc9('0x30')]();}else{_0xe288d1[_0xbfc9('0x27')]();}})[_0xbfc9('0x22')](function(_0x14e1ac){logger[_0xbfc9('0x23')](_0xbfc9('0x21'),_0x266c05,JSON[_0xbfc9('0x24')](_0x14e1ac));_0xe288d1[_0xbfc9('0x30')]();});})[_0xbfc9('0x22')](function(_0x56c98e){logger[_0xbfc9('0x23')](_0xbfc9('0x21'),_0x266c05,_0x56c98e[_0xbfc9('0x2a')]);_0xe288d1['next']();});}}catch(_0x5c306c){logger[_0xbfc9('0x23')](_0xbfc9('0x21'),_0x266c05,JSON[_0xbfc9('0x24')](_0x5c306c));_0xe288d1[_0xbfc9('0x27')]();}};}; \ No newline at end of file +var _0xe3da=['phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','Message','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp'];(function(_0xa12ed7,_0xca5f64){var _0x20cef0=function(_0x1c11dd){while(--_0x1c11dd){_0xa12ed7['push'](_0xa12ed7['shift']());}};_0x20cef0(++_0xca5f64);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var moment=require(_0xae3d('0x1'));var apiai=require(_0xae3d('0x2'));var md5=require(_0xae3d('0x3'));var utils=require(_0xae3d('0x4'));var logger=require(_0xae3d('0x5'))(_0xae3d('0x6'));var rpc={'chatMessage':require(_0xae3d('0x7')),'openchannelMessage':require(_0xae3d('0x8')),'mailMessage':require(_0xae3d('0x9')),'smsMessage':require(_0xae3d('0xa')),'faxMessage':require(_0xae3d('0xb')),'whatsappMessage':require(_0xae3d('0xc'))};exports[_0xae3d('0xd')]=function(_0x476579,_0x33c089){return function(_0x583b98){try{if(!_[_0xae3d('0xe')](this[_0xae3d('0xf')]['UserId'])){logger['info'](_0xae3d('0x10'),_0x476579,_0xae3d('0x11'));return _0x583b98[_0xae3d('0x12')]();}var _0x124833={'ContactId':this[_0xae3d('0x13')]['id'],'sentAt':moment()[_0xae3d('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xae3d('0x15')};if(this['channel']===_0xae3d('0x16')||this[_0xae3d('0x17')]===_0xae3d('0x18')){_0x124833[_0xae3d('0x19')]=this['interaction'][_0xae3d('0x19')];}var _0x27561c=this[_0xae3d('0x17')];if(_0x27561c===_0xae3d('0x1a')){_0x124833[_0xae3d('0x1b')]=this[_0xae3d('0x1c')]['id'];}else{_0x124833[_[_0xae3d('0x1d')](_0x27561c)+'AccountId']=this[_0xae3d('0x1c')]['id'];}_0x124833[_[_0xae3d('0x1d')](_0x27561c)+_0xae3d('0x1e')]=this[_0xae3d('0xf')]['id'];if(this[_0xae3d('0xf')][_0xae3d('0x1f')]){var _0x585160=_0x33c089[0x2];if(!_[_0xae3d('0x20')](_0x585160)){_0x124833[_0xae3d('0x21')]=utils[_0xae3d('0x22')](_0x585160,this);return rpc[_0x27561c+'Message'][_0xae3d('0x23')](_0x124833)[_0xae3d('0x24')](function(_0x558e42){logger['info'](_0xae3d('0x10'),_0x476579,_0x124833[_0xae3d('0x21')]);})[_0xae3d('0x25')](function(_0x377546){logger[_0xae3d('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x476579,JSON[_0xae3d('0x27')](_0x377546));})['finally'](function(){logger[_0xae3d('0x28')](_0xae3d('0x29'),_0x476579);_0x583b98[_0xae3d('0x2a')]();});}else{logger[_0xae3d('0x28')](_0xae3d('0x2b'),_0x476579);_0x583b98[_0xae3d('0x2a')]();}}else{var _0x26c419=this;var _0x155099=apiai(_0x33c089[0x0],{'language':_0x33c089[0x1]||'en'});return _0x155099[_0xae3d('0x2c')](this[_0xae3d('0x2d')][_0xae3d('0x21')],{'sessionId':md5(this[_0xae3d('0xf')]['id'])})[_0xae3d('0x24')](function(_0x1b2acb){_0x26c419[_0xae3d('0x21')][_0xae3d('0x2e')]=_0x1b2acb;_0x124833[_0xae3d('0x21')]=_0x1b2acb[_0xae3d('0x2f')][_0xae3d('0x30')][_0xae3d('0x31')];_0x124833['providerName']=_0xae3d('0x2e');_0x124833[_0xae3d('0x32')]=JSON[_0xae3d('0x27')](_0x1b2acb);return rpc[_0x27561c+_0xae3d('0x33')][_0xae3d('0x23')](_0x124833)[_0xae3d('0x24')](function(_0x8de288){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x476579,_0x124833[_0xae3d('0x21')]);if(_0x1b2acb[_0xae3d('0x2f')][_0xae3d('0x34')][_0xae3d('0x35')]){_0x583b98[_0xae3d('0x12')]();}else{_0x583b98['stop']();}})[_0xae3d('0x25')](function(_0x3a2434){logger['error'](_0xae3d('0x10'),_0x476579,JSON[_0xae3d('0x27')](_0x3a2434));_0x583b98[_0xae3d('0x12')]();});})[_0xae3d('0x25')](function(_0x432c04){logger[_0xae3d('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x476579,_0x432c04['message']);_0x583b98['next']();});}}catch(_0x5cfdae){logger[_0xae3d('0x26')](_0xae3d('0x10'),_0x476579,JSON[_0xae3d('0x27')](_0x5cfdae));_0x583b98['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 3d5c5ab..eaf26e9 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57a9=['out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','stop','catch','stack','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x28378a,_0x32a231){var _0x35fa9b=function(_0x4b4e71){while(--_0x4b4e71){_0x28378a['push'](_0x28378a['shift']());}};_0x35fa9b(++_0x32a231);}(_0x57a9,0x1ed));var _0x957a=function(_0x473138,_0x374826){_0x473138=_0x473138-0x0;var _0x44a6bc=_0x57a9[_0x473138];return _0x44a6bc;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x957a('0x0'));var moment=require(_0x957a('0x1'));var Promise=require(_0x957a('0x2'));var logger=require(_0x957a('0x3'))(_0x957a('0x4'));var utils=require(_0x957a('0x5'));var rpc={'chatMessage':require(_0x957a('0x6')),'openchannelMessage':require(_0x957a('0x7')),'mailMessage':require(_0x957a('0x8')),'smsMessage':require(_0x957a('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5d93ee,_0x57bd0f,_0x399215,_0x2c2d36){return new Promise(function(_0x25f143,_0x167b42){var _0x3b31dc=_[_0x957a('0xa')](_0x399215);_0x3b31dc[_0x957a('0xb')]=_0x2c2d36;return rpc[_0x57bd0f+_0x957a('0xc')][_0x957a('0xd')](_0x3b31dc)[_0x957a('0xe')](function(){logger[_0x957a('0xf')](_0x957a('0x10'),_0x5d93ee,_0x3b31dc['body']);_0x25f143();})['catch'](function(_0x1f2483){logger[_0x957a('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x5d93ee,JSON[_0x957a('0x12')](_0x1f2483));_0x167b42(_0x1f2483);});});}exports[_0x957a('0x13')]=function(_0x1b2e8d,_0x4dbff3){return function(_0x58fb9c){try{if(!_[_0x957a('0x14')](this['interaction'][_0x957a('0x15')])){logger[_0x957a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b2e8d,_0x957a('0x16'));return _0x58fb9c[_0x957a('0x17')]();}var _0x2b1781={'ContactId':this[_0x957a('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x957a('0x19')};if(this['channel']===_0x957a('0x1a')||this[_0x957a('0x1b')]===_0x957a('0x1c')){_0x2b1781['phone']=this['interaction'][_0x957a('0x1d')];}var _0x69a5b7=this[_0x957a('0x1b')];if(_0x69a5b7===_0x957a('0x1e')){_0x2b1781[_0x957a('0x1f')]=this[_0x957a('0x20')]['id'];}else{_0x2b1781[_[_0x957a('0x21')](_0x69a5b7)+_0x957a('0x22')]=this[_0x957a('0x20')]['id'];}_0x2b1781[_[_0x957a('0x21')](_0x69a5b7)+_0x957a('0x23')]=this[_0x957a('0x24')]['id'];if(this[_0x957a('0x24')][_0x957a('0x25')]){var _0x3aedff=_0x4dbff3[0x4];if(!_[_0x957a('0x26')](_0x3aedff)){_0x2b1781['body']=utils[_0x957a('0x27')](_0x3aedff,this);return rpc[_0x69a5b7+_0x957a('0xc')][_0x957a('0xd')](_0x2b1781)[_0x957a('0xe')](function(_0x31a1ee){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1b2e8d,_0x2b1781[_0x957a('0xb')]);})['catch'](function(_0x4dad5e){logger[_0x957a('0x11')](_0x957a('0x10'),_0x1b2e8d,JSON[_0x957a('0x12')](_0x4dad5e));})['finally'](function(){logger[_0x957a('0xf')](_0x957a('0x28'),_0x1b2e8d);_0x58fb9c['stop']();});}else{logger['info'](_0x957a('0x29'),_0x1b2e8d);_0x58fb9c['stop']();}}else{var _0x13882f=this;var _0x3fa507=_0x4dbff3[0x2][_0x957a('0x2a')](/\\n/g,'\x0a');var _0x5ced={'credentials':{'private_key':_0x3fa507,'client_email':_0x4dbff3[0x1]}};var _0x2a961b=new dialogflow['SessionsClient'](_0x5ced);var _0x4c509a=_0x2a961b[_0x957a('0x2b')](_0x4dbff3[0x0],md5(_0x13882f[_0x957a('0x24')]['id']));var _0x39b66e={'session':_0x4c509a,'queryInput':{'text':{'text':_0x13882f[_0x957a('0x2c')][_0x957a('0xb')],'languageCode':_0x4dbff3[0x3]||'en'}}};return _0x2a961b[_0x957a('0x2d')](_0x39b66e)[_0x957a('0xe')](function(_0x198f0c){if(_0x198f0c&&_0x198f0c[_0x957a('0x2e')]){_0x13882f[_0x957a('0xb')][_0x957a('0x2f')]=_0x198f0c;var _0x398318=_0x198f0c[0x0];var _0x1dcb49=_0x398318[_0x957a('0x30')][_0x957a('0x31')]&&_0x398318[_0x957a('0x30')][_0x957a('0x31')]['fields']?_0x398318[_0x957a('0x30')][_0x957a('0x31')][_0x957a('0x32')][_0x957a('0x33')]['boolValue']:![];_0x13882f[_0x957a('0xb')][_0x957a('0x34')]=_0x398318[_0x957a('0x30')][_0x957a('0x35')];_0x13882f['body'][_0x957a('0x36')]=_0x398318[_0x957a('0x30')][_0x957a('0x37')];_0x13882f['body'][_0x957a('0x38')]=_0x398318[_0x957a('0x30')][_0x957a('0x31')]&&_0x398318[_0x957a('0x30')][_0x957a('0x31')][_0x957a('0x32')]?_0x398318[_0x957a('0x30')][_0x957a('0x31')][_0x957a('0x32')][_0x957a('0x33')]['boolValue']:![];_0x13882f[_0x957a('0xb')][_0x957a('0x39')]=_0x398318[_0x957a('0x30')][_0x957a('0x3a')][_0x957a('0x3b')];_0x13882f[_0x957a('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x398318[_0x957a('0x30')][_0x957a('0x3a')][_0x957a('0x3c')];_0x13882f['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x398318[_0x957a('0x30')][_0x957a('0x3a')]['isFallback'];_0x13882f[_0x957a('0xb')][_0x957a('0x3d')]=_0x398318[_0x957a('0x30')][_0x957a('0x3e')];_0x13882f['body'][_0x957a('0x3f')]=_0x398318[_0x957a('0x30')][_0x957a('0x40')];_0x13882f[_0x957a('0xb')][_0x957a('0x41')]=_0x398318['queryResult']['intentDetectionConfidence'];_0x2b1781[_0x957a('0x42')]=_0x957a('0x2f');_0x2b1781[_0x957a('0x43')]=JSON[_0x957a('0x12')](_0x198f0c);var _0x16a99b=[];for(var _0x38ded0=0x0;_0x38ded0<_0x198f0c['length'];_0x38ded0++){var _0x1f492b=_0x198f0c[_0x38ded0];if(_0x1f492b&&_0x1f492b[_0x957a('0x30')]&&_0x1f492b['queryResult'][_0x957a('0x44')]){_0x16a99b[_0x957a('0x45')](createMessage(_0x1b2e8d,_0x69a5b7,_0x2b1781,_0x1f492b['queryResult']['fulfillmentText']));}}return Promise[_0x957a('0x46')](_0x16a99b)[_0x957a('0xe')](function(){if(_0x1dcb49){_0x58fb9c[_0x957a('0x17')]();}else{_0x58fb9c[_0x957a('0x47')]();}})[_0x957a('0x48')](function(_0x4017ac){logger[_0x957a('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b2e8d,JSON[_0x957a('0x12')](_0x4017ac));_0x58fb9c[_0x957a('0x17')]();});}})['catch'](function(_0x5c855f){logger[_0x957a('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b2e8d,_0x5c855f['message'],_0x5c855f[_0x957a('0x49')]);_0x58fb9c[_0x957a('0x17')]();});}}catch(_0x651bbe){logger[_0x957a('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b2e8d,JSON[_0x957a('0x12')](_0x651bbe));_0x58fb9c['stop']();}};}; \ No newline at end of file +var _0xed7d=['chat','account','upperFirst','AccountId','created','getMustacheRender','Message','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','stack','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','consequence','isNil','interaction','UserId','next','format','channel','phone'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xed7d,0x134));var _0xded7=function(_0xab58e1,_0x5d47ce){_0xab58e1=_0xab58e1-0x0;var _0x295351=_0xed7d[_0xab58e1];return _0x295351;};'use strict';var _=require(_0xded7('0x0'));var dialogflow=require(_0xded7('0x1'));var md5=require(_0xded7('0x2'));var moment=require(_0xded7('0x3'));var Promise=require('bluebird');var logger=require(_0xded7('0x4'))(_0xded7('0x5'));var utils=require(_0xded7('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xded7('0x7')),'mailMessage':require(_0xded7('0x8')),'smsMessage':require(_0xded7('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xded7('0xa'))};function createMessage(_0x1ed3d2,_0x159f7d,_0x44c9f8,_0x1da75c){return new Promise(function(_0x968162,_0x51e137){var _0x3e2076=_[_0xded7('0xb')](_0x44c9f8);_0x3e2076['body']=_0x1da75c;return rpc[_0x159f7d+'Message'][_0xded7('0xc')](_0x3e2076)[_0xded7('0xd')](function(){logger[_0xded7('0xe')](_0xded7('0xf'),_0x1ed3d2,_0x3e2076[_0xded7('0x10')]);_0x968162();})[_0xded7('0x11')](function(_0x6704ce){logger[_0xded7('0x12')](_0xded7('0xf'),_0x1ed3d2,JSON['stringify'](_0x6704ce));_0x51e137(_0x6704ce);});});}exports[_0xded7('0x13')]=function(_0x21aa87,_0x9137da){return function(_0xa56eaf){try{if(!_[_0xded7('0x14')](this[_0xded7('0x15')][_0xded7('0x16')])){logger[_0xded7('0xe')](_0xded7('0xf'),_0x21aa87,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xa56eaf[_0xded7('0x17')]();}var _0x68eac6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xded7('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xded7('0x19')]==='sms'||this['channel']==='whatsapp'){_0x68eac6[_0xded7('0x1a')]=this['interaction'][_0xded7('0x1a')];}var _0x4de13c=this[_0xded7('0x19')];if(_0x4de13c===_0xded7('0x1b')){_0x68eac6['ChatWebsiteId']=this[_0xded7('0x1c')]['id'];}else{_0x68eac6[_[_0xded7('0x1d')](_0x4de13c)+_0xded7('0x1e')]=this[_0xded7('0x1c')]['id'];}_0x68eac6[_['upperFirst'](_0x4de13c)+'InteractionId']=this[_0xded7('0x15')]['id'];if(this[_0xded7('0x15')][_0xded7('0x1f')]){var _0x85225b=_0x9137da[0x4];if(!_['isEmpty'](_0x85225b)){_0x68eac6[_0xded7('0x10')]=utils[_0xded7('0x20')](_0x85225b,this);return rpc[_0x4de13c+_0xded7('0x21')][_0xded7('0xc')](_0x68eac6)[_0xded7('0xd')](function(_0x250bf3){logger[_0xded7('0xe')](_0xded7('0xf'),_0x21aa87,_0x68eac6[_0xded7('0x10')]);})[_0xded7('0x11')](function(_0x4c56b2){logger['error'](_0xded7('0xf'),_0x21aa87,JSON[_0xded7('0x22')](_0x4c56b2));})[_0xded7('0x23')](function(){logger[_0xded7('0xe')](_0xded7('0x24'),_0x21aa87);_0xa56eaf[_0xded7('0x25')]();});}else{logger[_0xded7('0xe')](_0xded7('0x26'),_0x21aa87);_0xa56eaf[_0xded7('0x25')]();}}else{var _0x38f890=this;var _0x5ef71d=_0x9137da[0x2][_0xded7('0x27')](/\\n/g,'\x0a');var _0x2dbae8={'credentials':{'private_key':_0x5ef71d,'client_email':_0x9137da[0x1]}};var _0x5e4f89=new dialogflow[(_0xded7('0x28'))](_0x2dbae8);var _0x31f583=_0x5e4f89[_0xded7('0x29')](_0x9137da[0x0],md5(_0x38f890['interaction']['id']));var _0x45cd74={'session':_0x31f583,'queryInput':{'text':{'text':_0x38f890['message']['body'],'languageCode':_0x9137da[0x3]||'en'}}};return _0x5e4f89['detectIntent'](_0x45cd74)[_0xded7('0xd')](function(_0x58b28c){if(_0x58b28c&&_0x58b28c[_0xded7('0x2a')]){_0x38f890['body'][_0xded7('0x2b')]=_0x58b28c;var _0x453dc2=_0x58b28c[0x0];var _0x8e1660=_0x453dc2['queryResult'][_0xded7('0x2c')]&&_0x453dc2[_0xded7('0x2d')][_0xded7('0x2c')][_0xded7('0x2e')]?_0x453dc2['queryResult'][_0xded7('0x2c')]['fields'][_0xded7('0x2f')][_0xded7('0x30')]:![];_0x38f890[_0xded7('0x10')]['DIALOGFLOWV2_ACTION']=_0x453dc2['queryResult'][_0xded7('0x31')];_0x38f890['body'][_0xded7('0x32')]=_0x453dc2[_0xded7('0x2d')][_0xded7('0x33')];_0x38f890[_0xded7('0x10')][_0xded7('0x34')]=_0x453dc2[_0xded7('0x2d')][_0xded7('0x2c')]&&_0x453dc2[_0xded7('0x2d')][_0xded7('0x2c')]['fields']?_0x453dc2[_0xded7('0x2d')][_0xded7('0x2c')]['fields']['end_conversation'][_0xded7('0x30')]:![];_0x38f890[_0xded7('0x10')][_0xded7('0x35')]=_0x453dc2[_0xded7('0x2d')][_0xded7('0x36')][_0xded7('0x37')];_0x38f890[_0xded7('0x10')][_0xded7('0x38')]=_0x453dc2['queryResult'][_0xded7('0x36')]['displayName'];_0x38f890[_0xded7('0x10')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x453dc2[_0xded7('0x2d')]['intent'][_0xded7('0x39')];_0x38f890['body'][_0xded7('0x3a')]=_0x453dc2[_0xded7('0x2d')][_0xded7('0x3b')];_0x38f890[_0xded7('0x10')][_0xded7('0x3c')]=_0x453dc2[_0xded7('0x2d')][_0xded7('0x3d')];_0x38f890[_0xded7('0x10')][_0xded7('0x3e')]=_0x453dc2['queryResult']['intentDetectionConfidence'];_0x68eac6[_0xded7('0x3f')]=_0xded7('0x2b');_0x68eac6[_0xded7('0x40')]=JSON[_0xded7('0x22')](_0x58b28c);var _0x59feb8=[];for(var _0x2fd0f6=0x0;_0x2fd0f6<_0x58b28c[_0xded7('0x2a')];_0x2fd0f6++){var _0x4e4b6d=_0x58b28c[_0x2fd0f6];if(_0x4e4b6d&&_0x4e4b6d[_0xded7('0x2d')]&&_0x4e4b6d['queryResult'][_0xded7('0x41')]){_0x59feb8['push'](createMessage(_0x21aa87,_0x4de13c,_0x68eac6,_0x4e4b6d[_0xded7('0x2d')]['fulfillmentText']));}}return Promise['all'](_0x59feb8)[_0xded7('0xd')](function(){if(_0x8e1660){_0xa56eaf[_0xded7('0x17')]();}else{_0xa56eaf['stop']();}})[_0xded7('0x11')](function(_0x34cff9){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x21aa87,JSON[_0xded7('0x22')](_0x34cff9));_0xa56eaf[_0xded7('0x17')]();});}})[_0xded7('0x11')](function(_0x1523a3){logger[_0xded7('0x12')](_0xded7('0xf'),_0x21aa87,_0x1523a3['message'],_0x1523a3[_0xded7('0x42')]);_0xa56eaf[_0xded7('0x17')]();});}}catch(_0x4c1885){logger[_0xded7('0x12')](_0xded7('0xf'),_0x21aa87,JSON[_0xded7('0x22')](_0x4c1885));_0xa56eaf[_0xded7('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index ac8e924..dfb60e4 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbe4=['message','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s'];(function(_0x51528f,_0xf08ab9){var _0x118717=function(_0x5e0731){while(--_0x5e0731){_0x51528f['push'](_0x51528f['shift']());}};_0x118717(++_0xf08ab9);}(_0xcbe4,0x112));var _0x4cbe=function(_0x505367,_0x21dcde){_0x505367=_0x505367-0x0;var _0x2be99f=_0xcbe4[_0x505367];return _0x2be99f;};'use strict';var schema=require(_0x4cbe('0x0'));var _=require(_0x4cbe('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x4cbe('0x2'));var logger=require(_0x4cbe('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x4cbe('0x4')},'priorityTrue':{'type':_0x4cbe('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x4cbe('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x4cbe('0x6')]=function(_0x3e89c7,_0x306d66){return function(_0x4d5b48){try{var _0x499f23={'condition':htmlToText[_0x4cbe('0x7')](utils[_0x4cbe('0x8')](_0x306d66[0x0],this),{'wordwrap':![]})[_0x4cbe('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x306d66[0x1],'priorityFalse':_0x306d66[0x2]};var _0x2cceba=gotoif[_0x4cbe('0x0')](_0x499f23,{'typecast':!![]});if(_0x2cceba[_0x4cbe('0xa')]){logger['error'](_0x4cbe('0xb'),_0x3e89c7,_['map'](_0x2cceba,_0x4cbe('0xc'))[_0x4cbe('0xd')](',\x20'));_0x4d5b48[_0x4cbe('0xe')]();}else{try{var _0x152989=eval('('+_0x499f23[_0x4cbe('0xf')]+')');var _0x2b81b9=_0x152989?_0x499f23[_0x4cbe('0x10')]:_0x499f23[_0x4cbe('0x11')];logger[_0x4cbe('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3e89c7,_0x499f23[_0x4cbe('0xf')],_0x152989,_0x2b81b9||_0x4cbe('0x13'));if(_0x2b81b9){var _0xc180=_[_0x4cbe('0x14')](_0x4d5b48['rules'](),{'p':_0x2b81b9});if(_0xc180>=0x0){logger['info'](_0x4cbe('0x15'),_0x3e89c7,_0x2b81b9||'next',_0xc180);_0x4d5b48[_0x4cbe('0x13')](_0xc180);}else{logger[_0x4cbe('0x12')](_0x4cbe('0x16'),_0x3e89c7,_0x2b81b9||_0x4cbe('0x13'));_0x4d5b48['stop']();}}else{_0x4d5b48['next']();}}catch(_0x48e776){logger[_0x4cbe('0x17')](_0x4cbe('0x18'),_0x3e89c7,_0x48e776[_0x4cbe('0xc')]);_0x4d5b48[_0x4cbe('0xe')]();}}}catch(_0x39db5e){logger['error'](_0x4cbe('0xb'),_0x3e89c7,JSON[_0x4cbe('0x19')](_0x39db5e));_0x4d5b48[_0x4cbe('0xe')]();}};}; \ No newline at end of file +var _0xf09d=['stringify','validate','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf09d,0x17b));var _0xdf09=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0xf09d[_0x1b1a3b];return _0x385347;};'use strict';var schema=require(_0xdf09('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xdf09('0x1'));var logger=require('../../../../config/logger')(_0xdf09('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xdf09('0x3')},'priorityTrue':{'type':_0xdf09('0x4'),'message':_0xdf09('0x5')},'priorityFalse':{'type':'number','message':_0xdf09('0x6')}});exports[_0xdf09('0x7')]=function(_0x40c240,_0x2b5a14){return function(_0x2835f9){try{var _0x260208={'condition':htmlToText[_0xdf09('0x8')](utils[_0xdf09('0x9')](_0x2b5a14[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2b5a14[0x1],'priorityFalse':_0x2b5a14[0x2]};var _0x39f635=gotoif[_0xdf09('0x0')](_0x260208,{'typecast':!![]});if(_0x39f635['length']){logger[_0xdf09('0xa')](_0xdf09('0xb'),_0x40c240,_[_0xdf09('0xc')](_0x39f635,'message')['join'](',\x20'));_0x2835f9[_0xdf09('0xd')]();}else{try{var _0x1b0fb4=eval('('+_0x260208[_0xdf09('0xe')]+')');var _0x439d34=_0x1b0fb4?_0x260208[_0xdf09('0xf')]:_0x260208[_0xdf09('0x10')];logger[_0xdf09('0x11')](_0xdf09('0x12'),_0x40c240,_0x260208['condition'],_0x1b0fb4,_0x439d34||_0xdf09('0x13'));if(_0x439d34){var _0x409e0c=_[_0xdf09('0x14')](_0x2835f9[_0xdf09('0x15')](),{'p':_0x439d34});if(_0x409e0c>=0x0){logger['info'](_0xdf09('0x16'),_0x40c240,_0x439d34||'next',_0x409e0c);_0x2835f9['next'](_0x409e0c);}else{logger['info'](_0xdf09('0x17'),_0x40c240,_0x439d34||_0xdf09('0x13'));_0x2835f9['stop']();}}else{_0x2835f9[_0xdf09('0x13')]();}}catch(_0x531744){logger[_0xdf09('0xa')](_0xdf09('0x18'),_0x40c240,_0x531744[_0xdf09('0x19')]);_0x2835f9['stop']();}}}catch(_0x96097a){logger[_0xdf09('0xa')](_0xdf09('0xb'),_0x40c240,JSON[_0xdf09('0x1a')](_0x96097a));_0x2835f9[_0xdf09('0xd')]();}};}; \ 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 4bb5722..9fc4aad 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 _0x96b8=['../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash'];(function(_0x4d6871,_0x1c06a0){var _0x236f8d=function(_0x4e818c){while(--_0x4e818c){_0x4d6871['push'](_0x4d6871['shift']());}};_0x236f8d(++_0x1c06a0);}(_0x96b8,0x71));var _0x896b=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x96b8[_0x2fbcf6];return _0x3e7265;};'use strict';var schema=require('validate');var _=require(_0x896b('0x0'));var logger=require(_0x896b('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x896b('0x2')}});exports[_0x896b('0x3')]=function(_0x765e5e,_0x1d1fb1){return function(_0xe61d8c){try{var _0x4e0b63={'priority':_0x1d1fb1[0x0]};var _0x14fa89=gotop[_0x896b('0x4')](_0x4e0b63,{'typecast':!![]});if(_0x14fa89['length']){logger[_0x896b('0x5')](_0x896b('0x6'),_0x765e5e,_[_0x896b('0x7')](_0x14fa89,_0x896b('0x8'))[_0x896b('0x9')](',\x20'));_0xe61d8c[_0x896b('0xa')]();}else{logger['info'](_0x896b('0xb'),_0x765e5e,_0x4e0b63[_0x896b('0xc')]);if(_0x4e0b63[_0x896b('0xc')]){var _0x144a55=_[_0x896b('0xd')](_0xe61d8c[_0x896b('0xe')](),{'p':_0x4e0b63[_0x896b('0xc')]});if(_0x144a55>=0x0){logger[_0x896b('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x765e5e,_0x4e0b63['priority']||_0x896b('0x10'),_0x144a55);_0xe61d8c[_0x896b('0x10')](_0x144a55);}else{logger[_0x896b('0xf')](_0x896b('0x11'),_0x765e5e,_0x4e0b63['priority']||_0x896b('0x10'));_0xe61d8c[_0x896b('0xa')]();}}else{_0xe61d8c['next']();}}}catch(_0x368401){logger[_0x896b('0x5')]('[%s][GOTOP]\x20%s',_0x765e5e,JSON[_0x896b('0x12')](_0x368401));_0xe61d8c['stop']();}};}; \ No newline at end of file +var _0x677c=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing'];(function(_0x32bf8b,_0x2ac32b){var _0x1e5ef5=function(_0x36acec){while(--_0x36acec){_0x32bf8b['push'](_0x32bf8b['shift']());}};_0x1e5ef5(++_0x2ac32b);}(_0x677c,0x1b6));var _0xc677=function(_0x43813a,_0xd7fb83){_0x43813a=_0x43813a-0x0;var _0x1d9cfc=_0x677c[_0x43813a];return _0x1d9cfc;};'use strict';var schema=require('validate');var _=require(_0xc677('0x0'));var logger=require(_0xc677('0x1'))(_0xc677('0x2'));var gotop=schema({'priority':{'type':_0xc677('0x3'),'required':!![],'message':_0xc677('0x4')}});exports[_0xc677('0x5')]=function(_0x279d42,_0x108d8e){return function(_0x5c7693){try{var _0x25a31f={'priority':_0x108d8e[0x0]};var _0x483b01=gotop[_0xc677('0x6')](_0x25a31f,{'typecast':!![]});if(_0x483b01[_0xc677('0x7')]){logger[_0xc677('0x8')](_0xc677('0x9'),_0x279d42,_[_0xc677('0xa')](_0x483b01,_0xc677('0xb'))['join'](',\x20'));_0x5c7693[_0xc677('0xc')]();}else{logger[_0xc677('0xd')](_0xc677('0xe'),_0x279d42,_0x25a31f[_0xc677('0xf')]);if(_0x25a31f['priority']){var _0x98df7a=_[_0xc677('0x10')](_0x5c7693['rules'](),{'p':_0x25a31f[_0xc677('0xf')]});if(_0x98df7a>=0x0){logger['info'](_0xc677('0x11'),_0x279d42,_0x25a31f[_0xc677('0xf')]||_0xc677('0x12'),_0x98df7a);_0x5c7693['next'](_0x98df7a);}else{logger['info'](_0xc677('0x13'),_0x279d42,_0x25a31f[_0xc677('0xf')]||'next');_0x5c7693[_0xc677('0xc')]();}}else{_0x5c7693[_0xc677('0x12')]();}}}catch(_0x5e1727){logger['error']('[%s][GOTOP]\x20%s',_0x279d42,JSON[_0xc677('0x14')](_0x5e1727));_0x5c7693[_0xc677('0xc')]();}};}; \ 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 6c6021d..26e9292 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 _0xc064=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','routing'];(function(_0x4f4c83,_0x1d234e){var _0x2eddae=function(_0x33da9c){while(--_0x33da9c){_0x4f4c83['push'](_0x4f4c83['shift']());}};_0x2eddae(++_0x1d234e);}(_0xc064,0x174));var _0x4c06=function(_0x2fdf9a,_0x145bdd){_0x2fdf9a=_0x2fdf9a-0x0;var _0x57b8be=_0xc064[_0x2fdf9a];return _0x57b8be;};'use strict';var _=require(_0x4c06('0x0'));var utils=require(_0x4c06('0x1'));var logger=require('../../../../config/logger')(_0x4c06('0x2'));var rpc={'chatMessage':require(_0x4c06('0x3')),'openchannelMessage':require(_0x4c06('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4c06('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4c06('0x6'))};exports['consequence']=function(_0x13ac79,_0x2aec4f){return function(_0x4c7d3e){try{var _0x250c96={'body':utils[_0x4c06('0x7')](_0x2aec4f[0x0],this),'ContactId':this[_0x4c06('0x8')]['id']};if(this[_0x4c06('0x9')]==='chat'){_0x250c96['ChatWebsiteId']=this[_0x4c06('0xa')]['id'];}else{_0x250c96[_[_0x4c06('0xb')](this['channel'])+_0x4c06('0xc')]=this[_0x4c06('0xa')]['id'];}_0x250c96[_[_0x4c06('0xb')](this[_0x4c06('0x9')])+_0x4c06('0xd')]=this[_0x4c06('0xe')]['id'];if(rpc[this[_0x4c06('0x9')]+'Message']){return rpc[this[_0x4c06('0x9')]+_0x4c06('0xf')][_0x4c06('0x10')](_0x250c96)[_0x4c06('0x11')](function(_0x55888d){logger[_0x4c06('0x12')](_0x4c06('0x13'),_0x13ac79,_0x250c96['body']);_0x4c7d3e[_0x4c06('0x14')]();})[_0x4c06('0x15')](function(_0x19915e){logger[_0x4c06('0x16')](_0x4c06('0x13'),_0x13ac79,JSON[_0x4c06('0x17')](_0x19915e));_0x4c7d3e['stop']();});}}catch(_0x2ffa54){logger['error'](_0x4c06('0x13'),_0x13ac79,JSON[_0x4c06('0x17')](_0x2ffa54));_0x4c7d3e[_0x4c06('0x18')]();}};}; \ No newline at end of file +var _0x8a0f=['[%s][MESSAGE]\x20%s','body','catch','stop','error','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info'];(function(_0x1ca901,_0x2a7698){var _0x19176b=function(_0x5a017f){while(--_0x5a017f){_0x1ca901['push'](_0x1ca901['shift']());}};_0x19176b(++_0x2a7698);}(_0x8a0f,0x1e6));var _0xf8a0=function(_0x3e7ec1,_0x2aaa97){_0x3e7ec1=_0x3e7ec1-0x0;var _0x2c60c6=_0x8a0f[_0x3e7ec1];return _0x2c60c6;};'use strict';var _=require(_0xf8a0('0x0'));var utils=require(_0xf8a0('0x1'));var logger=require('../../../../config/logger')(_0xf8a0('0x2'));var rpc={'chatMessage':require(_0xf8a0('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf8a0('0x4')),'smsMessage':require(_0xf8a0('0x5')),'faxMessage':require(_0xf8a0('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1f10ff,_0x45d9cd){return function(_0x34d2cd){try{var _0x1a5182={'body':utils['getMustacheRender'](_0x45d9cd[0x0],this),'ContactId':this['contact']['id']};if(this[_0xf8a0('0x7')]===_0xf8a0('0x8')){_0x1a5182[_0xf8a0('0x9')]=this[_0xf8a0('0xa')]['id'];}else{_0x1a5182[_[_0xf8a0('0xb')](this[_0xf8a0('0x7')])+_0xf8a0('0xc')]=this[_0xf8a0('0xa')]['id'];}_0x1a5182[_[_0xf8a0('0xb')](this[_0xf8a0('0x7')])+_0xf8a0('0xd')]=this[_0xf8a0('0xe')]['id'];if(rpc[this[_0xf8a0('0x7')]+_0xf8a0('0xf')]){return rpc[this[_0xf8a0('0x7')]+'Message']['create'](_0x1a5182)[_0xf8a0('0x10')](function(_0x325b2a){logger[_0xf8a0('0x11')](_0xf8a0('0x12'),_0x1f10ff,_0x1a5182[_0xf8a0('0x13')]);_0x34d2cd['next']();})[_0xf8a0('0x14')](function(_0x34b771){logger['error'](_0xf8a0('0x12'),_0x1f10ff,JSON['stringify'](_0x34b771));_0x34d2cd[_0xf8a0('0x15')]();});}}catch(_0x986220){logger[_0xf8a0('0x16')](_0xf8a0('0x12'),_0x1f10ff,JSON[_0xf8a0('0x17')](_0x986220));_0x34d2cd[_0xf8a0('0x15')]();}};}; \ 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 984c070..7c04ddb 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 _0x7bd6=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x438d13,_0xca33d4){var _0x80bec6=function(_0x155d7c){while(--_0x155d7c){_0x438d13['push'](_0x438d13['shift']());}};_0x80bec6(++_0xca33d4);}(_0x7bd6,0xab));var _0x67bd=function(_0x1ed1d8,_0x384889){_0x1ed1d8=_0x1ed1d8-0x0;var _0x4f145d=_0x7bd6[_0x1ed1d8];return _0x4f145d;};'use strict';var utils=require(_0x67bd('0x0'));var logger=require(_0x67bd('0x1'))(_0x67bd('0x2'));exports[_0x67bd('0x3')]=function(_0x4165c4,_0x432fdc){return function(_0x122f28){try{logger[_0x67bd('0x4')](_0x67bd('0x5'),_0x4165c4,utils[_0x67bd('0x6')](_0x432fdc[0x0],this));_0x122f28[_0x67bd('0x7')]();}catch(_0x3a0cc7){logger[_0x67bd('0x8')]('[%s][NOOP]\x20%s',_0x4165c4,JSON[_0x67bd('0x9')](_0x3a0cc7));_0x122f28[_0x67bd('0xa')]();}};}; \ No newline at end of file +var _0x0e67=['stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x0e67,0x8d));var _0x70e6=function(_0x319105,_0x5282cb){_0x319105=_0x319105-0x0;var _0x5156ba=_0x0e67[_0x319105];return _0x5156ba;};'use strict';var utils=require(_0x70e6('0x0'));var logger=require(_0x70e6('0x1'))(_0x70e6('0x2'));exports[_0x70e6('0x3')]=function(_0x568427,_0x298553){return function(_0x1a1ede){try{logger[_0x70e6('0x4')]('[%s][NOOP]\x20%s',_0x568427,utils[_0x70e6('0x5')](_0x298553[0x0],this));_0x1a1ede[_0x70e6('0x6')]();}catch(_0x4da7f3){logger['error'](_0x70e6('0x7'),_0x568427,JSON[_0x70e6('0x8')](_0x4da7f3));_0x1a1ede[_0x70e6('0x9')]();}};}; \ 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 8781047..4c686f7 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 _0xbac0=['../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','timeout','[%s][END:QUEUE][NAME:%s]','catch','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport'];(function(_0x2cc53a,_0xc11bc6){var _0x43c65e=function(_0x48b5e9){while(--_0x48b5e9){_0x2cc53a['push'](_0x2cc53a['shift']());}};_0x43c65e(++_0xc11bc6);}(_0xbac0,0x8c));var _0x0bac=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0xbac0[_0x3a902a];return _0x24f2d5;};'use strict';var schema=require(_0x0bac('0x0'));var _=require('lodash');var util=require(_0x0bac('0x1'));var seqqueue=require(_0x0bac('0x2'));var moment=require(_0x0bac('0x3'));var Redis=require(_0x0bac('0x4'));var config=require(_0x0bac('0x5'));var logger=require('../../../../config/logger')(_0x0bac('0x6'));var strategy=require(_0x0bac('0x7'));config[_0x0bac('0x8')]=_[_0x0bac('0x9')](config[_0x0bac('0x8')],{'host':_0x0bac('0xa'),'port':0x18eb});var io=require(_0x0bac('0xb'))(new Redis(config[_0x0bac('0x8')]));var attributes=['id',_0x0bac('0xc'),_0x0bac('0xd'),_0x0bac('0xe'),_0x0bac('0xf'),_0x0bac('0x10')];function emit(_0xdcfb4,_0x48669f,_0x59e259){io['to'](_0xdcfb4)[_0x0bac('0x11')](_0x48669f,_0x59e259);}function emitChannelQueueInteraction(_0x10133f,_0x4e3221,_0xc27a94,_0x24050c,_0x37a9b9,_0x2b4864,_0x49a5a4,_0x2ff504){var _0xc1cd1d=_[_0x0bac('0x12')](_0xc27a94);_0xc1cd1d[_0x0bac('0xc')]=_0x2ff504;_0xc1cd1d[_0x0bac('0xe')]=_0x4e3221;_0xc1cd1d[_0x0bac('0xd')]=_0x24050c;_0xc1cd1d['id']=_0x37a9b9;if(_0x2b4864){attributes[_0x0bac('0x13')](_[_0x0bac('0x14')](_0x10133f)+_0x0bac('0x15'));_0x49a5a4[util['format'](_0x0bac('0x16'),_0x10133f)][_0x37a9b9]=_[_0x0bac('0x17')](_0xc1cd1d,attributes);}else{delete _0x49a5a4[util[_0x0bac('0x18')]('%sQueuesWaitingInteractions',_0x10133f)][_0x37a9b9];}emit(util[_0x0bac('0x18')](_0x0bac('0x19'),_0x10133f,_0x4e3221),util[_0x0bac('0x18')](_0x0bac('0x1a'),_0x10133f,_0x2b4864?'save':'remove'),_[_0x0bac('0x17')](_0xc1cd1d,attributes));}var rpc={'openchannelQueueReport':require(_0x0bac('0x1b')),'mailQueueReport':require(_0x0bac('0x1c')),'chatQueueReport':require(_0x0bac('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x0bac('0x1e')),'whatsappQueueReport':require(_0x0bac('0x1f')),'chatInteraction':require(_0x0bac('0x20')),'faxInteraction':require(_0x0bac('0x21')),'mailInteraction':require(_0x0bac('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x0bac('0x23'))};var queue=schema({'name':{'type':_0x0bac('0x24'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0bac('0x25'),'message':_0x0bac('0x26')}});function startRouting(_0x44fabc,_0x2064b2,_0x929a0e,_0x22181e){if(_0x44fabc&&_0x2064b2&&_0x929a0e){_0x2064b2[_0x0bac('0x27')]+=0x1;var _0x2f3b2b={'uniqueid':_0x44fabc,'from':_0x929a0e[_0x0bac('0x28')]?_0x929a0e[_0x0bac('0x28')][_0x0bac('0xf')]:'','joinAt':moment()[_0x0bac('0x18')](_0x0bac('0x29')),'ContactId':_0x929a0e[_0x0bac('0x2a')]?_0x929a0e[_0x0bac('0x2a')]['id']:null,'ListId':_0x929a0e[_0x0bac('0x2b')]?_0x929a0e[_0x0bac('0x2b')]['id']:null};_0x2f3b2b[_['upperFirst'](_0x929a0e[_0x0bac('0x2c')])+_0x0bac('0x2d')]=_0x2064b2['id']||null;_0x2f3b2b[_[_0x0bac('0x2e')](_0x929a0e['channel'])+_0x0bac('0x15')]=_0x929a0e[_0x0bac('0x2f')]?_0x929a0e[_0x0bac('0x2f')]['id']:null;_0x2f3b2b[_[_0x0bac('0x2e')](_0x929a0e['channel'])+_0x0bac('0x30')]=_0x929a0e[_0x0bac('0x31')]?_0x929a0e[_0x0bac('0x31')]['id']:null;_0x2f3b2b[_[_0x0bac('0x2e')](_0x929a0e[_0x0bac('0x2c')])+(_0x929a0e['channel']!==_0x0bac('0x32')?_0x0bac('0x33'):_0x0bac('0x34'))]=_0x929a0e[_0x0bac('0xd')]?_0x929a0e[_0x0bac('0xd')]['id']:null;logger[_0x0bac('0x35')](util['format'](_0x0bac('0x36'),_0x44fabc,_0x2064b2[_0x0bac('0x37')]));emitChannelQueueInteraction(_0x929a0e[_0x0bac('0x2c')],_0x2064b2[_0x0bac('0x37')],_0x2f3b2b,_0x929a0e[_0x0bac('0xd')]['name'],_0x929a0e[_0x0bac('0x31')]['id'],!![],_0x22181e,_0x2064b2['id']);if(rpc[_0x929a0e[_0x0bac('0x2c')]+_0x0bac('0x38')]){return rpc[_0x929a0e['channel']+_0x0bac('0x38')][_0x0bac('0x39')](_0x2f3b2b)['catch'](function(_0x1f8b13){logger['error'](_0x0bac('0x3a'),_0x1f8b13);});}}}function stopRouting(_0x4c5628,_0x1731f7,_0x3b86d9,_0x581583){if(_0x4c5628&&_0x1731f7){_0x1731f7[_0x0bac('0x27')]-=0x1;var _0x3588b1={'leaveAt':moment()[_0x0bac('0x18')](_0x0bac('0x29')),'acceptAt':moment()[_0x0bac('0x18')](_0x0bac('0x29')),'reason':_0x0bac('0x3b')};logger[_0x0bac('0x35')](util[_0x0bac('0x18')](_0x0bac('0x3c'),_0x4c5628,_0x1731f7[_0x0bac('0x37')]));emitChannelQueueInteraction(_0x3b86d9[_0x0bac('0x2c')],_0x1731f7[_0x0bac('0x37')],_0x3b86d9[_0x0bac('0x28')],_0x3b86d9[_0x0bac('0xd')][_0x0bac('0x37')],_0x3b86d9[_0x0bac('0x31')]['id'],![],_0x581583,_0x1731f7['id']);return rpc[_0x3b86d9['channel']+_0x0bac('0x3d')][_0x0bac('0x3e')](_0x3b86d9[_0x0bac('0x2f')]['id'],{'queueId':_0x1731f7['id']})[_0x0bac('0x3f')](function(){if(rpc[_0x3b86d9[_0x0bac('0x2c')]+_0x0bac('0x38')]){return rpc[_0x3b86d9[_0x0bac('0x2c')]+'QueueReport'][_0x0bac('0x3e')](_0x4c5628,_0x3588b1)['catch'](function(_0x27b7a5){logger[_0x0bac('0x40')]('update\x20queue\x20report',_0x27b7a5);});}});}}function endRouting(_0x5f1d7e,_0xdba9af,_0x11685a,_0x337eaa){if(_0x5f1d7e&&_0xdba9af){_0xdba9af[_0x0bac('0x27')]-=0x1;var _0x1c4823={'leaveAt':moment()['format'](_0x0bac('0x29')),'exitAt':moment()[_0x0bac('0x18')](_0x0bac('0x29')),'reason':_0x0bac('0x41')};logger[_0x0bac('0x35')](util[_0x0bac('0x18')](_0x0bac('0x42'),_0x5f1d7e,_0xdba9af[_0x0bac('0x37')]));emitChannelQueueInteraction(_0x11685a[_0x0bac('0x2c')],_0xdba9af['name'],_0x11685a[_0x0bac('0x28')],_0x11685a[_0x0bac('0xd')][_0x0bac('0x37')],_0x11685a[_0x0bac('0x31')]['id'],![],_0x337eaa);if(rpc[_0x11685a['channel']+_0x0bac('0x38')]){return rpc[_0x11685a[_0x0bac('0x2c')]+_0x0bac('0x38')][_0x0bac('0x3e')](_0x5f1d7e,_0x1c4823)[_0x0bac('0x43')](function(_0x972bbd){logger[_0x0bac('0x40')](_0x0bac('0x44'),_0x972bbd);});}}}function handleFindQueue(_0x2c3328){return function(_0xa1c614){return _0xa1c614[_0x0bac('0x37')][_0x0bac('0x45')]()===_0x2c3328[_0x0bac('0x45')]();};}exports['consequence']=function(_0x1d9c83,_0x31f8e4,_0x450b23,_0x4873c4){return function(_0x845378){try{var _0x457b91={'name':_0x31f8e4[0x0],'timeout':_0x31f8e4[0x1]};var _0xbdec80=queue[_0x0bac('0x0')](_0x457b91,{'typecast':!![]});if(_0xbdec80['length']){logger['error'](_0x0bac('0x46'),_0x1d9c83,_[_0x0bac('0x47')](_0xbdec80,'message')[_0x0bac('0x48')](',\x20'));_0x845378[_0x0bac('0x49')]();}else{var _0x30c16f=_['find'](_0x450b23[_0x4873c4['channel']+'Queues'],handleFindQueue(_0x457b91[_0x0bac('0x37')]));if(_0x30c16f){startRouting(_0x1d9c83,_0x30c16f,_0x4873c4,_0x450b23);var _0x3f6807=(_0x30c16f[_0x0bac('0x41')]||0xa)*0x3e8;var _0x420c43=(_0x457b91[_0x0bac('0x41')]||0x14)*0x3e8;var _0x20eeea;if(_0x3f6807>_0x420c43){_0x420c43=_0x3f6807;}var _0x1e89a3=seqqueue['createQueue'](_0x3f6807);_0x1e89a3['id']=_0x1d9c83;_0x1e89a3[_0x0bac('0x4a')]=_0x3f6807;_0x1e89a3[_0x0bac('0x4b')]=_0x420c43;_0x1e89a3[_0x0bac('0x2c')]=_0x4873c4[_0x0bac('0x2c')];_0x450b23[_0x0bac('0x4c')][_0x1d9c83]['on'](_0x0bac('0x4d'),function(){logger[_0x0bac('0x35')](_0x0bac('0x4e'),_0x1d9c83);stopRouting(_0x1d9c83,_0x30c16f,_0x4873c4,_0x450b23);clearTimeout(_0x20eeea);_0x20eeea=undefined;_0x1e89a3[_0x0bac('0x4f')](!![]);if(_0x450b23[_0x0bac('0x4c')][_0x1d9c83]){delete _0x450b23[_0x0bac('0x4c')][_0x1d9c83];}_0x845378['stop']();});_0x450b23[_0x0bac('0x4c')][_0x1d9c83]['on'](_0x0bac('0x50'),function(){if(_0x450b23[_0x0bac('0x4c')][_0x1d9c83]){delete _0x450b23['rules'][_0x1d9c83];}});_0x20eeea=setTimeout(function(){logger[_0x0bac('0x35')](_0x0bac('0x51'),_0x1d9c83);endRouting(_0x1d9c83,_0x30c16f,_0x4873c4,_0x450b23);clearTimeout(_0x20eeea);_0x1e89a3['close'](!![]);_0x845378[_0x0bac('0x52')]();},_0x420c43);switch(_0x30c16f[_0x0bac('0x53')]){case _0x0bac('0x54'):strategy[_0x0bac('0x54')](_0x1e89a3,_0x30c16f,_0x450b23,_0x4873c4);break;default:strategy[_0x0bac('0x55')](_0x1e89a3,_0x30c16f,_0x450b23,_0x4873c4);}}else{logger[_0x0bac('0x40')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1d9c83,_0x457b91[_0x0bac('0x37')]);_0x845378[_0x0bac('0x49')]();}}}catch(_0x199281){logger[_0x0bac('0x40')](_0x0bac('0x46'),_0x1d9c83,_0x199281['stack']);_0x845378['stop']();}};}; \ No newline at end of file +var _0x2d93=['queue','from','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','message','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','waiting','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','error','update\x20queue\x20report','toLowerCase','consequence','map','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0x2d93,0xf3));var _0x32d9=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x2d93[_0x4687df];return _0x32eaef;};'use strict';var schema=require(_0x32d9('0x0'));var _=require(_0x32d9('0x1'));var util=require(_0x32d9('0x2'));var seqqueue=require(_0x32d9('0x3'));var moment=require(_0x32d9('0x4'));var Redis=require(_0x32d9('0x5'));var config=require(_0x32d9('0x6'));var logger=require(_0x32d9('0x7'))(_0x32d9('0x8'));var strategy=require(_0x32d9('0x9'));config[_0x32d9('0xa')]=_[_0x32d9('0xb')](config[_0x32d9('0xa')],{'host':_0x32d9('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32d9('0xa')]));var attributes=['id',_0x32d9('0xd'),_0x32d9('0xe'),_0x32d9('0xf'),_0x32d9('0x10'),'joinAt'];function emit(_0x21df58,_0x46603b,_0x1d5f25){io['to'](_0x21df58)[_0x32d9('0x11')](_0x46603b,_0x1d5f25);}function emitChannelQueueInteraction(_0x2babbf,_0x312988,_0x3475ee,_0x3383a8,_0x2875cf,_0x5efb8f,_0x1befe0,_0x5b7bab){var _0x5afced=_[_0x32d9('0x12')](_0x3475ee);_0x5afced[_0x32d9('0xd')]=_0x5b7bab;_0x5afced[_0x32d9('0xf')]=_0x312988;_0x5afced[_0x32d9('0xe')]=_0x3383a8;_0x5afced['id']=_0x2875cf;if(_0x5efb8f){attributes[_0x32d9('0x13')](_[_0x32d9('0x14')](_0x2babbf)+_0x32d9('0x15'));_0x1befe0[util[_0x32d9('0x16')](_0x32d9('0x17'),_0x2babbf)][_0x2875cf]=_[_0x32d9('0x18')](_0x5afced,attributes);}else{delete _0x1befe0[util[_0x32d9('0x16')](_0x32d9('0x17'),_0x2babbf)][_0x2875cf];}emit(util['format'](_0x32d9('0x19'),_0x2babbf,_0x312988),util[_0x32d9('0x16')]('%s_queue_waiting_interaction:%s',_0x2babbf,_0x5efb8f?_0x32d9('0x1a'):_0x32d9('0x1b')),_[_0x32d9('0x18')](_0x5afced,attributes));}var rpc={'openchannelQueueReport':require(_0x32d9('0x1c')),'mailQueueReport':require(_0x32d9('0x1d')),'chatQueueReport':require(_0x32d9('0x1e')),'smsQueueReport':require(_0x32d9('0x1f')),'faxQueueReport':require(_0x32d9('0x20')),'whatsappQueueReport':require(_0x32d9('0x21')),'chatInteraction':require(_0x32d9('0x22')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x32d9('0x23')),'smsInteraction':require(_0x32d9('0x24')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x32d9('0x25'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x32d9('0x26'),'message':_0x32d9('0x27')}});function startRouting(_0x579b29,_0x59743d,_0x3e2ef3,_0xcd2cec){if(_0x579b29&&_0x59743d&&_0x3e2ef3){_0x59743d['waiting']+=0x1;var _0x56aac0={'uniqueid':_0x579b29,'from':_0x3e2ef3[_0x32d9('0x28')]?_0x3e2ef3[_0x32d9('0x28')][_0x32d9('0x10')]:'','joinAt':moment()[_0x32d9('0x16')](_0x32d9('0x29')),'ContactId':_0x3e2ef3['contact']?_0x3e2ef3[_0x32d9('0x2a')]['id']:null,'ListId':_0x3e2ef3[_0x32d9('0x2b')]?_0x3e2ef3[_0x32d9('0x2b')]['id']:null};_0x56aac0[_[_0x32d9('0x2c')](_0x3e2ef3['channel'])+_0x32d9('0x2d')]=_0x59743d['id']||null;_0x56aac0[_[_0x32d9('0x2c')](_0x3e2ef3[_0x32d9('0x2e')])+'InteractionId']=_0x3e2ef3[_0x32d9('0x2f')]?_0x3e2ef3[_0x32d9('0x2f')]['id']:null;_0x56aac0[_[_0x32d9('0x2c')](_0x3e2ef3[_0x32d9('0x2e')])+'MessageId']=_0x3e2ef3[_0x32d9('0x30')]?_0x3e2ef3[_0x32d9('0x30')]['id']:null;_0x56aac0[_[_0x32d9('0x2c')](_0x3e2ef3[_0x32d9('0x2e')])+(_0x3e2ef3['channel']!=='chat'?'AccountId':_0x32d9('0x31'))]=_0x3e2ef3[_0x32d9('0xe')]?_0x3e2ef3[_0x32d9('0xe')]['id']:null;logger['info'](util[_0x32d9('0x16')](_0x32d9('0x32'),_0x579b29,_0x59743d['name']));emitChannelQueueInteraction(_0x3e2ef3[_0x32d9('0x2e')],_0x59743d[_0x32d9('0x33')],_0x56aac0,_0x3e2ef3[_0x32d9('0xe')][_0x32d9('0x33')],_0x3e2ef3[_0x32d9('0x30')]['id'],!![],_0xcd2cec,_0x59743d['id']);if(rpc[_0x3e2ef3['channel']+_0x32d9('0x34')]){return rpc[_0x3e2ef3[_0x32d9('0x2e')]+_0x32d9('0x34')][_0x32d9('0x35')](_0x56aac0)['catch'](function(_0x536559){logger['error'](_0x32d9('0x36'),_0x536559);});}}}function stopRouting(_0x44f318,_0x2529e0,_0x30cd6b,_0x24a93e){if(_0x44f318&&_0x2529e0){_0x2529e0[_0x32d9('0x37')]-=0x1;var _0x247847={'leaveAt':moment()[_0x32d9('0x16')](_0x32d9('0x29')),'acceptAt':moment()['format'](_0x32d9('0x29')),'reason':_0x32d9('0x38')};logger[_0x32d9('0x39')](util[_0x32d9('0x16')](_0x32d9('0x3a'),_0x44f318,_0x2529e0[_0x32d9('0x33')]));emitChannelQueueInteraction(_0x30cd6b[_0x32d9('0x2e')],_0x2529e0[_0x32d9('0x33')],_0x30cd6b[_0x32d9('0x28')],_0x30cd6b[_0x32d9('0xe')]['name'],_0x30cd6b['message']['id'],![],_0x24a93e,_0x2529e0['id']);return rpc[_0x30cd6b[_0x32d9('0x2e')]+_0x32d9('0x3b')][_0x32d9('0x3c')](_0x30cd6b[_0x32d9('0x2f')]['id'],{'queueId':_0x2529e0['id']})[_0x32d9('0x3d')](function(){if(rpc[_0x30cd6b[_0x32d9('0x2e')]+_0x32d9('0x34')]){return rpc[_0x30cd6b[_0x32d9('0x2e')]+_0x32d9('0x34')][_0x32d9('0x3c')](_0x44f318,_0x247847)['catch'](function(_0x20ae87){logger['error']('update\x20queue\x20report',_0x20ae87);});}});}}function endRouting(_0x1d4b89,_0x2fc43f,_0x532195,_0x125c5){if(_0x1d4b89&&_0x2fc43f){_0x2fc43f['waiting']-=0x1;var _0x359727={'leaveAt':moment()[_0x32d9('0x16')](_0x32d9('0x29')),'exitAt':moment()['format'](_0x32d9('0x29')),'reason':_0x32d9('0x3e')};logger[_0x32d9('0x39')](util[_0x32d9('0x16')](_0x32d9('0x3f'),_0x1d4b89,_0x2fc43f[_0x32d9('0x33')]));emitChannelQueueInteraction(_0x532195[_0x32d9('0x2e')],_0x2fc43f[_0x32d9('0x33')],_0x532195['body'],_0x532195['account'][_0x32d9('0x33')],_0x532195[_0x32d9('0x30')]['id'],![],_0x125c5);if(rpc[_0x532195['channel']+_0x32d9('0x34')]){return rpc[_0x532195[_0x32d9('0x2e')]+_0x32d9('0x34')][_0x32d9('0x3c')](_0x1d4b89,_0x359727)['catch'](function(_0x4b1fea){logger[_0x32d9('0x40')](_0x32d9('0x41'),_0x4b1fea);});}}}function handleFindQueue(_0x12c469){return function(_0x389721){return _0x389721[_0x32d9('0x33')][_0x32d9('0x42')]()===_0x12c469[_0x32d9('0x42')]();};}exports[_0x32d9('0x43')]=function(_0x2edc21,_0x4344dc,_0x56c419,_0x3d41d4){return function(_0x5dc8ee){try{var _0x47494a={'name':_0x4344dc[0x0],'timeout':_0x4344dc[0x1]};var _0x376d46=queue[_0x32d9('0x0')](_0x47494a,{'typecast':!![]});if(_0x376d46['length']){logger['error']('[%s][QUEUE]\x20%s',_0x2edc21,_[_0x32d9('0x44')](_0x376d46,_0x32d9('0x30'))['join'](',\x20'));_0x5dc8ee[_0x32d9('0x45')]();}else{var _0x5e0484=_[_0x32d9('0x46')](_0x56c419[_0x3d41d4['channel']+_0x32d9('0x47')],handleFindQueue(_0x47494a[_0x32d9('0x33')]));if(_0x5e0484){startRouting(_0x2edc21,_0x5e0484,_0x3d41d4,_0x56c419);var _0x186371=(_0x5e0484[_0x32d9('0x3e')]||0xa)*0x3e8;var _0xadc374=(_0x47494a['timeout']||0x14)*0x3e8;var _0x2a2232;if(_0x186371>_0xadc374){_0xadc374=_0x186371;}var _0x46e05c=seqqueue[_0x32d9('0x48')](_0x186371);_0x46e05c['id']=_0x2edc21;_0x46e05c['atimeout']=_0x186371;_0x46e05c[_0x32d9('0x49')]=_0xadc374;_0x46e05c[_0x32d9('0x2e')]=_0x3d41d4[_0x32d9('0x2e')];_0x56c419[_0x32d9('0x4a')][_0x2edc21]['on'](_0x32d9('0x4b'),function(){logger['info'](_0x32d9('0x4c'),_0x2edc21);stopRouting(_0x2edc21,_0x5e0484,_0x3d41d4,_0x56c419);clearTimeout(_0x2a2232);_0x2a2232=undefined;_0x46e05c[_0x32d9('0x4d')](!![]);if(_0x56c419[_0x32d9('0x4a')][_0x2edc21]){delete _0x56c419[_0x32d9('0x4a')][_0x2edc21];}_0x5dc8ee['stop']();});_0x56c419['rules'][_0x2edc21]['on'](_0x32d9('0x4e'),function(){if(_0x56c419[_0x32d9('0x4a')][_0x2edc21]){delete _0x56c419[_0x32d9('0x4a')][_0x2edc21];}});_0x2a2232=setTimeout(function(){logger[_0x32d9('0x39')](_0x32d9('0x4f'),_0x2edc21);endRouting(_0x2edc21,_0x5e0484,_0x3d41d4,_0x56c419);clearTimeout(_0x2a2232);_0x46e05c[_0x32d9('0x4d')](!![]);_0x5dc8ee[_0x32d9('0x50')]();},_0xadc374);switch(_0x5e0484[_0x32d9('0x51')]){case'rrmemory':strategy[_0x32d9('0x52')](_0x46e05c,_0x5e0484,_0x56c419,_0x3d41d4);break;default:strategy[_0x32d9('0x53')](_0x46e05c,_0x5e0484,_0x56c419,_0x3d41d4);}}else{logger[_0x32d9('0x40')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2edc21,_0x47494a['name']);_0x5dc8ee[_0x32d9('0x45')]();}}}catch(_0x35a0f2){logger[_0x32d9('0x40')](_0x32d9('0x54'),_0x2edc21,_0x35a0f2[_0x32d9('0x55')]);_0x5dc8ee[_0x32d9('0x45')]();}};}; \ 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 0694619..0554034 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 _0xe5b3=['exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT'];(function(_0x385b69,_0x2a2b81){var _0x2e4816=function(_0x5401d0){while(--_0x5401d0){_0x385b69['push'](_0x385b69['shift']());}};_0x2e4816(++_0x2a2b81);}(_0xe5b3,0x133));var _0x3e5b=function(_0x6dece8,_0x461666){_0x6dece8=_0x6dece8-0x0;var _0x1bef9b=_0xe5b3[_0x6dece8];return _0x1bef9b;};'use strict';var _=require('lodash');var uuid=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var Agent=function(_0x2a71ef,_0x3171c5,_0x7f1cc0,_0x1e58ed){this[_0x3e5b('0x4')]=uuid['v4']();this[_0x3e5b('0x5')]=_0x2a71ef;this[_0x3e5b('0x6')]=_0x3171c5;this['realtime']=_0x7f1cc0;this[_0x3e5b('0x3')]=_0x1e58ed;this[_0x3e5b('0x5')]['push'](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this['squeue']['on']('timeout',this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this[_0x3e5b('0x5')]['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')]['bind'](this));};Agent[_0x3e5b('0xc')]['push']=function(){this[_0x3e5b('0x5')][_0x3e5b('0xd')](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));};Agent[_0x3e5b('0xc')]['handleDrained']=function(){this[_0x3e5b('0x9')](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0x3e5b('0xe'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);if(_['isNil'](this[_0x3e5b('0xf')]['agents'][this['agent']['id']])){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')]['bind'](this),0x3e8);}else{if(this[_0x3e5b('0x3')][_0x3e5b('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],this[_0x3e5b('0x5')][_0x3e5b('0x14')],![])){this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=!![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x17')](this['realtime'],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')][_0x3e5b('0x14')]);util['showNotification'](this[_0x3e5b('0x4')],this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this['agent']['id']],null,this[_0x3e5b('0x3')]);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],_0x3e5b('0x19')+(this[_0x3e5b('0x3')]['forcedOwnership']?_0x3e5b('0x1a'):''));}else{logger['debug'](_0x3e5b('0x1b'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}}};Agent[_0x3e5b('0xc')][_0x3e5b('0x9')]=function(_0x3cfaf6){if(_[_0x3e5b('0x1c')](this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']])){return logger[_0x3e5b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x1d'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);util[_0x3e5b('0x1e')](this['notificationId'],this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],null,this[_0x3e5b('0x3')]);this['realtime'][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x1f')](this[_0x3e5b('0xf')],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')]['channel']);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],_0x3cfaf6?'STOP':_0x3e5b('0x20'));}if(!_0x3cfaf6){setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}};function agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1){return new Agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1);}module[_0x3e5b('0x21')]=agent; \ No newline at end of file +var _0x4bc3=['hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x1e035b,_0x32e01b){var _0x2c0405=function(_0x2754ff){while(--_0x2754ff){_0x1e035b['push'](_0x1e035b['shift']());}};_0x2c0405(++_0x32e01b);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x4bc3[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x34bc('0x0'));var uuid=require(_0x34bc('0x1'));var util=require('./util');var logger=require(_0x34bc('0x2'))(_0x34bc('0x3'));var Agent=function(_0x5b45c7,_0x178fc0,_0x616014,_0x3ce1c3){this[_0x34bc('0x4')]=uuid['v4']();this[_0x34bc('0x5')]=_0x5b45c7;this[_0x34bc('0x6')]=_0x178fc0;this[_0x34bc('0x7')]=_0x616014;this['routing']=_0x3ce1c3;this[_0x34bc('0x5')]['push'](this['handleRun'][_0x34bc('0x8')](this),this[_0x34bc('0x9')][_0x34bc('0x8')](this));this[_0x34bc('0x5')]['on'](_0x34bc('0xa'),this[_0x34bc('0x9')]['bind'](this));this['squeue']['on'](_0x34bc('0xb'),this[_0x34bc('0xc')][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xd')]=function(){this['squeue'][_0x34bc('0xd')](this[_0x34bc('0xe')][_0x34bc('0x8')](this),this['handleTimeout'][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xc')]=function(){this[_0x34bc('0x9')](!![]);};Agent[_0x34bc('0xf')]['handleRun']=function(){logger['debug'](_0x34bc('0x10'),this['squeue']['id'],this[_0x34bc('0x6')]['id']);if(_[_0x34bc('0x11')](this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){logger[_0x34bc('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}else{if(this[_0x34bc('0x3')][_0x34bc('0x14')]||util['isAgentAvailable'](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],this[_0x34bc('0x5')]['channel'],![])){this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x15')]=!![];this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x16')]=undefined;util[_0x34bc('0x17')](this[_0x34bc('0x7')],this['routing'],this['agent'],this[_0x34bc('0x5')][_0x34bc('0x18')]);util[_0x34bc('0x19')](this[_0x34bc('0x4')],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);util[_0x34bc('0x1a')](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],'RINGING'+(this['routing'][_0x34bc('0x14')]?':FORCED':''));}else{logger[_0x34bc('0x13')](_0x34bc('0x1b'),this[_0x34bc('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}}};Agent[_0x34bc('0xf')][_0x34bc('0x9')]=function(_0x2bb874){if(_[_0x34bc('0x11')](this['realtime'][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){return logger[_0x34bc('0x13')](_0x34bc('0x1c'),this[_0x34bc('0x5')]['id'],this[_0x34bc('0x6')]['id']);}else{logger['debug'](_0x34bc('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x34bc('0x1e')](this['notificationId'],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x15')]=![];this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x16')]=undefined;util['removeWaitingNotification'](this[_0x34bc('0x7')],this[_0x34bc('0x3')],this[_0x34bc('0x6')],this[_0x34bc('0x5')][_0x34bc('0x18')]);util['writeLog'](this['squeue']['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],_0x2bb874?_0x34bc('0x1f'):'TIMEOUT');}if(!_0x2bb874){setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}};function agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb){return new Agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb);}module[_0x34bc('0x20')]=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 84dd235..42c934e 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 _0xe191=['writeLog','busy','name','saveWaitingNotification','channel','showNotification','hideNotification','notificationId','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue','handleTimeout','bind','drained','prototype','push','handleRun','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable'];(function(_0x584854,_0x5c0aa7){var _0x373c7a=function(_0x1ba6cf){while(--_0x1ba6cf){_0x584854['push'](_0x584854['shift']());}};_0x373c7a(++_0x5c0aa7);}(_0xe191,0xe4));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e19('0x0'));var uuid=require('uuid');var util=require(_0x1e19('0x1'));var logger=require(_0x1e19('0x2'))(_0x1e19('0x3'));var Beepall=function(_0x57e00f,_0x114dd3,_0x4c8475,_0x3ec282){this['notificationId']=uuid['v4']();this[_0x1e19('0x4')]=_0x57e00f;this[_0x1e19('0x5')]=_0x114dd3;this['realtime']=_0x4c8475;this[_0x1e19('0x3')]=_0x3ec282;this[_0x1e19('0x4')]['push'](this['handleRun']['bind'](this),this[_0x1e19('0x6')][_0x1e19('0x7')](this));this[_0x1e19('0x4')]['on']('timeout',this['handleTimeout'][_0x1e19('0x7')](this));this['squeue']['on'](_0x1e19('0x8'),this['handleDrained'][_0x1e19('0x7')](this));};Beepall[_0x1e19('0x9')]['push']=function(){this[_0x1e19('0x4')][_0x1e19('0xa')](this[_0x1e19('0xb')][_0x1e19('0x7')](this),this[_0x1e19('0x6')][_0x1e19('0x7')](this));};Beepall[_0x1e19('0x9')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0x1e19('0x9')]['handleRun']=function(){var _0x241639=!![];if(!_['isNil'](this[_0x1e19('0x5')])&&!_[_0x1e19('0xc')](this[_0x1e19('0x5')][_0x1e19('0xd')])&&this[_0x1e19('0x5')][_0x1e19('0xd')][_0x1e19('0xe')]>0x0){for(var _0x5f1e92=0x0,_0x2ab25e;_0x5f1e920x0){for(var _0x3f9058=0x0,_0x939c67;_0x3f90580x0&&_0x377491[_0x511d4c+_0x9e74('0x20')]>=_0x377491[_0x511d4c+_0x9e74('0x1f')]){writeLog(_0x2aa04a,_0x377491,_0x511d4c[_0x9e74('0x21')]()+_0x9e74('0x22'));return![];}}return!![];};exports[_0x9e74('0x23')]=function(_0x38f526,_0x935be9,_0x123c74,_0x5b1a60,_0x5d6177){return sendNotification(!![],_0x38f526,_0x935be9,_0x123c74,_0x5b1a60,_0x5d6177);};exports['hideNotification']=function(_0x205d59,_0x3a5a16,_0x316984,_0x3de1ca,_0x4fe2d2){return sendNotification(![],_0x205d59,_0x3a5a16,_0x316984,_0x3de1ca,_0x4fe2d2);};exports[_0x9e74('0x24')]=function(_0x21a77b,_0x41d2aa,_0x4b5871){var _0x5bd970=_0x41d2aa[_0x9e74('0x25')][_0x9e74('0x26')];if(!_0x5bd970&&_0x4b5871){_0x5bd970=_0x4b5871['id'];}var _0x5a93b0=_['some'](_0x21a77b[_0x41d2aa[_0x9e74('0x27')]+_0x9e74('0x28')],function(_0x1147a1){var _0x55f853=_[_0x9e74('0x29')](_0x41d2aa['channel'])+_0x9e74('0x2a');return _0x1147a1[_0x55f853]===_0x41d2aa[_0x9e74('0x25')]['id'];});if(!_0x5a93b0&&_0x5bd970&&_0x21a77b[_0x9e74('0x2b')][_0x5bd970]){_0x5a93b0=_['some'](_0x21a77b['agents'][_0x5bd970][_0x41d2aa[_0x9e74('0x27')]+'WaitingInteractions'],function(_0x15decf){return _0x15decf['id']===_0x41d2aa[_0x9e74('0x25')]['id'];});}return _0x5a93b0;};exports[_0x9e74('0x2c')]=function(_0x36e209,_0x327a54,_0x384b04,_0x990d96){if(_0x384b04&&_0x384b04['id']&&_0x36e209['agents']&&_0x36e209[_0x9e74('0x2b')][_0x384b04['id']]){_0x36e209['agents'][_0x384b04['id']][_0x990d96+_0x9e74('0x2d')][_0x327a54[_0x9e74('0x14')]['id']]={'id':_0x327a54['interaction']['id']};}};exports[_0x9e74('0x2e')]=function(_0xf403c7,_0x3f0783,_0x48d362,_0x47f7f5){if(_0x48d362&&_0x48d362['id']&&_0xf403c7[_0x9e74('0x2b')]&&_0xf403c7['agents'][_0x48d362['id']]){delete _0xf403c7[_0x9e74('0x2b')][_0x48d362['id']][_0x47f7f5+_0x9e74('0x2d')][_0x3f0783[_0x9e74('0x14')]['id']];}};exports[_0x9e74('0x2f')]=writeLog; \ No newline at end of file +var _0x79ad=['../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','split','\x20interaction','name','notificationSound','account','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','showNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','InteractionId','agents','WaitingInteractions','saveWaitingNotification','writeLog','lodash','ioredis'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x79ad,0x16e));var _0xd79a=function(_0x3e7d95,_0x8e2019){_0x3e7d95=_0x3e7d95-0x0;var _0x1acda0=_0x79ad[_0x3e7d95];return _0x1acda0;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0xd79a('0x1'));var config=require(_0xd79a('0x2'));var logger=require(_0xd79a('0x3'))(_0xd79a('0x4'));config[_0xd79a('0x5')]=_[_0xd79a('0x6')](config[_0xd79a('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd79a('0x5')]));function sendNotification(_0x370f0c,_0x1d3a5a,_0x273f8d,_0x12bf8c,_0x263519,_0x2d3ec9){var _0x2f2ed1=_0x2d3ec9||{};var _0x929947=_0x273f8d[_0xd79a('0x7')]('.');var _0x28c947={'uniqueid':_0x1d3a5a,'channel':_0x929947[0x0],'id':_0x929947[0x1],'title':_0x929947[0x0]+_0xd79a('0x8'),'interactionId':_0x929947[0x2],'queue':_0x263519?_0x263519[_0xd79a('0x9')]:null,'sound':_0x2f2ed1['account'][_0xd79a('0xa')],'shake':_0x2f2ed1[_0xd79a('0xb')][_0xd79a('0xc')]};try{if(!_0x2f2ed1[_0xd79a('0xd')]){_0x2f2ed1[_0xd79a('0xd')]={};}if(_0x263519){_0x2f2ed1[_0xd79a('0xd')][_0xd79a('0xe')]=_0x263519;}else if(_0x2f2ed1[_0xd79a('0xd')][_0xd79a('0xe')]){delete _0x2f2ed1['body']['queue'];}_0x28c947[_0xd79a('0xf')]=utils['getMustacheRender'](_0x2f2ed1[_0xd79a('0xb')][_0xd79a('0x10')],_0x2f2ed1);}catch(_0x329e2c){_0x28c947[_0xd79a('0xf')]=_0xd79a('0x11');logger[_0xd79a('0x12')](util[_0xd79a('0x13')](_0xd79a('0x14'),_0x1d3a5a,_0x329e2c[_0xd79a('0x15')]));}io['to'](util[_0xd79a('0x13')](_0xd79a('0x16'),_0x12bf8c[_0xd79a('0x9')]))['emit'](util[_0xd79a('0x13')](_0xd79a('0x17'),_0x370f0c?_0xd79a('0x18'):_0xd79a('0x19')),_0x28c947);}function writeLog(_0x41d296,_0x1a678b,_0x1bd13f){return logger[_0xd79a('0x1a')](util[_0xd79a('0x13')](_0xd79a('0x1b'),_0x41d296,_0x1a678b[_0xd79a('0x9')],_0x1bd13f));}exports['isAgentAvailable']=function(_0x2ac9ea,_0x558db5,_0x481ab1,_0x59717e){if(_0x558db5[_0xd79a('0x1c')]){writeLog(_0x2ac9ea,_0x558db5,_0xd79a('0x1d'));return![];}if(!_0x558db5[_0xd79a('0x1e')]){writeLog(_0x2ac9ea,_0x558db5,'OFFLINE');return![];}if(_0x558db5[_0x481ab1+_0xd79a('0x1f')]){writeLog(_0x2ac9ea,_0x558db5,_0xd79a('0x20'));return![];}if(_0x59717e&&_0x558db5[_0xd79a('0x21')](_0x481ab1+_0xd79a('0x22'))&&_0x558db5['hasOwnProperty'](_0x481ab1+'CurrentCapacity')){if(_0x558db5[_0x481ab1+'Capacity']>0x0&&_0x558db5[_0x481ab1+'CurrentCapacity']>=_0x558db5[_0x481ab1+_0xd79a('0x22')]){writeLog(_0x2ac9ea,_0x558db5,_0x481ab1['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xd79a('0x23')]=function(_0x4ab4ff,_0x5464a5,_0x169993,_0x2792b8,_0x4de7e8){return sendNotification(!![],_0x4ab4ff,_0x5464a5,_0x169993,_0x2792b8,_0x4de7e8);};exports['hideNotification']=function(_0x5334c8,_0x47e2c9,_0x12152b,_0xd7a6e5,_0x5e9bf4){return sendNotification(![],_0x5334c8,_0x47e2c9,_0x12152b,_0xd7a6e5,_0x5e9bf4);};exports[_0xd79a('0x24')]=function(_0x575bbe,_0x4f74db,_0x3b95){var _0x5be5bd=_0x4f74db[_0xd79a('0x25')]['UserId'];if(!_0x5be5bd&&_0x3b95){_0x5be5bd=_0x3b95['id'];}var _0x2bf0b2=_[_0xd79a('0x26')](_0x575bbe[_0x4f74db[_0xd79a('0x27')]+_0xd79a('0x28')],function(_0x37d02c){var _0x75686=_['capitalize'](_0x4f74db[_0xd79a('0x27')])+_0xd79a('0x29');return _0x37d02c[_0x75686]===_0x4f74db[_0xd79a('0x25')]['id'];});if(!_0x2bf0b2&&_0x5be5bd&&_0x575bbe[_0xd79a('0x2a')][_0x5be5bd]){_0x2bf0b2=_[_0xd79a('0x26')](_0x575bbe[_0xd79a('0x2a')][_0x5be5bd][_0x4f74db[_0xd79a('0x27')]+_0xd79a('0x2b')],function(_0x2e69aa){return _0x2e69aa['id']===_0x4f74db['interaction']['id'];});}return _0x2bf0b2;};exports[_0xd79a('0x2c')]=function(_0x4a531a,_0x345fa9,_0x5ec9a8,_0x32fde3){if(_0x5ec9a8&&_0x5ec9a8['id']&&_0x4a531a[_0xd79a('0x2a')]&&_0x4a531a[_0xd79a('0x2a')][_0x5ec9a8['id']]){_0x4a531a['agents'][_0x5ec9a8['id']][_0x32fde3+_0xd79a('0x2b')][_0x345fa9['message']['id']]={'id':_0x345fa9['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x3042aa,_0x500725,_0xb28aa,_0x5552a4){if(_0xb28aa&&_0xb28aa['id']&&_0x3042aa[_0xd79a('0x2a')]&&_0x3042aa['agents'][_0xb28aa['id']]){delete _0x3042aa[_0xd79a('0x2a')][_0xb28aa['id']][_0x5552a4+_0xd79a('0x2b')][_0x500725[_0xd79a('0x15')]['id']];}};exports[_0xd79a('0x2d')]=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 f28f521..2284210 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 _0xc3f9=['consequence','length','error','[%s][SYSTEM]\x20%s','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','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x499c39,_0x4a95c0){var _0x579971=function(_0x5c725b){while(--_0x5c725b){_0x499c39['push'](_0x499c39['shift']());}};_0x579971(++_0x4a95c0);}(_0xc3f9,0x125));var _0x9c3f=function(_0x204bb6,_0x10c426){_0x204bb6=_0x204bb6-0x0;var _0x4bc63b=_0xc3f9[_0x204bb6];return _0x4bc63b;};'use strict';var schema=require(_0x9c3f('0x0'));var sh=require(_0x9c3f('0x1'));var _=require(_0x9c3f('0x2'));var utils=require(_0x9c3f('0x3'));var logger=require(_0x9c3f('0x4'))(_0x9c3f('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x9c3f('0x6')}});exports[_0x9c3f('0x7')]=function(_0x1dd80e,_0x2a92a7){return function(_0x2fed2){try{var _0x49af64={'command':_0x2a92a7[0x0]};var _0x89ecda=system['validate'](_0x49af64,{'typecast':!![]});if(_0x89ecda[_0x9c3f('0x8')]){logger[_0x9c3f('0x9')](_0x9c3f('0xa'),_0x1dd80e,_['map'](_0x89ecda,_0x9c3f('0xb'))['join'](',\x20'));logger[_0x9c3f('0xc')](_0x9c3f('0xd'),_0x1dd80e);_0x2fed2[_0x9c3f('0xe')]();}else{var _0x149e98=this;var _0xa90c23=utils[_0x9c3f('0xf')](_0x2a92a7[0x0],this);logger[_0x9c3f('0xc')](_0x9c3f('0x10'),_0x1dd80e,_0xa90c23);sh[_0x9c3f('0x11')](_['trim'](_0xa90c23),function(_0x1a1d30,_0x4579b3){logger['info'](_0x9c3f('0x12'),_0x1dd80e,_0x1a1d30);if(_0x1a1d30==0x0){var _0x18f24c=_0x4579b3[_0x9c3f('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x9c3f('0x14')](_0x2a92a7[0x1])||_['isEmpty'](_0x2a92a7[0x1])){logger[_0x9c3f('0xc')](_0x9c3f('0x15'),_0x1dd80e);_0x149e98[_0x9c3f('0x16')][_0x2a92a7[0x1]]=_0x18f24c;}else{logger[_0x9c3f('0xc')](_0x9c3f('0x17'),_0x1dd80e,_0x2a92a7[0x1],_0x18f24c);_0x149e98[_0x9c3f('0x16')][_0x2a92a7[0x1]]=_0x18f24c;}}_0x2fed2[_0x9c3f('0xe')]();});}}catch(_0x432357){logger[_0x9c3f('0x9')](_0x9c3f('0xa'),_0x1dd80e,_[_0x9c3f('0x18')](_0x432357)?JSON['stringify'](_0x432357):_0x432357);logger[_0x9c3f('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1dd80e);_0x2fed2[_0x9c3f('0xe')]();}};}; \ No newline at end of file +var _0x3c6d=['consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x3c6d,0x199));var _0xd3c6=function(_0x1b5007,_0x1f729c){_0x1b5007=_0x1b5007-0x0;var _0x570334=_0x3c6d[_0x1b5007];return _0x570334;};'use strict';var schema=require(_0xd3c6('0x0'));var sh=require(_0xd3c6('0x1'));var _=require(_0xd3c6('0x2'));var utils=require(_0xd3c6('0x3'));var logger=require('../../../../config/logger')(_0xd3c6('0x4'));var system=schema({'command':{'type':_0xd3c6('0x5'),'required':!![],'message':_0xd3c6('0x6')}});exports[_0xd3c6('0x7')]=function(_0x26c5b9,_0x236c6b){return function(_0x5dcebd){try{var _0x11fb61={'command':_0x236c6b[0x0]};var _0xe7c405=system[_0xd3c6('0x0')](_0x11fb61,{'typecast':!![]});if(_0xe7c405[_0xd3c6('0x8')]){logger[_0xd3c6('0x9')](_0xd3c6('0xa'),_0x26c5b9,_['map'](_0xe7c405,'message')[_0xd3c6('0xb')](',\x20'));logger[_0xd3c6('0xc')](_0xd3c6('0xd'),_0x26c5b9);_0x5dcebd['next']();}else{var _0x1b7e6d=this;var _0x5c14ec=utils[_0xd3c6('0xe')](_0x236c6b[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x26c5b9,_0x5c14ec);sh[_0xd3c6('0xf')](_[_0xd3c6('0x10')](_0x5c14ec),function(_0x33ba6d,_0x2299fb){logger[_0xd3c6('0xc')](_0xd3c6('0x11'),_0x26c5b9,_0x33ba6d);if(_0x33ba6d==0x0){var _0x29f18b=_0x2299fb[_0xd3c6('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xd3c6('0x13')](_0x236c6b[0x1])||_[_0xd3c6('0x14')](_0x236c6b[0x1])){logger[_0xd3c6('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x26c5b9);_0x1b7e6d[_0xd3c6('0x15')][_0x236c6b[0x1]]=_0x29f18b;}else{logger[_0xd3c6('0xc')](_0xd3c6('0x16'),_0x26c5b9,_0x236c6b[0x1],_0x29f18b);_0x1b7e6d[_0xd3c6('0x15')][_0x236c6b[0x1]]=_0x29f18b;}}_0x5dcebd[_0xd3c6('0x17')]();});}}catch(_0x3bf390){logger[_0xd3c6('0x9')](_0xd3c6('0xa'),_0x26c5b9,_[_0xd3c6('0x18')](_0x3bf390)?JSON[_0xd3c6('0x19')](_0x3bf390):_0x3bf390);logger[_0xd3c6('0xc')](_0xd3c6('0xd'),_0x26c5b9);_0x5dcebd[_0xd3c6('0x17')]();}};}; \ 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 dbbf7c4..ff04b89 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 _0xd38b=['../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','join','next','channel','Interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x3dc2c7,_0x95a9f1){var _0x2a0172=function(_0x12dc9a){while(--_0x12dc9a){_0x3dc2c7['push'](_0x3dc2c7['shift']());}};_0x2a0172(++_0x95a9f1);}(_0xd38b,0x14a));var _0xbd38=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0xd38b[_0x30853f];return _0x3c416d;};'use strict';var schema=require(_0xbd38('0x0'));var _=require(_0xbd38('0x1'));var rpc={'chatInteraction':require(_0xbd38('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xbd38('0x3')),'faxInteraction':require(_0xbd38('0x4')),'whatsappInteraction':require(_0xbd38('0x5'))};var logger=require(_0xbd38('0x6'))('routing');var tag=schema({'tag':{'type':_0xbd38('0x7'),'required':!![],'message':_0xbd38('0x8')}});exports['consequence']=function(_0x38c7d4,_0x41cea7,_0x426c88,_0x36c499){return function(_0x5bd6a5){try{var _0x499d0a={'tag':_0x41cea7[0x0]};var _0x102254=tag['validate'](_0x499d0a,{'typecast':!![]});if(_0x102254[_0xbd38('0x9')]){logger[_0xbd38('0xa')](_0xbd38('0xb'),_0x38c7d4,_[_0xbd38('0xc')](_0x102254,_0xbd38('0xd'))[_0xbd38('0xe')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x38c7d4);_0x5bd6a5[_0xbd38('0xf')]();}else{var _0x26c6c3={'ids':[_0x41cea7[0x0]]};if(rpc[_0x36c499[_0xbd38('0x10')]+_0xbd38('0x11')]){rpc[_0x36c499[_0xbd38('0x10')]+'Interaction']['addTags'](_0x36c499['interaction']['id'],_0x26c6c3)['then'](function(_0x1c4193){logger[_0xbd38('0x12')](_0xbd38('0x13'),_0x38c7d4,_0x41cea7[0x1],_0x36c499[_0xbd38('0x10')],_0x36c499[_0xbd38('0x14')]['id']);})['catch'](function(_0x530500){logger['error']('[%s][TAG]\x20%s',_0x38c7d4,JSON[_0xbd38('0x15')](_0x530500));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x38c7d4);})[_0xbd38('0x16')](function(){_0x5bd6a5[_0xbd38('0xf')]();});}}}catch(_0x562507){logger['error']('[%s][TAG]\x20%s',_0x38c7d4,_[_0xbd38('0x17')](_0x562507)?JSON[_0xbd38('0x15')](_0x562507):_0x562507);logger[_0xbd38('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x38c7d4);_0x5bd6a5[_0xbd38('0xf')]();}};}; \ No newline at end of file +var _0xb417=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','finally','error','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x5b7e20,_0x17cfec){var _0x57eddf=function(_0x486ca0){while(--_0x486ca0){_0x5b7e20['push'](_0x5b7e20['shift']());}};_0x57eddf(++_0x17cfec);}(_0xb417,0x1e0));var _0x7b41=function(_0x41acb9,_0x13d905){_0x41acb9=_0x41acb9-0x0;var _0x4b18ab=_0xb417[_0x41acb9];return _0x4b18ab;};'use strict';var schema=require(_0x7b41('0x0'));var _=require(_0x7b41('0x1'));var rpc={'chatInteraction':require(_0x7b41('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7b41('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7b41('0x4'))};var logger=require(_0x7b41('0x5'))(_0x7b41('0x6'));var tag=schema({'tag':{'type':_0x7b41('0x7'),'required':!![],'message':_0x7b41('0x8')}});exports[_0x7b41('0x9')]=function(_0x17ca6d,_0x3b9d2f,_0x34b4ce,_0x1d87aa){return function(_0x52aadd){try{var _0x2f746e={'tag':_0x3b9d2f[0x0]};var _0x3bcb60=tag[_0x7b41('0x0')](_0x2f746e,{'typecast':!![]});if(_0x3bcb60[_0x7b41('0xa')]){logger['error'](_0x7b41('0xb'),_0x17ca6d,_[_0x7b41('0xc')](_0x3bcb60,_0x7b41('0xd'))[_0x7b41('0xe')](',\x20'));logger[_0x7b41('0xf')](_0x7b41('0x10'),_0x17ca6d);_0x52aadd[_0x7b41('0x11')]();}else{var _0x5ef55a={'ids':[_0x3b9d2f[0x0]]};if(rpc[_0x1d87aa[_0x7b41('0x12')]+_0x7b41('0x13')]){rpc[_0x1d87aa['channel']+'Interaction']['addTags'](_0x1d87aa['interaction']['id'],_0x5ef55a)[_0x7b41('0x14')](function(_0x19b105){logger[_0x7b41('0xf')](_0x7b41('0x15'),_0x17ca6d,_0x3b9d2f[0x1],_0x1d87aa[_0x7b41('0x12')],_0x1d87aa[_0x7b41('0x16')]['id']);})[_0x7b41('0x17')](function(_0xdf40ff){logger['error'](_0x7b41('0xb'),_0x17ca6d,JSON['stringify'](_0xdf40ff));logger[_0x7b41('0xf')](_0x7b41('0x10'),_0x17ca6d);})[_0x7b41('0x18')](function(){_0x52aadd[_0x7b41('0x11')]();});}}}catch(_0x27c638){logger[_0x7b41('0x19')]('[%s][TAG]\x20%s',_0x17ca6d,_['isObject'](_0x27c638)?JSON[_0x7b41('0x1a')](_0x27c638):_0x27c638);logger['info'](_0x7b41('0x10'),_0x17ca6d);_0x52aadd[_0x7b41('0x11')]();}};}; \ 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 5370898..bc2cd96 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 _0x7bcf=['params','stringify','utf8','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stop','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','?params=','urlOnRing','2.0','method','login','push'];(function(_0x5f0a7d,_0x4facf0){var _0xaddb63=function(_0x2a8ad7){while(--_0x2a8ad7){_0x5f0a7d['push'](_0x5f0a7d['shift']());}};_0xaddb63(++_0x4facf0);}(_0x7bcf,0x192));var _0xf7bc=function(_0x170ede,_0x24f180){_0x170ede=_0x170ede-0x0;var _0x5ce974=_0x7bcf[_0x170ede];return _0x5ce974;};'use strict';var rp=require(_0xf7bc('0x0'));var logger=require(_0xf7bc('0x1'))(_0xf7bc('0x2'));var _=require(_0xf7bc('0x3'));var arr=[];exports[_0xf7bc('0x4')]=function(_0x139af,_0x314ba2){return function(_0x3c4b29){var _0x37d222=_0x314ba2[0xa];var _0xef893=_0x314ba2[0xb];var _0x54484c=_0x314ba2[0xc];var _0x4aca5e=_0x314ba2[0xd];var _0x26e6e5=_0x314ba2[0xe];var _0x2ebba4=_0x314ba2[0xf][_0xf7bc('0x5')](/\n/g,_0xf7bc('0x6'));var _0x341b41=_0x314ba2[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xf7bc('0x7')](_0xef893)){arr['push'](_0xef893);var _0x14f88c=_0x314ba2[0x3];var _0xb25dc2=_0x314ba2[0x4];var _0x1e3bac=_0x314ba2[0x1];var _0x183b96=_0x314ba2[0x0];var _0xd9c137={};_0xd9c137['urlOnAnswer']=_0x314ba2[0x8]+_0xf7bc('0x8')+_0x54484c+'|'+_0x37d222+'|'+_0x4aca5e+'|'+_0xef893+'|'+_0x26e6e5;_0xd9c137[_0xf7bc('0x9')]=_0x314ba2[0x7]+_0xf7bc('0x8')+_0x54484c+'|'+_0x37d222+'|'+_0x4aca5e+'|'+_0xef893+'|'+_0x26e6e5+'|'+_0x2ebba4+'|'+_0x341b41;_0xd9c137['title']=_0x314ba2[0x9];var _0x2c0544={};_0x2c0544['jsonrpc']=_0xf7bc('0xa');_0x2c0544[_0xf7bc('0xb')]=_0xf7bc('0xc');var _0x5a01f8=[];_0x5a01f8[_0xf7bc('0xd')](_0x314ba2[0x2]);_0x5a01f8[_0xf7bc('0xd')](_0x314ba2[0x5]);_0x5a01f8[_0xf7bc('0xd')](_0x314ba2[0x6]);_0x2c0544[_0xf7bc('0xe')]=_0x5a01f8;_0x2c0544['id']=0x1;var _0xa758bc=JSON[_0xf7bc('0xf')](_0x2c0544);var _0x12faf0={'encoding':_0xf7bc('0x10'),'method':'POST','timeout':0x2710,'url':_0x14f88c,'headers':{'Content-Type':_0xf7bc('0x11')},'body':_0xa758bc};return rp(_0x12faf0)[_0xf7bc('0x12')](function(_0x3ebc42){const _0x10cc27=JSON['parse'](_0x3ebc42);if(!_0x10cc27[_0xf7bc('0x13')][_0xf7bc('0x14')]){throw new Error(_0xf7bc('0x15'));}var _0x3091dd=_0xef893;var _0x73a569=_0xf7bc('0x16')+_0x1e3bac+_0xf7bc('0x17')+_0x183b96+_0xf7bc('0x18')+_0x3091dd+_0xf7bc('0x19')+JSON[_0xf7bc('0xf')](_0xd9c137);var _0x345b55=_0xb25dc2+'?'+_0x73a569;return rp(_0x345b55);})[_0xf7bc('0x12')](function(_0x5e2c91){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x139af,_0x5e2c91);_0x3c4b29[_0xf7bc('0x1a')]();})['catch'](function(_0x27bd25){logger[_0xf7bc('0x1b')](_0xf7bc('0x1c'),_0x139af,_[_0xf7bc('0x1d')](_0x27bd25)?JSON[_0xf7bc('0xf')](_0x27bd25):_0x27bd25);_0x3c4b29['stop']();});}else{logger['info'](_0xf7bc('0x1e'),_0x139af);_0x3c4b29[_0xf7bc('0x1f')]();}};}; \ No newline at end of file +var _0xc7de=['result','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','jsonrpc','method','login','params','utf8','POST','application/json-rpc','then','parse'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc7de,0x1b0));var _0xec7d=function(_0x83e4d9,_0x3b9bb6){_0x83e4d9=_0x83e4d9-0x0;var _0x36a145=_0xc7de[_0x83e4d9];return _0x36a145;};'use strict';var rp=require(_0xec7d('0x0'));var logger=require('../../../../config/logger')(_0xec7d('0x1'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x38c498,_0x2f9e75){return function(_0x180859){var _0xb41a72=_0x2f9e75[0xa];var _0x1d87dd=_0x2f9e75[0xb];var _0x471ba5=_0x2f9e75[0xc];var _0xb20a77=_0x2f9e75[0xd];var _0x9042bb=_0x2f9e75[0xe];var _0x2ef54d=_0x2f9e75[0xf][_0xec7d('0x2')](/\n/g,_0xec7d('0x3'));var _0x5b6383=_0x2f9e75[0x10][_0xec7d('0x2')](/\n/g,'\x20');if(!arr[_0xec7d('0x4')](_0x1d87dd)){arr[_0xec7d('0x5')](_0x1d87dd);var _0x2a9c71=_0x2f9e75[0x3];var _0x3c986d=_0x2f9e75[0x4];var _0x2639e4=_0x2f9e75[0x1];var _0x4e0738=_0x2f9e75[0x0];var _0x1d5744={};_0x1d5744[_0xec7d('0x6')]=_0x2f9e75[0x8]+'?params='+_0x471ba5+'|'+_0xb41a72+'|'+_0xb20a77+'|'+_0x1d87dd+'|'+_0x9042bb;_0x1d5744[_0xec7d('0x7')]=_0x2f9e75[0x7]+_0xec7d('0x8')+_0x471ba5+'|'+_0xb41a72+'|'+_0xb20a77+'|'+_0x1d87dd+'|'+_0x9042bb+'|'+_0x2ef54d+'|'+_0x5b6383;_0x1d5744['title']=_0x2f9e75[0x9];var _0x1fcc35={};_0x1fcc35[_0xec7d('0x9')]='2.0';_0x1fcc35[_0xec7d('0xa')]=_0xec7d('0xb');var _0xd91ab3=[];_0xd91ab3[_0xec7d('0x5')](_0x2f9e75[0x2]);_0xd91ab3['push'](_0x2f9e75[0x5]);_0xd91ab3[_0xec7d('0x5')](_0x2f9e75[0x6]);_0x1fcc35[_0xec7d('0xc')]=_0xd91ab3;_0x1fcc35['id']=0x1;var _0x5133da=JSON['stringify'](_0x1fcc35);var _0x169265={'encoding':_0xec7d('0xd'),'method':_0xec7d('0xe'),'timeout':0x2710,'url':_0x2a9c71,'headers':{'Content-Type':_0xec7d('0xf')},'body':_0x5133da};return rp(_0x169265)[_0xec7d('0x10')](function(_0x8d4330){const _0x4d26c1=JSON[_0xec7d('0x11')](_0x8d4330);if(!_0x4d26c1[_0xec7d('0x12')]['logged']){throw new Error(_0xec7d('0x13'));}var _0x2ce46e=_0x1d87dd;var _0x119bd7='channelId='+_0x2639e4+'&serviceId='+_0x4e0738+_0xec7d('0x14')+_0x2ce46e+_0xec7d('0x15')+JSON['stringify'](_0x1d5744);var _0x1e2286=_0x3c986d+'?'+_0x119bd7;return rp(_0x1e2286);})[_0xec7d('0x10')](function(_0x307202){logger[_0xec7d('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x38c498,_0x307202);_0x180859[_0xec7d('0x17')]();})[_0xec7d('0x18')](function(_0x140cb7){logger[_0xec7d('0x19')](_0xec7d('0x1a'),_0x38c498,_['isObject'](_0x140cb7)?JSON[_0xec7d('0x1b')](_0x140cb7):_0x140cb7);_0x180859[_0xec7d('0x17')]();});}else{logger[_0xec7d('0x16')](_0xec7d('0x1c'),_0x38c498);_0x180859[_0xec7d('0x1d')]();}};}; \ 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 18b166b..2ad9f4c 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(_0x2ade4b,_0x1fdc0b){var _0x48b21f=function(_0x5b2936){while(--_0x5b2936){_0x2ade4b['push'](_0x2ade4b['shift']());}};_0x48b21f(++_0x1fdc0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5b84b3,_0x38fe0c){var _0x328887=function(_0x40f073){while(--_0x40f073){_0x5b84b3['push'](_0x5b84b3['shift']());}};_0x328887(++_0x38fe0c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index fd0073e..fcb6b9a 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 _0xd4d0=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','lodash','path','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','interaction','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','waiting','mailQueues','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x4e54e9,_0x40a2b7){var _0x32be8f=function(_0x5d91b3){while(--_0x5d91b3){_0x4e54e9['push'](_0x4e54e9['shift']());}};_0x32be8f(++_0x40a2b7);}(_0xd4d0,0x6d));var _0x0d4d=function(_0x2b6a2e,_0x13439a){_0x2b6a2e=_0x2b6a2e-0x0;var _0x2c473c=_0xd4d0[_0x2b6a2e];return _0x2c473c;};'use strict';var _=require(_0x0d4d('0x0'));var util=require('util');var path=require(_0x0d4d('0x1'));var fs=require('fs');var jayson=require(_0x0d4d('0x2'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x0d4d('0x3'));var logger=require(_0x0d4d('0x4'))(_0x0d4d('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0d4d('0x6')),'chatQueueReport':require(_0x0d4d('0x7')),'smsQueueReport':require(_0x0d4d('0x8')),'faxQueueReport':require(_0x0d4d('0x9')),'whatsappQueueReport':require(_0x0d4d('0xa'))};var RuleEngine=require(_0x0d4d('0xb'));function getId(_0x296db5,_0x5c35ef,_0x1ff00b){return util[_0x0d4d('0xc')](_0x0d4d('0xd'),_0x296db5,_0x5c35ef||0x0,_0x1ff00b||0x0);}function getIntervals(_0x64a879,_0x55e76c){var _0x2f96d5=[];if(!_[_0x0d4d('0xe')](_0x55e76c[_0x0d4d('0xf')])&&!_[_0x0d4d('0xe')](_0x64a879[_0x55e76c[_0x0d4d('0xf')]])&&!_['isNil'](_0x64a879[_0x55e76c['IntervalId']][_0x0d4d('0x10')])){_0x2f96d5=_[_0x0d4d('0x11')](_0x64a879[_0x55e76c[_0x0d4d('0xf')]][_0x0d4d('0x10')],_0x0d4d('0x12'));}else if(!_[_0x0d4d('0xe')](_0x55e76c['interval'])){_0x2f96d5=[_0x55e76c['interval']];}return _0x2f96d5;}exports[_0x0d4d('0x13')]=function(_0x4b8014){_0x4b8014[_0x0d4d('0x14')]={};return new BPromise(function(_0x519d46,_0x691728){var _0x3952bc={'Start':function(_0x4abf96){var _0x4ea7a9=this;return new Promise(function(_0x407b85,_0x588827){if(_0x4abf96){try{var _0x3e5494=[];var _0x3269b1=getId(_0x4abf96[_0x0d4d('0x15')],_0x4abf96['message']?_0x4abf96[_0x0d4d('0x16')]['id']:0x0,_0x4abf96['interaction']?_0x4abf96['interaction']['id']:0x0);var _0x2257b3=sUtils[_0x0d4d('0x17')](_0x4b8014,_0x4abf96);if(_0x4abf96[_0x0d4d('0x18')]||!_0x2257b3&&_0x4abf96[_0x0d4d('0x19')]&&_[_0x0d4d('0x1a')](_0x4abf96[_0x0d4d('0x19')])&&_0x4abf96[_0x0d4d('0x19')][_0x0d4d('0x1b')]){for(var _0x1d1b82=0x0;_0x1d1b82<_0x4abf96[_0x0d4d('0x19')]['length'];_0x1d1b82+=0x1){var _0x40d012=_0x4abf96[_0x0d4d('0x19')][_0x1d1b82];if(fs[_0x0d4d('0x1c')](path[_0x0d4d('0x1d')](__dirname,_0x0d4d('0x19'),_0x40d012[_0x0d4d('0x1e')]+_0x0d4d('0x1f')))){var _0x5c0b1a=[];switch(_0x40d012['app']['toLowerCase']()){case _0x0d4d('0x20'):var _0x26749b=_0x40d012[_0x0d4d('0x21')]['split'](',');if(_0x4abf96[_0x0d4d('0x15')]==='mail'){_0x5c0b1a[_0x0d4d('0x22')](_0x26749b[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0x26749b[0x1]);_0x5c0b1a[_0x0d4d('0x22')](_0x26749b[_0x0d4d('0x23')](0x2,_0x26749b['length'])[_0x0d4d('0x1d')](','));}else{_0x5c0b1a['push'](_0x26749b[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0x26749b[_0x0d4d('0x23')](0x1,_0x26749b[_0x0d4d('0x1b')])[_0x0d4d('0x1d')](','));}break;case _0x0d4d('0x24'):var _0x298373=_0x40d012[_0x0d4d('0x21')][_0x0d4d('0x25')](',');_0x5c0b1a['push'](_0x298373[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0x298373[0x1]);_0x5c0b1a[_0x0d4d('0x22')](_0x298373['slice'](0x2,_0x298373[_0x0d4d('0x1b')])[_0x0d4d('0x1d')](','));break;case _0x0d4d('0x26'):var _0xa819c2=_0x40d012[_0x0d4d('0x21')]['split'](',');_0x5c0b1a['push'](_0xa819c2[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0xa819c2[0x1]);_0x5c0b1a['push'](_0xa819c2[0x2]);_0x5c0b1a[_0x0d4d('0x22')](_0xa819c2[0x3]);_0x5c0b1a[_0x0d4d('0x22')](_0xa819c2[_0x0d4d('0x23')](0x4,_0xa819c2[_0x0d4d('0x1b')])[_0x0d4d('0x1d')](','));break;case _0x0d4d('0x27'):var _0x328dc7=_0x40d012['appdata']['split'](',');_0x5c0b1a[_0x0d4d('0x22')](_0x328dc7[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0x328dc7[0x1]);_0x5c0b1a['push'](_0x328dc7[0x2]);_0x5c0b1a[_0x0d4d('0x22')](_0x328dc7[0x3]);_0x5c0b1a[_0x0d4d('0x22')](_0x328dc7['slice'](0x4,_0x328dc7[_0x0d4d('0x1b')])[_0x0d4d('0x1d')](','));break;case _0x0d4d('0x16'):_0x5c0b1a[_0x0d4d('0x22')](_0x40d012[_0x0d4d('0x21')]);break;case _0x0d4d('0x28'):_0x5c0b1a[_0x0d4d('0x22')](_0x40d012[_0x0d4d('0x29')]);_0x5c0b1a['push'](_0x40d012[_0x0d4d('0x21')]);break;case'tvox':var _0x4e17db=utils[_0x0d4d('0x2a')](_0x4abf96[_0x0d4d('0x2b')][_0x0d4d('0x2c')],_0x4abf96);var _0x3f6ae9=_0x40d012[_0x0d4d('0x21')]['split'](',');_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x0]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x1]);_0x5c0b1a['push'](_0x3f6ae9[0x2]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x3]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x4]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x5]);_0x5c0b1a['push'](_0x3f6ae9[0x6]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x7]);_0x5c0b1a['push'](_0x3f6ae9[0x8]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0x9]);_0x5c0b1a[_0x0d4d('0x22')](_0x3f6ae9[0xa]);_0x5c0b1a[_0x0d4d('0x22')](_0x4abf96[_0x0d4d('0x2d')]['id']);_0x5c0b1a['push'](_0x4abf96[_0x0d4d('0x16')]['id']);_0x5c0b1a[_0x0d4d('0x22')](_0x40d012[_0x0d4d('0x2e')]);_0x5c0b1a['push'](_0x4abf96['interaction'][_0x0d4d('0x2f')]);_0x5c0b1a[_0x0d4d('0x22')](_0x4abf96[_0x0d4d('0x30')][_0x0d4d('0x30')]);_0x5c0b1a[_0x0d4d('0x22')](_0x4e17db);break;default:_0x5c0b1a=_[_0x0d4d('0xe')](_0x40d012['appdata'])?[]:_0x40d012[_0x0d4d('0x21')]['split'](',');}var _0x425fdd={'id':util[_0x0d4d('0xc')](_0x0d4d('0x31'),_0x3269b1,_0x40d012['id'],_0x40d012[_0x0d4d('0x1e')]),'condition':require(_0x0d4d('0x32'))[_0x0d4d('0x33')](_0x3269b1,getIntervals(_0x4b8014[_0x0d4d('0x34')],_0x40d012),_0x4b8014),'consequence':require(_0x0d4d('0x35')+_0x40d012[_0x0d4d('0x1e')])[_0x0d4d('0x36')](_0x3269b1,_0x5c0b1a,_0x4b8014,_0x4abf96),'p':_0x40d012[_0x0d4d('0x37')]||0x0};logger[_0x0d4d('0x38')]('Push\x20new\x20rule',_0x425fdd['id'],'on\x20interval',getIntervals(_0x4b8014[_0x0d4d('0x34')],_0x40d012)[_0x0d4d('0x1d')](_0x0d4d('0x39')));_0x3e5494[_0x0d4d('0x22')](_0x425fdd);}else{logger[_0x0d4d('0x3a')](_0x0d4d('0x3b'),path[_0x0d4d('0x1d')](__dirname,'applications',_0x40d012[_0x0d4d('0x1e')]+_0x0d4d('0x1f')));}}_0x4b8014[_0x0d4d('0x14')][_0x3269b1]=new RuleEngine(_0x3e5494);_0x4b8014['rules'][_0x3269b1]['execute'](_0x4abf96,function(_0x2636df){logger[_0x0d4d('0x38')](_0x0d4d('0x3c'),JSON[_0x0d4d('0x3d')](_0x2636df[_0x0d4d('0x3e')]));if(_0x4b8014['rules'][_0x3269b1]){_0x4b8014['rules'][_0x3269b1][_0x0d4d('0x3f')](_0x0d4d('0x40'));}});return _0x407b85({'code':0xc8,'message':_0x4abf96});}else{if(_0x2257b3){logger[_0x0d4d('0x38')](util['format']('Skipped\x20routing\x20for\x20%s',_0x3269b1));}else{logger[_0x0d4d('0x38')](_0x0d4d('0x41'));}return _0x407b85({'code':0xc8,'message':_0x4abf96});}}catch(_0x5f5dcf){logger[_0x0d4d('0x3a')](_0x5f5dcf[_0x0d4d('0x42')]);return _0x588827(_0x4ea7a9[_0x0d4d('0x3a')](0x1f4,_0x5f5dcf));}}return _0x588827(_0x0d4d('0x43'));});},'AcceptMessage':function(_0x29d3f3){var _0x38e891=this;return new Promise(function(_0x24a205,_0x5211f0){if(_0x29d3f3[_0x0d4d('0x44')]&&_0x29d3f3['agent']['id']){if(_0x4b8014[_0x0d4d('0x45')][_0x29d3f3['agent']['id']]){_0x4b8014[_0x0d4d('0x45')][_0x29d3f3[_0x0d4d('0x44')]['id']]['busy']=![];_0x4b8014['agents'][_0x29d3f3['agent']['id']][_0x0d4d('0x46')]=undefined;}}if(_0x29d3f3[_0x0d4d('0x16')]&&_0x29d3f3[_0x0d4d('0x16')]['id']){try{var _0x2f9baa=getId(_0x29d3f3[_0x0d4d('0x15')],_0x29d3f3[_0x0d4d('0x16')]?_0x29d3f3[_0x0d4d('0x16')]['id']:0x0,_0x29d3f3['interaction']?_0x29d3f3[_0x0d4d('0x2d')]['id']:0x0);if(_0x4b8014[_0x0d4d('0x14')][_0x2f9baa]){_0x4b8014[_0x0d4d('0x14')][_0x2f9baa][_0x0d4d('0x3f')](_0x0d4d('0x47'));if(rpc[_0x29d3f3[_0x0d4d('0x15')]+_0x0d4d('0x48')]){rpc[_0x29d3f3[_0x0d4d('0x15')]+_0x0d4d('0x48')]['update'](_0x2f9baa,{'UserId':_0x29d3f3['message'][_0x0d4d('0x49')]})[_0x0d4d('0x4a')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x24a205({'code':0xc8,'message':_0x29d3f3});}catch(_0x32f54a){logger[_0x0d4d('0x3a')](_0x32f54a['stack']);return _0x5211f0(_0x38e891['error'](0x1f4,_0x32f54a));}}logger[_0x0d4d('0x3a')](_0x0d4d('0x4b'));return _0x5211f0(_0x38e891[_0x0d4d('0x3a')](0x1f4,_0x0d4d('0x4b')));});},'RejectMessage':function(_0xc418c){var _0x1b7a7c=this;return new Promise(function(_0x588fc2,_0x422209){if(_0xc418c[_0x0d4d('0x44')]&&_0xc418c['agent']['id']){try{if(_0x4b8014[_0x0d4d('0x45')][_0xc418c[_0x0d4d('0x44')]['id']]){_0x4b8014[_0x0d4d('0x45')][_0xc418c[_0x0d4d('0x44')]['id']][_0x0d4d('0x4c')]=![];_0x4b8014['agents'][_0xc418c[_0x0d4d('0x44')]['id']]['busyQueue']=undefined;}return _0x588fc2({'code':0xc8,'message':_0xc418c});}catch(_0x3d7b37){logger['error'](_0x3d7b37['stack']);return _0x422209(_0x1b7a7c[_0x0d4d('0x3a')](0x1f4,_0x3d7b37));}}logger[_0x0d4d('0x3a')](_0x0d4d('0x4b'));return _0x422209(_0x1b7a7c[_0x0d4d('0x3a')](0x1f4,_0x0d4d('0x4b')));});},'AbandonInteraction':function(_0x9b2ea8){var _0x259507=this;return new Promise(function(_0x503eb9,_0x1592c6){if(_0x9b2ea8[_0x0d4d('0x15')]&&_0x9b2ea8['interaction']&&_0x9b2ea8[_0x0d4d('0x2d')]['id']){try{var _0xd52b76=getId(_0x9b2ea8[_0x0d4d('0x15')],_0x9b2ea8[_0x0d4d('0x16')]?_0x9b2ea8[_0x0d4d('0x16')]['id']:0x0,_0x9b2ea8[_0x0d4d('0x2d')]?_0x9b2ea8[_0x0d4d('0x2d')]['id']:0x0);if(_0x4b8014['rules'][_0xd52b76]){_0x4b8014[_0x0d4d('0x14')][_0xd52b76][_0x0d4d('0x3f')](_0x0d4d('0x47'));}return _0x503eb9({'code':0xc8,'message':_0x9b2ea8});}catch(_0xa5a6f2){logger[_0x0d4d('0x3a')](_0xa5a6f2[_0x0d4d('0x42')]);return _0x1592c6(_0x259507['error'](0x1f4,_0xa5a6f2));}}logger[_0x0d4d('0x3a')](_0x0d4d('0x4b'));return _0x1592c6(_0x259507[_0x0d4d('0x3a')](0x1f4,_0x0d4d('0x4b')));});},'AgentCapacity':function(_0x333eea){var _0x19b5c7=this;return new Promise(function(_0x167015,_0x5364dd){if(_0x4b8014['agents'][_0x0d4d('0x4d')](_0x333eea['id'])){for(var _0x3ac035 in _0x333eea[_0x0d4d('0x4e')]){if(_0x333eea[_0x0d4d('0x4e')][_0x0d4d('0x4d')](_0x3ac035)){if(_0x4b8014['agents'][_0x333eea['id']][_0x0d4d('0x4d')](_0x3ac035+_0x0d4d('0x4f'))){_0x4b8014[_0x0d4d('0x45')][_0x333eea['id']][_0x3ac035+_0x0d4d('0x4f')]=parseInt(_0x333eea['capacity'][_0x3ac035],0xa);}}}_0x4b8014[_0x0d4d('0x45')][_0x333eea['id']]['updateRealtime']();return _0x167015({'code':0xc8,'message':_0x4b8014[_0x0d4d('0x45')][_0x333eea['id']]});}else{return _0x5364dd(_0x19b5c7[_0x0d4d('0x3a')](0x1f4,_0x0d4d('0x50')));}});},'Agents':function(_0x5a5406){return new Promise(function(_0x15c027){var _0x353581=_[_0x0d4d('0x51')](_0x4b8014[_0x0d4d('0x45')]);if(_0x5a5406&&_0x5a5406['id']){var _0x50197a=_[_0x0d4d('0x52')](_0x353581,function(_0x2307aa){return _0x2307aa['id']===_0x5a5406['id'];});_0x15c027(_0x50197a);}else{_0x15c027({'count':_0x353581[_0x0d4d('0x1b')],'rows':_0x353581});}});},'ChatQueues':function(){return new Promise(function(_0x1fe4fa){var _0x201f7e=[];for(var _0x5146c4 in _0x4b8014['chatQueues']){if(_0x4b8014[_0x0d4d('0x53')][_0x0d4d('0x4d')](_0x5146c4)){var _0xc112d5=_0x4b8014[_0x0d4d('0x53')][_0x5146c4];var _0x288366={'id':_0xc112d5['id'],'available':_0xc112d5[_0x0d4d('0x54')],'loggedIn':_0xc112d5[_0x0d4d('0x55')],'name':_0xc112d5['name'],'paused':_0xc112d5['paused'],'waiting':_0xc112d5[_0x0d4d('0x56')]};_0x201f7e[_0x0d4d('0x22')](_0x288366);}}_0x1fe4fa({'count':_0x201f7e[_0x0d4d('0x1b')],'rows':_0x201f7e});});},'MailQueues':function(){return new Promise(function(_0x572dfd){var _0x56a8ff=[];for(var _0x56e5b2 in _0x4b8014[_0x0d4d('0x57')]){if(_0x4b8014['mailQueues'][_0x0d4d('0x4d')](_0x56e5b2)){var _0x43e2e5=_0x4b8014['mailQueues'][_0x56e5b2];var _0x48ac68={'id':_0x43e2e5['id'],'available':_0x43e2e5['available'],'loggedIn':_0x43e2e5[_0x0d4d('0x55')],'name':_0x43e2e5['name'],'paused':_0x43e2e5['paused'],'waiting':_0x43e2e5[_0x0d4d('0x56')]};_0x56a8ff[_0x0d4d('0x22')](_0x48ac68);}}_0x572dfd({'count':_0x56a8ff[_0x0d4d('0x1b')],'rows':_0x56a8ff});});},'OpenchannelQueues':function(){return new Promise(function(_0x796e9f){var _0x234d04=[];for(var _0x4ae9a9 in _0x4b8014['openchannelQueues']){if(_0x4b8014[_0x0d4d('0x58')][_0x0d4d('0x4d')](_0x4ae9a9)){var _0x1b9464=_0x4b8014[_0x0d4d('0x58')][_0x4ae9a9];var _0x488a42={'id':_0x1b9464['id'],'available':_0x1b9464[_0x0d4d('0x54')],'loggedIn':_0x1b9464['loggedIn'],'name':_0x1b9464[_0x0d4d('0x59')],'paused':_0x1b9464[_0x0d4d('0x5a')],'waiting':_0x1b9464[_0x0d4d('0x56')]};_0x234d04['push'](_0x488a42);}}_0x796e9f({'count':_0x234d04[_0x0d4d('0x1b')],'rows':_0x234d04});});},'SmsQueues':function(){return new Promise(function(_0x215d43){var _0x5799a6=[];for(var _0x1ac68b in _0x4b8014[_0x0d4d('0x5b')]){if(_0x4b8014[_0x0d4d('0x5b')][_0x0d4d('0x4d')](_0x1ac68b)){var _0x18da86=_0x4b8014[_0x0d4d('0x5b')][_0x1ac68b];var _0x14fa7c={'id':_0x18da86['id'],'available':_0x18da86['available'],'loggedIn':_0x18da86[_0x0d4d('0x55')],'name':_0x18da86['name'],'paused':_0x18da86['paused'],'waiting':_0x18da86[_0x0d4d('0x56')]};_0x5799a6[_0x0d4d('0x22')](_0x14fa7c);}}_0x215d43({'count':_0x5799a6[_0x0d4d('0x1b')],'rows':_0x5799a6});});},'FaxQueues':function(){return new Promise(function(_0x2eb040){var _0x405619=[];for(var _0x50ae15 in _0x4b8014['faxQueues']){if(_0x4b8014[_0x0d4d('0x5c')][_0x0d4d('0x4d')](_0x50ae15)){var _0x3f4841=_0x4b8014[_0x0d4d('0x5c')][_0x50ae15];var _0x1248b0={'id':_0x3f4841['id'],'available':_0x3f4841[_0x0d4d('0x54')],'loggedIn':_0x3f4841[_0x0d4d('0x55')],'name':_0x3f4841[_0x0d4d('0x59')],'paused':_0x3f4841[_0x0d4d('0x5a')],'waiting':_0x3f4841[_0x0d4d('0x56')]};_0x405619[_0x0d4d('0x22')](_0x1248b0);}}_0x2eb040({'count':_0x405619[_0x0d4d('0x1b')],'rows':_0x405619});});},'WhatsappQueues':function(){return new Promise(function(_0x5212f4){var _0x3b53e9=[];for(var _0x11074b in _0x4b8014[_0x0d4d('0x5d')]){if(_0x4b8014[_0x0d4d('0x5d')][_0x0d4d('0x4d')](_0x11074b)){var _0x457b87=_0x4b8014[_0x0d4d('0x5d')][_0x11074b];var _0x43fb50={'id':_0x457b87['id'],'available':_0x457b87['available'],'loggedIn':_0x457b87['loggedIn'],'name':_0x457b87[_0x0d4d('0x59')],'paused':_0x457b87[_0x0d4d('0x5a')],'waiting':_0x457b87['waiting']};_0x3b53e9[_0x0d4d('0x22')](_0x43fb50);}}_0x5212f4({'count':_0x3b53e9[_0x0d4d('0x1b')],'rows':_0x3b53e9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x19c7d6){var _0x1ce74b=_[_0x0d4d('0x51')](_0x4b8014[_0x0d4d('0x5e')]);_0x19c7d6({'count':_0x1ce74b['length'],'rows':_0x1ce74b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1ae40b){var _0x10a0c0=_[_0x0d4d('0x51')](_0x4b8014['mailQueuesWaitingInteractions']);_0x1ae40b({'count':_0x10a0c0[_0x0d4d('0x1b')],'rows':_0x10a0c0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1b88b0){var _0x49acab=_[_0x0d4d('0x51')](_0x4b8014[_0x0d4d('0x5f')]);_0x1b88b0({'count':_0x49acab['length'],'rows':_0x49acab});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4e8532){var _0x134fa8=_[_0x0d4d('0x51')](_0x4b8014[_0x0d4d('0x60')]);_0x4e8532({'count':_0x134fa8['length'],'rows':_0x134fa8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1b7352){var _0x3a9191=_[_0x0d4d('0x51')](_0x4b8014[_0x0d4d('0x61')]);_0x1b7352({'count':_0x3a9191[_0x0d4d('0x1b')],'rows':_0x3a9191});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x17825a){var _0x2dc069=_['values'](_0x4b8014[_0x0d4d('0x62')]);_0x17825a({'count':_0x2dc069['length'],'rows':_0x2dc069});});}};var _0x323445=jayson[_0x0d4d('0x63')](_0x3952bc)[_0x0d4d('0x64')]();_0x323445['on'](_0x0d4d('0x3a'),function(_0x277dee){logger[_0x0d4d('0x3a')](JSON[_0x0d4d('0x3d')](_0x277dee));return _0x691728(_0x277dee);});_0x323445[_0x0d4d('0x13')](0x232c,_0x0d4d('0x65'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x519d46('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x5c3c=['smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','.js','toLowerCase','appdata','split','push','slice','amazonlex','tag','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','format','%s:%s:%s','./interval','condition','./applications/','consequence','priority','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','matchPath','emit','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x1f5249,_0x5c4c86){var _0x20e223=function(_0x15eb45){while(--_0x15eb45){_0x1f5249['push'](_0x1f5249['shift']());}};_0x20e223(++_0x5c4c86);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x5c3c[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var fs=require('fs');var jayson=require(_0xc5c3('0x3'));var BPromise=require('bluebird');var utils=require(_0xc5c3('0x4'));var sUtils=require(_0xc5c3('0x5'));var logger=require(_0xc5c3('0x6'))(_0xc5c3('0x7'));var rpc={'openchannelQueueReport':require(_0xc5c3('0x8')),'mailQueueReport':require(_0xc5c3('0x9')),'chatQueueReport':require(_0xc5c3('0xa')),'smsQueueReport':require(_0xc5c3('0xb')),'faxQueueReport':require(_0xc5c3('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x591f7d,_0x723c31,_0x522be1){return util['format'](_0xc5c3('0xd'),_0x591f7d,_0x723c31||0x0,_0x522be1||0x0);}function getIntervals(_0x46e2c1,_0x52f3eb){var _0x14140f=[];if(!_[_0xc5c3('0xe')](_0x52f3eb['IntervalId'])&&!_[_0xc5c3('0xe')](_0x46e2c1[_0x52f3eb[_0xc5c3('0xf')]])&&!_[_0xc5c3('0xe')](_0x46e2c1[_0x52f3eb['IntervalId']][_0xc5c3('0x10')])){_0x14140f=_[_0xc5c3('0x11')](_0x46e2c1[_0x52f3eb['IntervalId']][_0xc5c3('0x10')],_0xc5c3('0x12'));}else if(!_[_0xc5c3('0xe')](_0x52f3eb['interval'])){_0x14140f=[_0x52f3eb[_0xc5c3('0x12')]];}return _0x14140f;}exports[_0xc5c3('0x13')]=function(_0x1488ab){_0x1488ab[_0xc5c3('0x14')]={};return new BPromise(function(_0xc8a636,_0x5f34bb){var _0x5c0341={'Start':function(_0x4445ea){var _0x577e1a=this;return new Promise(function(_0x1bae87,_0xef8b21){if(_0x4445ea){try{var _0x5ecd4b=[];var _0x4ff2de=getId(_0x4445ea[_0xc5c3('0x15')],_0x4445ea['message']?_0x4445ea[_0xc5c3('0x16')]['id']:0x0,_0x4445ea[_0xc5c3('0x17')]?_0x4445ea[_0xc5c3('0x17')]['id']:0x0);var _0x13c867=sUtils[_0xc5c3('0x18')](_0x1488ab,_0x4445ea);if(_0x4445ea['transfer']||!_0x13c867&&_0x4445ea[_0xc5c3('0x19')]&&_[_0xc5c3('0x1a')](_0x4445ea[_0xc5c3('0x19')])&&_0x4445ea[_0xc5c3('0x19')]['length']){for(var _0x25ef16=0x0;_0x25ef16<_0x4445ea[_0xc5c3('0x19')][_0xc5c3('0x1b')];_0x25ef16+=0x1){var _0x3ca20a=_0x4445ea[_0xc5c3('0x19')][_0x25ef16];if(fs['existsSync'](path[_0xc5c3('0x1c')](__dirname,_0xc5c3('0x19'),_0x3ca20a[_0xc5c3('0x1d')]+_0xc5c3('0x1e')))){var _0x1c5793=[];switch(_0x3ca20a[_0xc5c3('0x1d')][_0xc5c3('0x1f')]()){case'autoreply':var _0x52d638=_0x3ca20a[_0xc5c3('0x20')][_0xc5c3('0x21')](',');if(_0x4445ea['channel']==='mail'){_0x1c5793[_0xc5c3('0x22')](_0x52d638[0x0]);_0x1c5793[_0xc5c3('0x22')](_0x52d638[0x1]);_0x1c5793[_0xc5c3('0x22')](_0x52d638['slice'](0x2,_0x52d638['length'])[_0xc5c3('0x1c')](','));}else{_0x1c5793[_0xc5c3('0x22')](_0x52d638[0x0]);_0x1c5793[_0xc5c3('0x22')](_0x52d638[_0xc5c3('0x23')](0x1,_0x52d638['length'])[_0xc5c3('0x1c')](','));}break;case'dialogflow':var _0x2eacec=_0x3ca20a['appdata'][_0xc5c3('0x21')](',');_0x1c5793[_0xc5c3('0x22')](_0x2eacec[0x0]);_0x1c5793[_0xc5c3('0x22')](_0x2eacec[0x1]);_0x1c5793[_0xc5c3('0x22')](_0x2eacec[_0xc5c3('0x23')](0x2,_0x2eacec[_0xc5c3('0x1b')])[_0xc5c3('0x1c')](','));break;case'dialogflowv2':var _0xbcafd6=_0x3ca20a['appdata'][_0xc5c3('0x21')](',');_0x1c5793[_0xc5c3('0x22')](_0xbcafd6[0x0]);_0x1c5793['push'](_0xbcafd6[0x1]);_0x1c5793['push'](_0xbcafd6[0x2]);_0x1c5793[_0xc5c3('0x22')](_0xbcafd6[0x3]);_0x1c5793[_0xc5c3('0x22')](_0xbcafd6[_0xc5c3('0x23')](0x4,_0xbcafd6[_0xc5c3('0x1b')])['join'](','));break;case _0xc5c3('0x24'):var _0x24aa70=_0x3ca20a[_0xc5c3('0x20')][_0xc5c3('0x21')](',');_0x1c5793[_0xc5c3('0x22')](_0x24aa70[0x0]);_0x1c5793[_0xc5c3('0x22')](_0x24aa70[0x1]);_0x1c5793[_0xc5c3('0x22')](_0x24aa70[0x2]);_0x1c5793[_0xc5c3('0x22')](_0x24aa70[0x3]);_0x1c5793[_0xc5c3('0x22')](_0x24aa70['slice'](0x4,_0x24aa70[_0xc5c3('0x1b')])[_0xc5c3('0x1c')](','));break;case _0xc5c3('0x16'):_0x1c5793[_0xc5c3('0x22')](_0x3ca20a[_0xc5c3('0x20')]);break;case _0xc5c3('0x25'):_0x1c5793[_0xc5c3('0x22')](_0x3ca20a['TagId']);_0x1c5793['push'](_0x3ca20a[_0xc5c3('0x20')]);break;case'tvox':var _0x2b8d5c=utils[_0xc5c3('0x26')](_0x4445ea[_0xc5c3('0x27')][_0xc5c3('0x28')],_0x4445ea);var _0x32df1e=_0x3ca20a['appdata'][_0xc5c3('0x21')](',');_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x0]);_0x1c5793['push'](_0x32df1e[0x1]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x2]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x3]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x4]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x5]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x6]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x7]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x8]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0x9]);_0x1c5793[_0xc5c3('0x22')](_0x32df1e[0xa]);_0x1c5793[_0xc5c3('0x22')](_0x4445ea['interaction']['id']);_0x1c5793[_0xc5c3('0x22')](_0x4445ea['message']['id']);_0x1c5793['push'](_0x3ca20a[_0xc5c3('0x29')]);_0x1c5793[_0xc5c3('0x22')](_0x4445ea[_0xc5c3('0x17')][_0xc5c3('0x2a')]);_0x1c5793[_0xc5c3('0x22')](_0x4445ea['body']['body']);_0x1c5793[_0xc5c3('0x22')](_0x2b8d5c);break;default:_0x1c5793=_[_0xc5c3('0xe')](_0x3ca20a['appdata'])?[]:_0x3ca20a[_0xc5c3('0x20')]['split'](',');}var _0x40d1bc={'id':util[_0xc5c3('0x2b')](_0xc5c3('0x2c'),_0x4ff2de,_0x3ca20a['id'],_0x3ca20a['app']),'condition':require(_0xc5c3('0x2d'))[_0xc5c3('0x2e')](_0x4ff2de,getIntervals(_0x1488ab['intervals'],_0x3ca20a),_0x1488ab),'consequence':require(_0xc5c3('0x2f')+_0x3ca20a['app'])[_0xc5c3('0x30')](_0x4ff2de,_0x1c5793,_0x1488ab,_0x4445ea),'p':_0x3ca20a[_0xc5c3('0x31')]||0x0};logger['info']('Push\x20new\x20rule',_0x40d1bc['id'],'on\x20interval',getIntervals(_0x1488ab[_0xc5c3('0x32')],_0x3ca20a)[_0xc5c3('0x1c')]('\x20|\x20'));_0x5ecd4b[_0xc5c3('0x22')](_0x40d1bc);}else{logger[_0xc5c3('0x33')](_0xc5c3('0x34'),path[_0xc5c3('0x1c')](__dirname,'applications',_0x3ca20a[_0xc5c3('0x1d')]+'.js'));}}_0x1488ab['rules'][_0x4ff2de]=new RuleEngine(_0x5ecd4b);_0x1488ab[_0xc5c3('0x14')][_0x4ff2de][_0xc5c3('0x35')](_0x4445ea,function(_0x55be1d){logger[_0xc5c3('0x36')](_0xc5c3('0x37'),JSON['stringify'](_0x55be1d[_0xc5c3('0x38')]));if(_0x1488ab['rules'][_0x4ff2de]){_0x1488ab[_0xc5c3('0x14')][_0x4ff2de][_0xc5c3('0x39')]('complete');}});return _0x1bae87({'code':0xc8,'message':_0x4445ea});}else{if(_0x13c867){logger[_0xc5c3('0x36')](util['format'](_0xc5c3('0x3a'),_0x4ff2de));}else{logger[_0xc5c3('0x36')]('No\x20applications\x20to\x20execute');}return _0x1bae87({'code':0xc8,'message':_0x4445ea});}}catch(_0x1b10f4){logger[_0xc5c3('0x33')](_0x1b10f4[_0xc5c3('0x3b')]);return _0xef8b21(_0x577e1a[_0xc5c3('0x33')](0x1f4,_0x1b10f4));}}return _0xef8b21(_0xc5c3('0x3c'));});},'AcceptMessage':function(_0x41dca5){var _0x5427b7=this;return new Promise(function(_0x3e658b,_0xf13d81){if(_0x41dca5[_0xc5c3('0x3d')]&&_0x41dca5[_0xc5c3('0x3d')]['id']){if(_0x1488ab[_0xc5c3('0x3e')][_0x41dca5['agent']['id']]){_0x1488ab['agents'][_0x41dca5[_0xc5c3('0x3d')]['id']][_0xc5c3('0x3f')]=![];_0x1488ab[_0xc5c3('0x3e')][_0x41dca5['agent']['id']][_0xc5c3('0x40')]=undefined;}}if(_0x41dca5[_0xc5c3('0x16')]&&_0x41dca5[_0xc5c3('0x16')]['id']){try{var _0x1a150a=getId(_0x41dca5[_0xc5c3('0x15')],_0x41dca5[_0xc5c3('0x16')]?_0x41dca5[_0xc5c3('0x16')]['id']:0x0,_0x41dca5['interaction']?_0x41dca5[_0xc5c3('0x17')]['id']:0x0);if(_0x1488ab[_0xc5c3('0x14')][_0x1a150a]){_0x1488ab[_0xc5c3('0x14')][_0x1a150a]['emit'](_0xc5c3('0x41'));if(rpc[_0x41dca5[_0xc5c3('0x15')]+_0xc5c3('0x42')]){rpc[_0x41dca5[_0xc5c3('0x15')]+_0xc5c3('0x42')]['update'](_0x1a150a,{'UserId':_0x41dca5[_0xc5c3('0x16')]['UserId']})[_0xc5c3('0x43')](function(){logger['error'](_0xc5c3('0x44'));});}}return _0x3e658b({'code':0xc8,'message':_0x41dca5});}catch(_0x34a2c3){logger[_0xc5c3('0x33')](_0x34a2c3[_0xc5c3('0x3b')]);return _0xf13d81(_0x5427b7[_0xc5c3('0x33')](0x1f4,_0x34a2c3));}}logger['error'](_0xc5c3('0x45'));return _0xf13d81(_0x5427b7[_0xc5c3('0x33')](0x1f4,_0xc5c3('0x45')));});},'RejectMessage':function(_0x2baaf6){var _0x453a73=this;return new Promise(function(_0x57c4a3,_0x3b9e91){if(_0x2baaf6[_0xc5c3('0x3d')]&&_0x2baaf6[_0xc5c3('0x3d')]['id']){try{if(_0x1488ab['agents'][_0x2baaf6[_0xc5c3('0x3d')]['id']]){_0x1488ab['agents'][_0x2baaf6['agent']['id']][_0xc5c3('0x3f')]=![];_0x1488ab[_0xc5c3('0x3e')][_0x2baaf6[_0xc5c3('0x3d')]['id']][_0xc5c3('0x40')]=undefined;}return _0x57c4a3({'code':0xc8,'message':_0x2baaf6});}catch(_0x45e79a){logger[_0xc5c3('0x33')](_0x45e79a['stack']);return _0x3b9e91(_0x453a73[_0xc5c3('0x33')](0x1f4,_0x45e79a));}}logger[_0xc5c3('0x33')](_0xc5c3('0x45'));return _0x3b9e91(_0x453a73[_0xc5c3('0x33')](0x1f4,_0xc5c3('0x45')));});},'AbandonInteraction':function(_0x1beb06){var _0x3c3c50=this;return new Promise(function(_0x524aff,_0x59e765){if(_0x1beb06[_0xc5c3('0x15')]&&_0x1beb06[_0xc5c3('0x17')]&&_0x1beb06['interaction']['id']){try{var _0x3f1788=getId(_0x1beb06[_0xc5c3('0x15')],_0x1beb06[_0xc5c3('0x16')]?_0x1beb06[_0xc5c3('0x16')]['id']:0x0,_0x1beb06['interaction']?_0x1beb06[_0xc5c3('0x17')]['id']:0x0);if(_0x1488ab[_0xc5c3('0x14')][_0x3f1788]){_0x1488ab[_0xc5c3('0x14')][_0x3f1788][_0xc5c3('0x39')](_0xc5c3('0x41'));}return _0x524aff({'code':0xc8,'message':_0x1beb06});}catch(_0x36420a){logger[_0xc5c3('0x33')](_0x36420a[_0xc5c3('0x3b')]);return _0x59e765(_0x3c3c50[_0xc5c3('0x33')](0x1f4,_0x36420a));}}logger['error'](_0xc5c3('0x45'));return _0x59e765(_0x3c3c50[_0xc5c3('0x33')](0x1f4,_0xc5c3('0x45')));});},'AgentCapacity':function(_0x5a36f8){var _0x180e01=this;return new Promise(function(_0x939ee1,_0x18adc4){if(_0x1488ab[_0xc5c3('0x3e')][_0xc5c3('0x46')](_0x5a36f8['id'])){for(var _0x5067ed in _0x5a36f8[_0xc5c3('0x47')]){if(_0x5a36f8[_0xc5c3('0x47')][_0xc5c3('0x46')](_0x5067ed)){if(_0x1488ab[_0xc5c3('0x3e')][_0x5a36f8['id']][_0xc5c3('0x46')](_0x5067ed+_0xc5c3('0x48'))){_0x1488ab[_0xc5c3('0x3e')][_0x5a36f8['id']][_0x5067ed+'CurrentCapacity']=parseInt(_0x5a36f8[_0xc5c3('0x47')][_0x5067ed],0xa);}}}_0x1488ab[_0xc5c3('0x3e')][_0x5a36f8['id']][_0xc5c3('0x49')]();return _0x939ee1({'code':0xc8,'message':_0x1488ab[_0xc5c3('0x3e')][_0x5a36f8['id']]});}else{return _0x18adc4(_0x180e01[_0xc5c3('0x33')](0x1f4,_0xc5c3('0x4a')));}});},'Agents':function(_0x4767d4){return new Promise(function(_0x5b9013){var _0x485ae9=_[_0xc5c3('0x4b')](_0x1488ab[_0xc5c3('0x3e')]);if(_0x4767d4&&_0x4767d4['id']){var _0x1e7e4d=_[_0xc5c3('0x4c')](_0x485ae9,function(_0x1ed757){return _0x1ed757['id']===_0x4767d4['id'];});_0x5b9013(_0x1e7e4d);}else{_0x5b9013({'count':_0x485ae9[_0xc5c3('0x1b')],'rows':_0x485ae9});}});},'ChatQueues':function(){return new Promise(function(_0x17520e){var _0x2cdd7a=[];for(var _0x385b39 in _0x1488ab['chatQueues']){if(_0x1488ab[_0xc5c3('0x4d')][_0xc5c3('0x46')](_0x385b39)){var _0x578843=_0x1488ab['chatQueues'][_0x385b39];var _0x10c4d1={'id':_0x578843['id'],'available':_0x578843[_0xc5c3('0x4e')],'loggedIn':_0x578843[_0xc5c3('0x4f')],'name':_0x578843[_0xc5c3('0x50')],'paused':_0x578843[_0xc5c3('0x51')],'waiting':_0x578843[_0xc5c3('0x52')]};_0x2cdd7a[_0xc5c3('0x22')](_0x10c4d1);}}_0x17520e({'count':_0x2cdd7a[_0xc5c3('0x1b')],'rows':_0x2cdd7a});});},'MailQueues':function(){return new Promise(function(_0x325475){var _0x5b2c46=[];for(var _0x429fcb in _0x1488ab[_0xc5c3('0x53')]){if(_0x1488ab[_0xc5c3('0x53')][_0xc5c3('0x46')](_0x429fcb)){var _0xf23177=_0x1488ab[_0xc5c3('0x53')][_0x429fcb];var _0x183f6b={'id':_0xf23177['id'],'available':_0xf23177[_0xc5c3('0x4e')],'loggedIn':_0xf23177[_0xc5c3('0x4f')],'name':_0xf23177[_0xc5c3('0x50')],'paused':_0xf23177[_0xc5c3('0x51')],'waiting':_0xf23177['waiting']};_0x5b2c46['push'](_0x183f6b);}}_0x325475({'count':_0x5b2c46[_0xc5c3('0x1b')],'rows':_0x5b2c46});});},'OpenchannelQueues':function(){return new Promise(function(_0xcf6fc0){var _0x6281e5=[];for(var _0x1951a5 in _0x1488ab[_0xc5c3('0x54')]){if(_0x1488ab[_0xc5c3('0x54')][_0xc5c3('0x46')](_0x1951a5)){var _0x3c916b=_0x1488ab[_0xc5c3('0x54')][_0x1951a5];var _0x473524={'id':_0x3c916b['id'],'available':_0x3c916b[_0xc5c3('0x4e')],'loggedIn':_0x3c916b[_0xc5c3('0x4f')],'name':_0x3c916b['name'],'paused':_0x3c916b[_0xc5c3('0x51')],'waiting':_0x3c916b['waiting']};_0x6281e5[_0xc5c3('0x22')](_0x473524);}}_0xcf6fc0({'count':_0x6281e5[_0xc5c3('0x1b')],'rows':_0x6281e5});});},'SmsQueues':function(){return new Promise(function(_0x3743c7){var _0x22dc0a=[];for(var _0x15ba91 in _0x1488ab[_0xc5c3('0x55')]){if(_0x1488ab[_0xc5c3('0x55')][_0xc5c3('0x46')](_0x15ba91)){var _0x4813a0=_0x1488ab[_0xc5c3('0x55')][_0x15ba91];var _0x72dd80={'id':_0x4813a0['id'],'available':_0x4813a0[_0xc5c3('0x4e')],'loggedIn':_0x4813a0['loggedIn'],'name':_0x4813a0['name'],'paused':_0x4813a0[_0xc5c3('0x51')],'waiting':_0x4813a0['waiting']};_0x22dc0a[_0xc5c3('0x22')](_0x72dd80);}}_0x3743c7({'count':_0x22dc0a[_0xc5c3('0x1b')],'rows':_0x22dc0a});});},'FaxQueues':function(){return new Promise(function(_0x1d926c){var _0x5f42d5=[];for(var _0x27e484 in _0x1488ab['faxQueues']){if(_0x1488ab['faxQueues'][_0xc5c3('0x46')](_0x27e484)){var _0xc8e606=_0x1488ab[_0xc5c3('0x56')][_0x27e484];var _0x2f40e9={'id':_0xc8e606['id'],'available':_0xc8e606[_0xc5c3('0x4e')],'loggedIn':_0xc8e606['loggedIn'],'name':_0xc8e606[_0xc5c3('0x50')],'paused':_0xc8e606['paused'],'waiting':_0xc8e606[_0xc5c3('0x52')]};_0x5f42d5[_0xc5c3('0x22')](_0x2f40e9);}}_0x1d926c({'count':_0x5f42d5[_0xc5c3('0x1b')],'rows':_0x5f42d5});});},'WhatsappQueues':function(){return new Promise(function(_0x362c15){var _0xdc6c06=[];for(var _0x4fc5f4 in _0x1488ab['whatsappQueues']){if(_0x1488ab['whatsappQueues'][_0xc5c3('0x46')](_0x4fc5f4)){var _0x40b74f=_0x1488ab[_0xc5c3('0x57')][_0x4fc5f4];var _0x510dcc={'id':_0x40b74f['id'],'available':_0x40b74f[_0xc5c3('0x4e')],'loggedIn':_0x40b74f[_0xc5c3('0x4f')],'name':_0x40b74f['name'],'paused':_0x40b74f[_0xc5c3('0x51')],'waiting':_0x40b74f['waiting']};_0xdc6c06[_0xc5c3('0x22')](_0x510dcc);}}_0x362c15({'count':_0xdc6c06[_0xc5c3('0x1b')],'rows':_0xdc6c06});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xb11705){var _0x41c1e0=_['values'](_0x1488ab[_0xc5c3('0x58')]);_0xb11705({'count':_0x41c1e0[_0xc5c3('0x1b')],'rows':_0x41c1e0});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x370a03){var _0x2bd0ac=_[_0xc5c3('0x4b')](_0x1488ab[_0xc5c3('0x59')]);_0x370a03({'count':_0x2bd0ac[_0xc5c3('0x1b')],'rows':_0x2bd0ac});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1f36f8){var _0x5b15ca=_['values'](_0x1488ab['openchannelQueuesWaitingInteractions']);_0x1f36f8({'count':_0x5b15ca['length'],'rows':_0x5b15ca});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x326bee){var _0x420e49=_[_0xc5c3('0x4b')](_0x1488ab[_0xc5c3('0x5a')]);_0x326bee({'count':_0x420e49[_0xc5c3('0x1b')],'rows':_0x420e49});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x24b5af){var _0x1109e2=_[_0xc5c3('0x4b')](_0x1488ab[_0xc5c3('0x5b')]);_0x24b5af({'count':_0x1109e2['length'],'rows':_0x1109e2});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1c2acc){var _0x1beb7c=_[_0xc5c3('0x4b')](_0x1488ab[_0xc5c3('0x5c')]);_0x1c2acc({'count':_0x1beb7c[_0xc5c3('0x1b')],'rows':_0x1beb7c});});}};var _0x258e36=jayson[_0xc5c3('0x5d')](_0x5c0341)['http']();_0x258e36['on']('error',function(_0x1c4500){logger[_0xc5c3('0x33')](JSON[_0xc5c3('0x5e')](_0x1c4500));return _0x5f34bb(_0x1c4500);});_0x258e36[_0xc5c3('0x13')](0x232c,_0xc5c3('0x5f'),function(){console[_0xc5c3('0x60')](_0xc5c3('0x61'),0x232c);return _0xc8a636(_0xc5c3('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 359ab15..f1c75e1 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 _0x3b64=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','then','true','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','bluebird','lodash','../../../config/logger','routing','http','message','catch'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x3b64,0x10c));var _0x43b6=function(_0x336758,_0x199933){_0x336758=_0x336758-0x0;var _0x17b7f2=_0x3b64[_0x336758];return _0x17b7f2;};'use strict';var util=require('util');var BPromise=require(_0x43b6('0x0'));var jayson=require('jayson/promise');var _=require(_0x43b6('0x1'));var logger=require(_0x43b6('0x2'))(_0x43b6('0x3'));var client=jayson['client'][_0x43b6('0x4')]({'port':0x232a});function request(_0x3c2744,_0x18409d){return new BPromise(function(_0x2c98ef,_0x3f362a){return client['request'](_0x3c2744,_0x18409d)['then'](function(_0x5e2ce1){if(_0x5e2ce1['error']){return _0x3f362a(_0x5e2ce1['error'][_0x43b6('0x5')]);}else{return _0x2c98ef(_0x5e2ce1['result']);}})[_0x43b6('0x6')](function(_0xc0f4eb){return _0x3f362a(_0xc0f4eb);});});}exports['condition']=function(_0x2b0dab,_0x2bdce6,_0x4c0571){return function(_0xd464aa){if(_0x4c0571[_0x43b6('0x7')]&&!_0x4c0571['rules'][_0x2b0dab]){logger[_0x43b6('0x8')](_0x43b6('0x9'),_0x2b0dab);return _0xd464aa['stop']();}var _0x55fea9=[];for(var _0x45fea4=0x0;_0x45fea4<_0x2bdce6['length'];_0x45fea4+=0x1){_0x55fea9[_0x43b6('0xa')](request(_0x43b6('0xb'),{'command':util[_0x43b6('0xc')](_0x43b6('0xd'),_0x2bdce6[_0x45fea4])})[_0x43b6('0xe')](function(_0x5807c0){return _0x5807c0&&_0x5807c0[_0x43b6('0x5')]&&_0x5807c0[_0x43b6('0x5')]['indexOf'](_0x43b6('0xf'))>=0x0?!![]:![];})['catch'](function(){logger[_0x43b6('0x10')](_0x43b6('0x11'),_0x2b0dab,_0x2bdce6[_0x45fea4]);}));}BPromise[_0x43b6('0x12')](_0x55fea9)[_0x43b6('0xe')](function(_0xd8694){var _0x1774be=_[_0x43b6('0x13')](_0xd8694);logger[_0x43b6('0x8')](_0x43b6('0x14'),_0x2b0dab,_0x2bdce6[_0x43b6('0x15')](_0x43b6('0x16')),_0x1774be);_0xd464aa[_0x43b6('0x17')](_0x1774be);})['catch'](function(_0x842a6){logger[_0x43b6('0x10')](_0x43b6('0x14'),_0x2b0dab,_0x2bdce6[_0x43b6('0x15')](_0x43b6('0x16')),_0x842a6[_0x43b6('0x18')]);_0xd464aa['stop']();});};}; \ No newline at end of file +var _0x851c=['true','some','when','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','stop','util','bluebird','jayson/promise','lodash','routing','http','request','then','error','message','result','catch','condition','rules','info','length','push','Command','format','iftime\x20%s','indexOf'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x851c,0x1bb));var _0xc851=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x851c[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0xc851('0x0'));var BPromise=require(_0xc851('0x1'));var jayson=require(_0xc851('0x2'));var _=require(_0xc851('0x3'));var logger=require('../../../config/logger')(_0xc851('0x4'));var client=jayson['client'][_0xc851('0x5')]({'port':0x232a});function request(_0x582f26,_0x384916){return new BPromise(function(_0x5eb076,_0x14e826){return client[_0xc851('0x6')](_0x582f26,_0x384916)[_0xc851('0x7')](function(_0x2555ce){if(_0x2555ce[_0xc851('0x8')]){return _0x14e826(_0x2555ce[_0xc851('0x8')][_0xc851('0x9')]);}else{return _0x5eb076(_0x2555ce[_0xc851('0xa')]);}})[_0xc851('0xb')](function(_0x391878){return _0x14e826(_0x391878);});});}exports[_0xc851('0xc')]=function(_0x1b83ba,_0x4f71c7,_0xe63a95){return function(_0x22601c){if(_0xe63a95[_0xc851('0xd')]&&!_0xe63a95[_0xc851('0xd')][_0x1b83ba]){logger[_0xc851('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1b83ba);return _0x22601c['stop']();}var _0x8515af=[];for(var _0x1d66d0=0x0;_0x1d66d0<_0x4f71c7[_0xc851('0xf')];_0x1d66d0+=0x1){_0x8515af[_0xc851('0x10')](request(_0xc851('0x11'),{'command':util[_0xc851('0x12')](_0xc851('0x13'),_0x4f71c7[_0x1d66d0])})['then'](function(_0x3e4175){return _0x3e4175&&_0x3e4175[_0xc851('0x9')]&&_0x3e4175[_0xc851('0x9')][_0xc851('0x14')](_0xc851('0x15'))>=0x0?!![]:![];})[_0xc851('0xb')](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x1b83ba,_0x4f71c7[_0x1d66d0]);}));}BPromise['all'](_0x8515af)[_0xc851('0x7')](function(_0x120176){var _0x3dc7e6=_[_0xc851('0x16')](_0x120176);logger[_0xc851('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x1b83ba,_0x4f71c7['join']('\x20|\x20'),_0x3dc7e6);_0x22601c[_0xc851('0x17')](_0x3dc7e6);})['catch'](function(_0x2c6e2a){logger['error'](_0xc851('0x18'),_0x1b83ba,_0x4f71c7[_0xc851('0x19')](_0xc851('0x1a')),_0x2c6e2a[_0xc851('0x1b')]);_0x22601c[_0xc851('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 9892036..7e3341d 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 _0x58a4=['clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','debug','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid'];(function(_0x432bbd,_0x5503bf){var _0x3865b7=function(_0x562a29){while(--_0x562a29){_0x432bbd['push'](_0x432bbd['shift']());}};_0x3865b7(++_0x5503bf);}(_0x58a4,0xbf));var _0x458a=function(_0x2e8c3a,_0x56ab17){_0x2e8c3a=_0x2e8c3a-0x0;var _0x4d7311=_0x58a4[_0x2e8c3a];return _0x4d7311;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var utils=require(_0x458a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e23ea,_0xd2a36e){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x5'),_0x1e23ea[_0x458a('0x6')],_0x1e23ea[_0x458a('0x7')],_0x1e23ea[_0x458a('0x8')],_0x1e23ea[_0x458a('0x9')],_0x1e23ea[_0x458a('0xa')],_0x1e23ea['calleridnum'],_0x1e23ea['connectedlinenum'],_0x1e23ea[_0x458a('0xb')]));if(_0x1e23ea[_0x458a('0x8')]){utils[_0x458a('0xc')](_0x1e23ea[_0x458a('0x8')])[_0x458a('0xd')](function(_0x55bf10){if(_0x55bf10){_0x1e23ea['type']=_0x55bf10[_0x458a('0xe')];_0x1e23ea[_0x458a('0xf')]=_0x1e23ea[_0x458a('0x10')]?_0x55bf10[_0x458a('0x11')]:![];_0x1e23ea[_0x458a('0x12')]=_0x1e23ea['agentacw']?_0x55bf10[_0x458a('0x13')]:0x0;}utils[_0x458a('0x14')]('CreateVoiceAgentReport',_0x1e23ea);});}else{utils[_0x458a('0x14')](_0x458a('0x15'),_0x1e23ea);}if(_0xd2a36e){delete transfers[_0x1e23ea[_0x458a('0x6')]];}else{delete agents[_0x1e23ea[_0x458a('0x16')]];}}exports[_0x458a('0x17')]=function(_0x5bd09e){try{utils['debug'](util[_0x458a('0x4')]('[%s][agents][agentcalled]',_0x5bd09e[_0x458a('0x6')]),_0x5bd09e);agents[_0x5bd09e[_0x458a('0x16')]]=_0x5bd09e;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();agents[_0x5bd09e[_0x458a('0x16')]]['lastevent']='called';agents[_0x5bd09e['destuniqueid']][_0x458a('0x1a')]=null;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x1b')]=null;utils['info'](util[_0x458a('0x4')](_0x458a('0x1c'),_0x5bd09e[_0x458a('0x6')],agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x9')],_0x5bd09e['destuniqueid']));}catch(_0x4f57e3){utils[_0x458a('0x1d')](util['format'](_0x458a('0x1e'),_0x5bd09e[_0x458a('0x6')]),_0x4f57e3);}};exports['agentringnoanswer']=function(_0x468416){try{if(!_['isNil'](agents[_0x468416[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util['format'](_0x458a('0x20'),_0x468416[_0x458a('0x6')]),_0x468416);utils['info'](util[_0x458a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x468416[_0x458a('0x6')],agents[_0x468416['destuniqueid']][_0x458a('0x9')],_0x468416['destuniqueid']));agents[_0x468416[_0x458a('0x16')]][_0x458a('0x21')]=!![];agents[_0x468416[_0x458a('0x16')]][_0x458a('0x22')]=utils[_0x458a('0x19')]();agents[_0x468416[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x24')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x25')]=_0x468416['ringtime']?parseInt(_0x468416[_0x458a('0x26')])/0x3e8:0x0;agents[_0x468416[_0x458a('0x16')]]['talktime']=0x0;unanswered['push'](_0x468416[_0x458a('0x16')]);}}catch(_0x596fe2){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x20'),_0x468416['uniqueid']),_0x596fe2);}};exports[_0x458a('0x27')]=function(_0x2531f7){try{_[_0x458a('0x28')](agents,function(_0x562c36,_0x47e20d){if(_0x562c36[_0x458a('0x6')]==_0x2531f7['uniqueid']&&!_[_0x458a('0x29')](unanswered,_0x562c36['destuniqueid'])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]',_0x2531f7[_0x458a('0x6')]),_0x2531f7);utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2531f7[_0x458a('0x6')],_0x562c36[_0x458a('0x9')],_0x562c36[_0x458a('0x16')]));_0x562c36[_0x458a('0x21')]=!![];_0x562c36[_0x458a('0x22')]=utils['now']();_0x562c36[_0x458a('0xb')]=_0x458a('0x2a');_0x562c36[_0x458a('0x24')]=_0x458a('0x2a');_0x562c36[_0x458a('0x25')]=_0x2531f7[_0x458a('0x25')];_0x562c36['talktime']=0x0;writeDB(_0x562c36);}});}catch(_0x2a6b9c){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x2b'),_0x2531f7[_0x458a('0x6')]),_0x2a6b9c);}};exports[_0x458a('0x2c')]=function(_0x262ad0){try{if(agents[_0x262ad0[_0x458a('0x16')]]){utils[_0x458a('0x1f')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x262ad0);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x2e'),_0x262ad0[_0x458a('0x6')],agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x9')],_0x262ad0[_0x458a('0x16')]));agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x2f')]=utils[_0x458a('0x19')]();agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x1a')]=_0x262ad0[_0x458a('0x1a')];agents[_0x262ad0['destuniqueid']][_0x458a('0x1b')]=_0x262ad0[_0x458a('0x1b')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x30');_[_0x458a('0x28')](agents,function(_0x44c5ba,_0x20cf10){if(_0x44c5ba['destuniqueid']!=_0x262ad0[_0x458a('0x16')]&&_0x44c5ba[_0x458a('0x6')]==_0x262ad0['uniqueid']){_0x44c5ba[_0x458a('0x31')]=0x0;_0x44c5ba[_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];_0x44c5ba['agentringnoanswer']=!![];_0x44c5ba[_0x458a('0x22')]=utils[_0x458a('0x19')]();_0x44c5ba[_0x458a('0xb')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x24')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x33')]=_0x262ad0[_0x458a('0x16')];_0x44c5ba['answeredelsewheremembername']=_0x262ad0[_0x458a('0x9')];writeDB(_0x44c5ba);}});}}catch(_0x145e3c){utils[_0x458a('0x1d')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x145e3c);}};exports['agentcomplete']=function(_0x598707){try{if(!_[_0x458a('0x34')](agents[_0x598707[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][agentcomplete]',_0x598707['uniqueid']),_0x598707);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x35'),_0x598707[_0x458a('0x6')],agents[_0x598707['destuniqueid']][_0x458a('0x9')],_0x598707[_0x458a('0x16')]));agents[_0x598707['destuniqueid']][_0x458a('0x10')]=!![];agents[_0x598707['destuniqueid']][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x598707[_0x458a('0x16')]]['talktime']=utils[_0x458a('0x37')](agents[_0x598707[_0x458a('0x16')]][_0x458a('0x36')],agents[_0x598707['destuniqueid']]['agentconnectAt']);agents[_0x598707[_0x458a('0x16')]][_0x458a('0x24')]=_0x598707[_0x458a('0x24')];agents[_0x598707['destuniqueid']]['lastevent']=_0x458a('0x38');writeDB(agents[_0x598707[_0x458a('0x16')]]);}}catch(_0x25bee8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x39'),_0x598707[_0x458a('0x6')]),_0x25bee8);}};exports[_0x458a('0x3a')]=function(_0xb22232){try{if(!_[_0x458a('0x34')](agents[_0xb22232[_0x458a('0x3b')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232[_0x458a('0x6')]),_0xb22232);utils[_0x458a('0x3')](util['format'](_0x458a('0x3d'),_0xb22232[_0x458a('0x6')],agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x9')],agents[_0xb22232[_0x458a('0x3b')]]['uniqueid']));agents[_0xb22232['transfereruniqueid']]['transfer']=!![];agents[_0xb22232[_0x458a('0x3b')]]['transfertype']=_0x458a('0x3e');agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x3f')]=_0xb22232[_0x458a('0x40')];agents[_0xb22232[_0x458a('0x3b')]]['transferuniqueid']=agents[_0xb22232['transfereruniqueid']][_0x458a('0x6')];}}catch(_0x2d8b77){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232['uniqueid']),_0x2d8b77);}};exports[_0x458a('0x41')]=function(_0x4eed01){try{utils[_0x458a('0x1f')](util['format'](_0x458a('0x42'),_0x4eed01['origtransfereruniqueid']),_0x4eed01);if(_0x4eed01['origtransfereruniqueid']==_0x4eed01['origtransfererlinkedid']){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x43')]])){utils['info'](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01[_0x458a('0x45')],agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x9')]));agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x47')]=_0x458a('0x48');agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x3f')]=_0x4eed01[_0x458a('0x49')];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4a')]=_0x4eed01[_0x458a('0x45')];}if(_0x4eed01[_0x458a('0x4b')]&&agents[_0x4eed01[_0x458a('0x4b')]]){agents[_0x4eed01[_0x458a('0x4b')]]['agententerreason']=0x1;transfers[_0x4eed01[_0x458a('0x4b')]]=_['clone'](agents[_0x4eed01[_0x458a('0x4b')]]);transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x43')]]['calleridnum'];transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x2f')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x25')]=0x0;transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4e')]=0x2;}}else if(_0x4eed01[_0x458a('0x43')]==_0x4eed01[_0x458a('0x4f')]){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x45')]])){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01['origtransfereruniqueid'],agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x9')]));agents[_0x4eed01['origtransfereruniqueid']][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x45')]]['transfertype']=_0x458a('0x48');agents[_0x4eed01[_0x458a('0x45')]]['transferexten']=_0x4eed01[_0x458a('0x50')];agents[_0x4eed01[_0x458a('0x45')]]['transferuniqueid']=_0x4eed01[_0x458a('0x43')];}if(_0x4eed01[_0x458a('0x51')]&&agents[_0x4eed01[_0x458a('0x51')]]){agents[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x1;transfers[_0x4eed01[_0x458a('0x51')]]=_[_0x458a('0x52')](agents[_0x4eed01[_0x458a('0x51')]]);transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4c')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x2f')]=utils['now']();transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x25')]=0x0;transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x2;}}}catch(_0xfb99c8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x42'),_0x4eed01[_0x458a('0x45')]),_0xfb99c8);}};exports[_0x458a('0x53')]=function(_0x31074e){try{utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x31074e);if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e['uniqueid']][_0x458a('0x24')]==='timeout'){if(_0x31074e[_0x458a('0x55')]==='21'){agents[_0x31074e[_0x458a('0x6')]]['reason']=_0x458a('0x56');agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]='rejected';}utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x57'),_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e['uniqueid']][_0x458a('0x24')],agents[_0x31074e['uniqueid']]['lastevent']));writeDB(agents[_0x31074e[_0x458a('0x6')]]);var _0x36ba6e=unanswered[_0x458a('0x58')](_0x31074e[_0x458a('0x6')]);if(_0x36ba6e>-0x1){unanswered[_0x458a('0x59')](_0x36ba6e,0x1);}}if(transfers[_0x31074e[_0x458a('0x6')]]){transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x10')]=!![];transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](transfers[_0x31074e['uniqueid']]['agentcompleteAt'],transfers[_0x31074e['uniqueid']][_0x458a('0x2f')]);transfers[_0x31074e['uniqueid']][_0x458a('0x24')]=_0x458a('0x5a');transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],transfers[_0x31074e[_0x458a('0x6')]]['membername'],transfers[_0x31074e[_0x458a('0x6')]]['reason'],transfers[_0x31074e[_0x458a('0x6')]]['lastevent']));writeDB(transfers[_0x31074e[_0x458a('0x6')]],!![]);}if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]){agents[_0x31074e['uniqueid']][_0x458a('0x10')]=!![];agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](agents[_0x31074e[_0x458a('0x6')]]['agentcompleteAt'],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]);agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')]=agents[_0x31074e['uniqueid']][_0x458a('0x46')]?_0x458a('0x46'):'agent';agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]));writeDB(agents[_0x31074e['uniqueid']]);}}catch(_0x1f9925){utils['error'](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x1f9925);}}; \ No newline at end of file +var _0xa571=['calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','agententerreason'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa571,0x107));var _0x1a57=function(_0x49e9b9,_0x4f3a1){_0x49e9b9=_0x49e9b9-0x0;var _0x5a65a2=_0xa571[_0x49e9b9];return _0x5a65a2;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var utils=require(_0x1a57('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1067d9,_0x48485e){utils[_0x1a57('0x3')](util[_0x1a57('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1067d9['uniqueid'],_0x1067d9[_0x1a57('0x5')],_0x1067d9['queue'],_0x1067d9[_0x1a57('0x6')],_0x1067d9[_0x1a57('0x7')],_0x1067d9[_0x1a57('0x8')],_0x1067d9[_0x1a57('0x9')],_0x1067d9[_0x1a57('0xa')]));if(_0x1067d9[_0x1a57('0xb')]){utils['getVoiceQueueByName'](_0x1067d9[_0x1a57('0xb')])[_0x1a57('0xc')](function(_0x3631d6){if(_0x3631d6){_0x1067d9['type']=_0x3631d6[_0x1a57('0xd')];_0x1067d9[_0x1a57('0xe')]=_0x1067d9[_0x1a57('0xf')]?_0x3631d6[_0x1a57('0x10')]:![];_0x1067d9[_0x1a57('0x11')]=_0x1067d9[_0x1a57('0xe')]?_0x3631d6[_0x1a57('0x12')]:0x0;}utils[_0x1a57('0x13')]('CreateVoiceAgentReport',_0x1067d9);});}else{utils['request'](_0x1a57('0x14'),_0x1067d9);}if(_0x48485e){delete transfers[_0x1067d9[_0x1a57('0x15')]];}else{delete agents[_0x1067d9[_0x1a57('0x16')]];}}exports['agentcalled']=function(_0x3de36a){try{utils[_0x1a57('0x17')](util['format'](_0x1a57('0x18'),_0x3de36a['uniqueid']),_0x3de36a);agents[_0x3de36a[_0x1a57('0x16')]]=_0x3de36a;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();agents[_0x3de36a['destuniqueid']][_0x1a57('0xa')]='called';agents[_0x3de36a['destuniqueid']][_0x1a57('0x9')]=null;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x1b')]=null;utils['info'](util[_0x1a57('0x4')](_0x1a57('0x1c'),_0x3de36a[_0x1a57('0x15')],agents[_0x3de36a['destuniqueid']][_0x1a57('0x6')],_0x3de36a[_0x1a57('0x16')]));}catch(_0x451b34){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentcalled]',_0x3de36a['uniqueid']),_0x451b34);}};exports[_0x1a57('0x1e')]=function(_0x21e811){try{if(!_[_0x1a57('0x1f')](agents[_0x21e811['destuniqueid']])){utils['debug'](util['format'](_0x1a57('0x20'),_0x21e811[_0x1a57('0x15')]),_0x21e811);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x21'),_0x21e811[_0x1a57('0x15')],agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x6')],_0x21e811[_0x1a57('0x16')]));agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x1e')]=!![];agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x22')]=utils[_0x1a57('0x1a')]();agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x24')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x25')]=_0x21e811['ringtime']?parseInt(_0x21e811['ringtime'])/0x3e8:0x0;agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x26')]=0x0;unanswered['push'](_0x21e811[_0x1a57('0x16')]);}}catch(_0x54f6a5){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentringnoanswer]',_0x21e811[_0x1a57('0x15')]),_0x54f6a5);}};exports[_0x1a57('0x27')]=function(_0x30527c){try{_[_0x1a57('0x28')](agents,function(_0x492b90,_0x366d5f){if(_0x492b90[_0x1a57('0x15')]==_0x30527c[_0x1a57('0x15')]&&!_[_0x1a57('0x29')](unanswered,_0x492b90['destuniqueid'])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0x30527c);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x2b'),_0x30527c[_0x1a57('0x15')],_0x492b90[_0x1a57('0x6')],_0x492b90['destuniqueid']));_0x492b90[_0x1a57('0x1e')]=!![];_0x492b90[_0x1a57('0x22')]=utils['now']();_0x492b90['lastevent']=_0x1a57('0x2c');_0x492b90[_0x1a57('0x24')]=_0x1a57('0x2c');_0x492b90[_0x1a57('0x25')]=_0x30527c[_0x1a57('0x25')];_0x492b90[_0x1a57('0x26')]=0x0;writeDB(_0x492b90);}});}catch(_0xe80d94){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0xe80d94);}};exports[_0x1a57('0x2d')]=function(_0x12f3a7){try{if(agents[_0x12f3a7[_0x1a57('0x16')]]){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x12f3a7);utils['info'](util[_0x1a57('0x4')](_0x1a57('0x2f'),_0x12f3a7[_0x1a57('0x15')],agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x6')],_0x12f3a7[_0x1a57('0x16')]));agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();agents[_0x12f3a7['destuniqueid']]['connectedlinenum']=_0x12f3a7['connectedlinenum'];agents[_0x12f3a7['destuniqueid']][_0x1a57('0x1b')]=_0x12f3a7[_0x1a57('0x1b')];agents[_0x12f3a7[_0x1a57('0x16')]]['holdtime']=_0x12f3a7[_0x1a57('0x31')];agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x32');_['forIn'](agents,function(_0x1be254,_0x5e79f0){if(_0x1be254[_0x1a57('0x16')]!=_0x12f3a7[_0x1a57('0x16')]&&_0x1be254[_0x1a57('0x15')]==_0x12f3a7['uniqueid']){_0x1be254[_0x1a57('0x26')]=0x0;_0x1be254[_0x1a57('0x25')]=_0x12f3a7[_0x1a57('0x31')];_0x1be254[_0x1a57('0x1e')]=!![];_0x1be254[_0x1a57('0x22')]=utils['now']();_0x1be254[_0x1a57('0xa')]='answered_elsewhere';_0x1be254['reason']=_0x1a57('0x33');_0x1be254['answeredelsewheredestinationuniqueid']=_0x12f3a7[_0x1a57('0x16')];_0x1be254[_0x1a57('0x34')]=_0x12f3a7[_0x1a57('0x6')];writeDB(_0x1be254);}});}}catch(_0x59abb1){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x59abb1);}};exports['agentcomplete']=function(_0xc7bab4){try{if(!_[_0x1a57('0x1f')](agents[_0xc7bab4['destuniqueid']])){utils[_0x1a57('0x17')](util['format']('[%s][agents][agentcomplete]',_0xc7bab4[_0x1a57('0x15')]),_0xc7bab4);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x35'),_0xc7bab4['uniqueid'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x6')],_0xc7bab4[_0x1a57('0x16')]));agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xf')]=!![];agents[_0xc7bab4['destuniqueid']][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x26')]=utils['diffTime'](agents[_0xc7bab4[_0x1a57('0x16')]]['agentcompleteAt'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x30')]);agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x24')]=_0xc7bab4[_0x1a57('0x24')];agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x37');writeDB(agents[_0xc7bab4[_0x1a57('0x16')]]);}}catch(_0x424065){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x38'),_0xc7bab4['uniqueid']),_0x424065);}};exports[_0x1a57('0x39')]=function(_0x480aff){try{if(!_[_0x1a57('0x1f')](agents[_0x480aff[_0x1a57('0x3a')]])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x480aff);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x3c'),_0x480aff['uniqueid'],agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x6')],agents[_0x480aff['transfereruniqueid']][_0x1a57('0x15')]));agents[_0x480aff[_0x1a57('0x3a')]]['transfer']=!![];agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x3d')]='blind';agents[_0x480aff['transfereruniqueid']]['transferexten']=_0x480aff[_0x1a57('0x3e')];agents[_0x480aff[_0x1a57('0x3a')]]['transferuniqueid']=agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x15')];}}catch(_0x572202){utils['error'](util['format'](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x572202);}};exports[_0x1a57('0x3f')]=function(_0x31be00){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x31be00);if(_0x31be00['origtransfereruniqueid']==_0x31be00['origtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00['secondtransfereruniqueid']])){utils['info'](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x6')]));agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x44')]=!![];agents[_0x31be00[_0x1a57('0x43')]]['transfertype']='ATTENDED';agents[_0x31be00['secondtransfereruniqueid']][_0x1a57('0x45')]=_0x31be00['origtransfererexten'];agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x41')];}if(_0x31be00[_0x1a57('0x47')]&&agents[_0x31be00[_0x1a57('0x47')]]){agents[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x48')]=0x1;transfers[_0x31be00['transfereeuniqueid']]=_['clone'](agents[_0x31be00['transfereeuniqueid']]);transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x49')]=agents[_0x31be00[_0x1a57('0x43')]]['calleridname'];transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]]['holdtime']=0x0;transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x48')]=0x2;}}else if(_0x31be00[_0x1a57('0x43')]==_0x31be00['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00[_0x1a57('0x41')]])){utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x6')]));agents[_0x31be00['origtransfereruniqueid']]['transfer']=!![];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x3d')]=_0x1a57('0x4a');agents[_0x31be00[_0x1a57('0x41')]]['transferexten']=_0x31be00[_0x1a57('0x4b')];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x43')];}if(_0x31be00[_0x1a57('0x4c')]&&agents[_0x31be00['transfertargetuniqueid']]){agents[_0x31be00['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x31be00[_0x1a57('0x4c')]]=_[_0x1a57('0x4d')](agents[_0x31be00[_0x1a57('0x4c')]]);transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x4c')]]['calleridname']=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x49')];transfers[_0x31be00['transfertargetuniqueid']]['agentcalledAt']=utils[_0x1a57('0x1a')]();transfers[_0x31be00['transfertargetuniqueid']][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x25')]=0x0;transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x48')]=0x2;}}}catch(_0x213576){utils[_0x1a57('0x1d')](util['format'](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x213576);}};exports['hangup']=function(_0x24b56c){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')]('[%s][agents][hangup]',_0x24b56c['uniqueid']),_0x24b56c);if(agents[_0x24b56c[_0x1a57('0x15')]]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]===_0x1a57('0x23')){if(_0x24b56c['cause']==='21'){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]=_0x1a57('0x4e');agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]='rejected';}utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x6')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);var _0x48a10e=unanswered[_0x1a57('0x50')](_0x24b56c[_0x1a57('0x15')]);if(_0x48a10e>-0x1){unanswered['splice'](_0x48a10e,0x1);}}if(transfers[_0x24b56c[_0x1a57('0x15')]]){transfers[_0x24b56c[_0x1a57('0x15')]]['agentcomplete']=!![];transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x26')]=utils[_0x1a57('0x51')](transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],transfers[_0x24b56c['uniqueid']][_0x1a57('0x30')]);transfers[_0x24b56c[_0x1a57('0x15')]]['reason']=_0x1a57('0x52');transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]=_0x1a57('0x37');utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],transfers[_0x24b56c[_0x1a57('0x15')]]['membername'],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(transfers[_0x24b56c[_0x1a57('0x15')]],!![]);}if(agents[_0x24b56c['uniqueid']]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x30')]){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xf')]=!![];agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0x24b56c[_0x1a57('0x15')]]['talktime']=utils[_0x1a57('0x51')](agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],agents[_0x24b56c[_0x1a57('0x15')]]['agentconnectAt']);agents[_0x24b56c['uniqueid']]['reason']=agents[_0x24b56c['uniqueid']]['transfer']?_0x1a57('0x44'):_0x1a57('0x52');agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]=_0x1a57('0x37');utils['info'](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]]['membername'],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);}}catch(_0x42d41e){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x53'),_0x24b56c[_0x1a57('0x15')]),_0x42d41e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 8e12659..544a0e5 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 _0x88dd=['[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','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','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid'];(function(_0x3d9180,_0x3d3751){var _0x5ed226=function(_0x166e60){while(--_0x166e60){_0x3d9180['push'](_0x3d9180['shift']());}};_0x5ed226(++_0x3d3751);}(_0x88dd,0xf1));var _0xd88d=function(_0x149ed9,_0x44de1c){_0x149ed9=_0x149ed9-0x0;var _0x959eb=_0x88dd[_0x149ed9];return _0x959eb;};'use strict';var _=require(_0xd88d('0x0'));var util=require('util');var utils=require(_0xd88d('0x1'));var dispositions=[_0xd88d('0x2'),_0xd88d('0x3'),_0xd88d('0x3'),_0xd88d('0x2'),_0xd88d('0x2'),'NO\x20ANSWER',_0xd88d('0x4'),'BUSY',_0xd88d('0x3'),_0xd88d('0x3'),_0xd88d('0x3')];var channels={};function writeDB(_0x409a01){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x7'),_0x409a01[_0xd88d('0x8')],_0x409a01[_0xd88d('0x9')],_0x409a01[_0xd88d('0xa')],_0x409a01[_0xd88d('0xb')],_0x409a01[_0xd88d('0xc')],_0x409a01[_0xd88d('0xd')],_0x409a01['connectedlinenum'],_0x409a01[_0xd88d('0xe')]));if(_0x409a01['accountcode']){utils[_0xd88d('0xf')](_0x409a01[_0xd88d('0x10')])[_0xd88d('0x11')](function(_0x2c1c80){if(_0x2c1c80){_0x409a01[_0xd88d('0x12')]=_0x2c1c80['id'];}utils[_0xd88d('0x13')](_0xd88d('0x14'),_0x409a01);});}else{utils[_0xd88d('0x13')](_0xd88d('0x14'),_0x409a01);}if(channels[_0x409a01[_0xd88d('0x8')]]){delete channels[_0x409a01[_0xd88d('0x8')]];}}exports[_0xd88d('0x15')]=function(_0x5a6ec4){try{utils[_0xd88d('0x16')](util['format'](_0xd88d('0x17'),_0x5a6ec4['uniqueid']),_0x5a6ec4);if(_0x5a6ec4[_0xd88d('0x8')]==_0x5a6ec4[_0xd88d('0x18')]&&_0x5a6ec4[_0xd88d('0x9')]!='OutgoingSpoolFailed'){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x19'),_0x5a6ec4[_0xd88d('0x8')],_0x5a6ec4[_0xd88d('0x1a')],_0x5a6ec4[_0xd88d('0x1b')]));channels[_0x5a6ec4['uniqueid']]={'uniqueid':_0x5a6ec4[_0xd88d('0x8')],'accountcode':_0x5a6ec4[_0xd88d('0x10')],'source':_0x5a6ec4['calleridnum'],'destination':_0x5a6ec4['exten'],'destinationcontext':_0x5a6ec4[_0xd88d('0x1a')],'channel':_0x5a6ec4[_0xd88d('0x9')],'starttime':utils[_0xd88d('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd88d('0x2'),'amaflags':_0xd88d('0x1d')};}}catch(_0x5e8956){utils[_0xd88d('0x1e')](util[_0xd88d('0x6')](_0xd88d('0x17'),_0x5a6ec4[_0xd88d('0x8')]),_0x5e8956);}};exports[_0xd88d('0x1f')]=function(_0x4676a2){try{utils[_0xd88d('0x16')](util[_0xd88d('0x6')]('[%s][calls][newstate]',_0x4676a2[_0xd88d('0x8')]),_0x4676a2);if(!_['isNil'](channels[_0x4676a2['uniqueid']])&&_0x4676a2[_0xd88d('0x20')]==0x6){utils[_0xd88d('0x5')](util['format'](_0xd88d('0x21'),_0x4676a2[_0xd88d('0x8')],_0x4676a2[_0xd88d('0x1a')],_0x4676a2[_0xd88d('0x9')]));if(_[_0xd88d('0x22')](channels[_0x4676a2[_0xd88d('0x8')]][_0xd88d('0x23')])){channels[_0x4676a2[_0xd88d('0x8')]][_0xd88d('0x23')]=utils[_0xd88d('0x1c')]();}}else if(!_[_0xd88d('0x22')](channels[_0x4676a2['linkedid']])&&_0x4676a2[_0xd88d('0x20')]==0x6&&_0x4676a2[_0xd88d('0x1a')]!=_0xd88d('0x24')){utils[_0xd88d('0x5')](util[_0xd88d('0x6')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4676a2[_0xd88d('0x8')],_0x4676a2[_0xd88d('0x18')],_0x4676a2[_0xd88d('0x1a')],_0x4676a2[_0xd88d('0x9')]));channels[_0x4676a2['linkedid']][_0xd88d('0x10')]=_0x4676a2[_0xd88d('0x10')];channels[_0x4676a2[_0xd88d('0x18')]][_0xd88d('0x25')]=_0x4676a2[_0xd88d('0x9')];if(_[_0xd88d('0x22')](channels[_0x4676a2[_0xd88d('0x18')]][_0xd88d('0x26')])){channels[_0x4676a2[_0xd88d('0x18')]][_0xd88d('0x26')]=utils[_0xd88d('0x1c')]();}channels[_0x4676a2[_0xd88d('0x18')]][_0xd88d('0x27')]=dispositions[_[_0xd88d('0x28')](_0x4676a2['channelstate'])]||'ANSWERED';}}catch(_0x2cb5b1){utils[_0xd88d('0x1e')](util[_0xd88d('0x6')](_0xd88d('0x29'),_0x4676a2[_0xd88d('0x8')]),_0x2cb5b1);}};exports['hangup']=function(_0x3b217e){try{if(!_['isNil'](channels[_0x3b217e[_0xd88d('0x8')]])){utils['debug'](util[_0xd88d('0x6')](_0xd88d('0x2a'),_0x3b217e[_0xd88d('0x8')]),_0x3b217e);if(_['isNil'](channels[_0x3b217e['uniqueid']][_0xd88d('0x2b')])){channels[_0x3b217e[_0xd88d('0x8')]]['callerid']=_0x3b217e[_0xd88d('0x2c')]+'\x20<'+_0x3b217e[_0xd88d('0xd')]+'>';}utils[_0xd88d('0x5')](util[_0xd88d('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3b217e[_0xd88d('0x8')],channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x2b')],_0x3b217e[_0xd88d('0x2d')]));channels[_0x3b217e['uniqueid']][_0xd88d('0x2e')]=utils[_0xd88d('0x1c')]();channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x2f')]=utils['diffTime'](channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x2e')],channels[_0x3b217e[_0xd88d('0x8')]]['starttime']);channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x30')]=channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x26')]?utils[_0xd88d('0x31')](channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x2e')],channels[_0x3b217e[_0xd88d('0x8')]][_0xd88d('0x26')]):0x0;writeDB(channels[_0x3b217e[_0xd88d('0x8')]]);}}catch(_0x891254){utils['error'](util[_0xd88d('0x6')](_0xd88d('0x2a'),_0x3b217e[_0xd88d('0x8')]),_0x891254);}};exports[_0xd88d('0x32')]=function(_0x13054f){try{if(!_[_0xd88d('0x22')](channels[_0x13054f[_0xd88d('0x33')]])){utils[_0xd88d('0x16')](util[_0xd88d('0x6')](_0xd88d('0x34'),_0x13054f['origtransfereruniqueid']),_0x13054f);if(channels[_0x13054f['localtwolinkedid']][_0xd88d('0x9')]==_0x13054f[_0xd88d('0x35')]){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x36'),_0x13054f[_0xd88d('0x37')],_0x13054f[_0xd88d('0x33')],_0x13054f['secondtransfererchannel']));channels[_0x13054f['localtwolinkedid']]['destinationchannel']=_0x13054f[_0xd88d('0x38')];channels[_0x13054f[_0xd88d('0x33')]]['userfield']=_0xd88d('0x39');}else if(channels[_0x13054f[_0xd88d('0x33')]]['channel']=_0x13054f['transfertargetchannel']){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x36'),_0x13054f['origtransfereruniqueid'],_0x13054f[_0xd88d('0x33')],_0x13054f[_0xd88d('0x3a')]));channels[_0x13054f[_0xd88d('0x33')]]['destinationchannel']=_0x13054f[_0xd88d('0x3a')];channels[_0x13054f['localtwolinkedid']][_0xd88d('0x3b')]=_0xd88d('0x39');}}}catch(_0x4f2992){utils['error'](util[_0xd88d('0x6')](_0xd88d('0x34'),_0x13054f['origtransfereruniqueid']),_0x4f2992);}};exports[_0xd88d('0x3c')]=function(_0x5c1813){try{if(!_[_0xd88d('0x22')](channels[_0x5c1813['uniqueid']])){utils[_0xd88d('0x16')](util[_0xd88d('0x6')](_0xd88d('0x3d'),_0x5c1813['uniqueid']),_0x5c1813);channels[_0x5c1813[_0xd88d('0x8')]][_0xd88d('0x3e')]=utils[_0xd88d('0x1c')]();utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x3f'),_0x5c1813[_0xd88d('0x8')],channels[_0x5c1813['uniqueid']][_0xd88d('0x3e')]));}}catch(_0x3868d5){utils[_0xd88d('0x1e')](util[_0xd88d('0x6')](_0xd88d('0x3d'),_0x5c1813[_0xd88d('0x8')]),_0x3868d5);}};exports[_0xd88d('0x40')]=function(_0x3024c9){try{if(!_[_0xd88d('0x22')](channels[_0x3024c9[_0xd88d('0x8')]])){utils['debug'](util['format'](_0xd88d('0x41'),_0x3024c9['uniqueid']),_0x3024c9);if(!_['isNil'](channels[_0x3024c9['uniqueid']][_0xd88d('0x3e')])){channels[_0x3024c9[_0xd88d('0x8')]][_0xd88d('0x42')]+=utils[_0xd88d('0x31')](utils[_0xd88d('0x1c')](),channels[_0x3024c9[_0xd88d('0x8')]]['musiconholdstartAt']);utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x43'),_0x3024c9[_0xd88d('0x8')],channels[_0x3024c9[_0xd88d('0x8')]]['mohtime']));delete channels[_0x3024c9[_0xd88d('0x8')]][_0xd88d('0x3e')];}}}catch(_0x2213c2){utils[_0xd88d('0x1e')](util['format'](_0xd88d('0x41'),_0x3024c9[_0xd88d('0x8')]),_0x2213c2);}};exports[_0xd88d('0x44')]=function(_0x380693){try{if(!_[_0xd88d('0x22')](channels[_0x380693[_0xd88d('0x8')]])){utils[_0xd88d('0x16')](util[_0xd88d('0x6')](_0xd88d('0x45'),_0x380693[_0xd88d('0x8')]),_0x380693);if(!_[_0xd88d('0x22')](_0x380693['variable'][_0xd88d('0x46')])){utils[_0xd88d('0x5')](util['format'](_0xd88d('0x47'),_0x380693[_0xd88d('0x8')],_0x380693[_0xd88d('0x48')]));channels[_0x380693[_0xd88d('0x8')]]['source']=_0x380693['value'];}if(!_[_0xd88d('0x22')](_0x380693[_0xd88d('0x49')][_0xd88d('0x4a')])){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x4b'),_0x380693[_0xd88d('0x8')],_0x380693[_0xd88d('0x48')]));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x4c')]=_0x380693[_0xd88d('0x48')];channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x2b')]='\x22'+_0x380693[_0xd88d('0x48')]+'\x22\x20<'+_0x380693[_0xd88d('0x48')]+'>';}if(!_[_0xd88d('0x22')](_0x380693['variable']['xmd-callerid-preview'])||!_[_0xd88d('0x22')](_0x380693['variable'][_0xd88d('0x4d')])){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x4e'),_0x380693['uniqueid'],!_[_0xd88d('0x22')](_0x380693[_0xd88d('0x49')][_0xd88d('0x4f')])?_0xd88d('0x4f'):_0xd88d('0x4d'),_0x380693['value']));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x2b')]=_0x380693[_0xd88d('0x48')];}if(!_['isNil'](_0x380693[_0xd88d('0x49')][_0xd88d('0x50')])||!_[_0xd88d('0x22')](_0x380693[_0xd88d('0x49')]['xmcs-queue'])){utils[_0xd88d('0x5')](util['format'](_0xd88d('0x4e'),_0x380693[_0xd88d('0x8')],!_[_0xd88d('0x22')](_0x380693[_0xd88d('0x49')][_0xd88d('0x50')])?_0xd88d('0x50'):_0xd88d('0x51'),_0x380693[_0xd88d('0x48')]));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x52')]=_0xd88d('0x53');channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x54')]=_0x380693[_0xd88d('0x48')];channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0xa')]=!![];}if(!_[_0xd88d('0x22')](_0x380693['variable'][_0xd88d('0x55')])){utils[_0xd88d('0x5')](util['format'](_0xd88d('0x56'),_0x380693[_0xd88d('0x8')],_0x380693['value']));channels[_0x380693['uniqueid']]['ContactId']=_0x380693[_0xd88d('0x48')];}if(!_[_0xd88d('0x22')](_0x380693[_0xd88d('0x49')][_0xd88d('0x57')])){utils[_0xd88d('0x5')](util[_0xd88d('0x6')](_0xd88d('0x58'),_0x380693[_0xd88d('0x8')],_0x380693[_0xd88d('0x48')]));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x59')]=_0x380693[_0xd88d('0x48')];}if(!_[_0xd88d('0x22')](_0x380693['variable'][_0xd88d('0x5a')])){utils[_0xd88d('0x5')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x380693['uniqueid'],_0x380693[_0xd88d('0x48')]));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x5b')]=_0x380693[_0xd88d('0x48')];}if(!_[_0xd88d('0x22')](_0x380693['variable'][_0xd88d('0x5c')])){utils['info'](util[_0xd88d('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x380693['uniqueid'],_0x380693['value']));channels[_0x380693[_0xd88d('0x8')]][_0xd88d('0x5c')]=_0x380693['value'];}}}catch(_0xe51e06){utils[_0xd88d('0x1e')](util[_0xd88d('0x6')](_0xd88d('0x45'),_0x380693[_0xd88d('0x8')]),_0xe51e06);}};exports[_0xd88d('0x5d')]=function(_0x15935){try{if(!_[_0xd88d('0x22')](channels[_0x15935[_0xd88d('0x8')]])){utils['debug'](util[_0xd88d('0x6')](_0xd88d('0x5e'),_0x15935[_0xd88d('0x8')]),_0x15935);utils[_0xd88d('0x5')](util['format'](_0xd88d('0x5f'),_0x15935[_0xd88d('0x8')],_0x15935[_0xd88d('0x60')],_0x15935[_0xd88d('0x61')]));if(_0x15935[_0xd88d('0x60')][_0xd88d('0x62')]()==_0xd88d('0x63')&&_[_0xd88d('0x64')](_0x15935[_0xd88d('0x61')][_0xd88d('0x62')](),_0xd88d('0x65'))){var _0x43acb7=_0x15935[_0xd88d('0x61')][_0xd88d('0x66')]('=');var _0x3fdf8d=_0x43acb7[0x0][_0xd88d('0x67')](_0x43acb7[0x0][_0xd88d('0x68')]('(')+0x1,_0x43acb7[0x0][_0xd88d('0x68')](')'));var _0x362bd1=_0x43acb7[0x1];channels[_0x15935[_0xd88d('0x8')]][_0x3fdf8d]=_0x362bd1;}if(!_['includes']([_0xd88d('0x69'),_0xd88d('0x6a'),_0xd88d('0x6b'),_0xd88d('0x63'),_0xd88d('0x6c')],_0x15935[_0xd88d('0x60')][_0xd88d('0x62')]())){channels[_0x15935['uniqueid']][_0xd88d('0x52')]=_0x15935[_0xd88d('0x60')];channels[_0x15935[_0xd88d('0x8')]]['lastdata']=_0x15935[_0xd88d('0x61')];}}}catch(_0x2e7fe3){utils['error'](util[_0xd88d('0x6')]('[%s][calls][newexten]',_0x15935[_0xd88d('0x8')]),_0x2e7fe3);}}; \ No newline at end of file +var _0x5039=['[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','duration','starttime','endtime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','Queue','lastdata','xmd-contactid'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5039,0x149));var _0x9503=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x5039[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x9503('0x0'));var util=require(_0x9503('0x1'));var utils=require(_0x9503('0x2'));var dispositions=[_0x9503('0x3'),_0x9503('0x4'),_0x9503('0x4'),_0x9503('0x3'),'NO\x20ANSWER',_0x9503('0x3'),_0x9503('0x5'),_0x9503('0x6'),'FAILED',_0x9503('0x4'),_0x9503('0x4')];var channels={};function writeDB(_0x5a55bf){utils[_0x9503('0x7')](util[_0x9503('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5a55bf['uniqueid'],_0x5a55bf[_0x9503('0x9')],_0x5a55bf[_0x9503('0xa')],_0x5a55bf['membername'],_0x5a55bf[_0x9503('0xb')],_0x5a55bf[_0x9503('0xc')],_0x5a55bf[_0x9503('0xd')],_0x5a55bf[_0x9503('0xe')]));if(_0x5a55bf[_0x9503('0xf')]){utils[_0x9503('0x10')](_0x5a55bf[_0x9503('0xf')])[_0x9503('0x11')](function(_0x135093){if(_0x135093){_0x5a55bf['UserId']=_0x135093['id'];}utils['request'](_0x9503('0x12'),_0x5a55bf);});}else{utils['request'](_0x9503('0x12'),_0x5a55bf);}if(channels[_0x5a55bf[_0x9503('0x13')]]){delete channels[_0x5a55bf[_0x9503('0x13')]];}}exports[_0x9503('0x14')]=function(_0x3f87f5){try{utils[_0x9503('0x15')](util[_0x9503('0x8')](_0x9503('0x16'),_0x3f87f5[_0x9503('0x13')]),_0x3f87f5);if(_0x3f87f5[_0x9503('0x13')]==_0x3f87f5[_0x9503('0x17')]&&_0x3f87f5[_0x9503('0x9')]!=_0x9503('0x18')){utils['info'](util[_0x9503('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3f87f5[_0x9503('0x13')],_0x3f87f5[_0x9503('0x19')],_0x3f87f5[_0x9503('0x1a')]));channels[_0x3f87f5[_0x9503('0x13')]]={'uniqueid':_0x3f87f5[_0x9503('0x13')],'accountcode':_0x3f87f5['accountcode'],'source':_0x3f87f5[_0x9503('0xc')],'destination':_0x3f87f5[_0x9503('0x1a')],'destinationcontext':_0x3f87f5[_0x9503('0x19')],'channel':_0x3f87f5[_0x9503('0x9')],'starttime':utils[_0x9503('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9503('0x3'),'amaflags':_0x9503('0x1c')};}}catch(_0x255e5e){utils[_0x9503('0x1d')](util[_0x9503('0x8')](_0x9503('0x16'),_0x3f87f5[_0x9503('0x13')]),_0x255e5e);}};exports[_0x9503('0x1e')]=function(_0x9d127){try{utils[_0x9503('0x15')](util[_0x9503('0x8')](_0x9503('0x1f'),_0x9d127[_0x9503('0x13')]),_0x9d127);if(!_[_0x9503('0x20')](channels[_0x9d127['uniqueid']])&&_0x9d127[_0x9503('0x21')]==0x6){utils['info'](util[_0x9503('0x8')](_0x9503('0x22'),_0x9d127[_0x9503('0x13')],_0x9d127[_0x9503('0x19')],_0x9d127[_0x9503('0x9')]));if(_[_0x9503('0x20')](channels[_0x9d127['uniqueid']][_0x9503('0x23')])){channels[_0x9d127[_0x9503('0x13')]][_0x9503('0x23')]=utils[_0x9503('0x1b')]();}}else if(!_[_0x9503('0x20')](channels[_0x9d127[_0x9503('0x17')]])&&_0x9d127[_0x9503('0x21')]==0x6&&_0x9d127[_0x9503('0x19')]!='transfer'){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x24'),_0x9d127[_0x9503('0x13')],_0x9d127[_0x9503('0x17')],_0x9d127[_0x9503('0x19')],_0x9d127[_0x9503('0x9')]));channels[_0x9d127[_0x9503('0x17')]][_0x9503('0xf')]=_0x9d127[_0x9503('0xf')];channels[_0x9d127[_0x9503('0x17')]][_0x9503('0x25')]=_0x9d127[_0x9503('0x9')];if(_[_0x9503('0x20')](channels[_0x9d127[_0x9503('0x17')]][_0x9503('0x26')])){channels[_0x9d127[_0x9503('0x17')]][_0x9503('0x26')]=utils[_0x9503('0x1b')]();}channels[_0x9d127[_0x9503('0x17')]][_0x9503('0x27')]=dispositions[_[_0x9503('0x28')](_0x9d127[_0x9503('0x21')])]||_0x9503('0x5');}}catch(_0x137172){utils[_0x9503('0x1d')](util[_0x9503('0x8')](_0x9503('0x1f'),_0x9d127['uniqueid']),_0x137172);}};exports[_0x9503('0x29')]=function(_0x1c5529){try{if(!_[_0x9503('0x20')](channels[_0x1c5529['uniqueid']])){utils['debug'](util[_0x9503('0x8')](_0x9503('0x2a'),_0x1c5529[_0x9503('0x13')]),_0x1c5529);if(_[_0x9503('0x20')](channels[_0x1c5529['uniqueid']]['callerid'])){channels[_0x1c5529['uniqueid']]['callerid']=_0x1c5529[_0x9503('0x2b')]+'\x20<'+_0x1c5529[_0x9503('0xc')]+'>';}utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x2c'),_0x1c5529[_0x9503('0x13')],channels[_0x1c5529['uniqueid']][_0x9503('0x2d')],_0x1c5529[_0x9503('0x2e')]));channels[_0x1c5529[_0x9503('0x13')]]['endtime']=utils[_0x9503('0x1b')]();channels[_0x1c5529['uniqueid']][_0x9503('0x2f')]=utils['diffTime'](channels[_0x1c5529[_0x9503('0x13')]]['endtime'],channels[_0x1c5529['uniqueid']][_0x9503('0x30')]);channels[_0x1c5529[_0x9503('0x13')]]['billableseconds']=channels[_0x1c5529[_0x9503('0x13')]][_0x9503('0x26')]?utils['diffTime'](channels[_0x1c5529[_0x9503('0x13')]][_0x9503('0x31')],channels[_0x1c5529[_0x9503('0x13')]]['answertime']):0x0;writeDB(channels[_0x1c5529[_0x9503('0x13')]]);}}catch(_0x35b108){utils[_0x9503('0x1d')](util[_0x9503('0x8')]('[%s][calls][hangup]',_0x1c5529['uniqueid']),_0x35b108);}};exports['attendedtransfer']=function(_0xa367e2){try{if(!_[_0x9503('0x20')](channels[_0xa367e2[_0x9503('0x32')]])){utils['debug'](util[_0x9503('0x8')](_0x9503('0x33'),_0xa367e2[_0x9503('0x34')]),_0xa367e2);if(channels[_0xa367e2[_0x9503('0x32')]][_0x9503('0x9')]==_0xa367e2[_0x9503('0x35')]){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x36'),_0xa367e2['origtransfereruniqueid'],_0xa367e2[_0x9503('0x32')],_0xa367e2[_0x9503('0x37')]));channels[_0xa367e2[_0x9503('0x32')]][_0x9503('0x25')]=_0xa367e2['secondtransfererchannel'];channels[_0xa367e2['localtwolinkedid']]['userfield']=_0x9503('0x38');}else if(channels[_0xa367e2[_0x9503('0x32')]]['channel']=_0xa367e2['transfertargetchannel']){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x36'),_0xa367e2['origtransfereruniqueid'],_0xa367e2[_0x9503('0x32')],_0xa367e2['origtransfererchannel']));channels[_0xa367e2[_0x9503('0x32')]][_0x9503('0x25')]=_0xa367e2['origtransfererchannel'];channels[_0xa367e2['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x26d627){utils[_0x9503('0x1d')](util[_0x9503('0x8')](_0x9503('0x33'),_0xa367e2[_0x9503('0x34')]),_0x26d627);}};exports[_0x9503('0x39')]=function(_0x2e91af){try{if(!_[_0x9503('0x20')](channels[_0x2e91af[_0x9503('0x13')]])){utils[_0x9503('0x15')](util[_0x9503('0x8')](_0x9503('0x3a'),_0x2e91af[_0x9503('0x13')]),_0x2e91af);channels[_0x2e91af['uniqueid']]['musiconholdstartAt']=utils[_0x9503('0x1b')]();utils[_0x9503('0x7')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2e91af[_0x9503('0x13')],channels[_0x2e91af['uniqueid']][_0x9503('0x3b')]));}}catch(_0x48dbd0){utils[_0x9503('0x1d')](util[_0x9503('0x8')](_0x9503('0x3a'),_0x2e91af['uniqueid']),_0x48dbd0);}};exports[_0x9503('0x3c')]=function(_0x36234d){try{if(!_['isNil'](channels[_0x36234d[_0x9503('0x13')]])){utils[_0x9503('0x15')](util[_0x9503('0x8')](_0x9503('0x3d'),_0x36234d['uniqueid']),_0x36234d);if(!_[_0x9503('0x20')](channels[_0x36234d[_0x9503('0x13')]]['musiconholdstartAt'])){channels[_0x36234d['uniqueid']][_0x9503('0x3e')]+=utils['diffTime'](utils[_0x9503('0x1b')](),channels[_0x36234d[_0x9503('0x13')]][_0x9503('0x3b')]);utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x3f'),_0x36234d[_0x9503('0x13')],channels[_0x36234d[_0x9503('0x13')]][_0x9503('0x3e')]));delete channels[_0x36234d[_0x9503('0x13')]][_0x9503('0x3b')];}}}catch(_0x1e5c9f){utils[_0x9503('0x1d')](util['format'](_0x9503('0x3d'),_0x36234d['uniqueid']),_0x1e5c9f);}};exports['varset']=function(_0x2781a7){try{if(!_[_0x9503('0x20')](channels[_0x2781a7['uniqueid']])){utils[_0x9503('0x15')](util['format']('[%s][calls][varset]',_0x2781a7[_0x9503('0x13')]),_0x2781a7);if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x41')])){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x42'),_0x2781a7[_0x9503('0x13')],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0x44')]=_0x2781a7[_0x9503('0x43')];}if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x45')])){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x46'),_0x2781a7[_0x9503('0x13')],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7[_0x9503('0x13')]]['destination']=_0x2781a7[_0x9503('0x43')];channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0x2d')]='\x22'+_0x2781a7['value']+'\x22\x20<'+_0x2781a7['value']+'>';}if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x47')])||!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')]['xmd-callerid'])){utils['info'](util[_0x9503('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2781a7[_0x9503('0x13')],!_['isNil'](_0x2781a7[_0x9503('0x40')][_0x9503('0x47')])?_0x9503('0x47'):_0x9503('0x48'),_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7['uniqueid']][_0x9503('0x2d')]=_0x2781a7['value'];}if(!_['isNil'](_0x2781a7[_0x9503('0x40')][_0x9503('0x49')])||!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')]['xmcs-queue'])){utils['info'](util[_0x9503('0x8')](_0x9503('0x4a'),_0x2781a7['uniqueid'],!_['isNil'](_0x2781a7[_0x9503('0x40')][_0x9503('0x49')])?'xmd-queue':_0x9503('0x4b'),_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7[_0x9503('0x13')]]['lastapplication']=_0x9503('0x4c');channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0x4d')]=_0x2781a7[_0x9503('0x43')];channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0xa')]=!![];}if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x4e')])){utils['info'](util[_0x9503('0x8')](_0x9503('0x4f'),_0x2781a7['uniqueid'],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7['uniqueid']][_0x9503('0x50')]=_0x2781a7[_0x9503('0x43')];}if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x51')])){utils[_0x9503('0x7')](util[_0x9503('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2781a7['uniqueid'],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7['uniqueid']]['type']=_0x2781a7['value'];}if(!_['isNil'](_0x2781a7[_0x9503('0x40')][_0x9503('0x52')])){utils['info'](util[_0x9503('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2781a7[_0x9503('0x13')],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0x53')]=_0x2781a7[_0x9503('0x43')];}if(!_[_0x9503('0x20')](_0x2781a7[_0x9503('0x40')][_0x9503('0x54')])){utils[_0x9503('0x7')](util[_0x9503('0x8')](_0x9503('0x55'),_0x2781a7[_0x9503('0x13')],_0x2781a7[_0x9503('0x43')]));channels[_0x2781a7[_0x9503('0x13')]][_0x9503('0x54')]=_0x2781a7[_0x9503('0x43')];}}}catch(_0x24a572){utils[_0x9503('0x1d')](util[_0x9503('0x8')](_0x9503('0x56'),_0x2781a7[_0x9503('0x13')]),_0x24a572);}};exports[_0x9503('0x57')]=function(_0x594fc6){try{if(!_[_0x9503('0x20')](channels[_0x594fc6['uniqueid']])){utils[_0x9503('0x15')](util[_0x9503('0x8')](_0x9503('0x58'),_0x594fc6[_0x9503('0x13')]),_0x594fc6);utils['info'](util[_0x9503('0x8')](_0x9503('0x59'),_0x594fc6['uniqueid'],_0x594fc6[_0x9503('0x5a')],_0x594fc6[_0x9503('0x5b')]));if(_0x594fc6[_0x9503('0x5a')][_0x9503('0x5c')]()==_0x9503('0x5d')&&_['startsWith'](_0x594fc6[_0x9503('0x5b')]['toLowerCase'](),_0x9503('0x5e'))){var _0x3f5efb=_0x594fc6[_0x9503('0x5b')][_0x9503('0x5f')]('=');var _0xca9df9=_0x3f5efb[0x0][_0x9503('0x60')](_0x3f5efb[0x0][_0x9503('0x61')]('(')+0x1,_0x3f5efb[0x0][_0x9503('0x61')](')'));var _0xe7481b=_0x3f5efb[0x1];channels[_0x594fc6[_0x9503('0x13')]][_0xca9df9]=_0xe7481b;}if(!_[_0x9503('0x62')]([_0x9503('0x29'),_0x9503('0x63'),'execif','set',_0x9503('0x64')],_0x594fc6[_0x9503('0x5a')][_0x9503('0x5c')]())){channels[_0x594fc6[_0x9503('0x13')]][_0x9503('0x65')]=_0x594fc6[_0x9503('0x5a')];channels[_0x594fc6[_0x9503('0x13')]][_0x9503('0x4d')]=_0x594fc6[_0x9503('0x5b')];}}}catch(_0x291ba5){utils['error'](util[_0x9503('0x8')](_0x9503('0x58'),_0x594fc6[_0x9503('0x13')]),_0x291ba5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 078b058..b547988 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 _0x6610=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close'];(function(_0x28212f,_0x29ccc3){var _0x37fc01=function(_0xd76f60){while(--_0xd76f60){_0x28212f['push'](_0x28212f['shift']());}};_0x37fc01(++_0x29ccc3);}(_0x6610,0x161));var _0x0661=function(_0x1c3ecf,_0x33978c){_0x1c3ecf=_0x1c3ecf-0x0;var _0xd260c7=_0x6610[_0x1c3ecf];return _0xd260c7;};'use strict';var utils=require(_0x0661('0x0'));exports[_0x0661('0x1')]=function(){utils[_0x0661('0x2')](_0x0661('0x3'));};exports[_0x0661('0x4')]=function(){utils[_0x0661('0x2')]('[core]\x20shutdown');};exports[_0x0661('0x5')]=function(){utils[_0x0661('0x2')](_0x0661('0x6'));};exports[_0x0661('0x7')]=function(_0x18a0d0){utils[_0x0661('0x7')](_0x0661('0x8'),_0x18a0d0);};exports['close']=function(){utils[_0x0661('0x2')](_0x0661('0x9'));};exports[_0x0661('0xa')]=function(_0x965823){}; \ No newline at end of file +var _0xacda=['error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x35dfe6,_0x4244fa){var _0x59651c=function(_0x3ff137){while(--_0x3ff137){_0x35dfe6['push'](_0x35dfe6['shift']());}};_0x59651c(++_0x4244fa);}(_0xacda,0x7c));var _0xaacd=function(_0x1bd79d,_0x289be6){_0x1bd79d=_0x1bd79d-0x0;var _0x3c469b=_0xacda[_0x1bd79d];return _0x3c469b;};'use strict';var utils=require(_0xaacd('0x0'));exports[_0xaacd('0x1')]=function(){utils[_0xaacd('0x2')](_0xaacd('0x3'));};exports['shutdown']=function(){utils['info'](_0xaacd('0x4'));};exports['fullybooted']=function(){utils[_0xaacd('0x2')](_0xaacd('0x5'));};exports[_0xaacd('0x6')]=function(_0x20f55d){utils[_0xaacd('0x6')](_0xaacd('0x7'),_0x20f55d);};exports['close']=function(){utils[_0xaacd('0x2')](_0xaacd('0x8'));};exports[_0xaacd('0x9')]=function(_0x3ddb77){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 53efb04..0932fd8 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 _0x914c=['split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','[%s][dials][hangup]','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x914c,0x150));var _0xc914=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x914c[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0xc914('0x0'));var util=require('util');var utils=require(_0xc914('0x1'));var dials={};function writeDB(_0x135f28){utils[_0xc914('0x2')](util[_0xc914('0x3')](_0xc914('0x4'),_0x135f28[_0xc914('0x5')],_0x135f28['channel'],_0x135f28[_0xc914('0x6')],_0x135f28[_0xc914('0x7')],_0x135f28[_0xc914('0x8')],_0x135f28[_0xc914('0x9')]));utils[_0xc914('0xa')](_0xc914('0xb'),_0x135f28);delete dials[_0x135f28[_0xc914('0x5')]];}exports[_0xc914('0xc')]=function(_0x42f03f){try{utils[_0xc914('0xd')](util[_0xc914('0x3')]('[%s][dials][newexten]',_0x42f03f[_0xc914('0x5')]),_0x42f03f);utils[_0xc914('0x2')](util['format'](_0xc914('0xe'),_0x42f03f[_0xc914('0x5')],_0x42f03f['application'],_0x42f03f['appdata']));if(_0x42f03f[_0xc914('0xf')][_0xc914('0x10')]()==_0xc914('0x11')&&_[_0xc914('0x12')](_0x42f03f[_0xc914('0x13')][_0xc914('0x10')](),_0xc914('0x14'))){var _0x4ba4ae=_0x42f03f[_0xc914('0x13')][_0xc914('0x15')]('=');dials[_0x42f03f[_0xc914('0x5')]]={'routeId':_0x4ba4ae[0x1]};}}catch(_0x12f45b){utils[_0xc914('0x16')](util[_0xc914('0x3')](_0xc914('0x17'),_0x42f03f['uniqueid']),_0x12f45b);}};exports[_0xc914('0x18')]=function(_0x3b230b){try{utils[_0xc914('0xd')](util[_0xc914('0x3')](_0xc914('0x19'),_0x3b230b[_0xc914('0x5')]),_0x3b230b);if(!_[_0xc914('0x1a')](_0x3b230b[_0xc914('0x1b')][_0xc914('0x1c')])){utils[_0xc914('0x2')](util[_0xc914('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3b230b[_0xc914('0x5')],_0x3b230b['value']));dials[_0x3b230b['uniqueid']]={'routeId':_0x3b230b[_0xc914('0x1d')]};}}catch(_0x529153){utils[_0xc914('0x16')](util[_0xc914('0x3')](_0xc914('0x19'),_0x3b230b['uniqueid']),_0x529153);}};exports['dialbegin']=function(_0x562c26){try{if(!_['isNil'](dials[_0x562c26['uniqueid']])){utils[_0xc914('0xd')](util[_0xc914('0x3')](_0xc914('0x1e'),_0x562c26[_0xc914('0x5')]),_0x562c26);dials[_0x562c26[_0xc914('0x5')]]=_[_0xc914('0x1f')](dials[_0x562c26[_0xc914('0x5')]],_0x562c26);dials[_0x562c26[_0xc914('0x5')]][_0xc914('0x20')]=utils[_0xc914('0x21')]();dials[_0x562c26[_0xc914('0x5')]][_0xc914('0x22')]=_0xc914('0x23');utils['info'](util[_0xc914('0x3')](_0xc914('0x24'),_0x562c26['uniqueid'],dials[_0x562c26[_0xc914('0x5')]][_0xc914('0x20')]));}}catch(_0x3532b9){utils[_0xc914('0x16')](util[_0xc914('0x3')]('[%s][dials][dialbegin]',_0x562c26['uniqueid']),_0x3532b9);}};exports[_0xc914('0x25')]=function(_0x424b22){try{if(!_['isNil'](dials[_0x424b22[_0xc914('0x5')]])){utils[_0xc914('0xd')](util[_0xc914('0x3')](_0xc914('0x26'),_0x424b22['uniqueid']),_0x424b22);dials[_0x424b22['uniqueid']][_0xc914('0x9')]=_0x424b22[_0xc914('0x9')];if(_0x424b22[_0xc914('0x9')]=='ANSWER'){dials[_0x424b22[_0xc914('0x5')]]=_['assign'](dials[_0x424b22['uniqueid']],_0x424b22);dials[_0x424b22['uniqueid']][_0xc914('0x27')]=utils[_0xc914('0x21')]();dials[_0x424b22['uniqueid']]['lastevent']=_0xc914('0x28');utils[_0xc914('0x2')](util[_0xc914('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x424b22[_0xc914('0x5')],_0x424b22[_0xc914('0x9')],dials[_0x424b22[_0xc914('0x5')]][_0xc914('0x27')]));}else{utils['info'](util[_0xc914('0x3')](_0xc914('0x29'),_0x424b22[_0xc914('0x5')],_0x424b22[_0xc914('0x9')]));}}}catch(_0x51ab7d){utils[_0xc914('0x16')](util['format'](_0xc914('0x26'),_0x424b22[_0xc914('0x5')]),_0x51ab7d);}};exports[_0xc914('0x2a')]=function(_0x2082cd){try{if(!_['isNil'](dials[_0x2082cd['uniqueid']])){utils[_0xc914('0xd')](util[_0xc914('0x3')]('[%s][dials][hangup]',_0x2082cd[_0xc914('0x5')]),_0x2082cd);utils['info'](util[_0xc914('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2082cd[_0xc914('0x5')],_0x2082cd[_0xc914('0x7')],_0x2082cd[_0xc914('0x2b')],_0x2082cd[_0xc914('0x2c')]));dials[_0x2082cd[_0xc914('0x5')]]=_[_0xc914('0x1f')](dials[_0x2082cd[_0xc914('0x5')]],{'endtime':utils[_0xc914('0x21')](),'lastevent':_0xc914('0x2d')});dials[_0x2082cd['uniqueid']][_0xc914('0x2e')]=utils[_0xc914('0x2f')](dials[_0x2082cd['uniqueid']]['endtime'],dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x20')]);dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x30')]=utils[_0xc914('0x2f')](dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x27')]||dials[_0x2082cd['uniqueid']]['endtime'],dials[_0x2082cd['uniqueid']][_0xc914('0x20')]);dials[_0x2082cd[_0xc914('0x5')]]['billableseconds']=dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x27')]?utils[_0xc914('0x2f')](dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x31')],dials[_0x2082cd[_0xc914('0x5')]][_0xc914('0x27')]):0x0;writeDB(dials[_0x2082cd[_0xc914('0x5')]]);}}catch(_0x537217){utils[_0xc914('0x16')](util[_0xc914('0x3')](_0xc914('0x32'),_0x2082cd['uniqueid']),_0x537217);}}; \ No newline at end of file +var _0xc541=['lodash','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','format','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','[%s][dials][hangup]'];(function(_0x31e752,_0x32b293){var _0x537756=function(_0xb164be){while(--_0xb164be){_0x31e752['push'](_0x31e752['shift']());}};_0x537756(++_0x32b293);}(_0xc541,0x1ea));var _0x1c54=function(_0x19cfac,_0x3745dc){_0x19cfac=_0x19cfac-0x0;var _0x25d2a5=_0xc541[_0x19cfac];return _0x25d2a5;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var utils=require(_0x1c54('0x1'));var dials={};function writeDB(_0x2cae88){utils['info'](util['format'](_0x1c54('0x2'),_0x2cae88[_0x1c54('0x3')],_0x2cae88['channel'],_0x2cae88[_0x1c54('0x4')],_0x2cae88['calleridnum'],_0x2cae88[_0x1c54('0x5')],_0x2cae88['dialstatus']));utils[_0x1c54('0x6')](_0x1c54('0x7'),_0x2cae88);delete dials[_0x2cae88[_0x1c54('0x3')]];}exports[_0x1c54('0x8')]=function(_0x1fe5ba){try{utils[_0x1c54('0x9')](util['format'](_0x1c54('0xa'),_0x1fe5ba[_0x1c54('0x3')]),_0x1fe5ba);utils['info'](util[_0x1c54('0xb')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1fe5ba[_0x1c54('0x3')],_0x1fe5ba['application'],_0x1fe5ba[_0x1c54('0xc')]));if(_0x1fe5ba['application'][_0x1c54('0xd')]()=='set'&&_[_0x1c54('0xe')](_0x1fe5ba['appdata'][_0x1c54('0xd')](),_0x1c54('0xf'))){var _0x12cdad=_0x1fe5ba[_0x1c54('0xc')][_0x1c54('0x10')]('=');dials[_0x1fe5ba['uniqueid']]={'routeId':_0x12cdad[0x1]};}}catch(_0x23b94){utils[_0x1c54('0x11')](util[_0x1c54('0xb')]('[%s][dials][newexten]',_0x1fe5ba[_0x1c54('0x3')]),_0x23b94);}};exports[_0x1c54('0x12')]=function(_0x3155b5){try{utils[_0x1c54('0x9')](util[_0x1c54('0xb')]('[%s][dials][varset]',_0x3155b5['uniqueid']),_0x3155b5);if(!_[_0x1c54('0x13')](_0x3155b5[_0x1c54('0x14')][_0x1c54('0x15')])){utils[_0x1c54('0x16')](util[_0x1c54('0xb')](_0x1c54('0x17'),_0x3155b5[_0x1c54('0x3')],_0x3155b5['value']));dials[_0x3155b5[_0x1c54('0x3')]]={'routeId':_0x3155b5[_0x1c54('0x18')]};}}catch(_0x4eef06){utils['error'](util[_0x1c54('0xb')](_0x1c54('0x19'),_0x3155b5[_0x1c54('0x3')]),_0x4eef06);}};exports[_0x1c54('0x1a')]=function(_0x58ffb7){try{if(!_[_0x1c54('0x13')](dials[_0x58ffb7[_0x1c54('0x3')]])){utils[_0x1c54('0x9')](util[_0x1c54('0xb')]('[%s][dials][dialbegin]',_0x58ffb7[_0x1c54('0x3')]),_0x58ffb7);dials[_0x58ffb7[_0x1c54('0x3')]]=_[_0x1c54('0x1b')](dials[_0x58ffb7[_0x1c54('0x3')]],_0x58ffb7);dials[_0x58ffb7[_0x1c54('0x3')]][_0x1c54('0x1c')]=utils[_0x1c54('0x1d')]();dials[_0x58ffb7[_0x1c54('0x3')]][_0x1c54('0x1e')]=_0x1c54('0x1f');utils['info'](util[_0x1c54('0xb')](_0x1c54('0x20'),_0x58ffb7[_0x1c54('0x3')],dials[_0x58ffb7[_0x1c54('0x3')]][_0x1c54('0x1c')]));}}catch(_0x309f08){utils[_0x1c54('0x11')](util[_0x1c54('0xb')](_0x1c54('0x21'),_0x58ffb7['uniqueid']),_0x309f08);}};exports[_0x1c54('0x22')]=function(_0x1ae24d){try{if(!_['isNil'](dials[_0x1ae24d['uniqueid']])){utils[_0x1c54('0x9')](util[_0x1c54('0xb')]('[%s][dials][dialend]',_0x1ae24d['uniqueid']),_0x1ae24d);dials[_0x1ae24d['uniqueid']][_0x1c54('0x23')]=_0x1ae24d[_0x1c54('0x23')];if(_0x1ae24d['dialstatus']==_0x1c54('0x24')){dials[_0x1ae24d[_0x1c54('0x3')]]=_[_0x1c54('0x1b')](dials[_0x1ae24d[_0x1c54('0x3')]],_0x1ae24d);dials[_0x1ae24d[_0x1c54('0x3')]][_0x1c54('0x25')]=utils['now']();dials[_0x1ae24d['uniqueid']][_0x1c54('0x1e')]=_0x1c54('0x26');utils[_0x1c54('0x16')](util[_0x1c54('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1ae24d['uniqueid'],_0x1ae24d[_0x1c54('0x23')],dials[_0x1ae24d[_0x1c54('0x3')]][_0x1c54('0x25')]));}else{utils[_0x1c54('0x16')](util[_0x1c54('0xb')](_0x1c54('0x27'),_0x1ae24d['uniqueid'],_0x1ae24d[_0x1c54('0x23')]));}}}catch(_0x39af9c){utils[_0x1c54('0x11')](util[_0x1c54('0xb')](_0x1c54('0x28'),_0x1ae24d[_0x1c54('0x3')]),_0x39af9c);}};exports[_0x1c54('0x29')]=function(_0x47e201){try{if(!_[_0x1c54('0x13')](dials[_0x47e201['uniqueid']])){utils[_0x1c54('0x9')](util['format']('[%s][dials][hangup]',_0x47e201[_0x1c54('0x3')]),_0x47e201);utils[_0x1c54('0x16')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x47e201[_0x1c54('0x3')],_0x47e201[_0x1c54('0x2a')],_0x47e201[_0x1c54('0x2b')],_0x47e201[_0x1c54('0x2c')]));dials[_0x47e201[_0x1c54('0x3')]]=_[_0x1c54('0x1b')](dials[_0x47e201[_0x1c54('0x3')]],{'endtime':utils[_0x1c54('0x1d')](),'lastevent':'complete'});dials[_0x47e201['uniqueid']][_0x1c54('0x2d')]=utils[_0x1c54('0x2e')](dials[_0x47e201[_0x1c54('0x3')]]['endtime'],dials[_0x47e201[_0x1c54('0x3')]][_0x1c54('0x1c')]);dials[_0x47e201[_0x1c54('0x3')]]['holdtime']=utils[_0x1c54('0x2e')](dials[_0x47e201[_0x1c54('0x3')]]['answertime']||dials[_0x47e201[_0x1c54('0x3')]][_0x1c54('0x2f')],dials[_0x47e201[_0x1c54('0x3')]][_0x1c54('0x1c')]);dials[_0x47e201[_0x1c54('0x3')]]['billableseconds']=dials[_0x47e201[_0x1c54('0x3')]][_0x1c54('0x25')]?utils['diffTime'](dials[_0x47e201[_0x1c54('0x3')]][_0x1c54('0x2f')],dials[_0x47e201['uniqueid']][_0x1c54('0x25')]):0x0;writeDB(dials[_0x47e201['uniqueid']]);}}catch(_0x415e3a){utils[_0x1c54('0x11')](util[_0x1c54('0xb')](_0x1c54('0x30'),_0x47e201['uniqueid']),_0x415e3a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index be90483..f2fe2f0 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 _0x8173=['info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected'];(function(_0x461093,_0xb7f5ca){var _0x34f967=function(_0x153632){while(--_0x153632){_0x461093['push'](_0x461093['shift']());}};_0x34f967(++_0xb7f5ca);}(_0x8173,0x79));var _0x3817=function(_0x2a4f98,_0x497daf){_0x2a4f98=_0x2a4f98-0x0;var _0x301383=_0x8173[_0x2a4f98];return _0x301383;};var AsteriskManager=require(_0x3817('0x0'));var config=require(_0x3817('0x1'));var utils=require('./utils');var util=require(_0x3817('0x2'));var isXDREnabled=config[_0x3817('0x3')]&&config[_0x3817('0x3')][_0x3817('0x4')]?!config['xdr'][_0x3817('0x4')]:!![];var isProduction=config[_0x3817('0x5')]===_0x3817('0x6')||![];var isLocalAsterisk=config[_0x3817('0x3')]&&config[_0x3817('0x3')][_0x3817('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x3817('0x8')][_0x3817('0x9')],config['asterisk']['ip'],config[_0x3817('0x8')][_0x3817('0xa')],config[_0x3817('0x8')][_0x3817('0xb')],!![]);ami[_0x3817('0xc')]();if(!isXDREnabled){utils[_0x3817('0xd')](_0x3817('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x3817('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x3817('0xf'));var queues=require('./queues.controller');var recordings=require(_0x3817('0x10'));var members=require(_0x3817('0x11'));var dials=require(_0x3817('0x12'));var transfers=require(_0x3817('0x13'));var core=require(_0x3817('0x14'));ami['on'](_0x3817('0x15'),core[_0x3817('0x15')]);ami['on'](_0x3817('0x16'),core[_0x3817('0x16')]);ami['on'](_0x3817('0x17'),core[_0x3817('0x17')]);ami['on'](_0x3817('0x18'),core[_0x3817('0x18')]);ami['on']('close',core['close']);ami['on'](_0x3817('0x19'),core['managerevent']);ami['on'](_0x3817('0x1a'),function(_0xedff96){try{utils[_0x3817('0x1b')](util['format'](_0x3817('0x1c'),_0xedff96[_0x3817('0x1d')]),_0xedff96);members[_0x3817('0x1a')](_0xedff96);}catch(_0x29dcf1){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x1c'),_0xedff96['device']),_0x29dcf1);}});ami['on'](_0x3817('0x1f'),function(_0x3e5c0){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')]('[%s][index][agentcalled]',_0x3e5c0['uniqueid']),_0x3e5c0);agents[_0x3817('0x1f')](_0x3e5c0);}catch(_0x4864ee){utils['error'](util[_0x3817('0x1e')]('[%s][index][agentcalled]',_0x3e5c0['uniqueid']),_0x4864ee);}});ami['on'](_0x3817('0x20'),function(_0x14286c){try{utils['debug'](util['format'](_0x3817('0x21'),_0x14286c[_0x3817('0x22')]),_0x14286c);agents[_0x3817('0x20')](_0x14286c);}catch(_0x1acd39){utils[_0x3817('0x18')](util['format'](_0x3817('0x21'),_0x14286c[_0x3817('0x22')]),_0x1acd39);}});ami['on'](_0x3817('0x23'),function(_0x397a26){try{utils['debug'](util[_0x3817('0x1e')](_0x3817('0x24'),_0x397a26[_0x3817('0x22')]),_0x397a26);agents[_0x3817('0x23')](_0x397a26);queues[_0x3817('0x23')](_0x397a26);}catch(_0x43d8c3){utils[_0x3817('0x18')](util['format'](_0x3817('0x24'),_0x397a26['uniqueid']),_0x43d8c3);}});ami['on'](_0x3817('0x25'),function(_0x4a6754){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')]('[%s][index][agentcomplete]',_0x4a6754['uniqueid']),_0x4a6754);agents['agentcomplete'](_0x4a6754);queues[_0x3817('0x25')](_0x4a6754);members[_0x3817('0x25')](_0x4a6754);}catch(_0x20fa7b){utils[_0x3817('0x18')](util[_0x3817('0x1e')]('[%s][index][agentcomplete]',_0x4a6754[_0x3817('0x22')]),_0x20fa7b);}});ami['on'](_0x3817('0x26'),function(_0x26589e){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x27'),_0x26589e[_0x3817('0x22')]),_0x26589e);agents[_0x3817('0x26')](_0x26589e);queues[_0x3817('0x26')](_0x26589e);}catch(_0x4b3adb){utils[_0x3817('0x18')](util[_0x3817('0x1e')]('[%s][index][queuecallerabandon]',_0x26589e[_0x3817('0x22')]),_0x4b3adb);}});ami['on'](_0x3817('0x28'),function(_0x11ed36){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x29'),_0x11ed36['uniqueid']),_0x11ed36);queues[_0x3817('0x28')](_0x11ed36);recordings[_0x3817('0x28')](_0x11ed36);}catch(_0x77da7c){utils['error'](util[_0x3817('0x1e')]('[%s][index][queuecallerjoin]',_0x11ed36[_0x3817('0x22')]),_0x77da7c);}});ami['on'](_0x3817('0x2a'),function(_0x96bda4){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x2b'),_0x96bda4[_0x3817('0x22')]),_0x96bda4);queues[_0x3817('0x2a')](_0x96bda4);}catch(_0x381b70){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x2b'),_0x96bda4[_0x3817('0x22')]),_0x381b70);}});ami['on']('musiconholdstart',function(_0x22f3ff){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x2c'),_0x22f3ff[_0x3817('0x22')]),_0x22f3ff);queues['musiconholdstart'](_0x22f3ff);calls[_0x3817('0x2d')](_0x22f3ff);}catch(_0x53dd98){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x2c'),_0x22f3ff['uniqueid']),_0x53dd98);}});ami['on']('musiconholdstop',function(_0x4446bb){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x2e'),_0x4446bb['uniqueid']),_0x4446bb);queues[_0x3817('0x2f')](_0x4446bb);calls[_0x3817('0x2f')](_0x4446bb);}catch(_0x1de4ab){utils['error'](util[_0x3817('0x1e')](_0x3817('0x2e'),_0x4446bb[_0x3817('0x22')]),_0x1de4ab);}});ami['on'](_0x3817('0x30'),function(_0x566fd1){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')]('[%s][index][newstate]',_0x566fd1[_0x3817('0x22')]),_0x566fd1);calls['newstate'](_0x566fd1);recordings[_0x3817('0x30')](_0x566fd1);}catch(_0x11b647){utils['error'](util[_0x3817('0x1e')]('[%s][index][newstate]',_0x566fd1[_0x3817('0x22')]),_0x11b647);}});ami['on']('hangup',function(_0x396054){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x31'),_0x396054['uniqueid']),_0x396054);calls[_0x3817('0x32')](_0x396054);recordings[_0x3817('0x32')](_0x396054);dials[_0x3817('0x32')](_0x396054);agents[_0x3817('0x32')](_0x396054);queues[_0x3817('0x32')](_0x396054);}catch(_0x2e3d2b){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x31'),_0x396054['uniqueid']),_0x2e3d2b);}});ami['on'](_0x3817('0x33'),function(_0x28d5e0){try{utils['debug'](util[_0x3817('0x1e')](_0x3817('0x34'),_0x28d5e0[_0x3817('0x22')]),_0x28d5e0);members[_0x3817('0x33')](_0x28d5e0);}catch(_0x43df1d){utils['error'](util[_0x3817('0x1e')]('[%s][index][cdr]',_0x28d5e0[_0x3817('0x22')]),_0x43df1d);}});ami['on']('blindtransfer',function(_0x42a39d){try{utils['debug'](util[_0x3817('0x1e')](_0x3817('0x35'),_0x42a39d[_0x3817('0x22')]),_0x42a39d);queues[_0x3817('0x36')](_0x42a39d);agents['blindtransfer'](_0x42a39d);transfers[_0x3817('0x36')](_0x42a39d);}catch(_0x476c7c){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x35'),_0x42a39d[_0x3817('0x22')]),_0x476c7c);}});ami['on'](_0x3817('0x37'),function(_0x329a7e){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x38'),_0x329a7e['origtransfereruniqueid']),_0x329a7e);queues[_0x3817('0x37')](_0x329a7e);transfers[_0x3817('0x37')](_0x329a7e);agents[_0x3817('0x37')](_0x329a7e);calls[_0x3817('0x37')](_0x329a7e);}catch(_0x1fb96d){utils[_0x3817('0x18')](util['format'](_0x3817('0x38'),_0x329a7e['origtransfereruniqueid']),_0x1fb96d);}});ami['on']('varset',function(_0x46997e){try{utils['debug'](util[_0x3817('0x1e')](_0x3817('0x39'),_0x46997e[_0x3817('0x22')]),_0x46997e);queues[_0x3817('0x3a')](_0x46997e);recordings[_0x3817('0x3a')](_0x46997e);calls['varset'](_0x46997e);dials[_0x3817('0x3a')](_0x46997e);}catch(_0x10a60a){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x39'),_0x46997e['uniqueid']),_0x10a60a);}});ami['on'](_0x3817('0x3b'),function(_0x4b9ec1){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x3c'),_0x4b9ec1[_0x3817('0x22')]),_0x4b9ec1);calls[_0x3817('0x3b')](_0x4b9ec1);recordings[_0x3817('0x3b')](_0x4b9ec1);dials['newexten'](_0x4b9ec1);}catch(_0x290725){utils[_0x3817('0x18')](util['format'](_0x3817('0x3c'),_0x4b9ec1[_0x3817('0x22')]),_0x290725);}});ami['on'](_0x3817('0x3d'),function(_0x17d3d2){try{utils['debug'](util[_0x3817('0x1e')](_0x3817('0x3e'),_0x17d3d2['uniqueid']),_0x17d3d2);calls[_0x3817('0x3d')](_0x17d3d2);recordings['newchannel'](_0x17d3d2);}catch(_0x2d0944){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x3e'),_0x17d3d2['uniqueid']),_0x2d0944);}});ami['on']('dialbegin',function(_0x5863c3){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x3f'),_0x5863c3[_0x3817('0x22')]),_0x5863c3);dials[_0x3817('0x40')](_0x5863c3);}catch(_0x5ea934){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x41'),_0x5863c3[_0x3817('0x22')]),_0x5ea934);}});ami['on']('dialend',function(_0x533260){try{utils[_0x3817('0x1b')](util[_0x3817('0x1e')](_0x3817('0x42'),_0x533260[_0x3817('0x22')]),_0x533260);dials['dialend'](_0x533260);}catch(_0x4876f0){utils[_0x3817('0x18')](util[_0x3817('0x1e')](_0x3817('0x42'),_0x533260[_0x3817('0x22')]),_0x4876f0);}});} \ No newline at end of file +var _0xf2ba=['agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','fullybooted','error','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]'];(function(_0x36d03b,_0x2a77a6){var _0x2f1b02=function(_0x20c488){while(--_0x20c488){_0x36d03b['push'](_0x36d03b['shift']());}};_0x2f1b02(++_0x2a77a6);}(_0xf2ba,0xab));var _0xaf2b=function(_0x4225aa,_0x582bf2){_0x4225aa=_0x4225aa-0x0;var _0x3f8fab=_0xf2ba[_0x4225aa];return _0x3f8fab;};var AsteriskManager=require(_0xaf2b('0x0'));var config=require(_0xaf2b('0x1'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0xaf2b('0x2')]&&config[_0xaf2b('0x2')]['disabled']?!config['xdr'][_0xaf2b('0x3')]:!![];var isProduction=config[_0xaf2b('0x4')]===_0xaf2b('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0xaf2b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xaf2b('0x7')][_0xaf2b('0x8')],config['asterisk']['ip'],config[_0xaf2b('0x7')][_0xaf2b('0x9')],config['asterisk']['password'],!![]);ami[_0xaf2b('0xa')]();if(!isXDREnabled){utils[_0xaf2b('0xb')](_0xaf2b('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xaf2b('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xaf2b('0xd'));var calls=require(_0xaf2b('0xe'));var queues=require(_0xaf2b('0xf'));var recordings=require('./recordings.controller');var members=require(_0xaf2b('0x10'));var dials=require(_0xaf2b('0x11'));var transfers=require(_0xaf2b('0x12'));var core=require(_0xaf2b('0x13'));ami['on']('connect',core['connect']);ami['on']('shutdown',core['shutdown']);ami['on'](_0xaf2b('0x14'),core[_0xaf2b('0x14')]);ami['on']('error',core[_0xaf2b('0x15')]);ami['on']('close',core['close']);ami['on'](_0xaf2b('0x16'),core[_0xaf2b('0x16')]);ami['on'](_0xaf2b('0x17'),function(_0x47c8aa){try{utils['debug'](util[_0xaf2b('0x18')](_0xaf2b('0x19'),_0x47c8aa[_0xaf2b('0x1a')]),_0x47c8aa);members[_0xaf2b('0x17')](_0x47c8aa);}catch(_0x41f6c2){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x19'),_0x47c8aa[_0xaf2b('0x1a')]),_0x41f6c2);}});ami['on'](_0xaf2b('0x1b'),function(_0x257bdb){try{utils['debug'](util[_0xaf2b('0x18')](_0xaf2b('0x1c'),_0x257bdb[_0xaf2b('0x1d')]),_0x257bdb);agents[_0xaf2b('0x1b')](_0x257bdb);}catch(_0xc1f62d){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x1c'),_0x257bdb['uniqueid']),_0xc1f62d);}});ami['on'](_0xaf2b('0x1e'),function(_0x22d78b){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x20'),_0x22d78b['uniqueid']),_0x22d78b);agents[_0xaf2b('0x1e')](_0x22d78b);}catch(_0x5bdff1){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')]('[%s][index][agentringnoanswer]',_0x22d78b[_0xaf2b('0x1d')]),_0x5bdff1);}});ami['on']('agentconnect',function(_0x4aef8c){try{utils['debug'](util[_0xaf2b('0x18')](_0xaf2b('0x21'),_0x4aef8c[_0xaf2b('0x1d')]),_0x4aef8c);agents[_0xaf2b('0x22')](_0x4aef8c);queues['agentconnect'](_0x4aef8c);}catch(_0x200575){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x21'),_0x4aef8c['uniqueid']),_0x200575);}});ami['on']('agentcomplete',function(_0x28e9cf){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x23'),_0x28e9cf['uniqueid']),_0x28e9cf);agents[_0xaf2b('0x24')](_0x28e9cf);queues['agentcomplete'](_0x28e9cf);members[_0xaf2b('0x24')](_0x28e9cf);}catch(_0x4ebb86){utils['error'](util[_0xaf2b('0x18')](_0xaf2b('0x23'),_0x28e9cf[_0xaf2b('0x1d')]),_0x4ebb86);}});ami['on'](_0xaf2b('0x25'),function(_0x2f5974){try{utils['debug'](util[_0xaf2b('0x18')](_0xaf2b('0x26'),_0x2f5974[_0xaf2b('0x1d')]),_0x2f5974);agents[_0xaf2b('0x25')](_0x2f5974);queues[_0xaf2b('0x25')](_0x2f5974);}catch(_0x245e67){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x26'),_0x2f5974[_0xaf2b('0x1d')]),_0x245e67);}});ami['on'](_0xaf2b('0x27'),function(_0x5362bd){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')]('[%s][index][queuecallerjoin]',_0x5362bd[_0xaf2b('0x1d')]),_0x5362bd);queues[_0xaf2b('0x27')](_0x5362bd);recordings[_0xaf2b('0x27')](_0x5362bd);}catch(_0x2f76a8){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x28'),_0x5362bd[_0xaf2b('0x1d')]),_0x2f76a8);}});ami['on'](_0xaf2b('0x29'),function(_0x28dfb9){try{utils['debug'](util[_0xaf2b('0x18')](_0xaf2b('0x2a'),_0x28dfb9[_0xaf2b('0x1d')]),_0x28dfb9);queues[_0xaf2b('0x29')](_0x28dfb9);}catch(_0x3bea71){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x2a'),_0x28dfb9[_0xaf2b('0x1d')]),_0x3bea71);}});ami['on'](_0xaf2b('0x2b'),function(_0x477962){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x2c'),_0x477962[_0xaf2b('0x1d')]),_0x477962);queues[_0xaf2b('0x2b')](_0x477962);calls['musiconholdstart'](_0x477962);}catch(_0x5217bf){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x2c'),_0x477962[_0xaf2b('0x1d')]),_0x5217bf);}});ami['on'](_0xaf2b('0x2d'),function(_0x2ec2f6){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x2e'),_0x2ec2f6[_0xaf2b('0x1d')]),_0x2ec2f6);queues[_0xaf2b('0x2d')](_0x2ec2f6);calls[_0xaf2b('0x2d')](_0x2ec2f6);}catch(_0x1628c2){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x2e'),_0x2ec2f6[_0xaf2b('0x1d')]),_0x1628c2);}});ami['on'](_0xaf2b('0x2f'),function(_0x18fd1b){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x30'),_0x18fd1b['uniqueid']),_0x18fd1b);calls['newstate'](_0x18fd1b);recordings[_0xaf2b('0x2f')](_0x18fd1b);}catch(_0x31cb8f){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x30'),_0x18fd1b[_0xaf2b('0x1d')]),_0x31cb8f);}});ami['on'](_0xaf2b('0x31'),function(_0x479ba5){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x32'),_0x479ba5[_0xaf2b('0x1d')]),_0x479ba5);calls[_0xaf2b('0x31')](_0x479ba5);recordings[_0xaf2b('0x31')](_0x479ba5);dials[_0xaf2b('0x31')](_0x479ba5);agents[_0xaf2b('0x31')](_0x479ba5);queues[_0xaf2b('0x31')](_0x479ba5);}catch(_0x1b5f06){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')]('[%s][index][hangup]',_0x479ba5['uniqueid']),_0x1b5f06);}});ami['on']('cdr',function(_0x198480){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x33'),_0x198480[_0xaf2b('0x1d')]),_0x198480);members[_0xaf2b('0x34')](_0x198480);}catch(_0x4bc214){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')]('[%s][index][cdr]',_0x198480[_0xaf2b('0x1d')]),_0x4bc214);}});ami['on'](_0xaf2b('0x35'),function(_0x57b31b){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x36'),_0x57b31b[_0xaf2b('0x1d')]),_0x57b31b);queues['blindtransfer'](_0x57b31b);agents[_0xaf2b('0x35')](_0x57b31b);transfers[_0xaf2b('0x35')](_0x57b31b);}catch(_0x3ff32e){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x36'),_0x57b31b[_0xaf2b('0x1d')]),_0x3ff32e);}});ami['on'](_0xaf2b('0x37'),function(_0x12094b){try{utils[_0xaf2b('0x1f')](util['format'](_0xaf2b('0x38'),_0x12094b[_0xaf2b('0x39')]),_0x12094b);queues[_0xaf2b('0x37')](_0x12094b);transfers['attendedtransfer'](_0x12094b);agents['attendedtransfer'](_0x12094b);calls['attendedtransfer'](_0x12094b);}catch(_0x13c1de){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x38'),_0x12094b[_0xaf2b('0x39')]),_0x13c1de);}});ami['on']('varset',function(_0x1217f1){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x3a'),_0x1217f1[_0xaf2b('0x1d')]),_0x1217f1);queues[_0xaf2b('0x3b')](_0x1217f1);recordings[_0xaf2b('0x3b')](_0x1217f1);calls['varset'](_0x1217f1);dials[_0xaf2b('0x3b')](_0x1217f1);}catch(_0x52cd73){utils[_0xaf2b('0x15')](util['format'](_0xaf2b('0x3a'),_0x1217f1[_0xaf2b('0x1d')]),_0x52cd73);}});ami['on'](_0xaf2b('0x3c'),function(_0x21d611){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')]('[%s][index][newexten]',_0x21d611[_0xaf2b('0x1d')]),_0x21d611);calls[_0xaf2b('0x3c')](_0x21d611);recordings[_0xaf2b('0x3c')](_0x21d611);dials['newexten'](_0x21d611);}catch(_0x148ddd){utils['error'](util[_0xaf2b('0x18')](_0xaf2b('0x3d'),_0x21d611[_0xaf2b('0x1d')]),_0x148ddd);}});ami['on'](_0xaf2b('0x3e'),function(_0x59362c){try{utils[_0xaf2b('0x1f')](util['format'](_0xaf2b('0x3f'),_0x59362c[_0xaf2b('0x1d')]),_0x59362c);calls['newchannel'](_0x59362c);recordings['newchannel'](_0x59362c);}catch(_0x4dea08){utils['error'](util[_0xaf2b('0x18')](_0xaf2b('0x3f'),_0x59362c[_0xaf2b('0x1d')]),_0x4dea08);}});ami['on'](_0xaf2b('0x40'),function(_0x2993db){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x41'),_0x2993db[_0xaf2b('0x1d')]),_0x2993db);dials[_0xaf2b('0x40')](_0x2993db);}catch(_0x1bac4d){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x42'),_0x2993db['uniqueid']),_0x1bac4d);}});ami['on'](_0xaf2b('0x43'),function(_0x3040ea){try{utils[_0xaf2b('0x1f')](util[_0xaf2b('0x18')](_0xaf2b('0x44'),_0x3040ea['uniqueid']),_0x3040ea);dials['dialend'](_0x3040ea);}catch(_0x3418dd){utils[_0xaf2b('0x15')](util[_0xaf2b('0x18')](_0xaf2b('0x44'),_0x3040ea[_0xaf2b('0x1d')]),_0x3418dd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 872fe04..d2dd98f 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 _0x6697=['request','CreateMemberReport','getUserByName','catch','error','format','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','isNil','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','assign','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','membername','name','internal'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0x6697,0x1c3));var _0x7669=function(_0x2db315,_0x58d720){_0x2db315=_0x2db315-0x0;var _0x12f9a2=_0x6697[_0x2db315];return _0x12f9a2;};'use strict';var _=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var utils=require(_0x7669('0x2'));var members={};var exclude=[_0x7669('0x3'),_0x7669('0x4')];function writeDB(_0x188a6e){utils[_0x7669('0x5')](util['format'](_0x7669('0x6'),_0x188a6e[_0x7669('0x7')],_0x188a6e[_0x7669('0x8')],_0x188a6e[_0x7669('0x9')],_0x188a6e[_0x7669('0xa')],_0x188a6e['membername'],_0x188a6e[_0x7669('0xb')]));if(_0x188a6e[_0x7669('0x8')]){utils[_0x7669('0xc')](_0x188a6e[_0x7669('0x8')])[_0x7669('0xd')](function(_0x1312f3){if(_0x1312f3){_0x188a6e[_0x7669('0xe')]=_0x1312f3[_0x7669('0xf')];_0x188a6e[_0x7669('0x10')]=_0x1312f3['internal'];utils[_0x7669('0x11')](_0x7669('0x12'),_0x188a6e);}else{utils[_0x7669('0x13')](_0x188a6e[_0x7669('0x8')]['split']('/')[0x1])[_0x7669('0xd')](function(_0x1ae039){if(_0x1ae039){_0x188a6e['membername']=_0x1ae039['name'];_0x188a6e[_0x7669('0x10')]=_0x1ae039[_0x7669('0x10')];utils['request']('CreateMemberReport',_0x188a6e);}});}})[_0x7669('0x14')](function(_0x59d82c){utils[_0x7669('0x15')](util[_0x7669('0x16')]('[%s][members][writeDB]',_0x188a6e['uniqueid']),_0x59d82c);});}delete members[_0x188a6e[_0x7669('0x8')]];}function startsWith(_0x1afed0,_0x2bfc93){return _[_0x7669('0x17')](_0x1afed0,function(_0x4c22d2){return _['startsWith'](_0x2bfc93,_0x4c22d2);});}exports[_0x7669('0x18')]=function(_0x548b14){try{utils[_0x7669('0x19')](util[_0x7669('0x16')](_0x7669('0x1a'),members[_0x548b14[_0x7669('0x1b')]]?members[_0x548b14['device']][_0x7669('0x7')]:_0x548b14[_0x7669('0x1b')]),_0x548b14);utils[_0x7669('0x5')](util[_0x7669('0x16')](_0x7669('0x1c'),members[_0x548b14['device']]?members[_0x548b14[_0x7669('0x1b')]]['uniqueid']:_0x548b14[_0x7669('0x1b')],_0x548b14[_0x7669('0x1d')],_0x548b14[_0x7669('0x1b')]));switch(_0x548b14[_0x7669('0x1d')]){case _0x7669('0x1e'):case _0x7669('0x1f'):if(!startsWith(exclude,_0x548b14['device'])){members[_0x548b14['device']]={'channel':_0x7669('0x20'),'interface':_0x548b14[_0x7669('0x1b')],'type':'TALKING','enterAt':utils[_0x7669('0x21')](),'role':_0x7669('0x22')};}break;case'NOT_INUSE':if(!_[_0x7669('0x23')](members[_0x548b14['device']])){members[_0x548b14[_0x7669('0x1b')]]['exitAt']=utils[_0x7669('0x21')]();members[_0x548b14[_0x7669('0x1b')]]['duration']=utils[_0x7669('0x24')](members[_0x548b14['device']][_0x7669('0x25')],members[_0x548b14[_0x7669('0x1b')]][_0x7669('0x26')]);if(members[_0x548b14[_0x7669('0x1b')]]['uniqueid']){writeDB(members[_0x548b14[_0x7669('0x1b')]]);}}break;default:break;}}catch(_0x3e2f65){utils[_0x7669('0x15')](util[_0x7669('0x16')](_0x7669('0x1a'),members[_0x548b14['device']]?members[_0x548b14['device']][_0x7669('0x7')]:_0x548b14[_0x7669('0x1b')]),_0x3e2f65);}};exports['agentcomplete']=function(_0x2bdeea){try{if(!_['isNil'](members[_0x2bdeea[_0x7669('0x8')]])){utils[_0x7669('0x19')](util[_0x7669('0x16')](_0x7669('0x27'),_0x2bdeea[_0x7669('0x7')]),_0x2bdeea);utils['info'](util['format'](_0x7669('0x28'),_0x2bdeea[_0x7669('0x7')],_0x2bdeea['interface'],_0x2bdeea[_0x7669('0x29')]));members[_0x2bdeea[_0x7669('0x8')]]=_['assign'](members[_0x2bdeea[_0x7669('0x8')]],{'data4':_0x2bdeea[_0x7669('0x29')],'uniqueid':_0x2bdeea[_0x7669('0x7')]});}}catch(_0x53dd97){utils[_0x7669('0x15')](util[_0x7669('0x16')]('[%s][members][agentcomplete]',_0x2bdeea['uniqueid']),_0x53dd97);}};exports[_0x7669('0x2a')]=function(_0x132353){try{utils['debug'](util['format'](_0x7669('0x2b'),_0x132353['uniqueid']),_0x132353);if(_0x132353[_0x7669('0x9')]){var _0x2ac75b=_0x132353[_0x7669('0x9')][_0x7669('0x2c')]('-')[0x0];if(!_[_0x7669('0x23')](members[_0x2ac75b])){members[_0x2ac75b]=_['assign'](members[_0x2ac75b],{'data1':members[_0x2ac75b][_0x7669('0x2d')]||_0x132353[_0x7669('0xb')],'data2':members[_0x2ac75b][_0x7669('0xa')]||_0x132353[_0x7669('0x2e')],'data3':members[_0x2ac75b]['data3']||_0x132353['destination'],'uniqueid':members[_0x2ac75b][_0x7669('0x7')]||_0x132353[_0x7669('0x7')]});utils[_0x7669('0x5')](util[_0x7669('0x16')](_0x7669('0x2f'),_0x132353[_0x7669('0x7')],members[_0x2ac75b]['data1'],members[_0x2ac75b][_0x7669('0xa')],members[_0x2ac75b][_0x7669('0x30')]));if(members[_0x2ac75b][_0x7669('0x25')]){writeDB(members[_0x2ac75b]);}}}if(_0x132353[_0x7669('0x31')]){var _0x57ab94=_0x132353[_0x7669('0x31')][_0x7669('0x2c')]('-')[0x0];if(!_[_0x7669('0x23')](members[_0x57ab94])){members[_0x57ab94]=_[_0x7669('0x32')](members[_0x57ab94],{'data1':members[_0x57ab94][_0x7669('0x2d')]||_0x132353[_0x7669('0xb')],'data2':members[_0x57ab94][_0x7669('0xa')]||_0x132353[_0x7669('0x2e')],'data3':members[_0x57ab94][_0x7669('0x30')]||_0x132353[_0x7669('0x33')],'uniqueid':members[_0x57ab94][_0x7669('0x7')]||_0x132353[_0x7669('0x7')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x132353[_0x7669('0x7')],members[_0x57ab94][_0x7669('0x2d')],members[_0x57ab94][_0x7669('0xa')],members[_0x57ab94]['data3']));if(members[_0x57ab94][_0x7669('0x25')]){writeDB(members[_0x57ab94]);}}}}catch(_0x17bd47){utils[_0x7669('0x15')](util[_0x7669('0x16')]('[%s][members][cdr]',_0x132353[_0x7669('0x7')]),_0x17bd47);}}; \ No newline at end of file +var _0xc4a7=['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','type','then','name','internal','request','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','TALKING','agent','isNil','exitAt','now','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel'];(function(_0x11caac,_0x4edae3){var _0xf6a9d7=function(_0x1d73e9){while(--_0x1d73e9){_0x11caac['push'](_0x11caac['shift']());}};_0xf6a9d7(++_0x4edae3);}(_0xc4a7,0x132));var _0x7c4a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc4a7[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7c4a('0x0'));var util=require(_0x7c4a('0x1'));var utils=require(_0x7c4a('0x2'));var members={};var exclude=[_0x7c4a('0x3'),_0x7c4a('0x4')];function writeDB(_0x2b4f92){utils[_0x7c4a('0x5')](util[_0x7c4a('0x6')](_0x7c4a('0x7'),_0x2b4f92['uniqueid'],_0x2b4f92[_0x7c4a('0x8')],_0x2b4f92[_0x7c4a('0x9')],_0x2b4f92[_0x7c4a('0xa')],_0x2b4f92[_0x7c4a('0xb')],_0x2b4f92[_0x7c4a('0xc')]));if(_0x2b4f92[_0x7c4a('0x8')]){utils['getUserByInterface'](_0x2b4f92[_0x7c4a('0x8')])[_0x7c4a('0xd')](function(_0x462552){if(_0x462552){_0x2b4f92[_0x7c4a('0xb')]=_0x462552[_0x7c4a('0xe')];_0x2b4f92[_0x7c4a('0xf')]=_0x462552['internal'];utils[_0x7c4a('0x10')](_0x7c4a('0x11'),_0x2b4f92);}else{utils['getUserByName'](_0x2b4f92[_0x7c4a('0x8')]['split']('/')[0x1])[_0x7c4a('0xd')](function(_0x21b86d){if(_0x21b86d){_0x2b4f92['membername']=_0x21b86d[_0x7c4a('0xe')];_0x2b4f92['internal']=_0x21b86d[_0x7c4a('0xf')];utils['request'](_0x7c4a('0x11'),_0x2b4f92);}});}})[_0x7c4a('0x12')](function(_0x444afd){utils[_0x7c4a('0x13')](util[_0x7c4a('0x6')](_0x7c4a('0x14'),_0x2b4f92['uniqueid']),_0x444afd);});}delete members[_0x2b4f92['interface']];}function startsWith(_0x3c60bc,_0x161d09){return _[_0x7c4a('0x15')](_0x3c60bc,function(_0x1a5578){return _[_0x7c4a('0x16')](_0x161d09,_0x1a5578);});}exports[_0x7c4a('0x17')]=function(_0x35bf34){try{utils[_0x7c4a('0x18')](util['format'](_0x7c4a('0x19'),members[_0x35bf34[_0x7c4a('0x1a')]]?members[_0x35bf34['device']][_0x7c4a('0x1b')]:_0x35bf34[_0x7c4a('0x1a')]),_0x35bf34);utils[_0x7c4a('0x5')](util[_0x7c4a('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x35bf34[_0x7c4a('0x1a')]]?members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x1b')]:_0x35bf34[_0x7c4a('0x1a')],_0x35bf34[_0x7c4a('0x1c')],_0x35bf34[_0x7c4a('0x1a')]));switch(_0x35bf34[_0x7c4a('0x1c')]){case _0x7c4a('0x1d'):case'BUSY':if(!startsWith(exclude,_0x35bf34['device'])){members[_0x35bf34[_0x7c4a('0x1a')]]={'channel':'voice','interface':_0x35bf34[_0x7c4a('0x1a')],'type':_0x7c4a('0x1e'),'enterAt':utils['now'](),'role':_0x7c4a('0x1f')};}break;case'NOT_INUSE':if(!_[_0x7c4a('0x20')](members[_0x35bf34[_0x7c4a('0x1a')]])){members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x21')]=utils[_0x7c4a('0x22')]();members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x23')]=utils['diffTime'](members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x21')],members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x24')]);if(members[_0x35bf34[_0x7c4a('0x1a')]]['uniqueid']){writeDB(members[_0x35bf34[_0x7c4a('0x1a')]]);}}break;default:break;}}catch(_0x109b4f){utils['error'](util['format'](_0x7c4a('0x19'),members[_0x35bf34['device']]?members[_0x35bf34[_0x7c4a('0x1a')]][_0x7c4a('0x1b')]:_0x35bf34[_0x7c4a('0x1a')]),_0x109b4f);}};exports[_0x7c4a('0x25')]=function(_0xff967b){try{if(!_[_0x7c4a('0x20')](members[_0xff967b[_0x7c4a('0x8')]])){utils[_0x7c4a('0x18')](util[_0x7c4a('0x6')](_0x7c4a('0x26'),_0xff967b[_0x7c4a('0x1b')]),_0xff967b);utils['info'](util[_0x7c4a('0x6')](_0x7c4a('0x27'),_0xff967b['uniqueid'],_0xff967b[_0x7c4a('0x8')],_0xff967b[_0x7c4a('0x28')]));members[_0xff967b['interface']]=_[_0x7c4a('0x29')](members[_0xff967b[_0x7c4a('0x8')]],{'data4':_0xff967b['queue'],'uniqueid':_0xff967b[_0x7c4a('0x1b')]});}}catch(_0x129ff6){utils[_0x7c4a('0x13')](util[_0x7c4a('0x6')](_0x7c4a('0x26'),_0xff967b[_0x7c4a('0x1b')]),_0x129ff6);}};exports[_0x7c4a('0x2a')]=function(_0x32cee6){try{utils[_0x7c4a('0x18')](util[_0x7c4a('0x6')](_0x7c4a('0x2b'),_0x32cee6[_0x7c4a('0x1b')]),_0x32cee6);if(_0x32cee6[_0x7c4a('0x9')]){var _0x169613=_0x32cee6[_0x7c4a('0x9')][_0x7c4a('0x2c')]('-')[0x0];if(!_[_0x7c4a('0x20')](members[_0x169613])){members[_0x169613]=_[_0x7c4a('0x29')](members[_0x169613],{'data1':members[_0x169613][_0x7c4a('0x2d')]||_0x32cee6[_0x7c4a('0xc')],'data2':members[_0x169613][_0x7c4a('0xa')]||_0x32cee6[_0x7c4a('0x2e')],'data3':members[_0x169613][_0x7c4a('0x2f')]||_0x32cee6[_0x7c4a('0x30')],'uniqueid':members[_0x169613][_0x7c4a('0x1b')]||_0x32cee6[_0x7c4a('0x1b')]});utils[_0x7c4a('0x5')](util['format'](_0x7c4a('0x31'),_0x32cee6['uniqueid'],members[_0x169613]['data1'],members[_0x169613][_0x7c4a('0xa')],members[_0x169613]['data3']));if(members[_0x169613][_0x7c4a('0x21')]){writeDB(members[_0x169613]);}}}if(_0x32cee6['destinationchannel']){var _0x33414a=_0x32cee6[_0x7c4a('0x32')]['split']('-')[0x0];if(!_[_0x7c4a('0x20')](members[_0x33414a])){members[_0x33414a]=_[_0x7c4a('0x29')](members[_0x33414a],{'data1':members[_0x33414a][_0x7c4a('0x2d')]||_0x32cee6[_0x7c4a('0xc')],'data2':members[_0x33414a][_0x7c4a('0xa')]||_0x32cee6[_0x7c4a('0x2e')],'data3':members[_0x33414a]['data3']||_0x32cee6[_0x7c4a('0x30')],'uniqueid':members[_0x33414a][_0x7c4a('0x1b')]||_0x32cee6[_0x7c4a('0x1b')]});utils[_0x7c4a('0x5')](util[_0x7c4a('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x32cee6[_0x7c4a('0x1b')],members[_0x33414a]['data1'],members[_0x33414a][_0x7c4a('0xa')],members[_0x33414a][_0x7c4a('0x2f')]));if(members[_0x33414a][_0x7c4a('0x21')]){writeDB(members[_0x33414a]);}}}}catch(_0xe92c2e){utils['error'](util[_0x7c4a('0x6')](_0x7c4a('0x2b'),_0x32cee6['uniqueid']),_0xe92c2e);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0234b89..4ad7e76 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 _0xdab0=['holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','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','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','format','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','variable','queuestatus','toUpperCase','queuecallerabandonAt','value','queueposition','EXITWITHKEY','error','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerexitAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname'];(function(_0x340d01,_0x2080b2){var _0x1355de=function(_0x13f68d){while(--_0x13f68d){_0x340d01['push'](_0x340d01['shift']());}};_0x1355de(++_0x2080b2);}(_0xdab0,0x141));var _0x0dab=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdab0[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x0dab('0x0'));var util=require(_0x0dab('0x1'));var utils=require(_0x0dab('0x2'));var queues={};function writeDB(_0x1a64b4){utils[_0x0dab('0x3')](util['format'](_0x0dab('0x4'),_0x1a64b4[_0x0dab('0x5')],_0x1a64b4['channel'],_0x1a64b4[_0x0dab('0x6')],_0x1a64b4[_0x0dab('0x7')],_0x1a64b4[_0x0dab('0x8')],_0x1a64b4[_0x0dab('0x9')],_0x1a64b4[_0x0dab('0xa')]));if(_0x1a64b4[_0x0dab('0x6')]){utils[_0x0dab('0xb')](_0x1a64b4[_0x0dab('0x6')])[_0x0dab('0xc')](function(_0x389c94){if(_0x389c94){_0x1a64b4[_0x0dab('0xd')]=_0x389c94[_0x0dab('0xd')];}utils['request'](_0x0dab('0xe'),_0x1a64b4);});}else{utils[_0x0dab('0xf')](_0x0dab('0xe'),_0x1a64b4);}if(_0x1a64b4['transfereduniqueid']){delete queues[_0x1a64b4[_0x0dab('0x10')]];}else{delete queues[_0x1a64b4[_0x0dab('0x5')]];}}exports['queuecallerjoin']=function(_0x21a082){try{utils[_0x0dab('0x11')](util['format'](_0x0dab('0x12'),_0x21a082[_0x0dab('0x5')]),_0x21a082);utils[_0x0dab('0x3')](util['format'](_0x0dab('0x13'),_0x21a082['uniqueid'],_0x21a082[_0x0dab('0x6')],_0x21a082[_0x0dab('0x14')]));queues[_0x21a082[_0x0dab('0x5')]]=_[_0x0dab('0x15')](_0x21a082,{'originalposition':_0x21a082['position'],'queuecallerjoinAt':utils[_0x0dab('0x16')](),'mohtime':0x0});}catch(_0x59da){utils['error'](util['format'](_0x0dab('0x12'),_0x21a082['uniqueid']),_0x59da);}};exports[_0x0dab('0x17')]=function(_0x33acf5){try{if(!_[_0x0dab('0x18')](queues[_0x33acf5['uniqueid']])){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x1a'),_0x33acf5[_0x0dab('0x5')]),_0x33acf5);if(queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0x1b')]){if(!queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0x1c')]&&!queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0x1d')]){queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0x1e')]=!![];queues[_0x33acf5['uniqueid']][_0x0dab('0x1f')]=utils[_0x0dab('0x16')]();queues[_0x33acf5['uniqueid']][_0x0dab('0xa')]=_0x0dab('0x20');}utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x21'),_0x33acf5['uniqueid'],queues[_0x33acf5[_0x0dab('0x5')]]['name'],queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0xa')]));writeDB(queues[_0x33acf5[_0x0dab('0x5')]]);}else if(queues[_0x33acf5[_0x0dab('0x5')]]['transfereduniqueid']){utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x22'),_0x33acf5[_0x0dab('0x5')],queues[_0x33acf5[_0x0dab('0x5')]][_0x0dab('0x23')],queues[_0x33acf5['uniqueid']][_0x0dab('0x10')]));queues[queues[_0x33acf5[_0x0dab('0x5')]]['transfereduniqueid']]=queues[_0x33acf5[_0x0dab('0x5')]];queues[queues[_0x33acf5[_0x0dab('0x5')]]['transfereduniqueid']][_0x0dab('0x24')]=0x2;delete queues[_0x33acf5['uniqueid']];}}}catch(_0x504824){utils['error'](util[_0x0dab('0x19')](_0x0dab('0x1a'),_0x33acf5['uniqueid']),_0x504824);}};exports['varset']=function(_0x3f440f){try{utils[_0x0dab('0x11')](util[_0x0dab('0x19')]('[%s][queues][varset]',_0x3f440f['uniqueid']),_0x3f440f);if(!_[_0x0dab('0x18')](_0x3f440f[_0x0dab('0x25')][_0x0dab('0x26')])&&_0x3f440f['value'][_0x0dab('0x27')]()!=='CONTINUE'){if(!_[_0x0dab('0x18')](queues[_0x3f440f[_0x0dab('0x5')]])){queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x1c')]=![];queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x28')]=null;queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x1d')]=!![];queues[_0x3f440f[_0x0dab('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x3f440f['uniqueid']][_0x0dab('0xa')]=_0x3f440f[_0x0dab('0x29')]['toUpperCase']();utils[_0x0dab('0x3')](util[_0x0dab('0x19')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3f440f['uniqueid'],queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x23')],_0x3f440f[_0x0dab('0x29')],queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0xa')]));writeDB(queues[_0x3f440f[_0x0dab('0x5')]]);}}else if(!_[_0x0dab('0x18')](_0x3f440f[_0x0dab('0x25')][_0x0dab('0x2a')])){if(!_['isNil'](queues[_0x3f440f[_0x0dab('0x5')]])&&!queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x1c')]){queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x1c')]=![];queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x28')]=null;queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0x1d')]=!![];queues[_0x3f440f[_0x0dab('0x5')]]['queuecallerexitAt']=utils[_0x0dab('0x16')]();queues[_0x3f440f[_0x0dab('0x5')]][_0x0dab('0xa')]=_0x0dab('0x2b');utils[_0x0dab('0x3')](util[_0x0dab('0x19')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3f440f[_0x0dab('0x5')],queues[_0x3f440f['uniqueid']][_0x0dab('0x23')],_0x3f440f[_0x0dab('0x29')],queues[_0x3f440f['uniqueid']][_0x0dab('0xa')]));}}}catch(_0x247f5c){utils[_0x0dab('0x2c')](util['format'](_0x0dab('0x2d'),_0x3f440f['uniqueid']),_0x247f5c);}};exports['queuecallerabandon']=function(_0xdac2b6){try{if(!_[_0x0dab('0x18')](queues[_0xdac2b6[_0x0dab('0x5')]])){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x2e'),_0xdac2b6['uniqueid']),_0xdac2b6);queues[_0xdac2b6[_0x0dab('0x5')]][_0x0dab('0x1d')]=![];queues[_0xdac2b6['uniqueid']][_0x0dab('0x2f')]=null;queues[_0xdac2b6['uniqueid']]['queuecallerabandon']=!![];queues[_0xdac2b6['uniqueid']][_0x0dab('0x28')]=utils[_0x0dab('0x16')]();queues[_0xdac2b6[_0x0dab('0x5')]][_0x0dab('0xa')]='ABANDONED';utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x30'),_0xdac2b6[_0x0dab('0x5')],queues[_0xdac2b6[_0x0dab('0x5')]][_0x0dab('0x23')],queues[_0xdac2b6['uniqueid']][_0x0dab('0xa')]));}}catch(_0x85c63e){utils[_0x0dab('0x2c')](util[_0x0dab('0x19')](_0x0dab('0x2e'),_0xdac2b6['uniqueid']),_0x85c63e);}};exports['queuecallerleave']=function(_0x2db52f){try{if(!_[_0x0dab('0x18')](queues[_0x2db52f[_0x0dab('0x5')]])){utils[_0x0dab('0x11')](util['format']('[%s][queues][queuecallerleave]',_0x2db52f[_0x0dab('0x5')]),_0x2db52f);utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x31'),_0x2db52f[_0x0dab('0x5')],queues[_0x2db52f[_0x0dab('0x5')]][_0x0dab('0x23')],_0x2db52f[_0x0dab('0x32')],_0x2db52f[_0x0dab('0x33')]));queues[_0x2db52f[_0x0dab('0x5')]][_0x0dab('0x34')]=!![];queues[_0x2db52f[_0x0dab('0x5')]]['queuecallerleaveAt']=utils[_0x0dab('0x16')]();queues[_0x2db52f['uniqueid']]['holdtime']=utils[_0x0dab('0x35')](queues[_0x2db52f[_0x0dab('0x5')]][_0x0dab('0x1b')],queues[_0x2db52f['uniqueid']][_0x0dab('0x36')]);queues[_0x2db52f[_0x0dab('0x5')]]['position']=_0x2db52f[_0x0dab('0x14')];queues[_0x2db52f[_0x0dab('0x5')]]['count']=_0x2db52f[_0x0dab('0x37')];queues[_0x2db52f['uniqueid']]['connectedlinenum']=_0x2db52f[_0x0dab('0x32')];queues[_0x2db52f[_0x0dab('0x5')]]['connectedlinename']=_0x2db52f[_0x0dab('0x33')];}}catch(_0x47a555){utils['error'](util[_0x0dab('0x19')](_0x0dab('0x38'),_0x2db52f[_0x0dab('0x5')]),_0x47a555);}};exports[_0x0dab('0x39')]=function(_0xd39396){try{if(!_[_0x0dab('0x18')](queues[_0xd39396['uniqueid']])){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x3a'),_0xd39396[_0x0dab('0x5')]),_0xd39396);utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x3b'),_0xd39396[_0x0dab('0x5')],queues[_0xd39396[_0x0dab('0x5')]][_0x0dab('0x23')],_0xd39396['membername'],_0xd39396['destaccountcode']));queues[_0xd39396[_0x0dab('0x5')]]['queuecallerabandon']=![];queues[_0xd39396['uniqueid']]['queuecallerabandon']=![];queues[_0xd39396[_0x0dab('0x5')]][_0x0dab('0x28')]=null;queues[_0xd39396[_0x0dab('0x5')]][_0x0dab('0x1d')]=![];queues[_0xd39396[_0x0dab('0x5')]]['queuecallerexitreason']=null;queues[_0xd39396['uniqueid']][_0x0dab('0x2f')]=null;queues[_0xd39396[_0x0dab('0x5')]]['assigned']=!![];queues[_0xd39396[_0x0dab('0x5')]]['accountcode']=_0xd39396['destaccountcode'];queues[_0xd39396[_0x0dab('0x5')]][_0x0dab('0x7')]=_0xd39396[_0x0dab('0x3c')];}}catch(_0x13ebd1){utils['error'](util[_0x0dab('0x19')](_0x0dab('0x3a'),_0xd39396[_0x0dab('0x5')]),_0x13ebd1);}};exports[_0x0dab('0x3d')]=function(_0x35e34e){try{if(!_[_0x0dab('0x18')](queues[_0x35e34e[_0x0dab('0x5')]])){if(queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x1b')]){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x3e'),_0x35e34e[_0x0dab('0x5')]),_0x35e34e);queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x1c')]=![];queues[_0x35e34e['uniqueid']][_0x0dab('0x1c')]=![];queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x28')]=null;queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x1d')]=![];queues[_0x35e34e[_0x0dab('0x5')]]['queuecallerexitAt']=null;queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x3f')]=!![];queues[_0x35e34e['uniqueid']]['lastAssignedTo']=_0x35e34e[_0x0dab('0x3c')];queues[_0x35e34e['uniqueid']][_0x0dab('0x1e')]=!![];queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x1f')]=utils[_0x0dab('0x16')]();if(_0x35e34e[_0x0dab('0x40')]==_0x0dab('0x41')){if(!queues[_0x35e34e['uniqueid']][_0x0dab('0x41')]){queues[_0x35e34e['uniqueid']][_0x0dab('0xa')]=_0x0dab('0x42');}}else{queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0xa')]=_0x0dab('0x43')+_0x35e34e[_0x0dab('0x40')]['toUpperCase']();}utils[_0x0dab('0x3')](util['format'](_0x0dab('0x44'),_0x35e34e['uniqueid'],queues[_0x35e34e[_0x0dab('0x5')]][_0x0dab('0x23')],_0x35e34e[_0x0dab('0x3c')],queues[_0x35e34e[_0x0dab('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x35e34e[_0x0dab('0x5')]]);}}}catch(_0x5d670b){utils[_0x0dab('0x2c')](util[_0x0dab('0x19')]('[%s][queues][agentcomplete]',_0x35e34e['uniqueid']),_0x5d670b);}};exports['blindtransfer']=function(_0xa715a4){try{if(!_[_0x0dab('0x18')](queues[_0xa715a4[_0x0dab('0x45')]])){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x46'),_0xa715a4[_0x0dab('0x5')]),_0xa715a4);queues[_0xa715a4['transfereeuniqueid']][_0x0dab('0x41')]=!![];queues[_0xa715a4[_0x0dab('0x45')]][_0x0dab('0x47')]=_0x0dab('0x48');queues[_0xa715a4[_0x0dab('0x45')]][_0x0dab('0x49')]=_0xa715a4[_0x0dab('0x4a')];queues[_0xa715a4['transfereeuniqueid']][_0x0dab('0x4b')]=_0xa715a4[_0x0dab('0x45')];queues[_0xa715a4['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0x0dab('0x19')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xa715a4[_0x0dab('0x5')],queues[_0xa715a4['transfereeuniqueid']][_0x0dab('0x23')],_0xa715a4[_0x0dab('0x45')],_0xa715a4[_0x0dab('0x4a')]));}}catch(_0x5bb5ee){utils[_0x0dab('0x2c')](util['format'](_0x0dab('0x46'),_0xa715a4[_0x0dab('0x5')]),_0x5bb5ee);}};exports[_0x0dab('0x4c')]=function(_0x4d15a8){try{utils[_0x0dab('0x11')](util['format'](_0x0dab('0x4d'),_0x4d15a8[_0x0dab('0x4e')]),_0x4d15a8);if(_0x4d15a8['origtransfereruniqueid']==_0x4d15a8['origtransfererlinkedid']){if(!_[_0x0dab('0x18')](queues[_0x4d15a8[_0x0dab('0x4f')]])){utils[_0x0dab('0x3')](util[_0x0dab('0x19')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4d15a8[_0x0dab('0x4e')],queues[_0x4d15a8[_0x0dab('0x4f')]]['name'],_0x4d15a8[_0x0dab('0x50')]));queues[_0x4d15a8['secondtransfererlinkedid']][_0x0dab('0x41')]=!![];queues[_0x4d15a8[_0x0dab('0x4f')]][_0x0dab('0x47')]=_0x0dab('0x51');queues[_0x4d15a8[_0x0dab('0x4f')]]['transferexten']=_0x4d15a8['origtransfererexten'];queues[_0x4d15a8[_0x0dab('0x4f')]][_0x0dab('0x4b')]=_0x4d15a8['origtransfereruniqueid'];queues[_0x4d15a8[_0x0dab('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x0dab('0x18')](queues[_0x4d15a8[_0x0dab('0x52')]])){if(_0x4d15a8[_0x0dab('0x53')]&&queues[_0x4d15a8[_0x0dab('0x53')]]){queues[_0x4d15a8[_0x0dab('0x53')]][_0x0dab('0x24')]=0x1;queues[_0x4d15a8[_0x0dab('0x45')]]=_[_0x0dab('0x54')](queues[_0x4d15a8[_0x0dab('0x53')]]);queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x10')]=_0x4d15a8[_0x0dab('0x55')];queues[_0x4d15a8['transfereeuniqueid']][_0x0dab('0x24')]=0x2;queues[_0x4d15a8['transfereeuniqueid']][_0x0dab('0x8')]=queues[_0x4d15a8['secondtransfererlinkedid']]['calleridnum'];queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x56')]=queues[_0x4d15a8[_0x0dab('0x4f')]]['calleridname'];queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x36')]=utils['now']();queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x1b')]=utils[_0x0dab('0x16')]();queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x57')]=0x0;queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x58')]=0x0;utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x59'),_0x4d15a8[_0x0dab('0x4e')],queues[_0x4d15a8[_0x0dab('0x45')]]['name'],queues[_0x4d15a8['transfereeuniqueid']][_0x0dab('0x8')],queues[_0x4d15a8[_0x0dab('0x45')]][_0x0dab('0x56')]));}else{utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x5a'),_0x4d15a8[_0x0dab('0x4e')],queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x23')],_0x4d15a8[_0x0dab('0x4f')]));queues[_0x4d15a8['origtransfererlinkedid']][_0x0dab('0x10')]=_0x4d15a8[_0x0dab('0x4f')];}}}else if(_0x4d15a8[_0x0dab('0x5b')]==_0x4d15a8[_0x0dab('0x4f')]){if(!_[_0x0dab('0x18')](queues[_0x4d15a8['origtransfererlinkedid']])){utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x5c'),_0x4d15a8[_0x0dab('0x4e')],queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x23')],_0x4d15a8[_0x0dab('0x5b')],_0x4d15a8['secondtransfererexten']));queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x41')]=!![];queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x47')]='ATTENDED';queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x49')]=_0x4d15a8[_0x0dab('0x5d')];queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x4b')]=_0x4d15a8[_0x0dab('0x5b')];queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0xa')]=_0x0dab('0x5e');}if(!_[_0x0dab('0x18')](queues[_0x4d15a8['secondtransfererlinkedid']])){if(_0x4d15a8[_0x0dab('0x5f')]&&queues[_0x4d15a8[_0x0dab('0x5f')]]){queues[_0x4d15a8[_0x0dab('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x4d15a8[_0x0dab('0x55')]]=_[_0x0dab('0x54')](queues[_0x4d15a8[_0x0dab('0x5f')]]);queues[_0x4d15a8[_0x0dab('0x55')]]['transfereduniqueid']=_0x4d15a8[_0x0dab('0x55')];queues[_0x4d15a8['transfertargetuniqueid']][_0x0dab('0x24')]=0x2;queues[_0x4d15a8['transfertargetuniqueid']]['calleridnum']=queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x8')];queues[_0x4d15a8[_0x0dab('0x55')]][_0x0dab('0x56')]=queues[_0x4d15a8[_0x0dab('0x52')]][_0x0dab('0x56')];queues[_0x4d15a8['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x0dab('0x16')]();queues[_0x4d15a8['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x0dab('0x16')]();queues[_0x4d15a8[_0x0dab('0x55')]]['holdtime']=0x0;queues[_0x4d15a8[_0x0dab('0x55')]][_0x0dab('0x58')]=0x0;utils[_0x0dab('0x3')](util[_0x0dab('0x19')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4d15a8['origtransfereruniqueid'],queues[_0x4d15a8[_0x0dab('0x55')]][_0x0dab('0x23')],queues[_0x4d15a8['transfertargetuniqueid']][_0x0dab('0x10')],queues[_0x4d15a8[_0x0dab('0x55')]][_0x0dab('0x8')],queues[_0x4d15a8['transfertargetuniqueid']][_0x0dab('0x56')]));}else{utils['info'](util[_0x0dab('0x19')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4d15a8['origtransfereruniqueid'],queues[_0x4d15a8[_0x0dab('0x4f')]][_0x0dab('0x23')],_0x4d15a8['origtransfererlinkedid']));queues[_0x4d15a8[_0x0dab('0x4f')]][_0x0dab('0x10')]=_0x4d15a8[_0x0dab('0x52')];}}}}catch(_0x3a5ca1){utils[_0x0dab('0x2c')](util[_0x0dab('0x19')](_0x0dab('0x4d'),_0x4d15a8[_0x0dab('0x4e')]),_0x3a5ca1);}};exports[_0x0dab('0x60')]=function(_0x2f21bb){try{if(!_[_0x0dab('0x18')](queues[_0x2f21bb[_0x0dab('0x5')]])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x2f21bb[_0x0dab('0x5')]),_0x2f21bb);queues[_0x2f21bb[_0x0dab('0x5')]][_0x0dab('0x61')]=utils[_0x0dab('0x16')]();utils[_0x0dab('0x3')](util[_0x0dab('0x19')](_0x0dab('0x62'),_0x2f21bb[_0x0dab('0x5')],queues[_0x2f21bb['uniqueid']]['name'],queues[_0x2f21bb[_0x0dab('0x5')]][_0x0dab('0x61')]));}}catch(_0x1e9935){utils[_0x0dab('0x2c')](util[_0x0dab('0x19')]('[%s][queues][musiconholdstart]',_0x2f21bb['uniqueid']),_0x1e9935);}};exports[_0x0dab('0x63')]=function(_0x4a340f){try{if(!_[_0x0dab('0x18')](queues[_0x4a340f[_0x0dab('0x5')]])){if(!_[_0x0dab('0x18')](queues[_0x4a340f[_0x0dab('0x5')]][_0x0dab('0x61')])){utils[_0x0dab('0x11')](util[_0x0dab('0x19')](_0x0dab('0x64'),_0x4a340f[_0x0dab('0x5')]),_0x4a340f);queues[_0x4a340f['uniqueid']][_0x0dab('0x58')]+=utils[_0x0dab('0x35')](utils[_0x0dab('0x16')](),queues[_0x4a340f[_0x0dab('0x5')]][_0x0dab('0x61')]);utils['info'](util[_0x0dab('0x19')](_0x0dab('0x65'),_0x4a340f[_0x0dab('0x5')],queues[_0x4a340f['uniqueid']][_0x0dab('0x23')],queues[_0x4a340f[_0x0dab('0x5')]][_0x0dab('0x58')]));delete queues[_0x4a340f[_0x0dab('0x5')]][_0x0dab('0x61')];}}}catch(_0x553b2b){utils[_0x0dab('0x2c')](util['format'](_0x0dab('0x64'),_0x4a340f[_0x0dab('0x5')]),_0x553b2b);}}; \ No newline at end of file +var _0xc846=['clone','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc846,0xe8));var _0x6c84=function(_0x2575eb,_0x456f3f){_0x2575eb=_0x2575eb-0x0;var _0x1c49da=_0xc846[_0x2575eb];return _0x1c49da;};'use strict';var _=require(_0x6c84('0x0'));var util=require(_0x6c84('0x1'));var utils=require(_0x6c84('0x2'));var queues={};function writeDB(_0x1fb399){utils['info'](util[_0x6c84('0x3')](_0x6c84('0x4'),_0x1fb399[_0x6c84('0x5')],_0x1fb399[_0x6c84('0x6')],_0x1fb399[_0x6c84('0x7')],_0x1fb399[_0x6c84('0x8')],_0x1fb399[_0x6c84('0x9')],_0x1fb399[_0x6c84('0xa')],_0x1fb399[_0x6c84('0xb')]));if(_0x1fb399[_0x6c84('0x7')]){utils[_0x6c84('0xc')](_0x1fb399[_0x6c84('0x7')])[_0x6c84('0xd')](function(_0x136bf5){if(_0x136bf5){_0x1fb399['type']=_0x136bf5[_0x6c84('0xe')];}utils[_0x6c84('0xf')](_0x6c84('0x10'),_0x1fb399);});}else{utils['request'](_0x6c84('0x10'),_0x1fb399);}if(_0x1fb399[_0x6c84('0x11')]){delete queues[_0x1fb399['transfereduniqueid']];}else{delete queues[_0x1fb399['uniqueid']];}}exports['queuecallerjoin']=function(_0x227056){try{utils[_0x6c84('0x12')](util['format'](_0x6c84('0x13'),_0x227056['uniqueid']),_0x227056);utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x15'),_0x227056['uniqueid'],_0x227056[_0x6c84('0x7')],_0x227056['position']));queues[_0x227056['uniqueid']]=_['assign'](_0x227056,{'originalposition':_0x227056[_0x6c84('0x16')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x210eb0){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x13'),_0x227056[_0x6c84('0x5')]),_0x210eb0);}};exports[_0x6c84('0x18')]=function(_0x298f14){try{if(!_[_0x6c84('0x19')](queues[_0x298f14[_0x6c84('0x5')]])){utils['debug'](util[_0x6c84('0x3')]('[%s][queues][hangup]',_0x298f14[_0x6c84('0x5')]),_0x298f14);if(queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x1a')]){if(!queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x1b')]&&!queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x1c')]){queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x1d')]=!![];queues[_0x298f14[_0x6c84('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0xb')]=_0x6c84('0x1e');}utils[_0x6c84('0x14')](util['format'](_0x6c84('0x1f'),_0x298f14['uniqueid'],queues[_0x298f14['uniqueid']][_0x6c84('0x20')],queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0xb')]));writeDB(queues[_0x298f14[_0x6c84('0x5')]]);}else if(queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x11')]){utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x21'),_0x298f14['uniqueid'],queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x20')],queues[_0x298f14['uniqueid']][_0x6c84('0x11')]));queues[queues[_0x298f14[_0x6c84('0x5')]][_0x6c84('0x11')]]=queues[_0x298f14[_0x6c84('0x5')]];queues[queues[_0x298f14['uniqueid']]['transfereduniqueid']][_0x6c84('0x22')]=0x2;delete queues[_0x298f14[_0x6c84('0x5')]];}}}catch(_0x3ed3a4){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x23'),_0x298f14[_0x6c84('0x5')]),_0x3ed3a4);}};exports[_0x6c84('0x24')]=function(_0x207950){try{utils['debug'](util[_0x6c84('0x3')](_0x6c84('0x25'),_0x207950[_0x6c84('0x5')]),_0x207950);if(!_[_0x6c84('0x19')](_0x207950[_0x6c84('0x26')][_0x6c84('0x27')])&&_0x207950[_0x6c84('0x28')][_0x6c84('0x29')]()!==_0x6c84('0x2a')){if(!_[_0x6c84('0x19')](queues[_0x207950[_0x6c84('0x5')]])){queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x1b')]=![];queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x2b')]=null;queues[_0x207950['uniqueid']][_0x6c84('0x1c')]=!![];queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x2c')]=utils[_0x6c84('0x2d')]();queues[_0x207950[_0x6c84('0x5')]]['queuecallerexitreason']=_0x207950[_0x6c84('0x28')]['toUpperCase']();utils['info'](util[_0x6c84('0x3')](_0x6c84('0x2e'),_0x207950[_0x6c84('0x5')],queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x20')],_0x207950[_0x6c84('0x28')],queues[_0x207950[_0x6c84('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x207950['uniqueid']]);}}else if(!_['isNil'](_0x207950[_0x6c84('0x26')]['queueposition'])){if(!_[_0x6c84('0x19')](queues[_0x207950[_0x6c84('0x5')]])&&!queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x1b')]){queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x1b')]=![];queues[_0x207950['uniqueid']][_0x6c84('0x2b')]=null;queues[_0x207950['uniqueid']][_0x6c84('0x1c')]=!![];queues[_0x207950['uniqueid']][_0x6c84('0x2c')]=utils[_0x6c84('0x2d')]();queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0xb')]='EXITWITHKEY';utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x2f'),_0x207950[_0x6c84('0x5')],queues[_0x207950[_0x6c84('0x5')]][_0x6c84('0x20')],_0x207950[_0x6c84('0x28')],queues[_0x207950['uniqueid']][_0x6c84('0xb')]));}}}catch(_0x4d456c){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x25'),_0x207950['uniqueid']),_0x4d456c);}};exports[_0x6c84('0x1b')]=function(_0x43633e){try{if(!_[_0x6c84('0x19')](queues[_0x43633e[_0x6c84('0x5')]])){utils[_0x6c84('0x12')](util['format'](_0x6c84('0x30'),_0x43633e[_0x6c84('0x5')]),_0x43633e);queues[_0x43633e[_0x6c84('0x5')]][_0x6c84('0x1c')]=![];queues[_0x43633e[_0x6c84('0x5')]][_0x6c84('0x2c')]=null;queues[_0x43633e[_0x6c84('0x5')]][_0x6c84('0x1b')]=!![];queues[_0x43633e[_0x6c84('0x5')]][_0x6c84('0x2b')]=utils[_0x6c84('0x2d')]();queues[_0x43633e[_0x6c84('0x5')]][_0x6c84('0xb')]=_0x6c84('0x31');utils['info'](util[_0x6c84('0x3')](_0x6c84('0x32'),_0x43633e['uniqueid'],queues[_0x43633e['uniqueid']][_0x6c84('0x20')],queues[_0x43633e[_0x6c84('0x5')]]['queuecallerexitreason']));}}catch(_0x16e37b){utils['error'](util[_0x6c84('0x3')](_0x6c84('0x30'),_0x43633e[_0x6c84('0x5')]),_0x16e37b);}};exports['queuecallerleave']=function(_0x10eafe){try{if(!_[_0x6c84('0x19')](queues[_0x10eafe['uniqueid']])){utils[_0x6c84('0x12')](util[_0x6c84('0x3')](_0x6c84('0x33'),_0x10eafe[_0x6c84('0x5')]),_0x10eafe);utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x34'),_0x10eafe['uniqueid'],queues[_0x10eafe[_0x6c84('0x5')]][_0x6c84('0x20')],_0x10eafe[_0x6c84('0x35')],_0x10eafe[_0x6c84('0x36')]));queues[_0x10eafe['uniqueid']]['queuecallerleave']=!![];queues[_0x10eafe[_0x6c84('0x5')]][_0x6c84('0x1a')]=utils[_0x6c84('0x2d')]();queues[_0x10eafe['uniqueid']][_0x6c84('0x37')]=utils['diffTime'](queues[_0x10eafe[_0x6c84('0x5')]]['queuecallerleaveAt'],queues[_0x10eafe[_0x6c84('0x5')]]['queuecallerjoinAt']);queues[_0x10eafe[_0x6c84('0x5')]][_0x6c84('0x16')]=_0x10eafe[_0x6c84('0x16')];queues[_0x10eafe[_0x6c84('0x5')]]['count']=_0x10eafe[_0x6c84('0x38')];queues[_0x10eafe[_0x6c84('0x5')]][_0x6c84('0x35')]=_0x10eafe['connectedlinenum'];queues[_0x10eafe[_0x6c84('0x5')]][_0x6c84('0x36')]=_0x10eafe[_0x6c84('0x36')];}}catch(_0x3fb9a4){utils['error'](util[_0x6c84('0x3')](_0x6c84('0x33'),_0x10eafe['uniqueid']),_0x3fb9a4);}};exports[_0x6c84('0x39')]=function(_0x358a17){try{if(!_[_0x6c84('0x19')](queues[_0x358a17[_0x6c84('0x5')]])){utils['debug'](util[_0x6c84('0x3')]('[%s][queues][agentconnect]',_0x358a17[_0x6c84('0x5')]),_0x358a17);utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x3a'),_0x358a17[_0x6c84('0x5')],queues[_0x358a17['uniqueid']]['name'],_0x358a17[_0x6c84('0x3b')],_0x358a17['destaccountcode']));queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0x1b')]=![];queues[_0x358a17['uniqueid']]['queuecallerabandon']=![];queues[_0x358a17['uniqueid']]['queuecallerabandonAt']=null;queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0x1c')]=![];queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0xb')]=null;queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0x2c')]=null;queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0x3c')]=!![];queues[_0x358a17['uniqueid']]['accountcode']=_0x358a17[_0x6c84('0x3d')];queues[_0x358a17[_0x6c84('0x5')]][_0x6c84('0x8')]=_0x358a17['membername'];}}catch(_0x3e03ef){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x3e'),_0x358a17[_0x6c84('0x5')]),_0x3e03ef);}};exports[_0x6c84('0x3f')]=function(_0x98a7ff){try{if(!_['isNil'](queues[_0x98a7ff['uniqueid']])){if(queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x1a')]){utils[_0x6c84('0x12')](util[_0x6c84('0x3')](_0x6c84('0x40'),_0x98a7ff[_0x6c84('0x5')]),_0x98a7ff);queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x1b')]=![];queues[_0x98a7ff[_0x6c84('0x5')]]['queuecallerabandon']=![];queues[_0x98a7ff['uniqueid']][_0x6c84('0x2b')]=null;queues[_0x98a7ff['uniqueid']][_0x6c84('0x1c')]=![];queues[_0x98a7ff['uniqueid']][_0x6c84('0x2c')]=null;queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x3c')]=!![];queues[_0x98a7ff[_0x6c84('0x5')]]['lastAssignedTo']=_0x98a7ff[_0x6c84('0x3b')];queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x1d')]=!![];queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x41')]=utils[_0x6c84('0x2d')]();if(_0x98a7ff[_0x6c84('0x42')]=='transfer'){if(!queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x43')]){queues[_0x98a7ff[_0x6c84('0x5')]]['queuecallerexitreason']=_0x6c84('0x44');}}else{queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0xb')]=_0x6c84('0x45')+_0x98a7ff['reason'][_0x6c84('0x29')]();}utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x46'),_0x98a7ff[_0x6c84('0x5')],queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0x20')],_0x98a7ff[_0x6c84('0x3b')],queues[_0x98a7ff[_0x6c84('0x5')]][_0x6c84('0xb')]));writeDB(queues[_0x98a7ff[_0x6c84('0x5')]]);}}}catch(_0x30141f){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x40'),_0x98a7ff[_0x6c84('0x5')]),_0x30141f);}};exports[_0x6c84('0x47')]=function(_0x419fc8){try{if(!_[_0x6c84('0x19')](queues[_0x419fc8[_0x6c84('0x48')]])){utils['debug'](util[_0x6c84('0x3')](_0x6c84('0x49'),_0x419fc8['uniqueid']),_0x419fc8);queues[_0x419fc8['transfereeuniqueid']]['transfer']=!![];queues[_0x419fc8['transfereeuniqueid']]['transfertype']=_0x6c84('0x4a');queues[_0x419fc8[_0x6c84('0x48')]][_0x6c84('0x4b')]=_0x419fc8[_0x6c84('0x4c')];queues[_0x419fc8['transfereeuniqueid']][_0x6c84('0x4d')]=_0x419fc8[_0x6c84('0x48')];queues[_0x419fc8[_0x6c84('0x48')]][_0x6c84('0xb')]=_0x6c84('0x4e');utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x4f'),_0x419fc8['uniqueid'],queues[_0x419fc8[_0x6c84('0x48')]][_0x6c84('0x20')],_0x419fc8[_0x6c84('0x48')],_0x419fc8['extension']));}}catch(_0x2bd691){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x49'),_0x419fc8[_0x6c84('0x5')]),_0x2bd691);}};exports[_0x6c84('0x50')]=function(_0x5b4be2){try{utils[_0x6c84('0x12')](util[_0x6c84('0x3')]('[%s][queues][attendedtransfer]',_0x5b4be2[_0x6c84('0x51')]),_0x5b4be2);if(_0x5b4be2['origtransfereruniqueid']==_0x5b4be2[_0x6c84('0x52')]){if(!_[_0x6c84('0x19')](queues[_0x5b4be2[_0x6c84('0x53')]])){utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x54'),_0x5b4be2[_0x6c84('0x51')],queues[_0x5b4be2['secondtransfererlinkedid']]['name'],_0x5b4be2[_0x6c84('0x55')]));queues[_0x5b4be2[_0x6c84('0x53')]][_0x6c84('0x43')]=!![];queues[_0x5b4be2[_0x6c84('0x53')]]['transfertype']=_0x6c84('0x56');queues[_0x5b4be2[_0x6c84('0x53')]]['transferexten']=_0x5b4be2[_0x6c84('0x55')];queues[_0x5b4be2[_0x6c84('0x53')]]['transferuniqueid']=_0x5b4be2['origtransfereruniqueid'];queues[_0x5b4be2[_0x6c84('0x53')]]['queuecallerexitreason']=_0x6c84('0x57');}if(!_[_0x6c84('0x19')](queues[_0x5b4be2[_0x6c84('0x52')]])){if(_0x5b4be2[_0x6c84('0x58')]&&queues[_0x5b4be2[_0x6c84('0x58')]]){queues[_0x5b4be2['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x5b4be2[_0x6c84('0x48')]]=_[_0x6c84('0x59')](queues[_0x5b4be2['transfereelinkedid']]);queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x11')]=_0x5b4be2['transfertargetuniqueid'];queues[_0x5b4be2['transfereeuniqueid']][_0x6c84('0x22')]=0x2;queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x9')]=queues[_0x5b4be2['secondtransfererlinkedid']][_0x6c84('0x9')];queues[_0x5b4be2['transfereeuniqueid']][_0x6c84('0x5a')]=queues[_0x5b4be2[_0x6c84('0x53')]][_0x6c84('0x5a')];queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x5b')]=utils[_0x6c84('0x2d')]();queues[_0x5b4be2[_0x6c84('0x48')]]['queuecallerleaveAt']=utils[_0x6c84('0x2d')]();queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x37')]=0x0;queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x5c')]=0x0;utils[_0x6c84('0x14')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5b4be2[_0x6c84('0x51')],queues[_0x5b4be2['transfereeuniqueid']][_0x6c84('0x20')],queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x9')],queues[_0x5b4be2[_0x6c84('0x48')]][_0x6c84('0x5a')]));}else{utils[_0x6c84('0x14')](util[_0x6c84('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5b4be2[_0x6c84('0x51')],queues[_0x5b4be2[_0x6c84('0x52')]][_0x6c84('0x20')],_0x5b4be2[_0x6c84('0x53')]));queues[_0x5b4be2[_0x6c84('0x52')]][_0x6c84('0x11')]=_0x5b4be2[_0x6c84('0x53')];}}}else if(_0x5b4be2[_0x6c84('0x5d')]==_0x5b4be2['secondtransfererlinkedid']){if(!_[_0x6c84('0x19')](queues[_0x5b4be2['origtransfererlinkedid']])){utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x5e'),_0x5b4be2[_0x6c84('0x51')],queues[_0x5b4be2[_0x6c84('0x52')]][_0x6c84('0x20')],_0x5b4be2[_0x6c84('0x5d')],_0x5b4be2[_0x6c84('0x5f')]));queues[_0x5b4be2[_0x6c84('0x52')]]['transfer']=!![];queues[_0x5b4be2[_0x6c84('0x52')]]['transfertype']='ATTENDED';queues[_0x5b4be2[_0x6c84('0x52')]][_0x6c84('0x4b')]=_0x5b4be2[_0x6c84('0x5f')];queues[_0x5b4be2[_0x6c84('0x52')]][_0x6c84('0x4d')]=_0x5b4be2['secondtransfereruniqueid'];queues[_0x5b4be2['origtransfererlinkedid']][_0x6c84('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x6c84('0x19')](queues[_0x5b4be2[_0x6c84('0x53')]])){if(_0x5b4be2[_0x6c84('0x60')]&&queues[_0x5b4be2[_0x6c84('0x60')]]){queues[_0x5b4be2[_0x6c84('0x60')]]['queuecallerenterreason']=0x1;queues[_0x5b4be2['transfertargetuniqueid']]=_[_0x6c84('0x59')](queues[_0x5b4be2[_0x6c84('0x60')]]);queues[_0x5b4be2[_0x6c84('0x61')]][_0x6c84('0x11')]=_0x5b4be2['transfertargetuniqueid'];queues[_0x5b4be2[_0x6c84('0x61')]][_0x6c84('0x22')]=0x2;queues[_0x5b4be2[_0x6c84('0x61')]][_0x6c84('0x9')]=queues[_0x5b4be2[_0x6c84('0x52')]]['calleridnum'];queues[_0x5b4be2[_0x6c84('0x61')]]['calleridname']=queues[_0x5b4be2['origtransfererlinkedid']][_0x6c84('0x5a')];queues[_0x5b4be2['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x6c84('0x2d')]();queues[_0x5b4be2[_0x6c84('0x61')]]['queuecallerleaveAt']=utils['now']();queues[_0x5b4be2[_0x6c84('0x61')]][_0x6c84('0x37')]=0x0;queues[_0x5b4be2[_0x6c84('0x61')]]['mohtime']=0x0;utils[_0x6c84('0x14')](util['format'](_0x6c84('0x62'),_0x5b4be2['origtransfereruniqueid'],queues[_0x5b4be2['transfertargetuniqueid']][_0x6c84('0x20')],queues[_0x5b4be2['transfertargetuniqueid']][_0x6c84('0x11')],queues[_0x5b4be2['transfertargetuniqueid']][_0x6c84('0x9')],queues[_0x5b4be2[_0x6c84('0x61')]][_0x6c84('0x5a')]));}else{utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x63'),_0x5b4be2[_0x6c84('0x51')],queues[_0x5b4be2[_0x6c84('0x53')]]['name'],_0x5b4be2['origtransfererlinkedid']));queues[_0x5b4be2[_0x6c84('0x53')]][_0x6c84('0x11')]=_0x5b4be2[_0x6c84('0x52')];}}}}catch(_0x305536){utils[_0x6c84('0x17')](util[_0x6c84('0x3')]('[%s][queues][attendedtransfer]',_0x5b4be2[_0x6c84('0x51')]),_0x305536);}};exports[_0x6c84('0x64')]=function(_0x33fb0b){try{if(!_['isNil'](queues[_0x33fb0b['uniqueid']])){utils[_0x6c84('0x12')](util[_0x6c84('0x3')](_0x6c84('0x65'),_0x33fb0b[_0x6c84('0x5')]),_0x33fb0b);queues[_0x33fb0b[_0x6c84('0x5')]][_0x6c84('0x66')]=utils[_0x6c84('0x2d')]();utils[_0x6c84('0x14')](util[_0x6c84('0x3')](_0x6c84('0x67'),_0x33fb0b[_0x6c84('0x5')],queues[_0x33fb0b[_0x6c84('0x5')]][_0x6c84('0x20')],queues[_0x33fb0b[_0x6c84('0x5')]][_0x6c84('0x66')]));}}catch(_0x910fbf){utils[_0x6c84('0x17')](util[_0x6c84('0x3')](_0x6c84('0x65'),_0x33fb0b[_0x6c84('0x5')]),_0x910fbf);}};exports[_0x6c84('0x68')]=function(_0xcb057f){try{if(!_['isNil'](queues[_0xcb057f[_0x6c84('0x5')]])){if(!_['isNil'](queues[_0xcb057f['uniqueid']][_0x6c84('0x66')])){utils[_0x6c84('0x12')](util[_0x6c84('0x3')](_0x6c84('0x69'),_0xcb057f[_0x6c84('0x5')]),_0xcb057f);queues[_0xcb057f['uniqueid']][_0x6c84('0x5c')]+=utils[_0x6c84('0x6a')](utils[_0x6c84('0x2d')](),queues[_0xcb057f['uniqueid']][_0x6c84('0x66')]);utils['info'](util[_0x6c84('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xcb057f[_0x6c84('0x5')],queues[_0xcb057f[_0x6c84('0x5')]][_0x6c84('0x20')],queues[_0xcb057f[_0x6c84('0x5')]][_0x6c84('0x5c')]));delete queues[_0xcb057f['uniqueid']][_0x6c84('0x66')];}}}catch(_0x2371b1){utils[_0x6c84('0x17')](util['format'](_0x6c84('0x69'),_0xcb057f[_0x6c84('0x5')]),_0x2371b1);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5a0bcf2..f8172d9 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 _0x8701=['debug','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error'];(function(_0x1ef1dc,_0x59a983){var _0x2345a8=function(_0x112091){while(--_0x112091){_0x1ef1dc['push'](_0x1ef1dc['shift']());}};_0x2345a8(++_0x59a983);}(_0x8701,0x141));var _0x1870=function(_0x418570,_0x565e2f){_0x418570=_0x418570-0x0;var _0x2fcd53=_0x8701[_0x418570];return _0x2fcd53;};'use strict';var _=require(_0x1870('0x0'));var util=require(_0x1870('0x1'));var utils=require(_0x1870('0x2'));var recordings={};function writeDB(_0x463941){utils[_0x1870('0x3')](util[_0x1870('0x4')](_0x1870('0x5'),_0x463941[_0x1870('0x6')]));if(_0x463941[_0x1870('0x7')]){utils[_0x1870('0x8')](_0x463941['accountcode'])[_0x1870('0x9')](function(_0x32be10){if(_0x32be10){_0x463941['membername']=_0x32be10[_0x1870('0xa')];_0x463941[_0x1870('0xb')]=_0x32be10['id'];}utils[_0x1870('0xc')](_0x1870('0xd'),_0x463941);});}else{utils[_0x1870('0xc')](_0x1870('0xd'),_0x463941);}}exports['newchannel']=function(_0x28ff6d){try{utils['debug'](util[_0x1870('0x4')](_0x1870('0xe'),_0x28ff6d['uniqueid']),_0x28ff6d);if(_0x28ff6d[_0x1870('0x6')]==_0x28ff6d[_0x1870('0xf')]){utils['info'](util[_0x1870('0x4')](_0x1870('0x10'),_0x28ff6d['uniqueid'],_0x28ff6d['context'],_0x28ff6d[_0x1870('0x11')]));recordings[_0x28ff6d[_0x1870('0x6')]]={'uniqueid':_0x28ff6d[_0x1870('0x6')],'accountcode':_0x28ff6d[_0x1870('0x7')],'exten':_0x28ff6d[_0x1870('0x11')],'context':_0x28ff6d[_0x1870('0x12')],'channel':_0x28ff6d[_0x1870('0x13')],'monitors':[]};}}catch(_0x39f0e4){utils[_0x1870('0x14')](util[_0x1870('0x4')]('[%s][recordings][newchannel]',_0x28ff6d[_0x1870('0x6')]),_0x39f0e4);}};exports['newstate']=function(_0x5a694){try{utils[_0x1870('0x15')](util[_0x1870('0x4')]('[%s][recordings][newstate]',_0x5a694[_0x1870('0x6')]),_0x5a694);if(!_[_0x1870('0x16')](recordings[_0x5a694[_0x1870('0x6')]])&&_0x5a694[_0x1870('0x17')]==0x6){utils[_0x1870('0x3')](util[_0x1870('0x4')](_0x1870('0x18'),_0x5a694[_0x1870('0x6')],_0x5a694[_0x1870('0x12')],_0x5a694['channel']));}else if(!_[_0x1870('0x16')](recordings[_0x5a694[_0x1870('0xf')]])&&_0x5a694[_0x1870('0x17')]==0x6&&_0x5a694[_0x1870('0x12')]!=_0x1870('0x19')){utils[_0x1870('0x3')](util[_0x1870('0x4')](_0x1870('0x1a'),_0x5a694['uniqueid'],_0x5a694['linkedid'],_0x5a694[_0x1870('0x12')],_0x5a694[_0x1870('0x13')]));recordings[_0x5a694[_0x1870('0xf')]][_0x1870('0x7')]=_0x5a694[_0x1870('0x7')];}}catch(_0x1a7cb0){utils[_0x1870('0x14')](util['format']('[%s][recordings][newstate]',_0x5a694[_0x1870('0x6')]),_0x1a7cb0);}};exports['varset']=function(_0x568e40){try{if(!_[_0x1870('0x16')](_0x568e40['variable'])&&!_['isNil'](_0x568e40[_0x1870('0x1b')]['mixmonitor_filename'])){utils[_0x1870('0x15')](util['format'](_0x1870('0x1c'),_0x568e40[_0x1870('0x6')]),_0x568e40);utils[_0x1870('0x3')](util[_0x1870('0x4')](_0x1870('0x1d'),_0x568e40[_0x1870('0x6')],_0x568e40[_0x1870('0x1b')],_0x568e40[_0x1870('0x1e')]));if(_[_0x1870('0x1f')](_0x568e40[_0x1870('0x1e')],'.wav49')){_0x568e40[_0x1870('0x1e')]=_0x568e40[_0x1870('0x1e')]['replace']('.wav49',_0x1870('0x20'));}if(recordings[_0x568e40[_0x1870('0xf')]]){var _0x3fb6a2=_[_0x1870('0x21')](recordings[_0x568e40[_0x1870('0xf')]][_0x1870('0x22')],{'value':_0x568e40[_0x1870('0x1e')]});if(_[_0x1870('0x16')](_0x3fb6a2)){recordings[_0x568e40[_0x1870('0xf')]]['monitors'][_0x1870('0x23')]({'value':_0x568e40[_0x1870('0x1e')]});}}}}catch(_0x5012c3){utils[_0x1870('0x14')](util[_0x1870('0x4')](_0x1870('0x1c'),_0x568e40['uniqueid']),_0x5012c3);}};exports[_0x1870('0x24')]=function(_0x3c43c6){try{if(!_[_0x1870('0x16')](recordings[_0x3c43c6['uniqueid']])){utils[_0x1870('0x15')](util[_0x1870('0x4')](_0x1870('0x25'),_0x3c43c6['uniqueid']),_0x3c43c6);utils[_0x1870('0x3')](util[_0x1870('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3c43c6[_0x1870('0x6')],_0x3c43c6[_0x1870('0x26')],_0x3c43c6[_0x1870('0x27')],_0x3c43c6['cause-txt']));recordings[_0x3c43c6['uniqueid']][_0x1870('0x26')]=_0x3c43c6['calleridnum'];recordings[_0x3c43c6['uniqueid']][_0x1870('0x27')]=_0x3c43c6['calleridname'];recordings[_0x3c43c6[_0x1870('0x6')]][_0x1870('0x28')]=_0x3c43c6[_0x1870('0x28')];recordings[_0x3c43c6['uniqueid']][_0x1870('0x29')]=_0x3c43c6[_0x1870('0x29')];if(recordings[_0x3c43c6[_0x1870('0x6')]]['type']==_0x1870('0x2a')&&recordings[_0x3c43c6[_0x1870('0x6')]][_0x1870('0x7')]){recordings[_0x3c43c6[_0x1870('0x6')]][_0x1870('0x28')]=recordings[_0x3c43c6[_0x1870('0x6')]][_0x1870('0x7')];recordings[_0x3c43c6[_0x1870('0x6')]][_0x1870('0x29')]='';}recordings[_0x3c43c6[_0x1870('0x6')]]['monitors']['forEach'](function(_0x38e76){var _0x5513e5=_[_0x1870('0x2b')](recordings[_0x3c43c6['uniqueid']]);_0x5513e5[_0x1870('0x1e')]=_0x38e76[_0x1870('0x1e')];writeDB(_0x5513e5);});delete recordings[_0x3c43c6[_0x1870('0x6')]];}}catch(_0x12d3e3){utils[_0x1870('0x14')](util['format'](_0x1870('0x25'),_0x3c43c6[_0x1870('0x6')]),_0x12d3e3);}};exports['newexten']=function(_0x2d2b1a){try{if(!_[_0x1870('0x16')](recordings[_0x2d2b1a[_0x1870('0x6')]])){utils['debug'](util[_0x1870('0x4')](_0x1870('0x2c'),_0x2d2b1a[_0x1870('0x6')]),_0x2d2b1a);utils[_0x1870('0x3')](util[_0x1870('0x4')](_0x1870('0x2d'),_0x2d2b1a[_0x1870('0x6')],_0x2d2b1a['application'],_0x2d2b1a['appdata']));if(_0x2d2b1a[_0x1870('0x2e')][_0x1870('0x2f')]()==_0x1870('0x30')&&_[_0x1870('0x31')](_0x2d2b1a[_0x1870('0x32')][_0x1870('0x2f')](),_0x1870('0x33'))){var _0x1c5bbb=_0x2d2b1a[_0x1870('0x32')][_0x1870('0x34')]('=');var _0x185fde=_0x1c5bbb[0x0][_0x1870('0x35')](_0x1c5bbb[0x0][_0x1870('0x36')]('(')+0x1,_0x1c5bbb[0x0][_0x1870('0x36')](')'));var _0x4d0ad5=_0x1c5bbb[0x1];recordings[_0x2d2b1a[_0x1870('0x6')]][_0x185fde]=_0x4d0ad5;}}}catch(_0xb6486){utils[_0x1870('0x14')](util[_0x1870('0x4')](_0x1870('0x2c'),_0x2d2b1a[_0x1870('0x6')]),_0xb6486);}};exports['queuecallerjoin']=function(_0x37eced){try{if(!_[_0x1870('0x16')](recordings[_0x37eced[_0x1870('0x6')]])){utils['debug'](util['format'](_0x1870('0x37'),_0x37eced[_0x1870('0x6')]),_0x37eced);utils['info'](util[_0x1870('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x37eced[_0x1870('0x6')],_0x37eced[_0x1870('0x38')]));recordings[_0x37eced[_0x1870('0x6')]][_0x1870('0x38')]=_0x37eced[_0x1870('0x38')];}}catch(_0x4cb172){utils[_0x1870('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x37eced[_0x1870('0x6')]),_0x4cb172);}}; \ No newline at end of file +var _0x7931=['.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7931,0xd4));var _0x1793=function(_0x293828,_0x5dd85c){_0x293828=_0x293828-0x0;var _0x2bf80e=_0x7931[_0x293828];return _0x2bf80e;};'use strict';var _=require(_0x1793('0x0'));var util=require(_0x1793('0x1'));var utils=require(_0x1793('0x2'));var recordings={};function writeDB(_0x2b0170){utils[_0x1793('0x3')](util[_0x1793('0x4')]('[%s][recordings][writeDB]',_0x2b0170[_0x1793('0x5')]));if(_0x2b0170[_0x1793('0x6')]){utils[_0x1793('0x7')](_0x2b0170[_0x1793('0x6')])[_0x1793('0x8')](function(_0x3aac23){if(_0x3aac23){_0x2b0170[_0x1793('0x9')]=_0x3aac23[_0x1793('0xa')];_0x2b0170[_0x1793('0xb')]=_0x3aac23['id'];}utils['request'](_0x1793('0xc'),_0x2b0170);});}else{utils['request'](_0x1793('0xc'),_0x2b0170);}}exports[_0x1793('0xd')]=function(_0x1c8f49){try{utils[_0x1793('0xe')](util[_0x1793('0x4')](_0x1793('0xf'),_0x1c8f49[_0x1793('0x5')]),_0x1c8f49);if(_0x1c8f49[_0x1793('0x5')]==_0x1c8f49[_0x1793('0x10')]){utils['info'](util[_0x1793('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1c8f49[_0x1793('0x5')],_0x1c8f49[_0x1793('0x11')],_0x1c8f49[_0x1793('0x12')]));recordings[_0x1c8f49[_0x1793('0x5')]]={'uniqueid':_0x1c8f49[_0x1793('0x5')],'accountcode':_0x1c8f49[_0x1793('0x6')],'exten':_0x1c8f49['exten'],'context':_0x1c8f49[_0x1793('0x11')],'channel':_0x1c8f49[_0x1793('0x13')],'monitors':[]};}}catch(_0x4e6fe5){utils[_0x1793('0x14')](util[_0x1793('0x4')]('[%s][recordings][newchannel]',_0x1c8f49[_0x1793('0x5')]),_0x4e6fe5);}};exports[_0x1793('0x15')]=function(_0x2c39cd){try{utils['debug'](util[_0x1793('0x4')](_0x1793('0x16'),_0x2c39cd[_0x1793('0x5')]),_0x2c39cd);if(!_[_0x1793('0x17')](recordings[_0x2c39cd[_0x1793('0x5')]])&&_0x2c39cd[_0x1793('0x18')]==0x6){utils[_0x1793('0x3')](util[_0x1793('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2c39cd[_0x1793('0x5')],_0x2c39cd['context'],_0x2c39cd[_0x1793('0x13')]));}else if(!_[_0x1793('0x17')](recordings[_0x2c39cd[_0x1793('0x10')]])&&_0x2c39cd[_0x1793('0x18')]==0x6&&_0x2c39cd['context']!=_0x1793('0x19')){utils[_0x1793('0x3')](util[_0x1793('0x4')](_0x1793('0x1a'),_0x2c39cd['uniqueid'],_0x2c39cd[_0x1793('0x10')],_0x2c39cd[_0x1793('0x11')],_0x2c39cd[_0x1793('0x13')]));recordings[_0x2c39cd['linkedid']][_0x1793('0x6')]=_0x2c39cd['accountcode'];}}catch(_0x49e1e5){utils[_0x1793('0x14')](util[_0x1793('0x4')](_0x1793('0x16'),_0x2c39cd['uniqueid']),_0x49e1e5);}};exports[_0x1793('0x1b')]=function(_0x126bf6){try{if(!_[_0x1793('0x17')](_0x126bf6[_0x1793('0x1c')])&&!_[_0x1793('0x17')](_0x126bf6[_0x1793('0x1c')]['mixmonitor_filename'])){utils[_0x1793('0xe')](util[_0x1793('0x4')]('[%s][recordings][varset]',_0x126bf6['uniqueid']),_0x126bf6);utils[_0x1793('0x3')](util[_0x1793('0x4')](_0x1793('0x1d'),_0x126bf6[_0x1793('0x5')],_0x126bf6[_0x1793('0x1c')],_0x126bf6[_0x1793('0x1e')]));if(_[_0x1793('0x1f')](_0x126bf6[_0x1793('0x1e')],'.wav49')){_0x126bf6[_0x1793('0x1e')]=_0x126bf6[_0x1793('0x1e')]['replace'](_0x1793('0x20'),_0x1793('0x21'));}if(recordings[_0x126bf6[_0x1793('0x10')]]){var _0x124e75=_[_0x1793('0x22')](recordings[_0x126bf6[_0x1793('0x10')]]['monitors'],{'value':_0x126bf6['value']});if(_['isNil'](_0x124e75)){recordings[_0x126bf6['linkedid']][_0x1793('0x23')][_0x1793('0x24')]({'value':_0x126bf6[_0x1793('0x1e')]});}}}}catch(_0x23e9cb){utils[_0x1793('0x14')](util[_0x1793('0x4')](_0x1793('0x25'),_0x126bf6['uniqueid']),_0x23e9cb);}};exports[_0x1793('0x26')]=function(_0x43a97b){try{if(!_[_0x1793('0x17')](recordings[_0x43a97b['uniqueid']])){utils['debug'](util[_0x1793('0x4')]('[%s][recordings][hangup]',_0x43a97b[_0x1793('0x5')]),_0x43a97b);utils['info'](util[_0x1793('0x4')](_0x1793('0x27'),_0x43a97b[_0x1793('0x5')],_0x43a97b['calleridnum'],_0x43a97b[_0x1793('0x28')],_0x43a97b[_0x1793('0x29')]));recordings[_0x43a97b[_0x1793('0x5')]][_0x1793('0x2a')]=_0x43a97b[_0x1793('0x2a')];recordings[_0x43a97b[_0x1793('0x5')]][_0x1793('0x28')]=_0x43a97b[_0x1793('0x28')];recordings[_0x43a97b[_0x1793('0x5')]]['connectedlinenum']=_0x43a97b[_0x1793('0x2b')];recordings[_0x43a97b['uniqueid']][_0x1793('0x2c')]=_0x43a97b['connectedlinename'];if(recordings[_0x43a97b[_0x1793('0x5')]]['type']=='outbound'&&recordings[_0x43a97b[_0x1793('0x5')]]['accountcode']){recordings[_0x43a97b[_0x1793('0x5')]][_0x1793('0x2b')]=recordings[_0x43a97b[_0x1793('0x5')]][_0x1793('0x6')];recordings[_0x43a97b['uniqueid']][_0x1793('0x2c')]='';}recordings[_0x43a97b[_0x1793('0x5')]][_0x1793('0x23')]['forEach'](function(_0x12362b){var _0x402416=_['clone'](recordings[_0x43a97b[_0x1793('0x5')]]);_0x402416['value']=_0x12362b[_0x1793('0x1e')];writeDB(_0x402416);});delete recordings[_0x43a97b[_0x1793('0x5')]];}}catch(_0x3f1160){utils[_0x1793('0x14')](util[_0x1793('0x4')](_0x1793('0x2d'),_0x43a97b[_0x1793('0x5')]),_0x3f1160);}};exports[_0x1793('0x2e')]=function(_0x381a2a){try{if(!_[_0x1793('0x17')](recordings[_0x381a2a[_0x1793('0x5')]])){utils[_0x1793('0xe')](util['format'](_0x1793('0x2f'),_0x381a2a[_0x1793('0x5')]),_0x381a2a);utils[_0x1793('0x3')](util[_0x1793('0x4')](_0x1793('0x30'),_0x381a2a[_0x1793('0x5')],_0x381a2a['application'],_0x381a2a[_0x1793('0x31')]));if(_0x381a2a[_0x1793('0x32')][_0x1793('0x33')]()=='set'&&_[_0x1793('0x34')](_0x381a2a['appdata']['toLowerCase'](),_0x1793('0x35'))){var _0x418e2a=_0x381a2a[_0x1793('0x31')][_0x1793('0x36')]('=');var _0x123f66=_0x418e2a[0x0][_0x1793('0x37')](_0x418e2a[0x0][_0x1793('0x38')]('(')+0x1,_0x418e2a[0x0][_0x1793('0x38')](')'));var _0x38d69d=_0x418e2a[0x1];recordings[_0x381a2a[_0x1793('0x5')]][_0x123f66]=_0x38d69d;}}}catch(_0x228eaa){utils[_0x1793('0x14')](util[_0x1793('0x4')](_0x1793('0x2f'),_0x381a2a[_0x1793('0x5')]),_0x228eaa);}};exports[_0x1793('0x39')]=function(_0x3fb62c){try{if(!_[_0x1793('0x17')](recordings[_0x3fb62c[_0x1793('0x5')]])){utils[_0x1793('0xe')](util[_0x1793('0x4')](_0x1793('0x3a'),_0x3fb62c[_0x1793('0x5')]),_0x3fb62c);utils[_0x1793('0x3')](util[_0x1793('0x4')](_0x1793('0x3b'),_0x3fb62c[_0x1793('0x5')],_0x3fb62c[_0x1793('0x3c')]));recordings[_0x3fb62c['uniqueid']][_0x1793('0x3c')]=_0x3fb62c[_0x1793('0x3c')];}}catch(_0x205f18){utils[_0x1793('0x14')](util[_0x1793('0x4')](_0x1793('0x3a'),_0x3fb62c[_0x1793('0x5')]),_0x205f18);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4e092ae..4590146 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 _0x9cc4=['blind','error','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','format','transferercalleridnum','transfereecalleridnum'];(function(_0x223a4c,_0x3f22bc){var _0x12f7ca=function(_0x2ff070){while(--_0x2ff070){_0x223a4c['push'](_0x223a4c['shift']());}};_0x12f7ca(++_0x3f22bc);}(_0x9cc4,0x82));var _0x49cc=function(_0x36741d,_0x3c83fa){_0x36741d=_0x36741d-0x0;var _0x5517ec=_0x9cc4[_0x36741d];return _0x5517ec;};'use strict';var _=require(_0x49cc('0x0'));var util=require(_0x49cc('0x1'));var utils=require('./utils');function writeDB(_0x12a3a0){utils[_0x49cc('0x2')](util['format'](_0x49cc('0x3'),_0x12a3a0[_0x49cc('0x4')]===_0x49cc('0x5')?_0x12a3a0[_0x49cc('0x6')]:_0x12a3a0[_0x49cc('0x7')],_0x12a3a0[_0x49cc('0x4')]));utils['request'](_0x49cc('0x8'),_0x12a3a0);}exports[_0x49cc('0x9')]=function(_0x420f4b){try{utils['debug'](util['format'](_0x49cc('0xa'),_0x420f4b[_0x49cc('0x7')]),_0x420f4b);utils[_0x49cc('0x2')](util[_0x49cc('0xb')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x420f4b[_0x49cc('0x7')],_0x420f4b[_0x49cc('0xc')],_0x420f4b['transferercalleridname'],_0x420f4b[_0x49cc('0xd')],_0x420f4b['transfereecalleridname']));_0x420f4b[_0x49cc('0x4')]=_0x49cc('0xe');writeDB(_0x420f4b);}catch(_0x35d1c5){utils[_0x49cc('0xf')](util[_0x49cc('0xb')](_0x49cc('0xa'),_0x420f4b[_0x49cc('0x7')]),_0x35d1c5);}};exports['attendedtransfer']=function(_0x36021d){try{utils[_0x49cc('0x10')](util[_0x49cc('0xb')]('[%s][transfers][attendedtransfer]',_0x36021d[_0x49cc('0x6')]),_0x36021d);utils[_0x49cc('0x2')](util[_0x49cc('0xb')](_0x49cc('0x11'),_0x36021d[_0x49cc('0x6')],_0x36021d['origtransferercalleridnum'],_0x36021d[_0x49cc('0x12')],_0x36021d[_0x49cc('0x13')],_0x36021d[_0x49cc('0x14')]));_0x36021d=_[_0x49cc('0x15')](_0x36021d,{'transfererchannel':_0x36021d[_0x49cc('0x16')],'transferercalleridnum':_0x36021d['origtransferercalleridnum'],'transferercalleridname':_0x36021d[_0x49cc('0x12')],'transfererconnectedlinenum':_0x36021d[_0x49cc('0x17')],'transfererconnectedlinename':_0x36021d[_0x49cc('0x18')],'transfereraccountcode':_0x36021d['origtransfereraccountcode'],'transferercontext':_0x36021d[_0x49cc('0x19')],'transfererexten':_0x36021d[_0x49cc('0x1a')],'transfererlinkedid':_0x36021d[_0x49cc('0x1b')],'context':_0x36021d['origtransferercontext'],'extension':_0x36021d[_0x49cc('0x1c')],'type':'attended'});if(_[_0x49cc('0x1d')](_0x36021d['transfereechannel'])){_0x36021d=_[_0x49cc('0x15')](_0x36021d,{'transfereechannel':_0x36021d[_0x49cc('0x1e')],'transfereecalleridnum':_0x36021d[_0x49cc('0x13')],'transfereecalleridname':_0x36021d[_0x49cc('0x14')],'transfereeconnectedlinenum':_0x36021d[_0x49cc('0x1f')],'transfereeconnectedlinename':_0x36021d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x36021d['transfertargetaccountcode'],'transfereecontext':_0x36021d[_0x49cc('0x20')],'transfereeexten':_0x36021d[_0x49cc('0x21')],'transfereelinkedid':_0x36021d[_0x49cc('0x22')]});}writeDB(_0x36021d);}catch(_0xa99535){utils[_0x49cc('0xf')](util[_0x49cc('0xb')](_0x49cc('0x23'),_0x36021d[_0x49cc('0x6')]),_0xa99535);}}; \ No newline at end of file +var _0xc068=['type','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info'];(function(_0x3159a1,_0x163413){var _0x445a63=function(_0x3cf5cf){while(--_0x3cf5cf){_0x3159a1['push'](_0x3159a1['shift']());}};_0x445a63(++_0x163413);}(_0xc068,0x1e9));var _0x8c06=function(_0x19dcd6,_0x392f43){_0x19dcd6=_0x19dcd6-0x0;var _0x4ed869=_0xc068[_0x19dcd6];return _0x4ed869;};'use strict';var _=require(_0x8c06('0x0'));var util=require(_0x8c06('0x1'));var utils=require('./utils');function writeDB(_0x54671a){utils[_0x8c06('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x54671a[_0x8c06('0x3')]==='attended'?_0x54671a['origtransfereruniqueid']:_0x54671a[_0x8c06('0x4')],_0x54671a[_0x8c06('0x3')]));utils[_0x8c06('0x5')](_0x8c06('0x6'),_0x54671a);}exports[_0x8c06('0x7')]=function(_0x2633db){try{utils[_0x8c06('0x8')](util[_0x8c06('0x9')]('[%s][transfers][blindtransfer]',_0x2633db[_0x8c06('0x4')]),_0x2633db);utils[_0x8c06('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2633db[_0x8c06('0x4')],_0x2633db[_0x8c06('0xa')],_0x2633db[_0x8c06('0xb')],_0x2633db['transfereecalleridnum'],_0x2633db[_0x8c06('0xc')]));_0x2633db[_0x8c06('0x3')]=_0x8c06('0xd');writeDB(_0x2633db);}catch(_0x519e34){utils[_0x8c06('0xe')](util['format'](_0x8c06('0xf'),_0x2633db[_0x8c06('0x4')]),_0x519e34);}};exports[_0x8c06('0x10')]=function(_0x27609d){try{utils['debug'](util[_0x8c06('0x9')]('[%s][transfers][attendedtransfer]',_0x27609d[_0x8c06('0x11')]),_0x27609d);utils[_0x8c06('0x2')](util[_0x8c06('0x9')](_0x8c06('0x12'),_0x27609d[_0x8c06('0x11')],_0x27609d['origtransferercalleridnum'],_0x27609d[_0x8c06('0x13')],_0x27609d['transfertargetcalleridnum'],_0x27609d[_0x8c06('0x14')]));_0x27609d=_[_0x8c06('0x15')](_0x27609d,{'transfererchannel':_0x27609d['origtransfererchannel'],'transferercalleridnum':_0x27609d[_0x8c06('0x16')],'transferercalleridname':_0x27609d[_0x8c06('0x13')],'transfererconnectedlinenum':_0x27609d[_0x8c06('0x17')],'transfererconnectedlinename':_0x27609d[_0x8c06('0x18')],'transfereraccountcode':_0x27609d[_0x8c06('0x19')],'transferercontext':_0x27609d[_0x8c06('0x1a')],'transfererexten':_0x27609d['secondtransfererexten'],'transfererlinkedid':_0x27609d[_0x8c06('0x1b')],'context':_0x27609d[_0x8c06('0x1c')],'extension':_0x27609d[_0x8c06('0x1d')],'type':'attended'});if(_[_0x8c06('0x1e')](_0x27609d[_0x8c06('0x1f')])){_0x27609d=_['assign'](_0x27609d,{'transfereechannel':_0x27609d[_0x8c06('0x20')],'transfereecalleridnum':_0x27609d[_0x8c06('0x21')],'transfereecalleridname':_0x27609d[_0x8c06('0x14')],'transfereeconnectedlinenum':_0x27609d[_0x8c06('0x22')],'transfereeconnectedlinename':_0x27609d[_0x8c06('0x23')],'transfereeaccountcode':_0x27609d[_0x8c06('0x24')],'transfereecontext':_0x27609d[_0x8c06('0x25')],'transfereeexten':_0x27609d[_0x8c06('0x26')],'transfereelinkedid':_0x27609d[_0x8c06('0x27')]});}writeDB(_0x27609d);}catch(_0x1b314a){utils['error'](util[_0x8c06('0x9')](_0x8c06('0x28'),_0x27609d[_0x8c06('0x11')]),_0x1b314a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3ed4d2b..300a2dd 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 _0x2371=['debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','length','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect'];(function(_0x237999,_0x532553){var _0x19b172=function(_0x8d25a2){while(--_0x8d25a2){_0x237999['push'](_0x237999['shift']());}};_0x19b172(++_0x532553);}(_0x2371,0x140));var _0x1237=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x2371[_0x2bda14];return _0xb5dd49;};'use strict';var BPromise=require(_0x1237('0x0'));var jayson=require(_0x1237('0x1'));var moment=require(_0x1237('0x2'));var util=require(_0x1237('0x3'));var client=jayson[_0x1237('0x4')][_0x1237('0x5')]({'port':0x2329});var logger=require(_0x1237('0x6'))(_0x1237('0x7'));exports['info']=function(_0x6e786,_0x264c91){logger['info'](_0x6e786,_0x264c91?util[_0x1237('0x8')](_0x264c91,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x268900,_0xc3b934){logger[_0x1237('0x9')](_0x268900,_0xc3b934?util[_0x1237('0x8')](_0xc3b934,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x17ccec,_0x3c69d9){logger[_0x1237('0xa')](_0x17ccec,_0x3c69d9?util['inspect'](_0x3c69d9,{'showHidden':![],'depth':null}):'');};exports[_0x1237('0xb')]=function(_0x4aedc9,_0x423c80){return client[_0x1237('0xb')](_0x4aedc9,{'body':_0x423c80})['then'](function(_0x58ac0a){logger[_0x1237('0x9')]('[utils][request]\x20name:%s',_0x4aedc9,_0x58ac0a?util['inspect'](_0x58ac0a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2419b9){logger[_0x1237('0xa')](_0x1237('0xc'),_0x4aedc9,_0x2419b9?util['inspect'](_0x2419b9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4f74d2){return client[_0x1237('0xb')](_0x1237('0xd'),{'options':{'raw':!![],'attributes':['id',_0x1237('0xe'),_0x1237('0xf'),_0x1237('0x10')],'where':_0x4f74d2,'limit':0x1}})[_0x1237('0x11')](function(_0x13ffcf){logger['debug'](_0x1237('0x12'),JSON[_0x1237('0x13')](_0x4f74d2),_0x13ffcf?util[_0x1237('0x8')](_0x13ffcf,{'showHidden':![],'depth':null}):'');return _0x13ffcf['result'][_0x1237('0x14')]?_0x13ffcf['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x434b5a){return new BPromise(function(_0x52ba11,_0x7f198d){if(_0x434b5a){return getUser({'internal':_0x434b5a})[_0x1237('0x11')](function(_0x2de27c){logger[_0x1237('0x15')](_0x1237('0x16'),_0x434b5a,_0x2de27c?_0x1237('0x17'):_0x1237('0x18'));return _0x52ba11(_0x2de27c);})['catch'](function(_0x1f2024){logger[_0x1237('0xa')]('[utils][getUserByInternal]',_0x1f2024?util['inspect'](_0x1f2024,{'showHidden':![],'depth':null}):'');return _0x52ba11(null);});}return _0x52ba11(null);});};exports['getUserByInterface']=function(_0x2e3c64){return new BPromise(function(_0x74882c,_0x19b7a5){if(_0x2e3c64){return getUser({'interface':_0x2e3c64})[_0x1237('0x11')](function(_0x16d6fb){logger[_0x1237('0x15')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x2e3c64,_0x16d6fb?_0x1237('0x17'):_0x1237('0x18'));return _0x74882c(_0x16d6fb);})[_0x1237('0x19')](function(_0x130cc0){logger[_0x1237('0xa')]('[utils][getUserByInterface]',_0x130cc0?util['inspect'](_0x130cc0,{'showHidden':![],'depth':null}):'');return _0x74882c(null);});}return _0x74882c(null);});};exports[_0x1237('0x1a')]=function(_0x4dc3e0){return new BPromise(function(_0x2bd744,_0x91f9){if(_0x4dc3e0){return getUser({'name':_0x4dc3e0})[_0x1237('0x11')](function(_0x33673a){logger[_0x1237('0x15')](_0x1237('0x1b'),_0x4dc3e0,_0x33673a?'found':_0x1237('0x18'));return _0x2bd744(_0x33673a);})[_0x1237('0x19')](function(_0x4a48eb){logger['error'](_0x1237('0x1c'),_0x4a48eb?util[_0x1237('0x8')](_0x4a48eb,{'showHidden':![],'depth':null}):'');return _0x2bd744(null);});}return _0x2bd744(null);});};exports[_0x1237('0x1d')]=function(_0x19fc36){return new BPromise(function(_0x39a7b5,_0x36102d){if(_0x19fc36){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1237('0xf'),_0x1237('0x1e'),_0x1237('0x1f'),'acwTimeout'],'where':{'name':_0x19fc36},'limit':0x1}})[_0x1237('0x11')](function(_0x563b0c){logger[_0x1237('0x9')](_0x1237('0x20'),_0x19fc36,_0x563b0c?util[_0x1237('0x8')](_0x563b0c,{'showHidden':![],'depth':null}):'');logger[_0x1237('0x15')](_0x1237('0x21'),_0x19fc36,_0x563b0c?_0x1237('0x17'):_0x1237('0x18'));return _0x39a7b5(_0x563b0c[_0x1237('0x22')][_0x1237('0x14')]?_0x563b0c[_0x1237('0x22')][0x0]:null);})[_0x1237('0x19')](function(_0x198b70){logger[_0x1237('0xa')](_0x1237('0x23'),_0x198b70?util[_0x1237('0x8')](_0x198b70,{'showHidden':![],'depth':null}):'');return _0x39a7b5(null);});}return _0x39a7b5(null);});};exports[_0x1237('0x24')]=function(_0x5efb8f,_0x13c9d9){return moment(_0x5efb8f)[_0x1237('0x25')](_0x13c9d9,_0x1237('0x26'))[_0x1237('0x27')](_0x1237('0x28'));};exports[_0x1237('0x29')]=function(_0x1943d2,_0xd834e9){return moment(_0x1943d2)[_0x1237('0x2a')](_0xd834e9,'seconds')['format'](_0x1237('0x28'));};exports[_0x1237('0x2b')]=function(_0x50822c,_0x460615){return moment(_0x50822c)[_0x1237('0x2c')](moment(_0x460615),_0x1237('0x26'));};exports['sumTime']=function(_0x5cfdca,_0x62e01c){return parseInt(_0x5cfdca,0xa)+parseInt(_0x62e01c,0xa);};exports[_0x1237('0x2d')]=function(){return moment()[_0x1237('0x27')](_0x1237('0x28'));};exports[_0x1237('0x2e')]=function(_0x5bb21d,_0x249ffd){if(_0x249ffd){return moment(_0x5bb21d)[_0x1237('0x2e')](_0x249ffd);}return!![];};exports['isBefore']=function(_0xd6e309,_0x40745c){if(_0x40745c){return moment(_0xd6e309)['isBefore'](_0x40745c);}else if(_0xd6e309){return!![];}return![];}; \ No newline at end of file +var _0x470b=['bluebird','jayson/promise','util','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','internal','name','then','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diff','sumTime','now','isAfter','isBefore'];(function(_0x12a354,_0x17a171){var _0x33c946=function(_0x34427a){while(--_0x34427a){_0x12a354['push'](_0x12a354['shift']());}};_0x33c946(++_0x17a171);}(_0x470b,0x1ec));var _0xb470=function(_0x384636,_0x1216e7){_0x384636=_0x384636-0x0;var _0x1d958f=_0x470b[_0x384636];return _0x1d958f;};'use strict';var BPromise=require(_0xb470('0x0'));var jayson=require(_0xb470('0x1'));var moment=require('moment');var util=require(_0xb470('0x2'));var client=jayson['client'][_0xb470('0x3')]({'port':0x2329});var logger=require(_0xb470('0x4'))('xdr');exports[_0xb470('0x5')]=function(_0xbbe058,_0x1f29da){logger[_0xb470('0x5')](_0xbbe058,_0x1f29da?util[_0xb470('0x6')](_0x1f29da,{'showHidden':![],'depth':null}):'');};exports[_0xb470('0x7')]=function(_0x45bd95,_0x28eb89){logger[_0xb470('0x7')](_0x45bd95,_0x28eb89?util['inspect'](_0x28eb89,{'showHidden':![],'depth':null}):'');};exports[_0xb470('0x8')]=function(_0x3732de,_0x328496){logger[_0xb470('0x8')](_0x3732de,_0x328496?util[_0xb470('0x6')](_0x328496,{'showHidden':![],'depth':null}):'');};exports[_0xb470('0x9')]=function(_0x5070d0,_0x5a2c36){return client[_0xb470('0x9')](_0x5070d0,{'body':_0x5a2c36})['then'](function(_0x2a08af){logger['debug'](_0xb470('0xa'),_0x5070d0,_0x2a08af?util[_0xb470('0x6')](_0x2a08af,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4b6cd8){logger['error'](_0xb470('0xa'),_0x5070d0,_0x4b6cd8?util[_0xb470('0x6')](_0x4b6cd8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x481e0c){return client[_0xb470('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xb470('0xb'),_0xb470('0xc'),'interface'],'where':_0x481e0c,'limit':0x1}})[_0xb470('0xd')](function(_0x12ec2b){logger['debug']('[utils][getUser]\x20where:%s',JSON['stringify'](_0x481e0c),_0x12ec2b?util[_0xb470('0x6')](_0x12ec2b,{'showHidden':![],'depth':null}):'');return _0x12ec2b['result'][_0xb470('0xe')]?_0x12ec2b[_0xb470('0xf')][0x0]:null;});}exports[_0xb470('0x10')]=function(_0x4eea79){return new BPromise(function(_0x21197b,_0x24fc51){if(_0x4eea79){return getUser({'internal':_0x4eea79})['then'](function(_0xa34587){logger[_0xb470('0x5')](_0xb470('0x11'),_0x4eea79,_0xa34587?_0xb470('0x12'):'notfound');return _0x21197b(_0xa34587);})[_0xb470('0x13')](function(_0x30cc92){logger[_0xb470('0x8')]('[utils][getUserByInternal]',_0x30cc92?util[_0xb470('0x6')](_0x30cc92,{'showHidden':![],'depth':null}):'');return _0x21197b(null);});}return _0x21197b(null);});};exports[_0xb470('0x14')]=function(_0x1ea097){return new BPromise(function(_0x3642d2,_0x5613e0){if(_0x1ea097){return getUser({'interface':_0x1ea097})['then'](function(_0x4eb91e){logger[_0xb470('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1ea097,_0x4eb91e?_0xb470('0x12'):'notfound');return _0x3642d2(_0x4eb91e);})[_0xb470('0x13')](function(_0x29b20f){logger[_0xb470('0x8')](_0xb470('0x15'),_0x29b20f?util['inspect'](_0x29b20f,{'showHidden':![],'depth':null}):'');return _0x3642d2(null);});}return _0x3642d2(null);});};exports[_0xb470('0x16')]=function(_0x100cd9){return new BPromise(function(_0x1f4b29,_0x2f7409){if(_0x100cd9){return getUser({'name':_0x100cd9})['then'](function(_0x1c8d88){logger[_0xb470('0x5')](_0xb470('0x17'),_0x100cd9,_0x1c8d88?'found':_0xb470('0x18'));return _0x1f4b29(_0x1c8d88);})['catch'](function(_0x3367dc){logger[_0xb470('0x8')]('[utils][getUserByName]',_0x3367dc?util[_0xb470('0x6')](_0x3367dc,{'showHidden':![],'depth':null}):'');return _0x1f4b29(null);});}return _0x1f4b29(null);});};exports[_0xb470('0x19')]=function(_0x33a578){return new BPromise(function(_0x1d37a2,_0x419b8d){if(_0x33a578){return client[_0xb470('0x9')](_0xb470('0x1a'),{'options':{'raw':!![],'attributes':['id',_0xb470('0xc'),'type',_0xb470('0x1b'),_0xb470('0x1c')],'where':{'name':_0x33a578},'limit':0x1}})[_0xb470('0xd')](function(_0x4bf3ac){logger[_0xb470('0x7')](_0xb470('0x1d'),_0x33a578,_0x4bf3ac?util[_0xb470('0x6')](_0x4bf3ac,{'showHidden':![],'depth':null}):'');logger[_0xb470('0x5')](_0xb470('0x1e'),_0x33a578,_0x4bf3ac?_0xb470('0x12'):_0xb470('0x18'));return _0x1d37a2(_0x4bf3ac['result'][_0xb470('0xe')]?_0x4bf3ac['result'][0x0]:null);})[_0xb470('0x13')](function(_0x30fb22){logger['error']('[utils][getVoiceQueueByName]',_0x30fb22?util[_0xb470('0x6')](_0x30fb22,{'showHidden':![],'depth':null}):'');return _0x1d37a2(null);});}return _0x1d37a2(null);});};exports['addTime']=function(_0x248beb,_0x2760fe){return moment(_0x248beb)[_0xb470('0x1f')](_0x2760fe,'seconds')[_0xb470('0x20')](_0xb470('0x21'));};exports['subtractTime']=function(_0x4fbbe6,_0x14bb2b){return moment(_0x4fbbe6)[_0xb470('0x22')](_0x14bb2b,_0xb470('0x23'))[_0xb470('0x20')](_0xb470('0x21'));};exports['diffTime']=function(_0x315063,_0x501e2a){return moment(_0x315063)[_0xb470('0x24')](moment(_0x501e2a),_0xb470('0x23'));};exports[_0xb470('0x25')]=function(_0x3d8131,_0x26c741){return parseInt(_0x3d8131,0xa)+parseInt(_0x26c741,0xa);};exports[_0xb470('0x26')]=function(){return moment()['format'](_0xb470('0x21'));};exports[_0xb470('0x27')]=function(_0x365445,_0x3b72c4){if(_0x3b72c4){return moment(_0x365445)['isAfter'](_0x3b72c4);}return!![];};exports[_0xb470('0x28')]=function(_0x1e786b,_0x112319){if(_0x112319){return moment(_0x1e786b)[_0xb470('0x28')](_0x112319);}else if(_0x1e786b){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 c5cc752..0861801 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 _0xe3e1=['test','setupLoggers','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','then','user','data','timestamp','catch','api','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','inspect','logger','%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)','remoteAddress','responseTime','other','agent_id','agent_name'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xe3e1,0x136));var _0x1e3e=function(_0xcba88d,_0x4d4002){_0xcba88d=_0xcba88d-0x0;var _0x2305bd=_0xe3e1[_0xcba88d];return _0x2305bd;};var fs=require('fs-extra');var _=require(_0x1e3e('0x0'));var ewinston=require(_0x1e3e('0x1'));var path=require(_0x1e3e('0x2'));var util=require(_0x1e3e('0x3'));var fileLogger=require(_0x1e3e('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x1e3e('0x5')];var maskSensitiveData=require(_0x1e3e('0x6'))[_0x1e3e('0x7')];function ClientSideLogger(){function _0x4d21a9(_0x47f931){var _0x1532c3=path[_0x1e3e('0x8')](_0x1e3e('0x9'),_0x1e3e('0xa'),_0x1e3e('0xb'));var _0x4fe8f0=path[_0x1e3e('0x8')](_0x1e3e('0xc'),_0x47f931[_0x1e3e('0xd')]+'-'+_0x47f931[_0x1e3e('0xe')]);return fs['ensureDir'](path['join'](_0x1532c3,_0x4fe8f0))[_0x1e3e('0xf')](function(){var _0xf5aaa=fileLogger(_0x1e3e('0xc'),path[_0x1e3e('0x8')](_0x1532c3,_0x4fe8f0));return _0xf5aaa;})['catch'](function(_0x41ed48){throw _0x41ed48;});}this[_0x1e3e('0xa')]=function(_0x57971a,_0x6c7ad,_0x27817a,_0x34332e){return _0x4d21a9(_0x57971a[_0x1e3e('0x10')])[_0x1e3e('0xf')](function(_0x11641d){var _0x32b7cc=_0x11641d[_0x6c7ad];return _0x32b7cc;})[_0x1e3e('0xf')](function(_0x3f01a3){var _0x47bb0f=_0x57971a[_0x1e3e('0x10')]?_0x57971a[_0x1e3e('0x10')]['id']:'no-user';var _0x42f579=_0x34332e[_0x1e3e('0x11')];var _0x303464=_0x34332e[_0x1e3e('0x12')];var _0x1d65c8=new Date(Number(_0x303464));return _0x3f01a3(_0x47bb0f,_0x1d65c8,_0x27817a,_0x42f579);})[_0x1e3e('0x13')](function(_0xd5768d){fileLogger('client')['error'](_0xd5768d);});};}function setupLoggers(_0x152333){return new Promise(function(_0xe76cac){var _0x8ed332=new ClientSideLogger();var _0x487806=fileLogger(_0x1e3e('0x14'));var _0x7cae56=fileLogger('auth');_0x152333[_0x1e3e('0x15')]('client-side-logger',_0x8ed332);_0x152333[_0x1e3e('0x16')](ewinston['logger']({'winstonInstance':_0x487806,'meta':![],'statusLevels':!![],'msg':function(_0x7c999b,_0x78bfd6){var _0x483574=_0x1e3e('0x17');if(!_['isEmpty'](_0x7c999b[_0x1e3e('0x18')])){_0x483574+='\x20body=%s';var _0x3e056a=_0x7c999b[_0x1e3e('0x18')];maskSensitiveData(_0x3e056a);}return safeTemplate(util[_0x1e3e('0x19')](_0x483574,_0x7c999b[_0x1e3e('0x1a')],_0x7c999b[_0x1e3e('0x1b')][_0x1e3e('0x1c')]?_0x7c999b['headers'][_0x1e3e('0x1c')]:_0x7c999b[_0x1e3e('0x1d')]['remoteAddress']||_0x7c999b['ip'],_0x7c999b[_0x1e3e('0x1e')],_0x78bfd6[_0x1e3e('0x1f')],_0x78bfd6['responseTime'],_0x7c999b[_0x1e3e('0x10')]?_0x7c999b['user']['id']:null,_0x7c999b[_0x1e3e('0x10')]?_0x7c999b['user'][_0x1e3e('0xe')]:null,_0x7c999b[_0x1e3e('0x10')]?_0x7c999b[_0x1e3e('0x10')][_0x1e3e('0xd')]:null,_0x3e056a?util[_0x1e3e('0x20')](_0x3e056a,![],null):''));}}));_0x152333[_0x1e3e('0x16')](ewinston[_0x1e3e('0x21')]({'winstonInstance':_0x7cae56,'meta':![],'statusLevels':!![],'msg':function(_0x46b158,_0x3c26d7){var _0xeb2b83=_0x1e3e('0x22');if(_0x46b158[_0x1e3e('0x18')]&&_0x46b158['body'][_0x1e3e('0x23')]&&_0x46b158['body']['agent_id']){_0xeb2b83=_0x1e3e('0x24');}return util[_0x1e3e('0x19')](_0xeb2b83,_0x46b158['method'],_0x46b158[_0x1e3e('0x1b')]['x-forwarded-for']?_0x46b158['headers']['x-forwarded-for']:_0x46b158['connection'][_0x1e3e('0x25')]||_0x46b158['ip'],_0x46b158[_0x1e3e('0x1e')],_0x3c26d7['statusCode'],_0x3c26d7[_0x1e3e('0x26')],_0x46b158[_0x1e3e('0x10')]?_0x46b158[_0x1e3e('0x10')]['id']:null,_0x46b158[_0x1e3e('0x10')]?_0x46b158[_0x1e3e('0x10')][_0x1e3e('0xe')]:null,_0x46b158[_0x1e3e('0x10')]?_0x46b158[_0x1e3e('0x10')][_0x1e3e('0xd')]:null,_0x46b158[_0x1e3e('0x18')]&&_0x46b158['body'][_0x1e3e('0x23')]?_0x46b158[_0x1e3e('0x18')][_0x1e3e('0x23')]:_0x1e3e('0x27'),_0x46b158[_0x1e3e('0x18')]&&_0x46b158['body'][_0x1e3e('0x28')]?_0x46b158[_0x1e3e('0x18')][_0x1e3e('0x28')]:'',_0x46b158[_0x1e3e('0x18')]&&_0x46b158[_0x1e3e('0x18')][_0x1e3e('0x29')]?_0x46b158[_0x1e3e('0x18')][_0x1e3e('0x29')]:'');},'ignoreRoute':function(_0x4438cf){var _0x324c46=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x324c46[_0x1e3e('0x2a')](_0x4438cf[_0x1e3e('0x1e')]);}}));return _0xe76cac();});}exports[_0x1e3e('0x2b')]=setupLoggers; \ No newline at end of file +var _0x8dba=['x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','method','responseTime','name','device','agent_name','test','setupLoggers','fs-extra','express-winston','path','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','role','ensureDir','then','client','catch','user','no-user','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8dba,0x13c));var _0xa8db=function(_0x41d747,_0x124caf){_0x41d747=_0x41d747-0x0;var _0x1aed0b=_0x8dba[_0x41d747];return _0x1aed0b;};var fs=require(_0xa8db('0x0'));var _=require('lodash');var ewinston=require(_0xa8db('0x1'));var path=require(_0xa8db('0x2'));var util=require('util');var fileLogger=require(_0xa8db('0x3'))[_0xa8db('0x4')];var safeTemplate=require(_0xa8db('0x5'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0xa8db('0x6')];function ClientSideLogger(){function _0x4d7187(_0x444a09){var _0x1bd8c9=path[_0xa8db('0x7')](_0xa8db('0x8'),_0xa8db('0x9'),'xcally');var _0x112d1a=path[_0xa8db('0x7')]('client',_0x444a09[_0xa8db('0xa')]+'-'+_0x444a09['name']);return fs[_0xa8db('0xb')](path[_0xa8db('0x7')](_0x1bd8c9,_0x112d1a))[_0xa8db('0xc')](function(){var _0x35e367=fileLogger(_0xa8db('0xd'),path['join'](_0x1bd8c9,_0x112d1a));return _0x35e367;})[_0xa8db('0xe')](function(_0xf6868f){throw _0xf6868f;});}this['log']=function(_0x1e5fe9,_0x522f54,_0x20df0e,_0xf6bb84){return _0x4d7187(_0x1e5fe9['user'])[_0xa8db('0xc')](function(_0x37b9d7){var _0xe8ca66=_0x37b9d7[_0x522f54];return _0xe8ca66;})[_0xa8db('0xc')](function(_0x2957ca){var _0x3b11e9=_0x1e5fe9[_0xa8db('0xf')]?_0x1e5fe9[_0xa8db('0xf')]['id']:_0xa8db('0x10');var _0x40a6a8=_0xf6bb84['data'];var _0x1887c3=_0xf6bb84['timestamp'];var _0x218500=new Date(Number(_0x1887c3));return _0x2957ca(_0x3b11e9,_0x218500,_0x20df0e,_0x40a6a8);})[_0xa8db('0xe')](function(_0x1db10b){fileLogger(_0xa8db('0xd'))['error'](_0x1db10b);});};}function setupLoggers(_0x38ee1e){return new Promise(function(_0x1db41b){var _0x561d2b=new ClientSideLogger();var _0x13a6fd=fileLogger(_0xa8db('0x11'));var _0x3f77f2=fileLogger(_0xa8db('0x12'));_0x38ee1e[_0xa8db('0x13')](_0xa8db('0x14'),_0x561d2b);_0x38ee1e[_0xa8db('0x15')](ewinston[_0xa8db('0x16')]({'winstonInstance':_0x13a6fd,'meta':![],'statusLevels':!![],'msg':function(_0x460890,_0x52dece){var _0x3d729b=_0xa8db('0x17');if(!_[_0xa8db('0x18')](_0x460890['body'])){_0x3d729b+='\x20body=%s';var _0x3efd8b=_0x460890[_0xa8db('0x19')];maskSensitiveData(_0x3efd8b);}return safeTemplate(util[_0xa8db('0x1a')](_0x3d729b,_0x460890['method'],_0x460890[_0xa8db('0x1b')][_0xa8db('0x1c')]?_0x460890['headers']['x-forwarded-for']:_0x460890[_0xa8db('0x1d')][_0xa8db('0x1e')]||_0x460890['ip'],_0x460890[_0xa8db('0x1f')],_0x52dece[_0xa8db('0x20')],_0x52dece['responseTime'],_0x460890['user']?_0x460890[_0xa8db('0xf')]['id']:null,_0x460890[_0xa8db('0xf')]?_0x460890[_0xa8db('0xf')]['name']:null,_0x460890[_0xa8db('0xf')]?_0x460890[_0xa8db('0xf')][_0xa8db('0xa')]:null,_0x3efd8b?util[_0xa8db('0x21')](_0x3efd8b,![],null):''));}}));_0x38ee1e[_0xa8db('0x15')](ewinston[_0xa8db('0x16')]({'winstonInstance':_0x3f77f2,'meta':![],'statusLevels':!![],'msg':function(_0x551e65,_0x329b49){var _0x3a6b63=_0xa8db('0x22');if(_0x551e65[_0xa8db('0x19')]&&_0x551e65[_0xa8db('0x19')]['device']&&_0x551e65[_0xa8db('0x19')][_0xa8db('0x23')]){_0x3a6b63='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa8db('0x1a')](_0x3a6b63,_0x551e65[_0xa8db('0x24')],_0x551e65[_0xa8db('0x1b')][_0xa8db('0x1c')]?_0x551e65[_0xa8db('0x1b')][_0xa8db('0x1c')]:_0x551e65[_0xa8db('0x1d')][_0xa8db('0x1e')]||_0x551e65['ip'],_0x551e65[_0xa8db('0x1f')],_0x329b49['statusCode'],_0x329b49[_0xa8db('0x25')],_0x551e65[_0xa8db('0xf')]?_0x551e65[_0xa8db('0xf')]['id']:null,_0x551e65['user']?_0x551e65[_0xa8db('0xf')][_0xa8db('0x26')]:null,_0x551e65['user']?_0x551e65[_0xa8db('0xf')][_0xa8db('0xa')]:null,_0x551e65['body']&&_0x551e65[_0xa8db('0x19')][_0xa8db('0x27')]?_0x551e65['body'][_0xa8db('0x27')]:'other',_0x551e65[_0xa8db('0x19')]&&_0x551e65[_0xa8db('0x19')][_0xa8db('0x23')]?_0x551e65[_0xa8db('0x19')][_0xa8db('0x23')]:'',_0x551e65[_0xa8db('0x19')]&&_0x551e65[_0xa8db('0x19')][_0xa8db('0x28')]?_0x551e65[_0xa8db('0x19')][_0xa8db('0x28')]:'');},'ignoreRoute':function(_0x1aa394){var _0x2a0098=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2a0098[_0xa8db('0x29')](_0x1aa394[_0xa8db('0x1f')]);}}));return _0x1db41b();});}exports[_0xa8db('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index cc624ee..078f309 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x853a=['moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','dowCompare','date','max','min','domCompare','MMM','includes','monthCompare','guess','padStart','length','iftime','lodash'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x853a,0x11e));var _0xa853=function(_0x197385,_0x26bc49){_0x197385=_0x197385-0x0;var _0x4db795=_0x853a[_0x197385];return _0x4db795;};var _=require(_0xa853('0x0'));var moment=require(_0xa853('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa853('0x2')](function(_0x29c1ab){return _0x29c1ab[_0xa853('0x3')];})[_0xa853('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa853('0x5');var EINVALID_DATE=_0xa853('0x6');function throwIfDateNotValid(_0x1967a6){if(!_0x1967a6[_0xa853('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3d9b4a){var _0x295bda=_0x3d9b4a[_0xa853('0x8')](':')[_0xa853('0x2')](function(_0xef09a){return parseInt(_0xef09a,0xa);});var _0x3e0957=_0x295bda[0x0];var _0x50ff60=_0x295bda[0x1];if(_0x3e0957<0x0||_0x3e0957>0x17||_0x50ff60<0x0||_0x50ff60>0x3b){throw new Error(EINVALID_DATE);}return[_0x3e0957,_0x50ff60];}function circularDoWInterval(_0xe5b174,_0x30be66){if(_0xe5b174===_0x30be66){return[_0xe5b174];}else{var _0x1f1e43=moment[_0xa853('0x9')]();moment['locale']('en');var _0x21002a=moment['weekdaysShort']()[_0xa853('0x2')](function(_0x513763){return _0x513763['toLowerCase']();});moment['locale'](_0x1f1e43);var _0x4cde3c=_0x21002a[_0xa853('0xa')](_0xe5b174);var _0x1d6493=_0x21002a[_0xa853('0xa')](_0x30be66);if(_0x1d6493>_0x4cde3c){return _0x21002a[_0xa853('0xb')](_0x4cde3c,_0x1d6493+0x1);}else{var _0x1a2b56=_0x21002a['slice'](0x0,_0x1d6493+0x1);var _0x474d1d=_0x21002a[_0xa853('0xb')](_0x4cde3c);return _0x474d1d[_0xa853('0xc')](_0x1a2b56);}}}module['exports'][_0xa853('0xd')]=circularDoWInterval;function circularMonthInterval(_0x13ef82,_0x481908){if(_0x13ef82===_0x481908){return[_0x13ef82];}else{var _0x189334=moment[_0xa853('0x9')]();moment['locale']('en');var _0x48884e=moment[_0xa853('0xe')]()[_0xa853('0x2')](function(_0x5c5d53){return _0x5c5d53[_0xa853('0xf')]();});moment[_0xa853('0x9')](_0x189334);var _0x2ca770=_0x48884e['indexOf'](_0x13ef82);var _0x36065a=_0x48884e[_0xa853('0xa')](_0x481908);if(_0x36065a>_0x2ca770){return _0x48884e[_0xa853('0xb')](_0x2ca770,_0x36065a+0x1);}else{var _0xf19453=_0x48884e['slice'](0x0,_0x36065a+0x1);var _0x5a8946=_0x48884e[_0xa853('0xb')](_0x2ca770);return _0x5a8946[_0xa853('0xc')](_0xf19453);}}}module[_0xa853('0x10')][_0xa853('0x11')]=circularMonthInterval;function parseDom(_0xa7add0){var _0x244593=parseInt(_0xa7add0,0xa);if(_0x244593<0x1||_0x244593>0x1f){throw new Error(EINVALID_DATE);}return _0x244593;}function timeCompare(_0x4bf71d,_0x4c9e48,_0x4ae8b7){var _0x549cb7=_0x4bf71d[_0xa853('0x12')]();var _0x3fa259=extractTime(_0x4c9e48);var _0x5e7272=_0x3fa259[0x0];var _0x4cae90=_0x3fa259[0x1];var _0x96072e=_0x4bf71d[_0xa853('0x12')]()['hours'](_0x5e7272)['minutes'](_0x4cae90);throwIfDateNotValid(_0x96072e);var _0x927d81=extractTime(_0x4ae8b7);var _0x2074b8=_0x927d81[0x0];var _0x5f4893=_0x927d81[0x1];var _0x2f6a7b=_0x4bf71d[_0xa853('0x12')]()[_0xa853('0x13')](_0x2074b8)[_0xa853('0x14')](_0x5f4893);throwIfDateNotValid(_0x2f6a7b);if(_0x2f6a7b[_0xa853('0x15')](_0x96072e)){var _0x3ff8a2=_0x549cb7['clone']()[_0xa853('0x16')]('day');var _0x20f1f0=_0x549cb7['clone']()[_0xa853('0x17')](_0xa853('0x18'));return _0x549cb7[_0xa853('0x19')](_0x96072e,_0x20f1f0,undefined,'[]')||_0x549cb7[_0xa853('0x19')](_0x3ff8a2,_0x2f6a7b,undefined,'[]');}else{return _0x549cb7[_0xa853('0x19')](_0x96072e,_0x2f6a7b,undefined,'[]');}}module[_0xa853('0x10')][_0xa853('0x1a')]=timeCompare;function dowCompare(_0x3ba8d9,_0x2d24a5,_0x5b02e4){var _0xbce4b6=_0x3ba8d9['locale']('en')[_0xa853('0x1b')](_0xa853('0x1c'))[_0xa853('0xf')]();return circularDoWInterval(_0x2d24a5,_0x5b02e4)['includes'](_0xbce4b6);}module['exports'][_0xa853('0x1d')]=dowCompare;function domCompare(_0xdf6a32,_0x136deb,_0x5f1d5f){var _0x56ae4b=_0xdf6a32[_0xa853('0x1e')]();if(_0x136deb===_0x5f1d5f){return _0x56ae4b===_0x136deb;}else{var _0x408703=_0xdf6a32['daysInMonth']();var _0x12a49e=_0x136deb<_0x5f1d5f;let _0x2fa355=![];var _0x579913=0x0;var _0x12ba11=0x0;if(_0x12a49e){_0x579913=Math[_0xa853('0x1f')](0x1,_0x136deb);_0x12ba11=Math[_0xa853('0x20')](_0x5f1d5f,_0x408703);_0x2fa355=_0x56ae4b>=_0x579913&&_0x56ae4b<=_0x12ba11;}else{_0x579913=Math[_0xa853('0x20')](_0x136deb,_0x408703);_0x12ba11=Math[_0xa853('0x1f')](0x1,_0x5f1d5f);_0x2fa355=_0x56ae4b>=_0x579913||_0x56ae4b<=_0x12ba11;}return _0x2fa355;}}module[_0xa853('0x10')][_0xa853('0x21')]=domCompare;function monthCompare(_0x64574f,_0x3a5849,_0xb60f13){var _0x4c7235=_0x64574f[_0xa853('0x9')]('en')[_0xa853('0x1b')](_0xa853('0x22'))[_0xa853('0xf')]();return circularMonthInterval(_0x3a5849,_0xb60f13)[_0xa853('0x23')](_0x4c7235);}module['exports'][_0xa853('0x24')]=monthCompare;function iftime(_0x28e4f6,_0x48323b=moment['tz'][_0xa853('0x25')](),_0x5002c6=moment()){if(!validateRx['test'](_0x28e4f6)){throw new Error(EINVALID_STRING);}else{var _0x7e492b=(moment['isMoment'](_0x5002c6)?_0x5002c6[_0xa853('0x12')]():moment(_0x5002c6))['tz'](_0x48323b)[_0xa853('0x9')]('en');throwIfDateNotValid(_0x7e492b);var _0x481169=_0x28e4f6['split'](',');var _0x2e481b=_0x481169[0x0];var _0x4a649d=_0x481169[0x1];var _0x5bc1=_0x481169[0x2];var _0x38039a=_0x481169[0x3];let _0xb664d2=!![];if(_0x2e481b!=='*'){var _0x1db215=_0x2e481b[_0xa853('0x8')]('-');var _0x4d462b=_[_0xa853('0x26')](_0x1db215[0x0],0x5,'0');var _0x29e711=_0x1db215['length']===0x2?_['padStart'](_0x1db215[0x1],0x5,'0'):_0x4d462b;_0xb664d2=timeCompare(_0x7e492b,_0x4d462b,_0x29e711);}let _0xbf8404=!![];if(_0x4a649d!=='*'){var _0x33f1b6=_0x4a649d[_0xa853('0x8')]('-');var _0x3ec04c=_0x33f1b6[0x0];var _0x58c1a9=_0x33f1b6[_0xa853('0x27')]===0x2?_0x33f1b6[0x1]:_0x3ec04c;_0xbf8404=dowCompare(_0x7e492b,_0x3ec04c,_0x58c1a9);}let _0x4dbcc5=!![];if(_0x5bc1!=='*'){var _0x1a3dd9=_0x5bc1[_0xa853('0x8')]('-');var _0x1c21f0=parseDom(_0x1a3dd9[0x0]);var _0x4e44be=_0x1a3dd9[_0xa853('0x27')]===0x2?parseDom(_0x1a3dd9[0x1]):_0x1c21f0;_0x4dbcc5=domCompare(_0x7e492b,_0x1c21f0,_0x4e44be);}let _0xb391ac=!![];if(_0x38039a!=='*'){var _0x1df872=_0x38039a[_0xa853('0x8')]('-');var _0x5cc7f3=_0x1df872[0x0];var _0x4e93b7=_0x1df872[_0xa853('0x27')]===0x2?_0x1df872[0x1]:_0x1df872[0x0];_0xb391ac=monthCompare(_0x7e492b,_0x5cc7f3,_0x4e93b7);}return _0xb664d2&&_0xbf8404&&_0x4dbcc5&&_0xb391ac;}}module[_0xa853('0x10')][_0xa853('0x28')]=iftime; \ No newline at end of file +var _0x5a4a=['Date\x20not\x20valid','isValid','locale','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','clone','minutes','hours','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','monthCompare','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid'];(function(_0x32157d,_0x165a52){var _0x11d96b=function(_0x5427ca){while(--_0x5427ca){_0x32157d['push'](_0x32157d['shift']());}};_0x11d96b(++_0x165a52);}(_0x5a4a,0x163));var _0xa5a4=function(_0x49c73b,_0x4fe6e3){_0x49c73b=_0x49c73b-0x0;var _0x3cac41=_0x5a4a[_0x49c73b];return _0x3cac41;};var _=require(_0xa5a4('0x0'));var moment=require(_0xa5a4('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa5a4('0x2')](function(_0x2adc1c){return _0x2adc1c['source'];})[_0xa5a4('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa5a4('0x4');var EINVALID_DATE=_0xa5a4('0x5');function throwIfDateNotValid(_0x1d45b7){if(!_0x1d45b7[_0xa5a4('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x33ac31){var _0x414607=_0x33ac31['split'](':')[_0xa5a4('0x2')](function(_0x5d1c14){return parseInt(_0x5d1c14,0xa);});var _0x36c2c2=_0x414607[0x0];var _0x486712=_0x414607[0x1];if(_0x36c2c2<0x0||_0x36c2c2>0x17||_0x486712<0x0||_0x486712>0x3b){throw new Error(EINVALID_DATE);}return[_0x36c2c2,_0x486712];}function circularDoWInterval(_0x535c37,_0x2fd874){if(_0x535c37===_0x2fd874){return[_0x535c37];}else{var _0x201dea=moment[_0xa5a4('0x7')]();moment['locale']('en');var _0x4dfbbf=moment['weekdaysShort']()['map'](function(_0x2343ce){return _0x2343ce['toLowerCase']();});moment[_0xa5a4('0x7')](_0x201dea);var _0x83a0ea=_0x4dfbbf[_0xa5a4('0x8')](_0x535c37);var _0x1eec4f=_0x4dfbbf[_0xa5a4('0x8')](_0x2fd874);if(_0x1eec4f>_0x83a0ea){return _0x4dfbbf['slice'](_0x83a0ea,_0x1eec4f+0x1);}else{var _0x2f6b40=_0x4dfbbf[_0xa5a4('0x9')](0x0,_0x1eec4f+0x1);var _0x330cc9=_0x4dfbbf[_0xa5a4('0x9')](_0x83a0ea);return _0x330cc9[_0xa5a4('0xa')](_0x2f6b40);}}}module[_0xa5a4('0xb')][_0xa5a4('0xc')]=circularDoWInterval;function circularMonthInterval(_0x36badb,_0x15535d){if(_0x36badb===_0x15535d){return[_0x36badb];}else{var _0x444285=moment[_0xa5a4('0x7')]();moment[_0xa5a4('0x7')]('en');var _0x40d04a=moment[_0xa5a4('0xd')]()[_0xa5a4('0x2')](function(_0x527284){return _0x527284[_0xa5a4('0xe')]();});moment['locale'](_0x444285);var _0x4bb067=_0x40d04a[_0xa5a4('0x8')](_0x36badb);var _0x5bd7b0=_0x40d04a[_0xa5a4('0x8')](_0x15535d);if(_0x5bd7b0>_0x4bb067){return _0x40d04a['slice'](_0x4bb067,_0x5bd7b0+0x1);}else{var _0x37bf12=_0x40d04a[_0xa5a4('0x9')](0x0,_0x5bd7b0+0x1);var _0x360934=_0x40d04a[_0xa5a4('0x9')](_0x4bb067);return _0x360934[_0xa5a4('0xa')](_0x37bf12);}}}module[_0xa5a4('0xb')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x17bc2d){var _0x19af21=parseInt(_0x17bc2d,0xa);if(_0x19af21<0x1||_0x19af21>0x1f){throw new Error(EINVALID_DATE);}return _0x19af21;}function timeCompare(_0x4fd541,_0x3e7dba,_0x371d4f){var _0x34866d=_0x4fd541[_0xa5a4('0xf')]();var _0x6927=extractTime(_0x3e7dba);var _0x4f3514=_0x6927[0x0];var _0x4ccc21=_0x6927[0x1];var _0x98263a=_0x4fd541[_0xa5a4('0xf')]()['hours'](_0x4f3514)[_0xa5a4('0x10')](_0x4ccc21);throwIfDateNotValid(_0x98263a);var _0x69407c=extractTime(_0x371d4f);var _0xac9690=_0x69407c[0x0];var _0x1e5f95=_0x69407c[0x1];var _0x3a5c4d=_0x4fd541['clone']()[_0xa5a4('0x11')](_0xac9690)[_0xa5a4('0x10')](_0x1e5f95);throwIfDateNotValid(_0x3a5c4d);if(_0x3a5c4d['isBefore'](_0x98263a)){var _0x2f8499=_0x34866d[_0xa5a4('0xf')]()[_0xa5a4('0x12')](_0xa5a4('0x13'));var _0x2a3f4c=_0x34866d[_0xa5a4('0xf')]()[_0xa5a4('0x14')](_0xa5a4('0x13'));return _0x34866d['isBetween'](_0x98263a,_0x2a3f4c,undefined,'[]')||_0x34866d['isBetween'](_0x2f8499,_0x3a5c4d,undefined,'[]');}else{return _0x34866d[_0xa5a4('0x15')](_0x98263a,_0x3a5c4d,undefined,'[]');}}module[_0xa5a4('0xb')][_0xa5a4('0x16')]=timeCompare;function dowCompare(_0x25dcb4,_0x16a081,_0x48ab82){var _0x5d9e82=_0x25dcb4['locale']('en')[_0xa5a4('0x17')](_0xa5a4('0x18'))['toLowerCase']();return circularDoWInterval(_0x16a081,_0x48ab82)[_0xa5a4('0x19')](_0x5d9e82);}module[_0xa5a4('0xb')][_0xa5a4('0x1a')]=dowCompare;function domCompare(_0x23dfdb,_0x2fbd2b,_0x43cf35){var _0x518d74=_0x23dfdb[_0xa5a4('0x1b')]();if(_0x2fbd2b===_0x43cf35){return _0x518d74===_0x2fbd2b;}else{var _0x2dd19f=_0x23dfdb[_0xa5a4('0x1c')]();var _0x21418f=_0x2fbd2b<_0x43cf35;let _0x3b44fc=![];var _0x603f94=0x0;var _0x468d57=0x0;if(_0x21418f){_0x603f94=Math['max'](0x1,_0x2fbd2b);_0x468d57=Math[_0xa5a4('0x1d')](_0x43cf35,_0x2dd19f);_0x3b44fc=_0x518d74>=_0x603f94&&_0x518d74<=_0x468d57;}else{_0x603f94=Math[_0xa5a4('0x1d')](_0x2fbd2b,_0x2dd19f);_0x468d57=Math[_0xa5a4('0x1e')](0x1,_0x43cf35);_0x3b44fc=_0x518d74>=_0x603f94||_0x518d74<=_0x468d57;}return _0x3b44fc;}}module['exports'][_0xa5a4('0x1f')]=domCompare;function monthCompare(_0x47ee90,_0x313449,_0x2ee5d2){var _0x9b3373=_0x47ee90[_0xa5a4('0x7')]('en')['format'](_0xa5a4('0x20'))[_0xa5a4('0xe')]();return circularMonthInterval(_0x313449,_0x2ee5d2)[_0xa5a4('0x19')](_0x9b3373);}module[_0xa5a4('0xb')][_0xa5a4('0x21')]=monthCompare;function iftime(_0x3b9bd1,_0x572c69=moment['tz']['guess'](),_0x1e9183=moment()){if(!validateRx[_0xa5a4('0x22')](_0x3b9bd1)){throw new Error(EINVALID_STRING);}else{var _0x24b33d=(moment[_0xa5a4('0x23')](_0x1e9183)?_0x1e9183[_0xa5a4('0xf')]():moment(_0x1e9183))['tz'](_0x572c69)[_0xa5a4('0x7')]('en');throwIfDateNotValid(_0x24b33d);var _0x162ee9=_0x3b9bd1[_0xa5a4('0x24')](',');var _0x3d7003=_0x162ee9[0x0];var _0x101a2e=_0x162ee9[0x1];var _0xeffc62=_0x162ee9[0x2];var _0x33acd7=_0x162ee9[0x3];let _0x55eb29=!![];if(_0x3d7003!=='*'){var _0x56d0f5=_0x3d7003[_0xa5a4('0x24')]('-');var _0x1ab150=_[_0xa5a4('0x25')](_0x56d0f5[0x0],0x5,'0');var _0x1bcd67=_0x56d0f5[_0xa5a4('0x26')]===0x2?_[_0xa5a4('0x25')](_0x56d0f5[0x1],0x5,'0'):_0x1ab150;_0x55eb29=timeCompare(_0x24b33d,_0x1ab150,_0x1bcd67);}let _0x40ace5=!![];if(_0x101a2e!=='*'){var _0x248114=_0x101a2e['split']('-');var _0x481f01=_0x248114[0x0];var _0x25f204=_0x248114[_0xa5a4('0x26')]===0x2?_0x248114[0x1]:_0x481f01;_0x40ace5=dowCompare(_0x24b33d,_0x481f01,_0x25f204);}let _0x40a27e=!![];if(_0xeffc62!=='*'){var _0x53cd3a=_0xeffc62[_0xa5a4('0x24')]('-');var _0x1ed232=parseDom(_0x53cd3a[0x0]);var _0x29333f=_0x53cd3a[_0xa5a4('0x26')]===0x2?parseDom(_0x53cd3a[0x1]):_0x1ed232;_0x40a27e=domCompare(_0x24b33d,_0x1ed232,_0x29333f);}let _0x510faa=!![];if(_0x33acd7!=='*'){var _0x54f9c0=_0x33acd7[_0xa5a4('0x24')]('-');var _0x1661a3=_0x54f9c0[0x0];var _0x376079=_0x54f9c0[_0xa5a4('0x26')]===0x2?_0x54f9c0[0x1]:_0x54f9c0[0x0];_0x510faa=monthCompare(_0x24b33d,_0x1661a3,_0x376079);}return _0x55eb29&&_0x40ace5&&_0x40a27e&&_0x510faa;}}module[_0xa5a4('0xb')][_0xa5a4('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ed7c467..e427a59 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4949=['toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','Logger','transports','%s-%s','error','File','consoleLogger','fileLogger','util','winston','../config/environment','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0x4949,0xeb));var _0x9494=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4949[_0x122ef9];return _0x42fba0;};'use strict';var path=require('path');var util=require(_0x9494('0x0'));var moment=require('moment');var winston=require(_0x9494('0x1'));var config=require(_0x9494('0x2'));var debugLevel=config[_0x9494('0x3')]?config['debugLevel']['toLowerCase']():_0x9494('0x4');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':'redBG\x20white','error':_0x9494('0x5'),'warn':_0x9494('0x6'),'info':_0x9494('0x7'),'print':_0x9494('0x8'),'success':_0x9494('0x9'),'http':'gray','verbose':_0x9494('0xa'),'debug':_0x9494('0xb'),'silly':_0x9494('0xc')};winston[_0x9494('0xd')](XC_LOG_COLORS);function getLogFileName(_0x241bfe,_0x33be1b,_0xdf4c99){var _0x5c54fe=_0x241bfe||_0x9494('0xe');return path[_0x9494('0xf')](_0x5c54fe,util[_0x9494('0x10')](_0x9494('0x11'),_0x33be1b,_0xdf4c99));}function formatter(_0x3f2339,_0x88c770){_0x88c770['message']=_0x88c770[_0x9494('0x12')][_0x9494('0x13')](/@@{/g,_0x9494('0x14'))[_0x9494('0x13')](/}@@/g,_0x9494('0x15'))[_0x9494('0x13')](/@{/g,'{{')[_0x9494('0x13')](/}@/g,'}}');return util[_0x9494('0x10')](_0x9494('0x16'),moment()[_0x9494('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x88c770[_0x9494('0x17')][_0x9494('0x18')](),_0x3f2339,_0x88c770[_0x9494('0x12')]);}function fileFormat(_0x478c34,_0x18cf0f){_0x18cf0f[_0x9494('0x12')]=_0x18cf0f[_0x9494('0x12')][_0x9494('0x13')](/@@{/g,'{{{')[_0x9494('0x13')](/}@@/g,_0x9494('0x15'))[_0x9494('0x13')](/@{/g,'{{')[_0x9494('0x13')](/}@/g,'}}');var _0x5eccd9=_0x18cf0f[_0x9494('0x19')]&&Object['keys'](_0x18cf0f[_0x9494('0x19')])[_0x9494('0x1a')]?'\x0a\x09'+JSON[_0x9494('0x1b')](_0x18cf0f[_0x9494('0x19')]):'';return util[_0x9494('0x10')](_0x9494('0x1c'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x18cf0f['level'][_0x9494('0x18')](),_0x478c34,_0x18cf0f['message'],_0x5eccd9);}function consoleLogger(){var _0xb91389=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x9494('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x2274ef){return formatter('',_0x2274ef);}})]});return _0xb91389;}function fileLogger(_0xb1eb3,_0x402346){var _0x95d4ef=new winston[(_0x9494('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9494('0x1f'))]['File']({'name':util[_0x9494('0x10')](_0x9494('0x20'),_0xb1eb3,_0x9494('0x21')),'filename':getLogFileName(_0x402346,_0xb1eb3,_0x9494('0x21')),'level':_0x9494('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x589f06){return fileFormat(_0xb1eb3,_0x589f06);}}),new winston['transports'][(_0x9494('0x22'))]({'name':util[_0x9494('0x10')]('%s-%s',_0xb1eb3,debugLevel),'filename':getLogFileName(_0x402346,_0xb1eb3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b488b){return fileFormat(_0xb1eb3,_0x1b488b);}}),new winston[(_0x9494('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x402b66){return fileFormat(_0xb1eb3,_0x402b66);}})]});return _0x95d4ef;}exports[_0x9494('0x23')]=consoleLogger;exports[_0x9494('0x24')]=fileLogger; \ No newline at end of file +var _0xd99d=['meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','File','error','transports','%s-%s','consoleLogger','fileLogger','moment','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','gray','bold\x20magenta','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x236007,_0x247df4){var _0x22aff5=function(_0x576e27){while(--_0x576e27){_0x236007['push'](_0x236007['shift']());}};_0x22aff5(++_0x247df4);}(_0xd99d,0x157));var _0xdd99=function(_0x1ef42b,_0x359b56){_0x1ef42b=_0x1ef42b-0x0;var _0xe25e4f=_0xd99d[_0x1ef42b];return _0xe25e4f;};'use strict';var path=require('path');var util=require('util');var moment=require(_0xdd99('0x0'));var winston=require(_0xdd99('0x1'));var config=require(_0xdd99('0x2'));var debugLevel=config[_0xdd99('0x3')]?config[_0xdd99('0x3')][_0xdd99('0x4')]():'info';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':'redBG\x20white','error':_0xdd99('0x5'),'warn':_0xdd99('0x6'),'info':'white','print':'bold\x20white','success':'bold\x20green','http':_0xdd99('0x7'),'verbose':_0xdd99('0x8'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1517e2,_0x2bb408,_0x330918){var _0xdde883=_0x1517e2||_0xdd99('0x9');return path[_0xdd99('0xa')](_0xdde883,util[_0xdd99('0xb')](_0xdd99('0xc'),_0x2bb408,_0x330918));}function formatter(_0x2435d1,_0x54681f){_0x54681f[_0xdd99('0xd')]=_0x54681f[_0xdd99('0xd')][_0xdd99('0xe')](/@@{/g,_0xdd99('0xf'))[_0xdd99('0xe')](/}@@/g,_0xdd99('0x10'))[_0xdd99('0xe')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xdd99('0xb')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xdd99('0x11')),_0x54681f[_0xdd99('0x12')][_0xdd99('0x13')](),_0x2435d1,_0x54681f[_0xdd99('0xd')]);}function fileFormat(_0x345c49,_0x416218){_0x416218[_0xdd99('0xd')]=_0x416218['message'][_0xdd99('0xe')](/@@{/g,_0xdd99('0xf'))[_0xdd99('0xe')](/}@@/g,_0xdd99('0x10'))['replace'](/@{/g,'{{')[_0xdd99('0xe')](/}@/g,'}}');var _0x1e5d37=_0x416218[_0xdd99('0x14')]&&Object[_0xdd99('0x15')](_0x416218['meta'])[_0xdd99('0x16')]?'\x0a\x09'+JSON['stringify'](_0x416218['meta']):'';return util['format'](_0xdd99('0x17'),moment()[_0xdd99('0xb')](_0xdd99('0x11')),_0x416218[_0xdd99('0x12')][_0xdd99('0x13')](),_0x345c49,_0x416218['message'],_0x1e5d37);}function consoleLogger(){var _0x203b61=new winston[(_0xdd99('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xdd99('0x19'))]({'level':_0xdd99('0x1a'),'json':![],'formatter':function(_0x372b5d){return formatter('',_0x372b5d);}})]});return _0x203b61;}function fileLogger(_0x207913,_0x16a021){var _0x567c9b=new winston[(_0xdd99('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xdd99('0x1b'))]({'name':util[_0xdd99('0xb')]('%s-%s',_0x207913,_0xdd99('0x1c')),'filename':getLogFileName(_0x16a021,_0x207913,_0xdd99('0x1c')),'level':_0xdd99('0x1c'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x65a8fc){return fileFormat(_0x207913,_0x65a8fc);}}),new winston[(_0xdd99('0x1d'))][(_0xdd99('0x1b'))]({'name':util[_0xdd99('0xb')](_0xdd99('0x1e'),_0x207913,debugLevel),'filename':getLogFileName(_0x16a021,_0x207913,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b12fc){return fileFormat(_0x207913,_0x3b12fc);}}),new winston[(_0xdd99('0x1d'))][(_0xdd99('0x19'))]({'level':'warn','json':![],'formatter':function(_0x146007){return fileFormat(_0x207913,_0x146007);}})]});return _0x567c9b;}exports[_0xdd99('0x1f')]=consoleLogger;exports[_0xdd99('0x20')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index b34033f..ecec3d5 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 _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x2946f3,_0x31e6b7){var _0x206a6b=function(_0xf5b72e){while(--_0xf5b72e){_0x2946f3['push'](_0x2946f3['shift']());}};_0x206a6b(++_0x31e6b7);}(_0x14a0,0x8e));var _0x014a=function(_0x4ccf3f,_0x216408){_0x4ccf3f=_0x4ccf3f-0x0;var _0x11e3d7=_0x14a0[_0x4ccf3f];return _0x11e3d7;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x25b159,_0x3efee6){var _0x5258c5=function(_0x30f05d){while(--_0x30f05d){_0x25b159['push'](_0x25b159['shift']());}};_0x5258c5(++_0x3efee6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index bcbed74..03d754a 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['exports','replace'];(function(_0x1e8428,_0x2097b0){var _0x100aff=function(_0x724424){while(--_0x724424){_0x1e8428['push'](_0x1e8428['shift']());}};_0x100aff(++_0x2097b0);}(_0xdb28,0x106));var _0x8db2=function(_0x3cc4ec,_0x4fc9fe){_0x3cc4ec=_0x3cc4ec-0x0;var _0x3cd976=_0xdb28[_0x3cc4ec];return _0x3cd976;};module[_0x8db2('0x0')]={'escapeRegExp'(_0x4221b3,_0x1dc797=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4221b3[_0x8db2('0x1')](_0x1dc797,'\x5c$&');}}; \ No newline at end of file +var _0xc4aa=['\x5c$&','exports','replace'];(function(_0x1135fc,_0x37bb1c){var _0x417b15=function(_0x1f022a){while(--_0x1f022a){_0x1135fc['push'](_0x1135fc['shift']());}};_0x417b15(++_0x37bb1c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};module[_0xac4a('0x0')]={'escapeRegExp'(_0x5a86db,_0x40a0d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x5a86db[_0xac4a('0x1')](_0x40a0d0,_0xac4a('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index be2d42b..2e51fb2 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 _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0x24f822,_0x4d33ad){var _0x24bb6e=function(_0x3ef23d){while(--_0x3ef23d){_0x24f822['push'](_0x24f822['shift']());}};_0x24bb6e(++_0x4d33ad);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2a3746,_0x4a8a46){_0x2a3746=_0x2a3746-0x0;var _0x1d7e9a=_0x8f4c[_0x2a3746];return _0x1d7e9a;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('0x7')]=safeTemplate; \ No newline at end of file +var _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x401ccf,_0x38e258){var _0x211c4a=function(_0x334a94){while(--_0x334a94){_0x401ccf['push'](_0x401ccf['shift']());}};_0x211c4a(++_0x38e258);}(_0x4024,0x89));var _0x4402=function(_0x58542b,_0x1caad1){_0x58542b=_0x58542b-0x0;var _0x39c939=_0x4024[_0x58542b];return _0x39c939;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index d3cdd58..2cc2db7 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e72=['pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','resolve','legacy-libs','isArray','apps','name','motion2','env','NODE_PATH'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x1e72,0x13a));var _0x21e7=function(_0x1148e7,_0x52835e){_0x1148e7=_0x1148e7-0x0;var _0x4d6211=_0x1e72[_0x1148e7];return _0x4d6211;};var fs=require(_0x21e7('0x0'));var path=require('path');var config=require(_0x21e7('0x1'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0x21e7('0x2')](root,_0x21e7('0x3'));function setLegacyLibsNodeEnvPath(_0x49a5ea){let _0x22f8ce=![];if(Array[_0x21e7('0x4')](_0x49a5ea[_0x21e7('0x5')])){var _0x3203df=_0x49a5ea[_0x21e7('0x5')]['findIndex'](function(_0x504db3){return _0x504db3[_0x21e7('0x6')]===_0x21e7('0x7');});if(_0x3203df>-0x1){var _0x36f420=_0x49a5ea[_0x21e7('0x5')][_0x3203df];if(typeof _0x36f420[_0x21e7('0x8')][_0x21e7('0x9')]!=='string'){_0x36f420['env']['NODE_PATH']=NODEPATH;_0x22f8ce=!![];}}return{'appConfig':_0x49a5ea,'updated':_0x22f8ce};}}function updateAppConfig(_0x4644aa){return fs[_0x21e7('0xa')](APP_JSON_PATH)[_0x21e7('0xb')](function(_0x5233df){if(_0x5233df){return fs[_0x21e7('0xc')](APP_JSON_PATH)[_0x21e7('0xb')](function(_0x1f4b6c){var _0x1f4086=setLegacyLibsNodeEnvPath(_0x1f4b6c);if(_0x1f4086[_0x21e7('0xd')]){_0x4644aa[_0x21e7('0xe')](_0x21e7('0xf'));return fs[_0x21e7('0x10')](APP_JSON_PATH,_0x1f4b6c,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x21e7('0x2')]();}});}module[_0x21e7('0x11')]=updateAppConfig; \ No newline at end of file +var _0x35f2=['updated','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then','readJSON'];(function(_0x5546d5,_0x35060d){var _0x29c539=function(_0xc9b23e){while(--_0xc9b23e){_0x5546d5['push'](_0x5546d5['shift']());}};_0x29c539(++_0x35060d);}(_0x35f2,0x120));var _0x235f=function(_0x5dd6d1,_0x394c81){_0x5dd6d1=_0x5dd6d1-0x0;var _0x554d58=_0x35f2[_0x5dd6d1];return _0x554d58;};var fs=require(_0x235f('0x0'));var path=require(_0x235f('0x1'));var config=require(_0x235f('0x2'));var root=config[_0x235f('0x3')];var APP_JSON_PATH=path[_0x235f('0x4')](root,'server/app.json');var NODEPATH=path[_0x235f('0x4')](root,_0x235f('0x5'));function setLegacyLibsNodeEnvPath(_0x5d972c){let _0x251e5c=![];if(Array[_0x235f('0x6')](_0x5d972c['apps'])){var _0x183354=_0x5d972c[_0x235f('0x7')][_0x235f('0x8')](function(_0xee00f2){return _0xee00f2[_0x235f('0x9')]===_0x235f('0xa');});if(_0x183354>-0x1){var _0x137ec0=_0x5d972c[_0x235f('0x7')][_0x183354];if(typeof _0x137ec0[_0x235f('0xb')][_0x235f('0xc')]!=='string'){_0x137ec0[_0x235f('0xb')]['NODE_PATH']=NODEPATH;_0x251e5c=!![];}}return{'appConfig':_0x5d972c,'updated':_0x251e5c};}}function updateAppConfig(_0x55c621){return fs[_0x235f('0xd')](APP_JSON_PATH)[_0x235f('0xe')](function(_0x4b4afa){if(_0x4b4afa){return fs[_0x235f('0xf')](APP_JSON_PATH)[_0x235f('0xe')](function(_0x3473a6){var _0x24bb4b=setLegacyLibsNodeEnvPath(_0x3473a6);if(_0x24bb4b[_0x235f('0x10')]){_0x55c621['info']('Updating\x20app.json');return fs[_0x235f('0x11')](APP_JSON_PATH,_0x3473a6,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x235f('0x4')]();}});}module[_0x235f('0x12')]=updateAppConfig; \ No newline at end of file